From: Andrea Amorese Date: Mon, 4 Oct 2021 12:05:22 +0000 (+0200) Subject: Built motion from commit 9a9fea8c.|2.5.35 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css//%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%20%20%201101license.mail?a=commitdiff_plain;h=d3edc7b962d6b9ee690ec2376201978d058b8a69;p=motion2.git Built motion from commit 9a9fea8c.|2.5.35 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index e472eb8..7691d97 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-10-04T10:16:04.457Z", + "time": "2021-10-04T11:51:09.735Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index b37deb4..d7f2a76 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-10-04T10:16:04.457Z", + "time": "2021-10-04T11:51:09.735Z", "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 0dd3278..1764256 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 _0x1da4=['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','VIRTUAL','getDataValue','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'];(function(_0xeb74f,_0x16c8b5){var _0x3ab646=function(_0x2ebcd5){while(--_0x2ebcd5){_0xeb74f['push'](_0xeb74f['shift']());}};_0x3ab646(++_0x16c8b5);}(_0x1da4,0xd8));var _0x41da=function(_0x26709c,_0x5b9ace){_0x26709c=_0x26709c-0x0;var _0x5c7e51=_0x1da4[_0x26709c];return _0x5c7e51;};'use strict';var Sequelize=require(_0x41da('0x0'));module[_0x41da('0x1')]={'name':{'type':Sequelize[_0x41da('0x2')],'get':function(_0x2dc686){return this[_0x41da('0x3')]('action');}},'action':{'type':Sequelize[_0x41da('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x41da('0x5'),_0x41da('0x6'),_0x41da('0x7'),_0x41da('0x8'),_0x41da('0x9'),_0x41da('0xa'),_0x41da('0xb'),_0x41da('0xc')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x41da('0xd')},'data1':{'type':Sequelize[_0x41da('0x4')](0x1000),'comment':_0x41da('0xe')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x41da('0xf')},'data3':{'type':Sequelize[_0x41da('0x4')](0x1000),'comment':_0x41da('0x10')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x41da('0x4')](0x1000),'comments':_0x41da('0x11')},'data6':{'type':Sequelize[_0x41da('0x4')],'comments':_0x41da('0x12')},'data7':{'type':Sequelize[_0x41da('0x13')],'comments':_0x41da('0x14')}}; \ No newline at end of file +var _0x8273=['script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','sequelize','exports','getDataValue','action','integration','motionbar','jscripty','urlForward','browser'];(function(_0x1ddb60,_0x2747ef){var _0x267afa=function(_0x2d1b65){while(--_0x2d1b65){_0x1ddb60['push'](_0x1ddb60['shift']());}};_0x267afa(++_0x2747ef);}(_0x8273,0x1d3));var _0x3827=function(_0x169f0c,_0x2c8ab7){_0x169f0c=_0x169f0c-0x0;var _0x64ad6b=_0x8273[_0x169f0c];return _0x64ad6b;};'use strict';var Sequelize=require(_0x3827('0x0'));module[_0x3827('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x16e4f4){return this[_0x3827('0x2')](_0x3827('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x3827('0x4'),_0x3827('0x5'),_0x3827('0x6'),_0x3827('0x7'),_0x3827('0x8'),'bot',_0x3827('0x9')]],'msg':_0x3827('0xa')}},'comment':_0x3827('0xa')},'data1':{'type':Sequelize[_0x3827('0xb')](0x1000),'comment':_0x3827('0xc')},'data2':{'type':Sequelize[_0x3827('0xb')](0x1000),'comment':_0x3827('0xd')},'data3':{'type':Sequelize[_0x3827('0xb')](0x1000),'comment':_0x3827('0xe')},'data4':{'type':Sequelize[_0x3827('0xb')](0x1000),'comments':_0x3827('0xf')},'data5':{'type':Sequelize[_0x3827('0xb')](0x1000),'comments':_0x3827('0x10')},'data6':{'type':Sequelize[_0x3827('0xb')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize['TEXT'],'comments':'urlForward[body]'}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index c7e689c..acd9880 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 _0x3378=['then','error','stack','name','send','body','Action','find','params','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x3378,0xca));var _0x8337=function(_0x1b4c04,_0x8d961d){_0x1b4c04=_0x1b4c04-0x0;var _0x374f5d=_0x3378[_0x1b4c04];return _0x374f5d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8337('0x0'));var zipdir=require(_0x8337('0x1'));var jsonpatch=require(_0x8337('0x2'));var rp=require(_0x8337('0x3'));var moment=require(_0x8337('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8337('0x5'));var util=require(_0x8337('0x6'));var path=require(_0x8337('0x7'));var sox=require(_0x8337('0x8'));var csv=require(_0x8337('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8337('0xa'));var _=require(_0x8337('0xb'));var squel=require('squel');var crypto=require(_0x8337('0xc'));var jsforce=require(_0x8337('0xd'));var deskjs=require(_0x8337('0xe'));var toCsv=require(_0x8337('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8337('0xf'));var authService=require(_0x8337('0x10'));var qs=require(_0x8337('0x11'));var as=require(_0x8337('0x12'));var hardwareService=require(_0x8337('0x13'));var logger=require(_0x8337('0x14'))(_0x8337('0x15'));var utils=require(_0x8337('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8337('0x17'))['db'];function respondWithStatusCode(_0xb33423,_0x598bf5){_0x598bf5=_0x598bf5||0xcc;return function(_0x2ca27f){if(_0x2ca27f){return _0xb33423[_0x8337('0x18')](_0x598bf5);}return _0xb33423[_0x8337('0x19')](_0x598bf5)[_0x8337('0x1a')]();};}function respondWithResult(_0x2bec1c,_0x24ff85){_0x24ff85=_0x24ff85||0xc8;return function(_0xa3d98a){if(_0xa3d98a){return _0x2bec1c[_0x8337('0x19')](_0x24ff85)[_0x8337('0x1b')](_0xa3d98a);}};}function respondWithFilteredResult(_0x37a55e,_0x38b0e5){return function(_0x42650a){if(_0x42650a){var _0x331a00=typeof _0x38b0e5[_0x8337('0x1c')]===_0x8337('0x1d')&&typeof _0x38b0e5[_0x8337('0x1e')]===_0x8337('0x1d');var _0x42293e=_0x42650a[_0x8337('0x1f')];var _0x105f61=_0x331a00?0x0:_0x38b0e5['offset'];var _0x4b8ca4=_0x331a00?_0x42650a[_0x8337('0x1f')]:_0x38b0e5[_0x8337('0x1c')]+_0x38b0e5['limit'];var _0x467738;if(_0x4b8ca4>=_0x42293e){_0x4b8ca4=_0x42293e;_0x467738=0xc8;}else{_0x467738=0xce;}_0x37a55e[_0x8337('0x19')](_0x467738);return _0x37a55e['set'](_0x8337('0x20'),_0x105f61+'-'+_0x4b8ca4+'/'+_0x42293e)[_0x8337('0x1b')](_0x42650a);}return null;};}function patchUpdates(_0x4a625b){return function(_0x3f7a5c){try{jsonpatch[_0x8337('0x21')](_0x3f7a5c,_0x4a625b,!![]);}catch(_0x26bd3d){return BPromise[_0x8337('0x22')](_0x26bd3d);}return _0x3f7a5c[_0x8337('0x23')]();};}function saveUpdates(_0x39eccb,_0x21a923){return function(_0xcd98ba){if(_0xcd98ba){return _0xcd98ba[_0x8337('0x24')](_0x39eccb)['then'](function(_0x205030){return _0x205030;});}return null;};}function removeEntity(_0x5e2b82,_0x1ac2d8){return function(_0x507a6c){if(_0x507a6c){return _0x507a6c[_0x8337('0x25')]()[_0x8337('0x26')](function(){_0x5e2b82[_0x8337('0x19')](0xcc)[_0x8337('0x1a')]();});}};}function handleEntityNotFound(_0x242554,_0xa31f34){return function(_0x4ea5a2){if(!_0x4ea5a2){_0x242554[_0x8337('0x18')](0x194);}return _0x4ea5a2;};}function handleError(_0x38455a,_0x2d15b7){_0x2d15b7=_0x2d15b7||0x1f4;return function(_0x227ad9){logger[_0x8337('0x27')](_0x227ad9[_0x8337('0x28')]);if(_0x227ad9[_0x8337('0x29')]){delete _0x227ad9['name'];}_0x38455a[_0x8337('0x19')](_0x2d15b7)[_0x8337('0x2a')](_0x227ad9);};}exports['update']=function(_0xeb28c3,_0x4c890e){if(_0xeb28c3[_0x8337('0x2b')]['id']){delete _0xeb28c3[_0x8337('0x2b')]['id'];}return db[_0x8337('0x2c')][_0x8337('0x2d')]({'where':{'id':_0xeb28c3[_0x8337('0x2e')]['id']}})[_0x8337('0x26')](handleEntityNotFound(_0x4c890e,null))[_0x8337('0x26')](saveUpdates(_0xeb28c3[_0x8337('0x2b')],null))[_0x8337('0x26')](respondWithResult(_0x4c890e,null))[_0x8337('0x2f')](handleError(_0x4c890e,null));};exports[_0x8337('0x25')]=function(_0x5185af,_0x302589){return db['Action'][_0x8337('0x2d')]({'where':{'id':_0x5185af[_0x8337('0x2e')]['id']}})[_0x8337('0x26')](handleEntityNotFound(_0x302589,null))[_0x8337('0x26')](removeEntity(_0x302589,null))['catch'](handleError(_0x302589,null));}; \ No newline at end of file +var _0x5fba=['catch','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','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','send','body','Action','find','params'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5fba,0x15f));var _0xa5fb=function(_0x122e72,_0x5b155b){_0x122e72=_0x122e72-0x0;var _0x480db6=_0x5fba[_0x122e72];return _0x480db6;};'use strict';var emlformat=require(_0xa5fb('0x0'));var rimraf=require(_0xa5fb('0x1'));var zipdir=require(_0xa5fb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa5fb('0x3'));var moment=require(_0xa5fb('0x4'));var BPromise=require(_0xa5fb('0x5'));var Mustache=require(_0xa5fb('0x6'));var util=require(_0xa5fb('0x7'));var path=require(_0xa5fb('0x8'));var sox=require(_0xa5fb('0x9'));var csv=require(_0xa5fb('0xa'));var ejs=require(_0xa5fb('0xb'));var fs=require('fs');var fs_extra=require(_0xa5fb('0xc'));var _=require(_0xa5fb('0xd'));var squel=require(_0xa5fb('0xe'));var crypto=require(_0xa5fb('0xf'));var jsforce=require(_0xa5fb('0x10'));var deskjs=require(_0xa5fb('0x11'));var toCsv=require(_0xa5fb('0xa'));var querystring=require(_0xa5fb('0x12'));var Papa=require(_0xa5fb('0x13'));var Redis=require('ioredis');var authService=require(_0xa5fb('0x14'));var qs=require(_0xa5fb('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa5fb('0x16'));var logger=require(_0xa5fb('0x17'))('api');var utils=require(_0xa5fb('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xa5fb('0x19'));var db=require(_0xa5fb('0x1a'))['db'];function respondWithStatusCode(_0x59362f,_0x59ad8e){_0x59ad8e=_0x59ad8e||0xcc;return function(_0x17ef99){if(_0x17ef99){return _0x59362f[_0xa5fb('0x1b')](_0x59ad8e);}return _0x59362f['status'](_0x59ad8e)[_0xa5fb('0x1c')]();};}function respondWithResult(_0x52680c,_0x556a0e){_0x556a0e=_0x556a0e||0xc8;return function(_0x27655b){if(_0x27655b){return _0x52680c[_0xa5fb('0x1d')](_0x556a0e)[_0xa5fb('0x1e')](_0x27655b);}};}function respondWithFilteredResult(_0x39d123,_0x225ea6){return function(_0x9fa963){if(_0x9fa963){var _0x5e90f9=typeof _0x225ea6[_0xa5fb('0x1f')]===_0xa5fb('0x20')&&typeof _0x225ea6['limit']===_0xa5fb('0x20');var _0x2c9b7c=_0x9fa963[_0xa5fb('0x21')];var _0x46ae11=_0x5e90f9?0x0:_0x225ea6[_0xa5fb('0x1f')];var _0x22221f=_0x5e90f9?_0x9fa963[_0xa5fb('0x21')]:_0x225ea6['offset']+_0x225ea6[_0xa5fb('0x22')];var _0x39ce4b;if(_0x22221f>=_0x2c9b7c){_0x22221f=_0x2c9b7c;_0x39ce4b=0xc8;}else{_0x39ce4b=0xce;}_0x39d123['status'](_0x39ce4b);return _0x39d123[_0xa5fb('0x23')](_0xa5fb('0x24'),_0x46ae11+'-'+_0x22221f+'/'+_0x2c9b7c)[_0xa5fb('0x1e')](_0x9fa963);}return null;};}function patchUpdates(_0x2bc550){return function(_0x2402b8){try{jsonpatch[_0xa5fb('0x25')](_0x2402b8,_0x2bc550,!![]);}catch(_0x5e32a9){return BPromise['reject'](_0x5e32a9);}return _0x2402b8[_0xa5fb('0x26')]();};}function saveUpdates(_0x3a15d5,_0x2fe79a){return function(_0x46e89f){if(_0x46e89f){return _0x46e89f[_0xa5fb('0x27')](_0x3a15d5)['then'](function(_0x3e2703){return _0x3e2703;});}return null;};}function removeEntity(_0x1ed9fa,_0x147e30){return function(_0x331ce1){if(_0x331ce1){return _0x331ce1[_0xa5fb('0x28')]()[_0xa5fb('0x29')](function(){_0x1ed9fa[_0xa5fb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6bbe9b,_0x2e2a45){return function(_0x34405a){if(!_0x34405a){_0x6bbe9b['sendStatus'](0x194);}return _0x34405a;};}function handleError(_0x3d8854,_0x5439a1){_0x5439a1=_0x5439a1||0x1f4;return function(_0x1a0415){logger[_0xa5fb('0x2a')](_0x1a0415[_0xa5fb('0x2b')]);if(_0x1a0415['name']){delete _0x1a0415['name'];}_0x3d8854['status'](_0x5439a1)[_0xa5fb('0x2c')](_0x1a0415);};}exports[_0xa5fb('0x27')]=function(_0x4e6700,_0xc471e3){if(_0x4e6700['body']['id']){delete _0x4e6700[_0xa5fb('0x2d')]['id'];}return db[_0xa5fb('0x2e')][_0xa5fb('0x2f')]({'where':{'id':_0x4e6700[_0xa5fb('0x30')]['id']}})[_0xa5fb('0x29')](handleEntityNotFound(_0xc471e3,null))['then'](saveUpdates(_0x4e6700[_0xa5fb('0x2d')],null))['then'](respondWithResult(_0xc471e3,null))[_0xa5fb('0x31')](handleError(_0xc471e3,null));};exports['destroy']=function(_0x2ef94c,_0xa000c5){return db['Action'][_0xa5fb('0x2f')]({'where':{'id':_0x2ef94c['params']['id']}})[_0xa5fb('0x29')](handleEntityNotFound(_0xa000c5,null))[_0xa5fb('0x29')](removeEntity(_0xa000c5,null))[_0xa5fb('0x31')](handleError(_0xa000c5,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index dfbde9d..7668fd5 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 _0x137b=['exports','define','Action','tools_actions','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./action.attributes'];(function(_0x416c91,_0x2fa7f5){var _0x192761=function(_0x547f50){while(--_0x547f50){_0x416c91['push'](_0x416c91['shift']());}};_0x192761(++_0x2fa7f5);}(_0x137b,0xac));var _0xb137=function(_0x4a1353,_0x2fbe86){_0x4a1353=_0x4a1353-0x0;var _0x3805cc=_0x137b[_0x4a1353];return _0x3805cc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb137('0x0'))(_0xb137('0x1'));var moment=require(_0xb137('0x2'));var BPromise=require(_0xb137('0x3'));var rp=require(_0xb137('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb137('0x5'));var config=require(_0xb137('0x6'));var attributes=require(_0xb137('0x7'));module[_0xb137('0x8')]=function(_0x4d7a70,_0x4755da){return _0x4d7a70[_0xb137('0x9')](_0xb137('0xa'),attributes,{'tableName':_0xb137('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa76=['../../config/logger','api','moment','bluebird','path','./action.attributes','exports','tools_actions','lodash'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfa76,0x116));var _0x6fa7=function(_0x1a8b9d,_0x515d5f){_0x1a8b9d=_0x1a8b9d-0x0;var _0xf327ec=_0xfa76[_0x1a8b9d];return _0xf327ec;};'use strict';var _=require(_0x6fa7('0x0'));var util=require('util');var logger=require(_0x6fa7('0x1'))(_0x6fa7('0x2'));var moment=require(_0x6fa7('0x3'));var BPromise=require(_0x6fa7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6fa7('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6fa7('0x6'));module[_0x6fa7('0x7')]=function(_0x44e322,_0xa4782c){return _0x44e322['define']('Action',attributes,{'tableName':_0x6fa7('0x8'),'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 5e1bff4..a2e8f62 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 _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','Action,\x20%s,\x20%s','Action,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x5a4de8,_0x10ab46){var _0x52733d=function(_0x366d6c){while(--_0x366d6c){_0x5a4de8['push'](_0x5a4de8['shift']());}};_0x52733d(++_0x10ab46);}(_0xe14b,0x93));var _0xbe14=function(_0x1fde40,_0x2c75dc){_0x1fde40=_0x1fde40-0x0;var _0x4abfbc=_0xe14b[_0x1fde40];return _0x4abfbc;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file +var _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x11cf34,_0x368891){var _0x54211b=function(_0x524ebf){while(--_0x524ebf){_0x11cf34['push'](_0x11cf34['shift']());}};_0x54211b(++_0x368891);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2300c7,_0x255f74){_0x2300c7=_0x2300c7-0x0;var _0x23f720=_0x5fc3[_0x2300c7];return _0x23f720;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Action,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Action,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Action,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 9530e3c..4a2525a 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 _0xa55a=['isAuthenticated','destroy','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','update','delete'];(function(_0x52b24f,_0xca062d){var _0x46ea6b=function(_0x29f821){while(--_0x29f821){_0x52b24f['push'](_0x52b24f['shift']());}};_0x46ea6b(++_0xca062d);}(_0xa55a,0x6a));var _0xaa55=function(_0x58762c,_0x23f5b3){_0x58762c=_0x58762c-0x0;var _0x1fd080=_0xa55a[_0x58762c];return _0x1fd080;};'use strict';var multer=require(_0xaa55('0x0'));var util=require('util');var path=require(_0xaa55('0x1'));var timeout=require(_0xaa55('0x2'));var express=require(_0xaa55('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xaa55('0x4'));var interaction=require(_0xaa55('0x5'));var config=require(_0xaa55('0x6'));var controller=require('./action.controller');router[_0xaa55('0x7')](_0xaa55('0x8'),auth['isAuthenticated'](),controller[_0xaa55('0x9')]);router[_0xaa55('0xa')](_0xaa55('0x8'),auth[_0xaa55('0xb')](),controller[_0xaa55('0xc')]);module['exports']=router; \ No newline at end of file +var _0x4701=['multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','put','/:id','isAuthenticated','update','delete','destroy','exports'];(function(_0x453f0c,_0x5f1d53){var _0x204e8f=function(_0x48c6a5){while(--_0x48c6a5){_0x453f0c['push'](_0x453f0c['shift']());}};_0x204e8f(++_0x5f1d53);}(_0x4701,0xe4));var _0x1470=function(_0xbb33fa,_0x2edaab){_0xbb33fa=_0xbb33fa-0x0;var _0x1d03de=_0x4701[_0xbb33fa];return _0x1d03de;};'use strict';var multer=require(_0x1470('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1470('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1470('0x2'));var auth=require(_0x1470('0x3'));var interaction=require(_0x1470('0x4'));var config=require('../../config/environment');var controller=require('./action.controller');router[_0x1470('0x5')](_0x1470('0x6'),auth[_0x1470('0x7')](),controller[_0x1470('0x8')]);router[_0x1470('0x9')](_0x1470('0x6'),auth[_0x1470('0x7')](),controller[_0x1470('0xa')]);module[_0x1470('0xb')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 1c45615..8b51814 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 _0x038b=['exports','STRING','TEXT'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x038b,0x114));var _0xb038=function(_0x2b51da,_0x1ae9e9){_0x2b51da=_0x2b51da-0x0;var _0x11b95b=_0x038b[_0x2b51da];return _0x11b95b;};'use strict';var Sequelize=require('sequelize');module[_0xb038('0x0')]={'name':{'type':Sequelize[_0xb038('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xb038('0x1')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xb038('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xb038('0x2')]}}; \ No newline at end of file +var _0x3eea=['STRING','TEXT','sequelize'];(function(_0x4c4f0d,_0x31c9bf){var _0x1c1844=function(_0x18b21b){while(--_0x18b21b){_0x4c4f0d['push'](_0x4c4f0d['shift']());}};_0x1c1844(++_0x31c9bf);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x3adbca,_0x4df665){_0x3adbca=_0x3adbca-0x0;var _0x4769b3=_0x3eea[_0x3adbca];return _0x4769b3;};'use strict';var Sequelize=require(_0xa3ee('0x0'));module['exports']={'name':{'type':Sequelize[_0xa3ee('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa3ee('0x1')]},'parent':{'type':Sequelize[_0xa3ee('0x1')]},'table':{'type':Sequelize[_0xa3ee('0x1')]},'conditions':{'type':Sequelize[_0xa3ee('0x2')]},'joins':{'type':Sequelize[_0xa3ee('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index f7710f0..bb931b1 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 _0xf87a=['Content-Range','apply','reject','save','then','destroy','get','CustomReports','UserProfileResource','status','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','AnalyticCustomReport','includeAll','include','findAll','rows','catch','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','cross_join','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','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','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','replace','function','groupBy','orderBy','order','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','sequelize','toString','QueryTypes','SELECT','left_join','right_join','SUM(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','from','format','foreignKey','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','Limited\x20Query:','fast-json-patch','request-promise','bluebird','mustache','util','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','dbH','sendStatus','offset','undefined','limit','count','set'];(function(_0x58b214,_0x4c5ecf){var _0x19eee3=function(_0x13769e){while(--_0x13769e){_0x58b214['push'](_0x58b214['shift']());}};_0x19eee3(++_0x4c5ecf);}(_0xf87a,0x8b));var _0xaf87=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xf87a[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaf87('0x0'));var rp=require(_0xaf87('0x1'));var moment=require('moment');var BPromise=require(_0xaf87('0x2'));var Mustache=require(_0xaf87('0x3'));var util=require(_0xaf87('0x4'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xaf87('0x5'));var fs=require('fs');var fs_extra=require(_0xaf87('0x6'));var _=require(_0xaf87('0x7'));var squel=require(_0xaf87('0x8'));var crypto=require(_0xaf87('0x9'));var jsforce=require(_0xaf87('0xa'));var deskjs=require(_0xaf87('0xb'));var toCsv=require('to-csv');var querystring=require(_0xaf87('0xc'));var Papa=require(_0xaf87('0xd'));var Redis=require(_0xaf87('0xe'));var authService=require(_0xaf87('0xf'));var qs=require(_0xaf87('0x10'));var as=require(_0xaf87('0x11'));var hardwareService=require(_0xaf87('0x12'));var logger=require(_0xaf87('0x13'))(_0xaf87('0x14'));var utils=require(_0xaf87('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xaf87('0x16')];function respondWithStatusCode(_0x77251f,_0x569c98){_0x569c98=_0x569c98||0xcc;return function(_0x2b29f7){if(_0x2b29f7){return _0x77251f[_0xaf87('0x17')](_0x569c98);}return _0x77251f['status'](_0x569c98)['end']();};}function respondWithResult(_0x49a180,_0x1f2966){_0x1f2966=_0x1f2966||0xc8;return function(_0xadb65c){if(_0xadb65c){return _0x49a180['status'](_0x1f2966)['json'](_0xadb65c);}};}function respondWithFilteredResult(_0x1803ae,_0xb8579d){return function(_0x3e32b2){if(_0x3e32b2){var _0x59841f=typeof _0xb8579d[_0xaf87('0x18')]===_0xaf87('0x19')&&typeof _0xb8579d[_0xaf87('0x1a')]===_0xaf87('0x19');var _0x7def97=_0x3e32b2[_0xaf87('0x1b')];var _0x55df6d=_0x59841f?0x0:_0xb8579d[_0xaf87('0x18')];var _0x4a0248=_0x59841f?_0x3e32b2[_0xaf87('0x1b')]:_0xb8579d[_0xaf87('0x18')]+_0xb8579d[_0xaf87('0x1a')];var _0x48c7ba;if(_0x4a0248>=_0x7def97){_0x4a0248=_0x7def97;_0x48c7ba=0xc8;}else{_0x48c7ba=0xce;}_0x1803ae['status'](_0x48c7ba);return _0x1803ae[_0xaf87('0x1c')](_0xaf87('0x1d'),_0x55df6d+'-'+_0x4a0248+'/'+_0x7def97)['json'](_0x3e32b2);}return null;};}function patchUpdates(_0x4cbf54){return function(_0x1d82cf){try{jsonpatch[_0xaf87('0x1e')](_0x1d82cf,_0x4cbf54,!![]);}catch(_0xe9602b){return BPromise[_0xaf87('0x1f')](_0xe9602b);}return _0x1d82cf[_0xaf87('0x20')]();};}function saveUpdates(_0x329fa1,_0xd185d0){return function(_0xe7a2c3){if(_0xe7a2c3){return _0xe7a2c3['update'](_0x329fa1)[_0xaf87('0x21')](function(_0x93833e){return _0x93833e;});}return null;};}function removeEntity(_0x2ac89d,_0x379912){return function(_0x30de6b){if(_0x30de6b){return _0x30de6b[_0xaf87('0x22')]()['then'](function(){var _0x219090=_0x30de6b[_0xaf87('0x23')]({'plain':!![]});var _0x2665af=_0xaf87('0x24');return db[_0xaf87('0x25')]['destroy']({'where':{'type':_0x2665af,'resourceId':_0x219090['id']}})[_0xaf87('0x21')](function(){return _0x30de6b;});})['then'](function(){_0x2ac89d[_0xaf87('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x548184,_0xfe37f3){return function(_0x52828f){if(!_0x52828f){_0x548184['sendStatus'](0x194);}return _0x52828f;};}function handleError(_0x214fca,_0x19f923){_0x19f923=_0x19f923||0x1f4;return function(_0x47d37c){logger[_0xaf87('0x27')](_0x47d37c[_0xaf87('0x28')]);if(_0x47d37c[_0xaf87('0x29')]){delete _0x47d37c[_0xaf87('0x29')];}_0x214fca['status'](_0x19f923)[_0xaf87('0x2a')](_0x47d37c);};}exports[_0xaf87('0x2b')]=function(_0xb77baf,_0x18efae){var _0x15bb47={},_0x8ccd5e={},_0x47406b={'count':0x0,'rows':[]};var _0x5d7811=_[_0xaf87('0x2c')](db['AnalyticCustomReport']['rawAttributes'],function(_0x5508b3){return{'name':_0x5508b3[_0xaf87('0x2d')],'type':_0x5508b3[_0xaf87('0x2e')][_0xaf87('0x2f')]};});_0x8ccd5e[_0xaf87('0x30')]=_['map'](_0x5d7811,'name');_0x8ccd5e[_0xaf87('0x31')]=_[_0xaf87('0x32')](_0xb77baf[_0xaf87('0x31')]);_0x8ccd5e[_0xaf87('0x33')]=_[_0xaf87('0x34')](_0x8ccd5e[_0xaf87('0x30')],_0x8ccd5e[_0xaf87('0x31')]);_0x15bb47[_0xaf87('0x35')]=_[_0xaf87('0x34')](_0x8ccd5e[_0xaf87('0x30')],qs[_0xaf87('0x36')](_0xb77baf[_0xaf87('0x31')][_0xaf87('0x36')]));_0x15bb47[_0xaf87('0x35')]=_0x15bb47[_0xaf87('0x35')][_0xaf87('0x37')]?_0x15bb47[_0xaf87('0x35')]:_0x8ccd5e[_0xaf87('0x30')];if(!_0xb77baf[_0xaf87('0x31')][_0xaf87('0x38')]('nolimit')){_0x15bb47[_0xaf87('0x1a')]=qs[_0xaf87('0x1a')](_0xb77baf[_0xaf87('0x31')][_0xaf87('0x1a')]);_0x15bb47[_0xaf87('0x18')]=qs['offset'](_0xb77baf['query'][_0xaf87('0x18')]);}_0x15bb47['order']=qs[_0xaf87('0x39')](_0xb77baf['query'][_0xaf87('0x39')]);_0x15bb47[_0xaf87('0x3a')]=qs[_0xaf87('0x33')](_[_0xaf87('0x3b')](_0xb77baf[_0xaf87('0x31')],_0x8ccd5e[_0xaf87('0x33')]),_0x5d7811);if(_0xb77baf[_0xaf87('0x31')]['filter']){_0x15bb47[_0xaf87('0x3a')]=_[_0xaf87('0x3c')](_0x15bb47[_0xaf87('0x3a')],{'$or':_[_0xaf87('0x2c')](_0x5d7811,function(_0xe3cdbb){if(_0xe3cdbb[_0xaf87('0x2e')]!==_0xaf87('0x3d')){var _0x248c3f={};_0x248c3f[_0xe3cdbb[_0xaf87('0x29')]]={'$like':'%'+_0xb77baf['query'][_0xaf87('0x3e')]+'%'};return _0x248c3f;}})});}_0x15bb47=_[_0xaf87('0x3c')]({},_0x15bb47,_0xb77baf['options']);var _0x1f9914={'where':_0x15bb47['where']};return db[_0xaf87('0x3f')][_0xaf87('0x1b')](_0x1f9914)[_0xaf87('0x21')](function(_0x3ea153){_0x47406b[_0xaf87('0x1b')]=_0x3ea153;if(_0xb77baf['query'][_0xaf87('0x40')]){_0x15bb47[_0xaf87('0x41')]=[{'all':!![]}];}return db[_0xaf87('0x3f')][_0xaf87('0x42')](_0x15bb47);})[_0xaf87('0x21')](function(_0x2568d2){_0x47406b[_0xaf87('0x43')]=_0x2568d2;return _0x47406b;})['then'](respondWithFilteredResult(_0x18efae,_0x15bb47))[_0xaf87('0x44')](handleError(_0x18efae,null));};exports['show']=function(_0x30e013,_0x17ccfc){var _0xa3d58a={'raw':![],'where':{'id':_0x30e013[_0xaf87('0x45')]['id']}},_0x2b4824={};_0x2b4824[_0xaf87('0x30')]=_[_0xaf87('0x32')](db[_0xaf87('0x3f')]['rawAttributes']);_0x2b4824[_0xaf87('0x31')]=_['keys'](_0x30e013['query']);_0x2b4824[_0xaf87('0x33')]=_[_0xaf87('0x34')](_0x2b4824['model'],_0x2b4824[_0xaf87('0x31')]);_0xa3d58a['attributes']=_['intersection'](_0x2b4824[_0xaf87('0x30')],qs[_0xaf87('0x36')](_0x30e013[_0xaf87('0x31')][_0xaf87('0x36')]));_0xa3d58a[_0xaf87('0x35')]=_0xa3d58a[_0xaf87('0x35')][_0xaf87('0x37')]?_0xa3d58a[_0xaf87('0x35')]:_0x2b4824['model'];if(_0x30e013[_0xaf87('0x31')][_0xaf87('0x40')]){_0xa3d58a[_0xaf87('0x41')]=[{'all':!![]}];}_0xa3d58a=_[_0xaf87('0x3c')]({},_0xa3d58a,_0x30e013[_0xaf87('0x46')]);return db[_0xaf87('0x3f')][_0xaf87('0x47')](_0xa3d58a)[_0xaf87('0x21')](handleEntityNotFound(_0x17ccfc,null))['then'](respondWithResult(_0x17ccfc,null))[_0xaf87('0x44')](handleError(_0x17ccfc,null));};exports[_0xaf87('0x48')]=function(_0x1b9370,_0x3545ea){return db[_0xaf87('0x3f')][_0xaf87('0x48')](_0x1b9370[_0xaf87('0x49')],{})['then'](function(_0x17e6ef){var _0x2f6eec=_0x1b9370[_0xaf87('0x4a')]['get']({'plain':!![]});if(!_0x2f6eec)throw new Error(_0xaf87('0x4b'));if(_0x2f6eec[_0xaf87('0x4c')]==='user'){var _0x257311=_0x17e6ef[_0xaf87('0x23')]({'plain':!![]});var _0x2782f9=_0xaf87('0x4d');return db[_0xaf87('0x4e')][_0xaf87('0x47')]({'where':{'name':_0x2782f9,'userProfileId':_0x2f6eec[_0xaf87('0x4f')]},'raw':!![]})[_0xaf87('0x21')](function(_0x3c8758){if(_0x3c8758&&_0x3c8758[_0xaf87('0x50')]===0x0){return db[_0xaf87('0x25')][_0xaf87('0x48')]({'name':_0x257311['name'],'resourceId':_0x257311['id'],'type':_0xaf87('0x24'),'sectionId':_0x3c8758['id']},{})[_0xaf87('0x21')](function(){return _0x17e6ef;});}else{return _0x17e6ef;}})['catch'](function(_0x1fa4b7){logger[_0xaf87('0x27')](_0xaf87('0x51'),_0x1fa4b7);throw _0x1fa4b7;});}return _0x17e6ef;})[_0xaf87('0x21')](respondWithResult(_0x3545ea,0xc9))[_0xaf87('0x44')](handleError(_0x3545ea,null));};exports['update']=function(_0x1c9ae0,_0x3c7b83){if(_0x1c9ae0['body']['id']){delete _0x1c9ae0[_0xaf87('0x49')]['id'];}return db[_0xaf87('0x3f')][_0xaf87('0x47')]({'where':{'id':_0x1c9ae0[_0xaf87('0x45')]['id']}})[_0xaf87('0x21')](handleEntityNotFound(_0x3c7b83,null))[_0xaf87('0x21')](saveUpdates(_0x1c9ae0[_0xaf87('0x49')],null))[_0xaf87('0x21')](respondWithResult(_0x3c7b83,null))[_0xaf87('0x44')](handleError(_0x3c7b83,null));};exports['destroy']=function(_0x3b217c,_0x56fda2){return db[_0xaf87('0x3f')][_0xaf87('0x47')]({'where':{'id':_0x3b217c[_0xaf87('0x45')]['id']}})[_0xaf87('0x21')](handleEntityNotFound(_0x56fda2,null))[_0xaf87('0x21')](removeEntity(_0x56fda2,null))['catch'](handleError(_0x56fda2,null));};exports[_0xaf87('0x52')]=function(_0x513083,_0x2ddea0){var _0xbe7d65=0xa;var _0x3e0131=[_0xaf87('0x53'),'left_join','right_join',_0xaf87('0x54')];var _0x45ef93={'SUM':'SUM(%s)','COUNT':_0xaf87('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xaf87('0x56'),'MIN':_0xaf87('0x57'),'AVG':_0xaf87('0x58'),'GROUP_CONCAT':_0xaf87('0x59'),'GROUP_CONCAT ASC':_0xaf87('0x5a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1e8643={'SEC_TO_TIME':_0xaf87('0x5b'),'DATE':_0xaf87('0x5c'),'HOUR':_0xaf87('0x5d'),'ROUND':_0xaf87('0x5e'),'UNIX_TIMESTAMP':_0xaf87('0x5f')};var _0x7ee883=function(_0x5b75b7){return!_[_0xaf87('0x60')]([_0xaf87('0x61'),_0xaf87('0x62'),_0xaf87('0x63'),_0xaf87('0x64')],_0x5b75b7);};var _0x11116b=function(_0x2c2b62){if(!_0x2c2b62||!_0x2c2b62[_0xaf87('0x65')][_0xaf87('0x37')]){return'';}for(var _0x3d1c76='(',_0x28c7b9=0x0;_0x28c7b9<_0x2c2b62[_0xaf87('0x65')]['length'];_0x28c7b9+=0x1){_0x28c7b9>0x0&&(_0x3d1c76+='\x20'+_0x2c2b62[_0xaf87('0x66')]+'\x20');_0x3d1c76+=_0x2c2b62[_0xaf87('0x65')][_0x28c7b9]['group']?_0x11116b(_0x2c2b62['rules'][_0x28c7b9][_0xaf87('0x67')]):_0x2c2b62[_0xaf87('0x65')][_0x28c7b9][_0xaf87('0x68')]+'\x20'+_0x2c2b62[_0xaf87('0x65')][_0x28c7b9][_0xaf87('0x69')]+(_0x7ee883(_0x2c2b62[_0xaf87('0x65')][_0x28c7b9][_0xaf87('0x69')])?'\x20'+_0x2c2b62[_0xaf87('0x65')][_0x28c7b9][_0xaf87('0x6a')]:'');}return _0x3d1c76+')';};var _0x163e9f={'where':{'id':_0x513083['params']['id']}},_0x5c6a0b,_0x15b256,_0x459329,_0x1cc36a,_0x5a10d7;_0x163e9f=_[_0xaf87('0x3c')]({},_0x163e9f,_0x513083['options']);return db[_0xaf87('0x3f')][_0xaf87('0x47')](_0x163e9f)[_0xaf87('0x21')](function(_0x31554c){if(_0x31554c){_0x5c6a0b=_0x31554c;return _0x31554c[_0xaf87('0x6b')]();}return null;})['then'](function(_0x81a021){if(_0x81a021){if(!_0x81a021['length']){throw new db[(_0xaf87('0x6c'))][(_0xaf87('0x6d'))](_0xaf87('0x6e'),0x193);}_0x15b256=_0x81a021;return db[_0xaf87('0x6f')][_0xaf87('0x42')]({'raw':!![]});}return null;})[_0xaf87('0x21')](function(_0x13fc56){if(_0x13fc56){_0x459329=_[_0xaf87('0x70')](_0x13fc56,'id');var _0x3f1c6a;var _0x119b1c=squel[_0xaf87('0x71')]();_0x119b1c['from'](_0x5c6a0b[_0xaf87('0x72')]);for(var _0x45a36b=0x0;_0x45a36b<_0x15b256[_0xaf87('0x37')];_0x45a36b+=0x1){_0x3f1c6a=_0x15b256[_0x45a36b][_0xaf87('0x73')]?_0x459329[_0x15b256[_0x45a36b][_0xaf87('0x73')]][_0xaf87('0x74')]:_0x15b256[_0x45a36b]['field'];_0x3f1c6a=_0x15b256[_0x45a36b]['function']?_[_0xaf87('0x75')](_0x45ef93[_0x15b256[_0x45a36b][_0xaf87('0x76')]],'%s',_0x3f1c6a):_0x3f1c6a;_0x3f1c6a=_0x15b256[_0x45a36b]['format']?_[_0xaf87('0x75')](_0x1e8643[_0x15b256[_0x45a36b]['format']],'%s',_0x3f1c6a):_0x3f1c6a;if(_0x15b256[_0x45a36b][_0xaf87('0x77')]){_0x119b1c['group'](_0x3f1c6a);}_0x15b256[_0x45a36b][_0xaf87('0x78')]&&_0x119b1c[_0xaf87('0x79')](_0x3f1c6a,_0x15b256[_0x45a36b][_0xaf87('0x78')]===_0xaf87('0x7a')?![]:!![]);_0x119b1c[_0xaf87('0x68')](_0x3f1c6a,_0x15b256[_0x45a36b][_0xaf87('0x7b')]||_0x3f1c6a);}if(_0x5c6a0b[_0xaf87('0x7c')]){_0x5c6a0b[_0xaf87('0x7c')]=JSON['parse'](_0x5c6a0b['joins']);for(var _0x592099=0x0;_0x592099<_0x5c6a0b[_0xaf87('0x7c')][_0xaf87('0x37')];_0x592099+=0x1){if(_0x5c6a0b['joins'][_0x592099][_0xaf87('0x2e')]&&_[_0xaf87('0x60')](_0x3e0131,_0x5c6a0b[_0xaf87('0x7c')][_0x592099][_0xaf87('0x2e')])&&_0x5c6a0b[_0xaf87('0x7c')][_0x592099][_0xaf87('0x7d')]&&_0x5c6a0b[_0xaf87('0x7c')][_0x592099][_0xaf87('0x7e')]&&_0x5c6a0b['joins'][_0x592099]['foreignKey']){_0x119b1c[_0x5c6a0b[_0xaf87('0x7c')][_0x592099][_0xaf87('0x2e')]](_0x5c6a0b['joins'][_0x592099][_0xaf87('0x7e')],null,util['format'](_0xaf87('0x7f'),_0x5c6a0b['table'],_0x5c6a0b[_0xaf87('0x7c')][_0x592099][_0xaf87('0x7d')],_0x5c6a0b['joins'][_0x592099][_0xaf87('0x7e')],_0x5c6a0b[_0xaf87('0x7c')][_0x592099]['foreignKey']));}}}if(_0x5c6a0b['conditions']){_0x5c6a0b[_0xaf87('0x80')]=JSON[_0xaf87('0x81')](_0x5c6a0b['conditions']);_0x119b1c[_0xaf87('0x3a')](_0x11116b(_0x5c6a0b[_0xaf87('0x80')][_0xaf87('0x67')]));}_0x5a10d7=_0x119b1c[_0xaf87('0x82')]();_0x119b1c[_0xaf87('0x1a')](_0xbe7d65);_0x119b1c[_0xaf87('0x18')](0x0);logger[_0xaf87('0x83')]('Limited\x20Query:',_0x119b1c['toString']());return dbH[_0xaf87('0x84')][_0xaf87('0x31')](_0x119b1c[_0xaf87('0x85')](),{'type':dbH[_0xaf87('0x84')][_0xaf87('0x86')][_0xaf87('0x87')]});}})[_0xaf87('0x21')](respondWithResult(_0x2ddea0,null))[_0xaf87('0x44')](handleError(_0x2ddea0,null));};function runReport(_0x773bf6,_0x28d331,_0x578bab){var _0x95ab5b=_0x28d331['name'];var _0x3be676=0xa;var _0x44d484=[_0xaf87('0x53'),_0xaf87('0x88'),_0xaf87('0x89'),_0xaf87('0x54')];var _0x2bd7e6={'SUM':_0xaf87('0x8a'),'COUNT':_0xaf87('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xaf87('0x56'),'MIN':_0xaf87('0x57'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xaf87('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xaf87('0x8b')};var _0x10c1b4={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xaf87('0x5d'),'ROUND':_0xaf87('0x5e'),'UNIX_TIMESTAMP':_0xaf87('0x5f')};var _0x34c8b1=function(_0x5cf046){return!_[_0xaf87('0x60')]([_0xaf87('0x61'),_0xaf87('0x62'),_0xaf87('0x63'),'IS\x20NOT\x20EMPTY'],_0x5cf046);};var _0x27b696=function(_0x908da4){if(!_0x908da4||!_0x908da4[_0xaf87('0x65')]['length']){return'';}for(var _0x4fc2b5='(',_0x4bc0bf=0x0;_0x4bc0bf<_0x908da4[_0xaf87('0x65')][_0xaf87('0x37')];_0x4bc0bf+=0x1){_0x4bc0bf>0x0&&(_0x4fc2b5+='\x20'+_0x908da4[_0xaf87('0x66')]+'\x20');_0x4fc2b5+=_0x908da4[_0xaf87('0x65')][_0x4bc0bf][_0xaf87('0x67')]?_0x27b696(_0x908da4[_0xaf87('0x65')][_0x4bc0bf][_0xaf87('0x67')]):_0x908da4['rules'][_0x4bc0bf]['field']+'\x20'+_0x908da4[_0xaf87('0x65')][_0x4bc0bf][_0xaf87('0x69')]+(_0x34c8b1(_0x908da4[_0xaf87('0x65')][_0x4bc0bf][_0xaf87('0x69')])?'\x20'+_0x908da4[_0xaf87('0x65')][_0x4bc0bf][_0xaf87('0x6a')]:'');}return _0x4fc2b5+')';};var _0x15d9a7={'where':{'id':_0x773bf6['id']}},_0x2f552d,_0xccc498,_0x3729d0,_0x4ff441,_0x5cf31c;_0x15d9a7=_[_0xaf87('0x3c')]({},_0x15d9a7,_0x578bab);return db[_0xaf87('0x3f')][_0xaf87('0x47')](_0x15d9a7)[_0xaf87('0x21')](function(_0x93eebc){if(_0x93eebc){_0x2f552d=_0x93eebc;return _0x93eebc[_0xaf87('0x6b')]();}return null;})[_0xaf87('0x21')](function(_0x23541e){if(_0x23541e){if(!_0x23541e['length']){throw new db['Sequelize'][(_0xaf87('0x6d'))](_0xaf87('0x6e'),0x193);}_0xccc498=_0x23541e;return db['AnalyticMetric'][_0xaf87('0x42')]({'raw':!![]});}return null;})[_0xaf87('0x21')](function(_0x814ac6){if(_0x814ac6){_0x3729d0=_[_0xaf87('0x70')](_0x814ac6,'id');var _0x1f08e0;var _0x199649=squel[_0xaf87('0x71')]();_0x199649[_0xaf87('0x8c')](_0x2f552d['table']);for(var _0x320030=0x0;_0x320030<_0xccc498['length'];_0x320030+=0x1){_0x1f08e0=_0xccc498[_0x320030][_0xaf87('0x73')]?_0x3729d0[_0xccc498[_0x320030]['MetricId']][_0xaf87('0x74')]:_0xccc498[_0x320030][_0xaf87('0x68')];_0x1f08e0=_0xccc498[_0x320030]['function']?_[_0xaf87('0x75')](_0x2bd7e6[_0xccc498[_0x320030][_0xaf87('0x76')]],'%s',_0x1f08e0):_0x1f08e0;_0x1f08e0=_0xccc498[_0x320030][_0xaf87('0x8d')]?_[_0xaf87('0x75')](_0x10c1b4[_0xccc498[_0x320030][_0xaf87('0x8d')]],'%s',_0x1f08e0):_0x1f08e0;if(_0xccc498[_0x320030][_0xaf87('0x77')]){_0x199649['group'](_0x1f08e0);}_0xccc498[_0x320030][_0xaf87('0x78')]&&_0x199649[_0xaf87('0x79')](_0x1f08e0,_0xccc498[_0x320030][_0xaf87('0x78')]==='DESC'?![]:!![]);_0x199649['field'](_0x1f08e0,_0xccc498[_0x320030]['alias']||_0x1f08e0);}if(_0x2f552d[_0xaf87('0x7c')]){_0x2f552d[_0xaf87('0x7c')]=JSON[_0xaf87('0x81')](_0x2f552d['joins']);for(var _0x5ee425=0x0;_0x5ee425<_0x2f552d['joins'][_0xaf87('0x37')];_0x5ee425+=0x1){if(_0x2f552d[_0xaf87('0x7c')][_0x5ee425][_0xaf87('0x2e')]&&_[_0xaf87('0x60')](_0x44d484,_0x2f552d[_0xaf87('0x7c')][_0x5ee425][_0xaf87('0x2e')])&&_0x2f552d[_0xaf87('0x7c')][_0x5ee425][_0xaf87('0x7d')]&&_0x2f552d[_0xaf87('0x7c')][_0x5ee425]['foreignTable']&&_0x2f552d[_0xaf87('0x7c')][_0x5ee425][_0xaf87('0x8e')]){_0x199649[_0x2f552d['joins'][_0x5ee425][_0xaf87('0x2e')]](_0x2f552d[_0xaf87('0x7c')][_0x5ee425][_0xaf87('0x7e')],null,util['format'](_0xaf87('0x7f'),_0x2f552d[_0xaf87('0x72')],_0x2f552d['joins'][_0x5ee425]['parentKey'],_0x2f552d[_0xaf87('0x7c')][_0x5ee425][_0xaf87('0x7e')],_0x2f552d[_0xaf87('0x7c')][_0x5ee425]['foreignKey']));}}}if(_0x2f552d['conditions']){_0x2f552d['conditions']=JSON[_0xaf87('0x81')](_0x2f552d[_0xaf87('0x80')]);_0x199649[_0xaf87('0x3a')](_0x27b696(_0x2f552d[_0xaf87('0x80')][_0xaf87('0x67')]));}_0x5cf31c=_0x199649[_0xaf87('0x82')]();_0x199649[_0xaf87('0x1a')](_0x3be676);_0x199649['offset'](0x0);return;}})[_0xaf87('0x21')](function(){if(_0x28d331[_0xaf87('0x8f')]===_0xaf87('0x90')){return null;}var _0x515e4e=_[_0xaf87('0x3c')](_0x28d331,{'name':_0x28d331[_0xaf87('0x91')]||_0x28d331[_0xaf87('0x29')]||_0x2f552d[_0xaf87('0x29')],'basename':_0x95ab5b,'savename':util['format'](_0xaf87('0x92'),_0x28d331['name']||_0x2f552d[_0xaf87('0x29')],require(_0xaf87('0x93'))[_0xaf87('0x94')](0x4),_0x28d331[_0xaf87('0x8f')]||_0xaf87('0x95')),'reportId':_0x2f552d['id'],'reportType':_0xaf87('0x96')});return db[_0xaf87('0x97')][_0xaf87('0x48')](_0x515e4e,{'raw':!![]});})[_0xaf87('0x21')](function(_0x362cca){if(_0x2f552d[_0xaf87('0x72')]===_0xaf87('0x98')){_0x5cf31c['where'](_0x2f552d[_0xaf87('0x72')]+_0xaf87('0x99'),_0x28d331[_0xaf87('0x9a')],_0x28d331[_0xaf87('0x9b')]);}else{_0x5cf31c[_0xaf87('0x3a')](_0x2f552d[_0xaf87('0x72')]+_0xaf87('0x9c'),_0x28d331[_0xaf87('0x9a')],_0x28d331[_0xaf87('0x9b')]);}if(_0x362cca){logger[_0xaf87('0x9d')](_0xaf87('0x9e'),_0x5cf31c['toString']());require(_0xaf87('0x9f'))[_0xaf87('0xa0')](path[_0xaf87('0x53')](__dirname,_0xaf87('0xa1'),_0x362cca['output']),[_0x362cca['id'],_0x5cf31c[_0xaf87('0x85')](),path[_0xaf87('0x53')](__dirname,_0xaf87('0xa2'),_0x362cca[_0xaf87('0xa3')]),_0x95ab5b]);return _0x362cca;}else{var _0x5c3170=squel[_0xaf87('0x71')]();_0x5c3170[_0xaf87('0x8c')]('('+_0x5cf31c[_0xaf87('0x85')]()+')',_0xaf87('0xa4'));_0x5c3170[_0xaf87('0x68')](_0xaf87('0xa5'),'count');_0x5cf31c[_0xaf87('0x1a')](_0x28d331[_0xaf87('0x1a')]||_0x3be676);_0x5cf31c['offset'](_0x28d331[_0xaf87('0x18')]||0x0);return dbH[_0xaf87('0x84')]['query'](_0x5c3170[_0xaf87('0x85')](),{'type':dbH[_0xaf87('0x84')][_0xaf87('0x86')][_0xaf87('0x87')]})[_0xaf87('0x21')](function(_0x12c0f5){if(!_0x12c0f5[_0xaf87('0x37')]){_0x4ff441=0x0;}else{_0x4ff441=_0x12c0f5[0x0][_0xaf87('0x1b')]||0x0;}return dbH[_0xaf87('0x84')][_0xaf87('0x31')](_0x5cf31c[_0xaf87('0x85')](),{'type':dbH[_0xaf87('0x84')][_0xaf87('0x86')]['SELECT']});})[_0xaf87('0x21')](function(_0x2be863){return{'rows':_0x2be863||[],'count':_0x4ff441};});}});}exports[_0xaf87('0xa6')]=function(_0x565eb9,_0x86f3f1){return runReport(_0x565eb9[_0xaf87('0x45')],_0x565eb9[_0xaf87('0x31')],_0x565eb9['options'])[_0xaf87('0x21')](respondWithResult(_0x86f3f1,null))['catch'](handleError(_0x86f3f1,null));};exports['runReport']=runReport;exports['query']=function(_0xfa5b31,_0x4d352d){var _0x5488f0=0xa;var _0x305edf=[_0xaf87('0x53'),'left_join',_0xaf87('0x89'),_0xaf87('0x54')];var _0x3a2a57={'SUM':'SUM(%s)','COUNT':_0xaf87('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xaf87('0x56'),'MIN':'MIN(%s)','AVG':_0xaf87('0x58'),'GROUP_CONCAT':_0xaf87('0x59'),'GROUP_CONCAT ASC':_0xaf87('0x5a'),'GROUP_CONCAT DESC':_0xaf87('0x8b')};var _0x236142={'SEC_TO_TIME':_0xaf87('0x5b'),'DATE':_0xaf87('0x5c'),'HOUR':'HOUR(%s)','ROUND':_0xaf87('0x5e'),'UNIX_TIMESTAMP':_0xaf87('0x5f')};var _0x20146d=function(_0x36f1fe){return!_[_0xaf87('0x60')]([_0xaf87('0x61'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0xaf87('0x64')],_0x36f1fe);};var _0x12531a=function(_0x3f3f37){if(!_0x3f3f37||!_0x3f3f37[_0xaf87('0x65')][_0xaf87('0x37')]){return'';}for(var _0x436179='(',_0x58e491=0x0;_0x58e491<_0x3f3f37[_0xaf87('0x65')][_0xaf87('0x37')];_0x58e491+=0x1){_0x58e491>0x0&&(_0x436179+='\x20'+_0x3f3f37[_0xaf87('0x66')]+'\x20');_0x436179+=_0x3f3f37['rules'][_0x58e491][_0xaf87('0x67')]?_0x12531a(_0x3f3f37['rules'][_0x58e491][_0xaf87('0x67')]):_0x3f3f37[_0xaf87('0x65')][_0x58e491][_0xaf87('0x68')]+'\x20'+_0x3f3f37[_0xaf87('0x65')][_0x58e491][_0xaf87('0x69')]+(_0x20146d(_0x3f3f37[_0xaf87('0x65')][_0x58e491]['condition'])?'\x20'+_0x3f3f37[_0xaf87('0x65')][_0x58e491][_0xaf87('0x6a')]:'');}return _0x436179+')';};var _0xc72ad1={'where':{'id':_0xfa5b31[_0xaf87('0x45')]['id']}},_0x268d60,_0x292b9e,_0x39208e,_0x3adbaa,_0x305b56;_0xc72ad1=_[_0xaf87('0x3c')]({},_0xc72ad1,_0xfa5b31[_0xaf87('0x46')]);return db[_0xaf87('0x3f')][_0xaf87('0x47')](_0xc72ad1)[_0xaf87('0x21')](function(_0x48eab8){if(_0x48eab8){_0x268d60=_0x48eab8;return _0x48eab8[_0xaf87('0x6b')]();}return null;})[_0xaf87('0x21')](function(_0x285e42){if(_0x285e42){if(!_0x285e42['length']){throw new db[(_0xaf87('0x6c'))][(_0xaf87('0x6d'))](_0xaf87('0x6e'),0x193);}_0x292b9e=_0x285e42;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xaf87('0x21')](function(_0x32dc11){if(_0x32dc11){_0x39208e=_[_0xaf87('0x70')](_0x32dc11,'id');var _0x1c6729;var _0x4bd939=squel[_0xaf87('0x71')]();_0x4bd939['from'](_0x268d60[_0xaf87('0x72')]);for(var _0x217c45=0x0;_0x217c45<_0x292b9e['length'];_0x217c45+=0x1){_0x1c6729=_0x292b9e[_0x217c45][_0xaf87('0x73')]?_0x39208e[_0x292b9e[_0x217c45][_0xaf87('0x73')]][_0xaf87('0x74')]:_0x292b9e[_0x217c45]['field'];_0x1c6729=_0x292b9e[_0x217c45][_0xaf87('0x76')]?_[_0xaf87('0x75')](_0x3a2a57[_0x292b9e[_0x217c45][_0xaf87('0x76')]],'%s',_0x1c6729):_0x1c6729;_0x1c6729=_0x292b9e[_0x217c45]['format']?_[_0xaf87('0x75')](_0x236142[_0x292b9e[_0x217c45][_0xaf87('0x8d')]],'%s',_0x1c6729):_0x1c6729;if(_0x292b9e[_0x217c45][_0xaf87('0x77')]){_0x4bd939[_0xaf87('0x67')](_0x1c6729);}_0x292b9e[_0x217c45][_0xaf87('0x78')]&&_0x4bd939[_0xaf87('0x79')](_0x1c6729,_0x292b9e[_0x217c45]['orderBy']==='DESC'?![]:!![]);_0x4bd939[_0xaf87('0x68')](_0x1c6729,_0x292b9e[_0x217c45]['alias']||_0x1c6729);}if(_0x268d60['joins']){_0x268d60[_0xaf87('0x7c')]=JSON[_0xaf87('0x81')](_0x268d60['joins']);for(var _0xc6e764=0x0;_0xc6e764<_0x268d60['joins'][_0xaf87('0x37')];_0xc6e764+=0x1){if(_0x268d60['joins'][_0xc6e764][_0xaf87('0x2e')]&&_[_0xaf87('0x60')](_0x305edf,_0x268d60[_0xaf87('0x7c')][_0xc6e764][_0xaf87('0x2e')])&&_0x268d60['joins'][_0xc6e764][_0xaf87('0x7d')]&&_0x268d60[_0xaf87('0x7c')][_0xc6e764][_0xaf87('0x7e')]&&_0x268d60['joins'][_0xc6e764][_0xaf87('0x8e')]){_0x4bd939[_0x268d60[_0xaf87('0x7c')][_0xc6e764][_0xaf87('0x2e')]](_0x268d60['joins'][_0xc6e764][_0xaf87('0x7e')],null,util[_0xaf87('0x8d')](_0xaf87('0x7f'),_0x268d60[_0xaf87('0x72')],_0x268d60[_0xaf87('0x7c')][_0xc6e764][_0xaf87('0x7d')],_0x268d60[_0xaf87('0x7c')][_0xc6e764][_0xaf87('0x7e')],_0x268d60[_0xaf87('0x7c')][_0xc6e764][_0xaf87('0x8e')]));}}}if(_0x268d60[_0xaf87('0x80')]){_0x268d60[_0xaf87('0x80')]=JSON[_0xaf87('0x81')](_0x268d60['conditions']);_0x4bd939[_0xaf87('0x3a')](_0x12531a(_0x268d60[_0xaf87('0x80')]['group']));}_0x305b56=_0x4bd939[_0xaf87('0x82')]();_0x4bd939[_0xaf87('0x1a')](_0x5488f0);_0x4bd939[_0xaf87('0x18')](0x0);logger[_0xaf87('0x83')](_0xaf87('0xa7'),_0x4bd939['toString']());return dbH[_0xaf87('0x84')][_0xaf87('0x31')](_0x4bd939[_0xaf87('0x85')](),{'type':dbH[_0xaf87('0x84')][_0xaf87('0x86')][_0xaf87('0x87')]});}})[_0xaf87('0x21')](function(){return{'sql':_0x305b56[_0xaf87('0x85')]()};})[_0xaf87('0x21')](respondWithResult(_0x4d352d,null))['catch'](handleError(_0x4d352d,null));}; \ No newline at end of file +var _0x8a8c=['UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','table','MetricId','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','includes','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','left_join','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','HOUR(%s)','value','Sequelize','from','metric','parentKey','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','SELECT','run','runReport','GROUP_CONCAT(%s)','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','ejs','fs-extra','lodash','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','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','then','get','UserProfileResource','destroy','end','error','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','order','sort','where','VIRTUAL','filter','merge','AnalyticCustomReport','includeAll','include','rows','catch','show','params','rawAttributes','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','UserProfileSection','userProfileId','autoAssociation','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','ROUND(%s)'];(function(_0x1d5855,_0x1ca36b){var _0xae0eb2=function(_0x938914){while(--_0x938914){_0x1d5855['push'](_0x1d5855['shift']());}};_0xae0eb2(++_0x1ca36b);}(_0x8a8c,0x1a0));var _0xc8a8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a8c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc8a8('0x0'));var rimraf=require(_0xc8a8('0x1'));var zipdir=require(_0xc8a8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc8a8('0x3'));var BPromise=require(_0xc8a8('0x4'));var Mustache=require(_0xc8a8('0x5'));var util=require('util');var path=require(_0xc8a8('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc8a8('0x7'));var fs=require('fs');var fs_extra=require(_0xc8a8('0x8'));var _=require(_0xc8a8('0x9'));var squel=require(_0xc8a8('0xa'));var crypto=require(_0xc8a8('0xb'));var jsforce=require(_0xc8a8('0xc'));var deskjs=require(_0xc8a8('0xd'));var toCsv=require(_0xc8a8('0xe'));var querystring=require(_0xc8a8('0xf'));var Papa=require(_0xc8a8('0x10'));var Redis=require(_0xc8a8('0x11'));var authService=require(_0xc8a8('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc8a8('0x13'));var hardwareService=require(_0xc8a8('0x14'));var logger=require(_0xc8a8('0x15'))(_0xc8a8('0x16'));var utils=require(_0xc8a8('0x17'));var config=require(_0xc8a8('0x18'));var licenseUtil=require(_0xc8a8('0x19'));var db=require('../../mysqldb')['db'];var dbH=require(_0xc8a8('0x1a'))[_0xc8a8('0x1b')];function respondWithStatusCode(_0x492810,_0x22cecc){_0x22cecc=_0x22cecc||0xcc;return function(_0x4bb46e){if(_0x4bb46e){return _0x492810[_0xc8a8('0x1c')](_0x22cecc);}return _0x492810[_0xc8a8('0x1d')](_0x22cecc)['end']();};}function respondWithResult(_0x10a60f,_0x484375){_0x484375=_0x484375||0xc8;return function(_0x51bd39){if(_0x51bd39){return _0x10a60f['status'](_0x484375)[_0xc8a8('0x1e')](_0x51bd39);}};}function respondWithFilteredResult(_0x33a450,_0x2b5e3a){return function(_0x2bdd56){if(_0x2bdd56){var _0x46e183=typeof _0x2b5e3a[_0xc8a8('0x1f')]===_0xc8a8('0x20')&&typeof _0x2b5e3a['limit']===_0xc8a8('0x20');var _0x11e55e=_0x2bdd56[_0xc8a8('0x21')];var _0xdfbf84=_0x46e183?0x0:_0x2b5e3a[_0xc8a8('0x1f')];var _0x56b00f=_0x46e183?_0x2bdd56[_0xc8a8('0x21')]:_0x2b5e3a['offset']+_0x2b5e3a[_0xc8a8('0x22')];var _0x5f52d7;if(_0x56b00f>=_0x11e55e){_0x56b00f=_0x11e55e;_0x5f52d7=0xc8;}else{_0x5f52d7=0xce;}_0x33a450[_0xc8a8('0x1d')](_0x5f52d7);return _0x33a450['set'](_0xc8a8('0x23'),_0xdfbf84+'-'+_0x56b00f+'/'+_0x11e55e)[_0xc8a8('0x1e')](_0x2bdd56);}return null;};}function patchUpdates(_0x10c23e){return function(_0x26f2f4){try{jsonpatch[_0xc8a8('0x24')](_0x26f2f4,_0x10c23e,!![]);}catch(_0x52d7b0){return BPromise['reject'](_0x52d7b0);}return _0x26f2f4['save']();};}function saveUpdates(_0x1cd034,_0x52f659){return function(_0x47df7e){if(_0x47df7e){return _0x47df7e['update'](_0x1cd034)[_0xc8a8('0x25')](function(_0x343f07){return _0x343f07;});}return null;};}function removeEntity(_0x329b9e,_0x3c596e){return function(_0x3e8d7d){if(_0x3e8d7d){return _0x3e8d7d['destroy']()['then'](function(){var _0x5cd87c=_0x3e8d7d[_0xc8a8('0x26')]({'plain':!![]});var _0x150e27='CustomReports';return db[_0xc8a8('0x27')][_0xc8a8('0x28')]({'where':{'type':_0x150e27,'resourceId':_0x5cd87c['id']}})[_0xc8a8('0x25')](function(){return _0x3e8d7d;});})['then'](function(){_0x329b9e[_0xc8a8('0x1d')](0xcc)[_0xc8a8('0x29')]();});}};}function handleEntityNotFound(_0xca7114,_0x396840){return function(_0x3842cc){if(!_0x3842cc){_0xca7114['sendStatus'](0x194);}return _0x3842cc;};}function handleError(_0x5a76f7,_0x37016a){_0x37016a=_0x37016a||0x1f4;return function(_0x588ce1){logger[_0xc8a8('0x2a')](_0x588ce1['stack']);if(_0x588ce1['name']){delete _0x588ce1[_0xc8a8('0x2b')];}_0x5a76f7['status'](_0x37016a)[_0xc8a8('0x2c')](_0x588ce1);};}exports[_0xc8a8('0x2d')]=function(_0x44baa7,_0x3265ef){var _0x59a95f={},_0xbf053a={},_0x101084={'count':0x0,'rows':[]};var _0x4b99af=_['map'](db['AnalyticCustomReport']['rawAttributes'],function(_0x30229f){return{'name':_0x30229f[_0xc8a8('0x2e')],'type':_0x30229f[_0xc8a8('0x2f')][_0xc8a8('0x30')]};});_0xbf053a[_0xc8a8('0x31')]=_[_0xc8a8('0x32')](_0x4b99af,_0xc8a8('0x2b'));_0xbf053a[_0xc8a8('0x33')]=_[_0xc8a8('0x34')](_0x44baa7[_0xc8a8('0x33')]);_0xbf053a[_0xc8a8('0x35')]=_[_0xc8a8('0x36')](_0xbf053a[_0xc8a8('0x31')],_0xbf053a[_0xc8a8('0x33')]);_0x59a95f['attributes']=_[_0xc8a8('0x36')](_0xbf053a['model'],qs[_0xc8a8('0x37')](_0x44baa7[_0xc8a8('0x33')][_0xc8a8('0x37')]));_0x59a95f[_0xc8a8('0x38')]=_0x59a95f[_0xc8a8('0x38')][_0xc8a8('0x39')]?_0x59a95f[_0xc8a8('0x38')]:_0xbf053a['model'];if(!_0x44baa7[_0xc8a8('0x33')]['hasOwnProperty']('nolimit')){_0x59a95f[_0xc8a8('0x22')]=qs[_0xc8a8('0x22')](_0x44baa7[_0xc8a8('0x33')][_0xc8a8('0x22')]);_0x59a95f[_0xc8a8('0x1f')]=qs['offset'](_0x44baa7['query']['offset']);}_0x59a95f[_0xc8a8('0x3a')]=qs[_0xc8a8('0x3b')](_0x44baa7[_0xc8a8('0x33')][_0xc8a8('0x3b')]);_0x59a95f[_0xc8a8('0x3c')]=qs[_0xc8a8('0x35')](_['pick'](_0x44baa7[_0xc8a8('0x33')],_0xbf053a[_0xc8a8('0x35')]),_0x4b99af);if(_0x44baa7[_0xc8a8('0x33')]['filter']){_0x59a95f['where']=_['merge'](_0x59a95f[_0xc8a8('0x3c')],{'$or':_['map'](_0x4b99af,function(_0x1387d7){if(_0x1387d7['type']!==_0xc8a8('0x3d')){var _0x315065={};_0x315065[_0x1387d7[_0xc8a8('0x2b')]]={'$like':'%'+_0x44baa7[_0xc8a8('0x33')][_0xc8a8('0x3e')]+'%'};return _0x315065;}})});}_0x59a95f=_[_0xc8a8('0x3f')]({},_0x59a95f,_0x44baa7['options']);var _0x2784a3={'where':_0x59a95f[_0xc8a8('0x3c')]};return db[_0xc8a8('0x40')]['count'](_0x2784a3)[_0xc8a8('0x25')](function(_0x1fb0de){_0x101084['count']=_0x1fb0de;if(_0x44baa7[_0xc8a8('0x33')][_0xc8a8('0x41')]){_0x59a95f[_0xc8a8('0x42')]=[{'all':!![]}];}return db[_0xc8a8('0x40')]['findAll'](_0x59a95f);})[_0xc8a8('0x25')](function(_0x3b7adb){_0x101084[_0xc8a8('0x43')]=_0x3b7adb;return _0x101084;})[_0xc8a8('0x25')](respondWithFilteredResult(_0x3265ef,_0x59a95f))[_0xc8a8('0x44')](handleError(_0x3265ef,null));};exports[_0xc8a8('0x45')]=function(_0x5c0844,_0x353ed3){var _0x4b0f65={'raw':![],'where':{'id':_0x5c0844[_0xc8a8('0x46')]['id']}},_0x2efbe8={};_0x2efbe8[_0xc8a8('0x31')]=_[_0xc8a8('0x34')](db[_0xc8a8('0x40')][_0xc8a8('0x47')]);_0x2efbe8[_0xc8a8('0x33')]=_['keys'](_0x5c0844[_0xc8a8('0x33')]);_0x2efbe8['filters']=_[_0xc8a8('0x36')](_0x2efbe8[_0xc8a8('0x31')],_0x2efbe8[_0xc8a8('0x33')]);_0x4b0f65[_0xc8a8('0x38')]=_['intersection'](_0x2efbe8[_0xc8a8('0x31')],qs[_0xc8a8('0x37')](_0x5c0844[_0xc8a8('0x33')][_0xc8a8('0x37')]));_0x4b0f65[_0xc8a8('0x38')]=_0x4b0f65[_0xc8a8('0x38')][_0xc8a8('0x39')]?_0x4b0f65[_0xc8a8('0x38')]:_0x2efbe8[_0xc8a8('0x31')];if(_0x5c0844['query'][_0xc8a8('0x41')]){_0x4b0f65[_0xc8a8('0x42')]=[{'all':!![]}];}_0x4b0f65=_['merge']({},_0x4b0f65,_0x5c0844[_0xc8a8('0x48')]);return db[_0xc8a8('0x40')][_0xc8a8('0x49')](_0x4b0f65)[_0xc8a8('0x25')](handleEntityNotFound(_0x353ed3,null))[_0xc8a8('0x25')](respondWithResult(_0x353ed3,null))[_0xc8a8('0x44')](handleError(_0x353ed3,null));};exports[_0xc8a8('0x4a')]=function(_0x35b1dc,_0x5ef597){return db[_0xc8a8('0x40')][_0xc8a8('0x4a')](_0x35b1dc['body'],{})[_0xc8a8('0x25')](function(_0xf6198e){var _0x10aaed=_0x35b1dc['user'][_0xc8a8('0x26')]({'plain':!![]});if(!_0x10aaed)throw new Error(_0xc8a8('0x4b'));if(_0x10aaed[_0xc8a8('0x4c')]===_0xc8a8('0x4d')){var _0x1b5a19=_0xf6198e[_0xc8a8('0x26')]({'plain':!![]});var _0x1c03cd=_0xc8a8('0x4e');return db[_0xc8a8('0x4f')][_0xc8a8('0x49')]({'where':{'name':_0x1c03cd,'userProfileId':_0x10aaed[_0xc8a8('0x50')]},'raw':!![]})[_0xc8a8('0x25')](function(_0x4dfd10){if(_0x4dfd10&&_0x4dfd10[_0xc8a8('0x51')]===0x0){return db[_0xc8a8('0x27')]['create']({'name':_0x1b5a19[_0xc8a8('0x2b')],'resourceId':_0x1b5a19['id'],'type':_0xc8a8('0x52'),'sectionId':_0x4dfd10['id']},{})[_0xc8a8('0x25')](function(){return _0xf6198e;});}else{return _0xf6198e;}})['catch'](function(_0x117117){logger['error'](_0xc8a8('0x53'),_0x117117);throw _0x117117;});}return _0xf6198e;})['then'](respondWithResult(_0x5ef597,0xc9))['catch'](handleError(_0x5ef597,null));};exports[_0xc8a8('0x54')]=function(_0x22716c,_0x37e0d9){if(_0x22716c['body']['id']){delete _0x22716c['body']['id'];}return db['AnalyticCustomReport'][_0xc8a8('0x49')]({'where':{'id':_0x22716c[_0xc8a8('0x46')]['id']}})[_0xc8a8('0x25')](handleEntityNotFound(_0x37e0d9,null))[_0xc8a8('0x25')](saveUpdates(_0x22716c[_0xc8a8('0x55')],null))[_0xc8a8('0x25')](respondWithResult(_0x37e0d9,null))[_0xc8a8('0x44')](handleError(_0x37e0d9,null));};exports[_0xc8a8('0x28')]=function(_0x5b93e1,_0x5dba6a){return db[_0xc8a8('0x40')][_0xc8a8('0x49')]({'where':{'id':_0x5b93e1['params']['id']}})[_0xc8a8('0x25')](handleEntityNotFound(_0x5dba6a,null))['then'](removeEntity(_0x5dba6a,null))[_0xc8a8('0x44')](handleError(_0x5dba6a,null));};exports['preview']=function(_0xff18b4,_0x1f91f0){var _0x31bc22=0xa;var _0x536129=[_0xc8a8('0x56'),'left_join',_0xc8a8('0x57'),_0xc8a8('0x58')];var _0x359957={'SUM':_0xc8a8('0x59'),'COUNT':_0xc8a8('0x5a'),'COUNT DISTINCT':_0xc8a8('0x5b'),'MAX':_0xc8a8('0x5c'),'MIN':'MIN(%s)','AVG':_0xc8a8('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xc8a8('0x5e')};var _0x5081f6={'SEC_TO_TIME':_0xc8a8('0x5f'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xc8a8('0x60'),'UNIX_TIMESTAMP':_0xc8a8('0x61')};var _0x9ff3c1=function(_0x17d1c6){return!_['includes']([_0xc8a8('0x62'),_0xc8a8('0x63'),_0xc8a8('0x64'),_0xc8a8('0x65')],_0x17d1c6);};var _0x4f0b88=function(_0x280f23){if(!_0x280f23||!_0x280f23[_0xc8a8('0x66')][_0xc8a8('0x39')]){return'';}for(var _0x20bea2='(',_0xf34188=0x0;_0xf34188<_0x280f23[_0xc8a8('0x66')][_0xc8a8('0x39')];_0xf34188+=0x1){_0xf34188>0x0&&(_0x20bea2+='\x20'+_0x280f23[_0xc8a8('0x67')]+'\x20');_0x20bea2+=_0x280f23[_0xc8a8('0x66')][_0xf34188][_0xc8a8('0x68')]?_0x4f0b88(_0x280f23['rules'][_0xf34188][_0xc8a8('0x68')]):_0x280f23[_0xc8a8('0x66')][_0xf34188][_0xc8a8('0x69')]+'\x20'+_0x280f23[_0xc8a8('0x66')][_0xf34188]['condition']+(_0x9ff3c1(_0x280f23[_0xc8a8('0x66')][_0xf34188][_0xc8a8('0x6a')])?'\x20'+_0x280f23[_0xc8a8('0x66')][_0xf34188]['value']:'');}return _0x20bea2+')';};var _0x2583ba={'where':{'id':_0xff18b4['params']['id']}},_0x9f3ebe,_0x5b68cf,_0x33dcb7,_0x2bbe9c,_0x47de5b;_0x2583ba=_[_0xc8a8('0x3f')]({},_0x2583ba,_0xff18b4[_0xc8a8('0x48')]);return db[_0xc8a8('0x40')][_0xc8a8('0x49')](_0x2583ba)[_0xc8a8('0x25')](function(_0x66d3d4){if(_0x66d3d4){_0x9f3ebe=_0x66d3d4;return _0x66d3d4[_0xc8a8('0x6b')]();}return null;})[_0xc8a8('0x25')](function(_0x6807d9){if(_0x6807d9){if(!_0x6807d9[_0xc8a8('0x39')]){throw new db['Sequelize'][(_0xc8a8('0x6c'))](_0xc8a8('0x6d'),0x193);}_0x5b68cf=_0x6807d9;return db[_0xc8a8('0x6e')][_0xc8a8('0x6f')]({'raw':!![]});}return null;})[_0xc8a8('0x25')](function(_0x4a976a){if(_0x4a976a){_0x33dcb7=_[_0xc8a8('0x70')](_0x4a976a,'id');var _0x242f8f;var _0x456a83=squel[_0xc8a8('0x71')]();_0x456a83['from'](_0x9f3ebe[_0xc8a8('0x72')]);for(var _0x5f5a2b=0x0;_0x5f5a2b<_0x5b68cf[_0xc8a8('0x39')];_0x5f5a2b+=0x1){_0x242f8f=_0x5b68cf[_0x5f5a2b][_0xc8a8('0x73')]?_0x33dcb7[_0x5b68cf[_0x5f5a2b]['MetricId']]['metric']:_0x5b68cf[_0x5f5a2b][_0xc8a8('0x69')];_0x242f8f=_0x5b68cf[_0x5f5a2b][_0xc8a8('0x74')]?_[_0xc8a8('0x75')](_0x359957[_0x5b68cf[_0x5f5a2b][_0xc8a8('0x74')]],'%s',_0x242f8f):_0x242f8f;_0x242f8f=_0x5b68cf[_0x5f5a2b][_0xc8a8('0x76')]?_[_0xc8a8('0x75')](_0x5081f6[_0x5b68cf[_0x5f5a2b][_0xc8a8('0x76')]],'%s',_0x242f8f):_0x242f8f;if(_0x5b68cf[_0x5f5a2b][_0xc8a8('0x77')]){_0x456a83[_0xc8a8('0x68')](_0x242f8f);}_0x5b68cf[_0x5f5a2b][_0xc8a8('0x78')]&&_0x456a83['order'](_0x242f8f,_0x5b68cf[_0x5f5a2b][_0xc8a8('0x78')]===_0xc8a8('0x79')?![]:!![]);_0x456a83[_0xc8a8('0x69')](_0x242f8f,_0x5b68cf[_0x5f5a2b][_0xc8a8('0x7a')]||_0x242f8f);}if(_0x9f3ebe[_0xc8a8('0x7b')]){_0x9f3ebe[_0xc8a8('0x7b')]=JSON[_0xc8a8('0x7c')](_0x9f3ebe[_0xc8a8('0x7b')]);for(var _0x52390b=0x0;_0x52390b<_0x9f3ebe[_0xc8a8('0x7b')][_0xc8a8('0x39')];_0x52390b+=0x1){if(_0x9f3ebe[_0xc8a8('0x7b')][_0x52390b][_0xc8a8('0x2f')]&&_[_0xc8a8('0x7d')](_0x536129,_0x9f3ebe[_0xc8a8('0x7b')][_0x52390b][_0xc8a8('0x2f')])&&_0x9f3ebe['joins'][_0x52390b]['parentKey']&&_0x9f3ebe[_0xc8a8('0x7b')][_0x52390b]['foreignTable']&&_0x9f3ebe['joins'][_0x52390b][_0xc8a8('0x7e')]){_0x456a83[_0x9f3ebe[_0xc8a8('0x7b')][_0x52390b]['type']](_0x9f3ebe[_0xc8a8('0x7b')][_0x52390b][_0xc8a8('0x7f')],null,util['format'](_0xc8a8('0x80'),_0x9f3ebe[_0xc8a8('0x72')],_0x9f3ebe[_0xc8a8('0x7b')][_0x52390b]['parentKey'],_0x9f3ebe['joins'][_0x52390b][_0xc8a8('0x7f')],_0x9f3ebe[_0xc8a8('0x7b')][_0x52390b]['foreignKey']));}}}if(_0x9f3ebe[_0xc8a8('0x81')]){_0x9f3ebe[_0xc8a8('0x81')]=JSON[_0xc8a8('0x7c')](_0x9f3ebe[_0xc8a8('0x81')]);_0x456a83['where'](_0x4f0b88(_0x9f3ebe[_0xc8a8('0x81')][_0xc8a8('0x68')]));}_0x47de5b=_0x456a83[_0xc8a8('0x82')]();_0x456a83['limit'](_0x31bc22);_0x456a83[_0xc8a8('0x1f')](0x0);logger['debug'](_0xc8a8('0x83'),_0x456a83[_0xc8a8('0x84')]());return dbH[_0xc8a8('0x85')]['query'](_0x456a83[_0xc8a8('0x84')](),{'type':dbH[_0xc8a8('0x85')][_0xc8a8('0x86')]['SELECT']});}})[_0xc8a8('0x25')](respondWithResult(_0x1f91f0,null))['catch'](handleError(_0x1f91f0,null));};function runReport(_0x43b5ac,_0x3600c0,_0x5d2b06){var _0x4613d1=_0x3600c0[_0xc8a8('0x2b')];var _0x59ccae=0xa;var _0x17adde=[_0xc8a8('0x56'),_0xc8a8('0x87'),_0xc8a8('0x57'),'cross_join'];var _0x202cc4={'SUM':_0xc8a8('0x59'),'COUNT':_0xc8a8('0x5a'),'COUNT DISTINCT':_0xc8a8('0x5b'),'MAX':_0xc8a8('0x5c'),'MIN':_0xc8a8('0x88'),'AVG':_0xc8a8('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc8a8('0x89'),'GROUP_CONCAT DESC':_0xc8a8('0x5e')};var _0x24d1f1={'SEC_TO_TIME':_0xc8a8('0x5f'),'DATE':_0xc8a8('0x8a'),'HOUR':_0xc8a8('0x8b'),'ROUND':_0xc8a8('0x60'),'UNIX_TIMESTAMP':_0xc8a8('0x61')};var _0x1ce0e5=function(_0x45296e){return!_['includes'](['IS\x20NULL',_0xc8a8('0x63'),_0xc8a8('0x64'),_0xc8a8('0x65')],_0x45296e);};var _0x3e2a4a=function(_0x3e4b8d){if(!_0x3e4b8d||!_0x3e4b8d['rules'][_0xc8a8('0x39')]){return'';}for(var _0x3e9d51='(',_0xd05ca9=0x0;_0xd05ca9<_0x3e4b8d['rules'][_0xc8a8('0x39')];_0xd05ca9+=0x1){_0xd05ca9>0x0&&(_0x3e9d51+='\x20'+_0x3e4b8d[_0xc8a8('0x67')]+'\x20');_0x3e9d51+=_0x3e4b8d[_0xc8a8('0x66')][_0xd05ca9][_0xc8a8('0x68')]?_0x3e2a4a(_0x3e4b8d[_0xc8a8('0x66')][_0xd05ca9][_0xc8a8('0x68')]):_0x3e4b8d[_0xc8a8('0x66')][_0xd05ca9]['field']+'\x20'+_0x3e4b8d['rules'][_0xd05ca9][_0xc8a8('0x6a')]+(_0x1ce0e5(_0x3e4b8d[_0xc8a8('0x66')][_0xd05ca9][_0xc8a8('0x6a')])?'\x20'+_0x3e4b8d[_0xc8a8('0x66')][_0xd05ca9][_0xc8a8('0x8c')]:'');}return _0x3e9d51+')';};var _0x34d624={'where':{'id':_0x43b5ac['id']}},_0x1b23c1,_0x1917d8,_0x566ed0,_0x2f5468,_0x2587a6;_0x34d624=_[_0xc8a8('0x3f')]({},_0x34d624,_0x5d2b06);return db[_0xc8a8('0x40')][_0xc8a8('0x49')](_0x34d624)[_0xc8a8('0x25')](function(_0xbbe423){if(_0xbbe423){_0x1b23c1=_0xbbe423;return _0xbbe423[_0xc8a8('0x6b')]();}return null;})[_0xc8a8('0x25')](function(_0x1df336){if(_0x1df336){if(!_0x1df336[_0xc8a8('0x39')]){throw new db[(_0xc8a8('0x8d'))][(_0xc8a8('0x6c'))](_0xc8a8('0x6d'),0x193);}_0x1917d8=_0x1df336;return db[_0xc8a8('0x6e')]['findAll']({'raw':!![]});}return null;})[_0xc8a8('0x25')](function(_0x4fc30b){if(_0x4fc30b){_0x566ed0=_[_0xc8a8('0x70')](_0x4fc30b,'id');var _0x5e680f;var _0x239bde=squel[_0xc8a8('0x71')]();_0x239bde[_0xc8a8('0x8e')](_0x1b23c1['table']);for(var _0x43acd1=0x0;_0x43acd1<_0x1917d8[_0xc8a8('0x39')];_0x43acd1+=0x1){_0x5e680f=_0x1917d8[_0x43acd1][_0xc8a8('0x73')]?_0x566ed0[_0x1917d8[_0x43acd1][_0xc8a8('0x73')]][_0xc8a8('0x8f')]:_0x1917d8[_0x43acd1][_0xc8a8('0x69')];_0x5e680f=_0x1917d8[_0x43acd1][_0xc8a8('0x74')]?_[_0xc8a8('0x75')](_0x202cc4[_0x1917d8[_0x43acd1][_0xc8a8('0x74')]],'%s',_0x5e680f):_0x5e680f;_0x5e680f=_0x1917d8[_0x43acd1][_0xc8a8('0x76')]?_[_0xc8a8('0x75')](_0x24d1f1[_0x1917d8[_0x43acd1][_0xc8a8('0x76')]],'%s',_0x5e680f):_0x5e680f;if(_0x1917d8[_0x43acd1]['groupBy']){_0x239bde['group'](_0x5e680f);}_0x1917d8[_0x43acd1][_0xc8a8('0x78')]&&_0x239bde[_0xc8a8('0x3a')](_0x5e680f,_0x1917d8[_0x43acd1][_0xc8a8('0x78')]===_0xc8a8('0x79')?![]:!![]);_0x239bde[_0xc8a8('0x69')](_0x5e680f,_0x1917d8[_0x43acd1][_0xc8a8('0x7a')]||_0x5e680f);}if(_0x1b23c1['joins']){_0x1b23c1[_0xc8a8('0x7b')]=JSON[_0xc8a8('0x7c')](_0x1b23c1[_0xc8a8('0x7b')]);for(var _0x2e7495=0x0;_0x2e7495<_0x1b23c1['joins'][_0xc8a8('0x39')];_0x2e7495+=0x1){if(_0x1b23c1['joins'][_0x2e7495][_0xc8a8('0x2f')]&&_[_0xc8a8('0x7d')](_0x17adde,_0x1b23c1[_0xc8a8('0x7b')][_0x2e7495]['type'])&&_0x1b23c1[_0xc8a8('0x7b')][_0x2e7495]['parentKey']&&_0x1b23c1['joins'][_0x2e7495][_0xc8a8('0x7f')]&&_0x1b23c1['joins'][_0x2e7495]['foreignKey']){_0x239bde[_0x1b23c1[_0xc8a8('0x7b')][_0x2e7495][_0xc8a8('0x2f')]](_0x1b23c1[_0xc8a8('0x7b')][_0x2e7495][_0xc8a8('0x7f')],null,util[_0xc8a8('0x76')]('%s.%s\x20=\x20%s.%s',_0x1b23c1['table'],_0x1b23c1[_0xc8a8('0x7b')][_0x2e7495][_0xc8a8('0x90')],_0x1b23c1[_0xc8a8('0x7b')][_0x2e7495]['foreignTable'],_0x1b23c1[_0xc8a8('0x7b')][_0x2e7495][_0xc8a8('0x7e')]));}}}if(_0x1b23c1['conditions']){_0x1b23c1[_0xc8a8('0x81')]=JSON[_0xc8a8('0x7c')](_0x1b23c1['conditions']);_0x239bde['where'](_0x3e2a4a(_0x1b23c1[_0xc8a8('0x81')][_0xc8a8('0x68')]));}_0x2587a6=_0x239bde['clone']();_0x239bde[_0xc8a8('0x22')](_0x59ccae);_0x239bde[_0xc8a8('0x1f')](0x0);return;}})['then'](function(){if(_0x3600c0[_0xc8a8('0x91')]===_0xc8a8('0x92')){return null;}var _0x3c70a6=_[_0xc8a8('0x3f')](_0x3600c0,{'name':_0x3600c0[_0xc8a8('0x93')]||_0x3600c0['name']||_0x1b23c1[_0xc8a8('0x2b')],'basename':_0x4613d1,'savename':util['format'](_0xc8a8('0x94'),_0x3600c0[_0xc8a8('0x2b')]||_0x1b23c1[_0xc8a8('0x2b')],require(_0xc8a8('0x95'))[_0xc8a8('0x96')](0x4),_0x3600c0[_0xc8a8('0x91')]||_0xc8a8('0x97')),'reportId':_0x1b23c1['id'],'reportType':_0xc8a8('0x98')});return db[_0xc8a8('0x99')]['create'](_0x3c70a6,{'raw':!![]});})['then'](function(_0x867395){if(_0x1b23c1[_0xc8a8('0x72')]===_0xc8a8('0x9a')){_0x2587a6['where'](_0x1b23c1[_0xc8a8('0x72')]+_0xc8a8('0x9b'),_0x3600c0[_0xc8a8('0x9c')],_0x3600c0['endDate']);}else{_0x2587a6[_0xc8a8('0x3c')](_0x1b23c1[_0xc8a8('0x72')]+_0xc8a8('0x9d'),_0x3600c0[_0xc8a8('0x9c')],_0x3600c0[_0xc8a8('0x9e')]);}if(_0x867395){logger[_0xc8a8('0x9f')](_0xc8a8('0xa0'),_0x2587a6[_0xc8a8('0x84')]());require(_0xc8a8('0xa1'))['fork'](path[_0xc8a8('0x56')](__dirname,_0xc8a8('0xa2'),_0x867395[_0xc8a8('0x91')]),[_0x867395['id'],_0x2587a6[_0xc8a8('0x84')](),path[_0xc8a8('0x56')](__dirname,_0xc8a8('0xa3'),_0x867395[_0xc8a8('0xa4')]),_0x4613d1]);return _0x867395;}else{var _0x49e30b=squel[_0xc8a8('0x71')]();_0x49e30b[_0xc8a8('0x8e')]('('+_0x2587a6['toString']()+')',_0xc8a8('0xa5'));_0x49e30b[_0xc8a8('0x69')](_0xc8a8('0xa6'),'count');_0x2587a6[_0xc8a8('0x22')](_0x3600c0[_0xc8a8('0x22')]||_0x59ccae);_0x2587a6[_0xc8a8('0x1f')](_0x3600c0[_0xc8a8('0x1f')]||0x0);return dbH['sequelize']['query'](_0x49e30b[_0xc8a8('0x84')](),{'type':dbH['sequelize'][_0xc8a8('0x86')][_0xc8a8('0xa7')]})[_0xc8a8('0x25')](function(_0x5213e5){if(!_0x5213e5[_0xc8a8('0x39')]){_0x2f5468=0x0;}else{_0x2f5468=_0x5213e5[0x0][_0xc8a8('0x21')]||0x0;}return dbH['sequelize'][_0xc8a8('0x33')](_0x2587a6[_0xc8a8('0x84')](),{'type':dbH[_0xc8a8('0x85')][_0xc8a8('0x86')]['SELECT']});})['then'](function(_0x45e97f){return{'rows':_0x45e97f||[],'count':_0x2f5468};});}});}exports[_0xc8a8('0xa8')]=function(_0xc0d592,_0x2b2f91){return runReport(_0xc0d592[_0xc8a8('0x46')],_0xc0d592[_0xc8a8('0x33')],_0xc0d592[_0xc8a8('0x48')])['then'](respondWithResult(_0x2b2f91,null))['catch'](handleError(_0x2b2f91,null));};exports[_0xc8a8('0xa9')]=runReport;exports[_0xc8a8('0x33')]=function(_0x34da14,_0x4a2fd7){var _0xdaf5f7=0xa;var _0x2d74df=['join',_0xc8a8('0x87'),_0xc8a8('0x57'),_0xc8a8('0x58')];var _0x38789a={'SUM':_0xc8a8('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xc8a8('0x5b'),'MAX':_0xc8a8('0x5c'),'MIN':_0xc8a8('0x88'),'AVG':_0xc8a8('0x5d'),'GROUP_CONCAT':_0xc8a8('0xaa'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xc8a8('0x5e')};var _0x1b6c55={'SEC_TO_TIME':_0xc8a8('0x5f'),'DATE':_0xc8a8('0x8a'),'HOUR':_0xc8a8('0x8b'),'ROUND':_0xc8a8('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x436e51=function(_0x20038b){return!_[_0xc8a8('0x7d')]([_0xc8a8('0x62'),_0xc8a8('0x63'),'IS\x20EMPTY',_0xc8a8('0x65')],_0x20038b);};var _0xa3724=function(_0x5f0b16){if(!_0x5f0b16||!_0x5f0b16[_0xc8a8('0x66')][_0xc8a8('0x39')]){return'';}for(var _0x99fe47='(',_0x2aa253=0x0;_0x2aa253<_0x5f0b16[_0xc8a8('0x66')][_0xc8a8('0x39')];_0x2aa253+=0x1){_0x2aa253>0x0&&(_0x99fe47+='\x20'+_0x5f0b16[_0xc8a8('0x67')]+'\x20');_0x99fe47+=_0x5f0b16[_0xc8a8('0x66')][_0x2aa253][_0xc8a8('0x68')]?_0xa3724(_0x5f0b16['rules'][_0x2aa253][_0xc8a8('0x68')]):_0x5f0b16[_0xc8a8('0x66')][_0x2aa253][_0xc8a8('0x69')]+'\x20'+_0x5f0b16[_0xc8a8('0x66')][_0x2aa253][_0xc8a8('0x6a')]+(_0x436e51(_0x5f0b16[_0xc8a8('0x66')][_0x2aa253][_0xc8a8('0x6a')])?'\x20'+_0x5f0b16[_0xc8a8('0x66')][_0x2aa253]['value']:'');}return _0x99fe47+')';};var _0x43463d={'where':{'id':_0x34da14[_0xc8a8('0x46')]['id']}},_0x42e18f,_0x22623e,_0x125fdb,_0x4fd25e,_0x307410;_0x43463d=_[_0xc8a8('0x3f')]({},_0x43463d,_0x34da14[_0xc8a8('0x48')]);return db[_0xc8a8('0x40')]['find'](_0x43463d)[_0xc8a8('0x25')](function(_0xfd0c54){if(_0xfd0c54){_0x42e18f=_0xfd0c54;return _0xfd0c54[_0xc8a8('0x6b')]();}return null;})[_0xc8a8('0x25')](function(_0x51d4a2){if(_0x51d4a2){if(!_0x51d4a2[_0xc8a8('0x39')]){throw new db[(_0xc8a8('0x8d'))]['ValidationErrorItem'](_0xc8a8('0x6d'),0x193);}_0x22623e=_0x51d4a2;return db[_0xc8a8('0x6e')][_0xc8a8('0x6f')]({'raw':!![]});}return null;})[_0xc8a8('0x25')](function(_0x527509){if(_0x527509){_0x125fdb=_[_0xc8a8('0x70')](_0x527509,'id');var _0x1f919b;var _0x32a7df=squel[_0xc8a8('0x71')]();_0x32a7df[_0xc8a8('0x8e')](_0x42e18f[_0xc8a8('0x72')]);for(var _0x57c9b8=0x0;_0x57c9b8<_0x22623e[_0xc8a8('0x39')];_0x57c9b8+=0x1){_0x1f919b=_0x22623e[_0x57c9b8][_0xc8a8('0x73')]?_0x125fdb[_0x22623e[_0x57c9b8][_0xc8a8('0x73')]][_0xc8a8('0x8f')]:_0x22623e[_0x57c9b8][_0xc8a8('0x69')];_0x1f919b=_0x22623e[_0x57c9b8][_0xc8a8('0x74')]?_[_0xc8a8('0x75')](_0x38789a[_0x22623e[_0x57c9b8][_0xc8a8('0x74')]],'%s',_0x1f919b):_0x1f919b;_0x1f919b=_0x22623e[_0x57c9b8][_0xc8a8('0x76')]?_[_0xc8a8('0x75')](_0x1b6c55[_0x22623e[_0x57c9b8][_0xc8a8('0x76')]],'%s',_0x1f919b):_0x1f919b;if(_0x22623e[_0x57c9b8][_0xc8a8('0x77')]){_0x32a7df[_0xc8a8('0x68')](_0x1f919b);}_0x22623e[_0x57c9b8][_0xc8a8('0x78')]&&_0x32a7df[_0xc8a8('0x3a')](_0x1f919b,_0x22623e[_0x57c9b8][_0xc8a8('0x78')]===_0xc8a8('0x79')?![]:!![]);_0x32a7df[_0xc8a8('0x69')](_0x1f919b,_0x22623e[_0x57c9b8]['alias']||_0x1f919b);}if(_0x42e18f['joins']){_0x42e18f[_0xc8a8('0x7b')]=JSON[_0xc8a8('0x7c')](_0x42e18f[_0xc8a8('0x7b')]);for(var _0x50f83c=0x0;_0x50f83c<_0x42e18f[_0xc8a8('0x7b')]['length'];_0x50f83c+=0x1){if(_0x42e18f['joins'][_0x50f83c]['type']&&_[_0xc8a8('0x7d')](_0x2d74df,_0x42e18f[_0xc8a8('0x7b')][_0x50f83c][_0xc8a8('0x2f')])&&_0x42e18f[_0xc8a8('0x7b')][_0x50f83c][_0xc8a8('0x90')]&&_0x42e18f[_0xc8a8('0x7b')][_0x50f83c][_0xc8a8('0x7f')]&&_0x42e18f['joins'][_0x50f83c]['foreignKey']){_0x32a7df[_0x42e18f[_0xc8a8('0x7b')][_0x50f83c][_0xc8a8('0x2f')]](_0x42e18f[_0xc8a8('0x7b')][_0x50f83c]['foreignTable'],null,util['format'](_0xc8a8('0x80'),_0x42e18f[_0xc8a8('0x72')],_0x42e18f['joins'][_0x50f83c][_0xc8a8('0x90')],_0x42e18f[_0xc8a8('0x7b')][_0x50f83c][_0xc8a8('0x7f')],_0x42e18f['joins'][_0x50f83c][_0xc8a8('0x7e')]));}}}if(_0x42e18f['conditions']){_0x42e18f[_0xc8a8('0x81')]=JSON[_0xc8a8('0x7c')](_0x42e18f[_0xc8a8('0x81')]);_0x32a7df['where'](_0xa3724(_0x42e18f[_0xc8a8('0x81')][_0xc8a8('0x68')]));}_0x307410=_0x32a7df[_0xc8a8('0x82')]();_0x32a7df[_0xc8a8('0x22')](_0xdaf5f7);_0x32a7df[_0xc8a8('0x1f')](0x0);logger['debug'](_0xc8a8('0x83'),_0x32a7df['toString']());return dbH[_0xc8a8('0x85')]['query'](_0x32a7df['toString'](),{'type':dbH[_0xc8a8('0x85')][_0xc8a8('0x86')][_0xc8a8('0xa7')]});}})['then'](function(){return{'sql':_0x307410[_0xc8a8('0x84')]()};})[_0xc8a8('0x25')](respondWithResult(_0x4a2fd7,null))['catch'](handleError(_0x4a2fd7,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index e207c1e..2e794ec 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 _0x4059=['../../config/environment','./analyticCustomReport.attributes','exports','define','analytics_custom_reports','lodash','util','../../config/logger','request-promise'];(function(_0x28e5f7,_0x18ce28){var _0x1ba4de=function(_0x3775dd){while(--_0x3775dd){_0x28e5f7['push'](_0x28e5f7['shift']());}};_0x1ba4de(++_0x18ce28);}(_0x4059,0x1c7));var _0x9405=function(_0x5d60d0,_0x406cb4){_0x5d60d0=_0x5d60d0-0x0;var _0x1ce8dd=_0x4059[_0x5d60d0];return _0x1ce8dd;};'use strict';var _=require(_0x9405('0x0'));var util=require(_0x9405('0x1'));var logger=require(_0x9405('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9405('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9405('0x4'));var attributes=require(_0x9405('0x5'));module[_0x9405('0x6')]=function(_0x54414a,_0x262a84){return _0x54414a[_0x9405('0x7')]('AnalyticCustomReport',attributes,{'tableName':_0x9405('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x21a0=['./analyticCustomReport.attributes','define','AnalyticCustomReport','analytics_custom_reports','util','../../config/logger','api','moment','bluebird','../../config/environment'];(function(_0x1dec27,_0x18863c){var _0x1c26f1=function(_0x3dae7c){while(--_0x3dae7c){_0x1dec27['push'](_0x1dec27['shift']());}};_0x1c26f1(++_0x18863c);}(_0x21a0,0x19e));var _0x021a=function(_0x480607,_0x4e6d1f){_0x480607=_0x480607-0x0;var _0x353e6a=_0x21a0[_0x480607];return _0x353e6a;};'use strict';var _=require('lodash');var util=require(_0x021a('0x0'));var logger=require(_0x021a('0x1'))(_0x021a('0x2'));var moment=require(_0x021a('0x3'));var BPromise=require(_0x021a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x021a('0x5'));var attributes=require(_0x021a('0x6'));module['exports']=function(_0x2f2a87,_0x5b4d4f){return _0x2f2a87[_0x021a('0x7')](_0x021a('0x8'),attributes,{'tableName':_0x021a('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 494968b..2760418 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 _0xc541=['moment','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','AnalyticCustomReport,\x20%s,\x20%s','lodash'];(function(_0x52a295,_0x4f5804){var _0x2424e0=function(_0x315c2a){while(--_0x315c2a){_0x52a295['push'](_0x52a295['shift']());}};_0x2424e0(++_0x4f5804);}(_0xc541,0x8f));var _0x1c54=function(_0x35f7f5,_0x4e2ee1){_0x35f7f5=_0x35f7f5-0x0;var _0x5567a4=_0xc541[_0x35f7f5];return _0x5567a4;};'use strict';var _=require(_0x1c54('0x0'));var util=require('util');var moment=require(_0x1c54('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1c54('0x2'));var config=require(_0x1c54('0x3'));var jayson=require(_0x1c54('0x4'));var client=jayson[_0x1c54('0x5')][_0x1c54('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x332b82,_0x577d7d,_0xa300ea){return new BPromise(function(_0x344ea7,_0x2575b2){return client[_0x1c54('0x7')](_0x332b82,_0xa300ea)['then'](function(_0x2dd8d8){logger[_0x1c54('0x8')]('AnalyticCustomReport,\x20%s,\x20%s',_0x577d7d,'request\x20sent');logger[_0x1c54('0x9')](_0x1c54('0xa'),_0x577d7d,_0x1c54('0xb'),JSON[_0x1c54('0xc')](_0x2dd8d8));if(_0x2dd8d8[_0x1c54('0xd')]){if(_0x2dd8d8[_0x1c54('0xd')]['code']===0x1f4){logger[_0x1c54('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x577d7d,_0x2dd8d8[_0x1c54('0xd')][_0x1c54('0xe')]);return _0x2575b2(_0x2dd8d8[_0x1c54('0xd')]['message']);}logger[_0x1c54('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x577d7d,_0x2dd8d8[_0x1c54('0xd')][_0x1c54('0xe')]);return _0x344ea7(_0x2dd8d8['error'][_0x1c54('0xe')]);}else{logger[_0x1c54('0x8')](_0x1c54('0xf'),_0x577d7d,_0x1c54('0xb'));_0x344ea7(_0x2dd8d8['result'][_0x1c54('0xe')]);}})['catch'](function(_0x21f065){logger[_0x1c54('0xd')](_0x1c54('0xf'),_0x577d7d,_0x21f065);_0x2575b2(_0x21f065);});});} \ No newline at end of file +var _0x8acf=['stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x5cc1f6,_0x136a2e){var _0x4dcc9f=function(_0xefeb49){while(--_0xefeb49){_0x5cc1f6['push'](_0x5cc1f6['shift']());}};_0x4dcc9f(++_0x136a2e);}(_0x8acf,0xdf));var _0xf8ac=function(_0x483102,_0x54e93d){_0x483102=_0x483102-0x0;var _0x5cc885=_0x8acf[_0x483102];return _0x5cc885;};'use strict';var _=require(_0xf8ac('0x0'));var util=require('util');var moment=require(_0xf8ac('0x1'));var BPromise=require(_0xf8ac('0x2'));var rs=require(_0xf8ac('0x3'));var fs=require('fs');var Redis=require(_0xf8ac('0x4'));var db=require(_0xf8ac('0x5'))['db'];var utils=require(_0xf8ac('0x6'));var logger=require(_0xf8ac('0x7'))(_0xf8ac('0x8'));var config=require(_0xf8ac('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf8ac('0xa')][_0xf8ac('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x337940,_0x24d5b5,_0x3271d7){return new BPromise(function(_0x2a858d,_0x2b6b1d){return client['request'](_0x337940,_0x3271d7)[_0xf8ac('0xc')](function(_0x2d1321){logger['info'](_0xf8ac('0xd'),_0x24d5b5,'request\x20sent');logger[_0xf8ac('0xe')](_0xf8ac('0xf'),_0x24d5b5,_0xf8ac('0x10'),JSON[_0xf8ac('0x11')](_0x2d1321));if(_0x2d1321[_0xf8ac('0x12')]){if(_0x2d1321[_0xf8ac('0x12')][_0xf8ac('0x13')]===0x1f4){logger['error'](_0xf8ac('0xd'),_0x24d5b5,_0x2d1321['error'][_0xf8ac('0x14')]);return _0x2b6b1d(_0x2d1321[_0xf8ac('0x12')][_0xf8ac('0x14')]);}logger[_0xf8ac('0x12')](_0xf8ac('0xd'),_0x24d5b5,_0x2d1321[_0xf8ac('0x12')][_0xf8ac('0x14')]);return _0x2a858d(_0x2d1321['error'][_0xf8ac('0x14')]);}else{logger[_0xf8ac('0x15')]('AnalyticCustomReport,\x20%s,\x20%s',_0x24d5b5,_0xf8ac('0x10'));_0x2a858d(_0x2d1321[_0xf8ac('0x16')][_0xf8ac('0x14')]);}})[_0xf8ac('0x17')](function(_0x486704){logger[_0xf8ac('0x12')](_0xf8ac('0xd'),_0x24d5b5,_0x486704);_0x2b6b1d(_0x486704);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 599299a..14a7244 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 _0x6946=['isAuthenticated','index','/:id','show','preview','/:id/run','run','put','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get'];(function(_0x10dc60,_0x2fcce1){var _0x47dec5=function(_0x24b5e4){while(--_0x24b5e4){_0x10dc60['push'](_0x10dc60['shift']());}};_0x47dec5(++_0x2fcce1);}(_0x6946,0xbf));var _0x6694=function(_0x466ffe,_0x34706b){_0x466ffe=_0x466ffe-0x0;var _0x10e04d=_0x6946[_0x466ffe];return _0x10e04d;};'use strict';var multer=require(_0x6694('0x0'));var util=require('util');var path=require(_0x6694('0x1'));var timeout=require(_0x6694('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6694('0x3'));var auth=require(_0x6694('0x4'));var interaction=require(_0x6694('0x5'));var config=require(_0x6694('0x6'));var controller=require(_0x6694('0x7'));router[_0x6694('0x8')]('/',auth[_0x6694('0x9')](),controller[_0x6694('0xa')]);router[_0x6694('0x8')](_0x6694('0xb'),auth['isAuthenticated'](),controller[_0x6694('0xc')]);router['get']('/:id/preview',auth[_0x6694('0x9')](),controller[_0x6694('0xd')]);router[_0x6694('0x8')](_0x6694('0xe'),auth[_0x6694('0x9')](),controller[_0x6694('0xf')]);router[_0x6694('0x8')]('/:id/query',auth['isAuthenticated'](),controller['query']);router['post']('/',auth[_0x6694('0x9')](),controller['create']);router[_0x6694('0x10')](_0x6694('0xb'),auth[_0x6694('0x9')](),controller['update']);router[_0x6694('0x11')](_0x6694('0xb'),auth[_0x6694('0x9')](),controller[_0x6694('0x12')]);module[_0x6694('0x13')]=router; \ No newline at end of file +var _0x5f43=['/:id/preview','/:id/run','run','/:id/query','query','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','index','/:id','isAuthenticated','show'];(function(_0x43dd04,_0x306cca){var _0x227d37=function(_0x5d1c28){while(--_0x5d1c28){_0x43dd04['push'](_0x43dd04['shift']());}};_0x227d37(++_0x306cca);}(_0x5f43,0x178));var _0x35f4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f43[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x35f4('0x0'));var util=require(_0x35f4('0x1'));var path=require(_0x35f4('0x2'));var timeout=require(_0x35f4('0x3'));var express=require(_0x35f4('0x4'));var router=express[_0x35f4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x35f4('0x6'));var interaction=require(_0x35f4('0x7'));var config=require(_0x35f4('0x8'));var controller=require(_0x35f4('0x9'));router[_0x35f4('0xa')]('/',auth['isAuthenticated'](),controller[_0x35f4('0xb')]);router[_0x35f4('0xa')](_0x35f4('0xc'),auth[_0x35f4('0xd')](),controller[_0x35f4('0xe')]);router[_0x35f4('0xa')](_0x35f4('0xf'),auth[_0x35f4('0xd')](),controller['preview']);router[_0x35f4('0xa')](_0x35f4('0x10'),auth['isAuthenticated'](),controller[_0x35f4('0x11')]);router['get'](_0x35f4('0x12'),auth['isAuthenticated'](),controller[_0x35f4('0x13')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x35f4('0x14')]('/:id',auth[_0x35f4('0xd')](),controller['update']);router[_0x35f4('0x15')](_0x35f4('0xc'),auth[_0x35f4('0xd')](),controller['destroy']);module[_0x35f4('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 20ecca7..c09607a 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 _0xb138=['TEXT','sequelize','exports','STRING'];(function(_0x502c44,_0x35405c){var _0x4ffbcf=function(_0x3df300){while(--_0x3df300){_0x502c44['push'](_0x502c44['shift']());}};_0x4ffbcf(++_0x35405c);}(_0xb138,0x1dd));var _0x8b13=function(_0x55b44c,_0x4a070a){_0x55b44c=_0x55b44c-0x0;var _0x768ac6=_0xb138[_0x55b44c];return _0x768ac6;};'use strict';var Sequelize=require(_0x8b13('0x0'));module[_0x8b13('0x1')]={'name':{'type':Sequelize[_0x8b13('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8b13('0x2')]},'parent':{'type':Sequelize[_0x8b13('0x2')]},'table':{'type':Sequelize[_0x8b13('0x2')]},'conditions':{'type':Sequelize[_0x8b13('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x46ed=['sequelize','exports','STRING','TEXT'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x46ed,0x168));var _0xd46e=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x46ed[_0x5d6456];return _0x4d66c1;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd46e('0x2')]},'parent':{'type':Sequelize[_0xd46e('0x2')]},'table':{'type':Sequelize[_0xd46e('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xd46e('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 9151bcf..7139a55 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 _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(_0x2c0bb4,_0xd83a7a){var _0x6a14eb=function(_0x4ac762){while(--_0x4ac762){_0x2c0bb4['push'](_0x2c0bb4['shift']());}};_0x6a14eb(++_0xd83a7a);}(_0x814b,0x1a2));var _0xb814=function(_0x269e23,_0x14d11c){_0x269e23=_0x269e23-0x0;var _0x69ad53=_0x814b[_0x269e23];return _0x69ad53;};'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 +var _0x5fc3=['QueryTypes','right_join','HOUR(%s)','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','dbH','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','DefaultReports','destroy','error','stack','name','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','field','condition','value','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','groupBy','orderBy','order','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','format','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','sequelize','toString','SELECT','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','getFields','ValidationErrorItem','fullPath','%s-%s.%s','generate','output','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)'];(function(_0x576144,_0x1f3180){var _0x20c236=function(_0x2046f0){while(--_0x2046f0){_0x576144['push'](_0x576144['shift']());}};_0x20c236(++_0x1f3180);}(_0x5fc3,0xa8));var _0x35fc=function(_0x30d87a,_0xf3a07f){_0x30d87a=_0x30d87a-0x0;var _0x48f64b=_0x5fc3[_0x30d87a];return _0x48f64b;};'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'];var dbH=require('../../mysqldb')[_0x35fc('0x17')];function respondWithStatusCode(_0x5d462a,_0x397738){_0x397738=_0x397738||0xcc;return function(_0x22055e){if(_0x22055e){return _0x5d462a[_0x35fc('0x18')](_0x397738);}return _0x5d462a[_0x35fc('0x19')](_0x397738)[_0x35fc('0x1a')]();};}function respondWithResult(_0x5cfe94,_0x59507a){_0x59507a=_0x59507a||0xc8;return function(_0x5eac0f){if(_0x5eac0f){return _0x5cfe94['status'](_0x59507a)[_0x35fc('0x1b')](_0x5eac0f);}};}function respondWithFilteredResult(_0x229d56,_0x53b898){return function(_0x154958){if(_0x154958){var _0x227a49=typeof _0x53b898[_0x35fc('0x1c')]==='undefined'&&typeof _0x53b898[_0x35fc('0x1d')]===_0x35fc('0x1e');var _0x553677=_0x154958[_0x35fc('0x1f')];var _0x363e47=_0x227a49?0x0:_0x53b898[_0x35fc('0x1c')];var _0x5f56c6=_0x227a49?_0x154958[_0x35fc('0x1f')]:_0x53b898[_0x35fc('0x1c')]+_0x53b898[_0x35fc('0x1d')];var _0x488234;if(_0x5f56c6>=_0x553677){_0x5f56c6=_0x553677;_0x488234=0xc8;}else{_0x488234=0xce;}_0x229d56[_0x35fc('0x19')](_0x488234);return _0x229d56[_0x35fc('0x20')](_0x35fc('0x21'),_0x363e47+'-'+_0x5f56c6+'/'+_0x553677)[_0x35fc('0x1b')](_0x154958);}return null;};}function patchUpdates(_0x20ffde){return function(_0x21f1a9){try{jsonpatch[_0x35fc('0x22')](_0x21f1a9,_0x20ffde,!![]);}catch(_0x3b05b0){return BPromise[_0x35fc('0x23')](_0x3b05b0);}return _0x21f1a9[_0x35fc('0x24')]();};}function saveUpdates(_0x5bd2b8,_0x323aee){return function(_0xd5399f){if(_0xd5399f){return _0xd5399f[_0x35fc('0x25')](_0x5bd2b8)[_0x35fc('0x26')](function(_0x3b4743){return _0x3b4743;});}return null;};}function removeEntity(_0x55e9e7,_0x33f5e8){return function(_0x4c587a){if(_0x4c587a){return _0x4c587a['destroy']()[_0x35fc('0x26')](function(){var _0x5a93df=_0x4c587a[_0x35fc('0x27')]({'plain':!![]});var _0x51cfec=_0x35fc('0x28');return db['UserProfileResource'][_0x35fc('0x29')]({'where':{'type':_0x51cfec,'resourceId':_0x5a93df['id']}})[_0x35fc('0x26')](function(){return _0x4c587a;});})['then'](function(){_0x55e9e7['status'](0xcc)[_0x35fc('0x1a')]();});}};}function handleEntityNotFound(_0x58edb6,_0x274208){return function(_0x1a5d92){if(!_0x1a5d92){_0x58edb6['sendStatus'](0x194);}return _0x1a5d92;};}function handleError(_0x26b7cb,_0x645eac){_0x645eac=_0x645eac||0x1f4;return function(_0x383837){logger[_0x35fc('0x2a')](_0x383837[_0x35fc('0x2b')]);if(_0x383837[_0x35fc('0x2c')]){delete _0x383837[_0x35fc('0x2c')];}_0x26b7cb[_0x35fc('0x19')](_0x645eac)['send'](_0x383837);};}exports[_0x35fc('0x2d')]=function(_0x220931,_0x22af18){var _0x52acc5={},_0xe79f52={},_0x16f067={'count':0x0,'rows':[]};var _0x3822a8=_[_0x35fc('0x2e')](db[_0x35fc('0x2f')][_0x35fc('0x30')],function(_0x222ddb){return{'name':_0x222ddb[_0x35fc('0x31')],'type':_0x222ddb[_0x35fc('0x32')][_0x35fc('0x33')]};});_0xe79f52['model']=_['map'](_0x3822a8,_0x35fc('0x2c'));_0xe79f52['query']=_[_0x35fc('0x34')](_0x220931[_0x35fc('0x35')]);_0xe79f52[_0x35fc('0x36')]=_[_0x35fc('0x37')](_0xe79f52[_0x35fc('0x38')],_0xe79f52[_0x35fc('0x35')]);_0x52acc5['attributes']=_[_0x35fc('0x37')](_0xe79f52[_0x35fc('0x38')],qs[_0x35fc('0x39')](_0x220931[_0x35fc('0x35')][_0x35fc('0x39')]));_0x52acc5[_0x35fc('0x3a')]=_0x52acc5['attributes'][_0x35fc('0x3b')]?_0x52acc5[_0x35fc('0x3a')]:_0xe79f52[_0x35fc('0x38')];if(!_0x220931['query'][_0x35fc('0x3c')]('nolimit')){_0x52acc5[_0x35fc('0x1d')]=qs[_0x35fc('0x1d')](_0x220931[_0x35fc('0x35')][_0x35fc('0x1d')]);_0x52acc5['offset']=qs['offset'](_0x220931['query'][_0x35fc('0x1c')]);}_0x52acc5['order']=qs[_0x35fc('0x3d')](_0x220931['query'][_0x35fc('0x3d')]);_0x52acc5[_0x35fc('0x3e')]=qs[_0x35fc('0x36')](_[_0x35fc('0x3f')](_0x220931[_0x35fc('0x35')],_0xe79f52[_0x35fc('0x36')]),_0x3822a8);if(_0x220931[_0x35fc('0x35')]['filter']){_0x52acc5[_0x35fc('0x3e')]=_[_0x35fc('0x40')](_0x52acc5['where'],{'$or':_[_0x35fc('0x2e')](_0x3822a8,function(_0x1ccc41){if(_0x1ccc41[_0x35fc('0x32')]!==_0x35fc('0x41')){var _0x813866={};_0x813866[_0x1ccc41[_0x35fc('0x2c')]]={'$like':'%'+_0x220931['query'][_0x35fc('0x42')]+'%'};return _0x813866;}})});}_0x52acc5=_[_0x35fc('0x40')]({},_0x52acc5,_0x220931[_0x35fc('0x43')]);var _0x52543b={'where':_0x52acc5[_0x35fc('0x3e')]};return db[_0x35fc('0x2f')]['count'](_0x52543b)[_0x35fc('0x26')](function(_0x280af1){_0x16f067[_0x35fc('0x1f')]=_0x280af1;if(_0x220931[_0x35fc('0x35')][_0x35fc('0x44')]){_0x52acc5[_0x35fc('0x45')]=[{'all':!![]}];}return db[_0x35fc('0x2f')][_0x35fc('0x46')](_0x52acc5);})['then'](function(_0x596e83){_0x16f067[_0x35fc('0x47')]=_0x596e83;return _0x16f067;})[_0x35fc('0x26')](respondWithFilteredResult(_0x22af18,_0x52acc5))['catch'](handleError(_0x22af18,null));};exports['show']=function(_0x4ff202,_0x79677d){var _0x10f98b={'raw':!![],'where':{'id':_0x4ff202[_0x35fc('0x48')]['id']}},_0x4e56ed={};_0x4e56ed[_0x35fc('0x38')]=_[_0x35fc('0x34')](db[_0x35fc('0x2f')]['rawAttributes']);_0x4e56ed['query']=_['keys'](_0x4ff202['query']);_0x4e56ed['filters']=_[_0x35fc('0x37')](_0x4e56ed[_0x35fc('0x38')],_0x4e56ed['query']);_0x10f98b[_0x35fc('0x3a')]=_['intersection'](_0x4e56ed[_0x35fc('0x38')],qs[_0x35fc('0x39')](_0x4ff202[_0x35fc('0x35')][_0x35fc('0x39')]));_0x10f98b[_0x35fc('0x3a')]=_0x10f98b['attributes'][_0x35fc('0x3b')]?_0x10f98b[_0x35fc('0x3a')]:_0x4e56ed['model'];if(_0x4ff202[_0x35fc('0x35')][_0x35fc('0x44')]){_0x10f98b[_0x35fc('0x45')]=[{'all':!![]}];}_0x10f98b=_[_0x35fc('0x40')]({},_0x10f98b,_0x4ff202['options']);return db[_0x35fc('0x2f')]['find'](_0x10f98b)['then'](handleEntityNotFound(_0x79677d,null))[_0x35fc('0x26')](respondWithResult(_0x79677d,null))[_0x35fc('0x49')](handleError(_0x79677d,null));};exports[_0x35fc('0x4a')]=function(_0xca8aef,_0xf2ca20){return db[_0x35fc('0x2f')][_0x35fc('0x4a')](_0xca8aef[_0x35fc('0x4b')],{})['then'](function(_0x3e2961){var _0x91d7c0=_0xca8aef[_0x35fc('0x4c')][_0x35fc('0x27')]({'plain':!![]});if(!_0x91d7c0)throw new Error(_0x35fc('0x4d'));if(_0x91d7c0[_0x35fc('0x4e')]===_0x35fc('0x4c')){var _0x347a4a=_0x3e2961[_0x35fc('0x27')]({'plain':!![]});var _0xe6eb6a=_0x35fc('0x4f');return db[_0x35fc('0x50')][_0x35fc('0x51')]({'where':{'name':_0xe6eb6a,'userProfileId':_0x91d7c0[_0x35fc('0x52')]},'raw':!![]})['then'](function(_0x553ed6){if(_0x553ed6&&_0x553ed6[_0x35fc('0x53')]===0x0){return db[_0x35fc('0x54')][_0x35fc('0x4a')]({'name':_0x347a4a[_0x35fc('0x2c')],'resourceId':_0x347a4a['id'],'type':_0x35fc('0x28'),'sectionId':_0x553ed6['id']},{})[_0x35fc('0x26')](function(){return _0x3e2961;});}else{return _0x3e2961;}})['catch'](function(_0x4f024c){logger[_0x35fc('0x2a')](_0x35fc('0x55'),_0x4f024c);throw _0x4f024c;});}return _0x3e2961;})[_0x35fc('0x26')](respondWithResult(_0xf2ca20,0xc9))[_0x35fc('0x49')](handleError(_0xf2ca20,null));};exports['update']=function(_0x467980,_0x13281f){if(_0x467980['body']['id']){delete _0x467980[_0x35fc('0x4b')]['id'];}return db[_0x35fc('0x2f')]['find']({'where':{'id':_0x467980[_0x35fc('0x48')]['id']}})[_0x35fc('0x26')](handleEntityNotFound(_0x13281f,null))[_0x35fc('0x26')](saveUpdates(_0x467980[_0x35fc('0x4b')],null))['then'](respondWithResult(_0x13281f,null))['catch'](handleError(_0x13281f,null));};exports['destroy']=function(_0x240338,_0x2ea8d6){return db['AnalyticDefaultReport'][_0x35fc('0x51')]({'where':{'id':_0x240338[_0x35fc('0x48')]['id']}})[_0x35fc('0x26')](handleEntityNotFound(_0x2ea8d6,null))[_0x35fc('0x26')](removeEntity(_0x2ea8d6,null))[_0x35fc('0x49')](handleError(_0x2ea8d6,null));};exports['preview']=function(_0x2d9d45,_0x757aa6){var _0x39d470=0xa;var _0x509e77=[_0x35fc('0x56'),_0x35fc('0x57'),'right_join',_0x35fc('0x58')];var _0x164c7b={'SUM':_0x35fc('0x59'),'COUNT':_0x35fc('0x5a'),'COUNT DISTINCT':_0x35fc('0x5b'),'MAX':_0x35fc('0x5c'),'MIN':_0x35fc('0x5d'),'AVG':_0x35fc('0x5e'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x35fc('0x5f'),'GROUP_CONCAT DESC':_0x35fc('0x60')};var _0x303927={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x35fc('0x61'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x23b54f=function(_0xb1c68a){return!_[_0x35fc('0x62')]([_0x35fc('0x63'),_0x35fc('0x64'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0xb1c68a);};var _0x5353ea=function(_0x4faef4){if(!_0x4faef4||!_0x4faef4['rules'][_0x35fc('0x3b')]){return'';}for(var _0x44250b='(',_0xd470e8=0x0;_0xd470e8<_0x4faef4[_0x35fc('0x65')]['length'];_0xd470e8+=0x1){_0xd470e8>0x0&&(_0x44250b+='\x20'+_0x4faef4[_0x35fc('0x66')]+'\x20');_0x44250b+=_0x4faef4[_0x35fc('0x65')][_0xd470e8][_0x35fc('0x67')]?_0x5353ea(_0x4faef4[_0x35fc('0x65')][_0xd470e8][_0x35fc('0x67')]):_0x4faef4[_0x35fc('0x65')][_0xd470e8][_0x35fc('0x68')]+'\x20'+_0x4faef4[_0x35fc('0x65')][_0xd470e8][_0x35fc('0x69')]+(_0x23b54f(_0x4faef4['rules'][_0xd470e8][_0x35fc('0x69')])?'\x20'+_0x4faef4['rules'][_0xd470e8][_0x35fc('0x6a')]:'');}return _0x44250b+')';};var _0x9029e3={'where':{'id':_0x2d9d45['params']['id']}},_0x2ac8e1,_0x2bc76c,_0x4bdde7,_0x465c14,_0x4af592;_0x9029e3=_['merge']({},_0x9029e3,_0x2d9d45[_0x35fc('0x43')]);return db['AnalyticDefaultReport'][_0x35fc('0x51')](_0x9029e3)['then'](function(_0x11717){if(_0x11717){_0x2ac8e1=_0x11717;return _0x11717['getFields']();}return null;})[_0x35fc('0x26')](function(_0x455b84){if(_0x455b84){if(!_0x455b84[_0x35fc('0x3b')]){throw new db[(_0x35fc('0x6b'))]['ValidationErrorItem'](_0x35fc('0x6c'),0x193);}_0x2bc76c=_0x455b84;return db[_0x35fc('0x6d')][_0x35fc('0x46')]({'raw':!![]});}return null;})['then'](function(_0x3aa7fa){if(_0x3aa7fa){_0x4bdde7=_[_0x35fc('0x6e')](_0x3aa7fa,'id');var _0x37764b;var _0x3c1b56=squel[_0x35fc('0x6f')]();_0x3c1b56[_0x35fc('0x70')](_0x2ac8e1[_0x35fc('0x71')]);for(var _0x4464d5=0x0;_0x4464d5<_0x2bc76c['length'];_0x4464d5+=0x1){_0x37764b=_0x2bc76c[_0x4464d5][_0x35fc('0x72')]?_0x4bdde7[_0x2bc76c[_0x4464d5][_0x35fc('0x72')]][_0x35fc('0x73')]:_0x2bc76c[_0x4464d5]['field'];_0x37764b=_0x2bc76c[_0x4464d5][_0x35fc('0x74')]?_[_0x35fc('0x75')](_0x164c7b[_0x2bc76c[_0x4464d5]['function']],'%s',_0x37764b):_0x37764b;_0x37764b=_0x2bc76c[_0x4464d5]['format']?_[_0x35fc('0x75')](_0x303927[_0x2bc76c[_0x4464d5]['format']],'%s',_0x37764b):_0x37764b;if(_0x2bc76c[_0x4464d5][_0x35fc('0x76')]){_0x3c1b56[_0x35fc('0x67')](_0x37764b);}_0x2bc76c[_0x4464d5][_0x35fc('0x77')]&&_0x3c1b56[_0x35fc('0x78')](_0x37764b,_0x2bc76c[_0x4464d5][_0x35fc('0x77')]===_0x35fc('0x79')?![]:!![]);_0x3c1b56[_0x35fc('0x68')](_0x37764b,_0x2bc76c[_0x4464d5][_0x35fc('0x7a')]||_0x37764b);}if(_0x2ac8e1[_0x35fc('0x7b')]){_0x2ac8e1[_0x35fc('0x7b')]=JSON[_0x35fc('0x7c')](_0x2ac8e1[_0x35fc('0x7b')]);for(var _0x29f2b9=0x0;_0x29f2b9<_0x2ac8e1[_0x35fc('0x7b')][_0x35fc('0x3b')];_0x29f2b9+=0x1){if(_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x32')]&&_[_0x35fc('0x62')](_0x509e77,_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x32')])&&_0x2ac8e1['joins'][_0x29f2b9][_0x35fc('0x7d')]&&_0x2ac8e1['joins'][_0x29f2b9][_0x35fc('0x7e')]&&_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x7f')]){_0x3c1b56[_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x32')]](_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x7e')],null,util[_0x35fc('0x80')](_0x35fc('0x81'),_0x2ac8e1[_0x35fc('0x71')],_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9]['parentKey'],_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x7e')],_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x7f')]));}}}if(_0x2ac8e1[_0x35fc('0x82')]){_0x2ac8e1[_0x35fc('0x82')]=JSON['parse'](_0x2ac8e1[_0x35fc('0x82')]);_0x3c1b56[_0x35fc('0x3e')](_0x5353ea(_0x2ac8e1[_0x35fc('0x82')][_0x35fc('0x67')]));}_0x4af592=_0x3c1b56[_0x35fc('0x83')]();_0x3c1b56[_0x35fc('0x1d')](_0x39d470);_0x3c1b56[_0x35fc('0x1c')](0x0);logger[_0x35fc('0x84')](_0x35fc('0x85'),_0x3c1b56['toString']());return dbH[_0x35fc('0x86')]['query'](_0x3c1b56[_0x35fc('0x87')](),{'type':dbH[_0x35fc('0x86')]['QueryTypes'][_0x35fc('0x88')]});}})[_0x35fc('0x26')](respondWithResult(_0x757aa6,null))[_0x35fc('0x49')](handleError(_0x757aa6,null));};function runReport(_0x4274d6,_0x4026cc,_0x1a765f){var _0x42f87e=_0x4026cc[_0x35fc('0x2c')];var _0x25ee61=0xa;var _0x5806bf=['join','left_join','right_join',_0x35fc('0x58')];var _0x23cf84={'SUM':_0x35fc('0x59'),'COUNT':_0x35fc('0x5a'),'COUNT DISTINCT':_0x35fc('0x5b'),'MAX':'MAX(%s)','MIN':_0x35fc('0x5d'),'AVG':_0x35fc('0x5e'),'GROUP_CONCAT':_0x35fc('0x89'),'GROUP_CONCAT ASC':_0x35fc('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x15e936={'SEC_TO_TIME':_0x35fc('0x8a'),'DATE':_0x35fc('0x61'),'HOUR':'HOUR(%s)','ROUND':_0x35fc('0x8b'),'UNIX_TIMESTAMP':_0x35fc('0x8c')};var _0x319033=function(_0x9fe765){return!_[_0x35fc('0x62')]([_0x35fc('0x63'),_0x35fc('0x64'),_0x35fc('0x8d'),'IS\x20NOT\x20EMPTY'],_0x9fe765);};var _0x2faff7=function(_0xa2c5f8){if(!_0xa2c5f8||!_0xa2c5f8[_0x35fc('0x65')][_0x35fc('0x3b')]){return'';}for(var _0x221c5b='(',_0x1fcd36=0x0;_0x1fcd36<_0xa2c5f8['rules'][_0x35fc('0x3b')];_0x1fcd36+=0x1){_0x1fcd36>0x0&&(_0x221c5b+='\x20'+_0xa2c5f8['operator']+'\x20');_0x221c5b+=_0xa2c5f8['rules'][_0x1fcd36][_0x35fc('0x67')]?_0x2faff7(_0xa2c5f8['rules'][_0x1fcd36][_0x35fc('0x67')]):_0xa2c5f8[_0x35fc('0x65')][_0x1fcd36][_0x35fc('0x68')]+'\x20'+_0xa2c5f8['rules'][_0x1fcd36][_0x35fc('0x69')]+(_0x319033(_0xa2c5f8[_0x35fc('0x65')][_0x1fcd36][_0x35fc('0x69')])?'\x20'+_0xa2c5f8[_0x35fc('0x65')][_0x1fcd36][_0x35fc('0x6a')]:'');}return _0x221c5b+')';};var _0x5abdf9={'where':{'id':_0x4274d6['id']}},_0x5512f6,_0x487cb5,_0x23b261,_0x4c742c,_0x2fae26;_0x5abdf9=_[_0x35fc('0x40')]({},_0x5abdf9,_0x1a765f);return db[_0x35fc('0x2f')][_0x35fc('0x51')](_0x5abdf9)['then'](function(_0x28e80d){if(_0x28e80d){_0x5512f6=_0x28e80d;return _0x28e80d[_0x35fc('0x8e')]();}return null;})[_0x35fc('0x26')](function(_0x47c507){if(_0x47c507){if(!_0x47c507[_0x35fc('0x3b')]){throw new db[(_0x35fc('0x6b'))][(_0x35fc('0x8f'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x487cb5=_0x47c507;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x35fc('0x26')](function(_0x2edb1b){if(_0x2edb1b){_0x23b261=_[_0x35fc('0x6e')](_0x2edb1b,'id');var _0x3858a9;var _0x4859be=squel[_0x35fc('0x6f')]();_0x4859be[_0x35fc('0x70')](_0x5512f6['table']);for(var _0x5849a0=0x0;_0x5849a0<_0x487cb5[_0x35fc('0x3b')];_0x5849a0+=0x1){_0x3858a9=_0x487cb5[_0x5849a0][_0x35fc('0x72')]?_0x23b261[_0x487cb5[_0x5849a0][_0x35fc('0x72')]]['metric']:_0x487cb5[_0x5849a0]['field'];_0x3858a9=_0x487cb5[_0x5849a0][_0x35fc('0x74')]?_[_0x35fc('0x75')](_0x23cf84[_0x487cb5[_0x5849a0]['function']],'%s',_0x3858a9):_0x3858a9;_0x3858a9=_0x487cb5[_0x5849a0][_0x35fc('0x80')]?_[_0x35fc('0x75')](_0x15e936[_0x487cb5[_0x5849a0][_0x35fc('0x80')]],'%s',_0x3858a9):_0x3858a9;if(_0x487cb5[_0x5849a0]['groupBy']){_0x4859be[_0x35fc('0x67')](_0x3858a9);}_0x487cb5[_0x5849a0][_0x35fc('0x77')]&&_0x4859be[_0x35fc('0x78')](_0x3858a9,_0x487cb5[_0x5849a0][_0x35fc('0x77')]==='DESC'?![]:!![]);_0x4859be[_0x35fc('0x68')](_0x3858a9,_0x487cb5[_0x5849a0][_0x35fc('0x7a')]||_0x3858a9);}if(_0x5512f6[_0x35fc('0x7b')]){_0x5512f6['joins']=JSON[_0x35fc('0x7c')](_0x5512f6[_0x35fc('0x7b')]);for(var _0x425f72=0x0;_0x425f72<_0x5512f6['joins'][_0x35fc('0x3b')];_0x425f72+=0x1){if(_0x5512f6[_0x35fc('0x7b')][_0x425f72]['type']&&_[_0x35fc('0x62')](_0x5806bf,_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x32')])&&_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7d')]&&_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7e')]&&_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7f')]){_0x4859be[_0x5512f6['joins'][_0x425f72][_0x35fc('0x32')]](_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7e')],null,util[_0x35fc('0x80')]('%s.%s\x20=\x20%s.%s',_0x5512f6[_0x35fc('0x71')],_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7d')],_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7e')],_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7f')]));}}}if(_0x5512f6[_0x35fc('0x82')]){_0x5512f6['conditions']=JSON['parse'](_0x5512f6[_0x35fc('0x82')]);_0x4859be[_0x35fc('0x3e')](_0x2faff7(_0x5512f6[_0x35fc('0x82')]['group']));}_0x2fae26=_0x4859be[_0x35fc('0x83')]();_0x4859be[_0x35fc('0x1d')](_0x25ee61);_0x4859be[_0x35fc('0x1c')](0x0);return;}})[_0x35fc('0x26')](function(){if(_0x4026cc['output']==='web'){return null;}var _0x379650=_['merge'](_0x4026cc,{'name':_0x4026cc[_0x35fc('0x90')]||_0x4026cc[_0x35fc('0x2c')]||_0x5512f6['name'],'basename':_0x42f87e,'savename':util['format'](_0x35fc('0x91'),_0x4026cc[_0x35fc('0x2c')]||_0x5512f6[_0x35fc('0x2c')],require('randomstring')[_0x35fc('0x92')](0x4),_0x4026cc[_0x35fc('0x93')]||_0x35fc('0x94')),'reportId':_0x5512f6['id'],'reportType':'default'});return db[_0x35fc('0x95')][_0x35fc('0x4a')](_0x379650,{'raw':!![]});})[_0x35fc('0x26')](function(_0x328e90){if(_0x5512f6['table']===_0x35fc('0x96')){_0x2fae26[_0x35fc('0x3e')](_0x5512f6[_0x35fc('0x71')]+_0x35fc('0x97'),_0x4026cc[_0x35fc('0x98')],_0x4026cc[_0x35fc('0x99')]);}else{_0x2fae26['where'](_0x5512f6[_0x35fc('0x71')]+_0x35fc('0x9a'),_0x4026cc['startDate'],_0x4026cc[_0x35fc('0x99')]);}if(_0x328e90){logger[_0x35fc('0x9b')]('Run\x20Query:',_0x2fae26[_0x35fc('0x87')]());require(_0x35fc('0x9c'))[_0x35fc('0x9d')](path[_0x35fc('0x56')](__dirname,_0x35fc('0x9e'),_0x328e90['output']),[_0x328e90['id'],_0x2fae26[_0x35fc('0x87')](),path[_0x35fc('0x56')](__dirname,_0x35fc('0x9f'),_0x328e90['savename']),_0x42f87e]);return _0x328e90;}else{var _0x1224cd=squel['select']();_0x1224cd['from']('('+_0x2fae26[_0x35fc('0x87')]()+')',_0x35fc('0xa0'));_0x1224cd[_0x35fc('0x68')](_0x35fc('0xa1'),_0x35fc('0x1f'));_0x2fae26['limit'](_0x4026cc[_0x35fc('0x1d')]||_0x25ee61);_0x2fae26[_0x35fc('0x1c')](_0x4026cc[_0x35fc('0x1c')]||0x0);return dbH['sequelize'][_0x35fc('0x35')](_0x1224cd[_0x35fc('0x87')](),{'type':dbH[_0x35fc('0x86')][_0x35fc('0xa2')][_0x35fc('0x88')]})['then'](function(_0x1a2d73){if(!_0x1a2d73[_0x35fc('0x3b')]){_0x4c742c=0x0;}else{_0x4c742c=_0x1a2d73[0x0]['count']||0x0;}return dbH['sequelize'][_0x35fc('0x35')](_0x2fae26[_0x35fc('0x87')](),{'type':dbH[_0x35fc('0x86')][_0x35fc('0xa2')][_0x35fc('0x88')]});})[_0x35fc('0x26')](function(_0x8c80ca){return{'rows':_0x8c80ca||[],'count':_0x4c742c};});}});}exports['run']=function(_0x5dc286,_0x146ce1){return runReport(_0x5dc286[_0x35fc('0x48')],_0x5dc286[_0x35fc('0x35')],_0x5dc286[_0x35fc('0x43')])[_0x35fc('0x26')](respondWithResult(_0x146ce1,null))['catch'](handleError(_0x146ce1,null));};exports['runReport']=runReport;exports[_0x35fc('0x35')]=function(_0x2451f2,_0x3fff79){var _0x1c6ce9=0xa;var _0x4b2079=['join',_0x35fc('0x57'),_0x35fc('0xa3'),_0x35fc('0x58')];var _0xd46d64={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x35fc('0x5b'),'MAX':_0x35fc('0x5c'),'MIN':'MIN(%s)','AVG':_0x35fc('0x5e'),'GROUP_CONCAT':_0x35fc('0x89'),'GROUP_CONCAT ASC':_0x35fc('0x5f'),'GROUP_CONCAT DESC':_0x35fc('0x60')};var _0x274337={'SEC_TO_TIME':_0x35fc('0x8a'),'DATE':_0x35fc('0x61'),'HOUR':_0x35fc('0xa4'),'ROUND':_0x35fc('0x8b'),'UNIX_TIMESTAMP':_0x35fc('0x8c')};var _0x19ae76=function(_0x366a3b){return!_[_0x35fc('0x62')]([_0x35fc('0x63'),_0x35fc('0x64'),_0x35fc('0x8d'),'IS\x20NOT\x20EMPTY'],_0x366a3b);};var _0x345026=function(_0x553f7d){if(!_0x553f7d||!_0x553f7d[_0x35fc('0x65')]['length']){return'';}for(var _0x5aa072='(',_0x3c96ef=0x0;_0x3c96ef<_0x553f7d[_0x35fc('0x65')][_0x35fc('0x3b')];_0x3c96ef+=0x1){_0x3c96ef>0x0&&(_0x5aa072+='\x20'+_0x553f7d['operator']+'\x20');_0x5aa072+=_0x553f7d[_0x35fc('0x65')][_0x3c96ef][_0x35fc('0x67')]?_0x345026(_0x553f7d[_0x35fc('0x65')][_0x3c96ef][_0x35fc('0x67')]):_0x553f7d[_0x35fc('0x65')][_0x3c96ef][_0x35fc('0x68')]+'\x20'+_0x553f7d['rules'][_0x3c96ef]['condition']+(_0x19ae76(_0x553f7d[_0x35fc('0x65')][_0x3c96ef]['condition'])?'\x20'+_0x553f7d['rules'][_0x3c96ef][_0x35fc('0x6a')]:'');}return _0x5aa072+')';};var _0x48b826={'where':{'id':_0x2451f2[_0x35fc('0x48')]['id']}},_0x556f9a,_0x5ae83f,_0x450769,_0x5d461c,_0x355154;_0x48b826=_[_0x35fc('0x40')]({},_0x48b826,_0x2451f2[_0x35fc('0x43')]);return db[_0x35fc('0x2f')][_0x35fc('0x51')](_0x48b826)['then'](function(_0x522ff2){if(_0x522ff2){_0x556f9a=_0x522ff2;return _0x522ff2[_0x35fc('0x8e')]();}return null;})['then'](function(_0x233c94){if(_0x233c94){if(!_0x233c94[_0x35fc('0x3b')]){throw new db['Sequelize']['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5ae83f=_0x233c94;return db[_0x35fc('0x6d')][_0x35fc('0x46')]({'raw':!![]});}return null;})[_0x35fc('0x26')](function(_0x135e18){if(_0x135e18){_0x450769=_[_0x35fc('0x6e')](_0x135e18,'id');var _0x28525f;var _0x9116b1=squel[_0x35fc('0x6f')]();_0x9116b1['from'](_0x556f9a['table']);for(var _0x5cefdb=0x0;_0x5cefdb<_0x5ae83f['length'];_0x5cefdb+=0x1){_0x28525f=_0x5ae83f[_0x5cefdb][_0x35fc('0x72')]?_0x450769[_0x5ae83f[_0x5cefdb]['MetricId']][_0x35fc('0x73')]:_0x5ae83f[_0x5cefdb]['field'];_0x28525f=_0x5ae83f[_0x5cefdb][_0x35fc('0x74')]?_[_0x35fc('0x75')](_0xd46d64[_0x5ae83f[_0x5cefdb]['function']],'%s',_0x28525f):_0x28525f;_0x28525f=_0x5ae83f[_0x5cefdb]['format']?_[_0x35fc('0x75')](_0x274337[_0x5ae83f[_0x5cefdb][_0x35fc('0x80')]],'%s',_0x28525f):_0x28525f;if(_0x5ae83f[_0x5cefdb][_0x35fc('0x76')]){_0x9116b1[_0x35fc('0x67')](_0x28525f);}_0x5ae83f[_0x5cefdb][_0x35fc('0x77')]&&_0x9116b1['order'](_0x28525f,_0x5ae83f[_0x5cefdb]['orderBy']===_0x35fc('0x79')?![]:!![]);_0x9116b1['field'](_0x28525f,_0x5ae83f[_0x5cefdb][_0x35fc('0x7a')]||_0x28525f);}if(_0x556f9a['joins']){_0x556f9a[_0x35fc('0x7b')]=JSON[_0x35fc('0x7c')](_0x556f9a[_0x35fc('0x7b')]);for(var _0x10e30e=0x0;_0x10e30e<_0x556f9a['joins'][_0x35fc('0x3b')];_0x10e30e+=0x1){if(_0x556f9a['joins'][_0x10e30e][_0x35fc('0x32')]&&_['includes'](_0x4b2079,_0x556f9a['joins'][_0x10e30e][_0x35fc('0x32')])&&_0x556f9a['joins'][_0x10e30e][_0x35fc('0x7d')]&&_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7e')]&&_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7f')]){_0x9116b1[_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x32')]](_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7e')],null,util['format'](_0x35fc('0x81'),_0x556f9a[_0x35fc('0x71')],_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7d')],_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7e')],_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7f')]));}}}if(_0x556f9a['conditions']){_0x556f9a['conditions']=JSON['parse'](_0x556f9a['conditions']);_0x9116b1['where'](_0x345026(_0x556f9a[_0x35fc('0x82')][_0x35fc('0x67')]));}_0x355154=_0x9116b1[_0x35fc('0x83')]();_0x9116b1[_0x35fc('0x1d')](_0x1c6ce9);_0x9116b1[_0x35fc('0x1c')](0x0);logger['debug'](_0x35fc('0x85'),_0x9116b1[_0x35fc('0x87')]());return dbH[_0x35fc('0x86')][_0x35fc('0x35')](_0x9116b1[_0x35fc('0x87')](),{'type':dbH['sequelize'][_0x35fc('0xa2')][_0x35fc('0x88')]});}})[_0x35fc('0x26')](function(){return{'sql':_0x355154['toString']()};})[_0x35fc('0x26')](respondWithResult(_0x3fff79,null))[_0x35fc('0x49')](handleError(_0x3fff79,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 4c6f5dd..3dcfc93 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 _0x3f71=['rimraf','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','lodash','../../config/logger','api','moment','request-promise'];(function(_0x548d7d,_0x2d41fc){var _0xb1c878=function(_0x570f09){while(--_0x570f09){_0x548d7d['push'](_0x548d7d['shift']());}};_0xb1c878(++_0x2d41fc);}(_0x3f71,0x109));var _0x13f7=function(_0x2b8077,_0x453634){_0x2b8077=_0x2b8077-0x0;var _0x308091=_0x3f71[_0x2b8077];return _0x308091;};'use strict';var _=require(_0x13f7('0x0'));var util=require('util');var logger=require(_0x13f7('0x1'))(_0x13f7('0x2'));var moment=require(_0x13f7('0x3'));var BPromise=require('bluebird');var rp=require(_0x13f7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x13f7('0x5'));var config=require('../../config/environment');var attributes=require(_0x13f7('0x6'));module[_0x13f7('0x7')]=function(_0x270f63,_0x498da1){return _0x270f63[_0x13f7('0x8')](_0x13f7('0x9'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x76b4=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports'];(function(_0x28ce5d,_0x4d70ff){var _0x3643c1=function(_0x58fe05){while(--_0x58fe05){_0x28ce5d['push'](_0x28ce5d['shift']());}};_0x3643c1(++_0x4d70ff);}(_0x76b4,0xf7));var _0x476b=function(_0x3ead02,_0x5237bd){_0x3ead02=_0x3ead02-0x0;var _0x1729dd=_0x76b4[_0x3ead02];return _0x1729dd;};'use strict';var _=require('lodash');var util=require(_0x476b('0x0'));var logger=require(_0x476b('0x1'))(_0x476b('0x2'));var moment=require('moment');var BPromise=require(_0x476b('0x3'));var rp=require(_0x476b('0x4'));var fs=require('fs');var path=require(_0x476b('0x5'));var rimraf=require(_0x476b('0x6'));var config=require(_0x476b('0x7'));var attributes=require(_0x476b('0x8'));module[_0x476b('0x9')]=function(_0x1b3b24,_0x883150){return _0x1b3b24[_0x476b('0xa')](_0x476b('0xb'),attributes,{'tableName':_0x476b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index f1e56f9..96c9e07 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 _0x34b5=['lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x34b5,0x114));var _0x534b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x34b5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x534b('0x0'));var util=require(_0x534b('0x1'));var moment=require(_0x534b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x534b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x534b('0x4'));var logger=require(_0x534b('0x5'))(_0x534b('0x6'));var config=require(_0x534b('0x7'));var jayson=require(_0x534b('0x8'));var client=jayson[_0x534b('0x9')][_0x534b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9d06f1,_0x2ac54a,_0x560920){return new BPromise(function(_0x2aa21e,_0x313c9a){return client[_0x534b('0xb')](_0x9d06f1,_0x560920)[_0x534b('0xc')](function(_0x200297){logger[_0x534b('0xd')](_0x534b('0xe'),_0x2ac54a,_0x534b('0xf'));logger[_0x534b('0x10')](_0x534b('0x11'),_0x2ac54a,_0x534b('0xf'),JSON['stringify'](_0x200297));if(_0x200297[_0x534b('0x12')]){if(_0x200297[_0x534b('0x12')][_0x534b('0x13')]===0x1f4){logger['error'](_0x534b('0xe'),_0x2ac54a,_0x200297[_0x534b('0x12')][_0x534b('0x14')]);return _0x313c9a(_0x200297[_0x534b('0x12')][_0x534b('0x14')]);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x2ac54a,_0x200297[_0x534b('0x12')][_0x534b('0x14')]);return _0x2aa21e(_0x200297['error'][_0x534b('0x14')]);}else{logger[_0x534b('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2ac54a,_0x534b('0xf'));_0x2aa21e(_0x200297[_0x534b('0x15')][_0x534b('0x14')]);}})[_0x534b('0x16')](function(_0x1e1eb1){logger[_0x534b('0x12')](_0x534b('0xe'),_0x2ac54a,_0x1e1eb1);_0x313c9a(_0x1e1eb1);});});} \ No newline at end of file +var _0x228e=['debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent'];(function(_0x2e847b,_0x5c3f73){var _0x2def8c=function(_0x49a36d){while(--_0x49a36d){_0x2e847b['push'](_0x2e847b['shift']());}};_0x2def8c(++_0x5c3f73);}(_0x228e,0xf9));var _0xe228=function(_0x5d7d02,_0x441bb1){_0x5d7d02=_0x5d7d02-0x0;var _0x59f32b=_0x228e[_0x5d7d02];return _0x59f32b;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe228('0x0'));var rs=require(_0xe228('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe228('0x2'))['db'];var utils=require(_0xe228('0x3'));var logger=require(_0xe228('0x4'))(_0xe228('0x5'));var config=require(_0xe228('0x6'));var jayson=require(_0xe228('0x7'));var client=jayson[_0xe228('0x8')][_0xe228('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fea66,_0xdf042f,_0x37db49){return new BPromise(function(_0x2dcc21,_0x10986d){return client[_0xe228('0xa')](_0x2fea66,_0x37db49)[_0xe228('0xb')](function(_0xaa523b){logger[_0xe228('0xc')](_0xe228('0xd'),_0xdf042f,_0xe228('0xe'));logger[_0xe228('0xf')](_0xe228('0x10'),_0xdf042f,'request\x20sent',JSON['stringify'](_0xaa523b));if(_0xaa523b[_0xe228('0x11')]){if(_0xaa523b[_0xe228('0x11')][_0xe228('0x12')]===0x1f4){logger[_0xe228('0x11')](_0xe228('0xd'),_0xdf042f,_0xaa523b['error']['message']);return _0x10986d(_0xaa523b[_0xe228('0x11')]['message']);}logger[_0xe228('0x11')](_0xe228('0xd'),_0xdf042f,_0xaa523b[_0xe228('0x11')][_0xe228('0x13')]);return _0x2dcc21(_0xaa523b['error'][_0xe228('0x13')]);}else{logger['info'](_0xe228('0xd'),_0xdf042f,_0xe228('0xe'));_0x2dcc21(_0xaa523b[_0xe228('0x14')][_0xe228('0x13')]);}})[_0xe228('0x15')](function(_0x393088){logger[_0xe228('0x11')](_0xe228('0xd'),_0xdf042f,_0x393088);_0x10986d(_0x393088);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 9c85e70..13f5ee6 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 _0x6d00=['/:id/query','post','create','put','update','delete','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','get','/:id','/:id/preview','preview','/:id/run'];(function(_0x565cc6,_0x1ec418){var _0x168820=function(_0x6e340a){while(--_0x6e340a){_0x565cc6['push'](_0x565cc6['shift']());}};_0x168820(++_0x1ec418);}(_0x6d00,0x11b));var _0x06d0=function(_0x33504d,_0xf81588){_0x33504d=_0x33504d-0x0;var _0x5ee631=_0x6d00[_0x33504d];return _0x5ee631;};'use strict';var multer=require('multer');var util=require(_0x06d0('0x0'));var path=require(_0x06d0('0x1'));var timeout=require(_0x06d0('0x2'));var express=require('express');var router=express[_0x06d0('0x3')]();var fs_extra=require(_0x06d0('0x4'));var auth=require(_0x06d0('0x5'));var interaction=require(_0x06d0('0x6'));var config=require(_0x06d0('0x7'));var controller=require(_0x06d0('0x8'));router['get']('/',auth[_0x06d0('0x9')](),controller[_0x06d0('0xa')]);router[_0x06d0('0xb')](_0x06d0('0xc'),auth[_0x06d0('0x9')](),controller['show']);router['get'](_0x06d0('0xd'),auth[_0x06d0('0x9')](),controller[_0x06d0('0xe')]);router[_0x06d0('0xb')](_0x06d0('0xf'),auth[_0x06d0('0x9')](),controller['run']);router[_0x06d0('0xb')](_0x06d0('0x10'),auth[_0x06d0('0x9')](),controller['query']);router[_0x06d0('0x11')]('/',auth[_0x06d0('0x9')](),controller[_0x06d0('0x12')]);router[_0x06d0('0x13')]('/:id',auth[_0x06d0('0x9')](),controller[_0x06d0('0x14')]);router[_0x06d0('0x15')](_0x06d0('0xc'),auth[_0x06d0('0x9')](),controller[_0x06d0('0x16')]);module['exports']=router; \ No newline at end of file +var _0x197e=['../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','preview','/:id/run','run','/:id/query','query','post','create','put','delete','destroy','exports','path','connect-timeout','express','fs-extra'];(function(_0xca8d25,_0x287983){var _0x49bd97=function(_0x191b7f){while(--_0x191b7f){_0xca8d25['push'](_0xca8d25['shift']());}};_0x49bd97(++_0x287983);}(_0x197e,0x104));var _0xe197=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x197e[_0x40220a];return _0x3903cc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe197('0x0'));var timeout=require(_0xe197('0x1'));var express=require(_0xe197('0x2'));var router=express['Router']();var fs_extra=require(_0xe197('0x3'));var auth=require(_0xe197('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe197('0x5'));var controller=require(_0xe197('0x6'));router[_0xe197('0x7')]('/',auth[_0xe197('0x8')](),controller[_0xe197('0x9')]);router['get'](_0xe197('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xe197('0x7')]('/:id/preview',auth[_0xe197('0x8')](),controller[_0xe197('0xb')]);router[_0xe197('0x7')](_0xe197('0xc'),auth[_0xe197('0x8')](),controller[_0xe197('0xd')]);router[_0xe197('0x7')](_0xe197('0xe'),auth[_0xe197('0x8')](),controller[_0xe197('0xf')]);router[_0xe197('0x10')]('/',auth[_0xe197('0x8')](),controller[_0xe197('0x11')]);router[_0xe197('0x12')]('/:id',auth[_0xe197('0x8')](),controller['update']);router[_0xe197('0x13')]('/:id',auth[_0xe197('0x8')](),controller[_0xe197('0x14')]);module[_0xe197('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 31d9c18..f49bca1 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 _0x84a5=['pdf','xlsx','DATE','Loading','manual','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv'];(function(_0x14e142,_0xb7fe8d){var _0x3ad413=function(_0x57f761){while(--_0x57f761){_0x14e142['push'](_0x14e142['shift']());}};_0x3ad413(++_0xb7fe8d);}(_0x84a5,0x16e));var _0x584a=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x84a5[_0x5f0089];return _0x193892;};'use strict';var Sequelize=require(_0x584a('0x0'));var moment=require(_0x584a('0x1'));module[_0x584a('0x2')]={'name':{'type':Sequelize[_0x584a('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x584a('0x4')](_0x584a('0x5'),_0x584a('0x6'),_0x584a('0x7')),'allowNull':![],'defaultValue':_0x584a('0x5')},'savename':{'type':Sequelize[_0x584a('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x584a('0x8')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x584a('0x3')],'defaultValue':_0x584a('0x9')},'type':{'type':Sequelize[_0x584a('0x4')](_0x584a('0xa'),'scheduled'),'allowNull':![],'defaultValue':_0x584a('0xa')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x584a('0xb')]},'reportType':{'type':Sequelize[_0x584a('0x3')]}}; \ No newline at end of file +var _0x4c9c=['INTEGER','UNSIGNED','sequelize','moment','STRING','csv','DATE','ENUM','manual','scheduled'];(function(_0x4d061b,_0x173930){var _0x42067c=function(_0x5d7e17){while(--_0x5d7e17){_0x4d061b['push'](_0x4d061b['shift']());}};_0x42067c(++_0x173930);}(_0x4c9c,0xc0));var _0xc4c9=function(_0x22889a,_0x4b75f7){_0x22889a=_0x22889a-0x0;var _0x763d34=_0x4c9c[_0x22889a];return _0x763d34;};'use strict';var Sequelize=require(_0xc4c9('0x0'));var moment=require(_0xc4c9('0x1'));module['exports']={'name':{'type':Sequelize[_0xc4c9('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM']('csv','pdf','xlsx'),'allowNull':![],'defaultValue':_0xc4c9('0x3')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0xc4c9('0x4')]},'endDate':{'type':Sequelize[_0xc4c9('0x4')]},'status':{'type':Sequelize['STRING'],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xc4c9('0x5')](_0xc4c9('0x6'),_0xc4c9('0x7')),'allowNull':![],'defaultValue':_0xc4c9('0x6')},'reportId':{'type':Sequelize[_0xc4c9('0x8')](0xb)[_0xc4c9('0x9')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 1db4610..2ad8436 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 _0x8762=['rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','offset','set','Content-Range','json','apply','reject','save','update','then','get','UserProfileResource','destroy','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','options','count','includeAll','include','rows','catch','params','merge','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ExtractedReports','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','savename','output','existsSync','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','join','format','%s.%s','basename','toLowerCase','eml-format'];(function(_0x3e45b9,_0x4a26d1){var _0x2c76d8=function(_0x566159){while(--_0x566159){_0x3e45b9['push'](_0x3e45b9['shift']());}};_0x2c76d8(++_0x4a26d1);}(_0x8762,0x1f3));var _0x2876=function(_0x581aaa,_0x28fbaa){_0x581aaa=_0x581aaa-0x0;var _0x1e22b9=_0x8762[_0x581aaa];return _0x1e22b9;};'use strict';var emlformat=require(_0x2876('0x0'));var rimraf=require(_0x2876('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2876('0x2'));var rp=require('request-promise');var moment=require(_0x2876('0x3'));var BPromise=require(_0x2876('0x4'));var Mustache=require(_0x2876('0x5'));var util=require(_0x2876('0x6'));var path=require(_0x2876('0x7'));var sox=require(_0x2876('0x8'));var csv=require(_0x2876('0x9'));var ejs=require(_0x2876('0xa'));var fs=require('fs');var fs_extra=require(_0x2876('0xb'));var _=require(_0x2876('0xc'));var squel=require(_0x2876('0xd'));var crypto=require(_0x2876('0xe'));var jsforce=require(_0x2876('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2876('0x9'));var querystring=require('querystring');var Papa=require(_0x2876('0x10'));var Redis=require(_0x2876('0x11'));var authService=require(_0x2876('0x12'));var qs=require(_0x2876('0x13'));var as=require(_0x2876('0x14'));var hardwareService=require(_0x2876('0x15'));var logger=require(_0x2876('0x16'))(_0x2876('0x17'));var utils=require(_0x2876('0x18'));var config=require(_0x2876('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x2876('0x1a'))['db'];function respondWithStatusCode(_0x421523,_0x55eb3f){_0x55eb3f=_0x55eb3f||0xcc;return function(_0x27b527){if(_0x27b527){return _0x421523[_0x2876('0x1b')](_0x55eb3f);}return _0x421523[_0x2876('0x1c')](_0x55eb3f)[_0x2876('0x1d')]();};}function respondWithResult(_0x299dcf,_0x5638d7){_0x5638d7=_0x5638d7||0xc8;return function(_0x4fda63){if(_0x4fda63){return _0x299dcf['status'](_0x5638d7)['json'](_0x4fda63);}};}function respondWithFilteredResult(_0x496d57,_0x6d839d){return function(_0x39d3a6){if(_0x39d3a6){var _0x326b74=typeof _0x6d839d['offset']===_0x2876('0x1e')&&typeof _0x6d839d[_0x2876('0x1f')]===_0x2876('0x1e');var _0x45fa94=_0x39d3a6['count'];var _0x21cdfd=_0x326b74?0x0:_0x6d839d[_0x2876('0x20')];var _0xb95c78=_0x326b74?_0x39d3a6['count']:_0x6d839d[_0x2876('0x20')]+_0x6d839d[_0x2876('0x1f')];var _0x7eb9d4;if(_0xb95c78>=_0x45fa94){_0xb95c78=_0x45fa94;_0x7eb9d4=0xc8;}else{_0x7eb9d4=0xce;}_0x496d57[_0x2876('0x1c')](_0x7eb9d4);return _0x496d57[_0x2876('0x21')](_0x2876('0x22'),_0x21cdfd+'-'+_0xb95c78+'/'+_0x45fa94)[_0x2876('0x23')](_0x39d3a6);}return null;};}function patchUpdates(_0xa9906d){return function(_0x410152){try{jsonpatch[_0x2876('0x24')](_0x410152,_0xa9906d,!![]);}catch(_0x5b0e13){return BPromise[_0x2876('0x25')](_0x5b0e13);}return _0x410152[_0x2876('0x26')]();};}function saveUpdates(_0x15670d,_0x3b465a){return function(_0x5c367f){if(_0x5c367f){return _0x5c367f[_0x2876('0x27')](_0x15670d)['then'](function(_0x23fe7c){return _0x23fe7c;});}return null;};}function removeEntity(_0x4bc84f,_0x5b3763){return function(_0x3f4b51){if(_0x3f4b51){return _0x3f4b51['destroy']()[_0x2876('0x28')](function(){var _0x48b4db=_0x3f4b51[_0x2876('0x29')]({'plain':!![]});var _0xc87dd5='ExtractedReports';return db[_0x2876('0x2a')][_0x2876('0x2b')]({'where':{'type':_0xc87dd5,'resourceId':_0x48b4db['id']}})[_0x2876('0x28')](function(){return _0x3f4b51;});})['then'](function(){_0x4bc84f[_0x2876('0x1c')](0xcc)[_0x2876('0x1d')]();});}};}function handleEntityNotFound(_0x49525f,_0x3006fd){return function(_0x5259c4){if(!_0x5259c4){_0x49525f[_0x2876('0x1b')](0x194);}return _0x5259c4;};}function handleError(_0x20a6f4,_0x261b77){_0x261b77=_0x261b77||0x1f4;return function(_0xa57ab){logger['error'](_0xa57ab['stack']);if(_0xa57ab[_0x2876('0x2c')]){delete _0xa57ab[_0x2876('0x2c')];}_0x20a6f4[_0x2876('0x1c')](_0x261b77)[_0x2876('0x2d')](_0xa57ab);};}exports[_0x2876('0x2e')]=function(_0x398d7d,_0x17ff7b){var _0x19a657={},_0x5db568={},_0x1eed0b={'count':0x0,'rows':[]};var _0x3cf264=_[_0x2876('0x2f')](db[_0x2876('0x30')][_0x2876('0x31')],function(_0x418de3){return{'name':_0x418de3[_0x2876('0x32')],'type':_0x418de3[_0x2876('0x33')][_0x2876('0x34')]};});_0x5db568['model']=_[_0x2876('0x2f')](_0x3cf264,_0x2876('0x2c'));_0x5db568[_0x2876('0x35')]=_[_0x2876('0x36')](_0x398d7d[_0x2876('0x35')]);_0x5db568[_0x2876('0x37')]=_['intersection'](_0x5db568[_0x2876('0x38')],_0x5db568['query']);_0x19a657[_0x2876('0x39')]=_[_0x2876('0x3a')](_0x5db568[_0x2876('0x38')],qs[_0x2876('0x3b')](_0x398d7d['query']['fields']));_0x19a657[_0x2876('0x39')]=_0x19a657[_0x2876('0x39')][_0x2876('0x3c')]?_0x19a657[_0x2876('0x39')]:_0x5db568['model'];if(!_0x398d7d[_0x2876('0x35')][_0x2876('0x3d')](_0x2876('0x3e'))){_0x19a657[_0x2876('0x1f')]=qs[_0x2876('0x1f')](_0x398d7d[_0x2876('0x35')][_0x2876('0x1f')]);_0x19a657['offset']=qs[_0x2876('0x20')](_0x398d7d[_0x2876('0x35')][_0x2876('0x20')]);}_0x19a657[_0x2876('0x3f')]=qs[_0x2876('0x40')](_0x398d7d['query'][_0x2876('0x40')]);_0x19a657['where']=qs[_0x2876('0x37')](_['pick'](_0x398d7d[_0x2876('0x35')],_0x5db568[_0x2876('0x37')]),_0x3cf264);if(_0x398d7d[_0x2876('0x35')][_0x2876('0x41')]){_0x19a657[_0x2876('0x42')]=_['merge'](_0x19a657['where'],{'$or':_[_0x2876('0x2f')](_0x3cf264,function(_0x454ef0){if(_0x454ef0[_0x2876('0x33')]!==_0x2876('0x43')){var _0x529a90={};_0x529a90[_0x454ef0['name']]={'$like':'%'+_0x398d7d[_0x2876('0x35')][_0x2876('0x41')]+'%'};return _0x529a90;}})});}_0x19a657=_['merge']({},_0x19a657,_0x398d7d[_0x2876('0x44')]);var _0x817961={'where':_0x19a657[_0x2876('0x42')]};return db[_0x2876('0x30')][_0x2876('0x45')](_0x817961)[_0x2876('0x28')](function(_0x39128c){_0x1eed0b[_0x2876('0x45')]=_0x39128c;if(_0x398d7d[_0x2876('0x35')][_0x2876('0x46')]){_0x19a657[_0x2876('0x47')]=[{'all':!![]}];}return db[_0x2876('0x30')]['findAll'](_0x19a657);})[_0x2876('0x28')](function(_0x28896f){_0x1eed0b[_0x2876('0x48')]=_0x28896f;return _0x1eed0b;})[_0x2876('0x28')](respondWithFilteredResult(_0x17ff7b,_0x19a657))[_0x2876('0x49')](handleError(_0x17ff7b,null));};exports['show']=function(_0x2fb5c1,_0x412a00){var _0x4d8fb7={'raw':!![],'where':{'id':_0x2fb5c1[_0x2876('0x4a')]['id']}},_0x1f5497={};_0x1f5497[_0x2876('0x38')]=_[_0x2876('0x36')](db[_0x2876('0x30')][_0x2876('0x31')]);_0x1f5497[_0x2876('0x35')]=_[_0x2876('0x36')](_0x2fb5c1[_0x2876('0x35')]);_0x1f5497[_0x2876('0x37')]=_['intersection'](_0x1f5497[_0x2876('0x38')],_0x1f5497['query']);_0x4d8fb7[_0x2876('0x39')]=_['intersection'](_0x1f5497[_0x2876('0x38')],qs['fields'](_0x2fb5c1['query'][_0x2876('0x3b')]));_0x4d8fb7[_0x2876('0x39')]=_0x4d8fb7[_0x2876('0x39')][_0x2876('0x3c')]?_0x4d8fb7[_0x2876('0x39')]:_0x1f5497[_0x2876('0x38')];if(_0x2fb5c1[_0x2876('0x35')][_0x2876('0x46')]){_0x4d8fb7[_0x2876('0x47')]=[{'all':!![]}];}_0x4d8fb7=_[_0x2876('0x4b')]({},_0x4d8fb7,_0x2fb5c1[_0x2876('0x44')]);return db[_0x2876('0x30')][_0x2876('0x4c')](_0x4d8fb7)[_0x2876('0x28')](handleEntityNotFound(_0x412a00,null))[_0x2876('0x28')](respondWithResult(_0x412a00,null))[_0x2876('0x49')](handleError(_0x412a00,null));};exports[_0x2876('0x4d')]=function(_0x4269a1,_0x58b453){return db[_0x2876('0x30')]['create'](_0x4269a1['body'],{})[_0x2876('0x28')](function(_0x18a076){var _0x3e1732=_0x4269a1['user'][_0x2876('0x29')]({'plain':!![]});if(!_0x3e1732)throw new Error(_0x2876('0x4e'));if(_0x3e1732[_0x2876('0x4f')]===_0x2876('0x50')){var _0x569ade=_0x18a076[_0x2876('0x29')]({'plain':!![]});var _0x2cc26f=_0x2876('0x51');return db['UserProfileSection'][_0x2876('0x4c')]({'where':{'name':_0x2cc26f,'userProfileId':_0x3e1732['userProfileId']},'raw':!![]})['then'](function(_0x381716){if(_0x381716&&_0x381716[_0x2876('0x52')]===0x0){return db[_0x2876('0x2a')][_0x2876('0x4d')]({'name':_0x569ade[_0x2876('0x2c')],'resourceId':_0x569ade['id'],'type':_0x381716[_0x2876('0x2c')],'sectionId':_0x381716['id']},{})['then'](function(){return _0x18a076;});}else{return _0x18a076;}})[_0x2876('0x49')](function(_0x31b6e3){logger[_0x2876('0x53')](_0x2876('0x54'),_0x31b6e3);throw _0x31b6e3;});}return _0x18a076;})[_0x2876('0x28')](respondWithResult(_0x58b453,0xc9))['catch'](handleError(_0x58b453,null));};exports[_0x2876('0x27')]=function(_0x290566,_0x2e003a){if(_0x290566[_0x2876('0x55')]['id']){delete _0x290566[_0x2876('0x55')]['id'];}return db[_0x2876('0x30')][_0x2876('0x4c')]({'where':{'id':_0x290566[_0x2876('0x4a')]['id']}})[_0x2876('0x28')](handleEntityNotFound(_0x2e003a,null))[_0x2876('0x28')](saveUpdates(_0x290566[_0x2876('0x55')],null))[_0x2876('0x28')](respondWithResult(_0x2e003a,null))['catch'](handleError(_0x2e003a,null));};exports[_0x2876('0x2b')]=function(_0x48dbf8,_0x4dd5b0){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x48dbf8[_0x2876('0x4a')]['id']}})[_0x2876('0x28')](handleEntityNotFound(_0x4dd5b0,null))[_0x2876('0x28')](removeEntity(_0x4dd5b0,null))[_0x2876('0x49')](handleError(_0x4dd5b0,null));};exports[_0x2876('0x56')]=function(_0x255628,_0x465bdc,_0xfb96dd){return db[_0x2876('0x30')][_0x2876('0x4c')]({'where':{'id':_0x255628[_0x2876('0x4a')]['id']},'attributes':[_0x2876('0x2c'),'basename',_0x2876('0x57'),_0x2876('0x58')],'raw':!![]})[_0x2876('0x28')](handleEntityNotFound(_0x465bdc,null))[_0x2876('0x28')](function(_0x43d705){if(_0x43d705){if(!fs[_0x2876('0x59')](path['join'](config[_0x2876('0x5a')],_0x2876('0x5b'),_0x43d705[_0x2876('0x57')]))){throw new db['Sequelize'][(_0x2876('0x5c'))](_0x2876('0x5d'));}if(_0x255628['query'][_0x2876('0x5e')]){return _0x465bdc[_0x2876('0x1b')](0xc8);}return _0x465bdc[_0x2876('0x56')](path[_0x2876('0x5f')](config['root'],_0x2876('0x5b'),_0x43d705[_0x2876('0x57')]),util[_0x2876('0x60')](_0x2876('0x61'),_0x43d705[_0x2876('0x62')]||_0x43d705[_0x2876('0x2c')],_0x43d705[_0x2876('0x58')][_0x2876('0x63')]()));}})[_0x2876('0x49')](handleError(_0x465bdc,null));}; \ No newline at end of file +var _0xa8e7=['intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','options','AnalyticExtractedReport','include','findAll','rows','catch','params','fields','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','join','root','server/files/reports','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','toLowerCase','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','ExtractedReports','UserProfileResource','destroy','end','error','name','send','index','rawAttributes','fieldName','type','key','model','query'];(function(_0xe397b4,_0x37f1c0){var _0x384f1e=function(_0x2cc294){while(--_0x2cc294){_0xe397b4['push'](_0xe397b4['shift']());}};_0x384f1e(++_0x37f1c0);}(_0xa8e7,0x85));var _0x7a8e=function(_0x609f92,_0x59c70f){_0x609f92=_0x609f92-0x0;var _0x33bf0f=_0xa8e7[_0x609f92];return _0x33bf0f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7a8e('0x0'));var jsonpatch=require(_0x7a8e('0x1'));var rp=require(_0x7a8e('0x2'));var moment=require(_0x7a8e('0x3'));var BPromise=require(_0x7a8e('0x4'));var Mustache=require(_0x7a8e('0x5'));var util=require('util');var path=require(_0x7a8e('0x6'));var sox=require(_0x7a8e('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7a8e('0x8'));var _=require('lodash');var squel=require(_0x7a8e('0x9'));var crypto=require(_0x7a8e('0xa'));var jsforce=require(_0x7a8e('0xb'));var deskjs=require(_0x7a8e('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7a8e('0xd'));var Papa=require(_0x7a8e('0xe'));var Redis=require(_0x7a8e('0xf'));var authService=require(_0x7a8e('0x10'));var qs=require(_0x7a8e('0x11'));var as=require(_0x7a8e('0x12'));var hardwareService=require(_0x7a8e('0x13'));var logger=require(_0x7a8e('0x14'))(_0x7a8e('0x15'));var utils=require(_0x7a8e('0x16'));var config=require(_0x7a8e('0x17'));var licenseUtil=require(_0x7a8e('0x18'));var db=require(_0x7a8e('0x19'))['db'];function respondWithStatusCode(_0x168583,_0x246c6b){_0x246c6b=_0x246c6b||0xcc;return function(_0x5c88e9){if(_0x5c88e9){return _0x168583[_0x7a8e('0x1a')](_0x246c6b);}return _0x168583['status'](_0x246c6b)['end']();};}function respondWithResult(_0x501205,_0x561067){_0x561067=_0x561067||0xc8;return function(_0x560133){if(_0x560133){return _0x501205[_0x7a8e('0x1b')](_0x561067)[_0x7a8e('0x1c')](_0x560133);}};}function respondWithFilteredResult(_0x173450,_0x408d86){return function(_0x13ce06){if(_0x13ce06){var _0x4966d1=typeof _0x408d86[_0x7a8e('0x1d')]===_0x7a8e('0x1e')&&typeof _0x408d86[_0x7a8e('0x1f')]===_0x7a8e('0x1e');var _0x23a861=_0x13ce06[_0x7a8e('0x20')];var _0x106518=_0x4966d1?0x0:_0x408d86[_0x7a8e('0x1d')];var _0x2afbe4=_0x4966d1?_0x13ce06[_0x7a8e('0x20')]:_0x408d86[_0x7a8e('0x1d')]+_0x408d86[_0x7a8e('0x1f')];var _0x18755f;if(_0x2afbe4>=_0x23a861){_0x2afbe4=_0x23a861;_0x18755f=0xc8;}else{_0x18755f=0xce;}_0x173450[_0x7a8e('0x1b')](_0x18755f);return _0x173450[_0x7a8e('0x21')](_0x7a8e('0x22'),_0x106518+'-'+_0x2afbe4+'/'+_0x23a861)[_0x7a8e('0x1c')](_0x13ce06);}return null;};}function patchUpdates(_0x29468d){return function(_0x32f973){try{jsonpatch[_0x7a8e('0x23')](_0x32f973,_0x29468d,!![]);}catch(_0xc60f43){return BPromise[_0x7a8e('0x24')](_0xc60f43);}return _0x32f973[_0x7a8e('0x25')]();};}function saveUpdates(_0x55f8e3,_0x45e70c){return function(_0x456bdf){if(_0x456bdf){return _0x456bdf['update'](_0x55f8e3)['then'](function(_0x8449f4){return _0x8449f4;});}return null;};}function removeEntity(_0x3b7a86,_0x5aff76){return function(_0x4697ad){if(_0x4697ad){return _0x4697ad['destroy']()[_0x7a8e('0x26')](function(){var _0x1d0f7b=_0x4697ad['get']({'plain':!![]});var _0xde6c3=_0x7a8e('0x27');return db[_0x7a8e('0x28')][_0x7a8e('0x29')]({'where':{'type':_0xde6c3,'resourceId':_0x1d0f7b['id']}})['then'](function(){return _0x4697ad;});})['then'](function(){_0x3b7a86['status'](0xcc)[_0x7a8e('0x2a')]();});}};}function handleEntityNotFound(_0x42bba1,_0x57ff73){return function(_0x4daca6){if(!_0x4daca6){_0x42bba1[_0x7a8e('0x1a')](0x194);}return _0x4daca6;};}function handleError(_0x56d6fb,_0x2469bb){_0x2469bb=_0x2469bb||0x1f4;return function(_0x1e7647){logger[_0x7a8e('0x2b')](_0x1e7647['stack']);if(_0x1e7647[_0x7a8e('0x2c')]){delete _0x1e7647[_0x7a8e('0x2c')];}_0x56d6fb['status'](_0x2469bb)[_0x7a8e('0x2d')](_0x1e7647);};}exports[_0x7a8e('0x2e')]=function(_0x4431ce,_0x22c1ba){var _0x274f6a={},_0x4e18d0={},_0x3d5aed={'count':0x0,'rows':[]};var _0x147fbb=_['map'](db['AnalyticExtractedReport'][_0x7a8e('0x2f')],function(_0x537e95){return{'name':_0x537e95[_0x7a8e('0x30')],'type':_0x537e95[_0x7a8e('0x31')][_0x7a8e('0x32')]};});_0x4e18d0[_0x7a8e('0x33')]=_['map'](_0x147fbb,_0x7a8e('0x2c'));_0x4e18d0[_0x7a8e('0x34')]=_['keys'](_0x4431ce[_0x7a8e('0x34')]);_0x4e18d0['filters']=_[_0x7a8e('0x35')](_0x4e18d0['model'],_0x4e18d0[_0x7a8e('0x34')]);_0x274f6a[_0x7a8e('0x36')]=_[_0x7a8e('0x35')](_0x4e18d0[_0x7a8e('0x33')],qs['fields'](_0x4431ce[_0x7a8e('0x34')]['fields']));_0x274f6a[_0x7a8e('0x36')]=_0x274f6a[_0x7a8e('0x36')][_0x7a8e('0x37')]?_0x274f6a[_0x7a8e('0x36')]:_0x4e18d0['model'];if(!_0x4431ce[_0x7a8e('0x34')][_0x7a8e('0x38')](_0x7a8e('0x39'))){_0x274f6a[_0x7a8e('0x1f')]=qs[_0x7a8e('0x1f')](_0x4431ce[_0x7a8e('0x34')]['limit']);_0x274f6a[_0x7a8e('0x1d')]=qs[_0x7a8e('0x1d')](_0x4431ce[_0x7a8e('0x34')][_0x7a8e('0x1d')]);}_0x274f6a[_0x7a8e('0x3a')]=qs[_0x7a8e('0x3b')](_0x4431ce[_0x7a8e('0x34')][_0x7a8e('0x3b')]);_0x274f6a[_0x7a8e('0x3c')]=qs[_0x7a8e('0x3d')](_[_0x7a8e('0x3e')](_0x4431ce[_0x7a8e('0x34')],_0x4e18d0['filters']),_0x147fbb);if(_0x4431ce['query'][_0x7a8e('0x3f')]){_0x274f6a['where']=_[_0x7a8e('0x40')](_0x274f6a[_0x7a8e('0x3c')],{'$or':_[_0x7a8e('0x41')](_0x147fbb,function(_0x20f489){if(_0x20f489['type']!=='VIRTUAL'){var _0x523441={};_0x523441[_0x20f489[_0x7a8e('0x2c')]]={'$like':'%'+_0x4431ce[_0x7a8e('0x34')][_0x7a8e('0x3f')]+'%'};return _0x523441;}})});}_0x274f6a=_[_0x7a8e('0x40')]({},_0x274f6a,_0x4431ce[_0x7a8e('0x42')]);var _0x5e2370={'where':_0x274f6a['where']};return db[_0x7a8e('0x43')][_0x7a8e('0x20')](_0x5e2370)[_0x7a8e('0x26')](function(_0x55420a){_0x3d5aed['count']=_0x55420a;if(_0x4431ce[_0x7a8e('0x34')]['includeAll']){_0x274f6a[_0x7a8e('0x44')]=[{'all':!![]}];}return db[_0x7a8e('0x43')][_0x7a8e('0x45')](_0x274f6a);})[_0x7a8e('0x26')](function(_0x522d92){_0x3d5aed[_0x7a8e('0x46')]=_0x522d92;return _0x3d5aed;})['then'](respondWithFilteredResult(_0x22c1ba,_0x274f6a))[_0x7a8e('0x47')](handleError(_0x22c1ba,null));};exports['show']=function(_0x2ddf33,_0x2d1989){var _0xe3ef6b={'raw':!![],'where':{'id':_0x2ddf33[_0x7a8e('0x48')]['id']}},_0x5499fc={};_0x5499fc[_0x7a8e('0x33')]=_['keys'](db[_0x7a8e('0x43')][_0x7a8e('0x2f')]);_0x5499fc[_0x7a8e('0x34')]=_['keys'](_0x2ddf33[_0x7a8e('0x34')]);_0x5499fc[_0x7a8e('0x3d')]=_[_0x7a8e('0x35')](_0x5499fc[_0x7a8e('0x33')],_0x5499fc[_0x7a8e('0x34')]);_0xe3ef6b[_0x7a8e('0x36')]=_[_0x7a8e('0x35')](_0x5499fc[_0x7a8e('0x33')],qs[_0x7a8e('0x49')](_0x2ddf33[_0x7a8e('0x34')][_0x7a8e('0x49')]));_0xe3ef6b[_0x7a8e('0x36')]=_0xe3ef6b[_0x7a8e('0x36')][_0x7a8e('0x37')]?_0xe3ef6b[_0x7a8e('0x36')]:_0x5499fc[_0x7a8e('0x33')];if(_0x2ddf33[_0x7a8e('0x34')]['includeAll']){_0xe3ef6b[_0x7a8e('0x44')]=[{'all':!![]}];}_0xe3ef6b=_[_0x7a8e('0x40')]({},_0xe3ef6b,_0x2ddf33[_0x7a8e('0x42')]);return db[_0x7a8e('0x43')][_0x7a8e('0x4a')](_0xe3ef6b)['then'](handleEntityNotFound(_0x2d1989,null))[_0x7a8e('0x26')](respondWithResult(_0x2d1989,null))[_0x7a8e('0x47')](handleError(_0x2d1989,null));};exports[_0x7a8e('0x4b')]=function(_0x3ba9e2,_0x43f360){return db[_0x7a8e('0x43')][_0x7a8e('0x4b')](_0x3ba9e2[_0x7a8e('0x4c')],{})[_0x7a8e('0x26')](function(_0xc6f08e){var _0x3619a9=_0x3ba9e2['user'][_0x7a8e('0x4d')]({'plain':!![]});if(!_0x3619a9)throw new Error(_0x7a8e('0x4e'));if(_0x3619a9['role']===_0x7a8e('0x4f')){var _0x2e3afc=_0xc6f08e['get']({'plain':!![]});var _0x3e2bce=_0x7a8e('0x27');return db[_0x7a8e('0x50')]['find']({'where':{'name':_0x3e2bce,'userProfileId':_0x3619a9['userProfileId']},'raw':!![]})['then'](function(_0x4d6c16){if(_0x4d6c16&&_0x4d6c16['autoAssociation']===0x0){return db[_0x7a8e('0x28')][_0x7a8e('0x4b')]({'name':_0x2e3afc['name'],'resourceId':_0x2e3afc['id'],'type':_0x4d6c16[_0x7a8e('0x2c')],'sectionId':_0x4d6c16['id']},{})[_0x7a8e('0x26')](function(){return _0xc6f08e;});}else{return _0xc6f08e;}})[_0x7a8e('0x47')](function(_0x3d9599){logger[_0x7a8e('0x2b')](_0x7a8e('0x51'),_0x3d9599);throw _0x3d9599;});}return _0xc6f08e;})['then'](respondWithResult(_0x43f360,0xc9))[_0x7a8e('0x47')](handleError(_0x43f360,null));};exports['update']=function(_0x3ce2fc,_0xa8549d){if(_0x3ce2fc[_0x7a8e('0x4c')]['id']){delete _0x3ce2fc['body']['id'];}return db[_0x7a8e('0x43')][_0x7a8e('0x4a')]({'where':{'id':_0x3ce2fc['params']['id']}})[_0x7a8e('0x26')](handleEntityNotFound(_0xa8549d,null))[_0x7a8e('0x26')](saveUpdates(_0x3ce2fc[_0x7a8e('0x4c')],null))['then'](respondWithResult(_0xa8549d,null))[_0x7a8e('0x47')](handleError(_0xa8549d,null));};exports[_0x7a8e('0x29')]=function(_0x9d10be,_0xca307b){return db[_0x7a8e('0x43')][_0x7a8e('0x4a')]({'where':{'id':_0x9d10be[_0x7a8e('0x48')]['id']}})[_0x7a8e('0x26')](handleEntityNotFound(_0xca307b,null))['then'](removeEntity(_0xca307b,null))['catch'](handleError(_0xca307b,null));};exports[_0x7a8e('0x52')]=function(_0x21cdba,_0x50552e,_0x70b41d){return db[_0x7a8e('0x43')][_0x7a8e('0x4a')]({'where':{'id':_0x21cdba[_0x7a8e('0x48')]['id']},'attributes':[_0x7a8e('0x2c'),_0x7a8e('0x53'),_0x7a8e('0x54'),'output'],'raw':!![]})[_0x7a8e('0x26')](handleEntityNotFound(_0x50552e,null))[_0x7a8e('0x26')](function(_0x2ac9b0){if(_0x2ac9b0){if(!fs['existsSync'](path[_0x7a8e('0x55')](config[_0x7a8e('0x56')],_0x7a8e('0x57'),_0x2ac9b0[_0x7a8e('0x54')]))){throw new db['Sequelize']['ValidationError'](_0x7a8e('0x58'));}if(_0x21cdba[_0x7a8e('0x34')][_0x7a8e('0x59')]){return _0x50552e[_0x7a8e('0x1a')](0xc8);}return _0x50552e[_0x7a8e('0x52')](path[_0x7a8e('0x55')](config[_0x7a8e('0x56')],'server/files/reports',_0x2ac9b0[_0x7a8e('0x54')]),util[_0x7a8e('0x5a')](_0x7a8e('0x5b'),_0x2ac9b0['basename']||_0x2ac9b0[_0x7a8e('0x2c')],_0x2ac9b0['output'][_0x7a8e('0x5c')]()));}})[_0x7a8e('0x47')](handleError(_0x50552e,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 8e0356d..594e487 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 _0x1e92=['./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','lodash','util','api','bluebird','path','rimraf'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x1e92,0x158));var _0x21e9=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x1e92[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x21e9('0x0'));var util=require(_0x21e9('0x1'));var logger=require('../../config/logger')(_0x21e9('0x2'));var moment=require('moment');var BPromise=require(_0x21e9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x21e9('0x4'));var rimraf=require(_0x21e9('0x5'));var config=require('../../config/environment');var attributes=require(_0x21e9('0x6'));module[_0x21e9('0x7')]=function(_0x16460f,_0x56bf4d){return _0x16460f[_0x21e9('0x8')](_0x21e9('0x9'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c32=['../../config/environment','./analyticExtractedReport.attributes','exports','define','../../config/logger','api','path'];(function(_0x36a1a1,_0x1f3db3){var _0xd6f2aa=function(_0x2e1913){while(--_0x2e1913){_0x36a1a1['push'](_0x36a1a1['shift']());}};_0xd6f2aa(++_0x1f3db3);}(_0x1c32,0x1ee));var _0x21c3=function(_0x51bda1,_0x44f80d){_0x51bda1=_0x51bda1-0x0;var _0x1ce08c=_0x1c32[_0x51bda1];return _0x1ce08c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x21c3('0x0'))(_0x21c3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x21c3('0x2'));var rimraf=require('rimraf');var config=require(_0x21c3('0x3'));var attributes=require(_0x21c3('0x4'));module[_0x21c3('0x5')]=function(_0x536abe,_0x53c7fe){return _0x536abe[_0x21c3('0x6')]('AnalyticExtractedReport',attributes,{'tableName':'analytics_extracted_reports','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 774e90b..2626915 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 _0x0b9f=['error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x238671,_0x34aea0){var _0x474844=function(_0x26cab4){while(--_0x26cab4){_0x238671['push'](_0x238671['shift']());}};_0x474844(++_0x34aea0);}(_0x0b9f,0xa7));var _0xf0b9=function(_0x507781,_0x3238d3){_0x507781=_0x507781-0x0;var _0x32e3b9=_0x0b9f[_0x507781];return _0x32e3b9;};'use strict';var _=require(_0xf0b9('0x0'));var util=require(_0xf0b9('0x1'));var moment=require(_0xf0b9('0x2'));var BPromise=require('bluebird');var rs=require(_0xf0b9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf0b9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0b9('0x5'))(_0xf0b9('0x6'));var config=require(_0xf0b9('0x7'));var jayson=require(_0xf0b9('0x8'));var client=jayson['client'][_0xf0b9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a44cd,_0x5cef53,_0x3dbc8d){return new BPromise(function(_0x564223,_0x5e2200){return client[_0xf0b9('0xa')](_0x2a44cd,_0x3dbc8d)[_0xf0b9('0xb')](function(_0x429737){logger[_0xf0b9('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x5cef53,_0xf0b9('0xd'));logger[_0xf0b9('0xe')](_0xf0b9('0xf'),_0x5cef53,_0xf0b9('0xd'),JSON[_0xf0b9('0x10')](_0x429737));if(_0x429737[_0xf0b9('0x11')]){if(_0x429737[_0xf0b9('0x11')][_0xf0b9('0x12')]===0x1f4){logger['error'](_0xf0b9('0x13'),_0x5cef53,_0x429737[_0xf0b9('0x11')][_0xf0b9('0x14')]);return _0x5e2200(_0x429737[_0xf0b9('0x11')][_0xf0b9('0x14')]);}logger[_0xf0b9('0x11')](_0xf0b9('0x13'),_0x5cef53,_0x429737[_0xf0b9('0x11')]['message']);return _0x564223(_0x429737[_0xf0b9('0x11')][_0xf0b9('0x14')]);}else{logger[_0xf0b9('0xc')](_0xf0b9('0x13'),_0x5cef53,_0xf0b9('0xd'));_0x564223(_0x429737[_0xf0b9('0x15')][_0xf0b9('0x14')]);}})[_0xf0b9('0x16')](function(_0x42a877){logger['error'](_0xf0b9('0x13'),_0x5cef53,_0x42a877);_0x5e2200(_0x42a877);});});} \ No newline at end of file +var _0xe486=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','AnalyticExtractedReport,\x20%s,\x20%s','message','result'];(function(_0x525e26,_0x5b1935){var _0x59428a=function(_0x5e2e04){while(--_0x5e2e04){_0x525e26['push'](_0x525e26['shift']());}};_0x59428a(++_0x5b1935);}(_0xe486,0x6a));var _0x6e48=function(_0x2431be,_0x2522c6){_0x2431be=_0x2431be-0x0;var _0x221f9b=_0xe486[_0x2431be];return _0x221f9b;};'use strict';var _=require(_0x6e48('0x0'));var util=require(_0x6e48('0x1'));var moment=require(_0x6e48('0x2'));var BPromise=require(_0x6e48('0x3'));var rs=require(_0x6e48('0x4'));var fs=require('fs');var Redis=require(_0x6e48('0x5'));var db=require(_0x6e48('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6e48('0x7'));var config=require(_0x6e48('0x8'));var jayson=require(_0x6e48('0x9'));var client=jayson[_0x6e48('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ea941,_0x2dc190,_0x23d274){return new BPromise(function(_0x1aaa9e,_0x3d392e){return client['request'](_0x1ea941,_0x23d274)[_0x6e48('0xb')](function(_0x5d1b90){logger[_0x6e48('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2dc190,_0x6e48('0xd'));logger[_0x6e48('0xe')](_0x6e48('0xf'),_0x2dc190,_0x6e48('0xd'),JSON['stringify'](_0x5d1b90));if(_0x5d1b90[_0x6e48('0x10')]){if(_0x5d1b90['error']['code']===0x1f4){logger[_0x6e48('0x10')](_0x6e48('0x11'),_0x2dc190,_0x5d1b90[_0x6e48('0x10')][_0x6e48('0x12')]);return _0x3d392e(_0x5d1b90['error'][_0x6e48('0x12')]);}logger[_0x6e48('0x10')](_0x6e48('0x11'),_0x2dc190,_0x5d1b90[_0x6e48('0x10')][_0x6e48('0x12')]);return _0x1aaa9e(_0x5d1b90[_0x6e48('0x10')][_0x6e48('0x12')]);}else{logger[_0x6e48('0xc')](_0x6e48('0x11'),_0x2dc190,'request\x20sent');_0x1aaa9e(_0x5d1b90[_0x6e48('0x13')][_0x6e48('0x12')]);}})[_0x6e48('0x14')](function(_0x2ca234){logger['error'](_0x6e48('0x11'),_0x2dc190,_0x2ca234);_0x3d392e(_0x2ca234);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 7661eab..b038e85 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 _0x4330=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put','update','destroy','multer','util'];(function(_0x389125,_0x4b686c){var _0x2eebf5=function(_0x59c50b){while(--_0x59c50b){_0x389125['push'](_0x389125['shift']());}};_0x2eebf5(++_0x4b686c);}(_0x4330,0xbb));var _0x0433=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x4330[_0x1035c1];return _0x308d67;};'use strict';var multer=require(_0x0433('0x0'));var util=require(_0x0433('0x1'));var path=require(_0x0433('0x2'));var timeout=require(_0x0433('0x3'));var express=require(_0x0433('0x4'));var router=express[_0x0433('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0433('0x6'));var interaction=require(_0x0433('0x7'));var config=require('../../config/environment');var controller=require(_0x0433('0x8'));router[_0x0433('0x9')]('/',auth[_0x0433('0xa')](),controller[_0x0433('0xb')]);router[_0x0433('0x9')](_0x0433('0xc'),auth[_0x0433('0xa')](),controller[_0x0433('0xd')]);router[_0x0433('0x9')](_0x0433('0xe'),auth[_0x0433('0xa')](),controller[_0x0433('0xf')]);router[_0x0433('0x10')]('/',auth[_0x0433('0xa')](),controller[_0x0433('0x11')]);router[_0x0433('0x12')](_0x0433('0xc'),auth[_0x0433('0xa')](),controller[_0x0433('0x13')]);router['delete'](_0x0433('0xc'),auth['isAuthenticated'](),controller[_0x0433('0x14')]);module['exports']=router; \ No newline at end of file +var _0x712c=['get','isAuthenticated','index','/:id/download','download','post','create','put','/:id','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller'];(function(_0x269b97,_0x10d133){var _0x120efa=function(_0xef252d){while(--_0xef252d){_0x269b97['push'](_0x269b97['shift']());}};_0x120efa(++_0x10d133);}(_0x712c,0x115));var _0xc712=function(_0x21d532,_0x4552a4){_0x21d532=_0x21d532-0x0;var _0x37bda1=_0x712c[_0x21d532];return _0x37bda1;};'use strict';var multer=require('multer');var util=require(_0xc712('0x0'));var path=require(_0xc712('0x1'));var timeout=require(_0xc712('0x2'));var express=require('express');var router=express[_0xc712('0x3')]();var fs_extra=require(_0xc712('0x4'));var auth=require(_0xc712('0x5'));var interaction=require(_0xc712('0x6'));var config=require('../../config/environment');var controller=require(_0xc712('0x7'));router[_0xc712('0x8')]('/',auth[_0xc712('0x9')](),controller[_0xc712('0xa')]);router[_0xc712('0x8')]('/:id',auth[_0xc712('0x9')](),controller['show']);router['get'](_0xc712('0xb'),auth[_0xc712('0x9')](),controller[_0xc712('0xc')]);router[_0xc712('0xd')]('/',auth[_0xc712('0x9')](),controller[_0xc712('0xe')]);router[_0xc712('0xf')](_0xc712('0x10'),auth[_0xc712('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc712('0x11')]);module[_0xc712('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 0e45973..d399036 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 _0xada7=['TEXT','STRING','BOOLEAN','sequelize'];(function(_0x305866,_0x556589){var _0x5894ea=function(_0x1f222e){while(--_0x1f222e){_0x305866['push'](_0x305866['shift']());}};_0x5894ea(++_0x556589);}(_0xada7,0x8b));var _0x7ada=function(_0xb33879,_0x38b0cc){_0xb33879=_0xb33879-0x0;var _0x305a36=_0xada7[_0xb33879];return _0x305a36;};'use strict';var Sequelize=require(_0x7ada('0x0'));module['exports']={'field':{'type':Sequelize[_0x7ada('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x7ada('0x2')]},'format':{'type':Sequelize[_0x7ada('0x2')]},'groupBy':{'type':Sequelize[_0x7ada('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x7ada('0x2')]},'custom':{'type':Sequelize[_0x7ada('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x0ea2=['STRING','BOOLEAN','sequelize','exports'];(function(_0x523f2e,_0x51d51d){var _0x21692d=function(_0x342ab1){while(--_0x342ab1){_0x523f2e['push'](_0x523f2e['shift']());}};_0x21692d(++_0x51d51d);}(_0x0ea2,0x9e));var _0x20ea=function(_0x2dbeb4,_0x499544){_0x2dbeb4=_0x2dbeb4-0x0;var _0x18a513=_0x0ea2[_0x2dbeb4];return _0x18a513;};'use strict';var Sequelize=require(_0x20ea('0x0'));module[_0x20ea('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x20ea('0x2')]},'function':{'type':Sequelize[_0x20ea('0x2')]},'format':{'type':Sequelize[_0x20ea('0x2')]},'groupBy':{'type':Sequelize[_0x20ea('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x20ea('0x2')]},'custom':{'type':Sequelize[_0x20ea('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 11aa750..fbf1779 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 _0x3d53=['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','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','send','index','map','AnalyticFieldReport','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','params','rawAttributes','options','find','create','body','bulkCreate','bulkDestroy','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','findAll','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel'];(function(_0x5ba618,_0x472df0){var _0x1b6fc7=function(_0x30f96c){while(--_0x30f96c){_0x5ba618['push'](_0x5ba618['shift']());}};_0x1b6fc7(++_0x472df0);}(_0x3d53,0x150));var _0x33d5=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x3d53[_0x40220a];return _0x3903cc;};'use strict';var emlformat=require(_0x33d5('0x0'));var rimraf=require(_0x33d5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x33d5('0x2'));var rp=require(_0x33d5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x33d5('0x4'));var util=require(_0x33d5('0x5'));var path=require(_0x33d5('0x6'));var sox=require(_0x33d5('0x7'));var csv=require('to-csv');var ejs=require(_0x33d5('0x8'));var fs=require('fs');var fs_extra=require(_0x33d5('0x9'));var _=require(_0x33d5('0xa'));var squel=require(_0x33d5('0xb'));var crypto=require(_0x33d5('0xc'));var jsforce=require(_0x33d5('0xd'));var deskjs=require(_0x33d5('0xe'));var toCsv=require(_0x33d5('0xf'));var querystring=require(_0x33d5('0x10'));var Papa=require(_0x33d5('0x11'));var Redis=require(_0x33d5('0x12'));var authService=require(_0x33d5('0x13'));var qs=require(_0x33d5('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x33d5('0x15'));var logger=require(_0x33d5('0x16'))('api');var utils=require(_0x33d5('0x17'));var config=require(_0x33d5('0x18'));var licenseUtil=require(_0x33d5('0x19'));var db=require(_0x33d5('0x1a'))['db'];function respondWithStatusCode(_0x4469d2,_0x129c08){_0x129c08=_0x129c08||0xcc;return function(_0x5397e2){if(_0x5397e2){return _0x4469d2[_0x33d5('0x1b')](_0x129c08);}return _0x4469d2['status'](_0x129c08)[_0x33d5('0x1c')]();};}function respondWithResult(_0x29d8a2,_0x3c49bf){_0x3c49bf=_0x3c49bf||0xc8;return function(_0x4ce83f){if(_0x4ce83f){return _0x29d8a2[_0x33d5('0x1d')](_0x3c49bf)['json'](_0x4ce83f);}};}function respondWithFilteredResult(_0x336041,_0x4ea8fd){return function(_0x6ac1b7){if(_0x6ac1b7){var _0x472b05=typeof _0x4ea8fd[_0x33d5('0x1e')]===_0x33d5('0x1f')&&typeof _0x4ea8fd[_0x33d5('0x20')]==='undefined';var _0x287541=_0x6ac1b7[_0x33d5('0x21')];var _0x58fb7b=_0x472b05?0x0:_0x4ea8fd['offset'];var _0x137694=_0x472b05?_0x6ac1b7[_0x33d5('0x21')]:_0x4ea8fd['offset']+_0x4ea8fd[_0x33d5('0x20')];var _0x3be224;if(_0x137694>=_0x287541){_0x137694=_0x287541;_0x3be224=0xc8;}else{_0x3be224=0xce;}_0x336041['status'](_0x3be224);return _0x336041[_0x33d5('0x22')](_0x33d5('0x23'),_0x58fb7b+'-'+_0x137694+'/'+_0x287541)[_0x33d5('0x24')](_0x6ac1b7);}return null;};}function patchUpdates(_0x32ee29){return function(_0x4efb87){try{jsonpatch[_0x33d5('0x25')](_0x4efb87,_0x32ee29,!![]);}catch(_0xf19dcb){return BPromise[_0x33d5('0x26')](_0xf19dcb);}return _0x4efb87[_0x33d5('0x27')]();};}function saveUpdates(_0x35832d,_0x27351a){return function(_0x26194e){if(_0x26194e){return _0x26194e[_0x33d5('0x28')](_0x35832d)[_0x33d5('0x29')](function(_0x29a891){return _0x29a891;});}return null;};}function removeEntity(_0x5afc01,_0x4763f2){return function(_0x5ae890){if(_0x5ae890){return _0x5ae890[_0x33d5('0x2a')]()[_0x33d5('0x29')](function(){_0x5afc01[_0x33d5('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9dc12f,_0x3d2d8e){return function(_0x42e2da){if(!_0x42e2da){_0x9dc12f[_0x33d5('0x1b')](0x194);}return _0x42e2da;};}function handleError(_0x26d9ed,_0x1c7abf){_0x1c7abf=_0x1c7abf||0x1f4;return function(_0x4d2288){logger[_0x33d5('0x2b')](_0x4d2288['stack']);if(_0x4d2288['name']){delete _0x4d2288['name'];}_0x26d9ed['status'](_0x1c7abf)[_0x33d5('0x2c')](_0x4d2288);};}exports[_0x33d5('0x2d')]=function(_0x3b77a1,_0x1ffe4d){var _0x5caa89={},_0x3ac732={},_0x221a11={'count':0x0,'rows':[]};var _0x4fcca9=_[_0x33d5('0x2e')](db[_0x33d5('0x2f')]['rawAttributes'],function(_0x40b262){return{'name':_0x40b262[_0x33d5('0x30')],'type':_0x40b262[_0x33d5('0x31')][_0x33d5('0x32')]};});_0x3ac732[_0x33d5('0x33')]=_[_0x33d5('0x2e')](_0x4fcca9,'name');_0x3ac732[_0x33d5('0x34')]=_[_0x33d5('0x35')](_0x3b77a1[_0x33d5('0x34')]);_0x3ac732['filters']=_['intersection'](_0x3ac732[_0x33d5('0x33')],_0x3ac732[_0x33d5('0x34')]);_0x5caa89['attributes']=_[_0x33d5('0x36')](_0x3ac732['model'],qs[_0x33d5('0x37')](_0x3b77a1[_0x33d5('0x34')]['fields']));_0x5caa89[_0x33d5('0x38')]=_0x5caa89[_0x33d5('0x38')][_0x33d5('0x39')]?_0x5caa89[_0x33d5('0x38')]:_0x3ac732[_0x33d5('0x33')];if(!_0x3b77a1[_0x33d5('0x34')]['hasOwnProperty'](_0x33d5('0x3a'))){_0x5caa89[_0x33d5('0x20')]=qs[_0x33d5('0x20')](_0x3b77a1[_0x33d5('0x34')][_0x33d5('0x20')]);_0x5caa89['offset']=qs[_0x33d5('0x1e')](_0x3b77a1['query'][_0x33d5('0x1e')]);}_0x5caa89[_0x33d5('0x3b')]=qs[_0x33d5('0x3c')](_0x3b77a1[_0x33d5('0x34')][_0x33d5('0x3c')]);_0x5caa89[_0x33d5('0x3d')]=qs[_0x33d5('0x3e')](_[_0x33d5('0x3f')](_0x3b77a1[_0x33d5('0x34')],_0x3ac732['filters']),_0x4fcca9);if(_0x3b77a1['query']['filter']){_0x5caa89[_0x33d5('0x3d')]=_[_0x33d5('0x40')](_0x5caa89[_0x33d5('0x3d')],{'$or':_[_0x33d5('0x2e')](_0x4fcca9,function(_0x38403c){if(_0x38403c[_0x33d5('0x31')]!==_0x33d5('0x41')){var _0x922d4={};_0x922d4[_0x38403c['name']]={'$like':'%'+_0x3b77a1[_0x33d5('0x34')][_0x33d5('0x42')]+'%'};return _0x922d4;}})});}_0x5caa89=_['merge']({},_0x5caa89,_0x3b77a1['options']);var _0x280ddc={'where':_0x5caa89[_0x33d5('0x3d')]};return db[_0x33d5('0x2f')][_0x33d5('0x21')](_0x280ddc)[_0x33d5('0x29')](function(_0x4343ba){_0x221a11[_0x33d5('0x21')]=_0x4343ba;if(_0x3b77a1[_0x33d5('0x34')][_0x33d5('0x43')]){_0x5caa89[_0x33d5('0x44')]=[{'all':!![]}];}return db[_0x33d5('0x2f')]['findAll'](_0x5caa89);})[_0x33d5('0x29')](function(_0x68ab4d){_0x221a11[_0x33d5('0x45')]=_0x68ab4d;return _0x221a11;})[_0x33d5('0x29')](respondWithFilteredResult(_0x1ffe4d,_0x5caa89))[_0x33d5('0x46')](handleError(_0x1ffe4d,null));};exports[_0x33d5('0x47')]=function(_0x548a44,_0x2e86e7){var _0x26d65a={'raw':![],'where':{'id':_0x548a44[_0x33d5('0x48')]['id']}},_0xfdc23f={};_0xfdc23f[_0x33d5('0x33')]=_[_0x33d5('0x35')](db[_0x33d5('0x2f')][_0x33d5('0x49')]);_0xfdc23f[_0x33d5('0x34')]=_[_0x33d5('0x35')](_0x548a44[_0x33d5('0x34')]);_0xfdc23f[_0x33d5('0x3e')]=_[_0x33d5('0x36')](_0xfdc23f[_0x33d5('0x33')],_0xfdc23f[_0x33d5('0x34')]);_0x26d65a[_0x33d5('0x38')]=_[_0x33d5('0x36')](_0xfdc23f['model'],qs['fields'](_0x548a44[_0x33d5('0x34')][_0x33d5('0x37')]));_0x26d65a[_0x33d5('0x38')]=_0x26d65a[_0x33d5('0x38')][_0x33d5('0x39')]?_0x26d65a[_0x33d5('0x38')]:_0xfdc23f[_0x33d5('0x33')];if(_0x548a44[_0x33d5('0x34')][_0x33d5('0x43')]){_0x26d65a[_0x33d5('0x44')]=[{'all':!![]}];}_0x26d65a=_[_0x33d5('0x40')]({},_0x26d65a,_0x548a44[_0x33d5('0x4a')]);return db[_0x33d5('0x2f')][_0x33d5('0x4b')](_0x26d65a)[_0x33d5('0x29')](handleEntityNotFound(_0x2e86e7,null))['then'](respondWithResult(_0x2e86e7,null))[_0x33d5('0x46')](handleError(_0x2e86e7,null));};exports[_0x33d5('0x4c')]=function(_0x1eaf2e,_0x5b745e){return db[_0x33d5('0x2f')][_0x33d5('0x4c')](_0x1eaf2e[_0x33d5('0x4d')],{})[_0x33d5('0x29')](respondWithResult(_0x5b745e,0xc9))[_0x33d5('0x46')](handleError(_0x5b745e,null));};exports[_0x33d5('0x4e')]=function(_0x1425fd,_0x522f4a){return db['AnalyticFieldReport']['bulkCreate'](_0x1425fd[_0x33d5('0x4d')],{'raw':![],'individualHooks':!![]})[_0x33d5('0x29')](respondWithResult(_0x522f4a,0xc9))['catch'](handleError(_0x522f4a,null));};exports[_0x33d5('0x28')]=function(_0x45bc1b,_0xd34cff){if(_0x45bc1b[_0x33d5('0x4d')]['id']){delete _0x45bc1b[_0x33d5('0x4d')]['id'];}return db[_0x33d5('0x2f')]['find']({'where':{'id':_0x45bc1b[_0x33d5('0x48')]['id']}})[_0x33d5('0x29')](handleEntityNotFound(_0xd34cff,null))[_0x33d5('0x29')](saveUpdates(_0x45bc1b[_0x33d5('0x4d')],null))['then'](respondWithResult(_0xd34cff,null))[_0x33d5('0x46')](handleError(_0xd34cff,null));};exports[_0x33d5('0x2a')]=function(_0x2722c8,_0x4e5ca7){return db[_0x33d5('0x2f')][_0x33d5('0x4b')]({'where':{'id':_0x2722c8[_0x33d5('0x48')]['id']}})[_0x33d5('0x29')](handleEntityNotFound(_0x4e5ca7,null))[_0x33d5('0x29')](removeEntity(_0x4e5ca7,null))[_0x33d5('0x46')](handleError(_0x4e5ca7,null));};exports[_0x33d5('0x4f')]=function(_0x4cd64b,_0x515501){return db['AnalyticFieldReport'][_0x33d5('0x2a')]({'where':{'id':_0x4cd64b['query']['ids']||[]},'raw':![],'individualHooks':!![]})[_0x33d5('0x29')](respondWithResult(_0x515501,0xcc))[_0x33d5('0x46')](handleError(_0x515501,null));};exports[_0x33d5('0x50')]=function(_0xed7611,_0x110cfc,_0x5644de){return db[_0x33d5('0x51')][_0x33d5('0x52')]({'where':{'id':_0xed7611['params']['id']}})[_0x33d5('0x29')](handleEntityNotFound(_0x110cfc,null))[_0x33d5('0x29')](function(_0xa2d839){if(_0xa2d839){return db[_0x33d5('0x53')][_0x33d5('0x54')](function(_0x5f2dc8){return db['AnalyticFieldReport'][_0x33d5('0x2a')]({'where':{'CustomReportId':_0xed7611[_0x33d5('0x48')]['id']},'transaction':_0x5f2dc8})[_0x33d5('0x29')](function(_0x19eef3){var _0x3cfe8b=_[_0x33d5('0x2e')](_0xed7611[_0x33d5('0x4d')],function(_0x18a3ea){delete _0x18a3ea['id'];_0x18a3ea[_0x33d5('0x55')]=_0xed7611[_0x33d5('0x48')]['id'];return _0x18a3ea;});return db[_0x33d5('0x2f')]['bulkCreate'](_0x3cfe8b,{'transaction':_0x5f2dc8});});})[_0x33d5('0x29')](function(){return db[_0x33d5('0x2f')][_0x33d5('0x56')]({'where':{'CustomReportId':_0xed7611[_0x33d5('0x48')]['id']}});});}})[_0x33d5('0x29')](respondWithResult(_0x110cfc,null))[_0x33d5('0x46')](handleError(_0x110cfc,null));}; \ No newline at end of file +var _0x772a=['AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','where','VIRTUAL','filter','merge','includeAll','include','rows','params','options','find','body','catch','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','bulkCreate','findAll','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','index','map'];(function(_0x4876f4,_0x1e041b){var _0xfbd46b=function(_0x4d86ee){while(--_0x4d86ee){_0x4876f4['push'](_0x4876f4['shift']());}};_0xfbd46b(++_0x1e041b);}(_0x772a,0xc9));var _0xa772=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x772a[_0x5627e1];return _0x2f013f;};'use strict';var emlformat=require(_0xa772('0x0'));var rimraf=require(_0xa772('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa772('0x2'));var rp=require('request-promise');var moment=require(_0xa772('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa772('0x4'));var util=require(_0xa772('0x5'));var path=require(_0xa772('0x6'));var sox=require(_0xa772('0x7'));var csv=require('to-csv');var ejs=require(_0xa772('0x8'));var fs=require('fs');var fs_extra=require(_0xa772('0x9'));var _=require(_0xa772('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa772('0xb'));var deskjs=require(_0xa772('0xc'));var toCsv=require(_0xa772('0xd'));var querystring=require(_0xa772('0xe'));var Papa=require('papaparse');var Redis=require(_0xa772('0xf'));var authService=require(_0xa772('0x10'));var qs=require(_0xa772('0x11'));var as=require(_0xa772('0x12'));var hardwareService=require(_0xa772('0x13'));var logger=require(_0xa772('0x14'))(_0xa772('0x15'));var utils=require(_0xa772('0x16'));var config=require(_0xa772('0x17'));var licenseUtil=require(_0xa772('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30c872,_0x5b7f6d){_0x5b7f6d=_0x5b7f6d||0xcc;return function(_0x59c5e4){if(_0x59c5e4){return _0x30c872[_0xa772('0x19')](_0x5b7f6d);}return _0x30c872['status'](_0x5b7f6d)['end']();};}function respondWithResult(_0x4dd2f5,_0x21d733){_0x21d733=_0x21d733||0xc8;return function(_0xdcf7b8){if(_0xdcf7b8){return _0x4dd2f5[_0xa772('0x1a')](_0x21d733)[_0xa772('0x1b')](_0xdcf7b8);}};}function respondWithFilteredResult(_0x139feb,_0x2f83a9){return function(_0x294f7d){if(_0x294f7d){var _0x42da07=typeof _0x2f83a9[_0xa772('0x1c')]===_0xa772('0x1d')&&typeof _0x2f83a9[_0xa772('0x1e')]===_0xa772('0x1d');var _0x4e171c=_0x294f7d[_0xa772('0x1f')];var _0x15c6a4=_0x42da07?0x0:_0x2f83a9[_0xa772('0x1c')];var _0x448681=_0x42da07?_0x294f7d['count']:_0x2f83a9[_0xa772('0x1c')]+_0x2f83a9[_0xa772('0x1e')];var _0x4927b9;if(_0x448681>=_0x4e171c){_0x448681=_0x4e171c;_0x4927b9=0xc8;}else{_0x4927b9=0xce;}_0x139feb['status'](_0x4927b9);return _0x139feb[_0xa772('0x20')](_0xa772('0x21'),_0x15c6a4+'-'+_0x448681+'/'+_0x4e171c)[_0xa772('0x1b')](_0x294f7d);}return null;};}function patchUpdates(_0x554b64){return function(_0x571e89){try{jsonpatch[_0xa772('0x22')](_0x571e89,_0x554b64,!![]);}catch(_0x1964b0){return BPromise[_0xa772('0x23')](_0x1964b0);}return _0x571e89['save']();};}function saveUpdates(_0x2140c8,_0x38f4c4){return function(_0x2147af){if(_0x2147af){return _0x2147af[_0xa772('0x24')](_0x2140c8)[_0xa772('0x25')](function(_0x25f33f){return _0x25f33f;});}return null;};}function removeEntity(_0x188bb3,_0x1136a5){return function(_0x4add33){if(_0x4add33){return _0x4add33[_0xa772('0x26')]()[_0xa772('0x25')](function(){_0x188bb3['status'](0xcc)[_0xa772('0x27')]();});}};}function handleEntityNotFound(_0x56a5f9,_0x3b220f){return function(_0x23e749){if(!_0x23e749){_0x56a5f9['sendStatus'](0x194);}return _0x23e749;};}function handleError(_0x5a53d2,_0x195b2b){_0x195b2b=_0x195b2b||0x1f4;return function(_0x235a28){logger[_0xa772('0x28')](_0x235a28[_0xa772('0x29')]);if(_0x235a28[_0xa772('0x2a')]){delete _0x235a28['name'];}_0x5a53d2[_0xa772('0x1a')](_0x195b2b)['send'](_0x235a28);};}exports[_0xa772('0x2b')]=function(_0x95c841,_0x4a2428){var _0x394599={},_0x52838a={},_0x56b1cb={'count':0x0,'rows':[]};var _0x2c2f28=_[_0xa772('0x2c')](db[_0xa772('0x2d')][_0xa772('0x2e')],function(_0x1258bb){return{'name':_0x1258bb[_0xa772('0x2f')],'type':_0x1258bb[_0xa772('0x30')][_0xa772('0x31')]};});_0x52838a[_0xa772('0x32')]=_[_0xa772('0x2c')](_0x2c2f28,_0xa772('0x2a'));_0x52838a[_0xa772('0x33')]=_[_0xa772('0x34')](_0x95c841['query']);_0x52838a[_0xa772('0x35')]=_[_0xa772('0x36')](_0x52838a[_0xa772('0x32')],_0x52838a['query']);_0x394599[_0xa772('0x37')]=_[_0xa772('0x36')](_0x52838a['model'],qs[_0xa772('0x38')](_0x95c841[_0xa772('0x33')][_0xa772('0x38')]));_0x394599[_0xa772('0x37')]=_0x394599['attributes']['length']?_0x394599['attributes']:_0x52838a[_0xa772('0x32')];if(!_0x95c841[_0xa772('0x33')][_0xa772('0x39')](_0xa772('0x3a'))){_0x394599['limit']=qs[_0xa772('0x1e')](_0x95c841['query'][_0xa772('0x1e')]);_0x394599[_0xa772('0x1c')]=qs[_0xa772('0x1c')](_0x95c841[_0xa772('0x33')][_0xa772('0x1c')]);}_0x394599['order']=qs[_0xa772('0x3b')](_0x95c841[_0xa772('0x33')][_0xa772('0x3b')]);_0x394599['where']=qs['filters'](_[_0xa772('0x3c')](_0x95c841['query'],_0x52838a[_0xa772('0x35')]),_0x2c2f28);if(_0x95c841['query']['filter']){_0x394599[_0xa772('0x3d')]=_['merge'](_0x394599[_0xa772('0x3d')],{'$or':_[_0xa772('0x2c')](_0x2c2f28,function(_0x542344){if(_0x542344['type']!==_0xa772('0x3e')){var _0x51b14f={};_0x51b14f[_0x542344[_0xa772('0x2a')]]={'$like':'%'+_0x95c841['query'][_0xa772('0x3f')]+'%'};return _0x51b14f;}})});}_0x394599=_[_0xa772('0x40')]({},_0x394599,_0x95c841['options']);var _0x596c4f={'where':_0x394599[_0xa772('0x3d')]};return db['AnalyticFieldReport'][_0xa772('0x1f')](_0x596c4f)[_0xa772('0x25')](function(_0x6fc906){_0x56b1cb['count']=_0x6fc906;if(_0x95c841[_0xa772('0x33')][_0xa772('0x41')]){_0x394599[_0xa772('0x42')]=[{'all':!![]}];}return db['AnalyticFieldReport']['findAll'](_0x394599);})[_0xa772('0x25')](function(_0x42ad89){_0x56b1cb[_0xa772('0x43')]=_0x42ad89;return _0x56b1cb;})['then'](respondWithFilteredResult(_0x4a2428,_0x394599))['catch'](handleError(_0x4a2428,null));};exports['show']=function(_0x46e9ed,_0x23404e){var _0x22657a={'raw':![],'where':{'id':_0x46e9ed[_0xa772('0x44')]['id']}},_0x1e88b6={};_0x1e88b6[_0xa772('0x32')]=_[_0xa772('0x34')](db[_0xa772('0x2d')]['rawAttributes']);_0x1e88b6[_0xa772('0x33')]=_[_0xa772('0x34')](_0x46e9ed[_0xa772('0x33')]);_0x1e88b6[_0xa772('0x35')]=_[_0xa772('0x36')](_0x1e88b6[_0xa772('0x32')],_0x1e88b6['query']);_0x22657a[_0xa772('0x37')]=_[_0xa772('0x36')](_0x1e88b6[_0xa772('0x32')],qs[_0xa772('0x38')](_0x46e9ed[_0xa772('0x33')]['fields']));_0x22657a[_0xa772('0x37')]=_0x22657a[_0xa772('0x37')]['length']?_0x22657a['attributes']:_0x1e88b6[_0xa772('0x32')];if(_0x46e9ed[_0xa772('0x33')][_0xa772('0x41')]){_0x22657a[_0xa772('0x42')]=[{'all':!![]}];}_0x22657a=_['merge']({},_0x22657a,_0x46e9ed[_0xa772('0x45')]);return db[_0xa772('0x2d')][_0xa772('0x46')](_0x22657a)['then'](handleEntityNotFound(_0x23404e,null))[_0xa772('0x25')](respondWithResult(_0x23404e,null))['catch'](handleError(_0x23404e,null));};exports['create']=function(_0x1cef1b,_0x4a7ece){return db[_0xa772('0x2d')]['create'](_0x1cef1b[_0xa772('0x47')],{})[_0xa772('0x25')](respondWithResult(_0x4a7ece,0xc9))['catch'](handleError(_0x4a7ece,null));};exports['bulkCreate']=function(_0xaf84f1,_0x46370f){return db[_0xa772('0x2d')]['bulkCreate'](_0xaf84f1[_0xa772('0x47')],{'raw':![],'individualHooks':!![]})[_0xa772('0x25')](respondWithResult(_0x46370f,0xc9))[_0xa772('0x48')](handleError(_0x46370f,null));};exports[_0xa772('0x24')]=function(_0x5451dc,_0x3d3108){if(_0x5451dc[_0xa772('0x47')]['id']){delete _0x5451dc[_0xa772('0x47')]['id'];}return db[_0xa772('0x2d')][_0xa772('0x46')]({'where':{'id':_0x5451dc[_0xa772('0x44')]['id']}})[_0xa772('0x25')](handleEntityNotFound(_0x3d3108,null))['then'](saveUpdates(_0x5451dc[_0xa772('0x47')],null))[_0xa772('0x25')](respondWithResult(_0x3d3108,null))[_0xa772('0x48')](handleError(_0x3d3108,null));};exports[_0xa772('0x26')]=function(_0x5eb82d,_0x54246e){return db[_0xa772('0x2d')][_0xa772('0x46')]({'where':{'id':_0x5eb82d[_0xa772('0x44')]['id']}})['then'](handleEntityNotFound(_0x54246e,null))['then'](removeEntity(_0x54246e,null))[_0xa772('0x48')](handleError(_0x54246e,null));};exports[_0xa772('0x49')]=function(_0x174843,_0xd49bd0){return db[_0xa772('0x2d')][_0xa772('0x26')]({'where':{'id':_0x174843['query'][_0xa772('0x4a')]||[]},'raw':![],'individualHooks':!![]})[_0xa772('0x25')](respondWithResult(_0xd49bd0,0xcc))[_0xa772('0x48')](handleError(_0xd49bd0,null));};exports[_0xa772('0x4b')]=function(_0x3f50af,_0xcfab63,_0x12162c){return db[_0xa772('0x4c')]['findOne']({'where':{'id':_0x3f50af['params']['id']}})[_0xa772('0x25')](handleEntityNotFound(_0xcfab63,null))['then'](function(_0x50a579){if(_0x50a579){return db[_0xa772('0x4d')][_0xa772('0x4e')](function(_0x4d05e2){return db[_0xa772('0x2d')]['destroy']({'where':{'CustomReportId':_0x3f50af[_0xa772('0x44')]['id']},'transaction':_0x4d05e2})[_0xa772('0x25')](function(_0x3868d1){var _0x4b2c2b=_[_0xa772('0x2c')](_0x3f50af[_0xa772('0x47')],function(_0x359522){delete _0x359522['id'];_0x359522[_0xa772('0x4f')]=_0x3f50af[_0xa772('0x44')]['id'];return _0x359522;});return db[_0xa772('0x2d')][_0xa772('0x50')](_0x4b2c2b,{'transaction':_0x4d05e2});});})[_0xa772('0x25')](function(){return db[_0xa772('0x2d')][_0xa772('0x51')]({'where':{'CustomReportId':_0x3f50af[_0xa772('0x44')]['id']}});});}})[_0xa772('0x25')](respondWithResult(_0xcfab63,null))[_0xa772('0x48')](handleError(_0xcfab63,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 605e805..e1f0819 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 _0xc6d2=['util','api','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','define','analytics_report_fields','lodash'];(function(_0x2c17a5,_0x3fd48d){var _0x5a1b13=function(_0xb624ff){while(--_0xb624ff){_0x2c17a5['push'](_0x2c17a5['shift']());}};_0x5a1b13(++_0x3fd48d);}(_0xc6d2,0x18f));var _0x2c6d=function(_0x5583e2,_0x5ed956){_0x5583e2=_0x5583e2-0x0;var _0x4ff4a3=_0xc6d2[_0x5583e2];return _0x4ff4a3;};'use strict';var _=require(_0x2c6d('0x0'));var util=require(_0x2c6d('0x1'));var logger=require('../../config/logger')(_0x2c6d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2c6d('0x3'));var fs=require('fs');var path=require(_0x2c6d('0x4'));var rimraf=require(_0x2c6d('0x5'));var config=require(_0x2c6d('0x6'));var attributes=require(_0x2c6d('0x7'));module['exports']=function(_0x35c4c7,_0x2e8973){return _0x35c4c7[_0x2c6d('0x8')]('AnalyticFieldReport',attributes,{'tableName':_0x2c6d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6223=['./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5b31ad,_0x3f456f){var _0x3c0c45=function(_0x2dcc41){while(--_0x2dcc41){_0x5b31ad['push'](_0x5b31ad['shift']());}};_0x3c0c45(++_0x3f456f);}(_0x6223,0x122));var _0x3622=function(_0x3ef2d5,_0x423d46){_0x3ef2d5=_0x3ef2d5-0x0;var _0x2fefb2=_0x6223[_0x3ef2d5];return _0x2fefb2;};'use strict';var _=require(_0x3622('0x0'));var util=require(_0x3622('0x1'));var logger=require(_0x3622('0x2'))(_0x3622('0x3'));var moment=require(_0x3622('0x4'));var BPromise=require(_0x3622('0x5'));var rp=require(_0x3622('0x6'));var fs=require('fs');var path=require(_0x3622('0x7'));var rimraf=require(_0x3622('0x8'));var config=require(_0x3622('0x9'));var attributes=require(_0x3622('0xa'));module[_0x3622('0xb')]=function(_0x42f49a,_0x5eaea9){return _0x42f49a[_0x3622('0xc')](_0x3622('0xd'),attributes,{'tableName':_0x3622('0xe'),'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 dc08cc4..90a0a9b 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 _0x9423=['code','message','result','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x9423,0x8f));var _0x3942=function(_0x31fe22,_0x3237a1){_0x31fe22=_0x31fe22-0x0;var _0x22a27d=_0x9423[_0x31fe22];return _0x22a27d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x3942('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3942('0x1'));var db=require(_0x3942('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x3942('0x3'))(_0x3942('0x4'));var config=require(_0x3942('0x5'));var jayson=require(_0x3942('0x6'));var client=jayson[_0x3942('0x7')][_0x3942('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x581a3c,_0x561bfa,_0x4762a4){return new BPromise(function(_0x45939a,_0x4851c2){return client[_0x3942('0x9')](_0x581a3c,_0x4762a4)[_0x3942('0xa')](function(_0x6a9349){logger['info'](_0x3942('0xb'),_0x561bfa,'request\x20sent');logger[_0x3942('0xc')](_0x3942('0xd'),_0x561bfa,_0x3942('0xe'),JSON[_0x3942('0xf')](_0x6a9349));if(_0x6a9349[_0x3942('0x10')]){if(_0x6a9349[_0x3942('0x10')][_0x3942('0x11')]===0x1f4){logger[_0x3942('0x10')](_0x3942('0xb'),_0x561bfa,_0x6a9349[_0x3942('0x10')][_0x3942('0x12')]);return _0x4851c2(_0x6a9349['error'][_0x3942('0x12')]);}logger['error'](_0x3942('0xb'),_0x561bfa,_0x6a9349['error']['message']);return _0x45939a(_0x6a9349['error'][_0x3942('0x12')]);}else{logger['info'](_0x3942('0xb'),_0x561bfa,_0x3942('0xe'));_0x45939a(_0x6a9349[_0x3942('0x13')][_0x3942('0x12')]);}})['catch'](function(_0x384e2e){logger[_0x3942('0x10')](_0x3942('0xb'),_0x561bfa,_0x384e2e);_0x4851c2(_0x384e2e);});});} \ No newline at end of file +var _0xddfe=['../../config/environment','jayson/promise','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x512a69,_0x513a94){var _0x2240fe=function(_0x1ba678){while(--_0x1ba678){_0x512a69['push'](_0x512a69['shift']());}};_0x2240fe(++_0x513a94);}(_0xddfe,0xea));var _0xeddf=function(_0x94e963,_0x59a78d){_0x94e963=_0x94e963-0x0;var _0x145ecc=_0xddfe[_0x94e963];return _0x145ecc;};'use strict';var _=require(_0xeddf('0x0'));var util=require(_0xeddf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xeddf('0x2'));var fs=require('fs');var Redis=require(_0xeddf('0x3'));var db=require(_0xeddf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xeddf('0x5'))('rpc');var config=require(_0xeddf('0x6'));var jayson=require(_0xeddf('0x7'));var client=jayson['client'][_0xeddf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xb55eba,_0x4b19fd,_0x25b6db){return new BPromise(function(_0x613f90,_0x3239b5){return client[_0xeddf('0x9')](_0xb55eba,_0x25b6db)[_0xeddf('0xa')](function(_0x4ff4bf){logger[_0xeddf('0xb')](_0xeddf('0xc'),_0x4b19fd,_0xeddf('0xd'));logger[_0xeddf('0xe')](_0xeddf('0xf'),_0x4b19fd,_0xeddf('0xd'),JSON['stringify'](_0x4ff4bf));if(_0x4ff4bf[_0xeddf('0x10')]){if(_0x4ff4bf['error'][_0xeddf('0x11')]===0x1f4){logger[_0xeddf('0x10')](_0xeddf('0xc'),_0x4b19fd,_0x4ff4bf['error'][_0xeddf('0x12')]);return _0x3239b5(_0x4ff4bf[_0xeddf('0x10')][_0xeddf('0x12')]);}logger[_0xeddf('0x10')](_0xeddf('0xc'),_0x4b19fd,_0x4ff4bf[_0xeddf('0x10')][_0xeddf('0x12')]);return _0x613f90(_0x4ff4bf['error'][_0xeddf('0x12')]);}else{logger[_0xeddf('0xb')](_0xeddf('0xc'),_0x4b19fd,'request\x20sent');_0x613f90(_0x4ff4bf['result'][_0xeddf('0x12')]);}})[_0xeddf('0x13')](function(_0x1c1abf){logger['error'](_0xeddf('0xc'),_0x4b19fd,_0x1c1abf);_0x3239b5(_0x1c1abf);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 3f0b0cc..ceafc10 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(_0x44db8e,_0x143b54){var _0x40667a=function(_0x618866){while(--_0x618866){_0x44db8e['push'](_0x44db8e['shift']());}};_0x40667a(++_0x143b54);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0x30368a,_0x4ea293){var _0x306789=function(_0x1484d8){while(--_0x1484d8){_0x30368a['push'](_0x30368a['shift']());}};_0x306789(++_0x4ea293);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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 bbc5111..218817d 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 _0x13eb=['exports','name','STRING','sequelize'];(function(_0x176c18,_0x31e845){var _0x2d64b4=function(_0x27cd68){while(--_0x27cd68){_0x176c18['push'](_0x176c18['shift']());}};_0x2d64b4(++_0x31e845);}(_0x13eb,0x8f));var _0xb13e=function(_0x2d1d37,_0x1048d8){_0x2d1d37=_0x2d1d37-0x0;var _0x3e9649=_0x13eb[_0x2d1d37];return _0x3e9649;};'use strict';var Sequelize=require(_0xb13e('0x0'));module[_0xb13e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb13e('0x2')},'table':{'type':Sequelize[_0xb13e('0x3')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xb13e('0x3')]}}; \ No newline at end of file +var _0xae60=['exports','STRING','TEXT','sequelize'];(function(_0x278081,_0x571971){var _0x1f666e=function(_0x7cb6aa){while(--_0x7cb6aa){_0x278081['push'](_0x278081['shift']());}};_0x1f666e(++_0x571971);}(_0xae60,0x1c7));var _0x0ae6=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0xae60[_0x580647];return _0x5f0792;};'use strict';var Sequelize=require(_0x0ae6('0x0'));module[_0x0ae6('0x1')]={'name':{'type':Sequelize[_0x0ae6('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x0ae6('0x2')]},'metric':{'type':Sequelize[_0x0ae6('0x3')]},'description':{'type':Sequelize[_0x0ae6('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index a99e3a0..859f8e8 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 _0x6aa7=['json','apply','reject','save','update','then','destroy','get','Metrics','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','show','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','UserProfileResource','catch','error','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range'];(function(_0x195a84,_0x37a11b){var _0x35fa94=function(_0x2e50e1){while(--_0x2e50e1){_0x195a84['push'](_0x195a84['shift']());}};_0x35fa94(++_0x37a11b);}(_0x6aa7,0x178));var _0x76aa=function(_0x259357,_0x5a6eb1){_0x259357=_0x259357-0x0;var _0x22f04b=_0x6aa7[_0x259357];return _0x22f04b;};'use strict';var emlformat=require(_0x76aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x76aa('0x1'));var jsonpatch=require(_0x76aa('0x2'));var rp=require(_0x76aa('0x3'));var moment=require(_0x76aa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x76aa('0x5'));var util=require(_0x76aa('0x6'));var path=require(_0x76aa('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x76aa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0xd'));var querystring=require(_0x76aa('0xe'));var Papa=require('papaparse');var Redis=require(_0x76aa('0xf'));var authService=require(_0x76aa('0x10'));var qs=require(_0x76aa('0x11'));var as=require(_0x76aa('0x12'));var hardwareService=require(_0x76aa('0x13'));var logger=require(_0x76aa('0x14'))(_0x76aa('0x15'));var utils=require(_0x76aa('0x16'));var config=require(_0x76aa('0x17'));var licenseUtil=require(_0x76aa('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x112c39,_0x5df49c){_0x5df49c=_0x5df49c||0xcc;return function(_0x226536){if(_0x226536){return _0x112c39[_0x76aa('0x19')](_0x5df49c);}return _0x112c39[_0x76aa('0x1a')](_0x5df49c)[_0x76aa('0x1b')]();};}function respondWithResult(_0x10432c,_0x4e309f){_0x4e309f=_0x4e309f||0xc8;return function(_0x5f5b59){if(_0x5f5b59){return _0x10432c[_0x76aa('0x1a')](_0x4e309f)['json'](_0x5f5b59);}};}function respondWithFilteredResult(_0x180d92,_0x319bf1){return function(_0x5cf594){if(_0x5cf594){var _0x2111c7=typeof _0x319bf1['offset']===_0x76aa('0x1c')&&typeof _0x319bf1['limit']===_0x76aa('0x1c');var _0x413cf6=_0x5cf594[_0x76aa('0x1d')];var _0x21c16d=_0x2111c7?0x0:_0x319bf1[_0x76aa('0x1e')];var _0x3ead3f=_0x2111c7?_0x5cf594['count']:_0x319bf1['offset']+_0x319bf1[_0x76aa('0x1f')];var _0x454dd3;if(_0x3ead3f>=_0x413cf6){_0x3ead3f=_0x413cf6;_0x454dd3=0xc8;}else{_0x454dd3=0xce;}_0x180d92[_0x76aa('0x1a')](_0x454dd3);return _0x180d92[_0x76aa('0x20')](_0x76aa('0x21'),_0x21c16d+'-'+_0x3ead3f+'/'+_0x413cf6)[_0x76aa('0x22')](_0x5cf594);}return null;};}function patchUpdates(_0x19af92){return function(_0x2eaf48){try{jsonpatch[_0x76aa('0x23')](_0x2eaf48,_0x19af92,!![]);}catch(_0x5990c1){return BPromise[_0x76aa('0x24')](_0x5990c1);}return _0x2eaf48[_0x76aa('0x25')]();};}function saveUpdates(_0x338a6b,_0x5b3f55){return function(_0x41463a){if(_0x41463a){return _0x41463a[_0x76aa('0x26')](_0x338a6b)[_0x76aa('0x27')](function(_0x2bd2c6){return _0x2bd2c6;});}return null;};}function removeEntity(_0x29c50c,_0xc1044c){return function(_0x3cd039){if(_0x3cd039){return _0x3cd039[_0x76aa('0x28')]()[_0x76aa('0x27')](function(){var _0x2cba6d=_0x3cd039[_0x76aa('0x29')]({'plain':!![]});var _0x26b75e=_0x76aa('0x2a');return db['UserProfileResource'][_0x76aa('0x28')]({'where':{'type':_0x26b75e,'resourceId':_0x2cba6d['id']}})[_0x76aa('0x27')](function(){return _0x3cd039;});})[_0x76aa('0x27')](function(){_0x29c50c[_0x76aa('0x1a')](0xcc)[_0x76aa('0x1b')]();});}};}function handleEntityNotFound(_0x2f9316,_0x25a803){return function(_0x282d0a){if(!_0x282d0a){_0x2f9316[_0x76aa('0x19')](0x194);}return _0x282d0a;};}function handleError(_0x1bdc3d,_0x545b06){_0x545b06=_0x545b06||0x1f4;return function(_0x3fcb7f){logger['error'](_0x3fcb7f[_0x76aa('0x2b')]);if(_0x3fcb7f[_0x76aa('0x2c')]){delete _0x3fcb7f[_0x76aa('0x2c')];}_0x1bdc3d[_0x76aa('0x1a')](_0x545b06)[_0x76aa('0x2d')](_0x3fcb7f);};}exports[_0x76aa('0x2e')]=function(_0x2ee0f9,_0x3827ec){var _0x19fd4f={},_0x3ea05a={},_0x5edcd8={'count':0x0,'rows':[]};var _0x430ad6=_[_0x76aa('0x2f')](db[_0x76aa('0x30')][_0x76aa('0x31')],function(_0x458ac3){return{'name':_0x458ac3[_0x76aa('0x32')],'type':_0x458ac3[_0x76aa('0x33')]['key']};});_0x3ea05a[_0x76aa('0x34')]=_[_0x76aa('0x2f')](_0x430ad6,'name');_0x3ea05a[_0x76aa('0x35')]=_['keys'](_0x2ee0f9[_0x76aa('0x35')]);_0x3ea05a['filters']=_[_0x76aa('0x36')](_0x3ea05a['model'],_0x3ea05a['query']);_0x19fd4f[_0x76aa('0x37')]=_[_0x76aa('0x36')](_0x3ea05a[_0x76aa('0x34')],qs[_0x76aa('0x38')](_0x2ee0f9['query']['fields']));_0x19fd4f[_0x76aa('0x37')]=_0x19fd4f[_0x76aa('0x37')][_0x76aa('0x39')]?_0x19fd4f[_0x76aa('0x37')]:_0x3ea05a[_0x76aa('0x34')];if(!_0x2ee0f9['query'][_0x76aa('0x3a')]('nolimit')){_0x19fd4f['limit']=qs[_0x76aa('0x1f')](_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x1f')]);_0x19fd4f[_0x76aa('0x1e')]=qs['offset'](_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x1e')]);}_0x19fd4f[_0x76aa('0x3b')]=qs['sort'](_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x3c')]);_0x19fd4f[_0x76aa('0x3d')]=qs[_0x76aa('0x3e')](_[_0x76aa('0x3f')](_0x2ee0f9[_0x76aa('0x35')],_0x3ea05a[_0x76aa('0x3e')]),_0x430ad6);if(_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x40')]){_0x19fd4f['where']=_[_0x76aa('0x41')](_0x19fd4f[_0x76aa('0x3d')],{'$or':_[_0x76aa('0x2f')](_0x430ad6,function(_0xa824e8){if(_0xa824e8[_0x76aa('0x33')]!==_0x76aa('0x42')){var _0x572fdb={};_0x572fdb[_0xa824e8['name']]={'$like':'%'+_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x40')]+'%'};return _0x572fdb;}})});}_0x19fd4f=_[_0x76aa('0x41')]({},_0x19fd4f,_0x2ee0f9[_0x76aa('0x43')]);var _0x50599f={'where':_0x19fd4f[_0x76aa('0x3d')]};return db[_0x76aa('0x30')][_0x76aa('0x1d')](_0x50599f)[_0x76aa('0x27')](function(_0x1138b5){_0x5edcd8['count']=_0x1138b5;if(_0x2ee0f9[_0x76aa('0x35')]['includeAll']){_0x19fd4f[_0x76aa('0x44')]=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x19fd4f);})['then'](function(_0x144f0a){_0x5edcd8['rows']=_0x144f0a;return _0x5edcd8;})['then'](respondWithFilteredResult(_0x3827ec,_0x19fd4f))['catch'](handleError(_0x3827ec,null));};exports[_0x76aa('0x45')]=function(_0x3fd153,_0x116dc5){var _0x2c0744={'raw':!![],'where':{'id':_0x3fd153['params']['id']}},_0x27a52e={};_0x27a52e[_0x76aa('0x34')]=_[_0x76aa('0x46')](db[_0x76aa('0x30')][_0x76aa('0x31')]);_0x27a52e[_0x76aa('0x35')]=_['keys'](_0x3fd153[_0x76aa('0x35')]);_0x27a52e[_0x76aa('0x3e')]=_['intersection'](_0x27a52e[_0x76aa('0x34')],_0x27a52e['query']);_0x2c0744[_0x76aa('0x37')]=_[_0x76aa('0x36')](_0x27a52e[_0x76aa('0x34')],qs[_0x76aa('0x38')](_0x3fd153[_0x76aa('0x35')][_0x76aa('0x38')]));_0x2c0744[_0x76aa('0x37')]=_0x2c0744[_0x76aa('0x37')][_0x76aa('0x39')]?_0x2c0744[_0x76aa('0x37')]:_0x27a52e['model'];if(_0x3fd153[_0x76aa('0x35')]['includeAll']){_0x2c0744[_0x76aa('0x44')]=[{'all':!![]}];}_0x2c0744=_[_0x76aa('0x41')]({},_0x2c0744,_0x3fd153[_0x76aa('0x43')]);return db[_0x76aa('0x30')]['find'](_0x2c0744)['then'](handleEntityNotFound(_0x116dc5,null))[_0x76aa('0x27')](respondWithResult(_0x116dc5,null))['catch'](handleError(_0x116dc5,null));};exports[_0x76aa('0x47')]=function(_0x302a0c,_0x4315b3){return db[_0x76aa('0x30')][_0x76aa('0x47')](_0x302a0c[_0x76aa('0x48')],{})['then'](function(_0x564546){var _0x2fcf8f=_0x302a0c[_0x76aa('0x49')][_0x76aa('0x29')]({'plain':!![]});if(!_0x2fcf8f)throw new Error(_0x76aa('0x4a'));if(_0x2fcf8f[_0x76aa('0x4b')]===_0x76aa('0x49')){var _0x4c52d5=_0x564546[_0x76aa('0x29')]({'plain':!![]});var _0x2d631e=_0x76aa('0x2a');return db['UserProfileSection'][_0x76aa('0x4c')]({'where':{'name':_0x2d631e,'userProfileId':_0x2fcf8f['userProfileId']},'raw':!![]})[_0x76aa('0x27')](function(_0x5e1d84){if(_0x5e1d84&&_0x5e1d84[_0x76aa('0x4d')]===0x0){return db[_0x76aa('0x4e')][_0x76aa('0x47')]({'name':_0x4c52d5[_0x76aa('0x2c')],'resourceId':_0x4c52d5['id'],'type':_0x5e1d84[_0x76aa('0x2c')],'sectionId':_0x5e1d84['id']},{})[_0x76aa('0x27')](function(){return _0x564546;});}else{return _0x564546;}})[_0x76aa('0x4f')](function(_0x4f2c2b){logger[_0x76aa('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f2c2b);throw _0x4f2c2b;});}return _0x564546;})[_0x76aa('0x27')](respondWithResult(_0x4315b3,0xc9))[_0x76aa('0x4f')](handleError(_0x4315b3,null));};exports[_0x76aa('0x26')]=function(_0x53be10,_0x3fa7ec){if(_0x53be10[_0x76aa('0x48')]['id']){delete _0x53be10[_0x76aa('0x48')]['id'];}return db['AnalyticMetric'][_0x76aa('0x4c')]({'where':{'id':_0x53be10[_0x76aa('0x51')]['id']}})[_0x76aa('0x27')](handleEntityNotFound(_0x3fa7ec,null))[_0x76aa('0x27')](saveUpdates(_0x53be10['body'],null))[_0x76aa('0x27')](respondWithResult(_0x3fa7ec,null))[_0x76aa('0x4f')](handleError(_0x3fa7ec,null));};exports[_0x76aa('0x28')]=function(_0x410933,_0x2027f8){return db[_0x76aa('0x30')]['find']({'where':{'id':_0x410933[_0x76aa('0x51')]['id']}})[_0x76aa('0x27')](handleEntityNotFound(_0x2027f8,null))[_0x76aa('0x27')](removeEntity(_0x2027f8,null))[_0x76aa('0x4f')](handleError(_0x2027f8,null));}; \ No newline at end of file +var _0x46ed=['where','pick','filter','merge','map','type','options','count','includeAll','include','findAll','rows','params','keys','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','set','Content-Range','json','apply','reject','update','then','Metrics','UserProfileResource','destroy','error','stack','name','send','index','AnalyticMetric','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x45a36b,_0x5f337a){var _0x2232ac=function(_0x14f41c){while(--_0x14f41c){_0x45a36b['push'](_0x45a36b['shift']());}};_0x2232ac(++_0x5f337a);}(_0x46ed,0x168));var _0xd46e=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x46ed[_0x46698a];return _0x356db0;};'use strict';var emlformat=require(_0xd46e('0x0'));var rimraf=require(_0xd46e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd46e('0x2'));var rp=require(_0xd46e('0x3'));var moment=require(_0xd46e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd46e('0x5'));var util=require(_0xd46e('0x6'));var path=require('path');var sox=require(_0xd46e('0x7'));var csv=require(_0xd46e('0x8'));var ejs=require(_0xd46e('0x9'));var fs=require('fs');var fs_extra=require(_0xd46e('0xa'));var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x8'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46e('0x19'))['db'];function respondWithStatusCode(_0x5bc1da,_0x48550b){_0x48550b=_0x48550b||0xcc;return function(_0xf3048c){if(_0xf3048c){return _0x5bc1da[_0xd46e('0x1a')](_0x48550b);}return _0x5bc1da['status'](_0x48550b)['end']();};}function respondWithResult(_0xacd799,_0x4688ae){_0x4688ae=_0x4688ae||0xc8;return function(_0x1e9aae){if(_0x1e9aae){return _0xacd799[_0xd46e('0x1b')](_0x4688ae)['json'](_0x1e9aae);}};}function respondWithFilteredResult(_0x3b6d25,_0x44a620){return function(_0x417402){if(_0x417402){var _0x3d72ce=typeof _0x44a620[_0xd46e('0x1c')]==='undefined'&&typeof _0x44a620[_0xd46e('0x1d')]===_0xd46e('0x1e');var _0x3583a5=_0x417402['count'];var _0x5ddd04=_0x3d72ce?0x0:_0x44a620[_0xd46e('0x1c')];var _0x1bd574=_0x3d72ce?_0x417402['count']:_0x44a620['offset']+_0x44a620[_0xd46e('0x1d')];var _0x2f2571;if(_0x1bd574>=_0x3583a5){_0x1bd574=_0x3583a5;_0x2f2571=0xc8;}else{_0x2f2571=0xce;}_0x3b6d25[_0xd46e('0x1b')](_0x2f2571);return _0x3b6d25[_0xd46e('0x1f')](_0xd46e('0x20'),_0x5ddd04+'-'+_0x1bd574+'/'+_0x3583a5)[_0xd46e('0x21')](_0x417402);}return null;};}function patchUpdates(_0x3b5fa4){return function(_0x327b7e){try{jsonpatch[_0xd46e('0x22')](_0x327b7e,_0x3b5fa4,!![]);}catch(_0x3c7e91){return BPromise[_0xd46e('0x23')](_0x3c7e91);}return _0x327b7e['save']();};}function saveUpdates(_0x259072,_0x1c83fa){return function(_0x79aa51){if(_0x79aa51){return _0x79aa51[_0xd46e('0x24')](_0x259072)[_0xd46e('0x25')](function(_0xc1af7f){return _0xc1af7f;});}return null;};}function removeEntity(_0x33c2e0,_0x8a1be){return function(_0x62dea5){if(_0x62dea5){return _0x62dea5['destroy']()[_0xd46e('0x25')](function(){var _0x5424e5=_0x62dea5['get']({'plain':!![]});var _0x371054=_0xd46e('0x26');return db[_0xd46e('0x27')][_0xd46e('0x28')]({'where':{'type':_0x371054,'resourceId':_0x5424e5['id']}})[_0xd46e('0x25')](function(){return _0x62dea5;});})[_0xd46e('0x25')](function(){_0x33c2e0[_0xd46e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45d789,_0x3c301a){return function(_0xddbce9){if(!_0xddbce9){_0x45d789[_0xd46e('0x1a')](0x194);}return _0xddbce9;};}function handleError(_0x96f15c,_0x16e941){_0x16e941=_0x16e941||0x1f4;return function(_0x58aeef){logger[_0xd46e('0x29')](_0x58aeef[_0xd46e('0x2a')]);if(_0x58aeef[_0xd46e('0x2b')]){delete _0x58aeef[_0xd46e('0x2b')];}_0x96f15c[_0xd46e('0x1b')](_0x16e941)[_0xd46e('0x2c')](_0x58aeef);};}exports[_0xd46e('0x2d')]=function(_0x2c5ec7,_0x18f060){var _0x45ea47={},_0x2ff785={},_0x504324={'count':0x0,'rows':[]};var _0x2f4a1b=_['map'](db[_0xd46e('0x2e')][_0xd46e('0x2f')],function(_0x4f5718){return{'name':_0x4f5718[_0xd46e('0x30')],'type':_0x4f5718['type'][_0xd46e('0x31')]};});_0x2ff785[_0xd46e('0x32')]=_['map'](_0x2f4a1b,_0xd46e('0x2b'));_0x2ff785[_0xd46e('0x33')]=_['keys'](_0x2c5ec7[_0xd46e('0x33')]);_0x2ff785[_0xd46e('0x34')]=_[_0xd46e('0x35')](_0x2ff785['model'],_0x2ff785['query']);_0x45ea47[_0xd46e('0x36')]=_[_0xd46e('0x35')](_0x2ff785[_0xd46e('0x32')],qs[_0xd46e('0x37')](_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x37')]));_0x45ea47[_0xd46e('0x36')]=_0x45ea47[_0xd46e('0x36')]['length']?_0x45ea47[_0xd46e('0x36')]:_0x2ff785[_0xd46e('0x32')];if(!_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x38')](_0xd46e('0x39'))){_0x45ea47[_0xd46e('0x1d')]=qs[_0xd46e('0x1d')](_0x2c5ec7['query'][_0xd46e('0x1d')]);_0x45ea47[_0xd46e('0x1c')]=qs['offset'](_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x1c')]);}_0x45ea47[_0xd46e('0x3a')]=qs[_0xd46e('0x3b')](_0x2c5ec7['query'][_0xd46e('0x3b')]);_0x45ea47[_0xd46e('0x3c')]=qs[_0xd46e('0x34')](_[_0xd46e('0x3d')](_0x2c5ec7[_0xd46e('0x33')],_0x2ff785[_0xd46e('0x34')]),_0x2f4a1b);if(_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x3e')]){_0x45ea47['where']=_[_0xd46e('0x3f')](_0x45ea47[_0xd46e('0x3c')],{'$or':_[_0xd46e('0x40')](_0x2f4a1b,function(_0x25657a){if(_0x25657a[_0xd46e('0x41')]!=='VIRTUAL'){var _0x964c66={};_0x964c66[_0x25657a['name']]={'$like':'%'+_0x2c5ec7['query']['filter']+'%'};return _0x964c66;}})});}_0x45ea47=_['merge']({},_0x45ea47,_0x2c5ec7[_0xd46e('0x42')]);var _0x54949f={'where':_0x45ea47[_0xd46e('0x3c')]};return db[_0xd46e('0x2e')]['count'](_0x54949f)[_0xd46e('0x25')](function(_0x4114e6){_0x504324[_0xd46e('0x43')]=_0x4114e6;if(_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x44')]){_0x45ea47[_0xd46e('0x45')]=[{'all':!![]}];}return db[_0xd46e('0x2e')][_0xd46e('0x46')](_0x45ea47);})[_0xd46e('0x25')](function(_0xec367d){_0x504324[_0xd46e('0x47')]=_0xec367d;return _0x504324;})['then'](respondWithFilteredResult(_0x18f060,_0x45ea47))['catch'](handleError(_0x18f060,null));};exports['show']=function(_0x2b4a5a,_0x4e1d94){var _0x168d35={'raw':!![],'where':{'id':_0x2b4a5a[_0xd46e('0x48')]['id']}},_0x272f5f={};_0x272f5f[_0xd46e('0x32')]=_[_0xd46e('0x49')](db[_0xd46e('0x2e')][_0xd46e('0x2f')]);_0x272f5f[_0xd46e('0x33')]=_['keys'](_0x2b4a5a[_0xd46e('0x33')]);_0x272f5f['filters']=_[_0xd46e('0x35')](_0x272f5f[_0xd46e('0x32')],_0x272f5f[_0xd46e('0x33')]);_0x168d35[_0xd46e('0x36')]=_[_0xd46e('0x35')](_0x272f5f['model'],qs[_0xd46e('0x37')](_0x2b4a5a[_0xd46e('0x33')][_0xd46e('0x37')]));_0x168d35[_0xd46e('0x36')]=_0x168d35[_0xd46e('0x36')]['length']?_0x168d35[_0xd46e('0x36')]:_0x272f5f[_0xd46e('0x32')];if(_0x2b4a5a[_0xd46e('0x33')][_0xd46e('0x44')]){_0x168d35[_0xd46e('0x45')]=[{'all':!![]}];}_0x168d35=_['merge']({},_0x168d35,_0x2b4a5a[_0xd46e('0x42')]);return db[_0xd46e('0x2e')][_0xd46e('0x4a')](_0x168d35)[_0xd46e('0x25')](handleEntityNotFound(_0x4e1d94,null))[_0xd46e('0x25')](respondWithResult(_0x4e1d94,null))[_0xd46e('0x4b')](handleError(_0x4e1d94,null));};exports[_0xd46e('0x4c')]=function(_0x440dcc,_0x5188f6){return db[_0xd46e('0x2e')][_0xd46e('0x4c')](_0x440dcc[_0xd46e('0x4d')],{})[_0xd46e('0x25')](function(_0x1f1941){var _0x4e84c8=_0x440dcc['user'][_0xd46e('0x4e')]({'plain':!![]});if(!_0x4e84c8)throw new Error(_0xd46e('0x4f'));if(_0x4e84c8[_0xd46e('0x50')]==='user'){var _0x479711=_0x1f1941[_0xd46e('0x4e')]({'plain':!![]});var _0x9d8638='Metrics';return db[_0xd46e('0x51')][_0xd46e('0x4a')]({'where':{'name':_0x9d8638,'userProfileId':_0x4e84c8[_0xd46e('0x52')]},'raw':!![]})[_0xd46e('0x25')](function(_0x1bd8a5){if(_0x1bd8a5&&_0x1bd8a5[_0xd46e('0x53')]===0x0){return db[_0xd46e('0x27')][_0xd46e('0x4c')]({'name':_0x479711['name'],'resourceId':_0x479711['id'],'type':_0x1bd8a5[_0xd46e('0x2b')],'sectionId':_0x1bd8a5['id']},{})[_0xd46e('0x25')](function(){return _0x1f1941;});}else{return _0x1f1941;}})[_0xd46e('0x4b')](function(_0x63ee74){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x63ee74);throw _0x63ee74;});}return _0x1f1941;})[_0xd46e('0x25')](respondWithResult(_0x5188f6,0xc9))['catch'](handleError(_0x5188f6,null));};exports[_0xd46e('0x24')]=function(_0x2af20b,_0x393cb9){if(_0x2af20b[_0xd46e('0x4d')]['id']){delete _0x2af20b[_0xd46e('0x4d')]['id'];}return db[_0xd46e('0x2e')]['find']({'where':{'id':_0x2af20b[_0xd46e('0x48')]['id']}})[_0xd46e('0x25')](handleEntityNotFound(_0x393cb9,null))[_0xd46e('0x25')](saveUpdates(_0x2af20b['body'],null))[_0xd46e('0x25')](respondWithResult(_0x393cb9,null))[_0xd46e('0x4b')](handleError(_0x393cb9,null));};exports[_0xd46e('0x28')]=function(_0x2042d4,_0x1886e6){return db[_0xd46e('0x2e')][_0xd46e('0x4a')]({'where':{'id':_0x2042d4[_0xd46e('0x48')]['id']}})[_0xd46e('0x25')](handleEntityNotFound(_0x1886e6,null))[_0xd46e('0x25')](removeEntity(_0x1886e6,null))[_0xd46e('0x4b')](handleError(_0x1886e6,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 1b0a0b5..97ec447 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 _0xe260=['path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe260,0x94));var _0x0e26=function(_0x5deee7,_0x465983){_0x5deee7=_0x5deee7-0x0;var _0x3b5430=_0xe260[_0x5deee7];return _0x3b5430;};'use strict';var _=require(_0x0e26('0x0'));var util=require('util');var logger=require(_0x0e26('0x1'))(_0x0e26('0x2'));var moment=require(_0x0e26('0x3'));var BPromise=require(_0x0e26('0x4'));var rp=require(_0x0e26('0x5'));var fs=require('fs');var path=require(_0x0e26('0x6'));var rimraf=require(_0x0e26('0x7'));var config=require(_0x0e26('0x8'));var attributes=require(_0x0e26('0x9'));module[_0x0e26('0xa')]=function(_0x48cea9,_0x593669){return _0x48cea9[_0x0e26('0xb')](_0x0e26('0xc'),attributes,{'tableName':_0x0e26('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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(_0x3959aa,_0x2d07e0){_0x3959aa=_0x3959aa-0x0;var _0x4e2279=_0xd072[_0x3959aa];return _0x4e2279;};'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 diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 10a347f..af34dc7 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 _0x5ee9=['client','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x36fbef,_0x4ffc84){var _0x45e270=function(_0x32dd95){while(--_0x32dd95){_0x36fbef['push'](_0x36fbef['shift']());}};_0x45e270(++_0x4ffc84);}(_0x5ee9,0x16f));var _0x95ee=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5ee9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x95ee('0x0'));var util=require(_0x95ee('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x95ee('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x95ee('0x3'))['db'];var utils=require(_0x95ee('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x95ee('0x5'));var jayson=require(_0x95ee('0x6'));var client=jayson[_0x95ee('0x7')][_0x95ee('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b5168,_0x192d93,_0x46db8c){return new BPromise(function(_0x213dca,_0x289821){return client[_0x95ee('0x9')](_0x1b5168,_0x46db8c)[_0x95ee('0xa')](function(_0x38759f){logger['info'](_0x95ee('0xb'),_0x192d93,_0x95ee('0xc'));logger[_0x95ee('0xd')](_0x95ee('0xe'),_0x192d93,_0x95ee('0xc'),JSON[_0x95ee('0xf')](_0x38759f));if(_0x38759f[_0x95ee('0x10')]){if(_0x38759f[_0x95ee('0x10')][_0x95ee('0x11')]===0x1f4){logger[_0x95ee('0x10')](_0x95ee('0xb'),_0x192d93,_0x38759f['error'][_0x95ee('0x12')]);return _0x289821(_0x38759f[_0x95ee('0x10')][_0x95ee('0x12')]);}logger[_0x95ee('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x192d93,_0x38759f[_0x95ee('0x10')][_0x95ee('0x12')]);return _0x213dca(_0x38759f['error']['message']);}else{logger[_0x95ee('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x192d93,_0x95ee('0xc'));_0x213dca(_0x38759f[_0x95ee('0x14')][_0x95ee('0x12')]);}})[_0x95ee('0x15')](function(_0x59da5b){logger[_0x95ee('0x10')](_0x95ee('0xb'),_0x192d93,_0x59da5b);_0x289821(_0x59da5b);});});} \ No newline at end of file +var _0xd1bd=['moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash'];(function(_0x39c223,_0x17a712){var _0xac729f=function(_0x4932dd){while(--_0x4932dd){_0x39c223['push'](_0x39c223['shift']());}};_0xac729f(++_0x17a712);}(_0xd1bd,0x1d3));var _0xdd1b=function(_0x2cf014,_0x3bfccd){_0x2cf014=_0x2cf014-0x0;var _0x342266=_0xd1bd[_0x2cf014];return _0x342266;};'use strict';var _=require(_0xdd1b('0x0'));var util=require('util');var moment=require(_0xdd1b('0x1'));var BPromise=require(_0xdd1b('0x2'));var rs=require(_0xdd1b('0x3'));var fs=require('fs');var Redis=require(_0xdd1b('0x4'));var db=require(_0xdd1b('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdd1b('0x6'));var config=require(_0xdd1b('0x7'));var jayson=require(_0xdd1b('0x8'));var client=jayson['client'][_0xdd1b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa2034d,_0x28cac6,_0x5d1f3a){return new BPromise(function(_0x2fd7bf,_0xd2ce41){return client[_0xdd1b('0xa')](_0xa2034d,_0x5d1f3a)['then'](function(_0x1083b6){logger[_0xdd1b('0xb')](_0xdd1b('0xc'),_0x28cac6,_0xdd1b('0xd'));logger['debug']('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x28cac6,_0xdd1b('0xd'),JSON[_0xdd1b('0xe')](_0x1083b6));if(_0x1083b6[_0xdd1b('0xf')]){if(_0x1083b6[_0xdd1b('0xf')]['code']===0x1f4){logger[_0xdd1b('0xf')](_0xdd1b('0xc'),_0x28cac6,_0x1083b6['error'][_0xdd1b('0x10')]);return _0xd2ce41(_0x1083b6[_0xdd1b('0xf')]['message']);}logger[_0xdd1b('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x28cac6,_0x1083b6[_0xdd1b('0xf')][_0xdd1b('0x10')]);return _0x2fd7bf(_0x1083b6['error'][_0xdd1b('0x10')]);}else{logger[_0xdd1b('0xb')](_0xdd1b('0xc'),_0x28cac6,_0xdd1b('0xd'));_0x2fd7bf(_0x1083b6[_0xdd1b('0x11')][_0xdd1b('0x10')]);}})['catch'](function(_0x3d3a84){logger[_0xdd1b('0xf')](_0xdd1b('0xc'),_0x28cac6,_0x3d3a84);_0xd2ce41(_0x3d3a84);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index b7c8a2a..16665a9 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 _0x37cc=['index','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated'];(function(_0x479e59,_0x3a06fe){var _0xd8cc75=function(_0x56b7ae){while(--_0x56b7ae){_0x479e59['push'](_0x479e59['shift']());}};_0xd8cc75(++_0x3a06fe);}(_0x37cc,0x185));var _0xc37c=function(_0x71eff,_0x48dbbf){_0x71eff=_0x71eff-0x0;var _0xa62b29=_0x37cc[_0x71eff];return _0xa62b29;};'use strict';var multer=require(_0xc37c('0x0'));var util=require(_0xc37c('0x1'));var path=require(_0xc37c('0x2'));var timeout=require(_0xc37c('0x3'));var express=require(_0xc37c('0x4'));var router=express[_0xc37c('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc37c('0x6'));var config=require(_0xc37c('0x7'));var controller=require(_0xc37c('0x8'));router[_0xc37c('0x9')]('/',auth[_0xc37c('0xa')](),controller[_0xc37c('0xb')]);router[_0xc37c('0x9')](_0xc37c('0xc'),auth[_0xc37c('0xa')](),controller['show']);router[_0xc37c('0xd')]('/',auth[_0xc37c('0xa')](),controller[_0xc37c('0xe')]);router[_0xc37c('0xf')](_0xc37c('0xc'),auth['isAuthenticated'](),controller[_0xc37c('0x10')]);router[_0xc37c('0x11')](_0xc37c('0xc'),auth[_0xc37c('0xa')](),controller[_0xc37c('0x12')]);module[_0xc37c('0x13')]=router; \ No newline at end of file +var _0xdd68=['post','isAuthenticated','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','get','index','/:id','show'];(function(_0x36187e,_0x12f44a){var _0x36f0b0=function(_0x8413be){while(--_0x8413be){_0x36187e['push'](_0x36187e['shift']());}};_0x36f0b0(++_0x12f44a);}(_0xdd68,0x196));var _0x8dd6=function(_0x55d8c5,_0x10287a){_0x55d8c5=_0x55d8c5-0x0;var _0x225ae5=_0xdd68[_0x55d8c5];return _0x225ae5;};'use strict';var multer=require(_0x8dd6('0x0'));var util=require('util');var path=require(_0x8dd6('0x1'));var timeout=require(_0x8dd6('0x2'));var express=require(_0x8dd6('0x3'));var router=express[_0x8dd6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8dd6('0x5'));var interaction=require(_0x8dd6('0x6'));var config=require('../../config/environment');var controller=require(_0x8dd6('0x7'));router[_0x8dd6('0x8')]('/',auth['isAuthenticated'](),controller[_0x8dd6('0x9')]);router['get'](_0x8dd6('0xa'),auth['isAuthenticated'](),controller[_0x8dd6('0xb')]);router[_0x8dd6('0xc')]('/',auth[_0x8dd6('0xd')](),controller['create']);router[_0x8dd6('0xe')](_0x8dd6('0xa'),auth[_0x8dd6('0xd')](),controller[_0x8dd6('0xf')]);router[_0x8dd6('0x10')](_0x8dd6('0xa'),auth[_0x8dd6('0xd')](),controller[_0x8dd6('0x11')]);module[_0x8dd6('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index f76a374..64eb1bf 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 _0xf925=['sequelize','exports','TEXT'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xf925,0xf3));var _0x5f92=function(_0x2a608d,_0x298459){_0x2a608d=_0x2a608d-0x0;var _0x1bee3e=_0xf925[_0x2a608d];return _0x1bee3e;};'use strict';var Sequelize=require(_0x5f92('0x0'));module[_0x5f92('0x1')]={'tree':{'type':Sequelize[_0x5f92('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x6400=['sequelize','TEXT'];(function(_0xc71c52,_0x8dfc6c){var _0x17007f=function(_0x30f011){while(--_0x30f011){_0xc71c52['push'](_0xc71c52['shift']());}};_0x17007f(++_0x8dfc6c);}(_0x6400,0x1ee));var _0x0640=function(_0x29db71,_0x306de1){_0x29db71=_0x29db71-0x0;var _0x2c8a07=_0x6400[_0x29db71];return _0x2c8a07;};'use strict';var Sequelize=require(_0x0640('0x0'));module['exports']={'tree':{'type':Sequelize[_0x0640('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 7437929..513ff1e 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 _0x39fe=['update','then','sendStatus','error','stack','name','send','index','AnalyticTreeReport','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','options','includeAll','include','findAll','catch','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x1fa759,_0x4ecdce){var _0x2da9f4=function(_0x463e2a){while(--_0x463e2a){_0x1fa759['push'](_0x1fa759['shift']());}};_0x2da9f4(++_0x4ecdce);}(_0x39fe,0x193));var _0xe39f=function(_0x11e762,_0x3f7103){_0x11e762=_0x11e762-0x0;var _0x24c967=_0x39fe[_0x11e762];return _0x24c967;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe39f('0x0'));var zipdir=require(_0xe39f('0x1'));var jsonpatch=require(_0xe39f('0x2'));var rp=require(_0xe39f('0x3'));var moment=require('moment');var BPromise=require(_0xe39f('0x4'));var Mustache=require(_0xe39f('0x5'));var util=require(_0xe39f('0x6'));var path=require(_0xe39f('0x7'));var sox=require(_0xe39f('0x8'));var csv=require(_0xe39f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe39f('0xa'));var _=require(_0xe39f('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe39f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe39f('0x9'));var querystring=require(_0xe39f('0xd'));var Papa=require(_0xe39f('0xe'));var Redis=require(_0xe39f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe39f('0x10'));var as=require(_0xe39f('0x11'));var hardwareService=require(_0xe39f('0x12'));var logger=require(_0xe39f('0x13'))(_0xe39f('0x14'));var utils=require(_0xe39f('0x15'));var config=require(_0xe39f('0x16'));var licenseUtil=require(_0xe39f('0x17'));var db=require(_0xe39f('0x18'))['db'];function respondWithStatusCode(_0x2ed4bb,_0x18deff){_0x18deff=_0x18deff||0xcc;return function(_0x5ca50f){if(_0x5ca50f){return _0x2ed4bb['sendStatus'](_0x18deff);}return _0x2ed4bb[_0xe39f('0x19')](_0x18deff)['end']();};}function respondWithResult(_0x12f615,_0x33a82b){_0x33a82b=_0x33a82b||0xc8;return function(_0x2ca1ef){if(_0x2ca1ef){return _0x12f615['status'](_0x33a82b)[_0xe39f('0x1a')](_0x2ca1ef);}};}function respondWithFilteredResult(_0x5dce1a,_0x954717){return function(_0x191529){if(_0x191529){var _0x10a88b=typeof _0x954717[_0xe39f('0x1b')]===_0xe39f('0x1c')&&typeof _0x954717[_0xe39f('0x1d')]===_0xe39f('0x1c');var _0x315d25=_0x191529['count'];var _0xbad2ab=_0x10a88b?0x0:_0x954717['offset'];var _0xd23e7=_0x10a88b?_0x191529[_0xe39f('0x1e')]:_0x954717[_0xe39f('0x1b')]+_0x954717[_0xe39f('0x1d')];var _0x2169cb;if(_0xd23e7>=_0x315d25){_0xd23e7=_0x315d25;_0x2169cb=0xc8;}else{_0x2169cb=0xce;}_0x5dce1a[_0xe39f('0x19')](_0x2169cb);return _0x5dce1a[_0xe39f('0x1f')](_0xe39f('0x20'),_0xbad2ab+'-'+_0xd23e7+'/'+_0x315d25)['json'](_0x191529);}return null;};}function patchUpdates(_0x24292b){return function(_0x4b2ad6){try{jsonpatch[_0xe39f('0x21')](_0x4b2ad6,_0x24292b,!![]);}catch(_0x1b9d63){return BPromise[_0xe39f('0x22')](_0x1b9d63);}return _0x4b2ad6['save']();};}function saveUpdates(_0x1c3c24,_0x4a912e){return function(_0xbbeef5){if(_0xbbeef5){return _0xbbeef5[_0xe39f('0x23')](_0x1c3c24)['then'](function(_0x3d06c6){return _0x3d06c6;});}return null;};}function removeEntity(_0x51d2f7,_0x5287dc){return function(_0x384586){if(_0x384586){return _0x384586['destroy']()[_0xe39f('0x24')](function(){_0x51d2f7[_0xe39f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52e563,_0x15218c){return function(_0x451af9){if(!_0x451af9){_0x52e563[_0xe39f('0x25')](0x194);}return _0x451af9;};}function handleError(_0xab5df5,_0x2badd1){_0x2badd1=_0x2badd1||0x1f4;return function(_0x4bd591){logger[_0xe39f('0x26')](_0x4bd591[_0xe39f('0x27')]);if(_0x4bd591[_0xe39f('0x28')]){delete _0x4bd591[_0xe39f('0x28')];}_0xab5df5['status'](_0x2badd1)[_0xe39f('0x29')](_0x4bd591);};}exports[_0xe39f('0x2a')]=function(_0x4e581d,_0x3d5bfb){var _0x53f09a={},_0x36a756={},_0x137fbf={'count':0x0,'rows':[]};var _0x4895be=_['map'](db[_0xe39f('0x2b')][_0xe39f('0x2c')],function(_0x9e2c62){return{'name':_0x9e2c62[_0xe39f('0x2d')],'type':_0x9e2c62[_0xe39f('0x2e')][_0xe39f('0x2f')]};});_0x36a756['model']=_[_0xe39f('0x30')](_0x4895be,_0xe39f('0x28'));_0x36a756[_0xe39f('0x31')]=_[_0xe39f('0x32')](_0x4e581d['query']);_0x36a756[_0xe39f('0x33')]=_[_0xe39f('0x34')](_0x36a756['model'],_0x36a756['query']);_0x53f09a['attributes']=_['intersection'](_0x36a756[_0xe39f('0x35')],qs[_0xe39f('0x36')](_0x4e581d[_0xe39f('0x31')][_0xe39f('0x36')]));_0x53f09a[_0xe39f('0x37')]=_0x53f09a[_0xe39f('0x37')][_0xe39f('0x38')]?_0x53f09a[_0xe39f('0x37')]:_0x36a756[_0xe39f('0x35')];if(!_0x4e581d[_0xe39f('0x31')][_0xe39f('0x39')](_0xe39f('0x3a'))){_0x53f09a['limit']=qs[_0xe39f('0x1d')](_0x4e581d[_0xe39f('0x31')][_0xe39f('0x1d')]);_0x53f09a[_0xe39f('0x1b')]=qs[_0xe39f('0x1b')](_0x4e581d[_0xe39f('0x31')][_0xe39f('0x1b')]);}_0x53f09a[_0xe39f('0x3b')]=qs[_0xe39f('0x3c')](_0x4e581d[_0xe39f('0x31')][_0xe39f('0x3c')]);_0x53f09a['where']=qs['filters'](_['pick'](_0x4e581d[_0xe39f('0x31')],_0x36a756[_0xe39f('0x33')]),_0x4895be);if(_0x4e581d[_0xe39f('0x31')][_0xe39f('0x3d')]){_0x53f09a['where']=_[_0xe39f('0x3e')](_0x53f09a[_0xe39f('0x3f')],{'$or':_['map'](_0x4895be,function(_0x3542aa){if(_0x3542aa[_0xe39f('0x2e')]!=='VIRTUAL'){var _0x2f6c23={};_0x2f6c23[_0x3542aa[_0xe39f('0x28')]]={'$like':'%'+_0x4e581d[_0xe39f('0x31')][_0xe39f('0x3d')]+'%'};return _0x2f6c23;}})});}_0x53f09a=_[_0xe39f('0x3e')]({},_0x53f09a,_0x4e581d[_0xe39f('0x40')]);var _0x22ba7f={'where':_0x53f09a[_0xe39f('0x3f')]};return db[_0xe39f('0x2b')][_0xe39f('0x1e')](_0x22ba7f)['then'](function(_0x3d58e1){_0x137fbf[_0xe39f('0x1e')]=_0x3d58e1;if(_0x4e581d[_0xe39f('0x31')][_0xe39f('0x41')]){_0x53f09a[_0xe39f('0x42')]=[{'all':!![]}];}return db[_0xe39f('0x2b')][_0xe39f('0x43')](_0x53f09a);})[_0xe39f('0x24')](function(_0x28acf2){_0x137fbf['rows']=_0x28acf2;return _0x137fbf;})[_0xe39f('0x24')](respondWithFilteredResult(_0x3d5bfb,_0x53f09a))[_0xe39f('0x44')](handleError(_0x3d5bfb,null));};exports['show']=function(_0x3a5b0d,_0x559796){var _0x4bf4b0={'raw':!![],'where':{'id':_0x3a5b0d[_0xe39f('0x45')]['id']}},_0x54289f={};_0x54289f[_0xe39f('0x35')]=_[_0xe39f('0x32')](db[_0xe39f('0x2b')][_0xe39f('0x2c')]);_0x54289f[_0xe39f('0x31')]=_['keys'](_0x3a5b0d[_0xe39f('0x31')]);_0x54289f[_0xe39f('0x33')]=_['intersection'](_0x54289f[_0xe39f('0x35')],_0x54289f['query']);_0x4bf4b0[_0xe39f('0x37')]=_['intersection'](_0x54289f[_0xe39f('0x35')],qs[_0xe39f('0x36')](_0x3a5b0d[_0xe39f('0x31')][_0xe39f('0x36')]));_0x4bf4b0[_0xe39f('0x37')]=_0x4bf4b0[_0xe39f('0x37')][_0xe39f('0x38')]?_0x4bf4b0[_0xe39f('0x37')]:_0x54289f[_0xe39f('0x35')];if(_0x3a5b0d[_0xe39f('0x31')][_0xe39f('0x41')]){_0x4bf4b0['include']=[{'all':!![]}];}_0x4bf4b0=_['merge']({},_0x4bf4b0,_0x3a5b0d[_0xe39f('0x40')]);return db[_0xe39f('0x2b')][_0xe39f('0x46')](_0x4bf4b0)[_0xe39f('0x24')](handleEntityNotFound(_0x559796,null))['then'](respondWithResult(_0x559796,null))[_0xe39f('0x44')](handleError(_0x559796,null));};exports[_0xe39f('0x47')]=function(_0x1575b3,_0x278969){return db['AnalyticTreeReport'][_0xe39f('0x47')](_0x1575b3[_0xe39f('0x48')],{})[_0xe39f('0x24')](respondWithResult(_0x278969,0xc9))['catch'](handleError(_0x278969,null));};exports[_0xe39f('0x23')]=function(_0x1e0613,_0x207193){if(_0x1e0613['body']['id']){delete _0x1e0613[_0xe39f('0x48')]['id'];}return db[_0xe39f('0x2b')][_0xe39f('0x46')]({'where':{'id':_0x1e0613[_0xe39f('0x45')]['id']}})[_0xe39f('0x24')](handleEntityNotFound(_0x207193,null))[_0xe39f('0x24')](saveUpdates(_0x1e0613['body'],null))[_0xe39f('0x24')](respondWithResult(_0x207193,null))['catch'](handleError(_0x207193,null));};exports['destroy']=function(_0x105c4d,_0x37f4d0){return db[_0xe39f('0x2b')][_0xe39f('0x46')]({'where':{'id':_0x105c4d[_0xe39f('0x45')]['id']}})[_0xe39f('0x24')](handleEntityNotFound(_0x37f4d0,null))[_0xe39f('0x24')](removeEntity(_0x37f4d0,null))['catch'](handleError(_0x37f4d0,null));}; \ No newline at end of file +var _0x55f5=['AnalyticTreeReport','type','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','merge','filter','options','include','findAll','catch','show','params','find','create','body','destroy','eml-format','zip-dir','fast-json-patch','bluebird','util','sox','fs-extra','lodash','squel','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map'];(function(_0x40bf31,_0x258f13){var _0x3048c0=function(_0x5c1a98){while(--_0x5c1a98){_0x40bf31['push'](_0x40bf31['shift']());}};_0x3048c0(++_0x258f13);}(_0x55f5,0xe8));var _0x555f=function(_0xe091e8,_0x20b247){_0xe091e8=_0xe091e8-0x0;var _0x5a7a52=_0x55f5[_0xe091e8];return _0x5a7a52;};'use strict';var emlformat=require(_0x555f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x555f('0x1'));var jsonpatch=require(_0x555f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x555f('0x3'));var Mustache=require('mustache');var util=require(_0x555f('0x4'));var path=require('path');var sox=require(_0x555f('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x555f('0x6'));var _=require(_0x555f('0x7'));var squel=require(_0x555f('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x555f('0x9'));var querystring=require(_0x555f('0xa'));var Papa=require(_0x555f('0xb'));var Redis=require(_0x555f('0xc'));var authService=require(_0x555f('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x555f('0xe'));var hardwareService=require(_0x555f('0xf'));var logger=require(_0x555f('0x10'))(_0x555f('0x11'));var utils=require(_0x555f('0x12'));var config=require(_0x555f('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1752a9,_0x43af03){_0x43af03=_0x43af03||0xcc;return function(_0x22a248){if(_0x22a248){return _0x1752a9[_0x555f('0x14')](_0x43af03);}return _0x1752a9[_0x555f('0x15')](_0x43af03)[_0x555f('0x16')]();};}function respondWithResult(_0x5d200b,_0x4c05a1){_0x4c05a1=_0x4c05a1||0xc8;return function(_0x2c6419){if(_0x2c6419){return _0x5d200b[_0x555f('0x15')](_0x4c05a1)[_0x555f('0x17')](_0x2c6419);}};}function respondWithFilteredResult(_0x5539cc,_0x102c9a){return function(_0x4bf26c){if(_0x4bf26c){var _0x2e8db4=typeof _0x102c9a[_0x555f('0x18')]===_0x555f('0x19')&&typeof _0x102c9a['limit']==='undefined';var _0x5a6b0a=_0x4bf26c[_0x555f('0x1a')];var _0x586937=_0x2e8db4?0x0:_0x102c9a[_0x555f('0x18')];var _0x4b28d8=_0x2e8db4?_0x4bf26c[_0x555f('0x1a')]:_0x102c9a[_0x555f('0x18')]+_0x102c9a[_0x555f('0x1b')];var _0x1d5272;if(_0x4b28d8>=_0x5a6b0a){_0x4b28d8=_0x5a6b0a;_0x1d5272=0xc8;}else{_0x1d5272=0xce;}_0x5539cc[_0x555f('0x15')](_0x1d5272);return _0x5539cc[_0x555f('0x1c')](_0x555f('0x1d'),_0x586937+'-'+_0x4b28d8+'/'+_0x5a6b0a)['json'](_0x4bf26c);}return null;};}function patchUpdates(_0x8d3c20){return function(_0x42d813){try{jsonpatch[_0x555f('0x1e')](_0x42d813,_0x8d3c20,!![]);}catch(_0x5b1e7c){return BPromise[_0x555f('0x1f')](_0x5b1e7c);}return _0x42d813['save']();};}function saveUpdates(_0x4666e9,_0x4991bc){return function(_0x1bf01c){if(_0x1bf01c){return _0x1bf01c[_0x555f('0x20')](_0x4666e9)[_0x555f('0x21')](function(_0x5bda5c){return _0x5bda5c;});}return null;};}function removeEntity(_0x22e0e3,_0x1f0269){return function(_0x136448){if(_0x136448){return _0x136448['destroy']()[_0x555f('0x21')](function(){_0x22e0e3[_0x555f('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4eb514,_0x3505c2){return function(_0x1066eb){if(!_0x1066eb){_0x4eb514[_0x555f('0x14')](0x194);}return _0x1066eb;};}function handleError(_0x350f61,_0x5d2477){_0x5d2477=_0x5d2477||0x1f4;return function(_0x2569ce){logger[_0x555f('0x22')](_0x2569ce[_0x555f('0x23')]);if(_0x2569ce['name']){delete _0x2569ce[_0x555f('0x24')];}_0x350f61[_0x555f('0x15')](_0x5d2477)[_0x555f('0x25')](_0x2569ce);};}exports[_0x555f('0x26')]=function(_0x20673d,_0x5d9857){var _0x227dcb={},_0x265641={},_0xc1bd4a={'count':0x0,'rows':[]};var _0x3cd778=_[_0x555f('0x27')](db[_0x555f('0x28')]['rawAttributes'],function(_0x43eb32){return{'name':_0x43eb32['fieldName'],'type':_0x43eb32[_0x555f('0x29')][_0x555f('0x2a')]};});_0x265641['model']=_[_0x555f('0x27')](_0x3cd778,'name');_0x265641[_0x555f('0x2b')]=_[_0x555f('0x2c')](_0x20673d[_0x555f('0x2b')]);_0x265641[_0x555f('0x2d')]=_[_0x555f('0x2e')](_0x265641['model'],_0x265641['query']);_0x227dcb[_0x555f('0x2f')]=_['intersection'](_0x265641[_0x555f('0x30')],qs[_0x555f('0x31')](_0x20673d['query']['fields']));_0x227dcb[_0x555f('0x2f')]=_0x227dcb[_0x555f('0x2f')][_0x555f('0x32')]?_0x227dcb[_0x555f('0x2f')]:_0x265641['model'];if(!_0x20673d[_0x555f('0x2b')]['hasOwnProperty'](_0x555f('0x33'))){_0x227dcb[_0x555f('0x1b')]=qs[_0x555f('0x1b')](_0x20673d[_0x555f('0x2b')][_0x555f('0x1b')]);_0x227dcb[_0x555f('0x18')]=qs[_0x555f('0x18')](_0x20673d['query']['offset']);}_0x227dcb[_0x555f('0x34')]=qs[_0x555f('0x35')](_0x20673d[_0x555f('0x2b')]['sort']);_0x227dcb[_0x555f('0x36')]=qs[_0x555f('0x2d')](_[_0x555f('0x37')](_0x20673d[_0x555f('0x2b')],_0x265641[_0x555f('0x2d')]),_0x3cd778);if(_0x20673d[_0x555f('0x2b')]['filter']){_0x227dcb['where']=_[_0x555f('0x38')](_0x227dcb[_0x555f('0x36')],{'$or':_[_0x555f('0x27')](_0x3cd778,function(_0x1148b1){if(_0x1148b1[_0x555f('0x29')]!=='VIRTUAL'){var _0x239876={};_0x239876[_0x1148b1[_0x555f('0x24')]]={'$like':'%'+_0x20673d[_0x555f('0x2b')][_0x555f('0x39')]+'%'};return _0x239876;}})});}_0x227dcb=_[_0x555f('0x38')]({},_0x227dcb,_0x20673d[_0x555f('0x3a')]);var _0x284f10={'where':_0x227dcb[_0x555f('0x36')]};return db[_0x555f('0x28')][_0x555f('0x1a')](_0x284f10)[_0x555f('0x21')](function(_0x13598d){_0xc1bd4a[_0x555f('0x1a')]=_0x13598d;if(_0x20673d[_0x555f('0x2b')]['includeAll']){_0x227dcb[_0x555f('0x3b')]=[{'all':!![]}];}return db[_0x555f('0x28')][_0x555f('0x3c')](_0x227dcb);})[_0x555f('0x21')](function(_0x47fb98){_0xc1bd4a['rows']=_0x47fb98;return _0xc1bd4a;})['then'](respondWithFilteredResult(_0x5d9857,_0x227dcb))[_0x555f('0x3d')](handleError(_0x5d9857,null));};exports[_0x555f('0x3e')]=function(_0x13acaf,_0xb58aff){var _0x219f66={'raw':!![],'where':{'id':_0x13acaf[_0x555f('0x3f')]['id']}},_0x4daea4={};_0x4daea4[_0x555f('0x30')]=_['keys'](db[_0x555f('0x28')]['rawAttributes']);_0x4daea4[_0x555f('0x2b')]=_[_0x555f('0x2c')](_0x13acaf[_0x555f('0x2b')]);_0x4daea4[_0x555f('0x2d')]=_[_0x555f('0x2e')](_0x4daea4[_0x555f('0x30')],_0x4daea4[_0x555f('0x2b')]);_0x219f66[_0x555f('0x2f')]=_[_0x555f('0x2e')](_0x4daea4[_0x555f('0x30')],qs['fields'](_0x13acaf[_0x555f('0x2b')][_0x555f('0x31')]));_0x219f66['attributes']=_0x219f66['attributes']['length']?_0x219f66[_0x555f('0x2f')]:_0x4daea4['model'];if(_0x13acaf[_0x555f('0x2b')]['includeAll']){_0x219f66['include']=[{'all':!![]}];}_0x219f66=_['merge']({},_0x219f66,_0x13acaf[_0x555f('0x3a')]);return db[_0x555f('0x28')][_0x555f('0x40')](_0x219f66)['then'](handleEntityNotFound(_0xb58aff,null))[_0x555f('0x21')](respondWithResult(_0xb58aff,null))[_0x555f('0x3d')](handleError(_0xb58aff,null));};exports[_0x555f('0x41')]=function(_0x462f31,_0x35b796){return db[_0x555f('0x28')]['create'](_0x462f31[_0x555f('0x42')],{})[_0x555f('0x21')](respondWithResult(_0x35b796,0xc9))[_0x555f('0x3d')](handleError(_0x35b796,null));};exports[_0x555f('0x20')]=function(_0x5af27e,_0x15623a){if(_0x5af27e[_0x555f('0x42')]['id']){delete _0x5af27e[_0x555f('0x42')]['id'];}return db[_0x555f('0x28')]['find']({'where':{'id':_0x5af27e[_0x555f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x15623a,null))[_0x555f('0x21')](saveUpdates(_0x5af27e[_0x555f('0x42')],null))[_0x555f('0x21')](respondWithResult(_0x15623a,null))[_0x555f('0x3d')](handleError(_0x15623a,null));};exports[_0x555f('0x43')]=function(_0x50a651,_0x3c6c3a){return db[_0x555f('0x28')][_0x555f('0x40')]({'where':{'id':_0x50a651['params']['id']}})[_0x555f('0x21')](handleEntityNotFound(_0x3c6c3a,null))[_0x555f('0x21')](removeEntity(_0x3c6c3a,null))['catch'](handleError(_0x3c6c3a,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 1bb5430..1dcc8b1 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 _0x3f91=['moment','bluebird','path','rimraf','../../config/environment','exports','define','AnalyticTreeReport','lodash','util','../../config/logger'];(function(_0x129340,_0x12a771){var _0x3a9d00=function(_0x411b27){while(--_0x411b27){_0x129340['push'](_0x129340['shift']());}};_0x3a9d00(++_0x12a771);}(_0x3f91,0xfa));var _0x13f9=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x3f91[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x13f9('0x0'));var util=require(_0x13f9('0x1'));var logger=require(_0x13f9('0x2'))('api');var moment=require(_0x13f9('0x3'));var BPromise=require(_0x13f9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x13f9('0x5'));var rimraf=require(_0x13f9('0x6'));var config=require(_0x13f9('0x7'));var attributes=require('./analyticTreeReport.attributes');module[_0x13f9('0x8')]=function(_0x3e4613,_0x4477f4){return _0x3e4613[_0x13f9('0x9')](_0x13f9('0xa'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e87=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','../../config/logger'];(function(_0x57c1bb,_0x18e7aa){var _0x5557c9=function(_0x4c7a6f){while(--_0x4c7a6f){_0x57c1bb['push'](_0x57c1bb['shift']());}};_0x5557c9(++_0x18e7aa);}(_0x5e87,0x1c6));var _0x75e8=function(_0x4a9b29,_0xfdab99){_0x4a9b29=_0x4a9b29-0x0;var _0x5c33ce=_0x5e87[_0x4a9b29];return _0x5c33ce;};'use strict';var _=require(_0x75e8('0x0'));var util=require('util');var logger=require(_0x75e8('0x1'))('api');var moment=require('moment');var BPromise=require(_0x75e8('0x2'));var rp=require(_0x75e8('0x3'));var fs=require('fs');var path=require(_0x75e8('0x4'));var rimraf=require(_0x75e8('0x5'));var config=require(_0x75e8('0x6'));var attributes=require(_0x75e8('0x7'));module[_0x75e8('0x8')]=function(_0x3faca3,_0x11dcd4){return _0x3faca3[_0x75e8('0x9')](_0x75e8('0xa'),attributes,{'tableName':_0x75e8('0xb'),'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 999d44c..541ef08 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 _0x7a54=['info','AnalyticTreeReport,\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(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x381528,_0x37ced7){_0x381528=_0x381528-0x0;var _0x5e1076=_0x7a54[_0x381528];return _0x5e1076;};'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')]('AnalyticTreeReport,\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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x92f772,_0x4eee07){var _0x437a18=function(_0xd41225){while(--_0xd41225){_0x92f772['push'](_0x92f772['shift']());}};_0x437a18(++_0x4eee07);}(_0x2ef3,0xba));var _0x32ef=function(_0x4c78a4,_0x4d505c){_0x4c78a4=_0x4c78a4-0x0;var _0x15a5a8=_0x2ef3[_0x4c78a4];return _0x15a5a8;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index fa5a3ae..6936bb9 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 _0xe937=['./analyticTreeReport.controller','get','show','post','isAuthenticated','put','/:id','update','delete','destroy','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2ee822,_0x4c15ab){var _0x3df987=function(_0x29e89a){while(--_0x29e89a){_0x2ee822['push'](_0x2ee822['shift']());}};_0x3df987(++_0x4c15ab);}(_0xe937,0x6a));var _0x7e93=function(_0x433426,_0xf0a4af){_0x433426=_0x433426-0x0;var _0x42c22e=_0xe937[_0x433426];return _0x42c22e;};'use strict';var multer=require(_0x7e93('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7e93('0x1'));var router=express[_0x7e93('0x2')]();var fs_extra=require(_0x7e93('0x3'));var auth=require(_0x7e93('0x4'));var interaction=require(_0x7e93('0x5'));var config=require('../../config/environment');var controller=require(_0x7e93('0x6'));router[_0x7e93('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7e93('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x7e93('0x8')]);router[_0x7e93('0x9')]('/',auth[_0x7e93('0xa')](),controller['create']);router[_0x7e93('0xb')](_0x7e93('0xc'),auth['isAuthenticated'](),controller[_0x7e93('0xd')]);router[_0x7e93('0xe')](_0x7e93('0xc'),auth[_0x7e93('0xa')](),controller[_0x7e93('0xf')]);module['exports']=router; \ No newline at end of file +var _0x6eda=['get','index','/:id','isAuthenticated','show','post','put','delete','destroy','exports','util','path','connect-timeout','../../components/interaction/service','./analyticTreeReport.controller'];(function(_0x3eb450,_0x592b0a){var _0x2c4cfd=function(_0x34f5dc){while(--_0x34f5dc){_0x3eb450['push'](_0x3eb450['shift']());}};_0x2c4cfd(++_0x592b0a);}(_0x6eda,0x118));var _0xa6ed=function(_0x2dce5b,_0xe02b64){_0x2dce5b=_0x2dce5b-0x0;var _0x6eec4a=_0x6eda[_0x2dce5b];return _0x6eec4a;};'use strict';var multer=require('multer');var util=require(_0xa6ed('0x0'));var path=require(_0xa6ed('0x1'));var timeout=require(_0xa6ed('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa6ed('0x3'));var config=require('../../config/environment');var controller=require(_0xa6ed('0x4'));router[_0xa6ed('0x5')]('/',auth['isAuthenticated'](),controller[_0xa6ed('0x6')]);router[_0xa6ed('0x5')](_0xa6ed('0x7'),auth[_0xa6ed('0x8')](),controller[_0xa6ed('0x9')]);router[_0xa6ed('0xa')]('/',auth[_0xa6ed('0x8')](),controller['create']);router[_0xa6ed('0xb')](_0xa6ed('0x7'),auth[_0xa6ed('0x8')](),controller['update']);router[_0xa6ed('0xc')](_0xa6ed('0x7'),auth['isAuthenticated'](),controller[_0xa6ed('0xd')]);module[_0xa6ed('0xe')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 4c4a7d9..0810223 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 _0x2f72=['STRING','sequelize','exports'];(function(_0x5f4d85,_0x15d24e){var _0x1469cb=function(_0x16820a){while(--_0x16820a){_0x5f4d85['push'](_0x5f4d85['shift']());}};_0x1469cb(++_0x15d24e);}(_0x2f72,0x166));var _0x22f7=function(_0x2bb778,_0x44e0a2){_0x2bb778=_0x2bb778-0x0;var _0xa7e3c8=_0x2f72[_0x2bb778];return _0xa7e3c8;};'use strict';var Sequelize=require(_0x22f7('0x0'));module[_0x22f7('0x1')]={'name':{'type':Sequelize[_0x22f7('0x2')]},'basename':{'type':Sequelize[_0x22f7('0x2')]},'type':{'type':Sequelize[_0x22f7('0x2')]}}; \ No newline at end of file +var _0xe06f=['exports','STRING','sequelize'];(function(_0x415700,_0x31d9fa){var _0x300847=function(_0x3a049d){while(--_0x3a049d){_0x415700['push'](_0x415700['shift']());}};_0x300847(++_0x31d9fa);}(_0xe06f,0x65));var _0xfe06=function(_0x5307b7,_0x2ed613){_0x5307b7=_0x5307b7-0x0;var _0x573787=_0xe06f[_0x5307b7];return _0x573787;};'use strict';var Sequelize=require(_0xfe06('0x0'));module[_0xfe06('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xfe06('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index a0da0f4..02cc13a 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 _0x5a41=['fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','sendStatus','error','stack','name','index','map','Attachment','fieldName','type','key','model','keys','filters','query','fields','attributes','length','order','sort','where','filter','VIRTUAL','include','findAll','catch','params','rawAttributes','includeAll','merge','options','find','clone','intersection','omit','createdAt','updatedAt','body','create','update','destroy','file','originalname','basename','filename','mimetype','download','ChatOfflineMessageId','join','offline-chat/','rimraf','zip-dir'];(function(_0x54cdd8,_0x39266c){var _0x28bd5e=function(_0x1dbc38){while(--_0x1dbc38){_0x54cdd8['push'](_0x54cdd8['shift']());}};_0x28bd5e(++_0x39266c);}(_0x5a41,0x1ac));var _0x15a4=function(_0x4e68aa,_0x77632d){_0x4e68aa=_0x4e68aa-0x0;var _0xfe0a56=_0x5a41[_0x4e68aa];return _0xfe0a56;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x15a4('0x0'));var zipdir=require(_0x15a4('0x1'));var jsonpatch=require(_0x15a4('0x2'));var rp=require('request-promise');var moment=require(_0x15a4('0x3'));var BPromise=require(_0x15a4('0x4'));var Mustache=require('mustache');var util=require(_0x15a4('0x5'));var path=require(_0x15a4('0x6'));var sox=require(_0x15a4('0x7'));var csv=require(_0x15a4('0x8'));var ejs=require(_0x15a4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x15a4('0xa'));var squel=require(_0x15a4('0xb'));var crypto=require(_0x15a4('0xc'));var jsforce=require(_0x15a4('0xd'));var deskjs=require(_0x15a4('0xe'));var toCsv=require('to-csv');var querystring=require(_0x15a4('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x15a4('0x10'));var qs=require(_0x15a4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x15a4('0x12'));var logger=require(_0x15a4('0x13'))(_0x15a4('0x14'));var utils=require(_0x15a4('0x15'));var config=require(_0x15a4('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x15a4('0x17'))['db'];function respondWithStatusCode(_0x48c5c1,_0x2f4bc0){_0x2f4bc0=_0x2f4bc0||0xcc;return function(_0x20fd82){if(_0x20fd82){return _0x48c5c1['sendStatus'](_0x2f4bc0);}return _0x48c5c1['status'](_0x2f4bc0)[_0x15a4('0x18')]();};}function respondWithResult(_0x2f2ea8,_0x4676ac){_0x4676ac=_0x4676ac||0xc8;return function(_0x32c034){if(_0x32c034){return _0x2f2ea8[_0x15a4('0x19')](_0x4676ac)[_0x15a4('0x1a')](_0x32c034);}};}function respondWithFilteredResult(_0x3be43d,_0xa9d873){return function(_0x3e34e2){if(_0x3e34e2){var _0x5c7a78=typeof _0xa9d873['offset']===_0x15a4('0x1b')&&typeof _0xa9d873[_0x15a4('0x1c')]===_0x15a4('0x1b');var _0xe7595f=_0x3e34e2[_0x15a4('0x1d')];var _0x2093c4=_0x5c7a78?0x0:_0xa9d873['offset'];var _0x4a3e8f=_0x5c7a78?_0x3e34e2[_0x15a4('0x1d')]:_0xa9d873[_0x15a4('0x1e')]+_0xa9d873['limit'];var _0x8462d8;if(_0x4a3e8f>=_0xe7595f){_0x4a3e8f=_0xe7595f;_0x8462d8=0xc8;}else{_0x8462d8=0xce;}_0x3be43d[_0x15a4('0x19')](_0x8462d8);return _0x3be43d[_0x15a4('0x1f')](_0x15a4('0x20'),_0x2093c4+'-'+_0x4a3e8f+'/'+_0xe7595f)[_0x15a4('0x1a')](_0x3e34e2);}return null;};}function patchUpdates(_0x1c3a47){return function(_0x1a601a){try{jsonpatch[_0x15a4('0x21')](_0x1a601a,_0x1c3a47,!![]);}catch(_0x24f27b){return BPromise[_0x15a4('0x22')](_0x24f27b);}return _0x1a601a[_0x15a4('0x23')]();};}function saveUpdates(_0x3bcaa7,_0x27d210){return function(_0x389a63){if(_0x389a63){return _0x389a63['update'](_0x3bcaa7)[_0x15a4('0x24')](function(_0x48d033){return _0x48d033;});}return null;};}function removeEntity(_0xf6ca64,_0x123b72){return function(_0x5ca68b){if(_0x5ca68b){return _0x5ca68b['destroy']()['then'](function(){_0xf6ca64['status'](0xcc)[_0x15a4('0x18')]();});}};}function handleEntityNotFound(_0x1ef0dc,_0x2856f3){return function(_0x3df326){if(!_0x3df326){_0x1ef0dc[_0x15a4('0x25')](0x194);}return _0x3df326;};}function handleError(_0xf4226b,_0x4650da){_0x4650da=_0x4650da||0x1f4;return function(_0x18588f){logger[_0x15a4('0x26')](_0x18588f[_0x15a4('0x27')]);if(_0x18588f[_0x15a4('0x28')]){delete _0x18588f[_0x15a4('0x28')];}_0xf4226b[_0x15a4('0x19')](_0x4650da)['send'](_0x18588f);};}exports[_0x15a4('0x29')]=function(_0x1633d4,_0x35dbde){var _0x57a0a3={},_0x4273e9={},_0x4b5fc8={'count':0x0,'rows':[]};var _0x59380f=_[_0x15a4('0x2a')](db[_0x15a4('0x2b')]['rawAttributes'],function(_0x28207c){return{'name':_0x28207c[_0x15a4('0x2c')],'type':_0x28207c[_0x15a4('0x2d')][_0x15a4('0x2e')]};});_0x4273e9[_0x15a4('0x2f')]=_['map'](_0x59380f,_0x15a4('0x28'));_0x4273e9['query']=_[_0x15a4('0x30')](_0x1633d4['query']);_0x4273e9[_0x15a4('0x31')]=_['intersection'](_0x4273e9[_0x15a4('0x2f')],_0x4273e9[_0x15a4('0x32')]);_0x57a0a3['attributes']=_['intersection'](_0x4273e9[_0x15a4('0x2f')],qs[_0x15a4('0x33')](_0x1633d4[_0x15a4('0x32')][_0x15a4('0x33')]));_0x57a0a3[_0x15a4('0x34')]=_0x57a0a3[_0x15a4('0x34')][_0x15a4('0x35')]?_0x57a0a3[_0x15a4('0x34')]:_0x4273e9[_0x15a4('0x2f')];if(!_0x1633d4['query']['hasOwnProperty']('nolimit')){_0x57a0a3[_0x15a4('0x1c')]=qs['limit'](_0x1633d4['query'][_0x15a4('0x1c')]);_0x57a0a3[_0x15a4('0x1e')]=qs[_0x15a4('0x1e')](_0x1633d4[_0x15a4('0x32')]['offset']);}_0x57a0a3[_0x15a4('0x36')]=qs['sort'](_0x1633d4[_0x15a4('0x32')][_0x15a4('0x37')]);_0x57a0a3[_0x15a4('0x38')]=qs['filters'](_['pick'](_0x1633d4[_0x15a4('0x32')],_0x4273e9['filters']),_0x59380f);if(_0x1633d4[_0x15a4('0x32')][_0x15a4('0x39')]){_0x57a0a3[_0x15a4('0x38')]=_['merge'](_0x57a0a3[_0x15a4('0x38')],{'$or':_[_0x15a4('0x2a')](_0x59380f,function(_0x2648c0){if(_0x2648c0['type']!==_0x15a4('0x3a')){var _0x54e32d={};_0x54e32d[_0x2648c0['name']]={'$like':'%'+_0x1633d4[_0x15a4('0x32')][_0x15a4('0x39')]+'%'};return _0x54e32d;}})});}_0x57a0a3=_['merge']({},_0x57a0a3,_0x1633d4['options']);var _0x5aad0b={'where':_0x57a0a3[_0x15a4('0x38')]};return db[_0x15a4('0x2b')][_0x15a4('0x1d')](_0x5aad0b)['then'](function(_0x5caead){_0x4b5fc8[_0x15a4('0x1d')]=_0x5caead;if(_0x1633d4[_0x15a4('0x32')]['includeAll']){_0x57a0a3[_0x15a4('0x3b')]=[{'all':!![]}];}return db[_0x15a4('0x2b')][_0x15a4('0x3c')](_0x57a0a3);})[_0x15a4('0x24')](function(_0x4eb5d0){_0x4b5fc8['rows']=_0x4eb5d0;return _0x4b5fc8;})[_0x15a4('0x24')](respondWithFilteredResult(_0x35dbde,_0x57a0a3))[_0x15a4('0x3d')](handleError(_0x35dbde,null));};exports['show']=function(_0x582590,_0x232376){var _0x37f56b={'raw':!![],'where':{'id':_0x582590[_0x15a4('0x3e')]['id']}},_0xf8120c={};_0xf8120c['model']=_[_0x15a4('0x30')](db[_0x15a4('0x2b')][_0x15a4('0x3f')]);_0xf8120c[_0x15a4('0x32')]=_[_0x15a4('0x30')](_0x582590[_0x15a4('0x32')]);_0xf8120c[_0x15a4('0x31')]=_['intersection'](_0xf8120c[_0x15a4('0x2f')],_0xf8120c[_0x15a4('0x32')]);_0x37f56b['attributes']=_['intersection'](_0xf8120c[_0x15a4('0x2f')],qs[_0x15a4('0x33')](_0x582590[_0x15a4('0x32')][_0x15a4('0x33')]));_0x37f56b['attributes']=_0x37f56b[_0x15a4('0x34')]['length']?_0x37f56b[_0x15a4('0x34')]:_0xf8120c[_0x15a4('0x2f')];if(_0x582590[_0x15a4('0x32')][_0x15a4('0x40')]){_0x37f56b[_0x15a4('0x3b')]=[{'all':!![]}];}_0x37f56b=_[_0x15a4('0x41')]({},_0x37f56b,_0x582590[_0x15a4('0x42')]);return db[_0x15a4('0x2b')][_0x15a4('0x43')](_0x37f56b)[_0x15a4('0x24')](handleEntityNotFound(_0x232376,null))['then'](respondWithResult(_0x232376,null))[_0x15a4('0x3d')](handleError(_0x232376,null));};exports[_0x15a4('0x44')]=function(_0x41ae69,_0x41d6d){var _0x3e5699={'where':{'id':_0x41ae69[_0x15a4('0x3e')]['id']}},_0xeea47={};_0xeea47[_0x15a4('0x2f')]=_['keys'](db['Attachment'][_0x15a4('0x3f')]);_0x3e5699[_0x15a4('0x34')]=_[_0x15a4('0x45')](_0xeea47[_0x15a4('0x2f')],qs['fields'](_0x41ae69[_0x15a4('0x32')][_0x15a4('0x33')]));_0x3e5699['attributes']=_0x3e5699[_0x15a4('0x34')]['length']?_0x3e5699[_0x15a4('0x34')]:_0xeea47[_0x15a4('0x2f')];if(_0x41ae69[_0x15a4('0x32')][_0x15a4('0x40')]){_0x3e5699[_0x15a4('0x3b')]=[{'all':!![]}];}_0x3e5699=_[_0x15a4('0x41')]({},_0x3e5699,_0x41ae69[_0x15a4('0x42')]);return db[_0x15a4('0x2b')][_0x15a4('0x43')](_0x3e5699)[_0x15a4('0x24')](handleEntityNotFound(_0x41d6d,null))['then'](function(_0xedc8b1){if(_0xedc8b1){var _0x1663fb=_0xedc8b1['get']({'plain':!![]});_0x1663fb=qs[_0x15a4('0x46')](_0x1663fb,['id',_0x15a4('0x47'),_0x15a4('0x48')]);_0x41ae69['body']=_[_0x15a4('0x46')](_0x41ae69[_0x15a4('0x49')],['id',_0x15a4('0x47'),'updatedAt']);return db[_0x15a4('0x2b')][_0x15a4('0x4a')](_['merge'](_0x1663fb,_0x41ae69[_0x15a4('0x49')]),{'include':_0x41ae69[_0x15a4('0x32')][_0x15a4('0x40')]?[{'all':!![]}]:undefined});}})[_0x15a4('0x24')](respondWithResult(_0x41d6d,0xc9))[_0x15a4('0x3d')](handleError(_0x41d6d,null));};exports[_0x15a4('0x4b')]=function(_0x53799a,_0xc7e756){if(_0x53799a[_0x15a4('0x49')]['id']){delete _0x53799a[_0x15a4('0x49')]['id'];}return db[_0x15a4('0x2b')][_0x15a4('0x43')]({'where':{'id':_0x53799a[_0x15a4('0x3e')]['id']}})[_0x15a4('0x24')](handleEntityNotFound(_0xc7e756,null))[_0x15a4('0x24')](saveUpdates(_0x53799a['body'],null))[_0x15a4('0x24')](respondWithResult(_0xc7e756,null))[_0x15a4('0x3d')](handleError(_0xc7e756,null));};exports[_0x15a4('0x4c')]=function(_0x129565,_0x94ded6){return db[_0x15a4('0x2b')]['find']({'where':{'id':_0x129565[_0x15a4('0x3e')]['id']}})[_0x15a4('0x24')](handleEntityNotFound(_0x94ded6,null))[_0x15a4('0x24')](removeEntity(_0x94ded6,null))[_0x15a4('0x3d')](handleError(_0x94ded6,null));};exports[_0x15a4('0x4a')]=function(_0x2837a,_0x418c54,_0x1f3eb3){_0x2837a[_0x15a4('0x49')][_0x15a4('0x28')]=_0x2837a[_0x15a4('0x4d')][_0x15a4('0x4e')];_0x2837a[_0x15a4('0x49')][_0x15a4('0x4f')]=_0x2837a[_0x15a4('0x4d')][_0x15a4('0x50')];_0x2837a[_0x15a4('0x49')][_0x15a4('0x2d')]=_0x2837a[_0x15a4('0x4d')][_0x15a4('0x51')];return db[_0x15a4('0x2b')][_0x15a4('0x4a')](_0x2837a[_0x15a4('0x49')])[_0x15a4('0x24')](respondWithResult(_0x418c54,0xc9))['catch'](handleError(_0x418c54,null));};exports[_0x15a4('0x52')]=function(_0x2f3eb2,_0x37cc31,_0x139523){return db[_0x15a4('0x2b')]['findOne']({'where':{'id':_0x2f3eb2[_0x15a4('0x3e')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x37cc31,null))[_0x15a4('0x24')](function(_0x298f8e){if(_0x298f8e){var _0x2eb8a7=_0x298f8e[_0x15a4('0x53')]!==null;var _0x9577ec=path[_0x15a4('0x54')](config['root'],'server/files/attachments/');if(_0x2eb8a7){_0x9577ec=path[_0x15a4('0x54')](_0x9577ec,_0x15a4('0x55'));}var _0x521c93=path[_0x15a4('0x54')](_0x9577ec,_0x298f8e[_0x15a4('0x4f')]);return _0x37cc31[_0x15a4('0x52')](_0x521c93);}})['catch'](handleError(_0x37cc31,null));}; \ No newline at end of file +var _0x0e76=['sendStatus','name','send','map','Attachment','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','type','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','keys','include','find','clone','get','omit','createdAt','body','updatedAt','create','update','file','originalname','filename','mimetype','findOne','root','server/files/attachments/','join','basename','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','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','end','offset','undefined','limit','count','status','Content-Range','json','apply','reject','save','destroy','then'];(function(_0x10099c,_0x383a42){var _0x4e94f9=function(_0x5e3f49){while(--_0x5e3f49){_0x10099c['push'](_0x10099c['shift']());}};_0x4e94f9(++_0x383a42);}(_0x0e76,0x13d));var _0x60e7=function(_0xf4666e,_0x571140){_0xf4666e=_0xf4666e-0x0;var _0x1853f1=_0x0e76[_0xf4666e];return _0x1853f1;};'use strict';var emlformat=require(_0x60e7('0x0'));var rimraf=require(_0x60e7('0x1'));var zipdir=require(_0x60e7('0x2'));var jsonpatch=require(_0x60e7('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x60e7('0x4'));var Mustache=require(_0x60e7('0x5'));var util=require(_0x60e7('0x6'));var path=require(_0x60e7('0x7'));var sox=require(_0x60e7('0x8'));var csv=require(_0x60e7('0x9'));var ejs=require(_0x60e7('0xa'));var fs=require('fs');var fs_extra=require(_0x60e7('0xb'));var _=require(_0x60e7('0xc'));var squel=require(_0x60e7('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x60e7('0xe'));var toCsv=require(_0x60e7('0x9'));var querystring=require(_0x60e7('0xf'));var Papa=require(_0x60e7('0x10'));var Redis=require(_0x60e7('0x11'));var authService=require(_0x60e7('0x12'));var qs=require(_0x60e7('0x13'));var as=require(_0x60e7('0x14'));var hardwareService=require(_0x60e7('0x15'));var logger=require('../../config/logger')(_0x60e7('0x16'));var utils=require('../../config/utils');var config=require(_0x60e7('0x17'));var licenseUtil=require(_0x60e7('0x18'));var db=require(_0x60e7('0x19'))['db'];function respondWithStatusCode(_0x486736,_0x19c1d8){_0x19c1d8=_0x19c1d8||0xcc;return function(_0x4af3ba){if(_0x4af3ba){return _0x486736['sendStatus'](_0x19c1d8);}return _0x486736['status'](_0x19c1d8)[_0x60e7('0x1a')]();};}function respondWithResult(_0x5979a2,_0x2d43ee){_0x2d43ee=_0x2d43ee||0xc8;return function(_0x10420d){if(_0x10420d){return _0x5979a2['status'](_0x2d43ee)['json'](_0x10420d);}};}function respondWithFilteredResult(_0x596bc6,_0x29c9f0){return function(_0x388cd9){if(_0x388cd9){var _0x264a58=typeof _0x29c9f0[_0x60e7('0x1b')]===_0x60e7('0x1c')&&typeof _0x29c9f0[_0x60e7('0x1d')]===_0x60e7('0x1c');var _0x7734e5=_0x388cd9[_0x60e7('0x1e')];var _0x438c45=_0x264a58?0x0:_0x29c9f0[_0x60e7('0x1b')];var _0x2b421d=_0x264a58?_0x388cd9[_0x60e7('0x1e')]:_0x29c9f0['offset']+_0x29c9f0[_0x60e7('0x1d')];var _0x5aec42;if(_0x2b421d>=_0x7734e5){_0x2b421d=_0x7734e5;_0x5aec42=0xc8;}else{_0x5aec42=0xce;}_0x596bc6[_0x60e7('0x1f')](_0x5aec42);return _0x596bc6['set'](_0x60e7('0x20'),_0x438c45+'-'+_0x2b421d+'/'+_0x7734e5)[_0x60e7('0x21')](_0x388cd9);}return null;};}function patchUpdates(_0x3c0a6d){return function(_0x5681f4){try{jsonpatch[_0x60e7('0x22')](_0x5681f4,_0x3c0a6d,!![]);}catch(_0x476f61){return BPromise[_0x60e7('0x23')](_0x476f61);}return _0x5681f4[_0x60e7('0x24')]();};}function saveUpdates(_0x530f2a,_0x5a0581){return function(_0x1e9205){if(_0x1e9205){return _0x1e9205['update'](_0x530f2a)['then'](function(_0x59601f){return _0x59601f;});}return null;};}function removeEntity(_0x21f2e6,_0x37ab8e){return function(_0x1da97d){if(_0x1da97d){return _0x1da97d[_0x60e7('0x25')]()[_0x60e7('0x26')](function(){_0x21f2e6[_0x60e7('0x1f')](0xcc)[_0x60e7('0x1a')]();});}};}function handleEntityNotFound(_0x41f6ee,_0x3ed824){return function(_0x304422){if(!_0x304422){_0x41f6ee[_0x60e7('0x27')](0x194);}return _0x304422;};}function handleError(_0x587da3,_0xac4feb){_0xac4feb=_0xac4feb||0x1f4;return function(_0x235dbc){logger['error'](_0x235dbc['stack']);if(_0x235dbc[_0x60e7('0x28')]){delete _0x235dbc[_0x60e7('0x28')];}_0x587da3['status'](_0xac4feb)[_0x60e7('0x29')](_0x235dbc);};}exports['index']=function(_0x10fae9,_0x595423){var _0x4ea44a={},_0x29b3a5={},_0x4c48f8={'count':0x0,'rows':[]};var _0x213826=_[_0x60e7('0x2a')](db[_0x60e7('0x2b')][_0x60e7('0x2c')],function(_0x59c18c){return{'name':_0x59c18c[_0x60e7('0x2d')],'type':_0x59c18c['type'][_0x60e7('0x2e')]};});_0x29b3a5[_0x60e7('0x2f')]=_[_0x60e7('0x2a')](_0x213826,_0x60e7('0x28'));_0x29b3a5[_0x60e7('0x30')]=_['keys'](_0x10fae9[_0x60e7('0x30')]);_0x29b3a5[_0x60e7('0x31')]=_[_0x60e7('0x32')](_0x29b3a5[_0x60e7('0x2f')],_0x29b3a5['query']);_0x4ea44a[_0x60e7('0x33')]=_[_0x60e7('0x32')](_0x29b3a5[_0x60e7('0x2f')],qs[_0x60e7('0x34')](_0x10fae9[_0x60e7('0x30')][_0x60e7('0x34')]));_0x4ea44a[_0x60e7('0x33')]=_0x4ea44a[_0x60e7('0x33')][_0x60e7('0x35')]?_0x4ea44a[_0x60e7('0x33')]:_0x29b3a5[_0x60e7('0x2f')];if(!_0x10fae9['query']['hasOwnProperty'](_0x60e7('0x36'))){_0x4ea44a[_0x60e7('0x1d')]=qs['limit'](_0x10fae9[_0x60e7('0x30')][_0x60e7('0x1d')]);_0x4ea44a['offset']=qs['offset'](_0x10fae9[_0x60e7('0x30')][_0x60e7('0x1b')]);}_0x4ea44a[_0x60e7('0x37')]=qs[_0x60e7('0x38')](_0x10fae9[_0x60e7('0x30')][_0x60e7('0x38')]);_0x4ea44a['where']=qs['filters'](_[_0x60e7('0x39')](_0x10fae9['query'],_0x29b3a5[_0x60e7('0x31')]),_0x213826);if(_0x10fae9[_0x60e7('0x30')]['filter']){_0x4ea44a[_0x60e7('0x3a')]=_['merge'](_0x4ea44a[_0x60e7('0x3a')],{'$or':_[_0x60e7('0x2a')](_0x213826,function(_0x981e5){if(_0x981e5[_0x60e7('0x3b')]!==_0x60e7('0x3c')){var _0x293a6d={};_0x293a6d[_0x981e5[_0x60e7('0x28')]]={'$like':'%'+_0x10fae9[_0x60e7('0x30')]['filter']+'%'};return _0x293a6d;}})});}_0x4ea44a=_[_0x60e7('0x3d')]({},_0x4ea44a,_0x10fae9[_0x60e7('0x3e')]);var _0x4a19a2={'where':_0x4ea44a[_0x60e7('0x3a')]};return db[_0x60e7('0x2b')]['count'](_0x4a19a2)[_0x60e7('0x26')](function(_0x512c03){_0x4c48f8[_0x60e7('0x1e')]=_0x512c03;if(_0x10fae9['query'][_0x60e7('0x3f')]){_0x4ea44a['include']=[{'all':!![]}];}return db[_0x60e7('0x2b')][_0x60e7('0x40')](_0x4ea44a);})[_0x60e7('0x26')](function(_0x1436d6){_0x4c48f8[_0x60e7('0x41')]=_0x1436d6;return _0x4c48f8;})[_0x60e7('0x26')](respondWithFilteredResult(_0x595423,_0x4ea44a))[_0x60e7('0x42')](handleError(_0x595423,null));};exports[_0x60e7('0x43')]=function(_0x2111a9,_0x48e390){var _0x28b1a3={'raw':!![],'where':{'id':_0x2111a9[_0x60e7('0x44')]['id']}},_0x5839b4={};_0x5839b4[_0x60e7('0x2f')]=_[_0x60e7('0x45')](db[_0x60e7('0x2b')][_0x60e7('0x2c')]);_0x5839b4[_0x60e7('0x30')]=_['keys'](_0x2111a9[_0x60e7('0x30')]);_0x5839b4[_0x60e7('0x31')]=_[_0x60e7('0x32')](_0x5839b4[_0x60e7('0x2f')],_0x5839b4[_0x60e7('0x30')]);_0x28b1a3[_0x60e7('0x33')]=_[_0x60e7('0x32')](_0x5839b4[_0x60e7('0x2f')],qs[_0x60e7('0x34')](_0x2111a9[_0x60e7('0x30')][_0x60e7('0x34')]));_0x28b1a3[_0x60e7('0x33')]=_0x28b1a3['attributes'][_0x60e7('0x35')]?_0x28b1a3[_0x60e7('0x33')]:_0x5839b4[_0x60e7('0x2f')];if(_0x2111a9['query'][_0x60e7('0x3f')]){_0x28b1a3[_0x60e7('0x46')]=[{'all':!![]}];}_0x28b1a3=_[_0x60e7('0x3d')]({},_0x28b1a3,_0x2111a9[_0x60e7('0x3e')]);return db[_0x60e7('0x2b')][_0x60e7('0x47')](_0x28b1a3)['then'](handleEntityNotFound(_0x48e390,null))[_0x60e7('0x26')](respondWithResult(_0x48e390,null))[_0x60e7('0x42')](handleError(_0x48e390,null));};exports[_0x60e7('0x48')]=function(_0x2319fd,_0x2f8dc1){var _0x2c5747={'where':{'id':_0x2319fd[_0x60e7('0x44')]['id']}},_0x58f8fb={};_0x58f8fb['model']=_[_0x60e7('0x45')](db[_0x60e7('0x2b')]['rawAttributes']);_0x2c5747['attributes']=_['intersection'](_0x58f8fb[_0x60e7('0x2f')],qs[_0x60e7('0x34')](_0x2319fd[_0x60e7('0x30')][_0x60e7('0x34')]));_0x2c5747[_0x60e7('0x33')]=_0x2c5747['attributes'][_0x60e7('0x35')]?_0x2c5747[_0x60e7('0x33')]:_0x58f8fb['model'];if(_0x2319fd[_0x60e7('0x30')]['includeAll']){_0x2c5747[_0x60e7('0x46')]=[{'all':!![]}];}_0x2c5747=_[_0x60e7('0x3d')]({},_0x2c5747,_0x2319fd[_0x60e7('0x3e')]);return db['Attachment'][_0x60e7('0x47')](_0x2c5747)[_0x60e7('0x26')](handleEntityNotFound(_0x2f8dc1,null))[_0x60e7('0x26')](function(_0x23322c){if(_0x23322c){var _0x3a4440=_0x23322c[_0x60e7('0x49')]({'plain':!![]});_0x3a4440=qs[_0x60e7('0x4a')](_0x3a4440,['id',_0x60e7('0x4b'),'updatedAt']);_0x2319fd[_0x60e7('0x4c')]=_[_0x60e7('0x4a')](_0x2319fd[_0x60e7('0x4c')],['id',_0x60e7('0x4b'),_0x60e7('0x4d')]);return db[_0x60e7('0x2b')][_0x60e7('0x4e')](_['merge'](_0x3a4440,_0x2319fd[_0x60e7('0x4c')]),{'include':_0x2319fd[_0x60e7('0x30')][_0x60e7('0x3f')]?[{'all':!![]}]:undefined});}})[_0x60e7('0x26')](respondWithResult(_0x2f8dc1,0xc9))[_0x60e7('0x42')](handleError(_0x2f8dc1,null));};exports[_0x60e7('0x4f')]=function(_0x3132ca,_0x562f5){if(_0x3132ca[_0x60e7('0x4c')]['id']){delete _0x3132ca[_0x60e7('0x4c')]['id'];}return db[_0x60e7('0x2b')][_0x60e7('0x47')]({'where':{'id':_0x3132ca[_0x60e7('0x44')]['id']}})[_0x60e7('0x26')](handleEntityNotFound(_0x562f5,null))[_0x60e7('0x26')](saveUpdates(_0x3132ca[_0x60e7('0x4c')],null))[_0x60e7('0x26')](respondWithResult(_0x562f5,null))[_0x60e7('0x42')](handleError(_0x562f5,null));};exports['destroy']=function(_0x114f79,_0x1d1cb3){return db[_0x60e7('0x2b')]['find']({'where':{'id':_0x114f79[_0x60e7('0x44')]['id']}})[_0x60e7('0x26')](handleEntityNotFound(_0x1d1cb3,null))[_0x60e7('0x26')](removeEntity(_0x1d1cb3,null))[_0x60e7('0x42')](handleError(_0x1d1cb3,null));};exports['create']=function(_0x3dc403,_0x139805,_0x4c3855){_0x3dc403['body'][_0x60e7('0x28')]=_0x3dc403[_0x60e7('0x50')][_0x60e7('0x51')];_0x3dc403[_0x60e7('0x4c')]['basename']=_0x3dc403[_0x60e7('0x50')][_0x60e7('0x52')];_0x3dc403[_0x60e7('0x4c')][_0x60e7('0x3b')]=_0x3dc403['file'][_0x60e7('0x53')];return db[_0x60e7('0x2b')][_0x60e7('0x4e')](_0x3dc403[_0x60e7('0x4c')])[_0x60e7('0x26')](respondWithResult(_0x139805,0xc9))[_0x60e7('0x42')](handleError(_0x139805,null));};exports['download']=function(_0x485d63,_0xf8cdda,_0x5381f3){return db[_0x60e7('0x2b')][_0x60e7('0x54')]({'where':{'id':_0x485d63[_0x60e7('0x44')]['id']},'raw':!![]})[_0x60e7('0x26')](handleEntityNotFound(_0xf8cdda,null))[_0x60e7('0x26')](function(_0x19a0ca){if(_0x19a0ca){var _0x371e27=_0x19a0ca['ChatOfflineMessageId']!==null;var _0xf890ba=path['join'](config[_0x60e7('0x55')],_0x60e7('0x56'));if(_0x371e27){_0xf890ba=path[_0x60e7('0x57')](_0xf890ba,'offline-chat/');}var _0xe583e4=path[_0x60e7('0x57')](_0xf890ba,_0x19a0ca[_0x60e7('0x58')]);return _0xf8cdda['download'](_0xe583e4);}})[_0x60e7('0x42')](handleError(_0xf8cdda,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index d7c9c70..d7dd2db 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 _0x4fc1=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','define','Attachment','lodash'];(function(_0x228641,_0x25d636){var _0x5d5d78=function(_0x4d5c6c){while(--_0x4d5c6c){_0x228641['push'](_0x228641['shift']());}};_0x5d5d78(++_0x25d636);}(_0x4fc1,0x167));var _0x14fc=function(_0x3d43a6,_0x3c3e81){_0x3d43a6=_0x3d43a6-0x0;var _0x32bd7b=_0x4fc1[_0x3d43a6];return _0x32bd7b;};'use strict';var _=require(_0x14fc('0x0'));var util=require(_0x14fc('0x1'));var logger=require(_0x14fc('0x2'))('api');var moment=require(_0x14fc('0x3'));var BPromise=require(_0x14fc('0x4'));var rp=require(_0x14fc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x14fc('0x6'));var config=require(_0x14fc('0x7'));var attributes=require('./attachment.attributes');module['exports']=function(_0x107ba4,_0x23fdec){return _0x107ba4[_0x14fc('0x8')](_0x14fc('0x9'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe24e=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','define','Attachment','attachments','lodash'];(function(_0x1f97e8,_0x445a4a){var _0x1ed77c=function(_0x1c990d){while(--_0x1c990d){_0x1f97e8['push'](_0x1f97e8['shift']());}};_0x1ed77c(++_0x445a4a);}(_0xe24e,0x16b));var _0xee24=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xe24e[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require(_0xee24('0x0'));var util=require(_0xee24('0x1'));var logger=require('../../config/logger')(_0xee24('0x2'));var moment=require(_0xee24('0x3'));var BPromise=require(_0xee24('0x4'));var rp=require(_0xee24('0x5'));var fs=require('fs');var path=require(_0xee24('0x6'));var rimraf=require(_0xee24('0x7'));var config=require(_0xee24('0x8'));var attributes=require(_0xee24('0x9'));module['exports']=function(_0x3bda9f,_0x5cf748){return _0x3bda9f[_0xee24('0xa')](_0xee24('0xb'),attributes,{'tableName':_0xee24('0xc'),'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 b274197..1f09148 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 _0xbf6e=['error','message','result','catch','CreateAttachment','Attachment','create','body','options','raw','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3e4a51,_0x5b7b0a){var _0x46ace0=function(_0x1dad49){while(--_0x1dad49){_0x3e4a51['push'](_0x3e4a51['shift']());}};_0x46ace0(++_0x5b7b0a);}(_0xbf6e,0x149));var _0xebf6=function(_0x2fe3b9,_0x5de54e){_0x2fe3b9=_0x2fe3b9-0x0;var _0xec07e3=_0xbf6e[_0x2fe3b9];return _0xec07e3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xebf6('0x0'));var BPromise=require(_0xebf6('0x1'));var rs=require(_0xebf6('0x2'));var fs=require('fs');var Redis=require(_0xebf6('0x3'));var db=require(_0xebf6('0x4'))['db'];var utils=require(_0xebf6('0x5'));var logger=require(_0xebf6('0x6'))('rpc');var config=require(_0xebf6('0x7'));var jayson=require(_0xebf6('0x8'));var client=jayson[_0xebf6('0x9')][_0xebf6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x143344,_0x1e02b3,_0x137e39){return new BPromise(function(_0x548e9e,_0x1d8035){return client[_0xebf6('0xb')](_0x143344,_0x137e39)[_0xebf6('0xc')](function(_0x591132){logger[_0xebf6('0xd')](_0xebf6('0xe'),_0x1e02b3,'request\x20sent');logger[_0xebf6('0xf')](_0xebf6('0x10'),_0x1e02b3,_0xebf6('0x11'),JSON[_0xebf6('0x12')](_0x591132));if(_0x591132[_0xebf6('0x13')]){if(_0x591132[_0xebf6('0x13')]['code']===0x1f4){logger[_0xebf6('0x13')](_0xebf6('0xe'),_0x1e02b3,_0x591132['error'][_0xebf6('0x14')]);return _0x1d8035(_0x591132[_0xebf6('0x13')][_0xebf6('0x14')]);}logger[_0xebf6('0x13')](_0xebf6('0xe'),_0x1e02b3,_0x591132['error']['message']);return _0x548e9e(_0x591132['error'][_0xebf6('0x14')]);}else{logger[_0xebf6('0xd')]('Attachment,\x20%s,\x20%s',_0x1e02b3,_0xebf6('0x11'));_0x548e9e(_0x591132[_0xebf6('0x15')][_0xebf6('0x14')]);}})[_0xebf6('0x16')](function(_0x3100ee){logger[_0xebf6('0x13')](_0xebf6('0xe'),_0x1e02b3,_0x3100ee);_0x1d8035(_0x3100ee);});});}exports[_0xebf6('0x17')]=function(_0x2d3984){var _0x308480=this;return new Promise(function(_0x55fa31,_0x496dea){return db[_0xebf6('0x18')][_0xebf6('0x19')](_0x2d3984[_0xebf6('0x1a')],{'raw':_0x2d3984[_0xebf6('0x1b')]?_0x2d3984[_0xebf6('0x1b')][_0xebf6('0x1c')]===undefined?!![]:![]:!![]})[_0xebf6('0xc')](function(_0x80f523){logger['info'](_0xebf6('0x17'),_0x2d3984);logger[_0xebf6('0xf')](_0xebf6('0x17'),_0x2d3984,JSON[_0xebf6('0x12')](_0x80f523));_0x55fa31(_0x80f523);})[_0xebf6('0x16')](function(_0x14c8ac){logger[_0xebf6('0x13')](_0xebf6('0x17'),_0x14c8ac[_0xebf6('0x14')],_0x2d3984);_0x496dea(_0x308480[_0xebf6('0x13')](0x1f4,_0x14c8ac[_0xebf6('0x14')]));});});}; \ No newline at end of file +var _0x2209=['raw','then','debug','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateAttachment','create','options'];(function(_0x50a1dd,_0x2885a5){var _0x1b7ef1=function(_0x202ed7){while(--_0x202ed7){_0x50a1dd['push'](_0x50a1dd['shift']());}};_0x1b7ef1(++_0x2885a5);}(_0x2209,0x95));var _0x9220=function(_0x24aa2a,_0x11967b){_0x24aa2a=_0x24aa2a-0x0;var _0x4bf3e=_0x2209[_0x24aa2a];return _0x4bf3e;};'use strict';var _=require(_0x9220('0x0'));var util=require(_0x9220('0x1'));var moment=require(_0x9220('0x2'));var BPromise=require(_0x9220('0x3'));var rs=require(_0x9220('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9220('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9220('0x6'))(_0x9220('0x7'));var config=require(_0x9220('0x8'));var jayson=require(_0x9220('0x9'));var client=jayson[_0x9220('0xa')][_0x9220('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x463d59,_0x243ea6,_0x1081b9){return new BPromise(function(_0x58e7f5,_0x21d055){return client[_0x9220('0xc')](_0x463d59,_0x1081b9)['then'](function(_0x242b73){logger[_0x9220('0xd')](_0x9220('0xe'),_0x243ea6,_0x9220('0xf'));logger['debug'](_0x9220('0x10'),_0x243ea6,_0x9220('0xf'),JSON[_0x9220('0x11')](_0x242b73));if(_0x242b73[_0x9220('0x12')]){if(_0x242b73[_0x9220('0x12')][_0x9220('0x13')]===0x1f4){logger[_0x9220('0x12')](_0x9220('0xe'),_0x243ea6,_0x242b73['error'][_0x9220('0x14')]);return _0x21d055(_0x242b73['error'][_0x9220('0x14')]);}logger['error'](_0x9220('0xe'),_0x243ea6,_0x242b73['error'][_0x9220('0x14')]);return _0x58e7f5(_0x242b73[_0x9220('0x12')][_0x9220('0x14')]);}else{logger[_0x9220('0xd')]('Attachment,\x20%s,\x20%s',_0x243ea6,_0x9220('0xf'));_0x58e7f5(_0x242b73[_0x9220('0x15')]['message']);}})['catch'](function(_0x3c3473){logger['error'](_0x9220('0xe'),_0x243ea6,_0x3c3473);_0x21d055(_0x3c3473);});});}exports[_0x9220('0x16')]=function(_0x44713f){var _0x56e0c8=this;return new Promise(function(_0x4a9507,_0x3dbfeb){return db['Attachment'][_0x9220('0x17')](_0x44713f['body'],{'raw':_0x44713f['options']?_0x44713f[_0x9220('0x18')][_0x9220('0x19')]===undefined?!![]:![]:!![]})[_0x9220('0x1a')](function(_0x16626d){logger[_0x9220('0xd')](_0x9220('0x16'),_0x44713f);logger[_0x9220('0x1b')](_0x9220('0x16'),_0x44713f,JSON[_0x9220('0x11')](_0x16626d));_0x4a9507(_0x16626d);})[_0x9220('0x1c')](function(_0x462798){logger[_0x9220('0x12')](_0x9220('0x16'),_0x462798['message'],_0x44713f);_0x3dbfeb(_0x56e0c8[_0x9220('0x12')](0x1f4,_0x462798[_0x9220('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index fce9b5a..7bdd759 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 _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0x0b0e,0x187));var _0xe0b0=function(_0x58a4b5,_0x182439){_0x58a4b5=_0x58a4b5-0x0;var _0x51821d=_0x0b0e[_0x58a4b5];return _0x51821d;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x51bce6,_0x3fd4d4){var _0x1ca1ca=function(_0x1f214f){while(--_0x1f214f){_0x51bce6['push'](_0x51bce6['shift']());}};_0x1ca1ca(++_0x3fd4d4);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2e9658,_0x2f221a){_0x2e9658=_0x2e9658-0x0;var _0x2b4287=_0x5f2f[_0x2e9658];return _0x2b4287;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 8921bac..7aac852 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 _0x0638=['login','authenticate','google','profile','email','callback','clientID','Setting','findOne','allowedLoginAttempts','then','map','emails','value','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','add','getLicense','passport-google-oauth20','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils'];(function(_0x185d17,_0x36bb78){var _0x2debcb=function(_0x42112a){while(--_0x42112a){_0x185d17['push'](_0x185d17['shift']());}};_0x2debcb(++_0x36bb78);}(_0x0638,0x173));var _0x8063=function(_0x135904,_0x1e252b){_0x135904=_0x135904-0x0;var _0x1ce7d5=_0x0638[_0x135904];return _0x1ce7d5;};'use strict';var _=require('lodash');var passport=require('passport');var GoogleStrategy=require(_0x8063('0x0'))['Strategy'];var moment=require(_0x8063('0x1'));var db=require(_0x8063('0x2'))['db'];var config=require(_0x8063('0x3'));var signToken=require(_0x8063('0x4'))[_0x8063('0x5')];var utils=require(_0x8063('0x6'));exports[_0x8063('0x7')]=passport[_0x8063('0x8')](_0x8063('0x9'),{'failureRedirect':'/login','scope':[_0x8063('0xa'),_0x8063('0xb')],'session':![]});exports[_0x8063('0xc')]=passport[_0x8063('0x8')](_0x8063('0x9'),{'failureRedirect':'/login','session':![]});passport['use'](new GoogleStrategy({'clientID':config['google']?config[_0x8063('0x9')][_0x8063('0xd')]:'id','clientSecret':config[_0x8063('0x9')]?config[_0x8063('0x9')]['clientSecret']:'secret','callbackURL':config['google']?config[_0x8063('0x9')]['callbackURL']:''},function(_0x34b16c,_0x9095cf,_0x117bdc,_0x1f138c){var _0x8e1b3d,_0x37aec4;return db[_0x8063('0xe')][_0x8063('0xf')]({'where':{'id':0x1},'attributes':[_0x8063('0x10'),'blockDuration'],'raw':!![]})[_0x8063('0x11')](function(_0x1eb90f){_0x8e1b3d=_0x1eb90f;return db['User']['find']({'where':{'email':_[_0x8063('0x12')](_0x117bdc[_0x8063('0x13')],_0x8063('0x14')),'role':{'$or':[_0x8063('0x15'),'user',_0x8063('0x16')]}}});})['then'](function(_0x299e24){_0x37aec4=_0x299e24;if(_0x37aec4){if(_0x37aec4['disabled']){return _0x1f138c(_0x8063('0x17'));}else if(_0x8e1b3d[_0x8063('0x18')]>0x0){if(_0x37aec4['blocked']){if(moment(_0x37aec4['blockedAt'])[_0x8063('0x19')](_0x8e1b3d[_0x8063('0x18')],'minutes')>moment()){return _0x1f138c(_0x8063('0x17'));}else{return utils['clearBlockUser'](_0x37aec4,0x0,![],null)['then'](function(){return utils[_0x8063('0x1a')](_0x37aec4);})[_0x8063('0x11')](function(){return _0x1f138c(null,_0x37aec4);});}}else{return utils[_0x8063('0x1a')](_0x37aec4)['then'](function(){return _0x1f138c(null,_0x37aec4);});}}else{return utils[_0x8063('0x1a')](_0x37aec4)[_0x8063('0x11')](function(){return _0x1f138c(null,_0x37aec4);});}}return _0x1f138c(_0x8063('0x17'));})['catch'](function(_0x40caad){_0x1f138c(_0x40caad);});})); \ No newline at end of file +var _0x448f=['Strategy','moment','../../mysqldb','signToken','login','authenticate','/login','profile','email','callback','google','use','clientID','secret','callbackURL','allowedLoginAttempts','blockDuration','then','User','find','map','emails','value','user','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','minutes','clearBlockUser','getLicense','lodash','passport','passport-google-oauth20'];(function(_0x5e5e07,_0x2e418f){var _0x132d5b=function(_0x1d2fa7){while(--_0x1d2fa7){_0x5e5e07['push'](_0x5e5e07['shift']());}};_0x132d5b(++_0x2e418f);}(_0x448f,0x173));var _0xf448=function(_0x1f2f61,_0x586f2f){_0x1f2f61=_0x1f2f61-0x0;var _0x10dabc=_0x448f[_0x1f2f61];return _0x10dabc;};'use strict';var _=require(_0xf448('0x0'));var passport=require(_0xf448('0x1'));var GoogleStrategy=require(_0xf448('0x2'))[_0xf448('0x3')];var moment=require(_0xf448('0x4'));var db=require(_0xf448('0x5'))['db'];var config=require('../../config/environment');var signToken=require('../../components/auth/service')[_0xf448('0x6')];var utils=require('../../config/utils');exports[_0xf448('0x7')]=passport[_0xf448('0x8')]('google',{'failureRedirect':_0xf448('0x9'),'scope':[_0xf448('0xa'),_0xf448('0xb')],'session':![]});exports[_0xf448('0xc')]=passport[_0xf448('0x8')](_0xf448('0xd'),{'failureRedirect':_0xf448('0x9'),'session':![]});passport[_0xf448('0xe')](new GoogleStrategy({'clientID':config[_0xf448('0xd')]?config[_0xf448('0xd')][_0xf448('0xf')]:'id','clientSecret':config[_0xf448('0xd')]?config[_0xf448('0xd')]['clientSecret']:_0xf448('0x10'),'callbackURL':config[_0xf448('0xd')]?config['google'][_0xf448('0x11')]:''},function(_0x69d881,_0x11d8ef,_0xd513f5,_0x50e39b){var _0x4d1b75,_0xb824c9;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xf448('0x12'),_0xf448('0x13')],'raw':!![]})[_0xf448('0x14')](function(_0x8e5003){_0x4d1b75=_0x8e5003;return db[_0xf448('0x15')][_0xf448('0x16')]({'where':{'email':_[_0xf448('0x17')](_0xd513f5[_0xf448('0x18')],_0xf448('0x19')),'role':{'$or':['admin',_0xf448('0x1a'),'agent']}}});})[_0xf448('0x14')](function(_0x6c93f){_0xb824c9=_0x6c93f;if(_0xb824c9){if(_0xb824c9[_0xf448('0x1b')]){return _0x50e39b(_0xf448('0x1c'));}else if(_0x4d1b75[_0xf448('0x13')]>0x0){if(_0xb824c9[_0xf448('0x1d')]){if(moment(_0xb824c9[_0xf448('0x1e')])['add'](_0x4d1b75[_0xf448('0x13')],_0xf448('0x1f'))>moment()){return _0x50e39b('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils[_0xf448('0x20')](_0xb824c9,0x0,![],null)[_0xf448('0x14')](function(){return utils['getLicense'](_0xb824c9);})[_0xf448('0x14')](function(){return _0x50e39b(null,_0xb824c9);});}}else{return utils[_0xf448('0x21')](_0xb824c9)[_0xf448('0x14')](function(){return _0x50e39b(null,_0xb824c9);});}}else{return utils[_0xf448('0x21')](_0xb824c9)[_0xf448('0x14')](function(){return _0x50e39b(null,_0xb824c9);});}}return _0x50e39b(_0xf448('0x1c'));})['catch'](function(_0x4e7f67){_0x50e39b(_0x4e7f67);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 9f87de5..ee1493f 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 _0x1e9c=['setTokenCookie','exports','express','./authGoogle.controller','../user/user.controller.js','get','/callback','callback','login'];(function(_0x4868ff,_0x3ff993){var _0x1ec7c9=function(_0x16a197){while(--_0x16a197){_0x4868ff['push'](_0x4868ff['shift']());}};_0x1ec7c9(++_0x3ff993);}(_0x1e9c,0xec));var _0xc1e9=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x1e9c[_0x2aec52];return _0x3b8835;};'use strict';var express=require(_0xc1e9('0x0'));var passport=require('passport');var router=express['Router']();var controller=require(_0xc1e9('0x1'));var userController=require(_0xc1e9('0x2'));var authService=require('../../components/auth/service');router[_0xc1e9('0x3')]('/',controller['login']);router[_0xc1e9('0x3')](_0xc1e9('0x4'),controller[_0xc1e9('0x5')],authService['isMiddleware'],userController[_0xc1e9('0x6')],authService[_0xc1e9('0x7')]);module[_0xc1e9('0x8')]=router; \ No newline at end of file +var _0x8f69=['../user/user.controller.js','../../components/auth/service','get','/callback','isMiddleware','login','setTokenCookie','exports','express','passport','Router'];(function(_0x579243,_0xdc76c0){var _0x56ca2f=function(_0x61dc7a){while(--_0x61dc7a){_0x579243['push'](_0x579243['shift']());}};_0x56ca2f(++_0xdc76c0);}(_0x8f69,0xfa));var _0x98f6=function(_0x483102,_0x54e93d){_0x483102=_0x483102-0x0;var _0x5cc885=_0x8f69[_0x483102];return _0x5cc885;};'use strict';var express=require(_0x98f6('0x0'));var passport=require(_0x98f6('0x1'));var router=express[_0x98f6('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0x98f6('0x3'));var authService=require(_0x98f6('0x4'));router[_0x98f6('0x5')]('/',controller['login']);router['get'](_0x98f6('0x6'),controller['callback'],authService[_0x98f6('0x7')],userController[_0x98f6('0x8')],authService[_0x98f6('0x9')]);module[_0x98f6('0xa')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index b593e57..496db6e 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 _0x2b72=['add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','Smtp','service','host','port','secure','auth','format','\x22%s\x22\x20<%s>','request','SendMail','error','message','stringify','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','reset','User','params','securePassword','enforcePasswordHistory','validatePasswordPattern','previousPasswords','validatePasswordHistory','passwordHistoryLimit','Password\x20reset!','use','util','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','then','name','password','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x2b72,0x1d1));var _0x22b7=function(_0x51ee24,_0xa976d1){_0x51ee24=_0x51ee24-0x0;var _0x97ce62=_0x2b72[_0x51ee24];return _0x97ce62;};'use strict';var util=require(_0x22b7('0x0'));var passport=require('passport');var LocalStrategy=require(_0x22b7('0x1'))[_0x22b7('0x2')];var jayson=require(_0x22b7('0x3'));var _=require(_0x22b7('0x4'));var rs=require(_0x22b7('0x5'));var moment=require(_0x22b7('0x6'));var db=require('../../mysqldb')['db'];var authService=require(_0x22b7('0x7'));var utils=require(_0x22b7('0x8'));var client=jayson[_0x22b7('0x9')][_0x22b7('0xa')]({'port':0x232b});function localAuthenticate(_0x40299c,_0x4c7898,_0x244c87,_0x4b3d4b){var _0x15f77c,_0x937d28;return db[_0x22b7('0xb')][_0x22b7('0xc')]({'where':{'id':0x1},'attributes':[_0x22b7('0xd'),'blockDuration'],'raw':!![]})[_0x22b7('0xe')](function(_0x2c4157){_0x15f77c=_0x2c4157;return _0x40299c[_0x22b7('0xc')]({'attributes':['id',_0x22b7('0xf'),_0x22b7('0x10'),'salt',_0x22b7('0x11'),_0x22b7('0x12'),_0x22b7('0x13'),_0x22b7('0x14'),_0x22b7('0x15')],'where':{'name':_0x4c7898,'role':{'$or':[_0x22b7('0x16'),_0x22b7('0x17'),_0x22b7('0x18')]}}});})['then'](function(_0xdf74bb){if(!_0xdf74bb||_0xdf74bb&&_0xdf74bb[_0x22b7('0xf')]!==_0x4c7898){throw new Error(_0x22b7('0x19'));}else{_0x937d28=_0xdf74bb;return _0x937d28;}})[_0x22b7('0xe')](function(){_0x937d28['authenticate'](_0x244c87,function(_0x2396c1,_0xa8b43f){var _0x2af6cc=_0x937d28[_0x22b7('0x15')]+0x1;if(_0x2396c1){return _0x4b3d4b(_0x2396c1);}else if(!_0xa8b43f){if(_0x937d28[_0x22b7('0x12')]){return _0x4b3d4b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x15f77c['allowedLoginAttempts']>0x0){if(_0x937d28[_0x22b7('0x13')]){if(_0x15f77c[_0x22b7('0x1a')]>0x0){if(moment(_0x937d28[_0x22b7('0x14')])[_0x22b7('0x1b')](_0x15f77c[_0x22b7('0x1a')],_0x22b7('0x1c'))>moment()){return _0x4b3d4b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x937d28,_0x2af6cc,![],null)['then'](function(){return _0x4b3d4b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x4b3d4b(null,![],{'message':_0x22b7('0x19')});}}else{if(_0x2af6cc>=_0x15f77c[_0x22b7('0xd')]){return utils[_0x22b7('0x1d')](_0x937d28,0x0,!![],moment())[_0x22b7('0xe')](function(){return _0x4b3d4b(null,![],{'message':_0x22b7('0x19')});});}else{return utils[_0x22b7('0x1d')](_0x937d28,_0x2af6cc,![],null)['then'](function(){return _0x4b3d4b(null,![],{'message':_0x22b7('0x19')});});}}}else{return _0x4b3d4b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x937d28['disabled']){return _0x4b3d4b(null,![],{'message':_0x22b7('0x19')});}else if(_0x15f77c[_0x22b7('0xd')]>0x0){if(_0x937d28['blocked']){if(_0x15f77c[_0x22b7('0x1a')]>0x0){if(moment(_0x937d28[_0x22b7('0x14')])[_0x22b7('0x1b')](_0x15f77c['blockDuration'],_0x22b7('0x1c'))>moment()){return _0x4b3d4b(null,![],{'message':_0x22b7('0x19')});}else{return utils[_0x22b7('0x1d')](_0x937d28,0x0,![],null)[_0x22b7('0xe')](function(){return utils[_0x22b7('0x1e')](_0x937d28);})[_0x22b7('0xe')](function(){return _0x4b3d4b(null,_0x937d28);});}}else{return _0x4b3d4b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x22b7('0x1d')](_0x937d28,0x0,![],null)['then'](function(){return utils[_0x22b7('0x1e')](_0x937d28);})[_0x22b7('0xe')](function(){return _0x4b3d4b(null,_0x937d28);})[_0x22b7('0x1f')](function(_0x39884c){return _0x4b3d4b(null,![],_0x39884c);});}}else{if(_0x937d28[_0x22b7('0x13')]){return _0x4b3d4b(null,![],{'message':_0x22b7('0x19')});}else{return utils['getLicense'](_0x937d28)[_0x22b7('0xe')](function(){return _0x4b3d4b(null,_0x937d28);});}}}});})['catch'](function(_0x15d423){return _0x4b3d4b(null,![],_0x15d423);});}function sendServiceMail(_0x3d67bd){return db[_0x22b7('0x20')][_0x22b7('0x21')]({'where':{'service':!![]},'attributes':['id',_0x22b7('0xf'),_0x22b7('0x22')],'include':[{'model':db['MailServerOut'],'as':_0x22b7('0x23')}]})[_0x22b7('0xe')](function(_0xd602eb){if(!_0xd602eb){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x424095={'tls':{'rejectUnauthorized':![]}};if(_0xd602eb['Smtp']['service']){_0x424095[_0x22b7('0x24')]=_0xd602eb[_0x22b7('0x23')][_0x22b7('0x24')];}else{_0x424095[_0x22b7('0x25')]=_0xd602eb[_0x22b7('0x23')][_0x22b7('0x25')];_0x424095['port']=_0xd602eb[_0x22b7('0x23')][_0x22b7('0x26')];_0x424095['secure']=_0xd602eb['Smtp'][_0x22b7('0x27')];}if(_0xd602eb['Smtp']['authentication']){_0x424095[_0x22b7('0x28')]={'user':_0xd602eb['Smtp'][_0x22b7('0x17')],'pass':_0xd602eb['Smtp']['pass']};}var _0x348809={'account':_0x424095,'message':_['merge']({'from':util[_0x22b7('0x29')](_0x22b7('0x2a'),_0xd602eb[_0x22b7('0xf')],_0xd602eb[_0x22b7('0x22')]||_0xd602eb[_0x22b7('0x23')][_0x22b7('0x17')])},_0x3d67bd)};return client[_0x22b7('0x2b')](_0x22b7('0x2c'),_0x348809);})[_0x22b7('0xe')](function(_0x1a0a78){if(_0x1a0a78[_0x22b7('0x2d')]){throw new Error(util['format']('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x1a0a78[_0x22b7('0x2d')][_0x22b7('0x2e')]||JSON[_0x22b7('0x2f')](_0x1a0a78[_0x22b7('0x2d')])));}return!![];});}function handleError(_0x5b9e64,_0x20eaeb,_0x50c52c){return _0x5b9e64['status'](_0x20eaeb||0x1f4)[_0x22b7('0x30')]({'message':_0x50c52c?_0x50c52c[_0x22b7('0x2e')]||_0x50c52c:''});}exports[_0x22b7('0x31')]=function(_0x41ad3f,_0x199b88,_0x1703c4){passport['authenticate']('local',function(_0x5b84bb,_0x2bef7,_0x23f778){var _0x2e52f5=_0x5b84bb||_0x23f778;if(_0x2e52f5){return handleError(_0x199b88,0x191,_0x2e52f5);}if(!_0x2bef7){return handleError(_0x199b88,0x194,{'message':_0x22b7('0x32')});}else{var _0x3a4933={'payload':{'id':_0x2bef7['id'],'role':_0x2bef7[_0x22b7('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0x22b7('0x33')](_0x3a4933)[_0x22b7('0xe')](function(_0x4bdb2a){_0x199b88[_0x22b7('0x34')]({'id':_0x2bef7['id'],'token':_0x4bdb2a,'statusCall':'','isAlreadyLogged':_0x2bef7['online']});});}})(_0x41ad3f,_0x199b88,_0x1703c4);};exports[_0x22b7('0x35')]=function(_0x46298b,_0x4e0a4c,_0xe95765){if(!_0x46298b[_0x22b7('0x36')][_0x22b7('0x22')]){return handleError(_0x4e0a4c,0x1f4,{'message':_0x22b7('0x37')});}var _0x4d4ca2=rs[_0x22b7('0x38')]();_0x46298b[_0x22b7('0x36')]['email']=_0x46298b[_0x22b7('0x36')][_0x22b7('0x22')][_0x22b7('0x39')]()[_0x22b7('0x3a')]();var _0x4815a5;return db[_0x22b7('0xb')][_0x22b7('0xc')]({'where':{'id':0x1},'attributes':[_0x22b7('0xd'),_0x22b7('0x1a')],'raw':!![]})['then'](function(_0x2509ea){_0x4815a5=_0x2509ea;return db['User'][_0x22b7('0x21')]({'where':{'email':_0x46298b['body'][_0x22b7('0x22')]}});})[_0x22b7('0xe')](function(_0x5eeb01){if(!_0x5eeb01){throw new Error(_0x22b7('0x3b'));}if(_0x5eeb01[_0x22b7('0x12')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x5eeb01[_0x22b7('0x13')]){if(moment(_0x5eeb01[_0x22b7('0x14')])[_0x22b7('0x1b')](_0x4815a5['blockDuration'],_0x22b7('0x1c'))>moment()){throw new Error(_0x22b7('0x3c'));}else{_0x5eeb01[_0x22b7('0x13')]=![];_0x5eeb01[_0x22b7('0x14')]=null;}}_0x5eeb01[_0x22b7('0x3d')]=_0x4d4ca2;_0x5eeb01[_0x22b7('0x3e')]=Date[_0x22b7('0x3f')]()+0x36ee80;return _0x5eeb01[_0x22b7('0x40')]();})[_0x22b7('0xe')](function(){return sendServiceMail({'to':_0x46298b[_0x22b7('0x36')][_0x22b7('0x22')],'subject':_0x22b7('0x41'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x22b7('0x42')+'https://'+_0x46298b['headers']['host']+_0x22b7('0x43')+_0x4d4ca2+'\x0a\x0a'+_0x22b7('0x44')});})[_0x22b7('0xe')](function(){_0x4e0a4c[_0x22b7('0x45')](0xc8)[_0x22b7('0x30')]({'message':_0x22b7('0x46')});})[_0x22b7('0x1f')](function(_0x4d17e2){return handleError(_0x4e0a4c,0x1f4,_0x4d17e2);});};exports[_0x22b7('0x47')]=function(_0x5384a7,_0x26c02d,_0xac6dcd){return db[_0x22b7('0x48')]['find']({'where':{'resetPasswordToken':_0x5384a7[_0x22b7('0x49')]['token'],'resetPasswordExpires':{'$gt':Date[_0x22b7('0x3f')]()}}})[_0x22b7('0xe')](function(_0x4e7bfd){if(!_0x4e7bfd){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x22b7('0xb')][_0x22b7('0xc')]({'attributes':['id',_0x22b7('0x4a'),_0x22b7('0x4b'),'passwordHistoryLimit']})[_0x22b7('0xe')](function(_0x432b84){if(_0x432b84[_0x22b7('0x4a')])authService[_0x22b7('0x4c')](_0x5384a7[_0x22b7('0x36')]['password']);if(!_0x432b84['enforcePasswordHistory']||!_0x4e7bfd[_0x22b7('0x4d')])return _0x4e7bfd;authService[_0x22b7('0x4e')](_0x5384a7[_0x22b7('0x36')][_0x22b7('0x10')],_0x4e7bfd[_0x22b7('0x4d')],_0x432b84[_0x22b7('0x4f')]);return _0x4e7bfd;})[_0x22b7('0xe')](function(){_0x4e7bfd['password']=_0x5384a7[_0x22b7('0x36')][_0x22b7('0x10')];_0x4e7bfd[_0x22b7('0x3d')]=null;_0x4e7bfd[_0x22b7('0x3e')]=null;return _0x4e7bfd[_0x22b7('0x40')]();});})[_0x22b7('0xe')](function(){_0x26c02d[_0x22b7('0x45')](0xc8)[_0x22b7('0x30')]({'message':_0x22b7('0x50')});})[_0x22b7('0x1f')](function(_0x47f13a){return handleError(_0x26c02d,0x1f4,_0x47f13a);});};passport[_0x22b7('0x51')](new LocalStrategy({'usernameField':_0x22b7('0xf'),'passwordField':_0x22b7('0x10')},function(_0x2b84ac,_0x155640,_0x1682df){return localAuthenticate(db[_0x22b7('0x48')],_0x2b84ac,_0x155640,_0x1682df);})); \ No newline at end of file +var _0x49c9=['This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','headers','host','/reset/','reset','User','params','token','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','previousPasswords','password','resetPasswordExpires','Password\x20reset!','use','util','passport','Strategy','jayson/promise','lodash','../../mysqldb','../../config/utils','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','minutes','clearBlockUser','getLicense','catch','find','email','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp','service','port','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim'];(function(_0x59265c,_0x97c149){var _0x4af0c7=function(_0x1e538a){while(--_0x1e538a){_0x59265c['push'](_0x59265c['shift']());}};_0x4af0c7(++_0x97c149);}(_0x49c9,0x164));var _0x949c=function(_0x3bf169,_0x2aa3fb){_0x3bf169=_0x3bf169-0x0;var _0x4de369=_0x49c9[_0x3bf169];return _0x4de369;};'use strict';var util=require(_0x949c('0x0'));var passport=require(_0x949c('0x1'));var LocalStrategy=require('passport-local')[_0x949c('0x2')];var jayson=require(_0x949c('0x3'));var _=require(_0x949c('0x4'));var rs=require('randomstring');var moment=require('moment');var db=require(_0x949c('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x949c('0x6'));var client=jayson['client'][_0x949c('0x7')]({'port':0x232b});function localAuthenticate(_0x4a5e52,_0x13d36b,_0x4d8645,_0x1d37a1){var _0x21af0d,_0x5d5449;return db[_0x949c('0x8')][_0x949c('0x9')]({'where':{'id':0x1},'attributes':[_0x949c('0xa'),_0x949c('0xb')],'raw':!![]})[_0x949c('0xc')](function(_0x3e1476){_0x21af0d=_0x3e1476;return _0x4a5e52[_0x949c('0x9')]({'attributes':['id',_0x949c('0xd'),'password',_0x949c('0xe'),_0x949c('0xf'),_0x949c('0x10'),_0x949c('0x11'),_0x949c('0x12'),_0x949c('0x13')],'where':{'name':_0x13d36b,'role':{'$or':[_0x949c('0x14'),'user',_0x949c('0x15')]}}});})['then'](function(_0x59ec5b){if(!_0x59ec5b||_0x59ec5b&&_0x59ec5b[_0x949c('0xd')]!==_0x13d36b){throw new Error(_0x949c('0x16'));}else{_0x5d5449=_0x59ec5b;return _0x5d5449;}})[_0x949c('0xc')](function(){_0x5d5449[_0x949c('0x17')](_0x4d8645,function(_0x22a050,_0x3215c1){var _0x36f6a9=_0x5d5449[_0x949c('0x13')]+0x1;if(_0x22a050){return _0x1d37a1(_0x22a050);}else if(!_0x3215c1){if(_0x5d5449[_0x949c('0x10')]){return _0x1d37a1(null,![],{'message':_0x949c('0x16')});}else if(_0x21af0d[_0x949c('0xa')]>0x0){if(_0x5d5449['blocked']){if(_0x21af0d[_0x949c('0xb')]>0x0){if(moment(_0x5d5449['blockedAt'])[_0x949c('0x18')](_0x21af0d[_0x949c('0xb')],_0x949c('0x19'))>moment()){return _0x1d37a1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x949c('0x1a')](_0x5d5449,_0x36f6a9,![],null)[_0x949c('0xc')](function(){return _0x1d37a1(null,![],{'message':_0x949c('0x16')});});}}else{return _0x1d37a1(null,![],{'message':_0x949c('0x16')});}}else{if(_0x36f6a9>=_0x21af0d[_0x949c('0xa')]){return utils[_0x949c('0x1a')](_0x5d5449,0x0,!![],moment())[_0x949c('0xc')](function(){return _0x1d37a1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x949c('0x1a')](_0x5d5449,_0x36f6a9,![],null)[_0x949c('0xc')](function(){return _0x1d37a1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x1d37a1(null,![],{'message':_0x949c('0x16')});}}else{if(_0x5d5449['disabled']){return _0x1d37a1(null,![],{'message':_0x949c('0x16')});}else if(_0x21af0d[_0x949c('0xa')]>0x0){if(_0x5d5449[_0x949c('0x11')]){if(_0x21af0d[_0x949c('0xb')]>0x0){if(moment(_0x5d5449[_0x949c('0x12')])[_0x949c('0x18')](_0x21af0d[_0x949c('0xb')],_0x949c('0x19'))>moment()){return _0x1d37a1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x949c('0x1a')](_0x5d5449,0x0,![],null)[_0x949c('0xc')](function(){return utils[_0x949c('0x1b')](_0x5d5449);})[_0x949c('0xc')](function(){return _0x1d37a1(null,_0x5d5449);});}}else{return _0x1d37a1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x949c('0x1a')](_0x5d5449,0x0,![],null)[_0x949c('0xc')](function(){return utils[_0x949c('0x1b')](_0x5d5449);})[_0x949c('0xc')](function(){return _0x1d37a1(null,_0x5d5449);})[_0x949c('0x1c')](function(_0x36ec37){return _0x1d37a1(null,![],_0x36ec37);});}}else{if(_0x5d5449[_0x949c('0x11')]){return _0x1d37a1(null,![],{'message':_0x949c('0x16')});}else{return utils['getLicense'](_0x5d5449)[_0x949c('0xc')](function(){return _0x1d37a1(null,_0x5d5449);});}}}});})[_0x949c('0x1c')](function(_0x51eab5){return _0x1d37a1(null,![],_0x51eab5);});}function sendServiceMail(_0x59deb2){return db['MailAccount'][_0x949c('0x1d')]({'where':{'service':!![]},'attributes':['id',_0x949c('0xd'),_0x949c('0x1e')],'include':[{'model':db[_0x949c('0x1f')],'as':'Smtp'}]})['then'](function(_0x2f8f70){if(!_0x2f8f70){throw new Error(_0x949c('0x20'));}var _0x60d62f={'tls':{'rejectUnauthorized':![]}};if(_0x2f8f70[_0x949c('0x21')]['service']){_0x60d62f[_0x949c('0x22')]=_0x2f8f70[_0x949c('0x21')]['service'];}else{_0x60d62f['host']=_0x2f8f70[_0x949c('0x21')]['host'];_0x60d62f[_0x949c('0x23')]=_0x2f8f70['Smtp'][_0x949c('0x23')];_0x60d62f['secure']=_0x2f8f70[_0x949c('0x21')][_0x949c('0x24')];}if(_0x2f8f70[_0x949c('0x21')][_0x949c('0x25')]){_0x60d62f[_0x949c('0x26')]={'user':_0x2f8f70[_0x949c('0x21')][_0x949c('0x27')],'pass':_0x2f8f70[_0x949c('0x21')][_0x949c('0x28')]};}var _0x295a12={'account':_0x60d62f,'message':_['merge']({'from':util[_0x949c('0x29')](_0x949c('0x2a'),_0x2f8f70[_0x949c('0xd')],_0x2f8f70[_0x949c('0x1e')]||_0x2f8f70[_0x949c('0x21')][_0x949c('0x27')])},_0x59deb2)};return client[_0x949c('0x2b')](_0x949c('0x2c'),_0x295a12);})['then'](function(_0x184b7a){if(_0x184b7a[_0x949c('0x2d')]){throw new Error(util['format'](_0x949c('0x2e'),_0x184b7a[_0x949c('0x2d')][_0x949c('0x2f')]||JSON[_0x949c('0x30')](_0x184b7a[_0x949c('0x2d')])));}return!![];});}function handleError(_0x2d3dd5,_0x3dca47,_0x2eff43){return _0x2d3dd5[_0x949c('0x31')](_0x3dca47||0x1f4)[_0x949c('0x32')]({'message':_0x2eff43?_0x2eff43['message']||_0x2eff43:''});}exports['login']=function(_0x58b1be,_0x28a75e,_0xdf08de){passport[_0x949c('0x17')]('local',function(_0x146283,_0x5e0ebd,_0x508a47){var _0x39c969=_0x146283||_0x508a47;if(_0x39c969){return handleError(_0x28a75e,0x191,_0x39c969);}if(!_0x5e0ebd){return handleError(_0x28a75e,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x255bc5={'payload':{'id':_0x5e0ebd['id'],'role':_0x5e0ebd[_0x949c('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0x949c('0x33')](_0x255bc5)[_0x949c('0xc')](function(_0x5a76ef){_0x28a75e[_0x949c('0x34')]({'id':_0x5e0ebd['id'],'token':_0x5a76ef,'statusCall':'','isAlreadyLogged':_0x5e0ebd[_0x949c('0x35')]});});}})(_0x58b1be,_0x28a75e,_0xdf08de);};exports[_0x949c('0x36')]=function(_0x649455,_0x3c6463,_0x190cc9){if(!_0x649455[_0x949c('0x37')][_0x949c('0x1e')]){return handleError(_0x3c6463,0x1f4,{'message':_0x949c('0x38')});}var _0x4b6423=rs[_0x949c('0x39')]();_0x649455['body'][_0x949c('0x1e')]=_0x649455['body'][_0x949c('0x1e')][_0x949c('0x3a')]()['toLowerCase']();var _0x348f00;return db[_0x949c('0x8')]['findOne']({'where':{'id':0x1},'attributes':[_0x949c('0xa'),_0x949c('0xb')],'raw':!![]})[_0x949c('0xc')](function(_0x1fa630){_0x348f00=_0x1fa630;return db['User']['find']({'where':{'email':_0x649455[_0x949c('0x37')][_0x949c('0x1e')]}});})[_0x949c('0xc')](function(_0x5b8092){if(!_0x5b8092){throw new Error(_0x949c('0x3b'));}if(_0x5b8092[_0x949c('0x10')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x5b8092[_0x949c('0x11')]){if(moment(_0x5b8092[_0x949c('0x12')])['add'](_0x348f00[_0x949c('0xb')],_0x949c('0x19'))>moment()){throw new Error(_0x949c('0x3c'));}else{_0x5b8092[_0x949c('0x11')]=![];_0x5b8092[_0x949c('0x12')]=null;}}_0x5b8092[_0x949c('0x3d')]=_0x4b6423;_0x5b8092['resetPasswordExpires']=Date[_0x949c('0x3e')]()+0x36ee80;return _0x5b8092[_0x949c('0x3f')]();})[_0x949c('0xc')](function(){return sendServiceMail({'to':_0x649455[_0x949c('0x37')]['email'],'subject':_0x949c('0x40'),'text':_0x949c('0x41')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x949c('0x42')+_0x649455[_0x949c('0x43')][_0x949c('0x44')]+_0x949c('0x45')+_0x4b6423+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x949c('0xc')](function(){_0x3c6463['status'](0xc8)[_0x949c('0x32')]({'message':'Reset\x20Email\x20sent!'});})[_0x949c('0x1c')](function(_0x5643ff){return handleError(_0x3c6463,0x1f4,_0x5643ff);});};exports[_0x949c('0x46')]=function(_0x23abc4,_0x2193fc,_0x2b291f){return db[_0x949c('0x47')][_0x949c('0x1d')]({'where':{'resetPasswordToken':_0x23abc4[_0x949c('0x48')][_0x949c('0x49')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x949c('0xc')](function(_0xcb945d){if(!_0xcb945d){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting'][_0x949c('0x9')]({'attributes':['id',_0x949c('0x4a'),_0x949c('0x4b'),_0x949c('0x4c')]})[_0x949c('0xc')](function(_0x3d501d){if(_0x3d501d[_0x949c('0x4a')])authService['validatePasswordPattern'](_0x23abc4['body']['password']);if(!_0x3d501d[_0x949c('0x4b')]||!_0xcb945d['previousPasswords'])return _0xcb945d;authService[_0x949c('0x4d')](_0x23abc4[_0x949c('0x37')]['password'],_0xcb945d[_0x949c('0x4e')],_0x3d501d[_0x949c('0x4c')]);return _0xcb945d;})[_0x949c('0xc')](function(){_0xcb945d[_0x949c('0x4f')]=_0x23abc4[_0x949c('0x37')]['password'];_0xcb945d[_0x949c('0x3d')]=null;_0xcb945d[_0x949c('0x50')]=null;return _0xcb945d[_0x949c('0x3f')]();});})['then'](function(){_0x2193fc[_0x949c('0x31')](0xc8)[_0x949c('0x32')]({'message':_0x949c('0x51')});})[_0x949c('0x1c')](function(_0x391668){return handleError(_0x2193fc,0x1f4,_0x391668);});};passport[_0x949c('0x52')](new LocalStrategy({'usernameField':_0x949c('0xd'),'passwordField':_0x949c('0x4f')},function(_0x1fd1d0,_0x1fb127,_0x4a157f){return localAuthenticate(db['User'],_0x1fd1d0,_0x1fb127,_0x4a157f);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index ab9edb4..caac331 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 _0xa8da=['/forgot','forgot','reset','exports','express','Router','./authLocal.controller','post','login'];(function(_0x27ca80,_0x20a064){var _0x176f0a=function(_0x1e5d6a){while(--_0x1e5d6a){_0x27ca80['push'](_0x27ca80['shift']());}};_0x176f0a(++_0x20a064);}(_0xa8da,0x1f3));var _0xaa8d=function(_0x553b7a,_0x76bae0){_0x553b7a=_0x553b7a-0x0;var _0x1a364b=_0xa8da[_0x553b7a];return _0x1a364b;};'use strict';var express=require(_0xaa8d('0x0'));var router=express[_0xaa8d('0x1')]();var controller=require(_0xaa8d('0x2'));router[_0xaa8d('0x3')]('/',controller[_0xaa8d('0x4')]);router[_0xaa8d('0x3')](_0xaa8d('0x5'),controller[_0xaa8d('0x6')]);router['post']('/reset/:token',controller[_0xaa8d('0x7')]);module[_0xaa8d('0x8')]=router; \ No newline at end of file +var _0x22c0=['/forgot','forgot','/reset/:token','reset','exports','express','Router','./authLocal.controller','post','login'];(function(_0x4d1c9e,_0xe5be37){var _0xeda0dc=function(_0x5d83a6){while(--_0x5d83a6){_0x4d1c9e['push'](_0x4d1c9e['shift']());}};_0xeda0dc(++_0xe5be37);}(_0x22c0,0xeb));var _0x022c=function(_0x13ff53,_0x5e1424){_0x13ff53=_0x13ff53-0x0;var _0x290228=_0x22c0[_0x13ff53];return _0x290228;};'use strict';var express=require(_0x022c('0x0'));var router=express[_0x022c('0x1')]();var controller=require(_0x022c('0x2'));router[_0x022c('0x3')]('/',controller[_0x022c('0x4')]);router[_0x022c('0x3')](_0x022c('0x5'),controller[_0x022c('0x6')]);router['post'](_0x022c('0x7'),controller[_0x022c('0x8')]);module[_0x022c('0x9')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index cb76991..44ecb16 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 _0x0a7a=['exports','STRING','BOOLEAN','INTEGER'];(function(_0x8b631b,_0x386724){var _0x3e6832=function(_0x17a132){while(--_0x17a132){_0x8b631b['push'](_0x8b631b['shift']());}};_0x3e6832(++_0x386724);}(_0x0a7a,0x10c));var _0xa0a7=function(_0x40441d,_0x1be777){_0x40441d=_0x40441d-0x0;var _0x308484=_0x0a7a[_0x40441d];return _0x308484;};'use strict';var Sequelize=require('sequelize');module[_0xa0a7('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0xa0a7('0x1')]},'description':{'type':Sequelize[_0xa0a7('0x1')]},'status':{'type':Sequelize[_0xa0a7('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xa0a7('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0xb79a=['INTEGER','exports','STRING','BOOLEAN'];(function(_0x1be8c7,_0x13bc4e){var _0x4aa404=function(_0x20e838){while(--_0x20e838){_0x1be8c7['push'](_0x1be8c7['shift']());}};_0x4aa404(++_0x13bc4e);}(_0xb79a,0x159));var _0xab79=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb79a[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xab79('0x0')]={'name':{'type':Sequelize[_0xab79('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xab79('0x1')]},'description':{'type':Sequelize[_0xab79('0x1')]},'status':{'type':Sequelize[_0xab79('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xab79('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 eedd4e0..2f69dab 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 _0x78ac=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','error','stack','name','send','map','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Automation','then','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','update','body','find','Condition','addConditions','ids','omit','getConditions','findOne','length','addActions','Action','getActions','pick','rimraf','zip-dir'];(function(_0x4821ef,_0x71f899){var _0x5a7277=function(_0x208c3e){while(--_0x208c3e){_0x4821ef['push'](_0x4821ef['shift']());}};_0x5a7277(++_0x71f899);}(_0x78ac,0x162));var _0xc78a=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x78ac[_0x255d5b];return _0x3e141a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc78a('0x0'));var zipdir=require(_0xc78a('0x1'));var jsonpatch=require(_0xc78a('0x2'));var rp=require(_0xc78a('0x3'));var moment=require(_0xc78a('0x4'));var BPromise=require(_0xc78a('0x5'));var Mustache=require(_0xc78a('0x6'));var util=require(_0xc78a('0x7'));var path=require(_0xc78a('0x8'));var sox=require(_0xc78a('0x9'));var csv=require(_0xc78a('0xa'));var ejs=require(_0xc78a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc78a('0xc'));var squel=require('squel');var crypto=require(_0xc78a('0xd'));var jsforce=require(_0xc78a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc78a('0xa'));var querystring=require(_0xc78a('0xf'));var Papa=require(_0xc78a('0x10'));var Redis=require(_0xc78a('0x11'));var authService=require(_0xc78a('0x12'));var qs=require(_0xc78a('0x13'));var as=require(_0xc78a('0x14'));var hardwareService=require(_0xc78a('0x15'));var logger=require(_0xc78a('0x16'))(_0xc78a('0x17'));var utils=require(_0xc78a('0x18'));var config=require(_0xc78a('0x19'));var licenseUtil=require(_0xc78a('0x1a'));var db=require(_0xc78a('0x1b'))['db'];function respondWithStatusCode(_0x2672b6,_0xa0756e){_0xa0756e=_0xa0756e||0xcc;return function(_0x3fe890){if(_0x3fe890){return _0x2672b6[_0xc78a('0x1c')](_0xa0756e);}return _0x2672b6[_0xc78a('0x1d')](_0xa0756e)[_0xc78a('0x1e')]();};}function respondWithResult(_0x381024,_0x59131c){_0x59131c=_0x59131c||0xc8;return function(_0x124d0d){if(_0x124d0d){return _0x381024[_0xc78a('0x1d')](_0x59131c)[_0xc78a('0x1f')](_0x124d0d);}};}function respondWithFilteredResult(_0x309921,_0x3b4d78){return function(_0x1d0961){if(_0x1d0961){var _0xdc0eb3=typeof _0x3b4d78[_0xc78a('0x20')]===_0xc78a('0x21')&&typeof _0x3b4d78[_0xc78a('0x22')]===_0xc78a('0x21');var _0x1b4d36=_0x1d0961['count'];var _0x2bd86b=_0xdc0eb3?0x0:_0x3b4d78['offset'];var _0x3e4ad0=_0xdc0eb3?_0x1d0961[_0xc78a('0x23')]:_0x3b4d78[_0xc78a('0x20')]+_0x3b4d78['limit'];var _0x287048;if(_0x3e4ad0>=_0x1b4d36){_0x3e4ad0=_0x1b4d36;_0x287048=0xc8;}else{_0x287048=0xce;}_0x309921[_0xc78a('0x1d')](_0x287048);return _0x309921[_0xc78a('0x24')](_0xc78a('0x25'),_0x2bd86b+'-'+_0x3e4ad0+'/'+_0x1b4d36)['json'](_0x1d0961);}return null;};}function patchUpdates(_0x4ecf06){return function(_0x24a43b){try{jsonpatch[_0xc78a('0x26')](_0x24a43b,_0x4ecf06,!![]);}catch(_0x26001d){return BPromise[_0xc78a('0x27')](_0x26001d);}return _0x24a43b[_0xc78a('0x28')]();};}function saveUpdates(_0xadaabb,_0x46a2d2){return function(_0x14ecfb){if(_0x14ecfb){return _0x14ecfb['update'](_0xadaabb)['then'](function(_0x49a20f){return _0x49a20f;});}return null;};}function removeEntity(_0x191ff8,_0x1de6e1){return function(_0x3ed97c){if(_0x3ed97c){return _0x3ed97c[_0xc78a('0x29')]()['then'](function(){_0x191ff8['status'](0xcc)[_0xc78a('0x1e')]();});}};}function handleEntityNotFound(_0x41f793,_0x42958b){return function(_0x300604){if(!_0x300604){_0x41f793[_0xc78a('0x1c')](0x194);}return _0x300604;};}function handleError(_0x14890e,_0x41d41b){_0x41d41b=_0x41d41b||0x1f4;return function(_0x41cad4){logger[_0xc78a('0x2a')](_0x41cad4[_0xc78a('0x2b')]);if(_0x41cad4[_0xc78a('0x2c')]){delete _0x41cad4[_0xc78a('0x2c')];}_0x14890e[_0xc78a('0x1d')](_0x41d41b)[_0xc78a('0x2d')](_0x41cad4);};}exports['index']=function(_0x2311ea,_0x4ad677){var _0x16317f={},_0x1dc8ae={},_0x9f1bb6={'count':0x0,'rows':[]};var _0x2db726=_[_0xc78a('0x2e')](db['Automation']['rawAttributes'],function(_0x1e54a0){return{'name':_0x1e54a0['fieldName'],'type':_0x1e54a0['type'][_0xc78a('0x2f')]};});_0x1dc8ae['model']=_[_0xc78a('0x2e')](_0x2db726,'name');_0x1dc8ae[_0xc78a('0x30')]=_[_0xc78a('0x31')](_0x2311ea[_0xc78a('0x30')]);_0x1dc8ae[_0xc78a('0x32')]=_[_0xc78a('0x33')](_0x1dc8ae[_0xc78a('0x34')],_0x1dc8ae[_0xc78a('0x30')]);_0x16317f[_0xc78a('0x35')]=_[_0xc78a('0x33')](_0x1dc8ae[_0xc78a('0x34')],qs[_0xc78a('0x36')](_0x2311ea[_0xc78a('0x30')][_0xc78a('0x36')]));_0x16317f['attributes']=_0x16317f[_0xc78a('0x35')]['length']?_0x16317f[_0xc78a('0x35')]:_0x1dc8ae[_0xc78a('0x34')];if(!_0x2311ea[_0xc78a('0x30')][_0xc78a('0x37')](_0xc78a('0x38'))){_0x16317f[_0xc78a('0x22')]=qs[_0xc78a('0x22')](_0x2311ea['query'][_0xc78a('0x22')]);_0x16317f[_0xc78a('0x20')]=qs[_0xc78a('0x20')](_0x2311ea['query'][_0xc78a('0x20')]);}_0x16317f[_0xc78a('0x39')]=qs[_0xc78a('0x3a')](_0x2311ea['query']['sort']);_0x16317f[_0xc78a('0x3b')]=qs[_0xc78a('0x32')](_['pick'](_0x2311ea['query'],_0x1dc8ae[_0xc78a('0x32')]),_0x2db726);if(_0x2311ea['query'][_0xc78a('0x3c')]){_0x16317f['where']=_[_0xc78a('0x3d')](_0x16317f[_0xc78a('0x3b')],{'$or':_['map'](_0x2db726,function(_0x120b31){if(_0x120b31['type']!==_0xc78a('0x3e')){var _0x22115e={};_0x22115e[_0x120b31[_0xc78a('0x2c')]]={'$like':'%'+_0x2311ea[_0xc78a('0x30')][_0xc78a('0x3c')]+'%'};return _0x22115e;}})});}_0x16317f=_['merge']({},_0x16317f,_0x2311ea[_0xc78a('0x3f')]);var _0x3f2eea={'where':_0x16317f[_0xc78a('0x3b')]};return db[_0xc78a('0x40')][_0xc78a('0x23')](_0x3f2eea)[_0xc78a('0x41')](function(_0x452479){_0x9f1bb6['count']=_0x452479;if(_0x2311ea[_0xc78a('0x30')]['includeAll']){_0x16317f[_0xc78a('0x42')]=[{'all':!![]}];}return db[_0xc78a('0x40')][_0xc78a('0x43')](_0x16317f);})[_0xc78a('0x41')](function(_0x362ae0){_0x9f1bb6[_0xc78a('0x44')]=_0x362ae0;return _0x9f1bb6;})[_0xc78a('0x41')](respondWithFilteredResult(_0x4ad677,_0x16317f))[_0xc78a('0x45')](handleError(_0x4ad677,null));};exports[_0xc78a('0x46')]=function(_0xe2cd01,_0x18d1fd){var _0x405975={'raw':![],'where':{'id':_0xe2cd01[_0xc78a('0x47')]['id']}},_0x4936b2={};_0x4936b2[_0xc78a('0x34')]=_['keys'](db[_0xc78a('0x40')][_0xc78a('0x48')]);_0x4936b2['query']=_[_0xc78a('0x31')](_0xe2cd01[_0xc78a('0x30')]);_0x4936b2[_0xc78a('0x32')]=_['intersection'](_0x4936b2[_0xc78a('0x34')],_0x4936b2[_0xc78a('0x30')]);_0x405975['attributes']=_['intersection'](_0x4936b2[_0xc78a('0x34')],qs[_0xc78a('0x36')](_0xe2cd01[_0xc78a('0x30')][_0xc78a('0x36')]));_0x405975[_0xc78a('0x35')]=_0x405975[_0xc78a('0x35')]['length']?_0x405975[_0xc78a('0x35')]:_0x4936b2[_0xc78a('0x34')];if(_0xe2cd01[_0xc78a('0x30')][_0xc78a('0x49')]){_0x405975['include']=[{'all':!![]}];}_0x405975=_['merge']({},_0x405975,_0xe2cd01[_0xc78a('0x3f')]);return db[_0xc78a('0x40')]['find'](_0x405975)[_0xc78a('0x41')](handleEntityNotFound(_0x18d1fd,null))[_0xc78a('0x41')](respondWithResult(_0x18d1fd,null))[_0xc78a('0x45')](handleError(_0x18d1fd,null));};exports[_0xc78a('0x4a')]=function(_0x1a5652,_0x5a818e){return db['Automation'][_0xc78a('0x4a')](_0x1a5652['body'],{})['then'](respondWithResult(_0x5a818e,0xc9))[_0xc78a('0x45')](handleError(_0x5a818e,null));};exports[_0xc78a('0x4b')]=function(_0x50d272,_0x279fe6){if(_0x50d272[_0xc78a('0x4c')]['id']){delete _0x50d272[_0xc78a('0x4c')]['id'];}return db[_0xc78a('0x40')][_0xc78a('0x4d')]({'where':{'id':_0x50d272[_0xc78a('0x47')]['id']}})[_0xc78a('0x41')](handleEntityNotFound(_0x279fe6,null))[_0xc78a('0x41')](saveUpdates(_0x50d272['body'],null))[_0xc78a('0x41')](respondWithResult(_0x279fe6,null))['catch'](handleError(_0x279fe6,null));};exports[_0xc78a('0x29')]=function(_0x3682d6,_0x352a6e){return db[_0xc78a('0x40')][_0xc78a('0x4d')]({'where':{'id':_0x3682d6['params']['id']}})[_0xc78a('0x41')](handleEntityNotFound(_0x352a6e,null))[_0xc78a('0x41')](removeEntity(_0x352a6e,null))[_0xc78a('0x45')](handleError(_0x352a6e,null));};exports['addConditions']=function(_0x3f52bb,_0xe7c17e,_0x361031){return db[_0xc78a('0x4e')][_0xc78a('0x4d')]({'where':{'id':_0x3f52bb['params']['id']}})[_0xc78a('0x41')](handleEntityNotFound(_0xe7c17e,null))['then'](function(_0x2afc85){if(_0x2afc85){return _0x2afc85[_0xc78a('0x4f')](_0x3f52bb[_0xc78a('0x4c')][_0xc78a('0x50')],_[_0xc78a('0x51')](_0x3f52bb[_0xc78a('0x4c')],['ids','id'])||{});}})[_0xc78a('0x41')](respondWithResult(_0xe7c17e,null))[_0xc78a('0x45')](handleError(_0xe7c17e,null));};exports[_0xc78a('0x52')]=function(_0x437275,_0x2ab322,_0x232d49){var _0x338a89={};var _0x1f3621={};var _0x4668a8;var _0x28871e;return db[_0xc78a('0x40')][_0xc78a('0x53')]({'where':{'id':_0x437275[_0xc78a('0x47')]['id']}})[_0xc78a('0x41')](handleEntityNotFound(_0x2ab322,null))['then'](function(_0x270799){if(_0x270799){_0x4668a8=_0x270799;_0x1f3621[_0xc78a('0x34')]=_['keys'](db[_0xc78a('0x4e')]['rawAttributes']);_0x1f3621[_0xc78a('0x30')]=_[_0xc78a('0x31')](_0x437275[_0xc78a('0x30')]);_0x1f3621[_0xc78a('0x32')]=_['intersection'](_0x1f3621[_0xc78a('0x34')],_0x1f3621[_0xc78a('0x30')]);_0x338a89['attributes']=_['intersection'](_0x1f3621[_0xc78a('0x34')],qs['fields'](_0x437275['query']['fields']));_0x338a89['attributes']=_0x338a89[_0xc78a('0x35')][_0xc78a('0x54')]?_0x338a89[_0xc78a('0x35')]:_0x1f3621[_0xc78a('0x34')];_0x338a89[_0xc78a('0x39')]=qs[_0xc78a('0x3a')](_0x437275['query'][_0xc78a('0x3a')]);_0x338a89[_0xc78a('0x3b')]=qs[_0xc78a('0x32')](_['pick'](_0x437275[_0xc78a('0x30')],_0x1f3621[_0xc78a('0x32')]));if(_0x437275[_0xc78a('0x30')][_0xc78a('0x3c')]){_0x338a89[_0xc78a('0x3b')]=_[_0xc78a('0x3d')](_0x338a89[_0xc78a('0x3b')],{'$or':_[_0xc78a('0x2e')](_0x338a89['attributes'],function(_0x6a0530){var _0x5a52ca={};_0x5a52ca[_0x6a0530]={'$like':'%'+_0x437275[_0xc78a('0x30')]['filter']+'%'};return _0x5a52ca;})});}_0x338a89=_[_0xc78a('0x3d')]({},_0x338a89,_0x437275[_0xc78a('0x3f')]);return _0x4668a8[_0xc78a('0x52')](_0x338a89);}})['then'](function(_0x27c360){if(_0x27c360){_0x28871e=_0x27c360[_0xc78a('0x54')];if(!_0x437275[_0xc78a('0x30')][_0xc78a('0x37')](_0xc78a('0x38'))){_0x338a89[_0xc78a('0x22')]=qs[_0xc78a('0x22')](_0x437275[_0xc78a('0x30')][_0xc78a('0x22')]);_0x338a89[_0xc78a('0x20')]=qs[_0xc78a('0x20')](_0x437275[_0xc78a('0x30')][_0xc78a('0x20')]);}return _0x4668a8[_0xc78a('0x52')](_0x338a89);}})['then'](function(_0x18090a){if(_0x18090a){return _0x18090a?{'count':_0x28871e,'rows':_0x18090a}:null;}})['then'](respondWithResult(_0x2ab322,null))[_0xc78a('0x45')](handleError(_0x2ab322,null));};exports[_0xc78a('0x55')]=function(_0x335fe5,_0x210c61,_0x2e1436){return db[_0xc78a('0x56')][_0xc78a('0x4d')]({'where':{'id':_0x335fe5[_0xc78a('0x47')]['id']}})[_0xc78a('0x41')](handleEntityNotFound(_0x210c61,null))[_0xc78a('0x41')](function(_0x3d1618){if(_0x3d1618){return _0x3d1618['addActions'](_0x335fe5['body']['ids'],_['omit'](_0x335fe5['body'],[_0xc78a('0x50'),'id'])||{});}})[_0xc78a('0x41')](respondWithResult(_0x210c61,null))[_0xc78a('0x45')](handleError(_0x210c61,null));};exports[_0xc78a('0x57')]=function(_0x26724d,_0x82cec6,_0x3d9e81){var _0x31665b={};var _0x4dd410={};var _0x46279b;var _0x1186fb;return db[_0xc78a('0x40')]['findOne']({'where':{'id':_0x26724d[_0xc78a('0x47')]['id']}})['then'](handleEntityNotFound(_0x82cec6,null))[_0xc78a('0x41')](function(_0x2a5f3a){if(_0x2a5f3a){_0x46279b=_0x2a5f3a;_0x4dd410[_0xc78a('0x34')]=_[_0xc78a('0x31')](db[_0xc78a('0x56')][_0xc78a('0x48')]);_0x4dd410[_0xc78a('0x30')]=_[_0xc78a('0x31')](_0x26724d[_0xc78a('0x30')]);_0x4dd410[_0xc78a('0x32')]=_['intersection'](_0x4dd410[_0xc78a('0x34')],_0x4dd410[_0xc78a('0x30')]);_0x31665b['attributes']=_[_0xc78a('0x33')](_0x4dd410[_0xc78a('0x34')],qs['fields'](_0x26724d[_0xc78a('0x30')][_0xc78a('0x36')]));_0x31665b['attributes']=_0x31665b[_0xc78a('0x35')][_0xc78a('0x54')]?_0x31665b[_0xc78a('0x35')]:_0x4dd410['model'];_0x31665b[_0xc78a('0x39')]=qs[_0xc78a('0x3a')](_0x26724d['query'][_0xc78a('0x3a')]);_0x31665b[_0xc78a('0x3b')]=qs[_0xc78a('0x32')](_[_0xc78a('0x58')](_0x26724d[_0xc78a('0x30')],_0x4dd410[_0xc78a('0x32')]));if(_0x26724d['query'][_0xc78a('0x3c')]){_0x31665b[_0xc78a('0x3b')]=_[_0xc78a('0x3d')](_0x31665b[_0xc78a('0x3b')],{'$or':_[_0xc78a('0x2e')](_0x31665b[_0xc78a('0x35')],function(_0x3f5b7b){var _0x1abb5f={};_0x1abb5f[_0x3f5b7b]={'$like':'%'+_0x26724d[_0xc78a('0x30')]['filter']+'%'};return _0x1abb5f;})});}_0x31665b=_['merge']({},_0x31665b,_0x26724d['options']);return _0x46279b['getActions'](_0x31665b);}})[_0xc78a('0x41')](function(_0x514a36){if(_0x514a36){_0x1186fb=_0x514a36[_0xc78a('0x54')];if(!_0x26724d['query'][_0xc78a('0x37')](_0xc78a('0x38'))){_0x31665b[_0xc78a('0x22')]=qs['limit'](_0x26724d[_0xc78a('0x30')][_0xc78a('0x22')]);_0x31665b[_0xc78a('0x20')]=qs['offset'](_0x26724d['query'][_0xc78a('0x20')]);}return _0x46279b['getActions'](_0x31665b);}})[_0xc78a('0x41')](function(_0x58d86f){if(_0x58d86f){return _0x58d86f?{'count':_0x1186fb,'rows':_0x58d86f}:null;}})['then'](respondWithResult(_0x82cec6,null))[_0xc78a('0x45')](handleError(_0x82cec6,null));}; \ No newline at end of file +var _0x7226=['Action','addActions','omit','getActions','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','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','apply','reject','then','destroy','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','include','findAll','rows','catch','show','keys','find','create','body','params','addConditions','ids','getConditions','options','hasOwnProperty'];(function(_0x18a46a,_0x1b1946){var _0x1df050=function(_0x30bd1b){while(--_0x30bd1b){_0x18a46a['push'](_0x18a46a['shift']());}};_0x1df050(++_0x1b1946);}(_0x7226,0x159));var _0x6722=function(_0x571be2,_0x2b66c8){_0x571be2=_0x571be2-0x0;var _0x5c8f2e=_0x7226[_0x571be2];return _0x5c8f2e;};'use strict';var emlformat=require(_0x6722('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6722('0x1'));var jsonpatch=require(_0x6722('0x2'));var rp=require(_0x6722('0x3'));var moment=require(_0x6722('0x4'));var BPromise=require(_0x6722('0x5'));var Mustache=require('mustache');var util=require(_0x6722('0x6'));var path=require(_0x6722('0x7'));var sox=require('sox');var csv=require(_0x6722('0x8'));var ejs=require(_0x6722('0x9'));var fs=require('fs');var fs_extra=require(_0x6722('0xa'));var _=require(_0x6722('0xb'));var squel=require(_0x6722('0xc'));var crypto=require(_0x6722('0xd'));var jsforce=require(_0x6722('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6722('0xf'));var Papa=require(_0x6722('0x10'));var Redis=require(_0x6722('0x11'));var authService=require(_0x6722('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6722('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6722('0x14'))(_0x6722('0x15'));var utils=require(_0x6722('0x16'));var config=require(_0x6722('0x17'));var licenseUtil=require(_0x6722('0x18'));var db=require(_0x6722('0x19'))['db'];function respondWithStatusCode(_0x19035d,_0x50cb2f){_0x50cb2f=_0x50cb2f||0xcc;return function(_0x4393db){if(_0x4393db){return _0x19035d[_0x6722('0x1a')](_0x50cb2f);}return _0x19035d[_0x6722('0x1b')](_0x50cb2f)[_0x6722('0x1c')]();};}function respondWithResult(_0x2b718a,_0x2fea6f){_0x2fea6f=_0x2fea6f||0xc8;return function(_0x228fd3){if(_0x228fd3){return _0x2b718a['status'](_0x2fea6f)[_0x6722('0x1d')](_0x228fd3);}};}function respondWithFilteredResult(_0x21812b,_0x48cb4d){return function(_0x50e4e2){if(_0x50e4e2){var _0x1d3205=typeof _0x48cb4d[_0x6722('0x1e')]===_0x6722('0x1f')&&typeof _0x48cb4d[_0x6722('0x20')]===_0x6722('0x1f');var _0x316586=_0x50e4e2[_0x6722('0x21')];var _0xb22c6f=_0x1d3205?0x0:_0x48cb4d[_0x6722('0x1e')];var _0x269f1f=_0x1d3205?_0x50e4e2[_0x6722('0x21')]:_0x48cb4d['offset']+_0x48cb4d[_0x6722('0x20')];var _0x12901b;if(_0x269f1f>=_0x316586){_0x269f1f=_0x316586;_0x12901b=0xc8;}else{_0x12901b=0xce;}_0x21812b[_0x6722('0x1b')](_0x12901b);return _0x21812b[_0x6722('0x22')](_0x6722('0x23'),_0xb22c6f+'-'+_0x269f1f+'/'+_0x316586)[_0x6722('0x1d')](_0x50e4e2);}return null;};}function patchUpdates(_0x5da1bc){return function(_0x4a56cd){try{jsonpatch[_0x6722('0x24')](_0x4a56cd,_0x5da1bc,!![]);}catch(_0x3f6ee3){return BPromise[_0x6722('0x25')](_0x3f6ee3);}return _0x4a56cd['save']();};}function saveUpdates(_0xcbd2c7,_0x1d1353){return function(_0x506eb8){if(_0x506eb8){return _0x506eb8['update'](_0xcbd2c7)[_0x6722('0x26')](function(_0x40e8f1){return _0x40e8f1;});}return null;};}function removeEntity(_0x1cab45,_0x5f10f1){return function(_0x5757ee){if(_0x5757ee){return _0x5757ee[_0x6722('0x27')]()[_0x6722('0x26')](function(){_0x1cab45[_0x6722('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x274f5b,_0x29d200){return function(_0x54eaa3){if(!_0x54eaa3){_0x274f5b['sendStatus'](0x194);}return _0x54eaa3;};}function handleError(_0x2739d7,_0xd4be94){_0xd4be94=_0xd4be94||0x1f4;return function(_0x57f449){logger['error'](_0x57f449[_0x6722('0x28')]);if(_0x57f449[_0x6722('0x29')]){delete _0x57f449['name'];}_0x2739d7[_0x6722('0x1b')](_0xd4be94)[_0x6722('0x2a')](_0x57f449);};}exports[_0x6722('0x2b')]=function(_0x1d28f1,_0x3e75aa){var _0x361edc={},_0x501b19={},_0x3f8282={'count':0x0,'rows':[]};var _0x374cb2=_[_0x6722('0x2c')](db[_0x6722('0x2d')][_0x6722('0x2e')],function(_0x297bd2){return{'name':_0x297bd2[_0x6722('0x2f')],'type':_0x297bd2[_0x6722('0x30')][_0x6722('0x31')]};});_0x501b19[_0x6722('0x32')]=_['map'](_0x374cb2,_0x6722('0x29'));_0x501b19[_0x6722('0x33')]=_['keys'](_0x1d28f1[_0x6722('0x33')]);_0x501b19['filters']=_[_0x6722('0x34')](_0x501b19[_0x6722('0x32')],_0x501b19[_0x6722('0x33')]);_0x361edc[_0x6722('0x35')]=_[_0x6722('0x34')](_0x501b19['model'],qs['fields'](_0x1d28f1[_0x6722('0x33')][_0x6722('0x36')]));_0x361edc[_0x6722('0x35')]=_0x361edc[_0x6722('0x35')][_0x6722('0x37')]?_0x361edc[_0x6722('0x35')]:_0x501b19[_0x6722('0x32')];if(!_0x1d28f1['query']['hasOwnProperty'](_0x6722('0x38'))){_0x361edc[_0x6722('0x20')]=qs[_0x6722('0x20')](_0x1d28f1[_0x6722('0x33')]['limit']);_0x361edc['offset']=qs[_0x6722('0x1e')](_0x1d28f1[_0x6722('0x33')][_0x6722('0x1e')]);}_0x361edc[_0x6722('0x39')]=qs['sort'](_0x1d28f1['query'][_0x6722('0x3a')]);_0x361edc[_0x6722('0x3b')]=qs['filters'](_[_0x6722('0x3c')](_0x1d28f1[_0x6722('0x33')],_0x501b19[_0x6722('0x3d')]),_0x374cb2);if(_0x1d28f1[_0x6722('0x33')][_0x6722('0x3e')]){_0x361edc[_0x6722('0x3b')]=_[_0x6722('0x3f')](_0x361edc[_0x6722('0x3b')],{'$or':_[_0x6722('0x2c')](_0x374cb2,function(_0x44149a){if(_0x44149a[_0x6722('0x30')]!==_0x6722('0x40')){var _0xe8496f={};_0xe8496f[_0x44149a[_0x6722('0x29')]]={'$like':'%'+_0x1d28f1[_0x6722('0x33')]['filter']+'%'};return _0xe8496f;}})});}_0x361edc=_['merge']({},_0x361edc,_0x1d28f1['options']);var _0x5499d7={'where':_0x361edc[_0x6722('0x3b')]};return db[_0x6722('0x2d')][_0x6722('0x21')](_0x5499d7)['then'](function(_0x10f27b){_0x3f8282[_0x6722('0x21')]=_0x10f27b;if(_0x1d28f1[_0x6722('0x33')]['includeAll']){_0x361edc[_0x6722('0x41')]=[{'all':!![]}];}return db['Automation'][_0x6722('0x42')](_0x361edc);})[_0x6722('0x26')](function(_0x42d436){_0x3f8282[_0x6722('0x43')]=_0x42d436;return _0x3f8282;})[_0x6722('0x26')](respondWithFilteredResult(_0x3e75aa,_0x361edc))[_0x6722('0x44')](handleError(_0x3e75aa,null));};exports[_0x6722('0x45')]=function(_0x10d977,_0x4674ce){var _0x4e3023={'raw':![],'where':{'id':_0x10d977['params']['id']}},_0x1aa439={};_0x1aa439[_0x6722('0x32')]=_['keys'](db[_0x6722('0x2d')][_0x6722('0x2e')]);_0x1aa439['query']=_[_0x6722('0x46')](_0x10d977['query']);_0x1aa439[_0x6722('0x3d')]=_[_0x6722('0x34')](_0x1aa439[_0x6722('0x32')],_0x1aa439[_0x6722('0x33')]);_0x4e3023['attributes']=_[_0x6722('0x34')](_0x1aa439[_0x6722('0x32')],qs[_0x6722('0x36')](_0x10d977[_0x6722('0x33')]['fields']));_0x4e3023[_0x6722('0x35')]=_0x4e3023[_0x6722('0x35')][_0x6722('0x37')]?_0x4e3023[_0x6722('0x35')]:_0x1aa439[_0x6722('0x32')];if(_0x10d977[_0x6722('0x33')]['includeAll']){_0x4e3023[_0x6722('0x41')]=[{'all':!![]}];}_0x4e3023=_['merge']({},_0x4e3023,_0x10d977['options']);return db['Automation'][_0x6722('0x47')](_0x4e3023)[_0x6722('0x26')](handleEntityNotFound(_0x4674ce,null))[_0x6722('0x26')](respondWithResult(_0x4674ce,null))[_0x6722('0x44')](handleError(_0x4674ce,null));};exports[_0x6722('0x48')]=function(_0x4e48cb,_0x23e853){return db[_0x6722('0x2d')][_0x6722('0x48')](_0x4e48cb['body'],{})[_0x6722('0x26')](respondWithResult(_0x23e853,0xc9))[_0x6722('0x44')](handleError(_0x23e853,null));};exports['update']=function(_0x1743d5,_0x2a3c71){if(_0x1743d5['body']['id']){delete _0x1743d5[_0x6722('0x49')]['id'];}return db[_0x6722('0x2d')][_0x6722('0x47')]({'where':{'id':_0x1743d5[_0x6722('0x4a')]['id']}})[_0x6722('0x26')](handleEntityNotFound(_0x2a3c71,null))['then'](saveUpdates(_0x1743d5[_0x6722('0x49')],null))[_0x6722('0x26')](respondWithResult(_0x2a3c71,null))[_0x6722('0x44')](handleError(_0x2a3c71,null));};exports[_0x6722('0x27')]=function(_0x95f171,_0x12ceca){return db['Automation']['find']({'where':{'id':_0x95f171[_0x6722('0x4a')]['id']}})[_0x6722('0x26')](handleEntityNotFound(_0x12ceca,null))[_0x6722('0x26')](removeEntity(_0x12ceca,null))[_0x6722('0x44')](handleError(_0x12ceca,null));};exports[_0x6722('0x4b')]=function(_0x30e3e1,_0x54f44e,_0x378d32){return db['Condition'][_0x6722('0x47')]({'where':{'id':_0x30e3e1['params']['id']}})[_0x6722('0x26')](handleEntityNotFound(_0x54f44e,null))['then'](function(_0x435c09){if(_0x435c09){return _0x435c09[_0x6722('0x4b')](_0x30e3e1[_0x6722('0x49')][_0x6722('0x4c')],_['omit'](_0x30e3e1['body'],['ids','id'])||{});}})[_0x6722('0x26')](respondWithResult(_0x54f44e,null))[_0x6722('0x44')](handleError(_0x54f44e,null));};exports[_0x6722('0x4d')]=function(_0x1ec440,_0x51144e,_0x416070){var _0x579948={};var _0x429b4e={};var _0x1e217a;var _0x3601b2;return db[_0x6722('0x2d')]['findOne']({'where':{'id':_0x1ec440[_0x6722('0x4a')]['id']}})[_0x6722('0x26')](handleEntityNotFound(_0x51144e,null))[_0x6722('0x26')](function(_0x1434f3){if(_0x1434f3){_0x1e217a=_0x1434f3;_0x429b4e[_0x6722('0x32')]=_[_0x6722('0x46')](db['Condition']['rawAttributes']);_0x429b4e[_0x6722('0x33')]=_[_0x6722('0x46')](_0x1ec440[_0x6722('0x33')]);_0x429b4e[_0x6722('0x3d')]=_[_0x6722('0x34')](_0x429b4e['model'],_0x429b4e['query']);_0x579948[_0x6722('0x35')]=_[_0x6722('0x34')](_0x429b4e[_0x6722('0x32')],qs[_0x6722('0x36')](_0x1ec440[_0x6722('0x33')][_0x6722('0x36')]));_0x579948[_0x6722('0x35')]=_0x579948[_0x6722('0x35')][_0x6722('0x37')]?_0x579948['attributes']:_0x429b4e[_0x6722('0x32')];_0x579948['order']=qs[_0x6722('0x3a')](_0x1ec440['query']['sort']);_0x579948[_0x6722('0x3b')]=qs[_0x6722('0x3d')](_['pick'](_0x1ec440['query'],_0x429b4e['filters']));if(_0x1ec440[_0x6722('0x33')][_0x6722('0x3e')]){_0x579948[_0x6722('0x3b')]=_['merge'](_0x579948['where'],{'$or':_[_0x6722('0x2c')](_0x579948['attributes'],function(_0x882e28){var _0x569be2={};_0x569be2[_0x882e28]={'$like':'%'+_0x1ec440['query'][_0x6722('0x3e')]+'%'};return _0x569be2;})});}_0x579948=_[_0x6722('0x3f')]({},_0x579948,_0x1ec440[_0x6722('0x4e')]);return _0x1e217a['getConditions'](_0x579948);}})['then'](function(_0x3c3c97){if(_0x3c3c97){_0x3601b2=_0x3c3c97[_0x6722('0x37')];if(!_0x1ec440[_0x6722('0x33')][_0x6722('0x4f')](_0x6722('0x38'))){_0x579948['limit']=qs[_0x6722('0x20')](_0x1ec440[_0x6722('0x33')][_0x6722('0x20')]);_0x579948['offset']=qs[_0x6722('0x1e')](_0x1ec440[_0x6722('0x33')]['offset']);}return _0x1e217a['getConditions'](_0x579948);}})[_0x6722('0x26')](function(_0x135c3f){if(_0x135c3f){return _0x135c3f?{'count':_0x3601b2,'rows':_0x135c3f}:null;}})[_0x6722('0x26')](respondWithResult(_0x51144e,null))['catch'](handleError(_0x51144e,null));};exports['addActions']=function(_0x99e5b,_0x2b2aa4,_0x119783){return db[_0x6722('0x50')][_0x6722('0x47')]({'where':{'id':_0x99e5b[_0x6722('0x4a')]['id']}})[_0x6722('0x26')](handleEntityNotFound(_0x2b2aa4,null))['then'](function(_0x138ac7){if(_0x138ac7){return _0x138ac7[_0x6722('0x51')](_0x99e5b[_0x6722('0x49')][_0x6722('0x4c')],_[_0x6722('0x52')](_0x99e5b[_0x6722('0x49')],[_0x6722('0x4c'),'id'])||{});}})['then'](respondWithResult(_0x2b2aa4,null))[_0x6722('0x44')](handleError(_0x2b2aa4,null));};exports[_0x6722('0x53')]=function(_0x512d3d,_0x270f33,_0x49e06e){var _0x1683a6={};var _0x38b600={};var _0x33d1b3;var _0x136609;return db[_0x6722('0x2d')][_0x6722('0x54')]({'where':{'id':_0x512d3d[_0x6722('0x4a')]['id']}})['then'](handleEntityNotFound(_0x270f33,null))[_0x6722('0x26')](function(_0x47b729){if(_0x47b729){_0x33d1b3=_0x47b729;_0x38b600['model']=_[_0x6722('0x46')](db[_0x6722('0x50')][_0x6722('0x2e')]);_0x38b600[_0x6722('0x33')]=_[_0x6722('0x46')](_0x512d3d[_0x6722('0x33')]);_0x38b600[_0x6722('0x3d')]=_[_0x6722('0x34')](_0x38b600['model'],_0x38b600[_0x6722('0x33')]);_0x1683a6['attributes']=_[_0x6722('0x34')](_0x38b600[_0x6722('0x32')],qs['fields'](_0x512d3d[_0x6722('0x33')][_0x6722('0x36')]));_0x1683a6['attributes']=_0x1683a6[_0x6722('0x35')]['length']?_0x1683a6['attributes']:_0x38b600[_0x6722('0x32')];_0x1683a6['order']=qs[_0x6722('0x3a')](_0x512d3d[_0x6722('0x33')][_0x6722('0x3a')]);_0x1683a6['where']=qs[_0x6722('0x3d')](_[_0x6722('0x3c')](_0x512d3d[_0x6722('0x33')],_0x38b600[_0x6722('0x3d')]));if(_0x512d3d['query'][_0x6722('0x3e')]){_0x1683a6['where']=_[_0x6722('0x3f')](_0x1683a6[_0x6722('0x3b')],{'$or':_[_0x6722('0x2c')](_0x1683a6['attributes'],function(_0x438d65){var _0x1c4496={};_0x1c4496[_0x438d65]={'$like':'%'+_0x512d3d[_0x6722('0x33')][_0x6722('0x3e')]+'%'};return _0x1c4496;})});}_0x1683a6=_[_0x6722('0x3f')]({},_0x1683a6,_0x512d3d[_0x6722('0x4e')]);return _0x33d1b3['getActions'](_0x1683a6);}})['then'](function(_0x3db451){if(_0x3db451){_0x136609=_0x3db451[_0x6722('0x37')];if(!_0x512d3d['query'][_0x6722('0x4f')](_0x6722('0x38'))){_0x1683a6[_0x6722('0x20')]=qs[_0x6722('0x20')](_0x512d3d[_0x6722('0x33')][_0x6722('0x20')]);_0x1683a6['offset']=qs['offset'](_0x512d3d[_0x6722('0x33')]['offset']);}return _0x33d1b3['getActions'](_0x1683a6);}})[_0x6722('0x26')](function(_0x501800){if(_0x501800){return _0x501800?{'count':_0x136609,'rows':_0x501800}:null;}})[_0x6722('0x26')](respondWithResult(_0x270f33,null))['catch'](handleError(_0x270f33,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index bb3778a..819db74 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 _0xa1a6=['moment','bluebird','request-promise','path','rimraf','./automation.attributes','Automation','tools_automations','util','../../config/logger','api'];(function(_0x305419,_0x18e5f5){var _0x1d98b4=function(_0x90a0cf){while(--_0x90a0cf){_0x305419['push'](_0x305419['shift']());}};_0x1d98b4(++_0x18e5f5);}(_0xa1a6,0x126));var _0x6a1a=function(_0x5c6244,_0x112ab8){_0x5c6244=_0x5c6244-0x0;var _0x5800ce=_0xa1a6[_0x5c6244];return _0x5800ce;};'use strict';var _=require('lodash');var util=require(_0x6a1a('0x0'));var logger=require(_0x6a1a('0x1'))(_0x6a1a('0x2'));var moment=require(_0x6a1a('0x3'));var BPromise=require(_0x6a1a('0x4'));var rp=require(_0x6a1a('0x5'));var fs=require('fs');var path=require(_0x6a1a('0x6'));var rimraf=require(_0x6a1a('0x7'));var config=require('../../config/environment');var attributes=require(_0x6a1a('0x8'));module['exports']=function(_0x36ff81,_0x56fc95){return _0x36ff81['define'](_0x6a1a('0x9'),attributes,{'tableName':_0x6a1a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x23e6=['moment','bluebird','request-promise','path','rimraf','exports','define','Automation','tools_automations','lodash','util','api'];(function(_0x37d6b8,_0x525b5b){var _0x318611=function(_0x484847){while(--_0x484847){_0x37d6b8['push'](_0x37d6b8['shift']());}};_0x318611(++_0x525b5b);}(_0x23e6,0x11d));var _0x623e=function(_0x4115a0,_0x4a9504){_0x4115a0=_0x4115a0-0x0;var _0x45ed60=_0x23e6[_0x4115a0];return _0x45ed60;};'use strict';var _=require(_0x623e('0x0'));var util=require(_0x623e('0x1'));var logger=require('../../config/logger')(_0x623e('0x2'));var moment=require(_0x623e('0x3'));var BPromise=require(_0x623e('0x4'));var rp=require(_0x623e('0x5'));var fs=require('fs');var path=require(_0x623e('0x6'));var rimraf=require(_0x623e('0x7'));var config=require('../../config/environment');var attributes=require('./automation.attributes');module[_0x623e('0x8')]=function(_0x348535,_0x3890e0){return _0x348535[_0x623e('0x9')](_0x623e('0xa'),attributes,{'tableName':_0x623e('0xb'),'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 499ecbe..3b21727 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 _0xc7da=['request','then','info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc7da,0xf2));var _0xac7d=function(_0x2ed00c,_0x3bc41f){_0x2ed00c=_0x2ed00c-0x0;var _0x5e8c28=_0xc7da[_0x2ed00c];return _0x5e8c28;};'use strict';var _=require(_0xac7d('0x0'));var util=require(_0xac7d('0x1'));var moment=require(_0xac7d('0x2'));var BPromise=require('bluebird');var rs=require(_0xac7d('0x3'));var fs=require('fs');var Redis=require(_0xac7d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xac7d('0x5'));var logger=require(_0xac7d('0x6'))('rpc');var config=require(_0xac7d('0x7'));var jayson=require(_0xac7d('0x8'));var client=jayson[_0xac7d('0x9')][_0xac7d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x268265,_0x153ce5,_0x48ca59){return new BPromise(function(_0x44eb2b,_0x457e2d){return client[_0xac7d('0xb')](_0x268265,_0x48ca59)[_0xac7d('0xc')](function(_0x217811){logger[_0xac7d('0xd')](_0xac7d('0xe'),_0x153ce5,'request\x20sent');logger[_0xac7d('0xf')](_0xac7d('0x10'),_0x153ce5,_0xac7d('0x11'),JSON['stringify'](_0x217811));if(_0x217811[_0xac7d('0x12')]){if(_0x217811[_0xac7d('0x12')][_0xac7d('0x13')]===0x1f4){logger[_0xac7d('0x12')]('Automation,\x20%s,\x20%s',_0x153ce5,_0x217811[_0xac7d('0x12')][_0xac7d('0x14')]);return _0x457e2d(_0x217811[_0xac7d('0x12')][_0xac7d('0x14')]);}logger[_0xac7d('0x12')]('Automation,\x20%s,\x20%s',_0x153ce5,_0x217811[_0xac7d('0x12')]['message']);return _0x44eb2b(_0x217811[_0xac7d('0x12')][_0xac7d('0x14')]);}else{logger[_0xac7d('0xd')](_0xac7d('0xe'),_0x153ce5,'request\x20sent');_0x44eb2b(_0x217811[_0xac7d('0x15')][_0xac7d('0x14')]);}})[_0xac7d('0x16')](function(_0x12813a){logger[_0xac7d('0x12')]('Automation,\x20%s,\x20%s',_0x153ce5,_0x12813a);_0x457e2d(_0x12813a);});});} \ No newline at end of file +var _0x30c7=['http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','client'];(function(_0x2ab874,_0x319166){var _0xab4425=function(_0x26910f){while(--_0x26910f){_0x2ab874['push'](_0x2ab874['shift']());}};_0xab4425(++_0x319166);}(_0x30c7,0x111));var _0x730c=function(_0x4661fc,_0x2d5d9e){_0x4661fc=_0x4661fc-0x0;var _0x2e7294=_0x30c7[_0x4661fc];return _0x2e7294;};'use strict';var _=require(_0x730c('0x0'));var util=require('util');var moment=require(_0x730c('0x1'));var BPromise=require(_0x730c('0x2'));var rs=require(_0x730c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x730c('0x4'))['db'];var utils=require(_0x730c('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x730c('0x6')][_0x730c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5748ab,_0x11b5a8,_0x2ed29c){return new BPromise(function(_0x6022ae,_0x4b6e23){return client[_0x730c('0x8')](_0x5748ab,_0x2ed29c)[_0x730c('0x9')](function(_0x48b4f7){logger[_0x730c('0xa')](_0x730c('0xb'),_0x11b5a8,_0x730c('0xc'));logger[_0x730c('0xd')](_0x730c('0xe'),_0x11b5a8,_0x730c('0xc'),JSON[_0x730c('0xf')](_0x48b4f7));if(_0x48b4f7['error']){if(_0x48b4f7[_0x730c('0x10')][_0x730c('0x11')]===0x1f4){logger[_0x730c('0x10')](_0x730c('0xb'),_0x11b5a8,_0x48b4f7['error'][_0x730c('0x12')]);return _0x4b6e23(_0x48b4f7[_0x730c('0x10')][_0x730c('0x12')]);}logger[_0x730c('0x10')](_0x730c('0xb'),_0x11b5a8,_0x48b4f7[_0x730c('0x10')][_0x730c('0x12')]);return _0x6022ae(_0x48b4f7[_0x730c('0x10')][_0x730c('0x12')]);}else{logger[_0x730c('0xa')](_0x730c('0xb'),_0x11b5a8,'request\x20sent');_0x6022ae(_0x48b4f7['result']['message']);}})[_0x730c('0x13')](function(_0x2242e4){logger[_0x730c('0x10')](_0x730c('0xb'),_0x11b5a8,_0x2242e4);_0x4b6e23(_0x2242e4);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 11ee720..a41e161 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 _0xa37e=['/:id/conditions','isAuthenticated','/:id/actions','create','post','addConditions','addActions','/:id','update','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./automation.controller','get','show'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xa37e,0x97));var _0xea37=function(_0x449019,_0x532220){_0x449019=_0x449019-0x0;var _0x415042=_0xa37e[_0x449019];return _0x415042;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xea37('0x0'));var timeout=require(_0xea37('0x1'));var express=require(_0xea37('0x2'));var router=express[_0xea37('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xea37('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xea37('0x5'));var controller=require(_0xea37('0x6'));router[_0xea37('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xea37('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xea37('0x8')]);router[_0xea37('0x7')](_0xea37('0x9'),auth[_0xea37('0xa')](),controller['getConditions']);router[_0xea37('0x7')](_0xea37('0xb'),auth[_0xea37('0xa')](),controller['getActions']);router['post']('/',auth[_0xea37('0xa')](),controller[_0xea37('0xc')]);router[_0xea37('0xd')]('/:id/conditions',auth[_0xea37('0xa')](),controller[_0xea37('0xe')]);router[_0xea37('0xd')]('/:id/actions',auth[_0xea37('0xa')](),controller[_0xea37('0xf')]);router['put'](_0xea37('0x10'),auth['isAuthenticated'](),controller[_0xea37('0x11')]);router['delete'](_0xea37('0x10'),auth[_0xea37('0xa')](),controller[_0xea37('0x12')]);module[_0xea37('0x13')]=router; \ No newline at end of file +var _0x6d6f=['/:id','delete','destroy','connect-timeout','express','Router','../../components/auth/service','./automation.controller','isAuthenticated','get','/:id/conditions','getConditions','/:id/actions','post','create','addConditions','addActions','put'];(function(_0x5a06fe,_0x429758){var _0x175492=function(_0x5ec393){while(--_0x5ec393){_0x5a06fe['push'](_0x5a06fe['shift']());}};_0x175492(++_0x429758);}(_0x6d6f,0x159));var _0xf6d6=function(_0x5a19fc,_0x58f9f4){_0x5a19fc=_0x5a19fc-0x0;var _0x34b413=_0x6d6f[_0x5a19fc];return _0x34b413;};'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']('/:id',auth[_0xf6d6('0x5')](),controller['show']);router[_0xf6d6('0x6')](_0xf6d6('0x7'),auth[_0xf6d6('0x5')](),controller[_0xf6d6('0x8')]);router[_0xf6d6('0x6')](_0xf6d6('0x9'),auth[_0xf6d6('0x5')](),controller['getActions']);router[_0xf6d6('0xa')]('/',auth[_0xf6d6('0x5')](),controller[_0xf6d6('0xb')]);router[_0xf6d6('0xa')](_0xf6d6('0x7'),auth['isAuthenticated'](),controller[_0xf6d6('0xc')]);router['post']('/:id/actions',auth[_0xf6d6('0x5')](),controller[_0xf6d6('0xd')]);router[_0xf6d6('0xe')](_0xf6d6('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xf6d6('0x10')](_0xf6d6('0xf'),auth[_0xf6d6('0x5')](),controller[_0xf6d6('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 4c209cf..f9c05c7 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 _0x77ed=['ENUM','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','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'];(function(_0x12865d,_0x5f3b15){var _0x53b04c=function(_0x65d081){while(--_0x65d081){_0x12865d['push'](_0x12865d['shift']());}};_0x53b04c(++_0x5f3b15);}(_0x77ed,0x11c));var _0xd77e=function(_0x3c2d9c,_0x49408c){_0x3c2d9c=_0x3c2d9c-0x0;var _0x5e16a2=_0x77ed[_0x3c2d9c];return _0x5e16a2;};'use strict';var Sequelize=require(_0xd77e('0x0'));module[_0xd77e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd77e('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xd77e('0x3')](_0xd77e('0x4')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xd77e('0x5')]},'active':{'type':Sequelize[_0xd77e('0x6')],'defaultValue':0x0,'comment':_0xd77e('0x7')},'limitCalls':{'type':Sequelize[_0xd77e('0x8')](0x4)[_0xd77e('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xd77e('0xa')},'dialOriginateCallerIdName':{'type':Sequelize[_0xd77e('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xd77e('0x5')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xd77e('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd77e('0xb')},'dialCongestionMaxRetry':{'type':Sequelize[_0xd77e('0x8')](0x3)[_0xd77e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd77e('0xc')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd77e('0xd')},'dialBusyMaxRetry':{'type':Sequelize[_0xd77e('0x8')](0x3)[_0xd77e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xd77e('0x8')](0x5)[_0xd77e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd77e('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xd77e('0x8')](0x3)[_0xd77e('0x9')],'defaultValue':0x3,'comment':_0xd77e('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xd77e('0x8')](0x5)[_0xd77e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd77e('0x10')},'dialGlobalMaxRetry':{'type':Sequelize[_0xd77e('0x8')](0x3)[_0xd77e('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xd77e('0x11')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xd77e('0x5')],'defaultValue':_0xd77e('0x12')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xd77e('0x13'),_0xd77e('0x14'),_0xd77e('0x15')),'defaultValue':_0xd77e('0x13')},'dialAMDActive':{'type':Sequelize[_0xd77e('0x6')],'defaultValue':0x0,'comment':_0xd77e('0x16')},'dialAMDInitialSilence':{'type':Sequelize[_0xd77e('0x8')](0x9)[_0xd77e('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xd77e('0x17')},'dialAMDGreeting':{'type':Sequelize[_0xd77e('0x8')](0x9)[_0xd77e('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xd77e('0x18')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xd77e('0x8')](0x9)[_0xd77e('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xd77e('0x8')](0x9)[_0xd77e('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd77e('0x19')},'dialAMDMinWordLength':{'type':Sequelize[_0xd77e('0x8')](0x9)[_0xd77e('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xd77e('0x1a')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xd77e('0x1b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xd77e('0x8')](0x9)[_0xd77e('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xd77e('0x1c')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xd77e('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xd77e('0x1d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xd77e('0x8')](0x9)[_0xd77e('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xd77e('0x1e'),_0xd77e('0x1f')),'defaultValue':_0xd77e('0x1e')},'dialPrefix':{'type':Sequelize[_0xd77e('0x5')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xd77e('0x8')](0x3)[_0xd77e('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd77e('0x20')},'dialCutDigit':{'type':Sequelize[_0xd77e('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd77e('0x21')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xd77e('0x8')](0x3)[_0xd77e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xd77e('0x8')](0x5)[_0xd77e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd77e('0x22')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd77e('0x23')},'dialDropRetryFrequency':{'type':Sequelize[_0xd77e('0x8')](0x5)[_0xd77e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd77e('0x24')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xd77e('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd77e('0x25')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xd77e('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd77e('0x26')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd77e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xd77e('0x8')](0x5)[_0xd77e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xd77e('0x8')](0x3)[_0xd77e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd77e('0x27')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd77e('0x28')}}; \ No newline at end of file +var _0x6487=['NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','BOOLEAN','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','ENUM','ivr','STRING','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)'];(function(_0x2682d1,_0x303ab3){var _0x13c0c2=function(_0x533814){while(--_0x533814){_0x2682d1['push'](_0x2682d1['shift']());}};_0x13c0c2(++_0x303ab3);}(_0x6487,0x19f));var _0x7648=function(_0x4ce842,_0x1faafe){_0x4ce842=_0x4ce842-0x0;var _0x1c4e12=_0x6487[_0x4ce842];return _0x1c4e12;};'use strict';var Sequelize=require(_0x7648('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x7648('0x1')](_0x7648('0x2')),'allowNull':![],'defaultValue':_0x7648('0x2')},'description':{'type':Sequelize[_0x7648('0x3')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x7648('0x4')},'limitCalls':{'type':Sequelize[_0x7648('0x5')](0x4)[_0x7648('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x7648('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x7648('0x3')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x7648('0x5')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7648('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x7648('0x5')](0x3)[_0x7648('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7648('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x7648('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7648('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x7648('0x5')](0x3)[_0x7648('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7648('0xb')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7648('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7648('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x7648('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x7648('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x7648('0x5')](0x5)[_0x7648('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7648('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x7648('0x5')](0x3)[_0x7648('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x7648('0x3')],'defaultValue':_0x7648('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0x7648('0x1')](_0x7648('0x10'),_0x7648('0x11'),_0x7648('0x12')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x7648('0x13')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x7648('0x5')](0x9)[_0x7648('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x7648('0x14')},'dialAMDGreeting':{'type':Sequelize[_0x7648('0x5')](0x9)[_0x7648('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x7648('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x7648('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x7648('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x7648('0x5')](0x9)[_0x7648('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x7648('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x7648('0x5')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x7648('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x7648('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x7648('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x7648('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x7648('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x7648('0x5')](0x9)[_0x7648('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7648('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x7648('0x1')](_0x7648('0x1c'),_0x7648('0x1d')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x7648('0x3')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x7648('0x5')](0x3)[_0x7648('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7648('0x1e')},'dialCutDigit':{'type':Sequelize[_0x7648('0x5')](0x3)[_0x7648('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7648('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x7648('0x5')](0x3)[_0x7648('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7648('0x20')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x7648('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x7648('0x5')](0x3)[_0x7648('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x7648('0x5')](0x5)[_0x7648('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7648('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x7648('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7648('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7648('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7648('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0x7648('0x5')](0x3)[_0x7648('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7648('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0x7648('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x7648('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7648('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7648('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7648('0x26')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 3b0f79d..18f9670 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 _0xd851=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','getHoppers','CmHopper','hasOwnProperty','nolimit','CampaignId','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','addLists','ids','spread','dialCheckDuplicateType','insert','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','select','phone','field','CmListId','toString','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','into','CampaignId\x20=\x20?','ListId\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','Campaign','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','IvrCampaigns','UserProfileSection','userProfileId','autoAssociation'];(function(_0x26a706,_0x25cc80){var _0x1bcd7c=function(_0x4af445){while(--_0x4af445){_0x26a706['push'](_0x26a706['shift']());}};_0x1bcd7c(++_0x25cc80);}(_0xd851,0xb9));var _0x1d85=function(_0x199bc4,_0x338105){_0x199bc4=_0x199bc4-0x0;var _0x136ffb=_0xd851[_0x199bc4];return _0x136ffb;};'use strict';var emlformat=require(_0x1d85('0x0'));var rimraf=require(_0x1d85('0x1'));var zipdir=require(_0x1d85('0x2'));var jsonpatch=require(_0x1d85('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1d85('0x4'));var Mustache=require(_0x1d85('0x5'));var util=require(_0x1d85('0x6'));var path=require(_0x1d85('0x7'));var sox=require('sox');var csv=require(_0x1d85('0x8'));var ejs=require(_0x1d85('0x9'));var fs=require('fs');var fs_extra=require(_0x1d85('0xa'));var _=require(_0x1d85('0xb'));var squel=require(_0x1d85('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1d85('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1d85('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1d85('0xf'));var qs=require(_0x1d85('0x10'));var as=require(_0x1d85('0x11'));var hardwareService=require(_0x1d85('0x12'));var logger=require(_0x1d85('0x13'))('api');var utils=require(_0x1d85('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1d85('0x15'));var db=require(_0x1d85('0x16'))['db'];function respondWithStatusCode(_0x35596b,_0x3a5ae0){_0x3a5ae0=_0x3a5ae0||0xcc;return function(_0x27df25){if(_0x27df25){return _0x35596b['sendStatus'](_0x3a5ae0);}return _0x35596b[_0x1d85('0x17')](_0x3a5ae0)[_0x1d85('0x18')]();};}function respondWithResult(_0x176f13,_0x223eb8){_0x223eb8=_0x223eb8||0xc8;return function(_0x48282e){if(_0x48282e){return _0x176f13[_0x1d85('0x17')](_0x223eb8)['json'](_0x48282e);}};}function respondWithFilteredResult(_0x158bb3,_0xa15ba2){return function(_0x48d76a){if(_0x48d76a){var _0x1813ee=typeof _0xa15ba2[_0x1d85('0x19')]===_0x1d85('0x1a')&&typeof _0xa15ba2[_0x1d85('0x1b')]===_0x1d85('0x1a');var _0x26a6fb=_0x48d76a[_0x1d85('0x1c')];var _0x45d24b=_0x1813ee?0x0:_0xa15ba2[_0x1d85('0x19')];var _0x570730=_0x1813ee?_0x48d76a['count']:_0xa15ba2['offset']+_0xa15ba2[_0x1d85('0x1b')];var _0x41b1af;if(_0x570730>=_0x26a6fb){_0x570730=_0x26a6fb;_0x41b1af=0xc8;}else{_0x41b1af=0xce;}_0x158bb3[_0x1d85('0x17')](_0x41b1af);return _0x158bb3[_0x1d85('0x1d')](_0x1d85('0x1e'),_0x45d24b+'-'+_0x570730+'/'+_0x26a6fb)[_0x1d85('0x1f')](_0x48d76a);}return null;};}function patchUpdates(_0x5150e9){return function(_0x440a94){try{jsonpatch[_0x1d85('0x20')](_0x440a94,_0x5150e9,!![]);}catch(_0x54b82b){return BPromise[_0x1d85('0x21')](_0x54b82b);}return _0x440a94['save']();};}function saveUpdates(_0x21ee0a,_0x4ff5fe){return function(_0x581732){if(_0x581732){return _0x581732[_0x1d85('0x22')](_0x21ee0a)[_0x1d85('0x23')](function(_0x50a983){return _0x50a983;});}return null;};}function removeEntity(_0x5f2afb,_0x2bea5e){return function(_0x20af16){if(_0x20af16){return _0x20af16[_0x1d85('0x24')]()[_0x1d85('0x23')](function(){var _0x1dc6c7=_0x20af16[_0x1d85('0x25')]({'plain':!![]});var _0x4e44b8='IvrCampaigns';return db[_0x1d85('0x26')][_0x1d85('0x24')]({'where':{'type':_0x4e44b8,'resourceId':_0x1dc6c7['id']}})[_0x1d85('0x23')](function(){return _0x20af16;});})[_0x1d85('0x23')](function(){_0x5f2afb[_0x1d85('0x17')](0xcc)[_0x1d85('0x18')]();});}};}function handleEntityNotFound(_0x2a778a,_0x2ecd53){return function(_0x2ea5c7){if(!_0x2ea5c7){_0x2a778a[_0x1d85('0x27')](0x194);}return _0x2ea5c7;};}function handleError(_0x3eec1c,_0x5d2944){_0x5d2944=_0x5d2944||0x1f4;return function(_0x370875){logger[_0x1d85('0x28')](_0x370875[_0x1d85('0x29')]);if(_0x370875[_0x1d85('0x2a')]){delete _0x370875[_0x1d85('0x2a')];}_0x3eec1c[_0x1d85('0x17')](_0x5d2944)[_0x1d85('0x2b')](_0x370875);};}exports[_0x1d85('0x2c')]=function(_0xfa414d,_0x3b8a83){var _0x36f7e7={},_0x306b4d={},_0x4e80ba={'count':0x0,'rows':[]};var _0x5205c7=_[_0x1d85('0x2d')](db[_0x1d85('0x2e')]['rawAttributes'],function(_0x527228){return{'name':_0x527228['fieldName'],'type':_0x527228[_0x1d85('0x2f')][_0x1d85('0x30')]};});_0x306b4d[_0x1d85('0x31')]=_[_0x1d85('0x2d')](_0x5205c7,_0x1d85('0x2a'));_0x306b4d['query']=_['keys'](_0xfa414d[_0x1d85('0x32')]);_0x306b4d[_0x1d85('0x33')]=_[_0x1d85('0x34')](_0x306b4d[_0x1d85('0x31')],_0x306b4d[_0x1d85('0x32')]);_0x36f7e7[_0x1d85('0x35')]=_[_0x1d85('0x34')](_0x306b4d[_0x1d85('0x31')],qs[_0x1d85('0x36')](_0xfa414d[_0x1d85('0x32')][_0x1d85('0x36')]));_0x36f7e7['attributes']=_0x36f7e7[_0x1d85('0x35')][_0x1d85('0x37')]?_0x36f7e7['attributes']:_0x306b4d[_0x1d85('0x31')];if(!_0xfa414d[_0x1d85('0x32')]['hasOwnProperty']('nolimit')){_0x36f7e7[_0x1d85('0x1b')]=qs[_0x1d85('0x1b')](_0xfa414d['query']['limit']);_0x36f7e7['offset']=qs[_0x1d85('0x19')](_0xfa414d[_0x1d85('0x32')][_0x1d85('0x19')]);}_0x36f7e7[_0x1d85('0x38')]=qs[_0x1d85('0x39')](_0xfa414d['query']['sort']);_0x36f7e7[_0x1d85('0x3a')]=qs[_0x1d85('0x33')](_[_0x1d85('0x3b')](_0xfa414d[_0x1d85('0x32')],_0x306b4d[_0x1d85('0x33')]),_0x5205c7);if(_0xfa414d[_0x1d85('0x32')][_0x1d85('0x3c')]){_0x36f7e7[_0x1d85('0x3a')]=_['merge'](_0x36f7e7[_0x1d85('0x3a')],{'$or':_[_0x1d85('0x2d')](_0x5205c7,function(_0x449c5a){if(_0x449c5a[_0x1d85('0x2f')]!==_0x1d85('0x3d')){var _0xc27c96={};_0xc27c96[_0x449c5a['name']]={'$like':'%'+_0xfa414d['query']['filter']+'%'};return _0xc27c96;}})});}_0x36f7e7=_[_0x1d85('0x3e')]({},_0x36f7e7,_0xfa414d[_0x1d85('0x3f')]);var _0x112132={'where':_0x36f7e7[_0x1d85('0x3a')]};return db['Campaign']['count'](_0x112132)[_0x1d85('0x23')](function(_0x47aaa8){_0x4e80ba[_0x1d85('0x1c')]=_0x47aaa8;if(_0xfa414d[_0x1d85('0x32')][_0x1d85('0x40')]){_0x36f7e7['include']=[{'all':!![]}];}return db[_0x1d85('0x2e')][_0x1d85('0x41')](_0x36f7e7);})[_0x1d85('0x23')](function(_0x3d26a4){_0x4e80ba[_0x1d85('0x42')]=_0x3d26a4;return _0x4e80ba;})[_0x1d85('0x23')](respondWithFilteredResult(_0x3b8a83,_0x36f7e7))[_0x1d85('0x43')](handleError(_0x3b8a83,null));};exports[_0x1d85('0x44')]=function(_0x492122,_0x8841b2){var _0x2bb6b8={'raw':![],'where':{'id':_0x492122[_0x1d85('0x45')]['id']}},_0x5a09a7={};_0x5a09a7[_0x1d85('0x31')]=_[_0x1d85('0x46')](db[_0x1d85('0x2e')][_0x1d85('0x47')]);_0x5a09a7['query']=_['keys'](_0x492122[_0x1d85('0x32')]);_0x5a09a7['filters']=_[_0x1d85('0x34')](_0x5a09a7[_0x1d85('0x31')],_0x5a09a7[_0x1d85('0x32')]);_0x2bb6b8[_0x1d85('0x35')]=_[_0x1d85('0x34')](_0x5a09a7[_0x1d85('0x31')],qs[_0x1d85('0x36')](_0x492122['query'][_0x1d85('0x36')]));_0x2bb6b8[_0x1d85('0x35')]=_0x2bb6b8[_0x1d85('0x35')][_0x1d85('0x37')]?_0x2bb6b8[_0x1d85('0x35')]:_0x5a09a7[_0x1d85('0x31')];if(_0x492122[_0x1d85('0x32')][_0x1d85('0x40')]){_0x2bb6b8[_0x1d85('0x48')]=[{'all':!![]}];}_0x2bb6b8=_[_0x1d85('0x3e')]({},_0x2bb6b8,_0x492122['options']);return db[_0x1d85('0x2e')][_0x1d85('0x49')](_0x2bb6b8)[_0x1d85('0x23')](handleEntityNotFound(_0x8841b2,null))['then'](respondWithResult(_0x8841b2,null))[_0x1d85('0x43')](handleError(_0x8841b2,null));};exports[_0x1d85('0x4a')]=function(_0x16605b,_0x4e977f){return db[_0x1d85('0x2e')]['create'](_0x16605b[_0x1d85('0x4b')],{})[_0x1d85('0x23')](function(_0x2374df){var _0x4af694=_0x16605b['user'][_0x1d85('0x25')]({'plain':!![]});if(!_0x4af694)throw new Error(_0x1d85('0x4c'));if(_0x4af694[_0x1d85('0x4d')]===_0x1d85('0x4e')){var _0x571953=_0x2374df[_0x1d85('0x25')]({'plain':!![]});var _0x2c0898=_0x1d85('0x4f');return db[_0x1d85('0x50')][_0x1d85('0x49')]({'where':{'name':_0x2c0898,'userProfileId':_0x4af694[_0x1d85('0x51')]},'raw':!![]})['then'](function(_0xba87e3){if(_0xba87e3&&_0xba87e3[_0x1d85('0x52')]===0x0){return db[_0x1d85('0x26')][_0x1d85('0x4a')]({'name':_0x571953[_0x1d85('0x2a')],'resourceId':_0x571953['id'],'type':_0xba87e3[_0x1d85('0x2a')],'sectionId':_0xba87e3['id']},{})[_0x1d85('0x23')](function(){return _0x2374df;});}else{return _0x2374df;}})[_0x1d85('0x43')](function(_0x55785d){logger[_0x1d85('0x28')](_0x1d85('0x53'),_0x55785d);throw _0x55785d;});}return _0x2374df;})[_0x1d85('0x23')](respondWithResult(_0x4e977f,0xc9))['catch'](handleError(_0x4e977f,null));};exports[_0x1d85('0x54')]=function(_0x3a0e8f,_0x2a6a9a){var _0x5bf736={'where':{'id':_0x3a0e8f['params']['id']}},_0x562f09={};_0x562f09[_0x1d85('0x31')]=_[_0x1d85('0x46')](db[_0x1d85('0x2e')][_0x1d85('0x47')]);_0x5bf736['attributes']=_[_0x1d85('0x34')](_0x562f09[_0x1d85('0x31')],qs[_0x1d85('0x36')](_0x3a0e8f['query'][_0x1d85('0x36')]));_0x5bf736[_0x1d85('0x35')]=_0x5bf736[_0x1d85('0x35')][_0x1d85('0x37')]?_0x5bf736['attributes']:_0x562f09[_0x1d85('0x31')];if(_0x3a0e8f[_0x1d85('0x32')][_0x1d85('0x40')]){_0x5bf736['include']=[{'all':!![]}];}_0x5bf736=_[_0x1d85('0x3e')]({},_0x5bf736,_0x3a0e8f['options']);return db[_0x1d85('0x2e')][_0x1d85('0x49')](_0x5bf736)['then'](handleEntityNotFound(_0x2a6a9a,null))['then'](function(_0x3291dc){if(_0x3291dc){var _0x117e65=_0x3291dc[_0x1d85('0x25')]({'plain':!![]});_0x117e65=qs[_0x1d85('0x55')](_0x117e65,['id',_0x1d85('0x56'),_0x1d85('0x57')]);_0x3a0e8f['body']=_['omit'](_0x3a0e8f[_0x1d85('0x4b')],['id',_0x1d85('0x56'),_0x1d85('0x57')]);return db['Campaign'][_0x1d85('0x4a')](_[_0x1d85('0x3e')](_0x117e65,_0x3a0e8f[_0x1d85('0x4b')]),{'include':_0x3a0e8f[_0x1d85('0x32')][_0x1d85('0x40')]?[{'all':!![]}]:undefined})[_0x1d85('0x23')](function(_0x3eeaab){var _0x29f2a8=_0x3a0e8f[_0x1d85('0x4e')][_0x1d85('0x25')]({'plain':!![]});if(!_0x29f2a8)throw new Error(_0x1d85('0x4c'));if(_0x29f2a8[_0x1d85('0x4d')]===_0x1d85('0x4e')){var _0x3eee87=_0x3eeaab[_0x1d85('0x25')]({'plain':!![]});var _0x40a166='IvrCampaigns';return db[_0x1d85('0x50')][_0x1d85('0x49')]({'where':{'name':_0x40a166,'userProfileId':_0x29f2a8[_0x1d85('0x51')]},'raw':!![]})['then'](function(_0x3a72e1){if(_0x3a72e1&&_0x3a72e1[_0x1d85('0x52')]===0x0){return db[_0x1d85('0x26')][_0x1d85('0x4a')]({'name':_0x3eee87[_0x1d85('0x2a')],'resourceId':_0x3eee87['id'],'type':_0x3a72e1[_0x1d85('0x2a')],'sectionId':_0x3a72e1['id']},{})['then'](function(){return _0x3eeaab;});}else{return _0x3eeaab;}})[_0x1d85('0x43')](function(_0xe7d534){logger[_0x1d85('0x28')](_0x1d85('0x53'),_0xe7d534);throw _0xe7d534;});}return _0x3eeaab;});}})[_0x1d85('0x23')](respondWithResult(_0x2a6a9a,0xc9))[_0x1d85('0x43')](handleError(_0x2a6a9a,null));};exports[_0x1d85('0x22')]=function(_0x3941b9,_0x12fb39){if(_0x3941b9[_0x1d85('0x4b')]['id']){delete _0x3941b9[_0x1d85('0x4b')]['id'];}return db[_0x1d85('0x2e')][_0x1d85('0x49')]({'where':{'id':_0x3941b9[_0x1d85('0x45')]['id']}})[_0x1d85('0x23')](handleEntityNotFound(_0x12fb39,null))[_0x1d85('0x23')](saveUpdates(_0x3941b9[_0x1d85('0x4b')],null))[_0x1d85('0x23')](respondWithResult(_0x12fb39,null))[_0x1d85('0x43')](handleError(_0x12fb39,null));};exports['destroy']=function(_0x282218,_0x50e610){return db['Campaign'][_0x1d85('0x49')]({'where':{'id':_0x282218[_0x1d85('0x45')]['id']}})[_0x1d85('0x23')](handleEntityNotFound(_0x50e610,null))[_0x1d85('0x23')](removeEntity(_0x50e610,null))[_0x1d85('0x43')](handleError(_0x50e610,null));};exports[_0x1d85('0x58')]=function(_0x1c3130,_0x4a39b1,_0x7f18d1){var _0x495196={'raw':!![],'where':{}};var _0x415d73={};var _0x268684={'count':0x0,'rows':[]};return db[_0x1d85('0x2e')]['findOne']({'where':{'id':_0x1c3130['params']['id']}})['then'](handleEntityNotFound(_0x4a39b1,null))['then'](function(_0x5b3b0a){if(_0x5b3b0a){_0x415d73[_0x1d85('0x31')]=_[_0x1d85('0x46')](db[_0x1d85('0x59')][_0x1d85('0x47')]);_0x415d73[_0x1d85('0x32')]=_[_0x1d85('0x46')](_0x1c3130['query']);_0x415d73[_0x1d85('0x33')]=_[_0x1d85('0x34')](_0x415d73[_0x1d85('0x31')],_0x415d73['query']);_0x495196[_0x1d85('0x35')]=_[_0x1d85('0x34')](_0x415d73[_0x1d85('0x31')],qs[_0x1d85('0x36')](_0x1c3130[_0x1d85('0x32')][_0x1d85('0x36')]));_0x495196[_0x1d85('0x35')]=_0x495196[_0x1d85('0x35')][_0x1d85('0x37')]?_0x495196[_0x1d85('0x35')]:_0x415d73['model'];if(!_0x1c3130['query'][_0x1d85('0x5a')](_0x1d85('0x5b'))){_0x495196[_0x1d85('0x1b')]=qs[_0x1d85('0x1b')](_0x1c3130[_0x1d85('0x32')]['limit']);_0x495196[_0x1d85('0x19')]=qs[_0x1d85('0x19')](_0x1c3130[_0x1d85('0x32')]['offset']);}_0x495196['order']=qs[_0x1d85('0x39')](_0x1c3130[_0x1d85('0x32')][_0x1d85('0x39')]);_0x495196[_0x1d85('0x3a')]=qs['filters'](_['pick'](_0x1c3130['query'],_0x415d73[_0x1d85('0x33')]));_0x495196[_0x1d85('0x3a')][_0x1d85('0x5c')]=_0x5b3b0a['id'];if(_0x1c3130[_0x1d85('0x32')]['filter']){_0x495196[_0x1d85('0x3a')]=_[_0x1d85('0x3e')](_0x495196['where'],{'$or':_[_0x1d85('0x2d')](_0x495196[_0x1d85('0x35')],function(_0x13ae06){var _0xf02a7f={};_0xf02a7f[_0x13ae06]={'$like':'%'+_0x1c3130[_0x1d85('0x32')][_0x1d85('0x3c')]+'%'};return _0xf02a7f;})});}_0x495196=_[_0x1d85('0x3e')]({},_0x495196,_0x1c3130[_0x1d85('0x3f')]);return db[_0x1d85('0x59')]['count']({'where':_0x495196['where']})[_0x1d85('0x23')](function(_0x46f924){_0x268684[_0x1d85('0x1c')]=_0x46f924;if(_0x1c3130['query'][_0x1d85('0x40')]){_0x495196[_0x1d85('0x48')]=[{'all':!![]}];}return db['CmHopper'][_0x1d85('0x41')](_0x495196);})[_0x1d85('0x23')](function(_0x22f0ed){_0x268684[_0x1d85('0x42')]=_0x22f0ed;return _0x268684;});}})[_0x1d85('0x23')](respondWithFilteredResult(_0x4a39b1,_0x495196))['catch'](handleError(_0x4a39b1,null));};exports['getHopperHistories']=function(_0x42a93b,_0x48ed5c,_0x1f8245){var _0x9434ab={'raw':!![],'where':{}};var _0x248dd0={};var _0x218d30={'count':0x0,'rows':[]};return db[_0x1d85('0x2e')][_0x1d85('0x5d')]({'where':{'id':_0x42a93b[_0x1d85('0x45')]['id']}})[_0x1d85('0x23')](handleEntityNotFound(_0x48ed5c,null))[_0x1d85('0x23')](function(_0x2156ca){if(_0x2156ca){_0x248dd0[_0x1d85('0x31')]=_[_0x1d85('0x46')](db[_0x1d85('0x5e')][_0x1d85('0x47')]);_0x248dd0[_0x1d85('0x32')]=_[_0x1d85('0x46')](_0x42a93b[_0x1d85('0x32')]);_0x248dd0['filters']=_[_0x1d85('0x34')](_0x248dd0[_0x1d85('0x31')],_0x248dd0['query']);_0x9434ab['attributes']=_[_0x1d85('0x34')](_0x248dd0[_0x1d85('0x31')],qs[_0x1d85('0x36')](_0x42a93b[_0x1d85('0x32')][_0x1d85('0x36')]));_0x9434ab[_0x1d85('0x35')]=_0x9434ab[_0x1d85('0x35')][_0x1d85('0x37')]?_0x9434ab['attributes']:_0x248dd0[_0x1d85('0x31')];if(!_0x42a93b[_0x1d85('0x32')][_0x1d85('0x5a')](_0x1d85('0x5b'))){_0x9434ab[_0x1d85('0x1b')]=qs[_0x1d85('0x1b')](_0x42a93b[_0x1d85('0x32')]['limit']);_0x9434ab[_0x1d85('0x19')]=qs[_0x1d85('0x19')](_0x42a93b[_0x1d85('0x32')][_0x1d85('0x19')]);}_0x9434ab[_0x1d85('0x38')]=qs[_0x1d85('0x39')](_0x42a93b['query']['sort']);_0x9434ab[_0x1d85('0x3a')]=qs['filters'](_[_0x1d85('0x3b')](_0x42a93b['query'],_0x248dd0['filters']));_0x9434ab[_0x1d85('0x3a')]['CampaignId']=_0x2156ca['id'];if(_0x42a93b[_0x1d85('0x32')][_0x1d85('0x3c')]){_0x9434ab['where']=_[_0x1d85('0x3e')](_0x9434ab['where'],{'$or':_['map'](_0x9434ab[_0x1d85('0x35')],function(_0x462437){var _0x267be={};_0x267be[_0x462437]={'$like':'%'+_0x42a93b['query'][_0x1d85('0x3c')]+'%'};return _0x267be;})});}_0x9434ab=_['merge']({},_0x9434ab,_0x42a93b['options']);return db['CmHopperHistory'][_0x1d85('0x1c')]({'where':_0x9434ab[_0x1d85('0x3a')]})[_0x1d85('0x23')](function(_0x1a6d17){_0x218d30[_0x1d85('0x1c')]=_0x1a6d17;if(_0x42a93b[_0x1d85('0x32')]['includeAll']){_0x9434ab['include']=[{'all':!![]}];}return db[_0x1d85('0x5e')]['findAll'](_0x9434ab);})[_0x1d85('0x23')](function(_0x21b8e4){_0x218d30['rows']=_0x21b8e4;return _0x218d30;});}})[_0x1d85('0x23')](respondWithFilteredResult(_0x48ed5c,_0x9434ab))[_0x1d85('0x43')](handleError(_0x48ed5c,null));};exports[_0x1d85('0x5f')]=function(_0x3f2ab2,_0xae2637,_0x680dd7){var _0x31a75c={'raw':!![],'where':{}};var _0x3f9771={};var _0x379eb4={'count':0x0,'rows':[]};return db['Campaign'][_0x1d85('0x5d')]({'where':{'id':_0x3f2ab2['params']['id']}})[_0x1d85('0x23')](handleEntityNotFound(_0xae2637,null))['then'](function(_0xdb505c){if(_0xdb505c){_0x3f9771['model']=_[_0x1d85('0x46')](db[_0x1d85('0x60')][_0x1d85('0x47')]);_0x3f9771['query']=_[_0x1d85('0x46')](_0x3f2ab2['query']);_0x3f9771[_0x1d85('0x33')]=_['intersection'](_0x3f9771[_0x1d85('0x31')],_0x3f9771[_0x1d85('0x32')]);_0x31a75c[_0x1d85('0x35')]=_[_0x1d85('0x34')](_0x3f9771[_0x1d85('0x31')],qs[_0x1d85('0x36')](_0x3f2ab2['query'][_0x1d85('0x36')]));_0x31a75c['attributes']=_0x31a75c[_0x1d85('0x35')][_0x1d85('0x37')]?_0x31a75c[_0x1d85('0x35')]:_0x3f9771[_0x1d85('0x31')];if(!_0x3f2ab2[_0x1d85('0x32')][_0x1d85('0x5a')](_0x1d85('0x5b'))){_0x31a75c[_0x1d85('0x1b')]=qs[_0x1d85('0x1b')](_0x3f2ab2[_0x1d85('0x32')][_0x1d85('0x1b')]);_0x31a75c[_0x1d85('0x19')]=qs['offset'](_0x3f2ab2[_0x1d85('0x32')][_0x1d85('0x19')]);}_0x31a75c[_0x1d85('0x38')]=qs[_0x1d85('0x39')](_0x3f2ab2['query'][_0x1d85('0x39')]);_0x31a75c['where']=qs['filters'](_[_0x1d85('0x3b')](_0x3f2ab2[_0x1d85('0x32')],_0x3f9771[_0x1d85('0x33')]));_0x31a75c[_0x1d85('0x3a')][_0x1d85('0x5c')]=_0xdb505c['id'];if(_0x3f2ab2['query'][_0x1d85('0x3c')]){_0x31a75c[_0x1d85('0x3a')]=_[_0x1d85('0x3e')](_0x31a75c[_0x1d85('0x3a')],{'$or':_[_0x1d85('0x2d')](_0x31a75c[_0x1d85('0x35')],function(_0x48b38b){var _0x4b94c7={};_0x4b94c7[_0x48b38b]={'$like':'%'+_0x3f2ab2[_0x1d85('0x32')][_0x1d85('0x3c')]+'%'};return _0x4b94c7;})});}_0x31a75c=_[_0x1d85('0x3e')]({},_0x31a75c,_0x3f2ab2[_0x1d85('0x3f')]);return db[_0x1d85('0x60')][_0x1d85('0x1c')]({'where':_0x31a75c[_0x1d85('0x3a')]})[_0x1d85('0x23')](function(_0x475379){_0x379eb4[_0x1d85('0x1c')]=_0x475379;if(_0x3f2ab2['query'][_0x1d85('0x40')]){_0x31a75c[_0x1d85('0x48')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x1d85('0x41')](_0x31a75c);})['then'](function(_0x4bcdac){_0x379eb4[_0x1d85('0x42')]=_0x4bcdac;return _0x379eb4;});}})[_0x1d85('0x23')](respondWithFilteredResult(_0xae2637,_0x31a75c))[_0x1d85('0x43')](handleError(_0xae2637,null));};exports['getHopperBlacks']=function(_0xea65e4,_0x912c54,_0x493b5a){var _0x3eb9b3={'raw':!![],'where':{}};var _0x33eca4={};var _0x24d3e5={'count':0x0,'rows':[]};return db['Campaign'][_0x1d85('0x5d')]({'where':{'id':_0xea65e4[_0x1d85('0x45')]['id']}})['then'](handleEntityNotFound(_0x912c54,null))[_0x1d85('0x23')](function(_0x5dd7b7){if(_0x5dd7b7){_0x33eca4[_0x1d85('0x31')]=_['keys'](db['CmHopperBlack'][_0x1d85('0x47')]);_0x33eca4[_0x1d85('0x32')]=_[_0x1d85('0x46')](_0xea65e4[_0x1d85('0x32')]);_0x33eca4[_0x1d85('0x33')]=_['intersection'](_0x33eca4['model'],_0x33eca4[_0x1d85('0x32')]);_0x3eb9b3['attributes']=_[_0x1d85('0x34')](_0x33eca4[_0x1d85('0x31')],qs[_0x1d85('0x36')](_0xea65e4[_0x1d85('0x32')]['fields']));_0x3eb9b3['attributes']=_0x3eb9b3[_0x1d85('0x35')][_0x1d85('0x37')]?_0x3eb9b3[_0x1d85('0x35')]:_0x33eca4[_0x1d85('0x31')];if(!_0xea65e4[_0x1d85('0x32')][_0x1d85('0x5a')](_0x1d85('0x5b'))){_0x3eb9b3[_0x1d85('0x1b')]=qs[_0x1d85('0x1b')](_0xea65e4[_0x1d85('0x32')]['limit']);_0x3eb9b3[_0x1d85('0x19')]=qs['offset'](_0xea65e4[_0x1d85('0x32')][_0x1d85('0x19')]);}_0x3eb9b3['order']=qs['sort'](_0xea65e4['query'][_0x1d85('0x39')]);_0x3eb9b3['where']=qs[_0x1d85('0x33')](_[_0x1d85('0x3b')](_0xea65e4[_0x1d85('0x32')],_0x33eca4[_0x1d85('0x33')]));_0x3eb9b3[_0x1d85('0x3a')][_0x1d85('0x5c')]=_0x5dd7b7['id'];if(_0xea65e4[_0x1d85('0x32')][_0x1d85('0x3c')]){_0x3eb9b3['where']=_['merge'](_0x3eb9b3[_0x1d85('0x3a')],{'$or':_[_0x1d85('0x2d')](_0x3eb9b3[_0x1d85('0x35')],function(_0x592552){var _0x3c44bd={};_0x3c44bd[_0x592552]={'$like':'%'+_0xea65e4[_0x1d85('0x32')][_0x1d85('0x3c')]+'%'};return _0x3c44bd;})});}_0x3eb9b3=_[_0x1d85('0x3e')]({},_0x3eb9b3,_0xea65e4[_0x1d85('0x3f')]);return db['CmHopperBlack'][_0x1d85('0x1c')]({'where':_0x3eb9b3['where']})[_0x1d85('0x23')](function(_0x479d23){_0x24d3e5[_0x1d85('0x1c')]=_0x479d23;if(_0xea65e4[_0x1d85('0x32')]['includeAll']){_0x3eb9b3[_0x1d85('0x48')]=[{'all':!![]}];}return db[_0x1d85('0x61')]['findAll'](_0x3eb9b3);})[_0x1d85('0x23')](function(_0xe57733){_0x24d3e5['rows']=_0xe57733;return _0x24d3e5;});}})[_0x1d85('0x23')](respondWithFilteredResult(_0x912c54,_0x3eb9b3))[_0x1d85('0x43')](handleError(_0x912c54,null));};exports[_0x1d85('0x62')]=function(_0x443a8c,_0x33e5f2,_0x119030){var _0x5a7ee4={};var _0x2025cd={};var _0x174898;var _0x1a09f9;return db[_0x1d85('0x2e')][_0x1d85('0x5d')]({'where':{'id':_0x443a8c[_0x1d85('0x45')]['id']}})[_0x1d85('0x23')](handleEntityNotFound(_0x33e5f2,null))[_0x1d85('0x23')](function(_0x3c7ca6){if(_0x3c7ca6){_0x174898=_0x3c7ca6;_0x2025cd[_0x1d85('0x31')]=_['keys'](db['CmList'][_0x1d85('0x47')]);_0x2025cd[_0x1d85('0x32')]=_[_0x1d85('0x46')](_0x443a8c[_0x1d85('0x32')]);_0x2025cd[_0x1d85('0x33')]=_['intersection'](_0x2025cd[_0x1d85('0x31')],_0x2025cd['query']);_0x5a7ee4['attributes']=_[_0x1d85('0x34')](_0x2025cd[_0x1d85('0x31')],qs[_0x1d85('0x36')](_0x443a8c[_0x1d85('0x32')]['fields']));_0x5a7ee4[_0x1d85('0x35')]=_0x5a7ee4['attributes'][_0x1d85('0x37')]?_0x5a7ee4['attributes']:_0x2025cd['model'];_0x5a7ee4[_0x1d85('0x38')]=qs[_0x1d85('0x39')](_0x443a8c[_0x1d85('0x32')][_0x1d85('0x39')]);_0x5a7ee4[_0x1d85('0x3a')]=qs[_0x1d85('0x33')](_[_0x1d85('0x3b')](_0x443a8c[_0x1d85('0x32')],_0x2025cd[_0x1d85('0x33')]));if(_0x443a8c[_0x1d85('0x32')]['filter']){_0x5a7ee4[_0x1d85('0x3a')]=_[_0x1d85('0x3e')](_0x5a7ee4[_0x1d85('0x3a')],{'$or':_[_0x1d85('0x2d')](_0x5a7ee4['attributes'],function(_0x495e4f){var _0x5ba7d2={};_0x5ba7d2[_0x495e4f]={'$like':'%'+_0x443a8c[_0x1d85('0x32')][_0x1d85('0x3c')]+'%'};return _0x5ba7d2;})});}_0x5a7ee4=_[_0x1d85('0x3e')]({},_0x5a7ee4,_0x443a8c['options']);return _0x174898['getLists'](_0x5a7ee4);}})['then'](function(_0x50d7f6){if(_0x50d7f6){_0x1a09f9=_0x50d7f6['length'];if(!_0x443a8c[_0x1d85('0x32')][_0x1d85('0x5a')](_0x1d85('0x5b'))){_0x5a7ee4[_0x1d85('0x1b')]=qs['limit'](_0x443a8c[_0x1d85('0x32')][_0x1d85('0x1b')]);_0x5a7ee4['offset']=qs['offset'](_0x443a8c[_0x1d85('0x32')]['offset']);}return _0x174898[_0x1d85('0x62')](_0x5a7ee4);}})['then'](function(_0x27a806){if(_0x27a806){return _0x27a806?{'count':_0x1a09f9,'rows':_0x27a806}:null;}})['then'](respondWithResult(_0x33e5f2,null))[_0x1d85('0x43')](handleError(_0x33e5f2,null));};exports[_0x1d85('0x63')]=function(_0x530e3c,_0x2fdbb3,_0x2eee62){var _0x13f38c,_0x597822;return db[_0x1d85('0x2e')][_0x1d85('0x49')]({'where':{'id':_0x530e3c['params']['id']}})['then'](handleEntityNotFound(_0x2fdbb3,null))['then'](function(_0x322105){if(_0x322105){_0x597822=_0x322105;return _0x322105['addLists'](_0x530e3c[_0x1d85('0x4b')][_0x1d85('0x64')],_[_0x1d85('0x55')](_0x530e3c[_0x1d85('0x4b')],[_0x1d85('0x64'),'id'])||{});}return null;})[_0x1d85('0x65')](function(_0x499a73){var _0x2a0722;_0x13f38c=_0x499a73||[];var _0x374c32=[];if(_0x499a73){for(var _0x147077=0x0;_0x147077<_0x499a73[_0x1d85('0x37')];_0x147077+=0x1){var _0x1c8888=_0x499a73[_0x147077][_0x1d85('0x25')]({'plain':!![]});_0x597822[_0x1d85('0x66')]=_0x530e3c[_0x1d85('0x4b')]['dialCheckDuplicateType']?_0x530e3c[_0x1d85('0x4b')]['dialCheckDuplicateType']:_0x597822[_0x1d85('0x66')];switch(_0x597822[_0x1d85('0x66')]){case'always':_0x2a0722=squel[_0x1d85('0x67')]()['into'](_0x1d85('0x68'))[_0x1d85('0x69')](['phone',_0x1d85('0x6a'),_0x1d85('0x6b'),_0x1d85('0x6c'),'CampaignId',_0x1d85('0x56'),'updatedAt'],squel[_0x1d85('0x6d')]()['field'](_0x1d85('0x6e'),_0x1d85('0x6e'))[_0x1d85('0x6f')]('NOW()',_0x1d85('0x6a'))[_0x1d85('0x6f')]('id',_0x1d85('0x6b'))['field'](_0x1c8888[_0x1d85('0x70')]['toString'](),_0x1d85('0x6c'))[_0x1d85('0x6f')](_0x530e3c['params']['id'][_0x1d85('0x71')](),_0x1d85('0x5c'))[_0x1d85('0x6f')](_0x1d85('0x72'),'createdAt')[_0x1d85('0x6f')](_0x1d85('0x72'),_0x1d85('0x57'))[_0x1d85('0x73')](_0x1d85('0x74'))[_0x1d85('0x3a')](_0x1d85('0x75'))[_0x1d85('0x3a')]('ListId\x20=\x20?',_0x1c8888['CmListId']['toString']())['where'](_0x1d85('0x76'))[_0x1d85('0x3a')](_0x1d85('0x77'),squel['select']()[_0x1d85('0x6f')](_0x1d85('0x78'))[_0x1d85('0x73')](_0x1d85('0x79'))['where']('CampaignId\x20=\x20?',_0x530e3c[_0x1d85('0x45')]['id']['toString']()))[_0x1d85('0x3a')](_0x1d85('0x77'),squel['select']()['field'](_0x1d85('0x7a'))[_0x1d85('0x73')](_0x1d85('0x68'))[_0x1d85('0x3a')]('CampaignId\x20=\x20?',_0x530e3c['params']['id'][_0x1d85('0x71')]())))[_0x1d85('0x71')]();break;case _0x1d85('0x7b'):_0x2a0722=squel[_0x1d85('0x67')]()[_0x1d85('0x7c')](_0x1d85('0x68'))[_0x1d85('0x69')]([_0x1d85('0x6e'),'scheduledAt',_0x1d85('0x6b'),_0x1d85('0x6c'),_0x1d85('0x5c'),_0x1d85('0x56'),_0x1d85('0x57')],squel[_0x1d85('0x6d')]()[_0x1d85('0x6f')](_0x1d85('0x6e'),_0x1d85('0x6e'))[_0x1d85('0x6f')](_0x1d85('0x72'),'scheduledAt')['field']('id',_0x1d85('0x6b'))['field'](_0x1c8888[_0x1d85('0x70')]['toString'](),_0x1d85('0x6c'))[_0x1d85('0x6f')](_0x530e3c[_0x1d85('0x45')]['id'][_0x1d85('0x71')](),_0x1d85('0x5c'))[_0x1d85('0x6f')](_0x1d85('0x72'),_0x1d85('0x56'))[_0x1d85('0x6f')](_0x1d85('0x72'),'updatedAt')[_0x1d85('0x73')](_0x1d85('0x74'))[_0x1d85('0x3a')]('deletedAt\x20IS\x20NULL')[_0x1d85('0x3a')]('ListId\x20=\x20?',_0x1c8888['CmListId'][_0x1d85('0x71')]())[_0x1d85('0x3a')](_0x1d85('0x76'))[_0x1d85('0x3a')](_0x1d85('0x77'),squel[_0x1d85('0x6d')]()[_0x1d85('0x6f')](_0x1d85('0x7a'))[_0x1d85('0x73')](_0x1d85('0x68'))[_0x1d85('0x3a')](_0x1d85('0x7d'),_0x530e3c[_0x1d85('0x45')]['id']['toString']())))[_0x1d85('0x71')]();break;default:_0x2a0722=squel[_0x1d85('0x67')]()['into'](_0x1d85('0x68'))[_0x1d85('0x69')](['phone',_0x1d85('0x6a'),'ContactId',_0x1d85('0x6c'),_0x1d85('0x5c'),_0x1d85('0x56'),'updatedAt'],squel[_0x1d85('0x6d')]()[_0x1d85('0x6f')](_0x1d85('0x6e'),_0x1d85('0x6e'))[_0x1d85('0x6f')](_0x1d85('0x72'),_0x1d85('0x6a'))[_0x1d85('0x6f')]('id','ContactId')[_0x1d85('0x6f')](_0x1c8888[_0x1d85('0x70')]['toString'](),_0x1d85('0x6c'))[_0x1d85('0x6f')](_0x530e3c[_0x1d85('0x45')]['id'][_0x1d85('0x71')](),_0x1d85('0x5c'))[_0x1d85('0x6f')](_0x1d85('0x72'),_0x1d85('0x56'))['field'](_0x1d85('0x72'),_0x1d85('0x57'))[_0x1d85('0x73')](_0x1d85('0x74'))['where'](_0x1d85('0x75'))[_0x1d85('0x3a')](_0x1d85('0x7e'),_0x1c8888[_0x1d85('0x70')]['toString']())[_0x1d85('0x3a')](_0x1d85('0x76')))[_0x1d85('0x71')]();}_0x374c32[_0x1d85('0x7f')](db[_0x1d85('0x80')][_0x1d85('0x32')](_0x2a0722));}return BPromise[_0x1d85('0x81')](_0x374c32);}})[_0x1d85('0x23')](function(){return _0x13f38c;})[_0x1d85('0x23')](respondWithResult(_0x2fdbb3,null))['catch'](handleError(_0x2fdbb3,null));};exports[_0x1d85('0x82')]=function(_0x11595a,_0x7f1a82,_0x4f13bd){return db[_0x1d85('0x2e')][_0x1d85('0x49')]({'where':{'id':_0x11595a['params']['id']}})[_0x1d85('0x23')](handleEntityNotFound(_0x7f1a82,null))[_0x1d85('0x23')](function(_0x2a4fc4){if(_0x2a4fc4){return _0x2a4fc4[_0x1d85('0x82')](_0x11595a[_0x1d85('0x32')][_0x1d85('0x64')]);}})[_0x1d85('0x23')](function(_0x39a078){if(_0x39a078){return db[_0x1d85('0x59')]['destroy']({'where':{'ListId':_0x11595a[_0x1d85('0x32')][_0x1d85('0x64')],'CampaignId':_0x11595a[_0x1d85('0x45')]['id']}})[_0x1d85('0x23')](function(){return _0x39a078;});}})[_0x1d85('0x23')](respondWithStatusCode(_0x7f1a82,null))[_0x1d85('0x43')](handleError(_0x7f1a82,null));};exports[_0x1d85('0x83')]=function(_0xa82ac,_0x5162b7,_0x42c2d8){var _0x461a4d={};var _0x3dfe12={};var _0x490880;var _0x3fd269;return db['Campaign']['findOne']({'where':{'id':_0xa82ac[_0x1d85('0x45')]['id']}})['then'](handleEntityNotFound(_0x5162b7,null))[_0x1d85('0x23')](function(_0x59c202){if(_0x59c202){_0x490880=_0x59c202;_0x3dfe12[_0x1d85('0x31')]=_[_0x1d85('0x46')](db['CmList'][_0x1d85('0x47')]);_0x3dfe12[_0x1d85('0x32')]=_[_0x1d85('0x46')](_0xa82ac[_0x1d85('0x32')]);_0x3dfe12[_0x1d85('0x33')]=_[_0x1d85('0x34')](_0x3dfe12[_0x1d85('0x31')],_0x3dfe12[_0x1d85('0x32')]);_0x461a4d[_0x1d85('0x35')]=_[_0x1d85('0x34')](_0x3dfe12[_0x1d85('0x31')],qs[_0x1d85('0x36')](_0xa82ac['query']['fields']));_0x461a4d[_0x1d85('0x35')]=_0x461a4d[_0x1d85('0x35')][_0x1d85('0x37')]?_0x461a4d[_0x1d85('0x35')]:_0x3dfe12['model'];_0x461a4d[_0x1d85('0x38')]=qs['sort'](_0xa82ac['query']['sort']);_0x461a4d[_0x1d85('0x3a')]=qs['filters'](_['pick'](_0xa82ac['query'],_0x3dfe12[_0x1d85('0x33')]));if(_0xa82ac['query'][_0x1d85('0x3c')]){_0x461a4d[_0x1d85('0x3a')]=_[_0x1d85('0x3e')](_0x461a4d[_0x1d85('0x3a')],{'$or':_[_0x1d85('0x2d')](_0x461a4d[_0x1d85('0x35')],function(_0x1d7a89){var _0x3dba26={};_0x3dba26[_0x1d7a89]={'$like':'%'+_0xa82ac[_0x1d85('0x32')][_0x1d85('0x3c')]+'%'};return _0x3dba26;})});}_0x461a4d=_[_0x1d85('0x3e')]({},_0x461a4d,_0xa82ac[_0x1d85('0x3f')]);return _0x490880[_0x1d85('0x83')](_0x461a4d);}})[_0x1d85('0x23')](function(_0x27aba4){if(_0x27aba4){_0x3fd269=_0x27aba4[_0x1d85('0x37')];if(!_0xa82ac['query'][_0x1d85('0x5a')](_0x1d85('0x5b'))){_0x461a4d[_0x1d85('0x1b')]=qs[_0x1d85('0x1b')](_0xa82ac['query'][_0x1d85('0x1b')]);_0x461a4d['offset']=qs[_0x1d85('0x19')](_0xa82ac[_0x1d85('0x32')][_0x1d85('0x19')]);}return _0x490880[_0x1d85('0x83')](_0x461a4d);}})['then'](function(_0x301515){if(_0x301515){return _0x301515?{'count':_0x3fd269,'rows':_0x301515}:null;}})[_0x1d85('0x23')](respondWithResult(_0x5162b7,null))['catch'](handleError(_0x5162b7,null));};exports[_0x1d85('0x84')]=function(_0x5166d3,_0x16d6fe,_0x9254a5){var _0x545aa5,_0x379f75;return db[_0x1d85('0x2e')][_0x1d85('0x49')]({'where':{'id':_0x5166d3['params']['id']}})[_0x1d85('0x23')](handleEntityNotFound(_0x16d6fe,null))[_0x1d85('0x23')](function(_0x11bec3){if(_0x11bec3){_0x379f75=_0x11bec3;return _0x11bec3['addBlackLists'](_0x5166d3[_0x1d85('0x4b')][_0x1d85('0x64')],_[_0x1d85('0x55')](_0x5166d3[_0x1d85('0x4b')],[_0x1d85('0x64'),'id'])||{});}return null;})[_0x1d85('0x65')](function(_0xe77a6d){var _0x10ba8a;_0x545aa5=_0xe77a6d||[];var _0x2d7e52=[];if(_0xe77a6d){for(var _0x2ccf5d=0x0;_0x2ccf5d<_0xe77a6d['length'];_0x2ccf5d+=0x1){var _0x16bc0f=_0xe77a6d[_0x2ccf5d][_0x1d85('0x25')]({'plain':!![]});_0x10ba8a=squel['insert']()['into']('cm_hopper_black')['fromQuery'](['phone','ContactId',_0x1d85('0x6c'),_0x1d85('0x5c'),_0x1d85('0x56'),'updatedAt'],squel[_0x1d85('0x6d')]()[_0x1d85('0x6f')](_0x1d85('0x6e'),_0x1d85('0x6e'))[_0x1d85('0x6f')]('id',_0x1d85('0x6b'))['field'](_0x16bc0f['CmListId']['toString'](),'ListId')[_0x1d85('0x6f')](_0x5166d3['params']['id'][_0x1d85('0x71')](),_0x1d85('0x5c'))[_0x1d85('0x6f')](_0x1d85('0x72'),'createdAt')['field'](_0x1d85('0x72'),_0x1d85('0x57'))[_0x1d85('0x73')]('cm_contacts')[_0x1d85('0x3a')](_0x1d85('0x75'))[_0x1d85('0x3a')](_0x1d85('0x7e'),_0x16bc0f[_0x1d85('0x70')]['toString']())[_0x1d85('0x3a')](_0x1d85('0x76')))[_0x1d85('0x71')]();_0x2d7e52[_0x1d85('0x7f')](db[_0x1d85('0x80')][_0x1d85('0x32')](_0x10ba8a));}return BPromise[_0x1d85('0x81')](_0x2d7e52);}})[_0x1d85('0x23')](function(){return _0x545aa5;})[_0x1d85('0x23')](respondWithResult(_0x16d6fe,null))[_0x1d85('0x43')](handleError(_0x16d6fe,null));};exports[_0x1d85('0x85')]=function(_0x1391da,_0xca9dcd,_0x58787c){return db['Campaign'][_0x1d85('0x49')]({'where':{'id':_0x1391da['params']['id']}})['then'](handleEntityNotFound(_0xca9dcd,null))['then'](function(_0x3ab0f8){if(_0x3ab0f8){return _0x3ab0f8[_0x1d85('0x85')](_0x1391da[_0x1d85('0x32')][_0x1d85('0x64')]);}})[_0x1d85('0x23')](function(_0x373fc0){if(_0x373fc0){return db[_0x1d85('0x61')][_0x1d85('0x24')]({'where':{'ListId':_0x1391da[_0x1d85('0x32')][_0x1d85('0x64')],'CampaignId':_0x1391da[_0x1d85('0x45')]['id']}})['then'](function(){return _0x373fc0;});}})[_0x1d85('0x23')](respondWithStatusCode(_0xca9dcd,null))['catch'](handleError(_0xca9dcd,null));}; \ No newline at end of file +var _0x66fe=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','getHoppers','findOne','CmHopper','nolimit','order','CampaignId','rows','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','fromQuery','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','select','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_hopper','CampaignId\x20=\x20?','into','sequelize','getBlackLists','addBlackLists','push','all','removeBlackLists','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','Campaign','findAll','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x403cff,_0x1cf463){var _0x5a7c56=function(_0x1bab9d){while(--_0x1bab9d){_0x403cff['push'](_0x403cff['shift']());}};_0x5a7c56(++_0x1cf463);}(_0x66fe,0xbd));var _0xe66f=function(_0xd51d25,_0x4bf1d4){_0xd51d25=_0xd51d25-0x0;var _0x1829de=_0x66fe[_0xd51d25];return _0x1829de;};'use strict';var emlformat=require(_0xe66f('0x0'));var rimraf=require(_0xe66f('0x1'));var zipdir=require(_0xe66f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe66f('0x3'));var BPromise=require(_0xe66f('0x4'));var Mustache=require(_0xe66f('0x5'));var util=require('util');var path=require(_0xe66f('0x6'));var sox=require('sox');var csv=require(_0xe66f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe66f('0x8'));var _=require('lodash');var squel=require(_0xe66f('0x9'));var crypto=require(_0xe66f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe66f('0xb'));var toCsv=require(_0xe66f('0x7'));var querystring=require(_0xe66f('0xc'));var Papa=require(_0xe66f('0xd'));var Redis=require(_0xe66f('0xe'));var authService=require(_0xe66f('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xe66f('0x10'));var hardwareService=require(_0xe66f('0x11'));var logger=require(_0xe66f('0x12'))(_0xe66f('0x13'));var utils=require('../../config/utils');var config=require(_0xe66f('0x14'));var licenseUtil=require(_0xe66f('0x15'));var db=require(_0xe66f('0x16'))['db'];function respondWithStatusCode(_0xb10009,_0xae3039){_0xae3039=_0xae3039||0xcc;return function(_0x182141){if(_0x182141){return _0xb10009[_0xe66f('0x17')](_0xae3039);}return _0xb10009[_0xe66f('0x18')](_0xae3039)[_0xe66f('0x19')]();};}function respondWithResult(_0x1f30e3,_0x2d703f){_0x2d703f=_0x2d703f||0xc8;return function(_0x452ead){if(_0x452ead){return _0x1f30e3[_0xe66f('0x18')](_0x2d703f)['json'](_0x452ead);}};}function respondWithFilteredResult(_0x4821f9,_0xff7df9){return function(_0x493c32){if(_0x493c32){var _0x2cfc7c=typeof _0xff7df9['offset']==='undefined'&&typeof _0xff7df9['limit']==='undefined';var _0x1dfccc=_0x493c32[_0xe66f('0x1a')];var _0x7ab38b=_0x2cfc7c?0x0:_0xff7df9[_0xe66f('0x1b')];var _0x3de346=_0x2cfc7c?_0x493c32[_0xe66f('0x1a')]:_0xff7df9['offset']+_0xff7df9[_0xe66f('0x1c')];var _0x31b741;if(_0x3de346>=_0x1dfccc){_0x3de346=_0x1dfccc;_0x31b741=0xc8;}else{_0x31b741=0xce;}_0x4821f9[_0xe66f('0x18')](_0x31b741);return _0x4821f9[_0xe66f('0x1d')]('Content-Range',_0x7ab38b+'-'+_0x3de346+'/'+_0x1dfccc)[_0xe66f('0x1e')](_0x493c32);}return null;};}function patchUpdates(_0x252a6a){return function(_0x26276e){try{jsonpatch['apply'](_0x26276e,_0x252a6a,!![]);}catch(_0x46cce9){return BPromise[_0xe66f('0x1f')](_0x46cce9);}return _0x26276e[_0xe66f('0x20')]();};}function saveUpdates(_0x49b26f,_0x598db3){return function(_0x53bfc0){if(_0x53bfc0){return _0x53bfc0[_0xe66f('0x21')](_0x49b26f)[_0xe66f('0x22')](function(_0x58dbaf){return _0x58dbaf;});}return null;};}function removeEntity(_0x29c55c,_0x3d999f){return function(_0x19a8eb){if(_0x19a8eb){return _0x19a8eb[_0xe66f('0x23')]()[_0xe66f('0x22')](function(){var _0x12cc9e=_0x19a8eb[_0xe66f('0x24')]({'plain':!![]});var _0x131f6d=_0xe66f('0x25');return db[_0xe66f('0x26')][_0xe66f('0x23')]({'where':{'type':_0x131f6d,'resourceId':_0x12cc9e['id']}})[_0xe66f('0x22')](function(){return _0x19a8eb;});})['then'](function(){_0x29c55c[_0xe66f('0x18')](0xcc)[_0xe66f('0x19')]();});}};}function handleEntityNotFound(_0x236fa5,_0xa3d5b0){return function(_0x2883ce){if(!_0x2883ce){_0x236fa5['sendStatus'](0x194);}return _0x2883ce;};}function handleError(_0x259358,_0x2bee17){_0x2bee17=_0x2bee17||0x1f4;return function(_0x40e135){logger[_0xe66f('0x27')](_0x40e135[_0xe66f('0x28')]);if(_0x40e135[_0xe66f('0x29')]){delete _0x40e135[_0xe66f('0x29')];}_0x259358[_0xe66f('0x18')](_0x2bee17)[_0xe66f('0x2a')](_0x40e135);};}exports[_0xe66f('0x2b')]=function(_0x7ab1e3,_0x5ee0c5){var _0x2e72f1={},_0x196d82={},_0x5770d3={'count':0x0,'rows':[]};var _0xb49700=_[_0xe66f('0x2c')](db['Campaign'][_0xe66f('0x2d')],function(_0x4a5152){return{'name':_0x4a5152[_0xe66f('0x2e')],'type':_0x4a5152['type'][_0xe66f('0x2f')]};});_0x196d82[_0xe66f('0x30')]=_[_0xe66f('0x2c')](_0xb49700,_0xe66f('0x29'));_0x196d82[_0xe66f('0x31')]=_[_0xe66f('0x32')](_0x7ab1e3[_0xe66f('0x31')]);_0x196d82[_0xe66f('0x33')]=_['intersection'](_0x196d82[_0xe66f('0x30')],_0x196d82[_0xe66f('0x31')]);_0x2e72f1['attributes']=_[_0xe66f('0x34')](_0x196d82[_0xe66f('0x30')],qs['fields'](_0x7ab1e3[_0xe66f('0x31')][_0xe66f('0x35')]));_0x2e72f1[_0xe66f('0x36')]=_0x2e72f1[_0xe66f('0x36')][_0xe66f('0x37')]?_0x2e72f1[_0xe66f('0x36')]:_0x196d82['model'];if(!_0x7ab1e3['query'][_0xe66f('0x38')]('nolimit')){_0x2e72f1[_0xe66f('0x1c')]=qs[_0xe66f('0x1c')](_0x7ab1e3[_0xe66f('0x31')][_0xe66f('0x1c')]);_0x2e72f1['offset']=qs[_0xe66f('0x1b')](_0x7ab1e3[_0xe66f('0x31')]['offset']);}_0x2e72f1['order']=qs['sort'](_0x7ab1e3[_0xe66f('0x31')][_0xe66f('0x39')]);_0x2e72f1[_0xe66f('0x3a')]=qs[_0xe66f('0x33')](_[_0xe66f('0x3b')](_0x7ab1e3[_0xe66f('0x31')],_0x196d82[_0xe66f('0x33')]),_0xb49700);if(_0x7ab1e3['query'][_0xe66f('0x3c')]){_0x2e72f1[_0xe66f('0x3a')]=_[_0xe66f('0x3d')](_0x2e72f1[_0xe66f('0x3a')],{'$or':_[_0xe66f('0x2c')](_0xb49700,function(_0x7e3c1e){if(_0x7e3c1e[_0xe66f('0x3e')]!==_0xe66f('0x3f')){var _0x5e4c19={};_0x5e4c19[_0x7e3c1e[_0xe66f('0x29')]]={'$like':'%'+_0x7ab1e3[_0xe66f('0x31')][_0xe66f('0x3c')]+'%'};return _0x5e4c19;}})});}_0x2e72f1=_['merge']({},_0x2e72f1,_0x7ab1e3[_0xe66f('0x40')]);var _0x184b4a={'where':_0x2e72f1[_0xe66f('0x3a')]};return db['Campaign'][_0xe66f('0x1a')](_0x184b4a)['then'](function(_0x1ba3cd){_0x5770d3[_0xe66f('0x1a')]=_0x1ba3cd;if(_0x7ab1e3[_0xe66f('0x31')][_0xe66f('0x41')]){_0x2e72f1[_0xe66f('0x42')]=[{'all':!![]}];}return db[_0xe66f('0x43')][_0xe66f('0x44')](_0x2e72f1);})['then'](function(_0xe26877){_0x5770d3['rows']=_0xe26877;return _0x5770d3;})[_0xe66f('0x22')](respondWithFilteredResult(_0x5ee0c5,_0x2e72f1))['catch'](handleError(_0x5ee0c5,null));};exports[_0xe66f('0x45')]=function(_0x25d3b8,_0x4fd2e0){var _0x261382={'raw':![],'where':{'id':_0x25d3b8[_0xe66f('0x46')]['id']}},_0x361cba={};_0x361cba[_0xe66f('0x30')]=_[_0xe66f('0x32')](db[_0xe66f('0x43')][_0xe66f('0x2d')]);_0x361cba[_0xe66f('0x31')]=_[_0xe66f('0x32')](_0x25d3b8[_0xe66f('0x31')]);_0x361cba[_0xe66f('0x33')]=_['intersection'](_0x361cba[_0xe66f('0x30')],_0x361cba[_0xe66f('0x31')]);_0x261382[_0xe66f('0x36')]=_[_0xe66f('0x34')](_0x361cba[_0xe66f('0x30')],qs[_0xe66f('0x35')](_0x25d3b8[_0xe66f('0x31')][_0xe66f('0x35')]));_0x261382['attributes']=_0x261382[_0xe66f('0x36')]['length']?_0x261382['attributes']:_0x361cba[_0xe66f('0x30')];if(_0x25d3b8[_0xe66f('0x31')][_0xe66f('0x41')]){_0x261382[_0xe66f('0x42')]=[{'all':!![]}];}_0x261382=_[_0xe66f('0x3d')]({},_0x261382,_0x25d3b8[_0xe66f('0x40')]);return db[_0xe66f('0x43')][_0xe66f('0x47')](_0x261382)[_0xe66f('0x22')](handleEntityNotFound(_0x4fd2e0,null))[_0xe66f('0x22')](respondWithResult(_0x4fd2e0,null))[_0xe66f('0x48')](handleError(_0x4fd2e0,null));};exports['create']=function(_0x4557fd,_0x4b5558){return db['Campaign'][_0xe66f('0x49')](_0x4557fd[_0xe66f('0x4a')],{})[_0xe66f('0x22')](function(_0x583e83){var _0x2fd16f=_0x4557fd[_0xe66f('0x4b')][_0xe66f('0x24')]({'plain':!![]});if(!_0x2fd16f)throw new Error(_0xe66f('0x4c'));if(_0x2fd16f[_0xe66f('0x4d')]==='user'){var _0x1e1773=_0x583e83[_0xe66f('0x24')]({'plain':!![]});var _0x1d731c=_0xe66f('0x25');return db[_0xe66f('0x4e')][_0xe66f('0x47')]({'where':{'name':_0x1d731c,'userProfileId':_0x2fd16f[_0xe66f('0x4f')]},'raw':!![]})[_0xe66f('0x22')](function(_0x52fc0c){if(_0x52fc0c&&_0x52fc0c[_0xe66f('0x50')]===0x0){return db[_0xe66f('0x26')][_0xe66f('0x49')]({'name':_0x1e1773[_0xe66f('0x29')],'resourceId':_0x1e1773['id'],'type':_0x52fc0c[_0xe66f('0x29')],'sectionId':_0x52fc0c['id']},{})[_0xe66f('0x22')](function(){return _0x583e83;});}else{return _0x583e83;}})[_0xe66f('0x48')](function(_0x5ea7e9){logger['error'](_0xe66f('0x51'),_0x5ea7e9);throw _0x5ea7e9;});}return _0x583e83;})[_0xe66f('0x22')](respondWithResult(_0x4b5558,0xc9))['catch'](handleError(_0x4b5558,null));};exports[_0xe66f('0x52')]=function(_0xe8176c,_0x38286e){var _0x1fab8a={'where':{'id':_0xe8176c[_0xe66f('0x46')]['id']}},_0x26d6a0={};_0x26d6a0['model']=_[_0xe66f('0x32')](db[_0xe66f('0x43')][_0xe66f('0x2d')]);_0x1fab8a[_0xe66f('0x36')]=_[_0xe66f('0x34')](_0x26d6a0[_0xe66f('0x30')],qs[_0xe66f('0x35')](_0xe8176c[_0xe66f('0x31')][_0xe66f('0x35')]));_0x1fab8a[_0xe66f('0x36')]=_0x1fab8a[_0xe66f('0x36')][_0xe66f('0x37')]?_0x1fab8a[_0xe66f('0x36')]:_0x26d6a0[_0xe66f('0x30')];if(_0xe8176c[_0xe66f('0x31')]['includeAll']){_0x1fab8a['include']=[{'all':!![]}];}_0x1fab8a=_[_0xe66f('0x3d')]({},_0x1fab8a,_0xe8176c[_0xe66f('0x40')]);return db['Campaign']['find'](_0x1fab8a)[_0xe66f('0x22')](handleEntityNotFound(_0x38286e,null))[_0xe66f('0x22')](function(_0x29f483){if(_0x29f483){var _0x4ddc0b=_0x29f483['get']({'plain':!![]});_0x4ddc0b=qs[_0xe66f('0x53')](_0x4ddc0b,['id','createdAt',_0xe66f('0x54')]);_0xe8176c[_0xe66f('0x4a')]=_[_0xe66f('0x53')](_0xe8176c[_0xe66f('0x4a')],['id',_0xe66f('0x55'),_0xe66f('0x54')]);return db['Campaign']['create'](_[_0xe66f('0x3d')](_0x4ddc0b,_0xe8176c[_0xe66f('0x4a')]),{'include':_0xe8176c[_0xe66f('0x31')][_0xe66f('0x41')]?[{'all':!![]}]:undefined})[_0xe66f('0x22')](function(_0x4b3db3){var _0x27c493=_0xe8176c[_0xe66f('0x4b')]['get']({'plain':!![]});if(!_0x27c493)throw new Error(_0xe66f('0x4c'));if(_0x27c493['role']==='user'){var _0x1cf1ef=_0x4b3db3['get']({'plain':!![]});var _0x3618d6=_0xe66f('0x25');return db[_0xe66f('0x4e')][_0xe66f('0x47')]({'where':{'name':_0x3618d6,'userProfileId':_0x27c493[_0xe66f('0x4f')]},'raw':!![]})[_0xe66f('0x22')](function(_0x11183e){if(_0x11183e&&_0x11183e[_0xe66f('0x50')]===0x0){return db[_0xe66f('0x26')][_0xe66f('0x49')]({'name':_0x1cf1ef[_0xe66f('0x29')],'resourceId':_0x1cf1ef['id'],'type':_0x11183e['name'],'sectionId':_0x11183e['id']},{})[_0xe66f('0x22')](function(){return _0x4b3db3;});}else{return _0x4b3db3;}})[_0xe66f('0x48')](function(_0x1ce6f8){logger[_0xe66f('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ce6f8);throw _0x1ce6f8;});}return _0x4b3db3;});}})[_0xe66f('0x22')](respondWithResult(_0x38286e,0xc9))['catch'](handleError(_0x38286e,null));};exports[_0xe66f('0x21')]=function(_0x125b47,_0x3f815b){if(_0x125b47[_0xe66f('0x4a')]['id']){delete _0x125b47[_0xe66f('0x4a')]['id'];}return db[_0xe66f('0x43')][_0xe66f('0x47')]({'where':{'id':_0x125b47[_0xe66f('0x46')]['id']}})[_0xe66f('0x22')](handleEntityNotFound(_0x3f815b,null))[_0xe66f('0x22')](saveUpdates(_0x125b47[_0xe66f('0x4a')],null))['then'](respondWithResult(_0x3f815b,null))[_0xe66f('0x48')](handleError(_0x3f815b,null));};exports['destroy']=function(_0x212181,_0x1d167e){return db[_0xe66f('0x43')]['find']({'where':{'id':_0x212181[_0xe66f('0x46')]['id']}})[_0xe66f('0x22')](handleEntityNotFound(_0x1d167e,null))['then'](removeEntity(_0x1d167e,null))[_0xe66f('0x48')](handleError(_0x1d167e,null));};exports[_0xe66f('0x56')]=function(_0x260bf0,_0xe98ddd,_0xbd611d){var _0x38e3f9={'raw':!![],'where':{}};var _0x5bc011={};var _0x3ace02={'count':0x0,'rows':[]};return db[_0xe66f('0x43')][_0xe66f('0x57')]({'where':{'id':_0x260bf0[_0xe66f('0x46')]['id']}})[_0xe66f('0x22')](handleEntityNotFound(_0xe98ddd,null))[_0xe66f('0x22')](function(_0x23c954){if(_0x23c954){_0x5bc011['model']=_['keys'](db[_0xe66f('0x58')][_0xe66f('0x2d')]);_0x5bc011['query']=_[_0xe66f('0x32')](_0x260bf0[_0xe66f('0x31')]);_0x5bc011[_0xe66f('0x33')]=_['intersection'](_0x5bc011[_0xe66f('0x30')],_0x5bc011[_0xe66f('0x31')]);_0x38e3f9[_0xe66f('0x36')]=_[_0xe66f('0x34')](_0x5bc011[_0xe66f('0x30')],qs[_0xe66f('0x35')](_0x260bf0[_0xe66f('0x31')][_0xe66f('0x35')]));_0x38e3f9[_0xe66f('0x36')]=_0x38e3f9['attributes']['length']?_0x38e3f9['attributes']:_0x5bc011['model'];if(!_0x260bf0['query'][_0xe66f('0x38')](_0xe66f('0x59'))){_0x38e3f9[_0xe66f('0x1c')]=qs[_0xe66f('0x1c')](_0x260bf0[_0xe66f('0x31')][_0xe66f('0x1c')]);_0x38e3f9['offset']=qs[_0xe66f('0x1b')](_0x260bf0['query'][_0xe66f('0x1b')]);}_0x38e3f9[_0xe66f('0x5a')]=qs[_0xe66f('0x39')](_0x260bf0[_0xe66f('0x31')][_0xe66f('0x39')]);_0x38e3f9[_0xe66f('0x3a')]=qs[_0xe66f('0x33')](_[_0xe66f('0x3b')](_0x260bf0[_0xe66f('0x31')],_0x5bc011[_0xe66f('0x33')]));_0x38e3f9[_0xe66f('0x3a')][_0xe66f('0x5b')]=_0x23c954['id'];if(_0x260bf0['query']['filter']){_0x38e3f9[_0xe66f('0x3a')]=_['merge'](_0x38e3f9[_0xe66f('0x3a')],{'$or':_[_0xe66f('0x2c')](_0x38e3f9['attributes'],function(_0x3dbf85){var _0x4af06c={};_0x4af06c[_0x3dbf85]={'$like':'%'+_0x260bf0[_0xe66f('0x31')]['filter']+'%'};return _0x4af06c;})});}_0x38e3f9=_[_0xe66f('0x3d')]({},_0x38e3f9,_0x260bf0[_0xe66f('0x40')]);return db[_0xe66f('0x58')][_0xe66f('0x1a')]({'where':_0x38e3f9[_0xe66f('0x3a')]})[_0xe66f('0x22')](function(_0x21df54){_0x3ace02[_0xe66f('0x1a')]=_0x21df54;if(_0x260bf0[_0xe66f('0x31')]['includeAll']){_0x38e3f9['include']=[{'all':!![]}];}return db['CmHopper'][_0xe66f('0x44')](_0x38e3f9);})['then'](function(_0x3e9514){_0x3ace02[_0xe66f('0x5c')]=_0x3e9514;return _0x3ace02;});}})[_0xe66f('0x22')](respondWithFilteredResult(_0xe98ddd,_0x38e3f9))[_0xe66f('0x48')](handleError(_0xe98ddd,null));};exports['getHopperHistories']=function(_0x3e41e4,_0x5f2761,_0x2f6aec){var _0x2146e1={'raw':!![],'where':{}};var _0x3c330b={};var _0x402a68={'count':0x0,'rows':[]};return db[_0xe66f('0x43')][_0xe66f('0x57')]({'where':{'id':_0x3e41e4[_0xe66f('0x46')]['id']}})[_0xe66f('0x22')](handleEntityNotFound(_0x5f2761,null))[_0xe66f('0x22')](function(_0x571579){if(_0x571579){_0x3c330b[_0xe66f('0x30')]=_[_0xe66f('0x32')](db['CmHopperHistory'][_0xe66f('0x2d')]);_0x3c330b[_0xe66f('0x31')]=_['keys'](_0x3e41e4[_0xe66f('0x31')]);_0x3c330b[_0xe66f('0x33')]=_[_0xe66f('0x34')](_0x3c330b[_0xe66f('0x30')],_0x3c330b['query']);_0x2146e1['attributes']=_[_0xe66f('0x34')](_0x3c330b['model'],qs[_0xe66f('0x35')](_0x3e41e4[_0xe66f('0x31')][_0xe66f('0x35')]));_0x2146e1[_0xe66f('0x36')]=_0x2146e1[_0xe66f('0x36')][_0xe66f('0x37')]?_0x2146e1[_0xe66f('0x36')]:_0x3c330b[_0xe66f('0x30')];if(!_0x3e41e4[_0xe66f('0x31')][_0xe66f('0x38')]('nolimit')){_0x2146e1[_0xe66f('0x1c')]=qs[_0xe66f('0x1c')](_0x3e41e4[_0xe66f('0x31')][_0xe66f('0x1c')]);_0x2146e1[_0xe66f('0x1b')]=qs[_0xe66f('0x1b')](_0x3e41e4[_0xe66f('0x31')][_0xe66f('0x1b')]);}_0x2146e1[_0xe66f('0x5a')]=qs[_0xe66f('0x39')](_0x3e41e4[_0xe66f('0x31')][_0xe66f('0x39')]);_0x2146e1['where']=qs[_0xe66f('0x33')](_['pick'](_0x3e41e4[_0xe66f('0x31')],_0x3c330b[_0xe66f('0x33')]));_0x2146e1['where']['CampaignId']=_0x571579['id'];if(_0x3e41e4[_0xe66f('0x31')][_0xe66f('0x3c')]){_0x2146e1[_0xe66f('0x3a')]=_[_0xe66f('0x3d')](_0x2146e1[_0xe66f('0x3a')],{'$or':_[_0xe66f('0x2c')](_0x2146e1[_0xe66f('0x36')],function(_0x39aab2){var _0x6e4b94={};_0x6e4b94[_0x39aab2]={'$like':'%'+_0x3e41e4[_0xe66f('0x31')][_0xe66f('0x3c')]+'%'};return _0x6e4b94;})});}_0x2146e1=_['merge']({},_0x2146e1,_0x3e41e4[_0xe66f('0x40')]);return db[_0xe66f('0x5d')][_0xe66f('0x1a')]({'where':_0x2146e1[_0xe66f('0x3a')]})[_0xe66f('0x22')](function(_0x3890e9){_0x402a68[_0xe66f('0x1a')]=_0x3890e9;if(_0x3e41e4[_0xe66f('0x31')][_0xe66f('0x41')]){_0x2146e1['include']=[{'all':!![]}];}return db[_0xe66f('0x5d')][_0xe66f('0x44')](_0x2146e1);})[_0xe66f('0x22')](function(_0x2e2bfe){_0x402a68['rows']=_0x2e2bfe;return _0x402a68;});}})[_0xe66f('0x22')](respondWithFilteredResult(_0x5f2761,_0x2146e1))['catch'](handleError(_0x5f2761,null));};exports[_0xe66f('0x5e')]=function(_0x407662,_0xba62e3,_0x235440){var _0xbd1196={'raw':!![],'where':{}};var _0x561d66={};var _0x26e91c={'count':0x0,'rows':[]};return db[_0xe66f('0x43')][_0xe66f('0x57')]({'where':{'id':_0x407662[_0xe66f('0x46')]['id']}})['then'](handleEntityNotFound(_0xba62e3,null))[_0xe66f('0x22')](function(_0x3923f9){if(_0x3923f9){_0x561d66[_0xe66f('0x30')]=_[_0xe66f('0x32')](db[_0xe66f('0x5f')]['rawAttributes']);_0x561d66['query']=_['keys'](_0x407662['query']);_0x561d66[_0xe66f('0x33')]=_['intersection'](_0x561d66['model'],_0x561d66['query']);_0xbd1196['attributes']=_[_0xe66f('0x34')](_0x561d66[_0xe66f('0x30')],qs[_0xe66f('0x35')](_0x407662[_0xe66f('0x31')][_0xe66f('0x35')]));_0xbd1196['attributes']=_0xbd1196[_0xe66f('0x36')]['length']?_0xbd1196[_0xe66f('0x36')]:_0x561d66['model'];if(!_0x407662[_0xe66f('0x31')][_0xe66f('0x38')](_0xe66f('0x59'))){_0xbd1196[_0xe66f('0x1c')]=qs['limit'](_0x407662[_0xe66f('0x31')][_0xe66f('0x1c')]);_0xbd1196[_0xe66f('0x1b')]=qs[_0xe66f('0x1b')](_0x407662['query'][_0xe66f('0x1b')]);}_0xbd1196[_0xe66f('0x5a')]=qs[_0xe66f('0x39')](_0x407662[_0xe66f('0x31')]['sort']);_0xbd1196[_0xe66f('0x3a')]=qs[_0xe66f('0x33')](_[_0xe66f('0x3b')](_0x407662[_0xe66f('0x31')],_0x561d66[_0xe66f('0x33')]));_0xbd1196[_0xe66f('0x3a')][_0xe66f('0x5b')]=_0x3923f9['id'];if(_0x407662[_0xe66f('0x31')]['filter']){_0xbd1196[_0xe66f('0x3a')]=_['merge'](_0xbd1196['where'],{'$or':_[_0xe66f('0x2c')](_0xbd1196[_0xe66f('0x36')],function(_0x743191){var _0x46cbd0={};_0x46cbd0[_0x743191]={'$like':'%'+_0x407662[_0xe66f('0x31')][_0xe66f('0x3c')]+'%'};return _0x46cbd0;})});}_0xbd1196=_[_0xe66f('0x3d')]({},_0xbd1196,_0x407662[_0xe66f('0x40')]);return db[_0xe66f('0x5f')][_0xe66f('0x1a')]({'where':_0xbd1196[_0xe66f('0x3a')]})['then'](function(_0x1c9ad4){_0x26e91c[_0xe66f('0x1a')]=_0x1c9ad4;if(_0x407662[_0xe66f('0x31')][_0xe66f('0x41')]){_0xbd1196['include']=[{'all':!![]}];}return db[_0xe66f('0x5f')]['findAll'](_0xbd1196);})[_0xe66f('0x22')](function(_0x59be1d){_0x26e91c['rows']=_0x59be1d;return _0x26e91c;});}})['then'](respondWithFilteredResult(_0xba62e3,_0xbd1196))[_0xe66f('0x48')](handleError(_0xba62e3,null));};exports[_0xe66f('0x60')]=function(_0x3e85ff,_0x1ae27b,_0x5c2dae){var _0x31d7d6={'raw':!![],'where':{}};var _0x43b271={};var _0x42cec7={'count':0x0,'rows':[]};return db[_0xe66f('0x43')]['findOne']({'where':{'id':_0x3e85ff[_0xe66f('0x46')]['id']}})[_0xe66f('0x22')](handleEntityNotFound(_0x1ae27b,null))[_0xe66f('0x22')](function(_0x1823d9){if(_0x1823d9){_0x43b271['model']=_['keys'](db['CmHopperBlack'][_0xe66f('0x2d')]);_0x43b271['query']=_[_0xe66f('0x32')](_0x3e85ff[_0xe66f('0x31')]);_0x43b271[_0xe66f('0x33')]=_[_0xe66f('0x34')](_0x43b271[_0xe66f('0x30')],_0x43b271['query']);_0x31d7d6[_0xe66f('0x36')]=_[_0xe66f('0x34')](_0x43b271[_0xe66f('0x30')],qs[_0xe66f('0x35')](_0x3e85ff[_0xe66f('0x31')][_0xe66f('0x35')]));_0x31d7d6[_0xe66f('0x36')]=_0x31d7d6[_0xe66f('0x36')][_0xe66f('0x37')]?_0x31d7d6[_0xe66f('0x36')]:_0x43b271['model'];if(!_0x3e85ff[_0xe66f('0x31')]['hasOwnProperty'](_0xe66f('0x59'))){_0x31d7d6['limit']=qs['limit'](_0x3e85ff['query'][_0xe66f('0x1c')]);_0x31d7d6[_0xe66f('0x1b')]=qs[_0xe66f('0x1b')](_0x3e85ff[_0xe66f('0x31')][_0xe66f('0x1b')]);}_0x31d7d6['order']=qs['sort'](_0x3e85ff['query'][_0xe66f('0x39')]);_0x31d7d6['where']=qs['filters'](_[_0xe66f('0x3b')](_0x3e85ff[_0xe66f('0x31')],_0x43b271['filters']));_0x31d7d6[_0xe66f('0x3a')][_0xe66f('0x5b')]=_0x1823d9['id'];if(_0x3e85ff[_0xe66f('0x31')][_0xe66f('0x3c')]){_0x31d7d6[_0xe66f('0x3a')]=_[_0xe66f('0x3d')](_0x31d7d6[_0xe66f('0x3a')],{'$or':_[_0xe66f('0x2c')](_0x31d7d6['attributes'],function(_0x459f2e){var _0x5c24b5={};_0x5c24b5[_0x459f2e]={'$like':'%'+_0x3e85ff['query'][_0xe66f('0x3c')]+'%'};return _0x5c24b5;})});}_0x31d7d6=_[_0xe66f('0x3d')]({},_0x31d7d6,_0x3e85ff[_0xe66f('0x40')]);return db[_0xe66f('0x61')][_0xe66f('0x1a')]({'where':_0x31d7d6[_0xe66f('0x3a')]})[_0xe66f('0x22')](function(_0x44e2fd){_0x42cec7['count']=_0x44e2fd;if(_0x3e85ff[_0xe66f('0x31')][_0xe66f('0x41')]){_0x31d7d6[_0xe66f('0x42')]=[{'all':!![]}];}return db[_0xe66f('0x61')][_0xe66f('0x44')](_0x31d7d6);})[_0xe66f('0x22')](function(_0x2d39e3){_0x42cec7[_0xe66f('0x5c')]=_0x2d39e3;return _0x42cec7;});}})['then'](respondWithFilteredResult(_0x1ae27b,_0x31d7d6))['catch'](handleError(_0x1ae27b,null));};exports[_0xe66f('0x62')]=function(_0x50bd9b,_0x30aa6f,_0x1ff9ec){var _0x24267e={};var _0x3d05d8={};var _0x2a30b6;var _0x2deafe;return db[_0xe66f('0x43')]['findOne']({'where':{'id':_0x50bd9b[_0xe66f('0x46')]['id']}})[_0xe66f('0x22')](handleEntityNotFound(_0x30aa6f,null))['then'](function(_0x572324){if(_0x572324){_0x2a30b6=_0x572324;_0x3d05d8[_0xe66f('0x30')]=_[_0xe66f('0x32')](db[_0xe66f('0x63')]['rawAttributes']);_0x3d05d8[_0xe66f('0x31')]=_[_0xe66f('0x32')](_0x50bd9b[_0xe66f('0x31')]);_0x3d05d8[_0xe66f('0x33')]=_[_0xe66f('0x34')](_0x3d05d8[_0xe66f('0x30')],_0x3d05d8[_0xe66f('0x31')]);_0x24267e[_0xe66f('0x36')]=_['intersection'](_0x3d05d8[_0xe66f('0x30')],qs[_0xe66f('0x35')](_0x50bd9b[_0xe66f('0x31')][_0xe66f('0x35')]));_0x24267e[_0xe66f('0x36')]=_0x24267e['attributes'][_0xe66f('0x37')]?_0x24267e[_0xe66f('0x36')]:_0x3d05d8['model'];_0x24267e[_0xe66f('0x5a')]=qs['sort'](_0x50bd9b['query']['sort']);_0x24267e[_0xe66f('0x3a')]=qs['filters'](_[_0xe66f('0x3b')](_0x50bd9b[_0xe66f('0x31')],_0x3d05d8[_0xe66f('0x33')]));if(_0x50bd9b[_0xe66f('0x31')][_0xe66f('0x3c')]){_0x24267e[_0xe66f('0x3a')]=_['merge'](_0x24267e['where'],{'$or':_[_0xe66f('0x2c')](_0x24267e[_0xe66f('0x36')],function(_0x263526){var _0x243fd6={};_0x243fd6[_0x263526]={'$like':'%'+_0x50bd9b['query'][_0xe66f('0x3c')]+'%'};return _0x243fd6;})});}_0x24267e=_[_0xe66f('0x3d')]({},_0x24267e,_0x50bd9b[_0xe66f('0x40')]);return _0x2a30b6[_0xe66f('0x62')](_0x24267e);}})[_0xe66f('0x22')](function(_0x2ede88){if(_0x2ede88){_0x2deafe=_0x2ede88[_0xe66f('0x37')];if(!_0x50bd9b['query'][_0xe66f('0x38')](_0xe66f('0x59'))){_0x24267e['limit']=qs[_0xe66f('0x1c')](_0x50bd9b[_0xe66f('0x31')][_0xe66f('0x1c')]);_0x24267e[_0xe66f('0x1b')]=qs[_0xe66f('0x1b')](_0x50bd9b[_0xe66f('0x31')]['offset']);}return _0x2a30b6[_0xe66f('0x62')](_0x24267e);}})[_0xe66f('0x22')](function(_0x300141){if(_0x300141){return _0x300141?{'count':_0x2deafe,'rows':_0x300141}:null;}})[_0xe66f('0x22')](respondWithResult(_0x30aa6f,null))['catch'](handleError(_0x30aa6f,null));};exports[_0xe66f('0x64')]=function(_0x17fed1,_0x5ec990,_0x271b0c){var _0x2e738,_0x32a812;return db['Campaign'][_0xe66f('0x47')]({'where':{'id':_0x17fed1[_0xe66f('0x46')]['id']}})['then'](handleEntityNotFound(_0x5ec990,null))[_0xe66f('0x22')](function(_0xb60bb7){if(_0xb60bb7){_0x32a812=_0xb60bb7;return _0xb60bb7['addLists'](_0x17fed1[_0xe66f('0x4a')][_0xe66f('0x65')],_[_0xe66f('0x53')](_0x17fed1['body'],[_0xe66f('0x65'),'id'])||{});}return null;})[_0xe66f('0x66')](function(_0x1b2d45){var _0x37bfaa;_0x2e738=_0x1b2d45||[];var _0x2e6d1a=[];if(_0x1b2d45){for(var _0x4144f8=0x0;_0x4144f8<_0x1b2d45[_0xe66f('0x37')];_0x4144f8+=0x1){var _0x105c75=_0x1b2d45[_0x4144f8]['get']({'plain':!![]});_0x32a812[_0xe66f('0x67')]=_0x17fed1[_0xe66f('0x4a')][_0xe66f('0x67')]?_0x17fed1[_0xe66f('0x4a')][_0xe66f('0x67')]:_0x32a812[_0xe66f('0x67')];switch(_0x32a812[_0xe66f('0x67')]){case _0xe66f('0x68'):_0x37bfaa=squel[_0xe66f('0x69')]()['into']('cm_hopper')[_0xe66f('0x6a')]([_0xe66f('0x6b'),_0xe66f('0x6c'),_0xe66f('0x6d'),_0xe66f('0x6e'),_0xe66f('0x5b'),_0xe66f('0x55'),_0xe66f('0x54')],squel['select']()[_0xe66f('0x6f')](_0xe66f('0x6b'),'phone')['field'](_0xe66f('0x70'),_0xe66f('0x6c'))[_0xe66f('0x6f')]('id',_0xe66f('0x6d'))[_0xe66f('0x6f')](_0x105c75[_0xe66f('0x71')][_0xe66f('0x72')](),_0xe66f('0x6e'))['field'](_0x17fed1[_0xe66f('0x46')]['id']['toString'](),_0xe66f('0x5b'))[_0xe66f('0x6f')](_0xe66f('0x70'),_0xe66f('0x55'))[_0xe66f('0x6f')](_0xe66f('0x70'),_0xe66f('0x54'))['from'](_0xe66f('0x73'))[_0xe66f('0x3a')](_0xe66f('0x74'))[_0xe66f('0x3a')](_0xe66f('0x75'),_0x105c75[_0xe66f('0x71')][_0xe66f('0x72')]())[_0xe66f('0x3a')](_0xe66f('0x76'))[_0xe66f('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel[_0xe66f('0x77')]()[_0xe66f('0x6f')](_0xe66f('0x78'))[_0xe66f('0x79')](_0xe66f('0x7a'))['where']('CampaignId\x20=\x20?',_0x17fed1[_0xe66f('0x46')]['id'][_0xe66f('0x72')]()))[_0xe66f('0x3a')](_0xe66f('0x7b'),squel[_0xe66f('0x77')]()['field'](_0xe66f('0x7c'))[_0xe66f('0x79')](_0xe66f('0x7d'))[_0xe66f('0x3a')](_0xe66f('0x7e'),_0x17fed1[_0xe66f('0x46')]['id'][_0xe66f('0x72')]())))[_0xe66f('0x72')]();break;case'onlyIfOpen':_0x37bfaa=squel[_0xe66f('0x69')]()[_0xe66f('0x7f')](_0xe66f('0x7d'))[_0xe66f('0x6a')]([_0xe66f('0x6b'),_0xe66f('0x6c'),_0xe66f('0x6d'),_0xe66f('0x6e'),'CampaignId',_0xe66f('0x55'),_0xe66f('0x54')],squel[_0xe66f('0x77')]()[_0xe66f('0x6f')]('phone',_0xe66f('0x6b'))['field'](_0xe66f('0x70'),'scheduledAt')[_0xe66f('0x6f')]('id',_0xe66f('0x6d'))['field'](_0x105c75[_0xe66f('0x71')][_0xe66f('0x72')](),_0xe66f('0x6e'))['field'](_0x17fed1['params']['id'][_0xe66f('0x72')](),'CampaignId')['field'](_0xe66f('0x70'),'createdAt')[_0xe66f('0x6f')](_0xe66f('0x70'),'updatedAt')['from'](_0xe66f('0x73'))[_0xe66f('0x3a')](_0xe66f('0x74'))[_0xe66f('0x3a')](_0xe66f('0x75'),_0x105c75[_0xe66f('0x71')][_0xe66f('0x72')]())['where'](_0xe66f('0x76'))[_0xe66f('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel[_0xe66f('0x77')]()[_0xe66f('0x6f')](_0xe66f('0x7c'))['from'](_0xe66f('0x7d'))[_0xe66f('0x3a')](_0xe66f('0x7e'),_0x17fed1['params']['id'][_0xe66f('0x72')]())))[_0xe66f('0x72')]();break;default:_0x37bfaa=squel['insert']()[_0xe66f('0x7f')](_0xe66f('0x7d'))[_0xe66f('0x6a')](['phone',_0xe66f('0x6c'),_0xe66f('0x6d'),_0xe66f('0x6e'),_0xe66f('0x5b'),_0xe66f('0x55'),'updatedAt'],squel[_0xe66f('0x77')]()[_0xe66f('0x6f')](_0xe66f('0x6b'),_0xe66f('0x6b'))['field'](_0xe66f('0x70'),'scheduledAt')['field']('id',_0xe66f('0x6d'))[_0xe66f('0x6f')](_0x105c75[_0xe66f('0x71')]['toString'](),_0xe66f('0x6e'))['field'](_0x17fed1[_0xe66f('0x46')]['id'][_0xe66f('0x72')](),_0xe66f('0x5b'))[_0xe66f('0x6f')](_0xe66f('0x70'),_0xe66f('0x55'))[_0xe66f('0x6f')](_0xe66f('0x70'),_0xe66f('0x54'))[_0xe66f('0x79')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0xe66f('0x3a')](_0xe66f('0x75'),_0x105c75[_0xe66f('0x71')][_0xe66f('0x72')]())[_0xe66f('0x3a')](_0xe66f('0x76')))[_0xe66f('0x72')]();}_0x2e6d1a['push'](db[_0xe66f('0x80')][_0xe66f('0x31')](_0x37bfaa));}return BPromise['all'](_0x2e6d1a);}})[_0xe66f('0x22')](function(){return _0x2e738;})[_0xe66f('0x22')](respondWithResult(_0x5ec990,null))['catch'](handleError(_0x5ec990,null));};exports['removeLists']=function(_0x1671bf,_0x26e60b,_0x324356){return db[_0xe66f('0x43')][_0xe66f('0x47')]({'where':{'id':_0x1671bf['params']['id']}})['then'](handleEntityNotFound(_0x26e60b,null))[_0xe66f('0x22')](function(_0x28eb4e){if(_0x28eb4e){return _0x28eb4e['removeLists'](_0x1671bf['query'][_0xe66f('0x65')]);}})[_0xe66f('0x22')](function(_0x2c6598){if(_0x2c6598){return db[_0xe66f('0x58')][_0xe66f('0x23')]({'where':{'ListId':_0x1671bf[_0xe66f('0x31')][_0xe66f('0x65')],'CampaignId':_0x1671bf['params']['id']}})['then'](function(){return _0x2c6598;});}})[_0xe66f('0x22')](respondWithStatusCode(_0x26e60b,null))[_0xe66f('0x48')](handleError(_0x26e60b,null));};exports[_0xe66f('0x81')]=function(_0x22269a,_0x169a46,_0x16de3){var _0x1d404f={};var _0x5366e3={};var _0x4cda41;var _0x11c902;return db[_0xe66f('0x43')][_0xe66f('0x57')]({'where':{'id':_0x22269a[_0xe66f('0x46')]['id']}})['then'](handleEntityNotFound(_0x169a46,null))['then'](function(_0x2a8420){if(_0x2a8420){_0x4cda41=_0x2a8420;_0x5366e3[_0xe66f('0x30')]=_[_0xe66f('0x32')](db['CmList'][_0xe66f('0x2d')]);_0x5366e3[_0xe66f('0x31')]=_[_0xe66f('0x32')](_0x22269a[_0xe66f('0x31')]);_0x5366e3['filters']=_[_0xe66f('0x34')](_0x5366e3[_0xe66f('0x30')],_0x5366e3['query']);_0x1d404f[_0xe66f('0x36')]=_[_0xe66f('0x34')](_0x5366e3[_0xe66f('0x30')],qs['fields'](_0x22269a[_0xe66f('0x31')]['fields']));_0x1d404f[_0xe66f('0x36')]=_0x1d404f[_0xe66f('0x36')][_0xe66f('0x37')]?_0x1d404f[_0xe66f('0x36')]:_0x5366e3['model'];_0x1d404f[_0xe66f('0x5a')]=qs[_0xe66f('0x39')](_0x22269a[_0xe66f('0x31')][_0xe66f('0x39')]);_0x1d404f[_0xe66f('0x3a')]=qs[_0xe66f('0x33')](_[_0xe66f('0x3b')](_0x22269a[_0xe66f('0x31')],_0x5366e3[_0xe66f('0x33')]));if(_0x22269a[_0xe66f('0x31')][_0xe66f('0x3c')]){_0x1d404f[_0xe66f('0x3a')]=_[_0xe66f('0x3d')](_0x1d404f['where'],{'$or':_[_0xe66f('0x2c')](_0x1d404f[_0xe66f('0x36')],function(_0x48085b){var _0xab1c1d={};_0xab1c1d[_0x48085b]={'$like':'%'+_0x22269a[_0xe66f('0x31')][_0xe66f('0x3c')]+'%'};return _0xab1c1d;})});}_0x1d404f=_[_0xe66f('0x3d')]({},_0x1d404f,_0x22269a['options']);return _0x4cda41['getBlackLists'](_0x1d404f);}})[_0xe66f('0x22')](function(_0x8fed6a){if(_0x8fed6a){_0x11c902=_0x8fed6a[_0xe66f('0x37')];if(!_0x22269a['query'][_0xe66f('0x38')](_0xe66f('0x59'))){_0x1d404f[_0xe66f('0x1c')]=qs[_0xe66f('0x1c')](_0x22269a[_0xe66f('0x31')]['limit']);_0x1d404f[_0xe66f('0x1b')]=qs['offset'](_0x22269a['query'][_0xe66f('0x1b')]);}return _0x4cda41[_0xe66f('0x81')](_0x1d404f);}})[_0xe66f('0x22')](function(_0x246ef8){if(_0x246ef8){return _0x246ef8?{'count':_0x11c902,'rows':_0x246ef8}:null;}})['then'](respondWithResult(_0x169a46,null))[_0xe66f('0x48')](handleError(_0x169a46,null));};exports[_0xe66f('0x82')]=function(_0x5b7d0f,_0x48fa55,_0xc7588c){var _0x26ac13,_0x2d0284;return db[_0xe66f('0x43')][_0xe66f('0x47')]({'where':{'id':_0x5b7d0f[_0xe66f('0x46')]['id']}})[_0xe66f('0x22')](handleEntityNotFound(_0x48fa55,null))[_0xe66f('0x22')](function(_0x3ab151){if(_0x3ab151){_0x2d0284=_0x3ab151;return _0x3ab151[_0xe66f('0x82')](_0x5b7d0f[_0xe66f('0x4a')][_0xe66f('0x65')],_[_0xe66f('0x53')](_0x5b7d0f[_0xe66f('0x4a')],[_0xe66f('0x65'),'id'])||{});}return null;})[_0xe66f('0x66')](function(_0x1ba12c){var _0x45f643;_0x26ac13=_0x1ba12c||[];var _0x5991d0=[];if(_0x1ba12c){for(var _0x5856b4=0x0;_0x5856b4<_0x1ba12c[_0xe66f('0x37')];_0x5856b4+=0x1){var _0x2f603a=_0x1ba12c[_0x5856b4]['get']({'plain':!![]});_0x45f643=squel[_0xe66f('0x69')]()[_0xe66f('0x7f')]('cm_hopper_black')['fromQuery']([_0xe66f('0x6b'),'ContactId',_0xe66f('0x6e'),'CampaignId','createdAt',_0xe66f('0x54')],squel[_0xe66f('0x77')]()[_0xe66f('0x6f')](_0xe66f('0x6b'),'phone')[_0xe66f('0x6f')]('id',_0xe66f('0x6d'))['field'](_0x2f603a['CmListId'][_0xe66f('0x72')](),_0xe66f('0x6e'))[_0xe66f('0x6f')](_0x5b7d0f['params']['id'][_0xe66f('0x72')](),'CampaignId')[_0xe66f('0x6f')](_0xe66f('0x70'),_0xe66f('0x55'))[_0xe66f('0x6f')](_0xe66f('0x70'),_0xe66f('0x54'))[_0xe66f('0x79')](_0xe66f('0x73'))[_0xe66f('0x3a')](_0xe66f('0x74'))[_0xe66f('0x3a')](_0xe66f('0x75'),_0x2f603a['CmListId'][_0xe66f('0x72')]())[_0xe66f('0x3a')](_0xe66f('0x76')))[_0xe66f('0x72')]();_0x5991d0[_0xe66f('0x83')](db['sequelize'][_0xe66f('0x31')](_0x45f643));}return BPromise[_0xe66f('0x84')](_0x5991d0);}})['then'](function(){return _0x26ac13;})[_0xe66f('0x22')](respondWithResult(_0x48fa55,null))[_0xe66f('0x48')](handleError(_0x48fa55,null));};exports[_0xe66f('0x85')]=function(_0x2c966a,_0x3aeaf5,_0x367492){return db[_0xe66f('0x43')][_0xe66f('0x47')]({'where':{'id':_0x2c966a['params']['id']}})[_0xe66f('0x22')](handleEntityNotFound(_0x3aeaf5,null))[_0xe66f('0x22')](function(_0x16dbed){if(_0x16dbed){return _0x16dbed[_0xe66f('0x85')](_0x2c966a[_0xe66f('0x31')][_0xe66f('0x65')]);}})[_0xe66f('0x22')](function(_0x3594d1){if(_0x3594d1){return db[_0xe66f('0x61')][_0xe66f('0x23')]({'where':{'ListId':_0x2c966a[_0xe66f('0x31')][_0xe66f('0x65')],'CampaignId':_0x2c966a[_0xe66f('0x46')]['id']}})['then'](function(){return _0x3594d1;});}})[_0xe66f('0x22')](respondWithStatusCode(_0x3aeaf5,null))['catch'](handleError(_0x3aeaf5,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index bb0452c..1aefc10 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 _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x90d801,_0x5e10e5){var _0x136d39=function(_0x5b723c){while(--_0x5b723c){_0x90d801['push'](_0x90d801['shift']());}};_0x136d39(++_0x5e10e5);}(_0x7a54,0x106));var _0x47a5=function(_0x17da7a,_0x359a66){_0x17da7a=_0x17da7a-0x0;var _0x5969e1=_0x7a54[_0x17da7a];return _0x5969e1;};'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 +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x4dc5eb,_0x8e2c9a){var _0x55a235=function(_0x4269c4){while(--_0x4269c4){_0x4dc5eb['push'](_0x4dc5eb['shift']());}};_0x55a235(++_0x8e2c9a);}(_0x7a54,0x106));var _0x47a5=function(_0x3338a7,_0x451384){_0x3338a7=_0x3338a7-0x0;var _0x5585b1=_0x7a54[_0x3338a7];return _0x5585b1;};'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 bdee7f0..a001559 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 _0xadec=['catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','then','info','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','Campaign,\x20%s,\x20%s','message','result','Campaign','findAll','options','raw','where','limit','include','map','model','attributes','GetCampaign'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xadec,0x156));var _0xcade=function(_0x3c5a30,_0x2da842){_0x3c5a30=_0x3c5a30-0x0;var _0x57dcdc=_0xadec[_0x3c5a30];return _0x57dcdc;};'use strict';var _=require(_0xcade('0x0'));var util=require(_0xcade('0x1'));var moment=require(_0xcade('0x2'));var BPromise=require(_0xcade('0x3'));var rs=require(_0xcade('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcade('0x5'))(_0xcade('0x6'));var config=require(_0xcade('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x51d665,_0x1fe48f,_0x4c36e8){return new BPromise(function(_0x625da7,_0x5bebbe){return client['request'](_0x51d665,_0x4c36e8)[_0xcade('0x8')](function(_0x182658){logger[_0xcade('0x9')]('Campaign,\x20%s,\x20%s',_0x1fe48f,_0xcade('0xa'));logger[_0xcade('0xb')](_0xcade('0xc'),_0x1fe48f,_0xcade('0xa'),JSON[_0xcade('0xd')](_0x182658));if(_0x182658[_0xcade('0xe')]){if(_0x182658[_0xcade('0xe')][_0xcade('0xf')]===0x1f4){logger[_0xcade('0xe')](_0xcade('0x10'),_0x1fe48f,_0x182658[_0xcade('0xe')][_0xcade('0x11')]);return _0x5bebbe(_0x182658[_0xcade('0xe')][_0xcade('0x11')]);}logger['error'](_0xcade('0x10'),_0x1fe48f,_0x182658[_0xcade('0xe')][_0xcade('0x11')]);return _0x625da7(_0x182658['error'][_0xcade('0x11')]);}else{logger[_0xcade('0x9')]('Campaign,\x20%s,\x20%s',_0x1fe48f,_0xcade('0xa'));_0x625da7(_0x182658[_0xcade('0x12')][_0xcade('0x11')]);}})['catch'](function(_0x1678cd){logger[_0xcade('0xe')](_0xcade('0x10'),_0x1fe48f,_0x1678cd);_0x5bebbe(_0x1678cd);});});}exports['GetCampaign']=function(_0x126272){var _0x124e64=this;return new Promise(function(_0x1c7be1,_0x1c54a0){return db[_0xcade('0x13')][_0xcade('0x14')]({'raw':_0x126272[_0xcade('0x15')]?_0x126272['options'][_0xcade('0x16')]===undefined?!![]:![]:!![],'where':_0x126272[_0xcade('0x15')]?_0x126272[_0xcade('0x15')][_0xcade('0x17')]||null:null,'attributes':_0x126272[_0xcade('0x15')]?_0x126272['options']['attributes']||null:null,'limit':_0x126272[_0xcade('0x15')]?_0x126272['options'][_0xcade('0x18')]||null:null,'include':_0x126272[_0xcade('0x15')]?_0x126272[_0xcade('0x15')][_0xcade('0x19')]?_[_0xcade('0x1a')](_0x126272[_0xcade('0x15')][_0xcade('0x19')],function(_0x264df7){return{'model':db[_0x264df7[_0xcade('0x1b')]],'as':_0x264df7['as'],'attributes':_0x264df7[_0xcade('0x1c')],'include':_0x264df7[_0xcade('0x19')]?_[_0xcade('0x1a')](_0x264df7['include'],function(_0x4139b3){return{'model':db[_0x4139b3[_0xcade('0x1b')]],'as':_0x4139b3['as'],'attributes':_0x4139b3['attributes'],'include':_0x4139b3[_0xcade('0x19')]?_[_0xcade('0x1a')](_0x4139b3[_0xcade('0x19')],function(_0x264f53){return{'model':db[_0x264f53[_0xcade('0x1b')]],'as':_0x264f53['as'],'attributes':_0x264f53[_0xcade('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xcade('0x8')](function(_0x4bbe2a){logger[_0xcade('0x9')](_0xcade('0x1d'),_0x126272);logger[_0xcade('0xb')](_0xcade('0x1d'),_0x126272,JSON[_0xcade('0xd')](_0x4bbe2a));_0x1c7be1(_0x4bbe2a);})[_0xcade('0x1e')](function(_0x31fe0d){logger[_0xcade('0xe')]('GetCampaign',_0x31fe0d[_0xcade('0x11')],_0x126272);_0x1c54a0(_0x124e64[_0xcade('0xe')](0x1f4,_0x31fe0d[_0xcade('0x11')]));});});}; \ No newline at end of file +var _0x32ff=['jayson/promise','client','request','then','info','Campaign,\x20%s,\x20%s','Campaign,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','findAll','options','raw','where','attributes','limit','include','map','model','GetCampaign','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x23e67f,_0x566bda){var _0x39a330=function(_0x3c5756){while(--_0x3c5756){_0x23e67f['push'](_0x23e67f['shift']());}};_0x39a330(++_0x566bda);}(_0x32ff,0xc7));var _0xf32f=function(_0x1cd4f2,_0x20fd08){_0x1cd4f2=_0x1cd4f2-0x0;var _0x319272=_0x32ff[_0x1cd4f2];return _0x319272;};'use strict';var _=require(_0xf32f('0x0'));var util=require(_0xf32f('0x1'));var moment=require(_0xf32f('0x2'));var BPromise=require(_0xf32f('0x3'));var rs=require(_0xf32f('0x4'));var fs=require('fs');var Redis=require(_0xf32f('0x5'));var db=require(_0xf32f('0x6'))['db'];var utils=require(_0xf32f('0x7'));var logger=require(_0xf32f('0x8'))(_0xf32f('0x9'));var config=require(_0xf32f('0xa'));var jayson=require(_0xf32f('0xb'));var client=jayson[_0xf32f('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b688d,_0x4e4d6e,_0x40f495){return new BPromise(function(_0x2756a3,_0x23618f){return client[_0xf32f('0xd')](_0x1b688d,_0x40f495)[_0xf32f('0xe')](function(_0x2a0155){logger[_0xf32f('0xf')](_0xf32f('0x10'),_0x4e4d6e,'request\x20sent');logger['debug'](_0xf32f('0x11'),_0x4e4d6e,'request\x20sent',JSON['stringify'](_0x2a0155));if(_0x2a0155[_0xf32f('0x12')]){if(_0x2a0155[_0xf32f('0x12')][_0xf32f('0x13')]===0x1f4){logger[_0xf32f('0x12')](_0xf32f('0x10'),_0x4e4d6e,_0x2a0155[_0xf32f('0x12')][_0xf32f('0x14')]);return _0x23618f(_0x2a0155[_0xf32f('0x12')][_0xf32f('0x14')]);}logger['error'](_0xf32f('0x10'),_0x4e4d6e,_0x2a0155[_0xf32f('0x12')][_0xf32f('0x14')]);return _0x2756a3(_0x2a0155['error'][_0xf32f('0x14')]);}else{logger[_0xf32f('0xf')](_0xf32f('0x10'),_0x4e4d6e,_0xf32f('0x15'));_0x2756a3(_0x2a0155[_0xf32f('0x16')][_0xf32f('0x14')]);}})['catch'](function(_0x30b1a1){logger['error'](_0xf32f('0x10'),_0x4e4d6e,_0x30b1a1);_0x23618f(_0x30b1a1);});});}exports['GetCampaign']=function(_0x19ffa2){var _0x1a6dd0=this;return new Promise(function(_0x8cf34d,_0x369812){return db['Campaign'][_0xf32f('0x17')]({'raw':_0x19ffa2[_0xf32f('0x18')]?_0x19ffa2['options'][_0xf32f('0x19')]===undefined?!![]:![]:!![],'where':_0x19ffa2[_0xf32f('0x18')]?_0x19ffa2['options'][_0xf32f('0x1a')]||null:null,'attributes':_0x19ffa2[_0xf32f('0x18')]?_0x19ffa2[_0xf32f('0x18')][_0xf32f('0x1b')]||null:null,'limit':_0x19ffa2[_0xf32f('0x18')]?_0x19ffa2[_0xf32f('0x18')][_0xf32f('0x1c')]||null:null,'include':_0x19ffa2[_0xf32f('0x18')]?_0x19ffa2['options'][_0xf32f('0x1d')]?_[_0xf32f('0x1e')](_0x19ffa2[_0xf32f('0x18')][_0xf32f('0x1d')],function(_0x360a68){return{'model':db[_0x360a68['model']],'as':_0x360a68['as'],'attributes':_0x360a68[_0xf32f('0x1b')],'include':_0x360a68['include']?_[_0xf32f('0x1e')](_0x360a68[_0xf32f('0x1d')],function(_0x52eac7){return{'model':db[_0x52eac7['model']],'as':_0x52eac7['as'],'attributes':_0x52eac7['attributes'],'include':_0x52eac7[_0xf32f('0x1d')]?_[_0xf32f('0x1e')](_0x52eac7[_0xf32f('0x1d')],function(_0x3ac4d3){return{'model':db[_0x3ac4d3[_0xf32f('0x1f')]],'as':_0x3ac4d3['as'],'attributes':_0x3ac4d3[_0xf32f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf32f('0xe')](function(_0x26bcee){logger[_0xf32f('0xf')](_0xf32f('0x20'),_0x19ffa2);logger[_0xf32f('0x21')](_0xf32f('0x20'),_0x19ffa2,JSON['stringify'](_0x26bcee));_0x8cf34d(_0x26bcee);})[_0xf32f('0x22')](function(_0x285eb9){logger[_0xf32f('0x12')]('GetCampaign',_0x285eb9[_0xf32f('0x14')],_0x19ffa2);_0x369812(_0x1a6dd0[_0xf32f('0x12')](0x1f4,_0x285eb9[_0xf32f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 8b7a486..7fd1e7d 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 _0xacb8=['removeLists','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','show','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/lists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','addLists','addBlackLists','delete','/:id','destroy'];(function(_0x246148,_0x1358ee){var _0x453d94=function(_0x59920e){while(--_0x59920e){_0x246148['push'](_0x246148['shift']());}};_0x453d94(++_0x1358ee);}(_0xacb8,0x119));var _0x8acb=function(_0x58c531,_0x126bc6){_0x58c531=_0x58c531-0x0;var _0xddcc4a=_0xacb8[_0x58c531];return _0xddcc4a;};'use strict';var multer=require(_0x8acb('0x0'));var util=require('util');var path=require(_0x8acb('0x1'));var timeout=require(_0x8acb('0x2'));var express=require(_0x8acb('0x3'));var router=express['Router']();var fs_extra=require(_0x8acb('0x4'));var auth=require(_0x8acb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8acb('0x6'));var controller=require(_0x8acb('0x7'));router[_0x8acb('0x8')]('/',auth[_0x8acb('0x9')](),controller[_0x8acb('0xa')]);router[_0x8acb('0x8')]('/:id',auth[_0x8acb('0x9')](),controller[_0x8acb('0xb')]);router[_0x8acb('0x8')](_0x8acb('0xc'),auth[_0x8acb('0x9')](),controller[_0x8acb('0xd')]);router['get']('/:id/hopper_histories',auth[_0x8acb('0x9')](),controller[_0x8acb('0xe')]);router[_0x8acb('0x8')](_0x8acb('0xf'),auth['isAuthenticated'](),controller[_0x8acb('0x10')]);router[_0x8acb('0x8')]('/:id/hopper_black',auth[_0x8acb('0x9')](),controller[_0x8acb('0x11')]);router[_0x8acb('0x8')](_0x8acb('0x12'),auth[_0x8acb('0x9')](),controller['getLists']);router[_0x8acb('0x8')](_0x8acb('0x13'),auth[_0x8acb('0x9')](),controller[_0x8acb('0x14')]);router[_0x8acb('0x15')]('/',auth[_0x8acb('0x9')](),controller['create']);router[_0x8acb('0x15')](_0x8acb('0x16'),auth[_0x8acb('0x9')](),controller[_0x8acb('0x17')]);router[_0x8acb('0x15')](_0x8acb('0x12'),auth[_0x8acb('0x9')](),controller[_0x8acb('0x18')]);router[_0x8acb('0x15')]('/:id/blacklists',auth[_0x8acb('0x9')](),controller[_0x8acb('0x19')]);router['put']('/:id',auth[_0x8acb('0x9')](),controller['update']);router[_0x8acb('0x1a')](_0x8acb('0x1b'),auth['isAuthenticated'](),controller[_0x8acb('0x1c')]);router[_0x8acb('0x1a')](_0x8acb('0x12'),auth[_0x8acb('0x9')](),controller[_0x8acb('0x1d')]);router[_0x8acb('0x1a')](_0x8acb('0x13'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0x8acb('0x1e')]=router; \ No newline at end of file +var _0x19f8=['get','isAuthenticated','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperFinals','/:id/hopper_black','/:id/lists','getLists','getBlackLists','post','create','/:id/clone','clone','addLists','/:id/blacklists','addBlackLists','put','update','delete','removeBlackLists','multer','util','path','../../components/auth/service','../../config/environment'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x19f8,0xbf));var _0x819f=function(_0x5562fe,_0x4e809c){_0x5562fe=_0x5562fe-0x0;var _0x1829c7=_0x19f8[_0x5562fe];return _0x1829c7;};'use strict';var multer=require(_0x819f('0x0'));var util=require(_0x819f('0x1'));var path=require(_0x819f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x819f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x819f('0x4'));var controller=require('./campaign.controller');router[_0x819f('0x5')]('/',auth[_0x819f('0x6')](),controller['index']);router[_0x819f('0x5')](_0x819f('0x7'),auth['isAuthenticated'](),controller[_0x819f('0x8')]);router[_0x819f('0x5')](_0x819f('0x9'),auth[_0x819f('0x6')](),controller[_0x819f('0xa')]);router[_0x819f('0x5')](_0x819f('0xb'),auth[_0x819f('0x6')](),controller['getHopperHistories']);router[_0x819f('0x5')]('/:id/hopper_finals',auth[_0x819f('0x6')](),controller[_0x819f('0xc')]);router['get'](_0x819f('0xd'),auth[_0x819f('0x6')](),controller['getHopperBlacks']);router[_0x819f('0x5')](_0x819f('0xe'),auth['isAuthenticated'](),controller[_0x819f('0xf')]);router[_0x819f('0x5')]('/:id/blacklists',auth[_0x819f('0x6')](),controller[_0x819f('0x10')]);router[_0x819f('0x11')]('/',auth[_0x819f('0x6')](),controller[_0x819f('0x12')]);router[_0x819f('0x11')](_0x819f('0x13'),auth[_0x819f('0x6')](),controller[_0x819f('0x14')]);router[_0x819f('0x11')]('/:id/lists',auth['isAuthenticated'](),controller[_0x819f('0x15')]);router[_0x819f('0x11')](_0x819f('0x16'),auth[_0x819f('0x6')](),controller[_0x819f('0x17')]);router[_0x819f('0x18')](_0x819f('0x7'),auth[_0x819f('0x6')](),controller[_0x819f('0x19')]);router[_0x819f('0x1a')]('/:id',auth[_0x819f('0x6')](),controller['destroy']);router[_0x819f('0x1a')](_0x819f('0xe'),auth[_0x819f('0x6')](),controller['removeLists']);router['delete']('/:id/blacklists',auth[_0x819f('0x6')](),controller[_0x819f('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 89b6984..47425da 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 _0x7047=['VIRTUAL','getDataValue','sequelize','exports'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7047,0xd2));var _0x7704=function(_0x1f5d2d,_0x2416b4){_0x1f5d2d=_0x1f5d2d-0x0;var _0x1642ff=_0x7047[_0x1f5d2d];return _0x1642ff;};'use strict';var Sequelize=require(_0x7704('0x0'));module[_0x7704('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x7704('0x2')],'get':function(){return this[_0x7704('0x3')]('key');}}}; \ No newline at end of file +var _0x716c=['exports','STRING','VIRTUAL','getDataValue','key'];(function(_0x20de66,_0x17a6bc){var _0x442f5a=function(_0x364bf8){while(--_0x364bf8){_0x20de66['push'](_0x20de66['shift']());}};_0x442f5a(++_0x17a6bc);}(_0x716c,0x163));var _0xc716=function(_0x2ea06f,_0x4ec8b1){_0x2ea06f=_0x2ea06f-0x0;var _0x431113=_0x716c[_0x2ea06f];return _0x431113;};'use strict';var Sequelize=require('sequelize');module[_0xc716('0x0')]={'key':{'type':Sequelize[_0xc716('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0xc716('0x1')]},'name':{'type':Sequelize[_0xc716('0x2')],'get':function(){return this[_0xc716('0x3')](_0xc716('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 8d0102d..154bbeb 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 _0x2df1=['rows','catch','show','params','keys','rawAttributes','find','body','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','get','CannedAnswers','error','stack','name','send','index','map','CannedAnswer','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll'];(function(_0x1f7605,_0x2f094d){var _0x121539=function(_0x47f6e7){while(--_0x47f6e7){_0x1f7605['push'](_0x1f7605['shift']());}};_0x121539(++_0x2f094d);}(_0x2df1,0x122));var _0x12df=function(_0x1aa4e7,_0x445f2e){_0x1aa4e7=_0x1aa4e7-0x0;var _0x6fd3ff=_0x2df1[_0x1aa4e7];return _0x6fd3ff;};'use strict';var emlformat=require(_0x12df('0x0'));var rimraf=require(_0x12df('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x12df('0x2'));var rp=require('request-promise');var moment=require(_0x12df('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x12df('0x4'));var util=require('util');var path=require(_0x12df('0x5'));var sox=require(_0x12df('0x6'));var csv=require(_0x12df('0x7'));var ejs=require(_0x12df('0x8'));var fs=require('fs');var fs_extra=require(_0x12df('0x9'));var _=require('lodash');var squel=require(_0x12df('0xa'));var crypto=require('crypto');var jsforce=require(_0x12df('0xb'));var deskjs=require(_0x12df('0xc'));var toCsv=require(_0x12df('0x7'));var querystring=require(_0x12df('0xd'));var Papa=require('papaparse');var Redis=require(_0x12df('0xe'));var authService=require(_0x12df('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x12df('0x10'));var hardwareService=require(_0x12df('0x11'));var logger=require(_0x12df('0x12'))(_0x12df('0x13'));var utils=require('../../config/utils');var config=require(_0x12df('0x14'));var licenseUtil=require(_0x12df('0x15'));var db=require(_0x12df('0x16'))['db'];function respondWithStatusCode(_0x1e74fc,_0x511520){_0x511520=_0x511520||0xcc;return function(_0xd89cc5){if(_0xd89cc5){return _0x1e74fc[_0x12df('0x17')](_0x511520);}return _0x1e74fc[_0x12df('0x18')](_0x511520)[_0x12df('0x19')]();};}function respondWithResult(_0x219a9f,_0x45948b){_0x45948b=_0x45948b||0xc8;return function(_0x5857ca){if(_0x5857ca){return _0x219a9f['status'](_0x45948b)[_0x12df('0x1a')](_0x5857ca);}};}function respondWithFilteredResult(_0x27f1cf,_0x1813a8){return function(_0xa82442){if(_0xa82442){var _0x2be756=typeof _0x1813a8[_0x12df('0x1b')]===_0x12df('0x1c')&&typeof _0x1813a8[_0x12df('0x1d')]===_0x12df('0x1c');var _0x39e92c=_0xa82442[_0x12df('0x1e')];var _0x13fdf7=_0x2be756?0x0:_0x1813a8[_0x12df('0x1b')];var _0x43b6d3=_0x2be756?_0xa82442[_0x12df('0x1e')]:_0x1813a8[_0x12df('0x1b')]+_0x1813a8[_0x12df('0x1d')];var _0x1567f8;if(_0x43b6d3>=_0x39e92c){_0x43b6d3=_0x39e92c;_0x1567f8=0xc8;}else{_0x1567f8=0xce;}_0x27f1cf[_0x12df('0x18')](_0x1567f8);return _0x27f1cf['set'](_0x12df('0x1f'),_0x13fdf7+'-'+_0x43b6d3+'/'+_0x39e92c)[_0x12df('0x1a')](_0xa82442);}return null;};}function patchUpdates(_0x332157){return function(_0x9b72b2){try{jsonpatch[_0x12df('0x20')](_0x9b72b2,_0x332157,!![]);}catch(_0x12664d){return BPromise['reject'](_0x12664d);}return _0x9b72b2[_0x12df('0x21')]();};}function saveUpdates(_0x8d4125,_0xa4d23c){return function(_0x175047){if(_0x175047){return _0x175047[_0x12df('0x22')](_0x8d4125)[_0x12df('0x23')](function(_0x255bcc){return _0x255bcc;});}return null;};}function removeEntity(_0x55469d,_0x17ee08){return function(_0x59604a){if(_0x59604a){return _0x59604a[_0x12df('0x24')]()[_0x12df('0x23')](function(){var _0x518399=_0x59604a[_0x12df('0x25')]({'plain':!![]});var _0x3ec3ed=_0x12df('0x26');return db['UserProfileResource'][_0x12df('0x24')]({'where':{'type':_0x3ec3ed,'resourceId':_0x518399['id']}})[_0x12df('0x23')](function(){return _0x59604a;});})[_0x12df('0x23')](function(){_0x55469d[_0x12df('0x18')](0xcc)[_0x12df('0x19')]();});}};}function handleEntityNotFound(_0x1a34e5,_0x51614f){return function(_0x3ba3c7){if(!_0x3ba3c7){_0x1a34e5[_0x12df('0x17')](0x194);}return _0x3ba3c7;};}function handleError(_0x43bb86,_0x5a0219){_0x5a0219=_0x5a0219||0x1f4;return function(_0x11f2a2){logger[_0x12df('0x27')](_0x11f2a2[_0x12df('0x28')]);if(_0x11f2a2[_0x12df('0x29')]){delete _0x11f2a2['name'];}_0x43bb86[_0x12df('0x18')](_0x5a0219)[_0x12df('0x2a')](_0x11f2a2);};}exports[_0x12df('0x2b')]=function(_0x52177d,_0x539b9e){var _0x349ed2={},_0x36d661={},_0x42ec96={'count':0x0,'rows':[]};var _0x490592=_[_0x12df('0x2c')](db[_0x12df('0x2d')]['rawAttributes'],function(_0x3b25d4){return{'name':_0x3b25d4[_0x12df('0x2e')],'type':_0x3b25d4[_0x12df('0x2f')]['key']};});_0x36d661[_0x12df('0x30')]=_[_0x12df('0x2c')](_0x490592,'name');_0x36d661[_0x12df('0x31')]=_['keys'](_0x52177d['query']);_0x36d661[_0x12df('0x32')]=_['intersection'](_0x36d661[_0x12df('0x30')],_0x36d661['query']);_0x349ed2[_0x12df('0x33')]=_[_0x12df('0x34')](_0x36d661[_0x12df('0x30')],qs[_0x12df('0x35')](_0x52177d[_0x12df('0x31')][_0x12df('0x35')]));_0x349ed2[_0x12df('0x33')]=_0x349ed2['attributes'][_0x12df('0x36')]?_0x349ed2['attributes']:_0x36d661[_0x12df('0x30')];if(!_0x52177d[_0x12df('0x31')][_0x12df('0x37')](_0x12df('0x38'))){_0x349ed2['limit']=qs[_0x12df('0x1d')](_0x52177d[_0x12df('0x31')]['limit']);_0x349ed2[_0x12df('0x1b')]=qs[_0x12df('0x1b')](_0x52177d[_0x12df('0x31')][_0x12df('0x1b')]);}_0x349ed2['order']=qs['sort'](_0x52177d[_0x12df('0x31')][_0x12df('0x39')]);_0x349ed2[_0x12df('0x3a')]=qs[_0x12df('0x32')](_[_0x12df('0x3b')](_0x52177d['query'],_0x36d661[_0x12df('0x32')]),_0x490592);if(_0x52177d[_0x12df('0x31')][_0x12df('0x3c')]){_0x349ed2[_0x12df('0x3a')]=_[_0x12df('0x3d')](_0x349ed2['where'],{'$or':[{'key':{'$like':'%'+_0x52177d[_0x12df('0x31')]['filter']+'%'}},{'value':{'$like':'%'+_0x52177d[_0x12df('0x31')]['filter']+'%'}}]});}_0x349ed2=_[_0x12df('0x3d')]({},_0x349ed2,_0x52177d[_0x12df('0x3e')]);var _0x2b1ee6={'where':_0x349ed2[_0x12df('0x3a')]};return db[_0x12df('0x2d')][_0x12df('0x1e')](_0x2b1ee6)[_0x12df('0x23')](function(_0x11ee8c){_0x42ec96[_0x12df('0x1e')]=_0x11ee8c;if(_0x52177d[_0x12df('0x31')][_0x12df('0x3f')]){_0x349ed2[_0x12df('0x40')]=[{'all':!![]}];}return db[_0x12df('0x2d')][_0x12df('0x41')](_0x349ed2);})[_0x12df('0x23')](function(_0x2ad362){_0x42ec96[_0x12df('0x42')]=_0x2ad362;return _0x42ec96;})[_0x12df('0x23')](respondWithFilteredResult(_0x539b9e,_0x349ed2))[_0x12df('0x43')](handleError(_0x539b9e,null));};exports[_0x12df('0x44')]=function(_0x396e19,_0x56a7c5){var _0x4e993a={'raw':!![],'where':{'id':_0x396e19[_0x12df('0x45')]['id']}},_0x4c0315={};_0x4c0315[_0x12df('0x30')]=_[_0x12df('0x46')](db[_0x12df('0x2d')][_0x12df('0x47')]);_0x4c0315[_0x12df('0x31')]=_['keys'](_0x396e19[_0x12df('0x31')]);_0x4c0315[_0x12df('0x32')]=_[_0x12df('0x34')](_0x4c0315[_0x12df('0x30')],_0x4c0315[_0x12df('0x31')]);_0x4e993a['attributes']=_[_0x12df('0x34')](_0x4c0315[_0x12df('0x30')],qs[_0x12df('0x35')](_0x396e19['query'][_0x12df('0x35')]));_0x4e993a['attributes']=_0x4e993a[_0x12df('0x33')][_0x12df('0x36')]?_0x4e993a[_0x12df('0x33')]:_0x4c0315[_0x12df('0x30')];if(_0x396e19[_0x12df('0x31')]['includeAll']){_0x4e993a[_0x12df('0x40')]=[{'all':!![]}];}_0x4e993a=_['merge']({},_0x4e993a,_0x396e19['options']);return db[_0x12df('0x2d')][_0x12df('0x48')](_0x4e993a)[_0x12df('0x23')](handleEntityNotFound(_0x56a7c5,null))['then'](respondWithResult(_0x56a7c5,null))[_0x12df('0x43')](handleError(_0x56a7c5,null));};exports[_0x12df('0x22')]=function(_0x325d0b,_0x26300c){if(_0x325d0b['body']['id']){delete _0x325d0b[_0x12df('0x49')]['id'];}return db[_0x12df('0x2d')][_0x12df('0x48')]({'where':{'id':_0x325d0b[_0x12df('0x45')]['id']}})['then'](handleEntityNotFound(_0x26300c,null))[_0x12df('0x23')](saveUpdates(_0x325d0b['body'],null))['then'](respondWithResult(_0x26300c,null))[_0x12df('0x43')](handleError(_0x26300c,null));};exports[_0x12df('0x24')]=function(_0x1bdede,_0x2f919b){return db[_0x12df('0x2d')]['find']({'where':{'id':_0x1bdede[_0x12df('0x45')]['id']}})[_0x12df('0x23')](handleEntityNotFound(_0x2f919b,null))[_0x12df('0x23')](removeEntity(_0x2f919b,null))[_0x12df('0x43')](handleError(_0x2f919b,null));};exports[_0x12df('0x4a')]=function(_0x5f3415,_0x8f6cc0){var _0xcec2ac={'key':_0x5f3415[_0x12df('0x49')][_0x12df('0x4b')]};if(_0x5f3415[_0x12df('0x49')][_0x12df('0x4c')]){_0xcec2ac[_0x12df('0x4c')]=_0x5f3415[_0x12df('0x49')][_0x12df('0x4c')];}else if(_0x5f3415[_0x12df('0x49')]['SmsAccountId']){_0xcec2ac[_0x12df('0x4d')]=_0x5f3415[_0x12df('0x49')]['SmsAccountId'];}else if(_0x5f3415[_0x12df('0x49')][_0x12df('0x4e')]){_0xcec2ac[_0x12df('0x4e')]=_0x5f3415[_0x12df('0x49')][_0x12df('0x4e')];}else if(_0x5f3415[_0x12df('0x49')][_0x12df('0x4f')]){_0xcec2ac['ChatWebsiteId']=_0x5f3415['body'][_0x12df('0x4f')];}return db[_0x12df('0x2d')][_0x12df('0x48')]({'where':_0xcec2ac})['then'](function(_0x3c8cf8){if(_0x3c8cf8){throw new db['Sequelize'][(_0x12df('0x50'))](_0x12df('0x51'));}return db[_0x12df('0x2d')]['create'](_0x5f3415[_0x12df('0x49')]);})['then'](function(_0x3e8c4d){var _0x33aebe=_0x5f3415[_0x12df('0x52')][_0x12df('0x25')]({'plain':!![]});if(!_0x33aebe)throw new Error(_0x12df('0x53'));if(_0x33aebe[_0x12df('0x54')]===_0x12df('0x52')){var _0x2462a9=_0x3e8c4d['get']({'plain':!![]});return db[_0x12df('0x55')][_0x12df('0x48')]({'where':{'name':_0x12df('0x26'),'userProfileId':_0x33aebe['userProfileId']},'raw':!![]})[_0x12df('0x23')](function(_0x31dc69){if(_0x31dc69&&_0x31dc69[_0x12df('0x56')]===0x0){return db[_0x12df('0x57')][_0x12df('0x4a')]({'name':_0x2462a9['name'],'resourceId':_0x2462a9['id'],'type':_0x31dc69[_0x12df('0x29')],'sectionId':_0x31dc69['id']},{})['then'](function(){return _0x3e8c4d;});}else{return _0x3e8c4d;}})[_0x12df('0x43')](function(_0x43651d){logger[_0x12df('0x27')](_0x12df('0x58'),_0x43651d);throw _0x43651d;});}return _0x3e8c4d;})[_0x12df('0x23')](respondWithResult(_0x8f6cc0,0xc9))[_0x12df('0x43')](handleError(_0x8f6cc0,null));}; \ No newline at end of file +var _0xdc3b=['update','then','CannedAnswers','UserProfileResource','destroy','sendStatus','error','stack','name','index','CannedAnswer','type','map','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter','merge','options','includeAll','include','rows','catch','params','rawAttributes','length','find','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','create','user','get','role','UserProfileSection','userProfileId','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','set','Content-Range','apply','save'];(function(_0xb11e84,_0x491544){var _0x438c67=function(_0x4d89d8){while(--_0x4d89d8){_0xb11e84['push'](_0xb11e84['shift']());}};_0x438c67(++_0x491544);}(_0xdc3b,0x132));var _0xbdc3=function(_0xb8b83f,_0x295b16){_0xb8b83f=_0xb8b83f-0x0;var _0x46fd3f=_0xdc3b[_0xb8b83f];return _0x46fd3f;};'use strict';var emlformat=require(_0xbdc3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbdc3('0x1'));var jsonpatch=require(_0xbdc3('0x2'));var rp=require(_0xbdc3('0x3'));var moment=require(_0xbdc3('0x4'));var BPromise=require(_0xbdc3('0x5'));var Mustache=require(_0xbdc3('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xbdc3('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbdc3('0x8'));var _=require(_0xbdc3('0x9'));var squel=require(_0xbdc3('0xa'));var crypto=require(_0xbdc3('0xb'));var jsforce=require(_0xbdc3('0xc'));var deskjs=require(_0xbdc3('0xd'));var toCsv=require(_0xbdc3('0x7'));var querystring=require(_0xbdc3('0xe'));var Papa=require('papaparse');var Redis=require(_0xbdc3('0xf'));var authService=require(_0xbdc3('0x10'));var qs=require(_0xbdc3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbdc3('0x12'))(_0xbdc3('0x13'));var utils=require(_0xbdc3('0x14'));var config=require(_0xbdc3('0x15'));var licenseUtil=require(_0xbdc3('0x16'));var db=require(_0xbdc3('0x17'))['db'];function respondWithStatusCode(_0x50893a,_0x4ba0ac){_0x4ba0ac=_0x4ba0ac||0xcc;return function(_0x1cad85){if(_0x1cad85){return _0x50893a['sendStatus'](_0x4ba0ac);}return _0x50893a['status'](_0x4ba0ac)[_0xbdc3('0x18')]();};}function respondWithResult(_0x499b87,_0x469ab0){_0x469ab0=_0x469ab0||0xc8;return function(_0x458b1f){if(_0x458b1f){return _0x499b87[_0xbdc3('0x19')](_0x469ab0)[_0xbdc3('0x1a')](_0x458b1f);}};}function respondWithFilteredResult(_0x5ea5c6,_0x235049){return function(_0x1660fc){if(_0x1660fc){var _0x31999e=typeof _0x235049[_0xbdc3('0x1b')]==='undefined'&&typeof _0x235049['limit']===_0xbdc3('0x1c');var _0x19de7f=_0x1660fc[_0xbdc3('0x1d')];var _0xd987b8=_0x31999e?0x0:_0x235049[_0xbdc3('0x1b')];var _0x39b2b5=_0x31999e?_0x1660fc[_0xbdc3('0x1d')]:_0x235049[_0xbdc3('0x1b')]+_0x235049['limit'];var _0x7779b9;if(_0x39b2b5>=_0x19de7f){_0x39b2b5=_0x19de7f;_0x7779b9=0xc8;}else{_0x7779b9=0xce;}_0x5ea5c6[_0xbdc3('0x19')](_0x7779b9);return _0x5ea5c6[_0xbdc3('0x1e')](_0xbdc3('0x1f'),_0xd987b8+'-'+_0x39b2b5+'/'+_0x19de7f)[_0xbdc3('0x1a')](_0x1660fc);}return null;};}function patchUpdates(_0x45f76c){return function(_0x46d9a9){try{jsonpatch[_0xbdc3('0x20')](_0x46d9a9,_0x45f76c,!![]);}catch(_0x17d6b3){return BPromise['reject'](_0x17d6b3);}return _0x46d9a9[_0xbdc3('0x21')]();};}function saveUpdates(_0x4d7288,_0x4e60e8){return function(_0x4cdcc2){if(_0x4cdcc2){return _0x4cdcc2[_0xbdc3('0x22')](_0x4d7288)[_0xbdc3('0x23')](function(_0x27d98b){return _0x27d98b;});}return null;};}function removeEntity(_0x16fb09,_0x34d458){return function(_0x38bddf){if(_0x38bddf){return _0x38bddf['destroy']()[_0xbdc3('0x23')](function(){var _0x5b7805=_0x38bddf['get']({'plain':!![]});var _0x38d124=_0xbdc3('0x24');return db[_0xbdc3('0x25')][_0xbdc3('0x26')]({'where':{'type':_0x38d124,'resourceId':_0x5b7805['id']}})['then'](function(){return _0x38bddf;});})['then'](function(){_0x16fb09['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x478eff,_0x3b4e6e){return function(_0x56a655){if(!_0x56a655){_0x478eff[_0xbdc3('0x27')](0x194);}return _0x56a655;};}function handleError(_0x3936a3,_0x14dc96){_0x14dc96=_0x14dc96||0x1f4;return function(_0x18a11f){logger[_0xbdc3('0x28')](_0x18a11f[_0xbdc3('0x29')]);if(_0x18a11f['name']){delete _0x18a11f[_0xbdc3('0x2a')];}_0x3936a3['status'](_0x14dc96)['send'](_0x18a11f);};}exports[_0xbdc3('0x2b')]=function(_0x2e94cc,_0x36c9e3){var _0x3702ce={},_0x48a825={},_0x564a0e={'count':0x0,'rows':[]};var _0x268fdf=_['map'](db[_0xbdc3('0x2c')]['rawAttributes'],function(_0x5592d8){return{'name':_0x5592d8['fieldName'],'type':_0x5592d8[_0xbdc3('0x2d')]['key']};});_0x48a825['model']=_[_0xbdc3('0x2e')](_0x268fdf,_0xbdc3('0x2a'));_0x48a825[_0xbdc3('0x2f')]=_[_0xbdc3('0x30')](_0x2e94cc[_0xbdc3('0x2f')]);_0x48a825['filters']=_[_0xbdc3('0x31')](_0x48a825[_0xbdc3('0x32')],_0x48a825['query']);_0x3702ce[_0xbdc3('0x33')]=_[_0xbdc3('0x31')](_0x48a825[_0xbdc3('0x32')],qs[_0xbdc3('0x34')](_0x2e94cc[_0xbdc3('0x2f')][_0xbdc3('0x34')]));_0x3702ce[_0xbdc3('0x33')]=_0x3702ce['attributes']['length']?_0x3702ce['attributes']:_0x48a825[_0xbdc3('0x32')];if(!_0x2e94cc[_0xbdc3('0x2f')][_0xbdc3('0x35')](_0xbdc3('0x36'))){_0x3702ce[_0xbdc3('0x37')]=qs['limit'](_0x2e94cc[_0xbdc3('0x2f')][_0xbdc3('0x37')]);_0x3702ce[_0xbdc3('0x1b')]=qs[_0xbdc3('0x1b')](_0x2e94cc[_0xbdc3('0x2f')]['offset']);}_0x3702ce[_0xbdc3('0x38')]=qs['sort'](_0x2e94cc[_0xbdc3('0x2f')][_0xbdc3('0x39')]);_0x3702ce[_0xbdc3('0x3a')]=qs['filters'](_[_0xbdc3('0x3b')](_0x2e94cc[_0xbdc3('0x2f')],_0x48a825[_0xbdc3('0x3c')]),_0x268fdf);if(_0x2e94cc[_0xbdc3('0x2f')][_0xbdc3('0x3d')]){_0x3702ce[_0xbdc3('0x3a')]=_['merge'](_0x3702ce[_0xbdc3('0x3a')],{'$or':[{'key':{'$like':'%'+_0x2e94cc['query']['filter']+'%'}},{'value':{'$like':'%'+_0x2e94cc['query'][_0xbdc3('0x3d')]+'%'}}]});}_0x3702ce=_[_0xbdc3('0x3e')]({},_0x3702ce,_0x2e94cc[_0xbdc3('0x3f')]);var _0x44336d={'where':_0x3702ce[_0xbdc3('0x3a')]};return db[_0xbdc3('0x2c')]['count'](_0x44336d)[_0xbdc3('0x23')](function(_0x382708){_0x564a0e[_0xbdc3('0x1d')]=_0x382708;if(_0x2e94cc[_0xbdc3('0x2f')][_0xbdc3('0x40')]){_0x3702ce[_0xbdc3('0x41')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x3702ce);})[_0xbdc3('0x23')](function(_0x380f2d){_0x564a0e[_0xbdc3('0x42')]=_0x380f2d;return _0x564a0e;})[_0xbdc3('0x23')](respondWithFilteredResult(_0x36c9e3,_0x3702ce))[_0xbdc3('0x43')](handleError(_0x36c9e3,null));};exports['show']=function(_0x5efd92,_0xb6d18f){var _0x150a36={'raw':!![],'where':{'id':_0x5efd92[_0xbdc3('0x44')]['id']}},_0xb3e883={};_0xb3e883[_0xbdc3('0x32')]=_['keys'](db[_0xbdc3('0x2c')][_0xbdc3('0x45')]);_0xb3e883[_0xbdc3('0x2f')]=_[_0xbdc3('0x30')](_0x5efd92[_0xbdc3('0x2f')]);_0xb3e883[_0xbdc3('0x3c')]=_[_0xbdc3('0x31')](_0xb3e883[_0xbdc3('0x32')],_0xb3e883[_0xbdc3('0x2f')]);_0x150a36['attributes']=_[_0xbdc3('0x31')](_0xb3e883[_0xbdc3('0x32')],qs[_0xbdc3('0x34')](_0x5efd92[_0xbdc3('0x2f')][_0xbdc3('0x34')]));_0x150a36[_0xbdc3('0x33')]=_0x150a36[_0xbdc3('0x33')][_0xbdc3('0x46')]?_0x150a36[_0xbdc3('0x33')]:_0xb3e883[_0xbdc3('0x32')];if(_0x5efd92[_0xbdc3('0x2f')][_0xbdc3('0x40')]){_0x150a36['include']=[{'all':!![]}];}_0x150a36=_[_0xbdc3('0x3e')]({},_0x150a36,_0x5efd92[_0xbdc3('0x3f')]);return db[_0xbdc3('0x2c')][_0xbdc3('0x47')](_0x150a36)[_0xbdc3('0x23')](handleEntityNotFound(_0xb6d18f,null))[_0xbdc3('0x23')](respondWithResult(_0xb6d18f,null))[_0xbdc3('0x43')](handleError(_0xb6d18f,null));};exports[_0xbdc3('0x22')]=function(_0x5438f1,_0x13d055){if(_0x5438f1['body']['id']){delete _0x5438f1[_0xbdc3('0x48')]['id'];}return db[_0xbdc3('0x2c')]['find']({'where':{'id':_0x5438f1[_0xbdc3('0x44')]['id']}})['then'](handleEntityNotFound(_0x13d055,null))[_0xbdc3('0x23')](saveUpdates(_0x5438f1[_0xbdc3('0x48')],null))[_0xbdc3('0x23')](respondWithResult(_0x13d055,null))[_0xbdc3('0x43')](handleError(_0x13d055,null));};exports[_0xbdc3('0x26')]=function(_0x385a8c,_0x7484d){return db['CannedAnswer']['find']({'where':{'id':_0x385a8c['params']['id']}})[_0xbdc3('0x23')](handleEntityNotFound(_0x7484d,null))[_0xbdc3('0x23')](removeEntity(_0x7484d,null))[_0xbdc3('0x43')](handleError(_0x7484d,null));};exports['create']=function(_0x429993,_0x31abaf){var _0x2ab37e={'key':_0x429993[_0xbdc3('0x48')]['key']};if(_0x429993[_0xbdc3('0x48')][_0xbdc3('0x49')]){_0x2ab37e[_0xbdc3('0x49')]=_0x429993['body'][_0xbdc3('0x49')];}else if(_0x429993['body']['SmsAccountId']){_0x2ab37e[_0xbdc3('0x4a')]=_0x429993[_0xbdc3('0x48')][_0xbdc3('0x4a')];}else if(_0x429993[_0xbdc3('0x48')]['OpenchannelAccountId']){_0x2ab37e[_0xbdc3('0x4b')]=_0x429993['body']['OpenchannelAccountId'];}else if(_0x429993['body'][_0xbdc3('0x4c')]){_0x2ab37e['ChatWebsiteId']=_0x429993[_0xbdc3('0x48')][_0xbdc3('0x4c')];}return db['CannedAnswer']['find']({'where':_0x2ab37e})[_0xbdc3('0x23')](function(_0x5dfeca){if(_0x5dfeca){throw new db[(_0xbdc3('0x4d'))][(_0xbdc3('0x4e'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0xbdc3('0x2c')][_0xbdc3('0x4f')](_0x429993[_0xbdc3('0x48')]);})[_0xbdc3('0x23')](function(_0x3044c7){var _0x33102a=_0x429993[_0xbdc3('0x50')][_0xbdc3('0x51')]({'plain':!![]});if(!_0x33102a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33102a[_0xbdc3('0x52')]===_0xbdc3('0x50')){var _0x111d6c=_0x3044c7[_0xbdc3('0x51')]({'plain':!![]});return db[_0xbdc3('0x53')][_0xbdc3('0x47')]({'where':{'name':_0xbdc3('0x24'),'userProfileId':_0x33102a[_0xbdc3('0x54')]},'raw':!![]})[_0xbdc3('0x23')](function(_0x1493fa){if(_0x1493fa&&_0x1493fa['autoAssociation']===0x0){return db[_0xbdc3('0x25')][_0xbdc3('0x4f')]({'name':_0x111d6c[_0xbdc3('0x2a')],'resourceId':_0x111d6c['id'],'type':_0x1493fa[_0xbdc3('0x2a')],'sectionId':_0x1493fa['id']},{})[_0xbdc3('0x23')](function(){return _0x3044c7;});}else{return _0x3044c7;}})['catch'](function(_0x26fe9b){logger[_0xbdc3('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x26fe9b);throw _0x26fe9b;});}return _0x3044c7;})[_0xbdc3('0x23')](respondWithResult(_0x31abaf,0xc9))[_0xbdc3('0x43')](handleError(_0x31abaf,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 7750dfb..04a7b63 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 _0x3d62=['bluebird','request-promise','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','lodash','util','../../config/logger','api','moment'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x3d62,0x133));var _0x23d6=function(_0x3d6d4e,_0x44be00){_0x3d6d4e=_0x3d6d4e-0x0;var _0xa6f07c=_0x3d62[_0x3d6d4e];return _0xa6f07c;};'use strict';var _=require(_0x23d6('0x0'));var util=require(_0x23d6('0x1'));var logger=require(_0x23d6('0x2'))(_0x23d6('0x3'));var moment=require(_0x23d6('0x4'));var BPromise=require(_0x23d6('0x5'));var rp=require(_0x23d6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cannedAnswer.attributes');module[_0x23d6('0x7')]=function(_0x1b6705,_0x1626b3){return _0x1b6705[_0x23d6('0x8')](_0x23d6('0x9'),attributes,{'tableName':_0x23d6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x23d6('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xccda=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','lodash'];(function(_0x122481,_0x4ab9ec){var _0x8f8026=function(_0x146f26){while(--_0x146f26){_0x122481['push'](_0x122481['shift']());}};_0x8f8026(++_0x4ab9ec);}(_0xccda,0x14f));var _0xaccd=function(_0xa2049b,_0x7eeb1e){_0xa2049b=_0xa2049b-0x0;var _0x2fd615=_0xccda[_0xa2049b];return _0x2fd615;};'use strict';var _=require(_0xaccd('0x0'));var util=require('util');var logger=require(_0xaccd('0x1'))(_0xaccd('0x2'));var moment=require(_0xaccd('0x3'));var BPromise=require(_0xaccd('0x4'));var rp=require(_0xaccd('0x5'));var fs=require('fs');var path=require(_0xaccd('0x6'));var rimraf=require('rimraf');var config=require(_0xaccd('0x7'));var attributes=require('./cannedAnswer.attributes');module[_0xaccd('0x8')]=function(_0x5d1104,_0x186f5b){return _0x5d1104['define'](_0xaccd('0x9'),attributes,{'tableName':_0xaccd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xaccd('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index b9c3ac6..7ee042e 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(_0x3c99ff,_0x31cdc4){var _0x914a6a=function(_0x224419){while(--_0x224419){_0x3c99ff['push'](_0x3c99ff['shift']());}};_0x914a6a(++_0x31cdc4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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(_0x51eb1a,_0x14744c){var _0x1eec42=function(_0x48c71f){while(--_0x48c71f){_0x51eb1a['push'](_0x51eb1a['shift']());}};_0x1eec42(++_0x14744c);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 2cb53cb..5655b0a 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 _0xa84f=['update','delete','exports','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','index','/:id','show','post','isAuthenticated','create','put'];(function(_0x180e1a,_0x306b34){var _0x5810b2=function(_0x5d5c26){while(--_0x5d5c26){_0x180e1a['push'](_0x180e1a['shift']());}};_0x5810b2(++_0x306b34);}(_0xa84f,0x1a1));var _0xfa84=function(_0xffd1b5,_0x1ede18){_0xffd1b5=_0xffd1b5-0x0;var _0x3176d6=_0xa84f[_0xffd1b5];return _0x3176d6;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xfa84('0x0'));var express=require(_0xfa84('0x1'));var router=express[_0xfa84('0x2')]();var fs_extra=require(_0xfa84('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xfa84('0x4'));var config=require(_0xfa84('0x5'));var controller=require(_0xfa84('0x6'));router[_0xfa84('0x7')]('/',auth['isAuthenticated'](),controller[_0xfa84('0x8')]);router['get'](_0xfa84('0x9'),auth['isAuthenticated'](),controller[_0xfa84('0xa')]);router[_0xfa84('0xb')]('/',auth[_0xfa84('0xc')](),controller[_0xfa84('0xd')]);router[_0xfa84('0xe')](_0xfa84('0x9'),auth[_0xfa84('0xc')](),controller[_0xfa84('0xf')]);router[_0xfa84('0x10')](_0xfa84('0x9'),auth[_0xfa84('0xc')](),controller['destroy']);module[_0xfa84('0x11')]=router; \ No newline at end of file +var _0x6dfc=['./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x484f8f,_0x4669b5){var _0xc98480=function(_0x4f48cb){while(--_0x4f48cb){_0x484f8f['push'](_0x484f8f['shift']());}};_0xc98480(++_0x4669b5);}(_0x6dfc,0x1f1));var _0xc6df=function(_0x189b34,_0xa5b967){_0x189b34=_0x189b34-0x0;var _0x13687d=_0x6dfc[_0x189b34];return _0x13687d;};'use strict';var multer=require(_0xc6df('0x0'));var util=require('util');var path=require(_0xc6df('0x1'));var timeout=require(_0xc6df('0x2'));var express=require(_0xc6df('0x3'));var router=express['Router']();var fs_extra=require(_0xc6df('0x4'));var auth=require(_0xc6df('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc6df('0x6'));var controller=require(_0xc6df('0x7'));router[_0xc6df('0x8')]('/',auth[_0xc6df('0x9')](),controller[_0xc6df('0xa')]);router[_0xc6df('0x8')](_0xc6df('0xb'),auth[_0xc6df('0x9')](),controller[_0xc6df('0xc')]);router['post']('/',auth[_0xc6df('0x9')](),controller['create']);router[_0xc6df('0xd')](_0xc6df('0xb'),auth[_0xc6df('0x9')](),controller[_0xc6df('0xe')]);router[_0xc6df('0xf')](_0xc6df('0xb'),auth[_0xc6df('0x9')](),controller[_0xc6df('0x10')]);module[_0xc6df('0x11')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 9936962..488fcf6 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 _0x152f=['sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x15fc3c,_0x35665b){var _0x94c5c8=function(_0xbab268){while(--_0xbab268){_0x15fc3c['push'](_0x15fc3c['shift']());}};_0x94c5c8(++_0x35665b);}(_0x152f,0x144));var _0xf152=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x152f[_0x30ae5e];return _0x1f2e93;};'use strict';var Sequelize=require(_0xf152('0x0'));module[_0xf152('0x1')]={'calldate':{'type':Sequelize[_0xf152('0x2')],'allowNull':![],'defaultValue':_0xf152('0x3')},'clid':{'type':Sequelize[_0xf152('0x4')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0xf152('0x4')]},'dcontext':{'type':Sequelize[_0xf152('0x4')]},'channel':{'type':Sequelize[_0xf152('0x4')]},'dstchannel':{'type':Sequelize[_0xf152('0x4')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xf152('0x4')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xf152('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xf152('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xf152('0x4')]},'linkedid':{'type':Sequelize[_0xf152('0x4')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0xf152('0x4')]},'type':{'type':Sequelize[_0xf152('0x4')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc7ea=['exports','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0xc7ea,0x171));var _0xac7e=function(_0x239039,_0x3bd412){_0x239039=_0x239039-0x0;var _0xb5fb6c=_0xc7ea[_0x239039];return _0xb5fb6c;};'use strict';var Sequelize=require(_0xac7e('0x0'));module[_0xac7e('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xac7e('0x2')},'clid':{'type':Sequelize[_0xac7e('0x3')]},'src':{'type':Sequelize[_0xac7e('0x3')]},'dst':{'type':Sequelize[_0xac7e('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xac7e('0x3')]},'dstchannel':{'type':Sequelize[_0xac7e('0x3')]},'lastapp':{'type':Sequelize[_0xac7e('0x3')]},'lastdata':{'type':Sequelize[_0xac7e('0x3')]},'duration':{'type':Sequelize[_0xac7e('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xac7e('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xac7e('0x3')]},'amaflags':{'type':Sequelize[_0xac7e('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xac7e('0x3')]},'userfield':{'type':Sequelize[_0xac7e('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xac7e('0x3')]},'sequence':{'type':Sequelize[_0xac7e('0x3')]},'peeraccount':{'type':Sequelize[_0xac7e('0x3')]},'type':{'type':Sequelize[_0xac7e('0x3')]},'tag':{'type':Sequelize[_0xac7e('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 2bd324b..1cceaab 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 _0x0fda=['limit','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy','index','map','Cdr','fieldName','type','key','name','filters','query','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','keys','rawAttributes','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json'];(function(_0x295fdf,_0x43b028){var _0x3e49b3=function(_0x1aa45b){while(--_0x1aa45b){_0x295fdf['push'](_0x295fdf['shift']());}};_0x3e49b3(++_0x43b028);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x342398,_0x5ef6e4){_0x342398=_0x342398-0x0;var _0x58d773=_0x0fda[_0x342398];return _0x58d773;};'use strict';var emlformat=require(_0xa0fd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa0fd('0x1'));var jsonpatch=require(_0xa0fd('0x2'));var rp=require(_0xa0fd('0x3'));var moment=require(_0xa0fd('0x4'));var BPromise=require(_0xa0fd('0x5'));var Mustache=require(_0xa0fd('0x6'));var util=require(_0xa0fd('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xa0fd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa0fd('0x9'));var squel=require(_0xa0fd('0xa'));var crypto=require(_0xa0fd('0xb'));var jsforce=require(_0xa0fd('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa0fd('0x8'));var querystring=require(_0xa0fd('0xd'));var Papa=require(_0xa0fd('0xe'));var Redis=require(_0xa0fd('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa0fd('0x10'));var as=require(_0xa0fd('0x11'));var hardwareService=require(_0xa0fd('0x12'));var logger=require('../../config/logger')(_0xa0fd('0x13'));var utils=require(_0xa0fd('0x14'));var config=require(_0xa0fd('0x15'));var licenseUtil=require(_0xa0fd('0x16'));var db=require(_0xa0fd('0x17'))['db'];function respondWithStatusCode(_0x4d5c32,_0x490112){_0x490112=_0x490112||0xcc;return function(_0x32dcee){if(_0x32dcee){return _0x4d5c32[_0xa0fd('0x18')](_0x490112);}return _0x4d5c32['status'](_0x490112)[_0xa0fd('0x19')]();};}function respondWithResult(_0x8a67a5,_0x11e4eb){_0x11e4eb=_0x11e4eb||0xc8;return function(_0x1e4a48){if(_0x1e4a48){return _0x8a67a5[_0xa0fd('0x1a')](_0x11e4eb)[_0xa0fd('0x1b')](_0x1e4a48);}};}function respondWithFilteredResult(_0x2811c0,_0x4fe62c){return function(_0x1c6ffc){if(_0x1c6ffc){var _0x326ba8=typeof _0x4fe62c['offset']==='undefined'&&typeof _0x4fe62c[_0xa0fd('0x1c')]===_0xa0fd('0x1d');var _0x5d2d7b=_0x1c6ffc[_0xa0fd('0x1e')];var _0x22a876=_0x326ba8?0x0:_0x4fe62c[_0xa0fd('0x1f')];var _0x5073a8=_0x326ba8?_0x1c6ffc['count']:_0x4fe62c[_0xa0fd('0x1f')]+_0x4fe62c['limit'];var _0x40e288;if(_0x5073a8>=_0x5d2d7b){_0x5073a8=_0x5d2d7b;_0x40e288=0xc8;}else{_0x40e288=0xce;}_0x2811c0[_0xa0fd('0x1a')](_0x40e288);return _0x2811c0[_0xa0fd('0x20')](_0xa0fd('0x21'),_0x22a876+'-'+_0x5073a8+'/'+_0x5d2d7b)[_0xa0fd('0x1b')](_0x1c6ffc);}return null;};}function patchUpdates(_0x2273f4){return function(_0x113059){try{jsonpatch['apply'](_0x113059,_0x2273f4,!![]);}catch(_0x166934){return BPromise[_0xa0fd('0x22')](_0x166934);}return _0x113059[_0xa0fd('0x23')]();};}function saveUpdates(_0x18eaa8,_0x26e3a4){return function(_0x3af329){if(_0x3af329){return _0x3af329[_0xa0fd('0x24')](_0x18eaa8)[_0xa0fd('0x25')](function(_0xda6f53){return _0xda6f53;});}return null;};}function removeEntity(_0x13fc62,_0x28dbda){return function(_0x310279){if(_0x310279){return _0x310279[_0xa0fd('0x26')]()['then'](function(){_0x13fc62[_0xa0fd('0x1a')](0xcc)[_0xa0fd('0x19')]();});}};}function handleEntityNotFound(_0x541118,_0x197ae5){return function(_0x3cd5b0){if(!_0x3cd5b0){_0x541118['sendStatus'](0x194);}return _0x3cd5b0;};}function handleError(_0x5bb0ee,_0x2e9b0d){_0x2e9b0d=_0x2e9b0d||0x1f4;return function(_0x267899){logger['error'](_0x267899['stack']);if(_0x267899['name']){delete _0x267899['name'];}_0x5bb0ee[_0xa0fd('0x1a')](_0x2e9b0d)['send'](_0x267899);};}exports[_0xa0fd('0x27')]=function(_0x1db300,_0x2f5b0d){var _0x4a307b={},_0x36aaed={},_0x19c352={'count':0x0,'rows':[]};var _0x4feb93=_[_0xa0fd('0x28')](db[_0xa0fd('0x29')]['rawAttributes'],function(_0x366921){return{'name':_0x366921[_0xa0fd('0x2a')],'type':_0x366921[_0xa0fd('0x2b')][_0xa0fd('0x2c')]};});_0x36aaed['model']=_[_0xa0fd('0x28')](_0x4feb93,_0xa0fd('0x2d'));_0x36aaed['query']=_['keys'](_0x1db300['query']);_0x36aaed[_0xa0fd('0x2e')]=_['intersection'](_0x36aaed['model'],_0x36aaed[_0xa0fd('0x2f')]);_0x4a307b['attributes']=_[_0xa0fd('0x30')](_0x36aaed[_0xa0fd('0x31')],qs[_0xa0fd('0x32')](_0x1db300[_0xa0fd('0x2f')][_0xa0fd('0x32')]));_0x4a307b[_0xa0fd('0x33')]=_0x4a307b[_0xa0fd('0x33')][_0xa0fd('0x34')]?_0x4a307b['attributes']:_0x36aaed[_0xa0fd('0x31')];if(!_0x1db300['query'][_0xa0fd('0x35')]('nolimit')){_0x4a307b['limit']=qs[_0xa0fd('0x1c')](_0x1db300['query'][_0xa0fd('0x1c')]);_0x4a307b[_0xa0fd('0x1f')]=qs[_0xa0fd('0x1f')](_0x1db300[_0xa0fd('0x2f')]['offset']);}_0x4a307b[_0xa0fd('0x36')]=qs[_0xa0fd('0x37')](_0x1db300[_0xa0fd('0x2f')][_0xa0fd('0x37')]);_0x4a307b[_0xa0fd('0x38')]=qs[_0xa0fd('0x2e')](_[_0xa0fd('0x39')](_0x1db300['query'],_0x36aaed['filters']),_0x4feb93);if(_0x1db300[_0xa0fd('0x2f')][_0xa0fd('0x3a')]){_0x4a307b[_0xa0fd('0x38')]=_[_0xa0fd('0x3b')](_0x4a307b['where'],{'$or':_[_0xa0fd('0x28')](_0x4feb93,function(_0x3938da){if(_0x3938da[_0xa0fd('0x2b')]!==_0xa0fd('0x3c')){var _0x214094={};_0x214094[_0x3938da['name']]={'$like':'%'+_0x1db300[_0xa0fd('0x2f')][_0xa0fd('0x3a')]+'%'};return _0x214094;}})});}_0x4a307b=_['merge']({},_0x4a307b,_0x1db300['options']);var _0x27082a={'where':_0x4a307b[_0xa0fd('0x38')]};return db[_0xa0fd('0x29')][_0xa0fd('0x1e')](_0x27082a)[_0xa0fd('0x25')](function(_0xbeca16){_0x19c352[_0xa0fd('0x1e')]=_0xbeca16;if(_0x1db300[_0xa0fd('0x2f')][_0xa0fd('0x3d')]){_0x4a307b[_0xa0fd('0x3e')]=[{'all':!![]}];}return db[_0xa0fd('0x29')][_0xa0fd('0x3f')](_0x4a307b);})[_0xa0fd('0x25')](function(_0x466767){_0x19c352[_0xa0fd('0x40')]=_0x466767;return _0x19c352;})['then'](respondWithFilteredResult(_0x2f5b0d,_0x4a307b))['catch'](handleError(_0x2f5b0d,null));};exports['show']=function(_0x241e3e,_0x288a8a){var _0x399eb1={'raw':!![],'where':{'id':_0x241e3e[_0xa0fd('0x41')]['id']}},_0x54fb8c={};_0x54fb8c[_0xa0fd('0x31')]=_[_0xa0fd('0x42')](db['Cdr'][_0xa0fd('0x43')]);_0x54fb8c[_0xa0fd('0x2f')]=_[_0xa0fd('0x42')](_0x241e3e[_0xa0fd('0x2f')]);_0x54fb8c[_0xa0fd('0x2e')]=_[_0xa0fd('0x30')](_0x54fb8c['model'],_0x54fb8c[_0xa0fd('0x2f')]);_0x399eb1[_0xa0fd('0x33')]=_[_0xa0fd('0x30')](_0x54fb8c[_0xa0fd('0x31')],qs[_0xa0fd('0x32')](_0x241e3e[_0xa0fd('0x2f')]['fields']));_0x399eb1[_0xa0fd('0x33')]=_0x399eb1[_0xa0fd('0x33')][_0xa0fd('0x34')]?_0x399eb1[_0xa0fd('0x33')]:_0x54fb8c[_0xa0fd('0x31')];if(_0x241e3e['query']['includeAll']){_0x399eb1[_0xa0fd('0x3e')]=[{'all':!![]}];}_0x399eb1=_[_0xa0fd('0x3b')]({},_0x399eb1,_0x241e3e[_0xa0fd('0x44')]);return db[_0xa0fd('0x29')][_0xa0fd('0x45')](_0x399eb1)['then'](handleEntityNotFound(_0x288a8a,null))[_0xa0fd('0x25')](respondWithResult(_0x288a8a,null))[_0xa0fd('0x46')](handleError(_0x288a8a,null));};exports[_0xa0fd('0x47')]=function(_0x210a75,_0x93d528){return db[_0xa0fd('0x29')]['create'](_0x210a75['body'],{})['then'](respondWithResult(_0x93d528,0xc9))[_0xa0fd('0x46')](handleError(_0x93d528,null));};exports['update']=function(_0x4e4ce4,_0xcf725e){if(_0x4e4ce4['body']['id']){delete _0x4e4ce4[_0xa0fd('0x48')]['id'];}return db[_0xa0fd('0x29')]['find']({'where':{'id':_0x4e4ce4['params']['id']}})[_0xa0fd('0x25')](handleEntityNotFound(_0xcf725e,null))[_0xa0fd('0x25')](saveUpdates(_0x4e4ce4[_0xa0fd('0x48')],null))[_0xa0fd('0x25')](respondWithResult(_0xcf725e,null))[_0xa0fd('0x46')](handleError(_0xcf725e,null));};exports[_0xa0fd('0x26')]=function(_0x5268ba,_0x5712f2){return db['Cdr']['find']({'where':{'id':_0x5268ba[_0xa0fd('0x41')]['id']}})[_0xa0fd('0x25')](handleEntityNotFound(_0x5712f2,null))[_0xa0fd('0x25')](removeEntity(_0x5712f2,null))[_0xa0fd('0x46')](handleError(_0x5712f2,null));};exports[_0xa0fd('0x49')]=function(_0x53c1a2,_0x53f51c){return db['Cdr']['describe']()['then'](respondWithResult(_0x53f51c,null))[_0xa0fd('0x46')](handleError(_0x53f51c,null));}; \ No newline at end of file +var _0x9b67=['where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','name','send','map','Cdr','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort'];(function(_0x59295c,_0x3653da){var _0xb69eac=function(_0x368c6e){while(--_0x368c6e){_0x59295c['push'](_0x59295c['shift']());}};_0xb69eac(++_0x3653da);}(_0x9b67,0xf6));var _0x79b6=function(_0x1bb7a6,_0x103f78){_0x1bb7a6=_0x1bb7a6-0x0;var _0x35e21b=_0x9b67[_0x1bb7a6];return _0x35e21b;};'use strict';var emlformat=require(_0x79b6('0x0'));var rimraf=require(_0x79b6('0x1'));var zipdir=require(_0x79b6('0x2'));var jsonpatch=require(_0x79b6('0x3'));var rp=require(_0x79b6('0x4'));var moment=require('moment');var BPromise=require(_0x79b6('0x5'));var Mustache=require(_0x79b6('0x6'));var util=require('util');var path=require('path');var sox=require(_0x79b6('0x7'));var csv=require(_0x79b6('0x8'));var ejs=require(_0x79b6('0x9'));var fs=require('fs');var fs_extra=require(_0x79b6('0xa'));var _=require(_0x79b6('0xb'));var squel=require(_0x79b6('0xc'));var crypto=require(_0x79b6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x79b6('0xe'));var toCsv=require(_0x79b6('0x8'));var querystring=require(_0x79b6('0xf'));var Papa=require(_0x79b6('0x10'));var Redis=require(_0x79b6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x79b6('0x12'));var as=require(_0x79b6('0x13'));var hardwareService=require(_0x79b6('0x14'));var logger=require(_0x79b6('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x79b6('0x16'));var licenseUtil=require(_0x79b6('0x17'));var db=require(_0x79b6('0x18'))['db'];function respondWithStatusCode(_0x526727,_0xc05a77){_0xc05a77=_0xc05a77||0xcc;return function(_0x2df08d){if(_0x2df08d){return _0x526727[_0x79b6('0x19')](_0xc05a77);}return _0x526727[_0x79b6('0x1a')](_0xc05a77)[_0x79b6('0x1b')]();};}function respondWithResult(_0x40478d,_0x19d5b2){_0x19d5b2=_0x19d5b2||0xc8;return function(_0x3ef1fa){if(_0x3ef1fa){return _0x40478d[_0x79b6('0x1a')](_0x19d5b2)[_0x79b6('0x1c')](_0x3ef1fa);}};}function respondWithFilteredResult(_0x2ac966,_0x3563cc){return function(_0x1e8bf1){if(_0x1e8bf1){var _0x4cf491=typeof _0x3563cc[_0x79b6('0x1d')]===_0x79b6('0x1e')&&typeof _0x3563cc[_0x79b6('0x1f')]===_0x79b6('0x1e');var _0x2a8788=_0x1e8bf1[_0x79b6('0x20')];var _0x131bc5=_0x4cf491?0x0:_0x3563cc[_0x79b6('0x1d')];var _0x3ff583=_0x4cf491?_0x1e8bf1[_0x79b6('0x20')]:_0x3563cc[_0x79b6('0x1d')]+_0x3563cc[_0x79b6('0x1f')];var _0x1361f6;if(_0x3ff583>=_0x2a8788){_0x3ff583=_0x2a8788;_0x1361f6=0xc8;}else{_0x1361f6=0xce;}_0x2ac966['status'](_0x1361f6);return _0x2ac966[_0x79b6('0x21')]('Content-Range',_0x131bc5+'-'+_0x3ff583+'/'+_0x2a8788)[_0x79b6('0x1c')](_0x1e8bf1);}return null;};}function patchUpdates(_0x532e65){return function(_0x28b9c2){try{jsonpatch[_0x79b6('0x22')](_0x28b9c2,_0x532e65,!![]);}catch(_0x299bed){return BPromise['reject'](_0x299bed);}return _0x28b9c2[_0x79b6('0x23')]();};}function saveUpdates(_0x30dc0b,_0x53208a){return function(_0x565f86){if(_0x565f86){return _0x565f86[_0x79b6('0x24')](_0x30dc0b)[_0x79b6('0x25')](function(_0x9bd2cc){return _0x9bd2cc;});}return null;};}function removeEntity(_0x268826,_0x3b2a2a){return function(_0x488102){if(_0x488102){return _0x488102[_0x79b6('0x26')]()[_0x79b6('0x25')](function(){_0x268826[_0x79b6('0x1a')](0xcc)[_0x79b6('0x1b')]();});}};}function handleEntityNotFound(_0x4c275d,_0x53c03c){return function(_0x40ef76){if(!_0x40ef76){_0x4c275d[_0x79b6('0x19')](0x194);}return _0x40ef76;};}function handleError(_0x37b01b,_0xc25c99){_0xc25c99=_0xc25c99||0x1f4;return function(_0x4adf15){logger[_0x79b6('0x27')](_0x4adf15['stack']);if(_0x4adf15[_0x79b6('0x28')]){delete _0x4adf15[_0x79b6('0x28')];}_0x37b01b[_0x79b6('0x1a')](_0xc25c99)[_0x79b6('0x29')](_0x4adf15);};}exports['index']=function(_0x1484e5,_0x310832){var _0x53b463={},_0x158221={},_0x2d219c={'count':0x0,'rows':[]};var _0x1b1f2b=_[_0x79b6('0x2a')](db[_0x79b6('0x2b')][_0x79b6('0x2c')],function(_0x53b2f5){return{'name':_0x53b2f5[_0x79b6('0x2d')],'type':_0x53b2f5[_0x79b6('0x2e')][_0x79b6('0x2f')]};});_0x158221[_0x79b6('0x30')]=_[_0x79b6('0x2a')](_0x1b1f2b,_0x79b6('0x28'));_0x158221['query']=_[_0x79b6('0x31')](_0x1484e5[_0x79b6('0x32')]);_0x158221[_0x79b6('0x33')]=_['intersection'](_0x158221['model'],_0x158221[_0x79b6('0x32')]);_0x53b463[_0x79b6('0x34')]=_[_0x79b6('0x35')](_0x158221[_0x79b6('0x30')],qs[_0x79b6('0x36')](_0x1484e5[_0x79b6('0x32')]['fields']));_0x53b463['attributes']=_0x53b463[_0x79b6('0x34')]['length']?_0x53b463[_0x79b6('0x34')]:_0x158221['model'];if(!_0x1484e5[_0x79b6('0x32')][_0x79b6('0x37')]('nolimit')){_0x53b463[_0x79b6('0x1f')]=qs[_0x79b6('0x1f')](_0x1484e5['query'][_0x79b6('0x1f')]);_0x53b463['offset']=qs[_0x79b6('0x1d')](_0x1484e5[_0x79b6('0x32')][_0x79b6('0x1d')]);}_0x53b463[_0x79b6('0x38')]=qs[_0x79b6('0x39')](_0x1484e5[_0x79b6('0x32')][_0x79b6('0x39')]);_0x53b463[_0x79b6('0x3a')]=qs[_0x79b6('0x33')](_[_0x79b6('0x3b')](_0x1484e5['query'],_0x158221['filters']),_0x1b1f2b);if(_0x1484e5['query'][_0x79b6('0x3c')]){_0x53b463[_0x79b6('0x3a')]=_['merge'](_0x53b463[_0x79b6('0x3a')],{'$or':_['map'](_0x1b1f2b,function(_0x179a98){if(_0x179a98[_0x79b6('0x2e')]!==_0x79b6('0x3d')){var _0x53db1d={};_0x53db1d[_0x179a98[_0x79b6('0x28')]]={'$like':'%'+_0x1484e5['query'][_0x79b6('0x3c')]+'%'};return _0x53db1d;}})});}_0x53b463=_[_0x79b6('0x3e')]({},_0x53b463,_0x1484e5[_0x79b6('0x3f')]);var _0x2feeeb={'where':_0x53b463[_0x79b6('0x3a')]};return db['Cdr']['count'](_0x2feeeb)[_0x79b6('0x25')](function(_0x48ae49){_0x2d219c[_0x79b6('0x20')]=_0x48ae49;if(_0x1484e5[_0x79b6('0x32')][_0x79b6('0x40')]){_0x53b463[_0x79b6('0x41')]=[{'all':!![]}];}return db[_0x79b6('0x2b')][_0x79b6('0x42')](_0x53b463);})[_0x79b6('0x25')](function(_0x4a7f90){_0x2d219c[_0x79b6('0x43')]=_0x4a7f90;return _0x2d219c;})[_0x79b6('0x25')](respondWithFilteredResult(_0x310832,_0x53b463))[_0x79b6('0x44')](handleError(_0x310832,null));};exports[_0x79b6('0x45')]=function(_0x568f6b,_0x12ea22){var _0x4f803c={'raw':!![],'where':{'id':_0x568f6b[_0x79b6('0x46')]['id']}},_0x4ba212={};_0x4ba212[_0x79b6('0x30')]=_[_0x79b6('0x31')](db[_0x79b6('0x2b')][_0x79b6('0x2c')]);_0x4ba212[_0x79b6('0x32')]=_[_0x79b6('0x31')](_0x568f6b[_0x79b6('0x32')]);_0x4ba212['filters']=_[_0x79b6('0x35')](_0x4ba212['model'],_0x4ba212['query']);_0x4f803c[_0x79b6('0x34')]=_[_0x79b6('0x35')](_0x4ba212[_0x79b6('0x30')],qs[_0x79b6('0x36')](_0x568f6b[_0x79b6('0x32')][_0x79b6('0x36')]));_0x4f803c[_0x79b6('0x34')]=_0x4f803c[_0x79b6('0x34')][_0x79b6('0x47')]?_0x4f803c['attributes']:_0x4ba212[_0x79b6('0x30')];if(_0x568f6b[_0x79b6('0x32')][_0x79b6('0x40')]){_0x4f803c[_0x79b6('0x41')]=[{'all':!![]}];}_0x4f803c=_[_0x79b6('0x3e')]({},_0x4f803c,_0x568f6b['options']);return db[_0x79b6('0x2b')][_0x79b6('0x48')](_0x4f803c)['then'](handleEntityNotFound(_0x12ea22,null))['then'](respondWithResult(_0x12ea22,null))[_0x79b6('0x44')](handleError(_0x12ea22,null));};exports[_0x79b6('0x49')]=function(_0x247c79,_0xa0c396){return db[_0x79b6('0x2b')][_0x79b6('0x49')](_0x247c79[_0x79b6('0x4a')],{})[_0x79b6('0x25')](respondWithResult(_0xa0c396,0xc9))[_0x79b6('0x44')](handleError(_0xa0c396,null));};exports[_0x79b6('0x24')]=function(_0x15c795,_0x39972b){if(_0x15c795[_0x79b6('0x4a')]['id']){delete _0x15c795[_0x79b6('0x4a')]['id'];}return db[_0x79b6('0x2b')][_0x79b6('0x48')]({'where':{'id':_0x15c795[_0x79b6('0x46')]['id']}})[_0x79b6('0x25')](handleEntityNotFound(_0x39972b,null))[_0x79b6('0x25')](saveUpdates(_0x15c795['body'],null))['then'](respondWithResult(_0x39972b,null))['catch'](handleError(_0x39972b,null));};exports['destroy']=function(_0x56deb2,_0x412c1e){return db[_0x79b6('0x2b')][_0x79b6('0x48')]({'where':{'id':_0x56deb2[_0x79b6('0x46')]['id']}})[_0x79b6('0x25')](handleEntityNotFound(_0x412c1e,null))[_0x79b6('0x25')](removeEntity(_0x412c1e,null))['catch'](handleError(_0x412c1e,null));};exports[_0x79b6('0x4b')]=function(_0xa2ba0e,_0x58232b){return db[_0x79b6('0x2b')]['describe']()[_0x79b6('0x25')](respondWithResult(_0x58232b,null))['catch'](handleError(_0x58232b,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index ec6839f..cdb768f 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(_0x5f4fa9,_0x16d7a8){var _0x257d7f=function(_0x41022f){while(--_0x41022f){_0x5f4fa9['push'](_0x5f4fa9['shift']());}};_0x257d7f(++_0x16d7a8);}(_0x7a54,0x106));var _0x47a5=function(_0x4c0c4d,_0x2fb026){_0x4c0c4d=_0x4c0c4d-0x0;var _0x2f43d0=_0x7a54[_0x4c0c4d];return _0x2f43d0;};'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(_0x4b42f1,_0x41e0b6){var _0x11f0f1=function(_0x3b7ff8){while(--_0x3b7ff8){_0x4b42f1['push'](_0x4b42f1['shift']());}};_0x11f0f1(++_0x41e0b6);}(_0x7a54,0x106));var _0x47a5=function(_0x39cadc,_0x7398b5){_0x39cadc=_0x39cadc-0x0;var _0xb8e375=_0x7a54[_0x39cadc];return _0xb8e375;};'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 b4639df..9e17ef8 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 _0xfd67=['then','info','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0xb267b0,_0x5fe22c){var _0xbc1e3b=function(_0x53f855){while(--_0x53f855){_0xb267b0['push'](_0xb267b0['shift']());}};_0xbc1e3b(++_0x5fe22c);}(_0xfd67,0x1d7));var _0x7fd6=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xfd67[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x7fd6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7fd6('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7fd6('0x2'));var db=require(_0x7fd6('0x3'))['db'];var utils=require(_0x7fd6('0x4'));var logger=require(_0x7fd6('0x5'))(_0x7fd6('0x6'));var config=require(_0x7fd6('0x7'));var jayson=require(_0x7fd6('0x8'));var client=jayson[_0x7fd6('0x9')][_0x7fd6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47150b,_0x266c5f,_0x34969b){return new BPromise(function(_0x7a5ebb,_0x2f04ad){return client[_0x7fd6('0xb')](_0x47150b,_0x34969b)[_0x7fd6('0xc')](function(_0xc544e0){logger[_0x7fd6('0xd')](_0x7fd6('0xe'),_0x266c5f,'request\x20sent');logger[_0x7fd6('0xf')](_0x7fd6('0x10'),_0x266c5f,_0x7fd6('0x11'),JSON['stringify'](_0xc544e0));if(_0xc544e0[_0x7fd6('0x12')]){if(_0xc544e0[_0x7fd6('0x12')][_0x7fd6('0x13')]===0x1f4){logger[_0x7fd6('0x12')](_0x7fd6('0xe'),_0x266c5f,_0xc544e0[_0x7fd6('0x12')][_0x7fd6('0x14')]);return _0x2f04ad(_0xc544e0[_0x7fd6('0x12')][_0x7fd6('0x14')]);}logger['error'](_0x7fd6('0xe'),_0x266c5f,_0xc544e0[_0x7fd6('0x12')][_0x7fd6('0x14')]);return _0x7a5ebb(_0xc544e0['error'][_0x7fd6('0x14')]);}else{logger['info'](_0x7fd6('0xe'),_0x266c5f,'request\x20sent');_0x7a5ebb(_0xc544e0[_0x7fd6('0x15')][_0x7fd6('0x14')]);}})[_0x7fd6('0x16')](function(_0x101566){logger['error'](_0x7fd6('0xe'),_0x266c5f,_0x101566);_0x2f04ad(_0x101566);});});} \ No newline at end of file +var _0x5fc4=['debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','randomstring','../../config/logger','rpc','../../config/environment','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent'];(function(_0x4a672b,_0xcd0bae){var _0x50e2f9=function(_0x176800){while(--_0x176800){_0x4a672b['push'](_0x4a672b['shift']());}};_0x50e2f9(++_0xcd0bae);}(_0x5fc4,0x14a));var _0x45fc=function(_0x25c772,_0x2c8741){_0x25c772=_0x25c772-0x0;var _0x1f9b72=_0x5fc4[_0x25c772];return _0x1f9b72;};'use strict';var _=require(_0x45fc('0x0'));var util=require(_0x45fc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x45fc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x45fc('0x3'))(_0x45fc('0x4'));var config=require(_0x45fc('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x45fc('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x29cca5,_0x53d8d9,_0x1436d5){return new BPromise(function(_0x205755,_0x1a61db){return client[_0x45fc('0x7')](_0x29cca5,_0x1436d5)[_0x45fc('0x8')](function(_0x6be6f0){logger[_0x45fc('0x9')](_0x45fc('0xa'),_0x53d8d9,_0x45fc('0xb'));logger[_0x45fc('0xc')](_0x45fc('0xd'),_0x53d8d9,_0x45fc('0xb'),JSON['stringify'](_0x6be6f0));if(_0x6be6f0[_0x45fc('0xe')]){if(_0x6be6f0[_0x45fc('0xe')][_0x45fc('0xf')]===0x1f4){logger[_0x45fc('0xe')](_0x45fc('0xa'),_0x53d8d9,_0x6be6f0[_0x45fc('0xe')][_0x45fc('0x10')]);return _0x1a61db(_0x6be6f0[_0x45fc('0xe')][_0x45fc('0x10')]);}logger['error'](_0x45fc('0xa'),_0x53d8d9,_0x6be6f0[_0x45fc('0xe')][_0x45fc('0x10')]);return _0x205755(_0x6be6f0[_0x45fc('0xe')][_0x45fc('0x10')]);}else{logger['info'](_0x45fc('0xa'),_0x53d8d9,_0x45fc('0xb'));_0x205755(_0x6be6f0[_0x45fc('0x11')][_0x45fc('0x10')]);}})[_0x45fc('0x12')](function(_0x4d4b02){logger[_0x45fc('0xe')]('Cdr,\x20%s,\x20%s',_0x53d8d9,_0x4d4b02);_0x1a61db(_0x4d4b02);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 5a1428b..e848ebd 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(_0x19e166,_0x4cc641){var _0x5e6bed=function(_0xb7fce7){while(--_0xb7fce7){_0x19e166['push'](_0x19e166['shift']());}};_0x5e6bed(++_0x4cc641);}(_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 _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x3247b3,_0x42459e){var _0x5b3bed=function(_0x1e97be){while(--_0x1e97be){_0x3247b3['push'](_0x3247b3['shift']());}};_0x5b3bed(++_0x42459e);}(_0xb10b,0x12a));var _0xbb10=function(_0x2e8a6e,_0x18e64f){_0x2e8a6e=_0x2e8a6e-0x0;var _0x259829=_0xb10b[_0x2e8a6e];return _0x259829;};'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')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('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 643d6b9..62c98cc 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 _0x65d8=['sequelize','exports','STRING','noop','TEXT','*,*,*,*'];(function(_0x43a602,_0x4fe4ef){var _0x5b085c=function(_0xf6f6c4){while(--_0xf6f6c4){_0x43a602['push'](_0x43a602['shift']());}};_0x5b085c(++_0x4fe4ef);}(_0x65d8,0xba));var _0x865d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x65d8[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x865d('0x0'));module[_0x865d('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x865d('0x2')],'allowNull':![],'defaultValue':_0x865d('0x3')},'appdata':{'type':Sequelize[_0x865d('0x4')]()},'description':{'type':Sequelize[_0x865d('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x865d('0x5')}}; \ No newline at end of file +var _0x4627=['TEXT','*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x22330c,_0x568d7a){var _0xaa9963=function(_0x5445cc){while(--_0x5445cc){_0x22330c['push'](_0x22330c['shift']());}};_0xaa9963(++_0x568d7a);}(_0x4627,0xaa));var _0x7462=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0x4627[_0x266618];return _0x54dbf5;};'use strict';var Sequelize=require(_0x7462('0x0'));module['exports']={'priority':{'type':Sequelize[_0x7462('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x7462('0x2')],'allowNull':![],'defaultValue':_0x7462('0x3')},'appdata':{'type':Sequelize[_0x7462('0x4')]()},'description':{'type':Sequelize[_0x7462('0x2')]},'interval':{'type':Sequelize[_0x7462('0x2')],'defaultValue':_0x7462('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 42d8c48..01a3bb1 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 _0xd73a=['../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','send','params','model','keys','rawAttributes','query','filters','intersection','attributes','length','includeAll','include','ChatApplication','body','find','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment'];(function(_0x3ae393,_0x27e9b8){var _0x51c512=function(_0x5e1901){while(--_0x5e1901){_0x3ae393['push'](_0x3ae393['shift']());}};_0x51c512(++_0x27e9b8);}(_0xd73a,0x171));var _0xad73=function(_0xc8d57f,_0x286573){_0xc8d57f=_0xc8d57f-0x0;var _0x2e5d1f=_0xd73a[_0xc8d57f];return _0x2e5d1f;};'use strict';var emlformat=require(_0xad73('0x0'));var rimraf=require(_0xad73('0x1'));var zipdir=require(_0xad73('0x2'));var jsonpatch=require(_0xad73('0x3'));var rp=require(_0xad73('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xad73('0x5'));var util=require(_0xad73('0x6'));var path=require(_0xad73('0x7'));var sox=require(_0xad73('0x8'));var csv=require(_0xad73('0x9'));var ejs=require(_0xad73('0xa'));var fs=require('fs');var fs_extra=require(_0xad73('0xb'));var _=require(_0xad73('0xc'));var squel=require(_0xad73('0xd'));var crypto=require(_0xad73('0xe'));var jsforce=require(_0xad73('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xad73('0x9'));var querystring=require('querystring');var Papa=require(_0xad73('0x10'));var Redis=require(_0xad73('0x11'));var authService=require(_0xad73('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xad73('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xad73('0x14'))('api');var utils=require(_0xad73('0x15'));var config=require(_0xad73('0x16'));var licenseUtil=require(_0xad73('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1045be,_0x241ff5){_0x241ff5=_0x241ff5||0xcc;return function(_0x488787){if(_0x488787){return _0x1045be[_0xad73('0x18')](_0x241ff5);}return _0x1045be[_0xad73('0x19')](_0x241ff5)[_0xad73('0x1a')]();};}function respondWithResult(_0x27a9d2,_0x15f72d){_0x15f72d=_0x15f72d||0xc8;return function(_0x82fe13){if(_0x82fe13){return _0x27a9d2['status'](_0x15f72d)[_0xad73('0x1b')](_0x82fe13);}};}function respondWithFilteredResult(_0x35c2c5,_0x4336fa){return function(_0x155548){if(_0x155548){var _0x2f0dcd=typeof _0x4336fa[_0xad73('0x1c')]===_0xad73('0x1d')&&typeof _0x4336fa[_0xad73('0x1e')]===_0xad73('0x1d');var _0xad072c=_0x155548['count'];var _0x47381a=_0x2f0dcd?0x0:_0x4336fa['offset'];var _0x5bd242=_0x2f0dcd?_0x155548[_0xad73('0x1f')]:_0x4336fa[_0xad73('0x1c')]+_0x4336fa[_0xad73('0x1e')];var _0x578068;if(_0x5bd242>=_0xad072c){_0x5bd242=_0xad072c;_0x578068=0xc8;}else{_0x578068=0xce;}_0x35c2c5[_0xad73('0x19')](_0x578068);return _0x35c2c5[_0xad73('0x20')]('Content-Range',_0x47381a+'-'+_0x5bd242+'/'+_0xad072c)[_0xad73('0x1b')](_0x155548);}return null;};}function patchUpdates(_0x4289df){return function(_0x3e02ed){try{jsonpatch[_0xad73('0x21')](_0x3e02ed,_0x4289df,!![]);}catch(_0x2e6cdb){return BPromise[_0xad73('0x22')](_0x2e6cdb);}return _0x3e02ed[_0xad73('0x23')]();};}function saveUpdates(_0x497c3d,_0xfe2758){return function(_0x31f5c4){if(_0x31f5c4){return _0x31f5c4[_0xad73('0x24')](_0x497c3d)[_0xad73('0x25')](function(_0xb3e0b0){return _0xb3e0b0;});}return null;};}function removeEntity(_0x2a1295,_0xbfb297){return function(_0x439f09){if(_0x439f09){return _0x439f09[_0xad73('0x26')]()[_0xad73('0x25')](function(){_0x2a1295[_0xad73('0x19')](0xcc)[_0xad73('0x1a')]();});}};}function handleEntityNotFound(_0x182805,_0xfec523){return function(_0x1b7d84){if(!_0x1b7d84){_0x182805[_0xad73('0x18')](0x194);}return _0x1b7d84;};}function handleError(_0x34f8c4,_0x920ffc){_0x920ffc=_0x920ffc||0x1f4;return function(_0xb7700c){logger[_0xad73('0x27')](_0xb7700c['stack']);if(_0xb7700c['name']){delete _0xb7700c['name'];}_0x34f8c4[_0xad73('0x19')](_0x920ffc)[_0xad73('0x28')](_0xb7700c);};}exports['show']=function(_0x3f1f80,_0x54a8f9){var _0x54eadc={'raw':!![],'where':{'id':_0x3f1f80[_0xad73('0x29')]['id']}},_0x1f826c={};_0x1f826c[_0xad73('0x2a')]=_[_0xad73('0x2b')](db['ChatApplication'][_0xad73('0x2c')]);_0x1f826c[_0xad73('0x2d')]=_[_0xad73('0x2b')](_0x3f1f80['query']);_0x1f826c[_0xad73('0x2e')]=_[_0xad73('0x2f')](_0x1f826c[_0xad73('0x2a')],_0x1f826c[_0xad73('0x2d')]);_0x54eadc[_0xad73('0x30')]=_['intersection'](_0x1f826c['model'],qs['fields'](_0x3f1f80[_0xad73('0x2d')]['fields']));_0x54eadc[_0xad73('0x30')]=_0x54eadc['attributes'][_0xad73('0x31')]?_0x54eadc[_0xad73('0x30')]:_0x1f826c['model'];if(_0x3f1f80['query'][_0xad73('0x32')]){_0x54eadc[_0xad73('0x33')]=[{'all':!![]}];}_0x54eadc=_['merge']({},_0x54eadc,_0x3f1f80['options']);return db[_0xad73('0x34')]['find'](_0x54eadc)[_0xad73('0x25')](handleEntityNotFound(_0x54a8f9,null))[_0xad73('0x25')](respondWithResult(_0x54a8f9,null))['catch'](handleError(_0x54a8f9,null));};exports[_0xad73('0x24')]=function(_0x52518c,_0x33d874){if(_0x52518c[_0xad73('0x35')]['id']){delete _0x52518c[_0xad73('0x35')]['id'];}return db[_0xad73('0x34')][_0xad73('0x36')]({'where':{'id':_0x52518c[_0xad73('0x29')]['id']}})[_0xad73('0x25')](handleEntityNotFound(_0x33d874,null))[_0xad73('0x25')](saveUpdates(_0x52518c[_0xad73('0x35')],null))['then'](respondWithResult(_0x33d874,null))[_0xad73('0x37')](handleError(_0x33d874,null));};exports[_0xad73('0x26')]=function(_0x52169f,_0x221d3d){return db[_0xad73('0x34')][_0xad73('0x36')]({'where':{'id':_0x52169f[_0xad73('0x29')]['id']}})[_0xad73('0x25')](handleEntityNotFound(_0x221d3d,null))[_0xad73('0x25')](removeEntity(_0x221d3d,null))[_0xad73('0x37')](handleError(_0x221d3d,null));}; \ No newline at end of file +var _0x09dd=['stack','name','show','params','model','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','body','find','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','to-csv','papaparse','ioredis','../../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','save','update','then','destroy'];(function(_0x42fda7,_0x4933d4){var _0x3ccc56=function(_0x231078){while(--_0x231078){_0x42fda7['push'](_0x42fda7['shift']());}};_0x3ccc56(++_0x4933d4);}(_0x09dd,0xb7));var _0xd09d=function(_0x12833b,_0x26c1d2){_0x12833b=_0x12833b-0x0;var _0x3acad3=_0x09dd[_0x12833b];return _0x3acad3;};'use strict';var emlformat=require(_0xd09d('0x0'));var rimraf=require(_0xd09d('0x1'));var zipdir=require(_0xd09d('0x2'));var jsonpatch=require(_0xd09d('0x3'));var rp=require(_0xd09d('0x4'));var moment=require(_0xd09d('0x5'));var BPromise=require(_0xd09d('0x6'));var Mustache=require(_0xd09d('0x7'));var util=require(_0xd09d('0x8'));var path=require('path');var sox=require(_0xd09d('0x9'));var csv=require('to-csv');var ejs=require(_0xd09d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd09d('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd09d('0xc'));var querystring=require('querystring');var Papa=require(_0xd09d('0xd'));var Redis=require(_0xd09d('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd09d('0xf'));var logger=require(_0xd09d('0x10'))(_0xd09d('0x11'));var utils=require(_0xd09d('0x12'));var config=require(_0xd09d('0x13'));var licenseUtil=require(_0xd09d('0x14'));var db=require(_0xd09d('0x15'))['db'];function respondWithStatusCode(_0x58c129,_0x3004d0){_0x3004d0=_0x3004d0||0xcc;return function(_0x3c4a7a){if(_0x3c4a7a){return _0x58c129[_0xd09d('0x16')](_0x3004d0);}return _0x58c129[_0xd09d('0x17')](_0x3004d0)[_0xd09d('0x18')]();};}function respondWithResult(_0x594fea,_0x1c73b4){_0x1c73b4=_0x1c73b4||0xc8;return function(_0x1abe86){if(_0x1abe86){return _0x594fea[_0xd09d('0x17')](_0x1c73b4)[_0xd09d('0x19')](_0x1abe86);}};}function respondWithFilteredResult(_0x1d7d1c,_0x5b0c0a){return function(_0xf4c819){if(_0xf4c819){var _0x375e61=typeof _0x5b0c0a['offset']===_0xd09d('0x1a')&&typeof _0x5b0c0a[_0xd09d('0x1b')]===_0xd09d('0x1a');var _0xf0ffb8=_0xf4c819[_0xd09d('0x1c')];var _0x209df3=_0x375e61?0x0:_0x5b0c0a[_0xd09d('0x1d')];var _0x24d3c9=_0x375e61?_0xf4c819[_0xd09d('0x1c')]:_0x5b0c0a[_0xd09d('0x1d')]+_0x5b0c0a['limit'];var _0x253fdd;if(_0x24d3c9>=_0xf0ffb8){_0x24d3c9=_0xf0ffb8;_0x253fdd=0xc8;}else{_0x253fdd=0xce;}_0x1d7d1c['status'](_0x253fdd);return _0x1d7d1c[_0xd09d('0x1e')](_0xd09d('0x1f'),_0x209df3+'-'+_0x24d3c9+'/'+_0xf0ffb8)[_0xd09d('0x19')](_0xf4c819);}return null;};}function patchUpdates(_0xb92975){return function(_0x577a27){try{jsonpatch[_0xd09d('0x20')](_0x577a27,_0xb92975,!![]);}catch(_0x591433){return BPromise['reject'](_0x591433);}return _0x577a27[_0xd09d('0x21')]();};}function saveUpdates(_0x220beb,_0x49e283){return function(_0xad2389){if(_0xad2389){return _0xad2389[_0xd09d('0x22')](_0x220beb)[_0xd09d('0x23')](function(_0x39eaf7){return _0x39eaf7;});}return null;};}function removeEntity(_0x3c78be,_0x2e0f69){return function(_0x2626cb){if(_0x2626cb){return _0x2626cb[_0xd09d('0x24')]()[_0xd09d('0x23')](function(){_0x3c78be[_0xd09d('0x17')](0xcc)[_0xd09d('0x18')]();});}};}function handleEntityNotFound(_0x17e607,_0x3cb499){return function(_0x1ade38){if(!_0x1ade38){_0x17e607[_0xd09d('0x16')](0x194);}return _0x1ade38;};}function handleError(_0x53a9ea,_0x5db559){_0x5db559=_0x5db559||0x1f4;return function(_0x5aade7){logger['error'](_0x5aade7[_0xd09d('0x25')]);if(_0x5aade7[_0xd09d('0x26')]){delete _0x5aade7[_0xd09d('0x26')];}_0x53a9ea[_0xd09d('0x17')](_0x5db559)['send'](_0x5aade7);};}exports[_0xd09d('0x27')]=function(_0xdb4063,_0x4a552e){var _0x1842d0={'raw':!![],'where':{'id':_0xdb4063[_0xd09d('0x28')]['id']}},_0x5df00f={};_0x5df00f[_0xd09d('0x29')]=_['keys'](db[_0xd09d('0x2a')][_0xd09d('0x2b')]);_0x5df00f['query']=_['keys'](_0xdb4063[_0xd09d('0x2c')]);_0x5df00f[_0xd09d('0x2d')]=_[_0xd09d('0x2e')](_0x5df00f[_0xd09d('0x29')],_0x5df00f[_0xd09d('0x2c')]);_0x1842d0[_0xd09d('0x2f')]=_[_0xd09d('0x2e')](_0x5df00f[_0xd09d('0x29')],qs[_0xd09d('0x30')](_0xdb4063[_0xd09d('0x2c')][_0xd09d('0x30')]));_0x1842d0[_0xd09d('0x2f')]=_0x1842d0['attributes'][_0xd09d('0x31')]?_0x1842d0[_0xd09d('0x2f')]:_0x5df00f[_0xd09d('0x29')];if(_0xdb4063[_0xd09d('0x2c')]['includeAll']){_0x1842d0[_0xd09d('0x32')]=[{'all':!![]}];}_0x1842d0=_[_0xd09d('0x33')]({},_0x1842d0,_0xdb4063['options']);return db['ChatApplication']['find'](_0x1842d0)[_0xd09d('0x23')](handleEntityNotFound(_0x4a552e,null))[_0xd09d('0x23')](respondWithResult(_0x4a552e,null))['catch'](handleError(_0x4a552e,null));};exports['update']=function(_0x59893a,_0xf4a695){if(_0x59893a[_0xd09d('0x34')]['id']){delete _0x59893a[_0xd09d('0x34')]['id'];}return db['ChatApplication'][_0xd09d('0x35')]({'where':{'id':_0x59893a[_0xd09d('0x28')]['id']}})[_0xd09d('0x23')](handleEntityNotFound(_0xf4a695,null))['then'](saveUpdates(_0x59893a[_0xd09d('0x34')],null))[_0xd09d('0x23')](respondWithResult(_0xf4a695,null))[_0xd09d('0x36')](handleError(_0xf4a695,null));};exports[_0xd09d('0x24')]=function(_0x23ad4d,_0x56ccb){return db[_0xd09d('0x2a')][_0xd09d('0x35')]({'where':{'id':_0x23ad4d[_0xd09d('0x28')]['id']}})[_0xd09d('0x23')](handleEntityNotFound(_0x56ccb,null))[_0xd09d('0x23')](removeEntity(_0x56ccb,null))[_0xd09d('0x36')](handleError(_0x56ccb,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 36f3834..b2377ae 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 _0x6adb=['path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4_unicode_ci','util','../../config/logger','api','moment'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x6adb,0x134));var _0xb6ad=function(_0x5611b6,_0x159cef){_0x5611b6=_0x5611b6-0x0;var _0x5e3f5b=_0x6adb[_0x5611b6];return _0x5e3f5b;};'use strict';var _=require('lodash');var util=require(_0xb6ad('0x0'));var logger=require(_0xb6ad('0x1'))(_0xb6ad('0x2'));var moment=require(_0xb6ad('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb6ad('0x4'));var rimraf=require(_0xb6ad('0x5'));var config=require(_0xb6ad('0x6'));var attributes=require(_0xb6ad('0x7'));module[_0xb6ad('0x8')]=function(_0x303d03,_0x301efb){return _0x303d03[_0xb6ad('0x9')](_0xb6ad('0xa'),attributes,{'tableName':_0xb6ad('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xb6ad('0xc')});}; \ No newline at end of file +var _0x559d=['bluebird','request-promise','path','rimraf','../../config/environment','ChatApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x3c30a4,_0x152fd6){var _0x4f3e14=function(_0x28d11e){while(--_0x28d11e){_0x3c30a4['push'](_0x3c30a4['shift']());}};_0x4f3e14(++_0x152fd6);}(_0x559d,0x1e9));var _0xd559=function(_0x511a19,_0x417e36){_0x511a19=_0x511a19-0x0;var _0x499aa6=_0x559d[_0x511a19];return _0x499aa6;};'use strict';var _=require(_0xd559('0x0'));var util=require(_0xd559('0x1'));var logger=require(_0xd559('0x2'))(_0xd559('0x3'));var moment=require(_0xd559('0x4'));var BPromise=require(_0xd559('0x5'));var rp=require(_0xd559('0x6'));var fs=require('fs');var path=require(_0xd559('0x7'));var rimraf=require(_0xd559('0x8'));var config=require(_0xd559('0x9'));var attributes=require('./chatApplication.attributes');module['exports']=function(_0x53c7ee,_0x79ec60){return _0x53c7ee['define'](_0xd559('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd559('0xb'),'collate':_0xd559('0xc')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index d740d82..2159d5f 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 _0x0ba5=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x239b31,_0x44a64d){var _0x41c8be=function(_0x27f031){while(--_0x27f031){_0x239b31['push'](_0x239b31['shift']());}};_0x41c8be(++_0x44a64d);}(_0x0ba5,0xd9));var _0x50ba=function(_0x435117,_0x2b9bad){_0x435117=_0x435117-0x0;var _0x585a63=_0x0ba5[_0x435117];return _0x585a63;};'use strict';var _=require(_0x50ba('0x0'));var util=require(_0x50ba('0x1'));var moment=require(_0x50ba('0x2'));var BPromise=require(_0x50ba('0x3'));var rs=require(_0x50ba('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x50ba('0x5'))['db'];var utils=require(_0x50ba('0x6'));var logger=require('../../config/logger')(_0x50ba('0x7'));var config=require(_0x50ba('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x50ba('0x9')][_0x50ba('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d1f01,_0x922b9,_0x1dfc6c){return new BPromise(function(_0x2c2654,_0x24fe8e){return client[_0x50ba('0xb')](_0x4d1f01,_0x1dfc6c)[_0x50ba('0xc')](function(_0x17d416){logger[_0x50ba('0xd')](_0x50ba('0xe'),_0x922b9,_0x50ba('0xf'));logger[_0x50ba('0x10')](_0x50ba('0x11'),_0x922b9,_0x50ba('0xf'),JSON[_0x50ba('0x12')](_0x17d416));if(_0x17d416[_0x50ba('0x13')]){if(_0x17d416[_0x50ba('0x13')][_0x50ba('0x14')]===0x1f4){logger[_0x50ba('0x13')](_0x50ba('0xe'),_0x922b9,_0x17d416['error']['message']);return _0x24fe8e(_0x17d416[_0x50ba('0x13')]['message']);}logger['error'](_0x50ba('0xe'),_0x922b9,_0x17d416['error'][_0x50ba('0x15')]);return _0x2c2654(_0x17d416[_0x50ba('0x13')][_0x50ba('0x15')]);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0x922b9,_0x50ba('0xf'));_0x2c2654(_0x17d416[_0x50ba('0x16')][_0x50ba('0x15')]);}})[_0x50ba('0x17')](function(_0x589347){logger[_0x50ba('0x13')]('ChatApplication,\x20%s,\x20%s',_0x922b9,_0x589347);_0x24fe8e(_0x589347);});});} \ No newline at end of file +var _0x343c=['util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x343c,0x111));var _0xc343=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x343c[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xc343('0x0'));var moment=require('moment');var BPromise=require(_0xc343('0x1'));var rs=require(_0xc343('0x2'));var fs=require('fs');var Redis=require(_0xc343('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc343('0x4'));var logger=require(_0xc343('0x5'))('rpc');var config=require(_0xc343('0x6'));var jayson=require(_0xc343('0x7'));var client=jayson['client'][_0xc343('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3efa96,_0x547157,_0x21ffb9){return new BPromise(function(_0x2a43d3,_0xccd33a){return client[_0xc343('0x9')](_0x3efa96,_0x21ffb9)[_0xc343('0xa')](function(_0x50e8d6){logger[_0xc343('0xb')](_0xc343('0xc'),_0x547157,_0xc343('0xd'));logger['debug'](_0xc343('0xe'),_0x547157,_0xc343('0xd'),JSON[_0xc343('0xf')](_0x50e8d6));if(_0x50e8d6[_0xc343('0x10')]){if(_0x50e8d6[_0xc343('0x10')][_0xc343('0x11')]===0x1f4){logger[_0xc343('0x10')](_0xc343('0xc'),_0x547157,_0x50e8d6[_0xc343('0x10')]['message']);return _0xccd33a(_0x50e8d6[_0xc343('0x10')][_0xc343('0x12')]);}logger[_0xc343('0x10')]('ChatApplication,\x20%s,\x20%s',_0x547157,_0x50e8d6[_0xc343('0x10')][_0xc343('0x12')]);return _0x2a43d3(_0x50e8d6[_0xc343('0x10')][_0xc343('0x12')]);}else{logger[_0xc343('0xb')](_0xc343('0xc'),_0x547157,'request\x20sent');_0x2a43d3(_0x50e8d6[_0xc343('0x13')][_0xc343('0x12')]);}})[_0xc343('0x14')](function(_0x3287fd){logger[_0xc343('0x10')]('ChatApplication,\x20%s,\x20%s',_0x547157,_0x3287fd);_0xccd33a(_0x3287fd);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 7ee7485..b634365 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 _0x668d=['show','put','delete','destroy','exports','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated'];(function(_0x8b8be1,_0x5cbe7c){var _0x424735=function(_0x57adf6){while(--_0x57adf6){_0x8b8be1['push'](_0x8b8be1['shift']());}};_0x424735(++_0x5cbe7c);}(_0x668d,0x113));var _0xd668=function(_0x23666e,_0x3a73a8){_0x23666e=_0x23666e-0x0;var _0x308fd8=_0x668d[_0x23666e];return _0x308fd8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd668('0x0'));var timeout=require('connect-timeout');var express=require(_0xd668('0x1'));var router=express['Router']();var fs_extra=require(_0xd668('0x2'));var auth=require(_0xd668('0x3'));var interaction=require(_0xd668('0x4'));var config=require(_0xd668('0x5'));var controller=require(_0xd668('0x6'));router[_0xd668('0x7')](_0xd668('0x8'),auth[_0xd668('0x9')](),controller[_0xd668('0xa')]);router[_0xd668('0xb')](_0xd668('0x8'),auth[_0xd668('0x9')](),controller['update']);router[_0xd668('0xc')](_0xd668('0x8'),auth['isAuthenticated'](),controller[_0xd668('0xd')]);module[_0xd668('0xe')]=router; \ No newline at end of file +var _0x18f7=['../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','destroy','exports','util','path','connect-timeout','express'];(function(_0x44758b,_0x1ceb59){var _0x1d6576=function(_0x2cffeb){while(--_0x2cffeb){_0x44758b['push'](_0x44758b['shift']());}};_0x1d6576(++_0x1ceb59);}(_0x18f7,0x15b));var _0x718f=function(_0x380b8f,_0x32271d){_0x380b8f=_0x380b8f-0x0;var _0x646c69=_0x18f7[_0x380b8f];return _0x646c69;};'use strict';var multer=require('multer');var util=require(_0x718f('0x0'));var path=require(_0x718f('0x1'));var timeout=require(_0x718f('0x2'));var express=require(_0x718f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x718f('0x4'));var config=require(_0x718f('0x5'));var controller=require(_0x718f('0x6'));router[_0x718f('0x7')](_0x718f('0x8'),auth[_0x718f('0x9')](),controller[_0x718f('0xa')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x718f('0x8'),auth['isAuthenticated'](),controller[_0x718f('0xb')]);module[_0x718f('0xc')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 4827f7e..08e156b 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 _0x0213=['BOOLEAN','sequelize','exports','STRING'];(function(_0x2382fb,_0x4ded71){var _0x3a90b1=function(_0xe937f0){while(--_0xe937f0){_0x2382fb['push'](_0x2382fb['shift']());}};_0x3a90b1(++_0x4ded71);}(_0x0213,0x105));var _0x3021=function(_0x71b765,_0x3053f8){_0x71b765=_0x71b765-0x0;var _0x34cb24=_0x0213[_0x71b765];return _0x34cb24;};'use strict';var Sequelize=require(_0x3021('0x0'));module[_0x3021('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x3021('0x2')]},'write':{'type':Sequelize[_0x3021('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x35a6=['STRING','BOOLEAN'];(function(_0x26f9c4,_0x22ecb4){var _0x47c107=function(_0x557702){while(--_0x557702){_0x26f9c4['push'](_0x26f9c4['shift']());}};_0x47c107(++_0x22ecb4);}(_0x35a6,0x122));var _0x635a=function(_0x1da7a7,_0x360d47){_0x1da7a7=_0x1da7a7-0x0;var _0x454ba0=_0x35a6[_0x1da7a7];return _0x454ba0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x635a('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x635a('0x0')]},'write':{'type':Sequelize[_0x635a('0x1')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index aa382fe..f52c8f4 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 _0xf9c6=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./chatGroup.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','then','catch','show','params','include','merge','find','create','body','describe','ChatInternalMessage','toInteger','addMembers','ids','omit','getMembers','User','removeMembers','ChatGroupId','getMessages','findOne','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x1679cc,_0x242c53){var _0x4aaec8=function(_0x303c5f){while(--_0x303c5f){_0x1679cc['push'](_0x1679cc['shift']());}};_0x4aaec8(++_0x242c53);}(_0xf9c6,0x117));var _0x6f9c=function(_0x4f4b6f,_0x36f7ad){_0x4f4b6f=_0x4f4b6f-0x0;var _0x3bb63c=_0xf9c6[_0x4f4b6f];return _0x3bb63c;};'use strict';var emlformat=require(_0x6f9c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6f9c('0x1'));var jsonpatch=require(_0x6f9c('0x2'));var rp=require(_0x6f9c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6f9c('0x4'));var util=require(_0x6f9c('0x5'));var path=require('path');var sox=require(_0x6f9c('0x6'));var csv=require(_0x6f9c('0x7'));var ejs=require(_0x6f9c('0x8'));var fs=require('fs');var fs_extra=require(_0x6f9c('0x9'));var _=require(_0x6f9c('0xa'));var squel=require(_0x6f9c('0xb'));var crypto=require('crypto');var jsforce=require(_0x6f9c('0xc'));var deskjs=require(_0x6f9c('0xd'));var toCsv=require(_0x6f9c('0x7'));var querystring=require('querystring');var Papa=require(_0x6f9c('0xe'));var Redis=require(_0x6f9c('0xf'));var authService=require(_0x6f9c('0x10'));var qs=require(_0x6f9c('0x11'));var as=require(_0x6f9c('0x12'));var hardwareService=require(_0x6f9c('0x13'));var logger=require(_0x6f9c('0x14'))(_0x6f9c('0x15'));var utils=require(_0x6f9c('0x16'));var config=require(_0x6f9c('0x17'));var licenseUtil=require(_0x6f9c('0x18'));var db=require('../../mysqldb')['db'];config[_0x6f9c('0x19')]=_[_0x6f9c('0x1a')](config[_0x6f9c('0x19')],{'host':_0x6f9c('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6f9c('0x19')]));require(_0x6f9c('0x1c'))[_0x6f9c('0x1d')](socket);function respondWithStatusCode(_0x47a494,_0x16d120){_0x16d120=_0x16d120||0xcc;return function(_0x29a773){if(_0x29a773){return _0x47a494[_0x6f9c('0x1e')](_0x16d120);}return _0x47a494[_0x6f9c('0x1f')](_0x16d120)[_0x6f9c('0x20')]();};}function respondWithResult(_0x350a3a,_0x41bc74){_0x41bc74=_0x41bc74||0xc8;return function(_0x52151b){if(_0x52151b){return _0x350a3a[_0x6f9c('0x1f')](_0x41bc74)[_0x6f9c('0x21')](_0x52151b);}};}function respondWithFilteredResult(_0x25a0fe,_0xa7a9ec){return function(_0x2dc3c8){if(_0x2dc3c8){var _0x502c1b=typeof _0xa7a9ec[_0x6f9c('0x22')]===_0x6f9c('0x23')&&typeof _0xa7a9ec[_0x6f9c('0x24')]==='undefined';var _0x638f67=_0x2dc3c8['count'];var _0x107952=_0x502c1b?0x0:_0xa7a9ec[_0x6f9c('0x22')];var _0x569087=_0x502c1b?_0x2dc3c8[_0x6f9c('0x25')]:_0xa7a9ec['offset']+_0xa7a9ec['limit'];var _0x367b83;if(_0x569087>=_0x638f67){_0x569087=_0x638f67;_0x367b83=0xc8;}else{_0x367b83=0xce;}_0x25a0fe[_0x6f9c('0x1f')](_0x367b83);return _0x25a0fe[_0x6f9c('0x26')](_0x6f9c('0x27'),_0x107952+'-'+_0x569087+'/'+_0x638f67)[_0x6f9c('0x21')](_0x2dc3c8);}return null;};}function patchUpdates(_0x3a7fb8){return function(_0x31c85d){try{jsonpatch[_0x6f9c('0x28')](_0x31c85d,_0x3a7fb8,!![]);}catch(_0x52656c){return BPromise[_0x6f9c('0x29')](_0x52656c);}return _0x31c85d[_0x6f9c('0x2a')]();};}function saveUpdates(_0x317ae3,_0x56ffeb){return function(_0x5e9715){if(_0x5e9715){return _0x5e9715[_0x6f9c('0x2b')](_0x317ae3)['then'](function(_0x5902cf){return _0x5902cf;});}return null;};}function removeEntity(_0x5a98d0,_0x13cbe4){return function(_0x2fedec){if(_0x2fedec){return _0x2fedec[_0x6f9c('0x2c')]()['then'](function(){_0x5a98d0[_0x6f9c('0x1f')](0xcc)[_0x6f9c('0x20')]();});}};}function handleEntityNotFound(_0x935f9b,_0x2d2882){return function(_0x280f3b){if(!_0x280f3b){_0x935f9b[_0x6f9c('0x1e')](0x194);}return _0x280f3b;};}function handleError(_0x5d20fa,_0x3352a2){_0x3352a2=_0x3352a2||0x1f4;return function(_0x21ba28){logger[_0x6f9c('0x2d')](_0x21ba28[_0x6f9c('0x2e')]);if(_0x21ba28[_0x6f9c('0x2f')]){delete _0x21ba28[_0x6f9c('0x2f')];}_0x5d20fa[_0x6f9c('0x1f')](_0x3352a2)[_0x6f9c('0x30')](_0x21ba28);};}exports[_0x6f9c('0x31')]=function(_0x13232c,_0x356714){var _0x4c5642={},_0x4e1153={},_0x1baf4f={'count':0x0,'rows':[]};var _0x492cab=_[_0x6f9c('0x32')](db[_0x6f9c('0x33')][_0x6f9c('0x34')],function(_0x2dee34){return{'name':_0x2dee34[_0x6f9c('0x35')],'type':_0x2dee34[_0x6f9c('0x36')][_0x6f9c('0x37')]};});_0x4e1153[_0x6f9c('0x38')]=_[_0x6f9c('0x32')](_0x492cab,_0x6f9c('0x2f'));_0x4e1153[_0x6f9c('0x39')]=_[_0x6f9c('0x3a')](_0x13232c['query']);_0x4e1153[_0x6f9c('0x3b')]=_[_0x6f9c('0x3c')](_0x4e1153[_0x6f9c('0x38')],_0x4e1153[_0x6f9c('0x39')]);_0x4c5642[_0x6f9c('0x3d')]=_[_0x6f9c('0x3c')](_0x4e1153[_0x6f9c('0x38')],qs[_0x6f9c('0x3e')](_0x13232c['query']['fields']));_0x4c5642['attributes']=_0x4c5642[_0x6f9c('0x3d')][_0x6f9c('0x3f')]?_0x4c5642[_0x6f9c('0x3d')]:_0x4e1153['model'];if(!_0x13232c[_0x6f9c('0x39')][_0x6f9c('0x40')](_0x6f9c('0x41'))){_0x4c5642[_0x6f9c('0x24')]=qs['limit'](_0x13232c[_0x6f9c('0x39')][_0x6f9c('0x24')]);_0x4c5642[_0x6f9c('0x22')]=qs[_0x6f9c('0x22')](_0x13232c[_0x6f9c('0x39')][_0x6f9c('0x22')]);}_0x4c5642[_0x6f9c('0x42')]=qs[_0x6f9c('0x43')](_0x13232c[_0x6f9c('0x39')][_0x6f9c('0x43')]);_0x4c5642[_0x6f9c('0x44')]=qs['filters'](_[_0x6f9c('0x45')](_0x13232c[_0x6f9c('0x39')],_0x4e1153[_0x6f9c('0x3b')]),_0x492cab);if(_0x13232c['query'][_0x6f9c('0x46')]){_0x4c5642[_0x6f9c('0x44')]=_['merge'](_0x4c5642[_0x6f9c('0x44')],{'$or':_[_0x6f9c('0x32')](_0x492cab,function(_0x3ab3aa){if(_0x3ab3aa[_0x6f9c('0x36')]!==_0x6f9c('0x47')){var _0x50f83f={};_0x50f83f[_0x3ab3aa[_0x6f9c('0x2f')]]={'$like':'%'+_0x13232c[_0x6f9c('0x39')][_0x6f9c('0x46')]+'%'};return _0x50f83f;}})});}_0x4c5642=_['merge']({},_0x4c5642,_0x13232c[_0x6f9c('0x48')]);var _0x29be88={'where':_0x4c5642[_0x6f9c('0x44')]};return db[_0x6f9c('0x33')][_0x6f9c('0x25')](_0x29be88)['then'](function(_0x3ce580){_0x1baf4f[_0x6f9c('0x25')]=_0x3ce580;if(_0x13232c[_0x6f9c('0x39')][_0x6f9c('0x49')]){_0x4c5642['include']=[{'all':!![]}];}return db['ChatGroup']['findAll'](_0x4c5642);})[_0x6f9c('0x4a')](function(_0x4ad8da){_0x1baf4f['rows']=_0x4ad8da;return _0x1baf4f;})[_0x6f9c('0x4a')](respondWithFilteredResult(_0x356714,_0x4c5642))[_0x6f9c('0x4b')](handleError(_0x356714,null));};exports[_0x6f9c('0x4c')]=function(_0x350e48,_0x3afc9d){var _0x48b429={'raw':!![],'where':{'id':_0x350e48[_0x6f9c('0x4d')]['id']}},_0x261d59={};_0x261d59[_0x6f9c('0x38')]=_[_0x6f9c('0x3a')](db['ChatGroup']['rawAttributes']);_0x261d59[_0x6f9c('0x39')]=_[_0x6f9c('0x3a')](_0x350e48[_0x6f9c('0x39')]);_0x261d59['filters']=_['intersection'](_0x261d59[_0x6f9c('0x38')],_0x261d59[_0x6f9c('0x39')]);_0x48b429[_0x6f9c('0x3d')]=_['intersection'](_0x261d59['model'],qs['fields'](_0x350e48[_0x6f9c('0x39')][_0x6f9c('0x3e')]));_0x48b429['attributes']=_0x48b429[_0x6f9c('0x3d')][_0x6f9c('0x3f')]?_0x48b429[_0x6f9c('0x3d')]:_0x261d59[_0x6f9c('0x38')];if(_0x350e48['query'][_0x6f9c('0x49')]){_0x48b429[_0x6f9c('0x4e')]=[{'all':!![]}];}_0x48b429=_[_0x6f9c('0x4f')]({},_0x48b429,_0x350e48[_0x6f9c('0x48')]);return db[_0x6f9c('0x33')][_0x6f9c('0x50')](_0x48b429)[_0x6f9c('0x4a')](handleEntityNotFound(_0x3afc9d,null))['then'](respondWithResult(_0x3afc9d,null))[_0x6f9c('0x4b')](handleError(_0x3afc9d,null));};exports[_0x6f9c('0x51')]=function(_0xda62d8,_0x6d04c0){return db['ChatGroup']['create'](_0xda62d8[_0x6f9c('0x52')],{})['then'](respondWithResult(_0x6d04c0,0xc9))[_0x6f9c('0x4b')](handleError(_0x6d04c0,null));};exports[_0x6f9c('0x2b')]=function(_0x33a021,_0x264219){if(_0x33a021[_0x6f9c('0x52')]['id']){delete _0x33a021['body']['id'];}return db[_0x6f9c('0x33')][_0x6f9c('0x50')]({'where':{'id':_0x33a021[_0x6f9c('0x4d')]['id']}})[_0x6f9c('0x4a')](handleEntityNotFound(_0x264219,null))[_0x6f9c('0x4a')](saveUpdates(_0x33a021[_0x6f9c('0x52')],null))[_0x6f9c('0x4a')](respondWithResult(_0x264219,null))[_0x6f9c('0x4b')](handleError(_0x264219,null));};exports[_0x6f9c('0x2c')]=function(_0x2e3959,_0x530ce5){return db[_0x6f9c('0x33')][_0x6f9c('0x50')]({'where':{'id':_0x2e3959[_0x6f9c('0x4d')]['id']}})[_0x6f9c('0x4a')](handleEntityNotFound(_0x530ce5,null))[_0x6f9c('0x4a')](removeEntity(_0x530ce5,null))[_0x6f9c('0x4b')](handleError(_0x530ce5,null));};exports[_0x6f9c('0x53')]=function(_0x5a2e4e,_0x34bd19){return db[_0x6f9c('0x33')][_0x6f9c('0x53')]()[_0x6f9c('0x4a')](respondWithResult(_0x34bd19,null))['catch'](handleError(_0x34bd19,null));};exports['getUnread']=function(_0x1c73f3,_0x5ddd95,_0x4b6962){return db[_0x6f9c('0x54')][_0x6f9c('0x25')]({'where':{'ChatGroupId':_0x1c73f3[_0x6f9c('0x4d')]['id'],'ToId':_0x1c73f3['user']['id'],'read':![]}})['then'](function(_0x5e0ee4){return{'id':_[_0x6f9c('0x55')](_0x1c73f3['params']['id']),'count':_0x5e0ee4};})[_0x6f9c('0x4a')](respondWithResult(_0x5ddd95,null))[_0x6f9c('0x4b')](handleError(_0x5ddd95,null));};exports[_0x6f9c('0x56')]=function(_0x298ab0,_0x5097af,_0x54c05f){return db[_0x6f9c('0x33')]['find']({'where':{'id':_0x298ab0[_0x6f9c('0x4d')]['id']}})[_0x6f9c('0x4a')](handleEntityNotFound(_0x5097af,null))[_0x6f9c('0x4a')](function(_0x512560){if(_0x512560){return _0x512560[_0x6f9c('0x56')](_0x298ab0[_0x6f9c('0x52')][_0x6f9c('0x57')],_[_0x6f9c('0x58')](_0x298ab0[_0x6f9c('0x52')],[_0x6f9c('0x57'),'id'])||{});}})[_0x6f9c('0x4a')](respondWithResult(_0x5097af,null))[_0x6f9c('0x4b')](handleError(_0x5097af,null));};exports[_0x6f9c('0x59')]=function(_0x356c89,_0x16bc41,_0xede51){var _0x15587a={};var _0x43863c={};var _0x19a17e;var _0x4c3419;return db['ChatGroup']['findOne']({'where':{'id':_0x356c89[_0x6f9c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x16bc41,null))['then'](function(_0x25ac1b){if(_0x25ac1b){_0x19a17e=_0x25ac1b;_0x43863c['model']=_[_0x6f9c('0x3a')](db[_0x6f9c('0x5a')][_0x6f9c('0x34')]);_0x43863c[_0x6f9c('0x39')]=_['keys'](_0x356c89['query']);_0x43863c[_0x6f9c('0x3b')]=_[_0x6f9c('0x3c')](_0x43863c['model'],_0x43863c[_0x6f9c('0x39')]);_0x15587a[_0x6f9c('0x3d')]=_[_0x6f9c('0x3c')](_0x43863c['model'],qs[_0x6f9c('0x3e')](_0x356c89[_0x6f9c('0x39')]['fields']));_0x15587a[_0x6f9c('0x3d')]=_0x15587a[_0x6f9c('0x3d')]['length']?_0x15587a[_0x6f9c('0x3d')]:_0x43863c[_0x6f9c('0x38')];_0x15587a[_0x6f9c('0x42')]=qs[_0x6f9c('0x43')](_0x356c89[_0x6f9c('0x39')][_0x6f9c('0x43')]);_0x15587a[_0x6f9c('0x44')]=qs[_0x6f9c('0x3b')](_[_0x6f9c('0x45')](_0x356c89[_0x6f9c('0x39')],_0x43863c['filters']));if(_0x356c89[_0x6f9c('0x39')][_0x6f9c('0x46')]){_0x15587a[_0x6f9c('0x44')]=_[_0x6f9c('0x4f')](_0x15587a[_0x6f9c('0x44')],{'$or':_[_0x6f9c('0x32')](_0x15587a[_0x6f9c('0x3d')],function(_0x2d78d3){var _0x76fea8={};_0x76fea8[_0x2d78d3]={'$like':'%'+_0x356c89[_0x6f9c('0x39')][_0x6f9c('0x46')]+'%'};return _0x76fea8;})});}_0x15587a=_['merge']({},_0x15587a,_0x356c89[_0x6f9c('0x48')]);return _0x19a17e[_0x6f9c('0x59')](_0x15587a);}})['then'](function(_0x4ac85f){if(_0x4ac85f){_0x4c3419=_0x4ac85f['length'];if(!_0x356c89[_0x6f9c('0x39')][_0x6f9c('0x40')](_0x6f9c('0x41'))){_0x15587a[_0x6f9c('0x24')]=qs[_0x6f9c('0x24')](_0x356c89[_0x6f9c('0x39')][_0x6f9c('0x24')]);_0x15587a[_0x6f9c('0x22')]=qs['offset'](_0x356c89[_0x6f9c('0x39')]['offset']);}return _0x19a17e[_0x6f9c('0x59')](_0x15587a);}})[_0x6f9c('0x4a')](function(_0x52d974){if(_0x52d974){return _0x52d974?{'count':_0x4c3419,'rows':_0x52d974}:null;}})['then'](respondWithResult(_0x16bc41,null))[_0x6f9c('0x4b')](handleError(_0x16bc41,null));};exports[_0x6f9c('0x5b')]=function(_0x441112,_0x3fe7a5,_0x584821){return db[_0x6f9c('0x33')][_0x6f9c('0x50')]({'where':{'id':_0x441112[_0x6f9c('0x4d')]['id']}})[_0x6f9c('0x4a')](handleEntityNotFound(_0x3fe7a5,null))[_0x6f9c('0x4a')](function(_0x58d7f2){if(_0x58d7f2){return _0x58d7f2['removeMembers'](_0x441112[_0x6f9c('0x39')][_0x6f9c('0x57')]);}})[_0x6f9c('0x4a')](respondWithStatusCode(_0x3fe7a5,null))['catch'](handleError(_0x3fe7a5,null));};exports['addMessage']=function(_0x16d804,_0x3a2a8f,_0x4324ff){if(_0x16d804[_0x6f9c('0x52')]['id']){delete _0x16d804[_0x6f9c('0x52')]['id'];}return db[_0x6f9c('0x33')][_0x6f9c('0x50')]({'where':{'id':_0x16d804[_0x6f9c('0x4d')]['id']}})[_0x6f9c('0x4a')](handleEntityNotFound(_0x3a2a8f,null))[_0x6f9c('0x4a')](function(_0x196ba1){if(_0x196ba1){_0x16d804['body'][_0x6f9c('0x5c')]=_0x196ba1['id'];return db[_0x6f9c('0x54')]['create'](_0x16d804['body']);}})[_0x6f9c('0x4a')](respondWithResult(_0x3a2a8f,null))['catch'](handleError(_0x3a2a8f,null));};exports[_0x6f9c('0x5d')]=function(_0x4f1a25,_0x1f937f,_0x5ceb18){var _0x52ddf9={};var _0xa8dd2b={};var _0x167170;var _0x228dcc;return db[_0x6f9c('0x33')][_0x6f9c('0x5e')]({'where':{'id':_0x4f1a25[_0x6f9c('0x4d')]['id']}})[_0x6f9c('0x4a')](handleEntityNotFound(_0x1f937f,null))[_0x6f9c('0x4a')](function(_0x339518){if(_0x339518){_0x167170=_0x339518;_0xa8dd2b['model']=_[_0x6f9c('0x3a')](db[_0x6f9c('0x54')][_0x6f9c('0x34')]);_0xa8dd2b[_0x6f9c('0x39')]=_[_0x6f9c('0x3a')](_0x4f1a25['query']);_0xa8dd2b['filters']=_['intersection'](_0xa8dd2b[_0x6f9c('0x38')],_0xa8dd2b[_0x6f9c('0x39')]);_0x52ddf9[_0x6f9c('0x3d')]=_[_0x6f9c('0x3c')](_0xa8dd2b['model'],qs['fields'](_0x4f1a25[_0x6f9c('0x39')]['fields']));_0x52ddf9[_0x6f9c('0x3d')]=_0x52ddf9[_0x6f9c('0x3d')][_0x6f9c('0x3f')]?_0x52ddf9[_0x6f9c('0x3d')]:_0xa8dd2b[_0x6f9c('0x38')];_0x52ddf9[_0x6f9c('0x42')]=qs[_0x6f9c('0x43')](_0x4f1a25['query'][_0x6f9c('0x43')]);_0x52ddf9['where']=qs[_0x6f9c('0x3b')](_[_0x6f9c('0x45')](_0x4f1a25[_0x6f9c('0x39')],_0xa8dd2b['filters']));if(_0x4f1a25[_0x6f9c('0x39')][_0x6f9c('0x46')]){_0x52ddf9[_0x6f9c('0x44')]=_[_0x6f9c('0x4f')](_0x52ddf9[_0x6f9c('0x44')],{'$or':_[_0x6f9c('0x32')](_0x52ddf9[_0x6f9c('0x3d')],function(_0x2d6639){var _0x5507cb={};_0x5507cb[_0x2d6639]={'$like':'%'+_0x4f1a25[_0x6f9c('0x39')][_0x6f9c('0x46')]+'%'};return _0x5507cb;})});}if(_0x4f1a25[_0x6f9c('0x39')][_0x6f9c('0x5f')]){var _0x313f20=_0x4f1a25[_0x6f9c('0x39')][_0x6f9c('0x5f')][_0x6f9c('0x60')](',');var _0x3825aa={};_0x3825aa[_0x313f20[0x0]]={'$gte':moment(_0x313f20[0x1])[_0x6f9c('0x61')](_0x6f9c('0x62'))};_0x52ddf9['where']=_['merge'](_0x52ddf9['where'],_0x3825aa);}_0x52ddf9=_[_0x6f9c('0x4f')]({},_0x52ddf9,_0x4f1a25[_0x6f9c('0x48')]);return _0x167170[_0x6f9c('0x5d')](_0x52ddf9);}})['then'](function(_0x2e12e0){if(_0x2e12e0){_0x228dcc=_0x2e12e0[_0x6f9c('0x3f')];if(!_0x4f1a25[_0x6f9c('0x39')]['hasOwnProperty']('nolimit')){_0x52ddf9[_0x6f9c('0x24')]=qs[_0x6f9c('0x24')](_0x4f1a25[_0x6f9c('0x39')][_0x6f9c('0x24')]);_0x52ddf9[_0x6f9c('0x22')]=qs[_0x6f9c('0x22')](_0x4f1a25[_0x6f9c('0x39')]['offset']);}return _0x167170[_0x6f9c('0x5d')](_0x52ddf9);}})[_0x6f9c('0x4a')](function(_0x3e2c5a){if(_0x3e2c5a){return _0x3e2c5a?{'count':_0x228dcc,'rows':_0x3e2c5a}:null;}})[_0x6f9c('0x4a')](respondWithResult(_0x1f937f,null))[_0x6f9c('0x4b')](handleError(_0x1f937f,null));}; \ No newline at end of file +var _0x2a97=['util','sox','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./chatGroup.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','error','name','send','index','map','ChatGroup','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','update','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','findOne','pick','getMembers','removeMembers','addMessage','ChatGroupId','getMessages','split','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x52ebbe,_0x590652){var _0x4e8fe2=function(_0x201bfd){while(--_0x201bfd){_0x52ebbe['push'](_0x52ebbe['shift']());}};_0x4e8fe2(++_0x590652);}(_0x2a97,0x173));var _0x72a9=function(_0x3e827a,_0x4cb9c5){_0x3e827a=_0x3e827a-0x0;var _0x47a0a0=_0x2a97[_0x3e827a];return _0x47a0a0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x72a9('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x72a9('0x1'));var moment=require(_0x72a9('0x2'));var BPromise=require(_0x72a9('0x3'));var Mustache=require(_0x72a9('0x4'));var util=require(_0x72a9('0x5'));var path=require('path');var sox=require(_0x72a9('0x6'));var csv=require('to-csv');var ejs=require(_0x72a9('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x72a9('0x8'));var crypto=require(_0x72a9('0x9'));var jsforce=require(_0x72a9('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x72a9('0xb'));var Papa=require(_0x72a9('0xc'));var Redis=require(_0x72a9('0xd'));var authService=require(_0x72a9('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x72a9('0xf'));var hardwareService=require(_0x72a9('0x10'));var logger=require(_0x72a9('0x11'))('api');var utils=require(_0x72a9('0x12'));var config=require(_0x72a9('0x13'));var licenseUtil=require(_0x72a9('0x14'));var db=require(_0x72a9('0x15'))['db'];config['redis']=_[_0x72a9('0x16')](config['redis'],{'host':_0x72a9('0x17'),'port':0x18eb});var socket=require(_0x72a9('0x18'))(new Redis(config[_0x72a9('0x19')]));require(_0x72a9('0x1a'))[_0x72a9('0x1b')](socket);function respondWithStatusCode(_0x384e38,_0x52386e){_0x52386e=_0x52386e||0xcc;return function(_0x4a6379){if(_0x4a6379){return _0x384e38[_0x72a9('0x1c')](_0x52386e);}return _0x384e38[_0x72a9('0x1d')](_0x52386e)[_0x72a9('0x1e')]();};}function respondWithResult(_0x1beddd,_0x1e2794){_0x1e2794=_0x1e2794||0xc8;return function(_0x3c0f32){if(_0x3c0f32){return _0x1beddd[_0x72a9('0x1d')](_0x1e2794)[_0x72a9('0x1f')](_0x3c0f32);}};}function respondWithFilteredResult(_0x4d685a,_0x1e80bb){return function(_0x31af0e){if(_0x31af0e){var _0x31a6b9=typeof _0x1e80bb[_0x72a9('0x20')]===_0x72a9('0x21')&&typeof _0x1e80bb[_0x72a9('0x22')]==='undefined';var _0x2c5728=_0x31af0e[_0x72a9('0x23')];var _0x41259d=_0x31a6b9?0x0:_0x1e80bb['offset'];var _0x5be587=_0x31a6b9?_0x31af0e[_0x72a9('0x23')]:_0x1e80bb[_0x72a9('0x20')]+_0x1e80bb[_0x72a9('0x22')];var _0xf49726;if(_0x5be587>=_0x2c5728){_0x5be587=_0x2c5728;_0xf49726=0xc8;}else{_0xf49726=0xce;}_0x4d685a['status'](_0xf49726);return _0x4d685a[_0x72a9('0x24')](_0x72a9('0x25'),_0x41259d+'-'+_0x5be587+'/'+_0x2c5728)[_0x72a9('0x1f')](_0x31af0e);}return null;};}function patchUpdates(_0xf789b9){return function(_0x24585d){try{jsonpatch['apply'](_0x24585d,_0xf789b9,!![]);}catch(_0xf2ace5){return BPromise[_0x72a9('0x26')](_0xf2ace5);}return _0x24585d['save']();};}function saveUpdates(_0xa5b0c2,_0x4a8b6f){return function(_0x4bba66){if(_0x4bba66){return _0x4bba66['update'](_0xa5b0c2)[_0x72a9('0x27')](function(_0x438c58){return _0x438c58;});}return null;};}function removeEntity(_0x210e88,_0x550670){return function(_0xcce07a){if(_0xcce07a){return _0xcce07a[_0x72a9('0x28')]()[_0x72a9('0x27')](function(){_0x210e88['status'](0xcc)[_0x72a9('0x1e')]();});}};}function handleEntityNotFound(_0x12b138,_0x6cbd80){return function(_0x1f7744){if(!_0x1f7744){_0x12b138[_0x72a9('0x1c')](0x194);}return _0x1f7744;};}function handleError(_0xfec668,_0x4d178f){_0x4d178f=_0x4d178f||0x1f4;return function(_0x52abc4){logger[_0x72a9('0x29')](_0x52abc4['stack']);if(_0x52abc4[_0x72a9('0x2a')]){delete _0x52abc4[_0x72a9('0x2a')];}_0xfec668[_0x72a9('0x1d')](_0x4d178f)[_0x72a9('0x2b')](_0x52abc4);};}exports[_0x72a9('0x2c')]=function(_0x48ccb3,_0x22699c){var _0x168f61={},_0x3acd82={},_0x2384a6={'count':0x0,'rows':[]};var _0x46279b=_[_0x72a9('0x2d')](db[_0x72a9('0x2e')][_0x72a9('0x2f')],function(_0x5ea745){return{'name':_0x5ea745['fieldName'],'type':_0x5ea745[_0x72a9('0x30')][_0x72a9('0x31')]};});_0x3acd82[_0x72a9('0x32')]=_[_0x72a9('0x2d')](_0x46279b,_0x72a9('0x2a'));_0x3acd82['query']=_[_0x72a9('0x33')](_0x48ccb3[_0x72a9('0x34')]);_0x3acd82[_0x72a9('0x35')]=_['intersection'](_0x3acd82['model'],_0x3acd82[_0x72a9('0x34')]);_0x168f61[_0x72a9('0x36')]=_[_0x72a9('0x37')](_0x3acd82[_0x72a9('0x32')],qs['fields'](_0x48ccb3[_0x72a9('0x34')][_0x72a9('0x38')]));_0x168f61['attributes']=_0x168f61[_0x72a9('0x36')][_0x72a9('0x39')]?_0x168f61[_0x72a9('0x36')]:_0x3acd82['model'];if(!_0x48ccb3[_0x72a9('0x34')][_0x72a9('0x3a')](_0x72a9('0x3b'))){_0x168f61['limit']=qs[_0x72a9('0x22')](_0x48ccb3[_0x72a9('0x34')][_0x72a9('0x22')]);_0x168f61['offset']=qs[_0x72a9('0x20')](_0x48ccb3['query']['offset']);}_0x168f61[_0x72a9('0x3c')]=qs[_0x72a9('0x3d')](_0x48ccb3['query'][_0x72a9('0x3d')]);_0x168f61[_0x72a9('0x3e')]=qs['filters'](_['pick'](_0x48ccb3['query'],_0x3acd82['filters']),_0x46279b);if(_0x48ccb3[_0x72a9('0x34')][_0x72a9('0x3f')]){_0x168f61[_0x72a9('0x3e')]=_[_0x72a9('0x40')](_0x168f61['where'],{'$or':_[_0x72a9('0x2d')](_0x46279b,function(_0x1a3162){if(_0x1a3162[_0x72a9('0x30')]!==_0x72a9('0x41')){var _0x61cf27={};_0x61cf27[_0x1a3162[_0x72a9('0x2a')]]={'$like':'%'+_0x48ccb3[_0x72a9('0x34')][_0x72a9('0x3f')]+'%'};return _0x61cf27;}})});}_0x168f61=_['merge']({},_0x168f61,_0x48ccb3[_0x72a9('0x42')]);var _0x14ddab={'where':_0x168f61[_0x72a9('0x3e')]};return db['ChatGroup'][_0x72a9('0x23')](_0x14ddab)['then'](function(_0x5a1174){_0x2384a6['count']=_0x5a1174;if(_0x48ccb3[_0x72a9('0x34')]['includeAll']){_0x168f61[_0x72a9('0x43')]=[{'all':!![]}];}return db['ChatGroup'][_0x72a9('0x44')](_0x168f61);})[_0x72a9('0x27')](function(_0x291043){_0x2384a6[_0x72a9('0x45')]=_0x291043;return _0x2384a6;})[_0x72a9('0x27')](respondWithFilteredResult(_0x22699c,_0x168f61))[_0x72a9('0x46')](handleError(_0x22699c,null));};exports[_0x72a9('0x47')]=function(_0xde31ea,_0x21fdd4){var _0x2c1803={'raw':!![],'where':{'id':_0xde31ea[_0x72a9('0x48')]['id']}},_0x3aca4f={};_0x3aca4f[_0x72a9('0x32')]=_[_0x72a9('0x33')](db[_0x72a9('0x2e')][_0x72a9('0x2f')]);_0x3aca4f[_0x72a9('0x34')]=_['keys'](_0xde31ea[_0x72a9('0x34')]);_0x3aca4f[_0x72a9('0x35')]=_[_0x72a9('0x37')](_0x3aca4f['model'],_0x3aca4f[_0x72a9('0x34')]);_0x2c1803[_0x72a9('0x36')]=_[_0x72a9('0x37')](_0x3aca4f['model'],qs[_0x72a9('0x38')](_0xde31ea['query'][_0x72a9('0x38')]));_0x2c1803[_0x72a9('0x36')]=_0x2c1803[_0x72a9('0x36')][_0x72a9('0x39')]?_0x2c1803[_0x72a9('0x36')]:_0x3aca4f[_0x72a9('0x32')];if(_0xde31ea[_0x72a9('0x34')][_0x72a9('0x49')]){_0x2c1803[_0x72a9('0x43')]=[{'all':!![]}];}_0x2c1803=_[_0x72a9('0x40')]({},_0x2c1803,_0xde31ea[_0x72a9('0x42')]);return db['ChatGroup'][_0x72a9('0x4a')](_0x2c1803)[_0x72a9('0x27')](handleEntityNotFound(_0x21fdd4,null))['then'](respondWithResult(_0x21fdd4,null))[_0x72a9('0x46')](handleError(_0x21fdd4,null));};exports[_0x72a9('0x4b')]=function(_0x4a572f,_0x28066d){return db['ChatGroup'][_0x72a9('0x4b')](_0x4a572f[_0x72a9('0x4c')],{})[_0x72a9('0x27')](respondWithResult(_0x28066d,0xc9))[_0x72a9('0x46')](handleError(_0x28066d,null));};exports[_0x72a9('0x4d')]=function(_0x58a559,_0x2139d7){if(_0x58a559[_0x72a9('0x4c')]['id']){delete _0x58a559['body']['id'];}return db[_0x72a9('0x2e')]['find']({'where':{'id':_0x58a559[_0x72a9('0x48')]['id']}})[_0x72a9('0x27')](handleEntityNotFound(_0x2139d7,null))['then'](saveUpdates(_0x58a559[_0x72a9('0x4c')],null))[_0x72a9('0x27')](respondWithResult(_0x2139d7,null))[_0x72a9('0x46')](handleError(_0x2139d7,null));};exports[_0x72a9('0x28')]=function(_0xaf4756,_0x25656e){return db['ChatGroup'][_0x72a9('0x4a')]({'where':{'id':_0xaf4756['params']['id']}})[_0x72a9('0x27')](handleEntityNotFound(_0x25656e,null))[_0x72a9('0x27')](removeEntity(_0x25656e,null))[_0x72a9('0x46')](handleError(_0x25656e,null));};exports['describe']=function(_0x37004e,_0x5b8b03){return db[_0x72a9('0x2e')][_0x72a9('0x4e')]()['then'](respondWithResult(_0x5b8b03,null))[_0x72a9('0x46')](handleError(_0x5b8b03,null));};exports[_0x72a9('0x4f')]=function(_0x1ef28d,_0xa90d0b,_0x50d988){return db[_0x72a9('0x50')]['count']({'where':{'ChatGroupId':_0x1ef28d[_0x72a9('0x48')]['id'],'ToId':_0x1ef28d[_0x72a9('0x51')]['id'],'read':![]}})[_0x72a9('0x27')](function(_0x57cab7){return{'id':_[_0x72a9('0x52')](_0x1ef28d['params']['id']),'count':_0x57cab7};})['then'](respondWithResult(_0xa90d0b,null))[_0x72a9('0x46')](handleError(_0xa90d0b,null));};exports[_0x72a9('0x53')]=function(_0x4f04b6,_0x4e78bd,_0x1f2c0d){return db['ChatGroup'][_0x72a9('0x4a')]({'where':{'id':_0x4f04b6[_0x72a9('0x48')]['id']}})[_0x72a9('0x27')](handleEntityNotFound(_0x4e78bd,null))[_0x72a9('0x27')](function(_0x29ec41){if(_0x29ec41){return _0x29ec41[_0x72a9('0x53')](_0x4f04b6[_0x72a9('0x4c')][_0x72a9('0x54')],_[_0x72a9('0x55')](_0x4f04b6[_0x72a9('0x4c')],[_0x72a9('0x54'),'id'])||{});}})[_0x72a9('0x27')](respondWithResult(_0x4e78bd,null))['catch'](handleError(_0x4e78bd,null));};exports['getMembers']=function(_0x43583e,_0x594be8,_0x2518a9){var _0x2fe849={};var _0x3d92ed={};var _0x4d0e81;var _0x24d8f5;return db[_0x72a9('0x2e')][_0x72a9('0x56')]({'where':{'id':_0x43583e[_0x72a9('0x48')]['id']}})[_0x72a9('0x27')](handleEntityNotFound(_0x594be8,null))['then'](function(_0x400744){if(_0x400744){_0x4d0e81=_0x400744;_0x3d92ed[_0x72a9('0x32')]=_[_0x72a9('0x33')](db['User'][_0x72a9('0x2f')]);_0x3d92ed['query']=_['keys'](_0x43583e[_0x72a9('0x34')]);_0x3d92ed[_0x72a9('0x35')]=_[_0x72a9('0x37')](_0x3d92ed['model'],_0x3d92ed[_0x72a9('0x34')]);_0x2fe849[_0x72a9('0x36')]=_[_0x72a9('0x37')](_0x3d92ed[_0x72a9('0x32')],qs[_0x72a9('0x38')](_0x43583e[_0x72a9('0x34')][_0x72a9('0x38')]));_0x2fe849[_0x72a9('0x36')]=_0x2fe849['attributes'][_0x72a9('0x39')]?_0x2fe849[_0x72a9('0x36')]:_0x3d92ed['model'];_0x2fe849[_0x72a9('0x3c')]=qs[_0x72a9('0x3d')](_0x43583e[_0x72a9('0x34')][_0x72a9('0x3d')]);_0x2fe849[_0x72a9('0x3e')]=qs[_0x72a9('0x35')](_[_0x72a9('0x57')](_0x43583e[_0x72a9('0x34')],_0x3d92ed[_0x72a9('0x35')]));if(_0x43583e[_0x72a9('0x34')][_0x72a9('0x3f')]){_0x2fe849[_0x72a9('0x3e')]=_[_0x72a9('0x40')](_0x2fe849[_0x72a9('0x3e')],{'$or':_['map'](_0x2fe849[_0x72a9('0x36')],function(_0x56b49a){var _0x5612a0={};_0x5612a0[_0x56b49a]={'$like':'%'+_0x43583e['query'][_0x72a9('0x3f')]+'%'};return _0x5612a0;})});}_0x2fe849=_[_0x72a9('0x40')]({},_0x2fe849,_0x43583e['options']);return _0x4d0e81[_0x72a9('0x58')](_0x2fe849);}})[_0x72a9('0x27')](function(_0x14be60){if(_0x14be60){_0x24d8f5=_0x14be60[_0x72a9('0x39')];if(!_0x43583e[_0x72a9('0x34')][_0x72a9('0x3a')]('nolimit')){_0x2fe849['limit']=qs[_0x72a9('0x22')](_0x43583e['query']['limit']);_0x2fe849[_0x72a9('0x20')]=qs[_0x72a9('0x20')](_0x43583e['query'][_0x72a9('0x20')]);}return _0x4d0e81[_0x72a9('0x58')](_0x2fe849);}})[_0x72a9('0x27')](function(_0x125567){if(_0x125567){return _0x125567?{'count':_0x24d8f5,'rows':_0x125567}:null;}})['then'](respondWithResult(_0x594be8,null))[_0x72a9('0x46')](handleError(_0x594be8,null));};exports[_0x72a9('0x59')]=function(_0x446385,_0x131472,_0x44bef5){return db[_0x72a9('0x2e')]['find']({'where':{'id':_0x446385[_0x72a9('0x48')]['id']}})[_0x72a9('0x27')](handleEntityNotFound(_0x131472,null))[_0x72a9('0x27')](function(_0x3ad693){if(_0x3ad693){return _0x3ad693[_0x72a9('0x59')](_0x446385[_0x72a9('0x34')][_0x72a9('0x54')]);}})[_0x72a9('0x27')](respondWithStatusCode(_0x131472,null))[_0x72a9('0x46')](handleError(_0x131472,null));};exports[_0x72a9('0x5a')]=function(_0x2195f3,_0x5cc77a,_0x32e15b){if(_0x2195f3[_0x72a9('0x4c')]['id']){delete _0x2195f3[_0x72a9('0x4c')]['id'];}return db[_0x72a9('0x2e')]['find']({'where':{'id':_0x2195f3[_0x72a9('0x48')]['id']}})[_0x72a9('0x27')](handleEntityNotFound(_0x5cc77a,null))['then'](function(_0x44f145){if(_0x44f145){_0x2195f3['body'][_0x72a9('0x5b')]=_0x44f145['id'];return db['ChatInternalMessage']['create'](_0x2195f3[_0x72a9('0x4c')]);}})[_0x72a9('0x27')](respondWithResult(_0x5cc77a,null))[_0x72a9('0x46')](handleError(_0x5cc77a,null));};exports[_0x72a9('0x5c')]=function(_0x41b091,_0x42d789,_0x2ad2c0){var _0x23aa46={};var _0x29fffc={};var _0x238360;var _0x5adbbb;return db[_0x72a9('0x2e')][_0x72a9('0x56')]({'where':{'id':_0x41b091[_0x72a9('0x48')]['id']}})[_0x72a9('0x27')](handleEntityNotFound(_0x42d789,null))['then'](function(_0x3d2156){if(_0x3d2156){_0x238360=_0x3d2156;_0x29fffc[_0x72a9('0x32')]=_[_0x72a9('0x33')](db[_0x72a9('0x50')][_0x72a9('0x2f')]);_0x29fffc['query']=_[_0x72a9('0x33')](_0x41b091[_0x72a9('0x34')]);_0x29fffc[_0x72a9('0x35')]=_[_0x72a9('0x37')](_0x29fffc[_0x72a9('0x32')],_0x29fffc[_0x72a9('0x34')]);_0x23aa46[_0x72a9('0x36')]=_[_0x72a9('0x37')](_0x29fffc[_0x72a9('0x32')],qs[_0x72a9('0x38')](_0x41b091['query'][_0x72a9('0x38')]));_0x23aa46[_0x72a9('0x36')]=_0x23aa46['attributes'][_0x72a9('0x39')]?_0x23aa46[_0x72a9('0x36')]:_0x29fffc[_0x72a9('0x32')];_0x23aa46['order']=qs[_0x72a9('0x3d')](_0x41b091[_0x72a9('0x34')][_0x72a9('0x3d')]);_0x23aa46[_0x72a9('0x3e')]=qs[_0x72a9('0x35')](_[_0x72a9('0x57')](_0x41b091[_0x72a9('0x34')],_0x29fffc[_0x72a9('0x35')]));if(_0x41b091[_0x72a9('0x34')]['filter']){_0x23aa46[_0x72a9('0x3e')]=_['merge'](_0x23aa46[_0x72a9('0x3e')],{'$or':_[_0x72a9('0x2d')](_0x23aa46[_0x72a9('0x36')],function(_0x3f3804){var _0x18d568={};_0x18d568[_0x3f3804]={'$like':'%'+_0x41b091[_0x72a9('0x34')][_0x72a9('0x3f')]+'%'};return _0x18d568;})});}if(_0x41b091[_0x72a9('0x34')]['$gte']){var _0x4c3b8a=_0x41b091[_0x72a9('0x34')]['$gte'][_0x72a9('0x5d')](',');var _0xd36268={};_0xd36268[_0x4c3b8a[0x0]]={'$gte':moment(_0x4c3b8a[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x23aa46[_0x72a9('0x3e')]=_['merge'](_0x23aa46[_0x72a9('0x3e')],_0xd36268);}_0x23aa46=_['merge']({},_0x23aa46,_0x41b091['options']);return _0x238360[_0x72a9('0x5c')](_0x23aa46);}})['then'](function(_0x3e7a01){if(_0x3e7a01){_0x5adbbb=_0x3e7a01['length'];if(!_0x41b091[_0x72a9('0x34')][_0x72a9('0x3a')]('nolimit')){_0x23aa46['limit']=qs[_0x72a9('0x22')](_0x41b091['query'][_0x72a9('0x22')]);_0x23aa46[_0x72a9('0x20')]=qs['offset'](_0x41b091[_0x72a9('0x34')]['offset']);}return _0x238360[_0x72a9('0x5c')](_0x23aa46);}})[_0x72a9('0x27')](function(_0x1ec734){if(_0x1ec734){return _0x1ec734?{'count':_0x5adbbb,'rows':_0x1ec734}:null;}})[_0x72a9('0x27')](respondWithResult(_0x42d789,null))['catch'](handleError(_0x42d789,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index de4a152..95b8d6d 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 _0x2da6=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','update','remove'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x2da6,0x1dd));var _0x62da=function(_0x1bef10,_0x488a41){_0x1bef10=_0x1bef10-0x0;var _0x50e083=_0x2da6[_0x1bef10];return _0x50e083;};'use strict';var EventEmitter=require(_0x62da('0x0'));var ChatGroup=require(_0x62da('0x1'))['db'][_0x62da('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x62da('0x3')](0x0);var events={'afterCreate':_0x62da('0x4'),'afterUpdate':_0x62da('0x5'),'afterDestroy':_0x62da('0x6')};function emitEvent(_0x3552dc){return function(_0x4c079d,_0x4a8428,_0xe28204){ChatGroupEvents[_0x62da('0x7')](_0x3552dc+':'+_0x4c079d['id'],_0x4c079d);ChatGroupEvents[_0x62da('0x7')](_0x3552dc,_0x4c079d);_0xe28204(null);};}for(var e in events){if(events[_0x62da('0x8')](e)){var event=events[e];ChatGroup[_0x62da('0x9')](e,emitEvent(event));}}module[_0x62da('0xa')]=ChatGroupEvents; \ No newline at end of file +var _0x434b=['update','emit','hasOwnProperty','hook','exports','ChatGroup','setMaxListeners'];(function(_0x139b94,_0x50db6f){var _0x6888bf=function(_0x4a03fd){while(--_0x4a03fd){_0x139b94['push'](_0x139b94['shift']());}};_0x6888bf(++_0x50db6f);}(_0x434b,0x17f));var _0xb434=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x434b[_0x44bcb0];return _0xfaf881;};'use strict';var EventEmitter=require('events');var ChatGroup=require('../../mysqldb')['db'][_0xb434('0x0')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xb434('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb434('0x2'),'afterDestroy':'remove'};function emitEvent(_0x48dcb8){return function(_0x3553cb,_0x20334f,_0x79f4e9){ChatGroupEvents[_0xb434('0x3')](_0x48dcb8+':'+_0x3553cb['id'],_0x3553cb);ChatGroupEvents[_0xb434('0x3')](_0x48dcb8,_0x3553cb);_0x79f4e9(null);};}for(var e in events){if(events[_0xb434('0x4')](e)){var event=events[e];ChatGroup[_0xb434('0x5')](e,emitEvent(event));}}module[_0xb434('0x6')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 7b46075..e7e11cc 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 _0xc68a=['bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','define','chat_groups','lodash','util','../../config/logger','api'];(function(_0x450152,_0x5a03bc){var _0x193c9c=function(_0x5ade6c){while(--_0x5ade6c){_0x450152['push'](_0x450152['shift']());}};_0x193c9c(++_0x5a03bc);}(_0xc68a,0x194));var _0xac68=function(_0x35cabc,_0xc0f89a){_0x35cabc=_0x35cabc-0x0;var _0x2af2b9=_0xc68a[_0x35cabc];return _0x2af2b9;};'use strict';var _=require(_0xac68('0x0'));var util=require(_0xac68('0x1'));var logger=require(_0xac68('0x2'))(_0xac68('0x3'));var moment=require('moment');var BPromise=require(_0xac68('0x4'));var rp=require(_0xac68('0x5'));var fs=require('fs');var path=require(_0xac68('0x6'));var rimraf=require(_0xac68('0x7'));var config=require(_0xac68('0x8'));var attributes=require(_0xac68('0x9'));module['exports']=function(_0x48cc93,_0x1d5c0c){return _0x48cc93[_0xac68('0xa')]('ChatGroup',attributes,{'tableName':_0xac68('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb727=['bluebird','request-promise','../../config/environment','exports','define','ChatGroup','chat_groups','lodash','util','moment'];(function(_0x39ebba,_0x33f284){var _0x2c3f5e=function(_0x217b02){while(--_0x217b02){_0x39ebba['push'](_0x39ebba['shift']());}};_0x2c3f5e(++_0x33f284);}(_0xb727,0x147));var _0x7b72=function(_0x423e73,_0x34e2d5){_0x423e73=_0x423e73-0x0;var _0x4e8c1e=_0xb727[_0x423e73];return _0x4e8c1e;};'use strict';var _=require(_0x7b72('0x0'));var util=require(_0x7b72('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7b72('0x2'));var BPromise=require(_0x7b72('0x3'));var rp=require(_0x7b72('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7b72('0x5'));var attributes=require('./chatGroup.attributes');module[_0x7b72('0x6')]=function(_0x1e5acd,_0xd366b4){return _0x1e5acd[_0x7b72('0x7')](_0x7b72('0x8'),attributes,{'tableName':_0x7b72('0x9'),'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 002fb68..47303c7 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 _0x17ba=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x17ba,0xab));var _0xa17b=function(_0x2d07c5,_0x114a9b){_0x2d07c5=_0x2d07c5-0x0;var _0x1a4085=_0x17ba[_0x2d07c5];return _0x1a4085;};'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});config[_0xa17b('0xd')]=_[_0xa17b('0xe')](config[_0xa17b('0xd')],{'host':_0xa17b('0xf'),'port':0x18eb});var socket=require(_0xa17b('0x10'))(new Redis(config[_0xa17b('0xd')]));require(_0xa17b('0x11'))[_0xa17b('0x12')](socket);function respondWithRpcPromise(_0x578799,_0x2556c4,_0x38b8f1){return new BPromise(function(_0x322dc0,_0x1e799a){return client[_0xa17b('0x13')](_0x578799,_0x38b8f1)[_0xa17b('0x14')](function(_0xc5ef2e){logger['info'](_0xa17b('0x15'),_0x2556c4,_0xa17b('0x16'));logger[_0xa17b('0x17')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x2556c4,_0xa17b('0x16'),JSON[_0xa17b('0x18')](_0xc5ef2e));if(_0xc5ef2e[_0xa17b('0x19')]){if(_0xc5ef2e[_0xa17b('0x19')]['code']===0x1f4){logger[_0xa17b('0x19')]('ChatGroup,\x20%s,\x20%s',_0x2556c4,_0xc5ef2e[_0xa17b('0x19')][_0xa17b('0x1a')]);return _0x1e799a(_0xc5ef2e['error'][_0xa17b('0x1a')]);}logger[_0xa17b('0x19')](_0xa17b('0x15'),_0x2556c4,_0xc5ef2e[_0xa17b('0x19')]['message']);return _0x322dc0(_0xc5ef2e[_0xa17b('0x19')]['message']);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0x2556c4,_0xa17b('0x16'));_0x322dc0(_0xc5ef2e[_0xa17b('0x1b')]['message']);}})[_0xa17b('0x1c')](function(_0x166d44){logger[_0xa17b('0x19')](_0xa17b('0x15'),_0x2556c4,_0x166d44);_0x1e799a(_0x166d44);});});} \ No newline at end of file +var _0x5900=['rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x115d5b,_0x26aff2){var _0x6cfc50=function(_0x39a786){while(--_0x39a786){_0x115d5b['push'](_0x115d5b['shift']());}};_0x6cfc50(++_0x26aff2);}(_0x5900,0xd2));var _0x0590=function(_0x3aeb36,_0x312dc9){_0x3aeb36=_0x3aeb36-0x0;var _0xa2ef21=_0x5900[_0x3aeb36];return _0xa2ef21;};'use strict';var _=require('lodash');var util=require(_0x0590('0x0'));var moment=require(_0x0590('0x1'));var BPromise=require('bluebird');var rs=require(_0x0590('0x2'));var fs=require('fs');var Redis=require(_0x0590('0x3'));var db=require(_0x0590('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0590('0x5'))(_0x0590('0x6'));var config=require('../../config/environment');var jayson=require(_0x0590('0x7'));var client=jayson[_0x0590('0x8')]['http']({'port':0x232a});config[_0x0590('0x9')]=_[_0x0590('0xa')](config[_0x0590('0x9')],{'host':_0x0590('0xb'),'port':0x18eb});var socket=require(_0x0590('0xc'))(new Redis(config[_0x0590('0x9')]));require(_0x0590('0xd'))[_0x0590('0xe')](socket);function respondWithRpcPromise(_0x2c58b8,_0x5cffbc,_0x354ef5){return new BPromise(function(_0x42bfba,_0x4c9f77){return client[_0x0590('0xf')](_0x2c58b8,_0x354ef5)[_0x0590('0x10')](function(_0x4ef139){logger['info'](_0x0590('0x11'),_0x5cffbc,'request\x20sent');logger[_0x0590('0x12')](_0x0590('0x13'),_0x5cffbc,_0x0590('0x14'),JSON[_0x0590('0x15')](_0x4ef139));if(_0x4ef139[_0x0590('0x16')]){if(_0x4ef139['error'][_0x0590('0x17')]===0x1f4){logger[_0x0590('0x16')]('ChatGroup,\x20%s,\x20%s',_0x5cffbc,_0x4ef139[_0x0590('0x16')][_0x0590('0x18')]);return _0x4c9f77(_0x4ef139[_0x0590('0x16')]['message']);}logger[_0x0590('0x16')]('ChatGroup,\x20%s,\x20%s',_0x5cffbc,_0x4ef139[_0x0590('0x16')][_0x0590('0x18')]);return _0x42bfba(_0x4ef139[_0x0590('0x16')][_0x0590('0x18')]);}else{logger[_0x0590('0x19')](_0x0590('0x11'),_0x5cffbc,_0x0590('0x14'));_0x42bfba(_0x4ef139['result']['message']);}})[_0x0590('0x1a')](function(_0x394942){logger['error'](_0x0590('0x11'),_0x5cffbc,_0x394942);_0x4c9f77(_0x394942);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 5e20082..e55bce6 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 _0x90fe=['emit','removeListener','length','chatGroup:','./chatGroup.events','save','remove','update'];(function(_0x31cabf,_0x249573){var _0x1e6e0c=function(_0x44a2c4){while(--_0x44a2c4){_0x31cabf['push'](_0x31cabf['shift']());}};_0x1e6e0c(++_0x249573);}(_0x90fe,0xac));var _0xe90f=function(_0x8ad274,_0x569281){_0x8ad274=_0x8ad274-0x0;var _0x10640c=_0x90fe[_0x8ad274];return _0x10640c;};'use strict';var ChatGroupEvents=require(_0xe90f('0x0'));var events=[_0xe90f('0x1'),_0xe90f('0x2'),_0xe90f('0x3')];function createListener(_0x3ad19d,_0x2a407c){return function(_0x2ad8d6){_0x2a407c[_0xe90f('0x4')](_0x3ad19d,_0x2ad8d6);};}function removeListener(_0x314717,_0x3edbac){return function(){ChatGroupEvents[_0xe90f('0x5')](_0x314717,_0x3edbac);};}exports['register']=function(_0x55881f){for(var _0x56f6fb=0x0,_0x52018e=events[_0xe90f('0x6')];_0x56f6fb<_0x52018e;_0x56f6fb++){var _0x54abf4=events[_0x56f6fb];var _0x33ee7a=createListener(_0xe90f('0x7')+_0x54abf4,_0x55881f);ChatGroupEvents['on'](_0x54abf4,_0x33ee7a);}}; \ No newline at end of file +var _0x1baf=['remove','update','emit','removeListener','register','length','chatGroup:','./chatGroup.events'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x1baf,0x11f));var _0xf1ba=function(_0x51f0e8,_0xb80bf9){_0x51f0e8=_0x51f0e8-0x0;var _0x2949b2=_0x1baf[_0x51f0e8];return _0x2949b2;};'use strict';var ChatGroupEvents=require(_0xf1ba('0x0'));var events=['save',_0xf1ba('0x1'),_0xf1ba('0x2')];function createListener(_0x34256c,_0x124fb1){return function(_0x7d427d){_0x124fb1[_0xf1ba('0x3')](_0x34256c,_0x7d427d);};}function removeListener(_0x4101de,_0x62ba6c){return function(){ChatGroupEvents[_0xf1ba('0x4')](_0x4101de,_0x62ba6c);};}exports[_0xf1ba('0x5')]=function(_0x146b8e){for(var _0x114378=0x0,_0x35e2c7=events[_0xf1ba('0x6')];_0x114378<_0x35e2c7;_0x114378++){var _0x580322=events[_0x114378];var _0x28a69b=createListener(_0xf1ba('0x7')+_0x580322,_0x146b8e);ChatGroupEvents['on'](_0x580322,_0x28a69b);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index a2516bd..d41b50b 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 _0x6a23=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/:id','show','/:id/unread','getMembers','/:id/messages','post','create','/:id/members','addMembers','addMessage'];(function(_0x2b543a,_0x18d0e7){var _0x59f7d8=function(_0x5199fe){while(--_0x5199fe){_0x2b543a['push'](_0x2b543a['shift']());}};_0x59f7d8(++_0x18d0e7);}(_0x6a23,0x12c));var _0x36a2=function(_0x3f1710,_0x3877a2){_0x3f1710=_0x3f1710-0x0;var _0x528458=_0x6a23[_0x3f1710];return _0x528458;};'use strict';var multer=require(_0x36a2('0x0'));var util=require(_0x36a2('0x1'));var path=require(_0x36a2('0x2'));var timeout=require(_0x36a2('0x3'));var express=require(_0x36a2('0x4'));var router=express[_0x36a2('0x5')]();var fs_extra=require(_0x36a2('0x6'));var auth=require(_0x36a2('0x7'));var interaction=require(_0x36a2('0x8'));var config=require(_0x36a2('0x9'));var controller=require(_0x36a2('0xa'));router[_0x36a2('0xb')]('/',auth[_0x36a2('0xc')](),controller[_0x36a2('0xd')]);router[_0x36a2('0xb')]('/describe',auth[_0x36a2('0xc')](),controller['describe']);router[_0x36a2('0xb')](_0x36a2('0xe'),auth[_0x36a2('0xc')](),controller[_0x36a2('0xf')]);router[_0x36a2('0xb')](_0x36a2('0x10'),auth['isAuthenticated'](),controller['getUnread']);router['get']('/:id/members',auth['isAuthenticated'](),controller[_0x36a2('0x11')]);router['get'](_0x36a2('0x12'),auth[_0x36a2('0xc')](),controller['getMessages']);router[_0x36a2('0x13')]('/',auth[_0x36a2('0xc')](),controller[_0x36a2('0x14')]);router[_0x36a2('0x13')](_0x36a2('0x15'),auth[_0x36a2('0xc')](),controller[_0x36a2('0x16')]);router[_0x36a2('0x13')](_0x36a2('0x12'),auth[_0x36a2('0xc')](),controller[_0x36a2('0x17')]);router['put'](_0x36a2('0xe'),auth[_0x36a2('0xc')](),controller[_0x36a2('0x18')]);router['delete'](_0x36a2('0xe'),auth[_0x36a2('0xc')](),controller[_0x36a2('0x19')]);router['delete'](_0x36a2('0x15'),auth[_0x36a2('0xc')](),controller['removeMembers']);module[_0x36a2('0x1a')]=router; \ No newline at end of file +var _0xdd8d=['isAuthenticated','/:id','show','/:id/unread','getUnread','getMembers','/:id/messages','getMessages','create','post','/:id/members','addMembers','addMessage','put','update','delete','destroy','removeMembers','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','index','/describe'];(function(_0x448313,_0x2b5e0f){var _0x3740be=function(_0x130a0d){while(--_0x130a0d){_0x448313['push'](_0x448313['shift']());}};_0x3740be(++_0x2b5e0f);}(_0xdd8d,0x1b6));var _0xddd8=function(_0xc55d64,_0x133f2d){_0xc55d64=_0xc55d64-0x0;var _0x4194f6=_0xdd8d[_0xc55d64];return _0x4194f6;};'use strict';var multer=require(_0xddd8('0x0'));var util=require('util');var path=require(_0xddd8('0x1'));var timeout=require(_0xddd8('0x2'));var express=require(_0xddd8('0x3'));var router=express[_0xddd8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xddd8('0x5'));var interaction=require(_0xddd8('0x6'));var config=require(_0xddd8('0x7'));var controller=require(_0xddd8('0x8'));router[_0xddd8('0x9')]('/',auth['isAuthenticated'](),controller[_0xddd8('0xa')]);router['get'](_0xddd8('0xb'),auth[_0xddd8('0xc')](),controller['describe']);router[_0xddd8('0x9')](_0xddd8('0xd'),auth['isAuthenticated'](),controller[_0xddd8('0xe')]);router[_0xddd8('0x9')](_0xddd8('0xf'),auth[_0xddd8('0xc')](),controller[_0xddd8('0x10')]);router['get']('/:id/members',auth[_0xddd8('0xc')](),controller[_0xddd8('0x11')]);router[_0xddd8('0x9')](_0xddd8('0x12'),auth[_0xddd8('0xc')](),controller[_0xddd8('0x13')]);router['post']('/',auth[_0xddd8('0xc')](),controller[_0xddd8('0x14')]);router[_0xddd8('0x15')](_0xddd8('0x16'),auth['isAuthenticated'](),controller[_0xddd8('0x17')]);router['post']('/:id/messages',auth[_0xddd8('0xc')](),controller[_0xddd8('0x18')]);router[_0xddd8('0x19')](_0xddd8('0xd'),auth[_0xddd8('0xc')](),controller[_0xddd8('0x1a')]);router[_0xddd8('0x1b')](_0xddd8('0xd'),auth['isAuthenticated'](),controller[_0xddd8('0x1c')]);router[_0xddd8('0x1b')](_0xddd8('0x16'),auth[_0xddd8('0xc')](),controller[_0xddd8('0x1d')]);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 2dadf26..50b0188 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 _0xb677=['DATE','STRING','sequelize','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb677,0x119));var _0x7b67=function(_0xc30d17,_0x1151d6){_0xc30d17=_0xc30d17-0x0;var _0x310acf=_0xb677[_0xc30d17];return _0x310acf;};'use strict';var Sequelize=require(_0x7b67('0x0'));module['exports']={'closed':{'type':Sequelize[_0x7b67('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x7b67('0x2')]},'ratingType':{'type':Sequelize[_0x7b67('0x3')](_0x7b67('0x4'),_0x7b67('0x5')),'defaultValue':_0x7b67('0x4')},'ratingMessage':{'type':Sequelize[_0x7b67('0x6')]},'pathTranscript':{'type':Sequelize[_0x7b67('0x6')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x7b67('0x7')]},'disposition':{'type':Sequelize[_0x7b67('0x8')]},'secondDisposition':{'type':Sequelize[_0x7b67('0x8')]},'thirdDisposition':{'type':Sequelize[_0x7b67('0x8')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x7b67('0x8')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x7b67('0x8')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x7b67('0x8')]},'referer':{'type':Sequelize[_0x7b67('0x6')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x7b67('0x6')]('long')},'read1stAt':{'type':Sequelize[_0x7b67('0x7')]},'lastMsgAt':{'type':Sequelize[_0x7b67('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x7b67('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x7b67('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x7b67('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x1cc3=['TEXT','STRING','DATE','long','ENUM','out','BOOLEAN','sequelize','exports','INTEGER','star','thumb'];(function(_0x345866,_0x51daeb){var _0x292df7=function(_0xd26eea){while(--_0xd26eea){_0x345866['push'](_0x345866['shift']());}};_0x292df7(++_0x51daeb);}(_0x1cc3,0x11b));var _0x31cc=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x1cc3[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require(_0x31cc('0x0'));module[_0x31cc('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x31cc('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0x31cc('0x3'),_0x31cc('0x4')),'defaultValue':_0x31cc('0x3')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x31cc('0x5')]},'mailTranscript':{'type':Sequelize[_0x31cc('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x31cc('0x7')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x31cc('0x6')]},'thirdDisposition':{'type':Sequelize[_0x31cc('0x6')]},'note':{'type':Sequelize[_0x31cc('0x6')]},'browserName':{'type':Sequelize[_0x31cc('0x6')]},'browserVersion':{'type':Sequelize[_0x31cc('0x6')]},'osName':{'type':Sequelize[_0x31cc('0x6')]},'osVersion':{'type':Sequelize[_0x31cc('0x6')]},'deviceModel':{'type':Sequelize[_0x31cc('0x6')]},'deviceVendor':{'type':Sequelize[_0x31cc('0x6')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x31cc('0x5')]},'customerIp':{'type':Sequelize[_0x31cc('0x6')]},'formData':{'type':Sequelize[_0x31cc('0x5')](_0x31cc('0x8'))},'read1stAt':{'type':Sequelize[_0x31cc('0x7')]},'lastMsgAt':{'type':Sequelize[_0x31cc('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x31cc('0x9')]('in',_0x31cc('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x31cc('0x6')]},'customerPort':{'type':Sequelize[_0x31cc('0x6')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x31cc('0xb')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 2d74739..4523865 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 _0x0b0e=['closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','Attachment','attachmentDownload','attachId','ChatOfflineMessageId','join','root','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','ChatMessage','Messages','%s%d','agentAlias','customer','Visitor','agentIdentifier','website_alias','System','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','SendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','nolimit','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','includeAgent','spread','chatInteractionTags:save','removeTags','files','tmp','attachments','lastName','Account','Owner','get','mkdirSync','N.A.','browserName','customerIp','customerPort','createReadStream','pipe','createWriteStream','firstName','renderFile','server','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','err','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','http','then','request\x20sent','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','send','merge','body','contact','interaction','account','Users','map','TagIds','split','forEach','Tags','push','index','ChatInteraction','rawAttributes','fieldName','type','name','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','field','color','from','tools_tags','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','isEmpty','where','i.ChatWebsiteId\x20IN\x20?','createdAt','parse','$gte','$lte','null','read','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','role','agent','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','ChatWebsiteId','sequelize','toString','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','all','rows','show','params','filters','includeAll','include','options','create','describe','createVidaooSession','ChatWebsite','findOne','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','fullname','email','POST','isNull','follow','vidaooMetadata','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned'];(function(_0x4e9866,_0x2c16a0){var _0x20b298=function(_0x4f5179){while(--_0x4f5179){_0x4e9866['push'](_0x4e9866['shift']());}};_0x20b298(++_0x2c16a0);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4bd950,_0x184ed5){_0x4bd950=_0x4bd950-0x0;var _0x5dc59a=_0x0b0e[_0x4bd950];return _0x5dc59a;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var pdf=require(_0xe0b0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe0b0('0x14'))(_0xe0b0('0x15'));var utils=require(_0xe0b0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe0b0('0x17'));var db=require(_0xe0b0('0x18'))['db'];config[_0xe0b0('0x19')]=_[_0xe0b0('0x1a')](config[_0xe0b0('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xe0b0('0x1b'))(new Redis(config[_0xe0b0('0x19')]));require(_0xe0b0('0x1c'))[_0xe0b0('0x1d')](socket);var jayson=require(_0xe0b0('0x1e'));var client=jayson['client'][_0xe0b0('0x1f')]({'port':0x232b});var client9004=jayson['client'][_0xe0b0('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0xadee6e,_0x519ae8,_0x11fdca,_0x4a4cc0){return new BPromise(function(_0x2d6fb6,_0x100204){var _0x56bcc7=_0x4a4cc0||client;return _0x56bcc7['request'](_0xadee6e,_0x11fdca)[_0xe0b0('0x20')](function(_0x50a441){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x519ae8,_0xe0b0('0x21'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x519ae8,_0xe0b0('0x21'),JSON['stringify'](_0x50a441));if(_0x50a441[_0xe0b0('0x22')]){if(_0x50a441['error'][_0xe0b0('0x23')]===0x1f4){logger[_0xe0b0('0x22')](_0xe0b0('0x24'),_0x519ae8,_0x50a441[_0xe0b0('0x22')][_0xe0b0('0x25')]);return _0x100204(_0x50a441['error']['message']);}logger[_0xe0b0('0x22')]('ChatInteraction,\x20%s,\x20%s',_0x519ae8,_0x50a441[_0xe0b0('0x22')][_0xe0b0('0x25')]);return _0x2d6fb6(_0x50a441['error'][_0xe0b0('0x25')]);}else{logger['info'](_0xe0b0('0x24'),_0x519ae8,'request\x20sent');_0x2d6fb6(_0x50a441[_0xe0b0('0x26')]['message']);}})[_0xe0b0('0x27')](function(_0x4de537){logger[_0xe0b0('0x22')]('ChatInteraction,\x20%s,\x20%s',_0x519ae8,_0x4de537);_0x100204(_0x4de537);});});}function respondWithStatusCode(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0xcc;return function(_0x362aba){if(_0x362aba){return _0x3c221d[_0xe0b0('0x28')](_0x5c5317);}return _0x3c221d[_0xe0b0('0x29')](_0x5c5317)[_0xe0b0('0x2a')]();};}function respondWithResult(_0x3ec2,_0x10745d){_0x10745d=_0x10745d||0xc8;return function(_0x5200a6){if(_0x5200a6){return _0x3ec2[_0xe0b0('0x29')](_0x10745d)[_0xe0b0('0x2b')](_0x5200a6);}};}function respondWithFilteredResult(_0x5b7a64,_0x15e13b){return function(_0x419b1f){if(_0x419b1f){var _0x36d137=typeof _0x15e13b[_0xe0b0('0x2c')]===_0xe0b0('0x2d')&&typeof _0x15e13b[_0xe0b0('0x2e')]===_0xe0b0('0x2d');var _0x4fb3b7=_0x419b1f[_0xe0b0('0x2f')];var _0x3c0109=_0x36d137?0x0:_0x15e13b['offset'];var _0x4fe400=_0x36d137?_0x419b1f[_0xe0b0('0x2f')]:_0x15e13b[_0xe0b0('0x2c')]+_0x15e13b[_0xe0b0('0x2e')];var _0x3f81d5;if(_0x4fe400>=_0x4fb3b7){_0x4fe400=_0x4fb3b7;_0x3f81d5=0xc8;}else{_0x3f81d5=0xce;}_0x5b7a64[_0xe0b0('0x29')](_0x3f81d5);return _0x5b7a64['set'](_0xe0b0('0x30'),_0x3c0109+'-'+_0x4fe400+'/'+_0x4fb3b7)[_0xe0b0('0x2b')](_0x419b1f);}return null;};}function patchUpdates(_0x7867c4){return function(_0x29d725){try{jsonpatch[_0xe0b0('0x31')](_0x29d725,_0x7867c4,!![]);}catch(_0x4fe835){return BPromise[_0xe0b0('0x32')](_0x4fe835);}return _0x29d725[_0xe0b0('0x33')]();};}function saveUpdates(_0xfc51d3,_0x31c6f5){return function(_0x3575bc){if(_0x3575bc){return _0x3575bc[_0xe0b0('0x34')](_0xfc51d3)[_0xe0b0('0x20')](function(_0x20908f){return _0x20908f;});}return null;};}function removeEntity(_0x2125d5,_0x1dd010){return function(_0xd56467){if(_0xd56467){return _0xd56467[_0xe0b0('0x35')]()[_0xe0b0('0x20')](function(){_0x2125d5[_0xe0b0('0x29')](0xcc)[_0xe0b0('0x2a')]();});}};}function handleEntityNotFound(_0x4cf80c,_0x121608){return function(_0x135be5){if(!_0x135be5){_0x4cf80c[_0xe0b0('0x28')](0x194);}return _0x135be5;};}function handleError(_0x1eb3f9,_0x1a2d24){_0x1a2d24=_0x1a2d24||0x1f4;return function(_0x2c6e60){logger[_0xe0b0('0x22')](_0x2c6e60['stack']);if(_0x2c6e60['name']){delete _0x2c6e60['name'];}_0x1eb3f9['status'](_0x1a2d24)[_0xe0b0('0x36')](_0x2c6e60);};}function getMustacheRender(_0xc3d967,_0xe6f635){return Mustache['render'](_0xc3d967,_[_0xe0b0('0x37')](_0xe6f635[_0xe0b0('0x38')],{'contact':_0xe6f635[_0xe0b0('0x39')],'message':_0xe6f635[_0xe0b0('0x25')],'agent':_0xe6f635['agent'],'interaction':_0xe6f635[_0xe0b0('0x3a')],'account':_0xe6f635[_0xe0b0('0x3b')]}))||'';}function getInteractionUsers(_0x43d352,_0x30dcbb){return new BPromise(function(_0x4265e3,_0x1205db){try{if(_0x30dcbb[_0x43d352['id']]){_0x43d352[_0xe0b0('0x3c')]=_[_0xe0b0('0x3d')](_0x30dcbb[_0x43d352['id']],function(_0xeaffbb){return{'id':_0xeaffbb['id'],'fullname':_0xeaffbb['fullname']};});}}catch(_0x3e349b){_0x1205db(_0x3e349b);}_0x4265e3(_0x43d352);});}function getInteractionTags(_0x54f646,_0x34178d){return new BPromise(function(_0x2d5f47,_0x46c4ea){try{if(_0x54f646[_0xe0b0('0x3e')]){_0x54f646['Tags']=[];_0x54f646[_0xe0b0('0x3e')][_0xe0b0('0x3f')](',')[_0xe0b0('0x40')](function(_0x402a0e){_0x54f646[_0xe0b0('0x41')][_0xe0b0('0x42')](_0x34178d[_0x402a0e]);});}delete _0x54f646[_0xe0b0('0x3e')];}catch(_0x3bde8b){_0x46c4ea(_0x3bde8b);}_0x2d5f47(_0x54f646);});}function updateChatInteraction(_0x52ffe4,_0x2aad80,_0x309bbf){return new BPromise(function(_0x528818,_0x515bd2){return getInteractionUsers(_0x52ffe4,_0x309bbf)[_0xe0b0('0x20')](function(_0x247f8d){return getInteractionTags(_0x247f8d,_0x2aad80);})['then'](function(_0x18a59d){_0x528818(_0x18a59d);})[_0xe0b0('0x27')](function(_0x6bca5c){_0x515bd2(_0x6bca5c);});});}exports[_0xe0b0('0x43')]=function(_0x1a8cc7,_0x5c31b5){var _0x5d2fa2={},_0x51c580={},_0xc3235b={'count':0x0,'rows':[]};var _0x38e715=_['map'](db[_0xe0b0('0x44')][_0xe0b0('0x45')],function(_0x14197b){return{'name':_0x14197b[_0xe0b0('0x46')],'type':_0x14197b[_0xe0b0('0x47')]['key']};});_0x51c580['model']=_[_0xe0b0('0x3d')](_0x38e715,_0xe0b0('0x48'));_0x51c580[_0xe0b0('0x49')]=_[_0xe0b0('0x4a')](_0x1a8cc7[_0xe0b0('0x49')]);_0x51c580['filters']=_[_0xe0b0('0x4b')](_0x51c580[_0xe0b0('0x4c')],_0x51c580['query']);_0x5d2fa2['attributes']=_['intersection'](_0x51c580[_0xe0b0('0x4c')],qs[_0xe0b0('0x4d')](_0x1a8cc7[_0xe0b0('0x49')][_0xe0b0('0x4d')]));_0x5d2fa2['attributes']=_0x5d2fa2[_0xe0b0('0x4e')][_0xe0b0('0x4f')]?_0x5d2fa2['attributes']:_0x51c580['model'];if(!_0x1a8cc7[_0xe0b0('0x49')][_0xe0b0('0x50')]('nolimit')){_0x5d2fa2[_0xe0b0('0x2e')]=qs[_0xe0b0('0x2e')](_0x1a8cc7['query']['limit']);_0x5d2fa2[_0xe0b0('0x2c')]=qs['offset'](_0x1a8cc7[_0xe0b0('0x49')][_0xe0b0('0x2c')]);}_0x5d2fa2[_0xe0b0('0x51')]=qs[_0xe0b0('0x52')](_0x1a8cc7[_0xe0b0('0x49')][_0xe0b0('0x52')]);_0x5d2fa2['where']=qs['filters'](_[_0xe0b0('0x53')](_0x1a8cc7['query'],_0x51c580['filters']),_0x38e715);var _0x249d9a=[];var _0x222174=squel['select']()['field']('id')[_0xe0b0('0x54')](_0xe0b0('0x48'))[_0xe0b0('0x54')](_0xe0b0('0x55'))[_0xe0b0('0x56')](_0xe0b0('0x57'));var _0x84fabb=squel['select']()[_0xe0b0('0x54')]('u.id')[_0xe0b0('0x54')]('u.fullname')['field'](_0xe0b0('0x58'))[_0xe0b0('0x56')](_0xe0b0('0x59'),'ui')[_0xe0b0('0x5a')](_0xe0b0('0x5b'),'u',_0xe0b0('0x5c'));var _0x4548da=squel[_0xe0b0('0x5d')]()[_0xe0b0('0x56')]('chat_interactions','i')[_0xe0b0('0x5a')]('cm_contacts','c',_0xe0b0('0x5e'))[_0xe0b0('0x5a')](_0xe0b0('0x5b'),'o',_0xe0b0('0x5f'))[_0xe0b0('0x5a')](_0xe0b0('0x60'),'a','a.id\x20=\x20i.ChatWebsiteId')[_0xe0b0('0x5a')](_0xe0b0('0x61'),'me',_0xe0b0('0x62'))[_0xe0b0('0x5a')](_0xe0b0('0x63'),'it',_0xe0b0('0x64'))[_0xe0b0('0x5a')](_0xe0b0('0x57'),'t',_0xe0b0('0x65'));var _0xf331df=squel[_0xe0b0('0x66')]();var _0x18ab99=[];var _0xc719d2=squel[_0xe0b0('0x66')]();var _0xcdf97;if(_0x1a8cc7[_0xe0b0('0x49')][_0xe0b0('0x67')]){_0xcdf97=as[_0xe0b0('0x68')](_0x1a8cc7['query'][_0xe0b0('0x67')]);var _0xe7fbac=_0xcdf97[_0xe0b0('0x69')];for(var _0x2f24e6=0x0;_0x2f24e6<_0xcdf97[_0xe0b0('0x6a')][_0xe0b0('0x4f')];_0x2f24e6++){var _0x2bdb59=_0xcdf97['conditions'][_0x2f24e6];var _0x47dcc4='i';var _0x139014=_[_0xe0b0('0x6b')](_0x38e715,[_0xe0b0('0x48'),_0x2bdb59['field']]);if(!_0x139014){switch(_0x2bdb59[_0xe0b0('0x54')]){case _0xe0b0('0x6c'):if(_0x2bdb59[_0xe0b0('0x6d')]==0x1){_0x4548da[_0xe0b0('0x6e')]('`'+_0x2bdb59[_0xe0b0('0x54')]+'`\x20=\x200');}else{_0x4548da[_0xe0b0('0x6e')]('`'+_0x2bdb59[_0xe0b0('0x54')]+_0xe0b0('0x6f'));}break;case'Contact':if(_0x2bdb59[_0xe0b0('0x70')]===_0xe0b0('0x71')){if(_0x2bdb59['value'][_0xe0b0('0x3f')]('\x20')['length']>0x1){_0xf331df[_0xe7fbac]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xe0b0('0x72')](_0x2bdb59['value']),null);}else{var _0x4d75e4='%'+_0x2bdb59[_0xe0b0('0x6d')]+'%';_0xf331df[_0xe7fbac](_0xe0b0('0x73'),_0x4d75e4,_0x4d75e4,_0x4d75e4);}}else{_0x139014=_[_0xe0b0('0x6b')](_0x38e715,[_0xe0b0('0x48'),'ContactId']);_0x2bdb59[_0xe0b0('0x54')]=_0xe0b0('0x74');_0x14da9c=as[_0xe0b0('0x75')](_0x47dcc4,_0x139014[_0xe0b0('0x47')],_0x2bdb59);_0xf331df[_0xe7fbac](_0x14da9c[_0xe0b0('0x76')],_0x14da9c[_0xe0b0('0x6d')][_0xe0b0('0x77')],_0x14da9c[_0xe0b0('0x6d')]['end']);}break;case'Tag':var _0x4b41a=_0x2bdb59[_0xe0b0('0x6d')][_0xe0b0('0x3f')](',')['map'](function(_0x49b754){return Number(_0x49b754);});_0x4b41a[_0xe0b0('0x40')](function(_0x26f36f){_0xc719d2['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x26f36f+',%');});_0x18ab99=_['union'](_0x18ab99,_0x4b41a);break;case _0xe0b0('0x78'):if(_0x2bdb59[_0xe0b0('0x70')]===_0xe0b0('0x71')){_0xf331df[_0xe7fbac](_0xe0b0('0x79'),'%'+_0x2bdb59[_0xe0b0('0x6d')]+'%',null);}else{_0x139014=_[_0xe0b0('0x6b')](_0x38e715,[_0xe0b0('0x48'),_0xe0b0('0x7a')]);_0x2bdb59['field']=_0xe0b0('0x7a');_0x14da9c=as[_0xe0b0('0x75')](_0x47dcc4,_0x139014[_0xe0b0('0x47')],_0x2bdb59);_0xf331df[_0xe7fbac](_0x14da9c['text'],_0x14da9c['value']['start'],_0x14da9c['value']['end']);}break;case'body':_0x14da9c=as[_0xe0b0('0x75')]('me',null,_0x2bdb59);_0xf331df[_0xe7fbac](_0x14da9c['text'],_0x14da9c['value'][_0xe0b0('0x77')],_0x14da9c[_0xe0b0('0x6d')][_0xe0b0('0x2a')]);break;}}else{var _0x14da9c=as[_0xe0b0('0x75')](_0x47dcc4,_0x139014[_0xe0b0('0x47')],_0x2bdb59);_0xf331df[_0xe7fbac](_0x14da9c[_0xe0b0('0x76')],_0x14da9c[_0xe0b0('0x6d')]['start'],_0x14da9c[_0xe0b0('0x6d')][_0xe0b0('0x2a')]);}}}else{var _0x86e90=_(_0x1a8cc7[_0xe0b0('0x49')])[_0xe0b0('0x4a')]()[_0xe0b0('0x3d')](function(_0x16a2ae){return _['some'](_0x38e715,[_0xe0b0('0x48'),_0x16a2ae])?_0x16a2ae:undefined;})['compact']()[_0xe0b0('0x6d')]();if(!_[_0xe0b0('0x7b')](_0x86e90)){_0x86e90[_0xe0b0('0x40')](function(_0x9c7221){if(_0x9c7221==='ChatWebsiteId'){_0x4548da[_0xe0b0('0x7c')](_0xe0b0('0x7d'),[]['concat'](_0x1a8cc7['query'][_0x9c7221]));}else if(_0x9c7221===_0xe0b0('0x7e')){var _0x30adc5=JSON[_0xe0b0('0x7f')](_0x1a8cc7[_0xe0b0('0x49')][_0x9c7221])[_0xe0b0('0x80')];var _0x31dd21=JSON[_0xe0b0('0x7f')](_0x1a8cc7[_0xe0b0('0x49')][_0x9c7221])[_0xe0b0('0x81')];_0x4548da[_0xe0b0('0x7c')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x30adc5,_0x31dd21);}else{if(_0x1a8cc7['query'][_0x9c7221]===_0xe0b0('0x82')){_0x4548da['where']('i.'+_0x9c7221+'\x20IS\x20NULL');}else{_0x4548da['where']('i.'+_0x9c7221+'\x20=\x20?',_0x1a8cc7[_0xe0b0('0x49')][_0x9c7221]);}}});}if(_0x1a8cc7['query'][_0xe0b0('0x83')]){if(_0x1a8cc7[_0xe0b0('0x49')][_0xe0b0('0x83')]==0x1){_0x4548da[_0xe0b0('0x6e')]('`unreadMessages`\x20=\x200');}else{_0x4548da[_0xe0b0('0x6e')](_0xe0b0('0x84'));}}if(_0x1a8cc7['query'][_0xe0b0('0x85')]){_0x18ab99=_[_0xe0b0('0x86')](_0x1a8cc7[_0xe0b0('0x49')][_0xe0b0('0x85')])?_0x1a8cc7[_0xe0b0('0x49')]['tag']:new Array(_0x1a8cc7['query']['tag']);_0x18ab99['forEach'](function(_0x5c258b){_0xc719d2['or'](_0xe0b0('0x87'),'%,'+_0x5c258b+',%');});}if(_0x1a8cc7['query'][_0xe0b0('0x88')]){var _0x5f4aaf=_0x1a8cc7[_0xe0b0('0x49')][_0xe0b0('0x88')][_0xe0b0('0x89')]('\x5c','\x5c\x5c')[_0xe0b0('0x89')](/'/g,'\x27\x27');if(qs[_0xe0b0('0x8a')](_0x5f4aaf)){_0xf331df['or'](_0xe0b0('0x8b'),_0x5f4aaf+'%');}else{_0xf331df['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5f4aaf))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x5f4aaf+'%');}}}_0x4548da['where'](_0xf331df);_0x4548da[_0xe0b0('0x8c')](_0xe0b0('0x8d'));var _0x264363={'type':db[_0xe0b0('0x8e')][_0xe0b0('0x8f')]['SELECT'],'raw':!![]};var _0x234716=_0x4548da[_0xe0b0('0x90')]();_0x234716[_0xe0b0('0x54')](_0xe0b0('0x8d'));_0x234716[_0xe0b0('0x54')](_0xe0b0('0x91'),_0xe0b0('0x6c'));if(_0x5d2fa2[_0xe0b0('0x51')]){_0x5d2fa2[_0xe0b0('0x51')]['forEach'](function(_0x589c47){var _0x6e0e9=_0x589c47[0x0]===_0xe0b0('0x92')?_0x589c47[0x0]:'i.'+_0x589c47[0x0];_0x4548da['order'](_0x6e0e9,_0x589c47[0x1]===_0xe0b0('0x93')?![]:!![]);});}if(!_[_0xe0b0('0x7b')](_0x18ab99)){_0x4548da[_0xe0b0('0x6e')](_0xc719d2);_0x234716[_0xe0b0('0x7c')](_0xe0b0('0x94'),_0x18ab99);}BPromise[_0xe0b0('0x95')]()[_0xe0b0('0x20')](function(){if(!_0xcdf97){if(_0x1a8cc7[_0xe0b0('0x49')]['ChatWebsiteId'])return;_0x234716['where']('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x4548da[_0xe0b0('0x7c')](_0xe0b0('0x96'));return;}if(_0x1a8cc7['user'][_0xe0b0('0x97')]!==_0xe0b0('0x98'))return;return _0x1a8cc7[_0xe0b0('0x99')][_0xe0b0('0x9a')]({'attributes':['id'],'raw':!![]})['then'](function(_0x56c4b9){if(_['isEmpty'](_0x56c4b9)){_0x234716[_0xe0b0('0x7c')](_0xe0b0('0x9b'));_0x4548da['where'](_0xe0b0('0x9b'));}else{_0x234716[_0xe0b0('0x7c')]('i.ChatWebsiteId\x20IN\x20?',_['map'](_0x56c4b9,'id'));_0x4548da[_0xe0b0('0x7c')]('i.ChatWebsiteId\x20IN\x20?',_[_0xe0b0('0x3d')](_0x56c4b9,'id'));}});})['then'](function(){if(_0x1a8cc7[_0xe0b0('0x99')][_0xe0b0('0x97')]===_0xe0b0('0x98')&&!_0xcdf97&&!_0x1a8cc7[_0xe0b0('0x49')][_0xe0b0('0x9c')])return[];return db[_0xe0b0('0x9d')][_0xe0b0('0x49')](_0x234716[_0xe0b0('0x9e')](),_0x264363);})[_0xe0b0('0x20')](function(_0x48497e){_0xc3235b[_0xe0b0('0x2f')]=_0x48497e[_0xe0b0('0x4f')];if(_0xc3235b[_0xe0b0('0x2f')]===0x0)return[];return db['sequelize'][_0xe0b0('0x49')](_0x222174['toString'](),_0x264363)[_0xe0b0('0x20')](function(_0x350c40){_0x249d9a=_['keyBy'](_0x350c40,'id');_0x264363=_[_0xe0b0('0x37')](_0x264363,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1a8cc7['query'][_0xe0b0('0x4d')]){_0x5d2fa2['attributes']['forEach'](function(_0x4f027c){_0x4548da[_0xe0b0('0x54')]('i.'+_0x4f027c);});}else{_0x4548da[_0xe0b0('0x54')](_0xe0b0('0x91'),_0xe0b0('0x6c'));_0x4548da[_0xe0b0('0x54')]('a.key',_0xe0b0('0x9f'));_0x4548da[_0xe0b0('0x54')](_0xe0b0('0xa0'),'Account.mandatoryDisposition');_0x4548da[_0xe0b0('0x54')](_0xe0b0('0xa1'),'contactName');_0x4548da['field'](_0xe0b0('0xa2'));_0x4548da['field'](_0xe0b0('0xa3'),_0xe0b0('0xa4'));_0x4548da[_0xe0b0('0x54')](_0xe0b0('0xa5'),_0xe0b0('0xa6'));_0x4548da[_0xe0b0('0x54')](_0xe0b0('0xa7'),'Contact.email');_0x4548da[_0xe0b0('0x54')](_0xe0b0('0xa8'),_0xe0b0('0xa9'));_0x4548da[_0xe0b0('0x54')](_0xe0b0('0xaa'),'Contact.mobile');_0x4548da['field'](_0xe0b0('0xab'),_0xe0b0('0xac'));_0x4548da[_0xe0b0('0x54')](_0xe0b0('0xad'),_0xe0b0('0xae'));_0x4548da[_0xe0b0('0x54')](_0xe0b0('0xaf'),_0xe0b0('0xb0'));_0x4548da[_0xe0b0('0x54')](_0xe0b0('0xb1'),'TagIds');}if(_0x5d2fa2[_0xe0b0('0x2e')])_0x4548da[_0xe0b0('0x2e')](_0x5d2fa2[_0xe0b0('0x2e')]);if(_0x5d2fa2[_0xe0b0('0x2c')])_0x4548da['offset'](_0x5d2fa2[_0xe0b0('0x2c')]);return db[_0xe0b0('0x9d')][_0xe0b0('0x49')](_0x4548da[_0xe0b0('0x9e')](),_0x264363);})[_0xe0b0('0x20')](function(_0x484cb2){if(_0x484cb2[_0xe0b0('0x4f')]>0x0)_0x84fabb['where'](_0xe0b0('0xb2'),_[_0xe0b0('0x3d')](_0x484cb2,'id'));return db[_0xe0b0('0x9d')][_0xe0b0('0x49')](_0x84fabb[_0xe0b0('0x9e')](),_0x264363)['then'](function(_0x567e42){var _0x3822e4=_['groupBy'](_0x567e42,_0xe0b0('0xb3'));var _0x4c82d6=[];_0x484cb2[_0xe0b0('0x40')](function(_0x474fbb){_0x4c82d6[_0xe0b0('0x42')](updateChatInteraction(_0x474fbb,_0x249d9a,_0x3822e4));});return BPromise[_0xe0b0('0xb4')](_0x4c82d6);});});})[_0xe0b0('0x20')](function(_0x1bb4da){_0xc3235b[_0xe0b0('0xb5')]=_0x1bb4da;return _0xc3235b;})['then'](respondWithFilteredResult(_0x5c31b5,_0x5d2fa2))['catch'](handleError(_0x5c31b5,null));};exports[_0xe0b0('0xb6')]=function(_0x717e74,_0x184938){var _0x20d6bd={'raw':![],'where':{'id':_0x717e74[_0xe0b0('0xb7')]['id']}},_0xd83992={};_0xd83992[_0xe0b0('0x4c')]=_[_0xe0b0('0x4a')](db[_0xe0b0('0x44')][_0xe0b0('0x45')]);_0xd83992['query']=_['keys'](_0x717e74[_0xe0b0('0x49')]);_0xd83992[_0xe0b0('0xb8')]=_[_0xe0b0('0x4b')](_0xd83992[_0xe0b0('0x4c')],_0xd83992[_0xe0b0('0x49')]);_0x20d6bd[_0xe0b0('0x4e')]=_[_0xe0b0('0x4b')](_0xd83992['model'],qs['fields'](_0x717e74[_0xe0b0('0x49')][_0xe0b0('0x4d')]));_0x20d6bd[_0xe0b0('0x4e')]=_0x20d6bd[_0xe0b0('0x4e')][_0xe0b0('0x4f')]?_0x20d6bd[_0xe0b0('0x4e')]:_0xd83992[_0xe0b0('0x4c')];if(_0x717e74[_0xe0b0('0x49')][_0xe0b0('0xb9')]){_0x20d6bd[_0xe0b0('0xba')]=[{'all':!![]}];}_0x20d6bd=_['merge']({},_0x20d6bd,_0x717e74[_0xe0b0('0xbb')]);return db[_0xe0b0('0x44')]['find'](_0x20d6bd)[_0xe0b0('0x20')](handleEntityNotFound(_0x184938,null))[_0xe0b0('0x20')](respondWithResult(_0x184938,null))[_0xe0b0('0x27')](handleError(_0x184938,null));};exports[_0xe0b0('0xbc')]=function(_0x41fdef,_0x594f91){return db[_0xe0b0('0x44')][_0xe0b0('0xbc')](_0x41fdef[_0xe0b0('0x38')],{})[_0xe0b0('0x20')](respondWithResult(_0x594f91,0xc9))[_0xe0b0('0x27')](handleError(_0x594f91,null));};exports['update']=function(_0x475404,_0x58d61b){if(_0x475404[_0xe0b0('0x38')]['id']){delete _0x475404[_0xe0b0('0x38')]['id'];}return db[_0xe0b0('0x44')]['find']({'where':{'id':_0x475404['params']['id']}})[_0xe0b0('0x20')](handleEntityNotFound(_0x58d61b,null))[_0xe0b0('0x20')](saveUpdates(_0x475404[_0xe0b0('0x38')],null))['then'](respondWithResult(_0x58d61b,null))['catch'](handleError(_0x58d61b,null));};exports['destroy']=function(_0x5175e1,_0x57694c){return db['ChatInteraction'][_0xe0b0('0x6b')]({'where':{'id':_0x5175e1[_0xe0b0('0xb7')]['id']}})['then'](handleEntityNotFound(_0x57694c,null))[_0xe0b0('0x20')](removeEntity(_0x57694c,null))[_0xe0b0('0x27')](handleError(_0x57694c,null));};exports[_0xe0b0('0xbd')]=function(_0xd73b8a,_0x437588){return db['ChatInteraction']['describe']()[_0xe0b0('0x20')](respondWithResult(_0x437588,null))[_0xe0b0('0x27')](handleError(_0x437588,null));};exports[_0xe0b0('0xbe')]=function(_0x52dfd8,_0x6ab413){var _0x395083=_0x52dfd8[_0xe0b0('0xb7')]['id'];var _0xd231c4;var _0x35ca4e;var _0x1b8d4a;return db['ChatInteraction']['findOne']({'where':{'id':_0x395083}})['then'](function(_0x1ce027){_0xd231c4=_0x1ce027;return db[_0xe0b0('0xbf')][_0xe0b0('0xc0')]({'where':{'id':_0x1ce027[_0xe0b0('0x9c')]},'attributes':['id',_0xe0b0('0xc1'),_0xe0b0('0xc2'),_0xe0b0('0xc3'),_0xe0b0('0xc4'),'vidaooMetadata'],'raw':!![]});})['then'](function(_0x28ba25){if(_0x28ba25&&_0x28ba25[_0xe0b0('0xc1')]&&_0x28ba25[_0xe0b0('0xc2')]){_0x35ca4e=_0x28ba25;var _0x5451e7={'interaction':{'id':_0x395083},'agent':{'id':_0x52dfd8[_0xe0b0('0x99')]['id'],'name':_0x52dfd8[_0xe0b0('0x99')][_0xe0b0('0x48')],'fullname':_0x52dfd8['user'][_0xe0b0('0xc5')],'email':_0x52dfd8['user'][_0xe0b0('0xc6')]},'contact':_0x52dfd8[_0xe0b0('0x38')][_0xe0b0('0x39')],'account':_0x52dfd8[_0xe0b0('0x38')][_0xe0b0('0x3b')]};var _0x26df60={'rejectUnauthorized':![],'method':_0xe0b0('0xc7'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x28ba25[_0xe0b0('0xc1')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x52dfd8[_0xe0b0('0x99')]['email']],'buttons':null,'topic':_0x35ca4e[_0xe0b0('0xc3')],'note':_[_0xe0b0('0xc8')](_0x35ca4e[_0xe0b0('0xc4')])?null:getMustacheRender(_0x35ca4e['vidaooNote'],_0x5451e7),'metadata':null},'redirect':_0xe0b0('0xc9'),'json':!![]};try{if(!_[_0xe0b0('0xc8')](_0x35ca4e[_0xe0b0('0xca')])){var _0x566a6e=getMustacheRender(_0x35ca4e[_0xe0b0('0xca')],_0x5451e7);var _0x32f67b=JSON[_0xe0b0('0x7f')](_0x566a6e);_0x26df60[_0xe0b0('0x38')][_0xe0b0('0xcb')]=_0x32f67b;}}catch(_0x15be52){throw new db['Sequelize'][(_0xe0b0('0xcc'))](_0xe0b0('0xcd'));}return rp(_0x26df60);}else{throw new db[(_0xe0b0('0x8e'))][(_0xe0b0('0xcc'))](_0xe0b0('0xce'));}})[_0xe0b0('0x20')](function(_0x38b2cf){_0x1b8d4a=_0x38b2cf;if(_0x1b8d4a['id']){var _0x31b01a={'body':_0x1b8d4a[_0xe0b0('0xcf')],'ChatWebsiteId':_0x35ca4e['id'],'ChatInteractionId':_0xd231c4['id'],'direction':_0xe0b0('0xd0'),'UserId':_0x52dfd8[_0xe0b0('0x99')]['id']};return db['ChatMessage'][_0xe0b0('0xbc')](_0x31b01a,{});}else{throw new db['Sequelize']['ValidationError'](_0xe0b0('0xd1'));}})[_0xe0b0('0x20')](function(){return _0xd231c4['updateAttributes']({'vidaooSessionId':_0x1b8d4a['id']});})[_0xe0b0('0x20')](respondWithResult(_0x6ab413,null))[_0xe0b0('0x27')](handleError(_0x6ab413,null));};exports[_0xe0b0('0xd2')]=function(_0x11e969,_0xa18619){if(_0x11e969[_0xe0b0('0x38')]['id']){delete _0x11e969[_0xe0b0('0x38')]['id'];}return db[_0xe0b0('0x44')][_0xe0b0('0x6b')]({'where':{'id':_0x11e969['params']['id']},'include':[{'model':db[_0xe0b0('0xd3')],'as':_0xe0b0('0xd4')}]})[_0xe0b0('0x20')](handleEntityNotFound(_0xa18619,null))[_0xe0b0('0x20')](saveUpdates(_0x11e969['body'],null))['then'](respondWithResult(_0xa18619,null))[_0xe0b0('0x27')](handleError(_0xa18619,null));};exports[_0xe0b0('0xd5')]=function(_0x333c2a,_0x2cd7db,_0x308d03){if(_0x333c2a[_0xe0b0('0x38')]['id']){delete _0x333c2a[_0xe0b0('0x38')]['id'];}return db[_0xe0b0('0x44')][_0xe0b0('0x6b')]({'where':{'id':_0x333c2a[_0xe0b0('0xb7')]['id']}})[_0xe0b0('0x20')](function(_0xaa7a71){if(!_0xaa7a71){logger[_0xe0b0('0x22')](_0xe0b0('0xd6'),_0xe0b0('0xd5'),0x194,_0xe0b0('0xd7'));_0x2cd7db[_0xe0b0('0x28')](0x194);}else{if(_0xaa7a71[_0xe0b0('0x7a')]){throw new db[(_0xe0b0('0x8e'))]['ValidationError'](_0xe0b0('0xd8'));}}return _0xaa7a71;})[_0xe0b0('0x20')](function(_0x36a006){if(_0x36a006){return _0x36a006['update']({'closed':_0x333c2a[_0xe0b0('0x38')][_0xe0b0('0xd9')],'disposition':_0x333c2a[_0xe0b0('0x38')][_0xe0b0('0xda')]})[_0xe0b0('0x20')](function(_0x3532f1){return _0x3532f1;});}})[_0xe0b0('0x20')](function(_0x581ae9){return respondWithRpcPromise(_0xe0b0('0xdb'),'abandon',_0x333c2a[_0xe0b0('0x38')],client9004);})['then'](respondWithResult(_0x2cd7db,null))[_0xe0b0('0x27')](handleError(_0x2cd7db,null));};exports[_0xe0b0('0xdc')]=function(_0x4bd799,_0x2102bc,_0x4f0cbe){_0x4bd799[_0xe0b0('0x38')][_0xe0b0('0x48')]=_0x4bd799[_0xe0b0('0xdd')][_0xe0b0('0xde')];_0x4bd799[_0xe0b0('0x38')][_0xe0b0('0xdf')]=_0x4bd799[_0xe0b0('0xdd')][_0xe0b0('0xe0')];_0x4bd799['body'][_0xe0b0('0x47')]=_0x4bd799['file']['mimetype'];return db[_0xe0b0('0xe1')][_0xe0b0('0xbc')](_0x4bd799[_0xe0b0('0x38')])['then'](respondWithResult(_0x2102bc,0xc9))['catch'](handleError(_0x2102bc,null));};exports[_0xe0b0('0xe2')]=function(_0x3c207e,_0x4fc379,_0x98e7c9){return db[_0xe0b0('0x44')][_0xe0b0('0xc0')]({'where':{'id':_0x3c207e[_0xe0b0('0xb7')]['id']},'raw':!![]})[_0xe0b0('0x20')](handleEntityNotFound(_0x4fc379,null))[_0xe0b0('0x20')](function(_0x4074bb){if(_0x4074bb){if(_0x4074bb[_0xe0b0('0xd9')]){return _0x4fc379[_0xe0b0('0x29')](0x193)['json']({'status':0x193,'message':'Unauthorized'});}return db[_0xe0b0('0xe1')][_0xe0b0('0xc0')]({'where':{'id':_0x3c207e[_0xe0b0('0x49')][_0xe0b0('0xe3')]},'raw':!![]})[_0xe0b0('0x20')](handleEntityNotFound(_0x4fc379,null));}})[_0xe0b0('0x20')](function(_0x54f90a){if(_0x54f90a){var _0x1aa40b=_0x54f90a[_0xe0b0('0xe4')]!==null;var _0x22c8a2=path[_0xe0b0('0xe5')](config[_0xe0b0('0xe6')],'server/files/attachments/');if(_0x1aa40b){_0x22c8a2=path[_0xe0b0('0xe5')](_0x22c8a2,_0xe0b0('0xe7'));}var _0x321b0b=path[_0xe0b0('0xe5')](_0x22c8a2,_0x54f90a[_0xe0b0('0xdf')]);return _0x4fc379[_0xe0b0('0xe8')](_0x321b0b);}})[_0xe0b0('0x27')](handleError(_0x4fc379,null));};exports[_0xe0b0('0xe9')]=function(_0x1ccfc1,_0x2b1474){var _0x574f0a=null;var _0x108371=null;var _0x3f2ec=null;var _0x4f0db7=null;if(_0x1ccfc1[_0xe0b0('0x38')]['id']){delete _0x1ccfc1['body']['id'];}if(_0x1ccfc1[_0xe0b0('0x38')][_0xe0b0('0xea')]){_0x4f0db7=path['join'](config[_0xe0b0('0xe6')],_0xe0b0('0xeb'),util[_0xe0b0('0xec')](_0xe0b0('0xed'),Date[_0xe0b0('0xee')]()));_0x1ccfc1[_0xe0b0('0x38')][_0xe0b0('0xef')]=_0x4f0db7;}return db['ChatInteraction']['find']({'where':{'id':_0x1ccfc1[_0xe0b0('0xb7')]['id']},'include':[{'model':db[_0xe0b0('0xf0')],'as':_0xe0b0('0xf1'),'include':[{'model':db['User'],'as':_0xe0b0('0x78')}]}]})[_0xe0b0('0x20')](handleEntityNotFound(_0x2b1474,null))[_0xe0b0('0x20')](saveUpdates(_0x1ccfc1[_0xe0b0('0x38')],null))[_0xe0b0('0x20')](function(_0x117d00){if(_0x117d00){_0x574f0a=_0x117d00;return db[_0xe0b0('0xbf')][_0xe0b0('0x6b')]({'where':{'id':_0x574f0a[_0xe0b0('0x9c')]}});}})[_0xe0b0('0x20')](function(_0x5aa313){if(_0x5aa313){_0x3f2ec=_0x5aa313;return db['CmContact'][_0xe0b0('0x6b')]({'where':{'id':_0x574f0a[_0xe0b0('0x74')]}});}})[_0xe0b0('0x20')](function(_0x3c93c6){if(_0x3c93c6){_0x108371=_0x3c93c6;if(_0x4f0db7){var _0x203351=null;for(var _0x343409=0x1;_0x343409<_0x574f0a[_0xe0b0('0xf1')]['length'];++_0x343409){_0x203351=_0x574f0a[_0xe0b0('0xf1')][_0x343409];var _0x2e7fe2=_0x203351[_0xe0b0('0x7a')]?util['format'](_0xe0b0('0xf2'),_0x3f2ec[_0xe0b0('0xf3')],_0x203351['UserId']):'System';var _0x3b3473=_0x1ccfc1['body'][_0xe0b0('0xf4')]||util['format'](_0xe0b0('0xf2'),_0xe0b0('0xf5'),_0x203351['ContactId']);switch(_0x3f2ec[_0xe0b0('0xf6')]){case _0xe0b0('0xf7'):_0x2e7fe2=_0x203351['UserId']?util[_0xe0b0('0xec')]('%s%d',_0x3f2ec[_0xe0b0('0xf3')],_0x203351[_0xe0b0('0x7a')]):_0xe0b0('0xf8');break;case _0xe0b0('0xf9'):_0x2e7fe2=_0x203351[_0xe0b0('0x7a')]?_0x203351[_0xe0b0('0x78')][_0xe0b0('0xfa')]||_0x203351['User'][_0xe0b0('0xc5')]:_0xe0b0('0xf8');break;case'agent_fullname':_0x2e7fe2=_0x203351['UserId']?_0x203351[_0xe0b0('0x78')]['fullname']:_0xe0b0('0xf8');break;default:_0x2e7fe2=_0x203351[_0xe0b0('0x7a')]?util[_0xe0b0('0xec')](_0xe0b0('0xf2'),_0x3f2ec[_0xe0b0('0xf3')],_0x203351[_0xe0b0('0x7a')]):_0xe0b0('0xf8');}var _0x8364b0=util[_0xe0b0('0xec')](_0xe0b0('0xfb'),moment(_0x203351[_0xe0b0('0x7e')])[_0xe0b0('0xec')](_0xe0b0('0xfc')),_0x203351[_0xe0b0('0xfd')]==='in'?_0x3b3473:_0x2e7fe2,_0x203351['body']);if(!_0x203351[_0xe0b0('0xfe')]){fs[_0xe0b0('0xff')](_0x4f0db7,_0x8364b0);}}return db[_0xe0b0('0x100')][_0xe0b0('0xc0')]({'where':{'service':!![]},'include':[{'model':db[_0xe0b0('0x101')],'as':'Smtp','raw':!![]}]});}}})[_0xe0b0('0x20')](function(_0x3a75d8){if(_0x3a75d8&&_0x3a75d8[_0xe0b0('0x102')]&&_0x1ccfc1[_0xe0b0('0x38')]){var _0x1e2ef8={'tls':{'rejectUnauthorized':![]}};if(_0x3a75d8[_0xe0b0('0x102')]['service']){_0x1e2ef8[_0xe0b0('0x103')]=_0x3a75d8['Smtp'][_0xe0b0('0x103')];}else{_0x1e2ef8[_0xe0b0('0x104')]=_0x3a75d8[_0xe0b0('0x102')][_0xe0b0('0x104')];_0x1e2ef8[_0xe0b0('0x105')]=_0x3a75d8[_0xe0b0('0x102')]['port'];_0x1e2ef8[_0xe0b0('0x106')]=_0x3a75d8[_0xe0b0('0x102')][_0xe0b0('0x106')];}if(_0x3a75d8[_0xe0b0('0x102')][_0xe0b0('0x107')]){_0x1e2ef8[_0xe0b0('0x108')]={'user':_0x3a75d8[_0xe0b0('0x102')][_0xe0b0('0x99')],'pass':_0x3a75d8['Smtp']['pass']};}return respondWithRpcPromise(_0xe0b0('0x109'),'sendMail',{'account':_0x1e2ef8,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x3a75d8['name'],_0x3a75d8[_0xe0b0('0xc6')]||_0x3a75d8['Smtp']['user']),'to':_0x1ccfc1[_0xe0b0('0x38')][_0xe0b0('0xea')],'subject':_0xe0b0('0x10a'),'text':util[_0xe0b0('0xec')](_0xe0b0('0x10b'),_0x1ccfc1[_0xe0b0('0x38')][_0xe0b0('0xea')]),'attachments':[{'path':_0x4f0db7}]}})[_0xe0b0('0x20')](function(){return _0x574f0a;})[_0xe0b0('0x27')](function(_0x43f1b1){console['error'](_0x43f1b1);});}else{return _0x574f0a;}})['then'](respondWithStatusCode(_0x2b1474,0xc8))[_0xe0b0('0x27')](handleError(_0x2b1474,null));};exports[_0xe0b0('0x10c')]=function(_0x2b8a03,_0x4f784a,_0x4b5a48){return db[_0xe0b0('0xf0')]['find']({'where':{'id':_0x2b8a03[_0xe0b0('0xb7')]['id']}})[_0xe0b0('0x20')](handleEntityNotFound(_0x4f784a,null))['then'](function(_0x2e393e){if(_0x2e393e){return _0x2e393e[_0xe0b0('0x10c')](_0x2b8a03[_0xe0b0('0x38')][_0xe0b0('0x10d')],_[_0xe0b0('0x10e')](_0x2b8a03[_0xe0b0('0x38')],[_0xe0b0('0x10d'),'id'])||{});}})['then'](respondWithResult(_0x4f784a,null))[_0xe0b0('0x27')](handleError(_0x4f784a,null));};exports[_0xe0b0('0x10f')]=function(_0x1f3162,_0x22da3a,_0x2b2c68){var _0x5c5c2d={'raw':![],'where':{}};var _0x4d6429={};var _0x322d1b={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x1f3162[_0xe0b0('0xb7')]['id']}})['then'](handleEntityNotFound(_0x22da3a,null))[_0xe0b0('0x20')](function(_0x151da2){if(_0x151da2){_0x4d6429[_0xe0b0('0x4c')]=_[_0xe0b0('0x4a')](db['ChatMessage']['rawAttributes']);_0x4d6429[_0xe0b0('0x49')]=_[_0xe0b0('0x4a')](_0x1f3162[_0xe0b0('0x49')]);_0x4d6429[_0xe0b0('0xb8')]=_[_0xe0b0('0x4b')](_0x4d6429[_0xe0b0('0x4c')],_0x4d6429[_0xe0b0('0x49')]);_0x5c5c2d[_0xe0b0('0x4e')]=_['intersection'](_0x4d6429[_0xe0b0('0x4c')],qs[_0xe0b0('0x4d')](_0x1f3162[_0xe0b0('0x49')]['fields']));_0x5c5c2d[_0xe0b0('0x4e')]=_0x5c5c2d[_0xe0b0('0x4e')][_0xe0b0('0x4f')]?_0x5c5c2d[_0xe0b0('0x4e')]:_0x4d6429[_0xe0b0('0x4c')];if(!_0x1f3162[_0xe0b0('0x49')]['hasOwnProperty'](_0xe0b0('0x110'))){_0x5c5c2d[_0xe0b0('0x2e')]=qs[_0xe0b0('0x2e')](_0x1f3162['query'][_0xe0b0('0x2e')]);_0x5c5c2d[_0xe0b0('0x2c')]=qs[_0xe0b0('0x2c')](_0x1f3162[_0xe0b0('0x49')]['offset']);}_0x5c5c2d[_0xe0b0('0x51')]=qs[_0xe0b0('0x52')](_0x1f3162[_0xe0b0('0x49')][_0xe0b0('0x52')]);_0x5c5c2d[_0xe0b0('0x7c')]=qs[_0xe0b0('0xb8')](_[_0xe0b0('0x53')](_0x1f3162[_0xe0b0('0x49')],_0x4d6429['filters']));_0x5c5c2d[_0xe0b0('0x7c')]['ChatInteractionId']=_0x151da2['id'];if(_0x1f3162['query'][_0xe0b0('0x88')]){_0x5c5c2d[_0xe0b0('0x7c')]=_[_0xe0b0('0x37')](_0x5c5c2d['where'],{'$or':_[_0xe0b0('0x3d')](_0x5c5c2d['attributes'],function(_0xf0c217){var _0x4c5406={};_0x4c5406[_0xf0c217]={'$like':'%'+_0x1f3162['query']['filter']+'%'};return _0x4c5406;})});}if(_0x1f3162[_0xe0b0('0x49')][_0xe0b0('0x80')]){var _0x55e013=_0x1f3162[_0xe0b0('0x49')]['$gte']['split'](',');var _0x31fa9d={};_0x31fa9d[_0x55e013[0x0]]={'$gte':moment(_0x55e013[0x1])['format'](_0xe0b0('0x111'))};_0x5c5c2d[_0xe0b0('0x7c')]=_[_0xe0b0('0x37')](_0x5c5c2d[_0xe0b0('0x7c')],_0x31fa9d);}_0x5c5c2d=_['merge']({},_0x5c5c2d,_0x1f3162[_0xe0b0('0xbb')]);return db[_0xe0b0('0xf0')][_0xe0b0('0x2f')]({'where':_0x5c5c2d[_0xe0b0('0x7c')]})[_0xe0b0('0x20')](function(_0x51600e){_0x322d1b[_0xe0b0('0x2f')]=_0x51600e;if(_0x1f3162[_0xe0b0('0x49')]['includeAll']){_0x5c5c2d[_0xe0b0('0xba')]=[{'all':!![]}];}return db['ChatMessage'][_0xe0b0('0x112')](_0x5c5c2d);})[_0xe0b0('0x20')](function(_0x1e0374){_0x322d1b[_0xe0b0('0xb5')]=_0x1e0374;return _0x322d1b;});}})[_0xe0b0('0x20')](respondWithFilteredResult(_0x22da3a,_0x5c5c2d))[_0xe0b0('0x27')](handleError(_0x22da3a,null));};exports[_0xe0b0('0x113')]=function(_0x5b7b02,_0x565f67,_0x2853bf){var _0x4c0d9d={'where':{}},_0x38dd79={},_0x2dc446={'count':0x0,'rows':[]};return db[_0xe0b0('0x44')][_0xe0b0('0xc0')]({'where':{'id':_0x5b7b02[_0xe0b0('0xb7')]['id']}})[_0xe0b0('0x20')](handleEntityNotFound(_0x565f67,null))['then'](function(_0x5996a6){if(_0x5996a6){_0x38dd79[_0xe0b0('0x4c')]=_[_0xe0b0('0x4a')](db['ChatMessage'][_0xe0b0('0x45')]);_0x38dd79[_0xe0b0('0x49')]=_['keys'](_0x5b7b02[_0xe0b0('0x49')]);_0x38dd79[_0xe0b0('0xb8')]=_[_0xe0b0('0x4b')](_0x38dd79['model'],_0x38dd79[_0xe0b0('0x49')]);_0x4c0d9d[_0xe0b0('0x4e')]=_[_0xe0b0('0x4b')](_0x38dd79[_0xe0b0('0x4c')],qs['fields'](_0x5b7b02[_0xe0b0('0x49')]['fields']));_0x4c0d9d[_0xe0b0('0x4e')]=_0x4c0d9d[_0xe0b0('0x4e')][_0xe0b0('0x4f')]?_0x4c0d9d['attributes']:_0x38dd79[_0xe0b0('0x4c')];if(!_0x5b7b02[_0xe0b0('0x49')][_0xe0b0('0x50')](_0xe0b0('0x110'))){_0x4c0d9d['limit']=qs[_0xe0b0('0x2e')](_0x5b7b02[_0xe0b0('0x49')][_0xe0b0('0x2e')]);_0x4c0d9d[_0xe0b0('0x2c')]=qs[_0xe0b0('0x2c')](_0x5b7b02[_0xe0b0('0x49')]['offset']);}_0x4c0d9d['order']=qs['sort'](_0x5b7b02[_0xe0b0('0x49')]['sort']);_0x4c0d9d[_0xe0b0('0x7c')]=qs['filters'](_['pick'](_0x5b7b02[_0xe0b0('0x49')],_0x38dd79[_0xe0b0('0xb8')]));_0x4c0d9d[_0xe0b0('0x7c')][_0xe0b0('0xb3')]=_0x5996a6['id'];if(_0x5b7b02[_0xe0b0('0x49')][_0xe0b0('0x88')]){_0x4c0d9d[_0xe0b0('0x7c')]=_['merge'](_0x4c0d9d[_0xe0b0('0x7c')],{'$or':_[_0xe0b0('0x3d')](_0x4c0d9d[_0xe0b0('0x4e')],function(_0x15033e){var _0x14ba21={};_0x14ba21[_0x15033e]={'$like':'%'+_0x5b7b02[_0xe0b0('0x49')]['filter']+'%'};return _0x14ba21;})});}_0x4c0d9d['where'][_0xe0b0('0xfe')]=![];if(_0x5b7b02[_0xe0b0('0x49')]['id']){_0x4c0d9d[_0xe0b0('0x7c')]['id']={'$gt':_0x5b7b02[_0xe0b0('0x49')]['id']};}_0x4c0d9d=_[_0xe0b0('0x37')]({},_0x4c0d9d,_0x5b7b02[_0xe0b0('0xbb')]);return db[_0xe0b0('0xf0')]['count']({'where':_0x4c0d9d['where']})[_0xe0b0('0x20')](function(_0x16386b){_0x2dc446[_0xe0b0('0x2f')]=_0x16386b;_0x4c0d9d['include']=[];if(_0x5b7b02['query'][_0xe0b0('0x114')]){_0x4c0d9d[_0xe0b0('0xba')][_0xe0b0('0x42')]({'model':db[_0xe0b0('0x78')],'as':_0xe0b0('0x78'),'attributes':['id',_0xe0b0('0xc5'),_0xe0b0('0xfa')]});}if(_0x5b7b02[_0xe0b0('0x49')][_0xe0b0('0xb9')]){_0x4c0d9d[_0xe0b0('0xba')]=[{'all':!![]}];}return db['ChatMessage'][_0xe0b0('0x112')](_0x4c0d9d);})['then'](function(_0x2df3df){_0x2dc446['rows']=_0x2df3df;return _0x2dc446;});}})[_0xe0b0('0x20')](respondWithFilteredResult(_0x565f67,_0x4c0d9d))[_0xe0b0('0x27')](handleError(_0x565f67,null));};exports['addTags']=function(_0x236966,_0x41fd0e,_0x17e7d4){return db['ChatInteraction'][_0xe0b0('0x6b')]({'where':{'id':_0x236966[_0xe0b0('0xb7')]['id']}})['then'](handleEntityNotFound(_0x41fd0e,null))[_0xe0b0('0x20')](function(_0x19dafb){if(_0x19dafb){return _0x19dafb['setTags'](_0x236966['body'][_0xe0b0('0x10d')],_[_0xe0b0('0x10e')](_0x236966['body'],['ids','id'])||{})[_0xe0b0('0x115')](function(){return db['Tag'][_0xe0b0('0x112')]({'attributes':['id',_0xe0b0('0x48'),_0xe0b0('0x55')],'where':{'id':_0x236966[_0xe0b0('0x38')][_0xe0b0('0x10d')]}});})[_0xe0b0('0x20')](function(_0x36106e){socket['emit'](_0xe0b0('0x116'),{'id':Number(_0x236966['params']['id']),'tags':_0x36106e||[]});return{'id':Number(_0x236966['params']['id']),'tags':_0x36106e||[]};});}})['then'](respondWithResult(_0x41fd0e,null))[_0xe0b0('0x27')](handleError(_0x41fd0e,null));};exports[_0xe0b0('0x117')]=function(_0x263288,_0x7117ca,_0x21ccfe){return db['ChatInteraction']['find']({'where':{'id':_0x263288['params']['id']}})['then'](handleEntityNotFound(_0x7117ca,null))[_0xe0b0('0x20')](function(_0x1bd420){if(_0x1bd420){return _0x1bd420[_0xe0b0('0x117')](_0x263288['query'][_0xe0b0('0x10d')]);}})[_0xe0b0('0x20')](respondWithStatusCode(_0x7117ca,null))[_0xe0b0('0x27')](handleError(_0x7117ca,null));};exports[_0xe0b0('0xe8')]=function(_0x2d2852,_0x16a02b){var _0x125ead=moment()['unix']()[_0xe0b0('0x9e')]();var _0x380fe1=path[_0xe0b0('0xe5')](config[_0xe0b0('0xe6')],'server',_0xe0b0('0x118'),_0xe0b0('0x119'));var _0x3eb643=path[_0xe0b0('0xe5')](config['root'],'server',_0xe0b0('0x118'),_0xe0b0('0x11a'));var _0x26bd6c=path[_0xe0b0('0xe5')](_0x380fe1,_0x125ead);var _0x104409=util[_0xe0b0('0xec')]('transcript-%d-%s.zip',_0x2d2852[_0xe0b0('0xb7')]['id'],_0x125ead);var _0x6f9dbd=path[_0xe0b0('0xe5')](_0x380fe1,_0x104409);var _0x4c6646=[];_0x4c6646[_0xe0b0('0x42')]({'model':db['User'],'as':_0xe0b0('0x78'),'attributes':['id',_0xe0b0('0xc5')],'raw':!![]});_0x4c6646['push']({'model':db[_0xe0b0('0xd3')],'as':'Contact','attributes':['id','firstName',_0xe0b0('0x11b')],'raw':!![]});if(_0x2d2852['query']['attachments']){_0x4c6646['push']({'model':db[_0xe0b0('0xe1')],'as':_0xe0b0('0xe1'),'raw':!![]});}var _0x573ca9=[{'model':db[_0xe0b0('0xf0')],'as':'Messages','attributes':['id',_0xe0b0('0x38'),_0xe0b0('0x7e'),_0xe0b0('0xfd'),_0xe0b0('0xfe'),'read'],'include':_0x4c6646}];_0x573ca9['push']({'model':db['ChatWebsite'],'as':_0xe0b0('0x11c'),'attributes':['id',_0xe0b0('0x48')]});_0x573ca9['push']({'model':db['User'],'as':_0xe0b0('0x11d'),'attributes':['id',_0xe0b0('0xc5')]});return db[_0xe0b0('0x44')][_0xe0b0('0x6b')]({'where':{'id':_0x2d2852['params']['id']},'include':_0x573ca9})['then'](handleEntityNotFound(_0x16a02b,null))[_0xe0b0('0x20')](function(_0x329684){if(_0x329684){var _0x5b1bb7=_0x329684[_0xe0b0('0x11e')]({'plain':!![]});fs[_0xe0b0('0x11f')](_0x26bd6c);var _0x5b7df1={'channel':'Chat','account':_0x5b1bb7['Account'][_0xe0b0('0x48')],'agent':_0x5b1bb7[_0xe0b0('0x11d')]?_0x5b1bb7['Owner'][_0xe0b0('0xc5')]:_0xe0b0('0x120'),'createdAt':moment(_0x5b1bb7[_0xe0b0('0x7e')])[_0xe0b0('0xec')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe0b0('0x9e')](),'closedAt':_0x5b1bb7[_0xe0b0('0xd9')]?moment(_0x5b1bb7['closedAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xe0b0('0x9e')]():'','disposition':_0x5b1bb7['disposition'],'chatInfo':{'browser':_0x5b1bb7[_0xe0b0('0x121')],'os':_0x5b1bb7['osName'],'referer':_0x5b1bb7['referer'],'customerIp':_0x5b1bb7[_0xe0b0('0x122')],'customerPort':_0x5b1bb7[_0xe0b0('0x123')]?_0x5b1bb7[_0xe0b0('0x123')]:_0xe0b0('0x120')},'messages':_(_0x5b1bb7['Messages'])['tail']()['filter']({'secret':![]})['map'](function(_0x26a916){if(_0x26a916[_0xe0b0('0xe1')]){var _0x5b5bb2=path['join'](_0x3eb643,_0x26a916[_0xe0b0('0xe1')][_0xe0b0('0xdf')]);if(fs['existsSync'](_0x5b5bb2)){fs[_0xe0b0('0x124')](_0x5b5bb2)[_0xe0b0('0x125')](fs[_0xe0b0('0x126')](path[_0xe0b0('0xe5')](_0x26bd6c,_0x26a916['Attachment'][_0xe0b0('0xdf')])));}}return{'date':moment(_0x26a916[_0xe0b0('0x7e')])[_0xe0b0('0xec')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe0b0('0x9e')](),'sender':_0x26a916[_0xe0b0('0xfd')]===_0xe0b0('0xd0')?_0x26a916[_0xe0b0('0x78')]?_0x26a916['User'][_0xe0b0('0xc5')]:_0xe0b0('0xf8'):_0x26a916[_0xe0b0('0xd4')][_0xe0b0('0x127')]+(_0x26a916[_0xe0b0('0xd4')]['lastName']?'\x20'+_0x26a916[_0xe0b0('0xd4')][_0xe0b0('0x11b')]:''),'body':_0x26a916['Attachment']?_0x26a916[_0xe0b0('0xe1')][_0xe0b0('0xdf')]:_0x26a916[_0xe0b0('0x38')],'direction':_0x26a916[_0xe0b0('0xfd')]===_0xe0b0('0xd0')?'A':'C','secret':_0x26a916[_0xe0b0('0xfe')],'read':_0x26a916['read'],'attachment':_0x26a916[_0xe0b0('0xe1')]};})[_0xe0b0('0x6d')]()};return ejs[_0xe0b0('0x128')](path[_0xe0b0('0xe5')](config[_0xe0b0('0xe6')],_0xe0b0('0x129'),_0xe0b0('0x12a'),_0xe0b0('0x12b')),{'interaction':_0x5b7df1})[_0xe0b0('0x20')](function(_0x1f5871){var _0x4d12b2=path[_0xe0b0('0xe5')](_0x26bd6c,'transcript-'+_0x5b1bb7['id']+'-'+_0x125ead+_0xe0b0('0x12c'));var _0x4b655d={'path':_0x4d12b2,'channel':'Chat','interactionId':_0x5b1bb7['id']};return pdf[_0xe0b0('0x12d')](_0x1f5871,_0x4b655d);})[_0xe0b0('0x20')](function(){return new BPromise(function(_0x5b8cef,_0x4d4eae){zipdir(_0x26bd6c,{'saveTo':_0x6f9dbd},function(_0x388f0d,_0x317dee){if(_0x388f0d)return _0x4d4eae(_0x388f0d);return _0x5b8cef(_0x317dee);});})['then'](function(){return new BPromise(function(_0x5501c2,_0xa7f2cf){rimraf(_0x26bd6c,function(_0x2c61b3){if(_0x2c61b3)_0xa7f2cf(_0x2c61b3);return _0x5501c2();});});})['then'](function(){return _0x16a02b[_0xe0b0('0xe8')](_0x6f9dbd,_0x104409,function(_0x465315){if(_0x465315){console[_0xe0b0('0x12e')](_0xe0b0('0x12f'),_0x465315);}else{fs['unlinkSync'](_0x6f9dbd);}});});});}else{return _0x16a02b[_0xe0b0('0x28')](0xc8);}})[_0xe0b0('0x27')](handleError(_0x16a02b,null));}; \ No newline at end of file +var _0xb10b=['querystring','papaparse','ioredis','../../components/auth/service','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','reject','update','stack','name','send','body','contact','interaction','account','Users','map','fullname','TagIds','Tags','forEach','push','index','ChatInteraction','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','value','having','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','buildExpression','some','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','isEmpty','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','agent','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','catch','show','params','keys','includeAll','include','options','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooNote','email','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','isNull','follow','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','AbandonInteraction','attachmentUpload','file','filename','mimetype','attachmentDownload','closed','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','basename','close','mailTranscript','root','now','Messages','format','%s%d','System','customer','Visitor','agentIdentifier','website_alias','agentAlias','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','sendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','ids','omit','getMessages','split','YYYY-MM-DD\x20HH:mm:ss','includeAgent','alias','findAll','setTags','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','Contact','firstName','lastName','Account','Owner','get','mkdirSync','Chat','N.A.','disposition','osName','referer','customerPort','tail','existsSync','pipe','createWriteStream','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x5db59c,_0x11cc79){var _0x2a1f41=function(_0x35cfa4){while(--_0x35cfa4){_0x5db59c['push'](_0x5db59c['shift']());}};_0x2a1f41(++_0x11cc79);}(_0xb10b,0x12a));var _0xbb10=function(_0x5aabcb,_0x219fbd){_0x5aabcb=_0x5aabcb-0x0;var _0x4b6e71=_0xb10b[_0x5aabcb];return _0x4b6e71;};'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 pdf=require(_0xbb10('0x13'));var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))('api');var utils=require(_0xbb10('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb10('0x17'));var db=require(_0xbb10('0x18'))['db'];config[_0xbb10('0x19')]=_[_0xbb10('0x1a')](config[_0xbb10('0x19')],{'host':_0xbb10('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbb10('0x19')]));require(_0xbb10('0x1c'))[_0xbb10('0x1d')](socket);var jayson=require(_0xbb10('0x1e'));var client=jayson[_0xbb10('0x1f')][_0xbb10('0x20')]({'port':0x232b});var client9004=jayson[_0xbb10('0x1f')][_0xbb10('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x3e26f4,_0x2b184e,_0x4a2bfc,_0x2eca0f){return new BPromise(function(_0x1145f1,_0x133ac2){var _0x42db98=_0x2eca0f||client;return _0x42db98[_0xbb10('0x21')](_0x3e26f4,_0x4a2bfc)[_0xbb10('0x22')](function(_0x575cca){logger[_0xbb10('0x23')](_0xbb10('0x24'),_0x2b184e,_0xbb10('0x25'));logger['debug'](_0xbb10('0x26'),_0x2b184e,_0xbb10('0x25'),JSON[_0xbb10('0x27')](_0x575cca));if(_0x575cca[_0xbb10('0x28')]){if(_0x575cca[_0xbb10('0x28')][_0xbb10('0x29')]===0x1f4){logger['error'](_0xbb10('0x24'),_0x2b184e,_0x575cca[_0xbb10('0x28')]['message']);return _0x133ac2(_0x575cca['error'][_0xbb10('0x2a')]);}logger[_0xbb10('0x28')](_0xbb10('0x24'),_0x2b184e,_0x575cca[_0xbb10('0x28')][_0xbb10('0x2a')]);return _0x1145f1(_0x575cca[_0xbb10('0x28')][_0xbb10('0x2a')]);}else{logger[_0xbb10('0x23')](_0xbb10('0x24'),_0x2b184e,_0xbb10('0x25'));_0x1145f1(_0x575cca[_0xbb10('0x2b')][_0xbb10('0x2a')]);}})['catch'](function(_0x4fedac){logger['error'](_0xbb10('0x24'),_0x2b184e,_0x4fedac);_0x133ac2(_0x4fedac);});});}function respondWithStatusCode(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0xcc;return function(_0x4e25ff){if(_0x4e25ff){return _0x3c5ae7[_0xbb10('0x2c')](_0x2c89b9);}return _0x3c5ae7[_0xbb10('0x2d')](_0x2c89b9)[_0xbb10('0x2e')]();};}function respondWithResult(_0x1d5e95,_0x1acce9){_0x1acce9=_0x1acce9||0xc8;return function(_0x20d946){if(_0x20d946){return _0x1d5e95[_0xbb10('0x2d')](_0x1acce9)['json'](_0x20d946);}};}function respondWithFilteredResult(_0x3796c7,_0x21ac54){return function(_0xfc3595){if(_0xfc3595){var _0x2e0249=typeof _0x21ac54[_0xbb10('0x2f')]===_0xbb10('0x30')&&typeof _0x21ac54['limit']===_0xbb10('0x30');var _0x4ee02e=_0xfc3595[_0xbb10('0x31')];var _0x56f2da=_0x2e0249?0x0:_0x21ac54[_0xbb10('0x2f')];var _0x1dcc9c=_0x2e0249?_0xfc3595[_0xbb10('0x31')]:_0x21ac54['offset']+_0x21ac54['limit'];var _0x4c3744;if(_0x1dcc9c>=_0x4ee02e){_0x1dcc9c=_0x4ee02e;_0x4c3744=0xc8;}else{_0x4c3744=0xce;}_0x3796c7[_0xbb10('0x2d')](_0x4c3744);return _0x3796c7['set'](_0xbb10('0x32'),_0x56f2da+'-'+_0x1dcc9c+'/'+_0x4ee02e)[_0xbb10('0x33')](_0xfc3595);}return null;};}function patchUpdates(_0x2f653f){return function(_0x1c0b57){try{jsonpatch[_0xbb10('0x34')](_0x1c0b57,_0x2f653f,!![]);}catch(_0x138bc6){return BPromise[_0xbb10('0x35')](_0x138bc6);}return _0x1c0b57['save']();};}function saveUpdates(_0x25acb3,_0x1da9c9){return function(_0x441d15){if(_0x441d15){return _0x441d15[_0xbb10('0x36')](_0x25acb3)[_0xbb10('0x22')](function(_0x9de708){return _0x9de708;});}return null;};}function removeEntity(_0x188cbd,_0x10202c){return function(_0x3c8d7d){if(_0x3c8d7d){return _0x3c8d7d['destroy']()[_0xbb10('0x22')](function(){_0x188cbd[_0xbb10('0x2d')](0xcc)[_0xbb10('0x2e')]();});}};}function handleEntityNotFound(_0x3c3c45,_0x570f5a){return function(_0x111762){if(!_0x111762){_0x3c3c45['sendStatus'](0x194);}return _0x111762;};}function handleError(_0x4e2754,_0x3eb3cc){_0x3eb3cc=_0x3eb3cc||0x1f4;return function(_0x40c164){logger[_0xbb10('0x28')](_0x40c164[_0xbb10('0x37')]);if(_0x40c164[_0xbb10('0x38')]){delete _0x40c164[_0xbb10('0x38')];}_0x4e2754['status'](_0x3eb3cc)[_0xbb10('0x39')](_0x40c164);};}function getMustacheRender(_0x25d72f,_0x52de31){return Mustache['render'](_0x25d72f,_['merge'](_0x52de31[_0xbb10('0x3a')],{'contact':_0x52de31[_0xbb10('0x3b')],'message':_0x52de31[_0xbb10('0x2a')],'agent':_0x52de31['agent'],'interaction':_0x52de31[_0xbb10('0x3c')],'account':_0x52de31[_0xbb10('0x3d')]}))||'';}function getInteractionUsers(_0x4345f3,_0x4d1a83){return new BPromise(function(_0x17b6c5,_0x12238a){try{if(_0x4d1a83[_0x4345f3['id']]){_0x4345f3[_0xbb10('0x3e')]=_[_0xbb10('0x3f')](_0x4d1a83[_0x4345f3['id']],function(_0x4f1cdd){return{'id':_0x4f1cdd['id'],'fullname':_0x4f1cdd[_0xbb10('0x40')]};});}}catch(_0x110eb5){_0x12238a(_0x110eb5);}_0x17b6c5(_0x4345f3);});}function getInteractionTags(_0x5835fd,_0xe2040f){return new BPromise(function(_0x2e3214,_0x44d6ae){try{if(_0x5835fd[_0xbb10('0x41')]){_0x5835fd[_0xbb10('0x42')]=[];_0x5835fd[_0xbb10('0x41')]['split'](',')[_0xbb10('0x43')](function(_0x1c7fae){_0x5835fd[_0xbb10('0x42')][_0xbb10('0x44')](_0xe2040f[_0x1c7fae]);});}delete _0x5835fd['TagIds'];}catch(_0x3fff6c){_0x44d6ae(_0x3fff6c);}_0x2e3214(_0x5835fd);});}function updateChatInteraction(_0x331751,_0x23dc18,_0x403beb){return new BPromise(function(_0x5e2cfa,_0x351484){return getInteractionUsers(_0x331751,_0x403beb)[_0xbb10('0x22')](function(_0x54ac18){return getInteractionTags(_0x54ac18,_0x23dc18);})['then'](function(_0x38d78f){_0x5e2cfa(_0x38d78f);})['catch'](function(_0x318984){_0x351484(_0x318984);});});}exports[_0xbb10('0x45')]=function(_0x4c66d8,_0x366608){var _0x1d82bf={},_0x474e99={},_0x5cf4f8={'count':0x0,'rows':[]};var _0x2dd02b=_[_0xbb10('0x3f')](db[_0xbb10('0x46')][_0xbb10('0x47')],function(_0x36e1fa){return{'name':_0x36e1fa[_0xbb10('0x48')],'type':_0x36e1fa[_0xbb10('0x49')][_0xbb10('0x4a')]};});_0x474e99[_0xbb10('0x4b')]=_[_0xbb10('0x3f')](_0x2dd02b,_0xbb10('0x38'));_0x474e99[_0xbb10('0x4c')]=_['keys'](_0x4c66d8[_0xbb10('0x4c')]);_0x474e99[_0xbb10('0x4d')]=_['intersection'](_0x474e99[_0xbb10('0x4b')],_0x474e99[_0xbb10('0x4c')]);_0x1d82bf[_0xbb10('0x4e')]=_[_0xbb10('0x4f')](_0x474e99[_0xbb10('0x4b')],qs[_0xbb10('0x50')](_0x4c66d8[_0xbb10('0x4c')]['fields']));_0x1d82bf['attributes']=_0x1d82bf[_0xbb10('0x4e')][_0xbb10('0x51')]?_0x1d82bf[_0xbb10('0x4e')]:_0x474e99['model'];if(!_0x4c66d8['query'][_0xbb10('0x52')](_0xbb10('0x53'))){_0x1d82bf[_0xbb10('0x54')]=qs[_0xbb10('0x54')](_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x54')]);_0x1d82bf[_0xbb10('0x2f')]=qs[_0xbb10('0x2f')](_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x2f')]);}_0x1d82bf['order']=qs['sort'](_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x55')]);_0x1d82bf[_0xbb10('0x56')]=qs[_0xbb10('0x4d')](_[_0xbb10('0x57')](_0x4c66d8[_0xbb10('0x4c')],_0x474e99[_0xbb10('0x4d')]),_0x2dd02b);var _0x445870=[];var _0x1c0d8f=squel[_0xbb10('0x58')]()[_0xbb10('0x59')]('id')[_0xbb10('0x59')](_0xbb10('0x38'))[_0xbb10('0x59')](_0xbb10('0x5a'))['from'](_0xbb10('0x5b'));var _0x5bd44d=squel[_0xbb10('0x58')]()[_0xbb10('0x59')](_0xbb10('0x5c'))[_0xbb10('0x59')](_0xbb10('0x5d'))[_0xbb10('0x59')](_0xbb10('0x5e'))[_0xbb10('0x5f')](_0xbb10('0x60'),'ui')[_0xbb10('0x61')](_0xbb10('0x62'),'u',_0xbb10('0x63'));var _0x1d49e1=squel[_0xbb10('0x58')]()[_0xbb10('0x5f')]('chat_interactions','i')[_0xbb10('0x61')](_0xbb10('0x64'),'c',_0xbb10('0x65'))[_0xbb10('0x61')](_0xbb10('0x62'),'o',_0xbb10('0x66'))['left_join'](_0xbb10('0x67'),'a',_0xbb10('0x68'))[_0xbb10('0x61')](_0xbb10('0x69'),'me',_0xbb10('0x6a'))[_0xbb10('0x61')](_0xbb10('0x6b'),'it',_0xbb10('0x6c'))[_0xbb10('0x61')](_0xbb10('0x5b'),'t',_0xbb10('0x6d'));var _0x2a1ce1=squel[_0xbb10('0x6e')]();var _0x4e7fac=[];var _0x4ea1a6=squel[_0xbb10('0x6e')]();var _0x3e6338;if(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x6f')]){_0x3e6338=as['parseSearch'](_0x4c66d8['query'][_0xbb10('0x6f')]);var _0xaf2cc3=_0x3e6338[_0xbb10('0x70')];for(var _0x2dd150=0x0;_0x2dd150<_0x3e6338[_0xbb10('0x71')][_0xbb10('0x51')];_0x2dd150++){var _0x45c0dc=_0x3e6338['conditions'][_0x2dd150];var _0x117e84='i';var _0x216cff=_['find'](_0x2dd02b,['name',_0x45c0dc['field']]);if(!_0x216cff){switch(_0x45c0dc[_0xbb10('0x59')]){case _0xbb10('0x72'):if(_0x45c0dc[_0xbb10('0x73')]==0x1){_0x1d49e1['having']('`'+_0x45c0dc['field']+'`\x20=\x200');}else{_0x1d49e1[_0xbb10('0x74')]('`'+_0x45c0dc[_0xbb10('0x59')]+_0xbb10('0x75'));}break;case'Contact':if(_0x45c0dc[_0xbb10('0x76')]===_0xbb10('0x77')){if(_0x45c0dc['value']['split']('\x20')[_0xbb10('0x51')]>0x1){_0x2a1ce1[_0xaf2cc3](_0xbb10('0x78'),qs[_0xbb10('0x79')](_0x45c0dc[_0xbb10('0x73')]),null);}else{var _0x54b7c5='%'+_0x45c0dc[_0xbb10('0x73')]+'%';_0x2a1ce1[_0xaf2cc3](_0xbb10('0x7a'),_0x54b7c5,_0x54b7c5,_0x54b7c5);}}else{_0x216cff=_[_0xbb10('0x7b')](_0x2dd02b,['name',_0xbb10('0x7c')]);_0x45c0dc[_0xbb10('0x59')]=_0xbb10('0x7c');_0x329da7=as['buildExpression'](_0x117e84,_0x216cff[_0xbb10('0x49')],_0x45c0dc);_0x2a1ce1[_0xaf2cc3](_0x329da7[_0xbb10('0x7d')],_0x329da7[_0xbb10('0x73')][_0xbb10('0x7e')],_0x329da7['value'][_0xbb10('0x2e')]);}break;case _0xbb10('0x7f'):var _0x108e5b=_0x45c0dc[_0xbb10('0x73')]['split'](',')[_0xbb10('0x3f')](function(_0x277fe7){return Number(_0x277fe7);});_0x108e5b[_0xbb10('0x43')](function(_0x2ceb3e){_0x4ea1a6['or'](_0xbb10('0x80'),'%,'+_0x2ceb3e+',%');});_0x4e7fac=_[_0xbb10('0x81')](_0x4e7fac,_0x108e5b);break;case _0xbb10('0x82'):if(_0x45c0dc['operator']==='$substring'){_0x2a1ce1[_0xaf2cc3]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x45c0dc[_0xbb10('0x73')]+'%',null);}else{_0x216cff=_[_0xbb10('0x7b')](_0x2dd02b,[_0xbb10('0x38'),'UserId']);_0x45c0dc['field']=_0xbb10('0x83');_0x329da7=as[_0xbb10('0x84')](_0x117e84,_0x216cff[_0xbb10('0x49')],_0x45c0dc);_0x2a1ce1[_0xaf2cc3](_0x329da7[_0xbb10('0x7d')],_0x329da7[_0xbb10('0x73')][_0xbb10('0x7e')],_0x329da7['value'][_0xbb10('0x2e')]);}break;case _0xbb10('0x3a'):_0x329da7=as[_0xbb10('0x84')]('me',null,_0x45c0dc);_0x2a1ce1[_0xaf2cc3](_0x329da7[_0xbb10('0x7d')],_0x329da7[_0xbb10('0x73')]['start'],_0x329da7['value']['end']);break;}}else{var _0x329da7=as[_0xbb10('0x84')](_0x117e84,_0x216cff[_0xbb10('0x49')],_0x45c0dc);_0x2a1ce1[_0xaf2cc3](_0x329da7[_0xbb10('0x7d')],_0x329da7[_0xbb10('0x73')][_0xbb10('0x7e')],_0x329da7['value'][_0xbb10('0x2e')]);}}}else{var _0x4bc316=_(_0x4c66d8['query'])['keys']()[_0xbb10('0x3f')](function(_0x13040d){return _[_0xbb10('0x85')](_0x2dd02b,[_0xbb10('0x38'),_0x13040d])?_0x13040d:undefined;})['compact']()[_0xbb10('0x73')]();if(!_['isEmpty'](_0x4bc316)){_0x4bc316['forEach'](function(_0x165fe9){if(_0x165fe9===_0xbb10('0x86')){_0x1d49e1[_0xbb10('0x56')](_0xbb10('0x87'),[][_0xbb10('0x88')](_0x4c66d8['query'][_0x165fe9]));}else if(_0x165fe9===_0xbb10('0x89')){var _0x19fcec=JSON[_0xbb10('0x8a')](_0x4c66d8[_0xbb10('0x4c')][_0x165fe9])[_0xbb10('0x8b')];var _0x27f42f=JSON[_0xbb10('0x8a')](_0x4c66d8['query'][_0x165fe9])[_0xbb10('0x8c')];_0x1d49e1[_0xbb10('0x56')](_0xbb10('0x8d'),_0x19fcec,_0x27f42f);}else{if(_0x4c66d8[_0xbb10('0x4c')][_0x165fe9]===_0xbb10('0x8e')){_0x1d49e1[_0xbb10('0x56')]('i.'+_0x165fe9+_0xbb10('0x8f'));}else{_0x1d49e1[_0xbb10('0x56')]('i.'+_0x165fe9+'\x20=\x20?',_0x4c66d8[_0xbb10('0x4c')][_0x165fe9]);}}});}if(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x90')]){if(_0x4c66d8['query']['read']==0x1){_0x1d49e1['having'](_0xbb10('0x91'));}else{_0x1d49e1['having']('`unreadMessages`\x20>\x200');}}if(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x92')]){_0x4e7fac=_[_0xbb10('0x93')](_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x92')])?_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x92')]:new Array(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x92')]);_0x4e7fac['forEach'](function(_0x318a14){_0x4ea1a6['or'](_0xbb10('0x80'),'%,'+_0x318a14+',%');});}if(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x94')]){var _0x5c8eb8=_0x4c66d8['query'][_0xbb10('0x94')][_0xbb10('0x95')]('\x5c','\x5c\x5c')[_0xbb10('0x95')](/'/g,'\x27\x27');if(qs[_0xbb10('0x96')](_0x5c8eb8)){_0x2a1ce1['or']('i.id\x20LIKE\x20?',_0x5c8eb8+'%');}else{_0x2a1ce1['or'](_0xbb10('0x97'),qs[_0xbb10('0x79')](_0x5c8eb8))['or'](_0xbb10('0x98'),_0x5c8eb8+'%');}}}_0x1d49e1[_0xbb10('0x56')](_0x2a1ce1);_0x1d49e1[_0xbb10('0x99')]('i.id');var _0x5f0691={'type':db[_0xbb10('0x9a')][_0xbb10('0x9b')][_0xbb10('0x9c')],'raw':!![]};var _0x5239da=_0x1d49e1[_0xbb10('0x9d')]();_0x5239da[_0xbb10('0x59')]('i.id');_0x5239da['field'](_0xbb10('0x9e'),_0xbb10('0x72'));if(_0x1d82bf[_0xbb10('0x9f')]){_0x1d82bf['order'][_0xbb10('0x43')](function(_0x3a17fc){var _0xfbb365=_0x3a17fc[0x0]===_0xbb10('0xa0')?_0x3a17fc[0x0]:'i.'+_0x3a17fc[0x0];_0x1d49e1[_0xbb10('0x9f')](_0xfbb365,_0x3a17fc[0x1]===_0xbb10('0xa1')?![]:!![]);});}if(!_[_0xbb10('0xa2')](_0x4e7fac)){_0x1d49e1[_0xbb10('0x74')](_0x4ea1a6);_0x5239da[_0xbb10('0x56')]('t.id\x20IN\x20?',_0x4e7fac);}BPromise[_0xbb10('0xa3')]()[_0xbb10('0x22')](function(){if(!_0x3e6338){if(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x86')])return;_0x5239da[_0xbb10('0x56')](_0xbb10('0xa4'));_0x1d49e1[_0xbb10('0x56')](_0xbb10('0xa4'));return;}if(_0x4c66d8[_0xbb10('0xa5')][_0xbb10('0xa6')]!==_0xbb10('0xa7'))return;return _0x4c66d8[_0xbb10('0xa5')]['getChatWebsites']({'attributes':['id'],'raw':!![]})['then'](function(_0xe1fc51){if(_[_0xbb10('0xa2')](_0xe1fc51)){_0x5239da[_0xbb10('0x56')](_0xbb10('0xa8'));_0x1d49e1[_0xbb10('0x56')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x5239da[_0xbb10('0x56')](_0xbb10('0x87'),_[_0xbb10('0x3f')](_0xe1fc51,'id'));_0x1d49e1[_0xbb10('0x56')](_0xbb10('0x87'),_[_0xbb10('0x3f')](_0xe1fc51,'id'));}});})['then'](function(){if(_0x4c66d8[_0xbb10('0xa5')][_0xbb10('0xa6')]==='agent'&&!_0x3e6338&&!_0x4c66d8[_0xbb10('0x4c')]['ChatWebsiteId'])return[];return db[_0xbb10('0xa9')][_0xbb10('0x4c')](_0x5239da[_0xbb10('0xaa')](),_0x5f0691);})[_0xbb10('0x22')](function(_0x3a4a6e){_0x5cf4f8['count']=_0x3a4a6e[_0xbb10('0x51')];if(_0x5cf4f8['count']===0x0)return[];return db[_0xbb10('0xa9')][_0xbb10('0x4c')](_0x1c0d8f['toString'](),_0x5f0691)['then'](function(_0x415407){_0x445870=_[_0xbb10('0xab')](_0x415407,'id');_0x5f0691=_[_0xbb10('0xac')](_0x5f0691,{'model':db[_0xbb10('0x46')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x50')]){_0x1d82bf[_0xbb10('0x4e')][_0xbb10('0x43')](function(_0x252ab8){_0x1d49e1[_0xbb10('0x59')]('i.'+_0x252ab8);});}else{_0x1d49e1[_0xbb10('0x59')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xbb10('0x72'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xad'),_0xbb10('0xae'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xaf'),_0xbb10('0xb0'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xb1'),_0xbb10('0xa0'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xb2'));_0x1d49e1['field'](_0xbb10('0xb3'),'Contact.firstName');_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xb4'),_0xbb10('0xb5'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xb6'),'Contact.email');_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xb7'),_0xbb10('0xb8'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xb9'),_0xbb10('0xba'));_0x1d49e1['field']('c.fax',_0xbb10('0xbb'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xbc'),'Owner.fullname');_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xbd'),'Owner.internal');_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xbe'),'TagIds');}if(_0x1d82bf[_0xbb10('0x54')])_0x1d49e1['limit'](_0x1d82bf[_0xbb10('0x54')]);if(_0x1d82bf[_0xbb10('0x2f')])_0x1d49e1['offset'](_0x1d82bf[_0xbb10('0x2f')]);return db[_0xbb10('0xa9')]['query'](_0x1d49e1['toString'](),_0x5f0691);})[_0xbb10('0x22')](function(_0x13ae83){if(_0x13ae83[_0xbb10('0x51')]>0x0)_0x5bd44d[_0xbb10('0x56')](_0xbb10('0xbf'),_['map'](_0x13ae83,'id'));return db[_0xbb10('0xa9')][_0xbb10('0x4c')](_0x5bd44d[_0xbb10('0xaa')](),_0x5f0691)['then'](function(_0xd68afa){var _0x4f90e6=_[_0xbb10('0xc0')](_0xd68afa,_0xbb10('0xc1'));var _0x44a3e1=[];_0x13ae83[_0xbb10('0x43')](function(_0x1f55d3){_0x44a3e1[_0xbb10('0x44')](updateChatInteraction(_0x1f55d3,_0x445870,_0x4f90e6));});return BPromise[_0xbb10('0xc2')](_0x44a3e1);});});})['then'](function(_0x4fc544){_0x5cf4f8[_0xbb10('0xc3')]=_0x4fc544;return _0x5cf4f8;})[_0xbb10('0x22')](respondWithFilteredResult(_0x366608,_0x1d82bf))[_0xbb10('0xc4')](handleError(_0x366608,null));};exports[_0xbb10('0xc5')]=function(_0x20b585,_0x363b81){var _0x1cccec={'raw':![],'where':{'id':_0x20b585[_0xbb10('0xc6')]['id']}},_0x1674f7={};_0x1674f7[_0xbb10('0x4b')]=_[_0xbb10('0xc7')](db[_0xbb10('0x46')][_0xbb10('0x47')]);_0x1674f7['query']=_[_0xbb10('0xc7')](_0x20b585[_0xbb10('0x4c')]);_0x1674f7[_0xbb10('0x4d')]=_[_0xbb10('0x4f')](_0x1674f7[_0xbb10('0x4b')],_0x1674f7[_0xbb10('0x4c')]);_0x1cccec[_0xbb10('0x4e')]=_[_0xbb10('0x4f')](_0x1674f7[_0xbb10('0x4b')],qs[_0xbb10('0x50')](_0x20b585[_0xbb10('0x4c')]['fields']));_0x1cccec[_0xbb10('0x4e')]=_0x1cccec['attributes'][_0xbb10('0x51')]?_0x1cccec[_0xbb10('0x4e')]:_0x1674f7[_0xbb10('0x4b')];if(_0x20b585[_0xbb10('0x4c')][_0xbb10('0xc8')]){_0x1cccec[_0xbb10('0xc9')]=[{'all':!![]}];}_0x1cccec=_['merge']({},_0x1cccec,_0x20b585[_0xbb10('0xca')]);return db['ChatInteraction'][_0xbb10('0x7b')](_0x1cccec)[_0xbb10('0x22')](handleEntityNotFound(_0x363b81,null))[_0xbb10('0x22')](respondWithResult(_0x363b81,null))[_0xbb10('0xc4')](handleError(_0x363b81,null));};exports[_0xbb10('0xcb')]=function(_0x31907e,_0x4f06c){return db[_0xbb10('0x46')][_0xbb10('0xcb')](_0x31907e[_0xbb10('0x3a')],{})[_0xbb10('0x22')](respondWithResult(_0x4f06c,0xc9))[_0xbb10('0xc4')](handleError(_0x4f06c,null));};exports['update']=function(_0x3696b3,_0x516520){if(_0x3696b3[_0xbb10('0x3a')]['id']){delete _0x3696b3[_0xbb10('0x3a')]['id'];}return db[_0xbb10('0x46')][_0xbb10('0x7b')]({'where':{'id':_0x3696b3[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x516520,null))[_0xbb10('0x22')](saveUpdates(_0x3696b3['body'],null))[_0xbb10('0x22')](respondWithResult(_0x516520,null))['catch'](handleError(_0x516520,null));};exports['destroy']=function(_0x1513e0,_0x35cbb9){return db[_0xbb10('0x46')][_0xbb10('0x7b')]({'where':{'id':_0x1513e0[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x35cbb9,null))['then'](removeEntity(_0x35cbb9,null))[_0xbb10('0xc4')](handleError(_0x35cbb9,null));};exports[_0xbb10('0xcc')]=function(_0x39aa9e,_0xb1b7c8){return db[_0xbb10('0x46')][_0xbb10('0xcc')]()['then'](respondWithResult(_0xb1b7c8,null))[_0xbb10('0xc4')](handleError(_0xb1b7c8,null));};exports[_0xbb10('0xcd')]=function(_0xb7c454,_0xa8b7c3){var _0x31718f=_0xb7c454[_0xbb10('0xc6')]['id'];var _0x2764e1;var _0x5e405b;var _0x33a43e;return db['ChatInteraction'][_0xbb10('0xce')]({'where':{'id':_0x31718f}})['then'](function(_0x4c8b68){_0x2764e1=_0x4c8b68;return db[_0xbb10('0xcf')][_0xbb10('0xce')]({'where':{'id':_0x4c8b68[_0xbb10('0x86')]},'attributes':['id',_0xbb10('0xd0'),_0xbb10('0xd1'),'vidaooTopic',_0xbb10('0xd2'),'vidaooMetadata'],'raw':!![]});})['then'](function(_0x4dd138){if(_0x4dd138&&_0x4dd138[_0xbb10('0xd0')]&&_0x4dd138[_0xbb10('0xd1')]){_0x5e405b=_0x4dd138;var _0x1b9012={'interaction':{'id':_0x31718f},'agent':{'id':_0xb7c454[_0xbb10('0xa5')]['id'],'name':_0xb7c454[_0xbb10('0xa5')]['name'],'fullname':_0xb7c454[_0xbb10('0xa5')][_0xbb10('0x40')],'email':_0xb7c454[_0xbb10('0xa5')][_0xbb10('0xd3')]},'contact':_0xb7c454[_0xbb10('0x3a')][_0xbb10('0x3b')],'account':_0xb7c454[_0xbb10('0x3a')]['account']};var _0x4c95c2={'rejectUnauthorized':![],'method':'POST','url':_0xbb10('0xd4'),'headers':{'X-APIKEY':_0x4dd138[_0xbb10('0xd0')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0xb7c454[_0xbb10('0xa5')][_0xbb10('0xd3')]],'buttons':null,'topic':_0x5e405b[_0xbb10('0xd5')],'note':_[_0xbb10('0xd6')](_0x5e405b[_0xbb10('0xd2')])?null:getMustacheRender(_0x5e405b[_0xbb10('0xd2')],_0x1b9012),'metadata':null},'redirect':_0xbb10('0xd7'),'json':!![]};try{if(!_[_0xbb10('0xd6')](_0x5e405b['vidaooMetadata'])){var _0x58295f=getMustacheRender(_0x5e405b['vidaooMetadata'],_0x1b9012);var _0x3d4b89=JSON[_0xbb10('0x8a')](_0x58295f);_0x4c95c2[_0xbb10('0x3a')]['metadata']=_0x3d4b89;}}catch(_0x2bfa8e){throw new db[(_0xbb10('0x9a'))][(_0xbb10('0xd8'))](_0xbb10('0xd9'));}return rp(_0x4c95c2);}else{throw new db[(_0xbb10('0x9a'))][(_0xbb10('0xd8'))]('Error\x20in\x20Vidaoo\x20configuration');}})['then'](function(_0x356660){_0x33a43e=_0x356660;if(_0x33a43e['id']){var _0x48889b={'body':_0x33a43e[_0xbb10('0xda')],'ChatWebsiteId':_0x5e405b['id'],'ChatInteractionId':_0x2764e1['id'],'direction':_0xbb10('0xdb'),'UserId':_0xb7c454[_0xbb10('0xa5')]['id']};return db[_0xbb10('0xdc')][_0xbb10('0xcb')](_0x48889b,{});}else{throw new db[(_0xbb10('0x9a'))][(_0xbb10('0xd8'))](_0xbb10('0xdd'));}})[_0xbb10('0x22')](function(){return _0x2764e1[_0xbb10('0xde')]({'vidaooSessionId':_0x33a43e['id']});})['then'](respondWithResult(_0xa8b7c3,null))[_0xbb10('0xc4')](handleError(_0xa8b7c3,null));};exports['customUpdate']=function(_0x27bed2,_0x5547fa){if(_0x27bed2[_0xbb10('0x3a')]['id']){delete _0x27bed2[_0xbb10('0x3a')]['id'];}return db[_0xbb10('0x46')][_0xbb10('0x7b')]({'where':{'id':_0x27bed2['params']['id']},'include':[{'model':db[_0xbb10('0xdf')],'as':'Contact'}]})[_0xbb10('0x22')](handleEntityNotFound(_0x5547fa,null))[_0xbb10('0x22')](saveUpdates(_0x27bed2[_0xbb10('0x3a')],null))['then'](respondWithResult(_0x5547fa,null))[_0xbb10('0xc4')](handleError(_0x5547fa,null));};exports[_0xbb10('0xe0')]=function(_0x140173,_0x18a44f,_0x11d31b){if(_0x140173[_0xbb10('0x3a')]['id']){delete _0x140173['body']['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x140173[_0xbb10('0xc6')]['id']}})['then'](function(_0x318908){if(!_0x318908){logger['error'](_0xbb10('0xe1'),_0xbb10('0xe0'),0x194,_0xbb10('0xe2'));_0x18a44f['sendStatus'](0x194);}else{if(_0x318908['UserId']){throw new db[(_0xbb10('0x9a'))][(_0xbb10('0xd8'))](_0xbb10('0xe3'));}}return _0x318908;})['then'](function(_0x440108){if(_0x440108){return _0x440108[_0xbb10('0x36')]({'closed':_0x140173[_0xbb10('0x3a')]['closed'],'disposition':_0x140173['body']['disposition']})[_0xbb10('0x22')](function(_0x55aa03){return _0x55aa03;});}})[_0xbb10('0x22')](function(_0x1c2c95){return respondWithRpcPromise(_0xbb10('0xe4'),_0xbb10('0xe0'),_0x140173[_0xbb10('0x3a')],client9004);})[_0xbb10('0x22')](respondWithResult(_0x18a44f,null))[_0xbb10('0xc4')](handleError(_0x18a44f,null));};exports[_0xbb10('0xe5')]=function(_0x2746eb,_0x431792,_0x2e2710){_0x2746eb['body'][_0xbb10('0x38')]=_0x2746eb[_0xbb10('0xe6')]['originalname'];_0x2746eb[_0xbb10('0x3a')]['basename']=_0x2746eb['file'][_0xbb10('0xe7')];_0x2746eb[_0xbb10('0x3a')][_0xbb10('0x49')]=_0x2746eb[_0xbb10('0xe6')][_0xbb10('0xe8')];return db['Attachment'][_0xbb10('0xcb')](_0x2746eb[_0xbb10('0x3a')])['then'](respondWithResult(_0x431792,0xc9))[_0xbb10('0xc4')](handleError(_0x431792,null));};exports[_0xbb10('0xe9')]=function(_0x5a82e7,_0x424c96,_0x4c769b){return db[_0xbb10('0x46')][_0xbb10('0xce')]({'where':{'id':_0x5a82e7[_0xbb10('0xc6')]['id']},'raw':!![]})[_0xbb10('0x22')](handleEntityNotFound(_0x424c96,null))[_0xbb10('0x22')](function(_0x20b312){if(_0x20b312){if(_0x20b312[_0xbb10('0xea')]){return _0x424c96['status'](0x193)[_0xbb10('0x33')]({'status':0x193,'message':_0xbb10('0xeb')});}return db[_0xbb10('0xec')][_0xbb10('0xce')]({'where':{'id':_0x5a82e7[_0xbb10('0x4c')][_0xbb10('0xed')]},'raw':!![]})['then'](handleEntityNotFound(_0x424c96,null));}})['then'](function(_0x5a40e8){if(_0x5a40e8){var _0x23849e=_0x5a40e8[_0xbb10('0xee')]!==null;var _0x3e1a86=path[_0xbb10('0xef')](config['root'],_0xbb10('0xf0'));if(_0x23849e){_0x3e1a86=path[_0xbb10('0xef')](_0x3e1a86,_0xbb10('0xf1'));}var _0x577d27=path['join'](_0x3e1a86,_0x5a40e8[_0xbb10('0xf2')]);return _0x424c96['download'](_0x577d27);}})[_0xbb10('0xc4')](handleError(_0x424c96,null));};exports[_0xbb10('0xf3')]=function(_0xb9bc5a,_0x42276f){var _0x425505=null;var _0xcb61bb=null;var _0x1fe250=null;var _0x57933f=null;if(_0xb9bc5a[_0xbb10('0x3a')]['id']){delete _0xb9bc5a[_0xbb10('0x3a')]['id'];}if(_0xb9bc5a['body'][_0xbb10('0xf4')]){_0x57933f=path[_0xbb10('0xef')](config[_0xbb10('0xf5')],'server/files/chat/upload/',util['format']('transcript-%s.txt',Date[_0xbb10('0xf6')]()));_0xb9bc5a[_0xbb10('0x3a')]['pathTranscript']=_0x57933f;}return db[_0xbb10('0x46')][_0xbb10('0x7b')]({'where':{'id':_0xb9bc5a[_0xbb10('0xc6')]['id']},'include':[{'model':db[_0xbb10('0xdc')],'as':_0xbb10('0xf7'),'include':[{'model':db[_0xbb10('0x82')],'as':_0xbb10('0x82')}]}]})['then'](handleEntityNotFound(_0x42276f,null))[_0xbb10('0x22')](saveUpdates(_0xb9bc5a['body'],null))['then'](function(_0x4aa0d7){if(_0x4aa0d7){_0x425505=_0x4aa0d7;return db[_0xbb10('0xcf')][_0xbb10('0x7b')]({'where':{'id':_0x425505['ChatWebsiteId']}});}})[_0xbb10('0x22')](function(_0x49f324){if(_0x49f324){_0x1fe250=_0x49f324;return db[_0xbb10('0xdf')][_0xbb10('0x7b')]({'where':{'id':_0x425505[_0xbb10('0x7c')]}});}})['then'](function(_0x4d10ea){if(_0x4d10ea){_0xcb61bb=_0x4d10ea;if(_0x57933f){var _0x447c0d=null;for(var _0x502e73=0x1;_0x502e73<_0x425505[_0xbb10('0xf7')][_0xbb10('0x51')];++_0x502e73){_0x447c0d=_0x425505['Messages'][_0x502e73];var _0x50cd00=_0x447c0d[_0xbb10('0x83')]?util[_0xbb10('0xf8')](_0xbb10('0xf9'),_0x1fe250['agentAlias'],_0x447c0d[_0xbb10('0x83')]):_0xbb10('0xfa');var _0x22f153=_0xb9bc5a['body'][_0xbb10('0xfb')]||util[_0xbb10('0xf8')](_0xbb10('0xf9'),_0xbb10('0xfc'),_0x447c0d[_0xbb10('0x7c')]);switch(_0x1fe250[_0xbb10('0xfd')]){case _0xbb10('0xfe'):_0x50cd00=_0x447c0d[_0xbb10('0x83')]?util[_0xbb10('0xf8')](_0xbb10('0xf9'),_0x1fe250[_0xbb10('0xff')],_0x447c0d[_0xbb10('0x83')]):_0xbb10('0xfa');break;case'agent_alias':_0x50cd00=_0x447c0d['UserId']?_0x447c0d[_0xbb10('0x82')]['alias']||_0x447c0d[_0xbb10('0x82')][_0xbb10('0x40')]:_0xbb10('0xfa');break;case'agent_fullname':_0x50cd00=_0x447c0d[_0xbb10('0x83')]?_0x447c0d[_0xbb10('0x82')][_0xbb10('0x40')]:_0xbb10('0xfa');break;default:_0x50cd00=_0x447c0d[_0xbb10('0x83')]?util['format'](_0xbb10('0xf9'),_0x1fe250[_0xbb10('0xff')],_0x447c0d[_0xbb10('0x83')]):_0xbb10('0xfa');}var _0x150d4c=util[_0xbb10('0xf8')]('[%s]\x20%s:\x20%s\x0a',moment(_0x447c0d[_0xbb10('0x89')])[_0xbb10('0xf8')]('MM/DD/YYYY\x20HH:mm:ss'),_0x447c0d[_0xbb10('0x100')]==='in'?_0x22f153:_0x50cd00,_0x447c0d[_0xbb10('0x3a')]);if(!_0x447c0d[_0xbb10('0x101')]){fs[_0xbb10('0x102')](_0x57933f,_0x150d4c);}}return db[_0xbb10('0x103')][_0xbb10('0xce')]({'where':{'service':!![]},'include':[{'model':db[_0xbb10('0x104')],'as':_0xbb10('0x105'),'raw':!![]}]});}}})[_0xbb10('0x22')](function(_0x33d1b7){if(_0x33d1b7&&_0x33d1b7[_0xbb10('0x105')]&&_0xb9bc5a[_0xbb10('0x3a')]){var _0x1db646={'tls':{'rejectUnauthorized':![]}};if(_0x33d1b7[_0xbb10('0x105')][_0xbb10('0x106')]){_0x1db646['service']=_0x33d1b7[_0xbb10('0x105')][_0xbb10('0x106')];}else{_0x1db646['host']=_0x33d1b7['Smtp'][_0xbb10('0x107')];_0x1db646[_0xbb10('0x108')]=_0x33d1b7[_0xbb10('0x105')][_0xbb10('0x108')];_0x1db646[_0xbb10('0x109')]=_0x33d1b7[_0xbb10('0x105')][_0xbb10('0x109')];}if(_0x33d1b7[_0xbb10('0x105')][_0xbb10('0x10a')]){_0x1db646['auth']={'user':_0x33d1b7['Smtp']['user'],'pass':_0x33d1b7['Smtp']['pass']};}return respondWithRpcPromise('SendMail',_0xbb10('0x10b'),{'account':_0x1db646,'message':{'from':util[_0xbb10('0xf8')](_0xbb10('0x10c'),_0x33d1b7[_0xbb10('0x38')],_0x33d1b7['email']||_0x33d1b7[_0xbb10('0x105')][_0xbb10('0xa5')]),'to':_0xb9bc5a[_0xbb10('0x3a')][_0xbb10('0xf4')],'subject':'Mail\x20Transcript','text':util['format'](_0xbb10('0x10d'),_0xb9bc5a[_0xbb10('0x3a')]['mailTranscript']),'attachments':[{'path':_0x57933f}]}})['then'](function(){return _0x425505;})[_0xbb10('0xc4')](function(_0xf1371a){console[_0xbb10('0x28')](_0xf1371a);});}else{return _0x425505;}})[_0xbb10('0x22')](respondWithStatusCode(_0x42276f,0xc8))[_0xbb10('0xc4')](handleError(_0x42276f,null));};exports['addMessage']=function(_0x4744f4,_0x5382e9,_0x4c97b9){return db[_0xbb10('0xdc')][_0xbb10('0x7b')]({'where':{'id':_0x4744f4[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x5382e9,null))[_0xbb10('0x22')](function(_0x21c0fd){if(_0x21c0fd){return _0x21c0fd['addMessage'](_0x4744f4[_0xbb10('0x3a')][_0xbb10('0x10e')],_[_0xbb10('0x10f')](_0x4744f4[_0xbb10('0x3a')],[_0xbb10('0x10e'),'id'])||{});}})[_0xbb10('0x22')](respondWithResult(_0x5382e9,null))[_0xbb10('0xc4')](handleError(_0x5382e9,null));};exports[_0xbb10('0x110')]=function(_0x233d5e,_0x16f3ce,_0xbae19c){var _0x26f4b0={'raw':![],'where':{}};var _0x1dbf7b={};var _0x117e95={'count':0x0,'rows':[]};return db[_0xbb10('0x46')][_0xbb10('0xce')]({'where':{'id':_0x233d5e[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x16f3ce,null))[_0xbb10('0x22')](function(_0x43a203){if(_0x43a203){_0x1dbf7b[_0xbb10('0x4b')]=_[_0xbb10('0xc7')](db['ChatMessage'][_0xbb10('0x47')]);_0x1dbf7b['query']=_[_0xbb10('0xc7')](_0x233d5e[_0xbb10('0x4c')]);_0x1dbf7b[_0xbb10('0x4d')]=_[_0xbb10('0x4f')](_0x1dbf7b[_0xbb10('0x4b')],_0x1dbf7b['query']);_0x26f4b0['attributes']=_['intersection'](_0x1dbf7b[_0xbb10('0x4b')],qs[_0xbb10('0x50')](_0x233d5e['query'][_0xbb10('0x50')]));_0x26f4b0[_0xbb10('0x4e')]=_0x26f4b0[_0xbb10('0x4e')]['length']?_0x26f4b0[_0xbb10('0x4e')]:_0x1dbf7b[_0xbb10('0x4b')];if(!_0x233d5e[_0xbb10('0x4c')]['hasOwnProperty'](_0xbb10('0x53'))){_0x26f4b0['limit']=qs[_0xbb10('0x54')](_0x233d5e['query']['limit']);_0x26f4b0['offset']=qs['offset'](_0x233d5e['query']['offset']);}_0x26f4b0[_0xbb10('0x9f')]=qs[_0xbb10('0x55')](_0x233d5e[_0xbb10('0x4c')][_0xbb10('0x55')]);_0x26f4b0['where']=qs[_0xbb10('0x4d')](_[_0xbb10('0x57')](_0x233d5e[_0xbb10('0x4c')],_0x1dbf7b[_0xbb10('0x4d')]));_0x26f4b0[_0xbb10('0x56')][_0xbb10('0xc1')]=_0x43a203['id'];if(_0x233d5e[_0xbb10('0x4c')][_0xbb10('0x94')]){_0x26f4b0[_0xbb10('0x56')]=_[_0xbb10('0xac')](_0x26f4b0['where'],{'$or':_[_0xbb10('0x3f')](_0x26f4b0[_0xbb10('0x4e')],function(_0x288ccc){var _0x5c5ecc={};_0x5c5ecc[_0x288ccc]={'$like':'%'+_0x233d5e[_0xbb10('0x4c')][_0xbb10('0x94')]+'%'};return _0x5c5ecc;})});}if(_0x233d5e[_0xbb10('0x4c')][_0xbb10('0x8b')]){var _0x5b2292=_0x233d5e[_0xbb10('0x4c')][_0xbb10('0x8b')][_0xbb10('0x111')](',');var _0x22ec50={};_0x22ec50[_0x5b2292[0x0]]={'$gte':moment(_0x5b2292[0x1])[_0xbb10('0xf8')](_0xbb10('0x112'))};_0x26f4b0[_0xbb10('0x56')]=_[_0xbb10('0xac')](_0x26f4b0[_0xbb10('0x56')],_0x22ec50);}_0x26f4b0=_[_0xbb10('0xac')]({},_0x26f4b0,_0x233d5e[_0xbb10('0xca')]);return db['ChatMessage'][_0xbb10('0x31')]({'where':_0x26f4b0[_0xbb10('0x56')]})['then'](function(_0x5eb1fb){_0x117e95[_0xbb10('0x31')]=_0x5eb1fb;if(_0x233d5e[_0xbb10('0x4c')]['includeAll']){_0x26f4b0[_0xbb10('0xc9')]=[{'all':!![]}];}return db[_0xbb10('0xdc')]['findAll'](_0x26f4b0);})[_0xbb10('0x22')](function(_0x42441e){_0x117e95[_0xbb10('0xc3')]=_0x42441e;return _0x117e95;});}})[_0xbb10('0x22')](respondWithFilteredResult(_0x16f3ce,_0x26f4b0))[_0xbb10('0xc4')](handleError(_0x16f3ce,null));};exports['getMyMessages']=function(_0x4fc260,_0x5a502c,_0xaeaa51){var _0x4db9ad={'where':{}},_0x43deea={},_0x53e73e={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xbb10('0xce')]({'where':{'id':_0x4fc260[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x5a502c,null))[_0xbb10('0x22')](function(_0x2527f4){if(_0x2527f4){_0x43deea[_0xbb10('0x4b')]=_['keys'](db['ChatMessage']['rawAttributes']);_0x43deea[_0xbb10('0x4c')]=_[_0xbb10('0xc7')](_0x4fc260[_0xbb10('0x4c')]);_0x43deea[_0xbb10('0x4d')]=_[_0xbb10('0x4f')](_0x43deea[_0xbb10('0x4b')],_0x43deea[_0xbb10('0x4c')]);_0x4db9ad['attributes']=_[_0xbb10('0x4f')](_0x43deea[_0xbb10('0x4b')],qs[_0xbb10('0x50')](_0x4fc260[_0xbb10('0x4c')]['fields']));_0x4db9ad[_0xbb10('0x4e')]=_0x4db9ad['attributes']['length']?_0x4db9ad[_0xbb10('0x4e')]:_0x43deea[_0xbb10('0x4b')];if(!_0x4fc260[_0xbb10('0x4c')][_0xbb10('0x52')](_0xbb10('0x53'))){_0x4db9ad[_0xbb10('0x54')]=qs['limit'](_0x4fc260[_0xbb10('0x4c')][_0xbb10('0x54')]);_0x4db9ad[_0xbb10('0x2f')]=qs[_0xbb10('0x2f')](_0x4fc260[_0xbb10('0x4c')][_0xbb10('0x2f')]);}_0x4db9ad[_0xbb10('0x9f')]=qs['sort'](_0x4fc260[_0xbb10('0x4c')][_0xbb10('0x55')]);_0x4db9ad[_0xbb10('0x56')]=qs['filters'](_['pick'](_0x4fc260[_0xbb10('0x4c')],_0x43deea[_0xbb10('0x4d')]));_0x4db9ad[_0xbb10('0x56')][_0xbb10('0xc1')]=_0x2527f4['id'];if(_0x4fc260[_0xbb10('0x4c')][_0xbb10('0x94')]){_0x4db9ad[_0xbb10('0x56')]=_['merge'](_0x4db9ad[_0xbb10('0x56')],{'$or':_[_0xbb10('0x3f')](_0x4db9ad[_0xbb10('0x4e')],function(_0x55ba78){var _0x5e195a={};_0x5e195a[_0x55ba78]={'$like':'%'+_0x4fc260['query']['filter']+'%'};return _0x5e195a;})});}_0x4db9ad[_0xbb10('0x56')][_0xbb10('0x101')]=![];if(_0x4fc260[_0xbb10('0x4c')]['id']){_0x4db9ad[_0xbb10('0x56')]['id']={'$gt':_0x4fc260['query']['id']};}_0x4db9ad=_[_0xbb10('0xac')]({},_0x4db9ad,_0x4fc260['options']);return db[_0xbb10('0xdc')][_0xbb10('0x31')]({'where':_0x4db9ad[_0xbb10('0x56')]})[_0xbb10('0x22')](function(_0xa16287){_0x53e73e[_0xbb10('0x31')]=_0xa16287;_0x4db9ad[_0xbb10('0xc9')]=[];if(_0x4fc260[_0xbb10('0x4c')][_0xbb10('0x113')]){_0x4db9ad[_0xbb10('0xc9')][_0xbb10('0x44')]({'model':db[_0xbb10('0x82')],'as':'User','attributes':['id',_0xbb10('0x40'),_0xbb10('0x114')]});}if(_0x4fc260[_0xbb10('0x4c')]['includeAll']){_0x4db9ad[_0xbb10('0xc9')]=[{'all':!![]}];}return db['ChatMessage'][_0xbb10('0x115')](_0x4db9ad);})[_0xbb10('0x22')](function(_0x280119){_0x53e73e[_0xbb10('0xc3')]=_0x280119;return _0x53e73e;});}})[_0xbb10('0x22')](respondWithFilteredResult(_0x5a502c,_0x4db9ad))['catch'](handleError(_0x5a502c,null));};exports['addTags']=function(_0x842d94,_0x4cf5cc,_0x553bb8){return db[_0xbb10('0x46')]['find']({'where':{'id':_0x842d94[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x4cf5cc,null))[_0xbb10('0x22')](function(_0x4469c4){if(_0x4469c4){return _0x4469c4[_0xbb10('0x116')](_0x842d94[_0xbb10('0x3a')][_0xbb10('0x10e')],_[_0xbb10('0x10f')](_0x842d94['body'],[_0xbb10('0x10e'),'id'])||{})['spread'](function(){return db[_0xbb10('0x7f')]['findAll']({'attributes':['id',_0xbb10('0x38'),_0xbb10('0x5a')],'where':{'id':_0x842d94['body'][_0xbb10('0x10e')]}});})[_0xbb10('0x22')](function(_0x1bb072){socket['emit'](_0xbb10('0x117'),{'id':Number(_0x842d94[_0xbb10('0xc6')]['id']),'tags':_0x1bb072||[]});return{'id':Number(_0x842d94[_0xbb10('0xc6')]['id']),'tags':_0x1bb072||[]};});}})['then'](respondWithResult(_0x4cf5cc,null))[_0xbb10('0xc4')](handleError(_0x4cf5cc,null));};exports[_0xbb10('0x118')]=function(_0x46df90,_0x4b781e,_0x3e6756){return db['ChatInteraction'][_0xbb10('0x7b')]({'where':{'id':_0x46df90[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x4b781e,null))[_0xbb10('0x22')](function(_0x583a3e){if(_0x583a3e){return _0x583a3e[_0xbb10('0x118')](_0x46df90[_0xbb10('0x4c')][_0xbb10('0x10e')]);}})[_0xbb10('0x22')](respondWithStatusCode(_0x4b781e,null))[_0xbb10('0xc4')](handleError(_0x4b781e,null));};exports['download']=function(_0x4b10ed,_0x40b5da){var _0x4739a6=moment()[_0xbb10('0x119')]()['toString']();var _0x3d5870=path[_0xbb10('0xef')](config[_0xbb10('0xf5')],_0xbb10('0x11a'),_0xbb10('0x11b'),_0xbb10('0x11c'));var _0x81d970=path[_0xbb10('0xef')](config[_0xbb10('0xf5')],'server',_0xbb10('0x11b'),_0xbb10('0x11d'));var _0x4102af=path[_0xbb10('0xef')](_0x3d5870,_0x4739a6);var _0x4d49a7=util[_0xbb10('0xf8')](_0xbb10('0x11e'),_0x4b10ed[_0xbb10('0xc6')]['id'],_0x4739a6);var _0x59fef2=path['join'](_0x3d5870,_0x4d49a7);var _0x3b45c4=[];_0x3b45c4['push']({'model':db[_0xbb10('0x82')],'as':'User','attributes':['id',_0xbb10('0x40')],'raw':!![]});_0x3b45c4[_0xbb10('0x44')]({'model':db[_0xbb10('0xdf')],'as':_0xbb10('0x11f'),'attributes':['id',_0xbb10('0x120'),_0xbb10('0x121')],'raw':!![]});if(_0x4b10ed[_0xbb10('0x4c')]['attachments']){_0x3b45c4[_0xbb10('0x44')]({'model':db[_0xbb10('0xec')],'as':_0xbb10('0xec'),'raw':!![]});}var _0x2807d2=[{'model':db[_0xbb10('0xdc')],'as':_0xbb10('0xf7'),'attributes':['id','body',_0xbb10('0x89'),_0xbb10('0x100'),_0xbb10('0x101'),_0xbb10('0x90')],'include':_0x3b45c4}];_0x2807d2[_0xbb10('0x44')]({'model':db[_0xbb10('0xcf')],'as':_0xbb10('0x122'),'attributes':['id','name']});_0x2807d2[_0xbb10('0x44')]({'model':db[_0xbb10('0x82')],'as':_0xbb10('0x123'),'attributes':['id','fullname']});return db[_0xbb10('0x46')]['find']({'where':{'id':_0x4b10ed[_0xbb10('0xc6')]['id']},'include':_0x2807d2})[_0xbb10('0x22')](handleEntityNotFound(_0x40b5da,null))[_0xbb10('0x22')](function(_0x58a447){if(_0x58a447){var _0x50fa4e=_0x58a447[_0xbb10('0x124')]({'plain':!![]});fs[_0xbb10('0x125')](_0x4102af);var _0xbb410e={'channel':_0xbb10('0x126'),'account':_0x50fa4e[_0xbb10('0x122')][_0xbb10('0x38')],'agent':_0x50fa4e[_0xbb10('0x123')]?_0x50fa4e[_0xbb10('0x123')][_0xbb10('0x40')]:_0xbb10('0x127'),'createdAt':moment(_0x50fa4e[_0xbb10('0x89')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xbb10('0xaa')](),'closedAt':_0x50fa4e[_0xbb10('0xea')]?moment(_0x50fa4e['closedAt'])['format'](_0xbb10('0x112'))[_0xbb10('0xaa')]():'','disposition':_0x50fa4e[_0xbb10('0x128')],'chatInfo':{'browser':_0x50fa4e['browserName'],'os':_0x50fa4e[_0xbb10('0x129')],'referer':_0x50fa4e[_0xbb10('0x12a')],'customerIp':_0x50fa4e['customerIp'],'customerPort':_0x50fa4e[_0xbb10('0x12b')]?_0x50fa4e[_0xbb10('0x12b')]:'N.A.'},'messages':_(_0x50fa4e['Messages'])[_0xbb10('0x12c')]()[_0xbb10('0x94')]({'secret':![]})[_0xbb10('0x3f')](function(_0x5cab64){if(_0x5cab64['Attachment']){var _0x58ee41=path[_0xbb10('0xef')](_0x81d970,_0x5cab64['Attachment'][_0xbb10('0xf2')]);if(fs[_0xbb10('0x12d')](_0x58ee41)){fs['createReadStream'](_0x58ee41)[_0xbb10('0x12e')](fs[_0xbb10('0x12f')](path[_0xbb10('0xef')](_0x4102af,_0x5cab64[_0xbb10('0xec')]['basename'])));}}return{'date':moment(_0x5cab64[_0xbb10('0x89')])['format'](_0xbb10('0x112'))[_0xbb10('0xaa')](),'sender':_0x5cab64[_0xbb10('0x100')]===_0xbb10('0xdb')?_0x5cab64[_0xbb10('0x82')]?_0x5cab64[_0xbb10('0x82')][_0xbb10('0x40')]:_0xbb10('0xfa'):_0x5cab64['Contact'][_0xbb10('0x120')]+(_0x5cab64[_0xbb10('0x11f')][_0xbb10('0x121')]?'\x20'+_0x5cab64[_0xbb10('0x11f')]['lastName']:''),'body':_0x5cab64['Attachment']?_0x5cab64[_0xbb10('0xec')][_0xbb10('0xf2')]:_0x5cab64[_0xbb10('0x3a')],'direction':_0x5cab64[_0xbb10('0x100')]==='out'?'A':'C','secret':_0x5cab64[_0xbb10('0x101')],'read':_0x5cab64[_0xbb10('0x90')],'attachment':_0x5cab64['Attachment']};})[_0xbb10('0x73')]()};return ejs['renderFile'](path['join'](config[_0xbb10('0xf5')],_0xbb10('0x11a'),_0xbb10('0x130'),_0xbb10('0x131')),{'interaction':_0xbb410e})[_0xbb10('0x22')](function(_0x4aa76a){var _0x38403e=path[_0xbb10('0xef')](_0x4102af,_0xbb10('0x132')+_0x50fa4e['id']+'-'+_0x4739a6+_0xbb10('0x133'));var _0x1b7274={'path':_0x38403e,'channel':_0xbb10('0x126'),'interactionId':_0x50fa4e['id']};return pdf[_0xbb10('0x134')](_0x4aa76a,_0x1b7274);})[_0xbb10('0x22')](function(){return new BPromise(function(_0x34f4d6,_0x254b6e){zipdir(_0x4102af,{'saveTo':_0x59fef2},function(_0x368adb,_0xef4ccf){if(_0x368adb)return _0x254b6e(_0x368adb);return _0x34f4d6(_0xef4ccf);});})[_0xbb10('0x22')](function(){return new BPromise(function(_0x9fcc26,_0x111fd4){rimraf(_0x4102af,function(_0x256ce9){if(_0x256ce9)_0x111fd4(_0x256ce9);return _0x9fcc26();});});})[_0xbb10('0x22')](function(){return _0x40b5da[_0xbb10('0x135')](_0x59fef2,_0x4d49a7,function(_0x27e0c5){if(_0x27e0c5){console[_0xbb10('0x136')](_0xbb10('0x137'),_0x27e0c5);}else{fs[_0xbb10('0x138')](_0x59fef2);}});});});}else{return _0x40b5da[_0xbb10('0x2c')](0xc8);}})[_0xbb10('0xc4')](handleError(_0x40b5da,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index d7a802d..74293df 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 _0x4fc6=['../../mysqldb','ChatInteraction','ChatMessage','save','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events'];(function(_0x222ce2,_0x4732be){var _0x5bb103=function(_0x521772){while(--_0x521772){_0x222ce2['push'](_0x222ce2['shift']());}};_0x5bb103(++_0x4732be);}(_0x4fc6,0x143));var _0x64fc=function(_0x3f8bc2,_0x4093cd){_0x3f8bc2=_0x3f8bc2-0x0;var _0x16a48d=_0x4fc6[_0x3f8bc2];return _0x16a48d;};'use strict';var EventEmitter=require(_0x64fc('0x0'));var ChatInteraction=require(_0x64fc('0x1'))['db'][_0x64fc('0x2')];var ChatMessage=require(_0x64fc('0x1'))['db'][_0x64fc('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x64fc('0x4'),'afterUpdate':_0x64fc('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5121d4){return function(_0x10e9ff,_0x22810d,_0x4c94c5){_0x10e9ff[_0x64fc('0x6')]({'attributes':['id'],'raw':!![]})[_0x64fc('0x7')](function(_0x4d1c14){_0x10e9ff[_0x64fc('0x8')](_0x64fc('0x9'),_0x4d1c14[_0x64fc('0xa')](function(_0xcd6c25){return{'id':_0xcd6c25['id']};}));return ChatMessage[_0x64fc('0xb')]({'where':{'ChatInteractionId':_0x10e9ff['id'],'direction':'in','read':![]},'raw':!![]});})[_0x64fc('0x7')](function(_0x3a510f){_0x10e9ff[_0x64fc('0x8')](_0x64fc('0xc'),_0x3a510f[_0x64fc('0xd')]);ChatInteractionEvents[_0x64fc('0xe')](_0x5121d4+':'+_0x10e9ff['id'],_0x10e9ff);ChatInteractionEvents['emit'](_0x5121d4,_0x10e9ff);_0x4c94c5(null);})[_0x64fc('0xf')](_0x4c94c5(null));};}for(var e in events){if(events[_0x64fc('0x10')](e)){var event=events[e];ChatInteraction[_0x64fc('0x11')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0xdfb3=['length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages'];(function(_0x221272,_0x29146a){var _0xe0a9d7=function(_0x44ee43){while(--_0x44ee43){_0x221272['push'](_0x221272['shift']());}};_0xe0a9d7(++_0x29146a);}(_0xdfb3,0x71));var _0x3dfb=function(_0x471f8f,_0x2eaaf8){_0x471f8f=_0x471f8f-0x0;var _0x31da61=_0xdfb3[_0x471f8f];return _0x31da61;};'use strict';var EventEmitter=require(_0x3dfb('0x0'));var ChatInteraction=require(_0x3dfb('0x1'))['db'][_0x3dfb('0x2')];var ChatMessage=require(_0x3dfb('0x1'))['db'][_0x3dfb('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x3dfb('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3dfb('0x5'),'afterDestroy':'remove'};function emitEvent(_0x521eac){return function(_0x1d6406,_0x139f45,_0x2fc583){_0x1d6406[_0x3dfb('0x6')]({'attributes':['id'],'raw':!![]})[_0x3dfb('0x7')](function(_0x164023){_0x1d6406[_0x3dfb('0x8')](_0x3dfb('0x9'),_0x164023[_0x3dfb('0xa')](function(_0x4592b3){return{'id':_0x4592b3['id']};}));return ChatMessage[_0x3dfb('0xb')]({'where':{'ChatInteractionId':_0x1d6406['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3dfb('0x7')](function(_0x41f31e){_0x1d6406[_0x3dfb('0x8')](_0x3dfb('0xc'),_0x41f31e[_0x3dfb('0xd')]);ChatInteractionEvents[_0x3dfb('0xe')](_0x521eac+':'+_0x1d6406['id'],_0x1d6406);ChatInteractionEvents[_0x3dfb('0xe')](_0x521eac,_0x1d6406);_0x2fc583(null);})[_0x3dfb('0xf')](_0x2fc583(null));};}for(var e in events){if(events[_0x3dfb('0x10')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x3dfb('0x11')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 1bc782b..6bb1cd5 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 _0x8939=['utf8mb4','util','../../config/logger','bluebird','path','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x8939,0x15f));var _0x9893=function(_0x42a2d1,_0x55a9c3){_0x42a2d1=_0x42a2d1-0x0;var _0x59d91e=_0x8939[_0x42a2d1];return _0x59d91e;};'use strict';var _=require('lodash');var util=require(_0x9893('0x0'));var logger=require(_0x9893('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9893('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9893('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9893('0x4'));module[_0x9893('0x5')]=function(_0x2c1b86,_0x378e02){return _0x2c1b86[_0x9893('0x6')](_0x9893('0x7'),attributes,{'tableName':_0x9893('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xe1ed9f,_0x50eb6d,_0x108b4b){if(_0xe1ed9f[_0x9893('0x9')](_0x9893('0xa'))){_0xe1ed9f[_0x9893('0xb')]=moment()['format'](_0x9893('0xc'));}_0x108b4b(null,_0xe1ed9f);}},'charset':_0x9893('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x265d=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4'];(function(_0x7a075d,_0x27f098){var _0x44a327=function(_0x1e7d5e){while(--_0x1e7d5e){_0x7a075d['push'](_0x7a075d['shift']());}};_0x44a327(++_0x27f098);}(_0x265d,0x1cc));var _0xd265=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x265d[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0xd265('0x0'));var util=require(_0xd265('0x1'));var logger=require(_0xd265('0x2'))(_0xd265('0x3'));var moment=require(_0xd265('0x4'));var BPromise=require(_0xd265('0x5'));var rp=require(_0xd265('0x6'));var fs=require('fs');var path=require(_0xd265('0x7'));var rimraf=require(_0xd265('0x8'));var config=require(_0xd265('0x9'));var attributes=require(_0xd265('0xa'));module[_0xd265('0xb')]=function(_0x57f64a,_0x14a350){return _0x57f64a[_0xd265('0xc')](_0xd265('0xd'),attributes,{'tableName':_0xd265('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3f7407,_0x4966e6,_0x3ef337){if(_0x3f7407['changed'](_0xd265('0xf'))){_0x3f7407[_0xd265('0x10')]=moment()[_0xd265('0x11')](_0xd265('0x12'));}_0x3ef337(null,_0x3f7407);}},'charset':_0xd265('0x13'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index d10a3fe..23366e8 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 _0x5f75=['find','ids','AddTags','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','socket.io-emitter','register','then','info','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','ChatInteraction,\x20%s,\x20%s','message','request\x20sent','result','ChatInteraction','update','body','options','raw','where','limit','UpdateChatInteraction','stringify','catch'];(function(_0x1e6c80,_0x3f5af7){var _0x3c3ec0=function(_0xdbdc23){while(--_0xdbdc23){_0x1e6c80['push'](_0x1e6c80['shift']());}};_0x3c3ec0(++_0x3f5af7);}(_0x5f75,0x1d7));var _0x55f7=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x5f75[_0x1e7b16];return _0x37fadc;};'use strict';var _=require(_0x55f7('0x0'));var util=require('util');var moment=require(_0x55f7('0x1'));var BPromise=require('bluebird');var rs=require(_0x55f7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x55f7('0x3'))['db'];var utils=require(_0x55f7('0x4'));var logger=require(_0x55f7('0x5'))(_0x55f7('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x55f7('0x7')]['http']({'port':0x232a});config[_0x55f7('0x8')]=_[_0x55f7('0x9')](config['redis'],{'host':_0x55f7('0xa'),'port':0x18eb});var socket=require(_0x55f7('0xb'))(new Redis(config['redis']));require('./chatInteraction.socket')[_0x55f7('0xc')](socket);function respondWithRpcPromise(_0x202b71,_0x20f99c,_0x4ca73d){return new BPromise(function(_0x1db6a1,_0x444224){return client['request'](_0x202b71,_0x4ca73d)[_0x55f7('0xd')](function(_0x1b8e76){logger[_0x55f7('0xe')]('ChatInteraction,\x20%s,\x20%s',_0x20f99c,'request\x20sent');logger[_0x55f7('0xf')](_0x55f7('0x10'),_0x20f99c,'request\x20sent',JSON['stringify'](_0x1b8e76));if(_0x1b8e76[_0x55f7('0x11')]){if(_0x1b8e76[_0x55f7('0x11')][_0x55f7('0x12')]===0x1f4){logger[_0x55f7('0x11')](_0x55f7('0x13'),_0x20f99c,_0x1b8e76['error'][_0x55f7('0x14')]);return _0x444224(_0x1b8e76[_0x55f7('0x11')][_0x55f7('0x14')]);}logger['error'](_0x55f7('0x13'),_0x20f99c,_0x1b8e76[_0x55f7('0x11')][_0x55f7('0x14')]);return _0x1db6a1(_0x1b8e76[_0x55f7('0x11')]['message']);}else{logger[_0x55f7('0xe')](_0x55f7('0x13'),_0x20f99c,_0x55f7('0x15'));_0x1db6a1(_0x1b8e76[_0x55f7('0x16')][_0x55f7('0x14')]);}})['catch'](function(_0x54ff89){logger['error'](_0x55f7('0x13'),_0x20f99c,_0x54ff89);_0x444224(_0x54ff89);});});}exports['UpdateChatInteraction']=function(_0x1eddb9){var _0x195feb=this;return new Promise(function(_0x1bbc5b,_0x1fb2e9){return db[_0x55f7('0x17')][_0x55f7('0x18')](_0x1eddb9[_0x55f7('0x19')],{'raw':_0x1eddb9[_0x55f7('0x1a')]?_0x1eddb9[_0x55f7('0x1a')][_0x55f7('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1eddb9[_0x55f7('0x1a')]?_0x1eddb9['options'][_0x55f7('0x1c')]||null:null,'attributes':_0x1eddb9[_0x55f7('0x1a')]?_0x1eddb9['options']['attributes']||null:null,'limit':_0x1eddb9[_0x55f7('0x1a')]?_0x1eddb9[_0x55f7('0x1a')][_0x55f7('0x1d')]||null:null})[_0x55f7('0xd')](function(_0x2ef812){logger['info'](_0x55f7('0x1e'),_0x1eddb9);logger[_0x55f7('0xf')](_0x55f7('0x1e'),_0x1eddb9,JSON[_0x55f7('0x1f')](_0x2ef812));_0x1bbc5b(_0x2ef812);})[_0x55f7('0x20')](function(_0x5cdcc4){logger['error'](_0x55f7('0x1e'),_0x5cdcc4[_0x55f7('0x14')],_0x1eddb9);_0x1fb2e9(_0x195feb[_0x55f7('0x11')](0x1f4,_0x5cdcc4['message']));});});};exports['AddTagsToChatInteraction']=function(_0x4a2bf2){return new Promise(function(_0x549f81,_0x2bf8c6){return db[_0x55f7('0x17')][_0x55f7('0x21')]({'where':_0x4a2bf2[_0x55f7('0x1a')]?_0x4a2bf2[_0x55f7('0x1a')][_0x55f7('0x1c')]||null:null})[_0x55f7('0xd')](function(_0x1a11b1){if(_0x1a11b1){return _0x1a11b1['addTags'](_0x4a2bf2['body'][_0x55f7('0x22')],_['omit'](_0x4a2bf2[_0x55f7('0x19')],[_0x55f7('0x22'),'id'])||{});}})['spread'](function(_0x3d215e){logger[_0x55f7('0xe')](_0x55f7('0x23'),_0x4a2bf2);logger[_0x55f7('0xf')](_0x55f7('0x23'),_0x4a2bf2,JSON['stringify'](_0x3d215e));_0x549f81(_0x3d215e);})[_0x55f7('0x20')](function(_0xf2dce8){logger[_0x55f7('0x11')](_0x55f7('0x23'),_0xf2dce8['message'],_0x4a2bf2);_0x2bf8c6(_this['error'](0x1f4,_0xf2dce8[_0x55f7('0x14')]));});});}; \ No newline at end of file +var _0xd844=['spread','AddTags','util','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','ChatInteraction','options','raw','where','attributes','limit','UpdateChatInteraction','catch','AddTagsToChatInteraction','find','addTags','body','ids','omit'];(function(_0x267b9a,_0x2243e4){var _0x3759df=function(_0x5818ff){while(--_0x5818ff){_0x267b9a['push'](_0x267b9a['shift']());}};_0x3759df(++_0x2243e4);}(_0xd844,0xe6));var _0x4d84=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xd844[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0x4d84('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4d84('0x1'));var logger=require('../../config/logger')(_0x4d84('0x2'));var config=require('../../config/environment');var jayson=require(_0x4d84('0x3'));var client=jayson[_0x4d84('0x4')]['http']({'port':0x232a});config['redis']=_[_0x4d84('0x5')](config[_0x4d84('0x6')],{'host':_0x4d84('0x7'),'port':0x18eb});var socket=require(_0x4d84('0x8'))(new Redis(config[_0x4d84('0x6')]));require(_0x4d84('0x9'))[_0x4d84('0xa')](socket);function respondWithRpcPromise(_0x6ee723,_0x1a04ca,_0x556626){return new BPromise(function(_0x2a3924,_0x727346){return client[_0x4d84('0xb')](_0x6ee723,_0x556626)[_0x4d84('0xc')](function(_0x36a95d){logger[_0x4d84('0xd')](_0x4d84('0xe'),_0x1a04ca,_0x4d84('0xf'));logger[_0x4d84('0x10')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x1a04ca,_0x4d84('0xf'),JSON[_0x4d84('0x11')](_0x36a95d));if(_0x36a95d['error']){if(_0x36a95d[_0x4d84('0x12')][_0x4d84('0x13')]===0x1f4){logger['error'](_0x4d84('0xe'),_0x1a04ca,_0x36a95d[_0x4d84('0x12')][_0x4d84('0x14')]);return _0x727346(_0x36a95d[_0x4d84('0x12')][_0x4d84('0x14')]);}logger[_0x4d84('0x12')](_0x4d84('0xe'),_0x1a04ca,_0x36a95d[_0x4d84('0x12')][_0x4d84('0x14')]);return _0x2a3924(_0x36a95d['error'][_0x4d84('0x14')]);}else{logger['info'](_0x4d84('0xe'),_0x1a04ca,_0x4d84('0xf'));_0x2a3924(_0x36a95d[_0x4d84('0x15')]['message']);}})['catch'](function(_0x45a33){logger[_0x4d84('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x1a04ca,_0x45a33);_0x727346(_0x45a33);});});}exports['UpdateChatInteraction']=function(_0x4831e2){var _0x1d9acb=this;return new Promise(function(_0x5d9140,_0x4bcc63){return db[_0x4d84('0x16')]['update'](_0x4831e2['body'],{'raw':_0x4831e2[_0x4d84('0x17')]?_0x4831e2[_0x4d84('0x17')][_0x4d84('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4831e2[_0x4d84('0x17')]?_0x4831e2[_0x4d84('0x17')][_0x4d84('0x19')]||null:null,'attributes':_0x4831e2[_0x4d84('0x17')]?_0x4831e2[_0x4d84('0x17')][_0x4d84('0x1a')]||null:null,'limit':_0x4831e2['options']?_0x4831e2['options'][_0x4d84('0x1b')]||null:null})['then'](function(_0xd1cab5){logger[_0x4d84('0xd')](_0x4d84('0x1c'),_0x4831e2);logger['debug'](_0x4d84('0x1c'),_0x4831e2,JSON[_0x4d84('0x11')](_0xd1cab5));_0x5d9140(_0xd1cab5);})[_0x4d84('0x1d')](function(_0xab06e2){logger[_0x4d84('0x12')]('UpdateChatInteraction',_0xab06e2[_0x4d84('0x14')],_0x4831e2);_0x4bcc63(_0x1d9acb[_0x4d84('0x12')](0x1f4,_0xab06e2[_0x4d84('0x14')]));});});};exports[_0x4d84('0x1e')]=function(_0xe2ec9a){return new Promise(function(_0x286b34,_0x32d52b){return db[_0x4d84('0x16')][_0x4d84('0x1f')]({'where':_0xe2ec9a[_0x4d84('0x17')]?_0xe2ec9a['options'][_0x4d84('0x19')]||null:null})[_0x4d84('0xc')](function(_0x1a327a){if(_0x1a327a){return _0x1a327a[_0x4d84('0x20')](_0xe2ec9a[_0x4d84('0x21')][_0x4d84('0x22')],_[_0x4d84('0x23')](_0xe2ec9a[_0x4d84('0x21')],['ids','id'])||{});}})[_0x4d84('0x24')](function(_0x4580b5){logger['info']('AddTags',_0xe2ec9a);logger[_0x4d84('0x10')](_0x4d84('0x25'),_0xe2ec9a,JSON[_0x4d84('0x11')](_0x4580b5));_0x286b34(_0x4580b5);})['catch'](function(_0x38a166){logger[_0x4d84('0x12')](_0x4d84('0x25'),_0x38a166[_0x4d84('0x14')],_0xe2ec9a);_0x32d52b(_this['error'](0x1f4,_0x38a166[_0x4d84('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 3b77cc3..b286e05 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 _0xd0ae=['update','emit','register','length','./chatInteraction.events','save'];(function(_0x4be1e5,_0x23a9fb){var _0x4df4d2=function(_0x16b519){while(--_0x16b519){_0x4be1e5['push'](_0x4be1e5['shift']());}};_0x4df4d2(++_0x23a9fb);}(_0xd0ae,0x160));var _0xed0a=function(_0x552f5b,_0x4cfa89){_0x552f5b=_0x552f5b-0x0;var _0x2bebd2=_0xd0ae[_0x552f5b];return _0x2bebd2;};'use strict';var ChatInteractionEvents=require(_0xed0a('0x0'));var events=[_0xed0a('0x1'),'remove',_0xed0a('0x2')];function createListener(_0x4c59b9,_0x377708){return function(_0x419790){_0x377708[_0xed0a('0x3')](_0x4c59b9,_0x419790);};}function removeListener(_0x11748b,_0x1b202f){return function(){ChatInteractionEvents['removeListener'](_0x11748b,_0x1b202f);};}exports[_0xed0a('0x4')]=function(_0x1c7a79){for(var _0xbfe1f9=0x0,_0x3747ce=events[_0xed0a('0x5')];_0xbfe1f9<_0x3747ce;_0xbfe1f9++){var _0x11534a=events[_0xbfe1f9];var _0x41ed4b=createListener('chatInteraction:'+_0x11534a,_0x1c7a79);ChatInteractionEvents['on'](_0x11534a,_0x41ed4b);}}; \ No newline at end of file +var _0x37cb=['removeListener','register','length','./chatInteraction.events','save','remove','emit'];(function(_0x349367,_0x1cede2){var _0x14179b=function(_0x38a191){while(--_0x38a191){_0x349367['push'](_0x349367['shift']());}};_0x14179b(++_0x1cede2);}(_0x37cb,0x106));var _0xb37c=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0x37cb[_0x17406a];return _0x1501ff;};'use strict';var ChatInteractionEvents=require(_0xb37c('0x0'));var events=[_0xb37c('0x1'),_0xb37c('0x2'),'update'];function createListener(_0x3c3dcf,_0x21ca77){return function(_0x4c0d7e){_0x21ca77[_0xb37c('0x3')](_0x3c3dcf,_0x4c0d7e);};}function removeListener(_0x2b825d,_0x1dd1e7){return function(){ChatInteractionEvents[_0xb37c('0x4')](_0x2b825d,_0x1dd1e7);};}exports[_0xb37c('0x5')]=function(_0x18671f){for(var _0x5c2a64=0x0,_0x47d7d6=events[_0xb37c('0x6')];_0x5c2a64<_0x47d7d6;_0x5c2a64++){var _0x395529=events[_0x5c2a64];var _0x1375a4=createListener('chatInteraction:'+_0x395529,_0x18671f);ChatInteractionEvents['on'](_0x395529,_0x1375a4);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 455623c..9093d45 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 _0x2511=['addMessage','/:id/tags','tracked','chat','addTags','put','chatinteraction:update','update','customUpdate','/:id/abandon','abandon','delete','chatinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages','/:id/my_messages','getMyMessages','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','format','%s-%s','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload'];(function(_0x1d0395,_0x59b0de){var _0x1e4e75=function(_0x2915c5){while(--_0x2915c5){_0x1d0395['push'](_0x1d0395['shift']());}};_0x1e4e75(++_0x59b0de);}(_0x2511,0x1b7));var _0x1251=function(_0x1a0ebb,_0x33f753){_0x1a0ebb=_0x1a0ebb-0x0;var _0x2707d8=_0x2511[_0x1a0ebb];return _0x2707d8;};'use strict';var multer=require(_0x1251('0x0'));var util=require(_0x1251('0x1'));var path=require(_0x1251('0x2'));var timeout=require(_0x1251('0x3'));var express=require(_0x1251('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1251('0x5'));var interaction=require(_0x1251('0x6'));var config=require(_0x1251('0x7'));var controller=require(_0x1251('0x8'));router['get']('/',auth[_0x1251('0x9')](),controller[_0x1251('0xa')]);router[_0x1251('0xb')](_0x1251('0xc'),auth[_0x1251('0x9')](),controller[_0x1251('0xd')]);router['get'](_0x1251('0xe'),auth['isChatInteractionAuthorized'](),controller[_0x1251('0xf')]);router['get'](_0x1251('0x10'),auth[_0x1251('0x11')](),controller[_0x1251('0x12')]);router[_0x1251('0xb')](_0x1251('0x13'),auth[_0x1251('0x9')](),controller['getMessages']);router[_0x1251('0xb')](_0x1251('0x14'),auth['isChatInteractionAuthorized'](),controller[_0x1251('0x15')]);router[_0x1251('0xb')]('/:id/download',auth[_0x1251('0x9')](),controller[_0x1251('0x16')]);router[_0x1251('0x17')]('/',auth[_0x1251('0x9')](),controller[_0x1251('0x18')]);router[_0x1251('0x17')](_0x1251('0x19'),auth[_0x1251('0x9')](),controller[_0x1251('0x1a')]);var upload=multer({'storage':multer[_0x1251('0x1b')]({'destination':function(_0x24674a,_0x16a034,_0x10ea17){_0x10ea17(null,path[_0x1251('0x1c')](config[_0x1251('0x1d')],'server/files/attachments/'));},'filename':function(_0x4de35c,_0x5967ab,_0x18c295){_0x18c295(null,util[_0x1251('0x1e')](_0x1251('0x1f'),Date['now'](),_0x5967ab[_0x1251('0x20')][_0x1251('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x1251('0x22'),upload[_0x1251('0x23')](_0x1251('0x24')),controller[_0x1251('0x25')]);router[_0x1251('0x17')](_0x1251('0x13'),auth[_0x1251('0x11')](),controller[_0x1251('0x26')]);router[_0x1251('0x17')](_0x1251('0x27'),auth[_0x1251('0x9')](),interaction[_0x1251('0x28')](_0x1251('0x29'),'chatinteraction:addtags'),controller[_0x1251('0x2a')]);router[_0x1251('0x2b')](_0x1251('0xe'),auth['isAuthenticated'](),interaction[_0x1251('0x28')](_0x1251('0x29'),_0x1251('0x2c')),controller[_0x1251('0x2d')]);router['put']('/:id/custom_update',controller[_0x1251('0x2e')]);router[_0x1251('0x2b')](_0x1251('0x2f'),auth[_0x1251('0x11')](),controller[_0x1251('0x30')]);router[_0x1251('0x2b')]('/:id/close',controller['close']);router[_0x1251('0x31')](_0x1251('0xe'),auth[_0x1251('0x9')](),interaction[_0x1251('0x28')](_0x1251('0x29'),_0x1251('0x32')),controller[_0x1251('0x33')]);router[_0x1251('0x31')](_0x1251('0x27'),auth[_0x1251('0x9')](),controller['removeTags']);module[_0x1251('0x34')]=router; \ No newline at end of file +var _0x7b52=['addMessage','tracked','chat','chatinteraction:addtags','addTags','put','update','customUpdate','/:id/abandon','close','delete','chatinteraction:destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','isAuthenticated','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','create','post','/:id/vidaoo','createVidaooSession','diskStorage','root','format','%s-%s','originalname','replace','/:id/attachment_upload','single','attachmentUpload'];(function(_0x29bcd1,_0x321aab){var _0xe7f9cb=function(_0x250661){while(--_0x250661){_0x29bcd1['push'](_0x29bcd1['shift']());}};_0xe7f9cb(++_0x321aab);}(_0x7b52,0x107));var _0x27b5=function(_0x248d46,_0xba08ec){_0x248d46=_0x248d46-0x0;var _0x354942=_0x7b52[_0x248d46];return _0x354942;};'use strict';var multer=require(_0x27b5('0x0'));var util=require(_0x27b5('0x1'));var path=require(_0x27b5('0x2'));var timeout=require(_0x27b5('0x3'));var express=require(_0x27b5('0x4'));var router=express[_0x27b5('0x5')]();var fs_extra=require(_0x27b5('0x6'));var auth=require(_0x27b5('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x27b5('0x8'));var controller=require('./chatInteraction.controller');router[_0x27b5('0x9')]('/',auth['isAuthenticated'](),controller[_0x27b5('0xa')]);router[_0x27b5('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x27b5('0xb')]);router[_0x27b5('0x9')](_0x27b5('0xc'),auth[_0x27b5('0xd')](),controller[_0x27b5('0xe')]);router['get'](_0x27b5('0xf'),auth[_0x27b5('0xd')](),controller[_0x27b5('0x10')]);router['get'](_0x27b5('0x11'),auth[_0x27b5('0x12')](),controller[_0x27b5('0x13')]);router['get'](_0x27b5('0x14'),auth[_0x27b5('0xd')](),controller[_0x27b5('0x15')]);router[_0x27b5('0x9')](_0x27b5('0x16'),auth[_0x27b5('0x12')](),controller[_0x27b5('0x17')]);router['post']('/',auth[_0x27b5('0x12')](),controller[_0x27b5('0x18')]);router[_0x27b5('0x19')](_0x27b5('0x1a'),auth[_0x27b5('0x12')](),controller[_0x27b5('0x1b')]);var upload=multer({'storage':multer[_0x27b5('0x1c')]({'destination':function(_0x44a1cb,_0x18f98d,_0xa5595d){_0xa5595d(null,path['join'](config[_0x27b5('0x1d')],'server/files/attachments/'));},'filename':function(_0x3669e9,_0x2ebb4e,_0x4501f7){_0x4501f7(null,util[_0x27b5('0x1e')](_0x27b5('0x1f'),Date['now'](),_0x2ebb4e[_0x27b5('0x20')][_0x27b5('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x27b5('0x19')](_0x27b5('0x22'),upload[_0x27b5('0x23')]('file'),controller[_0x27b5('0x24')]);router[_0x27b5('0x19')](_0x27b5('0x11'),auth[_0x27b5('0xd')](),controller[_0x27b5('0x25')]);router[_0x27b5('0x19')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x27b5('0x26')](_0x27b5('0x27'),_0x27b5('0x28')),controller[_0x27b5('0x29')]);router[_0x27b5('0x2a')](_0x27b5('0xc'),auth[_0x27b5('0x12')](),interaction[_0x27b5('0x26')](_0x27b5('0x27'),'chatinteraction:update'),controller[_0x27b5('0x2b')]);router['put']('/:id/custom_update',controller[_0x27b5('0x2c')]);router[_0x27b5('0x2a')](_0x27b5('0x2d'),auth[_0x27b5('0xd')](),controller['abandon']);router[_0x27b5('0x2a')]('/:id/close',controller[_0x27b5('0x2e')]);router[_0x27b5('0x2f')]('/:id',auth[_0x27b5('0x12')](),interaction['tracked'](_0x27b5('0x27'),_0x27b5('0x30')),controller['destroy']);router[_0x27b5('0x2f')]('/:id/tags',auth[_0x27b5('0x12')](),controller['removeTags']);module[_0x27b5('0x31')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index c328527..139e114 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 _0xf343=['INTEGER','medium','BOOLEAN'];(function(_0x5818e5,_0x4a974b){var _0x19dffd=function(_0x259381){while(--_0x259381){_0x5818e5['push'](_0x5818e5['shift']());}};_0x19dffd(++_0x4a974b);}(_0xf343,0x12d));var _0x3f34=function(_0x429f82,_0x211f75){_0x429f82=_0x429f82-0x0;var _0x4d82bb=_0xf343[_0x429f82];return _0x4d82bb;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0x3f34('0x0')),'allowNull':![]},'read':{'type':Sequelize[_0x3f34('0x1')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x3f34('0x2')]}}; \ No newline at end of file +var _0x8859=['TEXT','BOOLEAN','INTEGER','exports'];(function(_0x56636c,_0x2655e0){var _0x48d630=function(_0x212d6b){while(--_0x212d6b){_0x56636c['push'](_0x56636c['shift']());}};_0x48d630(++_0x2655e0);}(_0x8859,0x11b));var _0x9885=function(_0x2806a0,_0x59d903){_0x2806a0=_0x2806a0-0x0;var _0x59a04d=_0x8859[_0x2806a0];return _0x59a04d;};'use strict';var Sequelize=require('sequelize');module[_0x9885('0x0')]={'body':{'type':Sequelize[_0x9885('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x9885('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x9885('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index d7ad004..6034c24 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 _0x98e9=['filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','then','params','keys','find','catch','create','body','describe','get','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','User','findAll','user','role','userpic','internal','showWebBar','-online','VoiceQueue','VoiceQueues','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','agent','resourceId','push','messages','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','sendStatus','status','json','offset','undefined','limit','count','reject','save','update','destroy','end','error','stack','name','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query'];(function(_0x58cf25,_0x81c579){var _0x5ea98c=function(_0x23b4c2){while(--_0x23b4c2){_0x58cf25['push'](_0x58cf25['shift']());}};_0x5ea98c(++_0x81c579);}(_0x98e9,0x170));var _0x998e=function(_0x370bc1,_0x48b79f){_0x370bc1=_0x370bc1-0x0;var _0xea7580=_0x98e9[_0x370bc1];return _0xea7580;};'use strict';var emlformat=require(_0x998e('0x0'));var rimraf=require(_0x998e('0x1'));var zipdir=require(_0x998e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x998e('0x3'));var moment=require(_0x998e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x998e('0x5'));var util=require(_0x998e('0x6'));var path=require(_0x998e('0x7'));var sox=require(_0x998e('0x8'));var csv=require(_0x998e('0x9'));var ejs=require(_0x998e('0xa'));var fs=require('fs');var fs_extra=require(_0x998e('0xb'));var _=require(_0x998e('0xc'));var squel=require(_0x998e('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x998e('0xe'));var toCsv=require(_0x998e('0x9'));var querystring=require(_0x998e('0xf'));var Papa=require(_0x998e('0x10'));var Redis=require(_0x998e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x998e('0x12'));var as=require(_0x998e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x998e('0x14'))(_0x998e('0x15'));var utils=require('../../config/utils');var config=require(_0x998e('0x16'));var licenseUtil=require(_0x998e('0x17'));var db=require(_0x998e('0x18'))['db'];config[_0x998e('0x19')]=_['defaults'](config['redis'],{'host':_0x998e('0x1a'),'port':0x18eb});var socket=require(_0x998e('0x1b'))(new Redis(config[_0x998e('0x19')]));require(_0x998e('0x1c'))['register'](socket);function respondWithStatusCode(_0x545951,_0x569b75){_0x569b75=_0x569b75||0xcc;return function(_0x2c12ba){if(_0x2c12ba){return _0x545951[_0x998e('0x1d')](_0x569b75);}return _0x545951[_0x998e('0x1e')](_0x569b75)['end']();};}function respondWithResult(_0x18b19a,_0x467f18){_0x467f18=_0x467f18||0xc8;return function(_0x139104){if(_0x139104){return _0x18b19a[_0x998e('0x1e')](_0x467f18)[_0x998e('0x1f')](_0x139104);}};}function respondWithFilteredResult(_0x38ca28,_0x232b36){return function(_0x1fc93e){if(_0x1fc93e){var _0x51f6db=typeof _0x232b36[_0x998e('0x20')]===_0x998e('0x21')&&typeof _0x232b36[_0x998e('0x22')]===_0x998e('0x21');var _0x4240fe=_0x1fc93e['count'];var _0x10aaf6=_0x51f6db?0x0:_0x232b36[_0x998e('0x20')];var _0xb114d2=_0x51f6db?_0x1fc93e[_0x998e('0x23')]:_0x232b36[_0x998e('0x20')]+_0x232b36[_0x998e('0x22')];var _0x96baa;if(_0xb114d2>=_0x4240fe){_0xb114d2=_0x4240fe;_0x96baa=0xc8;}else{_0x96baa=0xce;}_0x38ca28[_0x998e('0x1e')](_0x96baa);return _0x38ca28['set']('Content-Range',_0x10aaf6+'-'+_0xb114d2+'/'+_0x4240fe)[_0x998e('0x1f')](_0x1fc93e);}return null;};}function patchUpdates(_0x52d6de){return function(_0x489208){try{jsonpatch['apply'](_0x489208,_0x52d6de,!![]);}catch(_0x4f3756){return BPromise[_0x998e('0x24')](_0x4f3756);}return _0x489208[_0x998e('0x25')]();};}function saveUpdates(_0x3854ad,_0x2eda6a){return function(_0x7b518c){if(_0x7b518c){return _0x7b518c[_0x998e('0x26')](_0x3854ad)['then'](function(_0x5568af){return _0x5568af;});}return null;};}function removeEntity(_0x5c9bf0,_0x17f501){return function(_0x1a4c63){if(_0x1a4c63){return _0x1a4c63[_0x998e('0x27')]()['then'](function(){_0x5c9bf0[_0x998e('0x1e')](0xcc)[_0x998e('0x28')]();});}};}function handleEntityNotFound(_0x54b0f7,_0x384ab2){return function(_0xe1e234){if(!_0xe1e234){_0x54b0f7['sendStatus'](0x194);}return _0xe1e234;};}function handleError(_0x6e566d,_0x292c83){_0x292c83=_0x292c83||0x1f4;return function(_0x251bf1){logger[_0x998e('0x29')](_0x251bf1[_0x998e('0x2a')]);if(_0x251bf1[_0x998e('0x2b')]){delete _0x251bf1[_0x998e('0x2b')];}_0x6e566d[_0x998e('0x1e')](_0x292c83)['send'](_0x251bf1);};}exports['index']=function(_0x5d8f1f,_0x5b7ce3){var _0x1f771f={},_0x1defec={},_0x4ac9e9={'count':0x0,'rows':[]};var _0x14f06e=_[_0x998e('0x2c')](db[_0x998e('0x2d')][_0x998e('0x2e')],function(_0x4eef1b){return{'name':_0x4eef1b[_0x998e('0x2f')],'type':_0x4eef1b[_0x998e('0x30')][_0x998e('0x31')]};});_0x1defec[_0x998e('0x32')]=_['map'](_0x14f06e,_0x998e('0x2b'));_0x1defec[_0x998e('0x33')]=_['keys'](_0x5d8f1f['query']);_0x1defec[_0x998e('0x34')]=_[_0x998e('0x35')](_0x1defec['model'],_0x1defec[_0x998e('0x33')]);_0x1f771f[_0x998e('0x36')]=_[_0x998e('0x35')](_0x1defec['model'],qs[_0x998e('0x37')](_0x5d8f1f[_0x998e('0x33')]['fields']));_0x1f771f[_0x998e('0x36')]=_0x1f771f[_0x998e('0x36')][_0x998e('0x38')]?_0x1f771f[_0x998e('0x36')]:_0x1defec[_0x998e('0x32')];if(!_0x5d8f1f[_0x998e('0x33')][_0x998e('0x39')]('nolimit')){_0x1f771f[_0x998e('0x22')]=qs['limit'](_0x5d8f1f[_0x998e('0x33')][_0x998e('0x22')]);_0x1f771f[_0x998e('0x20')]=qs[_0x998e('0x20')](_0x5d8f1f['query'][_0x998e('0x20')]);}_0x1f771f[_0x998e('0x3a')]=qs[_0x998e('0x3b')](_0x5d8f1f[_0x998e('0x33')]['sort']);_0x1f771f['where']=qs[_0x998e('0x34')](_['pick'](_0x5d8f1f[_0x998e('0x33')],_0x1defec[_0x998e('0x34')]),_0x14f06e);if(_0x5d8f1f[_0x998e('0x33')]['filter']){_0x1f771f[_0x998e('0x3c')]=_[_0x998e('0x3d')](_0x1f771f[_0x998e('0x3c')],{'$or':_['map'](_0x14f06e,function(_0x1db07a){if(_0x1db07a['type']!==_0x998e('0x3e')){var _0x2a024a={};_0x2a024a[_0x1db07a[_0x998e('0x2b')]]={'$like':'%'+_0x5d8f1f[_0x998e('0x33')][_0x998e('0x3f')]+'%'};return _0x2a024a;}})});}_0x1f771f=_[_0x998e('0x3d')]({},_0x1f771f,_0x5d8f1f[_0x998e('0x40')]);var _0x583724={'where':_0x1f771f[_0x998e('0x3c')]};return db['ChatInternalMessage'][_0x998e('0x23')](_0x583724)['then'](function(_0x4439fe){_0x4ac9e9[_0x998e('0x23')]=_0x4439fe;if(_0x5d8f1f[_0x998e('0x33')][_0x998e('0x41')]){_0x1f771f[_0x998e('0x42')]=[{'all':!![]}];}return db[_0x998e('0x2d')]['findAll'](_0x1f771f);})['then'](function(_0x35e1a5){_0x4ac9e9['rows']=_0x35e1a5;return _0x4ac9e9;})[_0x998e('0x43')](respondWithFilteredResult(_0x5b7ce3,_0x1f771f))['catch'](handleError(_0x5b7ce3,null));};exports['show']=function(_0xb5a232,_0x52286b){var _0x1f88a1={'raw':!![],'where':{'id':_0xb5a232[_0x998e('0x44')]['id']}},_0x757c08={};_0x757c08[_0x998e('0x32')]=_[_0x998e('0x45')](db[_0x998e('0x2d')]['rawAttributes']);_0x757c08['query']=_[_0x998e('0x45')](_0xb5a232[_0x998e('0x33')]);_0x757c08[_0x998e('0x34')]=_[_0x998e('0x35')](_0x757c08['model'],_0x757c08[_0x998e('0x33')]);_0x1f88a1['attributes']=_['intersection'](_0x757c08['model'],qs[_0x998e('0x37')](_0xb5a232[_0x998e('0x33')][_0x998e('0x37')]));_0x1f88a1[_0x998e('0x36')]=_0x1f88a1['attributes']['length']?_0x1f88a1['attributes']:_0x757c08[_0x998e('0x32')];if(_0xb5a232['query'][_0x998e('0x41')]){_0x1f88a1[_0x998e('0x42')]=[{'all':!![]}];}_0x1f88a1=_[_0x998e('0x3d')]({},_0x1f88a1,_0xb5a232[_0x998e('0x40')]);return db[_0x998e('0x2d')][_0x998e('0x46')](_0x1f88a1)[_0x998e('0x43')](handleEntityNotFound(_0x52286b,null))[_0x998e('0x43')](respondWithResult(_0x52286b,null))[_0x998e('0x47')](handleError(_0x52286b,null));};exports[_0x998e('0x48')]=function(_0x20b8e7,_0x1ecb3a){return db['ChatInternalMessage'][_0x998e('0x48')](_0x20b8e7[_0x998e('0x49')],{})[_0x998e('0x43')](respondWithResult(_0x1ecb3a,0xc9))['catch'](handleError(_0x1ecb3a,null));};exports['update']=function(_0x35a0a0,_0x1aea19){if(_0x35a0a0['body']['id']){delete _0x35a0a0['body']['id'];}return db[_0x998e('0x2d')][_0x998e('0x46')]({'where':{'id':_0x35a0a0['params']['id']}})[_0x998e('0x43')](handleEntityNotFound(_0x1aea19,null))[_0x998e('0x43')](saveUpdates(_0x35a0a0[_0x998e('0x49')],null))[_0x998e('0x43')](respondWithResult(_0x1aea19,null))['catch'](handleError(_0x1aea19,null));};exports[_0x998e('0x27')]=function(_0x3bf4fa,_0x326281){return db[_0x998e('0x2d')][_0x998e('0x46')]({'where':{'id':_0x3bf4fa[_0x998e('0x44')]['id']}})['then'](handleEntityNotFound(_0x326281,null))[_0x998e('0x43')](removeEntity(_0x326281,null))['catch'](handleError(_0x326281,null));};exports['describe']=function(_0x15922c,_0x3693ff){return db[_0x998e('0x2d')][_0x998e('0x4a')]()[_0x998e('0x43')](respondWithResult(_0x3693ff,null))[_0x998e('0x47')](handleError(_0x3693ff,null));};function wrapUser(_0x56b933){return function(_0x23a076){var _0x135094=_0x56b933[_0x998e('0x4b')]({'plain':!![]});_0x135094['messages']=[];if(_0x23a076){_0x135094[_0x998e('0x4c')]=_0x23a076[_0x998e('0x4d')];_0x135094[_0x998e('0x4e')]=_0x23a076;}else{_0x135094[_0x998e('0x4c')]=moment(0x0)[_0x998e('0x4f')](_0x998e('0x50'));_0x135094[_0x998e('0x4e')]={};}return _0x135094;};}exports['getUsers']=function(_0x4e6324,_0x6a613d,_0x570009){var _0x3f8883=[];return db[_0x998e('0x51')][_0x998e('0x52')]({'where':{'role':['agent','admin',_0x998e('0x53')]},'attributes':['id','fullname','name',_0x998e('0x54'),_0x998e('0x55'),_0x998e('0x56'),'online','lastLoginAt','allowmessenger',_0x998e('0x57')],'order':qs['sort'](_0x998e('0x58')),'include':[{'model':db[_0x998e('0x59')],'as':_0x998e('0x5a'),'attributes':['id',_0x998e('0x2b'),_0x998e('0x30')],'through':{'attributes':[]}}]})[_0x998e('0x43')](function(_0x425685){if(_0x425685){var _0x25ba37=_0x4e6324['user'][_0x998e('0x4b')]({'plain':!![]});if(!_0x25ba37)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x25ba37['role']===_0x998e('0x53')){return db[_0x998e('0x5b')]['find']({'where':{'name':_0x998e('0x5c'),'userProfileId':_0x25ba37[_0x998e('0x5d')]},'raw':!![]})[_0x998e('0x43')](function(_0x4fe535){if(_0x4fe535){if(_0x4fe535[_0x998e('0x5e')]===0x0){return db[_0x998e('0x5f')][_0x998e('0x52')]({'where':{'sectionId':_0x4fe535['id']},'raw':!![]})[_0x998e('0x43')](function(_0x43ada4){var _0x2eb5fd=[];if(_[_0x998e('0x60')](_0x43ada4)){_0x2eb5fd=_[_0x998e('0x3f')](_0x425685,function(_0x2d161b){if(_0x2d161b[_0x998e('0x54')]!==_0x998e('0x61')){return _0x2d161b;}});return _0x2eb5fd;}else{for(var _0x4f9750=0x0;_0x4f9750<_0x425685[_0x998e('0x38')];_0x4f9750++){var _0x280003=_0x425685[_0x4f9750];if(_0x280003['role']===_0x998e('0x61')){var _0x19927c=_[_0x998e('0x46')](_0x43ada4,function(_0x3c06d5){return _0x3c06d5[_0x998e('0x62')]===_0x280003['id'];});if(_0x19927c)_0x2eb5fd[_0x998e('0x63')](_0x280003);}else{_0x2eb5fd[_0x998e('0x63')](_0x280003);}}return _0x2eb5fd;}});}else{return _0x425685;}}else{var _0xc8e0c7=_[_0x998e('0x3f')](_0x425685,function(_0x12baed){if(_0x12baed[_0x998e('0x54')]!==_0x998e('0x61')){return _0x12baed;}});return _0xc8e0c7;}});}else{return _0x425685;}}})['then'](function(_0x1589ad){var _0x2ebf11=[];if(_0x1589ad){_0x3f8883=_0x1589ad;for(var _0x205bda=0x0;_0x205bda<_0x1589ad[_0x998e('0x38')];_0x205bda+=0x1){_0x3f8883[_0x205bda][_0x998e('0x64')]=[];_0x2ebf11[_0x998e('0x63')](db['ChatInternalMessage'][_0x998e('0x46')]({'where':{'FromId':[_0x4e6324[_0x998e('0x53')]['id'],_0x1589ad[_0x205bda]['id']],'ToId':[_0x4e6324[_0x998e('0x53')]['id'],_0x1589ad[_0x205bda]['id']],'ChatGroupId':null},'attributes':['id',_0x998e('0x4d'),'FromId',_0x998e('0x65'),_0x998e('0x66'),'body'],'order':qs['sort'](_0x998e('0x67')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x998e('0x43')](wrapUser(_0x1589ad[_0x205bda])));}return BPromise[_0x998e('0x68')](_0x2ebf11);}return[];})['then'](function(_0x32721e){return{'rows':_0x32721e,'count':_0x32721e['length']};})[_0x998e('0x43')](respondWithResult(_0x6a613d,null))[_0x998e('0x47')](handleError(_0x6a613d,null));}; \ No newline at end of file +var _0xc534=['describe','get','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','fullname','lastLoginAt','allowmessenger','showWebBar','-online','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Agents','userProfileId','autoAssociation','isEmpty','role','agent','resourceId','push','messages','createdAt','FromId','ToId','all','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','include','ChatInternalMessage','findAll','rows','catch','params','keys','length','options','find','create','update','body'];(function(_0x14afa0,_0x14bc2b){var _0x1853a2=function(_0x5afc2d){while(--_0x5afc2d){_0x14afa0['push'](_0x14afa0['shift']());}};_0x1853a2(++_0x14bc2b);}(_0xc534,0xf5));var _0x4c53=function(_0x1bad8a,_0x4a160f){_0x1bad8a=_0x1bad8a-0x0;var _0xfa3b6b=_0xc534[_0x1bad8a];return _0xfa3b6b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4c53('0x0'));var rp=require('request-promise');var moment=require(_0x4c53('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x4c53('0x2'));var util=require(_0x4c53('0x3'));var path=require(_0x4c53('0x4'));var sox=require(_0x4c53('0x5'));var csv=require(_0x4c53('0x6'));var ejs=require(_0x4c53('0x7'));var fs=require('fs');var fs_extra=require(_0x4c53('0x8'));var _=require('lodash');var squel=require(_0x4c53('0x9'));var crypto=require(_0x4c53('0xa'));var jsforce=require(_0x4c53('0xb'));var deskjs=require(_0x4c53('0xc'));var toCsv=require(_0x4c53('0x6'));var querystring=require('querystring');var Papa=require(_0x4c53('0xd'));var Redis=require(_0x4c53('0xe'));var authService=require(_0x4c53('0xf'));var qs=require(_0x4c53('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4c53('0x11'));var logger=require(_0x4c53('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x4c53('0x13'));var licenseUtil=require(_0x4c53('0x14'));var db=require(_0x4c53('0x15'))['db'];config[_0x4c53('0x16')]=_[_0x4c53('0x17')](config[_0x4c53('0x16')],{'host':_0x4c53('0x18'),'port':0x18eb});var socket=require(_0x4c53('0x19'))(new Redis(config[_0x4c53('0x16')]));require(_0x4c53('0x1a'))[_0x4c53('0x1b')](socket);function respondWithStatusCode(_0x1ec7fb,_0x2c3170){_0x2c3170=_0x2c3170||0xcc;return function(_0x3eb3ba){if(_0x3eb3ba){return _0x1ec7fb[_0x4c53('0x1c')](_0x2c3170);}return _0x1ec7fb[_0x4c53('0x1d')](_0x2c3170)[_0x4c53('0x1e')]();};}function respondWithResult(_0x589832,_0x53a07b){_0x53a07b=_0x53a07b||0xc8;return function(_0x2d393d){if(_0x2d393d){return _0x589832[_0x4c53('0x1d')](_0x53a07b)['json'](_0x2d393d);}};}function respondWithFilteredResult(_0x195532,_0x11e6e4){return function(_0x33e0f5){if(_0x33e0f5){var _0x38f69c=typeof _0x11e6e4[_0x4c53('0x1f')]===_0x4c53('0x20')&&typeof _0x11e6e4[_0x4c53('0x21')]===_0x4c53('0x20');var _0x4467a4=_0x33e0f5[_0x4c53('0x22')];var _0x33f1d9=_0x38f69c?0x0:_0x11e6e4[_0x4c53('0x1f')];var _0x4345cf=_0x38f69c?_0x33e0f5[_0x4c53('0x22')]:_0x11e6e4['offset']+_0x11e6e4[_0x4c53('0x21')];var _0x679e20;if(_0x4345cf>=_0x4467a4){_0x4345cf=_0x4467a4;_0x679e20=0xc8;}else{_0x679e20=0xce;}_0x195532[_0x4c53('0x1d')](_0x679e20);return _0x195532[_0x4c53('0x23')](_0x4c53('0x24'),_0x33f1d9+'-'+_0x4345cf+'/'+_0x4467a4)['json'](_0x33e0f5);}return null;};}function patchUpdates(_0x1d5431){return function(_0xbe0f7d){try{jsonpatch[_0x4c53('0x25')](_0xbe0f7d,_0x1d5431,!![]);}catch(_0x1f386d){return BPromise['reject'](_0x1f386d);}return _0xbe0f7d[_0x4c53('0x26')]();};}function saveUpdates(_0x595c5f,_0x190340){return function(_0x183241){if(_0x183241){return _0x183241['update'](_0x595c5f)['then'](function(_0x43ffd7){return _0x43ffd7;});}return null;};}function removeEntity(_0x5a4852,_0xbd4371){return function(_0x5d5c08){if(_0x5d5c08){return _0x5d5c08[_0x4c53('0x27')]()[_0x4c53('0x28')](function(){_0x5a4852[_0x4c53('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x396ef4,_0x3388d9){return function(_0x4891f7){if(!_0x4891f7){_0x396ef4[_0x4c53('0x1c')](0x194);}return _0x4891f7;};}function handleError(_0x1444f2,_0x282c09){_0x282c09=_0x282c09||0x1f4;return function(_0x359bd7){logger[_0x4c53('0x29')](_0x359bd7[_0x4c53('0x2a')]);if(_0x359bd7[_0x4c53('0x2b')]){delete _0x359bd7[_0x4c53('0x2b')];}_0x1444f2['status'](_0x282c09)[_0x4c53('0x2c')](_0x359bd7);};}exports[_0x4c53('0x2d')]=function(_0x3ef1ff,_0x48f6df){var _0xcc92fd={},_0x145df5={},_0x4f932f={'count':0x0,'rows':[]};var _0x3a2df9=_[_0x4c53('0x2e')](db['ChatInternalMessage'][_0x4c53('0x2f')],function(_0x4525db){return{'name':_0x4525db[_0x4c53('0x30')],'type':_0x4525db['type'][_0x4c53('0x31')]};});_0x145df5[_0x4c53('0x32')]=_[_0x4c53('0x2e')](_0x3a2df9,_0x4c53('0x2b'));_0x145df5[_0x4c53('0x33')]=_['keys'](_0x3ef1ff[_0x4c53('0x33')]);_0x145df5[_0x4c53('0x34')]=_[_0x4c53('0x35')](_0x145df5[_0x4c53('0x32')],_0x145df5[_0x4c53('0x33')]);_0xcc92fd[_0x4c53('0x36')]=_['intersection'](_0x145df5[_0x4c53('0x32')],qs[_0x4c53('0x37')](_0x3ef1ff['query'][_0x4c53('0x37')]));_0xcc92fd['attributes']=_0xcc92fd[_0x4c53('0x36')]['length']?_0xcc92fd['attributes']:_0x145df5['model'];if(!_0x3ef1ff[_0x4c53('0x33')][_0x4c53('0x38')]('nolimit')){_0xcc92fd[_0x4c53('0x21')]=qs[_0x4c53('0x21')](_0x3ef1ff[_0x4c53('0x33')]['limit']);_0xcc92fd[_0x4c53('0x1f')]=qs[_0x4c53('0x1f')](_0x3ef1ff[_0x4c53('0x33')][_0x4c53('0x1f')]);}_0xcc92fd[_0x4c53('0x39')]=qs[_0x4c53('0x3a')](_0x3ef1ff[_0x4c53('0x33')][_0x4c53('0x3a')]);_0xcc92fd['where']=qs['filters'](_[_0x4c53('0x3b')](_0x3ef1ff[_0x4c53('0x33')],_0x145df5[_0x4c53('0x34')]),_0x3a2df9);if(_0x3ef1ff[_0x4c53('0x33')][_0x4c53('0x3c')]){_0xcc92fd[_0x4c53('0x3d')]=_[_0x4c53('0x3e')](_0xcc92fd[_0x4c53('0x3d')],{'$or':_['map'](_0x3a2df9,function(_0x12f25d){if(_0x12f25d[_0x4c53('0x3f')]!==_0x4c53('0x40')){var _0x2457e1={};_0x2457e1[_0x12f25d['name']]={'$like':'%'+_0x3ef1ff['query'][_0x4c53('0x3c')]+'%'};return _0x2457e1;}})});}_0xcc92fd=_[_0x4c53('0x3e')]({},_0xcc92fd,_0x3ef1ff['options']);var _0x400786={'where':_0xcc92fd['where']};return db['ChatInternalMessage']['count'](_0x400786)[_0x4c53('0x28')](function(_0x4e6b45){_0x4f932f[_0x4c53('0x22')]=_0x4e6b45;if(_0x3ef1ff[_0x4c53('0x33')][_0x4c53('0x41')]){_0xcc92fd[_0x4c53('0x42')]=[{'all':!![]}];}return db[_0x4c53('0x43')][_0x4c53('0x44')](_0xcc92fd);})['then'](function(_0xb563f3){_0x4f932f[_0x4c53('0x45')]=_0xb563f3;return _0x4f932f;})[_0x4c53('0x28')](respondWithFilteredResult(_0x48f6df,_0xcc92fd))[_0x4c53('0x46')](handleError(_0x48f6df,null));};exports['show']=function(_0x1a2cfc,_0x122b84){var _0x5de08f={'raw':!![],'where':{'id':_0x1a2cfc[_0x4c53('0x47')]['id']}},_0x3ca31e={};_0x3ca31e['model']=_[_0x4c53('0x48')](db['ChatInternalMessage'][_0x4c53('0x2f')]);_0x3ca31e[_0x4c53('0x33')]=_[_0x4c53('0x48')](_0x1a2cfc[_0x4c53('0x33')]);_0x3ca31e['filters']=_[_0x4c53('0x35')](_0x3ca31e[_0x4c53('0x32')],_0x3ca31e[_0x4c53('0x33')]);_0x5de08f[_0x4c53('0x36')]=_['intersection'](_0x3ca31e[_0x4c53('0x32')],qs[_0x4c53('0x37')](_0x1a2cfc['query'][_0x4c53('0x37')]));_0x5de08f['attributes']=_0x5de08f['attributes'][_0x4c53('0x49')]?_0x5de08f[_0x4c53('0x36')]:_0x3ca31e[_0x4c53('0x32')];if(_0x1a2cfc[_0x4c53('0x33')][_0x4c53('0x41')]){_0x5de08f[_0x4c53('0x42')]=[{'all':!![]}];}_0x5de08f=_[_0x4c53('0x3e')]({},_0x5de08f,_0x1a2cfc[_0x4c53('0x4a')]);return db[_0x4c53('0x43')][_0x4c53('0x4b')](_0x5de08f)[_0x4c53('0x28')](handleEntityNotFound(_0x122b84,null))[_0x4c53('0x28')](respondWithResult(_0x122b84,null))['catch'](handleError(_0x122b84,null));};exports[_0x4c53('0x4c')]=function(_0x48caa0,_0x46bfd8){return db[_0x4c53('0x43')][_0x4c53('0x4c')](_0x48caa0['body'],{})[_0x4c53('0x28')](respondWithResult(_0x46bfd8,0xc9))[_0x4c53('0x46')](handleError(_0x46bfd8,null));};exports[_0x4c53('0x4d')]=function(_0x3433d3,_0x384738){if(_0x3433d3[_0x4c53('0x4e')]['id']){delete _0x3433d3[_0x4c53('0x4e')]['id'];}return db['ChatInternalMessage'][_0x4c53('0x4b')]({'where':{'id':_0x3433d3['params']['id']}})[_0x4c53('0x28')](handleEntityNotFound(_0x384738,null))[_0x4c53('0x28')](saveUpdates(_0x3433d3[_0x4c53('0x4e')],null))[_0x4c53('0x28')](respondWithResult(_0x384738,null))[_0x4c53('0x46')](handleError(_0x384738,null));};exports[_0x4c53('0x27')]=function(_0x235812,_0x3b6092){return db[_0x4c53('0x43')][_0x4c53('0x4b')]({'where':{'id':_0x235812['params']['id']}})[_0x4c53('0x28')](handleEntityNotFound(_0x3b6092,null))[_0x4c53('0x28')](removeEntity(_0x3b6092,null))[_0x4c53('0x46')](handleError(_0x3b6092,null));};exports[_0x4c53('0x4f')]=function(_0x3ad6d3,_0x4e4c46){return db[_0x4c53('0x43')]['describe']()['then'](respondWithResult(_0x4e4c46,null))[_0x4c53('0x46')](handleError(_0x4e4c46,null));};function wrapUser(_0x4db5cc){return function(_0x28bf08){var _0x5913bf=_0x4db5cc[_0x4c53('0x50')]({'plain':!![]});_0x5913bf['messages']=[];if(_0x28bf08){_0x5913bf[_0x4c53('0x51')]=_0x28bf08['createdAt'];_0x5913bf[_0x4c53('0x52')]=_0x28bf08;}else{_0x5913bf[_0x4c53('0x51')]=moment(0x0)[_0x4c53('0x53')](_0x4c53('0x54'));_0x5913bf[_0x4c53('0x52')]={};}return _0x5913bf;};}exports[_0x4c53('0x55')]=function(_0x388033,_0x16471f,_0x193c7f){var _0x319164=[];return db[_0x4c53('0x56')]['findAll']({'where':{'role':['agent','admin','user']},'attributes':['id',_0x4c53('0x57'),_0x4c53('0x2b'),'role','userpic','internal','online',_0x4c53('0x58'),_0x4c53('0x59'),_0x4c53('0x5a')],'order':qs[_0x4c53('0x3a')](_0x4c53('0x5b')),'include':[{'model':db['VoiceQueue'],'as':'VoiceQueues','attributes':['id',_0x4c53('0x2b'),_0x4c53('0x3f')],'through':{'attributes':[]}}]})['then'](function(_0x65e9e2){if(_0x65e9e2){var _0x5c115a=_0x388033['user']['get']({'plain':!![]});if(!_0x5c115a)throw new Error(_0x4c53('0x5c'));if(_0x5c115a['role']===_0x4c53('0x5d')){return db[_0x4c53('0x5e')][_0x4c53('0x4b')]({'where':{'name':_0x4c53('0x5f'),'userProfileId':_0x5c115a[_0x4c53('0x60')]},'raw':!![]})[_0x4c53('0x28')](function(_0x5e3c92){if(_0x5e3c92){if(_0x5e3c92[_0x4c53('0x61')]===0x0){return db['UserProfileResource'][_0x4c53('0x44')]({'where':{'sectionId':_0x5e3c92['id']},'raw':!![]})[_0x4c53('0x28')](function(_0x4d5910){var _0x48d1dd=[];if(_[_0x4c53('0x62')](_0x4d5910)){_0x48d1dd=_[_0x4c53('0x3c')](_0x65e9e2,function(_0x418d94){if(_0x418d94[_0x4c53('0x63')]!==_0x4c53('0x64')){return _0x418d94;}});return _0x48d1dd;}else{for(var _0x33b62e=0x0;_0x33b62e<_0x65e9e2[_0x4c53('0x49')];_0x33b62e++){var _0x344517=_0x65e9e2[_0x33b62e];if(_0x344517[_0x4c53('0x63')]===_0x4c53('0x64')){var _0x5a0d53=_['find'](_0x4d5910,function(_0x251601){return _0x251601[_0x4c53('0x65')]===_0x344517['id'];});if(_0x5a0d53)_0x48d1dd['push'](_0x344517);}else{_0x48d1dd[_0x4c53('0x66')](_0x344517);}}return _0x48d1dd;}});}else{return _0x65e9e2;}}else{var _0x2bbdc7=_[_0x4c53('0x3c')](_0x65e9e2,function(_0x34e8fa){if(_0x34e8fa['role']!=='agent'){return _0x34e8fa;}});return _0x2bbdc7;}});}else{return _0x65e9e2;}}})['then'](function(_0x271384){var _0xf15f08=[];if(_0x271384){_0x319164=_0x271384;for(var _0x432218=0x0;_0x432218<_0x271384[_0x4c53('0x49')];_0x432218+=0x1){_0x319164[_0x432218][_0x4c53('0x67')]=[];_0xf15f08[_0x4c53('0x66')](db[_0x4c53('0x43')][_0x4c53('0x4b')]({'where':{'FromId':[_0x388033[_0x4c53('0x5d')]['id'],_0x271384[_0x432218]['id']],'ToId':[_0x388033[_0x4c53('0x5d')]['id'],_0x271384[_0x432218]['id']],'ChatGroupId':null},'attributes':['id',_0x4c53('0x68'),_0x4c53('0x69'),_0x4c53('0x6a'),'read','body'],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x271384[_0x432218])));}return BPromise[_0x4c53('0x6b')](_0xf15f08);}return[];})[_0x4c53('0x28')](function(_0x3167eb){return{'rows':_0x3167eb,'count':_0x3167eb[_0x4c53('0x49')]};})[_0x4c53('0x28')](respondWithResult(_0x16471f,null))[_0x4c53('0x46')](handleError(_0x16471f,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 00356ed..a420b4f 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 _0x117d=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage'];(function(_0xad3484,_0x40a31a){var _0x173e0c=function(_0x5098ce){while(--_0x5098ce){_0xad3484['push'](_0xad3484['shift']());}};_0x173e0c(++_0x40a31a);}(_0x117d,0x1e1));var _0xd117=function(_0x3f7598,_0x212e37){_0x3f7598=_0x3f7598-0x0;var _0x51fb16=_0x117d[_0x3f7598];return _0x51fb16;};'use strict';var EventEmitter=require(_0xd117('0x0'));var ChatInternalMessage=require(_0xd117('0x1'))['db'][_0xd117('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xd117('0x3')](0x0);var events={'afterCreate':_0xd117('0x4'),'afterUpdate':_0xd117('0x5'),'afterDestroy':_0xd117('0x6')};function emitEvent(_0x4d6ee7){return function(_0x513770,_0x4fbc25,_0x2a8274){ChatInternalMessageEvents[_0xd117('0x7')](_0x4d6ee7+':'+_0x513770['id'],_0x513770);ChatInternalMessageEvents['emit'](_0x4d6ee7,_0x513770);_0x2a8274(null);};}for(var e in events){if(events[_0xd117('0x8')](e)){var event=events[e];ChatInternalMessage[_0xd117('0x9')](e,emitEvent(event));}}module[_0xd117('0xa')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x4215=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit'];(function(_0x3cb8e5,_0x4b9cd4){var _0x3d76ea=function(_0x45c701){while(--_0x45c701){_0x3cb8e5['push'](_0x3cb8e5['shift']());}};_0x3d76ea(++_0x4b9cd4);}(_0x4215,0x1b0));var _0x5421=function(_0x412225,_0x4a65bc){_0x412225=_0x412225-0x0;var _0x30b4ae=_0x4215[_0x412225];return _0x30b4ae;};'use strict';var EventEmitter=require(_0x5421('0x0'));var ChatInternalMessage=require(_0x5421('0x1'))['db'][_0x5421('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x5421('0x3')](0x0);var events={'afterCreate':_0x5421('0x4'),'afterUpdate':_0x5421('0x5'),'afterDestroy':_0x5421('0x6')};function emitEvent(_0x4c984b){return function(_0x223981,_0x155288,_0x39c70d){ChatInternalMessageEvents[_0x5421('0x7')](_0x4c984b+':'+_0x223981['id'],_0x223981);ChatInternalMessageEvents['emit'](_0x4c984b,_0x223981);_0x39c70d(null);};}for(var e in events){if(events[_0x5421('0x8')](e)){var event=events[e];ChatInternalMessage[_0x5421('0x9')](e,emitEvent(event));}}module[_0x5421('0xa')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index c344e1c..f3587c0 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 _0xd98f=['ChatInternalMessage','chat_internal_messages','utf8mb4','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x53822b,_0x3fa297){var _0x5f5ccf=function(_0xea35c9){while(--_0xea35c9){_0x53822b['push'](_0x53822b['shift']());}};_0x5f5ccf(++_0x3fa297);}(_0xd98f,0x1d7));var _0xfd98=function(_0x3a217d,_0x41c41a){_0x3a217d=_0x3a217d-0x0;var _0x16010f=_0xd98f[_0x3a217d];return _0x16010f;};'use strict';var _=require(_0xfd98('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfd98('0x1'));var moment=require('moment');var BPromise=require(_0xfd98('0x2'));var rp=require(_0xfd98('0x3'));var fs=require('fs');var path=require(_0xfd98('0x4'));var rimraf=require(_0xfd98('0x5'));var config=require(_0xfd98('0x6'));var attributes=require('./chatInternalMessage.attributes');module[_0xfd98('0x7')]=function(_0x5785ac,_0x5f3162){return _0x5785ac[_0xfd98('0x8')](_0xfd98('0x9'),attributes,{'tableName':_0xfd98('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfd98('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x0d49=['exports','define','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','path','rimraf','../../config/environment'];(function(_0x1ad6a9,_0x653094){var _0xe082f0=function(_0xa2d105){while(--_0xa2d105){_0x1ad6a9['push'](_0x1ad6a9['shift']());}};_0xe082f0(++_0x653094);}(_0x0d49,0xc5));var _0x90d4=function(_0x1b7008,_0x556858){_0x1b7008=_0x1b7008-0x0;var _0x4e056d=_0x0d49[_0x1b7008];return _0x4e056d;};'use strict';var _=require(_0x90d4('0x0'));var util=require(_0x90d4('0x1'));var logger=require(_0x90d4('0x2'))(_0x90d4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x90d4('0x4'));var rimraf=require(_0x90d4('0x5'));var config=require(_0x90d4('0x6'));var attributes=require('./chatInternalMessage.attributes');module[_0x90d4('0x7')]=function(_0x2e6735,_0x463151){return _0x2e6735[_0x90d4('0x8')]('ChatInternalMessage',attributes,{'tableName':_0x90d4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x90d4('0xa'),'collate':_0x90d4('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 0cec356..b6f331e 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 _0xd8e0=['ChatInternalMessage,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatInternalMessage.socket','register','request','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd8e0,0x111));var _0x0d8e=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xd8e0[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0x0d8e('0x0'));var util=require(_0x0d8e('0x1'));var moment=require(_0x0d8e('0x2'));var BPromise=require(_0x0d8e('0x3'));var rs=require(_0x0d8e('0x4'));var fs=require('fs');var Redis=require(_0x0d8e('0x5'));var db=require(_0x0d8e('0x6'))['db'];var utils=require(_0x0d8e('0x7'));var logger=require(_0x0d8e('0x8'))(_0x0d8e('0x9'));var config=require(_0x0d8e('0xa'));var jayson=require(_0x0d8e('0xb'));var client=jayson[_0x0d8e('0xc')][_0x0d8e('0xd')]({'port':0x232a});config[_0x0d8e('0xe')]=_[_0x0d8e('0xf')](config[_0x0d8e('0xe')],{'host':_0x0d8e('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d8e('0xe')]));require(_0x0d8e('0x11'))[_0x0d8e('0x12')](socket);function respondWithRpcPromise(_0xfa6994,_0x5950ad,_0x1f2f5b){return new BPromise(function(_0x3a252c,_0x26e4c9){return client[_0x0d8e('0x13')](_0xfa6994,_0x1f2f5b)[_0x0d8e('0x14')](function(_0x596df4){logger[_0x0d8e('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x5950ad,_0x0d8e('0x16'));logger[_0x0d8e('0x17')](_0x0d8e('0x18'),_0x5950ad,_0x0d8e('0x16'),JSON[_0x0d8e('0x19')](_0x596df4));if(_0x596df4[_0x0d8e('0x1a')]){if(_0x596df4[_0x0d8e('0x1a')]['code']===0x1f4){logger['error'](_0x0d8e('0x1b'),_0x5950ad,_0x596df4['error'][_0x0d8e('0x1c')]);return _0x26e4c9(_0x596df4[_0x0d8e('0x1a')][_0x0d8e('0x1c')]);}logger[_0x0d8e('0x1a')](_0x0d8e('0x1b'),_0x5950ad,_0x596df4[_0x0d8e('0x1a')]['message']);return _0x3a252c(_0x596df4[_0x0d8e('0x1a')][_0x0d8e('0x1c')]);}else{logger['info'](_0x0d8e('0x1b'),_0x5950ad,'request\x20sent');_0x3a252c(_0x596df4[_0x0d8e('0x1d')][_0x0d8e('0x1c')]);}})['catch'](function(_0x4fc808){logger[_0x0d8e('0x1a')](_0x0d8e('0x1b'),_0x5950ad,_0x4fc808);_0x26e4c9(_0x4fc808);});});} \ No newline at end of file +var _0xac95=['../../config/environment','client','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xac95,0xa8));var _0x5ac9=function(_0xd0c79e,_0x15bd20){_0xd0c79e=_0xd0c79e-0x0;var _0x33ef90=_0xac95[_0xd0c79e];return _0x33ef90;};'use strict';var _=require(_0x5ac9('0x0'));var util=require(_0x5ac9('0x1'));var moment=require(_0x5ac9('0x2'));var BPromise=require(_0x5ac9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ac9('0x4'))['db'];var utils=require(_0x5ac9('0x5'));var logger=require('../../config/logger')(_0x5ac9('0x6'));var config=require(_0x5ac9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5ac9('0x8')][_0x5ac9('0x9')]({'port':0x232a});config[_0x5ac9('0xa')]=_['defaults'](config['redis'],{'host':_0x5ac9('0xb'),'port':0x18eb});var socket=require(_0x5ac9('0xc'))(new Redis(config[_0x5ac9('0xa')]));require(_0x5ac9('0xd'))[_0x5ac9('0xe')](socket);function respondWithRpcPromise(_0x5da6fb,_0x5ad3b7,_0x1bac16){return new BPromise(function(_0x34090e,_0x538efe){return client[_0x5ac9('0xf')](_0x5da6fb,_0x1bac16)['then'](function(_0x1bcb23){logger['info'](_0x5ac9('0x10'),_0x5ad3b7,_0x5ac9('0x11'));logger[_0x5ac9('0x12')](_0x5ac9('0x13'),_0x5ad3b7,'request\x20sent',JSON['stringify'](_0x1bcb23));if(_0x1bcb23[_0x5ac9('0x14')]){if(_0x1bcb23['error'][_0x5ac9('0x15')]===0x1f4){logger[_0x5ac9('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x5ad3b7,_0x1bcb23[_0x5ac9('0x14')][_0x5ac9('0x16')]);return _0x538efe(_0x1bcb23[_0x5ac9('0x14')][_0x5ac9('0x16')]);}logger[_0x5ac9('0x14')](_0x5ac9('0x10'),_0x5ad3b7,_0x1bcb23[_0x5ac9('0x14')][_0x5ac9('0x16')]);return _0x34090e(_0x1bcb23[_0x5ac9('0x14')]['message']);}else{logger['info'](_0x5ac9('0x10'),_0x5ad3b7,_0x5ac9('0x11'));_0x34090e(_0x1bcb23[_0x5ac9('0x17')][_0x5ac9('0x16')]);}})[_0x5ac9('0x18')](function(_0x47713e){logger[_0x5ac9('0x14')](_0x5ac9('0x10'),_0x5ad3b7,_0x47713e);_0x538efe(_0x47713e);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 00ff613..db46c7a 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 _0x2d0d=['chatInternalMessage:','./chatInternalMessage.events','save','remove','update','emit','removeListener','register','length'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x2d0d,0x196));var _0xd2d0=function(_0x1b9cfb,_0x2c5a2b){_0x1b9cfb=_0x1b9cfb-0x0;var _0x38a552=_0x2d0d[_0x1b9cfb];return _0x38a552;};'use strict';var ChatInternalMessageEvents=require(_0xd2d0('0x0'));var events=[_0xd2d0('0x1'),_0xd2d0('0x2'),_0xd2d0('0x3')];function createListener(_0x14f780,_0x19ea09){return function(_0x303c37){_0x19ea09[_0xd2d0('0x4')](_0x14f780,_0x303c37);};}function removeListener(_0x1e8f8d,_0x20cada){return function(){ChatInternalMessageEvents[_0xd2d0('0x5')](_0x1e8f8d,_0x20cada);};}exports[_0xd2d0('0x6')]=function(_0x1cbbf1){for(var _0x351cf4=0x0,_0xf1103c=events[_0xd2d0('0x7')];_0x351cf4<_0xf1103c;_0x351cf4++){var _0x5eed2c=events[_0x351cf4];var _0x2b5662=createListener(_0xd2d0('0x8')+_0x5eed2c,_0x1cbbf1);ChatInternalMessageEvents['on'](_0x5eed2c,_0x2b5662);}}; \ No newline at end of file +var _0x7928=['register','chatInternalMessage:','save','emit'];(function(_0x28a903,_0x5101c6){var _0x52b6ae=function(_0x2f8484){while(--_0x2f8484){_0x28a903['push'](_0x28a903['shift']());}};_0x52b6ae(++_0x5101c6);}(_0x7928,0x86));var _0x8792=function(_0x2aa2ef,_0x17f9a2){_0x2aa2ef=_0x2aa2ef-0x0;var _0x1d1d8c=_0x7928[_0x2aa2ef];return _0x1d1d8c;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x8792('0x0'),'remove','update'];function createListener(_0x352848,_0x3bff1f){return function(_0x1e299f){_0x3bff1f[_0x8792('0x1')](_0x352848,_0x1e299f);};}function removeListener(_0x29b201,_0x4745f6){return function(){ChatInternalMessageEvents['removeListener'](_0x29b201,_0x4745f6);};}exports[_0x8792('0x2')]=function(_0x122e9b){for(var _0x2ca404=0x0,_0x136777=events['length'];_0x2ca404<_0x136777;_0x2ca404++){var _0x2024df=events[_0x2ca404];var _0x433d5b=createListener(_0x8792('0x3')+_0x2024df,_0x122e9b);ChatInternalMessageEvents['on'](_0x2024df,_0x433d5b);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 047eb1f..d9213f0 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 _0xacca=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/users','getUsers','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x3dee92,_0x55e1eb){var _0x44d36e=function(_0x34de1a){while(--_0x34de1a){_0x3dee92['push'](_0x3dee92['shift']());}};_0x44d36e(++_0x55e1eb);}(_0xacca,0x110));var _0xaacc=function(_0x5ec973,_0x196985){_0x5ec973=_0x5ec973-0x0;var _0x20be94=_0xacca[_0x5ec973];return _0x20be94;};'use strict';var multer=require(_0xaacc('0x0'));var util=require(_0xaacc('0x1'));var path=require('path');var timeout=require(_0xaacc('0x2'));var express=require(_0xaacc('0x3'));var router=express[_0xaacc('0x4')]();var fs_extra=require(_0xaacc('0x5'));var auth=require(_0xaacc('0x6'));var interaction=require(_0xaacc('0x7'));var config=require(_0xaacc('0x8'));var controller=require(_0xaacc('0x9'));router[_0xaacc('0xa')]('/',auth[_0xaacc('0xb')](),controller['index']);router[_0xaacc('0xa')]('/describe',auth[_0xaacc('0xb')](),controller['describe']);router[_0xaacc('0xa')](_0xaacc('0xc'),auth[_0xaacc('0xb')](),controller[_0xaacc('0xd')]);router['get'](_0xaacc('0xe'),auth[_0xaacc('0xb')](),controller[_0xaacc('0xf')]);router[_0xaacc('0x10')]('/',auth[_0xaacc('0xb')](),controller[_0xaacc('0x11')]);router[_0xaacc('0x12')](_0xaacc('0xe'),controller[_0xaacc('0x13')]);router[_0xaacc('0x14')](_0xaacc('0xe'),auth[_0xaacc('0xb')](),controller[_0xaacc('0x15')]);module[_0xaacc('0x16')]=router; \ No newline at end of file +var _0xceaa=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInternalMessage.controller','index','get','/describe','isAuthenticated','describe','getUsers','/:id','show','post','create','put'];(function(_0x29ab8e,_0x67c0c1){var _0xc602a3=function(_0x2782b5){while(--_0x2782b5){_0x29ab8e['push'](_0x29ab8e['shift']());}};_0xc602a3(++_0x67c0c1);}(_0xceaa,0xe5));var _0xacea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xceaa[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xacea('0x0'));var util=require(_0xacea('0x1'));var path=require(_0xacea('0x2'));var timeout=require(_0xacea('0x3'));var express=require(_0xacea('0x4'));var router=express[_0xacea('0x5')]();var fs_extra=require(_0xacea('0x6'));var auth=require(_0xacea('0x7'));var interaction=require(_0xacea('0x8'));var config=require('../../config/environment');var controller=require(_0xacea('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xacea('0xa')]);router[_0xacea('0xb')](_0xacea('0xc'),auth[_0xacea('0xd')](),controller[_0xacea('0xe')]);router[_0xacea('0xb')]('/users',auth[_0xacea('0xd')](),controller[_0xacea('0xf')]);router[_0xacea('0xb')](_0xacea('0x10'),auth[_0xacea('0xd')](),controller[_0xacea('0x11')]);router[_0xacea('0x12')]('/',auth[_0xacea('0xd')](),controller[_0xacea('0x13')]);router[_0xacea('0x14')](_0xacea('0x10'),controller[_0xacea('0x15')]);router[_0xacea('0x16')](_0xacea('0x10'),auth[_0xacea('0xd')](),controller[_0xacea('0x17')]);module[_0xacea('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index eb751a3..710780f 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 _0x8c7a=['sequelize','medium','BOOLEAN','ENUM','out','STRING','TEXT'];(function(_0x55e724,_0x8f22f1){var _0x1b317c=function(_0x21d4dd){while(--_0x21d4dd){_0x55e724['push'](_0x55e724['shift']());}};_0x1b317c(++_0x8f22f1);}(_0x8c7a,0x8c));var _0xa8c7=function(_0x3d1284,_0x1bb481){_0x3d1284=_0x3d1284-0x0;var _0x4ac2e2=_0x8c7a[_0x3d1284];return _0x4ac2e2;};'use strict';var Sequelize=require(_0xa8c7('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xa8c7('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xa8c7('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa8c7('0x3')]('in',_0xa8c7('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xa8c7('0x5')]},'providerResponse':{'type':Sequelize[_0xa8c7('0x6')]}}; \ No newline at end of file +var _0x88c3=['DATE','STRING','sequelize','TEXT','BOOLEAN','out'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x88c3,0x1ee));var _0x388c=function(_0x4666a6,_0x10faae){_0x4666a6=_0x4666a6-0x0;var _0x3432c9=_0x88c3[_0x4666a6];return _0x3432c9;};'use strict';var Sequelize=require(_0x388c('0x0'));module['exports']={'body':{'type':Sequelize[_0x388c('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x388c('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x388c('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0x388c('0x4')]},'providerName':{'type':Sequelize[_0x388c('0x5')]},'providerResponse':{'type':Sequelize[_0x388c('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 889967d..37653be 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 _0x35c9=['contact','interface','EventManager','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','name','send','index','map','ChatMessage','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','create','body','describe','chat-interactions','accept','chat','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','User','fullname','email','manual','SIP/%s','channel','motionChannel','event','acceptmessage','parse','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x35c9,0x18a));var _0x935c=function(_0x4a7c71,_0x253d33){_0x4a7c71=_0x4a7c71-0x0;var _0x96692e=_0x35c9[_0x4a7c71];return _0x96692e;};'use strict';var emlformat=require(_0x935c('0x0'));var rimraf=require(_0x935c('0x1'));var zipdir=require(_0x935c('0x2'));var jsonpatch=require(_0x935c('0x3'));var rp=require(_0x935c('0x4'));var moment=require(_0x935c('0x5'));var BPromise=require(_0x935c('0x6'));var Mustache=require(_0x935c('0x7'));var util=require(_0x935c('0x8'));var path=require(_0x935c('0x9'));var sox=require(_0x935c('0xa'));var csv=require(_0x935c('0xb'));var ejs=require(_0x935c('0xc'));var fs=require('fs');var fs_extra=require(_0x935c('0xd'));var _=require('lodash');var squel=require(_0x935c('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x935c('0xb'));var querystring=require(_0x935c('0xf'));var Papa=require(_0x935c('0x10'));var Redis=require('ioredis');var authService=require(_0x935c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x935c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x935c('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x935c('0x14'));var db=require('../../mysqldb')['db'];config[_0x935c('0x15')]=_[_0x935c('0x16')](config['redis'],{'host':_0x935c('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x935c('0x15')]));require(_0x935c('0x18'))[_0x935c('0x19')](socket);var jayson=require(_0x935c('0x1a'));var client=jayson[_0x935c('0x1b')][_0x935c('0x1c')]({'port':0x232c});var client9002=jayson[_0x935c('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15d7f4,_0x4a2bd4,_0x1198e2,_0x382984){return new BPromise(function(_0x52674c,_0x54fd68){var _0x3c8279=_0x382984||client;return _0x3c8279[_0x935c('0x1d')](_0x15d7f4,_0x1198e2)[_0x935c('0x1e')](function(_0x374cac){logger[_0x935c('0x1f')](_0x935c('0x20'),_0x4a2bd4,_0x935c('0x21'));logger[_0x935c('0x22')](_0x935c('0x23'),_0x4a2bd4,_0x935c('0x21'),JSON[_0x935c('0x24')](_0x374cac));if(_0x374cac[_0x935c('0x25')]){if(_0x374cac[_0x935c('0x25')][_0x935c('0x26')]===0x1f4){logger[_0x935c('0x25')]('ChatMessage,\x20%s,\x20%s',_0x4a2bd4,_0x374cac['error'][_0x935c('0x27')]);return _0x54fd68(_0x374cac[_0x935c('0x25')]['message']);}logger[_0x935c('0x25')](_0x935c('0x20'),_0x4a2bd4,_0x374cac[_0x935c('0x25')]['message']);return _0x52674c(_0x374cac[_0x935c('0x25')][_0x935c('0x27')]);}else{logger[_0x935c('0x1f')](_0x935c('0x20'),_0x4a2bd4,_0x935c('0x21'));_0x52674c(_0x374cac[_0x935c('0x28')][_0x935c('0x27')]);}})[_0x935c('0x29')](function(_0x5a2455){logger[_0x935c('0x25')](_0x935c('0x20'),_0x4a2bd4,_0x5a2455);_0x54fd68(_0x5a2455);});});}function respondWithStatusCode(_0x1d4e05,_0x478d63){_0x478d63=_0x478d63||0xcc;return function(_0x433b1f){if(_0x433b1f){return _0x1d4e05[_0x935c('0x2a')](_0x478d63);}return _0x1d4e05[_0x935c('0x2b')](_0x478d63)[_0x935c('0x2c')]();};}function respondWithResult(_0x535e27,_0x145928){_0x145928=_0x145928||0xc8;return function(_0x4e7f95){if(_0x4e7f95){return _0x535e27[_0x935c('0x2b')](_0x145928)[_0x935c('0x2d')](_0x4e7f95);}};}function respondWithFilteredResult(_0x3c5813,_0x1f4588){return function(_0x22bf3a){if(_0x22bf3a){var _0x12d3f3=typeof _0x1f4588[_0x935c('0x2e')]===_0x935c('0x2f')&&typeof _0x1f4588['limit']===_0x935c('0x2f');var _0x577b8a=_0x22bf3a[_0x935c('0x30')];var _0x5ecf62=_0x12d3f3?0x0:_0x1f4588[_0x935c('0x2e')];var _0x562438=_0x12d3f3?_0x22bf3a[_0x935c('0x30')]:_0x1f4588[_0x935c('0x2e')]+_0x1f4588[_0x935c('0x31')];var _0x121e2e;if(_0x562438>=_0x577b8a){_0x562438=_0x577b8a;_0x121e2e=0xc8;}else{_0x121e2e=0xce;}_0x3c5813[_0x935c('0x2b')](_0x121e2e);return _0x3c5813[_0x935c('0x32')]('Content-Range',_0x5ecf62+'-'+_0x562438+'/'+_0x577b8a)[_0x935c('0x2d')](_0x22bf3a);}return null;};}function patchUpdates(_0x3ae1f8){return function(_0x44bf3d){try{jsonpatch[_0x935c('0x33')](_0x44bf3d,_0x3ae1f8,!![]);}catch(_0x362884){return BPromise[_0x935c('0x34')](_0x362884);}return _0x44bf3d[_0x935c('0x35')]();};}function saveUpdates(_0x3ba99e,_0x550928){return function(_0x28ac05){if(_0x28ac05){return _0x28ac05[_0x935c('0x36')](_0x3ba99e)[_0x935c('0x1e')](function(_0x4a7c89){return _0x4a7c89;});}return null;};}function removeEntity(_0x321357,_0x2fcfe3){return function(_0x5e9246){if(_0x5e9246){return _0x5e9246[_0x935c('0x37')]()[_0x935c('0x1e')](function(){_0x321357[_0x935c('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ceb0e,_0x1d283e){return function(_0x213d20){if(!_0x213d20){_0x1ceb0e[_0x935c('0x2a')](0x194);}return _0x213d20;};}function handleError(_0x398ee2,_0x5f92e0){_0x5f92e0=_0x5f92e0||0x1f4;return function(_0x5c6249){logger[_0x935c('0x25')](_0x5c6249['stack']);if(_0x5c6249['name']){delete _0x5c6249[_0x935c('0x38')];}_0x398ee2[_0x935c('0x2b')](_0x5f92e0)[_0x935c('0x39')](_0x5c6249);};}exports[_0x935c('0x3a')]=function(_0x2adda8,_0x505d61){var _0x5488d1={},_0x2ce877={},_0x375a8b={'count':0x0,'rows':[]};var _0x1d8de7=_[_0x935c('0x3b')](db[_0x935c('0x3c')]['rawAttributes'],function(_0x5bdd89){return{'name':_0x5bdd89[_0x935c('0x3d')],'type':_0x5bdd89[_0x935c('0x3e')][_0x935c('0x3f')]};});_0x2ce877[_0x935c('0x40')]=_['map'](_0x1d8de7,_0x935c('0x38'));_0x2ce877[_0x935c('0x41')]=_['keys'](_0x2adda8[_0x935c('0x41')]);_0x2ce877['filters']=_[_0x935c('0x42')](_0x2ce877['model'],_0x2ce877[_0x935c('0x41')]);_0x5488d1[_0x935c('0x43')]=_[_0x935c('0x42')](_0x2ce877[_0x935c('0x40')],qs[_0x935c('0x44')](_0x2adda8[_0x935c('0x41')][_0x935c('0x44')]));_0x5488d1[_0x935c('0x43')]=_0x5488d1[_0x935c('0x43')][_0x935c('0x45')]?_0x5488d1[_0x935c('0x43')]:_0x2ce877[_0x935c('0x40')];if(!_0x2adda8[_0x935c('0x41')][_0x935c('0x46')](_0x935c('0x47'))){_0x5488d1[_0x935c('0x31')]=qs[_0x935c('0x31')](_0x2adda8[_0x935c('0x41')][_0x935c('0x31')]);_0x5488d1[_0x935c('0x2e')]=qs[_0x935c('0x2e')](_0x2adda8['query'][_0x935c('0x2e')]);}_0x5488d1['order']=qs[_0x935c('0x48')](_0x2adda8['query'][_0x935c('0x48')]);_0x5488d1[_0x935c('0x49')]=qs[_0x935c('0x4a')](_[_0x935c('0x4b')](_0x2adda8[_0x935c('0x41')],_0x2ce877[_0x935c('0x4a')]),_0x1d8de7);if(_0x2adda8[_0x935c('0x41')][_0x935c('0x4c')]){_0x5488d1[_0x935c('0x49')]=_[_0x935c('0x4d')](_0x5488d1['where'],{'$or':_['map'](_0x1d8de7,function(_0x8c4539){if(_0x8c4539[_0x935c('0x3e')]!==_0x935c('0x4e')){var _0x5124d1={};_0x5124d1[_0x8c4539[_0x935c('0x38')]]={'$like':'%'+_0x2adda8[_0x935c('0x41')][_0x935c('0x4c')]+'%'};return _0x5124d1;}})});}_0x5488d1=_[_0x935c('0x4d')]({},_0x5488d1,_0x2adda8[_0x935c('0x4f')]);var _0x425f1b={'where':_0x5488d1[_0x935c('0x49')]};return db[_0x935c('0x3c')]['count'](_0x425f1b)[_0x935c('0x1e')](function(_0x490110){_0x375a8b[_0x935c('0x30')]=_0x490110;if(_0x2adda8[_0x935c('0x41')][_0x935c('0x50')]){_0x5488d1[_0x935c('0x51')]=[{'all':!![]}];}return db[_0x935c('0x3c')][_0x935c('0x52')](_0x5488d1);})[_0x935c('0x1e')](function(_0x2d5ba0){_0x375a8b[_0x935c('0x53')]=_0x2d5ba0;return _0x375a8b;})[_0x935c('0x1e')](respondWithFilteredResult(_0x505d61,_0x5488d1))[_0x935c('0x29')](handleError(_0x505d61,null));};exports['show']=function(_0x28c6e5,_0x95c4bb){var _0x111e15={'raw':!![],'where':{'id':_0x28c6e5[_0x935c('0x54')]['id']}},_0x552cc7={};_0x552cc7[_0x935c('0x40')]=_[_0x935c('0x55')](db['ChatMessage'][_0x935c('0x56')]);_0x552cc7[_0x935c('0x41')]=_[_0x935c('0x55')](_0x28c6e5[_0x935c('0x41')]);_0x552cc7[_0x935c('0x4a')]=_[_0x935c('0x42')](_0x552cc7[_0x935c('0x40')],_0x552cc7[_0x935c('0x41')]);_0x111e15['attributes']=_[_0x935c('0x42')](_0x552cc7[_0x935c('0x40')],qs[_0x935c('0x44')](_0x28c6e5[_0x935c('0x41')]['fields']));_0x111e15[_0x935c('0x43')]=_0x111e15['attributes'][_0x935c('0x45')]?_0x111e15[_0x935c('0x43')]:_0x552cc7[_0x935c('0x40')];if(_0x28c6e5[_0x935c('0x41')]['includeAll']){_0x111e15[_0x935c('0x51')]=[{'all':!![]}];}_0x111e15=_['merge']({},_0x111e15,_0x28c6e5[_0x935c('0x4f')]);return db[_0x935c('0x3c')][_0x935c('0x57')](_0x111e15)[_0x935c('0x1e')](handleEntityNotFound(_0x95c4bb,null))[_0x935c('0x1e')](respondWithResult(_0x95c4bb,null))[_0x935c('0x29')](handleError(_0x95c4bb,null));};exports[_0x935c('0x58')]=function(_0x23a99f,_0xde45ae){return db[_0x935c('0x3c')][_0x935c('0x58')](_0x23a99f[_0x935c('0x59')],{})['then'](respondWithResult(_0xde45ae,0xc9))[_0x935c('0x29')](handleError(_0xde45ae,null));};exports['update']=function(_0x1d6f42,_0x133cda){if(_0x1d6f42[_0x935c('0x59')]['id']){delete _0x1d6f42[_0x935c('0x59')]['id'];}return db[_0x935c('0x3c')][_0x935c('0x57')]({'where':{'id':_0x1d6f42['params']['id']}})[_0x935c('0x1e')](handleEntityNotFound(_0x133cda,null))['then'](saveUpdates(_0x1d6f42['body'],null))[_0x935c('0x1e')](respondWithResult(_0x133cda,null))[_0x935c('0x29')](handleError(_0x133cda,null));};exports[_0x935c('0x37')]=function(_0x42fbce,_0x24322a){return db[_0x935c('0x3c')][_0x935c('0x57')]({'where':{'id':_0x42fbce[_0x935c('0x54')]['id']}})['then'](handleEntityNotFound(_0x24322a,null))[_0x935c('0x1e')](removeEntity(_0x24322a,null))[_0x935c('0x29')](handleError(_0x24322a,null));};exports[_0x935c('0x5a')]=function(_0x7fd58d,_0x133163){return db[_0x935c('0x3c')][_0x935c('0x5a')]()[_0x935c('0x1e')](respondWithResult(_0x133163,null))[_0x935c('0x29')](handleError(_0x133163,null));};var interaction_log=require('../../config/logger')(_0x935c('0x5b'));exports[_0x935c('0x5c')]=function(_0x13f221,_0x2f9946,_0x2d8f18){var _0x56cf8b={'agent':{},'channel':_0x935c('0x5d')};if(_0x13f221['body']['id']){delete _0x13f221['body']['id'];}_0x13f221['body']['read']=!![];_0x13f221[_0x935c('0x59')]['readAt']=moment()[_0x935c('0x5e')](_0x935c('0x5f'));_0x13f221[_0x935c('0x59')][_0x935c('0x60')]=_0x13f221['body'][_0x935c('0x60')]||_0x13f221[_0x935c('0x61')]['id'];_0x56cf8b[_0x935c('0x62')]['id']=_0x13f221[_0x935c('0x59')][_0x935c('0x60')];return db[_0x935c('0x3c')][_0x935c('0x57')]({'where':{'id':_0x13f221[_0x935c('0x54')]['id'],'UserId':null}})[_0x935c('0x1e')](handleEntityNotFound(_0x2f9946,null))['then'](saveUpdates(_0x13f221[_0x935c('0x59')],null))['then'](function(_0x3bd2e2){if(_0x3bd2e2){_0x56cf8b[_0x935c('0x27')]=_0x3bd2e2[_0x935c('0x63')]({'plain':!![]});return db[_0x935c('0x64')][_0x935c('0x57')]({'where':{'id':_0x3bd2e2[_0x935c('0x65')]}});}return null;})[_0x935c('0x1e')](handleEntityNotFound(_0x2f9946,null))[_0x935c('0x1e')](function(_0x2ef405){if(_0x2ef405){return _0x2ef405[_0x935c('0x36')]({'UserId':_0x13f221[_0x935c('0x59')][_0x935c('0x60')],'read1stAt':_[_0x935c('0x66')](_0x2ef405[_0x935c('0x67')])?moment()[_0x935c('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x935c('0x1e')](function(_0x161ccb){if(_0x161ccb){_0x56cf8b[_0x935c('0x68')]=_0x161ccb[_0x935c('0x63')]({'plain':!![]});interaction_log['info'](_0x935c('0x69'),_0x13f221['user']['id'],_0x13f221[_0x935c('0x61')][_0x935c('0x38')],_0x13f221['user'][_0x935c('0x6a')],_0x56cf8b[_0x935c('0x68')]['id'],_0x13f221[_0x935c('0x59')]?JSON['stringify'](_0x13f221[_0x935c('0x59')]):_0x935c('0x6b'));return respondWithRpcPromise(_0x935c('0x6c'),'acceptMessage',_0x56cf8b);}return null;})['then'](function(_0x46568d){var _0x1a700a=_0x935c('0x6d')+_0x46568d[_0x935c('0x27')][_0x935c('0x6e')];return db[_0x935c('0x6f')]['query'](_0x1a700a,{'type':db[_0x935c('0x70')][_0x935c('0x71')]['SELECT'],'raw':!![]})[_0x935c('0x1e')](function(_0x598f63){return _0x598f63;});})[_0x935c('0x1e')](function(_0xd3e309){if(_0xd3e309){_0x56cf8b[_0x935c('0x27')]['contact']=_0xd3e309[0x0];if(!_0x13f221[_0x935c('0x59')][_0x935c('0x60')])return;return db[_0x935c('0x72')][_0x935c('0x57')]({'where':{'id':_0x13f221['body'][_0x935c('0x60')],'role':_0x935c('0x62')},'attributes':['id',_0x935c('0x38'),_0x935c('0x73'),_0x935c('0x74'),'internal'],'raw':!![]});}return null;})[_0x935c('0x1e')](function(_0x2aafd5){if(!_0x2aafd5)return null;_0x56cf8b[_0x935c('0x27')]['agent']=_0x2aafd5;return _0x56cf8b;})[_0x935c('0x1e')](function(_0x54c817){if(_0x54c817){if(_0x13f221[_0x935c('0x59')][_0x935c('0x75')]){_0x56cf8b[_0x935c('0x27')]['interface']=util[_0x935c('0x5e')](_0x935c('0x76'),_0x13f221[_0x935c('0x61')][_0x935c('0x38')]);_0x56cf8b[_0x935c('0x27')][_0x935c('0x77')]=_0x56cf8b[_0x935c('0x77')];_0x56cf8b['message'][_0x935c('0x78')]=_0x56cf8b[_0x935c('0x77')];_0x56cf8b[_0x935c('0x27')][_0x935c('0x79')]='accept';return respondWithRpcPromise('EventManager','EventManager',{'event':_0x935c('0x7a'),'message':_[_0x935c('0x4d')](_0x56cf8b[_0x935c('0x27')],JSON[_0x935c('0x7b')](_0x56cf8b[_0x935c('0x68')]['formData']))},client9002)[_0x935c('0x1e')](function(){return _0x56cf8b;});}return _0x56cf8b;}return null;})['then'](respondWithResult(_0x2f9946,null))[_0x935c('0x29')](handleError(_0x2f9946,null));};var interaction_log=require('../../config/logger')(_0x935c('0x5b'));exports[_0x935c('0x34')]=function(_0x514b52,_0x57eb2,_0x3fcf8e){var _0x36cfac={'agent':{},'channel':_0x935c('0x5d')};if(_0x514b52['body']['id']){delete _0x514b52['body']['id'];}_0x514b52['body'][_0x935c('0x60')]=_0x514b52[_0x935c('0x59')]['UserId']||_0x514b52['user']['id'];_0x36cfac[_0x935c('0x62')]['id']=_0x514b52[_0x935c('0x59')][_0x935c('0x60')];return db[_0x935c('0x3c')][_0x935c('0x57')]({'where':{'id':_0x514b52[_0x935c('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x57eb2,null))[_0x935c('0x1e')](function(_0x19fc80){if(_0x19fc80){_0x36cfac[_0x935c('0x27')]=_0x19fc80['get']({'plain':!![]});return db[_0x935c('0x64')][_0x935c('0x57')]({'where':{'id':_0x19fc80[_0x935c('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x57eb2,null))[_0x935c('0x1e')](function(_0xa520c4){if(_0xa520c4){_0x36cfac[_0x935c('0x68')]=_0xa520c4[_0x935c('0x63')]({'plain':!![]});interaction_log['info'](_0x935c('0x7c'),_0x514b52['user']['id'],_0x514b52[_0x935c('0x61')][_0x935c('0x38')],_0x514b52['user'][_0x935c('0x6a')],_0x36cfac[_0x935c('0x68')]['id'],_0x514b52[_0x935c('0x59')]?JSON['stringify'](_0x514b52[_0x935c('0x59')]):_0x935c('0x6b'));return respondWithRpcPromise(_0x935c('0x7d'),'rejectMessage',_0x36cfac);}return null;})[_0x935c('0x1e')](function(_0x4f9924){var _0x4405ce=_0x935c('0x6d')+_0x4f9924[_0x935c('0x27')][_0x935c('0x6e')];return db['sequelize'][_0x935c('0x41')](_0x4405ce,{'type':db[_0x935c('0x70')]['QueryTypes']['SELECT'],'raw':!![]})[_0x935c('0x1e')](function(_0x3a735e){return _0x3a735e;});})[_0x935c('0x1e')](function(_0xb54a94){if(_0xb54a94){_0x36cfac[_0x935c('0x27')][_0x935c('0x7e')]=_0xb54a94[0x0];if(!_0x514b52[_0x935c('0x59')][_0x935c('0x60')])return;return db[_0x935c('0x72')][_0x935c('0x57')]({'where':{'id':_0x514b52[_0x935c('0x59')][_0x935c('0x60')],'role':_0x935c('0x62')},'attributes':['id',_0x935c('0x38'),'fullname',_0x935c('0x74'),'internal'],'raw':!![]});}return null;})[_0x935c('0x1e')](function(_0x2476b1){if(!_0x2476b1)return null;_0x36cfac[_0x935c('0x27')][_0x935c('0x62')]=_0x2476b1;return _0x36cfac;})[_0x935c('0x1e')](function(_0x4a357b){if(_0x4a357b){_0x4a357b[_0x935c('0x27')][_0x935c('0x7f')]=util[_0x935c('0x5e')](_0x935c('0x76'),_0x514b52[_0x935c('0x61')][_0x935c('0x38')]);_0x4a357b[_0x935c('0x27')][_0x935c('0x77')]=_0x36cfac[_0x935c('0x77')];_0x4a357b[_0x935c('0x27')]['motionChannel']=_0x36cfac[_0x935c('0x77')];_0x4a357b[_0x935c('0x27')]['event']=_0x935c('0x34');respondWithRpcPromise(_0x935c('0x80'),_0x935c('0x80'),{'event':_0x935c('0x81'),'message':_[_0x935c('0x4d')](_0x36cfac[_0x935c('0x27')],JSON[_0x935c('0x7b')](_0x36cfac[_0x935c('0x68')]['formData']))},client9002);return _0x36cfac;}return null;})[_0x935c('0x1e')](respondWithResult(_0x57eb2,null))[_0x935c('0x29')](handleError(_0x57eb2,null));}; \ No newline at end of file +var _0x1029=['chat','ChatInteraction','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','contact','format','rejectmessage','formData','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./chatMessage.socket','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','end','name','send','index','map','ChatMessage','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','find','create','body','describe','chat-interactions','accept','read','readAt','UserId','agent','get','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse'];(function(_0xfb460f,_0x2afcd0){var _0x20d2e5=function(_0x5573f3){while(--_0x5573f3){_0xfb460f['push'](_0xfb460f['shift']());}};_0x20d2e5(++_0x2afcd0);}(_0x1029,0x19d));var _0x9102=function(_0x587e4d,_0x13cbde){_0x587e4d=_0x587e4d-0x0;var _0x5b833d=_0x1029[_0x587e4d];return _0x5b833d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9102('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9102('0x1'));var rp=require(_0x9102('0x2'));var moment=require('moment');var BPromise=require(_0x9102('0x3'));var Mustache=require(_0x9102('0x4'));var util=require(_0x9102('0x5'));var path=require(_0x9102('0x6'));var sox=require(_0x9102('0x7'));var csv=require(_0x9102('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9102('0x9'));var _=require('lodash');var squel=require(_0x9102('0xa'));var crypto=require(_0x9102('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9102('0xc'));var toCsv=require(_0x9102('0x8'));var querystring=require('querystring');var Papa=require(_0x9102('0xd'));var Redis=require(_0x9102('0xe'));var authService=require(_0x9102('0xf'));var qs=require(_0x9102('0x10'));var as=require(_0x9102('0x11'));var hardwareService=require(_0x9102('0x12'));var logger=require(_0x9102('0x13'))(_0x9102('0x14'));var utils=require(_0x9102('0x15'));var config=require(_0x9102('0x16'));var licenseUtil=require(_0x9102('0x17'));var db=require(_0x9102('0x18'))['db'];config['redis']=_['defaults'](config[_0x9102('0x19')],{'host':_0x9102('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9102('0x1b'))[_0x9102('0x1c')](socket);var jayson=require(_0x9102('0x1d'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x9102('0x1e')][_0x9102('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x56359a,_0x2ebeaf,_0x2183b5,_0x58425d){return new BPromise(function(_0x3ab32f,_0x4726df){var _0x53f24a=_0x58425d||client;return _0x53f24a['request'](_0x56359a,_0x2183b5)[_0x9102('0x20')](function(_0x9b8b92){logger[_0x9102('0x21')](_0x9102('0x22'),_0x2ebeaf,'request\x20sent');logger[_0x9102('0x23')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x2ebeaf,'request\x20sent',JSON[_0x9102('0x24')](_0x9b8b92));if(_0x9b8b92['error']){if(_0x9b8b92[_0x9102('0x25')][_0x9102('0x26')]===0x1f4){logger[_0x9102('0x25')](_0x9102('0x22'),_0x2ebeaf,_0x9b8b92['error'][_0x9102('0x27')]);return _0x4726df(_0x9b8b92[_0x9102('0x25')][_0x9102('0x27')]);}logger[_0x9102('0x25')]('ChatMessage,\x20%s,\x20%s',_0x2ebeaf,_0x9b8b92[_0x9102('0x25')]['message']);return _0x3ab32f(_0x9b8b92[_0x9102('0x25')][_0x9102('0x27')]);}else{logger[_0x9102('0x21')](_0x9102('0x22'),_0x2ebeaf,_0x9102('0x28'));_0x3ab32f(_0x9b8b92[_0x9102('0x29')]['message']);}})['catch'](function(_0x3854a8){logger[_0x9102('0x25')](_0x9102('0x22'),_0x2ebeaf,_0x3854a8);_0x4726df(_0x3854a8);});});}function respondWithStatusCode(_0x351d76,_0x14b49c){_0x14b49c=_0x14b49c||0xcc;return function(_0x1769be){if(_0x1769be){return _0x351d76[_0x9102('0x2a')](_0x14b49c);}return _0x351d76[_0x9102('0x2b')](_0x14b49c)['end']();};}function respondWithResult(_0x54f826,_0x5d8311){_0x5d8311=_0x5d8311||0xc8;return function(_0x2292de){if(_0x2292de){return _0x54f826[_0x9102('0x2b')](_0x5d8311)[_0x9102('0x2c')](_0x2292de);}};}function respondWithFilteredResult(_0x15103a,_0x29b25e){return function(_0x7f20){if(_0x7f20){var _0x3ff679=typeof _0x29b25e[_0x9102('0x2d')]===_0x9102('0x2e')&&typeof _0x29b25e[_0x9102('0x2f')]==='undefined';var _0x413dc6=_0x7f20[_0x9102('0x30')];var _0x5c5649=_0x3ff679?0x0:_0x29b25e[_0x9102('0x2d')];var _0x242728=_0x3ff679?_0x7f20[_0x9102('0x30')]:_0x29b25e[_0x9102('0x2d')]+_0x29b25e[_0x9102('0x2f')];var _0xb1ccf2;if(_0x242728>=_0x413dc6){_0x242728=_0x413dc6;_0xb1ccf2=0xc8;}else{_0xb1ccf2=0xce;}_0x15103a[_0x9102('0x2b')](_0xb1ccf2);return _0x15103a[_0x9102('0x31')]('Content-Range',_0x5c5649+'-'+_0x242728+'/'+_0x413dc6)[_0x9102('0x2c')](_0x7f20);}return null;};}function patchUpdates(_0x537e7f){return function(_0x5c8a51){try{jsonpatch[_0x9102('0x32')](_0x5c8a51,_0x537e7f,!![]);}catch(_0x41513d){return BPromise[_0x9102('0x33')](_0x41513d);}return _0x5c8a51[_0x9102('0x34')]();};}function saveUpdates(_0x2c0441,_0x271c6){return function(_0x2e5bc6){if(_0x2e5bc6){return _0x2e5bc6[_0x9102('0x35')](_0x2c0441)[_0x9102('0x20')](function(_0x5407bb){return _0x5407bb;});}return null;};}function removeEntity(_0x38c44d,_0x514cbb){return function(_0x5de665){if(_0x5de665){return _0x5de665[_0x9102('0x36')]()[_0x9102('0x20')](function(){_0x38c44d[_0x9102('0x2b')](0xcc)[_0x9102('0x37')]();});}};}function handleEntityNotFound(_0x335585,_0x5813eb){return function(_0x3daf0c){if(!_0x3daf0c){_0x335585[_0x9102('0x2a')](0x194);}return _0x3daf0c;};}function handleError(_0x5e13e9,_0xf88337){_0xf88337=_0xf88337||0x1f4;return function(_0x47f6c7){logger[_0x9102('0x25')](_0x47f6c7['stack']);if(_0x47f6c7[_0x9102('0x38')]){delete _0x47f6c7[_0x9102('0x38')];}_0x5e13e9[_0x9102('0x2b')](_0xf88337)[_0x9102('0x39')](_0x47f6c7);};}exports[_0x9102('0x3a')]=function(_0xe1be9,_0x5b2b30){var _0x5e32e7={},_0x493abf={},_0x2a7af7={'count':0x0,'rows':[]};var _0x1ca04d=_[_0x9102('0x3b')](db[_0x9102('0x3c')]['rawAttributes'],function(_0xa0b90){return{'name':_0xa0b90[_0x9102('0x3d')],'type':_0xa0b90[_0x9102('0x3e')][_0x9102('0x3f')]};});_0x493abf[_0x9102('0x40')]=_['map'](_0x1ca04d,_0x9102('0x38'));_0x493abf[_0x9102('0x41')]=_['keys'](_0xe1be9[_0x9102('0x41')]);_0x493abf['filters']=_[_0x9102('0x42')](_0x493abf[_0x9102('0x40')],_0x493abf[_0x9102('0x41')]);_0x5e32e7[_0x9102('0x43')]=_['intersection'](_0x493abf[_0x9102('0x40')],qs[_0x9102('0x44')](_0xe1be9[_0x9102('0x41')][_0x9102('0x44')]));_0x5e32e7['attributes']=_0x5e32e7['attributes'][_0x9102('0x45')]?_0x5e32e7[_0x9102('0x43')]:_0x493abf[_0x9102('0x40')];if(!_0xe1be9[_0x9102('0x41')][_0x9102('0x46')](_0x9102('0x47'))){_0x5e32e7[_0x9102('0x2f')]=qs[_0x9102('0x2f')](_0xe1be9[_0x9102('0x41')][_0x9102('0x2f')]);_0x5e32e7[_0x9102('0x2d')]=qs[_0x9102('0x2d')](_0xe1be9[_0x9102('0x41')]['offset']);}_0x5e32e7[_0x9102('0x48')]=qs[_0x9102('0x49')](_0xe1be9[_0x9102('0x41')][_0x9102('0x49')]);_0x5e32e7['where']=qs[_0x9102('0x4a')](_[_0x9102('0x4b')](_0xe1be9[_0x9102('0x41')],_0x493abf['filters']),_0x1ca04d);if(_0xe1be9[_0x9102('0x41')][_0x9102('0x4c')]){_0x5e32e7['where']=_[_0x9102('0x4d')](_0x5e32e7['where'],{'$or':_['map'](_0x1ca04d,function(_0x186de3){if(_0x186de3[_0x9102('0x3e')]!==_0x9102('0x4e')){var _0x4f326d={};_0x4f326d[_0x186de3[_0x9102('0x38')]]={'$like':'%'+_0xe1be9[_0x9102('0x41')]['filter']+'%'};return _0x4f326d;}})});}_0x5e32e7=_[_0x9102('0x4d')]({},_0x5e32e7,_0xe1be9['options']);var _0x366be8={'where':_0x5e32e7['where']};return db['ChatMessage'][_0x9102('0x30')](_0x366be8)[_0x9102('0x20')](function(_0x516976){_0x2a7af7[_0x9102('0x30')]=_0x516976;if(_0xe1be9[_0x9102('0x41')][_0x9102('0x4f')]){_0x5e32e7[_0x9102('0x50')]=[{'all':!![]}];}return db[_0x9102('0x3c')][_0x9102('0x51')](_0x5e32e7);})[_0x9102('0x20')](function(_0x44d8c3){_0x2a7af7[_0x9102('0x52')]=_0x44d8c3;return _0x2a7af7;})[_0x9102('0x20')](respondWithFilteredResult(_0x5b2b30,_0x5e32e7))[_0x9102('0x53')](handleError(_0x5b2b30,null));};exports[_0x9102('0x54')]=function(_0x55e103,_0xa37df8){var _0x1a9052={'raw':!![],'where':{'id':_0x55e103[_0x9102('0x55')]['id']}},_0x5e3cd6={};_0x5e3cd6[_0x9102('0x40')]=_['keys'](db[_0x9102('0x3c')][_0x9102('0x56')]);_0x5e3cd6[_0x9102('0x41')]=_[_0x9102('0x57')](_0x55e103[_0x9102('0x41')]);_0x5e3cd6[_0x9102('0x4a')]=_[_0x9102('0x42')](_0x5e3cd6[_0x9102('0x40')],_0x5e3cd6[_0x9102('0x41')]);_0x1a9052['attributes']=_[_0x9102('0x42')](_0x5e3cd6['model'],qs['fields'](_0x55e103[_0x9102('0x41')]['fields']));_0x1a9052[_0x9102('0x43')]=_0x1a9052[_0x9102('0x43')]['length']?_0x1a9052[_0x9102('0x43')]:_0x5e3cd6[_0x9102('0x40')];if(_0x55e103[_0x9102('0x41')][_0x9102('0x4f')]){_0x1a9052[_0x9102('0x50')]=[{'all':!![]}];}_0x1a9052=_[_0x9102('0x4d')]({},_0x1a9052,_0x55e103['options']);return db[_0x9102('0x3c')][_0x9102('0x58')](_0x1a9052)['then'](handleEntityNotFound(_0xa37df8,null))['then'](respondWithResult(_0xa37df8,null))['catch'](handleError(_0xa37df8,null));};exports['create']=function(_0xf05db6,_0x29afec){return db[_0x9102('0x3c')][_0x9102('0x59')](_0xf05db6[_0x9102('0x5a')],{})[_0x9102('0x20')](respondWithResult(_0x29afec,0xc9))[_0x9102('0x53')](handleError(_0x29afec,null));};exports[_0x9102('0x35')]=function(_0x432ba0,_0x9d5aa9){if(_0x432ba0['body']['id']){delete _0x432ba0[_0x9102('0x5a')]['id'];}return db[_0x9102('0x3c')][_0x9102('0x58')]({'where':{'id':_0x432ba0[_0x9102('0x55')]['id']}})[_0x9102('0x20')](handleEntityNotFound(_0x9d5aa9,null))['then'](saveUpdates(_0x432ba0[_0x9102('0x5a')],null))[_0x9102('0x20')](respondWithResult(_0x9d5aa9,null))[_0x9102('0x53')](handleError(_0x9d5aa9,null));};exports['destroy']=function(_0x16783a,_0x45fefe){return db['ChatMessage'][_0x9102('0x58')]({'where':{'id':_0x16783a['params']['id']}})[_0x9102('0x20')](handleEntityNotFound(_0x45fefe,null))[_0x9102('0x20')](removeEntity(_0x45fefe,null))['catch'](handleError(_0x45fefe,null));};exports[_0x9102('0x5b')]=function(_0x20cc43,_0x1bb997){return db[_0x9102('0x3c')]['describe']()[_0x9102('0x20')](respondWithResult(_0x1bb997,null))[_0x9102('0x53')](handleError(_0x1bb997,null));};var interaction_log=require(_0x9102('0x13'))(_0x9102('0x5c'));exports[_0x9102('0x5d')]=function(_0x4d9a49,_0x12e964,_0x3bc98c){var _0x5758d3={'agent':{},'channel':'chat'};if(_0x4d9a49['body']['id']){delete _0x4d9a49[_0x9102('0x5a')]['id'];}_0x4d9a49[_0x9102('0x5a')][_0x9102('0x5e')]=!![];_0x4d9a49[_0x9102('0x5a')][_0x9102('0x5f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4d9a49[_0x9102('0x5a')][_0x9102('0x60')]=_0x4d9a49[_0x9102('0x5a')][_0x9102('0x60')]||_0x4d9a49['user']['id'];_0x5758d3[_0x9102('0x61')]['id']=_0x4d9a49[_0x9102('0x5a')]['UserId'];return db[_0x9102('0x3c')][_0x9102('0x58')]({'where':{'id':_0x4d9a49['params']['id'],'UserId':null}})[_0x9102('0x20')](handleEntityNotFound(_0x12e964,null))[_0x9102('0x20')](saveUpdates(_0x4d9a49['body'],null))['then'](function(_0x1f4e97){if(_0x1f4e97){_0x5758d3[_0x9102('0x27')]=_0x1f4e97[_0x9102('0x62')]({'plain':!![]});return db['ChatInteraction'][_0x9102('0x58')]({'where':{'id':_0x1f4e97['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x12e964,null))[_0x9102('0x20')](function(_0xe7da8e){if(_0xe7da8e){return _0xe7da8e[_0x9102('0x35')]({'UserId':_0x4d9a49[_0x9102('0x5a')][_0x9102('0x60')],'read1stAt':_['isNil'](_0xe7da8e[_0x9102('0x63')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x36bc59){if(_0x36bc59){_0x5758d3[_0x9102('0x64')]=_0x36bc59[_0x9102('0x62')]({'plain':!![]});interaction_log[_0x9102('0x21')](_0x9102('0x65'),_0x4d9a49[_0x9102('0x66')]['id'],_0x4d9a49['user']['name'],_0x4d9a49[_0x9102('0x66')]['role'],_0x5758d3[_0x9102('0x64')]['id'],_0x4d9a49[_0x9102('0x5a')]?JSON['stringify'](_0x4d9a49['body']):'null');return respondWithRpcPromise(_0x9102('0x67'),_0x9102('0x68'),_0x5758d3);}return null;})[_0x9102('0x20')](function(_0x3cf7e1){var _0x3bc9a5=_0x9102('0x69')+_0x3cf7e1[_0x9102('0x27')][_0x9102('0x6a')];return db['sequelize'][_0x9102('0x41')](_0x3bc9a5,{'type':db[_0x9102('0x6b')][_0x9102('0x6c')][_0x9102('0x6d')],'raw':!![]})[_0x9102('0x20')](function(_0x4e5c43){return _0x4e5c43;});})[_0x9102('0x20')](function(_0x3aab32){if(_0x3aab32){_0x5758d3['message']['contact']=_0x3aab32[0x0];if(!_0x4d9a49[_0x9102('0x5a')][_0x9102('0x60')])return;return db[_0x9102('0x6e')][_0x9102('0x58')]({'where':{'id':_0x4d9a49[_0x9102('0x5a')][_0x9102('0x60')],'role':_0x9102('0x61')},'attributes':['id',_0x9102('0x38'),_0x9102('0x6f'),_0x9102('0x70'),_0x9102('0x71')],'raw':!![]});}return null;})[_0x9102('0x20')](function(_0xfb8fc3){if(!_0xfb8fc3)return null;_0x5758d3['message'][_0x9102('0x61')]=_0xfb8fc3;return _0x5758d3;})[_0x9102('0x20')](function(_0x237362){if(_0x237362){if(_0x4d9a49[_0x9102('0x5a')][_0x9102('0x72')]){_0x5758d3[_0x9102('0x27')][_0x9102('0x73')]=util['format'](_0x9102('0x74'),_0x4d9a49['user'][_0x9102('0x38')]);_0x5758d3[_0x9102('0x27')][_0x9102('0x75')]=_0x5758d3[_0x9102('0x75')];_0x5758d3[_0x9102('0x27')][_0x9102('0x76')]=_0x5758d3['channel'];_0x5758d3[_0x9102('0x27')][_0x9102('0x77')]=_0x9102('0x5d');return respondWithRpcPromise(_0x9102('0x78'),_0x9102('0x78'),{'event':_0x9102('0x79'),'message':_[_0x9102('0x4d')](_0x5758d3[_0x9102('0x27')],JSON[_0x9102('0x7a')](_0x5758d3[_0x9102('0x64')]['formData']))},client9002)[_0x9102('0x20')](function(){return _0x5758d3;});}return _0x5758d3;}return null;})[_0x9102('0x20')](respondWithResult(_0x12e964,null))[_0x9102('0x53')](handleError(_0x12e964,null));};var interaction_log=require(_0x9102('0x13'))('chat-interactions');exports[_0x9102('0x33')]=function(_0xe57193,_0x4dff95,_0x4e7446){var _0x4ed058={'agent':{},'channel':_0x9102('0x7b')};if(_0xe57193['body']['id']){delete _0xe57193[_0x9102('0x5a')]['id'];}_0xe57193['body'][_0x9102('0x60')]=_0xe57193[_0x9102('0x5a')][_0x9102('0x60')]||_0xe57193[_0x9102('0x66')]['id'];_0x4ed058[_0x9102('0x61')]['id']=_0xe57193[_0x9102('0x5a')][_0x9102('0x60')];return db[_0x9102('0x3c')][_0x9102('0x58')]({'where':{'id':_0xe57193[_0x9102('0x55')]['id'],'UserId':null}})[_0x9102('0x20')](handleEntityNotFound(_0x4dff95,null))['then'](function(_0x58f635){if(_0x58f635){_0x4ed058[_0x9102('0x27')]=_0x58f635[_0x9102('0x62')]({'plain':!![]});return db[_0x9102('0x7c')]['find']({'where':{'id':_0x58f635[_0x9102('0x7d')]}});}return null;})[_0x9102('0x20')](handleEntityNotFound(_0x4dff95,null))['then'](function(_0x53f608){if(_0x53f608){_0x4ed058[_0x9102('0x64')]=_0x53f608[_0x9102('0x62')]({'plain':!![]});interaction_log[_0x9102('0x21')](_0x9102('0x7e'),_0xe57193['user']['id'],_0xe57193[_0x9102('0x66')][_0x9102('0x38')],_0xe57193[_0x9102('0x66')][_0x9102('0x7f')],_0x4ed058['interaction']['id'],_0xe57193[_0x9102('0x5a')]?JSON[_0x9102('0x24')](_0xe57193[_0x9102('0x5a')]):_0x9102('0x80'));return respondWithRpcPromise(_0x9102('0x81'),'rejectMessage',_0x4ed058);}return null;})[_0x9102('0x20')](function(_0x3632bb){var _0x36ce44=_0x9102('0x69')+_0x3632bb['message']['ContactId'];return db['sequelize']['query'](_0x36ce44,{'type':db['Sequelize'][_0x9102('0x6c')][_0x9102('0x6d')],'raw':!![]})['then'](function(_0x44751d){return _0x44751d;});})[_0x9102('0x20')](function(_0x64533b){if(_0x64533b){_0x4ed058[_0x9102('0x27')][_0x9102('0x82')]=_0x64533b[0x0];if(!_0xe57193['body'][_0x9102('0x60')])return;return db[_0x9102('0x6e')]['find']({'where':{'id':_0xe57193[_0x9102('0x5a')][_0x9102('0x60')],'role':_0x9102('0x61')},'attributes':['id','name',_0x9102('0x6f'),_0x9102('0x70'),'internal'],'raw':!![]});}return null;})['then'](function(_0x4f49aa){if(!_0x4f49aa)return null;_0x4ed058[_0x9102('0x27')][_0x9102('0x61')]=_0x4f49aa;return _0x4ed058;})[_0x9102('0x20')](function(_0x4a0377){if(_0x4a0377){_0x4a0377[_0x9102('0x27')][_0x9102('0x73')]=util[_0x9102('0x83')](_0x9102('0x74'),_0xe57193['user'][_0x9102('0x38')]);_0x4a0377[_0x9102('0x27')][_0x9102('0x75')]=_0x4ed058['channel'];_0x4a0377['message'][_0x9102('0x76')]=_0x4ed058[_0x9102('0x75')];_0x4a0377[_0x9102('0x27')][_0x9102('0x77')]='reject';respondWithRpcPromise(_0x9102('0x78'),_0x9102('0x78'),{'event':_0x9102('0x84'),'message':_['merge'](_0x4ed058[_0x9102('0x27')],JSON['parse'](_0x4ed058[_0x9102('0x64')][_0x9102('0x85')]))},client9002);return _0x4ed058;}return null;})[_0x9102('0x20')](respondWithResult(_0x4dff95,null))[_0x9102('0x53')](handleError(_0x4dff95,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 17c06da..c5db65c 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 _0x1417=['ChatMessage','setMaxListeners','update','remove','emit','events'];(function(_0x500404,_0x4b70f9){var _0x1cda34=function(_0x5f361a){while(--_0x5f361a){_0x500404['push'](_0x500404['shift']());}};_0x1cda34(++_0x4b70f9);}(_0x1417,0x71));var _0x7141=function(_0x315086,_0xb1fec4){_0x315086=_0x315086-0x0;var _0x3ffa0c=_0x1417[_0x315086];return _0x3ffa0c;};'use strict';var EventEmitter=require(_0x7141('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x7141('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x7141('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7141('0x3'),'afterDestroy':_0x7141('0x4')};function emitEvent(_0x5af999){return function(_0x326502,_0x189e3f,_0x781394){ChatMessageEvents['emit'](_0x5af999+':'+_0x326502['id'],_0x326502);ChatMessageEvents[_0x7141('0x5')](_0x5af999,_0x326502);_0x781394(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0xf1c8=['exports','events','ChatMessage','setMaxListeners','update','remove','emit'];(function(_0x315774,_0x45e588){var _0x4933d4=function(_0x137464){while(--_0x137464){_0x315774['push'](_0x315774['shift']());}};_0x4933d4(++_0x45e588);}(_0xf1c8,0x10b));var _0x8f1c=function(_0xdd82f7,_0x3b6031){_0xdd82f7=_0xdd82f7-0x0;var _0x464a5b=_0xf1c8[_0xdd82f7];return _0x464a5b;};'use strict';var EventEmitter=require(_0x8f1c('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x8f1c('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x8f1c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8f1c('0x3'),'afterDestroy':_0x8f1c('0x4')};function emitEvent(_0x36400f){return function(_0x27aefc,_0x366d8f,_0x393c35){ChatMessageEvents[_0x8f1c('0x5')](_0x36400f+':'+_0x27aefc['id'],_0x27aefc);ChatMessageEvents[_0x8f1c('0x5')](_0x36400f,_0x27aefc);_0x393c35(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x8f1c('0x6')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 6ab039a..b148d35 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 _0xcefe=['api','moment','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','define','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','ChatInteraction','findOne','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x422345,_0x4e4c07){var _0x1f8f59=function(_0x234be9){while(--_0x234be9){_0x422345['push'](_0x422345['shift']());}};_0x1f8f59(++_0x4e4c07);}(_0xcefe,0x15a));var _0xecef=function(_0x57f8cd,_0x378850){_0x57f8cd=_0x57f8cd-0x0;var _0x2a65ea=_0xcefe[_0x57f8cd];return _0x2a65ea;};'use strict';var _=require(_0xecef('0x0'));var util=require('util');var logger=require(_0xecef('0x1'))(_0xecef('0x2'));var moment=require(_0xecef('0x3'));var BPromise=require('bluebird');var rp=require(_0xecef('0x4'));var fs=require('fs');var path=require(_0xecef('0x5'));var rimraf=require(_0xecef('0x6'));var config=require(_0xecef('0x7'));var attributes=require(_0xecef('0x8'));module['exports']=function(_0x5bc733,_0x147289){return _0x5bc733[_0xecef('0x9')]('ChatMessage',attributes,{'tableName':_0xecef('0xa'),'paranoid':![],'indexes':[{'name':_0xecef('0xb'),'fields':[_0xecef('0xc')],'type':_0xecef('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x41bb3f,_0x361e61,_0x36cc1b){var _0x316a26=_0x5bc733[_0xecef('0xe')];var _0x43e0c0=_0x41bb3f[_0xecef('0xf')]({'plain':!![]});if(_0x43e0c0[_0xecef('0x10')][_0xecef('0x11')]()==='in'||_0x43e0c0[_0xecef('0x10')][_0xecef('0x11')]()===_0xecef('0x12')&&!_0x43e0c0[_0xecef('0x13')]&&!_['isNil'](_0x43e0c0[_0xecef('0x14')])){_0x316a26[_0xecef('0x15')][_0xecef('0x16')]({'where':{'id':_0x43e0c0['ChatInteractionId']}})[_0xecef('0x17')](function(_0x29e515){if(_0x29e515){_0x29e515[_0xecef('0x18')]({'lastMsgAt':_0x43e0c0[_0xecef('0x19')],'lastMsgDirection':_0x43e0c0[_0xecef('0x10')][_0xecef('0x11')]()});}})[_0xecef('0x1a')](function(_0x29e69b){console[_0xecef('0x1b')](_0x29e69b);});}_0x36cc1b();}},'charset':'utf8mb4','collate':_0xecef('0x1c')});}; \ No newline at end of file +var _0x4435=['chat_messages','fti_chat_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','catch','error','utf8mb4','lodash','util','../../config/logger','api','path','rimraf','exports','define','ChatMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4435,0x1ef));var _0x5443=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x4435[_0x58dc25];return _0x21b0a7;};'use strict';var _=require(_0x5443('0x0'));var util=require(_0x5443('0x1'));var logger=require(_0x5443('0x2'))(_0x5443('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5443('0x4'));var rimraf=require(_0x5443('0x5'));var config=require('../../config/environment');var attributes=require('./chatMessage.attributes');module[_0x5443('0x6')]=function(_0x251c1b,_0x36d2db){return _0x251c1b[_0x5443('0x7')](_0x5443('0x8'),attributes,{'tableName':_0x5443('0x9'),'paranoid':![],'indexes':[{'name':_0x5443('0xa'),'fields':[_0x5443('0xb')],'type':_0x5443('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x40584d,_0x154131,_0x2abae0){var _0x2b75a6=_0x251c1b[_0x5443('0xd')];var _0x24d9a1=_0x40584d['get']({'plain':!![]});if(_0x24d9a1[_0x5443('0xe')][_0x5443('0xf')]()==='in'||_0x24d9a1['direction'][_0x5443('0xf')]()===_0x5443('0x10')&&!_0x24d9a1[_0x5443('0x11')]&&!_[_0x5443('0x12')](_0x24d9a1[_0x5443('0x13')])){_0x2b75a6[_0x5443('0x14')][_0x5443('0x15')]({'where':{'id':_0x24d9a1[_0x5443('0x16')]}})[_0x5443('0x17')](function(_0x156e5a){if(_0x156e5a){_0x156e5a[_0x5443('0x18')]({'lastMsgAt':_0x24d9a1['createdAt'],'lastMsgDirection':_0x24d9a1[_0x5443('0xe')][_0x5443('0xf')]()});}})[_0x5443('0x19')](function(_0x2b0692){console[_0x5443('0x1a')](_0x2b0692);});}_0x2abae0();}},'charset':_0x5443('0x1b'),'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 ad040e2..f9a726e 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 _0x63eb=['defaults','redis','socket.io-emitter','register','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','catch','ChatMessage','create','body','options','raw','CreateChatMessage','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x63eb,0x195));var _0xb63e=function(_0x30ca0b,_0x5cbe5b){_0x30ca0b=_0x30ca0b-0x0;var _0x320b45=_0x63eb[_0x30ca0b];return _0x320b45;};'use strict';var _=require(_0xb63e('0x0'));var util=require(_0xb63e('0x1'));var moment=require(_0xb63e('0x2'));var BPromise=require(_0xb63e('0x3'));var rs=require(_0xb63e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb63e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb63e('0x6'))(_0xb63e('0x7'));var config=require(_0xb63e('0x8'));var jayson=require(_0xb63e('0x9'));var client=jayson[_0xb63e('0xa')]['http']({'port':0x232a});config['redis']=_[_0xb63e('0xb')](config[_0xb63e('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xb63e('0xd'))(new Redis(config['redis']));require('./chatMessage.socket')[_0xb63e('0xe')](socket);function respondWithRpcPromise(_0x1ab60b,_0x31887c,_0x3d196d){return new BPromise(function(_0x8a9280,_0x5bfb39){return client[_0xb63e('0xf')](_0x1ab60b,_0x3d196d)[_0xb63e('0x10')](function(_0xb4d903){logger['info'](_0xb63e('0x11'),_0x31887c,_0xb63e('0x12'));logger[_0xb63e('0x13')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x31887c,_0xb63e('0x12'),JSON[_0xb63e('0x14')](_0xb4d903));if(_0xb4d903['error']){if(_0xb4d903['error'][_0xb63e('0x15')]===0x1f4){logger[_0xb63e('0x16')](_0xb63e('0x11'),_0x31887c,_0xb4d903[_0xb63e('0x16')][_0xb63e('0x17')]);return _0x5bfb39(_0xb4d903[_0xb63e('0x16')]['message']);}logger[_0xb63e('0x16')](_0xb63e('0x11'),_0x31887c,_0xb4d903[_0xb63e('0x16')][_0xb63e('0x17')]);return _0x8a9280(_0xb4d903[_0xb63e('0x16')][_0xb63e('0x17')]);}else{logger[_0xb63e('0x18')](_0xb63e('0x11'),_0x31887c,_0xb63e('0x12'));_0x8a9280(_0xb4d903['result']['message']);}})[_0xb63e('0x19')](function(_0x32a606){logger[_0xb63e('0x16')](_0xb63e('0x11'),_0x31887c,_0x32a606);_0x5bfb39(_0x32a606);});});}exports['CreateChatMessage']=function(_0x17b1ed){var _0x40e991=this;return new Promise(function(_0x306bad,_0x40f9a2){return db[_0xb63e('0x1a')][_0xb63e('0x1b')](_0x17b1ed[_0xb63e('0x1c')],{'raw':_0x17b1ed[_0xb63e('0x1d')]?_0x17b1ed['options'][_0xb63e('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x274e10){logger[_0xb63e('0x18')](_0xb63e('0x1f'),_0x17b1ed);logger['debug'](_0xb63e('0x1f'),_0x17b1ed,JSON['stringify'](_0x274e10));_0x306bad(_0x274e10);})[_0xb63e('0x19')](function(_0x31629c){logger[_0xb63e('0x16')](_0xb63e('0x1f'),_0x31629c[_0xb63e('0x17')],_0x17b1ed);_0x40f9a2(_0x40e991['error'](0x1f4,_0x31629c['message']));});});}; \ No newline at end of file +var _0xd51a=['CreateChatMessage','ChatMessage','create','body','options','raw','info','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','code','error','ChatMessage,\x20%s,\x20%s','message','result','catch'];(function(_0x36065b,_0x537564){var _0x37da57=function(_0x2038fc){while(--_0x2038fc){_0x36065b['push'](_0x36065b['shift']());}};_0x37da57(++_0x537564);}(_0xd51a,0x1c1));var _0xad51=function(_0x2e70a2,_0x5c9821){_0x2e70a2=_0x2e70a2-0x0;var _0x47e1de=_0xd51a[_0x2e70a2];return _0x47e1de;};'use strict';var _=require(_0xad51('0x0'));var util=require(_0xad51('0x1'));var moment=require(_0xad51('0x2'));var BPromise=require(_0xad51('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad51('0x4'))['db'];var utils=require(_0xad51('0x5'));var logger=require(_0xad51('0x6'))(_0xad51('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xad51('0x8')][_0xad51('0x9')]({'port':0x232a});config[_0xad51('0xa')]=_[_0xad51('0xb')](config[_0xad51('0xa')],{'host':_0xad51('0xc'),'port':0x18eb});var socket=require(_0xad51('0xd'))(new Redis(config[_0xad51('0xa')]));require(_0xad51('0xe'))[_0xad51('0xf')](socket);function respondWithRpcPromise(_0x290598,_0x18643e,_0x4675b5){return new BPromise(function(_0x5d98cc,_0x2ca6a0){return client[_0xad51('0x10')](_0x290598,_0x4675b5)[_0xad51('0x11')](function(_0xe0d045){logger['info']('ChatMessage,\x20%s,\x20%s',_0x18643e,_0xad51('0x12'));logger[_0xad51('0x13')](_0xad51('0x14'),_0x18643e,'request\x20sent',JSON['stringify'](_0xe0d045));if(_0xe0d045['error']){if(_0xe0d045['error'][_0xad51('0x15')]===0x1f4){logger[_0xad51('0x16')](_0xad51('0x17'),_0x18643e,_0xe0d045[_0xad51('0x16')][_0xad51('0x18')]);return _0x2ca6a0(_0xe0d045[_0xad51('0x16')][_0xad51('0x18')]);}logger[_0xad51('0x16')](_0xad51('0x17'),_0x18643e,_0xe0d045[_0xad51('0x16')][_0xad51('0x18')]);return _0x5d98cc(_0xe0d045['error'][_0xad51('0x18')]);}else{logger['info'](_0xad51('0x17'),_0x18643e,_0xad51('0x12'));_0x5d98cc(_0xe0d045[_0xad51('0x19')][_0xad51('0x18')]);}})[_0xad51('0x1a')](function(_0x29e151){logger[_0xad51('0x16')](_0xad51('0x17'),_0x18643e,_0x29e151);_0x2ca6a0(_0x29e151);});});}exports[_0xad51('0x1b')]=function(_0x1f003f){var _0x59fd48=this;return new Promise(function(_0x93c7,_0x45efe5){return db[_0xad51('0x1c')][_0xad51('0x1d')](_0x1f003f[_0xad51('0x1e')],{'raw':_0x1f003f[_0xad51('0x1f')]?_0x1f003f[_0xad51('0x1f')][_0xad51('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2020a2){logger[_0xad51('0x21')](_0xad51('0x1b'),_0x1f003f);logger[_0xad51('0x13')]('CreateChatMessage',_0x1f003f,JSON['stringify'](_0x2020a2));_0x93c7(_0x2020a2);})['catch'](function(_0x2936b1){logger[_0xad51('0x16')](_0xad51('0x1b'),_0x2936b1[_0xad51('0x18')],_0x1f003f);_0x45efe5(_0x59fd48['error'](0x1f4,_0x2936b1[_0xad51('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 0134b96..713cee5 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 _0x1561=['chatMessage:','remove','update','removeListener','register','length'];(function(_0x462d45,_0xec23a){var _0x51acb3=function(_0x13e784){while(--_0x13e784){_0x462d45['push'](_0x462d45['shift']());}};_0x51acb3(++_0xec23a);}(_0x1561,0x1bd));var _0x1156=function(_0x4cd9dd,_0x3701c8){_0x4cd9dd=_0x4cd9dd-0x0;var _0x24446a=_0x1561[_0x4cd9dd];return _0x24446a;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save',_0x1156('0x0'),_0x1156('0x1')];function createListener(_0x14f74b,_0x1ce4ca){return function(_0x1f66f7){_0x1ce4ca['emit'](_0x14f74b,_0x1f66f7);};}function removeListener(_0x1be639,_0x2b0b90){return function(){ChatMessageEvents[_0x1156('0x2')](_0x1be639,_0x2b0b90);};}exports[_0x1156('0x3')]=function(_0x5c989c){for(var _0xb0dab7=0x0,_0x4a7048=events[_0x1156('0x4')];_0xb0dab7<_0x4a7048;_0xb0dab7++){var _0x6c3476=events[_0xb0dab7];var _0x273b53=createListener(_0x1156('0x5')+_0x6c3476,_0x5c989c);ChatMessageEvents['on'](_0x6c3476,_0x273b53);}}; \ No newline at end of file +var _0x2494=['update','emit','removeListener','chatMessage:','./chatMessage.events','remove'];(function(_0x17f847,_0x495454){var _0x1eefb3=function(_0x2e2522){while(--_0x2e2522){_0x17f847['push'](_0x17f847['shift']());}};_0x1eefb3(++_0x495454);}(_0x2494,0x82));var _0x4249=function(_0x16af0d,_0x1d590c){_0x16af0d=_0x16af0d-0x0;var _0x9b01bd=_0x2494[_0x16af0d];return _0x9b01bd;};'use strict';var ChatMessageEvents=require(_0x4249('0x0'));var events=['save',_0x4249('0x1'),_0x4249('0x2')];function createListener(_0x3cdee4,_0x3f9dc6){return function(_0x161e6b){_0x3f9dc6[_0x4249('0x3')](_0x3cdee4,_0x161e6b);};}function removeListener(_0x5decbd,_0x4fdc12){return function(){ChatMessageEvents[_0x4249('0x4')](_0x5decbd,_0x4fdc12);};}exports['register']=function(_0x3c2d8d){for(var _0x1d4ca8=0x0,_0xed716a=events['length'];_0x1d4ca8<_0xed716a;_0x1d4ca8++){var _0x326336=events[_0x1d4ca8];var _0x2b7934=createListener(_0x4249('0x5')+_0x326336,_0x3c2d8d);ChatMessageEvents['on'](_0x326336,_0x2b7934);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index cd2c09a..47ee0e9 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 _0x8206=['delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','post','tracked','chat','chatmessage:create','create','put','update','/:id/accept','accept','reject'];(function(_0x531924,_0x5642f5){var _0x5b9d45=function(_0x2ed9b0){while(--_0x2ed9b0){_0x531924['push'](_0x531924['shift']());}};_0x5b9d45(++_0x5642f5);}(_0x8206,0x9f));var _0x6820=function(_0x98f6c3,_0x28639f){_0x98f6c3=_0x98f6c3-0x0;var _0x29238c=_0x8206[_0x98f6c3];return _0x29238c;};'use strict';var multer=require(_0x6820('0x0'));var util=require(_0x6820('0x1'));var path=require(_0x6820('0x2'));var timeout=require(_0x6820('0x3'));var express=require(_0x6820('0x4'));var router=express['Router']();var fs_extra=require(_0x6820('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6820('0x6'));var config=require('../../config/environment');var controller=require('./chatMessage.controller');router[_0x6820('0x7')]('/',auth['isAuthenticated'](),controller[_0x6820('0x8')]);router[_0x6820('0x7')](_0x6820('0x9'),auth[_0x6820('0xa')](),controller[_0x6820('0xb')]);router[_0x6820('0x7')](_0x6820('0xc'),auth[_0x6820('0xa')](),controller['show']);router[_0x6820('0xd')]('/',auth[_0x6820('0xa')](),interaction[_0x6820('0xe')](_0x6820('0xf'),_0x6820('0x10')),controller[_0x6820('0x11')]);router[_0x6820('0x12')](_0x6820('0xc'),controller[_0x6820('0x13')]);router[_0x6820('0x12')](_0x6820('0x14'),auth[_0x6820('0xa')](),controller[_0x6820('0x15')]);router[_0x6820('0x12')]('/:id/reject',auth[_0x6820('0xa')](),controller[_0x6820('0x16')]);router[_0x6820('0x17')](_0x6820('0xc'),auth[_0x6820('0xa')](),controller[_0x6820('0x18')]);module[_0x6820('0x19')]=router; \ No newline at end of file +var _0xd03b=['/describe','/:id','show','post','tracked','chat','chatmessage:create','create','put','update','accept','/:id/reject','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index'];(function(_0x3dfeb9,_0x1cc6e4){var _0x412314=function(_0x321253){while(--_0x321253){_0x3dfeb9['push'](_0x3dfeb9['shift']());}};_0x412314(++_0x1cc6e4);}(_0xd03b,0x1bf));var _0xbd03=function(_0x46ba87,_0x222314){_0x46ba87=_0x46ba87-0x0;var _0xd1974e=_0xd03b[_0x46ba87];return _0xd1974e;};'use strict';var multer=require(_0xbd03('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbd03('0x1'));var express=require(_0xbd03('0x2'));var router=express[_0xbd03('0x3')]();var fs_extra=require(_0xbd03('0x4'));var auth=require(_0xbd03('0x5'));var interaction=require(_0xbd03('0x6'));var config=require(_0xbd03('0x7'));var controller=require(_0xbd03('0x8'));router[_0xbd03('0x9')]('/',auth[_0xbd03('0xa')](),controller[_0xbd03('0xb')]);router[_0xbd03('0x9')](_0xbd03('0xc'),auth[_0xbd03('0xa')](),controller['describe']);router[_0xbd03('0x9')](_0xbd03('0xd'),auth['isAuthenticated'](),controller[_0xbd03('0xe')]);router[_0xbd03('0xf')]('/',auth[_0xbd03('0xa')](),interaction[_0xbd03('0x10')](_0xbd03('0x11'),_0xbd03('0x12')),controller[_0xbd03('0x13')]);router[_0xbd03('0x14')](_0xbd03('0xd'),controller[_0xbd03('0x15')]);router[_0xbd03('0x14')]('/:id/accept',auth[_0xbd03('0xa')](),controller[_0xbd03('0x16')]);router[_0xbd03('0x14')](_0xbd03('0x17'),auth[_0xbd03('0xa')](),controller['reject']);router[_0xbd03('0x18')]('/:id',auth[_0xbd03('0xa')](),controller[_0xbd03('0x19')]);module[_0xbd03('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index fcc3dbe..6a5c0f7 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 _0xd1ac=['exports','TEXT','sequelize'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0xd1ac,0xa1));var _0xcd1a=function(_0x4c2af0,_0x40921a){_0x4c2af0=_0x4c2af0-0x0;var _0x259f2c=_0xd1ac[_0x4c2af0];return _0x259f2c;};'use strict';var Sequelize=require(_0xcd1a('0x0'));module[_0xcd1a('0x1')]={'body':{'type':Sequelize[_0xcd1a('0x2')]('medium'),'allowNull':![]}}; \ No newline at end of file +var _0x390c=['TEXT','medium','exports'];(function(_0x5b7d6a,_0x63e6a2){var _0x992adf=function(_0x4511ae){while(--_0x4511ae){_0x5b7d6a['push'](_0x5b7d6a['shift']());}};_0x992adf(++_0x63e6a2);}(_0x390c,0x16d));var _0xc390=function(_0x4d3c3b,_0x156cb4){_0x4d3c3b=_0x4d3c3b-0x0;var _0x10966a=_0x390c[_0x4d3c3b];return _0x10966a;};'use strict';var Sequelize=require('sequelize');module[_0xc390('0x0')]={'body':{'type':Sequelize[_0xc390('0x1')](_0xc390('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 53a8f5d..66c0985 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(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0x7a54,0x106));var _0x47a5=function(_0x30a099,_0x2eb6bb){_0x30a099=_0x30a099-0x0;var _0x3fc35b=_0x7a54[_0x30a099];return _0x3fc35b;};'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(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x7a54,0x106));var _0x47a5=function(_0x32351c,_0x554b77){_0x32351c=_0x32351c-0x0;var _0x4eae19=_0x7a54[_0x32351c];return _0x4eae19;};'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.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 948a304..37391fe 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 _0x2a25=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','chat_offline_messages','utf8mb4_unicode_ci','lodash','util'];(function(_0x555ebb,_0x488366){var _0x1c2733=function(_0x4e8d65){while(--_0x4e8d65){_0x555ebb['push'](_0x555ebb['shift']());}};_0x1c2733(++_0x488366);}(_0x2a25,0xee));var _0x52a2=function(_0xbef85a,_0x23e70a){_0xbef85a=_0xbef85a-0x0;var _0x233d64=_0x2a25[_0xbef85a];return _0x233d64;};'use strict';var _=require(_0x52a2('0x0'));var util=require(_0x52a2('0x1'));var logger=require(_0x52a2('0x2'))(_0x52a2('0x3'));var moment=require(_0x52a2('0x4'));var BPromise=require(_0x52a2('0x5'));var rp=require(_0x52a2('0x6'));var fs=require('fs');var path=require(_0x52a2('0x7'));var rimraf=require(_0x52a2('0x8'));var config=require(_0x52a2('0x9'));var attributes=require('./chatOfflineMessage.attributes');module['exports']=function(_0x3d5157,_0x2bc6b7){return _0x3d5157['define']('ChatOfflineMessage',attributes,{'tableName':_0x52a2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x52a2('0xb')});}; \ No newline at end of file +var _0x8e25=['chat_offline_messages','utf8mb4_unicode_ci','lodash','util','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage'];(function(_0x176807,_0x137e37){var _0x26cd57=function(_0x4d3f71){while(--_0x4d3f71){_0x176807['push'](_0x176807['shift']());}};_0x26cd57(++_0x137e37);}(_0x8e25,0xce));var _0x58e2=function(_0x5f21aa,_0x659451){_0x5f21aa=_0x5f21aa-0x0;var _0x42047a=_0x8e25[_0x5f21aa];return _0x42047a;};'use strict';var _=require(_0x58e2('0x0'));var util=require(_0x58e2('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x58e2('0x2'));var fs=require('fs');var path=require(_0x58e2('0x3'));var rimraf=require(_0x58e2('0x4'));var config=require(_0x58e2('0x5'));var attributes=require(_0x58e2('0x6'));module[_0x58e2('0x7')]=function(_0x3f3766,_0x5f12e4){return _0x3f3766[_0x58e2('0x8')](_0x58e2('0x9'),attributes,{'tableName':_0x58e2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x58e2('0xb')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index b54365e..9c32e6d 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 _0x60ed=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','client','http','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x474952,_0x44bd77){var _0x332502=function(_0x540ebe){while(--_0x540ebe){_0x474952['push'](_0x474952['shift']());}};_0x332502(++_0x44bd77);}(_0x60ed,0x73));var _0xd60e=function(_0x24148d,_0xb1e251){_0x24148d=_0x24148d-0x0;var _0x4de78d=_0x60ed[_0x24148d];return _0x4de78d;};'use strict';var _=require(_0xd60e('0x0'));var util=require(_0xd60e('0x1'));var moment=require(_0xd60e('0x2'));var BPromise=require(_0xd60e('0x3'));var rs=require(_0xd60e('0x4'));var fs=require('fs');var Redis=require(_0xd60e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd60e('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd60e('0x7')][_0xd60e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3adc23,_0x47b2bf,_0x7988cb){return new BPromise(function(_0xa3aac7,_0xc22bc1){return client['request'](_0x3adc23,_0x7988cb)[_0xd60e('0x9')](function(_0x1ca561){logger[_0xd60e('0xa')](_0xd60e('0xb'),_0x47b2bf,_0xd60e('0xc'));logger[_0xd60e('0xd')](_0xd60e('0xe'),_0x47b2bf,_0xd60e('0xc'),JSON['stringify'](_0x1ca561));if(_0x1ca561[_0xd60e('0xf')]){if(_0x1ca561[_0xd60e('0xf')][_0xd60e('0x10')]===0x1f4){logger[_0xd60e('0xf')](_0xd60e('0xb'),_0x47b2bf,_0x1ca561[_0xd60e('0xf')][_0xd60e('0x11')]);return _0xc22bc1(_0x1ca561['error'][_0xd60e('0x11')]);}logger['error'](_0xd60e('0xb'),_0x47b2bf,_0x1ca561[_0xd60e('0xf')][_0xd60e('0x11')]);return _0xa3aac7(_0x1ca561[_0xd60e('0xf')][_0xd60e('0x11')]);}else{logger[_0xd60e('0xa')](_0xd60e('0xb'),_0x47b2bf,_0xd60e('0xc'));_0xa3aac7(_0x1ca561['result'][_0xd60e('0x11')]);}})[_0xd60e('0x12')](function(_0x2dfb82){logger[_0xd60e('0xf')](_0xd60e('0xb'),_0x47b2bf,_0x2dfb82);_0xc22bc1(_0x2dfb82);});});} \ No newline at end of file +var _0x66e6=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x519d31,_0x442b7b){var _0x4bf6d1=function(_0x43c4bc){while(--_0x43c4bc){_0x519d31['push'](_0x519d31['shift']());}};_0x4bf6d1(++_0x442b7b);}(_0x66e6,0xb1));var _0x666e=function(_0x36572f,_0x15ea8c){_0x36572f=_0x36572f-0x0;var _0x3d68de=_0x66e6[_0x36572f];return _0x3d68de;};'use strict';var _=require(_0x666e('0x0'));var util=require(_0x666e('0x1'));var moment=require('moment');var BPromise=require(_0x666e('0x2'));var rs=require(_0x666e('0x3'));var fs=require('fs');var Redis=require(_0x666e('0x4'));var db=require(_0x666e('0x5'))['db'];var utils=require(_0x666e('0x6'));var logger=require(_0x666e('0x7'))('rpc');var config=require(_0x666e('0x8'));var jayson=require(_0x666e('0x9'));var client=jayson[_0x666e('0xa')][_0x666e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d3b99,_0x5994a0,_0x1dfb59){return new BPromise(function(_0x12615e,_0x19f371){return client[_0x666e('0xc')](_0x2d3b99,_0x1dfb59)[_0x666e('0xd')](function(_0x1a21fc){logger[_0x666e('0xe')](_0x666e('0xf'),_0x5994a0,_0x666e('0x10'));logger[_0x666e('0x11')](_0x666e('0x12'),_0x5994a0,_0x666e('0x10'),JSON[_0x666e('0x13')](_0x1a21fc));if(_0x1a21fc[_0x666e('0x14')]){if(_0x1a21fc[_0x666e('0x14')]['code']===0x1f4){logger[_0x666e('0x14')](_0x666e('0xf'),_0x5994a0,_0x1a21fc[_0x666e('0x14')]['message']);return _0x19f371(_0x1a21fc[_0x666e('0x14')][_0x666e('0x15')]);}logger[_0x666e('0x14')](_0x666e('0xf'),_0x5994a0,_0x1a21fc[_0x666e('0x14')][_0x666e('0x15')]);return _0x12615e(_0x1a21fc[_0x666e('0x14')][_0x666e('0x15')]);}else{logger['info'](_0x666e('0xf'),_0x5994a0,_0x666e('0x10'));_0x12615e(_0x1a21fc['result'][_0x666e('0x15')]);}})[_0x666e('0x16')](function(_0x50e4da){logger[_0x666e('0x14')](_0x666e('0xf'),_0x5994a0,_0x50e4da);_0x19f371(_0x50e4da);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 386785a..a15a5e0 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 _0x8310=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post','create'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8310,0x10d));var _0x0831=function(_0x2a453b,_0x479c50){_0x2a453b=_0x2a453b-0x0;var _0x132f79=_0x8310[_0x2a453b];return _0x132f79;};'use strict';var multer=require(_0x0831('0x0'));var util=require(_0x0831('0x1'));var path=require(_0x0831('0x2'));var timeout=require(_0x0831('0x3'));var express=require(_0x0831('0x4'));var router=express[_0x0831('0x5')]();var fs_extra=require(_0x0831('0x6'));var auth=require(_0x0831('0x7'));var interaction=require(_0x0831('0x8'));var config=require(_0x0831('0x9'));var controller=require('./chatOfflineMessage.controller');router['get']('/',auth[_0x0831('0xa')](),controller[_0x0831('0xb')]);router[_0x0831('0xc')](_0x0831('0xd'),auth[_0x0831('0xa')](),controller[_0x0831('0xe')]);router[_0x0831('0xc')](_0x0831('0xf'),auth[_0x0831('0xa')](),controller[_0x0831('0x10')]);router[_0x0831('0x11')]('/',auth['isAuthenticated'](),controller[_0x0831('0x12')]);router[_0x0831('0x13')](_0x0831('0xf'),auth[_0x0831('0xa')](),controller[_0x0831('0x14')]);router[_0x0831('0x15')](_0x0831('0xf'),auth[_0x0831('0xa')](),controller[_0x0831('0x16')]);module[_0x0831('0x17')]=router; \ No newline at end of file +var _0xfd8d=['index','/describe','isAuthenticated','describe','/:id','show','post','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get'];(function(_0x2340b1,_0x52bbc0){var _0xde638e=function(_0xcbe807){while(--_0xcbe807){_0x2340b1['push'](_0x2340b1['shift']());}};_0xde638e(++_0x52bbc0);}(_0xfd8d,0xe5));var _0xdfd8=function(_0x987db8,_0x2aa504){_0x987db8=_0x987db8-0x0;var _0x5f30c8=_0xfd8d[_0x987db8];return _0x5f30c8;};'use strict';var multer=require(_0xdfd8('0x0'));var util=require(_0xdfd8('0x1'));var path=require(_0xdfd8('0x2'));var timeout=require(_0xdfd8('0x3'));var express=require('express');var router=express[_0xdfd8('0x4')]();var fs_extra=require(_0xdfd8('0x5'));var auth=require(_0xdfd8('0x6'));var interaction=require(_0xdfd8('0x7'));var config=require(_0xdfd8('0x8'));var controller=require(_0xdfd8('0x9'));router[_0xdfd8('0xa')]('/',auth['isAuthenticated'](),controller[_0xdfd8('0xb')]);router[_0xdfd8('0xa')](_0xdfd8('0xc'),auth[_0xdfd8('0xd')](),controller[_0xdfd8('0xe')]);router[_0xdfd8('0xa')](_0xdfd8('0xf'),auth[_0xdfd8('0xd')](),controller[_0xdfd8('0x10')]);router[_0xdfd8('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xdfd8('0xf'),auth[_0xdfd8('0xd')](),controller['update']);router[_0xdfd8('0x12')](_0xdfd8('0xf'),auth[_0xdfd8('0xd')](),controller['destroy']);module[_0xdfd8('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 5b240d5..73ec54f 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 _0x466d=['mouseOver','timeout','sequelize','exports','STRING','ENUM'];(function(_0x229103,_0x2813cb){var _0x1eb67d=function(_0x5efed9){while(--_0x5efed9){_0x229103['push'](_0x229103['shift']());}};_0x1eb67d(++_0x2813cb);}(_0x466d,0x80));var _0xd466=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0x466d[_0x3b5250];return _0xc844a1;};'use strict';var Sequelize=require(_0xd466('0x0'));module[_0xd466('0x1')]={'name':{'type':Sequelize[_0xd466('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xd466('0x3')](_0xd466('0x4'),_0xd466('0x5')),'defaultValue':_0xd466('0x4')},'selector':{'type':Sequelize[_0xd466('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x7fc0=['INTEGER','sequelize','exports','STRING','ENUM','mouseOver','timeout'];(function(_0x473b02,_0x4ed977){var _0x4ba0cd=function(_0x33fa20){while(--_0x33fa20){_0x473b02['push'](_0x473b02['shift']());}};_0x4ba0cd(++_0x4ed977);}(_0x7fc0,0x190));var _0x07fc=function(_0x579b79,_0x5b57b2){_0x579b79=_0x579b79-0x0;var _0x41e899=_0x7fc0[_0x579b79];return _0x41e899;};'use strict';var Sequelize=require(_0x07fc('0x0'));module[_0x07fc('0x1')]={'name':{'type':Sequelize[_0x07fc('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x07fc('0x3')](_0x07fc('0x4'),_0x07fc('0x5')),'defaultValue':_0x07fc('0x4')},'selector':{'type':Sequelize[_0x07fc('0x2')]},'timeout':{'type':Sequelize[_0x07fc('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 52b904c..2a70ad6 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 _0x0fcd=['body','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','undefined','count','offset','set','Content-Range','json','apply','save','update','then','destroy','end','error','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','ChatProactiveAction','find','create'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x0fcd,0x129));var _0xd0fc=function(_0x41b975,_0x3d52a8){_0x41b975=_0x41b975-0x0;var _0x37d28c=_0x0fcd[_0x41b975];return _0x37d28c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd0fc('0x0'));var zipdir=require(_0xd0fc('0x1'));var jsonpatch=require(_0xd0fc('0x2'));var rp=require(_0xd0fc('0x3'));var moment=require(_0xd0fc('0x4'));var BPromise=require(_0xd0fc('0x5'));var Mustache=require('mustache');var util=require(_0xd0fc('0x6'));var path=require(_0xd0fc('0x7'));var sox=require(_0xd0fc('0x8'));var csv=require(_0xd0fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd0fc('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd0fc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd0fc('0xc'));var toCsv=require(_0xd0fc('0x9'));var querystring=require(_0xd0fc('0xd'));var Papa=require('papaparse');var Redis=require(_0xd0fc('0xe'));var authService=require(_0xd0fc('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd0fc('0x10'));var logger=require(_0xd0fc('0x11'))(_0xd0fc('0x12'));var utils=require('../../config/utils');var config=require(_0xd0fc('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xd0fc('0x14'))['db'];function respondWithStatusCode(_0xe6df1f,_0x478b90){_0x478b90=_0x478b90||0xcc;return function(_0x2ccc68){if(_0x2ccc68){return _0xe6df1f[_0xd0fc('0x15')](_0x478b90);}return _0xe6df1f[_0xd0fc('0x16')](_0x478b90)['end']();};}function respondWithResult(_0x2f5405,_0x3f2e1f){_0x3f2e1f=_0x3f2e1f||0xc8;return function(_0x34492c){if(_0x34492c){return _0x2f5405['status'](_0x3f2e1f)['json'](_0x34492c);}};}function respondWithFilteredResult(_0x3f7fde,_0xd4f6a1){return function(_0x4304b0){if(_0x4304b0){var _0x4f7fe1=typeof _0xd4f6a1['offset']==='undefined'&&typeof _0xd4f6a1['limit']===_0xd0fc('0x17');var _0x4ced92=_0x4304b0[_0xd0fc('0x18')];var _0x5703f1=_0x4f7fe1?0x0:_0xd4f6a1[_0xd0fc('0x19')];var _0x20849d=_0x4f7fe1?_0x4304b0[_0xd0fc('0x18')]:_0xd4f6a1['offset']+_0xd4f6a1['limit'];var _0x53ac93;if(_0x20849d>=_0x4ced92){_0x20849d=_0x4ced92;_0x53ac93=0xc8;}else{_0x53ac93=0xce;}_0x3f7fde['status'](_0x53ac93);return _0x3f7fde[_0xd0fc('0x1a')](_0xd0fc('0x1b'),_0x5703f1+'-'+_0x20849d+'/'+_0x4ced92)[_0xd0fc('0x1c')](_0x4304b0);}return null;};}function patchUpdates(_0xb5c2fc){return function(_0x43d092){try{jsonpatch[_0xd0fc('0x1d')](_0x43d092,_0xb5c2fc,!![]);}catch(_0x10e8bd){return BPromise['reject'](_0x10e8bd);}return _0x43d092[_0xd0fc('0x1e')]();};}function saveUpdates(_0x25eb91,_0x4e914c){return function(_0x57d302){if(_0x57d302){return _0x57d302[_0xd0fc('0x1f')](_0x25eb91)[_0xd0fc('0x20')](function(_0x3b5491){return _0x3b5491;});}return null;};}function removeEntity(_0x2633f0,_0x1cdb25){return function(_0x3c24ae){if(_0x3c24ae){return _0x3c24ae[_0xd0fc('0x21')]()[_0xd0fc('0x20')](function(){_0x2633f0[_0xd0fc('0x16')](0xcc)[_0xd0fc('0x22')]();});}};}function handleEntityNotFound(_0x57d598,_0x305e0f){return function(_0x380635){if(!_0x380635){_0x57d598[_0xd0fc('0x15')](0x194);}return _0x380635;};}function handleError(_0x1af5a7,_0x3ebaad){_0x3ebaad=_0x3ebaad||0x1f4;return function(_0x94cbd){logger[_0xd0fc('0x23')](_0x94cbd[_0xd0fc('0x24')]);if(_0x94cbd[_0xd0fc('0x25')]){delete _0x94cbd[_0xd0fc('0x25')];}_0x1af5a7[_0xd0fc('0x16')](_0x3ebaad)[_0xd0fc('0x26')](_0x94cbd);};}exports[_0xd0fc('0x27')]=function(_0x739792,_0x2fcd27){var _0x758d5d={'raw':!![],'where':{'id':_0x739792[_0xd0fc('0x28')]['id']}},_0x131fdc={};_0x131fdc[_0xd0fc('0x29')]=_[_0xd0fc('0x2a')](db['ChatProactiveAction'][_0xd0fc('0x2b')]);_0x131fdc[_0xd0fc('0x2c')]=_[_0xd0fc('0x2a')](_0x739792[_0xd0fc('0x2c')]);_0x131fdc[_0xd0fc('0x2d')]=_[_0xd0fc('0x2e')](_0x131fdc[_0xd0fc('0x29')],_0x131fdc['query']);_0x758d5d[_0xd0fc('0x2f')]=_[_0xd0fc('0x2e')](_0x131fdc['model'],qs['fields'](_0x739792[_0xd0fc('0x2c')][_0xd0fc('0x30')]));_0x758d5d[_0xd0fc('0x2f')]=_0x758d5d[_0xd0fc('0x2f')][_0xd0fc('0x31')]?_0x758d5d['attributes']:_0x131fdc[_0xd0fc('0x29')];if(_0x739792[_0xd0fc('0x2c')][_0xd0fc('0x32')]){_0x758d5d[_0xd0fc('0x33')]=[{'all':!![]}];}_0x758d5d=_[_0xd0fc('0x34')]({},_0x758d5d,_0x739792[_0xd0fc('0x35')]);return db[_0xd0fc('0x36')][_0xd0fc('0x37')](_0x758d5d)['then'](handleEntityNotFound(_0x2fcd27,null))[_0xd0fc('0x20')](respondWithResult(_0x2fcd27,null))['catch'](handleError(_0x2fcd27,null));};exports['create']=function(_0x4fef30,_0x52dbdf){return db[_0xd0fc('0x36')][_0xd0fc('0x38')](_0x4fef30[_0xd0fc('0x39')],{})[_0xd0fc('0x20')](respondWithResult(_0x52dbdf,0xc9))[_0xd0fc('0x3a')](handleError(_0x52dbdf,null));};exports[_0xd0fc('0x1f')]=function(_0x1ab05e,_0x3eb0e0){if(_0x1ab05e[_0xd0fc('0x39')]['id']){delete _0x1ab05e['body']['id'];}return db[_0xd0fc('0x36')]['find']({'where':{'id':_0x1ab05e['params']['id']}})[_0xd0fc('0x20')](handleEntityNotFound(_0x3eb0e0,null))[_0xd0fc('0x20')](saveUpdates(_0x1ab05e['body'],null))[_0xd0fc('0x20')](respondWithResult(_0x3eb0e0,null))[_0xd0fc('0x3a')](handleError(_0x3eb0e0,null));};exports[_0xd0fc('0x21')]=function(_0x143bd3,_0x2d3834){return db[_0xd0fc('0x36')][_0xd0fc('0x37')]({'where':{'id':_0x143bd3[_0xd0fc('0x28')]['id']}})[_0xd0fc('0x20')](handleEntityNotFound(_0x2d3834,null))[_0xd0fc('0x20')](removeEntity(_0x2d3834,null))[_0xd0fc('0x3a')](handleError(_0x2d3834,null));}; \ No newline at end of file +var _0x7c1f=['json','undefined','count','offset','limit','Content-Range','apply','reject','update','destroy','then','status','error','stack','name','show','params','model','keys','rawAttributes','query','filters','fields','attributes','length','includeAll','options','ChatProactiveAction','find','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0x3f0700,_0x24d419){var _0x4bbe46=function(_0x105bd3){while(--_0x105bd3){_0x3f0700['push'](_0x3f0700['shift']());}};_0x4bbe46(++_0x24d419);}(_0x7c1f,0x194));var _0xf7c1=function(_0x2d660d,_0x2f4afd){_0x2d660d=_0x2d660d-0x0;var _0x839fd5=_0x7c1f[_0x2d660d];return _0x839fd5;};'use strict';var emlformat=require(_0xf7c1('0x0'));var rimraf=require(_0xf7c1('0x1'));var zipdir=require(_0xf7c1('0x2'));var jsonpatch=require(_0xf7c1('0x3'));var rp=require(_0xf7c1('0x4'));var moment=require('moment');var BPromise=require(_0xf7c1('0x5'));var Mustache=require(_0xf7c1('0x6'));var util=require(_0xf7c1('0x7'));var path=require('path');var sox=require(_0xf7c1('0x8'));var csv=require(_0xf7c1('0x9'));var ejs=require(_0xf7c1('0xa'));var fs=require('fs');var fs_extra=require(_0xf7c1('0xb'));var _=require('lodash');var squel=require(_0xf7c1('0xc'));var crypto=require(_0xf7c1('0xd'));var jsforce=require(_0xf7c1('0xe'));var deskjs=require(_0xf7c1('0xf'));var toCsv=require(_0xf7c1('0x9'));var querystring=require(_0xf7c1('0x10'));var Papa=require(_0xf7c1('0x11'));var Redis=require(_0xf7c1('0x12'));var authService=require(_0xf7c1('0x13'));var qs=require(_0xf7c1('0x14'));var as=require(_0xf7c1('0x15'));var hardwareService=require(_0xf7c1('0x16'));var logger=require('../../config/logger')(_0xf7c1('0x17'));var utils=require(_0xf7c1('0x18'));var config=require(_0xf7c1('0x19'));var licenseUtil=require(_0xf7c1('0x1a'));var db=require(_0xf7c1('0x1b'))['db'];function respondWithStatusCode(_0x377ca4,_0x4ffd9a){_0x4ffd9a=_0x4ffd9a||0xcc;return function(_0x5f579c){if(_0x5f579c){return _0x377ca4[_0xf7c1('0x1c')](_0x4ffd9a);}return _0x377ca4['status'](_0x4ffd9a)[_0xf7c1('0x1d')]();};}function respondWithResult(_0x212791,_0x5b553f){_0x5b553f=_0x5b553f||0xc8;return function(_0x396f8b){if(_0x396f8b){return _0x212791['status'](_0x5b553f)[_0xf7c1('0x1e')](_0x396f8b);}};}function respondWithFilteredResult(_0x3fc40e,_0x315424){return function(_0x12ccde){if(_0x12ccde){var _0xb567e7=typeof _0x315424['offset']===_0xf7c1('0x1f')&&typeof _0x315424['limit']===_0xf7c1('0x1f');var _0x4f0a0a=_0x12ccde[_0xf7c1('0x20')];var _0x20e3f8=_0xb567e7?0x0:_0x315424[_0xf7c1('0x21')];var _0x15dd26=_0xb567e7?_0x12ccde[_0xf7c1('0x20')]:_0x315424[_0xf7c1('0x21')]+_0x315424[_0xf7c1('0x22')];var _0x43eee9;if(_0x15dd26>=_0x4f0a0a){_0x15dd26=_0x4f0a0a;_0x43eee9=0xc8;}else{_0x43eee9=0xce;}_0x3fc40e['status'](_0x43eee9);return _0x3fc40e['set'](_0xf7c1('0x23'),_0x20e3f8+'-'+_0x15dd26+'/'+_0x4f0a0a)[_0xf7c1('0x1e')](_0x12ccde);}return null;};}function patchUpdates(_0x4ee91e){return function(_0x16d8a1){try{jsonpatch[_0xf7c1('0x24')](_0x16d8a1,_0x4ee91e,!![]);}catch(_0x51aba8){return BPromise[_0xf7c1('0x25')](_0x51aba8);}return _0x16d8a1['save']();};}function saveUpdates(_0x4b202d,_0x59e25f){return function(_0x4333f0){if(_0x4333f0){return _0x4333f0[_0xf7c1('0x26')](_0x4b202d)['then'](function(_0x2932e2){return _0x2932e2;});}return null;};}function removeEntity(_0x18e2b4,_0x4eff1a){return function(_0x33c874){if(_0x33c874){return _0x33c874[_0xf7c1('0x27')]()[_0xf7c1('0x28')](function(){_0x18e2b4[_0xf7c1('0x29')](0xcc)[_0xf7c1('0x1d')]();});}};}function handleEntityNotFound(_0x54f3f3,_0x502f57){return function(_0x5bd8ba){if(!_0x5bd8ba){_0x54f3f3[_0xf7c1('0x1c')](0x194);}return _0x5bd8ba;};}function handleError(_0x2802bf,_0x14ecef){_0x14ecef=_0x14ecef||0x1f4;return function(_0x374efc){logger[_0xf7c1('0x2a')](_0x374efc[_0xf7c1('0x2b')]);if(_0x374efc[_0xf7c1('0x2c')]){delete _0x374efc[_0xf7c1('0x2c')];}_0x2802bf[_0xf7c1('0x29')](_0x14ecef)['send'](_0x374efc);};}exports[_0xf7c1('0x2d')]=function(_0x37c472,_0x4f68c6){var _0x43c7b4={'raw':!![],'where':{'id':_0x37c472[_0xf7c1('0x2e')]['id']}},_0x1f486d={};_0x1f486d[_0xf7c1('0x2f')]=_[_0xf7c1('0x30')](db['ChatProactiveAction'][_0xf7c1('0x31')]);_0x1f486d['query']=_[_0xf7c1('0x30')](_0x37c472[_0xf7c1('0x32')]);_0x1f486d[_0xf7c1('0x33')]=_['intersection'](_0x1f486d[_0xf7c1('0x2f')],_0x1f486d[_0xf7c1('0x32')]);_0x43c7b4['attributes']=_['intersection'](_0x1f486d[_0xf7c1('0x2f')],qs[_0xf7c1('0x34')](_0x37c472[_0xf7c1('0x32')][_0xf7c1('0x34')]));_0x43c7b4[_0xf7c1('0x35')]=_0x43c7b4['attributes'][_0xf7c1('0x36')]?_0x43c7b4[_0xf7c1('0x35')]:_0x1f486d[_0xf7c1('0x2f')];if(_0x37c472[_0xf7c1('0x32')][_0xf7c1('0x37')]){_0x43c7b4['include']=[{'all':!![]}];}_0x43c7b4=_['merge']({},_0x43c7b4,_0x37c472[_0xf7c1('0x38')]);return db[_0xf7c1('0x39')][_0xf7c1('0x3a')](_0x43c7b4)[_0xf7c1('0x28')](handleEntityNotFound(_0x4f68c6,null))[_0xf7c1('0x28')](respondWithResult(_0x4f68c6,null))['catch'](handleError(_0x4f68c6,null));};exports['create']=function(_0x17a667,_0x122e85){return db[_0xf7c1('0x39')][_0xf7c1('0x3b')](_0x17a667['body'],{})[_0xf7c1('0x28')](respondWithResult(_0x122e85,0xc9))['catch'](handleError(_0x122e85,null));};exports[_0xf7c1('0x26')]=function(_0x368e33,_0x1f2141){if(_0x368e33[_0xf7c1('0x3c')]['id']){delete _0x368e33[_0xf7c1('0x3c')]['id'];}return db[_0xf7c1('0x39')][_0xf7c1('0x3a')]({'where':{'id':_0x368e33['params']['id']}})['then'](handleEntityNotFound(_0x1f2141,null))[_0xf7c1('0x28')](saveUpdates(_0x368e33['body'],null))[_0xf7c1('0x28')](respondWithResult(_0x1f2141,null))[_0xf7c1('0x3d')](handleError(_0x1f2141,null));};exports['destroy']=function(_0x22a832,_0x53a2c5){return db['ChatProactiveAction'][_0xf7c1('0x3a')]({'where':{'id':_0x22a832[_0xf7c1('0x2e')]['id']}})[_0xf7c1('0x28')](handleEntityNotFound(_0x53a2c5,null))[_0xf7c1('0x28')](removeEntity(_0x53a2c5,null))['catch'](handleError(_0x53a2c5,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 0b333c9..505fd8e 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 _0x8a8c=['define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x21e1e5,_0x5e4810){var _0x1d0582=function(_0x5a6769){while(--_0x5a6769){_0x21e1e5['push'](_0x21e1e5['shift']());}};_0x1d0582(++_0x5e4810);}(_0x8a8c,0xed));var _0xc8a8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a8c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc8a8('0x0'));var util=require(_0xc8a8('0x1'));var logger=require(_0xc8a8('0x2'))(_0xc8a8('0x3'));var moment=require(_0xc8a8('0x4'));var BPromise=require(_0xc8a8('0x5'));var rp=require(_0xc8a8('0x6'));var fs=require('fs');var path=require(_0xc8a8('0x7'));var rimraf=require(_0xc8a8('0x8'));var config=require('../../config/environment');var attributes=require('./chatProactiveAction.attributes');module[_0xc8a8('0x9')]=function(_0x3d9d32,_0x58805b){return _0x3d9d32[_0xc8a8('0xa')](_0xc8a8('0xb'),attributes,{'tableName':_0xc8a8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa4a2=['moment','bluebird','path','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','util','../../config/logger','api'];(function(_0x366427,_0x22ed58){var _0x3bc24f=function(_0x43e920){while(--_0x43e920){_0x366427['push'](_0x366427['shift']());}};_0x3bc24f(++_0x22ed58);}(_0xa4a2,0x1c5));var _0x2a4a=function(_0x8bc720,_0x177d9d){_0x8bc720=_0x8bc720-0x0;var _0xddfa32=_0xa4a2[_0x8bc720];return _0xddfa32;};'use strict';var _=require('lodash');var util=require(_0x2a4a('0x0'));var logger=require(_0x2a4a('0x1'))(_0x2a4a('0x2'));var moment=require(_0x2a4a('0x3'));var BPromise=require(_0x2a4a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2a4a('0x5'));var rimraf=require('rimraf');var config=require(_0x2a4a('0x6'));var attributes=require(_0x2a4a('0x7'));module[_0x2a4a('0x8')]=function(_0xba89c4,_0x521ce2){return _0xba89c4[_0x2a4a('0x9')](_0x2a4a('0xa'),attributes,{'tableName':_0x2a4a('0xb'),'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 81467ed..3ad7f5c 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 _0x6ece=['info','ChatProactiveAction,\x20%s,\x20%s','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','randomstring','ioredis','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x5d4818,_0x3ccae2){var _0x578a9c=function(_0x530284){while(--_0x530284){_0x5d4818['push'](_0x5d4818['shift']());}};_0x578a9c(++_0x3ccae2);}(_0x6ece,0x8f));var _0xe6ec=function(_0x5810b0,_0x4c4ba2){_0x5810b0=_0x5810b0-0x0;var _0x50ee55=_0x6ece[_0x5810b0];return _0x50ee55;};'use strict';var _=require(_0xe6ec('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe6ec('0x1'));var fs=require('fs');var Redis=require(_0xe6ec('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xe6ec('0x3'));var jayson=require(_0xe6ec('0x4'));var client=jayson[_0xe6ec('0x5')][_0xe6ec('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x53fdc9,_0x3e61c0,_0x35fa77){return new BPromise(function(_0x5a69d4,_0x51b6af){return client[_0xe6ec('0x7')](_0x53fdc9,_0x35fa77)[_0xe6ec('0x8')](function(_0x2bfd7b){logger[_0xe6ec('0x9')](_0xe6ec('0xa'),_0x3e61c0,'request\x20sent');logger['debug'](_0xe6ec('0xb'),_0x3e61c0,'request\x20sent',JSON[_0xe6ec('0xc')](_0x2bfd7b));if(_0x2bfd7b[_0xe6ec('0xd')]){if(_0x2bfd7b[_0xe6ec('0xd')][_0xe6ec('0xe')]===0x1f4){logger['error'](_0xe6ec('0xa'),_0x3e61c0,_0x2bfd7b[_0xe6ec('0xd')]['message']);return _0x51b6af(_0x2bfd7b[_0xe6ec('0xd')][_0xe6ec('0xf')]);}logger[_0xe6ec('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x3e61c0,_0x2bfd7b['error'][_0xe6ec('0xf')]);return _0x5a69d4(_0x2bfd7b['error'][_0xe6ec('0xf')]);}else{logger['info'](_0xe6ec('0xa'),_0x3e61c0,_0xe6ec('0x10'));_0x5a69d4(_0x2bfd7b[_0xe6ec('0x11')][_0xe6ec('0xf')]);}})[_0xe6ec('0x12')](function(_0x154892){logger[_0xe6ec('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x3e61c0,_0x154892);_0x51b6af(_0x154892);});});} \ No newline at end of file +var _0xa3e2=['lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x55ef8b,_0x5deb5e){var _0x359c84=function(_0x437673){while(--_0x437673){_0x55ef8b['push'](_0x55ef8b['shift']());}};_0x359c84(++_0x5deb5e);}(_0xa3e2,0x1cc));var _0x2a3e=function(_0x49d280,_0x33d68f){_0x49d280=_0x49d280-0x0;var _0x25274a=_0xa3e2[_0x49d280];return _0x25274a;};'use strict';var _=require(_0x2a3e('0x0'));var util=require('util');var moment=require(_0x2a3e('0x1'));var BPromise=require(_0x2a3e('0x2'));var rs=require(_0x2a3e('0x3'));var fs=require('fs');var Redis=require(_0x2a3e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2a3e('0x5'));var logger=require(_0x2a3e('0x6'))(_0x2a3e('0x7'));var config=require(_0x2a3e('0x8'));var jayson=require(_0x2a3e('0x9'));var client=jayson[_0x2a3e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59c1e4,_0x462c9b,_0x4e9647){return new BPromise(function(_0x2bda91,_0x27a3f9){return client[_0x2a3e('0xb')](_0x59c1e4,_0x4e9647)['then'](function(_0x5e076a){logger[_0x2a3e('0xc')](_0x2a3e('0xd'),_0x462c9b,_0x2a3e('0xe'));logger[_0x2a3e('0xf')](_0x2a3e('0x10'),_0x462c9b,'request\x20sent',JSON[_0x2a3e('0x11')](_0x5e076a));if(_0x5e076a[_0x2a3e('0x12')]){if(_0x5e076a[_0x2a3e('0x12')][_0x2a3e('0x13')]===0x1f4){logger[_0x2a3e('0x12')](_0x2a3e('0xd'),_0x462c9b,_0x5e076a[_0x2a3e('0x12')]['message']);return _0x27a3f9(_0x5e076a[_0x2a3e('0x12')][_0x2a3e('0x14')]);}logger[_0x2a3e('0x12')](_0x2a3e('0xd'),_0x462c9b,_0x5e076a[_0x2a3e('0x12')]['message']);return _0x2bda91(_0x5e076a['error'][_0x2a3e('0x14')]);}else{logger[_0x2a3e('0xc')](_0x2a3e('0xd'),_0x462c9b,_0x2a3e('0xe'));_0x2bda91(_0x5e076a[_0x2a3e('0x15')][_0x2a3e('0x14')]);}})[_0x2a3e('0x16')](function(_0x33a1fe){logger[_0x2a3e('0x12')](_0x2a3e('0xd'),_0x462c9b,_0x33a1fe);_0x27a3f9(_0x33a1fe);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 2b7b47d..03e681d 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 _0xeda8=['get','/:id','isAuthenticated','show','create','put','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller'];(function(_0x50d77f,_0x1a76da){var _0x477ae3=function(_0x358ee2){while(--_0x358ee2){_0x50d77f['push'](_0x50d77f['shift']());}};_0x477ae3(++_0x1a76da);}(_0xeda8,0x104));var _0x8eda=function(_0x267c8e,_0x3f31b8){_0x267c8e=_0x267c8e-0x0;var _0x446e27=_0xeda8[_0x267c8e];return _0x446e27;};'use strict';var multer=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var path=require('path');var timeout=require(_0x8eda('0x2'));var express=require(_0x8eda('0x3'));var router=express[_0x8eda('0x4')]();var fs_extra=require(_0x8eda('0x5'));var auth=require(_0x8eda('0x6'));var interaction=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var controller=require(_0x8eda('0x9'));router[_0x8eda('0xa')](_0x8eda('0xb'),auth[_0x8eda('0xc')](),controller[_0x8eda('0xd')]);router['post']('/',auth[_0x8eda('0xc')](),controller[_0x8eda('0xe')]);router[_0x8eda('0xf')](_0x8eda('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x8eda('0xc')](),controller[_0x8eda('0x10')]);module[_0x8eda('0x11')]=router; \ No newline at end of file +var _0x425d=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x425d,0x1e0));var _0xd425=function(_0x126121,_0x35e290){_0x126121=_0x126121-0x0;var _0x57d413=_0x425d[_0x126121];return _0x57d413;};'use strict';var multer=require(_0xd425('0x0'));var util=require('util');var path=require(_0xd425('0x1'));var timeout=require(_0xd425('0x2'));var express=require(_0xd425('0x3'));var router=express[_0xd425('0x4')]();var fs_extra=require(_0xd425('0x5'));var auth=require(_0xd425('0x6'));var interaction=require(_0xd425('0x7'));var config=require('../../config/environment');var controller=require(_0xd425('0x8'));router[_0xd425('0x9')](_0xd425('0xa'),auth[_0xd425('0xb')](),controller[_0xd425('0xc')]);router[_0xd425('0xd')]('/',auth['isAuthenticated'](),controller[_0xd425('0xe')]);router[_0xd425('0xf')](_0xd425('0xa'),auth[_0xd425('0xb')](),controller[_0xd425('0x10')]);router[_0xd425('0x11')](_0xd425('0xa'),auth[_0xd425('0xb')](),controller[_0xd425('0x12')]);module[_0xd425('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 7fd50f2..cdc2e9b 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 _0xde54=['STRING','name','INTEGER','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0xde54,0x12e));var _0x4de5=function(_0x3b52eb,_0x4e6484){_0x3b52eb=_0x3b52eb-0x0;var _0x21ca76=_0xde54[_0x3b52eb];return _0x21ca76;};'use strict';var Sequelize=require(_0x4de5('0x0'));module[_0x4de5('0x1')]={'name':{'type':Sequelize[_0x4de5('0x2')],'unique':_0x4de5('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4de5('0x2')]},'timeout':{'type':Sequelize[_0x4de5('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x4de5('0x5'),_0x4de5('0x6'),_0x4de5('0x7'))}}; \ No newline at end of file +var _0x527c=['roundrobin','exports','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x5ca17e,_0x594018){var _0x42e43b=function(_0x58e4eb){while(--_0x58e4eb){_0x5ca17e['push'](_0x5ca17e['shift']());}};_0x42e43b(++_0x594018);}(_0x527c,0xd3));var _0xc527=function(_0x491d35,_0x43f6e5){_0x491d35=_0x491d35-0x0;var _0x5a2de7=_0x527c[_0x491d35];return _0x5a2de7;};'use strict';var Sequelize=require('sequelize');module[_0xc527('0x0')]={'name':{'type':Sequelize[_0xc527('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc527('0x1')]},'timeout':{'type':Sequelize[_0xc527('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc527('0x3')](_0xc527('0x4'),_0xc527('0x5'),_0xc527('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 253efcd..3b28676 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 _0x2782=['set','Content-Range','json','apply','reject','save','update','destroy','ChatQueues','UserProfileResource','name','index','map','ChatQueue','rawAttributes','fieldName','type','key','model','query','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','keys','intersection','length','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','rows','format','%s/%s','SIP','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','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','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','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/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','jayson/promise','http','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','offset','undefined','count'];(function(_0x489ac6,_0xb2a891){var _0x211821=function(_0x594caa){while(--_0x594caa){_0x489ac6['push'](_0x489ac6['shift']());}};_0x211821(++_0xb2a891);}(_0x2782,0x101));var _0x2278=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0x2782[_0x20589d];return _0x422de9;};'use strict';var emlformat=require(_0x2278('0x0'));var rimraf=require(_0x2278('0x1'));var zipdir=require(_0x2278('0x2'));var jsonpatch=require(_0x2278('0x3'));var rp=require(_0x2278('0x4'));var moment=require('moment');var BPromise=require(_0x2278('0x5'));var Mustache=require(_0x2278('0x6'));var util=require(_0x2278('0x7'));var path=require(_0x2278('0x8'));var sox=require(_0x2278('0x9'));var csv=require(_0x2278('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2278('0xb'));var _=require(_0x2278('0xc'));var squel=require(_0x2278('0xd'));var crypto=require(_0x2278('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2278('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2278('0x10'));var Papa=require('papaparse');var Redis=require(_0x2278('0x11'));var authService=require(_0x2278('0x12'));var qs=require(_0x2278('0x13'));var as=require(_0x2278('0x14'));var hardwareService=require(_0x2278('0x15'));var logger=require(_0x2278('0x16'))(_0x2278('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2278('0x18'));var db=require(_0x2278('0x19'))['db'];config['redis']=_[_0x2278('0x1a')](config[_0x2278('0x1b')],{'host':_0x2278('0x1c'),'port':0x18eb});var socket=require(_0x2278('0x1d'))(new Redis(config[_0x2278('0x1b')]));require('./chatQueue.socket')['register'](socket);var jayson=require(_0x2278('0x1e'));var client=jayson['client'][_0x2278('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x30e05f,_0x3fa0c7,_0x54f9e6,_0x128459){return new BPromise(function(_0x7e050d,_0x1b2e19){var _0x153be8=_0x128459||client;return _0x153be8['request'](_0x30e05f,_0x54f9e6)[_0x2278('0x20')](function(_0x4c7540){logger[_0x2278('0x21')](_0x2278('0x22'),_0x3fa0c7,_0x2278('0x23'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x3fa0c7,_0x2278('0x23'),JSON['stringify'](_0x4c7540));if(_0x4c7540[_0x2278('0x24')]){if(_0x4c7540[_0x2278('0x24')][_0x2278('0x25')]===0x1f4){logger[_0x2278('0x24')]('ChatQueue,\x20%s,\x20%s',_0x3fa0c7,_0x4c7540[_0x2278('0x24')][_0x2278('0x26')]);return _0x1b2e19(_0x4c7540[_0x2278('0x24')][_0x2278('0x26')]);}logger[_0x2278('0x24')](_0x2278('0x22'),_0x3fa0c7,_0x4c7540[_0x2278('0x24')]['message']);return _0x7e050d(_0x4c7540[_0x2278('0x24')][_0x2278('0x26')]);}else{logger[_0x2278('0x21')](_0x2278('0x22'),_0x3fa0c7,_0x2278('0x23'));_0x7e050d(_0x4c7540[_0x2278('0x27')][_0x2278('0x26')]);}})[_0x2278('0x28')](function(_0x47a7bc){logger[_0x2278('0x24')](_0x2278('0x22'),_0x3fa0c7,_0x47a7bc);_0x1b2e19(_0x47a7bc);});});}function respondWithStatusCode(_0xd20a5d,_0x40e7a2){_0x40e7a2=_0x40e7a2||0xcc;return function(_0xb52ae9){if(_0xb52ae9){return _0xd20a5d[_0x2278('0x29')](_0x40e7a2);}return _0xd20a5d[_0x2278('0x2a')](_0x40e7a2)[_0x2278('0x2b')]();};}function respondWithResult(_0x33f22b,_0x59106d){_0x59106d=_0x59106d||0xc8;return function(_0x319d8a){if(_0x319d8a){return _0x33f22b[_0x2278('0x2a')](_0x59106d)['json'](_0x319d8a);}};}function respondWithFilteredResult(_0xbf132f,_0xd2be08){return function(_0x4b0405){if(_0x4b0405){var _0x299416=typeof _0xd2be08[_0x2278('0x2c')]===_0x2278('0x2d')&&typeof _0xd2be08['limit']===_0x2278('0x2d');var _0x5ebdbc=_0x4b0405[_0x2278('0x2e')];var _0xffbcab=_0x299416?0x0:_0xd2be08[_0x2278('0x2c')];var _0x46c0c3=_0x299416?_0x4b0405[_0x2278('0x2e')]:_0xd2be08[_0x2278('0x2c')]+_0xd2be08['limit'];var _0x47d276;if(_0x46c0c3>=_0x5ebdbc){_0x46c0c3=_0x5ebdbc;_0x47d276=0xc8;}else{_0x47d276=0xce;}_0xbf132f[_0x2278('0x2a')](_0x47d276);return _0xbf132f[_0x2278('0x2f')](_0x2278('0x30'),_0xffbcab+'-'+_0x46c0c3+'/'+_0x5ebdbc)[_0x2278('0x31')](_0x4b0405);}return null;};}function patchUpdates(_0x1da93d){return function(_0x53acf3){try{jsonpatch[_0x2278('0x32')](_0x53acf3,_0x1da93d,!![]);}catch(_0x2d7b82){return BPromise[_0x2278('0x33')](_0x2d7b82);}return _0x53acf3[_0x2278('0x34')]();};}function saveUpdates(_0x2c0458,_0x1058fc){return function(_0x526286){if(_0x526286){return _0x526286[_0x2278('0x35')](_0x2c0458)[_0x2278('0x20')](function(_0x3f5fd5){return _0x3f5fd5;});}return null;};}function removeEntity(_0x40decf,_0x425007){return function(_0x28658b){if(_0x28658b){return _0x28658b[_0x2278('0x36')]()[_0x2278('0x20')](function(){var _0x1cfd7b=_0x28658b['get']({'plain':!![]});var _0x37eaa9=_0x2278('0x37');return db[_0x2278('0x38')][_0x2278('0x36')]({'where':{'type':_0x37eaa9,'resourceId':_0x1cfd7b['id']}})[_0x2278('0x20')](function(){return _0x28658b;});})[_0x2278('0x20')](function(){_0x40decf['status'](0xcc)[_0x2278('0x2b')]();});}};}function handleEntityNotFound(_0x1ee7da,_0x1dd74d){return function(_0x3f4cd4){if(!_0x3f4cd4){_0x1ee7da['sendStatus'](0x194);}return _0x3f4cd4;};}function handleError(_0x2b82d3,_0x21d55e){_0x21d55e=_0x21d55e||0x1f4;return function(_0x4a6559){logger[_0x2278('0x24')](_0x4a6559['stack']);if(_0x4a6559['name']){delete _0x4a6559[_0x2278('0x39')];}_0x2b82d3['status'](_0x21d55e)['send'](_0x4a6559);};}exports[_0x2278('0x3a')]=function(_0x35cfb1,_0x56141e){var _0x2c30bc={},_0xd71b44={},_0x5a646a={'count':0x0,'rows':[]};var _0x17fbcf=_[_0x2278('0x3b')](db[_0x2278('0x3c')][_0x2278('0x3d')],function(_0x2df5c6){return{'name':_0x2df5c6[_0x2278('0x3e')],'type':_0x2df5c6[_0x2278('0x3f')][_0x2278('0x40')]};});_0xd71b44[_0x2278('0x41')]=_[_0x2278('0x3b')](_0x17fbcf,_0x2278('0x39'));_0xd71b44[_0x2278('0x42')]=_['keys'](_0x35cfb1['query']);_0xd71b44['filters']=_['intersection'](_0xd71b44[_0x2278('0x41')],_0xd71b44[_0x2278('0x42')]);_0x2c30bc[_0x2278('0x43')]=_['intersection'](_0xd71b44[_0x2278('0x41')],qs[_0x2278('0x44')](_0x35cfb1[_0x2278('0x42')][_0x2278('0x44')]));_0x2c30bc[_0x2278('0x43')]=_0x2c30bc[_0x2278('0x43')]['length']?_0x2c30bc['attributes']:_0xd71b44[_0x2278('0x41')];if(!_0x35cfb1['query'][_0x2278('0x45')](_0x2278('0x46'))){_0x2c30bc['limit']=qs['limit'](_0x35cfb1[_0x2278('0x42')][_0x2278('0x47')]);_0x2c30bc[_0x2278('0x2c')]=qs[_0x2278('0x2c')](_0x35cfb1[_0x2278('0x42')][_0x2278('0x2c')]);}_0x2c30bc[_0x2278('0x48')]=qs[_0x2278('0x49')](_0x35cfb1[_0x2278('0x42')]['sort']);_0x2c30bc[_0x2278('0x4a')]=qs[_0x2278('0x4b')](_[_0x2278('0x4c')](_0x35cfb1[_0x2278('0x42')],_0xd71b44[_0x2278('0x4b')]),_0x17fbcf);if(_0x35cfb1[_0x2278('0x42')][_0x2278('0x4d')]){_0x2c30bc['where']=_[_0x2278('0x4e')](_0x2c30bc[_0x2278('0x4a')],{'$or':_[_0x2278('0x3b')](_0x17fbcf,function(_0x3e52d9){if(_0x3e52d9['type']!==_0x2278('0x4f')){var _0x55580d={};_0x55580d[_0x3e52d9['name']]={'$like':'%'+_0x35cfb1[_0x2278('0x42')]['filter']+'%'};return _0x55580d;}})});}_0x2c30bc=_['merge']({},_0x2c30bc,_0x35cfb1[_0x2278('0x50')]);var _0x258df1={'where':_0x2c30bc[_0x2278('0x4a')]};return db[_0x2278('0x3c')]['count'](_0x258df1)['then'](function(_0x4c3c23){_0x5a646a['count']=_0x4c3c23;if(_0x35cfb1['query'][_0x2278('0x51')]){_0x2c30bc[_0x2278('0x52')]=[{'all':!![]}];}return db[_0x2278('0x3c')][_0x2278('0x53')](_0x2c30bc);})['then'](function(_0xf2600d){_0x5a646a['rows']=_0xf2600d;return _0x5a646a;})[_0x2278('0x20')](respondWithFilteredResult(_0x56141e,_0x2c30bc))['catch'](handleError(_0x56141e,null));};exports[_0x2278('0x54')]=function(_0x2ebcca,_0xded3b){var _0x32caea={'raw':!![],'where':{'id':_0x2ebcca['params']['id']}},_0x3ec770={};_0x3ec770[_0x2278('0x41')]=_[_0x2278('0x55')](db[_0x2278('0x3c')][_0x2278('0x3d')]);_0x3ec770[_0x2278('0x42')]=_[_0x2278('0x55')](_0x2ebcca[_0x2278('0x42')]);_0x3ec770[_0x2278('0x4b')]=_[_0x2278('0x56')](_0x3ec770[_0x2278('0x41')],_0x3ec770[_0x2278('0x42')]);_0x32caea[_0x2278('0x43')]=_[_0x2278('0x56')](_0x3ec770[_0x2278('0x41')],qs[_0x2278('0x44')](_0x2ebcca[_0x2278('0x42')][_0x2278('0x44')]));_0x32caea[_0x2278('0x43')]=_0x32caea[_0x2278('0x43')][_0x2278('0x57')]?_0x32caea[_0x2278('0x43')]:_0x3ec770[_0x2278('0x41')];if(_0x2ebcca[_0x2278('0x42')][_0x2278('0x51')]){_0x32caea[_0x2278('0x52')]=[{'all':!![]}];}_0x32caea=_[_0x2278('0x4e')]({},_0x32caea,_0x2ebcca[_0x2278('0x50')]);return db[_0x2278('0x3c')][_0x2278('0x58')](_0x32caea)['then'](handleEntityNotFound(_0xded3b,null))['then'](respondWithResult(_0xded3b,null))['catch'](handleError(_0xded3b,null));};exports['create']=function(_0x4239a3,_0x3ccbc6){return db[_0x2278('0x3c')]['create'](_0x4239a3[_0x2278('0x59')],{})['then'](function(_0x1a0447){var _0x2d3e73=_0x4239a3[_0x2278('0x5a')][_0x2278('0x5b')]({'plain':!![]});if(!_0x2d3e73)throw new Error(_0x2278('0x5c'));if(_0x2d3e73['role']===_0x2278('0x5a')){var _0x29f43f=_0x1a0447[_0x2278('0x5b')]({'plain':!![]});var _0x4fe779='ChatQueues';return db[_0x2278('0x5d')]['find']({'where':{'name':_0x4fe779,'userProfileId':_0x2d3e73['userProfileId']},'raw':!![]})[_0x2278('0x20')](function(_0x49a23a){if(_0x49a23a&&_0x49a23a[_0x2278('0x5e')]===0x0){return db[_0x2278('0x38')]['create']({'name':_0x29f43f['name'],'resourceId':_0x29f43f['id'],'type':_0x49a23a[_0x2278('0x39')],'sectionId':_0x49a23a['id']},{})[_0x2278('0x20')](function(){return _0x1a0447;});}else{return _0x1a0447;}})[_0x2278('0x28')](function(_0x5d1610){logger[_0x2278('0x24')](_0x2278('0x5f'),_0x5d1610);throw _0x5d1610;});}return _0x1a0447;})[_0x2278('0x20')](respondWithResult(_0x3ccbc6,0xc9))[_0x2278('0x28')](handleError(_0x3ccbc6,null));};exports['update']=function(_0x39758b,_0x272bdf){if(_0x39758b['body']['id']){delete _0x39758b['body']['id'];}return db[_0x2278('0x3c')][_0x2278('0x58')]({'where':{'id':_0x39758b[_0x2278('0x60')]['id']}})[_0x2278('0x20')](handleEntityNotFound(_0x272bdf,null))[_0x2278('0x20')](saveUpdates(_0x39758b[_0x2278('0x59')],null))['then'](respondWithResult(_0x272bdf,null))[_0x2278('0x28')](handleError(_0x272bdf,null));};exports[_0x2278('0x36')]=function(_0x40b38b,_0x15b720){return db[_0x2278('0x3c')][_0x2278('0x58')]({'where':{'id':_0x40b38b[_0x2278('0x60')]['id']}})[_0x2278('0x20')](handleEntityNotFound(_0x15b720,null))[_0x2278('0x20')](removeEntity(_0x15b720,null))[_0x2278('0x28')](handleError(_0x15b720,null));};exports[_0x2278('0x61')]=function(_0x1c8cea,_0x17c919){return db[_0x2278('0x3c')][_0x2278('0x61')]()[_0x2278('0x20')](respondWithResult(_0x17c919,null))[_0x2278('0x28')](handleError(_0x17c919,null));};exports['getMembers']=function(_0x54a9ab,_0x411d93,_0xf24cb4){var _0x2aa40e={'raw':!![],'where':{}},_0x181ad5={},_0x3798d1;return db[_0x2278('0x3c')][_0x2278('0x62')]({'where':{'id':_0x54a9ab[_0x2278('0x60')]['id']}})[_0x2278('0x20')](handleEntityNotFound(_0x411d93,null))['then'](function(_0x30e8a8){if(_0x30e8a8){_0x3798d1=_0x30e8a8['get']({'plain':!![]});_0x181ad5[_0x2278('0x41')]=_[_0x2278('0x55')](db['UserChatQueue'][_0x2278('0x3d')]);_0x181ad5[_0x2278('0x42')]=_[_0x2278('0x55')](_0x54a9ab[_0x2278('0x42')]);_0x181ad5[_0x2278('0x4b')]=_[_0x2278('0x56')](_0x181ad5[_0x2278('0x41')],_0x181ad5['query']);_0x2aa40e['attributes']=_[_0x2278('0x56')](_0x181ad5[_0x2278('0x41')],qs[_0x2278('0x44')](_0x54a9ab[_0x2278('0x42')]['fields']));_0x2aa40e[_0x2278('0x43')]=_0x2aa40e[_0x2278('0x43')]['length']?_0x2aa40e[_0x2278('0x43')]:_0x181ad5[_0x2278('0x41')];if(!_0x54a9ab[_0x2278('0x42')]['hasOwnProperty'](_0x2278('0x46'))){_0x2aa40e['limit']=qs[_0x2278('0x47')](_0x54a9ab[_0x2278('0x42')][_0x2278('0x47')]);_0x2aa40e[_0x2278('0x2c')]=qs[_0x2278('0x2c')](_0x54a9ab[_0x2278('0x42')][_0x2278('0x2c')]);}_0x2aa40e['order']=qs[_0x2278('0x49')](_0x54a9ab[_0x2278('0x42')][_0x2278('0x49')]);_0x2aa40e[_0x2278('0x4a')]=qs[_0x2278('0x4b')](_[_0x2278('0x4c')](_0x54a9ab[_0x2278('0x42')],_0x181ad5[_0x2278('0x4b')]));_0x2aa40e[_0x2278('0x4a')]['ChatQueueId']=_0x30e8a8['id'];if(_0x54a9ab[_0x2278('0x42')][_0x2278('0x4d')]){_0x2aa40e[_0x2278('0x4a')]=_[_0x2278('0x4e')](_0x2aa40e[_0x2278('0x4a')],{'$or':_[_0x2278('0x3b')](_0x2aa40e[_0x2278('0x43')],function(_0x42d5d6){var _0x57fb96={};_0x57fb96[_0x42d5d6]={'$like':'%'+_0x54a9ab[_0x2278('0x42')][_0x2278('0x4d')]+'%'};return _0x57fb96;})});}_0x2aa40e=_[_0x2278('0x4e')]({},_0x2aa40e,_0x54a9ab[_0x2278('0x50')]);return db['UserChatQueue'][_0x2278('0x53')](_0x2aa40e);}})[_0x2278('0x20')](function(_0x447837){if(_0x447837){return db[_0x2278('0x63')][_0x2278('0x64')]({'where':{'id':_[_0x2278('0x3b')](_0x447837,_0x2278('0x65')),'role':_0x2278('0x66')},'attributes':['id',_0x2278('0x39'),_0x2278('0x67'),_0x2278('0x68'),_0x2278('0x69')]});}})['then'](function(_0x4af52c){if(_0x4af52c){return{'count':_0x4af52c[_0x2278('0x2e')],'rows':_[_0x2278('0x3b')](_0x4af52c[_0x2278('0x6a')],function(_0x21b4b5){return{'membername':_0x21b4b5[_0x2278('0x39')],'UserId':_0x21b4b5['id'],'queue_name':_0x3798d1[_0x2278('0x39')],'ChatQueueId':_0x3798d1['id'],'interface':util[_0x2278('0x6b')](_0x2278('0x6c'),_0x2278('0x6d'),_0x21b4b5[_0x2278('0x39')]),'penalty':0x0,'paused':_0x21b4b5['chatPause'],'createdAt':_0x21b4b5['createdAt'],'updatedAt':_0x21b4b5['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x2278('0x20')](respondWithFilteredResult(_0x411d93,_0x2aa40e))['catch'](handleError(_0x411d93,null));};exports['getTeams']=function(_0x4d3c52,_0x4cf8e8,_0x3fe289){var _0x4225f3={};var _0x180673={};var _0x29cf98;var _0x4422cf;return db[_0x2278('0x3c')][_0x2278('0x62')]({'where':{'id':_0x4d3c52[_0x2278('0x60')]['id']}})['then'](handleEntityNotFound(_0x4cf8e8,null))['then'](function(_0x354d35){if(_0x354d35){_0x29cf98=_0x354d35;_0x180673[_0x2278('0x41')]=_[_0x2278('0x55')](db[_0x2278('0x6e')][_0x2278('0x3d')]);_0x180673['query']=_[_0x2278('0x55')](_0x4d3c52['query']);_0x180673[_0x2278('0x4b')]=_[_0x2278('0x56')](_0x180673['model'],_0x180673[_0x2278('0x42')]);_0x4225f3[_0x2278('0x43')]=_[_0x2278('0x56')](_0x180673[_0x2278('0x41')],qs[_0x2278('0x44')](_0x4d3c52[_0x2278('0x42')][_0x2278('0x44')]));_0x4225f3[_0x2278('0x43')]=_0x4225f3[_0x2278('0x43')][_0x2278('0x57')]?_0x4225f3['attributes']:_0x180673[_0x2278('0x41')];_0x4225f3[_0x2278('0x48')]=qs[_0x2278('0x49')](_0x4d3c52['query'][_0x2278('0x49')]);_0x4225f3[_0x2278('0x4a')]=qs['filters'](_[_0x2278('0x4c')](_0x4d3c52[_0x2278('0x42')],_0x180673[_0x2278('0x4b')]));if(_0x4d3c52['query'][_0x2278('0x4d')]){_0x4225f3[_0x2278('0x4a')]=_[_0x2278('0x4e')](_0x4225f3[_0x2278('0x4a')],{'$or':_['map'](_0x4225f3[_0x2278('0x43')],function(_0x5ddc4f){var _0x54413b={};_0x54413b[_0x5ddc4f]={'$like':'%'+_0x4d3c52[_0x2278('0x42')][_0x2278('0x4d')]+'%'};return _0x54413b;})});}_0x4225f3=_[_0x2278('0x4e')]({},_0x4225f3,_0x4d3c52[_0x2278('0x50')]);return _0x29cf98['getTeams'](_0x4225f3);}})[_0x2278('0x20')](function(_0x294391){if(_0x294391){_0x4422cf=_0x294391[_0x2278('0x57')];if(!_0x4d3c52[_0x2278('0x42')]['hasOwnProperty'](_0x2278('0x46'))){_0x4225f3['limit']=qs[_0x2278('0x47')](_0x4d3c52[_0x2278('0x42')]['limit']);_0x4225f3[_0x2278('0x2c')]=qs[_0x2278('0x2c')](_0x4d3c52[_0x2278('0x42')][_0x2278('0x2c')]);}return _0x29cf98[_0x2278('0x6f')](_0x4225f3);}})[_0x2278('0x20')](function(_0x2c4b56){if(_0x2c4b56){return _0x2c4b56?{'count':_0x4422cf,'rows':_0x2c4b56}:null;}})[_0x2278('0x20')](respondWithResult(_0x4cf8e8,null))[_0x2278('0x28')](handleError(_0x4cf8e8,null));};exports[_0x2278('0x70')]=function(_0x3f62d0,_0x31702c,_0x36beff){var _0x23e857=_0x3f62d0[_0x2278('0x59')][_0x2278('0x71')];return db[_0x2278('0x6e')][_0x2278('0x53')]({'where':{'id':_0x23e857},'attributes':['id'],'include':[{'model':db[_0x2278('0x63')],'as':_0x2278('0x72'),'attributes':['id',_0x2278('0x39'),_0x2278('0x73'),_0x2278('0x74'),_0x2278('0x75')],'raw':!![]}]})['then'](function(_0x2b15ee){if(_0x2b15ee){var _0x229174=_[_0x2278('0x76')](_0x2b15ee,function(_0x6d95b8){var _0x3d1404=_0x6d95b8['get']({'plain':!![]});return _0x3d1404[_0x2278('0x72')];});return db[_0x2278('0x3c')]['find']({'where':{'id':_0x3f62d0[_0x2278('0x60')]['id']}})['then'](function(_0x177c1d){return db[_0x2278('0x77')][_0x2278('0x78')](function(_0x221f58){return _0x177c1d[_0x2278('0x70')](_0x23e857,{'transaction':_0x221f58})[_0x2278('0x20')](function(){return BPromise[_0x2278('0x79')](_0x229174,function(_0x3bacdb){return db['UserChatQueue'][_0x2278('0x7a')]({'where':{'UserId':_0x3bacdb['id'],'ChatQueueId':_0x3f62d0['params']['id']},'transaction':_0x221f58});});})[_0x2278('0x20')](function(){_0x229174[_0x2278('0x7b')](function(_0x539fcb){socket[_0x2278('0x7c')]('userChatQueue:save',{'UserId':_0x539fcb['id'],'ChatQueueId':_0x177c1d['id']});});});});});}})[_0x2278('0x20')](respondWithStatusCode(_0x31702c,null))[_0x2278('0x28')](handleError(_0x31702c,null));};exports[_0x2278('0x7d')]=function(_0x4c70b9,_0x52556e,_0xe8c06a){return db[_0x2278('0x6e')][_0x2278('0x53')]({'where':{'id':_0x4c70b9[_0x2278('0x42')][_0x2278('0x71')]},'attributes':['id'],'include':[{'model':db[_0x2278('0x63')],'as':_0x2278('0x72'),'attributes':['id'],'raw':!![]}]})[_0x2278('0x20')](handleEntityNotFound(_0x52556e,null))[_0x2278('0x20')](function(_0x2afa35){var _0x3698f2=_[_0x2278('0x3b')](_0x2afa35,'id');var _0x1b187a=[];var _0x39d1f8=[];var _0x239073=squel['select']();_0x239073[_0x2278('0x7e')](_0x2278('0x7f'))[_0x2278('0x80')]('team_has_chat_queues','tq')[_0x2278('0x81')](_0x2278('0x82'),'ut',_0x2278('0x83'))[_0x2278('0x4a')](_0x2278('0x84'),_0x4c70b9[_0x2278('0x60')]['id']);for(var _0x1a2db2=0x0;_0x1a2db2<_0x2afa35[_0x2278('0x57')];_0x1a2db2+=0x1){let _0x39a74a=_0x2afa35[_0x1a2db2];for(var _0x1b7754=0x0;_0x1b7754<_0x39a74a[_0x2278('0x72')][_0x2278('0x57')];_0x1b7754+=0x1){let _0x4b92fe=_0x39a74a[_0x2278('0x72')][_0x1b7754];var _0x26c34e=_0x239073[_0x2278('0x85')]();_0x26c34e[_0x2278('0x4a')](_0x2278('0x86'),_0x4b92fe['id']);_0x39d1f8[_0x2278('0x87')](db[_0x2278('0x77')][_0x2278('0x42')](_0x26c34e[_0x2278('0x88')](),{'type':db[_0x2278('0x77')][_0x2278('0x89')][_0x2278('0x8a')]})['then'](function(_0x504932){if(_0x504932['length']===0x1){return _0x4b92fe['id'];}else{var _0x429f82=_['every'](_[_0x2278('0x3b')](_0x504932,_0x2278('0x8b')),function(_0x41bb6b){return _[_0x2278('0x8c')](_0x3698f2,_0x41bb6b);});if(_0x429f82){return _0x4b92fe['id'];}}}));}}return BPromise[_0x2278('0x8d')](_0x39d1f8)[_0x2278('0x20')](function(_0x296ed2){_0x1b187a=_(_0x1b187a)[_0x2278('0x8e')](_0x296ed2)[_0x2278('0x8f')]()[_0x2278('0x90')]();return db[_0x2278('0x3c')]['find']({'where':{'id':_0x4c70b9[_0x2278('0x60')]['id']}})[_0x2278('0x20')](function(_0x4cd092){return db[_0x2278('0x77')][_0x2278('0x78')](function(_0x3c333f){return _0x4cd092[_0x2278('0x7d')](_0x4c70b9['query'][_0x2278('0x71')],{'transaction':_0x3c333f})[_0x2278('0x20')](function(){if(!_[_0x2278('0x91')](_0x1b187a)){return _0x4cd092[_0x2278('0x92')](_0x1b187a,{'transaction':_0x3c333f});}})[_0x2278('0x20')](function(){_0x1b187a[_0x2278('0x7b')](function(_0x21d715){socket[_0x2278('0x7c')](_0x2278('0x93'),{'UserId':_0x21d715,'ChatQueueId':_0x4cd092['id']});});});});});});})['then'](respondWithStatusCode(_0x52556e,null))[_0x2278('0x28')](handleError(_0x52556e,null));};exports[_0x2278('0x94')]=function(_0x2d1da3,_0x55739d,_0x8efa01){return db[_0x2278('0x3c')][_0x2278('0x58')]({'where':{'id':_0x2d1da3['params']['id']}})[_0x2278('0x20')](handleEntityNotFound(_0x55739d,null))[_0x2278('0x20')](function(_0x38fd00){if(_0x38fd00){return _0x38fd00[_0x2278('0x94')](_0x2d1da3[_0x2278('0x59')][_0x2278('0x71')],_[_0x2278('0x95')](_0x2d1da3[_0x2278('0x59')],['ids','id'])||{})[_0x2278('0x96')](function(_0x564083){for(var _0x3f9ca1=0x0;_0x3f9ca1<_0x2d1da3[_0x2278('0x59')]['ids'][_0x2278('0x57')];_0x3f9ca1+=0x1){socket[_0x2278('0x7c')]('userChatQueue:save',{'UserId':Number(_0x2d1da3[_0x2278('0x59')][_0x2278('0x71')][_0x3f9ca1]),'ChatQueueId':Number(_0x2d1da3[_0x2278('0x60')]['id'])});}return _0x564083;});}})[_0x2278('0x20')](respondWithResult(_0x55739d,null))[_0x2278('0x28')](handleError(_0x55739d,null));};exports[_0x2278('0x92')]=function(_0x132574,_0x9e9de3,_0x17b4d9){return db[_0x2278('0x3c')]['find']({'where':{'id':_0x132574['params']['id']}})[_0x2278('0x20')](handleEntityNotFound(_0x9e9de3,null))[_0x2278('0x20')](function(_0x35580d){if(_0x35580d){return _0x35580d[_0x2278('0x92')](_0x132574['query'][_0x2278('0x71')])['then'](function(){if(_['isArray'](_0x132574[_0x2278('0x42')][_0x2278('0x71')])){for(var _0x204dc5=0x0;_0x204dc5<_0x132574[_0x2278('0x42')][_0x2278('0x71')][_0x2278('0x57')];_0x204dc5+=0x1){socket['emit'](_0x2278('0x93'),{'UserId':Number(_0x132574[_0x2278('0x42')][_0x2278('0x71')][_0x204dc5]),'ChatQueueId':Number(_0x132574['params']['id'])});}}else{socket[_0x2278('0x7c')]('userChatQueue:remove',{'UserId':Number(_0x132574[_0x2278('0x42')][_0x2278('0x71')]),'ChatQueueId':Number(_0x132574[_0x2278('0x60')]['id'])});}});}})[_0x2278('0x20')](respondWithStatusCode(_0x9e9de3,null))[_0x2278('0x28')](handleError(_0x9e9de3,null));};exports[_0x2278('0x97')]=function(_0x47b183,_0x2642af,_0x19ace6){var _0x167675={};var _0x19de41={};var _0x5dd67c;var _0x59e052;return db['ChatQueue'][_0x2278('0x62')]({'where':{'id':_0x47b183[_0x2278('0x60')]['id']}})[_0x2278('0x20')](handleEntityNotFound(_0x2642af,null))['then'](function(_0x486b71){if(_0x486b71){_0x5dd67c=_0x486b71;_0x19de41[_0x2278('0x41')]=_[_0x2278('0x55')](db[_0x2278('0x63')]['rawAttributes']);_0x19de41['query']=_[_0x2278('0x55')](_0x47b183[_0x2278('0x42')]);_0x19de41[_0x2278('0x4b')]=_[_0x2278('0x56')](_0x19de41[_0x2278('0x41')],_0x19de41['query']);_0x167675[_0x2278('0x43')]=_['intersection'](_0x19de41[_0x2278('0x41')],qs[_0x2278('0x44')](_0x47b183[_0x2278('0x42')]['fields']));_0x167675[_0x2278('0x43')]=_0x167675[_0x2278('0x43')][_0x2278('0x57')]?_0x167675[_0x2278('0x43')]:_0x19de41['model'];_0x167675[_0x2278('0x48')]=qs[_0x2278('0x49')](_0x47b183['query'][_0x2278('0x49')]);_0x167675[_0x2278('0x4a')]=qs[_0x2278('0x4b')](_[_0x2278('0x4c')](_0x47b183[_0x2278('0x42')],_0x19de41[_0x2278('0x4b')]));if(_0x47b183['query'][_0x2278('0x4d')]){_0x167675[_0x2278('0x4a')]=_[_0x2278('0x4e')](_0x167675[_0x2278('0x4a')],{'$or':_[_0x2278('0x3b')](_0x167675[_0x2278('0x43')],function(_0x4641b8){var _0x1aff33={};_0x1aff33[_0x4641b8]={'$like':'%'+_0x47b183[_0x2278('0x42')][_0x2278('0x4d')]+'%'};return _0x1aff33;})});}_0x167675=_['merge']({},_0x167675,_0x47b183[_0x2278('0x50')]);return _0x5dd67c['getAgents'](_0x167675);}})[_0x2278('0x20')](function(_0x235531){if(_0x235531){_0x59e052=_0x235531[_0x2278('0x57')];if(!_0x47b183[_0x2278('0x42')][_0x2278('0x45')](_0x2278('0x46'))){_0x167675[_0x2278('0x47')]=qs[_0x2278('0x47')](_0x47b183[_0x2278('0x42')][_0x2278('0x47')]);_0x167675['offset']=qs['offset'](_0x47b183[_0x2278('0x42')][_0x2278('0x2c')]);}return _0x5dd67c[_0x2278('0x97')](_0x167675);}})[_0x2278('0x20')](function(_0x230203){if(_0x230203){return _0x230203?{'count':_0x59e052,'rows':_0x230203}:null;}})[_0x2278('0x20')](respondWithResult(_0x2642af,null))['catch'](handleError(_0x2642af,null));}; \ No newline at end of file +var _0x1b27=['order','where','pick','filter','merge','VIRTUAL','ChatQueue','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChatQueues','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','sort','ChatQueueId','User','findAndCountAll','chatPause','updatedAt','createdAt','format','%s/%s','SIP','addTeams','ids','Team','Agents','online','voicePause','interface','sequelize','transaction','emit','userChatQueue:save','removeTeams','select','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','push','QueryTypes','TeamId','union','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','get','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x526db5,_0x402fa5){var _0x2a83cf=function(_0x5907d8){while(--_0x5907d8){_0x526db5['push'](_0x526db5['shift']());}};_0x2a83cf(++_0x402fa5);}(_0x1b27,0xce));var _0x71b2=function(_0x2f616a,_0x2a821b){_0x2f616a=_0x2f616a-0x0;var _0x5bcabe=_0x1b27[_0x2f616a];return _0x5bcabe;};'use strict';var emlformat=require(_0x71b2('0x0'));var rimraf=require(_0x71b2('0x1'));var zipdir=require(_0x71b2('0x2'));var jsonpatch=require(_0x71b2('0x3'));var rp=require(_0x71b2('0x4'));var moment=require('moment');var BPromise=require(_0x71b2('0x5'));var Mustache=require(_0x71b2('0x6'));var util=require(_0x71b2('0x7'));var path=require(_0x71b2('0x8'));var sox=require(_0x71b2('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x71b2('0xa'));var _=require(_0x71b2('0xb'));var squel=require('squel');var crypto=require(_0x71b2('0xc'));var jsforce=require(_0x71b2('0xd'));var deskjs=require(_0x71b2('0xe'));var toCsv=require(_0x71b2('0xf'));var querystring=require(_0x71b2('0x10'));var Papa=require(_0x71b2('0x11'));var Redis=require(_0x71b2('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x71b2('0x13'));var logger=require(_0x71b2('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x71b2('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x71b2('0x16'))['db'];config[_0x71b2('0x17')]=_[_0x71b2('0x18')](config[_0x71b2('0x17')],{'host':_0x71b2('0x19'),'port':0x18eb});var socket=require(_0x71b2('0x1a'))(new Redis(config[_0x71b2('0x17')]));require(_0x71b2('0x1b'))[_0x71b2('0x1c')](socket);var jayson=require(_0x71b2('0x1d'));var client=jayson[_0x71b2('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28ea96,_0x71d16b,_0x477cbd,_0x3b43bb){return new BPromise(function(_0x54b92f,_0x300a50){var _0x217ff6=_0x3b43bb||client;return _0x217ff6['request'](_0x28ea96,_0x477cbd)[_0x71b2('0x1f')](function(_0x2d85fd){logger[_0x71b2('0x20')](_0x71b2('0x21'),_0x71d16b,'request\x20sent');logger[_0x71b2('0x22')](_0x71b2('0x23'),_0x71d16b,'request\x20sent',JSON['stringify'](_0x2d85fd));if(_0x2d85fd[_0x71b2('0x24')]){if(_0x2d85fd[_0x71b2('0x24')]['code']===0x1f4){logger['error'](_0x71b2('0x21'),_0x71d16b,_0x2d85fd[_0x71b2('0x24')][_0x71b2('0x25')]);return _0x300a50(_0x2d85fd['error']['message']);}logger[_0x71b2('0x24')](_0x71b2('0x21'),_0x71d16b,_0x2d85fd[_0x71b2('0x24')][_0x71b2('0x25')]);return _0x54b92f(_0x2d85fd[_0x71b2('0x24')][_0x71b2('0x25')]);}else{logger[_0x71b2('0x20')]('ChatQueue,\x20%s,\x20%s',_0x71d16b,_0x71b2('0x26'));_0x54b92f(_0x2d85fd[_0x71b2('0x27')]['message']);}})[_0x71b2('0x28')](function(_0x318391){logger['error'](_0x71b2('0x21'),_0x71d16b,_0x318391);_0x300a50(_0x318391);});});}function respondWithStatusCode(_0x41c8e9,_0x945e4){_0x945e4=_0x945e4||0xcc;return function(_0x24b4d2){if(_0x24b4d2){return _0x41c8e9[_0x71b2('0x29')](_0x945e4);}return _0x41c8e9[_0x71b2('0x2a')](_0x945e4)[_0x71b2('0x2b')]();};}function respondWithResult(_0x491f5b,_0x1f0d97){_0x1f0d97=_0x1f0d97||0xc8;return function(_0x550cec){if(_0x550cec){return _0x491f5b[_0x71b2('0x2a')](_0x1f0d97)[_0x71b2('0x2c')](_0x550cec);}};}function respondWithFilteredResult(_0x45efcf,_0x3e0ed5){return function(_0x1b071d){if(_0x1b071d){var _0x459648=typeof _0x3e0ed5[_0x71b2('0x2d')]==='undefined'&&typeof _0x3e0ed5[_0x71b2('0x2e')]===_0x71b2('0x2f');var _0x429ee8=_0x1b071d['count'];var _0x8b23cf=_0x459648?0x0:_0x3e0ed5['offset'];var _0x18515b=_0x459648?_0x1b071d[_0x71b2('0x30')]:_0x3e0ed5['offset']+_0x3e0ed5['limit'];var _0x43fb4b;if(_0x18515b>=_0x429ee8){_0x18515b=_0x429ee8;_0x43fb4b=0xc8;}else{_0x43fb4b=0xce;}_0x45efcf[_0x71b2('0x2a')](_0x43fb4b);return _0x45efcf[_0x71b2('0x31')](_0x71b2('0x32'),_0x8b23cf+'-'+_0x18515b+'/'+_0x429ee8)['json'](_0x1b071d);}return null;};}function patchUpdates(_0x40a465){return function(_0x2d92e1){try{jsonpatch['apply'](_0x2d92e1,_0x40a465,!![]);}catch(_0x4b9b1e){return BPromise[_0x71b2('0x33')](_0x4b9b1e);}return _0x2d92e1[_0x71b2('0x34')]();};}function saveUpdates(_0x58912d,_0xcb0737){return function(_0x3992a2){if(_0x3992a2){return _0x3992a2[_0x71b2('0x35')](_0x58912d)[_0x71b2('0x1f')](function(_0x1aaed8){return _0x1aaed8;});}return null;};}function removeEntity(_0x4d3d6e,_0x50152a){return function(_0x250116){if(_0x250116){return _0x250116[_0x71b2('0x36')]()[_0x71b2('0x1f')](function(){var _0xdcce82=_0x250116[_0x71b2('0x37')]({'plain':!![]});var _0x4107aa='ChatQueues';return db['UserProfileResource'][_0x71b2('0x36')]({'where':{'type':_0x4107aa,'resourceId':_0xdcce82['id']}})[_0x71b2('0x1f')](function(){return _0x250116;});})[_0x71b2('0x1f')](function(){_0x4d3d6e[_0x71b2('0x2a')](0xcc)[_0x71b2('0x2b')]();});}};}function handleEntityNotFound(_0x36eb09,_0x1dd4ea){return function(_0x2c6897){if(!_0x2c6897){_0x36eb09['sendStatus'](0x194);}return _0x2c6897;};}function handleError(_0x2dd6d8,_0x349478){_0x349478=_0x349478||0x1f4;return function(_0x57f907){logger[_0x71b2('0x24')](_0x57f907[_0x71b2('0x38')]);if(_0x57f907[_0x71b2('0x39')]){delete _0x57f907[_0x71b2('0x39')];}_0x2dd6d8[_0x71b2('0x2a')](_0x349478)[_0x71b2('0x3a')](_0x57f907);};}exports[_0x71b2('0x3b')]=function(_0x316538,_0x3872bc){var _0x1eb799={},_0x5f3c2b={},_0x4965d0={'count':0x0,'rows':[]};var _0x318806=_[_0x71b2('0x3c')](db['ChatQueue']['rawAttributes'],function(_0xe3ebbc){return{'name':_0xe3ebbc[_0x71b2('0x3d')],'type':_0xe3ebbc[_0x71b2('0x3e')][_0x71b2('0x3f')]};});_0x5f3c2b[_0x71b2('0x40')]=_['map'](_0x318806,_0x71b2('0x39'));_0x5f3c2b[_0x71b2('0x41')]=_[_0x71b2('0x42')](_0x316538['query']);_0x5f3c2b[_0x71b2('0x43')]=_['intersection'](_0x5f3c2b['model'],_0x5f3c2b[_0x71b2('0x41')]);_0x1eb799['attributes']=_[_0x71b2('0x44')](_0x5f3c2b[_0x71b2('0x40')],qs[_0x71b2('0x45')](_0x316538['query']['fields']));_0x1eb799[_0x71b2('0x46')]=_0x1eb799[_0x71b2('0x46')][_0x71b2('0x47')]?_0x1eb799[_0x71b2('0x46')]:_0x5f3c2b['model'];if(!_0x316538['query'][_0x71b2('0x48')](_0x71b2('0x49'))){_0x1eb799[_0x71b2('0x2e')]=qs[_0x71b2('0x2e')](_0x316538[_0x71b2('0x41')][_0x71b2('0x2e')]);_0x1eb799['offset']=qs[_0x71b2('0x2d')](_0x316538[_0x71b2('0x41')][_0x71b2('0x2d')]);}_0x1eb799[_0x71b2('0x4a')]=qs['sort'](_0x316538[_0x71b2('0x41')]['sort']);_0x1eb799[_0x71b2('0x4b')]=qs[_0x71b2('0x43')](_[_0x71b2('0x4c')](_0x316538[_0x71b2('0x41')],_0x5f3c2b[_0x71b2('0x43')]),_0x318806);if(_0x316538[_0x71b2('0x41')][_0x71b2('0x4d')]){_0x1eb799['where']=_[_0x71b2('0x4e')](_0x1eb799[_0x71b2('0x4b')],{'$or':_[_0x71b2('0x3c')](_0x318806,function(_0x1f2793){if(_0x1f2793[_0x71b2('0x3e')]!==_0x71b2('0x4f')){var _0x5eb90c={};_0x5eb90c[_0x1f2793[_0x71b2('0x39')]]={'$like':'%'+_0x316538[_0x71b2('0x41')]['filter']+'%'};return _0x5eb90c;}})});}_0x1eb799=_[_0x71b2('0x4e')]({},_0x1eb799,_0x316538['options']);var _0x42a630={'where':_0x1eb799[_0x71b2('0x4b')]};return db[_0x71b2('0x50')][_0x71b2('0x30')](_0x42a630)[_0x71b2('0x1f')](function(_0x1033c2){_0x4965d0[_0x71b2('0x30')]=_0x1033c2;if(_0x316538[_0x71b2('0x41')][_0x71b2('0x51')]){_0x1eb799[_0x71b2('0x52')]=[{'all':!![]}];}return db[_0x71b2('0x50')][_0x71b2('0x53')](_0x1eb799);})[_0x71b2('0x1f')](function(_0x42903c){_0x4965d0[_0x71b2('0x54')]=_0x42903c;return _0x4965d0;})[_0x71b2('0x1f')](respondWithFilteredResult(_0x3872bc,_0x1eb799))[_0x71b2('0x28')](handleError(_0x3872bc,null));};exports[_0x71b2('0x55')]=function(_0x2daa33,_0x19220e){var _0x252649={'raw':!![],'where':{'id':_0x2daa33[_0x71b2('0x56')]['id']}},_0x44f1fb={};_0x44f1fb['model']=_['keys'](db[_0x71b2('0x50')][_0x71b2('0x57')]);_0x44f1fb[_0x71b2('0x41')]=_['keys'](_0x2daa33[_0x71b2('0x41')]);_0x44f1fb[_0x71b2('0x43')]=_[_0x71b2('0x44')](_0x44f1fb[_0x71b2('0x40')],_0x44f1fb[_0x71b2('0x41')]);_0x252649[_0x71b2('0x46')]=_[_0x71b2('0x44')](_0x44f1fb[_0x71b2('0x40')],qs[_0x71b2('0x45')](_0x2daa33['query'][_0x71b2('0x45')]));_0x252649[_0x71b2('0x46')]=_0x252649['attributes'][_0x71b2('0x47')]?_0x252649[_0x71b2('0x46')]:_0x44f1fb['model'];if(_0x2daa33[_0x71b2('0x41')][_0x71b2('0x51')]){_0x252649[_0x71b2('0x52')]=[{'all':!![]}];}_0x252649=_['merge']({},_0x252649,_0x2daa33[_0x71b2('0x58')]);return db[_0x71b2('0x50')][_0x71b2('0x59')](_0x252649)[_0x71b2('0x1f')](handleEntityNotFound(_0x19220e,null))[_0x71b2('0x1f')](respondWithResult(_0x19220e,null))[_0x71b2('0x28')](handleError(_0x19220e,null));};exports[_0x71b2('0x5a')]=function(_0x405829,_0x8fb36f){return db[_0x71b2('0x50')][_0x71b2('0x5a')](_0x405829[_0x71b2('0x5b')],{})[_0x71b2('0x1f')](function(_0x2f2bb1){var _0x191b91=_0x405829['user'][_0x71b2('0x37')]({'plain':!![]});if(!_0x191b91)throw new Error(_0x71b2('0x5c'));if(_0x191b91['role']==='user'){var _0x5ee006=_0x2f2bb1['get']({'plain':!![]});var _0x1937dd=_0x71b2('0x5d');return db['UserProfileSection'][_0x71b2('0x59')]({'where':{'name':_0x1937dd,'userProfileId':_0x191b91['userProfileId']},'raw':!![]})[_0x71b2('0x1f')](function(_0x403d21){if(_0x403d21&&_0x403d21[_0x71b2('0x5e')]===0x0){return db[_0x71b2('0x5f')][_0x71b2('0x5a')]({'name':_0x5ee006[_0x71b2('0x39')],'resourceId':_0x5ee006['id'],'type':_0x403d21['name'],'sectionId':_0x403d21['id']},{})[_0x71b2('0x1f')](function(){return _0x2f2bb1;});}else{return _0x2f2bb1;}})[_0x71b2('0x28')](function(_0x39603e){logger['error'](_0x71b2('0x60'),_0x39603e);throw _0x39603e;});}return _0x2f2bb1;})[_0x71b2('0x1f')](respondWithResult(_0x8fb36f,0xc9))[_0x71b2('0x28')](handleError(_0x8fb36f,null));};exports[_0x71b2('0x35')]=function(_0x443478,_0x20d7df){if(_0x443478[_0x71b2('0x5b')]['id']){delete _0x443478['body']['id'];}return db['ChatQueue'][_0x71b2('0x59')]({'where':{'id':_0x443478[_0x71b2('0x56')]['id']}})[_0x71b2('0x1f')](handleEntityNotFound(_0x20d7df,null))['then'](saveUpdates(_0x443478[_0x71b2('0x5b')],null))['then'](respondWithResult(_0x20d7df,null))['catch'](handleError(_0x20d7df,null));};exports['destroy']=function(_0x427f4b,_0xa79574){return db[_0x71b2('0x50')][_0x71b2('0x59')]({'where':{'id':_0x427f4b[_0x71b2('0x56')]['id']}})['then'](handleEntityNotFound(_0xa79574,null))['then'](removeEntity(_0xa79574,null))[_0x71b2('0x28')](handleError(_0xa79574,null));};exports['describe']=function(_0x322bba,_0x3d9509){return db[_0x71b2('0x50')][_0x71b2('0x61')]()[_0x71b2('0x1f')](respondWithResult(_0x3d9509,null))[_0x71b2('0x28')](handleError(_0x3d9509,null));};exports[_0x71b2('0x62')]=function(_0x54336f,_0x11ebde,_0x281bc4){var _0x5234d3={'raw':!![],'where':{}},_0x51a924={},_0x91dd1e;return db[_0x71b2('0x50')][_0x71b2('0x63')]({'where':{'id':_0x54336f[_0x71b2('0x56')]['id']}})['then'](handleEntityNotFound(_0x11ebde,null))[_0x71b2('0x1f')](function(_0x89fbe7){if(_0x89fbe7){_0x91dd1e=_0x89fbe7[_0x71b2('0x37')]({'plain':!![]});_0x51a924[_0x71b2('0x40')]=_['keys'](db['UserChatQueue'][_0x71b2('0x57')]);_0x51a924[_0x71b2('0x41')]=_[_0x71b2('0x42')](_0x54336f[_0x71b2('0x41')]);_0x51a924[_0x71b2('0x43')]=_[_0x71b2('0x44')](_0x51a924[_0x71b2('0x40')],_0x51a924[_0x71b2('0x41')]);_0x5234d3[_0x71b2('0x46')]=_[_0x71b2('0x44')](_0x51a924['model'],qs[_0x71b2('0x45')](_0x54336f[_0x71b2('0x41')][_0x71b2('0x45')]));_0x5234d3[_0x71b2('0x46')]=_0x5234d3['attributes'][_0x71b2('0x47')]?_0x5234d3[_0x71b2('0x46')]:_0x51a924[_0x71b2('0x40')];if(!_0x54336f[_0x71b2('0x41')]['hasOwnProperty'](_0x71b2('0x49'))){_0x5234d3[_0x71b2('0x2e')]=qs['limit'](_0x54336f[_0x71b2('0x41')]['limit']);_0x5234d3[_0x71b2('0x2d')]=qs['offset'](_0x54336f['query'][_0x71b2('0x2d')]);}_0x5234d3[_0x71b2('0x4a')]=qs[_0x71b2('0x64')](_0x54336f[_0x71b2('0x41')][_0x71b2('0x64')]);_0x5234d3[_0x71b2('0x4b')]=qs['filters'](_[_0x71b2('0x4c')](_0x54336f['query'],_0x51a924[_0x71b2('0x43')]));_0x5234d3[_0x71b2('0x4b')][_0x71b2('0x65')]=_0x89fbe7['id'];if(_0x54336f[_0x71b2('0x41')][_0x71b2('0x4d')]){_0x5234d3[_0x71b2('0x4b')]=_['merge'](_0x5234d3[_0x71b2('0x4b')],{'$or':_[_0x71b2('0x3c')](_0x5234d3[_0x71b2('0x46')],function(_0x3c43dc){var _0x41eace={};_0x41eace[_0x3c43dc]={'$like':'%'+_0x54336f[_0x71b2('0x41')][_0x71b2('0x4d')]+'%'};return _0x41eace;})});}_0x5234d3=_['merge']({},_0x5234d3,_0x54336f['options']);return db['UserChatQueue'][_0x71b2('0x53')](_0x5234d3);}})[_0x71b2('0x1f')](function(_0x24cd74){if(_0x24cd74){return db[_0x71b2('0x66')][_0x71b2('0x67')]({'where':{'id':_[_0x71b2('0x3c')](_0x24cd74,'UserId'),'role':'agent'},'attributes':['id',_0x71b2('0x39'),_0x71b2('0x68'),_0x71b2('0x69'),_0x71b2('0x6a')]});}})['then'](function(_0x5050f3){if(_0x5050f3){return{'count':_0x5050f3[_0x71b2('0x30')],'rows':_[_0x71b2('0x3c')](_0x5050f3['rows'],function(_0x2e82f5){return{'membername':_0x2e82f5['name'],'UserId':_0x2e82f5['id'],'queue_name':_0x91dd1e[_0x71b2('0x39')],'ChatQueueId':_0x91dd1e['id'],'interface':util[_0x71b2('0x6b')](_0x71b2('0x6c'),_0x71b2('0x6d'),_0x2e82f5[_0x71b2('0x39')]),'penalty':0x0,'paused':_0x2e82f5[_0x71b2('0x68')],'createdAt':_0x2e82f5['createdAt'],'updatedAt':_0x2e82f5[_0x71b2('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x71b2('0x1f')](respondWithFilteredResult(_0x11ebde,_0x5234d3))[_0x71b2('0x28')](handleError(_0x11ebde,null));};exports['getTeams']=function(_0x3dd2ac,_0x5c43c8,_0x1a0cc3){var _0xe7c4ce={};var _0x551ff0={};var _0x18acc8;var _0x5aac8a;return db[_0x71b2('0x50')]['findOne']({'where':{'id':_0x3dd2ac[_0x71b2('0x56')]['id']}})[_0x71b2('0x1f')](handleEntityNotFound(_0x5c43c8,null))[_0x71b2('0x1f')](function(_0x1fe84e){if(_0x1fe84e){_0x18acc8=_0x1fe84e;_0x551ff0[_0x71b2('0x40')]=_[_0x71b2('0x42')](db['Team'][_0x71b2('0x57')]);_0x551ff0[_0x71b2('0x41')]=_[_0x71b2('0x42')](_0x3dd2ac[_0x71b2('0x41')]);_0x551ff0[_0x71b2('0x43')]=_[_0x71b2('0x44')](_0x551ff0[_0x71b2('0x40')],_0x551ff0['query']);_0xe7c4ce[_0x71b2('0x46')]=_['intersection'](_0x551ff0[_0x71b2('0x40')],qs[_0x71b2('0x45')](_0x3dd2ac['query'][_0x71b2('0x45')]));_0xe7c4ce[_0x71b2('0x46')]=_0xe7c4ce['attributes'][_0x71b2('0x47')]?_0xe7c4ce[_0x71b2('0x46')]:_0x551ff0[_0x71b2('0x40')];_0xe7c4ce[_0x71b2('0x4a')]=qs['sort'](_0x3dd2ac[_0x71b2('0x41')][_0x71b2('0x64')]);_0xe7c4ce[_0x71b2('0x4b')]=qs[_0x71b2('0x43')](_[_0x71b2('0x4c')](_0x3dd2ac[_0x71b2('0x41')],_0x551ff0[_0x71b2('0x43')]));if(_0x3dd2ac[_0x71b2('0x41')][_0x71b2('0x4d')]){_0xe7c4ce[_0x71b2('0x4b')]=_[_0x71b2('0x4e')](_0xe7c4ce['where'],{'$or':_[_0x71b2('0x3c')](_0xe7c4ce[_0x71b2('0x46')],function(_0x177871){var _0x4537c5={};_0x4537c5[_0x177871]={'$like':'%'+_0x3dd2ac[_0x71b2('0x41')]['filter']+'%'};return _0x4537c5;})});}_0xe7c4ce=_[_0x71b2('0x4e')]({},_0xe7c4ce,_0x3dd2ac[_0x71b2('0x58')]);return _0x18acc8['getTeams'](_0xe7c4ce);}})[_0x71b2('0x1f')](function(_0x1c705b){if(_0x1c705b){_0x5aac8a=_0x1c705b['length'];if(!_0x3dd2ac['query']['hasOwnProperty']('nolimit')){_0xe7c4ce[_0x71b2('0x2e')]=qs['limit'](_0x3dd2ac[_0x71b2('0x41')][_0x71b2('0x2e')]);_0xe7c4ce['offset']=qs['offset'](_0x3dd2ac[_0x71b2('0x41')]['offset']);}return _0x18acc8['getTeams'](_0xe7c4ce);}})['then'](function(_0x41050e){if(_0x41050e){return _0x41050e?{'count':_0x5aac8a,'rows':_0x41050e}:null;}})[_0x71b2('0x1f')](respondWithResult(_0x5c43c8,null))[_0x71b2('0x28')](handleError(_0x5c43c8,null));};exports[_0x71b2('0x6e')]=function(_0x4eb9ec,_0x37ac04,_0xdf4369){var _0x5547ab=_0x4eb9ec[_0x71b2('0x5b')][_0x71b2('0x6f')];return db[_0x71b2('0x70')][_0x71b2('0x53')]({'where':{'id':_0x5547ab},'attributes':['id'],'include':[{'model':db[_0x71b2('0x66')],'as':_0x71b2('0x71'),'attributes':['id',_0x71b2('0x39'),_0x71b2('0x72'),_0x71b2('0x73'),_0x71b2('0x74')],'raw':!![]}]})[_0x71b2('0x1f')](function(_0x53d353){if(_0x53d353){var _0x5a689f=_['flatMap'](_0x53d353,function(_0x57d6d8){var _0x172ff6=_0x57d6d8[_0x71b2('0x37')]({'plain':!![]});return _0x172ff6['Agents'];});return db[_0x71b2('0x50')][_0x71b2('0x59')]({'where':{'id':_0x4eb9ec[_0x71b2('0x56')]['id']}})[_0x71b2('0x1f')](function(_0x1236ed){return db[_0x71b2('0x75')][_0x71b2('0x76')](function(_0x2c58a2){return _0x1236ed[_0x71b2('0x6e')](_0x5547ab,{'transaction':_0x2c58a2})['then'](function(){return BPromise['each'](_0x5a689f,function(_0x55a12e){return db['UserChatQueue']['findOrCreate']({'where':{'UserId':_0x55a12e['id'],'ChatQueueId':_0x4eb9ec['params']['id']},'transaction':_0x2c58a2});});})[_0x71b2('0x1f')](function(){_0x5a689f['forEach'](function(_0x16cab7){socket[_0x71b2('0x77')](_0x71b2('0x78'),{'UserId':_0x16cab7['id'],'ChatQueueId':_0x1236ed['id']});});});});});}})['then'](respondWithStatusCode(_0x37ac04,null))[_0x71b2('0x28')](handleError(_0x37ac04,null));};exports[_0x71b2('0x79')]=function(_0x1c7c02,_0x4a4fbe,_0x1a3904){return db[_0x71b2('0x70')]['findAll']({'where':{'id':_0x1c7c02[_0x71b2('0x41')]['ids']},'attributes':['id'],'include':[{'model':db[_0x71b2('0x66')],'as':_0x71b2('0x71'),'attributes':['id'],'raw':!![]}]})[_0x71b2('0x1f')](handleEntityNotFound(_0x4a4fbe,null))['then'](function(_0x1482fd){var _0x5cb0a3=_['map'](_0x1482fd,'id');var _0x530a5c=[];var _0x5a113d=[];var _0x3eb025=squel[_0x71b2('0x7a')]();_0x3eb025['field']('tq.TeamId')[_0x71b2('0x7b')](_0x71b2('0x7c'),'tq')[_0x71b2('0x7d')](_0x71b2('0x7e'),'ut',_0x71b2('0x7f'))[_0x71b2('0x4b')](_0x71b2('0x80'),_0x1c7c02[_0x71b2('0x56')]['id']);for(var _0x190656=0x0;_0x190656<_0x1482fd['length'];_0x190656+=0x1){let _0x1a4ea4=_0x1482fd[_0x190656];for(var _0x159022=0x0;_0x159022<_0x1a4ea4['Agents'][_0x71b2('0x47')];_0x159022+=0x1){let _0x909df4=_0x1a4ea4[_0x71b2('0x71')][_0x159022];var _0x409d00=_0x3eb025['clone']();_0x409d00[_0x71b2('0x4b')]('ut.UserId\x20=\x20?',_0x909df4['id']);_0x5a113d[_0x71b2('0x81')](db['sequelize'][_0x71b2('0x41')](_0x409d00['toString'](),{'type':db[_0x71b2('0x75')][_0x71b2('0x82')]['SELECT']})['then'](function(_0xddd1b4){if(_0xddd1b4['length']===0x1){return _0x909df4['id'];}else{var _0x3e2ee1=_['every'](_[_0x71b2('0x3c')](_0xddd1b4,_0x71b2('0x83')),function(_0x591bf2){return _['includes'](_0x5cb0a3,_0x591bf2);});if(_0x3e2ee1){return _0x909df4['id'];}}}));}}return BPromise['all'](_0x5a113d)[_0x71b2('0x1f')](function(_0x3a4617){_0x530a5c=_(_0x530a5c)[_0x71b2('0x84')](_0x3a4617)['compact']()[_0x71b2('0x85')]();return db[_0x71b2('0x50')][_0x71b2('0x59')]({'where':{'id':_0x1c7c02[_0x71b2('0x56')]['id']}})[_0x71b2('0x1f')](function(_0x4605bf){return db[_0x71b2('0x75')][_0x71b2('0x76')](function(_0x17a1a7){return _0x4605bf[_0x71b2('0x79')](_0x1c7c02['query']['ids'],{'transaction':_0x17a1a7})[_0x71b2('0x1f')](function(){if(!_[_0x71b2('0x86')](_0x530a5c)){return _0x4605bf[_0x71b2('0x87')](_0x530a5c,{'transaction':_0x17a1a7});}})[_0x71b2('0x1f')](function(){_0x530a5c['forEach'](function(_0x2d9ef7){socket[_0x71b2('0x77')](_0x71b2('0x88'),{'UserId':_0x2d9ef7,'ChatQueueId':_0x4605bf['id']});});});});});});})[_0x71b2('0x1f')](respondWithStatusCode(_0x4a4fbe,null))[_0x71b2('0x28')](handleError(_0x4a4fbe,null));};exports[_0x71b2('0x89')]=function(_0x22f09c,_0x5bb743,_0x4e4c32){return db[_0x71b2('0x50')][_0x71b2('0x59')]({'where':{'id':_0x22f09c[_0x71b2('0x56')]['id']}})[_0x71b2('0x1f')](handleEntityNotFound(_0x5bb743,null))['then'](function(_0x311b97){if(_0x311b97){return _0x311b97[_0x71b2('0x89')](_0x22f09c['body'][_0x71b2('0x6f')],_[_0x71b2('0x8a')](_0x22f09c[_0x71b2('0x5b')],[_0x71b2('0x6f'),'id'])||{})['spread'](function(_0x43119d){for(var _0x587887=0x0;_0x587887<_0x22f09c[_0x71b2('0x5b')][_0x71b2('0x6f')][_0x71b2('0x47')];_0x587887+=0x1){socket[_0x71b2('0x77')](_0x71b2('0x78'),{'UserId':Number(_0x22f09c[_0x71b2('0x5b')]['ids'][_0x587887]),'ChatQueueId':Number(_0x22f09c[_0x71b2('0x56')]['id'])});}return _0x43119d;});}})[_0x71b2('0x1f')](respondWithResult(_0x5bb743,null))[_0x71b2('0x28')](handleError(_0x5bb743,null));};exports[_0x71b2('0x87')]=function(_0x195331,_0x5ee92e,_0x26f4f4){return db[_0x71b2('0x50')][_0x71b2('0x59')]({'where':{'id':_0x195331[_0x71b2('0x56')]['id']}})['then'](handleEntityNotFound(_0x5ee92e,null))[_0x71b2('0x1f')](function(_0x5bf488){if(_0x5bf488){return _0x5bf488[_0x71b2('0x87')](_0x195331[_0x71b2('0x41')][_0x71b2('0x6f')])[_0x71b2('0x1f')](function(){if(_['isArray'](_0x195331[_0x71b2('0x41')][_0x71b2('0x6f')])){for(var _0x172dd1=0x0;_0x172dd1<_0x195331['query']['ids'][_0x71b2('0x47')];_0x172dd1+=0x1){socket[_0x71b2('0x77')](_0x71b2('0x88'),{'UserId':Number(_0x195331[_0x71b2('0x41')][_0x71b2('0x6f')][_0x172dd1]),'ChatQueueId':Number(_0x195331[_0x71b2('0x56')]['id'])});}}else{socket[_0x71b2('0x77')](_0x71b2('0x88'),{'UserId':Number(_0x195331['query'][_0x71b2('0x6f')]),'ChatQueueId':Number(_0x195331[_0x71b2('0x56')]['id'])});}});}})[_0x71b2('0x1f')](respondWithStatusCode(_0x5ee92e,null))['catch'](handleError(_0x5ee92e,null));};exports[_0x71b2('0x8b')]=function(_0x39fcec,_0x1c0eb0,_0x1dede6){var _0x4cc347={};var _0x3e0fea={};var _0x2c6b93;var _0x2425b0;return db['ChatQueue'][_0x71b2('0x63')]({'where':{'id':_0x39fcec[_0x71b2('0x56')]['id']}})['then'](handleEntityNotFound(_0x1c0eb0,null))[_0x71b2('0x1f')](function(_0x30d8ec){if(_0x30d8ec){_0x2c6b93=_0x30d8ec;_0x3e0fea['model']=_[_0x71b2('0x42')](db[_0x71b2('0x66')]['rawAttributes']);_0x3e0fea[_0x71b2('0x41')]=_['keys'](_0x39fcec[_0x71b2('0x41')]);_0x3e0fea[_0x71b2('0x43')]=_[_0x71b2('0x44')](_0x3e0fea['model'],_0x3e0fea['query']);_0x4cc347['attributes']=_[_0x71b2('0x44')](_0x3e0fea[_0x71b2('0x40')],qs[_0x71b2('0x45')](_0x39fcec[_0x71b2('0x41')]['fields']));_0x4cc347[_0x71b2('0x46')]=_0x4cc347[_0x71b2('0x46')][_0x71b2('0x47')]?_0x4cc347[_0x71b2('0x46')]:_0x3e0fea[_0x71b2('0x40')];_0x4cc347['order']=qs[_0x71b2('0x64')](_0x39fcec[_0x71b2('0x41')]['sort']);_0x4cc347['where']=qs['filters'](_[_0x71b2('0x4c')](_0x39fcec[_0x71b2('0x41')],_0x3e0fea['filters']));if(_0x39fcec[_0x71b2('0x41')][_0x71b2('0x4d')]){_0x4cc347['where']=_['merge'](_0x4cc347[_0x71b2('0x4b')],{'$or':_[_0x71b2('0x3c')](_0x4cc347[_0x71b2('0x46')],function(_0x55cead){var _0x40453e={};_0x40453e[_0x55cead]={'$like':'%'+_0x39fcec['query']['filter']+'%'};return _0x40453e;})});}_0x4cc347=_[_0x71b2('0x4e')]({},_0x4cc347,_0x39fcec['options']);return _0x2c6b93[_0x71b2('0x8b')](_0x4cc347);}})['then'](function(_0x2a7f4b){if(_0x2a7f4b){_0x2425b0=_0x2a7f4b[_0x71b2('0x47')];if(!_0x39fcec[_0x71b2('0x41')][_0x71b2('0x48')](_0x71b2('0x49'))){_0x4cc347[_0x71b2('0x2e')]=qs['limit'](_0x39fcec[_0x71b2('0x41')][_0x71b2('0x2e')]);_0x4cc347[_0x71b2('0x2d')]=qs[_0x71b2('0x2d')](_0x39fcec[_0x71b2('0x41')]['offset']);}return _0x2c6b93['getAgents'](_0x4cc347);}})[_0x71b2('0x1f')](function(_0x598bad){if(_0x598bad){return _0x598bad?{'count':_0x2425b0,'rows':_0x598bad}:null;}})[_0x71b2('0x1f')](respondWithResult(_0x1c0eb0,null))[_0x71b2('0x28')](handleError(_0x1c0eb0,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index aa323fc..624466d 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 _0x58f0=['exports','../../mysqldb','ChatQueue','setMaxListeners','update','remove','emit','hook'];(function(_0x6dc241,_0x3d6db7){var _0xac50e7=function(_0x42c8a1){while(--_0x42c8a1){_0x6dc241['push'](_0x6dc241['shift']());}};_0xac50e7(++_0x3d6db7);}(_0x58f0,0xe9));var _0x058f=function(_0x305290,_0x349aef){_0x305290=_0x305290-0x0;var _0x4f219c=_0x58f0[_0x305290];return _0x4f219c;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x058f('0x0'))['db'][_0x058f('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x058f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x058f('0x3'),'afterDestroy':_0x058f('0x4')};function emitEvent(_0x2244bc){return function(_0x3222f0,_0x3e8cce,_0x464619){ChatQueueEvents[_0x058f('0x5')](_0x2244bc+':'+_0x3222f0['id'],_0x3222f0);ChatQueueEvents[_0x058f('0x5')](_0x2244bc,_0x3222f0);_0x464619(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x058f('0x6')](e,emitEvent(event));}}module[_0x058f('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0xf296=['hook','events','../../mysqldb','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x154584,_0x421e12){var _0x969074=function(_0x17303b){while(--_0x17303b){_0x154584['push'](_0x154584['shift']());}};_0x969074(++_0x421e12);}(_0xf296,0x94));var _0x6f29=function(_0x5962b4,_0x84be73){_0x5962b4=_0x5962b4-0x0;var _0xe6443c=_0xf296[_0x5962b4];return _0xe6443c;};'use strict';var EventEmitter=require(_0x6f29('0x0'));var ChatQueue=require(_0x6f29('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x6f29('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x6f29('0x3')};function emitEvent(_0x3cdbee){return function(_0x4cdc12,_0x15e80c,_0x209362){ChatQueueEvents[_0x6f29('0x4')](_0x3cdbee+':'+_0x4cdc12['id'],_0x4cdc12);ChatQueueEvents['emit'](_0x3cdbee,_0x4cdc12);_0x209362(null);};}for(var e in events){if(events[_0x6f29('0x5')](e)){var event=events[e];ChatQueue[_0x6f29('0x6')](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 d41cd76..49a6404 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 _0xa962=['moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','api'];(function(_0x169600,_0x1d1346){var _0x3bee22=function(_0x19639b){while(--_0x19639b){_0x169600['push'](_0x169600['shift']());}};_0x3bee22(++_0x1d1346);}(_0xa962,0x10e));var _0x2a96=function(_0x23551e,_0x56f82f){_0x23551e=_0x23551e-0x0;var _0x4e36ff=_0xa962[_0x23551e];return _0x4e36ff;};'use strict';var _=require(_0x2a96('0x0'));var util=require(_0x2a96('0x1'));var logger=require('../../config/logger')(_0x2a96('0x2'));var moment=require(_0x2a96('0x3'));var BPromise=require(_0x2a96('0x4'));var rp=require(_0x2a96('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2a96('0x6'));var config=require(_0x2a96('0x7'));var attributes=require(_0x2a96('0x8'));module[_0x2a96('0x9')]=function(_0x52e73b,_0x8c447a){return _0x52e73b[_0x2a96('0xa')](_0x2a96('0xb'),attributes,{'tableName':_0x2a96('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x286f=['define','chat_queues','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x23a12d,_0x4171f2){var _0x136b63=function(_0x5292f6){while(--_0x5292f6){_0x23a12d['push'](_0x23a12d['shift']());}};_0x136b63(++_0x4171f2);}(_0x286f,0x157));var _0xf286=function(_0xdd7702,_0x1c1194){_0xdd7702=_0xdd7702-0x0;var _0x2fd65c=_0x286f[_0xdd7702];return _0x2fd65c;};'use strict';var _=require('lodash');var util=require(_0xf286('0x0'));var logger=require('../../config/logger')(_0xf286('0x1'));var moment=require(_0xf286('0x2'));var BPromise=require(_0xf286('0x3'));var rp=require(_0xf286('0x4'));var fs=require('fs');var path=require(_0xf286('0x5'));var rimraf=require(_0xf286('0x6'));var config=require(_0xf286('0x7'));var attributes=require('./chatQueue.attributes');module[_0xf286('0x8')]=function(_0x993a3e,_0x235d5c){return _0x993a3e[_0xf286('0x9')]('ChatQueue',attributes,{'tableName':_0xf286('0xa'),'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 5fc4e3b..e2f8be4 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 _0x7d25=['../../config/utils','client','redis','defaults','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowChatQueue','ChatQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x239a98,_0x288178){var _0x16d789=function(_0xbdf050){while(--_0xbdf050){_0x239a98['push'](_0x239a98['shift']());}};_0x16d789(++_0x288178);}(_0x7d25,0x8a));var _0x57d2=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x7d25[_0x29d94e];return _0x106237;};'use strict';var _=require('lodash');var util=require(_0x57d2('0x0'));var moment=require(_0x57d2('0x1'));var BPromise=require(_0x57d2('0x2'));var rs=require(_0x57d2('0x3'));var fs=require('fs');var Redis=require(_0x57d2('0x4'));var db=require(_0x57d2('0x5'))['db'];var utils=require(_0x57d2('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x57d2('0x7')]['http']({'port':0x232a});config[_0x57d2('0x8')]=_[_0x57d2('0x9')](config[_0x57d2('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x57d2('0x8')]));require('./chatQueue.socket')[_0x57d2('0xa')](socket);function respondWithRpcPromise(_0x5153c2,_0xa04872,_0x485438){return new BPromise(function(_0x429301,_0x1a86db){return client[_0x57d2('0xb')](_0x5153c2,_0x485438)[_0x57d2('0xc')](function(_0x2e8e12){logger[_0x57d2('0xd')](_0x57d2('0xe'),_0xa04872,_0x57d2('0xf'));logger[_0x57d2('0x10')](_0x57d2('0x11'),_0xa04872,_0x57d2('0xf'),JSON[_0x57d2('0x12')](_0x2e8e12));if(_0x2e8e12[_0x57d2('0x13')]){if(_0x2e8e12[_0x57d2('0x13')][_0x57d2('0x14')]===0x1f4){logger[_0x57d2('0x13')]('ChatQueue,\x20%s,\x20%s',_0xa04872,_0x2e8e12['error'][_0x57d2('0x15')]);return _0x1a86db(_0x2e8e12[_0x57d2('0x13')]['message']);}logger[_0x57d2('0x13')](_0x57d2('0xe'),_0xa04872,_0x2e8e12['error'][_0x57d2('0x15')]);return _0x429301(_0x2e8e12['error'][_0x57d2('0x15')]);}else{logger['info'](_0x57d2('0xe'),_0xa04872,_0x57d2('0xf'));_0x429301(_0x2e8e12[_0x57d2('0x16')]['message']);}})['catch'](function(_0xbaeda8){logger[_0x57d2('0x13')](_0x57d2('0xe'),_0xa04872,_0xbaeda8);_0x1a86db(_0xbaeda8);});});}exports[_0x57d2('0x17')]=function(_0x5b1b9d){var _0x1cbe4a=this;return new Promise(function(_0xcf924f,_0x55191e){return db['ChatQueue'][_0x57d2('0x18')]({'raw':_0x5b1b9d[_0x57d2('0x19')]?_0x5b1b9d[_0x57d2('0x19')][_0x57d2('0x1a')]===undefined?!![]:![]:!![],'where':_0x5b1b9d[_0x57d2('0x19')]?_0x5b1b9d[_0x57d2('0x19')][_0x57d2('0x1b')]||null:null,'attributes':_0x5b1b9d[_0x57d2('0x19')]?_0x5b1b9d[_0x57d2('0x19')][_0x57d2('0x1c')]||null:null,'limit':_0x5b1b9d[_0x57d2('0x19')]?_0x5b1b9d[_0x57d2('0x19')][_0x57d2('0x1d')]||null:null,'include':_0x5b1b9d[_0x57d2('0x19')]?_0x5b1b9d['options'][_0x57d2('0x1e')]?_[_0x57d2('0x1f')](_0x5b1b9d[_0x57d2('0x19')][_0x57d2('0x1e')],function(_0x4363b3){return{'model':db[_0x4363b3['model']],'as':_0x4363b3['as'],'attributes':_0x4363b3[_0x57d2('0x1c')],'include':_0x4363b3[_0x57d2('0x1e')]?_[_0x57d2('0x1f')](_0x4363b3[_0x57d2('0x1e')],function(_0x18d500){return{'model':db[_0x18d500[_0x57d2('0x20')]],'as':_0x18d500['as'],'attributes':_0x18d500[_0x57d2('0x1c')],'include':_0x18d500['include']?_[_0x57d2('0x1f')](_0x18d500[_0x57d2('0x1e')],function(_0x277426){return{'model':db[_0x277426[_0x57d2('0x20')]],'as':_0x277426['as'],'attributes':_0x277426[_0x57d2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x57d2('0xc')](function(_0x1dd6cb){logger[_0x57d2('0xd')](_0x57d2('0x17'),_0x5b1b9d);logger[_0x57d2('0x10')]('GetChatQueue',_0x5b1b9d,JSON[_0x57d2('0x12')](_0x1dd6cb));_0xcf924f(_0x1dd6cb);})[_0x57d2('0x21')](function(_0x26e052){logger[_0x57d2('0x13')]('GetChatQueue',_0x26e052[_0x57d2('0x15')],_0x5b1b9d);_0x55191e(_0x1cbe4a[_0x57d2('0x13')](0x1f4,_0x26e052[_0x57d2('0x15')]));});});};exports[_0x57d2('0x22')]=function(_0xb3051c){var _0x40f3f2=this;return new Promise(function(_0x3cbc4b,_0x36c0d7){return db[_0x57d2('0x23')]['find']({'raw':_0xb3051c[_0x57d2('0x19')]?_0xb3051c[_0x57d2('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xb3051c[_0x57d2('0x19')]?_0xb3051c[_0x57d2('0x19')]['where']||null:null,'attributes':_0xb3051c[_0x57d2('0x19')]?_0xb3051c[_0x57d2('0x19')][_0x57d2('0x1c')]||null:null,'include':_0xb3051c[_0x57d2('0x19')]?_0xb3051c[_0x57d2('0x19')]['include']?_['map'](_0xb3051c['options']['include'],function(_0x371939){return{'model':db[_0x371939[_0x57d2('0x20')]],'as':_0x371939['as'],'attributes':_0x371939[_0x57d2('0x1c')],'include':_0x371939[_0x57d2('0x1e')]?_[_0x57d2('0x1f')](_0x371939['include'],function(_0x375a83){return{'model':db[_0x375a83['model']],'as':_0x375a83['as'],'attributes':_0x375a83[_0x57d2('0x1c')],'include':_0x375a83[_0x57d2('0x1e')]?_[_0x57d2('0x1f')](_0x375a83['include'],function(_0x38a223){return{'model':db[_0x38a223[_0x57d2('0x20')]],'as':_0x38a223['as'],'attributes':_0x38a223['attributes']};}):[]};}):[]};}):[]:[]})[_0x57d2('0xc')](function(_0x28c52d){logger[_0x57d2('0xd')](_0x57d2('0x22'),_0xb3051c);logger[_0x57d2('0x10')](_0x57d2('0x22'),_0xb3051c,JSON['stringify'](_0x28c52d));_0x3cbc4b(_0x28c52d);})[_0x57d2('0x21')](function(_0x53c2e0){logger[_0x57d2('0x13')](_0x57d2('0x22'),_0x53c2e0[_0x57d2('0x15')],_0xb3051c);_0x36c0d7(_0x40f3f2[_0x57d2('0x13')](0x1f4,_0x53c2e0[_0x57d2('0x15')]));});});}; \ No newline at end of file +var _0x3495=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','localhost','redis','./chatQueue.socket','register','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetChatQueue','options','raw','where','attributes','limit','map','include','model','then','catch','ShowChatQueue','find','lodash','util'];(function(_0x3d9aa9,_0x3c8c6b){var _0x329086=function(_0x283253){while(--_0x283253){_0x3d9aa9['push'](_0x3d9aa9['shift']());}};_0x329086(++_0x3c8c6b);}(_0x3495,0x1de));var _0x5349=function(_0x3274d5,_0x1af0b3){_0x3274d5=_0x3274d5-0x0;var _0x4bf753=_0x3495[_0x3274d5];return _0x4bf753;};'use strict';var _=require(_0x5349('0x0'));var util=require(_0x5349('0x1'));var moment=require(_0x5349('0x2'));var BPromise=require(_0x5349('0x3'));var rs=require(_0x5349('0x4'));var fs=require('fs');var Redis=require(_0x5349('0x5'));var db=require(_0x5349('0x6'))['db'];var utils=require(_0x5349('0x7'));var logger=require(_0x5349('0x8'))('rpc');var config=require(_0x5349('0x9'));var jayson=require(_0x5349('0xa'));var client=jayson['client'][_0x5349('0xb')]({'port':0x232a});config['redis']=_[_0x5349('0xc')](config['redis'],{'host':_0x5349('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5349('0xe')]));require(_0x5349('0xf'))[_0x5349('0x10')](socket);function respondWithRpcPromise(_0x23a1c7,_0x21bf91,_0x3a416e){return new BPromise(function(_0x35d425,_0x4bf160){return client[_0x5349('0x11')](_0x23a1c7,_0x3a416e)['then'](function(_0x2cbd83){logger[_0x5349('0x12')](_0x5349('0x13'),_0x21bf91,_0x5349('0x14'));logger[_0x5349('0x15')](_0x5349('0x16'),_0x21bf91,_0x5349('0x14'),JSON[_0x5349('0x17')](_0x2cbd83));if(_0x2cbd83[_0x5349('0x18')]){if(_0x2cbd83[_0x5349('0x18')]['code']===0x1f4){logger[_0x5349('0x18')](_0x5349('0x13'),_0x21bf91,_0x2cbd83['error'][_0x5349('0x19')]);return _0x4bf160(_0x2cbd83[_0x5349('0x18')][_0x5349('0x19')]);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x21bf91,_0x2cbd83['error'][_0x5349('0x19')]);return _0x35d425(_0x2cbd83['error'][_0x5349('0x19')]);}else{logger['info'](_0x5349('0x13'),_0x21bf91,_0x5349('0x14'));_0x35d425(_0x2cbd83[_0x5349('0x1a')][_0x5349('0x19')]);}})['catch'](function(_0x22d1ca){logger[_0x5349('0x18')](_0x5349('0x13'),_0x21bf91,_0x22d1ca);_0x4bf160(_0x22d1ca);});});}exports[_0x5349('0x1b')]=function(_0x4be827){var _0xeaab5a=this;return new Promise(function(_0x3594a4,_0x4f2cb6){return db['ChatQueue']['findAll']({'raw':_0x4be827[_0x5349('0x1c')]?_0x4be827['options'][_0x5349('0x1d')]===undefined?!![]:![]:!![],'where':_0x4be827[_0x5349('0x1c')]?_0x4be827[_0x5349('0x1c')][_0x5349('0x1e')]||null:null,'attributes':_0x4be827[_0x5349('0x1c')]?_0x4be827[_0x5349('0x1c')][_0x5349('0x1f')]||null:null,'limit':_0x4be827[_0x5349('0x1c')]?_0x4be827[_0x5349('0x1c')][_0x5349('0x20')]||null:null,'include':_0x4be827[_0x5349('0x1c')]?_0x4be827[_0x5349('0x1c')]['include']?_[_0x5349('0x21')](_0x4be827[_0x5349('0x1c')][_0x5349('0x22')],function(_0x49435a){return{'model':db[_0x49435a[_0x5349('0x23')]],'as':_0x49435a['as'],'attributes':_0x49435a['attributes'],'include':_0x49435a[_0x5349('0x22')]?_[_0x5349('0x21')](_0x49435a[_0x5349('0x22')],function(_0x49153e){return{'model':db[_0x49153e[_0x5349('0x23')]],'as':_0x49153e['as'],'attributes':_0x49153e[_0x5349('0x1f')],'include':_0x49153e[_0x5349('0x22')]?_[_0x5349('0x21')](_0x49153e[_0x5349('0x22')],function(_0x16edcb){return{'model':db[_0x16edcb[_0x5349('0x23')]],'as':_0x16edcb['as'],'attributes':_0x16edcb[_0x5349('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5349('0x24')](function(_0x5b5d6c){logger[_0x5349('0x12')](_0x5349('0x1b'),_0x4be827);logger['debug'](_0x5349('0x1b'),_0x4be827,JSON['stringify'](_0x5b5d6c));_0x3594a4(_0x5b5d6c);})[_0x5349('0x25')](function(_0x262f62){logger[_0x5349('0x18')](_0x5349('0x1b'),_0x262f62[_0x5349('0x19')],_0x4be827);_0x4f2cb6(_0xeaab5a[_0x5349('0x18')](0x1f4,_0x262f62['message']));});});};exports[_0x5349('0x26')]=function(_0x3162c8){var _0xb0bc68=this;return new Promise(function(_0x2c24f4,_0x538814){return db['ChatQueue'][_0x5349('0x27')]({'raw':_0x3162c8[_0x5349('0x1c')]?_0x3162c8[_0x5349('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x3162c8[_0x5349('0x1c')]?_0x3162c8['options'][_0x5349('0x1e')]||null:null,'attributes':_0x3162c8[_0x5349('0x1c')]?_0x3162c8[_0x5349('0x1c')][_0x5349('0x1f')]||null:null,'include':_0x3162c8[_0x5349('0x1c')]?_0x3162c8[_0x5349('0x1c')]['include']?_['map'](_0x3162c8[_0x5349('0x1c')][_0x5349('0x22')],function(_0x1be201){return{'model':db[_0x1be201[_0x5349('0x23')]],'as':_0x1be201['as'],'attributes':_0x1be201[_0x5349('0x1f')],'include':_0x1be201[_0x5349('0x22')]?_[_0x5349('0x21')](_0x1be201['include'],function(_0x544557){return{'model':db[_0x544557[_0x5349('0x23')]],'as':_0x544557['as'],'attributes':_0x544557['attributes'],'include':_0x544557['include']?_[_0x5349('0x21')](_0x544557['include'],function(_0x18f881){return{'model':db[_0x18f881[_0x5349('0x23')]],'as':_0x18f881['as'],'attributes':_0x18f881[_0x5349('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd2376d){logger['info'](_0x5349('0x26'),_0x3162c8);logger[_0x5349('0x15')](_0x5349('0x26'),_0x3162c8,JSON['stringify'](_0xd2376d));_0x2c24f4(_0xd2376d);})['catch'](function(_0x5e5799){logger[_0x5349('0x18')](_0x5349('0x26'),_0x5e5799[_0x5349('0x19')],_0x3162c8);_0x538814(_0xb0bc68[_0x5349('0x18')](0x1f4,_0x5e5799[_0x5349('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index e141664..2a97bf3 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 _0x4c6d=['emit','removeListener','register','length','chatQueue:','./chatQueue.events','save','remove','update'];(function(_0xfca472,_0x1325e7){var _0x24f1b3=function(_0x3f6d2a){while(--_0x3f6d2a){_0xfca472['push'](_0xfca472['shift']());}};_0x24f1b3(++_0x1325e7);}(_0x4c6d,0x1d0));var _0xd4c6=function(_0xdea5b0,_0x28830f){_0xdea5b0=_0xdea5b0-0x0;var _0x5d10ac=_0x4c6d[_0xdea5b0];return _0x5d10ac;};'use strict';var ChatQueueEvents=require(_0xd4c6('0x0'));var events=[_0xd4c6('0x1'),_0xd4c6('0x2'),_0xd4c6('0x3')];function createListener(_0x350cc0,_0x5448bc){return function(_0x209f99){_0x5448bc[_0xd4c6('0x4')](_0x350cc0,_0x209f99);};}function removeListener(_0x306766,_0x4b2d75){return function(){ChatQueueEvents[_0xd4c6('0x5')](_0x306766,_0x4b2d75);};}exports[_0xd4c6('0x6')]=function(_0x56279c){for(var _0x182671=0x0,_0x316314=events[_0xd4c6('0x7')];_0x182671<_0x316314;_0x182671++){var _0x5d4fce=events[_0x182671];var _0x440ee3=createListener(_0xd4c6('0x8')+_0x5d4fce,_0x56279c);ChatQueueEvents['on'](_0x5d4fce,_0x440ee3);}}; \ No newline at end of file +var _0x54ef=['remove','emit','removeListener','length','./chatQueue.events','save'];(function(_0x357a5d,_0x2409c1){var _0x2e4660=function(_0x5e4168){while(--_0x5e4168){_0x357a5d['push'](_0x357a5d['shift']());}};_0x2e4660(++_0x2409c1);}(_0x54ef,0x112));var _0xf54e=function(_0xd7ef10,_0x1510ab){_0xd7ef10=_0xd7ef10-0x0;var _0x1dc4b3=_0x54ef[_0xd7ef10];return _0x1dc4b3;};'use strict';var ChatQueueEvents=require(_0xf54e('0x0'));var events=[_0xf54e('0x1'),_0xf54e('0x2'),'update'];function createListener(_0xd936f7,_0x18b7d6){return function(_0x18b1cf){_0x18b7d6[_0xf54e('0x3')](_0xd936f7,_0x18b1cf);};}function removeListener(_0x8b6bb6,_0x431e36){return function(){ChatQueueEvents[_0xf54e('0x4')](_0x8b6bb6,_0x431e36);};}exports['register']=function(_0x55e611){for(var _0x18e84e=0x0,_0x99cf9=events[_0xf54e('0x5')];_0x18e84e<_0x99cf9;_0x18e84e++){var _0x561870=events[_0x18e84e];var _0x27e69b=createListener('chatQueue:'+_0x561870,_0x55e611);ChatQueueEvents['on'](_0x561870,_0x27e69b);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index afe8152..ab08709 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x2163f0,_0x4540ee){var _0x5a3a5f=function(_0x4f7b66){while(--_0x4f7b66){_0x2163f0['push'](_0x2163f0['shift']());}};_0x5a3a5f(++_0x4540ee);}(_0x814b,0x1a2));var _0xb814=function(_0x59ae8f,_0x148344){_0x59ae8f=_0x59ae8f-0x0;var _0x3900b5=_0x814b[_0x59ae8f];return _0x3900b5;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0x16')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0x16')](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x18')]);router[_0xb814('0x16')](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x19')]);router[_0xb814('0x1a')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller['destroy']);router[_0xb814('0x1c')]('/:id/teams',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xb814('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4684a9,_0x187994){var _0x470fb1=function(_0x32e2bb){while(--_0x32e2bb){_0x4684a9['push'](_0x4684a9['shift']());}};_0x470fb1(++_0x187994);}(_0x008c,0x188));var _0xc008=function(_0x3cbe3a,_0x78bfce){_0x3cbe3a=_0x3cbe3a-0x0;var _0x24ffc1=_0x008c[_0x3cbe3a];return _0x24ffc1;};'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')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);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('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index fdb7174..b8b7c5e 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 _0x771d=['exports','STRING','DATE','moment','sequelize'];(function(_0x33a7f4,_0x4d7bf9){var _0x36b9f4=function(_0x1e2d50){while(--_0x1e2d50){_0x33a7f4['push'](_0x33a7f4['shift']());}};_0x36b9f4(++_0x4d7bf9);}(_0x771d,0xd5));var _0xd771=function(_0x156e66,_0x48c90f){_0x156e66=_0x156e66-0x0;var _0x102fa0=_0x771d[_0x156e66];return _0x102fa0;};'use strict';var moment=require(_0xd771('0x0'));var Sequelize=require(_0xd771('0x1'));module[_0xd771('0x2')]={'uniqueid':{'type':Sequelize[_0xd771('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xd771('0x3')]},'joinAt':{'type':Sequelize[_0xd771('0x4')]},'leaveAt':{'type':Sequelize[_0xd771('0x4')]},'acceptAt':{'type':Sequelize[_0xd771('0x4')]},'exitAt':{'type':Sequelize[_0xd771('0x4')]},'reason':{'type':Sequelize[_0xd771('0x3')]}}; \ No newline at end of file +var _0x85a7=['STRING','DATE','moment','sequelize','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x85a7,0xa7));var _0x785a=function(_0x33438e,_0xb2ff6a){_0x33438e=_0x33438e-0x0;var _0x529f1e=_0x85a7[_0x33438e];return _0x529f1e;};'use strict';var moment=require(_0x785a('0x0'));var Sequelize=require(_0x785a('0x1'));module[_0x785a('0x2')]={'uniqueid':{'type':Sequelize[_0x785a('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x785a('0x4')]},'leaveAt':{'type':Sequelize[_0x785a('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x785a('0x4')]},'reason':{'type':Sequelize[_0x785a('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index f71c1e6..ed87547 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 _0x5353=['update','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','then','error','stack','name','send','index','map','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','type','VIRTUAL','filter','includeAll','ChatQueueReport','findAll','rows','catch','show','params','include','create','body'];(function(_0x27d958,_0x29ef87){var _0x53e63e=function(_0x4130ec){while(--_0x4130ec){_0x27d958['push'](_0x27d958['shift']());}};_0x53e63e(++_0x29ef87);}(_0x5353,0x12f));var _0x3535=function(_0x3e43af,_0x20502e){_0x3e43af=_0x3e43af-0x0;var _0x2ac603=_0x5353[_0x3e43af];return _0x2ac603;};'use strict';var emlformat=require(_0x3535('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3535('0x1'));var jsonpatch=require(_0x3535('0x2'));var rp=require(_0x3535('0x3'));var moment=require(_0x3535('0x4'));var BPromise=require(_0x3535('0x5'));var Mustache=require(_0x3535('0x6'));var util=require(_0x3535('0x7'));var path=require(_0x3535('0x8'));var sox=require(_0x3535('0x9'));var csv=require(_0x3535('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3535('0xb'));var _=require('lodash');var squel=require(_0x3535('0xc'));var crypto=require(_0x3535('0xd'));var jsforce=require(_0x3535('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3535('0xa'));var querystring=require(_0x3535('0xf'));var Papa=require(_0x3535('0x10'));var Redis=require(_0x3535('0x11'));var authService=require(_0x3535('0x12'));var qs=require(_0x3535('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3535('0x14'));var logger=require(_0x3535('0x15'))('api');var utils=require(_0x3535('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3535('0x17'))['db'];function respondWithStatusCode(_0xff9aa8,_0xe7c052){_0xe7c052=_0xe7c052||0xcc;return function(_0x46b5c1){if(_0x46b5c1){return _0xff9aa8[_0x3535('0x18')](_0xe7c052);}return _0xff9aa8[_0x3535('0x19')](_0xe7c052)[_0x3535('0x1a')]();};}function respondWithResult(_0x5115bd,_0x2f4e64){_0x2f4e64=_0x2f4e64||0xc8;return function(_0x501016){if(_0x501016){return _0x5115bd[_0x3535('0x19')](_0x2f4e64)[_0x3535('0x1b')](_0x501016);}};}function respondWithFilteredResult(_0xf87404,_0x4c704f){return function(_0x1f18da){if(_0x1f18da){var _0x4b7c81=typeof _0x4c704f[_0x3535('0x1c')]==='undefined'&&typeof _0x4c704f['limit']===_0x3535('0x1d');var _0x222937=_0x1f18da[_0x3535('0x1e')];var _0x298235=_0x4b7c81?0x0:_0x4c704f[_0x3535('0x1c')];var _0x2a1705=_0x4b7c81?_0x1f18da[_0x3535('0x1e')]:_0x4c704f[_0x3535('0x1c')]+_0x4c704f[_0x3535('0x1f')];var _0x1fca4f;if(_0x2a1705>=_0x222937){_0x2a1705=_0x222937;_0x1fca4f=0xc8;}else{_0x1fca4f=0xce;}_0xf87404[_0x3535('0x19')](_0x1fca4f);return _0xf87404[_0x3535('0x20')]('Content-Range',_0x298235+'-'+_0x2a1705+'/'+_0x222937)['json'](_0x1f18da);}return null;};}function patchUpdates(_0xfea414){return function(_0x4e76c5){try{jsonpatch['apply'](_0x4e76c5,_0xfea414,!![]);}catch(_0x23f5b6){return BPromise[_0x3535('0x21')](_0x23f5b6);}return _0x4e76c5[_0x3535('0x22')]();};}function saveUpdates(_0x56db66,_0x52f0e3){return function(_0x3d73d2){if(_0x3d73d2){return _0x3d73d2['update'](_0x56db66)[_0x3535('0x23')](function(_0x542372){return _0x542372;});}return null;};}function removeEntity(_0x44fc44,_0x4d372e){return function(_0x450250){if(_0x450250){return _0x450250['destroy']()['then'](function(){_0x44fc44[_0x3535('0x19')](0xcc)[_0x3535('0x1a')]();});}};}function handleEntityNotFound(_0x5a25d1,_0x14e803){return function(_0x213f35){if(!_0x213f35){_0x5a25d1[_0x3535('0x18')](0x194);}return _0x213f35;};}function handleError(_0xefa28c,_0x51ba08){_0x51ba08=_0x51ba08||0x1f4;return function(_0x2bbe00){logger[_0x3535('0x24')](_0x2bbe00[_0x3535('0x25')]);if(_0x2bbe00[_0x3535('0x26')]){delete _0x2bbe00[_0x3535('0x26')];}_0xefa28c[_0x3535('0x19')](_0x51ba08)[_0x3535('0x27')](_0x2bbe00);};}exports[_0x3535('0x28')]=function(_0x4c993a,_0x167e64){var _0x17e2a0={},_0x4cf180={},_0x2594d7={'count':0x0,'rows':[]};var _0x2a84e0=_[_0x3535('0x29')](db['ChatQueueReport']['rawAttributes'],function(_0x3e8a1e){return{'name':_0x3e8a1e[_0x3535('0x2a')],'type':_0x3e8a1e['type'][_0x3535('0x2b')]};});_0x4cf180[_0x3535('0x2c')]=_[_0x3535('0x29')](_0x2a84e0,_0x3535('0x26'));_0x4cf180['query']=_[_0x3535('0x2d')](_0x4c993a[_0x3535('0x2e')]);_0x4cf180['filters']=_[_0x3535('0x2f')](_0x4cf180[_0x3535('0x2c')],_0x4cf180[_0x3535('0x2e')]);_0x17e2a0[_0x3535('0x30')]=_[_0x3535('0x2f')](_0x4cf180[_0x3535('0x2c')],qs[_0x3535('0x31')](_0x4c993a['query']['fields']));_0x17e2a0[_0x3535('0x30')]=_0x17e2a0[_0x3535('0x30')][_0x3535('0x32')]?_0x17e2a0[_0x3535('0x30')]:_0x4cf180[_0x3535('0x2c')];if(!_0x4c993a[_0x3535('0x2e')][_0x3535('0x33')](_0x3535('0x34'))){_0x17e2a0['limit']=qs[_0x3535('0x1f')](_0x4c993a[_0x3535('0x2e')][_0x3535('0x1f')]);_0x17e2a0[_0x3535('0x1c')]=qs[_0x3535('0x1c')](_0x4c993a[_0x3535('0x2e')]['offset']);}_0x17e2a0[_0x3535('0x35')]=qs['sort'](_0x4c993a[_0x3535('0x2e')][_0x3535('0x36')]);_0x17e2a0['where']=qs[_0x3535('0x37')](_[_0x3535('0x38')](_0x4c993a[_0x3535('0x2e')],_0x4cf180[_0x3535('0x37')]),_0x2a84e0);if(_0x4c993a['query']['filter']){_0x17e2a0[_0x3535('0x39')]=_[_0x3535('0x3a')](_0x17e2a0[_0x3535('0x39')],{'$or':_[_0x3535('0x29')](_0x2a84e0,function(_0x32d907){if(_0x32d907[_0x3535('0x3b')]!==_0x3535('0x3c')){var _0x396fd9={};_0x396fd9[_0x32d907[_0x3535('0x26')]]={'$like':'%'+_0x4c993a[_0x3535('0x2e')][_0x3535('0x3d')]+'%'};return _0x396fd9;}})});}_0x17e2a0=_[_0x3535('0x3a')]({},_0x17e2a0,_0x4c993a['options']);var _0x46aabb={'where':_0x17e2a0[_0x3535('0x39')]};return db['ChatQueueReport'][_0x3535('0x1e')](_0x46aabb)[_0x3535('0x23')](function(_0x5c4c2f){_0x2594d7[_0x3535('0x1e')]=_0x5c4c2f;if(_0x4c993a[_0x3535('0x2e')][_0x3535('0x3e')]){_0x17e2a0['include']=[{'all':!![]}];}return db[_0x3535('0x3f')][_0x3535('0x40')](_0x17e2a0);})[_0x3535('0x23')](function(_0x5258cc){_0x2594d7[_0x3535('0x41')]=_0x5258cc;return _0x2594d7;})[_0x3535('0x23')](respondWithFilteredResult(_0x167e64,_0x17e2a0))[_0x3535('0x42')](handleError(_0x167e64,null));};exports[_0x3535('0x43')]=function(_0x6c896c,_0x139ed6){var _0x347777={'raw':!![],'where':{'id':_0x6c896c[_0x3535('0x44')]['id']}},_0x2d12cc={};_0x2d12cc[_0x3535('0x2c')]=_[_0x3535('0x2d')](db[_0x3535('0x3f')]['rawAttributes']);_0x2d12cc[_0x3535('0x2e')]=_['keys'](_0x6c896c[_0x3535('0x2e')]);_0x2d12cc['filters']=_[_0x3535('0x2f')](_0x2d12cc[_0x3535('0x2c')],_0x2d12cc[_0x3535('0x2e')]);_0x347777[_0x3535('0x30')]=_[_0x3535('0x2f')](_0x2d12cc['model'],qs[_0x3535('0x31')](_0x6c896c[_0x3535('0x2e')]['fields']));_0x347777[_0x3535('0x30')]=_0x347777[_0x3535('0x30')][_0x3535('0x32')]?_0x347777[_0x3535('0x30')]:_0x2d12cc[_0x3535('0x2c')];if(_0x6c896c[_0x3535('0x2e')]['includeAll']){_0x347777[_0x3535('0x45')]=[{'all':!![]}];}_0x347777=_[_0x3535('0x3a')]({},_0x347777,_0x6c896c['options']);return db[_0x3535('0x3f')]['find'](_0x347777)[_0x3535('0x23')](handleEntityNotFound(_0x139ed6,null))[_0x3535('0x23')](respondWithResult(_0x139ed6,null))[_0x3535('0x42')](handleError(_0x139ed6,null));};exports[_0x3535('0x46')]=function(_0x2d8769,_0x45eb1b){return db[_0x3535('0x3f')][_0x3535('0x46')](_0x2d8769[_0x3535('0x47')],{})[_0x3535('0x23')](respondWithResult(_0x45eb1b,0xc9))[_0x3535('0x42')](handleError(_0x45eb1b,null));};exports[_0x3535('0x48')]=function(_0x5c881d,_0x2bd81b){if(_0x5c881d[_0x3535('0x47')]['id']){delete _0x5c881d[_0x3535('0x47')]['id'];}return db['ChatQueueReport']['find']({'where':{'id':_0x5c881d[_0x3535('0x44')]['id']}})[_0x3535('0x23')](handleEntityNotFound(_0x2bd81b,null))[_0x3535('0x23')](saveUpdates(_0x5c881d[_0x3535('0x47')],null))[_0x3535('0x23')](respondWithResult(_0x2bd81b,null))[_0x3535('0x42')](handleError(_0x2bd81b,null));};exports['destroy']=function(_0x1f17ed,_0x399f30){return db[_0x3535('0x3f')][_0x3535('0x49')]({'where':{'id':_0x1f17ed['params']['id']}})['then'](handleEntityNotFound(_0x399f30,null))['then'](removeEntity(_0x399f30,null))[_0x3535('0x42')](handleError(_0x399f30,null));};exports[_0x3535('0x4a')]=function(_0x10d4e6,_0x1c17f4){return db[_0x3535('0x3f')][_0x3535('0x4a')]()[_0x3535('0x23')](respondWithResult(_0x1c17f4,null))[_0x3535('0x42')](handleError(_0x1c17f4,null));}; \ No newline at end of file +var _0xf966=['findAll','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','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','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','Content-Range','apply','reject','update','destroy','then','error','stack','name','index','map','ChatQueueReport','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','offset','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','include'];(function(_0x2e624a,_0x1b6217){var _0x38ce2d=function(_0x35d339){while(--_0x35d339){_0x2e624a['push'](_0x2e624a['shift']());}};_0x38ce2d(++_0x1b6217);}(_0xf966,0x184));var _0x6f96=function(_0x1fabf2,_0x4ac131){_0x1fabf2=_0x1fabf2-0x0;var _0x93fd53=_0xf966[_0x1fabf2];return _0x93fd53;};'use strict';var emlformat=require(_0x6f96('0x0'));var rimraf=require(_0x6f96('0x1'));var zipdir=require(_0x6f96('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6f96('0x3'));var moment=require(_0x6f96('0x4'));var BPromise=require(_0x6f96('0x5'));var Mustache=require('mustache');var util=require(_0x6f96('0x6'));var path=require(_0x6f96('0x7'));var sox=require(_0x6f96('0x8'));var csv=require('to-csv');var ejs=require(_0x6f96('0x9'));var fs=require('fs');var fs_extra=require(_0x6f96('0xa'));var _=require(_0x6f96('0xb'));var squel=require(_0x6f96('0xc'));var crypto=require(_0x6f96('0xd'));var jsforce=require(_0x6f96('0xe'));var deskjs=require(_0x6f96('0xf'));var toCsv=require(_0x6f96('0x10'));var querystring=require(_0x6f96('0x11'));var Papa=require(_0x6f96('0x12'));var Redis=require(_0x6f96('0x13'));var authService=require(_0x6f96('0x14'));var qs=require(_0x6f96('0x15'));var as=require(_0x6f96('0x16'));var hardwareService=require(_0x6f96('0x17'));var logger=require('../../config/logger')(_0x6f96('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6f96('0x19'));var db=require(_0x6f96('0x1a'))['db'];function respondWithStatusCode(_0x58cc34,_0x30f125){_0x30f125=_0x30f125||0xcc;return function(_0x126b6a){if(_0x126b6a){return _0x58cc34[_0x6f96('0x1b')](_0x30f125);}return _0x58cc34[_0x6f96('0x1c')](_0x30f125)[_0x6f96('0x1d')]();};}function respondWithResult(_0x3f8950,_0x169c55){_0x169c55=_0x169c55||0xc8;return function(_0x1e2467){if(_0x1e2467){return _0x3f8950['status'](_0x169c55)[_0x6f96('0x1e')](_0x1e2467);}};}function respondWithFilteredResult(_0xb1ff4,_0x5a5602){return function(_0x203054){if(_0x203054){var _0x2cd321=typeof _0x5a5602['offset']==='undefined'&&typeof _0x5a5602[_0x6f96('0x1f')]===_0x6f96('0x20');var _0x130de4=_0x203054['count'];var _0x421e59=_0x2cd321?0x0:_0x5a5602['offset'];var _0x19cd18=_0x2cd321?_0x203054[_0x6f96('0x21')]:_0x5a5602['offset']+_0x5a5602['limit'];var _0x75c2db;if(_0x19cd18>=_0x130de4){_0x19cd18=_0x130de4;_0x75c2db=0xc8;}else{_0x75c2db=0xce;}_0xb1ff4[_0x6f96('0x1c')](_0x75c2db);return _0xb1ff4['set'](_0x6f96('0x22'),_0x421e59+'-'+_0x19cd18+'/'+_0x130de4)['json'](_0x203054);}return null;};}function patchUpdates(_0x3e3f51){return function(_0x16d62a){try{jsonpatch[_0x6f96('0x23')](_0x16d62a,_0x3e3f51,!![]);}catch(_0x2515ca){return BPromise[_0x6f96('0x24')](_0x2515ca);}return _0x16d62a['save']();};}function saveUpdates(_0x1d8dc7,_0x5ec160){return function(_0x46d79b){if(_0x46d79b){return _0x46d79b[_0x6f96('0x25')](_0x1d8dc7)['then'](function(_0xa12c3b){return _0xa12c3b;});}return null;};}function removeEntity(_0x5482c8,_0x280a55){return function(_0x45c1c2){if(_0x45c1c2){return _0x45c1c2[_0x6f96('0x26')]()[_0x6f96('0x27')](function(){_0x5482c8[_0x6f96('0x1c')](0xcc)[_0x6f96('0x1d')]();});}};}function handleEntityNotFound(_0x475ee9,_0xc91322){return function(_0x3a5f09){if(!_0x3a5f09){_0x475ee9['sendStatus'](0x194);}return _0x3a5f09;};}function handleError(_0x3329a2,_0xe3cf23){_0xe3cf23=_0xe3cf23||0x1f4;return function(_0x38922d){logger[_0x6f96('0x28')](_0x38922d[_0x6f96('0x29')]);if(_0x38922d[_0x6f96('0x2a')]){delete _0x38922d['name'];}_0x3329a2['status'](_0xe3cf23)['send'](_0x38922d);};}exports[_0x6f96('0x2b')]=function(_0x105796,_0x37b404){var _0x4821a8={},_0x19941b={},_0x29c45e={'count':0x0,'rows':[]};var _0x36f0ae=_[_0x6f96('0x2c')](db[_0x6f96('0x2d')]['rawAttributes'],function(_0x38dbba){return{'name':_0x38dbba[_0x6f96('0x2e')],'type':_0x38dbba['type'][_0x6f96('0x2f')]};});_0x19941b[_0x6f96('0x30')]=_[_0x6f96('0x2c')](_0x36f0ae,_0x6f96('0x2a'));_0x19941b[_0x6f96('0x31')]=_[_0x6f96('0x32')](_0x105796[_0x6f96('0x31')]);_0x19941b[_0x6f96('0x33')]=_['intersection'](_0x19941b[_0x6f96('0x30')],_0x19941b[_0x6f96('0x31')]);_0x4821a8[_0x6f96('0x34')]=_[_0x6f96('0x35')](_0x19941b[_0x6f96('0x30')],qs[_0x6f96('0x36')](_0x105796['query'][_0x6f96('0x36')]));_0x4821a8[_0x6f96('0x34')]=_0x4821a8[_0x6f96('0x34')][_0x6f96('0x37')]?_0x4821a8[_0x6f96('0x34')]:_0x19941b[_0x6f96('0x30')];if(!_0x105796['query'][_0x6f96('0x38')]('nolimit')){_0x4821a8[_0x6f96('0x1f')]=qs[_0x6f96('0x1f')](_0x105796['query'][_0x6f96('0x1f')]);_0x4821a8['offset']=qs[_0x6f96('0x39')](_0x105796[_0x6f96('0x31')][_0x6f96('0x39')]);}_0x4821a8[_0x6f96('0x3a')]=qs[_0x6f96('0x3b')](_0x105796[_0x6f96('0x31')]['sort']);_0x4821a8['where']=qs[_0x6f96('0x33')](_['pick'](_0x105796[_0x6f96('0x31')],_0x19941b['filters']),_0x36f0ae);if(_0x105796[_0x6f96('0x31')][_0x6f96('0x3c')]){_0x4821a8[_0x6f96('0x3d')]=_[_0x6f96('0x3e')](_0x4821a8[_0x6f96('0x3d')],{'$or':_[_0x6f96('0x2c')](_0x36f0ae,function(_0x57dd3f){if(_0x57dd3f[_0x6f96('0x3f')]!==_0x6f96('0x40')){var _0x9be8f5={};_0x9be8f5[_0x57dd3f[_0x6f96('0x2a')]]={'$like':'%'+_0x105796['query'][_0x6f96('0x3c')]+'%'};return _0x9be8f5;}})});}_0x4821a8=_[_0x6f96('0x3e')]({},_0x4821a8,_0x105796[_0x6f96('0x41')]);var _0x2fa5a1={'where':_0x4821a8[_0x6f96('0x3d')]};return db[_0x6f96('0x2d')][_0x6f96('0x21')](_0x2fa5a1)[_0x6f96('0x27')](function(_0x3cb013){_0x29c45e[_0x6f96('0x21')]=_0x3cb013;if(_0x105796[_0x6f96('0x31')][_0x6f96('0x42')]){_0x4821a8[_0x6f96('0x43')]=[{'all':!![]}];}return db[_0x6f96('0x2d')][_0x6f96('0x44')](_0x4821a8);})['then'](function(_0x140475){_0x29c45e['rows']=_0x140475;return _0x29c45e;})['then'](respondWithFilteredResult(_0x37b404,_0x4821a8))[_0x6f96('0x45')](handleError(_0x37b404,null));};exports[_0x6f96('0x46')]=function(_0xa2157d,_0x1d6023){var _0xa42324={'raw':!![],'where':{'id':_0xa2157d[_0x6f96('0x47')]['id']}},_0x4e8488={};_0x4e8488[_0x6f96('0x30')]=_[_0x6f96('0x32')](db[_0x6f96('0x2d')]['rawAttributes']);_0x4e8488[_0x6f96('0x31')]=_[_0x6f96('0x32')](_0xa2157d[_0x6f96('0x31')]);_0x4e8488[_0x6f96('0x33')]=_['intersection'](_0x4e8488[_0x6f96('0x30')],_0x4e8488[_0x6f96('0x31')]);_0xa42324[_0x6f96('0x34')]=_[_0x6f96('0x35')](_0x4e8488[_0x6f96('0x30')],qs[_0x6f96('0x36')](_0xa2157d[_0x6f96('0x31')][_0x6f96('0x36')]));_0xa42324['attributes']=_0xa42324['attributes'][_0x6f96('0x37')]?_0xa42324[_0x6f96('0x34')]:_0x4e8488[_0x6f96('0x30')];if(_0xa2157d[_0x6f96('0x31')][_0x6f96('0x42')]){_0xa42324['include']=[{'all':!![]}];}_0xa42324=_[_0x6f96('0x3e')]({},_0xa42324,_0xa2157d[_0x6f96('0x41')]);return db[_0x6f96('0x2d')][_0x6f96('0x48')](_0xa42324)[_0x6f96('0x27')](handleEntityNotFound(_0x1d6023,null))[_0x6f96('0x27')](respondWithResult(_0x1d6023,null))[_0x6f96('0x45')](handleError(_0x1d6023,null));};exports[_0x6f96('0x49')]=function(_0x12d2f1,_0x3d6cce){return db[_0x6f96('0x2d')][_0x6f96('0x49')](_0x12d2f1[_0x6f96('0x4a')],{})[_0x6f96('0x27')](respondWithResult(_0x3d6cce,0xc9))[_0x6f96('0x45')](handleError(_0x3d6cce,null));};exports[_0x6f96('0x25')]=function(_0x9e28e0,_0x11ecd7){if(_0x9e28e0['body']['id']){delete _0x9e28e0[_0x6f96('0x4a')]['id'];}return db[_0x6f96('0x2d')]['find']({'where':{'id':_0x9e28e0[_0x6f96('0x47')]['id']}})[_0x6f96('0x27')](handleEntityNotFound(_0x11ecd7,null))[_0x6f96('0x27')](saveUpdates(_0x9e28e0['body'],null))[_0x6f96('0x27')](respondWithResult(_0x11ecd7,null))[_0x6f96('0x45')](handleError(_0x11ecd7,null));};exports['destroy']=function(_0x37558e,_0x4b3263){return db['ChatQueueReport'][_0x6f96('0x48')]({'where':{'id':_0x37558e[_0x6f96('0x47')]['id']}})[_0x6f96('0x27')](handleEntityNotFound(_0x4b3263,null))[_0x6f96('0x27')](removeEntity(_0x4b3263,null))[_0x6f96('0x45')](handleError(_0x4b3263,null));};exports[_0x6f96('0x4b')]=function(_0x5e0dd8,_0x4fc754){return db[_0x6f96('0x2d')][_0x6f96('0x4b')]()[_0x6f96('0x27')](respondWithResult(_0x4fc754,null))[_0x6f96('0x45')](handleError(_0x4fc754,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 324a740..6b50a59 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2fc4e6,_0x2b6a85){var _0x2c9889=function(_0x1f60b9){while(--_0x1f60b9){_0x2fc4e6['push'](_0x2fc4e6['shift']());}};_0x2c9889(++_0x2b6a85);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x340f8a,_0x290485){var _0x12aea9=function(_0x4fd7f7){while(--_0x4fd7f7){_0x340f8a['push'](_0x340f8a['shift']());}};_0x12aea9(++_0x290485);}(_0xb7e7,0x121));var _0x7b7e=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xb7e7[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 05e236b..33d0e65 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 _0xd94d=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','debug','update','limit','UpdateChatQueueReport','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x6173fc,_0x32aadf){var _0x965fbe=function(_0x50d5b3){while(--_0x50d5b3){_0x6173fc['push'](_0x6173fc['shift']());}};_0x965fbe(++_0x32aadf);}(_0xd94d,0x16f));var _0xdd94=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xd94d[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0xdd94('0x0'));var moment=require(_0xdd94('0x1'));var BPromise=require(_0xdd94('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdd94('0x3'));var db=require(_0xdd94('0x4'))['db'];var utils=require(_0xdd94('0x5'));var logger=require(_0xdd94('0x6'))(_0xdd94('0x7'));var config=require(_0xdd94('0x8'));var jayson=require(_0xdd94('0x9'));var client=jayson['client'][_0xdd94('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa08a87,_0x5649d2,_0x2d1991){return new BPromise(function(_0x216e61,_0x3c2358){return client[_0xdd94('0xb')](_0xa08a87,_0x2d1991)[_0xdd94('0xc')](function(_0x31654c){logger[_0xdd94('0xd')](_0xdd94('0xe'),_0x5649d2,'request\x20sent');logger['debug'](_0xdd94('0xf'),_0x5649d2,'request\x20sent',JSON[_0xdd94('0x10')](_0x31654c));if(_0x31654c[_0xdd94('0x11')]){if(_0x31654c['error']['code']===0x1f4){logger['error'](_0xdd94('0xe'),_0x5649d2,_0x31654c['error'][_0xdd94('0x12')]);return _0x3c2358(_0x31654c[_0xdd94('0x11')][_0xdd94('0x12')]);}logger[_0xdd94('0x11')](_0xdd94('0xe'),_0x5649d2,_0x31654c[_0xdd94('0x11')][_0xdd94('0x12')]);return _0x216e61(_0x31654c[_0xdd94('0x11')]['message']);}else{logger[_0xdd94('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x5649d2,_0xdd94('0x13'));_0x216e61(_0x31654c[_0xdd94('0x14')][_0xdd94('0x12')]);}})['catch'](function(_0x430b65){logger[_0xdd94('0x11')](_0xdd94('0xe'),_0x5649d2,_0x430b65);_0x3c2358(_0x430b65);});});}exports[_0xdd94('0x15')]=function(_0x321b2b){var _0x5ab4ad=this;return new Promise(function(_0x6600ba,_0x4db4c3){return db[_0xdd94('0x16')][_0xdd94('0x17')](_0x321b2b[_0xdd94('0x18')],{'raw':_0x321b2b[_0xdd94('0x19')]?_0x321b2b[_0xdd94('0x19')][_0xdd94('0x1a')]===undefined?!![]:![]:!![]})[_0xdd94('0xc')](function(_0x517c4e){logger[_0xdd94('0xd')](_0xdd94('0x15'),_0x321b2b);logger[_0xdd94('0x1b')](_0xdd94('0x15'),_0x321b2b,JSON[_0xdd94('0x10')](_0x517c4e));_0x6600ba(_0x517c4e);})['catch'](function(_0x5f4a9a){logger[_0xdd94('0x11')](_0xdd94('0x15'),_0x5f4a9a['message'],_0x321b2b);_0x4db4c3(_0x5ab4ad[_0xdd94('0x11')](0x1f4,_0x5f4a9a[_0xdd94('0x12')]));});});};exports['UpdateChatQueueReport']=function(_0x3a0f4c){var _0x37d0b1=this;return new Promise(function(_0x418e55,_0x55e9d2){return db['ChatQueueReport'][_0xdd94('0x1c')](_0x3a0f4c['body'],{'raw':_0x3a0f4c['options']?_0x3a0f4c['options'][_0xdd94('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a0f4c[_0xdd94('0x19')]?_0x3a0f4c[_0xdd94('0x19')]['where']||null:null,'attributes':_0x3a0f4c[_0xdd94('0x19')]?_0x3a0f4c[_0xdd94('0x19')]['attributes']||null:null,'limit':_0x3a0f4c[_0xdd94('0x19')]?_0x3a0f4c[_0xdd94('0x19')][_0xdd94('0x1d')]||null:null})[_0xdd94('0xc')](function(_0x4e6102){logger[_0xdd94('0xd')](_0xdd94('0x1e'),_0x3a0f4c);logger['debug'](_0xdd94('0x1e'),_0x3a0f4c,JSON[_0xdd94('0x10')](_0x4e6102));_0x418e55(_0x4e6102);})['catch'](function(_0x39d377){logger[_0xdd94('0x11')](_0xdd94('0x1e'),_0x39d377[_0xdd94('0x12')],_0x3a0f4c);_0x55e9d2(_0x37d0b1['error'](0x1f4,_0x39d377['message']));});});}; \ No newline at end of file +var _0xfb3e=['stringify','UpdateChatQueueReport','update','attributes','limit','info','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','options','raw'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0xfb3e,0x150));var _0xefb3=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xfb3e[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xefb3('0x0'));var util=require(_0xefb3('0x1'));var moment=require('moment');var BPromise=require(_0xefb3('0x2'));var rs=require(_0xefb3('0x3'));var fs=require('fs');var Redis=require(_0xefb3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xefb3('0x5'));var logger=require(_0xefb3('0x6'))(_0xefb3('0x7'));var config=require(_0xefb3('0x8'));var jayson=require(_0xefb3('0x9'));var client=jayson[_0xefb3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5032a8,_0x4977f4,_0xedcd2b){return new BPromise(function(_0x41c3af,_0x3ceff5){return client['request'](_0x5032a8,_0xedcd2b)[_0xefb3('0xb')](function(_0x1a8238){logger['info'](_0xefb3('0xc'),_0x4977f4,_0xefb3('0xd'));logger[_0xefb3('0xe')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x4977f4,_0xefb3('0xd'),JSON['stringify'](_0x1a8238));if(_0x1a8238[_0xefb3('0xf')]){if(_0x1a8238['error']['code']===0x1f4){logger[_0xefb3('0xf')](_0xefb3('0xc'),_0x4977f4,_0x1a8238['error']['message']);return _0x3ceff5(_0x1a8238['error']['message']);}logger['error'](_0xefb3('0xc'),_0x4977f4,_0x1a8238[_0xefb3('0xf')]['message']);return _0x41c3af(_0x1a8238['error'][_0xefb3('0x10')]);}else{logger['info'](_0xefb3('0xc'),_0x4977f4,_0xefb3('0xd'));_0x41c3af(_0x1a8238[_0xefb3('0x11')][_0xefb3('0x10')]);}})[_0xefb3('0x12')](function(_0x436a48){logger['error'](_0xefb3('0xc'),_0x4977f4,_0x436a48);_0x3ceff5(_0x436a48);});});}exports[_0xefb3('0x13')]=function(_0x548a2e){var _0xff46f9=this;return new Promise(function(_0x3e7d8f,_0x39a42d){return db[_0xefb3('0x14')][_0xefb3('0x15')](_0x548a2e['body'],{'raw':_0x548a2e[_0xefb3('0x16')]?_0x548a2e['options'][_0xefb3('0x17')]===undefined?!![]:![]:!![]})[_0xefb3('0xb')](function(_0x13b239){logger['info'](_0xefb3('0x13'),_0x548a2e);logger['debug']('CreateChatQueueReport',_0x548a2e,JSON[_0xefb3('0x18')](_0x13b239));_0x3e7d8f(_0x13b239);})[_0xefb3('0x12')](function(_0x25ee01){logger[_0xefb3('0xf')](_0xefb3('0x13'),_0x25ee01[_0xefb3('0x10')],_0x548a2e);_0x39a42d(_0xff46f9[_0xefb3('0xf')](0x1f4,_0x25ee01[_0xefb3('0x10')]));});});};exports[_0xefb3('0x19')]=function(_0x132cb5){var _0x406908=this;return new Promise(function(_0x3fb7ee,_0x4bfed8){return db[_0xefb3('0x14')][_0xefb3('0x1a')](_0x132cb5['body'],{'raw':_0x132cb5[_0xefb3('0x16')]?_0x132cb5[_0xefb3('0x16')][_0xefb3('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x132cb5[_0xefb3('0x16')]?_0x132cb5[_0xefb3('0x16')]['where']||null:null,'attributes':_0x132cb5[_0xefb3('0x16')]?_0x132cb5[_0xefb3('0x16')][_0xefb3('0x1b')]||null:null,'limit':_0x132cb5[_0xefb3('0x16')]?_0x132cb5['options'][_0xefb3('0x1c')]||null:null})[_0xefb3('0xb')](function(_0x515c75){logger[_0xefb3('0x1d')]('UpdateChatQueueReport',_0x132cb5);logger[_0xefb3('0xe')](_0xefb3('0x19'),_0x132cb5,JSON[_0xefb3('0x18')](_0x515c75));_0x3fb7ee(_0x515c75);})[_0xefb3('0x12')](function(_0x205a14){logger['error'](_0xefb3('0x19'),_0x205a14[_0xefb3('0x10')],_0x132cb5);_0x4bfed8(_0x406908[_0xefb3('0xf')](0x1f4,_0x205a14['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index d1438b7..f1ba12b 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 _0x5fd9=['../../components/auth/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','/describe','/:id','post','create','delete','destroy','exports','multer','util','path','Router'];(function(_0x3069a6,_0x505399){var _0x4cf0a4=function(_0x37ca7d){while(--_0x37ca7d){_0x3069a6['push'](_0x3069a6['shift']());}};_0x4cf0a4(++_0x505399);}(_0x5fd9,0x8c));var _0x95fd=function(_0x513119,_0x425e6f){_0x513119=_0x513119-0x0;var _0x587511=_0x5fd9[_0x513119];return _0x587511;};'use strict';var multer=require(_0x95fd('0x0'));var util=require(_0x95fd('0x1'));var path=require(_0x95fd('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x95fd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x95fd('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x95fd('0x5'));var controller=require(_0x95fd('0x6'));router[_0x95fd('0x7')]('/',auth[_0x95fd('0x8')](),controller['index']);router['get'](_0x95fd('0x9'),auth[_0x95fd('0x8')](),controller['describe']);router[_0x95fd('0x7')](_0x95fd('0xa'),auth[_0x95fd('0x8')](),controller['show']);router[_0x95fd('0xb')]('/',auth[_0x95fd('0x8')](),controller[_0x95fd('0xc')]);router['put'](_0x95fd('0xa'),auth[_0x95fd('0x8')](),controller['update']);router[_0x95fd('0xd')](_0x95fd('0xa'),auth[_0x95fd('0x8')](),controller[_0x95fd('0xe')]);module[_0x95fd('0xf')]=router; \ No newline at end of file +var _0x70be=['/:id','post','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x87e255,_0x55ee56){var _0x1d577f=function(_0x23c6c5){while(--_0x23c6c5){_0x87e255['push'](_0x87e255['shift']());}};_0x1d577f(++_0x55ee56);}(_0x70be,0x16f));var _0xe70b=function(_0x1bdc0a,_0x5373db){_0x1bdc0a=_0x1bdc0a-0x0;var _0x4faaac=_0x70be[_0x1bdc0a];return _0x4faaac;};'use strict';var multer=require(_0xe70b('0x0'));var util=require(_0xe70b('0x1'));var path=require(_0xe70b('0x2'));var timeout=require('connect-timeout');var express=require(_0xe70b('0x3'));var router=express[_0xe70b('0x4')]();var fs_extra=require(_0xe70b('0x5'));var auth=require(_0xe70b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe70b('0x7'));var controller=require('./chatQueueReport.controller');router[_0xe70b('0x8')]('/',auth[_0xe70b('0x9')](),controller[_0xe70b('0xa')]);router['get'](_0xe70b('0xb'),auth['isAuthenticated'](),controller[_0xe70b('0xc')]);router[_0xe70b('0x8')](_0xe70b('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xe70b('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0xe70b('0x9')](),controller[_0xe70b('0xf')]);router[_0xe70b('0x10')](_0xe70b('0xd'),auth['isAuthenticated'](),controller[_0xe70b('0x11')]);module[_0xe70b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index dc6cf01..bbb30b7 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x195456,_0x178217){var _0x13c560=function(_0x199dae){while(--_0x199dae){_0x195456['push'](_0x195456['shift']());}};_0x13c560(++_0x178217);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x483d2a,_0x4bffba){_0x483d2a=_0x483d2a-0x0;var _0x5ba5d5=_0xf3cd[_0x483d2a];return _0x5ba5d5;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x50dda0,_0x50b5e6){var _0x328394=function(_0x3b7aad){while(--_0x3b7aad){_0x50dda0['push'](_0x50dda0['shift']());}};_0x328394(++_0x50b5e6);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1aed80,_0x3ca6f6){_0x1aed80=_0x1aed80-0x0;var _0x43961e=_0xcb91[_0x1aed80];return _0x43961e;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 241d410..a0951b8 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 _0xffae=['map','ChatTransferReport','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','find','create','body','update','params','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','then','destroy','error','stack','name','index'];(function(_0x4ed327,_0x5d7d2f){var _0x65e35c=function(_0x33b145){while(--_0x33b145){_0x4ed327['push'](_0x4ed327['shift']());}};_0x65e35c(++_0x5d7d2f);}(_0xffae,0xe5));var _0xeffa=function(_0x3704ea,_0x449e14){_0x3704ea=_0x3704ea-0x0;var _0x38a4ff=_0xffae[_0x3704ea];return _0x38a4ff;};'use strict';var emlformat=require(_0xeffa('0x0'));var rimraf=require(_0xeffa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeffa('0x2'));var rp=require(_0xeffa('0x3'));var moment=require(_0xeffa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xeffa('0x5'));var util=require('util');var path=require(_0xeffa('0x6'));var sox=require(_0xeffa('0x7'));var csv=require(_0xeffa('0x8'));var ejs=require(_0xeffa('0x9'));var fs=require('fs');var fs_extra=require(_0xeffa('0xa'));var _=require('lodash');var squel=require(_0xeffa('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xeffa('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeffa('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xeffa('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeffa('0xf'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xeffa('0x10'));var licenseUtil=require(_0xeffa('0x11'));var db=require(_0xeffa('0x12'))['db'];function respondWithStatusCode(_0x3d2e44,_0x52ab48){_0x52ab48=_0x52ab48||0xcc;return function(_0xc7c1e2){if(_0xc7c1e2){return _0x3d2e44[_0xeffa('0x13')](_0x52ab48);}return _0x3d2e44[_0xeffa('0x14')](_0x52ab48)[_0xeffa('0x15')]();};}function respondWithResult(_0x37cf52,_0xc56b03){_0xc56b03=_0xc56b03||0xc8;return function(_0x5f5cda){if(_0x5f5cda){return _0x37cf52[_0xeffa('0x14')](_0xc56b03)['json'](_0x5f5cda);}};}function respondWithFilteredResult(_0x5edaa9,_0xb0b25c){return function(_0x30fa0c){if(_0x30fa0c){var _0x8358b9=typeof _0xb0b25c[_0xeffa('0x16')]===_0xeffa('0x17')&&typeof _0xb0b25c['limit']===_0xeffa('0x17');var _0x5b0639=_0x30fa0c[_0xeffa('0x18')];var _0x24ef7a=_0x8358b9?0x0:_0xb0b25c['offset'];var _0x213cca=_0x8358b9?_0x30fa0c[_0xeffa('0x18')]:_0xb0b25c[_0xeffa('0x16')]+_0xb0b25c[_0xeffa('0x19')];var _0x481b7b;if(_0x213cca>=_0x5b0639){_0x213cca=_0x5b0639;_0x481b7b=0xc8;}else{_0x481b7b=0xce;}_0x5edaa9['status'](_0x481b7b);return _0x5edaa9[_0xeffa('0x1a')](_0xeffa('0x1b'),_0x24ef7a+'-'+_0x213cca+'/'+_0x5b0639)['json'](_0x30fa0c);}return null;};}function patchUpdates(_0x2ee9d5){return function(_0x1bf6fb){try{jsonpatch[_0xeffa('0x1c')](_0x1bf6fb,_0x2ee9d5,!![]);}catch(_0x6209f0){return BPromise['reject'](_0x6209f0);}return _0x1bf6fb['save']();};}function saveUpdates(_0x3bee37,_0x53124d){return function(_0x1569be){if(_0x1569be){return _0x1569be['update'](_0x3bee37)[_0xeffa('0x1d')](function(_0x181c17){return _0x181c17;});}return null;};}function removeEntity(_0x6e810e,_0x286d72){return function(_0xc73e1f){if(_0xc73e1f){return _0xc73e1f[_0xeffa('0x1e')]()['then'](function(){_0x6e810e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x259894,_0x27b10c){return function(_0xb89200){if(!_0xb89200){_0x259894[_0xeffa('0x13')](0x194);}return _0xb89200;};}function handleError(_0x1066cf,_0x37d7f4){_0x37d7f4=_0x37d7f4||0x1f4;return function(_0x2da56e){logger[_0xeffa('0x1f')](_0x2da56e[_0xeffa('0x20')]);if(_0x2da56e['name']){delete _0x2da56e[_0xeffa('0x21')];}_0x1066cf['status'](_0x37d7f4)['send'](_0x2da56e);};}exports[_0xeffa('0x22')]=function(_0x337e53,_0x21c027){var _0x1a00c1={},_0x134f08={},_0x4f3e09={'count':0x0,'rows':[]};var _0x33845e=_[_0xeffa('0x23')](db[_0xeffa('0x24')][_0xeffa('0x25')],function(_0x1d9aa7){return{'name':_0x1d9aa7[_0xeffa('0x26')],'type':_0x1d9aa7[_0xeffa('0x27')]['key']};});_0x134f08[_0xeffa('0x28')]=_[_0xeffa('0x23')](_0x33845e,_0xeffa('0x21'));_0x134f08['query']=_[_0xeffa('0x29')](_0x337e53[_0xeffa('0x2a')]);_0x134f08[_0xeffa('0x2b')]=_[_0xeffa('0x2c')](_0x134f08[_0xeffa('0x28')],_0x134f08['query']);_0x1a00c1[_0xeffa('0x2d')]=_[_0xeffa('0x2c')](_0x134f08['model'],qs[_0xeffa('0x2e')](_0x337e53['query']['fields']));_0x1a00c1[_0xeffa('0x2d')]=_0x1a00c1[_0xeffa('0x2d')][_0xeffa('0x2f')]?_0x1a00c1[_0xeffa('0x2d')]:_0x134f08[_0xeffa('0x28')];if(!_0x337e53['query'][_0xeffa('0x30')]('nolimit')){_0x1a00c1[_0xeffa('0x19')]=qs['limit'](_0x337e53[_0xeffa('0x2a')][_0xeffa('0x19')]);_0x1a00c1[_0xeffa('0x16')]=qs[_0xeffa('0x16')](_0x337e53[_0xeffa('0x2a')][_0xeffa('0x16')]);}_0x1a00c1[_0xeffa('0x31')]=qs['sort'](_0x337e53[_0xeffa('0x2a')][_0xeffa('0x32')]);_0x1a00c1[_0xeffa('0x33')]=qs[_0xeffa('0x2b')](_[_0xeffa('0x34')](_0x337e53[_0xeffa('0x2a')],_0x134f08[_0xeffa('0x2b')]),_0x33845e);if(_0x337e53[_0xeffa('0x2a')][_0xeffa('0x35')]){_0x1a00c1['where']=_[_0xeffa('0x36')](_0x1a00c1[_0xeffa('0x33')],{'$or':_[_0xeffa('0x23')](_0x33845e,function(_0x4d6dab){if(_0x4d6dab['type']!=='VIRTUAL'){var _0x5ba622={};_0x5ba622[_0x4d6dab['name']]={'$like':'%'+_0x337e53[_0xeffa('0x2a')][_0xeffa('0x35')]+'%'};return _0x5ba622;}})});}_0x1a00c1=_[_0xeffa('0x36')]({},_0x1a00c1,_0x337e53[_0xeffa('0x37')]);var _0x38d81f={'where':_0x1a00c1[_0xeffa('0x33')]};return db[_0xeffa('0x24')][_0xeffa('0x18')](_0x38d81f)[_0xeffa('0x1d')](function(_0x54211d){_0x4f3e09[_0xeffa('0x18')]=_0x54211d;if(_0x337e53['query'][_0xeffa('0x38')]){_0x1a00c1[_0xeffa('0x39')]=[{'all':!![]}];}return db[_0xeffa('0x24')][_0xeffa('0x3a')](_0x1a00c1);})[_0xeffa('0x1d')](function(_0x26c1fe){_0x4f3e09[_0xeffa('0x3b')]=_0x26c1fe;return _0x4f3e09;})['then'](respondWithFilteredResult(_0x21c027,_0x1a00c1))[_0xeffa('0x3c')](handleError(_0x21c027,null));};exports['show']=function(_0x15ad8e,_0x32c3f4){var _0x1d11d8={'raw':!![],'where':{'id':_0x15ad8e['params']['id']}},_0x283acc={};_0x283acc['model']=_['keys'](db[_0xeffa('0x24')][_0xeffa('0x25')]);_0x283acc[_0xeffa('0x2a')]=_[_0xeffa('0x29')](_0x15ad8e[_0xeffa('0x2a')]);_0x283acc['filters']=_[_0xeffa('0x2c')](_0x283acc[_0xeffa('0x28')],_0x283acc[_0xeffa('0x2a')]);_0x1d11d8['attributes']=_[_0xeffa('0x2c')](_0x283acc['model'],qs[_0xeffa('0x2e')](_0x15ad8e[_0xeffa('0x2a')]['fields']));_0x1d11d8[_0xeffa('0x2d')]=_0x1d11d8[_0xeffa('0x2d')][_0xeffa('0x2f')]?_0x1d11d8['attributes']:_0x283acc['model'];if(_0x15ad8e['query']['includeAll']){_0x1d11d8[_0xeffa('0x39')]=[{'all':!![]}];}_0x1d11d8=_[_0xeffa('0x36')]({},_0x1d11d8,_0x15ad8e[_0xeffa('0x37')]);return db[_0xeffa('0x24')][_0xeffa('0x3d')](_0x1d11d8)[_0xeffa('0x1d')](handleEntityNotFound(_0x32c3f4,null))['then'](respondWithResult(_0x32c3f4,null))['catch'](handleError(_0x32c3f4,null));};exports[_0xeffa('0x3e')]=function(_0x43955b,_0x5a989d){return db[_0xeffa('0x24')][_0xeffa('0x3e')](_0x43955b[_0xeffa('0x3f')],{})[_0xeffa('0x1d')](respondWithResult(_0x5a989d,0xc9))[_0xeffa('0x3c')](handleError(_0x5a989d,null));};exports[_0xeffa('0x40')]=function(_0x108be6,_0x455cc9){if(_0x108be6[_0xeffa('0x3f')]['id']){delete _0x108be6[_0xeffa('0x3f')]['id'];}return db['ChatTransferReport'][_0xeffa('0x3d')]({'where':{'id':_0x108be6['params']['id']}})[_0xeffa('0x1d')](handleEntityNotFound(_0x455cc9,null))[_0xeffa('0x1d')](saveUpdates(_0x108be6[_0xeffa('0x3f')],null))[_0xeffa('0x1d')](respondWithResult(_0x455cc9,null))['catch'](handleError(_0x455cc9,null));};exports[_0xeffa('0x1e')]=function(_0x23e0c9,_0x149187){return db[_0xeffa('0x24')][_0xeffa('0x3d')]({'where':{'id':_0x23e0c9[_0xeffa('0x41')]['id']}})[_0xeffa('0x1d')](handleEntityNotFound(_0x149187,null))[_0xeffa('0x1d')](removeEntity(_0x149187,null))[_0xeffa('0x3c')](handleError(_0x149187,null));};exports['describe']=function(_0x291f59,_0x5f47be){return db[_0xeffa('0x24')]['describe']()[_0xeffa('0x1d')](respondWithResult(_0x5f47be,null))[_0xeffa('0x3c')](handleError(_0x5f47be,null));}; \ No newline at end of file +var _0x749a=['then','error','send','index','map','ChatTransferReport','rawAttributes','type','key','name','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','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','sendStatus','status','end','offset','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x3fbce8,_0x1337d5){var _0x1409d1=function(_0x3ec126){while(--_0x3ec126){_0x3fbce8['push'](_0x3fbce8['shift']());}};_0x1409d1(++_0x1337d5);}(_0x749a,0x73));var _0xa749=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x749a[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xa749('0x0'));var rimraf=require(_0xa749('0x1'));var zipdir=require(_0xa749('0x2'));var jsonpatch=require(_0xa749('0x3'));var rp=require(_0xa749('0x4'));var moment=require(_0xa749('0x5'));var BPromise=require(_0xa749('0x6'));var Mustache=require(_0xa749('0x7'));var util=require('util');var path=require(_0xa749('0x8'));var sox=require('sox');var csv=require(_0xa749('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa749('0xa'));var _=require('lodash');var squel=require(_0xa749('0xb'));var crypto=require('crypto');var jsforce=require(_0xa749('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa749('0x9'));var querystring=require(_0xa749('0xd'));var Papa=require(_0xa749('0xe'));var Redis=require(_0xa749('0xf'));var authService=require(_0xa749('0x10'));var qs=require(_0xa749('0x11'));var as=require(_0xa749('0x12'));var hardwareService=require(_0xa749('0x13'));var logger=require(_0xa749('0x14'))(_0xa749('0x15'));var utils=require('../../config/utils');var config=require(_0xa749('0x16'));var licenseUtil=require(_0xa749('0x17'));var db=require(_0xa749('0x18'))['db'];function respondWithStatusCode(_0x5c878c,_0x20ad09){_0x20ad09=_0x20ad09||0xcc;return function(_0x1c16ee){if(_0x1c16ee){return _0x5c878c[_0xa749('0x19')](_0x20ad09);}return _0x5c878c[_0xa749('0x1a')](_0x20ad09)[_0xa749('0x1b')]();};}function respondWithResult(_0x32e8e0,_0x291ee9){_0x291ee9=_0x291ee9||0xc8;return function(_0xcd5cba){if(_0xcd5cba){return _0x32e8e0['status'](_0x291ee9)['json'](_0xcd5cba);}};}function respondWithFilteredResult(_0x58e5b9,_0x5db8dd){return function(_0x559f81){if(_0x559f81){var _0x2b307a=typeof _0x5db8dd[_0xa749('0x1c')]==='undefined'&&typeof _0x5db8dd[_0xa749('0x1d')]==='undefined';var _0x44a1d9=_0x559f81[_0xa749('0x1e')];var _0x199f87=_0x2b307a?0x0:_0x5db8dd[_0xa749('0x1c')];var _0x29714b=_0x2b307a?_0x559f81['count']:_0x5db8dd['offset']+_0x5db8dd[_0xa749('0x1d')];var _0x1c54dc;if(_0x29714b>=_0x44a1d9){_0x29714b=_0x44a1d9;_0x1c54dc=0xc8;}else{_0x1c54dc=0xce;}_0x58e5b9['status'](_0x1c54dc);return _0x58e5b9[_0xa749('0x1f')](_0xa749('0x20'),_0x199f87+'-'+_0x29714b+'/'+_0x44a1d9)['json'](_0x559f81);}return null;};}function patchUpdates(_0x1a7f0a){return function(_0x3556d1){try{jsonpatch[_0xa749('0x21')](_0x3556d1,_0x1a7f0a,!![]);}catch(_0x3055f9){return BPromise[_0xa749('0x22')](_0x3055f9);}return _0x3556d1[_0xa749('0x23')]();};}function saveUpdates(_0x39a2d3,_0x32b8ad){return function(_0x123f49){if(_0x123f49){return _0x123f49[_0xa749('0x24')](_0x39a2d3)[_0xa749('0x25')](function(_0x59e346){return _0x59e346;});}return null;};}function removeEntity(_0x4f54ec,_0x5dbb20){return function(_0x121009){if(_0x121009){return _0x121009['destroy']()['then'](function(){_0x4f54ec[_0xa749('0x1a')](0xcc)[_0xa749('0x1b')]();});}};}function handleEntityNotFound(_0x62ed57,_0x37190f){return function(_0x5a8d44){if(!_0x5a8d44){_0x62ed57[_0xa749('0x19')](0x194);}return _0x5a8d44;};}function handleError(_0x29a2b8,_0xfd21df){_0xfd21df=_0xfd21df||0x1f4;return function(_0x459d39){logger[_0xa749('0x26')](_0x459d39['stack']);if(_0x459d39['name']){delete _0x459d39['name'];}_0x29a2b8[_0xa749('0x1a')](_0xfd21df)[_0xa749('0x27')](_0x459d39);};}exports[_0xa749('0x28')]=function(_0x421278,_0x4f736a){var _0x4e501c={},_0x434545={},_0x53bef0={'count':0x0,'rows':[]};var _0x3c1034=_[_0xa749('0x29')](db[_0xa749('0x2a')][_0xa749('0x2b')],function(_0x1a63a3){return{'name':_0x1a63a3['fieldName'],'type':_0x1a63a3[_0xa749('0x2c')][_0xa749('0x2d')]};});_0x434545['model']=_[_0xa749('0x29')](_0x3c1034,_0xa749('0x2e'));_0x434545[_0xa749('0x2f')]=_['keys'](_0x421278[_0xa749('0x2f')]);_0x434545[_0xa749('0x30')]=_[_0xa749('0x31')](_0x434545[_0xa749('0x32')],_0x434545['query']);_0x4e501c['attributes']=_[_0xa749('0x31')](_0x434545['model'],qs[_0xa749('0x33')](_0x421278[_0xa749('0x2f')]['fields']));_0x4e501c[_0xa749('0x34')]=_0x4e501c[_0xa749('0x34')][_0xa749('0x35')]?_0x4e501c[_0xa749('0x34')]:_0x434545['model'];if(!_0x421278['query'][_0xa749('0x36')](_0xa749('0x37'))){_0x4e501c['limit']=qs[_0xa749('0x1d')](_0x421278[_0xa749('0x2f')][_0xa749('0x1d')]);_0x4e501c[_0xa749('0x1c')]=qs['offset'](_0x421278[_0xa749('0x2f')][_0xa749('0x1c')]);}_0x4e501c['order']=qs[_0xa749('0x38')](_0x421278[_0xa749('0x2f')]['sort']);_0x4e501c[_0xa749('0x39')]=qs[_0xa749('0x30')](_[_0xa749('0x3a')](_0x421278[_0xa749('0x2f')],_0x434545[_0xa749('0x30')]),_0x3c1034);if(_0x421278[_0xa749('0x2f')]['filter']){_0x4e501c[_0xa749('0x39')]=_[_0xa749('0x3b')](_0x4e501c[_0xa749('0x39')],{'$or':_['map'](_0x3c1034,function(_0xa11e4c){if(_0xa11e4c[_0xa749('0x2c')]!==_0xa749('0x3c')){var _0x2f9160={};_0x2f9160[_0xa11e4c[_0xa749('0x2e')]]={'$like':'%'+_0x421278['query'][_0xa749('0x3d')]+'%'};return _0x2f9160;}})});}_0x4e501c=_['merge']({},_0x4e501c,_0x421278[_0xa749('0x3e')]);var _0x374280={'where':_0x4e501c[_0xa749('0x39')]};return db[_0xa749('0x2a')][_0xa749('0x1e')](_0x374280)[_0xa749('0x25')](function(_0x10ffa2){_0x53bef0[_0xa749('0x1e')]=_0x10ffa2;if(_0x421278[_0xa749('0x2f')][_0xa749('0x3f')]){_0x4e501c[_0xa749('0x40')]=[{'all':!![]}];}return db[_0xa749('0x2a')][_0xa749('0x41')](_0x4e501c);})[_0xa749('0x25')](function(_0x1ec3fa){_0x53bef0[_0xa749('0x42')]=_0x1ec3fa;return _0x53bef0;})[_0xa749('0x25')](respondWithFilteredResult(_0x4f736a,_0x4e501c))[_0xa749('0x43')](handleError(_0x4f736a,null));};exports[_0xa749('0x44')]=function(_0x58d01c,_0x3df976){var _0x181e18={'raw':!![],'where':{'id':_0x58d01c['params']['id']}},_0x434641={};_0x434641[_0xa749('0x32')]=_[_0xa749('0x45')](db[_0xa749('0x2a')][_0xa749('0x2b')]);_0x434641[_0xa749('0x2f')]=_['keys'](_0x58d01c[_0xa749('0x2f')]);_0x434641[_0xa749('0x30')]=_[_0xa749('0x31')](_0x434641['model'],_0x434641['query']);_0x181e18[_0xa749('0x34')]=_['intersection'](_0x434641[_0xa749('0x32')],qs[_0xa749('0x33')](_0x58d01c[_0xa749('0x2f')][_0xa749('0x33')]));_0x181e18[_0xa749('0x34')]=_0x181e18[_0xa749('0x34')][_0xa749('0x35')]?_0x181e18['attributes']:_0x434641[_0xa749('0x32')];if(_0x58d01c['query'][_0xa749('0x3f')]){_0x181e18[_0xa749('0x40')]=[{'all':!![]}];}_0x181e18=_[_0xa749('0x3b')]({},_0x181e18,_0x58d01c[_0xa749('0x3e')]);return db[_0xa749('0x2a')][_0xa749('0x46')](_0x181e18)[_0xa749('0x25')](handleEntityNotFound(_0x3df976,null))[_0xa749('0x25')](respondWithResult(_0x3df976,null))[_0xa749('0x43')](handleError(_0x3df976,null));};exports[_0xa749('0x47')]=function(_0x196b67,_0x1cc6f0){return db[_0xa749('0x2a')]['create'](_0x196b67[_0xa749('0x48')],{})[_0xa749('0x25')](respondWithResult(_0x1cc6f0,0xc9))[_0xa749('0x43')](handleError(_0x1cc6f0,null));};exports['update']=function(_0x2b75e2,_0x3715b0){if(_0x2b75e2[_0xa749('0x48')]['id']){delete _0x2b75e2[_0xa749('0x48')]['id'];}return db['ChatTransferReport'][_0xa749('0x46')]({'where':{'id':_0x2b75e2[_0xa749('0x49')]['id']}})[_0xa749('0x25')](handleEntityNotFound(_0x3715b0,null))[_0xa749('0x25')](saveUpdates(_0x2b75e2[_0xa749('0x48')],null))['then'](respondWithResult(_0x3715b0,null))[_0xa749('0x43')](handleError(_0x3715b0,null));};exports[_0xa749('0x4a')]=function(_0x3ed4ab,_0x161bca){return db[_0xa749('0x2a')][_0xa749('0x46')]({'where':{'id':_0x3ed4ab[_0xa749('0x49')]['id']}})['then'](handleEntityNotFound(_0x161bca,null))[_0xa749('0x25')](removeEntity(_0x161bca,null))[_0xa749('0x43')](handleError(_0x161bca,null));};exports[_0xa749('0x4b')]=function(_0x28d7be,_0x33fb66){return db[_0xa749('0x2a')][_0xa749('0x4b')]()[_0xa749('0x25')](respondWithResult(_0x33fb66,null))[_0xa749('0x43')](handleError(_0x33fb66,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index e4fac61..a5eadc1 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 _0x1f13=['request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x3c7185,_0x456c77){var _0x51b03b=function(_0x4c7f07){while(--_0x4c7f07){_0x3c7185['push'](_0x3c7185['shift']());}};_0x51b03b(++_0x456c77);}(_0x1f13,0xdb));var _0x31f1=function(_0xce7bbf,_0x1e1546){_0xce7bbf=_0xce7bbf-0x0;var _0xd88dca=_0x1f13[_0xce7bbf];return _0xd88dca;};'use strict';var _=require(_0x31f1('0x0'));var util=require(_0x31f1('0x1'));var logger=require(_0x31f1('0x2'))(_0x31f1('0x3'));var moment=require('moment');var BPromise=require(_0x31f1('0x4'));var rp=require(_0x31f1('0x5'));var fs=require('fs');var path=require(_0x31f1('0x6'));var rimraf=require(_0x31f1('0x7'));var config=require(_0x31f1('0x8'));var attributes=require(_0x31f1('0x9'));module['exports']=function(_0x2a948e,_0x1d140e){return _0x2a948e[_0x31f1('0xa')](_0x31f1('0xb'),attributes,{'tableName':_0x31f1('0xc'),'paranoid':![],'indexes':[{'name':_0x31f1('0xd'),'fields':[_0x31f1('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9502=['bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','../../config/logger','api'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x9502,0x1e7));var _0x2950=function(_0x2efe4f,_0x35b3d9){_0x2efe4f=_0x2efe4f-0x0;var _0x251e7e=_0x9502[_0x2efe4f];return _0x251e7e;};'use strict';var _=require(_0x2950('0x0'));var util=require('util');var logger=require(_0x2950('0x1'))(_0x2950('0x2'));var moment=require('moment');var BPromise=require(_0x2950('0x3'));var rp=require(_0x2950('0x4'));var fs=require('fs');var path=require(_0x2950('0x5'));var rimraf=require(_0x2950('0x6'));var config=require(_0x2950('0x7'));var attributes=require(_0x2950('0x8'));module[_0x2950('0x9')]=function(_0x49d788,_0x441a95){return _0x49d788[_0x2950('0xa')](_0x2950('0xb'),attributes,{'tableName':_0x2950('0xc'),'paranoid':![],'indexes':[{'name':_0x2950('0xd'),'fields':[_0x2950('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 326644f..74c100a 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 _0xe54c=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x576f41,_0x4d2077){var _0x3ef2d4=function(_0x4767ba){while(--_0x4767ba){_0x576f41['push'](_0x576f41['shift']());}};_0x3ef2d4(++_0x4d2077);}(_0xe54c,0x145));var _0xce54=function(_0x47bf8b,_0x5c377e){_0x47bf8b=_0x47bf8b-0x0;var _0x2d71ff=_0xe54c[_0x47bf8b];return _0x2d71ff;};'use strict';var _=require(_0xce54('0x0'));var util=require(_0xce54('0x1'));var moment=require(_0xce54('0x2'));var BPromise=require(_0xce54('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xce54('0x4'));var db=require(_0xce54('0x5'))['db'];var utils=require(_0xce54('0x6'));var logger=require(_0xce54('0x7'))('rpc');var config=require(_0xce54('0x8'));var jayson=require(_0xce54('0x9'));var client=jayson[_0xce54('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x305110,_0x3837f6,_0x558a90){return new BPromise(function(_0x5e3038,_0x1246b9){return client[_0xce54('0xb')](_0x305110,_0x558a90)[_0xce54('0xc')](function(_0x11cbee){logger[_0xce54('0xd')](_0xce54('0xe'),_0x3837f6,'request\x20sent');logger[_0xce54('0xf')](_0xce54('0x10'),_0x3837f6,_0xce54('0x11'),JSON[_0xce54('0x12')](_0x11cbee));if(_0x11cbee[_0xce54('0x13')]){if(_0x11cbee['error']['code']===0x1f4){logger[_0xce54('0x13')](_0xce54('0xe'),_0x3837f6,_0x11cbee[_0xce54('0x13')][_0xce54('0x14')]);return _0x1246b9(_0x11cbee['error'][_0xce54('0x14')]);}logger['error'](_0xce54('0xe'),_0x3837f6,_0x11cbee[_0xce54('0x13')][_0xce54('0x14')]);return _0x5e3038(_0x11cbee[_0xce54('0x13')][_0xce54('0x14')]);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x3837f6,'request\x20sent');_0x5e3038(_0x11cbee[_0xce54('0x15')][_0xce54('0x14')]);}})[_0xce54('0x16')](function(_0x171669){logger[_0xce54('0x13')]('ChatTransferReport,\x20%s,\x20%s',_0x3837f6,_0x171669);_0x1246b9(_0x171669);});});} \ No newline at end of file +var _0x2bbc=['client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x57d9c9,_0x20e743){var _0x35daba=function(_0x452ca8){while(--_0x452ca8){_0x57d9c9['push'](_0x57d9c9['shift']());}};_0x35daba(++_0x20e743);}(_0x2bbc,0x194));var _0xc2bb=function(_0x51f8e7,_0x2e78a2){_0x51f8e7=_0x51f8e7-0x0;var _0x264589=_0x2bbc[_0x51f8e7];return _0x264589;};'use strict';var _=require(_0xc2bb('0x0'));var util=require('util');var moment=require(_0xc2bb('0x1'));var BPromise=require(_0xc2bb('0x2'));var rs=require(_0xc2bb('0x3'));var fs=require('fs');var Redis=require(_0xc2bb('0x4'));var db=require(_0xc2bb('0x5'))['db'];var utils=require(_0xc2bb('0x6'));var logger=require('../../config/logger')(_0xc2bb('0x7'));var config=require(_0xc2bb('0x8'));var jayson=require(_0xc2bb('0x9'));var client=jayson[_0xc2bb('0xa')][_0xc2bb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46d31b,_0x46c477,_0x170390){return new BPromise(function(_0xa9112b,_0x50e360){return client[_0xc2bb('0xc')](_0x46d31b,_0x170390)[_0xc2bb('0xd')](function(_0x1cc93b){logger[_0xc2bb('0xe')](_0xc2bb('0xf'),_0x46c477,_0xc2bb('0x10'));logger[_0xc2bb('0x11')](_0xc2bb('0x12'),_0x46c477,_0xc2bb('0x10'),JSON[_0xc2bb('0x13')](_0x1cc93b));if(_0x1cc93b['error']){if(_0x1cc93b[_0xc2bb('0x14')]['code']===0x1f4){logger[_0xc2bb('0x14')](_0xc2bb('0xf'),_0x46c477,_0x1cc93b[_0xc2bb('0x14')][_0xc2bb('0x15')]);return _0x50e360(_0x1cc93b[_0xc2bb('0x14')][_0xc2bb('0x15')]);}logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x46c477,_0x1cc93b[_0xc2bb('0x14')][_0xc2bb('0x15')]);return _0xa9112b(_0x1cc93b[_0xc2bb('0x14')]['message']);}else{logger[_0xc2bb('0xe')](_0xc2bb('0xf'),_0x46c477,'request\x20sent');_0xa9112b(_0x1cc93b['result']['message']);}})[_0xc2bb('0x16')](function(_0x5c5810){logger[_0xc2bb('0x14')](_0xc2bb('0xf'),_0x46c477,_0x5c5810);_0x50e360(_0x5c5810);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 14ab3d8..f63aa83 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 _0x8b35=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','destroy'];(function(_0x1e179b,_0x4d6ab7){var _0x1292a5=function(_0x22303d){while(--_0x22303d){_0x1e179b['push'](_0x1e179b['shift']());}};_0x1292a5(++_0x4d6ab7);}(_0x8b35,0x1ba));var _0x58b3=function(_0x4497c0,_0x356cfa){_0x4497c0=_0x4497c0-0x0;var _0x1b7e0c=_0x8b35[_0x4497c0];return _0x1b7e0c;};'use strict';var multer=require(_0x58b3('0x0'));var util=require(_0x58b3('0x1'));var path=require(_0x58b3('0x2'));var timeout=require('connect-timeout');var express=require(_0x58b3('0x3'));var router=express[_0x58b3('0x4')]();var fs_extra=require(_0x58b3('0x5'));var auth=require(_0x58b3('0x6'));var interaction=require(_0x58b3('0x7'));var config=require('../../config/environment');var controller=require(_0x58b3('0x8'));router[_0x58b3('0x9')]('/',auth[_0x58b3('0xa')](),controller[_0x58b3('0xb')]);router[_0x58b3('0x9')]('/describe',auth[_0x58b3('0xa')](),controller[_0x58b3('0xc')]);router['get'](_0x58b3('0xd'),auth[_0x58b3('0xa')](),controller[_0x58b3('0xe')]);router[_0x58b3('0xf')]('/',auth['isAuthenticated'](),controller[_0x58b3('0x10')]);router[_0x58b3('0x11')]('/:id',auth[_0x58b3('0xa')](),controller[_0x58b3('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x58b3('0x13')]);module[_0x58b3('0x14')]=router; \ No newline at end of file +var _0xf7ec=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path'];(function(_0xe051a7,_0x411ce5){var _0x21c86f=function(_0x5f0145){while(--_0x5f0145){_0xe051a7['push'](_0xe051a7['shift']());}};_0x21c86f(++_0x411ce5);}(_0xf7ec,0x1cc));var _0xcf7e=function(_0x54cba8,_0x3e5114){_0x54cba8=_0x54cba8-0x0;var _0x324d1f=_0xf7ec[_0x54cba8];return _0x324d1f;};'use strict';var multer=require('multer');var util=require(_0xcf7e('0x0'));var path=require(_0xcf7e('0x1'));var timeout=require('connect-timeout');var express=require(_0xcf7e('0x2'));var router=express[_0xcf7e('0x3')]();var fs_extra=require(_0xcf7e('0x4'));var auth=require(_0xcf7e('0x5'));var interaction=require(_0xcf7e('0x6'));var config=require('../../config/environment');var controller=require('./chatTransferReport.controller');router[_0xcf7e('0x7')]('/',auth[_0xcf7e('0x8')](),controller[_0xcf7e('0x9')]);router[_0xcf7e('0x7')](_0xcf7e('0xa'),auth['isAuthenticated'](),controller[_0xcf7e('0xb')]);router['get'](_0xcf7e('0xc'),auth[_0xcf7e('0x8')](),controller[_0xcf7e('0xd')]);router[_0xcf7e('0xe')]('/',auth['isAuthenticated'](),controller[_0xcf7e('0xf')]);router[_0xcf7e('0x10')](_0xcf7e('0xc'),auth[_0xcf7e('0x8')](),controller[_0xcf7e('0x11')]);router[_0xcf7e('0x12')](_0xcf7e('0xc'),auth[_0xcf7e('0x8')](),controller[_0xcf7e('0x13')]);module[_0xcf7e('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 5059fa7..eedc306 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 _0xe32c=['name','text','input','getDataValue','parse','onlineForm','setDataValue','stringify','Leave\x20your\x20comments','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','bottom_right','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','address','email','Agent','#011F6A','INTEGER','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','BOOLEAN','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Feedback','ENUM','star','thumb'];(function(_0x2b5a15,_0x3c6da1){var _0x91dcdb=function(_0x322425){while(--_0x322425){_0x2b5a15['push'](_0x2b5a15['shift']());}};_0x91dcdb(++_0x3c6da1);}(_0xe32c,0x197));var _0xce32=function(_0x263b0e,_0xc6479f){_0x263b0e=_0x263b0e-0x0;var _0x113fee=_0xe32c[_0x263b0e];return _0x113fee;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xce32('0x0'));module[_0xce32('0x1')]={'name':{'type':Sequelize[_0xce32('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xce32('0x3')},'description':{'type':Sequelize[_0xce32('0x2')]},'mapKey':{'type':Sequelize[_0xce32('0x2')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0xce32('0x2')],'defaultValue':_0xce32('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xce32('0x2')],'defaultValue':_0xce32('0x5')},'customerAlias':{'type':Sequelize[_0xce32('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xce32('0x2')],'allowNull':![],'defaultValue':_0xce32('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xce32('0x2')],'allowNull':![],'defaultValue':_0xce32('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xce32('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xce32('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xce32('0x2')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0xce32('0x8'),_0xce32('0x9')),'defaultValue':_0xce32('0x8')},'header_online':{'type':Sequelize[_0xce32('0x2')],'defaultValue':_0xce32('0xa')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xce32('0xb')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xce32('0xc')},'header_offline':{'type':Sequelize[_0xce32('0x2')],'defaultValue':_0xce32('0xd')},'download_transcript':{'type':Sequelize[_0xce32('0xe')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xce32('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xce32('0x2')],'defaultValue':_0xce32('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0xce32('0xe')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xce32('0x10')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xce32('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0xce32('0x2')],'defaultValue':_0xce32('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0xce32('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0xce32('0x13')},'placeholderMessage':{'type':Sequelize[_0xce32('0x2')],'defaultValue':_0xce32('0x14')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xce32('0xc')},'skipMessageButton':{'type':Sequelize[_0xce32('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0xce32('0xe')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xce32('0xe')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xce32('0xe')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xce32('0x2')],'defaultValue':_0xce32('0x15')},'ratingType':{'type':Sequelize[_0xce32('0x16')](_0xce32('0x17'),_0xce32('0x18')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xce32('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xce32('0x10')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','variable':null,'config':{'placeholder':_0xce32('0x19'),'type':_0xce32('0x1a'),'required':!![]},'props':{'title':_0xce32('0x19'),'helpText':''}},{'type':_0xce32('0x1b'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xce32('0x4'),'type':_0xce32('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xce32('0x1c')]('onlineForm')?JSON[_0xce32('0x1d')](this[_0xce32('0x1c')](_0xce32('0x1e'))):{};},'set':function(_0x441ae5){return this[_0xce32('0x1f')](_0xce32('0x1e'),JSON[_0xce32('0x20')](_0x441ae5));}},'offlineForm':{'type':Sequelize[_0xce32('0x10')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','props':{'title':_0xce32('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xce32('0x4'),'type':_0xce32('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':_0xce32('0x21')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0xce32('0x22'))?JSON[_0xce32('0x1d')](this[_0xce32('0x1c')]('offlineForm')):{};},'set':function(_0x548998){return this[_0xce32('0x1f')]('offlineForm',JSON['stringify'](_0x548998));}},'token':{'type':Sequelize[_0xce32('0x2')],'defaultValue':function(){return rs[_0xce32('0x23')]();}},'autoclose':{'type':Sequelize[_0xce32('0xe')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xce32('0xe')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xce32('0xe')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xce32('0x2')]},'forwardOffline':{'type':Sequelize[_0xce32('0xe')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xce32('0x2')]},'waitingTitle':{'type':Sequelize[_0xce32('0x2')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0xce32('0x2')],'defaultValue':_0xce32('0x24')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0xce32('0x25')},'offlineMessageBody':{'type':Sequelize[_0xce32('0x2')],'defaultValue':_0xce32('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0xce32('0xe')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xce32('0x2')],'defaultValue':_0xce32('0x27')},'skipUnmanaged':{'type':Sequelize[_0xce32('0x2')],'defaultValue':_0xce32('0x28')},'sendUnmanaged':{'type':Sequelize[_0xce32('0x2')],'defaultValue':_0xce32('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0xce32('0xe')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xce32('0xe')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xce32('0x10')]},'showAgentAvatar':{'type':Sequelize[_0xce32('0xe')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xce32('0x2')]},'notificationTemplate':{'type':Sequelize[_0xce32('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xce32('0xe')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xce32('0xe')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xce32('0x2')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xce32('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xce32('0x2')],'defaultValue':_0xce32('0x29')},'verticalAlignment':{'type':Sequelize[_0xce32('0x7')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xce32('0x2')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0xce32('0x10')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xce32('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xce32('0x2')],'allowNull':![],'defaultValue':_0xce32('0x2a'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xce32('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xce32('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xce32('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xce32('0x2')],'defaultValue':_0xce32('0x2b')},'systemAvatar':{'type':Sequelize[_0xce32('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xce32('0x7')],'comment':_0xce32('0x2c')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xce32('0x2d'),'set':function(_0x1470f5){if(!_0x1470f5)this[_0xce32('0x1f')](_0xce32('0x2e'),null);this[_0xce32('0x1f')](_0xce32('0x2f'),_0x1470f5);}},'vidaooEscalation':{'type':Sequelize[_0xce32('0xe')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xce32('0x2')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0xce32('0x2')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0xce32('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xce32('0xe')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xce32('0x10')]}}; \ No newline at end of file +var _0x0d3b=['#011F6A','#ffffff','INTEGER','BOOLEAN','rounded','squared','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Note','Type\x20a\x20message','Skip','Feedback','ENUM','star','thumb','stringify','input','name','text','onlineForm','getDataValue','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','parse','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x0d3b,0x14a));var _0xb0d3=function(_0x52ed24,_0x27432b){_0x52ed24=_0x52ed24-0x0;var _0x54c15c=_0x0d3b[_0x52ed24];return _0x54c15c;};'use strict';var Sequelize=require(_0xb0d3('0x0'));var rs=require(_0xb0d3('0x1'));module[_0xb0d3('0x2')]={'name':{'type':Sequelize[_0xb0d3('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb0d3('0x4')},'description':{'type':Sequelize[_0xb0d3('0x3')]},'mapKey':{'type':Sequelize[_0xb0d3('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xb0d3('0x5')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0xb0d3('0x3')],'allowNull':![],'defaultValue':_0xb0d3('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xb0d3('0x3')],'allowNull':![],'defaultValue':_0xb0d3('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xb0d3('0x3')],'allowNull':![],'defaultValue':_0xb0d3('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xb0d3('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xb0d3('0x3')]},'animation':{'type':Sequelize[_0xb0d3('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0xb0d3('0xa'),_0xb0d3('0xb')),'defaultValue':_0xb0d3('0xa')},'header_online':{'type':Sequelize['STRING'],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0xb0d3('0x3')],'defaultValue':_0xb0d3('0xc')},'offline_chat_button':{'type':Sequelize[_0xb0d3('0x3')],'defaultValue':_0xb0d3('0xd')},'header_offline':{'type':Sequelize[_0xb0d3('0x3')],'defaultValue':_0xb0d3('0xe')},'download_transcript':{'type':Sequelize[_0xb0d3('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xb0d3('0x3')],'defaultValue':_0xb0d3('0xf')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xb0d3('0x10')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0xb0d3('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0xb0d3('0x11')},'placeholderMessage':{'type':Sequelize[_0xb0d3('0x3')],'defaultValue':_0xb0d3('0x12')},'closingMessage':{'type':Sequelize[_0xb0d3('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xb0d3('0xd')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xb0d3('0x13')},'conditionAgreement':{'type':Sequelize[_0xb0d3('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xb0d3('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xb0d3('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0xb0d3('0x14')},'ratingType':{'type':Sequelize[_0xb0d3('0x15')](_0xb0d3('0x16'),_0xb0d3('0x17')),'defaultValue':_0xb0d3('0x16')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xb0d3('0x10')],'defaultValue':function(){return JSON[_0xb0d3('0x18')]({'items':[{'type':_0xb0d3('0x19'),'variable':null,'config':{'placeholder':_0xb0d3('0x1a'),'type':_0xb0d3('0x1b'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':'input','props':{'title':_0xb0d3('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xb0d3('0x5'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0xb0d3('0x1c'))?JSON['parse'](this[_0xb0d3('0x1d')](_0xb0d3('0x1c'))):{};},'set':function(_0x234266){return this[_0xb0d3('0x1e')](_0xb0d3('0x1c'),JSON[_0xb0d3('0x18')](_0x234266));}},'offlineForm':{'type':Sequelize[_0xb0d3('0x10')],'defaultValue':function(){return JSON[_0xb0d3('0x18')]({'items':[{'type':_0xb0d3('0x19'),'props':{'title':_0xb0d3('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xb0d3('0x5'),'type':_0xb0d3('0x5')},'variable':null},{'type':_0xb0d3('0x1f'),'config':{'placeholder':'Comments'},'props':{'title':_0xb0d3('0x20'),'helpText':_0xb0d3('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0xb0d3('0x1d')](_0xb0d3('0x22'))?JSON[_0xb0d3('0x23')](this[_0xb0d3('0x1d')]('offlineForm')):{};},'set':function(_0x3d3ae4){return this[_0xb0d3('0x1e')]('offlineForm',JSON[_0xb0d3('0x18')](_0x3d3ae4));}},'token':{'type':Sequelize[_0xb0d3('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xb0d3('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xb0d3('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xb0d3('0x3')]},'forwardOffline':{'type':Sequelize[_0xb0d3('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xb0d3('0x3')],'defaultValue':_0xb0d3('0x24')},'waitingMessage':{'type':Sequelize[_0xb0d3('0x3')],'defaultValue':_0xb0d3('0x25')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xb0d3('0x3')],'defaultValue':_0xb0d3('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0xb0d3('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0xb0d3('0x27')},'skipUnmanaged':{'type':Sequelize[_0xb0d3('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0xb0d3('0x3')],'defaultValue':_0xb0d3('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0xb0d3('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xb0d3('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xb0d3('0x10')]},'showAgentAvatar':{'type':Sequelize[_0xb0d3('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xb0d3('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xb0d3('0x28');}},'notificationSound':{'type':Sequelize[_0xb0d3('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb0d3('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xb0d3('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xb0d3('0x3')],'defaultValue':_0xb0d3('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0xb0d3('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xb0d3('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0xb0d3('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xb0d3('0x3')]},'customerAvatar':{'type':Sequelize[_0xb0d3('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0xb0d3('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xb0d3('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xb0d3('0x3')],'allowNull':![],'defaultValue':_0xb0d3('0x2a'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb0d3('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb0d3('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xb0d3('0x3')],'defaultValue':_0xb0d3('0x2b')},'systemAvatar':{'type':Sequelize[_0xb0d3('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xb0d3('0x2c')},'mandatoryDisposition':{'type':Sequelize[_0xb0d3('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1454ce){if(!_0x1454ce)this[_0xb0d3('0x1e')]('mandatoryDispositionPauseId',null);this[_0xb0d3('0x1e')](_0xb0d3('0x2d'),_0x1454ce);}},'vidaooEscalation':{'type':Sequelize[_0xb0d3('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xb0d3('0x3')]},'vidaooTopic':{'type':Sequelize[_0xb0d3('0x3')],'allowNull':![],'defaultValue':_0xb0d3('0x2e')},'vidaooNote':{'type':Sequelize[_0xb0d3('0x3')],'defaultValue':function(){return _0xb0d3('0x2f');}},'vidaooMetadata':{'type':Sequelize[_0xb0d3('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xb0d3('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xb0d3('0x10')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 1ab0ac7..36c1a13 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 _0x2ff7=['offlineForm','onlineForm','items','getOfflineMessages','ChatOfflineMessage','Attachments','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','get','UserProfileResource','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','ChatWebsite','includeAll','findAll','rows','params','keys','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChatWebsites','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','ChatWebsiteId','Disposition','getDispositions','findOne','order','pick','removeDispositions','addAnswer','CannedAnswer','getAnswers','options','removeAnswers','ids','addLogo','sitepic','file','filename','addAvatar','agentAvatar','systemAvatar','getLogo','join','getLicense','custom','existsSync','root','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','customerAvatar','showCustomerAvatar','isNil','getSystemAvatar','server/files/images/avatars/system_avatar.png','download','user-agent-parser','headers','user-agent','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','DESC','ChatApplication','Applications','list','applications','orderBy','priority','account','Contacts','customerIp','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','referer','browser','format','%s\x20%s','version','unknown','vendor','%s\x20%s\x20%s','device','threadId','ChatInteraction','externalUrl','interaction','contact','messageId','autoclose','close','AttachmentId','UserId','User','unshift','agent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','offline','files','send','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','originalname','mimetype','attachments','offline-chat','openNewInteraction','transaction','Attachment','bulkCreate','MailServerOut','forwardOffline','forwardOfflineAddress','service','Smtp','host','port','secure','authentication','auth','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','subjectOffline','mapValues','NotifyMailAccount','notifyMail','server','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Owner','fullname','internal','Tag','Tags','color','tag','getSnippet','timezone','interval','iftime\x20%s','true','ONLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','Intervals','getProactiveActions','License','some','server/files/chat/iframe.ejs','utf8','remote','x-real-ip','remoteAddress','virtual','replace','alignment','verticalAlignment','textColor','color_button','backgroundColor','addApplications','sequelize','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','false'];(function(_0x492739,_0x4d7d80){var _0x4b668c=function(_0x1136af){while(--_0x1136af){_0x492739['push'](_0x492739['shift']());}};_0x4b668c(++_0x4d7d80);}(_0x2ff7,0x13c));var _0x72ff=function(_0x33613f,_0x1d2c1b){_0x33613f=_0x33613f-0x0;var _0x12079b=_0x2ff7[_0x33613f];return _0x12079b;};'use strict';var emlformat=require(_0x72ff('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x72ff('0x1'));var jsonpatch=require(_0x72ff('0x2'));var rp=require(_0x72ff('0x3'));var moment=require('moment');var BPromise=require(_0x72ff('0x4'));var Mustache=require(_0x72ff('0x5'));var util=require(_0x72ff('0x6'));var path=require(_0x72ff('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x72ff('0x8'));var fs=require('fs');var fs_extra=require(_0x72ff('0x9'));var _=require(_0x72ff('0xa'));var squel=require(_0x72ff('0xb'));var crypto=require(_0x72ff('0xc'));var jsforce=require(_0x72ff('0xd'));var deskjs=require(_0x72ff('0xe'));var toCsv=require(_0x72ff('0xf'));var querystring=require(_0x72ff('0x10'));var Papa=require(_0x72ff('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x72ff('0x12'));var as=require(_0x72ff('0x13'));var hardwareService=require(_0x72ff('0x14'));var logger=require('../../config/logger')(_0x72ff('0x15'));var utils=require(_0x72ff('0x16'));var config=require(_0x72ff('0x17'));var licenseUtil=require(_0x72ff('0x18'));var db=require(_0x72ff('0x19'))['db'];config[_0x72ff('0x1a')]=_[_0x72ff('0x1b')](config[_0x72ff('0x1a')],{'host':_0x72ff('0x1c'),'port':0x18eb});var socket=require(_0x72ff('0x1d'))(new Redis(config[_0x72ff('0x1a')]));require(_0x72ff('0x1e'))[_0x72ff('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x72ff('0x20')]['http']({'port':0x232c});var client9002=jayson[_0x72ff('0x20')][_0x72ff('0x21')]({'port':0x232a});var client9003=jayson[_0x72ff('0x20')][_0x72ff('0x21')]({'port':0x232b});var client9001=jayson[_0x72ff('0x20')]['http']({'port':0x2329});function respondWithRpcPromise(_0x55230b,_0xc23b0b,_0x4a0cd0,_0x5759e8){return new BPromise(function(_0x42bc8f,_0x5ccce2){var _0x32a5a3=_0x5759e8||client;return _0x32a5a3[_0x72ff('0x22')](_0x55230b,_0x4a0cd0)[_0x72ff('0x23')](function(_0x580157){logger[_0x72ff('0x24')](_0x72ff('0x25'),_0xc23b0b,'request\x20sent');logger[_0x72ff('0x26')](_0x72ff('0x27'),_0xc23b0b,_0x72ff('0x28'),JSON[_0x72ff('0x29')](_0x580157));if(_0x580157['error']){if(_0x580157['error'][_0x72ff('0x2a')]===0x1f4){logger[_0x72ff('0x2b')]('ChatWebsite,\x20%s,\x20%s',_0xc23b0b,_0x580157[_0x72ff('0x2b')][_0x72ff('0x2c')]);return _0x5ccce2(_0x580157[_0x72ff('0x2b')][_0x72ff('0x2c')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0xc23b0b,_0x580157[_0x72ff('0x2b')][_0x72ff('0x2c')]);return _0x42bc8f(_0x580157[_0x72ff('0x2b')][_0x72ff('0x2c')]);}else{logger[_0x72ff('0x24')](_0x72ff('0x25'),_0xc23b0b,'request\x20sent');_0x42bc8f(_0x580157[_0x72ff('0x2d')]['message']);}})[_0x72ff('0x2e')](function(_0x11cf12){logger['error'](_0x72ff('0x25'),_0xc23b0b,_0x11cf12);_0x5ccce2(_0x11cf12);});});}function respondWithStatusCode(_0x5036ff,_0x1590c9){_0x1590c9=_0x1590c9||0xcc;return function(_0x2148f8){if(_0x2148f8){return _0x5036ff[_0x72ff('0x2f')](_0x1590c9);}return _0x5036ff[_0x72ff('0x30')](_0x1590c9)[_0x72ff('0x31')]();};}function respondWithResult(_0x2ccdda,_0x5319f1){_0x5319f1=_0x5319f1||0xc8;return function(_0x21339e){if(_0x21339e){return _0x2ccdda['status'](_0x5319f1)[_0x72ff('0x32')](_0x21339e);}};}function respondWithFilteredResult(_0x54f0ef,_0x426be7){return function(_0x250827){if(_0x250827){var _0xbf8ce8=typeof _0x426be7[_0x72ff('0x33')]===_0x72ff('0x34')&&typeof _0x426be7[_0x72ff('0x35')]==='undefined';var _0x593022=_0x250827[_0x72ff('0x36')];var _0x297d72=_0xbf8ce8?0x0:_0x426be7[_0x72ff('0x33')];var _0x9e455f=_0xbf8ce8?_0x250827['count']:_0x426be7[_0x72ff('0x33')]+_0x426be7[_0x72ff('0x35')];var _0x525f69;if(_0x9e455f>=_0x593022){_0x9e455f=_0x593022;_0x525f69=0xc8;}else{_0x525f69=0xce;}_0x54f0ef[_0x72ff('0x30')](_0x525f69);return _0x54f0ef[_0x72ff('0x37')](_0x72ff('0x38'),_0x297d72+'-'+_0x9e455f+'/'+_0x593022)[_0x72ff('0x32')](_0x250827);}return null;};}function patchUpdates(_0x4efe33){return function(_0x1ad4df){try{jsonpatch['apply'](_0x1ad4df,_0x4efe33,!![]);}catch(_0x1086af){return BPromise[_0x72ff('0x39')](_0x1086af);}return _0x1ad4df[_0x72ff('0x3a')]();};}function saveUpdates(_0x4aa540,_0x324c4b){return function(_0x580068){if(_0x580068){return _0x580068[_0x72ff('0x3b')](_0x4aa540)[_0x72ff('0x23')](function(_0x12a384){return _0x12a384;});}return null;};}function removeEntity(_0x4f43cd,_0xf42a46){return function(_0x5af3de){if(_0x5af3de){return _0x5af3de[_0x72ff('0x3c')]()[_0x72ff('0x23')](function(){var _0x2d11fa=_0x5af3de[_0x72ff('0x3d')]({'plain':!![]});var _0x435036='ChatWebsites';return db[_0x72ff('0x3e')][_0x72ff('0x3c')]({'where':{'type':_0x435036,'resourceId':_0x2d11fa['id']}})['then'](function(){return _0x5af3de;});})[_0x72ff('0x23')](function(){_0x4f43cd[_0x72ff('0x30')](0xcc)[_0x72ff('0x31')]();});}};}function handleEntityNotFound(_0x2c3c28,_0x229d92){return function(_0x233df9){if(!_0x233df9){_0x2c3c28[_0x72ff('0x2f')](0x194);}return _0x233df9;};}function handleError(_0x39bb5e,_0x4ebd57){_0x4ebd57=_0x4ebd57||0x1f4;return function(_0x1cc94e){logger['error'](_0x1cc94e[_0x72ff('0x3f')]);if(_0x1cc94e[_0x72ff('0x40')]){delete _0x1cc94e[_0x72ff('0x40')];}_0x39bb5e[_0x72ff('0x30')](_0x4ebd57)['send'](_0x1cc94e);};}exports[_0x72ff('0x41')]=function(_0x27c2c4,_0x5975db){var _0x23009a={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x3d3c94={},_0x427df8={'count':0x0,'rows':[]};var _0x280f48=_['map'](db['ChatWebsite'][_0x72ff('0x42')],function(_0x714c69){return{'name':_0x714c69[_0x72ff('0x43')],'type':_0x714c69[_0x72ff('0x44')][_0x72ff('0x45')]};});_0x3d3c94[_0x72ff('0x46')]=_[_0x72ff('0x47')](_0x280f48,_0x72ff('0x40'));_0x3d3c94[_0x72ff('0x48')]=_['keys'](_0x27c2c4['query']);_0x3d3c94[_0x72ff('0x49')]=_[_0x72ff('0x4a')](_0x3d3c94[_0x72ff('0x46')],_0x3d3c94[_0x72ff('0x48')]);_0x23009a['attributes']=_[_0x72ff('0x4a')](_0x3d3c94['model'],qs['fields'](_0x27c2c4[_0x72ff('0x48')][_0x72ff('0x4b')]));_0x23009a['attributes']=_0x23009a[_0x72ff('0x4c')][_0x72ff('0x4d')]?_0x23009a[_0x72ff('0x4c')]:_0x3d3c94['model'];if(!_0x27c2c4[_0x72ff('0x48')][_0x72ff('0x4e')](_0x72ff('0x4f'))){_0x23009a['limit']=qs[_0x72ff('0x35')](_0x27c2c4[_0x72ff('0x48')][_0x72ff('0x35')]);_0x23009a['offset']=qs[_0x72ff('0x33')](_0x27c2c4['query'][_0x72ff('0x33')]);}_0x23009a['order']=qs[_0x72ff('0x50')](_0x27c2c4[_0x72ff('0x48')][_0x72ff('0x50')]);_0x23009a[_0x72ff('0x51')]=qs[_0x72ff('0x49')](_['pick'](_0x27c2c4[_0x72ff('0x48')],_0x3d3c94['filters']),_0x280f48);if(_0x27c2c4['query'][_0x72ff('0x52')]){_0x23009a[_0x72ff('0x51')]=_[_0x72ff('0x53')](_0x23009a['where'],{'$or':_[_0x72ff('0x47')](_0x280f48,function(_0x3a7ef6){if(_0x3a7ef6[_0x72ff('0x44')]!=='VIRTUAL'){var _0x2e7e5f={};_0x2e7e5f[_0x3a7ef6[_0x72ff('0x40')]]={'$like':'%'+_0x27c2c4[_0x72ff('0x48')]['filter']+'%'};return _0x2e7e5f;}})});}_0x23009a=_[_0x72ff('0x53')]({},_0x23009a,_0x27c2c4['options']);var _0x4997aa={'where':_0x23009a[_0x72ff('0x51')]};return db[_0x72ff('0x54')]['count'](_0x4997aa)[_0x72ff('0x23')](function(_0x13b68d){_0x427df8['count']=_0x13b68d;if(_0x27c2c4[_0x72ff('0x48')][_0x72ff('0x55')]){_0x23009a['include']=[{'all':!![]}];}return db[_0x72ff('0x54')][_0x72ff('0x56')](_0x23009a);})['then'](function(_0x370d38){_0x427df8[_0x72ff('0x57')]=_0x370d38;return _0x427df8;})[_0x72ff('0x23')](respondWithFilteredResult(_0x5975db,_0x23009a))[_0x72ff('0x2e')](handleError(_0x5975db,null));};exports['show']=function(_0x13aeec,_0x1ba62a){var _0x5f386b={'raw':![],'where':{'id':_0x13aeec[_0x72ff('0x58')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x59e4ae={};_0x59e4ae['model']=_[_0x72ff('0x59')](db[_0x72ff('0x54')]['rawAttributes']);_0x59e4ae['query']=_[_0x72ff('0x59')](_0x13aeec['query']);_0x59e4ae[_0x72ff('0x49')]=_[_0x72ff('0x4a')](_0x59e4ae[_0x72ff('0x46')],_0x59e4ae['query']);_0x5f386b[_0x72ff('0x4c')]=_[_0x72ff('0x4a')](_0x59e4ae[_0x72ff('0x46')],qs[_0x72ff('0x4b')](_0x13aeec[_0x72ff('0x48')]['fields']));_0x5f386b[_0x72ff('0x4c')]=_0x5f386b[_0x72ff('0x4c')][_0x72ff('0x4d')]?_0x5f386b[_0x72ff('0x4c')]:_0x59e4ae[_0x72ff('0x46')];if(_0x13aeec[_0x72ff('0x48')][_0x72ff('0x55')]){_0x5f386b[_0x72ff('0x5a')]=[{'all':!![]}];}_0x5f386b=_['merge']({},_0x5f386b,_0x13aeec['options']);return db['ChatWebsite']['find'](_0x5f386b)['then'](handleEntityNotFound(_0x1ba62a,null))[_0x72ff('0x23')](respondWithResult(_0x1ba62a,null))[_0x72ff('0x2e')](handleError(_0x1ba62a,null));};exports['create']=function(_0x53109b,_0x48639f){return db[_0x72ff('0x54')][_0x72ff('0x5b')](_0x53109b[_0x72ff('0x5c')],{})[_0x72ff('0x23')](function(_0x482d41){var _0x409b5c=_0x53109b[_0x72ff('0x5d')]['get']({'plain':!![]});if(!_0x409b5c)throw new Error(_0x72ff('0x5e'));if(_0x409b5c['role']==='user'){var _0x5787ca=_0x482d41[_0x72ff('0x3d')]({'plain':!![]});var _0x4fc5f1=_0x72ff('0x5f');return db[_0x72ff('0x60')][_0x72ff('0x61')]({'where':{'name':_0x4fc5f1,'userProfileId':_0x409b5c[_0x72ff('0x62')]},'raw':!![]})[_0x72ff('0x23')](function(_0x2c37b2){if(_0x2c37b2&&_0x2c37b2['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x5787ca[_0x72ff('0x40')],'resourceId':_0x5787ca['id'],'type':_0x2c37b2[_0x72ff('0x40')],'sectionId':_0x2c37b2['id']},{})[_0x72ff('0x23')](function(){return _0x482d41;});}else{return _0x482d41;}})[_0x72ff('0x2e')](function(_0x1ccba8){logger[_0x72ff('0x2b')](_0x72ff('0x63'),_0x1ccba8);throw _0x1ccba8;});}return _0x482d41;})[_0x72ff('0x23')](respondWithResult(_0x48639f,0xc9))[_0x72ff('0x2e')](handleError(_0x48639f,null));};exports[_0x72ff('0x3b')]=function(_0x5c7ccc,_0x4df5d1){if(_0x5c7ccc[_0x72ff('0x5c')]['id']){delete _0x5c7ccc[_0x72ff('0x5c')]['id'];}return db[_0x72ff('0x54')]['find']({'where':{'id':_0x5c7ccc[_0x72ff('0x58')]['id']},'include':[{'model':db[_0x72ff('0x64')],'as':'mandatoryDispositionPause'}]})[_0x72ff('0x23')](handleEntityNotFound(_0x4df5d1,null))[_0x72ff('0x23')](saveUpdates(_0x5c7ccc[_0x72ff('0x5c')],null))[_0x72ff('0x23')](respondWithResult(_0x4df5d1,null))[_0x72ff('0x2e')](handleError(_0x4df5d1,null));};exports[_0x72ff('0x3c')]=function(_0x7a93ae,_0xe38358){return db['ChatWebsite'][_0x72ff('0x61')]({'where':{'id':_0x7a93ae['params']['id']}})['then'](handleEntityNotFound(_0xe38358,null))[_0x72ff('0x23')](removeEntity(_0xe38358,null))[_0x72ff('0x2e')](handleError(_0xe38358,null));};exports[_0x72ff('0x65')]=function(_0x5c7196,_0x5b15fe){return db[_0x72ff('0x54')]['describe']()[_0x72ff('0x23')](respondWithResult(_0x5b15fe,null))[_0x72ff('0x2e')](handleError(_0x5b15fe,null));};exports['addDisposition']=function(_0x1b457a,_0x517109,_0x2750fb){if(_0x1b457a[_0x72ff('0x5c')]['id']){delete _0x1b457a[_0x72ff('0x5c')]['id'];}return db[_0x72ff('0x54')][_0x72ff('0x61')]({'where':{'id':_0x1b457a[_0x72ff('0x58')]['id']}})[_0x72ff('0x23')](handleEntityNotFound(_0x517109,null))['then'](function(_0x2a520b){if(_0x2a520b){_0x1b457a[_0x72ff('0x5c')][_0x72ff('0x66')]=_0x2a520b['id'];return db[_0x72ff('0x67')][_0x72ff('0x5b')](_0x1b457a['body']);}})[_0x72ff('0x23')](respondWithResult(_0x517109,null))[_0x72ff('0x2e')](handleError(_0x517109,null));};exports[_0x72ff('0x68')]=function(_0x31a020,_0x12174d,_0x297f41){var _0x351c78={'raw':![],'where':{}};var _0xd801b0={};var _0x487484={'count':0x0,'rows':[]};return db[_0x72ff('0x54')][_0x72ff('0x69')]({'where':{'id':_0x31a020[_0x72ff('0x58')]['id']}})[_0x72ff('0x23')](handleEntityNotFound(_0x12174d,null))['then'](function(_0x564bf1){if(_0x564bf1){_0xd801b0[_0x72ff('0x46')]=_[_0x72ff('0x59')](db[_0x72ff('0x67')]['rawAttributes']);_0xd801b0[_0x72ff('0x48')]=_[_0x72ff('0x59')](_0x31a020[_0x72ff('0x48')]);_0xd801b0[_0x72ff('0x49')]=_[_0x72ff('0x4a')](_0xd801b0[_0x72ff('0x46')],_0xd801b0[_0x72ff('0x48')]);_0x351c78[_0x72ff('0x4c')]=_[_0x72ff('0x4a')](_0xd801b0[_0x72ff('0x46')],qs[_0x72ff('0x4b')](_0x31a020[_0x72ff('0x48')][_0x72ff('0x4b')]));_0x351c78['attributes']=_0x351c78['attributes'][_0x72ff('0x4d')]?_0x351c78[_0x72ff('0x4c')]:_0xd801b0[_0x72ff('0x46')];if(!_0x31a020[_0x72ff('0x48')][_0x72ff('0x4e')](_0x72ff('0x4f'))){_0x351c78[_0x72ff('0x35')]=qs[_0x72ff('0x35')](_0x31a020[_0x72ff('0x48')]['limit']);_0x351c78[_0x72ff('0x33')]=qs[_0x72ff('0x33')](_0x31a020[_0x72ff('0x48')][_0x72ff('0x33')]);}_0x351c78[_0x72ff('0x6a')]=qs['sort'](_0x31a020[_0x72ff('0x48')][_0x72ff('0x50')]);_0x351c78[_0x72ff('0x51')]=qs['filters'](_[_0x72ff('0x6b')](_0x31a020[_0x72ff('0x48')],_0xd801b0['filters']));_0x351c78[_0x72ff('0x51')]['ChatWebsiteId']=_0x564bf1['id'];if(_0x31a020[_0x72ff('0x48')][_0x72ff('0x52')]){_0x351c78['where']=_[_0x72ff('0x53')](_0x351c78['where'],{'$or':_[_0x72ff('0x47')](_0x351c78[_0x72ff('0x4c')],function(_0x3ea647){var _0x4e60e8={};_0x4e60e8[_0x3ea647]={'$like':'%'+_0x31a020[_0x72ff('0x48')][_0x72ff('0x52')]+'%'};return _0x4e60e8;})});}_0x351c78=_[_0x72ff('0x53')]({},_0x351c78,_0x31a020['options']);return db[_0x72ff('0x67')]['count']({'where':_0x351c78['where']})[_0x72ff('0x23')](function(_0x3b79f8){_0x487484[_0x72ff('0x36')]=_0x3b79f8;if(_0x31a020[_0x72ff('0x48')]['includeAll']){_0x351c78['include']=[{'all':!![]}];}return db[_0x72ff('0x67')][_0x72ff('0x56')](_0x351c78);})[_0x72ff('0x23')](function(_0x483594){_0x487484[_0x72ff('0x57')]=_0x483594;return _0x487484;});}})[_0x72ff('0x23')](respondWithFilteredResult(_0x12174d,_0x351c78))[_0x72ff('0x2e')](handleError(_0x12174d,null));};exports['removeDispositions']=function(_0x6f8d12,_0x51033b,_0x1d4cf9){return db[_0x72ff('0x54')][_0x72ff('0x61')]({'where':{'id':_0x6f8d12[_0x72ff('0x58')]['id']}})[_0x72ff('0x23')](handleEntityNotFound(_0x51033b,null))[_0x72ff('0x23')](function(_0x510d26){if(_0x510d26){return _0x510d26[_0x72ff('0x6c')](_0x6f8d12[_0x72ff('0x48')]['ids']);}})['then'](respondWithStatusCode(_0x51033b,null))[_0x72ff('0x2e')](handleError(_0x51033b,null));};exports[_0x72ff('0x6d')]=function(_0xc06ada,_0x31abbe,_0x3679ca){if(_0xc06ada['body']['id']){delete _0xc06ada[_0x72ff('0x5c')]['id'];}return db[_0x72ff('0x54')]['find']({'where':{'id':_0xc06ada[_0x72ff('0x58')]['id']}})[_0x72ff('0x23')](handleEntityNotFound(_0x31abbe,null))[_0x72ff('0x23')](function(_0x5859ef){if(_0x5859ef){_0xc06ada['body'][_0x72ff('0x66')]=_0x5859ef['id'];return db[_0x72ff('0x6e')][_0x72ff('0x5b')](_0xc06ada[_0x72ff('0x5c')]);}})[_0x72ff('0x23')](respondWithResult(_0x31abbe,null))[_0x72ff('0x2e')](handleError(_0x31abbe,null));};exports[_0x72ff('0x6f')]=function(_0x48d358,_0x289a6e,_0x36087c){var _0x2b1c15={'raw':![],'where':{}};var _0x26a1d2={};var _0x59adfb={'count':0x0,'rows':[]};return db[_0x72ff('0x54')][_0x72ff('0x69')]({'where':{'id':_0x48d358[_0x72ff('0x58')]['id']}})[_0x72ff('0x23')](handleEntityNotFound(_0x289a6e,null))[_0x72ff('0x23')](function(_0x28425f){if(_0x28425f){_0x26a1d2['model']=_[_0x72ff('0x59')](db[_0x72ff('0x6e')]['rawAttributes']);_0x26a1d2[_0x72ff('0x48')]=_[_0x72ff('0x59')](_0x48d358[_0x72ff('0x48')]);_0x26a1d2[_0x72ff('0x49')]=_['intersection'](_0x26a1d2[_0x72ff('0x46')],_0x26a1d2['query']);_0x2b1c15['attributes']=_['intersection'](_0x26a1d2[_0x72ff('0x46')],qs[_0x72ff('0x4b')](_0x48d358[_0x72ff('0x48')][_0x72ff('0x4b')]));_0x2b1c15[_0x72ff('0x4c')]=_0x2b1c15[_0x72ff('0x4c')][_0x72ff('0x4d')]?_0x2b1c15[_0x72ff('0x4c')]:_0x26a1d2[_0x72ff('0x46')];if(!_0x48d358['query'][_0x72ff('0x4e')](_0x72ff('0x4f'))){_0x2b1c15[_0x72ff('0x35')]=qs[_0x72ff('0x35')](_0x48d358[_0x72ff('0x48')]['limit']);_0x2b1c15[_0x72ff('0x33')]=qs[_0x72ff('0x33')](_0x48d358['query'][_0x72ff('0x33')]);}_0x2b1c15[_0x72ff('0x6a')]=qs[_0x72ff('0x50')](_0x48d358[_0x72ff('0x48')][_0x72ff('0x50')]);_0x2b1c15['where']=qs['filters'](_['pick'](_0x48d358[_0x72ff('0x48')],_0x26a1d2[_0x72ff('0x49')]));_0x2b1c15['where'][_0x72ff('0x66')]=_0x28425f['id'];if(_0x48d358['query'][_0x72ff('0x52')]){_0x2b1c15[_0x72ff('0x51')]=_[_0x72ff('0x53')](_0x2b1c15['where'],{'$or':_[_0x72ff('0x47')](_0x2b1c15[_0x72ff('0x4c')],function(_0x19e02b){var _0x35b73b={};_0x35b73b[_0x19e02b]={'$like':'%'+_0x48d358[_0x72ff('0x48')]['filter']+'%'};return _0x35b73b;})});}_0x2b1c15=_[_0x72ff('0x53')]({},_0x2b1c15,_0x48d358[_0x72ff('0x70')]);return db[_0x72ff('0x6e')]['count']({'where':_0x2b1c15['where']})[_0x72ff('0x23')](function(_0x33aa92){_0x59adfb[_0x72ff('0x36')]=_0x33aa92;if(_0x48d358[_0x72ff('0x48')][_0x72ff('0x55')]){_0x2b1c15['include']=[{'all':!![]}];}return db[_0x72ff('0x6e')][_0x72ff('0x56')](_0x2b1c15);})[_0x72ff('0x23')](function(_0x1cd392){_0x59adfb[_0x72ff('0x57')]=_0x1cd392;return _0x59adfb;});}})[_0x72ff('0x23')](respondWithFilteredResult(_0x289a6e,_0x2b1c15))['catch'](handleError(_0x289a6e,null));};exports[_0x72ff('0x71')]=function(_0xc39b08,_0x510491,_0x5a55c4){return db[_0x72ff('0x54')][_0x72ff('0x61')]({'where':{'id':_0xc39b08[_0x72ff('0x58')]['id']}})[_0x72ff('0x23')](handleEntityNotFound(_0x510491,null))[_0x72ff('0x23')](function(_0x4d59f5){if(_0x4d59f5){return _0x4d59f5[_0x72ff('0x71')](_0xc39b08[_0x72ff('0x48')][_0x72ff('0x72')]);}})['then'](respondWithStatusCode(_0x510491,null))[_0x72ff('0x2e')](handleError(_0x510491,null));};exports[_0x72ff('0x73')]=function(_0x1a20ba,_0x1fb1a2,_0x237ff0){_0x1a20ba[_0x72ff('0x5c')][_0x72ff('0x74')]=_0x1a20ba[_0x72ff('0x75')][_0x72ff('0x76')];return db[_0x72ff('0x54')][_0x72ff('0x61')]({'where':{'id':_0x1a20ba['params']['id']}})['then'](handleEntityNotFound(_0x1fb1a2,null))[_0x72ff('0x23')](saveUpdates(_0x1a20ba[_0x72ff('0x5c')],null))[_0x72ff('0x23')](respondWithResult(_0x1fb1a2,null))['catch'](handleError(_0x1fb1a2,null));};exports[_0x72ff('0x77')]=function(_0x423bcd,_0x494063,_0x238ff8){_0x423bcd['body'][_0x72ff('0x78')]=_0x423bcd[_0x72ff('0x75')][_0x72ff('0x76')];return db['ChatWebsite']['find']({'where':{'id':_0x423bcd[_0x72ff('0x58')]['id']}})[_0x72ff('0x23')](handleEntityNotFound(_0x494063,null))[_0x72ff('0x23')](saveUpdates(_0x423bcd['body'],null))[_0x72ff('0x23')](respondWithResult(_0x494063,null))[_0x72ff('0x2e')](handleError(_0x494063,null));};exports['addCustomerAvatar']=function(_0x5cb413,_0x3776b1,_0x1ee990){_0x5cb413[_0x72ff('0x5c')]['customerAvatar']=_0x5cb413[_0x72ff('0x75')]['filename'];return db[_0x72ff('0x54')][_0x72ff('0x61')]({'where':{'id':_0x5cb413['params']['id']}})[_0x72ff('0x23')](handleEntityNotFound(_0x3776b1,null))[_0x72ff('0x23')](saveUpdates(_0x5cb413[_0x72ff('0x5c')],null))['then'](respondWithResult(_0x3776b1,null))[_0x72ff('0x2e')](handleError(_0x3776b1,null));};exports['addSystemAvatar']=function(_0x255cdd,_0x2284f9,_0x5b1205){_0x255cdd[_0x72ff('0x5c')][_0x72ff('0x79')]=_0x255cdd['file'][_0x72ff('0x76')];return db['ChatWebsite'][_0x72ff('0x61')]({'where':{'id':_0x255cdd['params']['id']}})['then'](handleEntityNotFound(_0x2284f9,null))[_0x72ff('0x23')](saveUpdates(_0x255cdd['body'],null))[_0x72ff('0x23')](respondWithResult(_0x2284f9,null))['catch'](handleError(_0x2284f9,null));};exports[_0x72ff('0x7a')]=function(_0x338f46,_0x41578c,_0x3aa748){var _0x59551f=path[_0x72ff('0x7b')](config['root'],'server/files/images/logos/default_logo.svg');var _0x4013b9={'where':{'id':_0x338f46[_0x72ff('0x58')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x4d33a6=![];return require('../../config/license/util')[_0x72ff('0x7c')]()[_0x72ff('0x23')](function(_0x51f32c){if(_0x51f32c){_0x4d33a6=_0x51f32c[_0x72ff('0x7d')];}})[_0x72ff('0x23')](function(){return db[_0x72ff('0x54')][_0x72ff('0x61')](_0x4013b9);})[_0x72ff('0x23')](handleEntityNotFound(_0x41578c,null))[_0x72ff('0x23')](function(_0x317b0d){if(_0x317b0d){if(!_['isNil'](_0x317b0d[_0x72ff('0x74')])){if(fs[_0x72ff('0x7e')](path['join'](config[_0x72ff('0x7f')],_0x72ff('0x80'),_0x317b0d[_0x72ff('0x74')]))&&_0x4d33a6){_0x59551f=path[_0x72ff('0x7b')](config[_0x72ff('0x7f')],_0x72ff('0x80'),_0x317b0d[_0x72ff('0x74')]);}}return _0x41578c['download'](_0x59551f);}})[_0x72ff('0x2e')](handleError(_0x41578c,null));};exports[_0x72ff('0x81')]=function(_0x48076e,_0x3e2884,_0x5e4aea){var _0x28dd44=path['join'](config[_0x72ff('0x7f')],_0x72ff('0x82'));var _0x4495ee={'where':{'id':_0x48076e[_0x72ff('0x58')]['id']},'attributes':['id',_0x72ff('0x78')],'raw':!![]};return db['ChatWebsite'][_0x72ff('0x61')](_0x4495ee)[_0x72ff('0x23')](handleEntityNotFound(_0x3e2884,null))[_0x72ff('0x23')](function(_0x1e19f6){if(_0x1e19f6){if(!_['isNil'](_0x1e19f6[_0x72ff('0x78')])){if(fs[_0x72ff('0x7e')](path['join'](config[_0x72ff('0x7f')],_0x72ff('0x83'),_0x1e19f6[_0x72ff('0x78')]))){_0x28dd44=path[_0x72ff('0x7b')](config['root'],'server/files/images/avatars/',_0x1e19f6[_0x72ff('0x78')]);}}return _0x3e2884['download'](_0x28dd44);}})[_0x72ff('0x2e')](handleError(_0x3e2884,null));};exports[_0x72ff('0x84')]=function(_0x5b4820,_0x4ed5bc,_0x11360f){var _0x45ef94=path['join'](config[_0x72ff('0x7f')],'server/files/images/avatars/customer_avatar.png');var _0x8ea2f2={'where':{'id':_0x5b4820[_0x72ff('0x58')]['id']},'attributes':['id',_0x72ff('0x85'),_0x72ff('0x86')],'raw':!![]};return db[_0x72ff('0x54')][_0x72ff('0x61')](_0x8ea2f2)[_0x72ff('0x23')](handleEntityNotFound(_0x4ed5bc,null))[_0x72ff('0x23')](function(_0x306b6d){if(_0x306b6d){if(!_[_0x72ff('0x87')](_0x306b6d[_0x72ff('0x85')])){if(fs[_0x72ff('0x7e')](path[_0x72ff('0x7b')](config[_0x72ff('0x7f')],_0x72ff('0x83'),_0x306b6d[_0x72ff('0x85')]))&&_0x306b6d[_0x72ff('0x86')]){_0x45ef94=path['join'](config[_0x72ff('0x7f')],_0x72ff('0x83'),_0x306b6d[_0x72ff('0x85')]);}}return _0x4ed5bc['download'](_0x45ef94);}})['catch'](handleError(_0x4ed5bc,null));};exports[_0x72ff('0x88')]=function(_0x36c85b,_0x491d8d,_0x4f58be){var _0x5cc626=path[_0x72ff('0x7b')](config[_0x72ff('0x7f')],_0x72ff('0x89'));var _0xf1b60f={'where':{'id':_0x36c85b[_0x72ff('0x58')]['id']},'attributes':['id',_0x72ff('0x79')],'raw':!![]};return db[_0x72ff('0x54')][_0x72ff('0x61')](_0xf1b60f)[_0x72ff('0x23')](handleEntityNotFound(_0x491d8d,null))[_0x72ff('0x23')](function(_0x92892){if(_0x92892){if(!_['isNil'](_0x92892[_0x72ff('0x79')])){if(fs[_0x72ff('0x7e')](path[_0x72ff('0x7b')](config[_0x72ff('0x7f')],'server/files/images/avatars/',_0x92892[_0x72ff('0x79')]))){_0x5cc626=path[_0x72ff('0x7b')](config['root'],_0x72ff('0x83'),_0x92892[_0x72ff('0x79')]);}}return _0x491d8d[_0x72ff('0x8a')](_0x5cc626);}})['catch'](handleError(_0x491d8d,null));};exports['notify']=function(_0x974897,_0x37cc67,_0x1860a2){var _0x42cf26=require(_0x72ff('0x8b'));var _0x3a2516=new _0x42cf26();var _0xb0e47b=_0x3a2516['setUA'](_0x974897[_0x72ff('0x8c')][_0x72ff('0x8d')])['getResult']();var _0x50a2b8={'body':_0x974897[_0x72ff('0x5c')],'channel':_0x72ff('0x8e')};var _0x576d7e=[];var _0x3b4fa5=[];var _0x4e2885={};var _0x5a83c2=![];return db[_0x72ff('0x8f')][_0x72ff('0x65')]()[_0x72ff('0x23')](function(_0x488782){if(!_0x488782){throw new db[(_0x72ff('0x90'))][(_0x72ff('0x91'))](_0x72ff('0x92'));}_0x576d7e=_[_0x72ff('0x93')](_[_0x72ff('0x59')](_0x488782),[_0x72ff('0x94'),_0x72ff('0x95')]);_0x3b4fa5=_['difference'](_[_0x72ff('0x59')](_0x488782),[_0x72ff('0x94'),'updatedAt',_0x72ff('0x96'),_0x72ff('0x97')]);if(_0x974897[_0x72ff('0x5c')]['id']){delete _0x974897[_0x72ff('0x5c')]['id'];}if(_['isNil'](_0x974897[_0x72ff('0x5c')]['from'])){throw new db[(_0x72ff('0x90'))]['ValidationError'](_0x72ff('0x98'));}if(_[_0x72ff('0x87')](_0x974897[_0x72ff('0x5c')]['body'])||_0x974897[_0x72ff('0x5c')]['body']===''){throw new db[(_0x72ff('0x90'))][(_0x72ff('0x91'))](_0x72ff('0x99'));}if(_[_0x72ff('0x87')](_0x974897['body'][_0x72ff('0x9a')])){throw new db[(_0x72ff('0x90'))]['ValidationError'](_0x72ff('0x9b')+_0x3b4fa5);}if(!_[_0x72ff('0x9c')](_0x3b4fa5,_0x974897['body'][_0x72ff('0x9a')])){throw new db[(_0x72ff('0x90'))][(_0x72ff('0x91'))](_0x72ff('0x9d')+_0x3b4fa5);}_0x4e2885[_0x974897['body'][_0x72ff('0x9a')]]=_0x974897[_0x72ff('0x5c')][_0x72ff('0x9e')];})['then'](function(){return db[_0x72ff('0x54')][_0x72ff('0x61')]({'where':{'id':_0x974897['params']['id']},'include':[{'model':db[_0x72ff('0x9f')],'as':_0x72ff('0xa0'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x4e2885,'limit':0x1,'order':[['updatedAt',_0x72ff('0xa1')]]}]},{'model':db[_0x72ff('0xa2')],'as':_0x72ff('0xa3')}]});})[_0x72ff('0x23')](handleEntityNotFound(_0x37cc67,null))[_0x72ff('0x23')](function(_0x2159ab){if(_0x2159ab&&_0x2159ab['List']){_0x50a2b8['account']=_0x2159ab;_0x50a2b8['applications']=_0x2159ab['Applications'];_0x50a2b8[_0x72ff('0xa4')]=_0x2159ab[_0x72ff('0xa0')];_0x50a2b8[_0x72ff('0xa5')]=_[_0x72ff('0xa6')](_0x50a2b8['applications'],[_0x72ff('0xa7')],['asc']);if(_0x50a2b8['account'][_0x72ff('0xa3')]){delete _0x50a2b8[_0x72ff('0xa8')][_0x72ff('0xa3')];}if(_0x50a2b8[_0x72ff('0xa8')][_0x72ff('0xa0')]&&_0x50a2b8['account'][_0x72ff('0xa0')][_0x72ff('0xa9')][_0x72ff('0x4d')]){return _0x50a2b8['account'][_0x72ff('0xa0')][_0x72ff('0xa9')][0x0];}var _0x2e61cc=_[_0x72ff('0x1b')](_0x974897[_0x72ff('0x5c')],{'firstName':_0x974897[_0x72ff('0x5c')][_0x72ff('0x9e')],'ListId':_0x2159ab[_0x72ff('0x97')]});_0x2e61cc[_0x974897['body'][_0x72ff('0x9a')]]=_0x974897[_0x72ff('0x5c')][_0x72ff('0x9e')];return db[_0x72ff('0x8f')][_0x72ff('0x5b')](_0x2e61cc,{'fields':_0x576d7e,'raw':!![]});}})[_0x72ff('0x23')](handleEntityNotFound(_0x37cc67,null))[_0x72ff('0x23')](function(_0x56a11a){_0x50a2b8['contact']=_0x56a11a;var _0x150f88=_0x974897[_0x72ff('0x5c')][_0x72ff('0xaa')];if(_0x974897['headers']['cf-connecting-ip']){_0x150f88=_0x974897[_0x72ff('0x8c')][_0x72ff('0xab')];}else if(_0x974897[_0x72ff('0x8c')][_0x72ff('0xac')]){_0x150f88=_['first'](_0x974897[_0x72ff('0x8c')][_0x72ff('0xac')][_0x72ff('0xad')](','));}if(_0x56a11a){var _0xa0fa72={'ContactId':_0x56a11a['id'],'ChatWebsiteId':_0x974897[_0x72ff('0x58')]['id'],'from':(_0x56a11a[_0x72ff('0xae')]||'')+'\x20'+(_0x56a11a[_0x72ff('0xaf')]||''),'customerIp':_0x150f88,'customerPort':_0x974897[_0x72ff('0x8c')]['x-real-port']?_0x974897[_0x72ff('0x8c')]['x-real-port']:null,'referer':_0x974897[_0x72ff('0x5c')][_0x72ff('0xb0')],'browserName':_0xb0e47b[_0x72ff('0xb1')][_0x72ff('0x40')]&&_0xb0e47b[_0x72ff('0xb1')]['version']?util[_0x72ff('0xb2')](_0x72ff('0xb3'),_0xb0e47b[_0x72ff('0xb1')][_0x72ff('0x40')],_0xb0e47b['browser'][_0x72ff('0xb4')]):_0x72ff('0xb5'),'browserVersion':_0xb0e47b[_0x72ff('0xb1')][_0x72ff('0xb4')]||'unknown','osName':util[_0x72ff('0xb2')](_0x72ff('0xb3'),_0xb0e47b['os']['name'],_0xb0e47b['os'][_0x72ff('0xb4')]),'osVersion':_0xb0e47b['os']['version'],'deviceModel':_0xb0e47b['device']['model']&&_0xb0e47b['device'][_0x72ff('0xb6')]?util[_0x72ff('0xb2')](_0x72ff('0xb7'),_0xb0e47b[_0x72ff('0xb8')][_0x72ff('0x46')],_0xb0e47b['device'][_0x72ff('0xb6')],_0xb0e47b[_0x72ff('0xb8')][_0x72ff('0x44')]):null,'deviceVendor':_0xb0e47b[_0x72ff('0xb8')][_0x72ff('0xb6')],'deviceType':_0xb0e47b['device'][_0x72ff('0x44')],'formData':JSON[_0x72ff('0x29')](_0x974897[_0x72ff('0x5c')])};var _0x480897={'ChatWebsiteId':_0x974897[_0x72ff('0x58')]['id'],'closed':![]};if(_0x974897[_0x72ff('0x5c')][_0x72ff('0xb9')]){_0x480897[_0x72ff('0xb9')]=_0x974897['body'][_0x72ff('0xb9')];return db[_0x72ff('0xba')][_0x72ff('0x61')]({'where':_0x480897})[_0x72ff('0x23')](function(_0x383357){if(_0x383357){return[_0x383357,![]];}_0xa0fa72[_0x72ff('0xb9')]=_0x974897['body'][_0x72ff('0xb9')];_0xa0fa72[_0x72ff('0xbb')]=_0x974897[_0x72ff('0x5c')]['externalUrl'];return db[_0x72ff('0xba')][_0x72ff('0x5b')](_0xa0fa72)['then'](function(_0x50e29c){return[_0x50e29c,!![]];});});}_0x480897['ContactId']=_0x56a11a['id'];if(_0x974897[_0x72ff('0x5c')][_0x72ff('0xbc')]&&_0x974897['body'][_0x72ff('0xbc')]['id']){_0x480897['id']=_0x974897[_0x72ff('0x5c')][_0x72ff('0xbc')]['id'];return db[_0x72ff('0xba')][_0x72ff('0x61')]({'where':_0x480897})[_0x72ff('0x23')](function(_0x2c4705){if(_0x2c4705){return[_0x2c4705,![]];}return db[_0x72ff('0xba')][_0x72ff('0x5b')](_0xa0fa72)['then'](function(_0x162f95){return[_0x162f95,!![]];});});}return db[_0x72ff('0xba')]['create'](_0xa0fa72)[_0x72ff('0x23')](function(_0x20ab25){return[_0x20ab25,!![]];});}})['spread'](function(_0x253db8,_0x8b8695){if(_0x253db8){_0x5a83c2=_0x8b8695;if(!_0x8b8695){var _0x97ea48={'from':(_0x50a2b8[_0x72ff('0xbd')][_0x72ff('0xae')]||'')+'\x20'+(_0x50a2b8[_0x72ff('0xbd')][_0x72ff('0xaf')]||'')};if(_0x974897['body'][_0x72ff('0xb9')]&&_0x974897[_0x72ff('0x5c')]['messageId']&&_0x974897[_0x72ff('0x5c')][_0x72ff('0xb9')]!=_0x974897['body'][_0x72ff('0xbe')]){_0x97ea48[_0x72ff('0xb9')]=_0x974897[_0x72ff('0x5c')][_0x72ff('0xbe')];}return _0x253db8[_0x72ff('0x3b')](_0x97ea48);}else{return _0x253db8;}}})[_0x72ff('0x23')](function(_0x296163){_0x50a2b8[_0x72ff('0xbc')]=_0x296163[_0x72ff('0x3d')]({'plain':!![]});_0x50a2b8['interaction']['created']=_0x5a83c2;if(_0x50a2b8['interaction']['created']){if(_0x50a2b8[_0x72ff('0xa8')][_0x72ff('0xbf')]){_0x50a2b8[_0x72ff('0xa5')]['push']({'id':0x0,'priority':_0x50a2b8[_0x72ff('0xa5')][_0x72ff('0x4d')]+0x1,'app':_0x72ff('0xc0'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db['ChatMessage'][_0x72ff('0x5b')]({'body':_0x974897[_0x72ff('0x5c')][_0x72ff('0x5c')],'ChatWebsiteId':_0x974897[_0x72ff('0x58')]['id'],'ChatInteractionId':_0x296163['id'],'direction':'in','ContactId':_0x50a2b8[_0x72ff('0xbd')]['id'],'AttachmentId':_0x974897[_0x72ff('0x5c')][_0x72ff('0xc1')]});})[_0x72ff('0x23')](function(_0x22924f){_0x50a2b8[_0x72ff('0x2c')]=_0x22924f;if(_0x50a2b8[_0x72ff('0xbc')][_0x72ff('0xc2')]){return db[_0x72ff('0xc3')]['find']({'attributes':['id',_0x72ff('0x40')],'where':{'id':_0x50a2b8[_0x72ff('0xbc')]['UserId']}})['then'](function(_0x3ed77f){if(_0x3ed77f){_0x50a2b8['applications'][_0x72ff('0xc4')]({'id':0x0,'priority':0x0,'app':_0x72ff('0xc5'),'appdata':_0x3ed77f[_0x72ff('0x40')]+','+(_0x50a2b8[_0x72ff('0xa8')]['waitForTheAssignedAgent']||0xa),'interval':_0x72ff('0xc6')});_0x50a2b8[_0x72ff('0xc7')]=!![];}return respondWithRpcPromise(_0x72ff('0xc8'),_0x72ff('0xc9'),_0x50a2b8);});}return respondWithRpcPromise(_0x72ff('0xc8'),_0x72ff('0xc9'),_0x50a2b8);})[_0x72ff('0x23')](function(_0x5be021){respondWithRpcPromise(_0x72ff('0xca'),'EventManager',{'event':'notify','message':_0x5be021},client9002);return _0x5be021;})[_0x72ff('0x23')](respondWithResult(_0x37cc67,null))[_0x72ff('0x2e')](handleError(_0x37cc67,null));};exports[_0x72ff('0xcb')]=function(_0x4478d3,_0x34e02a,_0x427d09){var _0x1fec9c,_0x5a38a7,_0x29b950;var _0x1616bd=[];var _0x176386=[];var _0x589eaa={};var _0x5a5b17=_0x4478d3[_0x72ff('0xcc')]||[];var _0x49f043=[];var _0x4e2bea;return db[_0x72ff('0x8f')][_0x72ff('0x65')]()[_0x72ff('0x23')](function(_0x3e1c5a){if(!_0x3e1c5a){throw new db[(_0x72ff('0x90'))][(_0x72ff('0x91'))](_0x72ff('0x92'));}_0x176386=_[_0x72ff('0x93')](_[_0x72ff('0x59')](_0x3e1c5a),['createdAt',_0x72ff('0x95')]);_0x1616bd=_['difference'](_[_0x72ff('0x59')](_0x3e1c5a),['createdAt','updatedAt',_0x72ff('0x96'),_0x72ff('0x97')]);if(_0x4478d3[_0x72ff('0x5c')]['id']){delete _0x4478d3[_0x72ff('0x5c')]['id'];}if(_[_0x72ff('0x87')](_0x4478d3[_0x72ff('0x5c')][_0x72ff('0x9e')])){throw _0x34e02a[_0x72ff('0x30')](0x1f4)[_0x72ff('0xcd')](new db[(_0x72ff('0x90'))][(_0x72ff('0x91'))]('from\x20is\x20mandatory'));}if(_['isNil'](_0x4478d3[_0x72ff('0x5c')]['body'])||_0x4478d3[_0x72ff('0x5c')][_0x72ff('0x5c')]===''){throw _0x34e02a[_0x72ff('0x30')](0x1f4)[_0x72ff('0xcd')](new db[(_0x72ff('0x90'))][(_0x72ff('0x91'))](_0x72ff('0x99')));}if(_['isNil'](_0x4478d3[_0x72ff('0x5c')]['mapKeyOffline'])){throw _0x34e02a[_0x72ff('0x30')](0x1f4)[_0x72ff('0xcd')](new db[(_0x72ff('0x90'))]['ValidationError'](_0x72ff('0xce')+_0x1616bd));}if(!_[_0x72ff('0x9c')](_0x1616bd,_0x4478d3[_0x72ff('0x5c')][_0x72ff('0xcf')])){throw _0x34e02a['status'](0x1f4)[_0x72ff('0xcd')](new db[(_0x72ff('0x90'))]['ValidationError'](_0x72ff('0xd0')+_0x1616bd));}_0x589eaa[_0x4478d3[_0x72ff('0x5c')][_0x72ff('0xcf')]]=_0x4478d3[_0x72ff('0x5c')][_0x72ff('0x9e')];})[_0x72ff('0x23')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x4478d3['params']['id']},'include':[{'model':db['CmList'],'as':_0x72ff('0xa0')},{'model':db[_0x72ff('0xd1')],'as':_0x72ff('0xd1')}]});})[_0x72ff('0x23')](handleEntityNotFound(_0x34e02a,null))[_0x72ff('0x23')](function(_0x4647f5){if(_0x4647f5&&_0x4647f5['List']){_0x5a38a7=_0x4647f5;var _0x2f2863=_[_0x72ff('0x1b')](_0x4478d3[_0x72ff('0x5c')],{'firstName':_0x4478d3[_0x72ff('0x5c')][_0x72ff('0x9e')],'phone':_0x4478d3[_0x72ff('0x5c')][_0x72ff('0x9e')],'ListId':_0x4647f5[_0x72ff('0x97')]});_0x2f2863[_0x4478d3[_0x72ff('0x5c')][_0x72ff('0xcf')]]=_0x4478d3['body'][_0x72ff('0x9e')];return db['CmContact'][_0x72ff('0xd2')]({'where':_0x589eaa,'defaults':_0x2f2863});}})[_0x72ff('0xd3')](function(_0x8b85b7){if(_0x8b85b7){_0x29b950=_0x8b85b7;var _0x265b7e=fs[_0x72ff('0xd4')](path[_0x72ff('0x7b')](config[_0x72ff('0x7f')],_0x72ff('0xd5')),'utf8');var _0xf38104=ejs[_0x72ff('0xd6')](_0x265b7e,{'body':_[_0x72ff('0xd7')](_0x4478d3['body']['body']),'bodyTitle':_0x5a38a7[_0x72ff('0xd8')]});return db['ChatOfflineMessage'][_0x72ff('0x5b')]({'body':_0xf38104,'ContactId':_0x8b85b7['id'],'ChatWebsiteId':_0x5a38a7['id']});}})['then'](function(_0x5a9c9c){_0x4e2bea=_0x5a9c9c;if(_0x5a5b17[_0x72ff('0x4d')]){var _0x50d729=_0x5a5b17['map'](function(_0x454716){return{'name':_0x454716[_0x72ff('0xd9')],'basename':_0x454716[_0x72ff('0x76')],'type':_0x454716[_0x72ff('0xda')],'ChatOfflineMessageId':_0x5a9c9c['id']};});_0x49f043=_0x50d729[_0x72ff('0x47')](_0x3058eb=>{var _0xefd43b={'filename':_0x3058eb[_0x72ff('0x40')],'path':path[_0x72ff('0x7b')](config[_0x72ff('0x7f')],'server','files',_0x72ff('0xdb'),_0x72ff('0xdc'),_0x3058eb['basename'])};return _0xefd43b;});if(!_0x5a38a7[_0x72ff('0xdd')]){return db['sequelize'][_0x72ff('0xde')](function(_0x1deb92){return db[_0x72ff('0xdf')][_0x72ff('0xe0')](_0x50d729,{'transaction':_0x1deb92});});}}})['then'](function(){if(_0x4e2bea){_0x1fec9c=_0x4e2bea;return db['MailAccount']['findOne']({'where':{'active':!![]},'include':[{'model':db[_0x72ff('0xe1')],'as':'Smtp','raw':!![]}]});}})[_0x72ff('0x23')](function(_0x41c3ea){if(_0x41c3ea&&_0x41c3ea['Smtp']&&_0x5a38a7[_0x72ff('0xe2')]&&_0x5a38a7[_0x72ff('0xe3')]){var _0x4114e1={'tls':{'rejectUnauthorized':![]}};if(_0x41c3ea['Smtp'][_0x72ff('0xe4')]){_0x4114e1[_0x72ff('0xe4')]=_0x41c3ea[_0x72ff('0xe5')][_0x72ff('0xe4')];}else{_0x4114e1['host']=_0x41c3ea['Smtp'][_0x72ff('0xe6')];_0x4114e1[_0x72ff('0xe7')]=_0x41c3ea[_0x72ff('0xe5')]['port'];_0x4114e1[_0x72ff('0xe8')]=_0x41c3ea['Smtp'][_0x72ff('0xe8')];}if(_0x41c3ea['Smtp'][_0x72ff('0xe9')]){_0x4114e1[_0x72ff('0xea')]={'user':_0x41c3ea[_0x72ff('0xe5')][_0x72ff('0x5d')],'pass':_0x41c3ea[_0x72ff('0xe5')]['pass']};}return respondWithRpcPromise(_0x72ff('0xeb'),_0x72ff('0xec'),{'account':_0x4114e1,'message':{'from':util[_0x72ff('0xb2')](_0x72ff('0xed'),_0x41c3ea['name'],_0x41c3ea[_0x72ff('0xee')]||_0x41c3ea[_0x72ff('0xe5')][_0x72ff('0x5d')]),'to':_0x5a38a7['forwardOfflineAddress'],'subject':_0x5a38a7[_0x72ff('0xef')],'html':_0x1fec9c['body'],'attachments':_0x49f043}},client9003)[_0x72ff('0x23')](function(){return _0x1fec9c;})[_0x72ff('0x2e')](function(_0x27a123){console[_0x72ff('0x2b')](_0x27a123);});}})[_0x72ff('0x23')](function(){if(_0x5a38a7&&_0x5a38a7[_0x72ff('0xdd')]&&_0x5a38a7[_0x72ff('0xf0')]){var _0xf35b00=[];if(_0x5a5b17[_0x72ff('0x4d')]){_0xf35b00=_0x5a5b17[_0x72ff('0x47')](function(_0x5b4a5a){return{'name':_0x5b4a5a[_0x72ff('0xd9')],'basename':_0x5b4a5a['filename'],'type':_0x5b4a5a[_0x72ff('0xda')],'ChatOfflineMessageId':_0x4e2bea['id']};});}var _0x256c3;if(!_['isNil'](_0x5a38a7[_0x72ff('0xf1')])){var _0x14b78e=_[_0x72ff('0x47')](_0x4478d3[_0x72ff('0x5c')],function(_0x331f7d){return _0x331f7d;});var _0x38e48d=_['toPairsIn'](_0x14b78e)[0x0];var _0x514611=_[_0x72ff('0xf2')](_0x38e48d,function(_0x287a1c){return _0x287a1c;});_0x256c3=_0x514611[0x1][_0x5a38a7[_0x72ff('0xf1')]];}var _0x30263d={'from':_0x29b950[_0x72ff('0xee')],'firstName':_0x29b950[_0x72ff('0xae')],'lastName':_0x29b950[_0x72ff('0xaf')],'mapKey':_0x72ff('0xee'),'message':{'from':_0x29b950[_0x72ff('0xee')],'to':_0x5a38a7[_0x72ff('0xd1')][_0x72ff('0xee')],'cc':'','subject':_[_0x72ff('0x87')](_0x256c3)?_0x5a38a7[_0x72ff('0xef')]:_0x256c3,'messageId':'','sentAt':new Date(),'attach':_0xf35b00[_0x72ff('0x4d')],'attachments':_0xf35b00,'originChannel':'Chat','ChatWebsiteId':_0x5a38a7['id'],'ChatOfflineMessageId':_0x1fec9c['id'],'originTo':_0x5a38a7[_0x72ff('0xd1')][_0x72ff('0xee')]},'body':_0x1fec9c[_0x72ff('0x5c')]};var _0x177f02={'account':{'id':_0x5a38a7['MailAccountId']},'body':_0x30263d,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0x72ff('0xf3'),_0x72ff('0xf4'),_0x177f02,client9001)['then'](function(){return _0x1fec9c;})['catch'](function(_0x1859b6){console[_0x72ff('0x2b')](_0x1859b6);});}return;})['then'](function(){if(_0x1fec9c){return _0x1fec9c;}})['then'](respondWithResult(_0x34e02a,null))[_0x72ff('0x2e')](function(_0x4a4292){console[_0x72ff('0x2b')](_0x72ff('0x2e'),_0x4a4292);for(var _0x11e1c8 of _0x5a5b17){var _0x85369e=path['join'](config[_0x72ff('0x7f')],_0x72ff('0xf5'),'files',_0x72ff('0xdb'),_0x72ff('0xdc'),_0x11e1c8[_0x72ff('0x76')]);fs_extra[_0x72ff('0xf6')](_0x85369e)[_0x72ff('0x2e')](function(_0xc1b98c){console['error'](_0x72ff('0xf7'),_0x85369e,_0xc1b98c);});}});};exports[_0x72ff('0xf8')]=function(_0x16f3c5,_0x77ae4f,_0x2de124){return db[_0x72ff('0xba')][_0x72ff('0x61')]({'where':{'id':_0x16f3c5['params']['id']}})['then'](handleEntityNotFound(_0x77ae4f,null))['then'](function(_0x260757){if(_0x260757){return _0x260757[_0x72ff('0xf8')](_0x16f3c5[_0x72ff('0x5c')][_0x72ff('0x72')],_[_0x72ff('0xf9')](_0x16f3c5['body'],[_0x72ff('0x72'),'id'])||{});}})['then'](respondWithResult(_0x77ae4f,null))[_0x72ff('0x2e')](handleError(_0x77ae4f,null));};exports[_0x72ff('0xfa')]=function(_0x1f2f37,_0x27b562,_0xc6ddeb){var _0x55e3d5={'raw':![],'where':{}};var _0x372144={};var _0x4cb8d5={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x1f2f37[_0x72ff('0x58')]['id']}})['then'](handleEntityNotFound(_0x27b562,null))[_0x72ff('0x23')](function(_0x5e1c3d){if(_0x5e1c3d){_0x372144[_0x72ff('0x46')]=_[_0x72ff('0x59')](db[_0x72ff('0xba')]['rawAttributes']);_0x372144[_0x72ff('0x48')]=_[_0x72ff('0x59')](_0x1f2f37[_0x72ff('0x48')]);_0x372144[_0x72ff('0x49')]=_[_0x72ff('0x4a')](_0x372144[_0x72ff('0x46')],_0x372144['query']);_0x55e3d5[_0x72ff('0x4c')]=_[_0x72ff('0x4a')](_0x372144[_0x72ff('0x46')],qs[_0x72ff('0x4b')](_0x1f2f37[_0x72ff('0x48')][_0x72ff('0x4b')]));_0x55e3d5[_0x72ff('0x4c')]=_0x55e3d5['attributes'][_0x72ff('0x4d')]?_0x55e3d5[_0x72ff('0x4c')]:_0x372144['model'];if(!_0x1f2f37['query']['hasOwnProperty'](_0x72ff('0x4f'))){_0x55e3d5[_0x72ff('0x35')]=qs['limit'](_0x1f2f37[_0x72ff('0x48')][_0x72ff('0x35')]);_0x55e3d5['offset']=qs['offset'](_0x1f2f37['query'][_0x72ff('0x33')]);}_0x55e3d5['order']=qs[_0x72ff('0x50')](_0x1f2f37[_0x72ff('0x48')][_0x72ff('0x50')]);_0x55e3d5[_0x72ff('0x51')]=qs['filters'](_['pick'](_0x1f2f37[_0x72ff('0x48')],_0x372144[_0x72ff('0x49')]));_0x55e3d5[_0x72ff('0x51')][_0x72ff('0x66')]=_0x5e1c3d['id'];if(_0x1f2f37['query'][_0x72ff('0x52')]){_0x55e3d5[_0x72ff('0x51')]=_[_0x72ff('0x53')](_0x55e3d5[_0x72ff('0x51')],{'$or':_[_0x72ff('0x47')](_0x55e3d5[_0x72ff('0x4c')],function(_0x3c6d75){var _0xe4ae3d={};_0xe4ae3d[_0x3c6d75]={'$like':'%'+_0x1f2f37[_0x72ff('0x48')][_0x72ff('0x52')]+'%'};return _0xe4ae3d;})});}_0x55e3d5=_[_0x72ff('0x53')]({},_0x55e3d5,_0x1f2f37[_0x72ff('0x70')]);return db['ChatInteraction']['count']({'where':_0x55e3d5[_0x72ff('0x51')]})[_0x72ff('0x23')](function(_0x12ec64){_0x4cb8d5[_0x72ff('0x36')]=_0x12ec64;if(_0x1f2f37[_0x72ff('0x48')][_0x72ff('0x55')]){_0x55e3d5[_0x72ff('0x5a')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x72ff('0xc3')],'as':_0x72ff('0xfb'),'attributes':['name',_0x72ff('0xfc'),_0x72ff('0xfd')],'required':![]},{'model':db[_0x72ff('0xfe')],'as':_0x72ff('0xff'),'attributes':['id','name',_0x72ff('0x100')],'where':_0x1f2f37[_0x72ff('0x48')][_0x72ff('0x101')]?{'id':_0x1f2f37[_0x72ff('0x48')][_0x72ff('0x101')]}:undefined,'required':_0x1f2f37['query'][_0x72ff('0x101')]?!![]:![]}];}return db[_0x72ff('0xba')][_0x72ff('0x56')](_0x55e3d5);})[_0x72ff('0x23')](function(_0x2132da){_0x4cb8d5['rows']=_0x2132da;return _0x4cb8d5;});}})[_0x72ff('0x23')](respondWithFilteredResult(_0x27b562,_0x55e3d5))[_0x72ff('0x2e')](handleError(_0x27b562,null));};function iftimePromise(_0x8b70a4,_0x1f9a87){return respondWithRpcPromise('Command',_0x72ff('0x102'),{'command':_0x1f9a87[_0x72ff('0x103')]?util[_0x72ff('0xb2')]('iftime\x20%s,%s',_0x8b70a4[_0x72ff('0x104')],_0x1f9a87[_0x72ff('0x103')]):util[_0x72ff('0xb2')](_0x72ff('0x105'),_0x8b70a4[_0x72ff('0x104')])},client9002)[_0x72ff('0x23')](function(_0x7212e1){var _0x14c3d8=_0x7212e1&&_0x7212e1['indexOf'](_0x72ff('0x106'))>=0x0?!![]:![];logger[_0x72ff('0x24')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x1f9a87['id'],_0x8b70a4['id'],_0x8b70a4['interval'],_0x14c3d8?_0x72ff('0x107'):'OFFLINE',_0x1f9a87[_0x72ff('0x103')]?_0x1f9a87[_0x72ff('0x103')]:_0x72ff('0x108'));return _0x14c3d8;})[_0x72ff('0x2e')](function(_0x538c20){logger['error'](_0x72ff('0x109'),_0x1f9a87['id'],_0x8b70a4['id'],_0x8b70a4['interval'],util[_0x72ff('0x10a')](_0x538c20,{'showHidden':![],'depth':null}),_0x1f9a87[_0x72ff('0x103')]?_0x1f9a87['timezone']:_0x72ff('0x108'));return![];});}exports[_0x72ff('0x102')]=function(_0x4bf417,_0x2a0eb3,_0xa15eaf){var _0x33e24=0x0;var _0x201533=0x0;var _0x1eeb6f=![];var _0x299fea;var _0xf1eac1;return db[_0x72ff('0x54')][_0x72ff('0x61')]({'where':{'id':_0x4bf417[_0x72ff('0x58')]['id']},'include':[{'model':db[_0x72ff('0x10b')],'as':_0x72ff('0x10b'),'include':[{'model':db[_0x72ff('0x10b')],'as':_0x72ff('0x10c'),'attributes':['id',_0x72ff('0x104')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x2a0eb3,null))[_0x72ff('0x23')](function(_0x328a58){if(_0x328a58){_0x299fea=_0x328a58;return _0x328a58[_0x72ff('0x10d')]({'raw':!![]});}})[_0x72ff('0x23')](function(_0x3b2f9b){if(_0x299fea){if(_0x3b2f9b){_0xf1eac1=_0x3b2f9b;}}return require(_0x72ff('0x18'))['getLicense']();})[_0x72ff('0x23')](function(_0x103e99){if(_0x103e99){_0x201533=_0x103e99['virtual'];_0x1eeb6f=_0x103e99[_0x72ff('0x7d')];}})[_0x72ff('0x23')](function(){return db['ChatInteraction'][_0x72ff('0x36')]({'where':{'closed':![]}});})[_0x72ff('0x23')](function(_0x18b49b){_0x33e24=_0x18b49b;if(_0x201533&&_0x18b49b>_0x201533){return db[_0x72ff('0x10e')][_0x72ff('0x69')]({'where':{'id':0x1}})[_0x72ff('0x23')](function(_0x2fccf1){if(_0x2fccf1){_0x2fccf1['increment']('chatLicenseExceeded');}});}})[_0x72ff('0x23')](function(){if(_0x299fea[_0x72ff('0x10b')]&&_0x299fea['Interval']['Intervals']){var _0x34559c=[];for(var _0x4790e0=0x0;_0x4790e0<_0x299fea[_0x72ff('0x10b')][_0x72ff('0x10c')][_0x72ff('0x4d')];_0x4790e0++){var _0x50d0dd=_0x299fea[_0x72ff('0x10b')][_0x72ff('0x10c')][_0x4790e0][_0x72ff('0x3d')]({'plain':!![]});_0x34559c['push'](iftimePromise(_0x50d0dd,_0x299fea));}return BPromise['all'](_0x34559c)[_0x72ff('0x23')](function(_0x3d9d5d){return _[_0x72ff('0x10f')](_0x3d9d5d);});}else{return!![];}})[_0x72ff('0x23')](function(_0x427eb5){var _0x312ccb=fs[_0x72ff('0xd4')](path[_0x72ff('0x7b')](config[_0x72ff('0x7f')],_0x72ff('0x110')),_0x72ff('0x111'));var _0x39e012={'remote':_0x299fea[_0x72ff('0x112')],'query':querystring['stringify'](_[_0x72ff('0x53')](_0x299fea[_0x72ff('0x3d')]({'plain':!![]}),{'customerIp':_0x4bf417[_0x72ff('0x8c')]['x-forwarded-for']||_0x4bf417[_0x72ff('0x8c')][_0x72ff('0x113')]||_0x4bf417['connection'][_0x72ff('0x114')]||_0x4bf417['ip'],'referer':_0x4bf417[_0x72ff('0x8c')][_0x72ff('0xb0')],'openedInteractions':_0x33e24,'maxInteractions':_0x201533,'virtual':_0x1eeb6f[_0x72ff('0x115')],'online':_0x427eb5,'custom':_0x1eeb6f}))[_0x72ff('0x116')](/'/g,'\x5c\x27')};_0x2a0eb3[_0x72ff('0xcd')](ejs[_0x72ff('0xd6')](Mustache['render'](_0x312ccb,_0x39e012),{'proactiveActions':_0xf1eac1,'alignment':_0x299fea[_0x72ff('0x117')],'verticalAlignment':_0x299fea[_0x72ff('0x118')],'div_color':_0x299fea[_0x72ff('0x100')],'text_color':_0x299fea[_0x72ff('0x119')],'button_color':_0x299fea[_0x72ff('0x11a')],'background_color':_0x299fea[_0x72ff('0x11b')]}));})[_0x72ff('0x2e')](handleError(_0x2a0eb3,null));};exports[_0x72ff('0x11c')]=function(_0x4fcdc8,_0x51474a,_0x4bcbd6){return db[_0x72ff('0x54')]['findOne']({'where':{'id':_0x4fcdc8[_0x72ff('0x58')]['id']}})['then'](handleEntityNotFound(_0x51474a,null))[_0x72ff('0x23')](function(_0x1dd1a6){if(_0x1dd1a6){return db[_0x72ff('0x11d')][_0x72ff('0xde')](function(_0x3605e8){return db[_0x72ff('0xa2')][_0x72ff('0x3c')]({'where':{'ChatWebsiteId':_0x4fcdc8['params']['id']},'transaction':_0x3605e8})[_0x72ff('0x23')](function(_0x4346d1){var _0x3c3c06=_['map'](_0x4fcdc8['body'],function(_0x5db279){_0x5db279[_0x72ff('0x66')]=_0x4fcdc8[_0x72ff('0x58')]['id'];return _0x5db279;});return db[_0x72ff('0xa2')]['bulkCreate'](_0x3c3c06,{'transaction':_0x3605e8});});})[_0x72ff('0x23')](function(){return db[_0x72ff('0xa2')][_0x72ff('0x11e')]({'where':{'ChatWebsiteId':_0x4fcdc8[_0x72ff('0x58')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x51474a,null))[_0x72ff('0x2e')](handleError(_0x51474a,null));};exports['getApplications']=function(_0x3783fc,_0x5a089a,_0x46a729){var _0x3d7b21={};var _0x19d23d={};var _0x5bba6a;var _0x2ac79c;return db[_0x72ff('0x54')][_0x72ff('0x69')]({'where':{'id':_0x3783fc[_0x72ff('0x58')]['id']}})['then'](handleEntityNotFound(_0x5a089a,null))[_0x72ff('0x23')](function(_0x5d43d1){if(_0x5d43d1){_0x5bba6a=_0x5d43d1;_0x19d23d[_0x72ff('0x46')]=_['keys'](db[_0x72ff('0xa2')][_0x72ff('0x42')]);_0x19d23d['query']=_['keys'](_0x3783fc[_0x72ff('0x48')]);_0x19d23d[_0x72ff('0x49')]=_['intersection'](_0x19d23d['model'],_0x19d23d[_0x72ff('0x48')]);_0x3d7b21[_0x72ff('0x4c')]=_[_0x72ff('0x4a')](_0x19d23d[_0x72ff('0x46')],qs[_0x72ff('0x4b')](_0x3783fc[_0x72ff('0x48')][_0x72ff('0x4b')]));_0x3d7b21[_0x72ff('0x4c')]=_0x3d7b21[_0x72ff('0x4c')][_0x72ff('0x4d')]?_0x3d7b21[_0x72ff('0x4c')]:_0x19d23d[_0x72ff('0x46')];_0x3d7b21[_0x72ff('0x6a')]=qs[_0x72ff('0x50')](_0x3783fc[_0x72ff('0x48')]['sort']);_0x3d7b21['where']=qs[_0x72ff('0x49')](_['pick'](_0x3783fc[_0x72ff('0x48')],_0x19d23d['filters']));if(_0x3783fc[_0x72ff('0x48')][_0x72ff('0x52')]){_0x3d7b21[_0x72ff('0x51')]=_[_0x72ff('0x53')](_0x3d7b21[_0x72ff('0x51')],{'$or':_[_0x72ff('0x47')](_0x3d7b21['attributes'],function(_0x16dfb3){var _0x19cca6={};_0x19cca6[_0x16dfb3]={'$like':'%'+_0x3783fc[_0x72ff('0x48')][_0x72ff('0x52')]+'%'};return _0x19cca6;})});}_0x3d7b21=_[_0x72ff('0x53')]({},_0x3d7b21,_0x3783fc['options']);return _0x5bba6a[_0x72ff('0x11f')](_0x3d7b21);}})['then'](function(_0x3f36c1){if(_0x3f36c1){_0x2ac79c=_0x3f36c1[_0x72ff('0x4d')];if(!_0x3783fc['query']['hasOwnProperty'](_0x72ff('0x4f'))){_0x3d7b21[_0x72ff('0x35')]=qs[_0x72ff('0x35')](_0x3783fc[_0x72ff('0x48')][_0x72ff('0x35')]);_0x3d7b21['offset']=qs[_0x72ff('0x33')](_0x3783fc[_0x72ff('0x48')]['offset']);}return _0x5bba6a[_0x72ff('0x11f')](_0x3d7b21);}})[_0x72ff('0x23')](function(_0x536487){if(_0x536487){return _0x536487?{'count':_0x2ac79c,'rows':_0x536487}:null;}})[_0x72ff('0x23')](respondWithResult(_0x5a089a,null))['catch'](handleError(_0x5a089a,null));};exports[_0x72ff('0x120')]=function(_0x144667,_0x18d29a,_0x15f798){return db[_0x72ff('0x121')][_0x72ff('0x61')]({'where':{'id':_0x144667[_0x72ff('0x58')]['id']}})[_0x72ff('0x23')](handleEntityNotFound(_0x18d29a,null))[_0x72ff('0x23')](function(_0x46e5d6){if(_0x46e5d6){return _0x46e5d6[_0x72ff('0x120')](_0x144667['body']['ids'],_['omit'](_0x144667[_0x72ff('0x5c')],[_0x72ff('0x72'),'id'])||{});}})[_0x72ff('0x23')](respondWithResult(_0x18d29a,null))[_0x72ff('0x2e')](handleError(_0x18d29a,null));};exports[_0x72ff('0x10d')]=function(_0x1a63ff,_0x14e0d7,_0xcead90){var _0x99e59d={};var _0x5a60ab={};var _0x4f6ea;var _0x22d6ab;return db['ChatWebsite'][_0x72ff('0x69')]({'where':{'id':_0x1a63ff[_0x72ff('0x58')]['id']}})[_0x72ff('0x23')](handleEntityNotFound(_0x14e0d7,null))['then'](function(_0xae181f){if(_0xae181f){_0x4f6ea=_0xae181f;_0x5a60ab[_0x72ff('0x46')]=_[_0x72ff('0x59')](db[_0x72ff('0x122')]['rawAttributes']);_0x5a60ab['query']=_[_0x72ff('0x59')](_0x1a63ff[_0x72ff('0x48')]);_0x5a60ab[_0x72ff('0x49')]=_[_0x72ff('0x4a')](_0x5a60ab[_0x72ff('0x46')],_0x5a60ab['query']);_0x99e59d[_0x72ff('0x4c')]=_['intersection'](_0x5a60ab[_0x72ff('0x46')],qs['fields'](_0x1a63ff[_0x72ff('0x48')]['fields']));_0x99e59d['attributes']=_0x99e59d[_0x72ff('0x4c')]['length']?_0x99e59d[_0x72ff('0x4c')]:_0x5a60ab[_0x72ff('0x46')];_0x99e59d[_0x72ff('0x6a')]=qs[_0x72ff('0x50')](_0x1a63ff['query'][_0x72ff('0x50')]);_0x99e59d['where']=qs['filters'](_[_0x72ff('0x6b')](_0x1a63ff[_0x72ff('0x48')],_0x5a60ab[_0x72ff('0x49')]));if(_0x1a63ff[_0x72ff('0x48')][_0x72ff('0x52')]){_0x99e59d[_0x72ff('0x51')]=_['merge'](_0x99e59d[_0x72ff('0x51')],{'$or':_[_0x72ff('0x47')](_0x99e59d[_0x72ff('0x4c')],function(_0x5449a8){var _0x510eb7={};_0x510eb7[_0x5449a8]={'$like':'%'+_0x1a63ff[_0x72ff('0x48')][_0x72ff('0x52')]+'%'};return _0x510eb7;})});}_0x99e59d=_['merge']({},_0x99e59d,_0x1a63ff[_0x72ff('0x70')]);return _0x4f6ea[_0x72ff('0x10d')](_0x99e59d);}})[_0x72ff('0x23')](function(_0x88e9ab){if(_0x88e9ab){_0x22d6ab=_0x88e9ab[_0x72ff('0x4d')];if(!_0x1a63ff[_0x72ff('0x48')]['hasOwnProperty'](_0x72ff('0x4f'))){_0x99e59d[_0x72ff('0x35')]=qs[_0x72ff('0x35')](_0x1a63ff['query'][_0x72ff('0x35')]);_0x99e59d['offset']=qs['offset'](_0x1a63ff['query']['offset']);}return _0x4f6ea['getProactiveActions'](_0x99e59d);}})[_0x72ff('0x23')](function(_0x38a28e){if(_0x38a28e){return _0x38a28e?{'count':_0x22d6ab,'rows':_0x38a28e}:null;}})[_0x72ff('0x23')](respondWithResult(_0x14e0d7,null))[_0x72ff('0x2e')](handleError(_0x14e0d7,null));};exports['getFields']=function(_0x2198a0,_0x2ab5e8,_0x5466f3){var _0x3004c0=_0x2198a0[_0x72ff('0x48')]['online']===_0x72ff('0x123')?_0x72ff('0x124'):_0x72ff('0x125');return db['ChatWebsite'][_0x72ff('0x61')]({'attributes':['id',_0x3004c0],'where':{'id':_0x2198a0[_0x72ff('0x58')]['id']}})[_0x72ff('0x23')](handleEntityNotFound(_0x2ab5e8,null))[_0x72ff('0x23')](function(_0x1f129c){if(_0x1f129c){var _0x10f3e5=_0x1f129c[_0x3004c0];var _0x44562a=_0x10f3e5&&_0x10f3e5[_0x72ff('0x126')]?_0x10f3e5[_0x72ff('0x126')]:[];_0x2ab5e8[_0x72ff('0xcd')]({'fromKey':_[_0x72ff('0x87')](_0x10f3e5['fromKey'])?undefined:_0x10f3e5['fromKey'],'count':_0x44562a[_0x72ff('0x4d')],'rows':_0x44562a});}})[_0x72ff('0x2e')](handleError(_0x2ab5e8,null));};exports[_0x72ff('0x127')]=function(_0x5e4cb2,_0x5cd7dd,_0x217dd8){var _0x3d12f8={'raw':![],'where':{}};var _0x1e6a6b={};var _0x94e399={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x72ff('0x69')]({'where':{'id':_0x5e4cb2['params']['id']}})['then'](handleEntityNotFound(_0x5cd7dd,null))[_0x72ff('0x23')](function(_0x1b369e){if(_0x1b369e){_0x1e6a6b[_0x72ff('0x46')]=_['keys'](db[_0x72ff('0x128')]['rawAttributes']);_0x1e6a6b[_0x72ff('0x48')]=_[_0x72ff('0x59')](_0x5e4cb2[_0x72ff('0x48')]);_0x1e6a6b[_0x72ff('0x49')]=_['intersection'](_0x1e6a6b[_0x72ff('0x46')],_0x1e6a6b['query']);_0x3d12f8[_0x72ff('0x4c')]=_['intersection'](_0x1e6a6b['model'],qs['fields'](_0x5e4cb2[_0x72ff('0x48')][_0x72ff('0x4b')]));_0x3d12f8[_0x72ff('0x4c')]=_0x3d12f8[_0x72ff('0x4c')]['length']?_0x3d12f8[_0x72ff('0x4c')]:_0x1e6a6b[_0x72ff('0x46')];if(!_0x5e4cb2[_0x72ff('0x48')][_0x72ff('0x4e')](_0x72ff('0x4f'))){_0x3d12f8[_0x72ff('0x35')]=qs['limit'](_0x5e4cb2[_0x72ff('0x48')][_0x72ff('0x35')]);_0x3d12f8['offset']=qs[_0x72ff('0x33')](_0x5e4cb2['query']['offset']);}_0x3d12f8['order']=qs[_0x72ff('0x50')](_0x5e4cb2[_0x72ff('0x48')][_0x72ff('0x50')]);_0x3d12f8[_0x72ff('0x51')]=qs[_0x72ff('0x49')](_[_0x72ff('0x6b')](_0x5e4cb2['query'],_0x1e6a6b['filters']));_0x3d12f8[_0x72ff('0x51')]['ChatWebsiteId']=_0x1b369e['id'];if(_0x5e4cb2[_0x72ff('0x48')][_0x72ff('0x52')]){_0x3d12f8[_0x72ff('0x51')]=_['merge'](_0x3d12f8['where'],{'$or':_[_0x72ff('0x47')](_0x3d12f8[_0x72ff('0x4c')],function(_0x11b48b){var _0x14f38e={};_0x14f38e[_0x11b48b]={'$like':'%'+_0x5e4cb2[_0x72ff('0x48')][_0x72ff('0x52')]+'%'};return _0x14f38e;})});}_0x3d12f8=_[_0x72ff('0x53')]({},_0x3d12f8,_0x5e4cb2[_0x72ff('0x70')]);return db[_0x72ff('0x128')]['count']({'where':_0x3d12f8[_0x72ff('0x51')]})[_0x72ff('0x23')](function(_0x4d9aaa){_0x94e399[_0x72ff('0x36')]=_0x4d9aaa;if(_0x5e4cb2['query'][_0x72ff('0x55')]){_0x3d12f8[_0x72ff('0x5a')]=[{'all':!![]}];}else{_0x3d12f8[_0x72ff('0x5a')]=[{'model':db[_0x72ff('0x8f')],'as':'Contact','required':![]},{'model':db['Attachment'],'as':_0x72ff('0x129'),'required':![]}];}return db[_0x72ff('0x128')][_0x72ff('0x56')](_0x3d12f8);})['then'](function(_0x352e49){_0x94e399['rows']=_0x352e49;return _0x94e399;});}})[_0x72ff('0x23')](respondWithFilteredResult(_0x5cd7dd,_0x3d12f8))[_0x72ff('0x2e')](handleError(_0x5cd7dd,null));};exports['addAgents']=function(_0x3db21e,_0x551de6,_0x217ef2){return db['ChatWebsite'][_0x72ff('0x61')]({'where':{'id':_0x3db21e['params']['id']}})[_0x72ff('0x23')](handleEntityNotFound(_0x551de6,null))['then'](function(_0x1c4e74){if(_0x1c4e74){return _0x1c4e74['addAgents'](_0x3db21e[_0x72ff('0x5c')][_0x72ff('0x72')],_['omit'](_0x3db21e[_0x72ff('0x5c')],['ids','id'])||{})['spread'](function(_0x220aad){for(var _0x5a7769=0x0;_0x5a7769<_0x3db21e[_0x72ff('0x5c')][_0x72ff('0x72')][_0x72ff('0x4d')];_0x5a7769+=0x1){socket[_0x72ff('0x12a')](_0x72ff('0x12b'),{'UserId':Number(_0x3db21e[_0x72ff('0x5c')][_0x72ff('0x72')][_0x5a7769]),'ChatWebsiteId':Number(_0x3db21e['params']['id'])});}return _0x220aad;});}})[_0x72ff('0x23')](respondWithResult(_0x551de6,null))[_0x72ff('0x2e')](handleError(_0x551de6,null));};exports[_0x72ff('0x12c')]=function(_0x2d980e,_0x5195f7,_0x149263){return db[_0x72ff('0x54')][_0x72ff('0x61')]({'where':{'id':_0x2d980e['params']['id']}})[_0x72ff('0x23')](handleEntityNotFound(_0x5195f7,null))[_0x72ff('0x23')](function(_0x2a8be2){if(_0x2a8be2){return _0x2a8be2[_0x72ff('0x12c')](_0x2d980e[_0x72ff('0x48')][_0x72ff('0x72')])['then'](function(){if(_[_0x72ff('0x12d')](_0x2d980e[_0x72ff('0x48')][_0x72ff('0x72')])){for(var _0x2b632a=0x0;_0x2b632a<_0x2d980e[_0x72ff('0x48')][_0x72ff('0x72')]['length'];_0x2b632a+=0x1){socket[_0x72ff('0x12a')](_0x72ff('0x12e'),{'UserId':Number(_0x2d980e[_0x72ff('0x48')][_0x72ff('0x72')][_0x2b632a]),'ChatWebsiteId':Number(_0x2d980e['params']['id'])});}}else{socket[_0x72ff('0x12a')]('userChatWebsite:remove',{'UserId':Number(_0x2d980e[_0x72ff('0x48')][_0x72ff('0x72')]),'ChatWebsiteId':Number(_0x2d980e[_0x72ff('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x5195f7,null))[_0x72ff('0x2e')](handleError(_0x5195f7,null));};exports[_0x72ff('0x12f')]=function(_0xa78f10,_0x937f04,_0x530c7a){var _0x5c66c1={};var _0x20b755={};var _0x1bbac8;var _0x4bd020;return db[_0x72ff('0x54')][_0x72ff('0x69')]({'where':{'id':_0xa78f10[_0x72ff('0x58')]['id']}})[_0x72ff('0x23')](handleEntityNotFound(_0x937f04,null))[_0x72ff('0x23')](function(_0x37d37f){if(_0x37d37f){_0x1bbac8=_0x37d37f;_0x20b755[_0x72ff('0x46')]=_[_0x72ff('0x59')](db[_0x72ff('0xc3')][_0x72ff('0x42')]);_0x20b755[_0x72ff('0x48')]=_[_0x72ff('0x59')](_0xa78f10['query']);_0x20b755[_0x72ff('0x49')]=_[_0x72ff('0x4a')](_0x20b755[_0x72ff('0x46')],_0x20b755['query']);_0x5c66c1[_0x72ff('0x4c')]=_[_0x72ff('0x4a')](_0x20b755[_0x72ff('0x46')],qs[_0x72ff('0x4b')](_0xa78f10[_0x72ff('0x48')][_0x72ff('0x4b')]));_0x5c66c1[_0x72ff('0x4c')]=_0x5c66c1[_0x72ff('0x4c')]['length']?_0x5c66c1['attributes']:_0x20b755[_0x72ff('0x46')];_0x5c66c1[_0x72ff('0x6a')]=qs[_0x72ff('0x50')](_0xa78f10['query'][_0x72ff('0x50')]);_0x5c66c1[_0x72ff('0x51')]=qs['filters'](_[_0x72ff('0x6b')](_0xa78f10['query'],_0x20b755[_0x72ff('0x49')]));if(_0xa78f10[_0x72ff('0x48')][_0x72ff('0x52')]){_0x5c66c1[_0x72ff('0x51')]=_['merge'](_0x5c66c1['where'],{'$or':_['map'](_0x5c66c1[_0x72ff('0x4c')],function(_0xe790c0){var _0x59705b={};_0x59705b[_0xe790c0]={'$like':'%'+_0xa78f10['query'][_0x72ff('0x52')]+'%'};return _0x59705b;})});}_0x5c66c1=_['merge']({},_0x5c66c1,_0xa78f10[_0x72ff('0x70')]);return _0x1bbac8['getAgents'](_0x5c66c1);}})['then'](function(_0x2cb0e9){if(_0x2cb0e9){_0x4bd020=_0x2cb0e9[_0x72ff('0x4d')];if(!_0xa78f10[_0x72ff('0x48')][_0x72ff('0x4e')](_0x72ff('0x4f'))){_0x5c66c1[_0x72ff('0x35')]=qs[_0x72ff('0x35')](_0xa78f10['query'][_0x72ff('0x35')]);_0x5c66c1[_0x72ff('0x33')]=qs[_0x72ff('0x33')](_0xa78f10[_0x72ff('0x48')][_0x72ff('0x33')]);}return _0x1bbac8[_0x72ff('0x12f')](_0x5c66c1);}})[_0x72ff('0x23')](function(_0x61c527){if(_0x61c527){return _0x61c527?{'count':_0x4bd020,'rows':_0x61c527}:null;}})['then'](respondWithResult(_0x937f04,null))['catch'](handleError(_0x937f04,null));}; \ No newline at end of file +var _0x09c3=['agent','forcedOwnership','Start','EventManager','offline','files','no\x20available\x20attributes','mapKeyOffline','includes','MailAccount','ListId','findOrCreate','render','offlineMessageBody','ChatOfflineMessage','mimetype','server','attachments','offline-chat','basename','openNewInteraction','sequelize','forwardOfflineAddress','Smtp','service','host','port','secure','authentication','auth','SendMail','offlineMessageSubject','MailAccountId','originalname','toPairsIn','mapValues','subjectOffline','email','Chat','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','fullname','internal','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','Interval','Intervals','virtual','License','increment','chatLicenseExceeded','all','server/files/chat/iframe.ejs','utf8','remote','connection','remoteAddress','replace','verticalAlignment','color','textColor','color_button','backgroundColor','addApplications','transaction','ChatApplication','bulkCreate','findAndCountAll','getApplications','chatProactiveAction','addProactiveActions','getProactiveActions','getFields','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Contact','Attachment','Attachments','addAgents','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','emit','User','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','get','ChatWebsites','name','send','index','Pause','map','ChatWebsite','rawAttributes','type','model','filters','intersection','query','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','includeAll','include','rows','params','mandatoryDispositionPause','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','hasOwnProperty','findAll','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','file','filename','addAvatar','agentAvatar','addCustomerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic','getLicense','custom','server/files/images/logos/','download','getAvatar','isNil','existsSync','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','customerAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','from','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','CmList','List','Contacts','DESC','Applications','account','applications','list','priority','asc','CmContact','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','%s\x20%s','version','unknown','format','device','%s\x20%s\x20%s','vendor','stringify','threadId','externalUrl','ContactId','interaction','ChatInteraction','spread','messageId','created','autoclose','push','close','unmanaged','ChatMessage','AttachmentId','UserId'];(function(_0x39d0ec,_0x2e0eb7){var _0x584466=function(_0x599d75){while(--_0x599d75){_0x39d0ec['push'](_0x39d0ec['shift']());}};_0x584466(++_0x2e0eb7);}(_0x09c3,0x199));var _0x309c=function(_0x41ee16,_0xfa94c3){_0x41ee16=_0x41ee16-0x0;var _0x1f60de=_0x09c3[_0x41ee16];return _0x1f60de;};'use strict';var emlformat=require(_0x309c('0x0'));var rimraf=require(_0x309c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x309c('0x2'));var rp=require(_0x309c('0x3'));var moment=require(_0x309c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x309c('0x5'));var util=require(_0x309c('0x6'));var path=require(_0x309c('0x7'));var sox=require(_0x309c('0x8'));var csv=require(_0x309c('0x9'));var ejs=require(_0x309c('0xa'));var fs=require('fs');var fs_extra=require(_0x309c('0xb'));var _=require('lodash');var squel=require(_0x309c('0xc'));var crypto=require('crypto');var jsforce=require(_0x309c('0xd'));var deskjs=require(_0x309c('0xe'));var toCsv=require(_0x309c('0x9'));var querystring=require(_0x309c('0xf'));var Papa=require(_0x309c('0x10'));var Redis=require(_0x309c('0x11'));var authService=require(_0x309c('0x12'));var qs=require(_0x309c('0x13'));var as=require(_0x309c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x309c('0x15'))(_0x309c('0x16'));var utils=require(_0x309c('0x17'));var config=require(_0x309c('0x18'));var licenseUtil=require(_0x309c('0x19'));var db=require(_0x309c('0x1a'))['db'];config[_0x309c('0x1b')]=_[_0x309c('0x1c')](config[_0x309c('0x1b')],{'host':_0x309c('0x1d'),'port':0x18eb});var socket=require(_0x309c('0x1e'))(new Redis(config[_0x309c('0x1b')]));require('./chatWebsite.socket')[_0x309c('0x1f')](socket);var jayson=require(_0x309c('0x20'));var client=jayson[_0x309c('0x21')][_0x309c('0x22')]({'port':0x232c});var client9002=jayson[_0x309c('0x21')][_0x309c('0x22')]({'port':0x232a});var client9003=jayson[_0x309c('0x21')][_0x309c('0x22')]({'port':0x232b});var client9001=jayson[_0x309c('0x21')][_0x309c('0x22')]({'port':0x2329});function respondWithRpcPromise(_0xe5514d,_0x43e40e,_0x25e9b0,_0x4e1e71){return new BPromise(function(_0x1bfd11,_0x90ef5){var _0x4aabf1=_0x4e1e71||client;return _0x4aabf1[_0x309c('0x23')](_0xe5514d,_0x25e9b0)[_0x309c('0x24')](function(_0x4aac99){logger[_0x309c('0x25')](_0x309c('0x26'),_0x43e40e,'request\x20sent');logger[_0x309c('0x27')](_0x309c('0x28'),_0x43e40e,'request\x20sent',JSON['stringify'](_0x4aac99));if(_0x4aac99['error']){if(_0x4aac99[_0x309c('0x29')][_0x309c('0x2a')]===0x1f4){logger[_0x309c('0x29')](_0x309c('0x26'),_0x43e40e,_0x4aac99[_0x309c('0x29')]['message']);return _0x90ef5(_0x4aac99[_0x309c('0x29')][_0x309c('0x2b')]);}logger[_0x309c('0x29')](_0x309c('0x26'),_0x43e40e,_0x4aac99[_0x309c('0x29')][_0x309c('0x2b')]);return _0x1bfd11(_0x4aac99[_0x309c('0x29')]['message']);}else{logger['info'](_0x309c('0x26'),_0x43e40e,_0x309c('0x2c'));_0x1bfd11(_0x4aac99[_0x309c('0x2d')]['message']);}})[_0x309c('0x2e')](function(_0x41cdce){logger[_0x309c('0x29')](_0x309c('0x26'),_0x43e40e,_0x41cdce);_0x90ef5(_0x41cdce);});});}function respondWithStatusCode(_0x43de9d,_0x10e2a5){_0x10e2a5=_0x10e2a5||0xcc;return function(_0x198d47){if(_0x198d47){return _0x43de9d[_0x309c('0x2f')](_0x10e2a5);}return _0x43de9d[_0x309c('0x30')](_0x10e2a5)[_0x309c('0x31')]();};}function respondWithResult(_0x1778dc,_0x30f280){_0x30f280=_0x30f280||0xc8;return function(_0x2818be){if(_0x2818be){return _0x1778dc[_0x309c('0x30')](_0x30f280)[_0x309c('0x32')](_0x2818be);}};}function respondWithFilteredResult(_0x19d3e5,_0x23a4a0){return function(_0x3c6e03){if(_0x3c6e03){var _0x28f26b=typeof _0x23a4a0['offset']===_0x309c('0x33')&&typeof _0x23a4a0[_0x309c('0x34')]===_0x309c('0x33');var _0x3915e8=_0x3c6e03[_0x309c('0x35')];var _0x4e52fe=_0x28f26b?0x0:_0x23a4a0[_0x309c('0x36')];var _0x51eaed=_0x28f26b?_0x3c6e03[_0x309c('0x35')]:_0x23a4a0[_0x309c('0x36')]+_0x23a4a0['limit'];var _0x475d42;if(_0x51eaed>=_0x3915e8){_0x51eaed=_0x3915e8;_0x475d42=0xc8;}else{_0x475d42=0xce;}_0x19d3e5[_0x309c('0x30')](_0x475d42);return _0x19d3e5['set'](_0x309c('0x37'),_0x4e52fe+'-'+_0x51eaed+'/'+_0x3915e8)[_0x309c('0x32')](_0x3c6e03);}return null;};}function patchUpdates(_0x6f5734){return function(_0x3a8ed5){try{jsonpatch[_0x309c('0x38')](_0x3a8ed5,_0x6f5734,!![]);}catch(_0x246f57){return BPromise[_0x309c('0x39')](_0x246f57);}return _0x3a8ed5[_0x309c('0x3a')]();};}function saveUpdates(_0x2783bf,_0x7948e5){return function(_0x4adf7f){if(_0x4adf7f){return _0x4adf7f[_0x309c('0x3b')](_0x2783bf)['then'](function(_0x4fce85){return _0x4fce85;});}return null;};}function removeEntity(_0x5954c6,_0x527857){return function(_0x233477){if(_0x233477){return _0x233477[_0x309c('0x3c')]()[_0x309c('0x24')](function(){var _0xa84671=_0x233477[_0x309c('0x3d')]({'plain':!![]});var _0x482223=_0x309c('0x3e');return db['UserProfileResource'][_0x309c('0x3c')]({'where':{'type':_0x482223,'resourceId':_0xa84671['id']}})[_0x309c('0x24')](function(){return _0x233477;});})[_0x309c('0x24')](function(){_0x5954c6[_0x309c('0x30')](0xcc)[_0x309c('0x31')]();});}};}function handleEntityNotFound(_0x3147f7,_0xe0772d){return function(_0x19738c){if(!_0x19738c){_0x3147f7['sendStatus'](0x194);}return _0x19738c;};}function handleError(_0x2031af,_0x226dd8){_0x226dd8=_0x226dd8||0x1f4;return function(_0x35306b){logger[_0x309c('0x29')](_0x35306b['stack']);if(_0x35306b['name']){delete _0x35306b[_0x309c('0x3f')];}_0x2031af[_0x309c('0x30')](_0x226dd8)[_0x309c('0x40')](_0x35306b);};}exports[_0x309c('0x41')]=function(_0x221510,_0x3ab85c){var _0x4974d1={'include':[{'model':db[_0x309c('0x42')],'as':'mandatoryDispositionPause'}]},_0x295f67={},_0x2d50c9={'count':0x0,'rows':[]};var _0x282488=_[_0x309c('0x43')](db[_0x309c('0x44')][_0x309c('0x45')],function(_0x3b2870){return{'name':_0x3b2870['fieldName'],'type':_0x3b2870[_0x309c('0x46')]['key']};});_0x295f67[_0x309c('0x47')]=_[_0x309c('0x43')](_0x282488,_0x309c('0x3f'));_0x295f67['query']=_['keys'](_0x221510['query']);_0x295f67[_0x309c('0x48')]=_[_0x309c('0x49')](_0x295f67[_0x309c('0x47')],_0x295f67[_0x309c('0x4a')]);_0x4974d1['attributes']=_[_0x309c('0x49')](_0x295f67[_0x309c('0x47')],qs[_0x309c('0x4b')](_0x221510['query'][_0x309c('0x4b')]));_0x4974d1[_0x309c('0x4c')]=_0x4974d1[_0x309c('0x4c')][_0x309c('0x4d')]?_0x4974d1[_0x309c('0x4c')]:_0x295f67['model'];if(!_0x221510[_0x309c('0x4a')]['hasOwnProperty'](_0x309c('0x4e'))){_0x4974d1[_0x309c('0x34')]=qs[_0x309c('0x34')](_0x221510['query'][_0x309c('0x34')]);_0x4974d1[_0x309c('0x36')]=qs[_0x309c('0x36')](_0x221510['query'][_0x309c('0x36')]);}_0x4974d1[_0x309c('0x4f')]=qs[_0x309c('0x50')](_0x221510['query']['sort']);_0x4974d1[_0x309c('0x51')]=qs[_0x309c('0x48')](_[_0x309c('0x52')](_0x221510[_0x309c('0x4a')],_0x295f67['filters']),_0x282488);if(_0x221510[_0x309c('0x4a')][_0x309c('0x53')]){_0x4974d1['where']=_[_0x309c('0x54')](_0x4974d1[_0x309c('0x51')],{'$or':_[_0x309c('0x43')](_0x282488,function(_0x4f85bd){if(_0x4f85bd[_0x309c('0x46')]!=='VIRTUAL'){var _0x48128b={};_0x48128b[_0x4f85bd['name']]={'$like':'%'+_0x221510[_0x309c('0x4a')][_0x309c('0x53')]+'%'};return _0x48128b;}})});}_0x4974d1=_[_0x309c('0x54')]({},_0x4974d1,_0x221510['options']);var _0xff07a7={'where':_0x4974d1['where']};return db['ChatWebsite'][_0x309c('0x35')](_0xff07a7)[_0x309c('0x24')](function(_0x24bcfc){_0x2d50c9['count']=_0x24bcfc;if(_0x221510['query'][_0x309c('0x55')]){_0x4974d1[_0x309c('0x56')]=[{'all':!![]}];}return db[_0x309c('0x44')]['findAll'](_0x4974d1);})['then'](function(_0x35492c){_0x2d50c9[_0x309c('0x57')]=_0x35492c;return _0x2d50c9;})[_0x309c('0x24')](respondWithFilteredResult(_0x3ab85c,_0x4974d1))[_0x309c('0x2e')](handleError(_0x3ab85c,null));};exports['show']=function(_0x3fa75b,_0x47e2bf){var _0x45e725={'raw':![],'where':{'id':_0x3fa75b[_0x309c('0x58')]['id']},'include':[{'model':db[_0x309c('0x42')],'as':_0x309c('0x59')}]},_0x1ae23a={};_0x1ae23a[_0x309c('0x47')]=_[_0x309c('0x5a')](db[_0x309c('0x44')][_0x309c('0x45')]);_0x1ae23a['query']=_[_0x309c('0x5a')](_0x3fa75b[_0x309c('0x4a')]);_0x1ae23a[_0x309c('0x48')]=_[_0x309c('0x49')](_0x1ae23a[_0x309c('0x47')],_0x1ae23a[_0x309c('0x4a')]);_0x45e725[_0x309c('0x4c')]=_[_0x309c('0x49')](_0x1ae23a[_0x309c('0x47')],qs[_0x309c('0x4b')](_0x3fa75b['query'][_0x309c('0x4b')]));_0x45e725[_0x309c('0x4c')]=_0x45e725[_0x309c('0x4c')][_0x309c('0x4d')]?_0x45e725['attributes']:_0x1ae23a[_0x309c('0x47')];if(_0x3fa75b[_0x309c('0x4a')][_0x309c('0x55')]){_0x45e725[_0x309c('0x56')]=[{'all':!![]}];}_0x45e725=_[_0x309c('0x54')]({},_0x45e725,_0x3fa75b[_0x309c('0x5b')]);return db[_0x309c('0x44')][_0x309c('0x5c')](_0x45e725)[_0x309c('0x24')](handleEntityNotFound(_0x47e2bf,null))[_0x309c('0x24')](respondWithResult(_0x47e2bf,null))[_0x309c('0x2e')](handleError(_0x47e2bf,null));};exports[_0x309c('0x5d')]=function(_0x13260b,_0x1d761c){return db[_0x309c('0x44')]['create'](_0x13260b[_0x309c('0x5e')],{})[_0x309c('0x24')](function(_0x431ac2){var _0x247606=_0x13260b[_0x309c('0x5f')]['get']({'plain':!![]});if(!_0x247606)throw new Error(_0x309c('0x60'));if(_0x247606[_0x309c('0x61')]===_0x309c('0x5f')){var _0x133301=_0x431ac2[_0x309c('0x3d')]({'plain':!![]});var _0x2ac95d=_0x309c('0x3e');return db['UserProfileSection'][_0x309c('0x5c')]({'where':{'name':_0x2ac95d,'userProfileId':_0x247606[_0x309c('0x62')]},'raw':!![]})[_0x309c('0x24')](function(_0x1db9ec){if(_0x1db9ec&&_0x1db9ec[_0x309c('0x63')]===0x0){return db[_0x309c('0x64')][_0x309c('0x5d')]({'name':_0x133301[_0x309c('0x3f')],'resourceId':_0x133301['id'],'type':_0x1db9ec[_0x309c('0x3f')],'sectionId':_0x1db9ec['id']},{})['then'](function(){return _0x431ac2;});}else{return _0x431ac2;}})[_0x309c('0x2e')](function(_0xdfd01f){logger[_0x309c('0x29')](_0x309c('0x65'),_0xdfd01f);throw _0xdfd01f;});}return _0x431ac2;})[_0x309c('0x24')](respondWithResult(_0x1d761c,0xc9))['catch'](handleError(_0x1d761c,null));};exports['update']=function(_0x3bd300,_0x1c2f34){if(_0x3bd300[_0x309c('0x5e')]['id']){delete _0x3bd300[_0x309c('0x5e')]['id'];}return db[_0x309c('0x44')][_0x309c('0x5c')]({'where':{'id':_0x3bd300[_0x309c('0x58')]['id']},'include':[{'model':db[_0x309c('0x42')],'as':_0x309c('0x59')}]})['then'](handleEntityNotFound(_0x1c2f34,null))[_0x309c('0x24')](saveUpdates(_0x3bd300['body'],null))[_0x309c('0x24')](respondWithResult(_0x1c2f34,null))[_0x309c('0x2e')](handleError(_0x1c2f34,null));};exports[_0x309c('0x3c')]=function(_0x87e8e,_0xc45c10){return db['ChatWebsite']['find']({'where':{'id':_0x87e8e[_0x309c('0x58')]['id']}})['then'](handleEntityNotFound(_0xc45c10,null))[_0x309c('0x24')](removeEntity(_0xc45c10,null))[_0x309c('0x2e')](handleError(_0xc45c10,null));};exports['describe']=function(_0x54a3c6,_0x2fe2ed){return db[_0x309c('0x44')][_0x309c('0x66')]()[_0x309c('0x24')](respondWithResult(_0x2fe2ed,null))[_0x309c('0x2e')](handleError(_0x2fe2ed,null));};exports[_0x309c('0x67')]=function(_0x4548f3,_0x22c014,_0x43613f){if(_0x4548f3[_0x309c('0x5e')]['id']){delete _0x4548f3[_0x309c('0x5e')]['id'];}return db[_0x309c('0x44')][_0x309c('0x5c')]({'where':{'id':_0x4548f3[_0x309c('0x58')]['id']}})['then'](handleEntityNotFound(_0x22c014,null))[_0x309c('0x24')](function(_0x17c8e5){if(_0x17c8e5){_0x4548f3[_0x309c('0x5e')][_0x309c('0x68')]=_0x17c8e5['id'];return db[_0x309c('0x69')][_0x309c('0x5d')](_0x4548f3[_0x309c('0x5e')]);}})[_0x309c('0x24')](respondWithResult(_0x22c014,null))[_0x309c('0x2e')](handleError(_0x22c014,null));};exports[_0x309c('0x6a')]=function(_0x414b49,_0x57ea8f,_0x569f7f){var _0x4ded41={'raw':![],'where':{}};var _0x2b8736={};var _0x38cbfd={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x309c('0x6b')]({'where':{'id':_0x414b49[_0x309c('0x58')]['id']}})[_0x309c('0x24')](handleEntityNotFound(_0x57ea8f,null))[_0x309c('0x24')](function(_0xed9c6){if(_0xed9c6){_0x2b8736['model']=_['keys'](db['Disposition'][_0x309c('0x45')]);_0x2b8736[_0x309c('0x4a')]=_['keys'](_0x414b49['query']);_0x2b8736['filters']=_['intersection'](_0x2b8736[_0x309c('0x47')],_0x2b8736[_0x309c('0x4a')]);_0x4ded41[_0x309c('0x4c')]=_[_0x309c('0x49')](_0x2b8736[_0x309c('0x47')],qs[_0x309c('0x4b')](_0x414b49[_0x309c('0x4a')][_0x309c('0x4b')]));_0x4ded41[_0x309c('0x4c')]=_0x4ded41['attributes'][_0x309c('0x4d')]?_0x4ded41['attributes']:_0x2b8736[_0x309c('0x47')];if(!_0x414b49[_0x309c('0x4a')][_0x309c('0x6c')](_0x309c('0x4e'))){_0x4ded41[_0x309c('0x34')]=qs[_0x309c('0x34')](_0x414b49['query'][_0x309c('0x34')]);_0x4ded41['offset']=qs[_0x309c('0x36')](_0x414b49['query'][_0x309c('0x36')]);}_0x4ded41[_0x309c('0x4f')]=qs['sort'](_0x414b49[_0x309c('0x4a')][_0x309c('0x50')]);_0x4ded41[_0x309c('0x51')]=qs[_0x309c('0x48')](_[_0x309c('0x52')](_0x414b49[_0x309c('0x4a')],_0x2b8736[_0x309c('0x48')]));_0x4ded41[_0x309c('0x51')][_0x309c('0x68')]=_0xed9c6['id'];if(_0x414b49['query']['filter']){_0x4ded41[_0x309c('0x51')]=_[_0x309c('0x54')](_0x4ded41[_0x309c('0x51')],{'$or':_[_0x309c('0x43')](_0x4ded41[_0x309c('0x4c')],function(_0x4a4502){var _0x27cca5={};_0x27cca5[_0x4a4502]={'$like':'%'+_0x414b49[_0x309c('0x4a')]['filter']+'%'};return _0x27cca5;})});}_0x4ded41=_[_0x309c('0x54')]({},_0x4ded41,_0x414b49[_0x309c('0x5b')]);return db[_0x309c('0x69')]['count']({'where':_0x4ded41[_0x309c('0x51')]})[_0x309c('0x24')](function(_0x5b5a87){_0x38cbfd[_0x309c('0x35')]=_0x5b5a87;if(_0x414b49['query']['includeAll']){_0x4ded41['include']=[{'all':!![]}];}return db[_0x309c('0x69')][_0x309c('0x6d')](_0x4ded41);})[_0x309c('0x24')](function(_0x2b2a7b){_0x38cbfd[_0x309c('0x57')]=_0x2b2a7b;return _0x38cbfd;});}})[_0x309c('0x24')](respondWithFilteredResult(_0x57ea8f,_0x4ded41))['catch'](handleError(_0x57ea8f,null));};exports['removeDispositions']=function(_0xadce85,_0x324c01,_0x5f586c){return db['ChatWebsite'][_0x309c('0x5c')]({'where':{'id':_0xadce85[_0x309c('0x58')]['id']}})[_0x309c('0x24')](handleEntityNotFound(_0x324c01,null))['then'](function(_0x23bede){if(_0x23bede){return _0x23bede[_0x309c('0x6e')](_0xadce85[_0x309c('0x4a')][_0x309c('0x6f')]);}})['then'](respondWithStatusCode(_0x324c01,null))[_0x309c('0x2e')](handleError(_0x324c01,null));};exports['addAnswer']=function(_0x126649,_0x2a450f,_0x1b46a6){if(_0x126649[_0x309c('0x5e')]['id']){delete _0x126649[_0x309c('0x5e')]['id'];}return db[_0x309c('0x44')][_0x309c('0x5c')]({'where':{'id':_0x126649['params']['id']}})[_0x309c('0x24')](handleEntityNotFound(_0x2a450f,null))[_0x309c('0x24')](function(_0x139c21){if(_0x139c21){_0x126649[_0x309c('0x5e')][_0x309c('0x68')]=_0x139c21['id'];return db[_0x309c('0x70')][_0x309c('0x5d')](_0x126649[_0x309c('0x5e')]);}})[_0x309c('0x24')](respondWithResult(_0x2a450f,null))[_0x309c('0x2e')](handleError(_0x2a450f,null));};exports[_0x309c('0x71')]=function(_0x244c26,_0x4e2445,_0x325d9a){var _0x15e4be={'raw':![],'where':{}};var _0x40fe65={};var _0x4cba20={'count':0x0,'rows':[]};return db[_0x309c('0x44')][_0x309c('0x6b')]({'where':{'id':_0x244c26[_0x309c('0x58')]['id']}})[_0x309c('0x24')](handleEntityNotFound(_0x4e2445,null))[_0x309c('0x24')](function(_0x31a23d){if(_0x31a23d){_0x40fe65['model']=_[_0x309c('0x5a')](db[_0x309c('0x70')][_0x309c('0x45')]);_0x40fe65[_0x309c('0x4a')]=_[_0x309c('0x5a')](_0x244c26[_0x309c('0x4a')]);_0x40fe65[_0x309c('0x48')]=_[_0x309c('0x49')](_0x40fe65[_0x309c('0x47')],_0x40fe65[_0x309c('0x4a')]);_0x15e4be[_0x309c('0x4c')]=_[_0x309c('0x49')](_0x40fe65[_0x309c('0x47')],qs[_0x309c('0x4b')](_0x244c26[_0x309c('0x4a')][_0x309c('0x4b')]));_0x15e4be[_0x309c('0x4c')]=_0x15e4be[_0x309c('0x4c')]['length']?_0x15e4be[_0x309c('0x4c')]:_0x40fe65[_0x309c('0x47')];if(!_0x244c26['query'][_0x309c('0x6c')]('nolimit')){_0x15e4be[_0x309c('0x34')]=qs[_0x309c('0x34')](_0x244c26[_0x309c('0x4a')]['limit']);_0x15e4be[_0x309c('0x36')]=qs[_0x309c('0x36')](_0x244c26[_0x309c('0x4a')][_0x309c('0x36')]);}_0x15e4be['order']=qs[_0x309c('0x50')](_0x244c26[_0x309c('0x4a')][_0x309c('0x50')]);_0x15e4be[_0x309c('0x51')]=qs['filters'](_[_0x309c('0x52')](_0x244c26['query'],_0x40fe65[_0x309c('0x48')]));_0x15e4be['where'][_0x309c('0x68')]=_0x31a23d['id'];if(_0x244c26[_0x309c('0x4a')]['filter']){_0x15e4be[_0x309c('0x51')]=_['merge'](_0x15e4be[_0x309c('0x51')],{'$or':_[_0x309c('0x43')](_0x15e4be[_0x309c('0x4c')],function(_0x1152a2){var _0x289f1a={};_0x289f1a[_0x1152a2]={'$like':'%'+_0x244c26[_0x309c('0x4a')][_0x309c('0x53')]+'%'};return _0x289f1a;})});}_0x15e4be=_[_0x309c('0x54')]({},_0x15e4be,_0x244c26[_0x309c('0x5b')]);return db['CannedAnswer'][_0x309c('0x35')]({'where':_0x15e4be[_0x309c('0x51')]})[_0x309c('0x24')](function(_0x106814){_0x4cba20[_0x309c('0x35')]=_0x106814;if(_0x244c26['query']['includeAll']){_0x15e4be[_0x309c('0x56')]=[{'all':!![]}];}return db[_0x309c('0x70')][_0x309c('0x6d')](_0x15e4be);})[_0x309c('0x24')](function(_0x85f456){_0x4cba20[_0x309c('0x57')]=_0x85f456;return _0x4cba20;});}})[_0x309c('0x24')](respondWithFilteredResult(_0x4e2445,_0x15e4be))[_0x309c('0x2e')](handleError(_0x4e2445,null));};exports[_0x309c('0x72')]=function(_0x26fb9e,_0x2ebcfc,_0x120a11){return db[_0x309c('0x44')][_0x309c('0x5c')]({'where':{'id':_0x26fb9e[_0x309c('0x58')]['id']}})['then'](handleEntityNotFound(_0x2ebcfc,null))[_0x309c('0x24')](function(_0x21adb4){if(_0x21adb4){return _0x21adb4[_0x309c('0x72')](_0x26fb9e[_0x309c('0x4a')]['ids']);}})['then'](respondWithStatusCode(_0x2ebcfc,null))[_0x309c('0x2e')](handleError(_0x2ebcfc,null));};exports['addLogo']=function(_0x1100bd,_0x1f1e46,_0x420734){_0x1100bd[_0x309c('0x5e')]['sitepic']=_0x1100bd[_0x309c('0x73')][_0x309c('0x74')];return db[_0x309c('0x44')]['find']({'where':{'id':_0x1100bd[_0x309c('0x58')]['id']}})[_0x309c('0x24')](handleEntityNotFound(_0x1f1e46,null))['then'](saveUpdates(_0x1100bd[_0x309c('0x5e')],null))[_0x309c('0x24')](respondWithResult(_0x1f1e46,null))[_0x309c('0x2e')](handleError(_0x1f1e46,null));};exports[_0x309c('0x75')]=function(_0x4d2ed9,_0x4a8faa,_0x5d6431){_0x4d2ed9['body'][_0x309c('0x76')]=_0x4d2ed9[_0x309c('0x73')][_0x309c('0x74')];return db[_0x309c('0x44')]['find']({'where':{'id':_0x4d2ed9[_0x309c('0x58')]['id']}})[_0x309c('0x24')](handleEntityNotFound(_0x4a8faa,null))[_0x309c('0x24')](saveUpdates(_0x4d2ed9[_0x309c('0x5e')],null))['then'](respondWithResult(_0x4a8faa,null))[_0x309c('0x2e')](handleError(_0x4a8faa,null));};exports[_0x309c('0x77')]=function(_0x295207,_0xf8ae6a,_0x4bab8d){_0x295207[_0x309c('0x5e')]['customerAvatar']=_0x295207['file']['filename'];return db[_0x309c('0x44')][_0x309c('0x5c')]({'where':{'id':_0x295207['params']['id']}})[_0x309c('0x24')](handleEntityNotFound(_0xf8ae6a,null))[_0x309c('0x24')](saveUpdates(_0x295207[_0x309c('0x5e')],null))[_0x309c('0x24')](respondWithResult(_0xf8ae6a,null))[_0x309c('0x2e')](handleError(_0xf8ae6a,null));};exports[_0x309c('0x78')]=function(_0x530e1c,_0x189a3b,_0x235830){_0x530e1c[_0x309c('0x5e')][_0x309c('0x79')]=_0x530e1c[_0x309c('0x73')][_0x309c('0x74')];return db[_0x309c('0x44')][_0x309c('0x5c')]({'where':{'id':_0x530e1c[_0x309c('0x58')]['id']}})[_0x309c('0x24')](handleEntityNotFound(_0x189a3b,null))[_0x309c('0x24')](saveUpdates(_0x530e1c['body'],null))[_0x309c('0x24')](respondWithResult(_0x189a3b,null))['catch'](handleError(_0x189a3b,null));};exports[_0x309c('0x7a')]=function(_0x49b762,_0x3b29a1,_0x43bad6){var _0x3600cc=path[_0x309c('0x7b')](config[_0x309c('0x7c')],_0x309c('0x7d'));var _0xc42645={'where':{'id':_0x49b762['params']['id']},'attributes':['id',_0x309c('0x7e')],'raw':!![]};var _0x1f5ac8=![];return require(_0x309c('0x19'))[_0x309c('0x7f')]()[_0x309c('0x24')](function(_0x3f5caf){if(_0x3f5caf){_0x1f5ac8=_0x3f5caf[_0x309c('0x80')];}})[_0x309c('0x24')](function(){return db[_0x309c('0x44')][_0x309c('0x5c')](_0xc42645);})[_0x309c('0x24')](handleEntityNotFound(_0x3b29a1,null))[_0x309c('0x24')](function(_0x43eef8){if(_0x43eef8){if(!_['isNil'](_0x43eef8[_0x309c('0x7e')])){if(fs['existsSync'](path[_0x309c('0x7b')](config[_0x309c('0x7c')],_0x309c('0x81'),_0x43eef8[_0x309c('0x7e')]))&&_0x1f5ac8){_0x3600cc=path[_0x309c('0x7b')](config['root'],_0x309c('0x81'),_0x43eef8[_0x309c('0x7e')]);}}return _0x3b29a1[_0x309c('0x82')](_0x3600cc);}})[_0x309c('0x2e')](handleError(_0x3b29a1,null));};exports[_0x309c('0x83')]=function(_0xf9f19a,_0x438ddf,_0x2fbd1c){var _0x35f2af=path[_0x309c('0x7b')](config['root'],'server/files/images/avatars/default_avatar.png');var _0x3d9594={'where':{'id':_0xf9f19a[_0x309c('0x58')]['id']},'attributes':['id',_0x309c('0x76')],'raw':!![]};return db['ChatWebsite']['find'](_0x3d9594)[_0x309c('0x24')](handleEntityNotFound(_0x438ddf,null))[_0x309c('0x24')](function(_0x311535){if(_0x311535){if(!_[_0x309c('0x84')](_0x311535[_0x309c('0x76')])){if(fs[_0x309c('0x85')](path[_0x309c('0x7b')](config['root'],_0x309c('0x86'),_0x311535['agentAvatar']))){_0x35f2af=path[_0x309c('0x7b')](config[_0x309c('0x7c')],_0x309c('0x86'),_0x311535['agentAvatar']);}}return _0x438ddf[_0x309c('0x82')](_0x35f2af);}})[_0x309c('0x2e')](handleError(_0x438ddf,null));};exports[_0x309c('0x87')]=function(_0x32d700,_0x3fb417,_0x433651){var _0x30410f=path[_0x309c('0x7b')](config[_0x309c('0x7c')],'server/files/images/avatars/customer_avatar.png');var _0x348682={'where':{'id':_0x32d700['params']['id']},'attributes':['id','customerAvatar',_0x309c('0x88')],'raw':!![]};return db[_0x309c('0x44')][_0x309c('0x5c')](_0x348682)['then'](handleEntityNotFound(_0x3fb417,null))['then'](function(_0x512590){if(_0x512590){if(!_['isNil'](_0x512590[_0x309c('0x89')])){if(fs[_0x309c('0x85')](path[_0x309c('0x7b')](config[_0x309c('0x7c')],_0x309c('0x86'),_0x512590[_0x309c('0x89')]))&&_0x512590[_0x309c('0x88')]){_0x30410f=path[_0x309c('0x7b')](config[_0x309c('0x7c')],_0x309c('0x86'),_0x512590[_0x309c('0x89')]);}}return _0x3fb417[_0x309c('0x82')](_0x30410f);}})[_0x309c('0x2e')](handleError(_0x3fb417,null));};exports['getSystemAvatar']=function(_0x42bbcd,_0x4bf21e,_0x3b580f){var _0x2ee870=path['join'](config[_0x309c('0x7c')],_0x309c('0x8a'));var _0x174177={'where':{'id':_0x42bbcd[_0x309c('0x58')]['id']},'attributes':['id',_0x309c('0x79')],'raw':!![]};return db['ChatWebsite'][_0x309c('0x5c')](_0x174177)['then'](handleEntityNotFound(_0x4bf21e,null))[_0x309c('0x24')](function(_0x384d3c){if(_0x384d3c){if(!_[_0x309c('0x84')](_0x384d3c[_0x309c('0x79')])){if(fs[_0x309c('0x85')](path[_0x309c('0x7b')](config['root'],_0x309c('0x86'),_0x384d3c[_0x309c('0x79')]))){_0x2ee870=path[_0x309c('0x7b')](config['root'],_0x309c('0x86'),_0x384d3c[_0x309c('0x79')]);}}return _0x4bf21e[_0x309c('0x82')](_0x2ee870);}})[_0x309c('0x2e')](handleError(_0x4bf21e,null));};exports[_0x309c('0x8b')]=function(_0x1a8c12,_0x2bce5e,_0x242e91){var _0x344173=require(_0x309c('0x8c'));var _0x3836db=new _0x344173();var _0x509206=_0x3836db[_0x309c('0x8d')](_0x1a8c12[_0x309c('0x8e')][_0x309c('0x8f')])['getResult']();var _0x211809={'body':_0x1a8c12['body'],'channel':'chat'};var _0x5545dd=[];var _0x11b965=[];var _0x5b2086={};var _0x8dc2db=![];return db['CmContact']['describe']()[_0x309c('0x24')](function(_0x133393){if(!_0x133393){throw new db[(_0x309c('0x90'))][(_0x309c('0x91'))]('no\x20available\x20attributes');}_0x5545dd=_[_0x309c('0x92')](_['keys'](_0x133393),[_0x309c('0x93'),_0x309c('0x94')]);_0x11b965=_['difference'](_[_0x309c('0x5a')](_0x133393),[_0x309c('0x93'),_0x309c('0x94'),_0x309c('0x95'),'ListId']);if(_0x1a8c12[_0x309c('0x5e')]['id']){delete _0x1a8c12[_0x309c('0x5e')]['id'];}if(_[_0x309c('0x84')](_0x1a8c12[_0x309c('0x5e')][_0x309c('0x96')])){throw new db[(_0x309c('0x90'))]['ValidationError'](_0x309c('0x97'));}if(_[_0x309c('0x84')](_0x1a8c12[_0x309c('0x5e')][_0x309c('0x5e')])||_0x1a8c12[_0x309c('0x5e')]['body']===''){throw new db[(_0x309c('0x90'))][(_0x309c('0x91'))](_0x309c('0x98'));}if(_[_0x309c('0x84')](_0x1a8c12[_0x309c('0x5e')][_0x309c('0x99')])){throw new db[(_0x309c('0x90'))][(_0x309c('0x91'))](_0x309c('0x9a')+_0x11b965);}if(!_['includes'](_0x11b965,_0x1a8c12[_0x309c('0x5e')][_0x309c('0x99')])){throw new db['Sequelize']['ValidationError'](_0x309c('0x9b')+_0x11b965);}_0x5b2086[_0x1a8c12[_0x309c('0x5e')][_0x309c('0x99')]]=_0x1a8c12[_0x309c('0x5e')][_0x309c('0x96')];})['then'](function(){return db[_0x309c('0x44')][_0x309c('0x5c')]({'where':{'id':_0x1a8c12[_0x309c('0x58')]['id']},'include':[{'model':db[_0x309c('0x9c')],'as':_0x309c('0x9d'),'include':[{'model':db['CmContact'],'as':_0x309c('0x9e'),'where':_0x5b2086,'limit':0x1,'order':[[_0x309c('0x94'),_0x309c('0x9f')]]}]},{'model':db['ChatApplication'],'as':_0x309c('0xa0')}]});})[_0x309c('0x24')](handleEntityNotFound(_0x2bce5e,null))[_0x309c('0x24')](function(_0x16fa1){if(_0x16fa1&&_0x16fa1[_0x309c('0x9d')]){_0x211809[_0x309c('0xa1')]=_0x16fa1;_0x211809[_0x309c('0xa2')]=_0x16fa1[_0x309c('0xa0')];_0x211809[_0x309c('0xa3')]=_0x16fa1['List'];_0x211809[_0x309c('0xa2')]=_['orderBy'](_0x211809[_0x309c('0xa2')],[_0x309c('0xa4')],[_0x309c('0xa5')]);if(_0x211809[_0x309c('0xa1')][_0x309c('0xa0')]){delete _0x211809['account']['Applications'];}if(_0x211809[_0x309c('0xa1')][_0x309c('0x9d')]&&_0x211809['account'][_0x309c('0x9d')][_0x309c('0x9e')][_0x309c('0x4d')]){return _0x211809[_0x309c('0xa1')][_0x309c('0x9d')][_0x309c('0x9e')][0x0];}var _0x575749=_[_0x309c('0x1c')](_0x1a8c12['body'],{'firstName':_0x1a8c12[_0x309c('0x5e')]['from'],'ListId':_0x16fa1['ListId']});_0x575749[_0x1a8c12['body'][_0x309c('0x99')]]=_0x1a8c12[_0x309c('0x5e')][_0x309c('0x96')];return db[_0x309c('0xa6')][_0x309c('0x5d')](_0x575749,{'fields':_0x5545dd,'raw':!![]});}})[_0x309c('0x24')](handleEntityNotFound(_0x2bce5e,null))['then'](function(_0x326a36){_0x211809[_0x309c('0xa7')]=_0x326a36;var _0xdb2e52=_0x1a8c12['body'][_0x309c('0xa8')];if(_0x1a8c12['headers'][_0x309c('0xa9')]){_0xdb2e52=_0x1a8c12[_0x309c('0x8e')][_0x309c('0xa9')];}else if(_0x1a8c12[_0x309c('0x8e')][_0x309c('0xaa')]){_0xdb2e52=_[_0x309c('0xab')](_0x1a8c12[_0x309c('0x8e')][_0x309c('0xaa')][_0x309c('0xac')](','));}if(_0x326a36){var _0x1af9d3={'ContactId':_0x326a36['id'],'ChatWebsiteId':_0x1a8c12[_0x309c('0x58')]['id'],'from':(_0x326a36[_0x309c('0xad')]||'')+'\x20'+(_0x326a36[_0x309c('0xae')]||''),'customerIp':_0xdb2e52,'customerPort':_0x1a8c12[_0x309c('0x8e')]['x-real-port']?_0x1a8c12['headers'][_0x309c('0xaf')]:null,'referer':_0x1a8c12['body'][_0x309c('0xb0')],'browserName':_0x509206[_0x309c('0xb1')]['name']&&_0x509206[_0x309c('0xb1')]['version']?util['format'](_0x309c('0xb2'),_0x509206[_0x309c('0xb1')][_0x309c('0x3f')],_0x509206[_0x309c('0xb1')][_0x309c('0xb3')]):'unknown','browserVersion':_0x509206[_0x309c('0xb1')][_0x309c('0xb3')]||_0x309c('0xb4'),'osName':util[_0x309c('0xb5')](_0x309c('0xb2'),_0x509206['os']['name'],_0x509206['os'][_0x309c('0xb3')]),'osVersion':_0x509206['os'][_0x309c('0xb3')],'deviceModel':_0x509206['device'][_0x309c('0x47')]&&_0x509206[_0x309c('0xb6')]['vendor']?util[_0x309c('0xb5')](_0x309c('0xb7'),_0x509206[_0x309c('0xb6')][_0x309c('0x47')],_0x509206[_0x309c('0xb6')][_0x309c('0xb8')],_0x509206[_0x309c('0xb6')][_0x309c('0x46')]):null,'deviceVendor':_0x509206[_0x309c('0xb6')][_0x309c('0xb8')],'deviceType':_0x509206[_0x309c('0xb6')][_0x309c('0x46')],'formData':JSON[_0x309c('0xb9')](_0x1a8c12[_0x309c('0x5e')])};var _0x3eae38={'ChatWebsiteId':_0x1a8c12[_0x309c('0x58')]['id'],'closed':![]};if(_0x1a8c12[_0x309c('0x5e')][_0x309c('0xba')]){_0x3eae38[_0x309c('0xba')]=_0x1a8c12['body'][_0x309c('0xba')];return db['ChatInteraction']['find']({'where':_0x3eae38})[_0x309c('0x24')](function(_0x23b1c8){if(_0x23b1c8){return[_0x23b1c8,![]];}_0x1af9d3[_0x309c('0xba')]=_0x1a8c12[_0x309c('0x5e')]['threadId'];_0x1af9d3[_0x309c('0xbb')]=_0x1a8c12[_0x309c('0x5e')][_0x309c('0xbb')];return db['ChatInteraction'][_0x309c('0x5d')](_0x1af9d3)[_0x309c('0x24')](function(_0x35a5df){return[_0x35a5df,!![]];});});}_0x3eae38[_0x309c('0xbc')]=_0x326a36['id'];if(_0x1a8c12[_0x309c('0x5e')]['interaction']&&_0x1a8c12[_0x309c('0x5e')][_0x309c('0xbd')]['id']){_0x3eae38['id']=_0x1a8c12['body'][_0x309c('0xbd')]['id'];return db[_0x309c('0xbe')]['find']({'where':_0x3eae38})[_0x309c('0x24')](function(_0x2c228c){if(_0x2c228c){return[_0x2c228c,![]];}return db['ChatInteraction']['create'](_0x1af9d3)[_0x309c('0x24')](function(_0x75f518){return[_0x75f518,!![]];});});}return db['ChatInteraction']['create'](_0x1af9d3)[_0x309c('0x24')](function(_0x503bcc){return[_0x503bcc,!![]];});}})[_0x309c('0xbf')](function(_0x472475,_0x3aad3d){if(_0x472475){_0x8dc2db=_0x3aad3d;if(!_0x3aad3d){var _0x2c26e2={'from':(_0x211809['contact'][_0x309c('0xad')]||'')+'\x20'+(_0x211809[_0x309c('0xa7')][_0x309c('0xae')]||'')};if(_0x1a8c12[_0x309c('0x5e')][_0x309c('0xba')]&&_0x1a8c12[_0x309c('0x5e')][_0x309c('0xc0')]&&_0x1a8c12[_0x309c('0x5e')][_0x309c('0xba')]!=_0x1a8c12[_0x309c('0x5e')][_0x309c('0xc0')]){_0x2c26e2['threadId']=_0x1a8c12[_0x309c('0x5e')][_0x309c('0xc0')];}return _0x472475[_0x309c('0x3b')](_0x2c26e2);}else{return _0x472475;}}})[_0x309c('0x24')](function(_0x372c96){_0x211809[_0x309c('0xbd')]=_0x372c96[_0x309c('0x3d')]({'plain':!![]});_0x211809[_0x309c('0xbd')][_0x309c('0xc1')]=_0x8dc2db;if(_0x211809['interaction']['created']){if(_0x211809[_0x309c('0xa1')][_0x309c('0xc2')]){_0x211809['applications'][_0x309c('0xc3')]({'id':0x0,'priority':_0x211809[_0x309c('0xa2')]['length']+0x1,'app':_0x309c('0xc4'),'appdata':_0x309c('0xc5'),'interval':'*,*,*,*'});}}return db[_0x309c('0xc6')][_0x309c('0x5d')]({'body':_0x1a8c12['body'][_0x309c('0x5e')],'ChatWebsiteId':_0x1a8c12[_0x309c('0x58')]['id'],'ChatInteractionId':_0x372c96['id'],'direction':'in','ContactId':_0x211809['contact']['id'],'AttachmentId':_0x1a8c12['body'][_0x309c('0xc7')]});})[_0x309c('0x24')](function(_0xc2fb52){_0x211809[_0x309c('0x2b')]=_0xc2fb52;if(_0x211809[_0x309c('0xbd')][_0x309c('0xc8')]){return db['User'][_0x309c('0x5c')]({'attributes':['id',_0x309c('0x3f')],'where':{'id':_0x211809['interaction'][_0x309c('0xc8')]}})['then'](function(_0x4600c8){if(_0x4600c8){_0x211809[_0x309c('0xa2')]['unshift']({'id':0x0,'priority':0x0,'app':_0x309c('0xc9'),'appdata':_0x4600c8['name']+','+(_0x211809['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x211809[_0x309c('0xca')]=!![];}return respondWithRpcPromise('Start','startRouting',_0x211809);});}return respondWithRpcPromise(_0x309c('0xcb'),'startRouting',_0x211809);})[_0x309c('0x24')](function(_0x5455b9){respondWithRpcPromise(_0x309c('0xcc'),_0x309c('0xcc'),{'event':_0x309c('0x8b'),'message':_0x5455b9},client9002);return _0x5455b9;})['then'](respondWithResult(_0x2bce5e,null))[_0x309c('0x2e')](handleError(_0x2bce5e,null));};exports[_0x309c('0xcd')]=function(_0x8bcc71,_0x170646,_0x4f6f54){var _0x58c85a,_0x4aa977,_0x7e6739;var _0x337b25=[];var _0x3eea10=[];var _0x395b92={};var _0x3ebd0c=_0x8bcc71[_0x309c('0xce')]||[];var _0x45cce5=[];var _0x26f3cf;return db[_0x309c('0xa6')][_0x309c('0x66')]()[_0x309c('0x24')](function(_0xbd3bcb){if(!_0xbd3bcb){throw new db[(_0x309c('0x90'))]['ValidationError'](_0x309c('0xcf'));}_0x3eea10=_[_0x309c('0x92')](_[_0x309c('0x5a')](_0xbd3bcb),[_0x309c('0x93'),'updatedAt']);_0x337b25=_[_0x309c('0x92')](_[_0x309c('0x5a')](_0xbd3bcb),['createdAt',_0x309c('0x94'),'CompanyId','ListId']);if(_0x8bcc71[_0x309c('0x5e')]['id']){delete _0x8bcc71[_0x309c('0x5e')]['id'];}if(_[_0x309c('0x84')](_0x8bcc71['body'][_0x309c('0x96')])){throw _0x170646[_0x309c('0x30')](0x1f4)[_0x309c('0x40')](new db['Sequelize']['ValidationError']('from\x20is\x20mandatory'));}if(_['isNil'](_0x8bcc71[_0x309c('0x5e')][_0x309c('0x5e')])||_0x8bcc71['body'][_0x309c('0x5e')]===''){throw _0x170646[_0x309c('0x30')](0x1f4)[_0x309c('0x40')](new db[(_0x309c('0x90'))][(_0x309c('0x91'))](_0x309c('0x98')));}if(_[_0x309c('0x84')](_0x8bcc71[_0x309c('0x5e')][_0x309c('0xd0')])){throw _0x170646[_0x309c('0x30')](0x1f4)[_0x309c('0x40')](new db[(_0x309c('0x90'))][(_0x309c('0x91'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x337b25));}if(!_[_0x309c('0xd1')](_0x337b25,_0x8bcc71[_0x309c('0x5e')][_0x309c('0xd0')])){throw _0x170646[_0x309c('0x30')](0x1f4)[_0x309c('0x40')](new db['Sequelize'][(_0x309c('0x91'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x337b25));}_0x395b92[_0x8bcc71[_0x309c('0x5e')][_0x309c('0xd0')]]=_0x8bcc71['body'][_0x309c('0x96')];})['then'](function(){return db[_0x309c('0x44')][_0x309c('0x5c')]({'where':{'id':_0x8bcc71[_0x309c('0x58')]['id']},'include':[{'model':db[_0x309c('0x9c')],'as':_0x309c('0x9d')},{'model':db[_0x309c('0xd2')],'as':_0x309c('0xd2')}]});})[_0x309c('0x24')](handleEntityNotFound(_0x170646,null))[_0x309c('0x24')](function(_0x5a95a8){if(_0x5a95a8&&_0x5a95a8[_0x309c('0x9d')]){_0x4aa977=_0x5a95a8;var _0x513e88=_[_0x309c('0x1c')](_0x8bcc71['body'],{'firstName':_0x8bcc71[_0x309c('0x5e')][_0x309c('0x96')],'phone':_0x8bcc71[_0x309c('0x5e')][_0x309c('0x96')],'ListId':_0x5a95a8[_0x309c('0xd3')]});_0x513e88[_0x8bcc71[_0x309c('0x5e')]['mapKeyOffline']]=_0x8bcc71[_0x309c('0x5e')][_0x309c('0x96')];return db[_0x309c('0xa6')][_0x309c('0xd4')]({'where':_0x395b92,'defaults':_0x513e88});}})[_0x309c('0xbf')](function(_0x32b66d){if(_0x32b66d){_0x7e6739=_0x32b66d;var _0x3913a5=fs['readFileSync'](path[_0x309c('0x7b')](config[_0x309c('0x7c')],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x2fcdbe=ejs[_0x309c('0xd5')](_0x3913a5,{'body':_['toPairs'](_0x8bcc71['body'][_0x309c('0x5e')]),'bodyTitle':_0x4aa977[_0x309c('0xd6')]});return db[_0x309c('0xd7')]['create']({'body':_0x2fcdbe,'ContactId':_0x32b66d['id'],'ChatWebsiteId':_0x4aa977['id']});}})['then'](function(_0x20b8e2){_0x26f3cf=_0x20b8e2;if(_0x3ebd0c[_0x309c('0x4d')]){var _0x269c3b=_0x3ebd0c[_0x309c('0x43')](function(_0x4e4dc4){return{'name':_0x4e4dc4['originalname'],'basename':_0x4e4dc4[_0x309c('0x74')],'type':_0x4e4dc4[_0x309c('0xd8')],'ChatOfflineMessageId':_0x20b8e2['id']};});_0x45cce5=_0x269c3b[_0x309c('0x43')](_0x503185=>{var _0x10345c={'filename':_0x503185[_0x309c('0x3f')],'path':path[_0x309c('0x7b')](config['root'],_0x309c('0xd9'),'files',_0x309c('0xda'),_0x309c('0xdb'),_0x503185[_0x309c('0xdc')])};return _0x10345c;});if(!_0x4aa977[_0x309c('0xdd')]){return db[_0x309c('0xde')]['transaction'](function(_0x2311e9){return db['Attachment']['bulkCreate'](_0x269c3b,{'transaction':_0x2311e9});});}}})['then'](function(){if(_0x26f3cf){_0x58c85a=_0x26f3cf;return db[_0x309c('0xd2')][_0x309c('0x6b')]({'where':{'active':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]});}})['then'](function(_0x4b9f08){if(_0x4b9f08&&_0x4b9f08['Smtp']&&_0x4aa977['forwardOffline']&&_0x4aa977[_0x309c('0xdf')]){var _0x7f6e2={'tls':{'rejectUnauthorized':![]}};if(_0x4b9f08[_0x309c('0xe0')][_0x309c('0xe1')]){_0x7f6e2[_0x309c('0xe1')]=_0x4b9f08['Smtp'][_0x309c('0xe1')];}else{_0x7f6e2[_0x309c('0xe2')]=_0x4b9f08['Smtp']['host'];_0x7f6e2[_0x309c('0xe3')]=_0x4b9f08[_0x309c('0xe0')][_0x309c('0xe3')];_0x7f6e2[_0x309c('0xe4')]=_0x4b9f08['Smtp'][_0x309c('0xe4')];}if(_0x4b9f08['Smtp'][_0x309c('0xe5')]){_0x7f6e2[_0x309c('0xe6')]={'user':_0x4b9f08[_0x309c('0xe0')][_0x309c('0x5f')],'pass':_0x4b9f08['Smtp']['pass']};}return respondWithRpcPromise(_0x309c('0xe7'),'sendMail',{'account':_0x7f6e2,'message':{'from':util[_0x309c('0xb5')]('\x22%s\x22\x20<%s>',_0x4b9f08['name'],_0x4b9f08['email']||_0x4b9f08['Smtp']['user']),'to':_0x4aa977[_0x309c('0xdf')],'subject':_0x4aa977[_0x309c('0xe8')],'html':_0x58c85a[_0x309c('0x5e')],'attachments':_0x45cce5}},client9003)['then'](function(){return _0x58c85a;})[_0x309c('0x2e')](function(_0x76fdc8){console['error'](_0x76fdc8);});}})[_0x309c('0x24')](function(){if(_0x4aa977&&_0x4aa977[_0x309c('0xdd')]&&_0x4aa977[_0x309c('0xe9')]){var _0x2b4bcf=[];if(_0x3ebd0c[_0x309c('0x4d')]){_0x2b4bcf=_0x3ebd0c['map'](function(_0x4729a5){return{'name':_0x4729a5[_0x309c('0xea')],'basename':_0x4729a5[_0x309c('0x74')],'type':_0x4729a5[_0x309c('0xd8')],'ChatOfflineMessageId':_0x26f3cf['id']};});}var _0x56a2c4;if(!_[_0x309c('0x84')](_0x4aa977['subjectOffline'])){var _0x5af4c9=_[_0x309c('0x43')](_0x8bcc71[_0x309c('0x5e')],function(_0x54a3e3){return _0x54a3e3;});var _0x16fa38=_[_0x309c('0xeb')](_0x5af4c9)[0x0];var _0x256c37=_[_0x309c('0xec')](_0x16fa38,function(_0xc1b8b2){return _0xc1b8b2;});_0x56a2c4=_0x256c37[0x1][_0x4aa977[_0x309c('0xed')]];}var _0x20cabb={'from':_0x7e6739[_0x309c('0xee')],'firstName':_0x7e6739[_0x309c('0xad')],'lastName':_0x7e6739[_0x309c('0xae')],'mapKey':'email','message':{'from':_0x7e6739[_0x309c('0xee')],'to':_0x4aa977[_0x309c('0xd2')]['email'],'cc':'','subject':_['isNil'](_0x56a2c4)?_0x4aa977[_0x309c('0xe8')]:_0x56a2c4,'messageId':'','sentAt':new Date(),'attach':_0x2b4bcf[_0x309c('0x4d')],'attachments':_0x2b4bcf,'originChannel':_0x309c('0xef'),'ChatWebsiteId':_0x4aa977['id'],'ChatOfflineMessageId':_0x58c85a['id'],'originTo':_0x4aa977['MailAccount']['email']},'body':_0x58c85a[_0x309c('0x5e')]};var _0x31e0ff={'account':{'id':_0x4aa977[_0x309c('0xe9')]},'body':_0x20cabb,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0x309c('0xf0'),_0x309c('0xf1'),_0x31e0ff,client9001)[_0x309c('0x24')](function(){return _0x58c85a;})[_0x309c('0x2e')](function(_0x3d41c5){console['error'](_0x3d41c5);});}return;})[_0x309c('0x24')](function(){if(_0x58c85a){return _0x58c85a;}})[_0x309c('0x24')](respondWithResult(_0x170646,null))[_0x309c('0x2e')](function(_0x516639){console[_0x309c('0x29')](_0x309c('0x2e'),_0x516639);for(var _0x2ec312 of _0x3ebd0c){var _0x4e3e8c=path[_0x309c('0x7b')](config[_0x309c('0x7c')],'server','files',_0x309c('0xda'),'offline-chat',_0x2ec312[_0x309c('0x74')]);fs_extra['remove'](_0x4e3e8c)[_0x309c('0x2e')](function(_0x1d2239){console[_0x309c('0x29')](_0x309c('0xf2'),_0x4e3e8c,_0x1d2239);});}});};exports[_0x309c('0xf3')]=function(_0x37a6c6,_0x26579d,_0x2f44e7){return db['ChatInteraction'][_0x309c('0x5c')]({'where':{'id':_0x37a6c6['params']['id']}})['then'](handleEntityNotFound(_0x26579d,null))['then'](function(_0x322550){if(_0x322550){return _0x322550[_0x309c('0xf3')](_0x37a6c6['body'][_0x309c('0x6f')],_[_0x309c('0xf4')](_0x37a6c6[_0x309c('0x5e')],[_0x309c('0x6f'),'id'])||{});}})[_0x309c('0x24')](respondWithResult(_0x26579d,null))[_0x309c('0x2e')](handleError(_0x26579d,null));};exports[_0x309c('0xf5')]=function(_0x5d6379,_0x2ad2b6,_0x4f542a){var _0x5d5f89={'raw':![],'where':{}};var _0x272601={};var _0x1fd8d7={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x309c('0x6b')]({'where':{'id':_0x5d6379['params']['id']}})[_0x309c('0x24')](handleEntityNotFound(_0x2ad2b6,null))['then'](function(_0xbedd04){if(_0xbedd04){_0x272601[_0x309c('0x47')]=_[_0x309c('0x5a')](db['ChatInteraction'][_0x309c('0x45')]);_0x272601[_0x309c('0x4a')]=_[_0x309c('0x5a')](_0x5d6379[_0x309c('0x4a')]);_0x272601[_0x309c('0x48')]=_['intersection'](_0x272601['model'],_0x272601['query']);_0x5d5f89[_0x309c('0x4c')]=_['intersection'](_0x272601[_0x309c('0x47')],qs['fields'](_0x5d6379[_0x309c('0x4a')][_0x309c('0x4b')]));_0x5d5f89['attributes']=_0x5d5f89[_0x309c('0x4c')]['length']?_0x5d5f89[_0x309c('0x4c')]:_0x272601[_0x309c('0x47')];if(!_0x5d6379[_0x309c('0x4a')][_0x309c('0x6c')]('nolimit')){_0x5d5f89[_0x309c('0x34')]=qs['limit'](_0x5d6379[_0x309c('0x4a')]['limit']);_0x5d5f89[_0x309c('0x36')]=qs[_0x309c('0x36')](_0x5d6379['query']['offset']);}_0x5d5f89[_0x309c('0x4f')]=qs[_0x309c('0x50')](_0x5d6379[_0x309c('0x4a')][_0x309c('0x50')]);_0x5d5f89[_0x309c('0x51')]=qs[_0x309c('0x48')](_['pick'](_0x5d6379[_0x309c('0x4a')],_0x272601[_0x309c('0x48')]));_0x5d5f89[_0x309c('0x51')][_0x309c('0x68')]=_0xbedd04['id'];if(_0x5d6379[_0x309c('0x4a')][_0x309c('0x53')]){_0x5d5f89[_0x309c('0x51')]=_[_0x309c('0x54')](_0x5d5f89[_0x309c('0x51')],{'$or':_['map'](_0x5d5f89[_0x309c('0x4c')],function(_0x4c7225){var _0xd3534b={};_0xd3534b[_0x4c7225]={'$like':'%'+_0x5d6379[_0x309c('0x4a')][_0x309c('0x53')]+'%'};return _0xd3534b;})});}_0x5d5f89=_['merge']({},_0x5d5f89,_0x5d6379[_0x309c('0x5b')]);return db['ChatInteraction'][_0x309c('0x35')]({'where':_0x5d5f89['where']})[_0x309c('0x24')](function(_0x1cbc1b){_0x1fd8d7[_0x309c('0x35')]=_0x1cbc1b;if(_0x5d6379['query'][_0x309c('0x55')]){_0x5d5f89[_0x309c('0x56')]=[{'model':db[_0x309c('0xa6')],'as':'Contact','required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x309c('0x3f'),_0x309c('0xf6'),_0x309c('0xf7')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x309c('0x3f'),'color'],'where':_0x5d6379['query'][_0x309c('0xf8')]?{'id':_0x5d6379[_0x309c('0x4a')]['tag']}:undefined,'required':_0x5d6379[_0x309c('0x4a')]['tag']?!![]:![]}];}return db['ChatInteraction'][_0x309c('0x6d')](_0x5d5f89);})[_0x309c('0x24')](function(_0x5c9380){_0x1fd8d7[_0x309c('0x57')]=_0x5c9380;return _0x1fd8d7;});}})['then'](respondWithFilteredResult(_0x2ad2b6,_0x5d5f89))[_0x309c('0x2e')](handleError(_0x2ad2b6,null));};function iftimePromise(_0x3b8751,_0x1241e7){return respondWithRpcPromise(_0x309c('0xf9'),_0x309c('0xfa'),{'command':_0x1241e7[_0x309c('0xfb')]?util['format'](_0x309c('0xfc'),_0x3b8751[_0x309c('0xfd')],_0x1241e7[_0x309c('0xfb')]):util[_0x309c('0xb5')](_0x309c('0xfe'),_0x3b8751[_0x309c('0xfd')])},client9002)[_0x309c('0x24')](function(_0x4410a0){var _0x9951d5=_0x4410a0&&_0x4410a0[_0x309c('0xff')]('true')>=0x0?!![]:![];logger['info'](_0x309c('0x100'),_0x1241e7['id'],_0x3b8751['id'],_0x3b8751[_0x309c('0xfd')],_0x9951d5?_0x309c('0x101'):_0x309c('0x102'),_0x1241e7[_0x309c('0xfb')]?_0x1241e7[_0x309c('0xfb')]:_0x309c('0x103'));return _0x9951d5;})['catch'](function(_0x1613b5){logger[_0x309c('0x29')](_0x309c('0x100'),_0x1241e7['id'],_0x3b8751['id'],_0x3b8751[_0x309c('0xfd')],util['inspect'](_0x1613b5,{'showHidden':![],'depth':null}),_0x1241e7[_0x309c('0xfb')]?_0x1241e7[_0x309c('0xfb')]:'No\x20timezone');return![];});}exports[_0x309c('0xfa')]=function(_0xb1f931,_0x44d63c,_0x12fec2){var _0x1949ac=0x0;var _0x2a6a94=0x0;var _0x3388cb=![];var _0x1d78d9;var _0x1fc2ee;return db[_0x309c('0x44')][_0x309c('0x5c')]({'where':{'id':_0xb1f931[_0x309c('0x58')]['id']},'include':[{'model':db[_0x309c('0x104')],'as':_0x309c('0x104'),'include':[{'model':db[_0x309c('0x104')],'as':_0x309c('0x105'),'attributes':['id',_0x309c('0xfd')],'raw':!![]}]}]})[_0x309c('0x24')](handleEntityNotFound(_0x44d63c,null))['then'](function(_0xc76db5){if(_0xc76db5){_0x1d78d9=_0xc76db5;return _0xc76db5['getProactiveActions']({'raw':!![]});}})[_0x309c('0x24')](function(_0x4ba726){if(_0x1d78d9){if(_0x4ba726){_0x1fc2ee=_0x4ba726;}}return require('../../config/license/util')['getLicense']();})[_0x309c('0x24')](function(_0x5da805){if(_0x5da805){_0x2a6a94=_0x5da805[_0x309c('0x106')];_0x3388cb=_0x5da805[_0x309c('0x80')];}})[_0x309c('0x24')](function(){return db[_0x309c('0xbe')]['count']({'where':{'closed':![]}});})[_0x309c('0x24')](function(_0x24a94d){_0x1949ac=_0x24a94d;if(_0x2a6a94&&_0x24a94d>_0x2a6a94){return db[_0x309c('0x107')][_0x309c('0x6b')]({'where':{'id':0x1}})[_0x309c('0x24')](function(_0x354310){if(_0x354310){_0x354310[_0x309c('0x108')](_0x309c('0x109'));}});}})[_0x309c('0x24')](function(){if(_0x1d78d9[_0x309c('0x104')]&&_0x1d78d9[_0x309c('0x104')][_0x309c('0x105')]){var _0xfbd565=[];for(var _0x373263=0x0;_0x373263<_0x1d78d9['Interval']['Intervals'][_0x309c('0x4d')];_0x373263++){var _0x3f49a5=_0x1d78d9[_0x309c('0x104')][_0x309c('0x105')][_0x373263][_0x309c('0x3d')]({'plain':!![]});_0xfbd565['push'](iftimePromise(_0x3f49a5,_0x1d78d9));}return BPromise[_0x309c('0x10a')](_0xfbd565)['then'](function(_0x1190f6){return _['some'](_0x1190f6);});}else{return!![];}})['then'](function(_0x3935ad){var _0x147fde=fs['readFileSync'](path[_0x309c('0x7b')](config[_0x309c('0x7c')],_0x309c('0x10b')),_0x309c('0x10c'));var _0x44e2d1={'remote':_0x1d78d9[_0x309c('0x10d')],'query':querystring[_0x309c('0xb9')](_[_0x309c('0x54')](_0x1d78d9[_0x309c('0x3d')]({'plain':!![]}),{'customerIp':_0xb1f931[_0x309c('0x8e')]['x-forwarded-for']||_0xb1f931['headers']['x-real-ip']||_0xb1f931[_0x309c('0x10e')][_0x309c('0x10f')]||_0xb1f931['ip'],'referer':_0xb1f931[_0x309c('0x8e')][_0x309c('0xb0')],'openedInteractions':_0x1949ac,'maxInteractions':_0x2a6a94,'virtual':_0x3388cb['virtual'],'online':_0x3935ad,'custom':_0x3388cb}))[_0x309c('0x110')](/'/g,'\x5c\x27')};_0x44d63c['send'](ejs[_0x309c('0xd5')](Mustache['render'](_0x147fde,_0x44e2d1),{'proactiveActions':_0x1fc2ee,'alignment':_0x1d78d9['alignment'],'verticalAlignment':_0x1d78d9[_0x309c('0x111')],'div_color':_0x1d78d9[_0x309c('0x112')],'text_color':_0x1d78d9[_0x309c('0x113')],'button_color':_0x1d78d9[_0x309c('0x114')],'background_color':_0x1d78d9[_0x309c('0x115')]}));})['catch'](handleError(_0x44d63c,null));};exports[_0x309c('0x116')]=function(_0x114a15,_0x59dbe1,_0x5f1846){return db[_0x309c('0x44')][_0x309c('0x6b')]({'where':{'id':_0x114a15[_0x309c('0x58')]['id']}})[_0x309c('0x24')](handleEntityNotFound(_0x59dbe1,null))[_0x309c('0x24')](function(_0x610a53){if(_0x610a53){return db['sequelize'][_0x309c('0x117')](function(_0x25c4db){return db[_0x309c('0x118')][_0x309c('0x3c')]({'where':{'ChatWebsiteId':_0x114a15['params']['id']},'transaction':_0x25c4db})['then'](function(_0x572c93){var _0x5d174c=_['map'](_0x114a15['body'],function(_0x1d9e69){_0x1d9e69['ChatWebsiteId']=_0x114a15['params']['id'];return _0x1d9e69;});return db[_0x309c('0x118')][_0x309c('0x119')](_0x5d174c,{'transaction':_0x25c4db});});})['then'](function(){return db[_0x309c('0x118')][_0x309c('0x11a')]({'where':{'ChatWebsiteId':_0x114a15[_0x309c('0x58')]['id']},'order':'priority'});});}})[_0x309c('0x24')](respondWithResult(_0x59dbe1,null))[_0x309c('0x2e')](handleError(_0x59dbe1,null));};exports[_0x309c('0x11b')]=function(_0x143e39,_0x22ecae,_0x4c877a){var _0x203928={};var _0x201160={};var _0x3b9085;var _0x145c21;return db[_0x309c('0x44')][_0x309c('0x6b')]({'where':{'id':_0x143e39[_0x309c('0x58')]['id']}})[_0x309c('0x24')](handleEntityNotFound(_0x22ecae,null))[_0x309c('0x24')](function(_0x193a28){if(_0x193a28){_0x3b9085=_0x193a28;_0x201160[_0x309c('0x47')]=_[_0x309c('0x5a')](db[_0x309c('0x118')][_0x309c('0x45')]);_0x201160[_0x309c('0x4a')]=_[_0x309c('0x5a')](_0x143e39['query']);_0x201160[_0x309c('0x48')]=_['intersection'](_0x201160[_0x309c('0x47')],_0x201160[_0x309c('0x4a')]);_0x203928[_0x309c('0x4c')]=_[_0x309c('0x49')](_0x201160['model'],qs[_0x309c('0x4b')](_0x143e39[_0x309c('0x4a')][_0x309c('0x4b')]));_0x203928[_0x309c('0x4c')]=_0x203928['attributes'][_0x309c('0x4d')]?_0x203928[_0x309c('0x4c')]:_0x201160[_0x309c('0x47')];_0x203928['order']=qs[_0x309c('0x50')](_0x143e39['query'][_0x309c('0x50')]);_0x203928[_0x309c('0x51')]=qs[_0x309c('0x48')](_[_0x309c('0x52')](_0x143e39[_0x309c('0x4a')],_0x201160[_0x309c('0x48')]));if(_0x143e39[_0x309c('0x4a')][_0x309c('0x53')]){_0x203928[_0x309c('0x51')]=_['merge'](_0x203928[_0x309c('0x51')],{'$or':_[_0x309c('0x43')](_0x203928['attributes'],function(_0x42025c){var _0x4b0cd7={};_0x4b0cd7[_0x42025c]={'$like':'%'+_0x143e39['query']['filter']+'%'};return _0x4b0cd7;})});}_0x203928=_['merge']({},_0x203928,_0x143e39[_0x309c('0x5b')]);return _0x3b9085[_0x309c('0x11b')](_0x203928);}})[_0x309c('0x24')](function(_0x29d5d5){if(_0x29d5d5){_0x145c21=_0x29d5d5[_0x309c('0x4d')];if(!_0x143e39[_0x309c('0x4a')][_0x309c('0x6c')](_0x309c('0x4e'))){_0x203928[_0x309c('0x34')]=qs[_0x309c('0x34')](_0x143e39[_0x309c('0x4a')][_0x309c('0x34')]);_0x203928['offset']=qs['offset'](_0x143e39[_0x309c('0x4a')][_0x309c('0x36')]);}return _0x3b9085['getApplications'](_0x203928);}})[_0x309c('0x24')](function(_0x285194){if(_0x285194){return _0x285194?{'count':_0x145c21,'rows':_0x285194}:null;}})['then'](respondWithResult(_0x22ecae,null))[_0x309c('0x2e')](handleError(_0x22ecae,null));};exports['addProactiveActions']=function(_0x3aca9c,_0x56229,_0x56fcec){return db[_0x309c('0x11c')]['find']({'where':{'id':_0x3aca9c[_0x309c('0x58')]['id']}})['then'](handleEntityNotFound(_0x56229,null))[_0x309c('0x24')](function(_0x3a4fc7){if(_0x3a4fc7){return _0x3a4fc7[_0x309c('0x11d')](_0x3aca9c[_0x309c('0x5e')][_0x309c('0x6f')],_['omit'](_0x3aca9c['body'],[_0x309c('0x6f'),'id'])||{});}})[_0x309c('0x24')](respondWithResult(_0x56229,null))['catch'](handleError(_0x56229,null));};exports[_0x309c('0x11e')]=function(_0x44f199,_0x33b8f9,_0x1ae116){var _0x3c3d47={};var _0x4a8501={};var _0x3a72ad;var _0x3347a5;return db[_0x309c('0x44')][_0x309c('0x6b')]({'where':{'id':_0x44f199[_0x309c('0x58')]['id']}})[_0x309c('0x24')](handleEntityNotFound(_0x33b8f9,null))[_0x309c('0x24')](function(_0x2f66ff){if(_0x2f66ff){_0x3a72ad=_0x2f66ff;_0x4a8501[_0x309c('0x47')]=_[_0x309c('0x5a')](db['ChatProactiveAction'][_0x309c('0x45')]);_0x4a8501[_0x309c('0x4a')]=_[_0x309c('0x5a')](_0x44f199['query']);_0x4a8501[_0x309c('0x48')]=_[_0x309c('0x49')](_0x4a8501[_0x309c('0x47')],_0x4a8501[_0x309c('0x4a')]);_0x3c3d47[_0x309c('0x4c')]=_['intersection'](_0x4a8501[_0x309c('0x47')],qs[_0x309c('0x4b')](_0x44f199[_0x309c('0x4a')][_0x309c('0x4b')]));_0x3c3d47['attributes']=_0x3c3d47[_0x309c('0x4c')][_0x309c('0x4d')]?_0x3c3d47['attributes']:_0x4a8501['model'];_0x3c3d47[_0x309c('0x4f')]=qs['sort'](_0x44f199['query'][_0x309c('0x50')]);_0x3c3d47[_0x309c('0x51')]=qs['filters'](_[_0x309c('0x52')](_0x44f199[_0x309c('0x4a')],_0x4a8501[_0x309c('0x48')]));if(_0x44f199['query']['filter']){_0x3c3d47[_0x309c('0x51')]=_['merge'](_0x3c3d47[_0x309c('0x51')],{'$or':_[_0x309c('0x43')](_0x3c3d47[_0x309c('0x4c')],function(_0x48275a){var _0x31c202={};_0x31c202[_0x48275a]={'$like':'%'+_0x44f199['query'][_0x309c('0x53')]+'%'};return _0x31c202;})});}_0x3c3d47=_[_0x309c('0x54')]({},_0x3c3d47,_0x44f199[_0x309c('0x5b')]);return _0x3a72ad[_0x309c('0x11e')](_0x3c3d47);}})[_0x309c('0x24')](function(_0xba273e){if(_0xba273e){_0x3347a5=_0xba273e['length'];if(!_0x44f199['query'][_0x309c('0x6c')](_0x309c('0x4e'))){_0x3c3d47[_0x309c('0x34')]=qs['limit'](_0x44f199['query'][_0x309c('0x34')]);_0x3c3d47[_0x309c('0x36')]=qs['offset'](_0x44f199[_0x309c('0x4a')][_0x309c('0x36')]);}return _0x3a72ad['getProactiveActions'](_0x3c3d47);}})[_0x309c('0x24')](function(_0x4a6713){if(_0x4a6713){return _0x4a6713?{'count':_0x3347a5,'rows':_0x4a6713}:null;}})['then'](respondWithResult(_0x33b8f9,null))[_0x309c('0x2e')](handleError(_0x33b8f9,null));};exports[_0x309c('0x11f')]=function(_0x2b14b4,_0x199df5,_0x2df4dd){var _0x4b6939=_0x2b14b4['query']['online']===_0x309c('0x120')?_0x309c('0x121'):_0x309c('0x122');return db[_0x309c('0x44')][_0x309c('0x5c')]({'attributes':['id',_0x4b6939],'where':{'id':_0x2b14b4['params']['id']}})['then'](handleEntityNotFound(_0x199df5,null))[_0x309c('0x24')](function(_0xbae9ce){if(_0xbae9ce){var _0x4332e8=_0xbae9ce[_0x4b6939];var _0x37eec1=_0x4332e8&&_0x4332e8[_0x309c('0x123')]?_0x4332e8[_0x309c('0x123')]:[];_0x199df5[_0x309c('0x40')]({'fromKey':_['isNil'](_0x4332e8[_0x309c('0x124')])?undefined:_0x4332e8['fromKey'],'count':_0x37eec1[_0x309c('0x4d')],'rows':_0x37eec1});}})['catch'](handleError(_0x199df5,null));};exports[_0x309c('0x125')]=function(_0x1a8641,_0xfc7bc,_0x296abb){var _0x593487={'raw':![],'where':{}};var _0x1b3f2a={};var _0xec821b={'count':0x0,'rows':[]};return db[_0x309c('0x44')]['findOne']({'where':{'id':_0x1a8641[_0x309c('0x58')]['id']}})[_0x309c('0x24')](handleEntityNotFound(_0xfc7bc,null))[_0x309c('0x24')](function(_0x3042d5){if(_0x3042d5){_0x1b3f2a[_0x309c('0x47')]=_[_0x309c('0x5a')](db[_0x309c('0xd7')][_0x309c('0x45')]);_0x1b3f2a[_0x309c('0x4a')]=_[_0x309c('0x5a')](_0x1a8641[_0x309c('0x4a')]);_0x1b3f2a[_0x309c('0x48')]=_['intersection'](_0x1b3f2a[_0x309c('0x47')],_0x1b3f2a[_0x309c('0x4a')]);_0x593487[_0x309c('0x4c')]=_[_0x309c('0x49')](_0x1b3f2a[_0x309c('0x47')],qs[_0x309c('0x4b')](_0x1a8641[_0x309c('0x4a')]['fields']));_0x593487['attributes']=_0x593487['attributes'][_0x309c('0x4d')]?_0x593487[_0x309c('0x4c')]:_0x1b3f2a[_0x309c('0x47')];if(!_0x1a8641[_0x309c('0x4a')][_0x309c('0x6c')](_0x309c('0x4e'))){_0x593487[_0x309c('0x34')]=qs[_0x309c('0x34')](_0x1a8641[_0x309c('0x4a')][_0x309c('0x34')]);_0x593487['offset']=qs[_0x309c('0x36')](_0x1a8641[_0x309c('0x4a')]['offset']);}_0x593487[_0x309c('0x4f')]=qs['sort'](_0x1a8641[_0x309c('0x4a')][_0x309c('0x50')]);_0x593487[_0x309c('0x51')]=qs[_0x309c('0x48')](_['pick'](_0x1a8641[_0x309c('0x4a')],_0x1b3f2a[_0x309c('0x48')]));_0x593487['where'][_0x309c('0x68')]=_0x3042d5['id'];if(_0x1a8641[_0x309c('0x4a')][_0x309c('0x53')]){_0x593487[_0x309c('0x51')]=_[_0x309c('0x54')](_0x593487['where'],{'$or':_[_0x309c('0x43')](_0x593487[_0x309c('0x4c')],function(_0x35351e){var _0x38ca63={};_0x38ca63[_0x35351e]={'$like':'%'+_0x1a8641['query'][_0x309c('0x53')]+'%'};return _0x38ca63;})});}_0x593487=_[_0x309c('0x54')]({},_0x593487,_0x1a8641[_0x309c('0x5b')]);return db['ChatOfflineMessage'][_0x309c('0x35')]({'where':_0x593487[_0x309c('0x51')]})[_0x309c('0x24')](function(_0x3f4c1b){_0xec821b[_0x309c('0x35')]=_0x3f4c1b;if(_0x1a8641[_0x309c('0x4a')][_0x309c('0x55')]){_0x593487['include']=[{'all':!![]}];}else{_0x593487['include']=[{'model':db[_0x309c('0xa6')],'as':_0x309c('0x126'),'required':![]},{'model':db[_0x309c('0x127')],'as':_0x309c('0x128'),'required':![]}];}return db[_0x309c('0xd7')]['findAll'](_0x593487);})[_0x309c('0x24')](function(_0x3adbcf){_0xec821b[_0x309c('0x57')]=_0x3adbcf;return _0xec821b;});}})[_0x309c('0x24')](respondWithFilteredResult(_0xfc7bc,_0x593487))['catch'](handleError(_0xfc7bc,null));};exports[_0x309c('0x129')]=function(_0x563c6c,_0x519113,_0x52c736){return db[_0x309c('0x44')]['find']({'where':{'id':_0x563c6c[_0x309c('0x58')]['id']}})['then'](handleEntityNotFound(_0x519113,null))[_0x309c('0x24')](function(_0x7be287){if(_0x7be287){return _0x7be287[_0x309c('0x129')](_0x563c6c[_0x309c('0x5e')][_0x309c('0x6f')],_[_0x309c('0xf4')](_0x563c6c[_0x309c('0x5e')],['ids','id'])||{})[_0x309c('0xbf')](function(_0x2d25a8){for(var _0x584f52=0x0;_0x584f52<_0x563c6c[_0x309c('0x5e')][_0x309c('0x6f')][_0x309c('0x4d')];_0x584f52+=0x1){socket['emit'](_0x309c('0x12a'),{'UserId':Number(_0x563c6c[_0x309c('0x5e')][_0x309c('0x6f')][_0x584f52]),'ChatWebsiteId':Number(_0x563c6c[_0x309c('0x58')]['id'])});}return _0x2d25a8;});}})[_0x309c('0x24')](respondWithResult(_0x519113,null))[_0x309c('0x2e')](handleError(_0x519113,null));};exports['removeAgents']=function(_0x2560cc,_0x3c5097,_0x2b4eca){return db[_0x309c('0x44')][_0x309c('0x5c')]({'where':{'id':_0x2560cc[_0x309c('0x58')]['id']}})[_0x309c('0x24')](handleEntityNotFound(_0x3c5097,null))[_0x309c('0x24')](function(_0x342f72){if(_0x342f72){return _0x342f72[_0x309c('0x12b')](_0x2560cc['query'][_0x309c('0x6f')])['then'](function(){if(_[_0x309c('0x12c')](_0x2560cc[_0x309c('0x4a')][_0x309c('0x6f')])){for(var _0x1265f1=0x0;_0x1265f1<_0x2560cc[_0x309c('0x4a')][_0x309c('0x6f')]['length'];_0x1265f1+=0x1){socket['emit'](_0x309c('0x12d'),{'UserId':Number(_0x2560cc[_0x309c('0x4a')]['ids'][_0x1265f1]),'ChatWebsiteId':Number(_0x2560cc[_0x309c('0x58')]['id'])});}}else{socket[_0x309c('0x12e')](_0x309c('0x12d'),{'UserId':Number(_0x2560cc[_0x309c('0x4a')][_0x309c('0x6f')]),'ChatWebsiteId':Number(_0x2560cc[_0x309c('0x58')]['id'])});}});}})[_0x309c('0x24')](respondWithStatusCode(_0x3c5097,null))[_0x309c('0x2e')](handleError(_0x3c5097,null));};exports['getAgents']=function(_0x110346,_0x324158,_0x567c10){var _0x24163e={};var _0x3bd3d2={};var _0x2f3aad;var _0x48c7b0;return db['ChatWebsite'][_0x309c('0x6b')]({'where':{'id':_0x110346[_0x309c('0x58')]['id']}})[_0x309c('0x24')](handleEntityNotFound(_0x324158,null))[_0x309c('0x24')](function(_0x3265d9){if(_0x3265d9){_0x2f3aad=_0x3265d9;_0x3bd3d2['model']=_['keys'](db[_0x309c('0x12f')][_0x309c('0x45')]);_0x3bd3d2[_0x309c('0x4a')]=_[_0x309c('0x5a')](_0x110346[_0x309c('0x4a')]);_0x3bd3d2['filters']=_[_0x309c('0x49')](_0x3bd3d2['model'],_0x3bd3d2[_0x309c('0x4a')]);_0x24163e['attributes']=_[_0x309c('0x49')](_0x3bd3d2[_0x309c('0x47')],qs[_0x309c('0x4b')](_0x110346[_0x309c('0x4a')][_0x309c('0x4b')]));_0x24163e['attributes']=_0x24163e[_0x309c('0x4c')][_0x309c('0x4d')]?_0x24163e[_0x309c('0x4c')]:_0x3bd3d2['model'];_0x24163e['order']=qs[_0x309c('0x50')](_0x110346['query']['sort']);_0x24163e[_0x309c('0x51')]=qs[_0x309c('0x48')](_[_0x309c('0x52')](_0x110346['query'],_0x3bd3d2[_0x309c('0x48')]));if(_0x110346[_0x309c('0x4a')][_0x309c('0x53')]){_0x24163e[_0x309c('0x51')]=_['merge'](_0x24163e[_0x309c('0x51')],{'$or':_[_0x309c('0x43')](_0x24163e[_0x309c('0x4c')],function(_0x4cfab5){var _0x31dbd2={};_0x31dbd2[_0x4cfab5]={'$like':'%'+_0x110346['query'][_0x309c('0x53')]+'%'};return _0x31dbd2;})});}_0x24163e=_[_0x309c('0x54')]({},_0x24163e,_0x110346[_0x309c('0x5b')]);return _0x2f3aad[_0x309c('0x130')](_0x24163e);}})[_0x309c('0x24')](function(_0x13badd){if(_0x13badd){_0x48c7b0=_0x13badd[_0x309c('0x4d')];if(!_0x110346[_0x309c('0x4a')][_0x309c('0x6c')](_0x309c('0x4e'))){_0x24163e[_0x309c('0x34')]=qs['limit'](_0x110346['query'][_0x309c('0x34')]);_0x24163e['offset']=qs[_0x309c('0x36')](_0x110346[_0x309c('0x4a')][_0x309c('0x36')]);}return _0x2f3aad['getAgents'](_0x24163e);}})[_0x309c('0x24')](function(_0x2e65a1){if(_0x2e65a1){return _0x2e65a1?{'count':_0x48c7b0,'rows':_0x2e65a1}:null;}})[_0x309c('0x24')](respondWithResult(_0x324158,null))[_0x309c('0x2e')](handleError(_0x324158,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 684938f..062fb1a 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 _0x294b=['events','ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x22dac7,_0x45ffe6){var _0xad9681=function(_0x39e77d){while(--_0x39e77d){_0x22dac7['push'](_0x22dac7['shift']());}};_0xad9681(++_0x45ffe6);}(_0x294b,0xea));var _0xb294=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x294b[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xb294('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0xb294('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xb294('0x2')](0x0);var events={'afterCreate':_0xb294('0x3'),'afterUpdate':_0xb294('0x4'),'afterDestroy':_0xb294('0x5')};function emitEvent(_0x417648){return function(_0x58fe24,_0x5c0237,_0xba5c68){ChatWebsiteEvents[_0xb294('0x6')](_0x417648+':'+_0x58fe24['id'],_0x58fe24);ChatWebsiteEvents[_0xb294('0x6')](_0x417648,_0x58fe24);_0xba5c68(null);};}for(var e in events){if(events[_0xb294('0x7')](e)){var event=events[e];ChatWebsite[_0xb294('0x8')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x9879=['ChatWebsite','save','remove','emit','hook','events','../../mysqldb'];(function(_0x32f6ca,_0x3dd38a){var _0x4333d7=function(_0x3ca5d6){while(--_0x3ca5d6){_0x32f6ca['push'](_0x32f6ca['shift']());}};_0x4333d7(++_0x3dd38a);}(_0x9879,0x98));var _0x9987=function(_0x4dd338,_0x4559bb){_0x4dd338=_0x4dd338-0x0;var _0x2e061e=_0x9879[_0x4dd338];return _0x2e061e;};'use strict';var EventEmitter=require(_0x9987('0x0'));var ChatWebsite=require(_0x9987('0x1'))['db'][_0x9987('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9987('0x3'),'afterUpdate':'update','afterDestroy':_0x9987('0x4')};function emitEvent(_0x2e4478){return function(_0x1fd45d,_0xcc5722,_0x408924){ChatWebsiteEvents[_0x9987('0x5')](_0x2e4478+':'+_0x1fd45d['id'],_0x1fd45d);ChatWebsiteEvents[_0x9987('0x5')](_0x2e4478,_0x1fd45d);_0x408924(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x9987('0x6')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 1ee2b0f..b94aa89 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 _0x93dc=['path','rimraf','./chatWebsite.attributes','exports','ChatWebsite','chat_websites','util','../../config/logger','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x93dc,0x1c8));var _0xc93d=function(_0x32d679,_0x34a787){_0x32d679=_0x32d679-0x0;var _0xcb2cd4=_0x93dc[_0x32d679];return _0xcb2cd4;};'use strict';var _=require('lodash');var util=require(_0xc93d('0x0'));var logger=require(_0xc93d('0x1'))('api');var moment=require(_0xc93d('0x2'));var BPromise=require(_0xc93d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc93d('0x4'));var rimraf=require(_0xc93d('0x5'));var config=require('../../config/environment');var attributes=require(_0xc93d('0x6'));module[_0xc93d('0x7')]=function(_0x446503,_0x3a0c79){return _0x446503['define'](_0xc93d('0x8'),attributes,{'tableName':_0xc93d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8cb0=['request-promise','path','../../config/environment','exports','ChatWebsite','lodash','api','bluebird'];(function(_0xa3e0f7,_0x1b06db){var _0x4ce604=function(_0x29df1e){while(--_0x29df1e){_0xa3e0f7['push'](_0xa3e0f7['shift']());}};_0x4ce604(++_0x1b06db);}(_0x8cb0,0x85));var _0x08cb=function(_0x3afad7,_0x466432){_0x3afad7=_0x3afad7-0x0;var _0x5d8cb5=_0x8cb0[_0x3afad7];return _0x5d8cb5;};'use strict';var _=require(_0x08cb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x08cb('0x1'));var moment=require('moment');var BPromise=require(_0x08cb('0x2'));var rp=require(_0x08cb('0x3'));var fs=require('fs');var path=require(_0x08cb('0x4'));var rimraf=require('rimraf');var config=require(_0x08cb('0x5'));var attributes=require('./chatWebsite.attributes');module[_0x08cb('0x6')]=function(_0xc042a8,_0x470ec8){return _0xc042a8['define'](_0x08cb('0x7'),attributes,{'tableName':'chat_websites','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 63994b0..9db19e0 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 _0x1e45=['redis','socket.io-emitter','./chatWebsite.socket','register','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','defaults'];(function(_0x27e285,_0x274ef3){var _0x33513c=function(_0x8471d5){while(--_0x8471d5){_0x27e285['push'](_0x27e285['shift']());}};_0x33513c(++_0x274ef3);}(_0x1e45,0x18e));var _0x51e4=function(_0x445552,_0x5a5431){_0x445552=_0x445552-0x0;var _0x2e5eca=_0x1e45[_0x445552];return _0x2e5eca;};'use strict';var _=require(_0x51e4('0x0'));var util=require(_0x51e4('0x1'));var moment=require('moment');var BPromise=require(_0x51e4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x51e4('0x3'));var db=require(_0x51e4('0x4'))['db'];var utils=require(_0x51e4('0x5'));var logger=require('../../config/logger')(_0x51e4('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x51e4('0x7')][_0x51e4('0x8')]({'port':0x232a});config['redis']=_[_0x51e4('0x9')](config[_0x51e4('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x51e4('0xb'))(new Redis(config[_0x51e4('0xa')]));require(_0x51e4('0xc'))[_0x51e4('0xd')](socket);function respondWithRpcPromise(_0x1fc877,_0x1897ad,_0x1cc396){return new BPromise(function(_0x165630,_0xe98f22){return client[_0x51e4('0xe')](_0x1fc877,_0x1cc396)['then'](function(_0x5a98b1){logger[_0x51e4('0xf')](_0x51e4('0x10'),_0x1897ad,_0x51e4('0x11'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x1897ad,_0x51e4('0x11'),JSON[_0x51e4('0x12')](_0x5a98b1));if(_0x5a98b1[_0x51e4('0x13')]){if(_0x5a98b1['error'][_0x51e4('0x14')]===0x1f4){logger[_0x51e4('0x13')](_0x51e4('0x10'),_0x1897ad,_0x5a98b1['error'][_0x51e4('0x15')]);return _0xe98f22(_0x5a98b1[_0x51e4('0x13')][_0x51e4('0x15')]);}logger[_0x51e4('0x13')](_0x51e4('0x10'),_0x1897ad,_0x5a98b1[_0x51e4('0x13')][_0x51e4('0x15')]);return _0x165630(_0x5a98b1[_0x51e4('0x13')][_0x51e4('0x15')]);}else{logger[_0x51e4('0xf')](_0x51e4('0x10'),_0x1897ad,_0x51e4('0x11'));_0x165630(_0x5a98b1[_0x51e4('0x16')][_0x51e4('0x15')]);}})[_0x51e4('0x17')](function(_0x9fb3c1){logger[_0x51e4('0x13')](_0x51e4('0x10'),_0x1897ad,_0x9fb3c1);_0xe98f22(_0x9fb3c1);});});} \ No newline at end of file +var _0x25f0=['ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','redis','socket.io-emitter','./chatWebsite.socket','register','then','info'];(function(_0x2cae07,_0x3b2777){var _0x1d0e24=function(_0x11fa28){while(--_0x11fa28){_0x2cae07['push'](_0x2cae07['shift']());}};_0x1d0e24(++_0x3b2777);}(_0x25f0,0x1d6));var _0x025f=function(_0x536bfa,_0x27e109){_0x536bfa=_0x536bfa-0x0;var _0x357f33=_0x25f0[_0x536bfa];return _0x357f33;};'use strict';var _=require(_0x025f('0x0'));var util=require(_0x025f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x025f('0x2'));var fs=require('fs');var Redis=require(_0x025f('0x3'));var db=require(_0x025f('0x4'))['db'];var utils=require(_0x025f('0x5'));var logger=require('../../config/logger')(_0x025f('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x025f('0x7')]['http']({'port':0x232a});config[_0x025f('0x8')]=_['defaults'](config[_0x025f('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x025f('0x9'))(new Redis(config[_0x025f('0x8')]));require(_0x025f('0xa'))[_0x025f('0xb')](socket);function respondWithRpcPromise(_0x5d5f70,_0x1ec139,_0x5206be){return new BPromise(function(_0x12929e,_0x5e8a4b){return client['request'](_0x5d5f70,_0x5206be)[_0x025f('0xc')](function(_0x2a3f3e){logger[_0x025f('0xd')](_0x025f('0xe'),_0x1ec139,'request\x20sent');logger[_0x025f('0xf')](_0x025f('0x10'),_0x1ec139,_0x025f('0x11'),JSON['stringify'](_0x2a3f3e));if(_0x2a3f3e[_0x025f('0x12')]){if(_0x2a3f3e[_0x025f('0x12')][_0x025f('0x13')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x1ec139,_0x2a3f3e['error'][_0x025f('0x14')]);return _0x5e8a4b(_0x2a3f3e['error'][_0x025f('0x14')]);}logger[_0x025f('0x12')](_0x025f('0xe'),_0x1ec139,_0x2a3f3e[_0x025f('0x12')][_0x025f('0x14')]);return _0x12929e(_0x2a3f3e[_0x025f('0x12')][_0x025f('0x14')]);}else{logger[_0x025f('0xd')](_0x025f('0xe'),_0x1ec139,_0x025f('0x11'));_0x12929e(_0x2a3f3e['result'][_0x025f('0x14')]);}})[_0x025f('0x15')](function(_0x5479bb){logger[_0x025f('0x12')](_0x025f('0xe'),_0x1ec139,_0x5479bb);_0x5e8a4b(_0x5479bb);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index f034beb..c14c2f3 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 _0x0574=['update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save','remove'];(function(_0x29583f,_0x25f8c8){var _0x2a8003=function(_0x3a3d19){while(--_0x3a3d19){_0x29583f['push'](_0x29583f['shift']());}};_0x2a8003(++_0x25f8c8);}(_0x0574,0x12f));var _0x4057=function(_0x8c453,_0x57ffe1){_0x8c453=_0x8c453-0x0;var _0xc76889=_0x0574[_0x8c453];return _0xc76889;};'use strict';var ChatWebsiteEvents=require(_0x4057('0x0'));var events=[_0x4057('0x1'),_0x4057('0x2'),_0x4057('0x3')];function createListener(_0x26d509,_0x4683dd){return function(_0x3a09dd){_0x4683dd[_0x4057('0x4')](_0x26d509,_0x3a09dd);};}function removeListener(_0x46aeee,_0x52f595){return function(){ChatWebsiteEvents[_0x4057('0x5')](_0x46aeee,_0x52f595);};}exports[_0x4057('0x6')]=function(_0x3014e0){for(var _0xab5502=0x0,_0x33be93=events[_0x4057('0x7')];_0xab5502<_0x33be93;_0xab5502++){var _0x4cd77c=events[_0xab5502];var _0x478409=createListener(_0x4057('0x8')+_0x4cd77c,_0x3014e0);ChatWebsiteEvents['on'](_0x4cd77c,_0x478409);}}; \ No newline at end of file +var _0xa975=['removeListener','register','chatWebsite:','save','remove','update'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0xa975,0xab));var _0x5a97=function(_0x2f28f6,_0x116e07){_0x2f28f6=_0x2f28f6-0x0;var _0x1ccae9=_0xa975[_0x2f28f6];return _0x1ccae9;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x5a97('0x0'),_0x5a97('0x1'),_0x5a97('0x2')];function createListener(_0x4c2484,_0x8e35b2){return function(_0x45b078){_0x8e35b2['emit'](_0x4c2484,_0x45b078);};}function removeListener(_0xa160cd,_0x5e10f8){return function(){ChatWebsiteEvents[_0x5a97('0x3')](_0xa160cd,_0x5e10f8);};}exports[_0x5a97('0x4')]=function(_0x5625bb){for(var _0x1eeb4b=0x0,_0x54f01e=events['length'];_0x1eeb4b<_0x54f01e;_0x1eeb4b++){var _0x4dec1e=events[_0x1eeb4b];var _0xad4703=createListener(_0x5a97('0x5')+_0x4dec1e,_0x5625bb);ChatWebsiteEvents['on'](_0x4dec1e,_0xad4703);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index fc6400d..94cd144 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 _0xf6c3=['describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','/:id/fields','getOfflineMessages','/:id/users','getAgents','post','create','/:id/dispositions','addAnswer','root','server/files/images/logos/','format','%s-%s','now','single','addLogo','diskStorage','join','server/files/images/avatars/','originalname','file','addAvatar','addCustomerAvatar','addSystemAvatar','notify','server/files','attachments','ensureDir','replace','extname','/:id/offline','offline','addInteraction','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe'];(function(_0x2f3709,_0x1afca5){var _0x3c22d7=function(_0xacb8a){while(--_0xacb8a){_0x2f3709['push'](_0x2f3709['shift']());}};_0x3c22d7(++_0x1afca5);}(_0xf6c3,0xcd));var _0x3f6c=function(_0x19fbeb,_0x3335ef){_0x19fbeb=_0x19fbeb-0x0;var _0x5f27a1=_0xf6c3[_0x19fbeb];return _0x5f27a1;};'use strict';var multer=require(_0x3f6c('0x0'));var util=require(_0x3f6c('0x1'));var path=require(_0x3f6c('0x2'));var timeout=require(_0x3f6c('0x3'));var express=require(_0x3f6c('0x4'));var router=express[_0x3f6c('0x5')]();var fs_extra=require(_0x3f6c('0x6'));var auth=require(_0x3f6c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3f6c('0x8'));var controller=require(_0x3f6c('0x9'));router[_0x3f6c('0xa')]('/',auth[_0x3f6c('0xb')](),controller[_0x3f6c('0xc')]);router[_0x3f6c('0xa')](_0x3f6c('0xd'),auth[_0x3f6c('0xb')](),controller[_0x3f6c('0xe')]);router[_0x3f6c('0xa')](_0x3f6c('0xf'),auth[_0x3f6c('0xb')](),controller[_0x3f6c('0x10')]);router[_0x3f6c('0xa')]('/:id/dispositions',auth[_0x3f6c('0xb')](),controller[_0x3f6c('0x11')]);router['get'](_0x3f6c('0x12'),auth[_0x3f6c('0xb')](),controller[_0x3f6c('0x13')]);router[_0x3f6c('0xa')](_0x3f6c('0x14'),controller['getLogo']);router[_0x3f6c('0xa')](_0x3f6c('0x15'),controller[_0x3f6c('0x16')]);router['get']('/:id/customer_avatar',controller[_0x3f6c('0x17')]);router[_0x3f6c('0xa')](_0x3f6c('0x18'),controller[_0x3f6c('0x19')]);router[_0x3f6c('0xa')](_0x3f6c('0x1a'),auth[_0x3f6c('0xb')](),controller[_0x3f6c('0x1b')]);router['get']('/:id/snippet',controller[_0x3f6c('0x1c')]);router[_0x3f6c('0xa')](_0x3f6c('0x1d'),auth[_0x3f6c('0xb')](),controller[_0x3f6c('0x1e')]);router['get'](_0x3f6c('0x1f'),auth[_0x3f6c('0xb')](),controller['getProactiveActions']);router[_0x3f6c('0xa')](_0x3f6c('0x20'),controller['getFields']);router[_0x3f6c('0xa')]('/:id/offline_messages',auth[_0x3f6c('0xb')](),controller[_0x3f6c('0x21')]);router['get'](_0x3f6c('0x22'),auth[_0x3f6c('0xb')](),controller[_0x3f6c('0x23')]);router[_0x3f6c('0x24')]('/',auth[_0x3f6c('0xb')](),controller[_0x3f6c('0x25')]);router[_0x3f6c('0x24')](_0x3f6c('0x26'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x3f6c('0x24')](_0x3f6c('0x12'),auth[_0x3f6c('0xb')](),controller[_0x3f6c('0x27')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1ff99d,_0x11a2f0,_0x1c62b7){_0x1c62b7(null,path['join'](config[_0x3f6c('0x28')],_0x3f6c('0x29')));},'filename':function(_0x6d5f8f,_0x43c85f,_0x4d391a){_0x4d391a(null,util[_0x3f6c('0x2a')](_0x3f6c('0x2b'),Date[_0x3f6c('0x2c')](),_0x43c85f['originalname']));}})});router[_0x3f6c('0x24')](_0x3f6c('0x14'),upload[_0x3f6c('0x2d')]('file'),controller[_0x3f6c('0x2e')]);var upload=multer({'storage':multer[_0x3f6c('0x2f')]({'destination':function(_0x21f1cc,_0x51614e,_0x40ba83){_0x40ba83(null,path[_0x3f6c('0x30')](config[_0x3f6c('0x28')],_0x3f6c('0x31')));},'filename':function(_0x4e7998,_0x41a291,_0xc70ad3){_0xc70ad3(null,util[_0x3f6c('0x2a')]('%s-%s',Date[_0x3f6c('0x2c')](),_0x41a291[_0x3f6c('0x32')]));}})});router[_0x3f6c('0x24')](_0x3f6c('0x15'),upload['single'](_0x3f6c('0x33')),controller[_0x3f6c('0x34')]);var upload=multer({'storage':multer[_0x3f6c('0x2f')]({'destination':function(_0x581586,_0x39de38,_0x4b561d){_0x4b561d(null,path[_0x3f6c('0x30')](config[_0x3f6c('0x28')],_0x3f6c('0x31')));},'filename':function(_0x1df341,_0x11b5f2,_0x4d3704){_0x4d3704(null,util[_0x3f6c('0x2a')](_0x3f6c('0x2b'),Date['now'](),_0x11b5f2[_0x3f6c('0x32')]));}})});router[_0x3f6c('0x24')]('/:id/customer_avatar',upload[_0x3f6c('0x2d')](_0x3f6c('0x33')),controller[_0x3f6c('0x35')]);var upload=multer({'storage':multer[_0x3f6c('0x2f')]({'destination':function(_0x2e4877,_0x2421b5,_0x3ef351){_0x3ef351(null,path[_0x3f6c('0x30')](config[_0x3f6c('0x28')],_0x3f6c('0x31')));},'filename':function(_0x3910fd,_0x8e36ed,_0x5029b4){_0x5029b4(null,util['format'](_0x3f6c('0x2b'),Date[_0x3f6c('0x2c')](),_0x8e36ed[_0x3f6c('0x32')]));}})});router[_0x3f6c('0x24')]('/:id/system_avatar',upload[_0x3f6c('0x2d')]('file'),controller[_0x3f6c('0x36')]);router[_0x3f6c('0x24')]('/:id/notify',controller[_0x3f6c('0x37')]);const offlineUploadMulter=multer({'storage':multer[_0x3f6c('0x2f')]({'destination':function(_0x53c23a,_0x2192cb,_0x90db60){const _0x6bfb3d=path[_0x3f6c('0x30')](config[_0x3f6c('0x28')],_0x3f6c('0x38'),_0x3f6c('0x39'),'offline-chat');fs_extra[_0x3f6c('0x3a')](_0x6bfb3d,function(){_0x90db60(null,_0x6bfb3d);});},'filename':function(_0x564b9e,_0x11b831,_0x407f42){const _0x2f46aa=_0x11b831['originalname'][_0x3f6c('0x3b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1d73fe=path[_0x3f6c('0x3c')](_0x2f46aa);const _0x2c1f92=Date[_0x3f6c('0x2c')]()+'-'+_0x2f46aa[_0x3f6c('0x3b')](_0x1d73fe,'')+_0x1d73fe;_0x407f42(null,_0x2c1f92);}})});router['post'](_0x3f6c('0x3d'),offlineUploadMulter['any'](),controller[_0x3f6c('0x3e')]);router[_0x3f6c('0x24')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x3f6c('0x3f')]);router[_0x3f6c('0x24')](_0x3f6c('0x1d'),auth[_0x3f6c('0xb')](),controller['addApplications']);router[_0x3f6c('0x24')](_0x3f6c('0x1f'),auth['isAuthenticated'](),controller[_0x3f6c('0x40')]);router['post'](_0x3f6c('0x22'),auth[_0x3f6c('0xb')](),controller[_0x3f6c('0x41')]);router[_0x3f6c('0x42')](_0x3f6c('0xf'),auth[_0x3f6c('0xb')](),controller[_0x3f6c('0x43')]);router[_0x3f6c('0x44')](_0x3f6c('0xf'),auth[_0x3f6c('0xb')](),controller[_0x3f6c('0x45')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x3f6c('0x46')]);router[_0x3f6c('0x44')](_0x3f6c('0x12'),auth['isAuthenticated'](),controller[_0x3f6c('0x47')]);router[_0x3f6c('0x44')](_0x3f6c('0x22'),auth['isAuthenticated'](),controller[_0x3f6c('0x48')]);module['exports']=router; \ No newline at end of file +var _0x3137=['format','originalname','addCustomerAvatar','addSystemAvatar','notify','attachments','ensureDir','extname','replace','any','offline','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getAnswers','/:id/logo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','getInteractions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','/:id/fields','/:id/offline_messages','/:id/users','getAgents','post','addAnswer','join','root','%s-%s','now','single','file','addLogo','diskStorage','server/files/images/avatars/'];(function(_0xbcd7d4,_0x49f766){var _0xbb525=function(_0x12fd19){while(--_0x12fd19){_0xbcd7d4['push'](_0xbcd7d4['shift']());}};_0xbb525(++_0x49f766);}(_0x3137,0xa1));var _0x7313=function(_0x3c59c4,_0x2af708){_0x3c59c4=_0x3c59c4-0x0;var _0x2a42ab=_0x3137[_0x3c59c4];return _0x2a42ab;};'use strict';var multer=require(_0x7313('0x0'));var util=require(_0x7313('0x1'));var path=require(_0x7313('0x2'));var timeout=require(_0x7313('0x3'));var express=require(_0x7313('0x4'));var router=express[_0x7313('0x5')]();var fs_extra=require(_0x7313('0x6'));var auth=require(_0x7313('0x7'));var interaction=require(_0x7313('0x8'));var config=require('../../config/environment');var controller=require(_0x7313('0x9'));router[_0x7313('0xa')]('/',auth[_0x7313('0xb')](),controller[_0x7313('0xc')]);router[_0x7313('0xa')](_0x7313('0xd'),auth[_0x7313('0xb')](),controller[_0x7313('0xe')]);router['get'](_0x7313('0xf'),auth[_0x7313('0xb')](),controller[_0x7313('0x10')]);router[_0x7313('0xa')](_0x7313('0x11'),auth[_0x7313('0xb')](),controller['getDispositions']);router[_0x7313('0xa')]('/:id/canned_answers',auth[_0x7313('0xb')](),controller[_0x7313('0x12')]);router[_0x7313('0xa')](_0x7313('0x13'),controller['getLogo']);router[_0x7313('0xa')](_0x7313('0x14'),controller[_0x7313('0x15')]);router[_0x7313('0xa')](_0x7313('0x16'),controller[_0x7313('0x17')]);router[_0x7313('0xa')](_0x7313('0x18'),controller['getSystemAvatar']);router['get'](_0x7313('0x19'),auth['isAuthenticated'](),controller[_0x7313('0x1a')]);router['get'](_0x7313('0x1b'),controller['getSnippet']);router[_0x7313('0xa')](_0x7313('0x1c'),auth[_0x7313('0xb')](),controller[_0x7313('0x1d')]);router['get'](_0x7313('0x1e'),auth['isAuthenticated'](),controller['getProactiveActions']);router['get'](_0x7313('0x1f'),controller['getFields']);router[_0x7313('0xa')](_0x7313('0x20'),auth[_0x7313('0xb')](),controller['getOfflineMessages']);router[_0x7313('0xa')](_0x7313('0x21'),auth[_0x7313('0xb')](),controller[_0x7313('0x22')]);router[_0x7313('0x23')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7313('0x23')](_0x7313('0x11'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x7313('0x23')]('/:id/canned_answers',auth[_0x7313('0xb')](),controller[_0x7313('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1b32ee,_0x4453b0,_0x589efb){_0x589efb(null,path[_0x7313('0x25')](config[_0x7313('0x26')],'server/files/images/logos/'));},'filename':function(_0x30b7cb,_0x396712,_0x58b154){_0x58b154(null,util['format'](_0x7313('0x27'),Date[_0x7313('0x28')](),_0x396712['originalname']));}})});router[_0x7313('0x23')]('/:id/logo',upload[_0x7313('0x29')](_0x7313('0x2a')),controller[_0x7313('0x2b')]);var upload=multer({'storage':multer[_0x7313('0x2c')]({'destination':function(_0x38bc13,_0x49a453,_0x542200){_0x542200(null,path[_0x7313('0x25')](config[_0x7313('0x26')],_0x7313('0x2d')));},'filename':function(_0x42b2ea,_0x19819d,_0x51f590){_0x51f590(null,util['format'](_0x7313('0x27'),Date['now'](),_0x19819d['originalname']));}})});router[_0x7313('0x23')]('/:id/avatar',upload[_0x7313('0x29')](_0x7313('0x2a')),controller['addAvatar']);var upload=multer({'storage':multer[_0x7313('0x2c')]({'destination':function(_0x27b9fd,_0x1ef7b9,_0x204bea){_0x204bea(null,path[_0x7313('0x25')](config[_0x7313('0x26')],_0x7313('0x2d')));},'filename':function(_0x2711d6,_0x47e5e4,_0x9dfa7b){_0x9dfa7b(null,util[_0x7313('0x2e')](_0x7313('0x27'),Date[_0x7313('0x28')](),_0x47e5e4[_0x7313('0x2f')]));}})});router[_0x7313('0x23')](_0x7313('0x16'),upload[_0x7313('0x29')]('file'),controller[_0x7313('0x30')]);var upload=multer({'storage':multer[_0x7313('0x2c')]({'destination':function(_0x333af2,_0x2cdbad,_0x262244){_0x262244(null,path[_0x7313('0x25')](config[_0x7313('0x26')],_0x7313('0x2d')));},'filename':function(_0xa696c2,_0x49023,_0x3e9223){_0x3e9223(null,util[_0x7313('0x2e')](_0x7313('0x27'),Date[_0x7313('0x28')](),_0x49023['originalname']));}})});router[_0x7313('0x23')](_0x7313('0x18'),upload['single'](_0x7313('0x2a')),controller[_0x7313('0x31')]);router['post']('/:id/notify',controller[_0x7313('0x32')]);const offlineUploadMulter=multer({'storage':multer[_0x7313('0x2c')]({'destination':function(_0x49d431,_0x28475a,_0x1d7686){const _0x333c98=path['join'](config[_0x7313('0x26')],'server/files',_0x7313('0x33'),'offline-chat');fs_extra[_0x7313('0x34')](_0x333c98,function(){_0x1d7686(null,_0x333c98);});},'filename':function(_0x490f07,_0x4b9be0,_0xd1a20a){const _0x1d3347=_0x4b9be0[_0x7313('0x2f')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x10dbea=path[_0x7313('0x35')](_0x1d3347);const _0xd5812c=Date[_0x7313('0x28')]()+'-'+_0x1d3347[_0x7313('0x36')](_0x10dbea,'')+_0x10dbea;_0xd1a20a(null,_0xd5812c);}})});router[_0x7313('0x23')]('/:id/offline',offlineUploadMulter[_0x7313('0x37')](),controller[_0x7313('0x38')]);router[_0x7313('0x23')](_0x7313('0x19'),auth[_0x7313('0xb')](),controller['addInteraction']);router[_0x7313('0x23')]('/:id/applications',auth[_0x7313('0xb')](),controller[_0x7313('0x39')]);router[_0x7313('0x23')](_0x7313('0x1e'),auth[_0x7313('0xb')](),controller[_0x7313('0x3a')]);router[_0x7313('0x23')]('/:id/users',auth['isAuthenticated'](),controller[_0x7313('0x3b')]);router[_0x7313('0x3c')](_0x7313('0xf'),auth['isAuthenticated'](),controller[_0x7313('0x3d')]);router[_0x7313('0x3e')](_0x7313('0xf'),auth['isAuthenticated'](),controller[_0x7313('0x3f')]);router[_0x7313('0x3e')](_0x7313('0x11'),auth['isAuthenticated'](),controller[_0x7313('0x40')]);router[_0x7313('0x3e')](_0x7313('0x41'),auth[_0x7313('0xb')](),controller[_0x7313('0x42')]);router[_0x7313('0x3e')](_0x7313('0x21'),auth['isAuthenticated'](),controller[_0x7313('0x43')]);module[_0x7313('0x44')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 12ec5da..9d18329 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 _0x9fd4=['STRING','ENUM','AmazonAWS','Google','sequelize','exports'];(function(_0x16b331,_0xbbc92b){var _0x5613d9=function(_0x5c5c8b){while(--_0x5c5c8b){_0x16b331['push'](_0x16b331['shift']());}};_0x5613d9(++_0xbbc92b);}(_0x9fd4,0x16c));var _0x49fd=function(_0x459bcb,_0x1c02aa){_0x459bcb=_0x459bcb-0x0;var _0x308a6b=_0x9fd4[_0x459bcb];return _0x308a6b;};'use strict';var Sequelize=require(_0x49fd('0x0'));module[_0x49fd('0x1')]={'name':{'type':Sequelize[_0x49fd('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x49fd('0x3')](_0x49fd('0x4'),_0x49fd('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x49fd('0x2')]},'data2':{'type':Sequelize[_0x49fd('0x2')]}}; \ No newline at end of file +var _0xedf2=['exports','STRING','ENUM','Google'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xedf2,0x1ac));var _0x2edf=function(_0x315dd9,_0x54136b){_0x315dd9=_0x315dd9-0x0;var _0x1f9902=_0xedf2[_0x315dd9];return _0x1f9902;};'use strict';var Sequelize=require('sequelize');module[_0x2edf('0x0')]={'name':{'type':Sequelize[_0x2edf('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x2edf('0x2')]('AmazonAWS',_0x2edf('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x2edf('0x1')]},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index f00b934..1d2d60b 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 _0x2032=['body','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','CloudProvider','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','rows','show','params','keys','rawAttributes','includeAll','find','catch'];(function(_0x4ef30d,_0x2586bd){var _0x5768e5=function(_0x496a90){while(--_0x496a90){_0x4ef30d['push'](_0x4ef30d['shift']());}};_0x5768e5(++_0x2586bd);}(_0x2032,0xd9));var _0x2203=function(_0x186b67,_0x439a85){_0x186b67=_0x186b67-0x0;var _0x4753cd=_0x2032[_0x186b67];return _0x4753cd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'all':!![]}];}return db[_0x2203('0x2c')]['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x446209){_0x34b8ba[_0x2203('0x3f')]=_0x446209;return _0x34b8ba;})['then'](respondWithFilteredResult(_0x1df508,_0x9c53f))['catch'](handleError(_0x1df508,null));};exports[_0x2203('0x40')]=function(_0x3739f6,_0x368444){var _0x1e09f3={'raw':!![],'where':{'id':_0x3739f6[_0x2203('0x41')]['id']}},_0x372709={};_0x372709['model']=_[_0x2203('0x42')](db[_0x2203('0x2c')][_0x2203('0x43')]);_0x372709[_0x2203('0x30')]=_[_0x2203('0x42')](_0x3739f6[_0x2203('0x30')]);_0x372709[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x372709[_0x2203('0x31')],_0x372709[_0x2203('0x30')]);_0x1e09f3['attributes']=_[_0x2203('0x33')](_0x372709[_0x2203('0x31')],qs[_0x2203('0x34')](_0x3739f6[_0x2203('0x30')]['fields']));_0x1e09f3['attributes']=_0x1e09f3[_0x2203('0x32')]['length']?_0x1e09f3[_0x2203('0x32')]:_0x372709[_0x2203('0x31')];if(_0x3739f6[_0x2203('0x30')][_0x2203('0x44')]){_0x1e09f3['include']=[{'all':!![]}];}_0x1e09f3=_[_0x2203('0x3c')]({},_0x1e09f3,_0x3739f6[_0x2203('0x3e')]);return db['CloudProvider'][_0x2203('0x45')](_0x1e09f3)[_0x2203('0x23')](handleEntityNotFound(_0x368444,null))[_0x2203('0x23')](respondWithResult(_0x368444,null))[_0x2203('0x46')](handleError(_0x368444,null));};exports['create']=function(_0x4c1a29,_0x21b8ab){return db['CloudProvider']['create'](_0x4c1a29[_0x2203('0x47')],{})[_0x2203('0x23')](respondWithResult(_0x21b8ab,0xc9))[_0x2203('0x46')](handleError(_0x21b8ab,null));};exports['update']=function(_0x4c1496,_0x131aec){if(_0x4c1496[_0x2203('0x47')]['id']){delete _0x4c1496[_0x2203('0x47')]['id'];}return db[_0x2203('0x2c')][_0x2203('0x45')]({'where':{'id':_0x4c1496[_0x2203('0x41')]['id']}})['then'](handleEntityNotFound(_0x131aec,null))[_0x2203('0x23')](saveUpdates(_0x4c1496['body'],null))[_0x2203('0x23')](respondWithResult(_0x131aec,null))[_0x2203('0x46')](handleError(_0x131aec,null));};exports[_0x2203('0x24')]=function(_0x1e49dd,_0x58b9bb){return db['CloudProvider'][_0x2203('0x45')]({'where':{'id':_0x1e49dd[_0x2203('0x41')]['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x58b9bb,null))[_0x2203('0x23')](removeEntity(_0x58b9bb,null))['catch'](handleError(_0x58b9bb,null));}; \ No newline at end of file +var _0x0b0e=['hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','include','find','create','body','params','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','CloudProvider','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length'];(function(_0x3bf8de,_0x46f284){var _0x4e18d3=function(_0x235891){while(--_0x235891){_0x3bf8de['push'](_0x3bf8de['shift']());}};_0x4e18d3(++_0x46f284);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4599b6,_0x40c254){_0x4599b6=_0x4599b6-0x0;var _0x2e014c=_0x0b0e[_0x4599b6];return _0x2e014c;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['CloudProvider'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'all':!![]}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x41')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x402a0e){_0x36d137[_0xe0b0('0x42')]=_0x402a0e;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))[_0xe0b0('0x43')](handleError(_0x5b7a64,null));};exports[_0xe0b0('0x44')]=function(_0x52ffe4,_0x2aad80){var _0x309bbf={'raw':!![],'where':{'id':_0x52ffe4['params']['id']}},_0x528818={};_0x528818[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db['CloudProvider'][_0xe0b0('0x2b')]);_0x528818[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x52ffe4[_0xe0b0('0x2e')]);_0x528818[_0xe0b0('0x39')]=_['intersection'](_0x528818['model'],_0x528818['query']);_0x309bbf[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x528818['model'],qs[_0xe0b0('0x33')](_0x52ffe4[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x309bbf[_0xe0b0('0x32')]=_0x309bbf[_0xe0b0('0x32')]['length']?_0x309bbf['attributes']:_0x528818[_0xe0b0('0x31')];if(_0x52ffe4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x309bbf[_0xe0b0('0x45')]=[{'all':!![]}];}_0x309bbf=_[_0xe0b0('0x3b')]({},_0x309bbf,_0x52ffe4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x46')](_0x309bbf)['then'](handleEntityNotFound(_0x2aad80,null))['then'](respondWithResult(_0x2aad80,null))['catch'](handleError(_0x2aad80,null));};exports[_0xe0b0('0x47')]=function(_0x2184d3,_0x2419ce){return db[_0xe0b0('0x2a')]['create'](_0x2184d3[_0xe0b0('0x48')],{})[_0xe0b0('0x23')](respondWithResult(_0x2419ce,0xc9))['catch'](handleError(_0x2419ce,null));};exports['update']=function(_0x2365be,_0x1bc6e0){if(_0x2365be['body']['id']){delete _0x2365be[_0xe0b0('0x48')]['id'];}return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x2365be['params']['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x1bc6e0,null))['then'](saveUpdates(_0x2365be[_0xe0b0('0x48')],null))[_0xe0b0('0x23')](respondWithResult(_0x1bc6e0,null))[_0xe0b0('0x43')](handleError(_0x1bc6e0,null));};exports[_0xe0b0('0x24')]=function(_0x19ee71,_0xf9e694){return db['CloudProvider']['find']({'where':{'id':_0x19ee71[_0xe0b0('0x49')]['id']}})['then'](handleEntityNotFound(_0xf9e694,null))['then'](removeEntity(_0xf9e694,null))[_0xe0b0('0x43')](handleError(_0xf9e694,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 94f5c8a..dda6193 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 _0xe4d3=['../../config/environment','./cloudProvider.attributes','exports','define','cloud_providers','lodash','../../config/logger','api','bluebird','path'];(function(_0xe97423,_0x5a5df8){var _0x31c066=function(_0x28ac2d){while(--_0x28ac2d){_0xe97423['push'](_0xe97423['shift']());}};_0x31c066(++_0x5a5df8);}(_0xe4d3,0x1b3));var _0x3e4d=function(_0x16ce5b,_0x5c5fdb){_0x16ce5b=_0x16ce5b-0x0;var _0x44639c=_0xe4d3[_0x16ce5b];return _0x44639c;};'use strict';var _=require(_0x3e4d('0x0'));var util=require('util');var logger=require(_0x3e4d('0x1'))(_0x3e4d('0x2'));var moment=require('moment');var BPromise=require(_0x3e4d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3e4d('0x4'));var rimraf=require('rimraf');var config=require(_0x3e4d('0x5'));var attributes=require(_0x3e4d('0x6'));module[_0x3e4d('0x7')]=function(_0x2705c8,_0x5a9392){return _0x2705c8[_0x3e4d('0x8')]('CloudProvider',attributes,{'tableName':_0x3e4d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe334=['path','rimraf','exports','define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x50aff3,_0x4a8c08){var _0x4c311d=function(_0x189e87){while(--_0x189e87){_0x50aff3['push'](_0x50aff3['shift']());}};_0x4c311d(++_0x4a8c08);}(_0xe334,0x1c0));var _0x4e33=function(_0x2dff18,_0x4a9346){_0x2dff18=_0x2dff18-0x0;var _0x44db5f=_0xe334[_0x2dff18];return _0x44db5f;};'use strict';var _=require(_0x4e33('0x0'));var util=require(_0x4e33('0x1'));var logger=require(_0x4e33('0x2'))(_0x4e33('0x3'));var moment=require(_0x4e33('0x4'));var BPromise=require(_0x4e33('0x5'));var rp=require(_0x4e33('0x6'));var fs=require('fs');var path=require(_0x4e33('0x7'));var rimraf=require(_0x4e33('0x8'));var config=require('../../config/environment');var attributes=require('./cloudProvider.attributes');module[_0x4e33('0x9')]=function(_0x164bf9,_0x1de7ed){return _0x164bf9[_0x4e33('0xa')](_0x4e33('0xb'),attributes,{'tableName':_0x4e33('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 72c2112..2e01fe6 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 _0xcae2=['CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info'];(function(_0x390cea,_0x43c078){var _0x14bf80=function(_0x196f3c){while(--_0x196f3c){_0x390cea['push'](_0x390cea['shift']());}};_0x14bf80(++_0x43c078);}(_0xcae2,0x143));var _0x2cae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcae2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2cae('0x0'));var util=require(_0x2cae('0x1'));var moment=require(_0x2cae('0x2'));var BPromise=require(_0x2cae('0x3'));var rs=require(_0x2cae('0x4'));var fs=require('fs');var Redis=require(_0x2cae('0x5'));var db=require(_0x2cae('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2cae('0x7'))(_0x2cae('0x8'));var config=require(_0x2cae('0x9'));var jayson=require(_0x2cae('0xa'));var client=jayson['client'][_0x2cae('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1feff6,_0x1e1a3d,_0x25b6a2){return new BPromise(function(_0x2e7498,_0x49e1d1){return client['request'](_0x1feff6,_0x25b6a2)['then'](function(_0x49f0d3){logger[_0x2cae('0xc')](_0x2cae('0xd'),_0x1e1a3d,_0x2cae('0xe'));logger[_0x2cae('0xf')](_0x2cae('0x10'),_0x1e1a3d,_0x2cae('0xe'),JSON['stringify'](_0x49f0d3));if(_0x49f0d3[_0x2cae('0x11')]){if(_0x49f0d3['error'][_0x2cae('0x12')]===0x1f4){logger[_0x2cae('0x11')](_0x2cae('0xd'),_0x1e1a3d,_0x49f0d3[_0x2cae('0x11')][_0x2cae('0x13')]);return _0x49e1d1(_0x49f0d3[_0x2cae('0x11')]['message']);}logger[_0x2cae('0x11')]('CloudProvider,\x20%s,\x20%s',_0x1e1a3d,_0x49f0d3[_0x2cae('0x11')][_0x2cae('0x13')]);return _0x2e7498(_0x49f0d3['error'][_0x2cae('0x13')]);}else{logger[_0x2cae('0xc')](_0x2cae('0xd'),_0x1e1a3d,_0x2cae('0xe'));_0x2e7498(_0x49f0d3['result'][_0x2cae('0x13')]);}})[_0x2cae('0x14')](function(_0x4a89e1){logger[_0x2cae('0x11')](_0x2cae('0xd'),_0x1e1a3d,_0x4a89e1);_0x49e1d1(_0x4a89e1);});});} \ No newline at end of file +var _0x0c3a=['jayson/promise','client','request','then','info','CloudProvider,\x20%s,\x20%s','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x2b91c5,_0x3b6db5){var _0xbd5531=function(_0x54783d){while(--_0x54783d){_0x2b91c5['push'](_0x2b91c5['shift']());}};_0xbd5531(++_0x3b6db5);}(_0x0c3a,0x171));var _0xa0c3=function(_0x2c09bb,_0x279c10){_0x2c09bb=_0x2c09bb-0x0;var _0x47da2a=_0x0c3a[_0x2c09bb];return _0x47da2a;};'use strict';var _=require(_0xa0c3('0x0'));var util=require(_0xa0c3('0x1'));var moment=require(_0xa0c3('0x2'));var BPromise=require(_0xa0c3('0x3'));var rs=require(_0xa0c3('0x4'));var fs=require('fs');var Redis=require(_0xa0c3('0x5'));var db=require(_0xa0c3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0c3('0x7'))(_0xa0c3('0x8'));var config=require('../../config/environment');var jayson=require(_0xa0c3('0x9'));var client=jayson[_0xa0c3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fd974,_0x4f90f8,_0x5770bd){return new BPromise(function(_0x10da7c,_0x109c9a){return client[_0xa0c3('0xb')](_0x2fd974,_0x5770bd)[_0xa0c3('0xc')](function(_0x5d7c35){logger[_0xa0c3('0xd')](_0xa0c3('0xe'),_0x4f90f8,'request\x20sent');logger['debug'](_0xa0c3('0xf'),_0x4f90f8,_0xa0c3('0x10'),JSON['stringify'](_0x5d7c35));if(_0x5d7c35[_0xa0c3('0x11')]){if(_0x5d7c35[_0xa0c3('0x11')][_0xa0c3('0x12')]===0x1f4){logger['error'](_0xa0c3('0xe'),_0x4f90f8,_0x5d7c35[_0xa0c3('0x11')]['message']);return _0x109c9a(_0x5d7c35['error'][_0xa0c3('0x13')]);}logger[_0xa0c3('0x11')](_0xa0c3('0xe'),_0x4f90f8,_0x5d7c35[_0xa0c3('0x11')][_0xa0c3('0x13')]);return _0x10da7c(_0x5d7c35['error'][_0xa0c3('0x13')]);}else{logger['info'](_0xa0c3('0xe'),_0x4f90f8,'request\x20sent');_0x10da7c(_0x5d7c35['result']['message']);}})[_0xa0c3('0x14')](function(_0x474695){logger[_0xa0c3('0x11')]('CloudProvider,\x20%s,\x20%s',_0x4f90f8,_0x474695);_0x109c9a(_0x474695);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 6d7ff9b..489a06e 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 _0x686f=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','index','/:id','isAuthenticated','post','put','update','delete','destroy','exports','util','path'];(function(_0x143731,_0xa4bb31){var _0xa0e4de=function(_0xa2fb93){while(--_0xa2fb93){_0x143731['push'](_0x143731['shift']());}};_0xa0e4de(++_0xa4bb31);}(_0x686f,0x108));var _0xf686=function(_0x2c8f94,_0x595db3){_0x2c8f94=_0x2c8f94-0x0;var _0x2ac00e=_0x686f[_0x2c8f94];return _0x2ac00e;};'use strict';var multer=require('multer');var util=require(_0xf686('0x0'));var path=require(_0xf686('0x1'));var timeout=require(_0xf686('0x2'));var express=require(_0xf686('0x3'));var router=express[_0xf686('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf686('0x5'));var interaction=require(_0xf686('0x6'));var config=require(_0xf686('0x7'));var controller=require(_0xf686('0x8'));router[_0xf686('0x9')]('/',auth['isAuthenticated'](),controller[_0xf686('0xa')]);router[_0xf686('0x9')](_0xf686('0xb'),auth[_0xf686('0xc')](),controller['show']);router[_0xf686('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf686('0xe')]('/:id',auth[_0xf686('0xc')](),controller[_0xf686('0xf')]);router[_0xf686('0x10')](_0xf686('0xb'),auth['isAuthenticated'](),controller[_0xf686('0x11')]);module[_0xf686('0x12')]=router; \ No newline at end of file +var _0xa63a=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','/:id','show','post','create','put','isAuthenticated'];(function(_0x47fb99,_0x5848cc){var _0x114227=function(_0x170455){while(--_0x170455){_0x47fb99['push'](_0x47fb99['shift']());}};_0x114227(++_0x5848cc);}(_0xa63a,0x154));var _0xaa63=function(_0x2d9e27,_0x5965b2){_0x2d9e27=_0x2d9e27-0x0;var _0xd35381=_0xa63a[_0x2d9e27];return _0xd35381;};'use strict';var multer=require('multer');var util=require(_0xaa63('0x0'));var path=require(_0xaa63('0x1'));var timeout=require(_0xaa63('0x2'));var express=require(_0xaa63('0x3'));var router=express[_0xaa63('0x4')]();var fs_extra=require(_0xaa63('0x5'));var auth=require(_0xaa63('0x6'));var interaction=require(_0xaa63('0x7'));var config=require(_0xaa63('0x8'));var controller=require(_0xaa63('0x9'));router[_0xaa63('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xaa63('0xb'),auth['isAuthenticated'](),controller[_0xaa63('0xc')]);router[_0xaa63('0xd')]('/',auth['isAuthenticated'](),controller[_0xaa63('0xe')]);router[_0xaa63('0xf')](_0xaa63('0xb'),auth[_0xaa63('0x10')](),controller[_0xaa63('0x11')]);router[_0xaa63('0x12')](_0xaa63('0xb'),auth['isAuthenticated'](),controller[_0xaa63('0x13')]);module[_0xaa63('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index d66525e..0e913e2 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 _0x786f=['sequelize','exports','name','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x786f,0xc8));var _0xf786=function(_0x49beea,_0x47add1){_0x49beea=_0x49beea-0x0;var _0x27693a=_0x786f[_0x49beea];return _0x27693a;};'use strict';var Sequelize=require(_0xf786('0x0'));module[_0xf786('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xf786('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xf786('0x3')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xf786('0x3')]},'fax':{'type':Sequelize[_0xf786('0x3')]},'type':{'type':Sequelize[_0xf786('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xf786('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xf786('0x3')]},'email':{'type':Sequelize[_0xf786('0x3')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xf786('0x3')]},'sStreet':{'type':Sequelize[_0xf786('0x3')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xf786('0x3')]},'description':{'type':Sequelize[_0xf786('0x3')]}}; \ No newline at end of file +var _0xb04f=['sequelize','STRING','name'];(function(_0x19aa84,_0x549537){var _0x536146=function(_0x5da480){while(--_0x5da480){_0x19aa84['push'](_0x19aa84['shift']());}};_0x536146(++_0x549537);}(_0xb04f,0x174));var _0xfb04=function(_0x52ec86,_0x34535f){_0x52ec86=_0x52ec86-0x0;var _0x2b9c51=_0xb04f[_0x52ec86];return _0x2b9c51;};'use strict';var Sequelize=require(_0xfb04('0x0'));module['exports']={'name':{'type':Sequelize[_0xfb04('0x1')],'unique':_0xfb04('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xfb04('0x1')]},'companyId':{'type':Sequelize[_0xfb04('0x1')]},'website':{'type':Sequelize[_0xfb04('0x1')]},'phone':{'type':Sequelize[_0xfb04('0x1')]},'fax':{'type':Sequelize[_0xfb04('0x1')]},'type':{'type':Sequelize[_0xfb04('0x1')]},'street':{'type':Sequelize[_0xfb04('0x1')]},'postalCode':{'type':Sequelize[_0xfb04('0x1')]},'city':{'type':Sequelize[_0xfb04('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xfb04('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xfb04('0x1')]},'sPostalCode':{'type':Sequelize[_0xfb04('0x1')]},'sCity':{'type':Sequelize[_0xfb04('0x1')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfb04('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 704a275..6c4c88c 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 _0xedb0=['filter','options','include','findAll','rows','catch','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addContacts','CmContact','ids','omit','getContacts','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','Companies','UserProfileResource','end','error','name','index','CmCompany','describe','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','where','merge','map'];(function(_0x17e73b,_0x237aba){var _0x14fdb7=function(_0x34a9cd){while(--_0x34a9cd){_0x17e73b['push'](_0x17e73b['shift']());}};_0x14fdb7(++_0x237aba);}(_0xedb0,0x10c));var _0x0edb=function(_0x349711,_0x12a44c){_0x349711=_0x349711-0x0;var _0x17cae0=_0xedb0[_0x349711];return _0x17cae0;};'use strict';var emlformat=require(_0x0edb('0x0'));var rimraf=require(_0x0edb('0x1'));var zipdir=require(_0x0edb('0x2'));var jsonpatch=require(_0x0edb('0x3'));var rp=require(_0x0edb('0x4'));var moment=require('moment');var BPromise=require(_0x0edb('0x5'));var Mustache=require(_0x0edb('0x6'));var util=require('util');var path=require(_0x0edb('0x7'));var sox=require(_0x0edb('0x8'));var csv=require(_0x0edb('0x9'));var ejs=require(_0x0edb('0xa'));var fs=require('fs');var fs_extra=require(_0x0edb('0xb'));var _=require(_0x0edb('0xc'));var squel=require(_0x0edb('0xd'));var crypto=require(_0x0edb('0xe'));var jsforce=require(_0x0edb('0xf'));var deskjs=require(_0x0edb('0x10'));var toCsv=require(_0x0edb('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0edb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0edb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0edb('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x0edb('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x0edb('0x15'));var db=require(_0x0edb('0x16'))['db'];function respondWithStatusCode(_0x541502,_0xc48998){_0xc48998=_0xc48998||0xcc;return function(_0x5c8f38){if(_0x5c8f38){return _0x541502[_0x0edb('0x17')](_0xc48998);}return _0x541502['status'](_0xc48998)['end']();};}function respondWithResult(_0x2fa523,_0x1e69c0){_0x1e69c0=_0x1e69c0||0xc8;return function(_0x3a549a){if(_0x3a549a){return _0x2fa523[_0x0edb('0x18')](_0x1e69c0)[_0x0edb('0x19')](_0x3a549a);}};}function respondWithFilteredResult(_0x388e87,_0x130762){return function(_0x5d07f6){if(_0x5d07f6){var _0x19ad51=typeof _0x130762[_0x0edb('0x1a')]===_0x0edb('0x1b')&&typeof _0x130762[_0x0edb('0x1c')]===_0x0edb('0x1b');var _0x1812df=_0x5d07f6[_0x0edb('0x1d')];var _0x469332=_0x19ad51?0x0:_0x130762['offset'];var _0x3e4486=_0x19ad51?_0x5d07f6[_0x0edb('0x1d')]:_0x130762[_0x0edb('0x1a')]+_0x130762[_0x0edb('0x1c')];var _0x514556;if(_0x3e4486>=_0x1812df){_0x3e4486=_0x1812df;_0x514556=0xc8;}else{_0x514556=0xce;}_0x388e87[_0x0edb('0x18')](_0x514556);return _0x388e87[_0x0edb('0x1e')](_0x0edb('0x1f'),_0x469332+'-'+_0x3e4486+'/'+_0x1812df)[_0x0edb('0x19')](_0x5d07f6);}return null;};}function patchUpdates(_0x3fc6a1){return function(_0x40554c){try{jsonpatch[_0x0edb('0x20')](_0x40554c,_0x3fc6a1,!![]);}catch(_0x1d4bd5){return BPromise[_0x0edb('0x21')](_0x1d4bd5);}return _0x40554c['save']();};}function saveUpdates(_0x4ea3fa,_0x4fb902){return function(_0x19c9fd){if(_0x19c9fd){return _0x19c9fd[_0x0edb('0x22')](_0x4ea3fa)[_0x0edb('0x23')](function(_0x271b78){return _0x271b78;});}return null;};}function removeEntity(_0x3d5f7c,_0x167163){return function(_0x2230b0){if(_0x2230b0){return _0x2230b0[_0x0edb('0x24')]()['then'](function(){var _0x25ec8d=_0x2230b0[_0x0edb('0x25')]({'plain':!![]});var _0x455018=_0x0edb('0x26');return db[_0x0edb('0x27')][_0x0edb('0x24')]({'where':{'type':_0x455018,'resourceId':_0x25ec8d['id']}})[_0x0edb('0x23')](function(){return _0x2230b0;});})[_0x0edb('0x23')](function(){_0x3d5f7c[_0x0edb('0x18')](0xcc)[_0x0edb('0x28')]();});}};}function handleEntityNotFound(_0x5063af,_0x55d902){return function(_0x4b6318){if(!_0x4b6318){_0x5063af[_0x0edb('0x17')](0x194);}return _0x4b6318;};}function handleError(_0x455a93,_0x165a28){_0x165a28=_0x165a28||0x1f4;return function(_0x3aee70){logger[_0x0edb('0x29')](_0x3aee70['stack']);if(_0x3aee70['name']){delete _0x3aee70[_0x0edb('0x2a')];}_0x455a93[_0x0edb('0x18')](_0x165a28)['send'](_0x3aee70);};}exports[_0x0edb('0x2b')]=function(_0x2fac6a,_0x49f011){var _0x45dd9a={},_0x3c1f9a={},_0x3519cc={'count':0x0,'rows':[]};return db[_0x0edb('0x2c')][_0x0edb('0x2d')]()[_0x0edb('0x23')](function(_0x257e65){_0x3c1f9a[_0x0edb('0x2e')]=_['keys'](_0x257e65);_0x3c1f9a[_0x0edb('0x2f')]=_[_0x0edb('0x30')](_0x2fac6a['query']);_0x3c1f9a[_0x0edb('0x31')]=_[_0x0edb('0x32')](_0x3c1f9a[_0x0edb('0x2e')],_0x3c1f9a[_0x0edb('0x2f')]);_0x45dd9a[_0x0edb('0x33')]=_[_0x0edb('0x32')](_0x3c1f9a[_0x0edb('0x2e')],qs[_0x0edb('0x34')](_0x2fac6a['query'][_0x0edb('0x34')]));_0x45dd9a['attributes']=_0x45dd9a[_0x0edb('0x33')]['length']?_0x45dd9a['attributes']:_0x3c1f9a[_0x0edb('0x2e')];if(!_0x2fac6a[_0x0edb('0x2f')]['hasOwnProperty'](_0x0edb('0x35'))){_0x45dd9a[_0x0edb('0x1c')]=qs['limit'](_0x2fac6a[_0x0edb('0x2f')][_0x0edb('0x1c')]);_0x45dd9a[_0x0edb('0x1a')]=qs[_0x0edb('0x1a')](_0x2fac6a[_0x0edb('0x2f')]['offset']);}_0x45dd9a[_0x0edb('0x36')]=qs[_0x0edb('0x37')](_0x2fac6a[_0x0edb('0x2f')][_0x0edb('0x37')]);_0x45dd9a['where']=qs['filters'](_[_0x0edb('0x38')](_0x2fac6a[_0x0edb('0x2f')],_0x3c1f9a[_0x0edb('0x31')]),_0x257e65);if(_0x2fac6a[_0x0edb('0x2f')]['filter']){_0x45dd9a[_0x0edb('0x39')]=_[_0x0edb('0x3a')](_0x45dd9a[_0x0edb('0x39')],{'$or':_[_0x0edb('0x3b')](_0x45dd9a[_0x0edb('0x33')],function(_0x278570){var _0x4d8da2={};_0x4d8da2[_0x278570]={'$like':'%'+_0x2fac6a['query'][_0x0edb('0x3c')]+'%'};return _0x4d8da2;})});}_0x45dd9a=_[_0x0edb('0x3a')]({},_0x45dd9a,_0x2fac6a[_0x0edb('0x3d')]);var _0x5b8659={'where':_0x45dd9a['where']};return db['CmCompany']['count'](_0x5b8659)[_0x0edb('0x23')](function(_0x12198d){_0x3519cc[_0x0edb('0x1d')]=_0x12198d;if(_0x2fac6a[_0x0edb('0x2f')]['includeAll']){_0x45dd9a[_0x0edb('0x3e')]=[{'all':!![]}];}return db['CmCompany'][_0x0edb('0x3f')](_0x45dd9a);})['then'](function(_0x40dc74){_0x3519cc[_0x0edb('0x40')]=_0x40dc74;return _0x3519cc;})[_0x0edb('0x23')](respondWithFilteredResult(_0x49f011,_0x45dd9a))[_0x0edb('0x41')](handleError(_0x49f011,null));})[_0x0edb('0x41')](handleError(_0x49f011,null));};exports['show']=function(_0x2e4d9b,_0x3e3953){var _0x14c15d={'raw':![],'where':{'id':_0x2e4d9b['params']['id']}},_0x37417d={};_0x37417d['model']=_[_0x0edb('0x30')](db[_0x0edb('0x2c')][_0x0edb('0x42')]);_0x37417d[_0x0edb('0x2f')]=_[_0x0edb('0x30')](_0x2e4d9b[_0x0edb('0x2f')]);_0x37417d[_0x0edb('0x31')]=_['intersection'](_0x37417d[_0x0edb('0x2e')],_0x37417d[_0x0edb('0x2f')]);_0x14c15d[_0x0edb('0x33')]=_[_0x0edb('0x32')](_0x37417d[_0x0edb('0x2e')],qs[_0x0edb('0x34')](_0x2e4d9b[_0x0edb('0x2f')]['fields']));_0x14c15d[_0x0edb('0x33')]=_0x14c15d[_0x0edb('0x33')][_0x0edb('0x43')]?_0x14c15d['attributes']:_0x37417d['model'];if(_0x2e4d9b['query']['includeAll']){_0x14c15d[_0x0edb('0x3e')]=[{'all':!![]}];}_0x14c15d=_[_0x0edb('0x3a')]({},_0x14c15d,_0x2e4d9b[_0x0edb('0x3d')]);return db['CmCompany'][_0x0edb('0x44')](_0x14c15d)[_0x0edb('0x23')](handleEntityNotFound(_0x3e3953,null))[_0x0edb('0x23')](respondWithResult(_0x3e3953,null))[_0x0edb('0x41')](handleError(_0x3e3953,null));};exports[_0x0edb('0x45')]=function(_0x15fd61,_0x4ff593){return db[_0x0edb('0x2c')]['create'](_0x15fd61[_0x0edb('0x46')],{})[_0x0edb('0x23')](function(_0x5c9ff8){var _0x5224ea=_0x15fd61[_0x0edb('0x47')][_0x0edb('0x25')]({'plain':!![]});if(!_0x5224ea)throw new Error(_0x0edb('0x48'));if(_0x5224ea['role']===_0x0edb('0x47')){var _0x141956=_0x5c9ff8['get']({'plain':!![]});var _0x4051fe=_0x0edb('0x26');return db['UserProfileSection'][_0x0edb('0x44')]({'where':{'name':_0x4051fe,'userProfileId':_0x5224ea['userProfileId']},'raw':!![]})[_0x0edb('0x23')](function(_0x17c516){if(_0x17c516&&_0x17c516[_0x0edb('0x49')]===0x0){return db[_0x0edb('0x27')]['create']({'name':_0x141956[_0x0edb('0x2a')],'resourceId':_0x141956['id'],'type':_0x17c516[_0x0edb('0x2a')],'sectionId':_0x17c516['id']},{})['then'](function(){return _0x5c9ff8;});}else{return _0x5c9ff8;}})[_0x0edb('0x41')](function(_0x8f3f64){logger['error'](_0x0edb('0x4a'),_0x8f3f64);throw _0x8f3f64;});}return _0x5c9ff8;})['then'](respondWithResult(_0x4ff593,0xc9))[_0x0edb('0x41')](handleError(_0x4ff593,null));};exports[_0x0edb('0x22')]=function(_0x2b5ac0,_0x5ad408){if(_0x2b5ac0[_0x0edb('0x46')]['id']){delete _0x2b5ac0[_0x0edb('0x46')]['id'];}return db[_0x0edb('0x2c')][_0x0edb('0x44')]({'where':{'id':_0x2b5ac0[_0x0edb('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5ad408,null))['then'](saveUpdates(_0x2b5ac0[_0x0edb('0x46')],null))['then'](respondWithResult(_0x5ad408,null))[_0x0edb('0x41')](handleError(_0x5ad408,null));};exports[_0x0edb('0x24')]=function(_0x560604,_0x45f2d8){return db[_0x0edb('0x2c')]['find']({'where':{'id':_0x560604['params']['id']}})[_0x0edb('0x23')](handleEntityNotFound(_0x45f2d8,null))[_0x0edb('0x23')](removeEntity(_0x45f2d8,null))['catch'](handleError(_0x45f2d8,null));};exports[_0x0edb('0x2d')]=function(_0x3188d5,_0x10ac46){return db[_0x0edb('0x2c')][_0x0edb('0x2d')]()['then'](respondWithResult(_0x10ac46,null))[_0x0edb('0x41')](handleError(_0x10ac46,null));};exports[_0x0edb('0x4c')]=function(_0x4ad731,_0x11b4f5,_0x37d42e){return db[_0x0edb('0x4d')][_0x0edb('0x44')]({'where':{'id':_0x4ad731[_0x0edb('0x4b')]['id']}})[_0x0edb('0x23')](handleEntityNotFound(_0x11b4f5,null))[_0x0edb('0x23')](function(_0xd76e54){if(_0xd76e54){return _0xd76e54[_0x0edb('0x4c')](_0x4ad731['body'][_0x0edb('0x4e')],_[_0x0edb('0x4f')](_0x4ad731[_0x0edb('0x46')],[_0x0edb('0x4e'),'id'])||{});}})[_0x0edb('0x23')](respondWithResult(_0x11b4f5,null))['catch'](handleError(_0x11b4f5,null));};exports[_0x0edb('0x50')]=function(_0x354d55,_0x4ea9de,_0x8dd145){var _0x282b2d={};var _0x403c22={};var _0x159b04;var _0x329210;return db[_0x0edb('0x2c')]['findOne']({'where':{'id':_0x354d55['params']['id']}})['then'](handleEntityNotFound(_0x4ea9de,null))[_0x0edb('0x23')](function(_0x515a84){if(_0x515a84){_0x159b04=_0x515a84;_0x403c22[_0x0edb('0x2e')]=_[_0x0edb('0x30')](db[_0x0edb('0x4d')]['rawAttributes']);_0x403c22[_0x0edb('0x2f')]=_[_0x0edb('0x30')](_0x354d55[_0x0edb('0x2f')]);_0x403c22[_0x0edb('0x31')]=_[_0x0edb('0x32')](_0x403c22[_0x0edb('0x2e')],_0x403c22[_0x0edb('0x2f')]);_0x282b2d[_0x0edb('0x33')]=_[_0x0edb('0x32')](_0x403c22[_0x0edb('0x2e')],qs[_0x0edb('0x34')](_0x354d55[_0x0edb('0x2f')][_0x0edb('0x34')]));_0x282b2d[_0x0edb('0x33')]=_0x282b2d[_0x0edb('0x33')][_0x0edb('0x43')]?_0x282b2d['attributes']:_0x403c22[_0x0edb('0x2e')];_0x282b2d[_0x0edb('0x36')]=qs[_0x0edb('0x37')](_0x354d55['query'][_0x0edb('0x37')]);_0x282b2d[_0x0edb('0x39')]=qs[_0x0edb('0x31')](_[_0x0edb('0x38')](_0x354d55[_0x0edb('0x2f')],_0x403c22[_0x0edb('0x31')]));if(_0x354d55[_0x0edb('0x2f')][_0x0edb('0x3c')]){_0x282b2d[_0x0edb('0x39')]=_[_0x0edb('0x3a')](_0x282b2d[_0x0edb('0x39')],{'$or':_['map'](_0x282b2d['attributes'],function(_0xa87677){var _0x4e29a7={};_0x4e29a7[_0xa87677]={'$like':'%'+_0x354d55[_0x0edb('0x2f')][_0x0edb('0x3c')]+'%'};return _0x4e29a7;})});}_0x282b2d=_[_0x0edb('0x3a')]({},_0x282b2d,_0x354d55['options']);return _0x159b04[_0x0edb('0x50')](_0x282b2d);}})[_0x0edb('0x23')](function(_0x6e5b0f){if(_0x6e5b0f){_0x329210=_0x6e5b0f[_0x0edb('0x43')];if(!_0x354d55[_0x0edb('0x2f')][_0x0edb('0x51')]('nolimit')){_0x282b2d[_0x0edb('0x1c')]=qs[_0x0edb('0x1c')](_0x354d55[_0x0edb('0x2f')][_0x0edb('0x1c')]);_0x282b2d[_0x0edb('0x1a')]=qs[_0x0edb('0x1a')](_0x354d55[_0x0edb('0x2f')][_0x0edb('0x1a')]);}return _0x159b04[_0x0edb('0x50')](_0x282b2d);}})['then'](function(_0x155a5d){if(_0x155a5d){return _0x155a5d?{'count':_0x329210,'rows':_0x155a5d}:null;}})[_0x0edb('0x23')](respondWithResult(_0x4ea9de,null))[_0x0edb('0x41')](handleError(_0x4ea9de,null));}; \ No newline at end of file +var _0x8fe0=['nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','catch','params','length','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','UserProfileSection','userProfileId','body','addContacts','CmContact','omit','ids','getContacts','findOne','rawAttributes','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','save','update','then','destroy','UserProfileResource','end','error','stack','name','send','index','CmCompany','describe','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8fe0,0xd1));var _0x08fe=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8fe0[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x08fe('0x0'));var zipdir=require(_0x08fe('0x1'));var jsonpatch=require(_0x08fe('0x2'));var rp=require(_0x08fe('0x3'));var moment=require(_0x08fe('0x4'));var BPromise=require(_0x08fe('0x5'));var Mustache=require(_0x08fe('0x6'));var util=require(_0x08fe('0x7'));var path=require(_0x08fe('0x8'));var sox=require(_0x08fe('0x9'));var csv=require(_0x08fe('0xa'));var ejs=require(_0x08fe('0xb'));var fs=require('fs');var fs_extra=require(_0x08fe('0xc'));var _=require(_0x08fe('0xd'));var squel=require(_0x08fe('0xe'));var crypto=require(_0x08fe('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x08fe('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x08fe('0x11'));var authService=require(_0x08fe('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x08fe('0x13'));var hardwareService=require(_0x08fe('0x14'));var logger=require(_0x08fe('0x15'))(_0x08fe('0x16'));var utils=require(_0x08fe('0x17'));var config=require(_0x08fe('0x18'));var licenseUtil=require(_0x08fe('0x19'));var db=require(_0x08fe('0x1a'))['db'];function respondWithStatusCode(_0x1cd83a,_0x263c01){_0x263c01=_0x263c01||0xcc;return function(_0x3e5856){if(_0x3e5856){return _0x1cd83a[_0x08fe('0x1b')](_0x263c01);}return _0x1cd83a[_0x08fe('0x1c')](_0x263c01)['end']();};}function respondWithResult(_0x32ba9f,_0x36df1b){_0x36df1b=_0x36df1b||0xc8;return function(_0x33d2d7){if(_0x33d2d7){return _0x32ba9f[_0x08fe('0x1c')](_0x36df1b)[_0x08fe('0x1d')](_0x33d2d7);}};}function respondWithFilteredResult(_0x3296f5,_0x13e04f){return function(_0x2acd35){if(_0x2acd35){var _0x41205f=typeof _0x13e04f['offset']==='undefined'&&typeof _0x13e04f[_0x08fe('0x1e')]===_0x08fe('0x1f');var _0x421f21=_0x2acd35[_0x08fe('0x20')];var _0x58b4f9=_0x41205f?0x0:_0x13e04f['offset'];var _0x4325a4=_0x41205f?_0x2acd35[_0x08fe('0x20')]:_0x13e04f[_0x08fe('0x21')]+_0x13e04f[_0x08fe('0x1e')];var _0x2ccd79;if(_0x4325a4>=_0x421f21){_0x4325a4=_0x421f21;_0x2ccd79=0xc8;}else{_0x2ccd79=0xce;}_0x3296f5[_0x08fe('0x1c')](_0x2ccd79);return _0x3296f5['set']('Content-Range',_0x58b4f9+'-'+_0x4325a4+'/'+_0x421f21)[_0x08fe('0x1d')](_0x2acd35);}return null;};}function patchUpdates(_0x27ed67){return function(_0x1f81a2){try{jsonpatch['apply'](_0x1f81a2,_0x27ed67,!![]);}catch(_0x4dbf3c){return BPromise['reject'](_0x4dbf3c);}return _0x1f81a2[_0x08fe('0x22')]();};}function saveUpdates(_0x1d9071,_0x21527c){return function(_0x4bed20){if(_0x4bed20){return _0x4bed20[_0x08fe('0x23')](_0x1d9071)[_0x08fe('0x24')](function(_0x33eaaf){return _0x33eaaf;});}return null;};}function removeEntity(_0x4ecf98,_0x40231a){return function(_0x2ef445){if(_0x2ef445){return _0x2ef445[_0x08fe('0x25')]()['then'](function(){var _0x4cca26=_0x2ef445['get']({'plain':!![]});var _0x170e39='Companies';return db[_0x08fe('0x26')][_0x08fe('0x25')]({'where':{'type':_0x170e39,'resourceId':_0x4cca26['id']}})[_0x08fe('0x24')](function(){return _0x2ef445;});})[_0x08fe('0x24')](function(){_0x4ecf98['status'](0xcc)[_0x08fe('0x27')]();});}};}function handleEntityNotFound(_0x318062,_0x2fe7f0){return function(_0x8b8e2e){if(!_0x8b8e2e){_0x318062[_0x08fe('0x1b')](0x194);}return _0x8b8e2e;};}function handleError(_0xc3586,_0xa39b53){_0xa39b53=_0xa39b53||0x1f4;return function(_0x41ad03){logger[_0x08fe('0x28')](_0x41ad03[_0x08fe('0x29')]);if(_0x41ad03[_0x08fe('0x2a')]){delete _0x41ad03['name'];}_0xc3586[_0x08fe('0x1c')](_0xa39b53)[_0x08fe('0x2b')](_0x41ad03);};}exports[_0x08fe('0x2c')]=function(_0x1abd26,_0x5dcdf8){var _0x457b27={},_0x3ffcd4={},_0x40cdf9={'count':0x0,'rows':[]};return db[_0x08fe('0x2d')][_0x08fe('0x2e')]()[_0x08fe('0x24')](function(_0x5daca2){_0x3ffcd4[_0x08fe('0x2f')]=_['keys'](_0x5daca2);_0x3ffcd4[_0x08fe('0x30')]=_[_0x08fe('0x31')](_0x1abd26[_0x08fe('0x30')]);_0x3ffcd4[_0x08fe('0x32')]=_[_0x08fe('0x33')](_0x3ffcd4['model'],_0x3ffcd4[_0x08fe('0x30')]);_0x457b27[_0x08fe('0x34')]=_['intersection'](_0x3ffcd4['model'],qs[_0x08fe('0x35')](_0x1abd26[_0x08fe('0x30')][_0x08fe('0x35')]));_0x457b27[_0x08fe('0x34')]=_0x457b27[_0x08fe('0x34')]['length']?_0x457b27[_0x08fe('0x34')]:_0x3ffcd4[_0x08fe('0x2f')];if(!_0x1abd26['query'][_0x08fe('0x36')](_0x08fe('0x37'))){_0x457b27[_0x08fe('0x1e')]=qs['limit'](_0x1abd26[_0x08fe('0x30')]['limit']);_0x457b27[_0x08fe('0x21')]=qs[_0x08fe('0x21')](_0x1abd26[_0x08fe('0x30')]['offset']);}_0x457b27[_0x08fe('0x38')]=qs[_0x08fe('0x39')](_0x1abd26[_0x08fe('0x30')][_0x08fe('0x39')]);_0x457b27[_0x08fe('0x3a')]=qs['filters'](_[_0x08fe('0x3b')](_0x1abd26[_0x08fe('0x30')],_0x3ffcd4[_0x08fe('0x32')]),_0x5daca2);if(_0x1abd26['query'][_0x08fe('0x3c')]){_0x457b27[_0x08fe('0x3a')]=_[_0x08fe('0x3d')](_0x457b27[_0x08fe('0x3a')],{'$or':_[_0x08fe('0x3e')](_0x457b27[_0x08fe('0x34')],function(_0x21b52d){var _0x440125={};_0x440125[_0x21b52d]={'$like':'%'+_0x1abd26['query'][_0x08fe('0x3c')]+'%'};return _0x440125;})});}_0x457b27=_[_0x08fe('0x3d')]({},_0x457b27,_0x1abd26[_0x08fe('0x3f')]);var _0xc106b={'where':_0x457b27[_0x08fe('0x3a')]};return db[_0x08fe('0x2d')]['count'](_0xc106b)[_0x08fe('0x24')](function(_0x1fafa9){_0x40cdf9[_0x08fe('0x20')]=_0x1fafa9;if(_0x1abd26['query'][_0x08fe('0x40')]){_0x457b27[_0x08fe('0x41')]=[{'all':!![]}];}return db[_0x08fe('0x2d')][_0x08fe('0x42')](_0x457b27);})['then'](function(_0x3d15af){_0x40cdf9[_0x08fe('0x43')]=_0x3d15af;return _0x40cdf9;})[_0x08fe('0x24')](respondWithFilteredResult(_0x5dcdf8,_0x457b27))[_0x08fe('0x44')](handleError(_0x5dcdf8,null));})[_0x08fe('0x44')](handleError(_0x5dcdf8,null));};exports['show']=function(_0x395134,_0x392807){var _0x2e3923={'raw':![],'where':{'id':_0x395134[_0x08fe('0x45')]['id']}},_0x2c3a01={};_0x2c3a01[_0x08fe('0x2f')]=_[_0x08fe('0x31')](db[_0x08fe('0x2d')]['rawAttributes']);_0x2c3a01[_0x08fe('0x30')]=_['keys'](_0x395134[_0x08fe('0x30')]);_0x2c3a01[_0x08fe('0x32')]=_[_0x08fe('0x33')](_0x2c3a01['model'],_0x2c3a01[_0x08fe('0x30')]);_0x2e3923[_0x08fe('0x34')]=_[_0x08fe('0x33')](_0x2c3a01[_0x08fe('0x2f')],qs[_0x08fe('0x35')](_0x395134[_0x08fe('0x30')][_0x08fe('0x35')]));_0x2e3923[_0x08fe('0x34')]=_0x2e3923[_0x08fe('0x34')][_0x08fe('0x46')]?_0x2e3923[_0x08fe('0x34')]:_0x2c3a01['model'];if(_0x395134[_0x08fe('0x30')][_0x08fe('0x40')]){_0x2e3923[_0x08fe('0x41')]=[{'all':!![]}];}_0x2e3923=_[_0x08fe('0x3d')]({},_0x2e3923,_0x395134[_0x08fe('0x3f')]);return db[_0x08fe('0x2d')][_0x08fe('0x47')](_0x2e3923)[_0x08fe('0x24')](handleEntityNotFound(_0x392807,null))['then'](respondWithResult(_0x392807,null))[_0x08fe('0x44')](handleError(_0x392807,null));};exports[_0x08fe('0x48')]=function(_0x2a1cd8,_0x1675ac){return db[_0x08fe('0x2d')][_0x08fe('0x48')](_0x2a1cd8['body'],{})[_0x08fe('0x24')](function(_0x4beb4f){var _0x26fedd=_0x2a1cd8[_0x08fe('0x49')][_0x08fe('0x4a')]({'plain':!![]});if(!_0x26fedd)throw new Error(_0x08fe('0x4b'));if(_0x26fedd[_0x08fe('0x4c')]==='user'){var _0x1a5e23=_0x4beb4f[_0x08fe('0x4a')]({'plain':!![]});var _0x50007e=_0x08fe('0x4d');return db[_0x08fe('0x4e')][_0x08fe('0x47')]({'where':{'name':_0x50007e,'userProfileId':_0x26fedd[_0x08fe('0x4f')]},'raw':!![]})['then'](function(_0x20ed0d){if(_0x20ed0d&&_0x20ed0d['autoAssociation']===0x0){return db[_0x08fe('0x26')][_0x08fe('0x48')]({'name':_0x1a5e23['name'],'resourceId':_0x1a5e23['id'],'type':_0x20ed0d['name'],'sectionId':_0x20ed0d['id']},{})['then'](function(){return _0x4beb4f;});}else{return _0x4beb4f;}})[_0x08fe('0x44')](function(_0x2cdeff){logger[_0x08fe('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2cdeff);throw _0x2cdeff;});}return _0x4beb4f;})[_0x08fe('0x24')](respondWithResult(_0x1675ac,0xc9))[_0x08fe('0x44')](handleError(_0x1675ac,null));};exports[_0x08fe('0x23')]=function(_0x2c30c1,_0x21853b){if(_0x2c30c1[_0x08fe('0x50')]['id']){delete _0x2c30c1[_0x08fe('0x50')]['id'];}return db['CmCompany'][_0x08fe('0x47')]({'where':{'id':_0x2c30c1['params']['id']}})['then'](handleEntityNotFound(_0x21853b,null))[_0x08fe('0x24')](saveUpdates(_0x2c30c1[_0x08fe('0x50')],null))[_0x08fe('0x24')](respondWithResult(_0x21853b,null))[_0x08fe('0x44')](handleError(_0x21853b,null));};exports[_0x08fe('0x25')]=function(_0x44d96e,_0x40ddae){return db[_0x08fe('0x2d')][_0x08fe('0x47')]({'where':{'id':_0x44d96e[_0x08fe('0x45')]['id']}})[_0x08fe('0x24')](handleEntityNotFound(_0x40ddae,null))[_0x08fe('0x24')](removeEntity(_0x40ddae,null))[_0x08fe('0x44')](handleError(_0x40ddae,null));};exports[_0x08fe('0x2e')]=function(_0x431911,_0x373a36){return db[_0x08fe('0x2d')][_0x08fe('0x2e')]()[_0x08fe('0x24')](respondWithResult(_0x373a36,null))[_0x08fe('0x44')](handleError(_0x373a36,null));};exports[_0x08fe('0x51')]=function(_0x186ae0,_0x444ca3,_0x1b3bef){return db[_0x08fe('0x52')]['find']({'where':{'id':_0x186ae0[_0x08fe('0x45')]['id']}})[_0x08fe('0x24')](handleEntityNotFound(_0x444ca3,null))[_0x08fe('0x24')](function(_0x479f88){if(_0x479f88){return _0x479f88['addContacts'](_0x186ae0[_0x08fe('0x50')]['ids'],_[_0x08fe('0x53')](_0x186ae0[_0x08fe('0x50')],[_0x08fe('0x54'),'id'])||{});}})[_0x08fe('0x24')](respondWithResult(_0x444ca3,null))[_0x08fe('0x44')](handleError(_0x444ca3,null));};exports[_0x08fe('0x55')]=function(_0x1ef673,_0x54dc97,_0x584f21){var _0x12d4eb={};var _0x283375={};var _0x380e01;var _0x4235d4;return db[_0x08fe('0x2d')][_0x08fe('0x56')]({'where':{'id':_0x1ef673[_0x08fe('0x45')]['id']}})[_0x08fe('0x24')](handleEntityNotFound(_0x54dc97,null))[_0x08fe('0x24')](function(_0x28f697){if(_0x28f697){_0x380e01=_0x28f697;_0x283375[_0x08fe('0x2f')]=_['keys'](db['CmContact'][_0x08fe('0x57')]);_0x283375['query']=_[_0x08fe('0x31')](_0x1ef673[_0x08fe('0x30')]);_0x283375[_0x08fe('0x32')]=_[_0x08fe('0x33')](_0x283375[_0x08fe('0x2f')],_0x283375[_0x08fe('0x30')]);_0x12d4eb['attributes']=_[_0x08fe('0x33')](_0x283375['model'],qs[_0x08fe('0x35')](_0x1ef673['query'][_0x08fe('0x35')]));_0x12d4eb[_0x08fe('0x34')]=_0x12d4eb['attributes'][_0x08fe('0x46')]?_0x12d4eb[_0x08fe('0x34')]:_0x283375[_0x08fe('0x2f')];_0x12d4eb[_0x08fe('0x38')]=qs['sort'](_0x1ef673[_0x08fe('0x30')][_0x08fe('0x39')]);_0x12d4eb[_0x08fe('0x3a')]=qs['filters'](_['pick'](_0x1ef673[_0x08fe('0x30')],_0x283375[_0x08fe('0x32')]));if(_0x1ef673['query'][_0x08fe('0x3c')]){_0x12d4eb[_0x08fe('0x3a')]=_[_0x08fe('0x3d')](_0x12d4eb[_0x08fe('0x3a')],{'$or':_[_0x08fe('0x3e')](_0x12d4eb[_0x08fe('0x34')],function(_0x57f9bc){var _0x44a025={};_0x44a025[_0x57f9bc]={'$like':'%'+_0x1ef673['query'][_0x08fe('0x3c')]+'%'};return _0x44a025;})});}_0x12d4eb=_[_0x08fe('0x3d')]({},_0x12d4eb,_0x1ef673[_0x08fe('0x3f')]);return _0x380e01[_0x08fe('0x55')](_0x12d4eb);}})[_0x08fe('0x24')](function(_0x29247a){if(_0x29247a){_0x4235d4=_0x29247a[_0x08fe('0x46')];if(!_0x1ef673[_0x08fe('0x30')]['hasOwnProperty'](_0x08fe('0x37'))){_0x12d4eb[_0x08fe('0x1e')]=qs['limit'](_0x1ef673[_0x08fe('0x30')][_0x08fe('0x1e')]);_0x12d4eb[_0x08fe('0x21')]=qs['offset'](_0x1ef673['query'][_0x08fe('0x21')]);}return _0x380e01[_0x08fe('0x55')](_0x12d4eb);}})[_0x08fe('0x24')](function(_0x49e2d0){if(_0x49e2d0){return _0x49e2d0?{'count':_0x4235d4,'rows':_0x49e2d0}:null;}})[_0x08fe('0x24')](respondWithResult(_0x54dc97,null))['catch'](handleError(_0x54dc97,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 17c6bb6..8d12dcf 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 _0x900b=['bluebird','path','rimraf','../../config/environment','exports','define','CmCompany','cm_companies','lodash','../../config/logger','api','moment'];(function(_0xfbe590,_0xeb207c){var _0x1b3fc0=function(_0xe43099){while(--_0xe43099){_0xfbe590['push'](_0xfbe590['shift']());}};_0x1b3fc0(++_0xeb207c);}(_0x900b,0x128));var _0xb900=function(_0x124cdd,_0x365e00){_0x124cdd=_0x124cdd-0x0;var _0x40a2f6=_0x900b[_0x124cdd];return _0x40a2f6;};'use strict';var _=require(_0xb900('0x0'));var util=require('util');var logger=require(_0xb900('0x1'))(_0xb900('0x2'));var moment=require(_0xb900('0x3'));var BPromise=require(_0xb900('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb900('0x5'));var rimraf=require(_0xb900('0x6'));var config=require(_0xb900('0x7'));var attributes=require('./cmCompany.attributes');module[_0xb900('0x8')]=function(_0x13ff61,_0x89c2f1){return _0x13ff61[_0xb900('0x9')](_0xb900('0xa'),attributes,{'tableName':_0xb900('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b39=['../../config/environment','./cmCompany.attributes','exports','define','CmCompany','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3cfa2f,_0x23cf96){var _0x217ebb=function(_0x268abd){while(--_0x268abd){_0x3cfa2f['push'](_0x3cfa2f['shift']());}};_0x217ebb(++_0x23cf96);}(_0x8b39,0x87));var _0x98b3=function(_0x1ff039,_0x5df91c){_0x1ff039=_0x1ff039-0x0;var _0x290ead=_0x8b39[_0x1ff039];return _0x290ead;};'use strict';var _=require(_0x98b3('0x0'));var util=require('util');var logger=require(_0x98b3('0x1'))(_0x98b3('0x2'));var moment=require(_0x98b3('0x3'));var BPromise=require(_0x98b3('0x4'));var rp=require(_0x98b3('0x5'));var fs=require('fs');var path=require(_0x98b3('0x6'));var rimraf=require(_0x98b3('0x7'));var config=require(_0x98b3('0x8'));var attributes=require(_0x98b3('0x9'));module[_0x98b3('0xa')]=function(_0x2b24a4,_0x46c5de){return _0x2b24a4[_0x98b3('0xb')](_0x98b3('0xc'),attributes,{'tableName':'cm_companies','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 3f1eb7d..ac3f2d3 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 _0x6aef=['debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/environment','client','http','request','then','info','CmCompany,\x20%s,\x20%s'];(function(_0x377315,_0xb569ab){var _0x2ce4ef=function(_0x317ad9){while(--_0x317ad9){_0x377315['push'](_0x377315['shift']());}};_0x2ce4ef(++_0xb569ab);}(_0x6aef,0x144));var _0xf6ae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6aef[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xf6ae('0x0'));var moment=require(_0xf6ae('0x1'));var BPromise=require(_0xf6ae('0x2'));var rs=require(_0xf6ae('0x3'));var fs=require('fs');var Redis=require(_0xf6ae('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xf6ae('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xf6ae('0x6')][_0xf6ae('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x288bc5,_0x38fbd0,_0x2f99fc){return new BPromise(function(_0x270e5f,_0x1b9708){return client[_0xf6ae('0x8')](_0x288bc5,_0x2f99fc)[_0xf6ae('0x9')](function(_0x3d7476){logger[_0xf6ae('0xa')](_0xf6ae('0xb'),_0x38fbd0,'request\x20sent');logger[_0xf6ae('0xc')](_0xf6ae('0xd'),_0x38fbd0,_0xf6ae('0xe'),JSON[_0xf6ae('0xf')](_0x3d7476));if(_0x3d7476[_0xf6ae('0x10')]){if(_0x3d7476[_0xf6ae('0x10')][_0xf6ae('0x11')]===0x1f4){logger['error'](_0xf6ae('0xb'),_0x38fbd0,_0x3d7476[_0xf6ae('0x10')][_0xf6ae('0x12')]);return _0x1b9708(_0x3d7476[_0xf6ae('0x10')]['message']);}logger['error'](_0xf6ae('0xb'),_0x38fbd0,_0x3d7476[_0xf6ae('0x10')]['message']);return _0x270e5f(_0x3d7476['error'][_0xf6ae('0x12')]);}else{logger[_0xf6ae('0xa')](_0xf6ae('0xb'),_0x38fbd0,_0xf6ae('0xe'));_0x270e5f(_0x3d7476[_0xf6ae('0x13')][_0xf6ae('0x12')]);}})[_0xf6ae('0x14')](function(_0x36fca6){logger[_0xf6ae('0x10')](_0xf6ae('0xb'),_0x38fbd0,_0x36fca6);_0x1b9708(_0x36fca6);});});} \ No newline at end of file +var _0x2d78=['jayson/promise','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','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x2d78,0x123));var _0x82d7=function(_0x2ba740,_0x62a305){_0x2ba740=_0x2ba740-0x0;var _0x358bda=_0x2d78[_0x2ba740];return _0x358bda;};'use strict';var _=require(_0x82d7('0x0'));var util=require(_0x82d7('0x1'));var moment=require('moment');var BPromise=require(_0x82d7('0x2'));var rs=require(_0x82d7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x82d7('0x4'))['db'];var utils=require(_0x82d7('0x5'));var logger=require(_0x82d7('0x6'))(_0x82d7('0x7'));var config=require(_0x82d7('0x8'));var jayson=require(_0x82d7('0x9'));var client=jayson[_0x82d7('0xa')][_0x82d7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3af566,_0x520cd7,_0x36dd3a){return new BPromise(function(_0x21c23a,_0x41aac1){return client[_0x82d7('0xc')](_0x3af566,_0x36dd3a)[_0x82d7('0xd')](function(_0x14e6e5){logger[_0x82d7('0xe')](_0x82d7('0xf'),_0x520cd7,_0x82d7('0x10'));logger[_0x82d7('0x11')](_0x82d7('0x12'),_0x520cd7,_0x82d7('0x10'),JSON[_0x82d7('0x13')](_0x14e6e5));if(_0x14e6e5[_0x82d7('0x14')]){if(_0x14e6e5[_0x82d7('0x14')][_0x82d7('0x15')]===0x1f4){logger[_0x82d7('0x14')](_0x82d7('0xf'),_0x520cd7,_0x14e6e5[_0x82d7('0x14')]['message']);return _0x41aac1(_0x14e6e5['error'][_0x82d7('0x16')]);}logger[_0x82d7('0x14')](_0x82d7('0xf'),_0x520cd7,_0x14e6e5['error']['message']);return _0x21c23a(_0x14e6e5['error'][_0x82d7('0x16')]);}else{logger[_0x82d7('0xe')]('CmCompany,\x20%s,\x20%s',_0x520cd7,_0x82d7('0x10'));_0x21c23a(_0x14e6e5[_0x82d7('0x17')][_0x82d7('0x16')]);}})[_0x82d7('0x18')](function(_0xc3c9b3){logger['error']('CmCompany,\x20%s,\x20%s',_0x520cd7,_0xc3c9b3);_0x41aac1(_0xc3c9b3);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 0d5b825..cfa0db2 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 _0x6824=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','/:id/contacts','addContacts','put','update','destroy','exports','multer','util','path','express'];(function(_0xe6fedd,_0x3c1278){var _0x3a6beb=function(_0xdbba8e){while(--_0xdbba8e){_0xe6fedd['push'](_0xe6fedd['shift']());}};_0x3a6beb(++_0x3c1278);}(_0x6824,0x104));var _0x4682=function(_0x40eb6e,_0x18015a){_0x40eb6e=_0x40eb6e-0x0;var _0x150089=_0x6824[_0x40eb6e];return _0x150089;};'use strict';var multer=require(_0x4682('0x0'));var util=require(_0x4682('0x1'));var path=require(_0x4682('0x2'));var timeout=require('connect-timeout');var express=require(_0x4682('0x3'));var router=express[_0x4682('0x4')]();var fs_extra=require(_0x4682('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4682('0x6'));var config=require(_0x4682('0x7'));var controller=require('./cmCompany.controller');router[_0x4682('0x8')]('/',auth[_0x4682('0x9')](),controller[_0x4682('0xa')]);router[_0x4682('0x8')]('/describe',auth[_0x4682('0x9')](),controller[_0x4682('0xb')]);router[_0x4682('0x8')](_0x4682('0xc'),auth[_0x4682('0x9')](),controller[_0x4682('0xd')]);router['get']('/:id/contacts',auth['isAuthenticated'](),controller['getContacts']);router[_0x4682('0xe')]('/',auth['isAuthenticated'](),controller[_0x4682('0xf')]);router[_0x4682('0xe')](_0x4682('0x10'),auth['isAuthenticated'](),controller[_0x4682('0x11')]);router[_0x4682('0x12')](_0x4682('0xc'),auth[_0x4682('0x9')](),controller[_0x4682('0x13')]);router['delete'](_0x4682('0xc'),auth[_0x4682('0x9')](),controller[_0x4682('0x14')]);module[_0x4682('0x15')]=router; \ No newline at end of file +var _0xc7aa=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/contacts','create','post','addContacts'];(function(_0xdd3935,_0x29a0aa){var _0x55e134=function(_0x5b80d8){while(--_0x5b80d8){_0xdd3935['push'](_0xdd3935['shift']());}};_0x55e134(++_0x29a0aa);}(_0xc7aa,0x1a9));var _0xac7a=function(_0x16ed56,_0x527721){_0x16ed56=_0x16ed56-0x0;var _0x594760=_0xc7aa[_0x16ed56];return _0x594760;};'use strict';var multer=require(_0xac7a('0x0'));var util=require(_0xac7a('0x1'));var path=require('path');var timeout=require(_0xac7a('0x2'));var express=require(_0xac7a('0x3'));var router=express[_0xac7a('0x4')]();var fs_extra=require(_0xac7a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xac7a('0x6'));var config=require('../../config/environment');var controller=require('./cmCompany.controller');router[_0xac7a('0x7')]('/',auth[_0xac7a('0x8')](),controller[_0xac7a('0x9')]);router['get']('/describe',auth[_0xac7a('0x8')](),controller['describe']);router['get'](_0xac7a('0xa'),auth[_0xac7a('0x8')](),controller[_0xac7a('0xb')]);router[_0xac7a('0x7')](_0xac7a('0xc'),auth[_0xac7a('0x8')](),controller['getContacts']);router['post']('/',auth['isAuthenticated'](),controller[_0xac7a('0xd')]);router[_0xac7a('0xe')](_0xac7a('0xc'),auth[_0xac7a('0x8')](),controller[_0xac7a('0xf')]);router[_0xac7a('0x10')]('/:id',auth[_0xac7a('0x8')](),controller[_0xac7a('0x11')]);router[_0xac7a('0x12')](_0xac7a('0xa'),auth[_0xac7a('0x8')](),controller[_0xac7a('0x13')]);module[_0xac7a('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 8bd7ae4..a96408a 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 _0xd747=['NOW','sequelize','STRING','TEXT','INTEGER','UNSIGNED','DATE'];(function(_0x426f74,_0x3edf53){var _0x42a4a8=function(_0x3a9e8c){while(--_0x3a9e8c){_0x426f74['push'](_0x426f74['shift']());}};_0x42a4a8(++_0x3edf53);}(_0xd747,0xa2));var _0x7d74=function(_0x3a9ee5,_0x287e7e){_0x3a9ee5=_0x3a9ee5-0x0;var _0x458151=_0xd747[_0x3a9ee5];return _0x458151;};'use strict';var _=require('lodash');var Sequelize=require(_0x7d74('0x0'));module['exports']={'firstName':{'type':Sequelize[_0x7d74('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0x7d74('0x1')]},'street':{'type':Sequelize[_0x7d74('0x1')]},'postalCode':{'type':Sequelize[_0x7d74('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x7d74('0x1')]},'description':{'type':Sequelize[_0x7d74('0x2')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x7d74('0x1')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x7d74('0x1')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x7d74('0x1')]},'skype':{'type':Sequelize[_0x7d74('0x1')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x7d74('0x1')]},'line':{'type':Sequelize[_0x7d74('0x1')]},'wechat':{'type':Sequelize[_0x7d74('0x1')]},'telegram':{'type':Sequelize[_0x7d74('0x1')]},'UserId':{'type':Sequelize[_0x7d74('0x3')]},'priority':{'type':Sequelize[_0x7d74('0x3')](0x2)[_0x7d74('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x7d74('0x5')],'defaultValue':Sequelize[_0x7d74('0x6')]}}; \ No newline at end of file +var _0x5969=['UNSIGNED','DATE','NOW','lodash','sequelize','STRING','TEXT','INTEGER'];(function(_0x13e8c1,_0x12c592){var _0x59d958=function(_0x3c53ee){while(--_0x3c53ee){_0x13e8c1['push'](_0x13e8c1['shift']());}};_0x59d958(++_0x12c592);}(_0x5969,0xdb));var _0x9596=function(_0x340d87,_0xac058d){_0x340d87=_0x340d87-0x0;var _0x49a975=_0x5969[_0x340d87];return _0x49a975;};'use strict';var _=require(_0x9596('0x0'));var Sequelize=require(_0x9596('0x1'));module['exports']={'firstName':{'type':Sequelize[_0x9596('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x9596('0x2')]},'street':{'type':Sequelize[_0x9596('0x2')]},'postalCode':{'type':Sequelize[_0x9596('0x2')]},'city':{'type':Sequelize[_0x9596('0x2')]},'country':{'type':Sequelize[_0x9596('0x2')]},'dateOfBirth':{'type':Sequelize[_0x9596('0x2')]},'description':{'type':Sequelize[_0x9596('0x3')]},'phone':{'type':Sequelize[_0x9596('0x2')]},'mobile':{'type':Sequelize[_0x9596('0x2')]},'fax':{'type':Sequelize[_0x9596('0x2')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x9596('0x2')]},'fb_data':{'type':Sequelize[_0x9596('0x2')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x9596('0x2')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x9596('0x2')]},'telegram':{'type':Sequelize[_0x9596('0x2')]},'UserId':{'type':Sequelize[_0x9596('0x4')]},'priority':{'type':Sequelize[_0x9596('0x4')](0x2)[_0x9596('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x9596('0x6')],'defaultValue':Sequelize[_0x9596('0x7')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 91ba42c..2aafac6 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 _0x7501=['datetime','DATE','buildExpression','text','start','filter','Contact','isEmpty','forEach','ListId','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','SELECT','clone','DESC','t.id\x20IN\x20?','resolve','role','user','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','agent','sequelize','count','toString','keyBy','merge','c.firstName','c.lastName','c.phone','c.fax','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','catch','startsWith','columnName','displayName','analytics','CmCustomField','findAll','alias','custom','values','body','get','mergeWith','isArray','tags','info','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','VoiceCallReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','create','join','bulkCreate','each','duplicates','$or','show','params','color','isNil','$and','omit','format','cf_%d','table','setFields','id\x20=\x20?','phone','getTags','Tag','rawAttributes','options','nolimit','setTags','ids','getHoppers','ContactId','includeAll','include','getHopperFinals','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_values','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','0777','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','upload','createReadStream','import','binding','child_process','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','pid','exit','error\x20child\x20process','mail','sms','openchannel','fax','whatsapp','voice','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','destination','callerid','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','startCase','chat','Website','closed','closedAt','secondDisposition','thirdDisposition','UserId','key','Owner','fullname','customerIp','customerPort','deviceModel','osName','ratingType','ratingValue','referer','threadId','Interaction','findAndCountAll','flatten','sortBy','reverse','moment','bluebird','util','path','lodash','squel','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./cmContact.socket','register','status','undefined','limit','offset','set','update','destroy','then','end','sendStatus','error','name','send','index','CmContact','describe','keys','length','cf_','push','findOne','fieldType','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','select','field','tools_tags','from','cm_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','left_join','t.id\x20=\x20ct.TagId','where','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','find','value','split','map','union','User','and','uc.UserId\x20=\x20?','dateOfBirth'];(function(_0x326407,_0x2c9181){var _0x1b69f1=function(_0x4f8fa3){while(--_0x4f8fa3){_0x326407['push'](_0x326407['shift']());}};_0x1b69f1(++_0x2c9181);}(_0x7501,0xcc));var _0x1750=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x7501[_0x4a747d];return _0x3a5b5c;};'use strict';var moment=require(_0x1750('0x0'));var BPromise=require(_0x1750('0x1'));var util=require(_0x1750('0x2'));var path=require(_0x1750('0x3'));var fs=require('fs');var _=require(_0x1750('0x4'));var squel=require(_0x1750('0x5'));var Papa=require(_0x1750('0x6'));var Redis=require('ioredis');var qs=require(_0x1750('0x7'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0x1750('0x8'))(_0x1750('0x9'));var config=require(_0x1750('0xa'));var db=require(_0x1750('0xb'))['db'];config['redis']=_[_0x1750('0xc')](config[_0x1750('0xd')],{'host':_0x1750('0xe'),'port':0x18eb});var socket=require(_0x1750('0xf'))(new Redis(config['redis']));require(_0x1750('0x10'))[_0x1750('0x11')](socket);function respondWithResult(_0x1d4fdc,_0x1f6cce){_0x1f6cce=_0x1f6cce||0xc8;return function(_0x463a5b){if(_0x463a5b){return _0x1d4fdc[_0x1750('0x12')](_0x1f6cce)['json'](_0x463a5b);}};}function respondWithFilteredResult(_0x3f341c,_0x12dfcd){return function(_0x53dbfb){if(_0x53dbfb){var _0x4eceb3=typeof _0x12dfcd['offset']===_0x1750('0x13')&&typeof _0x12dfcd[_0x1750('0x14')]==='undefined';var _0x1772ee=_0x53dbfb['count'];var _0x1cce22=_0x4eceb3?0x0:_0x12dfcd[_0x1750('0x15')];var _0x33abe3=_0x4eceb3?_0x53dbfb['count']:_0x12dfcd[_0x1750('0x15')]+_0x12dfcd['limit'];var _0x202ebb;if(_0x33abe3>=_0x1772ee){_0x33abe3=_0x1772ee;_0x202ebb=0xc8;}else{_0x202ebb=0xce;}_0x3f341c[_0x1750('0x12')](_0x202ebb);return _0x3f341c[_0x1750('0x16')]('Content-Range',_0x1cce22+'-'+_0x33abe3+'/'+_0x1772ee)['json'](_0x53dbfb);}return null;};}function saveUpdates(_0xce300f){return function(_0x5f3a2b){if(_0x5f3a2b){return _0x5f3a2b[_0x1750('0x17')](_0xce300f)['then'](function(_0x196dd2){return _0x196dd2;});}return null;};}function removeEntity(_0x21f433){return function(_0xc91c63){if(_0xc91c63){return _0xc91c63[_0x1750('0x18')]()[_0x1750('0x19')](function(){_0x21f433['status'](0xcc)[_0x1750('0x1a')]();});}};}function handleEntityNotFound(_0x210cd3){return function(_0x53a29d){if(!_0x53a29d){_0x210cd3[_0x1750('0x1b')](0x194);}return _0x53a29d;};}function handleError(_0x2d5842,_0x34b4f0){_0x34b4f0=_0x34b4f0||0x1f4;return function(_0x306fd0){logger[_0x1750('0x1c')](_0x306fd0['stack']);if(_0x306fd0[_0x1750('0x1d')]){delete _0x306fd0[_0x1750('0x1d')];}_0x2d5842[_0x1750('0x12')](_0x34b4f0)[_0x1750('0x1e')](_0x306fd0);};}exports[_0x1750('0x1f')]=function(_0x15b64,_0x2240df){var _0x33bd85={},_0x381d5d={},_0x3add7a={'count':0x0,'rows':[]};return db[_0x1750('0x20')][_0x1750('0x21')]()[_0x1750('0x19')](function(_0x2f2702){var _0x276d12=[];for(var _0x3712ce=0x0;_0x3712ce0x1){_0x407462['or'](_0x1750('0x5b'),qs[_0x1750('0x5c')](_0xfbe3d5),null);}else{if(qs[_0x1750('0x5d')](_0xfbe3d5)){_0x407462['or'](_0x1750('0x5e'),_0xfbe3d5+'%');_0x407462['or'](_0x1750('0x5f'),_0xfbe3d5+'%');_0x407462['or'](_0x1750('0x60'),_0xfbe3d5+'%');_0x407462['or'](_0x1750('0x61'),_0xfbe3d5+'%');}else if(qs[_0x1750('0x62')](_0xfbe3d5)){_0x407462['or'](_0x1750('0x63'),_0xfbe3d5+'%');}else{_0x407462['or']('c.firstName\x20LIKE\x20?','%'+_0xfbe3d5+'%');_0x407462['or'](_0x1750('0x64'),'%'+_0xfbe3d5+'%');_0x407462['or']('c.email\x20LIKE\x20?','%'+_0xfbe3d5+'%');}}}}_0x37a66d[_0x1750('0x3c')](_0x407462);_0x37a66d[_0x1750('0x65')](_0x1750('0x66'));var _0x4ba84c={'type':db[_0x1750('0x67')][_0x1750('0x68')][_0x1750('0x69')],'raw':!![]};var _0x2b26ec=_0x37a66d[_0x1750('0x6a')]()['field']('c.id');if(_0x33bd85[_0x1750('0x30')]){_0x33bd85[_0x1750('0x30')][_0x1750('0x54')](function(_0x4dca64){_0x37a66d[_0x1750('0x30')]('c.'+_0x4dca64[0x0],_0x4dca64[0x1]===_0x1750('0x6b')?![]:!![]);});}if(!_[_0x1750('0x53')](_0x2d94d2)){_0x37a66d['having'](_0xcd8d04);_0x2b26ec[_0x1750('0x3c')](_0x1750('0x6c'),_0x2d94d2);}BPromise[_0x1750('0x6d')]()['then'](function(){if(!_0xb3993a)return;if(_0x15b64['user'][_0x1750('0x6e')]!=='agent')return;if(!_['some'](_0xb3993a[_0x1750('0x42')],[_0x1750('0x34'),'User'])){return _0x15b64[_0x1750('0x6f')][_0x1750('0x70')]({'attributes':['id'],'raw':!![]})[_0x1750('0x19')](function(_0x1e2277){if(_['isEmpty'](_0x1e2277)){_0x2b26ec[_0x1750('0x3c')](_0x1750('0x71'));_0x37a66d['where'](_0x1750('0x71'));}else{_0x2b26ec[_0x1750('0x3c')]('c.ListId\x20IN\x20?',_['map'](_0x1e2277,'id'));_0x37a66d[_0x1750('0x3c')](_0x1750('0x72'),_[_0x1750('0x46')](_0x1e2277,'id'));}});}})[_0x1750('0x19')](function(){if(_0x15b64[_0x1750('0x6f')]['role']===_0x1750('0x73')&&!_0xb3993a&&!_0x15b64[_0x1750('0x2a')][_0x1750('0x55')])return[];return db[_0x1750('0x74')][_0x1750('0x2a')](_0x2b26ec['toString'](),_0x4ba84c);})[_0x1750('0x19')](function(_0x16a1c1){_0x3add7a['count']=_0x16a1c1[_0x1750('0x23')];if(_0x3add7a[_0x1750('0x75')]===0x0)return[];return db[_0x1750('0x74')][_0x1750('0x2a')](_0x119520[_0x1750('0x76')](),_0x4ba84c)[_0x1750('0x19')](function(_0x18dab6){_0x1680d3=_[_0x1750('0x77')](_0x18dab6,'id');_0x4ba84c=_[_0x1750('0x78')](_0x4ba84c,{'model':db[_0x1750('0x20')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x15b64[_0x1750('0x2a')][_0x1750('0x2e')]){_0x33bd85[_0x1750('0x2d')][_0x1750('0x54')](function(_0x30e478){_0x37a66d[_0x1750('0x34')]('c.'+_0x30e478);});}else{_0x37a66d[_0x1750('0x34')](_0x1750('0x66'));_0x37a66d[_0x1750('0x34')](_0x1750('0x79'));_0x37a66d[_0x1750('0x34')](_0x1750('0x7a'));_0x37a66d[_0x1750('0x34')](_0x1750('0x7b'));_0x37a66d[_0x1750('0x34')]('c.mobile');_0x37a66d[_0x1750('0x34')](_0x1750('0x7c'));_0x37a66d[_0x1750('0x34')]('c.email');_0x37a66d['field']('c.ListId');_0x37a66d[_0x1750('0x34')]('c.createdAt');_0x37a66d[_0x1750('0x34')](_0x1750('0x7d'));_0x37a66d[_0x1750('0x34')](_0x1750('0x7e'));_0x37a66d['field'](_0x1750('0x7f'),_0x1750('0x80'));}if(_0x33bd85[_0x1750('0x14')])_0x37a66d[_0x1750('0x14')](_0x33bd85[_0x1750('0x14')]);if(_0x33bd85['offset'])_0x37a66d['offset'](_0x33bd85['offset']);return db['sequelize'][_0x1750('0x2a')](_0x37a66d[_0x1750('0x76')](),_0x4ba84c);});})['then'](function(_0x64e835){_0x64e835[_0x1750('0x54')](function(_0x58809b){if(_0x58809b[_0x1750('0x80')]){_0x58809b[_0x1750('0x81')]=[];_0x58809b['TagIds']['split'](',')[_0x1750('0x54')](function(_0x45c2d7){_0x58809b[_0x1750('0x81')][_0x1750('0x25')](_0x1680d3[_0x45c2d7]);});}delete _0x58809b[_0x1750('0x80')];});_0x3add7a[_0x1750('0x82')]=_0x64e835;return _0x3add7a;})[_0x1750('0x19')](respondWithFilteredResult(_0x2240df,_0x33bd85));})[_0x1750('0x83')](handleError(_0x2240df,null));};exports['destroy']=function(_0x402d8a,_0x10d4b7){return db[_0x1750('0x20')][_0x1750('0x43')]({'where':{'id':_0x402d8a['params']['id']}})[_0x1750('0x19')](handleEntityNotFound(_0x10d4b7,null))[_0x1750('0x19')](removeEntity(_0x10d4b7,null))[_0x1750('0x83')](handleError(_0x10d4b7,null));};exports['describe']=function(_0x527676,_0x71bee7){return db['CmContact'][_0x1750('0x21')]()[_0x1750('0x19')](function(_0x3f1be8){delete _0x3f1be8['tags'];for(var _0xa84e2b=0x0;_0xa84e2b=_0x5f44c8){_0x53cc95=_0x5f44c8;_0x539f2a=0xc8;}else{_0x539f2a=0xce;}_0x346212[_0xf529('0xe')](_0x539f2a);return _0x346212['set'](_0xf529('0x14'),_0x1c03be+'-'+_0x53cc95+'/'+_0x5f44c8)[_0xf529('0xf')](_0xf91be8);}return null;};}function saveUpdates(_0x563050){return function(_0x3ef289){if(_0x3ef289){return _0x3ef289[_0xf529('0x15')](_0x563050)[_0xf529('0x16')](function(_0x1de813){return _0x1de813;});}return null;};}function removeEntity(_0x31f434){return function(_0x558011){if(_0x558011){return _0x558011['destroy']()['then'](function(){_0x31f434[_0xf529('0xe')](0xcc)[_0xf529('0x17')]();});}};}function handleEntityNotFound(_0x4f0f0f){return function(_0x56a8f9){if(!_0x56a8f9){_0x4f0f0f[_0xf529('0x18')](0x194);}return _0x56a8f9;};}function handleError(_0x325b1c,_0x18b85b){_0x18b85b=_0x18b85b||0x1f4;return function(_0x5b0b5c){logger['error'](_0x5b0b5c[_0xf529('0x19')]);if(_0x5b0b5c['name']){delete _0x5b0b5c['name'];}_0x325b1c[_0xf529('0xe')](_0x18b85b)['send'](_0x5b0b5c);};}exports[_0xf529('0x1a')]=function(_0x4bf641,_0x491b28){var _0x2a96b0={},_0x14fb99={},_0x280bce={'count':0x0,'rows':[]};return db[_0xf529('0x1b')][_0xf529('0x1c')]()[_0xf529('0x16')](function(_0xf955a9){var _0x204b5d=[];for(var _0x523789=0x0;_0x5237890x1){_0x1570ff['or'](_0xf529('0x5d'),qs['getFullTextValue'](_0x2a4728),null);}else{if(qs[_0xf529('0x5e')](_0x2a4728)){_0x1570ff['or'](_0xf529('0x5f'),_0x2a4728+'%');_0x1570ff['or'](_0xf529('0x60'),_0x2a4728+'%');_0x1570ff['or'](_0xf529('0x61'),_0x2a4728+'%');_0x1570ff['or'](_0xf529('0x62'),_0x2a4728+'%');}else if(qs[_0xf529('0x63')](_0x2a4728)){_0x1570ff['or'](_0xf529('0x64'),_0x2a4728+'%');}else{_0x1570ff['or']('c.firstName\x20LIKE\x20?','%'+_0x2a4728+'%');_0x1570ff['or']('c.lastName\x20LIKE\x20?','%'+_0x2a4728+'%');_0x1570ff['or'](_0xf529('0x64'),'%'+_0x2a4728+'%');}}}}_0x33629d[_0xf529('0x58')](_0x1570ff);_0x33629d[_0xf529('0x65')](_0xf529('0x66'));var _0x26f1d2={'type':db[_0xf529('0x67')][_0xf529('0x68')][_0xf529('0x69')],'raw':!![]};var _0x59c498=_0x33629d[_0xf529('0x6a')]()[_0xf529('0x3e')](_0xf529('0x66'));if(_0x2a96b0[_0xf529('0x2c')]){_0x2a96b0[_0xf529('0x2c')][_0xf529('0x42')](function(_0x2f5733){_0x33629d[_0xf529('0x2c')]('c.'+_0x2f5733[0x0],_0x2f5733[0x1]===_0xf529('0x6b')?![]:!![]);});}if(!_[_0xf529('0x53')](_0x3ca439)){_0x33629d[_0xf529('0x6c')](_0x1b7ab0);_0x59c498[_0xf529('0x58')](_0xf529('0x6d'),_0x3ca439);}BPromise[_0xf529('0x6e')]()[_0xf529('0x16')](function(){if(!_0x2e44fb)return;if(_0x4bf641[_0xf529('0x6f')]['role']!=='agent')return;if(!_[_0xf529('0x70')](_0x2e44fb[_0xf529('0x3c')],[_0xf529('0x3e'),_0xf529('0x45')])){return _0x4bf641['user']['getLists']({'attributes':['id'],'raw':!![]})[_0xf529('0x16')](function(_0x552afb){if(_['isEmpty'](_0x552afb)){_0x59c498[_0xf529('0x58')]('c.ListId\x20IS\x20NULL');_0x33629d[_0xf529('0x58')]('c.ListId\x20IS\x20NULL');}else{_0x59c498[_0xf529('0x58')](_0xf529('0x55'),_[_0xf529('0x41')](_0x552afb,'id'));_0x33629d[_0xf529('0x58')](_0xf529('0x55'),_[_0xf529('0x41')](_0x552afb,'id'));}});}})[_0xf529('0x16')](function(){if(_0x4bf641[_0xf529('0x6f')][_0xf529('0x71')]===_0xf529('0x72')&&!_0x2e44fb&&!_0x4bf641['query'][_0xf529('0x54')])return[];return db['sequelize'][_0xf529('0x26')](_0x59c498[_0xf529('0x73')](),_0x26f1d2);})['then'](function(_0x4367b0){_0x280bce['count']=_0x4367b0[_0xf529('0x1d')];if(_0x280bce[_0xf529('0x13')]===0x0)return[];return db[_0xf529('0x74')][_0xf529('0x26')](_0x515452['toString'](),_0x26f1d2)[_0xf529('0x16')](function(_0x531149){_0x3a1c14=_['keyBy'](_0x531149,'id');_0x26f1d2=_[_0xf529('0x75')](_0x26f1d2,{'model':db[_0xf529('0x1b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4bf641[_0xf529('0x26')][_0xf529('0x2a')]){_0x2a96b0[_0xf529('0x29')][_0xf529('0x42')](function(_0x25a4a5){_0x33629d[_0xf529('0x3e')]('c.'+_0x25a4a5);});}else{_0x33629d['field'](_0xf529('0x66'));_0x33629d[_0xf529('0x3e')](_0xf529('0x76'));_0x33629d[_0xf529('0x3e')](_0xf529('0x77'));_0x33629d[_0xf529('0x3e')]('c.phone');_0x33629d[_0xf529('0x3e')](_0xf529('0x78'));_0x33629d[_0xf529('0x3e')](_0xf529('0x79'));_0x33629d[_0xf529('0x3e')]('c.email');_0x33629d[_0xf529('0x3e')](_0xf529('0x7a'));_0x33629d['field'](_0xf529('0x7b'));_0x33629d[_0xf529('0x3e')](_0xf529('0x7c'));_0x33629d[_0xf529('0x3e')]('c.CompanyId');_0x33629d[_0xf529('0x3e')](_0xf529('0x7d'),'TagIds');}if(_0x2a96b0[_0xf529('0x11')])_0x33629d[_0xf529('0x11')](_0x2a96b0[_0xf529('0x11')]);if(_0x2a96b0[_0xf529('0x10')])_0x33629d['offset'](_0x2a96b0[_0xf529('0x10')]);return db['sequelize'][_0xf529('0x26')](_0x33629d['toString'](),_0x26f1d2);});})[_0xf529('0x16')](function(_0x66bb8a){_0x66bb8a['forEach'](function(_0x454d9c){if(_0x454d9c[_0xf529('0x7e')]){_0x454d9c['Tags']=[];_0x454d9c[_0xf529('0x7e')]['split'](',')[_0xf529('0x42')](function(_0x347624){_0x454d9c[_0xf529('0x7f')][_0xf529('0x1f')](_0x3a1c14[_0x347624]);});}delete _0x454d9c['TagIds'];});_0x280bce['rows']=_0x66bb8a;return _0x280bce;})[_0xf529('0x16')](respondWithFilteredResult(_0x491b28,_0x2a96b0));})[_0xf529('0x80')](handleError(_0x491b28,null));};exports[_0xf529('0x81')]=function(_0x3edcc9,_0xb697a6){return db[_0xf529('0x1b')][_0xf529('0x3d')]({'where':{'id':_0x3edcc9[_0xf529('0x82')]['id']}})[_0xf529('0x16')](handleEntityNotFound(_0xb697a6,null))[_0xf529('0x16')](removeEntity(_0xb697a6,null))[_0xf529('0x80')](handleError(_0xb697a6,null));};exports[_0xf529('0x1c')]=function(_0xeaa5d8,_0x46d66f){return db[_0xf529('0x1b')]['describe']()[_0xf529('0x16')](function(_0x415e36){delete _0x415e36[_0xf529('0x83')];for(var _0x1b14cc=0x0;_0x1b14cc{}\s\\|]/g,'-');_0x42f20f(null,util[_0x5bc1('0x22')]('%s-%s%s',path['basename'](_0x369936[_0x5bc1('0x20')],path[_0x5bc1('0x23')](_0x369936[_0x5bc1('0x20')])),Date[_0x5bc1('0x24')](),path[_0x5bc1('0x23')](_0x369936[_0x5bc1('0x20')])));}})});router[_0x5bc1('0x17')](_0x5bc1('0x25'),upload[_0x5bc1('0x26')](_0x5bc1('0x27')),controller[_0x5bc1('0x28')]);var upload=multer({'storage':multer[_0x5bc1('0x29')]({'destination':function(_0x53e154,_0x3fa77c,_0x332abc){_0x332abc(null,path[_0x5bc1('0x1e')](config[_0x5bc1('0x1f')],'server/files/tmp'));},'filename':function(_0x363503,_0x1ff9dc,_0x2844b2){_0x1ff9dc[_0x5bc1('0x20')]=_0x1ff9dc[_0x5bc1('0x20')][_0x5bc1('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2844b2(null,util['format'](_0x5bc1('0x2a'),path[_0x5bc1('0x2b')](_0x1ff9dc[_0x5bc1('0x20')],path[_0x5bc1('0x23')](_0x1ff9dc[_0x5bc1('0x20')])),Date[_0x5bc1('0x24')](),path['extname'](_0x1ff9dc[_0x5bc1('0x20')])));}})});router[_0x5bc1('0x17')]('/upload',upload[_0x5bc1('0x26')]('file'),controller[_0x5bc1('0x2c')]);router[_0x5bc1('0x17')](_0x5bc1('0x2d'),auth['isAuthenticated'](),controller[_0x5bc1('0x2e')]);router[_0x5bc1('0x2f')](_0x5bc1('0xd'),auth['isAuthenticated'](),controller[_0x5bc1('0x30')]);router[_0x5bc1('0x31')](_0x5bc1('0xd'),auth['isAuthenticated'](),controller[_0x5bc1('0x32')]);module[_0x5bc1('0x33')]=router; \ No newline at end of file +var _0x2176=['/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','post','/merge','merge','create','bulkCreate','setTags','diskStorage','server/files/tmp','originalname','replace','format','basename','extname','/csv','single','file','uploadCsv','join','root','%s-%s%s','now','/upload','upload','/upload/:id','import','put','update','delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmContact.controller','get','isAuthenticated','index','describe','/:id','show','/:id/tags','getTags'];(function(_0x51f4c1,_0x29f657){var _0x24534e=function(_0xaac0bb){while(--_0xaac0bb){_0x51f4c1['push'](_0x51f4c1['shift']());}};_0x24534e(++_0x29f657);}(_0x2176,0xc8));var _0x6217=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2176[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x6217('0x0'));var path=require('path');var timeout=require(_0x6217('0x1'));var express=require(_0x6217('0x2'));var router=express[_0x6217('0x3')]();var fs_extra=require(_0x6217('0x4'));var auth=require(_0x6217('0x5'));var interaction=require(_0x6217('0x6'));var config=require('../../config/environment');var controller=require(_0x6217('0x7'));router[_0x6217('0x8')]('/',auth[_0x6217('0x9')](),controller[_0x6217('0xa')]);router['get']('/describe',auth[_0x6217('0x9')](),controller[_0x6217('0xb')]);router['get'](_0x6217('0xc'),auth['isAuthenticated'](),controller[_0x6217('0xd')]);router[_0x6217('0x8')](_0x6217('0xe'),auth[_0x6217('0x9')](),controller[_0x6217('0xf')]);router[_0x6217('0x8')](_0x6217('0x10'),auth['isAuthenticated'](),controller[_0x6217('0x11')]);router[_0x6217('0x8')](_0x6217('0x12'),auth[_0x6217('0x9')](),controller[_0x6217('0x13')]);router['get'](_0x6217('0x14'),auth[_0x6217('0x9')](),controller[_0x6217('0x15')]);router['get'](_0x6217('0x16'),auth['isAuthenticated'](),controller[_0x6217('0x17')]);router[_0x6217('0x8')](_0x6217('0x18'),auth[_0x6217('0x9')](),controller['getJourney']);router[_0x6217('0x19')](_0x6217('0x1a'),auth[_0x6217('0x9')](),controller[_0x6217('0x1b')]);router[_0x6217('0x19')]('/',auth[_0x6217('0x9')](),controller[_0x6217('0x1c')]);router[_0x6217('0x19')]('/create_many',auth['isAuthenticated'](),controller[_0x6217('0x1d')]);router['post'](_0x6217('0xe'),auth['isAuthenticated'](),controller[_0x6217('0x1e')]);var upload=multer({'storage':multer[_0x6217('0x1f')]({'destination':function(_0x4a1d11,_0x1e8049,_0x5af704){_0x5af704(null,path['join'](config['root'],_0x6217('0x20')));},'filename':function(_0xf42eaa,_0x26414a,_0x360b84){_0x26414a[_0x6217('0x21')]=_0x26414a[_0x6217('0x21')][_0x6217('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x360b84(null,util[_0x6217('0x23')]('%s-%s%s',path[_0x6217('0x24')](_0x26414a['originalname'],path[_0x6217('0x25')](_0x26414a[_0x6217('0x21')])),Date['now'](),path[_0x6217('0x25')](_0x26414a['originalname'])));}})});router['post'](_0x6217('0x26'),upload[_0x6217('0x27')](_0x6217('0x28')),controller[_0x6217('0x29')]);var upload=multer({'storage':multer[_0x6217('0x1f')]({'destination':function(_0x35efd1,_0x245929,_0x35b9b2){_0x35b9b2(null,path[_0x6217('0x2a')](config[_0x6217('0x2b')],_0x6217('0x20')));},'filename':function(_0x31db6e,_0x308e0f,_0x66aeea){_0x308e0f['originalname']=_0x308e0f[_0x6217('0x21')][_0x6217('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x66aeea(null,util[_0x6217('0x23')](_0x6217('0x2c'),path[_0x6217('0x24')](_0x308e0f[_0x6217('0x21')],path[_0x6217('0x25')](_0x308e0f[_0x6217('0x21')])),Date[_0x6217('0x2d')](),path[_0x6217('0x25')](_0x308e0f[_0x6217('0x21')])));}})});router[_0x6217('0x19')](_0x6217('0x2e'),upload[_0x6217('0x27')](_0x6217('0x28')),controller[_0x6217('0x2f')]);router[_0x6217('0x19')](_0x6217('0x30'),auth['isAuthenticated'](),controller[_0x6217('0x31')]);router[_0x6217('0x32')](_0x6217('0xc'),auth[_0x6217('0x9')](),controller[_0x6217('0x33')]);router[_0x6217('0x34')](_0x6217('0xc'),auth[_0x6217('0x9')](),controller[_0x6217('0x35')]);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 8ec8d35..62dd9d3 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 _0x3bb4=['type','select','parse','values','isArray','stringify','BOOLEAN','ENUM','sequelize','lodash','exports','getDataValue','alias','STRING','setDataValue','TEXT','long'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0x3bb4,0xc3));var _0x43bb=function(_0x25a993,_0x23312c){_0x25a993=_0x25a993-0x0;var _0x1ab96a=_0x3bb4[_0x25a993];return _0x1ab96a;};'use strict';var Sequelize=require(_0x43bb('0x0'));var _=require(_0x43bb('0x1'));module[_0x43bb('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x586fe5){return this[_0x43bb('0x3')](_0x43bb('0x4'));}},'alias':{'type':Sequelize[_0x43bb('0x5')],'allowNull':![],'set':function(_0x5a3465){this[_0x43bb('0x6')](_0x43bb('0x4'),_0x5a3465?_0x5a3465:this[_0x43bb('0x3')]('name'));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x43bb('0x7')](_0x43bb('0x8')),'get':function(){if(this[_0x43bb('0x3')](_0x43bb('0x9'))===_0x43bb('0xa')){return JSON[_0x43bb('0xb')](this[_0x43bb('0x3')](_0x43bb('0xc')));}else{return this[_0x43bb('0x3')](_0x43bb('0xc'));}},'set':function(_0x363693){if(Array[_0x43bb('0xd')](_0x363693)){this[_0x43bb('0x6')](_0x43bb('0xc'),JSON[_0x43bb('0xe')](_0x363693));}else{this['setDataValue'](_0x43bb('0xc'),_0x363693);}}},'required':{'type':Sequelize[_0x43bb('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x43bb('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x43bb('0x10')]('voice')}}; \ No newline at end of file +var _0xa1b5=['isArray','stringify','BOOLEAN','ENUM','sequelize','exports','getDataValue','STRING','setDataValue','TEXT','long','type','select','values'];(function(_0x5439f0,_0x170a76){var _0x21bfd3=function(_0x384b39){while(--_0x384b39){_0x5439f0['push'](_0x5439f0['shift']());}};_0x21bfd3(++_0x170a76);}(_0xa1b5,0x1c4));var _0x5a1b=function(_0x1e49e9,_0x4639c7){_0x1e49e9=_0x1e49e9-0x0;var _0x442c06=_0xa1b5[_0x1e49e9];return _0x442c06;};'use strict';var Sequelize=require(_0x5a1b('0x0'));var _=require('lodash');module[_0x5a1b('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3fcb00){return this[_0x5a1b('0x2')]('alias');}},'alias':{'type':Sequelize[_0x5a1b('0x3')],'allowNull':![],'set':function(_0x36059c){this[_0x5a1b('0x4')]('alias',_0x36059c?_0x36059c:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0x5a1b('0x3')],'allowNull':![]},'values':{'type':Sequelize[_0x5a1b('0x5')](_0x5a1b('0x6')),'get':function(){if(this[_0x5a1b('0x2')](_0x5a1b('0x7'))===_0x5a1b('0x8')){return JSON['parse'](this[_0x5a1b('0x2')](_0x5a1b('0x9')));}else{return this[_0x5a1b('0x2')](_0x5a1b('0x9'));}},'set':function(_0x3a6ec7){if(Array[_0x5a1b('0xa')](_0x3a6ec7)){this[_0x5a1b('0x4')](_0x5a1b('0x9'),JSON[_0x5a1b('0xb')](_0x3a6ec7));}else{this[_0x5a1b('0x4')](_0x5a1b('0x9'),_0x3a6ec7);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x5a1b('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x5a1b('0xd')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index e4d1360..3bca717 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 _0x1194=['sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','cm_contacts','format','cf_%d','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','differenceBy','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','merge','options','CmCustomField','includeAll','include','rows','catch','show','params','keys','length','find','body','create'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0x1194,0x1d4));var _0x4119=function(_0x24689f,_0x4fff42){_0x24689f=_0x24689f-0x0;var _0x2c1c51=_0x1194[_0x24689f];return _0x2c1c51;};'use strict';var emlformat=require(_0x4119('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4119('0x1'));var jsonpatch=require(_0x4119('0x2'));var rp=require(_0x4119('0x3'));var moment=require(_0x4119('0x4'));var BPromise=require(_0x4119('0x5'));var Mustache=require(_0x4119('0x6'));var util=require('util');var path=require(_0x4119('0x7'));var sox=require(_0x4119('0x8'));var csv=require('to-csv');var ejs=require(_0x4119('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4119('0xa'));var squel=require(_0x4119('0xb'));var crypto=require(_0x4119('0xc'));var jsforce=require(_0x4119('0xd'));var deskjs=require(_0x4119('0xe'));var toCsv=require(_0x4119('0xf'));var querystring=require(_0x4119('0x10'));var Papa=require(_0x4119('0x11'));var Redis=require(_0x4119('0x12'));var authService=require(_0x4119('0x13'));var qs=require(_0x4119('0x14'));var as=require(_0x4119('0x15'));var hardwareService=require(_0x4119('0x16'));var logger=require(_0x4119('0x17'))(_0x4119('0x18'));var utils=require(_0x4119('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4119('0x1a'))['db'];function respondWithStatusCode(_0x49ab38,_0xfd2475){_0xfd2475=_0xfd2475||0xcc;return function(_0x2c111d){if(_0x2c111d){return _0x49ab38['sendStatus'](_0xfd2475);}return _0x49ab38[_0x4119('0x1b')](_0xfd2475)[_0x4119('0x1c')]();};}function respondWithResult(_0x1f68db,_0x51518d){_0x51518d=_0x51518d||0xc8;return function(_0x178d80){if(_0x178d80){return _0x1f68db['status'](_0x51518d)[_0x4119('0x1d')](_0x178d80);}};}function respondWithFilteredResult(_0x26afe6,_0x1f83e9){return function(_0x301a97){if(_0x301a97){var _0x26c83f=typeof _0x1f83e9[_0x4119('0x1e')]===_0x4119('0x1f')&&typeof _0x1f83e9['limit']===_0x4119('0x1f');var _0x592635=_0x301a97[_0x4119('0x20')];var _0x3eea10=_0x26c83f?0x0:_0x1f83e9[_0x4119('0x1e')];var _0x29ec9e=_0x26c83f?_0x301a97['count']:_0x1f83e9[_0x4119('0x1e')]+_0x1f83e9[_0x4119('0x21')];var _0x5e2863;if(_0x29ec9e>=_0x592635){_0x29ec9e=_0x592635;_0x5e2863=0xc8;}else{_0x5e2863=0xce;}_0x26afe6['status'](_0x5e2863);return _0x26afe6['set'](_0x4119('0x22'),_0x3eea10+'-'+_0x29ec9e+'/'+_0x592635)[_0x4119('0x1d')](_0x301a97);}return null;};}function patchUpdates(_0x3dbdf2){return function(_0x516b26){try{jsonpatch[_0x4119('0x23')](_0x516b26,_0x3dbdf2,!![]);}catch(_0x537345){return BPromise[_0x4119('0x24')](_0x537345);}return _0x516b26[_0x4119('0x25')]();};}function saveUpdates(_0x819368,_0x123ecb){return function(_0x4825d1){if(_0x4825d1){return _0x4825d1[_0x4119('0x26')](_0x819368)['then'](function(_0x155d1d){return _0x155d1d;});}return null;};}function removeEntity(_0x21f3ef,_0x174d38){return function(_0x41e7ab){if(_0x41e7ab){return _0x41e7ab[_0x4119('0x27')]()[_0x4119('0x28')](function(){_0x21f3ef[_0x4119('0x1b')](0xcc)[_0x4119('0x1c')]();});}};}function handleEntityNotFound(_0x5cbaf8,_0x52e1b9){return function(_0xe0cdae){if(!_0xe0cdae){_0x5cbaf8[_0x4119('0x29')](0x194);}return _0xe0cdae;};}function handleError(_0x903bcc,_0x205c2b){_0x205c2b=_0x205c2b||0x1f4;return function(_0x1fdd39){logger[_0x4119('0x2a')](_0x1fdd39[_0x4119('0x2b')]);if(_0x1fdd39['name']){delete _0x1fdd39[_0x4119('0x2c')];}_0x903bcc[_0x4119('0x1b')](_0x205c2b)[_0x4119('0x2d')](_0x1fdd39);};}exports[_0x4119('0x2e')]=function(_0x1393db,_0x3d47da){var _0x407f2c={},_0x4f64c8={},_0x2bd7bc={'count':0x0,'rows':[]};var _0x221bfc=_[_0x4119('0x2f')](db['CmCustomField'][_0x4119('0x30')],function(_0x4f58cf){return{'name':_0x4f58cf[_0x4119('0x31')],'type':_0x4f58cf['type'][_0x4119('0x32')]};});_0x4f64c8[_0x4119('0x33')]=_[_0x4119('0x34')](_[_0x4119('0x2f')](_0x221bfc,_0x4119('0x2c')),[_0x4119('0x2c')]);_0x4f64c8[_0x4119('0x35')]=_['keys'](_0x1393db['query']);_0x4f64c8[_0x4119('0x36')]=_[_0x4119('0x37')](_0x4f64c8[_0x4119('0x33')],_0x4f64c8[_0x4119('0x35')]);_0x407f2c['attributes']=_[_0x4119('0x37')](_0x4f64c8[_0x4119('0x33')],qs[_0x4119('0x38')](_0x1393db[_0x4119('0x35')][_0x4119('0x38')]));_0x407f2c[_0x4119('0x39')]=_0x407f2c[_0x4119('0x39')]['length']?_0x407f2c[_0x4119('0x39')]:_0x4f64c8[_0x4119('0x33')];if(!_0x1393db[_0x4119('0x35')][_0x4119('0x3a')](_0x4119('0x3b'))){_0x407f2c['limit']=qs[_0x4119('0x21')](_0x1393db[_0x4119('0x35')][_0x4119('0x21')]);_0x407f2c[_0x4119('0x1e')]=qs[_0x4119('0x1e')](_0x1393db[_0x4119('0x35')][_0x4119('0x1e')]);}_0x407f2c['order']=qs[_0x4119('0x3c')](_0x1393db[_0x4119('0x35')]['sort']);_0x407f2c[_0x4119('0x3d')]=qs[_0x4119('0x36')](_['pick'](_0x1393db[_0x4119('0x35')],_0x4f64c8[_0x4119('0x36')]),_0x221bfc);if(_0x1393db['query']['filter']){_0x407f2c[_0x4119('0x3d')]=_['merge'](_0x407f2c['where'],{'$or':_[_0x4119('0x2f')](_0x221bfc,function(_0x268681){if(_0x268681[_0x4119('0x3e')]!==_0x4119('0x3f')){var _0x53f449={};_0x53f449[_0x268681[_0x4119('0x2c')]]={'$like':'%'+_0x1393db[_0x4119('0x35')]['filter']+'%'};return _0x53f449;}})});}_0x407f2c=_[_0x4119('0x40')]({},_0x407f2c,_0x1393db[_0x4119('0x41')]);var _0x97f617={'where':_0x407f2c[_0x4119('0x3d')]};return db[_0x4119('0x42')][_0x4119('0x20')](_0x97f617)['then'](function(_0x15d282){_0x2bd7bc[_0x4119('0x20')]=_0x15d282;if(_0x1393db['query'][_0x4119('0x43')]){_0x407f2c[_0x4119('0x44')]=[{'all':!![]}];}return db[_0x4119('0x42')]['findAll'](_0x407f2c);})['then'](function(_0x2037a7){_0x2bd7bc[_0x4119('0x45')]=_0x2037a7;return _0x2bd7bc;})[_0x4119('0x28')](respondWithFilteredResult(_0x3d47da,_0x407f2c))[_0x4119('0x46')](handleError(_0x3d47da,null));};exports[_0x4119('0x47')]=function(_0x304ad4,_0x3c25e6){var _0x443d26={'raw':!![],'where':{'id':_0x304ad4[_0x4119('0x48')]['id']}},_0x1896cd={};_0x1896cd[_0x4119('0x33')]=_[_0x4119('0x49')](db['CmCustomField'][_0x4119('0x30')]);_0x1896cd[_0x4119('0x35')]=_[_0x4119('0x49')](_0x304ad4['query']);_0x1896cd['filters']=_[_0x4119('0x37')](_0x1896cd['model'],_0x1896cd[_0x4119('0x35')]);_0x443d26[_0x4119('0x39')]=_[_0x4119('0x37')](_0x1896cd['model'],qs['fields'](_0x304ad4['query'][_0x4119('0x38')]));_0x443d26[_0x4119('0x39')]=_0x443d26[_0x4119('0x39')][_0x4119('0x4a')]?_0x443d26[_0x4119('0x39')]:_0x1896cd['model'];if(_0x304ad4[_0x4119('0x35')][_0x4119('0x43')]){_0x443d26[_0x4119('0x44')]=[{'all':!![]}];}_0x443d26=_[_0x4119('0x40')]({},_0x443d26,_0x304ad4[_0x4119('0x41')]);return db[_0x4119('0x42')][_0x4119('0x4b')](_0x443d26)[_0x4119('0x28')](handleEntityNotFound(_0x3c25e6,null))[_0x4119('0x28')](respondWithResult(_0x3c25e6,null))['catch'](handleError(_0x3c25e6,null));};exports[_0x4119('0x26')]=function(_0x3e76af,_0x9cf8ed){if(_0x3e76af[_0x4119('0x4c')]['id']){delete _0x3e76af['body']['id'];}return db[_0x4119('0x42')]['find']({'where':{'id':_0x3e76af['params']['id']}})[_0x4119('0x28')](handleEntityNotFound(_0x9cf8ed,null))[_0x4119('0x28')](saveUpdates(_0x3e76af[_0x4119('0x4c')],null))[_0x4119('0x28')](respondWithResult(_0x9cf8ed,null))['catch'](handleError(_0x9cf8ed,null));};exports['destroy']=function(_0x928414,_0x38508a){return db['CmCustomField'][_0x4119('0x4b')]({'where':{'id':_0x928414[_0x4119('0x48')]['id']}})[_0x4119('0x28')](handleEntityNotFound(_0x38508a,null))[_0x4119('0x28')](removeEntity(_0x38508a,null))[_0x4119('0x46')](handleError(_0x38508a,null));};exports[_0x4119('0x4d')]=function(_0x28326c,_0x5aabab){var _0x477baa;return db[_0x4119('0x4e')][_0x4119('0x4f')](function(_0x23e235){return db[_0x4119('0x42')]['create'](_0x28326c['body'],{'transaction':_0x23e235})[_0x4119('0x28')](function(_0xe1244b){_0x477baa=_0xe1244b;var _0xd09487={'type':db[_0x4119('0x50')][_0x4119('0x51')],'transaction':_0x23e235};switch(_0x28326c[_0x4119('0x4c')][_0x4119('0x3e')]){case _0x4119('0x52'):_0xd09487[_0x4119('0x3e')]=db[_0x4119('0x50')][_0x4119('0x51')];break;case _0x4119('0x53'):_0xd09487['type']=db['Sequelize'][_0x4119('0x54')];break;case _0x4119('0x55'):_0xd09487[_0x4119('0x3e')]=db[_0x4119('0x50')][_0x4119('0x56')];_0xd09487[_0x4119('0x57')]=![];break;default:}return db['sequelize']['queryInterface']['addColumn'](_0x4119('0x58'),util[_0x4119('0x59')](_0x4119('0x5a'),_0x477baa['id']),_0xd09487);})[_0x4119('0x28')](function(){return _0x477baa;});})[_0x4119('0x28')](respondWithResult(_0x5aabab,0xc9))[_0x4119('0x46')](handleError(_0x5aabab,null));}; \ No newline at end of file +var _0xec16=['cm_contacts','eml-format','rimraf','zip-dir','fast-json-patch','moment','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','save','update','then','stack','name','send','index','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','find','body','params','destroy','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','addColumn'];(function(_0x59b54c,_0x28ea07){var _0x732077=function(_0x9df37c){while(--_0x9df37c){_0x59b54c['push'](_0x59b54c['shift']());}};_0x732077(++_0x28ea07);}(_0xec16,0xa9));var _0x6ec1=function(_0x3ce233,_0x58abd8){_0x3ce233=_0x3ce233-0x0;var _0x48c0cc=_0xec16[_0x3ce233];return _0x48c0cc;};'use strict';var emlformat=require(_0x6ec1('0x0'));var rimraf=require(_0x6ec1('0x1'));var zipdir=require(_0x6ec1('0x2'));var jsonpatch=require(_0x6ec1('0x3'));var rp=require('request-promise');var moment=require(_0x6ec1('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x6ec1('0x5'));var csv=require(_0x6ec1('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6ec1('0x7'));var _=require(_0x6ec1('0x8'));var squel=require(_0x6ec1('0x9'));var crypto=require(_0x6ec1('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6ec1('0x6'));var querystring=require(_0x6ec1('0xb'));var Papa=require(_0x6ec1('0xc'));var Redis=require(_0x6ec1('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x6ec1('0xe'));var as=require(_0x6ec1('0xf'));var hardwareService=require(_0x6ec1('0x10'));var logger=require(_0x6ec1('0x11'))(_0x6ec1('0x12'));var utils=require(_0x6ec1('0x13'));var config=require(_0x6ec1('0x14'));var licenseUtil=require(_0x6ec1('0x15'));var db=require(_0x6ec1('0x16'))['db'];function respondWithStatusCode(_0x1e34a2,_0x567760){_0x567760=_0x567760||0xcc;return function(_0x31bfe5){if(_0x31bfe5){return _0x1e34a2[_0x6ec1('0x17')](_0x567760);}return _0x1e34a2[_0x6ec1('0x18')](_0x567760)[_0x6ec1('0x19')]();};}function respondWithResult(_0xc7b364,_0x5c61eb){_0x5c61eb=_0x5c61eb||0xc8;return function(_0x27c3ca){if(_0x27c3ca){return _0xc7b364['status'](_0x5c61eb)['json'](_0x27c3ca);}};}function respondWithFilteredResult(_0x3d65b2,_0x541064){return function(_0x4083d5){if(_0x4083d5){var _0xa5dd77=typeof _0x541064[_0x6ec1('0x1a')]===_0x6ec1('0x1b')&&typeof _0x541064[_0x6ec1('0x1c')]===_0x6ec1('0x1b');var _0x4ec327=_0x4083d5[_0x6ec1('0x1d')];var _0x58d4e7=_0xa5dd77?0x0:_0x541064[_0x6ec1('0x1a')];var _0x54ad85=_0xa5dd77?_0x4083d5[_0x6ec1('0x1d')]:_0x541064[_0x6ec1('0x1a')]+_0x541064[_0x6ec1('0x1c')];var _0x1937d2;if(_0x54ad85>=_0x4ec327){_0x54ad85=_0x4ec327;_0x1937d2=0xc8;}else{_0x1937d2=0xce;}_0x3d65b2['status'](_0x1937d2);return _0x3d65b2['set'](_0x6ec1('0x1e'),_0x58d4e7+'-'+_0x54ad85+'/'+_0x4ec327)['json'](_0x4083d5);}return null;};}function patchUpdates(_0x591e18){return function(_0x44eeca){try{jsonpatch[_0x6ec1('0x1f')](_0x44eeca,_0x591e18,!![]);}catch(_0x55e2ae){return BPromise['reject'](_0x55e2ae);}return _0x44eeca[_0x6ec1('0x20')]();};}function saveUpdates(_0x335161,_0x1c36b4){return function(_0x474503){if(_0x474503){return _0x474503[_0x6ec1('0x21')](_0x335161)[_0x6ec1('0x22')](function(_0x1a49cb){return _0x1a49cb;});}return null;};}function removeEntity(_0x343d7b,_0x48ff7d){return function(_0x5654ca){if(_0x5654ca){return _0x5654ca['destroy']()[_0x6ec1('0x22')](function(){_0x343d7b[_0x6ec1('0x18')](0xcc)[_0x6ec1('0x19')]();});}};}function handleEntityNotFound(_0x556db2,_0x417ff0){return function(_0x8c625e){if(!_0x8c625e){_0x556db2[_0x6ec1('0x17')](0x194);}return _0x8c625e;};}function handleError(_0x298214,_0x145663){_0x145663=_0x145663||0x1f4;return function(_0xed9408){logger['error'](_0xed9408[_0x6ec1('0x23')]);if(_0xed9408[_0x6ec1('0x24')]){delete _0xed9408['name'];}_0x298214['status'](_0x145663)[_0x6ec1('0x25')](_0xed9408);};}exports[_0x6ec1('0x26')]=function(_0x2b4584,_0x82dd18){var _0x39d4ce={},_0x215151={},_0x51153f={'count':0x0,'rows':[]};var _0x57bd3d=_['map'](db[_0x6ec1('0x27')][_0x6ec1('0x28')],function(_0x2e8e4d){return{'name':_0x2e8e4d[_0x6ec1('0x29')],'type':_0x2e8e4d[_0x6ec1('0x2a')][_0x6ec1('0x2b')]};});_0x215151[_0x6ec1('0x2c')]=_[_0x6ec1('0x2d')](_[_0x6ec1('0x2e')](_0x57bd3d,'name'),[_0x6ec1('0x24')]);_0x215151[_0x6ec1('0x2f')]=_[_0x6ec1('0x30')](_0x2b4584['query']);_0x215151[_0x6ec1('0x31')]=_[_0x6ec1('0x32')](_0x215151[_0x6ec1('0x2c')],_0x215151[_0x6ec1('0x2f')]);_0x39d4ce[_0x6ec1('0x33')]=_[_0x6ec1('0x32')](_0x215151[_0x6ec1('0x2c')],qs[_0x6ec1('0x34')](_0x2b4584[_0x6ec1('0x2f')]['fields']));_0x39d4ce['attributes']=_0x39d4ce[_0x6ec1('0x33')][_0x6ec1('0x35')]?_0x39d4ce[_0x6ec1('0x33')]:_0x215151[_0x6ec1('0x2c')];if(!_0x2b4584[_0x6ec1('0x2f')][_0x6ec1('0x36')](_0x6ec1('0x37'))){_0x39d4ce[_0x6ec1('0x1c')]=qs[_0x6ec1('0x1c')](_0x2b4584[_0x6ec1('0x2f')][_0x6ec1('0x1c')]);_0x39d4ce[_0x6ec1('0x1a')]=qs['offset'](_0x2b4584['query']['offset']);}_0x39d4ce[_0x6ec1('0x38')]=qs[_0x6ec1('0x39')](_0x2b4584['query'][_0x6ec1('0x39')]);_0x39d4ce[_0x6ec1('0x3a')]=qs[_0x6ec1('0x31')](_[_0x6ec1('0x3b')](_0x2b4584[_0x6ec1('0x2f')],_0x215151[_0x6ec1('0x31')]),_0x57bd3d);if(_0x2b4584[_0x6ec1('0x2f')][_0x6ec1('0x3c')]){_0x39d4ce[_0x6ec1('0x3a')]=_[_0x6ec1('0x3d')](_0x39d4ce[_0x6ec1('0x3a')],{'$or':_[_0x6ec1('0x2e')](_0x57bd3d,function(_0x4da26a){if(_0x4da26a[_0x6ec1('0x2a')]!==_0x6ec1('0x3e')){var _0x275ee2={};_0x275ee2[_0x4da26a['name']]={'$like':'%'+_0x2b4584[_0x6ec1('0x2f')][_0x6ec1('0x3c')]+'%'};return _0x275ee2;}})});}_0x39d4ce=_[_0x6ec1('0x3d')]({},_0x39d4ce,_0x2b4584[_0x6ec1('0x3f')]);var _0x491a28={'where':_0x39d4ce['where']};return db[_0x6ec1('0x27')]['count'](_0x491a28)[_0x6ec1('0x22')](function(_0x2aa4e2){_0x51153f[_0x6ec1('0x1d')]=_0x2aa4e2;if(_0x2b4584[_0x6ec1('0x2f')]['includeAll']){_0x39d4ce[_0x6ec1('0x40')]=[{'all':!![]}];}return db[_0x6ec1('0x27')][_0x6ec1('0x41')](_0x39d4ce);})['then'](function(_0xa08cdc){_0x51153f[_0x6ec1('0x42')]=_0xa08cdc;return _0x51153f;})['then'](respondWithFilteredResult(_0x82dd18,_0x39d4ce))[_0x6ec1('0x43')](handleError(_0x82dd18,null));};exports[_0x6ec1('0x44')]=function(_0x489e1d,_0x4f2076){var _0x4ad3a7={'raw':!![],'where':{'id':_0x489e1d['params']['id']}},_0x8fc0a={};_0x8fc0a['model']=_[_0x6ec1('0x30')](db[_0x6ec1('0x27')][_0x6ec1('0x28')]);_0x8fc0a[_0x6ec1('0x2f')]=_['keys'](_0x489e1d['query']);_0x8fc0a[_0x6ec1('0x31')]=_[_0x6ec1('0x32')](_0x8fc0a[_0x6ec1('0x2c')],_0x8fc0a[_0x6ec1('0x2f')]);_0x4ad3a7[_0x6ec1('0x33')]=_['intersection'](_0x8fc0a[_0x6ec1('0x2c')],qs[_0x6ec1('0x34')](_0x489e1d[_0x6ec1('0x2f')][_0x6ec1('0x34')]));_0x4ad3a7[_0x6ec1('0x33')]=_0x4ad3a7['attributes'][_0x6ec1('0x35')]?_0x4ad3a7[_0x6ec1('0x33')]:_0x8fc0a[_0x6ec1('0x2c')];if(_0x489e1d[_0x6ec1('0x2f')][_0x6ec1('0x45')]){_0x4ad3a7[_0x6ec1('0x40')]=[{'all':!![]}];}_0x4ad3a7=_['merge']({},_0x4ad3a7,_0x489e1d['options']);return db[_0x6ec1('0x27')][_0x6ec1('0x46')](_0x4ad3a7)['then'](handleEntityNotFound(_0x4f2076,null))['then'](respondWithResult(_0x4f2076,null))[_0x6ec1('0x43')](handleError(_0x4f2076,null));};exports['update']=function(_0x399da2,_0x54be79){if(_0x399da2['body']['id']){delete _0x399da2[_0x6ec1('0x47')]['id'];}return db[_0x6ec1('0x27')][_0x6ec1('0x46')]({'where':{'id':_0x399da2[_0x6ec1('0x48')]['id']}})[_0x6ec1('0x22')](handleEntityNotFound(_0x54be79,null))[_0x6ec1('0x22')](saveUpdates(_0x399da2[_0x6ec1('0x47')],null))[_0x6ec1('0x22')](respondWithResult(_0x54be79,null))[_0x6ec1('0x43')](handleError(_0x54be79,null));};exports[_0x6ec1('0x49')]=function(_0x2fb7dc,_0x21a11c){return db['CmCustomField'][_0x6ec1('0x46')]({'where':{'id':_0x2fb7dc[_0x6ec1('0x48')]['id']}})['then'](handleEntityNotFound(_0x21a11c,null))['then'](removeEntity(_0x21a11c,null))['catch'](handleError(_0x21a11c,null));};exports[_0x6ec1('0x4a')]=function(_0xed2ecc,_0x3685d1){var _0x40029d;return db[_0x6ec1('0x4b')][_0x6ec1('0x4c')](function(_0x888870){return db[_0x6ec1('0x27')][_0x6ec1('0x4a')](_0xed2ecc['body'],{'transaction':_0x888870})[_0x6ec1('0x22')](function(_0x158e51){_0x40029d=_0x158e51;var _0x282345={'type':db[_0x6ec1('0x4d')][_0x6ec1('0x4e')],'transaction':_0x888870};switch(_0xed2ecc[_0x6ec1('0x47')][_0x6ec1('0x2a')]){case _0x6ec1('0x4f'):_0x282345[_0x6ec1('0x2a')]=db[_0x6ec1('0x4d')][_0x6ec1('0x4e')];break;case _0x6ec1('0x50'):_0x282345[_0x6ec1('0x2a')]=db[_0x6ec1('0x4d')][_0x6ec1('0x51')];break;case'switch':_0x282345[_0x6ec1('0x2a')]=db[_0x6ec1('0x4d')]['BOOLEAN'];_0x282345['defaultValue']=![];break;default:}return db[_0x6ec1('0x4b')]['queryInterface'][_0x6ec1('0x52')](_0x6ec1('0x53'),util['format']('cf_%d',_0x40029d['id']),_0x282345);})[_0x6ec1('0x22')](function(){return _0x40029d;});})[_0x6ec1('0x22')](respondWithResult(_0x3685d1,0xc9))[_0x6ec1('0x43')](handleError(_0x3685d1,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index c7a832e..f0840bd 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 _0x92cc=['request-promise','rimraf','../../config/environment','./cmCustomField.attributes','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','bluebird'];(function(_0x54f795,_0x567a78){var _0x880e70=function(_0x405c2f){while(--_0x405c2f){_0x54f795['push'](_0x54f795['shift']());}};_0x880e70(++_0x567a78);}(_0x92cc,0xd8));var _0xc92c=function(_0x5ae502,_0x26b0be){_0x5ae502=_0x5ae502-0x0;var _0x148c82=_0x92cc[_0x5ae502];return _0x148c82;};'use strict';var _=require(_0xc92c('0x0'));var util=require(_0xc92c('0x1'));var logger=require(_0xc92c('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc92c('0x3'));var rp=require(_0xc92c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc92c('0x5'));var config=require(_0xc92c('0x6'));var attributes=require(_0xc92c('0x7'));module['exports']=function(_0x2feedd,_0x3a697f){return _0x2feedd['define'](_0xc92c('0x8'),attributes,{'tableName':_0xc92c('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x568e=['rimraf','./cmCustomField.attributes','exports','CmCustomField','util','api','path'];(function(_0x28112d,_0x28c519){var _0x397ecb=function(_0x4acc32){while(--_0x4acc32){_0x28112d['push'](_0x28112d['shift']());}};_0x397ecb(++_0x28c519);}(_0x568e,0x90));var _0xe568=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x568e[_0x1d9aa0];return _0x226868;};'use strict';var _=require('lodash');var util=require(_0xe568('0x0'));var logger=require('../../config/logger')(_0xe568('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe568('0x2'));var rimraf=require(_0xe568('0x3'));var config=require('../../config/environment');var attributes=require(_0xe568('0x4'));module[_0xe568('0x5')]=function(_0x2020b4,_0x8e29d8){return _0x2020b4['define'](_0xe568('0x6'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 19eecf9..9b37a00 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 _0x04c9=['then','info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0x04c9,0x19b));var _0x904c=function(_0x432ee6,_0x5aea6e){_0x432ee6=_0x432ee6-0x0;var _0x52a843=_0x04c9[_0x432ee6];return _0x52a843;};'use strict';var _=require('lodash');var util=require(_0x904c('0x0'));var moment=require(_0x904c('0x1'));var BPromise=require(_0x904c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x904c('0x3'))['db'];var utils=require(_0x904c('0x4'));var logger=require('../../config/logger')(_0x904c('0x5'));var config=require(_0x904c('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x904c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x12327e,_0x37416e,_0x12ea19){return new BPromise(function(_0x5599b7,_0x344673){return client[_0x904c('0x8')](_0x12327e,_0x12ea19)[_0x904c('0x9')](function(_0x3b41ca){logger[_0x904c('0xa')]('CmCustomField,\x20%s,\x20%s',_0x37416e,_0x904c('0xb'));logger[_0x904c('0xc')](_0x904c('0xd'),_0x37416e,'request\x20sent',JSON[_0x904c('0xe')](_0x3b41ca));if(_0x3b41ca[_0x904c('0xf')]){if(_0x3b41ca[_0x904c('0xf')][_0x904c('0x10')]===0x1f4){logger['error'](_0x904c('0x11'),_0x37416e,_0x3b41ca[_0x904c('0xf')]['message']);return _0x344673(_0x3b41ca['error']['message']);}logger[_0x904c('0xf')]('CmCustomField,\x20%s,\x20%s',_0x37416e,_0x3b41ca[_0x904c('0xf')]['message']);return _0x5599b7(_0x3b41ca[_0x904c('0xf')][_0x904c('0x12')]);}else{logger['info']('CmCustomField,\x20%s,\x20%s',_0x37416e,_0x904c('0xb'));_0x5599b7(_0x3b41ca[_0x904c('0x13')][_0x904c('0x12')]);}})[_0x904c('0x14')](function(_0x215226){logger[_0x904c('0xf')](_0x904c('0x11'),_0x37416e,_0x215226);_0x344673(_0x215226);});});} \ No newline at end of file +var _0x6a87=['error','CmCustomField,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6a87,0x6e));var _0x76a8=function(_0x133df2,_0x131193){_0x133df2=_0x133df2-0x0;var _0x3b7a7b=_0x6a87[_0x133df2];return _0x3b7a7b;};'use strict';var _=require('lodash');var util=require(_0x76a8('0x0'));var moment=require(_0x76a8('0x1'));var BPromise=require(_0x76a8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x76a8('0x3'))['db'];var utils=require(_0x76a8('0x4'));var logger=require(_0x76a8('0x5'))(_0x76a8('0x6'));var config=require(_0x76a8('0x7'));var jayson=require(_0x76a8('0x8'));var client=jayson[_0x76a8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x490924,_0x5b7607,_0xb9f17e){return new BPromise(function(_0xc2e1ba,_0x2267e9){return client[_0x76a8('0xa')](_0x490924,_0xb9f17e)[_0x76a8('0xb')](function(_0x58e3b7){logger[_0x76a8('0xc')]('CmCustomField,\x20%s,\x20%s',_0x5b7607,_0x76a8('0xd'));logger['debug'](_0x76a8('0xe'),_0x5b7607,_0x76a8('0xd'),JSON[_0x76a8('0xf')](_0x58e3b7));if(_0x58e3b7['error']){if(_0x58e3b7[_0x76a8('0x10')]['code']===0x1f4){logger[_0x76a8('0x10')](_0x76a8('0x11'),_0x5b7607,_0x58e3b7[_0x76a8('0x10')]['message']);return _0x2267e9(_0x58e3b7[_0x76a8('0x10')][_0x76a8('0x12')]);}logger[_0x76a8('0x10')](_0x76a8('0x11'),_0x5b7607,_0x58e3b7[_0x76a8('0x10')][_0x76a8('0x12')]);return _0xc2e1ba(_0x58e3b7[_0x76a8('0x10')][_0x76a8('0x12')]);}else{logger['info'](_0x76a8('0x11'),_0x5b7607,_0x76a8('0xd'));_0xc2e1ba(_0x58e3b7[_0x76a8('0x13')]['message']);}})[_0x76a8('0x14')](function(_0x15147a){logger[_0x76a8('0x10')](_0x76a8('0x11'),_0x5b7607,_0x15147a);_0x2267e9(_0x15147a);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index bae5081..faf06e7 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 _0x92bc=['/:id','post','create','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated'];(function(_0x447ef1,_0x374cd2){var _0x3d72ec=function(_0x3e10b){while(--_0x3e10b){_0x447ef1['push'](_0x447ef1['shift']());}};_0x3d72ec(++_0x374cd2);}(_0x92bc,0x106));var _0xc92b=function(_0x14e68d,_0x5d3968){_0x14e68d=_0x14e68d-0x0;var _0x32a06f=_0x92bc[_0x14e68d];return _0x32a06f;};'use strict';var multer=require(_0xc92b('0x0'));var util=require(_0xc92b('0x1'));var path=require(_0xc92b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc92b('0x3')]();var fs_extra=require(_0xc92b('0x4'));var auth=require(_0xc92b('0x5'));var interaction=require(_0xc92b('0x6'));var config=require('../../config/environment');var controller=require(_0xc92b('0x7'));router[_0xc92b('0x8')]('/',auth[_0xc92b('0x9')](),controller['index']);router['get'](_0xc92b('0xa'),auth[_0xc92b('0x9')](),controller['show']);router[_0xc92b('0xb')]('/',auth[_0xc92b('0x9')](),controller[_0xc92b('0xc')]);router['put'](_0xc92b('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xc92b('0xd')]('/:id',auth[_0xc92b('0x9')](),controller[_0xc92b('0xe')]);module[_0xc92b('0xf')]=router; \ No newline at end of file +var _0xec13=['isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x28301b,_0x5178be){var _0x546bec=function(_0x1d6774){while(--_0x1d6774){_0x28301b['push'](_0x28301b['shift']());}};_0x546bec(++_0x5178be);}(_0xec13,0x8f));var _0x3ec1=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xec13[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0x3ec1('0x0'));var util=require(_0x3ec1('0x1'));var path=require(_0x3ec1('0x2'));var timeout=require('connect-timeout');var express=require(_0x3ec1('0x3'));var router=express[_0x3ec1('0x4')]();var fs_extra=require(_0x3ec1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3ec1('0x6'));var config=require(_0x3ec1('0x7'));var controller=require('./cmCustomField.controller');router[_0x3ec1('0x8')]('/',auth[_0x3ec1('0x9')](),controller[_0x3ec1('0xa')]);router['get'](_0x3ec1('0xb'),auth[_0x3ec1('0x9')](),controller['show']);router[_0x3ec1('0xc')]('/',auth[_0x3ec1('0x9')](),controller[_0x3ec1('0xd')]);router[_0x3ec1('0xe')](_0x3ec1('0xb'),auth[_0x3ec1('0x9')](),controller[_0x3ec1('0xf')]);router[_0x3ec1('0x10')](_0x3ec1('0xb'),auth[_0x3ec1('0x9')](),controller[_0x3ec1('0x11')]);module[_0x3ec1('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index f7081f1..397ff29 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 _0x404c=['BOOLEAN','DATE','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','format','INTEGER'];(function(_0x17d711,_0x5b4fb7){var _0x371e29=function(_0x519f59){while(--_0x519f59){_0x17d711['push'](_0x17d711['shift']());}};_0x371e29(++_0x5b4fb7);}(_0x404c,0x1c6));var _0xc404=function(_0x51d8aa,_0x2c4a01){_0x51d8aa=_0x51d8aa-0x0;var _0x2af145=_0x404c[_0x51d8aa];return _0x2af145;};'use strict';var moment=require(_0xc404('0x0'));var Sequelize=require(_0xc404('0x1'));module[_0xc404('0x2')]={'phone':{'type':Sequelize[_0xc404('0x3')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xc404('0x4')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xc404('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc404('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc404('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xc404('0x6')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xc404('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xc404('0x7')]},'priority':{'type':Sequelize[_0xc404('0x5')](0x2)[_0xc404('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xc404('0x6')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xc404('0x5')],'unique':_0xc404('0x9')},'ListId':{'type':Sequelize[_0xc404('0x5')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0xc404('0x5')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xc404('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xc404('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc404('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xc404('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc404('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfecf=['contactListQueue','moment','exports','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED'];(function(_0x453583,_0x5ca1e8){var _0x3e9101=function(_0x421947){while(--_0x421947){_0x453583['push'](_0x453583['shift']());}};_0x3e9101(++_0x5ca1e8);}(_0xfecf,0x71));var _0xffec=function(_0x30c974,_0x43819d){_0x30c974=_0x30c974-0x0;var _0x41e239=_0xfecf[_0x30c974];return _0x41e239;};'use strict';var moment=require(_0xffec('0x0'));var Sequelize=require('sequelize');module[_0xffec('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0xffec('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xffec('0x3')],'defaultValue':moment()['format'](_0xffec('0x4'))},'countbusyretry':{'type':Sequelize[_0xffec('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xffec('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xffec('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xffec('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xffec('0x3')]},'priority':{'type':Sequelize[_0xffec('0x5')](0x2)[_0xffec('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xffec('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xffec('0x5')],'unique':_0xffec('0x7')},'ListId':{'type':Sequelize[_0xffec('0x5')],'unique':_0xffec('0x7')},'UserId':{'type':Sequelize[_0xffec('0x5')]},'VoiceQueueId':{'type':Sequelize[_0xffec('0x5')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xffec('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xffec('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xffec('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xffec('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xffec('0x5')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 7742320..56d777a 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 _0x7e77=['fieldName','type','key','model','map','query','keys','filters','intersection','concat','$and','$or','$gte','$lte','$eq','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','CmHopper','includeAll','include','rows','catch','show','params','find','create','body','update','describe','VoiceQueueId','CampaignId','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','CmContact','lastName','isNil','firstName','calleridname','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','sequelize','transaction','direction','isEmpty','hopperIds','priority','ASC','scheduledAt','literal','DESC','dialOrderByScheduledAt','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','List','VoiceQueue','dialActive','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','then','destroy','end','error','name','send','index','rawAttributes'];(function(_0x4b7f28,_0x27d23a){var _0xf5b553=function(_0x1cb9c1){while(--_0x1cb9c1){_0x4b7f28['push'](_0x4b7f28['shift']());}};_0xf5b553(++_0x27d23a);}(_0x7e77,0x64));var _0x77e7=function(_0x5519a9,_0x1c5147){_0x5519a9=_0x5519a9-0x0;var _0x32f2cc=_0x7e77[_0x5519a9];return _0x32f2cc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x77e7('0x0'));var zipdir=require(_0x77e7('0x1'));var jsonpatch=require(_0x77e7('0x2'));var rp=require('request-promise');var moment=require(_0x77e7('0x3'));var BPromise=require(_0x77e7('0x4'));var Mustache=require(_0x77e7('0x5'));var util=require('util');var path=require(_0x77e7('0x6'));var sox=require(_0x77e7('0x7'));var csv=require('to-csv');var ejs=require(_0x77e7('0x8'));var fs=require('fs');var fs_extra=require(_0x77e7('0x9'));var _=require(_0x77e7('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x77e7('0xb'));var deskjs=require(_0x77e7('0xc'));var toCsv=require(_0x77e7('0xd'));var querystring=require(_0x77e7('0xe'));var Papa=require(_0x77e7('0xf'));var Redis=require('ioredis');var authService=require(_0x77e7('0x10'));var qs=require(_0x77e7('0x11'));var as=require(_0x77e7('0x12'));var hardwareService=require(_0x77e7('0x13'));var logger=require('../../config/logger')(_0x77e7('0x14'));var utils=require(_0x77e7('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x77e7('0x16'));var db=require(_0x77e7('0x17'))['db'];function respondWithStatusCode(_0x2ac756,_0x44635e){_0x44635e=_0x44635e||0xcc;return function(_0x13c91d){if(_0x13c91d){return _0x2ac756[_0x77e7('0x18')](_0x44635e);}return _0x2ac756[_0x77e7('0x19')](_0x44635e)['end']();};}function respondWithResult(_0x317c77,_0x2bd3cb){_0x2bd3cb=_0x2bd3cb||0xc8;return function(_0x10f3e2){if(_0x10f3e2){return _0x317c77[_0x77e7('0x19')](_0x2bd3cb)[_0x77e7('0x1a')](_0x10f3e2);}};}function respondWithFilteredResult(_0x5eab68,_0x51a2bf){return function(_0x45a6ce){if(_0x45a6ce){var _0x1b1dc1=typeof _0x51a2bf[_0x77e7('0x1b')]===_0x77e7('0x1c')&&typeof _0x51a2bf[_0x77e7('0x1d')]==='undefined';var _0x127772=_0x45a6ce[_0x77e7('0x1e')];var _0x5ebba0=_0x1b1dc1?0x0:_0x51a2bf[_0x77e7('0x1b')];var _0xd4c7ce=_0x1b1dc1?_0x45a6ce[_0x77e7('0x1e')]:_0x51a2bf[_0x77e7('0x1b')]+_0x51a2bf['limit'];var _0x343ece;if(_0xd4c7ce>=_0x127772){_0xd4c7ce=_0x127772;_0x343ece=0xc8;}else{_0x343ece=0xce;}_0x5eab68[_0x77e7('0x19')](_0x343ece);return _0x5eab68[_0x77e7('0x1f')]('Content-Range',_0x5ebba0+'-'+_0xd4c7ce+'/'+_0x127772)[_0x77e7('0x1a')](_0x45a6ce);}return null;};}function patchUpdates(_0x1d2331){return function(_0x36df68){try{jsonpatch['apply'](_0x36df68,_0x1d2331,!![]);}catch(_0x238655){return BPromise['reject'](_0x238655);}return _0x36df68['save']();};}function saveUpdates(_0xbb2702,_0x3af05d){return function(_0x347209){if(_0x347209){return _0x347209['update'](_0xbb2702)[_0x77e7('0x20')](function(_0x597224){return _0x597224;});}return null;};}function removeEntity(_0xde362,_0x2cbde5){return function(_0x162768){if(_0x162768){return _0x162768[_0x77e7('0x21')]()[_0x77e7('0x20')](function(){_0xde362[_0x77e7('0x19')](0xcc)[_0x77e7('0x22')]();});}};}function handleEntityNotFound(_0x378b8d,_0x4c4bf2){return function(_0x63e828){if(!_0x63e828){_0x378b8d[_0x77e7('0x18')](0x194);}return _0x63e828;};}function handleError(_0x2cd213,_0x341c9d){_0x341c9d=_0x341c9d||0x1f4;return function(_0x550c4e){logger[_0x77e7('0x23')](_0x550c4e['stack']);if(_0x550c4e[_0x77e7('0x24')]){delete _0x550c4e[_0x77e7('0x24')];}_0x2cd213[_0x77e7('0x19')](_0x341c9d)[_0x77e7('0x25')](_0x550c4e);};}exports[_0x77e7('0x26')]=function(_0x2df6f9,_0x383605){var _0x2c7d80={},_0x42f15b={},_0x3438c3={'count':0x0,'rows':[]};var _0x5e94d2=_['map'](db['CmHopper'][_0x77e7('0x27')],function(_0x381dfd){return{'name':_0x381dfd[_0x77e7('0x28')],'type':_0x381dfd[_0x77e7('0x29')][_0x77e7('0x2a')]};});_0x42f15b[_0x77e7('0x2b')]=_[_0x77e7('0x2c')](_0x5e94d2,'name');_0x42f15b[_0x77e7('0x2d')]=_[_0x77e7('0x2e')](_0x2df6f9[_0x77e7('0x2d')]);_0x42f15b[_0x77e7('0x2f')]=_[_0x77e7('0x30')](_0x42f15b['model'],_0x42f15b[_0x77e7('0x2d')]);_0x42f15b['filters']=_[_0x77e7('0x31')](_0x42f15b[_0x77e7('0x2f')],[_0x77e7('0x32'),_0x77e7('0x33'),'$gt',_0x77e7('0x34'),'$lt',_0x77e7('0x35'),'$ne',_0x77e7('0x36'),'$not',_0x77e7('0x37'),_0x77e7('0x38'),_0x77e7('0x39'),_0x77e7('0x3a'),_0x77e7('0x3b'),_0x77e7('0x3c'),_0x77e7('0x3d'),_0x77e7('0x3e'),_0x77e7('0x3b'),_0x77e7('0x3f'),_0x77e7('0x40'),_0x77e7('0x41'),'$any']);_0x2c7d80[_0x77e7('0x42')]=_['intersection'](_0x42f15b['model'],qs[_0x77e7('0x43')](_0x2df6f9['query'][_0x77e7('0x43')]));_0x2c7d80[_0x77e7('0x42')]=_0x2c7d80[_0x77e7('0x42')][_0x77e7('0x44')]?_0x2c7d80['attributes']:_0x42f15b[_0x77e7('0x2b')];if(!_0x2df6f9['query']['hasOwnProperty'](_0x77e7('0x45'))){_0x2c7d80[_0x77e7('0x1d')]=qs[_0x77e7('0x1d')](_0x2df6f9[_0x77e7('0x2d')][_0x77e7('0x1d')]);_0x2c7d80[_0x77e7('0x1b')]=qs[_0x77e7('0x1b')](_0x2df6f9[_0x77e7('0x2d')][_0x77e7('0x1b')]);}_0x2c7d80['order']=qs[_0x77e7('0x46')](_0x2df6f9['query'][_0x77e7('0x46')]);_0x2c7d80[_0x77e7('0x47')]=qs[_0x77e7('0x2f')](_[_0x77e7('0x48')](_0x2df6f9[_0x77e7('0x2d')],_0x42f15b[_0x77e7('0x2f')]),_0x5e94d2);if(_0x2df6f9[_0x77e7('0x2d')][_0x77e7('0x49')]){_0x2c7d80[_0x77e7('0x47')]=_[_0x77e7('0x4a')](_0x2c7d80[_0x77e7('0x47')],{'$or':_['map'](_0x5e94d2,function(_0x1cf532){if(_0x1cf532[_0x77e7('0x29')]!==_0x77e7('0x4b')){var _0x57e673={};_0x57e673[_0x1cf532[_0x77e7('0x24')]]={'$like':'%'+_0x2df6f9[_0x77e7('0x2d')][_0x77e7('0x49')]+'%'};return _0x57e673;}})});}_0x2c7d80=_[_0x77e7('0x4a')]({},_0x2c7d80,_0x2df6f9[_0x77e7('0x4c')]);var _0x13f925={'where':_0x2c7d80[_0x77e7('0x47')]};return db[_0x77e7('0x4d')][_0x77e7('0x1e')](_0x13f925)[_0x77e7('0x20')](function(_0x1cc8fb){_0x3438c3[_0x77e7('0x1e')]=_0x1cc8fb;if(_0x2df6f9['query'][_0x77e7('0x4e')]){_0x2c7d80[_0x77e7('0x4f')]=[{'all':!![]}];}return db[_0x77e7('0x4d')]['findAll'](_0x2c7d80);})[_0x77e7('0x20')](function(_0x25dddb){_0x3438c3[_0x77e7('0x50')]=_0x25dddb;return _0x3438c3;})[_0x77e7('0x20')](respondWithFilteredResult(_0x383605,_0x2c7d80))[_0x77e7('0x51')](handleError(_0x383605,null));};exports[_0x77e7('0x52')]=function(_0x8ab15e,_0x41761c){var _0x5cdee9={'raw':!![],'where':{'id':_0x8ab15e[_0x77e7('0x53')]['id']}},_0x545968={};_0x545968[_0x77e7('0x2b')]=_[_0x77e7('0x2e')](db[_0x77e7('0x4d')][_0x77e7('0x27')]);_0x545968[_0x77e7('0x2d')]=_[_0x77e7('0x2e')](_0x8ab15e[_0x77e7('0x2d')]);_0x545968[_0x77e7('0x2f')]=_[_0x77e7('0x30')](_0x545968[_0x77e7('0x2b')],_0x545968[_0x77e7('0x2d')]);_0x5cdee9[_0x77e7('0x42')]=_[_0x77e7('0x30')](_0x545968[_0x77e7('0x2b')],qs[_0x77e7('0x43')](_0x8ab15e[_0x77e7('0x2d')][_0x77e7('0x43')]));_0x5cdee9[_0x77e7('0x42')]=_0x5cdee9[_0x77e7('0x42')][_0x77e7('0x44')]?_0x5cdee9[_0x77e7('0x42')]:_0x545968[_0x77e7('0x2b')];if(_0x8ab15e[_0x77e7('0x2d')]['includeAll']){_0x5cdee9[_0x77e7('0x4f')]=[{'all':!![]}];}_0x5cdee9=_[_0x77e7('0x4a')]({},_0x5cdee9,_0x8ab15e[_0x77e7('0x4c')]);return db[_0x77e7('0x4d')][_0x77e7('0x54')](_0x5cdee9)[_0x77e7('0x20')](handleEntityNotFound(_0x41761c,null))[_0x77e7('0x20')](respondWithResult(_0x41761c,null))[_0x77e7('0x51')](handleError(_0x41761c,null));};exports[_0x77e7('0x55')]=function(_0x30a32c,_0x1569ca){return db['CmHopper'][_0x77e7('0x55')](_0x30a32c[_0x77e7('0x56')],{})[_0x77e7('0x20')](respondWithResult(_0x1569ca,0xc9))[_0x77e7('0x51')](handleError(_0x1569ca,null));};exports[_0x77e7('0x57')]=function(_0x6507e7,_0x24b5ca){if(_0x6507e7['body']['id']){delete _0x6507e7[_0x77e7('0x56')]['id'];}return db[_0x77e7('0x4d')][_0x77e7('0x54')]({'where':{'id':_0x6507e7[_0x77e7('0x53')]['id']}})[_0x77e7('0x20')](handleEntityNotFound(_0x24b5ca,null))[_0x77e7('0x20')](saveUpdates(_0x6507e7[_0x77e7('0x56')],null))[_0x77e7('0x20')](respondWithResult(_0x24b5ca,null))['catch'](handleError(_0x24b5ca,null));};exports[_0x77e7('0x58')]=function(_0x250d33,_0x3f6fd7){return db['CmHopper']['describe']()['then'](respondWithResult(_0x3f6fd7,null))[_0x77e7('0x51')](handleError(_0x3f6fd7,null));};exports[_0x77e7('0x21')]=function(_0x3ba195,_0x1313e8){var _0x3316c0;return db[_0x77e7('0x4d')][_0x77e7('0x54')]({'where':{'id':_0x3ba195[_0x77e7('0x53')]['id']}})[_0x77e7('0x20')](handleEntityNotFound(_0x1313e8,null))[_0x77e7('0x20')](function(_0x154330){if(_0x154330){return _0x154330[_0x77e7('0x21')]()['then'](function(_0x3f332f){return _0x3f332f;});}})['then'](function(_0x22a46d){_0x3316c0=_0x22a46d;if(_0x22a46d){if(_0x22a46d[_0x77e7('0x59')]||_0x22a46d[_0x77e7('0x5a')]){return db[_0x22a46d['VoiceQueueId']?'VoiceQueue':'Campaign'][_0x77e7('0x54')]({'where':{'id':_0x22a46d[_0x77e7('0x59')]?_0x22a46d['VoiceQueueId']:_0x22a46d[_0x77e7('0x5a')]},'attributes':['id',_0x77e7('0x24')],'raw':!![]});}}})[_0x77e7('0x20')](function(_0x468ea5){var _0x32fd02={};if(_0x468ea5){_[_0x77e7('0x4a')](_0x32fd02,_[_0x77e7('0x5b')](_0x3316c0[_0x77e7('0x5c')],[_0x77e7('0x5d'),_0x77e7('0x5e'),'id']));_0x32fd02[_0x77e7('0x5f')]=0x15;_0x32fd02[_0x77e7('0x60')]=_0x77e7('0x61');_0x32fd02['campaign']=_0x468ea5[_0x77e7('0x24')];_0x32fd02['membername']=_0x3ba195[_0x77e7('0x62')][_0x77e7('0x24')];_0x32fd02[_0x77e7('0x63')]=_0x3ba195[_0x77e7('0x62')]['id'];_0x32fd02[_0x77e7('0x61')]=!![];_0x32fd02['deletedat']=moment()[_0x77e7('0x64')](_0x77e7('0x65'));_0x32fd02[_0x77e7('0x66')]=_0x3316c0[_0x77e7('0x67')];_0x32fd02['campaigntype']=_0x3316c0[_0x77e7('0x59')]?_0x77e7('0x68'):'ivr';return db[_0x77e7('0x69')]['find']({'where':{'id':_0x32fd02['ContactId']},'attributes':['firstName',_0x77e7('0x6a')]})[_0x77e7('0x20')](function(_0x41b7b5){if(!_['isNil'](_0x1313e8)&&!_[_0x77e7('0x6b')](_0x41b7b5[_0x77e7('0x6c')])){_0x32fd02[_0x77e7('0x6d')]=_0x41b7b5[_0x77e7('0x6c')];if(!_[_0x77e7('0x6b')](_0x41b7b5[_0x77e7('0x6a')])){_0x32fd02[_0x77e7('0x6d')]+='\x20'+_0x41b7b5[_0x77e7('0x6a')];}}})['finally'](function(){return db[_0x77e7('0x6e')][_0x77e7('0x55')](_0x32fd02);});}})['then'](function(){return _0x1313e8['status'](0xcc)[_0x77e7('0x22')]();})[_0x77e7('0x51')](handleError(_0x1313e8,null));};exports[_0x77e7('0x6f')]=function(_0x17bd06,_0x2d46a5,_0x1b3ffe){var _0x539db3=[];return db[_0x77e7('0x69')]['describe']()[_0x77e7('0x20')](function(_0x522d38){_0x539db3=_[_0x77e7('0x2e')](_0x522d38);return _0x17bd06[_0x77e7('0x62')][_0x77e7('0x70')]({'where':{'type':_0x77e7('0x71'),'dialActive':!![],'dialMethod':_0x77e7('0x72')},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})[_0x77e7('0x20')](function(_0x3c0100){if(_0x3c0100&&_0x3c0100[_0x77e7('0x44')]){return db[_0x77e7('0x73')][_0x77e7('0x74')](function(_0x1b059e){var _0x1f9287={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x77e7('0x64')](_0x77e7('0x65'))},'VoiceQueueId':{'$in':_['map'](_0x3c0100,'id')},'$or':[{'UserId':null},{'UserId':_0x17bd06[_0x77e7('0x62')]['id']}]};var _0x524956=[];if(_0x17bd06[_0x77e7('0x56')][_0x77e7('0x75')]&&_0x17bd06[_0x77e7('0x56')][_0x77e7('0x75')]==='prev'){if(!_[_0x77e7('0x76')](_0x17bd06['body'][_0x77e7('0x77')])){_0x1f9287['id']={'$in':_0x17bd06[_0x77e7('0x56')]['hopperIds']};}_0x524956=[[_0x77e7('0x78'),_0x77e7('0x79')],[_0x77e7('0x7a'),_0x3c0100[0x0]['dialOrderByScheduledAt']==='ASC'?'DESC':_0x77e7('0x79')],db[_0x77e7('0x73')][_0x77e7('0x7b')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x77e7('0x7c')]];}else{if(!_[_0x77e7('0x76')](_0x17bd06[_0x77e7('0x56')][_0x77e7('0x77')])){_0x1f9287['id']={'$notIn':_0x17bd06[_0x77e7('0x56')][_0x77e7('0x77')]};}_0x524956=[[_0x77e7('0x78'),'DESC'],[_0x77e7('0x7a'),_0x3c0100[0x0][_0x77e7('0x7d')]],db[_0x77e7('0x73')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x77e7('0x79')]];}return db[_0x77e7('0x4d')][_0x77e7('0x7e')]({'attributes':['id',_0x77e7('0x7f')],'where':_0x1f9287,'order':_0x524956,'transaction':_0x1b059e,'lock':_0x1b059e[_0x77e7('0x80')][_0x77e7('0x81')],'include':[{'model':db[_0x77e7('0x69')],'as':_0x77e7('0x82'),'attributes':_0x539db3,'include':[{'model':db[_0x77e7('0x83')],'as':_0x77e7('0x84'),'attributes':['id',_0x77e7('0x24')]}]},{'model':db['CmList'],'as':_0x77e7('0x85'),'attributes':['id','name']},{'model':db[_0x77e7('0x86')],'as':'Queue','attributes':['id','name',_0x77e7('0x87')]}]})[_0x77e7('0x20')](function(_0x4759fc){if(_0x4759fc){return _0x4759fc[_0x77e7('0x57')]({'UserId':_0x17bd06[_0x77e7('0x62')]['id']},{'transaction':_0x1b059e});}});});}})[_0x77e7('0x20')](handleEntityNotFound(_0x2d46a5,null))[_0x77e7('0x20')](respondWithResult(_0x2d46a5,null))[_0x77e7('0x51')](handleError(_0x2d46a5,null));};exports['getOpenContacts']=function(_0x47e4ab,_0x36f6bb,_0x44bfa5){return _0x47e4ab[_0x77e7('0x62')][_0x77e7('0x70')]({'where':{'type':_0x77e7('0x71'),'dialActive':!![],'dialMethod':_0x77e7('0x72')},'attributes':['id'],'raw':!![]})[_0x77e7('0x20')](function(_0x220777){if(_0x220777&&_0x220777['length']){return db['CmHopper'][_0x77e7('0x1e')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x77e7('0x64')](_0x77e7('0x65'))},'VoiceQueueId':{'$in':_[_0x77e7('0x2c')](_0x220777,'id')},'$or':[{'UserId':null},{'UserId':_0x47e4ab[_0x77e7('0x62')]['id']}]}});}return 0x0;})[_0x77e7('0x20')](function(_0x1c1f2b){if(!_[_0x77e7('0x6b')](_0x1c1f2b)&&_[_0x77e7('0x88')](_0x1c1f2b)){return _0x36f6bb['status'](0xc8)[_0x77e7('0x1a')]({'contacts':_0x1c1f2b});}else{logger[_0x77e7('0x23')](_0x77e7('0x89'),_0x77e7('0x8a'),0x194,_0x77e7('0x8b'));_0x36f6bb[_0x77e7('0x18')](0x194);}})[_0x77e7('0x51')](handleError(_0x36f6bb,null));}; \ No newline at end of file +var _0x79b8=['where','CmHopper','includeAll','include','findAll','catch','find','create','body','update','params','describe','destroy','CampaignId','VoiceQueue','Campaign','VoiceQueueId','omit','dataValues','createdAt','updatedAt','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','ivr','CmContact','ContactId','firstName','isNil','calleridname','lastName','finally','getPreview','getVoiceQueues','outbound','preview','sequelize','transaction','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','dialOrderByScheduledAt','findOne','LOCK','UPDATE','CmCompany','Company','List','Queue','dialActive','getOpenContacts','CmHopper,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','fs-extra','lodash','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','$and','$or','$gt','$lte','$ne','$eq','$notBetween','$in','$notIn','$like','$iLike','$notILike','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','order','pick','filter','merge','VIRTUAL','options'];(function(_0x1820cf,_0x26d93c){var _0x311806=function(_0x347e39){while(--_0x347e39){_0x1820cf['push'](_0x1820cf['shift']());}};_0x311806(++_0x26d93c);}(_0x79b8,0x1ea));var _0x879b=function(_0x9e18e2,_0x2680ea){_0x9e18e2=_0x9e18e2-0x0;var _0x5578bc=_0x79b8[_0x9e18e2];return _0x5578bc;};'use strict';var emlformat=require(_0x879b('0x0'));var rimraf=require(_0x879b('0x1'));var zipdir=require(_0x879b('0x2'));var jsonpatch=require(_0x879b('0x3'));var rp=require(_0x879b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x879b('0x5'));var util=require(_0x879b('0x6'));var path=require(_0x879b('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x879b('0x8'));var fs=require('fs');var fs_extra=require(_0x879b('0x9'));var _=require(_0x879b('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x879b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x879b('0xc'));var querystring=require(_0x879b('0xd'));var Papa=require('papaparse');var Redis=require(_0x879b('0xe'));var authService=require(_0x879b('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x879b('0x10'))(_0x879b('0x11'));var utils=require(_0x879b('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x879b('0x13'));var db=require(_0x879b('0x14'))['db'];function respondWithStatusCode(_0x4911de,_0x1d3220){_0x1d3220=_0x1d3220||0xcc;return function(_0x5d857c){if(_0x5d857c){return _0x4911de[_0x879b('0x15')](_0x1d3220);}return _0x4911de[_0x879b('0x16')](_0x1d3220)[_0x879b('0x17')]();};}function respondWithResult(_0x2280d7,_0x36b5ae){_0x36b5ae=_0x36b5ae||0xc8;return function(_0x271939){if(_0x271939){return _0x2280d7[_0x879b('0x16')](_0x36b5ae)[_0x879b('0x18')](_0x271939);}};}function respondWithFilteredResult(_0x2927e5,_0x25ef99){return function(_0x34f546){if(_0x34f546){var _0x4b5c07=typeof _0x25ef99[_0x879b('0x19')]===_0x879b('0x1a')&&typeof _0x25ef99[_0x879b('0x1b')]===_0x879b('0x1a');var _0x4a3289=_0x34f546[_0x879b('0x1c')];var _0xee0bf7=_0x4b5c07?0x0:_0x25ef99['offset'];var _0x222cc8=_0x4b5c07?_0x34f546[_0x879b('0x1c')]:_0x25ef99['offset']+_0x25ef99['limit'];var _0x216f9c;if(_0x222cc8>=_0x4a3289){_0x222cc8=_0x4a3289;_0x216f9c=0xc8;}else{_0x216f9c=0xce;}_0x2927e5['status'](_0x216f9c);return _0x2927e5[_0x879b('0x1d')](_0x879b('0x1e'),_0xee0bf7+'-'+_0x222cc8+'/'+_0x4a3289)[_0x879b('0x18')](_0x34f546);}return null;};}function patchUpdates(_0x50807e){return function(_0x4caca2){try{jsonpatch[_0x879b('0x1f')](_0x4caca2,_0x50807e,!![]);}catch(_0xe29d71){return BPromise[_0x879b('0x20')](_0xe29d71);}return _0x4caca2[_0x879b('0x21')]();};}function saveUpdates(_0x41ca5d,_0xfc310b){return function(_0x3c1913){if(_0x3c1913){return _0x3c1913['update'](_0x41ca5d)[_0x879b('0x22')](function(_0x47ba72){return _0x47ba72;});}return null;};}function removeEntity(_0x1bba24,_0x4a71b8){return function(_0x35ffde){if(_0x35ffde){return _0x35ffde['destroy']()['then'](function(){_0x1bba24[_0x879b('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4deba3,_0x1d3712){return function(_0x3d18ff){if(!_0x3d18ff){_0x4deba3['sendStatus'](0x194);}return _0x3d18ff;};}function handleError(_0x14cce3,_0x26b777){_0x26b777=_0x26b777||0x1f4;return function(_0x12a7e6){logger[_0x879b('0x23')](_0x12a7e6[_0x879b('0x24')]);if(_0x12a7e6['name']){delete _0x12a7e6[_0x879b('0x25')];}_0x14cce3[_0x879b('0x16')](_0x26b777)['send'](_0x12a7e6);};}exports[_0x879b('0x26')]=function(_0x15881e,_0x45ad72){var _0x2f3d95={},_0xf981fc={},_0x279853={'count':0x0,'rows':[]};var _0x3d1bcf=_[_0x879b('0x27')](db['CmHopper'][_0x879b('0x28')],function(_0x484c04){return{'name':_0x484c04[_0x879b('0x29')],'type':_0x484c04[_0x879b('0x2a')][_0x879b('0x2b')]};});_0xf981fc[_0x879b('0x2c')]=_[_0x879b('0x27')](_0x3d1bcf,'name');_0xf981fc[_0x879b('0x2d')]=_[_0x879b('0x2e')](_0x15881e[_0x879b('0x2d')]);_0xf981fc[_0x879b('0x2f')]=_[_0x879b('0x30')](_0xf981fc['model'],_0xf981fc[_0x879b('0x2d')]);_0xf981fc['filters']=_['concat'](_0xf981fc[_0x879b('0x2f')],[_0x879b('0x31'),_0x879b('0x32'),_0x879b('0x33'),'$gte','$lt',_0x879b('0x34'),_0x879b('0x35'),_0x879b('0x36'),'$not','$between',_0x879b('0x37'),_0x879b('0x38'),_0x879b('0x39'),_0x879b('0x3a'),'$notLike',_0x879b('0x3b'),_0x879b('0x3c'),'$like','$overlap',_0x879b('0x3d'),_0x879b('0x3e'),_0x879b('0x3f')]);_0x2f3d95[_0x879b('0x40')]=_['intersection'](_0xf981fc['model'],qs[_0x879b('0x41')](_0x15881e['query'][_0x879b('0x41')]));_0x2f3d95[_0x879b('0x40')]=_0x2f3d95[_0x879b('0x40')][_0x879b('0x42')]?_0x2f3d95[_0x879b('0x40')]:_0xf981fc[_0x879b('0x2c')];if(!_0x15881e[_0x879b('0x2d')][_0x879b('0x43')]('nolimit')){_0x2f3d95[_0x879b('0x1b')]=qs['limit'](_0x15881e[_0x879b('0x2d')][_0x879b('0x1b')]);_0x2f3d95[_0x879b('0x19')]=qs[_0x879b('0x19')](_0x15881e[_0x879b('0x2d')][_0x879b('0x19')]);}_0x2f3d95[_0x879b('0x44')]=qs['sort'](_0x15881e[_0x879b('0x2d')]['sort']);_0x2f3d95['where']=qs[_0x879b('0x2f')](_[_0x879b('0x45')](_0x15881e[_0x879b('0x2d')],_0xf981fc[_0x879b('0x2f')]),_0x3d1bcf);if(_0x15881e['query'][_0x879b('0x46')]){_0x2f3d95['where']=_[_0x879b('0x47')](_0x2f3d95['where'],{'$or':_[_0x879b('0x27')](_0x3d1bcf,function(_0x56b0a1){if(_0x56b0a1['type']!==_0x879b('0x48')){var _0x268603={};_0x268603[_0x56b0a1['name']]={'$like':'%'+_0x15881e[_0x879b('0x2d')]['filter']+'%'};return _0x268603;}})});}_0x2f3d95=_[_0x879b('0x47')]({},_0x2f3d95,_0x15881e[_0x879b('0x49')]);var _0x3725cd={'where':_0x2f3d95[_0x879b('0x4a')]};return db[_0x879b('0x4b')]['count'](_0x3725cd)['then'](function(_0x2395aa){_0x279853['count']=_0x2395aa;if(_0x15881e[_0x879b('0x2d')][_0x879b('0x4c')]){_0x2f3d95[_0x879b('0x4d')]=[{'all':!![]}];}return db[_0x879b('0x4b')][_0x879b('0x4e')](_0x2f3d95);})[_0x879b('0x22')](function(_0x172cbb){_0x279853['rows']=_0x172cbb;return _0x279853;})[_0x879b('0x22')](respondWithFilteredResult(_0x45ad72,_0x2f3d95))[_0x879b('0x4f')](handleError(_0x45ad72,null));};exports['show']=function(_0x24253c,_0x16fdda){var _0x1d2232={'raw':!![],'where':{'id':_0x24253c['params']['id']}},_0x1607da={};_0x1607da[_0x879b('0x2c')]=_[_0x879b('0x2e')](db[_0x879b('0x4b')][_0x879b('0x28')]);_0x1607da[_0x879b('0x2d')]=_['keys'](_0x24253c[_0x879b('0x2d')]);_0x1607da['filters']=_[_0x879b('0x30')](_0x1607da[_0x879b('0x2c')],_0x1607da[_0x879b('0x2d')]);_0x1d2232[_0x879b('0x40')]=_[_0x879b('0x30')](_0x1607da[_0x879b('0x2c')],qs[_0x879b('0x41')](_0x24253c[_0x879b('0x2d')][_0x879b('0x41')]));_0x1d2232[_0x879b('0x40')]=_0x1d2232['attributes'][_0x879b('0x42')]?_0x1d2232[_0x879b('0x40')]:_0x1607da[_0x879b('0x2c')];if(_0x24253c[_0x879b('0x2d')][_0x879b('0x4c')]){_0x1d2232['include']=[{'all':!![]}];}_0x1d2232=_[_0x879b('0x47')]({},_0x1d2232,_0x24253c['options']);return db[_0x879b('0x4b')][_0x879b('0x50')](_0x1d2232)['then'](handleEntityNotFound(_0x16fdda,null))[_0x879b('0x22')](respondWithResult(_0x16fdda,null))[_0x879b('0x4f')](handleError(_0x16fdda,null));};exports[_0x879b('0x51')]=function(_0x5547a6,_0x4f07b0){return db[_0x879b('0x4b')][_0x879b('0x51')](_0x5547a6[_0x879b('0x52')],{})[_0x879b('0x22')](respondWithResult(_0x4f07b0,0xc9))[_0x879b('0x4f')](handleError(_0x4f07b0,null));};exports[_0x879b('0x53')]=function(_0x205678,_0x3a4ebf){if(_0x205678[_0x879b('0x52')]['id']){delete _0x205678[_0x879b('0x52')]['id'];}return db[_0x879b('0x4b')][_0x879b('0x50')]({'where':{'id':_0x205678[_0x879b('0x54')]['id']}})[_0x879b('0x22')](handleEntityNotFound(_0x3a4ebf,null))['then'](saveUpdates(_0x205678[_0x879b('0x52')],null))[_0x879b('0x22')](respondWithResult(_0x3a4ebf,null))[_0x879b('0x4f')](handleError(_0x3a4ebf,null));};exports['describe']=function(_0x1c5930,_0x186951){return db[_0x879b('0x4b')][_0x879b('0x55')]()[_0x879b('0x22')](respondWithResult(_0x186951,null))['catch'](handleError(_0x186951,null));};exports['destroy']=function(_0x14ad05,_0x39b107){var _0x3b50f4;return db[_0x879b('0x4b')][_0x879b('0x50')]({'where':{'id':_0x14ad05[_0x879b('0x54')]['id']}})['then'](handleEntityNotFound(_0x39b107,null))['then'](function(_0x14df07){if(_0x14df07){return _0x14df07[_0x879b('0x56')]()[_0x879b('0x22')](function(_0x1c85d8){return _0x1c85d8;});}})['then'](function(_0x25a962){_0x3b50f4=_0x25a962;if(_0x25a962){if(_0x25a962['VoiceQueueId']||_0x25a962[_0x879b('0x57')]){return db[_0x25a962['VoiceQueueId']?_0x879b('0x58'):_0x879b('0x59')]['find']({'where':{'id':_0x25a962[_0x879b('0x5a')]?_0x25a962[_0x879b('0x5a')]:_0x25a962['CampaignId']},'attributes':['id',_0x879b('0x25')],'raw':!![]});}}})[_0x879b('0x22')](function(_0x54a512){var _0x8697a6={};if(_0x54a512){_[_0x879b('0x47')](_0x8697a6,_[_0x879b('0x5b')](_0x3b50f4[_0x879b('0x5c')],[_0x879b('0x5d'),_0x879b('0x5e'),'id']));_0x8697a6['state']=0x15;_0x8697a6[_0x879b('0x5f')]=_0x879b('0x60');_0x8697a6[_0x879b('0x61')]=_0x54a512['name'];_0x8697a6[_0x879b('0x62')]=_0x14ad05[_0x879b('0x63')][_0x879b('0x25')];_0x8697a6[_0x879b('0x64')]=_0x14ad05[_0x879b('0x63')]['id'];_0x8697a6[_0x879b('0x60')]=!![];_0x8697a6[_0x879b('0x65')]=moment()[_0x879b('0x66')](_0x879b('0x67'));_0x8697a6[_0x879b('0x68')]=_0x3b50f4['phone'];_0x8697a6[_0x879b('0x69')]=_0x3b50f4[_0x879b('0x5a')]?'queue':_0x879b('0x6a');return db[_0x879b('0x6b')]['find']({'where':{'id':_0x8697a6[_0x879b('0x6c')]},'attributes':[_0x879b('0x6d'),'lastName']})[_0x879b('0x22')](function(_0x58d226){if(!_[_0x879b('0x6e')](_0x39b107)&&!_[_0x879b('0x6e')](_0x58d226[_0x879b('0x6d')])){_0x8697a6[_0x879b('0x6f')]=_0x58d226[_0x879b('0x6d')];if(!_['isNil'](_0x58d226[_0x879b('0x70')])){_0x8697a6['calleridname']+='\x20'+_0x58d226['lastName'];}}})[_0x879b('0x71')](function(){return db['CmHopperFinal']['create'](_0x8697a6);});}})[_0x879b('0x22')](function(){return _0x39b107[_0x879b('0x16')](0xcc)['end']();})[_0x879b('0x4f')](handleError(_0x39b107,null));};exports[_0x879b('0x72')]=function(_0x228d32,_0x316706,_0x3ef89a){var _0x2c1869=[];return db[_0x879b('0x6b')]['describe']()[_0x879b('0x22')](function(_0x56ceaf){_0x2c1869=_[_0x879b('0x2e')](_0x56ceaf);return _0x228d32[_0x879b('0x63')][_0x879b('0x73')]({'where':{'type':_0x879b('0x74'),'dialActive':!![],'dialMethod':_0x879b('0x75')},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})[_0x879b('0x22')](function(_0x266691){if(_0x266691&&_0x266691[_0x879b('0x42')]){return db[_0x879b('0x76')][_0x879b('0x77')](function(_0x340bec){var _0x2b52e1={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x879b('0x66')](_0x879b('0x67'))},'VoiceQueueId':{'$in':_[_0x879b('0x27')](_0x266691,'id')},'$or':[{'UserId':null},{'UserId':_0x228d32['user']['id']}]};var _0x401edc=[];if(_0x228d32['body'][_0x879b('0x78')]&&_0x228d32[_0x879b('0x52')][_0x879b('0x78')]===_0x879b('0x79')){if(!_[_0x879b('0x7a')](_0x228d32[_0x879b('0x52')][_0x879b('0x7b')])){_0x2b52e1['id']={'$in':_0x228d32[_0x879b('0x52')][_0x879b('0x7b')]};}_0x401edc=[[_0x879b('0x7c'),_0x879b('0x7d')],[_0x879b('0x7e'),_0x266691[0x0]['dialOrderByScheduledAt']===_0x879b('0x7d')?_0x879b('0x7f'):_0x879b('0x7d')],db[_0x879b('0x76')][_0x879b('0x80')](_0x879b('0x81')),['id',_0x879b('0x7f')]];}else{if(!_[_0x879b('0x7a')](_0x228d32[_0x879b('0x52')][_0x879b('0x7b')])){_0x2b52e1['id']={'$notIn':_0x228d32[_0x879b('0x52')]['hopperIds']};}_0x401edc=[[_0x879b('0x7c'),'DESC'],[_0x879b('0x7e'),_0x266691[0x0][_0x879b('0x82')]],db[_0x879b('0x76')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x879b('0x7d')]];}return db['CmHopper'][_0x879b('0x83')]({'attributes':['id','scheduledat'],'where':_0x2b52e1,'order':_0x401edc,'transaction':_0x340bec,'lock':_0x340bec[_0x879b('0x84')][_0x879b('0x85')],'include':[{'model':db[_0x879b('0x6b')],'as':'Contact','attributes':_0x2c1869,'include':[{'model':db[_0x879b('0x86')],'as':_0x879b('0x87'),'attributes':['id',_0x879b('0x25')]}]},{'model':db['CmList'],'as':_0x879b('0x88'),'attributes':['id',_0x879b('0x25')]},{'model':db[_0x879b('0x58')],'as':_0x879b('0x89'),'attributes':['id','name',_0x879b('0x8a')]}]})['then'](function(_0x5bb881){if(_0x5bb881){return _0x5bb881['update']({'UserId':_0x228d32[_0x879b('0x63')]['id']},{'transaction':_0x340bec});}});});}})[_0x879b('0x22')](handleEntityNotFound(_0x316706,null))[_0x879b('0x22')](respondWithResult(_0x316706,null))[_0x879b('0x4f')](handleError(_0x316706,null));};exports[_0x879b('0x8b')]=function(_0x348ef8,_0xf8b728,_0x3797bd){return _0x348ef8['user'][_0x879b('0x73')]({'where':{'type':_0x879b('0x74'),'dialActive':!![],'dialMethod':_0x879b('0x75')},'attributes':['id'],'raw':!![]})['then'](function(_0x161a22){if(_0x161a22&&_0x161a22[_0x879b('0x42')]){return db[_0x879b('0x4b')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x879b('0x67'))},'VoiceQueueId':{'$in':_[_0x879b('0x27')](_0x161a22,'id')},'$or':[{'UserId':null},{'UserId':_0x348ef8[_0x879b('0x63')]['id']}]}});}return 0x0;})[_0x879b('0x22')](function(_0x5c495d){if(!_['isNil'](_0x5c495d)&&_['isNumber'](_0x5c495d)){return _0xf8b728['status'](0xc8)['json']({'contacts':_0x5c495d});}else{logger[_0x879b('0x23')](_0x879b('0x8c'),_0x879b('0x8b'),0x194,'entity\x20not\x20found');_0xf8b728[_0x879b('0x15')](0x194);}})[_0x879b('0x4f')](handleError(_0xf8b728,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 5617747..32618b6 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 _0x01d9=['define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports'];(function(_0x35c300,_0x284351){var _0x59e44b=function(_0x327e5c){while(--_0x327e5c){_0x35c300['push'](_0x35c300['shift']());}};_0x59e44b(++_0x284351);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var logger=require(_0x901d('0x2'))(_0x901d('0x3'));var moment=require('moment');var BPromise=require(_0x901d('0x4'));var rp=require(_0x901d('0x5'));var fs=require('fs');var path=require(_0x901d('0x6'));var rimraf=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var attributes=require(_0x901d('0x9'));module[_0x901d('0xa')]=function(_0x4e7842,_0x1e5d7d){return _0x4e7842[_0x901d('0xb')](_0x901d('0xc'),attributes,{'tableName':_0x901d('0xd'),'paranoid':![],'indexes':[{'name':_0x901d('0xe'),'fields':[_0x901d('0xe')]},{'name':_0x901d('0xf'),'fields':[_0x901d('0xf')]},{'name':_0x901d('0x10'),'fields':[_0x901d('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7c09=['scheduledat','phone','priority','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','define','CmHopper','cm_hopper'];(function(_0xb63d25,_0x43da39){var _0x348c21=function(_0x131e1f){while(--_0x131e1f){_0xb63d25['push'](_0xb63d25['shift']());}};_0x348c21(++_0x43da39);}(_0x7c09,0x102));var _0x97c0=function(_0x347e11,_0x251383){_0x347e11=_0x347e11-0x0;var _0x3028d3=_0x7c09[_0x347e11];return _0x3028d3;};'use strict';var _=require('lodash');var util=require(_0x97c0('0x0'));var logger=require(_0x97c0('0x1'))('api');var moment=require(_0x97c0('0x2'));var BPromise=require(_0x97c0('0x3'));var rp=require(_0x97c0('0x4'));var fs=require('fs');var path=require(_0x97c0('0x5'));var rimraf=require(_0x97c0('0x6'));var config=require(_0x97c0('0x7'));var attributes=require(_0x97c0('0x8'));module['exports']=function(_0x4b2f81,_0x590368){return _0x4b2f81[_0x97c0('0x9')](_0x97c0('0xa'),attributes,{'tableName':_0x97c0('0xb'),'paranoid':![],'indexes':[{'name':_0x97c0('0xc'),'fields':[_0x97c0('0xc')]},{'name':'phone','fields':[_0x97c0('0xd')]},{'name':'priority','fields':[_0x97c0('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 0bf2c34..20ec6d0 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 _0xe0cb=['attributes','include','map','model','debug','catch','ShowCmHopper','find','where','CreateCmHopper','body','UpdateCmHopper','update','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','limit','order','LOCK','UPDATE','keys','User','Agent','voicePause','UserId','includes','push','MoveContactManagedDialer','CmHopperFinal','create','CountReScheduled','findAll','COUNT','literal','format','\x22%s\x22','contactsRescheduled','GetContactRecallMe','length','all','GetCmHopperPreview','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopper,\x20%s,\x20%s','message','info','result','GetCmHopper','CmHopper','options','raw'];(function(_0x1ff3cb,_0x3c7f05){var _0x38a9a8=function(_0x2e5ade){while(--_0x2e5ade){_0x1ff3cb['push'](_0x1ff3cb['shift']());}};_0x38a9a8(++_0x3c7f05);}(_0xe0cb,0x144));var _0xbe0c=function(_0x4c05da,_0x414720){_0x4c05da=_0x4c05da-0x0;var _0x1614db=_0xe0cb[_0x4c05da];return _0x1614db;};'use strict';var _=require(_0xbe0c('0x0'));var util=require(_0xbe0c('0x1'));var moment=require(_0xbe0c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbe0c('0x3'));var db=require(_0xbe0c('0x4'))['db'];var utils=require(_0xbe0c('0x5'));var logger=require(_0xbe0c('0x6'))('rpc');var config=require(_0xbe0c('0x7'));var jayson=require(_0xbe0c('0x8'));var client=jayson[_0xbe0c('0x9')][_0xbe0c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19caad,_0x324c21,_0x3284ae){return new BPromise(function(_0x42c929,_0x39fa66){return client[_0xbe0c('0xb')](_0x19caad,_0x3284ae)[_0xbe0c('0xc')](function(_0x4645d2){logger['info']('CmHopper,\x20%s,\x20%s',_0x324c21,_0xbe0c('0xd'));logger['debug'](_0xbe0c('0xe'),_0x324c21,_0xbe0c('0xd'),JSON[_0xbe0c('0xf')](_0x4645d2));if(_0x4645d2[_0xbe0c('0x10')]){if(_0x4645d2[_0xbe0c('0x10')][_0xbe0c('0x11')]===0x1f4){logger['error'](_0xbe0c('0x12'),_0x324c21,_0x4645d2[_0xbe0c('0x10')]['message']);return _0x39fa66(_0x4645d2[_0xbe0c('0x10')][_0xbe0c('0x13')]);}logger[_0xbe0c('0x10')](_0xbe0c('0x12'),_0x324c21,_0x4645d2[_0xbe0c('0x10')]['message']);return _0x42c929(_0x4645d2[_0xbe0c('0x10')][_0xbe0c('0x13')]);}else{logger[_0xbe0c('0x14')]('CmHopper,\x20%s,\x20%s',_0x324c21,_0xbe0c('0xd'));_0x42c929(_0x4645d2[_0xbe0c('0x15')][_0xbe0c('0x13')]);}})['catch'](function(_0x2d659f){logger['error'](_0xbe0c('0x12'),_0x324c21,_0x2d659f);_0x39fa66(_0x2d659f);});});}exports[_0xbe0c('0x16')]=function(_0x3d0d5d){var _0x4caec9=this;return new Promise(function(_0x3b7590,_0x17bbd9){return db[_0xbe0c('0x17')]['findAll']({'raw':_0x3d0d5d[_0xbe0c('0x18')]?_0x3d0d5d[_0xbe0c('0x18')][_0xbe0c('0x19')]===undefined?!![]:![]:!![],'where':_0x3d0d5d[_0xbe0c('0x18')]?_0x3d0d5d[_0xbe0c('0x18')]['where']||null:null,'attributes':_0x3d0d5d[_0xbe0c('0x18')]?_0x3d0d5d[_0xbe0c('0x18')][_0xbe0c('0x1a')]||null:null,'limit':_0x3d0d5d[_0xbe0c('0x18')]?_0x3d0d5d['options']['limit']||null:null,'include':_0x3d0d5d[_0xbe0c('0x18')]?_0x3d0d5d['options'][_0xbe0c('0x1b')]?_[_0xbe0c('0x1c')](_0x3d0d5d['options'][_0xbe0c('0x1b')],function(_0x467997){return{'model':db[_0x467997['model']],'as':_0x467997['as'],'attributes':_0x467997[_0xbe0c('0x1a')],'include':_0x467997['include']?_[_0xbe0c('0x1c')](_0x467997[_0xbe0c('0x1b')],function(_0x430ab7){return{'model':db[_0x430ab7[_0xbe0c('0x1d')]],'as':_0x430ab7['as'],'attributes':_0x430ab7[_0xbe0c('0x1a')],'include':_0x430ab7[_0xbe0c('0x1b')]?_[_0xbe0c('0x1c')](_0x430ab7[_0xbe0c('0x1b')],function(_0x3735d4){return{'model':db[_0x3735d4['model']],'as':_0x3735d4['as'],'attributes':_0x3735d4[_0xbe0c('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x30fe5f){logger[_0xbe0c('0x14')](_0xbe0c('0x16'),_0x3d0d5d);logger[_0xbe0c('0x1e')]('GetCmHopper',_0x3d0d5d,JSON[_0xbe0c('0xf')](_0x30fe5f));_0x3b7590(_0x30fe5f);})[_0xbe0c('0x1f')](function(_0x1ce47a){logger[_0xbe0c('0x10')](_0xbe0c('0x16'),_0x1ce47a['message'],_0x3d0d5d);_0x17bbd9(_0x4caec9[_0xbe0c('0x10')](0x1f4,_0x1ce47a[_0xbe0c('0x13')]));});});};exports[_0xbe0c('0x20')]=function(_0x482430){var _0x7b4050=this;return new Promise(function(_0x43daad,_0x193b39){return db[_0xbe0c('0x17')][_0xbe0c('0x21')]({'raw':_0x482430[_0xbe0c('0x18')]?_0x482430[_0xbe0c('0x18')][_0xbe0c('0x19')]===undefined?!![]:![]:!![],'where':_0x482430[_0xbe0c('0x18')]?_0x482430[_0xbe0c('0x18')][_0xbe0c('0x22')]||null:null,'attributes':_0x482430[_0xbe0c('0x18')]?_0x482430[_0xbe0c('0x18')][_0xbe0c('0x1a')]||null:null,'include':_0x482430[_0xbe0c('0x18')]?_0x482430['options'][_0xbe0c('0x1b')]?_[_0xbe0c('0x1c')](_0x482430[_0xbe0c('0x18')][_0xbe0c('0x1b')],function(_0xbcfdcf){return{'model':db[_0xbcfdcf[_0xbe0c('0x1d')]],'as':_0xbcfdcf['as'],'attributes':_0xbcfdcf[_0xbe0c('0x1a')],'include':_0xbcfdcf['include']?_[_0xbe0c('0x1c')](_0xbcfdcf[_0xbe0c('0x1b')],function(_0x36724a){return{'model':db[_0x36724a['model']],'as':_0x36724a['as'],'attributes':_0x36724a[_0xbe0c('0x1a')],'include':_0x36724a[_0xbe0c('0x1b')]?_['map'](_0x36724a['include'],function(_0x36faee){return{'model':db[_0x36faee[_0xbe0c('0x1d')]],'as':_0x36faee['as'],'attributes':_0x36faee[_0xbe0c('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xbe0c('0xc')](function(_0x3b7bc2){logger['info']('ShowCmHopper',_0x482430);logger[_0xbe0c('0x1e')](_0xbe0c('0x20'),_0x482430,JSON[_0xbe0c('0xf')](_0x3b7bc2));_0x43daad(_0x3b7bc2);})[_0xbe0c('0x1f')](function(_0x28a8e2){logger[_0xbe0c('0x10')]('ShowCmHopper',_0x28a8e2['message'],_0x482430);_0x193b39(_0x7b4050[_0xbe0c('0x10')](0x1f4,_0x28a8e2[_0xbe0c('0x13')]));});});};exports[_0xbe0c('0x23')]=function(_0x4b023e){var _0x5aec03=this;return new Promise(function(_0x463771,_0x2d8c72){return db[_0xbe0c('0x17')]['create'](_0x4b023e[_0xbe0c('0x24')],{'raw':_0x4b023e[_0xbe0c('0x18')]?_0x4b023e['options'][_0xbe0c('0x19')]===undefined?!![]:![]:!![]})[_0xbe0c('0xc')](function(_0x2f2668){logger['info']('CreateCmHopper',_0x4b023e);logger[_0xbe0c('0x1e')](_0xbe0c('0x23'),_0x4b023e,JSON[_0xbe0c('0xf')](_0x2f2668));_0x463771(_0x2f2668);})[_0xbe0c('0x1f')](function(_0x581d3f){logger[_0xbe0c('0x10')]('CreateCmHopper',_0x581d3f[_0xbe0c('0x13')],_0x4b023e);_0x2d8c72(_0x5aec03[_0xbe0c('0x10')](0x1f4,_0x581d3f[_0xbe0c('0x13')]));});});};exports[_0xbe0c('0x25')]=function(_0xc94487){var _0x1cc329=this;return new Promise(function(_0x2dc670,_0x34d7e6){return db[_0xbe0c('0x17')][_0xbe0c('0x26')](_0xc94487[_0xbe0c('0x24')],{'raw':_0xc94487['options']?_0xc94487[_0xbe0c('0x18')][_0xbe0c('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc94487[_0xbe0c('0x18')]?_0xc94487[_0xbe0c('0x18')][_0xbe0c('0x22')]||null:null,'attributes':_0xc94487['options']?_0xc94487[_0xbe0c('0x18')][_0xbe0c('0x1a')]||null:null,'limit':_0xc94487[_0xbe0c('0x18')]?_0xc94487[_0xbe0c('0x18')]['limit']||null:null})[_0xbe0c('0xc')](function(_0x3d597d){logger[_0xbe0c('0x14')](_0xbe0c('0x25'),_0xc94487);logger[_0xbe0c('0x1e')](_0xbe0c('0x25'),_0xc94487,JSON[_0xbe0c('0xf')](_0x3d597d));_0x2dc670(_0x3d597d);})['catch'](function(_0x550453){logger[_0xbe0c('0x10')](_0xbe0c('0x25'),_0x550453[_0xbe0c('0x13')],_0xc94487);_0x34d7e6(_0x1cc329[_0xbe0c('0x10')](0x1f4,_0x550453[_0xbe0c('0x13')]));});});};exports[_0xbe0c('0x27')]=function(_0x19ef6d){var _0x4c0d83=this;return new Promise(function(_0x125854,_0x390740){return db[_0xbe0c('0x17')]['destroy']({'where':_0x19ef6d[_0xbe0c('0x18')]?_0x19ef6d[_0xbe0c('0x18')]['where']||null:null})[_0xbe0c('0xc')](function(_0x551a5e){logger[_0xbe0c('0x14')](_0xbe0c('0x27'),_0x19ef6d);logger[_0xbe0c('0x1e')](_0xbe0c('0x27'),_0x19ef6d,JSON['stringify'](_0x551a5e));_0x125854(_0x551a5e);})[_0xbe0c('0x1f')](function(_0x6cbee6){logger[_0xbe0c('0x10')](_0xbe0c('0x27'),_0x6cbee6[_0xbe0c('0x13')],_0x19ef6d);_0x390740(_0x4c0d83[_0xbe0c('0x10')](0x1f4,_0x6cbee6['message']));});});};exports[_0xbe0c('0x28')]=function(_0xaedccb){var _0x6c4bcc=this;return new Promise(function(_0x492864,_0x4ce612){return db[_0xbe0c('0x29')][_0xbe0c('0x2a')]()[_0xbe0c('0xc')](function(_0x2b14e9){return db[_0xbe0c('0x2b')][_0xbe0c('0x2c')](function(_0x28fa67){return db[_0xbe0c('0x17')]['findAll']({'where':_0xaedccb['options']?_0xaedccb[_0xbe0c('0x18')]['where']||null:null,'attributes':_0xaedccb[_0xbe0c('0x18')]?_0xaedccb[_0xbe0c('0x18')][_0xbe0c('0x1a')]||null:null,'limit':_0xaedccb[_0xbe0c('0x18')]?_0xaedccb[_0xbe0c('0x18')][_0xbe0c('0x2d')]||null:null,'order':_0xaedccb[_0xbe0c('0x18')]?_0xaedccb[_0xbe0c('0x18')][_0xbe0c('0x2e')]||null:null,'transaction':_0x28fa67,'lock':_0x28fa67[_0xbe0c('0x2f')][_0xbe0c('0x30')],'include':[{'model':db[_0xbe0c('0x29')],'as':'Contact','attributes':_[_0xbe0c('0x31')](_0x2b14e9)},{'model':db[_0xbe0c('0x32')],'as':_0xbe0c('0x33'),'attributes':['id','name',_0xbe0c('0x34')]}]})['then'](function(_0x2bf671){var _0x2dc4b5=[];var _0x2f10fe=[];for(var _0x7f9e6f=0x0;_0x7f9e6f<_0x2bf671['length'];_0x7f9e6f+=0x1){var _0x48504e=_0x2bf671[_0x7f9e6f][_0xbe0c('0x35')];if(_0x48504e===null){_0x2dc4b5['push'](_0x2bf671[_0x7f9e6f]['update'](_0xaedccb[_0xbe0c('0x24')],{'transaction':_0x28fa67}));}else if(!_0x2f10fe[_0xbe0c('0x36')](_0x48504e)){_0x2f10fe['push'](_0x48504e);_0x2dc4b5[_0xbe0c('0x37')](_0x2bf671[_0x7f9e6f]['update'](_0xaedccb[_0xbe0c('0x24')],{'transaction':_0x28fa67}));}}return BPromise['all'](_0x2dc4b5);});})[_0xbe0c('0xc')](function(_0x5c6768){logger[_0xbe0c('0x14')](_0xbe0c('0x28'),_0xaedccb);logger[_0xbe0c('0x1e')](_0xbe0c('0x28'),_0xaedccb,JSON['stringify'](_0x5c6768));_0x492864(_0x5c6768);})['catch'](function(_0x169d00){logger[_0xbe0c('0x10')]('GetContactDialer',_0x169d00[_0xbe0c('0x13')],_0xaedccb);_0x4ce612(_0x6c4bcc[_0xbe0c('0x10')](0x1f4,_0x169d00['message']));});});});};exports[_0xbe0c('0x38')]=function(_0x3205c8){var _0x537fed=this;return new Promise(function(_0x1a3fac,_0x545c44){return db[_0xbe0c('0x2b')][_0xbe0c('0x2c')](function(_0x297b30){return db[_0xbe0c('0x39')][_0xbe0c('0x3a')](_0x3205c8['body'],{'raw':_0x3205c8[_0xbe0c('0x18')]?_0x3205c8[_0xbe0c('0x18')]['raw']===undefined?!![]:![]:!![],'transaction':_0x297b30})[_0xbe0c('0xc')](function(){return db[_0xbe0c('0x17')]['destroy']({'where':_0x3205c8[_0xbe0c('0x18')]?_0x3205c8['options'][_0xbe0c('0x22')]||null:null,'transaction':_0x297b30});});})[_0xbe0c('0xc')](function(_0x30baf5){logger[_0xbe0c('0x14')](_0xbe0c('0x38'),_0x3205c8);logger[_0xbe0c('0x1e')]('MoveContactManagedDialer',_0x3205c8,JSON[_0xbe0c('0xf')](_0x30baf5));_0x1a3fac(_0x30baf5);})[_0xbe0c('0x1f')](function(_0x4832d2){logger[_0xbe0c('0x10')](_0xbe0c('0x38'),_0x4832d2[_0xbe0c('0x13')],_0x3205c8);_0x545c44(_0x537fed[_0xbe0c('0x10')](0x1f4,_0x4832d2['message']));});});};exports[_0xbe0c('0x3b')]=function(_0x2d5018){var _0x46eabd=this;return new Promise(function(_0x513e16,_0x539f73){return db[_0xbe0c('0x17')][_0xbe0c('0x3c')]({'raw':_0x2d5018[_0xbe0c('0x18')]?_0x2d5018[_0xbe0c('0x18')][_0xbe0c('0x19')]===undefined?!![]:![]:!![],'where':_0x2d5018[_0xbe0c('0x18')]?_0x2d5018[_0xbe0c('0x18')][_0xbe0c('0x22')]||null:null,'attributes':[[db[_0xbe0c('0x2b')]['fn'](_0xbe0c('0x3d'),db[_0xbe0c('0x2b')]['fn']('IF',db['sequelize'][_0xbe0c('0x3e')]('`scheduledat`\x20>=\x20'+util[_0xbe0c('0x3f')](_0xbe0c('0x40'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'))+'\x20,\x201,\x20null'))),_0xbe0c('0x41')]]})['then'](function(_0x16980f){logger['info']('CountReScheduled',_0x2d5018);logger[_0xbe0c('0x1e')](_0xbe0c('0x3b'),_0x2d5018,JSON['stringify'](_0x16980f));_0x513e16(_0x16980f);})['catch'](function(_0x2a8aba){logger[_0xbe0c('0x10')](_0xbe0c('0x3b'),_0x2a8aba[_0xbe0c('0x13')],_0x2d5018);_0x539f73(_0x46eabd[_0xbe0c('0x10')](0x1f4,_0x2a8aba[_0xbe0c('0x13')]));});});};exports[_0xbe0c('0x42')]=function(_0x8da604){var _0x163c7a=this;return new Promise(function(_0x3c60b6,_0x30de6a){return db[_0xbe0c('0x29')][_0xbe0c('0x2a')]()['then'](function(_0x4950af){return db[_0xbe0c('0x2b')][_0xbe0c('0x2c')](function(_0x1ad756){return db[_0xbe0c('0x17')][_0xbe0c('0x3c')]({'where':_0x8da604[_0xbe0c('0x18')]?_0x8da604['options'][_0xbe0c('0x22')]||null:null,'attributes':_0x8da604['options']?_0x8da604[_0xbe0c('0x18')][_0xbe0c('0x1a')]||null:null,'limit':0x1,'order':_0x8da604[_0xbe0c('0x18')]?_0x8da604[_0xbe0c('0x18')][_0xbe0c('0x2e')]||null:null,'group':db[_0xbe0c('0x17')][_0xbe0c('0x35')],'transaction':_0x1ad756,'lock':_0x1ad756[_0xbe0c('0x2f')][_0xbe0c('0x30')],'include':_0x8da604[_0xbe0c('0x18')]?_0x8da604[_0xbe0c('0x18')][_0xbe0c('0x1b')]?_['map'](_0x8da604[_0xbe0c('0x18')][_0xbe0c('0x1b')],function(_0x3efeff){return{'model':db[_0x3efeff['model']],'as':_0x3efeff['as'],'attributes':_0x3efeff[_0xbe0c('0x1a')],'include':_0x3efeff['include']?_[_0xbe0c('0x1c')](_0x3efeff[_0xbe0c('0x1b')],function(_0x34d4f8){return{'model':db[_0x34d4f8[_0xbe0c('0x1d')]],'as':_0x34d4f8['as'],'attributes':_0x34d4f8[_0xbe0c('0x1a')],'include':_0x34d4f8['include']?_[_0xbe0c('0x1c')](_0x34d4f8[_0xbe0c('0x1b')],function(_0x260e8c){return{'model':db[_0x260e8c[_0xbe0c('0x1d')]],'as':_0x260e8c['as'],'attributes':_0x260e8c[_0xbe0c('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xbe0c('0xc')](function(_0x53b98b){var _0x515856=[];for(var _0x175be2=0x0;_0x175be2<_0x53b98b[_0xbe0c('0x43')];_0x175be2+=0x1){_0x515856['push'](_0x53b98b[_0x175be2][_0xbe0c('0x26')](_0x8da604[_0xbe0c('0x24')],{'transaction':_0x1ad756}));}return BPromise[_0xbe0c('0x44')](_0x515856);});})[_0xbe0c('0xc')](function(_0x3a5441){logger[_0xbe0c('0x14')]('GetContactRecallMe',_0x8da604);logger[_0xbe0c('0x1e')](_0xbe0c('0x42'),_0x8da604,JSON[_0xbe0c('0xf')](_0x3a5441));_0x3c60b6(_0x3a5441);})[_0xbe0c('0x1f')](function(_0x507bfc){logger[_0xbe0c('0x10')](_0xbe0c('0x42'),_0x507bfc['message'],_0x8da604);_0x30de6a(_0x163c7a['error'](0x1f4,_0x507bfc[_0xbe0c('0x13')]));});});});};exports[_0xbe0c('0x45')]=function(_0x11cf17){var _0x228499=this;return new Promise(function(_0x1ff3d5,_0x18cb58){db[_0xbe0c('0x29')][_0xbe0c('0x2a')]()['then'](function(_0x3cb475){return db[_0xbe0c('0x17')][_0xbe0c('0x3c')]({'raw':_0x11cf17[_0xbe0c('0x18')]?_0x11cf17[_0xbe0c('0x18')][_0xbe0c('0x19')]===undefined?!![]:![]:!![],'where':_0x11cf17['options']?_0x11cf17[_0xbe0c('0x18')]['where']||null:null,'attributes':_0x11cf17[_0xbe0c('0x18')]?_0x11cf17[_0xbe0c('0x18')][_0xbe0c('0x1a')]||null:null,'limit':_0x11cf17['options']?_0x11cf17[_0xbe0c('0x18')][_0xbe0c('0x2d')]||null:null,'include':_0x11cf17[_0xbe0c('0x18')]?_0x11cf17[_0xbe0c('0x18')][_0xbe0c('0x1b')]?_[_0xbe0c('0x1c')](_0x11cf17['options'][_0xbe0c('0x1b')],function(_0x5904e5){return{'model':db[_0x5904e5['model']],'as':_0x5904e5['as'],'attributes':_0x5904e5['as']==='Contact'?_['keys'](_0x3cb475):_0x5904e5['attributes'],'include':_0x5904e5['include']?_[_0xbe0c('0x1c')](_0x5904e5[_0xbe0c('0x1b')],function(_0x396e33){return{'model':db[_0x396e33[_0xbe0c('0x1d')]],'as':_0x396e33['as'],'attributes':_0x396e33[_0xbe0c('0x1a')],'include':_0x396e33[_0xbe0c('0x1b')]?_[_0xbe0c('0x1c')](_0x396e33[_0xbe0c('0x1b')],function(_0x3d2a6b){return{'model':db[_0x3d2a6b[_0xbe0c('0x1d')]],'as':_0x3d2a6b['as'],'attributes':_0x3d2a6b['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe0c('0xc')](function(_0x582c9a){logger[_0xbe0c('0x14')](_0xbe0c('0x16'),_0x11cf17);logger['debug']('GetCmHopper',_0x11cf17,JSON[_0xbe0c('0xf')](_0x582c9a));_0x1ff3d5(_0x582c9a);})[_0xbe0c('0x1f')](function(_0x132b59){logger[_0xbe0c('0x10')](_0xbe0c('0x16'),_0x132b59[_0xbe0c('0x13')],_0x11cf17);_0x18cb58(_0x228499[_0xbe0c('0x10')](0x1f4,_0x132b59[_0xbe0c('0x13')]));});});});}; \ No newline at end of file +var _0x0b9b=['CmHopper','findAll','options','raw','where','limit','map','include','model','attributes','stringify','find','ShowCmHopper','create','body','CreateCmHopper','update','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','order','UPDATE','Contact','keys','User','name','length','push','all','MoveContactManagedDialer','CountReScheduled','COUNT','literal','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','UserId','GetCmHopperPreview','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','error','CmHopper,\x20%s,\x20%s','message','catch','GetCmHopper'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0x0b9b,0x13a));var _0xb0b9=function(_0x1a9c59,_0x23dd7e){_0x1a9c59=_0x1a9c59-0x0;var _0x2cdeb6=_0x0b9b[_0x1a9c59];return _0x2cdeb6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb0b9('0x0'));var BPromise=require('bluebird');var rs=require(_0xb0b9('0x1'));var fs=require('fs');var Redis=require(_0xb0b9('0x2'));var db=require(_0xb0b9('0x3'))['db'];var utils=require(_0xb0b9('0x4'));var logger=require(_0xb0b9('0x5'))(_0xb0b9('0x6'));var config=require(_0xb0b9('0x7'));var jayson=require(_0xb0b9('0x8'));var client=jayson[_0xb0b9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a3eb0,_0x3c0aff,_0x5e5567){return new BPromise(function(_0x38d13a,_0x29484e){return client[_0xb0b9('0xa')](_0x3a3eb0,_0x5e5567)[_0xb0b9('0xb')](function(_0x2a75e3){logger[_0xb0b9('0xc')]('CmHopper,\x20%s,\x20%s',_0x3c0aff,_0xb0b9('0xd'));logger[_0xb0b9('0xe')](_0xb0b9('0xf'),_0x3c0aff,_0xb0b9('0xd'),JSON['stringify'](_0x2a75e3));if(_0x2a75e3[_0xb0b9('0x10')]){if(_0x2a75e3[_0xb0b9('0x10')]['code']===0x1f4){logger[_0xb0b9('0x10')](_0xb0b9('0x11'),_0x3c0aff,_0x2a75e3['error'][_0xb0b9('0x12')]);return _0x29484e(_0x2a75e3['error']['message']);}logger[_0xb0b9('0x10')]('CmHopper,\x20%s,\x20%s',_0x3c0aff,_0x2a75e3[_0xb0b9('0x10')][_0xb0b9('0x12')]);return _0x38d13a(_0x2a75e3[_0xb0b9('0x10')][_0xb0b9('0x12')]);}else{logger[_0xb0b9('0xc')](_0xb0b9('0x11'),_0x3c0aff,'request\x20sent');_0x38d13a(_0x2a75e3['result'][_0xb0b9('0x12')]);}})[_0xb0b9('0x13')](function(_0x1c52df){logger['error'](_0xb0b9('0x11'),_0x3c0aff,_0x1c52df);_0x29484e(_0x1c52df);});});}exports[_0xb0b9('0x14')]=function(_0xcd9c1f){var _0xa180d2=this;return new Promise(function(_0x7325ef,_0x54eaec){return db[_0xb0b9('0x15')][_0xb0b9('0x16')]({'raw':_0xcd9c1f['options']?_0xcd9c1f[_0xb0b9('0x17')][_0xb0b9('0x18')]===undefined?!![]:![]:!![],'where':_0xcd9c1f[_0xb0b9('0x17')]?_0xcd9c1f['options'][_0xb0b9('0x19')]||null:null,'attributes':_0xcd9c1f[_0xb0b9('0x17')]?_0xcd9c1f[_0xb0b9('0x17')]['attributes']||null:null,'limit':_0xcd9c1f[_0xb0b9('0x17')]?_0xcd9c1f[_0xb0b9('0x17')][_0xb0b9('0x1a')]||null:null,'include':_0xcd9c1f[_0xb0b9('0x17')]?_0xcd9c1f[_0xb0b9('0x17')]['include']?_[_0xb0b9('0x1b')](_0xcd9c1f[_0xb0b9('0x17')][_0xb0b9('0x1c')],function(_0x26cfd6){return{'model':db[_0x26cfd6[_0xb0b9('0x1d')]],'as':_0x26cfd6['as'],'attributes':_0x26cfd6['attributes'],'include':_0x26cfd6['include']?_[_0xb0b9('0x1b')](_0x26cfd6[_0xb0b9('0x1c')],function(_0x409f08){return{'model':db[_0x409f08[_0xb0b9('0x1d')]],'as':_0x409f08['as'],'attributes':_0x409f08['attributes'],'include':_0x409f08[_0xb0b9('0x1c')]?_['map'](_0x409f08['include'],function(_0x12e4b8){return{'model':db[_0x12e4b8[_0xb0b9('0x1d')]],'as':_0x12e4b8['as'],'attributes':_0x12e4b8[_0xb0b9('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x35b286){logger[_0xb0b9('0xc')](_0xb0b9('0x14'),_0xcd9c1f);logger[_0xb0b9('0xe')](_0xb0b9('0x14'),_0xcd9c1f,JSON[_0xb0b9('0x1f')](_0x35b286));_0x7325ef(_0x35b286);})[_0xb0b9('0x13')](function(_0x4deb2c){logger[_0xb0b9('0x10')](_0xb0b9('0x14'),_0x4deb2c[_0xb0b9('0x12')],_0xcd9c1f);_0x54eaec(_0xa180d2[_0xb0b9('0x10')](0x1f4,_0x4deb2c['message']));});});};exports['ShowCmHopper']=function(_0x4f1547){var _0x1f32ca=this;return new Promise(function(_0x12bf81,_0xd11f52){return db[_0xb0b9('0x15')][_0xb0b9('0x20')]({'raw':_0x4f1547[_0xb0b9('0x17')]?_0x4f1547['options'][_0xb0b9('0x18')]===undefined?!![]:![]:!![],'where':_0x4f1547[_0xb0b9('0x17')]?_0x4f1547[_0xb0b9('0x17')]['where']||null:null,'attributes':_0x4f1547['options']?_0x4f1547[_0xb0b9('0x17')][_0xb0b9('0x1e')]||null:null,'include':_0x4f1547[_0xb0b9('0x17')]?_0x4f1547['options'][_0xb0b9('0x1c')]?_[_0xb0b9('0x1b')](_0x4f1547[_0xb0b9('0x17')]['include'],function(_0x110a3b){return{'model':db[_0x110a3b['model']],'as':_0x110a3b['as'],'attributes':_0x110a3b[_0xb0b9('0x1e')],'include':_0x110a3b['include']?_['map'](_0x110a3b['include'],function(_0x4d12a0){return{'model':db[_0x4d12a0[_0xb0b9('0x1d')]],'as':_0x4d12a0['as'],'attributes':_0x4d12a0[_0xb0b9('0x1e')],'include':_0x4d12a0['include']?_[_0xb0b9('0x1b')](_0x4d12a0[_0xb0b9('0x1c')],function(_0x25d2b3){return{'model':db[_0x25d2b3[_0xb0b9('0x1d')]],'as':_0x25d2b3['as'],'attributes':_0x25d2b3['attributes']};}):[]};}):[]};}):[]:[]})[_0xb0b9('0xb')](function(_0x5a94e3){logger[_0xb0b9('0xc')](_0xb0b9('0x21'),_0x4f1547);logger[_0xb0b9('0xe')](_0xb0b9('0x21'),_0x4f1547,JSON['stringify'](_0x5a94e3));_0x12bf81(_0x5a94e3);})['catch'](function(_0x460eef){logger['error']('ShowCmHopper',_0x460eef['message'],_0x4f1547);_0xd11f52(_0x1f32ca['error'](0x1f4,_0x460eef['message']));});});};exports['CreateCmHopper']=function(_0x346a6c){var _0x38802a=this;return new Promise(function(_0x3709fe,_0x37236c){return db[_0xb0b9('0x15')][_0xb0b9('0x22')](_0x346a6c[_0xb0b9('0x23')],{'raw':_0x346a6c['options']?_0x346a6c[_0xb0b9('0x17')][_0xb0b9('0x18')]===undefined?!![]:![]:!![]})[_0xb0b9('0xb')](function(_0x3637a3){logger[_0xb0b9('0xc')](_0xb0b9('0x24'),_0x346a6c);logger[_0xb0b9('0xe')](_0xb0b9('0x24'),_0x346a6c,JSON[_0xb0b9('0x1f')](_0x3637a3));_0x3709fe(_0x3637a3);})[_0xb0b9('0x13')](function(_0x4a33bb){logger[_0xb0b9('0x10')](_0xb0b9('0x24'),_0x4a33bb[_0xb0b9('0x12')],_0x346a6c);_0x37236c(_0x38802a[_0xb0b9('0x10')](0x1f4,_0x4a33bb['message']));});});};exports['UpdateCmHopper']=function(_0x31ff7c){var _0x51059f=this;return new Promise(function(_0x250f83,_0x268eb7){return db[_0xb0b9('0x15')][_0xb0b9('0x25')](_0x31ff7c['body'],{'raw':_0x31ff7c[_0xb0b9('0x17')]?_0x31ff7c[_0xb0b9('0x17')][_0xb0b9('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31ff7c[_0xb0b9('0x17')]?_0x31ff7c['options'][_0xb0b9('0x19')]||null:null,'attributes':_0x31ff7c[_0xb0b9('0x17')]?_0x31ff7c[_0xb0b9('0x17')][_0xb0b9('0x1e')]||null:null,'limit':_0x31ff7c[_0xb0b9('0x17')]?_0x31ff7c['options'][_0xb0b9('0x1a')]||null:null})[_0xb0b9('0xb')](function(_0x4b84c8){logger['info'](_0xb0b9('0x26'),_0x31ff7c);logger[_0xb0b9('0xe')](_0xb0b9('0x26'),_0x31ff7c,JSON['stringify'](_0x4b84c8));_0x250f83(_0x4b84c8);})[_0xb0b9('0x13')](function(_0x3764a1){logger['error'](_0xb0b9('0x26'),_0x3764a1[_0xb0b9('0x12')],_0x31ff7c);_0x268eb7(_0x51059f[_0xb0b9('0x10')](0x1f4,_0x3764a1['message']));});});};exports[_0xb0b9('0x27')]=function(_0x4d0ebb){var _0x3392cf=this;return new Promise(function(_0xf2bc26,_0xc7d83a){return db[_0xb0b9('0x15')][_0xb0b9('0x28')]({'where':_0x4d0ebb['options']?_0x4d0ebb[_0xb0b9('0x17')]['where']||null:null})['then'](function(_0x1ce23e){logger[_0xb0b9('0xc')](_0xb0b9('0x27'),_0x4d0ebb);logger[_0xb0b9('0xe')](_0xb0b9('0x27'),_0x4d0ebb,JSON[_0xb0b9('0x1f')](_0x1ce23e));_0xf2bc26(_0x1ce23e);})[_0xb0b9('0x13')](function(_0xbceb26){logger[_0xb0b9('0x10')](_0xb0b9('0x27'),_0xbceb26[_0xb0b9('0x12')],_0x4d0ebb);_0xc7d83a(_0x3392cf[_0xb0b9('0x10')](0x1f4,_0xbceb26[_0xb0b9('0x12')]));});});};exports[_0xb0b9('0x29')]=function(_0x5a613d){var _0x2cb79d=this;return new Promise(function(_0x5ddfb7,_0x3b3c26){return db[_0xb0b9('0x2a')][_0xb0b9('0x2b')]()[_0xb0b9('0xb')](function(_0x2c3464){return db[_0xb0b9('0x2c')][_0xb0b9('0x2d')](function(_0x1c6a42){return db[_0xb0b9('0x15')][_0xb0b9('0x16')]({'where':_0x5a613d[_0xb0b9('0x17')]?_0x5a613d[_0xb0b9('0x17')][_0xb0b9('0x19')]||null:null,'attributes':_0x5a613d[_0xb0b9('0x17')]?_0x5a613d['options'][_0xb0b9('0x1e')]||null:null,'limit':_0x5a613d[_0xb0b9('0x17')]?_0x5a613d[_0xb0b9('0x17')][_0xb0b9('0x1a')]||null:null,'order':_0x5a613d[_0xb0b9('0x17')]?_0x5a613d[_0xb0b9('0x17')][_0xb0b9('0x2e')]||null:null,'transaction':_0x1c6a42,'lock':_0x1c6a42['LOCK'][_0xb0b9('0x2f')],'include':[{'model':db[_0xb0b9('0x2a')],'as':_0xb0b9('0x30'),'attributes':_[_0xb0b9('0x31')](_0x2c3464)},{'model':db[_0xb0b9('0x32')],'as':'Agent','attributes':['id',_0xb0b9('0x33'),'voicePause']}]})[_0xb0b9('0xb')](function(_0xa80a56){var _0x582f2e=[];var _0x2b8582=[];for(var _0x3708d0=0x0;_0x3708d0<_0xa80a56[_0xb0b9('0x34')];_0x3708d0+=0x1){var _0x1759da=_0xa80a56[_0x3708d0]['UserId'];if(_0x1759da===null){_0x582f2e[_0xb0b9('0x35')](_0xa80a56[_0x3708d0][_0xb0b9('0x25')](_0x5a613d[_0xb0b9('0x23')],{'transaction':_0x1c6a42}));}else if(!_0x2b8582['includes'](_0x1759da)){_0x2b8582['push'](_0x1759da);_0x582f2e[_0xb0b9('0x35')](_0xa80a56[_0x3708d0][_0xb0b9('0x25')](_0x5a613d[_0xb0b9('0x23')],{'transaction':_0x1c6a42}));}}return BPromise[_0xb0b9('0x36')](_0x582f2e);});})['then'](function(_0x28df6d){logger[_0xb0b9('0xc')](_0xb0b9('0x29'),_0x5a613d);logger[_0xb0b9('0xe')](_0xb0b9('0x29'),_0x5a613d,JSON[_0xb0b9('0x1f')](_0x28df6d));_0x5ddfb7(_0x28df6d);})[_0xb0b9('0x13')](function(_0x89378d){logger[_0xb0b9('0x10')](_0xb0b9('0x29'),_0x89378d['message'],_0x5a613d);_0x3b3c26(_0x2cb79d[_0xb0b9('0x10')](0x1f4,_0x89378d[_0xb0b9('0x12')]));});});});};exports[_0xb0b9('0x37')]=function(_0x11e647){var _0x2edd29=this;return new Promise(function(_0x12ff29,_0xa53c37){return db['sequelize'][_0xb0b9('0x2d')](function(_0x55f305){return db['CmHopperFinal'][_0xb0b9('0x22')](_0x11e647[_0xb0b9('0x23')],{'raw':_0x11e647[_0xb0b9('0x17')]?_0x11e647['options'][_0xb0b9('0x18')]===undefined?!![]:![]:!![],'transaction':_0x55f305})['then'](function(){return db[_0xb0b9('0x15')][_0xb0b9('0x28')]({'where':_0x11e647[_0xb0b9('0x17')]?_0x11e647[_0xb0b9('0x17')]['where']||null:null,'transaction':_0x55f305});});})['then'](function(_0x31a6ff){logger[_0xb0b9('0xc')](_0xb0b9('0x37'),_0x11e647);logger['debug'](_0xb0b9('0x37'),_0x11e647,JSON[_0xb0b9('0x1f')](_0x31a6ff));_0x12ff29(_0x31a6ff);})[_0xb0b9('0x13')](function(_0x151c54){logger['error'](_0xb0b9('0x37'),_0x151c54[_0xb0b9('0x12')],_0x11e647);_0xa53c37(_0x2edd29[_0xb0b9('0x10')](0x1f4,_0x151c54[_0xb0b9('0x12')]));});});};exports[_0xb0b9('0x38')]=function(_0x4e1c1b){var _0x34ffd2=this;return new Promise(function(_0x5009c9,_0x3cfb5c){return db[_0xb0b9('0x15')][_0xb0b9('0x16')]({'raw':_0x4e1c1b[_0xb0b9('0x17')]?_0x4e1c1b['options'][_0xb0b9('0x18')]===undefined?!![]:![]:!![],'where':_0x4e1c1b[_0xb0b9('0x17')]?_0x4e1c1b[_0xb0b9('0x17')][_0xb0b9('0x19')]||null:null,'attributes':[[db[_0xb0b9('0x2c')]['fn'](_0xb0b9('0x39'),db[_0xb0b9('0x2c')]['fn']('IF',db[_0xb0b9('0x2c')][_0xb0b9('0x3a')]('`scheduledat`\x20>=\x20'+util[_0xb0b9('0x3b')](_0xb0b9('0x3c'),moment()['format'](_0xb0b9('0x3d')))+_0xb0b9('0x3e')))),_0xb0b9('0x3f')]]})[_0xb0b9('0xb')](function(_0x1db502){logger[_0xb0b9('0xc')](_0xb0b9('0x38'),_0x4e1c1b);logger[_0xb0b9('0xe')](_0xb0b9('0x38'),_0x4e1c1b,JSON[_0xb0b9('0x1f')](_0x1db502));_0x5009c9(_0x1db502);})[_0xb0b9('0x13')](function(_0x2f1433){logger['error'](_0xb0b9('0x38'),_0x2f1433[_0xb0b9('0x12')],_0x4e1c1b);_0x3cfb5c(_0x34ffd2[_0xb0b9('0x10')](0x1f4,_0x2f1433[_0xb0b9('0x12')]));});});};exports[_0xb0b9('0x40')]=function(_0x77052){var _0x1575ac=this;return new Promise(function(_0x2bce79,_0x5565f0){return db['CmContact'][_0xb0b9('0x2b')]()[_0xb0b9('0xb')](function(_0x193278){return db['sequelize'][_0xb0b9('0x2d')](function(_0x429213){return db['CmHopper'][_0xb0b9('0x16')]({'where':_0x77052[_0xb0b9('0x17')]?_0x77052[_0xb0b9('0x17')][_0xb0b9('0x19')]||null:null,'attributes':_0x77052[_0xb0b9('0x17')]?_0x77052[_0xb0b9('0x17')][_0xb0b9('0x1e')]||null:null,'limit':0x1,'order':_0x77052[_0xb0b9('0x17')]?_0x77052['options']['order']||null:null,'group':db[_0xb0b9('0x15')][_0xb0b9('0x41')],'transaction':_0x429213,'lock':_0x429213['LOCK']['UPDATE'],'include':_0x77052['options']?_0x77052[_0xb0b9('0x17')][_0xb0b9('0x1c')]?_[_0xb0b9('0x1b')](_0x77052[_0xb0b9('0x17')]['include'],function(_0x4e44b1){return{'model':db[_0x4e44b1['model']],'as':_0x4e44b1['as'],'attributes':_0x4e44b1[_0xb0b9('0x1e')],'include':_0x4e44b1[_0xb0b9('0x1c')]?_[_0xb0b9('0x1b')](_0x4e44b1[_0xb0b9('0x1c')],function(_0xde7d4d){return{'model':db[_0xde7d4d[_0xb0b9('0x1d')]],'as':_0xde7d4d['as'],'attributes':_0xde7d4d[_0xb0b9('0x1e')],'include':_0xde7d4d[_0xb0b9('0x1c')]?_[_0xb0b9('0x1b')](_0xde7d4d[_0xb0b9('0x1c')],function(_0x4b6a17){return{'model':db[_0x4b6a17[_0xb0b9('0x1d')]],'as':_0x4b6a17['as'],'attributes':_0x4b6a17[_0xb0b9('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xcf2637){var _0x1a6e60=[];for(var _0x4db830=0x0;_0x4db830<_0xcf2637[_0xb0b9('0x34')];_0x4db830+=0x1){_0x1a6e60[_0xb0b9('0x35')](_0xcf2637[_0x4db830][_0xb0b9('0x25')](_0x77052[_0xb0b9('0x23')],{'transaction':_0x429213}));}return BPromise[_0xb0b9('0x36')](_0x1a6e60);});})[_0xb0b9('0xb')](function(_0x8cdf48){logger[_0xb0b9('0xc')](_0xb0b9('0x40'),_0x77052);logger[_0xb0b9('0xe')]('GetContactRecallMe',_0x77052,JSON['stringify'](_0x8cdf48));_0x2bce79(_0x8cdf48);})[_0xb0b9('0x13')](function(_0x366823){logger[_0xb0b9('0x10')](_0xb0b9('0x40'),_0x366823['message'],_0x77052);_0x5565f0(_0x1575ac[_0xb0b9('0x10')](0x1f4,_0x366823[_0xb0b9('0x12')]));});});});};exports[_0xb0b9('0x42')]=function(_0x42086d){var _0x356a59=this;return new Promise(function(_0x3a2c08,_0x2d35a1){db[_0xb0b9('0x2a')][_0xb0b9('0x2b')]()[_0xb0b9('0xb')](function(_0x49aa05){return db['CmHopper'][_0xb0b9('0x16')]({'raw':_0x42086d[_0xb0b9('0x17')]?_0x42086d[_0xb0b9('0x17')][_0xb0b9('0x18')]===undefined?!![]:![]:!![],'where':_0x42086d[_0xb0b9('0x17')]?_0x42086d[_0xb0b9('0x17')]['where']||null:null,'attributes':_0x42086d[_0xb0b9('0x17')]?_0x42086d[_0xb0b9('0x17')][_0xb0b9('0x1e')]||null:null,'limit':_0x42086d[_0xb0b9('0x17')]?_0x42086d['options'][_0xb0b9('0x1a')]||null:null,'include':_0x42086d[_0xb0b9('0x17')]?_0x42086d[_0xb0b9('0x17')][_0xb0b9('0x1c')]?_[_0xb0b9('0x1b')](_0x42086d[_0xb0b9('0x17')][_0xb0b9('0x1c')],function(_0x241b92){return{'model':db[_0x241b92['model']],'as':_0x241b92['as'],'attributes':_0x241b92['as']===_0xb0b9('0x30')?_['keys'](_0x49aa05):_0x241b92[_0xb0b9('0x1e')],'include':_0x241b92[_0xb0b9('0x1c')]?_[_0xb0b9('0x1b')](_0x241b92[_0xb0b9('0x1c')],function(_0x5ab622){return{'model':db[_0x5ab622[_0xb0b9('0x1d')]],'as':_0x5ab622['as'],'attributes':_0x5ab622[_0xb0b9('0x1e')],'include':_0x5ab622[_0xb0b9('0x1c')]?_[_0xb0b9('0x1b')](_0x5ab622['include'],function(_0x2693a7){return{'model':db[_0x2693a7['model']],'as':_0x2693a7['as'],'attributes':_0x2693a7['attributes']};}):[]};}):[]};}):[]:[]})[_0xb0b9('0xb')](function(_0x3df7a0){logger['info']('GetCmHopper',_0x42086d);logger[_0xb0b9('0xe')]('GetCmHopper',_0x42086d,JSON[_0xb0b9('0x1f')](_0x3df7a0));_0x3a2c08(_0x3df7a0);})[_0xb0b9('0x13')](function(_0x11065e){logger['error']('GetCmHopper',_0x11065e[_0xb0b9('0x12')],_0x42086d);_0x2d35a1(_0x356a59[_0xb0b9('0x10')](0x1f4,_0x11065e[_0xb0b9('0x12')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index d1fbe5e..1f78ca3 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 _0x4a7b=['../../components/auth/service','../../components/interaction/service','../../config/environment','index','/describe','isAuthenticated','describe','get','/opencontacts','/:id','show','post','create','/preview','getPreview','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4a7b,0x1a3));var _0xb4a7=function(_0x11eb5c,_0x3b5438){_0x11eb5c=_0x11eb5c-0x0;var _0x2304e3=_0x4a7b[_0x11eb5c];return _0x2304e3;};'use strict';var multer=require(_0xb4a7('0x0'));var util=require(_0xb4a7('0x1'));var path=require('path');var timeout=require(_0xb4a7('0x2'));var express=require(_0xb4a7('0x3'));var router=express[_0xb4a7('0x4')]();var fs_extra=require(_0xb4a7('0x5'));var auth=require(_0xb4a7('0x6'));var interaction=require(_0xb4a7('0x7'));var config=require(_0xb4a7('0x8'));var controller=require('./cmHopper.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xb4a7('0x9')]);router['get'](_0xb4a7('0xa'),auth[_0xb4a7('0xb')](),controller[_0xb4a7('0xc')]);router[_0xb4a7('0xd')](_0xb4a7('0xe'),auth['isAuthenticated'](),controller['getOpenContacts']);router[_0xb4a7('0xd')](_0xb4a7('0xf'),auth['isAuthenticated'](),controller[_0xb4a7('0x10')]);router[_0xb4a7('0x11')]('/',auth[_0xb4a7('0xb')](),controller[_0xb4a7('0x12')]);router[_0xb4a7('0x11')](_0xb4a7('0x13'),auth[_0xb4a7('0xb')](),controller[_0xb4a7('0x14')]);router[_0xb4a7('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xb4a7('0x16')]);router[_0xb4a7('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xb4a7('0x18')]);module['exports']=router; \ No newline at end of file +var _0x9cb7=['index','get','describe','/opencontacts','getOpenContacts','/:id','create','post','/preview','getPreview','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','isAuthenticated'];(function(_0x10e84c,_0x59f32d){var _0x1f16c9=function(_0x360941){while(--_0x360941){_0x10e84c['push'](_0x10e84c['shift']());}};_0x1f16c9(++_0x59f32d);}(_0x9cb7,0xbc));var _0x79cb=function(_0x138141,_0x5a2a2b){_0x138141=_0x138141-0x0;var _0x5a6f06=_0x9cb7[_0x138141];return _0x5a6f06;};'use strict';var multer=require(_0x79cb('0x0'));var util=require(_0x79cb('0x1'));var path=require(_0x79cb('0x2'));var timeout=require(_0x79cb('0x3'));var express=require(_0x79cb('0x4'));var router=express[_0x79cb('0x5')]();var fs_extra=require(_0x79cb('0x6'));var auth=require(_0x79cb('0x7'));var interaction=require(_0x79cb('0x8'));var config=require(_0x79cb('0x9'));var controller=require(_0x79cb('0xa'));router['get']('/',auth[_0x79cb('0xb')](),controller[_0x79cb('0xc')]);router[_0x79cb('0xd')]('/describe',auth[_0x79cb('0xb')](),controller[_0x79cb('0xe')]);router[_0x79cb('0xd')](_0x79cb('0xf'),auth[_0x79cb('0xb')](),controller[_0x79cb('0x10')]);router[_0x79cb('0xd')](_0x79cb('0x11'),auth[_0x79cb('0xb')](),controller['show']);router['post']('/',auth[_0x79cb('0xb')](),controller[_0x79cb('0x12')]);router[_0x79cb('0x13')](_0x79cb('0x14'),auth[_0x79cb('0xb')](),controller[_0x79cb('0x15')]);router[_0x79cb('0x16')]('/:id',auth[_0x79cb('0xb')](),controller['update']);router[_0x79cb('0x17')](_0x79cb('0x11'),auth[_0x79cb('0xb')](),controller['destroy']);module[_0x79cb('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 3bbc91f..b5b35f4 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 _0x15c5=['moment','INTEGER','contactListQueue'];(function(_0x2b12c2,_0x1a89ae){var _0x5d5163=function(_0x5df0a5){while(--_0x5df0a5){_0x2b12c2['push'](_0x2b12c2['shift']());}};_0x5d5163(++_0x1a89ae);}(_0x15c5,0x192));var _0x515c=function(_0x559a80,_0x3d193d){_0x559a80=_0x559a80-0x0;var _0x42f555=_0x15c5[_0x559a80];return _0x42f555;};'use strict';var moment=require(_0x515c('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x515c('0x1')],'unique':_0x515c('0x2')},'ListId':{'type':Sequelize[_0x515c('0x1')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'}}; \ No newline at end of file +var _0xbd3c=['sequelize','exports','INTEGER','contactListQueue','moment'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0xbd3c,0xc2));var _0xcbd3=function(_0x57a7e7,_0xdd2dd3){_0x57a7e7=_0x57a7e7-0x0;var _0x308ccf=_0xbd3c[_0x57a7e7];return _0x308ccf;};'use strict';var moment=require(_0xcbd3('0x0'));var Sequelize=require(_0xcbd3('0x1'));module[_0xcbd3('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xcbd3('0x3')],'unique':_0xcbd3('0x4')},'ListId':{'type':Sequelize[_0xcbd3('0x3')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xcbd3('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index a6443c5..3d21e0a 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 _0xdd79=['destroy','sendStatus','stack','name','send','index','CmHopperBlack','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then'];(function(_0x1a7550,_0x1edace){var _0x426e22=function(_0x1c10a1){while(--_0x1c10a1){_0x1a7550['push'](_0x1a7550['shift']());}};_0x426e22(++_0x1edace);}(_0xdd79,0x10f));var _0x9dd7=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xdd79[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x9dd7('0x0'));var rimraf=require(_0x9dd7('0x1'));var zipdir=require(_0x9dd7('0x2'));var jsonpatch=require(_0x9dd7('0x3'));var rp=require(_0x9dd7('0x4'));var moment=require(_0x9dd7('0x5'));var BPromise=require(_0x9dd7('0x6'));var Mustache=require('mustache');var util=require(_0x9dd7('0x7'));var path=require(_0x9dd7('0x8'));var sox=require(_0x9dd7('0x9'));var csv=require(_0x9dd7('0xa'));var ejs=require(_0x9dd7('0xb'));var fs=require('fs');var fs_extra=require(_0x9dd7('0xc'));var _=require(_0x9dd7('0xd'));var squel=require('squel');var crypto=require(_0x9dd7('0xe'));var jsforce=require(_0x9dd7('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x9dd7('0xa'));var querystring=require(_0x9dd7('0x10'));var Papa=require(_0x9dd7('0x11'));var Redis=require(_0x9dd7('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9dd7('0x13'));var as=require(_0x9dd7('0x14'));var hardwareService=require(_0x9dd7('0x15'));var logger=require(_0x9dd7('0x16'))(_0x9dd7('0x17'));var utils=require(_0x9dd7('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x9dd7('0x19'));var db=require(_0x9dd7('0x1a'))['db'];function respondWithStatusCode(_0x4b17d5,_0x22200d){_0x22200d=_0x22200d||0xcc;return function(_0xed9042){if(_0xed9042){return _0x4b17d5['sendStatus'](_0x22200d);}return _0x4b17d5[_0x9dd7('0x1b')](_0x22200d)[_0x9dd7('0x1c')]();};}function respondWithResult(_0x3ecc73,_0x33e434){_0x33e434=_0x33e434||0xc8;return function(_0x5d184c){if(_0x5d184c){return _0x3ecc73[_0x9dd7('0x1b')](_0x33e434)[_0x9dd7('0x1d')](_0x5d184c);}};}function respondWithFilteredResult(_0x4e0e32,_0x58ce68){return function(_0x15fe9d){if(_0x15fe9d){var _0x1562e5=typeof _0x58ce68['offset']===_0x9dd7('0x1e')&&typeof _0x58ce68[_0x9dd7('0x1f')]===_0x9dd7('0x1e');var _0x2e8027=_0x15fe9d[_0x9dd7('0x20')];var _0x488225=_0x1562e5?0x0:_0x58ce68[_0x9dd7('0x21')];var _0x23c587=_0x1562e5?_0x15fe9d[_0x9dd7('0x20')]:_0x58ce68[_0x9dd7('0x21')]+_0x58ce68[_0x9dd7('0x1f')];var _0x4bcc98;if(_0x23c587>=_0x2e8027){_0x23c587=_0x2e8027;_0x4bcc98=0xc8;}else{_0x4bcc98=0xce;}_0x4e0e32[_0x9dd7('0x1b')](_0x4bcc98);return _0x4e0e32[_0x9dd7('0x22')](_0x9dd7('0x23'),_0x488225+'-'+_0x23c587+'/'+_0x2e8027)[_0x9dd7('0x1d')](_0x15fe9d);}return null;};}function patchUpdates(_0x30961e){return function(_0x497394){try{jsonpatch[_0x9dd7('0x24')](_0x497394,_0x30961e,!![]);}catch(_0x22f984){return BPromise[_0x9dd7('0x25')](_0x22f984);}return _0x497394[_0x9dd7('0x26')]();};}function saveUpdates(_0x8a8d09,_0x164342){return function(_0x1ded6b){if(_0x1ded6b){return _0x1ded6b[_0x9dd7('0x27')](_0x8a8d09)[_0x9dd7('0x28')](function(_0x1769c9){return _0x1769c9;});}return null;};}function removeEntity(_0x2ddf5a,_0x436a0f){return function(_0x527a8b){if(_0x527a8b){return _0x527a8b[_0x9dd7('0x29')]()[_0x9dd7('0x28')](function(){_0x2ddf5a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x356e6a,_0x44ab78){return function(_0x484a2a){if(!_0x484a2a){_0x356e6a[_0x9dd7('0x2a')](0x194);}return _0x484a2a;};}function handleError(_0x1ba10c,_0x2d602d){_0x2d602d=_0x2d602d||0x1f4;return function(_0x10d85a){logger['error'](_0x10d85a[_0x9dd7('0x2b')]);if(_0x10d85a[_0x9dd7('0x2c')]){delete _0x10d85a[_0x9dd7('0x2c')];}_0x1ba10c[_0x9dd7('0x1b')](_0x2d602d)[_0x9dd7('0x2d')](_0x10d85a);};}exports[_0x9dd7('0x2e')]=function(_0x2369b1,_0x1e3cee){var _0xc79657={},_0x116f98={},_0x4ad018={'count':0x0,'rows':[]};var _0x11a7b3=_['map'](db[_0x9dd7('0x2f')][_0x9dd7('0x30')],function(_0x22de17){return{'name':_0x22de17[_0x9dd7('0x31')],'type':_0x22de17[_0x9dd7('0x32')]['key']};});_0x116f98[_0x9dd7('0x33')]=_[_0x9dd7('0x34')](_0x11a7b3,_0x9dd7('0x2c'));_0x116f98[_0x9dd7('0x35')]=_[_0x9dd7('0x36')](_0x2369b1['query']);_0x116f98[_0x9dd7('0x37')]=_[_0x9dd7('0x38')](_0x116f98[_0x9dd7('0x33')],_0x116f98[_0x9dd7('0x35')]);_0xc79657['attributes']=_['intersection'](_0x116f98[_0x9dd7('0x33')],qs['fields'](_0x2369b1[_0x9dd7('0x35')][_0x9dd7('0x39')]));_0xc79657[_0x9dd7('0x3a')]=_0xc79657[_0x9dd7('0x3a')][_0x9dd7('0x3b')]?_0xc79657['attributes']:_0x116f98[_0x9dd7('0x33')];if(!_0x2369b1[_0x9dd7('0x35')][_0x9dd7('0x3c')](_0x9dd7('0x3d'))){_0xc79657[_0x9dd7('0x1f')]=qs[_0x9dd7('0x1f')](_0x2369b1['query'][_0x9dd7('0x1f')]);_0xc79657[_0x9dd7('0x21')]=qs[_0x9dd7('0x21')](_0x2369b1[_0x9dd7('0x35')][_0x9dd7('0x21')]);}_0xc79657[_0x9dd7('0x3e')]=qs[_0x9dd7('0x3f')](_0x2369b1[_0x9dd7('0x35')][_0x9dd7('0x3f')]);_0xc79657[_0x9dd7('0x40')]=qs['filters'](_['pick'](_0x2369b1[_0x9dd7('0x35')],_0x116f98['filters']),_0x11a7b3);if(_0x2369b1[_0x9dd7('0x35')][_0x9dd7('0x41')]){_0xc79657['where']=_[_0x9dd7('0x42')](_0xc79657['where'],{'$or':_[_0x9dd7('0x34')](_0x11a7b3,function(_0x4194eb){if(_0x4194eb['type']!==_0x9dd7('0x43')){var _0x23bf69={};_0x23bf69[_0x4194eb['name']]={'$like':'%'+_0x2369b1[_0x9dd7('0x35')][_0x9dd7('0x41')]+'%'};return _0x23bf69;}})});}_0xc79657=_['merge']({},_0xc79657,_0x2369b1[_0x9dd7('0x44')]);var _0x2fb8bc={'where':_0xc79657['where']};return db[_0x9dd7('0x2f')]['count'](_0x2fb8bc)[_0x9dd7('0x28')](function(_0x2f4596){_0x4ad018[_0x9dd7('0x20')]=_0x2f4596;if(_0x2369b1[_0x9dd7('0x35')][_0x9dd7('0x45')]){_0xc79657[_0x9dd7('0x46')]=[{'all':!![]}];}return db[_0x9dd7('0x2f')][_0x9dd7('0x47')](_0xc79657);})['then'](function(_0x515948){_0x4ad018['rows']=_0x515948;return _0x4ad018;})[_0x9dd7('0x28')](respondWithFilteredResult(_0x1e3cee,_0xc79657))[_0x9dd7('0x48')](handleError(_0x1e3cee,null));};exports[_0x9dd7('0x49')]=function(_0x27bc9b,_0xbefa88){var _0xc19086={'raw':!![],'where':{'id':_0x27bc9b[_0x9dd7('0x4a')]['id']}},_0x3ee9b2={};_0x3ee9b2['model']=_['keys'](db[_0x9dd7('0x2f')][_0x9dd7('0x30')]);_0x3ee9b2[_0x9dd7('0x35')]=_[_0x9dd7('0x36')](_0x27bc9b['query']);_0x3ee9b2[_0x9dd7('0x37')]=_[_0x9dd7('0x38')](_0x3ee9b2[_0x9dd7('0x33')],_0x3ee9b2['query']);_0xc19086[_0x9dd7('0x3a')]=_[_0x9dd7('0x38')](_0x3ee9b2[_0x9dd7('0x33')],qs[_0x9dd7('0x39')](_0x27bc9b[_0x9dd7('0x35')][_0x9dd7('0x39')]));_0xc19086[_0x9dd7('0x3a')]=_0xc19086['attributes'][_0x9dd7('0x3b')]?_0xc19086[_0x9dd7('0x3a')]:_0x3ee9b2[_0x9dd7('0x33')];if(_0x27bc9b[_0x9dd7('0x35')][_0x9dd7('0x45')]){_0xc19086['include']=[{'all':!![]}];}_0xc19086=_[_0x9dd7('0x42')]({},_0xc19086,_0x27bc9b['options']);return db[_0x9dd7('0x2f')][_0x9dd7('0x4b')](_0xc19086)[_0x9dd7('0x28')](handleEntityNotFound(_0xbefa88,null))['then'](respondWithResult(_0xbefa88,null))[_0x9dd7('0x48')](handleError(_0xbefa88,null));};exports[_0x9dd7('0x27')]=function(_0x56c997,_0x34ca6f){if(_0x56c997[_0x9dd7('0x4c')]['id']){delete _0x56c997[_0x9dd7('0x4c')]['id'];}return db[_0x9dd7('0x2f')][_0x9dd7('0x4b')]({'where':{'id':_0x56c997['params']['id']}})['then'](handleEntityNotFound(_0x34ca6f,null))[_0x9dd7('0x28')](saveUpdates(_0x56c997[_0x9dd7('0x4c')],null))[_0x9dd7('0x28')](respondWithResult(_0x34ca6f,null))['catch'](handleError(_0x34ca6f,null));};exports['destroy']=function(_0x2500da,_0x9e8077){return db[_0x9dd7('0x2f')][_0x9dd7('0x4b')]({'where':{'id':_0x2500da[_0x9dd7('0x4a')]['id']}})[_0x9dd7('0x28')](handleEntityNotFound(_0x9e8077,null))[_0x9dd7('0x28')](removeEntity(_0x9e8077,null))[_0x9dd7('0x48')](handleError(_0x9e8077,null));};exports[_0x9dd7('0x4d')]=function(_0x43e325,_0x190c1c){return db[_0x9dd7('0x2f')][_0x9dd7('0x4d')]()[_0x9dd7('0x28')](respondWithResult(_0x190c1c,null))[_0x9dd7('0x48')](handleError(_0x190c1c,null));}; \ No newline at end of file +var _0x3155=['name','index','map','CmHopperBlack','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','stack'];(function(_0x5c7661,_0x14f937){var _0x4ee887=function(_0xb6af3e){while(--_0xb6af3e){_0x5c7661['push'](_0x5c7661['shift']());}};_0x4ee887(++_0x14f937);}(_0x3155,0xf6));var _0x5315=function(_0x1652b7,_0xcd7dd5){_0x1652b7=_0x1652b7-0x0;var _0x54632e=_0x3155[_0x1652b7];return _0x54632e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5315('0x0'));var zipdir=require(_0x5315('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5315('0x2'));var moment=require(_0x5315('0x3'));var BPromise=require(_0x5315('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5315('0x5'));var sox=require(_0x5315('0x6'));var csv=require(_0x5315('0x7'));var ejs=require(_0x5315('0x8'));var fs=require('fs');var fs_extra=require(_0x5315('0x9'));var _=require(_0x5315('0xa'));var squel=require('squel');var crypto=require(_0x5315('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5315('0xc'));var toCsv=require(_0x5315('0x7'));var querystring=require('querystring');var Papa=require(_0x5315('0xd'));var Redis=require(_0x5315('0xe'));var authService=require(_0x5315('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5315('0x10'));var logger=require(_0x5315('0x11'))(_0x5315('0x12'));var utils=require(_0x5315('0x13'));var config=require(_0x5315('0x14'));var licenseUtil=require(_0x5315('0x15'));var db=require(_0x5315('0x16'))['db'];function respondWithStatusCode(_0xe0bd61,_0x458577){_0x458577=_0x458577||0xcc;return function(_0x5a3665){if(_0x5a3665){return _0xe0bd61[_0x5315('0x17')](_0x458577);}return _0xe0bd61[_0x5315('0x18')](_0x458577)[_0x5315('0x19')]();};}function respondWithResult(_0x15b977,_0x1160a9){_0x1160a9=_0x1160a9||0xc8;return function(_0x50a49f){if(_0x50a49f){return _0x15b977[_0x5315('0x18')](_0x1160a9)[_0x5315('0x1a')](_0x50a49f);}};}function respondWithFilteredResult(_0x39d4b3,_0xb73b1c){return function(_0xdde988){if(_0xdde988){var _0x4d8015=typeof _0xb73b1c[_0x5315('0x1b')]===_0x5315('0x1c')&&typeof _0xb73b1c[_0x5315('0x1d')]===_0x5315('0x1c');var _0x4fa6ca=_0xdde988[_0x5315('0x1e')];var _0x5a990e=_0x4d8015?0x0:_0xb73b1c[_0x5315('0x1b')];var _0x815986=_0x4d8015?_0xdde988[_0x5315('0x1e')]:_0xb73b1c[_0x5315('0x1b')]+_0xb73b1c['limit'];var _0x5dcf4b;if(_0x815986>=_0x4fa6ca){_0x815986=_0x4fa6ca;_0x5dcf4b=0xc8;}else{_0x5dcf4b=0xce;}_0x39d4b3['status'](_0x5dcf4b);return _0x39d4b3['set'](_0x5315('0x1f'),_0x5a990e+'-'+_0x815986+'/'+_0x4fa6ca)['json'](_0xdde988);}return null;};}function patchUpdates(_0x4380d0){return function(_0x50965b){try{jsonpatch[_0x5315('0x20')](_0x50965b,_0x4380d0,!![]);}catch(_0x40248f){return BPromise[_0x5315('0x21')](_0x40248f);}return _0x50965b['save']();};}function saveUpdates(_0x4b8699,_0x20ef52){return function(_0x3a6793){if(_0x3a6793){return _0x3a6793[_0x5315('0x22')](_0x4b8699)[_0x5315('0x23')](function(_0x5a571a){return _0x5a571a;});}return null;};}function removeEntity(_0x392989,_0x3236e1){return function(_0x5e3e2a){if(_0x5e3e2a){return _0x5e3e2a[_0x5315('0x24')]()[_0x5315('0x23')](function(){_0x392989[_0x5315('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x129c89,_0x4aaba3){return function(_0x36fa7d){if(!_0x36fa7d){_0x129c89['sendStatus'](0x194);}return _0x36fa7d;};}function handleError(_0x25f997,_0x520d54){_0x520d54=_0x520d54||0x1f4;return function(_0x487ccd){logger['error'](_0x487ccd[_0x5315('0x25')]);if(_0x487ccd[_0x5315('0x26')]){delete _0x487ccd[_0x5315('0x26')];}_0x25f997['status'](_0x520d54)['send'](_0x487ccd);};}exports[_0x5315('0x27')]=function(_0x1502fc,_0x5b0085){var _0x29c065={},_0x340bb3={},_0xf24d22={'count':0x0,'rows':[]};var _0x5de6dc=_[_0x5315('0x28')](db[_0x5315('0x29')][_0x5315('0x2a')],function(_0x5d6f66){return{'name':_0x5d6f66['fieldName'],'type':_0x5d6f66[_0x5315('0x2b')][_0x5315('0x2c')]};});_0x340bb3['model']=_[_0x5315('0x28')](_0x5de6dc,_0x5315('0x26'));_0x340bb3[_0x5315('0x2d')]=_[_0x5315('0x2e')](_0x1502fc[_0x5315('0x2d')]);_0x340bb3['filters']=_[_0x5315('0x2f')](_0x340bb3[_0x5315('0x30')],_0x340bb3[_0x5315('0x2d')]);_0x29c065[_0x5315('0x31')]=_[_0x5315('0x2f')](_0x340bb3[_0x5315('0x30')],qs[_0x5315('0x32')](_0x1502fc[_0x5315('0x2d')][_0x5315('0x32')]));_0x29c065[_0x5315('0x31')]=_0x29c065['attributes']['length']?_0x29c065['attributes']:_0x340bb3[_0x5315('0x30')];if(!_0x1502fc[_0x5315('0x2d')][_0x5315('0x33')](_0x5315('0x34'))){_0x29c065[_0x5315('0x1d')]=qs['limit'](_0x1502fc['query'][_0x5315('0x1d')]);_0x29c065[_0x5315('0x1b')]=qs[_0x5315('0x1b')](_0x1502fc[_0x5315('0x2d')]['offset']);}_0x29c065['order']=qs[_0x5315('0x35')](_0x1502fc['query']['sort']);_0x29c065[_0x5315('0x36')]=qs[_0x5315('0x37')](_[_0x5315('0x38')](_0x1502fc['query'],_0x340bb3[_0x5315('0x37')]),_0x5de6dc);if(_0x1502fc[_0x5315('0x2d')]['filter']){_0x29c065[_0x5315('0x36')]=_['merge'](_0x29c065[_0x5315('0x36')],{'$or':_['map'](_0x5de6dc,function(_0x28df39){if(_0x28df39['type']!=='VIRTUAL'){var _0x1465ee={};_0x1465ee[_0x28df39[_0x5315('0x26')]]={'$like':'%'+_0x1502fc[_0x5315('0x2d')][_0x5315('0x39')]+'%'};return _0x1465ee;}})});}_0x29c065=_[_0x5315('0x3a')]({},_0x29c065,_0x1502fc[_0x5315('0x3b')]);var _0x59bb66={'where':_0x29c065[_0x5315('0x36')]};return db[_0x5315('0x29')][_0x5315('0x1e')](_0x59bb66)[_0x5315('0x23')](function(_0x4a0111){_0xf24d22['count']=_0x4a0111;if(_0x1502fc['query'][_0x5315('0x3c')]){_0x29c065[_0x5315('0x3d')]=[{'all':!![]}];}return db[_0x5315('0x29')][_0x5315('0x3e')](_0x29c065);})[_0x5315('0x23')](function(_0x264dc6){_0xf24d22[_0x5315('0x3f')]=_0x264dc6;return _0xf24d22;})[_0x5315('0x23')](respondWithFilteredResult(_0x5b0085,_0x29c065))[_0x5315('0x40')](handleError(_0x5b0085,null));};exports[_0x5315('0x41')]=function(_0x4cadfb,_0x363366){var _0xea72e4={'raw':!![],'where':{'id':_0x4cadfb[_0x5315('0x42')]['id']}},_0x5a7d6c={};_0x5a7d6c[_0x5315('0x30')]=_[_0x5315('0x2e')](db['CmHopperBlack'][_0x5315('0x2a')]);_0x5a7d6c['query']=_[_0x5315('0x2e')](_0x4cadfb[_0x5315('0x2d')]);_0x5a7d6c[_0x5315('0x37')]=_[_0x5315('0x2f')](_0x5a7d6c[_0x5315('0x30')],_0x5a7d6c[_0x5315('0x2d')]);_0xea72e4['attributes']=_['intersection'](_0x5a7d6c[_0x5315('0x30')],qs['fields'](_0x4cadfb[_0x5315('0x2d')][_0x5315('0x32')]));_0xea72e4[_0x5315('0x31')]=_0xea72e4['attributes'][_0x5315('0x43')]?_0xea72e4[_0x5315('0x31')]:_0x5a7d6c['model'];if(_0x4cadfb[_0x5315('0x2d')][_0x5315('0x3c')]){_0xea72e4['include']=[{'all':!![]}];}_0xea72e4=_[_0x5315('0x3a')]({},_0xea72e4,_0x4cadfb[_0x5315('0x3b')]);return db[_0x5315('0x29')][_0x5315('0x44')](_0xea72e4)[_0x5315('0x23')](handleEntityNotFound(_0x363366,null))[_0x5315('0x23')](respondWithResult(_0x363366,null))[_0x5315('0x40')](handleError(_0x363366,null));};exports[_0x5315('0x22')]=function(_0xf6e36c,_0x47e269){if(_0xf6e36c['body']['id']){delete _0xf6e36c[_0x5315('0x45')]['id'];}return db['CmHopperBlack'][_0x5315('0x44')]({'where':{'id':_0xf6e36c[_0x5315('0x42')]['id']}})[_0x5315('0x23')](handleEntityNotFound(_0x47e269,null))['then'](saveUpdates(_0xf6e36c[_0x5315('0x45')],null))[_0x5315('0x23')](respondWithResult(_0x47e269,null))[_0x5315('0x40')](handleError(_0x47e269,null));};exports['destroy']=function(_0x240f6f,_0x1fdd7c){return db[_0x5315('0x29')][_0x5315('0x44')]({'where':{'id':_0x240f6f['params']['id']}})[_0x5315('0x23')](handleEntityNotFound(_0x1fdd7c,null))[_0x5315('0x23')](removeEntity(_0x1fdd7c,null))[_0x5315('0x40')](handleError(_0x1fdd7c,null));};exports[_0x5315('0x46')]=function(_0x127441,_0x1978be){return db['CmHopperBlack'][_0x5315('0x46')]()[_0x5315('0x23')](respondWithResult(_0x1978be,null))[_0x5315('0x40')](handleError(_0x1978be,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 1f0a799..c8990d1 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 _0x269e=['cm_hopper_black','lodash','../../config/logger','api','moment','bluebird','request-promise','./cmHopperBlack.attributes','exports','define','CmHopperBlack'];(function(_0x38f569,_0x4aa7e9){var _0x2f5442=function(_0x32ebc1){while(--_0x32ebc1){_0x38f569['push'](_0x38f569['shift']());}};_0x2f5442(++_0x4aa7e9);}(_0x269e,0xd2));var _0xe269=function(_0x3989d6,_0x2c5400){_0x3989d6=_0x3989d6-0x0;var _0xae8e03=_0x269e[_0x3989d6];return _0xae8e03;};'use strict';var _=require(_0xe269('0x0'));var util=require('util');var logger=require(_0xe269('0x1'))(_0xe269('0x2'));var moment=require(_0xe269('0x3'));var BPromise=require(_0xe269('0x4'));var rp=require(_0xe269('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe269('0x6'));module[_0xe269('0x7')]=function(_0x3e86d4,_0xb812df){return _0x3e86d4[_0xe269('0x8')](_0xe269('0x9'),attributes,{'tableName':_0xe269('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50b9=['rimraf','../../config/environment','exports','CmHopperBlack','cm_hopper_black','lodash','../../config/logger','api','moment','bluebird'];(function(_0x1b827d,_0x380d57){var _0x4e04be=function(_0x4dd658){while(--_0x4dd658){_0x1b827d['push'](_0x1b827d['shift']());}};_0x4e04be(++_0x380d57);}(_0x50b9,0x19f));var _0x950b=function(_0x552cf8,_0x493a58){_0x552cf8=_0x552cf8-0x0;var _0x5b0eca=_0x50b9[_0x552cf8];return _0x5b0eca;};'use strict';var _=require(_0x950b('0x0'));var util=require('util');var logger=require(_0x950b('0x1'))(_0x950b('0x2'));var moment=require(_0x950b('0x3'));var BPromise=require(_0x950b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x950b('0x5'));var config=require(_0x950b('0x6'));var attributes=require('./cmHopperBlack.attributes');module[_0x950b('0x7')]=function(_0x1cdadf,_0x49c75a){return _0x1cdadf['define'](_0x950b('0x8'),attributes,{'tableName':_0x950b('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 13b3aa4..89ecf3e 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 _0x4b50=['bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','catch','body','UpdateCmHopperBlack','destroy','DestroyCmHopperBlack','util','moment'];(function(_0x32032a,_0x24e8d1){var _0x5d5792=function(_0x517d18){while(--_0x517d18){_0x32032a['push'](_0x32032a['shift']());}};_0x5d5792(++_0x24e8d1);}(_0x4b50,0x195));var _0x04b5=function(_0x427d3a,_0x23724c){_0x427d3a=_0x427d3a-0x0;var _0xe5c521=_0x4b50[_0x427d3a];return _0xe5c521;};'use strict';var _=require('lodash');var util=require(_0x04b5('0x0'));var moment=require(_0x04b5('0x1'));var BPromise=require(_0x04b5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x04b5('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x04b5('0x4'))(_0x04b5('0x5'));var config=require(_0x04b5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x04b5('0x7')][_0x04b5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3650c7,_0x25c8a2,_0x18e98e){return new BPromise(function(_0x3a8d4b,_0xe46729){return client[_0x04b5('0x9')](_0x3650c7,_0x18e98e)[_0x04b5('0xa')](function(_0x1148c4){logger[_0x04b5('0xb')](_0x04b5('0xc'),_0x25c8a2,_0x04b5('0xd'));logger[_0x04b5('0xe')](_0x04b5('0xf'),_0x25c8a2,_0x04b5('0xd'),JSON[_0x04b5('0x10')](_0x1148c4));if(_0x1148c4['error']){if(_0x1148c4[_0x04b5('0x11')][_0x04b5('0x12')]===0x1f4){logger['error'](_0x04b5('0xc'),_0x25c8a2,_0x1148c4['error'][_0x04b5('0x13')]);return _0xe46729(_0x1148c4['error']['message']);}logger[_0x04b5('0x11')](_0x04b5('0xc'),_0x25c8a2,_0x1148c4[_0x04b5('0x11')][_0x04b5('0x13')]);return _0x3a8d4b(_0x1148c4[_0x04b5('0x11')][_0x04b5('0x13')]);}else{logger[_0x04b5('0xb')](_0x04b5('0xc'),_0x25c8a2,'request\x20sent');_0x3a8d4b(_0x1148c4[_0x04b5('0x14')][_0x04b5('0x13')]);}})['catch'](function(_0x306b95){logger[_0x04b5('0x11')](_0x04b5('0xc'),_0x25c8a2,_0x306b95);_0xe46729(_0x306b95);});});}exports[_0x04b5('0x15')]=function(_0x12d801){var _0x14b457=this;return new Promise(function(_0x293b5f,_0x13bc23){return db[_0x04b5('0x16')][_0x04b5('0x17')]({'raw':_0x12d801['options']?_0x12d801[_0x04b5('0x18')][_0x04b5('0x19')]===undefined?!![]:![]:!![],'where':_0x12d801['options']?_0x12d801[_0x04b5('0x18')][_0x04b5('0x1a')]||null:null,'attributes':_0x12d801[_0x04b5('0x18')]?_0x12d801[_0x04b5('0x18')][_0x04b5('0x1b')]||null:null,'limit':_0x12d801['options']?_0x12d801[_0x04b5('0x18')][_0x04b5('0x1c')]||null:null,'include':_0x12d801[_0x04b5('0x18')]?_0x12d801[_0x04b5('0x18')][_0x04b5('0x1d')]?_[_0x04b5('0x1e')](_0x12d801[_0x04b5('0x18')][_0x04b5('0x1d')],function(_0x46a1b7){return{'model':db[_0x46a1b7[_0x04b5('0x1f')]],'as':_0x46a1b7['as'],'attributes':_0x46a1b7[_0x04b5('0x1b')],'include':_0x46a1b7[_0x04b5('0x1d')]?_[_0x04b5('0x1e')](_0x46a1b7[_0x04b5('0x1d')],function(_0x317c52){return{'model':db[_0x317c52[_0x04b5('0x1f')]],'as':_0x317c52['as'],'attributes':_0x317c52[_0x04b5('0x1b')],'include':_0x317c52['include']?_[_0x04b5('0x1e')](_0x317c52[_0x04b5('0x1d')],function(_0x50dcc5){return{'model':db[_0x50dcc5[_0x04b5('0x1f')]],'as':_0x50dcc5['as'],'attributes':_0x50dcc5[_0x04b5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x04b5('0xa')](function(_0x3ca191){logger[_0x04b5('0xb')](_0x04b5('0x15'),_0x12d801);logger[_0x04b5('0xe')](_0x04b5('0x15'),_0x12d801,JSON[_0x04b5('0x10')](_0x3ca191));_0x293b5f(_0x3ca191);})[_0x04b5('0x20')](function(_0x418fc9){logger[_0x04b5('0x11')](_0x04b5('0x15'),_0x418fc9['message'],_0x12d801);_0x13bc23(_0x14b457[_0x04b5('0x11')](0x1f4,_0x418fc9[_0x04b5('0x13')]));});});};exports['UpdateCmHopperBlack']=function(_0x5e1028){var _0x13060f=this;return new Promise(function(_0x2777dc,_0xa8e74b){return db[_0x04b5('0x16')]['update'](_0x5e1028[_0x04b5('0x21')],{'raw':_0x5e1028[_0x04b5('0x18')]?_0x5e1028[_0x04b5('0x18')][_0x04b5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e1028[_0x04b5('0x18')]?_0x5e1028['options'][_0x04b5('0x1a')]||null:null,'attributes':_0x5e1028[_0x04b5('0x18')]?_0x5e1028[_0x04b5('0x18')][_0x04b5('0x1b')]||null:null,'limit':_0x5e1028[_0x04b5('0x18')]?_0x5e1028[_0x04b5('0x18')][_0x04b5('0x1c')]||null:null})[_0x04b5('0xa')](function(_0x3dffc4){logger[_0x04b5('0xb')](_0x04b5('0x22'),_0x5e1028);logger['debug'](_0x04b5('0x22'),_0x5e1028,JSON[_0x04b5('0x10')](_0x3dffc4));_0x2777dc(_0x3dffc4);})[_0x04b5('0x20')](function(_0x3d723a){logger['error'](_0x04b5('0x22'),_0x3d723a[_0x04b5('0x13')],_0x5e1028);_0xa8e74b(_0x13060f[_0x04b5('0x11')](0x1f4,_0x3d723a[_0x04b5('0x13')]));});});};exports['DestroyCmHopperBlack']=function(_0x18e41b){var _0x4c12ab=this;return new Promise(function(_0x3e040e,_0x4d4387){return db[_0x04b5('0x16')][_0x04b5('0x23')]({'where':_0x18e41b[_0x04b5('0x18')]?_0x18e41b[_0x04b5('0x18')][_0x04b5('0x1a')]||null:null})['then'](function(_0x43580a){logger['info']('DestroyCmHopperBlack',_0x18e41b);logger[_0x04b5('0xe')](_0x04b5('0x24'),_0x18e41b,JSON[_0x04b5('0x10')](_0x43580a));_0x3e040e(_0x43580a);})[_0x04b5('0x20')](function(_0x2409e8){logger[_0x04b5('0x11')](_0x04b5('0x24'),_0x2409e8[_0x04b5('0x13')],_0x18e41b);_0x4d4387(_0x4c12ab['error'](0x1f4,_0x2409e8['message']));});});}; \ No newline at end of file +var _0x9565=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','info','CmHopperBlack,\x20%s,\x20%s','error','message','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','attributes','limit','include','model','map','then','debug','stringify','UpdateCmHopperBlack','update','body','raw','DestroyCmHopperBlack','destroy','where','lodash','moment','randomstring'];(function(_0x4bb2b9,_0x459c78){var _0x40e2a2=function(_0x19a26c){while(--_0x19a26c){_0x4bb2b9['push'](_0x4bb2b9['shift']());}};_0x40e2a2(++_0x459c78);}(_0x9565,0x173));var _0x5956=function(_0x241abe,_0x25f88b){_0x241abe=_0x241abe-0x0;var _0x2e6302=_0x9565[_0x241abe];return _0x2e6302;};'use strict';var _=require(_0x5956('0x0'));var util=require('util');var moment=require(_0x5956('0x1'));var BPromise=require('bluebird');var rs=require(_0x5956('0x2'));var fs=require('fs');var Redis=require(_0x5956('0x3'));var db=require(_0x5956('0x4'))['db'];var utils=require(_0x5956('0x5'));var logger=require('../../config/logger')(_0x5956('0x6'));var config=require(_0x5956('0x7'));var jayson=require(_0x5956('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x27aaaa,_0x329ab5,_0x5038bd){return new BPromise(function(_0x463585,_0x245c12){return client[_0x5956('0x9')](_0x27aaaa,_0x5038bd)['then'](function(_0x102c58){logger[_0x5956('0xa')](_0x5956('0xb'),_0x329ab5,'request\x20sent');logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x329ab5,'request\x20sent',JSON['stringify'](_0x102c58));if(_0x102c58[_0x5956('0xc')]){if(_0x102c58[_0x5956('0xc')]['code']===0x1f4){logger[_0x5956('0xc')](_0x5956('0xb'),_0x329ab5,_0x102c58[_0x5956('0xc')][_0x5956('0xd')]);return _0x245c12(_0x102c58[_0x5956('0xc')][_0x5956('0xd')]);}logger[_0x5956('0xc')](_0x5956('0xb'),_0x329ab5,_0x102c58[_0x5956('0xc')][_0x5956('0xd')]);return _0x463585(_0x102c58['error']['message']);}else{logger[_0x5956('0xa')](_0x5956('0xb'),_0x329ab5,'request\x20sent');_0x463585(_0x102c58['result'][_0x5956('0xd')]);}})[_0x5956('0xe')](function(_0x299e65){logger[_0x5956('0xc')]('CmHopperBlack,\x20%s,\x20%s',_0x329ab5,_0x299e65);_0x245c12(_0x299e65);});});}exports[_0x5956('0xf')]=function(_0x331890){var _0x3dd9cf=this;return new Promise(function(_0x5291b9,_0xa6ef5b){return db[_0x5956('0x10')][_0x5956('0x11')]({'raw':_0x331890[_0x5956('0x12')]?_0x331890['options']['raw']===undefined?!![]:![]:!![],'where':_0x331890[_0x5956('0x12')]?_0x331890[_0x5956('0x12')]['where']||null:null,'attributes':_0x331890[_0x5956('0x12')]?_0x331890[_0x5956('0x12')][_0x5956('0x13')]||null:null,'limit':_0x331890[_0x5956('0x12')]?_0x331890[_0x5956('0x12')][_0x5956('0x14')]||null:null,'include':_0x331890['options']?_0x331890[_0x5956('0x12')]['include']?_['map'](_0x331890[_0x5956('0x12')][_0x5956('0x15')],function(_0x578d94){return{'model':db[_0x578d94[_0x5956('0x16')]],'as':_0x578d94['as'],'attributes':_0x578d94[_0x5956('0x13')],'include':_0x578d94[_0x5956('0x15')]?_[_0x5956('0x17')](_0x578d94[_0x5956('0x15')],function(_0x2bb90f){return{'model':db[_0x2bb90f[_0x5956('0x16')]],'as':_0x2bb90f['as'],'attributes':_0x2bb90f['attributes'],'include':_0x2bb90f[_0x5956('0x15')]?_[_0x5956('0x17')](_0x2bb90f['include'],function(_0x40386d){return{'model':db[_0x40386d[_0x5956('0x16')]],'as':_0x40386d['as'],'attributes':_0x40386d[_0x5956('0x13')]};}):[]};}):[]};}):[]:[]})[_0x5956('0x18')](function(_0x3d7cf0){logger[_0x5956('0xa')](_0x5956('0xf'),_0x331890);logger[_0x5956('0x19')](_0x5956('0xf'),_0x331890,JSON[_0x5956('0x1a')](_0x3d7cf0));_0x5291b9(_0x3d7cf0);})[_0x5956('0xe')](function(_0x4b2927){logger['error']('GetCmHopperBlack',_0x4b2927['message'],_0x331890);_0xa6ef5b(_0x3dd9cf[_0x5956('0xc')](0x1f4,_0x4b2927[_0x5956('0xd')]));});});};exports[_0x5956('0x1b')]=function(_0x25d2e1){var _0x23e835=this;return new Promise(function(_0x4c4450,_0x56787a){return db['CmHopperBlack'][_0x5956('0x1c')](_0x25d2e1[_0x5956('0x1d')],{'raw':_0x25d2e1[_0x5956('0x12')]?_0x25d2e1[_0x5956('0x12')][_0x5956('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25d2e1[_0x5956('0x12')]?_0x25d2e1[_0x5956('0x12')]['where']||null:null,'attributes':_0x25d2e1[_0x5956('0x12')]?_0x25d2e1[_0x5956('0x12')][_0x5956('0x13')]||null:null,'limit':_0x25d2e1[_0x5956('0x12')]?_0x25d2e1['options'][_0x5956('0x14')]||null:null})[_0x5956('0x18')](function(_0x52755d){logger[_0x5956('0xa')]('UpdateCmHopperBlack',_0x25d2e1);logger['debug']('UpdateCmHopperBlack',_0x25d2e1,JSON[_0x5956('0x1a')](_0x52755d));_0x4c4450(_0x52755d);})[_0x5956('0xe')](function(_0x3fabfe){logger[_0x5956('0xc')]('UpdateCmHopperBlack',_0x3fabfe['message'],_0x25d2e1);_0x56787a(_0x23e835['error'](0x1f4,_0x3fabfe[_0x5956('0xd')]));});});};exports[_0x5956('0x1f')]=function(_0x4b8109){var _0x1e9a59=this;return new Promise(function(_0x3f40a6,_0x6e6a4c){return db[_0x5956('0x10')][_0x5956('0x20')]({'where':_0x4b8109['options']?_0x4b8109[_0x5956('0x12')][_0x5956('0x21')]||null:null})[_0x5956('0x18')](function(_0x28d549){logger[_0x5956('0xa')](_0x5956('0x1f'),_0x4b8109);logger[_0x5956('0x19')](_0x5956('0x1f'),_0x4b8109,JSON[_0x5956('0x1a')](_0x28d549));_0x3f40a6(_0x28d549);})[_0x5956('0xe')](function(_0x392d59){logger['error']('DestroyCmHopperBlack',_0x392d59[_0x5956('0xd')],_0x4b8109);_0x6e6a4c(_0x1e9a59[_0x5956('0xc')](0x1f4,_0x392d59[_0x5956('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 605d97c..e4b232a 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 _0x814b=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','/describe','describe','/:id','show','put','update','delete','destroy','multer','util'];(function(_0x22ebf4,_0x3c039a){var _0x450f87=function(_0x54f42d){while(--_0x54f42d){_0x22ebf4['push'](_0x22ebf4['shift']());}};_0x450f87(++_0x3c039a);}(_0x814b,0x1a2));var _0xb814=function(_0x4cc492,_0x162c85){_0x4cc492=_0x4cc492-0x0;var _0x1f36b9=_0x814b[_0x4cc492];return _0x1f36b9;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')](_0xb814('0xe'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);module['exports']=router; \ No newline at end of file +var _0x3e24=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','show','/:id','delete','exports','multer'];(function(_0x393d8f,_0xc7003c){var _0x2270cb=function(_0x269bff){while(--_0x269bff){_0x393d8f['push'](_0x393d8f['shift']());}};_0x2270cb(++_0xc7003c);}(_0x3e24,0x167));var _0x43e2=function(_0x4375fb,_0x22650a){_0x4375fb=_0x4375fb-0x0;var _0x445a97=_0x3e24[_0x4375fb];return _0x445a97;};'use strict';var multer=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var path=require(_0x43e2('0x2'));var timeout=require(_0x43e2('0x3'));var express=require(_0x43e2('0x4'));var router=express['Router']();var fs_extra=require(_0x43e2('0x5'));var auth=require(_0x43e2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x43e2('0x7'));var controller=require(_0x43e2('0x8'));router[_0x43e2('0x9')]('/',auth[_0x43e2('0xa')](),controller[_0x43e2('0xb')]);router[_0x43e2('0x9')](_0x43e2('0xc'),auth['isAuthenticated'](),controller[_0x43e2('0xd')]);router[_0x43e2('0x9')]('/:id',auth[_0x43e2('0xa')](),controller[_0x43e2('0xe')]);router['put'](_0x43e2('0xf'),auth[_0x43e2('0xa')](),controller['update']);router[_0x43e2('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x43e2('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 35331cd..2793410 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 _0x68da=['moment','exports','INTEGER','DATE','STRING','getDataValue','endtime','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN','sequelize'];(function(_0x341919,_0x332fb5){var _0x58fac1=function(_0x58ef8b){while(--_0x58ef8b){_0x341919['push'](_0x341919['shift']());}};_0x58fac1(++_0x332fb5);}(_0x68da,0x15d));var _0xa68d=function(_0xcfeff4,_0x3f2e19){_0xcfeff4=_0xcfeff4-0x0;var _0xb2fadc=_0x68da[_0xcfeff4];return _0xb2fadc;};'use strict';var Sequelize=require(_0xa68d('0x0'));var moment=require(_0xa68d('0x1'));module[_0xa68d('0x2')]={'state':{'type':Sequelize[_0xa68d('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xa68d('0x4')]},'countbusyretry':{'type':Sequelize[_0xa68d('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa68d('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xa68d('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xa68d('0x5')]},'originatecalleridnum':{'type':Sequelize[_0xa68d('0x5')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xa68d('0x5')]},'calleridname':{'type':Sequelize[_0xa68d('0x5')]},'starttime':{'type':Sequelize[_0xa68d('0x4')]},'responsetime':{'type':Sequelize[_0xa68d('0x4')]},'answertime':{'type':Sequelize[_0xa68d('0x4')]},'droptime':{'type':Sequelize[_0xa68d('0x4')]},'endtime':{'type':Sequelize[_0xa68d('0x4')]},'ringtime':{'type':Sequelize[_0xa68d('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xa68d('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xa68d('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xa68d('0x5')]},'campaign':{'type':Sequelize[_0xa68d('0x5')]},'campaigntype':{'type':Sequelize[_0xa68d('0x5')]},'membername':{'type':Sequelize[_0xa68d('0x5')]},'reason':{'type':Sequelize[_0xa68d('0x5')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xa68d('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xa68d('0x4')],'set':function(_0x52ccc4){var _0xfa5cc0=this[_0xa68d('0x6')](_0xa68d('0x7'));if(_0xfa5cc0&&_0x52ccc4){this[_0xa68d('0x8')](_0xa68d('0x9'),moment(_0x52ccc4)[_0xa68d('0xa')](moment(_0xfa5cc0),_0xa68d('0xb')));}return this['setDataValue'](_0xa68d('0xc'),_0x52ccc4);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xa68d('0xd')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xa68d('0xd')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xa68d('0xd')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xa68d('0x4')]},'callback':{'type':Sequelize[_0xa68d('0xd')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa68d('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa68d('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xa68d('0x4')]},'recallme':{'type':Sequelize[_0xa68d('0xd')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xa68d('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa68d('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa68d('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9fe2=['dispositionat','BOOLEAN','sequelize','moment','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds'];(function(_0x3b2f9c,_0x5d5606){var _0x2d6b54=function(_0x1b4e78){while(--_0x1b4e78){_0x3b2f9c['push'](_0x3b2f9c['shift']());}};_0x2d6b54(++_0x5d5606);}(_0x9fe2,0x16e));var _0x29fe=function(_0x24a51d,_0x3f0644){_0x24a51d=_0x24a51d-0x0;var _0x197b2f=_0x9fe2[_0x24a51d];return _0x197b2f;};'use strict';var Sequelize=require(_0x29fe('0x0'));var moment=require(_0x29fe('0x1'));module['exports']={'state':{'type':Sequelize[_0x29fe('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x29fe('0x3')]},'scheduledat':{'type':Sequelize[_0x29fe('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x29fe('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x29fe('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x29fe('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x29fe('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x29fe('0x3')]},'starttime':{'type':Sequelize[_0x29fe('0x4')]},'responsetime':{'type':Sequelize[_0x29fe('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x29fe('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x29fe('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x29fe('0x3')]},'campaign':{'type':Sequelize[_0x29fe('0x3')]},'campaigntype':{'type':Sequelize[_0x29fe('0x3')]},'membername':{'type':Sequelize[_0x29fe('0x3')]},'reason':{'type':Sequelize[_0x29fe('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x29fe('0x3')]},'dispositionat':{'type':Sequelize[_0x29fe('0x4')],'set':function(_0x4caf95){var _0x2e7f11=this[_0x29fe('0x5')](_0x29fe('0x6'));if(_0x2e7f11&&_0x4caf95){this[_0x29fe('0x7')](_0x29fe('0x8'),moment(_0x4caf95)[_0x29fe('0x9')](moment(_0x2e7f11),_0x29fe('0xa')));}return this['setDataValue'](_0x29fe('0xb'),_0x4caf95);}},'amd':{'type':Sequelize[_0x29fe('0xc')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x29fe('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x29fe('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x29fe('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x29fe('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x29fe('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x29fe('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x29fe('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x29fe('0x2')],'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 f3d9a4e..a2b0caf 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 _0xd117=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','CmHopperFinal','fieldName','type','map','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','findAll','rows','catch','show','params','rawAttributes','includeAll','find','describe','update','body','uniqueid','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','insert','CampaignId','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format'];(function(_0x2da658,_0x2c9473){var _0x4139c7=function(_0x7226){while(--_0x7226){_0x2da658['push'](_0x2da658['shift']());}};_0x4139c7(++_0x2c9473);}(_0xd117,0x182));var _0x7d11=function(_0x51639a,_0x35f006){_0x51639a=_0x51639a-0x0;var _0x3abae4=_0xd117[_0x51639a];return _0x3abae4;};'use strict';var emlformat=require(_0x7d11('0x0'));var rimraf=require(_0x7d11('0x1'));var zipdir=require(_0x7d11('0x2'));var jsonpatch=require(_0x7d11('0x3'));var rp=require(_0x7d11('0x4'));var moment=require(_0x7d11('0x5'));var BPromise=require(_0x7d11('0x6'));var Mustache=require(_0x7d11('0x7'));var util=require(_0x7d11('0x8'));var path=require(_0x7d11('0x9'));var sox=require(_0x7d11('0xa'));var csv=require(_0x7d11('0xb'));var ejs=require(_0x7d11('0xc'));var fs=require('fs');var fs_extra=require(_0x7d11('0xd'));var _=require(_0x7d11('0xe'));var squel=require(_0x7d11('0xf'));var crypto=require('crypto');var jsforce=require(_0x7d11('0x10'));var deskjs=require(_0x7d11('0x11'));var toCsv=require(_0x7d11('0xb'));var querystring=require('querystring');var Papa=require(_0x7d11('0x12'));var Redis=require(_0x7d11('0x13'));var authService=require(_0x7d11('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7d11('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7d11('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7d11('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4767d5,_0x471f46){_0x471f46=_0x471f46||0xcc;return function(_0x5ee572){if(_0x5ee572){return _0x4767d5[_0x7d11('0x18')](_0x471f46);}return _0x4767d5[_0x7d11('0x19')](_0x471f46)['end']();};}function respondWithResult(_0x324de5,_0x16949d){_0x16949d=_0x16949d||0xc8;return function(_0x20a2df){if(_0x20a2df){return _0x324de5[_0x7d11('0x19')](_0x16949d)[_0x7d11('0x1a')](_0x20a2df);}};}function respondWithFilteredResult(_0xeae744,_0x2a269e){return function(_0xb1669e){if(_0xb1669e){var _0x4aa795=typeof _0x2a269e[_0x7d11('0x1b')]===_0x7d11('0x1c')&&typeof _0x2a269e[_0x7d11('0x1d')]===_0x7d11('0x1c');var _0x45f916=_0xb1669e['count'];var _0x456cb9=_0x4aa795?0x0:_0x2a269e[_0x7d11('0x1b')];var _0x4d1306=_0x4aa795?_0xb1669e['count']:_0x2a269e[_0x7d11('0x1b')]+_0x2a269e['limit'];var _0x1f9990;if(_0x4d1306>=_0x45f916){_0x4d1306=_0x45f916;_0x1f9990=0xc8;}else{_0x1f9990=0xce;}_0xeae744['status'](_0x1f9990);return _0xeae744[_0x7d11('0x1e')](_0x7d11('0x1f'),_0x456cb9+'-'+_0x4d1306+'/'+_0x45f916)[_0x7d11('0x1a')](_0xb1669e);}return null;};}function patchUpdates(_0x46f662){return function(_0x30df70){try{jsonpatch[_0x7d11('0x20')](_0x30df70,_0x46f662,!![]);}catch(_0x4297f8){return BPromise[_0x7d11('0x21')](_0x4297f8);}return _0x30df70['save']();};}function saveUpdates(_0x441917,_0x4a34f4){return function(_0x58455b){if(_0x58455b){return _0x58455b['update'](_0x441917)[_0x7d11('0x22')](function(_0x3545dc){return _0x3545dc;});}return null;};}function removeEntity(_0x44476c,_0x1a7853){return function(_0x355d14){if(_0x355d14){return _0x355d14[_0x7d11('0x23')]()[_0x7d11('0x22')](function(){_0x44476c[_0x7d11('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36c2b4,_0x577ca9){return function(_0x4bfa76){if(!_0x4bfa76){_0x36c2b4['sendStatus'](0x194);}return _0x4bfa76;};}function handleError(_0x3ba092,_0x59cdba){_0x59cdba=_0x59cdba||0x1f4;return function(_0x180e1e){logger[_0x7d11('0x24')](_0x180e1e[_0x7d11('0x25')]);if(_0x180e1e['name']){delete _0x180e1e[_0x7d11('0x26')];}_0x3ba092[_0x7d11('0x19')](_0x59cdba)[_0x7d11('0x27')](_0x180e1e);};}exports['index']=function(_0x601650,_0x35a789){var _0x18c049={},_0x38f1be={},_0x4c7d6a={'count':0x0,'rows':[]};var _0x1a7745=_['map'](db[_0x7d11('0x28')]['rawAttributes'],function(_0x31866d){return{'name':_0x31866d[_0x7d11('0x29')],'type':_0x31866d[_0x7d11('0x2a')]['key']};});_0x38f1be['model']=_[_0x7d11('0x2b')](_0x1a7745,_0x7d11('0x26'));_0x38f1be['query']=_[_0x7d11('0x2c')](_0x601650[_0x7d11('0x2d')]);_0x38f1be[_0x7d11('0x2e')]=_['intersection'](_0x38f1be[_0x7d11('0x2f')],_0x38f1be['query']);_0x18c049['attributes']=_[_0x7d11('0x30')](_0x38f1be['model'],qs[_0x7d11('0x31')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x31')]));_0x18c049[_0x7d11('0x32')]=_0x18c049['attributes'][_0x7d11('0x33')]?_0x18c049[_0x7d11('0x32')]:_0x38f1be['model'];if(!_0x601650['query'][_0x7d11('0x34')](_0x7d11('0x35'))){_0x18c049['limit']=qs[_0x7d11('0x1d')](_0x601650['query']['limit']);_0x18c049[_0x7d11('0x1b')]=qs['offset'](_0x601650['query'][_0x7d11('0x1b')]);}_0x18c049[_0x7d11('0x36')]=qs[_0x7d11('0x37')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x37')]);_0x18c049[_0x7d11('0x38')]=qs[_0x7d11('0x2e')](_[_0x7d11('0x39')](_0x601650[_0x7d11('0x2d')],_0x38f1be[_0x7d11('0x2e')]),_0x1a7745);if(_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]){_0x18c049['where']=_[_0x7d11('0x3b')](_0x18c049['where'],{'$or':_[_0x7d11('0x2b')](_0x1a7745,function(_0x111e26){if(_0x111e26[_0x7d11('0x2a')]!==_0x7d11('0x3c')){var _0x4f8fd2={};_0x4f8fd2[_0x111e26[_0x7d11('0x26')]]={'$like':'%'+_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]+'%'};return _0x4f8fd2;}})});}_0x18c049=_[_0x7d11('0x3b')]({},_0x18c049,_0x601650['options']);var _0x22730e={'where':_0x18c049['where']};return db[_0x7d11('0x28')]['count'](_0x22730e)[_0x7d11('0x22')](function(_0x622725){_0x4c7d6a[_0x7d11('0x3d')]=_0x622725;if(_0x601650[_0x7d11('0x2d')]['includeAll']){_0x18c049['include']=[{'all':!![]}];}return db[_0x7d11('0x28')][_0x7d11('0x3e')](_0x18c049);})['then'](function(_0x1caef9){_0x4c7d6a[_0x7d11('0x3f')]=_0x1caef9;return _0x4c7d6a;})[_0x7d11('0x22')](respondWithFilteredResult(_0x35a789,_0x18c049))[_0x7d11('0x40')](handleError(_0x35a789,null));};exports[_0x7d11('0x41')]=function(_0x2e1647,_0x47e968){var _0x25b73b={'raw':!![],'where':{'id':_0x2e1647[_0x7d11('0x42')]['id']}},_0x5cf6a6={};_0x5cf6a6[_0x7d11('0x2f')]=_[_0x7d11('0x2c')](db[_0x7d11('0x28')][_0x7d11('0x43')]);_0x5cf6a6[_0x7d11('0x2d')]=_['keys'](_0x2e1647['query']);_0x5cf6a6['filters']=_[_0x7d11('0x30')](_0x5cf6a6[_0x7d11('0x2f')],_0x5cf6a6[_0x7d11('0x2d')]);_0x25b73b[_0x7d11('0x32')]=_[_0x7d11('0x30')](_0x5cf6a6['model'],qs[_0x7d11('0x31')](_0x2e1647[_0x7d11('0x2d')]['fields']));_0x25b73b[_0x7d11('0x32')]=_0x25b73b[_0x7d11('0x32')][_0x7d11('0x33')]?_0x25b73b['attributes']:_0x5cf6a6[_0x7d11('0x2f')];if(_0x2e1647[_0x7d11('0x2d')][_0x7d11('0x44')]){_0x25b73b['include']=[{'all':!![]}];}_0x25b73b=_[_0x7d11('0x3b')]({},_0x25b73b,_0x2e1647['options']);return db[_0x7d11('0x28')][_0x7d11('0x45')](_0x25b73b)[_0x7d11('0x22')](handleEntityNotFound(_0x47e968,null))[_0x7d11('0x22')](respondWithResult(_0x47e968,null))[_0x7d11('0x40')](handleError(_0x47e968,null));};exports[_0x7d11('0x46')]=function(_0x161213,_0x193631){return db[_0x7d11('0x28')]['describe']()['then'](respondWithResult(_0x193631,null))['catch'](handleError(_0x193631,null));};exports[_0x7d11('0x47')]=function(_0x1e5bb5,_0x20297a){if(_0x1e5bb5[_0x7d11('0x48')][_0x7d11('0x49')]){delete _0x1e5bb5[_0x7d11('0x48')][_0x7d11('0x49')];}return db[_0x7d11('0x28')][_0x7d11('0x45')]({'where':{'uniqueid':_0x1e5bb5[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x20297a,null))[_0x7d11('0x22')](saveUpdates(_0x1e5bb5['body'],null))[_0x7d11('0x22')](respondWithResult(_0x20297a,null))[_0x7d11('0x40')](handleError(_0x20297a,null));};exports[_0x7d11('0x4a')]=function(_0x553a03,_0x503ebc,_0x14db1c){return db[_0x7d11('0x28')][_0x7d11('0x3e')]({'raw':![],'where':{'VoiceQueueId':_0x553a03['params']['id']},'attributes':[[db['sequelize']['fn'](_0x7d11('0x4b'),db[_0x7d11('0x4c')]['fn']('IF',db['sequelize'][_0x7d11('0x4d')](_0x7d11('0x4e')))),_0x7d11('0x4f')],[db[_0x7d11('0x4c')]['fn']('COUNT',db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')][_0x7d11('0x4d')]('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x7d11('0x4c')]['fn'](_0x7d11('0x4b'),db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')][_0x7d11('0x4d')]('`state`\x20=\x205,\x201,\x20null'))),_0x7d11('0x50')],[db[_0x7d11('0x4c')]['fn'](_0x7d11('0x4b'),db[_0x7d11('0x4c')]['fn']('IF',db['sequelize']['literal'](_0x7d11('0x51')))),_0x7d11('0x52')],[db[_0x7d11('0x4c')]['fn'](_0x7d11('0x4b'),db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')][_0x7d11('0x4d')](_0x7d11('0x53')))),_0x7d11('0x54')],[db[_0x7d11('0x4c')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x7d11('0x4d')](_0x7d11('0x55')))),_0x7d11('0x56')],[db['sequelize']['fn'](_0x7d11('0x4b'),db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')][_0x7d11('0x4d')](_0x7d11('0x57')))),_0x7d11('0x58')],[db['sequelize']['fn'](_0x7d11('0x4b'),db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})['then'](handleEntityNotFound(_0x503ebc,null))[_0x7d11('0x22')](respondWithResult(_0x503ebc,null))['catch'](handleError(_0x503ebc,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x52d62d,_0x32c551,_0x12f05b){return db[_0x7d11('0x28')][_0x7d11('0x3e')]({'raw':![],'where':{'CampaignId':_0x52d62d[_0x7d11('0x42')]['id']},'attributes':[[db[_0x7d11('0x4c')]['fn']('COUNT',db[_0x7d11('0x4c')]['fn']('IF',db['sequelize'][_0x7d11('0x4d')]('`state`\x20=\x200,\x201,\x20null'))),_0x7d11('0x4f')],[db[_0x7d11('0x4c')]['fn']('COUNT',db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')][_0x7d11('0x4d')](_0x7d11('0x59')))),'noAnswerContacts'],[db['sequelize']['fn'](_0x7d11('0x4b'),db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')][_0x7d11('0x4d')](_0x7d11('0x5a')))),'busyContacts'],[db[_0x7d11('0x4c')]['fn']('COUNT',db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')][_0x7d11('0x4d')](_0x7d11('0x51')))),'congestionContacts'],[db[_0x7d11('0x4c')]['fn']('COUNT',db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')][_0x7d11('0x4d')](_0x7d11('0x53')))),_0x7d11('0x54')],[db[_0x7d11('0x4c')]['fn'](_0x7d11('0x4b'),db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')][_0x7d11('0x4d')](_0x7d11('0x55')))),_0x7d11('0x56')],[db[_0x7d11('0x4c')]['fn'](_0x7d11('0x4b'),db['sequelize']['fn']('IF',db[_0x7d11('0x4c')]['literal'](_0x7d11('0x57')))),'reCallContacts'],[db[_0x7d11('0x4c')]['fn'](_0x7d11('0x4b'),db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0x7d11('0x5b')]]})[_0x7d11('0x22')](handleEntityNotFound(_0x32c551,null))[_0x7d11('0x22')](respondWithResult(_0x32c551,null))['catch'](handleError(_0x32c551,null));};exports[_0x7d11('0x5c')]=function(_0x3c656b,_0x31cb39,_0x1b89de){return db[_0x7d11('0x5d')][_0x7d11('0x45')]({'where':{'id':_0x3c656b['params']['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x31cb39,null))['then'](function(_0x1fd598){var _0x4c88c6;if(_0x1fd598){_0x4c88c6=squel['insert']()[_0x7d11('0x5e')](_0x7d11('0x5f'))[_0x7d11('0x60')]([_0x7d11('0x61'),_0x7d11('0x62'),_0x7d11('0x63'),_0x7d11('0x64'),_0x7d11('0x65'),_0x7d11('0x66'),_0x7d11('0x67')],squel[_0x7d11('0x68')]()['field'](_0x7d11('0x69'),'phone')[_0x7d11('0x6a')](_0x7d11('0x6b'),_0x7d11('0x62'))[_0x7d11('0x6a')](_0x7d11('0x6c'),_0x7d11('0x63'))[_0x7d11('0x6a')]('ANY_VALUE(ListId)','ListId')[_0x7d11('0x6a')](_0x7d11('0x6d'),_0x7d11('0x65'))[_0x7d11('0x6a')](_0x7d11('0x6b'),'createdAt')[_0x7d11('0x6a')]('NOW()',_0x7d11('0x67'))[_0x7d11('0x6e')](_0x7d11('0x6f'))[_0x7d11('0x38')](_0x7d11('0x70'),_0x3c656b[_0x7d11('0x42')]['id'][_0x7d11('0x71')]())[_0x7d11('0x38')]('state\x20=\x20?',_0x3c656b['body'][_0x7d11('0x72')][_0x7d11('0x71')]())[_0x7d11('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')['where'](_0x7d11('0x73'),squel['select']()[_0x7d11('0x6a')](_0x7d11('0x61'))[_0x7d11('0x6e')](_0x7d11('0x5f'))['where'](_0x7d11('0x70'),_0x3c656b[_0x7d11('0x42')]['id'][_0x7d11('0x71')]()))[_0x7d11('0x38')](_0x7d11('0x73'),squel[_0x7d11('0x68')]()[_0x7d11('0x6a')](_0x7d11('0x74'))['from'](_0x7d11('0x6f'))[_0x7d11('0x38')](_0x7d11('0x70'),_0x3c656b[_0x7d11('0x42')]['id'][_0x7d11('0x71')]())['where'](_0x7d11('0x75')))[_0x7d11('0x76')](_0x7d11('0x63')))[_0x7d11('0x71')]();return db[_0x7d11('0x4c')]['query'](_0x4c88c6);}return[];})['then'](respondWithResult(_0x31cb39,null))['catch'](handleError(_0x31cb39,null));};exports[_0x7d11('0x77')]=function(_0x4c15e9,_0x2a9e92,_0x5459d1){return db['Campaign'][_0x7d11('0x45')]({'where':{'id':_0x4c15e9[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x2a9e92,null))[_0x7d11('0x22')](function(_0x345fb3){var _0x32a17a;if(_0x345fb3){_0x32a17a=squel[_0x7d11('0x78')]()[_0x7d11('0x5e')](_0x7d11('0x5f'))[_0x7d11('0x60')](['phone',_0x7d11('0x62'),_0x7d11('0x63'),'ListId',_0x7d11('0x79'),_0x7d11('0x66'),_0x7d11('0x67')],squel[_0x7d11('0x68')]()['field']('ANY_VALUE(calleridnum)',_0x7d11('0x61'))['field'](_0x7d11('0x6b'),_0x7d11('0x62'))[_0x7d11('0x6a')](_0x7d11('0x6c'),_0x7d11('0x63'))[_0x7d11('0x6a')](_0x7d11('0x7a'),'ListId')[_0x7d11('0x6a')](_0x7d11('0x7b'),_0x7d11('0x79'))[_0x7d11('0x6a')]('NOW()',_0x7d11('0x66'))[_0x7d11('0x6a')]('NOW()',_0x7d11('0x67'))[_0x7d11('0x6e')](_0x7d11('0x6f'))['where'](_0x7d11('0x7c'),_0x4c15e9[_0x7d11('0x42')]['id']['toString']())[_0x7d11('0x38')](_0x7d11('0x7d'),_0x4c15e9['body'][_0x7d11('0x72')]['toString']())['where']('calleridnum\x20IS\x20NOT\x20NULL')['where'](_0x7d11('0x73'),squel[_0x7d11('0x68')]()[_0x7d11('0x6a')](_0x7d11('0x61'))[_0x7d11('0x6e')](_0x7d11('0x5f'))[_0x7d11('0x38')](_0x7d11('0x7c'),_0x4c15e9[_0x7d11('0x42')]['id'][_0x7d11('0x71')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x7d11('0x68')]()[_0x7d11('0x6a')]('calleridnum')['from'](_0x7d11('0x6f'))[_0x7d11('0x38')](_0x7d11('0x7c'),_0x4c15e9[_0x7d11('0x42')]['id']['toString']())['where']('state\x20=\x204'))[_0x7d11('0x76')](_0x7d11('0x63')))[_0x7d11('0x71')]();return db['sequelize'][_0x7d11('0x2d')](_0x32a17a);}return[];})[_0x7d11('0x22')](respondWithResult(_0x2a9e92,null))['catch'](handleError(_0x2a9e92,null));};exports[_0x7d11('0x7e')]=function(_0x1cb457,_0x59f0db,_0x5e5faf){return db[_0x7d11('0x7f')][_0x7d11('0x80')]({'where':{'VoiceQueueId':_0x1cb457['body']['VoiceQueueId'],'CampaignId':_0x1cb457[_0x7d11('0x48')][_0x7d11('0x79')],'ContactId':_0x1cb457[_0x7d11('0x48')][_0x7d11('0x63')]}})['then'](handleEntityNotFound(_0x59f0db,null))[_0x7d11('0x22')](function(_0x2cfa77){if(_0x2cfa77){return _0x2cfa77;}return null;})[_0x7d11('0x22')](respondWithResult(_0x59f0db,null))[_0x7d11('0x40')](handleError(_0x59f0db,null));}; \ No newline at end of file +var _0x6d38=['calleridnum\x20IS\x20NOT\x20NULL','CmHopper','findOne','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','stack','name','send','index','map','CmHopperFinal','rawAttributes','type','key','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','keys','filters','intersection','describe','catch','body','uniqueid','find','params','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','busyContacts','`state`\x20=\x208,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','moveContactsQueueCampaignHopperFinal','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','from','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','Campaign','cm_hopper','CampaignId','ANY_VALUE(ListId)','CampaignId\x20=\x20?','state'];(function(_0x1c5ebd,_0x33a0d4){var _0x3ae736=function(_0x361304){while(--_0x361304){_0x1c5ebd['push'](_0x1c5ebd['shift']());}};_0x3ae736(++_0x33a0d4);}(_0x6d38,0x1ef));var _0x86d3=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x6d38[_0x465028];return _0xb783d4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x86d3('0x0'));var zipdir=require(_0x86d3('0x1'));var jsonpatch=require(_0x86d3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x86d3('0x3'));var Mustache=require('mustache');var util=require(_0x86d3('0x4'));var path=require(_0x86d3('0x5'));var sox=require(_0x86d3('0x6'));var csv=require('to-csv');var ejs=require(_0x86d3('0x7'));var fs=require('fs');var fs_extra=require(_0x86d3('0x8'));var _=require(_0x86d3('0x9'));var squel=require(_0x86d3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86d3('0xb'));var toCsv=require(_0x86d3('0xc'));var querystring=require(_0x86d3('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x86d3('0xe'));var qs=require(_0x86d3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x86d3('0x10'))(_0x86d3('0x11'));var utils=require('../../config/utils');var config=require(_0x86d3('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x86d3('0x13'))['db'];function respondWithStatusCode(_0x7d4d2e,_0x440a55){_0x440a55=_0x440a55||0xcc;return function(_0x26d64c){if(_0x26d64c){return _0x7d4d2e[_0x86d3('0x14')](_0x440a55);}return _0x7d4d2e[_0x86d3('0x15')](_0x440a55)[_0x86d3('0x16')]();};}function respondWithResult(_0x12ef4a,_0x5ce2ff){_0x5ce2ff=_0x5ce2ff||0xc8;return function(_0x1c1ba8){if(_0x1c1ba8){return _0x12ef4a[_0x86d3('0x15')](_0x5ce2ff)[_0x86d3('0x17')](_0x1c1ba8);}};}function respondWithFilteredResult(_0x207f6f,_0x1ea535){return function(_0x34fb3b){if(_0x34fb3b){var _0x1ff008=typeof _0x1ea535[_0x86d3('0x18')]==='undefined'&&typeof _0x1ea535[_0x86d3('0x19')]===_0x86d3('0x1a');var _0x431b3f=_0x34fb3b[_0x86d3('0x1b')];var _0x46feec=_0x1ff008?0x0:_0x1ea535[_0x86d3('0x18')];var _0x33e459=_0x1ff008?_0x34fb3b[_0x86d3('0x1b')]:_0x1ea535[_0x86d3('0x18')]+_0x1ea535['limit'];var _0x191ba5;if(_0x33e459>=_0x431b3f){_0x33e459=_0x431b3f;_0x191ba5=0xc8;}else{_0x191ba5=0xce;}_0x207f6f['status'](_0x191ba5);return _0x207f6f[_0x86d3('0x1c')]('Content-Range',_0x46feec+'-'+_0x33e459+'/'+_0x431b3f)['json'](_0x34fb3b);}return null;};}function patchUpdates(_0x41486a){return function(_0x1edb6d){try{jsonpatch[_0x86d3('0x1d')](_0x1edb6d,_0x41486a,!![]);}catch(_0x1720ae){return BPromise['reject'](_0x1720ae);}return _0x1edb6d[_0x86d3('0x1e')]();};}function saveUpdates(_0x55e1c3,_0x36e0fa){return function(_0x3fdf67){if(_0x3fdf67){return _0x3fdf67[_0x86d3('0x1f')](_0x55e1c3)['then'](function(_0x39d819){return _0x39d819;});}return null;};}function removeEntity(_0x72b3d4,_0x1fa4ac){return function(_0x4bf5b8){if(_0x4bf5b8){return _0x4bf5b8['destroy']()[_0x86d3('0x20')](function(){_0x72b3d4['status'](0xcc)[_0x86d3('0x16')]();});}};}function handleEntityNotFound(_0x1bea5e,_0x3dfecd){return function(_0x3c5fe4){if(!_0x3c5fe4){_0x1bea5e['sendStatus'](0x194);}return _0x3c5fe4;};}function handleError(_0x481077,_0x3359e4){_0x3359e4=_0x3359e4||0x1f4;return function(_0x611764){logger['error'](_0x611764[_0x86d3('0x21')]);if(_0x611764['name']){delete _0x611764[_0x86d3('0x22')];}_0x481077[_0x86d3('0x15')](_0x3359e4)[_0x86d3('0x23')](_0x611764);};}exports[_0x86d3('0x24')]=function(_0x11a6fd,_0x14c9ff){var _0x1f203e={},_0x35d708={},_0x303f13={'count':0x0,'rows':[]};var _0x44dacf=_[_0x86d3('0x25')](db[_0x86d3('0x26')][_0x86d3('0x27')],function(_0x28c25e){return{'name':_0x28c25e['fieldName'],'type':_0x28c25e[_0x86d3('0x28')][_0x86d3('0x29')]};});_0x35d708[_0x86d3('0x2a')]=_[_0x86d3('0x25')](_0x44dacf,_0x86d3('0x22'));_0x35d708[_0x86d3('0x2b')]=_['keys'](_0x11a6fd[_0x86d3('0x2b')]);_0x35d708['filters']=_['intersection'](_0x35d708[_0x86d3('0x2a')],_0x35d708[_0x86d3('0x2b')]);_0x1f203e[_0x86d3('0x2c')]=_['intersection'](_0x35d708[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x11a6fd['query'][_0x86d3('0x2d')]));_0x1f203e[_0x86d3('0x2c')]=_0x1f203e[_0x86d3('0x2c')][_0x86d3('0x2e')]?_0x1f203e[_0x86d3('0x2c')]:_0x35d708[_0x86d3('0x2a')];if(!_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x2f')]('nolimit')){_0x1f203e['limit']=qs['limit'](_0x11a6fd[_0x86d3('0x2b')]['limit']);_0x1f203e[_0x86d3('0x18')]=qs['offset'](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x18')]);}_0x1f203e[_0x86d3('0x30')]=qs[_0x86d3('0x31')](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x31')]);_0x1f203e[_0x86d3('0x32')]=qs['filters'](_[_0x86d3('0x33')](_0x11a6fd[_0x86d3('0x2b')],_0x35d708['filters']),_0x44dacf);if(_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]){_0x1f203e[_0x86d3('0x32')]=_[_0x86d3('0x35')](_0x1f203e['where'],{'$or':_[_0x86d3('0x25')](_0x44dacf,function(_0x42ac0d){if(_0x42ac0d[_0x86d3('0x28')]!=='VIRTUAL'){var _0x5762ca={};_0x5762ca[_0x42ac0d[_0x86d3('0x22')]]={'$like':'%'+_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]+'%'};return _0x5762ca;}})});}_0x1f203e=_[_0x86d3('0x35')]({},_0x1f203e,_0x11a6fd[_0x86d3('0x36')]);var _0x3666fc={'where':_0x1f203e[_0x86d3('0x32')]};return db['CmHopperFinal'][_0x86d3('0x1b')](_0x3666fc)[_0x86d3('0x20')](function(_0x2bdc67){_0x303f13[_0x86d3('0x1b')]=_0x2bdc67;if(_0x11a6fd['query'][_0x86d3('0x37')]){_0x1f203e[_0x86d3('0x38')]=[{'all':!![]}];}return db[_0x86d3('0x26')][_0x86d3('0x39')](_0x1f203e);})['then'](function(_0x587747){_0x303f13[_0x86d3('0x3a')]=_0x587747;return _0x303f13;})['then'](respondWithFilteredResult(_0x14c9ff,_0x1f203e))['catch'](handleError(_0x14c9ff,null));};exports[_0x86d3('0x3b')]=function(_0x1385fc,_0x43490a){var _0x35d6fe={'raw':!![],'where':{'id':_0x1385fc['params']['id']}},_0x23ef72={};_0x23ef72[_0x86d3('0x2a')]=_[_0x86d3('0x3c')](db[_0x86d3('0x26')]['rawAttributes']);_0x23ef72[_0x86d3('0x2b')]=_[_0x86d3('0x3c')](_0x1385fc['query']);_0x23ef72[_0x86d3('0x3d')]=_[_0x86d3('0x3e')](_0x23ef72['model'],_0x23ef72['query']);_0x35d6fe['attributes']=_[_0x86d3('0x3e')](_0x23ef72[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x2d')]));_0x35d6fe[_0x86d3('0x2c')]=_0x35d6fe['attributes'][_0x86d3('0x2e')]?_0x35d6fe[_0x86d3('0x2c')]:_0x23ef72['model'];if(_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x37')]){_0x35d6fe[_0x86d3('0x38')]=[{'all':!![]}];}_0x35d6fe=_[_0x86d3('0x35')]({},_0x35d6fe,_0x1385fc[_0x86d3('0x36')]);return db[_0x86d3('0x26')]['find'](_0x35d6fe)[_0x86d3('0x20')](handleEntityNotFound(_0x43490a,null))[_0x86d3('0x20')](respondWithResult(_0x43490a,null))['catch'](handleError(_0x43490a,null));};exports[_0x86d3('0x3f')]=function(_0x412d0e,_0xd20863){return db[_0x86d3('0x26')][_0x86d3('0x3f')]()['then'](respondWithResult(_0xd20863,null))[_0x86d3('0x40')](handleError(_0xd20863,null));};exports[_0x86d3('0x1f')]=function(_0x3226b5,_0x14fa58){if(_0x3226b5[_0x86d3('0x41')][_0x86d3('0x42')]){delete _0x3226b5[_0x86d3('0x41')][_0x86d3('0x42')];}return db[_0x86d3('0x26')][_0x86d3('0x43')]({'where':{'uniqueid':_0x3226b5[_0x86d3('0x44')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x14fa58,null))['then'](saveUpdates(_0x3226b5[_0x86d3('0x41')],null))[_0x86d3('0x20')](respondWithResult(_0x14fa58,null))['catch'](handleError(_0x14fa58,null));};exports[_0x86d3('0x45')]=function(_0x23a6ee,_0x197047,_0x2e9af5){return db[_0x86d3('0x26')][_0x86d3('0x39')]({'raw':![],'where':{'VoiceQueueId':_0x23a6ee['params']['id']},'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x48')))),_0x86d3('0x49')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db['sequelize'][_0x86d3('0x47')](_0x86d3('0x4b')))),_0x86d3('0x4c')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')]['literal'](_0x86d3('0x4d')))),'busyContacts'],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')]('`state`\x20=\x208,\x201,\x20null'))),_0x86d3('0x4e')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x86d3('0x4f')))),'dropContacts'],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x50')))),_0x86d3('0x51')],[db[_0x86d3('0x46')]['fn']('COUNT',db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x52')))),'answeringMachine']]})[_0x86d3('0x20')](handleEntityNotFound(_0x197047,null))[_0x86d3('0x20')](respondWithResult(_0x197047,null))['catch'](handleError(_0x197047,null));};exports[_0x86d3('0x53')]=function(_0x416428,_0x15cdd0,_0x29bdee){return db[_0x86d3('0x26')][_0x86d3('0x39')]({'raw':![],'where':{'CampaignId':_0x416428[_0x86d3('0x44')]['id']},'attributes':[[db['sequelize']['fn']('COUNT',db[_0x86d3('0x46')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x86d3('0x49')],[db['sequelize']['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x4b')))),'noAnswerContacts'],[db['sequelize']['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x4d')))),_0x86d3('0x54')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x55')))),_0x86d3('0x4e')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x86d3('0x56')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x57')))),_0x86d3('0x58')],[db['sequelize']['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x50')))),_0x86d3('0x51')],[db[_0x86d3('0x46')]['fn']('COUNT',db[_0x86d3('0x46')]['fn']('IF',db['sequelize'][_0x86d3('0x47')](_0x86d3('0x52')))),'answeringMachine']]})[_0x86d3('0x20')](handleEntityNotFound(_0x15cdd0,null))[_0x86d3('0x20')](respondWithResult(_0x15cdd0,null))[_0x86d3('0x40')](handleError(_0x15cdd0,null));};exports[_0x86d3('0x59')]=function(_0x308fed,_0x1c966a,_0x379799){return db['VoiceQueue'][_0x86d3('0x43')]({'where':{'id':_0x308fed[_0x86d3('0x44')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x1c966a,null))[_0x86d3('0x20')](function(_0x46e356){var _0x47f72e;if(_0x46e356){_0x47f72e=squel[_0x86d3('0x5a')]()[_0x86d3('0x5b')]('cm_hopper')[_0x86d3('0x5c')]([_0x86d3('0x5d'),_0x86d3('0x5e'),_0x86d3('0x5f'),_0x86d3('0x60'),_0x86d3('0x61'),_0x86d3('0x62'),_0x86d3('0x63')],squel[_0x86d3('0x64')]()[_0x86d3('0x65')](_0x86d3('0x66'),_0x86d3('0x5d'))[_0x86d3('0x65')](_0x86d3('0x67'),'scheduledAt')[_0x86d3('0x65')](_0x86d3('0x68'),_0x86d3('0x5f'))[_0x86d3('0x65')]('ANY_VALUE(ListId)',_0x86d3('0x60'))[_0x86d3('0x65')](_0x86d3('0x69'),_0x86d3('0x61'))['field']('NOW()',_0x86d3('0x62'))['field'](_0x86d3('0x67'),'updatedAt')['from'](_0x86d3('0x6a'))[_0x86d3('0x32')](_0x86d3('0x6b'),_0x308fed[_0x86d3('0x44')]['id'][_0x86d3('0x6c')]())['where'](_0x86d3('0x6d'),_0x308fed[_0x86d3('0x41')]['state'][_0x86d3('0x6c')]())[_0x86d3('0x32')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x86d3('0x32')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x86d3('0x64')]()['field']('phone')[_0x86d3('0x6e')]('cm_hopper')[_0x86d3('0x32')](_0x86d3('0x6b'),_0x308fed[_0x86d3('0x44')]['id'][_0x86d3('0x6c')]()))[_0x86d3('0x32')](_0x86d3('0x6f'),squel[_0x86d3('0x64')]()[_0x86d3('0x65')]('calleridnum')[_0x86d3('0x6e')](_0x86d3('0x6a'))[_0x86d3('0x32')](_0x86d3('0x6b'),_0x308fed[_0x86d3('0x44')]['id']['toString']())[_0x86d3('0x32')](_0x86d3('0x70')))[_0x86d3('0x71')](_0x86d3('0x5f')))[_0x86d3('0x6c')]();return db[_0x86d3('0x46')][_0x86d3('0x2b')](_0x47f72e);}return[];})['then'](respondWithResult(_0x1c966a,null))[_0x86d3('0x40')](handleError(_0x1c966a,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0xca2e0,_0x596b1d,_0x5a22ca){return db[_0x86d3('0x72')][_0x86d3('0x43')]({'where':{'id':_0xca2e0['params']['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x596b1d,null))[_0x86d3('0x20')](function(_0x879a8b){var _0x1c1384;if(_0x879a8b){_0x1c1384=squel[_0x86d3('0x5a')]()[_0x86d3('0x5b')](_0x86d3('0x73'))['fromQuery'](['phone',_0x86d3('0x5e'),_0x86d3('0x5f'),_0x86d3('0x60'),_0x86d3('0x74'),_0x86d3('0x62'),_0x86d3('0x63')],squel['select']()[_0x86d3('0x65')](_0x86d3('0x66'),_0x86d3('0x5d'))[_0x86d3('0x65')](_0x86d3('0x67'),_0x86d3('0x5e'))[_0x86d3('0x65')](_0x86d3('0x68'),_0x86d3('0x5f'))['field'](_0x86d3('0x75'),_0x86d3('0x60'))['field']('ANY_VALUE(CampaignId)',_0x86d3('0x74'))[_0x86d3('0x65')](_0x86d3('0x67'),'createdAt')[_0x86d3('0x65')](_0x86d3('0x67'),_0x86d3('0x63'))[_0x86d3('0x6e')](_0x86d3('0x6a'))['where'](_0x86d3('0x76'),_0xca2e0[_0x86d3('0x44')]['id']['toString']())[_0x86d3('0x32')](_0x86d3('0x6d'),_0xca2e0[_0x86d3('0x41')][_0x86d3('0x77')]['toString']())[_0x86d3('0x32')](_0x86d3('0x78'))[_0x86d3('0x32')](_0x86d3('0x6f'),squel[_0x86d3('0x64')]()['field'](_0x86d3('0x5d'))[_0x86d3('0x6e')](_0x86d3('0x73'))[_0x86d3('0x32')](_0x86d3('0x76'),_0xca2e0[_0x86d3('0x44')]['id'][_0x86d3('0x6c')]()))[_0x86d3('0x32')](_0x86d3('0x6f'),squel[_0x86d3('0x64')]()['field']('calleridnum')[_0x86d3('0x6e')](_0x86d3('0x6a'))['where'](_0x86d3('0x76'),_0xca2e0[_0x86d3('0x44')]['id'][_0x86d3('0x6c')]())[_0x86d3('0x32')](_0x86d3('0x70')))[_0x86d3('0x71')](_0x86d3('0x5f')))[_0x86d3('0x6c')]();return db[_0x86d3('0x46')]['query'](_0x1c1384);}return[];})['then'](respondWithResult(_0x596b1d,null))['catch'](handleError(_0x596b1d,null));};exports['checkContactHopper']=function(_0xad83bf,_0x2514c1,_0x28a509){return db[_0x86d3('0x79')][_0x86d3('0x7a')]({'where':{'VoiceQueueId':_0xad83bf[_0x86d3('0x41')][_0x86d3('0x61')],'CampaignId':_0xad83bf['body'][_0x86d3('0x74')],'ContactId':_0xad83bf[_0x86d3('0x41')][_0x86d3('0x5f')]}})[_0x86d3('0x20')](handleEntityNotFound(_0x2514c1,null))['then'](function(_0xe239b5){if(_0xe239b5){return _0xe239b5;}return null;})['then'](respondWithResult(_0x2514c1,null))[_0x86d3('0x40')](handleError(_0x2514c1,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 6e0eaa5..cc32c5c 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 _0x74a1=['path','../../config/environment','./cmHopperFinal.attributes','exports','define','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x74a1,0x13f));var _0x174a=function(_0x11ed52,_0xe2c31f){_0x11ed52=_0x11ed52-0x0;var _0xeee5ea=_0x74a1[_0x11ed52];return _0xeee5ea;};'use strict';var _=require(_0x174a('0x0'));var util=require(_0x174a('0x1'));var logger=require(_0x174a('0x2'))(_0x174a('0x3'));var moment=require(_0x174a('0x4'));var BPromise=require('bluebird');var rp=require(_0x174a('0x5'));var fs=require('fs');var path=require(_0x174a('0x6'));var rimraf=require('rimraf');var config=require(_0x174a('0x7'));var attributes=require(_0x174a('0x8'));module[_0x174a('0x9')]=function(_0x487ca2,_0x16b612){return _0x487ca2[_0x174a('0xa')]('CmHopperFinal',attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x174a('0xb'),'fields':[_0x174a('0xb')]},{'name':_0x174a('0xc'),'fields':[_0x174a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2b2e=['../../config/environment','./cmHopperFinal.attributes','exports','CmHopperFinal','calleridnum','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1d29da,_0x2eb10d){var _0x2722ea=function(_0x5e721f){while(--_0x5e721f){_0x1d29da['push'](_0x1d29da['shift']());}};_0x2722ea(++_0x2eb10d);}(_0x2b2e,0x12c));var _0xe2b2=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x2b2e[_0x220dbb];return _0x2b77de;};'use strict';var _=require(_0xe2b2('0x0'));var util=require(_0xe2b2('0x1'));var logger=require('../../config/logger')(_0xe2b2('0x2'));var moment=require(_0xe2b2('0x3'));var BPromise=require(_0xe2b2('0x4'));var rp=require(_0xe2b2('0x5'));var fs=require('fs');var path=require(_0xe2b2('0x6'));var rimraf=require(_0xe2b2('0x7'));var config=require(_0xe2b2('0x8'));var attributes=require(_0xe2b2('0x9'));module[_0xe2b2('0xa')]=function(_0x3b04ca,_0x5c4542){return _0x3b04ca['define'](_0xe2b2('0xb'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0xe2b2('0xc'),'fields':[_0xe2b2('0xc')]},{'name':'uniqueid','fields':[_0xe2b2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 36f0ac5..9401e3c 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 _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(_0x5d92da,_0xe9723a){var _0x24fe12=function(_0x43bfb5){while(--_0x43bfb5){_0x5d92da['push'](_0x5d92da['shift']());}};_0x24fe12(++_0xe9723a);}(_0x7a54,0x106));var _0x47a5=function(_0x2b1e4f,_0x5e3229){_0x2b1e4f=_0x2b1e4f-0x0;var _0x501c33=_0x7a54[_0x2b1e4f];return _0x501c33;};'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 +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(_0x446cd2,_0x49cb17){var _0x100c0d=function(_0x1759a4){while(--_0x1759a4){_0x446cd2['push'](_0x446cd2['shift']());}};_0x100c0d(++_0x49cb17);}(_0xb10b,0x12a));var _0xbb10=function(_0x332d5c,_0x4a2336){_0x332d5c=_0x332d5c-0x0;var _0x47448d=_0xb10b[_0x332d5c];return _0x47448d;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 4207249..0dca3ef 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 _0xffad=['/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','util','connect-timeout','express','../../config/environment','./cmHopperFinal.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post'];(function(_0x13b5ad,_0x4a8940){var _0x53fd45=function(_0x5ec1c0){while(--_0x5ec1c0){_0x13b5ad['push'](_0x13b5ad['shift']());}};_0x53fd45(++_0x4a8940);}(_0xffad,0x175));var _0xdffa=function(_0x588794,_0x130e43){_0x588794=_0x588794-0x0;var _0x51032e=_0xffad[_0x588794];return _0x51032e;};'use strict';var multer=require(_0xdffa('0x0'));var util=require(_0xdffa('0x1'));var path=require('path');var timeout=require(_0xdffa('0x2'));var express=require(_0xdffa('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(_0xdffa('0x4'));var controller=require(_0xdffa('0x5'));router['get']('/',auth[_0xdffa('0x6')](),controller[_0xdffa('0x7')]);router['get'](_0xdffa('0x8'),auth[_0xdffa('0x6')](),controller[_0xdffa('0x9')]);router[_0xdffa('0xa')](_0xdffa('0xb'),auth[_0xdffa('0x6')](),controller[_0xdffa('0xc')]);router[_0xdffa('0xa')](_0xdffa('0xd'),auth[_0xdffa('0x6')](),controller['countContactsQueueCampaignHopperFinal']);router['get'](_0xdffa('0xe'),auth[_0xdffa('0x6')](),controller[_0xdffa('0xf')]);router[_0xdffa('0x10')](_0xdffa('0x11'),auth[_0xdffa('0x6')](),controller[_0xdffa('0x12')]);router[_0xdffa('0x10')](_0xdffa('0x13'),auth['isAuthenticated'](),controller[_0xdffa('0x14')]);router[_0xdffa('0x10')](_0xdffa('0x15'),auth[_0xdffa('0x6')](),controller[_0xdffa('0x16')]);router[_0xdffa('0x17')](_0xdffa('0xb'),auth[_0xdffa('0x6')](),controller[_0xdffa('0x18')]);module[_0xdffa('0x19')]=router; \ No newline at end of file +var _0xb9f7=['describe','/:id','show','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/checkContactHopper','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','index','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb9f7,0x18b));var _0x7b9f=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xb9f7[_0x17b6e3];return _0x3906f3;};'use strict';var multer=require(_0x7b9f('0x0'));var util=require(_0x7b9f('0x1'));var path=require(_0x7b9f('0x2'));var timeout=require(_0x7b9f('0x3'));var express=require('express');var router=express[_0x7b9f('0x4')]();var fs_extra=require(_0x7b9f('0x5'));var auth=require(_0x7b9f('0x6'));var interaction=require(_0x7b9f('0x7'));var config=require(_0x7b9f('0x8'));var controller=require(_0x7b9f('0x9'));router['get']('/',auth[_0x7b9f('0xa')](),controller[_0x7b9f('0xb')]);router[_0x7b9f('0xc')]('/describe',auth['isAuthenticated'](),controller[_0x7b9f('0xd')]);router[_0x7b9f('0xc')](_0x7b9f('0xe'),auth[_0x7b9f('0xa')](),controller[_0x7b9f('0xf')]);router['get']('/voice/queue/countAttributes/:id',auth[_0x7b9f('0xa')](),controller['countContactsQueueCampaignHopperFinal']);router['get'](_0x7b9f('0x10'),auth['isAuthenticated'](),controller[_0x7b9f('0x11')]);router[_0x7b9f('0x12')](_0x7b9f('0x13'),auth[_0x7b9f('0xa')](),controller[_0x7b9f('0x14')]);router[_0x7b9f('0x12')]('/voice/campaign/moveContacts/:id',auth['isAuthenticated'](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x7b9f('0x12')](_0x7b9f('0x15'),auth['isAuthenticated'](),controller['checkContactHopper']);router['put'](_0x7b9f('0xe'),auth[_0x7b9f('0xa')](),controller[_0x7b9f('0x16')]);module[_0x7b9f('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 733ffc1..4b5bbab 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 _0x53e2=['INTEGER','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x18ed72,_0x7607b){var _0x3b689d=function(_0x1a22aa){while(--_0x1a22aa){_0x18ed72['push'](_0x18ed72['shift']());}};_0x3b689d(++_0x7607b);}(_0x53e2,0x14e));var _0x253e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x53e2[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x253e('0x0'));module[_0x253e('0x1')]={'state':{'type':Sequelize[_0x253e('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x253e('0x3')]},'scheduledat':{'type':Sequelize[_0x253e('0x4')]},'countbusyretry':{'type':Sequelize[_0x253e('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x253e('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x253e('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x253e('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x253e('0x3')]},'originatecalleridname':{'type':Sequelize[_0x253e('0x3')]},'calleridnum':{'type':Sequelize[_0x253e('0x3')]},'calleridname':{'type':Sequelize[_0x253e('0x3')]},'starttime':{'type':Sequelize[_0x253e('0x4')]},'responsetime':{'type':Sequelize[_0x253e('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x253e('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x253e('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x253e('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x253e('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x253e('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x253e('0x4')]},'recallme':{'type':Sequelize[_0x253e('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x253e('0x4')]},'edited':{'type':Sequelize[_0x253e('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x253e('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x253e('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x253e('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x253e('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x253e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6462=['DATE','BOOLEAN','exports','INTEGER','STRING'];(function(_0x1a2ac5,_0x431ac7){var _0x2cedd0=function(_0x169aac){while(--_0x169aac){_0x1a2ac5['push'](_0x1a2ac5['shift']());}};_0x2cedd0(++_0x431ac7);}(_0x6462,0xd9));var _0x2646=function(_0x38d5ab,_0x4d1263){_0x38d5ab=_0x38d5ab-0x0;var _0x3cee80=_0x6462[_0x38d5ab];return _0x3cee80;};'use strict';var Sequelize=require('sequelize');module[_0x2646('0x0')]={'state':{'type':Sequelize[_0x2646('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x2646('0x2')]},'scheduledat':{'type':Sequelize[_0x2646('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2646('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2646('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x2646('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x2646('0x2')]},'originatecalleridname':{'type':Sequelize[_0x2646('0x2')]},'calleridnum':{'type':Sequelize[_0x2646('0x2')]},'calleridname':{'type':Sequelize[_0x2646('0x2')]},'starttime':{'type':Sequelize[_0x2646('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x2646('0x3')]},'droptime':{'type':Sequelize[_0x2646('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x2646('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x2646('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x2646('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x2646('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x2646('0x2')]},'campaign':{'type':Sequelize[_0x2646('0x2')]},'campaigntype':{'type':Sequelize[_0x2646('0x2')]},'membername':{'type':Sequelize[_0x2646('0x2')]},'reason':{'type':Sequelize[_0x2646('0x2')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x2646('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x2646('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x2646('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x2646('0x3')]},'edited':{'type':Sequelize[_0x2646('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2646('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2646('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2646('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x2646('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 929c77f..7bbb94c 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 _0xe6db=['order','sort','filters','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','keys','length','includeAll','find','create','describe','body','eml-format','rimraf','fast-json-patch','request-promise','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','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','CmHopperHistory','fieldName','type','key','model','map','query','intersection','attributes','fields','nolimit'];(function(_0x2c6e7c,_0x422235){var _0x376d42=function(_0x41441b){while(--_0x41441b){_0x2c6e7c['push'](_0x2c6e7c['shift']());}};_0x376d42(++_0x422235);}(_0xe6db,0xb2));var _0xbe6d=function(_0x9b8ece,_0xe835cb){_0x9b8ece=_0x9b8ece-0x0;var _0x53ea6d=_0xe6db[_0x9b8ece];return _0x53ea6d;};'use strict';var emlformat=require(_0xbe6d('0x0'));var rimraf=require(_0xbe6d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbe6d('0x2'));var rp=require(_0xbe6d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbe6d('0x4'));var util=require(_0xbe6d('0x5'));var path=require(_0xbe6d('0x6'));var sox=require(_0xbe6d('0x7'));var csv=require(_0xbe6d('0x8'));var ejs=require(_0xbe6d('0x9'));var fs=require('fs');var fs_extra=require(_0xbe6d('0xa'));var _=require(_0xbe6d('0xb'));var squel=require(_0xbe6d('0xc'));var crypto=require(_0xbe6d('0xd'));var jsforce=require(_0xbe6d('0xe'));var deskjs=require(_0xbe6d('0xf'));var toCsv=require(_0xbe6d('0x8'));var querystring=require(_0xbe6d('0x10'));var Papa=require(_0xbe6d('0x11'));var Redis=require(_0xbe6d('0x12'));var authService=require(_0xbe6d('0x13'));var qs=require(_0xbe6d('0x14'));var as=require(_0xbe6d('0x15'));var hardwareService=require(_0xbe6d('0x16'));var logger=require('../../config/logger')(_0xbe6d('0x17'));var utils=require('../../config/utils');var config=require(_0xbe6d('0x18'));var licenseUtil=require(_0xbe6d('0x19'));var db=require(_0xbe6d('0x1a'))['db'];function respondWithStatusCode(_0x15df5a,_0x165e96){_0x165e96=_0x165e96||0xcc;return function(_0x1a3ec7){if(_0x1a3ec7){return _0x15df5a[_0xbe6d('0x1b')](_0x165e96);}return _0x15df5a[_0xbe6d('0x1c')](_0x165e96)[_0xbe6d('0x1d')]();};}function respondWithResult(_0x163e28,_0x581a98){_0x581a98=_0x581a98||0xc8;return function(_0x294239){if(_0x294239){return _0x163e28[_0xbe6d('0x1c')](_0x581a98)[_0xbe6d('0x1e')](_0x294239);}};}function respondWithFilteredResult(_0xadbac4,_0x4f3681){return function(_0x3552f8){if(_0x3552f8){var _0x2acb69=typeof _0x4f3681[_0xbe6d('0x1f')]==='undefined'&&typeof _0x4f3681[_0xbe6d('0x20')]===_0xbe6d('0x21');var _0x272f20=_0x3552f8[_0xbe6d('0x22')];var _0x5328f2=_0x2acb69?0x0:_0x4f3681['offset'];var _0x4be41a=_0x2acb69?_0x3552f8[_0xbe6d('0x22')]:_0x4f3681[_0xbe6d('0x1f')]+_0x4f3681[_0xbe6d('0x20')];var _0x153417;if(_0x4be41a>=_0x272f20){_0x4be41a=_0x272f20;_0x153417=0xc8;}else{_0x153417=0xce;}_0xadbac4['status'](_0x153417);return _0xadbac4[_0xbe6d('0x23')](_0xbe6d('0x24'),_0x5328f2+'-'+_0x4be41a+'/'+_0x272f20)[_0xbe6d('0x1e')](_0x3552f8);}return null;};}function patchUpdates(_0x3835d1){return function(_0x2dbef6){try{jsonpatch[_0xbe6d('0x25')](_0x2dbef6,_0x3835d1,!![]);}catch(_0x3bc885){return BPromise[_0xbe6d('0x26')](_0x3bc885);}return _0x2dbef6[_0xbe6d('0x27')]();};}function saveUpdates(_0xbd7631,_0x42ea97){return function(_0x502e1e){if(_0x502e1e){return _0x502e1e[_0xbe6d('0x28')](_0xbd7631)[_0xbe6d('0x29')](function(_0xae2234){return _0xae2234;});}return null;};}function removeEntity(_0xb2115,_0x1d9c5b){return function(_0xf85b8f){if(_0xf85b8f){return _0xf85b8f['destroy']()['then'](function(){_0xb2115[_0xbe6d('0x1c')](0xcc)[_0xbe6d('0x1d')]();});}};}function handleEntityNotFound(_0x1f794d,_0xf3f28e){return function(_0x4e06fb){if(!_0x4e06fb){_0x1f794d[_0xbe6d('0x1b')](0x194);}return _0x4e06fb;};}function handleError(_0x636acf,_0x2a95ac){_0x2a95ac=_0x2a95ac||0x1f4;return function(_0x4db198){logger['error'](_0x4db198[_0xbe6d('0x2a')]);if(_0x4db198[_0xbe6d('0x2b')]){delete _0x4db198['name'];}_0x636acf['status'](_0x2a95ac)[_0xbe6d('0x2c')](_0x4db198);};}exports['index']=function(_0x1ab01d,_0x254787){var _0x1a5920={},_0x31c3ad={},_0x6b769a={'count':0x0,'rows':[]};var _0x15849b=_['map'](db[_0xbe6d('0x2d')]['rawAttributes'],function(_0x92238e){return{'name':_0x92238e[_0xbe6d('0x2e')],'type':_0x92238e[_0xbe6d('0x2f')][_0xbe6d('0x30')]};});_0x31c3ad[_0xbe6d('0x31')]=_[_0xbe6d('0x32')](_0x15849b,_0xbe6d('0x2b'));_0x31c3ad[_0xbe6d('0x33')]=_['keys'](_0x1ab01d[_0xbe6d('0x33')]);_0x31c3ad['filters']=_[_0xbe6d('0x34')](_0x31c3ad['model'],_0x31c3ad[_0xbe6d('0x33')]);_0x1a5920[_0xbe6d('0x35')]=_[_0xbe6d('0x34')](_0x31c3ad[_0xbe6d('0x31')],qs[_0xbe6d('0x36')](_0x1ab01d[_0xbe6d('0x33')][_0xbe6d('0x36')]));_0x1a5920[_0xbe6d('0x35')]=_0x1a5920[_0xbe6d('0x35')]['length']?_0x1a5920[_0xbe6d('0x35')]:_0x31c3ad[_0xbe6d('0x31')];if(!_0x1ab01d[_0xbe6d('0x33')]['hasOwnProperty'](_0xbe6d('0x37'))){_0x1a5920['limit']=qs[_0xbe6d('0x20')](_0x1ab01d[_0xbe6d('0x33')]['limit']);_0x1a5920[_0xbe6d('0x1f')]=qs[_0xbe6d('0x1f')](_0x1ab01d['query'][_0xbe6d('0x1f')]);}_0x1a5920[_0xbe6d('0x38')]=qs[_0xbe6d('0x39')](_0x1ab01d['query'][_0xbe6d('0x39')]);_0x1a5920['where']=qs[_0xbe6d('0x3a')](_[_0xbe6d('0x3b')](_0x1ab01d[_0xbe6d('0x33')],_0x31c3ad[_0xbe6d('0x3a')]),_0x15849b);if(_0x1ab01d[_0xbe6d('0x33')]['filter']){_0x1a5920[_0xbe6d('0x3c')]=_[_0xbe6d('0x3d')](_0x1a5920[_0xbe6d('0x3c')],{'$or':_[_0xbe6d('0x32')](_0x15849b,function(_0x139584){if(_0x139584[_0xbe6d('0x2f')]!==_0xbe6d('0x3e')){var _0x4e80a7={};_0x4e80a7[_0x139584['name']]={'$like':'%'+_0x1ab01d['query'][_0xbe6d('0x3f')]+'%'};return _0x4e80a7;}})});}_0x1a5920=_['merge']({},_0x1a5920,_0x1ab01d[_0xbe6d('0x40')]);var _0x1846a6={'where':_0x1a5920[_0xbe6d('0x3c')]};return db['CmHopperHistory'][_0xbe6d('0x22')](_0x1846a6)[_0xbe6d('0x29')](function(_0x155c53){_0x6b769a[_0xbe6d('0x22')]=_0x155c53;if(_0x1ab01d[_0xbe6d('0x33')]['includeAll']){_0x1a5920[_0xbe6d('0x41')]=[{'all':!![]}];}return db[_0xbe6d('0x2d')][_0xbe6d('0x42')](_0x1a5920);})[_0xbe6d('0x29')](function(_0x35a08b){_0x6b769a[_0xbe6d('0x43')]=_0x35a08b;return _0x6b769a;})[_0xbe6d('0x29')](respondWithFilteredResult(_0x254787,_0x1a5920))[_0xbe6d('0x44')](handleError(_0x254787,null));};exports[_0xbe6d('0x45')]=function(_0x19517b,_0x44ce96){var _0x55e9a9={'raw':!![],'where':{'id':_0x19517b[_0xbe6d('0x46')]['id']}},_0xb24f5={};_0xb24f5[_0xbe6d('0x31')]=_[_0xbe6d('0x47')](db[_0xbe6d('0x2d')]['rawAttributes']);_0xb24f5[_0xbe6d('0x33')]=_[_0xbe6d('0x47')](_0x19517b[_0xbe6d('0x33')]);_0xb24f5[_0xbe6d('0x3a')]=_[_0xbe6d('0x34')](_0xb24f5['model'],_0xb24f5[_0xbe6d('0x33')]);_0x55e9a9[_0xbe6d('0x35')]=_[_0xbe6d('0x34')](_0xb24f5[_0xbe6d('0x31')],qs[_0xbe6d('0x36')](_0x19517b['query'][_0xbe6d('0x36')]));_0x55e9a9['attributes']=_0x55e9a9[_0xbe6d('0x35')][_0xbe6d('0x48')]?_0x55e9a9[_0xbe6d('0x35')]:_0xb24f5[_0xbe6d('0x31')];if(_0x19517b[_0xbe6d('0x33')][_0xbe6d('0x49')]){_0x55e9a9[_0xbe6d('0x41')]=[{'all':!![]}];}_0x55e9a9=_[_0xbe6d('0x3d')]({},_0x55e9a9,_0x19517b[_0xbe6d('0x40')]);return db[_0xbe6d('0x2d')][_0xbe6d('0x4a')](_0x55e9a9)[_0xbe6d('0x29')](handleEntityNotFound(_0x44ce96,null))[_0xbe6d('0x29')](respondWithResult(_0x44ce96,null))[_0xbe6d('0x44')](handleError(_0x44ce96,null));};exports[_0xbe6d('0x4b')]=function(_0x487902,_0x2dd851){return db['CmHopperHistory'][_0xbe6d('0x4b')](_0x487902['body'],{})[_0xbe6d('0x29')](respondWithResult(_0x2dd851,0xc9))[_0xbe6d('0x44')](handleError(_0x2dd851,null));};exports[_0xbe6d('0x4c')]=function(_0x33267e,_0x2e84a1){return db[_0xbe6d('0x2d')][_0xbe6d('0x4c')]()[_0xbe6d('0x29')](respondWithResult(_0x2e84a1,null))[_0xbe6d('0x44')](handleError(_0x2e84a1,null));};exports['update']=function(_0x2b5cee,_0x369396){if(_0x2b5cee['body']['uniqueid']){delete _0x2b5cee[_0xbe6d('0x4d')]['uniqueid'];}return db[_0xbe6d('0x2d')]['find']({'where':{'uniqueid':_0x2b5cee[_0xbe6d('0x46')]['id']}})['then'](handleEntityNotFound(_0x369396,null))[_0xbe6d('0x29')](saveUpdates(_0x2b5cee['body'],null))[_0xbe6d('0x29')](respondWithResult(_0x369396,null))['catch'](handleError(_0x369396,null));}; \ No newline at end of file +var _0x7e66=['query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','catch','show','include','options','find','create','body','describe','update','params','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','end','error','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','name'];(function(_0x347efc,_0x48f4b){var _0x47fe0a=function(_0x497301){while(--_0x497301){_0x347efc['push'](_0x347efc['shift']());}};_0x47fe0a(++_0x48f4b);}(_0x7e66,0xf4));var _0x67e6=function(_0x43f929,_0x27e736){_0x43f929=_0x43f929-0x0;var _0x283813=_0x7e66[_0x43f929];return _0x283813;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x67e6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x67e6('0x1'));var rp=require(_0x67e6('0x2'));var moment=require(_0x67e6('0x3'));var BPromise=require(_0x67e6('0x4'));var Mustache=require(_0x67e6('0x5'));var util=require(_0x67e6('0x6'));var path=require('path');var sox=require(_0x67e6('0x7'));var csv=require(_0x67e6('0x8'));var ejs=require(_0x67e6('0x9'));var fs=require('fs');var fs_extra=require(_0x67e6('0xa'));var _=require(_0x67e6('0xb'));var squel=require('squel');var crypto=require(_0x67e6('0xc'));var jsforce=require(_0x67e6('0xd'));var deskjs=require(_0x67e6('0xe'));var toCsv=require(_0x67e6('0x8'));var querystring=require(_0x67e6('0xf'));var Papa=require(_0x67e6('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x67e6('0x11'));var hardwareService=require(_0x67e6('0x12'));var logger=require(_0x67e6('0x13'))('api');var utils=require(_0x67e6('0x14'));var config=require(_0x67e6('0x15'));var licenseUtil=require(_0x67e6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59b2d9,_0x30956e){_0x30956e=_0x30956e||0xcc;return function(_0x5095a6){if(_0x5095a6){return _0x59b2d9[_0x67e6('0x17')](_0x30956e);}return _0x59b2d9[_0x67e6('0x18')](_0x30956e)['end']();};}function respondWithResult(_0x4e2950,_0x2c350e){_0x2c350e=_0x2c350e||0xc8;return function(_0x1a453c){if(_0x1a453c){return _0x4e2950[_0x67e6('0x18')](_0x2c350e)[_0x67e6('0x19')](_0x1a453c);}};}function respondWithFilteredResult(_0x14f49a,_0x16c4d6){return function(_0x1096cf){if(_0x1096cf){var _0x3b13cf=typeof _0x16c4d6[_0x67e6('0x1a')]===_0x67e6('0x1b')&&typeof _0x16c4d6[_0x67e6('0x1c')]===_0x67e6('0x1b');var _0x16dbc5=_0x1096cf[_0x67e6('0x1d')];var _0x3d4bd8=_0x3b13cf?0x0:_0x16c4d6[_0x67e6('0x1a')];var _0x543b6c=_0x3b13cf?_0x1096cf[_0x67e6('0x1d')]:_0x16c4d6[_0x67e6('0x1a')]+_0x16c4d6[_0x67e6('0x1c')];var _0x4125c6;if(_0x543b6c>=_0x16dbc5){_0x543b6c=_0x16dbc5;_0x4125c6=0xc8;}else{_0x4125c6=0xce;}_0x14f49a[_0x67e6('0x18')](_0x4125c6);return _0x14f49a[_0x67e6('0x1e')](_0x67e6('0x1f'),_0x3d4bd8+'-'+_0x543b6c+'/'+_0x16dbc5)[_0x67e6('0x19')](_0x1096cf);}return null;};}function patchUpdates(_0x13d92c){return function(_0x4b442e){try{jsonpatch[_0x67e6('0x20')](_0x4b442e,_0x13d92c,!![]);}catch(_0x33d39b){return BPromise[_0x67e6('0x21')](_0x33d39b);}return _0x4b442e[_0x67e6('0x22')]();};}function saveUpdates(_0x2bade,_0x5bb4df){return function(_0x3e2840){if(_0x3e2840){return _0x3e2840['update'](_0x2bade)[_0x67e6('0x23')](function(_0x5e3381){return _0x5e3381;});}return null;};}function removeEntity(_0x1934a5,_0x50d6fc){return function(_0x121713){if(_0x121713){return _0x121713['destroy']()[_0x67e6('0x23')](function(){_0x1934a5[_0x67e6('0x18')](0xcc)[_0x67e6('0x24')]();});}};}function handleEntityNotFound(_0x1ae6cf,_0x4b877a){return function(_0x353358){if(!_0x353358){_0x1ae6cf[_0x67e6('0x17')](0x194);}return _0x353358;};}function handleError(_0x4ac61e,_0x9b8e82){_0x9b8e82=_0x9b8e82||0x1f4;return function(_0x300d7e){logger[_0x67e6('0x25')](_0x300d7e['stack']);if(_0x300d7e['name']){delete _0x300d7e['name'];}_0x4ac61e['status'](_0x9b8e82)[_0x67e6('0x26')](_0x300d7e);};}exports[_0x67e6('0x27')]=function(_0x1b886b,_0x389046){var _0xffb802={},_0x1f4ff4={},_0xd5478a={'count':0x0,'rows':[]};var _0x49c4f2=_[_0x67e6('0x28')](db[_0x67e6('0x29')][_0x67e6('0x2a')],function(_0x21b398){return{'name':_0x21b398[_0x67e6('0x2b')],'type':_0x21b398[_0x67e6('0x2c')][_0x67e6('0x2d')]};});_0x1f4ff4[_0x67e6('0x2e')]=_[_0x67e6('0x28')](_0x49c4f2,_0x67e6('0x2f'));_0x1f4ff4[_0x67e6('0x30')]=_[_0x67e6('0x31')](_0x1b886b[_0x67e6('0x30')]);_0x1f4ff4[_0x67e6('0x32')]=_['intersection'](_0x1f4ff4['model'],_0x1f4ff4[_0x67e6('0x30')]);_0xffb802[_0x67e6('0x33')]=_[_0x67e6('0x34')](_0x1f4ff4[_0x67e6('0x2e')],qs[_0x67e6('0x35')](_0x1b886b[_0x67e6('0x30')][_0x67e6('0x35')]));_0xffb802['attributes']=_0xffb802['attributes'][_0x67e6('0x36')]?_0xffb802[_0x67e6('0x33')]:_0x1f4ff4[_0x67e6('0x2e')];if(!_0x1b886b['query'][_0x67e6('0x37')](_0x67e6('0x38'))){_0xffb802[_0x67e6('0x1c')]=qs[_0x67e6('0x1c')](_0x1b886b['query'][_0x67e6('0x1c')]);_0xffb802['offset']=qs[_0x67e6('0x1a')](_0x1b886b[_0x67e6('0x30')][_0x67e6('0x1a')]);}_0xffb802['order']=qs[_0x67e6('0x39')](_0x1b886b['query']['sort']);_0xffb802[_0x67e6('0x3a')]=qs[_0x67e6('0x32')](_['pick'](_0x1b886b[_0x67e6('0x30')],_0x1f4ff4[_0x67e6('0x32')]),_0x49c4f2);if(_0x1b886b[_0x67e6('0x30')][_0x67e6('0x3b')]){_0xffb802[_0x67e6('0x3a')]=_[_0x67e6('0x3c')](_0xffb802['where'],{'$or':_[_0x67e6('0x28')](_0x49c4f2,function(_0x5facdc){if(_0x5facdc[_0x67e6('0x2c')]!==_0x67e6('0x3d')){var _0x3124d9={};_0x3124d9[_0x5facdc[_0x67e6('0x2f')]]={'$like':'%'+_0x1b886b[_0x67e6('0x30')]['filter']+'%'};return _0x3124d9;}})});}_0xffb802=_[_0x67e6('0x3c')]({},_0xffb802,_0x1b886b['options']);var _0x43c74a={'where':_0xffb802[_0x67e6('0x3a')]};return db['CmHopperHistory'][_0x67e6('0x1d')](_0x43c74a)[_0x67e6('0x23')](function(_0x46fe98){_0xd5478a[_0x67e6('0x1d')]=_0x46fe98;if(_0x1b886b['query'][_0x67e6('0x3e')]){_0xffb802['include']=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0xffb802);})[_0x67e6('0x23')](function(_0x21ce7){_0xd5478a['rows']=_0x21ce7;return _0xd5478a;})[_0x67e6('0x23')](respondWithFilteredResult(_0x389046,_0xffb802))[_0x67e6('0x3f')](handleError(_0x389046,null));};exports[_0x67e6('0x40')]=function(_0x5efc64,_0x49cd2a){var _0x3a392a={'raw':!![],'where':{'id':_0x5efc64['params']['id']}},_0xeee302={};_0xeee302[_0x67e6('0x2e')]=_['keys'](db[_0x67e6('0x29')][_0x67e6('0x2a')]);_0xeee302[_0x67e6('0x30')]=_['keys'](_0x5efc64['query']);_0xeee302['filters']=_['intersection'](_0xeee302[_0x67e6('0x2e')],_0xeee302['query']);_0x3a392a['attributes']=_['intersection'](_0xeee302[_0x67e6('0x2e')],qs[_0x67e6('0x35')](_0x5efc64[_0x67e6('0x30')][_0x67e6('0x35')]));_0x3a392a[_0x67e6('0x33')]=_0x3a392a[_0x67e6('0x33')]['length']?_0x3a392a['attributes']:_0xeee302['model'];if(_0x5efc64[_0x67e6('0x30')][_0x67e6('0x3e')]){_0x3a392a[_0x67e6('0x41')]=[{'all':!![]}];}_0x3a392a=_[_0x67e6('0x3c')]({},_0x3a392a,_0x5efc64[_0x67e6('0x42')]);return db['CmHopperHistory'][_0x67e6('0x43')](_0x3a392a)['then'](handleEntityNotFound(_0x49cd2a,null))[_0x67e6('0x23')](respondWithResult(_0x49cd2a,null))['catch'](handleError(_0x49cd2a,null));};exports[_0x67e6('0x44')]=function(_0x3c6fc8,_0x532f47){return db[_0x67e6('0x29')][_0x67e6('0x44')](_0x3c6fc8[_0x67e6('0x45')],{})[_0x67e6('0x23')](respondWithResult(_0x532f47,0xc9))['catch'](handleError(_0x532f47,null));};exports[_0x67e6('0x46')]=function(_0x4d0a6a,_0x160421){return db[_0x67e6('0x29')][_0x67e6('0x46')]()[_0x67e6('0x23')](respondWithResult(_0x160421,null))['catch'](handleError(_0x160421,null));};exports[_0x67e6('0x47')]=function(_0x21c6ff,_0x50a72f){if(_0x21c6ff['body']['uniqueid']){delete _0x21c6ff[_0x67e6('0x45')]['uniqueid'];}return db[_0x67e6('0x29')]['find']({'where':{'uniqueid':_0x21c6ff[_0x67e6('0x48')]['id']}})['then'](handleEntityNotFound(_0x50a72f,null))['then'](saveUpdates(_0x21c6ff['body'],null))[_0x67e6('0x23')](respondWithResult(_0x50a72f,null))['catch'](handleError(_0x50a72f,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index dd0e629..1299a71 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 _0xdab3=['moment','bluebird','request-promise','path','rimraf','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','api'];(function(_0x1bd323,_0x1c16ab){var _0x13097b=function(_0x4cc5de){while(--_0x4cc5de){_0x1bd323['push'](_0x1bd323['shift']());}};_0x13097b(++_0x1c16ab);}(_0xdab3,0xeb));var _0x3dab=function(_0x52ddad,_0x154c16){_0x52ddad=_0x52ddad-0x0;var _0x589e64=_0xdab3[_0x52ddad];return _0x589e64;};'use strict';var _=require(_0x3dab('0x0'));var util=require(_0x3dab('0x1'));var logger=require('../../config/logger')(_0x3dab('0x2'));var moment=require(_0x3dab('0x3'));var BPromise=require(_0x3dab('0x4'));var rp=require(_0x3dab('0x5'));var fs=require('fs');var path=require(_0x3dab('0x6'));var rimraf=require(_0x3dab('0x7'));var config=require('../../config/environment');var attributes=require('./cmHopperHistory.attributes');module[_0x3dab('0x8')]=function(_0x2e95d1,_0x2e3718){return _0x2e95d1[_0x3dab('0x9')](_0x3dab('0xa'),attributes,{'tableName':_0x3dab('0xb'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x3dab('0xc')]},{'name':_0x3dab('0xd'),'fields':[_0x3dab('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2c16=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','CmHopperHistory','cm_hopper_history','endtime','uniqueid'];(function(_0x2ae21d,_0xa47c67){var _0x1523df=function(_0x2c23cb){while(--_0x2c23cb){_0x2ae21d['push'](_0x2ae21d['shift']());}};_0x1523df(++_0xa47c67);}(_0x2c16,0xf0));var _0x62c1=function(_0x14365f,_0x2d60a1){_0x14365f=_0x14365f-0x0;var _0x46f191=_0x2c16[_0x14365f];return _0x46f191;};'use strict';var _=require(_0x62c1('0x0'));var util=require(_0x62c1('0x1'));var logger=require(_0x62c1('0x2'))('api');var moment=require(_0x62c1('0x3'));var BPromise=require(_0x62c1('0x4'));var rp=require(_0x62c1('0x5'));var fs=require('fs');var path=require(_0x62c1('0x6'));var rimraf=require(_0x62c1('0x7'));var config=require(_0x62c1('0x8'));var attributes=require(_0x62c1('0x9'));module[_0x62c1('0xa')]=function(_0x34eca5,_0x24f289){return _0x34eca5['define'](_0x62c1('0xb'),attributes,{'tableName':_0x62c1('0xc'),'paranoid':![],'indexes':[{'name':_0x62c1('0xd'),'fields':['endtime']},{'name':_0x62c1('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 6ddf30d..b9f0296 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 _0xfaa4=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CmHopperHistory','create','options','raw','CreateCmHopperHistory','AvgHandleTime','findAll','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','`state`\x20=\x204,\x20`holdtime`,\x20null','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','stringify','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','where','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xfaa4,0x1a8));var _0x4faa=function(_0x3c9970,_0x2a46cc){_0x3c9970=_0x3c9970-0x0;var _0x249e86=_0xfaa4[_0x3c9970];return _0x249e86;};'use strict';var _=require(_0x4faa('0x0'));var util=require(_0x4faa('0x1'));var moment=require(_0x4faa('0x2'));var BPromise=require(_0x4faa('0x3'));var rs=require(_0x4faa('0x4'));var fs=require('fs');var Redis=require(_0x4faa('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4faa('0x6'));var logger=require(_0x4faa('0x7'))(_0x4faa('0x8'));var config=require(_0x4faa('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4faa('0xa')][_0x4faa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa46a7d,_0x504f83,_0x528871){return new BPromise(function(_0x5d476f,_0x159843){return client[_0x4faa('0xc')](_0xa46a7d,_0x528871)[_0x4faa('0xd')](function(_0x4dd4d4){logger[_0x4faa('0xe')](_0x4faa('0xf'),_0x504f83,_0x4faa('0x10'));logger[_0x4faa('0x11')](_0x4faa('0x12'),_0x504f83,'request\x20sent',JSON['stringify'](_0x4dd4d4));if(_0x4dd4d4[_0x4faa('0x13')]){if(_0x4dd4d4[_0x4faa('0x13')][_0x4faa('0x14')]===0x1f4){logger[_0x4faa('0x13')](_0x4faa('0xf'),_0x504f83,_0x4dd4d4[_0x4faa('0x13')][_0x4faa('0x15')]);return _0x159843(_0x4dd4d4[_0x4faa('0x13')][_0x4faa('0x15')]);}logger[_0x4faa('0x13')](_0x4faa('0xf'),_0x504f83,_0x4dd4d4[_0x4faa('0x13')][_0x4faa('0x15')]);return _0x5d476f(_0x4dd4d4['error'][_0x4faa('0x15')]);}else{logger[_0x4faa('0xe')](_0x4faa('0xf'),_0x504f83,'request\x20sent');_0x5d476f(_0x4dd4d4[_0x4faa('0x16')][_0x4faa('0x15')]);}})[_0x4faa('0x17')](function(_0x536a2b){logger[_0x4faa('0x13')](_0x4faa('0xf'),_0x504f83,_0x536a2b);_0x159843(_0x536a2b);});});}exports['CreateCmHopperHistory']=function(_0x5d8c8a){var _0x5444d9=this;return new Promise(function(_0x33592d,_0x361cdc){return db[_0x4faa('0x18')][_0x4faa('0x19')](_0x5d8c8a['body'],{'raw':_0x5d8c8a[_0x4faa('0x1a')]?_0x5d8c8a[_0x4faa('0x1a')][_0x4faa('0x1b')]===undefined?!![]:![]:!![]})[_0x4faa('0xd')](function(_0x492417){logger[_0x4faa('0xe')]('CreateCmHopperHistory',_0x5d8c8a);logger['debug'](_0x4faa('0x1c'),_0x5d8c8a,JSON['stringify'](_0x492417));_0x33592d(_0x492417);})['catch'](function(_0x14683b){logger[_0x4faa('0x13')](_0x4faa('0x1c'),_0x14683b[_0x4faa('0x15')],_0x5d8c8a);_0x361cdc(_0x5444d9[_0x4faa('0x13')](0x1f4,_0x14683b[_0x4faa('0x15')]));});});};exports[_0x4faa('0x1d')]=function(_0x177774){var _0x5087ca=this;return new Promise(function(_0x1049a6,_0xe6992){return db['CmHopperHistory'][_0x4faa('0x1e')]({'raw':_0x177774[_0x4faa('0x1a')]?_0x177774[_0x4faa('0x1a')][_0x4faa('0x1b')]===undefined?!![]:![]:!![],'where':_0x177774['options']?_0x177774[_0x4faa('0x1a')]['where']||null:null,'attributes':[[db[_0x4faa('0x1f')]['fn'](_0x4faa('0x20'),db[_0x4faa('0x1f')][_0x4faa('0x21')]('id')),_0x4faa('0x22')],[db[_0x4faa('0x1f')]['fn']('COUNT',db[_0x4faa('0x1f')]['fn']('IF',db[_0x4faa('0x1f')][_0x4faa('0x23')](_0x4faa('0x24')))),'predictiveIntervalAnsweredCalls'],[db['sequelize']['fn'](_0x4faa('0x20'),db[_0x4faa('0x1f')]['fn']('IF',db[_0x4faa('0x1f')]['literal'](_0x4faa('0x25')))),_0x4faa('0x26')],[db[_0x4faa('0x1f')]['fn'](_0x4faa('0x20'),db[_0x4faa('0x1f')]['fn']('IF',db[_0x4faa('0x1f')]['literal'](_0x4faa('0x27')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x4faa('0x1f')]['fn']('AVG',db[_0x4faa('0x1f')]['fn']('IF',db[_0x4faa('0x1f')][_0x4faa('0x23')](_0x4faa('0x28')))),'predictiveIntervalAvgHoldtime'],[db[_0x4faa('0x1f')]['fn'](_0x4faa('0x29'),db[_0x4faa('0x1f')]['fn']('IF',db[_0x4faa('0x1f')][_0x4faa('0x23')](_0x4faa('0x2a')))),_0x4faa('0x2b')]]})[_0x4faa('0xd')](function(_0x4ebbef){logger[_0x4faa('0xe')](_0x4faa('0x1d'),_0x177774);logger[_0x4faa('0x11')]('AvgHandleTime',_0x177774,JSON[_0x4faa('0x2c')](_0x4ebbef));_0x1049a6(_0x4ebbef);})[_0x4faa('0x17')](function(_0x244c22){logger[_0x4faa('0x13')](_0x4faa('0x1d'),_0x244c22[_0x4faa('0x15')],_0x177774);_0xe6992(_0x5087ca[_0x4faa('0x13')](0x1f4,_0x244c22[_0x4faa('0x15')]));});});};exports[_0x4faa('0x2d')]=function(_0x477313){var _0x39b9bc=this;return new Promise(function(_0x1e355e,_0x2e4a87){return db[_0x4faa('0x18')]['findAll']({'raw':_0x477313[_0x4faa('0x1a')]?_0x477313['options']['raw']===undefined?!![]:![]:!![],'where':_0x477313[_0x4faa('0x1a')]?_0x477313[_0x4faa('0x1a')]['where']||null:null,'attributes':[[_0x4faa('0x2e'),_0x4faa('0x2f')],[db[_0x4faa('0x1f')]['fn'](_0x4faa('0x20'),db[_0x4faa('0x1f')]['fn']('IF',db['sequelize'][_0x4faa('0x23')](_0x4faa('0x30')))),_0x4faa('0x31')],[db[_0x4faa('0x1f')]['fn'](_0x4faa('0x20'),db[_0x4faa('0x1f')]['fn']('IF',db[_0x4faa('0x1f')]['literal'](_0x4faa('0x32')))),_0x4faa('0x33')],[db[_0x4faa('0x1f')]['fn'](_0x4faa('0x20'),db[_0x4faa('0x1f')]['fn']('IF',db[_0x4faa('0x1f')][_0x4faa('0x23')](_0x4faa('0x24')))),_0x4faa('0x34')],[db['sequelize']['fn'](_0x4faa('0x20'),db[_0x4faa('0x1f')]['fn']('IF',db[_0x4faa('0x1f')][_0x4faa('0x23')](_0x4faa('0x35')))),'outboundBusyCallsDay'],[db[_0x4faa('0x1f')]['fn'](_0x4faa('0x20'),db[_0x4faa('0x1f')]['fn']('IF',db['sequelize'][_0x4faa('0x23')](_0x4faa('0x36')))),_0x4faa('0x37')],[db['sequelize']['fn'](_0x4faa('0x20'),db[_0x4faa('0x1f')]['fn']('IF',db[_0x4faa('0x1f')][_0x4faa('0x23')](_0x4faa('0x38')))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn'](_0x4faa('0x20'),db[_0x4faa('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x4faa('0x39')))),_0x4faa('0x3a')],[db[_0x4faa('0x1f')]['fn'](_0x4faa('0x20'),db['sequelize']['fn']('IF',db[_0x4faa('0x1f')][_0x4faa('0x23')]('`state`\x20=\x2012,\x201,\x20null'))),_0x4faa('0x3b')],[db[_0x4faa('0x1f')]['fn'](_0x4faa('0x20'),db[_0x4faa('0x1f')]['fn']('IF',db[_0x4faa('0x1f')][_0x4faa('0x23')](_0x4faa('0x3c')))),_0x4faa('0x3d')],[db['sequelize']['fn'](_0x4faa('0x20'),db[_0x4faa('0x1f')]['fn']('IF',db[_0x4faa('0x1f')][_0x4faa('0x23')](_0x4faa('0x3e')))),_0x4faa('0x3f')],[db['sequelize']['fn']('COUNT',db[_0x4faa('0x1f')]['fn']('IF',db[_0x4faa('0x1f')][_0x4faa('0x23')](_0x4faa('0x40')))),_0x4faa('0x41')],[db['sequelize']['fn']('COUNT',db[_0x4faa('0x1f')]['fn']('IF',db[_0x4faa('0x1f')][_0x4faa('0x23')]('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db['sequelize']['fn'](_0x4faa('0x20'),db[_0x4faa('0x1f')]['fn']('IF',db['sequelize'][_0x4faa('0x23')](_0x4faa('0x42')))),_0x4faa('0x41')],[db[_0x4faa('0x1f')]['fn'](_0x4faa('0x20'),db[_0x4faa('0x1f')]['fn']('IF',db[_0x4faa('0x1f')][_0x4faa('0x23')](_0x4faa('0x43')))),'outboundReCallsDay']],'group':[_0x4faa('0x2e')]})[_0x4faa('0xd')](function(_0x11f544){logger['info'](_0x4faa('0x2d'),_0x477313);logger['debug']('GetVoiceQueueHopperHistory',_0x477313,JSON['stringify'](_0x11f544));_0x1e355e(_0x11f544);})[_0x4faa('0x17')](function(_0x307eb2){logger['error'](_0x4faa('0x2d'),_0x307eb2[_0x4faa('0x15')],_0x477313);_0x2e4a87(_0x39b9bc[_0x4faa('0x13')](0x1f4,_0x307eb2[_0x4faa('0x15')]));});});};exports['GetCampaignHopperHistory']=function(_0x47c3ab){var _0x3a43e3=this;return new Promise(function(_0x1462ba,_0x3cf67e){return db[_0x4faa('0x18')][_0x4faa('0x1e')]({'raw':_0x47c3ab['options']?_0x47c3ab[_0x4faa('0x1a')][_0x4faa('0x1b')]===undefined?!![]:![]:!![],'where':_0x47c3ab['options']?_0x47c3ab[_0x4faa('0x1a')][_0x4faa('0x44')]||null:null,'attributes':[['campaign',_0x4faa('0x2f')],[db[_0x4faa('0x1f')]['fn'](_0x4faa('0x20'),db[_0x4faa('0x1f')][_0x4faa('0x21')]('id')),'ivrTotalCallsDays'],[db[_0x4faa('0x1f')]['fn']('COUNT',db[_0x4faa('0x1f')]['fn']('IF',db['sequelize'][_0x4faa('0x23')](_0x4faa('0x24')))),_0x4faa('0x45')]],'group':['campaign']})['then'](function(_0x1cd9c8){logger['info'](_0x4faa('0x46'),_0x47c3ab);logger[_0x4faa('0x11')](_0x4faa('0x46'),_0x47c3ab,JSON[_0x4faa('0x2c')](_0x1cd9c8));_0x1462ba(_0x1cd9c8);})[_0x4faa('0x17')](function(_0x949e25){logger[_0x4faa('0x13')]('GetCampaignHopperHistory',_0x949e25[_0x4faa('0x15')],_0x47c3ab);_0x3cf67e(_0x3a43e3[_0x4faa('0x13')](0x1f4,_0x949e25[_0x4faa('0x15')]));});});}; \ No newline at end of file +var _0x8029=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','CreateCmHopperHistory','body','options','raw','debug','CmHopperHistory','sequelize','COUNT','col','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','AvgHandleTime','GetVoiceQueueHopperHistory','findAll','where','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','outboundBusyCallsDay','`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','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','outboundReCallsDay','campaign','GetCampaignHopperHistory','`state`\x20=\x204,\x201,\x20null','ivrAnswerCallsDay'];(function(_0x29711a,_0x389c71){var _0x3467ea=function(_0x55dc22){while(--_0x55dc22){_0x29711a['push'](_0x29711a['shift']());}};_0x3467ea(++_0x389c71);}(_0x8029,0xf8));var _0x9802=function(_0x5c40c1,_0x2791a2){_0x5c40c1=_0x5c40c1-0x0;var _0x71a032=_0x8029[_0x5c40c1];return _0x71a032;};'use strict';var _=require(_0x9802('0x0'));var util=require(_0x9802('0x1'));var moment=require('moment');var BPromise=require(_0x9802('0x2'));var rs=require(_0x9802('0x3'));var fs=require('fs');var Redis=require(_0x9802('0x4'));var db=require(_0x9802('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9802('0x6'));var config=require(_0x9802('0x7'));var jayson=require(_0x9802('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x52f9a0,_0x39f748,_0xa50d40){return new BPromise(function(_0x1d1405,_0x331bb1){return client['request'](_0x52f9a0,_0xa50d40)[_0x9802('0x9')](function(_0x2930eb){logger['info'](_0x9802('0xa'),_0x39f748,_0x9802('0xb'));logger['debug']('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x39f748,'request\x20sent',JSON[_0x9802('0xc')](_0x2930eb));if(_0x2930eb[_0x9802('0xd')]){if(_0x2930eb[_0x9802('0xd')][_0x9802('0xe')]===0x1f4){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x39f748,_0x2930eb[_0x9802('0xd')][_0x9802('0xf')]);return _0x331bb1(_0x2930eb[_0x9802('0xd')][_0x9802('0xf')]);}logger[_0x9802('0xd')](_0x9802('0xa'),_0x39f748,_0x2930eb[_0x9802('0xd')][_0x9802('0xf')]);return _0x1d1405(_0x2930eb[_0x9802('0xd')][_0x9802('0xf')]);}else{logger[_0x9802('0x10')](_0x9802('0xa'),_0x39f748,_0x9802('0xb'));_0x1d1405(_0x2930eb['result']['message']);}})[_0x9802('0x11')](function(_0x440c8d){logger[_0x9802('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x39f748,_0x440c8d);_0x331bb1(_0x440c8d);});});}exports[_0x9802('0x12')]=function(_0x1fd296){var _0x1b43f2=this;return new Promise(function(_0xa753e,_0x181a84){return db['CmHopperHistory']['create'](_0x1fd296[_0x9802('0x13')],{'raw':_0x1fd296[_0x9802('0x14')]?_0x1fd296[_0x9802('0x14')][_0x9802('0x15')]===undefined?!![]:![]:!![]})[_0x9802('0x9')](function(_0x567eed){logger[_0x9802('0x10')](_0x9802('0x12'),_0x1fd296);logger[_0x9802('0x16')](_0x9802('0x12'),_0x1fd296,JSON[_0x9802('0xc')](_0x567eed));_0xa753e(_0x567eed);})[_0x9802('0x11')](function(_0x36830d){logger[_0x9802('0xd')](_0x9802('0x12'),_0x36830d[_0x9802('0xf')],_0x1fd296);_0x181a84(_0x1b43f2[_0x9802('0xd')](0x1f4,_0x36830d['message']));});});};exports['AvgHandleTime']=function(_0x1163d6){var _0x5a695d=this;return new Promise(function(_0x43d624,_0x489a9d){return db[_0x9802('0x17')]['findAll']({'raw':_0x1163d6[_0x9802('0x14')]?_0x1163d6[_0x9802('0x14')][_0x9802('0x15')]===undefined?!![]:![]:!![],'where':_0x1163d6[_0x9802('0x14')]?_0x1163d6[_0x9802('0x14')]['where']||null:null,'attributes':[[db[_0x9802('0x18')]['fn'](_0x9802('0x19'),db['sequelize'][_0x9802('0x1a')]('id')),'predictiveIntervalTotalCalls'],[db['sequelize']['fn']('COUNT',db[_0x9802('0x18')]['fn']('IF',db[_0x9802('0x18')][_0x9802('0x1b')]('`state`\x20=\x204,\x201,\x20null'))),'predictiveIntervalAnsweredCalls'],[db[_0x9802('0x18')]['fn']('COUNT',db[_0x9802('0x18')]['fn']('IF',db['sequelize'][_0x9802('0x1b')](_0x9802('0x1c')))),_0x9802('0x1d')],[db[_0x9802('0x18')]['fn'](_0x9802('0x19'),db['sequelize']['fn']('IF',db[_0x9802('0x18')][_0x9802('0x1b')](_0x9802('0x1e')))),_0x9802('0x1f')],[db[_0x9802('0x18')]['fn'](_0x9802('0x20'),db[_0x9802('0x18')]['fn']('IF',db[_0x9802('0x18')][_0x9802('0x1b')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),'predictiveIntervalAvgHoldtime'],[db[_0x9802('0x18')]['fn']('AVG',db[_0x9802('0x18')]['fn']('IF',db['sequelize'][_0x9802('0x1b')](_0x9802('0x21')))),'predictiveIntervalAvgTalktime']]})[_0x9802('0x9')](function(_0x47ad87){logger['info']('AvgHandleTime',_0x1163d6);logger[_0x9802('0x16')]('AvgHandleTime',_0x1163d6,JSON[_0x9802('0xc')](_0x47ad87));_0x43d624(_0x47ad87);})[_0x9802('0x11')](function(_0x172a3a){logger['error'](_0x9802('0x22'),_0x172a3a['message'],_0x1163d6);_0x489a9d(_0x5a695d[_0x9802('0xd')](0x1f4,_0x172a3a[_0x9802('0xf')]));});});};exports[_0x9802('0x23')]=function(_0x31ff13){var _0x1460e7=this;return new Promise(function(_0x49f6bd,_0x5423e1){return db['CmHopperHistory'][_0x9802('0x24')]({'raw':_0x31ff13[_0x9802('0x14')]?_0x31ff13['options'][_0x9802('0x15')]===undefined?!![]:![]:!![],'where':_0x31ff13[_0x9802('0x14')]?_0x31ff13[_0x9802('0x14')][_0x9802('0x25')]||null:null,'attributes':[['campaign','name'],[db[_0x9802('0x18')]['fn']('COUNT',db[_0x9802('0x18')]['fn']('IF',db[_0x9802('0x18')][_0x9802('0x1b')](_0x9802('0x26')))),_0x9802('0x27')],[db[_0x9802('0x18')]['fn'](_0x9802('0x19'),db[_0x9802('0x18')]['fn']('IF',db[_0x9802('0x18')][_0x9802('0x1b')](_0x9802('0x28')))),'outboundNoAnswerCallsDay'],[db[_0x9802('0x18')]['fn'](_0x9802('0x19'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x9802('0x29')],[db[_0x9802('0x18')]['fn'](_0x9802('0x19'),db[_0x9802('0x18')]['fn']('IF',db[_0x9802('0x18')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x9802('0x2a')],[db[_0x9802('0x18')]['fn'](_0x9802('0x19'),db['sequelize']['fn']('IF',db[_0x9802('0x18')][_0x9802('0x1b')]('`state`\x20=\x208,\x201,\x20null'))),'outboundCongestionCallsDay'],[db[_0x9802('0x18')]['fn'](_0x9802('0x19'),db['sequelize']['fn']('IF',db[_0x9802('0x18')]['literal'](_0x9802('0x2b')))),_0x9802('0x2c')],[db[_0x9802('0x18')]['fn'](_0x9802('0x19'),db['sequelize']['fn']('IF',db['sequelize'][_0x9802('0x1b')](_0x9802('0x2d')))),_0x9802('0x2e')],[db[_0x9802('0x18')]['fn'](_0x9802('0x19'),db[_0x9802('0x18')]['fn']('IF',db[_0x9802('0x18')][_0x9802('0x1b')](_0x9802('0x2f')))),_0x9802('0x30')],[db[_0x9802('0x18')]['fn'](_0x9802('0x19'),db[_0x9802('0x18')]['fn']('IF',db[_0x9802('0x18')][_0x9802('0x1b')](_0x9802('0x31')))),_0x9802('0x32')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x9802('0x18')][_0x9802('0x1b')](_0x9802('0x33')))),_0x9802('0x34')],[db[_0x9802('0x18')]['fn'](_0x9802('0x19'),db[_0x9802('0x18')]['fn']('IF',db[_0x9802('0x18')]['literal']('`state`\x20=\x2018,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0x9802('0x18')]['fn'](_0x9802('0x19'),db[_0x9802('0x18')]['fn']('IF',db[_0x9802('0x18')][_0x9802('0x1b')](_0x9802('0x35')))),_0x9802('0x36')],[db[_0x9802('0x18')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x9802('0x18')][_0x9802('0x1b')](_0x9802('0x37')))),_0x9802('0x38')],[db[_0x9802('0x18')]['fn'](_0x9802('0x19'),db[_0x9802('0x18')]['fn']('IF',db['sequelize'][_0x9802('0x1b')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x9802('0x39')]],'group':[_0x9802('0x3a')]})['then'](function(_0x178fdc){logger['info'](_0x9802('0x23'),_0x31ff13);logger[_0x9802('0x16')](_0x9802('0x23'),_0x31ff13,JSON[_0x9802('0xc')](_0x178fdc));_0x49f6bd(_0x178fdc);})[_0x9802('0x11')](function(_0x2e7571){logger[_0x9802('0xd')](_0x9802('0x23'),_0x2e7571['message'],_0x31ff13);_0x5423e1(_0x1460e7['error'](0x1f4,_0x2e7571[_0x9802('0xf')]));});});};exports[_0x9802('0x3b')]=function(_0x29c076){var _0x1a04dc=this;return new Promise(function(_0x2b0e9f,_0x5aa639){return db[_0x9802('0x17')][_0x9802('0x24')]({'raw':_0x29c076[_0x9802('0x14')]?_0x29c076['options'][_0x9802('0x15')]===undefined?!![]:![]:!![],'where':_0x29c076[_0x9802('0x14')]?_0x29c076[_0x9802('0x14')]['where']||null:null,'attributes':[[_0x9802('0x3a'),'name'],[db[_0x9802('0x18')]['fn'](_0x9802('0x19'),db[_0x9802('0x18')][_0x9802('0x1a')]('id')),'ivrTotalCallsDays'],[db[_0x9802('0x18')]['fn'](_0x9802('0x19'),db[_0x9802('0x18')]['fn']('IF',db['sequelize'][_0x9802('0x1b')](_0x9802('0x3c')))),_0x9802('0x3d')]],'group':['campaign']})[_0x9802('0x9')](function(_0x2f6b26){logger[_0x9802('0x10')]('GetCampaignHopperHistory',_0x29c076);logger[_0x9802('0x16')](_0x9802('0x3b'),_0x29c076,JSON[_0x9802('0xc')](_0x2f6b26));_0x2b0e9f(_0x2f6b26);})[_0x9802('0x11')](function(_0x5e1fc3){logger[_0x9802('0xd')]('GetCampaignHopperHistory',_0x5e1fc3[_0x9802('0xf')],_0x29c076);_0x5aa639(_0x1a04dc[_0x9802('0xd')](0x1f4,_0x5e1fc3[_0x9802('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 9a65aa7..77db732 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 _0x0aa0=['describe','/:id','show','post','create','put','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated','get','/describe'];(function(_0x48f1cb,_0x33e810){var _0x3ba0ad=function(_0x423641){while(--_0x423641){_0x48f1cb['push'](_0x48f1cb['shift']());}};_0x3ba0ad(++_0x33e810);}(_0x0aa0,0x1e2));var _0x00aa=function(_0x1b6318,_0x5761fd){_0x1b6318=_0x1b6318-0x0;var _0x573968=_0x0aa0[_0x1b6318];return _0x573968;};'use strict';var multer=require(_0x00aa('0x0'));var util=require(_0x00aa('0x1'));var path=require('path');var timeout=require(_0x00aa('0x2'));var express=require(_0x00aa('0x3'));var router=express[_0x00aa('0x4')]();var fs_extra=require(_0x00aa('0x5'));var auth=require(_0x00aa('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x00aa('0x7'));var controller=require(_0x00aa('0x8'));router['get']('/',auth[_0x00aa('0x9')](),controller['index']);router[_0x00aa('0xa')](_0x00aa('0xb'),auth[_0x00aa('0x9')](),controller[_0x00aa('0xc')]);router['get'](_0x00aa('0xd'),auth[_0x00aa('0x9')](),controller[_0x00aa('0xe')]);router[_0x00aa('0xf')]('/',auth['isAuthenticated'](),controller[_0x00aa('0x10')]);router[_0x00aa('0x11')](_0x00aa('0xd'),auth[_0x00aa('0x9')](),controller['update']);module[_0x00aa('0x12')]=router; \ No newline at end of file +var _0xa46d=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','exports','multer'];(function(_0x1d1963,_0x32cc0e){var _0x3f58bb=function(_0x514823){while(--_0x514823){_0x1d1963['push'](_0x1d1963['shift']());}};_0x3f58bb(++_0x32cc0e);}(_0xa46d,0x179));var _0xda46=function(_0x117eed,_0xadd482){_0x117eed=_0x117eed-0x0;var _0x3fa13f=_0xa46d[_0x117eed];return _0x3fa13f;};'use strict';var multer=require(_0xda46('0x0'));var util=require(_0xda46('0x1'));var path=require(_0xda46('0x2'));var timeout=require(_0xda46('0x3'));var express=require(_0xda46('0x4'));var router=express[_0xda46('0x5')]();var fs_extra=require(_0xda46('0x6'));var auth=require(_0xda46('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xda46('0x8'));var controller=require('./cmHopperHistory.controller');router[_0xda46('0x9')]('/',auth[_0xda46('0xa')](),controller[_0xda46('0xb')]);router[_0xda46('0x9')](_0xda46('0xc'),auth['isAuthenticated'](),controller[_0xda46('0xd')]);router['get'](_0xda46('0xe'),auth[_0xda46('0xa')](),controller[_0xda46('0xf')]);router[_0xda46('0x10')]('/',auth[_0xda46('0xa')](),controller[_0xda46('0x11')]);router[_0xda46('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xda46('0x13')]);module[_0xda46('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 420c769..d297aff 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 _0x4989=['STRING','sequelize','name'];(function(_0x20d10c,_0x298c6c){var _0x346406=function(_0x52ff98){while(--_0x52ff98){_0x20d10c['push'](_0x20d10c['shift']());}};_0x346406(++_0x298c6c);}(_0x4989,0x79));var _0x9498=function(_0x5e6d65,_0x5db89c){_0x5e6d65=_0x5e6d65-0x0;var _0x5e1f75=_0x4989[_0x5e6d65];return _0x5e1f75;};'use strict';var Sequelize=require(_0x9498('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x9498('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9498('0x2')]},'dialPrefix':{'type':Sequelize[_0x9498('0x2')]}}; \ No newline at end of file +var _0x2e8a=['STRING','exports'];(function(_0x4fbb15,_0x21be0c){var _0x436338=function(_0x3b5a05){while(--_0x3b5a05){_0x4fbb15['push'](_0x4fbb15['shift']());}};_0x436338(++_0x21be0c);}(_0x2e8a,0xc7));var _0xa2e8=function(_0xb833b1,_0x1c3d3f){_0xb833b1=_0xb833b1-0x0;var _0x1ab87a=_0x2e8a[_0xb833b1];return _0x1ab87a;};'use strict';var Sequelize=require('sequelize');module[_0xa2e8('0x0')]={'name':{'type':Sequelize[_0xa2e8('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa2e8('0x1')]},'dialPrefix':{'type':Sequelize[_0xa2e8('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index e4f7c03..d640608 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 _0x5337=['redis','defaults','register','sendStatus','status','json','offset','limit','count','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','end','error','stack','name','send','index','CmList','rawAttributes','fieldName','key','model','map','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','filters','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','ListId','getDispositions','Disposition','pick','removeDispositions','ids','addContacts','CmContact','tags','isArray','push','omit','success','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','Content-type','text/csv','download','addCustomField','sequelize','addCustomFields','Sequelize','text','TEXT','number','INTEGER','switch','BOOLEAN','addColumn','cf_%s','getCustomFields','findOne','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','eml-format','rimraf','fast-json-patch','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x9e72c8,_0x5ac1a9){var _0x1468b2=function(_0x2cac69){while(--_0x2cac69){_0x9e72c8['push'](_0x9e72c8['shift']());}};_0x1468b2(++_0x5ac1a9);}(_0x5337,0x104));var _0x7533=function(_0x4bb93d,_0x1cda9a){_0x4bb93d=_0x4bb93d-0x0;var _0x106b4f=_0x5337[_0x4bb93d];return _0x106b4f;};'use strict';var emlformat=require(_0x7533('0x0'));var rimraf=require(_0x7533('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7533('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7533('0x3'));var util=require(_0x7533('0x4'));var path=require(_0x7533('0x5'));var sox=require('sox');var csv=require(_0x7533('0x6'));var ejs=require(_0x7533('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7533('0x8'));var squel=require(_0x7533('0x9'));var crypto=require(_0x7533('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x7533('0xb'));var toCsv=require(_0x7533('0x6'));var querystring=require('querystring');var Papa=require(_0x7533('0xc'));var Redis=require(_0x7533('0xd'));var authService=require(_0x7533('0xe'));var qs=require(_0x7533('0xf'));var as=require(_0x7533('0x10'));var hardwareService=require(_0x7533('0x11'));var logger=require(_0x7533('0x12'))('api');var utils=require(_0x7533('0x13'));var config=require(_0x7533('0x14'));var licenseUtil=require(_0x7533('0x15'));var db=require('../../mysqldb')['db'];config[_0x7533('0x16')]=_[_0x7533('0x17')](config[_0x7533('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7533('0x16')]));require('./cmList.socket')[_0x7533('0x18')](socket);function respondWithStatusCode(_0x4142b5,_0x48d831){_0x48d831=_0x48d831||0xcc;return function(_0xf78d7d){if(_0xf78d7d){return _0x4142b5[_0x7533('0x19')](_0x48d831);}return _0x4142b5[_0x7533('0x1a')](_0x48d831)['end']();};}function respondWithResult(_0x5e1cdc,_0x1d2494){_0x1d2494=_0x1d2494||0xc8;return function(_0x9e5ca2){if(_0x9e5ca2){return _0x5e1cdc[_0x7533('0x1a')](_0x1d2494)[_0x7533('0x1b')](_0x9e5ca2);}};}function respondWithFilteredResult(_0x15c8b9,_0x4dc305){return function(_0x2c9723){if(_0x2c9723){var _0x1a687b=typeof _0x4dc305[_0x7533('0x1c')]==='undefined'&&typeof _0x4dc305[_0x7533('0x1d')]==='undefined';var _0x472731=_0x2c9723[_0x7533('0x1e')];var _0x5b82f8=_0x1a687b?0x0:_0x4dc305['offset'];var _0x1f83e1=_0x1a687b?_0x2c9723[_0x7533('0x1e')]:_0x4dc305[_0x7533('0x1c')]+_0x4dc305[_0x7533('0x1d')];var _0x2e39e7;if(_0x1f83e1>=_0x472731){_0x1f83e1=_0x472731;_0x2e39e7=0xc8;}else{_0x2e39e7=0xce;}_0x15c8b9[_0x7533('0x1a')](_0x2e39e7);return _0x15c8b9['set'](_0x7533('0x1f'),_0x5b82f8+'-'+_0x1f83e1+'/'+_0x472731)[_0x7533('0x1b')](_0x2c9723);}return null;};}function patchUpdates(_0x21b208){return function(_0x37d79b){try{jsonpatch[_0x7533('0x20')](_0x37d79b,_0x21b208,!![]);}catch(_0x2917e5){return BPromise[_0x7533('0x21')](_0x2917e5);}return _0x37d79b[_0x7533('0x22')]();};}function saveUpdates(_0x1337c6,_0x3c62ed){return function(_0x2a9380){if(_0x2a9380){return _0x2a9380[_0x7533('0x23')](_0x1337c6)['then'](function(_0x5b4458){return _0x5b4458;});}return null;};}function removeEntity(_0x9f2c63,_0x4bb7cb){return function(_0x400072){if(_0x400072){return _0x400072[_0x7533('0x24')]()[_0x7533('0x25')](function(){var _0x3159c7=_0x400072[_0x7533('0x26')]({'plain':!![]});var _0x4a379f='Lists';return db[_0x7533('0x27')][_0x7533('0x24')]({'where':{'type':_0x4a379f,'resourceId':_0x3159c7['id']}})[_0x7533('0x25')](function(){return _0x400072;});})[_0x7533('0x25')](function(){_0x9f2c63['status'](0xcc)[_0x7533('0x28')]();});}};}function handleEntityNotFound(_0x326d56,_0xf5741d){return function(_0x1eb7b9){if(!_0x1eb7b9){_0x326d56[_0x7533('0x19')](0x194);}return _0x1eb7b9;};}function handleError(_0x5564dd,_0x2c9658){_0x2c9658=_0x2c9658||0x1f4;return function(_0xa1229b){logger[_0x7533('0x29')](_0xa1229b[_0x7533('0x2a')]);if(_0xa1229b[_0x7533('0x2b')]){delete _0xa1229b['name'];}_0x5564dd[_0x7533('0x1a')](_0x2c9658)[_0x7533('0x2c')](_0xa1229b);};}exports[_0x7533('0x2d')]=function(_0x4aaf10,_0x5dcf88){var _0x6eeb66={},_0x17d0c0={},_0x5967f8={'count':0x0,'rows':[]};var _0x39292c=_['map'](db[_0x7533('0x2e')][_0x7533('0x2f')],function(_0x1f3889){return{'name':_0x1f3889[_0x7533('0x30')],'type':_0x1f3889['type'][_0x7533('0x31')]};});_0x17d0c0[_0x7533('0x32')]=_[_0x7533('0x33')](_0x39292c,_0x7533('0x2b'));_0x17d0c0['query']=_[_0x7533('0x34')](_0x4aaf10[_0x7533('0x35')]);_0x17d0c0['filters']=_[_0x7533('0x36')](_0x17d0c0[_0x7533('0x32')],_0x17d0c0['query']);_0x6eeb66['attributes']=_[_0x7533('0x36')](_0x17d0c0[_0x7533('0x32')],qs[_0x7533('0x37')](_0x4aaf10['query'][_0x7533('0x37')]));_0x6eeb66[_0x7533('0x38')]=_0x6eeb66[_0x7533('0x38')]['length']?_0x6eeb66[_0x7533('0x38')]:_0x17d0c0['model'];if(!_0x4aaf10['query'][_0x7533('0x39')](_0x7533('0x3a'))){_0x6eeb66[_0x7533('0x1d')]=qs[_0x7533('0x1d')](_0x4aaf10['query'][_0x7533('0x1d')]);_0x6eeb66[_0x7533('0x1c')]=qs['offset'](_0x4aaf10[_0x7533('0x35')][_0x7533('0x1c')]);}_0x6eeb66[_0x7533('0x3b')]=qs[_0x7533('0x3c')](_0x4aaf10['query']['sort']);_0x6eeb66['where']=qs['filters'](_['pick'](_0x4aaf10['query'],_0x17d0c0['filters']),_0x39292c);if(_0x4aaf10[_0x7533('0x35')]['filter']){_0x6eeb66[_0x7533('0x3d')]=_['merge'](_0x6eeb66[_0x7533('0x3d')],{'$or':_['map'](_0x39292c,function(_0x390d41){if(_0x390d41[_0x7533('0x3e')]!==_0x7533('0x3f')){var _0x1955c2={};_0x1955c2[_0x390d41['name']]={'$like':'%'+_0x4aaf10[_0x7533('0x35')][_0x7533('0x40')]+'%'};return _0x1955c2;}})});}_0x6eeb66=_[_0x7533('0x41')]({},_0x6eeb66,_0x4aaf10[_0x7533('0x42')]);var _0x31913b={'where':_0x6eeb66['where']};return db[_0x7533('0x2e')][_0x7533('0x1e')](_0x31913b)[_0x7533('0x25')](function(_0xcf4b2a){_0x5967f8['count']=_0xcf4b2a;if(_0x4aaf10[_0x7533('0x35')][_0x7533('0x43')]){_0x6eeb66[_0x7533('0x44')]=[{'all':!![]}];}return db[_0x7533('0x2e')][_0x7533('0x45')](_0x6eeb66);})[_0x7533('0x25')](function(_0x424d59){_0x5967f8[_0x7533('0x46')]=_0x424d59;return _0x5967f8;})[_0x7533('0x25')](respondWithFilteredResult(_0x5dcf88,_0x6eeb66))[_0x7533('0x47')](handleError(_0x5dcf88,null));};exports[_0x7533('0x48')]=function(_0x54e371,_0x36f188){var _0x1a087c={'raw':![],'where':{'id':_0x54e371['params']['id']}},_0x4e321e={};_0x4e321e[_0x7533('0x32')]=_['keys'](db['CmList']['rawAttributes']);_0x4e321e[_0x7533('0x35')]=_[_0x7533('0x34')](_0x54e371[_0x7533('0x35')]);_0x4e321e[_0x7533('0x49')]=_[_0x7533('0x36')](_0x4e321e[_0x7533('0x32')],_0x4e321e[_0x7533('0x35')]);_0x1a087c['attributes']=_[_0x7533('0x36')](_0x4e321e[_0x7533('0x32')],qs[_0x7533('0x37')](_0x54e371['query'][_0x7533('0x37')]));_0x1a087c['attributes']=_0x1a087c['attributes'][_0x7533('0x4a')]?_0x1a087c[_0x7533('0x38')]:_0x4e321e[_0x7533('0x32')];if(_0x54e371[_0x7533('0x35')][_0x7533('0x43')]){_0x1a087c[_0x7533('0x44')]=[{'all':!![]}];}_0x1a087c=_[_0x7533('0x41')]({},_0x1a087c,_0x54e371[_0x7533('0x42')]);return db['CmList'][_0x7533('0x4b')](_0x1a087c)[_0x7533('0x25')](handleEntityNotFound(_0x36f188,null))[_0x7533('0x25')](respondWithResult(_0x36f188,null))[_0x7533('0x47')](handleError(_0x36f188,null));};exports[_0x7533('0x4c')]=function(_0x4eb11d,_0x23a6c7){return db[_0x7533('0x2e')][_0x7533('0x4c')](_0x4eb11d['body'],{})['then'](function(_0x201ec1){var _0x409c73=_0x4eb11d[_0x7533('0x4d')][_0x7533('0x26')]({'plain':!![]});if(!_0x409c73)throw new Error(_0x7533('0x4e'));if(_0x409c73[_0x7533('0x4f')]===_0x7533('0x4d')){var _0x9b2636=_0x201ec1['get']({'plain':!![]});var _0x382242='Lists';return db[_0x7533('0x50')][_0x7533('0x4b')]({'where':{'name':_0x382242,'userProfileId':_0x409c73['userProfileId']},'raw':!![]})[_0x7533('0x25')](function(_0x408e9a){if(_0x408e9a&&_0x408e9a[_0x7533('0x51')]===0x0){return db['UserProfileResource'][_0x7533('0x4c')]({'name':_0x9b2636[_0x7533('0x2b')],'resourceId':_0x9b2636['id'],'type':_0x408e9a[_0x7533('0x2b')],'sectionId':_0x408e9a['id']},{})[_0x7533('0x25')](function(){return _0x201ec1;});}else{return _0x201ec1;}})[_0x7533('0x47')](function(_0x48d739){logger['error'](_0x7533('0x52'),_0x48d739);throw _0x48d739;});}return _0x201ec1;})['then'](respondWithResult(_0x23a6c7,0xc9))[_0x7533('0x47')](handleError(_0x23a6c7,null));};exports['update']=function(_0x41144d,_0x4f7e75){if(_0x41144d[_0x7533('0x53')]['id']){delete _0x41144d[_0x7533('0x53')]['id'];}return db[_0x7533('0x2e')][_0x7533('0x4b')]({'where':{'id':_0x41144d[_0x7533('0x54')]['id']}})[_0x7533('0x25')](handleEntityNotFound(_0x4f7e75,null))['then'](saveUpdates(_0x41144d[_0x7533('0x53')],null))[_0x7533('0x25')](respondWithResult(_0x4f7e75,null))['catch'](handleError(_0x4f7e75,null));};exports[_0x7533('0x24')]=function(_0x2451be,_0x55ac4a){return db[_0x7533('0x2e')][_0x7533('0x4b')]({'where':{'id':_0x2451be[_0x7533('0x54')]['id']}})[_0x7533('0x25')](handleEntityNotFound(_0x55ac4a,null))['then'](removeEntity(_0x55ac4a,null))[_0x7533('0x47')](handleError(_0x55ac4a,null));};exports[_0x7533('0x55')]=function(_0x1c32d4,_0x8a959){return db[_0x7533('0x2e')][_0x7533('0x55')]()['then'](respondWithResult(_0x8a959,null))[_0x7533('0x47')](handleError(_0x8a959,null));};exports[_0x7533('0x56')]=function(_0x421228,_0x5b9af2,_0xc28f0c){if(_0x421228[_0x7533('0x53')]['id']){delete _0x421228[_0x7533('0x53')]['id'];}return db['CmList'][_0x7533('0x4b')]({'where':{'id':_0x421228[_0x7533('0x54')]['id']}})['then'](handleEntityNotFound(_0x5b9af2,null))['then'](function(_0x44f6f6){if(_0x44f6f6){_0x421228[_0x7533('0x53')][_0x7533('0x57')]=_0x44f6f6['id'];return db['Disposition'][_0x7533('0x4c')](_0x421228[_0x7533('0x53')]);}})[_0x7533('0x25')](respondWithResult(_0x5b9af2,null))[_0x7533('0x47')](handleError(_0x5b9af2,null));};exports[_0x7533('0x58')]=function(_0x114b8b,_0x298ad2,_0x3716a7){var _0x3cea55={'raw':![],'where':{}};var _0x1982d={};var _0x31aea3={'count':0x0,'rows':[]};return db['CmList']['findOne']({'where':{'id':_0x114b8b[_0x7533('0x54')]['id']}})[_0x7533('0x25')](handleEntityNotFound(_0x298ad2,null))[_0x7533('0x25')](function(_0x28d0a4){if(_0x28d0a4){_0x1982d['model']=_[_0x7533('0x34')](db[_0x7533('0x59')][_0x7533('0x2f')]);_0x1982d[_0x7533('0x35')]=_[_0x7533('0x34')](_0x114b8b[_0x7533('0x35')]);_0x1982d['filters']=_[_0x7533('0x36')](_0x1982d[_0x7533('0x32')],_0x1982d[_0x7533('0x35')]);_0x3cea55['attributes']=_[_0x7533('0x36')](_0x1982d[_0x7533('0x32')],qs['fields'](_0x114b8b[_0x7533('0x35')]['fields']));_0x3cea55[_0x7533('0x38')]=_0x3cea55[_0x7533('0x38')][_0x7533('0x4a')]?_0x3cea55[_0x7533('0x38')]:_0x1982d[_0x7533('0x32')];if(!_0x114b8b[_0x7533('0x35')]['hasOwnProperty']('nolimit')){_0x3cea55[_0x7533('0x1d')]=qs[_0x7533('0x1d')](_0x114b8b[_0x7533('0x35')]['limit']);_0x3cea55[_0x7533('0x1c')]=qs[_0x7533('0x1c')](_0x114b8b[_0x7533('0x35')]['offset']);}_0x3cea55['order']=qs[_0x7533('0x3c')](_0x114b8b['query'][_0x7533('0x3c')]);_0x3cea55['where']=qs[_0x7533('0x49')](_[_0x7533('0x5a')](_0x114b8b[_0x7533('0x35')],_0x1982d[_0x7533('0x49')]));_0x3cea55['where'][_0x7533('0x57')]=_0x28d0a4['id'];if(_0x114b8b[_0x7533('0x35')]['filter']){_0x3cea55[_0x7533('0x3d')]=_[_0x7533('0x41')](_0x3cea55['where'],{'$or':_['map'](_0x3cea55[_0x7533('0x38')],function(_0x1c9332){var _0x5d2489={};_0x5d2489[_0x1c9332]={'$like':'%'+_0x114b8b['query'][_0x7533('0x40')]+'%'};return _0x5d2489;})});}_0x3cea55=_['merge']({},_0x3cea55,_0x114b8b[_0x7533('0x42')]);return db[_0x7533('0x59')][_0x7533('0x1e')]({'where':_0x3cea55['where']})[_0x7533('0x25')](function(_0xc5716f){_0x31aea3['count']=_0xc5716f;if(_0x114b8b[_0x7533('0x35')][_0x7533('0x43')]){_0x3cea55[_0x7533('0x44')]=[{'all':!![]}];}return db[_0x7533('0x59')][_0x7533('0x45')](_0x3cea55);})[_0x7533('0x25')](function(_0x3b4942){_0x31aea3[_0x7533('0x46')]=_0x3b4942;return _0x31aea3;});}})[_0x7533('0x25')](respondWithFilteredResult(_0x298ad2,_0x3cea55))[_0x7533('0x47')](handleError(_0x298ad2,null));};exports[_0x7533('0x5b')]=function(_0x129a63,_0xb6f27,_0x2a124e){return db[_0x7533('0x2e')][_0x7533('0x4b')]({'where':{'id':_0x129a63['params']['id']}})['then'](handleEntityNotFound(_0xb6f27,null))[_0x7533('0x25')](function(_0x252a5e){if(_0x252a5e){return _0x252a5e[_0x7533('0x5b')](_0x129a63[_0x7533('0x35')][_0x7533('0x5c')]);}})[_0x7533('0x25')](respondWithStatusCode(_0xb6f27,null))[_0x7533('0x47')](handleError(_0xb6f27,null));};exports[_0x7533('0x5d')]=function(_0x59d557,_0x28bebe,_0x122801){return db[_0x7533('0x2e')][_0x7533('0x4b')]({'where':{'id':_0x59d557[_0x7533('0x54')]['id']}})[_0x7533('0x25')](handleEntityNotFound(_0x28bebe,null))[_0x7533('0x25')](function(_0x47d2f7){if(_0x47d2f7){var _0x1d2618=[];var _0x3a8b98={'success':[],'errors':[]};return db[_0x7533('0x5e')][_0x7533('0x55')]()[_0x7533('0x25')](function(_0xba91a9){if(_0x59d557[_0x7533('0x53')][_0x7533('0x5f')]&&_[_0x7533('0x60')](_0x59d557[_0x7533('0x53')][_0x7533('0x5f')])){if(_0x59d557[_0x7533('0x53')][_0x7533('0x5f')]['length']){_0x59d557['body']['tags']=_0x59d557[_0x7533('0x53')]['tags']['join'](';')+';';}else{_0x59d557['body'][_0x7533('0x5f')]=null;}}else{_0x59d557[_0x7533('0x53')][_0x7533('0x5f')]=null;}if(_0x59d557[_0x7533('0x53')]&&_[_0x7533('0x60')](_0x59d557[_0x7533('0x53')])){for(var _0x4296fb=0x0;_0x4296fb<_0x59d557[_0x7533('0x53')][_0x7533('0x4a')];_0x4296fb+=0x1){_0x59d557[_0x7533('0x53')][_0x4296fb][_0x7533('0x57')]=_0x59d557['params']['id'];_0x1d2618[_0x7533('0x61')](_0x59d557[_0x7533('0x53')][_0x4296fb]);}return BPromise['each'](_0x1d2618,function(_0x2e99c0){return db['CmContact'][_0x7533('0x4c')](_[_0x7533('0x62')](_0x2e99c0,[_0x7533('0x5c'),'id'])||{},{'fields':_['keys'](_0xba91a9),'raw':!![]})[_0x7533('0x25')](function(_0x46bc0b){_0x3a8b98[_0x7533('0x63')][_0x7533('0x61')](_0x46bc0b['dataValues']);})['catch'](function(_0xb81805){_0x3a8b98[_0x7533('0x64')][_0x7533('0x61')]({'data':_0x2e99c0,'error':_0xb81805[_0x7533('0x65')]});});})[_0x7533('0x25')](function(_0x20bb54){return _0x3a8b98;})['catch'](function(_0x171509){return _0x171509;});}else{_0x28bebe['status'](0x190)[_0x7533('0x1b')]({'message':_0x7533('0x66')});}});}})['then'](respondWithResult(_0x28bebe,null))[_0x7533('0x47')](handleError(_0x28bebe,null));};exports[_0x7533('0x67')]=function(_0x38c0de,_0x3b7b78,_0x35e223){var _0x3f623d;return db['CmList']['find']({'where':{'id':_0x38c0de[_0x7533('0x54')]['id']},'include':[{'model':db[_0x7533('0x68')],'as':_0x7533('0x69')}]})[_0x7533('0x25')](handleEntityNotFound(_0x3b7b78,null))[_0x7533('0x25')](function(_0x23c530){if(_0x23c530){_0x3f623d=_0x23c530;return db[_0x7533('0x5e')][_0x7533('0x2f')];}})[_0x7533('0x25')](function(_0x23fa7f){if(_0x23fa7f){var _0x3721e6={};var _0x300739={};_0x300739[_0x7533('0x32')]=_[_0x7533('0x6a')](_[_0x7533('0x34')](_0x23fa7f),_[_0x7533('0x33')](_0x3f623d[_0x7533('0x69')],function(_0x2e2fe5){return util[_0x7533('0x6b')](_0x7533('0x6c'),_0x2e2fe5['id']);}));_0x300739[_0x7533('0x35')]=_[_0x7533('0x34')](_0x38c0de[_0x7533('0x35')]);_0x300739[_0x7533('0x49')]=_['intersection'](_0x300739['model'],_0x300739[_0x7533('0x35')]);_0x3721e6[_0x7533('0x38')]=_[_0x7533('0x36')](_0x300739[_0x7533('0x32')],qs['fields'](_0x38c0de[_0x7533('0x35')]['fields']));_0x3721e6[_0x7533('0x38')]=_0x3721e6['attributes'][_0x7533('0x4a')]?_0x3721e6[_0x7533('0x38')]:_0x300739[_0x7533('0x32')];if(!_0x38c0de[_0x7533('0x35')]['hasOwnProperty'](_0x7533('0x3a'))){_0x3721e6['limit']=qs[_0x7533('0x1d')](_0x38c0de[_0x7533('0x35')][_0x7533('0x1d')]);_0x3721e6[_0x7533('0x1c')]=qs[_0x7533('0x1c')](_0x38c0de[_0x7533('0x35')][_0x7533('0x1c')]);}_0x3721e6[_0x7533('0x3b')]=qs[_0x7533('0x3c')](_0x38c0de[_0x7533('0x35')][_0x7533('0x3c')]);_0x3721e6['where']=qs['filters'](_[_0x7533('0x5a')](_0x38c0de[_0x7533('0x35')],_0x300739[_0x7533('0x49')]));_0x3721e6[_0x7533('0x6d')]=!![];if(_0x38c0de[_0x7533('0x35')]['filter']){_0x3721e6[_0x7533('0x3d')]=_['merge'](_0x3721e6[_0x7533('0x3d')],{'$or':_[_0x7533('0x33')](_0x3721e6[_0x7533('0x38')],function(_0x206627){var _0x43c63c={};_0x43c63c[_0x206627]={'$like':'%'+_0x38c0de[_0x7533('0x35')][_0x7533('0x40')]+'%'};return _0x43c63c;})});}_0x3721e6=_[_0x7533('0x41')]({},_0x3721e6,_0x38c0de['options']);return _0x3f623d[_0x7533('0x67')](_0x3721e6);}})[_0x7533('0x25')](respondWithResult(_0x3b7b78,null))[_0x7533('0x47')](handleError(_0x3b7b78,null));};exports['getContactsCsv']=function(_0x1042f8,_0x3bc00f,_0x43af01){var _0x498d55;return db['CmList'][_0x7533('0x4b')]({'where':{'id':_0x1042f8[_0x7533('0x54')]['id']},'include':[{'model':db[_0x7533('0x68')],'as':_0x7533('0x69')}]})['then'](handleEntityNotFound(_0x3bc00f,null))[_0x7533('0x25')](function(_0x3d42e0){if(_0x3d42e0){_0x498d55=_0x3d42e0;return db['CmContact'][_0x7533('0x2f')];}})[_0x7533('0x25')](function(_0x38f5d4){if(_0x38f5d4){var _0x432ad6={};var _0x320890={};_0x320890[_0x7533('0x32')]=_['concat'](_['keys'](_0x38f5d4),_[_0x7533('0x33')](_0x498d55['CustomFields'],function(_0x56a2d3){return util[_0x7533('0x6b')](_0x7533('0x6c'),_0x56a2d3['id']);}));_0x320890[_0x7533('0x35')]=_[_0x7533('0x34')](_0x1042f8['query']);_0x320890[_0x7533('0x49')]=_['intersection'](_0x320890[_0x7533('0x32')],_0x320890[_0x7533('0x35')]);_0x432ad6[_0x7533('0x38')]=_['intersection'](_0x320890[_0x7533('0x32')],qs[_0x7533('0x37')](_0x1042f8['query']['fields']));_0x432ad6[_0x7533('0x38')]=_0x432ad6['attributes'][_0x7533('0x4a')]?_0x432ad6[_0x7533('0x38')]:_0x320890['model'];if(!_0x1042f8[_0x7533('0x35')][_0x7533('0x39')](_0x7533('0x3a'))){_0x432ad6[_0x7533('0x1d')]=qs['limit'](_0x1042f8['query'][_0x7533('0x1d')]);_0x432ad6[_0x7533('0x1c')]=qs[_0x7533('0x1c')](_0x1042f8[_0x7533('0x35')]['offset']);}_0x432ad6['order']=qs[_0x7533('0x3c')](_0x1042f8[_0x7533('0x35')][_0x7533('0x3c')]);_0x432ad6['where']=qs['filters'](_[_0x7533('0x5a')](_0x1042f8[_0x7533('0x35')],_0x320890[_0x7533('0x49')]));_0x432ad6[_0x7533('0x6d')]=!![];if(_0x1042f8['query'][_0x7533('0x40')]){_0x432ad6[_0x7533('0x3d')]=_[_0x7533('0x41')](_0x432ad6[_0x7533('0x3d')],{'$or':_[_0x7533('0x33')](_0x432ad6['attributes'],function(_0x52b4ca){var _0x4e3257={};_0x4e3257[_0x52b4ca]={'$like':'%'+_0x1042f8['query']['filter']+'%'};return _0x4e3257;})});}_0x432ad6=_['merge']({},_0x432ad6,_0x1042f8['options']);return _0x498d55[_0x7533('0x67')](_0x432ad6);}})[_0x7533('0x25')](function(_0x428861){if(!_['isEmpty'](_0x428861)){var _0x4d898b=toCsv(_0x428861);var _0x6932b0=Date[_0x7533('0x6e')]();fs[_0x7533('0x6f')](util[_0x7533('0x6b')](_0x7533('0x70'),_0x498d55['id'],_0x6932b0),_0x4d898b);_0x3bc00f[_0x7533('0x71')]('Content-disposition',_0x7533('0x72')+util['format']('list_%d_%s.csv',_0x498d55['id'],_0x6932b0));_0x3bc00f['setHeader'](_0x7533('0x73'),_0x7533('0x74'));return _0x3bc00f[_0x7533('0x75')](util[_0x7533('0x6b')](_0x7533('0x70'),_0x498d55['id'],_0x6932b0));}else{return _0x3bc00f[_0x7533('0x19')](0xcc);}})[_0x7533('0x47')](handleError(_0x3bc00f,null));};exports[_0x7533('0x76')]=function(_0x4495a4,_0x16f2df,_0x5c72e8){var _0xde02d;delete _0x4495a4[_0x7533('0x53')]['id'];return db[_0x7533('0x2e')]['findOne']({'where':{'id':_0x4495a4['params']['id']}})['then'](handleEntityNotFound(_0x16f2df,null))[_0x7533('0x25')](function(_0x50f65b){if(_0x50f65b){return db[_0x7533('0x77')]['transaction'](function(_0x425968){return db['CmCustomField']['create'](_0x4495a4[_0x7533('0x53')],{'transaction':_0x425968})[_0x7533('0x25')](function(_0x2df556){_0xde02d=_0x2df556;return _0x50f65b[_0x7533('0x78')](_0x2df556,{'transaction':_0x425968});})[_0x7533('0x25')](function(){var _0x3245b7={'type':db[_0x7533('0x79')]['TEXT'],'transaction':_0x425968};switch(_0x4495a4['body'][_0x7533('0x3e')]){case _0x7533('0x7a'):_0x3245b7[_0x7533('0x3e')]=db[_0x7533('0x79')][_0x7533('0x7b')];break;case _0x7533('0x7c'):_0x3245b7['type']=db[_0x7533('0x79')][_0x7533('0x7d')];break;case _0x7533('0x7e'):_0x3245b7[_0x7533('0x3e')]=db['Sequelize'][_0x7533('0x7f')];_0x3245b7['defaultValue']=![];break;default:}return db[_0x7533('0x77')]['queryInterface'][_0x7533('0x80')]('cm_contacts',util[_0x7533('0x6b')](_0x7533('0x81'),_0xde02d['id']),_0x3245b7);})[_0x7533('0x25')](function(){return _0xde02d;});});}})[_0x7533('0x25')](respondWithResult(_0x16f2df,null))['catch'](handleError(_0x16f2df,null));};exports[_0x7533('0x82')]=function(_0x2dc14d,_0x3868e7,_0xb9b285){var _0x23a448={};var _0xf793f6={};var _0x3a33ed;var _0x1e7ebf;return db[_0x7533('0x2e')][_0x7533('0x83')]({'where':{'id':_0x2dc14d[_0x7533('0x54')]['id']}})[_0x7533('0x25')](handleEntityNotFound(_0x3868e7,null))['then'](function(_0x1f9e06){if(_0x1f9e06){_0x3a33ed=_0x1f9e06;_0xf793f6['model']=_[_0x7533('0x34')](db[_0x7533('0x68')][_0x7533('0x2f')]);_0xf793f6[_0x7533('0x35')]=_[_0x7533('0x34')](_0x2dc14d[_0x7533('0x35')]);_0xf793f6[_0x7533('0x49')]=_['intersection'](_0xf793f6['model'],_0xf793f6[_0x7533('0x35')]);_0x23a448[_0x7533('0x38')]=_[_0x7533('0x36')](_0xf793f6[_0x7533('0x32')],qs[_0x7533('0x37')](_0x2dc14d['query'][_0x7533('0x37')]));_0x23a448['attributes']=_0x23a448['attributes']['length']?_0x23a448[_0x7533('0x38')]:_0xf793f6[_0x7533('0x32')];_0x23a448['order']=qs[_0x7533('0x3c')](_0x2dc14d['query'][_0x7533('0x3c')]);_0x23a448[_0x7533('0x3d')]=qs[_0x7533('0x49')](_[_0x7533('0x5a')](_0x2dc14d['query'],_0xf793f6[_0x7533('0x49')]));_0x23a448['where']=_[_0x7533('0x41')](_0x23a448[_0x7533('0x3d')],{'$or':[{'ListId':_0x1f9e06['id']},{'ListId':null}]});if(_0x2dc14d[_0x7533('0x35')][_0x7533('0x40')]){_0x23a448[_0x7533('0x3d')]=_[_0x7533('0x41')](_0x23a448[_0x7533('0x3d')],{'$or':_[_0x7533('0x33')](_0x23a448[_0x7533('0x38')],function(_0x2a893c){var _0x30fce1={};_0x30fce1[_0x2a893c]={'$like':'%'+_0x2dc14d['query'][_0x7533('0x40')]+'%'};return _0x30fce1;})});}_0x23a448=_[_0x7533('0x41')]({},_0x23a448,_0x2dc14d[_0x7533('0x42')]);return db[_0x7533('0x68')][_0x7533('0x84')](_0x23a448);}})[_0x7533('0x25')](respondWithResult(_0x3868e7,null))[_0x7533('0x47')](handleError(_0x3868e7,null));};exports[_0x7533('0x85')]=function(_0x7fbbf7,_0x146c0f,_0x3244f0){return db['CmList']['find']({'where':{'id':_0x7fbbf7[_0x7533('0x54')]['id']}})['then'](handleEntityNotFound(_0x146c0f,null))[_0x7533('0x25')](function(_0x3ff9c0){if(_0x3ff9c0){return _0x3ff9c0[_0x7533('0x85')](_0x7fbbf7[_0x7533('0x53')][_0x7533('0x5c')],_[_0x7533('0x62')](_0x7fbbf7['body'],['ids','id'])||{})[_0x7533('0x86')](function(_0xe05aeb){for(var _0x1a3dba=0x0;_0x1a3dba<_0x7fbbf7[_0x7533('0x53')]['ids'][_0x7533('0x4a')];_0x1a3dba+=0x1){socket[_0x7533('0x87')](_0x7533('0x88'),{'UserId':Number(_0x7fbbf7['body'][_0x7533('0x5c')][_0x1a3dba]),'CmListId':Number(_0x7fbbf7[_0x7533('0x54')]['id'])});}return _0xe05aeb;});}})[_0x7533('0x25')](respondWithResult(_0x146c0f,null))[_0x7533('0x47')](handleError(_0x146c0f,null));};exports[_0x7533('0x89')]=function(_0x54ae70,_0x31f62c,_0x147d3f){return db[_0x7533('0x2e')][_0x7533('0x4b')]({'where':{'id':_0x54ae70['params']['id']}})[_0x7533('0x25')](handleEntityNotFound(_0x31f62c,null))['then'](function(_0x5e48ce){if(_0x5e48ce){return _0x5e48ce[_0x7533('0x89')](_0x54ae70[_0x7533('0x35')][_0x7533('0x5c')])[_0x7533('0x25')](function(){if(_[_0x7533('0x60')](_0x54ae70['query'][_0x7533('0x5c')])){for(var _0x3eba66=0x0;_0x3eba66<_0x54ae70[_0x7533('0x35')][_0x7533('0x5c')][_0x7533('0x4a')];_0x3eba66+=0x1){socket['emit'](_0x7533('0x8a'),{'UserId':Number(_0x54ae70[_0x7533('0x35')][_0x7533('0x5c')][_0x3eba66]),'CmListId':Number(_0x54ae70[_0x7533('0x54')]['id'])});}}else{socket[_0x7533('0x87')](_0x7533('0x8a'),{'UserId':Number(_0x54ae70[_0x7533('0x35')][_0x7533('0x5c')]),'CmListId':Number(_0x54ae70['params']['id'])});}});}})[_0x7533('0x25')](respondWithStatusCode(_0x31f62c,null))[_0x7533('0x47')](handleError(_0x31f62c,null));};exports['getAgents']=function(_0x1105b0,_0x59c46d,_0xd773ee){var _0x40d17b={};var _0x3350c9={};var _0x39cbb0;var _0x12155a;return db[_0x7533('0x2e')]['findOne']({'where':{'id':_0x1105b0[_0x7533('0x54')]['id']}})['then'](handleEntityNotFound(_0x59c46d,null))[_0x7533('0x25')](function(_0x14ff39){if(_0x14ff39){_0x39cbb0=_0x14ff39;_0x3350c9['model']=_[_0x7533('0x34')](db[_0x7533('0x8b')][_0x7533('0x2f')]);_0x3350c9[_0x7533('0x35')]=_[_0x7533('0x34')](_0x1105b0[_0x7533('0x35')]);_0x3350c9['filters']=_[_0x7533('0x36')](_0x3350c9[_0x7533('0x32')],_0x3350c9[_0x7533('0x35')]);_0x40d17b[_0x7533('0x38')]=_[_0x7533('0x36')](_0x3350c9[_0x7533('0x32')],qs['fields'](_0x1105b0['query'][_0x7533('0x37')]));_0x40d17b['attributes']=_0x40d17b[_0x7533('0x38')][_0x7533('0x4a')]?_0x40d17b['attributes']:_0x3350c9[_0x7533('0x32')];_0x40d17b[_0x7533('0x3b')]=qs[_0x7533('0x3c')](_0x1105b0['query'][_0x7533('0x3c')]);_0x40d17b[_0x7533('0x3d')]=qs[_0x7533('0x49')](_[_0x7533('0x5a')](_0x1105b0[_0x7533('0x35')],_0x3350c9[_0x7533('0x49')]));if(_0x1105b0[_0x7533('0x35')][_0x7533('0x40')]){_0x40d17b[_0x7533('0x3d')]=_['merge'](_0x40d17b[_0x7533('0x3d')],{'$or':_[_0x7533('0x33')](_0x40d17b['attributes'],function(_0x219ec3){var _0x3caff7={};_0x3caff7[_0x219ec3]={'$like':'%'+_0x1105b0[_0x7533('0x35')][_0x7533('0x40')]+'%'};return _0x3caff7;})});}_0x40d17b=_[_0x7533('0x41')]({},_0x40d17b,_0x1105b0[_0x7533('0x42')]);return _0x39cbb0[_0x7533('0x8c')](_0x40d17b);}})[_0x7533('0x25')](function(_0x290649){if(_0x290649){_0x12155a=_0x290649[_0x7533('0x4a')];if(!_0x1105b0['query'][_0x7533('0x39')](_0x7533('0x3a'))){_0x40d17b[_0x7533('0x1d')]=qs[_0x7533('0x1d')](_0x1105b0[_0x7533('0x35')][_0x7533('0x1d')]);_0x40d17b['offset']=qs['offset'](_0x1105b0[_0x7533('0x35')]['offset']);}return _0x39cbb0[_0x7533('0x8c')](_0x40d17b);}})[_0x7533('0x25')](function(_0x4b263a){if(_0x4b263a){return _0x4b263a?{'count':_0x12155a,'rows':_0x4b263a}:null;}})[_0x7533('0x25')](respondWithResult(_0x59c46d,null))[_0x7533('0x47')](handleError(_0x59c46d,null));}; \ No newline at end of file +var _0x1c12=['addCustomField','transaction','addCustomFields','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','findAndCountAll','addAgents','omit','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','reject','save','update','destroy','then','get','Lists','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','length','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','options','CmList','includeAll','include','findAll','params','keys','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','findOne','nolimit','rows','removeDispositions','tags','join','isArray','push','CmContact','ids','success','dataValues','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','format','cf_%d','raw','getContactsCsv','CmCustomField','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','text/csv','download'];(function(_0x81a812,_0x2723d7){var _0x260423=function(_0x3c9549){while(--_0x3c9549){_0x81a812['push'](_0x81a812['shift']());}};_0x260423(++_0x2723d7);}(_0x1c12,0xa4));var _0x21c1=function(_0x2134b2,_0x57a161){_0x2134b2=_0x2134b2-0x0;var _0x3e5d50=_0x1c12[_0x2134b2];return _0x3e5d50;};'use strict';var emlformat=require(_0x21c1('0x0'));var rimraf=require(_0x21c1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x21c1('0x2'));var rp=require(_0x21c1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x21c1('0x4'));var util=require(_0x21c1('0x5'));var path=require(_0x21c1('0x6'));var sox=require(_0x21c1('0x7'));var csv=require('to-csv');var ejs=require(_0x21c1('0x8'));var fs=require('fs');var fs_extra=require(_0x21c1('0x9'));var _=require('lodash');var squel=require(_0x21c1('0xa'));var crypto=require('crypto');var jsforce=require(_0x21c1('0xb'));var deskjs=require(_0x21c1('0xc'));var toCsv=require(_0x21c1('0xd'));var querystring=require(_0x21c1('0xe'));var Papa=require(_0x21c1('0xf'));var Redis=require(_0x21c1('0x10'));var authService=require(_0x21c1('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x21c1('0x12'));var hardwareService=require(_0x21c1('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x21c1('0x14'));var config=require(_0x21c1('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x21c1('0x16')]=_[_0x21c1('0x17')](config[_0x21c1('0x16')],{'host':_0x21c1('0x18'),'port':0x18eb});var socket=require(_0x21c1('0x19'))(new Redis(config[_0x21c1('0x16')]));require(_0x21c1('0x1a'))[_0x21c1('0x1b')](socket);function respondWithStatusCode(_0x29344c,_0x2646fe){_0x2646fe=_0x2646fe||0xcc;return function(_0x553d72){if(_0x553d72){return _0x29344c[_0x21c1('0x1c')](_0x2646fe);}return _0x29344c['status'](_0x2646fe)[_0x21c1('0x1d')]();};}function respondWithResult(_0x1485cd,_0x1dbe02){_0x1dbe02=_0x1dbe02||0xc8;return function(_0x44f6b3){if(_0x44f6b3){return _0x1485cd['status'](_0x1dbe02)['json'](_0x44f6b3);}};}function respondWithFilteredResult(_0x1267ee,_0x17ab17){return function(_0x19536d){if(_0x19536d){var _0x35db6e=typeof _0x17ab17[_0x21c1('0x1e')]===_0x21c1('0x1f')&&typeof _0x17ab17[_0x21c1('0x20')]===_0x21c1('0x1f');var _0xf7b626=_0x19536d[_0x21c1('0x21')];var _0x2ed853=_0x35db6e?0x0:_0x17ab17[_0x21c1('0x1e')];var _0x5f1710=_0x35db6e?_0x19536d[_0x21c1('0x21')]:_0x17ab17[_0x21c1('0x1e')]+_0x17ab17[_0x21c1('0x20')];var _0x541c52;if(_0x5f1710>=_0xf7b626){_0x5f1710=_0xf7b626;_0x541c52=0xc8;}else{_0x541c52=0xce;}_0x1267ee[_0x21c1('0x22')](_0x541c52);return _0x1267ee[_0x21c1('0x23')](_0x21c1('0x24'),_0x2ed853+'-'+_0x5f1710+'/'+_0xf7b626)[_0x21c1('0x25')](_0x19536d);}return null;};}function patchUpdates(_0x26caf3){return function(_0x5186f3){try{jsonpatch[_0x21c1('0x26')](_0x5186f3,_0x26caf3,!![]);}catch(_0xf688e8){return BPromise[_0x21c1('0x27')](_0xf688e8);}return _0x5186f3[_0x21c1('0x28')]();};}function saveUpdates(_0x495c31,_0x2bf361){return function(_0x4c2523){if(_0x4c2523){return _0x4c2523[_0x21c1('0x29')](_0x495c31)['then'](function(_0x9e9745){return _0x9e9745;});}return null;};}function removeEntity(_0x546e06,_0x4460c3){return function(_0x3f10c9){if(_0x3f10c9){return _0x3f10c9[_0x21c1('0x2a')]()[_0x21c1('0x2b')](function(){var _0x1b2207=_0x3f10c9[_0x21c1('0x2c')]({'plain':!![]});var _0x244bd7=_0x21c1('0x2d');return db['UserProfileResource'][_0x21c1('0x2a')]({'where':{'type':_0x244bd7,'resourceId':_0x1b2207['id']}})[_0x21c1('0x2b')](function(){return _0x3f10c9;});})[_0x21c1('0x2b')](function(){_0x546e06[_0x21c1('0x22')](0xcc)[_0x21c1('0x1d')]();});}};}function handleEntityNotFound(_0x1e1dd6,_0x59357f){return function(_0x1cc4d0){if(!_0x1cc4d0){_0x1e1dd6[_0x21c1('0x1c')](0x194);}return _0x1cc4d0;};}function handleError(_0x2f82ba,_0x5c75b0){_0x5c75b0=_0x5c75b0||0x1f4;return function(_0x185a91){logger[_0x21c1('0x2e')](_0x185a91[_0x21c1('0x2f')]);if(_0x185a91['name']){delete _0x185a91[_0x21c1('0x30')];}_0x2f82ba[_0x21c1('0x22')](_0x5c75b0)[_0x21c1('0x31')](_0x185a91);};}exports[_0x21c1('0x32')]=function(_0x2f22b0,_0x5689bf){var _0x49f53a={},_0x460634={},_0xc9f9da={'count':0x0,'rows':[]};var _0x3afb4a=_[_0x21c1('0x33')](db['CmList'][_0x21c1('0x34')],function(_0x58377d){return{'name':_0x58377d[_0x21c1('0x35')],'type':_0x58377d[_0x21c1('0x36')][_0x21c1('0x37')]};});_0x460634[_0x21c1('0x38')]=_['map'](_0x3afb4a,_0x21c1('0x30'));_0x460634[_0x21c1('0x39')]=_['keys'](_0x2f22b0[_0x21c1('0x39')]);_0x460634[_0x21c1('0x3a')]=_['intersection'](_0x460634[_0x21c1('0x38')],_0x460634[_0x21c1('0x39')]);_0x49f53a['attributes']=_[_0x21c1('0x3b')](_0x460634[_0x21c1('0x38')],qs[_0x21c1('0x3c')](_0x2f22b0[_0x21c1('0x39')][_0x21c1('0x3c')]));_0x49f53a['attributes']=_0x49f53a['attributes'][_0x21c1('0x3d')]?_0x49f53a[_0x21c1('0x3e')]:_0x460634[_0x21c1('0x38')];if(!_0x2f22b0[_0x21c1('0x39')][_0x21c1('0x3f')]('nolimit')){_0x49f53a[_0x21c1('0x20')]=qs[_0x21c1('0x20')](_0x2f22b0[_0x21c1('0x39')][_0x21c1('0x20')]);_0x49f53a[_0x21c1('0x1e')]=qs[_0x21c1('0x1e')](_0x2f22b0[_0x21c1('0x39')]['offset']);}_0x49f53a[_0x21c1('0x40')]=qs[_0x21c1('0x41')](_0x2f22b0[_0x21c1('0x39')][_0x21c1('0x41')]);_0x49f53a[_0x21c1('0x42')]=qs['filters'](_[_0x21c1('0x43')](_0x2f22b0[_0x21c1('0x39')],_0x460634[_0x21c1('0x3a')]),_0x3afb4a);if(_0x2f22b0[_0x21c1('0x39')][_0x21c1('0x44')]){_0x49f53a[_0x21c1('0x42')]=_[_0x21c1('0x45')](_0x49f53a[_0x21c1('0x42')],{'$or':_['map'](_0x3afb4a,function(_0x723ee9){if(_0x723ee9[_0x21c1('0x36')]!=='VIRTUAL'){var _0x4a54bf={};_0x4a54bf[_0x723ee9['name']]={'$like':'%'+_0x2f22b0[_0x21c1('0x39')][_0x21c1('0x44')]+'%'};return _0x4a54bf;}})});}_0x49f53a=_[_0x21c1('0x45')]({},_0x49f53a,_0x2f22b0[_0x21c1('0x46')]);var _0x5bc2bc={'where':_0x49f53a['where']};return db[_0x21c1('0x47')]['count'](_0x5bc2bc)[_0x21c1('0x2b')](function(_0x4a4de9){_0xc9f9da['count']=_0x4a4de9;if(_0x2f22b0[_0x21c1('0x39')][_0x21c1('0x48')]){_0x49f53a[_0x21c1('0x49')]=[{'all':!![]}];}return db[_0x21c1('0x47')][_0x21c1('0x4a')](_0x49f53a);})[_0x21c1('0x2b')](function(_0x186c80){_0xc9f9da['rows']=_0x186c80;return _0xc9f9da;})[_0x21c1('0x2b')](respondWithFilteredResult(_0x5689bf,_0x49f53a))['catch'](handleError(_0x5689bf,null));};exports['show']=function(_0x140fb8,_0x4f6e3b){var _0x8f7448={'raw':![],'where':{'id':_0x140fb8[_0x21c1('0x4b')]['id']}},_0x3a479c={};_0x3a479c['model']=_[_0x21c1('0x4c')](db[_0x21c1('0x47')]['rawAttributes']);_0x3a479c['query']=_[_0x21c1('0x4c')](_0x140fb8[_0x21c1('0x39')]);_0x3a479c[_0x21c1('0x3a')]=_[_0x21c1('0x3b')](_0x3a479c[_0x21c1('0x38')],_0x3a479c[_0x21c1('0x39')]);_0x8f7448[_0x21c1('0x3e')]=_['intersection'](_0x3a479c[_0x21c1('0x38')],qs['fields'](_0x140fb8[_0x21c1('0x39')]['fields']));_0x8f7448[_0x21c1('0x3e')]=_0x8f7448['attributes'][_0x21c1('0x3d')]?_0x8f7448[_0x21c1('0x3e')]:_0x3a479c[_0x21c1('0x38')];if(_0x140fb8[_0x21c1('0x39')][_0x21c1('0x48')]){_0x8f7448[_0x21c1('0x49')]=[{'all':!![]}];}_0x8f7448=_[_0x21c1('0x45')]({},_0x8f7448,_0x140fb8[_0x21c1('0x46')]);return db[_0x21c1('0x47')][_0x21c1('0x4d')](_0x8f7448)[_0x21c1('0x2b')](handleEntityNotFound(_0x4f6e3b,null))[_0x21c1('0x2b')](respondWithResult(_0x4f6e3b,null))[_0x21c1('0x4e')](handleError(_0x4f6e3b,null));};exports['create']=function(_0x271183,_0x5af54b){return db[_0x21c1('0x47')][_0x21c1('0x4f')](_0x271183[_0x21c1('0x50')],{})[_0x21c1('0x2b')](function(_0x2938ea){var _0x54b03e=_0x271183['user'][_0x21c1('0x2c')]({'plain':!![]});if(!_0x54b03e)throw new Error(_0x21c1('0x51'));if(_0x54b03e[_0x21c1('0x52')]===_0x21c1('0x53')){var _0x5e8871=_0x2938ea[_0x21c1('0x2c')]({'plain':!![]});var _0xe2cd75=_0x21c1('0x2d');return db[_0x21c1('0x54')]['find']({'where':{'name':_0xe2cd75,'userProfileId':_0x54b03e['userProfileId']},'raw':!![]})[_0x21c1('0x2b')](function(_0x5995f3){if(_0x5995f3&&_0x5995f3['autoAssociation']===0x0){return db['UserProfileResource'][_0x21c1('0x4f')]({'name':_0x5e8871[_0x21c1('0x30')],'resourceId':_0x5e8871['id'],'type':_0x5995f3[_0x21c1('0x30')],'sectionId':_0x5995f3['id']},{})[_0x21c1('0x2b')](function(){return _0x2938ea;});}else{return _0x2938ea;}})[_0x21c1('0x4e')](function(_0x5c0f37){logger['error'](_0x21c1('0x55'),_0x5c0f37);throw _0x5c0f37;});}return _0x2938ea;})['then'](respondWithResult(_0x5af54b,0xc9))['catch'](handleError(_0x5af54b,null));};exports[_0x21c1('0x29')]=function(_0x35e141,_0x2bc089){if(_0x35e141[_0x21c1('0x50')]['id']){delete _0x35e141[_0x21c1('0x50')]['id'];}return db['CmList'][_0x21c1('0x4d')]({'where':{'id':_0x35e141['params']['id']}})[_0x21c1('0x2b')](handleEntityNotFound(_0x2bc089,null))['then'](saveUpdates(_0x35e141[_0x21c1('0x50')],null))['then'](respondWithResult(_0x2bc089,null))[_0x21c1('0x4e')](handleError(_0x2bc089,null));};exports[_0x21c1('0x2a')]=function(_0x599552,_0x19e339){return db[_0x21c1('0x47')]['find']({'where':{'id':_0x599552[_0x21c1('0x4b')]['id']}})[_0x21c1('0x2b')](handleEntityNotFound(_0x19e339,null))[_0x21c1('0x2b')](removeEntity(_0x19e339,null))['catch'](handleError(_0x19e339,null));};exports['describe']=function(_0x3fa2bf,_0x2c6341){return db['CmList'][_0x21c1('0x56')]()[_0x21c1('0x2b')](respondWithResult(_0x2c6341,null))['catch'](handleError(_0x2c6341,null));};exports[_0x21c1('0x57')]=function(_0x5ed30d,_0x3a964a,_0x515b2a){if(_0x5ed30d[_0x21c1('0x50')]['id']){delete _0x5ed30d['body']['id'];}return db['CmList'][_0x21c1('0x4d')]({'where':{'id':_0x5ed30d['params']['id']}})[_0x21c1('0x2b')](handleEntityNotFound(_0x3a964a,null))['then'](function(_0x2ded21){if(_0x2ded21){_0x5ed30d[_0x21c1('0x50')][_0x21c1('0x58')]=_0x2ded21['id'];return db[_0x21c1('0x59')][_0x21c1('0x4f')](_0x5ed30d[_0x21c1('0x50')]);}})[_0x21c1('0x2b')](respondWithResult(_0x3a964a,null))[_0x21c1('0x4e')](handleError(_0x3a964a,null));};exports['getDispositions']=function(_0x152a40,_0x10198e,_0x43bf2d){var _0x2a7944={'raw':![],'where':{}};var _0x3a5ad2={};var _0x1378ca={'count':0x0,'rows':[]};return db[_0x21c1('0x47')][_0x21c1('0x5a')]({'where':{'id':_0x152a40[_0x21c1('0x4b')]['id']}})[_0x21c1('0x2b')](handleEntityNotFound(_0x10198e,null))[_0x21c1('0x2b')](function(_0x149fbd){if(_0x149fbd){_0x3a5ad2[_0x21c1('0x38')]=_[_0x21c1('0x4c')](db[_0x21c1('0x59')][_0x21c1('0x34')]);_0x3a5ad2['query']=_[_0x21c1('0x4c')](_0x152a40[_0x21c1('0x39')]);_0x3a5ad2[_0x21c1('0x3a')]=_[_0x21c1('0x3b')](_0x3a5ad2[_0x21c1('0x38')],_0x3a5ad2[_0x21c1('0x39')]);_0x2a7944['attributes']=_[_0x21c1('0x3b')](_0x3a5ad2[_0x21c1('0x38')],qs[_0x21c1('0x3c')](_0x152a40[_0x21c1('0x39')][_0x21c1('0x3c')]));_0x2a7944[_0x21c1('0x3e')]=_0x2a7944[_0x21c1('0x3e')][_0x21c1('0x3d')]?_0x2a7944[_0x21c1('0x3e')]:_0x3a5ad2[_0x21c1('0x38')];if(!_0x152a40[_0x21c1('0x39')][_0x21c1('0x3f')](_0x21c1('0x5b'))){_0x2a7944[_0x21c1('0x20')]=qs[_0x21c1('0x20')](_0x152a40['query']['limit']);_0x2a7944[_0x21c1('0x1e')]=qs['offset'](_0x152a40['query']['offset']);}_0x2a7944[_0x21c1('0x40')]=qs[_0x21c1('0x41')](_0x152a40['query'][_0x21c1('0x41')]);_0x2a7944[_0x21c1('0x42')]=qs['filters'](_[_0x21c1('0x43')](_0x152a40[_0x21c1('0x39')],_0x3a5ad2[_0x21c1('0x3a')]));_0x2a7944[_0x21c1('0x42')][_0x21c1('0x58')]=_0x149fbd['id'];if(_0x152a40[_0x21c1('0x39')][_0x21c1('0x44')]){_0x2a7944['where']=_['merge'](_0x2a7944[_0x21c1('0x42')],{'$or':_[_0x21c1('0x33')](_0x2a7944[_0x21c1('0x3e')],function(_0x3c6c04){var _0x3ff16a={};_0x3ff16a[_0x3c6c04]={'$like':'%'+_0x152a40[_0x21c1('0x39')][_0x21c1('0x44')]+'%'};return _0x3ff16a;})});}_0x2a7944=_[_0x21c1('0x45')]({},_0x2a7944,_0x152a40['options']);return db[_0x21c1('0x59')]['count']({'where':_0x2a7944[_0x21c1('0x42')]})[_0x21c1('0x2b')](function(_0x4a3815){_0x1378ca[_0x21c1('0x21')]=_0x4a3815;if(_0x152a40[_0x21c1('0x39')][_0x21c1('0x48')]){_0x2a7944['include']=[{'all':!![]}];}return db[_0x21c1('0x59')][_0x21c1('0x4a')](_0x2a7944);})[_0x21c1('0x2b')](function(_0x1bf58f){_0x1378ca[_0x21c1('0x5c')]=_0x1bf58f;return _0x1378ca;});}})[_0x21c1('0x2b')](respondWithFilteredResult(_0x10198e,_0x2a7944))[_0x21c1('0x4e')](handleError(_0x10198e,null));};exports[_0x21c1('0x5d')]=function(_0x39def9,_0x3b2929,_0x3548dc){return db['CmList']['find']({'where':{'id':_0x39def9[_0x21c1('0x4b')]['id']}})[_0x21c1('0x2b')](handleEntityNotFound(_0x3b2929,null))[_0x21c1('0x2b')](function(_0x16ff25){if(_0x16ff25){return _0x16ff25[_0x21c1('0x5d')](_0x39def9[_0x21c1('0x39')]['ids']);}})[_0x21c1('0x2b')](respondWithStatusCode(_0x3b2929,null))[_0x21c1('0x4e')](handleError(_0x3b2929,null));};exports['addContacts']=function(_0x53ec04,_0x2bd7c3,_0x5b2f3e){return db[_0x21c1('0x47')][_0x21c1('0x4d')]({'where':{'id':_0x53ec04[_0x21c1('0x4b')]['id']}})[_0x21c1('0x2b')](handleEntityNotFound(_0x2bd7c3,null))[_0x21c1('0x2b')](function(_0x2fbe74){if(_0x2fbe74){var _0x164b20=[];var _0x2325db={'success':[],'errors':[]};return db['CmContact']['describe']()[_0x21c1('0x2b')](function(_0x539408){if(_0x53ec04[_0x21c1('0x50')]['tags']&&_['isArray'](_0x53ec04['body'][_0x21c1('0x5e')])){if(_0x53ec04[_0x21c1('0x50')]['tags']['length']){_0x53ec04[_0x21c1('0x50')]['tags']=_0x53ec04['body'][_0x21c1('0x5e')][_0x21c1('0x5f')](';')+';';}else{_0x53ec04['body'][_0x21c1('0x5e')]=null;}}else{_0x53ec04[_0x21c1('0x50')][_0x21c1('0x5e')]=null;}if(_0x53ec04[_0x21c1('0x50')]&&_[_0x21c1('0x60')](_0x53ec04['body'])){for(var _0x35cab0=0x0;_0x35cab0<_0x53ec04[_0x21c1('0x50')][_0x21c1('0x3d')];_0x35cab0+=0x1){_0x53ec04['body'][_0x35cab0][_0x21c1('0x58')]=_0x53ec04['params']['id'];_0x164b20[_0x21c1('0x61')](_0x53ec04['body'][_0x35cab0]);}return BPromise['each'](_0x164b20,function(_0x3ea260){return db[_0x21c1('0x62')][_0x21c1('0x4f')](_['omit'](_0x3ea260,[_0x21c1('0x63'),'id'])||{},{'fields':_['keys'](_0x539408),'raw':!![]})['then'](function(_0x57452f){_0x2325db[_0x21c1('0x64')][_0x21c1('0x61')](_0x57452f[_0x21c1('0x65')]);})[_0x21c1('0x4e')](function(_0x387213){_0x2325db['errors']['push']({'data':_0x3ea260,'error':_0x387213['message']});});})['then'](function(_0x1317db){return _0x2325db;})['catch'](function(_0x540bdf){return _0x540bdf;});}else{_0x2bd7c3[_0x21c1('0x22')](0x190)[_0x21c1('0x25')]({'message':_0x21c1('0x66')});}});}})['then'](respondWithResult(_0x2bd7c3,null))[_0x21c1('0x4e')](handleError(_0x2bd7c3,null));};exports[_0x21c1('0x67')]=function(_0x26799d,_0x497cc6,_0x59a7d3){var _0x923d8c;return db['CmList'][_0x21c1('0x4d')]({'where':{'id':_0x26799d[_0x21c1('0x4b')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x21c1('0x68')}]})[_0x21c1('0x2b')](handleEntityNotFound(_0x497cc6,null))[_0x21c1('0x2b')](function(_0x3f4f38){if(_0x3f4f38){_0x923d8c=_0x3f4f38;return db[_0x21c1('0x62')]['rawAttributes'];}})['then'](function(_0x92fc1){if(_0x92fc1){var _0x22df3f={};var _0x18b660={};_0x18b660[_0x21c1('0x38')]=_[_0x21c1('0x69')](_[_0x21c1('0x4c')](_0x92fc1),_[_0x21c1('0x33')](_0x923d8c[_0x21c1('0x68')],function(_0x1e7407){return util[_0x21c1('0x6a')](_0x21c1('0x6b'),_0x1e7407['id']);}));_0x18b660[_0x21c1('0x39')]=_[_0x21c1('0x4c')](_0x26799d['query']);_0x18b660['filters']=_[_0x21c1('0x3b')](_0x18b660[_0x21c1('0x38')],_0x18b660['query']);_0x22df3f[_0x21c1('0x3e')]=_[_0x21c1('0x3b')](_0x18b660['model'],qs['fields'](_0x26799d[_0x21c1('0x39')][_0x21c1('0x3c')]));_0x22df3f[_0x21c1('0x3e')]=_0x22df3f[_0x21c1('0x3e')][_0x21c1('0x3d')]?_0x22df3f[_0x21c1('0x3e')]:_0x18b660[_0x21c1('0x38')];if(!_0x26799d['query']['hasOwnProperty'](_0x21c1('0x5b'))){_0x22df3f[_0x21c1('0x20')]=qs[_0x21c1('0x20')](_0x26799d[_0x21c1('0x39')][_0x21c1('0x20')]);_0x22df3f[_0x21c1('0x1e')]=qs[_0x21c1('0x1e')](_0x26799d[_0x21c1('0x39')][_0x21c1('0x1e')]);}_0x22df3f[_0x21c1('0x40')]=qs['sort'](_0x26799d[_0x21c1('0x39')][_0x21c1('0x41')]);_0x22df3f['where']=qs[_0x21c1('0x3a')](_[_0x21c1('0x43')](_0x26799d[_0x21c1('0x39')],_0x18b660[_0x21c1('0x3a')]));_0x22df3f[_0x21c1('0x6c')]=!![];if(_0x26799d['query'][_0x21c1('0x44')]){_0x22df3f[_0x21c1('0x42')]=_[_0x21c1('0x45')](_0x22df3f['where'],{'$or':_[_0x21c1('0x33')](_0x22df3f[_0x21c1('0x3e')],function(_0x38440c){var _0x4583b3={};_0x4583b3[_0x38440c]={'$like':'%'+_0x26799d[_0x21c1('0x39')][_0x21c1('0x44')]+'%'};return _0x4583b3;})});}_0x22df3f=_[_0x21c1('0x45')]({},_0x22df3f,_0x26799d[_0x21c1('0x46')]);return _0x923d8c[_0x21c1('0x67')](_0x22df3f);}})[_0x21c1('0x2b')](respondWithResult(_0x497cc6,null))[_0x21c1('0x4e')](handleError(_0x497cc6,null));};exports[_0x21c1('0x6d')]=function(_0x43b8f3,_0x576d55,_0x37d630){var _0x4d6aa7;return db[_0x21c1('0x47')][_0x21c1('0x4d')]({'where':{'id':_0x43b8f3['params']['id']},'include':[{'model':db[_0x21c1('0x6e')],'as':'CustomFields'}]})[_0x21c1('0x2b')](handleEntityNotFound(_0x576d55,null))[_0x21c1('0x2b')](function(_0x3becb6){if(_0x3becb6){_0x4d6aa7=_0x3becb6;return db['CmContact'][_0x21c1('0x34')];}})[_0x21c1('0x2b')](function(_0x2de47a){if(_0x2de47a){var _0x2d387b={};var _0x4aefbe={};_0x4aefbe[_0x21c1('0x38')]=_[_0x21c1('0x69')](_[_0x21c1('0x4c')](_0x2de47a),_['map'](_0x4d6aa7[_0x21c1('0x68')],function(_0x5d3a94){return util[_0x21c1('0x6a')](_0x21c1('0x6b'),_0x5d3a94['id']);}));_0x4aefbe[_0x21c1('0x39')]=_[_0x21c1('0x4c')](_0x43b8f3['query']);_0x4aefbe[_0x21c1('0x3a')]=_[_0x21c1('0x3b')](_0x4aefbe['model'],_0x4aefbe[_0x21c1('0x39')]);_0x2d387b['attributes']=_[_0x21c1('0x3b')](_0x4aefbe[_0x21c1('0x38')],qs[_0x21c1('0x3c')](_0x43b8f3['query'][_0x21c1('0x3c')]));_0x2d387b[_0x21c1('0x3e')]=_0x2d387b[_0x21c1('0x3e')]['length']?_0x2d387b[_0x21c1('0x3e')]:_0x4aefbe[_0x21c1('0x38')];if(!_0x43b8f3['query'][_0x21c1('0x3f')]('nolimit')){_0x2d387b['limit']=qs['limit'](_0x43b8f3[_0x21c1('0x39')][_0x21c1('0x20')]);_0x2d387b[_0x21c1('0x1e')]=qs[_0x21c1('0x1e')](_0x43b8f3[_0x21c1('0x39')][_0x21c1('0x1e')]);}_0x2d387b[_0x21c1('0x40')]=qs[_0x21c1('0x41')](_0x43b8f3[_0x21c1('0x39')][_0x21c1('0x41')]);_0x2d387b['where']=qs['filters'](_[_0x21c1('0x43')](_0x43b8f3['query'],_0x4aefbe[_0x21c1('0x3a')]));_0x2d387b['raw']=!![];if(_0x43b8f3[_0x21c1('0x39')][_0x21c1('0x44')]){_0x2d387b['where']=_[_0x21c1('0x45')](_0x2d387b['where'],{'$or':_[_0x21c1('0x33')](_0x2d387b[_0x21c1('0x3e')],function(_0x20c50a){var _0x4fdc2a={};_0x4fdc2a[_0x20c50a]={'$like':'%'+_0x43b8f3[_0x21c1('0x39')][_0x21c1('0x44')]+'%'};return _0x4fdc2a;})});}_0x2d387b=_['merge']({},_0x2d387b,_0x43b8f3[_0x21c1('0x46')]);return _0x4d6aa7[_0x21c1('0x67')](_0x2d387b);}})[_0x21c1('0x2b')](function(_0x22f60b){if(!_[_0x21c1('0x6f')](_0x22f60b)){var _0x192c2a=toCsv(_0x22f60b);var _0x57e953=Date[_0x21c1('0x70')]();fs[_0x21c1('0x71')](util[_0x21c1('0x6a')](_0x21c1('0x72'),_0x4d6aa7['id'],_0x57e953),_0x192c2a);_0x576d55['setHeader'](_0x21c1('0x73'),_0x21c1('0x74')+util[_0x21c1('0x6a')](_0x21c1('0x75'),_0x4d6aa7['id'],_0x57e953));_0x576d55[_0x21c1('0x76')](_0x21c1('0x77'),_0x21c1('0x78'));return _0x576d55[_0x21c1('0x79')](util[_0x21c1('0x6a')](_0x21c1('0x72'),_0x4d6aa7['id'],_0x57e953));}else{return _0x576d55['sendStatus'](0xcc);}})['catch'](handleError(_0x576d55,null));};exports[_0x21c1('0x7a')]=function(_0x5c7b35,_0x308767,_0x5b6d45){var _0x26ac3b;delete _0x5c7b35[_0x21c1('0x50')]['id'];return db[_0x21c1('0x47')][_0x21c1('0x5a')]({'where':{'id':_0x5c7b35[_0x21c1('0x4b')]['id']}})[_0x21c1('0x2b')](handleEntityNotFound(_0x308767,null))[_0x21c1('0x2b')](function(_0x396fb4){if(_0x396fb4){return db['sequelize'][_0x21c1('0x7b')](function(_0x1a58ca){return db['CmCustomField']['create'](_0x5c7b35[_0x21c1('0x50')],{'transaction':_0x1a58ca})[_0x21c1('0x2b')](function(_0x5a97df){_0x26ac3b=_0x5a97df;return _0x396fb4[_0x21c1('0x7c')](_0x5a97df,{'transaction':_0x1a58ca});})[_0x21c1('0x2b')](function(){var _0x373a72={'type':db[_0x21c1('0x7d')][_0x21c1('0x7e')],'transaction':_0x1a58ca};switch(_0x5c7b35[_0x21c1('0x50')][_0x21c1('0x36')]){case'text':_0x373a72[_0x21c1('0x36')]=db[_0x21c1('0x7d')]['TEXT'];break;case _0x21c1('0x7f'):_0x373a72['type']=db['Sequelize'][_0x21c1('0x80')];break;case _0x21c1('0x81'):_0x373a72[_0x21c1('0x36')]=db['Sequelize'][_0x21c1('0x82')];_0x373a72[_0x21c1('0x83')]=![];break;default:}return db['sequelize']['queryInterface'][_0x21c1('0x84')]('cm_contacts',util[_0x21c1('0x6a')]('cf_%s',_0x26ac3b['id']),_0x373a72);})[_0x21c1('0x2b')](function(){return _0x26ac3b;});});}})['then'](respondWithResult(_0x308767,null))[_0x21c1('0x4e')](handleError(_0x308767,null));};exports['getCustomFields']=function(_0x3a6c82,_0x534961,_0x18fb9d){var _0x1ab372={};var _0x3a42e6={};var _0x329636;var _0x3caeb3;return db[_0x21c1('0x47')][_0x21c1('0x5a')]({'where':{'id':_0x3a6c82['params']['id']}})[_0x21c1('0x2b')](handleEntityNotFound(_0x534961,null))[_0x21c1('0x2b')](function(_0x2ebe46){if(_0x2ebe46){_0x329636=_0x2ebe46;_0x3a42e6[_0x21c1('0x38')]=_['keys'](db[_0x21c1('0x6e')]['rawAttributes']);_0x3a42e6[_0x21c1('0x39')]=_[_0x21c1('0x4c')](_0x3a6c82[_0x21c1('0x39')]);_0x3a42e6[_0x21c1('0x3a')]=_[_0x21c1('0x3b')](_0x3a42e6[_0x21c1('0x38')],_0x3a42e6[_0x21c1('0x39')]);_0x1ab372[_0x21c1('0x3e')]=_['intersection'](_0x3a42e6[_0x21c1('0x38')],qs['fields'](_0x3a6c82[_0x21c1('0x39')][_0x21c1('0x3c')]));_0x1ab372['attributes']=_0x1ab372[_0x21c1('0x3e')][_0x21c1('0x3d')]?_0x1ab372[_0x21c1('0x3e')]:_0x3a42e6['model'];_0x1ab372[_0x21c1('0x40')]=qs['sort'](_0x3a6c82[_0x21c1('0x39')]['sort']);_0x1ab372[_0x21c1('0x42')]=qs[_0x21c1('0x3a')](_[_0x21c1('0x43')](_0x3a6c82[_0x21c1('0x39')],_0x3a42e6[_0x21c1('0x3a')]));_0x1ab372[_0x21c1('0x42')]=_[_0x21c1('0x45')](_0x1ab372[_0x21c1('0x42')],{'$or':[{'ListId':_0x2ebe46['id']},{'ListId':null}]});if(_0x3a6c82[_0x21c1('0x39')][_0x21c1('0x44')]){_0x1ab372[_0x21c1('0x42')]=_['merge'](_0x1ab372['where'],{'$or':_[_0x21c1('0x33')](_0x1ab372[_0x21c1('0x3e')],function(_0x5ae736){var _0x89a2c={};_0x89a2c[_0x5ae736]={'$like':'%'+_0x3a6c82[_0x21c1('0x39')]['filter']+'%'};return _0x89a2c;})});}_0x1ab372=_[_0x21c1('0x45')]({},_0x1ab372,_0x3a6c82[_0x21c1('0x46')]);return db[_0x21c1('0x6e')][_0x21c1('0x85')](_0x1ab372);}})[_0x21c1('0x2b')](respondWithResult(_0x534961,null))[_0x21c1('0x4e')](handleError(_0x534961,null));};exports[_0x21c1('0x86')]=function(_0x28dbd8,_0x14bcbc,_0x1dc021){return db[_0x21c1('0x47')][_0x21c1('0x4d')]({'where':{'id':_0x28dbd8[_0x21c1('0x4b')]['id']}})[_0x21c1('0x2b')](handleEntityNotFound(_0x14bcbc,null))[_0x21c1('0x2b')](function(_0x3889b9){if(_0x3889b9){return _0x3889b9[_0x21c1('0x86')](_0x28dbd8[_0x21c1('0x50')][_0x21c1('0x63')],_[_0x21c1('0x87')](_0x28dbd8['body'],[_0x21c1('0x63'),'id'])||{})[_0x21c1('0x88')](function(_0x13f806){for(var _0x5c61d8=0x0;_0x5c61d8<_0x28dbd8[_0x21c1('0x50')]['ids'][_0x21c1('0x3d')];_0x5c61d8+=0x1){socket[_0x21c1('0x89')](_0x21c1('0x8a'),{'UserId':Number(_0x28dbd8[_0x21c1('0x50')]['ids'][_0x5c61d8]),'CmListId':Number(_0x28dbd8[_0x21c1('0x4b')]['id'])});}return _0x13f806;});}})[_0x21c1('0x2b')](respondWithResult(_0x14bcbc,null))['catch'](handleError(_0x14bcbc,null));};exports['removeAgents']=function(_0x5591d0,_0x3019bd,_0x876ab3){return db[_0x21c1('0x47')][_0x21c1('0x4d')]({'where':{'id':_0x5591d0[_0x21c1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3019bd,null))[_0x21c1('0x2b')](function(_0x11ab5c){if(_0x11ab5c){return _0x11ab5c[_0x21c1('0x8b')](_0x5591d0[_0x21c1('0x39')][_0x21c1('0x63')])[_0x21c1('0x2b')](function(){if(_[_0x21c1('0x60')](_0x5591d0[_0x21c1('0x39')][_0x21c1('0x63')])){for(var _0x1e686e=0x0;_0x1e686e<_0x5591d0[_0x21c1('0x39')][_0x21c1('0x63')][_0x21c1('0x3d')];_0x1e686e+=0x1){socket[_0x21c1('0x89')](_0x21c1('0x8c'),{'UserId':Number(_0x5591d0['query'][_0x21c1('0x63')][_0x1e686e]),'CmListId':Number(_0x5591d0[_0x21c1('0x4b')]['id'])});}}else{socket[_0x21c1('0x89')](_0x21c1('0x8c'),{'UserId':Number(_0x5591d0[_0x21c1('0x39')][_0x21c1('0x63')]),'CmListId':Number(_0x5591d0[_0x21c1('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x3019bd,null))['catch'](handleError(_0x3019bd,null));};exports[_0x21c1('0x8d')]=function(_0x449494,_0x4fa613,_0x10e432){var _0x3a08e5={};var _0x51f8cb={};var _0x19c642;var _0xb4a5b0;return db[_0x21c1('0x47')][_0x21c1('0x5a')]({'where':{'id':_0x449494['params']['id']}})[_0x21c1('0x2b')](handleEntityNotFound(_0x4fa613,null))['then'](function(_0x2a03a4){if(_0x2a03a4){_0x19c642=_0x2a03a4;_0x51f8cb['model']=_[_0x21c1('0x4c')](db[_0x21c1('0x8e')][_0x21c1('0x34')]);_0x51f8cb[_0x21c1('0x39')]=_[_0x21c1('0x4c')](_0x449494[_0x21c1('0x39')]);_0x51f8cb[_0x21c1('0x3a')]=_['intersection'](_0x51f8cb[_0x21c1('0x38')],_0x51f8cb[_0x21c1('0x39')]);_0x3a08e5[_0x21c1('0x3e')]=_['intersection'](_0x51f8cb[_0x21c1('0x38')],qs[_0x21c1('0x3c')](_0x449494[_0x21c1('0x39')]['fields']));_0x3a08e5[_0x21c1('0x3e')]=_0x3a08e5['attributes'][_0x21c1('0x3d')]?_0x3a08e5[_0x21c1('0x3e')]:_0x51f8cb[_0x21c1('0x38')];_0x3a08e5[_0x21c1('0x40')]=qs[_0x21c1('0x41')](_0x449494['query'][_0x21c1('0x41')]);_0x3a08e5['where']=qs[_0x21c1('0x3a')](_['pick'](_0x449494['query'],_0x51f8cb[_0x21c1('0x3a')]));if(_0x449494[_0x21c1('0x39')][_0x21c1('0x44')]){_0x3a08e5[_0x21c1('0x42')]=_['merge'](_0x3a08e5['where'],{'$or':_['map'](_0x3a08e5[_0x21c1('0x3e')],function(_0xe5da79){var _0x433aa8={};_0x433aa8[_0xe5da79]={'$like':'%'+_0x449494['query'][_0x21c1('0x44')]+'%'};return _0x433aa8;})});}_0x3a08e5=_[_0x21c1('0x45')]({},_0x3a08e5,_0x449494[_0x21c1('0x46')]);return _0x19c642[_0x21c1('0x8d')](_0x3a08e5);}})[_0x21c1('0x2b')](function(_0x3a1e03){if(_0x3a1e03){_0xb4a5b0=_0x3a1e03[_0x21c1('0x3d')];if(!_0x449494['query']['hasOwnProperty'](_0x21c1('0x5b'))){_0x3a08e5[_0x21c1('0x20')]=qs[_0x21c1('0x20')](_0x449494[_0x21c1('0x39')][_0x21c1('0x20')]);_0x3a08e5['offset']=qs['offset'](_0x449494['query']['offset']);}return _0x19c642[_0x21c1('0x8d')](_0x3a08e5);}})[_0x21c1('0x2b')](function(_0x1accc7){if(_0x1accc7){return _0x1accc7?{'count':_0xb4a5b0,'rows':_0x1accc7}:null;}})[_0x21c1('0x2b')](respondWithResult(_0x4fa613,null))['catch'](handleError(_0x4fa613,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index cfe8d3a..7dc6677 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x172d9c,_0x1d4da7){_0x172d9c=_0x172d9c-0x0;var _0x5ba879=_0x3e74[_0x172d9c];return _0x5ba879;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file +var _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0x55ca,0x126));var _0xa55c=function(_0x4cfb78,_0x4c1da6){_0x4cfb78=_0x4cfb78-0x0;var _0xc1250e=_0x55ca[_0x4cfb78];return _0xc1250e;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var CmList=require(_0xa55c('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){CmListEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);CmListEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];CmList[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 3866593..e0d4e72 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 _0x6c76=['define','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','exports'];(function(_0x24d455,_0x7f4ae1){var _0x31392a=function(_0x4cbf9f){while(--_0x4cbf9f){_0x24d455['push'](_0x24d455['shift']());}};_0x31392a(++_0x7f4ae1);}(_0x6c76,0x184));var _0x66c7=function(_0x592a76,_0x82b8ab){_0x592a76=_0x592a76-0x0;var _0x5b0367=_0x6c76[_0x592a76];return _0x5b0367;};'use strict';var _=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var logger=require(_0x66c7('0x2'))('api');var moment=require(_0x66c7('0x3'));var BPromise=require(_0x66c7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x66c7('0x5'));var config=require(_0x66c7('0x6'));var attributes=require('./cmList.attributes');module[_0x66c7('0x7')]=function(_0x45b0a5,_0x52f71b){return _0x45b0a5[_0x66c7('0x8')]('CmList',attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee5b=['request-promise','path','rimraf','exports','define','lodash','../../config/logger','api','bluebird'];(function(_0x43a4a7,_0x5a086a){var _0x53ea5a=function(_0x295b0f){while(--_0x295b0f){_0x43a4a7['push'](_0x43a4a7['shift']());}};_0x53ea5a(++_0x5a086a);}(_0xee5b,0x1f4));var _0xbee5=function(_0x34b78b,_0x251885){_0x34b78b=_0x34b78b-0x0;var _0x1cf384=_0xee5b[_0x34b78b];return _0x1cf384;};'use strict';var _=require(_0xbee5('0x0'));var util=require('util');var logger=require(_0xbee5('0x1'))(_0xbee5('0x2'));var moment=require('moment');var BPromise=require(_0xbee5('0x3'));var rp=require(_0xbee5('0x4'));var fs=require('fs');var path=require(_0xbee5('0x5'));var rimraf=require(_0xbee5('0x6'));var config=require('../../config/environment');var attributes=require('./cmList.attributes');module[_0xbee5('0x7')]=function(_0x2c0bde,_0xab6e4d){return _0x2c0bde[_0xbee5('0x8')]('CmList',attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 24310fc..2208cd0 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 _0x7a06=['CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x422d4b,_0x1ce750){var _0x483cf7=function(_0x21c188){while(--_0x21c188){_0x422d4b['push'](_0x422d4b['shift']());}};_0x483cf7(++_0x1ce750);}(_0x7a06,0x6a));var _0x67a0=function(_0x25c49d,_0xcc82ce){_0x25c49d=_0x25c49d-0x0;var _0x448469=_0x7a06[_0x25c49d];return _0x448469;};'use strict';var _=require(_0x67a0('0x0'));var util=require(_0x67a0('0x1'));var moment=require(_0x67a0('0x2'));var BPromise=require('bluebird');var rs=require(_0x67a0('0x3'));var fs=require('fs');var Redis=require(_0x67a0('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x67a0('0x5'));var jayson=require(_0x67a0('0x6'));var client=jayson[_0x67a0('0x7')]['http']({'port':0x232a});config[_0x67a0('0x8')]=_[_0x67a0('0x9')](config[_0x67a0('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x67a0('0xa'))(new Redis(config[_0x67a0('0x8')]));require(_0x67a0('0xb'))[_0x67a0('0xc')](socket);function respondWithRpcPromise(_0xe68602,_0x335db1,_0x56f103){return new BPromise(function(_0x13f36a,_0x4da01b){return client[_0x67a0('0xd')](_0xe68602,_0x56f103)[_0x67a0('0xe')](function(_0x14e4ac){logger[_0x67a0('0xf')](_0x67a0('0x10'),_0x335db1,_0x67a0('0x11'));logger[_0x67a0('0x12')](_0x67a0('0x13'),_0x335db1,_0x67a0('0x11'),JSON[_0x67a0('0x14')](_0x14e4ac));if(_0x14e4ac[_0x67a0('0x15')]){if(_0x14e4ac[_0x67a0('0x15')]['code']===0x1f4){logger[_0x67a0('0x15')](_0x67a0('0x10'),_0x335db1,_0x14e4ac[_0x67a0('0x15')][_0x67a0('0x16')]);return _0x4da01b(_0x14e4ac[_0x67a0('0x15')][_0x67a0('0x16')]);}logger['error'](_0x67a0('0x10'),_0x335db1,_0x14e4ac[_0x67a0('0x15')]['message']);return _0x13f36a(_0x14e4ac[_0x67a0('0x15')][_0x67a0('0x16')]);}else{logger['info']('CmList,\x20%s,\x20%s',_0x335db1,_0x67a0('0x11'));_0x13f36a(_0x14e4ac[_0x67a0('0x17')]['message']);}})[_0x67a0('0x18')](function(_0x2d44b7){logger['error'](_0x67a0('0x10'),_0x335db1,_0x2d44b7);_0x4da01b(_0x2d44b7);});});} \ No newline at end of file +var _0xa1e4=['./cmList.socket','register','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter'];(function(_0x3fd32f,_0x588235){var _0xa55282=function(_0x32df40){while(--_0x32df40){_0x3fd32f['push'](_0x3fd32f['shift']());}};_0xa55282(++_0x588235);}(_0xa1e4,0xd5));var _0x4a1e=function(_0x2cc21c,_0x4ceefa){_0x2cc21c=_0x2cc21c-0x0;var _0x59e4ea=_0xa1e4[_0x2cc21c];return _0x59e4ea;};'use strict';var _=require('lodash');var util=require(_0x4a1e('0x0'));var moment=require('moment');var BPromise=require(_0x4a1e('0x1'));var rs=require(_0x4a1e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4a1e('0x3'))['db'];var utils=require(_0x4a1e('0x4'));var logger=require('../../config/logger')(_0x4a1e('0x5'));var config=require(_0x4a1e('0x6'));var jayson=require(_0x4a1e('0x7'));var client=jayson[_0x4a1e('0x8')]['http']({'port':0x232a});config[_0x4a1e('0x9')]=_[_0x4a1e('0xa')](config[_0x4a1e('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4a1e('0xb'))(new Redis(config['redis']));require(_0x4a1e('0xc'))[_0x4a1e('0xd')](socket);function respondWithRpcPromise(_0x1d018c,_0xbfbea7,_0x59bddc){return new BPromise(function(_0x62fb20,_0x36f853){return client['request'](_0x1d018c,_0x59bddc)[_0x4a1e('0xe')](function(_0xa4a7c1){logger[_0x4a1e('0xf')](_0x4a1e('0x10'),_0xbfbea7,_0x4a1e('0x11'));logger[_0x4a1e('0x12')]('CmList,\x20%s,\x20%s,\x20%s',_0xbfbea7,_0x4a1e('0x11'),JSON[_0x4a1e('0x13')](_0xa4a7c1));if(_0xa4a7c1[_0x4a1e('0x14')]){if(_0xa4a7c1[_0x4a1e('0x14')][_0x4a1e('0x15')]===0x1f4){logger['error'](_0x4a1e('0x10'),_0xbfbea7,_0xa4a7c1[_0x4a1e('0x14')][_0x4a1e('0x16')]);return _0x36f853(_0xa4a7c1[_0x4a1e('0x14')][_0x4a1e('0x16')]);}logger['error'](_0x4a1e('0x10'),_0xbfbea7,_0xa4a7c1['error']['message']);return _0x62fb20(_0xa4a7c1[_0x4a1e('0x14')]['message']);}else{logger[_0x4a1e('0xf')](_0x4a1e('0x10'),_0xbfbea7,'request\x20sent');_0x62fb20(_0xa4a7c1[_0x4a1e('0x17')]['message']);}})[_0x4a1e('0x18')](function(_0x850391){logger[_0x4a1e('0x14')](_0x4a1e('0x10'),_0xbfbea7,_0x850391);_0x36f853(_0x850391);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 07e366d..e3c96f5 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 _0x08da=['remove','emit','removeListener','register','length','cmList:','save'];(function(_0xc4998a,_0x56d417){var _0x43b4bc=function(_0x3971fb){while(--_0x3971fb){_0xc4998a['push'](_0xc4998a['shift']());}};_0x43b4bc(++_0x56d417);}(_0x08da,0x180));var _0xa08d=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x08da[_0x341e0f];return _0x59555a;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0xa08d('0x0'),_0xa08d('0x1'),'update'];function createListener(_0x3b1dcc,_0x4119ca){return function(_0x34cf03){_0x4119ca[_0xa08d('0x2')](_0x3b1dcc,_0x34cf03);};}function removeListener(_0x50abf7,_0x2b272b){return function(){CmListEvents[_0xa08d('0x3')](_0x50abf7,_0x2b272b);};}exports[_0xa08d('0x4')]=function(_0x277770){for(var _0x17635c=0x0,_0x272991=events[_0xa08d('0x5')];_0x17635c<_0x272991;_0x17635c++){var _0x1210d0=events[_0x17635c];var _0x58f858=createListener(_0xa08d('0x6')+_0x1210d0,_0x277770);CmListEvents['on'](_0x1210d0,_0x58f858);}}; \ No newline at end of file +var _0xc298=['register','length','cmList:','./cmList.events','save','remove','update','emit'];(function(_0x17b9e9,_0x3deffc){var _0x276627=function(_0x49be87){while(--_0x49be87){_0x17b9e9['push'](_0x17b9e9['shift']());}};_0x276627(++_0x3deffc);}(_0xc298,0x1c3));var _0x8c29=function(_0xe9ecfb,_0x157622){_0xe9ecfb=_0xe9ecfb-0x0;var _0x328048=_0xc298[_0xe9ecfb];return _0x328048;};'use strict';var CmListEvents=require(_0x8c29('0x0'));var events=[_0x8c29('0x1'),_0x8c29('0x2'),_0x8c29('0x3')];function createListener(_0x203c1e,_0x13c216){return function(_0x3c5592){_0x13c216[_0x8c29('0x4')](_0x203c1e,_0x3c5592);};}function removeListener(_0x2be0bd,_0x4c60f7){return function(){CmListEvents['removeListener'](_0x2be0bd,_0x4c60f7);};}exports[_0x8c29('0x5')]=function(_0xb23a42){for(var _0x3f9d59=0x0,_0x1e9ceb=events[_0x8c29('0x6')];_0x3f9d59<_0x1e9ceb;_0x3f9d59++){var _0x17602c=events[_0x3f9d59];var _0x77ae58=createListener(_0x8c29('0x7')+_0x17602c,_0xb23a42);CmListEvents['on'](_0x17602c,_0x77ae58);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index f1c65ed..f1da7f9 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 _0xc367=['/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','getAgents','post','create','addDisposition','addContacts','addCustomField','/:id/users','addAgents','update','delete','removeAgents','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions'];(function(_0x3f7f09,_0x4542b3){var _0x29ac03=function(_0x3f38ba){while(--_0x3f38ba){_0x3f7f09['push'](_0x3f7f09['shift']());}};_0x29ac03(++_0x4542b3);}(_0xc367,0x67));var _0x7c36=function(_0x5903d7,_0x4f4955){_0x5903d7=_0x5903d7-0x0;var _0x49a11a=_0xc367[_0x5903d7];return _0x49a11a;};'use strict';var multer=require(_0x7c36('0x0'));var util=require(_0x7c36('0x1'));var path=require('path');var timeout=require(_0x7c36('0x2'));var express=require(_0x7c36('0x3'));var router=express[_0x7c36('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7c36('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7c36('0x6'));var controller=require('./cmList.controller');router[_0x7c36('0x7')]('/',auth[_0x7c36('0x8')](),controller['index']);router[_0x7c36('0x7')]('/describe',auth[_0x7c36('0x8')](),controller[_0x7c36('0x9')]);router[_0x7c36('0x7')](_0x7c36('0xa'),auth[_0x7c36('0x8')](),controller['show']);router['get'](_0x7c36('0xb'),auth['isAuthenticated'](),controller[_0x7c36('0xc')]);router['get'](_0x7c36('0xd'),auth[_0x7c36('0x8')](),controller['getContacts']);router[_0x7c36('0x7')](_0x7c36('0xe'),auth[_0x7c36('0x8')](),controller[_0x7c36('0xf')]);router[_0x7c36('0x7')](_0x7c36('0x10'),auth[_0x7c36('0x8')](),controller[_0x7c36('0x11')]);router['get']('/:id/users',auth[_0x7c36('0x8')](),controller[_0x7c36('0x12')]);router[_0x7c36('0x13')]('/',auth['isAuthenticated'](),controller[_0x7c36('0x14')]);router['post'](_0x7c36('0xb'),auth[_0x7c36('0x8')](),controller[_0x7c36('0x15')]);router[_0x7c36('0x13')](_0x7c36('0xd'),auth[_0x7c36('0x8')](),controller[_0x7c36('0x16')]);router[_0x7c36('0x13')](_0x7c36('0x10'),auth[_0x7c36('0x8')](),controller[_0x7c36('0x17')]);router[_0x7c36('0x13')](_0x7c36('0x18'),auth[_0x7c36('0x8')](),controller[_0x7c36('0x19')]);router['put'](_0x7c36('0xa'),auth[_0x7c36('0x8')](),controller[_0x7c36('0x1a')]);router[_0x7c36('0x1b')]('/:id',auth[_0x7c36('0x8')](),controller['destroy']);router[_0x7c36('0x1b')](_0x7c36('0xb'),auth[_0x7c36('0x8')](),controller['removeDispositions']);router[_0x7c36('0x1b')](_0x7c36('0x18'),auth[_0x7c36('0x8')](),controller[_0x7c36('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x1169=['update','delete','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','/:id/users','getAgents','post','addDisposition','addCustomField','addAgents'];(function(_0x4c99e4,_0x266348){var _0x4bdd67=function(_0x1a6f36){while(--_0x1a6f36){_0x4c99e4['push'](_0x4c99e4['shift']());}};_0x4bdd67(++_0x266348);}(_0x1169,0x138));var _0x9116=function(_0x1dc4a2,_0x2508ca){_0x1dc4a2=_0x1dc4a2-0x0;var _0xf8c245=_0x1169[_0x1dc4a2];return _0xf8c245;};'use strict';var multer=require('multer');var util=require(_0x9116('0x0'));var path=require('path');var timeout=require(_0x9116('0x1'));var express=require('express');var router=express[_0x9116('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x9116('0x3'));var interaction=require(_0x9116('0x4'));var config=require(_0x9116('0x5'));var controller=require('./cmList.controller');router[_0x9116('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9116('0x6')](_0x9116('0x7'),auth[_0x9116('0x8')](),controller[_0x9116('0x9')]);router[_0x9116('0x6')](_0x9116('0xa'),auth[_0x9116('0x8')](),controller[_0x9116('0xb')]);router[_0x9116('0x6')](_0x9116('0xc'),auth[_0x9116('0x8')](),controller['getDispositions']);router[_0x9116('0x6')](_0x9116('0xd'),auth[_0x9116('0x8')](),controller[_0x9116('0xe')]);router['get'](_0x9116('0xf'),auth[_0x9116('0x8')](),controller[_0x9116('0x10')]);router[_0x9116('0x6')](_0x9116('0x11'),auth['isAuthenticated'](),controller['getCustomFields']);router['get'](_0x9116('0x12'),auth[_0x9116('0x8')](),controller[_0x9116('0x13')]);router[_0x9116('0x14')]('/',auth[_0x9116('0x8')](),controller['create']);router[_0x9116('0x14')](_0x9116('0xc'),auth[_0x9116('0x8')](),controller[_0x9116('0x15')]);router[_0x9116('0x14')](_0x9116('0xd'),auth[_0x9116('0x8')](),controller['addContacts']);router[_0x9116('0x14')](_0x9116('0x11'),auth[_0x9116('0x8')](),controller[_0x9116('0x16')]);router[_0x9116('0x14')](_0x9116('0x12'),auth[_0x9116('0x8')](),controller[_0x9116('0x17')]);router['put'](_0x9116('0xa'),auth[_0x9116('0x8')](),controller[_0x9116('0x18')]);router[_0x9116('0x19')](_0x9116('0xa'),auth[_0x9116('0x8')](),controller[_0x9116('0x1a')]);router['delete'](_0x9116('0xc'),auth[_0x9116('0x8')](),controller['removeDispositions']);router[_0x9116('0x19')](_0x9116('0x12'),auth[_0x9116('0x8')](),controller['removeAgents']);module[_0x9116('0x1b')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index a7faef1..1cacde1 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 _0x8bd1=['getDataValue','field','STRING'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0x8bd1,0x1c8));var _0x18bd=function(_0x56213b,_0x307ddf){_0x56213b=_0x56213b-0x0;var _0x15948c=_0x8bd1[_0x56213b];return _0x15948c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3227be){return this[_0x18bd('0x0')](_0x18bd('0x1'));}},'field':{'type':Sequelize[_0x18bd('0x2')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x18bd('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x42d6=['getDataValue','field','STRING','exports','VIRTUAL'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x42d6,0x9e));var _0x642d=function(_0x5da01a,_0xaa577a){_0x5da01a=_0x5da01a-0x0;var _0x257f09=_0x42d6[_0x5da01a];return _0x257f09;};'use strict';var Sequelize=require('sequelize');module[_0x642d('0x0')]={'name':{'type':Sequelize[_0x642d('0x1')],'get':function(_0x27914d){return this[_0x642d('0x2')](_0x642d('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x642d('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x642d('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index b899d31..b58e29d 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x28d8b8,_0x29fd1d){var _0xa0806e=function(_0x552a39){while(--_0x552a39){_0x28d8b8['push'](_0x28d8b8['shift']());}};_0xa0806e(++_0x29fd1d);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _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(_0x32a98e,_0x41c98c){var _0x34d5a4=function(_0x33a464){while(--_0x33a464){_0x32a98e['push'](_0x32a98e['shift']());}};_0x34d5a4(++_0x41c98c);}(_0x7a54,0x106));var _0x47a5=function(_0x23e7ab,_0xdfc25e){_0x23e7ab=_0x23e7ab-0x0;var _0x526404=_0x7a54[_0x23e7ab];return _0x526404;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 345040e..431354c 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 _0xda8a=['./condition.attributes','exports','Condition','tools_conditions','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x21aa18,_0x17316d){var _0x97b86e=function(_0x2e0fee){while(--_0x2e0fee){_0x21aa18['push'](_0x21aa18['shift']());}};_0x97b86e(++_0x17316d);}(_0xda8a,0x1be));var _0xada8=function(_0x499716,_0x2d8909){_0x499716=_0x499716-0x0;var _0x2ab4da=_0xda8a[_0x499716];return _0x2ab4da;};'use strict';var _=require(_0xada8('0x0'));var util=require(_0xada8('0x1'));var logger=require(_0xada8('0x2'))(_0xada8('0x3'));var moment=require('moment');var BPromise=require(_0xada8('0x4'));var rp=require(_0xada8('0x5'));var fs=require('fs');var path=require(_0xada8('0x6'));var rimraf=require(_0xada8('0x7'));var config=require(_0xada8('0x8'));var attributes=require(_0xada8('0x9'));module[_0xada8('0xa')]=function(_0x4d515b,_0x3e87c6){return _0x4d515b['define'](_0xada8('0xb'),attributes,{'tableName':_0xada8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e34=['../../config/environment','exports','define','lodash','../../config/logger','api','moment','path','rimraf'];(function(_0xda0bbd,_0x331bd4){var _0x28d4a5=function(_0x326536){while(--_0x326536){_0xda0bbd['push'](_0xda0bbd['shift']());}};_0x28d4a5(++_0x331bd4);}(_0x8e34,0x93));var _0x48e3=function(_0x956ad9,_0x30a59f){_0x956ad9=_0x956ad9-0x0;var _0x566d21=_0x8e34[_0x956ad9];return _0x566d21;};'use strict';var _=require(_0x48e3('0x0'));var util=require('util');var logger=require(_0x48e3('0x1'))(_0x48e3('0x2'));var moment=require(_0x48e3('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x48e3('0x4'));var rimraf=require(_0x48e3('0x5'));var config=require(_0x48e3('0x6'));var attributes=require('./condition.attributes');module[_0x48e3('0x7')]=function(_0xc85574,_0x3bb2c5){return _0xc85574[_0x48e3('0x8')]('Condition',attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 03b1627..5801b3e 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 _0x8a63=['info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x1e03a6,_0xf0349){var _0x295b64=function(_0x1ad0a5){while(--_0x1ad0a5){_0x1e03a6['push'](_0x1e03a6['shift']());}};_0x295b64(++_0xf0349);}(_0x8a63,0x136));var _0x38a6=function(_0x2c574e,_0x491053){_0x2c574e=_0x2c574e-0x0;var _0x1101f7=_0x8a63[_0x2c574e];return _0x1101f7;};'use strict';var _=require('lodash');var util=require(_0x38a6('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x38a6('0x1'));var fs=require('fs');var Redis=require(_0x38a6('0x2'));var db=require(_0x38a6('0x3'))['db'];var utils=require(_0x38a6('0x4'));var logger=require(_0x38a6('0x5'))(_0x38a6('0x6'));var config=require(_0x38a6('0x7'));var jayson=require(_0x38a6('0x8'));var client=jayson[_0x38a6('0x9')][_0x38a6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1de8b6,_0xba02d6,_0x11329e){return new BPromise(function(_0x11b087,_0x29125c){return client['request'](_0x1de8b6,_0x11329e)[_0x38a6('0xb')](function(_0x452916){logger[_0x38a6('0xc')](_0x38a6('0xd'),_0xba02d6,_0x38a6('0xe'));logger[_0x38a6('0xf')](_0x38a6('0x10'),_0xba02d6,_0x38a6('0xe'),JSON[_0x38a6('0x11')](_0x452916));if(_0x452916[_0x38a6('0x12')]){if(_0x452916[_0x38a6('0x12')][_0x38a6('0x13')]===0x1f4){logger[_0x38a6('0x12')](_0x38a6('0xd'),_0xba02d6,_0x452916[_0x38a6('0x12')][_0x38a6('0x14')]);return _0x29125c(_0x452916[_0x38a6('0x12')][_0x38a6('0x14')]);}logger[_0x38a6('0x12')]('Condition,\x20%s,\x20%s',_0xba02d6,_0x452916[_0x38a6('0x12')][_0x38a6('0x14')]);return _0x11b087(_0x452916[_0x38a6('0x12')][_0x38a6('0x14')]);}else{logger['info'](_0x38a6('0xd'),_0xba02d6,_0x38a6('0xe'));_0x11b087(_0x452916[_0x38a6('0x15')][_0x38a6('0x14')]);}})[_0x38a6('0x16')](function(_0x34ae99){logger[_0x38a6('0x12')](_0x38a6('0xd'),_0xba02d6,_0x34ae99);_0x29125c(_0x34ae99);});});} \ No newline at end of file +var _0xabbb=['message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4c5c97,_0x53a94f){var _0x581034=function(_0x16f7ea){while(--_0x16f7ea){_0x4c5c97['push'](_0x4c5c97['shift']());}};_0x581034(++_0x53a94f);}(_0xabbb,0x173));var _0xbabb=function(_0x1dc01a,_0x2104f7){_0x1dc01a=_0x1dc01a-0x0;var _0x151480=_0xabbb[_0x1dc01a];return _0x151480;};'use strict';var _=require('lodash');var util=require(_0xbabb('0x0'));var moment=require(_0xbabb('0x1'));var BPromise=require(_0xbabb('0x2'));var rs=require(_0xbabb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbabb('0x4'))['db'];var utils=require(_0xbabb('0x5'));var logger=require(_0xbabb('0x6'))(_0xbabb('0x7'));var config=require('../../config/environment');var jayson=require(_0xbabb('0x8'));var client=jayson[_0xbabb('0x9')][_0xbabb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59f015,_0x3d7b7d,_0x176090){return new BPromise(function(_0x1abcd1,_0x348dcd){return client[_0xbabb('0xb')](_0x59f015,_0x176090)['then'](function(_0x4b4fee){logger[_0xbabb('0xc')](_0xbabb('0xd'),_0x3d7b7d,_0xbabb('0xe'));logger[_0xbabb('0xf')](_0xbabb('0x10'),_0x3d7b7d,_0xbabb('0xe'),JSON[_0xbabb('0x11')](_0x4b4fee));if(_0x4b4fee[_0xbabb('0x12')]){if(_0x4b4fee[_0xbabb('0x12')][_0xbabb('0x13')]===0x1f4){logger['error'](_0xbabb('0xd'),_0x3d7b7d,_0x4b4fee[_0xbabb('0x12')][_0xbabb('0x14')]);return _0x348dcd(_0x4b4fee[_0xbabb('0x12')]['message']);}logger[_0xbabb('0x12')](_0xbabb('0xd'),_0x3d7b7d,_0x4b4fee[_0xbabb('0x12')][_0xbabb('0x14')]);return _0x1abcd1(_0x4b4fee['error'][_0xbabb('0x14')]);}else{logger[_0xbabb('0xc')](_0xbabb('0xd'),_0x3d7b7d,_0xbabb('0xe'));_0x1abcd1(_0x4b4fee[_0xbabb('0x15')][_0xbabb('0x14')]);}})[_0xbabb('0x16')](function(_0x417ec0){logger[_0xbabb('0x12')](_0xbabb('0xd'),_0x3d7b7d,_0x417ec0);_0x348dcd(_0x417ec0);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index e9137d0..905f5f7 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 _0x7140=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./condition.controller','/:id','isAuthenticated','delete','destroy','exports'];(function(_0xd25c9e,_0x1a7379){var _0x20edec=function(_0x2fdedc){while(--_0x2fdedc){_0xd25c9e['push'](_0xd25c9e['shift']());}};_0x20edec(++_0x1a7379);}(_0x7140,0x1e1));var _0x0714=function(_0x513545,_0x158f2e){_0x513545=_0x513545-0x0;var _0x18b7c5=_0x7140[_0x513545];return _0x18b7c5;};'use strict';var multer=require(_0x0714('0x0'));var util=require(_0x0714('0x1'));var path=require(_0x0714('0x2'));var timeout=require('connect-timeout');var express=require(_0x0714('0x3'));var router=express[_0x0714('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0714('0x5'));var interaction=require(_0x0714('0x6'));var config=require('../../config/environment');var controller=require(_0x0714('0x7'));router['put'](_0x0714('0x8'),auth[_0x0714('0x9')](),controller['update']);router[_0x0714('0xa')](_0x0714('0x8'),auth['isAuthenticated'](),controller[_0x0714('0xb')]);module[_0x0714('0xc')]=router; \ No newline at end of file +var _0xf24f=['put','/:id','isAuthenticated','update','destroy','exports','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2376d1,_0x38eec4){var _0x443759=function(_0x73c733){while(--_0x73c733){_0x2376d1['push'](_0x2376d1['shift']());}};_0x443759(++_0x38eec4);}(_0xf24f,0xa2));var _0xff24=function(_0x51fe5f,_0x1d8632){_0x51fe5f=_0x51fe5f-0x0;var _0x4abce9=_0xf24f[_0x51fe5f];return _0x4abce9;};'use strict';var multer=require(_0xff24('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xff24('0x1')]();var fs_extra=require(_0xff24('0x2'));var auth=require(_0xff24('0x3'));var interaction=require(_0xff24('0x4'));var config=require(_0xff24('0x5'));var controller=require('./condition.controller');router[_0xff24('0x6')](_0xff24('0x7'),auth[_0xff24('0x8')](),controller[_0xff24('0x9')]);router['delete'](_0xff24('0x7'),auth['isAuthenticated'](),controller[_0xff24('0xa')]);module[_0xff24('0xb')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index ae33f09..de3f1e3 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 _0x757a=['exports','STRING'];(function(_0x1b54e1,_0xa731c2){var _0x16b3e7=function(_0x247ed4){while(--_0x247ed4){_0x1b54e1['push'](_0x1b54e1['shift']());}};_0x16b3e7(++_0xa731c2);}(_0x757a,0xde));var _0xa757=function(_0x3aab54,_0x4c0372){_0x3aab54=_0x3aab54-0x0;var _0x2e7f70=_0x757a[_0x3aab54];return _0x2e7f70;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x3a33ff,_0x431390){var _0x214ba7=function(_0xfc57fc){while(--_0xfc57fc){_0x3a33ff['push'](_0x3a33ff['shift']());}};_0x214ba7(++_0x431390);}(_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 fa481a4..62408e9 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 _0x80e0=['widgetAttributes:\x20%s','stringify','DashboardItem','getItems','findOne','sort','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','CustomDashboards','error','stack','name','send','Dashboard','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','rawAttributes','length','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','clone','omit','updatedAt','createdAt','user','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','attrPath','value','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','attrReport','attrRefresh'];(function(_0x5d67e7,_0x28f784){var _0x19b0ed=function(_0x1cd374){while(--_0x1cd374){_0x5d67e7['push'](_0x5d67e7['shift']());}};_0x19b0ed(++_0x28f784);}(_0x80e0,0x79));var _0x080e=function(_0x3bb168,_0x5d02f8){_0x3bb168=_0x3bb168-0x0;var _0x11d4c9=_0x80e0[_0x3bb168];return _0x11d4c9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x080e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x080e('0x1'));var rp=require(_0x080e('0x2'));var moment=require('moment');var BPromise=require(_0x080e('0x3'));var Mustache=require(_0x080e('0x4'));var util=require(_0x080e('0x5'));var path=require(_0x080e('0x6'));var sox=require(_0x080e('0x7'));var csv=require(_0x080e('0x8'));var ejs=require(_0x080e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x080e('0xa'));var squel=require(_0x080e('0xb'));var crypto=require(_0x080e('0xc'));var jsforce=require(_0x080e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x080e('0x8'));var querystring=require(_0x080e('0xe'));var Papa=require('papaparse');var Redis=require(_0x080e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x080e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x080e('0x11'));var utils=require(_0x080e('0x12'));var config=require(_0x080e('0x13'));var licenseUtil=require(_0x080e('0x14'));var db=require(_0x080e('0x15'))['db'];config[_0x080e('0x16')]=_[_0x080e('0x17')](config[_0x080e('0x16')],{'host':_0x080e('0x18'),'port':0x18eb});var socket=require(_0x080e('0x19'))(new Redis(config[_0x080e('0x16')]));require(_0x080e('0x1a'))[_0x080e('0x1b')](socket);function respondWithStatusCode(_0x2f3bca,_0x3a3c47){_0x3a3c47=_0x3a3c47||0xcc;return function(_0x164cc2){if(_0x164cc2){return _0x2f3bca[_0x080e('0x1c')](_0x3a3c47);}return _0x2f3bca[_0x080e('0x1d')](_0x3a3c47)[_0x080e('0x1e')]();};}function respondWithResult(_0x30ca37,_0x411f39){_0x411f39=_0x411f39||0xc8;return function(_0xacdcb6){if(_0xacdcb6){return _0x30ca37[_0x080e('0x1d')](_0x411f39)['json'](_0xacdcb6);}};}function respondWithFilteredResult(_0xe1b38c,_0x3cfeb7){return function(_0xcd4669){if(_0xcd4669){var _0x31511b=typeof _0x3cfeb7[_0x080e('0x1f')]===_0x080e('0x20')&&typeof _0x3cfeb7['limit']===_0x080e('0x20');var _0x5dc2b7=_0xcd4669[_0x080e('0x21')];var _0x4b70de=_0x31511b?0x0:_0x3cfeb7['offset'];var _0xf2b786=_0x31511b?_0xcd4669[_0x080e('0x21')]:_0x3cfeb7[_0x080e('0x1f')]+_0x3cfeb7[_0x080e('0x22')];var _0x3a46c4;if(_0xf2b786>=_0x5dc2b7){_0xf2b786=_0x5dc2b7;_0x3a46c4=0xc8;}else{_0x3a46c4=0xce;}_0xe1b38c['status'](_0x3a46c4);return _0xe1b38c[_0x080e('0x23')](_0x080e('0x24'),_0x4b70de+'-'+_0xf2b786+'/'+_0x5dc2b7)['json'](_0xcd4669);}return null;};}function patchUpdates(_0x30f709){return function(_0x19dcfd){try{jsonpatch['apply'](_0x19dcfd,_0x30f709,!![]);}catch(_0x40b9dc){return BPromise[_0x080e('0x25')](_0x40b9dc);}return _0x19dcfd[_0x080e('0x26')]();};}function saveUpdates(_0x38e772,_0x233dde){return function(_0x51f583){if(_0x51f583){return _0x51f583[_0x080e('0x27')](_0x38e772)[_0x080e('0x28')](function(_0x59c32b){return _0x59c32b;});}return null;};}function removeEntity(_0x41770,_0x4e21d2){return function(_0x1ed5ac){if(_0x1ed5ac){return _0x1ed5ac[_0x080e('0x29')]()[_0x080e('0x28')](function(){var _0x1d355a=_0x1ed5ac['get']({'plain':!![]});var _0x50336f=_0x080e('0x2a');return db['UserProfileResource'][_0x080e('0x29')]({'where':{'type':_0x50336f,'resourceId':_0x1d355a['id']}})[_0x080e('0x28')](function(){return _0x1ed5ac;});})[_0x080e('0x28')](function(){_0x41770['status'](0xcc)[_0x080e('0x1e')]();});}};}function handleEntityNotFound(_0x1ebc2d,_0x33ec04){return function(_0x39c825){if(!_0x39c825){_0x1ebc2d[_0x080e('0x1c')](0x194);}return _0x39c825;};}function handleError(_0x4851b9,_0x62630b){_0x62630b=_0x62630b||0x1f4;return function(_0x28b2d6){logger[_0x080e('0x2b')](_0x28b2d6[_0x080e('0x2c')]);if(_0x28b2d6[_0x080e('0x2d')]){delete _0x28b2d6[_0x080e('0x2d')];}_0x4851b9['status'](_0x62630b)[_0x080e('0x2e')](_0x28b2d6);};}exports['index']=function(_0x5c382f,_0xaa388b){var _0x29a0b8={},_0x49ef42={},_0x3f2def={'count':0x0,'rows':[]};var _0xa40822=_['map'](db[_0x080e('0x2f')]['rawAttributes'],function(_0xeb8b37){return{'name':_0xeb8b37[_0x080e('0x30')],'type':_0xeb8b37[_0x080e('0x31')][_0x080e('0x32')]};});_0x49ef42['model']=_['map'](_0xa40822,_0x080e('0x2d'));_0x49ef42[_0x080e('0x33')]=_[_0x080e('0x34')](_0x5c382f[_0x080e('0x33')]);_0x49ef42[_0x080e('0x35')]=_['intersection'](_0x49ef42[_0x080e('0x36')],_0x49ef42['query']);_0x29a0b8[_0x080e('0x37')]=_[_0x080e('0x38')](_0x49ef42[_0x080e('0x36')],qs[_0x080e('0x39')](_0x5c382f[_0x080e('0x33')][_0x080e('0x39')]));_0x29a0b8[_0x080e('0x37')]=_0x29a0b8[_0x080e('0x37')]['length']?_0x29a0b8['attributes']:_0x49ef42['model'];if(!_0x5c382f[_0x080e('0x33')][_0x080e('0x3a')](_0x080e('0x3b'))){_0x29a0b8[_0x080e('0x22')]=qs[_0x080e('0x22')](_0x5c382f['query'][_0x080e('0x22')]);_0x29a0b8[_0x080e('0x1f')]=qs['offset'](_0x5c382f[_0x080e('0x33')]['offset']);}_0x29a0b8[_0x080e('0x3c')]=qs['sort'](_0x5c382f['query']['sort']);_0x29a0b8[_0x080e('0x3d')]=qs[_0x080e('0x35')](_[_0x080e('0x3e')](_0x5c382f[_0x080e('0x33')],_0x49ef42[_0x080e('0x35')]),_0xa40822);if(_0x5c382f[_0x080e('0x33')][_0x080e('0x3f')]){_0x29a0b8[_0x080e('0x3d')]=_[_0x080e('0x40')](_0x29a0b8[_0x080e('0x3d')],{'$or':_['map'](_0xa40822,function(_0x220b74){if(_0x220b74['type']!==_0x080e('0x41')){var _0x1ac69f={};_0x1ac69f[_0x220b74[_0x080e('0x2d')]]={'$like':'%'+_0x5c382f[_0x080e('0x33')][_0x080e('0x3f')]+'%'};return _0x1ac69f;}})});}_0x29a0b8=_[_0x080e('0x40')]({},_0x29a0b8,_0x5c382f[_0x080e('0x42')]);var _0xd4b5d9={'where':_0x29a0b8[_0x080e('0x3d')]};return db[_0x080e('0x2f')][_0x080e('0x21')](_0xd4b5d9)['then'](function(_0x2cea34){_0x3f2def[_0x080e('0x21')]=_0x2cea34;if(_0x5c382f[_0x080e('0x33')][_0x080e('0x43')]){_0x29a0b8['include']=[{'all':!![]}];}return db[_0x080e('0x2f')][_0x080e('0x44')](_0x29a0b8);})[_0x080e('0x28')](function(_0x33f15d){_0x3f2def['rows']=_0x33f15d;return _0x3f2def;})[_0x080e('0x28')](respondWithFilteredResult(_0xaa388b,_0x29a0b8))[_0x080e('0x45')](handleError(_0xaa388b,null));};exports[_0x080e('0x46')]=function(_0xdf640a,_0x46b3c8){var _0x417b81={'raw':![],'where':{'id':_0xdf640a[_0x080e('0x47')]['id']}},_0x7b3214={};_0x7b3214[_0x080e('0x36')]=_[_0x080e('0x34')](db['Dashboard'][_0x080e('0x48')]);_0x7b3214[_0x080e('0x33')]=_[_0x080e('0x34')](_0xdf640a[_0x080e('0x33')]);_0x7b3214[_0x080e('0x35')]=_['intersection'](_0x7b3214[_0x080e('0x36')],_0x7b3214[_0x080e('0x33')]);_0x417b81[_0x080e('0x37')]=_[_0x080e('0x38')](_0x7b3214[_0x080e('0x36')],qs[_0x080e('0x39')](_0xdf640a[_0x080e('0x33')][_0x080e('0x39')]));_0x417b81[_0x080e('0x37')]=_0x417b81[_0x080e('0x37')][_0x080e('0x49')]?_0x417b81[_0x080e('0x37')]:_0x7b3214[_0x080e('0x36')];if(_0xdf640a[_0x080e('0x33')][_0x080e('0x43')]){_0x417b81[_0x080e('0x4a')]=[{'all':!![]}];}_0x417b81=_['merge']({},_0x417b81,_0xdf640a[_0x080e('0x42')]);return db[_0x080e('0x2f')][_0x080e('0x4b')](_0x417b81)[_0x080e('0x28')](handleEntityNotFound(_0x46b3c8,null))[_0x080e('0x28')](respondWithResult(_0x46b3c8,null))[_0x080e('0x45')](handleError(_0x46b3c8,null));};exports[_0x080e('0x4c')]=function(_0x160832,_0x4fbcc6){return db[_0x080e('0x2f')][_0x080e('0x4c')](_0x160832[_0x080e('0x4d')],{})[_0x080e('0x28')](function(_0x417583){var _0x3253f1=_0x160832['user'][_0x080e('0x4e')]({'plain':!![]});if(!_0x3253f1)throw new Error(_0x080e('0x4f'));if(_0x3253f1[_0x080e('0x50')]==='user'){var _0x289d81=_0x417583['get']({'plain':!![]});var _0x137694=_0x080e('0x2a');return db['UserProfileSection']['find']({'where':{'name':_0x137694,'userProfileId':_0x3253f1['userProfileId']},'raw':!![]})[_0x080e('0x28')](function(_0x56d577){if(_0x56d577&&_0x56d577[_0x080e('0x51')]===0x0){return db['UserProfileResource'][_0x080e('0x4c')]({'name':_0x289d81[_0x080e('0x2d')],'resourceId':_0x289d81['id'],'type':_0x56d577['name'],'sectionId':_0x56d577['id']},{})[_0x080e('0x28')](function(){return _0x417583;});}else{return _0x417583;}})[_0x080e('0x45')](function(_0x8deb7){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x8deb7);throw _0x8deb7;});}return _0x417583;})[_0x080e('0x28')](respondWithResult(_0x4fbcc6,0xc9))['catch'](handleError(_0x4fbcc6,null));};exports[_0x080e('0x52')]=function(_0x1a6383,_0x1dbe2d){var _0x50b8fb={'where':{'id':_0x1a6383['params']['id']}},_0x5e0e61={};_0x5e0e61[_0x080e('0x36')]=_[_0x080e('0x34')](db[_0x080e('0x2f')][_0x080e('0x48')]);_0x50b8fb['attributes']=_[_0x080e('0x38')](_0x5e0e61[_0x080e('0x36')],qs[_0x080e('0x39')](_0x1a6383[_0x080e('0x33')][_0x080e('0x39')]));_0x50b8fb[_0x080e('0x37')]=_0x50b8fb[_0x080e('0x37')][_0x080e('0x49')]?_0x50b8fb['attributes']:_0x5e0e61['model'];if(_0x1a6383[_0x080e('0x33')]['includeAll']){_0x50b8fb[_0x080e('0x4a')]=[{'all':!![]}];}_0x50b8fb=_[_0x080e('0x40')]({},_0x50b8fb,_0x1a6383[_0x080e('0x42')]);return db[_0x080e('0x2f')][_0x080e('0x4b')](_0x50b8fb)[_0x080e('0x28')](handleEntityNotFound(_0x1dbe2d,null))['then'](function(_0x550c2f){if(_0x550c2f){var _0x4a55bf=_0x550c2f[_0x080e('0x4e')]({'plain':!![]});_0x4a55bf=qs[_0x080e('0x53')](_0x4a55bf,['id','createdAt',_0x080e('0x54')]);_0x1a6383[_0x080e('0x4d')]=_[_0x080e('0x53')](_0x1a6383[_0x080e('0x4d')],['id',_0x080e('0x55'),_0x080e('0x54')]);return db[_0x080e('0x2f')][_0x080e('0x4c')](_[_0x080e('0x40')](_0x4a55bf,_0x1a6383[_0x080e('0x4d')]),{'include':_0x1a6383[_0x080e('0x33')]['includeAll']?[{'all':!![]}]:undefined})[_0x080e('0x28')](function(_0x446cb9){var _0x47b529=_0x1a6383[_0x080e('0x56')]['get']({'plain':!![]});if(!_0x47b529)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47b529[_0x080e('0x50')]===_0x080e('0x56')){var _0x40e579=_0x446cb9[_0x080e('0x4e')]({'plain':!![]});var _0x1c3915='CustomDashboards';return db['UserProfileSection'][_0x080e('0x4b')]({'where':{'name':_0x1c3915,'userProfileId':_0x47b529[_0x080e('0x57')]},'raw':!![]})[_0x080e('0x28')](function(_0x33e442){if(_0x33e442&&_0x33e442[_0x080e('0x51')]===0x0){return db[_0x080e('0x58')][_0x080e('0x4c')]({'name':_0x40e579['name'],'resourceId':_0x40e579['id'],'type':_0x33e442[_0x080e('0x2d')],'sectionId':_0x33e442['id']},{})[_0x080e('0x28')](function(){return _0x446cb9;});}else{return _0x446cb9;}})[_0x080e('0x45')](function(_0x4c8955){logger[_0x080e('0x2b')](_0x080e('0x59'),_0x4c8955);throw _0x4c8955;});}return _0x446cb9;});}})[_0x080e('0x28')](respondWithResult(_0x1dbe2d,0xc9))[_0x080e('0x45')](handleError(_0x1dbe2d,null));};exports[_0x080e('0x27')]=function(_0x35c4fd,_0x130c6e){if(_0x35c4fd[_0x080e('0x4d')]['id']){delete _0x35c4fd[_0x080e('0x4d')]['id'];}return db[_0x080e('0x2f')][_0x080e('0x4b')]({'where':{'id':_0x35c4fd[_0x080e('0x47')]['id']}})['then'](handleEntityNotFound(_0x130c6e,null))[_0x080e('0x28')](saveUpdates(_0x35c4fd[_0x080e('0x4d')],null))[_0x080e('0x28')](respondWithResult(_0x130c6e,null))[_0x080e('0x45')](handleError(_0x130c6e,null));};exports[_0x080e('0x29')]=function(_0x3e714a,_0x36e5c2){return db[_0x080e('0x2f')][_0x080e('0x4b')]({'where':{'id':_0x3e714a[_0x080e('0x47')]['id']}})[_0x080e('0x28')](handleEntityNotFound(_0x36e5c2,null))[_0x080e('0x28')](removeEntity(_0x36e5c2,null))[_0x080e('0x45')](handleError(_0x36e5c2,null));};function widgetAttributes(_0xb9965d){try{switch(_0xb9965d[_0x080e('0x31')]){case _0x080e('0x5a'):return[{'name':_0x080e('0x5b'),'value':_0xb9965d[_0x080e('0x5b')]||(_0xb9965d['attrs']&&_0xb9965d[_0x080e('0x5c')][0x0]?_0xb9965d[_0x080e('0x5c')][0x0]['value']:undefined)||'https://'}];case'custom':return[{'name':_0x080e('0x5d'),'value':_0xb9965d[_0x080e('0x5d')]||(_0xb9965d[_0x080e('0x5c')]&&_0xb9965d[_0x080e('0x5c')][0x0]?_0xb9965d[_0x080e('0x5c')][0x0][_0x080e('0x5e')]:undefined)||''}];case _0x080e('0x5f'):return[{'name':'attrHourFormat','value':_0xb9965d[_0x080e('0x60')]||(_0xb9965d[_0x080e('0x5c')]&&_0xb9965d[_0x080e('0x5c')][0x0]?_0xb9965d[_0x080e('0x5c')][0x0][_0x080e('0x5e')]:undefined)||'HH:mm:ss'},{'name':_0x080e('0x61'),'value':_0xb9965d[_0x080e('0x61')]||(_0xb9965d[_0x080e('0x5c')]&&_0xb9965d[_0x080e('0x5c')][0x1]?_0xb9965d[_0x080e('0x5c')][0x1][_0x080e('0x5e')]:undefined)||_0x080e('0x62')},{'name':_0x080e('0x63'),'value':_0xb9965d[_0x080e('0x63')]||(_0xb9965d[_0x080e('0x5c')]&&_0xb9965d[_0x080e('0x5c')][0x2]?_0xb9965d['attrs'][0x2][_0x080e('0x5e')]:undefined)||0xc}];case _0x080e('0x64'):return[{'name':_0x080e('0x65'),'value':_0xb9965d['attrMetric']||(_0xb9965d[_0x080e('0x5c')]&&_0xb9965d[_0x080e('0x5c')][0x0]?_0xb9965d[_0x080e('0x5c')][0x0][_0x080e('0x5e')]:undefined)||_0x080e('0x66')},{'name':'attrVoiceQueues','value':_0xb9965d['attrVoiceQueues']||(_0xb9965d[_0x080e('0x5c')]&&_0xb9965d[_0x080e('0x5c')][0x1]?_0xb9965d['attrs'][0x1]['value']:undefined)||[]},{'name':_0x080e('0x63'),'value':_0xb9965d[_0x080e('0x63')]||(_0xb9965d[_0x080e('0x5c')]&&_0xb9965d[_0x080e('0x5c')][0x2]?_0xb9965d[_0x080e('0x5c')][0x2]['value']:undefined)||0x14}];case'multibar-chart':case'pie-chart':return[{'name':_0x080e('0x67'),'value':_0xb9965d[_0x080e('0x67')]||(_0xb9965d[_0x080e('0x5c')]&&_0xb9965d[_0x080e('0x5c')][0x0]?_0xb9965d[_0x080e('0x5c')][0x0][_0x080e('0x5e')]:undefined)||'total'},{'name':_0x080e('0x68'),'value':_0xb9965d['attrSerie2']||(_0xb9965d['attrs']&&_0xb9965d[_0x080e('0x5c')][0x1]?_0xb9965d['attrs'][0x1][_0x080e('0x5e')]:undefined)||null},{'name':_0x080e('0x69'),'value':_0xb9965d['attrSerie3']||(_0xb9965d[_0x080e('0x5c')]&&_0xb9965d['attrs'][0x2]?_0xb9965d[_0x080e('0x5c')][0x2][_0x080e('0x5e')]:undefined)||null},{'name':_0x080e('0x6a'),'value':_0xb9965d[_0x080e('0x6a')]||(_0xb9965d[_0x080e('0x5c')]&&_0xb9965d[_0x080e('0x5c')][0x3]?_0xb9965d['attrs'][0x3]['value']:undefined)||[]}];case'web-report':return[{'name':'attrReport','type':_0xb9965d['reportType']||(_0xb9965d[_0x080e('0x5c')]&&_0xb9965d[_0x080e('0x5c')][0x0]?_0xb9965d[_0x080e('0x5c')][0x0][_0x080e('0x31')]:undefined)||null,'value':_0xb9965d[_0x080e('0x6b')]||(_0xb9965d[_0x080e('0x5c')]&&_0xb9965d[_0x080e('0x5c')][0x0]?_0xb9965d[_0x080e('0x5c')][0x0]['value']:undefined)||null},{'name':_0x080e('0x6c'),'value':_0xb9965d['attrRefresh']||(_0xb9965d[_0x080e('0x5c')]&&_0xb9965d[_0x080e('0x5c')][0x1]?_0xb9965d[_0x080e('0x5c')][0x1][_0x080e('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0x408e12){logger[_0x080e('0x2b')](_0x080e('0x6d'),JSON[_0x080e('0x6e')](_0x408e12));return[];}}exports['addItem']=function(_0x1f8adc,_0x40e2e0,_0x2cf16e){if(_0x1f8adc[_0x080e('0x4d')]['id']){delete _0x1f8adc[_0x080e('0x4d')]['id'];}return db[_0x080e('0x2f')][_0x080e('0x4b')]({'where':{'id':_0x1f8adc[_0x080e('0x47')]['id']}})[_0x080e('0x28')](handleEntityNotFound(_0x40e2e0,null))[_0x080e('0x28')](function(_0xa77573){if(_0xa77573){_0x1f8adc[_0x080e('0x4d')]['DashboardId']=_0xa77573['id'];_0x1f8adc[_0x080e('0x4d')][_0x080e('0x5c')]=widgetAttributes(_0x1f8adc['body']);return db[_0x080e('0x6f')][_0x080e('0x4c')](_0x1f8adc[_0x080e('0x4d')]);}})[_0x080e('0x28')](respondWithResult(_0x40e2e0,null))[_0x080e('0x45')](handleError(_0x40e2e0,null));};exports[_0x080e('0x70')]=function(_0x576e32,_0x2f83e2,_0x50b23b){var _0x225efc={};var _0xb4a850={};var _0x3b174f;var _0x2688c3;return db[_0x080e('0x2f')][_0x080e('0x71')]({'where':{'id':_0x576e32['params']['id']}})[_0x080e('0x28')](handleEntityNotFound(_0x2f83e2,null))[_0x080e('0x28')](function(_0x33c02e){if(_0x33c02e){_0x3b174f=_0x33c02e;_0xb4a850[_0x080e('0x36')]=_[_0x080e('0x34')](db['DashboardItem']['rawAttributes']);_0xb4a850[_0x080e('0x33')]=_['keys'](_0x576e32[_0x080e('0x33')]);_0xb4a850['filters']=_[_0x080e('0x38')](_0xb4a850[_0x080e('0x36')],_0xb4a850[_0x080e('0x33')]);_0x225efc[_0x080e('0x37')]=_['intersection'](_0xb4a850[_0x080e('0x36')],qs[_0x080e('0x39')](_0x576e32[_0x080e('0x33')]['fields']));_0x225efc[_0x080e('0x37')]=_0x225efc[_0x080e('0x37')][_0x080e('0x49')]?_0x225efc[_0x080e('0x37')]:_0xb4a850[_0x080e('0x36')];_0x225efc[_0x080e('0x3c')]=qs['sort'](_0x576e32[_0x080e('0x33')][_0x080e('0x72')]);_0x225efc[_0x080e('0x3d')]=qs[_0x080e('0x35')](_['pick'](_0x576e32[_0x080e('0x33')],_0xb4a850[_0x080e('0x35')]));if(_0x576e32[_0x080e('0x33')]['filter']){_0x225efc[_0x080e('0x3d')]=_['merge'](_0x225efc[_0x080e('0x3d')],{'$or':_['map'](_0x225efc['attributes'],function(_0x49b45a){var _0x15a968={};_0x15a968[_0x49b45a]={'$like':'%'+_0x576e32[_0x080e('0x33')][_0x080e('0x3f')]+'%'};return _0x15a968;})});}_0x225efc=_[_0x080e('0x40')]({},_0x225efc,_0x576e32[_0x080e('0x42')]);return _0x3b174f[_0x080e('0x70')](_0x225efc);}})[_0x080e('0x28')](function(_0x293af9){if(_0x293af9){_0x2688c3=_0x293af9[_0x080e('0x49')];if(!_0x576e32[_0x080e('0x33')][_0x080e('0x3a')]('nolimit')){_0x225efc[_0x080e('0x22')]=qs[_0x080e('0x22')](_0x576e32[_0x080e('0x33')][_0x080e('0x22')]);_0x225efc[_0x080e('0x1f')]=qs[_0x080e('0x1f')](_0x576e32[_0x080e('0x33')][_0x080e('0x1f')]);}return _0x3b174f['getItems'](_0x225efc);}})[_0x080e('0x28')](function(_0x4a1c91){if(_0x4a1c91){return _0x4a1c91?{'count':_0x2688c3,'rows':_0x4a1c91}:null;}})[_0x080e('0x28')](respondWithResult(_0x2f83e2,null))[_0x080e('0x45')](handleError(_0x2f83e2,null));}; \ No newline at end of file +var _0xf625=['VIRTUAL','options','Dashboard','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','UserProfileSection','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','getItems','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','UserProfileResource','error','stack','name','send','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map'];(function(_0x130705,_0x2d266b){var _0x1fa991=function(_0x395639){while(--_0x395639){_0x130705['push'](_0x130705['shift']());}};_0x1fa991(++_0x2d266b);}(_0xf625,0x1b5));var _0x5f62=function(_0x22193e,_0x2ae001){_0x22193e=_0x22193e-0x0;var _0x10c378=_0xf625[_0x22193e];return _0x10c378;};'use strict';var emlformat=require(_0x5f62('0x0'));var rimraf=require(_0x5f62('0x1'));var zipdir=require(_0x5f62('0x2'));var jsonpatch=require(_0x5f62('0x3'));var rp=require(_0x5f62('0x4'));var moment=require(_0x5f62('0x5'));var BPromise=require(_0x5f62('0x6'));var Mustache=require(_0x5f62('0x7'));var util=require(_0x5f62('0x8'));var path=require(_0x5f62('0x9'));var sox=require(_0x5f62('0xa'));var csv=require(_0x5f62('0xb'));var ejs=require(_0x5f62('0xc'));var fs=require('fs');var fs_extra=require(_0x5f62('0xd'));var _=require(_0x5f62('0xe'));var squel=require(_0x5f62('0xf'));var crypto=require(_0x5f62('0x10'));var jsforce=require(_0x5f62('0x11'));var deskjs=require(_0x5f62('0x12'));var toCsv=require(_0x5f62('0xb'));var querystring=require(_0x5f62('0x13'));var Papa=require(_0x5f62('0x14'));var Redis=require(_0x5f62('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x5f62('0x16'));var as=require(_0x5f62('0x17'));var hardwareService=require(_0x5f62('0x18'));var logger=require(_0x5f62('0x19'))(_0x5f62('0x1a'));var utils=require(_0x5f62('0x1b'));var config=require(_0x5f62('0x1c'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x5f62('0x1d')]=_[_0x5f62('0x1e')](config['redis'],{'host':_0x5f62('0x1f'),'port':0x18eb});var socket=require(_0x5f62('0x20'))(new Redis(config[_0x5f62('0x1d')]));require(_0x5f62('0x21'))[_0x5f62('0x22')](socket);function respondWithStatusCode(_0x3fa72d,_0x565fd2){_0x565fd2=_0x565fd2||0xcc;return function(_0x208b68){if(_0x208b68){return _0x3fa72d[_0x5f62('0x23')](_0x565fd2);}return _0x3fa72d['status'](_0x565fd2)[_0x5f62('0x24')]();};}function respondWithResult(_0x1821ee,_0x1cbc85){_0x1cbc85=_0x1cbc85||0xc8;return function(_0x4ee1ef){if(_0x4ee1ef){return _0x1821ee[_0x5f62('0x25')](_0x1cbc85)[_0x5f62('0x26')](_0x4ee1ef);}};}function respondWithFilteredResult(_0x178a5,_0x3a4e17){return function(_0x46be4a){if(_0x46be4a){var _0xa68579=typeof _0x3a4e17[_0x5f62('0x27')]===_0x5f62('0x28')&&typeof _0x3a4e17[_0x5f62('0x29')]==='undefined';var _0x538a06=_0x46be4a[_0x5f62('0x2a')];var _0x6a3823=_0xa68579?0x0:_0x3a4e17['offset'];var _0x5329cb=_0xa68579?_0x46be4a[_0x5f62('0x2a')]:_0x3a4e17[_0x5f62('0x27')]+_0x3a4e17[_0x5f62('0x29')];var _0x27424b;if(_0x5329cb>=_0x538a06){_0x5329cb=_0x538a06;_0x27424b=0xc8;}else{_0x27424b=0xce;}_0x178a5[_0x5f62('0x25')](_0x27424b);return _0x178a5[_0x5f62('0x2b')]('Content-Range',_0x6a3823+'-'+_0x5329cb+'/'+_0x538a06)[_0x5f62('0x26')](_0x46be4a);}return null;};}function patchUpdates(_0x4e7eb7){return function(_0x24f1f4){try{jsonpatch[_0x5f62('0x2c')](_0x24f1f4,_0x4e7eb7,!![]);}catch(_0x3d1da9){return BPromise[_0x5f62('0x2d')](_0x3d1da9);}return _0x24f1f4[_0x5f62('0x2e')]();};}function saveUpdates(_0x1a275c,_0x352fa0){return function(_0x2d4038){if(_0x2d4038){return _0x2d4038[_0x5f62('0x2f')](_0x1a275c)['then'](function(_0x1d090c){return _0x1d090c;});}return null;};}function removeEntity(_0x5d5e5d,_0xe74198){return function(_0x5e015a){if(_0x5e015a){return _0x5e015a[_0x5f62('0x30')]()[_0x5f62('0x31')](function(){var _0x2bbef2=_0x5e015a['get']({'plain':!![]});var _0x14ec43='CustomDashboards';return db[_0x5f62('0x32')][_0x5f62('0x30')]({'where':{'type':_0x14ec43,'resourceId':_0x2bbef2['id']}})[_0x5f62('0x31')](function(){return _0x5e015a;});})['then'](function(){_0x5d5e5d['status'](0xcc)[_0x5f62('0x24')]();});}};}function handleEntityNotFound(_0x7a9468,_0x17751e){return function(_0xb8c179){if(!_0xb8c179){_0x7a9468[_0x5f62('0x23')](0x194);}return _0xb8c179;};}function handleError(_0x2e59e6,_0x15feed){_0x15feed=_0x15feed||0x1f4;return function(_0x307bdf){logger[_0x5f62('0x33')](_0x307bdf[_0x5f62('0x34')]);if(_0x307bdf[_0x5f62('0x35')]){delete _0x307bdf[_0x5f62('0x35')];}_0x2e59e6[_0x5f62('0x25')](_0x15feed)[_0x5f62('0x36')](_0x307bdf);};}exports['index']=function(_0xd2f54c,_0x488b15){var _0x49cb98={},_0x8f6015={},_0x12ab5d={'count':0x0,'rows':[]};var _0x540623=_['map'](db['Dashboard'][_0x5f62('0x37')],function(_0x4b98bc){return{'name':_0x4b98bc[_0x5f62('0x38')],'type':_0x4b98bc[_0x5f62('0x39')][_0x5f62('0x3a')]};});_0x8f6015[_0x5f62('0x3b')]=_['map'](_0x540623,_0x5f62('0x35'));_0x8f6015['query']=_[_0x5f62('0x3c')](_0xd2f54c[_0x5f62('0x3d')]);_0x8f6015[_0x5f62('0x3e')]=_[_0x5f62('0x3f')](_0x8f6015['model'],_0x8f6015[_0x5f62('0x3d')]);_0x49cb98[_0x5f62('0x40')]=_[_0x5f62('0x3f')](_0x8f6015[_0x5f62('0x3b')],qs[_0x5f62('0x41')](_0xd2f54c[_0x5f62('0x3d')]['fields']));_0x49cb98[_0x5f62('0x40')]=_0x49cb98['attributes']['length']?_0x49cb98[_0x5f62('0x40')]:_0x8f6015[_0x5f62('0x3b')];if(!_0xd2f54c[_0x5f62('0x3d')][_0x5f62('0x42')](_0x5f62('0x43'))){_0x49cb98[_0x5f62('0x29')]=qs[_0x5f62('0x29')](_0xd2f54c['query'][_0x5f62('0x29')]);_0x49cb98[_0x5f62('0x27')]=qs[_0x5f62('0x27')](_0xd2f54c[_0x5f62('0x3d')][_0x5f62('0x27')]);}_0x49cb98[_0x5f62('0x44')]=qs[_0x5f62('0x45')](_0xd2f54c[_0x5f62('0x3d')][_0x5f62('0x45')]);_0x49cb98[_0x5f62('0x46')]=qs['filters'](_[_0x5f62('0x47')](_0xd2f54c[_0x5f62('0x3d')],_0x8f6015[_0x5f62('0x3e')]),_0x540623);if(_0xd2f54c['query'][_0x5f62('0x48')]){_0x49cb98['where']=_[_0x5f62('0x49')](_0x49cb98[_0x5f62('0x46')],{'$or':_[_0x5f62('0x4a')](_0x540623,function(_0x14791e){if(_0x14791e['type']!==_0x5f62('0x4b')){var _0xf6cf63={};_0xf6cf63[_0x14791e[_0x5f62('0x35')]]={'$like':'%'+_0xd2f54c[_0x5f62('0x3d')]['filter']+'%'};return _0xf6cf63;}})});}_0x49cb98=_[_0x5f62('0x49')]({},_0x49cb98,_0xd2f54c[_0x5f62('0x4c')]);var _0x2ebbf5={'where':_0x49cb98[_0x5f62('0x46')]};return db[_0x5f62('0x4d')]['count'](_0x2ebbf5)[_0x5f62('0x31')](function(_0x24e329){_0x12ab5d[_0x5f62('0x2a')]=_0x24e329;if(_0xd2f54c[_0x5f62('0x3d')][_0x5f62('0x4e')]){_0x49cb98[_0x5f62('0x4f')]=[{'all':!![]}];}return db[_0x5f62('0x4d')][_0x5f62('0x50')](_0x49cb98);})[_0x5f62('0x31')](function(_0xae3e47){_0x12ab5d[_0x5f62('0x51')]=_0xae3e47;return _0x12ab5d;})[_0x5f62('0x31')](respondWithFilteredResult(_0x488b15,_0x49cb98))[_0x5f62('0x52')](handleError(_0x488b15,null));};exports[_0x5f62('0x53')]=function(_0xec9b48,_0x3dd249){var _0x32b507={'raw':![],'where':{'id':_0xec9b48[_0x5f62('0x54')]['id']}},_0x5e5616={};_0x5e5616[_0x5f62('0x3b')]=_['keys'](db[_0x5f62('0x4d')][_0x5f62('0x37')]);_0x5e5616[_0x5f62('0x3d')]=_[_0x5f62('0x3c')](_0xec9b48[_0x5f62('0x3d')]);_0x5e5616[_0x5f62('0x3e')]=_['intersection'](_0x5e5616[_0x5f62('0x3b')],_0x5e5616['query']);_0x32b507[_0x5f62('0x40')]=_[_0x5f62('0x3f')](_0x5e5616[_0x5f62('0x3b')],qs[_0x5f62('0x41')](_0xec9b48[_0x5f62('0x3d')]['fields']));_0x32b507[_0x5f62('0x40')]=_0x32b507[_0x5f62('0x40')][_0x5f62('0x55')]?_0x32b507[_0x5f62('0x40')]:_0x5e5616[_0x5f62('0x3b')];if(_0xec9b48[_0x5f62('0x3d')][_0x5f62('0x4e')]){_0x32b507[_0x5f62('0x4f')]=[{'all':!![]}];}_0x32b507=_[_0x5f62('0x49')]({},_0x32b507,_0xec9b48[_0x5f62('0x4c')]);return db[_0x5f62('0x4d')][_0x5f62('0x56')](_0x32b507)[_0x5f62('0x31')](handleEntityNotFound(_0x3dd249,null))['then'](respondWithResult(_0x3dd249,null))[_0x5f62('0x52')](handleError(_0x3dd249,null));};exports[_0x5f62('0x57')]=function(_0x37f2e4,_0x10aa73){return db['Dashboard'][_0x5f62('0x57')](_0x37f2e4[_0x5f62('0x58')],{})[_0x5f62('0x31')](function(_0x2dd62a){var _0x440814=_0x37f2e4[_0x5f62('0x59')][_0x5f62('0x5a')]({'plain':!![]});if(!_0x440814)throw new Error(_0x5f62('0x5b'));if(_0x440814[_0x5f62('0x5c')]===_0x5f62('0x59')){var _0x5a3f22=_0x2dd62a[_0x5f62('0x5a')]({'plain':!![]});var _0x2a3beb=_0x5f62('0x5d');return db['UserProfileSection']['find']({'where':{'name':_0x2a3beb,'userProfileId':_0x440814[_0x5f62('0x5e')]},'raw':!![]})[_0x5f62('0x31')](function(_0x47b08d){if(_0x47b08d&&_0x47b08d[_0x5f62('0x5f')]===0x0){return db[_0x5f62('0x32')][_0x5f62('0x57')]({'name':_0x5a3f22['name'],'resourceId':_0x5a3f22['id'],'type':_0x47b08d[_0x5f62('0x35')],'sectionId':_0x47b08d['id']},{})['then'](function(){return _0x2dd62a;});}else{return _0x2dd62a;}})[_0x5f62('0x52')](function(_0x39ef7d){logger[_0x5f62('0x33')](_0x5f62('0x60'),_0x39ef7d);throw _0x39ef7d;});}return _0x2dd62a;})[_0x5f62('0x31')](respondWithResult(_0x10aa73,0xc9))['catch'](handleError(_0x10aa73,null));};exports[_0x5f62('0x61')]=function(_0x3ddbe5,_0x4a6821){var _0x25ab51={'where':{'id':_0x3ddbe5[_0x5f62('0x54')]['id']}},_0x375a3d={};_0x375a3d[_0x5f62('0x3b')]=_[_0x5f62('0x3c')](db[_0x5f62('0x4d')]['rawAttributes']);_0x25ab51[_0x5f62('0x40')]=_['intersection'](_0x375a3d['model'],qs['fields'](_0x3ddbe5['query']['fields']));_0x25ab51[_0x5f62('0x40')]=_0x25ab51[_0x5f62('0x40')][_0x5f62('0x55')]?_0x25ab51[_0x5f62('0x40')]:_0x375a3d['model'];if(_0x3ddbe5[_0x5f62('0x3d')][_0x5f62('0x4e')]){_0x25ab51['include']=[{'all':!![]}];}_0x25ab51=_[_0x5f62('0x49')]({},_0x25ab51,_0x3ddbe5[_0x5f62('0x4c')]);return db[_0x5f62('0x4d')]['find'](_0x25ab51)[_0x5f62('0x31')](handleEntityNotFound(_0x4a6821,null))[_0x5f62('0x31')](function(_0x29b428){if(_0x29b428){var _0x26e540=_0x29b428[_0x5f62('0x5a')]({'plain':!![]});_0x26e540=qs['omit'](_0x26e540,['id',_0x5f62('0x62'),_0x5f62('0x63')]);_0x3ddbe5[_0x5f62('0x58')]=_['omit'](_0x3ddbe5[_0x5f62('0x58')],['id','createdAt',_0x5f62('0x63')]);return db['Dashboard'][_0x5f62('0x57')](_[_0x5f62('0x49')](_0x26e540,_0x3ddbe5['body']),{'include':_0x3ddbe5[_0x5f62('0x3d')][_0x5f62('0x4e')]?[{'all':!![]}]:undefined})[_0x5f62('0x31')](function(_0x5d378b){var _0xb63e67=_0x3ddbe5[_0x5f62('0x59')][_0x5f62('0x5a')]({'plain':!![]});if(!_0xb63e67)throw new Error(_0x5f62('0x5b'));if(_0xb63e67[_0x5f62('0x5c')]===_0x5f62('0x59')){var _0x51dea5=_0x5d378b['get']({'plain':!![]});var _0x26b4c2=_0x5f62('0x5d');return db[_0x5f62('0x64')][_0x5f62('0x56')]({'where':{'name':_0x26b4c2,'userProfileId':_0xb63e67['userProfileId']},'raw':!![]})['then'](function(_0x51c1c3){if(_0x51c1c3&&_0x51c1c3[_0x5f62('0x5f')]===0x0){return db['UserProfileResource'][_0x5f62('0x57')]({'name':_0x51dea5['name'],'resourceId':_0x51dea5['id'],'type':_0x51c1c3[_0x5f62('0x35')],'sectionId':_0x51c1c3['id']},{})['then'](function(){return _0x5d378b;});}else{return _0x5d378b;}})[_0x5f62('0x52')](function(_0x2fb420){logger[_0x5f62('0x33')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2fb420);throw _0x2fb420;});}return _0x5d378b;});}})[_0x5f62('0x31')](respondWithResult(_0x4a6821,0xc9))['catch'](handleError(_0x4a6821,null));};exports['update']=function(_0x247fe9,_0x378860){if(_0x247fe9[_0x5f62('0x58')]['id']){delete _0x247fe9[_0x5f62('0x58')]['id'];}return db[_0x5f62('0x4d')][_0x5f62('0x56')]({'where':{'id':_0x247fe9[_0x5f62('0x54')]['id']}})[_0x5f62('0x31')](handleEntityNotFound(_0x378860,null))[_0x5f62('0x31')](saveUpdates(_0x247fe9[_0x5f62('0x58')],null))[_0x5f62('0x31')](respondWithResult(_0x378860,null))['catch'](handleError(_0x378860,null));};exports['destroy']=function(_0x1c0128,_0x399f5){return db[_0x5f62('0x4d')][_0x5f62('0x56')]({'where':{'id':_0x1c0128[_0x5f62('0x54')]['id']}})[_0x5f62('0x31')](handleEntityNotFound(_0x399f5,null))[_0x5f62('0x31')](removeEntity(_0x399f5,null))['catch'](handleError(_0x399f5,null));};function widgetAttributes(_0x4093b3){try{switch(_0x4093b3[_0x5f62('0x39')]){case _0x5f62('0x65'):return[{'name':'attrUrl','value':_0x4093b3[_0x5f62('0x66')]||(_0x4093b3['attrs']&&_0x4093b3['attrs'][0x0]?_0x4093b3[_0x5f62('0x67')][0x0][_0x5f62('0x68')]:undefined)||_0x5f62('0x69')}];case'custom':return[{'name':_0x5f62('0x6a'),'value':_0x4093b3['attrPath']||(_0x4093b3[_0x5f62('0x67')]&&_0x4093b3[_0x5f62('0x67')][0x0]?_0x4093b3[_0x5f62('0x67')][0x0][_0x5f62('0x68')]:undefined)||''}];case _0x5f62('0x6b'):return[{'name':'attrHourFormat','value':_0x4093b3[_0x5f62('0x6c')]||(_0x4093b3['attrs']&&_0x4093b3[_0x5f62('0x67')][0x0]?_0x4093b3[_0x5f62('0x67')][0x0][_0x5f62('0x68')]:undefined)||'HH:mm:ss'},{'name':_0x5f62('0x6d'),'value':_0x4093b3[_0x5f62('0x6d')]||(_0x4093b3[_0x5f62('0x67')]&&_0x4093b3[_0x5f62('0x67')][0x1]?_0x4093b3[_0x5f62('0x67')][0x1]['value']:undefined)||_0x5f62('0x6e')},{'name':_0x5f62('0x6f'),'value':_0x4093b3[_0x5f62('0x6f')]||(_0x4093b3['attrs']&&_0x4093b3['attrs'][0x2]?_0x4093b3['attrs'][0x2][_0x5f62('0x68')]:undefined)||0xc}];case _0x5f62('0x70'):return[{'name':_0x5f62('0x71'),'value':_0x4093b3['attrMetric']||(_0x4093b3['attrs']&&_0x4093b3[_0x5f62('0x67')][0x0]?_0x4093b3[_0x5f62('0x67')][0x0]['value']:undefined)||_0x5f62('0x72')},{'name':_0x5f62('0x73'),'value':_0x4093b3[_0x5f62('0x73')]||(_0x4093b3[_0x5f62('0x67')]&&_0x4093b3[_0x5f62('0x67')][0x1]?_0x4093b3[_0x5f62('0x67')][0x1][_0x5f62('0x68')]:undefined)||[]},{'name':_0x5f62('0x6f'),'value':_0x4093b3['attrFontSize']||(_0x4093b3[_0x5f62('0x67')]&&_0x4093b3[_0x5f62('0x67')][0x2]?_0x4093b3[_0x5f62('0x67')][0x2][_0x5f62('0x68')]:undefined)||0x14}];case _0x5f62('0x74'):case _0x5f62('0x75'):return[{'name':_0x5f62('0x76'),'value':_0x4093b3['attrSerie1']||(_0x4093b3['attrs']&&_0x4093b3[_0x5f62('0x67')][0x0]?_0x4093b3[_0x5f62('0x67')][0x0][_0x5f62('0x68')]:undefined)||'total'},{'name':_0x5f62('0x77'),'value':_0x4093b3[_0x5f62('0x77')]||(_0x4093b3[_0x5f62('0x67')]&&_0x4093b3[_0x5f62('0x67')][0x1]?_0x4093b3[_0x5f62('0x67')][0x1][_0x5f62('0x68')]:undefined)||null},{'name':_0x5f62('0x78'),'value':_0x4093b3[_0x5f62('0x78')]||(_0x4093b3[_0x5f62('0x67')]&&_0x4093b3[_0x5f62('0x67')][0x2]?_0x4093b3[_0x5f62('0x67')][0x2][_0x5f62('0x68')]:undefined)||null},{'name':_0x5f62('0x73'),'value':_0x4093b3[_0x5f62('0x73')]||(_0x4093b3[_0x5f62('0x67')]&&_0x4093b3[_0x5f62('0x67')][0x3]?_0x4093b3[_0x5f62('0x67')][0x3][_0x5f62('0x68')]:undefined)||[]}];case _0x5f62('0x79'):return[{'name':_0x5f62('0x7a'),'type':_0x4093b3['reportType']||(_0x4093b3[_0x5f62('0x67')]&&_0x4093b3[_0x5f62('0x67')][0x0]?_0x4093b3[_0x5f62('0x67')][0x0][_0x5f62('0x39')]:undefined)||null,'value':_0x4093b3[_0x5f62('0x7a')]||(_0x4093b3['attrs']&&_0x4093b3[_0x5f62('0x67')][0x0]?_0x4093b3[_0x5f62('0x67')][0x0][_0x5f62('0x68')]:undefined)||null},{'name':_0x5f62('0x7b'),'value':_0x4093b3[_0x5f62('0x7b')]||(_0x4093b3[_0x5f62('0x67')]&&_0x4093b3[_0x5f62('0x67')][0x1]?_0x4093b3[_0x5f62('0x67')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x2e0549){logger['error'](_0x5f62('0x7c'),JSON[_0x5f62('0x7d')](_0x2e0549));return[];}}exports['addItem']=function(_0x186164,_0x14e819,_0x28abb3){if(_0x186164[_0x5f62('0x58')]['id']){delete _0x186164[_0x5f62('0x58')]['id'];}return db[_0x5f62('0x4d')][_0x5f62('0x56')]({'where':{'id':_0x186164[_0x5f62('0x54')]['id']}})[_0x5f62('0x31')](handleEntityNotFound(_0x14e819,null))[_0x5f62('0x31')](function(_0x21ecb5){if(_0x21ecb5){_0x186164[_0x5f62('0x58')][_0x5f62('0x7e')]=_0x21ecb5['id'];_0x186164[_0x5f62('0x58')][_0x5f62('0x67')]=widgetAttributes(_0x186164[_0x5f62('0x58')]);return db['DashboardItem'][_0x5f62('0x57')](_0x186164['body']);}})['then'](respondWithResult(_0x14e819,null))['catch'](handleError(_0x14e819,null));};exports[_0x5f62('0x7f')]=function(_0x2011eb,_0x57d029,_0x1fd19e){var _0x10b49b={};var _0xabee59={};var _0x14e27e;var _0x596b29;return db['Dashboard']['findOne']({'where':{'id':_0x2011eb['params']['id']}})[_0x5f62('0x31')](handleEntityNotFound(_0x57d029,null))[_0x5f62('0x31')](function(_0x46442c){if(_0x46442c){_0x14e27e=_0x46442c;_0xabee59['model']=_['keys'](db['DashboardItem'][_0x5f62('0x37')]);_0xabee59[_0x5f62('0x3d')]=_[_0x5f62('0x3c')](_0x2011eb[_0x5f62('0x3d')]);_0xabee59[_0x5f62('0x3e')]=_['intersection'](_0xabee59[_0x5f62('0x3b')],_0xabee59['query']);_0x10b49b[_0x5f62('0x40')]=_[_0x5f62('0x3f')](_0xabee59['model'],qs['fields'](_0x2011eb[_0x5f62('0x3d')][_0x5f62('0x41')]));_0x10b49b[_0x5f62('0x40')]=_0x10b49b['attributes'][_0x5f62('0x55')]?_0x10b49b[_0x5f62('0x40')]:_0xabee59[_0x5f62('0x3b')];_0x10b49b[_0x5f62('0x44')]=qs[_0x5f62('0x45')](_0x2011eb[_0x5f62('0x3d')][_0x5f62('0x45')]);_0x10b49b['where']=qs['filters'](_[_0x5f62('0x47')](_0x2011eb[_0x5f62('0x3d')],_0xabee59[_0x5f62('0x3e')]));if(_0x2011eb[_0x5f62('0x3d')]['filter']){_0x10b49b[_0x5f62('0x46')]=_[_0x5f62('0x49')](_0x10b49b[_0x5f62('0x46')],{'$or':_[_0x5f62('0x4a')](_0x10b49b['attributes'],function(_0x35598d){var _0x14c0e1={};_0x14c0e1[_0x35598d]={'$like':'%'+_0x2011eb[_0x5f62('0x3d')][_0x5f62('0x48')]+'%'};return _0x14c0e1;})});}_0x10b49b=_['merge']({},_0x10b49b,_0x2011eb[_0x5f62('0x4c')]);return _0x14e27e['getItems'](_0x10b49b);}})[_0x5f62('0x31')](function(_0xcbc3e8){if(_0xcbc3e8){_0x596b29=_0xcbc3e8[_0x5f62('0x55')];if(!_0x2011eb[_0x5f62('0x3d')]['hasOwnProperty'](_0x5f62('0x43'))){_0x10b49b[_0x5f62('0x29')]=qs[_0x5f62('0x29')](_0x2011eb[_0x5f62('0x3d')]['limit']);_0x10b49b[_0x5f62('0x27')]=qs['offset'](_0x2011eb[_0x5f62('0x3d')][_0x5f62('0x27')]);}return _0x14e27e['getItems'](_0x10b49b);}})[_0x5f62('0x31')](function(_0x1e6f5e){if(_0x1e6f5e){return _0x1e6f5e?{'count':_0x596b29,'rows':_0x1e6f5e}:null;}})[_0x5f62('0x31')](respondWithResult(_0x57d029,null))[_0x5f62('0x52')](handleError(_0x57d029,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 767227a..25247d0 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 _0x141c=['hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard','save','update','remove','emit'];(function(_0x30da2e,_0x146e54){var _0x794139=function(_0x25bd28){while(--_0x25bd28){_0x30da2e['push'](_0x30da2e['shift']());}};_0x794139(++_0x146e54);}(_0x141c,0x143));var _0xc141=function(_0x58c1e3,_0x214851){_0x58c1e3=_0x58c1e3-0x0;var _0x5bf69c=_0x141c[_0x58c1e3];return _0x5bf69c;};'use strict';var EventEmitter=require(_0xc141('0x0'));var Dashboard=require(_0xc141('0x1'))['db'][_0xc141('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc141('0x3'),'afterUpdate':_0xc141('0x4'),'afterDestroy':_0xc141('0x5')};function emitEvent(_0x1cb34b){return function(_0x2d4ffe,_0x4ccbfa,_0xe33597){DashboardEvents[_0xc141('0x6')](_0x1cb34b+':'+_0x2d4ffe['id'],_0x2d4ffe);DashboardEvents[_0xc141('0x6')](_0x1cb34b,_0x2d4ffe);_0xe33597(null);};}for(var e in events){if(events[_0xc141('0x7')](e)){var event=events[e];Dashboard[_0xc141('0x8')](e,emitEvent(event));}}module[_0xc141('0x9')]=DashboardEvents; \ No newline at end of file +var _0x6599=['Dashboard','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x5356da,_0x3cd9e5){var _0x50c39e=function(_0x2cd6c8){while(--_0x2cd6c8){_0x5356da['push'](_0x5356da['shift']());}};_0x50c39e(++_0x3cd9e5);}(_0x6599,0x8e));var _0x9659=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x6599[_0xbd08b4];return _0x314f1e;};'use strict';var EventEmitter=require(_0x9659('0x0'));var Dashboard=require(_0x9659('0x1'))['db'][_0x9659('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9659('0x3'),'afterUpdate':_0x9659('0x4'),'afterDestroy':'remove'};function emitEvent(_0x95ca4c){return function(_0x230c9a,_0x5a1f90,_0x296b14){DashboardEvents[_0x9659('0x5')](_0x95ca4c+':'+_0x230c9a['id'],_0x230c9a);DashboardEvents['emit'](_0x95ca4c,_0x230c9a);_0x296b14(null);};}for(var e in events){if(events[_0x9659('0x6')](e)){var event=events[e];Dashboard[_0x9659('0x7')](e,emitEvent(event));}}module[_0x9659('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 1fb33c6..65f5a50 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 _0xb5b1=['lodash','moment','path','rimraf','exports','define','dashboards'];(function(_0x4e435d,_0x3ea863){var _0x411552=function(_0x33cbeb){while(--_0x33cbeb){_0x4e435d['push'](_0x4e435d['shift']());}};_0x411552(++_0x3ea863);}(_0xb5b1,0xcb));var _0x1b5b=function(_0x2484d2,_0x4ef1e0){_0x2484d2=_0x2484d2-0x0;var _0x4f47da=_0xb5b1[_0x2484d2];return _0x4f47da;};'use strict';var _=require(_0x1b5b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x1b5b('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1b5b('0x2'));var rimraf=require(_0x1b5b('0x3'));var config=require('../../config/environment');var attributes=require('./dashboard.attributes');module[_0x1b5b('0x4')]=function(_0x7c7b3,_0x2bc562){return _0x7c7b3[_0x1b5b('0x5')]('Dashboard',attributes,{'tableName':_0x1b5b('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f70=['path','../../config/environment','./dashboard.attributes','exports','define','dashboards','lodash','api','bluebird','request-promise'];(function(_0x5ac4b6,_0x4d9360){var _0x29ced8=function(_0x4fdcb6){while(--_0x4fdcb6){_0x5ac4b6['push'](_0x5ac4b6['shift']());}};_0x29ced8(++_0x4d9360);}(_0x1f70,0x92));var _0x01f7=function(_0x55093a,_0x4ca188){_0x55093a=_0x55093a-0x0;var _0x5a4682=_0x1f70[_0x55093a];return _0x5a4682;};'use strict';var _=require(_0x01f7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x01f7('0x1'));var moment=require('moment');var BPromise=require(_0x01f7('0x2'));var rp=require(_0x01f7('0x3'));var fs=require('fs');var path=require(_0x01f7('0x4'));var rimraf=require('rimraf');var config=require(_0x01f7('0x5'));var attributes=require(_0x01f7('0x6'));module[_0x01f7('0x7')]=function(_0x3c8662,_0x42a013){return _0x3c8662[_0x01f7('0x8')]('Dashboard',attributes,{'tableName':_0x01f7('0x9'),'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 a07c6ee..fb7a801 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 _0xa2e3=['info','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./dashboard.socket'];(function(_0xb4e6b1,_0x37bb2e){var _0x515972=function(_0x51417c){while(--_0x51417c){_0xb4e6b1['push'](_0xb4e6b1['shift']());}};_0x515972(++_0x37bb2e);}(_0xa2e3,0x128));var _0x3a2e=function(_0x2a659c,_0x37b069){_0x2a659c=_0x2a659c-0x0;var _0x529157=_0xa2e3[_0x2a659c];return _0x529157;};'use strict';var _=require(_0x3a2e('0x0'));var util=require(_0x3a2e('0x1'));var moment=require('moment');var BPromise=require(_0x3a2e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3a2e('0x3'));var db=require(_0x3a2e('0x4'))['db'];var utils=require(_0x3a2e('0x5'));var logger=require(_0x3a2e('0x6'))(_0x3a2e('0x7'));var config=require(_0x3a2e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3a2e('0x9')][_0x3a2e('0xa')]({'port':0x232a});config['redis']=_[_0x3a2e('0xb')](config[_0x3a2e('0xc')],{'host':_0x3a2e('0xd'),'port':0x18eb});var socket=require(_0x3a2e('0xe'))(new Redis(config['redis']));require(_0x3a2e('0xf'))['register'](socket);function respondWithRpcPromise(_0x10d297,_0x456cad,_0x65070f){return new BPromise(function(_0x3c1304,_0x5ba407){return client['request'](_0x10d297,_0x65070f)['then'](function(_0x43cd18){logger[_0x3a2e('0x10')](_0x3a2e('0x11'),_0x456cad,_0x3a2e('0x12'));logger['debug'](_0x3a2e('0x13'),_0x456cad,_0x3a2e('0x12'),JSON[_0x3a2e('0x14')](_0x43cd18));if(_0x43cd18[_0x3a2e('0x15')]){if(_0x43cd18['error']['code']===0x1f4){logger[_0x3a2e('0x15')](_0x3a2e('0x11'),_0x456cad,_0x43cd18['error']['message']);return _0x5ba407(_0x43cd18[_0x3a2e('0x15')]['message']);}logger[_0x3a2e('0x15')](_0x3a2e('0x11'),_0x456cad,_0x43cd18[_0x3a2e('0x15')][_0x3a2e('0x16')]);return _0x3c1304(_0x43cd18['error'][_0x3a2e('0x16')]);}else{logger['info'](_0x3a2e('0x11'),_0x456cad,'request\x20sent');_0x3c1304(_0x43cd18[_0x3a2e('0x17')][_0x3a2e('0x16')]);}})['catch'](function(_0x4be2d2){logger['error'](_0x3a2e('0x11'),_0x456cad,_0x4be2d2);_0x5ba407(_0x4be2d2);});});} \ No newline at end of file +var _0x975a=['socket.io-emitter','info','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x50d29b,_0x146ee4){var _0x1c590a=function(_0x2a6163){while(--_0x2a6163){_0x50d29b['push'](_0x50d29b['shift']());}};_0x1c590a(++_0x146ee4);}(_0x975a,0x142));var _0xa975=function(_0x4141c2,_0x4345b1){_0x4141c2=_0x4141c2-0x0;var _0x104dca=_0x975a[_0x4141c2];return _0x104dca;};'use strict';var _=require(_0xa975('0x0'));var util=require(_0xa975('0x1'));var moment=require(_0xa975('0x2'));var BPromise=require(_0xa975('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa975('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa975('0x5'));var logger=require('../../config/logger')(_0xa975('0x6'));var config=require(_0xa975('0x7'));var jayson=require(_0xa975('0x8'));var client=jayson[_0xa975('0x9')][_0xa975('0xa')]({'port':0x232a});config[_0xa975('0xb')]=_[_0xa975('0xc')](config[_0xa975('0xb')],{'host':_0xa975('0xd'),'port':0x18eb});var socket=require(_0xa975('0xe'))(new Redis(config[_0xa975('0xb')]));require('./dashboard.socket')['register'](socket);function respondWithRpcPromise(_0x23e8a7,_0x52ce47,_0x4091f1){return new BPromise(function(_0x16f94c,_0x1192fb){return client['request'](_0x23e8a7,_0x4091f1)['then'](function(_0x45c8e){logger[_0xa975('0xf')](_0xa975('0x10'),_0x52ce47,_0xa975('0x11'));logger['debug'](_0xa975('0x12'),_0x52ce47,_0xa975('0x11'),JSON['stringify'](_0x45c8e));if(_0x45c8e['error']){if(_0x45c8e[_0xa975('0x13')][_0xa975('0x14')]===0x1f4){logger[_0xa975('0x13')]('Dashboard,\x20%s,\x20%s',_0x52ce47,_0x45c8e[_0xa975('0x13')]['message']);return _0x1192fb(_0x45c8e['error'][_0xa975('0x15')]);}logger[_0xa975('0x13')](_0xa975('0x10'),_0x52ce47,_0x45c8e[_0xa975('0x13')][_0xa975('0x15')]);return _0x16f94c(_0x45c8e['error'][_0xa975('0x15')]);}else{logger[_0xa975('0xf')](_0xa975('0x10'),_0x52ce47,_0xa975('0x11'));_0x16f94c(_0x45c8e[_0xa975('0x16')][_0xa975('0x15')]);}})[_0xa975('0x17')](function(_0x19cbf4){logger['error'](_0xa975('0x10'),_0x52ce47,_0x19cbf4);_0x1192fb(_0x19cbf4);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index a709ad9..72b4330 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 _0x4f18=['update','removeListener','register','length','dashboard:','./dashboard.events','remove'];(function(_0x2417cb,_0x30f452){var _0x4dabae=function(_0x41659a){while(--_0x41659a){_0x2417cb['push'](_0x2417cb['shift']());}};_0x4dabae(++_0x30f452);}(_0x4f18,0x1b0));var _0x84f1=function(_0x471809,_0x566d8e){_0x471809=_0x471809-0x0;var _0x82c43d=_0x4f18[_0x471809];return _0x82c43d;};'use strict';var DashboardEvents=require(_0x84f1('0x0'));var events=['save',_0x84f1('0x1'),_0x84f1('0x2')];function createListener(_0x4c73aa,_0x29458c){return function(_0x24db64){_0x29458c['emit'](_0x4c73aa,_0x24db64);};}function removeListener(_0x9fdf5,_0x5880ef){return function(){DashboardEvents[_0x84f1('0x3')](_0x9fdf5,_0x5880ef);};}exports[_0x84f1('0x4')]=function(_0xb1fd49){for(var _0x2e6c1d=0x0,_0x4c93b0=events[_0x84f1('0x5')];_0x2e6c1d<_0x4c93b0;_0x2e6c1d++){var _0x3155be=events[_0x2e6c1d];var _0x3b7654=createListener(_0x84f1('0x6')+_0x3155be,_0xb1fd49);DashboardEvents['on'](_0x3155be,_0x3b7654);}}; \ No newline at end of file +var _0xb18f=['register','length','dashboard:','save','remove','update','emit','removeListener'];(function(_0x49c1fb,_0x5d5217){var _0x20d9c6=function(_0x358a40){while(--_0x358a40){_0x49c1fb['push'](_0x49c1fb['shift']());}};_0x20d9c6(++_0x5d5217);}(_0xb18f,0x18b));var _0xfb18=function(_0x547c3a,_0x1e6ca9){_0x547c3a=_0x547c3a-0x0;var _0x57c5e7=_0xb18f[_0x547c3a];return _0x57c5e7;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0xfb18('0x0'),_0xfb18('0x1'),_0xfb18('0x2')];function createListener(_0x120cbc,_0x1858d4){return function(_0x29a530){_0x1858d4[_0xfb18('0x3')](_0x120cbc,_0x29a530);};}function removeListener(_0x38b596,_0x2c1aa0){return function(){DashboardEvents[_0xfb18('0x4')](_0x38b596,_0x2c1aa0);};}exports[_0xfb18('0x5')]=function(_0x4450d2){for(var _0x2117c3=0x0,_0x2430ed=events[_0xfb18('0x6')];_0x2117c3<_0x2430ed;_0x2117c3++){var _0x4ff110=events[_0x2117c3];var _0x49685b=createListener(_0xfb18('0x7')+_0x4ff110,_0x4450d2);DashboardEvents['on'](_0x4ff110,_0x49685b);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index aafa91d..79c989d 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 _0xde9a=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','getItems','post','create','clone','/:id/items','addItem','put','update','delete','exports','multer'];(function(_0x347a4b,_0x15c25d){var _0x150134=function(_0x106a0b){while(--_0x106a0b){_0x347a4b['push'](_0x347a4b['shift']());}};_0x150134(++_0x15c25d);}(_0xde9a,0x1b9));var _0xade9=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xde9a[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require(_0xade9('0x0'));var util=require(_0xade9('0x1'));var path=require(_0xade9('0x2'));var timeout=require(_0xade9('0x3'));var express=require(_0xade9('0x4'));var router=express[_0xade9('0x5')]();var fs_extra=require(_0xade9('0x6'));var auth=require(_0xade9('0x7'));var interaction=require(_0xade9('0x8'));var config=require(_0xade9('0x9'));var controller=require(_0xade9('0xa'));router[_0xade9('0xb')]('/',auth[_0xade9('0xc')](),controller[_0xade9('0xd')]);router[_0xade9('0xb')](_0xade9('0xe'),auth[_0xade9('0xc')](),controller[_0xade9('0xf')]);router[_0xade9('0xb')]('/:id/items',auth[_0xade9('0xc')](),controller[_0xade9('0x10')]);router[_0xade9('0x11')]('/',auth['isAuthenticated'](),controller[_0xade9('0x12')]);router['post']('/:id/clone',auth[_0xade9('0xc')](),controller[_0xade9('0x13')]);router[_0xade9('0x11')](_0xade9('0x14'),auth[_0xade9('0xc')](),controller[_0xade9('0x15')]);router[_0xade9('0x16')](_0xade9('0xe'),auth[_0xade9('0xc')](),controller[_0xade9('0x17')]);router[_0xade9('0x18')](_0xade9('0xe'),auth[_0xade9('0xc')](),controller['destroy']);module[_0xade9('0x19')]=router; \ No newline at end of file +var _0x95b4=['get','/:id','isAuthenticated','show','/:id/items','getItems','create','post','/:id/clone','clone','addItem','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboard.controller'];(function(_0x454945,_0x4dbde4){var _0x263ec4=function(_0xe4e74){while(--_0xe4e74){_0x454945['push'](_0x454945['shift']());}};_0x263ec4(++_0x4dbde4);}(_0x95b4,0x87));var _0x495b=function(_0x57e990,_0x4f77a8){_0x57e990=_0x57e990-0x0;var _0x4084a3=_0x95b4[_0x57e990];return _0x4084a3;};'use strict';var multer=require(_0x495b('0x0'));var util=require(_0x495b('0x1'));var path=require('path');var timeout=require(_0x495b('0x2'));var express=require(_0x495b('0x3'));var router=express[_0x495b('0x4')]();var fs_extra=require(_0x495b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x495b('0x6'));var config=require(_0x495b('0x7'));var controller=require(_0x495b('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x495b('0x9')](_0x495b('0xa'),auth[_0x495b('0xb')](),controller[_0x495b('0xc')]);router[_0x495b('0x9')](_0x495b('0xd'),auth[_0x495b('0xb')](),controller[_0x495b('0xe')]);router['post']('/',auth[_0x495b('0xb')](),controller[_0x495b('0xf')]);router[_0x495b('0x10')](_0x495b('0x11'),auth[_0x495b('0xb')](),controller[_0x495b('0x12')]);router[_0x495b('0x10')](_0x495b('0xd'),auth['isAuthenticated'](),controller[_0x495b('0x13')]);router[_0x495b('0x14')](_0x495b('0xa'),auth['isAuthenticated'](),controller[_0x495b('0x15')]);router[_0x495b('0x16')](_0x495b('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x495b('0x17')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 42d2008..225523b 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 _0xe2fe=['setDataValue','INTEGER','sequelize','exports','STRING','TEXT','long','parse','getDataValue','attrs','stringify'];(function(_0x56c3ce,_0x1f8b29){var _0x5a3866=function(_0x142a2f){while(--_0x142a2f){_0x56c3ce['push'](_0x56c3ce['shift']());}};_0x5a3866(++_0x1f8b29);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xee2f('0x0'));var squel=require('squel');var _=require('lodash');module[_0xee2f('0x1')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xee2f('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xee2f('0x3')](_0xee2f('0x4')),'get':function(){try{return JSON[_0xee2f('0x5')](this[_0xee2f('0x6')]('attrs'));}catch(_0x311a2f){return[];}},'set':function(_0x2b7e7c){try{this['setDataValue'](_0xee2f('0x7'),JSON[_0xee2f('0x8')](_0x2b7e7c));}catch(_0x5a7975){this[_0xee2f('0x9')]('attrs',JSON[_0xee2f('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0xee2f('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xee2f('0xa')]},'col':{'type':Sequelize[_0xee2f('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xee2f('0x2')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x4975=['parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','lodash','exports','STRING','TEXT','long'];(function(_0x2125cb,_0x36b97d){var _0x586a38=function(_0x29b57d){while(--_0x29b57d){_0x2125cb['push'](_0x2125cb['shift']());}};_0x586a38(++_0x36b97d);}(_0x4975,0x86));var _0x5497=function(_0x119c04,_0x560ed0){_0x119c04=_0x119c04-0x0;var _0x5eb12b=_0x4975[_0x119c04];return _0x5eb12b;};'use strict';var Sequelize=require(_0x5497('0x0'));var squel=require('squel');var _=require(_0x5497('0x1'));module[_0x5497('0x2')]={'title':{'type':Sequelize[_0x5497('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x5497('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x5497('0x4')](_0x5497('0x5')),'get':function(){try{return JSON[_0x5497('0x6')](this[_0x5497('0x7')](_0x5497('0x8')));}catch(_0x5d5272){return[];}},'set':function(_0x539a27){try{this[_0x5497('0x9')]('attrs',JSON[_0x5497('0xa')](_0x539a27));}catch(_0x674a2a){this[_0x5497('0x9')]('attrs',JSON[_0x5497('0xa')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x5497('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5497('0xb')]},'col':{'type':Sequelize[_0x5497('0xb')]},'background':{'type':Sequelize[_0x5497('0x3')],'allowNull':![],'defaultValue':_0x5497('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x5497('0x3')],'allowNull':![],'defaultValue':_0x5497('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x5497('0x3')]},'titleFontSize':{'type':Sequelize['INTEGER'],'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 ae8e5bd..f00a1b5 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 _0x831c=['fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','show','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','merge','options','DashboardItem','find','catch','type','iframe','attrUrl','attrs','https://','custom','attrPath','value','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','create','body','update','eml-format','rimraf'];(function(_0x43b8da,_0x346385){var _0x343207=function(_0x4559bc){while(--_0x4559bc){_0x43b8da['push'](_0x43b8da['shift']());}};_0x343207(++_0x346385);}(_0x831c,0x172));var _0xc831=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x831c[_0x3b0731];return _0x4204d7;};'use strict';var emlformat=require(_0xc831('0x0'));var rimraf=require(_0xc831('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc831('0x2'));var rp=require(_0xc831('0x3'));var moment=require(_0xc831('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc831('0x5'));var util=require(_0xc831('0x6'));var path=require(_0xc831('0x7'));var sox=require(_0xc831('0x8'));var csv=require('to-csv');var ejs=require(_0xc831('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc831('0xa'));var crypto=require('crypto');var jsforce=require(_0xc831('0xb'));var deskjs=require(_0xc831('0xc'));var toCsv=require(_0xc831('0xd'));var querystring=require(_0xc831('0xe'));var Papa=require(_0xc831('0xf'));var Redis=require(_0xc831('0x10'));var authService=require(_0xc831('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc831('0x12'));var logger=require(_0xc831('0x13'))(_0xc831('0x14'));var utils=require(_0xc831('0x15'));var config=require(_0xc831('0x16'));var licenseUtil=require(_0xc831('0x17'));var db=require(_0xc831('0x18'))['db'];config[_0xc831('0x19')]=_['defaults'](config[_0xc831('0x19')],{'host':_0xc831('0x1a'),'port':0x18eb});var socket=require(_0xc831('0x1b'))(new Redis(config[_0xc831('0x19')]));require(_0xc831('0x1c'))[_0xc831('0x1d')](socket);function respondWithStatusCode(_0x163490,_0x2013b2){_0x2013b2=_0x2013b2||0xcc;return function(_0x3f7181){if(_0x3f7181){return _0x163490[_0xc831('0x1e')](_0x2013b2);}return _0x163490[_0xc831('0x1f')](_0x2013b2)[_0xc831('0x20')]();};}function respondWithResult(_0x2b1266,_0x7b9875){_0x7b9875=_0x7b9875||0xc8;return function(_0xba4607){if(_0xba4607){return _0x2b1266[_0xc831('0x1f')](_0x7b9875)[_0xc831('0x21')](_0xba4607);}};}function respondWithFilteredResult(_0x36c23e,_0x8a6913){return function(_0xa21ce5){if(_0xa21ce5){var _0x2d88bd=typeof _0x8a6913[_0xc831('0x22')]===_0xc831('0x23')&&typeof _0x8a6913[_0xc831('0x24')]===_0xc831('0x23');var _0x48d4fc=_0xa21ce5[_0xc831('0x25')];var _0x36e6c6=_0x2d88bd?0x0:_0x8a6913['offset'];var _0x10f3c7=_0x2d88bd?_0xa21ce5['count']:_0x8a6913[_0xc831('0x22')]+_0x8a6913[_0xc831('0x24')];var _0x221907;if(_0x10f3c7>=_0x48d4fc){_0x10f3c7=_0x48d4fc;_0x221907=0xc8;}else{_0x221907=0xce;}_0x36c23e['status'](_0x221907);return _0x36c23e[_0xc831('0x26')](_0xc831('0x27'),_0x36e6c6+'-'+_0x10f3c7+'/'+_0x48d4fc)[_0xc831('0x21')](_0xa21ce5);}return null;};}function patchUpdates(_0x60e76e){return function(_0x53d3d0){try{jsonpatch[_0xc831('0x28')](_0x53d3d0,_0x60e76e,!![]);}catch(_0x480eae){return BPromise[_0xc831('0x29')](_0x480eae);}return _0x53d3d0[_0xc831('0x2a')]();};}function saveUpdates(_0x288569,_0x161579){return function(_0x2f0d7c){if(_0x2f0d7c){return _0x2f0d7c['update'](_0x288569)['then'](function(_0x4f5fd8){return _0x4f5fd8;});}return null;};}function removeEntity(_0x1b0d22,_0xd5001f){return function(_0x353853){if(_0x353853){return _0x353853[_0xc831('0x2b')]()[_0xc831('0x2c')](function(){_0x1b0d22[_0xc831('0x1f')](0xcc)[_0xc831('0x20')]();});}};}function handleEntityNotFound(_0x2847e6,_0x508558){return function(_0x4f71b0){if(!_0x4f71b0){_0x2847e6[_0xc831('0x1e')](0x194);}return _0x4f71b0;};}function handleError(_0xee01dc,_0x3214c5){_0x3214c5=_0x3214c5||0x1f4;return function(_0x2dab6e){logger[_0xc831('0x2d')](_0x2dab6e[_0xc831('0x2e')]);if(_0x2dab6e[_0xc831('0x2f')]){delete _0x2dab6e[_0xc831('0x2f')];}_0xee01dc[_0xc831('0x1f')](_0x3214c5)['send'](_0x2dab6e);};}exports[_0xc831('0x30')]=function(_0x4ad877,_0x52e28c){var _0x58bcc9={'raw':![],'where':{'id':_0x4ad877[_0xc831('0x31')]['id']}},_0x3d79bc={};_0x3d79bc[_0xc831('0x32')]=_[_0xc831('0x33')](db['DashboardItem']['rawAttributes']);_0x3d79bc[_0xc831('0x34')]=_[_0xc831('0x33')](_0x4ad877[_0xc831('0x34')]);_0x3d79bc[_0xc831('0x35')]=_[_0xc831('0x36')](_0x3d79bc['model'],_0x3d79bc[_0xc831('0x34')]);_0x58bcc9[_0xc831('0x37')]=_[_0xc831('0x36')](_0x3d79bc[_0xc831('0x32')],qs[_0xc831('0x38')](_0x4ad877['query'][_0xc831('0x38')]));_0x58bcc9['attributes']=_0x58bcc9[_0xc831('0x37')][_0xc831('0x39')]?_0x58bcc9['attributes']:_0x3d79bc[_0xc831('0x32')];if(_0x4ad877[_0xc831('0x34')][_0xc831('0x3a')]){_0x58bcc9['include']=[{'all':!![]}];}_0x58bcc9=_[_0xc831('0x3b')]({},_0x58bcc9,_0x4ad877[_0xc831('0x3c')]);return db[_0xc831('0x3d')][_0xc831('0x3e')](_0x58bcc9)[_0xc831('0x2c')](handleEntityNotFound(_0x52e28c,null))[_0xc831('0x2c')](respondWithResult(_0x52e28c,null))[_0xc831('0x3f')](handleError(_0x52e28c,null));};exports['destroy']=function(_0x5349d1,_0x1af703){return db[_0xc831('0x3d')][_0xc831('0x3e')]({'where':{'id':_0x5349d1[_0xc831('0x31')]['id']}})[_0xc831('0x2c')](handleEntityNotFound(_0x1af703,null))[_0xc831('0x2c')](removeEntity(_0x1af703,null))[_0xc831('0x3f')](handleError(_0x1af703,null));};function widgetAttributes(_0x49f32a){try{switch(_0x49f32a[_0xc831('0x40')]){case _0xc831('0x41'):return[{'name':_0xc831('0x42'),'value':_0x49f32a[_0xc831('0x42')]||(_0x49f32a[_0xc831('0x43')]&&_0x49f32a[_0xc831('0x43')][0x0]?_0x49f32a['attrs'][0x0]['value']:undefined)||_0xc831('0x44')}];case _0xc831('0x45'):return[{'name':_0xc831('0x46'),'value':_0x49f32a[_0xc831('0x46')]||(_0x49f32a[_0xc831('0x43')]&&_0x49f32a[_0xc831('0x43')][0x0]?_0x49f32a['attrs'][0x0][_0xc831('0x47')]:undefined)||''}];case'clock':return[{'name':_0xc831('0x48'),'value':_0x49f32a['attrHourFormat']||(_0x49f32a['attrs']&&_0x49f32a[_0xc831('0x43')][0x0]?_0x49f32a[_0xc831('0x43')][0x0]['value']:undefined)||_0xc831('0x49')},{'name':_0xc831('0x4a'),'value':_0x49f32a[_0xc831('0x4a')]||(_0x49f32a[_0xc831('0x43')]&&_0x49f32a['attrs'][0x1]?_0x49f32a[_0xc831('0x43')][0x1][_0xc831('0x47')]:undefined)||'0.00'},{'name':_0xc831('0x4b'),'value':_0x49f32a['attrFontSize']||(_0x49f32a[_0xc831('0x43')]&&_0x49f32a['attrs'][0x2]?_0x49f32a[_0xc831('0x43')][0x2]['value']:undefined)||0xc}];case _0xc831('0x4c'):return[{'name':_0xc831('0x4d'),'value':_0x49f32a[_0xc831('0x4d')]||(_0x49f32a[_0xc831('0x43')]&&_0x49f32a['attrs'][0x0]?_0x49f32a[_0xc831('0x43')][0x0]['value']:undefined)||'total'},{'name':_0xc831('0x4e'),'value':_0x49f32a['attrVoiceQueues']||(_0x49f32a[_0xc831('0x43')]&&_0x49f32a[_0xc831('0x43')][0x1]?_0x49f32a[_0xc831('0x43')][0x1][_0xc831('0x47')]:undefined)||[]},{'name':'attrFontSize','value':_0x49f32a[_0xc831('0x4b')]||(_0x49f32a[_0xc831('0x43')]&&_0x49f32a['attrs'][0x2]?_0x49f32a[_0xc831('0x43')][0x2]['value']:undefined)||0x14}];case _0xc831('0x4f'):case _0xc831('0x50'):return[{'name':_0xc831('0x51'),'value':_0x49f32a[_0xc831('0x51')]||(_0x49f32a[_0xc831('0x43')]&&_0x49f32a['attrs'][0x0]?_0x49f32a[_0xc831('0x43')][0x0][_0xc831('0x47')]:undefined)||_0xc831('0x52')},{'name':_0xc831('0x53'),'value':_0x49f32a['attrSerie2']||(_0x49f32a[_0xc831('0x43')]&&_0x49f32a[_0xc831('0x43')][0x1]?_0x49f32a['attrs'][0x1][_0xc831('0x47')]:undefined)||null},{'name':'attrSerie3','value':_0x49f32a[_0xc831('0x54')]||(_0x49f32a['attrs']&&_0x49f32a[_0xc831('0x43')][0x2]?_0x49f32a['attrs'][0x2][_0xc831('0x47')]:undefined)||null},{'name':_0xc831('0x4e'),'value':_0x49f32a[_0xc831('0x4e')]||(_0x49f32a['attrs']&&_0x49f32a['attrs'][0x3]?_0x49f32a[_0xc831('0x43')][0x3][_0xc831('0x47')]:undefined)||[]}];case _0xc831('0x55'):return[{'name':'attrReport','type':_0x49f32a[_0xc831('0x56')]||(_0x49f32a[_0xc831('0x43')]&&_0x49f32a['attrs'][0x0]?_0x49f32a[_0xc831('0x43')][0x0][_0xc831('0x40')]:undefined)||null,'value':_0x49f32a[_0xc831('0x57')]||(_0x49f32a[_0xc831('0x43')]&&_0x49f32a['attrs'][0x0]?_0x49f32a[_0xc831('0x43')][0x0][_0xc831('0x47')]:undefined)||null},{'name':_0xc831('0x58'),'value':_0x49f32a[_0xc831('0x58')]||(_0x49f32a[_0xc831('0x43')]&&_0x49f32a[_0xc831('0x43')][0x1]?_0x49f32a[_0xc831('0x43')][0x1][_0xc831('0x47')]:undefined)||0x0}];default:return[];}}catch(_0x52e816){logger[_0xc831('0x2d')](_0xc831('0x59'),JSON['stringify'](_0x52e816));return[];}}exports[_0xc831('0x5a')]=function(_0x462f61,_0x19aa4d){if(_0x462f61[_0xc831('0x5b')]){_0x462f61[_0xc831('0x5b')][_0xc831('0x43')]=widgetAttributes(_0x462f61[_0xc831('0x5b')]);}return db['DashboardItem']['create'](_0x462f61[_0xc831('0x5b')],{})[_0xc831('0x2c')](respondWithResult(_0x19aa4d,0xc9))['catch'](handleError(_0x19aa4d,null));};exports[_0xc831('0x5c')]=function(_0x5091e8,_0x6d62b6){if(_0x5091e8[_0xc831('0x5b')]['id']){delete _0x5091e8['body']['id'];}_0x5091e8[_0xc831('0x5b')][_0xc831('0x43')]=widgetAttributes(_0x5091e8[_0xc831('0x5b')]);return db['DashboardItem'][_0xc831('0x3e')]({'where':{'id':_0x5091e8['params']['id']}})[_0xc831('0x2c')](handleEntityNotFound(_0x6d62b6,null))[_0xc831('0x2c')](saveUpdates(_0x5091e8[_0xc831('0x5b')],null))[_0xc831('0x2c')](respondWithResult(_0x6d62b6,null))[_0xc831('0x3f')](handleError(_0x6d62b6,null));}; \ No newline at end of file +var _0x7a34=['create','body','zip-dir','fast-json-patch','moment','bluebird','path','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','status','json','offset','undefined','count','limit','Content-Range','save','update','then','params','model','keys','DashboardItem','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','catch','destroy','find','type','iframe','attrUrl','attrs','value','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','error','widgetAttributes:\x20%s','stringify'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x7a34,0xa6));var _0x47a3=function(_0x341d32,_0x17488e){_0x341d32=_0x341d32-0x0;var _0x3c3834=_0x7a34[_0x341d32];return _0x3c3834;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x47a3('0x0'));var jsonpatch=require(_0x47a3('0x1'));var rp=require('request-promise');var moment=require(_0x47a3('0x2'));var BPromise=require(_0x47a3('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x47a3('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x47a3('0x5'));var fs=require('fs');var fs_extra=require(_0x47a3('0x6'));var _=require(_0x47a3('0x7'));var squel=require(_0x47a3('0x8'));var crypto=require('crypto');var jsforce=require(_0x47a3('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x47a3('0xa'));var querystring=require(_0x47a3('0xb'));var Papa=require(_0x47a3('0xc'));var Redis=require(_0x47a3('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x47a3('0xe'));var as=require(_0x47a3('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x47a3('0x10'))(_0x47a3('0x11'));var utils=require('../../config/utils');var config=require(_0x47a3('0x12'));var licenseUtil=require(_0x47a3('0x13'));var db=require(_0x47a3('0x14'))['db'];config[_0x47a3('0x15')]=_[_0x47a3('0x16')](config[_0x47a3('0x15')],{'host':_0x47a3('0x17'),'port':0x18eb});var socket=require(_0x47a3('0x18'))(new Redis(config[_0x47a3('0x15')]));require(_0x47a3('0x19'))['register'](socket);function respondWithStatusCode(_0x263bfe,_0x1c3406){_0x1c3406=_0x1c3406||0xcc;return function(_0xdb7356){if(_0xdb7356){return _0x263bfe[_0x47a3('0x1a')](_0x1c3406);}return _0x263bfe[_0x47a3('0x1b')](_0x1c3406)['end']();};}function respondWithResult(_0x31680d,_0x13f1ab){_0x13f1ab=_0x13f1ab||0xc8;return function(_0x3af6e5){if(_0x3af6e5){return _0x31680d['status'](_0x13f1ab)[_0x47a3('0x1c')](_0x3af6e5);}};}function respondWithFilteredResult(_0x6a9673,_0x48bd98){return function(_0x3ccb16){if(_0x3ccb16){var _0xb1453f=typeof _0x48bd98[_0x47a3('0x1d')]===_0x47a3('0x1e')&&typeof _0x48bd98['limit']==='undefined';var _0x184b77=_0x3ccb16[_0x47a3('0x1f')];var _0x40adb8=_0xb1453f?0x0:_0x48bd98[_0x47a3('0x1d')];var _0x4494e8=_0xb1453f?_0x3ccb16['count']:_0x48bd98[_0x47a3('0x1d')]+_0x48bd98[_0x47a3('0x20')];var _0x330cb1;if(_0x4494e8>=_0x184b77){_0x4494e8=_0x184b77;_0x330cb1=0xc8;}else{_0x330cb1=0xce;}_0x6a9673[_0x47a3('0x1b')](_0x330cb1);return _0x6a9673['set'](_0x47a3('0x21'),_0x40adb8+'-'+_0x4494e8+'/'+_0x184b77)[_0x47a3('0x1c')](_0x3ccb16);}return null;};}function patchUpdates(_0x50b5cc){return function(_0x39d298){try{jsonpatch['apply'](_0x39d298,_0x50b5cc,!![]);}catch(_0x5f511f){return BPromise['reject'](_0x5f511f);}return _0x39d298[_0x47a3('0x22')]();};}function saveUpdates(_0x13cd84,_0x53a169){return function(_0x49f91b){if(_0x49f91b){return _0x49f91b[_0x47a3('0x23')](_0x13cd84)[_0x47a3('0x24')](function(_0x431a93){return _0x431a93;});}return null;};}function removeEntity(_0x5eeb6f,_0x23581d){return function(_0x469e63){if(_0x469e63){return _0x469e63['destroy']()[_0x47a3('0x24')](function(){_0x5eeb6f[_0x47a3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51e7f7,_0x47e81e){return function(_0x1dba1e){if(!_0x1dba1e){_0x51e7f7['sendStatus'](0x194);}return _0x1dba1e;};}function handleError(_0x259b64,_0x280129){_0x280129=_0x280129||0x1f4;return function(_0x479aa7){logger['error'](_0x479aa7['stack']);if(_0x479aa7['name']){delete _0x479aa7['name'];}_0x259b64[_0x47a3('0x1b')](_0x280129)['send'](_0x479aa7);};}exports['show']=function(_0x53e89a,_0x2ab340){var _0x44f679={'raw':![],'where':{'id':_0x53e89a[_0x47a3('0x25')]['id']}},_0x301021={};_0x301021[_0x47a3('0x26')]=_[_0x47a3('0x27')](db[_0x47a3('0x28')]['rawAttributes']);_0x301021[_0x47a3('0x29')]=_[_0x47a3('0x27')](_0x53e89a['query']);_0x301021[_0x47a3('0x2a')]=_['intersection'](_0x301021[_0x47a3('0x26')],_0x301021[_0x47a3('0x29')]);_0x44f679[_0x47a3('0x2b')]=_[_0x47a3('0x2c')](_0x301021[_0x47a3('0x26')],qs['fields'](_0x53e89a[_0x47a3('0x29')][_0x47a3('0x2d')]));_0x44f679[_0x47a3('0x2b')]=_0x44f679['attributes'][_0x47a3('0x2e')]?_0x44f679[_0x47a3('0x2b')]:_0x301021['model'];if(_0x53e89a[_0x47a3('0x29')][_0x47a3('0x2f')]){_0x44f679[_0x47a3('0x30')]=[{'all':!![]}];}_0x44f679=_[_0x47a3('0x31')]({},_0x44f679,_0x53e89a[_0x47a3('0x32')]);return db[_0x47a3('0x28')]['find'](_0x44f679)[_0x47a3('0x24')](handleEntityNotFound(_0x2ab340,null))[_0x47a3('0x24')](respondWithResult(_0x2ab340,null))[_0x47a3('0x33')](handleError(_0x2ab340,null));};exports[_0x47a3('0x34')]=function(_0x19984d,_0x1cdfa8){return db[_0x47a3('0x28')][_0x47a3('0x35')]({'where':{'id':_0x19984d[_0x47a3('0x25')]['id']}})[_0x47a3('0x24')](handleEntityNotFound(_0x1cdfa8,null))['then'](removeEntity(_0x1cdfa8,null))[_0x47a3('0x33')](handleError(_0x1cdfa8,null));};function widgetAttributes(_0x2389c6){try{switch(_0x2389c6[_0x47a3('0x36')]){case _0x47a3('0x37'):return[{'name':'attrUrl','value':_0x2389c6[_0x47a3('0x38')]||(_0x2389c6[_0x47a3('0x39')]&&_0x2389c6['attrs'][0x0]?_0x2389c6['attrs'][0x0][_0x47a3('0x3a')]:undefined)||'https://'}];case _0x47a3('0x3b'):return[{'name':_0x47a3('0x3c'),'value':_0x2389c6[_0x47a3('0x3c')]||(_0x2389c6['attrs']&&_0x2389c6[_0x47a3('0x39')][0x0]?_0x2389c6[_0x47a3('0x39')][0x0][_0x47a3('0x3a')]:undefined)||''}];case'clock':return[{'name':_0x47a3('0x3d'),'value':_0x2389c6['attrHourFormat']||(_0x2389c6[_0x47a3('0x39')]&&_0x2389c6[_0x47a3('0x39')][0x0]?_0x2389c6[_0x47a3('0x39')][0x0][_0x47a3('0x3a')]:undefined)||_0x47a3('0x3e')},{'name':_0x47a3('0x3f'),'value':_0x2389c6[_0x47a3('0x3f')]||(_0x2389c6[_0x47a3('0x39')]&&_0x2389c6[_0x47a3('0x39')][0x1]?_0x2389c6[_0x47a3('0x39')][0x1]['value']:undefined)||_0x47a3('0x40')},{'name':_0x47a3('0x41'),'value':_0x2389c6[_0x47a3('0x41')]||(_0x2389c6[_0x47a3('0x39')]&&_0x2389c6['attrs'][0x2]?_0x2389c6['attrs'][0x2][_0x47a3('0x3a')]:undefined)||0xc}];case _0x47a3('0x42'):return[{'name':_0x47a3('0x43'),'value':_0x2389c6[_0x47a3('0x43')]||(_0x2389c6[_0x47a3('0x39')]&&_0x2389c6[_0x47a3('0x39')][0x0]?_0x2389c6[_0x47a3('0x39')][0x0][_0x47a3('0x3a')]:undefined)||_0x47a3('0x44')},{'name':_0x47a3('0x45'),'value':_0x2389c6['attrVoiceQueues']||(_0x2389c6[_0x47a3('0x39')]&&_0x2389c6[_0x47a3('0x39')][0x1]?_0x2389c6[_0x47a3('0x39')][0x1][_0x47a3('0x3a')]:undefined)||[]},{'name':_0x47a3('0x41'),'value':_0x2389c6[_0x47a3('0x41')]||(_0x2389c6[_0x47a3('0x39')]&&_0x2389c6[_0x47a3('0x39')][0x2]?_0x2389c6[_0x47a3('0x39')][0x2][_0x47a3('0x3a')]:undefined)||0x14}];case'multibar-chart':case _0x47a3('0x46'):return[{'name':_0x47a3('0x47'),'value':_0x2389c6['attrSerie1']||(_0x2389c6['attrs']&&_0x2389c6['attrs'][0x0]?_0x2389c6['attrs'][0x0][_0x47a3('0x3a')]:undefined)||_0x47a3('0x44')},{'name':_0x47a3('0x48'),'value':_0x2389c6[_0x47a3('0x48')]||(_0x2389c6[_0x47a3('0x39')]&&_0x2389c6[_0x47a3('0x39')][0x1]?_0x2389c6[_0x47a3('0x39')][0x1][_0x47a3('0x3a')]:undefined)||null},{'name':'attrSerie3','value':_0x2389c6[_0x47a3('0x49')]||(_0x2389c6[_0x47a3('0x39')]&&_0x2389c6['attrs'][0x2]?_0x2389c6['attrs'][0x2][_0x47a3('0x3a')]:undefined)||null},{'name':_0x47a3('0x45'),'value':_0x2389c6['attrVoiceQueues']||(_0x2389c6[_0x47a3('0x39')]&&_0x2389c6['attrs'][0x3]?_0x2389c6[_0x47a3('0x39')][0x3][_0x47a3('0x3a')]:undefined)||[]}];case'web-report':return[{'name':_0x47a3('0x4a'),'type':_0x2389c6[_0x47a3('0x4b')]||(_0x2389c6[_0x47a3('0x39')]&&_0x2389c6[_0x47a3('0x39')][0x0]?_0x2389c6[_0x47a3('0x39')][0x0][_0x47a3('0x36')]:undefined)||null,'value':_0x2389c6['attrReport']||(_0x2389c6[_0x47a3('0x39')]&&_0x2389c6[_0x47a3('0x39')][0x0]?_0x2389c6['attrs'][0x0][_0x47a3('0x3a')]:undefined)||null},{'name':_0x47a3('0x4c'),'value':_0x2389c6[_0x47a3('0x4c')]||(_0x2389c6['attrs']&&_0x2389c6[_0x47a3('0x39')][0x1]?_0x2389c6['attrs'][0x1][_0x47a3('0x3a')]:undefined)||0x0}];default:return[];}}catch(_0x222e69){logger[_0x47a3('0x4d')](_0x47a3('0x4e'),JSON[_0x47a3('0x4f')](_0x222e69));return[];}}exports[_0x47a3('0x50')]=function(_0x3e475a,_0x597952){if(_0x3e475a[_0x47a3('0x51')]){_0x3e475a[_0x47a3('0x51')][_0x47a3('0x39')]=widgetAttributes(_0x3e475a['body']);}return db[_0x47a3('0x28')][_0x47a3('0x50')](_0x3e475a['body'],{})['then'](respondWithResult(_0x597952,0xc9))[_0x47a3('0x33')](handleError(_0x597952,null));};exports[_0x47a3('0x23')]=function(_0x176db1,_0xfc9fb8){if(_0x176db1[_0x47a3('0x51')]['id']){delete _0x176db1[_0x47a3('0x51')]['id'];}_0x176db1['body'][_0x47a3('0x39')]=widgetAttributes(_0x176db1[_0x47a3('0x51')]);return db[_0x47a3('0x28')][_0x47a3('0x35')]({'where':{'id':_0x176db1['params']['id']}})[_0x47a3('0x24')](handleEntityNotFound(_0xfc9fb8,null))[_0x47a3('0x24')](saveUpdates(_0x176db1['body'],null))[_0x47a3('0x24')](respondWithResult(_0xfc9fb8,null))[_0x47a3('0x33')](handleError(_0xfc9fb8,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 34da916..bc993d5 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 _0x281a=['hasOwnProperty','hook','setMaxListeners','update','emit'];(function(_0x58d523,_0x3359ce){var _0x92d96c=function(_0x8d4222){while(--_0x8d4222){_0x58d523['push'](_0x58d523['shift']());}};_0x92d96c(++_0x3359ce);}(_0x281a,0x160));var _0xa281=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x281a[_0x4a53d];return _0x27410e;};'use strict';var EventEmitter=require('events');var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xa281('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa281('0x1'),'afterDestroy':'remove'};function emitEvent(_0x457b4e){return function(_0x36627b,_0x38dcff,_0x5a336e){DashboardItemEvents[_0xa281('0x2')](_0x457b4e+':'+_0x36627b['id'],_0x36627b);DashboardItemEvents['emit'](_0x457b4e,_0x36627b);_0x5a336e(null);};}for(var e in events){if(events[_0xa281('0x3')](e)){var event=events[e];DashboardItem[_0xa281('0x4')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0xf31f=['save','update','emit','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners'];(function(_0x3e3dcb,_0x547408){var _0x21763f=function(_0x4b2998){while(--_0x4b2998){_0x3e3dcb['push'](_0x3e3dcb['shift']());}};_0x21763f(++_0x547408);}(_0xf31f,0x95));var _0xff31=function(_0x4458d6,_0x57db85){_0x4458d6=_0x4458d6-0x0;var _0x4796bd=_0xf31f[_0x4458d6];return _0x4796bd;};'use strict';var EventEmitter=require(_0xff31('0x0'));var DashboardItem=require(_0xff31('0x1'))['db'][_0xff31('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xff31('0x3')](0x0);var events={'afterCreate':_0xff31('0x4'),'afterUpdate':_0xff31('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2191d9){return function(_0x48038f,_0x25ed47,_0x292026){DashboardItemEvents[_0xff31('0x6')](_0x2191d9+':'+_0x48038f['id'],_0x48038f);DashboardItemEvents[_0xff31('0x6')](_0x2191d9,_0x48038f);_0x292026(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0xff31('0x7')](e,emitEvent(event));}}module[_0xff31('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 639dbb1..e870e88 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 _0xeef0=['define','dashboard_items','lodash','util','../../config/logger','api','request-promise','rimraf','exports'];(function(_0x59db37,_0x14464c){var _0x3a4d97=function(_0x3e1094){while(--_0x3e1094){_0x59db37['push'](_0x59db37['shift']());}};_0x3a4d97(++_0x14464c);}(_0xeef0,0x1c4));var _0x0eef=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0xeef0[_0x4e9d3c];return _0x2d0825;};'use strict';var _=require(_0x0eef('0x0'));var util=require(_0x0eef('0x1'));var logger=require(_0x0eef('0x2'))(_0x0eef('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0eef('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0eef('0x5'));var config=require('../../config/environment');var attributes=require('./dashboardItem.attributes');module[_0x0eef('0x6')]=function(_0x671256,_0x1c86e1){return _0x671256[_0x0eef('0x7')]('DashboardItem',attributes,{'tableName':_0x0eef('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a43=['../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x4794b5,_0x34efd1){var _0x1ff218=function(_0x1dd96f){while(--_0x1dd96f){_0x4794b5['push'](_0x4794b5['shift']());}};_0x1ff218(++_0x34efd1);}(_0x7a43,0x13e));var _0x37a4=function(_0x524ca8,_0x5e1d98){_0x524ca8=_0x524ca8-0x0;var _0x41982c=_0x7a43[_0x524ca8];return _0x41982c;};'use strict';var _=require('lodash');var util=require(_0x37a4('0x0'));var logger=require(_0x37a4('0x1'))(_0x37a4('0x2'));var moment=require(_0x37a4('0x3'));var BPromise=require(_0x37a4('0x4'));var rp=require(_0x37a4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x37a4('0x6'));var config=require(_0x37a4('0x7'));var attributes=require(_0x37a4('0x8'));module[_0x37a4('0x9')]=function(_0x268bbf,_0x10dc66){return _0x268bbf[_0x37a4('0xa')](_0x37a4('0xb'),attributes,{'tableName':_0x37a4('0xc'),'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 6dc45aa..4dba7c6 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 _0xe828=['http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xe828,0xcf));var _0x8e82=function(_0x3d1cd7,_0x233452){_0x3d1cd7=_0x3d1cd7-0x0;var _0x5521ab=_0xe828[_0x3d1cd7];return _0x5521ab;};'use strict';var _=require(_0x8e82('0x0'));var util=require(_0x8e82('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8e82('0x2'));var fs=require('fs');var Redis=require(_0x8e82('0x3'));var db=require(_0x8e82('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8e82('0x5'))('rpc');var config=require(_0x8e82('0x6'));var jayson=require(_0x8e82('0x7'));var client=jayson[_0x8e82('0x8')][_0x8e82('0x9')]({'port':0x232a});config[_0x8e82('0xa')]=_[_0x8e82('0xb')](config[_0x8e82('0xa')],{'host':_0x8e82('0xc'),'port':0x18eb});var socket=require(_0x8e82('0xd'))(new Redis(config[_0x8e82('0xa')]));require(_0x8e82('0xe'))[_0x8e82('0xf')](socket);function respondWithRpcPromise(_0x1c5c4a,_0x229c8a,_0x583a94){return new BPromise(function(_0x595c94,_0x4aa76c){return client[_0x8e82('0x10')](_0x1c5c4a,_0x583a94)[_0x8e82('0x11')](function(_0x160b22){logger['info'](_0x8e82('0x12'),_0x229c8a,_0x8e82('0x13'));logger[_0x8e82('0x14')](_0x8e82('0x15'),_0x229c8a,_0x8e82('0x13'),JSON[_0x8e82('0x16')](_0x160b22));if(_0x160b22['error']){if(_0x160b22[_0x8e82('0x17')][_0x8e82('0x18')]===0x1f4){logger[_0x8e82('0x17')](_0x8e82('0x12'),_0x229c8a,_0x160b22['error'][_0x8e82('0x19')]);return _0x4aa76c(_0x160b22[_0x8e82('0x17')][_0x8e82('0x19')]);}logger['error'](_0x8e82('0x12'),_0x229c8a,_0x160b22[_0x8e82('0x17')][_0x8e82('0x19')]);return _0x595c94(_0x160b22[_0x8e82('0x17')][_0x8e82('0x19')]);}else{logger['info'](_0x8e82('0x12'),_0x229c8a,_0x8e82('0x13'));_0x595c94(_0x160b22[_0x8e82('0x1a')][_0x8e82('0x19')]);}})['catch'](function(_0x2e0c30){logger['error'](_0x8e82('0x12'),_0x229c8a,_0x2e0c30);_0x4aa76c(_0x2e0c30);});});} \ No newline at end of file +var _0x374d=['catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x374d,0x196));var _0xd374=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x374d[_0xbca1b1];return _0x4e1686;};'use strict';var _=require('lodash');var util=require(_0xd374('0x0'));var moment=require('moment');var BPromise=require(_0xd374('0x1'));var rs=require(_0xd374('0x2'));var fs=require('fs');var Redis=require(_0xd374('0x3'));var db=require(_0xd374('0x4'))['db'];var utils=require(_0xd374('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xd374('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd374('0x7')][_0xd374('0x8')]({'port':0x232a});config['redis']=_[_0xd374('0x9')](config[_0xd374('0xa')],{'host':_0xd374('0xb'),'port':0x18eb});var socket=require(_0xd374('0xc'))(new Redis(config[_0xd374('0xa')]));require(_0xd374('0xd'))[_0xd374('0xe')](socket);function respondWithRpcPromise(_0xb2d52,_0x3fc30b,_0xb4e151){return new BPromise(function(_0x2406e3,_0x1142d3){return client[_0xd374('0xf')](_0xb2d52,_0xb4e151)['then'](function(_0x57887c){logger[_0xd374('0x10')](_0xd374('0x11'),_0x3fc30b,'request\x20sent');logger[_0xd374('0x12')](_0xd374('0x13'),_0x3fc30b,_0xd374('0x14'),JSON[_0xd374('0x15')](_0x57887c));if(_0x57887c[_0xd374('0x16')]){if(_0x57887c[_0xd374('0x16')][_0xd374('0x17')]===0x1f4){logger[_0xd374('0x16')](_0xd374('0x11'),_0x3fc30b,_0x57887c[_0xd374('0x16')][_0xd374('0x18')]);return _0x1142d3(_0x57887c[_0xd374('0x16')]['message']);}logger['error'](_0xd374('0x11'),_0x3fc30b,_0x57887c[_0xd374('0x16')][_0xd374('0x18')]);return _0x2406e3(_0x57887c['error']['message']);}else{logger[_0xd374('0x10')](_0xd374('0x11'),_0x3fc30b,_0xd374('0x14'));_0x2406e3(_0x57887c[_0xd374('0x19')][_0xd374('0x18')]);}})[_0xd374('0x1a')](function(_0x288446){logger[_0xd374('0x16')](_0xd374('0x11'),_0x3fc30b,_0x288446);_0x1142d3(_0x288446);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index c43bfc3..e4335a0 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 _0xa870=['save','remove','update','emit','removeListener','length','dashboardItem:','./dashboardItem.events'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xa870,0xdf));var _0x0a87=function(_0x3d35ba,_0x12f690){_0x3d35ba=_0x3d35ba-0x0;var _0x2b1edf=_0xa870[_0x3d35ba];return _0x2b1edf;};'use strict';var DashboardItemEvents=require(_0x0a87('0x0'));var events=[_0x0a87('0x1'),_0x0a87('0x2'),_0x0a87('0x3')];function createListener(_0x460129,_0x3503ca){return function(_0x360840){_0x3503ca[_0x0a87('0x4')](_0x460129,_0x360840);};}function removeListener(_0x359e3c,_0x3a3574){return function(){DashboardItemEvents[_0x0a87('0x5')](_0x359e3c,_0x3a3574);};}exports['register']=function(_0x54ad0c){for(var _0x49741b=0x0,_0x12c9e6=events[_0x0a87('0x6')];_0x49741b<_0x12c9e6;_0x49741b++){var _0x4a0ba4=events[_0x49741b];var _0xef1bad=createListener(_0x0a87('0x7')+_0x4a0ba4,_0x54ad0c);DashboardItemEvents['on'](_0x4a0ba4,_0xef1bad);}}; \ No newline at end of file +var _0xd497=['length','dashboardItem:','./dashboardItem.events','save','removeListener','register'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xd497,0x122));var _0x7d49=function(_0x3b13cb,_0x2495a8){_0x3b13cb=_0x3b13cb-0x0;var _0x99167c=_0xd497[_0x3b13cb];return _0x99167c;};'use strict';var DashboardItemEvents=require(_0x7d49('0x0'));var events=[_0x7d49('0x1'),'remove','update'];function createListener(_0x19f201,_0x1382c9){return function(_0x54cbdb){_0x1382c9['emit'](_0x19f201,_0x54cbdb);};}function removeListener(_0x24b230,_0xca79fa){return function(){DashboardItemEvents[_0x7d49('0x2')](_0x24b230,_0xca79fa);};}exports[_0x7d49('0x3')]=function(_0x3991fc){for(var _0x4baf87=0x0,_0x46f0b4=events[_0x7d49('0x4')];_0x4baf87<_0x46f0b4;_0x4baf87++){var _0x35f1b7=events[_0x4baf87];var _0x209dfd=createListener(_0x7d49('0x5')+_0x35f1b7,_0x3991fc);DashboardItemEvents['on'](_0x35f1b7,_0x209dfd);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 0f0fb57..188d59d 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 _0x1bd1=['put','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','create'];(function(_0x52d2b8,_0x5723e1){var _0xd63311=function(_0xf1b9bc){while(--_0xf1b9bc){_0x52d2b8['push'](_0x52d2b8['shift']());}};_0xd63311(++_0x5723e1);}(_0x1bd1,0x1be));var _0x11bd=function(_0x1f5d35,_0x13db91){_0x1f5d35=_0x1f5d35-0x0;var _0x27355a=_0x1bd1[_0x1f5d35];return _0x27355a;};'use strict';var multer=require(_0x11bd('0x0'));var util=require('util');var path=require(_0x11bd('0x1'));var timeout=require('connect-timeout');var express=require(_0x11bd('0x2'));var router=express[_0x11bd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x11bd('0x4'));var interaction=require(_0x11bd('0x5'));var config=require(_0x11bd('0x6'));var controller=require('./dashboardItem.controller');router[_0x11bd('0x7')](_0x11bd('0x8'),auth[_0x11bd('0x9')](),controller[_0x11bd('0xa')]);router[_0x11bd('0xb')]('/',auth[_0x11bd('0x9')](),controller[_0x11bd('0xc')]);router[_0x11bd('0xd')](_0x11bd('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x11bd('0xe')](_0x11bd('0x8'),auth[_0x11bd('0x9')](),controller[_0x11bd('0xf')]);module[_0x11bd('0x10')]=router; \ No newline at end of file +var _0x9372=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','post','create'];(function(_0x1867d9,_0x41e057){var _0x181d2d=function(_0x20978d){while(--_0x20978d){_0x1867d9['push'](_0x1867d9['shift']());}};_0x181d2d(++_0x41e057);}(_0x9372,0x195));var _0x2937=function(_0x2253f1,_0x5a92a7){_0x2253f1=_0x2253f1-0x0;var _0x49aca7=_0x9372[_0x2253f1];return _0x49aca7;};'use strict';var multer=require(_0x2937('0x0'));var util=require(_0x2937('0x1'));var path=require(_0x2937('0x2'));var timeout=require(_0x2937('0x3'));var express=require(_0x2937('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2937('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2937('0x6'));var controller=require('./dashboardItem.controller');router[_0x2937('0x7')]('/:id',auth[_0x2937('0x8')](),controller['show']);router[_0x2937('0x9')]('/',auth[_0x2937('0x8')](),controller[_0x2937('0xa')]);router['put'](_0x2937('0xb'),auth['isAuthenticated'](),controller[_0x2937('0xc')]);router[_0x2937('0xd')](_0x2937('0xb'),auth[_0x2937('0x8')](),controller[_0x2937('0xe')]);module[_0x2937('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 8449272..f85cfc1 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 _0xbcef=['third','sequelize','exports','STRING','ENUM','first','second'];(function(_0x106cfa,_0x4c0898){var _0x2b6a81=function(_0xa3df00){while(--_0xa3df00){_0x106cfa['push'](_0x106cfa['shift']());}};_0x2b6a81(++_0x4c0898);}(_0xbcef,0x1f2));var _0xfbce=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbcef[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0xfbce('0x0'));module[_0xfbce('0x1')]={'name':{'type':Sequelize[_0xfbce('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xfbce('0x3')](_0xfbce('0x4'),_0xfbce('0x5'),_0xfbce('0x6')),'allowNull':![],'defaultValue':_0xfbce('0x4')},'description':{'type':Sequelize[_0xfbce('0x2')]}}; \ No newline at end of file +var _0xf438=['second','third','sequelize','exports','STRING','ENUM','first'];(function(_0x3c32e1,_0x305f8b){var _0x362ad9=function(_0x3ae3bf){while(--_0x3ae3bf){_0x3c32e1['push'](_0x3c32e1['shift']());}};_0x362ad9(++_0x305f8b);}(_0xf438,0x12f));var _0x8f43=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xf438[_0x2e4aa2];return _0x5e6092;};'use strict';var Sequelize=require(_0x8f43('0x0'));module[_0x8f43('0x1')]={'name':{'type':Sequelize[_0x8f43('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x8f43('0x3')](_0x8f43('0x4'),_0x8f43('0x5'),_0x8f43('0x6')),'allowNull':![],'defaultValue':_0x8f43('0x4')},'description':{'type':Sequelize[_0x8f43('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 4ff879d..2f379b0 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 _0xa992=['send','index','map','Disposition','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','rows','params','rawAttributes','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','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','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','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','destroy','get','Dispositions','UserProfileResource','then','error','stack','name'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xa992,0x18c));var _0x2a99=function(_0x38ce04,_0x3c5383){_0x38ce04=_0x38ce04-0x0;var _0x27eb0d=_0xa992[_0x38ce04];return _0x27eb0d;};'use strict';var emlformat=require(_0x2a99('0x0'));var rimraf=require(_0x2a99('0x1'));var zipdir=require(_0x2a99('0x2'));var jsonpatch=require(_0x2a99('0x3'));var rp=require('request-promise');var moment=require(_0x2a99('0x4'));var BPromise=require(_0x2a99('0x5'));var Mustache=require(_0x2a99('0x6'));var util=require(_0x2a99('0x7'));var path=require(_0x2a99('0x8'));var sox=require(_0x2a99('0x9'));var csv=require(_0x2a99('0xa'));var ejs=require(_0x2a99('0xb'));var fs=require('fs');var fs_extra=require(_0x2a99('0xc'));var _=require(_0x2a99('0xd'));var squel=require('squel');var crypto=require(_0x2a99('0xe'));var jsforce=require(_0x2a99('0xf'));var deskjs=require(_0x2a99('0x10'));var toCsv=require(_0x2a99('0xa'));var querystring=require(_0x2a99('0x11'));var Papa=require(_0x2a99('0x12'));var Redis=require(_0x2a99('0x13'));var authService=require(_0x2a99('0x14'));var qs=require(_0x2a99('0x15'));var as=require(_0x2a99('0x16'));var hardwareService=require(_0x2a99('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x2a99('0x18'));var config=require(_0x2a99('0x19'));var licenseUtil=require(_0x2a99('0x1a'));var db=require(_0x2a99('0x1b'))['db'];function respondWithStatusCode(_0x22e9e2,_0x13e434){_0x13e434=_0x13e434||0xcc;return function(_0x530f6a){if(_0x530f6a){return _0x22e9e2[_0x2a99('0x1c')](_0x13e434);}return _0x22e9e2[_0x2a99('0x1d')](_0x13e434)[_0x2a99('0x1e')]();};}function respondWithResult(_0x2e04f2,_0x2b07a3){_0x2b07a3=_0x2b07a3||0xc8;return function(_0x5f2cfa){if(_0x5f2cfa){return _0x2e04f2[_0x2a99('0x1d')](_0x2b07a3)['json'](_0x5f2cfa);}};}function respondWithFilteredResult(_0x5cbe7b,_0x14528e){return function(_0x271db6){if(_0x271db6){var _0x343ba4=typeof _0x14528e['offset']==='undefined'&&typeof _0x14528e['limit']===_0x2a99('0x1f');var _0x4346c4=_0x271db6['count'];var _0x1819fd=_0x343ba4?0x0:_0x14528e[_0x2a99('0x20')];var _0xbca200=_0x343ba4?_0x271db6[_0x2a99('0x21')]:_0x14528e['offset']+_0x14528e[_0x2a99('0x22')];var _0x410ea7;if(_0xbca200>=_0x4346c4){_0xbca200=_0x4346c4;_0x410ea7=0xc8;}else{_0x410ea7=0xce;}_0x5cbe7b[_0x2a99('0x1d')](_0x410ea7);return _0x5cbe7b[_0x2a99('0x23')](_0x2a99('0x24'),_0x1819fd+'-'+_0xbca200+'/'+_0x4346c4)['json'](_0x271db6);}return null;};}function patchUpdates(_0x24fcbf){return function(_0x281efc){try{jsonpatch[_0x2a99('0x25')](_0x281efc,_0x24fcbf,!![]);}catch(_0x35fddf){return BPromise[_0x2a99('0x26')](_0x35fddf);}return _0x281efc[_0x2a99('0x27')]();};}function saveUpdates(_0x3dc468,_0x36aa21){return function(_0x3541fc){if(_0x3541fc){return _0x3541fc[_0x2a99('0x28')](_0x3dc468)['then'](function(_0x1109cd){return _0x1109cd;});}return null;};}function removeEntity(_0x4e715c,_0x5a0964){return function(_0x48c611){if(_0x48c611){return _0x48c611[_0x2a99('0x29')]()['then'](function(){var _0x4bb142=_0x48c611[_0x2a99('0x2a')]({'plain':!![]});var _0x5ec334=_0x2a99('0x2b');return db[_0x2a99('0x2c')][_0x2a99('0x29')]({'where':{'type':_0x5ec334,'resourceId':_0x4bb142['id']}})[_0x2a99('0x2d')](function(){return _0x48c611;});})[_0x2a99('0x2d')](function(){_0x4e715c[_0x2a99('0x1d')](0xcc)[_0x2a99('0x1e')]();});}};}function handleEntityNotFound(_0x3485c8,_0x2b5d97){return function(_0x2f0bf0){if(!_0x2f0bf0){_0x3485c8['sendStatus'](0x194);}return _0x2f0bf0;};}function handleError(_0x47736f,_0x4271b4){_0x4271b4=_0x4271b4||0x1f4;return function(_0x5ad092){logger[_0x2a99('0x2e')](_0x5ad092[_0x2a99('0x2f')]);if(_0x5ad092[_0x2a99('0x30')]){delete _0x5ad092['name'];}_0x47736f[_0x2a99('0x1d')](_0x4271b4)[_0x2a99('0x31')](_0x5ad092);};}exports[_0x2a99('0x32')]=function(_0x30f087,_0x5ea029){var _0x24dc9f={},_0x1dbffa={},_0x4864b6={'count':0x0,'rows':[]};var _0x153a3e=_[_0x2a99('0x33')](db[_0x2a99('0x34')]['rawAttributes'],function(_0x1a45d4){return{'name':_0x1a45d4[_0x2a99('0x35')],'type':_0x1a45d4[_0x2a99('0x36')][_0x2a99('0x37')]};});_0x1dbffa[_0x2a99('0x38')]=_['map'](_0x153a3e,_0x2a99('0x30'));_0x1dbffa['query']=_[_0x2a99('0x39')](_0x30f087[_0x2a99('0x3a')]);_0x1dbffa[_0x2a99('0x3b')]=_[_0x2a99('0x3c')](_0x1dbffa[_0x2a99('0x38')],_0x1dbffa[_0x2a99('0x3a')]);_0x24dc9f[_0x2a99('0x3d')]=_[_0x2a99('0x3c')](_0x1dbffa[_0x2a99('0x38')],qs[_0x2a99('0x3e')](_0x30f087[_0x2a99('0x3a')]['fields']));_0x24dc9f[_0x2a99('0x3d')]=_0x24dc9f[_0x2a99('0x3d')][_0x2a99('0x3f')]?_0x24dc9f[_0x2a99('0x3d')]:_0x1dbffa[_0x2a99('0x38')];if(!_0x30f087[_0x2a99('0x3a')][_0x2a99('0x40')](_0x2a99('0x41'))){_0x24dc9f[_0x2a99('0x22')]=qs[_0x2a99('0x22')](_0x30f087['query']['limit']);_0x24dc9f['offset']=qs[_0x2a99('0x20')](_0x30f087[_0x2a99('0x3a')][_0x2a99('0x20')]);}_0x24dc9f[_0x2a99('0x42')]=qs[_0x2a99('0x43')](_0x30f087[_0x2a99('0x3a')][_0x2a99('0x43')]);_0x24dc9f['where']=qs[_0x2a99('0x3b')](_['pick'](_0x30f087['query'],_0x1dbffa[_0x2a99('0x3b')]),_0x153a3e);if(_0x30f087[_0x2a99('0x3a')][_0x2a99('0x44')]){_0x24dc9f[_0x2a99('0x45')]=_[_0x2a99('0x46')](_0x24dc9f[_0x2a99('0x45')],{'$or':_[_0x2a99('0x33')](_0x153a3e,function(_0x26b186){if(_0x26b186[_0x2a99('0x36')]!==_0x2a99('0x47')){var _0x93025a={};_0x93025a[_0x26b186[_0x2a99('0x30')]]={'$like':'%'+_0x30f087[_0x2a99('0x3a')]['filter']+'%'};return _0x93025a;}})});}_0x24dc9f=_[_0x2a99('0x46')]({},_0x24dc9f,_0x30f087[_0x2a99('0x48')]);var _0x529822={'where':_0x24dc9f[_0x2a99('0x45')]};return db[_0x2a99('0x34')][_0x2a99('0x21')](_0x529822)[_0x2a99('0x2d')](function(_0x3e9348){_0x4864b6['count']=_0x3e9348;if(_0x30f087[_0x2a99('0x3a')][_0x2a99('0x49')]){_0x24dc9f[_0x2a99('0x4a')]=[{'all':!![]}];}return db[_0x2a99('0x34')]['findAll'](_0x24dc9f);})[_0x2a99('0x2d')](function(_0x26db27){_0x4864b6[_0x2a99('0x4b')]=_0x26db27;return _0x4864b6;})[_0x2a99('0x2d')](respondWithFilteredResult(_0x5ea029,_0x24dc9f))['catch'](handleError(_0x5ea029,null));};exports['show']=function(_0x5386db,_0x3f1682){var _0x50c82d={'raw':!![],'where':{'id':_0x5386db[_0x2a99('0x4c')]['id']}},_0x324f98={};_0x324f98['model']=_[_0x2a99('0x39')](db['Disposition'][_0x2a99('0x4d')]);_0x324f98[_0x2a99('0x3a')]=_[_0x2a99('0x39')](_0x5386db['query']);_0x324f98[_0x2a99('0x3b')]=_['intersection'](_0x324f98['model'],_0x324f98[_0x2a99('0x3a')]);_0x50c82d[_0x2a99('0x3d')]=_[_0x2a99('0x3c')](_0x324f98[_0x2a99('0x38')],qs[_0x2a99('0x3e')](_0x5386db[_0x2a99('0x3a')]['fields']));_0x50c82d[_0x2a99('0x3d')]=_0x50c82d[_0x2a99('0x3d')][_0x2a99('0x3f')]?_0x50c82d[_0x2a99('0x3d')]:_0x324f98['model'];if(_0x5386db['query'][_0x2a99('0x49')]){_0x50c82d[_0x2a99('0x4a')]=[{'all':!![]}];}_0x50c82d=_[_0x2a99('0x46')]({},_0x50c82d,_0x5386db[_0x2a99('0x48')]);return db[_0x2a99('0x34')]['find'](_0x50c82d)[_0x2a99('0x2d')](handleEntityNotFound(_0x3f1682,null))[_0x2a99('0x2d')](respondWithResult(_0x3f1682,null))[_0x2a99('0x4e')](handleError(_0x3f1682,null));};exports[_0x2a99('0x4f')]=function(_0x310042,_0x164bca){return db[_0x2a99('0x34')][_0x2a99('0x4f')](_0x310042['body'],{})['then'](function(_0x100338){var _0x135d89=_0x310042[_0x2a99('0x50')][_0x2a99('0x2a')]({'plain':!![]});if(!_0x135d89)throw new Error(_0x2a99('0x51'));if(_0x135d89[_0x2a99('0x52')]===_0x2a99('0x50')){var _0x5ae31d=_0x100338[_0x2a99('0x2a')]({'plain':!![]});var _0x496f0a=_0x2a99('0x2b');return db[_0x2a99('0x53')]['find']({'where':{'name':_0x496f0a,'userProfileId':_0x135d89[_0x2a99('0x54')]},'raw':!![]})['then'](function(_0x4bb119){if(_0x4bb119&&_0x4bb119[_0x2a99('0x55')]===0x0){return db['UserProfileResource'][_0x2a99('0x4f')]({'name':_0x5ae31d['name'],'resourceId':_0x5ae31d['id'],'type':_0x4bb119[_0x2a99('0x30')],'sectionId':_0x4bb119['id']},{})['then'](function(){return _0x100338;});}else{return _0x100338;}})[_0x2a99('0x4e')](function(_0x3b150a){logger[_0x2a99('0x2e')](_0x2a99('0x56'),_0x3b150a);throw _0x3b150a;});}return _0x100338;})[_0x2a99('0x2d')](respondWithResult(_0x164bca,0xc9))[_0x2a99('0x4e')](handleError(_0x164bca,null));};exports['update']=function(_0xa5c4c5,_0x2a53f0){if(_0xa5c4c5['body']['id']){delete _0xa5c4c5['body']['id'];}return db['Disposition'][_0x2a99('0x57')]({'where':{'id':_0xa5c4c5['params']['id']}})[_0x2a99('0x2d')](handleEntityNotFound(_0x2a53f0,null))['then'](saveUpdates(_0xa5c4c5[_0x2a99('0x58')],null))[_0x2a99('0x2d')](respondWithResult(_0x2a53f0,null))[_0x2a99('0x4e')](handleError(_0x2a53f0,null));};exports[_0x2a99('0x29')]=function(_0x2f2745,_0x111e29){return db['Disposition']['find']({'where':{'id':_0x2f2745[_0x2a99('0x4c')]['id']}})[_0x2a99('0x2d')](handleEntityNotFound(_0x111e29,null))[_0x2a99('0x2d')](removeEntity(_0x111e29,null))[_0x2a99('0x4e')](handleError(_0x111e29,null));}; \ No newline at end of file +var _0xe52b=['ioredis','../../components/auth/service','../../components/parsers/qs','../../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','then','destroy','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','type','VIRTUAL','includeAll','Disposition','rows','catch','show','params','keys','include','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Dispositions','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','fs-extra','lodash','squel','crypto','papaparse'];(function(_0x89ede1,_0x1dc8d5){var _0x56500a=function(_0x364988){while(--_0x364988){_0x89ede1['push'](_0x89ede1['shift']());}};_0x56500a(++_0x1dc8d5);}(_0xe52b,0x132));var _0xbe52=function(_0x59a482,_0x283736){_0x59a482=_0x59a482-0x0;var _0x535530=_0xe52b[_0x59a482];return _0x535530;};'use strict';var emlformat=require(_0xbe52('0x0'));var rimraf=require(_0xbe52('0x1'));var zipdir=require(_0xbe52('0x2'));var jsonpatch=require(_0xbe52('0x3'));var rp=require(_0xbe52('0x4'));var moment=require(_0xbe52('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xbe52('0x6'));var sox=require(_0xbe52('0x7'));var csv=require(_0xbe52('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbe52('0x9'));var _=require(_0xbe52('0xa'));var squel=require(_0xbe52('0xb'));var crypto=require(_0xbe52('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbe52('0x8'));var querystring=require('querystring');var Papa=require(_0xbe52('0xd'));var Redis=require(_0xbe52('0xe'));var authService=require(_0xbe52('0xf'));var qs=require(_0xbe52('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbe52('0x11'))(_0xbe52('0x12'));var utils=require(_0xbe52('0x13'));var config=require(_0xbe52('0x14'));var licenseUtil=require(_0xbe52('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe3f223,_0x3f5bf3){_0x3f5bf3=_0x3f5bf3||0xcc;return function(_0x1990e4){if(_0x1990e4){return _0xe3f223[_0xbe52('0x16')](_0x3f5bf3);}return _0xe3f223[_0xbe52('0x17')](_0x3f5bf3)[_0xbe52('0x18')]();};}function respondWithResult(_0x6f5ef3,_0x563fc5){_0x563fc5=_0x563fc5||0xc8;return function(_0x15bf31){if(_0x15bf31){return _0x6f5ef3[_0xbe52('0x17')](_0x563fc5)[_0xbe52('0x19')](_0x15bf31);}};}function respondWithFilteredResult(_0x4aa829,_0x5bb87c){return function(_0x3be085){if(_0x3be085){var _0x337030=typeof _0x5bb87c[_0xbe52('0x1a')]===_0xbe52('0x1b')&&typeof _0x5bb87c[_0xbe52('0x1c')]==='undefined';var _0x138312=_0x3be085[_0xbe52('0x1d')];var _0x5b655b=_0x337030?0x0:_0x5bb87c[_0xbe52('0x1a')];var _0x5035bf=_0x337030?_0x3be085[_0xbe52('0x1d')]:_0x5bb87c[_0xbe52('0x1a')]+_0x5bb87c['limit'];var _0x41b8eb;if(_0x5035bf>=_0x138312){_0x5035bf=_0x138312;_0x41b8eb=0xc8;}else{_0x41b8eb=0xce;}_0x4aa829[_0xbe52('0x17')](_0x41b8eb);return _0x4aa829[_0xbe52('0x1e')](_0xbe52('0x1f'),_0x5b655b+'-'+_0x5035bf+'/'+_0x138312)[_0xbe52('0x19')](_0x3be085);}return null;};}function patchUpdates(_0x386a59){return function(_0x320ea1){try{jsonpatch[_0xbe52('0x20')](_0x320ea1,_0x386a59,!![]);}catch(_0x2cf6ad){return BPromise[_0xbe52('0x21')](_0x2cf6ad);}return _0x320ea1[_0xbe52('0x22')]();};}function saveUpdates(_0x591510,_0x21e221){return function(_0x22fce5){if(_0x22fce5){return _0x22fce5[_0xbe52('0x23')](_0x591510)[_0xbe52('0x24')](function(_0x47d13c){return _0x47d13c;});}return null;};}function removeEntity(_0xe70f9a,_0x376220){return function(_0x11ce95){if(_0x11ce95){return _0x11ce95[_0xbe52('0x25')]()[_0xbe52('0x24')](function(){var _0x4b65ca=_0x11ce95['get']({'plain':!![]});var _0x3dd1a3='Dispositions';return db[_0xbe52('0x26')]['destroy']({'where':{'type':_0x3dd1a3,'resourceId':_0x4b65ca['id']}})['then'](function(){return _0x11ce95;});})[_0xbe52('0x24')](function(){_0xe70f9a['status'](0xcc)[_0xbe52('0x18')]();});}};}function handleEntityNotFound(_0x4f82ef,_0x59ac8c){return function(_0x209cea){if(!_0x209cea){_0x4f82ef[_0xbe52('0x16')](0x194);}return _0x209cea;};}function handleError(_0x377b4a,_0x221b9f){_0x221b9f=_0x221b9f||0x1f4;return function(_0x56da5c){logger[_0xbe52('0x27')](_0x56da5c[_0xbe52('0x28')]);if(_0x56da5c[_0xbe52('0x29')]){delete _0x56da5c[_0xbe52('0x29')];}_0x377b4a['status'](_0x221b9f)[_0xbe52('0x2a')](_0x56da5c);};}exports['index']=function(_0x4401d5,_0x4bd5a9){var _0x21205b={},_0xcd45b5={},_0x2eca91={'count':0x0,'rows':[]};var _0x930820=_[_0xbe52('0x2b')](db['Disposition'][_0xbe52('0x2c')],function(_0x237854){return{'name':_0x237854[_0xbe52('0x2d')],'type':_0x237854['type']['key']};});_0xcd45b5['model']=_[_0xbe52('0x2b')](_0x930820,_0xbe52('0x29'));_0xcd45b5['query']=_['keys'](_0x4401d5[_0xbe52('0x2e')]);_0xcd45b5[_0xbe52('0x2f')]=_[_0xbe52('0x30')](_0xcd45b5[_0xbe52('0x31')],_0xcd45b5[_0xbe52('0x2e')]);_0x21205b[_0xbe52('0x32')]=_[_0xbe52('0x30')](_0xcd45b5[_0xbe52('0x31')],qs[_0xbe52('0x33')](_0x4401d5[_0xbe52('0x2e')][_0xbe52('0x33')]));_0x21205b[_0xbe52('0x32')]=_0x21205b['attributes'][_0xbe52('0x34')]?_0x21205b['attributes']:_0xcd45b5[_0xbe52('0x31')];if(!_0x4401d5[_0xbe52('0x2e')][_0xbe52('0x35')](_0xbe52('0x36'))){_0x21205b['limit']=qs[_0xbe52('0x1c')](_0x4401d5[_0xbe52('0x2e')]['limit']);_0x21205b[_0xbe52('0x1a')]=qs[_0xbe52('0x1a')](_0x4401d5['query'][_0xbe52('0x1a')]);}_0x21205b[_0xbe52('0x37')]=qs['sort'](_0x4401d5['query']['sort']);_0x21205b[_0xbe52('0x38')]=qs[_0xbe52('0x2f')](_['pick'](_0x4401d5[_0xbe52('0x2e')],_0xcd45b5[_0xbe52('0x2f')]),_0x930820);if(_0x4401d5['query'][_0xbe52('0x39')]){_0x21205b[_0xbe52('0x38')]=_[_0xbe52('0x3a')](_0x21205b[_0xbe52('0x38')],{'$or':_[_0xbe52('0x2b')](_0x930820,function(_0x1dec1e){if(_0x1dec1e[_0xbe52('0x3b')]!==_0xbe52('0x3c')){var _0x4f0e68={};_0x4f0e68[_0x1dec1e[_0xbe52('0x29')]]={'$like':'%'+_0x4401d5['query']['filter']+'%'};return _0x4f0e68;}})});}_0x21205b=_[_0xbe52('0x3a')]({},_0x21205b,_0x4401d5['options']);var _0x1976ad={'where':_0x21205b[_0xbe52('0x38')]};return db['Disposition']['count'](_0x1976ad)[_0xbe52('0x24')](function(_0x3ea9f4){_0x2eca91[_0xbe52('0x1d')]=_0x3ea9f4;if(_0x4401d5[_0xbe52('0x2e')][_0xbe52('0x3d')]){_0x21205b['include']=[{'all':!![]}];}return db[_0xbe52('0x3e')]['findAll'](_0x21205b);})[_0xbe52('0x24')](function(_0x45f712){_0x2eca91[_0xbe52('0x3f')]=_0x45f712;return _0x2eca91;})[_0xbe52('0x24')](respondWithFilteredResult(_0x4bd5a9,_0x21205b))[_0xbe52('0x40')](handleError(_0x4bd5a9,null));};exports[_0xbe52('0x41')]=function(_0x1bbb18,_0x2e6271){var _0x5f3a3c={'raw':!![],'where':{'id':_0x1bbb18[_0xbe52('0x42')]['id']}},_0x2a6470={};_0x2a6470[_0xbe52('0x31')]=_[_0xbe52('0x43')](db[_0xbe52('0x3e')][_0xbe52('0x2c')]);_0x2a6470[_0xbe52('0x2e')]=_['keys'](_0x1bbb18['query']);_0x2a6470['filters']=_['intersection'](_0x2a6470['model'],_0x2a6470['query']);_0x5f3a3c['attributes']=_[_0xbe52('0x30')](_0x2a6470[_0xbe52('0x31')],qs[_0xbe52('0x33')](_0x1bbb18[_0xbe52('0x2e')][_0xbe52('0x33')]));_0x5f3a3c[_0xbe52('0x32')]=_0x5f3a3c['attributes'][_0xbe52('0x34')]?_0x5f3a3c['attributes']:_0x2a6470[_0xbe52('0x31')];if(_0x1bbb18['query'][_0xbe52('0x3d')]){_0x5f3a3c[_0xbe52('0x44')]=[{'all':!![]}];}_0x5f3a3c=_['merge']({},_0x5f3a3c,_0x1bbb18['options']);return db['Disposition']['find'](_0x5f3a3c)['then'](handleEntityNotFound(_0x2e6271,null))[_0xbe52('0x24')](respondWithResult(_0x2e6271,null))[_0xbe52('0x40')](handleError(_0x2e6271,null));};exports[_0xbe52('0x45')]=function(_0x19237e,_0x111206){return db[_0xbe52('0x3e')][_0xbe52('0x45')](_0x19237e['body'],{})[_0xbe52('0x24')](function(_0xbb4f66){var _0x1d8a30=_0x19237e[_0xbe52('0x46')][_0xbe52('0x47')]({'plain':!![]});if(!_0x1d8a30)throw new Error(_0xbe52('0x48'));if(_0x1d8a30['role']===_0xbe52('0x46')){var _0x1b3c43=_0xbb4f66['get']({'plain':!![]});var _0x201e4c=_0xbe52('0x49');return db[_0xbe52('0x4a')][_0xbe52('0x4b')]({'where':{'name':_0x201e4c,'userProfileId':_0x1d8a30[_0xbe52('0x4c')]},'raw':!![]})[_0xbe52('0x24')](function(_0x1b2719){if(_0x1b2719&&_0x1b2719[_0xbe52('0x4d')]===0x0){return db[_0xbe52('0x26')][_0xbe52('0x45')]({'name':_0x1b3c43['name'],'resourceId':_0x1b3c43['id'],'type':_0x1b2719[_0xbe52('0x29')],'sectionId':_0x1b2719['id']},{})[_0xbe52('0x24')](function(){return _0xbb4f66;});}else{return _0xbb4f66;}})[_0xbe52('0x40')](function(_0x115fb4){logger['error'](_0xbe52('0x4e'),_0x115fb4);throw _0x115fb4;});}return _0xbb4f66;})['then'](respondWithResult(_0x111206,0xc9))[_0xbe52('0x40')](handleError(_0x111206,null));};exports[_0xbe52('0x23')]=function(_0xf91462,_0x2775ec){if(_0xf91462[_0xbe52('0x4f')]['id']){delete _0xf91462[_0xbe52('0x4f')]['id'];}return db['Disposition'][_0xbe52('0x4b')]({'where':{'id':_0xf91462[_0xbe52('0x42')]['id']}})['then'](handleEntityNotFound(_0x2775ec,null))[_0xbe52('0x24')](saveUpdates(_0xf91462['body'],null))[_0xbe52('0x24')](respondWithResult(_0x2775ec,null))[_0xbe52('0x40')](handleError(_0x2775ec,null));};exports['destroy']=function(_0x4e3acf,_0xbba2d){return db[_0xbe52('0x3e')]['find']({'where':{'id':_0x4e3acf[_0xbe52('0x42')]['id']}})[_0xbe52('0x24')](handleEntityNotFound(_0xbba2d,null))[_0xbe52('0x24')](removeEntity(_0xbba2d,null))[_0xbe52('0x40')](handleError(_0xbba2d,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 1c25649..83b5d1a 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 _0x4e8e=['name','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','Disposition','tools_dispositions','name_chat'];(function(_0x2f5a22,_0x5e9f03){var _0x326b70=function(_0x1b7bf9){while(--_0x1b7bf9){_0x2f5a22['push'](_0x2f5a22['shift']());}};_0x326b70(++_0x5e9f03);}(_0x4e8e,0xca));var _0xe4e8=function(_0x1e1a63,_0x2f2793){_0x1e1a63=_0x1e1a63-0x0;var _0xb4deb0=_0x4e8e[_0x1e1a63];return _0xb4deb0;};'use strict';var _=require(_0xe4e8('0x0'));var util=require(_0xe4e8('0x1'));var logger=require(_0xe4e8('0x2'))(_0xe4e8('0x3'));var moment=require(_0xe4e8('0x4'));var BPromise=require('bluebird');var rp=require(_0xe4e8('0x5'));var fs=require('fs');var path=require(_0xe4e8('0x6'));var rimraf=require(_0xe4e8('0x7'));var config=require(_0xe4e8('0x8'));var attributes=require(_0xe4e8('0x9'));module[_0xe4e8('0xa')]=function(_0x594b9a,_0x5db0bb){return _0x594b9a['define'](_0xe4e8('0xb'),attributes,{'tableName':_0xe4e8('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':['name','ListId']},{'unique':!![],'name':_0xe4e8('0xd'),'fields':[_0xe4e8('0xe'),'ChatWebsiteId']},{'unique':!![],'name':_0xe4e8('0xf'),'fields':['name',_0xe4e8('0x10')]},{'unique':!![],'name':_0xe4e8('0x11'),'fields':[_0xe4e8('0xe'),_0xe4e8('0x12')]},{'unique':!![],'name':_0xe4e8('0x13'),'fields':['name',_0xe4e8('0x14')]},{'unique':!![],'name':_0xe4e8('0x15'),'fields':['name',_0xe4e8('0x16')]},{'unique':!![],'name':_0xe4e8('0x17'),'fields':['name','WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd64a=['name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','Disposition','tools_dispositions','name_voice','name','ListId'];(function(_0x3c2572,_0x560fed){var _0x49860a=function(_0x10508b){while(--_0x10508b){_0x3c2572['push'](_0x3c2572['shift']());}};_0x49860a(++_0x560fed);}(_0xd64a,0x1e8));var _0xad64=function(_0x5ba9a4,_0x27821b){_0x5ba9a4=_0x5ba9a4-0x0;var _0x362b5d=_0xd64a[_0x5ba9a4];return _0x362b5d;};'use strict';var _=require(_0xad64('0x0'));var util=require(_0xad64('0x1'));var logger=require(_0xad64('0x2'))(_0xad64('0x3'));var moment=require(_0xad64('0x4'));var BPromise=require(_0xad64('0x5'));var rp=require(_0xad64('0x6'));var fs=require('fs');var path=require(_0xad64('0x7'));var rimraf=require(_0xad64('0x8'));var config=require('../../config/environment');var attributes=require('./disposition.attributes');module[_0xad64('0x9')]=function(_0x5010a4,_0x85fc4d){return _0x5010a4[_0xad64('0xa')](_0xad64('0xb'),attributes,{'tableName':_0xad64('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xad64('0xd'),'fields':[_0xad64('0xe'),_0xad64('0xf')]},{'unique':!![],'name':_0xad64('0x10'),'fields':[_0xad64('0xe'),_0xad64('0x11')]},{'unique':!![],'name':_0xad64('0x12'),'fields':['name',_0xad64('0x13')]},{'unique':!![],'name':_0xad64('0x14'),'fields':[_0xad64('0xe'),_0xad64('0x15')]},{'unique':!![],'name':_0xad64('0x16'),'fields':['name',_0xad64('0x17')]},{'unique':!![],'name':_0xad64('0x18'),'fields':[_0xad64('0xe'),_0xad64('0x19')]},{'unique':!![],'name':_0xad64('0x1a'),'fields':[_0xad64('0xe'),_0xad64('0x1b')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 7f04869..822507e 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(_0x4df7ff,_0x4f34ed){var _0x387ad6=function(_0x43cfe0){while(--_0x43cfe0){_0x4df7ff['push'](_0x4df7ff['shift']());}};_0x387ad6(++_0x4f34ed);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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(_0x52a454,_0x51add2){var _0xdd253e=function(_0x340980){while(--_0x340980){_0x52a454['push'](_0x52a454['shift']());}};_0xdd253e(++_0x51add2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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 600faeb..060e18a 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 _0x5b41=['create','put','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post'];(function(_0x5d5a41,_0x3c4cd1){var _0x4be05e=function(_0x54ed2b){while(--_0x54ed2b){_0x5d5a41['push'](_0x5d5a41['shift']());}};_0x4be05e(++_0x3c4cd1);}(_0x5b41,0xaa));var _0x15b4=function(_0x239264,_0x340497){_0x239264=_0x239264-0x0;var _0x482244=_0x5b41[_0x239264];return _0x482244;};'use strict';var multer=require(_0x15b4('0x0'));var util=require('util');var path=require(_0x15b4('0x1'));var timeout=require(_0x15b4('0x2'));var express=require('express');var router=express[_0x15b4('0x3')]();var fs_extra=require(_0x15b4('0x4'));var auth=require(_0x15b4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x15b4('0x6'));var controller=require('./disposition.controller');router[_0x15b4('0x7')]('/',auth[_0x15b4('0x8')](),controller['index']);router[_0x15b4('0x7')](_0x15b4('0x9'),auth[_0x15b4('0x8')](),controller[_0x15b4('0xa')]);router[_0x15b4('0xb')]('/',auth[_0x15b4('0x8')](),controller[_0x15b4('0xc')]);router[_0x15b4('0xd')](_0x15b4('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x15b4('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7669=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','path'];(function(_0x4334b8,_0x58e160){var _0x2f1709=function(_0x26c5de){while(--_0x26c5de){_0x4334b8['push'](_0x4334b8['shift']());}};_0x2f1709(++_0x58e160);}(_0x7669,0xd7));var _0x9766=function(_0x557243,_0xb9a9e6){_0x557243=_0x557243-0x0;var _0x2d0f6f=_0x7669[_0x557243];return _0x2d0f6f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9766('0x0'));var timeout=require(_0x9766('0x1'));var express=require(_0x9766('0x2'));var router=express[_0x9766('0x3')]();var fs_extra=require(_0x9766('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9766('0x5'));var config=require(_0x9766('0x6'));var controller=require('./disposition.controller');router[_0x9766('0x7')]('/',auth[_0x9766('0x8')](),controller[_0x9766('0x9')]);router['get'](_0x9766('0xa'),auth[_0x9766('0x8')](),controller['show']);router[_0x9766('0xb')]('/',auth[_0x9766('0x8')](),controller[_0x9766('0xc')]);router[_0x9766('0xd')](_0x9766('0xa'),auth[_0x9766('0x8')](),controller[_0x9766('0xe')]);router[_0x9766('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x9766('0x10')]);module[_0x9766('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index edd7d88..c62377b 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 _0xe3f2=['DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','4800','9600','12000','14400','2400','v17,v27,v29','INTEGER','SIP','IAX'];(function(_0x4a5bdc,_0x3ba456){var _0x17715e=function(_0x2f8687){while(--_0x2f8687){_0x4a5bdc['push'](_0x4a5bdc['shift']());}};_0x17715e(++_0x3ba456);}(_0xe3f2,0x80));var _0x2e3f=function(_0x525cbd,_0x9d5fbe){_0x525cbd=_0x525cbd-0x0;var _0x2f2347=_0xe3f2[_0x525cbd];return _0x2f2347;};'use strict';var Sequelize=require(_0x2e3f('0x0'));module[_0x2e3f('0x1')]={'name':{'type':Sequelize[_0x2e3f('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2e3f('0x2')]},'ecm':{'type':Sequelize[_0x2e3f('0x3')](_0x2e3f('0x4'),'no'),'defaultValue':_0x2e3f('0x4')},'headerinfo':{'type':Sequelize[_0x2e3f('0x2')],'defaultValue':_0x2e3f('0x5')},'localstationid':{'type':Sequelize[_0x2e3f('0x2')],'unique':_0x2e3f('0x6')},'minrate':{'type':Sequelize[_0x2e3f('0x3')]('2400',_0x2e3f('0x7'),'7200',_0x2e3f('0x8'),_0x2e3f('0x9'),_0x2e3f('0xa')),'defaultValue':_0x2e3f('0x7')},'maxrate':{'type':Sequelize[_0x2e3f('0x3')](_0x2e3f('0xb'),_0x2e3f('0x7'),'7200',_0x2e3f('0x8'),'12000',_0x2e3f('0xa')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x2e3f('0x2')],'defaultValue':_0x2e3f('0xc')},'gateway':{'type':Sequelize[_0x2e3f('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x2e3f('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x2e3f('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x2e3f('0x3')](_0x2e3f('0xe'),_0x2e3f('0xf'),_0x2e3f('0x10'),_0x2e3f('0x11')),'defaultValue':_0x2e3f('0xe')},'key':{'type':Sequelize[_0x2e3f('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x2e3f('0x12')],'defaultValue':function(){return _0x2e3f('0x13');}},'notificationSound':{'type':Sequelize[_0x2e3f('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2e3f('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2e3f('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2e3f('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2e3f('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x2e3f('0x15')},'mandatoryDisposition':{'type':Sequelize[_0x2e3f('0x14')],'defaultValue':![],'comment':_0x2e3f('0x16'),'set':function(_0x329177){if(!_0x329177)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0x2e3f('0x17'),_0x329177);}}}; \ No newline at end of file +var _0x093a=['14400','12000','v17,v27,v29','INTEGER','DADHI','KHOMP','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','7200','9600'];(function(_0x22acb7,_0x1a6b06){var _0x295d96=function(_0x4efff2){while(--_0x4efff2){_0x22acb7['push'](_0x22acb7['shift']());}};_0x295d96(++_0x1a6b06);}(_0x093a,0xc5));var _0xa093=function(_0x21cb7f,_0x48cd16){_0x21cb7f=_0x21cb7f-0x0;var _0x5a079a=_0x093a[_0x21cb7f];return _0x5a079a;};'use strict';var Sequelize=require(_0xa093('0x0'));module[_0xa093('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa093('0x2')]},'ecm':{'type':Sequelize[_0xa093('0x3')](_0xa093('0x4'),'no'),'defaultValue':_0xa093('0x4')},'headerinfo':{'type':Sequelize[_0xa093('0x2')],'defaultValue':_0xa093('0x5')},'localstationid':{'type':Sequelize[_0xa093('0x2')],'unique':_0xa093('0x6')},'minrate':{'type':Sequelize[_0xa093('0x3')](_0xa093('0x7'),'4800',_0xa093('0x8'),_0xa093('0x9'),'12000',_0xa093('0xa')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0xa093('0x3')]('2400','4800',_0xa093('0x8'),_0xa093('0x9'),_0xa093('0xb'),'14400'),'defaultValue':_0xa093('0xa')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0xa093('0xc')},'gateway':{'type':Sequelize[_0xa093('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xa093('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xa093('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xa093('0x3')]('SIP','IAX',_0xa093('0xe'),_0xa093('0xf')),'defaultValue':_0xa093('0x10')},'key':{'type':Sequelize[_0xa093('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xa093('0x11')],'defaultValue':function(){return _0xa093('0x12');}},'notificationSound':{'type':Sequelize[_0xa093('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa093('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa093('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa093('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa093('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa093('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa093('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa093('0xd')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xa093('0x14'),'set':function(_0x20267b){if(!_0x20267b)this[_0xa093('0x15')](_0xa093('0x16'),null);this[_0xa093('0x15')]('mandatoryDisposition',_0x20267b);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index ba1a5d8..2d19d21 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 _0xd6fb=['maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','push','/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','addAccountApplications','VoiceExtension','updateAccountApplications','createdAt','updatedAt','TrunkId','ListId','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','Contacts','DESC','attachments','root','server/files/attachments','basename','isNil','from','\x22%s\x22\x20<%s>','fax','CmContact','List\x20not\x20found','out','filename','Contact\x20not\x20found','spread','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','http','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','FaxAccounts','stack','name','send','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','hasOwnProperty','order','sort','where','filter','merge','include','findAll','rows','params','fields','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','getDispositions','findOne','length','nolimit','pick','FaxAccountId','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','app','system','Fax\x20Extension','appdata','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo'];(function(_0x12dd11,_0x52b882){var _0x3a502b=function(_0x1a660d){while(--_0x1a660d){_0x12dd11['push'](_0x12dd11['shift']());}};_0x3a502b(++_0x52b882);}(_0xd6fb,0x1b6));var _0xbd6f=function(_0x31ed50,_0x302724){_0x31ed50=_0x31ed50-0x0;var _0x27ccc3=_0xd6fb[_0x31ed50];return _0x27ccc3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbd6f('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbd6f('0x1'));var moment=require(_0xbd6f('0x2'));var BPromise=require(_0xbd6f('0x3'));var Mustache=require(_0xbd6f('0x4'));var util=require('util');var path=require(_0xbd6f('0x5'));var sox=require(_0xbd6f('0x6'));var csv=require('to-csv');var ejs=require(_0xbd6f('0x7'));var fs=require('fs');var fs_extra=require(_0xbd6f('0x8'));var _=require(_0xbd6f('0x9'));var squel=require('squel');var crypto=require(_0xbd6f('0xa'));var jsforce=require(_0xbd6f('0xb'));var deskjs=require(_0xbd6f('0xc'));var toCsv=require(_0xbd6f('0xd'));var querystring=require('querystring');var Papa=require(_0xbd6f('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbd6f('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbd6f('0x10'))(_0xbd6f('0x11'));var utils=require(_0xbd6f('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xbd6f('0x13'));var db=require(_0xbd6f('0x14'))['db'];config[_0xbd6f('0x15')]=_[_0xbd6f('0x16')](config[_0xbd6f('0x15')],{'host':_0xbd6f('0x17'),'port':0x18eb});var socket=require(_0xbd6f('0x18'))(new Redis(config[_0xbd6f('0x15')]));require(_0xbd6f('0x19'))[_0xbd6f('0x1a')](socket);var jayson=require(_0xbd6f('0x1b'));var client=jayson['client'][_0xbd6f('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0xbd6f('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x32446c,_0x3bd11c,_0x19bda2,_0x449a20){return new BPromise(function(_0x5f316d,_0x594593){var _0x18d05f=_0x449a20||client;return _0x18d05f['request'](_0x32446c,_0x19bda2)[_0xbd6f('0x1d')](function(_0x5d13bb){logger[_0xbd6f('0x1e')](_0xbd6f('0x1f'),_0x3bd11c,_0xbd6f('0x20'));logger[_0xbd6f('0x21')](_0xbd6f('0x22'),_0x3bd11c,_0xbd6f('0x20'),JSON[_0xbd6f('0x23')](_0x5d13bb));if(_0x5d13bb[_0xbd6f('0x24')]){if(_0x5d13bb[_0xbd6f('0x24')][_0xbd6f('0x25')]===0x1f4){logger[_0xbd6f('0x24')](_0xbd6f('0x1f'),_0x3bd11c,_0x5d13bb[_0xbd6f('0x24')][_0xbd6f('0x26')]);return _0x594593(_0x5d13bb['error'][_0xbd6f('0x26')]);}logger[_0xbd6f('0x24')]('FaxAccount,\x20%s,\x20%s',_0x3bd11c,_0x5d13bb[_0xbd6f('0x24')][_0xbd6f('0x26')]);return _0x5f316d(_0x5d13bb[_0xbd6f('0x24')]['message']);}else{logger[_0xbd6f('0x1e')]('FaxAccount,\x20%s,\x20%s',_0x3bd11c,'request\x20sent');_0x5f316d(_0x5d13bb['result'][_0xbd6f('0x26')]);}})[_0xbd6f('0x27')](function(_0x31b494){logger[_0xbd6f('0x24')](_0xbd6f('0x1f'),_0x3bd11c,_0x31b494);_0x594593(_0x31b494);});});}function respondWithStatusCode(_0x13445e,_0x3a7291){_0x3a7291=_0x3a7291||0xcc;return function(_0x4392db){if(_0x4392db){return _0x13445e['sendStatus'](_0x3a7291);}return _0x13445e['status'](_0x3a7291)[_0xbd6f('0x28')]();};}function respondWithResult(_0x15cf1b,_0x3e468c){_0x3e468c=_0x3e468c||0xc8;return function(_0x184ad6){if(_0x184ad6){return _0x15cf1b[_0xbd6f('0x29')](_0x3e468c)[_0xbd6f('0x2a')](_0x184ad6);}};}function respondWithFilteredResult(_0x177c49,_0x43eff4){return function(_0x5168a0){if(_0x5168a0){var _0x4f89b8=typeof _0x43eff4[_0xbd6f('0x2b')]===_0xbd6f('0x2c')&&typeof _0x43eff4[_0xbd6f('0x2d')]===_0xbd6f('0x2c');var _0x384012=_0x5168a0[_0xbd6f('0x2e')];var _0x4af51=_0x4f89b8?0x0:_0x43eff4['offset'];var _0x252757=_0x4f89b8?_0x5168a0[_0xbd6f('0x2e')]:_0x43eff4['offset']+_0x43eff4[_0xbd6f('0x2d')];var _0x3cdf21;if(_0x252757>=_0x384012){_0x252757=_0x384012;_0x3cdf21=0xc8;}else{_0x3cdf21=0xce;}_0x177c49['status'](_0x3cdf21);return _0x177c49[_0xbd6f('0x2f')](_0xbd6f('0x30'),_0x4af51+'-'+_0x252757+'/'+_0x384012)['json'](_0x5168a0);}return null;};}function patchUpdates(_0x43edbc){return function(_0x4897da){try{jsonpatch[_0xbd6f('0x31')](_0x4897da,_0x43edbc,!![]);}catch(_0x32606f){return BPromise[_0xbd6f('0x32')](_0x32606f);}return _0x4897da[_0xbd6f('0x33')]();};}function saveUpdates(_0x4d78d9,_0x142f72){return function(_0x4e06cd){if(_0x4e06cd){return _0x4e06cd[_0xbd6f('0x34')](_0x4d78d9)['then'](function(_0x5da8f1){return _0x5da8f1;});}return null;};}function removeEntity(_0x550c2a,_0x2ce8){return function(_0x115f37){if(_0x115f37){return _0x115f37[_0xbd6f('0x35')]()[_0xbd6f('0x1d')](function(){var _0x19912c=_0x115f37[_0xbd6f('0x36')]({'plain':!![]});var _0x556b8c=_0xbd6f('0x37');return db['UserProfileResource'][_0xbd6f('0x35')]({'where':{'type':_0x556b8c,'resourceId':_0x19912c['id']}})['then'](function(){return _0x115f37;});})[_0xbd6f('0x1d')](function(){_0x550c2a[_0xbd6f('0x29')](0xcc)[_0xbd6f('0x28')]();});}};}function handleEntityNotFound(_0xcf1ad1,_0x3d34e8){return function(_0x3a7fe8){if(!_0x3a7fe8){_0xcf1ad1['sendStatus'](0x194);}return _0x3a7fe8;};}function handleError(_0x136e97,_0x46bf2a){_0x46bf2a=_0x46bf2a||0x1f4;return function(_0x1314f2){logger[_0xbd6f('0x24')](_0x1314f2[_0xbd6f('0x38')]);if(_0x1314f2[_0xbd6f('0x39')]){delete _0x1314f2[_0xbd6f('0x39')];}_0x136e97['status'](_0x46bf2a)[_0xbd6f('0x3a')](_0x1314f2);};}exports['index']=function(_0x297dba,_0x4ebd3b){var _0x5658e2={'include':[{'model':db[_0xbd6f('0x3b')],'as':_0xbd6f('0x3c')}]},_0x335770={},_0x4641f9={'count':0x0,'rows':[]};var _0x39be2f=_[_0xbd6f('0x3d')](db[_0xbd6f('0x3e')][_0xbd6f('0x3f')],function(_0x5d08a7){return{'name':_0x5d08a7['fieldName'],'type':_0x5d08a7[_0xbd6f('0x40')][_0xbd6f('0x41')]};});_0x335770[_0xbd6f('0x42')]=_[_0xbd6f('0x3d')](_0x39be2f,_0xbd6f('0x39'));_0x335770['query']=_[_0xbd6f('0x43')](_0x297dba[_0xbd6f('0x44')]);_0x335770[_0xbd6f('0x45')]=_[_0xbd6f('0x46')](_0x335770[_0xbd6f('0x42')],_0x335770[_0xbd6f('0x44')]);_0x5658e2[_0xbd6f('0x47')]=_[_0xbd6f('0x46')](_0x335770[_0xbd6f('0x42')],qs['fields'](_0x297dba[_0xbd6f('0x44')]['fields']));_0x5658e2['attributes']=_0x5658e2[_0xbd6f('0x47')]['length']?_0x5658e2[_0xbd6f('0x47')]:_0x335770['model'];if(!_0x297dba[_0xbd6f('0x44')][_0xbd6f('0x48')]('nolimit')){_0x5658e2[_0xbd6f('0x2d')]=qs['limit'](_0x297dba[_0xbd6f('0x44')][_0xbd6f('0x2d')]);_0x5658e2[_0xbd6f('0x2b')]=qs['offset'](_0x297dba[_0xbd6f('0x44')][_0xbd6f('0x2b')]);}_0x5658e2[_0xbd6f('0x49')]=qs[_0xbd6f('0x4a')](_0x297dba[_0xbd6f('0x44')][_0xbd6f('0x4a')]);_0x5658e2[_0xbd6f('0x4b')]=qs[_0xbd6f('0x45')](_['pick'](_0x297dba['query'],_0x335770['filters']),_0x39be2f);if(_0x297dba[_0xbd6f('0x44')][_0xbd6f('0x4c')]){_0x5658e2[_0xbd6f('0x4b')]=_[_0xbd6f('0x4d')](_0x5658e2[_0xbd6f('0x4b')],{'$or':_[_0xbd6f('0x3d')](_0x39be2f,function(_0x2e4f2c){if(_0x2e4f2c[_0xbd6f('0x40')]!=='VIRTUAL'){var _0xa1a0be={};_0xa1a0be[_0x2e4f2c['name']]={'$like':'%'+_0x297dba['query'][_0xbd6f('0x4c')]+'%'};return _0xa1a0be;}})});}_0x5658e2=_[_0xbd6f('0x4d')]({},_0x5658e2,_0x297dba['options']);var _0x49353e={'where':_0x5658e2[_0xbd6f('0x4b')]};return db[_0xbd6f('0x3e')][_0xbd6f('0x2e')](_0x49353e)['then'](function(_0x1ec294){_0x4641f9[_0xbd6f('0x2e')]=_0x1ec294;if(_0x297dba['query']['includeAll']){_0x5658e2[_0xbd6f('0x4e')]=[{'all':!![]}];}return db[_0xbd6f('0x3e')][_0xbd6f('0x4f')](_0x5658e2);})[_0xbd6f('0x1d')](function(_0x5e2cf7){_0x4641f9[_0xbd6f('0x50')]=_0x5e2cf7;return _0x4641f9;})[_0xbd6f('0x1d')](respondWithFilteredResult(_0x4ebd3b,_0x5658e2))[_0xbd6f('0x27')](handleError(_0x4ebd3b,null));};exports['show']=function(_0x42ae8e,_0x2cce1f){var _0x2b3250={'raw':![],'where':{'id':_0x42ae8e[_0xbd6f('0x51')]['id']},'include':[{'model':db[_0xbd6f('0x3b')],'as':_0xbd6f('0x3c')}]},_0x14b3fa={};_0x14b3fa[_0xbd6f('0x42')]=_['keys'](db[_0xbd6f('0x3e')][_0xbd6f('0x3f')]);_0x14b3fa[_0xbd6f('0x44')]=_[_0xbd6f('0x43')](_0x42ae8e[_0xbd6f('0x44')]);_0x14b3fa[_0xbd6f('0x45')]=_[_0xbd6f('0x46')](_0x14b3fa[_0xbd6f('0x42')],_0x14b3fa[_0xbd6f('0x44')]);_0x2b3250[_0xbd6f('0x47')]=_[_0xbd6f('0x46')](_0x14b3fa[_0xbd6f('0x42')],qs[_0xbd6f('0x52')](_0x42ae8e[_0xbd6f('0x44')][_0xbd6f('0x52')]));_0x2b3250[_0xbd6f('0x47')]=_0x2b3250['attributes']['length']?_0x2b3250[_0xbd6f('0x47')]:_0x14b3fa[_0xbd6f('0x42')];if(_0x42ae8e['query'][_0xbd6f('0x53')]){_0x2b3250[_0xbd6f('0x4e')]=[{'all':!![]}];}_0x2b3250=_[_0xbd6f('0x4d')]({},_0x2b3250,_0x42ae8e[_0xbd6f('0x54')]);return db[_0xbd6f('0x3e')]['find'](_0x2b3250)[_0xbd6f('0x1d')](handleEntityNotFound(_0x2cce1f,null))[_0xbd6f('0x1d')](respondWithResult(_0x2cce1f,null))[_0xbd6f('0x27')](handleError(_0x2cce1f,null));};exports[_0xbd6f('0x55')]=function(_0x5a3073,_0x3d9b6f){return db[_0xbd6f('0x3e')][_0xbd6f('0x55')](_0x5a3073[_0xbd6f('0x56')],{})['then'](function(_0x21c0f8){var _0x594689=_0x5a3073[_0xbd6f('0x57')][_0xbd6f('0x36')]({'plain':!![]});if(!_0x594689)throw new Error(_0xbd6f('0x58'));if(_0x594689[_0xbd6f('0x59')]===_0xbd6f('0x57')){var _0x27acec=_0x21c0f8[_0xbd6f('0x36')]({'plain':!![]});var _0x359871=_0xbd6f('0x37');return db[_0xbd6f('0x5a')][_0xbd6f('0x5b')]({'where':{'name':_0x359871,'userProfileId':_0x594689[_0xbd6f('0x5c')]},'raw':!![]})[_0xbd6f('0x1d')](function(_0x3efc38){if(_0x3efc38&&_0x3efc38['autoAssociation']===0x0){return db['UserProfileResource'][_0xbd6f('0x55')]({'name':_0x27acec[_0xbd6f('0x39')],'resourceId':_0x27acec['id'],'type':_0x3efc38[_0xbd6f('0x39')],'sectionId':_0x3efc38['id']},{})[_0xbd6f('0x1d')](function(){return _0x21c0f8;});}else{return _0x21c0f8;}})[_0xbd6f('0x27')](function(_0x31ca41){logger['error'](_0xbd6f('0x5d'),_0x31ca41);throw _0x31ca41;});}return _0x21c0f8;})[_0xbd6f('0x1d')](respondWithResult(_0x3d9b6f,0xc9))[_0xbd6f('0x27')](handleError(_0x3d9b6f,null));};exports[_0xbd6f('0x34')]=function(_0x542b59,_0x2bc36e){if(_0x542b59[_0xbd6f('0x56')]['id']){delete _0x542b59['body']['id'];}return db[_0xbd6f('0x3e')][_0xbd6f('0x5b')]({'where':{'id':_0x542b59[_0xbd6f('0x51')]['id']},'include':[{'model':db[_0xbd6f('0x3b')],'as':_0xbd6f('0x3c')}]})[_0xbd6f('0x1d')](handleEntityNotFound(_0x2bc36e,null))[_0xbd6f('0x1d')](saveUpdates(_0x542b59[_0xbd6f('0x56')],null))[_0xbd6f('0x1d')](respondWithResult(_0x2bc36e,null))[_0xbd6f('0x27')](handleError(_0x2bc36e,null));};exports['destroy']=function(_0x1c068a,_0x3539cd){return db[_0xbd6f('0x3e')][_0xbd6f('0x5b')]({'where':{'id':_0x1c068a[_0xbd6f('0x51')]['id']}})[_0xbd6f('0x1d')](handleEntityNotFound(_0x3539cd,null))[_0xbd6f('0x1d')](removeEntity(_0x3539cd,null))[_0xbd6f('0x27')](handleError(_0x3539cd,null));};exports[_0xbd6f('0x5e')]=function(_0x10ff93,_0x5ba2f5){return db['FaxAccount'][_0xbd6f('0x5e')]()[_0xbd6f('0x1d')](respondWithResult(_0x5ba2f5,null))[_0xbd6f('0x27')](handleError(_0x5ba2f5,null));};exports[_0xbd6f('0x5f')]=function(_0x346072,_0x5227b9,_0x26988c){if(_0x346072[_0xbd6f('0x56')]['id']){delete _0x346072['body']['id'];}return db[_0xbd6f('0x3e')][_0xbd6f('0x5b')]({'where':{'id':_0x346072[_0xbd6f('0x51')]['id']}})['then'](handleEntityNotFound(_0x5227b9,null))[_0xbd6f('0x1d')](function(_0x3a0c5a){if(_0x3a0c5a){_0x346072[_0xbd6f('0x56')]['FaxAccountId']=_0x3a0c5a['id'];return db['Disposition']['create'](_0x346072['body']);}})[_0xbd6f('0x1d')](respondWithResult(_0x5227b9,null))[_0xbd6f('0x27')](handleError(_0x5227b9,null));};exports[_0xbd6f('0x60')]=function(_0x478f87,_0x145eb7,_0x335fdc){var _0x5c3fe9={'raw':![],'where':{}};var _0x4fd8e6={};var _0xbfeacb={'count':0x0,'rows':[]};return db[_0xbd6f('0x3e')][_0xbd6f('0x61')]({'where':{'id':_0x478f87[_0xbd6f('0x51')]['id']}})[_0xbd6f('0x1d')](handleEntityNotFound(_0x145eb7,null))[_0xbd6f('0x1d')](function(_0x550fb6){if(_0x550fb6){_0x4fd8e6[_0xbd6f('0x42')]=_[_0xbd6f('0x43')](db['Disposition'][_0xbd6f('0x3f')]);_0x4fd8e6[_0xbd6f('0x44')]=_[_0xbd6f('0x43')](_0x478f87[_0xbd6f('0x44')]);_0x4fd8e6['filters']=_[_0xbd6f('0x46')](_0x4fd8e6['model'],_0x4fd8e6[_0xbd6f('0x44')]);_0x5c3fe9[_0xbd6f('0x47')]=_[_0xbd6f('0x46')](_0x4fd8e6[_0xbd6f('0x42')],qs[_0xbd6f('0x52')](_0x478f87[_0xbd6f('0x44')][_0xbd6f('0x52')]));_0x5c3fe9['attributes']=_0x5c3fe9[_0xbd6f('0x47')][_0xbd6f('0x62')]?_0x5c3fe9[_0xbd6f('0x47')]:_0x4fd8e6[_0xbd6f('0x42')];if(!_0x478f87['query'][_0xbd6f('0x48')](_0xbd6f('0x63'))){_0x5c3fe9[_0xbd6f('0x2d')]=qs[_0xbd6f('0x2d')](_0x478f87[_0xbd6f('0x44')]['limit']);_0x5c3fe9[_0xbd6f('0x2b')]=qs[_0xbd6f('0x2b')](_0x478f87[_0xbd6f('0x44')]['offset']);}_0x5c3fe9[_0xbd6f('0x49')]=qs[_0xbd6f('0x4a')](_0x478f87['query']['sort']);_0x5c3fe9[_0xbd6f('0x4b')]=qs[_0xbd6f('0x45')](_[_0xbd6f('0x64')](_0x478f87[_0xbd6f('0x44')],_0x4fd8e6['filters']));_0x5c3fe9[_0xbd6f('0x4b')][_0xbd6f('0x65')]=_0x550fb6['id'];if(_0x478f87[_0xbd6f('0x44')]['filter']){_0x5c3fe9[_0xbd6f('0x4b')]=_[_0xbd6f('0x4d')](_0x5c3fe9['where'],{'$or':_['map'](_0x5c3fe9[_0xbd6f('0x47')],function(_0x5bf502){var _0x408310={};_0x408310[_0x5bf502]={'$like':'%'+_0x478f87[_0xbd6f('0x44')][_0xbd6f('0x4c')]+'%'};return _0x408310;})});}_0x5c3fe9=_[_0xbd6f('0x4d')]({},_0x5c3fe9,_0x478f87[_0xbd6f('0x54')]);return db[_0xbd6f('0x66')][_0xbd6f('0x2e')]({'where':_0x5c3fe9[_0xbd6f('0x4b')]})[_0xbd6f('0x1d')](function(_0x1e261b){_0xbfeacb[_0xbd6f('0x2e')]=_0x1e261b;if(_0x478f87[_0xbd6f('0x44')]['includeAll']){_0x5c3fe9['include']=[{'all':!![]}];}return db[_0xbd6f('0x66')][_0xbd6f('0x4f')](_0x5c3fe9);})[_0xbd6f('0x1d')](function(_0x50b569){_0xbfeacb[_0xbd6f('0x50')]=_0x50b569;return _0xbfeacb;});}})[_0xbd6f('0x1d')](respondWithFilteredResult(_0x145eb7,_0x5c3fe9))['catch'](handleError(_0x145eb7,null));};exports[_0xbd6f('0x67')]=function(_0x5488be,_0x5e1431,_0x4da81a){return db['FaxAccount'][_0xbd6f('0x5b')]({'where':{'id':_0x5488be['params']['id']}})[_0xbd6f('0x1d')](handleEntityNotFound(_0x5e1431,null))[_0xbd6f('0x1d')](function(_0x315f61){if(_0x315f61){return _0x315f61[_0xbd6f('0x67')](_0x5488be[_0xbd6f('0x44')][_0xbd6f('0x68')]);}})[_0xbd6f('0x1d')](respondWithStatusCode(_0x5e1431,null))[_0xbd6f('0x27')](handleError(_0x5e1431,null));};exports[_0xbd6f('0x69')]=function(_0x15ed6a,_0x31d166,_0x5af83d){if(_0x15ed6a['body']['id']){delete _0x15ed6a['body']['id'];}return db[_0xbd6f('0x3e')][_0xbd6f('0x5b')]({'where':{'id':_0x15ed6a[_0xbd6f('0x51')]['id']}})['then'](handleEntityNotFound(_0x31d166,null))[_0xbd6f('0x1d')](function(_0x4f9287){if(_0x4f9287){_0x15ed6a[_0xbd6f('0x56')][_0xbd6f('0x65')]=_0x4f9287['id'];return db[_0xbd6f('0x6a')][_0xbd6f('0x55')](_0x15ed6a[_0xbd6f('0x56')]);}})[_0xbd6f('0x1d')](respondWithResult(_0x31d166,null))[_0xbd6f('0x27')](handleError(_0x31d166,null));};exports[_0xbd6f('0x6b')]=function(_0x4a77ed,_0x5140c5,_0xa719b5){var _0x8fe0fa={'raw':![],'where':{}};var _0x4e55eb={};var _0x1a4f70={'count':0x0,'rows':[]};return db[_0xbd6f('0x3e')][_0xbd6f('0x61')]({'where':{'id':_0x4a77ed[_0xbd6f('0x51')]['id']}})[_0xbd6f('0x1d')](handleEntityNotFound(_0x5140c5,null))['then'](function(_0x3f51ba){if(_0x3f51ba){_0x4e55eb[_0xbd6f('0x42')]=_['keys'](db[_0xbd6f('0x6a')][_0xbd6f('0x3f')]);_0x4e55eb['query']=_['keys'](_0x4a77ed[_0xbd6f('0x44')]);_0x4e55eb['filters']=_[_0xbd6f('0x46')](_0x4e55eb[_0xbd6f('0x42')],_0x4e55eb[_0xbd6f('0x44')]);_0x8fe0fa[_0xbd6f('0x47')]=_[_0xbd6f('0x46')](_0x4e55eb[_0xbd6f('0x42')],qs[_0xbd6f('0x52')](_0x4a77ed[_0xbd6f('0x44')]['fields']));_0x8fe0fa[_0xbd6f('0x47')]=_0x8fe0fa[_0xbd6f('0x47')]['length']?_0x8fe0fa[_0xbd6f('0x47')]:_0x4e55eb[_0xbd6f('0x42')];if(!_0x4a77ed['query'][_0xbd6f('0x48')](_0xbd6f('0x63'))){_0x8fe0fa[_0xbd6f('0x2d')]=qs[_0xbd6f('0x2d')](_0x4a77ed[_0xbd6f('0x44')][_0xbd6f('0x2d')]);_0x8fe0fa[_0xbd6f('0x2b')]=qs[_0xbd6f('0x2b')](_0x4a77ed['query']['offset']);}_0x8fe0fa[_0xbd6f('0x49')]=qs[_0xbd6f('0x4a')](_0x4a77ed[_0xbd6f('0x44')][_0xbd6f('0x4a')]);_0x8fe0fa[_0xbd6f('0x4b')]=qs[_0xbd6f('0x45')](_[_0xbd6f('0x64')](_0x4a77ed[_0xbd6f('0x44')],_0x4e55eb['filters']));_0x8fe0fa[_0xbd6f('0x4b')]['FaxAccountId']=_0x3f51ba['id'];if(_0x4a77ed[_0xbd6f('0x44')][_0xbd6f('0x4c')]){_0x8fe0fa[_0xbd6f('0x4b')]=_[_0xbd6f('0x4d')](_0x8fe0fa[_0xbd6f('0x4b')],{'$or':_[_0xbd6f('0x3d')](_0x8fe0fa[_0xbd6f('0x47')],function(_0x5adbab){var _0x2cb03e={};_0x2cb03e[_0x5adbab]={'$like':'%'+_0x4a77ed['query'][_0xbd6f('0x4c')]+'%'};return _0x2cb03e;})});}_0x8fe0fa=_[_0xbd6f('0x4d')]({},_0x8fe0fa,_0x4a77ed[_0xbd6f('0x54')]);return db[_0xbd6f('0x6a')][_0xbd6f('0x2e')]({'where':_0x8fe0fa['where']})[_0xbd6f('0x1d')](function(_0x5854d2){_0x1a4f70[_0xbd6f('0x2e')]=_0x5854d2;if(_0x4a77ed[_0xbd6f('0x44')][_0xbd6f('0x53')]){_0x8fe0fa['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x8fe0fa);})[_0xbd6f('0x1d')](function(_0x457283){_0x1a4f70[_0xbd6f('0x50')]=_0x457283;return _0x1a4f70;});}})[_0xbd6f('0x1d')](respondWithFilteredResult(_0x5140c5,_0x8fe0fa))[_0xbd6f('0x27')](handleError(_0x5140c5,null));};exports[_0xbd6f('0x6c')]=function(_0x3eeed6,_0x1f3131,_0x4a0327){return db[_0xbd6f('0x3e')][_0xbd6f('0x5b')]({'where':{'id':_0x3eeed6['params']['id']}})[_0xbd6f('0x1d')](handleEntityNotFound(_0x1f3131,null))['then'](function(_0x528ca7){if(_0x528ca7){return _0x528ca7[_0xbd6f('0x6c')](_0x3eeed6[_0xbd6f('0x44')][_0xbd6f('0x68')]);}})[_0xbd6f('0x1d')](respondWithStatusCode(_0x1f3131,null))[_0xbd6f('0x27')](handleError(_0x1f3131,null));};exports[_0xbd6f('0x6d')]=function(_0x42d263,_0x4b01dc,_0x56bed7){return db[_0xbd6f('0x6e')][_0xbd6f('0x5b')]({'where':{'id':_0x42d263['params']['id']}})[_0xbd6f('0x1d')](handleEntityNotFound(_0x4b01dc,null))[_0xbd6f('0x1d')](function(_0x575cb0){if(_0x575cb0){return _0x575cb0['addInteraction'](_0x42d263[_0xbd6f('0x56')]['ids'],_['omit'](_0x42d263[_0xbd6f('0x56')],[_0xbd6f('0x68'),'id'])||{});}})[_0xbd6f('0x1d')](respondWithResult(_0x4b01dc,null))['catch'](handleError(_0x4b01dc,null));};exports[_0xbd6f('0x6f')]=function(_0xdb5872,_0x5d812d,_0x3e4621){var _0x58c7c4={'raw':![],'where':{}};var _0x27edbc={};var _0x3a17f2={'count':0x0,'rows':[]};return db['FaxAccount'][_0xbd6f('0x61')]({'where':{'id':_0xdb5872[_0xbd6f('0x51')]['id']}})[_0xbd6f('0x1d')](handleEntityNotFound(_0x5d812d,null))['then'](function(_0x301e2d){if(_0x301e2d){_0x27edbc['model']=_[_0xbd6f('0x43')](db[_0xbd6f('0x6e')][_0xbd6f('0x3f')]);_0x27edbc['query']=_['keys'](_0xdb5872['query']);_0x27edbc[_0xbd6f('0x45')]=_['intersection'](_0x27edbc[_0xbd6f('0x42')],_0x27edbc[_0xbd6f('0x44')]);_0x58c7c4[_0xbd6f('0x47')]=_['intersection'](_0x27edbc[_0xbd6f('0x42')],qs[_0xbd6f('0x52')](_0xdb5872['query']['fields']));_0x58c7c4['attributes']=_0x58c7c4['attributes']['length']?_0x58c7c4[_0xbd6f('0x47')]:_0x27edbc['model'];if(!_0xdb5872['query'][_0xbd6f('0x48')](_0xbd6f('0x63'))){_0x58c7c4['limit']=qs[_0xbd6f('0x2d')](_0xdb5872[_0xbd6f('0x44')][_0xbd6f('0x2d')]);_0x58c7c4[_0xbd6f('0x2b')]=qs['offset'](_0xdb5872[_0xbd6f('0x44')]['offset']);}_0x58c7c4['order']=qs[_0xbd6f('0x4a')](_0xdb5872[_0xbd6f('0x44')][_0xbd6f('0x4a')]);_0x58c7c4[_0xbd6f('0x4b')]=qs[_0xbd6f('0x45')](_[_0xbd6f('0x64')](_0xdb5872[_0xbd6f('0x44')],_0x27edbc[_0xbd6f('0x45')]));_0x58c7c4[_0xbd6f('0x4b')][_0xbd6f('0x65')]=_0x301e2d['id'];if(_0xdb5872[_0xbd6f('0x44')][_0xbd6f('0x4c')]){_0x58c7c4[_0xbd6f('0x4b')]=_[_0xbd6f('0x4d')](_0x58c7c4[_0xbd6f('0x4b')],{'$or':_['map'](_0x58c7c4['attributes'],function(_0x22f4ec){var _0x5eee92={};_0x5eee92[_0x22f4ec]={'$like':'%'+_0xdb5872['query']['filter']+'%'};return _0x5eee92;})});}_0x58c7c4=_[_0xbd6f('0x4d')]({},_0x58c7c4,_0xdb5872[_0xbd6f('0x54')]);return db[_0xbd6f('0x6e')]['count']({'where':_0x58c7c4['where']})[_0xbd6f('0x1d')](function(_0x22e74d){_0x3a17f2[_0xbd6f('0x2e')]=_0x22e74d;if(_0xdb5872['query'][_0xbd6f('0x53')]){_0x58c7c4[_0xbd6f('0x4e')]=[{'model':db['CmContact'],'as':_0xbd6f('0x70'),'required':![]},{'model':db[_0xbd6f('0x71')],'as':_0xbd6f('0x72'),'attributes':[_0xbd6f('0x39'),_0xbd6f('0x73'),_0xbd6f('0x74')],'required':![]},{'model':db[_0xbd6f('0x75')],'as':_0xbd6f('0x76'),'attributes':['id',_0xbd6f('0x39'),_0xbd6f('0x77')],'where':_0xdb5872['query'][_0xbd6f('0x78')]?{'id':_0xdb5872[_0xbd6f('0x44')][_0xbd6f('0x78')]}:undefined,'required':_0xdb5872[_0xbd6f('0x44')][_0xbd6f('0x78')]?!![]:![]}];}return db[_0xbd6f('0x6e')][_0xbd6f('0x4f')](_0x58c7c4);})[_0xbd6f('0x1d')](function(_0x454f22){_0x3a17f2[_0xbd6f('0x50')]=_0x454f22;return _0x3a17f2;});}})['then'](respondWithFilteredResult(_0x5d812d,_0x58c7c4))[_0xbd6f('0x27')](handleError(_0x5d812d,null));};exports[_0xbd6f('0x79')]=function(_0x30e2ae,_0x46acc2,_0x282a0a){return db[_0xbd6f('0x3e')]['findOne']({'where':{'id':_0x30e2ae['params']['id']}})[_0xbd6f('0x1d')](handleEntityNotFound(_0x46acc2,null))['then'](function(_0x32f0a4){if(_0x32f0a4){return db[_0xbd6f('0x7a')][_0xbd6f('0x7b')](function(_0x17f9d9){return db['FaxApplication'][_0xbd6f('0x35')]({'where':{'FaxAccountId':_0x30e2ae[_0xbd6f('0x51')]['id']},'transaction':_0x17f9d9})['then'](function(_0x48ccfb){var _0x3eb57e=_[_0xbd6f('0x3d')](_0x30e2ae[_0xbd6f('0x56')],function(_0x4825e9){_0x4825e9[_0xbd6f('0x65')]=_0x30e2ae['params']['id'];return _0x4825e9;});return db[_0xbd6f('0x7c')][_0xbd6f('0x7d')](_0x3eb57e,{'transaction':_0x17f9d9});});})[_0xbd6f('0x1d')](function(){return db[_0xbd6f('0x7c')][_0xbd6f('0x7e')]({'where':{'FaxAccountId':_0x30e2ae['params']['id']},'order':_0xbd6f('0x7f')});});}})[_0xbd6f('0x1d')](respondWithResult(_0x46acc2,null))[_0xbd6f('0x27')](handleError(_0x46acc2,null));};exports[_0xbd6f('0x80')]=function(_0x431cee,_0x44ca82,_0x4970c4){var _0x182e11={};var _0x1328ed={};var _0x59567a;var _0xbfde5e;return db['FaxAccount'][_0xbd6f('0x61')]({'where':{'id':_0x431cee[_0xbd6f('0x51')]['id']}})[_0xbd6f('0x1d')](handleEntityNotFound(_0x44ca82,null))[_0xbd6f('0x1d')](function(_0x34e7bd){if(_0x34e7bd){_0x59567a=_0x34e7bd;_0x1328ed[_0xbd6f('0x42')]=_['keys'](db[_0xbd6f('0x7c')][_0xbd6f('0x3f')]);_0x1328ed[_0xbd6f('0x44')]=_[_0xbd6f('0x43')](_0x431cee[_0xbd6f('0x44')]);_0x1328ed[_0xbd6f('0x45')]=_['intersection'](_0x1328ed[_0xbd6f('0x42')],_0x1328ed[_0xbd6f('0x44')]);_0x182e11[_0xbd6f('0x47')]=_[_0xbd6f('0x46')](_0x1328ed[_0xbd6f('0x42')],qs[_0xbd6f('0x52')](_0x431cee[_0xbd6f('0x44')][_0xbd6f('0x52')]));_0x182e11[_0xbd6f('0x47')]=_0x182e11['attributes'][_0xbd6f('0x62')]?_0x182e11[_0xbd6f('0x47')]:_0x1328ed[_0xbd6f('0x42')];_0x182e11[_0xbd6f('0x49')]=qs[_0xbd6f('0x4a')](_0x431cee[_0xbd6f('0x44')]['sort']);_0x182e11['where']=qs[_0xbd6f('0x45')](_[_0xbd6f('0x64')](_0x431cee['query'],_0x1328ed[_0xbd6f('0x45')]));if(_0x431cee[_0xbd6f('0x44')][_0xbd6f('0x4c')]){_0x182e11['where']=_[_0xbd6f('0x4d')](_0x182e11[_0xbd6f('0x4b')],{'$or':_['map'](_0x182e11['attributes'],function(_0x3a343c){var _0x5c69c0={};_0x5c69c0[_0x3a343c]={'$like':'%'+_0x431cee[_0xbd6f('0x44')][_0xbd6f('0x4c')]+'%'};return _0x5c69c0;})});}_0x182e11=_['merge']({},_0x182e11,_0x431cee[_0xbd6f('0x54')]);return _0x59567a[_0xbd6f('0x80')](_0x182e11);}})[_0xbd6f('0x1d')](function(_0xc0f6c3){if(_0xc0f6c3){_0xbfde5e=_0xc0f6c3[_0xbd6f('0x62')];if(!_0x431cee[_0xbd6f('0x44')]['hasOwnProperty'](_0xbd6f('0x63'))){_0x182e11['limit']=qs['limit'](_0x431cee['query'][_0xbd6f('0x2d')]);_0x182e11['offset']=qs[_0xbd6f('0x2b')](_0x431cee[_0xbd6f('0x44')][_0xbd6f('0x2b')]);}return _0x59567a[_0xbd6f('0x80')](_0x182e11);}})[_0xbd6f('0x1d')](function(_0x3cb6ee){if(_0x3cb6ee){return _0x3cb6ee?{'count':_0xbfde5e,'rows':_0x3cb6ee}:null;}})[_0xbd6f('0x1d')](respondWithResult(_0x44ca82,null))[_0xbd6f('0x27')](handleError(_0x44ca82,null));};function Extension(_0x41fc68,_0x270ee9,_0x304e3f,_0x45ad8c){this[_0xbd6f('0x81')]=_0xbd6f('0x82');this[_0xbd6f('0x83')]=_0x41fc68[_0xbd6f('0x84')];this[_0xbd6f('0x85')]=_0x45ad8c;this[_0xbd6f('0x40')]=_0xbd6f('0x86');this['description']=_0xbd6f('0x87');this[_0xbd6f('0x65')]=_0x41fc68['id'];this[_0xbd6f('0x7f')]=_0x270ee9;this[_0xbd6f('0x88')]=_0x304e3f;}function createExtensionsReciveFax(_0x2bcb20){var _0x9a3965=0x1;var _0x5545c7=[];_0x5545c7['push'](new Extension(_0x2bcb20,_0x9a3965,'',_0xbd6f('0x89')));_0x9a3965+=0x1;_0x5545c7['push'](new Extension(_0x2bcb20,_0x9a3965,_0xbd6f('0x8a'),_0xbd6f('0x8b')));_0x9a3965+=0x1;for(var _0xc33add in _0x2bcb20){if(_0x2bcb20['hasOwnProperty'](_0xc33add)&&(_0xc33add===_0xbd6f('0x8c')||_0xc33add===_0xbd6f('0x84')||_0xc33add===_0xbd6f('0x8d')||_0xc33add===_0xbd6f('0x8e')||_0xc33add===_0xbd6f('0x8f')||_0xc33add===_0xbd6f('0x90')||_0xc33add===_0xbd6f('0x91')||_0xc33add===_0xbd6f('0x92')||_0xc33add===_0xbd6f('0x93'))){_0x5545c7['push'](new Extension(_0x2bcb20,_0x9a3965,_0xbd6f('0x94')+_0xc33add+')='+_0x2bcb20[_0xc33add],'Set'));_0x9a3965+=0x1;}}_0x5545c7['push'](new Extension(_0x2bcb20,_0x9a3965,'6',_0xbd6f('0x95')));_0x9a3965+=0x1;_0x5545c7[_0xbd6f('0x96')](new Extension(_0x2bcb20,_0x9a3965,_0xbd6f('0x97'),_0xbd6f('0x98')));_0x9a3965=0x0;return _0x5545c7;}exports[_0xbd6f('0x99')]=function(_0x46bf05,_0x216188,_0x46dddb){var _0x5026b5;return db[_0xbd6f('0x7a')]['transaction'](function(_0x28eee7){return db[_0xbd6f('0x3e')][_0xbd6f('0x55')](_0x46bf05['body'],{'transaction':_0x28eee7})[_0xbd6f('0x1d')](function(_0x45bd81){_0x5026b5=_0x45bd81[_0xbd6f('0x36')]({'plain':!![]});return db[_0xbd6f('0x9a')]['bulkCreate'](createExtensionsReciveFax(_0x5026b5),{'transaction':_0x28eee7});});})[_0xbd6f('0x1d')](function(){return _0x5026b5;})['then'](respondWithResult(_0x216188,null))[_0xbd6f('0x27')](handleError(_0x216188,null));};exports[_0xbd6f('0x9b')]=function(_0x1c7714,_0x251989,_0x4a5392){var _0x342b43;return db[_0xbd6f('0x7a')][_0xbd6f('0x7b')](function(_0x3c49be){return db[_0xbd6f('0x3e')][_0xbd6f('0x34')](_0x1c7714['body'],{'where':{'id':_0x1c7714[_0xbd6f('0x56')]['id']},'transaction':_0x3c49be})[_0xbd6f('0x1d')](function(_0x5a7005){return db[_0xbd6f('0x9a')][_0xbd6f('0x35')]({'where':{'FaxAccountId':_0x1c7714[_0xbd6f('0x56')]['id']},'transaction':_0x3c49be})['then'](function(_0x1d288f){return db[_0xbd6f('0x9a')][_0xbd6f('0x7d')](createExtensionsReciveFax(_['omit'](_0x1c7714[_0xbd6f('0x56')],['tech',_0xbd6f('0x41'),_0xbd6f('0x9c'),_0xbd6f('0x9d'),_0xbd6f('0x9e'),_0xbd6f('0x9f')])),{'transaction':_0x3c49be});});});})['then'](function(){return db['FaxAccount']['findById'](_0x1c7714[_0xbd6f('0x56')]['id']);})['then'](respondWithResult(_0x251989,null))[_0xbd6f('0x27')](handleError(_0x251989,null));};exports[_0xbd6f('0xa0')]=function(_0x200785,_0x159de5,_0x43fa76){var _0x53f41e={'raw':!![],'where':{}};var _0x45199c={};var _0x4140c5={'count':0x0,'rows':[]};return db['FaxAccount'][_0xbd6f('0x61')]({'where':{'id':_0x200785['params']['id']}})[_0xbd6f('0x1d')](handleEntityNotFound(_0x159de5,null))[_0xbd6f('0x1d')](function(_0x3d6557){if(_0x3d6557){_0x45199c[_0xbd6f('0x42')]=_[_0xbd6f('0x43')](db[_0xbd6f('0xa1')][_0xbd6f('0x3f')]);_0x45199c[_0xbd6f('0x44')]=_[_0xbd6f('0x43')](_0x200785[_0xbd6f('0x44')]);_0x45199c[_0xbd6f('0x45')]=_[_0xbd6f('0x46')](_0x45199c[_0xbd6f('0x42')],_0x45199c['query']);_0x53f41e[_0xbd6f('0x47')]=_['intersection'](_0x45199c[_0xbd6f('0x42')],qs[_0xbd6f('0x52')](_0x200785['query']['fields']));_0x53f41e[_0xbd6f('0x47')]=_0x53f41e[_0xbd6f('0x47')]['length']?_0x53f41e[_0xbd6f('0x47')]:_0x45199c[_0xbd6f('0x42')];if(!_0x200785['query'][_0xbd6f('0x48')]('nolimit')){_0x53f41e['limit']=qs['limit'](_0x200785[_0xbd6f('0x44')][_0xbd6f('0x2d')]);_0x53f41e[_0xbd6f('0x2b')]=qs['offset'](_0x200785['query']['offset']);}_0x53f41e[_0xbd6f('0x49')]=qs[_0xbd6f('0x4a')](_0x200785[_0xbd6f('0x44')]['sort']);_0x53f41e[_0xbd6f('0x4b')]=qs[_0xbd6f('0x45')](_[_0xbd6f('0x64')](_0x200785['query'],_0x45199c['filters']));_0x53f41e[_0xbd6f('0x4b')][_0xbd6f('0x65')]=_0x3d6557['id'];if(_0x200785['query'][_0xbd6f('0x4c')]){_0x53f41e[_0xbd6f('0x4b')]=_[_0xbd6f('0x4d')](_0x53f41e[_0xbd6f('0x4b')],{'$or':_[_0xbd6f('0x3d')](_0x53f41e[_0xbd6f('0x47')],function(_0x49863c){var _0x2f779a={};_0x2f779a[_0x49863c]={'$like':'%'+_0x200785[_0xbd6f('0x44')]['filter']+'%'};return _0x2f779a;})});}if(_0x200785[_0xbd6f('0x44')][_0xbd6f('0xa2')]){var _0x124601=_0x200785[_0xbd6f('0x44')][_0xbd6f('0xa2')][_0xbd6f('0xa3')](',');var _0x1a1350={};_0x1a1350[_0x124601[0x0]]={'$gte':moment(_0x124601[0x1])[_0xbd6f('0xa4')](_0xbd6f('0xa5'))};_0x53f41e['where']=_['merge'](_0x53f41e[_0xbd6f('0x4b')],_0x1a1350);}_0x53f41e=_[_0xbd6f('0x4d')]({},_0x53f41e,_0x200785[_0xbd6f('0x54')]);return db[_0xbd6f('0xa1')][_0xbd6f('0x2e')]({'where':_0x53f41e[_0xbd6f('0x4b')]})[_0xbd6f('0x1d')](function(_0xe45b71){_0x4140c5[_0xbd6f('0x2e')]=_0xe45b71;if(_0x200785[_0xbd6f('0x44')]['includeAll']){_0x53f41e[_0xbd6f('0x4e')]=[{'all':!![]}];}return db[_0xbd6f('0xa1')]['findAll'](_0x53f41e);})[_0xbd6f('0x1d')](function(_0x34f8d4){_0x4140c5[_0xbd6f('0x50')]=_0x34f8d4;return _0x4140c5;});}})[_0xbd6f('0x1d')](respondWithFilteredResult(_0x159de5,_0x53f41e))[_0xbd6f('0x27')](handleError(_0x159de5,null));};exports[_0xbd6f('0x3a')]=function(_0x50aee9,_0xa0d5d0,_0x8f9aba){var _0x4f9fe7,_0x5c380a={},_0x2d8007;if(_0x50aee9[_0xbd6f('0x56')]['to']){_0x2d8007=_0x50aee9['body']['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0x50aee9[_0xbd6f('0x51')]['id']},'include':[{'model':db['CmList'],'as':_0xbd6f('0xa6'),'include':[{'model':db['CmContact'],'as':_0xbd6f('0xa7'),'where':{'fax':_0x2d8007},'limit':0x1,'order':[[_0xbd6f('0x9d'),_0xbd6f('0xa8')]]}]}]})[_0xbd6f('0x1d')](handleEntityNotFound(_0xa0d5d0,null))[_0xbd6f('0x1d')](function(_0x20a98b){_0x4f9fe7=_0x20a98b;if(_0x50aee9[_0xbd6f('0x56')][_0xbd6f('0xa9')]&&_0x50aee9[_0xbd6f('0x56')][_0xbd6f('0xa9')][_0xbd6f('0x62')]){for(var _0x3b4d7f=0x0;_0x3b4d7f<_0x50aee9[_0xbd6f('0x56')][_0xbd6f('0xa9')][_0xbd6f('0x62')];_0x3b4d7f+=0x1){_0x50aee9[_0xbd6f('0x56')][_0xbd6f('0xa9')][_0x3b4d7f]={'filename':_0x50aee9[_0xbd6f('0x56')][_0xbd6f('0xa9')][_0x3b4d7f][_0xbd6f('0x39')],'id':_0x50aee9['body']['attachments'][_0x3b4d7f]['id'],'path':path['join'](config[_0xbd6f('0xaa')],_0xbd6f('0xab'),_0x50aee9['body'][_0xbd6f('0xa9')][_0x3b4d7f][_0xbd6f('0xac')])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_['isNil'](_0x50aee9[_0xbd6f('0x51')]['id'])?undefined:_0x50aee9[_0xbd6f('0x51')]['id'],'path':_['isNil'](_0x50aee9[_0xbd6f('0x56')]['attachments'][0x0]['path'])?undefined:_0x50aee9['body'][_0xbd6f('0xa9')][0x0][_0xbd6f('0x5')],'fax':_[_0xbd6f('0xad')](_0x50aee9[_0xbd6f('0x56')]['to'][0x0])?undefined:_0x50aee9[_0xbd6f('0x56')]['to'][0x0]},client9002);})[_0xbd6f('0x1d')](function(){if(_0x4f9fe7){if(_[_0xbd6f('0xad')](_0x50aee9[_0xbd6f('0x56')][_0xbd6f('0xae')])){_0x50aee9[_0xbd6f('0x56')][_0xbd6f('0xae')]=util[_0xbd6f('0xa4')](_0xbd6f('0xaf'),_0x4f9fe7[_0xbd6f('0x39')],_0x4f9fe7[_0xbd6f('0xb0')]);}if(_0x4f9fe7[_0xbd6f('0xa6')]){if(_0x4f9fe7[_0xbd6f('0xa6')]['Contacts'][_0xbd6f('0x62')]){return _0x4f9fe7[_0xbd6f('0xa6')][_0xbd6f('0xa7')][0x0];}else{return db[_0xbd6f('0xb1')][_0xbd6f('0x55')](_['defaults'](_0x50aee9[_0xbd6f('0x56')],{'firstName':_0x50aee9[_0xbd6f('0x56')]['to'][0x0],'phone':_0x50aee9[_0xbd6f('0x56')]['to'][0x0],'fax':_0x50aee9[_0xbd6f('0x56')]['to'][0x0],'ListId':_0x4f9fe7[_0xbd6f('0x9f')]}));}}else{throw new Error(_0xbd6f('0xb2'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xbd6f('0x1d')](function(_0x16db81){if(_0x16db81){return db[_0xbd6f('0x6e')][_0xbd6f('0x5b')]({'where':{'ContactId':_0x16db81['id'],'closed':![],'FaxAccountId':_0x4f9fe7['id']}})[_0xbd6f('0x1d')](function(_0x45e11e){if(_0x45e11e){return[_0x45e11e,![]];}return db[_0xbd6f('0x6e')][_0xbd6f('0x55')]({'UserId':_0x50aee9[_0xbd6f('0x57')]['id'],'ContactId':_0x16db81['id'],'FaxAccountId':_0x4f9fe7['id'],'fax':_0x50aee9[_0xbd6f('0x56')]['to'][0x0],'firstMsgDirection':_0xbd6f('0xb3'),'Messages':[_[_0xbd6f('0x4d')](_0x50aee9['body'],{'read':![],'body':_0x50aee9[_0xbd6f('0x56')][_0xbd6f('0xa9')][0x0][_0xbd6f('0xb4')],'FaxAccountId':_0x4f9fe7['id'],'UserId':_0x50aee9[_0xbd6f('0x57')]['id'],'ContactId':_0x16db81['id'],'AttachmentId':_0x50aee9[_0xbd6f('0x56')][_0xbd6f('0xa9')][0x0]['id']})]},{'include':[{'model':db[_0xbd6f('0xa1')],'as':'Messages'}]})[_0xbd6f('0x1d')](function(_0x3b7052){return[_0x3b7052,!![]];});});}else{throw new Error(_0xbd6f('0xb5'));}})[_0xbd6f('0xb6')](function(_0x4deed7,_0x435996){if(_0x435996){return _0x4deed7;}return db['FaxMessage']['create']({'direction':_0xbd6f('0xb3'),'read':![],'body':_0x50aee9[_0xbd6f('0x56')]['attachments'][0x0][_0xbd6f('0xb4')],'FaxAccountId':_0x4f9fe7['id'],'FaxInteractionId':_0x4deed7['id'],'UserId':_0x50aee9[_0xbd6f('0x57')]['id'],'ContactId':_0x4deed7['ContactId'],'AttachmentId':_0x50aee9[_0xbd6f('0x56')]['attachments'][0x0]['id']})[_0xbd6f('0x1d')](function(_0x51aa8b){_0x4deed7[_0xbd6f('0xb7')][_0xbd6f('0xb8')]=[];_0x4deed7[_0xbd6f('0xb7')][_0xbd6f('0xb8')]['push'](_0x51aa8b[_0xbd6f('0xb7')]);return _0x4deed7;});})[_0xbd6f('0x1d')](function(_0x210482){respondWithRpcPromise(_0xbd6f('0xb9'),_0xbd6f('0xb9'),{'FaxAccountId':_[_0xbd6f('0xad')](_0x50aee9[_0xbd6f('0x51')]['id'])?undefined:_0x50aee9[_0xbd6f('0x51')]['id'],'path':_[_0xbd6f('0xad')](_0x50aee9['body'][_0xbd6f('0xa9')][0x0][_0xbd6f('0x5')])?undefined:_0x50aee9['body'][_0xbd6f('0xa9')][0x0][_0xbd6f('0x5')],'fax':_[_0xbd6f('0xad')](_0x50aee9['body']['to'][0x0])?undefined:_0x50aee9[_0xbd6f('0x56')]['to'][0x0],'AttachmentId':_0x50aee9[_0xbd6f('0x56')][_0xbd6f('0xa9')][0x0]['id']},client9002)[_0xbd6f('0x1d')](function(_0x37fe46){logger['info'](_0xbd6f('0xba'),_0x37fe46);})[_0xbd6f('0x27')](function(_0x245c27){logger[_0xbd6f('0x1e')](_0xbd6f('0xba'),_0x245c27);});return _0x210482;})[_0xbd6f('0x1d')](respondWithResult(_0xa0d5d0,null))[_0xbd6f('0x27')](handleError(_0xa0d5d0,null));};exports[_0xbd6f('0xbb')]=function(_0x1306f5,_0x1d8e01,_0x44992e){return db[_0xbd6f('0x3e')]['find']({'where':{'id':_0x1306f5[_0xbd6f('0x51')]['id']}})['then'](handleEntityNotFound(_0x1d8e01,null))[_0xbd6f('0x1d')](function(_0x43f69c){if(_0x43f69c){return _0x43f69c['addAgents'](_0x1306f5['body'][_0xbd6f('0x68')],_['omit'](_0x1306f5['body'],[_0xbd6f('0x68'),'id'])||{})[_0xbd6f('0xb6')](function(_0x381361){for(var _0x2df9f1=0x0;_0x2df9f1<_0x1306f5[_0xbd6f('0x56')][_0xbd6f('0x68')]['length'];_0x2df9f1+=0x1){socket[_0xbd6f('0xbc')](_0xbd6f('0xbd'),{'UserId':Number(_0x1306f5[_0xbd6f('0x56')][_0xbd6f('0x68')][_0x2df9f1]),'FaxAccountId':Number(_0x1306f5[_0xbd6f('0x51')]['id'])});}return _0x381361;});}})['then'](respondWithResult(_0x1d8e01,null))[_0xbd6f('0x27')](handleError(_0x1d8e01,null));};exports[_0xbd6f('0xbe')]=function(_0x1584c2,_0x1c8632,_0x277a48){return db[_0xbd6f('0x3e')][_0xbd6f('0x5b')]({'where':{'id':_0x1584c2[_0xbd6f('0x51')]['id']}})['then'](handleEntityNotFound(_0x1c8632,null))[_0xbd6f('0x1d')](function(_0x3acc41){if(_0x3acc41){return _0x3acc41['removeAgents'](_0x1584c2[_0xbd6f('0x44')]['ids'])[_0xbd6f('0x1d')](function(){if(_[_0xbd6f('0xbf')](_0x1584c2[_0xbd6f('0x44')][_0xbd6f('0x68')])){for(var _0x536c23=0x0;_0x536c23<_0x1584c2[_0xbd6f('0x44')][_0xbd6f('0x68')]['length'];_0x536c23+=0x1){socket[_0xbd6f('0xbc')](_0xbd6f('0xc0'),{'UserId':Number(_0x1584c2[_0xbd6f('0x44')][_0xbd6f('0x68')][_0x536c23]),'FaxAccountId':Number(_0x1584c2['params']['id'])});}}else{socket[_0xbd6f('0xbc')]('userFaxAccount:remove',{'UserId':Number(_0x1584c2[_0xbd6f('0x44')][_0xbd6f('0x68')]),'FaxAccountId':Number(_0x1584c2['params']['id'])});}});}})['then'](respondWithStatusCode(_0x1c8632,null))[_0xbd6f('0x27')](handleError(_0x1c8632,null));};exports[_0xbd6f('0xc1')]=function(_0x45ad6f,_0x3e2490,_0x4c473b){var _0x4b878e={};var _0x5f5640={};var _0x55bed5;var _0xdf10ff;return db[_0xbd6f('0x3e')]['findOne']({'where':{'id':_0x45ad6f['params']['id']}})[_0xbd6f('0x1d')](handleEntityNotFound(_0x3e2490,null))[_0xbd6f('0x1d')](function(_0x30c643){if(_0x30c643){_0x55bed5=_0x30c643;_0x5f5640[_0xbd6f('0x42')]=_[_0xbd6f('0x43')](db[_0xbd6f('0x71')][_0xbd6f('0x3f')]);_0x5f5640[_0xbd6f('0x44')]=_[_0xbd6f('0x43')](_0x45ad6f['query']);_0x5f5640['filters']=_[_0xbd6f('0x46')](_0x5f5640[_0xbd6f('0x42')],_0x5f5640[_0xbd6f('0x44')]);_0x4b878e[_0xbd6f('0x47')]=_['intersection'](_0x5f5640[_0xbd6f('0x42')],qs['fields'](_0x45ad6f['query']['fields']));_0x4b878e['attributes']=_0x4b878e[_0xbd6f('0x47')][_0xbd6f('0x62')]?_0x4b878e[_0xbd6f('0x47')]:_0x5f5640['model'];_0x4b878e['order']=qs[_0xbd6f('0x4a')](_0x45ad6f[_0xbd6f('0x44')][_0xbd6f('0x4a')]);_0x4b878e[_0xbd6f('0x4b')]=qs[_0xbd6f('0x45')](_['pick'](_0x45ad6f[_0xbd6f('0x44')],_0x5f5640[_0xbd6f('0x45')]));if(_0x45ad6f[_0xbd6f('0x44')]['filter']){_0x4b878e[_0xbd6f('0x4b')]=_[_0xbd6f('0x4d')](_0x4b878e[_0xbd6f('0x4b')],{'$or':_['map'](_0x4b878e[_0xbd6f('0x47')],function(_0x24b78b){var _0x310c29={};_0x310c29[_0x24b78b]={'$like':'%'+_0x45ad6f[_0xbd6f('0x44')][_0xbd6f('0x4c')]+'%'};return _0x310c29;})});}_0x4b878e=_[_0xbd6f('0x4d')]({},_0x4b878e,_0x45ad6f[_0xbd6f('0x54')]);return _0x55bed5['getAgents'](_0x4b878e);}})[_0xbd6f('0x1d')](function(_0x801ef4){if(_0x801ef4){_0xdf10ff=_0x801ef4[_0xbd6f('0x62')];if(!_0x45ad6f[_0xbd6f('0x44')]['hasOwnProperty'](_0xbd6f('0x63'))){_0x4b878e[_0xbd6f('0x2d')]=qs[_0xbd6f('0x2d')](_0x45ad6f[_0xbd6f('0x44')][_0xbd6f('0x2d')]);_0x4b878e['offset']=qs[_0xbd6f('0x2b')](_0x45ad6f['query'][_0xbd6f('0x2b')]);}return _0x55bed5[_0xbd6f('0xc1')](_0x4b878e);}})[_0xbd6f('0x1d')](function(_0x3e3ae1){if(_0x3e3ae1){return _0x3e3ae1?{'count':_0xdf10ff,'rows':_0x3e3ae1}:null;}})['then'](respondWithResult(_0x3e2490,null))[_0xbd6f('0x27')](handleError(_0x3e2490,null));}; \ No newline at end of file +var _0xbb63=['UserProfileSection','userProfileId','autoAssociation','params','describe','addDisposition','FaxAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','pick','removeAnswers','addInteraction','getInteractions','CmContact','Owner','fullname','internal','Tag','Tags','color','tag','FaxInteraction','addApplications','sequelize','transaction','FaxApplication','bulkCreate','getApplications','context','from-voip-provider','exten','localstationid','system','description','Fax\x20Extension','priority','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','modem','t38timeout','FAXOPT(','Wait','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','omit','tech','createdAt','TrunkId','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','Contacts','updatedAt','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','Contact\x20not\x20found','filename','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxAccount.socket','jayson/promise','client','http','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','update','destroy','get','FaxAccounts','UserProfileResource','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','FaxAccount','includeAll','include','findAll','rows','catch','Pause','mandatoryDispositionPause','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0xbb63,0x12a));var _0x3bb6=function(_0x40b43f,_0x21d9ae){_0x40b43f=_0x40b43f-0x0;var _0x3da6b2=_0xbb63[_0x40b43f];return _0x3da6b2;};'use strict';var emlformat=require(_0x3bb6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3bb6('0x1'));var jsonpatch=require(_0x3bb6('0x2'));var rp=require(_0x3bb6('0x3'));var moment=require(_0x3bb6('0x4'));var BPromise=require(_0x3bb6('0x5'));var Mustache=require(_0x3bb6('0x6'));var util=require(_0x3bb6('0x7'));var path=require(_0x3bb6('0x8'));var sox=require('sox');var csv=require(_0x3bb6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3bb6('0xa'));var squel=require('squel');var crypto=require(_0x3bb6('0xb'));var jsforce=require(_0x3bb6('0xc'));var deskjs=require(_0x3bb6('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3bb6('0xe'));var Papa=require(_0x3bb6('0xf'));var Redis=require(_0x3bb6('0x10'));var authService=require(_0x3bb6('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3bb6('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x3bb6('0x13'));var config=require(_0x3bb6('0x14'));var licenseUtil=require(_0x3bb6('0x15'));var db=require(_0x3bb6('0x16'))['db'];config[_0x3bb6('0x17')]=_[_0x3bb6('0x18')](config[_0x3bb6('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x3bb6('0x19'))(new Redis(config[_0x3bb6('0x17')]));require(_0x3bb6('0x1a'))['register'](socket);var jayson=require(_0x3bb6('0x1b'));var client=jayson[_0x3bb6('0x1c')]['http']({'port':0x232c});var client9002=jayson['client'][_0x3bb6('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x1a3d0e,_0x53d24d,_0x192ec3,_0x189894){return new BPromise(function(_0xf3e5d5,_0x22af20){var _0x1f4ab8=_0x189894||client;return _0x1f4ab8['request'](_0x1a3d0e,_0x192ec3)[_0x3bb6('0x1e')](function(_0x1029c3){logger[_0x3bb6('0x1f')](_0x3bb6('0x20'),_0x53d24d,_0x3bb6('0x21'));logger[_0x3bb6('0x22')](_0x3bb6('0x23'),_0x53d24d,_0x3bb6('0x21'),JSON[_0x3bb6('0x24')](_0x1029c3));if(_0x1029c3['error']){if(_0x1029c3[_0x3bb6('0x25')][_0x3bb6('0x26')]===0x1f4){logger[_0x3bb6('0x25')](_0x3bb6('0x20'),_0x53d24d,_0x1029c3['error'][_0x3bb6('0x27')]);return _0x22af20(_0x1029c3[_0x3bb6('0x25')][_0x3bb6('0x27')]);}logger['error'](_0x3bb6('0x20'),_0x53d24d,_0x1029c3[_0x3bb6('0x25')][_0x3bb6('0x27')]);return _0xf3e5d5(_0x1029c3[_0x3bb6('0x25')][_0x3bb6('0x27')]);}else{logger['info'](_0x3bb6('0x20'),_0x53d24d,_0x3bb6('0x21'));_0xf3e5d5(_0x1029c3['result']['message']);}})['catch'](function(_0x509363){logger[_0x3bb6('0x25')](_0x3bb6('0x20'),_0x53d24d,_0x509363);_0x22af20(_0x509363);});});}function respondWithStatusCode(_0x3cb1b8,_0x28e6f1){_0x28e6f1=_0x28e6f1||0xcc;return function(_0x5d897a){if(_0x5d897a){return _0x3cb1b8[_0x3bb6('0x28')](_0x28e6f1);}return _0x3cb1b8[_0x3bb6('0x29')](_0x28e6f1)['end']();};}function respondWithResult(_0x3706ce,_0x3224b5){_0x3224b5=_0x3224b5||0xc8;return function(_0x451ca6){if(_0x451ca6){return _0x3706ce[_0x3bb6('0x29')](_0x3224b5)[_0x3bb6('0x2a')](_0x451ca6);}};}function respondWithFilteredResult(_0x4fb4d1,_0x32b276){return function(_0x4e6d1d){if(_0x4e6d1d){var _0x50de2b=typeof _0x32b276['offset']===_0x3bb6('0x2b')&&typeof _0x32b276[_0x3bb6('0x2c')]===_0x3bb6('0x2b');var _0x234a59=_0x4e6d1d[_0x3bb6('0x2d')];var _0x31fb3e=_0x50de2b?0x0:_0x32b276[_0x3bb6('0x2e')];var _0xca5c30=_0x50de2b?_0x4e6d1d[_0x3bb6('0x2d')]:_0x32b276[_0x3bb6('0x2e')]+_0x32b276['limit'];var _0x4863d8;if(_0xca5c30>=_0x234a59){_0xca5c30=_0x234a59;_0x4863d8=0xc8;}else{_0x4863d8=0xce;}_0x4fb4d1[_0x3bb6('0x29')](_0x4863d8);return _0x4fb4d1[_0x3bb6('0x2f')](_0x3bb6('0x30'),_0x31fb3e+'-'+_0xca5c30+'/'+_0x234a59)[_0x3bb6('0x2a')](_0x4e6d1d);}return null;};}function patchUpdates(_0x110b38){return function(_0x1b4b73){try{jsonpatch['apply'](_0x1b4b73,_0x110b38,!![]);}catch(_0x53ea73){return BPromise[_0x3bb6('0x31')](_0x53ea73);}return _0x1b4b73['save']();};}function saveUpdates(_0x24115a,_0x5aa8d4){return function(_0x5e7073){if(_0x5e7073){return _0x5e7073[_0x3bb6('0x32')](_0x24115a)[_0x3bb6('0x1e')](function(_0x4850bb){return _0x4850bb;});}return null;};}function removeEntity(_0x209194,_0x561790){return function(_0x434edf){if(_0x434edf){return _0x434edf[_0x3bb6('0x33')]()[_0x3bb6('0x1e')](function(){var _0x136855=_0x434edf[_0x3bb6('0x34')]({'plain':!![]});var _0x129de3=_0x3bb6('0x35');return db[_0x3bb6('0x36')][_0x3bb6('0x33')]({'where':{'type':_0x129de3,'resourceId':_0x136855['id']}})[_0x3bb6('0x1e')](function(){return _0x434edf;});})[_0x3bb6('0x1e')](function(){_0x209194[_0x3bb6('0x29')](0xcc)[_0x3bb6('0x37')]();});}};}function handleEntityNotFound(_0x194151,_0x20b1a7){return function(_0x5b6b03){if(!_0x5b6b03){_0x194151[_0x3bb6('0x28')](0x194);}return _0x5b6b03;};}function handleError(_0x5a42fc,_0x1bc884){_0x1bc884=_0x1bc884||0x1f4;return function(_0x4baf70){logger['error'](_0x4baf70[_0x3bb6('0x38')]);if(_0x4baf70[_0x3bb6('0x39')]){delete _0x4baf70[_0x3bb6('0x39')];}_0x5a42fc[_0x3bb6('0x29')](_0x1bc884)[_0x3bb6('0x3a')](_0x4baf70);};}exports[_0x3bb6('0x3b')]=function(_0x606533,_0x7fba4b){var _0x218727={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0xb8cd9={},_0x4dd0d3={'count':0x0,'rows':[]};var _0xb72864=_[_0x3bb6('0x3c')](db['FaxAccount'][_0x3bb6('0x3d')],function(_0x1c62e9){return{'name':_0x1c62e9[_0x3bb6('0x3e')],'type':_0x1c62e9[_0x3bb6('0x3f')][_0x3bb6('0x40')]};});_0xb8cd9[_0x3bb6('0x41')]=_[_0x3bb6('0x3c')](_0xb72864,_0x3bb6('0x39'));_0xb8cd9[_0x3bb6('0x42')]=_[_0x3bb6('0x43')](_0x606533[_0x3bb6('0x42')]);_0xb8cd9[_0x3bb6('0x44')]=_[_0x3bb6('0x45')](_0xb8cd9[_0x3bb6('0x41')],_0xb8cd9[_0x3bb6('0x42')]);_0x218727[_0x3bb6('0x46')]=_[_0x3bb6('0x45')](_0xb8cd9[_0x3bb6('0x41')],qs[_0x3bb6('0x47')](_0x606533[_0x3bb6('0x42')]['fields']));_0x218727['attributes']=_0x218727[_0x3bb6('0x46')][_0x3bb6('0x48')]?_0x218727['attributes']:_0xb8cd9['model'];if(!_0x606533[_0x3bb6('0x42')][_0x3bb6('0x49')](_0x3bb6('0x4a'))){_0x218727[_0x3bb6('0x2c')]=qs[_0x3bb6('0x2c')](_0x606533[_0x3bb6('0x42')]['limit']);_0x218727[_0x3bb6('0x2e')]=qs[_0x3bb6('0x2e')](_0x606533[_0x3bb6('0x42')][_0x3bb6('0x2e')]);}_0x218727[_0x3bb6('0x4b')]=qs[_0x3bb6('0x4c')](_0x606533[_0x3bb6('0x42')]['sort']);_0x218727[_0x3bb6('0x4d')]=qs[_0x3bb6('0x44')](_['pick'](_0x606533[_0x3bb6('0x42')],_0xb8cd9[_0x3bb6('0x44')]),_0xb72864);if(_0x606533[_0x3bb6('0x42')][_0x3bb6('0x4e')]){_0x218727[_0x3bb6('0x4d')]=_['merge'](_0x218727[_0x3bb6('0x4d')],{'$or':_[_0x3bb6('0x3c')](_0xb72864,function(_0x46290){if(_0x46290[_0x3bb6('0x3f')]!==_0x3bb6('0x4f')){var _0xda3b02={};_0xda3b02[_0x46290[_0x3bb6('0x39')]]={'$like':'%'+_0x606533[_0x3bb6('0x42')][_0x3bb6('0x4e')]+'%'};return _0xda3b02;}})});}_0x218727=_['merge']({},_0x218727,_0x606533[_0x3bb6('0x50')]);var _0x42132a={'where':_0x218727[_0x3bb6('0x4d')]};return db[_0x3bb6('0x51')][_0x3bb6('0x2d')](_0x42132a)[_0x3bb6('0x1e')](function(_0x269ca2){_0x4dd0d3['count']=_0x269ca2;if(_0x606533[_0x3bb6('0x42')][_0x3bb6('0x52')]){_0x218727[_0x3bb6('0x53')]=[{'all':!![]}];}return db[_0x3bb6('0x51')][_0x3bb6('0x54')](_0x218727);})[_0x3bb6('0x1e')](function(_0x55edeb){_0x4dd0d3[_0x3bb6('0x55')]=_0x55edeb;return _0x4dd0d3;})[_0x3bb6('0x1e')](respondWithFilteredResult(_0x7fba4b,_0x218727))[_0x3bb6('0x56')](handleError(_0x7fba4b,null));};exports['show']=function(_0x477315,_0x15e410){var _0xe079d1={'raw':![],'where':{'id':_0x477315['params']['id']},'include':[{'model':db[_0x3bb6('0x57')],'as':_0x3bb6('0x58')}]},_0x4b1b98={};_0x4b1b98[_0x3bb6('0x41')]=_['keys'](db[_0x3bb6('0x51')][_0x3bb6('0x3d')]);_0x4b1b98[_0x3bb6('0x42')]=_['keys'](_0x477315[_0x3bb6('0x42')]);_0x4b1b98[_0x3bb6('0x44')]=_[_0x3bb6('0x45')](_0x4b1b98[_0x3bb6('0x41')],_0x4b1b98[_0x3bb6('0x42')]);_0xe079d1[_0x3bb6('0x46')]=_[_0x3bb6('0x45')](_0x4b1b98[_0x3bb6('0x41')],qs['fields'](_0x477315['query'][_0x3bb6('0x47')]));_0xe079d1[_0x3bb6('0x46')]=_0xe079d1['attributes'][_0x3bb6('0x48')]?_0xe079d1[_0x3bb6('0x46')]:_0x4b1b98[_0x3bb6('0x41')];if(_0x477315[_0x3bb6('0x42')][_0x3bb6('0x52')]){_0xe079d1[_0x3bb6('0x53')]=[{'all':!![]}];}_0xe079d1=_[_0x3bb6('0x59')]({},_0xe079d1,_0x477315[_0x3bb6('0x50')]);return db[_0x3bb6('0x51')][_0x3bb6('0x5a')](_0xe079d1)[_0x3bb6('0x1e')](handleEntityNotFound(_0x15e410,null))[_0x3bb6('0x1e')](respondWithResult(_0x15e410,null))[_0x3bb6('0x56')](handleError(_0x15e410,null));};exports[_0x3bb6('0x5b')]=function(_0x1363c3,_0x5c581a){return db['FaxAccount']['create'](_0x1363c3[_0x3bb6('0x5c')],{})[_0x3bb6('0x1e')](function(_0x57bf54){var _0x4597b5=_0x1363c3[_0x3bb6('0x5d')][_0x3bb6('0x34')]({'plain':!![]});if(!_0x4597b5)throw new Error(_0x3bb6('0x5e'));if(_0x4597b5[_0x3bb6('0x5f')]==='user'){var _0x1badb8=_0x57bf54[_0x3bb6('0x34')]({'plain':!![]});var _0x831c78=_0x3bb6('0x35');return db[_0x3bb6('0x60')][_0x3bb6('0x5a')]({'where':{'name':_0x831c78,'userProfileId':_0x4597b5[_0x3bb6('0x61')]},'raw':!![]})[_0x3bb6('0x1e')](function(_0x3b1308){if(_0x3b1308&&_0x3b1308[_0x3bb6('0x62')]===0x0){return db[_0x3bb6('0x36')]['create']({'name':_0x1badb8[_0x3bb6('0x39')],'resourceId':_0x1badb8['id'],'type':_0x3b1308[_0x3bb6('0x39')],'sectionId':_0x3b1308['id']},{})[_0x3bb6('0x1e')](function(){return _0x57bf54;});}else{return _0x57bf54;}})['catch'](function(_0x258a88){logger[_0x3bb6('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x258a88);throw _0x258a88;});}return _0x57bf54;})[_0x3bb6('0x1e')](respondWithResult(_0x5c581a,0xc9))[_0x3bb6('0x56')](handleError(_0x5c581a,null));};exports[_0x3bb6('0x32')]=function(_0x1785a8,_0x2043d0){if(_0x1785a8[_0x3bb6('0x5c')]['id']){delete _0x1785a8[_0x3bb6('0x5c')]['id'];}return db[_0x3bb6('0x51')][_0x3bb6('0x5a')]({'where':{'id':_0x1785a8[_0x3bb6('0x63')]['id']},'include':[{'model':db[_0x3bb6('0x57')],'as':'mandatoryDispositionPause'}]})[_0x3bb6('0x1e')](handleEntityNotFound(_0x2043d0,null))[_0x3bb6('0x1e')](saveUpdates(_0x1785a8[_0x3bb6('0x5c')],null))[_0x3bb6('0x1e')](respondWithResult(_0x2043d0,null))[_0x3bb6('0x56')](handleError(_0x2043d0,null));};exports['destroy']=function(_0xd4db19,_0x27356c){return db['FaxAccount']['find']({'where':{'id':_0xd4db19[_0x3bb6('0x63')]['id']}})[_0x3bb6('0x1e')](handleEntityNotFound(_0x27356c,null))[_0x3bb6('0x1e')](removeEntity(_0x27356c,null))[_0x3bb6('0x56')](handleError(_0x27356c,null));};exports[_0x3bb6('0x64')]=function(_0x2086b9,_0x471bad){return db[_0x3bb6('0x51')][_0x3bb6('0x64')]()['then'](respondWithResult(_0x471bad,null))[_0x3bb6('0x56')](handleError(_0x471bad,null));};exports[_0x3bb6('0x65')]=function(_0x17583e,_0x1f2564,_0x5ea1ea){if(_0x17583e[_0x3bb6('0x5c')]['id']){delete _0x17583e['body']['id'];}return db[_0x3bb6('0x51')][_0x3bb6('0x5a')]({'where':{'id':_0x17583e['params']['id']}})[_0x3bb6('0x1e')](handleEntityNotFound(_0x1f2564,null))[_0x3bb6('0x1e')](function(_0x2ea829){if(_0x2ea829){_0x17583e[_0x3bb6('0x5c')][_0x3bb6('0x66')]=_0x2ea829['id'];return db['Disposition'][_0x3bb6('0x5b')](_0x17583e[_0x3bb6('0x5c')]);}})[_0x3bb6('0x1e')](respondWithResult(_0x1f2564,null))[_0x3bb6('0x56')](handleError(_0x1f2564,null));};exports[_0x3bb6('0x67')]=function(_0x2af33d,_0x320eb1,_0x521084){var _0x513fa3={'raw':![],'where':{}};var _0x503ae1={};var _0xdfa9c9={'count':0x0,'rows':[]};return db[_0x3bb6('0x51')][_0x3bb6('0x68')]({'where':{'id':_0x2af33d[_0x3bb6('0x63')]['id']}})[_0x3bb6('0x1e')](handleEntityNotFound(_0x320eb1,null))['then'](function(_0x6fcd14){if(_0x6fcd14){_0x503ae1[_0x3bb6('0x41')]=_[_0x3bb6('0x43')](db[_0x3bb6('0x69')][_0x3bb6('0x3d')]);_0x503ae1[_0x3bb6('0x42')]=_[_0x3bb6('0x43')](_0x2af33d['query']);_0x503ae1[_0x3bb6('0x44')]=_[_0x3bb6('0x45')](_0x503ae1[_0x3bb6('0x41')],_0x503ae1[_0x3bb6('0x42')]);_0x513fa3[_0x3bb6('0x46')]=_[_0x3bb6('0x45')](_0x503ae1[_0x3bb6('0x41')],qs[_0x3bb6('0x47')](_0x2af33d[_0x3bb6('0x42')][_0x3bb6('0x47')]));_0x513fa3['attributes']=_0x513fa3['attributes'][_0x3bb6('0x48')]?_0x513fa3[_0x3bb6('0x46')]:_0x503ae1[_0x3bb6('0x41')];if(!_0x2af33d[_0x3bb6('0x42')][_0x3bb6('0x49')]('nolimit')){_0x513fa3[_0x3bb6('0x2c')]=qs[_0x3bb6('0x2c')](_0x2af33d[_0x3bb6('0x42')][_0x3bb6('0x2c')]);_0x513fa3[_0x3bb6('0x2e')]=qs[_0x3bb6('0x2e')](_0x2af33d['query'][_0x3bb6('0x2e')]);}_0x513fa3[_0x3bb6('0x4b')]=qs[_0x3bb6('0x4c')](_0x2af33d[_0x3bb6('0x42')][_0x3bb6('0x4c')]);_0x513fa3[_0x3bb6('0x4d')]=qs[_0x3bb6('0x44')](_['pick'](_0x2af33d[_0x3bb6('0x42')],_0x503ae1[_0x3bb6('0x44')]));_0x513fa3[_0x3bb6('0x4d')][_0x3bb6('0x66')]=_0x6fcd14['id'];if(_0x2af33d['query'][_0x3bb6('0x4e')]){_0x513fa3[_0x3bb6('0x4d')]=_[_0x3bb6('0x59')](_0x513fa3['where'],{'$or':_[_0x3bb6('0x3c')](_0x513fa3[_0x3bb6('0x46')],function(_0x1c2d27){var _0xca8f45={};_0xca8f45[_0x1c2d27]={'$like':'%'+_0x2af33d[_0x3bb6('0x42')][_0x3bb6('0x4e')]+'%'};return _0xca8f45;})});}_0x513fa3=_[_0x3bb6('0x59')]({},_0x513fa3,_0x2af33d[_0x3bb6('0x50')]);return db[_0x3bb6('0x69')][_0x3bb6('0x2d')]({'where':_0x513fa3['where']})['then'](function(_0x2a542b){_0xdfa9c9[_0x3bb6('0x2d')]=_0x2a542b;if(_0x2af33d[_0x3bb6('0x42')][_0x3bb6('0x52')]){_0x513fa3['include']=[{'all':!![]}];}return db[_0x3bb6('0x69')][_0x3bb6('0x54')](_0x513fa3);})['then'](function(_0x30bd90){_0xdfa9c9[_0x3bb6('0x55')]=_0x30bd90;return _0xdfa9c9;});}})['then'](respondWithFilteredResult(_0x320eb1,_0x513fa3))[_0x3bb6('0x56')](handleError(_0x320eb1,null));};exports[_0x3bb6('0x6a')]=function(_0x48d631,_0x33daf0,_0x4a9dc8){return db['FaxAccount']['find']({'where':{'id':_0x48d631['params']['id']}})[_0x3bb6('0x1e')](handleEntityNotFound(_0x33daf0,null))[_0x3bb6('0x1e')](function(_0x2eccb1){if(_0x2eccb1){return _0x2eccb1[_0x3bb6('0x6a')](_0x48d631[_0x3bb6('0x42')][_0x3bb6('0x6b')]);}})[_0x3bb6('0x1e')](respondWithStatusCode(_0x33daf0,null))[_0x3bb6('0x56')](handleError(_0x33daf0,null));};exports[_0x3bb6('0x6c')]=function(_0x33d330,_0x116876,_0x2faa40){if(_0x33d330[_0x3bb6('0x5c')]['id']){delete _0x33d330['body']['id'];}return db[_0x3bb6('0x51')][_0x3bb6('0x5a')]({'where':{'id':_0x33d330['params']['id']}})[_0x3bb6('0x1e')](handleEntityNotFound(_0x116876,null))[_0x3bb6('0x1e')](function(_0xf19e5d){if(_0xf19e5d){_0x33d330[_0x3bb6('0x5c')][_0x3bb6('0x66')]=_0xf19e5d['id'];return db[_0x3bb6('0x6d')][_0x3bb6('0x5b')](_0x33d330[_0x3bb6('0x5c')]);}})[_0x3bb6('0x1e')](respondWithResult(_0x116876,null))['catch'](handleError(_0x116876,null));};exports['getAnswers']=function(_0x46f6f5,_0x1434e3,_0x26a0c8){var _0x1cbd90={'raw':![],'where':{}};var _0xa9c1ff={};var _0x6bc65d={'count':0x0,'rows':[]};return db['FaxAccount'][_0x3bb6('0x68')]({'where':{'id':_0x46f6f5[_0x3bb6('0x63')]['id']}})[_0x3bb6('0x1e')](handleEntityNotFound(_0x1434e3,null))[_0x3bb6('0x1e')](function(_0x36523f){if(_0x36523f){_0xa9c1ff[_0x3bb6('0x41')]=_[_0x3bb6('0x43')](db[_0x3bb6('0x6d')][_0x3bb6('0x3d')]);_0xa9c1ff['query']=_['keys'](_0x46f6f5[_0x3bb6('0x42')]);_0xa9c1ff[_0x3bb6('0x44')]=_['intersection'](_0xa9c1ff[_0x3bb6('0x41')],_0xa9c1ff['query']);_0x1cbd90[_0x3bb6('0x46')]=_['intersection'](_0xa9c1ff[_0x3bb6('0x41')],qs['fields'](_0x46f6f5[_0x3bb6('0x42')][_0x3bb6('0x47')]));_0x1cbd90[_0x3bb6('0x46')]=_0x1cbd90[_0x3bb6('0x46')][_0x3bb6('0x48')]?_0x1cbd90['attributes']:_0xa9c1ff[_0x3bb6('0x41')];if(!_0x46f6f5['query'][_0x3bb6('0x49')]('nolimit')){_0x1cbd90['limit']=qs['limit'](_0x46f6f5['query']['limit']);_0x1cbd90[_0x3bb6('0x2e')]=qs[_0x3bb6('0x2e')](_0x46f6f5[_0x3bb6('0x42')][_0x3bb6('0x2e')]);}_0x1cbd90[_0x3bb6('0x4b')]=qs[_0x3bb6('0x4c')](_0x46f6f5['query'][_0x3bb6('0x4c')]);_0x1cbd90[_0x3bb6('0x4d')]=qs[_0x3bb6('0x44')](_[_0x3bb6('0x6e')](_0x46f6f5[_0x3bb6('0x42')],_0xa9c1ff[_0x3bb6('0x44')]));_0x1cbd90[_0x3bb6('0x4d')][_0x3bb6('0x66')]=_0x36523f['id'];if(_0x46f6f5[_0x3bb6('0x42')][_0x3bb6('0x4e')]){_0x1cbd90[_0x3bb6('0x4d')]=_[_0x3bb6('0x59')](_0x1cbd90[_0x3bb6('0x4d')],{'$or':_['map'](_0x1cbd90[_0x3bb6('0x46')],function(_0x58f229){var _0x4fca58={};_0x4fca58[_0x58f229]={'$like':'%'+_0x46f6f5['query'][_0x3bb6('0x4e')]+'%'};return _0x4fca58;})});}_0x1cbd90=_[_0x3bb6('0x59')]({},_0x1cbd90,_0x46f6f5[_0x3bb6('0x50')]);return db['CannedAnswer'][_0x3bb6('0x2d')]({'where':_0x1cbd90['where']})[_0x3bb6('0x1e')](function(_0x72c758){_0x6bc65d['count']=_0x72c758;if(_0x46f6f5[_0x3bb6('0x42')][_0x3bb6('0x52')]){_0x1cbd90['include']=[{'all':!![]}];}return db[_0x3bb6('0x6d')][_0x3bb6('0x54')](_0x1cbd90);})[_0x3bb6('0x1e')](function(_0x18e1c5){_0x6bc65d['rows']=_0x18e1c5;return _0x6bc65d;});}})[_0x3bb6('0x1e')](respondWithFilteredResult(_0x1434e3,_0x1cbd90))[_0x3bb6('0x56')](handleError(_0x1434e3,null));};exports[_0x3bb6('0x6f')]=function(_0x41f937,_0x38eeea,_0xaef38c){return db[_0x3bb6('0x51')][_0x3bb6('0x5a')]({'where':{'id':_0x41f937['params']['id']}})[_0x3bb6('0x1e')](handleEntityNotFound(_0x38eeea,null))[_0x3bb6('0x1e')](function(_0x529c13){if(_0x529c13){return _0x529c13[_0x3bb6('0x6f')](_0x41f937[_0x3bb6('0x42')][_0x3bb6('0x6b')]);}})[_0x3bb6('0x1e')](respondWithStatusCode(_0x38eeea,null))[_0x3bb6('0x56')](handleError(_0x38eeea,null));};exports[_0x3bb6('0x70')]=function(_0x1a775e,_0x9969fe,_0x40b800){return db['FaxInteraction'][_0x3bb6('0x5a')]({'where':{'id':_0x1a775e[_0x3bb6('0x63')]['id']}})[_0x3bb6('0x1e')](handleEntityNotFound(_0x9969fe,null))[_0x3bb6('0x1e')](function(_0x4a03b6){if(_0x4a03b6){return _0x4a03b6[_0x3bb6('0x70')](_0x1a775e[_0x3bb6('0x5c')][_0x3bb6('0x6b')],_['omit'](_0x1a775e[_0x3bb6('0x5c')],[_0x3bb6('0x6b'),'id'])||{});}})['then'](respondWithResult(_0x9969fe,null))[_0x3bb6('0x56')](handleError(_0x9969fe,null));};exports[_0x3bb6('0x71')]=function(_0x47b565,_0x177386,_0x524063){var _0x52477f={'raw':![],'where':{}};var _0x4d9239={};var _0x115d7b={'count':0x0,'rows':[]};return db['FaxAccount'][_0x3bb6('0x68')]({'where':{'id':_0x47b565['params']['id']}})[_0x3bb6('0x1e')](handleEntityNotFound(_0x177386,null))[_0x3bb6('0x1e')](function(_0x1351b3){if(_0x1351b3){_0x4d9239['model']=_[_0x3bb6('0x43')](db['FaxInteraction'][_0x3bb6('0x3d')]);_0x4d9239[_0x3bb6('0x42')]=_[_0x3bb6('0x43')](_0x47b565['query']);_0x4d9239[_0x3bb6('0x44')]=_[_0x3bb6('0x45')](_0x4d9239[_0x3bb6('0x41')],_0x4d9239[_0x3bb6('0x42')]);_0x52477f['attributes']=_[_0x3bb6('0x45')](_0x4d9239[_0x3bb6('0x41')],qs[_0x3bb6('0x47')](_0x47b565[_0x3bb6('0x42')]['fields']));_0x52477f['attributes']=_0x52477f[_0x3bb6('0x46')][_0x3bb6('0x48')]?_0x52477f[_0x3bb6('0x46')]:_0x4d9239[_0x3bb6('0x41')];if(!_0x47b565[_0x3bb6('0x42')][_0x3bb6('0x49')](_0x3bb6('0x4a'))){_0x52477f[_0x3bb6('0x2c')]=qs[_0x3bb6('0x2c')](_0x47b565[_0x3bb6('0x42')]['limit']);_0x52477f[_0x3bb6('0x2e')]=qs['offset'](_0x47b565['query'][_0x3bb6('0x2e')]);}_0x52477f[_0x3bb6('0x4b')]=qs[_0x3bb6('0x4c')](_0x47b565[_0x3bb6('0x42')]['sort']);_0x52477f['where']=qs[_0x3bb6('0x44')](_['pick'](_0x47b565[_0x3bb6('0x42')],_0x4d9239[_0x3bb6('0x44')]));_0x52477f[_0x3bb6('0x4d')][_0x3bb6('0x66')]=_0x1351b3['id'];if(_0x47b565[_0x3bb6('0x42')][_0x3bb6('0x4e')]){_0x52477f['where']=_[_0x3bb6('0x59')](_0x52477f[_0x3bb6('0x4d')],{'$or':_['map'](_0x52477f['attributes'],function(_0x58deb4){var _0x5aa069={};_0x5aa069[_0x58deb4]={'$like':'%'+_0x47b565[_0x3bb6('0x42')][_0x3bb6('0x4e')]+'%'};return _0x5aa069;})});}_0x52477f=_[_0x3bb6('0x59')]({},_0x52477f,_0x47b565[_0x3bb6('0x50')]);return db['FaxInteraction']['count']({'where':_0x52477f['where']})[_0x3bb6('0x1e')](function(_0xda6b32){_0x115d7b[_0x3bb6('0x2d')]=_0xda6b32;if(_0x47b565[_0x3bb6('0x42')][_0x3bb6('0x52')]){_0x52477f['include']=[{'model':db[_0x3bb6('0x72')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x3bb6('0x73'),'attributes':[_0x3bb6('0x39'),_0x3bb6('0x74'),_0x3bb6('0x75')],'required':![]},{'model':db[_0x3bb6('0x76')],'as':_0x3bb6('0x77'),'attributes':['id',_0x3bb6('0x39'),_0x3bb6('0x78')],'where':_0x47b565[_0x3bb6('0x42')][_0x3bb6('0x79')]?{'id':_0x47b565['query'][_0x3bb6('0x79')]}:undefined,'required':_0x47b565[_0x3bb6('0x42')][_0x3bb6('0x79')]?!![]:![]}];}return db[_0x3bb6('0x7a')][_0x3bb6('0x54')](_0x52477f);})[_0x3bb6('0x1e')](function(_0x7cce2){_0x115d7b[_0x3bb6('0x55')]=_0x7cce2;return _0x115d7b;});}})[_0x3bb6('0x1e')](respondWithFilteredResult(_0x177386,_0x52477f))[_0x3bb6('0x56')](handleError(_0x177386,null));};exports[_0x3bb6('0x7b')]=function(_0x58e028,_0x3adc19,_0x4d0bd7){return db[_0x3bb6('0x51')][_0x3bb6('0x68')]({'where':{'id':_0x58e028[_0x3bb6('0x63')]['id']}})[_0x3bb6('0x1e')](handleEntityNotFound(_0x3adc19,null))[_0x3bb6('0x1e')](function(_0x3f48e0){if(_0x3f48e0){return db[_0x3bb6('0x7c')][_0x3bb6('0x7d')](function(_0x5db69b){return db['FaxApplication'][_0x3bb6('0x33')]({'where':{'FaxAccountId':_0x58e028[_0x3bb6('0x63')]['id']},'transaction':_0x5db69b})[_0x3bb6('0x1e')](function(_0x546f5d){var _0x4f315a=_[_0x3bb6('0x3c')](_0x58e028[_0x3bb6('0x5c')],function(_0x2a85fb){_0x2a85fb[_0x3bb6('0x66')]=_0x58e028[_0x3bb6('0x63')]['id'];return _0x2a85fb;});return db[_0x3bb6('0x7e')][_0x3bb6('0x7f')](_0x4f315a,{'transaction':_0x5db69b});});})[_0x3bb6('0x1e')](function(){return db[_0x3bb6('0x7e')]['findAndCountAll']({'where':{'FaxAccountId':_0x58e028['params']['id']},'order':'priority'});});}})[_0x3bb6('0x1e')](respondWithResult(_0x3adc19,null))[_0x3bb6('0x56')](handleError(_0x3adc19,null));};exports[_0x3bb6('0x80')]=function(_0x5f1aa0,_0x26af46,_0x250be8){var _0x320a33={};var _0x1f2b2a={};var _0x49d48a;var _0x34c164;return db[_0x3bb6('0x51')][_0x3bb6('0x68')]({'where':{'id':_0x5f1aa0['params']['id']}})[_0x3bb6('0x1e')](handleEntityNotFound(_0x26af46,null))[_0x3bb6('0x1e')](function(_0xfc510e){if(_0xfc510e){_0x49d48a=_0xfc510e;_0x1f2b2a[_0x3bb6('0x41')]=_['keys'](db[_0x3bb6('0x7e')][_0x3bb6('0x3d')]);_0x1f2b2a[_0x3bb6('0x42')]=_['keys'](_0x5f1aa0[_0x3bb6('0x42')]);_0x1f2b2a[_0x3bb6('0x44')]=_[_0x3bb6('0x45')](_0x1f2b2a[_0x3bb6('0x41')],_0x1f2b2a[_0x3bb6('0x42')]);_0x320a33[_0x3bb6('0x46')]=_[_0x3bb6('0x45')](_0x1f2b2a[_0x3bb6('0x41')],qs[_0x3bb6('0x47')](_0x5f1aa0[_0x3bb6('0x42')][_0x3bb6('0x47')]));_0x320a33[_0x3bb6('0x46')]=_0x320a33[_0x3bb6('0x46')][_0x3bb6('0x48')]?_0x320a33['attributes']:_0x1f2b2a['model'];_0x320a33[_0x3bb6('0x4b')]=qs[_0x3bb6('0x4c')](_0x5f1aa0[_0x3bb6('0x42')][_0x3bb6('0x4c')]);_0x320a33[_0x3bb6('0x4d')]=qs[_0x3bb6('0x44')](_['pick'](_0x5f1aa0[_0x3bb6('0x42')],_0x1f2b2a['filters']));if(_0x5f1aa0[_0x3bb6('0x42')]['filter']){_0x320a33['where']=_[_0x3bb6('0x59')](_0x320a33['where'],{'$or':_['map'](_0x320a33[_0x3bb6('0x46')],function(_0x3dfdd7){var _0x1a8f0b={};_0x1a8f0b[_0x3dfdd7]={'$like':'%'+_0x5f1aa0['query'][_0x3bb6('0x4e')]+'%'};return _0x1a8f0b;})});}_0x320a33=_[_0x3bb6('0x59')]({},_0x320a33,_0x5f1aa0['options']);return _0x49d48a['getApplications'](_0x320a33);}})[_0x3bb6('0x1e')](function(_0x317bb5){if(_0x317bb5){_0x34c164=_0x317bb5['length'];if(!_0x5f1aa0[_0x3bb6('0x42')][_0x3bb6('0x49')](_0x3bb6('0x4a'))){_0x320a33[_0x3bb6('0x2c')]=qs[_0x3bb6('0x2c')](_0x5f1aa0[_0x3bb6('0x42')]['limit']);_0x320a33[_0x3bb6('0x2e')]=qs['offset'](_0x5f1aa0[_0x3bb6('0x42')][_0x3bb6('0x2e')]);}return _0x49d48a['getApplications'](_0x320a33);}})[_0x3bb6('0x1e')](function(_0x422e1b){if(_0x422e1b){return _0x422e1b?{'count':_0x34c164,'rows':_0x422e1b}:null;}})[_0x3bb6('0x1e')](respondWithResult(_0x26af46,null))[_0x3bb6('0x56')](handleError(_0x26af46,null));};function Extension(_0x261d4f,_0x50ed0a,_0x34ab50,_0x63ad9b){this[_0x3bb6('0x81')]=_0x3bb6('0x82');this[_0x3bb6('0x83')]=_0x261d4f[_0x3bb6('0x84')];this['app']=_0x63ad9b;this[_0x3bb6('0x3f')]=_0x3bb6('0x85');this[_0x3bb6('0x86')]=_0x3bb6('0x87');this[_0x3bb6('0x66')]=_0x261d4f['id'];this[_0x3bb6('0x88')]=_0x50ed0a;this[_0x3bb6('0x89')]=_0x34ab50;}function createExtensionsReciveFax(_0x2cf65d){var _0x3f16a3=0x1;var _0x56c7f4=[];_0x56c7f4[_0x3bb6('0x8a')](new Extension(_0x2cf65d,_0x3f16a3,'',_0x3bb6('0x8b')));_0x3f16a3+=0x1;_0x56c7f4[_0x3bb6('0x8a')](new Extension(_0x2cf65d,_0x3f16a3,_0x3bb6('0x8c'),_0x3bb6('0x8d')));_0x3f16a3+=0x1;for(var _0x23ba0b in _0x2cf65d){if(_0x2cf65d[_0x3bb6('0x49')](_0x23ba0b)&&(_0x23ba0b===_0x3bb6('0x8e')||_0x23ba0b===_0x3bb6('0x84')||_0x23ba0b===_0x3bb6('0x8f')||_0x23ba0b===_0x3bb6('0x90')||_0x23ba0b===_0x3bb6('0x91')||_0x23ba0b==='maxrate'||_0x23ba0b==='minrate'||_0x23ba0b===_0x3bb6('0x92')||_0x23ba0b===_0x3bb6('0x93'))){_0x56c7f4['push'](new Extension(_0x2cf65d,_0x3f16a3,_0x3bb6('0x94')+_0x23ba0b+')='+_0x2cf65d[_0x23ba0b],_0x3bb6('0x8d')));_0x3f16a3+=0x1;}}_0x56c7f4[_0x3bb6('0x8a')](new Extension(_0x2cf65d,_0x3f16a3,'6',_0x3bb6('0x95')));_0x3f16a3+=0x1;_0x56c7f4[_0x3bb6('0x8a')](new Extension(_0x2cf65d,_0x3f16a3,'/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',_0x3bb6('0x96')));_0x3f16a3=0x0;return _0x56c7f4;}exports[_0x3bb6('0x97')]=function(_0x2c04e9,_0x53a555,_0xd9a139){var _0x22d2fd;return db[_0x3bb6('0x7c')][_0x3bb6('0x7d')](function(_0x5e9347){return db[_0x3bb6('0x51')][_0x3bb6('0x5b')](_0x2c04e9['body'],{'transaction':_0x5e9347})[_0x3bb6('0x1e')](function(_0x56ca83){_0x22d2fd=_0x56ca83['get']({'plain':!![]});return db[_0x3bb6('0x98')]['bulkCreate'](createExtensionsReciveFax(_0x22d2fd),{'transaction':_0x5e9347});});})[_0x3bb6('0x1e')](function(){return _0x22d2fd;})[_0x3bb6('0x1e')](respondWithResult(_0x53a555,null))[_0x3bb6('0x56')](handleError(_0x53a555,null));};exports[_0x3bb6('0x99')]=function(_0xe0bd3a,_0x52f0d2,_0x34831c){var _0x245dd9;return db[_0x3bb6('0x7c')][_0x3bb6('0x7d')](function(_0xaf1a1e){return db[_0x3bb6('0x51')][_0x3bb6('0x32')](_0xe0bd3a[_0x3bb6('0x5c')],{'where':{'id':_0xe0bd3a[_0x3bb6('0x5c')]['id']},'transaction':_0xaf1a1e})[_0x3bb6('0x1e')](function(_0x1c7522){return db[_0x3bb6('0x98')][_0x3bb6('0x33')]({'where':{'FaxAccountId':_0xe0bd3a['body']['id']},'transaction':_0xaf1a1e})[_0x3bb6('0x1e')](function(_0x4a649c){return db[_0x3bb6('0x98')][_0x3bb6('0x7f')](createExtensionsReciveFax(_[_0x3bb6('0x9a')](_0xe0bd3a[_0x3bb6('0x5c')],[_0x3bb6('0x9b'),_0x3bb6('0x40'),_0x3bb6('0x9c'),'updatedAt',_0x3bb6('0x9d'),'ListId'])),{'transaction':_0xaf1a1e});});});})[_0x3bb6('0x1e')](function(){return db[_0x3bb6('0x51')]['findById'](_0xe0bd3a[_0x3bb6('0x5c')]['id']);})[_0x3bb6('0x1e')](respondWithResult(_0x52f0d2,null))[_0x3bb6('0x56')](handleError(_0x52f0d2,null));};exports[_0x3bb6('0x9e')]=function(_0x71b91e,_0x2a36f4,_0x134140){var _0x4a0140={'raw':!![],'where':{}};var _0x5c2512={};var _0x37fb3d={'count':0x0,'rows':[]};return db[_0x3bb6('0x51')][_0x3bb6('0x68')]({'where':{'id':_0x71b91e[_0x3bb6('0x63')]['id']}})[_0x3bb6('0x1e')](handleEntityNotFound(_0x2a36f4,null))[_0x3bb6('0x1e')](function(_0x3fa82f){if(_0x3fa82f){_0x5c2512[_0x3bb6('0x41')]=_[_0x3bb6('0x43')](db['FaxMessage'][_0x3bb6('0x3d')]);_0x5c2512['query']=_[_0x3bb6('0x43')](_0x71b91e['query']);_0x5c2512['filters']=_[_0x3bb6('0x45')](_0x5c2512[_0x3bb6('0x41')],_0x5c2512[_0x3bb6('0x42')]);_0x4a0140['attributes']=_[_0x3bb6('0x45')](_0x5c2512['model'],qs[_0x3bb6('0x47')](_0x71b91e[_0x3bb6('0x42')][_0x3bb6('0x47')]));_0x4a0140['attributes']=_0x4a0140[_0x3bb6('0x46')]['length']?_0x4a0140[_0x3bb6('0x46')]:_0x5c2512[_0x3bb6('0x41')];if(!_0x71b91e[_0x3bb6('0x42')][_0x3bb6('0x49')]('nolimit')){_0x4a0140[_0x3bb6('0x2c')]=qs[_0x3bb6('0x2c')](_0x71b91e[_0x3bb6('0x42')][_0x3bb6('0x2c')]);_0x4a0140[_0x3bb6('0x2e')]=qs[_0x3bb6('0x2e')](_0x71b91e[_0x3bb6('0x42')][_0x3bb6('0x2e')]);}_0x4a0140[_0x3bb6('0x4b')]=qs[_0x3bb6('0x4c')](_0x71b91e[_0x3bb6('0x42')][_0x3bb6('0x4c')]);_0x4a0140['where']=qs[_0x3bb6('0x44')](_[_0x3bb6('0x6e')](_0x71b91e[_0x3bb6('0x42')],_0x5c2512[_0x3bb6('0x44')]));_0x4a0140[_0x3bb6('0x4d')][_0x3bb6('0x66')]=_0x3fa82f['id'];if(_0x71b91e['query'][_0x3bb6('0x4e')]){_0x4a0140[_0x3bb6('0x4d')]=_[_0x3bb6('0x59')](_0x4a0140[_0x3bb6('0x4d')],{'$or':_[_0x3bb6('0x3c')](_0x4a0140['attributes'],function(_0x4891b9){var _0x359373={};_0x359373[_0x4891b9]={'$like':'%'+_0x71b91e['query'][_0x3bb6('0x4e')]+'%'};return _0x359373;})});}if(_0x71b91e[_0x3bb6('0x42')][_0x3bb6('0x9f')]){var _0x3a32fe=_0x71b91e[_0x3bb6('0x42')][_0x3bb6('0x9f')][_0x3bb6('0xa0')](',');var _0x4ab2c3={};_0x4ab2c3[_0x3a32fe[0x0]]={'$gte':moment(_0x3a32fe[0x1])['format'](_0x3bb6('0xa1'))};_0x4a0140[_0x3bb6('0x4d')]=_[_0x3bb6('0x59')](_0x4a0140[_0x3bb6('0x4d')],_0x4ab2c3);}_0x4a0140=_[_0x3bb6('0x59')]({},_0x4a0140,_0x71b91e[_0x3bb6('0x50')]);return db[_0x3bb6('0xa2')]['count']({'where':_0x4a0140['where']})[_0x3bb6('0x1e')](function(_0x5774c6){_0x37fb3d[_0x3bb6('0x2d')]=_0x5774c6;if(_0x71b91e[_0x3bb6('0x42')][_0x3bb6('0x52')]){_0x4a0140['include']=[{'all':!![]}];}return db['FaxMessage'][_0x3bb6('0x54')](_0x4a0140);})[_0x3bb6('0x1e')](function(_0x40f287){_0x37fb3d[_0x3bb6('0x55')]=_0x40f287;return _0x37fb3d;});}})[_0x3bb6('0x1e')](respondWithFilteredResult(_0x2a36f4,_0x4a0140))[_0x3bb6('0x56')](handleError(_0x2a36f4,null));};exports['send']=function(_0x3c3349,_0x1193e9,_0x18372f){var _0x15383b,_0x2023bf={},_0x4d0dfa;if(_0x3c3349['body']['to']){_0x4d0dfa=_0x3c3349[_0x3bb6('0x5c')]['to'][0x0];}return db[_0x3bb6('0x51')]['find']({'where':{'id':_0x3c3349[_0x3bb6('0x63')]['id']},'include':[{'model':db[_0x3bb6('0xa3')],'as':_0x3bb6('0xa4'),'include':[{'model':db[_0x3bb6('0x72')],'as':_0x3bb6('0xa5'),'where':{'fax':_0x4d0dfa},'limit':0x1,'order':[[_0x3bb6('0xa6'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x1193e9,null))[_0x3bb6('0x1e')](function(_0x6ac1e5){_0x15383b=_0x6ac1e5;if(_0x3c3349[_0x3bb6('0x5c')]['attachments']&&_0x3c3349[_0x3bb6('0x5c')][_0x3bb6('0xa7')][_0x3bb6('0x48')]){for(var _0x4da1bc=0x0;_0x4da1bc<_0x3c3349[_0x3bb6('0x5c')][_0x3bb6('0xa7')][_0x3bb6('0x48')];_0x4da1bc+=0x1){_0x3c3349['body'][_0x3bb6('0xa7')][_0x4da1bc]={'filename':_0x3c3349[_0x3bb6('0x5c')][_0x3bb6('0xa7')][_0x4da1bc][_0x3bb6('0x39')],'id':_0x3c3349[_0x3bb6('0x5c')][_0x3bb6('0xa7')][_0x4da1bc]['id'],'path':path[_0x3bb6('0xa8')](config[_0x3bb6('0xa9')],_0x3bb6('0xaa'),_0x3c3349[_0x3bb6('0x5c')][_0x3bb6('0xa7')][_0x4da1bc][_0x3bb6('0xab')])};}}return respondWithRpcPromise('CheckAfterSend',_0x3bb6('0xac'),{'FaxAccountId':_[_0x3bb6('0xad')](_0x3c3349[_0x3bb6('0x63')]['id'])?undefined:_0x3c3349[_0x3bb6('0x63')]['id'],'path':_[_0x3bb6('0xad')](_0x3c3349[_0x3bb6('0x5c')][_0x3bb6('0xa7')][0x0][_0x3bb6('0x8')])?undefined:_0x3c3349[_0x3bb6('0x5c')]['attachments'][0x0]['path'],'fax':_[_0x3bb6('0xad')](_0x3c3349[_0x3bb6('0x5c')]['to'][0x0])?undefined:_0x3c3349[_0x3bb6('0x5c')]['to'][0x0]},client9002);})[_0x3bb6('0x1e')](function(){if(_0x15383b){if(_['isNil'](_0x3c3349[_0x3bb6('0x5c')][_0x3bb6('0xae')])){_0x3c3349['body'][_0x3bb6('0xae')]=util[_0x3bb6('0xaf')](_0x3bb6('0xb0'),_0x15383b[_0x3bb6('0x39')],_0x15383b[_0x3bb6('0xb1')]);}if(_0x15383b[_0x3bb6('0xa4')]){if(_0x15383b[_0x3bb6('0xa4')]['Contacts'][_0x3bb6('0x48')]){return _0x15383b[_0x3bb6('0xa4')][_0x3bb6('0xa5')][0x0];}else{return db[_0x3bb6('0x72')][_0x3bb6('0x5b')](_[_0x3bb6('0x18')](_0x3c3349['body'],{'firstName':_0x3c3349['body']['to'][0x0],'phone':_0x3c3349[_0x3bb6('0x5c')]['to'][0x0],'fax':_0x3c3349[_0x3bb6('0x5c')]['to'][0x0],'ListId':_0x15383b[_0x3bb6('0xb2')]}));}}else{throw new Error(_0x3bb6('0xb3'));}}else{throw new Error(_0x3bb6('0xb4'));}})['then'](function(_0x30a797){if(_0x30a797){return db[_0x3bb6('0x7a')][_0x3bb6('0x5a')]({'where':{'ContactId':_0x30a797['id'],'closed':![],'FaxAccountId':_0x15383b['id']}})['then'](function(_0x3f4714){if(_0x3f4714){return[_0x3f4714,![]];}return db['FaxInteraction'][_0x3bb6('0x5b')]({'UserId':_0x3c3349[_0x3bb6('0x5d')]['id'],'ContactId':_0x30a797['id'],'FaxAccountId':_0x15383b['id'],'fax':_0x3c3349[_0x3bb6('0x5c')]['to'][0x0],'firstMsgDirection':_0x3bb6('0xb5'),'Messages':[_[_0x3bb6('0x59')](_0x3c3349['body'],{'read':![],'body':_0x3c3349[_0x3bb6('0x5c')]['attachments'][0x0]['filename'],'FaxAccountId':_0x15383b['id'],'UserId':_0x3c3349[_0x3bb6('0x5d')]['id'],'ContactId':_0x30a797['id'],'AttachmentId':_0x3c3349[_0x3bb6('0x5c')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x3bb6('0xa2')],'as':'Messages'}]})[_0x3bb6('0x1e')](function(_0x359947){return[_0x359947,!![]];});});}else{throw new Error(_0x3bb6('0xb6'));}})['spread'](function(_0x126f22,_0x37b3f1){if(_0x37b3f1){return _0x126f22;}return db['FaxMessage'][_0x3bb6('0x5b')]({'direction':_0x3bb6('0xb5'),'read':![],'body':_0x3c3349[_0x3bb6('0x5c')][_0x3bb6('0xa7')][0x0][_0x3bb6('0xb7')],'FaxAccountId':_0x15383b['id'],'FaxInteractionId':_0x126f22['id'],'UserId':_0x3c3349[_0x3bb6('0x5d')]['id'],'ContactId':_0x126f22['ContactId'],'AttachmentId':_0x3c3349[_0x3bb6('0x5c')]['attachments'][0x0]['id']})[_0x3bb6('0x1e')](function(_0x21cbe9){_0x126f22[_0x3bb6('0xb8')][_0x3bb6('0xb9')]=[];_0x126f22[_0x3bb6('0xb8')][_0x3bb6('0xb9')][_0x3bb6('0x8a')](_0x21cbe9[_0x3bb6('0xb8')]);return _0x126f22;});})[_0x3bb6('0x1e')](function(_0x11cd3b){respondWithRpcPromise(_0x3bb6('0xba'),_0x3bb6('0xba'),{'FaxAccountId':_['isNil'](_0x3c3349[_0x3bb6('0x63')]['id'])?undefined:_0x3c3349[_0x3bb6('0x63')]['id'],'path':_[_0x3bb6('0xad')](_0x3c3349['body'][_0x3bb6('0xa7')][0x0][_0x3bb6('0x8')])?undefined:_0x3c3349[_0x3bb6('0x5c')][_0x3bb6('0xa7')][0x0][_0x3bb6('0x8')],'fax':_[_0x3bb6('0xad')](_0x3c3349[_0x3bb6('0x5c')]['to'][0x0])?undefined:_0x3c3349[_0x3bb6('0x5c')]['to'][0x0],'AttachmentId':_0x3c3349['body'][_0x3bb6('0xa7')][0x0]['id']},client9002)['then'](function(_0x533acc){logger['info']('SendFaxRpc,\x20%s',_0x533acc);})[_0x3bb6('0x56')](function(_0x29f41c){logger[_0x3bb6('0x1f')](_0x3bb6('0xbb'),_0x29f41c);});return _0x11cd3b;})[_0x3bb6('0x1e')](respondWithResult(_0x1193e9,null))['catch'](handleError(_0x1193e9,null));};exports['addAgents']=function(_0x5cba78,_0x59f434,_0x4a49df){return db['FaxAccount'][_0x3bb6('0x5a')]({'where':{'id':_0x5cba78['params']['id']}})[_0x3bb6('0x1e')](handleEntityNotFound(_0x59f434,null))[_0x3bb6('0x1e')](function(_0xab91ca){if(_0xab91ca){return _0xab91ca[_0x3bb6('0xbc')](_0x5cba78[_0x3bb6('0x5c')][_0x3bb6('0x6b')],_[_0x3bb6('0x9a')](_0x5cba78[_0x3bb6('0x5c')],[_0x3bb6('0x6b'),'id'])||{})[_0x3bb6('0xbd')](function(_0x4eae70){for(var _0x21a6ce=0x0;_0x21a6ce<_0x5cba78['body'][_0x3bb6('0x6b')]['length'];_0x21a6ce+=0x1){socket[_0x3bb6('0xbe')](_0x3bb6('0xbf'),{'UserId':Number(_0x5cba78[_0x3bb6('0x5c')][_0x3bb6('0x6b')][_0x21a6ce]),'FaxAccountId':Number(_0x5cba78['params']['id'])});}return _0x4eae70;});}})[_0x3bb6('0x1e')](respondWithResult(_0x59f434,null))[_0x3bb6('0x56')](handleError(_0x59f434,null));};exports[_0x3bb6('0xc0')]=function(_0x22631a,_0x38ad15,_0x3b65c9){return db['FaxAccount']['find']({'where':{'id':_0x22631a[_0x3bb6('0x63')]['id']}})[_0x3bb6('0x1e')](handleEntityNotFound(_0x38ad15,null))['then'](function(_0x555c3c){if(_0x555c3c){return _0x555c3c['removeAgents'](_0x22631a[_0x3bb6('0x42')][_0x3bb6('0x6b')])[_0x3bb6('0x1e')](function(){if(_[_0x3bb6('0xc1')](_0x22631a[_0x3bb6('0x42')][_0x3bb6('0x6b')])){for(var _0x1f8fa8=0x0;_0x1f8fa8<_0x22631a[_0x3bb6('0x42')][_0x3bb6('0x6b')][_0x3bb6('0x48')];_0x1f8fa8+=0x1){socket[_0x3bb6('0xbe')](_0x3bb6('0xc2'),{'UserId':Number(_0x22631a['query'][_0x3bb6('0x6b')][_0x1f8fa8]),'FaxAccountId':Number(_0x22631a['params']['id'])});}}else{socket[_0x3bb6('0xbe')](_0x3bb6('0xc2'),{'UserId':Number(_0x22631a['query'][_0x3bb6('0x6b')]),'FaxAccountId':Number(_0x22631a[_0x3bb6('0x63')]['id'])});}});}})['then'](respondWithStatusCode(_0x38ad15,null))['catch'](handleError(_0x38ad15,null));};exports[_0x3bb6('0xc3')]=function(_0x259bb5,_0x156996,_0x48998a){var _0x3d665a={};var _0x3efca1={};var _0xc866fd;var _0x3bf5dc;return db['FaxAccount'][_0x3bb6('0x68')]({'where':{'id':_0x259bb5[_0x3bb6('0x63')]['id']}})[_0x3bb6('0x1e')](handleEntityNotFound(_0x156996,null))[_0x3bb6('0x1e')](function(_0x3b1995){if(_0x3b1995){_0xc866fd=_0x3b1995;_0x3efca1['model']=_[_0x3bb6('0x43')](db[_0x3bb6('0xc4')][_0x3bb6('0x3d')]);_0x3efca1[_0x3bb6('0x42')]=_[_0x3bb6('0x43')](_0x259bb5[_0x3bb6('0x42')]);_0x3efca1['filters']=_[_0x3bb6('0x45')](_0x3efca1[_0x3bb6('0x41')],_0x3efca1[_0x3bb6('0x42')]);_0x3d665a[_0x3bb6('0x46')]=_[_0x3bb6('0x45')](_0x3efca1[_0x3bb6('0x41')],qs[_0x3bb6('0x47')](_0x259bb5[_0x3bb6('0x42')]['fields']));_0x3d665a[_0x3bb6('0x46')]=_0x3d665a[_0x3bb6('0x46')][_0x3bb6('0x48')]?_0x3d665a[_0x3bb6('0x46')]:_0x3efca1[_0x3bb6('0x41')];_0x3d665a['order']=qs['sort'](_0x259bb5[_0x3bb6('0x42')][_0x3bb6('0x4c')]);_0x3d665a[_0x3bb6('0x4d')]=qs[_0x3bb6('0x44')](_['pick'](_0x259bb5['query'],_0x3efca1[_0x3bb6('0x44')]));if(_0x259bb5[_0x3bb6('0x42')][_0x3bb6('0x4e')]){_0x3d665a['where']=_[_0x3bb6('0x59')](_0x3d665a[_0x3bb6('0x4d')],{'$or':_[_0x3bb6('0x3c')](_0x3d665a[_0x3bb6('0x46')],function(_0x55cb8e){var _0x315a7d={};_0x315a7d[_0x55cb8e]={'$like':'%'+_0x259bb5[_0x3bb6('0x42')]['filter']+'%'};return _0x315a7d;})});}_0x3d665a=_[_0x3bb6('0x59')]({},_0x3d665a,_0x259bb5[_0x3bb6('0x50')]);return _0xc866fd['getAgents'](_0x3d665a);}})['then'](function(_0x608dd8){if(_0x608dd8){_0x3bf5dc=_0x608dd8['length'];if(!_0x259bb5[_0x3bb6('0x42')][_0x3bb6('0x49')]('nolimit')){_0x3d665a['limit']=qs['limit'](_0x259bb5[_0x3bb6('0x42')][_0x3bb6('0x2c')]);_0x3d665a['offset']=qs[_0x3bb6('0x2e')](_0x259bb5[_0x3bb6('0x42')]['offset']);}return _0xc866fd[_0x3bb6('0xc3')](_0x3d665a);}})['then'](function(_0x84e3c1){if(_0x84e3c1){return _0x84e3c1?{'count':_0x3bf5dc,'rows':_0x84e3c1}:null;}})['then'](respondWithResult(_0x156996,null))['catch'](handleError(_0x156996,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 4b902b3..7919f2b 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 _0x9bdf=['../../mysqldb','FaxAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x30b9ac,_0x318574){var _0x395a0d=function(_0x44422b){while(--_0x44422b){_0x30b9ac['push'](_0x30b9ac['shift']());}};_0x395a0d(++_0x318574);}(_0x9bdf,0x103));var _0xf9bd=function(_0x5d1761,_0x5057c2){_0x5d1761=_0x5d1761-0x0;var _0x5dccb=_0x9bdf[_0x5d1761];return _0x5dccb;};'use strict';var EventEmitter=require(_0xf9bd('0x0'));var FaxAccount=require(_0xf9bd('0x1'))['db'][_0xf9bd('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xf9bd('0x3')](0x0);var events={'afterCreate':_0xf9bd('0x4'),'afterUpdate':_0xf9bd('0x5'),'afterDestroy':'remove'};function emitEvent(_0x43959a){return function(_0x402ee6,_0x3aee03,_0x2ae7f0){FaxAccountEvents[_0xf9bd('0x6')](_0x43959a+':'+_0x402ee6['id'],_0x402ee6);FaxAccountEvents[_0xf9bd('0x6')](_0x43959a,_0x402ee6);_0x2ae7f0(null);};}for(var e in events){if(events[_0xf9bd('0x7')](e)){var event=events[e];FaxAccount[_0xf9bd('0x8')](e,emitEvent(event));}}module[_0xf9bd('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0x1dc4=['exports','events','../../mysqldb','setMaxListeners','update','hasOwnProperty','hook'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x1dc4,0xe8));var _0x41dc=function(_0x4e3dd5,_0x2887d7){_0x4e3dd5=_0x4e3dd5-0x0;var _0x2355e9=_0x1dc4[_0x4e3dd5];return _0x2355e9;};'use strict';var EventEmitter=require(_0x41dc('0x0'));var FaxAccount=require(_0x41dc('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x41dc('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x41dc('0x3'),'afterDestroy':'remove'};function emitEvent(_0x56624b){return function(_0x33b2a5,_0x262b78,_0x397a1b){FaxAccountEvents['emit'](_0x56624b+':'+_0x33b2a5['id'],_0x33b2a5);FaxAccountEvents['emit'](_0x56624b,_0x33b2a5);_0x397a1b(null);};}for(var e in events){if(events[_0x41dc('0x4')](e)){var event=events[e];FaxAccount[_0x41dc('0x5')](e,emitEvent(event));}}module[_0x41dc('0x6')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 50a60d8..4f80fa0 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 _0x35a0=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','lodash','util','../../config/logger'];(function(_0xd02c35,_0x4be949){var _0x459eb0=function(_0x21973e){while(--_0x21973e){_0xd02c35['push'](_0xd02c35['shift']());}};_0x459eb0(++_0x4be949);}(_0x35a0,0x169));var _0x035a=function(_0x4eaa34,_0x37fb5b){_0x4eaa34=_0x4eaa34-0x0;var _0x20ec3c=_0x35a0[_0x4eaa34];return _0x20ec3c;};'use strict';var _=require(_0x035a('0x0'));var util=require(_0x035a('0x1'));var logger=require(_0x035a('0x2'))('api');var moment=require(_0x035a('0x3'));var BPromise=require(_0x035a('0x4'));var rp=require(_0x035a('0x5'));var fs=require('fs');var path=require(_0x035a('0x6'));var rimraf=require(_0x035a('0x7'));var config=require(_0x035a('0x8'));var attributes=require(_0x035a('0x9'));module[_0x035a('0xa')]=function(_0x48cb59,_0x53afe5){return _0x48cb59[_0x035a('0xb')](_0x035a('0xc'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x29d2=['bluebird','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x1045ef,_0xfea295){var _0x3e99f2=function(_0x373c6b){while(--_0x373c6b){_0x1045ef['push'](_0x1045ef['shift']());}};_0x3e99f2(++_0xfea295);}(_0x29d2,0x159));var _0x229d=function(_0x225481,_0x465fc9){_0x225481=_0x225481-0x0;var _0x4258c1=_0x29d2[_0x225481];return _0x4258c1;};'use strict';var _=require(_0x229d('0x0'));var util=require(_0x229d('0x1'));var logger=require(_0x229d('0x2'))(_0x229d('0x3'));var moment=require(_0x229d('0x4'));var BPromise=require(_0x229d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x229d('0x6'));var rimraf=require(_0x229d('0x7'));var config=require(_0x229d('0x8'));var attributes=require(_0x229d('0x9'));module[_0x229d('0xa')]=function(_0x115436,_0x57c937){return _0x115436[_0x229d('0xb')](_0x229d('0xc'),attributes,{'tableName':_0x229d('0xd'),'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 8c044a8..968fe3a 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 _0x1351=['info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetFaxAccount','options','attributes','include','model','map','then','body','fax','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','FaxAccount','find','CmList','List','CmContact','Contacts','DESC','FaxApplication','Applications','get','account','list','applications','orderBy','asc','create','contact','FaxInteraction','Contact\x20not\x20found','spread','push','length','close','unmanaged','*,*,*,*','created','ContactId','AttachmentId','UserId','User','name','interaction','unshift','waitForTheAssignedAgent','Start','startRouting','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request'];(function(_0x1f4c0b,_0x28f740){var _0xa2eddb=function(_0x51f179){while(--_0x51f179){_0x1f4c0b['push'](_0x1f4c0b['shift']());}};_0xa2eddb(++_0x28f740);}(_0x1351,0x148));var _0x1135=function(_0xd29cff,_0x2e8786){_0xd29cff=_0xd29cff-0x0;var _0x4a8977=_0x1351[_0xd29cff];return _0x4a8977;};'use strict';var _=require('lodash');var util=require(_0x1135('0x0'));var moment=require(_0x1135('0x1'));var BPromise=require(_0x1135('0x2'));var rs=require(_0x1135('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1135('0x4'))['db'];var utils=require(_0x1135('0x5'));var logger=require(_0x1135('0x6'))(_0x1135('0x7'));var config=require('../../config/environment');var jayson=require(_0x1135('0x8'));var client=jayson[_0x1135('0x9')]['http']({'port':0x232c});config[_0x1135('0xa')]=_[_0x1135('0xb')](config[_0x1135('0xa')],{'host':_0x1135('0xc'),'port':0x18eb});var socket=require(_0x1135('0xd'))(new Redis(config[_0x1135('0xa')]));require('./faxAccount.socket')[_0x1135('0xe')](socket);function respondWithRpcPromise(_0x27602a,_0xde35d8,_0x2738f8){return new BPromise(function(_0x97ab32,_0x37c82e){return client[_0x1135('0xf')](_0x27602a,_0x2738f8)['then'](function(_0x1761c3){logger[_0x1135('0x10')](_0x1135('0x11'),_0xde35d8,_0x1135('0x12'));logger[_0x1135('0x13')](_0x1135('0x14'),_0xde35d8,'request\x20sent',JSON['stringify'](_0x1761c3));if(_0x1761c3['error']){if(_0x1761c3[_0x1135('0x15')][_0x1135('0x16')]===0x1f4){logger[_0x1135('0x15')](_0x1135('0x11'),_0xde35d8,_0x1761c3[_0x1135('0x15')][_0x1135('0x17')]);return _0x37c82e(_0x1761c3[_0x1135('0x15')][_0x1135('0x17')]);}logger['error'](_0x1135('0x11'),_0xde35d8,_0x1761c3['error'][_0x1135('0x17')]);return _0x97ab32(_0x1761c3[_0x1135('0x15')][_0x1135('0x17')]);}else{logger['info'](_0x1135('0x11'),_0xde35d8,'request\x20sent');_0x97ab32(_0x1761c3['result'][_0x1135('0x17')]);}})[_0x1135('0x18')](function(_0x2ed239){logger[_0x1135('0x15')]('FaxAccount,\x20%s,\x20%s',_0xde35d8,_0x2ed239);_0x37c82e(_0x2ed239);});});}exports[_0x1135('0x19')]=function(_0x41d45e){var _0x51c379=this;return new Promise(function(_0x52c824,_0x4bf63d){return db['FaxAccount']['findAll']({'raw':_0x41d45e['options']?_0x41d45e[_0x1135('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x41d45e[_0x1135('0x1a')]?_0x41d45e[_0x1135('0x1a')]['where']||null:null,'attributes':_0x41d45e['options']?_0x41d45e[_0x1135('0x1a')][_0x1135('0x1b')]||null:null,'limit':_0x41d45e[_0x1135('0x1a')]?_0x41d45e[_0x1135('0x1a')]['limit']||null:null,'include':_0x41d45e[_0x1135('0x1a')]?_0x41d45e[_0x1135('0x1a')][_0x1135('0x1c')]?_['map'](_0x41d45e[_0x1135('0x1a')][_0x1135('0x1c')],function(_0x267ce4){return{'model':db[_0x267ce4[_0x1135('0x1d')]],'as':_0x267ce4['as'],'attributes':_0x267ce4[_0x1135('0x1b')],'include':_0x267ce4['include']?_[_0x1135('0x1e')](_0x267ce4['include'],function(_0x5a2475){return{'model':db[_0x5a2475[_0x1135('0x1d')]],'as':_0x5a2475['as'],'attributes':_0x5a2475[_0x1135('0x1b')],'include':_0x5a2475['include']?_[_0x1135('0x1e')](_0x5a2475[_0x1135('0x1c')],function(_0x5d39dc){return{'model':db[_0x5d39dc[_0x1135('0x1d')]],'as':_0x5d39dc['as'],'attributes':_0x5d39dc[_0x1135('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1135('0x1f')](function(_0x33c0e7){logger[_0x1135('0x10')]('GetFaxAccount',_0x41d45e);logger[_0x1135('0x13')]('GetFaxAccount',_0x41d45e,JSON['stringify'](_0x33c0e7));_0x52c824(_0x33c0e7);})[_0x1135('0x18')](function(_0x34e820){logger['error'](_0x1135('0x19'),_0x34e820[_0x1135('0x17')],_0x41d45e);_0x4bf63d(_0x51c379['error'](0x1f4,_0x34e820[_0x1135('0x17')]));});});};exports['NotifyFaxAccount']=function(_0x250136,_0x73a148,_0x53af2e){var _0x31a8dd=this;return new Promise(function(_0x4a2056,_0x41660f){var _0x4b9948={'body':_0x250136[_0x1135('0x20')],'channel':_0x1135('0x21')};var _0x36eb8d=[];var _0x225c79=[];var _0x5bceca={};return db['CmContact'][_0x1135('0x22')]()[_0x1135('0x1f')](function(_0x55753e){if(!_0x55753e){throw new db[(_0x1135('0x23'))][(_0x1135('0x24'))](_0x1135('0x25'));}_0x36eb8d=_[_0x1135('0x26')](_[_0x1135('0x27')](_0x55753e),['createdAt','updatedAt']);_0x225c79=_[_0x1135('0x26')](_[_0x1135('0x27')](_0x55753e),[_0x1135('0x28'),_0x1135('0x29'),_0x1135('0x2a'),_0x1135('0x2b')]);if(_0x250136['body']['id']){delete _0x250136['body']['id'];}if(_['isNil'](_0x250136[_0x1135('0x20')][_0x1135('0x2c')])){throw new db[(_0x1135('0x23'))]['ValidationError'](_0x1135('0x2d'));}if(_[_0x1135('0x2e')](_0x250136[_0x1135('0x20')]['body'])||_0x250136[_0x1135('0x20')][_0x1135('0x20')]===''){throw new db['Sequelize'][(_0x1135('0x24'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x1135('0x2e')](_0x250136[_0x1135('0x20')][_0x1135('0x2f')])){throw new db[(_0x1135('0x23'))][(_0x1135('0x24'))](_0x1135('0x30')+_0x225c79);}if(!_[_0x1135('0x31')](_0x225c79,_0x250136[_0x1135('0x20')]['mapKey'])){throw new db['Sequelize'][(_0x1135('0x24'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x225c79);}_0x5bceca[_0x250136['body']['mapKey']]=_0x250136['body'][_0x1135('0x2c')];})[_0x1135('0x1f')](function(){return db[_0x1135('0x32')][_0x1135('0x33')]({'where':{'id':_0x250136['account']['id']},'include':[{'model':db[_0x1135('0x34')],'as':_0x1135('0x35'),'include':[{'model':db[_0x1135('0x36')],'as':_0x1135('0x37'),'where':_0x5bceca,'limit':0x1,'order':[[_0x1135('0x29'),_0x1135('0x38')]]}]},{'model':db[_0x1135('0x39')],'as':_0x1135('0x3a')}]});})[_0x1135('0x1f')](function(_0x3acd77){if(_0x3acd77&&_0x3acd77[_0x1135('0x35')]){var _0x412b87=_0x3acd77[_0x1135('0x3b')]({'plain':!![]});_0x4b9948[_0x1135('0x3c')]=_0x412b87;_0x4b9948['applications']=_0x412b87[_0x1135('0x3a')];_0x4b9948[_0x1135('0x3d')]=_0x412b87[_0x1135('0x35')];_0x4b9948[_0x1135('0x3e')]=_[_0x1135('0x3f')](_0x4b9948[_0x1135('0x3e')],['priority'],[_0x1135('0x40')]);if(_0x4b9948[_0x1135('0x3c')][_0x1135('0x3a')]){delete _0x4b9948[_0x1135('0x3c')][_0x1135('0x3a')];}if(_0x4b9948[_0x1135('0x3c')][_0x1135('0x35')]&&_0x4b9948['account'][_0x1135('0x35')][_0x1135('0x37')]['length']){return _0x4b9948[_0x1135('0x3c')][_0x1135('0x35')][_0x1135('0x37')][0x0];}var _0x315d8f=_[_0x1135('0xb')](_0x250136[_0x1135('0x20')],{'firstName':_0x250136[_0x1135('0x20')][_0x1135('0x2c')],'ListId':_0x412b87[_0x1135('0x2b')]});_0x315d8f[_0x250136['body'][_0x1135('0x2f')]]=_0x250136[_0x1135('0x20')]['from'];return db[_0x1135('0x36')][_0x1135('0x41')](_0x315d8f,{'fields':_0x36eb8d,'raw':!![]});}})[_0x1135('0x1f')](function(_0x4c9a18){_0x4b9948[_0x1135('0x42')]=_0x4c9a18;if(_0x4c9a18){var _0x3c99bf={'ContactId':_0x4c9a18['id'],'FaxAccountId':_0x250136[_0x1135('0x3c')]['id'],'fax':_0x4c9a18[_0x1135('0x21')]};return db[_0x1135('0x43')]['find']({'where':{'ContactId':_0x4c9a18['id'],'closed':![],'FaxAccountId':_0x250136['account']['id']}})[_0x1135('0x1f')](function(_0x42a16c){if(_0x42a16c){return[_0x42a16c,![]];}return db[_0x1135('0x43')][_0x1135('0x41')](_0x3c99bf)[_0x1135('0x1f')](function(_0x1e111d){return[_0x1e111d,!![]];});});}else{throw new Error(_0x1135('0x44'));}})[_0x1135('0x45')](function(_0x58f9c5,_0x30a4ca){var _0x47b63a=_0x58f9c5[_0x1135('0x3b')]({'plain':!![]});if(_0x30a4ca){if(_0x4b9948[_0x1135('0x3c')]['autoclose']){_0x4b9948['applications'][_0x1135('0x46')]({'id':0x0,'priority':_0x4b9948['applications'][_0x1135('0x47')]+0x1,'app':_0x1135('0x48'),'appdata':_0x1135('0x49'),'interval':_0x1135('0x4a')});}_0x47b63a[_0x1135('0x4b')]=!![];}else{_0x47b63a[_0x1135('0x4b')]=![];}_0x4b9948['interaction']=_0x47b63a;return db['FaxMessage'][_0x1135('0x41')]({'body':_0x250136[_0x1135('0x20')][_0x1135('0x20')],'FaxAccountId':_0x250136[_0x1135('0x3c')]['id'],'FaxInteractionId':_0x58f9c5['id'],'direction':'in','ContactId':_0x58f9c5[_0x1135('0x4c')],'AttachmentId':_0x250136[_0x1135('0x20')][_0x1135('0x4d')]});})[_0x1135('0x1f')](function(_0x378ee4){_0x4b9948[_0x1135('0x17')]=_0x378ee4;if(_0x4b9948['interaction'][_0x1135('0x4e')]){return db[_0x1135('0x4f')][_0x1135('0x33')]({'attributes':['id',_0x1135('0x50')],'where':{'id':_0x4b9948[_0x1135('0x51')][_0x1135('0x4e')]}})['then'](function(_0x3f9ee2){if(_0x3f9ee2){_0x4b9948[_0x1135('0x3e')][_0x1135('0x52')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3f9ee2['name']+','+(_0x4b9948[_0x1135('0x3c')][_0x1135('0x53')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x1135('0x54'),_0x1135('0x55'),_0x4b9948);});}return respondWithRpcPromise(_0x1135('0x54'),_0x1135('0x55'),_0x4b9948);})[_0x1135('0x1f')](function(_0x16187b){_0x4a2056(_0x16187b);})['catch'](function(_0x572118){_0x41660f(_0x31a8dd[_0x1135('0x15')](0x1f4,_0x572118[_0x1135('0x17')]));});});}; \ No newline at end of file +var _0xc251=['List','get','applications','orderBy','priority','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','*,*,*,*','created','FaxMessage','ContactId','AttachmentId','interaction','UserId','User','name','unshift','waitForTheAssignedAgent','Start','startRouting','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetFaxAccount','NotifyFaxAccount','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','body','isNil','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','find','account','CmList','Contacts','DESC','FaxApplication','Applications'];(function(_0x14a153,_0x143562){var _0x54f687=function(_0x1bfc6f){while(--_0x1bfc6f){_0x14a153['push'](_0x14a153['shift']());}};_0x54f687(++_0x143562);}(_0xc251,0xda));var _0x1c25=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xc251[_0x46e363];return _0x3fb059;};'use strict';var _=require('lodash');var util=require(_0x1c25('0x0'));var moment=require('moment');var BPromise=require(_0x1c25('0x1'));var rs=require(_0x1c25('0x2'));var fs=require('fs');var Redis=require(_0x1c25('0x3'));var db=require(_0x1c25('0x4'))['db'];var utils=require(_0x1c25('0x5'));var logger=require(_0x1c25('0x6'))(_0x1c25('0x7'));var config=require(_0x1c25('0x8'));var jayson=require(_0x1c25('0x9'));var client=jayson['client'][_0x1c25('0xa')]({'port':0x232c});config[_0x1c25('0xb')]=_[_0x1c25('0xc')](config[_0x1c25('0xb')],{'host':_0x1c25('0xd'),'port':0x18eb});var socket=require(_0x1c25('0xe'))(new Redis(config[_0x1c25('0xb')]));require(_0x1c25('0xf'))[_0x1c25('0x10')](socket);function respondWithRpcPromise(_0x1da359,_0xe07dad,_0x312046){return new BPromise(function(_0x5e25c4,_0x4404fc){return client[_0x1c25('0x11')](_0x1da359,_0x312046)[_0x1c25('0x12')](function(_0x41987a){logger[_0x1c25('0x13')]('FaxAccount,\x20%s,\x20%s',_0xe07dad,'request\x20sent');logger[_0x1c25('0x14')](_0x1c25('0x15'),_0xe07dad,'request\x20sent',JSON[_0x1c25('0x16')](_0x41987a));if(_0x41987a['error']){if(_0x41987a[_0x1c25('0x17')][_0x1c25('0x18')]===0x1f4){logger['error'](_0x1c25('0x19'),_0xe07dad,_0x41987a[_0x1c25('0x17')]['message']);return _0x4404fc(_0x41987a[_0x1c25('0x17')]['message']);}logger[_0x1c25('0x17')](_0x1c25('0x19'),_0xe07dad,_0x41987a[_0x1c25('0x17')][_0x1c25('0x1a')]);return _0x5e25c4(_0x41987a[_0x1c25('0x17')][_0x1c25('0x1a')]);}else{logger[_0x1c25('0x13')](_0x1c25('0x19'),_0xe07dad,'request\x20sent');_0x5e25c4(_0x41987a[_0x1c25('0x1b')][_0x1c25('0x1a')]);}})[_0x1c25('0x1c')](function(_0x325d67){logger[_0x1c25('0x17')](_0x1c25('0x19'),_0xe07dad,_0x325d67);_0x4404fc(_0x325d67);});});}exports['GetFaxAccount']=function(_0x29d5e2){var _0x3b02e9=this;return new Promise(function(_0x4cb73d,_0xdca6d){return db[_0x1c25('0x1d')][_0x1c25('0x1e')]({'raw':_0x29d5e2[_0x1c25('0x1f')]?_0x29d5e2[_0x1c25('0x1f')][_0x1c25('0x20')]===undefined?!![]:![]:!![],'where':_0x29d5e2[_0x1c25('0x1f')]?_0x29d5e2[_0x1c25('0x1f')][_0x1c25('0x21')]||null:null,'attributes':_0x29d5e2[_0x1c25('0x1f')]?_0x29d5e2[_0x1c25('0x1f')][_0x1c25('0x22')]||null:null,'limit':_0x29d5e2[_0x1c25('0x1f')]?_0x29d5e2[_0x1c25('0x1f')][_0x1c25('0x23')]||null:null,'include':_0x29d5e2[_0x1c25('0x1f')]?_0x29d5e2[_0x1c25('0x1f')][_0x1c25('0x24')]?_[_0x1c25('0x25')](_0x29d5e2[_0x1c25('0x1f')][_0x1c25('0x24')],function(_0x21157c){return{'model':db[_0x21157c[_0x1c25('0x26')]],'as':_0x21157c['as'],'attributes':_0x21157c[_0x1c25('0x22')],'include':_0x21157c[_0x1c25('0x24')]?_['map'](_0x21157c[_0x1c25('0x24')],function(_0x172688){return{'model':db[_0x172688[_0x1c25('0x26')]],'as':_0x172688['as'],'attributes':_0x172688['attributes'],'include':_0x172688['include']?_[_0x1c25('0x25')](_0x172688[_0x1c25('0x24')],function(_0x118e3f){return{'model':db[_0x118e3f[_0x1c25('0x26')]],'as':_0x118e3f['as'],'attributes':_0x118e3f['attributes']};}):[]};}):[]};}):[]:[]})[_0x1c25('0x12')](function(_0x3cf29f){logger[_0x1c25('0x13')](_0x1c25('0x27'),_0x29d5e2);logger[_0x1c25('0x14')](_0x1c25('0x27'),_0x29d5e2,JSON[_0x1c25('0x16')](_0x3cf29f));_0x4cb73d(_0x3cf29f);})[_0x1c25('0x1c')](function(_0x255d15){logger[_0x1c25('0x17')](_0x1c25('0x27'),_0x255d15[_0x1c25('0x1a')],_0x29d5e2);_0xdca6d(_0x3b02e9['error'](0x1f4,_0x255d15[_0x1c25('0x1a')]));});});};exports[_0x1c25('0x28')]=function(_0x4212fe,_0x2cbacd,_0x3a3928){var _0x46cc4a=this;return new Promise(function(_0x48704a,_0x57f1ba){var _0x3c2653={'body':_0x4212fe['body'],'channel':_0x1c25('0x29')};var _0x3e4285=[];var _0x199d55=[];var _0xdacb77={};return db[_0x1c25('0x2a')][_0x1c25('0x2b')]()['then'](function(_0x3835dc){if(!_0x3835dc){throw new db[(_0x1c25('0x2c'))][(_0x1c25('0x2d'))](_0x1c25('0x2e'));}_0x3e4285=_[_0x1c25('0x2f')](_[_0x1c25('0x30')](_0x3835dc),[_0x1c25('0x31'),'updatedAt']);_0x199d55=_[_0x1c25('0x2f')](_[_0x1c25('0x30')](_0x3835dc),[_0x1c25('0x31'),_0x1c25('0x32'),_0x1c25('0x33'),_0x1c25('0x34')]);if(_0x4212fe[_0x1c25('0x35')]['id']){delete _0x4212fe[_0x1c25('0x35')]['id'];}if(_[_0x1c25('0x36')](_0x4212fe[_0x1c25('0x35')]['from'])){throw new db[(_0x1c25('0x2c'))][(_0x1c25('0x2d'))]('from\x20is\x20mandatory');}if(_[_0x1c25('0x36')](_0x4212fe['body'][_0x1c25('0x35')])||_0x4212fe[_0x1c25('0x35')][_0x1c25('0x35')]===''){throw new db[(_0x1c25('0x2c'))][(_0x1c25('0x2d'))](_0x1c25('0x37'));}if(_['isNil'](_0x4212fe['body'][_0x1c25('0x38')])){throw new db[(_0x1c25('0x2c'))][(_0x1c25('0x2d'))](_0x1c25('0x39')+_0x199d55);}if(!_['includes'](_0x199d55,_0x4212fe[_0x1c25('0x35')]['mapKey'])){throw new db['Sequelize'][(_0x1c25('0x2d'))](_0x1c25('0x3a')+_0x199d55);}_0xdacb77[_0x4212fe[_0x1c25('0x35')][_0x1c25('0x38')]]=_0x4212fe['body'][_0x1c25('0x3b')];})[_0x1c25('0x12')](function(){return db[_0x1c25('0x1d')][_0x1c25('0x3c')]({'where':{'id':_0x4212fe[_0x1c25('0x3d')]['id']},'include':[{'model':db[_0x1c25('0x3e')],'as':'List','include':[{'model':db[_0x1c25('0x2a')],'as':_0x1c25('0x3f'),'where':_0xdacb77,'limit':0x1,'order':[['updatedAt',_0x1c25('0x40')]]}]},{'model':db[_0x1c25('0x41')],'as':_0x1c25('0x42')}]});})[_0x1c25('0x12')](function(_0x1d3f56){if(_0x1d3f56&&_0x1d3f56[_0x1c25('0x43')]){var _0x582c8a=_0x1d3f56[_0x1c25('0x44')]({'plain':!![]});_0x3c2653[_0x1c25('0x3d')]=_0x582c8a;_0x3c2653[_0x1c25('0x45')]=_0x582c8a[_0x1c25('0x42')];_0x3c2653['list']=_0x582c8a[_0x1c25('0x43')];_0x3c2653['applications']=_[_0x1c25('0x46')](_0x3c2653[_0x1c25('0x45')],[_0x1c25('0x47')],['asc']);if(_0x3c2653['account']['Applications']){delete _0x3c2653['account']['Applications'];}if(_0x3c2653[_0x1c25('0x3d')]['List']&&_0x3c2653[_0x1c25('0x3d')][_0x1c25('0x43')][_0x1c25('0x3f')][_0x1c25('0x48')]){return _0x3c2653['account'][_0x1c25('0x43')]['Contacts'][0x0];}var _0x45a083=_['defaults'](_0x4212fe[_0x1c25('0x35')],{'firstName':_0x4212fe['body'][_0x1c25('0x3b')],'ListId':_0x582c8a[_0x1c25('0x34')]});_0x45a083[_0x4212fe[_0x1c25('0x35')][_0x1c25('0x38')]]=_0x4212fe['body'][_0x1c25('0x3b')];return db[_0x1c25('0x2a')][_0x1c25('0x49')](_0x45a083,{'fields':_0x3e4285,'raw':!![]});}})[_0x1c25('0x12')](function(_0x14dd26){_0x3c2653[_0x1c25('0x4a')]=_0x14dd26;if(_0x14dd26){var _0xdcf14c={'ContactId':_0x14dd26['id'],'FaxAccountId':_0x4212fe[_0x1c25('0x3d')]['id'],'fax':_0x14dd26['fax']};return db[_0x1c25('0x4b')]['find']({'where':{'ContactId':_0x14dd26['id'],'closed':![],'FaxAccountId':_0x4212fe[_0x1c25('0x3d')]['id']}})['then'](function(_0x415756){if(_0x415756){return[_0x415756,![]];}return db[_0x1c25('0x4b')][_0x1c25('0x49')](_0xdcf14c)[_0x1c25('0x12')](function(_0x4757a1){return[_0x4757a1,!![]];});});}else{throw new Error(_0x1c25('0x4c'));}})[_0x1c25('0x4d')](function(_0x15b828,_0x3c481e){var _0x24e8ad=_0x15b828[_0x1c25('0x44')]({'plain':!![]});if(_0x3c481e){if(_0x3c2653[_0x1c25('0x3d')][_0x1c25('0x4e')]){_0x3c2653[_0x1c25('0x45')][_0x1c25('0x4f')]({'id':0x0,'priority':_0x3c2653[_0x1c25('0x45')][_0x1c25('0x48')]+0x1,'app':_0x1c25('0x50'),'appdata':_0x1c25('0x51'),'interval':_0x1c25('0x52')});}_0x24e8ad['created']=!![];}else{_0x24e8ad[_0x1c25('0x53')]=![];}_0x3c2653['interaction']=_0x24e8ad;return db[_0x1c25('0x54')][_0x1c25('0x49')]({'body':_0x4212fe['body'][_0x1c25('0x35')],'FaxAccountId':_0x4212fe[_0x1c25('0x3d')]['id'],'FaxInteractionId':_0x15b828['id'],'direction':'in','ContactId':_0x15b828[_0x1c25('0x55')],'AttachmentId':_0x4212fe['body'][_0x1c25('0x56')]});})[_0x1c25('0x12')](function(_0x21387e){_0x3c2653[_0x1c25('0x1a')]=_0x21387e;if(_0x3c2653[_0x1c25('0x57')][_0x1c25('0x58')]){return db[_0x1c25('0x59')]['find']({'attributes':['id',_0x1c25('0x5a')],'where':{'id':_0x3c2653[_0x1c25('0x57')][_0x1c25('0x58')]}})[_0x1c25('0x12')](function(_0x29f506){if(_0x29f506){_0x3c2653[_0x1c25('0x45')][_0x1c25('0x5b')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x29f506[_0x1c25('0x5a')]+','+(_0x3c2653[_0x1c25('0x3d')][_0x1c25('0x5c')]||0xa),'interval':_0x1c25('0x52')});}return respondWithRpcPromise(_0x1c25('0x5d'),_0x1c25('0x5e'),_0x3c2653);});}return respondWithRpcPromise(_0x1c25('0x5d'),_0x1c25('0x5e'),_0x3c2653);})['then'](function(_0xd1e993){_0x48704a(_0xd1e993);})[_0x1c25('0x1c')](function(_0x25134e){_0x57f1ba(_0x46cc4a[_0x1c25('0x17')](0x1f4,_0x25134e[_0x1c25('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 60ea785..851cccb 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 _0x9e2e=['faxAccount:','save','remove','update','removeListener','register','length'];(function(_0x38d040,_0x117cdc){var _0x2ab2a1=function(_0x2038bb){while(--_0x2038bb){_0x38d040['push'](_0x38d040['shift']());}};_0x2ab2a1(++_0x117cdc);}(_0x9e2e,0x1ac));var _0xe9e2=function(_0x50692b,_0x4cf5bc){_0x50692b=_0x50692b-0x0;var _0x57748b=_0x9e2e[_0x50692b];return _0x57748b;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0xe9e2('0x0'),_0xe9e2('0x1'),_0xe9e2('0x2')];function createListener(_0x83abc3,_0x411f49){return function(_0x1242aa){_0x411f49['emit'](_0x83abc3,_0x1242aa);};}function removeListener(_0xf300d7,_0x45f3e5){return function(){FaxAccountEvents[_0xe9e2('0x3')](_0xf300d7,_0x45f3e5);};}exports[_0xe9e2('0x4')]=function(_0x554994){for(var _0x2b298c=0x0,_0x233610=events[_0xe9e2('0x5')];_0x2b298c<_0x233610;_0x2b298c++){var _0x4a1d51=events[_0x2b298c];var _0x3d7814=createListener(_0xe9e2('0x6')+_0x4a1d51,_0x554994);FaxAccountEvents['on'](_0x4a1d51,_0x3d7814);}}; \ No newline at end of file +var _0x5509=['update','removeListener','register','length','faxAccount:','./faxAccount.events','save','remove'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x5509,0x125));var _0x9550=function(_0x5c1155,_0x1b4d92){_0x5c1155=_0x5c1155-0x0;var _0x4326ee=_0x5509[_0x5c1155];return _0x4326ee;};'use strict';var FaxAccountEvents=require(_0x9550('0x0'));var events=[_0x9550('0x1'),_0x9550('0x2'),_0x9550('0x3')];function createListener(_0x53119d,_0xec497e){return function(_0x41fbff){_0xec497e['emit'](_0x53119d,_0x41fbff);};}function removeListener(_0x73b4dc,_0x24d90d){return function(){FaxAccountEvents[_0x9550('0x4')](_0x73b4dc,_0x24d90d);};}exports[_0x9550('0x5')]=function(_0x1eadf9){for(var _0x4935c4=0x0,_0x135ac8=events[_0x9550('0x6')];_0x4935c4<_0x135ac8;_0x4935c4++){var _0x2bf581=events[_0x4935c4];var _0x300e64=createListener(_0x9550('0x7')+_0x2bf581,_0x1eadf9);FaxAccountEvents['on'](_0x2bf581,_0x300e64);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index f15e024..8af9c87 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x1844aa,_0x51bd44){var _0x1bb1ce=function(_0x1329fe){while(--_0x1329fe){_0x1844aa['push'](_0x1844aa['shift']());}};_0x1bb1ce(++_0x51bd44);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x17ede9,_0x27d731){var _0x35b71d=function(_0x30f681){while(--_0x30f681){_0x17ede9['push'](_0x17ede9['shift']());}};_0x35b71d(++_0x27d731);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index aba10e5..581d0b0 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 _0xdd6d=['*,*,*,*','exports','STRING','TEXT'];(function(_0x52ab0a,_0xf641d5){var _0x1d2cab=function(_0x47d5a1){while(--_0x47d5a1){_0x52ab0a['push'](_0x52ab0a['shift']());}};_0x1d2cab(++_0xf641d5);}(_0xdd6d,0xd9));var _0xddd6=function(_0x48925b,_0x1f5a56){_0x48925b=_0x48925b-0x0;var _0x128edd=_0xdd6d[_0x48925b];return _0x128edd;};'use strict';var Sequelize=require('sequelize');module[_0xddd6('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xddd6('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xddd6('0x2')]()},'description':{'type':Sequelize[_0xddd6('0x1')]},'interval':{'type':Sequelize[_0xddd6('0x1')],'defaultValue':_0xddd6('0x3')}}; \ No newline at end of file +var _0x4e7c=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x4e7c,0x13f));var _0xc4e7=function(_0x16f4cd,_0x1c8805){_0x16f4cd=_0x16f4cd-0x0;var _0x4755bb=_0x4e7c[_0x16f4cd];return _0x4755bb;};'use strict';var Sequelize=require(_0xc4e7('0x0'));module[_0xc4e7('0x1')]={'priority':{'type':Sequelize[_0xc4e7('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xc4e7('0x3')],'allowNull':![],'defaultValue':_0xc4e7('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xc4e7('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xc4e7('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 94d35c5..dbe5263 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 _0x5a06=['squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../mysqldb','status','end','json','offset','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','index','map','FaxApplication','type','model','query','keys','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','catch','show','rawAttributes','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x5a06,0xc6));var _0x65a0=function(_0x57c029,_0x302ebd){_0x57c029=_0x57c029-0x0;var _0x6b7d44=_0x5a06[_0x57c029];return _0x6b7d44;};'use strict';var emlformat=require(_0x65a0('0x0'));var rimraf=require(_0x65a0('0x1'));var zipdir=require(_0x65a0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x65a0('0x3'));var moment=require(_0x65a0('0x4'));var BPromise=require(_0x65a0('0x5'));var Mustache=require('mustache');var util=require(_0x65a0('0x6'));var path=require(_0x65a0('0x7'));var sox=require(_0x65a0('0x8'));var csv=require(_0x65a0('0x9'));var ejs=require(_0x65a0('0xa'));var fs=require('fs');var fs_extra=require(_0x65a0('0xb'));var _=require('lodash');var squel=require(_0x65a0('0xc'));var crypto=require(_0x65a0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x65a0('0xe'));var toCsv=require(_0x65a0('0x9'));var querystring=require(_0x65a0('0xf'));var Papa=require(_0x65a0('0x10'));var Redis=require(_0x65a0('0x11'));var authService=require(_0x65a0('0x12'));var qs=require(_0x65a0('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x65a0('0x14'));var logger=require(_0x65a0('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x65a0('0x16'))['db'];function respondWithStatusCode(_0x16a46b,_0x391a89){_0x391a89=_0x391a89||0xcc;return function(_0xa8de95){if(_0xa8de95){return _0x16a46b['sendStatus'](_0x391a89);}return _0x16a46b[_0x65a0('0x17')](_0x391a89)[_0x65a0('0x18')]();};}function respondWithResult(_0x2ef3ca,_0xc32822){_0xc32822=_0xc32822||0xc8;return function(_0xb579ad){if(_0xb579ad){return _0x2ef3ca[_0x65a0('0x17')](_0xc32822)[_0x65a0('0x19')](_0xb579ad);}};}function respondWithFilteredResult(_0xbbce05,_0xeba321){return function(_0x34745f){if(_0x34745f){var _0x44d858=typeof _0xeba321['offset']==='undefined'&&typeof _0xeba321['limit']==='undefined';var _0x59a7d7=_0x34745f['count'];var _0x29c5ba=_0x44d858?0x0:_0xeba321[_0x65a0('0x1a')];var _0x3d37fc=_0x44d858?_0x34745f[_0x65a0('0x1b')]:_0xeba321[_0x65a0('0x1a')]+_0xeba321['limit'];var _0xe8348d;if(_0x3d37fc>=_0x59a7d7){_0x3d37fc=_0x59a7d7;_0xe8348d=0xc8;}else{_0xe8348d=0xce;}_0xbbce05[_0x65a0('0x17')](_0xe8348d);return _0xbbce05[_0x65a0('0x1c')](_0x65a0('0x1d'),_0x29c5ba+'-'+_0x3d37fc+'/'+_0x59a7d7)[_0x65a0('0x19')](_0x34745f);}return null;};}function patchUpdates(_0x310ee3){return function(_0x33cd9d){try{jsonpatch[_0x65a0('0x1e')](_0x33cd9d,_0x310ee3,!![]);}catch(_0x4b244b){return BPromise['reject'](_0x4b244b);}return _0x33cd9d[_0x65a0('0x1f')]();};}function saveUpdates(_0x1fb3ae,_0x5e47e3){return function(_0x31b0db){if(_0x31b0db){return _0x31b0db[_0x65a0('0x20')](_0x1fb3ae)[_0x65a0('0x21')](function(_0x1ad1e4){return _0x1ad1e4;});}return null;};}function removeEntity(_0x4f639a,_0x222511){return function(_0x9b158d){if(_0x9b158d){return _0x9b158d[_0x65a0('0x22')]()[_0x65a0('0x21')](function(){_0x4f639a[_0x65a0('0x17')](0xcc)[_0x65a0('0x18')]();});}};}function handleEntityNotFound(_0x165466,_0x445d3){return function(_0x5af5bd){if(!_0x5af5bd){_0x165466[_0x65a0('0x23')](0x194);}return _0x5af5bd;};}function handleError(_0x3e7220,_0x3f1115){_0x3f1115=_0x3f1115||0x1f4;return function(_0x4999bf){logger[_0x65a0('0x24')](_0x4999bf[_0x65a0('0x25')]);if(_0x4999bf[_0x65a0('0x26')]){delete _0x4999bf[_0x65a0('0x26')];}_0x3e7220['status'](_0x3f1115)['send'](_0x4999bf);};}exports[_0x65a0('0x27')]=function(_0x9d7fec,_0x396e26){var _0x574d9f={},_0x1c5b3e={},_0x3055d9={'count':0x0,'rows':[]};var _0x13a8ee=_[_0x65a0('0x28')](db[_0x65a0('0x29')]['rawAttributes'],function(_0x41d253){return{'name':_0x41d253['fieldName'],'type':_0x41d253[_0x65a0('0x2a')]['key']};});_0x1c5b3e[_0x65a0('0x2b')]=_[_0x65a0('0x28')](_0x13a8ee,_0x65a0('0x26'));_0x1c5b3e[_0x65a0('0x2c')]=_[_0x65a0('0x2d')](_0x9d7fec[_0x65a0('0x2c')]);_0x1c5b3e['filters']=_[_0x65a0('0x2e')](_0x1c5b3e['model'],_0x1c5b3e['query']);_0x574d9f[_0x65a0('0x2f')]=_[_0x65a0('0x2e')](_0x1c5b3e[_0x65a0('0x2b')],qs['fields'](_0x9d7fec['query'][_0x65a0('0x30')]));_0x574d9f[_0x65a0('0x2f')]=_0x574d9f[_0x65a0('0x2f')][_0x65a0('0x31')]?_0x574d9f[_0x65a0('0x2f')]:_0x1c5b3e[_0x65a0('0x2b')];if(!_0x9d7fec['query']['hasOwnProperty'](_0x65a0('0x32'))){_0x574d9f[_0x65a0('0x33')]=qs[_0x65a0('0x33')](_0x9d7fec['query']['limit']);_0x574d9f[_0x65a0('0x1a')]=qs[_0x65a0('0x1a')](_0x9d7fec[_0x65a0('0x2c')][_0x65a0('0x1a')]);}_0x574d9f[_0x65a0('0x34')]=qs[_0x65a0('0x35')](_0x9d7fec[_0x65a0('0x2c')][_0x65a0('0x35')]);_0x574d9f[_0x65a0('0x36')]=qs[_0x65a0('0x37')](_[_0x65a0('0x38')](_0x9d7fec[_0x65a0('0x2c')],_0x1c5b3e[_0x65a0('0x37')]),_0x13a8ee);if(_0x9d7fec[_0x65a0('0x2c')]['filter']){_0x574d9f[_0x65a0('0x36')]=_[_0x65a0('0x39')](_0x574d9f[_0x65a0('0x36')],{'$or':_['map'](_0x13a8ee,function(_0x5c26b8){if(_0x5c26b8[_0x65a0('0x2a')]!==_0x65a0('0x3a')){var _0x329886={};_0x329886[_0x5c26b8[_0x65a0('0x26')]]={'$like':'%'+_0x9d7fec[_0x65a0('0x2c')][_0x65a0('0x3b')]+'%'};return _0x329886;}})});}_0x574d9f=_[_0x65a0('0x39')]({},_0x574d9f,_0x9d7fec['options']);var _0x16967f={'where':_0x574d9f['where']};return db[_0x65a0('0x29')][_0x65a0('0x1b')](_0x16967f)[_0x65a0('0x21')](function(_0x192040){_0x3055d9[_0x65a0('0x1b')]=_0x192040;if(_0x9d7fec[_0x65a0('0x2c')][_0x65a0('0x3c')]){_0x574d9f[_0x65a0('0x3d')]=[{'all':!![]}];}return db[_0x65a0('0x29')][_0x65a0('0x3e')](_0x574d9f);})[_0x65a0('0x21')](function(_0x14d307){_0x3055d9['rows']=_0x14d307;return _0x3055d9;})[_0x65a0('0x21')](respondWithFilteredResult(_0x396e26,_0x574d9f))[_0x65a0('0x3f')](handleError(_0x396e26,null));};exports[_0x65a0('0x40')]=function(_0x881bef,_0x5adddb){var _0x421f4c={'raw':!![],'where':{'id':_0x881bef['params']['id']}},_0x25df3c={};_0x25df3c[_0x65a0('0x2b')]=_[_0x65a0('0x2d')](db[_0x65a0('0x29')][_0x65a0('0x41')]);_0x25df3c[_0x65a0('0x2c')]=_[_0x65a0('0x2d')](_0x881bef[_0x65a0('0x2c')]);_0x25df3c[_0x65a0('0x37')]=_[_0x65a0('0x2e')](_0x25df3c[_0x65a0('0x2b')],_0x25df3c['query']);_0x421f4c[_0x65a0('0x2f')]=_[_0x65a0('0x2e')](_0x25df3c[_0x65a0('0x2b')],qs[_0x65a0('0x30')](_0x881bef['query'][_0x65a0('0x30')]));_0x421f4c[_0x65a0('0x2f')]=_0x421f4c['attributes'][_0x65a0('0x31')]?_0x421f4c[_0x65a0('0x2f')]:_0x25df3c['model'];if(_0x881bef[_0x65a0('0x2c')][_0x65a0('0x3c')]){_0x421f4c[_0x65a0('0x3d')]=[{'all':!![]}];}_0x421f4c=_['merge']({},_0x421f4c,_0x881bef['options']);return db['FaxApplication'][_0x65a0('0x42')](_0x421f4c)[_0x65a0('0x21')](handleEntityNotFound(_0x5adddb,null))['then'](respondWithResult(_0x5adddb,null))[_0x65a0('0x3f')](handleError(_0x5adddb,null));};exports[_0x65a0('0x43')]=function(_0x1d0de6,_0x4d7fc5){return db[_0x65a0('0x29')][_0x65a0('0x43')](_0x1d0de6['body'],{})['then'](respondWithResult(_0x4d7fc5,0xc9))[_0x65a0('0x3f')](handleError(_0x4d7fc5,null));};exports[_0x65a0('0x20')]=function(_0x352995,_0x5d8af0){if(_0x352995['body']['id']){delete _0x352995[_0x65a0('0x44')]['id'];}return db[_0x65a0('0x29')][_0x65a0('0x42')]({'where':{'id':_0x352995['params']['id']}})[_0x65a0('0x21')](handleEntityNotFound(_0x5d8af0,null))['then'](saveUpdates(_0x352995[_0x65a0('0x44')],null))[_0x65a0('0x21')](respondWithResult(_0x5d8af0,null))[_0x65a0('0x3f')](handleError(_0x5d8af0,null));};exports[_0x65a0('0x22')]=function(_0x44da9f,_0x374473){return db['FaxApplication'][_0x65a0('0x42')]({'where':{'id':_0x44da9f[_0x65a0('0x45')]['id']}})['then'](handleEntityNotFound(_0x374473,null))[_0x65a0('0x21')](removeEntity(_0x374473,null))['catch'](handleError(_0x374473,null));}; \ No newline at end of file +var _0x3f65=['create','body','params','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','end','stack','name','index','map','rawAttributes','fieldName','type','key','model','intersection','query','length','hasOwnProperty','limit','order','sort','filters','filter','where','merge','VIRTUAL','includeAll','include','FaxApplication','rows','keys','fields','attributes','find','catch'];(function(_0x60095b,_0x2aba3e){var _0x2e8ad0=function(_0x5a53ac){while(--_0x5a53ac){_0x60095b['push'](_0x60095b['shift']());}};_0x2e8ad0(++_0x2aba3e);}(_0x3f65,0x1b9));var _0x53f6=function(_0x3c6016,_0x552388){_0x3c6016=_0x3c6016-0x0;var _0x395576=_0x3f65[_0x3c6016];return _0x395576;};'use strict';var emlformat=require(_0x53f6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x53f6('0x1'));var rp=require(_0x53f6('0x2'));var moment=require(_0x53f6('0x3'));var BPromise=require(_0x53f6('0x4'));var Mustache=require(_0x53f6('0x5'));var util=require(_0x53f6('0x6'));var path=require(_0x53f6('0x7'));var sox=require(_0x53f6('0x8'));var csv=require('to-csv');var ejs=require(_0x53f6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x53f6('0xa'));var squel=require(_0x53f6('0xb'));var crypto=require(_0x53f6('0xc'));var jsforce=require(_0x53f6('0xd'));var deskjs=require(_0x53f6('0xe'));var toCsv=require(_0x53f6('0xf'));var querystring=require(_0x53f6('0x10'));var Papa=require(_0x53f6('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x53f6('0x12'));var as=require(_0x53f6('0x13'));var hardwareService=require(_0x53f6('0x14'));var logger=require(_0x53f6('0x15'))(_0x53f6('0x16'));var utils=require(_0x53f6('0x17'));var config=require(_0x53f6('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x53f6('0x19'))['db'];function respondWithStatusCode(_0x5297be,_0x341847){_0x341847=_0x341847||0xcc;return function(_0x3920d4){if(_0x3920d4){return _0x5297be[_0x53f6('0x1a')](_0x341847);}return _0x5297be[_0x53f6('0x1b')](_0x341847)['end']();};}function respondWithResult(_0x129a17,_0x3173fd){_0x3173fd=_0x3173fd||0xc8;return function(_0x1f8f77){if(_0x1f8f77){return _0x129a17[_0x53f6('0x1b')](_0x3173fd)['json'](_0x1f8f77);}};}function respondWithFilteredResult(_0xe31a71,_0x251e20){return function(_0x25d042){if(_0x25d042){var _0x480fb0=typeof _0x251e20[_0x53f6('0x1c')]==='undefined'&&typeof _0x251e20['limit']===_0x53f6('0x1d');var _0x40e2e5=_0x25d042['count'];var _0x4860a0=_0x480fb0?0x0:_0x251e20[_0x53f6('0x1c')];var _0x1a7081=_0x480fb0?_0x25d042[_0x53f6('0x1e')]:_0x251e20[_0x53f6('0x1c')]+_0x251e20['limit'];var _0x41ee10;if(_0x1a7081>=_0x40e2e5){_0x1a7081=_0x40e2e5;_0x41ee10=0xc8;}else{_0x41ee10=0xce;}_0xe31a71[_0x53f6('0x1b')](_0x41ee10);return _0xe31a71['set'](_0x53f6('0x1f'),_0x4860a0+'-'+_0x1a7081+'/'+_0x40e2e5)[_0x53f6('0x20')](_0x25d042);}return null;};}function patchUpdates(_0x530550){return function(_0x14c7ba){try{jsonpatch[_0x53f6('0x21')](_0x14c7ba,_0x530550,!![]);}catch(_0x11e44b){return BPromise[_0x53f6('0x22')](_0x11e44b);}return _0x14c7ba[_0x53f6('0x23')]();};}function saveUpdates(_0x5b976f,_0x33e4ad){return function(_0x3e9277){if(_0x3e9277){return _0x3e9277[_0x53f6('0x24')](_0x5b976f)[_0x53f6('0x25')](function(_0x3be4c5){return _0x3be4c5;});}return null;};}function removeEntity(_0x305442,_0x5bdfe4){return function(_0x16ea34){if(_0x16ea34){return _0x16ea34[_0x53f6('0x26')]()[_0x53f6('0x25')](function(){_0x305442[_0x53f6('0x1b')](0xcc)[_0x53f6('0x27')]();});}};}function handleEntityNotFound(_0x116a15,_0x2209af){return function(_0x4ca136){if(!_0x4ca136){_0x116a15[_0x53f6('0x1a')](0x194);}return _0x4ca136;};}function handleError(_0x1b9bf6,_0x3be6cb){_0x3be6cb=_0x3be6cb||0x1f4;return function(_0x3a92bd){logger['error'](_0x3a92bd[_0x53f6('0x28')]);if(_0x3a92bd['name']){delete _0x3a92bd[_0x53f6('0x29')];}_0x1b9bf6[_0x53f6('0x1b')](_0x3be6cb)['send'](_0x3a92bd);};}exports[_0x53f6('0x2a')]=function(_0x4e02bd,_0xdb319e){var _0x524897={},_0x3e6c34={},_0x22e6a8={'count':0x0,'rows':[]};var _0x5263b2=_[_0x53f6('0x2b')](db['FaxApplication'][_0x53f6('0x2c')],function(_0x43e421){return{'name':_0x43e421[_0x53f6('0x2d')],'type':_0x43e421[_0x53f6('0x2e')][_0x53f6('0x2f')]};});_0x3e6c34[_0x53f6('0x30')]=_[_0x53f6('0x2b')](_0x5263b2,_0x53f6('0x29'));_0x3e6c34['query']=_['keys'](_0x4e02bd['query']);_0x3e6c34['filters']=_[_0x53f6('0x31')](_0x3e6c34['model'],_0x3e6c34['query']);_0x524897['attributes']=_[_0x53f6('0x31')](_0x3e6c34[_0x53f6('0x30')],qs['fields'](_0x4e02bd[_0x53f6('0x32')]['fields']));_0x524897['attributes']=_0x524897['attributes'][_0x53f6('0x33')]?_0x524897['attributes']:_0x3e6c34[_0x53f6('0x30')];if(!_0x4e02bd[_0x53f6('0x32')][_0x53f6('0x34')]('nolimit')){_0x524897[_0x53f6('0x35')]=qs[_0x53f6('0x35')](_0x4e02bd[_0x53f6('0x32')][_0x53f6('0x35')]);_0x524897[_0x53f6('0x1c')]=qs[_0x53f6('0x1c')](_0x4e02bd[_0x53f6('0x32')][_0x53f6('0x1c')]);}_0x524897[_0x53f6('0x36')]=qs[_0x53f6('0x37')](_0x4e02bd[_0x53f6('0x32')][_0x53f6('0x37')]);_0x524897['where']=qs[_0x53f6('0x38')](_['pick'](_0x4e02bd['query'],_0x3e6c34[_0x53f6('0x38')]),_0x5263b2);if(_0x4e02bd['query'][_0x53f6('0x39')]){_0x524897[_0x53f6('0x3a')]=_[_0x53f6('0x3b')](_0x524897[_0x53f6('0x3a')],{'$or':_[_0x53f6('0x2b')](_0x5263b2,function(_0x2d4d47){if(_0x2d4d47[_0x53f6('0x2e')]!==_0x53f6('0x3c')){var _0x45dd9a={};_0x45dd9a[_0x2d4d47[_0x53f6('0x29')]]={'$like':'%'+_0x4e02bd[_0x53f6('0x32')][_0x53f6('0x39')]+'%'};return _0x45dd9a;}})});}_0x524897=_['merge']({},_0x524897,_0x4e02bd['options']);var _0x74939={'where':_0x524897['where']};return db['FaxApplication'][_0x53f6('0x1e')](_0x74939)[_0x53f6('0x25')](function(_0x4dd6ec){_0x22e6a8[_0x53f6('0x1e')]=_0x4dd6ec;if(_0x4e02bd[_0x53f6('0x32')][_0x53f6('0x3d')]){_0x524897[_0x53f6('0x3e')]=[{'all':!![]}];}return db[_0x53f6('0x3f')]['findAll'](_0x524897);})['then'](function(_0x22aede){_0x22e6a8[_0x53f6('0x40')]=_0x22aede;return _0x22e6a8;})[_0x53f6('0x25')](respondWithFilteredResult(_0xdb319e,_0x524897))['catch'](handleError(_0xdb319e,null));};exports['show']=function(_0x95bcdf,_0x5f091a){var _0x33d409={'raw':!![],'where':{'id':_0x95bcdf['params']['id']}},_0x1004b3={};_0x1004b3[_0x53f6('0x30')]=_[_0x53f6('0x41')](db['FaxApplication'][_0x53f6('0x2c')]);_0x1004b3['query']=_['keys'](_0x95bcdf[_0x53f6('0x32')]);_0x1004b3[_0x53f6('0x38')]=_['intersection'](_0x1004b3['model'],_0x1004b3[_0x53f6('0x32')]);_0x33d409['attributes']=_[_0x53f6('0x31')](_0x1004b3[_0x53f6('0x30')],qs[_0x53f6('0x42')](_0x95bcdf[_0x53f6('0x32')][_0x53f6('0x42')]));_0x33d409[_0x53f6('0x43')]=_0x33d409[_0x53f6('0x43')]['length']?_0x33d409[_0x53f6('0x43')]:_0x1004b3[_0x53f6('0x30')];if(_0x95bcdf['query'][_0x53f6('0x3d')]){_0x33d409['include']=[{'all':!![]}];}_0x33d409=_[_0x53f6('0x3b')]({},_0x33d409,_0x95bcdf['options']);return db[_0x53f6('0x3f')][_0x53f6('0x44')](_0x33d409)[_0x53f6('0x25')](handleEntityNotFound(_0x5f091a,null))[_0x53f6('0x25')](respondWithResult(_0x5f091a,null))[_0x53f6('0x45')](handleError(_0x5f091a,null));};exports[_0x53f6('0x46')]=function(_0x5bff29,_0x5d9a30){return db[_0x53f6('0x3f')][_0x53f6('0x46')](_0x5bff29[_0x53f6('0x47')],{})[_0x53f6('0x25')](respondWithResult(_0x5d9a30,0xc9))[_0x53f6('0x45')](handleError(_0x5d9a30,null));};exports[_0x53f6('0x24')]=function(_0xbda3f4,_0x54b51c){if(_0xbda3f4[_0x53f6('0x47')]['id']){delete _0xbda3f4[_0x53f6('0x47')]['id'];}return db[_0x53f6('0x3f')][_0x53f6('0x44')]({'where':{'id':_0xbda3f4[_0x53f6('0x48')]['id']}})[_0x53f6('0x25')](handleEntityNotFound(_0x54b51c,null))[_0x53f6('0x25')](saveUpdates(_0xbda3f4['body'],null))[_0x53f6('0x25')](respondWithResult(_0x54b51c,null))[_0x53f6('0x45')](handleError(_0x54b51c,null));};exports[_0x53f6('0x26')]=function(_0x55403c,_0x78883b){return db[_0x53f6('0x3f')][_0x53f6('0x44')]({'where':{'id':_0x55403c[_0x53f6('0x48')]['id']}})[_0x53f6('0x25')](handleEntityNotFound(_0x78883b,null))[_0x53f6('0x25')](removeEntity(_0x78883b,null))[_0x53f6('0x45')](handleError(_0x78883b,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 1dc6769..3b2aea1 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 _0xd422=['FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xd422,0x124));var _0x2d42=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0xd422[_0xe73080];return _0x12cbc4;};'use strict';var _=require(_0x2d42('0x0'));var util=require(_0x2d42('0x1'));var logger=require(_0x2d42('0x2'))(_0x2d42('0x3'));var moment=require(_0x2d42('0x4'));var BPromise=require('bluebird');var rp=require(_0x2d42('0x5'));var fs=require('fs');var path=require(_0x2d42('0x6'));var rimraf=require(_0x2d42('0x7'));var config=require(_0x2d42('0x8'));var attributes=require(_0x2d42('0x9'));module[_0x2d42('0xa')]=function(_0x2d12ca,_0xc516a1){return _0x2d12ca[_0x2d42('0xb')](_0x2d42('0xc'),attributes,{'tableName':_0x2d42('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2d42('0xe'),'collate':_0x2d42('0xf')});}; \ No newline at end of file +var _0xdd65=['fax_applications','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','path','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication'];(function(_0x256973,_0x3cdbd4){var _0x4bf1d8=function(_0x4b6fb6){while(--_0x4b6fb6){_0x256973['push'](_0x256973['shift']());}};_0x4bf1d8(++_0x3cdbd4);}(_0xdd65,0x12e));var _0x5dd6=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xdd65[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require(_0x5dd6('0x0'));var logger=require(_0x5dd6('0x1'))('api');var moment=require(_0x5dd6('0x2'));var BPromise=require(_0x5dd6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5dd6('0x4'));var rimraf=require('rimraf');var config=require(_0x5dd6('0x5'));var attributes=require(_0x5dd6('0x6'));module[_0x5dd6('0x7')]=function(_0x28ddd6,_0x1f5b5b){return _0x28ddd6[_0x5dd6('0x8')](_0x5dd6('0x9'),attributes,{'tableName':_0x5dd6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x5dd6('0xb')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 4e30bd9..483fa86 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 _0x18ec=['stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','FaxApplication','update','body','options','where','attributes','UpdateFaxApplication'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x18ec,0x1d1));var _0xc18e=function(_0x585ff1,_0x43bdc3){_0x585ff1=_0x585ff1-0x0;var _0x470649=_0x18ec[_0x585ff1];return _0x470649;};'use strict';var _=require(_0xc18e('0x0'));var util=require(_0xc18e('0x1'));var moment=require('moment');var BPromise=require(_0xc18e('0x2'));var rs=require(_0xc18e('0x3'));var fs=require('fs');var Redis=require(_0xc18e('0x4'));var db=require(_0xc18e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc18e('0x6'))(_0xc18e('0x7'));var config=require(_0xc18e('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc18e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2efdb2,_0x593d8d,_0x49dec5){return new BPromise(function(_0x16e96b,_0x171c34){return client[_0xc18e('0xa')](_0x2efdb2,_0x49dec5)[_0xc18e('0xb')](function(_0x370702){logger['info'](_0xc18e('0xc'),_0x593d8d,'request\x20sent');logger[_0xc18e('0xd')](_0xc18e('0xe'),_0x593d8d,_0xc18e('0xf'),JSON['stringify'](_0x370702));if(_0x370702[_0xc18e('0x10')]){if(_0x370702[_0xc18e('0x10')]['code']===0x1f4){logger[_0xc18e('0x10')](_0xc18e('0xc'),_0x593d8d,_0x370702['error'][_0xc18e('0x11')]);return _0x171c34(_0x370702['error'][_0xc18e('0x11')]);}logger[_0xc18e('0x10')](_0xc18e('0xc'),_0x593d8d,_0x370702['error'][_0xc18e('0x11')]);return _0x16e96b(_0x370702['error']['message']);}else{logger[_0xc18e('0x12')](_0xc18e('0xc'),_0x593d8d,_0xc18e('0xf'));_0x16e96b(_0x370702[_0xc18e('0x13')][_0xc18e('0x11')]);}})[_0xc18e('0x14')](function(_0x1061b8){logger[_0xc18e('0x10')](_0xc18e('0xc'),_0x593d8d,_0x1061b8);_0x171c34(_0x1061b8);});});}exports['UpdateFaxApplication']=function(_0xda93d8){var _0x11b88a=this;return new Promise(function(_0x341160,_0x3a279e){return db[_0xc18e('0x15')][_0xc18e('0x16')](_0xda93d8[_0xc18e('0x17')],{'raw':_0xda93d8[_0xc18e('0x18')]?_0xda93d8['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xda93d8[_0xc18e('0x18')]?_0xda93d8[_0xc18e('0x18')][_0xc18e('0x19')]||null:null,'attributes':_0xda93d8[_0xc18e('0x18')]?_0xda93d8[_0xc18e('0x18')][_0xc18e('0x1a')]||null:null,'limit':_0xda93d8['options']?_0xda93d8[_0xc18e('0x18')]['limit']||null:null})[_0xc18e('0xb')](function(_0x192422){logger[_0xc18e('0x12')]('UpdateFaxApplication',_0xda93d8);logger[_0xc18e('0xd')](_0xc18e('0x1b'),_0xda93d8,JSON[_0xc18e('0x1c')](_0x192422));_0x341160(_0x192422);})[_0xc18e('0x14')](function(_0x194998){logger['error']('UpdateFaxApplication',_0x194998[_0xc18e('0x11')],_0xda93d8);_0x3a279e(_0x11b88a[_0xc18e('0x10')](0x1f4,_0x194998['message']));});});}; \ No newline at end of file +var _0xcf70=['result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','code','error','message'];(function(_0x3fd81a,_0x137a1a){var _0x51cf60=function(_0x1919c1){while(--_0x1919c1){_0x3fd81a['push'](_0x3fd81a['shift']());}};_0x51cf60(++_0x137a1a);}(_0xcf70,0x94));var _0x0cf7=function(_0x543670,_0x4d26b5){_0x543670=_0x543670-0x0;var _0x1e1c2d=_0xcf70[_0x543670];return _0x1e1c2d;};'use strict';var _=require(_0x0cf7('0x0'));var util=require(_0x0cf7('0x1'));var moment=require(_0x0cf7('0x2'));var BPromise=require(_0x0cf7('0x3'));var rs=require(_0x0cf7('0x4'));var fs=require('fs');var Redis=require(_0x0cf7('0x5'));var db=require(_0x0cf7('0x6'))['db'];var utils=require(_0x0cf7('0x7'));var logger=require(_0x0cf7('0x8'))(_0x0cf7('0x9'));var config=require('../../config/environment');var jayson=require(_0x0cf7('0xa'));var client=jayson['client'][_0x0cf7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28aac7,_0x59758a,_0x6f757f){return new BPromise(function(_0x352126,_0x39e5c8){return client[_0x0cf7('0xc')](_0x28aac7,_0x6f757f)[_0x0cf7('0xd')](function(_0x5192f8){logger[_0x0cf7('0xe')](_0x0cf7('0xf'),_0x59758a,_0x0cf7('0x10'));logger[_0x0cf7('0x11')](_0x0cf7('0x12'),_0x59758a,_0x0cf7('0x10'),JSON['stringify'](_0x5192f8));if(_0x5192f8['error']){if(_0x5192f8['error'][_0x0cf7('0x13')]===0x1f4){logger[_0x0cf7('0x14')](_0x0cf7('0xf'),_0x59758a,_0x5192f8[_0x0cf7('0x14')][_0x0cf7('0x15')]);return _0x39e5c8(_0x5192f8[_0x0cf7('0x14')]['message']);}logger['error'](_0x0cf7('0xf'),_0x59758a,_0x5192f8[_0x0cf7('0x14')]['message']);return _0x352126(_0x5192f8[_0x0cf7('0x14')][_0x0cf7('0x15')]);}else{logger['info'](_0x0cf7('0xf'),_0x59758a,'request\x20sent');_0x352126(_0x5192f8[_0x0cf7('0x16')][_0x0cf7('0x15')]);}})[_0x0cf7('0x17')](function(_0x4c5bca){logger[_0x0cf7('0x14')](_0x0cf7('0xf'),_0x59758a,_0x4c5bca);_0x39e5c8(_0x4c5bca);});});}exports[_0x0cf7('0x18')]=function(_0x107e5e){var _0x3cbf6d=this;return new Promise(function(_0x51f487,_0x6b411d){return db[_0x0cf7('0x19')][_0x0cf7('0x1a')](_0x107e5e[_0x0cf7('0x1b')],{'raw':_0x107e5e[_0x0cf7('0x1c')]?_0x107e5e[_0x0cf7('0x1c')][_0x0cf7('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x107e5e[_0x0cf7('0x1c')]?_0x107e5e[_0x0cf7('0x1c')][_0x0cf7('0x1e')]||null:null,'attributes':_0x107e5e[_0x0cf7('0x1c')]?_0x107e5e[_0x0cf7('0x1c')][_0x0cf7('0x1f')]||null:null,'limit':_0x107e5e[_0x0cf7('0x1c')]?_0x107e5e[_0x0cf7('0x1c')][_0x0cf7('0x20')]||null:null})['then'](function(_0x42a071){logger[_0x0cf7('0xe')](_0x0cf7('0x18'),_0x107e5e);logger['debug']('UpdateFaxApplication',_0x107e5e,JSON[_0x0cf7('0x21')](_0x42a071));_0x51f487(_0x42a071);})[_0x0cf7('0x17')](function(_0x1408e5){logger[_0x0cf7('0x14')](_0x0cf7('0x18'),_0x1408e5[_0x0cf7('0x15')],_0x107e5e);_0x6b411d(_0x3cbf6d[_0x0cf7('0x14')](0x1f4,_0x1408e5[_0x0cf7('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 5303cfd..9dcd5cd 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 _0xefda=['post','create','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','index','/:id','isAuthenticated'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xefda,0x96));var _0xaefd=function(_0x5edbcf,_0x4fd67e){_0x5edbcf=_0x5edbcf-0x0;var _0xfedcc1=_0xefda[_0x5edbcf];return _0xfedcc1;};'use strict';var multer=require(_0xaefd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaefd('0x1'));var express=require(_0xaefd('0x2'));var router=express['Router']();var fs_extra=require(_0xaefd('0x3'));var auth=require(_0xaefd('0x4'));var interaction=require(_0xaefd('0x5'));var config=require(_0xaefd('0x6'));var controller=require(_0xaefd('0x7'));router[_0xaefd('0x8')]('/',auth['isAuthenticated'](),controller[_0xaefd('0x9')]);router[_0xaefd('0x8')](_0xaefd('0xa'),auth[_0xaefd('0xb')](),controller['show']);router[_0xaefd('0xc')]('/',auth[_0xaefd('0xb')](),controller[_0xaefd('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xaefd('0xe')]);router[_0xaefd('0xf')](_0xaefd('0xa'),auth[_0xaefd('0xb')](),controller[_0xaefd('0x10')]);module[_0xaefd('0x11')]=router; \ No newline at end of file +var _0xd4a2=['../../components/auth/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','connect-timeout','Router'];(function(_0x228e7e,_0x4a4f50){var _0x16ec84=function(_0x1949ff){while(--_0x1949ff){_0x228e7e['push'](_0x228e7e['shift']());}};_0x16ec84(++_0x4a4f50);}(_0xd4a2,0x173));var _0x2d4a=function(_0x2461d9,_0x21ddd3){_0x2461d9=_0x2461d9-0x0;var _0x517364=_0xd4a2[_0x2461d9];return _0x517364;};'use strict';var multer=require(_0x2d4a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2d4a('0x1'));var express=require('express');var router=express[_0x2d4a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2d4a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2d4a('0x4'));var controller=require(_0x2d4a('0x5'));router[_0x2d4a('0x6')]('/',auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x8')]);router['get'](_0x2d4a('0x9'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xa')]);router[_0x2d4a('0xb')]('/',auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xc')]);router[_0x2d4a('0xd')](_0x2d4a('0x9'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xe')]);router[_0x2d4a('0xf')](_0x2d4a('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x2d4a('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 07ae913..247df8a 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 _0xf930=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x121c29,_0x392b98){var _0x569e32=function(_0x3acfab){while(--_0x3acfab){_0x121c29['push'](_0x121c29['shift']());}};_0x569e32(++_0x392b98);}(_0xf930,0x17e));var _0x0f93=function(_0x35e21a,_0x689d32){_0x35e21a=_0x35e21a-0x0;var _0x50949e=_0xf930[_0x35e21a];return _0x50949e;};'use strict';var Sequelize=require(_0x0f93('0x0'));module[_0x0f93('0x1')]={'closed':{'type':Sequelize[_0x0f93('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0f93('0x3')]},'disposition':{'type':Sequelize[_0x0f93('0x4')]},'secondDisposition':{'type':Sequelize[_0x0f93('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x0f93('0x3')]},'fax':{'type':Sequelize[_0x0f93('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x0f93('0x5')]('in',_0x0f93('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x0f93('0x5')]('in',_0x0f93('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xb94f=['exports','DATE','STRING','ENUM','out','sequelize'];(function(_0x416a91,_0x3008b3){var _0x59552a=function(_0x7dd072){while(--_0x7dd072){_0x416a91['push'](_0x416a91['shift']());}};_0x59552a(++_0x3008b3);}(_0xb94f,0x83));var _0xfb94=function(_0x46306f,_0x5aef14){_0x46306f=_0x46306f-0x0;var _0x16a27f=_0xb94f[_0x46306f];return _0x16a27f;};'use strict';var Sequelize=require(_0xfb94('0x0'));module[_0xfb94('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfb94('0x2')]},'disposition':{'type':Sequelize[_0xfb94('0x3')]},'secondDisposition':{'type':Sequelize[_0xfb94('0x3')]},'thirdDisposition':{'type':Sequelize[_0xfb94('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xfb94('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xfb94('0x4')]('in',_0xfb94('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xfb94('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xfb94('0x4')]('in',_0xfb94('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index cb5adc8..57f769e 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 _0x20c6=['createWriteStream','log','eml-format','request-promise','moment','bluebird','mustache','util','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/license/util','../../mysqldb','redis','defaults','localhost','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','map','fullname','TagIds','split','forEach','push','index','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','select','field','color','tools_tags','u.id','u.fullname','user_has_fax_interactions','left_join','users','from','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','fax_interaction_has_tags','expr','search','sqlOperator','conditions','unreadMessages','`\x20=\x200','having','Contact','operator','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','i.FaxAccountId\x20IN\x20?','concat','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','filter','replace','isNumeric','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','order','DESC','t.id\x20IN\x20?','resolve','FaxAccountId','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','i.FaxAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','fields','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.FaxInteractionId\x20IN\x20?','FaxInteractionId','rows','catch','show','params','includeAll','include','FaxInteraction','find','create','describe','addMessage','FaxMessage','ids','omit','getMessages','pick','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','spread','emit','faxInteractionTags:save','removeTags','download','unix','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream'];(function(_0x4ebc94,_0x1b5aa1){var _0x1bbfdb=function(_0x373206){while(--_0x373206){_0x4ebc94['push'](_0x4ebc94['shift']());}};_0x1bbfdb(++_0x1b5aa1);}(_0x20c6,0xd4));var _0x620c=function(_0x286a7f,_0x21db56){_0x286a7f=_0x286a7f-0x0;var _0x3faca1=_0x20c6[_0x286a7f];return _0x3faca1;};'use strict';var emlformat=require(_0x620c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x620c('0x1'));var moment=require(_0x620c('0x2'));var BPromise=require(_0x620c('0x3'));var Mustache=require(_0x620c('0x4'));var util=require(_0x620c('0x5'));var path=require('path');var sox=require(_0x620c('0x6'));var csv=require(_0x620c('0x7'));var ejs=require(_0x620c('0x8'));var fs=require('fs');var fs_extra=require(_0x620c('0x9'));var _=require(_0x620c('0xa'));var squel=require(_0x620c('0xb'));var crypto=require(_0x620c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x620c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x620c('0xe'));var Papa=require('papaparse');var Redis=require(_0x620c('0xf'));var authService=require(_0x620c('0x10'));var qs=require(_0x620c('0x11'));var as=require(_0x620c('0x12'));var hardwareService=require(_0x620c('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x620c('0x14'));var db=require(_0x620c('0x15'))['db'];config[_0x620c('0x16')]=_[_0x620c('0x17')](config[_0x620c('0x16')],{'host':_0x620c('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x620c('0x16')]));require(_0x620c('0x19'))[_0x620c('0x1a')](socket);function respondWithStatusCode(_0x5d4e4c,_0x547477){_0x547477=_0x547477||0xcc;return function(_0x1e524b){if(_0x1e524b){return _0x5d4e4c[_0x620c('0x1b')](_0x547477);}return _0x5d4e4c[_0x620c('0x1c')](_0x547477)[_0x620c('0x1d')]();};}function respondWithResult(_0x5b76d7,_0x23e432){_0x23e432=_0x23e432||0xc8;return function(_0x2a7e39){if(_0x2a7e39){return _0x5b76d7[_0x620c('0x1c')](_0x23e432)[_0x620c('0x1e')](_0x2a7e39);}};}function respondWithFilteredResult(_0x5d5161,_0x182fb6){return function(_0x22f167){if(_0x22f167){var _0x4bd7b=typeof _0x182fb6[_0x620c('0x1f')]===_0x620c('0x20')&&typeof _0x182fb6[_0x620c('0x21')]===_0x620c('0x20');var _0x1bc7a0=_0x22f167[_0x620c('0x22')];var _0x253af7=_0x4bd7b?0x0:_0x182fb6[_0x620c('0x1f')];var _0x21545c=_0x4bd7b?_0x22f167[_0x620c('0x22')]:_0x182fb6['offset']+_0x182fb6['limit'];var _0x1a57c1;if(_0x21545c>=_0x1bc7a0){_0x21545c=_0x1bc7a0;_0x1a57c1=0xc8;}else{_0x1a57c1=0xce;}_0x5d5161[_0x620c('0x1c')](_0x1a57c1);return _0x5d5161['set'](_0x620c('0x23'),_0x253af7+'-'+_0x21545c+'/'+_0x1bc7a0)['json'](_0x22f167);}return null;};}function patchUpdates(_0xb88ac3){return function(_0x4f04b7){try{jsonpatch[_0x620c('0x24')](_0x4f04b7,_0xb88ac3,!![]);}catch(_0x2b6798){return BPromise[_0x620c('0x25')](_0x2b6798);}return _0x4f04b7[_0x620c('0x26')]();};}function saveUpdates(_0x4dd2c6,_0x5186b6){return function(_0x44c00b){if(_0x44c00b){return _0x44c00b[_0x620c('0x27')](_0x4dd2c6)[_0x620c('0x28')](function(_0x27335d){return _0x27335d;});}return null;};}function removeEntity(_0x2cb781,_0x6385c7){return function(_0x281461){if(_0x281461){return _0x281461['destroy']()[_0x620c('0x28')](function(){_0x2cb781[_0x620c('0x1c')](0xcc)[_0x620c('0x1d')]();});}};}function handleEntityNotFound(_0x373b20,_0x65d673){return function(_0x9661fd){if(!_0x9661fd){_0x373b20[_0x620c('0x1b')](0x194);}return _0x9661fd;};}function handleError(_0x5c4f09,_0x394e55){_0x394e55=_0x394e55||0x1f4;return function(_0x58c130){logger[_0x620c('0x29')](_0x58c130[_0x620c('0x2a')]);if(_0x58c130[_0x620c('0x2b')]){delete _0x58c130[_0x620c('0x2b')];}_0x5c4f09[_0x620c('0x1c')](_0x394e55)['send'](_0x58c130);};}function getInteractionUsers(_0x533508,_0x45f91e){return new BPromise(function(_0x423b82,_0x1aa8b3){try{if(_0x45f91e[_0x533508['id']]){_0x533508['Users']=_[_0x620c('0x2c')](_0x45f91e[_0x533508['id']],function(_0x14bf3e){return{'id':_0x14bf3e['id'],'fullname':_0x14bf3e[_0x620c('0x2d')]};});}}catch(_0x4dbc13){_0x1aa8b3(_0x4dbc13);}_0x423b82(_0x533508);});}function getInteractionTags(_0x54a4a0,_0x3d14c7){return new BPromise(function(_0x1c50fd,_0x3ba969){try{if(_0x54a4a0['TagIds']){_0x54a4a0['Tags']=[];_0x54a4a0[_0x620c('0x2e')][_0x620c('0x2f')](',')[_0x620c('0x30')](function(_0x98ab86){_0x54a4a0['Tags'][_0x620c('0x31')](_0x3d14c7[_0x98ab86]);});}delete _0x54a4a0['TagIds'];}catch(_0x55757f){_0x3ba969(_0x55757f);}_0x1c50fd(_0x54a4a0);});}function updateFaxInteraction(_0x146d9d,_0x559388,_0x572b6f){return new BPromise(function(_0x4fbe4a,_0x450dd6){return getInteractionUsers(_0x146d9d,_0x572b6f)[_0x620c('0x28')](function(_0x39bde2){return getInteractionTags(_0x39bde2,_0x559388);})[_0x620c('0x28')](function(_0x414603){_0x4fbe4a(_0x414603);})['catch'](function(_0x2b093e){_0x450dd6(_0x2b093e);});});}exports[_0x620c('0x32')]=function(_0x4bfd50,_0x4bf719){var _0x1619c3={},_0x505be9={},_0x112f1c={'count':0x0,'rows':[]};var _0x2e6d46=_[_0x620c('0x2c')](db['FaxInteraction'][_0x620c('0x33')],function(_0x366614){return{'name':_0x366614['fieldName'],'type':_0x366614[_0x620c('0x34')][_0x620c('0x35')]};});_0x505be9[_0x620c('0x36')]=_[_0x620c('0x2c')](_0x2e6d46,_0x620c('0x2b'));_0x505be9[_0x620c('0x37')]=_[_0x620c('0x38')](_0x4bfd50[_0x620c('0x37')]);_0x505be9[_0x620c('0x39')]=_[_0x620c('0x3a')](_0x505be9[_0x620c('0x36')],_0x505be9[_0x620c('0x37')]);_0x1619c3[_0x620c('0x3b')]=_[_0x620c('0x3a')](_0x505be9[_0x620c('0x36')],qs['fields'](_0x4bfd50[_0x620c('0x37')]['fields']));_0x1619c3[_0x620c('0x3b')]=_0x1619c3[_0x620c('0x3b')][_0x620c('0x3c')]?_0x1619c3[_0x620c('0x3b')]:_0x505be9[_0x620c('0x36')];if(!_0x4bfd50[_0x620c('0x37')][_0x620c('0x3d')](_0x620c('0x3e'))){_0x1619c3[_0x620c('0x21')]=qs['limit'](_0x4bfd50[_0x620c('0x37')][_0x620c('0x21')]);_0x1619c3[_0x620c('0x1f')]=qs[_0x620c('0x1f')](_0x4bfd50[_0x620c('0x37')][_0x620c('0x1f')]);}_0x1619c3['order']=qs['sort'](_0x4bfd50[_0x620c('0x37')][_0x620c('0x3f')]);_0x1619c3[_0x620c('0x40')]=qs['filters'](_['pick'](_0x4bfd50['query'],_0x505be9['filters']),_0x2e6d46);var _0x8ee301=[];var _0x497837=squel[_0x620c('0x41')]()[_0x620c('0x42')]('id')[_0x620c('0x42')](_0x620c('0x2b'))['field'](_0x620c('0x43'))['from'](_0x620c('0x44'));var _0x1982fa=squel[_0x620c('0x41')]()[_0x620c('0x42')](_0x620c('0x45'))[_0x620c('0x42')](_0x620c('0x46'))['field']('ui.FaxInteractionId')['from'](_0x620c('0x47'),'ui')[_0x620c('0x48')](_0x620c('0x49'),'u','u.id\x20=\x20ui.UserId');var _0x5bbf70=squel[_0x620c('0x41')]()[_0x620c('0x4a')](_0x620c('0x4b'),'i')[_0x620c('0x48')](_0x620c('0x4c'),'c',_0x620c('0x4d'))[_0x620c('0x48')](_0x620c('0x49'),'o',_0x620c('0x4e'))['left_join'](_0x620c('0x4f'),'a',_0x620c('0x50'))[_0x620c('0x48')](_0x620c('0x51'),'me','me.FaxInteractionId\x20=\x20i.id')[_0x620c('0x48')](_0x620c('0x52'),'it','it.FaxInteractionId\x20=\x20i.id')['left_join'](_0x620c('0x44'),'t','t.id\x20=\x20it.TagId');var _0x96859f=squel[_0x620c('0x53')]();var _0x387f39=[];var _0xd84237=squel[_0x620c('0x53')]();var _0x2178d1;if(_0x4bfd50[_0x620c('0x37')][_0x620c('0x54')]){_0x2178d1=as['parseSearch'](_0x4bfd50[_0x620c('0x37')]['search']);var _0x13dfbe=_0x2178d1[_0x620c('0x55')];for(var _0x540893=0x0;_0x540893<_0x2178d1['conditions'][_0x620c('0x3c')];_0x540893++){var _0x432a4b=_0x2178d1[_0x620c('0x56')][_0x540893];var _0x3734ae='i';var _0x264f1=_['find'](_0x2e6d46,[_0x620c('0x2b'),_0x432a4b[_0x620c('0x42')]]);if(!_0x264f1){switch(_0x432a4b[_0x620c('0x42')]){case _0x620c('0x57'):if(_0x432a4b['value']==0x1){_0x5bbf70['having']('`'+_0x432a4b['field']+_0x620c('0x58'));}else{_0x5bbf70[_0x620c('0x59')]('`'+_0x432a4b[_0x620c('0x42')]+'`\x20>\x200');}break;case _0x620c('0x5a'):if(_0x432a4b[_0x620c('0x5b')]==='$substring'){if(_0x432a4b[_0x620c('0x5c')][_0x620c('0x2f')]('\x20')[_0x620c('0x3c')]>0x1){_0x96859f[_0x13dfbe](_0x620c('0x5d'),qs['getFullTextValue'](_0x432a4b['value']),null);}else{var _0x459a54='%'+_0x432a4b['value']+'%';_0x96859f[_0x13dfbe](_0x620c('0x5e'),_0x459a54,_0x459a54,_0x459a54);}}else{_0x264f1=_['find'](_0x2e6d46,[_0x620c('0x2b'),'ContactId']);_0x432a4b[_0x620c('0x42')]=_0x620c('0x5f');_0x5269f1=as[_0x620c('0x60')](_0x3734ae,_0x264f1['type'],_0x432a4b);_0x96859f[_0x13dfbe](_0x5269f1[_0x620c('0x61')],_0x5269f1['value'][_0x620c('0x62')],_0x5269f1[_0x620c('0x5c')][_0x620c('0x1d')]);}break;case'Tag':var _0xa973dd=_0x432a4b['value'][_0x620c('0x2f')](',')[_0x620c('0x2c')](function(_0x48aedc){return Number(_0x48aedc);});_0xa973dd['forEach'](function(_0x336e3c){_0xd84237['or'](_0x620c('0x63'),'%,'+_0x336e3c+',%');});_0x387f39=_[_0x620c('0x64')](_0x387f39,_0xa973dd);break;case _0x620c('0x65'):if(_0x432a4b[_0x620c('0x5b')]===_0x620c('0x66')){_0x96859f[_0x13dfbe](_0x620c('0x67'),'%'+_0x432a4b[_0x620c('0x5c')]+'%',null);}else{_0x264f1=_['find'](_0x2e6d46,[_0x620c('0x2b'),_0x620c('0x68')]);_0x432a4b[_0x620c('0x42')]=_0x620c('0x68');_0x5269f1=as[_0x620c('0x60')](_0x3734ae,_0x264f1[_0x620c('0x34')],_0x432a4b);_0x96859f[_0x13dfbe](_0x5269f1[_0x620c('0x61')],_0x5269f1[_0x620c('0x5c')][_0x620c('0x62')],_0x5269f1['value']['end']);}break;case _0x620c('0x69'):_0x5269f1=as[_0x620c('0x60')]('me',null,_0x432a4b);_0x96859f[_0x13dfbe](_0x5269f1[_0x620c('0x61')],_0x5269f1[_0x620c('0x5c')][_0x620c('0x62')],_0x5269f1['value'][_0x620c('0x1d')]);break;}}else{var _0x5269f1=as[_0x620c('0x60')](_0x3734ae,_0x264f1[_0x620c('0x34')],_0x432a4b);_0x96859f[_0x13dfbe](_0x5269f1[_0x620c('0x61')],_0x5269f1[_0x620c('0x5c')][_0x620c('0x62')],_0x5269f1[_0x620c('0x5c')][_0x620c('0x1d')]);}}}else{var _0x425320=_(_0x4bfd50[_0x620c('0x37')])[_0x620c('0x38')]()['map'](function(_0x4de398){return _[_0x620c('0x6a')](_0x2e6d46,[_0x620c('0x2b'),_0x4de398])?_0x4de398:undefined;})[_0x620c('0x6b')]()[_0x620c('0x5c')]();if(!_[_0x620c('0x6c')](_0x425320)){_0x425320[_0x620c('0x30')](function(_0x57fb03){if(_0x57fb03==='FaxAccountId'){_0x5bbf70['where'](_0x620c('0x6d'),[][_0x620c('0x6e')](_0x4bfd50[_0x620c('0x37')][_0x57fb03]));}else if(_0x57fb03==='createdAt'){var _0x249bbd=JSON[_0x620c('0x6f')](_0x4bfd50[_0x620c('0x37')][_0x57fb03])[_0x620c('0x70')];var _0x234df5=JSON[_0x620c('0x6f')](_0x4bfd50[_0x620c('0x37')][_0x57fb03])['$lte'];_0x5bbf70[_0x620c('0x40')](_0x620c('0x71'),_0x249bbd,_0x234df5);}else{if(_0x4bfd50[_0x620c('0x37')][_0x57fb03]==='null'){_0x5bbf70[_0x620c('0x40')]('i.'+_0x57fb03+'\x20IS\x20NULL');}else{_0x5bbf70[_0x620c('0x40')]('i.'+_0x57fb03+_0x620c('0x72'),_0x4bfd50[_0x620c('0x37')][_0x57fb03]);}}});}if(_0x4bfd50['query'][_0x620c('0x73')]){if(_0x4bfd50[_0x620c('0x37')]['read']==0x1){_0x5bbf70[_0x620c('0x59')](_0x620c('0x74'));}else{_0x5bbf70[_0x620c('0x59')]('`unreadMessages`\x20>\x200');}}if(_0x4bfd50[_0x620c('0x37')][_0x620c('0x75')]){_0x387f39=_['isArray'](_0x4bfd50[_0x620c('0x37')]['tag'])?_0x4bfd50[_0x620c('0x37')][_0x620c('0x75')]:new Array(_0x4bfd50[_0x620c('0x37')][_0x620c('0x75')]);_0x387f39['forEach'](function(_0x473b83){_0xd84237['or'](_0x620c('0x63'),'%,'+_0x473b83+',%');});}if(_0x4bfd50[_0x620c('0x37')]['filter']){var _0x37a684=_0x4bfd50[_0x620c('0x37')][_0x620c('0x76')][_0x620c('0x77')]('\x5c','\x5c\x5c')[_0x620c('0x77')](/'/g,'\x27\x27');if(qs[_0x620c('0x78')](_0x37a684)){_0x96859f['or']('i.id\x20LIKE\x20?',_0x37a684+'%')['or'](_0x620c('0x79'),_0x37a684+'%');}_0x96859f['or'](_0x620c('0x7a'),_0x37a684+'%');}}_0x5bbf70[_0x620c('0x40')](_0x96859f);_0x5bbf70['group'](_0x620c('0x7b'));var _0x28e499={'type':db[_0x620c('0x7c')][_0x620c('0x7d')][_0x620c('0x7e')],'raw':!![]};var _0x540c24=_0x5bbf70[_0x620c('0x7f')]();_0x540c24[_0x620c('0x42')]('i.id');_0x540c24['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x1619c3['order']){_0x1619c3['order'][_0x620c('0x30')](function(_0x36ef39){var _0x5364aa=_0x36ef39[0x0]===_0x620c('0x80')?_0x36ef39[0x0]:'i.'+_0x36ef39[0x0];_0x5bbf70[_0x620c('0x81')](_0x5364aa,_0x36ef39[0x1]===_0x620c('0x82')?![]:!![]);});}if(!_[_0x620c('0x6c')](_0x387f39)){_0x5bbf70['having'](_0xd84237);_0x540c24[_0x620c('0x40')](_0x620c('0x83'),_0x387f39);}BPromise[_0x620c('0x84')]()['then'](function(){if(!_0x2178d1){if(_0x4bfd50[_0x620c('0x37')][_0x620c('0x85')])return;_0x540c24[_0x620c('0x40')](_0x620c('0x86'));_0x5bbf70[_0x620c('0x40')](_0x620c('0x86'));return;}if(_0x4bfd50[_0x620c('0x87')][_0x620c('0x88')]!=='agent')return;return _0x4bfd50[_0x620c('0x87')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0x620c('0x28')](function(_0x187141){if(_[_0x620c('0x6c')](_0x187141)){_0x540c24[_0x620c('0x40')](_0x620c('0x89'));_0x5bbf70[_0x620c('0x40')](_0x620c('0x89'));}else{_0x540c24['where'](_0x620c('0x6d'),_[_0x620c('0x2c')](_0x187141,'id'));_0x5bbf70[_0x620c('0x40')](_0x620c('0x6d'),_[_0x620c('0x2c')](_0x187141,'id'));}});})[_0x620c('0x28')](function(){if(_0x4bfd50[_0x620c('0x87')]['role']===_0x620c('0x8a')&&!_0x2178d1&&!_0x4bfd50['query'][_0x620c('0x85')])return[];return db[_0x620c('0x8b')][_0x620c('0x37')](_0x540c24['toString'](),_0x28e499);})[_0x620c('0x28')](function(_0x24df25){_0x112f1c['count']=_0x24df25['length'];if(_0x112f1c[_0x620c('0x22')]===0x0)return[];return db[_0x620c('0x8b')]['query'](_0x497837[_0x620c('0x8c')](),_0x28e499)['then'](function(_0x347238){_0x8ee301=_[_0x620c('0x8d')](_0x347238,'id');_0x28e499=_[_0x620c('0x8e')](_0x28e499,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4bfd50[_0x620c('0x37')][_0x620c('0x8f')]){_0x1619c3[_0x620c('0x3b')][_0x620c('0x30')](function(_0x5b46ea){_0x5bbf70[_0x620c('0x42')]('i.'+_0x5b46ea);});}else{_0x5bbf70[_0x620c('0x42')](_0x620c('0x90'),_0x620c('0x57'));_0x5bbf70[_0x620c('0x42')]('a.key',_0x620c('0x91'));_0x5bbf70[_0x620c('0x42')](_0x620c('0x92'),'Account.mandatoryDisposition');_0x5bbf70[_0x620c('0x42')]('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',_0x620c('0x80'));_0x5bbf70[_0x620c('0x42')](_0x620c('0x93'));_0x5bbf70['field'](_0x620c('0x94'),_0x620c('0x95'));_0x5bbf70['field'](_0x620c('0x96'),_0x620c('0x97'));_0x5bbf70[_0x620c('0x42')](_0x620c('0x98'),_0x620c('0x99'));_0x5bbf70[_0x620c('0x42')](_0x620c('0x9a'),_0x620c('0x9b'));_0x5bbf70['field'](_0x620c('0x9c'),_0x620c('0x9d'));_0x5bbf70[_0x620c('0x42')](_0x620c('0x9e'),_0x620c('0x9f'));_0x5bbf70[_0x620c('0x42')](_0x620c('0xa0'),_0x620c('0xa1'));_0x5bbf70[_0x620c('0x42')](_0x620c('0xa2'),_0x620c('0xa3'));_0x5bbf70[_0x620c('0x42')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x1619c3[_0x620c('0x21')])_0x5bbf70[_0x620c('0x21')](_0x1619c3['limit']);if(_0x1619c3[_0x620c('0x1f')])_0x5bbf70[_0x620c('0x1f')](_0x1619c3[_0x620c('0x1f')]);return db[_0x620c('0x8b')]['query'](_0x5bbf70['toString'](),_0x28e499);})['then'](function(_0x26f3dd){if(_0x26f3dd['length']>0x0)_0x1982fa[_0x620c('0x40')](_0x620c('0xa4'),_['map'](_0x26f3dd,'id'));return db[_0x620c('0x8b')]['query'](_0x1982fa[_0x620c('0x8c')](),_0x28e499)[_0x620c('0x28')](function(_0x46ad91){var _0x543fe3=_['groupBy'](_0x46ad91,_0x620c('0xa5'));var _0xab3aa5=[];_0x26f3dd[_0x620c('0x30')](function(_0x2592e7){_0xab3aa5[_0x620c('0x31')](updateFaxInteraction(_0x2592e7,_0x8ee301,_0x543fe3));});return BPromise['all'](_0xab3aa5);});});})[_0x620c('0x28')](function(_0x2a25d5){_0x112f1c[_0x620c('0xa6')]=_0x2a25d5;return _0x112f1c;})['then'](respondWithFilteredResult(_0x4bf719,_0x1619c3))[_0x620c('0xa7')](handleError(_0x4bf719,null));};exports[_0x620c('0xa8')]=function(_0x5d80ec,_0x50e144){var _0x442d8d={'raw':![],'where':{'id':_0x5d80ec[_0x620c('0xa9')]['id']}},_0x1fb24c={};_0x1fb24c[_0x620c('0x36')]=_[_0x620c('0x38')](db['FaxInteraction'][_0x620c('0x33')]);_0x1fb24c['query']=_[_0x620c('0x38')](_0x5d80ec[_0x620c('0x37')]);_0x1fb24c[_0x620c('0x39')]=_[_0x620c('0x3a')](_0x1fb24c[_0x620c('0x36')],_0x1fb24c[_0x620c('0x37')]);_0x442d8d[_0x620c('0x3b')]=_[_0x620c('0x3a')](_0x1fb24c[_0x620c('0x36')],qs['fields'](_0x5d80ec[_0x620c('0x37')][_0x620c('0x8f')]));_0x442d8d[_0x620c('0x3b')]=_0x442d8d[_0x620c('0x3b')]['length']?_0x442d8d[_0x620c('0x3b')]:_0x1fb24c['model'];if(_0x5d80ec[_0x620c('0x37')][_0x620c('0xaa')]){_0x442d8d[_0x620c('0xab')]=[{'all':!![]}];}_0x442d8d=_[_0x620c('0x8e')]({},_0x442d8d,_0x5d80ec['options']);return db[_0x620c('0xac')][_0x620c('0xad')](_0x442d8d)[_0x620c('0x28')](handleEntityNotFound(_0x50e144,null))[_0x620c('0x28')](respondWithResult(_0x50e144,null))[_0x620c('0xa7')](handleError(_0x50e144,null));};exports[_0x620c('0xae')]=function(_0x40b392,_0x5819bc){return db[_0x620c('0xac')]['create'](_0x40b392[_0x620c('0x69')],{})[_0x620c('0x28')](respondWithResult(_0x5819bc,0xc9))[_0x620c('0xa7')](handleError(_0x5819bc,null));};exports['update']=function(_0x371212,_0x408b34){if(_0x371212['body']['id']){delete _0x371212[_0x620c('0x69')]['id'];}return db[_0x620c('0xac')][_0x620c('0xad')]({'where':{'id':_0x371212[_0x620c('0xa9')]['id']}})[_0x620c('0x28')](handleEntityNotFound(_0x408b34,null))[_0x620c('0x28')](saveUpdates(_0x371212[_0x620c('0x69')],null))[_0x620c('0x28')](respondWithResult(_0x408b34,null))[_0x620c('0xa7')](handleError(_0x408b34,null));};exports['destroy']=function(_0x371cbc,_0x26387d){return db[_0x620c('0xac')][_0x620c('0xad')]({'where':{'id':_0x371cbc[_0x620c('0xa9')]['id']}})[_0x620c('0x28')](handleEntityNotFound(_0x26387d,null))[_0x620c('0x28')](removeEntity(_0x26387d,null))[_0x620c('0xa7')](handleError(_0x26387d,null));};exports[_0x620c('0xaf')]=function(_0x2d92c4,_0x5a1d66){return db[_0x620c('0xac')][_0x620c('0xaf')]()[_0x620c('0x28')](respondWithResult(_0x5a1d66,null))[_0x620c('0xa7')](handleError(_0x5a1d66,null));};exports[_0x620c('0xb0')]=function(_0x535c35,_0xc413ef,_0x12b775){return db[_0x620c('0xb1')][_0x620c('0xad')]({'where':{'id':_0x535c35[_0x620c('0xa9')]['id']}})[_0x620c('0x28')](handleEntityNotFound(_0xc413ef,null))[_0x620c('0x28')](function(_0x27ce3d){if(_0x27ce3d){return _0x27ce3d[_0x620c('0xb0')](_0x535c35[_0x620c('0x69')][_0x620c('0xb2')],_[_0x620c('0xb3')](_0x535c35['body'],['ids','id'])||{});}})['then'](respondWithResult(_0xc413ef,null))[_0x620c('0xa7')](handleError(_0xc413ef,null));};exports[_0x620c('0xb4')]=function(_0x1ecaa3,_0x47838c,_0x20cfa0){var _0x25af5a={'raw':![],'where':{}};var _0x2a641a={};var _0xe46ea8={'count':0x0,'rows':[]};return db[_0x620c('0xac')]['findOne']({'where':{'id':_0x1ecaa3[_0x620c('0xa9')]['id']}})[_0x620c('0x28')](handleEntityNotFound(_0x47838c,null))[_0x620c('0x28')](function(_0x22d0bf){if(_0x22d0bf){_0x2a641a[_0x620c('0x36')]=_['keys'](db['FaxMessage'][_0x620c('0x33')]);_0x2a641a[_0x620c('0x37')]=_[_0x620c('0x38')](_0x1ecaa3[_0x620c('0x37')]);_0x2a641a[_0x620c('0x39')]=_['intersection'](_0x2a641a[_0x620c('0x36')],_0x2a641a['query']);_0x25af5a[_0x620c('0x3b')]=_[_0x620c('0x3a')](_0x2a641a[_0x620c('0x36')],qs[_0x620c('0x8f')](_0x1ecaa3[_0x620c('0x37')][_0x620c('0x8f')]));_0x25af5a[_0x620c('0x3b')]=_0x25af5a['attributes']['length']?_0x25af5a[_0x620c('0x3b')]:_0x2a641a[_0x620c('0x36')];if(!_0x1ecaa3[_0x620c('0x37')][_0x620c('0x3d')]('nolimit')){_0x25af5a['limit']=qs['limit'](_0x1ecaa3[_0x620c('0x37')][_0x620c('0x21')]);_0x25af5a[_0x620c('0x1f')]=qs[_0x620c('0x1f')](_0x1ecaa3[_0x620c('0x37')][_0x620c('0x1f')]);}_0x25af5a[_0x620c('0x81')]=qs[_0x620c('0x3f')](_0x1ecaa3[_0x620c('0x37')]['sort']);_0x25af5a[_0x620c('0x40')]=qs[_0x620c('0x39')](_[_0x620c('0xb5')](_0x1ecaa3[_0x620c('0x37')],_0x2a641a[_0x620c('0x39')]));_0x25af5a[_0x620c('0x40')][_0x620c('0xa5')]=_0x22d0bf['id'];if(_0x1ecaa3[_0x620c('0x37')]['filter']){_0x25af5a[_0x620c('0x40')]=_['merge'](_0x25af5a[_0x620c('0x40')],{'$or':_[_0x620c('0x2c')](_0x25af5a['attributes'],function(_0x1c6b15){var _0x11f2c7={};_0x11f2c7[_0x1c6b15]={'$like':'%'+_0x1ecaa3[_0x620c('0x37')][_0x620c('0x76')]+'%'};return _0x11f2c7;})});}if(_0x1ecaa3[_0x620c('0x37')][_0x620c('0x70')]){var _0x5adbc5=_0x1ecaa3[_0x620c('0x37')]['$gte'][_0x620c('0x2f')](',');var _0x59cbe6={};_0x59cbe6[_0x5adbc5[0x0]]={'$gte':moment(_0x5adbc5[0x1])[_0x620c('0xb6')](_0x620c('0xb7'))};_0x25af5a['where']=_[_0x620c('0x8e')](_0x25af5a[_0x620c('0x40')],_0x59cbe6);}_0x25af5a=_['merge']({},_0x25af5a,_0x1ecaa3[_0x620c('0xb8')]);return db['FaxMessage']['count']({'where':_0x25af5a[_0x620c('0x40')]})[_0x620c('0x28')](function(_0x37e8b6){_0xe46ea8[_0x620c('0x22')]=_0x37e8b6;if(_0x1ecaa3['query'][_0x620c('0xaa')]){_0x25af5a[_0x620c('0xab')]=[{'all':!![]}];}return db['FaxMessage'][_0x620c('0xb9')](_0x25af5a);})[_0x620c('0x28')](function(_0x31efd3){_0xe46ea8['rows']=_0x31efd3;return _0xe46ea8;});}})[_0x620c('0x28')](respondWithFilteredResult(_0x47838c,_0x25af5a))[_0x620c('0xa7')](handleError(_0x47838c,null));};exports[_0x620c('0xba')]=function(_0x27a330,_0x8951a6,_0x2d126d){return db[_0x620c('0xac')][_0x620c('0xad')]({'where':{'id':_0x27a330[_0x620c('0xa9')]['id']}})[_0x620c('0x28')](handleEntityNotFound(_0x8951a6,null))[_0x620c('0x28')](function(_0x2256e3){if(_0x2256e3){return _0x2256e3[_0x620c('0xbb')](_0x27a330[_0x620c('0x69')][_0x620c('0xb2')],_[_0x620c('0xb3')](_0x27a330[_0x620c('0x69')],['ids','id'])||{})[_0x620c('0xbc')](function(){return db['Tag'][_0x620c('0xb9')]({'attributes':['id',_0x620c('0x2b'),_0x620c('0x43')],'where':{'id':_0x27a330[_0x620c('0x69')][_0x620c('0xb2')]}});})[_0x620c('0x28')](function(_0x107849){socket[_0x620c('0xbd')](_0x620c('0xbe'),{'id':Number(_0x27a330[_0x620c('0xa9')]['id']),'tags':_0x107849||[]});return{'id':Number(_0x27a330[_0x620c('0xa9')]['id']),'tags':_0x107849||[]};});}})['then'](respondWithResult(_0x8951a6,null))[_0x620c('0xa7')](handleError(_0x8951a6,null));};exports[_0x620c('0xbf')]=function(_0x14d43a,_0x31cca1,_0x502d12){return db['FaxInteraction'][_0x620c('0xad')]({'where':{'id':_0x14d43a[_0x620c('0xa9')]['id']}})[_0x620c('0x28')](handleEntityNotFound(_0x31cca1,null))[_0x620c('0x28')](function(_0x307728){if(_0x307728){return _0x307728['removeTags'](_0x14d43a['query']['ids']);}})['then'](respondWithStatusCode(_0x31cca1,null))['catch'](handleError(_0x31cca1,null));};exports[_0x620c('0xc0')]=function(_0x1a11f9,_0x4fdd35){var _0x4d7cb2=moment()[_0x620c('0xc1')]()[_0x620c('0x8c')]();var _0x36a0d0=path[_0x620c('0xc2')](config[_0x620c('0xc3')],'server',_0x620c('0xc4'),_0x620c('0xc5'));var _0x2a0b23=path['join'](config[_0x620c('0xc3')],_0x620c('0xc6'),'files',_0x620c('0xc7'));var _0x2084be=path['join'](_0x36a0d0,_0x4d7cb2);var _0x1f1aea=util[_0x620c('0xb6')](_0x620c('0xc8'),_0x1a11f9[_0x620c('0xa9')]['id'],_0x4d7cb2);var _0x15fd58=path[_0x620c('0xc2')](_0x36a0d0,_0x1f1aea);var _0x2495df=[];_0x2495df[_0x620c('0x31')]({'model':db[_0x620c('0xc9')],'as':'Attachment','raw':!![]});var _0x2e8242=[{'model':db[_0x620c('0xb1')],'as':'Messages','attributes':['id','body','createdAt'],'include':_0x2495df}];return db[_0x620c('0xac')][_0x620c('0xad')]({'where':{'id':_0x1a11f9[_0x620c('0xa9')]['id']},'include':_0x2e8242})[_0x620c('0x28')](handleEntityNotFound(_0x4fdd35,null))[_0x620c('0x28')](function(_0x530d31){if(_0x530d31&&_0x530d31[_0x620c('0xca')]){var _0x241f88=_0x530d31[_0x620c('0xcb')]({'plain':!![]});fs[_0x620c('0xcc')](_0x2084be);for(var _0x4cedcc=0x0;_0x4cedcc<_0x241f88[_0x620c('0xca')]['length'];_0x4cedcc++){var _0x48e317=_0x241f88['Messages'][_0x4cedcc]['Attachment'];if(_0x48e317){var _0x1b6432=path[_0x620c('0xc2')](_0x2a0b23,_0x48e317[_0x620c('0xcd')]);if(fs[_0x620c('0xce')](_0x1b6432)){fs[_0x620c('0xcf')](_0x1b6432)['pipe'](fs[_0x620c('0xd0')](path[_0x620c('0xc2')](_0x2084be,_0x48e317[_0x620c('0xcd')])));}}}return BPromise[_0x620c('0x84')]()[_0x620c('0x28')](function(){return new BPromise(function(_0x3f657d,_0x5597c2){zipdir(_0x2084be,{'saveTo':_0x15fd58},function(_0x3030ae,_0x14a838){if(_0x3030ae)return _0x5597c2(_0x3030ae);return _0x3f657d(_0x14a838);});})[_0x620c('0x28')](function(){return new BPromise(function(_0x55dba0,_0x590fa5){rimraf(_0x2084be,function(_0x230803){if(_0x230803)_0x590fa5(_0x230803);return _0x55dba0();});});})['then'](function(){return _0x4fdd35[_0x620c('0xc0')](_0x15fd58,_0x1f1aea,function(_0x12e74e){if(_0x12e74e){console[_0x620c('0xd1')]('err',_0x12e74e);}else{fs['unlinkSync'](_0x15fd58);}});});});}else{return _0x4fdd35[_0x620c('0x1b')](0xc8);}})[_0x620c('0xa7')](handleError(_0x4fdd35,null));}; \ No newline at end of file +var _0x9704=['fax_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','isEmpty','t.id\x20IN\x20?','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','count','toString','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','all','rows','show','FaxInteraction','includeAll','include','create','params','describe','addMessage','FaxMessage','ids','getMessages','findOne','hasOwnProperty','FaxInteractionId','format','options','findAll','addTags','setTags','omit','spread','Tag','faxInteractionTags:save','removeTags','download','unix','root','files','tmp','server','attachments','join','transcript-%d-%s.zip','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','createReadStream','createWriteStream','resolve','log','err','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','status','offset','undefined','Content-Range','json','reject','save','update','then','destroy','end','error','stack','name','send','Users','map','fullname','TagIds','split','forEach','Tags','push','catch','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','pick','select','field','color','from','u.id','ui.FaxInteractionId','left_join','users','u.id\x20=\x20ui.UserId'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x9704,0x8f));var _0x4970=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9704[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x4970('0x0'));var rimraf=require(_0x4970('0x1'));var zipdir=require(_0x4970('0x2'));var jsonpatch=require(_0x4970('0x3'));var rp=require(_0x4970('0x4'));var moment=require(_0x4970('0x5'));var BPromise=require(_0x4970('0x6'));var Mustache=require(_0x4970('0x7'));var util=require(_0x4970('0x8'));var path=require(_0x4970('0x9'));var sox=require('sox');var csv=require(_0x4970('0xa'));var ejs=require(_0x4970('0xb'));var fs=require('fs');var fs_extra=require(_0x4970('0xc'));var _=require(_0x4970('0xd'));var squel=require('squel');var crypto=require(_0x4970('0xe'));var jsforce=require(_0x4970('0xf'));var deskjs=require(_0x4970('0x10'));var toCsv=require('to-csv');var querystring=require(_0x4970('0x11'));var Papa=require(_0x4970('0x12'));var Redis=require(_0x4970('0x13'));var authService=require(_0x4970('0x14'));var qs=require(_0x4970('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4970('0x16'));var logger=require(_0x4970('0x17'))(_0x4970('0x18'));var utils=require(_0x4970('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x4970('0x1a')]=_[_0x4970('0x1b')](config[_0x4970('0x1a')],{'host':_0x4970('0x1c'),'port':0x18eb});var socket=require(_0x4970('0x1d'))(new Redis(config[_0x4970('0x1a')]));require(_0x4970('0x1e'))['register'](socket);function respondWithStatusCode(_0x22e268,_0x58005f){_0x58005f=_0x58005f||0xcc;return function(_0x2ef0fa){if(_0x2ef0fa){return _0x22e268[_0x4970('0x1f')](_0x58005f);}return _0x22e268['status'](_0x58005f)['end']();};}function respondWithResult(_0x4903a4,_0x11751c){_0x11751c=_0x11751c||0xc8;return function(_0x5ed61f){if(_0x5ed61f){return _0x4903a4[_0x4970('0x20')](_0x11751c)['json'](_0x5ed61f);}};}function respondWithFilteredResult(_0x31315f,_0x5e0649){return function(_0x3e10f6){if(_0x3e10f6){var _0x5b28a2=typeof _0x5e0649[_0x4970('0x21')]===_0x4970('0x22')&&typeof _0x5e0649['limit']===_0x4970('0x22');var _0x3b01d1=_0x3e10f6['count'];var _0x39bdfb=_0x5b28a2?0x0:_0x5e0649[_0x4970('0x21')];var _0xd17d07=_0x5b28a2?_0x3e10f6['count']:_0x5e0649[_0x4970('0x21')]+_0x5e0649['limit'];var _0x4837ee;if(_0xd17d07>=_0x3b01d1){_0xd17d07=_0x3b01d1;_0x4837ee=0xc8;}else{_0x4837ee=0xce;}_0x31315f[_0x4970('0x20')](_0x4837ee);return _0x31315f['set'](_0x4970('0x23'),_0x39bdfb+'-'+_0xd17d07+'/'+_0x3b01d1)[_0x4970('0x24')](_0x3e10f6);}return null;};}function patchUpdates(_0x415511){return function(_0x1b1e82){try{jsonpatch['apply'](_0x1b1e82,_0x415511,!![]);}catch(_0x3ab5fb){return BPromise[_0x4970('0x25')](_0x3ab5fb);}return _0x1b1e82[_0x4970('0x26')]();};}function saveUpdates(_0x322e34,_0x3ffc0c){return function(_0x58a07f){if(_0x58a07f){return _0x58a07f[_0x4970('0x27')](_0x322e34)[_0x4970('0x28')](function(_0x37e57){return _0x37e57;});}return null;};}function removeEntity(_0x38404b,_0x48b6f5){return function(_0x1e4134){if(_0x1e4134){return _0x1e4134[_0x4970('0x29')]()[_0x4970('0x28')](function(){_0x38404b[_0x4970('0x20')](0xcc)[_0x4970('0x2a')]();});}};}function handleEntityNotFound(_0xa99b5d,_0x199a17){return function(_0x7fb56b){if(!_0x7fb56b){_0xa99b5d[_0x4970('0x1f')](0x194);}return _0x7fb56b;};}function handleError(_0x3b240a,_0x3295e5){_0x3295e5=_0x3295e5||0x1f4;return function(_0x1887c8){logger[_0x4970('0x2b')](_0x1887c8[_0x4970('0x2c')]);if(_0x1887c8[_0x4970('0x2d')]){delete _0x1887c8['name'];}_0x3b240a[_0x4970('0x20')](_0x3295e5)[_0x4970('0x2e')](_0x1887c8);};}function getInteractionUsers(_0x1f79b4,_0xceaf1b){return new BPromise(function(_0x492a15,_0x1759e0){try{if(_0xceaf1b[_0x1f79b4['id']]){_0x1f79b4[_0x4970('0x2f')]=_[_0x4970('0x30')](_0xceaf1b[_0x1f79b4['id']],function(_0x18e9d9){return{'id':_0x18e9d9['id'],'fullname':_0x18e9d9[_0x4970('0x31')]};});}}catch(_0x4ff3a8){_0x1759e0(_0x4ff3a8);}_0x492a15(_0x1f79b4);});}function getInteractionTags(_0x4065c5,_0x1092f2){return new BPromise(function(_0x3c0644,_0x30d859){try{if(_0x4065c5[_0x4970('0x32')]){_0x4065c5['Tags']=[];_0x4065c5[_0x4970('0x32')][_0x4970('0x33')](',')[_0x4970('0x34')](function(_0x443c52){_0x4065c5[_0x4970('0x35')][_0x4970('0x36')](_0x1092f2[_0x443c52]);});}delete _0x4065c5[_0x4970('0x32')];}catch(_0x1bb026){_0x30d859(_0x1bb026);}_0x3c0644(_0x4065c5);});}function updateFaxInteraction(_0x5b40c7,_0x1997e3,_0x30bfa4){return new BPromise(function(_0x594d06,_0x362b23){return getInteractionUsers(_0x5b40c7,_0x30bfa4)[_0x4970('0x28')](function(_0x1837cf){return getInteractionTags(_0x1837cf,_0x1997e3);})[_0x4970('0x28')](function(_0x4bca89){_0x594d06(_0x4bca89);})[_0x4970('0x37')](function(_0x5a464b){_0x362b23(_0x5a464b);});});}exports[_0x4970('0x38')]=function(_0x539fc0,_0xeeace8){var _0xaef461={},_0x4434eb={},_0x27d693={'count':0x0,'rows':[]};var _0x5f17bc=_[_0x4970('0x30')](db['FaxInteraction'][_0x4970('0x39')],function(_0x44a41c){return{'name':_0x44a41c['fieldName'],'type':_0x44a41c['type']['key']};});_0x4434eb[_0x4970('0x3a')]=_[_0x4970('0x30')](_0x5f17bc,_0x4970('0x2d'));_0x4434eb['query']=_[_0x4970('0x3b')](_0x539fc0[_0x4970('0x3c')]);_0x4434eb[_0x4970('0x3d')]=_[_0x4970('0x3e')](_0x4434eb[_0x4970('0x3a')],_0x4434eb['query']);_0xaef461[_0x4970('0x3f')]=_[_0x4970('0x3e')](_0x4434eb[_0x4970('0x3a')],qs[_0x4970('0x40')](_0x539fc0[_0x4970('0x3c')]['fields']));_0xaef461[_0x4970('0x3f')]=_0xaef461[_0x4970('0x3f')][_0x4970('0x41')]?_0xaef461[_0x4970('0x3f')]:_0x4434eb[_0x4970('0x3a')];if(!_0x539fc0[_0x4970('0x3c')]['hasOwnProperty'](_0x4970('0x42'))){_0xaef461[_0x4970('0x43')]=qs[_0x4970('0x43')](_0x539fc0['query'][_0x4970('0x43')]);_0xaef461[_0x4970('0x21')]=qs[_0x4970('0x21')](_0x539fc0['query'][_0x4970('0x21')]);}_0xaef461['order']=qs['sort'](_0x539fc0['query'][_0x4970('0x44')]);_0xaef461[_0x4970('0x45')]=qs[_0x4970('0x3d')](_[_0x4970('0x46')](_0x539fc0['query'],_0x4434eb[_0x4970('0x3d')]),_0x5f17bc);var _0x50de08=[];var _0x14f4c8=squel[_0x4970('0x47')]()[_0x4970('0x48')]('id')['field'](_0x4970('0x2d'))[_0x4970('0x48')](_0x4970('0x49'))[_0x4970('0x4a')]('tools_tags');var _0x3afb25=squel[_0x4970('0x47')]()[_0x4970('0x48')](_0x4970('0x4b'))[_0x4970('0x48')]('u.fullname')[_0x4970('0x48')](_0x4970('0x4c'))['from']('user_has_fax_interactions','ui')[_0x4970('0x4d')](_0x4970('0x4e'),'u',_0x4970('0x4f'));var _0x1e45ff=squel[_0x4970('0x47')]()[_0x4970('0x4a')](_0x4970('0x50'),'i')['left_join']('cm_contacts','c',_0x4970('0x51'))['left_join'](_0x4970('0x4e'),'o','o.id\x20=\x20i.UserId')[_0x4970('0x4d')]('fax_accounts','a',_0x4970('0x52'))[_0x4970('0x4d')](_0x4970('0x53'),'me',_0x4970('0x54'))[_0x4970('0x4d')](_0x4970('0x55'),'it',_0x4970('0x56'))['left_join'](_0x4970('0x57'),'t',_0x4970('0x58'));var _0x10623a=squel[_0x4970('0x59')]();var _0x18ee42=[];var _0x164b1a=squel[_0x4970('0x59')]();var _0x14abf9;if(_0x539fc0[_0x4970('0x3c')][_0x4970('0x5a')]){_0x14abf9=as['parseSearch'](_0x539fc0[_0x4970('0x3c')][_0x4970('0x5a')]);var _0x435225=_0x14abf9[_0x4970('0x5b')];for(var _0x4ac1e0=0x0;_0x4ac1e0<_0x14abf9[_0x4970('0x5c')][_0x4970('0x41')];_0x4ac1e0++){var _0x4566e3=_0x14abf9[_0x4970('0x5c')][_0x4ac1e0];var _0x350123='i';var _0x230d55=_[_0x4970('0x5d')](_0x5f17bc,[_0x4970('0x2d'),_0x4566e3[_0x4970('0x48')]]);if(!_0x230d55){switch(_0x4566e3[_0x4970('0x48')]){case _0x4970('0x5e'):if(_0x4566e3[_0x4970('0x5f')]==0x1){_0x1e45ff[_0x4970('0x60')]('`'+_0x4566e3[_0x4970('0x48')]+_0x4970('0x61'));}else{_0x1e45ff[_0x4970('0x60')]('`'+_0x4566e3[_0x4970('0x48')]+_0x4970('0x62'));}break;case _0x4970('0x63'):if(_0x4566e3[_0x4970('0x64')]===_0x4970('0x65')){if(_0x4566e3[_0x4970('0x5f')][_0x4970('0x33')]('\x20')[_0x4970('0x41')]>0x1){_0x10623a[_0x435225]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4970('0x66')](_0x4566e3[_0x4970('0x5f')]),null);}else{var _0x56ffc4='%'+_0x4566e3[_0x4970('0x5f')]+'%';_0x10623a[_0x435225](_0x4970('0x67'),_0x56ffc4,_0x56ffc4,_0x56ffc4);}}else{_0x230d55=_[_0x4970('0x5d')](_0x5f17bc,[_0x4970('0x2d'),_0x4970('0x68')]);_0x4566e3['field']=_0x4970('0x68');_0x55cc38=as[_0x4970('0x69')](_0x350123,_0x230d55[_0x4970('0x6a')],_0x4566e3);_0x10623a[_0x435225](_0x55cc38[_0x4970('0x6b')],_0x55cc38['value'][_0x4970('0x6c')],_0x55cc38[_0x4970('0x5f')]['end']);}break;case'Tag':var _0x101985=_0x4566e3[_0x4970('0x5f')][_0x4970('0x33')](',')[_0x4970('0x30')](function(_0x8f69c1){return Number(_0x8f69c1);});_0x101985[_0x4970('0x34')](function(_0x1dd6e1){_0x164b1a['or'](_0x4970('0x6d'),'%,'+_0x1dd6e1+',%');});_0x18ee42=_['union'](_0x18ee42,_0x101985);break;case _0x4970('0x6e'):if(_0x4566e3[_0x4970('0x64')]==='$substring'){_0x10623a[_0x435225](_0x4970('0x6f'),'%'+_0x4566e3[_0x4970('0x5f')]+'%',null);}else{_0x230d55=_[_0x4970('0x5d')](_0x5f17bc,[_0x4970('0x2d'),_0x4970('0x70')]);_0x4566e3[_0x4970('0x48')]='UserId';_0x55cc38=as['buildExpression'](_0x350123,_0x230d55['type'],_0x4566e3);_0x10623a[_0x435225](_0x55cc38[_0x4970('0x6b')],_0x55cc38[_0x4970('0x5f')][_0x4970('0x6c')],_0x55cc38[_0x4970('0x5f')]['end']);}break;case _0x4970('0x71'):_0x55cc38=as[_0x4970('0x69')]('me',null,_0x4566e3);_0x10623a[_0x435225](_0x55cc38[_0x4970('0x6b')],_0x55cc38[_0x4970('0x5f')][_0x4970('0x6c')],_0x55cc38[_0x4970('0x5f')][_0x4970('0x2a')]);break;}}else{var _0x55cc38=as[_0x4970('0x69')](_0x350123,_0x230d55[_0x4970('0x6a')],_0x4566e3);_0x10623a[_0x435225](_0x55cc38[_0x4970('0x6b')],_0x55cc38[_0x4970('0x5f')][_0x4970('0x6c')],_0x55cc38['value']['end']);}}}else{var _0x53fdf1=_(_0x539fc0[_0x4970('0x3c')])[_0x4970('0x3b')]()[_0x4970('0x30')](function(_0x26a125){return _[_0x4970('0x72')](_0x5f17bc,[_0x4970('0x2d'),_0x26a125])?_0x26a125:undefined;})[_0x4970('0x73')]()[_0x4970('0x5f')]();if(!_['isEmpty'](_0x53fdf1)){_0x53fdf1[_0x4970('0x34')](function(_0x33d132){if(_0x33d132===_0x4970('0x74')){_0x1e45ff[_0x4970('0x45')](_0x4970('0x75'),[][_0x4970('0x76')](_0x539fc0[_0x4970('0x3c')][_0x33d132]));}else if(_0x33d132==='createdAt'){var _0x456b4b=JSON[_0x4970('0x77')](_0x539fc0[_0x4970('0x3c')][_0x33d132])[_0x4970('0x78')];var _0x5a7cdf=JSON[_0x4970('0x77')](_0x539fc0['query'][_0x33d132])[_0x4970('0x79')];_0x1e45ff[_0x4970('0x45')](_0x4970('0x7a'),_0x456b4b,_0x5a7cdf);}else{if(_0x539fc0[_0x4970('0x3c')][_0x33d132]===_0x4970('0x7b')){_0x1e45ff[_0x4970('0x45')]('i.'+_0x33d132+'\x20IS\x20NULL');}else{_0x1e45ff[_0x4970('0x45')]('i.'+_0x33d132+_0x4970('0x7c'),_0x539fc0[_0x4970('0x3c')][_0x33d132]);}}});}if(_0x539fc0[_0x4970('0x3c')][_0x4970('0x7d')]){if(_0x539fc0[_0x4970('0x3c')][_0x4970('0x7d')]==0x1){_0x1e45ff[_0x4970('0x60')](_0x4970('0x7e'));}else{_0x1e45ff[_0x4970('0x60')](_0x4970('0x7f'));}}if(_0x539fc0[_0x4970('0x3c')][_0x4970('0x80')]){_0x18ee42=_[_0x4970('0x81')](_0x539fc0[_0x4970('0x3c')][_0x4970('0x80')])?_0x539fc0[_0x4970('0x3c')][_0x4970('0x80')]:new Array(_0x539fc0[_0x4970('0x3c')][_0x4970('0x80')]);_0x18ee42[_0x4970('0x34')](function(_0x43a9ac){_0x164b1a['or'](_0x4970('0x6d'),'%,'+_0x43a9ac+',%');});}if(_0x539fc0[_0x4970('0x3c')][_0x4970('0x82')]){var _0x3e43a2=_0x539fc0[_0x4970('0x3c')][_0x4970('0x82')][_0x4970('0x83')]('\x5c','\x5c\x5c')[_0x4970('0x83')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x3e43a2)){_0x10623a['or'](_0x4970('0x84'),_0x3e43a2+'%')['or'](_0x4970('0x85'),_0x3e43a2+'%');}_0x10623a['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3e43a2+'%');}}_0x1e45ff['where'](_0x10623a);_0x1e45ff[_0x4970('0x86')](_0x4970('0x87'));var _0x3d3384={'type':db[_0x4970('0x88')][_0x4970('0x89')][_0x4970('0x8a')],'raw':!![]};var _0xda06d0=_0x1e45ff['clone']();_0xda06d0[_0x4970('0x48')](_0x4970('0x87'));_0xda06d0[_0x4970('0x48')](_0x4970('0x8b'),'unreadMessages');if(_0xaef461[_0x4970('0x8c')]){_0xaef461[_0x4970('0x8c')]['forEach'](function(_0x4ef249){var _0x184dd8=_0x4ef249[0x0]===_0x4970('0x8d')?_0x4ef249[0x0]:'i.'+_0x4ef249[0x0];_0x1e45ff[_0x4970('0x8c')](_0x184dd8,_0x4ef249[0x1]===_0x4970('0x8e')?![]:!![]);});}if(!_[_0x4970('0x8f')](_0x18ee42)){_0x1e45ff[_0x4970('0x60')](_0x164b1a);_0xda06d0[_0x4970('0x45')](_0x4970('0x90'),_0x18ee42);}BPromise['resolve']()[_0x4970('0x28')](function(){if(!_0x14abf9){if(_0x539fc0[_0x4970('0x3c')][_0x4970('0x74')])return;_0xda06d0[_0x4970('0x45')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x1e45ff['where'](_0x4970('0x91'));return;}if(_0x539fc0[_0x4970('0x92')][_0x4970('0x93')]!==_0x4970('0x94'))return;return _0x539fc0[_0x4970('0x92')][_0x4970('0x95')]({'attributes':['id'],'raw':!![]})['then'](function(_0x476ac6){if(_['isEmpty'](_0x476ac6)){_0xda06d0['where'](_0x4970('0x96'));_0x1e45ff[_0x4970('0x45')](_0x4970('0x96'));}else{_0xda06d0[_0x4970('0x45')](_0x4970('0x75'),_[_0x4970('0x30')](_0x476ac6,'id'));_0x1e45ff[_0x4970('0x45')](_0x4970('0x75'),_[_0x4970('0x30')](_0x476ac6,'id'));}});})['then'](function(){if(_0x539fc0[_0x4970('0x92')][_0x4970('0x93')]===_0x4970('0x94')&&!_0x14abf9&&!_0x539fc0['query'][_0x4970('0x74')])return[];return db[_0x4970('0x97')][_0x4970('0x3c')](_0xda06d0['toString'](),_0x3d3384);})[_0x4970('0x28')](function(_0x57a526){_0x27d693[_0x4970('0x98')]=_0x57a526['length'];if(_0x27d693[_0x4970('0x98')]===0x0)return[];return db[_0x4970('0x97')][_0x4970('0x3c')](_0x14f4c8[_0x4970('0x99')](),_0x3d3384)[_0x4970('0x28')](function(_0x595919){_0x50de08=_[_0x4970('0x9a')](_0x595919,'id');_0x3d3384=_[_0x4970('0x9b')](_0x3d3384,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x539fc0['query']['fields']){_0xaef461['attributes'][_0x4970('0x34')](function(_0x3d8069){_0x1e45ff['field']('i.'+_0x3d8069);});}else{_0x1e45ff[_0x4970('0x48')](_0x4970('0x8b'),_0x4970('0x5e'));_0x1e45ff[_0x4970('0x48')]('a.key',_0x4970('0x9c'));_0x1e45ff['field'](_0x4970('0x9d'),_0x4970('0x9e'));_0x1e45ff['field'](_0x4970('0x9f'),'contactName');_0x1e45ff[_0x4970('0x48')](_0x4970('0xa0'));_0x1e45ff[_0x4970('0x48')](_0x4970('0xa1'),_0x4970('0xa2'));_0x1e45ff[_0x4970('0x48')]('c.lastName',_0x4970('0xa3'));_0x1e45ff[_0x4970('0x48')](_0x4970('0xa4'),'Contact.email');_0x1e45ff[_0x4970('0x48')]('c.phone',_0x4970('0xa5'));_0x1e45ff['field'](_0x4970('0xa6'),_0x4970('0xa7'));_0x1e45ff['field'](_0x4970('0xa8'),_0x4970('0xa9'));_0x1e45ff['field'](_0x4970('0xaa'),'Owner.fullname');_0x1e45ff[_0x4970('0x48')](_0x4970('0xab'),_0x4970('0xac'));_0x1e45ff['field'](_0x4970('0xad'),'TagIds');}if(_0xaef461[_0x4970('0x43')])_0x1e45ff[_0x4970('0x43')](_0xaef461[_0x4970('0x43')]);if(_0xaef461[_0x4970('0x21')])_0x1e45ff[_0x4970('0x21')](_0xaef461[_0x4970('0x21')]);return db[_0x4970('0x97')][_0x4970('0x3c')](_0x1e45ff['toString'](),_0x3d3384);})[_0x4970('0x28')](function(_0x514ef9){if(_0x514ef9[_0x4970('0x41')]>0x0)_0x3afb25[_0x4970('0x45')](_0x4970('0xae'),_['map'](_0x514ef9,'id'));return db['sequelize'][_0x4970('0x3c')](_0x3afb25[_0x4970('0x99')](),_0x3d3384)[_0x4970('0x28')](function(_0x558262){var _0x440528=_[_0x4970('0xaf')](_0x558262,'FaxInteractionId');var _0x17badd=[];_0x514ef9['forEach'](function(_0x161c39){_0x17badd[_0x4970('0x36')](updateFaxInteraction(_0x161c39,_0x50de08,_0x440528));});return BPromise[_0x4970('0xb0')](_0x17badd);});});})[_0x4970('0x28')](function(_0x4b2f7f){_0x27d693[_0x4970('0xb1')]=_0x4b2f7f;return _0x27d693;})[_0x4970('0x28')](respondWithFilteredResult(_0xeeace8,_0xaef461))['catch'](handleError(_0xeeace8,null));};exports[_0x4970('0xb2')]=function(_0x2afebe,_0x6f7789){var _0x46513e={'raw':![],'where':{'id':_0x2afebe['params']['id']}},_0x5b033b={};_0x5b033b[_0x4970('0x3a')]=_[_0x4970('0x3b')](db[_0x4970('0xb3')][_0x4970('0x39')]);_0x5b033b['query']=_['keys'](_0x2afebe[_0x4970('0x3c')]);_0x5b033b['filters']=_[_0x4970('0x3e')](_0x5b033b[_0x4970('0x3a')],_0x5b033b[_0x4970('0x3c')]);_0x46513e[_0x4970('0x3f')]=_[_0x4970('0x3e')](_0x5b033b[_0x4970('0x3a')],qs[_0x4970('0x40')](_0x2afebe[_0x4970('0x3c')][_0x4970('0x40')]));_0x46513e[_0x4970('0x3f')]=_0x46513e[_0x4970('0x3f')][_0x4970('0x41')]?_0x46513e[_0x4970('0x3f')]:_0x5b033b[_0x4970('0x3a')];if(_0x2afebe[_0x4970('0x3c')][_0x4970('0xb4')]){_0x46513e[_0x4970('0xb5')]=[{'all':!![]}];}_0x46513e=_[_0x4970('0x9b')]({},_0x46513e,_0x2afebe['options']);return db[_0x4970('0xb3')][_0x4970('0x5d')](_0x46513e)[_0x4970('0x28')](handleEntityNotFound(_0x6f7789,null))[_0x4970('0x28')](respondWithResult(_0x6f7789,null))[_0x4970('0x37')](handleError(_0x6f7789,null));};exports[_0x4970('0xb6')]=function(_0x40e232,_0x693b44){return db[_0x4970('0xb3')][_0x4970('0xb6')](_0x40e232[_0x4970('0x71')],{})[_0x4970('0x28')](respondWithResult(_0x693b44,0xc9))['catch'](handleError(_0x693b44,null));};exports['update']=function(_0x1eb079,_0xfd181){if(_0x1eb079['body']['id']){delete _0x1eb079[_0x4970('0x71')]['id'];}return db['FaxInteraction'][_0x4970('0x5d')]({'where':{'id':_0x1eb079[_0x4970('0xb7')]['id']}})[_0x4970('0x28')](handleEntityNotFound(_0xfd181,null))[_0x4970('0x28')](saveUpdates(_0x1eb079[_0x4970('0x71')],null))[_0x4970('0x28')](respondWithResult(_0xfd181,null))[_0x4970('0x37')](handleError(_0xfd181,null));};exports[_0x4970('0x29')]=function(_0x978307,_0x3d7cf4){return db[_0x4970('0xb3')][_0x4970('0x5d')]({'where':{'id':_0x978307[_0x4970('0xb7')]['id']}})['then'](handleEntityNotFound(_0x3d7cf4,null))['then'](removeEntity(_0x3d7cf4,null))[_0x4970('0x37')](handleError(_0x3d7cf4,null));};exports[_0x4970('0xb8')]=function(_0x18217d,_0x3d6f94){return db[_0x4970('0xb3')][_0x4970('0xb8')]()[_0x4970('0x28')](respondWithResult(_0x3d6f94,null))[_0x4970('0x37')](handleError(_0x3d6f94,null));};exports[_0x4970('0xb9')]=function(_0x55e81d,_0x3c7a2d,_0x26b157){return db[_0x4970('0xba')]['find']({'where':{'id':_0x55e81d[_0x4970('0xb7')]['id']}})['then'](handleEntityNotFound(_0x3c7a2d,null))[_0x4970('0x28')](function(_0x123a52){if(_0x123a52){return _0x123a52[_0x4970('0xb9')](_0x55e81d[_0x4970('0x71')][_0x4970('0xbb')],_['omit'](_0x55e81d[_0x4970('0x71')],[_0x4970('0xbb'),'id'])||{});}})[_0x4970('0x28')](respondWithResult(_0x3c7a2d,null))[_0x4970('0x37')](handleError(_0x3c7a2d,null));};exports[_0x4970('0xbc')]=function(_0x3b14c5,_0xb426f,_0x50c484){var _0x4770f9={'raw':![],'where':{}};var _0x1368d9={};var _0x28230a={'count':0x0,'rows':[]};return db[_0x4970('0xb3')][_0x4970('0xbd')]({'where':{'id':_0x3b14c5[_0x4970('0xb7')]['id']}})[_0x4970('0x28')](handleEntityNotFound(_0xb426f,null))[_0x4970('0x28')](function(_0x34d33c){if(_0x34d33c){_0x1368d9['model']=_[_0x4970('0x3b')](db[_0x4970('0xba')][_0x4970('0x39')]);_0x1368d9[_0x4970('0x3c')]=_['keys'](_0x3b14c5[_0x4970('0x3c')]);_0x1368d9[_0x4970('0x3d')]=_[_0x4970('0x3e')](_0x1368d9['model'],_0x1368d9[_0x4970('0x3c')]);_0x4770f9['attributes']=_[_0x4970('0x3e')](_0x1368d9[_0x4970('0x3a')],qs[_0x4970('0x40')](_0x3b14c5[_0x4970('0x3c')][_0x4970('0x40')]));_0x4770f9[_0x4970('0x3f')]=_0x4770f9[_0x4970('0x3f')][_0x4970('0x41')]?_0x4770f9['attributes']:_0x1368d9[_0x4970('0x3a')];if(!_0x3b14c5[_0x4970('0x3c')][_0x4970('0xbe')](_0x4970('0x42'))){_0x4770f9[_0x4970('0x43')]=qs['limit'](_0x3b14c5['query']['limit']);_0x4770f9[_0x4970('0x21')]=qs[_0x4970('0x21')](_0x3b14c5[_0x4970('0x3c')][_0x4970('0x21')]);}_0x4770f9[_0x4970('0x8c')]=qs['sort'](_0x3b14c5['query'][_0x4970('0x44')]);_0x4770f9[_0x4970('0x45')]=qs[_0x4970('0x3d')](_[_0x4970('0x46')](_0x3b14c5[_0x4970('0x3c')],_0x1368d9['filters']));_0x4770f9[_0x4970('0x45')][_0x4970('0xbf')]=_0x34d33c['id'];if(_0x3b14c5[_0x4970('0x3c')]['filter']){_0x4770f9['where']=_[_0x4970('0x9b')](_0x4770f9[_0x4970('0x45')],{'$or':_['map'](_0x4770f9[_0x4970('0x3f')],function(_0x2729d6){var _0xe56d68={};_0xe56d68[_0x2729d6]={'$like':'%'+_0x3b14c5[_0x4970('0x3c')][_0x4970('0x82')]+'%'};return _0xe56d68;})});}if(_0x3b14c5[_0x4970('0x3c')]['$gte']){var _0x3c334b=_0x3b14c5['query'][_0x4970('0x78')][_0x4970('0x33')](',');var _0x4f9d96={};_0x4f9d96[_0x3c334b[0x0]]={'$gte':moment(_0x3c334b[0x1])[_0x4970('0xc0')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4770f9[_0x4970('0x45')]=_[_0x4970('0x9b')](_0x4770f9[_0x4970('0x45')],_0x4f9d96);}_0x4770f9=_[_0x4970('0x9b')]({},_0x4770f9,_0x3b14c5[_0x4970('0xc1')]);return db[_0x4970('0xba')][_0x4970('0x98')]({'where':_0x4770f9[_0x4970('0x45')]})[_0x4970('0x28')](function(_0x28c560){_0x28230a[_0x4970('0x98')]=_0x28c560;if(_0x3b14c5[_0x4970('0x3c')][_0x4970('0xb4')]){_0x4770f9['include']=[{'all':!![]}];}return db[_0x4970('0xba')][_0x4970('0xc2')](_0x4770f9);})['then'](function(_0x456bdd){_0x28230a[_0x4970('0xb1')]=_0x456bdd;return _0x28230a;});}})[_0x4970('0x28')](respondWithFilteredResult(_0xb426f,_0x4770f9))[_0x4970('0x37')](handleError(_0xb426f,null));};exports[_0x4970('0xc3')]=function(_0x2c5c6c,_0x420428,_0x1c6960){return db['FaxInteraction']['find']({'where':{'id':_0x2c5c6c['params']['id']}})[_0x4970('0x28')](handleEntityNotFound(_0x420428,null))['then'](function(_0x213fcc){if(_0x213fcc){return _0x213fcc[_0x4970('0xc4')](_0x2c5c6c[_0x4970('0x71')][_0x4970('0xbb')],_[_0x4970('0xc5')](_0x2c5c6c[_0x4970('0x71')],[_0x4970('0xbb'),'id'])||{})[_0x4970('0xc6')](function(){return db[_0x4970('0xc7')][_0x4970('0xc2')]({'attributes':['id','name',_0x4970('0x49')],'where':{'id':_0x2c5c6c['body'][_0x4970('0xbb')]}});})[_0x4970('0x28')](function(_0x1cd33a){socket['emit'](_0x4970('0xc8'),{'id':Number(_0x2c5c6c[_0x4970('0xb7')]['id']),'tags':_0x1cd33a||[]});return{'id':Number(_0x2c5c6c[_0x4970('0xb7')]['id']),'tags':_0x1cd33a||[]};});}})[_0x4970('0x28')](respondWithResult(_0x420428,null))[_0x4970('0x37')](handleError(_0x420428,null));};exports[_0x4970('0xc9')]=function(_0x455f4c,_0x786e7b,_0x27b603){return db[_0x4970('0xb3')][_0x4970('0x5d')]({'where':{'id':_0x455f4c['params']['id']}})[_0x4970('0x28')](handleEntityNotFound(_0x786e7b,null))[_0x4970('0x28')](function(_0x3927dc){if(_0x3927dc){return _0x3927dc[_0x4970('0xc9')](_0x455f4c['query'][_0x4970('0xbb')]);}})[_0x4970('0x28')](respondWithStatusCode(_0x786e7b,null))[_0x4970('0x37')](handleError(_0x786e7b,null));};exports[_0x4970('0xca')]=function(_0x302025,_0x432a17){var _0x94e9e0=moment()[_0x4970('0xcb')]()[_0x4970('0x99')]();var _0x1a3d87=path['join'](config[_0x4970('0xcc')],'server',_0x4970('0xcd'),_0x4970('0xce'));var _0x2a9a31=path['join'](config[_0x4970('0xcc')],_0x4970('0xcf'),_0x4970('0xcd'),_0x4970('0xd0'));var _0x562413=path[_0x4970('0xd1')](_0x1a3d87,_0x94e9e0);var _0x35d66b=util[_0x4970('0xc0')](_0x4970('0xd2'),_0x302025['params']['id'],_0x94e9e0);var _0x54a13d=path[_0x4970('0xd1')](_0x1a3d87,_0x35d66b);var _0x1db68b=[];_0x1db68b[_0x4970('0x36')]({'model':db[_0x4970('0xd3')],'as':_0x4970('0xd3'),'raw':!![]});var _0x359557=[{'model':db[_0x4970('0xba')],'as':_0x4970('0xd4'),'attributes':['id',_0x4970('0x71'),_0x4970('0xd5')],'include':_0x1db68b}];return db[_0x4970('0xb3')]['find']({'where':{'id':_0x302025[_0x4970('0xb7')]['id']},'include':_0x359557})['then'](handleEntityNotFound(_0x432a17,null))[_0x4970('0x28')](function(_0x5ae4e4){if(_0x5ae4e4&&_0x5ae4e4['Messages']){var _0x463315=_0x5ae4e4[_0x4970('0xd6')]({'plain':!![]});fs[_0x4970('0xd7')](_0x562413);for(var _0x4ae12c=0x0;_0x4ae12c<_0x463315['Messages'][_0x4970('0x41')];_0x4ae12c++){var _0x47369b=_0x463315[_0x4970('0xd4')][_0x4ae12c][_0x4970('0xd3')];if(_0x47369b){var _0x24ed42=path['join'](_0x2a9a31,_0x47369b[_0x4970('0xd8')]);if(fs[_0x4970('0xd9')](_0x24ed42)){fs[_0x4970('0xda')](_0x24ed42)['pipe'](fs[_0x4970('0xdb')](path[_0x4970('0xd1')](_0x562413,_0x47369b[_0x4970('0xd8')])));}}}return BPromise[_0x4970('0xdc')]()[_0x4970('0x28')](function(){return new BPromise(function(_0xab72ad,_0x14c156){zipdir(_0x562413,{'saveTo':_0x54a13d},function(_0x33d99b,_0x21ec0b){if(_0x33d99b)return _0x14c156(_0x33d99b);return _0xab72ad(_0x21ec0b);});})[_0x4970('0x28')](function(){return new BPromise(function(_0x475d6b,_0x3a690d){rimraf(_0x562413,function(_0x23b645){if(_0x23b645)_0x3a690d(_0x23b645);return _0x475d6b();});});})['then'](function(){return _0x432a17[_0x4970('0xca')](_0x54a13d,_0x35d66b,function(_0x593716){if(_0x593716){console[_0x4970('0xdd')](_0x4970('0xde'),_0x593716);}else{fs['unlinkSync'](_0x54a13d);}});});});}else{return _0x432a17['sendStatus'](0xc8);}})[_0x4970('0x37')](handleError(_0x432a17,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index abe5102..ff917bc 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 _0x63fa=['update','remove','then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','events','../../mysqldb','FaxInteraction','setMaxListeners','save'];(function(_0x43c279,_0x38a78d){var _0x1a480c=function(_0x190017){while(--_0x190017){_0x43c279['push'](_0x43c279['shift']());}};_0x1a480c(++_0x38a78d);}(_0x63fa,0x17b));var _0xa63f=function(_0x34647e,_0x2d7553){_0x34647e=_0x34647e-0x0;var _0x5747ca=_0x63fa[_0x34647e];return _0x5747ca;};'use strict';var EventEmitter=require(_0xa63f('0x0'));var FaxInteraction=require(_0xa63f('0x1'))['db'][_0xa63f('0x2')];var FaxMessage=require(_0xa63f('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xa63f('0x3')](0x0);var events={'afterCreate':_0xa63f('0x4'),'afterUpdate':_0xa63f('0x5'),'afterDestroy':_0xa63f('0x6')};function emitEvent(_0x4ff275){return function(_0x1576da,_0x17c92d,_0x51a751){_0x1576da['getUsers']({'attributes':['id'],'raw':!![]})[_0xa63f('0x7')](function(_0x2d3b02){_0x1576da[_0xa63f('0x8')](_0xa63f('0x9'),_0x2d3b02[_0xa63f('0xa')](function(_0x8948bf){return{'id':_0x8948bf['id']};}));return FaxMessage[_0xa63f('0xb')]({'where':{'FaxInteractionId':_0x1576da['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa63f('0x7')](function(_0x16d5dd){_0x1576da[_0xa63f('0x8')]('unreadMessages',_0x16d5dd[_0xa63f('0xc')]);FaxInteractionEvents[_0xa63f('0xd')](_0x4ff275+':'+_0x1576da['id'],_0x1576da);FaxInteractionEvents['emit'](_0x4ff275,_0x1576da);_0x51a751(null);})[_0xa63f('0xe')](_0x51a751(null));};}for(var e in events){if(events[_0xa63f('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0x4f28=['findAll','unreadMessages','emit','catch','hook','exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x4f28,0x138));var _0x84f2=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x4f28[_0x3ab9ee];return _0x82ee88;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x84f2('0x0'))['db'][_0x84f2('0x1')];var FaxMessage=require(_0x84f2('0x0'))['db'][_0x84f2('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x84f2('0x3')](0x0);var events={'afterCreate':_0x84f2('0x4'),'afterUpdate':'update','afterDestroy':_0x84f2('0x5')};function emitEvent(_0x37c2a9){return function(_0x4c4353,_0x474c90,_0x6ce909){_0x4c4353[_0x84f2('0x6')]({'attributes':['id'],'raw':!![]})[_0x84f2('0x7')](function(_0x5a118b){_0x4c4353[_0x84f2('0x8')](_0x84f2('0x9'),_0x5a118b[_0x84f2('0xa')](function(_0x2eb813){return{'id':_0x2eb813['id']};}));return FaxMessage[_0x84f2('0xb')]({'where':{'FaxInteractionId':_0x4c4353['id'],'direction':'in','read':![]},'raw':!![]});})[_0x84f2('0x7')](function(_0x435665){_0x4c4353['setDataValue'](_0x84f2('0xc'),_0x435665['length']);FaxInteractionEvents[_0x84f2('0xd')](_0x37c2a9+':'+_0x4c4353['id'],_0x4c4353);FaxInteractionEvents[_0x84f2('0xd')](_0x37c2a9,_0x4c4353);_0x6ce909(null);})[_0x84f2('0xe')](_0x6ce909(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x84f2('0xf')](e,emitEvent(event));}}module[_0x84f2('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 9d327ad..0e0ceba 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 _0x6ee2=['fax_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction'];(function(_0x38c767,_0x3a5e35){var _0x5ad145=function(_0x5a5a58){while(--_0x5a5a58){_0x38c767['push'](_0x38c767['shift']());}};_0x5ad145(++_0x3a5e35);}(_0x6ee2,0x155));var _0x26ee=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x6ee2[_0x68ee8b];return _0x5148f7;};'use strict';var _=require(_0x26ee('0x0'));var util=require(_0x26ee('0x1'));var logger=require(_0x26ee('0x2'))('api');var moment=require(_0x26ee('0x3'));var BPromise=require(_0x26ee('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x26ee('0x5'));var config=require(_0x26ee('0x6'));var attributes=require(_0x26ee('0x7'));module[_0x26ee('0x8')]=function(_0x10466e,_0x3d2e3b){return _0x10466e[_0x26ee('0x9')](_0x26ee('0xa'),attributes,{'tableName':_0x26ee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4e87f8,_0x414d2c,_0x535544){if(_0x4e87f8['changed'](_0x26ee('0xc'))){_0x4e87f8[_0x26ee('0xd')]=moment()[_0x26ee('0xe')](_0x26ee('0xf'));}_0x535544(null,_0x4e87f8);}}});}; \ No newline at end of file +var _0xed65=['define','FaxInteraction','fax_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','path','./faxInteraction.attributes'];(function(_0x2971ec,_0xb83fa3){var _0x599007=function(_0x5c3a95){while(--_0x5c3a95){_0x2971ec['push'](_0x2971ec['shift']());}};_0x599007(++_0xb83fa3);}(_0xed65,0xa1));var _0x5ed6=function(_0x24e2a3,_0x534875){_0x24e2a3=_0x24e2a3-0x0;var _0x3e82f4=_0xed65[_0x24e2a3];return _0x3e82f4;};'use strict';var _=require(_0x5ed6('0x0'));var util=require(_0x5ed6('0x1'));var logger=require(_0x5ed6('0x2'))(_0x5ed6('0x3'));var moment=require('moment');var BPromise=require(_0x5ed6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ed6('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5ed6('0x6'));module['exports']=function(_0xc6b584,_0x28ca18){return _0xc6b584[_0x5ed6('0x7')](_0x5ed6('0x8'),attributes,{'tableName':_0x5ed6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3eed1f,_0x2e38fd,_0x1f04bb){if(_0x3eed1f['changed'](_0x5ed6('0xa'))){_0x3eed1f[_0x5ed6('0xb')]=moment()[_0x5ed6('0xc')](_0x5ed6('0xd'));}_0x1f04bb(null,_0x3eed1f);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index aebec2e..6df7349 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 _0x343e=['spread','AddTags','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','AddTagsToFaxInteraction','find','addTags','ids','omit'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x343e,0x1ba));var _0xe343=function(_0x3c786d,_0xe68ade){_0x3c786d=_0x3c786d-0x0;var _0x59ab1e=_0x343e[_0x3c786d];return _0x59ab1e;};'use strict';var _=require(_0xe343('0x0'));var util=require(_0xe343('0x1'));var moment=require(_0xe343('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe343('0x3'));var db=require(_0xe343('0x4'))['db'];var utils=require(_0xe343('0x5'));var logger=require('../../config/logger')(_0xe343('0x6'));var config=require('../../config/environment');var jayson=require(_0xe343('0x7'));var client=jayson[_0xe343('0x8')][_0xe343('0x9')]({'port':0x232a});config[_0xe343('0xa')]=_[_0xe343('0xb')](config['redis'],{'host':_0xe343('0xc'),'port':0x18eb});var socket=require(_0xe343('0xd'))(new Redis(config['redis']));require('./faxInteraction.socket')[_0xe343('0xe')](socket);function respondWithRpcPromise(_0x4af874,_0x2692de,_0x3f0192){return new BPromise(function(_0x291d0a,_0x441cd2){return client[_0xe343('0xf')](_0x4af874,_0x3f0192)[_0xe343('0x10')](function(_0x384aef){logger[_0xe343('0x11')](_0xe343('0x12'),_0x2692de,_0xe343('0x13'));logger[_0xe343('0x14')](_0xe343('0x15'),_0x2692de,'request\x20sent',JSON[_0xe343('0x16')](_0x384aef));if(_0x384aef['error']){if(_0x384aef[_0xe343('0x17')][_0xe343('0x18')]===0x1f4){logger[_0xe343('0x17')](_0xe343('0x12'),_0x2692de,_0x384aef[_0xe343('0x17')][_0xe343('0x19')]);return _0x441cd2(_0x384aef['error'][_0xe343('0x19')]);}logger[_0xe343('0x17')](_0xe343('0x12'),_0x2692de,_0x384aef[_0xe343('0x17')][_0xe343('0x19')]);return _0x291d0a(_0x384aef['error']['message']);}else{logger['info'](_0xe343('0x12'),_0x2692de,_0xe343('0x13'));_0x291d0a(_0x384aef[_0xe343('0x1a')]['message']);}})[_0xe343('0x1b')](function(_0x399e43){logger[_0xe343('0x17')](_0xe343('0x12'),_0x2692de,_0x399e43);_0x441cd2(_0x399e43);});});}exports[_0xe343('0x1c')]=function(_0x4847bd){var _0x408b76=this;return new Promise(function(_0x20e5a9,_0x241379){return db[_0xe343('0x1d')][_0xe343('0x1e')](_0x4847bd[_0xe343('0x1f')],{'raw':_0x4847bd[_0xe343('0x20')]?_0x4847bd[_0xe343('0x20')][_0xe343('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4847bd['options']?_0x4847bd[_0xe343('0x20')][_0xe343('0x22')]||null:null,'attributes':_0x4847bd[_0xe343('0x20')]?_0x4847bd['options'][_0xe343('0x23')]||null:null,'limit':_0x4847bd[_0xe343('0x20')]?_0x4847bd[_0xe343('0x20')][_0xe343('0x24')]||null:null})['then'](function(_0x4de2f2){logger[_0xe343('0x11')](_0xe343('0x1c'),_0x4847bd);logger[_0xe343('0x14')](_0xe343('0x1c'),_0x4847bd,JSON[_0xe343('0x16')](_0x4de2f2));_0x20e5a9(_0x4de2f2);})['catch'](function(_0x2d5962){logger['error'](_0xe343('0x1c'),_0x2d5962[_0xe343('0x19')],_0x4847bd);_0x241379(_0x408b76['error'](0x1f4,_0x2d5962[_0xe343('0x19')]));});});};exports[_0xe343('0x25')]=function(_0x3ce7cb){return new Promise(function(_0x43210a,_0x224949){return db[_0xe343('0x1d')][_0xe343('0x26')]({'where':_0x3ce7cb[_0xe343('0x20')]?_0x3ce7cb['options'][_0xe343('0x22')]||null:null})['then'](function(_0x2f8252){if(_0x2f8252){return _0x2f8252[_0xe343('0x27')](_0x3ce7cb[_0xe343('0x1f')][_0xe343('0x28')],_[_0xe343('0x29')](_0x3ce7cb['body'],[_0xe343('0x28'),'id'])||{});}})[_0xe343('0x2a')](function(_0xd12dd7){logger[_0xe343('0x11')](_0xe343('0x2b'),_0x3ce7cb);logger[_0xe343('0x14')](_0xe343('0x2b'),_0x3ce7cb,JSON[_0xe343('0x16')](_0xd12dd7));_0x43210a(_0xd12dd7);})[_0xe343('0x1b')](function(_0x39a9b9){logger[_0xe343('0x17')]('AddTags',_0x39a9b9['message'],_0x3ce7cb);_0x224949(_this[_0xe343('0x17')](0x1f4,_0x39a9b9[_0xe343('0x19')]));});});}; \ No newline at end of file +var _0xf85a=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','AddTagsToFaxInteraction','find','omit','ids','spread','AddTags','util'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0xf85a,0x1cd));var _0xaf85=function(_0x17aa7e,_0x35bad7){_0x17aa7e=_0x17aa7e-0x0;var _0x36e9c6=_0xf85a[_0x17aa7e];return _0x36e9c6;};'use strict';var _=require('lodash');var util=require(_0xaf85('0x0'));var moment=require(_0xaf85('0x1'));var BPromise=require('bluebird');var rs=require(_0xaf85('0x2'));var fs=require('fs');var Redis=require(_0xaf85('0x3'));var db=require(_0xaf85('0x4'))['db'];var utils=require(_0xaf85('0x5'));var logger=require(_0xaf85('0x6'))('rpc');var config=require(_0xaf85('0x7'));var jayson=require(_0xaf85('0x8'));var client=jayson[_0xaf85('0x9')][_0xaf85('0xa')]({'port':0x232a});config[_0xaf85('0xb')]=_['defaults'](config[_0xaf85('0xb')],{'host':_0xaf85('0xc'),'port':0x18eb});var socket=require(_0xaf85('0xd'))(new Redis(config[_0xaf85('0xb')]));require(_0xaf85('0xe'))[_0xaf85('0xf')](socket);function respondWithRpcPromise(_0x278520,_0x2b4c6f,_0x56e894){return new BPromise(function(_0x56c7f2,_0x450d58){return client[_0xaf85('0x10')](_0x278520,_0x56e894)[_0xaf85('0x11')](function(_0x3124cf){logger['info'](_0xaf85('0x12'),_0x2b4c6f,_0xaf85('0x13'));logger[_0xaf85('0x14')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x2b4c6f,'request\x20sent',JSON[_0xaf85('0x15')](_0x3124cf));if(_0x3124cf[_0xaf85('0x16')]){if(_0x3124cf[_0xaf85('0x16')][_0xaf85('0x17')]===0x1f4){logger[_0xaf85('0x16')](_0xaf85('0x12'),_0x2b4c6f,_0x3124cf[_0xaf85('0x16')][_0xaf85('0x18')]);return _0x450d58(_0x3124cf['error']['message']);}logger[_0xaf85('0x16')](_0xaf85('0x12'),_0x2b4c6f,_0x3124cf[_0xaf85('0x16')][_0xaf85('0x18')]);return _0x56c7f2(_0x3124cf[_0xaf85('0x16')][_0xaf85('0x18')]);}else{logger[_0xaf85('0x19')]('FaxInteraction,\x20%s,\x20%s',_0x2b4c6f,'request\x20sent');_0x56c7f2(_0x3124cf[_0xaf85('0x1a')]['message']);}})[_0xaf85('0x1b')](function(_0x2a8e45){logger[_0xaf85('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x2b4c6f,_0x2a8e45);_0x450d58(_0x2a8e45);});});}exports[_0xaf85('0x1c')]=function(_0x2502f9){var _0x12b2b5=this;return new Promise(function(_0x1e655f,_0x3ce2db){return db[_0xaf85('0x1d')][_0xaf85('0x1e')](_0x2502f9[_0xaf85('0x1f')],{'raw':_0x2502f9[_0xaf85('0x20')]?_0x2502f9['options'][_0xaf85('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2502f9[_0xaf85('0x20')]?_0x2502f9['options'][_0xaf85('0x22')]||null:null,'attributes':_0x2502f9['options']?_0x2502f9[_0xaf85('0x20')][_0xaf85('0x23')]||null:null,'limit':_0x2502f9['options']?_0x2502f9[_0xaf85('0x20')]['limit']||null:null})[_0xaf85('0x11')](function(_0x32e98d){logger['info']('UpdateFaxInteraction',_0x2502f9);logger[_0xaf85('0x14')]('UpdateFaxInteraction',_0x2502f9,JSON[_0xaf85('0x15')](_0x32e98d));_0x1e655f(_0x32e98d);})[_0xaf85('0x1b')](function(_0x133d76){logger[_0xaf85('0x16')](_0xaf85('0x1c'),_0x133d76[_0xaf85('0x18')],_0x2502f9);_0x3ce2db(_0x12b2b5[_0xaf85('0x16')](0x1f4,_0x133d76[_0xaf85('0x18')]));});});};exports[_0xaf85('0x24')]=function(_0x42c179){return new Promise(function(_0x2e894b,_0x42f4fc){return db[_0xaf85('0x1d')][_0xaf85('0x25')]({'where':_0x42c179[_0xaf85('0x20')]?_0x42c179[_0xaf85('0x20')][_0xaf85('0x22')]||null:null})['then'](function(_0x1ffe2b){if(_0x1ffe2b){return _0x1ffe2b['addTags'](_0x42c179[_0xaf85('0x1f')]['ids'],_[_0xaf85('0x26')](_0x42c179[_0xaf85('0x1f')],[_0xaf85('0x27'),'id'])||{});}})[_0xaf85('0x28')](function(_0x274302){logger[_0xaf85('0x19')](_0xaf85('0x29'),_0x42c179);logger[_0xaf85('0x14')](_0xaf85('0x29'),_0x42c179,JSON[_0xaf85('0x15')](_0x274302));_0x2e894b(_0x274302);})['catch'](function(_0x3915a5){logger['error']('AddTags',_0x3915a5[_0xaf85('0x18')],_0x42c179);_0x42f4fc(_this[_0xaf85('0x16')](0x1f4,_0x3915a5[_0xaf85('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index f609dcf..b6247ab 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 _0x0d2a=['register','length','faxInteraction:','./faxInteraction.events','remove','update','emit','removeListener'];(function(_0x1f87d8,_0x2659a0){var _0x59cfbb=function(_0x4fcd01){while(--_0x4fcd01){_0x1f87d8['push'](_0x1f87d8['shift']());}};_0x59cfbb(++_0x2659a0);}(_0x0d2a,0xcb));var _0xa0d2=function(_0x394049,_0xc85850){_0x394049=_0x394049-0x0;var _0x5a7ae3=_0x0d2a[_0x394049];return _0x5a7ae3;};'use strict';var FaxInteractionEvents=require(_0xa0d2('0x0'));var events=['save',_0xa0d2('0x1'),_0xa0d2('0x2')];function createListener(_0x5ce07f,_0x4b6533){return function(_0x2fae7e){_0x4b6533[_0xa0d2('0x3')](_0x5ce07f,_0x2fae7e);};}function removeListener(_0x110c24,_0x1a4018){return function(){FaxInteractionEvents[_0xa0d2('0x4')](_0x110c24,_0x1a4018);};}exports[_0xa0d2('0x5')]=function(_0x4e4a6e){for(var _0x215934=0x0,_0x32545b=events[_0xa0d2('0x6')];_0x215934<_0x32545b;_0x215934++){var _0x172b9e=events[_0x215934];var _0x283b36=createListener(_0xa0d2('0x7')+_0x172b9e,_0x4e4a6e);FaxInteractionEvents['on'](_0x172b9e,_0x283b36);}}; \ No newline at end of file +var _0x48a2=['save','remove','update','emit','removeListener','register','length','./faxInteraction.events'];(function(_0x168bce,_0x595366){var _0x3db48b=function(_0xe7bc82){while(--_0xe7bc82){_0x168bce['push'](_0x168bce['shift']());}};_0x3db48b(++_0x595366);}(_0x48a2,0x6f));var _0x248a=function(_0x4ebf6a,_0xfd0a40){_0x4ebf6a=_0x4ebf6a-0x0;var _0x1e7a72=_0x48a2[_0x4ebf6a];return _0x1e7a72;};'use strict';var FaxInteractionEvents=require(_0x248a('0x0'));var events=[_0x248a('0x1'),_0x248a('0x2'),_0x248a('0x3')];function createListener(_0xddfd5d,_0x13da6e){return function(_0x55834a){_0x13da6e[_0x248a('0x4')](_0xddfd5d,_0x55834a);};}function removeListener(_0x3d704c,_0x4c2c71){return function(){FaxInteractionEvents[_0x248a('0x5')](_0x3d704c,_0x4c2c71);};}exports[_0x248a('0x6')]=function(_0x5b8e75){for(var _0x3dd188=0x0,_0x36ca62=events[_0x248a('0x7')];_0x3dd188<_0x36ca62;_0x3dd188++){var _0x296c5b=events[_0x3dd188];var _0x5ed502=createListener('faxInteraction:'+_0x296c5b,_0x5b8e75);FaxInteractionEvents['on'](_0x296c5b,_0x5ed502);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 106a0a7..596cbaf 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 _0x406a=['tracked','fax','faxinteraction:addtags','addTags','put','update','delete','faxinteraction:destroy','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','/:id','show','getMessages','post','create','/:id/messages','addMessage','/:id/tags'];(function(_0x4260aa,_0xd487ed){var _0x4cb285=function(_0x869e1d){while(--_0x869e1d){_0x4260aa['push'](_0x4260aa['shift']());}};_0x4cb285(++_0xd487ed);}(_0x406a,0xfd));var _0xa406=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x406a[_0x616290];return _0x453879;};'use strict';var multer=require(_0xa406('0x0'));var util=require('util');var path=require(_0xa406('0x1'));var timeout=require(_0xa406('0x2'));var express=require(_0xa406('0x3'));var router=express[_0xa406('0x4')]();var fs_extra=require(_0xa406('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa406('0x6'));var config=require('../../config/environment');var controller=require('./faxInteraction.controller');router[_0xa406('0x7')]('/',auth[_0xa406('0x8')](),controller['index']);router[_0xa406('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xa406('0x7')](_0xa406('0x9'),auth['isAuthenticated'](),controller[_0xa406('0xa')]);router[_0xa406('0x7')]('/:id/messages',auth[_0xa406('0x8')](),controller[_0xa406('0xb')]);router['get']('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xa406('0xc')]('/',auth['isAuthenticated'](),controller[_0xa406('0xd')]);router[_0xa406('0xc')](_0xa406('0xe'),auth[_0xa406('0x8')](),controller[_0xa406('0xf')]);router['post'](_0xa406('0x10'),auth[_0xa406('0x8')](),interaction[_0xa406('0x11')](_0xa406('0x12'),_0xa406('0x13')),controller[_0xa406('0x14')]);router[_0xa406('0x15')](_0xa406('0x9'),auth['isAuthenticated'](),interaction['tracked'](_0xa406('0x12'),'faxinteraction:update'),controller[_0xa406('0x16')]);router[_0xa406('0x17')](_0xa406('0x9'),auth[_0xa406('0x8')](),interaction['tracked'](_0xa406('0x12'),_0xa406('0x18')),controller[_0xa406('0x19')]);router['delete']('/:id/tags',auth[_0xa406('0x8')](),controller['removeTags']);module[_0xa406('0x1a')]=router; \ No newline at end of file +var _0x6c39=['getMessages','download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','faxinteraction:update','update','delete','faxinteraction:destroy','removeTags','exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','index','/describe','describe','/:id','show','/:id/messages','isAuthenticated'];(function(_0x57fa7e,_0xd0b5ce){var _0x320671=function(_0x3392cc){while(--_0x3392cc){_0x57fa7e['push'](_0x57fa7e['shift']());}};_0x320671(++_0xd0b5ce);}(_0x6c39,0x184));var _0x96c3=function(_0x419550,_0x15cdf1){_0x419550=_0x419550-0x0;var _0x55f9ef=_0x6c39[_0x419550];return _0x55f9ef;};'use strict';var multer=require(_0x96c3('0x0'));var util=require('util');var path=require(_0x96c3('0x1'));var timeout=require('connect-timeout');var express=require(_0x96c3('0x2'));var router=express['Router']();var fs_extra=require(_0x96c3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x96c3('0x4'));var config=require(_0x96c3('0x5'));var controller=require(_0x96c3('0x6'));router[_0x96c3('0x7')]('/',auth['isAuthenticated'](),controller[_0x96c3('0x8')]);router[_0x96c3('0x7')](_0x96c3('0x9'),auth['isAuthenticated'](),controller[_0x96c3('0xa')]);router['get'](_0x96c3('0xb'),auth['isAuthenticated'](),controller[_0x96c3('0xc')]);router['get'](_0x96c3('0xd'),auth[_0x96c3('0xe')](),controller[_0x96c3('0xf')]);router[_0x96c3('0x7')]('/:id/download',auth['isAuthenticated'](),controller[_0x96c3('0x10')]);router[_0x96c3('0x11')]('/',auth[_0x96c3('0xe')](),controller[_0x96c3('0x12')]);router['post'](_0x96c3('0xd'),auth[_0x96c3('0xe')](),controller[_0x96c3('0x13')]);router[_0x96c3('0x11')](_0x96c3('0x14'),auth[_0x96c3('0xe')](),interaction[_0x96c3('0x15')](_0x96c3('0x16'),_0x96c3('0x17')),controller[_0x96c3('0x18')]);router['put'](_0x96c3('0xb'),auth[_0x96c3('0xe')](),interaction[_0x96c3('0x15')](_0x96c3('0x16'),_0x96c3('0x19')),controller[_0x96c3('0x1a')]);router[_0x96c3('0x1b')]('/:id',auth[_0x96c3('0xe')](),interaction[_0x96c3('0x15')](_0x96c3('0x16'),_0x96c3('0x1c')),controller['destroy']);router['delete'](_0x96c3('0x14'),auth['isAuthenticated'](),controller[_0x96c3('0x1d')]);module[_0x96c3('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 7f806c0..48b7c79 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 _0xb43b=['out','DATE','sequelize','TEXT','medium','BOOLEAN','ENUM'];(function(_0x4f4757,_0x44241a){var _0x549c37=function(_0x3c3cfb){while(--_0x3c3cfb){_0x4f4757['push'](_0x4f4757['shift']());}};_0x549c37(++_0x44241a);}(_0xb43b,0xbf));var _0xbb43=function(_0x4a4949,_0xbbacb3){_0x4a4949=_0x4a4949-0x0;var _0x4fec8c=_0xb43b[_0x4a4949];return _0x4fec8c;};'use strict';var Sequelize=require(_0xbb43('0x0'));module['exports']={'body':{'type':Sequelize[_0xbb43('0x1')](_0xbb43('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xbb43('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbb43('0x4')]('in',_0xbb43('0x5')),'defaultValue':_0xbb43('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xbb43('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0xbb43('0x6')]}}; \ No newline at end of file +var _0x1306=['out','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x22868f,_0x450f48){var _0x97bc75=function(_0x447cb4){while(--_0x447cb4){_0x22868f['push'](_0x22868f['shift']());}};_0x97bc75(++_0x450f48);}(_0x1306,0x17a));var _0x6130=function(_0x3453a4,_0x450378){_0x3453a4=_0x3453a4-0x0;var _0x2a34cc=_0x1306[_0x3453a4];return _0x2a34cc;};'use strict';var Sequelize=require(_0x6130('0x0'));module[_0x6130('0x1')]={'body':{'type':Sequelize[_0x6130('0x2')](_0x6130('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x6130('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6130('0x5')]('in',_0x6130('0x6')),'defaultValue':_0x6130('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x6130('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x6130('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index bafa133..969b7e5 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 _0x866e=['readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','format','interaction','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','agent','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','reject','CmContact','Attachment','findOne','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','join','root','server','files','attachments','eml-format','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined','count','limit','set','Content-Range','save','update','destroy','sendStatus','name','send','map','FaxMessage','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','type','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','body','describe','fax-interactions','accept','fax','read'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x866e,0x1ec));var _0xe866=function(_0x224dae,_0x182cc4){_0x224dae=_0x224dae-0x0;var _0x3661de=_0x866e[_0x224dae];return _0x3661de;};'use strict';var emlformat=require(_0xe866('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe866('0x1'));var moment=require(_0xe866('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe866('0x3'));var util=require(_0xe866('0x4'));var path=require(_0xe866('0x5'));var sox=require(_0xe866('0x6'));var csv=require(_0xe866('0x7'));var ejs=require(_0xe866('0x8'));var fs=require('fs');var fs_extra=require(_0xe866('0x9'));var _=require(_0xe866('0xa'));var squel=require(_0xe866('0xb'));var crypto=require(_0xe866('0xc'));var jsforce=require(_0xe866('0xd'));var deskjs=require(_0xe866('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe866('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe866('0x10'));var qs=require(_0xe866('0x11'));var as=require(_0xe866('0x12'));var hardwareService=require(_0xe866('0x13'));var logger=require(_0xe866('0x14'))(_0xe866('0x15'));var utils=require(_0xe866('0x16'));var config=require(_0xe866('0x17'));var licenseUtil=require(_0xe866('0x18'));var db=require(_0xe866('0x19'))['db'];config[_0xe866('0x1a')]=_['defaults'](config[_0xe866('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xe866('0x1b'))(new Redis(config[_0xe866('0x1a')]));require(_0xe866('0x1c'))[_0xe866('0x1d')](socket);var jayson=require(_0xe866('0x1e'));var client=jayson[_0xe866('0x1f')][_0xe866('0x20')]({'port':0x232c});var client9002=jayson['client'][_0xe866('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x7af191,_0x10646b,_0x20b759,_0x53c61c){return new BPromise(function(_0x54f711,_0xcc29f2){var _0x5cfe38=_0x53c61c||client;return _0x5cfe38[_0xe866('0x21')](_0x7af191,_0x20b759)[_0xe866('0x22')](function(_0x3d4b5f){logger[_0xe866('0x23')](_0xe866('0x24'),_0x10646b,_0xe866('0x25'));logger[_0xe866('0x26')](_0xe866('0x27'),_0x10646b,_0xe866('0x25'),JSON[_0xe866('0x28')](_0x3d4b5f));if(_0x3d4b5f[_0xe866('0x29')]){if(_0x3d4b5f['error'][_0xe866('0x2a')]===0x1f4){logger[_0xe866('0x29')](_0xe866('0x24'),_0x10646b,_0x3d4b5f['error'][_0xe866('0x2b')]);return _0xcc29f2(_0x3d4b5f[_0xe866('0x29')][_0xe866('0x2b')]);}logger[_0xe866('0x29')](_0xe866('0x24'),_0x10646b,_0x3d4b5f[_0xe866('0x29')][_0xe866('0x2b')]);return _0x54f711(_0x3d4b5f[_0xe866('0x29')]['message']);}else{logger[_0xe866('0x23')]('FaxMessage,\x20%s,\x20%s',_0x10646b,_0xe866('0x25'));_0x54f711(_0x3d4b5f[_0xe866('0x2c')][_0xe866('0x2b')]);}})[_0xe866('0x2d')](function(_0x2060f2){logger[_0xe866('0x29')](_0xe866('0x24'),_0x10646b,_0x2060f2);_0xcc29f2(_0x2060f2);});});}function respondWithStatusCode(_0x3f637b,_0x5770b9){_0x5770b9=_0x5770b9||0xcc;return function(_0x5d997e){if(_0x5d997e){return _0x3f637b['sendStatus'](_0x5770b9);}return _0x3f637b[_0xe866('0x2e')](_0x5770b9)[_0xe866('0x2f')]();};}function respondWithResult(_0x329abc,_0x2e722d){_0x2e722d=_0x2e722d||0xc8;return function(_0x336ac0){if(_0x336ac0){return _0x329abc['status'](_0x2e722d)[_0xe866('0x30')](_0x336ac0);}};}function respondWithFilteredResult(_0x3b3602,_0x30cad3){return function(_0x33bd0e){if(_0x33bd0e){var _0x31a54c=typeof _0x30cad3[_0xe866('0x31')]===_0xe866('0x32')&&typeof _0x30cad3['limit']===_0xe866('0x32');var _0x17eb10=_0x33bd0e['count'];var _0x446617=_0x31a54c?0x0:_0x30cad3[_0xe866('0x31')];var _0x10cc7b=_0x31a54c?_0x33bd0e[_0xe866('0x33')]:_0x30cad3[_0xe866('0x31')]+_0x30cad3[_0xe866('0x34')];var _0x2df120;if(_0x10cc7b>=_0x17eb10){_0x10cc7b=_0x17eb10;_0x2df120=0xc8;}else{_0x2df120=0xce;}_0x3b3602[_0xe866('0x2e')](_0x2df120);return _0x3b3602[_0xe866('0x35')](_0xe866('0x36'),_0x446617+'-'+_0x10cc7b+'/'+_0x17eb10)['json'](_0x33bd0e);}return null;};}function patchUpdates(_0x2fe00a){return function(_0x28be18){try{jsonpatch['apply'](_0x28be18,_0x2fe00a,!![]);}catch(_0x3deac7){return BPromise['reject'](_0x3deac7);}return _0x28be18[_0xe866('0x37')]();};}function saveUpdates(_0x52f975,_0x42cf74){return function(_0x721d80){if(_0x721d80){return _0x721d80[_0xe866('0x38')](_0x52f975)[_0xe866('0x22')](function(_0x2fc9ca){return _0x2fc9ca;});}return null;};}function removeEntity(_0x299954,_0x25f170){return function(_0x4fd5a6){if(_0x4fd5a6){return _0x4fd5a6[_0xe866('0x39')]()[_0xe866('0x22')](function(){_0x299954[_0xe866('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x488ad9,_0xb41cdc){return function(_0x3051fc){if(!_0x3051fc){_0x488ad9[_0xe866('0x3a')](0x194);}return _0x3051fc;};}function handleError(_0x1f74f5,_0xfe0f7b){_0xfe0f7b=_0xfe0f7b||0x1f4;return function(_0x2f0646){logger[_0xe866('0x29')](_0x2f0646['stack']);if(_0x2f0646[_0xe866('0x3b')]){delete _0x2f0646[_0xe866('0x3b')];}_0x1f74f5['status'](_0xfe0f7b)[_0xe866('0x3c')](_0x2f0646);};}exports['index']=function(_0x3a0905,_0x5993ca){var _0x5ed116={},_0x553ba1={},_0x317051={'count':0x0,'rows':[]};var _0x2fada8=_[_0xe866('0x3d')](db[_0xe866('0x3e')][_0xe866('0x3f')],function(_0x54f735){return{'name':_0x54f735[_0xe866('0x40')],'type':_0x54f735['type']['key']};});_0x553ba1[_0xe866('0x41')]=_[_0xe866('0x3d')](_0x2fada8,'name');_0x553ba1[_0xe866('0x42')]=_[_0xe866('0x43')](_0x3a0905[_0xe866('0x42')]);_0x553ba1[_0xe866('0x44')]=_['intersection'](_0x553ba1[_0xe866('0x41')],_0x553ba1[_0xe866('0x42')]);_0x5ed116[_0xe866('0x45')]=_[_0xe866('0x46')](_0x553ba1[_0xe866('0x41')],qs[_0xe866('0x47')](_0x3a0905[_0xe866('0x42')][_0xe866('0x47')]));_0x5ed116['attributes']=_0x5ed116[_0xe866('0x45')][_0xe866('0x48')]?_0x5ed116[_0xe866('0x45')]:_0x553ba1[_0xe866('0x41')];if(!_0x3a0905['query'][_0xe866('0x49')](_0xe866('0x4a'))){_0x5ed116[_0xe866('0x34')]=qs[_0xe866('0x34')](_0x3a0905[_0xe866('0x42')][_0xe866('0x34')]);_0x5ed116[_0xe866('0x31')]=qs[_0xe866('0x31')](_0x3a0905['query'][_0xe866('0x31')]);}_0x5ed116['order']=qs[_0xe866('0x4b')](_0x3a0905['query'][_0xe866('0x4b')]);_0x5ed116['where']=qs[_0xe866('0x44')](_[_0xe866('0x4c')](_0x3a0905[_0xe866('0x42')],_0x553ba1[_0xe866('0x44')]),_0x2fada8);if(_0x3a0905[_0xe866('0x42')][_0xe866('0x4d')]){_0x5ed116['where']=_[_0xe866('0x4e')](_0x5ed116[_0xe866('0x4f')],{'$or':_[_0xe866('0x3d')](_0x2fada8,function(_0x50b4ca){if(_0x50b4ca[_0xe866('0x50')]!==_0xe866('0x51')){var _0x71643d={};_0x71643d[_0x50b4ca[_0xe866('0x3b')]]={'$like':'%'+_0x3a0905[_0xe866('0x42')]['filter']+'%'};return _0x71643d;}})});}_0x5ed116=_[_0xe866('0x4e')]({},_0x5ed116,_0x3a0905[_0xe866('0x52')]);var _0x385fa3={'where':_0x5ed116[_0xe866('0x4f')]};return db[_0xe866('0x3e')]['count'](_0x385fa3)['then'](function(_0x51c535){_0x317051['count']=_0x51c535;if(_0x3a0905[_0xe866('0x42')]['includeAll']){_0x5ed116[_0xe866('0x53')]=[{'all':!![]}];}return db[_0xe866('0x3e')][_0xe866('0x54')](_0x5ed116);})[_0xe866('0x22')](function(_0x53c3f8){_0x317051[_0xe866('0x55')]=_0x53c3f8;return _0x317051;})[_0xe866('0x22')](respondWithFilteredResult(_0x5993ca,_0x5ed116))[_0xe866('0x2d')](handleError(_0x5993ca,null));};exports[_0xe866('0x56')]=function(_0x4c8edf,_0x2d6107){var _0x904390={'raw':!![],'where':{'id':_0x4c8edf[_0xe866('0x57')]['id']}},_0x30f309={};_0x30f309[_0xe866('0x41')]=_[_0xe866('0x43')](db[_0xe866('0x3e')]['rawAttributes']);_0x30f309['query']=_[_0xe866('0x43')](_0x4c8edf['query']);_0x30f309[_0xe866('0x44')]=_[_0xe866('0x46')](_0x30f309['model'],_0x30f309[_0xe866('0x42')]);_0x904390['attributes']=_[_0xe866('0x46')](_0x30f309[_0xe866('0x41')],qs[_0xe866('0x47')](_0x4c8edf[_0xe866('0x42')][_0xe866('0x47')]));_0x904390[_0xe866('0x45')]=_0x904390[_0xe866('0x45')][_0xe866('0x48')]?_0x904390[_0xe866('0x45')]:_0x30f309[_0xe866('0x41')];if(_0x4c8edf['query'][_0xe866('0x58')]){_0x904390[_0xe866('0x53')]=[{'all':!![]}];}_0x904390=_['merge']({},_0x904390,_0x4c8edf[_0xe866('0x52')]);return db[_0xe866('0x3e')][_0xe866('0x59')](_0x904390)[_0xe866('0x22')](handleEntityNotFound(_0x2d6107,null))[_0xe866('0x22')](respondWithResult(_0x2d6107,null))['catch'](handleError(_0x2d6107,null));};exports[_0xe866('0x38')]=function(_0x20d0b3,_0x5545e1){if(_0x20d0b3[_0xe866('0x5a')]['id']){delete _0x20d0b3[_0xe866('0x5a')]['id'];}return db['FaxMessage']['find']({'where':{'id':_0x20d0b3[_0xe866('0x57')]['id']}})['then'](handleEntityNotFound(_0x5545e1,null))['then'](saveUpdates(_0x20d0b3[_0xe866('0x5a')],null))[_0xe866('0x22')](respondWithResult(_0x5545e1,null))[_0xe866('0x2d')](handleError(_0x5545e1,null));};exports[_0xe866('0x39')]=function(_0x4d73ad,_0x5d833a){return db[_0xe866('0x3e')]['find']({'where':{'id':_0x4d73ad[_0xe866('0x57')]['id']}})['then'](handleEntityNotFound(_0x5d833a,null))['then'](removeEntity(_0x5d833a,null))[_0xe866('0x2d')](handleError(_0x5d833a,null));};exports['describe']=function(_0x8dc77a,_0x473fc9){return db[_0xe866('0x3e')][_0xe866('0x5b')]()[_0xe866('0x22')](respondWithResult(_0x473fc9,null))[_0xe866('0x2d')](handleError(_0x473fc9,null));};var interaction_log=require(_0xe866('0x14'))(_0xe866('0x5c'));exports[_0xe866('0x5d')]=function(_0x46f9d9,_0x403319,_0x1de790){var _0x1dadd7={'agent':{},'channel':_0xe866('0x5e')};if(_0x46f9d9[_0xe866('0x5a')]['id']){delete _0x46f9d9[_0xe866('0x5a')]['id'];}_0x46f9d9[_0xe866('0x5a')][_0xe866('0x5f')]=!![];_0x46f9d9['body'][_0xe866('0x60')]=moment()['format'](_0xe866('0x61'));_0x46f9d9['body']['UserId']=_0x46f9d9[_0xe866('0x5a')]['UserId']||_0x46f9d9['user']['id'];_0x1dadd7['agent']['id']=_0x46f9d9[_0xe866('0x5a')][_0xe866('0x62')];return db[_0xe866('0x3e')]['find']({'where':{'id':_0x46f9d9[_0xe866('0x57')]['id'],'UserId':null}})[_0xe866('0x22')](handleEntityNotFound(_0x403319,null))[_0xe866('0x22')](saveUpdates(_0x46f9d9[_0xe866('0x5a')],null))['then'](function(_0x47a767){if(_0x47a767){_0x1dadd7[_0xe866('0x2b')]=_0x47a767[_0xe866('0x63')]({'plain':!![]});return db[_0xe866('0x64')][_0xe866('0x59')]({'where':{'id':_0x47a767[_0xe866('0x65')]}});}return null;})[_0xe866('0x22')](handleEntityNotFound(_0x403319,null))[_0xe866('0x22')](function(_0xb0aef){if(_0xb0aef){return _0xb0aef[_0xe866('0x38')]({'UserId':_0x46f9d9[_0xe866('0x5a')][_0xe866('0x62')],'read1stAt':_[_0xe866('0x66')](_0xb0aef[_0xe866('0x67')])?moment()[_0xe866('0x68')](_0xe866('0x61')):undefined});}return null;})['then'](function(_0x27794d){if(_0x27794d){_0x1dadd7[_0xe866('0x69')]=_0x27794d['get']({'plain':!![]});interaction_log['info']('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x46f9d9['user']['id'],_0x46f9d9[_0xe866('0x6a')][_0xe866('0x3b')],_0x46f9d9[_0xe866('0x6a')][_0xe866('0x6b')],_0x1dadd7[_0xe866('0x69')]['id'],_0x46f9d9['body']?JSON[_0xe866('0x28')](_0x46f9d9[_0xe866('0x5a')]):_0xe866('0x6c'));return respondWithRpcPromise(_0xe866('0x6d'),'acceptMessage',_0x1dadd7);}return null;})['then'](function(_0x154792){var _0x47ea15=_0xe866('0x6e')+_0x154792['message'][_0xe866('0x6f')];return db[_0xe866('0x70')][_0xe866('0x42')](_0x47ea15,{'type':db[_0xe866('0x71')][_0xe866('0x72')]['SELECT'],'raw':!![]})[_0xe866('0x22')](function(_0x1f4843){return _0x1f4843;});})['then'](function(_0x62d532){if(_0x62d532){_0x1dadd7[_0xe866('0x2b')][_0xe866('0x73')]=_0x62d532[0x0];if(!_0x46f9d9['body']['UserId'])return;return db[_0xe866('0x74')]['find']({'where':{'id':_0x46f9d9[_0xe866('0x5a')]['UserId'],'role':_0xe866('0x75')},'attributes':['id','name',_0xe866('0x76'),'email',_0xe866('0x77')],'raw':!![]});}return null;})[_0xe866('0x22')](function(_0x319501){if(!_0x319501)return null;_0x1dadd7['message'][_0xe866('0x75')]=_0x319501;return _0x1dadd7;})[_0xe866('0x22')](function(_0x24d629){if(_0x24d629){if(_0x46f9d9['body'][_0xe866('0x78')]){_0x1dadd7[_0xe866('0x2b')][_0xe866('0x79')]=util[_0xe866('0x68')](_0xe866('0x7a'),_0x46f9d9[_0xe866('0x6a')][_0xe866('0x3b')]);_0x1dadd7[_0xe866('0x2b')]['channel']=_0x1dadd7[_0xe866('0x7b')];_0x1dadd7['message'][_0xe866('0x7c')]=_0x1dadd7[_0xe866('0x7b')];_0x1dadd7[_0xe866('0x2b')][_0xe866('0x7d')]=_0xe866('0x5d');return respondWithRpcPromise('EventManager',_0xe866('0x7e'),{'event':_0xe866('0x7f'),'message':_0x1dadd7[_0xe866('0x2b')]},client9002)['then'](function(){return _0x1dadd7;});}return _0x1dadd7;}return null;})['then'](respondWithResult(_0x403319,null))['catch'](handleError(_0x403319,null));};var interaction_log=require(_0xe866('0x14'))(_0xe866('0x5c'));exports['reject']=function(_0x17a0c3,_0x3b7234,_0x265c9a){var _0xdcd292={'agent':{},'channel':_0xe866('0x5e')};if(_0x17a0c3[_0xe866('0x5a')]['id']){delete _0x17a0c3[_0xe866('0x5a')]['id'];}_0x17a0c3[_0xe866('0x5a')]['UserId']=_0x17a0c3[_0xe866('0x5a')][_0xe866('0x62')]||_0x17a0c3[_0xe866('0x6a')]['id'];_0xdcd292[_0xe866('0x75')]['id']=_0x17a0c3[_0xe866('0x5a')][_0xe866('0x62')];return db[_0xe866('0x3e')][_0xe866('0x59')]({'where':{'id':_0x17a0c3[_0xe866('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3b7234,null))[_0xe866('0x22')](function(_0x520f90){if(_0x520f90){_0xdcd292[_0xe866('0x2b')]=_0x520f90['get']({'plain':!![]});return db[_0xe866('0x64')]['find']({'where':{'id':_0x520f90[_0xe866('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x3b7234,null))[_0xe866('0x22')](function(_0x46a4f8){if(_0x46a4f8){_0xdcd292['interaction']=_0x46a4f8[_0xe866('0x63')]({'plain':!![]});interaction_log[_0xe866('0x23')](_0xe866('0x80'),_0x17a0c3[_0xe866('0x6a')]['id'],_0x17a0c3[_0xe866('0x6a')]['name'],_0x17a0c3[_0xe866('0x6a')][_0xe866('0x6b')],_0xdcd292['interaction']['id'],_0x17a0c3[_0xe866('0x5a')]?JSON[_0xe866('0x28')](_0x17a0c3[_0xe866('0x5a')]):_0xe866('0x6c'));return respondWithRpcPromise(_0xe866('0x81'),_0xe866('0x82'),_0xdcd292);}return null;})['then'](function(_0x337a20){var _0x3dbe25='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x337a20[_0xe866('0x2b')]['ContactId'];return db['sequelize'][_0xe866('0x42')](_0x3dbe25,{'type':db[_0xe866('0x71')][_0xe866('0x72')][_0xe866('0x83')],'raw':!![]})[_0xe866('0x22')](function(_0x1e3b8e){return _0x1e3b8e;});})[_0xe866('0x22')](function(_0x189f92){if(_0x189f92){_0xdcd292[_0xe866('0x2b')]['contact']=_0x189f92[0x0];if(!_0x17a0c3['body'][_0xe866('0x62')])return;return db[_0xe866('0x74')][_0xe866('0x59')]({'where':{'id':_0x17a0c3[_0xe866('0x5a')][_0xe866('0x62')],'role':_0xe866('0x75')},'attributes':['id','name',_0xe866('0x76'),'email',_0xe866('0x77')],'raw':!![]});}return null;})[_0xe866('0x22')](function(_0x2267a1){if(!_0x2267a1)return null;_0xdcd292['message'][_0xe866('0x75')]=_0x2267a1;return _0xdcd292;})['then'](function(_0x1c1b9f){if(_0x1c1b9f){_0x1c1b9f[_0xe866('0x2b')][_0xe866('0x79')]=util[_0xe866('0x68')](_0xe866('0x7a'),_0x17a0c3['user'][_0xe866('0x3b')]);_0x1c1b9f['message'][_0xe866('0x7b')]=_0xdcd292[_0xe866('0x7b')];_0x1c1b9f[_0xe866('0x2b')]['motionChannel']=_0xdcd292['channel'];_0x1c1b9f[_0xe866('0x2b')][_0xe866('0x7d')]=_0xe866('0x84');respondWithRpcPromise(_0xe866('0x7e'),'EventManager',{'event':'rejectmessage','message':_0x1c1b9f['message']},client9002);return _0xdcd292;}return null;})[_0xe866('0x22')](respondWithResult(_0x3b7234,null))[_0xe866('0x2d')](handleError(_0x3b7234,null));};exports['create']=function(_0x2c8796,_0x4c0a64){var _0x25aa1d;return db['FaxMessage']['create'](_0x2c8796[_0xe866('0x5a')],{})[_0xe866('0x22')](function(_0xa3c68e){_0x25aa1d=_0xa3c68e;return db[_0xe866('0x85')]['findOne']({'where':{'id':_0x25aa1d[_0xe866('0x6f')]}});})[_0xe866('0x22')](function(_0x9f82f6){if(_[_0xe866('0x66')](_0x9f82f6)){return;}else{_0x25aa1d[_0xe866('0x5e')]=_0x9f82f6['fax'];return db[_0xe866('0x86')][_0xe866('0x87')]({'where':{'id':_0x25aa1d['AttachmentId']}});}})[_0xe866('0x22')](function(_0x2ae5b7){return respondWithRpcPromise(_0xe866('0x88'),_0xe866('0x88'),{'FaxAccountId':_[_0xe866('0x66')](_0x2c8796[_0xe866('0x5a')])?undefined:_0x2c8796[_0xe866('0x5a')][_0xe866('0x89')],'path':_['isNil'](_0x2ae5b7)?undefined:util[_0xe866('0x68')](_0xe866('0x8a'),_0x2ae5b7[_0xe866('0x8b')]),'fax':_[_0xe866('0x66')](_0x25aa1d[_0xe866('0x5e')])?undefined:_0x25aa1d[_0xe866('0x5e')],'AttachmentId':_0x25aa1d[_0xe866('0x8c')]},client9002);})['then'](respondWithResult(_0x4c0a64,0xc9))[_0xe866('0x2d')](handleError(_0x4c0a64,null));};exports[_0xe866('0x8d')]=function(_0x3dfb9e,_0x5a1800){var _0x1daf28=path[_0xe866('0x8e')](config[_0xe866('0x8f')],_0xe866('0x90'),_0xe866('0x91'),_0xe866('0x92'));return db[_0xe866('0x3e')][_0xe866('0x59')]({'where':{'id':_0x3dfb9e[_0xe866('0x57')]['id']},'include':[{'model':db[_0xe866('0x86')],'as':'Attachment'}]})[_0xe866('0x22')](handleEntityNotFound(_0x5a1800,null))[_0xe866('0x22')](function(_0x3f6ce8){if(_0x3f6ce8){return _0x5a1800[_0xe866('0x8d')](path[_0xe866('0x8e')](_0x1daf28,_0x3f6ce8['Attachment']['basename']));}})[_0xe866('0x2d')](handleError(_0x5a1800,null));}; \ No newline at end of file +var _0xc35a=['agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','reject','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','QueryTypes','rejectmessage','create','CmContact','fax','findOne','SendFax','FaxAccountId','AttachmentId','join','root','server','files','attachments','Attachment','basename','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','info','request\x20sent','debug','error','FaxMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','update','then','destroy','stack','name','index','FaxMessage','rawAttributes','type','key','map','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','keys','find','body','describe','fax-interactions','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User'];(function(_0x22d236,_0x250b09){var _0x1ac2b9=function(_0x103c48){while(--_0x103c48){_0x22d236['push'](_0x22d236['shift']());}};_0x1ac2b9(++_0x250b09);}(_0xc35a,0x13b));var _0xac35=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xc35a[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0xac35('0x0'));var rimraf=require(_0xac35('0x1'));var zipdir=require(_0xac35('0x2'));var jsonpatch=require(_0xac35('0x3'));var rp=require(_0xac35('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac35('0x5'));var path=require('path');var sox=require(_0xac35('0x6'));var csv=require(_0xac35('0x7'));var ejs=require(_0xac35('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xac35('0x9'));var squel=require(_0xac35('0xa'));var crypto=require(_0xac35('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xac35('0xc'));var toCsv=require(_0xac35('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xac35('0xd'));var authService=require(_0xac35('0xe'));var qs=require(_0xac35('0xf'));var as=require(_0xac35('0x10'));var hardwareService=require(_0xac35('0x11'));var logger=require(_0xac35('0x12'))('api');var utils=require(_0xac35('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xac35('0x14'))['db'];config[_0xac35('0x15')]=_[_0xac35('0x16')](config[_0xac35('0x15')],{'host':_0xac35('0x17'),'port':0x18eb});var socket=require(_0xac35('0x18'))(new Redis(config[_0xac35('0x15')]));require(_0xac35('0x19'))[_0xac35('0x1a')](socket);var jayson=require(_0xac35('0x1b'));var client=jayson[_0xac35('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0xac35('0x1c')][_0xac35('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5a8750,_0x35198e,_0x236622,_0x1e947d){return new BPromise(function(_0x44b909,_0x348f6b){var _0x3128d9=_0x1e947d||client;return _0x3128d9['request'](_0x5a8750,_0x236622)['then'](function(_0x3af3b2){logger[_0xac35('0x1e')]('FaxMessage,\x20%s,\x20%s',_0x35198e,_0xac35('0x1f'));logger[_0xac35('0x20')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x35198e,_0xac35('0x1f'),JSON['stringify'](_0x3af3b2));if(_0x3af3b2['error']){if(_0x3af3b2['error']['code']===0x1f4){logger[_0xac35('0x21')](_0xac35('0x22'),_0x35198e,_0x3af3b2[_0xac35('0x21')][_0xac35('0x23')]);return _0x348f6b(_0x3af3b2[_0xac35('0x21')][_0xac35('0x23')]);}logger[_0xac35('0x21')]('FaxMessage,\x20%s,\x20%s',_0x35198e,_0x3af3b2[_0xac35('0x21')][_0xac35('0x23')]);return _0x44b909(_0x3af3b2['error'][_0xac35('0x23')]);}else{logger[_0xac35('0x1e')](_0xac35('0x22'),_0x35198e,_0xac35('0x1f'));_0x44b909(_0x3af3b2[_0xac35('0x24')]['message']);}})[_0xac35('0x25')](function(_0x2a6a31){logger[_0xac35('0x21')](_0xac35('0x22'),_0x35198e,_0x2a6a31);_0x348f6b(_0x2a6a31);});});}function respondWithStatusCode(_0x327c40,_0x3c5919){_0x3c5919=_0x3c5919||0xcc;return function(_0x5d7074){if(_0x5d7074){return _0x327c40[_0xac35('0x26')](_0x3c5919);}return _0x327c40[_0xac35('0x27')](_0x3c5919)[_0xac35('0x28')]();};}function respondWithResult(_0x2ad372,_0x5c8531){_0x5c8531=_0x5c8531||0xc8;return function(_0x2df0b4){if(_0x2df0b4){return _0x2ad372[_0xac35('0x27')](_0x5c8531)[_0xac35('0x29')](_0x2df0b4);}};}function respondWithFilteredResult(_0x4a63ad,_0x343902){return function(_0x18c2aa){if(_0x18c2aa){var _0x211d8b=typeof _0x343902[_0xac35('0x2a')]==='undefined'&&typeof _0x343902[_0xac35('0x2b')]==='undefined';var _0x53f413=_0x18c2aa[_0xac35('0x2c')];var _0x29ffcb=_0x211d8b?0x0:_0x343902[_0xac35('0x2a')];var _0x1ce974=_0x211d8b?_0x18c2aa['count']:_0x343902[_0xac35('0x2a')]+_0x343902['limit'];var _0x364aa8;if(_0x1ce974>=_0x53f413){_0x1ce974=_0x53f413;_0x364aa8=0xc8;}else{_0x364aa8=0xce;}_0x4a63ad['status'](_0x364aa8);return _0x4a63ad['set'](_0xac35('0x2d'),_0x29ffcb+'-'+_0x1ce974+'/'+_0x53f413)['json'](_0x18c2aa);}return null;};}function patchUpdates(_0x5afc3a){return function(_0x56e16a){try{jsonpatch[_0xac35('0x2e')](_0x56e16a,_0x5afc3a,!![]);}catch(_0x953ea4){return BPromise['reject'](_0x953ea4);}return _0x56e16a['save']();};}function saveUpdates(_0x2daf22,_0x1e7e2c){return function(_0x3391d1){if(_0x3391d1){return _0x3391d1[_0xac35('0x2f')](_0x2daf22)[_0xac35('0x30')](function(_0x46bf18){return _0x46bf18;});}return null;};}function removeEntity(_0x2ab990,_0xb1f4ac){return function(_0x2c5516){if(_0x2c5516){return _0x2c5516[_0xac35('0x31')]()[_0xac35('0x30')](function(){_0x2ab990['status'](0xcc)[_0xac35('0x28')]();});}};}function handleEntityNotFound(_0x1a6a59,_0x3a7a39){return function(_0x92f4ab){if(!_0x92f4ab){_0x1a6a59['sendStatus'](0x194);}return _0x92f4ab;};}function handleError(_0x5d3360,_0x2325d4){_0x2325d4=_0x2325d4||0x1f4;return function(_0x4dac37){logger[_0xac35('0x21')](_0x4dac37[_0xac35('0x32')]);if(_0x4dac37['name']){delete _0x4dac37[_0xac35('0x33')];}_0x5d3360[_0xac35('0x27')](_0x2325d4)['send'](_0x4dac37);};}exports[_0xac35('0x34')]=function(_0x59d9b9,_0x15fa95){var _0x4caeca={},_0x41aadf={},_0x3d6780={'count':0x0,'rows':[]};var _0x5e8aa7=_['map'](db[_0xac35('0x35')][_0xac35('0x36')],function(_0x3428f6){return{'name':_0x3428f6['fieldName'],'type':_0x3428f6[_0xac35('0x37')][_0xac35('0x38')]};});_0x41aadf['model']=_[_0xac35('0x39')](_0x5e8aa7,'name');_0x41aadf[_0xac35('0x3a')]=_['keys'](_0x59d9b9['query']);_0x41aadf[_0xac35('0x3b')]=_[_0xac35('0x3c')](_0x41aadf[_0xac35('0x3d')],_0x41aadf[_0xac35('0x3a')]);_0x4caeca[_0xac35('0x3e')]=_[_0xac35('0x3c')](_0x41aadf[_0xac35('0x3d')],qs[_0xac35('0x3f')](_0x59d9b9[_0xac35('0x3a')]['fields']));_0x4caeca[_0xac35('0x3e')]=_0x4caeca['attributes'][_0xac35('0x40')]?_0x4caeca[_0xac35('0x3e')]:_0x41aadf['model'];if(!_0x59d9b9[_0xac35('0x3a')]['hasOwnProperty'](_0xac35('0x41'))){_0x4caeca[_0xac35('0x2b')]=qs[_0xac35('0x2b')](_0x59d9b9[_0xac35('0x3a')][_0xac35('0x2b')]);_0x4caeca[_0xac35('0x2a')]=qs['offset'](_0x59d9b9[_0xac35('0x3a')]['offset']);}_0x4caeca[_0xac35('0x42')]=qs[_0xac35('0x43')](_0x59d9b9[_0xac35('0x3a')][_0xac35('0x43')]);_0x4caeca[_0xac35('0x44')]=qs[_0xac35('0x3b')](_[_0xac35('0x45')](_0x59d9b9[_0xac35('0x3a')],_0x41aadf['filters']),_0x5e8aa7);if(_0x59d9b9[_0xac35('0x3a')]['filter']){_0x4caeca[_0xac35('0x44')]=_[_0xac35('0x46')](_0x4caeca[_0xac35('0x44')],{'$or':_[_0xac35('0x39')](_0x5e8aa7,function(_0x504261){if(_0x504261[_0xac35('0x37')]!==_0xac35('0x47')){var _0x4c9652={};_0x4c9652[_0x504261[_0xac35('0x33')]]={'$like':'%'+_0x59d9b9['query'][_0xac35('0x48')]+'%'};return _0x4c9652;}})});}_0x4caeca=_['merge']({},_0x4caeca,_0x59d9b9[_0xac35('0x49')]);var _0x393762={'where':_0x4caeca[_0xac35('0x44')]};return db['FaxMessage'][_0xac35('0x2c')](_0x393762)[_0xac35('0x30')](function(_0x377e0f){_0x3d6780['count']=_0x377e0f;if(_0x59d9b9['query'][_0xac35('0x4a')]){_0x4caeca[_0xac35('0x4b')]=[{'all':!![]}];}return db['FaxMessage'][_0xac35('0x4c')](_0x4caeca);})['then'](function(_0x5b7bf4){_0x3d6780['rows']=_0x5b7bf4;return _0x3d6780;})[_0xac35('0x30')](respondWithFilteredResult(_0x15fa95,_0x4caeca))[_0xac35('0x25')](handleError(_0x15fa95,null));};exports[_0xac35('0x4d')]=function(_0x59ef3e,_0x22391e){var _0x21083c={'raw':!![],'where':{'id':_0x59ef3e[_0xac35('0x4e')]['id']}},_0x27e71e={};_0x27e71e[_0xac35('0x3d')]=_['keys'](db[_0xac35('0x35')][_0xac35('0x36')]);_0x27e71e[_0xac35('0x3a')]=_[_0xac35('0x4f')](_0x59ef3e[_0xac35('0x3a')]);_0x27e71e[_0xac35('0x3b')]=_[_0xac35('0x3c')](_0x27e71e[_0xac35('0x3d')],_0x27e71e[_0xac35('0x3a')]);_0x21083c[_0xac35('0x3e')]=_[_0xac35('0x3c')](_0x27e71e[_0xac35('0x3d')],qs['fields'](_0x59ef3e[_0xac35('0x3a')][_0xac35('0x3f')]));_0x21083c[_0xac35('0x3e')]=_0x21083c[_0xac35('0x3e')][_0xac35('0x40')]?_0x21083c[_0xac35('0x3e')]:_0x27e71e['model'];if(_0x59ef3e['query'][_0xac35('0x4a')]){_0x21083c[_0xac35('0x4b')]=[{'all':!![]}];}_0x21083c=_[_0xac35('0x46')]({},_0x21083c,_0x59ef3e[_0xac35('0x49')]);return db[_0xac35('0x35')][_0xac35('0x50')](_0x21083c)[_0xac35('0x30')](handleEntityNotFound(_0x22391e,null))[_0xac35('0x30')](respondWithResult(_0x22391e,null))['catch'](handleError(_0x22391e,null));};exports['update']=function(_0x2a4509,_0x458555){if(_0x2a4509[_0xac35('0x51')]['id']){delete _0x2a4509[_0xac35('0x51')]['id'];}return db[_0xac35('0x35')][_0xac35('0x50')]({'where':{'id':_0x2a4509['params']['id']}})[_0xac35('0x30')](handleEntityNotFound(_0x458555,null))['then'](saveUpdates(_0x2a4509['body'],null))['then'](respondWithResult(_0x458555,null))[_0xac35('0x25')](handleError(_0x458555,null));};exports[_0xac35('0x31')]=function(_0x45a245,_0x178a44){return db['FaxMessage']['find']({'where':{'id':_0x45a245[_0xac35('0x4e')]['id']}})[_0xac35('0x30')](handleEntityNotFound(_0x178a44,null))['then'](removeEntity(_0x178a44,null))['catch'](handleError(_0x178a44,null));};exports[_0xac35('0x52')]=function(_0x438926,_0xbe40ff){return db['FaxMessage'][_0xac35('0x52')]()[_0xac35('0x30')](respondWithResult(_0xbe40ff,null))[_0xac35('0x25')](handleError(_0xbe40ff,null));};var interaction_log=require(_0xac35('0x12'))(_0xac35('0x53'));exports['accept']=function(_0x568304,_0x2352e4,_0x52c21c){var _0x1fbb88={'agent':{},'channel':'fax'};if(_0x568304[_0xac35('0x51')]['id']){delete _0x568304['body']['id'];}_0x568304[_0xac35('0x51')][_0xac35('0x54')]=!![];_0x568304[_0xac35('0x51')][_0xac35('0x55')]=moment()[_0xac35('0x56')](_0xac35('0x57'));_0x568304[_0xac35('0x51')][_0xac35('0x58')]=_0x568304[_0xac35('0x51')][_0xac35('0x58')]||_0x568304['user']['id'];_0x1fbb88['agent']['id']=_0x568304[_0xac35('0x51')][_0xac35('0x58')];return db[_0xac35('0x35')][_0xac35('0x50')]({'where':{'id':_0x568304[_0xac35('0x4e')]['id'],'UserId':null}})[_0xac35('0x30')](handleEntityNotFound(_0x2352e4,null))['then'](saveUpdates(_0x568304['body'],null))[_0xac35('0x30')](function(_0x1dc06f){if(_0x1dc06f){_0x1fbb88[_0xac35('0x23')]=_0x1dc06f['get']({'plain':!![]});return db[_0xac35('0x59')]['find']({'where':{'id':_0x1dc06f[_0xac35('0x5a')]}});}return null;})[_0xac35('0x30')](handleEntityNotFound(_0x2352e4,null))['then'](function(_0x39bddb){if(_0x39bddb){return _0x39bddb[_0xac35('0x2f')]({'UserId':_0x568304['body'][_0xac35('0x58')],'read1stAt':_[_0xac35('0x5b')](_0x39bddb[_0xac35('0x5c')])?moment()[_0xac35('0x56')](_0xac35('0x57')):undefined});}return null;})['then'](function(_0x148386){if(_0x148386){_0x1fbb88[_0xac35('0x5d')]=_0x148386[_0xac35('0x5e')]({'plain':!![]});interaction_log[_0xac35('0x1e')](_0xac35('0x5f'),_0x568304[_0xac35('0x60')]['id'],_0x568304[_0xac35('0x60')][_0xac35('0x33')],_0x568304[_0xac35('0x60')][_0xac35('0x61')],_0x1fbb88[_0xac35('0x5d')]['id'],_0x568304[_0xac35('0x51')]?JSON[_0xac35('0x62')](_0x568304[_0xac35('0x51')]):'null');return respondWithRpcPromise(_0xac35('0x63'),_0xac35('0x64'),_0x1fbb88);}return null;})[_0xac35('0x30')](function(_0x4541d9){var _0x5db669=_0xac35('0x65')+_0x4541d9[_0xac35('0x23')][_0xac35('0x66')];return db[_0xac35('0x67')][_0xac35('0x3a')](_0x5db669,{'type':db[_0xac35('0x68')]['QueryTypes'][_0xac35('0x69')],'raw':!![]})[_0xac35('0x30')](function(_0x55511c){return _0x55511c;});})['then'](function(_0x4c2f41){if(_0x4c2f41){_0x1fbb88[_0xac35('0x23')][_0xac35('0x6a')]=_0x4c2f41[0x0];if(!_0x568304[_0xac35('0x51')][_0xac35('0x58')])return;return db[_0xac35('0x6b')]['find']({'where':{'id':_0x568304['body'][_0xac35('0x58')],'role':_0xac35('0x6c')},'attributes':['id',_0xac35('0x33'),_0xac35('0x6d'),_0xac35('0x6e'),_0xac35('0x6f')],'raw':!![]});}return null;})[_0xac35('0x30')](function(_0x2becb7){if(!_0x2becb7)return null;_0x1fbb88[_0xac35('0x23')][_0xac35('0x6c')]=_0x2becb7;return _0x1fbb88;})[_0xac35('0x30')](function(_0x5893a8){if(_0x5893a8){if(_0x568304[_0xac35('0x51')][_0xac35('0x70')]){_0x1fbb88[_0xac35('0x23')][_0xac35('0x71')]=util['format'](_0xac35('0x72'),_0x568304[_0xac35('0x60')][_0xac35('0x33')]);_0x1fbb88[_0xac35('0x23')][_0xac35('0x73')]=_0x1fbb88[_0xac35('0x73')];_0x1fbb88[_0xac35('0x23')][_0xac35('0x74')]=_0x1fbb88[_0xac35('0x73')];_0x1fbb88[_0xac35('0x23')][_0xac35('0x75')]=_0xac35('0x76');return respondWithRpcPromise(_0xac35('0x77'),_0xac35('0x77'),{'event':_0xac35('0x78'),'message':_0x1fbb88[_0xac35('0x23')]},client9002)[_0xac35('0x30')](function(){return _0x1fbb88;});}return _0x1fbb88;}return null;})[_0xac35('0x30')](respondWithResult(_0x2352e4,null))[_0xac35('0x25')](handleError(_0x2352e4,null));};var interaction_log=require('../../config/logger')(_0xac35('0x53'));exports[_0xac35('0x79')]=function(_0x22a4b3,_0x18f87f,_0x52c944){var _0x8f3ba8={'agent':{},'channel':'fax'};if(_0x22a4b3[_0xac35('0x51')]['id']){delete _0x22a4b3['body']['id'];}_0x22a4b3['body'][_0xac35('0x58')]=_0x22a4b3[_0xac35('0x51')][_0xac35('0x58')]||_0x22a4b3[_0xac35('0x60')]['id'];_0x8f3ba8[_0xac35('0x6c')]['id']=_0x22a4b3[_0xac35('0x51')][_0xac35('0x58')];return db[_0xac35('0x35')][_0xac35('0x50')]({'where':{'id':_0x22a4b3[_0xac35('0x4e')]['id'],'UserId':null}})[_0xac35('0x30')](handleEntityNotFound(_0x18f87f,null))['then'](function(_0x5d694c){if(_0x5d694c){_0x8f3ba8[_0xac35('0x23')]=_0x5d694c[_0xac35('0x5e')]({'plain':!![]});return db['FaxInteraction'][_0xac35('0x50')]({'where':{'id':_0x5d694c['FaxInteractionId']}});}return null;})[_0xac35('0x30')](handleEntityNotFound(_0x18f87f,null))[_0xac35('0x30')](function(_0x5747a2){if(_0x5747a2){_0x8f3ba8[_0xac35('0x5d')]=_0x5747a2[_0xac35('0x5e')]({'plain':!![]});interaction_log[_0xac35('0x1e')](_0xac35('0x7a'),_0x22a4b3[_0xac35('0x60')]['id'],_0x22a4b3[_0xac35('0x60')][_0xac35('0x33')],_0x22a4b3[_0xac35('0x60')][_0xac35('0x61')],_0x8f3ba8[_0xac35('0x5d')]['id'],_0x22a4b3['body']?JSON[_0xac35('0x62')](_0x22a4b3[_0xac35('0x51')]):_0xac35('0x7b'));return respondWithRpcPromise(_0xac35('0x7c'),'rejectMessage',_0x8f3ba8);}return null;})[_0xac35('0x30')](function(_0xd68dcd){var _0x32a35a=_0xac35('0x65')+_0xd68dcd[_0xac35('0x23')][_0xac35('0x66')];return db[_0xac35('0x67')][_0xac35('0x3a')](_0x32a35a,{'type':db[_0xac35('0x68')][_0xac35('0x7d')][_0xac35('0x69')],'raw':!![]})[_0xac35('0x30')](function(_0x5b4b22){return _0x5b4b22;});})[_0xac35('0x30')](function(_0x39ba77){if(_0x39ba77){_0x8f3ba8[_0xac35('0x23')][_0xac35('0x6a')]=_0x39ba77[0x0];if(!_0x22a4b3['body'][_0xac35('0x58')])return;return db['User'][_0xac35('0x50')]({'where':{'id':_0x22a4b3['body']['UserId'],'role':_0xac35('0x6c')},'attributes':['id',_0xac35('0x33'),_0xac35('0x6d'),_0xac35('0x6e'),'internal'],'raw':!![]});}return null;})[_0xac35('0x30')](function(_0x58231f){if(!_0x58231f)return null;_0x8f3ba8[_0xac35('0x23')][_0xac35('0x6c')]=_0x58231f;return _0x8f3ba8;})['then'](function(_0x2ee1cc){if(_0x2ee1cc){_0x2ee1cc[_0xac35('0x23')][_0xac35('0x71')]=util[_0xac35('0x56')](_0xac35('0x72'),_0x22a4b3[_0xac35('0x60')]['name']);_0x2ee1cc['message'][_0xac35('0x73')]=_0x8f3ba8[_0xac35('0x73')];_0x2ee1cc[_0xac35('0x23')][_0xac35('0x74')]=_0x8f3ba8[_0xac35('0x73')];_0x2ee1cc[_0xac35('0x23')][_0xac35('0x75')]='reject';respondWithRpcPromise('EventManager',_0xac35('0x77'),{'event':_0xac35('0x7e'),'message':_0x2ee1cc[_0xac35('0x23')]},client9002);return _0x8f3ba8;}return null;})[_0xac35('0x30')](respondWithResult(_0x18f87f,null))[_0xac35('0x25')](handleError(_0x18f87f,null));};exports[_0xac35('0x7f')]=function(_0xc0f6fe,_0x2e2dea){var _0x3cb325;return db[_0xac35('0x35')][_0xac35('0x7f')](_0xc0f6fe['body'],{})[_0xac35('0x30')](function(_0x5afe60){_0x3cb325=_0x5afe60;return db[_0xac35('0x80')]['findOne']({'where':{'id':_0x3cb325[_0xac35('0x66')]}});})[_0xac35('0x30')](function(_0x109a9a){if(_[_0xac35('0x5b')](_0x109a9a)){return;}else{_0x3cb325[_0xac35('0x81')]=_0x109a9a[_0xac35('0x81')];return db['Attachment'][_0xac35('0x82')]({'where':{'id':_0x3cb325['AttachmentId']}});}})[_0xac35('0x30')](function(_0x3b8dbe){return respondWithRpcPromise('SendFax',_0xac35('0x83'),{'FaxAccountId':_[_0xac35('0x5b')](_0xc0f6fe[_0xac35('0x51')])?undefined:_0xc0f6fe[_0xac35('0x51')][_0xac35('0x84')],'path':_[_0xac35('0x5b')](_0x3b8dbe)?undefined:util[_0xac35('0x56')]('/var/opt/motion2/server/files/attachments/%s',_0x3b8dbe['basename']),'fax':_[_0xac35('0x5b')](_0x3cb325[_0xac35('0x81')])?undefined:_0x3cb325[_0xac35('0x81')],'AttachmentId':_0x3cb325[_0xac35('0x85')]},client9002);})[_0xac35('0x30')](respondWithResult(_0x2e2dea,0xc9))[_0xac35('0x25')](handleError(_0x2e2dea,null));};exports['download']=function(_0x4e39cb,_0x29e9cc){var _0x42a59f=path[_0xac35('0x86')](config[_0xac35('0x87')],_0xac35('0x88'),_0xac35('0x89'),_0xac35('0x8a'));return db['FaxMessage'][_0xac35('0x50')]({'where':{'id':_0x4e39cb[_0xac35('0x4e')]['id']},'include':[{'model':db[_0xac35('0x8b')],'as':_0xac35('0x8b')}]})[_0xac35('0x30')](handleEntityNotFound(_0x29e9cc,null))[_0xac35('0x30')](function(_0x45a3a8){if(_0x45a3a8){return _0x29e9cc['download'](path['join'](_0x42a59f,_0x45a3a8[_0xac35('0x8b')][_0xac35('0x8c')]));}})[_0xac35('0x25')](handleError(_0x29e9cc,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index b62d4c3..983b9c7 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 _0x0424=['exports','FaxMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x263b1e,_0x3ed97b){var _0x3a64b3=function(_0x4c0981){while(--_0x4c0981){_0x263b1e['push'](_0x263b1e['shift']());}};_0x3a64b3(++_0x3ed97b);}(_0x0424,0x159));var _0x4042=function(_0x4ec805,_0x3b8515){_0x4ec805=_0x4ec805-0x0;var _0x386805=_0x0424[_0x4ec805];return _0x386805;};'use strict';var EventEmitter=require('events');var FaxMessage=require('../../mysqldb')['db'][_0x4042('0x0')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x4042('0x1')](0x0);var events={'afterCreate':_0x4042('0x2'),'afterUpdate':_0x4042('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3cd879){return function(_0x519987,_0x491eae,_0x20d8df){FaxMessageEvents[_0x4042('0x4')](_0x3cd879+':'+_0x519987['id'],_0x519987);FaxMessageEvents[_0x4042('0x4')](_0x3cd879,_0x519987);_0x20d8df(null);};}for(var e in events){if(events[_0x4042('0x5')](e)){var event=events[e];FaxMessage[_0x4042('0x6')](e,emitEvent(event));}}module[_0x4042('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0xd9ce=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxMessage','setMaxListeners','save'];(function(_0x4c93d0,_0x16a2d9){var _0xf64b45=function(_0x4f1fc9){while(--_0x4f1fc9){_0x4c93d0['push'](_0x4c93d0['shift']());}};_0xf64b45(++_0x16a2d9);}(_0xd9ce,0xeb));var _0xed9c=function(_0x292a0b,_0x3b2a29){_0x292a0b=_0x292a0b-0x0;var _0x2f3ccc=_0xd9ce[_0x292a0b];return _0x2f3ccc;};'use strict';var EventEmitter=require(_0xed9c('0x0'));var FaxMessage=require(_0xed9c('0x1'))['db'][_0xed9c('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xed9c('0x3')](0x0);var events={'afterCreate':_0xed9c('0x4'),'afterUpdate':_0xed9c('0x5'),'afterDestroy':_0xed9c('0x6')};function emitEvent(_0x1cd5b5){return function(_0x5903b6,_0x3c9c4a,_0xd13461){FaxMessageEvents[_0xed9c('0x7')](_0x1cd5b5+':'+_0x5903b6['id'],_0x5903b6);FaxMessageEvents[_0xed9c('0x7')](_0x1cd5b5,_0x5903b6);_0xd13461(null);};}for(var e in events){if(events[_0xed9c('0x8')](e)){var event=events[e];FaxMessage[_0xed9c('0x9')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index e070636..45751b0 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 _0x8da9=['path','rimraf','define','FaxMessage','body','get','direction','toLowerCase','out','secret','findOne','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','request-promise'];(function(_0x2d0fff,_0x128adc){var _0x40c5b1=function(_0x2bbb86){while(--_0x2bbb86){_0x2d0fff['push'](_0x2d0fff['shift']());}};_0x40c5b1(++_0x128adc);}(_0x8da9,0x65));var _0x98da=function(_0x191d3f,_0x4dc6bb){_0x191d3f=_0x191d3f-0x0;var _0x3b0772=_0x8da9[_0x191d3f];return _0x3b0772;};'use strict';var _=require(_0x98da('0x0'));var util=require(_0x98da('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x98da('0x2'));var BPromise=require('bluebird');var rp=require(_0x98da('0x3'));var fs=require('fs');var path=require(_0x98da('0x4'));var rimraf=require(_0x98da('0x5'));var config=require('../../config/environment');var attributes=require('./faxMessage.attributes');module['exports']=function(_0xbd78b9,_0x2a4b33){return _0xbd78b9[_0x98da('0x6')](_0x98da('0x7'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x98da('0x8')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2256cb,_0x4412df,_0x10773c){var _0x3d0019=_0xbd78b9['models'];var _0x4b2a3b=_0x2256cb[_0x98da('0x9')]({'plain':!![]});if(_0x4b2a3b[_0x98da('0xa')][_0x98da('0xb')]()==='in'||_0x4b2a3b[_0x98da('0xa')][_0x98da('0xb')]()===_0x98da('0xc')&&!_0x4b2a3b[_0x98da('0xd')]&&!_['isNil'](_0x4b2a3b['UserId'])){_0x3d0019['FaxInteraction'][_0x98da('0xe')]({'where':{'id':_0x4b2a3b['FaxInteractionId']}})[_0x98da('0xf')](function(_0x2687b1){if(_0x2687b1){_0x2687b1[_0x98da('0x10')]({'lastMsgAt':_0x4b2a3b[_0x98da('0x11')],'lastMsgDirection':_0x4b2a3b[_0x98da('0xa')][_0x98da('0xb')]()});}})['catch'](function(_0x3c3ff7){console[_0x98da('0x12')](_0x3c3ff7);});}_0x10773c();}},'charset':_0x98da('0x13'),'collate':_0x98da('0x14')});}; \ No newline at end of file +var _0xe046=['createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fax_messages','fti_fax_messages','body','models','get','direction','toLowerCase','out','UserId','FaxInteraction','findOne','FaxInteractionId','then','update'];(function(_0x350343,_0x256f69){var _0x9afc1c=function(_0x47ab32){while(--_0x47ab32){_0x350343['push'](_0x350343['shift']());}};_0x9afc1c(++_0x256f69);}(_0xe046,0x79));var _0x6e04=function(_0x21941e,_0x345231){_0x21941e=_0x21941e-0x0;var _0x11de3b=_0xe046[_0x21941e];return _0x11de3b;};'use strict';var _=require('lodash');var util=require(_0x6e04('0x0'));var logger=require(_0x6e04('0x1'))(_0x6e04('0x2'));var moment=require(_0x6e04('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6e04('0x4'));var rimraf=require(_0x6e04('0x5'));var config=require(_0x6e04('0x6'));var attributes=require(_0x6e04('0x7'));module[_0x6e04('0x8')]=function(_0x3a09bc,_0x5b41a5){return _0x3a09bc['define'](_0x6e04('0x9'),attributes,{'tableName':_0x6e04('0xa'),'paranoid':![],'indexes':[{'name':_0x6e04('0xb'),'fields':[_0x6e04('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2a81ec,_0x4539b8,_0x261d9a){var _0x377743=_0x3a09bc[_0x6e04('0xd')];var _0x520183=_0x2a81ec[_0x6e04('0xe')]({'plain':!![]});if(_0x520183[_0x6e04('0xf')][_0x6e04('0x10')]()==='in'||_0x520183['direction']['toLowerCase']()===_0x6e04('0x11')&&!_0x520183['secret']&&!_['isNil'](_0x520183[_0x6e04('0x12')])){_0x377743[_0x6e04('0x13')][_0x6e04('0x14')]({'where':{'id':_0x520183[_0x6e04('0x15')]}})[_0x6e04('0x16')](function(_0x1c7fac){if(_0x1c7fac){_0x1c7fac[_0x6e04('0x17')]({'lastMsgAt':_0x520183[_0x6e04('0x18')],'lastMsgDirection':_0x520183[_0x6e04('0xf')][_0x6e04('0x10')]()});}})[_0x6e04('0x19')](function(_0x13c67f){console[_0x6e04('0x1a')](_0x13c67f);});}_0x261d9a();}},'charset':_0x6e04('0x1b'),'collate':_0x6e04('0x1c')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index c4dd46e..81a0d22 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 _0x9c44=['code','message','info','catch','FaxMessage','create','body','options','CreateFaxMessage','stringify','UpdateFaxMessage','update','raw','where','attributes','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','defaults','socket.io-emitter','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x9c44,0x178));var _0x49c4=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x9c44[_0x32f7d7];return _0x133d09;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});config[_0x49c4('0x9')]=_[_0x49c4('0xa')](config[_0x49c4('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x49c4('0xb'))(new Redis(config[_0x49c4('0x9')]));require(_0x49c4('0xc'))[_0x49c4('0xd')](socket);function respondWithRpcPromise(_0x4c7d3a,_0x5ab4a3,_0x451ea6){return new BPromise(function(_0x313e73,_0x58cad7){return client[_0x49c4('0xe')](_0x4c7d3a,_0x451ea6)[_0x49c4('0xf')](function(_0x4adb3c){logger['info'](_0x49c4('0x10'),_0x5ab4a3,_0x49c4('0x11'));logger['debug'](_0x49c4('0x12'),_0x5ab4a3,_0x49c4('0x11'),JSON['stringify'](_0x4adb3c));if(_0x4adb3c[_0x49c4('0x13')]){if(_0x4adb3c[_0x49c4('0x13')][_0x49c4('0x14')]===0x1f4){logger[_0x49c4('0x13')](_0x49c4('0x10'),_0x5ab4a3,_0x4adb3c[_0x49c4('0x13')][_0x49c4('0x15')]);return _0x58cad7(_0x4adb3c[_0x49c4('0x13')]['message']);}logger[_0x49c4('0x13')](_0x49c4('0x10'),_0x5ab4a3,_0x4adb3c[_0x49c4('0x13')][_0x49c4('0x15')]);return _0x313e73(_0x4adb3c[_0x49c4('0x13')]['message']);}else{logger[_0x49c4('0x16')](_0x49c4('0x10'),_0x5ab4a3,'request\x20sent');_0x313e73(_0x4adb3c['result'][_0x49c4('0x15')]);}})[_0x49c4('0x17')](function(_0x3addb2){logger['error'](_0x49c4('0x10'),_0x5ab4a3,_0x3addb2);_0x58cad7(_0x3addb2);});});}exports['CreateFaxMessage']=function(_0x2cbd50){var _0x1806c2=this;return new Promise(function(_0xe31fcc,_0x291526){return db[_0x49c4('0x18')][_0x49c4('0x19')](_0x2cbd50[_0x49c4('0x1a')],{'raw':_0x2cbd50[_0x49c4('0x1b')]?_0x2cbd50[_0x49c4('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x57f502){logger[_0x49c4('0x16')]('CreateFaxMessage',_0x2cbd50);logger['debug'](_0x49c4('0x1c'),_0x2cbd50,JSON[_0x49c4('0x1d')](_0x57f502));_0xe31fcc(_0x57f502);})[_0x49c4('0x17')](function(_0xd335e4){logger['error']('CreateFaxMessage',_0xd335e4[_0x49c4('0x15')],_0x2cbd50);_0x291526(_0x1806c2[_0x49c4('0x13')](0x1f4,_0xd335e4['message']));});});};exports[_0x49c4('0x1e')]=function(_0x43e014){var _0x210159=this;return new Promise(function(_0xa7a826,_0x531d92){return db['FaxMessage'][_0x49c4('0x1f')](_0x43e014['body'],{'raw':_0x43e014[_0x49c4('0x1b')]?_0x43e014[_0x49c4('0x1b')][_0x49c4('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43e014[_0x49c4('0x1b')]?_0x43e014['options'][_0x49c4('0x21')]||null:null,'attributes':_0x43e014[_0x49c4('0x1b')]?_0x43e014[_0x49c4('0x1b')][_0x49c4('0x22')]||null:null,'limit':_0x43e014[_0x49c4('0x1b')]?_0x43e014[_0x49c4('0x1b')][_0x49c4('0x23')]||null:null})[_0x49c4('0xf')](function(_0x17b50f){logger[_0x49c4('0x16')](_0x49c4('0x1e'),_0x43e014);logger['debug']('UpdateFaxMessage',_0x43e014,JSON['stringify'](_0x17b50f));_0xa7a826(_0x17b50f);})[_0x49c4('0x17')](function(_0x7ee704){logger[_0x49c4('0x13')](_0x49c4('0x1e'),_0x7ee704[_0x49c4('0x15')],_0x43e014);_0x531d92(_0x210159['error'](0x1f4,_0x7ee704[_0x49c4('0x15')]));});});}; \ No newline at end of file +var _0x22fb=['request','FaxMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','create','options','raw','then','debug','UpdateFaxMessage','update','body','attributes','limit','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x22fb,0x192));var _0xb22f=function(_0x26ea08,_0x1ccd6a){_0x26ea08=_0x26ea08-0x0;var _0xe3b69=_0x22fb[_0x26ea08];return _0xe3b69;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb22f('0x0'));var BPromise=require('bluebird');var rs=require(_0xb22f('0x1'));var fs=require('fs');var Redis=require(_0xb22f('0x2'));var db=require(_0xb22f('0x3'))['db'];var utils=require(_0xb22f('0x4'));var logger=require(_0xb22f('0x5'))('rpc');var config=require(_0xb22f('0x6'));var jayson=require(_0xb22f('0x7'));var client=jayson[_0xb22f('0x8')][_0xb22f('0x9')]({'port':0x232a});config[_0xb22f('0xa')]=_[_0xb22f('0xb')](config['redis'],{'host':_0xb22f('0xc'),'port':0x18eb});var socket=require(_0xb22f('0xd'))(new Redis(config[_0xb22f('0xa')]));require(_0xb22f('0xe'))[_0xb22f('0xf')](socket);function respondWithRpcPromise(_0x3593fb,_0x188cea,_0x2ca6dd){return new BPromise(function(_0x26cf79,_0x2676f3){return client[_0xb22f('0x10')](_0x3593fb,_0x2ca6dd)['then'](function(_0x4b9e56){logger['info'](_0xb22f('0x11'),_0x188cea,'request\x20sent');logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x188cea,_0xb22f('0x12'),JSON[_0xb22f('0x13')](_0x4b9e56));if(_0x4b9e56[_0xb22f('0x14')]){if(_0x4b9e56[_0xb22f('0x14')][_0xb22f('0x15')]===0x1f4){logger[_0xb22f('0x14')]('FaxMessage,\x20%s,\x20%s',_0x188cea,_0x4b9e56[_0xb22f('0x14')]['message']);return _0x2676f3(_0x4b9e56[_0xb22f('0x14')]['message']);}logger[_0xb22f('0x14')](_0xb22f('0x11'),_0x188cea,_0x4b9e56[_0xb22f('0x14')][_0xb22f('0x16')]);return _0x26cf79(_0x4b9e56[_0xb22f('0x14')]['message']);}else{logger[_0xb22f('0x17')]('FaxMessage,\x20%s,\x20%s',_0x188cea,_0xb22f('0x12'));_0x26cf79(_0x4b9e56[_0xb22f('0x18')][_0xb22f('0x16')]);}})[_0xb22f('0x19')](function(_0x139bb6){logger[_0xb22f('0x14')]('FaxMessage,\x20%s,\x20%s',_0x188cea,_0x139bb6);_0x2676f3(_0x139bb6);});});}exports[_0xb22f('0x1a')]=function(_0x4b4510){var _0x3e05ce=this;return new Promise(function(_0x3878d8,_0x316f11){return db[_0xb22f('0x1b')][_0xb22f('0x1c')](_0x4b4510['body'],{'raw':_0x4b4510['options']?_0x4b4510[_0xb22f('0x1d')][_0xb22f('0x1e')]===undefined?!![]:![]:!![]})[_0xb22f('0x1f')](function(_0x16e465){logger[_0xb22f('0x17')](_0xb22f('0x1a'),_0x4b4510);logger[_0xb22f('0x20')](_0xb22f('0x1a'),_0x4b4510,JSON['stringify'](_0x16e465));_0x3878d8(_0x16e465);})['catch'](function(_0x3ab1d8){logger[_0xb22f('0x14')]('CreateFaxMessage',_0x3ab1d8[_0xb22f('0x16')],_0x4b4510);_0x316f11(_0x3e05ce[_0xb22f('0x14')](0x1f4,_0x3ab1d8['message']));});});};exports[_0xb22f('0x21')]=function(_0x2918be){var _0x4dfb62=this;return new Promise(function(_0x3e471f,_0x2c4a9e){return db[_0xb22f('0x1b')][_0xb22f('0x22')](_0x2918be[_0xb22f('0x23')],{'raw':_0x2918be[_0xb22f('0x1d')]?_0x2918be[_0xb22f('0x1d')][_0xb22f('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2918be['options']?_0x2918be['options']['where']||null:null,'attributes':_0x2918be[_0xb22f('0x1d')]?_0x2918be['options'][_0xb22f('0x24')]||null:null,'limit':_0x2918be[_0xb22f('0x1d')]?_0x2918be[_0xb22f('0x1d')][_0xb22f('0x25')]||null:null})[_0xb22f('0x1f')](function(_0x5b2a42){logger['info'](_0xb22f('0x21'),_0x2918be);logger[_0xb22f('0x20')](_0xb22f('0x21'),_0x2918be,JSON[_0xb22f('0x13')](_0x5b2a42));_0x3e471f(_0x5b2a42);})['catch'](function(_0x176133){logger[_0xb22f('0x14')]('UpdateFaxMessage',_0x176133[_0xb22f('0x16')],_0x2918be);_0x2c4a9e(_0x4dfb62[_0xb22f('0x14')](0x1f4,_0x176133[_0xb22f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index cebbbc4..db807c9 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 _0x8b62=['removeListener','register','length','faxMessage:','./faxMessage.events','save','remove'];(function(_0x21bd67,_0x11389f){var _0x46d728=function(_0x6902fa){while(--_0x6902fa){_0x21bd67['push'](_0x21bd67['shift']());}};_0x46d728(++_0x11389f);}(_0x8b62,0x115));var _0x28b6=function(_0x16e57d,_0x2cb7ba){_0x16e57d=_0x16e57d-0x0;var _0x40239c=_0x8b62[_0x16e57d];return _0x40239c;};'use strict';var FaxMessageEvents=require(_0x28b6('0x0'));var events=[_0x28b6('0x1'),_0x28b6('0x2'),'update'];function createListener(_0x2a5800,_0x37bb8a){return function(_0x4b128c){_0x37bb8a['emit'](_0x2a5800,_0x4b128c);};}function removeListener(_0x26dee9,_0x40211c){return function(){FaxMessageEvents[_0x28b6('0x3')](_0x26dee9,_0x40211c);};}exports[_0x28b6('0x4')]=function(_0x2e42cf){for(var _0x1181b7=0x0,_0x3f5f07=events[_0x28b6('0x5')];_0x1181b7<_0x3f5f07;_0x1181b7++){var _0x3189ae=events[_0x1181b7];var _0x5559bb=createListener(_0x28b6('0x6')+_0x3189ae,_0x2e42cf);FaxMessageEvents['on'](_0x3189ae,_0x5559bb);}}; \ No newline at end of file +var _0xce4d=['emit','register','length','faxMessage:','./faxMessage.events','save','update'];(function(_0x53acc2,_0x5272b1){var _0x2143c4=function(_0x8019d9){while(--_0x8019d9){_0x53acc2['push'](_0x53acc2['shift']());}};_0x2143c4(++_0x5272b1);}(_0xce4d,0x177));var _0xdce4=function(_0x406e72,_0x48ec90){_0x406e72=_0x406e72-0x0;var _0x51fe6a=_0xce4d[_0x406e72];return _0x51fe6a;};'use strict';var FaxMessageEvents=require(_0xdce4('0x0'));var events=[_0xdce4('0x1'),'remove',_0xdce4('0x2')];function createListener(_0x23dfa1,_0x2521fe){return function(_0x192e3d){_0x2521fe[_0xdce4('0x3')](_0x23dfa1,_0x192e3d);};}function removeListener(_0x43fcec,_0x38ea43){return function(){FaxMessageEvents['removeListener'](_0x43fcec,_0x38ea43);};}exports[_0xdce4('0x4')]=function(_0x42a1a8){for(var _0xe64846=0x0,_0x592f01=events[_0xdce4('0x5')];_0xe64846<_0x592f01;_0xe64846++){var _0x8f2a35=events[_0xe64846];var _0x5ed4ef=createListener(_0xdce4('0x6')+_0x8f2a35,_0x42a1a8);FaxMessageEvents['on'](_0x8f2a35,_0x5ed4ef);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 4abb7de..cf85391 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 _0xc788=['describe','/:id','show','post','fax','faxmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc788,0xc4));var _0x8c78=function(_0x9ba307,_0x570631){_0x9ba307=_0x9ba307-0x0;var _0x335d04=_0xc788[_0x9ba307];return _0x335d04;};'use strict';var multer=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var path=require(_0x8c78('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8c78('0x3')]();var fs_extra=require(_0x8c78('0x4'));var auth=require(_0x8c78('0x5'));var interaction=require(_0x8c78('0x6'));var config=require(_0x8c78('0x7'));var controller=require('./faxMessage.controller');router[_0x8c78('0x8')]('/',auth[_0x8c78('0x9')](),controller[_0x8c78('0xa')]);router[_0x8c78('0x8')](_0x8c78('0xb'),auth['isAuthenticated'](),controller[_0x8c78('0xc')]);router[_0x8c78('0x8')](_0x8c78('0xd'),auth[_0x8c78('0x9')](),controller[_0x8c78('0xe')]);router[_0x8c78('0x8')]('/:id/download',auth[_0x8c78('0x9')](),controller['download']);router[_0x8c78('0xf')]('/',auth[_0x8c78('0x9')](),interaction['tracked'](_0x8c78('0x10'),_0x8c78('0x11')),controller['create']);router[_0x8c78('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x8c78('0x13')]);router[_0x8c78('0x12')](_0x8c78('0x14'),auth[_0x8c78('0x9')](),controller[_0x8c78('0x15')]);router[_0x8c78('0x12')](_0x8c78('0x16'),auth[_0x8c78('0x9')](),controller[_0x8c78('0x17')]);router[_0x8c78('0x18')]('/:id',auth[_0x8c78('0x9')](),controller[_0x8c78('0x19')]);module['exports']=router; \ No newline at end of file +var _0xa571=['download','post','tracked','fax','put','/:id/accept','accept','/:id/reject','reject','delete','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','/:id','/:id/download'];(function(_0x162bff,_0x2d60ca){var _0xa22a0d=function(_0x43264f){while(--_0x43264f){_0x162bff['push'](_0x162bff['shift']());}};_0xa22a0d(++_0x2d60ca);}(_0xa571,0x107));var _0x1a57=function(_0x2bee83,_0x54b3f6){_0x2bee83=_0x2bee83-0x0;var _0x23eff9=_0xa571[_0x2bee83];return _0x23eff9;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var fs_extra=require(_0x1a57('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a57('0x6'));var controller=require('./faxMessage.controller');router[_0x1a57('0x7')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0x7')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller['describe']);router[_0x1a57('0x7')](_0x1a57('0xb'),auth[_0x1a57('0x8')](),controller['show']);router[_0x1a57('0x7')](_0x1a57('0xc'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xd')]);router[_0x1a57('0xe')]('/',auth[_0x1a57('0x8')](),interaction[_0x1a57('0xf')](_0x1a57('0x10'),'faxmessage:create'),controller['create']);router[_0x1a57('0x11')](_0x1a57('0xb'),auth[_0x1a57('0x8')](),controller['update']);router[_0x1a57('0x11')](_0x1a57('0x12'),auth['isAuthenticated'](),controller[_0x1a57('0x13')]);router['put'](_0x1a57('0x14'),auth[_0x1a57('0x8')](),controller[_0x1a57('0x15')]);router[_0x1a57('0x16')]('/:id',auth[_0x1a57('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 59bb087..7ef3602 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 _0x6d4b=['exports','STRING','INTEGER','beepall','roundrobin','sequelize'];(function(_0x37cb5e,_0x41800d){var _0x28989e=function(_0x566d3d){while(--_0x566d3d){_0x37cb5e['push'](_0x37cb5e['shift']());}};_0x28989e(++_0x41800d);}(_0x6d4b,0xbf));var _0xb6d4=function(_0x413dfc,_0x4bac10){_0x413dfc=_0x413dfc-0x0;var _0x4ac1ac=_0x6d4b[_0x413dfc];return _0x4ac1ac;};'use strict';var Sequelize=require(_0xb6d4('0x0'));module[_0xb6d4('0x1')]={'name':{'type':Sequelize[_0xb6d4('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb6d4('0x2')]},'timeout':{'type':Sequelize[_0xb6d4('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0xb6d4('0x4'),_0xb6d4('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xb6d4('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7b84=['exports','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x4df85c,_0x248dfb){var _0x4e2a61=function(_0x4e2c8e){while(--_0x4e2c8e){_0x4df85c['push'](_0x4df85c['shift']());}};_0x4e2a61(++_0x248dfb);}(_0x7b84,0x167));var _0x47b8=function(_0x4c60be,_0x2af84c){_0x4c60be=_0x4c60be-0x0;var _0x501d02=_0x7b84[_0x4c60be];return _0x501d02;};'use strict';var Sequelize=require(_0x47b8('0x0'));module[_0x47b8('0x1')]={'name':{'type':Sequelize[_0x47b8('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x47b8('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x47b8('0x4')](_0x47b8('0x5'),_0x47b8('0x6'),_0x47b8('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x47b8('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 01938b3..a126d92 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 _0xac38=['getTeams','addTeams','ids','online','voicePause','Agents','sequelize','each','forEach','userFaxQueue:save','removeTeams','field','tq.TeamId','from','team_has_fax_queues','user_has_teams','FaxQueueId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','union','compact','value','transaction','isEmpty','removeAgents','emit','userFaxQueue:remove','addAgents','spread','isArray','getAgents','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./faxQueue.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','save','then','get','FaxQueues','UserProfileResource','error','stack','send','map','FaxQueue','rawAttributes','fieldName','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','type','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','describe','getMembers','findOne','UserFaxQueue','pick','findAll','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','faxPause','Team'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xac38,0x135));var _0x8ac3=function(_0x374ccf,_0xa945c4){_0x374ccf=_0x374ccf-0x0;var _0x443cde=_0xac38[_0x374ccf];return _0x443cde;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8ac3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8ac3('0x1'));var moment=require(_0x8ac3('0x2'));var BPromise=require(_0x8ac3('0x3'));var Mustache=require(_0x8ac3('0x4'));var util=require('util');var path=require(_0x8ac3('0x5'));var sox=require(_0x8ac3('0x6'));var csv=require(_0x8ac3('0x7'));var ejs=require(_0x8ac3('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8ac3('0x9'));var jsforce=require(_0x8ac3('0xa'));var deskjs=require(_0x8ac3('0xb'));var toCsv=require('to-csv');var querystring=require(_0x8ac3('0xc'));var Papa=require(_0x8ac3('0xd'));var Redis=require(_0x8ac3('0xe'));var authService=require(_0x8ac3('0xf'));var qs=require(_0x8ac3('0x10'));var as=require(_0x8ac3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ac3('0x12'))(_0x8ac3('0x13'));var utils=require(_0x8ac3('0x14'));var config=require(_0x8ac3('0x15'));var licenseUtil=require(_0x8ac3('0x16'));var db=require('../../mysqldb')['db'];config[_0x8ac3('0x17')]=_[_0x8ac3('0x18')](config[_0x8ac3('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x8ac3('0x19'))(new Redis(config[_0x8ac3('0x17')]));require(_0x8ac3('0x1a'))['register'](socket);function respondWithStatusCode(_0x34ed5b,_0x1dc77f){_0x1dc77f=_0x1dc77f||0xcc;return function(_0x1fbcac){if(_0x1fbcac){return _0x34ed5b[_0x8ac3('0x1b')](_0x1dc77f);}return _0x34ed5b[_0x8ac3('0x1c')](_0x1dc77f)[_0x8ac3('0x1d')]();};}function respondWithResult(_0x522911,_0x3063c2){_0x3063c2=_0x3063c2||0xc8;return function(_0x4221a5){if(_0x4221a5){return _0x522911[_0x8ac3('0x1c')](_0x3063c2)[_0x8ac3('0x1e')](_0x4221a5);}};}function respondWithFilteredResult(_0x3f0b67,_0x57c4f6){return function(_0x1dcb45){if(_0x1dcb45){var _0x12f501=typeof _0x57c4f6[_0x8ac3('0x1f')]===_0x8ac3('0x20')&&typeof _0x57c4f6['limit']===_0x8ac3('0x20');var _0x30d01e=_0x1dcb45[_0x8ac3('0x21')];var _0x44c4ce=_0x12f501?0x0:_0x57c4f6['offset'];var _0x1474b7=_0x12f501?_0x1dcb45[_0x8ac3('0x21')]:_0x57c4f6['offset']+_0x57c4f6[_0x8ac3('0x22')];var _0x17a733;if(_0x1474b7>=_0x30d01e){_0x1474b7=_0x30d01e;_0x17a733=0xc8;}else{_0x17a733=0xce;}_0x3f0b67[_0x8ac3('0x1c')](_0x17a733);return _0x3f0b67[_0x8ac3('0x23')](_0x8ac3('0x24'),_0x44c4ce+'-'+_0x1474b7+'/'+_0x30d01e)['json'](_0x1dcb45);}return null;};}function patchUpdates(_0x2726c1){return function(_0x146485){try{jsonpatch['apply'](_0x146485,_0x2726c1,!![]);}catch(_0x1d24af){return BPromise['reject'](_0x1d24af);}return _0x146485[_0x8ac3('0x25')]();};}function saveUpdates(_0x434bc6,_0x20541e){return function(_0x51b99b){if(_0x51b99b){return _0x51b99b['update'](_0x434bc6)[_0x8ac3('0x26')](function(_0xdb6fa1){return _0xdb6fa1;});}return null;};}function removeEntity(_0x1dc93a,_0x121b83){return function(_0x30ef15){if(_0x30ef15){return _0x30ef15['destroy']()[_0x8ac3('0x26')](function(){var _0x4e61b6=_0x30ef15[_0x8ac3('0x27')]({'plain':!![]});var _0x2194fe=_0x8ac3('0x28');return db[_0x8ac3('0x29')]['destroy']({'where':{'type':_0x2194fe,'resourceId':_0x4e61b6['id']}})[_0x8ac3('0x26')](function(){return _0x30ef15;});})['then'](function(){_0x1dc93a[_0x8ac3('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d8a07,_0x4dd187){return function(_0x2e7af1){if(!_0x2e7af1){_0x5d8a07[_0x8ac3('0x1b')](0x194);}return _0x2e7af1;};}function handleError(_0x54db7e,_0x4c779b){_0x4c779b=_0x4c779b||0x1f4;return function(_0x2ef800){logger[_0x8ac3('0x2a')](_0x2ef800[_0x8ac3('0x2b')]);if(_0x2ef800['name']){delete _0x2ef800['name'];}_0x54db7e[_0x8ac3('0x1c')](_0x4c779b)[_0x8ac3('0x2c')](_0x2ef800);};}exports['index']=function(_0x3bde32,_0x4d447d){var _0x458ba3={},_0x249a32={},_0x437979={'count':0x0,'rows':[]};var _0xfcd3d7=_[_0x8ac3('0x2d')](db[_0x8ac3('0x2e')][_0x8ac3('0x2f')],function(_0x222e6e){return{'name':_0x222e6e[_0x8ac3('0x30')],'type':_0x222e6e['type'][_0x8ac3('0x31')]};});_0x249a32[_0x8ac3('0x32')]=_[_0x8ac3('0x2d')](_0xfcd3d7,_0x8ac3('0x33'));_0x249a32[_0x8ac3('0x34')]=_['keys'](_0x3bde32[_0x8ac3('0x34')]);_0x249a32[_0x8ac3('0x35')]=_[_0x8ac3('0x36')](_0x249a32['model'],_0x249a32[_0x8ac3('0x34')]);_0x458ba3[_0x8ac3('0x37')]=_[_0x8ac3('0x36')](_0x249a32[_0x8ac3('0x32')],qs[_0x8ac3('0x38')](_0x3bde32[_0x8ac3('0x34')][_0x8ac3('0x38')]));_0x458ba3[_0x8ac3('0x37')]=_0x458ba3[_0x8ac3('0x37')][_0x8ac3('0x39')]?_0x458ba3['attributes']:_0x249a32[_0x8ac3('0x32')];if(!_0x3bde32[_0x8ac3('0x34')][_0x8ac3('0x3a')](_0x8ac3('0x3b'))){_0x458ba3['limit']=qs[_0x8ac3('0x22')](_0x3bde32['query'][_0x8ac3('0x22')]);_0x458ba3['offset']=qs[_0x8ac3('0x1f')](_0x3bde32[_0x8ac3('0x34')][_0x8ac3('0x1f')]);}_0x458ba3[_0x8ac3('0x3c')]=qs[_0x8ac3('0x3d')](_0x3bde32[_0x8ac3('0x34')][_0x8ac3('0x3d')]);_0x458ba3['where']=qs[_0x8ac3('0x35')](_['pick'](_0x3bde32[_0x8ac3('0x34')],_0x249a32[_0x8ac3('0x35')]),_0xfcd3d7);if(_0x3bde32[_0x8ac3('0x34')][_0x8ac3('0x3e')]){_0x458ba3[_0x8ac3('0x3f')]=_['merge'](_0x458ba3['where'],{'$or':_['map'](_0xfcd3d7,function(_0x3f299c){if(_0x3f299c[_0x8ac3('0x40')]!==_0x8ac3('0x41')){var _0xfa82b4={};_0xfa82b4[_0x3f299c[_0x8ac3('0x33')]]={'$like':'%'+_0x3bde32['query'][_0x8ac3('0x3e')]+'%'};return _0xfa82b4;}})});}_0x458ba3=_[_0x8ac3('0x42')]({},_0x458ba3,_0x3bde32[_0x8ac3('0x43')]);var _0x52ce68={'where':_0x458ba3['where']};return db['FaxQueue'][_0x8ac3('0x21')](_0x52ce68)[_0x8ac3('0x26')](function(_0x330474){_0x437979[_0x8ac3('0x21')]=_0x330474;if(_0x3bde32['query'][_0x8ac3('0x44')]){_0x458ba3[_0x8ac3('0x45')]=[{'all':!![]}];}return db[_0x8ac3('0x2e')]['findAll'](_0x458ba3);})[_0x8ac3('0x26')](function(_0x309b96){_0x437979[_0x8ac3('0x46')]=_0x309b96;return _0x437979;})[_0x8ac3('0x26')](respondWithFilteredResult(_0x4d447d,_0x458ba3))[_0x8ac3('0x47')](handleError(_0x4d447d,null));};exports[_0x8ac3('0x48')]=function(_0x567450,_0x36dea6){var _0x420e6c={'raw':!![],'where':{'id':_0x567450[_0x8ac3('0x49')]['id']}},_0x2769ab={};_0x2769ab[_0x8ac3('0x32')]=_[_0x8ac3('0x4a')](db[_0x8ac3('0x2e')][_0x8ac3('0x2f')]);_0x2769ab[_0x8ac3('0x34')]=_[_0x8ac3('0x4a')](_0x567450[_0x8ac3('0x34')]);_0x2769ab[_0x8ac3('0x35')]=_['intersection'](_0x2769ab[_0x8ac3('0x32')],_0x2769ab[_0x8ac3('0x34')]);_0x420e6c[_0x8ac3('0x37')]=_[_0x8ac3('0x36')](_0x2769ab[_0x8ac3('0x32')],qs[_0x8ac3('0x38')](_0x567450[_0x8ac3('0x34')]['fields']));_0x420e6c[_0x8ac3('0x37')]=_0x420e6c[_0x8ac3('0x37')][_0x8ac3('0x39')]?_0x420e6c[_0x8ac3('0x37')]:_0x2769ab[_0x8ac3('0x32')];if(_0x567450['query']['includeAll']){_0x420e6c[_0x8ac3('0x45')]=[{'all':!![]}];}_0x420e6c=_['merge']({},_0x420e6c,_0x567450['options']);return db[_0x8ac3('0x2e')]['find'](_0x420e6c)[_0x8ac3('0x26')](handleEntityNotFound(_0x36dea6,null))[_0x8ac3('0x26')](respondWithResult(_0x36dea6,null))[_0x8ac3('0x47')](handleError(_0x36dea6,null));};exports['create']=function(_0x12aafe,_0x4663b2){return db[_0x8ac3('0x2e')][_0x8ac3('0x4b')](_0x12aafe[_0x8ac3('0x4c')],{})['then'](function(_0x527286){var _0xcfb9f0=_0x12aafe['user'][_0x8ac3('0x27')]({'plain':!![]});if(!_0xcfb9f0)throw new Error(_0x8ac3('0x4d'));if(_0xcfb9f0['role']===_0x8ac3('0x4e')){var _0x5a6265=_0x527286['get']({'plain':!![]});var _0x5ce43b=_0x8ac3('0x28');return db[_0x8ac3('0x4f')][_0x8ac3('0x50')]({'where':{'name':_0x5ce43b,'userProfileId':_0xcfb9f0['userProfileId']},'raw':!![]})[_0x8ac3('0x26')](function(_0x5ab13b){if(_0x5ab13b&&_0x5ab13b[_0x8ac3('0x51')]===0x0){return db['UserProfileResource'][_0x8ac3('0x4b')]({'name':_0x5a6265[_0x8ac3('0x33')],'resourceId':_0x5a6265['id'],'type':_0x5ab13b[_0x8ac3('0x33')],'sectionId':_0x5ab13b['id']},{})['then'](function(){return _0x527286;});}else{return _0x527286;}})[_0x8ac3('0x47')](function(_0x2d9e4f){logger[_0x8ac3('0x2a')](_0x8ac3('0x52'),_0x2d9e4f);throw _0x2d9e4f;});}return _0x527286;})[_0x8ac3('0x26')](respondWithResult(_0x4663b2,0xc9))[_0x8ac3('0x47')](handleError(_0x4663b2,null));};exports[_0x8ac3('0x53')]=function(_0x3d2c87,_0x359fc8){if(_0x3d2c87[_0x8ac3('0x4c')]['id']){delete _0x3d2c87['body']['id'];}return db[_0x8ac3('0x2e')]['find']({'where':{'id':_0x3d2c87[_0x8ac3('0x49')]['id']}})[_0x8ac3('0x26')](handleEntityNotFound(_0x359fc8,null))[_0x8ac3('0x26')](saveUpdates(_0x3d2c87[_0x8ac3('0x4c')],null))[_0x8ac3('0x26')](respondWithResult(_0x359fc8,null))['catch'](handleError(_0x359fc8,null));};exports[_0x8ac3('0x54')]=function(_0x4723fb,_0x3d0f21){return db[_0x8ac3('0x2e')][_0x8ac3('0x50')]({'where':{'id':_0x4723fb[_0x8ac3('0x49')]['id']}})[_0x8ac3('0x26')](handleEntityNotFound(_0x3d0f21,null))[_0x8ac3('0x26')](removeEntity(_0x3d0f21,null))['catch'](handleError(_0x3d0f21,null));};exports[_0x8ac3('0x55')]=function(_0x192006,_0x5d3937){return db[_0x8ac3('0x2e')][_0x8ac3('0x55')]()[_0x8ac3('0x26')](respondWithResult(_0x5d3937,null))[_0x8ac3('0x47')](handleError(_0x5d3937,null));};exports[_0x8ac3('0x56')]=function(_0x55d3a1,_0x5f2889,_0xba9c7a){var _0x53a3f8={'raw':!![],'where':{}},_0x2d27f3={},_0x12dce6;return db[_0x8ac3('0x2e')][_0x8ac3('0x57')]({'where':{'id':_0x55d3a1[_0x8ac3('0x49')]['id']}})[_0x8ac3('0x26')](handleEntityNotFound(_0x5f2889,null))['then'](function(_0x350493){if(_0x350493){_0x12dce6=_0x350493[_0x8ac3('0x27')]({'plain':!![]});_0x2d27f3[_0x8ac3('0x32')]=_[_0x8ac3('0x4a')](db[_0x8ac3('0x58')][_0x8ac3('0x2f')]);_0x2d27f3[_0x8ac3('0x34')]=_['keys'](_0x55d3a1['query']);_0x2d27f3[_0x8ac3('0x35')]=_[_0x8ac3('0x36')](_0x2d27f3['model'],_0x2d27f3[_0x8ac3('0x34')]);_0x53a3f8[_0x8ac3('0x37')]=_[_0x8ac3('0x36')](_0x2d27f3[_0x8ac3('0x32')],qs[_0x8ac3('0x38')](_0x55d3a1[_0x8ac3('0x34')]['fields']));_0x53a3f8[_0x8ac3('0x37')]=_0x53a3f8[_0x8ac3('0x37')][_0x8ac3('0x39')]?_0x53a3f8[_0x8ac3('0x37')]:_0x2d27f3[_0x8ac3('0x32')];if(!_0x55d3a1[_0x8ac3('0x34')][_0x8ac3('0x3a')](_0x8ac3('0x3b'))){_0x53a3f8[_0x8ac3('0x22')]=qs[_0x8ac3('0x22')](_0x55d3a1['query'][_0x8ac3('0x22')]);_0x53a3f8[_0x8ac3('0x1f')]=qs['offset'](_0x55d3a1[_0x8ac3('0x34')][_0x8ac3('0x1f')]);}_0x53a3f8['order']=qs[_0x8ac3('0x3d')](_0x55d3a1[_0x8ac3('0x34')][_0x8ac3('0x3d')]);_0x53a3f8[_0x8ac3('0x3f')]=qs['filters'](_[_0x8ac3('0x59')](_0x55d3a1[_0x8ac3('0x34')],_0x2d27f3[_0x8ac3('0x35')]));_0x53a3f8['where']['FaxQueueId']=_0x350493['id'];if(_0x55d3a1[_0x8ac3('0x34')][_0x8ac3('0x3e')]){_0x53a3f8['where']=_[_0x8ac3('0x42')](_0x53a3f8[_0x8ac3('0x3f')],{'$or':_['map'](_0x53a3f8[_0x8ac3('0x37')],function(_0xf3e8ec){var _0x400280={};_0x400280[_0xf3e8ec]={'$like':'%'+_0x55d3a1[_0x8ac3('0x34')]['filter']+'%'};return _0x400280;})});}_0x53a3f8=_[_0x8ac3('0x42')]({},_0x53a3f8,_0x55d3a1[_0x8ac3('0x43')]);return db[_0x8ac3('0x58')][_0x8ac3('0x5a')](_0x53a3f8);}})[_0x8ac3('0x26')](function(_0x19c6d9){if(_0x19c6d9){return db[_0x8ac3('0x5b')][_0x8ac3('0x5c')]({'where':{'id':_[_0x8ac3('0x2d')](_0x19c6d9,_0x8ac3('0x5d')),'role':_0x8ac3('0x5e')},'attributes':['id',_0x8ac3('0x33'),'faxPause',_0x8ac3('0x5f'),_0x8ac3('0x60')]});}})['then'](function(_0x426449){if(_0x426449){return{'count':_0x426449[_0x8ac3('0x21')],'rows':_[_0x8ac3('0x2d')](_0x426449[_0x8ac3('0x46')],function(_0x142ed4){return{'membername':_0x142ed4[_0x8ac3('0x33')],'UserId':_0x142ed4['id'],'queue_name':_0x12dce6['name'],'FaxQueueId':_0x12dce6['id'],'interface':util[_0x8ac3('0x61')](_0x8ac3('0x62'),_0x8ac3('0x63'),_0x142ed4[_0x8ac3('0x33')]),'penalty':0x0,'paused':_0x142ed4[_0x8ac3('0x64')],'createdAt':_0x142ed4['createdAt'],'updatedAt':_0x142ed4['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5f2889,_0x53a3f8))[_0x8ac3('0x47')](handleError(_0x5f2889,null));};exports['getTeams']=function(_0x435f78,_0x2b663b,_0x144f28){var _0x1b02b5={};var _0x596704={};var _0x210e5b;var _0x286bc7;return db[_0x8ac3('0x2e')]['findOne']({'where':{'id':_0x435f78[_0x8ac3('0x49')]['id']}})['then'](handleEntityNotFound(_0x2b663b,null))[_0x8ac3('0x26')](function(_0x26848c){if(_0x26848c){_0x210e5b=_0x26848c;_0x596704[_0x8ac3('0x32')]=_[_0x8ac3('0x4a')](db[_0x8ac3('0x65')][_0x8ac3('0x2f')]);_0x596704[_0x8ac3('0x34')]=_[_0x8ac3('0x4a')](_0x435f78[_0x8ac3('0x34')]);_0x596704[_0x8ac3('0x35')]=_[_0x8ac3('0x36')](_0x596704[_0x8ac3('0x32')],_0x596704[_0x8ac3('0x34')]);_0x1b02b5[_0x8ac3('0x37')]=_['intersection'](_0x596704[_0x8ac3('0x32')],qs[_0x8ac3('0x38')](_0x435f78[_0x8ac3('0x34')][_0x8ac3('0x38')]));_0x1b02b5[_0x8ac3('0x37')]=_0x1b02b5[_0x8ac3('0x37')]['length']?_0x1b02b5['attributes']:_0x596704[_0x8ac3('0x32')];_0x1b02b5[_0x8ac3('0x3c')]=qs[_0x8ac3('0x3d')](_0x435f78['query'][_0x8ac3('0x3d')]);_0x1b02b5[_0x8ac3('0x3f')]=qs[_0x8ac3('0x35')](_[_0x8ac3('0x59')](_0x435f78[_0x8ac3('0x34')],_0x596704[_0x8ac3('0x35')]));if(_0x435f78['query']['filter']){_0x1b02b5[_0x8ac3('0x3f')]=_[_0x8ac3('0x42')](_0x1b02b5[_0x8ac3('0x3f')],{'$or':_[_0x8ac3('0x2d')](_0x1b02b5[_0x8ac3('0x37')],function(_0x228c20){var _0x16924f={};_0x16924f[_0x228c20]={'$like':'%'+_0x435f78[_0x8ac3('0x34')][_0x8ac3('0x3e')]+'%'};return _0x16924f;})});}_0x1b02b5=_['merge']({},_0x1b02b5,_0x435f78[_0x8ac3('0x43')]);return _0x210e5b[_0x8ac3('0x66')](_0x1b02b5);}})[_0x8ac3('0x26')](function(_0x144ef7){if(_0x144ef7){_0x286bc7=_0x144ef7[_0x8ac3('0x39')];if(!_0x435f78['query']['hasOwnProperty']('nolimit')){_0x1b02b5[_0x8ac3('0x22')]=qs[_0x8ac3('0x22')](_0x435f78[_0x8ac3('0x34')][_0x8ac3('0x22')]);_0x1b02b5['offset']=qs[_0x8ac3('0x1f')](_0x435f78[_0x8ac3('0x34')][_0x8ac3('0x1f')]);}return _0x210e5b[_0x8ac3('0x66')](_0x1b02b5);}})[_0x8ac3('0x26')](function(_0x5396ac){if(_0x5396ac){return _0x5396ac?{'count':_0x286bc7,'rows':_0x5396ac}:null;}})[_0x8ac3('0x26')](respondWithResult(_0x2b663b,null))['catch'](handleError(_0x2b663b,null));};exports[_0x8ac3('0x67')]=function(_0x399019,_0x44f163,_0x559ae9){var _0x156a0f=_0x399019[_0x8ac3('0x4c')][_0x8ac3('0x68')];return db[_0x8ac3('0x65')][_0x8ac3('0x5a')]({'where':{'id':_0x156a0f},'attributes':['id'],'include':[{'model':db[_0x8ac3('0x5b')],'as':'Agents','attributes':['id','name',_0x8ac3('0x69'),_0x8ac3('0x6a'),'interface'],'raw':!![]}]})[_0x8ac3('0x26')](function(_0x31c3d8){if(_0x31c3d8){var _0x37c724=_['flatMap'](_0x31c3d8,function(_0x5add5f){var _0x1cf488=_0x5add5f[_0x8ac3('0x27')]({'plain':!![]});return _0x1cf488[_0x8ac3('0x6b')];});return db[_0x8ac3('0x2e')]['find']({'where':{'id':_0x399019[_0x8ac3('0x49')]['id']}})[_0x8ac3('0x26')](function(_0x3bd319){return db[_0x8ac3('0x6c')]['transaction'](function(_0x503c5a){return _0x3bd319[_0x8ac3('0x67')](_0x156a0f,{'transaction':_0x503c5a})['then'](function(){return BPromise[_0x8ac3('0x6d')](_0x37c724,function(_0x1cf7bc){return db[_0x8ac3('0x58')]['findOrCreate']({'where':{'UserId':_0x1cf7bc['id'],'FaxQueueId':_0x399019[_0x8ac3('0x49')]['id']},'transaction':_0x503c5a});});})[_0x8ac3('0x26')](function(){_0x37c724[_0x8ac3('0x6e')](function(_0x3d5914){socket['emit'](_0x8ac3('0x6f'),{'UserId':_0x3d5914['id'],'FaxQueueId':_0x3bd319['id']});});});});});}})[_0x8ac3('0x26')](respondWithStatusCode(_0x44f163,null))[_0x8ac3('0x47')](handleError(_0x44f163,null));};exports[_0x8ac3('0x70')]=function(_0x96b186,_0x14f47e,_0x588de0){return db[_0x8ac3('0x65')][_0x8ac3('0x5a')]({'where':{'id':_0x96b186[_0x8ac3('0x34')][_0x8ac3('0x68')]},'attributes':['id'],'include':[{'model':db[_0x8ac3('0x5b')],'as':_0x8ac3('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x8ac3('0x26')](handleEntityNotFound(_0x14f47e,null))[_0x8ac3('0x26')](function(_0x7b5d35){var _0x24f258=_[_0x8ac3('0x2d')](_0x7b5d35,'id');var _0x3529c9=[];var _0x165de5=[];var _0x5020d0=squel['select']();_0x5020d0[_0x8ac3('0x71')](_0x8ac3('0x72'))[_0x8ac3('0x73')](_0x8ac3('0x74'),'tq')['join'](_0x8ac3('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x8ac3('0x3f')](_0x8ac3('0x76'),_0x96b186[_0x8ac3('0x49')]['id']);for(var _0x2b9ad4=0x0;_0x2b9ad4<_0x7b5d35[_0x8ac3('0x39')];_0x2b9ad4+=0x1){let _0x47e536=_0x7b5d35[_0x2b9ad4];for(var _0xc1988b=0x0;_0xc1988b<_0x47e536['Agents'][_0x8ac3('0x39')];_0xc1988b+=0x1){let _0x23d53f=_0x47e536[_0x8ac3('0x6b')][_0xc1988b];var _0x100e17=_0x5020d0['clone']();_0x100e17[_0x8ac3('0x3f')]('ut.UserId\x20=\x20?',_0x23d53f['id']);_0x165de5[_0x8ac3('0x77')](db[_0x8ac3('0x6c')][_0x8ac3('0x34')](_0x100e17[_0x8ac3('0x78')](),{'type':db['sequelize']['QueryTypes'][_0x8ac3('0x79')]})[_0x8ac3('0x26')](function(_0x8786a2){if(_0x8786a2['length']===0x1){return _0x23d53f['id'];}else{var _0x4287a2=_[_0x8ac3('0x7a')](_[_0x8ac3('0x2d')](_0x8786a2,_0x8ac3('0x7b')),function(_0x2ca4ab){return _[_0x8ac3('0x7c')](_0x24f258,_0x2ca4ab);});if(_0x4287a2){return _0x23d53f['id'];}}}));}}return BPromise['all'](_0x165de5)['then'](function(_0x411e59){_0x3529c9=_(_0x3529c9)[_0x8ac3('0x7d')](_0x411e59)[_0x8ac3('0x7e')]()[_0x8ac3('0x7f')]();return db[_0x8ac3('0x2e')][_0x8ac3('0x50')]({'where':{'id':_0x96b186[_0x8ac3('0x49')]['id']}})[_0x8ac3('0x26')](function(_0x3ee2a7){return db[_0x8ac3('0x6c')][_0x8ac3('0x80')](function(_0xc412ab){return _0x3ee2a7[_0x8ac3('0x70')](_0x96b186[_0x8ac3('0x34')][_0x8ac3('0x68')],{'transaction':_0xc412ab})[_0x8ac3('0x26')](function(){if(!_[_0x8ac3('0x81')](_0x3529c9)){return _0x3ee2a7[_0x8ac3('0x82')](_0x3529c9,{'transaction':_0xc412ab});}})[_0x8ac3('0x26')](function(){_0x3529c9['forEach'](function(_0x48f116){socket[_0x8ac3('0x83')](_0x8ac3('0x84'),{'UserId':_0x48f116,'FaxQueueId':_0x3ee2a7['id']});});});});});});})[_0x8ac3('0x26')](respondWithStatusCode(_0x14f47e,null))[_0x8ac3('0x47')](handleError(_0x14f47e,null));};exports['addAgents']=function(_0x3a5272,_0x5241ae,_0x393173){return db[_0x8ac3('0x2e')][_0x8ac3('0x50')]({'where':{'id':_0x3a5272[_0x8ac3('0x49')]['id']}})[_0x8ac3('0x26')](handleEntityNotFound(_0x5241ae,null))['then'](function(_0x2bb928){if(_0x2bb928){return _0x2bb928[_0x8ac3('0x85')](_0x3a5272['body'][_0x8ac3('0x68')],_['omit'](_0x3a5272[_0x8ac3('0x4c')],[_0x8ac3('0x68'),'id'])||{})[_0x8ac3('0x86')](function(_0xa5370){for(var _0x52c6d7=0x0;_0x52c6d7<_0x3a5272[_0x8ac3('0x4c')][_0x8ac3('0x68')]['length'];_0x52c6d7+=0x1){socket[_0x8ac3('0x83')](_0x8ac3('0x6f'),{'UserId':Number(_0x3a5272['body']['ids'][_0x52c6d7]),'FaxQueueId':Number(_0x3a5272[_0x8ac3('0x49')]['id'])});}return _0xa5370;});}})[_0x8ac3('0x26')](respondWithResult(_0x5241ae,null))[_0x8ac3('0x47')](handleError(_0x5241ae,null));};exports[_0x8ac3('0x82')]=function(_0x501439,_0x23c6fb,_0x45f6fe){return db[_0x8ac3('0x2e')][_0x8ac3('0x50')]({'where':{'id':_0x501439['params']['id']}})[_0x8ac3('0x26')](handleEntityNotFound(_0x23c6fb,null))[_0x8ac3('0x26')](function(_0x43e995){if(_0x43e995){return _0x43e995[_0x8ac3('0x82')](_0x501439[_0x8ac3('0x34')][_0x8ac3('0x68')])[_0x8ac3('0x26')](function(){if(_[_0x8ac3('0x87')](_0x501439[_0x8ac3('0x34')][_0x8ac3('0x68')])){for(var _0x2a9b08=0x0;_0x2a9b08<_0x501439[_0x8ac3('0x34')][_0x8ac3('0x68')][_0x8ac3('0x39')];_0x2a9b08+=0x1){socket[_0x8ac3('0x83')](_0x8ac3('0x84'),{'UserId':Number(_0x501439[_0x8ac3('0x34')][_0x8ac3('0x68')][_0x2a9b08]),'FaxQueueId':Number(_0x501439[_0x8ac3('0x49')]['id'])});}}else{socket[_0x8ac3('0x83')](_0x8ac3('0x84'),{'UserId':Number(_0x501439['query'][_0x8ac3('0x68')]),'FaxQueueId':Number(_0x501439['params']['id'])});}});}})[_0x8ac3('0x26')](respondWithStatusCode(_0x23c6fb,null))[_0x8ac3('0x47')](handleError(_0x23c6fb,null));};exports['getAgents']=function(_0x2c46c9,_0x191238,_0x1b71ad){var _0x5814e5={};var _0x4b2beb={};var _0x588def;var _0x2e7db7;return db[_0x8ac3('0x2e')][_0x8ac3('0x57')]({'where':{'id':_0x2c46c9[_0x8ac3('0x49')]['id']}})[_0x8ac3('0x26')](handleEntityNotFound(_0x191238,null))[_0x8ac3('0x26')](function(_0x494f19){if(_0x494f19){_0x588def=_0x494f19;_0x4b2beb[_0x8ac3('0x32')]=_[_0x8ac3('0x4a')](db[_0x8ac3('0x5b')][_0x8ac3('0x2f')]);_0x4b2beb[_0x8ac3('0x34')]=_[_0x8ac3('0x4a')](_0x2c46c9[_0x8ac3('0x34')]);_0x4b2beb[_0x8ac3('0x35')]=_[_0x8ac3('0x36')](_0x4b2beb['model'],_0x4b2beb[_0x8ac3('0x34')]);_0x5814e5[_0x8ac3('0x37')]=_[_0x8ac3('0x36')](_0x4b2beb['model'],qs[_0x8ac3('0x38')](_0x2c46c9['query']['fields']));_0x5814e5[_0x8ac3('0x37')]=_0x5814e5[_0x8ac3('0x37')][_0x8ac3('0x39')]?_0x5814e5['attributes']:_0x4b2beb[_0x8ac3('0x32')];_0x5814e5[_0x8ac3('0x3c')]=qs[_0x8ac3('0x3d')](_0x2c46c9[_0x8ac3('0x34')][_0x8ac3('0x3d')]);_0x5814e5[_0x8ac3('0x3f')]=qs[_0x8ac3('0x35')](_['pick'](_0x2c46c9[_0x8ac3('0x34')],_0x4b2beb['filters']));if(_0x2c46c9['query'][_0x8ac3('0x3e')]){_0x5814e5[_0x8ac3('0x3f')]=_[_0x8ac3('0x42')](_0x5814e5[_0x8ac3('0x3f')],{'$or':_['map'](_0x5814e5[_0x8ac3('0x37')],function(_0x2b7944){var _0x2b86f9={};_0x2b86f9[_0x2b7944]={'$like':'%'+_0x2c46c9[_0x8ac3('0x34')]['filter']+'%'};return _0x2b86f9;})});}_0x5814e5=_[_0x8ac3('0x42')]({},_0x5814e5,_0x2c46c9['options']);return _0x588def['getAgents'](_0x5814e5);}})[_0x8ac3('0x26')](function(_0x415f11){if(_0x415f11){_0x2e7db7=_0x415f11[_0x8ac3('0x39')];if(!_0x2c46c9['query'][_0x8ac3('0x3a')](_0x8ac3('0x3b'))){_0x5814e5[_0x8ac3('0x22')]=qs[_0x8ac3('0x22')](_0x2c46c9[_0x8ac3('0x34')][_0x8ac3('0x22')]);_0x5814e5['offset']=qs[_0x8ac3('0x1f')](_0x2c46c9[_0x8ac3('0x34')][_0x8ac3('0x1f')]);}return _0x588def[_0x8ac3('0x88')](_0x5814e5);}})['then'](function(_0x315af){if(_0x315af){return _0x315af?{'count':_0x2e7db7,'rows':_0x315af}:null;}})[_0x8ac3('0x26')](respondWithResult(_0x191238,null))['catch'](handleError(_0x191238,null));}; \ No newline at end of file +var _0x04a0=['findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','SIP','getTeams','Team','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','all','union','removeTeams','isEmpty','removeAgents','userFaxQueue:remove','addAgents','userFaxQueue:save','isArray','getAgents','rimraf','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','register','status','undefined','count','offset','set','json','apply','reject','save','update','destroy','then','get','FaxQueues','UserProfileResource','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','params','getMembers','findOne','UserFaxQueue','hasOwnProperty','sort','User'];(function(_0x5120e4,_0x21a82a){var _0x3acaf6=function(_0x5004c7){while(--_0x5004c7){_0x5120e4['push'](_0x5120e4['shift']());}};_0x3acaf6(++_0x21a82a);}(_0x04a0,0xb3));var _0x004a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x04a0[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x004a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x004a('0x1'));var moment=require(_0x004a('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x004a('0x3'));var path=require(_0x004a('0x4'));var sox=require('sox');var csv=require(_0x004a('0x5'));var ejs=require(_0x004a('0x6'));var fs=require('fs');var fs_extra=require(_0x004a('0x7'));var _=require('lodash');var squel=require(_0x004a('0x8'));var crypto=require('crypto');var jsforce=require(_0x004a('0x9'));var deskjs=require(_0x004a('0xa'));var toCsv=require(_0x004a('0x5'));var querystring=require(_0x004a('0xb'));var Papa=require('papaparse');var Redis=require(_0x004a('0xc'));var authService=require(_0x004a('0xd'));var qs=require(_0x004a('0xe'));var as=require(_0x004a('0xf'));var hardwareService=require(_0x004a('0x10'));var logger=require(_0x004a('0x11'))(_0x004a('0x12'));var utils=require(_0x004a('0x13'));var config=require(_0x004a('0x14'));var licenseUtil=require(_0x004a('0x15'));var db=require(_0x004a('0x16'))['db'];config[_0x004a('0x17')]=_['defaults'](config[_0x004a('0x17')],{'host':_0x004a('0x18'),'port':0x18eb});var socket=require(_0x004a('0x19'))(new Redis(config['redis']));require(_0x004a('0x1a'))[_0x004a('0x1b')](socket);function respondWithStatusCode(_0x25b779,_0x38fb20){_0x38fb20=_0x38fb20||0xcc;return function(_0x57e622){if(_0x57e622){return _0x25b779['sendStatus'](_0x38fb20);}return _0x25b779[_0x004a('0x1c')](_0x38fb20)['end']();};}function respondWithResult(_0xad4831,_0x2721e0){_0x2721e0=_0x2721e0||0xc8;return function(_0x364db8){if(_0x364db8){return _0xad4831['status'](_0x2721e0)['json'](_0x364db8);}};}function respondWithFilteredResult(_0x450af9,_0x31c2f5){return function(_0x42067a){if(_0x42067a){var _0x514e7a=typeof _0x31c2f5['offset']===_0x004a('0x1d')&&typeof _0x31c2f5['limit']===_0x004a('0x1d');var _0x3fa2a9=_0x42067a[_0x004a('0x1e')];var _0x31cda0=_0x514e7a?0x0:_0x31c2f5['offset'];var _0x33e23f=_0x514e7a?_0x42067a[_0x004a('0x1e')]:_0x31c2f5[_0x004a('0x1f')]+_0x31c2f5['limit'];var _0x4edd0c;if(_0x33e23f>=_0x3fa2a9){_0x33e23f=_0x3fa2a9;_0x4edd0c=0xc8;}else{_0x4edd0c=0xce;}_0x450af9[_0x004a('0x1c')](_0x4edd0c);return _0x450af9[_0x004a('0x20')]('Content-Range',_0x31cda0+'-'+_0x33e23f+'/'+_0x3fa2a9)[_0x004a('0x21')](_0x42067a);}return null;};}function patchUpdates(_0x5996df){return function(_0x592e78){try{jsonpatch[_0x004a('0x22')](_0x592e78,_0x5996df,!![]);}catch(_0x18c8e0){return BPromise[_0x004a('0x23')](_0x18c8e0);}return _0x592e78[_0x004a('0x24')]();};}function saveUpdates(_0x56a19b,_0x50be9e){return function(_0x45119c){if(_0x45119c){return _0x45119c[_0x004a('0x25')](_0x56a19b)['then'](function(_0x2d0ab7){return _0x2d0ab7;});}return null;};}function removeEntity(_0x56dda5,_0x40d8fb){return function(_0x45b099){if(_0x45b099){return _0x45b099[_0x004a('0x26')]()[_0x004a('0x27')](function(){var _0x553184=_0x45b099[_0x004a('0x28')]({'plain':!![]});var _0xa7a885=_0x004a('0x29');return db[_0x004a('0x2a')][_0x004a('0x26')]({'where':{'type':_0xa7a885,'resourceId':_0x553184['id']}})[_0x004a('0x27')](function(){return _0x45b099;});})[_0x004a('0x27')](function(){_0x56dda5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ed74d,_0x1a546f){return function(_0xacfe82){if(!_0xacfe82){_0x5ed74d['sendStatus'](0x194);}return _0xacfe82;};}function handleError(_0x180fbd,_0x30ca5f){_0x30ca5f=_0x30ca5f||0x1f4;return function(_0x4a6ff8){logger[_0x004a('0x2b')](_0x4a6ff8[_0x004a('0x2c')]);if(_0x4a6ff8['name']){delete _0x4a6ff8[_0x004a('0x2d')];}_0x180fbd[_0x004a('0x1c')](_0x30ca5f)[_0x004a('0x2e')](_0x4a6ff8);};}exports[_0x004a('0x2f')]=function(_0x1c8e66,_0x34ccaf){var _0xe7e448={},_0x17b155={},_0x57a5da={'count':0x0,'rows':[]};var _0x48dd47=_[_0x004a('0x30')](db[_0x004a('0x31')][_0x004a('0x32')],function(_0x1ca53f){return{'name':_0x1ca53f[_0x004a('0x33')],'type':_0x1ca53f['type'][_0x004a('0x34')]};});_0x17b155[_0x004a('0x35')]=_['map'](_0x48dd47,'name');_0x17b155[_0x004a('0x36')]=_[_0x004a('0x37')](_0x1c8e66[_0x004a('0x36')]);_0x17b155[_0x004a('0x38')]=_['intersection'](_0x17b155['model'],_0x17b155[_0x004a('0x36')]);_0xe7e448['attributes']=_[_0x004a('0x39')](_0x17b155[_0x004a('0x35')],qs['fields'](_0x1c8e66[_0x004a('0x36')][_0x004a('0x3a')]));_0xe7e448[_0x004a('0x3b')]=_0xe7e448[_0x004a('0x3b')][_0x004a('0x3c')]?_0xe7e448['attributes']:_0x17b155[_0x004a('0x35')];if(!_0x1c8e66['query']['hasOwnProperty'](_0x004a('0x3d'))){_0xe7e448[_0x004a('0x3e')]=qs[_0x004a('0x3e')](_0x1c8e66[_0x004a('0x36')][_0x004a('0x3e')]);_0xe7e448[_0x004a('0x1f')]=qs[_0x004a('0x1f')](_0x1c8e66[_0x004a('0x36')]['offset']);}_0xe7e448[_0x004a('0x3f')]=qs['sort'](_0x1c8e66[_0x004a('0x36')]['sort']);_0xe7e448[_0x004a('0x40')]=qs[_0x004a('0x38')](_[_0x004a('0x41')](_0x1c8e66[_0x004a('0x36')],_0x17b155[_0x004a('0x38')]),_0x48dd47);if(_0x1c8e66[_0x004a('0x36')][_0x004a('0x42')]){_0xe7e448['where']=_['merge'](_0xe7e448['where'],{'$or':_[_0x004a('0x30')](_0x48dd47,function(_0x27a009){if(_0x27a009['type']!=='VIRTUAL'){var _0x558f72={};_0x558f72[_0x27a009[_0x004a('0x2d')]]={'$like':'%'+_0x1c8e66[_0x004a('0x36')]['filter']+'%'};return _0x558f72;}})});}_0xe7e448=_[_0x004a('0x43')]({},_0xe7e448,_0x1c8e66[_0x004a('0x44')]);var _0x4873d4={'where':_0xe7e448[_0x004a('0x40')]};return db[_0x004a('0x31')][_0x004a('0x1e')](_0x4873d4)['then'](function(_0x19f9ea){_0x57a5da[_0x004a('0x1e')]=_0x19f9ea;if(_0x1c8e66[_0x004a('0x36')][_0x004a('0x45')]){_0xe7e448[_0x004a('0x46')]=[{'all':!![]}];}return db['FaxQueue'][_0x004a('0x47')](_0xe7e448);})[_0x004a('0x27')](function(_0x4a39d1){_0x57a5da['rows']=_0x4a39d1;return _0x57a5da;})['then'](respondWithFilteredResult(_0x34ccaf,_0xe7e448))[_0x004a('0x48')](handleError(_0x34ccaf,null));};exports[_0x004a('0x49')]=function(_0x5849e1,_0x541d69){var _0x33d8a7={'raw':!![],'where':{'id':_0x5849e1['params']['id']}},_0x4a5309={};_0x4a5309[_0x004a('0x35')]=_['keys'](db[_0x004a('0x31')][_0x004a('0x32')]);_0x4a5309[_0x004a('0x36')]=_[_0x004a('0x37')](_0x5849e1[_0x004a('0x36')]);_0x4a5309[_0x004a('0x38')]=_[_0x004a('0x39')](_0x4a5309['model'],_0x4a5309['query']);_0x33d8a7[_0x004a('0x3b')]=_[_0x004a('0x39')](_0x4a5309[_0x004a('0x35')],qs[_0x004a('0x3a')](_0x5849e1[_0x004a('0x36')][_0x004a('0x3a')]));_0x33d8a7['attributes']=_0x33d8a7['attributes'][_0x004a('0x3c')]?_0x33d8a7[_0x004a('0x3b')]:_0x4a5309[_0x004a('0x35')];if(_0x5849e1[_0x004a('0x36')][_0x004a('0x45')]){_0x33d8a7[_0x004a('0x46')]=[{'all':!![]}];}_0x33d8a7=_[_0x004a('0x43')]({},_0x33d8a7,_0x5849e1[_0x004a('0x44')]);return db[_0x004a('0x31')][_0x004a('0x4a')](_0x33d8a7)[_0x004a('0x27')](handleEntityNotFound(_0x541d69,null))[_0x004a('0x27')](respondWithResult(_0x541d69,null))['catch'](handleError(_0x541d69,null));};exports['create']=function(_0x212b29,_0x5ea9f1){return db[_0x004a('0x31')][_0x004a('0x4b')](_0x212b29[_0x004a('0x4c')],{})[_0x004a('0x27')](function(_0x5226ce){var _0x233006=_0x212b29[_0x004a('0x4d')][_0x004a('0x28')]({'plain':!![]});if(!_0x233006)throw new Error(_0x004a('0x4e'));if(_0x233006[_0x004a('0x4f')]==='user'){var _0x46bf0b=_0x5226ce['get']({'plain':!![]});var _0x4f5c6b=_0x004a('0x29');return db['UserProfileSection'][_0x004a('0x4a')]({'where':{'name':_0x4f5c6b,'userProfileId':_0x233006[_0x004a('0x50')]},'raw':!![]})[_0x004a('0x27')](function(_0x30bc90){if(_0x30bc90&&_0x30bc90[_0x004a('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x46bf0b[_0x004a('0x2d')],'resourceId':_0x46bf0b['id'],'type':_0x30bc90[_0x004a('0x2d')],'sectionId':_0x30bc90['id']},{})[_0x004a('0x27')](function(){return _0x5226ce;});}else{return _0x5226ce;}})['catch'](function(_0x47bc83){logger[_0x004a('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x47bc83);throw _0x47bc83;});}return _0x5226ce;})[_0x004a('0x27')](respondWithResult(_0x5ea9f1,0xc9))['catch'](handleError(_0x5ea9f1,null));};exports[_0x004a('0x25')]=function(_0x2fb1c9,_0x409af4){if(_0x2fb1c9['body']['id']){delete _0x2fb1c9[_0x004a('0x4c')]['id'];}return db[_0x004a('0x31')][_0x004a('0x4a')]({'where':{'id':_0x2fb1c9[_0x004a('0x52')]['id']}})['then'](handleEntityNotFound(_0x409af4,null))[_0x004a('0x27')](saveUpdates(_0x2fb1c9[_0x004a('0x4c')],null))[_0x004a('0x27')](respondWithResult(_0x409af4,null))[_0x004a('0x48')](handleError(_0x409af4,null));};exports['destroy']=function(_0xedff32,_0x1dd5f8){return db['FaxQueue'][_0x004a('0x4a')]({'where':{'id':_0xedff32['params']['id']}})[_0x004a('0x27')](handleEntityNotFound(_0x1dd5f8,null))['then'](removeEntity(_0x1dd5f8,null))[_0x004a('0x48')](handleError(_0x1dd5f8,null));};exports['describe']=function(_0x6756ae,_0x370fa2){return db[_0x004a('0x31')]['describe']()[_0x004a('0x27')](respondWithResult(_0x370fa2,null))[_0x004a('0x48')](handleError(_0x370fa2,null));};exports[_0x004a('0x53')]=function(_0x1782bc,_0x45910d,_0x5361e1){var _0x5afd02={'raw':!![],'where':{}},_0x2e24fc={},_0x24087b;return db[_0x004a('0x31')][_0x004a('0x54')]({'where':{'id':_0x1782bc[_0x004a('0x52')]['id']}})[_0x004a('0x27')](handleEntityNotFound(_0x45910d,null))['then'](function(_0x4f6e13){if(_0x4f6e13){_0x24087b=_0x4f6e13[_0x004a('0x28')]({'plain':!![]});_0x2e24fc[_0x004a('0x35')]=_[_0x004a('0x37')](db[_0x004a('0x55')][_0x004a('0x32')]);_0x2e24fc['query']=_[_0x004a('0x37')](_0x1782bc[_0x004a('0x36')]);_0x2e24fc['filters']=_[_0x004a('0x39')](_0x2e24fc['model'],_0x2e24fc[_0x004a('0x36')]);_0x5afd02[_0x004a('0x3b')]=_['intersection'](_0x2e24fc[_0x004a('0x35')],qs['fields'](_0x1782bc['query']['fields']));_0x5afd02[_0x004a('0x3b')]=_0x5afd02[_0x004a('0x3b')]['length']?_0x5afd02[_0x004a('0x3b')]:_0x2e24fc[_0x004a('0x35')];if(!_0x1782bc['query'][_0x004a('0x56')](_0x004a('0x3d'))){_0x5afd02[_0x004a('0x3e')]=qs['limit'](_0x1782bc[_0x004a('0x36')][_0x004a('0x3e')]);_0x5afd02['offset']=qs[_0x004a('0x1f')](_0x1782bc[_0x004a('0x36')][_0x004a('0x1f')]);}_0x5afd02[_0x004a('0x3f')]=qs[_0x004a('0x57')](_0x1782bc[_0x004a('0x36')][_0x004a('0x57')]);_0x5afd02[_0x004a('0x40')]=qs['filters'](_[_0x004a('0x41')](_0x1782bc[_0x004a('0x36')],_0x2e24fc['filters']));_0x5afd02[_0x004a('0x40')]['FaxQueueId']=_0x4f6e13['id'];if(_0x1782bc[_0x004a('0x36')][_0x004a('0x42')]){_0x5afd02[_0x004a('0x40')]=_[_0x004a('0x43')](_0x5afd02['where'],{'$or':_[_0x004a('0x30')](_0x5afd02['attributes'],function(_0x21964c){var _0x40d700={};_0x40d700[_0x21964c]={'$like':'%'+_0x1782bc['query'][_0x004a('0x42')]+'%'};return _0x40d700;})});}_0x5afd02=_[_0x004a('0x43')]({},_0x5afd02,_0x1782bc['options']);return db[_0x004a('0x55')]['findAll'](_0x5afd02);}})[_0x004a('0x27')](function(_0x2a4ab4){if(_0x2a4ab4){return db[_0x004a('0x58')][_0x004a('0x59')]({'where':{'id':_[_0x004a('0x30')](_0x2a4ab4,_0x004a('0x5a')),'role':_0x004a('0x5b')},'attributes':['id',_0x004a('0x2d'),_0x004a('0x5c'),_0x004a('0x5d'),_0x004a('0x5e')]});}})[_0x004a('0x27')](function(_0x4ed9ae){if(_0x4ed9ae){return{'count':_0x4ed9ae[_0x004a('0x1e')],'rows':_[_0x004a('0x30')](_0x4ed9ae['rows'],function(_0x4e8489){return{'membername':_0x4e8489[_0x004a('0x2d')],'UserId':_0x4e8489['id'],'queue_name':_0x24087b['name'],'FaxQueueId':_0x24087b['id'],'interface':util['format']('%s/%s',_0x004a('0x5f'),_0x4e8489[_0x004a('0x2d')]),'penalty':0x0,'paused':_0x4e8489[_0x004a('0x5c')],'createdAt':_0x4e8489[_0x004a('0x5e')],'updatedAt':_0x4e8489['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x004a('0x27')](respondWithFilteredResult(_0x45910d,_0x5afd02))[_0x004a('0x48')](handleError(_0x45910d,null));};exports[_0x004a('0x60')]=function(_0x407f27,_0x15e6bf,_0x2c46d9){var _0x155240={};var _0x522076={};var _0x2986a1;var _0x46c415;return db['FaxQueue'][_0x004a('0x54')]({'where':{'id':_0x407f27[_0x004a('0x52')]['id']}})['then'](handleEntityNotFound(_0x15e6bf,null))[_0x004a('0x27')](function(_0x172ae0){if(_0x172ae0){_0x2986a1=_0x172ae0;_0x522076[_0x004a('0x35')]=_['keys'](db[_0x004a('0x61')]['rawAttributes']);_0x522076[_0x004a('0x36')]=_[_0x004a('0x37')](_0x407f27[_0x004a('0x36')]);_0x522076['filters']=_[_0x004a('0x39')](_0x522076[_0x004a('0x35')],_0x522076[_0x004a('0x36')]);_0x155240[_0x004a('0x3b')]=_[_0x004a('0x39')](_0x522076[_0x004a('0x35')],qs['fields'](_0x407f27['query'][_0x004a('0x3a')]));_0x155240['attributes']=_0x155240[_0x004a('0x3b')]['length']?_0x155240['attributes']:_0x522076['model'];_0x155240[_0x004a('0x3f')]=qs['sort'](_0x407f27[_0x004a('0x36')][_0x004a('0x57')]);_0x155240[_0x004a('0x40')]=qs[_0x004a('0x38')](_[_0x004a('0x41')](_0x407f27[_0x004a('0x36')],_0x522076[_0x004a('0x38')]));if(_0x407f27[_0x004a('0x36')][_0x004a('0x42')]){_0x155240[_0x004a('0x40')]=_[_0x004a('0x43')](_0x155240[_0x004a('0x40')],{'$or':_[_0x004a('0x30')](_0x155240[_0x004a('0x3b')],function(_0x436e7a){var _0x55244a={};_0x55244a[_0x436e7a]={'$like':'%'+_0x407f27[_0x004a('0x36')][_0x004a('0x42')]+'%'};return _0x55244a;})});}_0x155240=_[_0x004a('0x43')]({},_0x155240,_0x407f27[_0x004a('0x44')]);return _0x2986a1['getTeams'](_0x155240);}})['then'](function(_0x34b8e5){if(_0x34b8e5){_0x46c415=_0x34b8e5['length'];if(!_0x407f27['query'][_0x004a('0x56')](_0x004a('0x3d'))){_0x155240[_0x004a('0x3e')]=qs['limit'](_0x407f27[_0x004a('0x36')][_0x004a('0x3e')]);_0x155240[_0x004a('0x1f')]=qs[_0x004a('0x1f')](_0x407f27[_0x004a('0x36')]['offset']);}return _0x2986a1[_0x004a('0x60')](_0x155240);}})[_0x004a('0x27')](function(_0x345edb){if(_0x345edb){return _0x345edb?{'count':_0x46c415,'rows':_0x345edb}:null;}})[_0x004a('0x27')](respondWithResult(_0x15e6bf,null))[_0x004a('0x48')](handleError(_0x15e6bf,null));};exports[_0x004a('0x62')]=function(_0x51b2d8,_0x321660,_0x3e8967){var _0x242f81=_0x51b2d8['body'][_0x004a('0x63')];return db['Team'][_0x004a('0x47')]({'where':{'id':_0x242f81},'attributes':['id'],'include':[{'model':db[_0x004a('0x58')],'as':_0x004a('0x64'),'attributes':['id',_0x004a('0x2d'),'online',_0x004a('0x65'),_0x004a('0x66')],'raw':!![]}]})[_0x004a('0x27')](function(_0x1cfb6d){if(_0x1cfb6d){var _0x137ced=_[_0x004a('0x67')](_0x1cfb6d,function(_0x562e7a){var _0x52eafc=_0x562e7a['get']({'plain':!![]});return _0x52eafc[_0x004a('0x64')];});return db['FaxQueue'][_0x004a('0x4a')]({'where':{'id':_0x51b2d8['params']['id']}})['then'](function(_0x1b8ab1){return db[_0x004a('0x68')][_0x004a('0x69')](function(_0x4dfb46){return _0x1b8ab1[_0x004a('0x62')](_0x242f81,{'transaction':_0x4dfb46})[_0x004a('0x27')](function(){return BPromise[_0x004a('0x6a')](_0x137ced,function(_0x743d26){return db[_0x004a('0x55')][_0x004a('0x6b')]({'where':{'UserId':_0x743d26['id'],'FaxQueueId':_0x51b2d8[_0x004a('0x52')]['id']},'transaction':_0x4dfb46});});})['then'](function(){_0x137ced[_0x004a('0x6c')](function(_0x70325c){socket[_0x004a('0x6d')]('userFaxQueue:save',{'UserId':_0x70325c['id'],'FaxQueueId':_0x1b8ab1['id']});});});});});}})['then'](respondWithStatusCode(_0x321660,null))[_0x004a('0x48')](handleError(_0x321660,null));};exports['removeTeams']=function(_0x276340,_0x1d0f64,_0x37ae0a){return db['Team']['findAll']({'where':{'id':_0x276340[_0x004a('0x36')][_0x004a('0x63')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x004a('0x64'),'attributes':['id'],'raw':!![]}]})[_0x004a('0x27')](handleEntityNotFound(_0x1d0f64,null))[_0x004a('0x27')](function(_0x4aa34f){var _0x350add=_[_0x004a('0x30')](_0x4aa34f,'id');var _0xe03bf0=[];var _0x3f4885=[];var _0x4c6034=squel[_0x004a('0x6e')]();_0x4c6034[_0x004a('0x6f')]('tq.TeamId')[_0x004a('0x70')]('team_has_fax_queues','tq')[_0x004a('0x71')](_0x004a('0x72'),'ut',_0x004a('0x73'))['where'](_0x004a('0x74'),_0x276340[_0x004a('0x52')]['id']);for(var _0x51b1e6=0x0;_0x51b1e6<_0x4aa34f[_0x004a('0x3c')];_0x51b1e6+=0x1){let _0x27d4c2=_0x4aa34f[_0x51b1e6];for(var _0x3781a5=0x0;_0x3781a5<_0x27d4c2[_0x004a('0x64')][_0x004a('0x3c')];_0x3781a5+=0x1){let _0x4f040e=_0x27d4c2['Agents'][_0x3781a5];var _0x306849=_0x4c6034[_0x004a('0x75')]();_0x306849[_0x004a('0x40')](_0x004a('0x76'),_0x4f040e['id']);_0x3f4885[_0x004a('0x77')](db[_0x004a('0x68')][_0x004a('0x36')](_0x306849[_0x004a('0x78')](),{'type':db['sequelize'][_0x004a('0x79')]['SELECT']})['then'](function(_0x1d42f8){if(_0x1d42f8['length']===0x1){return _0x4f040e['id'];}else{var _0x3b3369=_[_0x004a('0x7a')](_[_0x004a('0x30')](_0x1d42f8,_0x004a('0x7b')),function(_0x35d4dc){return _['includes'](_0x350add,_0x35d4dc);});if(_0x3b3369){return _0x4f040e['id'];}}}));}}return BPromise[_0x004a('0x7c')](_0x3f4885)[_0x004a('0x27')](function(_0x5de407){_0xe03bf0=_(_0xe03bf0)[_0x004a('0x7d')](_0x5de407)['compact']()['value']();return db[_0x004a('0x31')][_0x004a('0x4a')]({'where':{'id':_0x276340[_0x004a('0x52')]['id']}})[_0x004a('0x27')](function(_0x8b186d){return db[_0x004a('0x68')][_0x004a('0x69')](function(_0x5c07ea){return _0x8b186d[_0x004a('0x7e')](_0x276340['query'][_0x004a('0x63')],{'transaction':_0x5c07ea})[_0x004a('0x27')](function(){if(!_[_0x004a('0x7f')](_0xe03bf0)){return _0x8b186d[_0x004a('0x80')](_0xe03bf0,{'transaction':_0x5c07ea});}})[_0x004a('0x27')](function(){_0xe03bf0[_0x004a('0x6c')](function(_0x58da63){socket[_0x004a('0x6d')](_0x004a('0x81'),{'UserId':_0x58da63,'FaxQueueId':_0x8b186d['id']});});});});});});})['then'](respondWithStatusCode(_0x1d0f64,null))[_0x004a('0x48')](handleError(_0x1d0f64,null));};exports['addAgents']=function(_0x5dcfc5,_0x297f7d,_0x416cbf){return db[_0x004a('0x31')][_0x004a('0x4a')]({'where':{'id':_0x5dcfc5['params']['id']}})[_0x004a('0x27')](handleEntityNotFound(_0x297f7d,null))['then'](function(_0x2c0170){if(_0x2c0170){return _0x2c0170[_0x004a('0x82')](_0x5dcfc5[_0x004a('0x4c')][_0x004a('0x63')],_['omit'](_0x5dcfc5[_0x004a('0x4c')],['ids','id'])||{})['spread'](function(_0x563be2){for(var _0x33aa70=0x0;_0x33aa70<_0x5dcfc5['body'][_0x004a('0x63')][_0x004a('0x3c')];_0x33aa70+=0x1){socket[_0x004a('0x6d')](_0x004a('0x83'),{'UserId':Number(_0x5dcfc5[_0x004a('0x4c')][_0x004a('0x63')][_0x33aa70]),'FaxQueueId':Number(_0x5dcfc5[_0x004a('0x52')]['id'])});}return _0x563be2;});}})[_0x004a('0x27')](respondWithResult(_0x297f7d,null))[_0x004a('0x48')](handleError(_0x297f7d,null));};exports[_0x004a('0x80')]=function(_0x1acc49,_0x46ba8f,_0x483d31){return db[_0x004a('0x31')]['find']({'where':{'id':_0x1acc49['params']['id']}})[_0x004a('0x27')](handleEntityNotFound(_0x46ba8f,null))['then'](function(_0x59535c){if(_0x59535c){return _0x59535c['removeAgents'](_0x1acc49[_0x004a('0x36')][_0x004a('0x63')])[_0x004a('0x27')](function(){if(_[_0x004a('0x84')](_0x1acc49['query'][_0x004a('0x63')])){for(var _0x44ae3c=0x0;_0x44ae3c<_0x1acc49[_0x004a('0x36')][_0x004a('0x63')][_0x004a('0x3c')];_0x44ae3c+=0x1){socket[_0x004a('0x6d')]('userFaxQueue:remove',{'UserId':Number(_0x1acc49[_0x004a('0x36')][_0x004a('0x63')][_0x44ae3c]),'FaxQueueId':Number(_0x1acc49['params']['id'])});}}else{socket[_0x004a('0x6d')](_0x004a('0x81'),{'UserId':Number(_0x1acc49[_0x004a('0x36')]['ids']),'FaxQueueId':Number(_0x1acc49['params']['id'])});}});}})['then'](respondWithStatusCode(_0x46ba8f,null))[_0x004a('0x48')](handleError(_0x46ba8f,null));};exports['getAgents']=function(_0x4e11ea,_0x4139de,_0x3469a2){var _0x32657c={};var _0x1a4b3b={};var _0x125132;var _0x556b9d;return db[_0x004a('0x31')][_0x004a('0x54')]({'where':{'id':_0x4e11ea[_0x004a('0x52')]['id']}})[_0x004a('0x27')](handleEntityNotFound(_0x4139de,null))[_0x004a('0x27')](function(_0x3f3332){if(_0x3f3332){_0x125132=_0x3f3332;_0x1a4b3b[_0x004a('0x35')]=_[_0x004a('0x37')](db[_0x004a('0x58')][_0x004a('0x32')]);_0x1a4b3b[_0x004a('0x36')]=_[_0x004a('0x37')](_0x4e11ea[_0x004a('0x36')]);_0x1a4b3b[_0x004a('0x38')]=_[_0x004a('0x39')](_0x1a4b3b[_0x004a('0x35')],_0x1a4b3b[_0x004a('0x36')]);_0x32657c['attributes']=_[_0x004a('0x39')](_0x1a4b3b[_0x004a('0x35')],qs[_0x004a('0x3a')](_0x4e11ea[_0x004a('0x36')][_0x004a('0x3a')]));_0x32657c['attributes']=_0x32657c['attributes'][_0x004a('0x3c')]?_0x32657c['attributes']:_0x1a4b3b['model'];_0x32657c[_0x004a('0x3f')]=qs[_0x004a('0x57')](_0x4e11ea[_0x004a('0x36')]['sort']);_0x32657c[_0x004a('0x40')]=qs[_0x004a('0x38')](_[_0x004a('0x41')](_0x4e11ea[_0x004a('0x36')],_0x1a4b3b[_0x004a('0x38')]));if(_0x4e11ea[_0x004a('0x36')]['filter']){_0x32657c[_0x004a('0x40')]=_[_0x004a('0x43')](_0x32657c[_0x004a('0x40')],{'$or':_[_0x004a('0x30')](_0x32657c[_0x004a('0x3b')],function(_0x42bb0d){var _0x1398e3={};_0x1398e3[_0x42bb0d]={'$like':'%'+_0x4e11ea[_0x004a('0x36')][_0x004a('0x42')]+'%'};return _0x1398e3;})});}_0x32657c=_[_0x004a('0x43')]({},_0x32657c,_0x4e11ea[_0x004a('0x44')]);return _0x125132[_0x004a('0x85')](_0x32657c);}})[_0x004a('0x27')](function(_0x1bf3ff){if(_0x1bf3ff){_0x556b9d=_0x1bf3ff['length'];if(!_0x4e11ea['query'][_0x004a('0x56')](_0x004a('0x3d'))){_0x32657c[_0x004a('0x3e')]=qs[_0x004a('0x3e')](_0x4e11ea[_0x004a('0x36')][_0x004a('0x3e')]);_0x32657c[_0x004a('0x1f')]=qs[_0x004a('0x1f')](_0x4e11ea[_0x004a('0x36')]['offset']);}return _0x125132['getAgents'](_0x32657c);}})['then'](function(_0x27c77b){if(_0x27c77b){return _0x27c77b?{'count':_0x556b9d,'rows':_0x27c77b}:null;}})[_0x004a('0x27')](respondWithResult(_0x4139de,null))[_0x004a('0x48')](handleError(_0x4139de,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 0b1157b..dc6089f 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 _0x5659=['hook','events','../../mysqldb','FaxQueue','save','remove','emit','hasOwnProperty'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x5659,0x141));var _0x9565=function(_0x1344cc,_0x19667f){_0x1344cc=_0x1344cc-0x0;var _0x4b7296=_0x5659[_0x1344cc];return _0x4b7296;};'use strict';var EventEmitter=require(_0x9565('0x0'));var FaxQueue=require(_0x9565('0x1'))['db'][_0x9565('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9565('0x3'),'afterUpdate':'update','afterDestroy':_0x9565('0x4')};function emitEvent(_0x2f62a1){return function(_0x5bb9f2,_0x1f68cb,_0x4898dd){FaxQueueEvents['emit'](_0x2f62a1+':'+_0x5bb9f2['id'],_0x5bb9f2);FaxQueueEvents[_0x9565('0x5')](_0x2f62a1,_0x5bb9f2);_0x4898dd(null);};}for(var e in events){if(events[_0x9565('0x6')](e)){var event=events[e];FaxQueue[_0x9565('0x7')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x9f25=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners'];(function(_0x8632c6,_0x179577){var _0x45bcf2=function(_0x61759c){while(--_0x61759c){_0x8632c6['push'](_0x8632c6['shift']());}};_0x45bcf2(++_0x179577);}(_0x9f25,0x196));var _0x59f2=function(_0xda501a,_0x159d6a){_0xda501a=_0xda501a-0x0;var _0x44be3a=_0x9f25[_0xda501a];return _0x44be3a;};'use strict';var EventEmitter=require(_0x59f2('0x0'));var FaxQueue=require(_0x59f2('0x1'))['db'][_0x59f2('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x59f2('0x3')](0x0);var events={'afterCreate':_0x59f2('0x4'),'afterUpdate':_0x59f2('0x5'),'afterDestroy':'remove'};function emitEvent(_0x48e107){return function(_0x52c40b,_0x54cecd,_0x41c5cb){FaxQueueEvents[_0x59f2('0x6')](_0x48e107+':'+_0x52c40b['id'],_0x52c40b);FaxQueueEvents[_0x59f2('0x6')](_0x48e107,_0x52c40b);_0x41c5cb(null);};}for(var e in events){if(events[_0x59f2('0x7')](e)){var event=events[e];FaxQueue[_0x59f2('0x8')](e,emitEvent(event));}}module[_0x59f2('0x9')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 53b4a12..bc7cc03 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 _0x45eb=['api','moment','bluebird','request-promise','../../config/environment','./faxQueue.attributes','exports','define','lodash','util'];(function(_0x1927c4,_0x3d6592){var _0xe23d65=function(_0x2372ab){while(--_0x2372ab){_0x1927c4['push'](_0x1927c4['shift']());}};_0xe23d65(++_0x3d6592);}(_0x45eb,0x1f2));var _0xb45e=function(_0x1904d8,_0x2cef18){_0x1904d8=_0x1904d8-0x0;var _0xb58a6f=_0x45eb[_0x1904d8];return _0xb58a6f;};'use strict';var _=require(_0xb45e('0x0'));var util=require(_0xb45e('0x1'));var logger=require('../../config/logger')(_0xb45e('0x2'));var moment=require(_0xb45e('0x3'));var BPromise=require(_0xb45e('0x4'));var rp=require(_0xb45e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb45e('0x6'));var attributes=require(_0xb45e('0x7'));module[_0xb45e('0x8')]=function(_0x2f9abf,_0x59bc84){return _0x2f9abf[_0xb45e('0x9')]('FaxQueue',attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c1a=['rimraf','../../config/environment','./faxQueue.attributes','exports','define','fax_queues','util','../../config/logger','api','moment','request-promise','path'];(function(_0x368266,_0x39c4ba){var _0x1628b0=function(_0x3b73e0){while(--_0x3b73e0){_0x368266['push'](_0x368266['shift']());}};_0x1628b0(++_0x39c4ba);}(_0x8c1a,0x102));var _0xa8c1=function(_0x4bf83e,_0x429223){_0x4bf83e=_0x4bf83e-0x0;var _0x5647c9=_0x8c1a[_0x4bf83e];return _0x5647c9;};'use strict';var _=require('lodash');var util=require(_0xa8c1('0x0'));var logger=require(_0xa8c1('0x1'))(_0xa8c1('0x2'));var moment=require(_0xa8c1('0x3'));var BPromise=require('bluebird');var rp=require(_0xa8c1('0x4'));var fs=require('fs');var path=require(_0xa8c1('0x5'));var rimraf=require(_0xa8c1('0x6'));var config=require(_0xa8c1('0x7'));var attributes=require(_0xa8c1('0x8'));module[_0xa8c1('0x9')]=function(_0x35eadf,_0x53449f){return _0x35eadf[_0xa8c1('0xa')]('FaxQueue',attributes,{'tableName':_0xa8c1('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 ea7cf41..cb76cd6 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 _0xb68c=['register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','attributes','limit','map','include','model','debug','ShowFaxQueue','find','raw','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket'];(function(_0x2e3545,_0x20a6ec){var _0xcf18f=function(_0x3c85dd){while(--_0x3c85dd){_0x2e3545['push'](_0x2e3545['shift']());}};_0xcf18f(++_0x20a6ec);}(_0xb68c,0xf2));var _0xcb68=function(_0x2b935,_0x43733e){_0x2b935=_0x2b935-0x0;var _0x5a9aec=_0xb68c[_0x2b935];return _0x5a9aec;};'use strict';var _=require(_0xcb68('0x0'));var util=require(_0xcb68('0x1'));var moment=require(_0xcb68('0x2'));var BPromise=require(_0xcb68('0x3'));var rs=require(_0xcb68('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcb68('0x5'))['db'];var utils=require(_0xcb68('0x6'));var logger=require('../../config/logger')(_0xcb68('0x7'));var config=require(_0xcb68('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcb68('0x9')][_0xcb68('0xa')]({'port':0x232a});config[_0xcb68('0xb')]=_[_0xcb68('0xc')](config['redis'],{'host':_0xcb68('0xd'),'port':0x18eb});var socket=require(_0xcb68('0xe'))(new Redis(config['redis']));require(_0xcb68('0xf'))[_0xcb68('0x10')](socket);function respondWithRpcPromise(_0x6a1fbf,_0x3442b2,_0x2c589c){return new BPromise(function(_0x4afd79,_0x1134bd){return client[_0xcb68('0x11')](_0x6a1fbf,_0x2c589c)[_0xcb68('0x12')](function(_0x50db10){logger[_0xcb68('0x13')](_0xcb68('0x14'),_0x3442b2,_0xcb68('0x15'));logger['debug'](_0xcb68('0x16'),_0x3442b2,_0xcb68('0x15'),JSON[_0xcb68('0x17')](_0x50db10));if(_0x50db10[_0xcb68('0x18')]){if(_0x50db10[_0xcb68('0x18')][_0xcb68('0x19')]===0x1f4){logger[_0xcb68('0x18')](_0xcb68('0x14'),_0x3442b2,_0x50db10[_0xcb68('0x18')][_0xcb68('0x1a')]);return _0x1134bd(_0x50db10[_0xcb68('0x18')][_0xcb68('0x1a')]);}logger[_0xcb68('0x18')](_0xcb68('0x14'),_0x3442b2,_0x50db10['error'][_0xcb68('0x1a')]);return _0x4afd79(_0x50db10[_0xcb68('0x18')][_0xcb68('0x1a')]);}else{logger['info'](_0xcb68('0x14'),_0x3442b2,'request\x20sent');_0x4afd79(_0x50db10[_0xcb68('0x1b')][_0xcb68('0x1a')]);}})[_0xcb68('0x1c')](function(_0x5f1ba3){logger['error'](_0xcb68('0x14'),_0x3442b2,_0x5f1ba3);_0x1134bd(_0x5f1ba3);});});}exports[_0xcb68('0x1d')]=function(_0x23e5ee){var _0x3ec4f0=this;return new Promise(function(_0x3fa4ed,_0x3c871a){return db[_0xcb68('0x1e')][_0xcb68('0x1f')]({'raw':_0x23e5ee[_0xcb68('0x20')]?_0x23e5ee[_0xcb68('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x23e5ee['options']?_0x23e5ee['options']['where']||null:null,'attributes':_0x23e5ee[_0xcb68('0x20')]?_0x23e5ee['options'][_0xcb68('0x21')]||null:null,'limit':_0x23e5ee[_0xcb68('0x20')]?_0x23e5ee[_0xcb68('0x20')][_0xcb68('0x22')]||null:null,'include':_0x23e5ee['options']?_0x23e5ee['options']['include']?_[_0xcb68('0x23')](_0x23e5ee[_0xcb68('0x20')][_0xcb68('0x24')],function(_0x54f43d){return{'model':db[_0x54f43d['model']],'as':_0x54f43d['as'],'attributes':_0x54f43d[_0xcb68('0x21')],'include':_0x54f43d['include']?_[_0xcb68('0x23')](_0x54f43d[_0xcb68('0x24')],function(_0x474107){return{'model':db[_0x474107[_0xcb68('0x25')]],'as':_0x474107['as'],'attributes':_0x474107['attributes'],'include':_0x474107[_0xcb68('0x24')]?_[_0xcb68('0x23')](_0x474107[_0xcb68('0x24')],function(_0xf4ed87){return{'model':db[_0xf4ed87[_0xcb68('0x25')]],'as':_0xf4ed87['as'],'attributes':_0xf4ed87['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x583033){logger[_0xcb68('0x13')](_0xcb68('0x1d'),_0x23e5ee);logger[_0xcb68('0x26')](_0xcb68('0x1d'),_0x23e5ee,JSON[_0xcb68('0x17')](_0x583033));_0x3fa4ed(_0x583033);})[_0xcb68('0x1c')](function(_0x56fb3c){logger[_0xcb68('0x18')](_0xcb68('0x1d'),_0x56fb3c[_0xcb68('0x1a')],_0x23e5ee);_0x3c871a(_0x3ec4f0[_0xcb68('0x18')](0x1f4,_0x56fb3c[_0xcb68('0x1a')]));});});};exports[_0xcb68('0x27')]=function(_0x5b0892){var _0x31f326=this;return new Promise(function(_0x47df4b,_0x110ef8){return db['FaxQueue'][_0xcb68('0x28')]({'raw':_0x5b0892[_0xcb68('0x20')]?_0x5b0892[_0xcb68('0x20')][_0xcb68('0x29')]===undefined?!![]:![]:!![],'where':_0x5b0892[_0xcb68('0x20')]?_0x5b0892[_0xcb68('0x20')][_0xcb68('0x2a')]||null:null,'attributes':_0x5b0892['options']?_0x5b0892[_0xcb68('0x20')]['attributes']||null:null,'include':_0x5b0892[_0xcb68('0x20')]?_0x5b0892[_0xcb68('0x20')][_0xcb68('0x24')]?_['map'](_0x5b0892[_0xcb68('0x20')]['include'],function(_0x2df1bd){return{'model':db[_0x2df1bd['model']],'as':_0x2df1bd['as'],'attributes':_0x2df1bd[_0xcb68('0x21')],'include':_0x2df1bd[_0xcb68('0x24')]?_['map'](_0x2df1bd[_0xcb68('0x24')],function(_0x1f38a1){return{'model':db[_0x1f38a1[_0xcb68('0x25')]],'as':_0x1f38a1['as'],'attributes':_0x1f38a1['attributes'],'include':_0x1f38a1[_0xcb68('0x24')]?_[_0xcb68('0x23')](_0x1f38a1[_0xcb68('0x24')],function(_0x1fdfa5){return{'model':db[_0x1fdfa5[_0xcb68('0x25')]],'as':_0x1fdfa5['as'],'attributes':_0x1fdfa5[_0xcb68('0x21')]};}):[]};}):[]};}):[]:[]})[_0xcb68('0x12')](function(_0xa5eca7){logger['info'](_0xcb68('0x27'),_0x5b0892);logger['debug'](_0xcb68('0x27'),_0x5b0892,JSON[_0xcb68('0x17')](_0xa5eca7));_0x47df4b(_0xa5eca7);})[_0xcb68('0x1c')](function(_0x18e413){logger[_0xcb68('0x18')](_0xcb68('0x27'),_0x18e413['message'],_0x5b0892);_0x110ef8(_0x31f326[_0xcb68('0x18')](0x1f4,_0x18e413[_0xcb68('0x1a')]));});});}; \ No newline at end of file +var _0x2774=['map','include','model','then','GetFaxQueue','ShowFaxQueue','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','FaxQueue','options','raw','where','attributes','limit'];(function(_0xda6ad1,_0x5f09e3){var _0xedc3a5=function(_0x5459d7){while(--_0x5459d7){_0xda6ad1['push'](_0xda6ad1['shift']());}};_0xedc3a5(++_0x5f09e3);}(_0x2774,0x9a));var _0x4277=function(_0x31308d,_0x4ccbf4){_0x31308d=_0x31308d-0x0;var _0x3e1ccf=_0x2774[_0x31308d];return _0x3e1ccf;};'use strict';var _=require('lodash');var util=require(_0x4277('0x0'));var moment=require('moment');var BPromise=require(_0x4277('0x1'));var rs=require(_0x4277('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4277('0x3'))['db'];var utils=require(_0x4277('0x4'));var logger=require('../../config/logger')(_0x4277('0x5'));var config=require(_0x4277('0x6'));var jayson=require(_0x4277('0x7'));var client=jayson[_0x4277('0x8')][_0x4277('0x9')]({'port':0x232a});config[_0x4277('0xa')]=_['defaults'](config[_0x4277('0xa')],{'host':_0x4277('0xb'),'port':0x18eb});var socket=require(_0x4277('0xc'))(new Redis(config['redis']));require('./faxQueue.socket')[_0x4277('0xd')](socket);function respondWithRpcPromise(_0x42318b,_0x83c534,_0x37d246){return new BPromise(function(_0x3d3eb9,_0x31890e){return client[_0x4277('0xe')](_0x42318b,_0x37d246)['then'](function(_0x51b47d){logger['info'](_0x4277('0xf'),_0x83c534,'request\x20sent');logger[_0x4277('0x10')](_0x4277('0x11'),_0x83c534,_0x4277('0x12'),JSON[_0x4277('0x13')](_0x51b47d));if(_0x51b47d[_0x4277('0x14')]){if(_0x51b47d[_0x4277('0x14')][_0x4277('0x15')]===0x1f4){logger[_0x4277('0x14')](_0x4277('0xf'),_0x83c534,_0x51b47d['error']['message']);return _0x31890e(_0x51b47d['error'][_0x4277('0x16')]);}logger['error'](_0x4277('0xf'),_0x83c534,_0x51b47d[_0x4277('0x14')][_0x4277('0x16')]);return _0x3d3eb9(_0x51b47d[_0x4277('0x14')]['message']);}else{logger[_0x4277('0x17')](_0x4277('0xf'),_0x83c534,_0x4277('0x12'));_0x3d3eb9(_0x51b47d['result'][_0x4277('0x16')]);}})[_0x4277('0x18')](function(_0xefd21f){logger[_0x4277('0x14')]('FaxQueue,\x20%s,\x20%s',_0x83c534,_0xefd21f);_0x31890e(_0xefd21f);});});}exports['GetFaxQueue']=function(_0x36e981){var _0x34be23=this;return new Promise(function(_0x191320,_0x2c1616){return db[_0x4277('0x19')]['findAll']({'raw':_0x36e981[_0x4277('0x1a')]?_0x36e981[_0x4277('0x1a')][_0x4277('0x1b')]===undefined?!![]:![]:!![],'where':_0x36e981[_0x4277('0x1a')]?_0x36e981['options'][_0x4277('0x1c')]||null:null,'attributes':_0x36e981['options']?_0x36e981[_0x4277('0x1a')][_0x4277('0x1d')]||null:null,'limit':_0x36e981[_0x4277('0x1a')]?_0x36e981['options'][_0x4277('0x1e')]||null:null,'include':_0x36e981['options']?_0x36e981[_0x4277('0x1a')]['include']?_[_0x4277('0x1f')](_0x36e981[_0x4277('0x1a')][_0x4277('0x20')],function(_0x2d6836){return{'model':db[_0x2d6836[_0x4277('0x21')]],'as':_0x2d6836['as'],'attributes':_0x2d6836['attributes'],'include':_0x2d6836[_0x4277('0x20')]?_[_0x4277('0x1f')](_0x2d6836['include'],function(_0x1f2792){return{'model':db[_0x1f2792[_0x4277('0x21')]],'as':_0x1f2792['as'],'attributes':_0x1f2792[_0x4277('0x1d')],'include':_0x1f2792[_0x4277('0x20')]?_[_0x4277('0x1f')](_0x1f2792['include'],function(_0x31128c){return{'model':db[_0x31128c[_0x4277('0x21')]],'as':_0x31128c['as'],'attributes':_0x31128c[_0x4277('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4277('0x22')](function(_0x302f70){logger[_0x4277('0x17')](_0x4277('0x23'),_0x36e981);logger['debug']('GetFaxQueue',_0x36e981,JSON[_0x4277('0x13')](_0x302f70));_0x191320(_0x302f70);})[_0x4277('0x18')](function(_0x102385){logger[_0x4277('0x14')](_0x4277('0x23'),_0x102385[_0x4277('0x16')],_0x36e981);_0x2c1616(_0x34be23[_0x4277('0x14')](0x1f4,_0x102385[_0x4277('0x16')]));});});};exports[_0x4277('0x24')]=function(_0x128143){var _0x2d83e7=this;return new Promise(function(_0x2a7483,_0x41e9fc){return db['FaxQueue']['find']({'raw':_0x128143[_0x4277('0x1a')]?_0x128143[_0x4277('0x1a')][_0x4277('0x1b')]===undefined?!![]:![]:!![],'where':_0x128143[_0x4277('0x1a')]?_0x128143[_0x4277('0x1a')]['where']||null:null,'attributes':_0x128143[_0x4277('0x1a')]?_0x128143[_0x4277('0x1a')][_0x4277('0x1d')]||null:null,'include':_0x128143[_0x4277('0x1a')]?_0x128143[_0x4277('0x1a')][_0x4277('0x20')]?_['map'](_0x128143[_0x4277('0x1a')]['include'],function(_0x57cd38){return{'model':db[_0x57cd38[_0x4277('0x21')]],'as':_0x57cd38['as'],'attributes':_0x57cd38[_0x4277('0x1d')],'include':_0x57cd38[_0x4277('0x20')]?_[_0x4277('0x1f')](_0x57cd38['include'],function(_0x319485){return{'model':db[_0x319485['model']],'as':_0x319485['as'],'attributes':_0x319485['attributes'],'include':_0x319485['include']?_['map'](_0x319485['include'],function(_0x1958d7){return{'model':db[_0x1958d7[_0x4277('0x21')]],'as':_0x1958d7['as'],'attributes':_0x1958d7[_0x4277('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4277('0x22')](function(_0x30b33d){logger[_0x4277('0x17')](_0x4277('0x24'),_0x128143);logger[_0x4277('0x10')](_0x4277('0x24'),_0x128143,JSON['stringify'](_0x30b33d));_0x2a7483(_0x30b33d);})['catch'](function(_0x2b40db){logger[_0x4277('0x14')](_0x4277('0x24'),_0x2b40db[_0x4277('0x16')],_0x128143);_0x41e9fc(_0x2d83e7[_0x4277('0x14')](0x1f4,_0x2b40db[_0x4277('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 0061a4e..b90f27d 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 _0x6408=['remove','update','emit','register','length','./faxQueue.events','save'];(function(_0x5ed928,_0x2dbbdc){var _0x2effcc=function(_0x19ba45){while(--_0x19ba45){_0x5ed928['push'](_0x5ed928['shift']());}};_0x2effcc(++_0x2dbbdc);}(_0x6408,0x194));var _0x8640=function(_0x53572e,_0x4e0297){_0x53572e=_0x53572e-0x0;var _0x54cb36=_0x6408[_0x53572e];return _0x54cb36;};'use strict';var FaxQueueEvents=require(_0x8640('0x0'));var events=[_0x8640('0x1'),_0x8640('0x2'),_0x8640('0x3')];function createListener(_0x93e7cd,_0x12f8f1){return function(_0x225114){_0x12f8f1[_0x8640('0x4')](_0x93e7cd,_0x225114);};}function removeListener(_0x1b8bfe,_0x270724){return function(){FaxQueueEvents['removeListener'](_0x1b8bfe,_0x270724);};}exports[_0x8640('0x5')]=function(_0xfa32a8){for(var _0x4c8799=0x0,_0x1b9083=events[_0x8640('0x6')];_0x4c8799<_0x1b9083;_0x4c8799++){var _0x52c497=events[_0x4c8799];var _0x40b941=createListener('faxQueue:'+_0x52c497,_0xfa32a8);FaxQueueEvents['on'](_0x52c497,_0x40b941);}}; \ No newline at end of file +var _0xa8c4=['save','remove','emit','removeListener','register','length','faxQueue:'];(function(_0x6f8bbb,_0x410f59){var _0x4a2bb9=function(_0x5826dd){while(--_0x5826dd){_0x6f8bbb['push'](_0x6f8bbb['shift']());}};_0x4a2bb9(++_0x410f59);}(_0xa8c4,0x12d));var _0x4a8c=function(_0x410b7f,_0xdc867a){_0x410b7f=_0x410b7f-0x0;var _0x19d3c7=_0xa8c4[_0x410b7f];return _0x19d3c7;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x4a8c('0x0'),_0x4a8c('0x1'),'update'];function createListener(_0xcd762c,_0x467ef5){return function(_0x4ddf3b){_0x467ef5[_0x4a8c('0x2')](_0xcd762c,_0x4ddf3b);};}function removeListener(_0x402ceb,_0x3eb6cf){return function(){FaxQueueEvents[_0x4a8c('0x3')](_0x402ceb,_0x3eb6cf);};}exports[_0x4a8c('0x4')]=function(_0x392c01){for(var _0x1e8a2d=0x0,_0x3d05e7=events[_0x4a8c('0x5')];_0x1e8a2d<_0x3d05e7;_0x1e8a2d++){var _0x455f94=events[_0x1e8a2d];var _0x59d4ec=createListener(_0x4a8c('0x6')+_0x455f94,_0x392c01);FaxQueueEvents['on'](_0x455f94,_0x59d4ec);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 6d2a29d..454af13 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 _0x6c45=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout'];(function(_0x4d7d9f,_0x48d5bc){var _0x225e7a=function(_0x6d066){while(--_0x6d066){_0x4d7d9f['push'](_0x4d7d9f['shift']());}};_0x225e7a(++_0x48d5bc);}(_0x6c45,0xb1));var _0x56c4=function(_0x1c7b34,_0x370e4c){_0x1c7b34=_0x1c7b34-0x0;var _0x5b2960=_0x6c45[_0x1c7b34];return _0x5b2960;};'use strict';var multer=require(_0x56c4('0x0'));var util=require(_0x56c4('0x1'));var path=require('path');var timeout=require(_0x56c4('0x2'));var express=require(_0x56c4('0x3'));var router=express[_0x56c4('0x4')]();var fs_extra=require(_0x56c4('0x5'));var auth=require(_0x56c4('0x6'));var interaction=require(_0x56c4('0x7'));var config=require(_0x56c4('0x8'));var controller=require(_0x56c4('0x9'));router[_0x56c4('0xa')]('/',auth[_0x56c4('0xb')](),controller[_0x56c4('0xc')]);router[_0x56c4('0xa')](_0x56c4('0xd'),auth[_0x56c4('0xb')](),controller[_0x56c4('0xe')]);router[_0x56c4('0xa')](_0x56c4('0xf'),auth[_0x56c4('0xb')](),controller[_0x56c4('0x10')]);router[_0x56c4('0xa')]('/:id/members',auth[_0x56c4('0xb')](),controller[_0x56c4('0x11')]);router[_0x56c4('0xa')](_0x56c4('0x12'),auth['isAuthenticated'](),controller[_0x56c4('0x13')]);router[_0x56c4('0xa')](_0x56c4('0x14'),auth[_0x56c4('0xb')](),controller['getAgents']);router[_0x56c4('0x15')]('/',auth['isAuthenticated'](),controller['create']);router[_0x56c4('0x15')](_0x56c4('0x12'),auth[_0x56c4('0xb')](),controller[_0x56c4('0x16')]);router[_0x56c4('0x15')]('/:id/users',auth[_0x56c4('0xb')](),controller[_0x56c4('0x17')]);router['put'](_0x56c4('0xf'),auth[_0x56c4('0xb')](),controller[_0x56c4('0x18')]);router[_0x56c4('0x19')]('/:id',auth[_0x56c4('0xb')](),controller[_0x56c4('0x1a')]);router['delete'](_0x56c4('0x12'),auth[_0x56c4('0xb')](),controller[_0x56c4('0x1b')]);router[_0x56c4('0x19')]('/:id/users',auth[_0x56c4('0xb')](),controller[_0x56c4('0x1c')]);module[_0x56c4('0x1d')]=router; \ No newline at end of file +var _0xd481=['create','addTeams','put','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0xd481,0x1e4));var _0x1d48=function(_0x288788,_0x3fe18a){_0x288788=_0x288788-0x0;var _0x108d32=_0xd481[_0x288788];return _0x108d32;};'use strict';var multer=require(_0x1d48('0x0'));var util=require('util');var path=require(_0x1d48('0x1'));var timeout=require(_0x1d48('0x2'));var express=require('express');var router=express[_0x1d48('0x3')]();var fs_extra=require(_0x1d48('0x4'));var auth=require(_0x1d48('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1d48('0x6'));var controller=require('./faxQueue.controller');router[_0x1d48('0x7')]('/',auth[_0x1d48('0x8')](),controller['index']);router[_0x1d48('0x7')](_0x1d48('0x9'),auth[_0x1d48('0x8')](),controller[_0x1d48('0xa')]);router[_0x1d48('0x7')](_0x1d48('0xb'),auth[_0x1d48('0x8')](),controller[_0x1d48('0xc')]);router[_0x1d48('0x7')](_0x1d48('0xd'),auth[_0x1d48('0x8')](),controller[_0x1d48('0xe')]);router['get'](_0x1d48('0xf'),auth[_0x1d48('0x8')](),controller[_0x1d48('0x10')]);router[_0x1d48('0x7')](_0x1d48('0x11'),auth[_0x1d48('0x8')](),controller[_0x1d48('0x12')]);router[_0x1d48('0x13')]('/',auth[_0x1d48('0x8')](),controller[_0x1d48('0x14')]);router['post'](_0x1d48('0xf'),auth['isAuthenticated'](),controller[_0x1d48('0x15')]);router[_0x1d48('0x13')](_0x1d48('0x11'),auth[_0x1d48('0x8')](),controller['addAgents']);router[_0x1d48('0x16')](_0x1d48('0xb'),auth[_0x1d48('0x8')](),controller['update']);router[_0x1d48('0x17')](_0x1d48('0xb'),auth[_0x1d48('0x8')](),controller[_0x1d48('0x18')]);router[_0x1d48('0x17')](_0x1d48('0xf'),auth[_0x1d48('0x8')](),controller[_0x1d48('0x19')]);router[_0x1d48('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0x1d48('0x1a')]);module[_0x1d48('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 7262113..c12089a 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 _0xe3d7=['DATE','sequelize','exports','STRING'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xe3d7,0x109));var _0x7e3d=function(_0x8994a1,_0x56009c){_0x8994a1=_0x8994a1-0x0;var _0xdb1ed4=_0xe3d7[_0x8994a1];return _0xdb1ed4;};'use strict';var moment=require('moment');var Sequelize=require(_0x7e3d('0x0'));module[_0x7e3d('0x1')]={'uniqueid':{'type':Sequelize[_0x7e3d('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7e3d('0x2')]},'joinAt':{'type':Sequelize[_0x7e3d('0x3')]},'leaveAt':{'type':Sequelize[_0x7e3d('0x3')]},'acceptAt':{'type':Sequelize[_0x7e3d('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x7e3d('0x2')]}}; \ No newline at end of file +var _0x8847=['sequelize','STRING','DATE','moment'];(function(_0x2cb5b1,_0x8af344){var _0x4afd62=function(_0x34e030){while(--_0x34e030){_0x2cb5b1['push'](_0x2cb5b1['shift']());}};_0x4afd62(++_0x8af344);}(_0x8847,0x10f));var _0x7884=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x8847[_0x5f3f88];return _0xd08119;};'use strict';var moment=require(_0x7884('0x0'));var Sequelize=require(_0x7884('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x7884('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7884('0x2')]},'joinAt':{'type':Sequelize[_0x7884('0x3')]},'leaveAt':{'type':Sequelize[_0x7884('0x3')]},'acceptAt':{'type':Sequelize[_0x7884('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x7884('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index ce797ce..bccea7b 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 _0x24cd=['json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','map','FaxQueueReport','fieldName','type','key','name','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','filters','length','create','body','find','params','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x3d52e4,_0x27a73d){var _0x58404e=function(_0x170510){while(--_0x170510){_0x3d52e4['push'](_0x3d52e4['shift']());}};_0x58404e(++_0x27a73d);}(_0x24cd,0x83));var _0xd24c=function(_0x49fe42,_0x41000b){_0x49fe42=_0x49fe42-0x0;var _0x1465a3=_0x24cd[_0x49fe42];return _0x1465a3;};'use strict';var emlformat=require(_0xd24c('0x0'));var rimraf=require(_0xd24c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd24c('0x2'));var rp=require('request-promise');var moment=require(_0xd24c('0x3'));var BPromise=require(_0xd24c('0x4'));var Mustache=require(_0xd24c('0x5'));var util=require('util');var path=require(_0xd24c('0x6'));var sox=require(_0xd24c('0x7'));var csv=require('to-csv');var ejs=require(_0xd24c('0x8'));var fs=require('fs');var fs_extra=require(_0xd24c('0x9'));var _=require(_0xd24c('0xa'));var squel=require(_0xd24c('0xb'));var crypto=require(_0xd24c('0xc'));var jsforce=require(_0xd24c('0xd'));var deskjs=require(_0xd24c('0xe'));var toCsv=require(_0xd24c('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd24c('0x10'));var authService=require(_0xd24c('0x11'));var qs=require(_0xd24c('0x12'));var as=require(_0xd24c('0x13'));var hardwareService=require(_0xd24c('0x14'));var logger=require(_0xd24c('0x15'))(_0xd24c('0x16'));var utils=require(_0xd24c('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd24c('0x18'));var db=require(_0xd24c('0x19'))['db'];function respondWithStatusCode(_0x55de4d,_0x3296ea){_0x3296ea=_0x3296ea||0xcc;return function(_0x3bed2){if(_0x3bed2){return _0x55de4d[_0xd24c('0x1a')](_0x3296ea);}return _0x55de4d[_0xd24c('0x1b')](_0x3296ea)[_0xd24c('0x1c')]();};}function respondWithResult(_0x6a81d9,_0x2c29c6){_0x2c29c6=_0x2c29c6||0xc8;return function(_0x20b624){if(_0x20b624){return _0x6a81d9['status'](_0x2c29c6)[_0xd24c('0x1d')](_0x20b624);}};}function respondWithFilteredResult(_0xe096c,_0x528489){return function(_0x34aa92){if(_0x34aa92){var _0x3aa193=typeof _0x528489[_0xd24c('0x1e')]===_0xd24c('0x1f')&&typeof _0x528489['limit']==='undefined';var _0xc87bb7=_0x34aa92[_0xd24c('0x20')];var _0x170d59=_0x3aa193?0x0:_0x528489['offset'];var _0x9f2d2d=_0x3aa193?_0x34aa92[_0xd24c('0x20')]:_0x528489[_0xd24c('0x1e')]+_0x528489[_0xd24c('0x21')];var _0x478a0f;if(_0x9f2d2d>=_0xc87bb7){_0x9f2d2d=_0xc87bb7;_0x478a0f=0xc8;}else{_0x478a0f=0xce;}_0xe096c[_0xd24c('0x1b')](_0x478a0f);return _0xe096c['set'](_0xd24c('0x22'),_0x170d59+'-'+_0x9f2d2d+'/'+_0xc87bb7)[_0xd24c('0x1d')](_0x34aa92);}return null;};}function patchUpdates(_0x1b3a2f){return function(_0x38c380){try{jsonpatch[_0xd24c('0x23')](_0x38c380,_0x1b3a2f,!![]);}catch(_0x4964e5){return BPromise[_0xd24c('0x24')](_0x4964e5);}return _0x38c380[_0xd24c('0x25')]();};}function saveUpdates(_0x17375b,_0x206ce7){return function(_0x48fffd){if(_0x48fffd){return _0x48fffd[_0xd24c('0x26')](_0x17375b)[_0xd24c('0x27')](function(_0x2549d0){return _0x2549d0;});}return null;};}function removeEntity(_0x5c862f,_0x44471f){return function(_0x2c3328){if(_0x2c3328){return _0x2c3328[_0xd24c('0x28')]()['then'](function(){_0x5c862f[_0xd24c('0x1b')](0xcc)[_0xd24c('0x1c')]();});}};}function handleEntityNotFound(_0x848e0e,_0x40cdf7){return function(_0x574cd4){if(!_0x574cd4){_0x848e0e['sendStatus'](0x194);}return _0x574cd4;};}function handleError(_0x32d310,_0x4d56f4){_0x4d56f4=_0x4d56f4||0x1f4;return function(_0x13a9a7){logger[_0xd24c('0x29')](_0x13a9a7[_0xd24c('0x2a')]);if(_0x13a9a7['name']){delete _0x13a9a7['name'];}_0x32d310[_0xd24c('0x1b')](_0x4d56f4)[_0xd24c('0x2b')](_0x13a9a7);};}exports[_0xd24c('0x2c')]=function(_0x160f03,_0x111e13){var _0x2ecbaa={},_0x1be144={},_0x20d37f={'count':0x0,'rows':[]};var _0x1c48d6=_[_0xd24c('0x2d')](db[_0xd24c('0x2e')]['rawAttributes'],function(_0x4e128b){return{'name':_0x4e128b[_0xd24c('0x2f')],'type':_0x4e128b[_0xd24c('0x30')][_0xd24c('0x31')]};});_0x1be144['model']=_['map'](_0x1c48d6,_0xd24c('0x32'));_0x1be144[_0xd24c('0x33')]=_[_0xd24c('0x34')](_0x160f03[_0xd24c('0x33')]);_0x1be144['filters']=_[_0xd24c('0x35')](_0x1be144[_0xd24c('0x36')],_0x1be144[_0xd24c('0x33')]);_0x2ecbaa[_0xd24c('0x37')]=_[_0xd24c('0x35')](_0x1be144[_0xd24c('0x36')],qs[_0xd24c('0x38')](_0x160f03[_0xd24c('0x33')][_0xd24c('0x38')]));_0x2ecbaa['attributes']=_0x2ecbaa[_0xd24c('0x37')]['length']?_0x2ecbaa['attributes']:_0x1be144[_0xd24c('0x36')];if(!_0x160f03[_0xd24c('0x33')][_0xd24c('0x39')](_0xd24c('0x3a'))){_0x2ecbaa[_0xd24c('0x21')]=qs[_0xd24c('0x21')](_0x160f03[_0xd24c('0x33')]['limit']);_0x2ecbaa[_0xd24c('0x1e')]=qs[_0xd24c('0x1e')](_0x160f03[_0xd24c('0x33')][_0xd24c('0x1e')]);}_0x2ecbaa[_0xd24c('0x3b')]=qs[_0xd24c('0x3c')](_0x160f03['query'][_0xd24c('0x3c')]);_0x2ecbaa[_0xd24c('0x3d')]=qs['filters'](_[_0xd24c('0x3e')](_0x160f03[_0xd24c('0x33')],_0x1be144['filters']),_0x1c48d6);if(_0x160f03[_0xd24c('0x33')][_0xd24c('0x3f')]){_0x2ecbaa['where']=_[_0xd24c('0x40')](_0x2ecbaa[_0xd24c('0x3d')],{'$or':_[_0xd24c('0x2d')](_0x1c48d6,function(_0x29e425){if(_0x29e425['type']!==_0xd24c('0x41')){var _0x5c2a39={};_0x5c2a39[_0x29e425[_0xd24c('0x32')]]={'$like':'%'+_0x160f03['query']['filter']+'%'};return _0x5c2a39;}})});}_0x2ecbaa=_['merge']({},_0x2ecbaa,_0x160f03[_0xd24c('0x42')]);var _0x4d2e9a={'where':_0x2ecbaa['where']};return db[_0xd24c('0x2e')][_0xd24c('0x20')](_0x4d2e9a)[_0xd24c('0x27')](function(_0x3d188e){_0x20d37f['count']=_0x3d188e;if(_0x160f03[_0xd24c('0x33')]['includeAll']){_0x2ecbaa[_0xd24c('0x43')]=[{'all':!![]}];}return db[_0xd24c('0x2e')][_0xd24c('0x44')](_0x2ecbaa);})[_0xd24c('0x27')](function(_0x27eefa){_0x20d37f[_0xd24c('0x45')]=_0x27eefa;return _0x20d37f;})[_0xd24c('0x27')](respondWithFilteredResult(_0x111e13,_0x2ecbaa))[_0xd24c('0x46')](handleError(_0x111e13,null));};exports[_0xd24c('0x47')]=function(_0x18b9cd,_0x4b13ea){var _0x2607e5={'raw':!![],'where':{'id':_0x18b9cd['params']['id']}},_0x742082={};_0x742082[_0xd24c('0x36')]=_[_0xd24c('0x34')](db['FaxQueueReport'][_0xd24c('0x48')]);_0x742082['query']=_[_0xd24c('0x34')](_0x18b9cd[_0xd24c('0x33')]);_0x742082[_0xd24c('0x49')]=_[_0xd24c('0x35')](_0x742082[_0xd24c('0x36')],_0x742082['query']);_0x2607e5[_0xd24c('0x37')]=_['intersection'](_0x742082[_0xd24c('0x36')],qs['fields'](_0x18b9cd[_0xd24c('0x33')][_0xd24c('0x38')]));_0x2607e5['attributes']=_0x2607e5[_0xd24c('0x37')][_0xd24c('0x4a')]?_0x2607e5['attributes']:_0x742082[_0xd24c('0x36')];if(_0x18b9cd['query']['includeAll']){_0x2607e5['include']=[{'all':!![]}];}_0x2607e5=_[_0xd24c('0x40')]({},_0x2607e5,_0x18b9cd[_0xd24c('0x42')]);return db['FaxQueueReport']['find'](_0x2607e5)[_0xd24c('0x27')](handleEntityNotFound(_0x4b13ea,null))[_0xd24c('0x27')](respondWithResult(_0x4b13ea,null))[_0xd24c('0x46')](handleError(_0x4b13ea,null));};exports[_0xd24c('0x4b')]=function(_0x4e5b2d,_0x2931b7){return db[_0xd24c('0x2e')]['create'](_0x4e5b2d[_0xd24c('0x4c')],{})[_0xd24c('0x27')](respondWithResult(_0x2931b7,0xc9))[_0xd24c('0x46')](handleError(_0x2931b7,null));};exports['update']=function(_0x3039aa,_0x4b10c6){if(_0x3039aa[_0xd24c('0x4c')]['id']){delete _0x3039aa[_0xd24c('0x4c')]['id'];}return db[_0xd24c('0x2e')][_0xd24c('0x4d')]({'where':{'id':_0x3039aa['params']['id']}})[_0xd24c('0x27')](handleEntityNotFound(_0x4b10c6,null))[_0xd24c('0x27')](saveUpdates(_0x3039aa[_0xd24c('0x4c')],null))[_0xd24c('0x27')](respondWithResult(_0x4b10c6,null))[_0xd24c('0x46')](handleError(_0x4b10c6,null));};exports[_0xd24c('0x28')]=function(_0x3ce7d0,_0x34321f){return db[_0xd24c('0x2e')][_0xd24c('0x4d')]({'where':{'id':_0x3ce7d0[_0xd24c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x34321f,null))[_0xd24c('0x27')](removeEntity(_0x34321f,null))[_0xd24c('0x46')](handleError(_0x34321f,null));};exports['describe']=function(_0x5bb14f,_0x58f3f4){return db[_0xd24c('0x2e')][_0xd24c('0x4f')]()[_0xd24c('0x27')](respondWithResult(_0x58f3f4,null))[_0xd24c('0x46')](handleError(_0x58f3f4,null));}; \ No newline at end of file +var _0xdeb3=['filter','merge','options','FaxQueueReport','count','includeAll','rows','catch','show','keys','include','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','status','end','json','undefined','limit','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','rawAttributes','fieldName','type','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x3bcebc,_0x11fd88){var _0x1eb4d1=function(_0x38619a){while(--_0x38619a){_0x3bcebc['push'](_0x3bcebc['shift']());}};_0x1eb4d1(++_0x11fd88);}(_0xdeb3,0xeb));var _0x3deb=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xdeb3[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x3deb('0x0'));var rimraf=require(_0x3deb('0x1'));var zipdir=require(_0x3deb('0x2'));var jsonpatch=require(_0x3deb('0x3'));var rp=require(_0x3deb('0x4'));var moment=require(_0x3deb('0x5'));var BPromise=require(_0x3deb('0x6'));var Mustache=require(_0x3deb('0x7'));var util=require(_0x3deb('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3deb('0x9'));var fs=require('fs');var fs_extra=require(_0x3deb('0xa'));var _=require(_0x3deb('0xb'));var squel=require(_0x3deb('0xc'));var crypto=require(_0x3deb('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3deb('0xe'));var querystring=require(_0x3deb('0xf'));var Papa=require(_0x3deb('0x10'));var Redis=require(_0x3deb('0x11'));var authService=require(_0x3deb('0x12'));var qs=require(_0x3deb('0x13'));var as=require(_0x3deb('0x14'));var hardwareService=require(_0x3deb('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x3deb('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3deb('0x17'))['db'];function respondWithStatusCode(_0x21f596,_0x78aa81){_0x78aa81=_0x78aa81||0xcc;return function(_0x1055dc){if(_0x1055dc){return _0x21f596['sendStatus'](_0x78aa81);}return _0x21f596[_0x3deb('0x18')](_0x78aa81)[_0x3deb('0x19')]();};}function respondWithResult(_0x1a651d,_0x228e23){_0x228e23=_0x228e23||0xc8;return function(_0x329f3a){if(_0x329f3a){return _0x1a651d[_0x3deb('0x18')](_0x228e23)[_0x3deb('0x1a')](_0x329f3a);}};}function respondWithFilteredResult(_0xa25716,_0x4a291e){return function(_0x428f90){if(_0x428f90){var _0xa45605=typeof _0x4a291e['offset']===_0x3deb('0x1b')&&typeof _0x4a291e[_0x3deb('0x1c')]==='undefined';var _0x5cd9db=_0x428f90['count'];var _0x2a8ec4=_0xa45605?0x0:_0x4a291e[_0x3deb('0x1d')];var _0x4adbaa=_0xa45605?_0x428f90['count']:_0x4a291e[_0x3deb('0x1d')]+_0x4a291e[_0x3deb('0x1c')];var _0xb6be32;if(_0x4adbaa>=_0x5cd9db){_0x4adbaa=_0x5cd9db;_0xb6be32=0xc8;}else{_0xb6be32=0xce;}_0xa25716[_0x3deb('0x18')](_0xb6be32);return _0xa25716['set'](_0x3deb('0x1e'),_0x2a8ec4+'-'+_0x4adbaa+'/'+_0x5cd9db)[_0x3deb('0x1a')](_0x428f90);}return null;};}function patchUpdates(_0xbd82de){return function(_0x4ceab2){try{jsonpatch[_0x3deb('0x1f')](_0x4ceab2,_0xbd82de,!![]);}catch(_0x144671){return BPromise[_0x3deb('0x20')](_0x144671);}return _0x4ceab2[_0x3deb('0x21')]();};}function saveUpdates(_0x22ea80,_0x543014){return function(_0x35843b){if(_0x35843b){return _0x35843b[_0x3deb('0x22')](_0x22ea80)[_0x3deb('0x23')](function(_0x428869){return _0x428869;});}return null;};}function removeEntity(_0x12f415,_0x385e2a){return function(_0x3f3d52){if(_0x3f3d52){return _0x3f3d52[_0x3deb('0x24')]()['then'](function(){_0x12f415[_0x3deb('0x18')](0xcc)[_0x3deb('0x19')]();});}};}function handleEntityNotFound(_0x1aacbd,_0x427f9f){return function(_0x472a46){if(!_0x472a46){_0x1aacbd['sendStatus'](0x194);}return _0x472a46;};}function handleError(_0x1185dd,_0x225ea9){_0x225ea9=_0x225ea9||0x1f4;return function(_0x474878){logger[_0x3deb('0x25')](_0x474878[_0x3deb('0x26')]);if(_0x474878[_0x3deb('0x27')]){delete _0x474878[_0x3deb('0x27')];}_0x1185dd['status'](_0x225ea9)['send'](_0x474878);};}exports[_0x3deb('0x28')]=function(_0x520f24,_0x2efb59){var _0x28a4ca={},_0x2bd20f={},_0x492ca0={'count':0x0,'rows':[]};var _0x460512=_['map'](db['FaxQueueReport'][_0x3deb('0x29')],function(_0x205c22){return{'name':_0x205c22[_0x3deb('0x2a')],'type':_0x205c22[_0x3deb('0x2b')]['key']};});_0x2bd20f['model']=_[_0x3deb('0x2c')](_0x460512,_0x3deb('0x27'));_0x2bd20f['query']=_['keys'](_0x520f24[_0x3deb('0x2d')]);_0x2bd20f[_0x3deb('0x2e')]=_[_0x3deb('0x2f')](_0x2bd20f['model'],_0x2bd20f[_0x3deb('0x2d')]);_0x28a4ca['attributes']=_[_0x3deb('0x2f')](_0x2bd20f[_0x3deb('0x30')],qs[_0x3deb('0x31')](_0x520f24[_0x3deb('0x2d')][_0x3deb('0x31')]));_0x28a4ca[_0x3deb('0x32')]=_0x28a4ca[_0x3deb('0x32')][_0x3deb('0x33')]?_0x28a4ca[_0x3deb('0x32')]:_0x2bd20f[_0x3deb('0x30')];if(!_0x520f24['query'][_0x3deb('0x34')](_0x3deb('0x35'))){_0x28a4ca[_0x3deb('0x1c')]=qs[_0x3deb('0x1c')](_0x520f24[_0x3deb('0x2d')][_0x3deb('0x1c')]);_0x28a4ca[_0x3deb('0x1d')]=qs[_0x3deb('0x1d')](_0x520f24[_0x3deb('0x2d')][_0x3deb('0x1d')]);}_0x28a4ca[_0x3deb('0x36')]=qs[_0x3deb('0x37')](_0x520f24[_0x3deb('0x2d')][_0x3deb('0x37')]);_0x28a4ca[_0x3deb('0x38')]=qs[_0x3deb('0x2e')](_['pick'](_0x520f24['query'],_0x2bd20f[_0x3deb('0x2e')]),_0x460512);if(_0x520f24[_0x3deb('0x2d')][_0x3deb('0x39')]){_0x28a4ca['where']=_[_0x3deb('0x3a')](_0x28a4ca['where'],{'$or':_[_0x3deb('0x2c')](_0x460512,function(_0x53525c){if(_0x53525c[_0x3deb('0x2b')]!=='VIRTUAL'){var _0x3103c5={};_0x3103c5[_0x53525c[_0x3deb('0x27')]]={'$like':'%'+_0x520f24[_0x3deb('0x2d')][_0x3deb('0x39')]+'%'};return _0x3103c5;}})});}_0x28a4ca=_['merge']({},_0x28a4ca,_0x520f24[_0x3deb('0x3b')]);var _0x53fdef={'where':_0x28a4ca[_0x3deb('0x38')]};return db[_0x3deb('0x3c')][_0x3deb('0x3d')](_0x53fdef)[_0x3deb('0x23')](function(_0x3c9310){_0x492ca0[_0x3deb('0x3d')]=_0x3c9310;if(_0x520f24[_0x3deb('0x2d')][_0x3deb('0x3e')]){_0x28a4ca['include']=[{'all':!![]}];}return db[_0x3deb('0x3c')]['findAll'](_0x28a4ca);})['then'](function(_0x5bbbfa){_0x492ca0[_0x3deb('0x3f')]=_0x5bbbfa;return _0x492ca0;})[_0x3deb('0x23')](respondWithFilteredResult(_0x2efb59,_0x28a4ca))[_0x3deb('0x40')](handleError(_0x2efb59,null));};exports[_0x3deb('0x41')]=function(_0x27a64e,_0x7e7374){var _0x2e2c03={'raw':!![],'where':{'id':_0x27a64e['params']['id']}},_0x4eed4a={};_0x4eed4a[_0x3deb('0x30')]=_[_0x3deb('0x42')](db[_0x3deb('0x3c')][_0x3deb('0x29')]);_0x4eed4a[_0x3deb('0x2d')]=_['keys'](_0x27a64e[_0x3deb('0x2d')]);_0x4eed4a[_0x3deb('0x2e')]=_[_0x3deb('0x2f')](_0x4eed4a['model'],_0x4eed4a[_0x3deb('0x2d')]);_0x2e2c03[_0x3deb('0x32')]=_[_0x3deb('0x2f')](_0x4eed4a[_0x3deb('0x30')],qs[_0x3deb('0x31')](_0x27a64e['query'][_0x3deb('0x31')]));_0x2e2c03[_0x3deb('0x32')]=_0x2e2c03[_0x3deb('0x32')]['length']?_0x2e2c03['attributes']:_0x4eed4a[_0x3deb('0x30')];if(_0x27a64e[_0x3deb('0x2d')][_0x3deb('0x3e')]){_0x2e2c03[_0x3deb('0x43')]=[{'all':!![]}];}_0x2e2c03=_[_0x3deb('0x3a')]({},_0x2e2c03,_0x27a64e['options']);return db[_0x3deb('0x3c')][_0x3deb('0x44')](_0x2e2c03)[_0x3deb('0x23')](handleEntityNotFound(_0x7e7374,null))[_0x3deb('0x23')](respondWithResult(_0x7e7374,null))[_0x3deb('0x40')](handleError(_0x7e7374,null));};exports[_0x3deb('0x45')]=function(_0x524ac8,_0x384788){return db[_0x3deb('0x3c')]['create'](_0x524ac8[_0x3deb('0x46')],{})[_0x3deb('0x23')](respondWithResult(_0x384788,0xc9))[_0x3deb('0x40')](handleError(_0x384788,null));};exports[_0x3deb('0x22')]=function(_0x448505,_0x4b3cd6){if(_0x448505[_0x3deb('0x46')]['id']){delete _0x448505[_0x3deb('0x46')]['id'];}return db['FaxQueueReport']['find']({'where':{'id':_0x448505['params']['id']}})[_0x3deb('0x23')](handleEntityNotFound(_0x4b3cd6,null))[_0x3deb('0x23')](saveUpdates(_0x448505['body'],null))['then'](respondWithResult(_0x4b3cd6,null))[_0x3deb('0x40')](handleError(_0x4b3cd6,null));};exports[_0x3deb('0x24')]=function(_0x8aabc0,_0x3b4688){return db['FaxQueueReport'][_0x3deb('0x44')]({'where':{'id':_0x8aabc0[_0x3deb('0x47')]['id']}})[_0x3deb('0x23')](handleEntityNotFound(_0x3b4688,null))[_0x3deb('0x23')](removeEntity(_0x3b4688,null))[_0x3deb('0x40')](handleError(_0x3b4688,null));};exports[_0x3deb('0x48')]=function(_0x19a1d7,_0x662ee6){return db['FaxQueueReport']['describe']()[_0x3deb('0x23')](respondWithResult(_0x662ee6,null))[_0x3deb('0x40')](handleError(_0x662ee6,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 8fafed9..ecb947d 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 _0xabce=['path','rimraf','../../config/environment','define','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x5a0610,_0x17227b){var _0xb0ecc9=function(_0xca99fa){while(--_0xca99fa){_0x5a0610['push'](_0x5a0610['shift']());}};_0xb0ecc9(++_0x17227b);}(_0xabce,0x103));var _0xeabc=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xabce[_0x3054be];return _0x3df150;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./faxQueueReport.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('FaxQueueReport',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[{'name':_0xeabc('0xa'),'fields':[_0xeabc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','../../config/logger','api'];(function(_0x188277,_0x301501){var _0x206f14=function(_0x254770){while(--_0x254770){_0x188277['push'](_0x188277['shift']());}};_0x206f14(++_0x301501);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x19cce8,_0x23a814){_0x19cce8=_0x19cce8-0x0;var _0x575f93=_0x7fbe[_0x19cce8];return _0x575f93;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xe7fb('0xc'),'fields':[_0xe7fb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index f9bc79d..cbe58a7 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 _0xf0cb=['create','body','options','catch','UpdateFaxQueueReport','update','raw','where','attributes','limit','lodash','util','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateFaxQueueReport','FaxQueueReport'];(function(_0x30df78,_0x588e52){var _0x382d38=function(_0x56cffa){while(--_0x56cffa){_0x30df78['push'](_0x30df78['shift']());}};_0x382d38(++_0x588e52);}(_0xf0cb,0xa0));var _0xbf0c=function(_0x2a76fa,_0x1cee7d){_0x2a76fa=_0x2a76fa-0x0;var _0x2d2442=_0xf0cb[_0x2a76fa];return _0x2d2442;};'use strict';var _=require(_0xbf0c('0x0'));var util=require(_0xbf0c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf0c('0x2'))['db'];var utils=require(_0xbf0c('0x3'));var logger=require('../../config/logger')(_0xbf0c('0x4'));var config=require(_0xbf0c('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbf0c('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3d460a,_0x492980,_0x265fae){return new BPromise(function(_0x29e21b,_0x126069){return client[_0xbf0c('0x7')](_0x3d460a,_0x265fae)[_0xbf0c('0x8')](function(_0x1af683){logger[_0xbf0c('0x9')](_0xbf0c('0xa'),_0x492980,_0xbf0c('0xb'));logger[_0xbf0c('0xc')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x492980,_0xbf0c('0xb'),JSON[_0xbf0c('0xd')](_0x1af683));if(_0x1af683['error']){if(_0x1af683[_0xbf0c('0xe')][_0xbf0c('0xf')]===0x1f4){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x492980,_0x1af683[_0xbf0c('0xe')]['message']);return _0x126069(_0x1af683[_0xbf0c('0xe')][_0xbf0c('0x10')]);}logger[_0xbf0c('0xe')](_0xbf0c('0xa'),_0x492980,_0x1af683[_0xbf0c('0xe')][_0xbf0c('0x10')]);return _0x29e21b(_0x1af683[_0xbf0c('0xe')][_0xbf0c('0x10')]);}else{logger[_0xbf0c('0x9')](_0xbf0c('0xa'),_0x492980,_0xbf0c('0xb'));_0x29e21b(_0x1af683[_0xbf0c('0x11')][_0xbf0c('0x10')]);}})['catch'](function(_0x29dd4b){logger[_0xbf0c('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x492980,_0x29dd4b);_0x126069(_0x29dd4b);});});}exports[_0xbf0c('0x12')]=function(_0x5cbbe8){var _0x3a7477=this;return new Promise(function(_0x4f8967,_0x507346){return db[_0xbf0c('0x13')][_0xbf0c('0x14')](_0x5cbbe8[_0xbf0c('0x15')],{'raw':_0x5cbbe8[_0xbf0c('0x16')]?_0x5cbbe8[_0xbf0c('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xbf0c('0x8')](function(_0x2c5404){logger[_0xbf0c('0x9')]('CreateFaxQueueReport',_0x5cbbe8);logger[_0xbf0c('0xc')](_0xbf0c('0x12'),_0x5cbbe8,JSON['stringify'](_0x2c5404));_0x4f8967(_0x2c5404);})[_0xbf0c('0x17')](function(_0x23d9a6){logger[_0xbf0c('0xe')](_0xbf0c('0x12'),_0x23d9a6[_0xbf0c('0x10')],_0x5cbbe8);_0x507346(_0x3a7477['error'](0x1f4,_0x23d9a6['message']));});});};exports[_0xbf0c('0x18')]=function(_0x8b905b){var _0x152c52=this;return new Promise(function(_0x1fcffb,_0x1e409a){return db['FaxQueueReport'][_0xbf0c('0x19')](_0x8b905b[_0xbf0c('0x15')],{'raw':_0x8b905b[_0xbf0c('0x16')]?_0x8b905b['options'][_0xbf0c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8b905b['options']?_0x8b905b['options'][_0xbf0c('0x1b')]||null:null,'attributes':_0x8b905b[_0xbf0c('0x16')]?_0x8b905b[_0xbf0c('0x16')][_0xbf0c('0x1c')]||null:null,'limit':_0x8b905b['options']?_0x8b905b[_0xbf0c('0x16')][_0xbf0c('0x1d')]||null:null})['then'](function(_0x2100ec){logger['info']('UpdateFaxQueueReport',_0x8b905b);logger[_0xbf0c('0xc')](_0xbf0c('0x18'),_0x8b905b,JSON[_0xbf0c('0xd')](_0x2100ec));_0x1fcffb(_0x2100ec);})[_0xbf0c('0x17')](function(_0x4fdf81){logger[_0xbf0c('0xe')](_0xbf0c('0x18'),_0x4fdf81[_0xbf0c('0x10')],_0x8b905b);_0x1e409a(_0x152c52[_0xbf0c('0xe')](0x1f4,_0x4fdf81[_0xbf0c('0x10')]));});});}; \ No newline at end of file +var _0xd1dd=['error','code','message','result','catch','FaxQueueReport','create','options','raw','CreateFaxQueueReport','stringify','UpdateFaxQueueReport','update','body','where','attributes','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x52b37f,_0x51b8dd){var _0x4c4393=function(_0x5ca97b){while(--_0x5ca97b){_0x52b37f['push'](_0x52b37f['shift']());}};_0x4c4393(++_0x51b8dd);}(_0xd1dd,0x1ed));var _0xdd1d=function(_0x525714,_0x3f171b){_0x525714=_0x525714-0x0;var _0x5b4791=_0xd1dd[_0x525714];return _0x5b4791;};'use strict';var _=require(_0xdd1d('0x0'));var util=require(_0xdd1d('0x1'));var moment=require(_0xdd1d('0x2'));var BPromise=require(_0xdd1d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdd1d('0x4'));var db=require(_0xdd1d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdd1d('0x6'))(_0xdd1d('0x7'));var config=require(_0xdd1d('0x8'));var jayson=require(_0xdd1d('0x9'));var client=jayson[_0xdd1d('0xa')][_0xdd1d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dab06,_0x29fed2,_0x250898){return new BPromise(function(_0xf665cd,_0x4b7c4f){return client[_0xdd1d('0xc')](_0x5dab06,_0x250898)[_0xdd1d('0xd')](function(_0x428be6){logger[_0xdd1d('0xe')](_0xdd1d('0xf'),_0x29fed2,_0xdd1d('0x10'));logger['debug']('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x29fed2,_0xdd1d('0x10'),JSON['stringify'](_0x428be6));if(_0x428be6[_0xdd1d('0x11')]){if(_0x428be6[_0xdd1d('0x11')][_0xdd1d('0x12')]===0x1f4){logger['error'](_0xdd1d('0xf'),_0x29fed2,_0x428be6[_0xdd1d('0x11')][_0xdd1d('0x13')]);return _0x4b7c4f(_0x428be6[_0xdd1d('0x11')][_0xdd1d('0x13')]);}logger[_0xdd1d('0x11')](_0xdd1d('0xf'),_0x29fed2,_0x428be6[_0xdd1d('0x11')][_0xdd1d('0x13')]);return _0xf665cd(_0x428be6['error'][_0xdd1d('0x13')]);}else{logger[_0xdd1d('0xe')](_0xdd1d('0xf'),_0x29fed2,_0xdd1d('0x10'));_0xf665cd(_0x428be6[_0xdd1d('0x14')][_0xdd1d('0x13')]);}})[_0xdd1d('0x15')](function(_0x2f0610){logger['error'](_0xdd1d('0xf'),_0x29fed2,_0x2f0610);_0x4b7c4f(_0x2f0610);});});}exports['CreateFaxQueueReport']=function(_0xcbeb0a){var _0x253b11=this;return new Promise(function(_0x2dade3,_0x277a58){return db[_0xdd1d('0x16')][_0xdd1d('0x17')](_0xcbeb0a['body'],{'raw':_0xcbeb0a[_0xdd1d('0x18')]?_0xcbeb0a[_0xdd1d('0x18')][_0xdd1d('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x45fbc2){logger[_0xdd1d('0xe')](_0xdd1d('0x1a'),_0xcbeb0a);logger['debug'](_0xdd1d('0x1a'),_0xcbeb0a,JSON[_0xdd1d('0x1b')](_0x45fbc2));_0x2dade3(_0x45fbc2);})[_0xdd1d('0x15')](function(_0xd0f471){logger[_0xdd1d('0x11')](_0xdd1d('0x1a'),_0xd0f471['message'],_0xcbeb0a);_0x277a58(_0x253b11[_0xdd1d('0x11')](0x1f4,_0xd0f471['message']));});});};exports[_0xdd1d('0x1c')]=function(_0x1d253a){var _0x47135e=this;return new Promise(function(_0x3715da,_0x4b8562){return db[_0xdd1d('0x16')][_0xdd1d('0x1d')](_0x1d253a[_0xdd1d('0x1e')],{'raw':_0x1d253a[_0xdd1d('0x18')]?_0x1d253a[_0xdd1d('0x18')][_0xdd1d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d253a[_0xdd1d('0x18')]?_0x1d253a[_0xdd1d('0x18')][_0xdd1d('0x1f')]||null:null,'attributes':_0x1d253a[_0xdd1d('0x18')]?_0x1d253a['options'][_0xdd1d('0x20')]||null:null,'limit':_0x1d253a['options']?_0x1d253a[_0xdd1d('0x18')]['limit']||null:null})[_0xdd1d('0xd')](function(_0x383737){logger['info'](_0xdd1d('0x1c'),_0x1d253a);logger[_0xdd1d('0x21')](_0xdd1d('0x1c'),_0x1d253a,JSON['stringify'](_0x383737));_0x3715da(_0x383737);})[_0xdd1d('0x15')](function(_0x2a1232){logger['error'](_0xdd1d('0x1c'),_0x2a1232[_0xdd1d('0x13')],_0x1d253a);_0x4b8562(_0x47135e[_0xdd1d('0x11')](0x1f4,_0x2a1232[_0xdd1d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index e324a45..9af3222 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 _0xdb88=['multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','destroy','exports'];(function(_0x400aec,_0x20d3bb){var _0x54d53f=function(_0x508336){while(--_0x508336){_0x400aec['push'](_0x400aec['shift']());}};_0x54d53f(++_0x20d3bb);}(_0xdb88,0x90));var _0x8db8=function(_0x104857,_0x34844c){_0x104857=_0x104857-0x0;var _0x5c7d6d=_0xdb88[_0x104857];return _0x5c7d6d;};'use strict';var multer=require(_0x8db8('0x0'));var util=require(_0x8db8('0x1'));var path=require(_0x8db8('0x2'));var timeout=require('connect-timeout');var express=require(_0x8db8('0x3'));var router=express['Router']();var fs_extra=require(_0x8db8('0x4'));var auth=require(_0x8db8('0x5'));var interaction=require(_0x8db8('0x6'));var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x8db8('0x7')](_0x8db8('0x8'),auth[_0x8db8('0x9')](),controller[_0x8db8('0xa')]);router[_0x8db8('0x7')](_0x8db8('0xb'),auth[_0x8db8('0x9')](),controller[_0x8db8('0xc')]);router[_0x8db8('0xd')]('/',auth[_0x8db8('0x9')](),controller[_0x8db8('0xe')]);router[_0x8db8('0xf')](_0x8db8('0xb'),auth[_0x8db8('0x9')](),controller['update']);router['delete'](_0x8db8('0xb'),auth[_0x8db8('0x9')](),controller[_0x8db8('0x10')]);module[_0x8db8('0x11')]=router; \ No newline at end of file +var _0x5dd9=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','/describe','isAuthenticated','show','post','create','put'];(function(_0x236d24,_0x29e80a){var _0x1574cf=function(_0x5d1dad){while(--_0x5d1dad){_0x236d24['push'](_0x236d24['shift']());}};_0x1574cf(++_0x29e80a);}(_0x5dd9,0x1a7));var _0x95dd=function(_0xdb50e1,_0x112a80){_0xdb50e1=_0xdb50e1-0x0;var _0x2a50fc=_0x5dd9[_0xdb50e1];return _0x2a50fc;};'use strict';var multer=require(_0x95dd('0x0'));var util=require(_0x95dd('0x1'));var path=require(_0x95dd('0x2'));var timeout=require(_0x95dd('0x3'));var express=require(_0x95dd('0x4'));var router=express[_0x95dd('0x5')]();var fs_extra=require(_0x95dd('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x95dd('0x7'));var config=require(_0x95dd('0x8'));var controller=require(_0x95dd('0x9'));router[_0x95dd('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x95dd('0xa')](_0x95dd('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x95dd('0xa')]('/:id',auth[_0x95dd('0xc')](),controller[_0x95dd('0xd')]);router[_0x95dd('0xe')]('/',auth['isAuthenticated'](),controller[_0x95dd('0xf')]);router[_0x95dd('0x10')]('/:id',auth[_0x95dd('0xc')](),controller[_0x95dd('0x11')]);router[_0x95dd('0x12')]('/:id',auth[_0x95dd('0xc')](),controller[_0x95dd('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 7a6650d..0256e23 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x29aefc,_0x4dcf53){var _0x11be36=function(_0x3d472a){while(--_0x3d472a){_0x29aefc['push'](_0x29aefc['shift']());}};_0x11be36(++_0x4dcf53);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1a9e51,_0x56e399){_0x1a9e51=_0x1a9e51-0x0;var _0x22d2ef=_0x9bde[_0x1a9e51];return _0x22d2ef;};'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 +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x47aef8,_0x1acbea){var _0x43d389=function(_0x3bc854){while(--_0x3bc854){_0x47aef8['push'](_0x47aef8['shift']());}};_0x43d389(++_0x1acbea);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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 1604f25..c4444a4 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 _0x2ac4=['fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','FaxTransferReport','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../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','stack','name','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes'];(function(_0xb021f4,_0x78fb58){var _0x380940=function(_0x3317fa){while(--_0x3317fa){_0xb021f4['push'](_0xb021f4['shift']());}};_0x380940(++_0x78fb58);}(_0x2ac4,0xac));var _0x42ac=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0x2ac4[_0x20ef64];return _0x3707d8;};'use strict';var emlformat=require(_0x42ac('0x0'));var rimraf=require(_0x42ac('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x42ac('0x2'));var rp=require(_0x42ac('0x3'));var moment=require('moment');var BPromise=require(_0x42ac('0x4'));var Mustache=require(_0x42ac('0x5'));var util=require(_0x42ac('0x6'));var path=require(_0x42ac('0x7'));var sox=require(_0x42ac('0x8'));var csv=require(_0x42ac('0x9'));var ejs=require(_0x42ac('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x42ac('0xb'));var squel=require(_0x42ac('0xc'));var crypto=require(_0x42ac('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x42ac('0xe'));var toCsv=require(_0x42ac('0x9'));var querystring=require(_0x42ac('0xf'));var Papa=require(_0x42ac('0x10'));var Redis=require('ioredis');var authService=require(_0x42ac('0x11'));var qs=require(_0x42ac('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x42ac('0x13'))(_0x42ac('0x14'));var utils=require(_0x42ac('0x15'));var config=require(_0x42ac('0x16'));var licenseUtil=require(_0x42ac('0x17'));var db=require(_0x42ac('0x18'))['db'];function respondWithStatusCode(_0x1bef1e,_0x546c6a){_0x546c6a=_0x546c6a||0xcc;return function(_0x3451c2){if(_0x3451c2){return _0x1bef1e[_0x42ac('0x19')](_0x546c6a);}return _0x1bef1e[_0x42ac('0x1a')](_0x546c6a)[_0x42ac('0x1b')]();};}function respondWithResult(_0x5c168d,_0x172b9a){_0x172b9a=_0x172b9a||0xc8;return function(_0x2f4aed){if(_0x2f4aed){return _0x5c168d[_0x42ac('0x1a')](_0x172b9a)[_0x42ac('0x1c')](_0x2f4aed);}};}function respondWithFilteredResult(_0xccfe18,_0x32a51f){return function(_0x18b28a){if(_0x18b28a){var _0x84a2eb=typeof _0x32a51f[_0x42ac('0x1d')]===_0x42ac('0x1e')&&typeof _0x32a51f[_0x42ac('0x1f')]==='undefined';var _0x11276b=_0x18b28a[_0x42ac('0x20')];var _0x489f5a=_0x84a2eb?0x0:_0x32a51f['offset'];var _0x49c39f=_0x84a2eb?_0x18b28a[_0x42ac('0x20')]:_0x32a51f['offset']+_0x32a51f['limit'];var _0x45b439;if(_0x49c39f>=_0x11276b){_0x49c39f=_0x11276b;_0x45b439=0xc8;}else{_0x45b439=0xce;}_0xccfe18[_0x42ac('0x1a')](_0x45b439);return _0xccfe18[_0x42ac('0x21')](_0x42ac('0x22'),_0x489f5a+'-'+_0x49c39f+'/'+_0x11276b)[_0x42ac('0x1c')](_0x18b28a);}return null;};}function patchUpdates(_0x1fa510){return function(_0x5024aa){try{jsonpatch[_0x42ac('0x23')](_0x5024aa,_0x1fa510,!![]);}catch(_0x1d8094){return BPromise[_0x42ac('0x24')](_0x1d8094);}return _0x5024aa['save']();};}function saveUpdates(_0x1a9332,_0x14e527){return function(_0x29b47d){if(_0x29b47d){return _0x29b47d[_0x42ac('0x25')](_0x1a9332)[_0x42ac('0x26')](function(_0x379acc){return _0x379acc;});}return null;};}function removeEntity(_0x38f123,_0x22aedb){return function(_0x9361df){if(_0x9361df){return _0x9361df[_0x42ac('0x27')]()[_0x42ac('0x26')](function(){_0x38f123[_0x42ac('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34275a,_0x16c6da){return function(_0x358ad7){if(!_0x358ad7){_0x34275a['sendStatus'](0x194);}return _0x358ad7;};}function handleError(_0x515b84,_0x47d499){_0x47d499=_0x47d499||0x1f4;return function(_0x3c3b56){logger[_0x42ac('0x28')](_0x3c3b56[_0x42ac('0x29')]);if(_0x3c3b56[_0x42ac('0x2a')]){delete _0x3c3b56[_0x42ac('0x2a')];}_0x515b84[_0x42ac('0x1a')](_0x47d499)['send'](_0x3c3b56);};}exports['index']=function(_0x2db5fc,_0x2d0f3d){var _0x5d7145={},_0x232a97={},_0x2024ad={'count':0x0,'rows':[]};var _0x1b7932=_[_0x42ac('0x2b')](db['FaxTransferReport'][_0x42ac('0x2c')],function(_0x1066db){return{'name':_0x1066db[_0x42ac('0x2d')],'type':_0x1066db[_0x42ac('0x2e')][_0x42ac('0x2f')]};});_0x232a97[_0x42ac('0x30')]=_[_0x42ac('0x2b')](_0x1b7932,'name');_0x232a97[_0x42ac('0x31')]=_['keys'](_0x2db5fc['query']);_0x232a97[_0x42ac('0x32')]=_[_0x42ac('0x33')](_0x232a97[_0x42ac('0x30')],_0x232a97['query']);_0x5d7145[_0x42ac('0x34')]=_[_0x42ac('0x33')](_0x232a97['model'],qs[_0x42ac('0x35')](_0x2db5fc['query']['fields']));_0x5d7145[_0x42ac('0x34')]=_0x5d7145[_0x42ac('0x34')]['length']?_0x5d7145[_0x42ac('0x34')]:_0x232a97['model'];if(!_0x2db5fc[_0x42ac('0x31')][_0x42ac('0x36')](_0x42ac('0x37'))){_0x5d7145[_0x42ac('0x1f')]=qs[_0x42ac('0x1f')](_0x2db5fc['query'][_0x42ac('0x1f')]);_0x5d7145[_0x42ac('0x1d')]=qs[_0x42ac('0x1d')](_0x2db5fc[_0x42ac('0x31')]['offset']);}_0x5d7145[_0x42ac('0x38')]=qs[_0x42ac('0x39')](_0x2db5fc[_0x42ac('0x31')][_0x42ac('0x39')]);_0x5d7145[_0x42ac('0x3a')]=qs[_0x42ac('0x32')](_[_0x42ac('0x3b')](_0x2db5fc['query'],_0x232a97[_0x42ac('0x32')]),_0x1b7932);if(_0x2db5fc['query']['filter']){_0x5d7145[_0x42ac('0x3a')]=_[_0x42ac('0x3c')](_0x5d7145['where'],{'$or':_[_0x42ac('0x2b')](_0x1b7932,function(_0x5b0873){if(_0x5b0873[_0x42ac('0x2e')]!=='VIRTUAL'){var _0x47ae83={};_0x47ae83[_0x5b0873[_0x42ac('0x2a')]]={'$like':'%'+_0x2db5fc[_0x42ac('0x31')]['filter']+'%'};return _0x47ae83;}})});}_0x5d7145=_[_0x42ac('0x3c')]({},_0x5d7145,_0x2db5fc[_0x42ac('0x3d')]);var _0x2faaf5={'where':_0x5d7145[_0x42ac('0x3a')]};return db[_0x42ac('0x3e')][_0x42ac('0x20')](_0x2faaf5)['then'](function(_0x3bd1b0){_0x2024ad['count']=_0x3bd1b0;if(_0x2db5fc[_0x42ac('0x31')][_0x42ac('0x3f')]){_0x5d7145[_0x42ac('0x40')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x42ac('0x41')](_0x5d7145);})[_0x42ac('0x26')](function(_0x582ba4){_0x2024ad[_0x42ac('0x42')]=_0x582ba4;return _0x2024ad;})['then'](respondWithFilteredResult(_0x2d0f3d,_0x5d7145))[_0x42ac('0x43')](handleError(_0x2d0f3d,null));};exports[_0x42ac('0x44')]=function(_0xc09a8e,_0x172112){var _0xbb1de4={'raw':!![],'where':{'id':_0xc09a8e[_0x42ac('0x45')]['id']}},_0x46f48c={};_0x46f48c['model']=_[_0x42ac('0x46')](db[_0x42ac('0x3e')]['rawAttributes']);_0x46f48c['query']=_['keys'](_0xc09a8e['query']);_0x46f48c['filters']=_[_0x42ac('0x33')](_0x46f48c[_0x42ac('0x30')],_0x46f48c[_0x42ac('0x31')]);_0xbb1de4[_0x42ac('0x34')]=_[_0x42ac('0x33')](_0x46f48c['model'],qs[_0x42ac('0x35')](_0xc09a8e['query'][_0x42ac('0x35')]));_0xbb1de4['attributes']=_0xbb1de4[_0x42ac('0x34')]['length']?_0xbb1de4['attributes']:_0x46f48c[_0x42ac('0x30')];if(_0xc09a8e[_0x42ac('0x31')]['includeAll']){_0xbb1de4['include']=[{'all':!![]}];}_0xbb1de4=_[_0x42ac('0x3c')]({},_0xbb1de4,_0xc09a8e[_0x42ac('0x3d')]);return db[_0x42ac('0x3e')][_0x42ac('0x47')](_0xbb1de4)[_0x42ac('0x26')](handleEntityNotFound(_0x172112,null))[_0x42ac('0x26')](respondWithResult(_0x172112,null))['catch'](handleError(_0x172112,null));};exports[_0x42ac('0x48')]=function(_0x167e4a,_0x3f32ec){return db[_0x42ac('0x3e')][_0x42ac('0x48')](_0x167e4a[_0x42ac('0x49')],{})[_0x42ac('0x26')](respondWithResult(_0x3f32ec,0xc9))[_0x42ac('0x43')](handleError(_0x3f32ec,null));};exports[_0x42ac('0x25')]=function(_0x55a7e7,_0x480e27){if(_0x55a7e7[_0x42ac('0x49')]['id']){delete _0x55a7e7[_0x42ac('0x49')]['id'];}return db[_0x42ac('0x3e')]['find']({'where':{'id':_0x55a7e7[_0x42ac('0x45')]['id']}})['then'](handleEntityNotFound(_0x480e27,null))[_0x42ac('0x26')](saveUpdates(_0x55a7e7[_0x42ac('0x49')],null))[_0x42ac('0x26')](respondWithResult(_0x480e27,null))[_0x42ac('0x43')](handleError(_0x480e27,null));};exports[_0x42ac('0x27')]=function(_0x17fe54,_0x1f404b){return db['FaxTransferReport'][_0x42ac('0x47')]({'where':{'id':_0x17fe54['params']['id']}})[_0x42ac('0x26')](handleEntityNotFound(_0x1f404b,null))[_0x42ac('0x26')](removeEntity(_0x1f404b,null))[_0x42ac('0x43')](handleError(_0x1f404b,null));};exports[_0x42ac('0x4a')]=function(_0x12beb9,_0xdeac5a){return db[_0x42ac('0x3e')][_0x42ac('0x4a')]()[_0x42ac('0x26')](respondWithResult(_0xdeac5a,null))[_0x42ac('0x43')](handleError(_0xdeac5a,null));}; \ No newline at end of file +var _0xd819=['../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','catch','show','params','keys','includeAll','include','find','create','body','update','describe','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment'];(function(_0x110758,_0x3f6d73){var _0x13678f=function(_0x4d888d){while(--_0x4d888d){_0x110758['push'](_0x110758['shift']());}};_0x13678f(++_0x3f6d73);}(_0xd819,0x1b3));var _0x9d81=function(_0x4f3f71,_0x1e35ce){_0x4f3f71=_0x4f3f71-0x0;var _0x559c25=_0xd819[_0x4f3f71];return _0x559c25;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9d81('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9d81('0x1'));var rp=require('request-promise');var moment=require(_0x9d81('0x2'));var BPromise=require(_0x9d81('0x3'));var Mustache=require(_0x9d81('0x4'));var util=require(_0x9d81('0x5'));var path=require(_0x9d81('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9d81('0x7'));var fs=require('fs');var fs_extra=require(_0x9d81('0x8'));var _=require(_0x9d81('0x9'));var squel=require(_0x9d81('0xa'));var crypto=require(_0x9d81('0xb'));var jsforce=require(_0x9d81('0xc'));var deskjs=require(_0x9d81('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9d81('0xe'));var Papa=require(_0x9d81('0xf'));var Redis=require('ioredis');var authService=require(_0x9d81('0x10'));var qs=require(_0x9d81('0x11'));var as=require(_0x9d81('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x9d81('0x13'));var config=require(_0x9d81('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9d81('0x15'))['db'];function respondWithStatusCode(_0x37d47a,_0x2ef83f){_0x2ef83f=_0x2ef83f||0xcc;return function(_0x490a79){if(_0x490a79){return _0x37d47a[_0x9d81('0x16')](_0x2ef83f);}return _0x37d47a['status'](_0x2ef83f)['end']();};}function respondWithResult(_0x146233,_0x102d7e){_0x102d7e=_0x102d7e||0xc8;return function(_0x4a62a0){if(_0x4a62a0){return _0x146233[_0x9d81('0x17')](_0x102d7e)['json'](_0x4a62a0);}};}function respondWithFilteredResult(_0x52e0b3,_0x468517){return function(_0x395fb5){if(_0x395fb5){var _0x36bee0=typeof _0x468517['offset']===_0x9d81('0x18')&&typeof _0x468517[_0x9d81('0x19')]===_0x9d81('0x18');var _0x2c62a6=_0x395fb5[_0x9d81('0x1a')];var _0x5b53d5=_0x36bee0?0x0:_0x468517['offset'];var _0x1e9630=_0x36bee0?_0x395fb5[_0x9d81('0x1a')]:_0x468517[_0x9d81('0x1b')]+_0x468517[_0x9d81('0x19')];var _0x4d5ecc;if(_0x1e9630>=_0x2c62a6){_0x1e9630=_0x2c62a6;_0x4d5ecc=0xc8;}else{_0x4d5ecc=0xce;}_0x52e0b3[_0x9d81('0x17')](_0x4d5ecc);return _0x52e0b3[_0x9d81('0x1c')](_0x9d81('0x1d'),_0x5b53d5+'-'+_0x1e9630+'/'+_0x2c62a6)[_0x9d81('0x1e')](_0x395fb5);}return null;};}function patchUpdates(_0x10e7aa){return function(_0x15e115){try{jsonpatch[_0x9d81('0x1f')](_0x15e115,_0x10e7aa,!![]);}catch(_0xe8a132){return BPromise[_0x9d81('0x20')](_0xe8a132);}return _0x15e115[_0x9d81('0x21')]();};}function saveUpdates(_0x1757e4,_0x215724){return function(_0x58b1c0){if(_0x58b1c0){return _0x58b1c0['update'](_0x1757e4)[_0x9d81('0x22')](function(_0x56cd56){return _0x56cd56;});}return null;};}function removeEntity(_0x52dc0f,_0x3bf9d2){return function(_0x43b169){if(_0x43b169){return _0x43b169[_0x9d81('0x23')]()[_0x9d81('0x22')](function(){_0x52dc0f[_0x9d81('0x17')](0xcc)[_0x9d81('0x24')]();});}};}function handleEntityNotFound(_0x1d867c,_0x102e44){return function(_0x483700){if(!_0x483700){_0x1d867c['sendStatus'](0x194);}return _0x483700;};}function handleError(_0x49991d,_0x41278c){_0x41278c=_0x41278c||0x1f4;return function(_0x23376f){logger[_0x9d81('0x25')](_0x23376f[_0x9d81('0x26')]);if(_0x23376f['name']){delete _0x23376f[_0x9d81('0x27')];}_0x49991d[_0x9d81('0x17')](_0x41278c)[_0x9d81('0x28')](_0x23376f);};}exports[_0x9d81('0x29')]=function(_0x121e52,_0x4096a1){var _0x18de46={},_0x32fa04={},_0x2256bd={'count':0x0,'rows':[]};var _0x166e8a=_[_0x9d81('0x2a')](db[_0x9d81('0x2b')][_0x9d81('0x2c')],function(_0x6612a5){return{'name':_0x6612a5['fieldName'],'type':_0x6612a5[_0x9d81('0x2d')][_0x9d81('0x2e')]};});_0x32fa04[_0x9d81('0x2f')]=_['map'](_0x166e8a,'name');_0x32fa04[_0x9d81('0x30')]=_['keys'](_0x121e52[_0x9d81('0x30')]);_0x32fa04[_0x9d81('0x31')]=_['intersection'](_0x32fa04[_0x9d81('0x2f')],_0x32fa04[_0x9d81('0x30')]);_0x18de46['attributes']=_[_0x9d81('0x32')](_0x32fa04[_0x9d81('0x2f')],qs[_0x9d81('0x33')](_0x121e52[_0x9d81('0x30')][_0x9d81('0x33')]));_0x18de46[_0x9d81('0x34')]=_0x18de46['attributes'][_0x9d81('0x35')]?_0x18de46['attributes']:_0x32fa04[_0x9d81('0x2f')];if(!_0x121e52['query'][_0x9d81('0x36')](_0x9d81('0x37'))){_0x18de46[_0x9d81('0x19')]=qs[_0x9d81('0x19')](_0x121e52['query'][_0x9d81('0x19')]);_0x18de46[_0x9d81('0x1b')]=qs[_0x9d81('0x1b')](_0x121e52[_0x9d81('0x30')][_0x9d81('0x1b')]);}_0x18de46[_0x9d81('0x38')]=qs[_0x9d81('0x39')](_0x121e52['query'][_0x9d81('0x39')]);_0x18de46[_0x9d81('0x3a')]=qs['filters'](_[_0x9d81('0x3b')](_0x121e52[_0x9d81('0x30')],_0x32fa04[_0x9d81('0x31')]),_0x166e8a);if(_0x121e52[_0x9d81('0x30')][_0x9d81('0x3c')]){_0x18de46[_0x9d81('0x3a')]=_[_0x9d81('0x3d')](_0x18de46[_0x9d81('0x3a')],{'$or':_['map'](_0x166e8a,function(_0x395c3d){if(_0x395c3d[_0x9d81('0x2d')]!==_0x9d81('0x3e')){var _0x58284d={};_0x58284d[_0x395c3d[_0x9d81('0x27')]]={'$like':'%'+_0x121e52['query'][_0x9d81('0x3c')]+'%'};return _0x58284d;}})});}_0x18de46=_[_0x9d81('0x3d')]({},_0x18de46,_0x121e52[_0x9d81('0x3f')]);var _0x412308={'where':_0x18de46[_0x9d81('0x3a')]};return db[_0x9d81('0x2b')][_0x9d81('0x1a')](_0x412308)[_0x9d81('0x22')](function(_0x43e56a){_0x2256bd['count']=_0x43e56a;if(_0x121e52['query']['includeAll']){_0x18de46['include']=[{'all':!![]}];}return db[_0x9d81('0x2b')][_0x9d81('0x40')](_0x18de46);})[_0x9d81('0x22')](function(_0x51b49b){_0x2256bd['rows']=_0x51b49b;return _0x2256bd;})[_0x9d81('0x22')](respondWithFilteredResult(_0x4096a1,_0x18de46))[_0x9d81('0x41')](handleError(_0x4096a1,null));};exports[_0x9d81('0x42')]=function(_0x584e39,_0x84009a){var _0x524ca1={'raw':!![],'where':{'id':_0x584e39[_0x9d81('0x43')]['id']}},_0x4acb5a={};_0x4acb5a[_0x9d81('0x2f')]=_[_0x9d81('0x44')](db[_0x9d81('0x2b')][_0x9d81('0x2c')]);_0x4acb5a[_0x9d81('0x30')]=_[_0x9d81('0x44')](_0x584e39['query']);_0x4acb5a[_0x9d81('0x31')]=_[_0x9d81('0x32')](_0x4acb5a[_0x9d81('0x2f')],_0x4acb5a['query']);_0x524ca1[_0x9d81('0x34')]=_['intersection'](_0x4acb5a[_0x9d81('0x2f')],qs[_0x9d81('0x33')](_0x584e39[_0x9d81('0x30')][_0x9d81('0x33')]));_0x524ca1[_0x9d81('0x34')]=_0x524ca1['attributes'][_0x9d81('0x35')]?_0x524ca1[_0x9d81('0x34')]:_0x4acb5a[_0x9d81('0x2f')];if(_0x584e39['query'][_0x9d81('0x45')]){_0x524ca1[_0x9d81('0x46')]=[{'all':!![]}];}_0x524ca1=_[_0x9d81('0x3d')]({},_0x524ca1,_0x584e39[_0x9d81('0x3f')]);return db[_0x9d81('0x2b')][_0x9d81('0x47')](_0x524ca1)[_0x9d81('0x22')](handleEntityNotFound(_0x84009a,null))[_0x9d81('0x22')](respondWithResult(_0x84009a,null))['catch'](handleError(_0x84009a,null));};exports['create']=function(_0x597cea,_0x1cfd64){return db[_0x9d81('0x2b')][_0x9d81('0x48')](_0x597cea[_0x9d81('0x49')],{})['then'](respondWithResult(_0x1cfd64,0xc9))[_0x9d81('0x41')](handleError(_0x1cfd64,null));};exports[_0x9d81('0x4a')]=function(_0x147b9f,_0x47808a){if(_0x147b9f[_0x9d81('0x49')]['id']){delete _0x147b9f['body']['id'];}return db[_0x9d81('0x2b')][_0x9d81('0x47')]({'where':{'id':_0x147b9f[_0x9d81('0x43')]['id']}})[_0x9d81('0x22')](handleEntityNotFound(_0x47808a,null))[_0x9d81('0x22')](saveUpdates(_0x147b9f[_0x9d81('0x49')],null))[_0x9d81('0x22')](respondWithResult(_0x47808a,null))[_0x9d81('0x41')](handleError(_0x47808a,null));};exports[_0x9d81('0x23')]=function(_0x38c63f,_0x80b748){return db['FaxTransferReport'][_0x9d81('0x47')]({'where':{'id':_0x38c63f[_0x9d81('0x43')]['id']}})[_0x9d81('0x22')](handleEntityNotFound(_0x80b748,null))[_0x9d81('0x22')](removeEntity(_0x80b748,null))[_0x9d81('0x41')](handleError(_0x80b748,null));};exports[_0x9d81('0x4b')]=function(_0x355153,_0x117a95){return db['FaxTransferReport']['describe']()[_0x9d81('0x22')](respondWithResult(_0x117a95,null))[_0x9d81('0x41')](handleError(_0x117a95,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index aa89d3a..c5e0969 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 _0xf330=['report_fax_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport'];(function(_0x7a0220,_0x73e776){var _0x582068=function(_0x2089c7){while(--_0x2089c7){_0x7a0220['push'](_0x7a0220['shift']());}};_0x582068(++_0x73e776);}(_0xf330,0x160));var _0x0f33=function(_0x101554,_0x112c00){_0x101554=_0x101554-0x0;var _0x47f4f5=_0xf330[_0x101554];return _0x47f4f5;};'use strict';var _=require(_0x0f33('0x0'));var util=require(_0x0f33('0x1'));var logger=require(_0x0f33('0x2'))('api');var moment=require(_0x0f33('0x3'));var BPromise=require(_0x0f33('0x4'));var rp=require(_0x0f33('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0f33('0x6'));var config=require(_0x0f33('0x7'));var attributes=require(_0x0f33('0x8'));module[_0x0f33('0x9')]=function(_0x568a18,_0x470e19){return _0x568a18[_0x0f33('0xa')](_0x0f33('0xb'),attributes,{'tableName':_0x0f33('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0f33('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0aab=['uniqueid','lodash','api','moment','bluebird','request-promise','path','rimraf','./faxTransferReport.attributes','report_fax_transfer'];(function(_0x27dba4,_0x419253){var _0x35ec9d=function(_0x2d13b2){while(--_0x2d13b2){_0x27dba4['push'](_0x27dba4['shift']());}};_0x35ec9d(++_0x419253);}(_0x0aab,0x169));var _0xb0aa=function(_0xfb42e6,_0x5f5d4b){_0xfb42e6=_0xfb42e6-0x0;var _0x27265b=_0x0aab[_0xfb42e6];return _0x27265b;};'use strict';var _=require(_0xb0aa('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb0aa('0x1'));var moment=require(_0xb0aa('0x2'));var BPromise=require(_0xb0aa('0x3'));var rp=require(_0xb0aa('0x4'));var fs=require('fs');var path=require(_0xb0aa('0x5'));var rimraf=require(_0xb0aa('0x6'));var config=require('../../config/environment');var attributes=require(_0xb0aa('0x7'));module['exports']=function(_0xe6f6bf,_0x21a353){return _0xe6f6bf['define']('FaxTransferReport',attributes,{'tableName':_0xb0aa('0x8'),'paranoid':![],'indexes':[{'name':_0xb0aa('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 5353163..e305df4 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 _0x078e=['FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x52d6bd,_0x41873e){var _0x21a990=function(_0x4da406){while(--_0x4da406){_0x52d6bd['push'](_0x52d6bd['shift']());}};_0x21a990(++_0x41873e);}(_0x078e,0x147));var _0xe078=function(_0xfb60c2,_0x4afb20){_0xfb60c2=_0xfb60c2-0x0;var _0x388c5c=_0x078e[_0xfb60c2];return _0x388c5c;};'use strict';var _=require(_0xe078('0x0'));var util=require(_0xe078('0x1'));var moment=require(_0xe078('0x2'));var BPromise=require(_0xe078('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe078('0x4'));var db=require(_0xe078('0x5'))['db'];var utils=require(_0xe078('0x6'));var logger=require('../../config/logger')(_0xe078('0x7'));var config=require(_0xe078('0x8'));var jayson=require(_0xe078('0x9'));var client=jayson[_0xe078('0xa')][_0xe078('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x340c3e,_0x590b18,_0x45ba1c){return new BPromise(function(_0x1e8f79,_0x458194){return client[_0xe078('0xc')](_0x340c3e,_0x45ba1c)[_0xe078('0xd')](function(_0x2442eb){logger[_0xe078('0xe')](_0xe078('0xf'),_0x590b18,_0xe078('0x10'));logger[_0xe078('0x11')](_0xe078('0x12'),_0x590b18,_0xe078('0x10'),JSON[_0xe078('0x13')](_0x2442eb));if(_0x2442eb[_0xe078('0x14')]){if(_0x2442eb[_0xe078('0x14')]['code']===0x1f4){logger[_0xe078('0x14')]('FaxTransferReport,\x20%s,\x20%s',_0x590b18,_0x2442eb[_0xe078('0x14')][_0xe078('0x15')]);return _0x458194(_0x2442eb[_0xe078('0x14')][_0xe078('0x15')]);}logger[_0xe078('0x14')](_0xe078('0xf'),_0x590b18,_0x2442eb[_0xe078('0x14')][_0xe078('0x15')]);return _0x1e8f79(_0x2442eb['error'][_0xe078('0x15')]);}else{logger[_0xe078('0xe')](_0xe078('0xf'),_0x590b18,_0xe078('0x10'));_0x1e8f79(_0x2442eb['result']['message']);}})[_0xe078('0x16')](function(_0x5a543d){logger[_0xe078('0x14')](_0xe078('0xf'),_0x590b18,_0x5a543d);_0x458194(_0x5a543d);});});} \ No newline at end of file +var _0x89c1=['code','FaxTransferReport,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x89c1,0x1e7));var _0x189c=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x89c1[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require(_0x189c('0x0'));var moment=require(_0x189c('0x1'));var BPromise=require(_0x189c('0x2'));var rs=require(_0x189c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x189c('0x4'));var logger=require(_0x189c('0x5'))(_0x189c('0x6'));var config=require(_0x189c('0x7'));var jayson=require(_0x189c('0x8'));var client=jayson[_0x189c('0x9')][_0x189c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x213051,_0x263c49,_0x4b6250){return new BPromise(function(_0x584d2d,_0xc87872){return client[_0x189c('0xb')](_0x213051,_0x4b6250)[_0x189c('0xc')](function(_0x370036){logger[_0x189c('0xd')]('FaxTransferReport,\x20%s,\x20%s',_0x263c49,_0x189c('0xe'));logger[_0x189c('0xf')](_0x189c('0x10'),_0x263c49,_0x189c('0xe'),JSON[_0x189c('0x11')](_0x370036));if(_0x370036[_0x189c('0x12')]){if(_0x370036[_0x189c('0x12')][_0x189c('0x13')]===0x1f4){logger[_0x189c('0x12')](_0x189c('0x14'),_0x263c49,_0x370036[_0x189c('0x12')][_0x189c('0x15')]);return _0xc87872(_0x370036['error'][_0x189c('0x15')]);}logger[_0x189c('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x263c49,_0x370036[_0x189c('0x12')][_0x189c('0x15')]);return _0x584d2d(_0x370036[_0x189c('0x12')]['message']);}else{logger['info'](_0x189c('0x14'),_0x263c49,_0x189c('0xe'));_0x584d2d(_0x370036[_0x189c('0x16')][_0x189c('0x15')]);}})['catch'](function(_0x496df7){logger[_0x189c('0x12')](_0x189c('0x14'),_0x263c49,_0x496df7);_0xc87872(_0x496df7);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index e3de591..444deb4 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 _0xa7c5=['delete','destroy','exports','multer','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put'];(function(_0x35b1c4,_0x56b60b){var _0x475339=function(_0x597c71){while(--_0x597c71){_0x35b1c4['push'](_0x35b1c4['shift']());}};_0x475339(++_0x56b60b);}(_0xa7c5,0xb3));var _0x5a7c=function(_0x5e2210,_0x172a2){_0x5e2210=_0x5e2210-0x0;var _0x16ff51=_0xa7c5[_0x5e2210];return _0x16ff51;};'use strict';var multer=require(_0x5a7c('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('fs-extra');var auth=require(_0x5a7c('0x1'));var interaction=require(_0x5a7c('0x2'));var config=require('../../config/environment');var controller=require(_0x5a7c('0x3'));router[_0x5a7c('0x4')]('/',auth[_0x5a7c('0x5')](),controller[_0x5a7c('0x6')]);router[_0x5a7c('0x4')]('/describe',auth[_0x5a7c('0x5')](),controller[_0x5a7c('0x7')]);router[_0x5a7c('0x4')](_0x5a7c('0x8'),auth['isAuthenticated'](),controller[_0x5a7c('0x9')]);router[_0x5a7c('0xa')]('/',auth[_0x5a7c('0x5')](),controller[_0x5a7c('0xb')]);router[_0x5a7c('0xc')](_0x5a7c('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x5a7c('0xd')](_0x5a7c('0x8'),auth[_0x5a7c('0x5')](),controller[_0x5a7c('0xe')]);module[_0x5a7c('0xf')]=router; \ No newline at end of file +var _0x462b=['destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x462b,0x13d));var _0xb462=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x462b[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xb462('0x0'));var util=require('util');var path=require(_0xb462('0x1'));var timeout=require(_0xb462('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb462('0x3'));var auth=require(_0xb462('0x4'));var interaction=require(_0xb462('0x5'));var config=require(_0xb462('0x6'));var controller=require(_0xb462('0x7'));router['get']('/',auth[_0xb462('0x8')](),controller[_0xb462('0x9')]);router[_0xb462('0xa')](_0xb462('0xb'),auth[_0xb462('0x8')](),controller[_0xb462('0xc')]);router[_0xb462('0xa')](_0xb462('0xd'),auth[_0xb462('0x8')](),controller[_0xb462('0xe')]);router[_0xb462('0xf')]('/',auth['isAuthenticated'](),controller[_0xb462('0x10')]);router[_0xb462('0x11')]('/:id',auth[_0xb462('0x8')](),controller['update']);router[_0xb462('0x12')](_0xb462('0xd'),auth[_0xb462('0x8')](),controller[_0xb462('0x13')]);module[_0xb462('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 5679593..50f3034 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 _0xca5b=['isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','./intDeskAccount.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xca5b,0x91));var _0xbca5=function(_0xbf3f74,_0x1ae4bf){_0xbf3f74=_0xbf3f74-0x0;var _0xd26ead=_0xca5b[_0xbf3f74];return _0xd26ead;};'use strict';var multer=require(_0xbca5('0x0'));var util=require(_0xbca5('0x1'));var path=require(_0xbca5('0x2'));var timeout=require(_0xbca5('0x3'));var express=require(_0xbca5('0x4'));var router=express[_0xbca5('0x5')]();var fs_extra=require(_0xbca5('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbca5('0x7'));router[_0xbca5('0x8')]('/',auth[_0xbca5('0x9')](),controller[_0xbca5('0xa')]);router[_0xbca5('0x8')](_0xbca5('0xb'),auth['isAuthenticated'](),controller[_0xbca5('0xc')]);router[_0xbca5('0x8')](_0xbca5('0xd'),auth[_0xbca5('0x9')](),controller[_0xbca5('0xe')]);router['get'](_0xbca5('0xf'),auth[_0xbca5('0x9')](),controller['getFields']);router[_0xbca5('0x10')]('/',auth[_0xbca5('0x9')](),controller[_0xbca5('0x11')]);router[_0xbca5('0x10')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0xbca5('0x12')](_0xbca5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xbca5('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xbca5('0x14')]);module[_0xbca5('0x15')]=router; \ No newline at end of file +var _0x5b71=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra'];(function(_0x4d5ec2,_0x1f3cc2){var _0x26b7b4=function(_0x24ad78){while(--_0x24ad78){_0x4d5ec2['push'](_0x4d5ec2['shift']());}};_0x26b7b4(++_0x1f3cc2);}(_0x5b71,0xd7));var _0x15b7=function(_0x14723d,_0x4e09de){_0x14723d=_0x14723d-0x0;var _0x53227d=_0x5b71[_0x14723d];return _0x53227d;};'use strict';var multer=require(_0x15b7('0x0'));var util=require(_0x15b7('0x1'));var path=require('path');var timeout=require(_0x15b7('0x2'));var express=require(_0x15b7('0x3'));var router=express['Router']();var fs_extra=require(_0x15b7('0x4'));var auth=require(_0x15b7('0x5'));var interaction=require(_0x15b7('0x6'));var config=require(_0x15b7('0x7'));var controller=require('./intDeskAccount.controller');router[_0x15b7('0x8')]('/',auth['isAuthenticated'](),controller[_0x15b7('0x9')]);router[_0x15b7('0x8')](_0x15b7('0xa'),auth[_0x15b7('0xb')](),controller['show']);router['get'](_0x15b7('0xc'),auth[_0x15b7('0xb')](),controller[_0x15b7('0xd')]);router[_0x15b7('0x8')]('/:id/fields',auth[_0x15b7('0xb')](),controller[_0x15b7('0xe')]);router['post']('/',auth[_0x15b7('0xb')](),controller['create']);router[_0x15b7('0xf')](_0x15b7('0xc'),auth[_0x15b7('0xb')](),controller[_0x15b7('0x10')]);router[_0x15b7('0x11')](_0x15b7('0xa'),auth[_0x15b7('0xb')](),controller[_0x15b7('0x12')]);router[_0x15b7('0x13')](_0x15b7('0xa'),auth[_0x15b7('0xb')](),controller[_0x15b7('0x14')]);module[_0x15b7('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 462fe67..80166e3 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 _0x5eae=['ENUM','basic','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x5eae,0x9e));var _0xe5ea=function(_0x27b7cd,_0x285187){_0x27b7cd=_0x27b7cd-0x0;var _0x7497b=_0x5eae[_0x27b7cd];return _0x7497b;};'use strict';var Sequelize=require(_0xe5ea('0x0'));module[_0xe5ea('0x1')]={'name':{'type':Sequelize[_0xe5ea('0x2')]},'description':{'type':Sequelize[_0xe5ea('0x2')]},'username':{'type':Sequelize[_0xe5ea('0x2')]},'remoteUri':{'type':Sequelize[_0xe5ea('0x2')]},'authType':{'type':Sequelize[_0xe5ea('0x3')]('basic'),'defaultValue':_0xe5ea('0x4')},'password':{'type':Sequelize[_0xe5ea('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xe5ea('0x2')]},'token':{'type':Sequelize[_0xe5ea('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xe5ea('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe5ea('0x3')](_0xe5ea('0x5'),_0xe5ea('0x6')),'defaultValue':_0xe5ea('0x5')}}; \ No newline at end of file +var _0xdf40=['sequelize','exports','STRING','ENUM','basic','newTab','integrationTab'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xdf40,0x17a));var _0x0df4=function(_0x1778e1,_0x3e1727){_0x1778e1=_0x1778e1-0x0;var _0x2bc4c6=_0xdf40[_0x1778e1];return _0x2bc4c6;};'use strict';var Sequelize=require(_0x0df4('0x0'));module[_0x0df4('0x1')]={'name':{'type':Sequelize[_0x0df4('0x2')]},'description':{'type':Sequelize[_0x0df4('0x2')]},'username':{'type':Sequelize[_0x0df4('0x2')]},'remoteUri':{'type':Sequelize[_0x0df4('0x2')]},'authType':{'type':Sequelize[_0x0df4('0x3')](_0x0df4('0x4')),'defaultValue':_0x0df4('0x4')},'password':{'type':Sequelize[_0x0df4('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x0df4('0x2')]},'tokenSecret':{'type':Sequelize[_0x0df4('0x2')]},'serverUrl':{'type':Sequelize[_0x0df4('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x0df4('0x5')),'defaultValue':_0x0df4('0x6')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 23a52ee..e601128 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 _0xbd1c=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','name','index','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','VIRTUAL','options','include','DeskAccount','rows','catch','includeAll','find','create','body','getConfigurations','params','order','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','lastIndexOf','format','%s/custom_fields','application/json','headers','%s:%s','toString','base64','concat','entries','active','label','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','eml-format'];(function(_0x5696bc,_0xdfac28){var _0x2b85f2=function(_0x447f56){while(--_0x447f56){_0x5696bc['push'](_0x5696bc['shift']());}};_0x2b85f2(++_0xdfac28);}(_0xbd1c,0x1bb));var _0xcbd1=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xbd1c[_0x46e363];return _0x3fb059;};'use strict';var emlformat=require(_0xcbd1('0x0'));var rimraf=require(_0xcbd1('0x1'));var zipdir=require(_0xcbd1('0x2'));var jsonpatch=require(_0xcbd1('0x3'));var rp=require(_0xcbd1('0x4'));var moment=require('moment');var BPromise=require(_0xcbd1('0x5'));var Mustache=require(_0xcbd1('0x6'));var util=require('util');var path=require(_0xcbd1('0x7'));var sox=require(_0xcbd1('0x8'));var csv=require(_0xcbd1('0x9'));var ejs=require(_0xcbd1('0xa'));var fs=require('fs');var fs_extra=require(_0xcbd1('0xb'));var _=require(_0xcbd1('0xc'));var squel=require(_0xcbd1('0xd'));var crypto=require(_0xcbd1('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcbd1('0x9'));var querystring=require(_0xcbd1('0xf'));var Papa=require(_0xcbd1('0x10'));var Redis=require(_0xcbd1('0x11'));var authService=require(_0xcbd1('0x12'));var qs=require(_0xcbd1('0x13'));var as=require(_0xcbd1('0x14'));var hardwareService=require(_0xcbd1('0x15'));var logger=require('../../config/logger')(_0xcbd1('0x16'));var utils=require('../../config/utils');var config=require(_0xcbd1('0x17'));var licenseUtil=require(_0xcbd1('0x18'));var db=require(_0xcbd1('0x19'))['db'];var integrations=require(_0xcbd1('0x1a'));function respondWithStatusCode(_0x5de054,_0x2389d3){_0x2389d3=_0x2389d3||0xcc;return function(_0x31abb4){if(_0x31abb4){return _0x5de054['sendStatus'](_0x2389d3);}return _0x5de054['status'](_0x2389d3)[_0xcbd1('0x1b')]();};}function respondWithResult(_0xb19408,_0x561b6e){_0x561b6e=_0x561b6e||0xc8;return function(_0x224b59){if(_0x224b59){return _0xb19408[_0xcbd1('0x1c')](_0x561b6e)['json'](_0x224b59);}};}function respondWithFilteredResult(_0x48546c,_0x502253){return function(_0x5511a7){if(_0x5511a7){var _0x3f7041=typeof _0x502253[_0xcbd1('0x1d')]===_0xcbd1('0x1e')&&typeof _0x502253[_0xcbd1('0x1f')]===_0xcbd1('0x1e');var _0xa999a=_0x5511a7[_0xcbd1('0x20')];var _0x3f4179=_0x3f7041?0x0:_0x502253[_0xcbd1('0x1d')];var _0x585102=_0x3f7041?_0x5511a7[_0xcbd1('0x20')]:_0x502253[_0xcbd1('0x1d')]+_0x502253[_0xcbd1('0x1f')];var _0x535abf;if(_0x585102>=_0xa999a){_0x585102=_0xa999a;_0x535abf=0xc8;}else{_0x535abf=0xce;}_0x48546c[_0xcbd1('0x1c')](_0x535abf);return _0x48546c[_0xcbd1('0x21')](_0xcbd1('0x22'),_0x3f4179+'-'+_0x585102+'/'+_0xa999a)[_0xcbd1('0x23')](_0x5511a7);}return null;};}function patchUpdates(_0x20be8a){return function(_0x4d25b7){try{jsonpatch['apply'](_0x4d25b7,_0x20be8a,!![]);}catch(_0x3dcbc9){return BPromise[_0xcbd1('0x24')](_0x3dcbc9);}return _0x4d25b7[_0xcbd1('0x25')]();};}function saveUpdates(_0x363c0f,_0x450df6){return function(_0xfaae31){if(_0xfaae31){return _0xfaae31[_0xcbd1('0x26')](_0x363c0f)[_0xcbd1('0x27')](function(_0x5f58ef){return _0x5f58ef;});}return null;};}function removeEntity(_0x37f34f,_0x1c4905){return function(_0xec2e86){if(_0xec2e86){return _0xec2e86[_0xcbd1('0x28')]()[_0xcbd1('0x27')](function(){_0x37f34f[_0xcbd1('0x1c')](0xcc)[_0xcbd1('0x1b')]();});}};}function handleEntityNotFound(_0x4e73f4,_0x1893e7){return function(_0x1ff414){if(!_0x1ff414){_0x4e73f4[_0xcbd1('0x29')](0x194);}return _0x1ff414;};}function handleError(_0xc2359a,_0x296b47){_0x296b47=_0x296b47||0x1f4;return function(_0x3be493){logger['error'](_0x3be493['stack']);if(_0x3be493[_0xcbd1('0x2a')]){delete _0x3be493[_0xcbd1('0x2a')];}_0xc2359a[_0xcbd1('0x1c')](_0x296b47)['send'](_0x3be493);};}exports[_0xcbd1('0x2b')]=function(_0xf9fa82,_0x36ff2f){var _0x3153fb={},_0x102edf={},_0x5d900b={'count':0x0,'rows':[]};var _0x17f08c=_['map'](db['DeskAccount'][_0xcbd1('0x2c')],function(_0x8cdddb){return{'name':_0x8cdddb[_0xcbd1('0x2d')],'type':_0x8cdddb[_0xcbd1('0x2e')][_0xcbd1('0x2f')]};});_0x102edf['model']=_[_0xcbd1('0x30')](_0x17f08c,_0xcbd1('0x2a'));_0x102edf[_0xcbd1('0x31')]=_[_0xcbd1('0x32')](_0xf9fa82[_0xcbd1('0x31')]);_0x102edf['filters']=_[_0xcbd1('0x33')](_0x102edf[_0xcbd1('0x34')],_0x102edf[_0xcbd1('0x31')]);_0x3153fb['attributes']=_[_0xcbd1('0x33')](_0x102edf['model'],qs[_0xcbd1('0x35')](_0xf9fa82[_0xcbd1('0x31')][_0xcbd1('0x35')]));_0x3153fb[_0xcbd1('0x36')]=_0x3153fb[_0xcbd1('0x36')][_0xcbd1('0x37')]?_0x3153fb[_0xcbd1('0x36')]:_0x102edf[_0xcbd1('0x34')];if(!_0xf9fa82['query'][_0xcbd1('0x38')](_0xcbd1('0x39'))){_0x3153fb[_0xcbd1('0x1f')]=qs[_0xcbd1('0x1f')](_0xf9fa82['query']['limit']);_0x3153fb[_0xcbd1('0x1d')]=qs[_0xcbd1('0x1d')](_0xf9fa82['query'][_0xcbd1('0x1d')]);}_0x3153fb['order']=qs[_0xcbd1('0x3a')](_0xf9fa82['query']['sort']);_0x3153fb['where']=qs['filters'](_[_0xcbd1('0x3b')](_0xf9fa82[_0xcbd1('0x31')],_0x102edf[_0xcbd1('0x3c')]),_0x17f08c);if(_0xf9fa82[_0xcbd1('0x31')][_0xcbd1('0x3d')]){_0x3153fb['where']=_[_0xcbd1('0x3e')](_0x3153fb[_0xcbd1('0x3f')],{'$or':_['map'](_0x17f08c,function(_0x3f4507){if(_0x3f4507[_0xcbd1('0x2e')]!==_0xcbd1('0x40')){var _0x50ab1d={};_0x50ab1d[_0x3f4507[_0xcbd1('0x2a')]]={'$like':'%'+_0xf9fa82[_0xcbd1('0x31')][_0xcbd1('0x3d')]+'%'};return _0x50ab1d;}})});}_0x3153fb=_[_0xcbd1('0x3e')]({},_0x3153fb,_0xf9fa82[_0xcbd1('0x41')]);var _0x1b63e5={'where':_0x3153fb['where']};return db['DeskAccount'][_0xcbd1('0x20')](_0x1b63e5)[_0xcbd1('0x27')](function(_0x2a930b){_0x5d900b[_0xcbd1('0x20')]=_0x2a930b;if(_0xf9fa82['query']['includeAll']){_0x3153fb[_0xcbd1('0x42')]=[{'all':!![]}];}return db[_0xcbd1('0x43')]['findAll'](_0x3153fb);})[_0xcbd1('0x27')](function(_0x543bc6){_0x5d900b[_0xcbd1('0x44')]=_0x543bc6;return _0x5d900b;})[_0xcbd1('0x27')](respondWithFilteredResult(_0x36ff2f,_0x3153fb))[_0xcbd1('0x45')](handleError(_0x36ff2f,null));};exports['show']=function(_0x5bb07d,_0x5d6eb6){var _0x430ac0={'raw':![],'where':{'id':_0x5bb07d['params']['id']}},_0xcc36e4={};_0xcc36e4[_0xcbd1('0x34')]=_['keys'](db[_0xcbd1('0x43')]['rawAttributes']);_0xcc36e4['query']=_[_0xcbd1('0x32')](_0x5bb07d[_0xcbd1('0x31')]);_0xcc36e4[_0xcbd1('0x3c')]=_[_0xcbd1('0x33')](_0xcc36e4['model'],_0xcc36e4[_0xcbd1('0x31')]);_0x430ac0[_0xcbd1('0x36')]=_[_0xcbd1('0x33')](_0xcc36e4['model'],qs[_0xcbd1('0x35')](_0x5bb07d[_0xcbd1('0x31')][_0xcbd1('0x35')]));_0x430ac0[_0xcbd1('0x36')]=_0x430ac0[_0xcbd1('0x36')][_0xcbd1('0x37')]?_0x430ac0[_0xcbd1('0x36')]:_0xcc36e4[_0xcbd1('0x34')];if(_0x5bb07d[_0xcbd1('0x31')][_0xcbd1('0x46')]){_0x430ac0[_0xcbd1('0x42')]=[{'all':!![]}];}_0x430ac0=_[_0xcbd1('0x3e')]({},_0x430ac0,_0x5bb07d[_0xcbd1('0x41')]);return db['DeskAccount'][_0xcbd1('0x47')](_0x430ac0)[_0xcbd1('0x27')](handleEntityNotFound(_0x5d6eb6,null))[_0xcbd1('0x27')](respondWithResult(_0x5d6eb6,null))[_0xcbd1('0x45')](handleError(_0x5d6eb6,null));};exports[_0xcbd1('0x48')]=function(_0x138555,_0x285a8b){return db[_0xcbd1('0x43')][_0xcbd1('0x48')](_0x138555[_0xcbd1('0x49')],{})[_0xcbd1('0x27')](respondWithResult(_0x285a8b,0xc9))[_0xcbd1('0x45')](handleError(_0x285a8b,null));};exports[_0xcbd1('0x26')]=function(_0x5c5ff7,_0x4605eb){if(_0x5c5ff7[_0xcbd1('0x49')]['id']){delete _0x5c5ff7[_0xcbd1('0x49')]['id'];}return db['DeskAccount']['find']({'where':{'id':_0x5c5ff7['params']['id']}})[_0xcbd1('0x27')](handleEntityNotFound(_0x4605eb,null))[_0xcbd1('0x27')](saveUpdates(_0x5c5ff7['body'],null))['then'](respondWithResult(_0x4605eb,null))[_0xcbd1('0x45')](handleError(_0x4605eb,null));};exports[_0xcbd1('0x28')]=function(_0x489e55,_0x22eade){return db['DeskAccount'][_0xcbd1('0x47')]({'where':{'id':_0x489e55['params']['id']}})['then'](handleEntityNotFound(_0x22eade,null))[_0xcbd1('0x27')](removeEntity(_0x22eade,null))[_0xcbd1('0x45')](handleError(_0x22eade,null));};exports[_0xcbd1('0x4a')]=function(_0x1df70b,_0x422f30,_0x1de5af){var _0x547056={};var _0x3247cd={};var _0x1708cd;var _0xad7c33;return db[_0xcbd1('0x43')]['findOne']({'where':{'id':_0x1df70b[_0xcbd1('0x4b')]['id']}})[_0xcbd1('0x27')](handleEntityNotFound(_0x422f30,null))['then'](function(_0x34abe3){if(_0x34abe3){_0x1708cd=_0x34abe3;_0x3247cd[_0xcbd1('0x34')]=_[_0xcbd1('0x32')](db['DeskConfiguration'][_0xcbd1('0x2c')]);_0x3247cd[_0xcbd1('0x31')]=_[_0xcbd1('0x32')](_0x1df70b[_0xcbd1('0x31')]);_0x3247cd[_0xcbd1('0x3c')]=_['intersection'](_0x3247cd[_0xcbd1('0x34')],_0x3247cd[_0xcbd1('0x31')]);_0x547056[_0xcbd1('0x36')]=_['intersection'](_0x3247cd[_0xcbd1('0x34')],qs['fields'](_0x1df70b[_0xcbd1('0x31')][_0xcbd1('0x35')]));_0x547056['attributes']=_0x547056['attributes'][_0xcbd1('0x37')]?_0x547056[_0xcbd1('0x36')]:_0x3247cd[_0xcbd1('0x34')];_0x547056[_0xcbd1('0x4c')]=qs['sort'](_0x1df70b['query']['sort']);_0x547056[_0xcbd1('0x3f')]=qs[_0xcbd1('0x3c')](_[_0xcbd1('0x3b')](_0x1df70b[_0xcbd1('0x31')],_0x3247cd[_0xcbd1('0x3c')]));if(_0x1df70b[_0xcbd1('0x31')][_0xcbd1('0x3d')]){_0x547056[_0xcbd1('0x3f')]=_[_0xcbd1('0x3e')](_0x547056['where'],{'$or':_[_0xcbd1('0x30')](_0x547056['attributes'],function(_0x53a293){var _0x5e5248={};_0x5e5248[_0x53a293]={'$like':'%'+_0x1df70b[_0xcbd1('0x31')][_0xcbd1('0x3d')]+'%'};return _0x5e5248;})});}_0x547056=_[_0xcbd1('0x3e')]({},_0x547056,_0x1df70b['options']);return _0x1708cd[_0xcbd1('0x4a')](_0x547056);}})[_0xcbd1('0x27')](function(_0x55aefe){if(_0x55aefe){_0xad7c33=_0x55aefe['length'];if(!_0x1df70b[_0xcbd1('0x31')][_0xcbd1('0x38')](_0xcbd1('0x39'))){_0x547056[_0xcbd1('0x1f')]=qs[_0xcbd1('0x1f')](_0x1df70b[_0xcbd1('0x31')][_0xcbd1('0x1f')]);_0x547056['offset']=qs[_0xcbd1('0x1d')](_0x1df70b[_0xcbd1('0x31')][_0xcbd1('0x1d')]);}return _0x1708cd[_0xcbd1('0x4a')](_0x547056);}})[_0xcbd1('0x27')](function(_0x39668f){if(_0x39668f){return _0x39668f?{'count':_0xad7c33,'rows':_0x39668f}:null;}})['then'](respondWithResult(_0x422f30,null))[_0xcbd1('0x45')](handleError(_0x422f30,null));};exports[_0xcbd1('0x4d')]=function(_0x15eca5,_0x168a56,_0x2d6b6f){if(_0x15eca5[_0xcbd1('0x49')]['id']){delete _0x15eca5[_0xcbd1('0x49')]['id'];}return db[_0xcbd1('0x43')][_0xcbd1('0x4e')]({'where':{'id':_0x15eca5[_0xcbd1('0x4b')]['id']}})[_0xcbd1('0x27')](handleEntityNotFound(_0x168a56,null))[_0xcbd1('0x27')](function(_0x3669da){if(_0x3669da){_0x15eca5[_0xcbd1('0x49')][_0xcbd1('0x4f')]=_0x3669da['id'];_0x15eca5[_0xcbd1('0x49')][_0xcbd1('0x50')]=integrations[_0xcbd1('0x51')](_0x15eca5[_0xcbd1('0x49')][_0xcbd1('0x52')],_0x15eca5[_0xcbd1('0x49')][_0xcbd1('0x2e')]);_0x15eca5[_0xcbd1('0x49')]['Descriptions']=integrations['getDescriptions'](_0x15eca5[_0xcbd1('0x49')][_0xcbd1('0x52')],_0x15eca5[_0xcbd1('0x49')][_0xcbd1('0x2e')]);return db['DeskConfiguration'][_0xcbd1('0x48')](_0x15eca5['body'],{'include':[{'model':db['DeskField'],'as':_0xcbd1('0x50')},{'model':db['DeskField'],'as':_0xcbd1('0x53')}]});}return null;})[_0xcbd1('0x27')](respondWithResult(_0x168a56,null))[_0xcbd1('0x45')](handleError(_0x168a56,null));};exports[_0xcbd1('0x54')]=function(_0x2a231b,_0x25b9a8,_0x335038){var _0x5521d4=[{'name':_0xcbd1('0x55'),'label':_0xcbd1('0x55'),'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 _0x25cc85='';return db['DeskAccount']['findOne']({'where':{'id':_0x2a231b[_0xcbd1('0x4b')]['id']},'attributes':['id',_0xcbd1('0x56'),_0xcbd1('0x57'),_0xcbd1('0x58'),_0xcbd1('0x59'),_0xcbd1('0x5a'),_0xcbd1('0x5b'),_0xcbd1('0x5c'),'tokenSecret']})[_0xcbd1('0x27')](handleEntityNotFound(_0x25b9a8,null))[_0xcbd1('0x27')](function(_0x4563d9){if(_0x4563d9){_0x25cc85=_0x4563d9[_0xcbd1('0x56')];var _0x44776c=_0x25cc85['slice'](-0x1);if(_0x44776c==='/'){_0x25cc85=_0x25cc85['substring'](0x0,_0x25cc85[_0xcbd1('0x5d')](_0x44776c));}var _0x45b343={'method':'GET','uri':util[_0xcbd1('0x5e')](_0xcbd1('0x5f'),_0x25cc85),'headers':{'Content-Type':_0xcbd1('0x60'),'Accept':'application/json'},'json':!![]};if(_0x4563d9[_0xcbd1('0x57')]==='basic'){_0x45b343[_0xcbd1('0x61')]['Authorization']=util[_0xcbd1('0x5e')]('Basic\x20%s',new Buffer(util[_0xcbd1('0x5e')](_0xcbd1('0x62'),_0x4563d9[_0xcbd1('0x58')],_0x4563d9['password']))[_0xcbd1('0x63')](_0xcbd1('0x64')));}return rp(_0x45b343)[_0xcbd1('0x27')](function(_0x532b25){return _0x5521d4[_0xcbd1('0x65')](_[_0xcbd1('0x30')](_0x532b25['_embedded'][_0xcbd1('0x66')],function(_0x4ea1f2){return{'id':_0x4ea1f2[_0xcbd1('0x2a')],'name':_0x4ea1f2[_0xcbd1('0x2a')],'type':_0x4ea1f2['type'],'active':_0x4ea1f2[_0xcbd1('0x67')],'label':_0x4ea1f2[_0xcbd1('0x68')],'custom':!![]};}));});}})[_0xcbd1('0x27')](function(_0x2b068c){return{'count':_0x2b068c[_0xcbd1('0x37')],'rows':_0x2b068c};})['then'](respondWithResult(_0x25b9a8,null))[_0xcbd1('0x45')](function(_0x524481){var _0x51f1d7=_0x2a231b[_0xcbd1('0x31')]['test']?0x1f4:_0x524481[_0xcbd1('0x69')]||0x1f4;logger[_0xcbd1('0x6a')](_0xcbd1('0x6b'),_0xcbd1('0x54'),_0x51f1d7,JSON['stringify'](_0x524481));delete _0x524481[_0xcbd1('0x2a')];if(_0x51f1d7===0x191){_0x51f1d7=0x190;}_0x25b9a8[_0xcbd1('0x1c')](_0x51f1d7)[_0xcbd1('0x6c')](_0x2a231b[_0xcbd1('0x31')][_0xcbd1('0x6d')]?{'message':_0xcbd1('0x6e'),'statusCode':_0x524481[_0xcbd1('0x69')]}:_0x524481);});}; \ No newline at end of file +var _0xc2a3=['set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','DeskAccount','rawAttributes','fieldName','type','key','map','query','keys','filters','model','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','fields','find','catch','create','body','getConfigurations','findOne','DeskConfiguration','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','username','password','consumerKey','consumerSecret','token','tokenSecret','remoteUri','slice','lastIndexOf','GET','%s/custom_fields','application/json','authType','headers','Basic\x20%s','format','%s:%s','toString','concat','_embedded','entries','active','label','test','statusCode','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','undefined','offset','count','limit'];(function(_0xcc4c5f,_0x492728){var _0x5911bb=function(_0x2bf44e){while(--_0x2bf44e){_0xcc4c5f['push'](_0xcc4c5f['shift']());}};_0x5911bb(++_0x492728);}(_0xc2a3,0x13c));var _0x3c2a=function(_0x3c4f1f,_0x20d3ec){_0x3c4f1f=_0x3c4f1f-0x0;var _0x19cb69=_0xc2a3[_0x3c4f1f];return _0x19cb69;};'use strict';var emlformat=require(_0x3c2a('0x0'));var rimraf=require(_0x3c2a('0x1'));var zipdir=require(_0x3c2a('0x2'));var jsonpatch=require(_0x3c2a('0x3'));var rp=require(_0x3c2a('0x4'));var moment=require(_0x3c2a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3c2a('0x6'));var path=require(_0x3c2a('0x7'));var sox=require(_0x3c2a('0x8'));var csv=require(_0x3c2a('0x9'));var ejs=require(_0x3c2a('0xa'));var fs=require('fs');var fs_extra=require(_0x3c2a('0xb'));var _=require(_0x3c2a('0xc'));var squel=require(_0x3c2a('0xd'));var crypto=require('crypto');var jsforce=require(_0x3c2a('0xe'));var deskjs=require(_0x3c2a('0xf'));var toCsv=require(_0x3c2a('0x9'));var querystring=require(_0x3c2a('0x10'));var Papa=require(_0x3c2a('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3c2a('0x12'));var as=require(_0x3c2a('0x13'));var hardwareService=require(_0x3c2a('0x14'));var logger=require(_0x3c2a('0x15'))(_0x3c2a('0x16'));var utils=require(_0x3c2a('0x17'));var config=require(_0x3c2a('0x18'));var licenseUtil=require(_0x3c2a('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x3c2a('0x1a'));function respondWithStatusCode(_0x4942eb,_0x513c93){_0x513c93=_0x513c93||0xcc;return function(_0x2ee8e0){if(_0x2ee8e0){return _0x4942eb[_0x3c2a('0x1b')](_0x513c93);}return _0x4942eb['status'](_0x513c93)[_0x3c2a('0x1c')]();};}function respondWithResult(_0x54933a,_0x432455){_0x432455=_0x432455||0xc8;return function(_0x3faa9c){if(_0x3faa9c){return _0x54933a[_0x3c2a('0x1d')](_0x432455)[_0x3c2a('0x1e')](_0x3faa9c);}};}function respondWithFilteredResult(_0x16e72b,_0x5738cf){return function(_0x2e5b45){if(_0x2e5b45){var _0x464447=typeof _0x5738cf['offset']==='undefined'&&typeof _0x5738cf['limit']===_0x3c2a('0x1f');var _0x3d266c=_0x2e5b45['count'];var _0x48c8bf=_0x464447?0x0:_0x5738cf[_0x3c2a('0x20')];var _0x1ceb4a=_0x464447?_0x2e5b45[_0x3c2a('0x21')]:_0x5738cf[_0x3c2a('0x20')]+_0x5738cf[_0x3c2a('0x22')];var _0x2050d8;if(_0x1ceb4a>=_0x3d266c){_0x1ceb4a=_0x3d266c;_0x2050d8=0xc8;}else{_0x2050d8=0xce;}_0x16e72b[_0x3c2a('0x1d')](_0x2050d8);return _0x16e72b[_0x3c2a('0x23')](_0x3c2a('0x24'),_0x48c8bf+'-'+_0x1ceb4a+'/'+_0x3d266c)[_0x3c2a('0x1e')](_0x2e5b45);}return null;};}function patchUpdates(_0x2448dc){return function(_0x17eb75){try{jsonpatch[_0x3c2a('0x25')](_0x17eb75,_0x2448dc,!![]);}catch(_0x4499d6){return BPromise[_0x3c2a('0x26')](_0x4499d6);}return _0x17eb75['save']();};}function saveUpdates(_0x1d872d,_0x557954){return function(_0x5c5e4d){if(_0x5c5e4d){return _0x5c5e4d[_0x3c2a('0x27')](_0x1d872d)[_0x3c2a('0x28')](function(_0xb502d9){return _0xb502d9;});}return null;};}function removeEntity(_0x4adc08,_0x3aa2b0){return function(_0x57fc43){if(_0x57fc43){return _0x57fc43[_0x3c2a('0x29')]()['then'](function(){_0x4adc08[_0x3c2a('0x1d')](0xcc)[_0x3c2a('0x1c')]();});}};}function handleEntityNotFound(_0x5445b2,_0x4e56da){return function(_0x17ad17){if(!_0x17ad17){_0x5445b2[_0x3c2a('0x1b')](0x194);}return _0x17ad17;};}function handleError(_0x4b4f6b,_0x16f3b9){_0x16f3b9=_0x16f3b9||0x1f4;return function(_0x5085e2){logger[_0x3c2a('0x2a')](_0x5085e2[_0x3c2a('0x2b')]);if(_0x5085e2[_0x3c2a('0x2c')]){delete _0x5085e2[_0x3c2a('0x2c')];}_0x4b4f6b[_0x3c2a('0x1d')](_0x16f3b9)[_0x3c2a('0x2d')](_0x5085e2);};}exports['index']=function(_0x3a0724,_0x5d1b2c){var _0x4e5dee={},_0x2f7bcc={},_0x918036={'count':0x0,'rows':[]};var _0x497075=_['map'](db[_0x3c2a('0x2e')][_0x3c2a('0x2f')],function(_0x3ca30d){return{'name':_0x3ca30d[_0x3c2a('0x30')],'type':_0x3ca30d[_0x3c2a('0x31')][_0x3c2a('0x32')]};});_0x2f7bcc['model']=_[_0x3c2a('0x33')](_0x497075,_0x3c2a('0x2c'));_0x2f7bcc[_0x3c2a('0x34')]=_[_0x3c2a('0x35')](_0x3a0724[_0x3c2a('0x34')]);_0x2f7bcc[_0x3c2a('0x36')]=_['intersection'](_0x2f7bcc[_0x3c2a('0x37')],_0x2f7bcc[_0x3c2a('0x34')]);_0x4e5dee['attributes']=_[_0x3c2a('0x38')](_0x2f7bcc[_0x3c2a('0x37')],qs['fields'](_0x3a0724[_0x3c2a('0x34')]['fields']));_0x4e5dee[_0x3c2a('0x39')]=_0x4e5dee[_0x3c2a('0x39')][_0x3c2a('0x3a')]?_0x4e5dee[_0x3c2a('0x39')]:_0x2f7bcc[_0x3c2a('0x37')];if(!_0x3a0724[_0x3c2a('0x34')][_0x3c2a('0x3b')](_0x3c2a('0x3c'))){_0x4e5dee[_0x3c2a('0x22')]=qs[_0x3c2a('0x22')](_0x3a0724[_0x3c2a('0x34')]['limit']);_0x4e5dee[_0x3c2a('0x20')]=qs['offset'](_0x3a0724[_0x3c2a('0x34')][_0x3c2a('0x20')]);}_0x4e5dee[_0x3c2a('0x3d')]=qs['sort'](_0x3a0724['query'][_0x3c2a('0x3e')]);_0x4e5dee[_0x3c2a('0x3f')]=qs[_0x3c2a('0x36')](_[_0x3c2a('0x40')](_0x3a0724[_0x3c2a('0x34')],_0x2f7bcc[_0x3c2a('0x36')]),_0x497075);if(_0x3a0724[_0x3c2a('0x34')][_0x3c2a('0x41')]){_0x4e5dee[_0x3c2a('0x3f')]=_[_0x3c2a('0x42')](_0x4e5dee[_0x3c2a('0x3f')],{'$or':_[_0x3c2a('0x33')](_0x497075,function(_0x3bc85d){if(_0x3bc85d[_0x3c2a('0x31')]!==_0x3c2a('0x43')){var _0x231f2d={};_0x231f2d[_0x3bc85d[_0x3c2a('0x2c')]]={'$like':'%'+_0x3a0724[_0x3c2a('0x34')]['filter']+'%'};return _0x231f2d;}})});}_0x4e5dee=_['merge']({},_0x4e5dee,_0x3a0724[_0x3c2a('0x44')]);var _0x5618c9={'where':_0x4e5dee[_0x3c2a('0x3f')]};return db[_0x3c2a('0x2e')][_0x3c2a('0x21')](_0x5618c9)[_0x3c2a('0x28')](function(_0x149277){_0x918036[_0x3c2a('0x21')]=_0x149277;if(_0x3a0724[_0x3c2a('0x34')][_0x3c2a('0x45')]){_0x4e5dee[_0x3c2a('0x46')]=[{'all':!![]}];}return db[_0x3c2a('0x2e')]['findAll'](_0x4e5dee);})['then'](function(_0x1fc041){_0x918036[_0x3c2a('0x47')]=_0x1fc041;return _0x918036;})[_0x3c2a('0x28')](respondWithFilteredResult(_0x5d1b2c,_0x4e5dee))['catch'](handleError(_0x5d1b2c,null));};exports[_0x3c2a('0x48')]=function(_0x4ae53a,_0x48746e){var _0x339951={'raw':![],'where':{'id':_0x4ae53a[_0x3c2a('0x49')]['id']}},_0x6f6c9e={};_0x6f6c9e[_0x3c2a('0x37')]=_[_0x3c2a('0x35')](db[_0x3c2a('0x2e')][_0x3c2a('0x2f')]);_0x6f6c9e['query']=_[_0x3c2a('0x35')](_0x4ae53a[_0x3c2a('0x34')]);_0x6f6c9e[_0x3c2a('0x36')]=_[_0x3c2a('0x38')](_0x6f6c9e[_0x3c2a('0x37')],_0x6f6c9e[_0x3c2a('0x34')]);_0x339951['attributes']=_['intersection'](_0x6f6c9e['model'],qs[_0x3c2a('0x4a')](_0x4ae53a[_0x3c2a('0x34')][_0x3c2a('0x4a')]));_0x339951[_0x3c2a('0x39')]=_0x339951['attributes']['length']?_0x339951[_0x3c2a('0x39')]:_0x6f6c9e[_0x3c2a('0x37')];if(_0x4ae53a['query'][_0x3c2a('0x45')]){_0x339951['include']=[{'all':!![]}];}_0x339951=_[_0x3c2a('0x42')]({},_0x339951,_0x4ae53a[_0x3c2a('0x44')]);return db[_0x3c2a('0x2e')][_0x3c2a('0x4b')](_0x339951)['then'](handleEntityNotFound(_0x48746e,null))[_0x3c2a('0x28')](respondWithResult(_0x48746e,null))[_0x3c2a('0x4c')](handleError(_0x48746e,null));};exports[_0x3c2a('0x4d')]=function(_0x3ceadd,_0x31dafe){return db[_0x3c2a('0x2e')][_0x3c2a('0x4d')](_0x3ceadd[_0x3c2a('0x4e')],{})['then'](respondWithResult(_0x31dafe,0xc9))['catch'](handleError(_0x31dafe,null));};exports[_0x3c2a('0x27')]=function(_0x843013,_0x4a5422){if(_0x843013[_0x3c2a('0x4e')]['id']){delete _0x843013[_0x3c2a('0x4e')]['id'];}return db[_0x3c2a('0x2e')][_0x3c2a('0x4b')]({'where':{'id':_0x843013['params']['id']}})[_0x3c2a('0x28')](handleEntityNotFound(_0x4a5422,null))[_0x3c2a('0x28')](saveUpdates(_0x843013['body'],null))[_0x3c2a('0x28')](respondWithResult(_0x4a5422,null))['catch'](handleError(_0x4a5422,null));};exports[_0x3c2a('0x29')]=function(_0xbedfc6,_0x821f24){return db[_0x3c2a('0x2e')][_0x3c2a('0x4b')]({'where':{'id':_0xbedfc6['params']['id']}})[_0x3c2a('0x28')](handleEntityNotFound(_0x821f24,null))[_0x3c2a('0x28')](removeEntity(_0x821f24,null))[_0x3c2a('0x4c')](handleError(_0x821f24,null));};exports[_0x3c2a('0x4f')]=function(_0x58deb8,_0x1873b7,_0x473553){var _0x2439de={};var _0x24365d={};var _0x237195;var _0x5b960f;return db['DeskAccount'][_0x3c2a('0x50')]({'where':{'id':_0x58deb8[_0x3c2a('0x49')]['id']}})[_0x3c2a('0x28')](handleEntityNotFound(_0x1873b7,null))[_0x3c2a('0x28')](function(_0x2868f4){if(_0x2868f4){_0x237195=_0x2868f4;_0x24365d[_0x3c2a('0x37')]=_[_0x3c2a('0x35')](db[_0x3c2a('0x51')][_0x3c2a('0x2f')]);_0x24365d[_0x3c2a('0x34')]=_[_0x3c2a('0x35')](_0x58deb8[_0x3c2a('0x34')]);_0x24365d[_0x3c2a('0x36')]=_['intersection'](_0x24365d['model'],_0x24365d['query']);_0x2439de[_0x3c2a('0x39')]=_[_0x3c2a('0x38')](_0x24365d['model'],qs[_0x3c2a('0x4a')](_0x58deb8[_0x3c2a('0x34')][_0x3c2a('0x4a')]));_0x2439de[_0x3c2a('0x39')]=_0x2439de[_0x3c2a('0x39')][_0x3c2a('0x3a')]?_0x2439de[_0x3c2a('0x39')]:_0x24365d[_0x3c2a('0x37')];_0x2439de['order']=qs[_0x3c2a('0x3e')](_0x58deb8[_0x3c2a('0x34')][_0x3c2a('0x3e')]);_0x2439de[_0x3c2a('0x3f')]=qs[_0x3c2a('0x36')](_[_0x3c2a('0x40')](_0x58deb8[_0x3c2a('0x34')],_0x24365d[_0x3c2a('0x36')]));if(_0x58deb8['query'][_0x3c2a('0x41')]){_0x2439de[_0x3c2a('0x3f')]=_[_0x3c2a('0x42')](_0x2439de[_0x3c2a('0x3f')],{'$or':_[_0x3c2a('0x33')](_0x2439de[_0x3c2a('0x39')],function(_0xcaf179){var _0x14ac4e={};_0x14ac4e[_0xcaf179]={'$like':'%'+_0x58deb8[_0x3c2a('0x34')][_0x3c2a('0x41')]+'%'};return _0x14ac4e;})});}_0x2439de=_[_0x3c2a('0x42')]({},_0x2439de,_0x58deb8['options']);return _0x237195[_0x3c2a('0x4f')](_0x2439de);}})[_0x3c2a('0x28')](function(_0x2de40f){if(_0x2de40f){_0x5b960f=_0x2de40f['length'];if(!_0x58deb8[_0x3c2a('0x34')][_0x3c2a('0x3b')](_0x3c2a('0x3c'))){_0x2439de[_0x3c2a('0x22')]=qs[_0x3c2a('0x22')](_0x58deb8[_0x3c2a('0x34')]['limit']);_0x2439de['offset']=qs['offset'](_0x58deb8['query']['offset']);}return _0x237195[_0x3c2a('0x4f')](_0x2439de);}})[_0x3c2a('0x28')](function(_0xf55515){if(_0xf55515){return _0xf55515?{'count':_0x5b960f,'rows':_0xf55515}:null;}})[_0x3c2a('0x28')](respondWithResult(_0x1873b7,null))[_0x3c2a('0x4c')](handleError(_0x1873b7,null));};exports[_0x3c2a('0x52')]=function(_0x3f3493,_0x281951,_0x27fbaa){if(_0x3f3493[_0x3c2a('0x4e')]['id']){delete _0x3f3493[_0x3c2a('0x4e')]['id'];}return db['DeskAccount'][_0x3c2a('0x50')]({'where':{'id':_0x3f3493[_0x3c2a('0x49')]['id']}})[_0x3c2a('0x28')](handleEntityNotFound(_0x281951,null))['then'](function(_0xea9c99){if(_0xea9c99){_0x3f3493[_0x3c2a('0x4e')]['AccountId']=_0xea9c99['id'];_0x3f3493['body'][_0x3c2a('0x53')]=integrations[_0x3c2a('0x54')](_0x3f3493[_0x3c2a('0x4e')][_0x3c2a('0x55')],_0x3f3493['body']['type']);_0x3f3493[_0x3c2a('0x4e')][_0x3c2a('0x56')]=integrations[_0x3c2a('0x57')](_0x3f3493['body'][_0x3c2a('0x55')],_0x3f3493[_0x3c2a('0x4e')][_0x3c2a('0x31')]);return db['DeskConfiguration'][_0x3c2a('0x4d')](_0x3f3493[_0x3c2a('0x4e')],{'include':[{'model':db[_0x3c2a('0x58')],'as':_0x3c2a('0x53')},{'model':db[_0x3c2a('0x58')],'as':_0x3c2a('0x56')}]});}return null;})[_0x3c2a('0x28')](respondWithResult(_0x281951,null))['catch'](handleError(_0x281951,null));};exports[_0x3c2a('0x59')]=function(_0x148b3a,_0x243f87,_0x2212e9){var _0x43ce27=[{'name':_0x3c2a('0x5a'),'label':_0x3c2a('0x5a'),'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 _0x1721cb='';return db['DeskAccount']['findOne']({'where':{'id':_0x148b3a['params']['id']},'attributes':['id','remoteUri','authType',_0x3c2a('0x5b'),_0x3c2a('0x5c'),_0x3c2a('0x5d'),_0x3c2a('0x5e'),_0x3c2a('0x5f'),_0x3c2a('0x60')]})[_0x3c2a('0x28')](handleEntityNotFound(_0x243f87,null))[_0x3c2a('0x28')](function(_0x306b10){if(_0x306b10){_0x1721cb=_0x306b10[_0x3c2a('0x61')];var _0x178a87=_0x1721cb[_0x3c2a('0x62')](-0x1);if(_0x178a87==='/'){_0x1721cb=_0x1721cb['substring'](0x0,_0x1721cb[_0x3c2a('0x63')](_0x178a87));}var _0x55c3e7={'method':_0x3c2a('0x64'),'uri':util['format'](_0x3c2a('0x65'),_0x1721cb),'headers':{'Content-Type':_0x3c2a('0x66'),'Accept':'application/json'},'json':!![]};if(_0x306b10[_0x3c2a('0x67')]==='basic'){_0x55c3e7[_0x3c2a('0x68')]['Authorization']=util['format'](_0x3c2a('0x69'),new Buffer(util[_0x3c2a('0x6a')](_0x3c2a('0x6b'),_0x306b10[_0x3c2a('0x5b')],_0x306b10[_0x3c2a('0x5c')]))[_0x3c2a('0x6c')]('base64'));}return rp(_0x55c3e7)['then'](function(_0x48274b){return _0x43ce27[_0x3c2a('0x6d')](_[_0x3c2a('0x33')](_0x48274b[_0x3c2a('0x6e')][_0x3c2a('0x6f')],function(_0x5b687b){return{'id':_0x5b687b['name'],'name':_0x5b687b[_0x3c2a('0x2c')],'type':_0x5b687b[_0x3c2a('0x31')],'active':_0x5b687b[_0x3c2a('0x70')],'label':_0x5b687b[_0x3c2a('0x71')],'custom':!![]};}));});}})[_0x3c2a('0x28')](function(_0x9db90c){return{'count':_0x9db90c['length'],'rows':_0x9db90c};})[_0x3c2a('0x28')](respondWithResult(_0x243f87,null))[_0x3c2a('0x4c')](function(_0x57c678){var _0x5a2305=_0x148b3a[_0x3c2a('0x34')][_0x3c2a('0x72')]?0x1f4:_0x57c678[_0x3c2a('0x73')]||0x1f4;logger[_0x3c2a('0x2a')]('getFields,\x20%s,\x20%s,\x20%s',_0x3c2a('0x59'),_0x5a2305,JSON[_0x3c2a('0x74')](_0x57c678));delete _0x57c678[_0x3c2a('0x2c')];if(_0x5a2305===0x191){_0x5a2305=0x190;}_0x243f87[_0x3c2a('0x1d')](_0x5a2305)[_0x3c2a('0x2d')](_0x148b3a[_0x3c2a('0x34')][_0x3c2a('0x72')]?{'message':'Wrong\x20credentials','statusCode':_0x57c678[_0x3c2a('0x73')]}:_0x57c678);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 45777f6..2ac440a 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 _0xe00a=['api','moment','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','DeskAccount','int_desk_accounts','lodash','../../config/logger'];(function(_0xd22c48,_0x350cfe){var _0x48fa79=function(_0x43c895){while(--_0x43c895){_0xd22c48['push'](_0xd22c48['shift']());}};_0x48fa79(++_0x350cfe);}(_0xe00a,0x1ab));var _0xae00=function(_0x1b8b9c,_0x31dc20){_0x1b8b9c=_0x1b8b9c-0x0;var _0x25844a=_0xe00a[_0x1b8b9c];return _0x25844a;};'use strict';var _=require(_0xae00('0x0'));var util=require('util');var logger=require(_0xae00('0x1'))(_0xae00('0x2'));var moment=require(_0xae00('0x3'));var BPromise=require('bluebird');var rp=require(_0xae00('0x4'));var fs=require('fs');var path=require(_0xae00('0x5'));var rimraf=require(_0xae00('0x6'));var config=require(_0xae00('0x7'));var attributes=require(_0xae00('0x8'));var integrations=require(_0xae00('0x9'));module[_0xae00('0xa')]=function(_0x254f5e,_0x4b9858){return _0x254f5e['define'](_0xae00('0xb'),attributes,{'tableName':_0xae00('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8ed=['bluebird','request-promise','path','../../config/environment','./intDeskAccount.attributes','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x4d7e3f,_0x198643){var _0x159267=function(_0x258c72){while(--_0x258c72){_0x4d7e3f['push'](_0x4d7e3f['shift']());}};_0x159267(++_0x198643);}(_0xd8ed,0x133));var _0xdd8e=function(_0x4f622c,_0x3707cf){_0x4f622c=_0x4f622c-0x0;var _0x51558d=_0xd8ed[_0x4f622c];return _0x51558d;};'use strict';var _=require(_0xdd8e('0x0'));var util=require(_0xdd8e('0x1'));var logger=require(_0xdd8e('0x2'))(_0xdd8e('0x3'));var moment=require(_0xdd8e('0x4'));var BPromise=require(_0xdd8e('0x5'));var rp=require(_0xdd8e('0x6'));var fs=require('fs');var path=require(_0xdd8e('0x7'));var rimraf=require('rimraf');var config=require(_0xdd8e('0x8'));var attributes=require(_0xdd8e('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x349e99,_0x10a279){return _0x349e99[_0xdd8e('0xa')](_0xdd8e('0xb'),attributes,{'tableName':_0xdd8e('0xc'),'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 7b44b78..a3290ad 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 _0x8065=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetDeskAccount','findAll','options','where','attributes','limit','include','map','model','catch','DeskAccount','find','raw','ShowDeskAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x153dd4,_0x45c990){var _0x24b6f8=function(_0x3c1f21){while(--_0x3c1f21){_0x153dd4['push'](_0x153dd4['shift']());}};_0x24b6f8(++_0x45c990);}(_0x8065,0x1ce));var _0x5806=function(_0x2a1349,_0x50602d){_0x2a1349=_0x2a1349-0x0;var _0x2dd607=_0x8065[_0x2a1349];return _0x2dd607;};'use strict';var _=require('lodash');var util=require(_0x5806('0x0'));var moment=require(_0x5806('0x1'));var BPromise=require(_0x5806('0x2'));var rs=require(_0x5806('0x3'));var fs=require('fs');var Redis=require(_0x5806('0x4'));var db=require(_0x5806('0x5'))['db'];var utils=require(_0x5806('0x6'));var logger=require(_0x5806('0x7'))(_0x5806('0x8'));var config=require(_0x5806('0x9'));var jayson=require(_0x5806('0xa'));var client=jayson[_0x5806('0xb')][_0x5806('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4c236d,_0x395603,_0x4190f1){return new BPromise(function(_0x370a30,_0x5c5e9a){return client[_0x5806('0xd')](_0x4c236d,_0x4190f1)[_0x5806('0xe')](function(_0x39f35d){logger[_0x5806('0xf')](_0x5806('0x10'),_0x395603,_0x5806('0x11'));logger[_0x5806('0x12')](_0x5806('0x13'),_0x395603,_0x5806('0x11'),JSON[_0x5806('0x14')](_0x39f35d));if(_0x39f35d[_0x5806('0x15')]){if(_0x39f35d['error'][_0x5806('0x16')]===0x1f4){logger['error'](_0x5806('0x10'),_0x395603,_0x39f35d['error'][_0x5806('0x17')]);return _0x5c5e9a(_0x39f35d[_0x5806('0x15')][_0x5806('0x17')]);}logger[_0x5806('0x15')](_0x5806('0x10'),_0x395603,_0x39f35d['error'][_0x5806('0x17')]);return _0x370a30(_0x39f35d['error']['message']);}else{logger[_0x5806('0xf')](_0x5806('0x10'),_0x395603,_0x5806('0x11'));_0x370a30(_0x39f35d[_0x5806('0x18')][_0x5806('0x17')]);}})['catch'](function(_0x129de2){logger[_0x5806('0x15')](_0x5806('0x10'),_0x395603,_0x129de2);_0x5c5e9a(_0x129de2);});});}exports[_0x5806('0x19')]=function(_0x5775ee){var _0x550089=this;return new Promise(function(_0xe49f6c,_0x5bb943){return db['DeskAccount'][_0x5806('0x1a')]({'raw':_0x5775ee[_0x5806('0x1b')]?_0x5775ee[_0x5806('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x5775ee[_0x5806('0x1b')]?_0x5775ee[_0x5806('0x1b')][_0x5806('0x1c')]||null:null,'attributes':_0x5775ee[_0x5806('0x1b')]?_0x5775ee['options'][_0x5806('0x1d')]||null:null,'limit':_0x5775ee['options']?_0x5775ee[_0x5806('0x1b')][_0x5806('0x1e')]||null:null,'include':_0x5775ee[_0x5806('0x1b')]?_0x5775ee['options'][_0x5806('0x1f')]?_[_0x5806('0x20')](_0x5775ee[_0x5806('0x1b')]['include'],function(_0xe56c74){return{'model':db[_0xe56c74[_0x5806('0x21')]],'as':_0xe56c74['as'],'attributes':_0xe56c74[_0x5806('0x1d')],'include':_0xe56c74[_0x5806('0x1f')]?_[_0x5806('0x20')](_0xe56c74[_0x5806('0x1f')],function(_0x105db4){return{'model':db[_0x105db4['model']],'as':_0x105db4['as'],'attributes':_0x105db4[_0x5806('0x1d')],'include':_0x105db4[_0x5806('0x1f')]?_[_0x5806('0x20')](_0x105db4[_0x5806('0x1f')],function(_0xb2c015){return{'model':db[_0xb2c015['model']],'as':_0xb2c015['as'],'attributes':_0xb2c015[_0x5806('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5806('0xe')](function(_0x50f47a){logger['info'](_0x5806('0x19'),_0x5775ee);logger[_0x5806('0x12')](_0x5806('0x19'),_0x5775ee,JSON[_0x5806('0x14')](_0x50f47a));_0xe49f6c(_0x50f47a);})[_0x5806('0x22')](function(_0x42ea07){logger[_0x5806('0x15')]('GetDeskAccount',_0x42ea07[_0x5806('0x17')],_0x5775ee);_0x5bb943(_0x550089[_0x5806('0x15')](0x1f4,_0x42ea07[_0x5806('0x17')]));});});};exports['ShowDeskAccount']=function(_0x49e0c9){var _0x5e1c41=this;return new Promise(function(_0x1763a4,_0x45b8dd){return db[_0x5806('0x23')][_0x5806('0x24')]({'raw':_0x49e0c9[_0x5806('0x1b')]?_0x49e0c9['options'][_0x5806('0x25')]===undefined?!![]:![]:!![],'where':_0x49e0c9[_0x5806('0x1b')]?_0x49e0c9[_0x5806('0x1b')][_0x5806('0x1c')]||null:null,'attributes':_0x49e0c9[_0x5806('0x1b')]?_0x49e0c9[_0x5806('0x1b')][_0x5806('0x1d')]||null:null,'include':_0x49e0c9[_0x5806('0x1b')]?_0x49e0c9[_0x5806('0x1b')][_0x5806('0x1f')]?_[_0x5806('0x20')](_0x49e0c9[_0x5806('0x1b')][_0x5806('0x1f')],function(_0x4dfe75){return{'model':db[_0x4dfe75[_0x5806('0x21')]],'as':_0x4dfe75['as'],'attributes':_0x4dfe75[_0x5806('0x1d')],'include':_0x4dfe75['include']?_['map'](_0x4dfe75[_0x5806('0x1f')],function(_0x323b02){return{'model':db[_0x323b02[_0x5806('0x21')]],'as':_0x323b02['as'],'attributes':_0x323b02[_0x5806('0x1d')],'include':_0x323b02[_0x5806('0x1f')]?_[_0x5806('0x20')](_0x323b02[_0x5806('0x1f')],function(_0x2750cb){return{'model':db[_0x2750cb[_0x5806('0x21')]],'as':_0x2750cb['as'],'attributes':_0x2750cb[_0x5806('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5806('0xe')](function(_0x40d5b8){logger['info'](_0x5806('0x26'),_0x49e0c9);logger[_0x5806('0x12')]('ShowDeskAccount',_0x49e0c9,JSON['stringify'](_0x40d5b8));_0x1763a4(_0x40d5b8);})[_0x5806('0x22')](function(_0x5d1d15){logger['error'](_0x5806('0x26'),_0x5d1d15['message'],_0x49e0c9);_0x45b8dd(_0x5e1c41[_0x5806('0x15')](0x1f4,_0x5d1d15[_0x5806('0x17')]));});});}; \ No newline at end of file +var _0xe5b5=['stringify','error','code','message','info','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','include','model','attributes','map','ShowDeskAccount','find','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x14ab54,_0x49bea9){var _0x3f8771=function(_0x43c930){while(--_0x43c930){_0x14ab54['push'](_0x14ab54['shift']());}};_0x3f8771(++_0x49bea9);}(_0xe5b5,0x122));var _0x5e5b=function(_0x2e2681,_0x4089c1){_0x2e2681=_0x2e2681-0x0;var _0x368a64=_0xe5b5[_0x2e2681];return _0x368a64;};'use strict';var _=require(_0x5e5b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5e5b('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5e5b('0x2'))['db'];var utils=require(_0x5e5b('0x3'));var logger=require(_0x5e5b('0x4'))(_0x5e5b('0x5'));var config=require(_0x5e5b('0x6'));var jayson=require(_0x5e5b('0x7'));var client=jayson[_0x5e5b('0x8')][_0x5e5b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x58b301,_0x11815b,_0x3c9019){return new BPromise(function(_0x10b301,_0x5e3a11){return client[_0x5e5b('0xa')](_0x58b301,_0x3c9019)[_0x5e5b('0xb')](function(_0x306a67){logger['info'](_0x5e5b('0xc'),_0x11815b,_0x5e5b('0xd'));logger[_0x5e5b('0xe')](_0x5e5b('0xf'),_0x11815b,_0x5e5b('0xd'),JSON[_0x5e5b('0x10')](_0x306a67));if(_0x306a67['error']){if(_0x306a67[_0x5e5b('0x11')][_0x5e5b('0x12')]===0x1f4){logger['error'](_0x5e5b('0xc'),_0x11815b,_0x306a67[_0x5e5b('0x11')]['message']);return _0x5e3a11(_0x306a67[_0x5e5b('0x11')][_0x5e5b('0x13')]);}logger['error'](_0x5e5b('0xc'),_0x11815b,_0x306a67[_0x5e5b('0x11')][_0x5e5b('0x13')]);return _0x10b301(_0x306a67[_0x5e5b('0x11')]['message']);}else{logger[_0x5e5b('0x14')](_0x5e5b('0xc'),_0x11815b,_0x5e5b('0xd'));_0x10b301(_0x306a67['result'][_0x5e5b('0x13')]);}})[_0x5e5b('0x15')](function(_0x458e99){logger[_0x5e5b('0x11')]('DeskAccount,\x20%s,\x20%s',_0x11815b,_0x458e99);_0x5e3a11(_0x458e99);});});}exports[_0x5e5b('0x16')]=function(_0x12631c){var _0x4f9eba=this;return new Promise(function(_0x22519f,_0x534132){return db[_0x5e5b('0x17')][_0x5e5b('0x18')]({'raw':_0x12631c[_0x5e5b('0x19')]?_0x12631c[_0x5e5b('0x19')][_0x5e5b('0x1a')]===undefined?!![]:![]:!![],'where':_0x12631c['options']?_0x12631c['options'][_0x5e5b('0x1b')]||null:null,'attributes':_0x12631c['options']?_0x12631c[_0x5e5b('0x19')]['attributes']||null:null,'limit':_0x12631c[_0x5e5b('0x19')]?_0x12631c[_0x5e5b('0x19')]['limit']||null:null,'include':_0x12631c['options']?_0x12631c['options'][_0x5e5b('0x1c')]?_['map'](_0x12631c[_0x5e5b('0x19')][_0x5e5b('0x1c')],function(_0x470237){return{'model':db[_0x470237[_0x5e5b('0x1d')]],'as':_0x470237['as'],'attributes':_0x470237[_0x5e5b('0x1e')],'include':_0x470237[_0x5e5b('0x1c')]?_['map'](_0x470237['include'],function(_0x571e65){return{'model':db[_0x571e65[_0x5e5b('0x1d')]],'as':_0x571e65['as'],'attributes':_0x571e65['attributes'],'include':_0x571e65[_0x5e5b('0x1c')]?_[_0x5e5b('0x1f')](_0x571e65['include'],function(_0x5aeffb){return{'model':db[_0x5aeffb['model']],'as':_0x5aeffb['as'],'attributes':_0x5aeffb[_0x5e5b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5e5b('0xb')](function(_0x2dbe40){logger['info'](_0x5e5b('0x16'),_0x12631c);logger[_0x5e5b('0xe')]('GetDeskAccount',_0x12631c,JSON[_0x5e5b('0x10')](_0x2dbe40));_0x22519f(_0x2dbe40);})[_0x5e5b('0x15')](function(_0x396b8c){logger[_0x5e5b('0x11')](_0x5e5b('0x16'),_0x396b8c['message'],_0x12631c);_0x534132(_0x4f9eba[_0x5e5b('0x11')](0x1f4,_0x396b8c[_0x5e5b('0x13')]));});});};exports[_0x5e5b('0x20')]=function(_0xb88fd6){var _0xbc74af=this;return new Promise(function(_0x315ce3,_0x112784){return db['DeskAccount'][_0x5e5b('0x21')]({'raw':_0xb88fd6['options']?_0xb88fd6[_0x5e5b('0x19')][_0x5e5b('0x1a')]===undefined?!![]:![]:!![],'where':_0xb88fd6[_0x5e5b('0x19')]?_0xb88fd6[_0x5e5b('0x19')]['where']||null:null,'attributes':_0xb88fd6[_0x5e5b('0x19')]?_0xb88fd6[_0x5e5b('0x19')]['attributes']||null:null,'include':_0xb88fd6[_0x5e5b('0x19')]?_0xb88fd6[_0x5e5b('0x19')][_0x5e5b('0x1c')]?_[_0x5e5b('0x1f')](_0xb88fd6[_0x5e5b('0x19')]['include'],function(_0x27ef4f){return{'model':db[_0x27ef4f[_0x5e5b('0x1d')]],'as':_0x27ef4f['as'],'attributes':_0x27ef4f[_0x5e5b('0x1e')],'include':_0x27ef4f[_0x5e5b('0x1c')]?_[_0x5e5b('0x1f')](_0x27ef4f[_0x5e5b('0x1c')],function(_0x504a9e){return{'model':db[_0x504a9e['model']],'as':_0x504a9e['as'],'attributes':_0x504a9e['attributes'],'include':_0x504a9e[_0x5e5b('0x1c')]?_[_0x5e5b('0x1f')](_0x504a9e[_0x5e5b('0x1c')],function(_0x4ee37d){return{'model':db[_0x4ee37d[_0x5e5b('0x1d')]],'as':_0x4ee37d['as'],'attributes':_0x4ee37d['attributes']};}):[]};}):[]};}):[]:[]})[_0x5e5b('0xb')](function(_0x212c7f){logger[_0x5e5b('0x14')](_0x5e5b('0x20'),_0xb88fd6);logger['debug'](_0x5e5b('0x20'),_0xb88fd6,JSON[_0x5e5b('0x10')](_0x212c7f));_0x315ce3(_0x212c7f);})[_0x5e5b('0x15')](function(_0x277d17){logger[_0x5e5b('0x11')](_0x5e5b('0x20'),_0x277d17[_0x5e5b('0x13')],_0xb88fd6);_0x112784(_0xbc74af[_0x5e5b('0x11')](0x1f4,_0x277d17['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 29265aa..a739496 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 _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x35f64d,_0x39977f){var _0x594c05=function(_0xd64e2b){while(--_0xd64e2b){_0x35f64d['push'](_0x35f64d['shift']());}};_0x594c05(++_0x39977f);}(_0xedd9,0xfc));var _0x9edd=function(_0xb0c522,_0x3b60d1){_0xb0c522=_0xb0c522-0x0;var _0x468364=_0xedd9[_0xb0c522];return _0x468364;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file +var _0x3e74=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','setTags','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x16f407,_0x56afbf){var _0x14264a=function(_0x33be02){while(--_0x33be02){_0x16f407['push'](_0x16f407['shift']());}};_0x14264a(++_0x56afbf);}(_0x3e74,0x175));var _0x43e7=function(_0x1924e6,_0x3653e8){_0x1924e6=_0x1924e6-0x0;var _0x2acec5=_0x3e74[_0x1924e6];return _0x2acec5;};'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('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/subjects',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/tags',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0x13'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router['put']('/:id',auth[_0x43e7('0x8')](),controller[_0x43e7('0x15')]);router[_0x43e7('0x16')](_0x43e7('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x43e7('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 b3c5d6e..4bfcec2 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 _0x8e1f=['sequelize','STRING'];(function(_0x12a111,_0x1eec41){var _0x1b56c4=function(_0x45588a){while(--_0x45588a){_0x12a111['push'](_0x12a111['shift']());}};_0x1b56c4(++_0x1eec41);}(_0x8e1f,0x6a));var _0xf8e1=function(_0x26a0d4,_0x4e402e){_0x26a0d4=_0x26a0d4-0x0;var _0x2302e6=_0x8e1f[_0x26a0d4];return _0x2302e6;};'use strict';var Sequelize=require(_0xf8e1('0x0'));module['exports']={'name':{'type':Sequelize[_0xf8e1('0x1')]},'description':{'type':Sequelize[_0xf8e1('0x1')]}}; \ No newline at end of file +var _0x5ba2=['sequelize','STRING'];(function(_0x3f7598,_0x212e37){var _0x51fb16=function(_0x4a5c0b){while(--_0x4a5c0b){_0x3f7598['push'](_0x3f7598['shift']());}};_0x51fb16(++_0x212e37);}(_0x5ba2,0xa8));var _0x25ba=function(_0x264545,_0x214037){_0x264545=_0x264545-0x0;var _0x114d10=_0x5ba2[_0x264545];return _0x114d10;};'use strict';var Sequelize=require(_0x25ba('0x0'));module['exports']={'name':{'type':Sequelize[_0x25ba('0x1')]},'description':{'type':Sequelize[_0x25ba('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index da3f422..eae65fe 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 _0xb4b4=['findOne','DeskField','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','DeskConfiguration','includeAll','findAll','rows','catch','show','rawAttributes','include','find','create','body','params','getFields'];(function(_0x28669c,_0x1f62c4){var _0x4a3af6=function(_0x3e25d5){while(--_0x3e25d5){_0x28669c['push'](_0x28669c['shift']());}};_0x4a3af6(++_0x1f62c4);}(_0xb4b4,0x10e));var _0x4b4b=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xb4b4[_0x15bc81];return _0x59440e;};'use strict';var emlformat=require(_0x4b4b('0x0'));var rimraf=require(_0x4b4b('0x1'));var zipdir=require(_0x4b4b('0x2'));var jsonpatch=require(_0x4b4b('0x3'));var rp=require(_0x4b4b('0x4'));var moment=require(_0x4b4b('0x5'));var BPromise=require(_0x4b4b('0x6'));var Mustache=require(_0x4b4b('0x7'));var util=require(_0x4b4b('0x8'));var path=require(_0x4b4b('0x9'));var sox=require(_0x4b4b('0xa'));var csv=require(_0x4b4b('0xb'));var ejs=require(_0x4b4b('0xc'));var fs=require('fs');var fs_extra=require(_0x4b4b('0xd'));var _=require('lodash');var squel=require(_0x4b4b('0xe'));var crypto=require(_0x4b4b('0xf'));var jsforce=require(_0x4b4b('0x10'));var deskjs=require(_0x4b4b('0x11'));var toCsv=require(_0x4b4b('0xb'));var querystring=require('querystring');var Papa=require(_0x4b4b('0x12'));var Redis=require('ioredis');var authService=require(_0x4b4b('0x13'));var qs=require(_0x4b4b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4b4b('0x15'));var logger=require(_0x4b4b('0x16'))(_0x4b4b('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4b4b('0x18'));var db=require(_0x4b4b('0x19'))['db'];function respondWithStatusCode(_0x686c86,_0x280e09){_0x280e09=_0x280e09||0xcc;return function(_0x3db4e4){if(_0x3db4e4){return _0x686c86[_0x4b4b('0x1a')](_0x280e09);}return _0x686c86[_0x4b4b('0x1b')](_0x280e09)[_0x4b4b('0x1c')]();};}function respondWithResult(_0x1e1d54,_0x562e3a){_0x562e3a=_0x562e3a||0xc8;return function(_0x43af38){if(_0x43af38){return _0x1e1d54[_0x4b4b('0x1b')](_0x562e3a)[_0x4b4b('0x1d')](_0x43af38);}};}function respondWithFilteredResult(_0x26dbe,_0xe897e2){return function(_0x497757){if(_0x497757){var _0x1c36c7=typeof _0xe897e2['offset']===_0x4b4b('0x1e')&&typeof _0xe897e2[_0x4b4b('0x1f')]==='undefined';var _0x2a143a=_0x497757[_0x4b4b('0x20')];var _0x4da6ba=_0x1c36c7?0x0:_0xe897e2[_0x4b4b('0x21')];var _0x241e21=_0x1c36c7?_0x497757[_0x4b4b('0x20')]:_0xe897e2[_0x4b4b('0x21')]+_0xe897e2['limit'];var _0x242775;if(_0x241e21>=_0x2a143a){_0x241e21=_0x2a143a;_0x242775=0xc8;}else{_0x242775=0xce;}_0x26dbe[_0x4b4b('0x1b')](_0x242775);return _0x26dbe[_0x4b4b('0x22')](_0x4b4b('0x23'),_0x4da6ba+'-'+_0x241e21+'/'+_0x2a143a)['json'](_0x497757);}return null;};}function patchUpdates(_0xec3bb3){return function(_0x47d5e4){try{jsonpatch['apply'](_0x47d5e4,_0xec3bb3,!![]);}catch(_0x1dd3e6){return BPromise['reject'](_0x1dd3e6);}return _0x47d5e4['save']();};}function saveUpdates(_0x5853f4,_0x238858){return function(_0x14fb70){if(_0x14fb70){return _0x14fb70[_0x4b4b('0x24')](_0x5853f4)[_0x4b4b('0x25')](function(_0x1f991d){return _0x1f991d;});}return null;};}function removeEntity(_0x20e016,_0x5ed1a4){return function(_0x1d8536){if(_0x1d8536){return _0x1d8536[_0x4b4b('0x26')]()[_0x4b4b('0x25')](function(){_0x20e016[_0x4b4b('0x1b')](0xcc)[_0x4b4b('0x1c')]();});}};}function handleEntityNotFound(_0x39e786,_0x3523c4){return function(_0x54318f){if(!_0x54318f){_0x39e786[_0x4b4b('0x1a')](0x194);}return _0x54318f;};}function handleError(_0x41d56f,_0x5d18d2){_0x5d18d2=_0x5d18d2||0x1f4;return function(_0x43227b){logger[_0x4b4b('0x27')](_0x43227b[_0x4b4b('0x28')]);if(_0x43227b[_0x4b4b('0x29')]){delete _0x43227b['name'];}_0x41d56f[_0x4b4b('0x1b')](_0x5d18d2)[_0x4b4b('0x2a')](_0x43227b);};}exports[_0x4b4b('0x2b')]=function(_0x534896,_0x302b33){var _0x5dfcb7={},_0xd37d17={},_0x4518a1={'count':0x0,'rows':[]};var _0x513fe2=_[_0x4b4b('0x2c')](db['DeskConfiguration']['rawAttributes'],function(_0xf2fb9d){return{'name':_0xf2fb9d[_0x4b4b('0x2d')],'type':_0xf2fb9d['type'][_0x4b4b('0x2e')]};});_0xd37d17[_0x4b4b('0x2f')]=_[_0x4b4b('0x2c')](_0x513fe2,_0x4b4b('0x29'));_0xd37d17[_0x4b4b('0x30')]=_[_0x4b4b('0x31')](_0x534896[_0x4b4b('0x30')]);_0xd37d17[_0x4b4b('0x32')]=_['intersection'](_0xd37d17[_0x4b4b('0x2f')],_0xd37d17[_0x4b4b('0x30')]);_0x5dfcb7['attributes']=_[_0x4b4b('0x33')](_0xd37d17['model'],qs[_0x4b4b('0x34')](_0x534896[_0x4b4b('0x30')][_0x4b4b('0x34')]));_0x5dfcb7[_0x4b4b('0x35')]=_0x5dfcb7['attributes'][_0x4b4b('0x36')]?_0x5dfcb7[_0x4b4b('0x35')]:_0xd37d17[_0x4b4b('0x2f')];if(!_0x534896['query']['hasOwnProperty'](_0x4b4b('0x37'))){_0x5dfcb7[_0x4b4b('0x1f')]=qs[_0x4b4b('0x1f')](_0x534896[_0x4b4b('0x30')][_0x4b4b('0x1f')]);_0x5dfcb7['offset']=qs['offset'](_0x534896['query'][_0x4b4b('0x21')]);}_0x5dfcb7[_0x4b4b('0x38')]=qs['sort'](_0x534896[_0x4b4b('0x30')][_0x4b4b('0x39')]);_0x5dfcb7[_0x4b4b('0x3a')]=qs['filters'](_[_0x4b4b('0x3b')](_0x534896[_0x4b4b('0x30')],_0xd37d17[_0x4b4b('0x32')]),_0x513fe2);if(_0x534896['query'][_0x4b4b('0x3c')]){_0x5dfcb7[_0x4b4b('0x3a')]=_[_0x4b4b('0x3d')](_0x5dfcb7[_0x4b4b('0x3a')],{'$or':_[_0x4b4b('0x2c')](_0x513fe2,function(_0x80dbda){if(_0x80dbda[_0x4b4b('0x3e')]!==_0x4b4b('0x3f')){var _0x15c05c={};_0x15c05c[_0x80dbda[_0x4b4b('0x29')]]={'$like':'%'+_0x534896[_0x4b4b('0x30')][_0x4b4b('0x3c')]+'%'};return _0x15c05c;}})});}_0x5dfcb7=_[_0x4b4b('0x3d')]({},_0x5dfcb7,_0x534896[_0x4b4b('0x40')]);var _0x297ad0={'where':_0x5dfcb7[_0x4b4b('0x3a')]};return db[_0x4b4b('0x41')][_0x4b4b('0x20')](_0x297ad0)[_0x4b4b('0x25')](function(_0x589760){_0x4518a1['count']=_0x589760;if(_0x534896[_0x4b4b('0x30')][_0x4b4b('0x42')]){_0x5dfcb7['include']=[{'all':!![]}];}return db['DeskConfiguration'][_0x4b4b('0x43')](_0x5dfcb7);})[_0x4b4b('0x25')](function(_0x1601ca){_0x4518a1[_0x4b4b('0x44')]=_0x1601ca;return _0x4518a1;})[_0x4b4b('0x25')](respondWithFilteredResult(_0x302b33,_0x5dfcb7))[_0x4b4b('0x45')](handleError(_0x302b33,null));};exports[_0x4b4b('0x46')]=function(_0x4b0aef,_0x1c95c4){var _0x3e5b38={'raw':![],'where':{'id':_0x4b0aef['params']['id']}},_0xbd75d9={};_0xbd75d9[_0x4b4b('0x2f')]=_[_0x4b4b('0x31')](db[_0x4b4b('0x41')][_0x4b4b('0x47')]);_0xbd75d9[_0x4b4b('0x30')]=_[_0x4b4b('0x31')](_0x4b0aef['query']);_0xbd75d9[_0x4b4b('0x32')]=_[_0x4b4b('0x33')](_0xbd75d9[_0x4b4b('0x2f')],_0xbd75d9[_0x4b4b('0x30')]);_0x3e5b38[_0x4b4b('0x35')]=_[_0x4b4b('0x33')](_0xbd75d9[_0x4b4b('0x2f')],qs[_0x4b4b('0x34')](_0x4b0aef[_0x4b4b('0x30')][_0x4b4b('0x34')]));_0x3e5b38[_0x4b4b('0x35')]=_0x3e5b38['attributes'][_0x4b4b('0x36')]?_0x3e5b38[_0x4b4b('0x35')]:_0xbd75d9['model'];if(_0x4b0aef[_0x4b4b('0x30')][_0x4b4b('0x42')]){_0x3e5b38[_0x4b4b('0x48')]=[{'all':!![]}];}_0x3e5b38=_[_0x4b4b('0x3d')]({},_0x3e5b38,_0x4b0aef[_0x4b4b('0x40')]);return db[_0x4b4b('0x41')][_0x4b4b('0x49')](_0x3e5b38)['then'](handleEntityNotFound(_0x1c95c4,null))[_0x4b4b('0x25')](respondWithResult(_0x1c95c4,null))[_0x4b4b('0x45')](handleError(_0x1c95c4,null));};exports['create']=function(_0x553bc7,_0x4ea109){return db[_0x4b4b('0x41')][_0x4b4b('0x4a')](_0x553bc7[_0x4b4b('0x4b')],{})[_0x4b4b('0x25')](respondWithResult(_0x4ea109,0xc9))['catch'](handleError(_0x4ea109,null));};exports[_0x4b4b('0x24')]=function(_0x4f9443,_0x591047){if(_0x4f9443[_0x4b4b('0x4b')]['id']){delete _0x4f9443[_0x4b4b('0x4b')]['id'];}return db[_0x4b4b('0x41')][_0x4b4b('0x49')]({'where':{'id':_0x4f9443[_0x4b4b('0x4c')]['id']}})[_0x4b4b('0x25')](handleEntityNotFound(_0x591047,null))[_0x4b4b('0x25')](saveUpdates(_0x4f9443[_0x4b4b('0x4b')],null))[_0x4b4b('0x25')](respondWithResult(_0x591047,null))['catch'](handleError(_0x591047,null));};exports[_0x4b4b('0x26')]=function(_0x5e4a8d,_0x5e720e){return db[_0x4b4b('0x41')][_0x4b4b('0x49')]({'where':{'id':_0x5e4a8d['params']['id']}})['then'](handleEntityNotFound(_0x5e720e,null))[_0x4b4b('0x25')](removeEntity(_0x5e720e,null))['catch'](handleError(_0x5e720e,null));};exports[_0x4b4b('0x4d')]=function(_0x5a4cac,_0x1b3d45,_0x597374){var _0x13654c={};var _0x4ecd17={};var _0x1d32fa;var _0x4ef821;return db['DeskConfiguration'][_0x4b4b('0x4e')]({'where':{'id':_0x5a4cac[_0x4b4b('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1b3d45,null))['then'](function(_0x209af4){if(_0x209af4){_0x1d32fa=_0x209af4;_0x4ecd17['model']=_['keys'](db[_0x4b4b('0x4f')][_0x4b4b('0x47')]);_0x4ecd17[_0x4b4b('0x30')]=_[_0x4b4b('0x31')](_0x5a4cac[_0x4b4b('0x30')]);_0x4ecd17[_0x4b4b('0x32')]=_['intersection'](_0x4ecd17[_0x4b4b('0x2f')],_0x4ecd17[_0x4b4b('0x30')]);_0x13654c[_0x4b4b('0x35')]=_[_0x4b4b('0x33')](_0x4ecd17[_0x4b4b('0x2f')],qs[_0x4b4b('0x34')](_0x5a4cac[_0x4b4b('0x30')][_0x4b4b('0x34')]));_0x13654c[_0x4b4b('0x35')]=_0x13654c[_0x4b4b('0x35')][_0x4b4b('0x36')]?_0x13654c['attributes']:_0x4ecd17['model'];_0x13654c[_0x4b4b('0x38')]=qs['sort'](_0x5a4cac['query'][_0x4b4b('0x39')]);_0x13654c[_0x4b4b('0x3a')]=qs[_0x4b4b('0x32')](_[_0x4b4b('0x3b')](_0x5a4cac['query'],_0x4ecd17[_0x4b4b('0x32')]));if(_0x5a4cac[_0x4b4b('0x30')][_0x4b4b('0x3c')]){_0x13654c[_0x4b4b('0x3a')]=_[_0x4b4b('0x3d')](_0x13654c['where'],{'$or':_[_0x4b4b('0x2c')](_0x13654c[_0x4b4b('0x35')],function(_0x90899c){var _0x1dc013={};_0x1dc013[_0x90899c]={'$like':'%'+_0x5a4cac[_0x4b4b('0x30')]['filter']+'%'};return _0x1dc013;})});}_0x13654c=_[_0x4b4b('0x3d')]({},_0x13654c,_0x5a4cac[_0x4b4b('0x40')]);return _0x1d32fa[_0x4b4b('0x4d')](_0x13654c);}})['then'](function(_0x219560){if(_0x219560){_0x4ef821=_0x219560['length'];if(!_0x5a4cac[_0x4b4b('0x30')][_0x4b4b('0x50')](_0x4b4b('0x37'))){_0x13654c[_0x4b4b('0x1f')]=qs[_0x4b4b('0x1f')](_0x5a4cac[_0x4b4b('0x30')][_0x4b4b('0x1f')]);_0x13654c[_0x4b4b('0x21')]=qs[_0x4b4b('0x21')](_0x5a4cac[_0x4b4b('0x30')]['offset']);}return _0x1d32fa['getFields'](_0x13654c);}})[_0x4b4b('0x25')](function(_0xd1796c){if(_0xd1796c){return _0xd1796c?{'count':_0x4ef821,'rows':_0xd1796c}:null;}})[_0x4b4b('0x25')](respondWithResult(_0x1b3d45,null))[_0x4b4b('0x45')](handleError(_0x1b3d45,null));};exports[_0x4b4b('0x51')]=function(_0x193410,_0x1ef070,_0x5ae62c){var _0x1036f1={};var _0x269dbb={};var _0x189ed2;var _0x2a4c76;return db[_0x4b4b('0x41')][_0x4b4b('0x4e')]({'where':{'id':_0x193410['params']['id']}})['then'](handleEntityNotFound(_0x1ef070,null))[_0x4b4b('0x25')](function(_0xbf9c1d){if(_0xbf9c1d){_0x189ed2=_0xbf9c1d;_0x269dbb[_0x4b4b('0x2f')]=_[_0x4b4b('0x31')](db[_0x4b4b('0x4f')][_0x4b4b('0x47')]);_0x269dbb[_0x4b4b('0x30')]=_[_0x4b4b('0x31')](_0x193410['query']);_0x269dbb[_0x4b4b('0x32')]=_['intersection'](_0x269dbb[_0x4b4b('0x2f')],_0x269dbb[_0x4b4b('0x30')]);_0x1036f1[_0x4b4b('0x35')]=_['intersection'](_0x269dbb[_0x4b4b('0x2f')],qs[_0x4b4b('0x34')](_0x193410['query'][_0x4b4b('0x34')]));_0x1036f1[_0x4b4b('0x35')]=_0x1036f1[_0x4b4b('0x35')][_0x4b4b('0x36')]?_0x1036f1['attributes']:_0x269dbb['model'];_0x1036f1['order']=qs[_0x4b4b('0x39')](_0x193410[_0x4b4b('0x30')]['sort']);_0x1036f1['where']=qs[_0x4b4b('0x32')](_[_0x4b4b('0x3b')](_0x193410['query'],_0x269dbb[_0x4b4b('0x32')]));if(_0x193410[_0x4b4b('0x30')][_0x4b4b('0x3c')]){_0x1036f1[_0x4b4b('0x3a')]=_[_0x4b4b('0x3d')](_0x1036f1[_0x4b4b('0x3a')],{'$or':_['map'](_0x1036f1[_0x4b4b('0x35')],function(_0xc39850){var _0x2e1e90={};_0x2e1e90[_0xc39850]={'$like':'%'+_0x193410[_0x4b4b('0x30')][_0x4b4b('0x3c')]+'%'};return _0x2e1e90;})});}_0x1036f1=_[_0x4b4b('0x3d')]({},_0x1036f1,_0x193410[_0x4b4b('0x40')]);return _0x189ed2['getSubjects'](_0x1036f1);}})[_0x4b4b('0x25')](function(_0x59cd87){if(_0x59cd87){_0x2a4c76=_0x59cd87[_0x4b4b('0x36')];if(!_0x193410['query']['hasOwnProperty']('nolimit')){_0x1036f1[_0x4b4b('0x1f')]=qs[_0x4b4b('0x1f')](_0x193410[_0x4b4b('0x30')][_0x4b4b('0x1f')]);_0x1036f1['offset']=qs[_0x4b4b('0x21')](_0x193410[_0x4b4b('0x30')][_0x4b4b('0x21')]);}return _0x189ed2[_0x4b4b('0x51')](_0x1036f1);}})[_0x4b4b('0x25')](function(_0xa18522){if(_0xa18522){return _0xa18522?{'count':_0x2a4c76,'rows':_0xa18522}:null;}})['then'](respondWithResult(_0x1ef070,null))['catch'](handleError(_0x1ef070,null));};exports[_0x4b4b('0x52')]=function(_0xb9e23e,_0x1065d2,_0x459d9b){var _0xf55a97={};var _0x1724a7={};var _0x25a08c;var _0x50e542;return db[_0x4b4b('0x41')][_0x4b4b('0x4e')]({'where':{'id':_0xb9e23e[_0x4b4b('0x4c')]['id']}})[_0x4b4b('0x25')](handleEntityNotFound(_0x1065d2,null))[_0x4b4b('0x25')](function(_0x5b9ae8){if(_0x5b9ae8){_0x25a08c=_0x5b9ae8;_0x1724a7[_0x4b4b('0x2f')]=_[_0x4b4b('0x31')](db['DeskField'][_0x4b4b('0x47')]);_0x1724a7[_0x4b4b('0x30')]=_['keys'](_0xb9e23e[_0x4b4b('0x30')]);_0x1724a7[_0x4b4b('0x32')]=_[_0x4b4b('0x33')](_0x1724a7[_0x4b4b('0x2f')],_0x1724a7[_0x4b4b('0x30')]);_0xf55a97['attributes']=_['intersection'](_0x1724a7[_0x4b4b('0x2f')],qs[_0x4b4b('0x34')](_0xb9e23e[_0x4b4b('0x30')][_0x4b4b('0x34')]));_0xf55a97[_0x4b4b('0x35')]=_0xf55a97[_0x4b4b('0x35')][_0x4b4b('0x36')]?_0xf55a97[_0x4b4b('0x35')]:_0x1724a7[_0x4b4b('0x2f')];_0xf55a97[_0x4b4b('0x38')]=qs[_0x4b4b('0x39')](_0xb9e23e[_0x4b4b('0x30')]['sort']);_0xf55a97['where']=qs['filters'](_['pick'](_0xb9e23e[_0x4b4b('0x30')],_0x1724a7[_0x4b4b('0x32')]));if(_0xb9e23e[_0x4b4b('0x30')][_0x4b4b('0x3c')]){_0xf55a97[_0x4b4b('0x3a')]=_[_0x4b4b('0x3d')](_0xf55a97[_0x4b4b('0x3a')],{'$or':_[_0x4b4b('0x2c')](_0xf55a97['attributes'],function(_0xdf1f2f){var _0x587e64={};_0x587e64[_0xdf1f2f]={'$like':'%'+_0xb9e23e[_0x4b4b('0x30')]['filter']+'%'};return _0x587e64;})});}_0xf55a97=_[_0x4b4b('0x3d')]({},_0xf55a97,_0xb9e23e[_0x4b4b('0x40')]);return _0x25a08c['getDescriptions'](_0xf55a97);}})[_0x4b4b('0x25')](function(_0x366fb3){if(_0x366fb3){_0x50e542=_0x366fb3[_0x4b4b('0x36')];if(!_0xb9e23e[_0x4b4b('0x30')][_0x4b4b('0x50')](_0x4b4b('0x37'))){_0xf55a97[_0x4b4b('0x1f')]=qs[_0x4b4b('0x1f')](_0xb9e23e[_0x4b4b('0x30')][_0x4b4b('0x1f')]);_0xf55a97['offset']=qs[_0x4b4b('0x21')](_0xb9e23e[_0x4b4b('0x30')][_0x4b4b('0x21')]);}return _0x25a08c[_0x4b4b('0x52')](_0xf55a97);}})[_0x4b4b('0x25')](function(_0x29d4be){if(_0x29d4be){return _0x29d4be?{'count':_0x50e542,'rows':_0x29d4be}:null;}})[_0x4b4b('0x25')](respondWithResult(_0x1065d2,null))[_0x4b4b('0x45')](handleError(_0x1065d2,null));};exports[_0x4b4b('0x53')]=function(_0x21cba3,_0x37001a,_0x2263cf){var _0x3dbc16={};var _0x45a129={};var _0x3c3dee;var _0x5c6506;return db['DeskConfiguration'][_0x4b4b('0x4e')]({'where':{'id':_0x21cba3[_0x4b4b('0x4c')]['id']}})['then'](handleEntityNotFound(_0x37001a,null))[_0x4b4b('0x25')](function(_0x254a87){if(_0x254a87){_0x3c3dee=_0x254a87;_0x45a129[_0x4b4b('0x2f')]=_[_0x4b4b('0x31')](db[_0x4b4b('0x54')]['rawAttributes']);_0x45a129[_0x4b4b('0x30')]=_[_0x4b4b('0x31')](_0x21cba3[_0x4b4b('0x30')]);_0x45a129[_0x4b4b('0x32')]=_[_0x4b4b('0x33')](_0x45a129[_0x4b4b('0x2f')],_0x45a129[_0x4b4b('0x30')]);_0x3dbc16['attributes']=_[_0x4b4b('0x33')](_0x45a129[_0x4b4b('0x2f')],qs[_0x4b4b('0x34')](_0x21cba3[_0x4b4b('0x30')][_0x4b4b('0x34')]));_0x3dbc16[_0x4b4b('0x35')]=_0x3dbc16[_0x4b4b('0x35')][_0x4b4b('0x36')]?_0x3dbc16[_0x4b4b('0x35')]:_0x45a129['model'];_0x3dbc16[_0x4b4b('0x38')]=qs[_0x4b4b('0x39')](_0x21cba3['query']['sort']);_0x3dbc16[_0x4b4b('0x3a')]=qs[_0x4b4b('0x32')](_['pick'](_0x21cba3['query'],_0x45a129[_0x4b4b('0x32')]));if(_0x21cba3[_0x4b4b('0x30')][_0x4b4b('0x3c')]){_0x3dbc16[_0x4b4b('0x3a')]=_[_0x4b4b('0x3d')](_0x3dbc16[_0x4b4b('0x3a')],{'$or':_[_0x4b4b('0x2c')](_0x3dbc16[_0x4b4b('0x35')],function(_0x5f5cd8){var _0x1318c7={};_0x1318c7[_0x5f5cd8]={'$like':'%'+_0x21cba3[_0x4b4b('0x30')][_0x4b4b('0x3c')]+'%'};return _0x1318c7;})});}_0x3dbc16=_['merge']({},_0x3dbc16,_0x21cba3[_0x4b4b('0x40')]);return _0x3c3dee['getTags'](_0x3dbc16);}})[_0x4b4b('0x25')](function(_0x3f57f0){if(_0x3f57f0){_0x5c6506=_0x3f57f0[_0x4b4b('0x36')];if(!_0x21cba3[_0x4b4b('0x30')]['hasOwnProperty'](_0x4b4b('0x37'))){_0x3dbc16[_0x4b4b('0x1f')]=qs[_0x4b4b('0x1f')](_0x21cba3['query'][_0x4b4b('0x1f')]);_0x3dbc16['offset']=qs[_0x4b4b('0x21')](_0x21cba3[_0x4b4b('0x30')]['offset']);}return _0x3c3dee[_0x4b4b('0x53')](_0x3dbc16);}})[_0x4b4b('0x25')](function(_0x28e50b){if(_0x28e50b){return _0x28e50b?{'count':_0x5c6506,'rows':_0x28e50b}:null;}})['then'](respondWithResult(_0x37001a,null))['catch'](handleError(_0x37001a,null));};exports['setTags']=function(_0x4f72e8,_0x337b93,_0x40b703){if(_0x4f72e8[_0x4b4b('0x4b')]['id']){delete _0x4f72e8[_0x4b4b('0x4b')]['id'];}return db[_0x4b4b('0x41')][_0x4b4b('0x4e')]({'where':{'id':_0x4f72e8[_0x4b4b('0x4c')]['id']}})[_0x4b4b('0x25')](handleEntityNotFound(_0x337b93,null))[_0x4b4b('0x25')](function(_0x4c53e8){if(_0x4c53e8){return _0x4c53e8[_0x4b4b('0x55')](_0x4f72e8[_0x4b4b('0x4b')][_0x4b4b('0x56')]||[]);}return null;})[_0x4b4b('0x25')](respondWithResult(_0x337b93,null))[_0x4b4b('0x45')](handleError(_0x337b93,null));}; \ No newline at end of file +var _0xa90b=['key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','DeskConfiguration','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','findOne','DeskField','order','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','rawAttributes','fieldName'];(function(_0x380d16,_0xdf0d31){var _0x5d5253=function(_0x7a25bc){while(--_0x7a25bc){_0x380d16['push'](_0x380d16['shift']());}};_0x5d5253(++_0xdf0d31);}(_0xa90b,0x17c));var _0xba90=function(_0x154983,_0xc29edf){_0x154983=_0x154983-0x0;var _0x3d1243=_0xa90b[_0x154983];return _0x3d1243;};'use strict';var emlformat=require(_0xba90('0x0'));var rimraf=require(_0xba90('0x1'));var zipdir=require(_0xba90('0x2'));var jsonpatch=require(_0xba90('0x3'));var rp=require(_0xba90('0x4'));var moment=require(_0xba90('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xba90('0x6'));var util=require('util');var path=require('path');var sox=require(_0xba90('0x7'));var csv=require(_0xba90('0x8'));var ejs=require(_0xba90('0x9'));var fs=require('fs');var fs_extra=require(_0xba90('0xa'));var _=require(_0xba90('0xb'));var squel=require(_0xba90('0xc'));var crypto=require('crypto');var jsforce=require(_0xba90('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xba90('0x8'));var querystring=require(_0xba90('0xe'));var Papa=require(_0xba90('0xf'));var Redis=require('ioredis');var authService=require(_0xba90('0x10'));var qs=require(_0xba90('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xba90('0x12'));var logger=require(_0xba90('0x13'))(_0xba90('0x14'));var utils=require(_0xba90('0x15'));var config=require(_0xba90('0x16'));var licenseUtil=require(_0xba90('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1dfe01,_0x536fb1){_0x536fb1=_0x536fb1||0xcc;return function(_0x283e8b){if(_0x283e8b){return _0x1dfe01['sendStatus'](_0x536fb1);}return _0x1dfe01[_0xba90('0x18')](_0x536fb1)['end']();};}function respondWithResult(_0x30618a,_0x50e270){_0x50e270=_0x50e270||0xc8;return function(_0x136bd9){if(_0x136bd9){return _0x30618a[_0xba90('0x18')](_0x50e270)[_0xba90('0x19')](_0x136bd9);}};}function respondWithFilteredResult(_0x3ee14a,_0x29348a){return function(_0x3862b2){if(_0x3862b2){var _0x58be16=typeof _0x29348a[_0xba90('0x1a')]==='undefined'&&typeof _0x29348a[_0xba90('0x1b')]===_0xba90('0x1c');var _0x1b7bc6=_0x3862b2['count'];var _0x2640cf=_0x58be16?0x0:_0x29348a[_0xba90('0x1a')];var _0x571099=_0x58be16?_0x3862b2[_0xba90('0x1d')]:_0x29348a[_0xba90('0x1a')]+_0x29348a[_0xba90('0x1b')];var _0x5d9b73;if(_0x571099>=_0x1b7bc6){_0x571099=_0x1b7bc6;_0x5d9b73=0xc8;}else{_0x5d9b73=0xce;}_0x3ee14a[_0xba90('0x18')](_0x5d9b73);return _0x3ee14a[_0xba90('0x1e')](_0xba90('0x1f'),_0x2640cf+'-'+_0x571099+'/'+_0x1b7bc6)['json'](_0x3862b2);}return null;};}function patchUpdates(_0x4441fe){return function(_0x15b3a6){try{jsonpatch[_0xba90('0x20')](_0x15b3a6,_0x4441fe,!![]);}catch(_0x36968c){return BPromise[_0xba90('0x21')](_0x36968c);}return _0x15b3a6[_0xba90('0x22')]();};}function saveUpdates(_0x239ca5,_0xfaa674){return function(_0xb26a42){if(_0xb26a42){return _0xb26a42[_0xba90('0x23')](_0x239ca5)[_0xba90('0x24')](function(_0x1a0305){return _0x1a0305;});}return null;};}function removeEntity(_0x66dcac,_0x4a1747){return function(_0xaec3d7){if(_0xaec3d7){return _0xaec3d7[_0xba90('0x25')]()[_0xba90('0x24')](function(){_0x66dcac[_0xba90('0x18')](0xcc)[_0xba90('0x26')]();});}};}function handleEntityNotFound(_0x4e9e1b,_0x3ab3ff){return function(_0x1b780e){if(!_0x1b780e){_0x4e9e1b['sendStatus'](0x194);}return _0x1b780e;};}function handleError(_0x99ff4e,_0x19491f){_0x19491f=_0x19491f||0x1f4;return function(_0xc6e7f4){logger[_0xba90('0x27')](_0xc6e7f4['stack']);if(_0xc6e7f4['name']){delete _0xc6e7f4[_0xba90('0x28')];}_0x99ff4e['status'](_0x19491f)[_0xba90('0x29')](_0xc6e7f4);};}exports[_0xba90('0x2a')]=function(_0xcf7382,_0x377bc2){var _0x2a30f1={},_0x4a7a12={},_0x1cb040={'count':0x0,'rows':[]};var _0x596388=_['map'](db['DeskConfiguration'][_0xba90('0x2b')],function(_0x5b1914){return{'name':_0x5b1914[_0xba90('0x2c')],'type':_0x5b1914['type'][_0xba90('0x2d')]};});_0x4a7a12[_0xba90('0x2e')]=_[_0xba90('0x2f')](_0x596388,_0xba90('0x28'));_0x4a7a12[_0xba90('0x30')]=_['keys'](_0xcf7382['query']);_0x4a7a12[_0xba90('0x31')]=_[_0xba90('0x32')](_0x4a7a12['model'],_0x4a7a12[_0xba90('0x30')]);_0x2a30f1[_0xba90('0x33')]=_[_0xba90('0x32')](_0x4a7a12[_0xba90('0x2e')],qs[_0xba90('0x34')](_0xcf7382[_0xba90('0x30')][_0xba90('0x34')]));_0x2a30f1[_0xba90('0x33')]=_0x2a30f1['attributes'][_0xba90('0x35')]?_0x2a30f1['attributes']:_0x4a7a12['model'];if(!_0xcf7382[_0xba90('0x30')][_0xba90('0x36')](_0xba90('0x37'))){_0x2a30f1[_0xba90('0x1b')]=qs[_0xba90('0x1b')](_0xcf7382['query'][_0xba90('0x1b')]);_0x2a30f1[_0xba90('0x1a')]=qs['offset'](_0xcf7382[_0xba90('0x30')]['offset']);}_0x2a30f1['order']=qs[_0xba90('0x38')](_0xcf7382['query'][_0xba90('0x38')]);_0x2a30f1[_0xba90('0x39')]=qs[_0xba90('0x31')](_[_0xba90('0x3a')](_0xcf7382[_0xba90('0x30')],_0x4a7a12[_0xba90('0x31')]),_0x596388);if(_0xcf7382[_0xba90('0x30')]['filter']){_0x2a30f1[_0xba90('0x39')]=_['merge'](_0x2a30f1[_0xba90('0x39')],{'$or':_[_0xba90('0x2f')](_0x596388,function(_0x35b160){if(_0x35b160['type']!==_0xba90('0x3b')){var _0x27f5f7={};_0x27f5f7[_0x35b160[_0xba90('0x28')]]={'$like':'%'+_0xcf7382[_0xba90('0x30')][_0xba90('0x3c')]+'%'};return _0x27f5f7;}})});}_0x2a30f1=_[_0xba90('0x3d')]({},_0x2a30f1,_0xcf7382[_0xba90('0x3e')]);var _0x4a6540={'where':_0x2a30f1[_0xba90('0x39')]};return db[_0xba90('0x3f')][_0xba90('0x1d')](_0x4a6540)[_0xba90('0x24')](function(_0x101492){_0x1cb040[_0xba90('0x1d')]=_0x101492;if(_0xcf7382[_0xba90('0x30')][_0xba90('0x40')]){_0x2a30f1[_0xba90('0x41')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xba90('0x42')](_0x2a30f1);})[_0xba90('0x24')](function(_0x437e6d){_0x1cb040[_0xba90('0x43')]=_0x437e6d;return _0x1cb040;})['then'](respondWithFilteredResult(_0x377bc2,_0x2a30f1))[_0xba90('0x44')](handleError(_0x377bc2,null));};exports[_0xba90('0x45')]=function(_0x404f04,_0x4228d9){var _0x2cfa05={'raw':![],'where':{'id':_0x404f04['params']['id']}},_0x21d396={};_0x21d396[_0xba90('0x2e')]=_[_0xba90('0x46')](db[_0xba90('0x3f')]['rawAttributes']);_0x21d396[_0xba90('0x30')]=_[_0xba90('0x46')](_0x404f04['query']);_0x21d396['filters']=_[_0xba90('0x32')](_0x21d396[_0xba90('0x2e')],_0x21d396[_0xba90('0x30')]);_0x2cfa05[_0xba90('0x33')]=_[_0xba90('0x32')](_0x21d396['model'],qs[_0xba90('0x34')](_0x404f04[_0xba90('0x30')][_0xba90('0x34')]));_0x2cfa05[_0xba90('0x33')]=_0x2cfa05[_0xba90('0x33')]['length']?_0x2cfa05[_0xba90('0x33')]:_0x21d396['model'];if(_0x404f04[_0xba90('0x30')][_0xba90('0x40')]){_0x2cfa05[_0xba90('0x41')]=[{'all':!![]}];}_0x2cfa05=_[_0xba90('0x3d')]({},_0x2cfa05,_0x404f04[_0xba90('0x3e')]);return db[_0xba90('0x3f')][_0xba90('0x47')](_0x2cfa05)[_0xba90('0x24')](handleEntityNotFound(_0x4228d9,null))['then'](respondWithResult(_0x4228d9,null))[_0xba90('0x44')](handleError(_0x4228d9,null));};exports[_0xba90('0x48')]=function(_0x49d60c,_0xa1921){return db[_0xba90('0x3f')][_0xba90('0x48')](_0x49d60c['body'],{})[_0xba90('0x24')](respondWithResult(_0xa1921,0xc9))[_0xba90('0x44')](handleError(_0xa1921,null));};exports[_0xba90('0x23')]=function(_0x48bc43,_0x1de9ae){if(_0x48bc43[_0xba90('0x49')]['id']){delete _0x48bc43[_0xba90('0x49')]['id'];}return db[_0xba90('0x3f')]['find']({'where':{'id':_0x48bc43['params']['id']}})[_0xba90('0x24')](handleEntityNotFound(_0x1de9ae,null))[_0xba90('0x24')](saveUpdates(_0x48bc43[_0xba90('0x49')],null))['then'](respondWithResult(_0x1de9ae,null))[_0xba90('0x44')](handleError(_0x1de9ae,null));};exports[_0xba90('0x25')]=function(_0x4722de,_0x182b20){return db[_0xba90('0x3f')][_0xba90('0x47')]({'where':{'id':_0x4722de[_0xba90('0x4a')]['id']}})['then'](handleEntityNotFound(_0x182b20,null))[_0xba90('0x24')](removeEntity(_0x182b20,null))[_0xba90('0x44')](handleError(_0x182b20,null));};exports['getFields']=function(_0x2e6109,_0x880d7e,_0xed4d4b){var _0x118e15={};var _0x15707d={};var _0x47d871;var _0x1e352a;return db[_0xba90('0x3f')][_0xba90('0x4b')]({'where':{'id':_0x2e6109['params']['id']}})[_0xba90('0x24')](handleEntityNotFound(_0x880d7e,null))['then'](function(_0x5e2587){if(_0x5e2587){_0x47d871=_0x5e2587;_0x15707d[_0xba90('0x2e')]=_[_0xba90('0x46')](db[_0xba90('0x4c')][_0xba90('0x2b')]);_0x15707d[_0xba90('0x30')]=_[_0xba90('0x46')](_0x2e6109[_0xba90('0x30')]);_0x15707d[_0xba90('0x31')]=_[_0xba90('0x32')](_0x15707d['model'],_0x15707d[_0xba90('0x30')]);_0x118e15[_0xba90('0x33')]=_[_0xba90('0x32')](_0x15707d['model'],qs[_0xba90('0x34')](_0x2e6109['query'][_0xba90('0x34')]));_0x118e15['attributes']=_0x118e15[_0xba90('0x33')]['length']?_0x118e15[_0xba90('0x33')]:_0x15707d[_0xba90('0x2e')];_0x118e15[_0xba90('0x4d')]=qs[_0xba90('0x38')](_0x2e6109[_0xba90('0x30')][_0xba90('0x38')]);_0x118e15['where']=qs['filters'](_[_0xba90('0x3a')](_0x2e6109[_0xba90('0x30')],_0x15707d['filters']));if(_0x2e6109[_0xba90('0x30')]['filter']){_0x118e15['where']=_['merge'](_0x118e15[_0xba90('0x39')],{'$or':_[_0xba90('0x2f')](_0x118e15[_0xba90('0x33')],function(_0x3715a8){var _0x527145={};_0x527145[_0x3715a8]={'$like':'%'+_0x2e6109[_0xba90('0x30')][_0xba90('0x3c')]+'%'};return _0x527145;})});}_0x118e15=_[_0xba90('0x3d')]({},_0x118e15,_0x2e6109[_0xba90('0x3e')]);return _0x47d871[_0xba90('0x4e')](_0x118e15);}})[_0xba90('0x24')](function(_0x89e8a9){if(_0x89e8a9){_0x1e352a=_0x89e8a9[_0xba90('0x35')];if(!_0x2e6109[_0xba90('0x30')][_0xba90('0x36')](_0xba90('0x37'))){_0x118e15[_0xba90('0x1b')]=qs['limit'](_0x2e6109[_0xba90('0x30')][_0xba90('0x1b')]);_0x118e15[_0xba90('0x1a')]=qs[_0xba90('0x1a')](_0x2e6109[_0xba90('0x30')][_0xba90('0x1a')]);}return _0x47d871[_0xba90('0x4e')](_0x118e15);}})[_0xba90('0x24')](function(_0xe64733){if(_0xe64733){return _0xe64733?{'count':_0x1e352a,'rows':_0xe64733}:null;}})[_0xba90('0x24')](respondWithResult(_0x880d7e,null))[_0xba90('0x44')](handleError(_0x880d7e,null));};exports[_0xba90('0x4f')]=function(_0x24fc2f,_0x31f988,_0xb22a2d){var _0x56d3ef={};var _0x1dbcf6={};var _0x19983d;var _0x48e180;return db[_0xba90('0x3f')][_0xba90('0x4b')]({'where':{'id':_0x24fc2f[_0xba90('0x4a')]['id']}})['then'](handleEntityNotFound(_0x31f988,null))[_0xba90('0x24')](function(_0x37d335){if(_0x37d335){_0x19983d=_0x37d335;_0x1dbcf6[_0xba90('0x2e')]=_[_0xba90('0x46')](db[_0xba90('0x4c')][_0xba90('0x2b')]);_0x1dbcf6['query']=_[_0xba90('0x46')](_0x24fc2f[_0xba90('0x30')]);_0x1dbcf6[_0xba90('0x31')]=_['intersection'](_0x1dbcf6[_0xba90('0x2e')],_0x1dbcf6[_0xba90('0x30')]);_0x56d3ef[_0xba90('0x33')]=_[_0xba90('0x32')](_0x1dbcf6[_0xba90('0x2e')],qs[_0xba90('0x34')](_0x24fc2f[_0xba90('0x30')][_0xba90('0x34')]));_0x56d3ef[_0xba90('0x33')]=_0x56d3ef[_0xba90('0x33')][_0xba90('0x35')]?_0x56d3ef[_0xba90('0x33')]:_0x1dbcf6[_0xba90('0x2e')];_0x56d3ef['order']=qs[_0xba90('0x38')](_0x24fc2f[_0xba90('0x30')][_0xba90('0x38')]);_0x56d3ef['where']=qs[_0xba90('0x31')](_[_0xba90('0x3a')](_0x24fc2f[_0xba90('0x30')],_0x1dbcf6[_0xba90('0x31')]));if(_0x24fc2f[_0xba90('0x30')][_0xba90('0x3c')]){_0x56d3ef['where']=_['merge'](_0x56d3ef[_0xba90('0x39')],{'$or':_[_0xba90('0x2f')](_0x56d3ef[_0xba90('0x33')],function(_0x267e40){var _0x12969e={};_0x12969e[_0x267e40]={'$like':'%'+_0x24fc2f[_0xba90('0x30')][_0xba90('0x3c')]+'%'};return _0x12969e;})});}_0x56d3ef=_[_0xba90('0x3d')]({},_0x56d3ef,_0x24fc2f[_0xba90('0x3e')]);return _0x19983d[_0xba90('0x4f')](_0x56d3ef);}})[_0xba90('0x24')](function(_0x5b341f){if(_0x5b341f){_0x48e180=_0x5b341f[_0xba90('0x35')];if(!_0x24fc2f[_0xba90('0x30')]['hasOwnProperty']('nolimit')){_0x56d3ef['limit']=qs[_0xba90('0x1b')](_0x24fc2f['query'][_0xba90('0x1b')]);_0x56d3ef[_0xba90('0x1a')]=qs[_0xba90('0x1a')](_0x24fc2f['query'][_0xba90('0x1a')]);}return _0x19983d['getSubjects'](_0x56d3ef);}})[_0xba90('0x24')](function(_0x59ebf1){if(_0x59ebf1){return _0x59ebf1?{'count':_0x48e180,'rows':_0x59ebf1}:null;}})['then'](respondWithResult(_0x31f988,null))[_0xba90('0x44')](handleError(_0x31f988,null));};exports[_0xba90('0x50')]=function(_0x871369,_0x5b75e5,_0x246507){var _0x24c36c={};var _0x4ed882={};var _0x4b6aa0;var _0x522a5f;return db[_0xba90('0x3f')][_0xba90('0x4b')]({'where':{'id':_0x871369[_0xba90('0x4a')]['id']}})[_0xba90('0x24')](handleEntityNotFound(_0x5b75e5,null))['then'](function(_0x47bf8d){if(_0x47bf8d){_0x4b6aa0=_0x47bf8d;_0x4ed882[_0xba90('0x2e')]=_['keys'](db[_0xba90('0x4c')][_0xba90('0x2b')]);_0x4ed882[_0xba90('0x30')]=_[_0xba90('0x46')](_0x871369['query']);_0x4ed882['filters']=_[_0xba90('0x32')](_0x4ed882[_0xba90('0x2e')],_0x4ed882[_0xba90('0x30')]);_0x24c36c[_0xba90('0x33')]=_['intersection'](_0x4ed882[_0xba90('0x2e')],qs[_0xba90('0x34')](_0x871369[_0xba90('0x30')][_0xba90('0x34')]));_0x24c36c[_0xba90('0x33')]=_0x24c36c['attributes']['length']?_0x24c36c['attributes']:_0x4ed882[_0xba90('0x2e')];_0x24c36c['order']=qs[_0xba90('0x38')](_0x871369[_0xba90('0x30')][_0xba90('0x38')]);_0x24c36c[_0xba90('0x39')]=qs['filters'](_[_0xba90('0x3a')](_0x871369[_0xba90('0x30')],_0x4ed882[_0xba90('0x31')]));if(_0x871369[_0xba90('0x30')]['filter']){_0x24c36c[_0xba90('0x39')]=_[_0xba90('0x3d')](_0x24c36c['where'],{'$or':_[_0xba90('0x2f')](_0x24c36c[_0xba90('0x33')],function(_0x52a1e8){var _0x382774={};_0x382774[_0x52a1e8]={'$like':'%'+_0x871369[_0xba90('0x30')][_0xba90('0x3c')]+'%'};return _0x382774;})});}_0x24c36c=_[_0xba90('0x3d')]({},_0x24c36c,_0x871369['options']);return _0x4b6aa0[_0xba90('0x50')](_0x24c36c);}})[_0xba90('0x24')](function(_0x501447){if(_0x501447){_0x522a5f=_0x501447[_0xba90('0x35')];if(!_0x871369['query'][_0xba90('0x36')](_0xba90('0x37'))){_0x24c36c[_0xba90('0x1b')]=qs['limit'](_0x871369[_0xba90('0x30')][_0xba90('0x1b')]);_0x24c36c[_0xba90('0x1a')]=qs[_0xba90('0x1a')](_0x871369[_0xba90('0x30')][_0xba90('0x1a')]);}return _0x4b6aa0['getDescriptions'](_0x24c36c);}})[_0xba90('0x24')](function(_0x194984){if(_0x194984){return _0x194984?{'count':_0x522a5f,'rows':_0x194984}:null;}})[_0xba90('0x24')](respondWithResult(_0x5b75e5,null))[_0xba90('0x44')](handleError(_0x5b75e5,null));};exports[_0xba90('0x51')]=function(_0x14da32,_0x1c9030,_0x3e27c7){var _0x1d44b7={};var _0x2bb3cf={};var _0x2aba77;var _0x809f52;return db[_0xba90('0x3f')][_0xba90('0x4b')]({'where':{'id':_0x14da32[_0xba90('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1c9030,null))[_0xba90('0x24')](function(_0x444d6a){if(_0x444d6a){_0x2aba77=_0x444d6a;_0x2bb3cf[_0xba90('0x2e')]=_[_0xba90('0x46')](db[_0xba90('0x52')]['rawAttributes']);_0x2bb3cf['query']=_[_0xba90('0x46')](_0x14da32['query']);_0x2bb3cf[_0xba90('0x31')]=_['intersection'](_0x2bb3cf[_0xba90('0x2e')],_0x2bb3cf[_0xba90('0x30')]);_0x1d44b7[_0xba90('0x33')]=_[_0xba90('0x32')](_0x2bb3cf['model'],qs[_0xba90('0x34')](_0x14da32[_0xba90('0x30')][_0xba90('0x34')]));_0x1d44b7[_0xba90('0x33')]=_0x1d44b7[_0xba90('0x33')]['length']?_0x1d44b7[_0xba90('0x33')]:_0x2bb3cf[_0xba90('0x2e')];_0x1d44b7[_0xba90('0x4d')]=qs['sort'](_0x14da32[_0xba90('0x30')][_0xba90('0x38')]);_0x1d44b7[_0xba90('0x39')]=qs['filters'](_['pick'](_0x14da32['query'],_0x2bb3cf[_0xba90('0x31')]));if(_0x14da32['query'][_0xba90('0x3c')]){_0x1d44b7[_0xba90('0x39')]=_[_0xba90('0x3d')](_0x1d44b7[_0xba90('0x39')],{'$or':_[_0xba90('0x2f')](_0x1d44b7[_0xba90('0x33')],function(_0x39927a){var _0x9511cf={};_0x9511cf[_0x39927a]={'$like':'%'+_0x14da32['query'][_0xba90('0x3c')]+'%'};return _0x9511cf;})});}_0x1d44b7=_[_0xba90('0x3d')]({},_0x1d44b7,_0x14da32[_0xba90('0x3e')]);return _0x2aba77[_0xba90('0x51')](_0x1d44b7);}})[_0xba90('0x24')](function(_0x2afc0d){if(_0x2afc0d){_0x809f52=_0x2afc0d[_0xba90('0x35')];if(!_0x14da32[_0xba90('0x30')]['hasOwnProperty'](_0xba90('0x37'))){_0x1d44b7[_0xba90('0x1b')]=qs[_0xba90('0x1b')](_0x14da32[_0xba90('0x30')][_0xba90('0x1b')]);_0x1d44b7['offset']=qs[_0xba90('0x1a')](_0x14da32[_0xba90('0x30')]['offset']);}return _0x2aba77[_0xba90('0x51')](_0x1d44b7);}})[_0xba90('0x24')](function(_0x299a38){if(_0x299a38){return _0x299a38?{'count':_0x809f52,'rows':_0x299a38}:null;}})[_0xba90('0x24')](respondWithResult(_0x1c9030,null))[_0xba90('0x44')](handleError(_0x1c9030,null));};exports['setTags']=function(_0x33d709,_0x55dd43,_0x5a24c2){if(_0x33d709[_0xba90('0x49')]['id']){delete _0x33d709['body']['id'];}return db[_0xba90('0x3f')][_0xba90('0x4b')]({'where':{'id':_0x33d709[_0xba90('0x4a')]['id']}})[_0xba90('0x24')](handleEntityNotFound(_0x55dd43,null))['then'](function(_0x4b769d){if(_0x4b769d){return _0x4b769d[_0xba90('0x53')](_0x33d709[_0xba90('0x49')][_0xba90('0x54')]||[]);}return null;})[_0xba90('0x24')](respondWithResult(_0x55dd43,null))[_0xba90('0x44')](handleError(_0x55dd43,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index bf4f52e..6ce7247 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 _0xab25=['../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x1e7ead,_0x4dba3c){var _0x4f17af=function(_0x5e6eea){while(--_0x5e6eea){_0x1e7ead['push'](_0x1e7ead['shift']());}};_0x4f17af(++_0x4dba3c);}(_0xab25,0x1e7));var _0x5ab2=function(_0x328d5f,_0x96b5e5){_0x328d5f=_0x328d5f-0x0;var _0x396cbc=_0xab25[_0x328d5f];return _0x396cbc;};'use strict';var _=require(_0x5ab2('0x0'));var util=require(_0x5ab2('0x1'));var logger=require('../../config/logger')(_0x5ab2('0x2'));var moment=require(_0x5ab2('0x3'));var BPromise=require(_0x5ab2('0x4'));var rp=require(_0x5ab2('0x5'));var fs=require('fs');var path=require(_0x5ab2('0x6'));var rimraf=require('rimraf');var config=require(_0x5ab2('0x7'));var attributes=require(_0x5ab2('0x8'));module[_0x5ab2('0x9')]=function(_0x3eebb3,_0x2facaa){return _0x3eebb3[_0x5ab2('0xa')](_0x5ab2('0xb'),attributes,{'tableName':_0x5ab2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x281e=['../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x1f51be,_0x355c27){var _0x3ffcce=function(_0x4fce0a){while(--_0x4fce0a){_0x1f51be['push'](_0x1f51be['shift']());}};_0x3ffcce(++_0x355c27);}(_0x281e,0x68));var _0xe281=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x281e[_0xbf8ebe];return _0x1e25e8;};'use strict';var _=require(_0xe281('0x0'));var util=require(_0xe281('0x1'));var logger=require(_0xe281('0x2'))(_0xe281('0x3'));var moment=require(_0xe281('0x4'));var BPromise=require(_0xe281('0x5'));var rp=require(_0xe281('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe281('0x7'));var config=require(_0xe281('0x8'));var attributes=require(_0xe281('0x9'));module[_0xe281('0xa')]=function(_0x2ae20d,_0x3319bb){return _0x2ae20d[_0xe281('0xb')](_0xe281('0xc'),attributes,{'tableName':_0xe281('0xd'),'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 6567f6e..7b54680 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 _0xeda7=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','DeskConfiguration,\x20%s,\x20%s','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4b2b75,_0x3c0844){var _0x34c82a=function(_0x7b607e){while(--_0x7b607e){_0x4b2b75['push'](_0x4b2b75['shift']());}};_0x34c82a(++_0x3c0844);}(_0xeda7,0x196));var _0x7eda=function(_0x5e4563,_0x3ff918){_0x5e4563=_0x5e4563-0x0;var _0x8d1bf5=_0xeda7[_0x5e4563];return _0x8d1bf5;};'use strict';var _=require(_0x7eda('0x0'));var util=require(_0x7eda('0x1'));var moment=require(_0x7eda('0x2'));var BPromise=require(_0x7eda('0x3'));var rs=require(_0x7eda('0x4'));var fs=require('fs');var Redis=require(_0x7eda('0x5'));var db=require(_0x7eda('0x6'))['db'];var utils=require(_0x7eda('0x7'));var logger=require(_0x7eda('0x8'))(_0x7eda('0x9'));var config=require(_0x7eda('0xa'));var jayson=require(_0x7eda('0xb'));var client=jayson[_0x7eda('0xc')][_0x7eda('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x314602,_0x839e38,_0x163427){return new BPromise(function(_0x2bc200,_0x11576a){return client[_0x7eda('0xe')](_0x314602,_0x163427)['then'](function(_0x29bce2){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x839e38,_0x7eda('0xf'));logger[_0x7eda('0x10')](_0x7eda('0x11'),_0x839e38,_0x7eda('0xf'),JSON['stringify'](_0x29bce2));if(_0x29bce2['error']){if(_0x29bce2[_0x7eda('0x12')][_0x7eda('0x13')]===0x1f4){logger[_0x7eda('0x12')](_0x7eda('0x14'),_0x839e38,_0x29bce2['error'][_0x7eda('0x15')]);return _0x11576a(_0x29bce2['error'][_0x7eda('0x15')]);}logger[_0x7eda('0x12')](_0x7eda('0x14'),_0x839e38,_0x29bce2[_0x7eda('0x12')][_0x7eda('0x15')]);return _0x2bc200(_0x29bce2[_0x7eda('0x12')][_0x7eda('0x15')]);}else{logger[_0x7eda('0x16')](_0x7eda('0x14'),_0x839e38,'request\x20sent');_0x2bc200(_0x29bce2['result'][_0x7eda('0x15')]);}})['catch'](function(_0x597ce9){logger[_0x7eda('0x12')](_0x7eda('0x14'),_0x839e38,_0x597ce9);_0x11576a(_0x597ce9);});});} \ No newline at end of file +var _0xeb7e=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','DeskConfiguration,\x20%s,\x20%s','info','result','catch','lodash','util'];(function(_0x50da66,_0x27342f){var _0x1472ba=function(_0x16c13e){while(--_0x16c13e){_0x50da66['push'](_0x50da66['shift']());}};_0x1472ba(++_0x27342f);}(_0xeb7e,0x1f2));var _0xeeb7=function(_0x4ce227,_0x188b1f){_0x4ce227=_0x4ce227-0x0;var _0x3997d2=_0xeb7e[_0x4ce227];return _0x3997d2;};'use strict';var _=require(_0xeeb7('0x0'));var util=require(_0xeeb7('0x1'));var moment=require(_0xeeb7('0x2'));var BPromise=require(_0xeeb7('0x3'));var rs=require(_0xeeb7('0x4'));var fs=require('fs');var Redis=require(_0xeeb7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xeeb7('0x6'));var logger=require(_0xeeb7('0x7'))(_0xeeb7('0x8'));var config=require(_0xeeb7('0x9'));var jayson=require(_0xeeb7('0xa'));var client=jayson[_0xeeb7('0xb')][_0xeeb7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x25372f,_0x508ebf,_0x19de00){return new BPromise(function(_0xa90e90,_0x4f6290){return client[_0xeeb7('0xd')](_0x25372f,_0x19de00)['then'](function(_0x2709dc){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x508ebf,'request\x20sent');logger[_0xeeb7('0xe')](_0xeeb7('0xf'),_0x508ebf,_0xeeb7('0x10'),JSON[_0xeeb7('0x11')](_0x2709dc));if(_0x2709dc[_0xeeb7('0x12')]){if(_0x2709dc['error'][_0xeeb7('0x13')]===0x1f4){logger[_0xeeb7('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x508ebf,_0x2709dc['error'][_0xeeb7('0x14')]);return _0x4f6290(_0x2709dc[_0xeeb7('0x12')][_0xeeb7('0x14')]);}logger[_0xeeb7('0x12')](_0xeeb7('0x15'),_0x508ebf,_0x2709dc[_0xeeb7('0x12')][_0xeeb7('0x14')]);return _0xa90e90(_0x2709dc['error'][_0xeeb7('0x14')]);}else{logger[_0xeeb7('0x16')]('DeskConfiguration,\x20%s,\x20%s',_0x508ebf,_0xeeb7('0x10'));_0xa90e90(_0x2709dc[_0xeeb7('0x17')][_0xeeb7('0x14')]);}})[_0xeeb7('0x18')](function(_0x2c1e23){logger[_0xeeb7('0x12')](_0xeeb7('0x15'),_0x508ebf,_0x2c1e23);_0x4f6290(_0x2c1e23);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 6e51ae0..e827fc8 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 _0x3624=['put','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','show','post'];(function(_0x49dc4a,_0x51a2d9){var _0x1f6464=function(_0x84cf86){while(--_0x84cf86){_0x49dc4a['push'](_0x49dc4a['shift']());}};_0x1f6464(++_0x51a2d9);}(_0x3624,0x152));var _0x4362=function(_0x1e4a8e,_0x18022b){_0x1e4a8e=_0x1e4a8e-0x0;var _0x5408f9=_0x3624[_0x1e4a8e];return _0x5408f9;};'use strict';var multer=require(_0x4362('0x0'));var util=require(_0x4362('0x1'));var path=require(_0x4362('0x2'));var timeout=require(_0x4362('0x3'));var express=require(_0x4362('0x4'));var router=express[_0x4362('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4362('0x6'));var interaction=require(_0x4362('0x7'));var config=require(_0x4362('0x8'));var controller=require(_0x4362('0x9'));router[_0x4362('0xa')]('/',auth[_0x4362('0xb')](),controller['index']);router[_0x4362('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x4362('0xc')]);router[_0x4362('0xd')]('/',auth[_0x4362('0xb')](),controller['create']);router[_0x4362('0xe')]('/:id',auth[_0x4362('0xb')](),controller[_0x4362('0xf')]);router['delete']('/:id',auth[_0x4362('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4be1=['./intDeskField.controller','get','isAuthenticated','index','post','put','/:id','update','delete','destroy','multer','util','path','express','fs-extra','../../components/interaction/service'];(function(_0x20eacd,_0x2394e2){var _0x57942a=function(_0xd86eda){while(--_0xd86eda){_0x20eacd['push'](_0x20eacd['shift']());}};_0x57942a(++_0x2394e2);}(_0x4be1,0x10a));var _0x14be=function(_0x147c96,_0x309657){_0x147c96=_0x147c96-0x0;var _0x4ec711=_0x4be1[_0x147c96];return _0x4ec711;};'use strict';var multer=require(_0x14be('0x0'));var util=require(_0x14be('0x1'));var path=require(_0x14be('0x2'));var timeout=require('connect-timeout');var express=require(_0x14be('0x3'));var router=express['Router']();var fs_extra=require(_0x14be('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x14be('0x5'));var config=require('../../config/environment');var controller=require(_0x14be('0x6'));router[_0x14be('0x7')]('/',auth[_0x14be('0x8')](),controller[_0x14be('0x9')]);router[_0x14be('0x7')]('/:id',auth[_0x14be('0x8')](),controller['show']);router[_0x14be('0xa')]('/',auth[_0x14be('0x8')](),controller['create']);router[_0x14be('0xb')](_0x14be('0xc'),auth[_0x14be('0x8')](),controller[_0x14be('0xd')]);router[_0x14be('0xe')](_0x14be('0xc'),auth[_0x14be('0x8')](),controller[_0x14be('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 6ca162f..f8deae8 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 _0x15c2=['variable','customVariable','keyValue','STRING','sequelize','ENUM','string'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x15c2,0x66));var _0x215c=function(_0x1e660e,_0x522348){_0x1e660e=_0x1e660e-0x0;var _0x155339=_0x15c2[_0x1e660e];return _0x155339;};'use strict';var Sequelize=require(_0x215c('0x0'));module['exports']={'type':{'type':Sequelize[_0x215c('0x1')](_0x215c('0x2'),_0x215c('0x3'),_0x215c('0x4'),_0x215c('0x5'),'picklist'),'defaultValue':_0x215c('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x215c('0x6')]},'keyType':{'type':Sequelize[_0x215c('0x1')]('string',_0x215c('0x3'),_0x215c('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x215c('0x6')]},'nameField':{'type':Sequelize[_0x215c('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x215c('0x6')]}}; \ No newline at end of file +var _0x2416=['variable','BOOLEAN','sequelize','exports','string','customVariable','keyValue','picklist','STRING','ENUM'];(function(_0x49b712,_0x4a91b3){var _0x308935=function(_0x23e9c7){while(--_0x23e9c7){_0x49b712['push'](_0x49b712['shift']());}};_0x308935(++_0x4a91b3);}(_0x2416,0x1b0));var _0x6241=function(_0x1962e9,_0xc92091){_0x1962e9=_0x1962e9-0x0;var _0x56bc1b=_0x2416[_0x1962e9];return _0x56bc1b;};'use strict';var Sequelize=require(_0x6241('0x0'));module[_0x6241('0x1')]={'type':{'type':Sequelize['ENUM'](_0x6241('0x2'),'variable',_0x6241('0x3'),_0x6241('0x4'),_0x6241('0x5')),'defaultValue':_0x6241('0x2')},'content':{'type':Sequelize[_0x6241('0x6')]},'key':{'type':Sequelize[_0x6241('0x6')]},'keyType':{'type':Sequelize[_0x6241('0x7')](_0x6241('0x2'),_0x6241('0x8'),_0x6241('0x3'))},'keyContent':{'type':Sequelize[_0x6241('0x6')]},'idField':{'type':Sequelize[_0x6241('0x6')]},'nameField':{'type':Sequelize[_0x6241('0x6')]},'customField':{'type':Sequelize[_0x6241('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6241('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index d2b44b4..d972c12 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 _0x090a=['rows','catch','show','params','includeAll','find','body','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','DeskField','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include'];(function(_0x58053f,_0x121503){var _0x2c30c7=function(_0x4d3d73){while(--_0x4d3d73){_0x58053f['push'](_0x58053f['shift']());}};_0x2c30c7(++_0x121503);}(_0x090a,0x133));var _0xa090=function(_0x436c85,_0x79d3ab){_0x436c85=_0x436c85-0x0;var _0x3769a2=_0x090a[_0x436c85];return _0x3769a2;};'use strict';var emlformat=require(_0xa090('0x0'));var rimraf=require(_0xa090('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa090('0x2'));var rp=require(_0xa090('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa090('0x4'));var util=require('util');var path=require(_0xa090('0x5'));var sox=require(_0xa090('0x6'));var csv=require(_0xa090('0x7'));var ejs=require(_0xa090('0x8'));var fs=require('fs');var fs_extra=require(_0xa090('0x9'));var _=require(_0xa090('0xa'));var squel=require(_0xa090('0xb'));var crypto=require(_0xa090('0xc'));var jsforce=require(_0xa090('0xd'));var deskjs=require(_0xa090('0xe'));var toCsv=require(_0xa090('0x7'));var querystring=require(_0xa090('0xf'));var Papa=require(_0xa090('0x10'));var Redis=require(_0xa090('0x11'));var authService=require(_0xa090('0x12'));var qs=require(_0xa090('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa090('0x14'));var logger=require('../../config/logger')(_0xa090('0x15'));var utils=require(_0xa090('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa090('0x17'));var db=require(_0xa090('0x18'))['db'];function respondWithStatusCode(_0x46164a,_0x337aad){_0x337aad=_0x337aad||0xcc;return function(_0x168827){if(_0x168827){return _0x46164a[_0xa090('0x19')](_0x337aad);}return _0x46164a['status'](_0x337aad)[_0xa090('0x1a')]();};}function respondWithResult(_0x26d9c7,_0x1407d3){_0x1407d3=_0x1407d3||0xc8;return function(_0x25601e){if(_0x25601e){return _0x26d9c7[_0xa090('0x1b')](_0x1407d3)[_0xa090('0x1c')](_0x25601e);}};}function respondWithFilteredResult(_0xe1f5c9,_0x297e21){return function(_0x1a7314){if(_0x1a7314){var _0x48c5b2=typeof _0x297e21['offset']===_0xa090('0x1d')&&typeof _0x297e21[_0xa090('0x1e')]===_0xa090('0x1d');var _0xd3983=_0x1a7314['count'];var _0x2ad993=_0x48c5b2?0x0:_0x297e21[_0xa090('0x1f')];var _0x19aaf5=_0x48c5b2?_0x1a7314[_0xa090('0x20')]:_0x297e21['offset']+_0x297e21['limit'];var _0x36afd8;if(_0x19aaf5>=_0xd3983){_0x19aaf5=_0xd3983;_0x36afd8=0xc8;}else{_0x36afd8=0xce;}_0xe1f5c9[_0xa090('0x1b')](_0x36afd8);return _0xe1f5c9[_0xa090('0x21')](_0xa090('0x22'),_0x2ad993+'-'+_0x19aaf5+'/'+_0xd3983)[_0xa090('0x1c')](_0x1a7314);}return null;};}function patchUpdates(_0x5e0036){return function(_0x479a66){try{jsonpatch[_0xa090('0x23')](_0x479a66,_0x5e0036,!![]);}catch(_0x553d64){return BPromise['reject'](_0x553d64);}return _0x479a66[_0xa090('0x24')]();};}function saveUpdates(_0x39983b,_0x2f68c6){return function(_0x17693f){if(_0x17693f){return _0x17693f[_0xa090('0x25')](_0x39983b)[_0xa090('0x26')](function(_0x474b6b){return _0x474b6b;});}return null;};}function removeEntity(_0xc60bfd,_0x2f587d){return function(_0x210ae3){if(_0x210ae3){return _0x210ae3[_0xa090('0x27')]()[_0xa090('0x26')](function(){_0xc60bfd[_0xa090('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55a954,_0xfd6cf0){return function(_0x34e50a){if(!_0x34e50a){_0x55a954[_0xa090('0x19')](0x194);}return _0x34e50a;};}function handleError(_0x3f8af2,_0x365f35){_0x365f35=_0x365f35||0x1f4;return function(_0x452734){logger[_0xa090('0x28')](_0x452734[_0xa090('0x29')]);if(_0x452734[_0xa090('0x2a')]){delete _0x452734[_0xa090('0x2a')];}_0x3f8af2[_0xa090('0x1b')](_0x365f35)[_0xa090('0x2b')](_0x452734);};}exports[_0xa090('0x2c')]=function(_0x2f36da,_0x512f0d){var _0xae6cc1={},_0x3e69f8={},_0x23286f={'count':0x0,'rows':[]};var _0x2e18d6=_[_0xa090('0x2d')](db[_0xa090('0x2e')][_0xa090('0x2f')],function(_0x1c21c8){return{'name':_0x1c21c8[_0xa090('0x30')],'type':_0x1c21c8[_0xa090('0x31')]['key']};});_0x3e69f8['model']=_[_0xa090('0x2d')](_0x2e18d6,_0xa090('0x2a'));_0x3e69f8[_0xa090('0x32')]=_[_0xa090('0x33')](_0x2f36da[_0xa090('0x32')]);_0x3e69f8[_0xa090('0x34')]=_[_0xa090('0x35')](_0x3e69f8[_0xa090('0x36')],_0x3e69f8[_0xa090('0x32')]);_0xae6cc1[_0xa090('0x37')]=_[_0xa090('0x35')](_0x3e69f8[_0xa090('0x36')],qs[_0xa090('0x38')](_0x2f36da['query'][_0xa090('0x38')]));_0xae6cc1['attributes']=_0xae6cc1[_0xa090('0x37')][_0xa090('0x39')]?_0xae6cc1[_0xa090('0x37')]:_0x3e69f8['model'];if(!_0x2f36da[_0xa090('0x32')]['hasOwnProperty'](_0xa090('0x3a'))){_0xae6cc1['limit']=qs['limit'](_0x2f36da[_0xa090('0x32')][_0xa090('0x1e')]);_0xae6cc1[_0xa090('0x1f')]=qs['offset'](_0x2f36da[_0xa090('0x32')]['offset']);}_0xae6cc1[_0xa090('0x3b')]=qs[_0xa090('0x3c')](_0x2f36da[_0xa090('0x32')][_0xa090('0x3c')]);_0xae6cc1[_0xa090('0x3d')]=qs[_0xa090('0x34')](_[_0xa090('0x3e')](_0x2f36da[_0xa090('0x32')],_0x3e69f8[_0xa090('0x34')]),_0x2e18d6);if(_0x2f36da[_0xa090('0x32')][_0xa090('0x3f')]){_0xae6cc1[_0xa090('0x3d')]=_[_0xa090('0x40')](_0xae6cc1['where'],{'$or':_[_0xa090('0x2d')](_0x2e18d6,function(_0x33a41d){if(_0x33a41d[_0xa090('0x31')]!==_0xa090('0x41')){var _0x4cb5cc={};_0x4cb5cc[_0x33a41d['name']]={'$like':'%'+_0x2f36da[_0xa090('0x32')][_0xa090('0x3f')]+'%'};return _0x4cb5cc;}})});}_0xae6cc1=_['merge']({},_0xae6cc1,_0x2f36da[_0xa090('0x42')]);var _0xd6908e={'where':_0xae6cc1[_0xa090('0x3d')]};return db['DeskField']['count'](_0xd6908e)[_0xa090('0x26')](function(_0x3f43f2){_0x23286f[_0xa090('0x20')]=_0x3f43f2;if(_0x2f36da[_0xa090('0x32')]['includeAll']){_0xae6cc1[_0xa090('0x43')]=[{'all':!![]}];}return db[_0xa090('0x2e')]['findAll'](_0xae6cc1);})[_0xa090('0x26')](function(_0x2032ea){_0x23286f[_0xa090('0x44')]=_0x2032ea;return _0x23286f;})['then'](respondWithFilteredResult(_0x512f0d,_0xae6cc1))[_0xa090('0x45')](handleError(_0x512f0d,null));};exports[_0xa090('0x46')]=function(_0x49f658,_0x38afa6){var _0x19f357={'raw':!![],'where':{'id':_0x49f658[_0xa090('0x47')]['id']}},_0x3abc8b={};_0x3abc8b[_0xa090('0x36')]=_[_0xa090('0x33')](db[_0xa090('0x2e')]['rawAttributes']);_0x3abc8b['query']=_[_0xa090('0x33')](_0x49f658[_0xa090('0x32')]);_0x3abc8b[_0xa090('0x34')]=_[_0xa090('0x35')](_0x3abc8b[_0xa090('0x36')],_0x3abc8b['query']);_0x19f357[_0xa090('0x37')]=_[_0xa090('0x35')](_0x3abc8b[_0xa090('0x36')],qs['fields'](_0x49f658[_0xa090('0x32')][_0xa090('0x38')]));_0x19f357[_0xa090('0x37')]=_0x19f357[_0xa090('0x37')][_0xa090('0x39')]?_0x19f357['attributes']:_0x3abc8b[_0xa090('0x36')];if(_0x49f658[_0xa090('0x32')][_0xa090('0x48')]){_0x19f357[_0xa090('0x43')]=[{'all':!![]}];}_0x19f357=_[_0xa090('0x40')]({},_0x19f357,_0x49f658[_0xa090('0x42')]);return db[_0xa090('0x2e')][_0xa090('0x49')](_0x19f357)[_0xa090('0x26')](handleEntityNotFound(_0x38afa6,null))['then'](respondWithResult(_0x38afa6,null))[_0xa090('0x45')](handleError(_0x38afa6,null));};exports['create']=function(_0x1bba33,_0x190450){return db[_0xa090('0x2e')]['create'](_0x1bba33[_0xa090('0x4a')],{})[_0xa090('0x26')](respondWithResult(_0x190450,0xc9))[_0xa090('0x45')](handleError(_0x190450,null));};exports[_0xa090('0x25')]=function(_0x549210,_0x3c8358){if(_0x549210[_0xa090('0x4a')]['id']){delete _0x549210[_0xa090('0x4a')]['id'];}return db[_0xa090('0x2e')]['find']({'where':{'id':_0x549210[_0xa090('0x47')]['id']}})[_0xa090('0x26')](handleEntityNotFound(_0x3c8358,null))[_0xa090('0x26')](saveUpdates(_0x549210['body'],null))[_0xa090('0x26')](respondWithResult(_0x3c8358,null))[_0xa090('0x45')](handleError(_0x3c8358,null));};exports[_0xa090('0x27')]=function(_0x2eddeb,_0x2fcd34){return db[_0xa090('0x2e')]['find']({'where':{'id':_0x2eddeb[_0xa090('0x47')]['id']}})['then'](handleEntityNotFound(_0x2fcd34,null))[_0xa090('0x26')](removeEntity(_0x2fcd34,null))['catch'](handleError(_0x2fcd34,null));}; \ No newline at end of file +var _0x905a=['pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','catch','create','body','find','params','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','DeskField','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0xf28501,_0x2382a5){var _0x11a871=function(_0x82017){while(--_0x82017){_0xf28501['push'](_0xf28501['shift']());}};_0x11a871(++_0x2382a5);}(_0x905a,0xeb));var _0xa905=function(_0x87b9f3,_0x3b7250){_0x87b9f3=_0x87b9f3-0x0;var _0x1f60a9=_0x905a[_0x87b9f3];return _0x1f60a9;};'use strict';var emlformat=require(_0xa905('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa905('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa905('0x2'));var BPromise=require(_0xa905('0x3'));var Mustache=require(_0xa905('0x4'));var util=require(_0xa905('0x5'));var path=require(_0xa905('0x6'));var sox=require(_0xa905('0x7'));var csv=require(_0xa905('0x8'));var ejs=require(_0xa905('0x9'));var fs=require('fs');var fs_extra=require(_0xa905('0xa'));var _=require(_0xa905('0xb'));var squel=require(_0xa905('0xc'));var crypto=require(_0xa905('0xd'));var jsforce=require(_0xa905('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa905('0x8'));var querystring=require('querystring');var Papa=require(_0xa905('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa905('0x10'));var as=require(_0xa905('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa905('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xa905('0x13'));var licenseUtil=require(_0xa905('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54e06c,_0x3272df){_0x3272df=_0x3272df||0xcc;return function(_0x1caa49){if(_0x1caa49){return _0x54e06c[_0xa905('0x15')](_0x3272df);}return _0x54e06c[_0xa905('0x16')](_0x3272df)[_0xa905('0x17')]();};}function respondWithResult(_0xbe0d64,_0x4c42a4){_0x4c42a4=_0x4c42a4||0xc8;return function(_0x3ec259){if(_0x3ec259){return _0xbe0d64['status'](_0x4c42a4)[_0xa905('0x18')](_0x3ec259);}};}function respondWithFilteredResult(_0x97332d,_0x5990c8){return function(_0x58341f){if(_0x58341f){var _0x5b7b12=typeof _0x5990c8[_0xa905('0x19')]===_0xa905('0x1a')&&typeof _0x5990c8[_0xa905('0x1b')]===_0xa905('0x1a');var _0x185c1c=_0x58341f[_0xa905('0x1c')];var _0x1439d5=_0x5b7b12?0x0:_0x5990c8[_0xa905('0x19')];var _0xa59b33=_0x5b7b12?_0x58341f[_0xa905('0x1c')]:_0x5990c8[_0xa905('0x19')]+_0x5990c8[_0xa905('0x1b')];var _0x56c09f;if(_0xa59b33>=_0x185c1c){_0xa59b33=_0x185c1c;_0x56c09f=0xc8;}else{_0x56c09f=0xce;}_0x97332d[_0xa905('0x16')](_0x56c09f);return _0x97332d[_0xa905('0x1d')](_0xa905('0x1e'),_0x1439d5+'-'+_0xa59b33+'/'+_0x185c1c)[_0xa905('0x18')](_0x58341f);}return null;};}function patchUpdates(_0x14930d){return function(_0x36e094){try{jsonpatch['apply'](_0x36e094,_0x14930d,!![]);}catch(_0x4194a8){return BPromise[_0xa905('0x1f')](_0x4194a8);}return _0x36e094[_0xa905('0x20')]();};}function saveUpdates(_0x3193ca,_0x5c4b50){return function(_0x1da420){if(_0x1da420){return _0x1da420[_0xa905('0x21')](_0x3193ca)[_0xa905('0x22')](function(_0x1689a5){return _0x1689a5;});}return null;};}function removeEntity(_0x50a44a,_0x53d476){return function(_0x23fb4e){if(_0x23fb4e){return _0x23fb4e[_0xa905('0x23')]()['then'](function(){_0x50a44a[_0xa905('0x16')](0xcc)[_0xa905('0x17')]();});}};}function handleEntityNotFound(_0x447f6c,_0x182967){return function(_0x59fb12){if(!_0x59fb12){_0x447f6c[_0xa905('0x15')](0x194);}return _0x59fb12;};}function handleError(_0x3ad10c,_0x4bed6e){_0x4bed6e=_0x4bed6e||0x1f4;return function(_0x3e3067){logger[_0xa905('0x24')](_0x3e3067[_0xa905('0x25')]);if(_0x3e3067[_0xa905('0x26')]){delete _0x3e3067[_0xa905('0x26')];}_0x3ad10c[_0xa905('0x16')](_0x4bed6e)[_0xa905('0x27')](_0x3e3067);};}exports['index']=function(_0x3f391d,_0x32cf90){var _0x38c35d={},_0x4071c0={},_0x2713db={'count':0x0,'rows':[]};var _0x5d99eb=_['map'](db[_0xa905('0x28')][_0xa905('0x29')],function(_0x951d2e){return{'name':_0x951d2e[_0xa905('0x2a')],'type':_0x951d2e['type'][_0xa905('0x2b')]};});_0x4071c0[_0xa905('0x2c')]=_[_0xa905('0x2d')](_0x5d99eb,_0xa905('0x26'));_0x4071c0[_0xa905('0x2e')]=_['keys'](_0x3f391d[_0xa905('0x2e')]);_0x4071c0[_0xa905('0x2f')]=_[_0xa905('0x30')](_0x4071c0[_0xa905('0x2c')],_0x4071c0[_0xa905('0x2e')]);_0x38c35d[_0xa905('0x31')]=_['intersection'](_0x4071c0[_0xa905('0x2c')],qs[_0xa905('0x32')](_0x3f391d[_0xa905('0x2e')][_0xa905('0x32')]));_0x38c35d[_0xa905('0x31')]=_0x38c35d['attributes'][_0xa905('0x33')]?_0x38c35d['attributes']:_0x4071c0[_0xa905('0x2c')];if(!_0x3f391d[_0xa905('0x2e')][_0xa905('0x34')](_0xa905('0x35'))){_0x38c35d['limit']=qs[_0xa905('0x1b')](_0x3f391d[_0xa905('0x2e')]['limit']);_0x38c35d[_0xa905('0x19')]=qs['offset'](_0x3f391d[_0xa905('0x2e')]['offset']);}_0x38c35d[_0xa905('0x36')]=qs['sort'](_0x3f391d[_0xa905('0x2e')][_0xa905('0x37')]);_0x38c35d[_0xa905('0x38')]=qs[_0xa905('0x2f')](_[_0xa905('0x39')](_0x3f391d[_0xa905('0x2e')],_0x4071c0[_0xa905('0x2f')]),_0x5d99eb);if(_0x3f391d[_0xa905('0x2e')][_0xa905('0x3a')]){_0x38c35d[_0xa905('0x38')]=_[_0xa905('0x3b')](_0x38c35d['where'],{'$or':_[_0xa905('0x2d')](_0x5d99eb,function(_0xe08a81){if(_0xe08a81['type']!==_0xa905('0x3c')){var _0x271c32={};_0x271c32[_0xe08a81['name']]={'$like':'%'+_0x3f391d[_0xa905('0x2e')][_0xa905('0x3a')]+'%'};return _0x271c32;}})});}_0x38c35d=_['merge']({},_0x38c35d,_0x3f391d[_0xa905('0x3d')]);var _0x4b22f9={'where':_0x38c35d[_0xa905('0x38')]};return db[_0xa905('0x28')]['count'](_0x4b22f9)[_0xa905('0x22')](function(_0x4a8f02){_0x2713db[_0xa905('0x1c')]=_0x4a8f02;if(_0x3f391d['query'][_0xa905('0x3e')]){_0x38c35d[_0xa905('0x3f')]=[{'all':!![]}];}return db[_0xa905('0x28')][_0xa905('0x40')](_0x38c35d);})[_0xa905('0x22')](function(_0x193edc){_0x2713db[_0xa905('0x41')]=_0x193edc;return _0x2713db;})[_0xa905('0x22')](respondWithFilteredResult(_0x32cf90,_0x38c35d))['catch'](handleError(_0x32cf90,null));};exports[_0xa905('0x42')]=function(_0x1e10a7,_0x5a44dc){var _0x274f7a={'raw':!![],'where':{'id':_0x1e10a7['params']['id']}},_0x1d6033={};_0x1d6033[_0xa905('0x2c')]=_[_0xa905('0x43')](db['DeskField'][_0xa905('0x29')]);_0x1d6033[_0xa905('0x2e')]=_[_0xa905('0x43')](_0x1e10a7[_0xa905('0x2e')]);_0x1d6033[_0xa905('0x2f')]=_[_0xa905('0x30')](_0x1d6033[_0xa905('0x2c')],_0x1d6033[_0xa905('0x2e')]);_0x274f7a[_0xa905('0x31')]=_[_0xa905('0x30')](_0x1d6033[_0xa905('0x2c')],qs['fields'](_0x1e10a7[_0xa905('0x2e')]['fields']));_0x274f7a['attributes']=_0x274f7a[_0xa905('0x31')]['length']?_0x274f7a[_0xa905('0x31')]:_0x1d6033['model'];if(_0x1e10a7['query'][_0xa905('0x3e')]){_0x274f7a['include']=[{'all':!![]}];}_0x274f7a=_[_0xa905('0x3b')]({},_0x274f7a,_0x1e10a7['options']);return db['DeskField']['find'](_0x274f7a)['then'](handleEntityNotFound(_0x5a44dc,null))[_0xa905('0x22')](respondWithResult(_0x5a44dc,null))[_0xa905('0x44')](handleError(_0x5a44dc,null));};exports[_0xa905('0x45')]=function(_0x2ca873,_0x5c9e8a){return db[_0xa905('0x28')]['create'](_0x2ca873['body'],{})[_0xa905('0x22')](respondWithResult(_0x5c9e8a,0xc9))[_0xa905('0x44')](handleError(_0x5c9e8a,null));};exports[_0xa905('0x21')]=function(_0x1e1089,_0x10e0b7){if(_0x1e1089[_0xa905('0x46')]['id']){delete _0x1e1089[_0xa905('0x46')]['id'];}return db[_0xa905('0x28')][_0xa905('0x47')]({'where':{'id':_0x1e1089[_0xa905('0x48')]['id']}})[_0xa905('0x22')](handleEntityNotFound(_0x10e0b7,null))[_0xa905('0x22')](saveUpdates(_0x1e1089[_0xa905('0x46')],null))[_0xa905('0x22')](respondWithResult(_0x10e0b7,null))[_0xa905('0x44')](handleError(_0x10e0b7,null));};exports[_0xa905('0x23')]=function(_0x29d44a,_0x2af289){return db[_0xa905('0x28')][_0xa905('0x47')]({'where':{'id':_0x29d44a[_0xa905('0x48')]['id']}})[_0xa905('0x22')](handleEntityNotFound(_0x2af289,null))[_0xa905('0x22')](removeEntity(_0x2af289,null))[_0xa905('0x44')](handleError(_0x2af289,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index cf6fec4..49622e9 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 _0x6012=['path','rimraf','../../config/environment','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x5f31cf,_0x2595c3){var _0x24f87e=function(_0x32e244){while(--_0x32e244){_0x5f31cf['push'](_0x5f31cf['shift']());}};_0x24f87e(++_0x2595c3);}(_0x6012,0x15a));var _0x2601=function(_0x13137e,_0x29c0f3){_0x13137e=_0x13137e-0x0;var _0x346261=_0x6012[_0x13137e];return _0x346261;};'use strict';var _=require(_0x2601('0x0'));var util=require(_0x2601('0x1'));var logger=require(_0x2601('0x2'))('api');var moment=require(_0x2601('0x3'));var BPromise=require(_0x2601('0x4'));var rp=require(_0x2601('0x5'));var fs=require('fs');var path=require(_0x2601('0x6'));var rimraf=require(_0x2601('0x7'));var config=require(_0x2601('0x8'));var attributes=require('./intDeskField.attributes');module[_0x2601('0x9')]=function(_0x30eacc,_0x5ea8fa){return _0x30eacc[_0x2601('0xa')](_0x2601('0xb'),attributes,{'tableName':_0x2601('0xc'),'paranoid':![],'indexes':[{'name':_0x2601('0xd'),'fields':[_0x2601('0xe'),_0x2601('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe153=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDeskField.attributes','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash'];(function(_0x2129bd,_0x307d53){var _0x1574a5=function(_0x10bacc){while(--_0x10bacc){_0x2129bd['push'](_0x2129bd['shift']());}};_0x1574a5(++_0x307d53);}(_0xe153,0x149));var _0x3e15=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xe153[_0x1b2ff7];return _0x31656a;};'use strict';var _=require(_0x3e15('0x0'));var util=require(_0x3e15('0x1'));var logger=require(_0x3e15('0x2'))(_0x3e15('0x3'));var moment=require(_0x3e15('0x4'));var BPromise=require(_0x3e15('0x5'));var rp=require(_0x3e15('0x6'));var fs=require('fs');var path=require(_0x3e15('0x7'));var rimraf=require(_0x3e15('0x8'));var config=require('../../config/environment');var attributes=require(_0x3e15('0x9'));module['exports']=function(_0x3f7cca,_0x3400ba){return _0x3f7cca['define'](_0x3e15('0xa'),attributes,{'tableName':_0x3e15('0xb'),'paranoid':![],'indexes':[{'name':_0x3e15('0xc'),'fields':[_0x3e15('0xd'),_0x3e15('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 0f5274b..64cafaa 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 _0x3a35=['jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x3f758f,_0x302451){var _0x26e4ae=function(_0x54beae){while(--_0x54beae){_0x3f758f['push'](_0x3f758f['shift']());}};_0x26e4ae(++_0x302451);}(_0x3a35,0x1b2));var _0x53a3=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x3a35[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0x53a3('0x0'));var util=require('util');var moment=require(_0x53a3('0x1'));var BPromise=require('bluebird');var rs=require(_0x53a3('0x2'));var fs=require('fs');var Redis=require(_0x53a3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x53a3('0x4'));var logger=require(_0x53a3('0x5'))('rpc');var config=require(_0x53a3('0x6'));var jayson=require(_0x53a3('0x7'));var client=jayson[_0x53a3('0x8')][_0x53a3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x117928,_0x44e2d4,_0x19ae89){return new BPromise(function(_0x365037,_0x57c508){return client[_0x53a3('0xa')](_0x117928,_0x19ae89)[_0x53a3('0xb')](function(_0x508436){logger[_0x53a3('0xc')](_0x53a3('0xd'),_0x44e2d4,_0x53a3('0xe'));logger['debug'](_0x53a3('0xf'),_0x44e2d4,_0x53a3('0xe'),JSON[_0x53a3('0x10')](_0x508436));if(_0x508436[_0x53a3('0x11')]){if(_0x508436[_0x53a3('0x11')]['code']===0x1f4){logger[_0x53a3('0x11')](_0x53a3('0xd'),_0x44e2d4,_0x508436[_0x53a3('0x11')][_0x53a3('0x12')]);return _0x57c508(_0x508436[_0x53a3('0x11')][_0x53a3('0x12')]);}logger[_0x53a3('0x11')]('DeskField,\x20%s,\x20%s',_0x44e2d4,_0x508436[_0x53a3('0x11')][_0x53a3('0x12')]);return _0x365037(_0x508436[_0x53a3('0x11')][_0x53a3('0x12')]);}else{logger[_0x53a3('0xc')]('DeskField,\x20%s,\x20%s',_0x44e2d4,'request\x20sent');_0x365037(_0x508436[_0x53a3('0x13')][_0x53a3('0x12')]);}})[_0x53a3('0x14')](function(_0x2e6820){logger['error'](_0x53a3('0xd'),_0x44e2d4,_0x2e6820);_0x57c508(_0x2e6820);});});} \ No newline at end of file +var _0x92e5=['DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info'];(function(_0x4b5834,_0x5d2d54){var _0x369490=function(_0x350bb7){while(--_0x350bb7){_0x4b5834['push'](_0x4b5834['shift']());}};_0x369490(++_0x5d2d54);}(_0x92e5,0x10b));var _0x592e=function(_0x2a295a,_0x4d1e42){_0x2a295a=_0x2a295a-0x0;var _0x15f31c=_0x92e5[_0x2a295a];return _0x15f31c;};'use strict';var _=require(_0x592e('0x0'));var util=require(_0x592e('0x1'));var moment=require('moment');var BPromise=require(_0x592e('0x2'));var rs=require(_0x592e('0x3'));var fs=require('fs');var Redis=require(_0x592e('0x4'));var db=require(_0x592e('0x5'))['db'];var utils=require(_0x592e('0x6'));var logger=require(_0x592e('0x7'))('rpc');var config=require(_0x592e('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x592e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x316483,_0x1708da,_0x545af0){return new BPromise(function(_0x1d5f72,_0x2788a6){return client[_0x592e('0xa')](_0x316483,_0x545af0)[_0x592e('0xb')](function(_0x4cd6f0){logger[_0x592e('0xc')](_0x592e('0xd'),_0x1708da,_0x592e('0xe'));logger[_0x592e('0xf')](_0x592e('0x10'),_0x1708da,'request\x20sent',JSON[_0x592e('0x11')](_0x4cd6f0));if(_0x4cd6f0['error']){if(_0x4cd6f0['error']['code']===0x1f4){logger[_0x592e('0x12')](_0x592e('0xd'),_0x1708da,_0x4cd6f0[_0x592e('0x12')][_0x592e('0x13')]);return _0x2788a6(_0x4cd6f0['error'][_0x592e('0x13')]);}logger['error']('DeskField,\x20%s,\x20%s',_0x1708da,_0x4cd6f0[_0x592e('0x12')][_0x592e('0x13')]);return _0x1d5f72(_0x4cd6f0[_0x592e('0x12')][_0x592e('0x13')]);}else{logger[_0x592e('0xc')]('DeskField,\x20%s,\x20%s',_0x1708da,_0x592e('0xe'));_0x1d5f72(_0x4cd6f0['result'][_0x592e('0x13')]);}})['catch'](function(_0x2c27da){logger[_0x592e('0x12')](_0x592e('0xd'),_0x1708da,_0x2c27da);_0x2788a6(_0x2c27da);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 8871591..9ce19a4 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 _0x7777=['post','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','getFields'];(function(_0x436073,_0x11b1d6){var _0x564463=function(_0x5836cf){while(--_0x5836cf){_0x436073['push'](_0x436073['shift']());}};_0x564463(++_0x11b1d6);}(_0x7777,0x7c));var _0x7777=function(_0x5400b,_0x55943a){_0x5400b=_0x5400b-0x0;var _0x36a39b=_0x7777[_0x5400b];return _0x36a39b;};'use strict';var multer=require(_0x7777('0x0'));var util=require(_0x7777('0x1'));var path=require('path');var timeout=require(_0x7777('0x2'));var express=require(_0x7777('0x3'));var router=express[_0x7777('0x4')]();var fs_extra=require(_0x7777('0x5'));var auth=require(_0x7777('0x6'));var interaction=require(_0x7777('0x7'));var config=require(_0x7777('0x8'));var controller=require(_0x7777('0x9'));router[_0x7777('0xa')]('/',auth[_0x7777('0xb')](),controller['index']);router[_0x7777('0xa')](_0x7777('0xc'),auth[_0x7777('0xb')](),controller['show']);router[_0x7777('0xa')](_0x7777('0xd'),auth[_0x7777('0xb')](),controller[_0x7777('0xe')]);router[_0x7777('0xa')]('/:id/fields',auth[_0x7777('0xb')](),controller[_0x7777('0xf')]);router[_0x7777('0x10')]('/',auth[_0x7777('0xb')](),controller['create']);router['post'](_0x7777('0xd'),auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0x7777('0xc'),auth['isAuthenticated'](),controller[_0x7777('0x11')]);router['delete'](_0x7777('0xc'),auth[_0x7777('0xb')](),controller[_0x7777('0x12')]);module[_0x7777('0x13')]=router; \ No newline at end of file +var _0x05c7=['/:id/configurations','getConfigurations','post','addConfiguration','put','update','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/:id','get'];(function(_0x836465,_0x5442ae){var _0x2150ea=function(_0x4f4bc2){while(--_0x4f4bc2){_0x836465['push'](_0x836465['shift']());}};_0x2150ea(++_0x5442ae);}(_0x05c7,0x16c));var _0x705c=function(_0x34683b,_0x19932c){_0x34683b=_0x34683b-0x0;var _0x2a01f0=_0x05c7[_0x34683b];return _0x2a01f0;};'use strict';var multer=require(_0x705c('0x0'));var util=require(_0x705c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x705c('0x2'));var router=express[_0x705c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x705c('0x4'));var interaction=require(_0x705c('0x5'));var config=require('../../config/environment');var controller=require('./intDynamics365Account.controller');router['get']('/',auth[_0x705c('0x6')](),controller[_0x705c('0x7')]);router['get'](_0x705c('0x8'),auth[_0x705c('0x6')](),controller['show']);router[_0x705c('0x9')](_0x705c('0xa'),auth[_0x705c('0x6')](),controller[_0x705c('0xb')]);router[_0x705c('0x9')]('/:id/fields',auth[_0x705c('0x6')](),controller['getFields']);router['post']('/',auth[_0x705c('0x6')](),controller['create']);router[_0x705c('0xc')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x705c('0xd')]);router[_0x705c('0xe')](_0x705c('0x8'),auth[_0x705c('0x6')](),controller[_0x705c('0xf')]);router['delete'](_0x705c('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x705c('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index f5b323d..4f05434 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 _0xff24=['exports','STRING','sequelize'];(function(_0x4e13f2,_0xa3dcb1){var _0xfa0160=function(_0x1c2d31){while(--_0x1c2d31){_0x4e13f2['push'](_0x4e13f2['shift']());}};_0xfa0160(++_0xa3dcb1);}(_0xff24,0xb6));var _0x4ff2=function(_0x24a9b6,_0x236702){_0x24a9b6=_0x24a9b6-0x0;var _0xf89854=_0xff24[_0x24a9b6];return _0xf89854;};'use strict';var Sequelize=require(_0x4ff2('0x0'));module[_0x4ff2('0x1')]={'name':{'type':Sequelize[_0x4ff2('0x2')]},'username':{'type':Sequelize[_0x4ff2('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x4ff2('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x4ff2('0x2')]},'serverUrl':{'type':Sequelize[_0x4ff2('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x4ff2('0x2')]}}; \ No newline at end of file +var _0xe2b8=['STRING','exports'];(function(_0x5483c9,_0x576f04){var _0x1e8337=function(_0xfef303){while(--_0xfef303){_0x5483c9['push'](_0x5483c9['shift']());}};_0x1e8337(++_0x576f04);}(_0xe2b8,0x189));var _0x8e2b=function(_0x1f83a5,_0x59843f){_0x1f83a5=_0x1f83a5-0x0;var _0x45edf0=_0xe2b8[_0x1f83a5];return _0x45edf0;};'use strict';var Sequelize=require('sequelize');module[_0x8e2b('0x0')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x8e2b('0x1')]},'password':{'type':Sequelize[_0x8e2b('0x1')]},'remoteUri':{'type':Sequelize[_0x8e2b('0x1')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x8e2b('0x1')]},'clientSecret':{'type':Sequelize[_0x8e2b('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8e2b('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 149d018..cb438af 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 _0xcee8=['status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','hasOwnProperty','nolimit','pick','filter','VIRTUAL','options','where','includeAll','include','Dynamics365Account','rows','show','length','merge','find','catch','create','body','params','findOne','Dynamics365Configuration','sort','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Dynamics365Field','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridyominame','primarycontactidyominame','prioritycodename','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','username','remoteUri','clientId','clientSecret','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','password','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','MetadataId','all','isNil','BooleanAttributeMetadata','BigIntAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','concat','test','statusCode','Wrong\x20credentials','GET',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus'];(function(_0x3b83da,_0x3149a6){var _0x6c8ce2=function(_0x19c096){while(--_0x19c096){_0x3b83da['push'](_0x3b83da['shift']());}};_0x6c8ce2(++_0x3149a6);}(_0xcee8,0xb1));var _0x8cee=function(_0x10d423,_0x287e09){_0x10d423=_0x10d423-0x0;var _0x3ead0c=_0xcee8[_0x10d423];return _0x3ead0c;};'use strict';var emlformat=require(_0x8cee('0x0'));var rimraf=require(_0x8cee('0x1'));var zipdir=require(_0x8cee('0x2'));var jsonpatch=require(_0x8cee('0x3'));var rp=require(_0x8cee('0x4'));var moment=require(_0x8cee('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8cee('0x6'));var util=require(_0x8cee('0x7'));var path=require(_0x8cee('0x8'));var sox=require(_0x8cee('0x9'));var csv=require('to-csv');var ejs=require(_0x8cee('0xa'));var fs=require('fs');var fs_extra=require(_0x8cee('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8cee('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8cee('0xd'));var toCsv=require(_0x8cee('0xe'));var querystring=require(_0x8cee('0xf'));var Papa=require(_0x8cee('0x10'));var Redis=require('ioredis');var authService=require(_0x8cee('0x11'));var qs=require(_0x8cee('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8cee('0x13'));var logger=require(_0x8cee('0x14'))('api');var utils=require(_0x8cee('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8cee('0x16'));var db=require(_0x8cee('0x17'))['db'];var integrations=require(_0x8cee('0x18'));function respondWithStatusCode(_0x28bd09,_0x4e1f09){_0x4e1f09=_0x4e1f09||0xcc;return function(_0x5d4de3){if(_0x5d4de3){return _0x28bd09[_0x8cee('0x19')](_0x4e1f09);}return _0x28bd09[_0x8cee('0x1a')](_0x4e1f09)[_0x8cee('0x1b')]();};}function respondWithResult(_0x227762,_0xedc808){_0xedc808=_0xedc808||0xc8;return function(_0x9d7853){if(_0x9d7853){return _0x227762[_0x8cee('0x1a')](_0xedc808)[_0x8cee('0x1c')](_0x9d7853);}};}function respondWithFilteredResult(_0x237248,_0x487241){return function(_0x33b07e){if(_0x33b07e){var _0x39213b=typeof _0x487241[_0x8cee('0x1d')]===_0x8cee('0x1e')&&typeof _0x487241[_0x8cee('0x1f')]==='undefined';var _0x3015bf=_0x33b07e['count'];var _0x4a3556=_0x39213b?0x0:_0x487241[_0x8cee('0x1d')];var _0x1bed34=_0x39213b?_0x33b07e[_0x8cee('0x20')]:_0x487241[_0x8cee('0x1d')]+_0x487241[_0x8cee('0x1f')];var _0x56ecf7;if(_0x1bed34>=_0x3015bf){_0x1bed34=_0x3015bf;_0x56ecf7=0xc8;}else{_0x56ecf7=0xce;}_0x237248[_0x8cee('0x1a')](_0x56ecf7);return _0x237248[_0x8cee('0x21')](_0x8cee('0x22'),_0x4a3556+'-'+_0x1bed34+'/'+_0x3015bf)['json'](_0x33b07e);}return null;};}function patchUpdates(_0x31dbd5){return function(_0x3e198f){try{jsonpatch['apply'](_0x3e198f,_0x31dbd5,!![]);}catch(_0x5c8e6b){return BPromise[_0x8cee('0x23')](_0x5c8e6b);}return _0x3e198f['save']();};}function saveUpdates(_0x54539b,_0x51a93f){return function(_0x51cf76){if(_0x51cf76){return _0x51cf76[_0x8cee('0x24')](_0x54539b)['then'](function(_0x117bc6){return _0x117bc6;});}return null;};}function removeEntity(_0x5e231e,_0x2ea47b){return function(_0x27e8fb){if(_0x27e8fb){return _0x27e8fb[_0x8cee('0x25')]()[_0x8cee('0x26')](function(){_0x5e231e[_0x8cee('0x1a')](0xcc)[_0x8cee('0x1b')]();});}};}function handleEntityNotFound(_0x89974f,_0x415f47){return function(_0x5a5ee5){if(!_0x5a5ee5){_0x89974f[_0x8cee('0x19')](0x194);}return _0x5a5ee5;};}function handleError(_0xc2ad7f,_0x5df746){_0x5df746=_0x5df746||0x1f4;return function(_0x5c4810){logger[_0x8cee('0x27')](_0x5c4810[_0x8cee('0x28')]);if(_0x5c4810[_0x8cee('0x29')]){delete _0x5c4810[_0x8cee('0x29')];}_0xc2ad7f[_0x8cee('0x1a')](_0x5df746)[_0x8cee('0x2a')](_0x5c4810);};}exports['index']=function(_0x1572d5,_0x4a7781){var _0x75f082={},_0x139867={},_0x16f571={'count':0x0,'rows':[]};var _0x1b6128=_[_0x8cee('0x2b')](db['Dynamics365Account'][_0x8cee('0x2c')],function(_0x5a301c){return{'name':_0x5a301c[_0x8cee('0x2d')],'type':_0x5a301c[_0x8cee('0x2e')][_0x8cee('0x2f')]};});_0x139867[_0x8cee('0x30')]=_['map'](_0x1b6128,_0x8cee('0x29'));_0x139867['query']=_[_0x8cee('0x31')](_0x1572d5['query']);_0x139867[_0x8cee('0x32')]=_['intersection'](_0x139867['model'],_0x139867[_0x8cee('0x33')]);_0x75f082[_0x8cee('0x34')]=_[_0x8cee('0x35')](_0x139867[_0x8cee('0x30')],qs[_0x8cee('0x36')](_0x1572d5[_0x8cee('0x33')][_0x8cee('0x36')]));_0x75f082[_0x8cee('0x34')]=_0x75f082['attributes']['length']?_0x75f082[_0x8cee('0x34')]:_0x139867[_0x8cee('0x30')];if(!_0x1572d5[_0x8cee('0x33')][_0x8cee('0x37')](_0x8cee('0x38'))){_0x75f082[_0x8cee('0x1f')]=qs['limit'](_0x1572d5[_0x8cee('0x33')][_0x8cee('0x1f')]);_0x75f082[_0x8cee('0x1d')]=qs[_0x8cee('0x1d')](_0x1572d5['query']['offset']);}_0x75f082['order']=qs['sort'](_0x1572d5[_0x8cee('0x33')]['sort']);_0x75f082['where']=qs[_0x8cee('0x32')](_[_0x8cee('0x39')](_0x1572d5[_0x8cee('0x33')],_0x139867[_0x8cee('0x32')]),_0x1b6128);if(_0x1572d5[_0x8cee('0x33')][_0x8cee('0x3a')]){_0x75f082['where']=_['merge'](_0x75f082['where'],{'$or':_[_0x8cee('0x2b')](_0x1b6128,function(_0xb07688){if(_0xb07688[_0x8cee('0x2e')]!==_0x8cee('0x3b')){var _0x50e460={};_0x50e460[_0xb07688[_0x8cee('0x29')]]={'$like':'%'+_0x1572d5[_0x8cee('0x33')]['filter']+'%'};return _0x50e460;}})});}_0x75f082=_['merge']({},_0x75f082,_0x1572d5[_0x8cee('0x3c')]);var _0x18b30c={'where':_0x75f082[_0x8cee('0x3d')]};return db['Dynamics365Account'][_0x8cee('0x20')](_0x18b30c)['then'](function(_0x43fec8){_0x16f571[_0x8cee('0x20')]=_0x43fec8;if(_0x1572d5[_0x8cee('0x33')][_0x8cee('0x3e')]){_0x75f082[_0x8cee('0x3f')]=[{'all':!![]}];}return db[_0x8cee('0x40')]['findAll'](_0x75f082);})[_0x8cee('0x26')](function(_0x6d5472){_0x16f571[_0x8cee('0x41')]=_0x6d5472;return _0x16f571;})[_0x8cee('0x26')](respondWithFilteredResult(_0x4a7781,_0x75f082))['catch'](handleError(_0x4a7781,null));};exports[_0x8cee('0x42')]=function(_0x190725,_0x582c90){var _0xa68469={'raw':![],'where':{'id':_0x190725['params']['id']}},_0x425eda={};_0x425eda[_0x8cee('0x30')]=_['keys'](db[_0x8cee('0x40')][_0x8cee('0x2c')]);_0x425eda[_0x8cee('0x33')]=_[_0x8cee('0x31')](_0x190725[_0x8cee('0x33')]);_0x425eda[_0x8cee('0x32')]=_[_0x8cee('0x35')](_0x425eda[_0x8cee('0x30')],_0x425eda[_0x8cee('0x33')]);_0xa68469[_0x8cee('0x34')]=_[_0x8cee('0x35')](_0x425eda[_0x8cee('0x30')],qs[_0x8cee('0x36')](_0x190725[_0x8cee('0x33')]['fields']));_0xa68469[_0x8cee('0x34')]=_0xa68469[_0x8cee('0x34')][_0x8cee('0x43')]?_0xa68469[_0x8cee('0x34')]:_0x425eda['model'];if(_0x190725[_0x8cee('0x33')][_0x8cee('0x3e')]){_0xa68469[_0x8cee('0x3f')]=[{'all':!![]}];}_0xa68469=_[_0x8cee('0x44')]({},_0xa68469,_0x190725[_0x8cee('0x3c')]);return db[_0x8cee('0x40')][_0x8cee('0x45')](_0xa68469)['then'](handleEntityNotFound(_0x582c90,null))['then'](respondWithResult(_0x582c90,null))[_0x8cee('0x46')](handleError(_0x582c90,null));};exports[_0x8cee('0x47')]=function(_0x267d77,_0x28b97b){return db[_0x8cee('0x40')][_0x8cee('0x47')](_0x267d77[_0x8cee('0x48')],{})[_0x8cee('0x26')](respondWithResult(_0x28b97b,0xc9))['catch'](handleError(_0x28b97b,null));};exports[_0x8cee('0x24')]=function(_0x10495e,_0x14a1bd){if(_0x10495e[_0x8cee('0x48')]['id']){delete _0x10495e['body']['id'];}return db[_0x8cee('0x40')][_0x8cee('0x45')]({'where':{'id':_0x10495e[_0x8cee('0x49')]['id']}})['then'](handleEntityNotFound(_0x14a1bd,null))[_0x8cee('0x26')](saveUpdates(_0x10495e[_0x8cee('0x48')],null))['then'](respondWithResult(_0x14a1bd,null))[_0x8cee('0x46')](handleError(_0x14a1bd,null));};exports[_0x8cee('0x25')]=function(_0x56182b,_0x4ca024){return db[_0x8cee('0x40')][_0x8cee('0x45')]({'where':{'id':_0x56182b['params']['id']}})[_0x8cee('0x26')](handleEntityNotFound(_0x4ca024,null))[_0x8cee('0x26')](removeEntity(_0x4ca024,null))[_0x8cee('0x46')](handleError(_0x4ca024,null));};exports['getConfigurations']=function(_0x37f6e6,_0x6f1319,_0x3ed61f){var _0x244c60={};var _0x5ecb09={};var _0x3f0a57;var _0x5cfb48;return db[_0x8cee('0x40')][_0x8cee('0x4a')]({'where':{'id':_0x37f6e6['params']['id']}})['then'](handleEntityNotFound(_0x6f1319,null))['then'](function(_0x34dde3){if(_0x34dde3){_0x3f0a57=_0x34dde3;_0x5ecb09[_0x8cee('0x30')]=_['keys'](db[_0x8cee('0x4b')][_0x8cee('0x2c')]);_0x5ecb09[_0x8cee('0x33')]=_[_0x8cee('0x31')](_0x37f6e6['query']);_0x5ecb09[_0x8cee('0x32')]=_[_0x8cee('0x35')](_0x5ecb09[_0x8cee('0x30')],_0x5ecb09[_0x8cee('0x33')]);_0x244c60[_0x8cee('0x34')]=_[_0x8cee('0x35')](_0x5ecb09[_0x8cee('0x30')],qs[_0x8cee('0x36')](_0x37f6e6[_0x8cee('0x33')]['fields']));_0x244c60[_0x8cee('0x34')]=_0x244c60[_0x8cee('0x34')][_0x8cee('0x43')]?_0x244c60['attributes']:_0x5ecb09['model'];_0x244c60['order']=qs['sort'](_0x37f6e6[_0x8cee('0x33')][_0x8cee('0x4c')]);_0x244c60[_0x8cee('0x3d')]=qs['filters'](_[_0x8cee('0x39')](_0x37f6e6[_0x8cee('0x33')],_0x5ecb09[_0x8cee('0x32')]));if(_0x37f6e6[_0x8cee('0x33')][_0x8cee('0x3a')]){_0x244c60[_0x8cee('0x3d')]=_[_0x8cee('0x44')](_0x244c60[_0x8cee('0x3d')],{'$or':_[_0x8cee('0x2b')](_0x244c60[_0x8cee('0x34')],function(_0x1b40d0){var _0x5550f7={};_0x5550f7[_0x1b40d0]={'$like':'%'+_0x37f6e6[_0x8cee('0x33')][_0x8cee('0x3a')]+'%'};return _0x5550f7;})});}_0x244c60=_[_0x8cee('0x44')]({},_0x244c60,_0x37f6e6['options']);return _0x3f0a57[_0x8cee('0x4d')](_0x244c60);}})[_0x8cee('0x26')](function(_0x53959e){if(_0x53959e){_0x5cfb48=_0x53959e[_0x8cee('0x43')];if(!_0x37f6e6[_0x8cee('0x33')][_0x8cee('0x37')]('nolimit')){_0x244c60[_0x8cee('0x1f')]=qs[_0x8cee('0x1f')](_0x37f6e6[_0x8cee('0x33')][_0x8cee('0x1f')]);_0x244c60[_0x8cee('0x1d')]=qs['offset'](_0x37f6e6[_0x8cee('0x33')][_0x8cee('0x1d')]);}return _0x3f0a57[_0x8cee('0x4d')](_0x244c60);}})['then'](function(_0x6648b){if(_0x6648b){return _0x6648b?{'count':_0x5cfb48,'rows':_0x6648b}:null;}})[_0x8cee('0x26')](respondWithResult(_0x6f1319,null))[_0x8cee('0x46')](handleError(_0x6f1319,null));};exports[_0x8cee('0x4e')]=function(_0x3a27ee,_0x5613cb,_0x2204e4){if(_0x3a27ee['body']['id']){delete _0x3a27ee[_0x8cee('0x48')]['id'];}return db[_0x8cee('0x40')][_0x8cee('0x4a')]({'where':{'id':_0x3a27ee[_0x8cee('0x49')]['id']}})[_0x8cee('0x26')](handleEntityNotFound(_0x5613cb,null))[_0x8cee('0x26')](function(_0x5ec6c4){if(_0x5ec6c4){_0x3a27ee[_0x8cee('0x48')][_0x8cee('0x4f')]=_0x5ec6c4['id'];_0x3a27ee[_0x8cee('0x48')][_0x8cee('0x50')]=integrations[_0x8cee('0x51')](_0x3a27ee[_0x8cee('0x48')][_0x8cee('0x52')],_0x3a27ee[_0x8cee('0x48')][_0x8cee('0x2e')]);_0x3a27ee[_0x8cee('0x48')]['Descriptions']=integrations['getDescriptions'](_0x3a27ee[_0x8cee('0x48')][_0x8cee('0x52')],_0x3a27ee[_0x8cee('0x48')]['type']);return db['Dynamics365Configuration'][_0x8cee('0x47')](_0x3a27ee[_0x8cee('0x48')],{'include':[{'model':db[_0x8cee('0x53')],'as':_0x8cee('0x50')},{'model':db[_0x8cee('0x53')],'as':'Descriptions'}]});}return null;})[_0x8cee('0x26')](respondWithResult(_0x5613cb,null))['catch'](handleError(_0x5613cb,null));};exports['getFields']=function(_0x49b18a,_0x98af20,_0x5808ca){var _0x1087e8=_0x49b18a[_0x8cee('0x33')]['ticketType'];var _0x31cfbb=_0x1087e8==='incident'?_0x8cee('0x54'):_0x8cee('0x55');var _0x57ab97='';var _0x348707='';var _0x3a3600='';var _0x4cb877='';var _0x1f3f31='';var _0x5141ea='';var _0x4fa498='';var _0x30a313='';var _0x112a38=[_0x8cee('0x56'),_0x8cee('0x57'),_0x8cee('0x58'),_0x8cee('0x59'),_0x8cee('0x5a'),_0x8cee('0x5b'),'phonenumber',_0x8cee('0x5c'),_0x8cee('0x5d'),_0x8cee('0x5e')];var _0x27708a=[_0x8cee('0x5f'),_0x8cee('0x60'),_0x8cee('0x61'),_0x8cee('0x62'),'contactidname',_0x8cee('0x63'),_0x8cee('0x64'),_0x8cee('0x65'),_0x8cee('0x66'),'createdbyexternalpartyyominame',_0x8cee('0x67'),_0x8cee('0x68'),_0x8cee('0x69'),'createdonbehalfbyname',_0x8cee('0x6a'),_0x8cee('0x6b'),_0x8cee('0x6c'),_0x8cee('0x6d'),_0x8cee('0x6e'),_0x8cee('0x6f'),_0x8cee('0x70'),'entityimage_url',_0x8cee('0x71'),_0x8cee('0x72'),_0x8cee('0x73'),_0x8cee('0x74'),_0x8cee('0x75'),'influencescore',_0x8cee('0x76'),_0x8cee('0x77'),_0x8cee('0x78'),'modifiedbyexternalpartyname','modifiedbyexternalpartyyominame',_0x8cee('0x79'),'modifiedbyyominame',_0x8cee('0x7a'),_0x8cee('0x7b'),_0x8cee('0x7c'),_0x8cee('0x7d'),_0x8cee('0x7e'),'numberofchildincidents',_0x8cee('0x7f'),_0x8cee('0x80'),_0x8cee('0x81'),'owneridtype',_0x8cee('0x82'),'parentcaseidname','primarycontactidname',_0x8cee('0x83'),_0x8cee('0x84'),_0x8cee('0x85'),'productserialnumber',_0x8cee('0x86'),_0x8cee('0x87'),_0x8cee('0x88'),_0x8cee('0x89'),_0x8cee('0x8a'),'sentimentvalue',_0x8cee('0x8b'),'slaname',_0x8cee('0x8c'),_0x8cee('0x8d'),_0x8cee('0x8e'),_0x8cee('0x8f'),_0x8cee('0x90'),_0x8cee('0x91'),'transactioncurrencyidname',_0x8cee('0x92'),_0x8cee('0x93'),_0x8cee('0x94')];var _0x353bbe=_0x112a38['concat'](_0x27708a);return db[_0x8cee('0x40')]['findOne']({'where':{'id':_0x49b18a[_0x8cee('0x49')]['id']},'attributes':['id',_0x8cee('0x95'),'password',_0x8cee('0x96'),'tenantId',_0x8cee('0x97'),_0x8cee('0x98')]})[_0x8cee('0x26')](handleEntityNotFound(_0x98af20,null))[_0x8cee('0x26')](function(_0x21a385){if(_0x21a385){_0x30a313=_0x21a385[_0x8cee('0x96')];var _0x4d34c9=_0x30a313['slice'](-0x1);if(_0x4d34c9==='/'){_0x30a313=_0x30a313[_0x8cee('0x99')](0x0,_0x30a313[_0x8cee('0x9a')](_0x4d34c9));}_0x4fa498=util[_0x8cee('0x9b')](_0x8cee('0x9c'),_0x30a313);var _0x4b865a={'method':_0x8cee('0x9d'),'uri':_0x8cee('0x9e')+_0x21a385['tenantId']+'/oauth2/token','form':{'client_id':_0x21a385[_0x8cee('0x97')],'resource':_0x30a313,'username':_0x21a385[_0x8cee('0x95')],'password':_0x21a385[_0x8cee('0x9f')],'grant_type':'password','client_secret':_0x21a385[_0x8cee('0x98')]},'json':!![]};return rp(_0x4b865a);}})[_0x8cee('0x26')](function(_0x259b2a){_0x5141ea=_0x259b2a[_0x8cee('0xa0')];var _0x1f8775={'method':'GET','uri':encodeURI(_0x4fa498+_0x8cee('0xa1')+_0x31cfbb+'\x27'),'headers':{'Authorization':_0x8cee('0xa2')+_0x5141ea,'If-None-Match':null,'OData-Version':_0x8cee('0xa3')},'json':!![]};return rp(_0x1f8775);})[_0x8cee('0x26')](function(_0x531cf6){var _0x4c9562=_0x531cf6['value'][0x0];var _0xaaa7f9=_0x4c9562['MetadataId'];var _0x1b5491={'method':'GET','uri':_0x4fa498+_0x8cee('0xa4')+_0xaaa7f9+_0x8cee('0xa5'),'headers':{'Authorization':'Bearer\x20'+_0x5141ea,'If-None-Match':null,'OData-Version':_0x8cee('0xa3')},'json':!![]};return rp(_0x1b5491);})[_0x8cee('0x26')](function(_0xc874b6){_0x57ab97=_0xc874b6;_0x348707=_0x57ab97[_0x8cee('0xa6')];_0x348707=_[_0x8cee('0xa7')](_0x348707,function(_0x34bc01){return!_0x353bbe[_0x8cee('0xa8')](_0x34bc01[_0x8cee('0xa9')]);});var _0x5951bf=[];var _0x52a90a=[];_0x348707[_0x8cee('0xaa')](function(_0x3beaa0){if(_0x3beaa0['@odata.type']){var _0x32f864=_0x3beaa0[_0x8cee('0xab')][_0x8cee('0x99')](_0x3beaa0[_0x8cee('0xab')][_0x8cee('0x9a')]('.')+0x1);if(_0x32f864===_0x8cee('0xac')){_0x5951bf[_0x8cee('0xad')](getSelectList(_0x4fa498,_0x1087e8,_0x52a90a,_0x57ab97[_0x8cee('0xae')],_0x3beaa0[_0x8cee('0xae')],_0x5141ea));}}});return Promise[_0x8cee('0xaf')](_0x5951bf);})[_0x8cee('0x26')](function(_0x5e79a0){_0x3a3600=_0x5e79a0[0x0];var _0x25f62d=[];var _0x21d002=[];_0x348707['forEach'](function(_0x2bf37e){if(!_[_0x8cee('0xb0')](_0x2bf37e[_0x8cee('0xab')])){var _0x2baae7=_0x2bf37e[_0x8cee('0xab')][_0x8cee('0x99')](_0x2bf37e['@odata.type']['lastIndexOf']('.')+0x1);if(_0x2baae7===_0x8cee('0xb1')){_0x25f62d['push'](getBooleanList(_0x4fa498,_0x1087e8,_0x21d002,_0x57ab97[_0x8cee('0xae')],_0x2bf37e['MetadataId'],_0x5141ea));}}});return Promise[_0x8cee('0xaf')](_0x25f62d);})[_0x8cee('0x26')](function(_0x46cfd9){_0x4cb877=_0x46cfd9[0x0];var _0x4854b0=[];var _0x13d0ca=[];_0x348707[_0x8cee('0xaa')](function(_0x38319b){if(_0x38319b['@odata.type']){var _0xcfc20c=_0x38319b[_0x8cee('0xab')][_0x8cee('0x99')](_0x38319b[_0x8cee('0xab')]['lastIndexOf']('.')+0x1);if(_0xcfc20c==='StringAttributeMetadata'||_0xcfc20c==='DoubleAttributeMetadata'||_0xcfc20c===_0x8cee('0xb2')||_0xcfc20c==='IntegerAttributeMetadata'||_0xcfc20c==='MemoAttributeMetadata'||_0xcfc20c===_0x8cee('0xb3')||_0xcfc20c===_0x8cee('0xb4')||_0xcfc20c===_0x8cee('0xb5')||_0xcfc20c===_0x8cee('0xb6')||_0xcfc20c==='DecimalAttributeMetadata'){_0x4854b0[_0x8cee('0xad')](getInputList(_0x4fa498,_0x1087e8,_0xcfc20c,_0x13d0ca,_0x57ab97['MetadataId'],_0x38319b[_0x8cee('0xae')],_0x5141ea));}}});return Promise['all'](_0x4854b0);})[_0x8cee('0x26')](function(_0x2ac0e4){_0x1f3f31=_0x2ac0e4[0x0];var _0x1434d2=_0x3a3600[_0x8cee('0xb7')](_0x4cb877)[_0x8cee('0xb7')](_0x1f3f31);var _0x46a1ce={'count':_0x1434d2[_0x8cee('0x43')],'rows':_0x1434d2};return _0x46a1ce;})[_0x8cee('0x26')](respondWithResult(_0x98af20,null))[_0x8cee('0x46')](function(_0x3e219c){var _0x105cd4=_0x49b18a[_0x8cee('0x33')][_0x8cee('0xb8')]?0x1f4:_0x3e219c[_0x8cee('0xb9')]||0x1f4;logger[_0x8cee('0x27')](_0x3e219c[_0x8cee('0x28')]);delete _0x3e219c[_0x8cee('0x29')];if(_0x105cd4===0x191){_0x105cd4=0x190;}_0x98af20[_0x8cee('0x1a')](_0x105cd4)[_0x8cee('0x2a')](_0x49b18a[_0x8cee('0x33')][_0x8cee('0xb8')]?{'message':_0x8cee('0xba'),'statusCode':_0x3e219c[_0x8cee('0xb9')]}:_0x3e219c);});};function getSelectList(_0x751e74,_0x7ad805,_0x28c7a1,_0x521d3a,_0x475bde,_0x2b7f11){var _0xc321f6={'method':_0x8cee('0xbb'),'uri':_0x751e74+'EntityDefinitions('+_0x521d3a+_0x8cee('0xbc')+_0x475bde+_0x8cee('0xbd')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x8cee('0xa2')+_0x2b7f11,'If-None-Match':null,'OData-Version':_0x8cee('0xa3')},'json':!![]};return rp(_0xc321f6)['then'](function(_0x2b7ea2){var _0x4761bd=[];var _0x3fa672=_0x2b7ea2[_0x8cee('0xbe')][_0x8cee('0xbf')];_0x3fa672[_0x8cee('0xaa')](function(_0x3f531b){_0x4761bd[_0x8cee('0xad')]({'name':_0x3f531b[_0x8cee('0xc0')][_0x8cee('0xc1')][_0x8cee('0xc0')],'value':String(_0x3f531b[_0x8cee('0xc2')])});});var _0x138ae4={'id':_0x7ad805+'_'+_0x2b7ea2[_0x8cee('0xa9')],'name':_0x2b7ea2[_0x8cee('0xc3')][_0x8cee('0xc1')][_0x8cee('0xc0')],'custom':![],'options':_0x4761bd};_0x28c7a1[_0x8cee('0xad')](_0x138ae4);return _0x28c7a1;});}function getBooleanList(_0x5cfe3d,_0x575f0f,_0x5448ed,_0x1131a1,_0x3474bd,_0x2247d0){var _0x45414a={'method':_0x8cee('0xbb'),'uri':_0x5cfe3d+_0x8cee('0xa4')+_0x1131a1+_0x8cee('0xbc')+_0x3474bd+_0x8cee('0xc4'),'headers':{'Authorization':_0x8cee('0xa2')+_0x2247d0,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x45414a)[_0x8cee('0x26')](function(_0x1f25ba){var _0x4673fa=[];_0x4673fa[_0x8cee('0xad')]({'name':_0x1f25ba[_0x8cee('0xbe')][_0x8cee('0xc5')]['Label']['UserLocalizedLabel'][_0x8cee('0xc0')],'value':_0x8cee('0xc6')},{'name':_0x1f25ba[_0x8cee('0xbe')][_0x8cee('0xc7')]['Label'][_0x8cee('0xc1')][_0x8cee('0xc0')],'value':_0x8cee('0xc8')});var _0x46f761={'id':_0x575f0f+'_'+_0x1f25ba[_0x8cee('0xa9')],'name':_0x1f25ba['DisplayName'][_0x8cee('0xc1')][_0x8cee('0xc0')],'custom':![],'options':_0x4673fa};_0x5448ed[_0x8cee('0xad')](_0x46f761);return _0x5448ed;});}function getInputList(_0x5b3a9c,_0x5ab484,_0x4e21b2,_0x14f4cd,_0x1b39c9,_0x53ed44,_0xa02df2){var _0x40a2b0={'method':_0x8cee('0xbb'),'uri':_0x5b3a9c+_0x8cee('0xa4')+_0x1b39c9+_0x8cee('0xbc')+_0x53ed44+_0x8cee('0xc9')+_0x4e21b2+_0x8cee('0xca'),'headers':{'Authorization':_0x8cee('0xa2')+_0xa02df2,'If-None-Match':null,'OData-Version':_0x8cee('0xa3')},'json':!![]};return rp(_0x40a2b0)['then'](function(_0x5219ca){var _0x225434={'id':_0x5ab484+'_'+_0x5219ca[_0x8cee('0xa9')],'name':_0x5219ca['DisplayName'][_0x8cee('0xc1')]?_0x5219ca[_0x8cee('0xc3')][_0x8cee('0xc1')][_0x8cee('0xc0')]:_0x5219ca[_0x8cee('0xa9')],'custom':![],'options':[]};_0x14f4cd[_0x8cee('0xad')](_0x225434);return _0x14f4cd;});} \ No newline at end of file +var _0x2904=['emailaddress','entitlementidname','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','username','password','remoteUri','clientId','clientSecret','slice','substring','lastIndexOf','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','tenantId','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','MetadataId','all','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode','send','Wrong\x20credentials',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Value','DisplayName','UserLocalizedLabel','Label',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','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','../../components/integrations/configuration','status','offset','undefined','count','limit','Content-Range','reject','save','then','destroy','end','sendStatus','error','stack','name','index','Dynamics365Account','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','find','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','getSubjects','channel','Dynamics365Field','Subjects','Descriptions','getFields','ticketType','Incident','PhoneCall','title','customerid','ownerid','caseorigincode','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyyominame','customeridtype','customeridyominame'];(function(_0x3155a5,_0x406665){var _0xf2e24a=function(_0x2aa6fc){while(--_0x2aa6fc){_0x3155a5['push'](_0x3155a5['shift']());}};_0xf2e24a(++_0x406665);}(_0x2904,0x137));var _0x4290=function(_0x2f1be9,_0x1c72c0){_0x2f1be9=_0x2f1be9-0x0;var _0x5194b3=_0x2904[_0x2f1be9];return _0x5194b3;};'use strict';var emlformat=require(_0x4290('0x0'));var rimraf=require(_0x4290('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4290('0x2'));var rp=require('request-promise');var moment=require(_0x4290('0x3'));var BPromise=require(_0x4290('0x4'));var Mustache=require(_0x4290('0x5'));var util=require(_0x4290('0x6'));var path=require(_0x4290('0x7'));var sox=require('sox');var csv=require(_0x4290('0x8'));var ejs=require(_0x4290('0x9'));var fs=require('fs');var fs_extra=require(_0x4290('0xa'));var _=require('lodash');var squel=require(_0x4290('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4290('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4290('0xd'));var Papa=require(_0x4290('0xe'));var Redis=require('ioredis');var authService=require(_0x4290('0xf'));var qs=require(_0x4290('0x10'));var as=require(_0x4290('0x11'));var hardwareService=require(_0x4290('0x12'));var logger=require(_0x4290('0x13'))(_0x4290('0x14'));var utils=require(_0x4290('0x15'));var config=require(_0x4290('0x16'));var licenseUtil=require(_0x4290('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x4290('0x18'));function respondWithStatusCode(_0x1a2b4b,_0x5d3384){_0x5d3384=_0x5d3384||0xcc;return function(_0x18223a){if(_0x18223a){return _0x1a2b4b['sendStatus'](_0x5d3384);}return _0x1a2b4b[_0x4290('0x19')](_0x5d3384)['end']();};}function respondWithResult(_0x418062,_0x252b4e){_0x252b4e=_0x252b4e||0xc8;return function(_0x59a02c){if(_0x59a02c){return _0x418062[_0x4290('0x19')](_0x252b4e)['json'](_0x59a02c);}};}function respondWithFilteredResult(_0x1c8d95,_0xf2f5c9){return function(_0x1ff10f){if(_0x1ff10f){var _0x5d0a1f=typeof _0xf2f5c9[_0x4290('0x1a')]===_0x4290('0x1b')&&typeof _0xf2f5c9['limit']===_0x4290('0x1b');var _0x22e97a=_0x1ff10f[_0x4290('0x1c')];var _0x2d2537=_0x5d0a1f?0x0:_0xf2f5c9[_0x4290('0x1a')];var _0x538dd7=_0x5d0a1f?_0x1ff10f[_0x4290('0x1c')]:_0xf2f5c9['offset']+_0xf2f5c9[_0x4290('0x1d')];var _0x25cb57;if(_0x538dd7>=_0x22e97a){_0x538dd7=_0x22e97a;_0x25cb57=0xc8;}else{_0x25cb57=0xce;}_0x1c8d95[_0x4290('0x19')](_0x25cb57);return _0x1c8d95['set'](_0x4290('0x1e'),_0x2d2537+'-'+_0x538dd7+'/'+_0x22e97a)['json'](_0x1ff10f);}return null;};}function patchUpdates(_0x3f95ca){return function(_0x5ee14a){try{jsonpatch['apply'](_0x5ee14a,_0x3f95ca,!![]);}catch(_0x2a509a){return BPromise[_0x4290('0x1f')](_0x2a509a);}return _0x5ee14a[_0x4290('0x20')]();};}function saveUpdates(_0x301b94,_0x3a7445){return function(_0x3b178d){if(_0x3b178d){return _0x3b178d['update'](_0x301b94)[_0x4290('0x21')](function(_0x5e912a){return _0x5e912a;});}return null;};}function removeEntity(_0x14999,_0x46d4bd){return function(_0x35da8e){if(_0x35da8e){return _0x35da8e[_0x4290('0x22')]()['then'](function(){_0x14999['status'](0xcc)[_0x4290('0x23')]();});}};}function handleEntityNotFound(_0x33738b,_0x26d283){return function(_0x423e34){if(!_0x423e34){_0x33738b[_0x4290('0x24')](0x194);}return _0x423e34;};}function handleError(_0x2031a6,_0xdd3947){_0xdd3947=_0xdd3947||0x1f4;return function(_0x3c4def){logger[_0x4290('0x25')](_0x3c4def[_0x4290('0x26')]);if(_0x3c4def['name']){delete _0x3c4def[_0x4290('0x27')];}_0x2031a6[_0x4290('0x19')](_0xdd3947)['send'](_0x3c4def);};}exports[_0x4290('0x28')]=function(_0x19c969,_0x19dfdc){var _0x3b6579={},_0x53c1c0={},_0x3fa5e8={'count':0x0,'rows':[]};var _0x660773=_['map'](db[_0x4290('0x29')][_0x4290('0x2a')],function(_0x3d8fc7){return{'name':_0x3d8fc7[_0x4290('0x2b')],'type':_0x3d8fc7[_0x4290('0x2c')][_0x4290('0x2d')]};});_0x53c1c0[_0x4290('0x2e')]=_[_0x4290('0x2f')](_0x660773,_0x4290('0x27'));_0x53c1c0[_0x4290('0x30')]=_[_0x4290('0x31')](_0x19c969[_0x4290('0x30')]);_0x53c1c0[_0x4290('0x32')]=_[_0x4290('0x33')](_0x53c1c0[_0x4290('0x2e')],_0x53c1c0[_0x4290('0x30')]);_0x3b6579[_0x4290('0x34')]=_[_0x4290('0x33')](_0x53c1c0[_0x4290('0x2e')],qs[_0x4290('0x35')](_0x19c969[_0x4290('0x30')]['fields']));_0x3b6579['attributes']=_0x3b6579[_0x4290('0x34')][_0x4290('0x36')]?_0x3b6579['attributes']:_0x53c1c0['model'];if(!_0x19c969[_0x4290('0x30')][_0x4290('0x37')](_0x4290('0x38'))){_0x3b6579[_0x4290('0x1d')]=qs[_0x4290('0x1d')](_0x19c969['query'][_0x4290('0x1d')]);_0x3b6579[_0x4290('0x1a')]=qs[_0x4290('0x1a')](_0x19c969[_0x4290('0x30')]['offset']);}_0x3b6579['order']=qs[_0x4290('0x39')](_0x19c969[_0x4290('0x30')][_0x4290('0x39')]);_0x3b6579[_0x4290('0x3a')]=qs[_0x4290('0x32')](_[_0x4290('0x3b')](_0x19c969[_0x4290('0x30')],_0x53c1c0[_0x4290('0x32')]),_0x660773);if(_0x19c969[_0x4290('0x30')][_0x4290('0x3c')]){_0x3b6579[_0x4290('0x3a')]=_[_0x4290('0x3d')](_0x3b6579[_0x4290('0x3a')],{'$or':_[_0x4290('0x2f')](_0x660773,function(_0x4eb137){if(_0x4eb137[_0x4290('0x2c')]!==_0x4290('0x3e')){var _0xdbe4d3={};_0xdbe4d3[_0x4eb137['name']]={'$like':'%'+_0x19c969[_0x4290('0x30')][_0x4290('0x3c')]+'%'};return _0xdbe4d3;}})});}_0x3b6579=_['merge']({},_0x3b6579,_0x19c969[_0x4290('0x3f')]);var _0x4ebf63={'where':_0x3b6579[_0x4290('0x3a')]};return db['Dynamics365Account'][_0x4290('0x1c')](_0x4ebf63)[_0x4290('0x21')](function(_0x1afb9c){_0x3fa5e8['count']=_0x1afb9c;if(_0x19c969['query'][_0x4290('0x40')]){_0x3b6579[_0x4290('0x41')]=[{'all':!![]}];}return db[_0x4290('0x29')][_0x4290('0x42')](_0x3b6579);})[_0x4290('0x21')](function(_0x28e481){_0x3fa5e8['rows']=_0x28e481;return _0x3fa5e8;})[_0x4290('0x21')](respondWithFilteredResult(_0x19dfdc,_0x3b6579))[_0x4290('0x43')](handleError(_0x19dfdc,null));};exports[_0x4290('0x44')]=function(_0x1e813f,_0x122b79){var _0x344a3d={'raw':![],'where':{'id':_0x1e813f[_0x4290('0x45')]['id']}},_0xb9d8bf={};_0xb9d8bf['model']=_[_0x4290('0x31')](db[_0x4290('0x29')][_0x4290('0x2a')]);_0xb9d8bf[_0x4290('0x30')]=_[_0x4290('0x31')](_0x1e813f[_0x4290('0x30')]);_0xb9d8bf[_0x4290('0x32')]=_[_0x4290('0x33')](_0xb9d8bf['model'],_0xb9d8bf[_0x4290('0x30')]);_0x344a3d[_0x4290('0x34')]=_[_0x4290('0x33')](_0xb9d8bf['model'],qs[_0x4290('0x35')](_0x1e813f[_0x4290('0x30')][_0x4290('0x35')]));_0x344a3d['attributes']=_0x344a3d[_0x4290('0x34')][_0x4290('0x36')]?_0x344a3d[_0x4290('0x34')]:_0xb9d8bf['model'];if(_0x1e813f['query'][_0x4290('0x40')]){_0x344a3d[_0x4290('0x41')]=[{'all':!![]}];}_0x344a3d=_['merge']({},_0x344a3d,_0x1e813f[_0x4290('0x3f')]);return db[_0x4290('0x29')]['find'](_0x344a3d)[_0x4290('0x21')](handleEntityNotFound(_0x122b79,null))[_0x4290('0x21')](respondWithResult(_0x122b79,null))[_0x4290('0x43')](handleError(_0x122b79,null));};exports['create']=function(_0x13b984,_0x2795e8){return db[_0x4290('0x29')][_0x4290('0x46')](_0x13b984[_0x4290('0x47')],{})[_0x4290('0x21')](respondWithResult(_0x2795e8,0xc9))[_0x4290('0x43')](handleError(_0x2795e8,null));};exports['update']=function(_0xf1418f,_0xb29b1){if(_0xf1418f[_0x4290('0x47')]['id']){delete _0xf1418f[_0x4290('0x47')]['id'];}return db['Dynamics365Account'][_0x4290('0x48')]({'where':{'id':_0xf1418f[_0x4290('0x45')]['id']}})[_0x4290('0x21')](handleEntityNotFound(_0xb29b1,null))[_0x4290('0x21')](saveUpdates(_0xf1418f[_0x4290('0x47')],null))[_0x4290('0x21')](respondWithResult(_0xb29b1,null))[_0x4290('0x43')](handleError(_0xb29b1,null));};exports[_0x4290('0x22')]=function(_0x260987,_0x482d0b){return db['Dynamics365Account']['find']({'where':{'id':_0x260987[_0x4290('0x45')]['id']}})[_0x4290('0x21')](handleEntityNotFound(_0x482d0b,null))[_0x4290('0x21')](removeEntity(_0x482d0b,null))['catch'](handleError(_0x482d0b,null));};exports[_0x4290('0x49')]=function(_0x284d7d,_0x20f6a2,_0x4e8aad){var _0x1f1798={};var _0x5294ef={};var _0x405072;var _0xdebc6d;return db['Dynamics365Account'][_0x4290('0x4a')]({'where':{'id':_0x284d7d[_0x4290('0x45')]['id']}})[_0x4290('0x21')](handleEntityNotFound(_0x20f6a2,null))[_0x4290('0x21')](function(_0x58ba89){if(_0x58ba89){_0x405072=_0x58ba89;_0x5294ef['model']=_[_0x4290('0x31')](db[_0x4290('0x4b')][_0x4290('0x2a')]);_0x5294ef[_0x4290('0x30')]=_[_0x4290('0x31')](_0x284d7d[_0x4290('0x30')]);_0x5294ef['filters']=_['intersection'](_0x5294ef['model'],_0x5294ef[_0x4290('0x30')]);_0x1f1798[_0x4290('0x34')]=_[_0x4290('0x33')](_0x5294ef[_0x4290('0x2e')],qs[_0x4290('0x35')](_0x284d7d[_0x4290('0x30')]['fields']));_0x1f1798[_0x4290('0x34')]=_0x1f1798['attributes'][_0x4290('0x36')]?_0x1f1798[_0x4290('0x34')]:_0x5294ef[_0x4290('0x2e')];_0x1f1798['order']=qs[_0x4290('0x39')](_0x284d7d['query'][_0x4290('0x39')]);_0x1f1798['where']=qs[_0x4290('0x32')](_[_0x4290('0x3b')](_0x284d7d[_0x4290('0x30')],_0x5294ef['filters']));if(_0x284d7d[_0x4290('0x30')][_0x4290('0x3c')]){_0x1f1798[_0x4290('0x3a')]=_['merge'](_0x1f1798['where'],{'$or':_[_0x4290('0x2f')](_0x1f1798[_0x4290('0x34')],function(_0x4589c0){var _0x46f0b4={};_0x46f0b4[_0x4589c0]={'$like':'%'+_0x284d7d[_0x4290('0x30')][_0x4290('0x3c')]+'%'};return _0x46f0b4;})});}_0x1f1798=_[_0x4290('0x3d')]({},_0x1f1798,_0x284d7d[_0x4290('0x3f')]);return _0x405072[_0x4290('0x49')](_0x1f1798);}})[_0x4290('0x21')](function(_0x518842){if(_0x518842){_0xdebc6d=_0x518842['length'];if(!_0x284d7d[_0x4290('0x30')][_0x4290('0x37')]('nolimit')){_0x1f1798[_0x4290('0x1d')]=qs[_0x4290('0x1d')](_0x284d7d['query'][_0x4290('0x1d')]);_0x1f1798['offset']=qs[_0x4290('0x1a')](_0x284d7d['query'][_0x4290('0x1a')]);}return _0x405072[_0x4290('0x49')](_0x1f1798);}})[_0x4290('0x21')](function(_0x9b6a73){if(_0x9b6a73){return _0x9b6a73?{'count':_0xdebc6d,'rows':_0x9b6a73}:null;}})[_0x4290('0x21')](respondWithResult(_0x20f6a2,null))[_0x4290('0x43')](handleError(_0x20f6a2,null));};exports[_0x4290('0x4c')]=function(_0xe6aad7,_0x55e3ed,_0x316a03){if(_0xe6aad7[_0x4290('0x47')]['id']){delete _0xe6aad7['body']['id'];}return db[_0x4290('0x29')][_0x4290('0x4a')]({'where':{'id':_0xe6aad7[_0x4290('0x45')]['id']}})['then'](handleEntityNotFound(_0x55e3ed,null))[_0x4290('0x21')](function(_0x1a6453){if(_0x1a6453){_0xe6aad7[_0x4290('0x47')][_0x4290('0x4d')]=_0x1a6453['id'];_0xe6aad7[_0x4290('0x47')]['Subjects']=integrations[_0x4290('0x4e')](_0xe6aad7[_0x4290('0x47')][_0x4290('0x4f')],_0xe6aad7['body'][_0x4290('0x2c')]);_0xe6aad7[_0x4290('0x47')]['Descriptions']=integrations['getDescriptions'](_0xe6aad7[_0x4290('0x47')][_0x4290('0x4f')],_0xe6aad7[_0x4290('0x47')][_0x4290('0x2c')]);return db[_0x4290('0x4b')]['create'](_0xe6aad7['body'],{'include':[{'model':db[_0x4290('0x50')],'as':_0x4290('0x51')},{'model':db[_0x4290('0x50')],'as':_0x4290('0x52')}]});}return null;})[_0x4290('0x21')](respondWithResult(_0x55e3ed,null))['catch'](handleError(_0x55e3ed,null));};exports[_0x4290('0x53')]=function(_0x34c796,_0x6edae0,_0x199b3){var _0x510d6d=_0x34c796[_0x4290('0x30')][_0x4290('0x54')];var _0x3d408a=_0x510d6d==='incident'?_0x4290('0x55'):_0x4290('0x56');var _0x4bd742='';var _0x609982='';var _0x354937='';var _0xed8b47='';var _0x2d5ca5='';var _0xa6565f='';var _0x3cd5d3='';var _0xee2cb5='';var _0x187bfa=[_0x4290('0x57'),'description',_0x4290('0x58'),_0x4290('0x59'),_0x4290('0x5a'),_0x4290('0x5b'),'phonenumber',_0x4290('0x5c'),_0x4290('0x5d'),_0x4290('0x5e')];var _0x3c2b82=[_0x4290('0x5f'),_0x4290('0x60'),_0x4290('0x61'),_0x4290('0x62'),_0x4290('0x63'),_0x4290('0x64'),_0x4290('0x65'),'contractidname',_0x4290('0x66'),'createdbyexternalpartyyominame',_0x4290('0x67'),_0x4290('0x68'),_0x4290('0x69'),'createdonbehalfbyname',_0x4290('0x6a'),'customeridname',_0x4290('0x6b'),_0x4290('0x6c'),_0x4290('0x6d'),_0x4290('0x6e'),'entityimage_timestamp',_0x4290('0x6f'),_0x4290('0x70'),'exchangerate',_0x4290('0x71'),_0x4290('0x72'),_0x4290('0x73'),'influencescore','kbarticleidname',_0x4290('0x74'),_0x4290('0x75'),_0x4290('0x76'),_0x4290('0x77'),'modifiedbyname',_0x4290('0x78'),_0x4290('0x79'),'modifiedonbehalfbyname',_0x4290('0x7a'),_0x4290('0x7b'),_0x4290('0x7c'),'numberofchildincidents',_0x4290('0x7d'),_0x4290('0x7e'),_0x4290('0x7f'),_0x4290('0x80'),_0x4290('0x81'),_0x4290('0x82'),_0x4290('0x83'),_0x4290('0x84'),_0x4290('0x85'),_0x4290('0x86'),_0x4290('0x87'),_0x4290('0x88'),_0x4290('0x89'),_0x4290('0x8a'),_0x4290('0x8b'),_0x4290('0x8c'),_0x4290('0x8d'),_0x4290('0x8e'),_0x4290('0x8f'),_0x4290('0x90'),'statecode',_0x4290('0x91'),'subjectidname',_0x4290('0x92'),_0x4290('0x93'),_0x4290('0x94'),_0x4290('0x95'),_0x4290('0x96'),'versionnumber'];var _0x9cb14f=_0x187bfa['concat'](_0x3c2b82);return db[_0x4290('0x29')][_0x4290('0x4a')]({'where':{'id':_0x34c796[_0x4290('0x45')]['id']},'attributes':['id',_0x4290('0x97'),_0x4290('0x98'),_0x4290('0x99'),'tenantId',_0x4290('0x9a'),_0x4290('0x9b')]})[_0x4290('0x21')](handleEntityNotFound(_0x6edae0,null))[_0x4290('0x21')](function(_0x157e7f){if(_0x157e7f){_0xee2cb5=_0x157e7f[_0x4290('0x99')];var _0x1b641d=_0xee2cb5[_0x4290('0x9c')](-0x1);if(_0x1b641d==='/'){_0xee2cb5=_0xee2cb5[_0x4290('0x9d')](0x0,_0xee2cb5[_0x4290('0x9e')](_0x1b641d));}_0x3cd5d3=util['format'](_0x4290('0x9f'),_0xee2cb5);var _0x2e5cc9={'method':_0x4290('0xa0'),'uri':_0x4290('0xa1')+_0x157e7f[_0x4290('0xa2')]+'/oauth2/token','form':{'client_id':_0x157e7f[_0x4290('0x9a')],'resource':_0xee2cb5,'username':_0x157e7f[_0x4290('0x97')],'password':_0x157e7f[_0x4290('0x98')],'grant_type':_0x4290('0x98'),'client_secret':_0x157e7f[_0x4290('0x9b')]},'json':!![]};return rp(_0x2e5cc9);}})[_0x4290('0x21')](function(_0x4a2632){_0xa6565f=_0x4a2632['access_token'];var _0x2e56a3={'method':'GET','uri':encodeURI(_0x3cd5d3+_0x4290('0xa3')+_0x3d408a+'\x27'),'headers':{'Authorization':_0x4290('0xa4')+_0xa6565f,'If-None-Match':null,'OData-Version':_0x4290('0xa5')},'json':!![]};return rp(_0x2e56a3);})[_0x4290('0x21')](function(_0xb923d5){var _0x27fd1b=_0xb923d5[_0x4290('0xa6')][0x0];var _0x3f23ae=_0x27fd1b['MetadataId'];var _0x524dec={'method':_0x4290('0xa7'),'uri':_0x3cd5d3+_0x4290('0xa8')+_0x3f23ae+_0x4290('0xa9'),'headers':{'Authorization':_0x4290('0xa4')+_0xa6565f,'If-None-Match':null,'OData-Version':_0x4290('0xa5')},'json':!![]};return rp(_0x524dec);})['then'](function(_0x428833){_0x4bd742=_0x428833;_0x609982=_0x4bd742[_0x4290('0xaa')];_0x609982=_[_0x4290('0xab')](_0x609982,function(_0x5a7fdc){return!_0x9cb14f[_0x4290('0xac')](_0x5a7fdc[_0x4290('0xad')]);});var _0x1b22e4=[];var _0x1f7b05=[];_0x609982[_0x4290('0xae')](function(_0x19ed76){if(_0x19ed76[_0x4290('0xaf')]){var _0x3dd605=_0x19ed76[_0x4290('0xaf')]['substring'](_0x19ed76[_0x4290('0xaf')]['lastIndexOf']('.')+0x1);if(_0x3dd605===_0x4290('0xb0')){_0x1b22e4[_0x4290('0xb1')](getSelectList(_0x3cd5d3,_0x510d6d,_0x1f7b05,_0x4bd742[_0x4290('0xb2')],_0x19ed76[_0x4290('0xb2')],_0xa6565f));}}});return Promise[_0x4290('0xb3')](_0x1b22e4);})[_0x4290('0x21')](function(_0x4f16b6){_0x354937=_0x4f16b6[0x0];var _0x2988a7=[];var _0xe4895a=[];_0x609982[_0x4290('0xae')](function(_0x181a24){if(!_['isNil'](_0x181a24[_0x4290('0xaf')])){var _0x259505=_0x181a24[_0x4290('0xaf')]['substring'](_0x181a24[_0x4290('0xaf')]['lastIndexOf']('.')+0x1);if(_0x259505===_0x4290('0xb4')){_0x2988a7[_0x4290('0xb1')](getBooleanList(_0x3cd5d3,_0x510d6d,_0xe4895a,_0x4bd742[_0x4290('0xb2')],_0x181a24[_0x4290('0xb2')],_0xa6565f));}}});return Promise[_0x4290('0xb3')](_0x2988a7);})[_0x4290('0x21')](function(_0x18cd2c){_0xed8b47=_0x18cd2c[0x0];var _0x5134fb=[];var _0x37311a=[];_0x609982[_0x4290('0xae')](function(_0x149588){if(_0x149588[_0x4290('0xaf')]){var _0x12181b=_0x149588[_0x4290('0xaf')][_0x4290('0x9d')](_0x149588['@odata.type'][_0x4290('0x9e')]('.')+0x1);if(_0x12181b===_0x4290('0xb5')||_0x12181b===_0x4290('0xb6')||_0x12181b===_0x4290('0xb7')||_0x12181b===_0x4290('0xb8')||_0x12181b===_0x4290('0xb9')||_0x12181b===_0x4290('0xba')||_0x12181b===_0x4290('0xbb')||_0x12181b==='EntityNameAttributeMetadata'||_0x12181b===_0x4290('0xbc')||_0x12181b===_0x4290('0xbd')){_0x5134fb['push'](getInputList(_0x3cd5d3,_0x510d6d,_0x12181b,_0x37311a,_0x4bd742[_0x4290('0xb2')],_0x149588[_0x4290('0xb2')],_0xa6565f));}}});return Promise[_0x4290('0xb3')](_0x5134fb);})[_0x4290('0x21')](function(_0x531c1c){_0x2d5ca5=_0x531c1c[0x0];var _0x4f53f5=_0x354937[_0x4290('0xbe')](_0xed8b47)[_0x4290('0xbe')](_0x2d5ca5);var _0x55b479={'count':_0x4f53f5[_0x4290('0x36')],'rows':_0x4f53f5};return _0x55b479;})['then'](respondWithResult(_0x6edae0,null))[_0x4290('0x43')](function(_0x4bba13){var _0x3ec9cb=_0x34c796[_0x4290('0x30')][_0x4290('0xbf')]?0x1f4:_0x4bba13[_0x4290('0xc0')]||0x1f4;logger[_0x4290('0x25')](_0x4bba13[_0x4290('0x26')]);delete _0x4bba13['name'];if(_0x3ec9cb===0x191){_0x3ec9cb=0x190;}_0x6edae0[_0x4290('0x19')](_0x3ec9cb)[_0x4290('0xc1')](_0x34c796['query'][_0x4290('0xbf')]?{'message':_0x4290('0xc2'),'statusCode':_0x4bba13[_0x4290('0xc0')]}:_0x4bba13);});};function getSelectList(_0x4cd345,_0x58ee42,_0x2f72d7,_0x751275,_0x3eb047,_0x36365b){var _0x92ae30={'method':_0x4290('0xa7'),'uri':_0x4cd345+_0x4290('0xa8')+_0x751275+_0x4290('0xc3')+_0x3eb047+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x4290('0xc4'),'headers':{'Authorization':_0x4290('0xa4')+_0x36365b,'If-None-Match':null,'OData-Version':_0x4290('0xa5')},'json':!![]};return rp(_0x92ae30)[_0x4290('0x21')](function(_0x1b064c){var _0x3cd6c7=[];var _0x5e483b=_0x1b064c[_0x4290('0xc5')][_0x4290('0xc6')];_0x5e483b[_0x4290('0xae')](function(_0xedbe15){_0x3cd6c7[_0x4290('0xb1')]({'name':_0xedbe15['Label']['UserLocalizedLabel']['Label'],'value':String(_0xedbe15[_0x4290('0xc7')])});});var _0x1fc5f3={'id':_0x58ee42+'_'+_0x1b064c[_0x4290('0xad')],'name':_0x1b064c[_0x4290('0xc8')][_0x4290('0xc9')][_0x4290('0xca')],'custom':![],'options':_0x3cd6c7};_0x2f72d7[_0x4290('0xb1')](_0x1fc5f3);return _0x2f72d7;});}function getBooleanList(_0x147cfb,_0x532284,_0xb8e862,_0xb2486,_0x543d75,_0x569254){var _0xf0ea65={'method':_0x4290('0xa7'),'uri':_0x147cfb+_0x4290('0xa8')+_0xb2486+_0x4290('0xc3')+_0x543d75+_0x4290('0xcb'),'headers':{'Authorization':_0x4290('0xa4')+_0x569254,'If-None-Match':null,'OData-Version':_0x4290('0xa5')},'json':!![]};return rp(_0xf0ea65)[_0x4290('0x21')](function(_0x2f2896){var _0x505cf9=[];_0x505cf9[_0x4290('0xb1')]({'name':_0x2f2896['OptionSet'][_0x4290('0xcc')]['Label'][_0x4290('0xc9')][_0x4290('0xca')],'value':_0x4290('0xcd')},{'name':_0x2f2896[_0x4290('0xc5')][_0x4290('0xce')]['Label'][_0x4290('0xc9')]['Label'],'value':_0x4290('0xcf')});var _0x1e7a8e={'id':_0x532284+'_'+_0x2f2896[_0x4290('0xad')],'name':_0x2f2896['DisplayName'][_0x4290('0xc9')][_0x4290('0xca')],'custom':![],'options':_0x505cf9};_0xb8e862[_0x4290('0xb1')](_0x1e7a8e);return _0xb8e862;});}function getInputList(_0x3cddf1,_0x2caf50,_0x19ab21,_0x2c110f,_0x400f89,_0x1bbcef,_0x4796cb){var _0x41b3c2={'method':_0x4290('0xa7'),'uri':_0x3cddf1+'EntityDefinitions('+_0x400f89+_0x4290('0xc3')+_0x1bbcef+_0x4290('0xd0')+_0x19ab21+_0x4290('0xd1'),'headers':{'Authorization':_0x4290('0xa4')+_0x4796cb,'If-None-Match':null,'OData-Version':_0x4290('0xa5')},'json':!![]};return rp(_0x41b3c2)[_0x4290('0x21')](function(_0x25eeb9){var _0x12851b={'id':_0x2caf50+'_'+_0x25eeb9['LogicalName'],'name':_0x25eeb9[_0x4290('0xc8')]['UserLocalizedLabel']?_0x25eeb9[_0x4290('0xc8')][_0x4290('0xc9')][_0x4290('0xca')]:_0x25eeb9[_0x4290('0xad')],'custom':![],'options':[]};_0x2c110f[_0x4290('0xb1')](_0x12851b);return _0x2c110f;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 87d8498..54d1640 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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x3e4f11,_0x38cb0d){var _0x3fd9d1=function(_0x33828f){while(--_0x33828f){_0x3e4f11['push'](_0x3e4f11['shift']());}};_0x3fd9d1(++_0x38cb0d);}(_0xe706,0xa3));var _0x6e70=function(_0x270075,_0x142657){_0x270075=_0x270075-0x0;var _0x24a211=_0xe706[_0x270075];return _0x24a211;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x54613e,_0x2ab568){var _0x46e35a=function(_0x4b6cf6){while(--_0x4b6cf6){_0x54613e['push'](_0x54613e['shift']());}};_0x46e35a(++_0x2ab568);}(_0xe706,0xa3));var _0x6e70=function(_0x3705f7,_0x2553c4){_0x3705f7=_0x3705f7-0x0;var _0x2a1cf2=_0xe706[_0x3705f7];return _0x2a1cf2;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'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 a353e8f..280de2e 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 _0x538b=['Dynamics365Account,\x20%s,\x20%s','message','result','catch','Dynamics365Account','options','attributes','limit','include','map','model','then','GetDynamics365Account','find','raw','where','ShowDynamics365Account','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code'];(function(_0x4be6a0,_0x403cc8){var _0x4f3a6e=function(_0x4699fe){while(--_0x4699fe){_0x4be6a0['push'](_0x4be6a0['shift']());}};_0x4f3a6e(++_0x403cc8);}(_0x538b,0x7d));var _0xb538=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x538b[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xb538('0x0'));var util=require(_0xb538('0x1'));var moment=require(_0xb538('0x2'));var BPromise=require(_0xb538('0x3'));var rs=require(_0xb538('0x4'));var fs=require('fs');var Redis=require(_0xb538('0x5'));var db=require(_0xb538('0x6'))['db'];var utils=require(_0xb538('0x7'));var logger=require(_0xb538('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb538('0x9'));var client=jayson[_0xb538('0xa')][_0xb538('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25a732,_0x4ae563,_0x3303a5){return new BPromise(function(_0x21fa2f,_0x30e0f8){return client[_0xb538('0xc')](_0x25a732,_0x3303a5)['then'](function(_0x20ad01){logger[_0xb538('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x4ae563,_0xb538('0xe'));logger[_0xb538('0xf')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x4ae563,'request\x20sent',JSON[_0xb538('0x10')](_0x20ad01));if(_0x20ad01[_0xb538('0x11')]){if(_0x20ad01[_0xb538('0x11')][_0xb538('0x12')]===0x1f4){logger[_0xb538('0x11')](_0xb538('0x13'),_0x4ae563,_0x20ad01[_0xb538('0x11')][_0xb538('0x14')]);return _0x30e0f8(_0x20ad01['error'][_0xb538('0x14')]);}logger[_0xb538('0x11')](_0xb538('0x13'),_0x4ae563,_0x20ad01[_0xb538('0x11')][_0xb538('0x14')]);return _0x21fa2f(_0x20ad01['error'][_0xb538('0x14')]);}else{logger[_0xb538('0xd')](_0xb538('0x13'),_0x4ae563,_0xb538('0xe'));_0x21fa2f(_0x20ad01[_0xb538('0x15')][_0xb538('0x14')]);}})[_0xb538('0x16')](function(_0x5d16c9){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x4ae563,_0x5d16c9);_0x30e0f8(_0x5d16c9);});});}exports['GetDynamics365Account']=function(_0x596cd4){var _0x2edcb6=this;return new Promise(function(_0x4ed5e0,_0x18b2f5){return db[_0xb538('0x17')]['findAll']({'raw':_0x596cd4['options']?_0x596cd4[_0xb538('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x596cd4[_0xb538('0x18')]?_0x596cd4['options']['where']||null:null,'attributes':_0x596cd4[_0xb538('0x18')]?_0x596cd4[_0xb538('0x18')][_0xb538('0x19')]||null:null,'limit':_0x596cd4['options']?_0x596cd4['options'][_0xb538('0x1a')]||null:null,'include':_0x596cd4['options']?_0x596cd4[_0xb538('0x18')][_0xb538('0x1b')]?_[_0xb538('0x1c')](_0x596cd4[_0xb538('0x18')][_0xb538('0x1b')],function(_0x42f15e){return{'model':db[_0x42f15e[_0xb538('0x1d')]],'as':_0x42f15e['as'],'attributes':_0x42f15e[_0xb538('0x19')],'include':_0x42f15e[_0xb538('0x1b')]?_[_0xb538('0x1c')](_0x42f15e[_0xb538('0x1b')],function(_0x48880d){return{'model':db[_0x48880d[_0xb538('0x1d')]],'as':_0x48880d['as'],'attributes':_0x48880d[_0xb538('0x19')],'include':_0x48880d[_0xb538('0x1b')]?_[_0xb538('0x1c')](_0x48880d[_0xb538('0x1b')],function(_0x181cc7){return{'model':db[_0x181cc7[_0xb538('0x1d')]],'as':_0x181cc7['as'],'attributes':_0x181cc7[_0xb538('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb538('0x1e')](function(_0x1624b6){logger[_0xb538('0xd')](_0xb538('0x1f'),_0x596cd4);logger[_0xb538('0xf')](_0xb538('0x1f'),_0x596cd4,JSON[_0xb538('0x10')](_0x1624b6));_0x4ed5e0(_0x1624b6);})[_0xb538('0x16')](function(_0x2ff27a){logger[_0xb538('0x11')](_0xb538('0x1f'),_0x2ff27a[_0xb538('0x14')],_0x596cd4);_0x18b2f5(_0x2edcb6[_0xb538('0x11')](0x1f4,_0x2ff27a[_0xb538('0x14')]));});});};exports['ShowDynamics365Account']=function(_0x18c0db){var _0x159b50=this;return new Promise(function(_0x597e78,_0x348fb1){return db[_0xb538('0x17')][_0xb538('0x20')]({'raw':_0x18c0db[_0xb538('0x18')]?_0x18c0db[_0xb538('0x18')][_0xb538('0x21')]===undefined?!![]:![]:!![],'where':_0x18c0db[_0xb538('0x18')]?_0x18c0db['options'][_0xb538('0x22')]||null:null,'attributes':_0x18c0db[_0xb538('0x18')]?_0x18c0db['options'][_0xb538('0x19')]||null:null,'include':_0x18c0db[_0xb538('0x18')]?_0x18c0db[_0xb538('0x18')][_0xb538('0x1b')]?_[_0xb538('0x1c')](_0x18c0db['options'][_0xb538('0x1b')],function(_0x580548){return{'model':db[_0x580548[_0xb538('0x1d')]],'as':_0x580548['as'],'attributes':_0x580548[_0xb538('0x19')],'include':_0x580548[_0xb538('0x1b')]?_[_0xb538('0x1c')](_0x580548[_0xb538('0x1b')],function(_0x3cee20){return{'model':db[_0x3cee20[_0xb538('0x1d')]],'as':_0x3cee20['as'],'attributes':_0x3cee20['attributes'],'include':_0x3cee20[_0xb538('0x1b')]?_['map'](_0x3cee20[_0xb538('0x1b')],function(_0x2b04f8){return{'model':db[_0x2b04f8[_0xb538('0x1d')]],'as':_0x2b04f8['as'],'attributes':_0x2b04f8['attributes']};}):[]};}):[]};}):[]:[]})[_0xb538('0x1e')](function(_0x13379d){logger[_0xb538('0xd')]('ShowDynamics365Account',_0x18c0db);logger[_0xb538('0xf')](_0xb538('0x23'),_0x18c0db,JSON[_0xb538('0x10')](_0x13379d));_0x597e78(_0x13379d);})[_0xb538('0x16')](function(_0x284ae8){logger[_0xb538('0x11')](_0xb538('0x23'),_0x284ae8[_0xb538('0x14')],_0x18c0db);_0x348fb1(_0x159b50['error'](0x1f4,_0x284ae8['message']));});});}; \ No newline at end of file +var _0x3393=['request\x20sent','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','info','result','GetDynamics365Account','raw','options','attributes','limit','include','map','model','debug','catch','ShowDynamics365Account','Dynamics365Account','find','where','lodash','moment','bluebird','../../mysqldb','../../config/logger','client','http','request','then','Dynamics365Account,\x20%s,\x20%s,\x20%s'];(function(_0x5b1362,_0x55c4ab){var _0x443807=function(_0x44981a){while(--_0x44981a){_0x5b1362['push'](_0x5b1362['shift']());}};_0x443807(++_0x55c4ab);}(_0x3393,0x176));var _0x3339=function(_0x4f0db6,_0x576b8c){_0x4f0db6=_0x4f0db6-0x0;var _0x17e7b6=_0x3393[_0x4f0db6];return _0x17e7b6;};'use strict';var _=require(_0x3339('0x0'));var util=require('util');var moment=require(_0x3339('0x1'));var BPromise=require(_0x3339('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3339('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3339('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3339('0x5')][_0x3339('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x37adf7,_0x126bbf,_0x2a47db){return new BPromise(function(_0x5024a9,_0x520e0f){return client[_0x3339('0x7')](_0x37adf7,_0x2a47db)[_0x3339('0x8')](function(_0x25ebc9){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x126bbf,'request\x20sent');logger['debug'](_0x3339('0x9'),_0x126bbf,_0x3339('0xa'),JSON[_0x3339('0xb')](_0x25ebc9));if(_0x25ebc9[_0x3339('0xc')]){if(_0x25ebc9[_0x3339('0xc')][_0x3339('0xd')]===0x1f4){logger['error'](_0x3339('0xe'),_0x126bbf,_0x25ebc9[_0x3339('0xc')][_0x3339('0xf')]);return _0x520e0f(_0x25ebc9[_0x3339('0xc')][_0x3339('0xf')]);}logger[_0x3339('0xc')](_0x3339('0xe'),_0x126bbf,_0x25ebc9['error']['message']);return _0x5024a9(_0x25ebc9['error']['message']);}else{logger[_0x3339('0x10')](_0x3339('0xe'),_0x126bbf,'request\x20sent');_0x5024a9(_0x25ebc9[_0x3339('0x11')][_0x3339('0xf')]);}})['catch'](function(_0x5ce900){logger[_0x3339('0xc')](_0x3339('0xe'),_0x126bbf,_0x5ce900);_0x520e0f(_0x5ce900);});});}exports[_0x3339('0x12')]=function(_0x20c24b){var _0x5329fa=this;return new Promise(function(_0x2b8319,_0x57282c){return db['Dynamics365Account']['findAll']({'raw':_0x20c24b['options']?_0x20c24b['options'][_0x3339('0x13')]===undefined?!![]:![]:!![],'where':_0x20c24b[_0x3339('0x14')]?_0x20c24b[_0x3339('0x14')]['where']||null:null,'attributes':_0x20c24b['options']?_0x20c24b[_0x3339('0x14')][_0x3339('0x15')]||null:null,'limit':_0x20c24b[_0x3339('0x14')]?_0x20c24b['options'][_0x3339('0x16')]||null:null,'include':_0x20c24b[_0x3339('0x14')]?_0x20c24b[_0x3339('0x14')][_0x3339('0x17')]?_[_0x3339('0x18')](_0x20c24b[_0x3339('0x14')][_0x3339('0x17')],function(_0x2665f5){return{'model':db[_0x2665f5['model']],'as':_0x2665f5['as'],'attributes':_0x2665f5[_0x3339('0x15')],'include':_0x2665f5[_0x3339('0x17')]?_['map'](_0x2665f5[_0x3339('0x17')],function(_0x46a409){return{'model':db[_0x46a409[_0x3339('0x19')]],'as':_0x46a409['as'],'attributes':_0x46a409[_0x3339('0x15')],'include':_0x46a409['include']?_[_0x3339('0x18')](_0x46a409[_0x3339('0x17')],function(_0x129b91){return{'model':db[_0x129b91[_0x3339('0x19')]],'as':_0x129b91['as'],'attributes':_0x129b91[_0x3339('0x15')]};}):[]};}):[]};}):[]:[]})[_0x3339('0x8')](function(_0x2e1c67){logger['info'](_0x3339('0x12'),_0x20c24b);logger[_0x3339('0x1a')](_0x3339('0x12'),_0x20c24b,JSON['stringify'](_0x2e1c67));_0x2b8319(_0x2e1c67);})[_0x3339('0x1b')](function(_0x46bd9a){logger[_0x3339('0xc')](_0x3339('0x12'),_0x46bd9a[_0x3339('0xf')],_0x20c24b);_0x57282c(_0x5329fa[_0x3339('0xc')](0x1f4,_0x46bd9a[_0x3339('0xf')]));});});};exports[_0x3339('0x1c')]=function(_0x529dae){var _0x440f02=this;return new Promise(function(_0x25660a,_0x1a001e){return db[_0x3339('0x1d')][_0x3339('0x1e')]({'raw':_0x529dae[_0x3339('0x14')]?_0x529dae[_0x3339('0x14')][_0x3339('0x13')]===undefined?!![]:![]:!![],'where':_0x529dae['options']?_0x529dae[_0x3339('0x14')][_0x3339('0x1f')]||null:null,'attributes':_0x529dae[_0x3339('0x14')]?_0x529dae[_0x3339('0x14')][_0x3339('0x15')]||null:null,'include':_0x529dae[_0x3339('0x14')]?_0x529dae[_0x3339('0x14')][_0x3339('0x17')]?_[_0x3339('0x18')](_0x529dae[_0x3339('0x14')][_0x3339('0x17')],function(_0x3b0201){return{'model':db[_0x3b0201[_0x3339('0x19')]],'as':_0x3b0201['as'],'attributes':_0x3b0201[_0x3339('0x15')],'include':_0x3b0201[_0x3339('0x17')]?_[_0x3339('0x18')](_0x3b0201['include'],function(_0x5dda57){return{'model':db[_0x5dda57[_0x3339('0x19')]],'as':_0x5dda57['as'],'attributes':_0x5dda57[_0x3339('0x15')],'include':_0x5dda57[_0x3339('0x17')]?_[_0x3339('0x18')](_0x5dda57['include'],function(_0x4e24e8){return{'model':db[_0x4e24e8[_0x3339('0x19')]],'as':_0x4e24e8['as'],'attributes':_0x4e24e8[_0x3339('0x15')]};}):[]};}):[]};}):[]:[]})[_0x3339('0x8')](function(_0x39148a){logger['info'](_0x3339('0x1c'),_0x529dae);logger['debug'](_0x3339('0x1c'),_0x529dae,JSON[_0x3339('0xb')](_0x39148a));_0x25660a(_0x39148a);})[_0x3339('0x1b')](function(_0x574146){logger[_0x3339('0xc')](_0x3339('0x1c'),_0x574146[_0x3339('0xf')],_0x529dae);_0x1a001e(_0x440f02[_0x3339('0xc')](0x1f4,_0x574146[_0x3339('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index edab4bf..0d06827 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 _0x8101=['/:id/subjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/fields','getFields'];(function(_0x450c0f,_0x473776){var _0x59c286=function(_0x1d2db3){while(--_0x1d2db3){_0x450c0f['push'](_0x450c0f['shift']());}};_0x59c286(++_0x473776);}(_0x8101,0xc0));var _0x1810=function(_0x15de11,_0x3cd20d){_0x15de11=_0x15de11-0x0;var _0x4f1c07=_0x8101[_0x15de11];return _0x4f1c07;};'use strict';var multer=require(_0x1810('0x0'));var util=require(_0x1810('0x1'));var path=require(_0x1810('0x2'));var timeout=require(_0x1810('0x3'));var express=require(_0x1810('0x4'));var router=express[_0x1810('0x5')]();var fs_extra=require(_0x1810('0x6'));var auth=require(_0x1810('0x7'));var interaction=require(_0x1810('0x8'));var config=require('../../config/environment');var controller=require('./intDynamics365Configuration.controller');router[_0x1810('0x9')]('/',auth[_0x1810('0xa')](),controller['index']);router[_0x1810('0x9')](_0x1810('0xb'),auth[_0x1810('0xa')](),controller[_0x1810('0xc')]);router[_0x1810('0x9')](_0x1810('0xd'),auth[_0x1810('0xa')](),controller[_0x1810('0xe')]);router[_0x1810('0x9')](_0x1810('0xf'),auth[_0x1810('0xa')](),controller['getSubjects']);router[_0x1810('0x9')](_0x1810('0x10'),auth['isAuthenticated'](),controller[_0x1810('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1810('0x12')]);router[_0x1810('0x13')](_0x1810('0xb'),auth[_0x1810('0xa')](),controller[_0x1810('0x14')]);router[_0x1810('0x15')]('/:id',auth[_0x1810('0xa')](),controller[_0x1810('0x16')]);module['exports']=router; \ No newline at end of file +var _0x8292=['./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x25ada8,_0x140ac9){var _0x51e173=function(_0x49824d){while(--_0x49824d){_0x25ada8['push'](_0x25ada8['shift']());}};_0x51e173(++_0x140ac9);}(_0x8292,0x19b));var _0x2829=function(_0x5c2c7c,_0xa7d3b1){_0x5c2c7c=_0x5c2c7c-0x0;var _0xea7ffe=_0x8292[_0x5c2c7c];return _0xea7ffe;};'use strict';var multer=require(_0x2829('0x0'));var util=require('util');var path=require(_0x2829('0x1'));var timeout=require(_0x2829('0x2'));var express=require(_0x2829('0x3'));var router=express['Router']();var fs_extra=require(_0x2829('0x4'));var auth=require(_0x2829('0x5'));var interaction=require(_0x2829('0x6'));var config=require('../../config/environment');var controller=require(_0x2829('0x7'));router[_0x2829('0x8')]('/',auth[_0x2829('0x9')](),controller[_0x2829('0xa')]);router[_0x2829('0x8')](_0x2829('0xb'),auth[_0x2829('0x9')](),controller[_0x2829('0xc')]);router[_0x2829('0x8')](_0x2829('0xd'),auth[_0x2829('0x9')](),controller[_0x2829('0xe')]);router['get'](_0x2829('0xf'),auth[_0x2829('0x9')](),controller[_0x2829('0x10')]);router[_0x2829('0x8')](_0x2829('0x11'),auth[_0x2829('0x9')](),controller[_0x2829('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2829('0x13')]);router['put'](_0x2829('0xb'),auth[_0x2829('0x9')](),controller['update']);router[_0x2829('0x14')](_0x2829('0xb'),auth[_0x2829('0x9')](),controller[_0x2829('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index f8132a2..3d39564 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 _0x6301=['phonecall','STRING','incident'];(function(_0x1129cf,_0xa0c4ea){var _0x5b00b6=function(_0x36bebb){while(--_0x36bebb){_0x1129cf['push'](_0x1129cf['shift']());}};_0x5b00b6(++_0xa0c4ea);}(_0x6301,0x10c));var _0x1630=function(_0x564eec,_0x2174aa){_0x564eec=_0x564eec-0x0;var _0xb25d75=_0x6301[_0x564eec];return _0xb25d75;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1630('0x0')]},'description':{'type':Sequelize[_0x1630('0x0')]},'ticketType':{'type':Sequelize['ENUM'](_0x1630('0x1'),_0x1630('0x2')),'defaultValue':_0x1630('0x1')}}; \ No newline at end of file +var _0xdcb0=['STRING','ENUM','incident','phonecall','sequelize','exports'];(function(_0x299b7b,_0x595dbe){var _0x56f392=function(_0x3d97bb){while(--_0x3d97bb){_0x299b7b['push'](_0x299b7b['shift']());}};_0x56f392(++_0x595dbe);}(_0xdcb0,0x1e4));var _0x0dcb=function(_0x4da56e,_0x49f5e2){_0x4da56e=_0x4da56e-0x0;var _0x56ceff=_0xdcb0[_0x4da56e];return _0x56ceff;};'use strict';var Sequelize=require(_0x0dcb('0x0'));module[_0x0dcb('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0dcb('0x2')]},'ticketType':{'type':Sequelize[_0x0dcb('0x3')](_0x0dcb('0x4'),_0x0dcb('0x5')),'defaultValue':'incident'}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 6481abe..1d56223 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 _0x0a24=['VIRTUAL','filter','options','count','includeAll','include','findAll','catch','show','params','find','create','body','getFields','findOne','order','hasOwnProperty','Dynamics365Field','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','merge'];(function(_0x3c965f,_0x2f0c8e){var _0x3aff2c=function(_0x58d56f){while(--_0x58d56f){_0x3c965f['push'](_0x3c965f['shift']());}};_0x3aff2c(++_0x2f0c8e);}(_0x0a24,0x19f));var _0x40a2=function(_0x48a80d,_0x1b2aaf){_0x48a80d=_0x48a80d-0x0;var _0x267bcb=_0x0a24[_0x48a80d];return _0x267bcb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x40a2('0x0'));var zipdir=require(_0x40a2('0x1'));var jsonpatch=require(_0x40a2('0x2'));var rp=require(_0x40a2('0x3'));var moment=require(_0x40a2('0x4'));var BPromise=require(_0x40a2('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x40a2('0x6'));var csv=require(_0x40a2('0x7'));var ejs=require(_0x40a2('0x8'));var fs=require('fs');var fs_extra=require(_0x40a2('0x9'));var _=require(_0x40a2('0xa'));var squel=require(_0x40a2('0xb'));var crypto=require(_0x40a2('0xc'));var jsforce=require(_0x40a2('0xd'));var deskjs=require(_0x40a2('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x40a2('0xf'));var as=require(_0x40a2('0x10'));var hardwareService=require(_0x40a2('0x11'));var logger=require(_0x40a2('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x40a2('0x13'));var licenseUtil=require(_0x40a2('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x442c03,_0x1d3c4e){_0x1d3c4e=_0x1d3c4e||0xcc;return function(_0x2c9f46){if(_0x2c9f46){return _0x442c03['sendStatus'](_0x1d3c4e);}return _0x442c03['status'](_0x1d3c4e)[_0x40a2('0x15')]();};}function respondWithResult(_0x3a6746,_0x3b2d4c){_0x3b2d4c=_0x3b2d4c||0xc8;return function(_0x49e813){if(_0x49e813){return _0x3a6746[_0x40a2('0x16')](_0x3b2d4c)[_0x40a2('0x17')](_0x49e813);}};}function respondWithFilteredResult(_0x4886f9,_0x177c92){return function(_0x240e00){if(_0x240e00){var _0x1e48f7=typeof _0x177c92[_0x40a2('0x18')]===_0x40a2('0x19')&&typeof _0x177c92[_0x40a2('0x1a')]==='undefined';var _0x4d1e87=_0x240e00['count'];var _0x553b47=_0x1e48f7?0x0:_0x177c92[_0x40a2('0x18')];var _0x288ce6=_0x1e48f7?_0x240e00['count']:_0x177c92['offset']+_0x177c92['limit'];var _0x46ecb4;if(_0x288ce6>=_0x4d1e87){_0x288ce6=_0x4d1e87;_0x46ecb4=0xc8;}else{_0x46ecb4=0xce;}_0x4886f9['status'](_0x46ecb4);return _0x4886f9[_0x40a2('0x1b')](_0x40a2('0x1c'),_0x553b47+'-'+_0x288ce6+'/'+_0x4d1e87)[_0x40a2('0x17')](_0x240e00);}return null;};}function patchUpdates(_0xc0e210){return function(_0x54123d){try{jsonpatch[_0x40a2('0x1d')](_0x54123d,_0xc0e210,!![]);}catch(_0x443eb1){return BPromise[_0x40a2('0x1e')](_0x443eb1);}return _0x54123d[_0x40a2('0x1f')]();};}function saveUpdates(_0x5e7528,_0x55e1bb){return function(_0x578610){if(_0x578610){return _0x578610[_0x40a2('0x20')](_0x5e7528)[_0x40a2('0x21')](function(_0x119d84){return _0x119d84;});}return null;};}function removeEntity(_0x1a0494,_0x1fe8d1){return function(_0x2724c3){if(_0x2724c3){return _0x2724c3[_0x40a2('0x22')]()[_0x40a2('0x21')](function(){_0x1a0494[_0x40a2('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe27f43,_0x2a737f){return function(_0x2417ae){if(!_0x2417ae){_0xe27f43[_0x40a2('0x23')](0x194);}return _0x2417ae;};}function handleError(_0x3fa639,_0x55276a){_0x55276a=_0x55276a||0x1f4;return function(_0x42453f){logger['error'](_0x42453f[_0x40a2('0x24')]);if(_0x42453f[_0x40a2('0x25')]){delete _0x42453f[_0x40a2('0x25')];}_0x3fa639['status'](_0x55276a)[_0x40a2('0x26')](_0x42453f);};}exports[_0x40a2('0x27')]=function(_0x10fc28,_0x16c86d){var _0x39a2f3={},_0x5ac775={},_0x30defe={'count':0x0,'rows':[]};var _0x1e0b3c=_[_0x40a2('0x28')](db[_0x40a2('0x29')][_0x40a2('0x2a')],function(_0x1ea390){return{'name':_0x1ea390[_0x40a2('0x2b')],'type':_0x1ea390[_0x40a2('0x2c')][_0x40a2('0x2d')]};});_0x5ac775['model']=_[_0x40a2('0x28')](_0x1e0b3c,_0x40a2('0x25'));_0x5ac775['query']=_[_0x40a2('0x2e')](_0x10fc28[_0x40a2('0x2f')]);_0x5ac775[_0x40a2('0x30')]=_[_0x40a2('0x31')](_0x5ac775[_0x40a2('0x32')],_0x5ac775[_0x40a2('0x2f')]);_0x39a2f3[_0x40a2('0x33')]=_[_0x40a2('0x31')](_0x5ac775[_0x40a2('0x32')],qs[_0x40a2('0x34')](_0x10fc28[_0x40a2('0x2f')][_0x40a2('0x34')]));_0x39a2f3[_0x40a2('0x33')]=_0x39a2f3[_0x40a2('0x33')][_0x40a2('0x35')]?_0x39a2f3[_0x40a2('0x33')]:_0x5ac775[_0x40a2('0x32')];if(!_0x10fc28[_0x40a2('0x2f')]['hasOwnProperty'](_0x40a2('0x36'))){_0x39a2f3[_0x40a2('0x1a')]=qs[_0x40a2('0x1a')](_0x10fc28[_0x40a2('0x2f')][_0x40a2('0x1a')]);_0x39a2f3[_0x40a2('0x18')]=qs[_0x40a2('0x18')](_0x10fc28[_0x40a2('0x2f')]['offset']);}_0x39a2f3['order']=qs['sort'](_0x10fc28[_0x40a2('0x2f')][_0x40a2('0x37')]);_0x39a2f3[_0x40a2('0x38')]=qs[_0x40a2('0x30')](_[_0x40a2('0x39')](_0x10fc28['query'],_0x5ac775[_0x40a2('0x30')]),_0x1e0b3c);if(_0x10fc28[_0x40a2('0x2f')]['filter']){_0x39a2f3[_0x40a2('0x38')]=_[_0x40a2('0x3a')](_0x39a2f3[_0x40a2('0x38')],{'$or':_[_0x40a2('0x28')](_0x1e0b3c,function(_0x2fa367){if(_0x2fa367[_0x40a2('0x2c')]!==_0x40a2('0x3b')){var _0x4bfaad={};_0x4bfaad[_0x2fa367[_0x40a2('0x25')]]={'$like':'%'+_0x10fc28['query'][_0x40a2('0x3c')]+'%'};return _0x4bfaad;}})});}_0x39a2f3=_[_0x40a2('0x3a')]({},_0x39a2f3,_0x10fc28[_0x40a2('0x3d')]);var _0x32bbcb={'where':_0x39a2f3[_0x40a2('0x38')]};return db[_0x40a2('0x29')][_0x40a2('0x3e')](_0x32bbcb)['then'](function(_0x4c4796){_0x30defe[_0x40a2('0x3e')]=_0x4c4796;if(_0x10fc28['query'][_0x40a2('0x3f')]){_0x39a2f3[_0x40a2('0x40')]=[{'all':!![]}];}return db[_0x40a2('0x29')][_0x40a2('0x41')](_0x39a2f3);})[_0x40a2('0x21')](function(_0x13187b){_0x30defe['rows']=_0x13187b;return _0x30defe;})['then'](respondWithFilteredResult(_0x16c86d,_0x39a2f3))[_0x40a2('0x42')](handleError(_0x16c86d,null));};exports[_0x40a2('0x43')]=function(_0x5dc434,_0x440c14){var _0x149896={'raw':![],'where':{'id':_0x5dc434[_0x40a2('0x44')]['id']}},_0x471cb0={};_0x471cb0['model']=_[_0x40a2('0x2e')](db['Dynamics365Configuration'][_0x40a2('0x2a')]);_0x471cb0['query']=_['keys'](_0x5dc434[_0x40a2('0x2f')]);_0x471cb0[_0x40a2('0x30')]=_[_0x40a2('0x31')](_0x471cb0[_0x40a2('0x32')],_0x471cb0['query']);_0x149896[_0x40a2('0x33')]=_[_0x40a2('0x31')](_0x471cb0[_0x40a2('0x32')],qs['fields'](_0x5dc434[_0x40a2('0x2f')][_0x40a2('0x34')]));_0x149896[_0x40a2('0x33')]=_0x149896['attributes'][_0x40a2('0x35')]?_0x149896['attributes']:_0x471cb0[_0x40a2('0x32')];if(_0x5dc434[_0x40a2('0x2f')][_0x40a2('0x3f')]){_0x149896['include']=[{'all':!![]}];}_0x149896=_['merge']({},_0x149896,_0x5dc434[_0x40a2('0x3d')]);return db[_0x40a2('0x29')][_0x40a2('0x45')](_0x149896)['then'](handleEntityNotFound(_0x440c14,null))[_0x40a2('0x21')](respondWithResult(_0x440c14,null))[_0x40a2('0x42')](handleError(_0x440c14,null));};exports['create']=function(_0x185556,_0x256465){return db['Dynamics365Configuration'][_0x40a2('0x46')](_0x185556[_0x40a2('0x47')],{})['then'](respondWithResult(_0x256465,0xc9))[_0x40a2('0x42')](handleError(_0x256465,null));};exports['update']=function(_0x270759,_0x5898d8){if(_0x270759['body']['id']){delete _0x270759[_0x40a2('0x47')]['id'];}return db[_0x40a2('0x29')][_0x40a2('0x45')]({'where':{'id':_0x270759[_0x40a2('0x44')]['id']}})[_0x40a2('0x21')](handleEntityNotFound(_0x5898d8,null))[_0x40a2('0x21')](saveUpdates(_0x270759[_0x40a2('0x47')],null))['then'](respondWithResult(_0x5898d8,null))[_0x40a2('0x42')](handleError(_0x5898d8,null));};exports[_0x40a2('0x22')]=function(_0x37193b,_0x13fc1c){return db[_0x40a2('0x29')][_0x40a2('0x45')]({'where':{'id':_0x37193b[_0x40a2('0x44')]['id']}})[_0x40a2('0x21')](handleEntityNotFound(_0x13fc1c,null))['then'](removeEntity(_0x13fc1c,null))[_0x40a2('0x42')](handleError(_0x13fc1c,null));};exports[_0x40a2('0x48')]=function(_0x507935,_0x242efb,_0xf70b1d){var _0x24cf8f={};var _0x13cc0c={};var _0x4d5509;var _0x5a0cf1;return db['Dynamics365Configuration'][_0x40a2('0x49')]({'where':{'id':_0x507935['params']['id']}})['then'](handleEntityNotFound(_0x242efb,null))[_0x40a2('0x21')](function(_0x51bd11){if(_0x51bd11){_0x4d5509=_0x51bd11;_0x13cc0c['model']=_['keys'](db['Dynamics365Field'][_0x40a2('0x2a')]);_0x13cc0c[_0x40a2('0x2f')]=_[_0x40a2('0x2e')](_0x507935['query']);_0x13cc0c['filters']=_[_0x40a2('0x31')](_0x13cc0c[_0x40a2('0x32')],_0x13cc0c[_0x40a2('0x2f')]);_0x24cf8f[_0x40a2('0x33')]=_[_0x40a2('0x31')](_0x13cc0c[_0x40a2('0x32')],qs['fields'](_0x507935[_0x40a2('0x2f')][_0x40a2('0x34')]));_0x24cf8f['attributes']=_0x24cf8f['attributes']['length']?_0x24cf8f[_0x40a2('0x33')]:_0x13cc0c['model'];_0x24cf8f[_0x40a2('0x4a')]=qs[_0x40a2('0x37')](_0x507935[_0x40a2('0x2f')][_0x40a2('0x37')]);_0x24cf8f['where']=qs[_0x40a2('0x30')](_[_0x40a2('0x39')](_0x507935[_0x40a2('0x2f')],_0x13cc0c['filters']));if(_0x507935['query'][_0x40a2('0x3c')]){_0x24cf8f[_0x40a2('0x38')]=_['merge'](_0x24cf8f[_0x40a2('0x38')],{'$or':_['map'](_0x24cf8f[_0x40a2('0x33')],function(_0x447ce7){var _0x3df31c={};_0x3df31c[_0x447ce7]={'$like':'%'+_0x507935[_0x40a2('0x2f')][_0x40a2('0x3c')]+'%'};return _0x3df31c;})});}_0x24cf8f=_[_0x40a2('0x3a')]({},_0x24cf8f,_0x507935[_0x40a2('0x3d')]);return _0x4d5509['getFields'](_0x24cf8f);}})[_0x40a2('0x21')](function(_0x3190a2){if(_0x3190a2){_0x5a0cf1=_0x3190a2[_0x40a2('0x35')];if(!_0x507935[_0x40a2('0x2f')][_0x40a2('0x4b')](_0x40a2('0x36'))){_0x24cf8f[_0x40a2('0x1a')]=qs[_0x40a2('0x1a')](_0x507935[_0x40a2('0x2f')][_0x40a2('0x1a')]);_0x24cf8f[_0x40a2('0x18')]=qs[_0x40a2('0x18')](_0x507935[_0x40a2('0x2f')][_0x40a2('0x18')]);}return _0x4d5509[_0x40a2('0x48')](_0x24cf8f);}})['then'](function(_0x2bb46f){if(_0x2bb46f){return _0x2bb46f?{'count':_0x5a0cf1,'rows':_0x2bb46f}:null;}})[_0x40a2('0x21')](respondWithResult(_0x242efb,null))['catch'](handleError(_0x242efb,null));};exports['getSubjects']=function(_0x1f7142,_0x415b6b,_0x262dbf){var _0x141a5d={};var _0x2c5384={};var _0x247cd4;var _0x3c19fe;return db['Dynamics365Configuration'][_0x40a2('0x49')]({'where':{'id':_0x1f7142[_0x40a2('0x44')]['id']}})['then'](handleEntityNotFound(_0x415b6b,null))['then'](function(_0x4ab840){if(_0x4ab840){_0x247cd4=_0x4ab840;_0x2c5384['model']=_[_0x40a2('0x2e')](db[_0x40a2('0x4c')]['rawAttributes']);_0x2c5384['query']=_['keys'](_0x1f7142[_0x40a2('0x2f')]);_0x2c5384[_0x40a2('0x30')]=_[_0x40a2('0x31')](_0x2c5384[_0x40a2('0x32')],_0x2c5384[_0x40a2('0x2f')]);_0x141a5d[_0x40a2('0x33')]=_['intersection'](_0x2c5384['model'],qs['fields'](_0x1f7142[_0x40a2('0x2f')][_0x40a2('0x34')]));_0x141a5d[_0x40a2('0x33')]=_0x141a5d['attributes'][_0x40a2('0x35')]?_0x141a5d[_0x40a2('0x33')]:_0x2c5384[_0x40a2('0x32')];_0x141a5d[_0x40a2('0x4a')]=qs['sort'](_0x1f7142['query']['sort']);_0x141a5d['where']=qs[_0x40a2('0x30')](_['pick'](_0x1f7142[_0x40a2('0x2f')],_0x2c5384[_0x40a2('0x30')]));if(_0x1f7142[_0x40a2('0x2f')][_0x40a2('0x3c')]){_0x141a5d[_0x40a2('0x38')]=_[_0x40a2('0x3a')](_0x141a5d[_0x40a2('0x38')],{'$or':_[_0x40a2('0x28')](_0x141a5d[_0x40a2('0x33')],function(_0x4236d2){var _0x44d6d3={};_0x44d6d3[_0x4236d2]={'$like':'%'+_0x1f7142[_0x40a2('0x2f')][_0x40a2('0x3c')]+'%'};return _0x44d6d3;})});}_0x141a5d=_['merge']({},_0x141a5d,_0x1f7142[_0x40a2('0x3d')]);return _0x247cd4[_0x40a2('0x4d')](_0x141a5d);}})[_0x40a2('0x21')](function(_0x1abc23){if(_0x1abc23){_0x3c19fe=_0x1abc23['length'];if(!_0x1f7142[_0x40a2('0x2f')][_0x40a2('0x4b')](_0x40a2('0x36'))){_0x141a5d[_0x40a2('0x1a')]=qs[_0x40a2('0x1a')](_0x1f7142[_0x40a2('0x2f')][_0x40a2('0x1a')]);_0x141a5d[_0x40a2('0x18')]=qs[_0x40a2('0x18')](_0x1f7142[_0x40a2('0x2f')][_0x40a2('0x18')]);}return _0x247cd4[_0x40a2('0x4d')](_0x141a5d);}})['then'](function(_0x238892){if(_0x238892){return _0x238892?{'count':_0x3c19fe,'rows':_0x238892}:null;}})[_0x40a2('0x21')](respondWithResult(_0x415b6b,null))[_0x40a2('0x42')](handleError(_0x415b6b,null));};exports[_0x40a2('0x4e')]=function(_0xc084f6,_0x4d3931,_0x4df536){var _0x4212b8={};var _0x2541f9={};var _0x3baf23;var _0x580a11;return db[_0x40a2('0x29')][_0x40a2('0x49')]({'where':{'id':_0xc084f6[_0x40a2('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d3931,null))[_0x40a2('0x21')](function(_0x245d61){if(_0x245d61){_0x3baf23=_0x245d61;_0x2541f9[_0x40a2('0x32')]=_['keys'](db[_0x40a2('0x4c')][_0x40a2('0x2a')]);_0x2541f9[_0x40a2('0x2f')]=_[_0x40a2('0x2e')](_0xc084f6['query']);_0x2541f9['filters']=_[_0x40a2('0x31')](_0x2541f9[_0x40a2('0x32')],_0x2541f9[_0x40a2('0x2f')]);_0x4212b8[_0x40a2('0x33')]=_[_0x40a2('0x31')](_0x2541f9[_0x40a2('0x32')],qs['fields'](_0xc084f6['query'][_0x40a2('0x34')]));_0x4212b8[_0x40a2('0x33')]=_0x4212b8[_0x40a2('0x33')]['length']?_0x4212b8['attributes']:_0x2541f9[_0x40a2('0x32')];_0x4212b8[_0x40a2('0x4a')]=qs[_0x40a2('0x37')](_0xc084f6[_0x40a2('0x2f')][_0x40a2('0x37')]);_0x4212b8[_0x40a2('0x38')]=qs['filters'](_['pick'](_0xc084f6[_0x40a2('0x2f')],_0x2541f9[_0x40a2('0x30')]));if(_0xc084f6[_0x40a2('0x2f')][_0x40a2('0x3c')]){_0x4212b8[_0x40a2('0x38')]=_[_0x40a2('0x3a')](_0x4212b8['where'],{'$or':_['map'](_0x4212b8[_0x40a2('0x33')],function(_0x118d22){var _0x1291ce={};_0x1291ce[_0x118d22]={'$like':'%'+_0xc084f6['query']['filter']+'%'};return _0x1291ce;})});}_0x4212b8=_['merge']({},_0x4212b8,_0xc084f6[_0x40a2('0x3d')]);return _0x3baf23[_0x40a2('0x4e')](_0x4212b8);}})[_0x40a2('0x21')](function(_0x499e1e){if(_0x499e1e){_0x580a11=_0x499e1e[_0x40a2('0x35')];if(!_0xc084f6['query'][_0x40a2('0x4b')](_0x40a2('0x36'))){_0x4212b8[_0x40a2('0x1a')]=qs[_0x40a2('0x1a')](_0xc084f6[_0x40a2('0x2f')]['limit']);_0x4212b8[_0x40a2('0x18')]=qs[_0x40a2('0x18')](_0xc084f6[_0x40a2('0x2f')]['offset']);}return _0x3baf23[_0x40a2('0x4e')](_0x4212b8);}})[_0x40a2('0x21')](function(_0x4dc787){if(_0x4dc787){return _0x4dc787?{'count':_0x580a11,'rows':_0x4dc787}:null;}})[_0x40a2('0x21')](respondWithResult(_0x4d3931,null))[_0x40a2('0x42')](handleError(_0x4d3931,null));}; \ No newline at end of file +var _0xbf28=['lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','count','set','apply','reject','update','destroy','then','sendStatus','error','stack','name','index','map','Dynamics365Configuration','fieldName','type','key','model','query','keys','filters','intersection','length','attributes','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','catch','rawAttributes','fields','create','body','find','getFields','findOne','params','Dynamics365Field','pick','options','getSubjects','getDescriptions','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra'];(function(_0x295595,_0xd93fc9){var _0x4da683=function(_0x55b78d){while(--_0x55b78d){_0x295595['push'](_0x295595['shift']());}};_0x4da683(++_0xd93fc9);}(_0xbf28,0x1d0));var _0x8bf2=function(_0x57101b,_0x4679fa){_0x57101b=_0x57101b-0x0;var _0x3b104a=_0xbf28[_0x57101b];return _0x3b104a;};'use strict';var emlformat=require(_0x8bf2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8bf2('0x1'));var rp=require('request-promise');var moment=require(_0x8bf2('0x2'));var BPromise=require(_0x8bf2('0x3'));var Mustache=require(_0x8bf2('0x4'));var util=require(_0x8bf2('0x5'));var path=require(_0x8bf2('0x6'));var sox=require(_0x8bf2('0x7'));var csv=require('to-csv');var ejs=require(_0x8bf2('0x8'));var fs=require('fs');var fs_extra=require(_0x8bf2('0x9'));var _=require(_0x8bf2('0xa'));var squel=require(_0x8bf2('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8bf2('0xc'));var toCsv=require(_0x8bf2('0xd'));var querystring=require(_0x8bf2('0xe'));var Papa=require(_0x8bf2('0xf'));var Redis=require(_0x8bf2('0x10'));var authService=require(_0x8bf2('0x11'));var qs=require(_0x8bf2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8bf2('0x13'));var logger=require(_0x8bf2('0x14'))(_0x8bf2('0x15'));var utils=require(_0x8bf2('0x16'));var config=require(_0x8bf2('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8bf2('0x18'))['db'];function respondWithStatusCode(_0x59985f,_0x4ad6b2){_0x4ad6b2=_0x4ad6b2||0xcc;return function(_0x153258){if(_0x153258){return _0x59985f['sendStatus'](_0x4ad6b2);}return _0x59985f[_0x8bf2('0x19')](_0x4ad6b2)[_0x8bf2('0x1a')]();};}function respondWithResult(_0x28a1d3,_0x55ad95){_0x55ad95=_0x55ad95||0xc8;return function(_0x125503){if(_0x125503){return _0x28a1d3['status'](_0x55ad95)[_0x8bf2('0x1b')](_0x125503);}};}function respondWithFilteredResult(_0x20ffff,_0x213f4e){return function(_0x4d2fa2){if(_0x4d2fa2){var _0x3fffd3=typeof _0x213f4e[_0x8bf2('0x1c')]==='undefined'&&typeof _0x213f4e[_0x8bf2('0x1d')]==='undefined';var _0x312840=_0x4d2fa2['count'];var _0x5a68fe=_0x3fffd3?0x0:_0x213f4e[_0x8bf2('0x1c')];var _0x39c8a3=_0x3fffd3?_0x4d2fa2[_0x8bf2('0x1e')]:_0x213f4e[_0x8bf2('0x1c')]+_0x213f4e[_0x8bf2('0x1d')];var _0xed15fa;if(_0x39c8a3>=_0x312840){_0x39c8a3=_0x312840;_0xed15fa=0xc8;}else{_0xed15fa=0xce;}_0x20ffff[_0x8bf2('0x19')](_0xed15fa);return _0x20ffff[_0x8bf2('0x1f')]('Content-Range',_0x5a68fe+'-'+_0x39c8a3+'/'+_0x312840)[_0x8bf2('0x1b')](_0x4d2fa2);}return null;};}function patchUpdates(_0x2d5ba5){return function(_0x4a9cf8){try{jsonpatch[_0x8bf2('0x20')](_0x4a9cf8,_0x2d5ba5,!![]);}catch(_0x2a9b3b){return BPromise[_0x8bf2('0x21')](_0x2a9b3b);}return _0x4a9cf8['save']();};}function saveUpdates(_0x5af645,_0xc0d14f){return function(_0x595e16){if(_0x595e16){return _0x595e16[_0x8bf2('0x22')](_0x5af645)['then'](function(_0x3a7792){return _0x3a7792;});}return null;};}function removeEntity(_0x59b0c8,_0x39d360){return function(_0x1f2cc3){if(_0x1f2cc3){return _0x1f2cc3[_0x8bf2('0x23')]()[_0x8bf2('0x24')](function(){_0x59b0c8[_0x8bf2('0x19')](0xcc)[_0x8bf2('0x1a')]();});}};}function handleEntityNotFound(_0x18d336,_0x2f7c8f){return function(_0x1aa923){if(!_0x1aa923){_0x18d336[_0x8bf2('0x25')](0x194);}return _0x1aa923;};}function handleError(_0x52c604,_0x441561){_0x441561=_0x441561||0x1f4;return function(_0x1c1878){logger[_0x8bf2('0x26')](_0x1c1878[_0x8bf2('0x27')]);if(_0x1c1878[_0x8bf2('0x28')]){delete _0x1c1878['name'];}_0x52c604[_0x8bf2('0x19')](_0x441561)['send'](_0x1c1878);};}exports[_0x8bf2('0x29')]=function(_0x527bb0,_0x74b6a2){var _0x318eeb={},_0x13190e={},_0x250a4e={'count':0x0,'rows':[]};var _0x2c2e82=_[_0x8bf2('0x2a')](db[_0x8bf2('0x2b')]['rawAttributes'],function(_0x2526aa){return{'name':_0x2526aa[_0x8bf2('0x2c')],'type':_0x2526aa[_0x8bf2('0x2d')][_0x8bf2('0x2e')]};});_0x13190e[_0x8bf2('0x2f')]=_[_0x8bf2('0x2a')](_0x2c2e82,_0x8bf2('0x28'));_0x13190e[_0x8bf2('0x30')]=_[_0x8bf2('0x31')](_0x527bb0[_0x8bf2('0x30')]);_0x13190e[_0x8bf2('0x32')]=_['intersection'](_0x13190e[_0x8bf2('0x2f')],_0x13190e['query']);_0x318eeb['attributes']=_[_0x8bf2('0x33')](_0x13190e[_0x8bf2('0x2f')],qs['fields'](_0x527bb0[_0x8bf2('0x30')]['fields']));_0x318eeb['attributes']=_0x318eeb['attributes'][_0x8bf2('0x34')]?_0x318eeb[_0x8bf2('0x35')]:_0x13190e[_0x8bf2('0x2f')];if(!_0x527bb0[_0x8bf2('0x30')][_0x8bf2('0x36')](_0x8bf2('0x37'))){_0x318eeb[_0x8bf2('0x1d')]=qs[_0x8bf2('0x1d')](_0x527bb0[_0x8bf2('0x30')]['limit']);_0x318eeb[_0x8bf2('0x1c')]=qs[_0x8bf2('0x1c')](_0x527bb0[_0x8bf2('0x30')]['offset']);}_0x318eeb[_0x8bf2('0x38')]=qs['sort'](_0x527bb0[_0x8bf2('0x30')][_0x8bf2('0x39')]);_0x318eeb[_0x8bf2('0x3a')]=qs[_0x8bf2('0x32')](_['pick'](_0x527bb0[_0x8bf2('0x30')],_0x13190e[_0x8bf2('0x32')]),_0x2c2e82);if(_0x527bb0['query']['filter']){_0x318eeb[_0x8bf2('0x3a')]=_[_0x8bf2('0x3b')](_0x318eeb[_0x8bf2('0x3a')],{'$or':_[_0x8bf2('0x2a')](_0x2c2e82,function(_0x381fbb){if(_0x381fbb[_0x8bf2('0x2d')]!==_0x8bf2('0x3c')){var _0x5831f3={};_0x5831f3[_0x381fbb[_0x8bf2('0x28')]]={'$like':'%'+_0x527bb0[_0x8bf2('0x30')][_0x8bf2('0x3d')]+'%'};return _0x5831f3;}})});}_0x318eeb=_[_0x8bf2('0x3b')]({},_0x318eeb,_0x527bb0['options']);var _0x425d9f={'where':_0x318eeb[_0x8bf2('0x3a')]};return db['Dynamics365Configuration'][_0x8bf2('0x1e')](_0x425d9f)['then'](function(_0x478f44){_0x250a4e[_0x8bf2('0x1e')]=_0x478f44;if(_0x527bb0[_0x8bf2('0x30')][_0x8bf2('0x3e')]){_0x318eeb[_0x8bf2('0x3f')]=[{'all':!![]}];}return db[_0x8bf2('0x2b')][_0x8bf2('0x40')](_0x318eeb);})[_0x8bf2('0x24')](function(_0x399af1){_0x250a4e['rows']=_0x399af1;return _0x250a4e;})[_0x8bf2('0x24')](respondWithFilteredResult(_0x74b6a2,_0x318eeb))[_0x8bf2('0x41')](handleError(_0x74b6a2,null));};exports['show']=function(_0x1ad9dd,_0x27bf0b){var _0x3dd2a3={'raw':![],'where':{'id':_0x1ad9dd['params']['id']}},_0x2720b2={};_0x2720b2[_0x8bf2('0x2f')]=_[_0x8bf2('0x31')](db[_0x8bf2('0x2b')][_0x8bf2('0x42')]);_0x2720b2[_0x8bf2('0x30')]=_[_0x8bf2('0x31')](_0x1ad9dd[_0x8bf2('0x30')]);_0x2720b2[_0x8bf2('0x32')]=_['intersection'](_0x2720b2[_0x8bf2('0x2f')],_0x2720b2[_0x8bf2('0x30')]);_0x3dd2a3[_0x8bf2('0x35')]=_[_0x8bf2('0x33')](_0x2720b2[_0x8bf2('0x2f')],qs[_0x8bf2('0x43')](_0x1ad9dd['query'][_0x8bf2('0x43')]));_0x3dd2a3['attributes']=_0x3dd2a3[_0x8bf2('0x35')][_0x8bf2('0x34')]?_0x3dd2a3[_0x8bf2('0x35')]:_0x2720b2[_0x8bf2('0x2f')];if(_0x1ad9dd[_0x8bf2('0x30')]['includeAll']){_0x3dd2a3[_0x8bf2('0x3f')]=[{'all':!![]}];}_0x3dd2a3=_['merge']({},_0x3dd2a3,_0x1ad9dd['options']);return db[_0x8bf2('0x2b')]['find'](_0x3dd2a3)[_0x8bf2('0x24')](handleEntityNotFound(_0x27bf0b,null))[_0x8bf2('0x24')](respondWithResult(_0x27bf0b,null))[_0x8bf2('0x41')](handleError(_0x27bf0b,null));};exports[_0x8bf2('0x44')]=function(_0x5c13c6,_0x400772){return db[_0x8bf2('0x2b')][_0x8bf2('0x44')](_0x5c13c6[_0x8bf2('0x45')],{})['then'](respondWithResult(_0x400772,0xc9))[_0x8bf2('0x41')](handleError(_0x400772,null));};exports[_0x8bf2('0x22')]=function(_0x1d457e,_0x14ab63){if(_0x1d457e[_0x8bf2('0x45')]['id']){delete _0x1d457e[_0x8bf2('0x45')]['id'];}return db[_0x8bf2('0x2b')][_0x8bf2('0x46')]({'where':{'id':_0x1d457e['params']['id']}})['then'](handleEntityNotFound(_0x14ab63,null))[_0x8bf2('0x24')](saveUpdates(_0x1d457e[_0x8bf2('0x45')],null))[_0x8bf2('0x24')](respondWithResult(_0x14ab63,null))[_0x8bf2('0x41')](handleError(_0x14ab63,null));};exports[_0x8bf2('0x23')]=function(_0xf62f83,_0x313846){return db[_0x8bf2('0x2b')]['find']({'where':{'id':_0xf62f83['params']['id']}})[_0x8bf2('0x24')](handleEntityNotFound(_0x313846,null))[_0x8bf2('0x24')](removeEntity(_0x313846,null))['catch'](handleError(_0x313846,null));};exports[_0x8bf2('0x47')]=function(_0x290192,_0x1a0c71,_0x2a6543){var _0x468c70={};var _0x253ec1={};var _0x45a0a6;var _0x4dbd65;return db[_0x8bf2('0x2b')][_0x8bf2('0x48')]({'where':{'id':_0x290192[_0x8bf2('0x49')]['id']}})[_0x8bf2('0x24')](handleEntityNotFound(_0x1a0c71,null))[_0x8bf2('0x24')](function(_0x581cfc){if(_0x581cfc){_0x45a0a6=_0x581cfc;_0x253ec1[_0x8bf2('0x2f')]=_['keys'](db[_0x8bf2('0x4a')]['rawAttributes']);_0x253ec1[_0x8bf2('0x30')]=_[_0x8bf2('0x31')](_0x290192[_0x8bf2('0x30')]);_0x253ec1[_0x8bf2('0x32')]=_['intersection'](_0x253ec1[_0x8bf2('0x2f')],_0x253ec1[_0x8bf2('0x30')]);_0x468c70['attributes']=_['intersection'](_0x253ec1['model'],qs[_0x8bf2('0x43')](_0x290192[_0x8bf2('0x30')][_0x8bf2('0x43')]));_0x468c70['attributes']=_0x468c70[_0x8bf2('0x35')][_0x8bf2('0x34')]?_0x468c70['attributes']:_0x253ec1[_0x8bf2('0x2f')];_0x468c70[_0x8bf2('0x38')]=qs[_0x8bf2('0x39')](_0x290192[_0x8bf2('0x30')][_0x8bf2('0x39')]);_0x468c70[_0x8bf2('0x3a')]=qs[_0x8bf2('0x32')](_[_0x8bf2('0x4b')](_0x290192['query'],_0x253ec1[_0x8bf2('0x32')]));if(_0x290192[_0x8bf2('0x30')]['filter']){_0x468c70[_0x8bf2('0x3a')]=_[_0x8bf2('0x3b')](_0x468c70[_0x8bf2('0x3a')],{'$or':_['map'](_0x468c70[_0x8bf2('0x35')],function(_0x89d33c){var _0x2e6f94={};_0x2e6f94[_0x89d33c]={'$like':'%'+_0x290192['query'][_0x8bf2('0x3d')]+'%'};return _0x2e6f94;})});}_0x468c70=_[_0x8bf2('0x3b')]({},_0x468c70,_0x290192[_0x8bf2('0x4c')]);return _0x45a0a6[_0x8bf2('0x47')](_0x468c70);}})[_0x8bf2('0x24')](function(_0x3d9544){if(_0x3d9544){_0x4dbd65=_0x3d9544['length'];if(!_0x290192[_0x8bf2('0x30')][_0x8bf2('0x36')](_0x8bf2('0x37'))){_0x468c70['limit']=qs[_0x8bf2('0x1d')](_0x290192[_0x8bf2('0x30')][_0x8bf2('0x1d')]);_0x468c70[_0x8bf2('0x1c')]=qs[_0x8bf2('0x1c')](_0x290192[_0x8bf2('0x30')][_0x8bf2('0x1c')]);}return _0x45a0a6[_0x8bf2('0x47')](_0x468c70);}})[_0x8bf2('0x24')](function(_0x178ef5){if(_0x178ef5){return _0x178ef5?{'count':_0x4dbd65,'rows':_0x178ef5}:null;}})[_0x8bf2('0x24')](respondWithResult(_0x1a0c71,null))[_0x8bf2('0x41')](handleError(_0x1a0c71,null));};exports[_0x8bf2('0x4d')]=function(_0x39bc83,_0x92c45d,_0x40ce30){var _0x56145a={};var _0x41390c={};var _0x583638;var _0x39e9b6;return db[_0x8bf2('0x2b')][_0x8bf2('0x48')]({'where':{'id':_0x39bc83[_0x8bf2('0x49')]['id']}})[_0x8bf2('0x24')](handleEntityNotFound(_0x92c45d,null))['then'](function(_0x1945d7){if(_0x1945d7){_0x583638=_0x1945d7;_0x41390c[_0x8bf2('0x2f')]=_[_0x8bf2('0x31')](db[_0x8bf2('0x4a')][_0x8bf2('0x42')]);_0x41390c[_0x8bf2('0x30')]=_[_0x8bf2('0x31')](_0x39bc83[_0x8bf2('0x30')]);_0x41390c['filters']=_['intersection'](_0x41390c['model'],_0x41390c[_0x8bf2('0x30')]);_0x56145a[_0x8bf2('0x35')]=_[_0x8bf2('0x33')](_0x41390c['model'],qs[_0x8bf2('0x43')](_0x39bc83['query'][_0x8bf2('0x43')]));_0x56145a['attributes']=_0x56145a[_0x8bf2('0x35')]['length']?_0x56145a[_0x8bf2('0x35')]:_0x41390c[_0x8bf2('0x2f')];_0x56145a['order']=qs[_0x8bf2('0x39')](_0x39bc83['query'][_0x8bf2('0x39')]);_0x56145a['where']=qs[_0x8bf2('0x32')](_[_0x8bf2('0x4b')](_0x39bc83[_0x8bf2('0x30')],_0x41390c[_0x8bf2('0x32')]));if(_0x39bc83[_0x8bf2('0x30')][_0x8bf2('0x3d')]){_0x56145a[_0x8bf2('0x3a')]=_[_0x8bf2('0x3b')](_0x56145a[_0x8bf2('0x3a')],{'$or':_['map'](_0x56145a[_0x8bf2('0x35')],function(_0x5d8c98){var _0x5dd997={};_0x5dd997[_0x5d8c98]={'$like':'%'+_0x39bc83[_0x8bf2('0x30')][_0x8bf2('0x3d')]+'%'};return _0x5dd997;})});}_0x56145a=_['merge']({},_0x56145a,_0x39bc83['options']);return _0x583638[_0x8bf2('0x4d')](_0x56145a);}})['then'](function(_0x4d5aae){if(_0x4d5aae){_0x39e9b6=_0x4d5aae[_0x8bf2('0x34')];if(!_0x39bc83[_0x8bf2('0x30')][_0x8bf2('0x36')](_0x8bf2('0x37'))){_0x56145a[_0x8bf2('0x1d')]=qs[_0x8bf2('0x1d')](_0x39bc83[_0x8bf2('0x30')][_0x8bf2('0x1d')]);_0x56145a[_0x8bf2('0x1c')]=qs[_0x8bf2('0x1c')](_0x39bc83[_0x8bf2('0x30')][_0x8bf2('0x1c')]);}return _0x583638['getSubjects'](_0x56145a);}})[_0x8bf2('0x24')](function(_0x4dbc38){if(_0x4dbc38){return _0x4dbc38?{'count':_0x39e9b6,'rows':_0x4dbc38}:null;}})[_0x8bf2('0x24')](respondWithResult(_0x92c45d,null))[_0x8bf2('0x41')](handleError(_0x92c45d,null));};exports[_0x8bf2('0x4e')]=function(_0x427a95,_0x27ef97,_0x57ad54){var _0x4b8561={};var _0x302151={};var _0x3028cd;var _0x496919;return db['Dynamics365Configuration'][_0x8bf2('0x48')]({'where':{'id':_0x427a95[_0x8bf2('0x49')]['id']}})[_0x8bf2('0x24')](handleEntityNotFound(_0x27ef97,null))[_0x8bf2('0x24')](function(_0x9184f9){if(_0x9184f9){_0x3028cd=_0x9184f9;_0x302151['model']=_[_0x8bf2('0x31')](db['Dynamics365Field'][_0x8bf2('0x42')]);_0x302151[_0x8bf2('0x30')]=_['keys'](_0x427a95['query']);_0x302151[_0x8bf2('0x32')]=_[_0x8bf2('0x33')](_0x302151[_0x8bf2('0x2f')],_0x302151['query']);_0x4b8561[_0x8bf2('0x35')]=_[_0x8bf2('0x33')](_0x302151['model'],qs[_0x8bf2('0x43')](_0x427a95[_0x8bf2('0x30')][_0x8bf2('0x43')]));_0x4b8561['attributes']=_0x4b8561[_0x8bf2('0x35')][_0x8bf2('0x34')]?_0x4b8561[_0x8bf2('0x35')]:_0x302151[_0x8bf2('0x2f')];_0x4b8561[_0x8bf2('0x38')]=qs['sort'](_0x427a95[_0x8bf2('0x30')][_0x8bf2('0x39')]);_0x4b8561[_0x8bf2('0x3a')]=qs[_0x8bf2('0x32')](_[_0x8bf2('0x4b')](_0x427a95['query'],_0x302151[_0x8bf2('0x32')]));if(_0x427a95[_0x8bf2('0x30')][_0x8bf2('0x3d')]){_0x4b8561[_0x8bf2('0x3a')]=_[_0x8bf2('0x3b')](_0x4b8561[_0x8bf2('0x3a')],{'$or':_[_0x8bf2('0x2a')](_0x4b8561[_0x8bf2('0x35')],function(_0x37ed11){var _0x17f5eb={};_0x17f5eb[_0x37ed11]={'$like':'%'+_0x427a95[_0x8bf2('0x30')][_0x8bf2('0x3d')]+'%'};return _0x17f5eb;})});}_0x4b8561=_[_0x8bf2('0x3b')]({},_0x4b8561,_0x427a95[_0x8bf2('0x4c')]);return _0x3028cd[_0x8bf2('0x4e')](_0x4b8561);}})[_0x8bf2('0x24')](function(_0x12e6ed){if(_0x12e6ed){_0x496919=_0x12e6ed[_0x8bf2('0x34')];if(!_0x427a95[_0x8bf2('0x30')][_0x8bf2('0x36')](_0x8bf2('0x37'))){_0x4b8561[_0x8bf2('0x1d')]=qs['limit'](_0x427a95[_0x8bf2('0x30')][_0x8bf2('0x1d')]);_0x4b8561[_0x8bf2('0x1c')]=qs[_0x8bf2('0x1c')](_0x427a95['query'][_0x8bf2('0x1c')]);}return _0x3028cd[_0x8bf2('0x4e')](_0x4b8561);}})['then'](function(_0x403512){if(_0x403512){return _0x403512?{'count':_0x496919,'rows':_0x403512}:null;}})[_0x8bf2('0x24')](respondWithResult(_0x27ef97,null))[_0x8bf2('0x41')](handleError(_0x27ef97,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index a348b99..b0ace8d 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x84ab=['request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration','lodash','util','../../config/logger','api','moment'];(function(_0x20ee4d,_0x5c470a){var _0x36d115=function(_0x22be35){while(--_0x22be35){_0x20ee4d['push'](_0x20ee4d['shift']());}};_0x36d115(++_0x5c470a);}(_0x84ab,0x12f));var _0xb84a=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x84ab[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var logger=require(_0xb84a('0x2'))(_0xb84a('0x3'));var moment=require(_0xb84a('0x4'));var BPromise=require('bluebird');var rp=require(_0xb84a('0x5'));var fs=require('fs');var path=require(_0xb84a('0x6'));var rimraf=require('rimraf');var config=require(_0xb84a('0x7'));var attributes=require(_0xb84a('0x8'));module[_0xb84a('0x9')]=function(_0x5b9def,_0x521a64){return _0x5b9def['define'](_0xb84a('0xa'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0xb5dd9f,_0x580485){var _0x299b41=function(_0x1a3937){while(--_0x1a3937){_0xb5dd9f['push'](_0xb5dd9f['shift']());}};_0x299b41(++_0x580485);}(_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 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':'int_dynamics365_configurations','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 cd7a0a6..92e19ad 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 _0xadb0=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x485113,_0x199534){var _0x37faae=function(_0x111cb7){while(--_0x111cb7){_0x485113['push'](_0x485113['shift']());}};_0x37faae(++_0x199534);}(_0xadb0,0x82));var _0x0adb=function(_0x324c08,_0x494619){_0x324c08=_0x324c08-0x0;var _0x571fe7=_0xadb0[_0x324c08];return _0x571fe7;};'use strict';var _=require(_0x0adb('0x0'));var util=require(_0x0adb('0x1'));var moment=require(_0x0adb('0x2'));var BPromise=require(_0x0adb('0x3'));var rs=require(_0x0adb('0x4'));var fs=require('fs');var Redis=require(_0x0adb('0x5'));var db=require(_0x0adb('0x6'))['db'];var utils=require(_0x0adb('0x7'));var logger=require('../../config/logger')(_0x0adb('0x8'));var config=require(_0x0adb('0x9'));var jayson=require(_0x0adb('0xa'));var client=jayson[_0x0adb('0xb')][_0x0adb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x558cd9,_0x417a89,_0x5c40dd){return new BPromise(function(_0x10f0de,_0x7ed12){return client[_0x0adb('0xd')](_0x558cd9,_0x5c40dd)[_0x0adb('0xe')](function(_0x556ab5){logger[_0x0adb('0xf')](_0x0adb('0x10'),_0x417a89,_0x0adb('0x11'));logger['debug'](_0x0adb('0x12'),_0x417a89,'request\x20sent',JSON[_0x0adb('0x13')](_0x556ab5));if(_0x556ab5['error']){if(_0x556ab5[_0x0adb('0x14')]['code']===0x1f4){logger[_0x0adb('0x14')](_0x0adb('0x10'),_0x417a89,_0x556ab5[_0x0adb('0x14')][_0x0adb('0x15')]);return _0x7ed12(_0x556ab5['error'][_0x0adb('0x15')]);}logger[_0x0adb('0x14')]('Dynamics365Configuration,\x20%s,\x20%s',_0x417a89,_0x556ab5[_0x0adb('0x14')][_0x0adb('0x15')]);return _0x10f0de(_0x556ab5[_0x0adb('0x14')]['message']);}else{logger[_0x0adb('0xf')](_0x0adb('0x10'),_0x417a89,_0x0adb('0x11'));_0x10f0de(_0x556ab5[_0x0adb('0x16')]['message']);}})['catch'](function(_0x16bc55){logger[_0x0adb('0x14')]('Dynamics365Configuration,\x20%s,\x20%s',_0x417a89,_0x16bc55);_0x7ed12(_0x16bc55);});});} \ No newline at end of file +var _0x54a4=['randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x54a4,0xcd));var _0x454a=function(_0x5327e2,_0x2eab05){_0x5327e2=_0x5327e2-0x0;var _0x247c45=_0x54a4[_0x5327e2];return _0x247c45;};'use strict';var _=require(_0x454a('0x0'));var util=require('util');var moment=require(_0x454a('0x1'));var BPromise=require('bluebird');var rs=require(_0x454a('0x2'));var fs=require('fs');var Redis=require(_0x454a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x454a('0x4'))(_0x454a('0x5'));var config=require(_0x454a('0x6'));var jayson=require(_0x454a('0x7'));var client=jayson[_0x454a('0x8')][_0x454a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21d9c7,_0x2a0f0b,_0x49a27b){return new BPromise(function(_0x212299,_0x307017){return client[_0x454a('0xa')](_0x21d9c7,_0x49a27b)[_0x454a('0xb')](function(_0x395232){logger['info'](_0x454a('0xc'),_0x2a0f0b,_0x454a('0xd'));logger[_0x454a('0xe')](_0x454a('0xf'),_0x2a0f0b,_0x454a('0xd'),JSON[_0x454a('0x10')](_0x395232));if(_0x395232[_0x454a('0x11')]){if(_0x395232['error'][_0x454a('0x12')]===0x1f4){logger[_0x454a('0x11')](_0x454a('0xc'),_0x2a0f0b,_0x395232['error'][_0x454a('0x13')]);return _0x307017(_0x395232[_0x454a('0x11')]['message']);}logger[_0x454a('0x11')](_0x454a('0xc'),_0x2a0f0b,_0x395232[_0x454a('0x11')][_0x454a('0x13')]);return _0x212299(_0x395232['error'][_0x454a('0x13')]);}else{logger[_0x454a('0x14')](_0x454a('0xc'),_0x2a0f0b,_0x454a('0xd'));_0x212299(_0x395232[_0x454a('0x15')][_0x454a('0x13')]);}})[_0x454a('0x16')](function(_0x4fc23d){logger[_0x454a('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2a0f0b,_0x4fc23d);_0x307017(_0x4fc23d);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index f9e6194..912a22d 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 _0x1569=['../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x52daea,_0xa2df7e){var _0x16c531=function(_0x197ecb){while(--_0x197ecb){_0x52daea['push'](_0x52daea['shift']());}};_0x16c531(++_0xa2df7e);}(_0x1569,0x85));var _0x9156=function(_0x4ef078,_0x490047){_0x4ef078=_0x4ef078-0x0;var _0x33215c=_0x1569[_0x4ef078];return _0x33215c;};'use strict';var multer=require('multer');var util=require(_0x9156('0x0'));var path=require('path');var timeout=require(_0x9156('0x1'));var express=require(_0x9156('0x2'));var router=express[_0x9156('0x3')]();var fs_extra=require(_0x9156('0x4'));var auth=require(_0x9156('0x5'));var interaction=require(_0x9156('0x6'));var config=require(_0x9156('0x7'));var controller=require(_0x9156('0x8'));router[_0x9156('0x9')]('/',auth[_0x9156('0xa')](),controller[_0x9156('0xb')]);router[_0x9156('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x9156('0xc')]);router[_0x9156('0xd')]('/',auth[_0x9156('0xa')](),controller[_0x9156('0xe')]);router[_0x9156('0xf')](_0x9156('0x10'),auth[_0x9156('0xa')](),controller[_0x9156('0x11')]);router[_0x9156('0x12')](_0x9156('0x10'),auth[_0x9156('0xa')](),controller['destroy']);module[_0x9156('0x13')]=router; \ No newline at end of file +var _0xa36f=['create','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','isAuthenticated','index','get','/:id','show','post'];(function(_0x86df98,_0x5e321e){var _0x3f3e96=function(_0x3dfba0){while(--_0x3dfba0){_0x86df98['push'](_0x86df98['shift']());}};_0x3f3e96(++_0x5e321e);}(_0xa36f,0xcd));var _0xfa36=function(_0x3f92a4,_0x596105){_0x3f92a4=_0x3f92a4-0x0;var _0xdff35c=_0xa36f[_0x3f92a4];return _0xdff35c;};'use strict';var multer=require(_0xfa36('0x0'));var util=require(_0xfa36('0x1'));var path=require('path');var timeout=require(_0xfa36('0x2'));var express=require('express');var router=express[_0xfa36('0x3')]();var fs_extra=require(_0xfa36('0x4'));var auth=require(_0xfa36('0x5'));var interaction=require(_0xfa36('0x6'));var config=require(_0xfa36('0x7'));var controller=require(_0xfa36('0x8'));router['get']('/',auth[_0xfa36('0x9')](),controller[_0xfa36('0xa')]);router[_0xfa36('0xb')](_0xfa36('0xc'),auth[_0xfa36('0x9')](),controller[_0xfa36('0xd')]);router[_0xfa36('0xe')]('/',auth[_0xfa36('0x9')](),controller[_0xfa36('0xf')]);router['put']('/:id',auth[_0xfa36('0x9')](),controller[_0xfa36('0x10')]);router[_0xfa36('0x11')](_0xfa36('0xc'),auth['isAuthenticated'](),controller[_0xfa36('0x12')]);module[_0xfa36('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 3fe5dae..27529ae 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 _0x8368=['keyValue','picklist','STRING','customVariable','sequelize','exports','ENUM','string','variable'];(function(_0x512c83,_0x42a67a){var _0x1f7f25=function(_0x1e656c){while(--_0x1e656c){_0x512c83['push'](_0x512c83['shift']());}};_0x1f7f25(++_0x42a67a);}(_0x8368,0x17e));var _0x8836=function(_0x51972f,_0x11f19e){_0x51972f=_0x51972f-0x0;var _0x13af1b=_0x8368[_0x51972f];return _0x13af1b;};'use strict';var Sequelize=require(_0x8836('0x0'));module[_0x8836('0x1')]={'type':{'type':Sequelize[_0x8836('0x2')](_0x8836('0x3'),_0x8836('0x4'),'customVariable',_0x8836('0x5'),_0x8836('0x6')),'defaultValue':_0x8836('0x3')},'content':{'type':Sequelize[_0x8836('0x7')]},'key':{'type':Sequelize[_0x8836('0x7')]},'keyType':{'type':Sequelize[_0x8836('0x2')](_0x8836('0x3'),_0x8836('0x4'),_0x8836('0x8'))},'keyContent':{'type':Sequelize[_0x8836('0x7')]},'idField':{'type':Sequelize[_0x8836('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8836('0x7')]}}; \ No newline at end of file +var _0x4ce6=['string','keyValue','picklist','STRING','variable','customVariable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x154473,_0x5f2e1f){var _0x496212=function(_0x571ffb){while(--_0x571ffb){_0x154473['push'](_0x154473['shift']());}};_0x496212(++_0x5f2e1f);}(_0x4ce6,0x179));var _0x64ce=function(_0x54d52,_0x2473ba){_0x54d52=_0x54d52-0x0;var _0x968345=_0x4ce6[_0x54d52];return _0x968345;};'use strict';var Sequelize=require(_0x64ce('0x0'));module[_0x64ce('0x1')]={'type':{'type':Sequelize[_0x64ce('0x2')](_0x64ce('0x3'),'variable','customVariable',_0x64ce('0x4'),_0x64ce('0x5')),'defaultValue':_0x64ce('0x3')},'content':{'type':Sequelize[_0x64ce('0x6')]},'key':{'type':Sequelize[_0x64ce('0x6')]},'keyType':{'type':Sequelize[_0x64ce('0x2')](_0x64ce('0x3'),_0x64ce('0x7'),_0x64ce('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x64ce('0x6')]},'nameField':{'type':Sequelize[_0x64ce('0x6')]},'customField':{'type':Sequelize[_0x64ce('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x64ce('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 3c82d03..7c809ec 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 _0x43f7=['end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','keys','create','body','find','params','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x43f7,0xcb));var _0x743f=function(_0x58ef72,_0x332754){_0x58ef72=_0x58ef72-0x0;var _0x365902=_0x43f7[_0x58ef72];return _0x365902;};'use strict';var emlformat=require(_0x743f('0x0'));var rimraf=require(_0x743f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x743f('0x2'));var moment=require(_0x743f('0x3'));var BPromise=require(_0x743f('0x4'));var Mustache=require(_0x743f('0x5'));var util=require(_0x743f('0x6'));var path=require(_0x743f('0x7'));var sox=require(_0x743f('0x8'));var csv=require(_0x743f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x743f('0xa'));var _=require(_0x743f('0xb'));var squel=require('squel');var crypto=require(_0x743f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x743f('0xd'));var toCsv=require(_0x743f('0x9'));var querystring=require('querystring');var Papa=require(_0x743f('0xe'));var Redis=require(_0x743f('0xf'));var authService=require(_0x743f('0x10'));var qs=require(_0x743f('0x11'));var as=require(_0x743f('0x12'));var hardwareService=require(_0x743f('0x13'));var logger=require(_0x743f('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x743f('0x15'));var licenseUtil=require(_0x743f('0x16'));var db=require(_0x743f('0x17'))['db'];function respondWithStatusCode(_0x306038,_0x47fe60){_0x47fe60=_0x47fe60||0xcc;return function(_0x37427d){if(_0x37427d){return _0x306038[_0x743f('0x18')](_0x47fe60);}return _0x306038['status'](_0x47fe60)[_0x743f('0x19')]();};}function respondWithResult(_0x3e74e8,_0x4760a8){_0x4760a8=_0x4760a8||0xc8;return function(_0x3ee617){if(_0x3ee617){return _0x3e74e8[_0x743f('0x1a')](_0x4760a8)[_0x743f('0x1b')](_0x3ee617);}};}function respondWithFilteredResult(_0x2b68fe,_0x1d4eed){return function(_0x34389f){if(_0x34389f){var _0x702242=typeof _0x1d4eed['offset']===_0x743f('0x1c')&&typeof _0x1d4eed[_0x743f('0x1d')]===_0x743f('0x1c');var _0x419f53=_0x34389f['count'];var _0x196e28=_0x702242?0x0:_0x1d4eed['offset'];var _0x17db7d=_0x702242?_0x34389f[_0x743f('0x1e')]:_0x1d4eed[_0x743f('0x1f')]+_0x1d4eed[_0x743f('0x1d')];var _0x58c9cc;if(_0x17db7d>=_0x419f53){_0x17db7d=_0x419f53;_0x58c9cc=0xc8;}else{_0x58c9cc=0xce;}_0x2b68fe['status'](_0x58c9cc);return _0x2b68fe[_0x743f('0x20')](_0x743f('0x21'),_0x196e28+'-'+_0x17db7d+'/'+_0x419f53)['json'](_0x34389f);}return null;};}function patchUpdates(_0x1caaae){return function(_0x3a3b33){try{jsonpatch[_0x743f('0x22')](_0x3a3b33,_0x1caaae,!![]);}catch(_0x3cc791){return BPromise['reject'](_0x3cc791);}return _0x3a3b33[_0x743f('0x23')]();};}function saveUpdates(_0x545a23,_0x501584){return function(_0x5eafac){if(_0x5eafac){return _0x5eafac[_0x743f('0x24')](_0x545a23)[_0x743f('0x25')](function(_0x4c3b15){return _0x4c3b15;});}return null;};}function removeEntity(_0x4fb23f,_0x56a8f2){return function(_0x2fb0a4){if(_0x2fb0a4){return _0x2fb0a4[_0x743f('0x26')]()[_0x743f('0x25')](function(){_0x4fb23f[_0x743f('0x1a')](0xcc)[_0x743f('0x19')]();});}};}function handleEntityNotFound(_0x2da8fe,_0x2b0bc0){return function(_0x415226){if(!_0x415226){_0x2da8fe['sendStatus'](0x194);}return _0x415226;};}function handleError(_0x4a3930,_0x51d5dd){_0x51d5dd=_0x51d5dd||0x1f4;return function(_0x4d03aa){logger[_0x743f('0x27')](_0x4d03aa['stack']);if(_0x4d03aa[_0x743f('0x28')]){delete _0x4d03aa[_0x743f('0x28')];}_0x4a3930[_0x743f('0x1a')](_0x51d5dd)[_0x743f('0x29')](_0x4d03aa);};}exports[_0x743f('0x2a')]=function(_0x25c287,_0x1039a1){var _0x1f6056={},_0x179d01={},_0x90e373={'count':0x0,'rows':[]};var _0x56d02f=_[_0x743f('0x2b')](db[_0x743f('0x2c')][_0x743f('0x2d')],function(_0x5d4fe9){return{'name':_0x5d4fe9[_0x743f('0x2e')],'type':_0x5d4fe9[_0x743f('0x2f')][_0x743f('0x30')]};});_0x179d01[_0x743f('0x31')]=_['map'](_0x56d02f,_0x743f('0x28'));_0x179d01[_0x743f('0x32')]=_['keys'](_0x25c287[_0x743f('0x32')]);_0x179d01['filters']=_['intersection'](_0x179d01['model'],_0x179d01[_0x743f('0x32')]);_0x1f6056[_0x743f('0x33')]=_[_0x743f('0x34')](_0x179d01[_0x743f('0x31')],qs[_0x743f('0x35')](_0x25c287['query'][_0x743f('0x35')]));_0x1f6056[_0x743f('0x33')]=_0x1f6056[_0x743f('0x33')][_0x743f('0x36')]?_0x1f6056[_0x743f('0x33')]:_0x179d01[_0x743f('0x31')];if(!_0x25c287[_0x743f('0x32')][_0x743f('0x37')](_0x743f('0x38'))){_0x1f6056[_0x743f('0x1d')]=qs['limit'](_0x25c287[_0x743f('0x32')][_0x743f('0x1d')]);_0x1f6056[_0x743f('0x1f')]=qs['offset'](_0x25c287['query'][_0x743f('0x1f')]);}_0x1f6056['order']=qs[_0x743f('0x39')](_0x25c287['query']['sort']);_0x1f6056[_0x743f('0x3a')]=qs[_0x743f('0x3b')](_[_0x743f('0x3c')](_0x25c287[_0x743f('0x32')],_0x179d01[_0x743f('0x3b')]),_0x56d02f);if(_0x25c287['query']['filter']){_0x1f6056[_0x743f('0x3a')]=_[_0x743f('0x3d')](_0x1f6056[_0x743f('0x3a')],{'$or':_[_0x743f('0x2b')](_0x56d02f,function(_0x32645d){if(_0x32645d['type']!==_0x743f('0x3e')){var _0x42d066={};_0x42d066[_0x32645d[_0x743f('0x28')]]={'$like':'%'+_0x25c287[_0x743f('0x32')][_0x743f('0x3f')]+'%'};return _0x42d066;}})});}_0x1f6056=_[_0x743f('0x3d')]({},_0x1f6056,_0x25c287[_0x743f('0x40')]);var _0x1b31b5={'where':_0x1f6056[_0x743f('0x3a')]};return db[_0x743f('0x2c')]['count'](_0x1b31b5)[_0x743f('0x25')](function(_0x7aa0f1){_0x90e373['count']=_0x7aa0f1;if(_0x25c287[_0x743f('0x32')][_0x743f('0x41')]){_0x1f6056[_0x743f('0x42')]=[{'all':!![]}];}return db[_0x743f('0x2c')][_0x743f('0x43')](_0x1f6056);})[_0x743f('0x25')](function(_0x1d7a3c){_0x90e373[_0x743f('0x44')]=_0x1d7a3c;return _0x90e373;})['then'](respondWithFilteredResult(_0x1039a1,_0x1f6056))[_0x743f('0x45')](handleError(_0x1039a1,null));};exports[_0x743f('0x46')]=function(_0x35fdb7,_0xe49258){var _0x79f97={'raw':!![],'where':{'id':_0x35fdb7['params']['id']}},_0x4446a1={};_0x4446a1[_0x743f('0x31')]=_[_0x743f('0x47')](db[_0x743f('0x2c')][_0x743f('0x2d')]);_0x4446a1[_0x743f('0x32')]=_['keys'](_0x35fdb7[_0x743f('0x32')]);_0x4446a1[_0x743f('0x3b')]=_[_0x743f('0x34')](_0x4446a1['model'],_0x4446a1[_0x743f('0x32')]);_0x79f97[_0x743f('0x33')]=_[_0x743f('0x34')](_0x4446a1[_0x743f('0x31')],qs['fields'](_0x35fdb7[_0x743f('0x32')]['fields']));_0x79f97['attributes']=_0x79f97[_0x743f('0x33')][_0x743f('0x36')]?_0x79f97['attributes']:_0x4446a1[_0x743f('0x31')];if(_0x35fdb7['query'][_0x743f('0x41')]){_0x79f97[_0x743f('0x42')]=[{'all':!![]}];}_0x79f97=_[_0x743f('0x3d')]({},_0x79f97,_0x35fdb7[_0x743f('0x40')]);return db[_0x743f('0x2c')]['find'](_0x79f97)['then'](handleEntityNotFound(_0xe49258,null))['then'](respondWithResult(_0xe49258,null))[_0x743f('0x45')](handleError(_0xe49258,null));};exports[_0x743f('0x48')]=function(_0x4fbc28,_0x1c65fd){return db[_0x743f('0x2c')]['create'](_0x4fbc28[_0x743f('0x49')],{})[_0x743f('0x25')](respondWithResult(_0x1c65fd,0xc9))[_0x743f('0x45')](handleError(_0x1c65fd,null));};exports[_0x743f('0x24')]=function(_0x4175d8,_0x404f26){if(_0x4175d8[_0x743f('0x49')]['id']){delete _0x4175d8[_0x743f('0x49')]['id'];}return db[_0x743f('0x2c')][_0x743f('0x4a')]({'where':{'id':_0x4175d8[_0x743f('0x4b')]['id']}})[_0x743f('0x25')](handleEntityNotFound(_0x404f26,null))[_0x743f('0x25')](saveUpdates(_0x4175d8[_0x743f('0x49')],null))[_0x743f('0x25')](respondWithResult(_0x404f26,null))[_0x743f('0x45')](handleError(_0x404f26,null));};exports[_0x743f('0x26')]=function(_0x27e30e,_0x180522){return db['Dynamics365Field'][_0x743f('0x4a')]({'where':{'id':_0x27e30e[_0x743f('0x4b')]['id']}})[_0x743f('0x25')](handleEntityNotFound(_0x180522,null))['then'](removeEntity(_0x180522,null))[_0x743f('0x45')](handleError(_0x180522,null));}; \ No newline at end of file +var _0xbca6=['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','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','Dynamics365Field','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','catch','zip-dir'];(function(_0xbad3f0,_0x3c6451){var _0x4c5fbd=function(_0x2d36dd){while(--_0x2d36dd){_0xbad3f0['push'](_0xbad3f0['shift']());}};_0x4c5fbd(++_0x3c6451);}(_0xbca6,0x1df));var _0x6bca=function(_0x440f9f,_0x43966e){_0x440f9f=_0x440f9f-0x0;var _0x55d573=_0xbca6[_0x440f9f];return _0x55d573;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6bca('0x0'));var jsonpatch=require(_0x6bca('0x1'));var rp=require(_0x6bca('0x2'));var moment=require(_0x6bca('0x3'));var BPromise=require(_0x6bca('0x4'));var Mustache=require('mustache');var util=require(_0x6bca('0x5'));var path=require(_0x6bca('0x6'));var sox=require(_0x6bca('0x7'));var csv=require('to-csv');var ejs=require(_0x6bca('0x8'));var fs=require('fs');var fs_extra=require(_0x6bca('0x9'));var _=require(_0x6bca('0xa'));var squel=require(_0x6bca('0xb'));var crypto=require(_0x6bca('0xc'));var jsforce=require(_0x6bca('0xd'));var deskjs=require(_0x6bca('0xe'));var toCsv=require(_0x6bca('0xf'));var querystring=require(_0x6bca('0x10'));var Papa=require(_0x6bca('0x11'));var Redis=require(_0x6bca('0x12'));var authService=require(_0x6bca('0x13'));var qs=require(_0x6bca('0x14'));var as=require(_0x6bca('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6bca('0x16'))('api');var utils=require(_0x6bca('0x17'));var config=require(_0x6bca('0x18'));var licenseUtil=require(_0x6bca('0x19'));var db=require(_0x6bca('0x1a'))['db'];function respondWithStatusCode(_0x22e065,_0x2ac5ef){_0x2ac5ef=_0x2ac5ef||0xcc;return function(_0x44ed9b){if(_0x44ed9b){return _0x22e065[_0x6bca('0x1b')](_0x2ac5ef);}return _0x22e065[_0x6bca('0x1c')](_0x2ac5ef)['end']();};}function respondWithResult(_0xa6d869,_0x2c3ef9){_0x2c3ef9=_0x2c3ef9||0xc8;return function(_0xc0e585){if(_0xc0e585){return _0xa6d869['status'](_0x2c3ef9)[_0x6bca('0x1d')](_0xc0e585);}};}function respondWithFilteredResult(_0x5d9823,_0x3f3daf){return function(_0x1ad764){if(_0x1ad764){var _0x995d8a=typeof _0x3f3daf[_0x6bca('0x1e')]===_0x6bca('0x1f')&&typeof _0x3f3daf[_0x6bca('0x20')]===_0x6bca('0x1f');var _0x302a19=_0x1ad764[_0x6bca('0x21')];var _0x229d67=_0x995d8a?0x0:_0x3f3daf['offset'];var _0x3f9510=_0x995d8a?_0x1ad764[_0x6bca('0x21')]:_0x3f3daf['offset']+_0x3f3daf[_0x6bca('0x20')];var _0x338f72;if(_0x3f9510>=_0x302a19){_0x3f9510=_0x302a19;_0x338f72=0xc8;}else{_0x338f72=0xce;}_0x5d9823[_0x6bca('0x1c')](_0x338f72);return _0x5d9823[_0x6bca('0x22')](_0x6bca('0x23'),_0x229d67+'-'+_0x3f9510+'/'+_0x302a19)[_0x6bca('0x1d')](_0x1ad764);}return null;};}function patchUpdates(_0x5915ed){return function(_0x17221d){try{jsonpatch[_0x6bca('0x24')](_0x17221d,_0x5915ed,!![]);}catch(_0x226588){return BPromise[_0x6bca('0x25')](_0x226588);}return _0x17221d['save']();};}function saveUpdates(_0x2127c9,_0x32de9a){return function(_0x151afe){if(_0x151afe){return _0x151afe[_0x6bca('0x26')](_0x2127c9)[_0x6bca('0x27')](function(_0x58ae0e){return _0x58ae0e;});}return null;};}function removeEntity(_0x11aa76,_0x2f95da){return function(_0x38cc60){if(_0x38cc60){return _0x38cc60[_0x6bca('0x28')]()[_0x6bca('0x27')](function(){_0x11aa76['status'](0xcc)[_0x6bca('0x29')]();});}};}function handleEntityNotFound(_0x1ce022,_0x175512){return function(_0x4ed53f){if(!_0x4ed53f){_0x1ce022[_0x6bca('0x1b')](0x194);}return _0x4ed53f;};}function handleError(_0x4e0d99,_0x595e0c){_0x595e0c=_0x595e0c||0x1f4;return function(_0x29cb58){logger[_0x6bca('0x2a')](_0x29cb58[_0x6bca('0x2b')]);if(_0x29cb58[_0x6bca('0x2c')]){delete _0x29cb58[_0x6bca('0x2c')];}_0x4e0d99[_0x6bca('0x1c')](_0x595e0c)[_0x6bca('0x2d')](_0x29cb58);};}exports[_0x6bca('0x2e')]=function(_0x132b44,_0x3dad0f){var _0x4fe276={},_0x250adf={},_0x5a9c01={'count':0x0,'rows':[]};var _0x11d815=_[_0x6bca('0x2f')](db['Dynamics365Field']['rawAttributes'],function(_0x19c73d){return{'name':_0x19c73d['fieldName'],'type':_0x19c73d[_0x6bca('0x30')][_0x6bca('0x31')]};});_0x250adf[_0x6bca('0x32')]=_['map'](_0x11d815,_0x6bca('0x2c'));_0x250adf[_0x6bca('0x33')]=_[_0x6bca('0x34')](_0x132b44[_0x6bca('0x33')]);_0x250adf[_0x6bca('0x35')]=_[_0x6bca('0x36')](_0x250adf['model'],_0x250adf[_0x6bca('0x33')]);_0x4fe276['attributes']=_[_0x6bca('0x36')](_0x250adf[_0x6bca('0x32')],qs['fields'](_0x132b44[_0x6bca('0x33')][_0x6bca('0x37')]));_0x4fe276['attributes']=_0x4fe276[_0x6bca('0x38')][_0x6bca('0x39')]?_0x4fe276[_0x6bca('0x38')]:_0x250adf[_0x6bca('0x32')];if(!_0x132b44[_0x6bca('0x33')][_0x6bca('0x3a')](_0x6bca('0x3b'))){_0x4fe276[_0x6bca('0x20')]=qs['limit'](_0x132b44['query'][_0x6bca('0x20')]);_0x4fe276[_0x6bca('0x1e')]=qs[_0x6bca('0x1e')](_0x132b44[_0x6bca('0x33')][_0x6bca('0x1e')]);}_0x4fe276[_0x6bca('0x3c')]=qs[_0x6bca('0x3d')](_0x132b44[_0x6bca('0x33')][_0x6bca('0x3d')]);_0x4fe276['where']=qs[_0x6bca('0x35')](_[_0x6bca('0x3e')](_0x132b44[_0x6bca('0x33')],_0x250adf['filters']),_0x11d815);if(_0x132b44[_0x6bca('0x33')][_0x6bca('0x3f')]){_0x4fe276[_0x6bca('0x40')]=_['merge'](_0x4fe276[_0x6bca('0x40')],{'$or':_['map'](_0x11d815,function(_0x566a65){if(_0x566a65[_0x6bca('0x30')]!==_0x6bca('0x41')){var _0x13433b={};_0x13433b[_0x566a65[_0x6bca('0x2c')]]={'$like':'%'+_0x132b44[_0x6bca('0x33')][_0x6bca('0x3f')]+'%'};return _0x13433b;}})});}_0x4fe276=_[_0x6bca('0x42')]({},_0x4fe276,_0x132b44[_0x6bca('0x43')]);var _0x348308={'where':_0x4fe276['where']};return db[_0x6bca('0x44')][_0x6bca('0x21')](_0x348308)[_0x6bca('0x27')](function(_0x2a5702){_0x5a9c01[_0x6bca('0x21')]=_0x2a5702;if(_0x132b44[_0x6bca('0x33')][_0x6bca('0x45')]){_0x4fe276[_0x6bca('0x46')]=[{'all':!![]}];}return db[_0x6bca('0x44')][_0x6bca('0x47')](_0x4fe276);})[_0x6bca('0x27')](function(_0x17870d){_0x5a9c01[_0x6bca('0x48')]=_0x17870d;return _0x5a9c01;})[_0x6bca('0x27')](respondWithFilteredResult(_0x3dad0f,_0x4fe276))['catch'](handleError(_0x3dad0f,null));};exports[_0x6bca('0x49')]=function(_0x2f6024,_0x4ca829){var _0x1d3a95={'raw':!![],'where':{'id':_0x2f6024[_0x6bca('0x4a')]['id']}},_0x39d167={};_0x39d167[_0x6bca('0x32')]=_[_0x6bca('0x34')](db[_0x6bca('0x44')][_0x6bca('0x4b')]);_0x39d167[_0x6bca('0x33')]=_['keys'](_0x2f6024[_0x6bca('0x33')]);_0x39d167[_0x6bca('0x35')]=_[_0x6bca('0x36')](_0x39d167[_0x6bca('0x32')],_0x39d167[_0x6bca('0x33')]);_0x1d3a95[_0x6bca('0x38')]=_[_0x6bca('0x36')](_0x39d167[_0x6bca('0x32')],qs[_0x6bca('0x37')](_0x2f6024[_0x6bca('0x33')]['fields']));_0x1d3a95[_0x6bca('0x38')]=_0x1d3a95[_0x6bca('0x38')][_0x6bca('0x39')]?_0x1d3a95[_0x6bca('0x38')]:_0x39d167[_0x6bca('0x32')];if(_0x2f6024[_0x6bca('0x33')][_0x6bca('0x45')]){_0x1d3a95[_0x6bca('0x46')]=[{'all':!![]}];}_0x1d3a95=_[_0x6bca('0x42')]({},_0x1d3a95,_0x2f6024[_0x6bca('0x43')]);return db[_0x6bca('0x44')][_0x6bca('0x4c')](_0x1d3a95)[_0x6bca('0x27')](handleEntityNotFound(_0x4ca829,null))[_0x6bca('0x27')](respondWithResult(_0x4ca829,null))['catch'](handleError(_0x4ca829,null));};exports[_0x6bca('0x4d')]=function(_0x26cd2f,_0x279701){return db[_0x6bca('0x44')][_0x6bca('0x4d')](_0x26cd2f[_0x6bca('0x4e')],{})['then'](respondWithResult(_0x279701,0xc9))[_0x6bca('0x4f')](handleError(_0x279701,null));};exports[_0x6bca('0x26')]=function(_0x37eaf3,_0xdc8070){if(_0x37eaf3[_0x6bca('0x4e')]['id']){delete _0x37eaf3[_0x6bca('0x4e')]['id'];}return db[_0x6bca('0x44')][_0x6bca('0x4c')]({'where':{'id':_0x37eaf3[_0x6bca('0x4a')]['id']}})[_0x6bca('0x27')](handleEntityNotFound(_0xdc8070,null))[_0x6bca('0x27')](saveUpdates(_0x37eaf3['body'],null))[_0x6bca('0x27')](respondWithResult(_0xdc8070,null))[_0x6bca('0x4f')](handleError(_0xdc8070,null));};exports[_0x6bca('0x28')]=function(_0x5a9abe,_0x3206f4){return db[_0x6bca('0x44')][_0x6bca('0x4c')]({'where':{'id':_0x5a9abe[_0x6bca('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3206f4,null))['then'](removeEntity(_0x3206f4,null))['catch'](handleError(_0x3206f4,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index d363e2e..e0ae9c5 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 _0xec3e=['idField','FieldId','lodash','request-promise','path','rimraf','../../config/environment','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index'];(function(_0x28e633,_0xe6024){var _0x4d714e=function(_0x4834bc){while(--_0x4834bc){_0x28e633['push'](_0x28e633['shift']());}};_0x4d714e(++_0xe6024);}(_0xec3e,0xaa));var _0xeec3=function(_0x33aae2,_0x11988d){_0x33aae2=_0x33aae2-0x0;var _0x18a391=_0xec3e[_0x33aae2];return _0x18a391;};'use strict';var _=require(_0xeec3('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xeec3('0x1'));var fs=require('fs');var path=require(_0xeec3('0x2'));var rimraf=require(_0xeec3('0x3'));var config=require(_0xeec3('0x4'));var attributes=require('./intDynamics365Field.attributes');module[_0xeec3('0x5')]=function(_0x520890,_0xdcf723){return _0x520890[_0xeec3('0x6')](_0xeec3('0x7'),attributes,{'tableName':_0xeec3('0x8'),'paranoid':![],'indexes':[{'name':_0xeec3('0x9'),'fields':[_0xeec3('0xa'),_0xeec3('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x784d=['api','moment','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util'];(function(_0xbd68cf,_0x33b0c1){var _0x1b1156=function(_0x755222){while(--_0x755222){_0xbd68cf['push'](_0xbd68cf['shift']());}};_0x1b1156(++_0x33b0c1);}(_0x784d,0x194));var _0xd784=function(_0x273b5d,_0x1c5bf8){_0x273b5d=_0x273b5d-0x0;var _0x345782=_0x784d[_0x273b5d];return _0x345782;};'use strict';var _=require(_0xd784('0x0'));var util=require(_0xd784('0x1'));var logger=require('../../config/logger')(_0xd784('0x2'));var moment=require(_0xd784('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd784('0x4'));var config=require(_0xd784('0x5'));var attributes=require(_0xd784('0x6'));module[_0xd784('0x7')]=function(_0x422f74,_0x482f9b){return _0x422f74[_0xd784('0x8')](_0xd784('0x9'),attributes,{'tableName':_0xd784('0xa'),'paranoid':![],'indexes':[{'name':_0xd784('0xb'),'fields':[_0xd784('0xc'),_0xd784('0xd')],'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 9ece501..cd773c2 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 _0x7758=['info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3ebbd2,_0x18293c){var _0x5cc1ba=function(_0x3ccace){while(--_0x3ccace){_0x3ebbd2['push'](_0x3ebbd2['shift']());}};_0x5cc1ba(++_0x18293c);}(_0x7758,0x1e9));var _0x8775=function(_0x3044f0,_0x5b4670){_0x3044f0=_0x3044f0-0x0;var _0x5e7c21=_0x7758[_0x3044f0];return _0x5e7c21;};'use strict';var _=require(_0x8775('0x0'));var util=require('util');var moment=require(_0x8775('0x1'));var BPromise=require(_0x8775('0x2'));var rs=require(_0x8775('0x3'));var fs=require('fs');var Redis=require(_0x8775('0x4'));var db=require(_0x8775('0x5'))['db'];var utils=require(_0x8775('0x6'));var logger=require(_0x8775('0x7'))(_0x8775('0x8'));var config=require(_0x8775('0x9'));var jayson=require(_0x8775('0xa'));var client=jayson[_0x8775('0xb')][_0x8775('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e7cdf,_0x5c5a4b,_0x5285e3){return new BPromise(function(_0x1fe59c,_0x3f757d){return client[_0x8775('0xd')](_0x2e7cdf,_0x5285e3)[_0x8775('0xe')](function(_0x37099b){logger[_0x8775('0xf')](_0x8775('0x10'),_0x5c5a4b,_0x8775('0x11'));logger[_0x8775('0x12')](_0x8775('0x13'),_0x5c5a4b,_0x8775('0x11'),JSON[_0x8775('0x14')](_0x37099b));if(_0x37099b[_0x8775('0x15')]){if(_0x37099b[_0x8775('0x15')]['code']===0x1f4){logger[_0x8775('0x15')]('Dynamics365Field,\x20%s,\x20%s',_0x5c5a4b,_0x37099b[_0x8775('0x15')][_0x8775('0x16')]);return _0x3f757d(_0x37099b[_0x8775('0x15')][_0x8775('0x16')]);}logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x5c5a4b,_0x37099b[_0x8775('0x15')]['message']);return _0x1fe59c(_0x37099b['error'][_0x8775('0x16')]);}else{logger[_0x8775('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x5c5a4b,_0x8775('0x11'));_0x1fe59c(_0x37099b['result'][_0x8775('0x16')]);}})[_0x8775('0x17')](function(_0x101743){logger[_0x8775('0x15')](_0x8775('0x10'),_0x5c5a4b,_0x101743);_0x3f757d(_0x101743);});});} \ No newline at end of file +var _0x3f90=['stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x17e99a,_0x1ecb68){var _0x4ed528=function(_0x3d4024){while(--_0x3d4024){_0x17e99a['push'](_0x17e99a['shift']());}};_0x4ed528(++_0x1ecb68);}(_0x3f90,0x83));var _0x03f9=function(_0x2ca8c7,_0x33f6ab){_0x2ca8c7=_0x2ca8c7-0x0;var _0x58ea74=_0x3f90[_0x2ca8c7];return _0x58ea74;};'use strict';var _=require(_0x03f9('0x0'));var util=require(_0x03f9('0x1'));var moment=require(_0x03f9('0x2'));var BPromise=require(_0x03f9('0x3'));var rs=require(_0x03f9('0x4'));var fs=require('fs');var Redis=require(_0x03f9('0x5'));var db=require(_0x03f9('0x6'))['db'];var utils=require(_0x03f9('0x7'));var logger=require(_0x03f9('0x8'))(_0x03f9('0x9'));var config=require('../../config/environment');var jayson=require(_0x03f9('0xa'));var client=jayson[_0x03f9('0xb')][_0x03f9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x35bc9c,_0x3b7a1c,_0x52df7b){return new BPromise(function(_0x40ba43,_0x21378e){return client[_0x03f9('0xd')](_0x35bc9c,_0x52df7b)[_0x03f9('0xe')](function(_0x313f30){logger[_0x03f9('0xf')](_0x03f9('0x10'),_0x3b7a1c,_0x03f9('0x11'));logger[_0x03f9('0x12')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x3b7a1c,_0x03f9('0x11'),JSON[_0x03f9('0x13')](_0x313f30));if(_0x313f30['error']){if(_0x313f30['error'][_0x03f9('0x14')]===0x1f4){logger[_0x03f9('0x15')]('Dynamics365Field,\x20%s,\x20%s',_0x3b7a1c,_0x313f30[_0x03f9('0x15')]['message']);return _0x21378e(_0x313f30[_0x03f9('0x15')][_0x03f9('0x16')]);}logger['error'](_0x03f9('0x10'),_0x3b7a1c,_0x313f30[_0x03f9('0x15')][_0x03f9('0x16')]);return _0x40ba43(_0x313f30[_0x03f9('0x15')][_0x03f9('0x16')]);}else{logger['info'](_0x03f9('0x10'),_0x3b7a1c,_0x03f9('0x11'));_0x40ba43(_0x313f30[_0x03f9('0x17')][_0x03f9('0x16')]);}})[_0x03f9('0x18')](function(_0x4888d1){logger[_0x03f9('0x15')](_0x03f9('0x10'),_0x3b7a1c,_0x4888d1);_0x21378e(_0x4888d1);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 166c171..286072a 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 _0x3b61=['/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','/:id'];(function(_0x3055a3,_0x5b79a6){var _0x3801ac=function(_0x2ce9fd){while(--_0x2ce9fd){_0x3055a3['push'](_0x3055a3['shift']());}};_0x3801ac(++_0x5b79a6);}(_0x3b61,0x1a3));var _0x13b6=function(_0x4491d9,_0x265573){_0x4491d9=_0x4491d9-0x0;var _0x582f25=_0x3b61[_0x4491d9];return _0x582f25;};'use strict';var multer=require(_0x13b6('0x0'));var util=require(_0x13b6('0x1'));var path=require('path');var timeout=require(_0x13b6('0x2'));var express=require(_0x13b6('0x3'));var router=express[_0x13b6('0x4')]();var fs_extra=require(_0x13b6('0x5'));var auth=require(_0x13b6('0x6'));var interaction=require(_0x13b6('0x7'));var config=require(_0x13b6('0x8'));var controller=require(_0x13b6('0x9'));router[_0x13b6('0xa')]('/',auth[_0x13b6('0xb')](),controller['index']);router[_0x13b6('0xa')](_0x13b6('0xc'),auth[_0x13b6('0xb')](),controller['show']);router['get'](_0x13b6('0xd'),auth[_0x13b6('0xb')](),controller[_0x13b6('0xe')]);router[_0x13b6('0xa')](_0x13b6('0xf'),auth[_0x13b6('0xb')](),controller[_0x13b6('0x10')]);router[_0x13b6('0x11')]('/',auth[_0x13b6('0xb')](),controller[_0x13b6('0x12')]);router[_0x13b6('0x11')](_0x13b6('0xd'),auth[_0x13b6('0xb')](),controller[_0x13b6('0x13')]);router[_0x13b6('0x14')]('/:id',auth[_0x13b6('0xb')](),controller[_0x13b6('0x15')]);router['delete'](_0x13b6('0xc'),auth['isAuthenticated'](),controller[_0x13b6('0x16')]);module[_0x13b6('0x17')]=router; \ No newline at end of file +var _0x2f9d=['addConfiguration','update','/:id','destroy','exports','util','path','express','Router','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations'];(function(_0x1217ba,_0x1d8bc9){var _0x5ee454=function(_0x51efa6){while(--_0x51efa6){_0x1217ba['push'](_0x1217ba['shift']());}};_0x5ee454(++_0x1d8bc9);}(_0x2f9d,0x140));var _0xd2f9=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x2f9d[_0x1abb09];return _0xea1c07;};'use strict';var multer=require('multer');var util=require(_0xd2f9('0x0'));var path=require(_0xd2f9('0x1'));var timeout=require('connect-timeout');var express=require(_0xd2f9('0x2'));var router=express[_0xd2f9('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd2f9('0x4'));var controller=require(_0xd2f9('0x5'));router['get']('/',auth[_0xd2f9('0x6')](),controller[_0xd2f9('0x7')]);router[_0xd2f9('0x8')]('/:id',auth[_0xd2f9('0x6')](),controller[_0xd2f9('0x9')]);router[_0xd2f9('0x8')]('/:id/configurations',auth[_0xd2f9('0x6')](),controller[_0xd2f9('0xa')]);router[_0xd2f9('0x8')](_0xd2f9('0xb'),auth[_0xd2f9('0x6')](),controller[_0xd2f9('0xc')]);router[_0xd2f9('0xd')]('/',auth[_0xd2f9('0x6')](),controller[_0xd2f9('0xe')]);router[_0xd2f9('0xd')](_0xd2f9('0xf'),auth['isAuthenticated'](),controller[_0xd2f9('0x10')]);router['put']('/:id',auth[_0xd2f9('0x6')](),controller[_0xd2f9('0x11')]);router['delete'](_0xd2f9('0x12'),auth['isAuthenticated'](),controller[_0xd2f9('0x13')]);module[_0xd2f9('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 8e8b63a..760fa74 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 _0x1a37=['sequelize','exports','STRING','username','remoteUri'];(function(_0xa87486,_0x5ff890){var _0x4fc6d5=function(_0x1c85c8){while(--_0x1c85c8){_0xa87486['push'](_0xa87486['shift']());}};_0x4fc6d5(++_0x5ff890);}(_0x1a37,0xb4));var _0x71a3=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0x1a37[_0x10004e];return _0x5af990;};'use strict';var Sequelize=require(_0x71a3('0x0'));module[_0x71a3('0x1')]={'name':{'type':Sequelize[_0x71a3('0x2')]},'description':{'type':Sequelize[_0x71a3('0x2')]},'username':{'type':Sequelize[_0x71a3('0x2')],'unique':_0x71a3('0x3')},'apiKey':{'type':Sequelize[_0x71a3('0x2')]},'remoteUri':{'type':Sequelize[_0x71a3('0x2')],'unique':_0x71a3('0x4')},'serverUrl':{'type':Sequelize[_0x71a3('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x1893=['STRING','username','remoteUri'];(function(_0x2dd390,_0x1bc894){var _0x3afe47=function(_0x42d8d3){while(--_0x42d8d3){_0x2dd390['push'](_0x2dd390['shift']());}};_0x3afe47(++_0x1bc894);}(_0x1893,0xa2));var _0x3189=function(_0x4c941f,_0x13e01d){_0x4c941f=_0x4c941f-0x0;var _0x59f360=_0x1893[_0x4c941f];return _0x59f360;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3189('0x0')]},'description':{'type':Sequelize[_0x3189('0x0')]},'username':{'type':Sequelize[_0x3189('0x0')],'unique':_0x3189('0x1')},'apiKey':{'type':Sequelize[_0x3189('0x0')]},'remoteUri':{'type':Sequelize[_0x3189('0x0')],'unique':_0x3189('0x2')},'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 3dc1212..dee2463 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 _0x1123=['VIRTUAL','options','count','includeAll','include','findAll','catch','show','intersection','body','update','find','params','getConfigurations','findOne','FreshdeskConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','create','FreshdeskField','getFields','remoteUri','apiKey','slice','lastIndexOf','format','api/v2/ticket_fields','Basic\x20%s','%s:X','base64','requester','agent','priority','group','source','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','query','keys','filters','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge'];(function(_0x2f04a4,_0x1be47e){var _0x5dde34=function(_0x2aac62){while(--_0x2aac62){_0x2f04a4['push'](_0x2f04a4['shift']());}};_0x5dde34(++_0x1be47e);}(_0x1123,0x118));var _0x3112=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x1123[_0x138adb];return _0x1b27f2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3112('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3112('0x1'));var moment=require(_0x3112('0x2'));var BPromise=require(_0x3112('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3112('0x4'));var sox=require(_0x3112('0x5'));var csv=require(_0x3112('0x6'));var ejs=require(_0x3112('0x7'));var fs=require('fs');var fs_extra=require(_0x3112('0x8'));var _=require(_0x3112('0x9'));var squel=require(_0x3112('0xa'));var crypto=require(_0x3112('0xb'));var jsforce=require(_0x3112('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3112('0x6'));var querystring=require(_0x3112('0xd'));var Papa=require(_0x3112('0xe'));var Redis=require(_0x3112('0xf'));var authService=require(_0x3112('0x10'));var qs=require(_0x3112('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3112('0x12'))(_0x3112('0x13'));var utils=require(_0x3112('0x14'));var config=require(_0x3112('0x15'));var licenseUtil=require(_0x3112('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x3112('0x17'));function respondWithStatusCode(_0x50a8a8,_0x5f2e90){_0x5f2e90=_0x5f2e90||0xcc;return function(_0x410b6d){if(_0x410b6d){return _0x50a8a8[_0x3112('0x18')](_0x5f2e90);}return _0x50a8a8[_0x3112('0x19')](_0x5f2e90)['end']();};}function respondWithResult(_0x48d238,_0x1d9f06){_0x1d9f06=_0x1d9f06||0xc8;return function(_0x5eeae7){if(_0x5eeae7){return _0x48d238[_0x3112('0x19')](_0x1d9f06)['json'](_0x5eeae7);}};}function respondWithFilteredResult(_0x56b594,_0x43a554){return function(_0x868e4b){if(_0x868e4b){var _0x5a6255=typeof _0x43a554[_0x3112('0x1a')]===_0x3112('0x1b')&&typeof _0x43a554['limit']==='undefined';var _0x3b2b44=_0x868e4b['count'];var _0x254ffc=_0x5a6255?0x0:_0x43a554[_0x3112('0x1a')];var _0x5e9262=_0x5a6255?_0x868e4b['count']:_0x43a554[_0x3112('0x1a')]+_0x43a554[_0x3112('0x1c')];var _0x901d10;if(_0x5e9262>=_0x3b2b44){_0x5e9262=_0x3b2b44;_0x901d10=0xc8;}else{_0x901d10=0xce;}_0x56b594[_0x3112('0x19')](_0x901d10);return _0x56b594[_0x3112('0x1d')](_0x3112('0x1e'),_0x254ffc+'-'+_0x5e9262+'/'+_0x3b2b44)['json'](_0x868e4b);}return null;};}function patchUpdates(_0x7fa729){return function(_0x4c61ba){try{jsonpatch[_0x3112('0x1f')](_0x4c61ba,_0x7fa729,!![]);}catch(_0x2f36ca){return BPromise[_0x3112('0x20')](_0x2f36ca);}return _0x4c61ba[_0x3112('0x21')]();};}function saveUpdates(_0x45ebd2,_0x4897b4){return function(_0x435227){if(_0x435227){return _0x435227['update'](_0x45ebd2)[_0x3112('0x22')](function(_0x4d5652){return _0x4d5652;});}return null;};}function removeEntity(_0x537e31,_0x31b3ac){return function(_0x48f464){if(_0x48f464){return _0x48f464[_0x3112('0x23')]()[_0x3112('0x22')](function(){_0x537e31[_0x3112('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32d8f4,_0x41233d){return function(_0xb5413b){if(!_0xb5413b){_0x32d8f4[_0x3112('0x18')](0x194);}return _0xb5413b;};}function handleError(_0x58b30f,_0x34ca6d){_0x34ca6d=_0x34ca6d||0x1f4;return function(_0x1a8d96){logger['error'](_0x1a8d96[_0x3112('0x24')]);if(_0x1a8d96['name']){delete _0x1a8d96[_0x3112('0x25')];}_0x58b30f[_0x3112('0x19')](_0x34ca6d)[_0x3112('0x26')](_0x1a8d96);};}exports[_0x3112('0x27')]=function(_0x20f457,_0x58e291){var _0x1d1e4a={},_0x5305c1={},_0x210364={'count':0x0,'rows':[]};var _0x53553c=_[_0x3112('0x28')](db[_0x3112('0x29')][_0x3112('0x2a')],function(_0xc56c20){return{'name':_0xc56c20[_0x3112('0x2b')],'type':_0xc56c20[_0x3112('0x2c')]['key']};});_0x5305c1['model']=_[_0x3112('0x28')](_0x53553c,_0x3112('0x25'));_0x5305c1[_0x3112('0x2d')]=_[_0x3112('0x2e')](_0x20f457[_0x3112('0x2d')]);_0x5305c1[_0x3112('0x2f')]=_['intersection'](_0x5305c1[_0x3112('0x30')],_0x5305c1[_0x3112('0x2d')]);_0x1d1e4a[_0x3112('0x31')]=_['intersection'](_0x5305c1['model'],qs[_0x3112('0x32')](_0x20f457[_0x3112('0x2d')][_0x3112('0x32')]));_0x1d1e4a['attributes']=_0x1d1e4a[_0x3112('0x31')][_0x3112('0x33')]?_0x1d1e4a[_0x3112('0x31')]:_0x5305c1['model'];if(!_0x20f457[_0x3112('0x2d')][_0x3112('0x34')]('nolimit')){_0x1d1e4a['limit']=qs[_0x3112('0x1c')](_0x20f457[_0x3112('0x2d')][_0x3112('0x1c')]);_0x1d1e4a['offset']=qs[_0x3112('0x1a')](_0x20f457[_0x3112('0x2d')][_0x3112('0x1a')]);}_0x1d1e4a[_0x3112('0x35')]=qs[_0x3112('0x36')](_0x20f457[_0x3112('0x2d')][_0x3112('0x36')]);_0x1d1e4a[_0x3112('0x37')]=qs[_0x3112('0x2f')](_[_0x3112('0x38')](_0x20f457[_0x3112('0x2d')],_0x5305c1[_0x3112('0x2f')]),_0x53553c);if(_0x20f457['query'][_0x3112('0x39')]){_0x1d1e4a[_0x3112('0x37')]=_[_0x3112('0x3a')](_0x1d1e4a['where'],{'$or':_[_0x3112('0x28')](_0x53553c,function(_0x50d592){if(_0x50d592[_0x3112('0x2c')]!==_0x3112('0x3b')){var _0xd1212d={};_0xd1212d[_0x50d592[_0x3112('0x25')]]={'$like':'%'+_0x20f457['query'][_0x3112('0x39')]+'%'};return _0xd1212d;}})});}_0x1d1e4a=_['merge']({},_0x1d1e4a,_0x20f457[_0x3112('0x3c')]);var _0x223e10={'where':_0x1d1e4a[_0x3112('0x37')]};return db['FreshdeskAccount'][_0x3112('0x3d')](_0x223e10)[_0x3112('0x22')](function(_0x86e0e3){_0x210364['count']=_0x86e0e3;if(_0x20f457[_0x3112('0x2d')][_0x3112('0x3e')]){_0x1d1e4a[_0x3112('0x3f')]=[{'all':!![]}];}return db[_0x3112('0x29')][_0x3112('0x40')](_0x1d1e4a);})[_0x3112('0x22')](function(_0x208236){_0x210364['rows']=_0x208236;return _0x210364;})[_0x3112('0x22')](respondWithFilteredResult(_0x58e291,_0x1d1e4a))[_0x3112('0x41')](handleError(_0x58e291,null));};exports[_0x3112('0x42')]=function(_0x31f64e,_0x3b3950){var _0x83d160={'raw':![],'where':{'id':_0x31f64e['params']['id']}},_0x4bad75={};_0x4bad75[_0x3112('0x30')]=_[_0x3112('0x2e')](db[_0x3112('0x29')][_0x3112('0x2a')]);_0x4bad75[_0x3112('0x2d')]=_[_0x3112('0x2e')](_0x31f64e['query']);_0x4bad75[_0x3112('0x2f')]=_[_0x3112('0x43')](_0x4bad75[_0x3112('0x30')],_0x4bad75[_0x3112('0x2d')]);_0x83d160[_0x3112('0x31')]=_[_0x3112('0x43')](_0x4bad75[_0x3112('0x30')],qs[_0x3112('0x32')](_0x31f64e['query'][_0x3112('0x32')]));_0x83d160[_0x3112('0x31')]=_0x83d160['attributes'][_0x3112('0x33')]?_0x83d160['attributes']:_0x4bad75[_0x3112('0x30')];if(_0x31f64e['query']['includeAll']){_0x83d160[_0x3112('0x3f')]=[{'all':!![]}];}_0x83d160=_['merge']({},_0x83d160,_0x31f64e[_0x3112('0x3c')]);return db[_0x3112('0x29')]['find'](_0x83d160)[_0x3112('0x22')](handleEntityNotFound(_0x3b3950,null))[_0x3112('0x22')](respondWithResult(_0x3b3950,null))['catch'](handleError(_0x3b3950,null));};exports['create']=function(_0x3c6cd2,_0x5cd27d){return db[_0x3112('0x29')]['create'](_0x3c6cd2[_0x3112('0x44')],{})[_0x3112('0x22')](respondWithResult(_0x5cd27d,0xc9))['catch'](handleError(_0x5cd27d,null));};exports[_0x3112('0x45')]=function(_0x5f1305,_0x2f8d76){if(_0x5f1305[_0x3112('0x44')]['id']){delete _0x5f1305[_0x3112('0x44')]['id'];}return db[_0x3112('0x29')]['find']({'where':{'id':_0x5f1305['params']['id']}})[_0x3112('0x22')](handleEntityNotFound(_0x2f8d76,null))[_0x3112('0x22')](saveUpdates(_0x5f1305[_0x3112('0x44')],null))['then'](respondWithResult(_0x2f8d76,null))[_0x3112('0x41')](handleError(_0x2f8d76,null));};exports[_0x3112('0x23')]=function(_0x12279e,_0x1f6afc){return db['FreshdeskAccount'][_0x3112('0x46')]({'where':{'id':_0x12279e[_0x3112('0x47')]['id']}})[_0x3112('0x22')](handleEntityNotFound(_0x1f6afc,null))[_0x3112('0x22')](removeEntity(_0x1f6afc,null))[_0x3112('0x41')](handleError(_0x1f6afc,null));};exports[_0x3112('0x48')]=function(_0x259378,_0x375837,_0x58f82c){var _0x2cc682={};var _0x1dcad2={};var _0x4e67c2;var _0x1ddb22;return db[_0x3112('0x29')][_0x3112('0x49')]({'where':{'id':_0x259378[_0x3112('0x47')]['id']}})['then'](handleEntityNotFound(_0x375837,null))['then'](function(_0x450853){if(_0x450853){_0x4e67c2=_0x450853;_0x1dcad2[_0x3112('0x30')]=_[_0x3112('0x2e')](db[_0x3112('0x4a')][_0x3112('0x2a')]);_0x1dcad2['query']=_[_0x3112('0x2e')](_0x259378[_0x3112('0x2d')]);_0x1dcad2[_0x3112('0x2f')]=_[_0x3112('0x43')](_0x1dcad2[_0x3112('0x30')],_0x1dcad2[_0x3112('0x2d')]);_0x2cc682['attributes']=_['intersection'](_0x1dcad2[_0x3112('0x30')],qs[_0x3112('0x32')](_0x259378[_0x3112('0x2d')][_0x3112('0x32')]));_0x2cc682['attributes']=_0x2cc682[_0x3112('0x31')][_0x3112('0x33')]?_0x2cc682[_0x3112('0x31')]:_0x1dcad2['model'];_0x2cc682['order']=qs[_0x3112('0x36')](_0x259378['query'][_0x3112('0x36')]);_0x2cc682['where']=qs[_0x3112('0x2f')](_[_0x3112('0x38')](_0x259378['query'],_0x1dcad2[_0x3112('0x2f')]));if(_0x259378[_0x3112('0x2d')][_0x3112('0x39')]){_0x2cc682['where']=_['merge'](_0x2cc682[_0x3112('0x37')],{'$or':_['map'](_0x2cc682[_0x3112('0x31')],function(_0x3498ac){var _0x1c1a4a={};_0x1c1a4a[_0x3498ac]={'$like':'%'+_0x259378['query'][_0x3112('0x39')]+'%'};return _0x1c1a4a;})});}_0x2cc682=_[_0x3112('0x3a')]({},_0x2cc682,_0x259378[_0x3112('0x3c')]);return _0x4e67c2['getConfigurations'](_0x2cc682);}})[_0x3112('0x22')](function(_0x2716f1){if(_0x2716f1){_0x1ddb22=_0x2716f1[_0x3112('0x33')];if(!_0x259378['query'][_0x3112('0x34')](_0x3112('0x4b'))){_0x2cc682[_0x3112('0x1c')]=qs[_0x3112('0x1c')](_0x259378[_0x3112('0x2d')][_0x3112('0x1c')]);_0x2cc682[_0x3112('0x1a')]=qs[_0x3112('0x1a')](_0x259378[_0x3112('0x2d')][_0x3112('0x1a')]);}return _0x4e67c2['getConfigurations'](_0x2cc682);}})[_0x3112('0x22')](function(_0x3e25a4){if(_0x3e25a4){return _0x3e25a4?{'count':_0x1ddb22,'rows':_0x3e25a4}:null;}})[_0x3112('0x22')](respondWithResult(_0x375837,null))[_0x3112('0x41')](handleError(_0x375837,null));};exports[_0x3112('0x4c')]=function(_0x4b413e,_0x277f23,_0x521608){if(_0x4b413e['body']['id']){delete _0x4b413e[_0x3112('0x44')]['id'];}return db[_0x3112('0x29')][_0x3112('0x49')]({'where':{'id':_0x4b413e[_0x3112('0x47')]['id']}})[_0x3112('0x22')](handleEntityNotFound(_0x277f23,null))[_0x3112('0x22')](function(_0x523e5c){if(_0x523e5c){_0x4b413e[_0x3112('0x44')][_0x3112('0x4d')]=_0x523e5c['id'];_0x4b413e[_0x3112('0x44')][_0x3112('0x4e')]=integrations[_0x3112('0x4f')](_0x4b413e[_0x3112('0x44')][_0x3112('0x50')],_0x4b413e['body'][_0x3112('0x2c')]);_0x4b413e[_0x3112('0x44')][_0x3112('0x51')]=integrations[_0x3112('0x52')](_0x4b413e[_0x3112('0x44')]['channel'],_0x4b413e[_0x3112('0x44')][_0x3112('0x2c')]);return db['FreshdeskConfiguration'][_0x3112('0x53')](_0x4b413e[_0x3112('0x44')],{'include':[{'model':db[_0x3112('0x54')],'as':_0x3112('0x4e')},{'model':db[_0x3112('0x54')],'as':_0x3112('0x51')}]});}return null;})['then'](respondWithResult(_0x277f23,null))[_0x3112('0x41')](handleError(_0x277f23,null));};exports[_0x3112('0x55')]=function(_0x12fb73,_0x4d99a1,_0x6a60d2){var _0x104f47='';return db[_0x3112('0x29')]['findOne']({'where':{'id':_0x12fb73[_0x3112('0x47')]['id']},'attributes':['id',_0x3112('0x56'),_0x3112('0x57')]})[_0x3112('0x22')](handleEntityNotFound(_0x4d99a1,null))[_0x3112('0x22')](function(_0x4a40ef){if(_0x4a40ef){_0x104f47=_0x4a40ef[_0x3112('0x56')];var _0x5037b6=_0x104f47[_0x3112('0x58')](-0x1);if(_0x5037b6==='/'){_0x104f47=_0x104f47['substring'](0x0,_0x104f47[_0x3112('0x59')](_0x5037b6));}return rp({'method':'GET','uri':util[_0x3112('0x5a')]('%s/%s',_0x104f47,_0x3112('0x5b')),'headers':{'Authorization':util['format'](_0x3112('0x5c'),new Buffer(util[_0x3112('0x5a')](_0x3112('0x5d'),_0x4a40ef[_0x3112('0x57')]))['toString'](_0x3112('0x5e')))},'json':!![]});}})[_0x3112('0x22')](function(_0x5abb45){if(_0x5abb45){var _0x1e36c8=[_0x3112('0x5f'),'subject',_0x3112('0x60'),'description',_0x3112('0x19'),_0x3112('0x61'),_0x3112('0x62'),_0x3112('0x63'),'ticket_type','group','company'];_['remove'](_0x5abb45,function(_0x3d1e19){return _0x1e36c8[_0x3112('0x64')](_0x3d1e19[_0x3112('0x25')])||!_0x3d1e19[_0x3112('0x65')]&&_0x3d1e19[_0x3112('0x2c')]!==_0x3112('0x66')&&_0x3d1e19[_0x3112('0x2c')]!==_0x3112('0x67');});return{'count':_0x5abb45['length'],'rows':_[_0x3112('0x28')](_0x5abb45,function(_0x5107ec){return{'id':_0x5107ec[_0x3112('0x25')],'name':_0x5107ec[_0x3112('0x68')],'custom':!_0x5107ec['default'],'options':_0x5107ec[_0x3112('0x69')]?_[_0x3112('0x28')](_0x5107ec[_0x3112('0x69')],function(_0x2aca76){return{'name':_[_0x3112('0x6a')](_0x2aca76),'value':_0x2aca76};}):[]};})};}})[_0x3112('0x22')](respondWithResult(_0x4d99a1,null))[_0x3112('0x41')](function(_0x175d73){var _0x4dfa60=_0x12fb73[_0x3112('0x2d')][_0x3112('0x6b')]?0x1f4:_0x175d73[_0x3112('0x6c')]||0x1f4;logger[_0x3112('0x6d')](_0x3112('0x6e'),'getFields',_0x4dfa60,JSON[_0x3112('0x6f')](_0x175d73));delete _0x175d73[_0x3112('0x25')];if(_0x4dfa60===0x191){_0x4dfa60=0x190;}_0x4d99a1[_0x3112('0x19')](_0x4dfa60)[_0x3112('0x26')](_0x12fb73[_0x3112('0x2d')][_0x3112('0x6b')]?{'message':_0x3112('0x70'),'statusCode':_0x175d73[_0x3112('0x6c')]}:_0x175d73);});}; \ No newline at end of file +var _0xfb71=['where','pick','filters','type','VIRTUAL','filter','merge','options','include','rows','catch','show','params','rawAttributes','includeAll','create','body','find','getConfigurations','findOne','FreshdeskConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','FreshdeskField','getFields','substring','lastIndexOf','GET','format','Basic\x20%s','%s:X','toString','base64','requester','agent','priority','group','source','ticket_type','company','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','json','offset','undefined','limit','count','apply','update','then','destroy','sendStatus','error','stack','name','send','index','map','FreshdeskAccount','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xfb71,0x1ef));var _0x1fb7=function(_0x261435,_0x5540df){_0x261435=_0x261435-0x0;var _0x47f31a=_0xfb71[_0x261435];return _0x47f31a;};'use strict';var emlformat=require(_0x1fb7('0x0'));var rimraf=require(_0x1fb7('0x1'));var zipdir=require(_0x1fb7('0x2'));var jsonpatch=require(_0x1fb7('0x3'));var rp=require(_0x1fb7('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1fb7('0x5'));var util=require(_0x1fb7('0x6'));var path=require(_0x1fb7('0x7'));var sox=require('sox');var csv=require(_0x1fb7('0x8'));var ejs=require(_0x1fb7('0x9'));var fs=require('fs');var fs_extra=require(_0x1fb7('0xa'));var _=require(_0x1fb7('0xb'));var squel=require(_0x1fb7('0xc'));var crypto=require(_0x1fb7('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1fb7('0xe'));var toCsv=require(_0x1fb7('0x8'));var querystring=require('querystring');var Papa=require(_0x1fb7('0xf'));var Redis=require(_0x1fb7('0x10'));var authService=require(_0x1fb7('0x11'));var qs=require(_0x1fb7('0x12'));var as=require(_0x1fb7('0x13'));var hardwareService=require(_0x1fb7('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1fb7('0x15'));var config=require(_0x1fb7('0x16'));var licenseUtil=require(_0x1fb7('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x1fb7('0x18'));function respondWithStatusCode(_0x195eb2,_0x3cc07d){_0x3cc07d=_0x3cc07d||0xcc;return function(_0x52ce28){if(_0x52ce28){return _0x195eb2['sendStatus'](_0x3cc07d);}return _0x195eb2[_0x1fb7('0x19')](_0x3cc07d)['end']();};}function respondWithResult(_0x5117a1,_0x1b333b){_0x1b333b=_0x1b333b||0xc8;return function(_0x5ae7bf){if(_0x5ae7bf){return _0x5117a1[_0x1fb7('0x19')](_0x1b333b)[_0x1fb7('0x1a')](_0x5ae7bf);}};}function respondWithFilteredResult(_0x3245cf,_0x5a010a){return function(_0xf4c50f){if(_0xf4c50f){var _0x7bb15c=typeof _0x5a010a[_0x1fb7('0x1b')]===_0x1fb7('0x1c')&&typeof _0x5a010a[_0x1fb7('0x1d')]==='undefined';var _0x228697=_0xf4c50f[_0x1fb7('0x1e')];var _0x43b878=_0x7bb15c?0x0:_0x5a010a['offset'];var _0x5015b3=_0x7bb15c?_0xf4c50f[_0x1fb7('0x1e')]:_0x5a010a[_0x1fb7('0x1b')]+_0x5a010a[_0x1fb7('0x1d')];var _0x469297;if(_0x5015b3>=_0x228697){_0x5015b3=_0x228697;_0x469297=0xc8;}else{_0x469297=0xce;}_0x3245cf[_0x1fb7('0x19')](_0x469297);return _0x3245cf['set']('Content-Range',_0x43b878+'-'+_0x5015b3+'/'+_0x228697)[_0x1fb7('0x1a')](_0xf4c50f);}return null;};}function patchUpdates(_0x28ad2b){return function(_0x4e8a2a){try{jsonpatch[_0x1fb7('0x1f')](_0x4e8a2a,_0x28ad2b,!![]);}catch(_0x3c0e85){return BPromise['reject'](_0x3c0e85);}return _0x4e8a2a['save']();};}function saveUpdates(_0x3c47be,_0x294e2b){return function(_0x26d94f){if(_0x26d94f){return _0x26d94f[_0x1fb7('0x20')](_0x3c47be)[_0x1fb7('0x21')](function(_0xf41888){return _0xf41888;});}return null;};}function removeEntity(_0x350384,_0x525149){return function(_0x3da6af){if(_0x3da6af){return _0x3da6af[_0x1fb7('0x22')]()['then'](function(){_0x350384[_0x1fb7('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4eee37,_0xe7d132){return function(_0x27b957){if(!_0x27b957){_0x4eee37[_0x1fb7('0x23')](0x194);}return _0x27b957;};}function handleError(_0x5c1800,_0x3695b6){_0x3695b6=_0x3695b6||0x1f4;return function(_0x1f9bbd){logger[_0x1fb7('0x24')](_0x1f9bbd[_0x1fb7('0x25')]);if(_0x1f9bbd[_0x1fb7('0x26')]){delete _0x1f9bbd[_0x1fb7('0x26')];}_0x5c1800[_0x1fb7('0x19')](_0x3695b6)[_0x1fb7('0x27')](_0x1f9bbd);};}exports[_0x1fb7('0x28')]=function(_0x24c1d2,_0x57bba8){var _0x1513ef={},_0x343f9c={},_0x42d3ca={'count':0x0,'rows':[]};var _0x35a6c4=_[_0x1fb7('0x29')](db[_0x1fb7('0x2a')]['rawAttributes'],function(_0x1eb571){return{'name':_0x1eb571['fieldName'],'type':_0x1eb571['type'][_0x1fb7('0x2b')]};});_0x343f9c[_0x1fb7('0x2c')]=_[_0x1fb7('0x29')](_0x35a6c4,_0x1fb7('0x26'));_0x343f9c['query']=_[_0x1fb7('0x2d')](_0x24c1d2[_0x1fb7('0x2e')]);_0x343f9c['filters']=_[_0x1fb7('0x2f')](_0x343f9c[_0x1fb7('0x2c')],_0x343f9c[_0x1fb7('0x2e')]);_0x1513ef[_0x1fb7('0x30')]=_['intersection'](_0x343f9c[_0x1fb7('0x2c')],qs[_0x1fb7('0x31')](_0x24c1d2[_0x1fb7('0x2e')][_0x1fb7('0x31')]));_0x1513ef[_0x1fb7('0x30')]=_0x1513ef[_0x1fb7('0x30')][_0x1fb7('0x32')]?_0x1513ef[_0x1fb7('0x30')]:_0x343f9c['model'];if(!_0x24c1d2['query'][_0x1fb7('0x33')](_0x1fb7('0x34'))){_0x1513ef[_0x1fb7('0x1d')]=qs[_0x1fb7('0x1d')](_0x24c1d2[_0x1fb7('0x2e')][_0x1fb7('0x1d')]);_0x1513ef[_0x1fb7('0x1b')]=qs[_0x1fb7('0x1b')](_0x24c1d2[_0x1fb7('0x2e')][_0x1fb7('0x1b')]);}_0x1513ef[_0x1fb7('0x35')]=qs[_0x1fb7('0x36')](_0x24c1d2[_0x1fb7('0x2e')][_0x1fb7('0x36')]);_0x1513ef[_0x1fb7('0x37')]=qs['filters'](_[_0x1fb7('0x38')](_0x24c1d2[_0x1fb7('0x2e')],_0x343f9c[_0x1fb7('0x39')]),_0x35a6c4);if(_0x24c1d2[_0x1fb7('0x2e')]['filter']){_0x1513ef[_0x1fb7('0x37')]=_['merge'](_0x1513ef[_0x1fb7('0x37')],{'$or':_[_0x1fb7('0x29')](_0x35a6c4,function(_0x53fa16){if(_0x53fa16[_0x1fb7('0x3a')]!==_0x1fb7('0x3b')){var _0x45005b={};_0x45005b[_0x53fa16[_0x1fb7('0x26')]]={'$like':'%'+_0x24c1d2[_0x1fb7('0x2e')][_0x1fb7('0x3c')]+'%'};return _0x45005b;}})});}_0x1513ef=_[_0x1fb7('0x3d')]({},_0x1513ef,_0x24c1d2[_0x1fb7('0x3e')]);var _0x38533a={'where':_0x1513ef[_0x1fb7('0x37')]};return db[_0x1fb7('0x2a')][_0x1fb7('0x1e')](_0x38533a)[_0x1fb7('0x21')](function(_0xf2cb8d){_0x42d3ca[_0x1fb7('0x1e')]=_0xf2cb8d;if(_0x24c1d2[_0x1fb7('0x2e')]['includeAll']){_0x1513ef[_0x1fb7('0x3f')]=[{'all':!![]}];}return db[_0x1fb7('0x2a')]['findAll'](_0x1513ef);})['then'](function(_0x425f8c){_0x42d3ca[_0x1fb7('0x40')]=_0x425f8c;return _0x42d3ca;})['then'](respondWithFilteredResult(_0x57bba8,_0x1513ef))[_0x1fb7('0x41')](handleError(_0x57bba8,null));};exports[_0x1fb7('0x42')]=function(_0x272f57,_0x5ac262){var _0x31580b={'raw':![],'where':{'id':_0x272f57[_0x1fb7('0x43')]['id']}},_0x220dd7={};_0x220dd7[_0x1fb7('0x2c')]=_[_0x1fb7('0x2d')](db[_0x1fb7('0x2a')][_0x1fb7('0x44')]);_0x220dd7[_0x1fb7('0x2e')]=_[_0x1fb7('0x2d')](_0x272f57['query']);_0x220dd7[_0x1fb7('0x39')]=_[_0x1fb7('0x2f')](_0x220dd7[_0x1fb7('0x2c')],_0x220dd7[_0x1fb7('0x2e')]);_0x31580b['attributes']=_[_0x1fb7('0x2f')](_0x220dd7[_0x1fb7('0x2c')],qs[_0x1fb7('0x31')](_0x272f57[_0x1fb7('0x2e')][_0x1fb7('0x31')]));_0x31580b[_0x1fb7('0x30')]=_0x31580b[_0x1fb7('0x30')][_0x1fb7('0x32')]?_0x31580b['attributes']:_0x220dd7[_0x1fb7('0x2c')];if(_0x272f57[_0x1fb7('0x2e')][_0x1fb7('0x45')]){_0x31580b[_0x1fb7('0x3f')]=[{'all':!![]}];}_0x31580b=_[_0x1fb7('0x3d')]({},_0x31580b,_0x272f57[_0x1fb7('0x3e')]);return db[_0x1fb7('0x2a')]['find'](_0x31580b)[_0x1fb7('0x21')](handleEntityNotFound(_0x5ac262,null))[_0x1fb7('0x21')](respondWithResult(_0x5ac262,null))['catch'](handleError(_0x5ac262,null));};exports[_0x1fb7('0x46')]=function(_0xe03b2e,_0x4da3e1){return db['FreshdeskAccount']['create'](_0xe03b2e[_0x1fb7('0x47')],{})[_0x1fb7('0x21')](respondWithResult(_0x4da3e1,0xc9))['catch'](handleError(_0x4da3e1,null));};exports[_0x1fb7('0x20')]=function(_0x3f758e,_0x2ef5a3){if(_0x3f758e[_0x1fb7('0x47')]['id']){delete _0x3f758e[_0x1fb7('0x47')]['id'];}return db[_0x1fb7('0x2a')][_0x1fb7('0x48')]({'where':{'id':_0x3f758e[_0x1fb7('0x43')]['id']}})[_0x1fb7('0x21')](handleEntityNotFound(_0x2ef5a3,null))[_0x1fb7('0x21')](saveUpdates(_0x3f758e['body'],null))[_0x1fb7('0x21')](respondWithResult(_0x2ef5a3,null))['catch'](handleError(_0x2ef5a3,null));};exports['destroy']=function(_0x14a469,_0x4b1ba3){return db[_0x1fb7('0x2a')]['find']({'where':{'id':_0x14a469[_0x1fb7('0x43')]['id']}})[_0x1fb7('0x21')](handleEntityNotFound(_0x4b1ba3,null))[_0x1fb7('0x21')](removeEntity(_0x4b1ba3,null))['catch'](handleError(_0x4b1ba3,null));};exports[_0x1fb7('0x49')]=function(_0x2fb723,_0x5a3522,_0x5bdecc){var _0x19fc85={};var _0x4db4fe={};var _0x582c1f;var _0x9c5766;return db[_0x1fb7('0x2a')][_0x1fb7('0x4a')]({'where':{'id':_0x2fb723[_0x1fb7('0x43')]['id']}})[_0x1fb7('0x21')](handleEntityNotFound(_0x5a3522,null))[_0x1fb7('0x21')](function(_0x2df453){if(_0x2df453){_0x582c1f=_0x2df453;_0x4db4fe['model']=_[_0x1fb7('0x2d')](db[_0x1fb7('0x4b')][_0x1fb7('0x44')]);_0x4db4fe[_0x1fb7('0x2e')]=_[_0x1fb7('0x2d')](_0x2fb723[_0x1fb7('0x2e')]);_0x4db4fe[_0x1fb7('0x39')]=_['intersection'](_0x4db4fe[_0x1fb7('0x2c')],_0x4db4fe[_0x1fb7('0x2e')]);_0x19fc85['attributes']=_['intersection'](_0x4db4fe[_0x1fb7('0x2c')],qs[_0x1fb7('0x31')](_0x2fb723[_0x1fb7('0x2e')][_0x1fb7('0x31')]));_0x19fc85[_0x1fb7('0x30')]=_0x19fc85[_0x1fb7('0x30')][_0x1fb7('0x32')]?_0x19fc85[_0x1fb7('0x30')]:_0x4db4fe['model'];_0x19fc85[_0x1fb7('0x35')]=qs[_0x1fb7('0x36')](_0x2fb723['query'][_0x1fb7('0x36')]);_0x19fc85[_0x1fb7('0x37')]=qs[_0x1fb7('0x39')](_[_0x1fb7('0x38')](_0x2fb723[_0x1fb7('0x2e')],_0x4db4fe['filters']));if(_0x2fb723[_0x1fb7('0x2e')][_0x1fb7('0x3c')]){_0x19fc85[_0x1fb7('0x37')]=_[_0x1fb7('0x3d')](_0x19fc85[_0x1fb7('0x37')],{'$or':_[_0x1fb7('0x29')](_0x19fc85[_0x1fb7('0x30')],function(_0x58c593){var _0xfb2d94={};_0xfb2d94[_0x58c593]={'$like':'%'+_0x2fb723['query'][_0x1fb7('0x3c')]+'%'};return _0xfb2d94;})});}_0x19fc85=_[_0x1fb7('0x3d')]({},_0x19fc85,_0x2fb723[_0x1fb7('0x3e')]);return _0x582c1f[_0x1fb7('0x49')](_0x19fc85);}})[_0x1fb7('0x21')](function(_0x426fdf){if(_0x426fdf){_0x9c5766=_0x426fdf[_0x1fb7('0x32')];if(!_0x2fb723['query'][_0x1fb7('0x33')](_0x1fb7('0x34'))){_0x19fc85[_0x1fb7('0x1d')]=qs[_0x1fb7('0x1d')](_0x2fb723[_0x1fb7('0x2e')][_0x1fb7('0x1d')]);_0x19fc85[_0x1fb7('0x1b')]=qs[_0x1fb7('0x1b')](_0x2fb723[_0x1fb7('0x2e')][_0x1fb7('0x1b')]);}return _0x582c1f[_0x1fb7('0x49')](_0x19fc85);}})['then'](function(_0x59f599){if(_0x59f599){return _0x59f599?{'count':_0x9c5766,'rows':_0x59f599}:null;}})[_0x1fb7('0x21')](respondWithResult(_0x5a3522,null))['catch'](handleError(_0x5a3522,null));};exports['addConfiguration']=function(_0xaf2b6d,_0x11c210,_0x845d93){if(_0xaf2b6d[_0x1fb7('0x47')]['id']){delete _0xaf2b6d[_0x1fb7('0x47')]['id'];}return db['FreshdeskAccount'][_0x1fb7('0x4a')]({'where':{'id':_0xaf2b6d[_0x1fb7('0x43')]['id']}})[_0x1fb7('0x21')](handleEntityNotFound(_0x11c210,null))[_0x1fb7('0x21')](function(_0xb0cf69){if(_0xb0cf69){_0xaf2b6d[_0x1fb7('0x47')][_0x1fb7('0x4c')]=_0xb0cf69['id'];_0xaf2b6d[_0x1fb7('0x47')][_0x1fb7('0x4d')]=integrations['getSubjects'](_0xaf2b6d[_0x1fb7('0x47')]['channel'],_0xaf2b6d[_0x1fb7('0x47')]['type']);_0xaf2b6d['body'][_0x1fb7('0x4e')]=integrations[_0x1fb7('0x4f')](_0xaf2b6d['body'][_0x1fb7('0x50')],_0xaf2b6d['body'][_0x1fb7('0x3a')]);return db[_0x1fb7('0x4b')][_0x1fb7('0x46')](_0xaf2b6d[_0x1fb7('0x47')],{'include':[{'model':db[_0x1fb7('0x51')],'as':_0x1fb7('0x4d')},{'model':db[_0x1fb7('0x51')],'as':'Descriptions'}]});}return null;})[_0x1fb7('0x21')](respondWithResult(_0x11c210,null))['catch'](handleError(_0x11c210,null));};exports[_0x1fb7('0x52')]=function(_0x57e9c,_0xc760ee,_0x46b055){var _0x22d425='';return db[_0x1fb7('0x2a')][_0x1fb7('0x4a')]({'where':{'id':_0x57e9c['params']['id']},'attributes':['id','remoteUri','apiKey']})[_0x1fb7('0x21')](handleEntityNotFound(_0xc760ee,null))[_0x1fb7('0x21')](function(_0x1ccf4d){if(_0x1ccf4d){_0x22d425=_0x1ccf4d['remoteUri'];var _0x870a34=_0x22d425['slice'](-0x1);if(_0x870a34==='/'){_0x22d425=_0x22d425[_0x1fb7('0x53')](0x0,_0x22d425[_0x1fb7('0x54')](_0x870a34));}return rp({'method':_0x1fb7('0x55'),'uri':util['format']('%s/%s',_0x22d425,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x1fb7('0x56')](_0x1fb7('0x57'),new Buffer(util[_0x1fb7('0x56')](_0x1fb7('0x58'),_0x1ccf4d['apiKey']))[_0x1fb7('0x59')](_0x1fb7('0x5a')))},'json':!![]});}})[_0x1fb7('0x21')](function(_0x4daf9a){if(_0x4daf9a){var _0x1086b3=[_0x1fb7('0x5b'),'subject',_0x1fb7('0x5c'),'description',_0x1fb7('0x19'),_0x1fb7('0x5d'),_0x1fb7('0x5e'),_0x1fb7('0x5f'),_0x1fb7('0x60'),_0x1fb7('0x5e'),_0x1fb7('0x61')];_['remove'](_0x4daf9a,function(_0x209b5b){return _0x1086b3[_0x1fb7('0x62')](_0x209b5b[_0x1fb7('0x26')])||!_0x209b5b[_0x1fb7('0x63')]&&_0x209b5b[_0x1fb7('0x3a')]!==_0x1fb7('0x64')&&_0x209b5b[_0x1fb7('0x3a')]!==_0x1fb7('0x65');});return{'count':_0x4daf9a[_0x1fb7('0x32')],'rows':_[_0x1fb7('0x29')](_0x4daf9a,function(_0x3f7f31){return{'id':_0x3f7f31['name'],'name':_0x3f7f31[_0x1fb7('0x66')],'custom':!_0x3f7f31[_0x1fb7('0x63')],'options':_0x3f7f31[_0x1fb7('0x67')]?_['map'](_0x3f7f31[_0x1fb7('0x67')],function(_0x4ffaff){return{'name':_[_0x1fb7('0x68')](_0x4ffaff),'value':_0x4ffaff};}):[]};})};}})[_0x1fb7('0x21')](respondWithResult(_0xc760ee,null))[_0x1fb7('0x41')](function(_0x30d46c){var _0x3985d0=_0x57e9c[_0x1fb7('0x2e')][_0x1fb7('0x69')]?0x1f4:_0x30d46c[_0x1fb7('0x6a')]||0x1f4;logger[_0x1fb7('0x24')](_0x1fb7('0x6b'),_0x1fb7('0x52'),_0x3985d0,JSON[_0x1fb7('0x6c')](_0x30d46c));delete _0x30d46c['name'];if(_0x3985d0===0x191){_0x3985d0=0x190;}_0xc760ee['status'](_0x3985d0)[_0x1fb7('0x27')](_0x57e9c[_0x1fb7('0x2e')][_0x1fb7('0x69')]?{'message':_0x1fb7('0x6d'),'statusCode':_0x30d46c[_0x1fb7('0x6a')]}:_0x30d46c);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 26b1080..a93873b 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 _0x30cf=['FreshdeskAccount','int_freshdesk_accounts','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x59ee75,_0x304dce){var _0x6b387f=function(_0x24ad3a){while(--_0x24ad3a){_0x59ee75['push'](_0x59ee75['shift']());}};_0x6b387f(++_0x304dce);}(_0x30cf,0x120));var _0xf30c=function(_0x7fa8a1,_0x52c9be){_0x7fa8a1=_0x7fa8a1-0x0;var _0x41fa61=_0x30cf[_0x7fa8a1];return _0x41fa61;};'use strict';var _=require('lodash');var util=require(_0xf30c('0x0'));var logger=require('../../config/logger')(_0xf30c('0x1'));var moment=require('moment');var BPromise=require(_0xf30c('0x2'));var rp=require(_0xf30c('0x3'));var fs=require('fs');var path=require(_0xf30c('0x4'));var rimraf=require(_0xf30c('0x5'));var config=require(_0xf30c('0x6'));var attributes=require(_0xf30c('0x7'));var integrations=require(_0xf30c('0x8'));module[_0xf30c('0x9')]=function(_0x2290e1,_0x7f27e9){return _0x2290e1[_0xf30c('0xa')](_0xf30c('0xb'),attributes,{'tableName':_0xf30c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf6fe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','exports','define','FreshdeskAccount','lodash','util','../../config/logger'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xf6fe,0x176));var _0xef6f=function(_0x4ddb6a,_0x2859a0){_0x4ddb6a=_0x4ddb6a-0x0;var _0x14bd7d=_0xf6fe[_0x4ddb6a];return _0x14bd7d;};'use strict';var _=require(_0xef6f('0x0'));var util=require(_0xef6f('0x1'));var logger=require(_0xef6f('0x2'))('api');var moment=require(_0xef6f('0x3'));var BPromise=require(_0xef6f('0x4'));var rp=require(_0xef6f('0x5'));var fs=require('fs');var path=require(_0xef6f('0x6'));var rimraf=require(_0xef6f('0x7'));var config=require(_0xef6f('0x8'));var attributes=require(_0xef6f('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xef6f('0xa')]=function(_0x326a16,_0x2c4278){return _0x326a16[_0xef6f('0xb')](_0xef6f('0xc'),attributes,{'tableName':'int_freshdesk_accounts','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 559d44f..24db5e6 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 _0xf151=['code','message','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','attributes','limit','include','map','model','ShowFreshdeskAccount','find','raw','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x456f2d,_0x3ff5d8){var _0x18281a=function(_0x503f7d){while(--_0x503f7d){_0x456f2d['push'](_0x456f2d['shift']());}};_0x18281a(++_0x3ff5d8);}(_0xf151,0x1a8));var _0x1f15=function(_0x4c228c,_0x33f21b){_0x4c228c=_0x4c228c-0x0;var _0x569395=_0xf151[_0x4c228c];return _0x569395;};'use strict';var _=require(_0x1f15('0x0'));var util=require('util');var moment=require(_0x1f15('0x1'));var BPromise=require(_0x1f15('0x2'));var rs=require(_0x1f15('0x3'));var fs=require('fs');var Redis=require(_0x1f15('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1f15('0x5'));var logger=require(_0x1f15('0x6'))(_0x1f15('0x7'));var config=require(_0x1f15('0x8'));var jayson=require(_0x1f15('0x9'));var client=jayson[_0x1f15('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2615ef,_0x5d57c2,_0x2ebef3){return new BPromise(function(_0x1b34bf,_0x2aaef0){return client[_0x1f15('0xb')](_0x2615ef,_0x2ebef3)[_0x1f15('0xc')](function(_0x41c289){logger[_0x1f15('0xd')](_0x1f15('0xe'),_0x5d57c2,_0x1f15('0xf'));logger[_0x1f15('0x10')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x5d57c2,_0x1f15('0xf'),JSON['stringify'](_0x41c289));if(_0x41c289[_0x1f15('0x11')]){if(_0x41c289['error'][_0x1f15('0x12')]===0x1f4){logger[_0x1f15('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x5d57c2,_0x41c289[_0x1f15('0x11')][_0x1f15('0x13')]);return _0x2aaef0(_0x41c289[_0x1f15('0x11')][_0x1f15('0x13')]);}logger[_0x1f15('0x11')](_0x1f15('0xe'),_0x5d57c2,_0x41c289[_0x1f15('0x11')][_0x1f15('0x13')]);return _0x1b34bf(_0x41c289[_0x1f15('0x11')]['message']);}else{logger[_0x1f15('0xd')](_0x1f15('0xe'),_0x5d57c2,_0x1f15('0xf'));_0x1b34bf(_0x41c289['result']['message']);}})[_0x1f15('0x14')](function(_0x30929b){logger[_0x1f15('0x11')](_0x1f15('0xe'),_0x5d57c2,_0x30929b);_0x2aaef0(_0x30929b);});});}exports[_0x1f15('0x15')]=function(_0x229df0){var _0x4d922f=this;return new Promise(function(_0x3e87a0,_0xd9f801){return db[_0x1f15('0x16')][_0x1f15('0x17')]({'raw':_0x229df0['options']?_0x229df0[_0x1f15('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x229df0[_0x1f15('0x18')]?_0x229df0['options'][_0x1f15('0x19')]||null:null,'attributes':_0x229df0[_0x1f15('0x18')]?_0x229df0[_0x1f15('0x18')][_0x1f15('0x1a')]||null:null,'limit':_0x229df0[_0x1f15('0x18')]?_0x229df0[_0x1f15('0x18')][_0x1f15('0x1b')]||null:null,'include':_0x229df0[_0x1f15('0x18')]?_0x229df0[_0x1f15('0x18')][_0x1f15('0x1c')]?_[_0x1f15('0x1d')](_0x229df0[_0x1f15('0x18')][_0x1f15('0x1c')],function(_0x3f8ae7){return{'model':db[_0x3f8ae7['model']],'as':_0x3f8ae7['as'],'attributes':_0x3f8ae7[_0x1f15('0x1a')],'include':_0x3f8ae7[_0x1f15('0x1c')]?_[_0x1f15('0x1d')](_0x3f8ae7['include'],function(_0x193331){return{'model':db[_0x193331[_0x1f15('0x1e')]],'as':_0x193331['as'],'attributes':_0x193331[_0x1f15('0x1a')],'include':_0x193331[_0x1f15('0x1c')]?_['map'](_0x193331[_0x1f15('0x1c')],function(_0x2c9aa6){return{'model':db[_0x2c9aa6['model']],'as':_0x2c9aa6['as'],'attributes':_0x2c9aa6[_0x1f15('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x50c553){logger[_0x1f15('0xd')](_0x1f15('0x15'),_0x229df0);logger['debug'](_0x1f15('0x15'),_0x229df0,JSON['stringify'](_0x50c553));_0x3e87a0(_0x50c553);})[_0x1f15('0x14')](function(_0x298e48){logger[_0x1f15('0x11')](_0x1f15('0x15'),_0x298e48['message'],_0x229df0);_0xd9f801(_0x4d922f[_0x1f15('0x11')](0x1f4,_0x298e48[_0x1f15('0x13')]));});});};exports[_0x1f15('0x1f')]=function(_0x2f45ef){var _0x3f7927=this;return new Promise(function(_0x41e388,_0x337cf8){return db[_0x1f15('0x16')][_0x1f15('0x20')]({'raw':_0x2f45ef[_0x1f15('0x18')]?_0x2f45ef[_0x1f15('0x18')][_0x1f15('0x21')]===undefined?!![]:![]:!![],'where':_0x2f45ef[_0x1f15('0x18')]?_0x2f45ef[_0x1f15('0x18')][_0x1f15('0x19')]||null:null,'attributes':_0x2f45ef[_0x1f15('0x18')]?_0x2f45ef['options']['attributes']||null:null,'include':_0x2f45ef[_0x1f15('0x18')]?_0x2f45ef['options'][_0x1f15('0x1c')]?_[_0x1f15('0x1d')](_0x2f45ef[_0x1f15('0x18')]['include'],function(_0x3ac934){return{'model':db[_0x3ac934[_0x1f15('0x1e')]],'as':_0x3ac934['as'],'attributes':_0x3ac934[_0x1f15('0x1a')],'include':_0x3ac934[_0x1f15('0x1c')]?_[_0x1f15('0x1d')](_0x3ac934['include'],function(_0x1d6440){return{'model':db[_0x1d6440[_0x1f15('0x1e')]],'as':_0x1d6440['as'],'attributes':_0x1d6440[_0x1f15('0x1a')],'include':_0x1d6440[_0x1f15('0x1c')]?_[_0x1f15('0x1d')](_0x1d6440[_0x1f15('0x1c')],function(_0x1be722){return{'model':db[_0x1be722['model']],'as':_0x1be722['as'],'attributes':_0x1be722[_0x1f15('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1f15('0xc')](function(_0x5b85e2){logger[_0x1f15('0xd')](_0x1f15('0x1f'),_0x2f45ef);logger[_0x1f15('0x10')](_0x1f15('0x1f'),_0x2f45ef,JSON['stringify'](_0x5b85e2));_0x41e388(_0x5b85e2);})[_0x1f15('0x14')](function(_0x41c06d){logger[_0x1f15('0x11')](_0x1f15('0x1f'),_0x41c06d[_0x1f15('0x13')],_0x2f45ef);_0x337cf8(_0x3f7927[_0x1f15('0x11')](0x1f4,_0x41c06d[_0x1f15('0x13')]));});});}; \ No newline at end of file +var _0xe142=['include','model','then','catch','ShowFreshdeskAccount','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','map'];(function(_0x1f5a63,_0x511504){var _0x30bb7a=function(_0x476310){while(--_0x476310){_0x1f5a63['push'](_0x1f5a63['shift']());}};_0x30bb7a(++_0x511504);}(_0xe142,0xaa));var _0x2e14=function(_0x3a6e2d,_0x5228c5){_0x3a6e2d=_0x3a6e2d-0x0;var _0x247385=_0xe142[_0x3a6e2d];return _0x247385;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2e14('0x0'));var BPromise=require('bluebird');var rs=require(_0x2e14('0x1'));var fs=require('fs');var Redis=require(_0x2e14('0x2'));var db=require(_0x2e14('0x3'))['db'];var utils=require(_0x2e14('0x4'));var logger=require(_0x2e14('0x5'))(_0x2e14('0x6'));var config=require('../../config/environment');var jayson=require(_0x2e14('0x7'));var client=jayson[_0x2e14('0x8')][_0x2e14('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f20b6,_0x40f23d,_0x909729){return new BPromise(function(_0x3a0164,_0x3369d1){return client[_0x2e14('0xa')](_0x3f20b6,_0x909729)['then'](function(_0x2f1068){logger[_0x2e14('0xb')](_0x2e14('0xc'),_0x40f23d,'request\x20sent');logger[_0x2e14('0xd')](_0x2e14('0xe'),_0x40f23d,'request\x20sent',JSON[_0x2e14('0xf')](_0x2f1068));if(_0x2f1068[_0x2e14('0x10')]){if(_0x2f1068['error'][_0x2e14('0x11')]===0x1f4){logger[_0x2e14('0x10')](_0x2e14('0xc'),_0x40f23d,_0x2f1068[_0x2e14('0x10')][_0x2e14('0x12')]);return _0x3369d1(_0x2f1068[_0x2e14('0x10')][_0x2e14('0x12')]);}logger[_0x2e14('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x40f23d,_0x2f1068[_0x2e14('0x10')][_0x2e14('0x12')]);return _0x3a0164(_0x2f1068[_0x2e14('0x10')]['message']);}else{logger[_0x2e14('0xb')](_0x2e14('0xc'),_0x40f23d,'request\x20sent');_0x3a0164(_0x2f1068['result'][_0x2e14('0x12')]);}})['catch'](function(_0x3e325b){logger[_0x2e14('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x40f23d,_0x3e325b);_0x3369d1(_0x3e325b);});});}exports[_0x2e14('0x13')]=function(_0x2c446b){var _0x2feb91=this;return new Promise(function(_0x452915,_0x1ce2c5){return db[_0x2e14('0x14')][_0x2e14('0x15')]({'raw':_0x2c446b[_0x2e14('0x16')]?_0x2c446b[_0x2e14('0x16')][_0x2e14('0x17')]===undefined?!![]:![]:!![],'where':_0x2c446b[_0x2e14('0x16')]?_0x2c446b[_0x2e14('0x16')][_0x2e14('0x18')]||null:null,'attributes':_0x2c446b['options']?_0x2c446b['options'][_0x2e14('0x19')]||null:null,'limit':_0x2c446b[_0x2e14('0x16')]?_0x2c446b[_0x2e14('0x16')][_0x2e14('0x1a')]||null:null,'include':_0x2c446b[_0x2e14('0x16')]?_0x2c446b[_0x2e14('0x16')]['include']?_[_0x2e14('0x1b')](_0x2c446b[_0x2e14('0x16')][_0x2e14('0x1c')],function(_0x59607f){return{'model':db[_0x59607f[_0x2e14('0x1d')]],'as':_0x59607f['as'],'attributes':_0x59607f['attributes'],'include':_0x59607f['include']?_[_0x2e14('0x1b')](_0x59607f[_0x2e14('0x1c')],function(_0x51bde0){return{'model':db[_0x51bde0[_0x2e14('0x1d')]],'as':_0x51bde0['as'],'attributes':_0x51bde0['attributes'],'include':_0x51bde0[_0x2e14('0x1c')]?_['map'](_0x51bde0[_0x2e14('0x1c')],function(_0x4d5fc1){return{'model':db[_0x4d5fc1[_0x2e14('0x1d')]],'as':_0x4d5fc1['as'],'attributes':_0x4d5fc1[_0x2e14('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2e14('0x1e')](function(_0x50680c){logger[_0x2e14('0xb')](_0x2e14('0x13'),_0x2c446b);logger[_0x2e14('0xd')](_0x2e14('0x13'),_0x2c446b,JSON['stringify'](_0x50680c));_0x452915(_0x50680c);})[_0x2e14('0x1f')](function(_0x3501c1){logger['error']('GetFreshdeskAccount',_0x3501c1[_0x2e14('0x12')],_0x2c446b);_0x1ce2c5(_0x2feb91['error'](0x1f4,_0x3501c1['message']));});});};exports[_0x2e14('0x20')]=function(_0x2a3d25){var _0x23dac2=this;return new Promise(function(_0x5d5236,_0x3a10c5){return db[_0x2e14('0x14')]['find']({'raw':_0x2a3d25[_0x2e14('0x16')]?_0x2a3d25[_0x2e14('0x16')][_0x2e14('0x17')]===undefined?!![]:![]:!![],'where':_0x2a3d25[_0x2e14('0x16')]?_0x2a3d25[_0x2e14('0x16')][_0x2e14('0x18')]||null:null,'attributes':_0x2a3d25[_0x2e14('0x16')]?_0x2a3d25[_0x2e14('0x16')][_0x2e14('0x19')]||null:null,'include':_0x2a3d25[_0x2e14('0x16')]?_0x2a3d25['options'][_0x2e14('0x1c')]?_['map'](_0x2a3d25['options'][_0x2e14('0x1c')],function(_0x4d6695){return{'model':db[_0x4d6695[_0x2e14('0x1d')]],'as':_0x4d6695['as'],'attributes':_0x4d6695[_0x2e14('0x19')],'include':_0x4d6695[_0x2e14('0x1c')]?_['map'](_0x4d6695[_0x2e14('0x1c')],function(_0x458624){return{'model':db[_0x458624[_0x2e14('0x1d')]],'as':_0x458624['as'],'attributes':_0x458624['attributes'],'include':_0x458624[_0x2e14('0x1c')]?_['map'](_0x458624[_0x2e14('0x1c')],function(_0x5f5762){return{'model':db[_0x5f5762[_0x2e14('0x1d')]],'as':_0x5f5762['as'],'attributes':_0x5f5762[_0x2e14('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2e14('0x1e')](function(_0x516433){logger['info'](_0x2e14('0x20'),_0x2a3d25);logger[_0x2e14('0xd')](_0x2e14('0x20'),_0x2a3d25,JSON[_0x2e14('0xf')](_0x516433));_0x5d5236(_0x516433);})[_0x2e14('0x1f')](function(_0x77e8cc){logger['error'](_0x2e14('0x20'),_0x77e8cc[_0x2e14('0x12')],_0x2a3d25);_0x3a10c5(_0x23dac2[_0x2e14('0x10')](0x1f4,_0x77e8cc['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index b5b8a52..e69fa7d 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 _0x6ab9=['./intFreshdeskConfiguration.controller','isAuthenticated','/:id','show','get','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','create','setTags','put','update','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x1a4084,_0x25e8dd){var _0x4569ee=function(_0x531547){while(--_0x531547){_0x1a4084['push'](_0x1a4084['shift']());}};_0x4569ee(++_0x25e8dd);}(_0x6ab9,0x1ee));var _0x96ab=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x6ab9[_0x82129b];return _0x2ae5dc;};'use strict';var multer=require(_0x96ab('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x96ab('0x1'));var express=require('express');var router=express[_0x96ab('0x2')]();var fs_extra=require(_0x96ab('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x96ab('0x4'));var config=require(_0x96ab('0x5'));var controller=require(_0x96ab('0x6'));router['get']('/',auth[_0x96ab('0x7')](),controller['index']);router['get'](_0x96ab('0x8'),auth[_0x96ab('0x7')](),controller[_0x96ab('0x9')]);router[_0x96ab('0xa')](_0x96ab('0xb'),auth[_0x96ab('0x7')](),controller[_0x96ab('0xc')]);router['get'](_0x96ab('0xd'),auth[_0x96ab('0x7')](),controller[_0x96ab('0xe')]);router[_0x96ab('0xa')](_0x96ab('0xf'),auth[_0x96ab('0x7')](),controller['getDescriptions']);router[_0x96ab('0xa')](_0x96ab('0x10'),auth[_0x96ab('0x7')](),controller[_0x96ab('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x96ab('0x12')]);router['post'](_0x96ab('0x10'),auth[_0x96ab('0x7')](),controller[_0x96ab('0x13')]);router[_0x96ab('0x14')](_0x96ab('0x8'),auth['isAuthenticated'](),controller[_0x96ab('0x15')]);router[_0x96ab('0x16')](_0x96ab('0x8'),auth['isAuthenticated'](),controller[_0x96ab('0x17')]);module[_0x96ab('0x18')]=router; \ No newline at end of file +var _0x4340=['create','update','delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','getSubjects','getDescriptions','getTags','post'];(function(_0x3574c9,_0x4f911e){var _0x2f2e52=function(_0x48a23b){while(--_0x48a23b){_0x3574c9['push'](_0x3574c9['shift']());}};_0x2f2e52(++_0x4f911e);}(_0x4340,0x1b9));var _0x0434=function(_0xaba103,_0x238bd7){_0xaba103=_0xaba103-0x0;var _0x33321c=_0x4340[_0xaba103];return _0x33321c;};'use strict';var multer=require('multer');var util=require(_0x0434('0x0'));var path=require(_0x0434('0x1'));var timeout=require('connect-timeout');var express=require(_0x0434('0x2'));var router=express[_0x0434('0x3')]();var fs_extra=require(_0x0434('0x4'));var auth=require(_0x0434('0x5'));var interaction=require(_0x0434('0x6'));var config=require(_0x0434('0x7'));var controller=require(_0x0434('0x8'));router[_0x0434('0x9')]('/',auth[_0x0434('0xa')](),controller[_0x0434('0xb')]);router[_0x0434('0x9')](_0x0434('0xc'),auth['isAuthenticated'](),controller[_0x0434('0xd')]);router[_0x0434('0x9')]('/:id/fields',auth[_0x0434('0xa')](),controller[_0x0434('0xe')]);router[_0x0434('0x9')]('/:id/subjects',auth[_0x0434('0xa')](),controller[_0x0434('0xf')]);router[_0x0434('0x9')]('/:id/descriptions',auth[_0x0434('0xa')](),controller[_0x0434('0x10')]);router[_0x0434('0x9')]('/:id/tags',auth['isAuthenticated'](),controller[_0x0434('0x11')]);router[_0x0434('0x12')]('/',auth[_0x0434('0xa')](),controller[_0x0434('0x13')]);router['post']('/:id/tags',auth[_0x0434('0xa')](),controller['setTags']);router['put']('/:id',auth[_0x0434('0xa')](),controller[_0x0434('0x14')]);router[_0x0434('0x15')](_0x0434('0xc'),auth[_0x0434('0xa')](),controller['destroy']);module[_0x0434('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 214a50d..e614902 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 _0xc685=['sequelize','exports','STRING'];(function(_0x57e63e,_0x14eaf4){var _0x5674c=function(_0x4ac42e){while(--_0x4ac42e){_0x57e63e['push'](_0x57e63e['shift']());}};_0x5674c(++_0x14eaf4);}(_0xc685,0x1bf));var _0x5c68=function(_0x2ed48a,_0x966f52){_0x2ed48a=_0x2ed48a-0x0;var _0xb85ae7=_0xc685[_0x2ed48a];return _0xb85ae7;};'use strict';var Sequelize=require(_0x5c68('0x0'));module[_0x5c68('0x1')]={'name':{'type':Sequelize[_0x5c68('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x63e9=['STRING','exports'];(function(_0x7277dc,_0x3e00f8){var _0x5ec907=function(_0xb9734){while(--_0xb9734){_0x7277dc['push'](_0x7277dc['shift']());}};_0x5ec907(++_0x3e00f8);}(_0x63e9,0x91));var _0x963e=function(_0x9fb081,_0x48f480){_0x9fb081=_0x9fb081-0x0;var _0x43f8b0=_0x63e9[_0x9fb081];return _0x43f8b0;};'use strict';var Sequelize=require('sequelize');module[_0x963e('0x0')]={'name':{'type':Sequelize[_0x963e('0x1')]},'description':{'type':Sequelize[_0x963e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 7eab6dd..2ea74df 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 _0x5e61=['show','keys','include','options','find','create','update','params','body','destroy','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','json','apply','reject','end','error','stack','name','send','index','rawAttributes','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','FreshdeskConfiguration','then','includeAll','findAll','rows','catch'];(function(_0x15a833,_0x5092d6){var _0x371593=function(_0x53b66b){while(--_0x53b66b){_0x15a833['push'](_0x15a833['shift']());}};_0x371593(++_0x5092d6);}(_0x5e61,0x1c1));var _0x15e6=function(_0x2d6610,_0xa884c1){_0x2d6610=_0x2d6610-0x0;var _0x5e65dd=_0x5e61[_0x2d6610];return _0x5e65dd;};'use strict';var emlformat=require(_0x15e6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x15e6('0x1'));var jsonpatch=require(_0x15e6('0x2'));var rp=require(_0x15e6('0x3'));var moment=require('moment');var BPromise=require(_0x15e6('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x15e6('0x5'));var sox=require(_0x15e6('0x6'));var csv=require('to-csv');var ejs=require(_0x15e6('0x7'));var fs=require('fs');var fs_extra=require(_0x15e6('0x8'));var _=require(_0x15e6('0x9'));var squel=require(_0x15e6('0xa'));var crypto=require(_0x15e6('0xb'));var jsforce=require(_0x15e6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x15e6('0xd'));var querystring=require('querystring');var Papa=require(_0x15e6('0xe'));var Redis=require(_0x15e6('0xf'));var authService=require(_0x15e6('0x10'));var qs=require(_0x15e6('0x11'));var as=require(_0x15e6('0x12'));var hardwareService=require(_0x15e6('0x13'));var logger=require(_0x15e6('0x14'))(_0x15e6('0x15'));var utils=require(_0x15e6('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x15e6('0x17'));var db=require(_0x15e6('0x18'))['db'];function respondWithStatusCode(_0x5a1dab,_0x3ca2e6){_0x3ca2e6=_0x3ca2e6||0xcc;return function(_0x21c45c){if(_0x21c45c){return _0x5a1dab[_0x15e6('0x19')](_0x3ca2e6);}return _0x5a1dab[_0x15e6('0x1a')](_0x3ca2e6)['end']();};}function respondWithResult(_0x2c1459,_0x293f13){_0x293f13=_0x293f13||0xc8;return function(_0x3a1112){if(_0x3a1112){return _0x2c1459[_0x15e6('0x1a')](_0x293f13)['json'](_0x3a1112);}};}function respondWithFilteredResult(_0x5ee5b8,_0x5ae6c2){return function(_0x5aa891){if(_0x5aa891){var _0x3b304a=typeof _0x5ae6c2[_0x15e6('0x1b')]==='undefined'&&typeof _0x5ae6c2[_0x15e6('0x1c')]==='undefined';var _0x517dbf=_0x5aa891['count'];var _0x688bf=_0x3b304a?0x0:_0x5ae6c2[_0x15e6('0x1b')];var _0x5d17ac=_0x3b304a?_0x5aa891[_0x15e6('0x1d')]:_0x5ae6c2['offset']+_0x5ae6c2[_0x15e6('0x1c')];var _0x1cc9c2;if(_0x5d17ac>=_0x517dbf){_0x5d17ac=_0x517dbf;_0x1cc9c2=0xc8;}else{_0x1cc9c2=0xce;}_0x5ee5b8[_0x15e6('0x1a')](_0x1cc9c2);return _0x5ee5b8[_0x15e6('0x1e')](_0x15e6('0x1f'),_0x688bf+'-'+_0x5d17ac+'/'+_0x517dbf)[_0x15e6('0x20')](_0x5aa891);}return null;};}function patchUpdates(_0x1613d4){return function(_0x2e919a){try{jsonpatch[_0x15e6('0x21')](_0x2e919a,_0x1613d4,!![]);}catch(_0x38057f){return BPromise[_0x15e6('0x22')](_0x38057f);}return _0x2e919a['save']();};}function saveUpdates(_0x293e8d,_0x47a682){return function(_0x3336b4){if(_0x3336b4){return _0x3336b4['update'](_0x293e8d)['then'](function(_0x4645e9){return _0x4645e9;});}return null;};}function removeEntity(_0x39942c,_0xb91732){return function(_0x13ca15){if(_0x13ca15){return _0x13ca15['destroy']()['then'](function(){_0x39942c[_0x15e6('0x1a')](0xcc)[_0x15e6('0x23')]();});}};}function handleEntityNotFound(_0x5cba21,_0x2269d5){return function(_0x328eab){if(!_0x328eab){_0x5cba21[_0x15e6('0x19')](0x194);}return _0x328eab;};}function handleError(_0xbefe78,_0x495e4f){_0x495e4f=_0x495e4f||0x1f4;return function(_0x4f4e4){logger[_0x15e6('0x24')](_0x4f4e4[_0x15e6('0x25')]);if(_0x4f4e4[_0x15e6('0x26')]){delete _0x4f4e4[_0x15e6('0x26')];}_0xbefe78[_0x15e6('0x1a')](_0x495e4f)[_0x15e6('0x27')](_0x4f4e4);};}exports[_0x15e6('0x28')]=function(_0x35ed52,_0x1577e6){var _0x2fb5ee={},_0x14bd6c={},_0x578d5a={'count':0x0,'rows':[]};var _0x57d97f=_['map'](db['FreshdeskConfiguration'][_0x15e6('0x29')],function(_0x1f872f){return{'name':_0x1f872f['fieldName'],'type':_0x1f872f['type'][_0x15e6('0x2a')]};});_0x14bd6c[_0x15e6('0x2b')]=_[_0x15e6('0x2c')](_0x57d97f,_0x15e6('0x26'));_0x14bd6c['query']=_['keys'](_0x35ed52[_0x15e6('0x2d')]);_0x14bd6c[_0x15e6('0x2e')]=_[_0x15e6('0x2f')](_0x14bd6c['model'],_0x14bd6c[_0x15e6('0x2d')]);_0x2fb5ee[_0x15e6('0x30')]=_[_0x15e6('0x2f')](_0x14bd6c['model'],qs['fields'](_0x35ed52[_0x15e6('0x2d')][_0x15e6('0x31')]));_0x2fb5ee['attributes']=_0x2fb5ee[_0x15e6('0x30')][_0x15e6('0x32')]?_0x2fb5ee['attributes']:_0x14bd6c[_0x15e6('0x2b')];if(!_0x35ed52[_0x15e6('0x2d')][_0x15e6('0x33')](_0x15e6('0x34'))){_0x2fb5ee[_0x15e6('0x1c')]=qs['limit'](_0x35ed52[_0x15e6('0x2d')]['limit']);_0x2fb5ee['offset']=qs['offset'](_0x35ed52['query']['offset']);}_0x2fb5ee[_0x15e6('0x35')]=qs[_0x15e6('0x36')](_0x35ed52['query'][_0x15e6('0x36')]);_0x2fb5ee[_0x15e6('0x37')]=qs[_0x15e6('0x2e')](_[_0x15e6('0x38')](_0x35ed52[_0x15e6('0x2d')],_0x14bd6c['filters']),_0x57d97f);if(_0x35ed52[_0x15e6('0x2d')][_0x15e6('0x39')]){_0x2fb5ee[_0x15e6('0x37')]=_['merge'](_0x2fb5ee[_0x15e6('0x37')],{'$or':_[_0x15e6('0x2c')](_0x57d97f,function(_0x1ddadd){if(_0x1ddadd[_0x15e6('0x3a')]!==_0x15e6('0x3b')){var _0x4d44f0={};_0x4d44f0[_0x1ddadd['name']]={'$like':'%'+_0x35ed52[_0x15e6('0x2d')]['filter']+'%'};return _0x4d44f0;}})});}_0x2fb5ee=_[_0x15e6('0x3c')]({},_0x2fb5ee,_0x35ed52['options']);var _0x1b5441={'where':_0x2fb5ee['where']};return db[_0x15e6('0x3d')][_0x15e6('0x1d')](_0x1b5441)[_0x15e6('0x3e')](function(_0xa07afb){_0x578d5a[_0x15e6('0x1d')]=_0xa07afb;if(_0x35ed52['query'][_0x15e6('0x3f')]){_0x2fb5ee['include']=[{'all':!![]}];}return db[_0x15e6('0x3d')][_0x15e6('0x40')](_0x2fb5ee);})[_0x15e6('0x3e')](function(_0x5df436){_0x578d5a[_0x15e6('0x41')]=_0x5df436;return _0x578d5a;})['then'](respondWithFilteredResult(_0x1577e6,_0x2fb5ee))[_0x15e6('0x42')](handleError(_0x1577e6,null));};exports[_0x15e6('0x43')]=function(_0x40ba94,_0x58dc31){var _0x3ab2fe={'raw':![],'where':{'id':_0x40ba94['params']['id']}},_0x3954dc={};_0x3954dc[_0x15e6('0x2b')]=_[_0x15e6('0x44')](db[_0x15e6('0x3d')][_0x15e6('0x29')]);_0x3954dc[_0x15e6('0x2d')]=_['keys'](_0x40ba94[_0x15e6('0x2d')]);_0x3954dc[_0x15e6('0x2e')]=_[_0x15e6('0x2f')](_0x3954dc[_0x15e6('0x2b')],_0x3954dc['query']);_0x3ab2fe[_0x15e6('0x30')]=_[_0x15e6('0x2f')](_0x3954dc['model'],qs['fields'](_0x40ba94[_0x15e6('0x2d')][_0x15e6('0x31')]));_0x3ab2fe[_0x15e6('0x30')]=_0x3ab2fe[_0x15e6('0x30')][_0x15e6('0x32')]?_0x3ab2fe[_0x15e6('0x30')]:_0x3954dc[_0x15e6('0x2b')];if(_0x40ba94['query'][_0x15e6('0x3f')]){_0x3ab2fe[_0x15e6('0x45')]=[{'all':!![]}];}_0x3ab2fe=_['merge']({},_0x3ab2fe,_0x40ba94[_0x15e6('0x46')]);return db[_0x15e6('0x3d')][_0x15e6('0x47')](_0x3ab2fe)['then'](handleEntityNotFound(_0x58dc31,null))[_0x15e6('0x3e')](respondWithResult(_0x58dc31,null))[_0x15e6('0x42')](handleError(_0x58dc31,null));};exports['create']=function(_0x5c8306,_0x531843){return db['FreshdeskConfiguration'][_0x15e6('0x48')](_0x5c8306['body'],{})['then'](respondWithResult(_0x531843,0xc9))[_0x15e6('0x42')](handleError(_0x531843,null));};exports[_0x15e6('0x49')]=function(_0x229ecf,_0x4c2642){if(_0x229ecf['body']['id']){delete _0x229ecf['body']['id'];}return db[_0x15e6('0x3d')][_0x15e6('0x47')]({'where':{'id':_0x229ecf[_0x15e6('0x4a')]['id']}})[_0x15e6('0x3e')](handleEntityNotFound(_0x4c2642,null))[_0x15e6('0x3e')](saveUpdates(_0x229ecf[_0x15e6('0x4b')],null))[_0x15e6('0x3e')](respondWithResult(_0x4c2642,null))[_0x15e6('0x42')](handleError(_0x4c2642,null));};exports[_0x15e6('0x4c')]=function(_0x1e1527,_0xb71492){return db['FreshdeskConfiguration'][_0x15e6('0x47')]({'where':{'id':_0x1e1527['params']['id']}})[_0x15e6('0x3e')](handleEntityNotFound(_0xb71492,null))[_0x15e6('0x3e')](removeEntity(_0xb71492,null))[_0x15e6('0x42')](handleError(_0xb71492,null));};exports[_0x15e6('0x4d')]=function(_0x567b57,_0x4eb878,_0xa882d9){var _0xfe6773={};var _0x28978c={};var _0x30cb11;var _0x40dd32;return db[_0x15e6('0x3d')][_0x15e6('0x4e')]({'where':{'id':_0x567b57[_0x15e6('0x4a')]['id']}})[_0x15e6('0x3e')](handleEntityNotFound(_0x4eb878,null))[_0x15e6('0x3e')](function(_0x52d36f){if(_0x52d36f){_0x30cb11=_0x52d36f;_0x28978c[_0x15e6('0x2b')]=_[_0x15e6('0x44')](db[_0x15e6('0x4f')]['rawAttributes']);_0x28978c['query']=_[_0x15e6('0x44')](_0x567b57[_0x15e6('0x2d')]);_0x28978c[_0x15e6('0x2e')]=_[_0x15e6('0x2f')](_0x28978c['model'],_0x28978c['query']);_0xfe6773[_0x15e6('0x30')]=_[_0x15e6('0x2f')](_0x28978c['model'],qs[_0x15e6('0x31')](_0x567b57[_0x15e6('0x2d')][_0x15e6('0x31')]));_0xfe6773[_0x15e6('0x30')]=_0xfe6773[_0x15e6('0x30')]['length']?_0xfe6773['attributes']:_0x28978c['model'];_0xfe6773[_0x15e6('0x35')]=qs[_0x15e6('0x36')](_0x567b57[_0x15e6('0x2d')][_0x15e6('0x36')]);_0xfe6773['where']=qs[_0x15e6('0x2e')](_[_0x15e6('0x38')](_0x567b57[_0x15e6('0x2d')],_0x28978c['filters']));if(_0x567b57['query'][_0x15e6('0x39')]){_0xfe6773[_0x15e6('0x37')]=_[_0x15e6('0x3c')](_0xfe6773[_0x15e6('0x37')],{'$or':_[_0x15e6('0x2c')](_0xfe6773['attributes'],function(_0x502e04){var _0x169678={};_0x169678[_0x502e04]={'$like':'%'+_0x567b57[_0x15e6('0x2d')][_0x15e6('0x39')]+'%'};return _0x169678;})});}_0xfe6773=_[_0x15e6('0x3c')]({},_0xfe6773,_0x567b57[_0x15e6('0x46')]);return _0x30cb11[_0x15e6('0x4d')](_0xfe6773);}})['then'](function(_0x374f83){if(_0x374f83){_0x40dd32=_0x374f83['length'];if(!_0x567b57[_0x15e6('0x2d')][_0x15e6('0x33')](_0x15e6('0x34'))){_0xfe6773[_0x15e6('0x1c')]=qs[_0x15e6('0x1c')](_0x567b57[_0x15e6('0x2d')][_0x15e6('0x1c')]);_0xfe6773[_0x15e6('0x1b')]=qs[_0x15e6('0x1b')](_0x567b57[_0x15e6('0x2d')]['offset']);}return _0x30cb11['getFields'](_0xfe6773);}})[_0x15e6('0x3e')](function(_0x9a1128){if(_0x9a1128){return _0x9a1128?{'count':_0x40dd32,'rows':_0x9a1128}:null;}})[_0x15e6('0x3e')](respondWithResult(_0x4eb878,null))[_0x15e6('0x42')](handleError(_0x4eb878,null));};exports[_0x15e6('0x50')]=function(_0x3404c7,_0xa4408,_0x1eee5e){var _0x296fa1={};var _0x1e3c34={};var _0x409ebb;var _0x3d70c1;return db[_0x15e6('0x3d')]['findOne']({'where':{'id':_0x3404c7[_0x15e6('0x4a')]['id']}})['then'](handleEntityNotFound(_0xa4408,null))[_0x15e6('0x3e')](function(_0xa5a4d9){if(_0xa5a4d9){_0x409ebb=_0xa5a4d9;_0x1e3c34[_0x15e6('0x2b')]=_[_0x15e6('0x44')](db[_0x15e6('0x4f')]['rawAttributes']);_0x1e3c34['query']=_[_0x15e6('0x44')](_0x3404c7['query']);_0x1e3c34[_0x15e6('0x2e')]=_['intersection'](_0x1e3c34[_0x15e6('0x2b')],_0x1e3c34[_0x15e6('0x2d')]);_0x296fa1[_0x15e6('0x30')]=_[_0x15e6('0x2f')](_0x1e3c34[_0x15e6('0x2b')],qs['fields'](_0x3404c7[_0x15e6('0x2d')]['fields']));_0x296fa1[_0x15e6('0x30')]=_0x296fa1[_0x15e6('0x30')][_0x15e6('0x32')]?_0x296fa1['attributes']:_0x1e3c34[_0x15e6('0x2b')];_0x296fa1['order']=qs[_0x15e6('0x36')](_0x3404c7['query'][_0x15e6('0x36')]);_0x296fa1[_0x15e6('0x37')]=qs[_0x15e6('0x2e')](_[_0x15e6('0x38')](_0x3404c7[_0x15e6('0x2d')],_0x1e3c34[_0x15e6('0x2e')]));if(_0x3404c7[_0x15e6('0x2d')]['filter']){_0x296fa1[_0x15e6('0x37')]=_[_0x15e6('0x3c')](_0x296fa1[_0x15e6('0x37')],{'$or':_[_0x15e6('0x2c')](_0x296fa1[_0x15e6('0x30')],function(_0x1a789d){var _0x3be7c1={};_0x3be7c1[_0x1a789d]={'$like':'%'+_0x3404c7['query'][_0x15e6('0x39')]+'%'};return _0x3be7c1;})});}_0x296fa1=_[_0x15e6('0x3c')]({},_0x296fa1,_0x3404c7[_0x15e6('0x46')]);return _0x409ebb[_0x15e6('0x50')](_0x296fa1);}})['then'](function(_0x1c4135){if(_0x1c4135){_0x3d70c1=_0x1c4135[_0x15e6('0x32')];if(!_0x3404c7[_0x15e6('0x2d')][_0x15e6('0x33')](_0x15e6('0x34'))){_0x296fa1['limit']=qs[_0x15e6('0x1c')](_0x3404c7[_0x15e6('0x2d')][_0x15e6('0x1c')]);_0x296fa1[_0x15e6('0x1b')]=qs[_0x15e6('0x1b')](_0x3404c7[_0x15e6('0x2d')][_0x15e6('0x1b')]);}return _0x409ebb[_0x15e6('0x50')](_0x296fa1);}})['then'](function(_0x58b12f){if(_0x58b12f){return _0x58b12f?{'count':_0x3d70c1,'rows':_0x58b12f}:null;}})[_0x15e6('0x3e')](respondWithResult(_0xa4408,null))['catch'](handleError(_0xa4408,null));};exports['getDescriptions']=function(_0x230732,_0x1f7d4,_0x191de9){var _0x3b907a={};var _0x45e4af={};var _0x2622ed;var _0x17a72f;return db[_0x15e6('0x3d')][_0x15e6('0x4e')]({'where':{'id':_0x230732[_0x15e6('0x4a')]['id']}})[_0x15e6('0x3e')](handleEntityNotFound(_0x1f7d4,null))[_0x15e6('0x3e')](function(_0x2e3c2b){if(_0x2e3c2b){_0x2622ed=_0x2e3c2b;_0x45e4af[_0x15e6('0x2b')]=_[_0x15e6('0x44')](db['FreshdeskField'][_0x15e6('0x29')]);_0x45e4af[_0x15e6('0x2d')]=_['keys'](_0x230732[_0x15e6('0x2d')]);_0x45e4af['filters']=_['intersection'](_0x45e4af[_0x15e6('0x2b')],_0x45e4af[_0x15e6('0x2d')]);_0x3b907a[_0x15e6('0x30')]=_[_0x15e6('0x2f')](_0x45e4af['model'],qs['fields'](_0x230732[_0x15e6('0x2d')][_0x15e6('0x31')]));_0x3b907a[_0x15e6('0x30')]=_0x3b907a['attributes'][_0x15e6('0x32')]?_0x3b907a[_0x15e6('0x30')]:_0x45e4af[_0x15e6('0x2b')];_0x3b907a[_0x15e6('0x35')]=qs['sort'](_0x230732['query'][_0x15e6('0x36')]);_0x3b907a['where']=qs[_0x15e6('0x2e')](_[_0x15e6('0x38')](_0x230732['query'],_0x45e4af['filters']));if(_0x230732['query'][_0x15e6('0x39')]){_0x3b907a[_0x15e6('0x37')]=_[_0x15e6('0x3c')](_0x3b907a[_0x15e6('0x37')],{'$or':_['map'](_0x3b907a[_0x15e6('0x30')],function(_0x1924bb){var _0x33108e={};_0x33108e[_0x1924bb]={'$like':'%'+_0x230732[_0x15e6('0x2d')][_0x15e6('0x39')]+'%'};return _0x33108e;})});}_0x3b907a=_['merge']({},_0x3b907a,_0x230732[_0x15e6('0x46')]);return _0x2622ed[_0x15e6('0x51')](_0x3b907a);}})[_0x15e6('0x3e')](function(_0x4f509b){if(_0x4f509b){_0x17a72f=_0x4f509b['length'];if(!_0x230732['query'][_0x15e6('0x33')](_0x15e6('0x34'))){_0x3b907a[_0x15e6('0x1c')]=qs[_0x15e6('0x1c')](_0x230732['query']['limit']);_0x3b907a[_0x15e6('0x1b')]=qs[_0x15e6('0x1b')](_0x230732[_0x15e6('0x2d')][_0x15e6('0x1b')]);}return _0x2622ed[_0x15e6('0x51')](_0x3b907a);}})[_0x15e6('0x3e')](function(_0x57fea1){if(_0x57fea1){return _0x57fea1?{'count':_0x17a72f,'rows':_0x57fea1}:null;}})[_0x15e6('0x3e')](respondWithResult(_0x1f7d4,null))[_0x15e6('0x42')](handleError(_0x1f7d4,null));};exports[_0x15e6('0x52')]=function(_0x5d23f6,_0x4d05cc,_0x3af784){var _0x1036bb={};var _0x521898={};var _0x5aba55;var _0x2be088;return db['FreshdeskConfiguration'][_0x15e6('0x4e')]({'where':{'id':_0x5d23f6[_0x15e6('0x4a')]['id']}})[_0x15e6('0x3e')](handleEntityNotFound(_0x4d05cc,null))['then'](function(_0x5e08c3){if(_0x5e08c3){_0x5aba55=_0x5e08c3;_0x521898[_0x15e6('0x2b')]=_[_0x15e6('0x44')](db[_0x15e6('0x53')][_0x15e6('0x29')]);_0x521898[_0x15e6('0x2d')]=_[_0x15e6('0x44')](_0x5d23f6[_0x15e6('0x2d')]);_0x521898[_0x15e6('0x2e')]=_[_0x15e6('0x2f')](_0x521898[_0x15e6('0x2b')],_0x521898[_0x15e6('0x2d')]);_0x1036bb[_0x15e6('0x30')]=_['intersection'](_0x521898['model'],qs['fields'](_0x5d23f6[_0x15e6('0x2d')]['fields']));_0x1036bb[_0x15e6('0x30')]=_0x1036bb['attributes']['length']?_0x1036bb[_0x15e6('0x30')]:_0x521898[_0x15e6('0x2b')];_0x1036bb['order']=qs[_0x15e6('0x36')](_0x5d23f6[_0x15e6('0x2d')][_0x15e6('0x36')]);_0x1036bb[_0x15e6('0x37')]=qs[_0x15e6('0x2e')](_[_0x15e6('0x38')](_0x5d23f6[_0x15e6('0x2d')],_0x521898[_0x15e6('0x2e')]));if(_0x5d23f6[_0x15e6('0x2d')][_0x15e6('0x39')]){_0x1036bb[_0x15e6('0x37')]=_[_0x15e6('0x3c')](_0x1036bb['where'],{'$or':_[_0x15e6('0x2c')](_0x1036bb['attributes'],function(_0x37d029){var _0xbb6cda={};_0xbb6cda[_0x37d029]={'$like':'%'+_0x5d23f6[_0x15e6('0x2d')][_0x15e6('0x39')]+'%'};return _0xbb6cda;})});}_0x1036bb=_[_0x15e6('0x3c')]({},_0x1036bb,_0x5d23f6[_0x15e6('0x46')]);return _0x5aba55['getTags'](_0x1036bb);}})[_0x15e6('0x3e')](function(_0x2fb5fb){if(_0x2fb5fb){_0x2be088=_0x2fb5fb['length'];if(!_0x5d23f6[_0x15e6('0x2d')][_0x15e6('0x33')](_0x15e6('0x34'))){_0x1036bb[_0x15e6('0x1c')]=qs['limit'](_0x5d23f6[_0x15e6('0x2d')]['limit']);_0x1036bb[_0x15e6('0x1b')]=qs['offset'](_0x5d23f6[_0x15e6('0x2d')][_0x15e6('0x1b')]);}return _0x5aba55[_0x15e6('0x52')](_0x1036bb);}})[_0x15e6('0x3e')](function(_0x37eef8){if(_0x37eef8){return _0x37eef8?{'count':_0x2be088,'rows':_0x37eef8}:null;}})[_0x15e6('0x3e')](respondWithResult(_0x4d05cc,null))[_0x15e6('0x42')](handleError(_0x4d05cc,null));};exports['setTags']=function(_0x274d0c,_0x58bbe2,_0x458e3a){if(_0x274d0c[_0x15e6('0x4b')]['id']){delete _0x274d0c[_0x15e6('0x4b')]['id'];}return db[_0x15e6('0x3d')][_0x15e6('0x4e')]({'where':{'id':_0x274d0c[_0x15e6('0x4a')]['id']}})[_0x15e6('0x3e')](handleEntityNotFound(_0x58bbe2,null))['then'](function(_0x2b74f0){if(_0x2b74f0){return _0x2b74f0[_0x15e6('0x54')](_0x274d0c[_0x15e6('0x4b')][_0x15e6('0x55')]||[]);}return null;})['then'](respondWithResult(_0x58bbe2,null))[_0x15e6('0x42')](handleError(_0x58bbe2,null));}; \ No newline at end of file +var _0x1c16=['getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','map','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','FreshdeskConfiguration','rows','show','params','find','catch','create','body','getFields','findOne','getDescriptions','FreshdeskField'];(function(_0x2dbed7,_0x2962d5){var _0x326efc=function(_0x1713b3){while(--_0x1713b3){_0x2dbed7['push'](_0x2dbed7['shift']());}};_0x326efc(++_0x2962d5);}(_0x1c16,0x14b));var _0x61c1=function(_0x1c5968,_0x68d40c){_0x1c5968=_0x1c5968-0x0;var _0x290441=_0x1c16[_0x1c5968];return _0x290441;};'use strict';var emlformat=require(_0x61c1('0x0'));var rimraf=require(_0x61c1('0x1'));var zipdir=require(_0x61c1('0x2'));var jsonpatch=require(_0x61c1('0x3'));var rp=require(_0x61c1('0x4'));var moment=require('moment');var BPromise=require(_0x61c1('0x5'));var Mustache=require(_0x61c1('0x6'));var util=require(_0x61c1('0x7'));var path=require(_0x61c1('0x8'));var sox=require(_0x61c1('0x9'));var csv=require(_0x61c1('0xa'));var ejs=require(_0x61c1('0xb'));var fs=require('fs');var fs_extra=require(_0x61c1('0xc'));var _=require(_0x61c1('0xd'));var squel=require(_0x61c1('0xe'));var crypto=require('crypto');var jsforce=require(_0x61c1('0xf'));var deskjs=require(_0x61c1('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x61c1('0x11'));var Redis=require(_0x61c1('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x61c1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x61c1('0x14'));var logger=require(_0x61c1('0x15'))(_0x61c1('0x16'));var utils=require(_0x61c1('0x17'));var config=require(_0x61c1('0x18'));var licenseUtil=require(_0x61c1('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e2edf,_0x121f83){_0x121f83=_0x121f83||0xcc;return function(_0x47c6db){if(_0x47c6db){return _0x5e2edf['sendStatus'](_0x121f83);}return _0x5e2edf[_0x61c1('0x1a')](_0x121f83)['end']();};}function respondWithResult(_0x3e8d0a,_0x596fce){_0x596fce=_0x596fce||0xc8;return function(_0xb1d237){if(_0xb1d237){return _0x3e8d0a[_0x61c1('0x1a')](_0x596fce)[_0x61c1('0x1b')](_0xb1d237);}};}function respondWithFilteredResult(_0x273724,_0x396e63){return function(_0x54724e){if(_0x54724e){var _0xe14fc2=typeof _0x396e63['offset']===_0x61c1('0x1c')&&typeof _0x396e63[_0x61c1('0x1d')]===_0x61c1('0x1c');var _0x275383=_0x54724e['count'];var _0x39add8=_0xe14fc2?0x0:_0x396e63[_0x61c1('0x1e')];var _0xd03e84=_0xe14fc2?_0x54724e[_0x61c1('0x1f')]:_0x396e63['offset']+_0x396e63[_0x61c1('0x1d')];var _0x457513;if(_0xd03e84>=_0x275383){_0xd03e84=_0x275383;_0x457513=0xc8;}else{_0x457513=0xce;}_0x273724[_0x61c1('0x1a')](_0x457513);return _0x273724[_0x61c1('0x20')](_0x61c1('0x21'),_0x39add8+'-'+_0xd03e84+'/'+_0x275383)[_0x61c1('0x1b')](_0x54724e);}return null;};}function patchUpdates(_0x4a3d5b){return function(_0x566b12){try{jsonpatch[_0x61c1('0x22')](_0x566b12,_0x4a3d5b,!![]);}catch(_0x36cfe5){return BPromise[_0x61c1('0x23')](_0x36cfe5);}return _0x566b12[_0x61c1('0x24')]();};}function saveUpdates(_0x30aef5,_0x458a58){return function(_0x597111){if(_0x597111){return _0x597111[_0x61c1('0x25')](_0x30aef5)[_0x61c1('0x26')](function(_0x44bcd3){return _0x44bcd3;});}return null;};}function removeEntity(_0x31a3a5,_0x46ec92){return function(_0x225854){if(_0x225854){return _0x225854[_0x61c1('0x27')]()[_0x61c1('0x26')](function(){_0x31a3a5[_0x61c1('0x1a')](0xcc)[_0x61c1('0x28')]();});}};}function handleEntityNotFound(_0x48b8db,_0xfd5dd7){return function(_0xe84bd0){if(!_0xe84bd0){_0x48b8db['sendStatus'](0x194);}return _0xe84bd0;};}function handleError(_0x20306e,_0x17e233){_0x17e233=_0x17e233||0x1f4;return function(_0x494396){logger['error'](_0x494396[_0x61c1('0x29')]);if(_0x494396[_0x61c1('0x2a')]){delete _0x494396[_0x61c1('0x2a')];}_0x20306e[_0x61c1('0x1a')](_0x17e233)[_0x61c1('0x2b')](_0x494396);};}exports['index']=function(_0x106702,_0x2b3f65){var _0x14ee72={},_0x51ba30={},_0x43bd50={'count':0x0,'rows':[]};var _0x6d2a29=_[_0x61c1('0x2c')](db['FreshdeskConfiguration'][_0x61c1('0x2d')],function(_0x2026a0){return{'name':_0x2026a0['fieldName'],'type':_0x2026a0['type']['key']};});_0x51ba30[_0x61c1('0x2e')]=_[_0x61c1('0x2c')](_0x6d2a29,_0x61c1('0x2a'));_0x51ba30['query']=_[_0x61c1('0x2f')](_0x106702[_0x61c1('0x30')]);_0x51ba30[_0x61c1('0x31')]=_[_0x61c1('0x32')](_0x51ba30[_0x61c1('0x2e')],_0x51ba30[_0x61c1('0x30')]);_0x14ee72[_0x61c1('0x33')]=_[_0x61c1('0x32')](_0x51ba30[_0x61c1('0x2e')],qs[_0x61c1('0x34')](_0x106702[_0x61c1('0x30')][_0x61c1('0x34')]));_0x14ee72['attributes']=_0x14ee72[_0x61c1('0x33')][_0x61c1('0x35')]?_0x14ee72[_0x61c1('0x33')]:_0x51ba30['model'];if(!_0x106702[_0x61c1('0x30')][_0x61c1('0x36')](_0x61c1('0x37'))){_0x14ee72[_0x61c1('0x1d')]=qs[_0x61c1('0x1d')](_0x106702[_0x61c1('0x30')][_0x61c1('0x1d')]);_0x14ee72[_0x61c1('0x1e')]=qs[_0x61c1('0x1e')](_0x106702[_0x61c1('0x30')][_0x61c1('0x1e')]);}_0x14ee72[_0x61c1('0x38')]=qs[_0x61c1('0x39')](_0x106702[_0x61c1('0x30')]['sort']);_0x14ee72['where']=qs['filters'](_[_0x61c1('0x3a')](_0x106702[_0x61c1('0x30')],_0x51ba30['filters']),_0x6d2a29);if(_0x106702[_0x61c1('0x30')][_0x61c1('0x3b')]){_0x14ee72[_0x61c1('0x3c')]=_[_0x61c1('0x3d')](_0x14ee72[_0x61c1('0x3c')],{'$or':_[_0x61c1('0x2c')](_0x6d2a29,function(_0xdfb125){if(_0xdfb125[_0x61c1('0x3e')]!==_0x61c1('0x3f')){var _0xb01855={};_0xb01855[_0xdfb125[_0x61c1('0x2a')]]={'$like':'%'+_0x106702[_0x61c1('0x30')]['filter']+'%'};return _0xb01855;}})});}_0x14ee72=_[_0x61c1('0x3d')]({},_0x14ee72,_0x106702[_0x61c1('0x40')]);var _0x11802d={'where':_0x14ee72[_0x61c1('0x3c')]};return db['FreshdeskConfiguration'][_0x61c1('0x1f')](_0x11802d)[_0x61c1('0x26')](function(_0x42d098){_0x43bd50['count']=_0x42d098;if(_0x106702['query'][_0x61c1('0x41')]){_0x14ee72[_0x61c1('0x42')]=[{'all':!![]}];}return db[_0x61c1('0x43')]['findAll'](_0x14ee72);})[_0x61c1('0x26')](function(_0x288d9d){_0x43bd50[_0x61c1('0x44')]=_0x288d9d;return _0x43bd50;})[_0x61c1('0x26')](respondWithFilteredResult(_0x2b3f65,_0x14ee72))['catch'](handleError(_0x2b3f65,null));};exports[_0x61c1('0x45')]=function(_0x37e051,_0x3196b6){var _0x1471ad={'raw':![],'where':{'id':_0x37e051[_0x61c1('0x46')]['id']}},_0x42e71c={};_0x42e71c[_0x61c1('0x2e')]=_['keys'](db[_0x61c1('0x43')][_0x61c1('0x2d')]);_0x42e71c[_0x61c1('0x30')]=_['keys'](_0x37e051['query']);_0x42e71c[_0x61c1('0x31')]=_[_0x61c1('0x32')](_0x42e71c[_0x61c1('0x2e')],_0x42e71c[_0x61c1('0x30')]);_0x1471ad[_0x61c1('0x33')]=_[_0x61c1('0x32')](_0x42e71c[_0x61c1('0x2e')],qs[_0x61c1('0x34')](_0x37e051[_0x61c1('0x30')]['fields']));_0x1471ad[_0x61c1('0x33')]=_0x1471ad[_0x61c1('0x33')][_0x61c1('0x35')]?_0x1471ad[_0x61c1('0x33')]:_0x42e71c['model'];if(_0x37e051[_0x61c1('0x30')][_0x61c1('0x41')]){_0x1471ad[_0x61c1('0x42')]=[{'all':!![]}];}_0x1471ad=_[_0x61c1('0x3d')]({},_0x1471ad,_0x37e051['options']);return db[_0x61c1('0x43')][_0x61c1('0x47')](_0x1471ad)['then'](handleEntityNotFound(_0x3196b6,null))[_0x61c1('0x26')](respondWithResult(_0x3196b6,null))[_0x61c1('0x48')](handleError(_0x3196b6,null));};exports['create']=function(_0x307320,_0x3b89fa){return db['FreshdeskConfiguration'][_0x61c1('0x49')](_0x307320['body'],{})[_0x61c1('0x26')](respondWithResult(_0x3b89fa,0xc9))[_0x61c1('0x48')](handleError(_0x3b89fa,null));};exports[_0x61c1('0x25')]=function(_0x473e5c,_0x525433){if(_0x473e5c[_0x61c1('0x4a')]['id']){delete _0x473e5c[_0x61c1('0x4a')]['id'];}return db[_0x61c1('0x43')][_0x61c1('0x47')]({'where':{'id':_0x473e5c[_0x61c1('0x46')]['id']}})['then'](handleEntityNotFound(_0x525433,null))['then'](saveUpdates(_0x473e5c[_0x61c1('0x4a')],null))['then'](respondWithResult(_0x525433,null))[_0x61c1('0x48')](handleError(_0x525433,null));};exports['destroy']=function(_0x4addbd,_0x3614e3){return db[_0x61c1('0x43')][_0x61c1('0x47')]({'where':{'id':_0x4addbd[_0x61c1('0x46')]['id']}})['then'](handleEntityNotFound(_0x3614e3,null))[_0x61c1('0x26')](removeEntity(_0x3614e3,null))['catch'](handleError(_0x3614e3,null));};exports[_0x61c1('0x4b')]=function(_0x3abbb2,_0x56fa00,_0xbc38b4){var _0x16938c={};var _0x30e0e3={};var _0x19fc4c;var _0x1c06e0;return db[_0x61c1('0x43')][_0x61c1('0x4c')]({'where':{'id':_0x3abbb2[_0x61c1('0x46')]['id']}})[_0x61c1('0x26')](handleEntityNotFound(_0x56fa00,null))[_0x61c1('0x26')](function(_0x203bb3){if(_0x203bb3){_0x19fc4c=_0x203bb3;_0x30e0e3['model']=_[_0x61c1('0x2f')](db['FreshdeskField'][_0x61c1('0x2d')]);_0x30e0e3[_0x61c1('0x30')]=_[_0x61c1('0x2f')](_0x3abbb2['query']);_0x30e0e3['filters']=_[_0x61c1('0x32')](_0x30e0e3[_0x61c1('0x2e')],_0x30e0e3[_0x61c1('0x30')]);_0x16938c[_0x61c1('0x33')]=_[_0x61c1('0x32')](_0x30e0e3['model'],qs['fields'](_0x3abbb2['query'][_0x61c1('0x34')]));_0x16938c[_0x61c1('0x33')]=_0x16938c['attributes'][_0x61c1('0x35')]?_0x16938c[_0x61c1('0x33')]:_0x30e0e3[_0x61c1('0x2e')];_0x16938c['order']=qs[_0x61c1('0x39')](_0x3abbb2['query']['sort']);_0x16938c[_0x61c1('0x3c')]=qs[_0x61c1('0x31')](_[_0x61c1('0x3a')](_0x3abbb2[_0x61c1('0x30')],_0x30e0e3[_0x61c1('0x31')]));if(_0x3abbb2[_0x61c1('0x30')][_0x61c1('0x3b')]){_0x16938c['where']=_[_0x61c1('0x3d')](_0x16938c[_0x61c1('0x3c')],{'$or':_[_0x61c1('0x2c')](_0x16938c[_0x61c1('0x33')],function(_0xe6b6e9){var _0x2965b5={};_0x2965b5[_0xe6b6e9]={'$like':'%'+_0x3abbb2[_0x61c1('0x30')][_0x61c1('0x3b')]+'%'};return _0x2965b5;})});}_0x16938c=_[_0x61c1('0x3d')]({},_0x16938c,_0x3abbb2['options']);return _0x19fc4c[_0x61c1('0x4b')](_0x16938c);}})[_0x61c1('0x26')](function(_0x12febf){if(_0x12febf){_0x1c06e0=_0x12febf[_0x61c1('0x35')];if(!_0x3abbb2['query'][_0x61c1('0x36')]('nolimit')){_0x16938c['limit']=qs[_0x61c1('0x1d')](_0x3abbb2[_0x61c1('0x30')][_0x61c1('0x1d')]);_0x16938c[_0x61c1('0x1e')]=qs['offset'](_0x3abbb2[_0x61c1('0x30')][_0x61c1('0x1e')]);}return _0x19fc4c['getFields'](_0x16938c);}})[_0x61c1('0x26')](function(_0x44c6ef){if(_0x44c6ef){return _0x44c6ef?{'count':_0x1c06e0,'rows':_0x44c6ef}:null;}})[_0x61c1('0x26')](respondWithResult(_0x56fa00,null))['catch'](handleError(_0x56fa00,null));};exports['getSubjects']=function(_0x1bdb2a,_0x2cd1f7,_0x2d6c8f){var _0x3043db={};var _0x29633d={};var _0x2c738d;var _0xe4abd5;return db[_0x61c1('0x43')]['findOne']({'where':{'id':_0x1bdb2a[_0x61c1('0x46')]['id']}})[_0x61c1('0x26')](handleEntityNotFound(_0x2cd1f7,null))['then'](function(_0x4bc66d){if(_0x4bc66d){_0x2c738d=_0x4bc66d;_0x29633d[_0x61c1('0x2e')]=_[_0x61c1('0x2f')](db['FreshdeskField']['rawAttributes']);_0x29633d['query']=_['keys'](_0x1bdb2a[_0x61c1('0x30')]);_0x29633d[_0x61c1('0x31')]=_[_0x61c1('0x32')](_0x29633d[_0x61c1('0x2e')],_0x29633d[_0x61c1('0x30')]);_0x3043db[_0x61c1('0x33')]=_[_0x61c1('0x32')](_0x29633d[_0x61c1('0x2e')],qs[_0x61c1('0x34')](_0x1bdb2a[_0x61c1('0x30')][_0x61c1('0x34')]));_0x3043db['attributes']=_0x3043db[_0x61c1('0x33')]['length']?_0x3043db['attributes']:_0x29633d[_0x61c1('0x2e')];_0x3043db[_0x61c1('0x38')]=qs['sort'](_0x1bdb2a[_0x61c1('0x30')]['sort']);_0x3043db[_0x61c1('0x3c')]=qs[_0x61c1('0x31')](_[_0x61c1('0x3a')](_0x1bdb2a[_0x61c1('0x30')],_0x29633d[_0x61c1('0x31')]));if(_0x1bdb2a[_0x61c1('0x30')]['filter']){_0x3043db[_0x61c1('0x3c')]=_[_0x61c1('0x3d')](_0x3043db[_0x61c1('0x3c')],{'$or':_[_0x61c1('0x2c')](_0x3043db['attributes'],function(_0x141805){var _0x31b076={};_0x31b076[_0x141805]={'$like':'%'+_0x1bdb2a[_0x61c1('0x30')]['filter']+'%'};return _0x31b076;})});}_0x3043db=_[_0x61c1('0x3d')]({},_0x3043db,_0x1bdb2a[_0x61c1('0x40')]);return _0x2c738d['getSubjects'](_0x3043db);}})['then'](function(_0xd7408a){if(_0xd7408a){_0xe4abd5=_0xd7408a[_0x61c1('0x35')];if(!_0x1bdb2a['query'][_0x61c1('0x36')]('nolimit')){_0x3043db[_0x61c1('0x1d')]=qs[_0x61c1('0x1d')](_0x1bdb2a[_0x61c1('0x30')][_0x61c1('0x1d')]);_0x3043db['offset']=qs[_0x61c1('0x1e')](_0x1bdb2a[_0x61c1('0x30')][_0x61c1('0x1e')]);}return _0x2c738d['getSubjects'](_0x3043db);}})[_0x61c1('0x26')](function(_0x50f2c5){if(_0x50f2c5){return _0x50f2c5?{'count':_0xe4abd5,'rows':_0x50f2c5}:null;}})[_0x61c1('0x26')](respondWithResult(_0x2cd1f7,null))['catch'](handleError(_0x2cd1f7,null));};exports[_0x61c1('0x4d')]=function(_0x1dc6aa,_0x5f58fc,_0x2699b7){var _0x3e297c={};var _0x2ccf76={};var _0x15a884;var _0xec2e13;return db[_0x61c1('0x43')][_0x61c1('0x4c')]({'where':{'id':_0x1dc6aa[_0x61c1('0x46')]['id']}})[_0x61c1('0x26')](handleEntityNotFound(_0x5f58fc,null))[_0x61c1('0x26')](function(_0x6d5a82){if(_0x6d5a82){_0x15a884=_0x6d5a82;_0x2ccf76[_0x61c1('0x2e')]=_[_0x61c1('0x2f')](db[_0x61c1('0x4e')][_0x61c1('0x2d')]);_0x2ccf76['query']=_[_0x61c1('0x2f')](_0x1dc6aa[_0x61c1('0x30')]);_0x2ccf76[_0x61c1('0x31')]=_[_0x61c1('0x32')](_0x2ccf76['model'],_0x2ccf76[_0x61c1('0x30')]);_0x3e297c[_0x61c1('0x33')]=_[_0x61c1('0x32')](_0x2ccf76[_0x61c1('0x2e')],qs[_0x61c1('0x34')](_0x1dc6aa[_0x61c1('0x30')][_0x61c1('0x34')]));_0x3e297c[_0x61c1('0x33')]=_0x3e297c['attributes']['length']?_0x3e297c['attributes']:_0x2ccf76[_0x61c1('0x2e')];_0x3e297c[_0x61c1('0x38')]=qs[_0x61c1('0x39')](_0x1dc6aa['query'][_0x61c1('0x39')]);_0x3e297c['where']=qs['filters'](_[_0x61c1('0x3a')](_0x1dc6aa[_0x61c1('0x30')],_0x2ccf76[_0x61c1('0x31')]));if(_0x1dc6aa[_0x61c1('0x30')]['filter']){_0x3e297c[_0x61c1('0x3c')]=_[_0x61c1('0x3d')](_0x3e297c[_0x61c1('0x3c')],{'$or':_[_0x61c1('0x2c')](_0x3e297c['attributes'],function(_0x4a5c60){var _0x52d8ab={};_0x52d8ab[_0x4a5c60]={'$like':'%'+_0x1dc6aa[_0x61c1('0x30')][_0x61c1('0x3b')]+'%'};return _0x52d8ab;})});}_0x3e297c=_[_0x61c1('0x3d')]({},_0x3e297c,_0x1dc6aa[_0x61c1('0x40')]);return _0x15a884[_0x61c1('0x4d')](_0x3e297c);}})['then'](function(_0x1b2f56){if(_0x1b2f56){_0xec2e13=_0x1b2f56[_0x61c1('0x35')];if(!_0x1dc6aa[_0x61c1('0x30')][_0x61c1('0x36')](_0x61c1('0x37'))){_0x3e297c[_0x61c1('0x1d')]=qs[_0x61c1('0x1d')](_0x1dc6aa['query']['limit']);_0x3e297c[_0x61c1('0x1e')]=qs[_0x61c1('0x1e')](_0x1dc6aa[_0x61c1('0x30')]['offset']);}return _0x15a884[_0x61c1('0x4d')](_0x3e297c);}})['then'](function(_0x2eca48){if(_0x2eca48){return _0x2eca48?{'count':_0xec2e13,'rows':_0x2eca48}:null;}})[_0x61c1('0x26')](respondWithResult(_0x5f58fc,null))['catch'](handleError(_0x5f58fc,null));};exports[_0x61c1('0x4f')]=function(_0x526fbd,_0x57a707,_0x5f442e){var _0x17569a={};var _0x388287={};var _0x5072c2;var _0x22d9b1;return db[_0x61c1('0x43')][_0x61c1('0x4c')]({'where':{'id':_0x526fbd[_0x61c1('0x46')]['id']}})[_0x61c1('0x26')](handleEntityNotFound(_0x57a707,null))[_0x61c1('0x26')](function(_0x58c3a3){if(_0x58c3a3){_0x5072c2=_0x58c3a3;_0x388287['model']=_['keys'](db['Tag'][_0x61c1('0x2d')]);_0x388287[_0x61c1('0x30')]=_[_0x61c1('0x2f')](_0x526fbd[_0x61c1('0x30')]);_0x388287['filters']=_['intersection'](_0x388287['model'],_0x388287[_0x61c1('0x30')]);_0x17569a[_0x61c1('0x33')]=_[_0x61c1('0x32')](_0x388287[_0x61c1('0x2e')],qs[_0x61c1('0x34')](_0x526fbd[_0x61c1('0x30')][_0x61c1('0x34')]));_0x17569a[_0x61c1('0x33')]=_0x17569a[_0x61c1('0x33')][_0x61c1('0x35')]?_0x17569a[_0x61c1('0x33')]:_0x388287[_0x61c1('0x2e')];_0x17569a['order']=qs['sort'](_0x526fbd['query'][_0x61c1('0x39')]);_0x17569a[_0x61c1('0x3c')]=qs['filters'](_[_0x61c1('0x3a')](_0x526fbd['query'],_0x388287[_0x61c1('0x31')]));if(_0x526fbd[_0x61c1('0x30')]['filter']){_0x17569a[_0x61c1('0x3c')]=_['merge'](_0x17569a[_0x61c1('0x3c')],{'$or':_['map'](_0x17569a[_0x61c1('0x33')],function(_0x4dec27){var _0x5af729={};_0x5af729[_0x4dec27]={'$like':'%'+_0x526fbd[_0x61c1('0x30')]['filter']+'%'};return _0x5af729;})});}_0x17569a=_['merge']({},_0x17569a,_0x526fbd[_0x61c1('0x40')]);return _0x5072c2[_0x61c1('0x4f')](_0x17569a);}})['then'](function(_0x4622ae){if(_0x4622ae){_0x22d9b1=_0x4622ae[_0x61c1('0x35')];if(!_0x526fbd[_0x61c1('0x30')]['hasOwnProperty'](_0x61c1('0x37'))){_0x17569a[_0x61c1('0x1d')]=qs['limit'](_0x526fbd[_0x61c1('0x30')]['limit']);_0x17569a[_0x61c1('0x1e')]=qs[_0x61c1('0x1e')](_0x526fbd[_0x61c1('0x30')][_0x61c1('0x1e')]);}return _0x5072c2[_0x61c1('0x4f')](_0x17569a);}})[_0x61c1('0x26')](function(_0x631ccd){if(_0x631ccd){return _0x631ccd?{'count':_0x22d9b1,'rows':_0x631ccd}:null;}})[_0x61c1('0x26')](respondWithResult(_0x57a707,null))[_0x61c1('0x48')](handleError(_0x57a707,null));};exports[_0x61c1('0x50')]=function(_0x119a9d,_0x70d23f,_0x47fa23){if(_0x119a9d[_0x61c1('0x4a')]['id']){delete _0x119a9d[_0x61c1('0x4a')]['id'];}return db[_0x61c1('0x43')][_0x61c1('0x4c')]({'where':{'id':_0x119a9d['params']['id']}})[_0x61c1('0x26')](handleEntityNotFound(_0x70d23f,null))[_0x61c1('0x26')](function(_0x3f7075){if(_0x3f7075){return _0x3f7075[_0x61c1('0x50')](_0x119a9d[_0x61c1('0x4a')][_0x61c1('0x51')]||[]);}return null;})[_0x61c1('0x26')](respondWithResult(_0x70d23f,null))['catch'](handleError(_0x70d23f,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 3d73a94..d7e7bb3 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 _0xb6d2=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations'];(function(_0x15af0f,_0x5454ce){var _0x2bd1cb=function(_0x593818){while(--_0x593818){_0x15af0f['push'](_0x15af0f['shift']());}};_0x2bd1cb(++_0x5454ce);}(_0xb6d2,0x13b));var _0x2b6d=function(_0x36043b,_0x1fedf5){_0x36043b=_0x36043b-0x0;var _0x41e08e=_0xb6d2[_0x36043b];return _0x41e08e;};'use strict';var _=require(_0x2b6d('0x0'));var util=require(_0x2b6d('0x1'));var logger=require(_0x2b6d('0x2'))(_0x2b6d('0x3'));var moment=require(_0x2b6d('0x4'));var BPromise=require(_0x2b6d('0x5'));var rp=require(_0x2b6d('0x6'));var fs=require('fs');var path=require(_0x2b6d('0x7'));var rimraf=require(_0x2b6d('0x8'));var config=require(_0x2b6d('0x9'));var attributes=require(_0x2b6d('0xa'));module[_0x2b6d('0xb')]=function(_0x1a2fb5,_0x2261f2){return _0x1a2fb5[_0x2b6d('0xc')](_0x2b6d('0xd'),attributes,{'tableName':_0x2b6d('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c66=['define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','api','moment','bluebird','request-promise','path','./intFreshdeskConfiguration.attributes'];(function(_0x3270fa,_0x5121ed){var _0x5e1dac=function(_0x456c2b){while(--_0x456c2b){_0x3270fa['push'](_0x3270fa['shift']());}};_0x5e1dac(++_0x5121ed);}(_0x4c66,0x14d));var _0x64c6=function(_0x5c53f8,_0x47acd1){_0x5c53f8=_0x5c53f8-0x0;var _0x44d9b3=_0x4c66[_0x5c53f8];return _0x44d9b3;};'use strict';var _=require(_0x64c6('0x0'));var util=require(_0x64c6('0x1'));var logger=require('../../config/logger')(_0x64c6('0x2'));var moment=require(_0x64c6('0x3'));var BPromise=require(_0x64c6('0x4'));var rp=require(_0x64c6('0x5'));var fs=require('fs');var path=require(_0x64c6('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x64c6('0x7'));module['exports']=function(_0x54f0da,_0x38056a){return _0x54f0da[_0x64c6('0x8')](_0x64c6('0x9'),attributes,{'tableName':_0x64c6('0xa'),'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 64971f4..36da0ee 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 _0x83de=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x83de,0x1f4));var _0xe83d=function(_0x51a055,_0x2a38ee){_0x51a055=_0x51a055-0x0;var _0x1a404d=_0x83de[_0x51a055];return _0x1a404d;};'use strict';var _=require(_0xe83d('0x0'));var util=require(_0xe83d('0x1'));var moment=require('moment');var BPromise=require(_0xe83d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe83d('0x3'));var db=require(_0xe83d('0x4'))['db'];var utils=require(_0xe83d('0x5'));var logger=require(_0xe83d('0x6'))(_0xe83d('0x7'));var config=require(_0xe83d('0x8'));var jayson=require(_0xe83d('0x9'));var client=jayson['client'][_0xe83d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3167fe,_0x57d926,_0x348a5a){return new BPromise(function(_0x4a6742,_0x1207c5){return client[_0xe83d('0xb')](_0x3167fe,_0x348a5a)[_0xe83d('0xc')](function(_0x814780){logger[_0xe83d('0xd')](_0xe83d('0xe'),_0x57d926,_0xe83d('0xf'));logger[_0xe83d('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x57d926,'request\x20sent',JSON[_0xe83d('0x11')](_0x814780));if(_0x814780['error']){if(_0x814780['error'][_0xe83d('0x12')]===0x1f4){logger[_0xe83d('0x13')](_0xe83d('0xe'),_0x57d926,_0x814780[_0xe83d('0x13')][_0xe83d('0x14')]);return _0x1207c5(_0x814780[_0xe83d('0x13')]['message']);}logger['error'](_0xe83d('0xe'),_0x57d926,_0x814780[_0xe83d('0x13')]['message']);return _0x4a6742(_0x814780[_0xe83d('0x13')][_0xe83d('0x14')]);}else{logger[_0xe83d('0xd')](_0xe83d('0xe'),_0x57d926,_0xe83d('0xf'));_0x4a6742(_0x814780[_0xe83d('0x15')]['message']);}})[_0xe83d('0x16')](function(_0x3c7566){logger[_0xe83d('0x13')](_0xe83d('0xe'),_0x57d926,_0x3c7566);_0x1207c5(_0x3c7566);});});} \ No newline at end of file +var _0xb1b6=['catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xb1b6,0x1e1));var _0x6b1b=function(_0x384efe,_0x13ffb6){_0x384efe=_0x384efe-0x0;var _0x2a18fd=_0xb1b6[_0x384efe];return _0x2a18fd;};'use strict';var _=require('lodash');var util=require(_0x6b1b('0x0'));var moment=require(_0x6b1b('0x1'));var BPromise=require(_0x6b1b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6b1b('0x3'));var db=require(_0x6b1b('0x4'))['db'];var utils=require(_0x6b1b('0x5'));var logger=require(_0x6b1b('0x6'))(_0x6b1b('0x7'));var config=require('../../config/environment');var jayson=require(_0x6b1b('0x8'));var client=jayson[_0x6b1b('0x9')][_0x6b1b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x146ffe,_0x19ad31,_0x4edcec){return new BPromise(function(_0x531d30,_0x4d90ba){return client['request'](_0x146ffe,_0x4edcec)[_0x6b1b('0xb')](function(_0x3794c1){logger[_0x6b1b('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x19ad31,_0x6b1b('0xd'));logger['debug']('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x19ad31,_0x6b1b('0xd'),JSON[_0x6b1b('0xe')](_0x3794c1));if(_0x3794c1['error']){if(_0x3794c1[_0x6b1b('0xf')][_0x6b1b('0x10')]===0x1f4){logger[_0x6b1b('0xf')](_0x6b1b('0x11'),_0x19ad31,_0x3794c1[_0x6b1b('0xf')][_0x6b1b('0x12')]);return _0x4d90ba(_0x3794c1['error']['message']);}logger['error'](_0x6b1b('0x11'),_0x19ad31,_0x3794c1['error'][_0x6b1b('0x12')]);return _0x531d30(_0x3794c1[_0x6b1b('0xf')]['message']);}else{logger[_0x6b1b('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x19ad31,_0x6b1b('0xd'));_0x531d30(_0x3794c1['result']['message']);}})[_0x6b1b('0x13')](function(_0x2f19b1){logger[_0x6b1b('0xf')](_0x6b1b('0x11'),_0x19ad31,_0x2f19b1);_0x4d90ba(_0x2f19b1);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index cf29dac..9208b2a 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 _0xd43e=['isAuthenticated','index','/:id','show','put','update','delete','exports','util','Router','fs-extra','../../components/interaction/service','./intFreshdeskField.controller','get'];(function(_0x5b8fe7,_0x1418d6){var _0x5c9c38=function(_0x30d011){while(--_0x30d011){_0x5b8fe7['push'](_0x5b8fe7['shift']());}};_0x5c9c38(++_0x1418d6);}(_0xd43e,0xe8));var _0xed43=function(_0x216446,_0x28d139){_0x216446=_0x216446-0x0;var _0x4b200b=_0xd43e[_0x216446];return _0x4b200b;};'use strict';var multer=require('multer');var util=require(_0xed43('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xed43('0x1')]();var fs_extra=require(_0xed43('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xed43('0x3'));var config=require('../../config/environment');var controller=require(_0xed43('0x4'));router[_0xed43('0x5')]('/',auth[_0xed43('0x6')](),controller[_0xed43('0x7')]);router['get'](_0xed43('0x8'),auth['isAuthenticated'](),controller[_0xed43('0x9')]);router['post']('/',auth[_0xed43('0x6')](),controller['create']);router[_0xed43('0xa')](_0xed43('0x8'),auth[_0xed43('0x6')](),controller[_0xed43('0xb')]);router[_0xed43('0xc')](_0xed43('0x8'),auth[_0xed43('0x6')](),controller['destroy']);module[_0xed43('0xd')]=router; \ No newline at end of file +var _0xa9dd=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskField.controller','isAuthenticated','index','get','/:id','show','create','update','delete','destroy','multer'];(function(_0x54f859,_0x59d463){var _0x17a08b=function(_0x3f8e49){while(--_0x3f8e49){_0x54f859['push'](_0x54f859['shift']());}};_0x17a08b(++_0x59d463);}(_0xa9dd,0x10f));var _0xda9d=function(_0x912d27,_0x28e0e3){_0x912d27=_0x912d27-0x0;var _0x31b918=_0xa9dd[_0x912d27];return _0x31b918;};'use strict';var multer=require(_0xda9d('0x0'));var util=require('util');var path=require(_0xda9d('0x1'));var timeout=require('connect-timeout');var express=require(_0xda9d('0x2'));var router=express[_0xda9d('0x3')]();var fs_extra=require(_0xda9d('0x4'));var auth=require(_0xda9d('0x5'));var interaction=require(_0xda9d('0x6'));var config=require('../../config/environment');var controller=require(_0xda9d('0x7'));router['get']('/',auth[_0xda9d('0x8')](),controller[_0xda9d('0x9')]);router[_0xda9d('0xa')](_0xda9d('0xb'),auth['isAuthenticated'](),controller[_0xda9d('0xc')]);router['post']('/',auth[_0xda9d('0x8')](),controller[_0xda9d('0xd')]);router['put'](_0xda9d('0xb'),auth[_0xda9d('0x8')](),controller[_0xda9d('0xe')]);router[_0xda9d('0xf')](_0xda9d('0xb'),auth[_0xda9d('0x8')](),controller[_0xda9d('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 978f6b4..667d563 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 _0x08f0=['STRING','ENUM','customVariable','sequelize','exports','string','variable','keyValue'];(function(_0x3492b4,_0x56932a){var _0xff19e9=function(_0x1503e4){while(--_0x1503e4){_0x3492b4['push'](_0x3492b4['shift']());}};_0xff19e9(++_0x56932a);}(_0x08f0,0x1e3));var _0x008f=function(_0x2fd873,_0x51262f){_0x2fd873=_0x2fd873-0x0;var _0x23e544=_0x08f0[_0x2fd873];return _0x23e544;};'use strict';var Sequelize=require(_0x008f('0x0'));module[_0x008f('0x1')]={'type':{'type':Sequelize['ENUM'](_0x008f('0x2'),_0x008f('0x3'),'customVariable',_0x008f('0x4'),'picklist'),'defaultValue':_0x008f('0x2')},'content':{'type':Sequelize[_0x008f('0x5')]},'key':{'type':Sequelize[_0x008f('0x5')]},'keyType':{'type':Sequelize[_0x008f('0x6')]('string',_0x008f('0x3'),_0x008f('0x7'))},'keyContent':{'type':Sequelize[_0x008f('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x008f('0x5')]}}; \ No newline at end of file +var _0xaae7=['keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize','string','variable','customVariable'];(function(_0x7e38f5,_0x2e16c9){var _0x2b6323=function(_0x141322){while(--_0x141322){_0x7e38f5['push'](_0x7e38f5['shift']());}};_0x2b6323(++_0x2e16c9);}(_0xaae7,0x1eb));var _0x7aae=function(_0x2ea4e6,_0x4e225a){_0x2ea4e6=_0x2ea4e6-0x0;var _0x5f2a28=_0xaae7[_0x2ea4e6];return _0x5f2a28;};'use strict';var Sequelize=require(_0x7aae('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x7aae('0x1'),_0x7aae('0x2'),_0x7aae('0x3'),_0x7aae('0x4'),_0x7aae('0x5')),'defaultValue':_0x7aae('0x1')},'content':{'type':Sequelize[_0x7aae('0x6')]},'key':{'type':Sequelize[_0x7aae('0x6')]},'keyType':{'type':Sequelize[_0x7aae('0x7')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0x7aae('0x6')]},'idField':{'type':Sequelize[_0x7aae('0x6')]},'nameField':{'type':Sequelize[_0x7aae('0x6')]},'customField':{'type':Sequelize[_0x7aae('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 4102114..9204f88 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 _0xe600=['attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','name','options','include','FreshdeskField','findAll','rows','catch','show','includeAll','create','body','find','params','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','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','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields'];(function(_0x32fb9a,_0x3959a8){var _0x363750=function(_0x29cf49){while(--_0x29cf49){_0x32fb9a['push'](_0x32fb9a['shift']());}};_0x363750(++_0x3959a8);}(_0xe600,0x159));var _0x0e60=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe600[_0x2641f9];return _0x585741;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0e60('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0e60('0x1'));var rp=require(_0x0e60('0x2'));var moment=require(_0x0e60('0x3'));var BPromise=require(_0x0e60('0x4'));var Mustache=require(_0x0e60('0x5'));var util=require(_0x0e60('0x6'));var path=require(_0x0e60('0x7'));var sox=require(_0x0e60('0x8'));var csv=require(_0x0e60('0x9'));var ejs=require(_0x0e60('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e60('0xb'));var squel=require(_0x0e60('0xc'));var crypto=require(_0x0e60('0xd'));var jsforce=require(_0x0e60('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0e60('0x9'));var querystring=require(_0x0e60('0xf'));var Papa=require(_0x0e60('0x10'));var Redis=require(_0x0e60('0x11'));var authService=require(_0x0e60('0x12'));var qs=require(_0x0e60('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0e60('0x14'));var logger=require(_0x0e60('0x15'))(_0x0e60('0x16'));var utils=require(_0x0e60('0x17'));var config=require(_0x0e60('0x18'));var licenseUtil=require(_0x0e60('0x19'));var db=require(_0x0e60('0x1a'))['db'];function respondWithStatusCode(_0x2f5ee4,_0x540411){_0x540411=_0x540411||0xcc;return function(_0x2d848f){if(_0x2d848f){return _0x2f5ee4[_0x0e60('0x1b')](_0x540411);}return _0x2f5ee4[_0x0e60('0x1c')](_0x540411)[_0x0e60('0x1d')]();};}function respondWithResult(_0x45328b,_0x37bf95){_0x37bf95=_0x37bf95||0xc8;return function(_0x5d7f84){if(_0x5d7f84){return _0x45328b[_0x0e60('0x1c')](_0x37bf95)['json'](_0x5d7f84);}};}function respondWithFilteredResult(_0x91cd1,_0x128887){return function(_0x170890){if(_0x170890){var _0x5ab4ba=typeof _0x128887[_0x0e60('0x1e')]===_0x0e60('0x1f')&&typeof _0x128887[_0x0e60('0x20')]===_0x0e60('0x1f');var _0x2e6270=_0x170890['count'];var _0x992490=_0x5ab4ba?0x0:_0x128887[_0x0e60('0x1e')];var _0x599c1d=_0x5ab4ba?_0x170890[_0x0e60('0x21')]:_0x128887[_0x0e60('0x1e')]+_0x128887[_0x0e60('0x20')];var _0x504b31;if(_0x599c1d>=_0x2e6270){_0x599c1d=_0x2e6270;_0x504b31=0xc8;}else{_0x504b31=0xce;}_0x91cd1[_0x0e60('0x1c')](_0x504b31);return _0x91cd1['set'](_0x0e60('0x22'),_0x992490+'-'+_0x599c1d+'/'+_0x2e6270)[_0x0e60('0x23')](_0x170890);}return null;};}function patchUpdates(_0xb9f037){return function(_0xabf953){try{jsonpatch[_0x0e60('0x24')](_0xabf953,_0xb9f037,!![]);}catch(_0x31a63e){return BPromise[_0x0e60('0x25')](_0x31a63e);}return _0xabf953[_0x0e60('0x26')]();};}function saveUpdates(_0x352633,_0x10f875){return function(_0x22c0e0){if(_0x22c0e0){return _0x22c0e0[_0x0e60('0x27')](_0x352633)[_0x0e60('0x28')](function(_0x16985f){return _0x16985f;});}return null;};}function removeEntity(_0x4702f,_0x33f9f3){return function(_0x41642c){if(_0x41642c){return _0x41642c[_0x0e60('0x29')]()[_0x0e60('0x28')](function(){_0x4702f['status'](0xcc)[_0x0e60('0x1d')]();});}};}function handleEntityNotFound(_0x41ad9a,_0x5ea254){return function(_0x10451f){if(!_0x10451f){_0x41ad9a['sendStatus'](0x194);}return _0x10451f;};}function handleError(_0x3ddc19,_0x5665c2){_0x5665c2=_0x5665c2||0x1f4;return function(_0x48d950){logger[_0x0e60('0x2a')](_0x48d950[_0x0e60('0x2b')]);if(_0x48d950['name']){delete _0x48d950['name'];}_0x3ddc19[_0x0e60('0x1c')](_0x5665c2)['send'](_0x48d950);};}exports[_0x0e60('0x2c')]=function(_0x548919,_0x4e6b41){var _0x154478={},_0x3d3c13={},_0x2a282d={'count':0x0,'rows':[]};var _0x4d9b18=_[_0x0e60('0x2d')](db['FreshdeskField'][_0x0e60('0x2e')],function(_0x1d54c0){return{'name':_0x1d54c0[_0x0e60('0x2f')],'type':_0x1d54c0['type'][_0x0e60('0x30')]};});_0x3d3c13[_0x0e60('0x31')]=_[_0x0e60('0x2d')](_0x4d9b18,'name');_0x3d3c13[_0x0e60('0x32')]=_[_0x0e60('0x33')](_0x548919[_0x0e60('0x32')]);_0x3d3c13[_0x0e60('0x34')]=_[_0x0e60('0x35')](_0x3d3c13['model'],_0x3d3c13[_0x0e60('0x32')]);_0x154478['attributes']=_[_0x0e60('0x35')](_0x3d3c13['model'],qs[_0x0e60('0x36')](_0x548919[_0x0e60('0x32')][_0x0e60('0x36')]));_0x154478['attributes']=_0x154478[_0x0e60('0x37')][_0x0e60('0x38')]?_0x154478[_0x0e60('0x37')]:_0x3d3c13[_0x0e60('0x31')];if(!_0x548919[_0x0e60('0x32')][_0x0e60('0x39')](_0x0e60('0x3a'))){_0x154478[_0x0e60('0x20')]=qs[_0x0e60('0x20')](_0x548919[_0x0e60('0x32')][_0x0e60('0x20')]);_0x154478[_0x0e60('0x1e')]=qs['offset'](_0x548919[_0x0e60('0x32')][_0x0e60('0x1e')]);}_0x154478[_0x0e60('0x3b')]=qs[_0x0e60('0x3c')](_0x548919['query']['sort']);_0x154478[_0x0e60('0x3d')]=qs['filters'](_[_0x0e60('0x3e')](_0x548919['query'],_0x3d3c13[_0x0e60('0x34')]),_0x4d9b18);if(_0x548919[_0x0e60('0x32')][_0x0e60('0x3f')]){_0x154478[_0x0e60('0x3d')]=_[_0x0e60('0x40')](_0x154478[_0x0e60('0x3d')],{'$or':_[_0x0e60('0x2d')](_0x4d9b18,function(_0x39fac1){if(_0x39fac1[_0x0e60('0x41')]!==_0x0e60('0x42')){var _0xb0a66c={};_0xb0a66c[_0x39fac1[_0x0e60('0x43')]]={'$like':'%'+_0x548919['query'][_0x0e60('0x3f')]+'%'};return _0xb0a66c;}})});}_0x154478=_['merge']({},_0x154478,_0x548919[_0x0e60('0x44')]);var _0x266cae={'where':_0x154478['where']};return db['FreshdeskField'][_0x0e60('0x21')](_0x266cae)[_0x0e60('0x28')](function(_0x50b793){_0x2a282d[_0x0e60('0x21')]=_0x50b793;if(_0x548919[_0x0e60('0x32')]['includeAll']){_0x154478[_0x0e60('0x45')]=[{'all':!![]}];}return db[_0x0e60('0x46')][_0x0e60('0x47')](_0x154478);})[_0x0e60('0x28')](function(_0x3ac0f0){_0x2a282d[_0x0e60('0x48')]=_0x3ac0f0;return _0x2a282d;})[_0x0e60('0x28')](respondWithFilteredResult(_0x4e6b41,_0x154478))[_0x0e60('0x49')](handleError(_0x4e6b41,null));};exports[_0x0e60('0x4a')]=function(_0x4c89b4,_0x4a2a10){var _0x535c06={'raw':!![],'where':{'id':_0x4c89b4['params']['id']}},_0x39c7d4={};_0x39c7d4[_0x0e60('0x31')]=_[_0x0e60('0x33')](db[_0x0e60('0x46')]['rawAttributes']);_0x39c7d4[_0x0e60('0x32')]=_[_0x0e60('0x33')](_0x4c89b4['query']);_0x39c7d4['filters']=_[_0x0e60('0x35')](_0x39c7d4[_0x0e60('0x31')],_0x39c7d4[_0x0e60('0x32')]);_0x535c06[_0x0e60('0x37')]=_[_0x0e60('0x35')](_0x39c7d4[_0x0e60('0x31')],qs['fields'](_0x4c89b4[_0x0e60('0x32')][_0x0e60('0x36')]));_0x535c06[_0x0e60('0x37')]=_0x535c06[_0x0e60('0x37')][_0x0e60('0x38')]?_0x535c06['attributes']:_0x39c7d4['model'];if(_0x4c89b4['query'][_0x0e60('0x4b')]){_0x535c06[_0x0e60('0x45')]=[{'all':!![]}];}_0x535c06=_[_0x0e60('0x40')]({},_0x535c06,_0x4c89b4[_0x0e60('0x44')]);return db['FreshdeskField']['find'](_0x535c06)['then'](handleEntityNotFound(_0x4a2a10,null))[_0x0e60('0x28')](respondWithResult(_0x4a2a10,null))[_0x0e60('0x49')](handleError(_0x4a2a10,null));};exports[_0x0e60('0x4c')]=function(_0x5fe304,_0x8777f4){return db['FreshdeskField']['create'](_0x5fe304[_0x0e60('0x4d')],{})[_0x0e60('0x28')](respondWithResult(_0x8777f4,0xc9))[_0x0e60('0x49')](handleError(_0x8777f4,null));};exports[_0x0e60('0x27')]=function(_0x4ad156,_0x36a999){if(_0x4ad156[_0x0e60('0x4d')]['id']){delete _0x4ad156[_0x0e60('0x4d')]['id'];}return db['FreshdeskField'][_0x0e60('0x4e')]({'where':{'id':_0x4ad156[_0x0e60('0x4f')]['id']}})['then'](handleEntityNotFound(_0x36a999,null))[_0x0e60('0x28')](saveUpdates(_0x4ad156['body'],null))[_0x0e60('0x28')](respondWithResult(_0x36a999,null))[_0x0e60('0x49')](handleError(_0x36a999,null));};exports[_0x0e60('0x29')]=function(_0x2e887c,_0x477a99){return db['FreshdeskField'][_0x0e60('0x4e')]({'where':{'id':_0x2e887c[_0x0e60('0x4f')]['id']}})[_0x0e60('0x28')](handleEntityNotFound(_0x477a99,null))[_0x0e60('0x28')](removeEntity(_0x477a99,null))['catch'](handleError(_0x477a99,null));}; \ No newline at end of file +var _0x765e=['sort','pick','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','rawAttributes','find','create','body','params','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/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','json','apply','update','then','destroy','error','stack','index','map','FreshdeskField','fieldName','key','model','name','query','filters','intersection','attributes','fields','length','order'];(function(_0x31cc7a,_0x1c23f9){var _0x247ac9=function(_0x51e738){while(--_0x51e738){_0x31cc7a['push'](_0x31cc7a['shift']());}};_0x247ac9(++_0x1c23f9);}(_0x765e,0x131));var _0xe765=function(_0x1bd172,_0x545df1){_0x1bd172=_0x1bd172-0x0;var _0x1667bc=_0x765e[_0x1bd172];return _0x1667bc;};'use strict';var emlformat=require(_0xe765('0x0'));var rimraf=require(_0xe765('0x1'));var zipdir=require(_0xe765('0x2'));var jsonpatch=require(_0xe765('0x3'));var rp=require(_0xe765('0x4'));var moment=require(_0xe765('0x5'));var BPromise=require(_0xe765('0x6'));var Mustache=require(_0xe765('0x7'));var util=require(_0xe765('0x8'));var path=require(_0xe765('0x9'));var sox=require(_0xe765('0xa'));var csv=require(_0xe765('0xb'));var ejs=require(_0xe765('0xc'));var fs=require('fs');var fs_extra=require(_0xe765('0xd'));var _=require(_0xe765('0xe'));var squel=require('squel');var crypto=require(_0xe765('0xf'));var jsforce=require(_0xe765('0x10'));var deskjs=require(_0xe765('0x11'));var toCsv=require(_0xe765('0xb'));var querystring=require(_0xe765('0x12'));var Papa=require(_0xe765('0x13'));var Redis=require(_0xe765('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xe765('0x15'));var as=require(_0xe765('0x16'));var hardwareService=require(_0xe765('0x17'));var logger=require('../../config/logger')(_0xe765('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe765('0x19'))['db'];function respondWithStatusCode(_0x18177f,_0x9411a0){_0x9411a0=_0x9411a0||0xcc;return function(_0x27456b){if(_0x27456b){return _0x18177f[_0xe765('0x1a')](_0x9411a0);}return _0x18177f['status'](_0x9411a0)[_0xe765('0x1b')]();};}function respondWithResult(_0x3a26d8,_0x395312){_0x395312=_0x395312||0xc8;return function(_0x58dc37){if(_0x58dc37){return _0x3a26d8[_0xe765('0x1c')](_0x395312)['json'](_0x58dc37);}};}function respondWithFilteredResult(_0x50e2ab,_0x2f673b){return function(_0x1b1cfe){if(_0x1b1cfe){var _0x3c887b=typeof _0x2f673b['offset']===_0xe765('0x1d')&&typeof _0x2f673b[_0xe765('0x1e')]===_0xe765('0x1d');var _0x1db3ca=_0x1b1cfe[_0xe765('0x1f')];var _0xf93371=_0x3c887b?0x0:_0x2f673b[_0xe765('0x20')];var _0x2a95a9=_0x3c887b?_0x1b1cfe[_0xe765('0x1f')]:_0x2f673b['offset']+_0x2f673b[_0xe765('0x1e')];var _0x56905c;if(_0x2a95a9>=_0x1db3ca){_0x2a95a9=_0x1db3ca;_0x56905c=0xc8;}else{_0x56905c=0xce;}_0x50e2ab[_0xe765('0x1c')](_0x56905c);return _0x50e2ab[_0xe765('0x21')]('Content-Range',_0xf93371+'-'+_0x2a95a9+'/'+_0x1db3ca)[_0xe765('0x22')](_0x1b1cfe);}return null;};}function patchUpdates(_0x59118f){return function(_0x1c73c8){try{jsonpatch[_0xe765('0x23')](_0x1c73c8,_0x59118f,!![]);}catch(_0x1efb96){return BPromise['reject'](_0x1efb96);}return _0x1c73c8['save']();};}function saveUpdates(_0x4b789b,_0x1c6de4){return function(_0x2a4427){if(_0x2a4427){return _0x2a4427[_0xe765('0x24')](_0x4b789b)[_0xe765('0x25')](function(_0x54b59c){return _0x54b59c;});}return null;};}function removeEntity(_0x50cfcb,_0x18ba77){return function(_0x2e2a34){if(_0x2e2a34){return _0x2e2a34[_0xe765('0x26')]()[_0xe765('0x25')](function(){_0x50cfcb[_0xe765('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1aacbc,_0x5464b4){return function(_0x2b1f66){if(!_0x2b1f66){_0x1aacbc[_0xe765('0x1a')](0x194);}return _0x2b1f66;};}function handleError(_0xd877f3,_0x357f4e){_0x357f4e=_0x357f4e||0x1f4;return function(_0x40492d){logger[_0xe765('0x27')](_0x40492d[_0xe765('0x28')]);if(_0x40492d['name']){delete _0x40492d['name'];}_0xd877f3[_0xe765('0x1c')](_0x357f4e)['send'](_0x40492d);};}exports[_0xe765('0x29')]=function(_0x3f7493,_0x2fcbc9){var _0x64ffd4={},_0x1a8c01={},_0x4fce2c={'count':0x0,'rows':[]};var _0x43349b=_[_0xe765('0x2a')](db[_0xe765('0x2b')]['rawAttributes'],function(_0x5947c1){return{'name':_0x5947c1[_0xe765('0x2c')],'type':_0x5947c1['type'][_0xe765('0x2d')]};});_0x1a8c01[_0xe765('0x2e')]=_[_0xe765('0x2a')](_0x43349b,_0xe765('0x2f'));_0x1a8c01[_0xe765('0x30')]=_['keys'](_0x3f7493['query']);_0x1a8c01[_0xe765('0x31')]=_[_0xe765('0x32')](_0x1a8c01[_0xe765('0x2e')],_0x1a8c01[_0xe765('0x30')]);_0x64ffd4[_0xe765('0x33')]=_['intersection'](_0x1a8c01['model'],qs[_0xe765('0x34')](_0x3f7493['query'][_0xe765('0x34')]));_0x64ffd4[_0xe765('0x33')]=_0x64ffd4[_0xe765('0x33')][_0xe765('0x35')]?_0x64ffd4[_0xe765('0x33')]:_0x1a8c01[_0xe765('0x2e')];if(!_0x3f7493[_0xe765('0x30')]['hasOwnProperty']('nolimit')){_0x64ffd4['limit']=qs[_0xe765('0x1e')](_0x3f7493[_0xe765('0x30')][_0xe765('0x1e')]);_0x64ffd4[_0xe765('0x20')]=qs['offset'](_0x3f7493[_0xe765('0x30')][_0xe765('0x20')]);}_0x64ffd4[_0xe765('0x36')]=qs[_0xe765('0x37')](_0x3f7493['query'][_0xe765('0x37')]);_0x64ffd4['where']=qs[_0xe765('0x31')](_[_0xe765('0x38')](_0x3f7493[_0xe765('0x30')],_0x1a8c01[_0xe765('0x31')]),_0x43349b);if(_0x3f7493[_0xe765('0x30')][_0xe765('0x39')]){_0x64ffd4[_0xe765('0x3a')]=_[_0xe765('0x3b')](_0x64ffd4[_0xe765('0x3a')],{'$or':_[_0xe765('0x2a')](_0x43349b,function(_0x5e21ae){if(_0x5e21ae[_0xe765('0x3c')]!==_0xe765('0x3d')){var _0x11b459={};_0x11b459[_0x5e21ae['name']]={'$like':'%'+_0x3f7493['query']['filter']+'%'};return _0x11b459;}})});}_0x64ffd4=_[_0xe765('0x3b')]({},_0x64ffd4,_0x3f7493['options']);var _0x1f0db1={'where':_0x64ffd4[_0xe765('0x3a')]};return db[_0xe765('0x2b')][_0xe765('0x1f')](_0x1f0db1)['then'](function(_0x363f59){_0x4fce2c[_0xe765('0x1f')]=_0x363f59;if(_0x3f7493[_0xe765('0x30')][_0xe765('0x3e')]){_0x64ffd4[_0xe765('0x3f')]=[{'all':!![]}];}return db[_0xe765('0x2b')][_0xe765('0x40')](_0x64ffd4);})[_0xe765('0x25')](function(_0xb92246){_0x4fce2c[_0xe765('0x41')]=_0xb92246;return _0x4fce2c;})['then'](respondWithFilteredResult(_0x2fcbc9,_0x64ffd4))[_0xe765('0x42')](handleError(_0x2fcbc9,null));};exports['show']=function(_0x1248ea,_0x1d2b24){var _0x4d2814={'raw':!![],'where':{'id':_0x1248ea['params']['id']}},_0x3977e5={};_0x3977e5['model']=_['keys'](db[_0xe765('0x2b')][_0xe765('0x43')]);_0x3977e5[_0xe765('0x30')]=_['keys'](_0x1248ea[_0xe765('0x30')]);_0x3977e5[_0xe765('0x31')]=_[_0xe765('0x32')](_0x3977e5[_0xe765('0x2e')],_0x3977e5[_0xe765('0x30')]);_0x4d2814[_0xe765('0x33')]=_[_0xe765('0x32')](_0x3977e5[_0xe765('0x2e')],qs[_0xe765('0x34')](_0x1248ea['query'][_0xe765('0x34')]));_0x4d2814['attributes']=_0x4d2814['attributes'][_0xe765('0x35')]?_0x4d2814['attributes']:_0x3977e5[_0xe765('0x2e')];if(_0x1248ea[_0xe765('0x30')][_0xe765('0x3e')]){_0x4d2814['include']=[{'all':!![]}];}_0x4d2814=_[_0xe765('0x3b')]({},_0x4d2814,_0x1248ea['options']);return db[_0xe765('0x2b')][_0xe765('0x44')](_0x4d2814)[_0xe765('0x25')](handleEntityNotFound(_0x1d2b24,null))['then'](respondWithResult(_0x1d2b24,null))[_0xe765('0x42')](handleError(_0x1d2b24,null));};exports[_0xe765('0x45')]=function(_0x115f16,_0x2d360e){return db['FreshdeskField']['create'](_0x115f16['body'],{})[_0xe765('0x25')](respondWithResult(_0x2d360e,0xc9))[_0xe765('0x42')](handleError(_0x2d360e,null));};exports[_0xe765('0x24')]=function(_0x58310d,_0x14834c){if(_0x58310d['body']['id']){delete _0x58310d[_0xe765('0x46')]['id'];}return db[_0xe765('0x2b')][_0xe765('0x44')]({'where':{'id':_0x58310d[_0xe765('0x47')]['id']}})[_0xe765('0x25')](handleEntityNotFound(_0x14834c,null))[_0xe765('0x25')](saveUpdates(_0x58310d['body'],null))[_0xe765('0x25')](respondWithResult(_0x14834c,null))[_0xe765('0x42')](handleError(_0x14834c,null));};exports[_0xe765('0x26')]=function(_0x1214a8,_0x14c3b5){return db[_0xe765('0x2b')]['find']({'where':{'id':_0x1214a8['params']['id']}})[_0xe765('0x25')](handleEntityNotFound(_0x14c3b5,null))[_0xe765('0x25')](removeEntity(_0x14c3b5,null))[_0xe765('0x42')](handleError(_0x14c3b5,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 4b0e74e..3c6a605 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 _0x1306=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId'];(function(_0x4654d5,_0x55fdf3){var _0x2da3f9=function(_0x8cd30a){while(--_0x8cd30a){_0x4654d5['push'](_0x4654d5['shift']());}};_0x2da3f9(++_0x55fdf3);}(_0x1306,0x17a));var _0x6130=function(_0x3adf6f,_0x11a73c){_0x3adf6f=_0x3adf6f-0x0;var _0x4f2a22=_0x1306[_0x3adf6f];return _0x4f2a22;};'use strict';var _=require(_0x6130('0x0'));var util=require(_0x6130('0x1'));var logger=require(_0x6130('0x2'))(_0x6130('0x3'));var moment=require(_0x6130('0x4'));var BPromise=require(_0x6130('0x5'));var rp=require(_0x6130('0x6'));var fs=require('fs');var path=require(_0x6130('0x7'));var rimraf=require(_0x6130('0x8'));var config=require(_0x6130('0x9'));var attributes=require(_0x6130('0xa'));module[_0x6130('0xb')]=function(_0x213e6a,_0x2b965d){return _0x213e6a[_0x6130('0xc')](_0x6130('0xd'),attributes,{'tableName':_0x6130('0xe'),'paranoid':![],'indexes':[{'name':_0x6130('0xf'),'fields':[_0x6130('0x10'),_0x6130('0x11')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x02bc=['exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3b8f24,_0x5a5790){var _0x877760=function(_0x3877af){while(--_0x3877af){_0x3b8f24['push'](_0x3b8f24['shift']());}};_0x877760(++_0x5a5790);}(_0x02bc,0x1d7));var _0xc02b=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x02bc[_0x432682];return _0x463d05;};'use strict';var _=require(_0xc02b('0x0'));var util=require(_0xc02b('0x1'));var logger=require(_0xc02b('0x2'))('api');var moment=require(_0xc02b('0x3'));var BPromise=require(_0xc02b('0x4'));var rp=require(_0xc02b('0x5'));var fs=require('fs');var path=require(_0xc02b('0x6'));var rimraf=require(_0xc02b('0x7'));var config=require(_0xc02b('0x8'));var attributes=require('./intFreshdeskField.attributes');module[_0xc02b('0x9')]=function(_0x2295d0,_0x2e1594){return _0x2295d0[_0xc02b('0xa')](_0xc02b('0xb'),attributes,{'tableName':_0xc02b('0xc'),'paranoid':![],'indexes':[{'name':_0xc02b('0xd'),'fields':['idField',_0xc02b('0xe')],'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 bc00efe..4afb23c 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 _0x2833=['../../config/logger','client','http','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x11cca1,_0x4a63e3){var _0xe01f78=function(_0x506a8d){while(--_0x506a8d){_0x11cca1['push'](_0x11cca1['shift']());}};_0xe01f78(++_0x4a63e3);}(_0x2833,0x6b));var _0x3283=function(_0x1e1443,_0x328d0e){_0x1e1443=_0x1e1443-0x0;var _0x595406=_0x2833[_0x1e1443];return _0x595406;};'use strict';var _=require(_0x3283('0x0'));var util=require(_0x3283('0x1'));var moment=require(_0x3283('0x2'));var BPromise=require(_0x3283('0x3'));var rs=require(_0x3283('0x4'));var fs=require('fs');var Redis=require(_0x3283('0x5'));var db=require(_0x3283('0x6'))['db'];var utils=require(_0x3283('0x7'));var logger=require(_0x3283('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3283('0x9')][_0x3283('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52b2bd,_0xb8aabf,_0x57fd82){return new BPromise(function(_0x1f6723,_0x50fe68){return client['request'](_0x52b2bd,_0x57fd82)[_0x3283('0xb')](function(_0x402d64){logger[_0x3283('0xc')](_0x3283('0xd'),_0xb8aabf,_0x3283('0xe'));logger[_0x3283('0xf')](_0x3283('0x10'),_0xb8aabf,_0x3283('0xe'),JSON[_0x3283('0x11')](_0x402d64));if(_0x402d64[_0x3283('0x12')]){if(_0x402d64[_0x3283('0x12')][_0x3283('0x13')]===0x1f4){logger['error'](_0x3283('0xd'),_0xb8aabf,_0x402d64[_0x3283('0x12')]['message']);return _0x50fe68(_0x402d64['error']['message']);}logger[_0x3283('0x12')](_0x3283('0xd'),_0xb8aabf,_0x402d64[_0x3283('0x12')][_0x3283('0x14')]);return _0x1f6723(_0x402d64[_0x3283('0x12')][_0x3283('0x14')]);}else{logger[_0x3283('0xc')](_0x3283('0xd'),_0xb8aabf,_0x3283('0xe'));_0x1f6723(_0x402d64[_0x3283('0x15')]['message']);}})[_0x3283('0x16')](function(_0x4cefa4){logger[_0x3283('0x12')](_0x3283('0xd'),_0xb8aabf,_0x4cefa4);_0x50fe68(_0x4cefa4);});});} \ No newline at end of file +var _0x9ba3=['ioredis','../../mysqldb','../../config/environment','jayson/promise','http','request','FreshdeskField,\x20%s,\x20%s','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x9ba3,0xc4));var _0x39ba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9ba3[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x39ba('0x0'));var moment=require(_0x39ba('0x1'));var BPromise=require(_0x39ba('0x2'));var rs=require(_0x39ba('0x3'));var fs=require('fs');var Redis=require(_0x39ba('0x4'));var db=require(_0x39ba('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x39ba('0x6'));var jayson=require(_0x39ba('0x7'));var client=jayson['client'][_0x39ba('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2f1819,_0x53e54a,_0x47d895){return new BPromise(function(_0x129aaa,_0x4cafc5){return client[_0x39ba('0x9')](_0x2f1819,_0x47d895)['then'](function(_0x254415){logger['info'](_0x39ba('0xa'),_0x53e54a,_0x39ba('0xb'));logger['debug'](_0x39ba('0xc'),_0x53e54a,_0x39ba('0xb'),JSON[_0x39ba('0xd')](_0x254415));if(_0x254415['error']){if(_0x254415[_0x39ba('0xe')][_0x39ba('0xf')]===0x1f4){logger[_0x39ba('0xe')](_0x39ba('0xa'),_0x53e54a,_0x254415['error'][_0x39ba('0x10')]);return _0x4cafc5(_0x254415[_0x39ba('0xe')]['message']);}logger[_0x39ba('0xe')](_0x39ba('0xa'),_0x53e54a,_0x254415[_0x39ba('0xe')][_0x39ba('0x10')]);return _0x129aaa(_0x254415[_0x39ba('0xe')][_0x39ba('0x10')]);}else{logger[_0x39ba('0x11')](_0x39ba('0xa'),_0x53e54a,'request\x20sent');_0x129aaa(_0x254415[_0x39ba('0x12')][_0x39ba('0x10')]);}})[_0x39ba('0x13')](function(_0x4ffbc9){logger[_0x39ba('0xe')]('FreshdeskField,\x20%s,\x20%s',_0x53e54a,_0x4ffbc9);_0x4cafc5(_0x4ffbc9);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 5b0ae42..e0eb75f 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 _0xe605=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','getConfigurations','/:id/fields','getFields','post','/:id/configurations','put','/:id','update','delete'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xe605,0x92));var _0x5e60=function(_0x47c5e5,_0x4a4019){_0x47c5e5=_0x47c5e5-0x0;var _0x53b6e9=_0xe605[_0x47c5e5];return _0x53b6e9;};'use strict';var multer=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var path=require('path');var timeout=require(_0x5e60('0x2'));var express=require(_0x5e60('0x3'));var router=express[_0x5e60('0x4')]();var fs_extra=require(_0x5e60('0x5'));var auth=require(_0x5e60('0x6'));var interaction=require(_0x5e60('0x7'));var config=require(_0x5e60('0x8'));var controller=require(_0x5e60('0x9'));router[_0x5e60('0xa')]('/',auth[_0x5e60('0xb')](),controller[_0x5e60('0xc')]);router[_0x5e60('0xa')]('/:id',auth[_0x5e60('0xb')](),controller['show']);router['get']('/:id/configurations',auth[_0x5e60('0xb')](),controller[_0x5e60('0xd')]);router[_0x5e60('0xa')](_0x5e60('0xe'),auth[_0x5e60('0xb')](),controller[_0x5e60('0xf')]);router['post']('/',auth[_0x5e60('0xb')](),controller['create']);router[_0x5e60('0x10')](_0x5e60('0x11'),auth[_0x5e60('0xb')](),controller['addConfiguration']);router[_0x5e60('0x12')](_0x5e60('0x13'),auth[_0x5e60('0xb')](),controller[_0x5e60('0x14')]);router[_0x5e60('0x15')](_0x5e60('0x13'),auth['isAuthenticated'](),controller[_0x5e60('0x16')]);module[_0x5e60('0x17')]=router; \ No newline at end of file +var _0x9ffd=['../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getFields','post','create','addConfiguration','update','delete','exports','multer','util','path','express','Router','fs-extra'];(function(_0x3d4ef1,_0x5a957c){var _0x409423=function(_0x1ab129){while(--_0x1ab129){_0x3d4ef1['push'](_0x3d4ef1['shift']());}};_0x409423(++_0x5a957c);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x5e972a,_0x32a5ab){_0x5e972a=_0x5e972a-0x0;var _0x5876e8=_0x9ffd[_0x5e972a];return _0x5876e8;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xb')](_0xd9ff('0xe'),auth[_0xd9ff('0x9')](),controller['getConfigurations']);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0xd9ff('0xf')]);router[_0xd9ff('0x10')]('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);router[_0xd9ff('0x10')](_0xd9ff('0xe'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x12')]);router['put']('/:id',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x13')]);router[_0xd9ff('0x14')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller['destroy']);module[_0xd9ff('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 28e8940..29405d2 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 _0x66fa=['exports','STRING','username','remoteUri','sequelize'];(function(_0xd99ca7,_0x1caead){var _0x5d44bd=function(_0x14c3a8){while(--_0x14c3a8){_0xd99ca7['push'](_0xd99ca7['shift']());}};_0x5d44bd(++_0x1caead);}(_0x66fa,0x117));var _0xa66f=function(_0x54bf42,_0x5d9c79){_0x54bf42=_0x54bf42-0x0;var _0x478f46=_0x66fa[_0x54bf42];return _0x478f46;};'use strict';var Sequelize=require(_0xa66f('0x0'));module[_0xa66f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa66f('0x2')]},'username':{'type':Sequelize[_0xa66f('0x2')],'unique':_0xa66f('0x3')},'apiKey':{'type':Sequelize[_0xa66f('0x2')]},'remoteUri':{'type':Sequelize[_0xa66f('0x2')],'unique':_0xa66f('0x4')},'serverUrl':{'type':Sequelize[_0xa66f('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x958a=['sequelize','exports','STRING','username'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x958a,0x128));var _0xa958=function(_0x4837bc,_0x2c840a){_0x4837bc=_0x4837bc-0x0;var _0xde7908=_0x958a[_0x4837bc];return _0xde7908;};'use strict';var Sequelize=require(_0xa958('0x0'));module[_0xa958('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa958('0x2')]},'username':{'type':Sequelize[_0xa958('0x2')],'unique':_0xa958('0x3')},'apiKey':{'type':Sequelize[_0xa958('0x2')]},'remoteUri':{'type':Sequelize[_0xa958('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xa958('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 4a80a90..fe0fd94 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 _0x6511=['order','sort','where','type','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','length','merge','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','FreshsalesConfiguration','FreshsalesField','getFields','username','remoteUri','apiKey','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','statusCode','stringify','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','error','stack','name','send','index','FreshsalesAccount','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x17d0e5,_0x5b5e4f){var _0x22685b=function(_0x2242f5){while(--_0x2242f5){_0x17d0e5['push'](_0x17d0e5['shift']());}};_0x22685b(++_0x5b5e4f);}(_0x6511,0x8f));var _0x1651=function(_0x10b477,_0x3f5cbf){_0x10b477=_0x10b477-0x0;var _0x311ed4=_0x6511[_0x10b477];return _0x311ed4;};'use strict';var emlformat=require(_0x1651('0x0'));var rimraf=require(_0x1651('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1651('0x2'));var rp=require(_0x1651('0x3'));var moment=require(_0x1651('0x4'));var BPromise=require(_0x1651('0x5'));var Mustache=require(_0x1651('0x6'));var util=require('util');var path=require('path');var sox=require(_0x1651('0x7'));var csv=require(_0x1651('0x8'));var ejs=require(_0x1651('0x9'));var fs=require('fs');var fs_extra=require(_0x1651('0xa'));var _=require(_0x1651('0xb'));var squel=require(_0x1651('0xc'));var crypto=require(_0x1651('0xd'));var jsforce=require(_0x1651('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1651('0x8'));var querystring=require(_0x1651('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1651('0x10'));var as=require(_0x1651('0x11'));var hardwareService=require(_0x1651('0x12'));var logger=require(_0x1651('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x1651('0x14'));var licenseUtil=require(_0x1651('0x15'));var db=require(_0x1651('0x16'))['db'];var integrations=require(_0x1651('0x17'));function respondWithStatusCode(_0x318648,_0x12ac3d){_0x12ac3d=_0x12ac3d||0xcc;return function(_0x4570a7){if(_0x4570a7){return _0x318648[_0x1651('0x18')](_0x12ac3d);}return _0x318648[_0x1651('0x19')](_0x12ac3d)[_0x1651('0x1a')]();};}function respondWithResult(_0x4140e1,_0x3ad64a){_0x3ad64a=_0x3ad64a||0xc8;return function(_0x43bea9){if(_0x43bea9){return _0x4140e1['status'](_0x3ad64a)[_0x1651('0x1b')](_0x43bea9);}};}function respondWithFilteredResult(_0x4b2411,_0x420c28){return function(_0x453be2){if(_0x453be2){var _0x18b702=typeof _0x420c28[_0x1651('0x1c')]===_0x1651('0x1d')&&typeof _0x420c28[_0x1651('0x1e')]===_0x1651('0x1d');var _0x5aff55=_0x453be2[_0x1651('0x1f')];var _0x2dcd75=_0x18b702?0x0:_0x420c28[_0x1651('0x1c')];var _0x2863db=_0x18b702?_0x453be2[_0x1651('0x1f')]:_0x420c28[_0x1651('0x1c')]+_0x420c28[_0x1651('0x1e')];var _0x109db7;if(_0x2863db>=_0x5aff55){_0x2863db=_0x5aff55;_0x109db7=0xc8;}else{_0x109db7=0xce;}_0x4b2411[_0x1651('0x19')](_0x109db7);return _0x4b2411[_0x1651('0x20')](_0x1651('0x21'),_0x2dcd75+'-'+_0x2863db+'/'+_0x5aff55)[_0x1651('0x1b')](_0x453be2);}return null;};}function patchUpdates(_0x1ddd50){return function(_0x2e5f96){try{jsonpatch['apply'](_0x2e5f96,_0x1ddd50,!![]);}catch(_0x2fe380){return BPromise['reject'](_0x2fe380);}return _0x2e5f96[_0x1651('0x22')]();};}function saveUpdates(_0x30fbfb,_0x339754){return function(_0x468f35){if(_0x468f35){return _0x468f35[_0x1651('0x23')](_0x30fbfb)[_0x1651('0x24')](function(_0x3eda41){return _0x3eda41;});}return null;};}function removeEntity(_0x2f3d2e,_0x4b8443){return function(_0x5355e5){if(_0x5355e5){return _0x5355e5[_0x1651('0x25')]()[_0x1651('0x24')](function(){_0x2f3d2e[_0x1651('0x19')](0xcc)[_0x1651('0x1a')]();});}};}function handleEntityNotFound(_0x378a5a,_0x2a61f1){return function(_0x5224cf){if(!_0x5224cf){_0x378a5a['sendStatus'](0x194);}return _0x5224cf;};}function handleError(_0x1bb4ef,_0x5ecea0){_0x5ecea0=_0x5ecea0||0x1f4;return function(_0x193e80){logger[_0x1651('0x26')](_0x193e80[_0x1651('0x27')]);if(_0x193e80[_0x1651('0x28')]){delete _0x193e80['name'];}_0x1bb4ef[_0x1651('0x19')](_0x5ecea0)[_0x1651('0x29')](_0x193e80);};}exports[_0x1651('0x2a')]=function(_0x4d6d92,_0x51bf0f){var _0x146db0={},_0x58a27a={},_0x4b59e8={'count':0x0,'rows':[]};var _0x19b2df=_['map'](db[_0x1651('0x2b')][_0x1651('0x2c')],function(_0x7e666d){return{'name':_0x7e666d[_0x1651('0x2d')],'type':_0x7e666d['type'][_0x1651('0x2e')]};});_0x58a27a[_0x1651('0x2f')]=_[_0x1651('0x30')](_0x19b2df,_0x1651('0x28'));_0x58a27a['query']=_[_0x1651('0x31')](_0x4d6d92[_0x1651('0x32')]);_0x58a27a[_0x1651('0x33')]=_[_0x1651('0x34')](_0x58a27a[_0x1651('0x2f')],_0x58a27a[_0x1651('0x32')]);_0x146db0[_0x1651('0x35')]=_[_0x1651('0x34')](_0x58a27a[_0x1651('0x2f')],qs[_0x1651('0x36')](_0x4d6d92['query'][_0x1651('0x36')]));_0x146db0[_0x1651('0x35')]=_0x146db0[_0x1651('0x35')]['length']?_0x146db0[_0x1651('0x35')]:_0x58a27a[_0x1651('0x2f')];if(!_0x4d6d92[_0x1651('0x32')][_0x1651('0x37')](_0x1651('0x38'))){_0x146db0[_0x1651('0x1e')]=qs[_0x1651('0x1e')](_0x4d6d92[_0x1651('0x32')][_0x1651('0x1e')]);_0x146db0[_0x1651('0x1c')]=qs[_0x1651('0x1c')](_0x4d6d92['query']['offset']);}_0x146db0[_0x1651('0x39')]=qs[_0x1651('0x3a')](_0x4d6d92[_0x1651('0x32')][_0x1651('0x3a')]);_0x146db0[_0x1651('0x3b')]=qs['filters'](_['pick'](_0x4d6d92['query'],_0x58a27a['filters']),_0x19b2df);if(_0x4d6d92['query']['filter']){_0x146db0['where']=_['merge'](_0x146db0[_0x1651('0x3b')],{'$or':_[_0x1651('0x30')](_0x19b2df,function(_0x9f81b5){if(_0x9f81b5[_0x1651('0x3c')]!==_0x1651('0x3d')){var _0x36cc54={};_0x36cc54[_0x9f81b5[_0x1651('0x28')]]={'$like':'%'+_0x4d6d92[_0x1651('0x32')][_0x1651('0x3e')]+'%'};return _0x36cc54;}})});}_0x146db0=_['merge']({},_0x146db0,_0x4d6d92[_0x1651('0x3f')]);var _0x23db79={'where':_0x146db0[_0x1651('0x3b')]};return db[_0x1651('0x2b')][_0x1651('0x1f')](_0x23db79)[_0x1651('0x24')](function(_0x699ea){_0x4b59e8[_0x1651('0x1f')]=_0x699ea;if(_0x4d6d92[_0x1651('0x32')][_0x1651('0x40')]){_0x146db0[_0x1651('0x41')]=[{'all':!![]}];}return db[_0x1651('0x2b')]['findAll'](_0x146db0);})[_0x1651('0x24')](function(_0xf5dd78){_0x4b59e8[_0x1651('0x42')]=_0xf5dd78;return _0x4b59e8;})['then'](respondWithFilteredResult(_0x51bf0f,_0x146db0))[_0x1651('0x43')](handleError(_0x51bf0f,null));};exports[_0x1651('0x44')]=function(_0x88e879,_0x30b5bf){var _0x241f66={'raw':![],'where':{'id':_0x88e879[_0x1651('0x45')]['id']}},_0x3ffe7c={};_0x3ffe7c[_0x1651('0x2f')]=_[_0x1651('0x31')](db[_0x1651('0x2b')][_0x1651('0x2c')]);_0x3ffe7c[_0x1651('0x32')]=_[_0x1651('0x31')](_0x88e879[_0x1651('0x32')]);_0x3ffe7c[_0x1651('0x33')]=_[_0x1651('0x34')](_0x3ffe7c[_0x1651('0x2f')],_0x3ffe7c[_0x1651('0x32')]);_0x241f66[_0x1651('0x35')]=_['intersection'](_0x3ffe7c[_0x1651('0x2f')],qs[_0x1651('0x36')](_0x88e879[_0x1651('0x32')][_0x1651('0x36')]));_0x241f66[_0x1651('0x35')]=_0x241f66[_0x1651('0x35')][_0x1651('0x46')]?_0x241f66[_0x1651('0x35')]:_0x3ffe7c[_0x1651('0x2f')];if(_0x88e879['query'][_0x1651('0x40')]){_0x241f66[_0x1651('0x41')]=[{'all':!![]}];}_0x241f66=_[_0x1651('0x47')]({},_0x241f66,_0x88e879[_0x1651('0x3f')]);return db['FreshsalesAccount'][_0x1651('0x48')](_0x241f66)[_0x1651('0x24')](handleEntityNotFound(_0x30b5bf,null))[_0x1651('0x24')](respondWithResult(_0x30b5bf,null))[_0x1651('0x43')](handleError(_0x30b5bf,null));};exports[_0x1651('0x49')]=function(_0x440b75,_0x3e0640){return db[_0x1651('0x2b')][_0x1651('0x49')](_0x440b75[_0x1651('0x4a')],{})[_0x1651('0x24')](respondWithResult(_0x3e0640,0xc9))['catch'](handleError(_0x3e0640,null));};exports[_0x1651('0x23')]=function(_0x47f714,_0x54cd1b){if(_0x47f714[_0x1651('0x4a')]['id']){delete _0x47f714[_0x1651('0x4a')]['id'];}return db['FreshsalesAccount'][_0x1651('0x48')]({'where':{'id':_0x47f714[_0x1651('0x45')]['id']}})[_0x1651('0x24')](handleEntityNotFound(_0x54cd1b,null))[_0x1651('0x24')](saveUpdates(_0x47f714['body'],null))[_0x1651('0x24')](respondWithResult(_0x54cd1b,null))['catch'](handleError(_0x54cd1b,null));};exports[_0x1651('0x25')]=function(_0x123c57,_0x2a817d){return db['FreshsalesAccount']['find']({'where':{'id':_0x123c57[_0x1651('0x45')]['id']}})['then'](handleEntityNotFound(_0x2a817d,null))[_0x1651('0x24')](removeEntity(_0x2a817d,null))['catch'](handleError(_0x2a817d,null));};exports[_0x1651('0x4b')]=function(_0x1ad423,_0xaab0f7,_0xfaee2f){var _0x56ef75={};var _0x816be2={};var _0x107fe3;var _0x93c7d4;return db[_0x1651('0x2b')][_0x1651('0x4c')]({'where':{'id':_0x1ad423[_0x1651('0x45')]['id']}})[_0x1651('0x24')](handleEntityNotFound(_0xaab0f7,null))[_0x1651('0x24')](function(_0x4eae34){if(_0x4eae34){_0x107fe3=_0x4eae34;_0x816be2[_0x1651('0x2f')]=_['keys'](db['FreshsalesConfiguration'][_0x1651('0x2c')]);_0x816be2['query']=_[_0x1651('0x31')](_0x1ad423['query']);_0x816be2['filters']=_[_0x1651('0x34')](_0x816be2['model'],_0x816be2[_0x1651('0x32')]);_0x56ef75[_0x1651('0x35')]=_[_0x1651('0x34')](_0x816be2['model'],qs[_0x1651('0x36')](_0x1ad423['query'][_0x1651('0x36')]));_0x56ef75['attributes']=_0x56ef75[_0x1651('0x35')]['length']?_0x56ef75[_0x1651('0x35')]:_0x816be2[_0x1651('0x2f')];_0x56ef75[_0x1651('0x39')]=qs['sort'](_0x1ad423[_0x1651('0x32')][_0x1651('0x3a')]);_0x56ef75[_0x1651('0x3b')]=qs['filters'](_['pick'](_0x1ad423[_0x1651('0x32')],_0x816be2[_0x1651('0x33')]));if(_0x1ad423[_0x1651('0x32')][_0x1651('0x3e')]){_0x56ef75['where']=_[_0x1651('0x47')](_0x56ef75[_0x1651('0x3b')],{'$or':_['map'](_0x56ef75['attributes'],function(_0x24036c){var _0x5233c3={};_0x5233c3[_0x24036c]={'$like':'%'+_0x1ad423[_0x1651('0x32')][_0x1651('0x3e')]+'%'};return _0x5233c3;})});}_0x56ef75=_['merge']({},_0x56ef75,_0x1ad423[_0x1651('0x3f')]);return _0x107fe3['getConfigurations'](_0x56ef75);}})[_0x1651('0x24')](function(_0x548049){if(_0x548049){_0x93c7d4=_0x548049[_0x1651('0x46')];if(!_0x1ad423[_0x1651('0x32')][_0x1651('0x37')](_0x1651('0x38'))){_0x56ef75[_0x1651('0x1e')]=qs[_0x1651('0x1e')](_0x1ad423[_0x1651('0x32')]['limit']);_0x56ef75[_0x1651('0x1c')]=qs[_0x1651('0x1c')](_0x1ad423[_0x1651('0x32')][_0x1651('0x1c')]);}return _0x107fe3[_0x1651('0x4b')](_0x56ef75);}})[_0x1651('0x24')](function(_0x50afae){if(_0x50afae){return _0x50afae?{'count':_0x93c7d4,'rows':_0x50afae}:null;}})['then'](respondWithResult(_0xaab0f7,null))['catch'](handleError(_0xaab0f7,null));};exports[_0x1651('0x4d')]=function(_0x4b0adf,_0x3f1ca3,_0x28500d){if(_0x4b0adf['body']['id']){delete _0x4b0adf[_0x1651('0x4a')]['id'];}return db['FreshsalesAccount'][_0x1651('0x4c')]({'where':{'id':_0x4b0adf[_0x1651('0x45')]['id']}})[_0x1651('0x24')](handleEntityNotFound(_0x3f1ca3,null))[_0x1651('0x24')](function(_0x19e747){if(_0x19e747){_0x4b0adf[_0x1651('0x4a')][_0x1651('0x4e')]=_0x19e747['id'];_0x4b0adf['body'][_0x1651('0x4f')]=integrations[_0x1651('0x50')](_0x4b0adf[_0x1651('0x4a')]['channel'],_0x4b0adf[_0x1651('0x4a')][_0x1651('0x3c')]);_0x4b0adf[_0x1651('0x4a')][_0x1651('0x51')]=integrations['getDescriptions'](_0x4b0adf[_0x1651('0x4a')][_0x1651('0x52')],_0x4b0adf[_0x1651('0x4a')]['type']);return db[_0x1651('0x53')][_0x1651('0x49')](_0x4b0adf[_0x1651('0x4a')],{'include':[{'model':db['FreshsalesField'],'as':'Subjects'},{'model':db[_0x1651('0x54')],'as':_0x1651('0x51')}]});}return null;})[_0x1651('0x24')](respondWithResult(_0x3f1ca3,null))['catch'](handleError(_0x3f1ca3,null));};exports[_0x1651('0x55')]=function(_0x47b712,_0x442735,_0x468983){var _0x1a39b5='';var _0x35904e='';return db[_0x1651('0x2b')][_0x1651('0x4c')]({'where':{'id':_0x47b712[_0x1651('0x45')]['id']},'attributes':['id',_0x1651('0x56'),_0x1651('0x57'),_0x1651('0x58')]})[_0x1651('0x24')](handleEntityNotFound(_0x442735,null))[_0x1651('0x24')](function(_0x2396a2){if(_0x2396a2){_0x35904e=_0x2396a2[_0x1651('0x56')];_0x1a39b5=_0x2396a2[_0x1651('0x57')];var _0x2f085b=_0x2396a2[_0x1651('0x57')]['slice'](-0x1);if(_0x2f085b==='/'){_0x1a39b5=_0x1a39b5['substring'](0x0,_0x1a39b5[_0x1651('0x59')](_0x2f085b));}return rp({'method':_0x1651('0x5a'),'uri':util[_0x1651('0x5b')](_0x1651('0x5c'),_0x1a39b5,_0x1651('0x5d')),'headers':{'Authorization':_0x1651('0x5e')+_0x2396a2[_0x1651('0x58')]},'json':!![]});}})[_0x1651('0x24')](function(_0x33f4ce){if(_0x33f4ce){var _0x304796=_0x33f4ce[_0x1651('0x5f')];var _0x1362d9=![];var _0x2d54df=null;for(_0x2d54df=0x0;_0x2d54df<_0x304796[_0x1651('0x46')];_0x2d54df++){if(_0x304796[_0x2d54df]['email']===_0x35904e){_0x1362d9=!![];}}if(_0x1362d9){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x1651('0x60')});}}})[_0x1651('0x24')](respondWithResult(_0x442735,null))[_0x1651('0x43')](function(_0x455142){var _0x42401b=_0x47b712['query'][_0x1651('0x61')]?0x1f4:_0x455142[_0x1651('0x62')]||0x1f4;logger[_0x1651('0x26')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x42401b,JSON[_0x1651('0x63')](_0x455142));delete _0x455142[_0x1651('0x28')];if(_0x42401b===0x191){_0x42401b=0x190;}_0x442735['status'](_0x42401b)[_0x1651('0x29')](_0x47b712[_0x1651('0x32')][_0x1651('0x61')]?{'message':'Wrong\x20credentials','statusCode':_0x455142[_0x1651('0x62')]}:_0x455142);});}; \ No newline at end of file +var _0x1c8d=['zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','end','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','filter','merge','VIRTUAL','FreshsalesAccount','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','body','find','destroy','getConfigurations','findOne','FreshsalesConfiguration','order','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','remoteUri','username','lastIndexOf','GET','%s%s','/api/selector/owners','Token\x20token=','apiKey','users','email','Requested\x20Resource\x20not\x20Found','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf'];(function(_0x88d146,_0x3af4a9){var _0x18b39f=function(_0x10abd5){while(--_0x10abd5){_0x88d146['push'](_0x88d146['shift']());}};_0x18b39f(++_0x3af4a9);}(_0x1c8d,0xce));var _0xd1c8=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x1c8d[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0xd1c8('0x0'));var rimraf=require(_0xd1c8('0x1'));var zipdir=require(_0xd1c8('0x2'));var jsonpatch=require(_0xd1c8('0x3'));var rp=require(_0xd1c8('0x4'));var moment=require(_0xd1c8('0x5'));var BPromise=require(_0xd1c8('0x6'));var Mustache=require('mustache');var util=require(_0xd1c8('0x7'));var path=require(_0xd1c8('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd1c8('0x9'));var fs=require('fs');var fs_extra=require(_0xd1c8('0xa'));var _=require(_0xd1c8('0xb'));var squel=require(_0xd1c8('0xc'));var crypto=require(_0xd1c8('0xd'));var jsforce=require(_0xd1c8('0xe'));var deskjs=require(_0xd1c8('0xf'));var toCsv=require(_0xd1c8('0x10'));var querystring=require(_0xd1c8('0x11'));var Papa=require(_0xd1c8('0x12'));var Redis=require(_0xd1c8('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xd1c8('0x14'));var as=require(_0xd1c8('0x15'));var hardwareService=require(_0xd1c8('0x16'));var logger=require(_0xd1c8('0x17'))('api');var utils=require(_0xd1c8('0x18'));var config=require(_0xd1c8('0x19'));var licenseUtil=require(_0xd1c8('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xb490d8,_0x51d016){_0x51d016=_0x51d016||0xcc;return function(_0x280dab){if(_0x280dab){return _0xb490d8[_0xd1c8('0x1b')](_0x51d016);}return _0xb490d8[_0xd1c8('0x1c')](_0x51d016)['end']();};}function respondWithResult(_0x5ed960,_0x23d0a7){_0x23d0a7=_0x23d0a7||0xc8;return function(_0x4a6291){if(_0x4a6291){return _0x5ed960['status'](_0x23d0a7)[_0xd1c8('0x1d')](_0x4a6291);}};}function respondWithFilteredResult(_0xec98e5,_0x528d60){return function(_0x4d380f){if(_0x4d380f){var _0x2b8596=typeof _0x528d60[_0xd1c8('0x1e')]===_0xd1c8('0x1f')&&typeof _0x528d60[_0xd1c8('0x20')]==='undefined';var _0x4d107b=_0x4d380f[_0xd1c8('0x21')];var _0xceca1f=_0x2b8596?0x0:_0x528d60[_0xd1c8('0x1e')];var _0x517104=_0x2b8596?_0x4d380f[_0xd1c8('0x21')]:_0x528d60[_0xd1c8('0x1e')]+_0x528d60[_0xd1c8('0x20')];var _0x128fc1;if(_0x517104>=_0x4d107b){_0x517104=_0x4d107b;_0x128fc1=0xc8;}else{_0x128fc1=0xce;}_0xec98e5[_0xd1c8('0x1c')](_0x128fc1);return _0xec98e5['set'](_0xd1c8('0x22'),_0xceca1f+'-'+_0x517104+'/'+_0x4d107b)['json'](_0x4d380f);}return null;};}function patchUpdates(_0x201c8f){return function(_0xacf4ba){try{jsonpatch[_0xd1c8('0x23')](_0xacf4ba,_0x201c8f,!![]);}catch(_0x1039dc){return BPromise[_0xd1c8('0x24')](_0x1039dc);}return _0xacf4ba['save']();};}function saveUpdates(_0x430957,_0x2fc5a9){return function(_0x44f228){if(_0x44f228){return _0x44f228[_0xd1c8('0x25')](_0x430957)['then'](function(_0x411eae){return _0x411eae;});}return null;};}function removeEntity(_0x2d471b,_0x52c458){return function(_0x4012e5){if(_0x4012e5){return _0x4012e5['destroy']()[_0xd1c8('0x26')](function(){_0x2d471b['status'](0xcc)[_0xd1c8('0x27')]();});}};}function handleEntityNotFound(_0x3730f0,_0x42ccd1){return function(_0x1ae81b){if(!_0x1ae81b){_0x3730f0[_0xd1c8('0x1b')](0x194);}return _0x1ae81b;};}function handleError(_0x659297,_0x240312){_0x240312=_0x240312||0x1f4;return function(_0x3cec66){logger['error'](_0x3cec66['stack']);if(_0x3cec66['name']){delete _0x3cec66[_0xd1c8('0x28')];}_0x659297[_0xd1c8('0x1c')](_0x240312)[_0xd1c8('0x29')](_0x3cec66);};}exports[_0xd1c8('0x2a')]=function(_0x37e645,_0x4434a1){var _0x4a1ccc={},_0x5c0309={},_0x13bed7={'count':0x0,'rows':[]};var _0x473394=_[_0xd1c8('0x2b')](db['FreshsalesAccount']['rawAttributes'],function(_0x11b58c){return{'name':_0x11b58c[_0xd1c8('0x2c')],'type':_0x11b58c[_0xd1c8('0x2d')][_0xd1c8('0x2e')]};});_0x5c0309[_0xd1c8('0x2f')]=_['map'](_0x473394,_0xd1c8('0x28'));_0x5c0309[_0xd1c8('0x30')]=_[_0xd1c8('0x31')](_0x37e645[_0xd1c8('0x30')]);_0x5c0309[_0xd1c8('0x32')]=_[_0xd1c8('0x33')](_0x5c0309['model'],_0x5c0309[_0xd1c8('0x30')]);_0x4a1ccc['attributes']=_[_0xd1c8('0x33')](_0x5c0309[_0xd1c8('0x2f')],qs[_0xd1c8('0x34')](_0x37e645[_0xd1c8('0x30')][_0xd1c8('0x34')]));_0x4a1ccc[_0xd1c8('0x35')]=_0x4a1ccc[_0xd1c8('0x35')][_0xd1c8('0x36')]?_0x4a1ccc[_0xd1c8('0x35')]:_0x5c0309[_0xd1c8('0x2f')];if(!_0x37e645[_0xd1c8('0x30')]['hasOwnProperty'](_0xd1c8('0x37'))){_0x4a1ccc[_0xd1c8('0x20')]=qs['limit'](_0x37e645[_0xd1c8('0x30')][_0xd1c8('0x20')]);_0x4a1ccc[_0xd1c8('0x1e')]=qs[_0xd1c8('0x1e')](_0x37e645[_0xd1c8('0x30')]['offset']);}_0x4a1ccc['order']=qs[_0xd1c8('0x38')](_0x37e645[_0xd1c8('0x30')]['sort']);_0x4a1ccc[_0xd1c8('0x39')]=qs[_0xd1c8('0x32')](_['pick'](_0x37e645[_0xd1c8('0x30')],_0x5c0309[_0xd1c8('0x32')]),_0x473394);if(_0x37e645[_0xd1c8('0x30')][_0xd1c8('0x3a')]){_0x4a1ccc[_0xd1c8('0x39')]=_[_0xd1c8('0x3b')](_0x4a1ccc['where'],{'$or':_[_0xd1c8('0x2b')](_0x473394,function(_0x2cfacc){if(_0x2cfacc[_0xd1c8('0x2d')]!==_0xd1c8('0x3c')){var _0x27a9cd={};_0x27a9cd[_0x2cfacc['name']]={'$like':'%'+_0x37e645[_0xd1c8('0x30')][_0xd1c8('0x3a')]+'%'};return _0x27a9cd;}})});}_0x4a1ccc=_['merge']({},_0x4a1ccc,_0x37e645['options']);var _0x114bec={'where':_0x4a1ccc[_0xd1c8('0x39')]};return db[_0xd1c8('0x3d')][_0xd1c8('0x21')](_0x114bec)[_0xd1c8('0x26')](function(_0x1bce55){_0x13bed7['count']=_0x1bce55;if(_0x37e645[_0xd1c8('0x30')][_0xd1c8('0x3e')]){_0x4a1ccc[_0xd1c8('0x3f')]=[{'all':!![]}];}return db[_0xd1c8('0x3d')][_0xd1c8('0x40')](_0x4a1ccc);})[_0xd1c8('0x26')](function(_0x14e131){_0x13bed7[_0xd1c8('0x41')]=_0x14e131;return _0x13bed7;})['then'](respondWithFilteredResult(_0x4434a1,_0x4a1ccc))[_0xd1c8('0x42')](handleError(_0x4434a1,null));};exports[_0xd1c8('0x43')]=function(_0x58b591,_0x4b8ca1){var _0x746eb0={'raw':![],'where':{'id':_0x58b591[_0xd1c8('0x44')]['id']}},_0x1a7913={};_0x1a7913[_0xd1c8('0x2f')]=_['keys'](db[_0xd1c8('0x3d')][_0xd1c8('0x45')]);_0x1a7913[_0xd1c8('0x30')]=_[_0xd1c8('0x31')](_0x58b591['query']);_0x1a7913[_0xd1c8('0x32')]=_[_0xd1c8('0x33')](_0x1a7913[_0xd1c8('0x2f')],_0x1a7913[_0xd1c8('0x30')]);_0x746eb0['attributes']=_['intersection'](_0x1a7913[_0xd1c8('0x2f')],qs['fields'](_0x58b591[_0xd1c8('0x30')][_0xd1c8('0x34')]));_0x746eb0[_0xd1c8('0x35')]=_0x746eb0[_0xd1c8('0x35')][_0xd1c8('0x36')]?_0x746eb0[_0xd1c8('0x35')]:_0x1a7913[_0xd1c8('0x2f')];if(_0x58b591[_0xd1c8('0x30')][_0xd1c8('0x3e')]){_0x746eb0[_0xd1c8('0x3f')]=[{'all':!![]}];}_0x746eb0=_['merge']({},_0x746eb0,_0x58b591[_0xd1c8('0x46')]);return db[_0xd1c8('0x3d')]['find'](_0x746eb0)['then'](handleEntityNotFound(_0x4b8ca1,null))[_0xd1c8('0x26')](respondWithResult(_0x4b8ca1,null))[_0xd1c8('0x42')](handleError(_0x4b8ca1,null));};exports[_0xd1c8('0x47')]=function(_0x4a8465,_0x5035f4){return db[_0xd1c8('0x3d')][_0xd1c8('0x47')](_0x4a8465[_0xd1c8('0x48')],{})[_0xd1c8('0x26')](respondWithResult(_0x5035f4,0xc9))[_0xd1c8('0x42')](handleError(_0x5035f4,null));};exports[_0xd1c8('0x25')]=function(_0x4972f2,_0x36dc8a){if(_0x4972f2['body']['id']){delete _0x4972f2[_0xd1c8('0x48')]['id'];}return db[_0xd1c8('0x3d')][_0xd1c8('0x49')]({'where':{'id':_0x4972f2[_0xd1c8('0x44')]['id']}})[_0xd1c8('0x26')](handleEntityNotFound(_0x36dc8a,null))[_0xd1c8('0x26')](saveUpdates(_0x4972f2[_0xd1c8('0x48')],null))[_0xd1c8('0x26')](respondWithResult(_0x36dc8a,null))[_0xd1c8('0x42')](handleError(_0x36dc8a,null));};exports[_0xd1c8('0x4a')]=function(_0x813921,_0x20bd6b){return db[_0xd1c8('0x3d')][_0xd1c8('0x49')]({'where':{'id':_0x813921['params']['id']}})[_0xd1c8('0x26')](handleEntityNotFound(_0x20bd6b,null))[_0xd1c8('0x26')](removeEntity(_0x20bd6b,null))['catch'](handleError(_0x20bd6b,null));};exports[_0xd1c8('0x4b')]=function(_0x55be28,_0x5db211,_0x5e5139){var _0x2da711={};var _0x52529a={};var _0xd0f0bd;var _0x5092b6;return db[_0xd1c8('0x3d')][_0xd1c8('0x4c')]({'where':{'id':_0x55be28[_0xd1c8('0x44')]['id']}})[_0xd1c8('0x26')](handleEntityNotFound(_0x5db211,null))['then'](function(_0xf04fd3){if(_0xf04fd3){_0xd0f0bd=_0xf04fd3;_0x52529a[_0xd1c8('0x2f')]=_[_0xd1c8('0x31')](db[_0xd1c8('0x4d')][_0xd1c8('0x45')]);_0x52529a[_0xd1c8('0x30')]=_[_0xd1c8('0x31')](_0x55be28[_0xd1c8('0x30')]);_0x52529a[_0xd1c8('0x32')]=_[_0xd1c8('0x33')](_0x52529a[_0xd1c8('0x2f')],_0x52529a[_0xd1c8('0x30')]);_0x2da711[_0xd1c8('0x35')]=_[_0xd1c8('0x33')](_0x52529a[_0xd1c8('0x2f')],qs[_0xd1c8('0x34')](_0x55be28[_0xd1c8('0x30')][_0xd1c8('0x34')]));_0x2da711[_0xd1c8('0x35')]=_0x2da711['attributes']['length']?_0x2da711[_0xd1c8('0x35')]:_0x52529a[_0xd1c8('0x2f')];_0x2da711[_0xd1c8('0x4e')]=qs['sort'](_0x55be28['query'][_0xd1c8('0x38')]);_0x2da711['where']=qs[_0xd1c8('0x32')](_['pick'](_0x55be28[_0xd1c8('0x30')],_0x52529a[_0xd1c8('0x32')]));if(_0x55be28[_0xd1c8('0x30')][_0xd1c8('0x3a')]){_0x2da711[_0xd1c8('0x39')]=_[_0xd1c8('0x3b')](_0x2da711[_0xd1c8('0x39')],{'$or':_[_0xd1c8('0x2b')](_0x2da711[_0xd1c8('0x35')],function(_0x2f4354){var _0x18c101={};_0x18c101[_0x2f4354]={'$like':'%'+_0x55be28[_0xd1c8('0x30')][_0xd1c8('0x3a')]+'%'};return _0x18c101;})});}_0x2da711=_['merge']({},_0x2da711,_0x55be28['options']);return _0xd0f0bd[_0xd1c8('0x4b')](_0x2da711);}})[_0xd1c8('0x26')](function(_0x4f6758){if(_0x4f6758){_0x5092b6=_0x4f6758[_0xd1c8('0x36')];if(!_0x55be28[_0xd1c8('0x30')][_0xd1c8('0x4f')](_0xd1c8('0x37'))){_0x2da711[_0xd1c8('0x20')]=qs['limit'](_0x55be28[_0xd1c8('0x30')][_0xd1c8('0x20')]);_0x2da711[_0xd1c8('0x1e')]=qs[_0xd1c8('0x1e')](_0x55be28[_0xd1c8('0x30')][_0xd1c8('0x1e')]);}return _0xd0f0bd[_0xd1c8('0x4b')](_0x2da711);}})['then'](function(_0x112c67){if(_0x112c67){return _0x112c67?{'count':_0x5092b6,'rows':_0x112c67}:null;}})['then'](respondWithResult(_0x5db211,null))[_0xd1c8('0x42')](handleError(_0x5db211,null));};exports[_0xd1c8('0x50')]=function(_0x7fb3c3,_0x59cfe2,_0x35fee8){if(_0x7fb3c3[_0xd1c8('0x48')]['id']){delete _0x7fb3c3['body']['id'];}return db[_0xd1c8('0x3d')]['findOne']({'where':{'id':_0x7fb3c3[_0xd1c8('0x44')]['id']}})[_0xd1c8('0x26')](handleEntityNotFound(_0x59cfe2,null))[_0xd1c8('0x26')](function(_0x40c904){if(_0x40c904){_0x7fb3c3[_0xd1c8('0x48')][_0xd1c8('0x51')]=_0x40c904['id'];_0x7fb3c3[_0xd1c8('0x48')][_0xd1c8('0x52')]=integrations[_0xd1c8('0x53')](_0x7fb3c3[_0xd1c8('0x48')][_0xd1c8('0x54')],_0x7fb3c3[_0xd1c8('0x48')][_0xd1c8('0x2d')]);_0x7fb3c3[_0xd1c8('0x48')][_0xd1c8('0x55')]=integrations[_0xd1c8('0x56')](_0x7fb3c3[_0xd1c8('0x48')][_0xd1c8('0x54')],_0x7fb3c3['body'][_0xd1c8('0x2d')]);return db['FreshsalesConfiguration'][_0xd1c8('0x47')](_0x7fb3c3[_0xd1c8('0x48')],{'include':[{'model':db[_0xd1c8('0x57')],'as':_0xd1c8('0x52')},{'model':db['FreshsalesField'],'as':_0xd1c8('0x55')}]});}return null;})[_0xd1c8('0x26')](respondWithResult(_0x59cfe2,null))[_0xd1c8('0x42')](handleError(_0x59cfe2,null));};exports[_0xd1c8('0x58')]=function(_0x42a746,_0x81a345,_0x3880c6){var _0x556513='';var _0x3c7866='';return db['FreshsalesAccount'][_0xd1c8('0x4c')]({'where':{'id':_0x42a746[_0xd1c8('0x44')]['id']},'attributes':['id','username',_0xd1c8('0x59'),'apiKey']})[_0xd1c8('0x26')](handleEntityNotFound(_0x81a345,null))['then'](function(_0x454add){if(_0x454add){_0x3c7866=_0x454add[_0xd1c8('0x5a')];_0x556513=_0x454add[_0xd1c8('0x59')];var _0x8cb46c=_0x454add[_0xd1c8('0x59')]['slice'](-0x1);if(_0x8cb46c==='/'){_0x556513=_0x556513['substring'](0x0,_0x556513[_0xd1c8('0x5b')](_0x8cb46c));}return rp({'method':_0xd1c8('0x5c'),'uri':util['format'](_0xd1c8('0x5d'),_0x556513,_0xd1c8('0x5e')),'headers':{'Authorization':_0xd1c8('0x5f')+_0x454add[_0xd1c8('0x60')]},'json':!![]});}})[_0xd1c8('0x26')](function(_0x3cf2b6){if(_0x3cf2b6){var _0x5ef2e0=_0x3cf2b6[_0xd1c8('0x61')];var _0x55aeba=![];var _0x43c97b=null;for(_0x43c97b=0x0;_0x43c97b<_0x5ef2e0[_0xd1c8('0x36')];_0x43c97b++){if(_0x5ef2e0[_0x43c97b][_0xd1c8('0x62')]===_0x3c7866){_0x55aeba=!![];}}if(_0x55aeba){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xd1c8('0x63')});}}})['then'](respondWithResult(_0x81a345,null))[_0xd1c8('0x42')](function(_0x373205){var _0x5cb7f6=_0x42a746[_0xd1c8('0x30')][_0xd1c8('0x64')]?0x1f4:_0x373205['statusCode']||0x1f4;logger['error'](_0xd1c8('0x65'),_0xd1c8('0x58'),_0x5cb7f6,JSON['stringify'](_0x373205));delete _0x373205[_0xd1c8('0x28')];if(_0x5cb7f6===0x191){_0x5cb7f6=0x190;}_0x81a345['status'](_0x5cb7f6)[_0xd1c8('0x29')](_0x42a746[_0xd1c8('0x30')][_0xd1c8('0x64')]?{'message':_0xd1c8('0x66'),'statusCode':_0x373205[_0xd1c8('0x67')]}:_0x373205);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 48a9ca4..7d66cf8 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 _0x01d9=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api'];(function(_0xd5896e,_0x3784a3){var _0x26bb39=function(_0x500be9){while(--_0x500be9){_0xd5896e['push'](_0xd5896e['shift']());}};_0x26bb39(++_0x3784a3);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var logger=require(_0x901d('0x2'))(_0x901d('0x3'));var moment=require('moment');var BPromise=require(_0x901d('0x4'));var rp=require(_0x901d('0x5'));var fs=require('fs');var path=require(_0x901d('0x6'));var rimraf=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var attributes=require(_0x901d('0x9'));var integrations=require(_0x901d('0xa'));module['exports']=function(_0x1e5d7d,_0x6c9ac8){return _0x1e5d7d[_0x901d('0xb')](_0x901d('0xc'),attributes,{'tableName':_0x901d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbff5=['FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../components/integrations/configuration','exports','define'];(function(_0x518b08,_0xba781e){var _0x43662c=function(_0x257b8f){while(--_0x257b8f){_0x518b08['push'](_0x518b08['shift']());}};_0x43662c(++_0xba781e);}(_0xbff5,0x1bc));var _0x5bff=function(_0x43afa1,_0x3c3d64){_0x43afa1=_0x43afa1-0x0;var _0x3aa817=_0xbff5[_0x43afa1];return _0x3aa817;};'use strict';var _=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));var logger=require(_0x5bff('0x2'))(_0x5bff('0x3'));var moment=require(_0x5bff('0x4'));var BPromise=require(_0x5bff('0x5'));var rp=require(_0x5bff('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5bff('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x5bff('0x8'));module[_0x5bff('0x9')]=function(_0x151add,_0xa54c57){return _0x151add[_0x5bff('0xa')](_0x5bff('0xb'),attributes,{'tableName':_0x5bff('0xc'),'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 3aab17c..f17166c 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 _0x4bd3=['where','attributes','limit','include','model','map','stringify','find','ShowFreshsalesAccount','lodash','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw'];(function(_0x179c4a,_0x10eb06){var _0x5d1879=function(_0x1f1dcd){while(--_0x1f1dcd){_0x179c4a['push'](_0x179c4a['shift']());}};_0x5d1879(++_0x10eb06);}(_0x4bd3,0x174));var _0x34bd=function(_0x59f924,_0x3a0889){_0x59f924=_0x59f924-0x0;var _0x4d1882=_0x4bd3[_0x59f924];return _0x4d1882;};'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')]('FreshsalesAccount,\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']('FreshsalesAccount,\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);});});}exports[_0x34bd('0x13')]=function(_0x3b4bf8){var _0x72b197=this;return new Promise(function(_0x4b5ebb,_0x48d2ba){return db[_0x34bd('0x14')][_0x34bd('0x15')]({'raw':_0x3b4bf8[_0x34bd('0x16')]?_0x3b4bf8[_0x34bd('0x16')][_0x34bd('0x17')]===undefined?!![]:![]:!![],'where':_0x3b4bf8[_0x34bd('0x16')]?_0x3b4bf8[_0x34bd('0x16')][_0x34bd('0x18')]||null:null,'attributes':_0x3b4bf8[_0x34bd('0x16')]?_0x3b4bf8['options'][_0x34bd('0x19')]||null:null,'limit':_0x3b4bf8[_0x34bd('0x16')]?_0x3b4bf8[_0x34bd('0x16')][_0x34bd('0x1a')]||null:null,'include':_0x3b4bf8[_0x34bd('0x16')]?_0x3b4bf8['options']['include']?_['map'](_0x3b4bf8['options'][_0x34bd('0x1b')],function(_0x503a60){return{'model':db[_0x503a60[_0x34bd('0x1c')]],'as':_0x503a60['as'],'attributes':_0x503a60[_0x34bd('0x19')],'include':_0x503a60[_0x34bd('0x1b')]?_['map'](_0x503a60[_0x34bd('0x1b')],function(_0x14479a){return{'model':db[_0x14479a[_0x34bd('0x1c')]],'as':_0x14479a['as'],'attributes':_0x14479a[_0x34bd('0x19')],'include':_0x14479a['include']?_[_0x34bd('0x1d')](_0x14479a[_0x34bd('0x1b')],function(_0x264c94){return{'model':db[_0x264c94[_0x34bd('0x1c')]],'as':_0x264c94['as'],'attributes':_0x264c94['attributes']};}):[]};}):[]};}):[]:[]})[_0x34bd('0x9')](function(_0x3fe8b0){logger['info'](_0x34bd('0x13'),_0x3b4bf8);logger[_0x34bd('0xc')](_0x34bd('0x13'),_0x3b4bf8,JSON[_0x34bd('0x1e')](_0x3fe8b0));_0x4b5ebb(_0x3fe8b0);})[_0x34bd('0x12')](function(_0x4500c8){logger[_0x34bd('0xe')]('GetFreshsalesAccount',_0x4500c8[_0x34bd('0x10')],_0x3b4bf8);_0x48d2ba(_0x72b197[_0x34bd('0xe')](0x1f4,_0x4500c8['message']));});});};exports['ShowFreshsalesAccount']=function(_0x38bdba){var _0xca9897=this;return new Promise(function(_0xd176f7,_0x536b2c){return db['FreshsalesAccount'][_0x34bd('0x1f')]({'raw':_0x38bdba[_0x34bd('0x16')]?_0x38bdba[_0x34bd('0x16')][_0x34bd('0x17')]===undefined?!![]:![]:!![],'where':_0x38bdba['options']?_0x38bdba[_0x34bd('0x16')][_0x34bd('0x18')]||null:null,'attributes':_0x38bdba[_0x34bd('0x16')]?_0x38bdba[_0x34bd('0x16')][_0x34bd('0x19')]||null:null,'include':_0x38bdba[_0x34bd('0x16')]?_0x38bdba['options'][_0x34bd('0x1b')]?_['map'](_0x38bdba[_0x34bd('0x16')][_0x34bd('0x1b')],function(_0xf12ee6){return{'model':db[_0xf12ee6['model']],'as':_0xf12ee6['as'],'attributes':_0xf12ee6[_0x34bd('0x19')],'include':_0xf12ee6[_0x34bd('0x1b')]?_['map'](_0xf12ee6[_0x34bd('0x1b')],function(_0x21c7d6){return{'model':db[_0x21c7d6[_0x34bd('0x1c')]],'as':_0x21c7d6['as'],'attributes':_0x21c7d6['attributes'],'include':_0x21c7d6[_0x34bd('0x1b')]?_[_0x34bd('0x1d')](_0x21c7d6['include'],function(_0x117188){return{'model':db[_0x117188[_0x34bd('0x1c')]],'as':_0x117188['as'],'attributes':_0x117188[_0x34bd('0x19')]};}):[]};}):[]};}):[]:[]})[_0x34bd('0x9')](function(_0x320643){logger[_0x34bd('0xa')]('ShowFreshsalesAccount',_0x38bdba);logger['debug']('ShowFreshsalesAccount',_0x38bdba,JSON[_0x34bd('0x1e')](_0x320643));_0xd176f7(_0x320643);})[_0x34bd('0x12')](function(_0x5e30c5){logger['error'](_0x34bd('0x20'),_0x5e30c5['message'],_0x38bdba);_0x536b2c(_0xca9897['error'](0x1f4,_0x5e30c5[_0x34bd('0x10')]));});});}; \ No newline at end of file +var _0x5f2f=['map','include','model','attributes','then','ShowFreshsalesAccount','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','FreshsalesAccount,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','limit'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4f4033,_0x2378b9){_0x4f4033=_0x4f4033-0x0;var _0x2051ec=_0x5f2f[_0x4f4033];return _0x2051ec;};'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')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')]({'raw':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd['options'][_0xf5f2('0x1b')]===undefined?!![]:![]:!![],'where':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd['options']['where']||null:null,'attributes':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')]['attributes']||null:null,'limit':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')][_0xf5f2('0x1c')]||null:null,'include':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')]['include']?_[_0xf5f2('0x1d')](_0x20fccd[_0xf5f2('0x1a')][_0xf5f2('0x1e')],function(_0x2833fe){return{'model':db[_0x2833fe[_0xf5f2('0x1f')]],'as':_0x2833fe['as'],'attributes':_0x2833fe['attributes'],'include':_0x2833fe['include']?_[_0xf5f2('0x1d')](_0x2833fe[_0xf5f2('0x1e')],function(_0x13da6f){return{'model':db[_0x13da6f[_0xf5f2('0x1f')]],'as':_0x13da6f['as'],'attributes':_0x13da6f[_0xf5f2('0x20')],'include':_0x13da6f[_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x13da6f[_0xf5f2('0x1e')],function(_0x294414){return{'model':db[_0x294414['model']],'as':_0x294414['as'],'attributes':_0x294414[_0xf5f2('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf5f2('0x21')](function(_0x375ca8){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')]('GetFreshsalesAccount',_0x20fccd,JSON['stringify'](_0x375ca8));_0x4ff59b(_0x375ca8);})[_0xf5f2('0x16')](function(_0x14c829){logger[_0xf5f2('0x11')]('GetFreshsalesAccount',_0x14c829['message'],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x14c829[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x22')]=function(_0x153924){var _0x1b381e=this;return new Promise(function(_0x54c0c8,_0x52e959){return db[_0xf5f2('0x18')]['find']({'raw':_0x153924[_0xf5f2('0x1a')]?_0x153924['options'][_0xf5f2('0x1b')]===undefined?!![]:![]:!![],'where':_0x153924[_0xf5f2('0x1a')]?_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x23')]||null:null,'attributes':_0x153924[_0xf5f2('0x1a')]?_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x20')]||null:null,'include':_0x153924[_0xf5f2('0x1a')]?_0x153924['options'][_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x1e')],function(_0x1408b9){return{'model':db[_0x1408b9[_0xf5f2('0x1f')]],'as':_0x1408b9['as'],'attributes':_0x1408b9[_0xf5f2('0x20')],'include':_0x1408b9['include']?_[_0xf5f2('0x1d')](_0x1408b9[_0xf5f2('0x1e')],function(_0x55989d){return{'model':db[_0x55989d[_0xf5f2('0x1f')]],'as':_0x55989d['as'],'attributes':_0x55989d['attributes'],'include':_0x55989d[_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x55989d[_0xf5f2('0x1e')],function(_0x2e3cca){return{'model':db[_0x2e3cca['model']],'as':_0x2e3cca['as'],'attributes':_0x2e3cca['attributes']};}):[]};}):[]};}):[]:[]})[_0xf5f2('0x21')](function(_0x46ad4a){logger[_0xf5f2('0xd')]('ShowFreshsalesAccount',_0x153924);logger[_0xf5f2('0xf')]('ShowFreshsalesAccount',_0x153924,JSON[_0xf5f2('0x10')](_0x46ad4a));_0x54c0c8(_0x46ad4a);})['catch'](function(_0x46f464){logger[_0xf5f2('0x11')]('ShowFreshsalesAccount',_0x46f464[_0xf5f2('0x13')],_0x153924);_0x52e959(_0x1b381e[_0xf5f2('0x11')](0x1f4,_0x46f464[_0xf5f2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index c5aaab7..5bafd98 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 _0xcc0a=['isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xcc0a,0xc0));var _0xacc0=function(_0x148b6a,_0x5f41e3){_0x148b6a=_0x148b6a-0x0;var _0x2a59b8=_0xcc0a[_0x148b6a];return _0x2a59b8;};'use strict';var multer=require('multer');var util=require(_0xacc0('0x0'));var path=require(_0xacc0('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xacc0('0x2')]();var fs_extra=require(_0xacc0('0x3'));var auth=require(_0xacc0('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xacc0('0x5'));var controller=require(_0xacc0('0x6'));router[_0xacc0('0x7')]('/',auth[_0xacc0('0x8')](),controller[_0xacc0('0x9')]);router[_0xacc0('0x7')](_0xacc0('0xa'),auth[_0xacc0('0x8')](),controller[_0xacc0('0xb')]);router[_0xacc0('0x7')](_0xacc0('0xc'),auth[_0xacc0('0x8')](),controller[_0xacc0('0xd')]);router[_0xacc0('0x7')](_0xacc0('0xe'),auth[_0xacc0('0x8')](),controller[_0xacc0('0xf')]);router[_0xacc0('0x7')](_0xacc0('0x10'),auth[_0xacc0('0x8')](),controller[_0xacc0('0x11')]);router[_0xacc0('0x12')]('/',auth[_0xacc0('0x8')](),controller[_0xacc0('0x13')]);router[_0xacc0('0x14')](_0xacc0('0xa'),auth[_0xacc0('0x8')](),controller[_0xacc0('0x15')]);router[_0xacc0('0x16')](_0xacc0('0xa'),auth[_0xacc0('0x8')](),controller[_0xacc0('0x17')]);module[_0xacc0('0x18')]=router; \ No newline at end of file +var _0x635d=['./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','create','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x112b42,_0x17973a){var _0x767e9a=function(_0x450fdd){while(--_0x450fdd){_0x112b42['push'](_0x112b42['shift']());}};_0x767e9a(++_0x17973a);}(_0x635d,0x8d));var _0xd635=function(_0x2ecee7,_0x5840b1){_0x2ecee7=_0x2ecee7-0x0;var _0x1210df=_0x635d[_0x2ecee7];return _0x1210df;};'use strict';var multer=require(_0xd635('0x0'));var util=require(_0xd635('0x1'));var path=require(_0xd635('0x2'));var timeout=require('connect-timeout');var express=require(_0xd635('0x3'));var router=express[_0xd635('0x4')]();var fs_extra=require(_0xd635('0x5'));var auth=require(_0xd635('0x6'));var interaction=require(_0xd635('0x7'));var config=require(_0xd635('0x8'));var controller=require(_0xd635('0x9'));router[_0xd635('0xa')]('/',auth[_0xd635('0xb')](),controller[_0xd635('0xc')]);router[_0xd635('0xa')](_0xd635('0xd'),auth[_0xd635('0xb')](),controller['show']);router[_0xd635('0xa')](_0xd635('0xe'),auth[_0xd635('0xb')](),controller[_0xd635('0xf')]);router[_0xd635('0xa')](_0xd635('0x10'),auth[_0xd635('0xb')](),controller[_0xd635('0x11')]);router[_0xd635('0xa')](_0xd635('0x12'),auth[_0xd635('0xb')](),controller[_0xd635('0x13')]);router['post']('/',auth[_0xd635('0xb')](),controller[_0xd635('0x14')]);router[_0xd635('0x15')](_0xd635('0xd'),auth[_0xd635('0xb')](),controller['update']);router[_0xd635('0x16')](_0xd635('0xd'),auth[_0xd635('0xb')](),controller[_0xd635('0x17')]);module[_0xd635('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 39604d6..c0e65e1 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 _0xe7dd=['exports','STRING','sequelize'];(function(_0x256e32,_0x4013bc){var _0x464070=function(_0x449398){while(--_0x449398){_0x256e32['push'](_0x256e32['shift']());}};_0x464070(++_0x4013bc);}(_0xe7dd,0xd1));var _0xde7d=function(_0x4d7b67,_0x5b3c9f){_0x4d7b67=_0x4d7b67-0x0;var _0x2d85e6=_0xe7dd[_0x4d7b67];return _0x2d85e6;};'use strict';var Sequelize=require(_0xde7d('0x0'));module[_0xde7d('0x1')]={'name':{'type':Sequelize[_0xde7d('0x2')]},'description':{'type':Sequelize[_0xde7d('0x2')]}}; \ No newline at end of file +var _0x6a8e=['STRING'];(function(_0x459820,_0x50202a){var _0x1d0c05=function(_0x3fb2ce){while(--_0x3fb2ce){_0x459820['push'](_0x459820['shift']());}};_0x1d0c05(++_0x50202a);}(_0x6a8e,0x106));var _0xe6a8=function(_0xcdb582,_0x4cf78f){_0xcdb582=_0xcdb582-0x0;var _0x105148=_0x6a8e[_0xcdb582];return _0x105148;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe6a8('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 52c99c1..27ca939 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 _0xf1d7=['moment','bluebird','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','Content-Range','apply','reject','destroy','then','end','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','create','body','find','getSubjects','findOne','FreshsalesField','limit','getDescriptions','params','eml-format','rimraf','zip-dir'];(function(_0x4c8600,_0x2bb8f7){var _0x1399a5=function(_0x212e8d){while(--_0x212e8d){_0x4c8600['push'](_0x4c8600['shift']());}};_0x1399a5(++_0x2bb8f7);}(_0xf1d7,0x17e));var _0x7f1d=function(_0x215764,_0x3229cc){_0x215764=_0x215764-0x0;var _0x156ad1=_0xf1d7[_0x215764];return _0x156ad1;};'use strict';var emlformat=require(_0x7f1d('0x0'));var rimraf=require(_0x7f1d('0x1'));var zipdir=require(_0x7f1d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7f1d('0x3'));var BPromise=require(_0x7f1d('0x4'));var Mustache=require('mustache');var util=require(_0x7f1d('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x7f1d('0x6'));var ejs=require(_0x7f1d('0x7'));var fs=require('fs');var fs_extra=require(_0x7f1d('0x8'));var _=require('lodash');var squel=require(_0x7f1d('0x9'));var crypto=require(_0x7f1d('0xa'));var jsforce=require(_0x7f1d('0xb'));var deskjs=require(_0x7f1d('0xc'));var toCsv=require(_0x7f1d('0x6'));var querystring=require('querystring');var Papa=require(_0x7f1d('0xd'));var Redis=require(_0x7f1d('0xe'));var authService=require(_0x7f1d('0xf'));var qs=require(_0x7f1d('0x10'));var as=require(_0x7f1d('0x11'));var hardwareService=require(_0x7f1d('0x12'));var logger=require(_0x7f1d('0x13'))(_0x7f1d('0x14'));var utils=require(_0x7f1d('0x15'));var config=require(_0x7f1d('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x120977,_0x233c7e){_0x233c7e=_0x233c7e||0xcc;return function(_0x32f617){if(_0x32f617){return _0x120977[_0x7f1d('0x17')](_0x233c7e);}return _0x120977[_0x7f1d('0x18')](_0x233c7e)['end']();};}function respondWithResult(_0x221058,_0x401c81){_0x401c81=_0x401c81||0xc8;return function(_0x4e4602){if(_0x4e4602){return _0x221058['status'](_0x401c81)[_0x7f1d('0x19')](_0x4e4602);}};}function respondWithFilteredResult(_0x4db43c,_0x268214){return function(_0x3cdf3b){if(_0x3cdf3b){var _0x233b9e=typeof _0x268214[_0x7f1d('0x1a')]===_0x7f1d('0x1b')&&typeof _0x268214['limit']==='undefined';var _0x5b8b87=_0x3cdf3b[_0x7f1d('0x1c')];var _0xe8ee=_0x233b9e?0x0:_0x268214['offset'];var _0x2e0fd0=_0x233b9e?_0x3cdf3b['count']:_0x268214['offset']+_0x268214['limit'];var _0x561023;if(_0x2e0fd0>=_0x5b8b87){_0x2e0fd0=_0x5b8b87;_0x561023=0xc8;}else{_0x561023=0xce;}_0x4db43c[_0x7f1d('0x18')](_0x561023);return _0x4db43c['set'](_0x7f1d('0x1d'),_0xe8ee+'-'+_0x2e0fd0+'/'+_0x5b8b87)[_0x7f1d('0x19')](_0x3cdf3b);}return null;};}function patchUpdates(_0x214a36){return function(_0xb04ddc){try{jsonpatch[_0x7f1d('0x1e')](_0xb04ddc,_0x214a36,!![]);}catch(_0x1aef2f){return BPromise[_0x7f1d('0x1f')](_0x1aef2f);}return _0xb04ddc['save']();};}function saveUpdates(_0x3ef891,_0xa91517){return function(_0x55e006){if(_0x55e006){return _0x55e006['update'](_0x3ef891)['then'](function(_0x1599ad){return _0x1599ad;});}return null;};}function removeEntity(_0x4b1134,_0xbfc514){return function(_0x48d181){if(_0x48d181){return _0x48d181[_0x7f1d('0x20')]()[_0x7f1d('0x21')](function(){_0x4b1134[_0x7f1d('0x18')](0xcc)[_0x7f1d('0x22')]();});}};}function handleEntityNotFound(_0x35ac09,_0x2b6f68){return function(_0x446854){if(!_0x446854){_0x35ac09[_0x7f1d('0x17')](0x194);}return _0x446854;};}function handleError(_0x2b853d,_0x389b74){_0x389b74=_0x389b74||0x1f4;return function(_0xecf0e5){logger['error'](_0xecf0e5[_0x7f1d('0x23')]);if(_0xecf0e5[_0x7f1d('0x24')]){delete _0xecf0e5[_0x7f1d('0x24')];}_0x2b853d[_0x7f1d('0x18')](_0x389b74)[_0x7f1d('0x25')](_0xecf0e5);};}exports[_0x7f1d('0x26')]=function(_0x15577e,_0x1d6abf){var _0x5d718f={},_0x42449d={},_0x130178={'count':0x0,'rows':[]};var _0x1c9607=_[_0x7f1d('0x27')](db[_0x7f1d('0x28')][_0x7f1d('0x29')],function(_0x597843){return{'name':_0x597843[_0x7f1d('0x2a')],'type':_0x597843[_0x7f1d('0x2b')][_0x7f1d('0x2c')]};});_0x42449d[_0x7f1d('0x2d')]=_['map'](_0x1c9607,'name');_0x42449d['query']=_[_0x7f1d('0x2e')](_0x15577e[_0x7f1d('0x2f')]);_0x42449d[_0x7f1d('0x30')]=_[_0x7f1d('0x31')](_0x42449d[_0x7f1d('0x2d')],_0x42449d[_0x7f1d('0x2f')]);_0x5d718f['attributes']=_[_0x7f1d('0x31')](_0x42449d[_0x7f1d('0x2d')],qs[_0x7f1d('0x32')](_0x15577e[_0x7f1d('0x2f')][_0x7f1d('0x32')]));_0x5d718f[_0x7f1d('0x33')]=_0x5d718f['attributes'][_0x7f1d('0x34')]?_0x5d718f[_0x7f1d('0x33')]:_0x42449d[_0x7f1d('0x2d')];if(!_0x15577e['query'][_0x7f1d('0x35')](_0x7f1d('0x36'))){_0x5d718f['limit']=qs['limit'](_0x15577e[_0x7f1d('0x2f')]['limit']);_0x5d718f['offset']=qs[_0x7f1d('0x1a')](_0x15577e[_0x7f1d('0x2f')][_0x7f1d('0x1a')]);}_0x5d718f[_0x7f1d('0x37')]=qs['sort'](_0x15577e['query'][_0x7f1d('0x38')]);_0x5d718f[_0x7f1d('0x39')]=qs[_0x7f1d('0x30')](_[_0x7f1d('0x3a')](_0x15577e[_0x7f1d('0x2f')],_0x42449d[_0x7f1d('0x30')]),_0x1c9607);if(_0x15577e[_0x7f1d('0x2f')][_0x7f1d('0x3b')]){_0x5d718f[_0x7f1d('0x39')]=_[_0x7f1d('0x3c')](_0x5d718f[_0x7f1d('0x39')],{'$or':_[_0x7f1d('0x27')](_0x1c9607,function(_0x2a6323){if(_0x2a6323[_0x7f1d('0x2b')]!=='VIRTUAL'){var _0xb4835e={};_0xb4835e[_0x2a6323[_0x7f1d('0x24')]]={'$like':'%'+_0x15577e[_0x7f1d('0x2f')][_0x7f1d('0x3b')]+'%'};return _0xb4835e;}})});}_0x5d718f=_[_0x7f1d('0x3c')]({},_0x5d718f,_0x15577e[_0x7f1d('0x3d')]);var _0x1b57cf={'where':_0x5d718f[_0x7f1d('0x39')]};return db[_0x7f1d('0x28')][_0x7f1d('0x1c')](_0x1b57cf)[_0x7f1d('0x21')](function(_0x515c1a){_0x130178['count']=_0x515c1a;if(_0x15577e[_0x7f1d('0x2f')][_0x7f1d('0x3e')]){_0x5d718f[_0x7f1d('0x3f')]=[{'all':!![]}];}return db[_0x7f1d('0x28')][_0x7f1d('0x40')](_0x5d718f);})['then'](function(_0x31e15d){_0x130178[_0x7f1d('0x41')]=_0x31e15d;return _0x130178;})[_0x7f1d('0x21')](respondWithFilteredResult(_0x1d6abf,_0x5d718f))[_0x7f1d('0x42')](handleError(_0x1d6abf,null));};exports[_0x7f1d('0x43')]=function(_0x4c8045,_0xcde8ff){var _0x1c787b={'raw':![],'where':{'id':_0x4c8045['params']['id']}},_0x101ab8={};_0x101ab8[_0x7f1d('0x2d')]=_[_0x7f1d('0x2e')](db[_0x7f1d('0x28')][_0x7f1d('0x29')]);_0x101ab8[_0x7f1d('0x2f')]=_[_0x7f1d('0x2e')](_0x4c8045['query']);_0x101ab8['filters']=_[_0x7f1d('0x31')](_0x101ab8[_0x7f1d('0x2d')],_0x101ab8[_0x7f1d('0x2f')]);_0x1c787b['attributes']=_[_0x7f1d('0x31')](_0x101ab8['model'],qs['fields'](_0x4c8045['query'][_0x7f1d('0x32')]));_0x1c787b[_0x7f1d('0x33')]=_0x1c787b['attributes']['length']?_0x1c787b[_0x7f1d('0x33')]:_0x101ab8[_0x7f1d('0x2d')];if(_0x4c8045['query'][_0x7f1d('0x3e')]){_0x1c787b[_0x7f1d('0x3f')]=[{'all':!![]}];}_0x1c787b=_[_0x7f1d('0x3c')]({},_0x1c787b,_0x4c8045[_0x7f1d('0x3d')]);return db[_0x7f1d('0x28')]['find'](_0x1c787b)[_0x7f1d('0x21')](handleEntityNotFound(_0xcde8ff,null))[_0x7f1d('0x21')](respondWithResult(_0xcde8ff,null))['catch'](handleError(_0xcde8ff,null));};exports[_0x7f1d('0x44')]=function(_0x3964e1,_0x42146e){return db[_0x7f1d('0x28')][_0x7f1d('0x44')](_0x3964e1['body'],{})[_0x7f1d('0x21')](respondWithResult(_0x42146e,0xc9))[_0x7f1d('0x42')](handleError(_0x42146e,null));};exports['update']=function(_0x2d39a2,_0x3467a5){if(_0x2d39a2['body']['id']){delete _0x2d39a2[_0x7f1d('0x45')]['id'];}return db[_0x7f1d('0x28')]['find']({'where':{'id':_0x2d39a2['params']['id']}})[_0x7f1d('0x21')](handleEntityNotFound(_0x3467a5,null))[_0x7f1d('0x21')](saveUpdates(_0x2d39a2['body'],null))[_0x7f1d('0x21')](respondWithResult(_0x3467a5,null))[_0x7f1d('0x42')](handleError(_0x3467a5,null));};exports[_0x7f1d('0x20')]=function(_0x2b3a09,_0x5b13c8){return db['FreshsalesConfiguration'][_0x7f1d('0x46')]({'where':{'id':_0x2b3a09['params']['id']}})[_0x7f1d('0x21')](handleEntityNotFound(_0x5b13c8,null))['then'](removeEntity(_0x5b13c8,null))[_0x7f1d('0x42')](handleError(_0x5b13c8,null));};exports[_0x7f1d('0x47')]=function(_0x3d6915,_0x5e271f,_0x49c346){var _0x3d69aa={};var _0x5908bc={};var _0x5c8c3e;var _0x43d5ab;return db[_0x7f1d('0x28')][_0x7f1d('0x48')]({'where':{'id':_0x3d6915['params']['id']}})[_0x7f1d('0x21')](handleEntityNotFound(_0x5e271f,null))[_0x7f1d('0x21')](function(_0x1fbc11){if(_0x1fbc11){_0x5c8c3e=_0x1fbc11;_0x5908bc[_0x7f1d('0x2d')]=_[_0x7f1d('0x2e')](db[_0x7f1d('0x49')][_0x7f1d('0x29')]);_0x5908bc[_0x7f1d('0x2f')]=_[_0x7f1d('0x2e')](_0x3d6915['query']);_0x5908bc[_0x7f1d('0x30')]=_['intersection'](_0x5908bc[_0x7f1d('0x2d')],_0x5908bc['query']);_0x3d69aa[_0x7f1d('0x33')]=_[_0x7f1d('0x31')](_0x5908bc[_0x7f1d('0x2d')],qs[_0x7f1d('0x32')](_0x3d6915[_0x7f1d('0x2f')][_0x7f1d('0x32')]));_0x3d69aa[_0x7f1d('0x33')]=_0x3d69aa[_0x7f1d('0x33')][_0x7f1d('0x34')]?_0x3d69aa[_0x7f1d('0x33')]:_0x5908bc[_0x7f1d('0x2d')];_0x3d69aa[_0x7f1d('0x37')]=qs[_0x7f1d('0x38')](_0x3d6915[_0x7f1d('0x2f')][_0x7f1d('0x38')]);_0x3d69aa[_0x7f1d('0x39')]=qs['filters'](_[_0x7f1d('0x3a')](_0x3d6915[_0x7f1d('0x2f')],_0x5908bc[_0x7f1d('0x30')]));if(_0x3d6915[_0x7f1d('0x2f')][_0x7f1d('0x3b')]){_0x3d69aa[_0x7f1d('0x39')]=_['merge'](_0x3d69aa[_0x7f1d('0x39')],{'$or':_[_0x7f1d('0x27')](_0x3d69aa['attributes'],function(_0x25a7cb){var _0x294ee4={};_0x294ee4[_0x25a7cb]={'$like':'%'+_0x3d6915[_0x7f1d('0x2f')]['filter']+'%'};return _0x294ee4;})});}_0x3d69aa=_['merge']({},_0x3d69aa,_0x3d6915[_0x7f1d('0x3d')]);return _0x5c8c3e['getSubjects'](_0x3d69aa);}})[_0x7f1d('0x21')](function(_0x4b1112){if(_0x4b1112){_0x43d5ab=_0x4b1112[_0x7f1d('0x34')];if(!_0x3d6915['query']['hasOwnProperty'](_0x7f1d('0x36'))){_0x3d69aa['limit']=qs[_0x7f1d('0x4a')](_0x3d6915[_0x7f1d('0x2f')][_0x7f1d('0x4a')]);_0x3d69aa['offset']=qs['offset'](_0x3d6915['query']['offset']);}return _0x5c8c3e[_0x7f1d('0x47')](_0x3d69aa);}})[_0x7f1d('0x21')](function(_0x2d80c1){if(_0x2d80c1){return _0x2d80c1?{'count':_0x43d5ab,'rows':_0x2d80c1}:null;}})['then'](respondWithResult(_0x5e271f,null))[_0x7f1d('0x42')](handleError(_0x5e271f,null));};exports[_0x7f1d('0x4b')]=function(_0x1720be,_0x3cdb14,_0x2eaa0a){var _0x473d42={};var _0x531879={};var _0x24f6f5;var _0x57ee23;return db[_0x7f1d('0x28')][_0x7f1d('0x48')]({'where':{'id':_0x1720be[_0x7f1d('0x4c')]['id']}})[_0x7f1d('0x21')](handleEntityNotFound(_0x3cdb14,null))[_0x7f1d('0x21')](function(_0x35e6fe){if(_0x35e6fe){_0x24f6f5=_0x35e6fe;_0x531879['model']=_[_0x7f1d('0x2e')](db[_0x7f1d('0x49')]['rawAttributes']);_0x531879['query']=_['keys'](_0x1720be[_0x7f1d('0x2f')]);_0x531879[_0x7f1d('0x30')]=_[_0x7f1d('0x31')](_0x531879['model'],_0x531879['query']);_0x473d42[_0x7f1d('0x33')]=_['intersection'](_0x531879['model'],qs[_0x7f1d('0x32')](_0x1720be[_0x7f1d('0x2f')][_0x7f1d('0x32')]));_0x473d42[_0x7f1d('0x33')]=_0x473d42[_0x7f1d('0x33')][_0x7f1d('0x34')]?_0x473d42[_0x7f1d('0x33')]:_0x531879[_0x7f1d('0x2d')];_0x473d42[_0x7f1d('0x37')]=qs[_0x7f1d('0x38')](_0x1720be[_0x7f1d('0x2f')][_0x7f1d('0x38')]);_0x473d42[_0x7f1d('0x39')]=qs['filters'](_[_0x7f1d('0x3a')](_0x1720be[_0x7f1d('0x2f')],_0x531879[_0x7f1d('0x30')]));if(_0x1720be['query'][_0x7f1d('0x3b')]){_0x473d42[_0x7f1d('0x39')]=_[_0x7f1d('0x3c')](_0x473d42[_0x7f1d('0x39')],{'$or':_[_0x7f1d('0x27')](_0x473d42[_0x7f1d('0x33')],function(_0x2caec3){var _0x422c45={};_0x422c45[_0x2caec3]={'$like':'%'+_0x1720be[_0x7f1d('0x2f')][_0x7f1d('0x3b')]+'%'};return _0x422c45;})});}_0x473d42=_['merge']({},_0x473d42,_0x1720be[_0x7f1d('0x3d')]);return _0x24f6f5[_0x7f1d('0x4b')](_0x473d42);}})[_0x7f1d('0x21')](function(_0x5398db){if(_0x5398db){_0x57ee23=_0x5398db[_0x7f1d('0x34')];if(!_0x1720be[_0x7f1d('0x2f')][_0x7f1d('0x35')](_0x7f1d('0x36'))){_0x473d42[_0x7f1d('0x4a')]=qs[_0x7f1d('0x4a')](_0x1720be['query'][_0x7f1d('0x4a')]);_0x473d42['offset']=qs[_0x7f1d('0x1a')](_0x1720be[_0x7f1d('0x2f')][_0x7f1d('0x1a')]);}return _0x24f6f5[_0x7f1d('0x4b')](_0x473d42);}})[_0x7f1d('0x21')](function(_0x3374de){if(_0x3374de){return _0x3374de?{'count':_0x57ee23,'rows':_0x3374de}:null;}})['then'](respondWithResult(_0x3cdb14,null))[_0x7f1d('0x42')](handleError(_0x3cdb14,null));};exports['getFields']=function(_0x405a4b,_0x4d84e2,_0x3cd9a0){var _0x3b962b={};var _0x2db247={};var _0x55318c;var _0x1af8c4;return db[_0x7f1d('0x28')][_0x7f1d('0x48')]({'where':{'id':_0x405a4b[_0x7f1d('0x4c')]['id']}})[_0x7f1d('0x21')](handleEntityNotFound(_0x4d84e2,null))[_0x7f1d('0x21')](function(_0x5eb989){if(_0x5eb989){_0x55318c=_0x5eb989;_0x2db247[_0x7f1d('0x2d')]=_['keys'](db['FreshsalesField']['rawAttributes']);_0x2db247[_0x7f1d('0x2f')]=_[_0x7f1d('0x2e')](_0x405a4b[_0x7f1d('0x2f')]);_0x2db247[_0x7f1d('0x30')]=_[_0x7f1d('0x31')](_0x2db247[_0x7f1d('0x2d')],_0x2db247[_0x7f1d('0x2f')]);_0x3b962b[_0x7f1d('0x33')]=_[_0x7f1d('0x31')](_0x2db247[_0x7f1d('0x2d')],qs[_0x7f1d('0x32')](_0x405a4b['query']['fields']));_0x3b962b[_0x7f1d('0x33')]=_0x3b962b[_0x7f1d('0x33')][_0x7f1d('0x34')]?_0x3b962b['attributes']:_0x2db247[_0x7f1d('0x2d')];_0x3b962b[_0x7f1d('0x37')]=qs[_0x7f1d('0x38')](_0x405a4b[_0x7f1d('0x2f')][_0x7f1d('0x38')]);_0x3b962b[_0x7f1d('0x39')]=qs[_0x7f1d('0x30')](_[_0x7f1d('0x3a')](_0x405a4b[_0x7f1d('0x2f')],_0x2db247['filters']));if(_0x405a4b[_0x7f1d('0x2f')][_0x7f1d('0x3b')]){_0x3b962b['where']=_[_0x7f1d('0x3c')](_0x3b962b[_0x7f1d('0x39')],{'$or':_[_0x7f1d('0x27')](_0x3b962b['attributes'],function(_0xdf607d){var _0x56f0d8={};_0x56f0d8[_0xdf607d]={'$like':'%'+_0x405a4b['query']['filter']+'%'};return _0x56f0d8;})});}_0x3b962b=_['merge']({},_0x3b962b,_0x405a4b['options']);return _0x55318c['getFields'](_0x3b962b);}})['then'](function(_0x2424b5){if(_0x2424b5){_0x1af8c4=_0x2424b5['length'];if(!_0x405a4b[_0x7f1d('0x2f')][_0x7f1d('0x35')](_0x7f1d('0x36'))){_0x3b962b[_0x7f1d('0x4a')]=qs['limit'](_0x405a4b[_0x7f1d('0x2f')]['limit']);_0x3b962b[_0x7f1d('0x1a')]=qs[_0x7f1d('0x1a')](_0x405a4b[_0x7f1d('0x2f')]['offset']);}return _0x55318c['getFields'](_0x3b962b);}})[_0x7f1d('0x21')](function(_0x23a61d){if(_0x23a61d){return _0x23a61d?{'count':_0x1af8c4,'rows':_0x23a61d}:null;}})['then'](respondWithResult(_0x4d84e2,null))[_0x7f1d('0x42')](handleError(_0x4d84e2,null));}; \ No newline at end of file +var _0x13b9=['../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','set','json','apply','save','destroy','then','error','stack','name','send','index','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','include','rows','catch','show','params','FreshsalesConfiguration','rawAttributes','includeAll','find','create','body','update','getSubjects','findOne','FreshsalesField','getDescriptions','pick','nolimit','getFields','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','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','../../config/license/util'];(function(_0x44eb31,_0x132866){var _0x3c5e7c=function(_0x13cf57){while(--_0x13cf57){_0x44eb31['push'](_0x44eb31['shift']());}};_0x3c5e7c(++_0x132866);}(_0x13b9,0xdf));var _0x913b=function(_0x4a7834,_0x546dc7){_0x4a7834=_0x4a7834-0x0;var _0x3ee779=_0x13b9[_0x4a7834];return _0x3ee779;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x913b('0x0'));var zipdir=require(_0x913b('0x1'));var jsonpatch=require(_0x913b('0x2'));var rp=require(_0x913b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x913b('0x4'));var util=require(_0x913b('0x5'));var path=require(_0x913b('0x6'));var sox=require(_0x913b('0x7'));var csv=require('to-csv');var ejs=require(_0x913b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x913b('0x9'));var squel=require(_0x913b('0xa'));var crypto=require(_0x913b('0xb'));var jsforce=require(_0x913b('0xc'));var deskjs=require(_0x913b('0xd'));var toCsv=require(_0x913b('0xe'));var querystring=require(_0x913b('0xf'));var Papa=require(_0x913b('0x10'));var Redis=require(_0x913b('0x11'));var authService=require(_0x913b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x913b('0x13'));var hardwareService=require(_0x913b('0x14'));var logger=require(_0x913b('0x15'))(_0x913b('0x16'));var utils=require(_0x913b('0x17'));var config=require(_0x913b('0x18'));var licenseUtil=require(_0x913b('0x19'));var db=require(_0x913b('0x1a'))['db'];function respondWithStatusCode(_0x481542,_0x303cea){_0x303cea=_0x303cea||0xcc;return function(_0x2b2d61){if(_0x2b2d61){return _0x481542[_0x913b('0x1b')](_0x303cea);}return _0x481542[_0x913b('0x1c')](_0x303cea)[_0x913b('0x1d')]();};}function respondWithResult(_0x1a64a8,_0xe43d9f){_0xe43d9f=_0xe43d9f||0xc8;return function(_0xfd5003){if(_0xfd5003){return _0x1a64a8['status'](_0xe43d9f)['json'](_0xfd5003);}};}function respondWithFilteredResult(_0x22fcda,_0x3d18c4){return function(_0x55b51a){if(_0x55b51a){var _0x5ad8f9=typeof _0x3d18c4['offset']===_0x913b('0x1e')&&typeof _0x3d18c4[_0x913b('0x1f')]===_0x913b('0x1e');var _0x1d8e1b=_0x55b51a['count'];var _0x9a8f7a=_0x5ad8f9?0x0:_0x3d18c4[_0x913b('0x20')];var _0x24a367=_0x5ad8f9?_0x55b51a[_0x913b('0x21')]:_0x3d18c4[_0x913b('0x20')]+_0x3d18c4[_0x913b('0x1f')];var _0x4902ae;if(_0x24a367>=_0x1d8e1b){_0x24a367=_0x1d8e1b;_0x4902ae=0xc8;}else{_0x4902ae=0xce;}_0x22fcda['status'](_0x4902ae);return _0x22fcda[_0x913b('0x22')]('Content-Range',_0x9a8f7a+'-'+_0x24a367+'/'+_0x1d8e1b)[_0x913b('0x23')](_0x55b51a);}return null;};}function patchUpdates(_0x383234){return function(_0x4c27ce){try{jsonpatch[_0x913b('0x24')](_0x4c27ce,_0x383234,!![]);}catch(_0x46d968){return BPromise['reject'](_0x46d968);}return _0x4c27ce[_0x913b('0x25')]();};}function saveUpdates(_0x1ac979,_0x5e9e46){return function(_0x49e37c){if(_0x49e37c){return _0x49e37c['update'](_0x1ac979)['then'](function(_0x1adb58){return _0x1adb58;});}return null;};}function removeEntity(_0x57779b,_0x301eb1){return function(_0x5cf392){if(_0x5cf392){return _0x5cf392[_0x913b('0x26')]()[_0x913b('0x27')](function(){_0x57779b['status'](0xcc)[_0x913b('0x1d')]();});}};}function handleEntityNotFound(_0x26d863,_0x25ad74){return function(_0x13bed0){if(!_0x13bed0){_0x26d863['sendStatus'](0x194);}return _0x13bed0;};}function handleError(_0x137f82,_0x13189b){_0x13189b=_0x13189b||0x1f4;return function(_0x391aee){logger[_0x913b('0x28')](_0x391aee[_0x913b('0x29')]);if(_0x391aee[_0x913b('0x2a')]){delete _0x391aee[_0x913b('0x2a')];}_0x137f82[_0x913b('0x1c')](_0x13189b)[_0x913b('0x2b')](_0x391aee);};}exports[_0x913b('0x2c')]=function(_0x305080,_0x7f59b9){var _0x2f2ad7={},_0x5266b7={},_0x49a982={'count':0x0,'rows':[]};var _0x5983b1=_['map'](db['FreshsalesConfiguration']['rawAttributes'],function(_0x7076ba){return{'name':_0x7076ba['fieldName'],'type':_0x7076ba[_0x913b('0x2d')][_0x913b('0x2e')]};});_0x5266b7['model']=_[_0x913b('0x2f')](_0x5983b1,_0x913b('0x2a'));_0x5266b7[_0x913b('0x30')]=_[_0x913b('0x31')](_0x305080[_0x913b('0x30')]);_0x5266b7[_0x913b('0x32')]=_[_0x913b('0x33')](_0x5266b7[_0x913b('0x34')],_0x5266b7['query']);_0x2f2ad7[_0x913b('0x35')]=_[_0x913b('0x33')](_0x5266b7['model'],qs[_0x913b('0x36')](_0x305080[_0x913b('0x30')][_0x913b('0x36')]));_0x2f2ad7[_0x913b('0x35')]=_0x2f2ad7[_0x913b('0x35')][_0x913b('0x37')]?_0x2f2ad7[_0x913b('0x35')]:_0x5266b7[_0x913b('0x34')];if(!_0x305080[_0x913b('0x30')][_0x913b('0x38')]('nolimit')){_0x2f2ad7[_0x913b('0x1f')]=qs['limit'](_0x305080[_0x913b('0x30')][_0x913b('0x1f')]);_0x2f2ad7[_0x913b('0x20')]=qs[_0x913b('0x20')](_0x305080[_0x913b('0x30')][_0x913b('0x20')]);}_0x2f2ad7[_0x913b('0x39')]=qs[_0x913b('0x3a')](_0x305080[_0x913b('0x30')][_0x913b('0x3a')]);_0x2f2ad7['where']=qs[_0x913b('0x32')](_['pick'](_0x305080['query'],_0x5266b7[_0x913b('0x32')]),_0x5983b1);if(_0x305080[_0x913b('0x30')][_0x913b('0x3b')]){_0x2f2ad7[_0x913b('0x3c')]=_[_0x913b('0x3d')](_0x2f2ad7[_0x913b('0x3c')],{'$or':_[_0x913b('0x2f')](_0x5983b1,function(_0x411c34){if(_0x411c34[_0x913b('0x2d')]!==_0x913b('0x3e')){var _0xe2b95b={};_0xe2b95b[_0x411c34[_0x913b('0x2a')]]={'$like':'%'+_0x305080[_0x913b('0x30')][_0x913b('0x3b')]+'%'};return _0xe2b95b;}})});}_0x2f2ad7=_[_0x913b('0x3d')]({},_0x2f2ad7,_0x305080[_0x913b('0x3f')]);var _0x3fa370={'where':_0x2f2ad7[_0x913b('0x3c')]};return db['FreshsalesConfiguration'][_0x913b('0x21')](_0x3fa370)[_0x913b('0x27')](function(_0x1fbfaf){_0x49a982['count']=_0x1fbfaf;if(_0x305080[_0x913b('0x30')]['includeAll']){_0x2f2ad7[_0x913b('0x40')]=[{'all':!![]}];}return db['FreshsalesConfiguration']['findAll'](_0x2f2ad7);})[_0x913b('0x27')](function(_0x53e2c8){_0x49a982[_0x913b('0x41')]=_0x53e2c8;return _0x49a982;})[_0x913b('0x27')](respondWithFilteredResult(_0x7f59b9,_0x2f2ad7))[_0x913b('0x42')](handleError(_0x7f59b9,null));};exports[_0x913b('0x43')]=function(_0x5022cc,_0x2e973a){var _0x52a2a7={'raw':![],'where':{'id':_0x5022cc[_0x913b('0x44')]['id']}},_0x53ca95={};_0x53ca95[_0x913b('0x34')]=_[_0x913b('0x31')](db[_0x913b('0x45')][_0x913b('0x46')]);_0x53ca95[_0x913b('0x30')]=_[_0x913b('0x31')](_0x5022cc[_0x913b('0x30')]);_0x53ca95['filters']=_[_0x913b('0x33')](_0x53ca95['model'],_0x53ca95[_0x913b('0x30')]);_0x52a2a7[_0x913b('0x35')]=_[_0x913b('0x33')](_0x53ca95[_0x913b('0x34')],qs['fields'](_0x5022cc[_0x913b('0x30')]['fields']));_0x52a2a7[_0x913b('0x35')]=_0x52a2a7['attributes'][_0x913b('0x37')]?_0x52a2a7[_0x913b('0x35')]:_0x53ca95[_0x913b('0x34')];if(_0x5022cc[_0x913b('0x30')][_0x913b('0x47')]){_0x52a2a7['include']=[{'all':!![]}];}_0x52a2a7=_[_0x913b('0x3d')]({},_0x52a2a7,_0x5022cc[_0x913b('0x3f')]);return db['FreshsalesConfiguration'][_0x913b('0x48')](_0x52a2a7)[_0x913b('0x27')](handleEntityNotFound(_0x2e973a,null))['then'](respondWithResult(_0x2e973a,null))['catch'](handleError(_0x2e973a,null));};exports['create']=function(_0x50042e,_0x24ac26){return db[_0x913b('0x45')][_0x913b('0x49')](_0x50042e[_0x913b('0x4a')],{})[_0x913b('0x27')](respondWithResult(_0x24ac26,0xc9))[_0x913b('0x42')](handleError(_0x24ac26,null));};exports[_0x913b('0x4b')]=function(_0x2a9c90,_0x3c22fe){if(_0x2a9c90[_0x913b('0x4a')]['id']){delete _0x2a9c90[_0x913b('0x4a')]['id'];}return db['FreshsalesConfiguration'][_0x913b('0x48')]({'where':{'id':_0x2a9c90[_0x913b('0x44')]['id']}})[_0x913b('0x27')](handleEntityNotFound(_0x3c22fe,null))[_0x913b('0x27')](saveUpdates(_0x2a9c90[_0x913b('0x4a')],null))[_0x913b('0x27')](respondWithResult(_0x3c22fe,null))['catch'](handleError(_0x3c22fe,null));};exports[_0x913b('0x26')]=function(_0x5b50a9,_0x206209){return db['FreshsalesConfiguration'][_0x913b('0x48')]({'where':{'id':_0x5b50a9[_0x913b('0x44')]['id']}})[_0x913b('0x27')](handleEntityNotFound(_0x206209,null))['then'](removeEntity(_0x206209,null))[_0x913b('0x42')](handleError(_0x206209,null));};exports[_0x913b('0x4c')]=function(_0x2d4684,_0x7b4836,_0x2975e1){var _0x2534ac={};var _0xa271ca={};var _0x201f01;var _0x1393a2;return db[_0x913b('0x45')][_0x913b('0x4d')]({'where':{'id':_0x2d4684['params']['id']}})[_0x913b('0x27')](handleEntityNotFound(_0x7b4836,null))['then'](function(_0x5f5510){if(_0x5f5510){_0x201f01=_0x5f5510;_0xa271ca[_0x913b('0x34')]=_[_0x913b('0x31')](db[_0x913b('0x4e')][_0x913b('0x46')]);_0xa271ca[_0x913b('0x30')]=_['keys'](_0x2d4684[_0x913b('0x30')]);_0xa271ca[_0x913b('0x32')]=_[_0x913b('0x33')](_0xa271ca[_0x913b('0x34')],_0xa271ca[_0x913b('0x30')]);_0x2534ac['attributes']=_[_0x913b('0x33')](_0xa271ca['model'],qs['fields'](_0x2d4684[_0x913b('0x30')][_0x913b('0x36')]));_0x2534ac[_0x913b('0x35')]=_0x2534ac[_0x913b('0x35')]['length']?_0x2534ac['attributes']:_0xa271ca[_0x913b('0x34')];_0x2534ac[_0x913b('0x39')]=qs[_0x913b('0x3a')](_0x2d4684[_0x913b('0x30')][_0x913b('0x3a')]);_0x2534ac[_0x913b('0x3c')]=qs[_0x913b('0x32')](_['pick'](_0x2d4684['query'],_0xa271ca[_0x913b('0x32')]));if(_0x2d4684['query'][_0x913b('0x3b')]){_0x2534ac[_0x913b('0x3c')]=_[_0x913b('0x3d')](_0x2534ac[_0x913b('0x3c')],{'$or':_[_0x913b('0x2f')](_0x2534ac[_0x913b('0x35')],function(_0x53cf47){var _0x58d8b7={};_0x58d8b7[_0x53cf47]={'$like':'%'+_0x2d4684[_0x913b('0x30')][_0x913b('0x3b')]+'%'};return _0x58d8b7;})});}_0x2534ac=_[_0x913b('0x3d')]({},_0x2534ac,_0x2d4684['options']);return _0x201f01[_0x913b('0x4c')](_0x2534ac);}})[_0x913b('0x27')](function(_0x50f065){if(_0x50f065){_0x1393a2=_0x50f065['length'];if(!_0x2d4684[_0x913b('0x30')][_0x913b('0x38')]('nolimit')){_0x2534ac[_0x913b('0x1f')]=qs['limit'](_0x2d4684[_0x913b('0x30')][_0x913b('0x1f')]);_0x2534ac[_0x913b('0x20')]=qs['offset'](_0x2d4684['query']['offset']);}return _0x201f01[_0x913b('0x4c')](_0x2534ac);}})['then'](function(_0x20f1f7){if(_0x20f1f7){return _0x20f1f7?{'count':_0x1393a2,'rows':_0x20f1f7}:null;}})['then'](respondWithResult(_0x7b4836,null))[_0x913b('0x42')](handleError(_0x7b4836,null));};exports[_0x913b('0x4f')]=function(_0x507505,_0x84b24d,_0x41fca9){var _0x52ad27={};var _0x50aa83={};var _0x24015e;var _0x3afdd3;return db['FreshsalesConfiguration'][_0x913b('0x4d')]({'where':{'id':_0x507505[_0x913b('0x44')]['id']}})[_0x913b('0x27')](handleEntityNotFound(_0x84b24d,null))[_0x913b('0x27')](function(_0x103332){if(_0x103332){_0x24015e=_0x103332;_0x50aa83['model']=_[_0x913b('0x31')](db['FreshsalesField'][_0x913b('0x46')]);_0x50aa83['query']=_[_0x913b('0x31')](_0x507505['query']);_0x50aa83['filters']=_[_0x913b('0x33')](_0x50aa83['model'],_0x50aa83[_0x913b('0x30')]);_0x52ad27[_0x913b('0x35')]=_[_0x913b('0x33')](_0x50aa83[_0x913b('0x34')],qs['fields'](_0x507505['query'][_0x913b('0x36')]));_0x52ad27[_0x913b('0x35')]=_0x52ad27[_0x913b('0x35')][_0x913b('0x37')]?_0x52ad27[_0x913b('0x35')]:_0x50aa83['model'];_0x52ad27['order']=qs[_0x913b('0x3a')](_0x507505[_0x913b('0x30')][_0x913b('0x3a')]);_0x52ad27[_0x913b('0x3c')]=qs[_0x913b('0x32')](_[_0x913b('0x50')](_0x507505[_0x913b('0x30')],_0x50aa83['filters']));if(_0x507505[_0x913b('0x30')][_0x913b('0x3b')]){_0x52ad27[_0x913b('0x3c')]=_['merge'](_0x52ad27[_0x913b('0x3c')],{'$or':_[_0x913b('0x2f')](_0x52ad27['attributes'],function(_0x4ea776){var _0x147554={};_0x147554[_0x4ea776]={'$like':'%'+_0x507505[_0x913b('0x30')][_0x913b('0x3b')]+'%'};return _0x147554;})});}_0x52ad27=_[_0x913b('0x3d')]({},_0x52ad27,_0x507505[_0x913b('0x3f')]);return _0x24015e[_0x913b('0x4f')](_0x52ad27);}})[_0x913b('0x27')](function(_0x344e56){if(_0x344e56){_0x3afdd3=_0x344e56[_0x913b('0x37')];if(!_0x507505['query'][_0x913b('0x38')](_0x913b('0x51'))){_0x52ad27['limit']=qs[_0x913b('0x1f')](_0x507505[_0x913b('0x30')][_0x913b('0x1f')]);_0x52ad27['offset']=qs[_0x913b('0x20')](_0x507505[_0x913b('0x30')][_0x913b('0x20')]);}return _0x24015e[_0x913b('0x4f')](_0x52ad27);}})[_0x913b('0x27')](function(_0xea9f67){if(_0xea9f67){return _0xea9f67?{'count':_0x3afdd3,'rows':_0xea9f67}:null;}})['then'](respondWithResult(_0x84b24d,null))[_0x913b('0x42')](handleError(_0x84b24d,null));};exports[_0x913b('0x52')]=function(_0x5d097a,_0x3697d1,_0x2d19c1){var _0x41d5e7={};var _0x4cab11={};var _0x3b3d02;var _0x59bc0;return db[_0x913b('0x45')]['findOne']({'where':{'id':_0x5d097a['params']['id']}})[_0x913b('0x27')](handleEntityNotFound(_0x3697d1,null))[_0x913b('0x27')](function(_0x579394){if(_0x579394){_0x3b3d02=_0x579394;_0x4cab11[_0x913b('0x34')]=_[_0x913b('0x31')](db[_0x913b('0x4e')][_0x913b('0x46')]);_0x4cab11[_0x913b('0x30')]=_[_0x913b('0x31')](_0x5d097a[_0x913b('0x30')]);_0x4cab11[_0x913b('0x32')]=_[_0x913b('0x33')](_0x4cab11[_0x913b('0x34')],_0x4cab11[_0x913b('0x30')]);_0x41d5e7['attributes']=_['intersection'](_0x4cab11[_0x913b('0x34')],qs[_0x913b('0x36')](_0x5d097a[_0x913b('0x30')][_0x913b('0x36')]));_0x41d5e7[_0x913b('0x35')]=_0x41d5e7[_0x913b('0x35')]['length']?_0x41d5e7[_0x913b('0x35')]:_0x4cab11[_0x913b('0x34')];_0x41d5e7[_0x913b('0x39')]=qs[_0x913b('0x3a')](_0x5d097a[_0x913b('0x30')]['sort']);_0x41d5e7[_0x913b('0x3c')]=qs['filters'](_[_0x913b('0x50')](_0x5d097a[_0x913b('0x30')],_0x4cab11[_0x913b('0x32')]));if(_0x5d097a['query']['filter']){_0x41d5e7[_0x913b('0x3c')]=_[_0x913b('0x3d')](_0x41d5e7[_0x913b('0x3c')],{'$or':_['map'](_0x41d5e7[_0x913b('0x35')],function(_0x397c36){var _0x5374d6={};_0x5374d6[_0x397c36]={'$like':'%'+_0x5d097a[_0x913b('0x30')]['filter']+'%'};return _0x5374d6;})});}_0x41d5e7=_['merge']({},_0x41d5e7,_0x5d097a[_0x913b('0x3f')]);return _0x3b3d02[_0x913b('0x52')](_0x41d5e7);}})[_0x913b('0x27')](function(_0x22b9f8){if(_0x22b9f8){_0x59bc0=_0x22b9f8['length'];if(!_0x5d097a[_0x913b('0x30')][_0x913b('0x38')]('nolimit')){_0x41d5e7[_0x913b('0x1f')]=qs[_0x913b('0x1f')](_0x5d097a[_0x913b('0x30')][_0x913b('0x1f')]);_0x41d5e7[_0x913b('0x20')]=qs[_0x913b('0x20')](_0x5d097a[_0x913b('0x30')]['offset']);}return _0x3b3d02[_0x913b('0x52')](_0x41d5e7);}})[_0x913b('0x27')](function(_0x477dfa){if(_0x477dfa){return _0x477dfa?{'count':_0x59bc0,'rows':_0x477dfa}:null;}})[_0x913b('0x27')](respondWithResult(_0x3697d1,null))[_0x913b('0x42')](handleError(_0x3697d1,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 771648d..f3bede1 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 _0xfda1=['FreshsalesConfiguration','util','../../config/logger','api','moment','bluebird','request-promise','path','./intFreshsalesConfiguration.attributes'];(function(_0x22c60a,_0x1e05ea){var _0x5b08aa=function(_0x58405e){while(--_0x58405e){_0x22c60a['push'](_0x22c60a['shift']());}};_0x5b08aa(++_0x1e05ea);}(_0xfda1,0x1c3));var _0x1fda=function(_0x4de2de,_0x2171db){_0x4de2de=_0x4de2de-0x0;var _0x2e3372=_0xfda1[_0x4de2de];return _0x2e3372;};'use strict';var _=require('lodash');var util=require(_0x1fda('0x0'));var logger=require(_0x1fda('0x1'))(_0x1fda('0x2'));var moment=require(_0x1fda('0x3'));var BPromise=require(_0x1fda('0x4'));var rp=require(_0x1fda('0x5'));var fs=require('fs');var path=require(_0x1fda('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1fda('0x7'));module['exports']=function(_0xd68d58,_0x40333d){return _0xd68d58['define'](_0x1fda('0x8'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4cec=['exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','api','bluebird','request-promise','path','./intFreshsalesConfiguration.attributes'];(function(_0x158c34,_0x3b39e5){var _0x393d5c=function(_0x3c6c50){while(--_0x3c6c50){_0x158c34['push'](_0x158c34['shift']());}};_0x393d5c(++_0x3b39e5);}(_0x4cec,0x88));var _0xc4ce=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x4cec[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0xc4ce('0x0'));var util=require(_0xc4ce('0x1'));var logger=require('../../config/logger')(_0xc4ce('0x2'));var moment=require('moment');var BPromise=require(_0xc4ce('0x3'));var rp=require(_0xc4ce('0x4'));var fs=require('fs');var path=require(_0xc4ce('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc4ce('0x6'));module[_0xc4ce('0x7')]=function(_0x2887bc,_0xf9789f){return _0x2887bc[_0xc4ce('0x8')](_0xc4ce('0x9'),attributes,{'tableName':_0xc4ce('0xa'),'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 4dd78fb..655cc4b 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 _0x585e=['jayson/promise','client','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0xe56605,_0x150790){var _0x24ab92=function(_0x43a165){while(--_0x43a165){_0xe56605['push'](_0xe56605['shift']());}};_0x24ab92(++_0x150790);}(_0x585e,0x163));var _0xe585=function(_0x43d8b9,_0x95699a){_0x43d8b9=_0x43d8b9-0x0;var _0xd0ece7=_0x585e[_0x43d8b9];return _0xd0ece7;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe585('0x0'));var fs=require('fs');var Redis=require(_0xe585('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xe585('0x2'));var logger=require(_0xe585('0x3'))(_0xe585('0x4'));var config=require('../../config/environment');var jayson=require(_0xe585('0x5'));var client=jayson[_0xe585('0x6')][_0xe585('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x37026d,_0x280cbf,_0x448681){return new BPromise(function(_0x5ceccd,_0x2facf9){return client['request'](_0x37026d,_0x448681)[_0xe585('0x8')](function(_0x2437c0){logger[_0xe585('0x9')](_0xe585('0xa'),_0x280cbf,_0xe585('0xb'));logger[_0xe585('0xc')](_0xe585('0xd'),_0x280cbf,_0xe585('0xb'),JSON[_0xe585('0xe')](_0x2437c0));if(_0x2437c0['error']){if(_0x2437c0[_0xe585('0xf')][_0xe585('0x10')]===0x1f4){logger[_0xe585('0xf')](_0xe585('0xa'),_0x280cbf,_0x2437c0['error'][_0xe585('0x11')]);return _0x2facf9(_0x2437c0['error'][_0xe585('0x11')]);}logger[_0xe585('0xf')](_0xe585('0xa'),_0x280cbf,_0x2437c0[_0xe585('0xf')][_0xe585('0x11')]);return _0x5ceccd(_0x2437c0[_0xe585('0xf')][_0xe585('0x11')]);}else{logger[_0xe585('0x9')](_0xe585('0xa'),_0x280cbf,_0xe585('0xb'));_0x5ceccd(_0x2437c0[_0xe585('0x12')][_0xe585('0x11')]);}})[_0xe585('0x13')](function(_0xce33ce){logger[_0xe585('0xf')](_0xe585('0xa'),_0x280cbf,_0xce33ce);_0x2facf9(_0xce33ce);});});} \ No newline at end of file +var _0x8d0b=['../../config/environment','jayson/promise','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x8d0b,0x1f1));var _0xb8d0=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x8d0b[_0x1b7368];return _0x25d54c;};'use strict';var _=require(_0xb8d0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb8d0('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb8d0('0x2'));var db=require(_0xb8d0('0x3'))['db'];var utils=require(_0xb8d0('0x4'));var logger=require(_0xb8d0('0x5'))(_0xb8d0('0x6'));var config=require(_0xb8d0('0x7'));var jayson=require(_0xb8d0('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x597d76,_0x802a38,_0xd56ff1){return new BPromise(function(_0x6f9d39,_0x9bde7b){return client[_0xb8d0('0x9')](_0x597d76,_0xd56ff1)[_0xb8d0('0xa')](function(_0x456050){logger['info'](_0xb8d0('0xb'),_0x802a38,_0xb8d0('0xc'));logger[_0xb8d0('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x802a38,_0xb8d0('0xc'),JSON[_0xb8d0('0xe')](_0x456050));if(_0x456050[_0xb8d0('0xf')]){if(_0x456050[_0xb8d0('0xf')][_0xb8d0('0x10')]===0x1f4){logger[_0xb8d0('0xf')](_0xb8d0('0xb'),_0x802a38,_0x456050[_0xb8d0('0xf')][_0xb8d0('0x11')]);return _0x9bde7b(_0x456050[_0xb8d0('0xf')][_0xb8d0('0x11')]);}logger[_0xb8d0('0xf')](_0xb8d0('0xb'),_0x802a38,_0x456050['error']['message']);return _0x6f9d39(_0x456050[_0xb8d0('0xf')]['message']);}else{logger[_0xb8d0('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x802a38,_0xb8d0('0xc'));_0x6f9d39(_0x456050[_0xb8d0('0x13')][_0xb8d0('0x11')]);}})[_0xb8d0('0x14')](function(_0x1d06c0){logger[_0xb8d0('0xf')](_0xb8d0('0xb'),_0x802a38,_0x1d06c0);_0x9bde7b(_0x1d06c0);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index e01edb2..e6700d1 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 _0xe700=['delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put'];(function(_0x2aaa60,_0x22258f){var _0x2e3fa5=function(_0x335589){while(--_0x335589){_0x2aaa60['push'](_0x2aaa60['shift']());}};_0x2e3fa5(++_0x22258f);}(_0xe700,0x16a));var _0x0e70=function(_0x38a286,_0x23c7e5){_0x38a286=_0x38a286-0x0;var _0x5705bd=_0xe700[_0x38a286];return _0x5705bd;};'use strict';var multer=require(_0x0e70('0x0'));var util=require(_0x0e70('0x1'));var path=require(_0x0e70('0x2'));var timeout=require(_0x0e70('0x3'));var express=require(_0x0e70('0x4'));var router=express['Router']();var fs_extra=require(_0x0e70('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0e70('0x6'));var config=require(_0x0e70('0x7'));var controller=require('./intFreshsalesField.controller');router['get']('/',auth[_0x0e70('0x8')](),controller[_0x0e70('0x9')]);router[_0x0e70('0xa')](_0x0e70('0xb'),auth['isAuthenticated'](),controller[_0x0e70('0xc')]);router[_0x0e70('0xd')]('/',auth[_0x0e70('0x8')](),controller[_0x0e70('0xe')]);router[_0x0e70('0xf')](_0x0e70('0xb'),auth[_0x0e70('0x8')](),controller['update']);router[_0x0e70('0x10')](_0x0e70('0xb'),auth[_0x0e70('0x8')](),controller['destroy']);module[_0x0e70('0x11')]=router; \ No newline at end of file +var _0xe2cc=['get','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller'];(function(_0x2fe89c,_0x196aa1){var _0x55a7fb=function(_0x5e44a1){while(--_0x5e44a1){_0x2fe89c['push'](_0x2fe89c['shift']());}};_0x55a7fb(++_0x196aa1);}(_0xe2cc,0x69));var _0xce2c=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xe2cc[_0x297fd3];return _0x2af381;};'use strict';var multer=require(_0xce2c('0x0'));var util=require(_0xce2c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xce2c('0x2'));var router=express[_0xce2c('0x3')]();var fs_extra=require(_0xce2c('0x4'));var auth=require(_0xce2c('0x5'));var interaction=require(_0xce2c('0x6'));var config=require(_0xce2c('0x7'));var controller=require(_0xce2c('0x8'));router[_0xce2c('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xce2c('0x9')](_0xce2c('0xa'),auth[_0xce2c('0xb')](),controller[_0xce2c('0xc')]);router[_0xce2c('0xd')]('/',auth[_0xce2c('0xb')](),controller['create']);router[_0xce2c('0xe')](_0xce2c('0xa'),auth[_0xce2c('0xb')](),controller[_0xce2c('0xf')]);router[_0xce2c('0x10')](_0xce2c('0xa'),auth[_0xce2c('0xb')](),controller[_0xce2c('0x11')]);module[_0xce2c('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 017b610..bbc27bf 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 _0xa1d6=['keyValue','picklist','string','STRING','BOOLEAN','ENUM','variable','customVariable'];(function(_0x5e40d8,_0x21782c){var _0x5bcf78=function(_0x47e102){while(--_0x47e102){_0x5e40d8['push'](_0x5e40d8['shift']());}};_0x5bcf78(++_0x21782c);}(_0xa1d6,0xf5));var _0x6a1d=function(_0x296373,_0x4dc0dc){_0x296373=_0x296373-0x0;var _0x448cd6=_0xa1d6[_0x296373];return _0x448cd6;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x6a1d('0x0')]('string',_0x6a1d('0x1'),_0x6a1d('0x2'),_0x6a1d('0x3'),_0x6a1d('0x4')),'defaultValue':_0x6a1d('0x5')},'content':{'type':Sequelize[_0x6a1d('0x6')]},'key':{'type':Sequelize[_0x6a1d('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x6a1d('0x1'),_0x6a1d('0x2'))},'keyContent':{'type':Sequelize[_0x6a1d('0x6')]},'idField':{'type':Sequelize[_0x6a1d('0x6')]},'nameField':{'type':Sequelize[_0x6a1d('0x6')]},'customField':{'type':Sequelize[_0x6a1d('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6a1d('0x6')]}}; \ No newline at end of file +var _0xaca5=['exports','ENUM','variable','customVariable','keyValue','picklist','STRING','string','BOOLEAN'];(function(_0xd54806,_0x4a2d43){var _0x5673e9=function(_0x677798){while(--_0x677798){_0xd54806['push'](_0xd54806['shift']());}};_0x5673e9(++_0x4a2d43);}(_0xaca5,0x132));var _0x5aca=function(_0x21ce75,_0x306b92){_0x21ce75=_0x21ce75-0x0;var _0x4432be=_0xaca5[_0x21ce75];return _0x4432be;};'use strict';var Sequelize=require('sequelize');module[_0x5aca('0x0')]={'type':{'type':Sequelize[_0x5aca('0x1')]('string',_0x5aca('0x2'),_0x5aca('0x3'),_0x5aca('0x4'),_0x5aca('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x5aca('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x5aca('0x7'),_0x5aca('0x2'),_0x5aca('0x3'))},'keyContent':{'type':Sequelize[_0x5aca('0x6')]},'idField':{'type':Sequelize[_0x5aca('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5aca('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5aca('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index d645002..3bc5ff5 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 _0x74ce=['api','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','Content-Range','json','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','FreshsalesField','includeAll','findAll','catch','params','length','include','options','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x21353c,_0x2ea587){var _0xa99120=function(_0x557f33){while(--_0x557f33){_0x21353c['push'](_0x21353c['shift']());}};_0xa99120(++_0x2ea587);}(_0x74ce,0x7e));var _0xe74c=function(_0x3ca788,_0x235eab){_0x3ca788=_0x3ca788-0x0;var _0x2657c6=_0x74ce[_0x3ca788];return _0x2657c6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe74c('0x0'));var zipdir=require(_0xe74c('0x1'));var jsonpatch=require(_0xe74c('0x2'));var rp=require(_0xe74c('0x3'));var moment=require(_0xe74c('0x4'));var BPromise=require(_0xe74c('0x5'));var Mustache=require('mustache');var util=require(_0xe74c('0x6'));var path=require(_0xe74c('0x7'));var sox=require('sox');var csv=require(_0xe74c('0x8'));var ejs=require(_0xe74c('0x9'));var fs=require('fs');var fs_extra=require(_0xe74c('0xa'));var _=require(_0xe74c('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe74c('0xc'));var deskjs=require(_0xe74c('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe74c('0xe'));var Papa=require(_0xe74c('0xf'));var Redis=require('ioredis');var authService=require(_0xe74c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe74c('0x11'));var hardwareService=require(_0xe74c('0x12'));var logger=require(_0xe74c('0x13'))(_0xe74c('0x14'));var utils=require('../../config/utils');var config=require(_0xe74c('0x15'));var licenseUtil=require(_0xe74c('0x16'));var db=require(_0xe74c('0x17'))['db'];function respondWithStatusCode(_0x55aead,_0x25f5d5){_0x25f5d5=_0x25f5d5||0xcc;return function(_0x59b859){if(_0x59b859){return _0x55aead['sendStatus'](_0x25f5d5);}return _0x55aead['status'](_0x25f5d5)['end']();};}function respondWithResult(_0x23a37d,_0x38a541){_0x38a541=_0x38a541||0xc8;return function(_0xc10e18){if(_0xc10e18){return _0x23a37d[_0xe74c('0x18')](_0x38a541)['json'](_0xc10e18);}};}function respondWithFilteredResult(_0x31cc77,_0x18eb62){return function(_0x1d66ea){if(_0x1d66ea){var _0x4d6260=typeof _0x18eb62[_0xe74c('0x19')]===_0xe74c('0x1a')&&typeof _0x18eb62['limit']===_0xe74c('0x1a');var _0x463d00=_0x1d66ea[_0xe74c('0x1b')];var _0xfdd364=_0x4d6260?0x0:_0x18eb62[_0xe74c('0x19')];var _0x1e3b74=_0x4d6260?_0x1d66ea[_0xe74c('0x1b')]:_0x18eb62[_0xe74c('0x19')]+_0x18eb62[_0xe74c('0x1c')];var _0x1bd2ca;if(_0x1e3b74>=_0x463d00){_0x1e3b74=_0x463d00;_0x1bd2ca=0xc8;}else{_0x1bd2ca=0xce;}_0x31cc77[_0xe74c('0x18')](_0x1bd2ca);return _0x31cc77['set'](_0xe74c('0x1d'),_0xfdd364+'-'+_0x1e3b74+'/'+_0x463d00)[_0xe74c('0x1e')](_0x1d66ea);}return null;};}function patchUpdates(_0x188af2){return function(_0x588647){try{jsonpatch[_0xe74c('0x1f')](_0x588647,_0x188af2,!![]);}catch(_0x1f8965){return BPromise[_0xe74c('0x20')](_0x1f8965);}return _0x588647[_0xe74c('0x21')]();};}function saveUpdates(_0x59686c,_0x20ec76){return function(_0x4142ba){if(_0x4142ba){return _0x4142ba['update'](_0x59686c)[_0xe74c('0x22')](function(_0x8463eb){return _0x8463eb;});}return null;};}function removeEntity(_0x3cad64,_0x4a5d90){return function(_0x3f1dab){if(_0x3f1dab){return _0x3f1dab[_0xe74c('0x23')]()[_0xe74c('0x22')](function(){_0x3cad64['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16c1a9,_0x1293c8){return function(_0x16a869){if(!_0x16a869){_0x16c1a9[_0xe74c('0x24')](0x194);}return _0x16a869;};}function handleError(_0x8af205,_0x5099b4){_0x5099b4=_0x5099b4||0x1f4;return function(_0x1a18bf){logger[_0xe74c('0x25')](_0x1a18bf[_0xe74c('0x26')]);if(_0x1a18bf[_0xe74c('0x27')]){delete _0x1a18bf['name'];}_0x8af205[_0xe74c('0x18')](_0x5099b4)[_0xe74c('0x28')](_0x1a18bf);};}exports[_0xe74c('0x29')]=function(_0x1c1eb9,_0x40493e){var _0x212279={},_0x24c067={},_0x557dc6={'count':0x0,'rows':[]};var _0x465789=_[_0xe74c('0x2a')](db['FreshsalesField'][_0xe74c('0x2b')],function(_0x1ab847){return{'name':_0x1ab847[_0xe74c('0x2c')],'type':_0x1ab847[_0xe74c('0x2d')][_0xe74c('0x2e')]};});_0x24c067[_0xe74c('0x2f')]=_[_0xe74c('0x2a')](_0x465789,'name');_0x24c067[_0xe74c('0x30')]=_[_0xe74c('0x31')](_0x1c1eb9[_0xe74c('0x30')]);_0x24c067[_0xe74c('0x32')]=_[_0xe74c('0x33')](_0x24c067['model'],_0x24c067['query']);_0x212279[_0xe74c('0x34')]=_[_0xe74c('0x33')](_0x24c067[_0xe74c('0x2f')],qs[_0xe74c('0x35')](_0x1c1eb9[_0xe74c('0x30')]['fields']));_0x212279[_0xe74c('0x34')]=_0x212279['attributes']['length']?_0x212279[_0xe74c('0x34')]:_0x24c067[_0xe74c('0x2f')];if(!_0x1c1eb9[_0xe74c('0x30')][_0xe74c('0x36')](_0xe74c('0x37'))){_0x212279['limit']=qs[_0xe74c('0x1c')](_0x1c1eb9[_0xe74c('0x30')][_0xe74c('0x1c')]);_0x212279[_0xe74c('0x19')]=qs[_0xe74c('0x19')](_0x1c1eb9[_0xe74c('0x30')]['offset']);}_0x212279[_0xe74c('0x38')]=qs[_0xe74c('0x39')](_0x1c1eb9[_0xe74c('0x30')][_0xe74c('0x39')]);_0x212279['where']=qs[_0xe74c('0x32')](_[_0xe74c('0x3a')](_0x1c1eb9[_0xe74c('0x30')],_0x24c067[_0xe74c('0x32')]),_0x465789);if(_0x1c1eb9[_0xe74c('0x30')][_0xe74c('0x3b')]){_0x212279[_0xe74c('0x3c')]=_[_0xe74c('0x3d')](_0x212279[_0xe74c('0x3c')],{'$or':_[_0xe74c('0x2a')](_0x465789,function(_0x32ee8d){if(_0x32ee8d[_0xe74c('0x2d')]!=='VIRTUAL'){var _0x2d18aa={};_0x2d18aa[_0x32ee8d[_0xe74c('0x27')]]={'$like':'%'+_0x1c1eb9[_0xe74c('0x30')][_0xe74c('0x3b')]+'%'};return _0x2d18aa;}})});}_0x212279=_[_0xe74c('0x3d')]({},_0x212279,_0x1c1eb9['options']);var _0x48105f={'where':_0x212279[_0xe74c('0x3c')]};return db[_0xe74c('0x3e')][_0xe74c('0x1b')](_0x48105f)[_0xe74c('0x22')](function(_0x2776c7){_0x557dc6[_0xe74c('0x1b')]=_0x2776c7;if(_0x1c1eb9[_0xe74c('0x30')][_0xe74c('0x3f')]){_0x212279['include']=[{'all':!![]}];}return db[_0xe74c('0x3e')][_0xe74c('0x40')](_0x212279);})[_0xe74c('0x22')](function(_0x1f752f){_0x557dc6['rows']=_0x1f752f;return _0x557dc6;})[_0xe74c('0x22')](respondWithFilteredResult(_0x40493e,_0x212279))[_0xe74c('0x41')](handleError(_0x40493e,null));};exports['show']=function(_0x12fb0d,_0x493b0d){var _0x1a9f3a={'raw':!![],'where':{'id':_0x12fb0d[_0xe74c('0x42')]['id']}},_0x3e858b={};_0x3e858b[_0xe74c('0x2f')]=_[_0xe74c('0x31')](db['FreshsalesField'][_0xe74c('0x2b')]);_0x3e858b[_0xe74c('0x30')]=_[_0xe74c('0x31')](_0x12fb0d[_0xe74c('0x30')]);_0x3e858b['filters']=_[_0xe74c('0x33')](_0x3e858b['model'],_0x3e858b[_0xe74c('0x30')]);_0x1a9f3a[_0xe74c('0x34')]=_['intersection'](_0x3e858b[_0xe74c('0x2f')],qs[_0xe74c('0x35')](_0x12fb0d['query'][_0xe74c('0x35')]));_0x1a9f3a[_0xe74c('0x34')]=_0x1a9f3a['attributes'][_0xe74c('0x43')]?_0x1a9f3a[_0xe74c('0x34')]:_0x3e858b['model'];if(_0x12fb0d[_0xe74c('0x30')][_0xe74c('0x3f')]){_0x1a9f3a[_0xe74c('0x44')]=[{'all':!![]}];}_0x1a9f3a=_[_0xe74c('0x3d')]({},_0x1a9f3a,_0x12fb0d[_0xe74c('0x45')]);return db[_0xe74c('0x3e')][_0xe74c('0x46')](_0x1a9f3a)[_0xe74c('0x22')](handleEntityNotFound(_0x493b0d,null))[_0xe74c('0x22')](respondWithResult(_0x493b0d,null))['catch'](handleError(_0x493b0d,null));};exports[_0xe74c('0x47')]=function(_0x294043,_0x21909e){return db[_0xe74c('0x3e')][_0xe74c('0x47')](_0x294043[_0xe74c('0x48')],{})[_0xe74c('0x22')](respondWithResult(_0x21909e,0xc9))['catch'](handleError(_0x21909e,null));};exports['update']=function(_0x23bc44,_0xd9419){if(_0x23bc44[_0xe74c('0x48')]['id']){delete _0x23bc44[_0xe74c('0x48')]['id'];}return db['FreshsalesField'][_0xe74c('0x46')]({'where':{'id':_0x23bc44['params']['id']}})[_0xe74c('0x22')](handleEntityNotFound(_0xd9419,null))[_0xe74c('0x22')](saveUpdates(_0x23bc44[_0xe74c('0x48')],null))[_0xe74c('0x22')](respondWithResult(_0xd9419,null))[_0xe74c('0x41')](handleError(_0xd9419,null));};exports['destroy']=function(_0xf42996,_0x4e8ed5){return db[_0xe74c('0x3e')][_0xe74c('0x46')]({'where':{'id':_0xf42996[_0xe74c('0x42')]['id']}})[_0xe74c('0x22')](handleEntityNotFound(_0x4e8ed5,null))['then'](removeEntity(_0x4e8ed5,null))[_0xe74c('0x41')](handleError(_0x4e8ed5,null));}; \ No newline at end of file +var _0x3c17=['sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','count','limit','set','reject','save','update','destroy','then','end','stack','map','FreshsalesField','fieldName','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x1e3d88,_0x407234){var _0x1dc450=function(_0x4fa834){while(--_0x4fa834){_0x1e3d88['push'](_0x1e3d88['shift']());}};_0x1dc450(++_0x407234);}(_0x3c17,0x12e));var _0x73c1=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x3c17[_0x3635ce];return _0x97ecd0;};'use strict';var emlformat=require(_0x73c1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x73c1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x73c1('0x2'));var moment=require(_0x73c1('0x3'));var BPromise=require(_0x73c1('0x4'));var Mustache=require(_0x73c1('0x5'));var util=require(_0x73c1('0x6'));var path=require(_0x73c1('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x73c1('0x8'));var fs=require('fs');var fs_extra=require(_0x73c1('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x73c1('0xa'));var jsforce=require(_0x73c1('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x73c1('0xc'));var querystring=require(_0x73c1('0xd'));var Papa=require(_0x73c1('0xe'));var Redis=require(_0x73c1('0xf'));var authService=require(_0x73c1('0x10'));var qs=require(_0x73c1('0x11'));var as=require(_0x73c1('0x12'));var hardwareService=require(_0x73c1('0x13'));var logger=require(_0x73c1('0x14'))('api');var utils=require(_0x73c1('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x73c1('0x16'));var db=require(_0x73c1('0x17'))['db'];function respondWithStatusCode(_0x1abacb,_0x438443){_0x438443=_0x438443||0xcc;return function(_0x1e413e){if(_0x1e413e){return _0x1abacb[_0x73c1('0x18')](_0x438443);}return _0x1abacb[_0x73c1('0x19')](_0x438443)['end']();};}function respondWithResult(_0x32acbd,_0x3c4954){_0x3c4954=_0x3c4954||0xc8;return function(_0x1cac6b){if(_0x1cac6b){return _0x32acbd[_0x73c1('0x19')](_0x3c4954)[_0x73c1('0x1a')](_0x1cac6b);}};}function respondWithFilteredResult(_0x23f165,_0x506324){return function(_0x1779fe){if(_0x1779fe){var _0x2b27ed=typeof _0x506324['offset']===_0x73c1('0x1b')&&typeof _0x506324['limit']===_0x73c1('0x1b');var _0x3ab528=_0x1779fe['count'];var _0x1f4528=_0x2b27ed?0x0:_0x506324[_0x73c1('0x1c')];var _0x2eef90=_0x2b27ed?_0x1779fe[_0x73c1('0x1d')]:_0x506324[_0x73c1('0x1c')]+_0x506324[_0x73c1('0x1e')];var _0x118799;if(_0x2eef90>=_0x3ab528){_0x2eef90=_0x3ab528;_0x118799=0xc8;}else{_0x118799=0xce;}_0x23f165['status'](_0x118799);return _0x23f165[_0x73c1('0x1f')]('Content-Range',_0x1f4528+'-'+_0x2eef90+'/'+_0x3ab528)[_0x73c1('0x1a')](_0x1779fe);}return null;};}function patchUpdates(_0x5d8f91){return function(_0x17b7d8){try{jsonpatch['apply'](_0x17b7d8,_0x5d8f91,!![]);}catch(_0x47b71b){return BPromise[_0x73c1('0x20')](_0x47b71b);}return _0x17b7d8[_0x73c1('0x21')]();};}function saveUpdates(_0x4d9e21,_0x16d76c){return function(_0x32fb18){if(_0x32fb18){return _0x32fb18[_0x73c1('0x22')](_0x4d9e21)['then'](function(_0x54ff31){return _0x54ff31;});}return null;};}function removeEntity(_0xe25135,_0x5afd9a){return function(_0x51233c){if(_0x51233c){return _0x51233c[_0x73c1('0x23')]()[_0x73c1('0x24')](function(){_0xe25135[_0x73c1('0x19')](0xcc)[_0x73c1('0x25')]();});}};}function handleEntityNotFound(_0x142327,_0x4b968a){return function(_0x292761){if(!_0x292761){_0x142327[_0x73c1('0x18')](0x194);}return _0x292761;};}function handleError(_0x5cc1cb,_0x51eaaa){_0x51eaaa=_0x51eaaa||0x1f4;return function(_0x41db57){logger['error'](_0x41db57[_0x73c1('0x26')]);if(_0x41db57['name']){delete _0x41db57['name'];}_0x5cc1cb[_0x73c1('0x19')](_0x51eaaa)['send'](_0x41db57);};}exports['index']=function(_0x14e217,_0x1165e3){var _0x3b83d4={},_0x38d790={},_0x5afb9a={'count':0x0,'rows':[]};var _0x134c62=_[_0x73c1('0x27')](db[_0x73c1('0x28')]['rawAttributes'],function(_0x45c14b){return{'name':_0x45c14b[_0x73c1('0x29')],'type':_0x45c14b['type']['key']};});_0x38d790[_0x73c1('0x2a')]=_['map'](_0x134c62,_0x73c1('0x2b'));_0x38d790[_0x73c1('0x2c')]=_['keys'](_0x14e217[_0x73c1('0x2c')]);_0x38d790[_0x73c1('0x2d')]=_[_0x73c1('0x2e')](_0x38d790[_0x73c1('0x2a')],_0x38d790[_0x73c1('0x2c')]);_0x3b83d4['attributes']=_['intersection'](_0x38d790[_0x73c1('0x2a')],qs['fields'](_0x14e217['query'][_0x73c1('0x2f')]));_0x3b83d4[_0x73c1('0x30')]=_0x3b83d4['attributes'][_0x73c1('0x31')]?_0x3b83d4['attributes']:_0x38d790[_0x73c1('0x2a')];if(!_0x14e217['query'][_0x73c1('0x32')](_0x73c1('0x33'))){_0x3b83d4[_0x73c1('0x1e')]=qs['limit'](_0x14e217[_0x73c1('0x2c')][_0x73c1('0x1e')]);_0x3b83d4[_0x73c1('0x1c')]=qs['offset'](_0x14e217[_0x73c1('0x2c')]['offset']);}_0x3b83d4[_0x73c1('0x34')]=qs[_0x73c1('0x35')](_0x14e217[_0x73c1('0x2c')][_0x73c1('0x35')]);_0x3b83d4['where']=qs['filters'](_[_0x73c1('0x36')](_0x14e217['query'],_0x38d790['filters']),_0x134c62);if(_0x14e217[_0x73c1('0x2c')][_0x73c1('0x37')]){_0x3b83d4[_0x73c1('0x38')]=_['merge'](_0x3b83d4[_0x73c1('0x38')],{'$or':_[_0x73c1('0x27')](_0x134c62,function(_0x427fab){if(_0x427fab[_0x73c1('0x39')]!==_0x73c1('0x3a')){var _0x158d38={};_0x158d38[_0x427fab[_0x73c1('0x2b')]]={'$like':'%'+_0x14e217['query'][_0x73c1('0x37')]+'%'};return _0x158d38;}})});}_0x3b83d4=_[_0x73c1('0x3b')]({},_0x3b83d4,_0x14e217[_0x73c1('0x3c')]);var _0x1f526a={'where':_0x3b83d4[_0x73c1('0x38')]};return db[_0x73c1('0x28')]['count'](_0x1f526a)[_0x73c1('0x24')](function(_0x26162d){_0x5afb9a[_0x73c1('0x1d')]=_0x26162d;if(_0x14e217[_0x73c1('0x2c')][_0x73c1('0x3d')]){_0x3b83d4[_0x73c1('0x3e')]=[{'all':!![]}];}return db[_0x73c1('0x28')][_0x73c1('0x3f')](_0x3b83d4);})[_0x73c1('0x24')](function(_0x2b7e52){_0x5afb9a['rows']=_0x2b7e52;return _0x5afb9a;})[_0x73c1('0x24')](respondWithFilteredResult(_0x1165e3,_0x3b83d4))[_0x73c1('0x40')](handleError(_0x1165e3,null));};exports[_0x73c1('0x41')]=function(_0x4dfe6a,_0x581b19){var _0x473a81={'raw':!![],'where':{'id':_0x4dfe6a[_0x73c1('0x42')]['id']}},_0x3b5566={};_0x3b5566['model']=_[_0x73c1('0x43')](db['FreshsalesField']['rawAttributes']);_0x3b5566[_0x73c1('0x2c')]=_[_0x73c1('0x43')](_0x4dfe6a[_0x73c1('0x2c')]);_0x3b5566['filters']=_[_0x73c1('0x2e')](_0x3b5566[_0x73c1('0x2a')],_0x3b5566[_0x73c1('0x2c')]);_0x473a81['attributes']=_[_0x73c1('0x2e')](_0x3b5566[_0x73c1('0x2a')],qs[_0x73c1('0x2f')](_0x4dfe6a[_0x73c1('0x2c')]['fields']));_0x473a81[_0x73c1('0x30')]=_0x473a81['attributes'][_0x73c1('0x31')]?_0x473a81[_0x73c1('0x30')]:_0x3b5566[_0x73c1('0x2a')];if(_0x4dfe6a[_0x73c1('0x2c')][_0x73c1('0x3d')]){_0x473a81[_0x73c1('0x3e')]=[{'all':!![]}];}_0x473a81=_[_0x73c1('0x3b')]({},_0x473a81,_0x4dfe6a[_0x73c1('0x3c')]);return db['FreshsalesField'][_0x73c1('0x44')](_0x473a81)[_0x73c1('0x24')](handleEntityNotFound(_0x581b19,null))['then'](respondWithResult(_0x581b19,null))[_0x73c1('0x40')](handleError(_0x581b19,null));};exports['create']=function(_0x3a57c8,_0x3c6fa6){return db[_0x73c1('0x28')][_0x73c1('0x45')](_0x3a57c8[_0x73c1('0x46')],{})[_0x73c1('0x24')](respondWithResult(_0x3c6fa6,0xc9))[_0x73c1('0x40')](handleError(_0x3c6fa6,null));};exports[_0x73c1('0x22')]=function(_0x118e84,_0x13d9f0){if(_0x118e84[_0x73c1('0x46')]['id']){delete _0x118e84[_0x73c1('0x46')]['id'];}return db[_0x73c1('0x28')][_0x73c1('0x44')]({'where':{'id':_0x118e84['params']['id']}})[_0x73c1('0x24')](handleEntityNotFound(_0x13d9f0,null))['then'](saveUpdates(_0x118e84[_0x73c1('0x46')],null))[_0x73c1('0x24')](respondWithResult(_0x13d9f0,null))['catch'](handleError(_0x13d9f0,null));};exports[_0x73c1('0x23')]=function(_0x3adcd3,_0xa0c608){return db[_0x73c1('0x28')]['find']({'where':{'id':_0x3adcd3[_0x73c1('0x42')]['id']}})[_0x73c1('0x24')](handleEntityNotFound(_0xa0c608,null))[_0x73c1('0x24')](removeEntity(_0xa0c608,null))[_0x73c1('0x40')](handleError(_0xa0c608,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index d8a74a5..fce28b6 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 _0x0457=['../../config/environment','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0457,0x11f));var _0x7045=function(_0xa85dbd,_0x2838a5){_0xa85dbd=_0xa85dbd-0x0;var _0x3be7aa=_0x0457[_0xa85dbd];return _0x3be7aa;};'use strict';var _=require('lodash');var util=require(_0x7045('0x0'));var logger=require(_0x7045('0x1'))('api');var moment=require(_0x7045('0x2'));var BPromise=require(_0x7045('0x3'));var rp=require(_0x7045('0x4'));var fs=require('fs');var path=require(_0x7045('0x5'));var rimraf=require(_0x7045('0x6'));var config=require(_0x7045('0x7'));var attributes=require('./intFreshsalesField.attributes');module[_0x7045('0x8')]=function(_0x51e53b,_0x91fb4c){return _0x51e53b[_0x7045('0x9')](_0x7045('0xa'),attributes,{'tableName':_0x7045('0xb'),'paranoid':![],'indexes':[{'name':_0x7045('0xc'),'fields':[_0x7045('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb515=['../../config/environment','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xb515,0x1b8));var _0x5b51=function(_0x34c553,_0x3e7dfc){_0x34c553=_0x34c553-0x0;var _0x1357d2=_0xb515[_0x34c553];return _0x1357d2;};'use strict';var _=require(_0x5b51('0x0'));var util=require('util');var logger=require(_0x5b51('0x1'))(_0x5b51('0x2'));var moment=require(_0x5b51('0x3'));var BPromise=require(_0x5b51('0x4'));var rp=require(_0x5b51('0x5'));var fs=require('fs');var path=require(_0x5b51('0x6'));var rimraf=require(_0x5b51('0x7'));var config=require(_0x5b51('0x8'));var attributes=require('./intFreshsalesField.attributes');module[_0x5b51('0x9')]=function(_0xf9e3ac,_0x3ef482){return _0xf9e3ac[_0x5b51('0xa')](_0x5b51('0xb'),attributes,{'tableName':_0x5b51('0xc'),'paranoid':![],'indexes':[{'name':_0x5b51('0xd'),'fields':[_0x5b51('0xe'),_0x5b51('0xf')],'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 8cdc888..feceaa1 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 _0x2eb2=['request','then','info','request\x20sent','error','FreshsalesField,\x20%s,\x20%s','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http'];(function(_0x5d303a,_0x1b6fe9){var _0x49a3c9=function(_0x5f04a0){while(--_0x5f04a0){_0x5d303a['push'](_0x5d303a['shift']());}};_0x49a3c9(++_0x1b6fe9);}(_0x2eb2,0x19f));var _0x22eb=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x2eb2[_0xc6be3a];return _0x56a310;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var moment=require(_0x22eb('0x1'));var BPromise=require(_0x22eb('0x2'));var rs=require(_0x22eb('0x3'));var fs=require('fs');var Redis=require(_0x22eb('0x4'));var db=require(_0x22eb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x22eb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x22eb('0x7'));var client=jayson[_0x22eb('0x8')][_0x22eb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a9850,_0x4539d0,_0x396806){return new BPromise(function(_0x33ddef,_0x3375d6){return client[_0x22eb('0xa')](_0x2a9850,_0x396806)[_0x22eb('0xb')](function(_0xb9c8a4){logger[_0x22eb('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x4539d0,_0x22eb('0xd'));logger['debug']('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x4539d0,_0x22eb('0xd'),JSON['stringify'](_0xb9c8a4));if(_0xb9c8a4[_0x22eb('0xe')]){if(_0xb9c8a4[_0x22eb('0xe')]['code']===0x1f4){logger['error'](_0x22eb('0xf'),_0x4539d0,_0xb9c8a4[_0x22eb('0xe')][_0x22eb('0x10')]);return _0x3375d6(_0xb9c8a4[_0x22eb('0xe')][_0x22eb('0x10')]);}logger['error'](_0x22eb('0xf'),_0x4539d0,_0xb9c8a4['error'][_0x22eb('0x10')]);return _0x33ddef(_0xb9c8a4['error'][_0x22eb('0x10')]);}else{logger[_0x22eb('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x4539d0,'request\x20sent');_0x33ddef(_0xb9c8a4['result'][_0x22eb('0x10')]);}})['catch'](function(_0x50176d){logger[_0x22eb('0xe')]('FreshsalesField,\x20%s,\x20%s',_0x4539d0,_0x50176d);_0x3375d6(_0x50176d);});});} \ No newline at end of file +var _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0x7d4dc8,_0x14d70e){var _0x20b216=function(_0x3575b0){while(--_0x3575b0){_0x7d4dc8['push'](_0x7d4dc8['shift']());}};_0x20b216(++_0x14d70e);}(_0x524e,0x15e));var _0xe524=function(_0x11d13a,_0x2c73f0){_0x11d13a=_0x11d13a-0x0;var _0x199851=_0x524e[_0x11d13a];return _0x199851;};'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')]('FreshsalesField,\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')]('FreshsalesField,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 16674a4..0e023a8 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x1f830c,_0x209533){var _0xb98f82=function(_0x2e2720){while(--_0x2e2720){_0x1f830c['push'](_0x1f830c['shift']());}};_0xb98f82(++_0x209533);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x3cd1c8,_0x59ed39){var _0x44408f=function(_0x109a07){while(--_0x109a07){_0x3cd1c8['push'](_0x3cd1c8['shift']());}};_0x44408f(++_0x59ed39);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index bdde76b..98c7100 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 _0x3189=['sequelize','STRING','username','ENUM','integrationTab'];(function(_0x773ebd,_0x8f6f15){var _0x33e9df=function(_0x4f6cbb){while(--_0x4f6cbb){_0x773ebd['push'](_0x773ebd['shift']());}};_0x33e9df(++_0x8f6f15);}(_0x3189,0x19a));var _0x9318=function(_0x2715e2,_0x2df562){_0x2715e2=_0x2715e2-0x0;var _0x39b018=_0x3189[_0x2715e2];return _0x39b018;};'use strict';var Sequelize=require(_0x9318('0x0'));module['exports']={'name':{'type':Sequelize[_0x9318('0x1')]},'description':{'type':Sequelize[_0x9318('0x1')]},'username':{'type':Sequelize[_0x9318('0x1')],'unique':_0x9318('0x2')},'remoteUri':{'type':Sequelize[_0x9318('0x1')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x9318('0x1')]},'clientSecret':{'type':Sequelize[_0x9318('0x1')]},'securityToken':{'type':Sequelize[_0x9318('0x1')]},'serverUrl':{'type':Sequelize[_0x9318('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x9318('0x3')](_0x9318('0x4'),'newTab'),'defaultValue':_0x9318('0x4')}}; \ No newline at end of file +var _0x1867=['integrationTab','sequelize','exports','STRING','username','ENUM'];(function(_0x3ae48c,_0x3c86b3){var _0x2ee200=function(_0x5e7dfd){while(--_0x5e7dfd){_0x3ae48c['push'](_0x3ae48c['shift']());}};_0x2ee200(++_0x3c86b3);}(_0x1867,0xb5));var _0x7186=function(_0x4509fd,_0x572a5b){_0x4509fd=_0x4509fd-0x0;var _0x279283=_0x1867[_0x4509fd];return _0x279283;};'use strict';var Sequelize=require(_0x7186('0x0'));module[_0x7186('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7186('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x7186('0x3')},'remoteUri':{'type':Sequelize[_0x7186('0x2')]},'password':{'type':Sequelize[_0x7186('0x2')]},'clientId':{'type':Sequelize[_0x7186('0x2')]},'clientSecret':{'type':Sequelize[_0x7186('0x2')]},'securityToken':{'type':Sequelize[_0x7186('0x2')]},'serverUrl':{'type':Sequelize[_0x7186('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7186('0x4')](_0x7186('0x5'),'newTab'),'defaultValue':_0x7186('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index cacb863..038f206 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 _0x4ffd=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','undefined','count','offset','limit','set','apply','reject','save','then','end','sendStatus','error','name','index','map','SalesforceAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','update','getConfigurations','SalesforceConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','substring','Connection','login','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsRecurrence','Description','string','int','boolean','email','textarea','phone','remove','includes','custom','picklistValues','label','True','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs'];(function(_0x30f5bb,_0x4db4bd){var _0x1cfc00=function(_0x20f833){while(--_0x20f833){_0x30f5bb['push'](_0x30f5bb['shift']());}};_0x1cfc00(++_0x4db4bd);}(_0x4ffd,0x17b));var _0xd4ff=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x4ffd[_0x565c49];return _0x20ca34;};'use strict';var emlformat=require(_0xd4ff('0x0'));var rimraf=require(_0xd4ff('0x1'));var zipdir=require(_0xd4ff('0x2'));var jsonpatch=require(_0xd4ff('0x3'));var rp=require(_0xd4ff('0x4'));var moment=require(_0xd4ff('0x5'));var BPromise=require(_0xd4ff('0x6'));var Mustache=require('mustache');var util=require(_0xd4ff('0x7'));var path=require('path');var sox=require(_0xd4ff('0x8'));var csv=require(_0xd4ff('0x9'));var ejs=require(_0xd4ff('0xa'));var fs=require('fs');var fs_extra=require(_0xd4ff('0xb'));var _=require(_0xd4ff('0xc'));var squel=require(_0xd4ff('0xd'));var crypto=require(_0xd4ff('0xe'));var jsforce=require(_0xd4ff('0xf'));var deskjs=require(_0xd4ff('0x10'));var toCsv=require(_0xd4ff('0x9'));var querystring=require(_0xd4ff('0x11'));var Papa=require('papaparse');var Redis=require(_0xd4ff('0x12'));var authService=require(_0xd4ff('0x13'));var qs=require(_0xd4ff('0x14'));var as=require(_0xd4ff('0x15'));var hardwareService=require(_0xd4ff('0x16'));var logger=require(_0xd4ff('0x17'))(_0xd4ff('0x18'));var utils=require(_0xd4ff('0x19'));var config=require(_0xd4ff('0x1a'));var licenseUtil=require(_0xd4ff('0x1b'));var db=require(_0xd4ff('0x1c'))['db'];var integrations=require(_0xd4ff('0x1d'));function respondWithStatusCode(_0x46cf75,_0x43874f){_0x43874f=_0x43874f||0xcc;return function(_0x375d0b){if(_0x375d0b){return _0x46cf75['sendStatus'](_0x43874f);}return _0x46cf75[_0xd4ff('0x1e')](_0x43874f)['end']();};}function respondWithResult(_0x525334,_0x3e210e){_0x3e210e=_0x3e210e||0xc8;return function(_0x428862){if(_0x428862){return _0x525334['status'](_0x3e210e)[_0xd4ff('0x1f')](_0x428862);}};}function respondWithFilteredResult(_0x516914,_0x10cb26){return function(_0x103b1e){if(_0x103b1e){var _0x323f46=typeof _0x10cb26['offset']===_0xd4ff('0x20')&&typeof _0x10cb26['limit']==='undefined';var _0x35f432=_0x103b1e[_0xd4ff('0x21')];var _0x36b323=_0x323f46?0x0:_0x10cb26['offset'];var _0x130970=_0x323f46?_0x103b1e[_0xd4ff('0x21')]:_0x10cb26[_0xd4ff('0x22')]+_0x10cb26[_0xd4ff('0x23')];var _0x34c353;if(_0x130970>=_0x35f432){_0x130970=_0x35f432;_0x34c353=0xc8;}else{_0x34c353=0xce;}_0x516914[_0xd4ff('0x1e')](_0x34c353);return _0x516914[_0xd4ff('0x24')]('Content-Range',_0x36b323+'-'+_0x130970+'/'+_0x35f432)['json'](_0x103b1e);}return null;};}function patchUpdates(_0x31cb14){return function(_0x1c5054){try{jsonpatch[_0xd4ff('0x25')](_0x1c5054,_0x31cb14,!![]);}catch(_0x335754){return BPromise[_0xd4ff('0x26')](_0x335754);}return _0x1c5054[_0xd4ff('0x27')]();};}function saveUpdates(_0x535cb6,_0x2f3f69){return function(_0x1c68c0){if(_0x1c68c0){return _0x1c68c0['update'](_0x535cb6)[_0xd4ff('0x28')](function(_0x3f63ba){return _0x3f63ba;});}return null;};}function removeEntity(_0x29df48,_0x554624){return function(_0x490f54){if(_0x490f54){return _0x490f54['destroy']()['then'](function(){_0x29df48[_0xd4ff('0x1e')](0xcc)[_0xd4ff('0x29')]();});}};}function handleEntityNotFound(_0x39c0df,_0x245ce8){return function(_0x5db359){if(!_0x5db359){_0x39c0df[_0xd4ff('0x2a')](0x194);}return _0x5db359;};}function handleError(_0x1053ee,_0x5d25a8){_0x5d25a8=_0x5d25a8||0x1f4;return function(_0x5599b8){logger[_0xd4ff('0x2b')](_0x5599b8['stack']);if(_0x5599b8[_0xd4ff('0x2c')]){delete _0x5599b8[_0xd4ff('0x2c')];}_0x1053ee[_0xd4ff('0x1e')](_0x5d25a8)['send'](_0x5599b8);};}exports[_0xd4ff('0x2d')]=function(_0x1f31cb,_0xe0698a){var _0x54f4e5={},_0x148354={},_0x5821d0={'count':0x0,'rows':[]};var _0x1441f7=_[_0xd4ff('0x2e')](db[_0xd4ff('0x2f')]['rawAttributes'],function(_0xc9d961){return{'name':_0xc9d961[_0xd4ff('0x30')],'type':_0xc9d961[_0xd4ff('0x31')][_0xd4ff('0x32')]};});_0x148354[_0xd4ff('0x33')]=_[_0xd4ff('0x2e')](_0x1441f7,_0xd4ff('0x2c'));_0x148354[_0xd4ff('0x34')]=_[_0xd4ff('0x35')](_0x1f31cb[_0xd4ff('0x34')]);_0x148354[_0xd4ff('0x36')]=_[_0xd4ff('0x37')](_0x148354['model'],_0x148354[_0xd4ff('0x34')]);_0x54f4e5[_0xd4ff('0x38')]=_[_0xd4ff('0x37')](_0x148354[_0xd4ff('0x33')],qs[_0xd4ff('0x39')](_0x1f31cb[_0xd4ff('0x34')][_0xd4ff('0x39')]));_0x54f4e5['attributes']=_0x54f4e5[_0xd4ff('0x38')]['length']?_0x54f4e5['attributes']:_0x148354['model'];if(!_0x1f31cb['query'][_0xd4ff('0x3a')](_0xd4ff('0x3b'))){_0x54f4e5['limit']=qs[_0xd4ff('0x23')](_0x1f31cb[_0xd4ff('0x34')][_0xd4ff('0x23')]);_0x54f4e5[_0xd4ff('0x22')]=qs[_0xd4ff('0x22')](_0x1f31cb[_0xd4ff('0x34')]['offset']);}_0x54f4e5[_0xd4ff('0x3c')]=qs['sort'](_0x1f31cb[_0xd4ff('0x34')][_0xd4ff('0x3d')]);_0x54f4e5[_0xd4ff('0x3e')]=qs['filters'](_[_0xd4ff('0x3f')](_0x1f31cb['query'],_0x148354[_0xd4ff('0x36')]),_0x1441f7);if(_0x1f31cb[_0xd4ff('0x34')][_0xd4ff('0x40')]){_0x54f4e5[_0xd4ff('0x3e')]=_[_0xd4ff('0x41')](_0x54f4e5['where'],{'$or':_[_0xd4ff('0x2e')](_0x1441f7,function(_0x50c7aa){if(_0x50c7aa[_0xd4ff('0x31')]!=='VIRTUAL'){var _0x4bc6e8={};_0x4bc6e8[_0x50c7aa['name']]={'$like':'%'+_0x1f31cb['query'][_0xd4ff('0x40')]+'%'};return _0x4bc6e8;}})});}_0x54f4e5=_[_0xd4ff('0x41')]({},_0x54f4e5,_0x1f31cb[_0xd4ff('0x42')]);var _0x408ad3={'where':_0x54f4e5[_0xd4ff('0x3e')]};return db['SalesforceAccount']['count'](_0x408ad3)[_0xd4ff('0x28')](function(_0x44293d){_0x5821d0[_0xd4ff('0x21')]=_0x44293d;if(_0x1f31cb[_0xd4ff('0x34')][_0xd4ff('0x43')]){_0x54f4e5[_0xd4ff('0x44')]=[{'all':!![]}];}return db[_0xd4ff('0x2f')][_0xd4ff('0x45')](_0x54f4e5);})[_0xd4ff('0x28')](function(_0x24e9d5){_0x5821d0[_0xd4ff('0x46')]=_0x24e9d5;return _0x5821d0;})[_0xd4ff('0x28')](respondWithFilteredResult(_0xe0698a,_0x54f4e5))[_0xd4ff('0x47')](handleError(_0xe0698a,null));};exports[_0xd4ff('0x48')]=function(_0x5f316b,_0x4759b6){var _0x4bd52e={'raw':![],'where':{'id':_0x5f316b[_0xd4ff('0x49')]['id']}},_0x5e1007={};_0x5e1007[_0xd4ff('0x33')]=_[_0xd4ff('0x35')](db[_0xd4ff('0x2f')][_0xd4ff('0x4a')]);_0x5e1007['query']=_[_0xd4ff('0x35')](_0x5f316b[_0xd4ff('0x34')]);_0x5e1007['filters']=_[_0xd4ff('0x37')](_0x5e1007[_0xd4ff('0x33')],_0x5e1007[_0xd4ff('0x34')]);_0x4bd52e[_0xd4ff('0x38')]=_['intersection'](_0x5e1007['model'],qs[_0xd4ff('0x39')](_0x5f316b[_0xd4ff('0x34')][_0xd4ff('0x39')]));_0x4bd52e[_0xd4ff('0x38')]=_0x4bd52e[_0xd4ff('0x38')][_0xd4ff('0x4b')]?_0x4bd52e[_0xd4ff('0x38')]:_0x5e1007[_0xd4ff('0x33')];if(_0x5f316b[_0xd4ff('0x34')][_0xd4ff('0x43')]){_0x4bd52e['include']=[{'all':!![]}];}_0x4bd52e=_[_0xd4ff('0x41')]({},_0x4bd52e,_0x5f316b['options']);return db[_0xd4ff('0x2f')][_0xd4ff('0x4c')](_0x4bd52e)[_0xd4ff('0x28')](handleEntityNotFound(_0x4759b6,null))[_0xd4ff('0x28')](respondWithResult(_0x4759b6,null))[_0xd4ff('0x47')](handleError(_0x4759b6,null));};exports[_0xd4ff('0x4d')]=function(_0x1c1e26,_0x1e629b){return db[_0xd4ff('0x2f')][_0xd4ff('0x4d')](_0x1c1e26[_0xd4ff('0x4e')],{})[_0xd4ff('0x28')](respondWithResult(_0x1e629b,0xc9))[_0xd4ff('0x47')](handleError(_0x1e629b,null));};exports[_0xd4ff('0x4f')]=function(_0x5370a6,_0x247110){if(_0x5370a6[_0xd4ff('0x4e')]['id']){delete _0x5370a6['body']['id'];}return db[_0xd4ff('0x2f')][_0xd4ff('0x4c')]({'where':{'id':_0x5370a6[_0xd4ff('0x49')]['id']}})[_0xd4ff('0x28')](handleEntityNotFound(_0x247110,null))[_0xd4ff('0x28')](saveUpdates(_0x5370a6[_0xd4ff('0x4e')],null))[_0xd4ff('0x28')](respondWithResult(_0x247110,null))[_0xd4ff('0x47')](handleError(_0x247110,null));};exports['destroy']=function(_0x1b4ba2,_0x24500f){return db['SalesforceAccount'][_0xd4ff('0x4c')]({'where':{'id':_0x1b4ba2[_0xd4ff('0x49')]['id']}})[_0xd4ff('0x28')](handleEntityNotFound(_0x24500f,null))[_0xd4ff('0x28')](removeEntity(_0x24500f,null))['catch'](handleError(_0x24500f,null));};exports[_0xd4ff('0x50')]=function(_0x4de924,_0x46dfd0,_0x3184e5){var _0x555069={};var _0x50bf3c={};var _0xd1fa84;var _0x43c449;return db[_0xd4ff('0x2f')]['findOne']({'where':{'id':_0x4de924[_0xd4ff('0x49')]['id']}})[_0xd4ff('0x28')](handleEntityNotFound(_0x46dfd0,null))['then'](function(_0x19d2f4){if(_0x19d2f4){_0xd1fa84=_0x19d2f4;_0x50bf3c[_0xd4ff('0x33')]=_[_0xd4ff('0x35')](db[_0xd4ff('0x51')][_0xd4ff('0x4a')]);_0x50bf3c[_0xd4ff('0x34')]=_['keys'](_0x4de924['query']);_0x50bf3c['filters']=_[_0xd4ff('0x37')](_0x50bf3c[_0xd4ff('0x33')],_0x50bf3c[_0xd4ff('0x34')]);_0x555069[_0xd4ff('0x38')]=_['intersection'](_0x50bf3c['model'],qs['fields'](_0x4de924['query'][_0xd4ff('0x39')]));_0x555069[_0xd4ff('0x38')]=_0x555069[_0xd4ff('0x38')]['length']?_0x555069[_0xd4ff('0x38')]:_0x50bf3c[_0xd4ff('0x33')];_0x555069['order']=qs['sort'](_0x4de924[_0xd4ff('0x34')][_0xd4ff('0x3d')]);_0x555069[_0xd4ff('0x3e')]=qs['filters'](_[_0xd4ff('0x3f')](_0x4de924[_0xd4ff('0x34')],_0x50bf3c[_0xd4ff('0x36')]));if(_0x4de924['query'][_0xd4ff('0x40')]){_0x555069[_0xd4ff('0x3e')]=_[_0xd4ff('0x41')](_0x555069[_0xd4ff('0x3e')],{'$or':_[_0xd4ff('0x2e')](_0x555069[_0xd4ff('0x38')],function(_0x1deaf6){var _0x57ffdc={};_0x57ffdc[_0x1deaf6]={'$like':'%'+_0x4de924[_0xd4ff('0x34')]['filter']+'%'};return _0x57ffdc;})});}_0x555069=_['merge']({},_0x555069,_0x4de924[_0xd4ff('0x42')]);return _0xd1fa84[_0xd4ff('0x50')](_0x555069);}})[_0xd4ff('0x28')](function(_0x5945ac){if(_0x5945ac){_0x43c449=_0x5945ac['length'];if(!_0x4de924[_0xd4ff('0x34')]['hasOwnProperty']('nolimit')){_0x555069['limit']=qs[_0xd4ff('0x23')](_0x4de924[_0xd4ff('0x34')][_0xd4ff('0x23')]);_0x555069['offset']=qs[_0xd4ff('0x22')](_0x4de924[_0xd4ff('0x34')]['offset']);}return _0xd1fa84[_0xd4ff('0x50')](_0x555069);}})[_0xd4ff('0x28')](function(_0x17b513){if(_0x17b513){return _0x17b513?{'count':_0x43c449,'rows':_0x17b513}:null;}})[_0xd4ff('0x28')](respondWithResult(_0x46dfd0,null))[_0xd4ff('0x47')](handleError(_0x46dfd0,null));};exports[_0xd4ff('0x52')]=function(_0x3c29dd,_0x45f2dd,_0x36a4c4){if(_0x3c29dd['body']['id']){delete _0x3c29dd[_0xd4ff('0x4e')]['id'];}return db[_0xd4ff('0x2f')][_0xd4ff('0x53')]({'where':{'id':_0x3c29dd[_0xd4ff('0x49')]['id']}})['then'](handleEntityNotFound(_0x45f2dd,null))[_0xd4ff('0x28')](function(_0x1d9a83){if(_0x1d9a83){_0x3c29dd[_0xd4ff('0x4e')][_0xd4ff('0x54')]=_0x1d9a83['id'];_0x3c29dd[_0xd4ff('0x4e')][_0xd4ff('0x55')]=integrations[_0xd4ff('0x56')](_0x3c29dd[_0xd4ff('0x4e')][_0xd4ff('0x57')],_0x3c29dd[_0xd4ff('0x4e')][_0xd4ff('0x31')]);_0x3c29dd[_0xd4ff('0x4e')][_0xd4ff('0x58')]=integrations[_0xd4ff('0x59')](_0x3c29dd[_0xd4ff('0x4e')]['channel'],_0x3c29dd['body']['type']);return db[_0xd4ff('0x51')]['create'](_0x3c29dd[_0xd4ff('0x4e')],{'include':[{'model':db['SalesforceField'],'as':_0xd4ff('0x55')},{'model':db[_0xd4ff('0x5a')],'as':_0xd4ff('0x58')}]});}return null;})[_0xd4ff('0x28')](respondWithResult(_0x45f2dd,null))['catch'](handleError(_0x45f2dd,null));};exports[_0xd4ff('0x5b')]=function(_0x588005,_0x5f1fc5,_0xa9a5d0){var _0x46edeb;var _0x258cc8='';var _0x4e4a0f=_0xd4ff('0x5c');return db[_0xd4ff('0x2f')][_0xd4ff('0x53')]({'where':{'id':_0x588005[_0xd4ff('0x49')]['id']},'attributes':['id',_0xd4ff('0x5d'),_0xd4ff('0x5e'),_0xd4ff('0x5f'),_0xd4ff('0x60'),_0xd4ff('0x61'),_0xd4ff('0x62')]})[_0xd4ff('0x28')](handleEntityNotFound(_0x5f1fc5,null))[_0xd4ff('0x28')](function(_0x47d99c){if(_0x47d99c){_0x258cc8=_0x47d99c[_0xd4ff('0x5d')];var _0x3930f7=_0x258cc8['slice'](-0x1);if(_0x3930f7==='/'){_0x258cc8=_0x258cc8[_0xd4ff('0x63')](0x0,_0x258cc8['lastIndexOf'](_0x3930f7));}_0x46edeb=new jsforce[(_0xd4ff('0x64'))]({'oauth2':{'loginUrl':_0x258cc8,'clientId':_0x47d99c[_0xd4ff('0x5e')],'clientSecret':_0x47d99c['clientSecret']}});return _0x46edeb[_0xd4ff('0x65')](_0x47d99c[_0xd4ff('0x60')],_0x47d99c[_0xd4ff('0x61')]['concat'](_0x47d99c[_0xd4ff('0x62')]));}})[_0xd4ff('0x28')](function(_0x4329fb){if(_0x4329fb){if(!_[_0xd4ff('0x66')](_0x588005[_0xd4ff('0x34')][_0xd4ff('0x67')])){_0x4e4a0f=_0x588005['query']['ticketType'];}return _0x46edeb[_0xd4ff('0x68')](_0x4e4a0f)[_0xd4ff('0x69')]();}})[_0xd4ff('0x28')](function(_0x29d10c){var _0x2ca47b=[_0xd4ff('0x6a'),_0xd4ff('0x6b'),'IsReminderSet',_0xd4ff('0x6c'),'Subject',_0xd4ff('0x6d')];var _0x16fe25=[_0xd4ff('0x6e'),_0xd4ff('0x6f'),'picklist',_0xd4ff('0x70'),_0xd4ff('0x71'),_0xd4ff('0x72'),_0xd4ff('0x73')];if(_0x29d10c){_[_0xd4ff('0x74')](_0x29d10c[_0xd4ff('0x39')],function(_0x574033){return _0x2ca47b[_0xd4ff('0x75')](_0x574033[_0xd4ff('0x2c')])||!_0x16fe25[_0xd4ff('0x75')](_0x574033['type']);});return{'count':_0x29d10c[_0xd4ff('0x39')]['length'],'rows':_[_0xd4ff('0x2e')](_0x29d10c['fields'],function(_0xb332de){return{'id':_0xb332de[_0xd4ff('0x2c')],'name':_0xb332de['label'],'custom':_0xb332de[_0xd4ff('0x76')],'options':_0xb332de[_0xd4ff('0x77')][_0xd4ff('0x4b')]>0x0?_[_0xd4ff('0x2e')](_0xb332de['picklistValues'],function(_0x3c3eaa){return{'name':_0x3c3eaa[_0xd4ff('0x78')],'value':_0x3c3eaa['value']};}):_0xb332de[_0xd4ff('0x31')]==_0xd4ff('0x70')?[{'name':_0xd4ff('0x79'),'value':'true'},{'name':_0xd4ff('0x7a'),'value':_0xd4ff('0x7b')}]:[]};})};}})[_0xd4ff('0x28')](respondWithResult(_0x5f1fc5,null))[_0xd4ff('0x47')](function(_0x1044c7){var _0x5f33af=_0x588005[_0xd4ff('0x34')][_0xd4ff('0x7c')]?0x1f4:_0x1044c7[_0xd4ff('0x7d')]||0x1f4;logger[_0xd4ff('0x2b')](_0xd4ff('0x7e'),_0xd4ff('0x5b'),_0x5f33af,JSON[_0xd4ff('0x7f')](_0x1044c7));delete _0x1044c7[_0xd4ff('0x2c')];if(_0x5f33af===0x191){_0x5f33af=0x190;}_0x5f1fc5['status'](_0x5f33af)[_0xd4ff('0x80')](_0x588005[_0xd4ff('0x34')][_0xd4ff('0x7c')]?{'message':_0xd4ff('0x81'),'statusCode':_0x1044c7[_0xd4ff('0x7d')]}:_0x1044c7);});}; \ No newline at end of file +var _0xd4b2=['keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','update','destroy','getConfigurations','SalesforceConfiguration','findOne','Subjects','channel','Descriptions','SalesforceField','remoteUri','clientId','clientSecret','username','password','slice','substring','lastIndexOf','Connection','login','concat','securityToken','isNil','ticketType','sobject','OwnerId','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','textarea','remove','includes','label','custom','picklistValues','value','True','true','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','Content-Range','save','then','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','query'];(function(_0x39bf39,_0x33a918){var _0x7effad=function(_0x2d2304){while(--_0x2d2304){_0x39bf39['push'](_0x39bf39['shift']());}};_0x7effad(++_0x33a918);}(_0xd4b2,0x1b8));var _0x2d4b=function(_0x5caabb,_0x2b0cc1){_0x5caabb=_0x5caabb-0x0;var _0x2929d8=_0xd4b2[_0x5caabb];return _0x2929d8;};'use strict';var emlformat=require(_0x2d4b('0x0'));var rimraf=require(_0x2d4b('0x1'));var zipdir=require(_0x2d4b('0x2'));var jsonpatch=require(_0x2d4b('0x3'));var rp=require(_0x2d4b('0x4'));var moment=require(_0x2d4b('0x5'));var BPromise=require(_0x2d4b('0x6'));var Mustache=require(_0x2d4b('0x7'));var util=require('util');var path=require('path');var sox=require(_0x2d4b('0x8'));var csv=require(_0x2d4b('0x9'));var ejs=require(_0x2d4b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2d4b('0xb'));var squel=require(_0x2d4b('0xc'));var crypto=require(_0x2d4b('0xd'));var jsforce=require(_0x2d4b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2d4b('0x9'));var querystring=require(_0x2d4b('0xf'));var Papa=require('papaparse');var Redis=require(_0x2d4b('0x10'));var authService=require(_0x2d4b('0x11'));var qs=require(_0x2d4b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2d4b('0x13'));var logger=require(_0x2d4b('0x14'))(_0x2d4b('0x15'));var utils=require(_0x2d4b('0x16'));var config=require(_0x2d4b('0x17'));var licenseUtil=require(_0x2d4b('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x2d4b('0x19'));function respondWithStatusCode(_0x566dd0,_0x3fe448){_0x3fe448=_0x3fe448||0xcc;return function(_0x45a766){if(_0x45a766){return _0x566dd0[_0x2d4b('0x1a')](_0x3fe448);}return _0x566dd0[_0x2d4b('0x1b')](_0x3fe448)['end']();};}function respondWithResult(_0x27b121,_0x48db66){_0x48db66=_0x48db66||0xc8;return function(_0x4abe41){if(_0x4abe41){return _0x27b121[_0x2d4b('0x1b')](_0x48db66)[_0x2d4b('0x1c')](_0x4abe41);}};}function respondWithFilteredResult(_0x41c850,_0x4aae09){return function(_0x73ff7e){if(_0x73ff7e){var _0x59822c=typeof _0x4aae09[_0x2d4b('0x1d')]==='undefined'&&typeof _0x4aae09['limit']===_0x2d4b('0x1e');var _0x4b71c6=_0x73ff7e[_0x2d4b('0x1f')];var _0x12b28d=_0x59822c?0x0:_0x4aae09[_0x2d4b('0x1d')];var _0x387b20=_0x59822c?_0x73ff7e[_0x2d4b('0x1f')]:_0x4aae09[_0x2d4b('0x1d')]+_0x4aae09[_0x2d4b('0x20')];var _0x3e240f;if(_0x387b20>=_0x4b71c6){_0x387b20=_0x4b71c6;_0x3e240f=0xc8;}else{_0x3e240f=0xce;}_0x41c850['status'](_0x3e240f);return _0x41c850['set'](_0x2d4b('0x21'),_0x12b28d+'-'+_0x387b20+'/'+_0x4b71c6)[_0x2d4b('0x1c')](_0x73ff7e);}return null;};}function patchUpdates(_0x5a6ef9){return function(_0x53b55b){try{jsonpatch['apply'](_0x53b55b,_0x5a6ef9,!![]);}catch(_0x33c7dc){return BPromise['reject'](_0x33c7dc);}return _0x53b55b[_0x2d4b('0x22')]();};}function saveUpdates(_0x1db8e2,_0x3695c3){return function(_0x1b8374){if(_0x1b8374){return _0x1b8374['update'](_0x1db8e2)['then'](function(_0x4ade54){return _0x4ade54;});}return null;};}function removeEntity(_0x58e01e,_0x7c0be6){return function(_0x2feb69){if(_0x2feb69){return _0x2feb69['destroy']()[_0x2d4b('0x23')](function(){_0x58e01e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x38db2d,_0x55f04f){return function(_0x35e0c6){if(!_0x35e0c6){_0x38db2d[_0x2d4b('0x1a')](0x194);}return _0x35e0c6;};}function handleError(_0x607442,_0x523c1a){_0x523c1a=_0x523c1a||0x1f4;return function(_0x28fe9f){logger[_0x2d4b('0x24')](_0x28fe9f[_0x2d4b('0x25')]);if(_0x28fe9f[_0x2d4b('0x26')]){delete _0x28fe9f[_0x2d4b('0x26')];}_0x607442[_0x2d4b('0x1b')](_0x523c1a)[_0x2d4b('0x27')](_0x28fe9f);};}exports[_0x2d4b('0x28')]=function(_0x7136c0,_0x487e88){var _0x2f0f3e={},_0x19b883={},_0xdf1c15={'count':0x0,'rows':[]};var _0x51a466=_[_0x2d4b('0x29')](db[_0x2d4b('0x2a')][_0x2d4b('0x2b')],function(_0x5d087d){return{'name':_0x5d087d[_0x2d4b('0x2c')],'type':_0x5d087d[_0x2d4b('0x2d')][_0x2d4b('0x2e')]};});_0x19b883['model']=_[_0x2d4b('0x29')](_0x51a466,_0x2d4b('0x26'));_0x19b883[_0x2d4b('0x2f')]=_[_0x2d4b('0x30')](_0x7136c0[_0x2d4b('0x2f')]);_0x19b883[_0x2d4b('0x31')]=_[_0x2d4b('0x32')](_0x19b883[_0x2d4b('0x33')],_0x19b883[_0x2d4b('0x2f')]);_0x2f0f3e['attributes']=_['intersection'](_0x19b883[_0x2d4b('0x33')],qs['fields'](_0x7136c0['query']['fields']));_0x2f0f3e['attributes']=_0x2f0f3e[_0x2d4b('0x34')][_0x2d4b('0x35')]?_0x2f0f3e[_0x2d4b('0x34')]:_0x19b883[_0x2d4b('0x33')];if(!_0x7136c0[_0x2d4b('0x2f')][_0x2d4b('0x36')](_0x2d4b('0x37'))){_0x2f0f3e[_0x2d4b('0x20')]=qs[_0x2d4b('0x20')](_0x7136c0[_0x2d4b('0x2f')][_0x2d4b('0x20')]);_0x2f0f3e[_0x2d4b('0x1d')]=qs[_0x2d4b('0x1d')](_0x7136c0['query'][_0x2d4b('0x1d')]);}_0x2f0f3e[_0x2d4b('0x38')]=qs[_0x2d4b('0x39')](_0x7136c0[_0x2d4b('0x2f')][_0x2d4b('0x39')]);_0x2f0f3e[_0x2d4b('0x3a')]=qs[_0x2d4b('0x31')](_[_0x2d4b('0x3b')](_0x7136c0[_0x2d4b('0x2f')],_0x19b883[_0x2d4b('0x31')]),_0x51a466);if(_0x7136c0[_0x2d4b('0x2f')][_0x2d4b('0x3c')]){_0x2f0f3e[_0x2d4b('0x3a')]=_[_0x2d4b('0x3d')](_0x2f0f3e[_0x2d4b('0x3a')],{'$or':_['map'](_0x51a466,function(_0x2510fc){if(_0x2510fc[_0x2d4b('0x2d')]!==_0x2d4b('0x3e')){var _0x56fe10={};_0x56fe10[_0x2510fc[_0x2d4b('0x26')]]={'$like':'%'+_0x7136c0[_0x2d4b('0x2f')]['filter']+'%'};return _0x56fe10;}})});}_0x2f0f3e=_[_0x2d4b('0x3d')]({},_0x2f0f3e,_0x7136c0[_0x2d4b('0x3f')]);var _0x151ba8={'where':_0x2f0f3e[_0x2d4b('0x3a')]};return db[_0x2d4b('0x2a')]['count'](_0x151ba8)[_0x2d4b('0x23')](function(_0x5a27fb){_0xdf1c15[_0x2d4b('0x1f')]=_0x5a27fb;if(_0x7136c0[_0x2d4b('0x2f')][_0x2d4b('0x40')]){_0x2f0f3e[_0x2d4b('0x41')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x2d4b('0x42')](_0x2f0f3e);})[_0x2d4b('0x23')](function(_0x256578){_0xdf1c15[_0x2d4b('0x43')]=_0x256578;return _0xdf1c15;})[_0x2d4b('0x23')](respondWithFilteredResult(_0x487e88,_0x2f0f3e))[_0x2d4b('0x44')](handleError(_0x487e88,null));};exports[_0x2d4b('0x45')]=function(_0x318081,_0x29aa48){var _0x55b594={'raw':![],'where':{'id':_0x318081[_0x2d4b('0x46')]['id']}},_0x5d919e={};_0x5d919e[_0x2d4b('0x33')]=_[_0x2d4b('0x30')](db['SalesforceAccount'][_0x2d4b('0x2b')]);_0x5d919e[_0x2d4b('0x2f')]=_[_0x2d4b('0x30')](_0x318081[_0x2d4b('0x2f')]);_0x5d919e['filters']=_['intersection'](_0x5d919e['model'],_0x5d919e[_0x2d4b('0x2f')]);_0x55b594[_0x2d4b('0x34')]=_[_0x2d4b('0x32')](_0x5d919e[_0x2d4b('0x33')],qs[_0x2d4b('0x47')](_0x318081[_0x2d4b('0x2f')][_0x2d4b('0x47')]));_0x55b594[_0x2d4b('0x34')]=_0x55b594[_0x2d4b('0x34')]['length']?_0x55b594[_0x2d4b('0x34')]:_0x5d919e[_0x2d4b('0x33')];if(_0x318081[_0x2d4b('0x2f')][_0x2d4b('0x40')]){_0x55b594[_0x2d4b('0x41')]=[{'all':!![]}];}_0x55b594=_['merge']({},_0x55b594,_0x318081[_0x2d4b('0x3f')]);return db['SalesforceAccount'][_0x2d4b('0x48')](_0x55b594)[_0x2d4b('0x23')](handleEntityNotFound(_0x29aa48,null))['then'](respondWithResult(_0x29aa48,null))[_0x2d4b('0x44')](handleError(_0x29aa48,null));};exports[_0x2d4b('0x49')]=function(_0x2c692b,_0x33e7fa){return db[_0x2d4b('0x2a')][_0x2d4b('0x49')](_0x2c692b[_0x2d4b('0x4a')],{})[_0x2d4b('0x23')](respondWithResult(_0x33e7fa,0xc9))[_0x2d4b('0x44')](handleError(_0x33e7fa,null));};exports[_0x2d4b('0x4b')]=function(_0xa29dc3,_0x556519){if(_0xa29dc3[_0x2d4b('0x4a')]['id']){delete _0xa29dc3[_0x2d4b('0x4a')]['id'];}return db[_0x2d4b('0x2a')][_0x2d4b('0x48')]({'where':{'id':_0xa29dc3[_0x2d4b('0x46')]['id']}})['then'](handleEntityNotFound(_0x556519,null))['then'](saveUpdates(_0xa29dc3[_0x2d4b('0x4a')],null))[_0x2d4b('0x23')](respondWithResult(_0x556519,null))['catch'](handleError(_0x556519,null));};exports[_0x2d4b('0x4c')]=function(_0xa73f98,_0x207987){return db[_0x2d4b('0x2a')][_0x2d4b('0x48')]({'where':{'id':_0xa73f98['params']['id']}})[_0x2d4b('0x23')](handleEntityNotFound(_0x207987,null))[_0x2d4b('0x23')](removeEntity(_0x207987,null))['catch'](handleError(_0x207987,null));};exports[_0x2d4b('0x4d')]=function(_0x12038e,_0x2bf539,_0x171f5b){var _0x103654={};var _0x3db34f={};var _0x3ca022;var _0x209c4e;return db[_0x2d4b('0x2a')]['findOne']({'where':{'id':_0x12038e[_0x2d4b('0x46')]['id']}})['then'](handleEntityNotFound(_0x2bf539,null))[_0x2d4b('0x23')](function(_0x602ae4){if(_0x602ae4){_0x3ca022=_0x602ae4;_0x3db34f[_0x2d4b('0x33')]=_[_0x2d4b('0x30')](db[_0x2d4b('0x4e')][_0x2d4b('0x2b')]);_0x3db34f[_0x2d4b('0x2f')]=_[_0x2d4b('0x30')](_0x12038e[_0x2d4b('0x2f')]);_0x3db34f['filters']=_[_0x2d4b('0x32')](_0x3db34f[_0x2d4b('0x33')],_0x3db34f[_0x2d4b('0x2f')]);_0x103654['attributes']=_[_0x2d4b('0x32')](_0x3db34f[_0x2d4b('0x33')],qs['fields'](_0x12038e['query'][_0x2d4b('0x47')]));_0x103654['attributes']=_0x103654[_0x2d4b('0x34')][_0x2d4b('0x35')]?_0x103654[_0x2d4b('0x34')]:_0x3db34f[_0x2d4b('0x33')];_0x103654['order']=qs[_0x2d4b('0x39')](_0x12038e[_0x2d4b('0x2f')][_0x2d4b('0x39')]);_0x103654[_0x2d4b('0x3a')]=qs[_0x2d4b('0x31')](_[_0x2d4b('0x3b')](_0x12038e['query'],_0x3db34f['filters']));if(_0x12038e[_0x2d4b('0x2f')]['filter']){_0x103654['where']=_[_0x2d4b('0x3d')](_0x103654[_0x2d4b('0x3a')],{'$or':_[_0x2d4b('0x29')](_0x103654['attributes'],function(_0x2ef604){var _0x1561f={};_0x1561f[_0x2ef604]={'$like':'%'+_0x12038e['query'][_0x2d4b('0x3c')]+'%'};return _0x1561f;})});}_0x103654=_[_0x2d4b('0x3d')]({},_0x103654,_0x12038e[_0x2d4b('0x3f')]);return _0x3ca022[_0x2d4b('0x4d')](_0x103654);}})[_0x2d4b('0x23')](function(_0x4cf3f0){if(_0x4cf3f0){_0x209c4e=_0x4cf3f0['length'];if(!_0x12038e[_0x2d4b('0x2f')][_0x2d4b('0x36')](_0x2d4b('0x37'))){_0x103654[_0x2d4b('0x20')]=qs['limit'](_0x12038e[_0x2d4b('0x2f')][_0x2d4b('0x20')]);_0x103654[_0x2d4b('0x1d')]=qs[_0x2d4b('0x1d')](_0x12038e[_0x2d4b('0x2f')][_0x2d4b('0x1d')]);}return _0x3ca022[_0x2d4b('0x4d')](_0x103654);}})['then'](function(_0x531c96){if(_0x531c96){return _0x531c96?{'count':_0x209c4e,'rows':_0x531c96}:null;}})[_0x2d4b('0x23')](respondWithResult(_0x2bf539,null))[_0x2d4b('0x44')](handleError(_0x2bf539,null));};exports['addConfiguration']=function(_0x28112a,_0x2c3e89,_0x37c490){if(_0x28112a[_0x2d4b('0x4a')]['id']){delete _0x28112a[_0x2d4b('0x4a')]['id'];}return db[_0x2d4b('0x2a')][_0x2d4b('0x4f')]({'where':{'id':_0x28112a[_0x2d4b('0x46')]['id']}})['then'](handleEntityNotFound(_0x2c3e89,null))[_0x2d4b('0x23')](function(_0xe25b17){if(_0xe25b17){_0x28112a[_0x2d4b('0x4a')]['AccountId']=_0xe25b17['id'];_0x28112a[_0x2d4b('0x4a')][_0x2d4b('0x50')]=integrations['getSubjects'](_0x28112a[_0x2d4b('0x4a')][_0x2d4b('0x51')],_0x28112a[_0x2d4b('0x4a')][_0x2d4b('0x2d')]);_0x28112a[_0x2d4b('0x4a')][_0x2d4b('0x52')]=integrations['getDescriptions'](_0x28112a[_0x2d4b('0x4a')]['channel'],_0x28112a[_0x2d4b('0x4a')][_0x2d4b('0x2d')]);return db[_0x2d4b('0x4e')][_0x2d4b('0x49')](_0x28112a[_0x2d4b('0x4a')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0x2d4b('0x53')],'as':_0x2d4b('0x52')}]});}return null;})[_0x2d4b('0x23')](respondWithResult(_0x2c3e89,null))[_0x2d4b('0x44')](handleError(_0x2c3e89,null));};exports['getFields']=function(_0x59aebc,_0x3a3eb1,_0x43142d){var _0xecbf4c;var _0x5ea3f9='';var _0x540009='Task';return db['SalesforceAccount'][_0x2d4b('0x4f')]({'where':{'id':_0x59aebc['params']['id']},'attributes':['id',_0x2d4b('0x54'),_0x2d4b('0x55'),_0x2d4b('0x56'),_0x2d4b('0x57'),_0x2d4b('0x58'),'securityToken']})[_0x2d4b('0x23')](handleEntityNotFound(_0x3a3eb1,null))[_0x2d4b('0x23')](function(_0x3719c0){if(_0x3719c0){_0x5ea3f9=_0x3719c0[_0x2d4b('0x54')];var _0x4d64b1=_0x5ea3f9[_0x2d4b('0x59')](-0x1);if(_0x4d64b1==='/'){_0x5ea3f9=_0x5ea3f9[_0x2d4b('0x5a')](0x0,_0x5ea3f9[_0x2d4b('0x5b')](_0x4d64b1));}_0xecbf4c=new jsforce[(_0x2d4b('0x5c'))]({'oauth2':{'loginUrl':_0x5ea3f9,'clientId':_0x3719c0[_0x2d4b('0x55')],'clientSecret':_0x3719c0[_0x2d4b('0x56')]}});return _0xecbf4c[_0x2d4b('0x5d')](_0x3719c0[_0x2d4b('0x57')],_0x3719c0[_0x2d4b('0x58')][_0x2d4b('0x5e')](_0x3719c0[_0x2d4b('0x5f')]));}})[_0x2d4b('0x23')](function(_0x5a6727){if(_0x5a6727){if(!_[_0x2d4b('0x60')](_0x59aebc[_0x2d4b('0x2f')][_0x2d4b('0x61')])){_0x540009=_0x59aebc[_0x2d4b('0x2f')]['ticketType'];}return _0xecbf4c[_0x2d4b('0x62')](_0x540009)['describe']();}})[_0x2d4b('0x23')](function(_0x5b67fe){var _0x43c70f=[_0x2d4b('0x63'),'ActivityDate',_0x2d4b('0x64'),_0x2d4b('0x65'),_0x2d4b('0x66'),_0x2d4b('0x67')];var _0x34b280=[_0x2d4b('0x68'),_0x2d4b('0x69'),_0x2d4b('0x6a'),_0x2d4b('0x6b'),'email',_0x2d4b('0x6c'),'phone'];if(_0x5b67fe){_[_0x2d4b('0x6d')](_0x5b67fe[_0x2d4b('0x47')],function(_0x1a58b9){return _0x43c70f[_0x2d4b('0x6e')](_0x1a58b9['name'])||!_0x34b280[_0x2d4b('0x6e')](_0x1a58b9[_0x2d4b('0x2d')]);});return{'count':_0x5b67fe['fields'][_0x2d4b('0x35')],'rows':_[_0x2d4b('0x29')](_0x5b67fe[_0x2d4b('0x47')],function(_0x53667d){return{'id':_0x53667d['name'],'name':_0x53667d[_0x2d4b('0x6f')],'custom':_0x53667d[_0x2d4b('0x70')],'options':_0x53667d['picklistValues']['length']>0x0?_[_0x2d4b('0x29')](_0x53667d[_0x2d4b('0x71')],function(_0x5aef76){return{'name':_0x5aef76['label'],'value':_0x5aef76[_0x2d4b('0x72')]};}):_0x53667d[_0x2d4b('0x2d')]==_0x2d4b('0x6b')?[{'name':_0x2d4b('0x73'),'value':_0x2d4b('0x74')},{'name':'False','value':_0x2d4b('0x75')}]:[]};})};}})[_0x2d4b('0x23')](respondWithResult(_0x3a3eb1,null))[_0x2d4b('0x44')](function(_0x2e911f){var _0x3a6bbe=_0x59aebc[_0x2d4b('0x2f')]['test']?0x1f4:_0x2e911f[_0x2d4b('0x76')]||0x1f4;logger['error'](_0x2d4b('0x77'),'getFields',_0x3a6bbe,JSON['stringify'](_0x2e911f));delete _0x2e911f[_0x2d4b('0x26')];if(_0x3a6bbe===0x191){_0x3a6bbe=0x190;}_0x3a3eb1[_0x2d4b('0x1b')](_0x3a6bbe)[_0x2d4b('0x27')](_0x59aebc[_0x2d4b('0x2f')][_0x2d4b('0x78')]?{'message':_0x2d4b('0x79'),'statusCode':_0x2e911f['statusCode']}:_0x2e911f);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 80bb175..1b7369f 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 _0xb76d=['int_salesforce_accounts','lodash','util','moment','path','rimraf','../../config/environment','exports','SalesforceAccount'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xb76d,0x19f));var _0xdb76=function(_0x5dcf2f,_0x583326){_0x5dcf2f=_0x5dcf2f-0x0;var _0x1b00d9=_0xb76d[_0x5dcf2f];return _0x1b00d9;};'use strict';var _=require(_0xdb76('0x0'));var util=require(_0xdb76('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xdb76('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdb76('0x3'));var rimraf=require(_0xdb76('0x4'));var config=require(_0xdb76('0x5'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xdb76('0x6')]=function(_0x2c516d,_0x1e6d75){return _0x2c516d['define'](_0xdb76('0x7'),attributes,{'tableName':_0xdb76('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d27=['path','rimraf','./intSalesforceAccount.attributes','exports','SalesforceAccount','int_salesforce_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x152121,_0x120c53){var _0x592a85=function(_0x241cab){while(--_0x241cab){_0x152121['push'](_0x152121['shift']());}};_0x592a85(++_0x120c53);}(_0x2d27,0x13e));var _0x72d2=function(_0x3d951c,_0x4a0695){_0x3d951c=_0x3d951c-0x0;var _0x1b91b5=_0x2d27[_0x3d951c];return _0x1b91b5;};'use strict';var _=require(_0x72d2('0x0'));var util=require('util');var logger=require(_0x72d2('0x1'))(_0x72d2('0x2'));var moment=require(_0x72d2('0x3'));var BPromise=require(_0x72d2('0x4'));var rp=require(_0x72d2('0x5'));var fs=require('fs');var path=require(_0x72d2('0x6'));var rimraf=require(_0x72d2('0x7'));var config=require('../../config/environment');var attributes=require(_0x72d2('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x72d2('0x9')]=function(_0xb3d568,_0xdc8dc1){return _0xb3d568['define'](_0x72d2('0xa'),attributes,{'tableName':_0x72d2('0xb'),'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 7f8475f..389e212 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 _0xa7f2=['stringify','error','code','message','SalesforceAccount,\x20%s,\x20%s','result','GetSalesforceAccount','SalesforceAccount','options','attributes','limit','include','map','model','debug','catch','ShowSalesforceAccount','find','raw','where','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s'];(function(_0x4113e2,_0x52dfb9){var _0xaca944=function(_0x737936){while(--_0x737936){_0x4113e2['push'](_0x4113e2['shift']());}};_0xaca944(++_0x52dfb9);}(_0xa7f2,0xc3));var _0x2a7f=function(_0x55e492,_0x398035){_0x55e492=_0x55e492-0x0;var _0x27b6a7=_0xa7f2[_0x55e492];return _0x27b6a7;};'use strict';var _=require('lodash');var util=require(_0x2a7f('0x0'));var moment=require('moment');var BPromise=require(_0x2a7f('0x1'));var rs=require(_0x2a7f('0x2'));var fs=require('fs');var Redis=require(_0x2a7f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2a7f('0x4'));var logger=require(_0x2a7f('0x5'))(_0x2a7f('0x6'));var config=require(_0x2a7f('0x7'));var jayson=require(_0x2a7f('0x8'));var client=jayson[_0x2a7f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28a839,_0x98163f,_0x1538f9){return new BPromise(function(_0x4d3dda,_0x3c7ee9){return client[_0x2a7f('0xa')](_0x28a839,_0x1538f9)[_0x2a7f('0xb')](function(_0x5f186b){logger[_0x2a7f('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x98163f,_0x2a7f('0xd'));logger['debug'](_0x2a7f('0xe'),_0x98163f,_0x2a7f('0xd'),JSON[_0x2a7f('0xf')](_0x5f186b));if(_0x5f186b[_0x2a7f('0x10')]){if(_0x5f186b[_0x2a7f('0x10')][_0x2a7f('0x11')]===0x1f4){logger[_0x2a7f('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x98163f,_0x5f186b[_0x2a7f('0x10')]['message']);return _0x3c7ee9(_0x5f186b['error'][_0x2a7f('0x12')]);}logger[_0x2a7f('0x10')](_0x2a7f('0x13'),_0x98163f,_0x5f186b[_0x2a7f('0x10')][_0x2a7f('0x12')]);return _0x4d3dda(_0x5f186b[_0x2a7f('0x10')][_0x2a7f('0x12')]);}else{logger[_0x2a7f('0xc')](_0x2a7f('0x13'),_0x98163f,_0x2a7f('0xd'));_0x4d3dda(_0x5f186b[_0x2a7f('0x14')][_0x2a7f('0x12')]);}})['catch'](function(_0x50268b){logger[_0x2a7f('0x10')](_0x2a7f('0x13'),_0x98163f,_0x50268b);_0x3c7ee9(_0x50268b);});});}exports[_0x2a7f('0x15')]=function(_0x2da909){var _0x1ec015=this;return new Promise(function(_0x1072a5,_0x3770be){return db[_0x2a7f('0x16')]['findAll']({'raw':_0x2da909[_0x2a7f('0x17')]?_0x2da909[_0x2a7f('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2da909[_0x2a7f('0x17')]?_0x2da909['options']['where']||null:null,'attributes':_0x2da909[_0x2a7f('0x17')]?_0x2da909[_0x2a7f('0x17')][_0x2a7f('0x18')]||null:null,'limit':_0x2da909[_0x2a7f('0x17')]?_0x2da909[_0x2a7f('0x17')][_0x2a7f('0x19')]||null:null,'include':_0x2da909['options']?_0x2da909[_0x2a7f('0x17')][_0x2a7f('0x1a')]?_[_0x2a7f('0x1b')](_0x2da909[_0x2a7f('0x17')][_0x2a7f('0x1a')],function(_0x190d1d){return{'model':db[_0x190d1d[_0x2a7f('0x1c')]],'as':_0x190d1d['as'],'attributes':_0x190d1d[_0x2a7f('0x18')],'include':_0x190d1d[_0x2a7f('0x1a')]?_[_0x2a7f('0x1b')](_0x190d1d[_0x2a7f('0x1a')],function(_0x55d944){return{'model':db[_0x55d944[_0x2a7f('0x1c')]],'as':_0x55d944['as'],'attributes':_0x55d944[_0x2a7f('0x18')],'include':_0x55d944[_0x2a7f('0x1a')]?_[_0x2a7f('0x1b')](_0x55d944[_0x2a7f('0x1a')],function(_0x793d48){return{'model':db[_0x793d48[_0x2a7f('0x1c')]],'as':_0x793d48['as'],'attributes':_0x793d48[_0x2a7f('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2a7f('0xb')](function(_0x55ee16){logger['info'](_0x2a7f('0x15'),_0x2da909);logger[_0x2a7f('0x1d')](_0x2a7f('0x15'),_0x2da909,JSON['stringify'](_0x55ee16));_0x1072a5(_0x55ee16);})[_0x2a7f('0x1e')](function(_0xbea17a){logger[_0x2a7f('0x10')](_0x2a7f('0x15'),_0xbea17a['message'],_0x2da909);_0x3770be(_0x1ec015['error'](0x1f4,_0xbea17a[_0x2a7f('0x12')]));});});};exports[_0x2a7f('0x1f')]=function(_0x44d933){var _0x211d50=this;return new Promise(function(_0x5cd40a,_0x2ab686){return db[_0x2a7f('0x16')][_0x2a7f('0x20')]({'raw':_0x44d933[_0x2a7f('0x17')]?_0x44d933[_0x2a7f('0x17')][_0x2a7f('0x21')]===undefined?!![]:![]:!![],'where':_0x44d933[_0x2a7f('0x17')]?_0x44d933[_0x2a7f('0x17')][_0x2a7f('0x22')]||null:null,'attributes':_0x44d933[_0x2a7f('0x17')]?_0x44d933[_0x2a7f('0x17')]['attributes']||null:null,'include':_0x44d933[_0x2a7f('0x17')]?_0x44d933[_0x2a7f('0x17')][_0x2a7f('0x1a')]?_[_0x2a7f('0x1b')](_0x44d933['options'][_0x2a7f('0x1a')],function(_0x4674fb){return{'model':db[_0x4674fb['model']],'as':_0x4674fb['as'],'attributes':_0x4674fb[_0x2a7f('0x18')],'include':_0x4674fb[_0x2a7f('0x1a')]?_[_0x2a7f('0x1b')](_0x4674fb[_0x2a7f('0x1a')],function(_0x220f9f){return{'model':db[_0x220f9f[_0x2a7f('0x1c')]],'as':_0x220f9f['as'],'attributes':_0x220f9f[_0x2a7f('0x18')],'include':_0x220f9f[_0x2a7f('0x1a')]?_[_0x2a7f('0x1b')](_0x220f9f[_0x2a7f('0x1a')],function(_0x537155){return{'model':db[_0x537155[_0x2a7f('0x1c')]],'as':_0x537155['as'],'attributes':_0x537155[_0x2a7f('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2a7f('0xb')](function(_0x37434c){logger['info'](_0x2a7f('0x1f'),_0x44d933);logger[_0x2a7f('0x1d')](_0x2a7f('0x1f'),_0x44d933,JSON[_0x2a7f('0xf')](_0x37434c));_0x5cd40a(_0x37434c);})['catch'](function(_0x5d0073){logger[_0x2a7f('0x10')](_0x2a7f('0x1f'),_0x5d0073[_0x2a7f('0x12')],_0x44d933);_0x2ab686(_0x211d50[_0x2a7f('0x10')](0x1f4,_0x5d0073[_0x2a7f('0x12')]));});});}; \ No newline at end of file +var _0x3933=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','request','then','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','SalesforceAccount,\x20%s,\x20%s','message','info','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowSalesforceAccount','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3933,0x83));var _0x3393=function(_0x3d1efc,_0x3e9596){_0x3d1efc=_0x3d1efc-0x0;var _0x126d4b=_0x3933[_0x3d1efc];return _0x126d4b;};'use strict';var _=require(_0x3393('0x0'));var util=require(_0x3393('0x1'));var moment=require(_0x3393('0x2'));var BPromise=require(_0x3393('0x3'));var rs=require(_0x3393('0x4'));var fs=require('fs');var Redis=require(_0x3393('0x5'));var db=require(_0x3393('0x6'))['db'];var utils=require(_0x3393('0x7'));var logger=require('../../config/logger')(_0x3393('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x3393('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x387a6b,_0x18c430,_0x481fdb){return new BPromise(function(_0xbfd1e7,_0x75cdca){return client[_0x3393('0xa')](_0x387a6b,_0x481fdb)[_0x3393('0xb')](function(_0x44f93a){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x18c430,_0x3393('0xc'));logger[_0x3393('0xd')](_0x3393('0xe'),_0x18c430,_0x3393('0xc'),JSON[_0x3393('0xf')](_0x44f93a));if(_0x44f93a[_0x3393('0x10')]){if(_0x44f93a[_0x3393('0x10')]['code']===0x1f4){logger[_0x3393('0x10')](_0x3393('0x11'),_0x18c430,_0x44f93a[_0x3393('0x10')][_0x3393('0x12')]);return _0x75cdca(_0x44f93a[_0x3393('0x10')]['message']);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x18c430,_0x44f93a[_0x3393('0x10')][_0x3393('0x12')]);return _0xbfd1e7(_0x44f93a[_0x3393('0x10')][_0x3393('0x12')]);}else{logger[_0x3393('0x13')](_0x3393('0x11'),_0x18c430,'request\x20sent');_0xbfd1e7(_0x44f93a['result'][_0x3393('0x12')]);}})[_0x3393('0x14')](function(_0xd1ff41){logger[_0x3393('0x10')](_0x3393('0x11'),_0x18c430,_0xd1ff41);_0x75cdca(_0xd1ff41);});});}exports[_0x3393('0x15')]=function(_0x4c7811){var _0x23aa20=this;return new Promise(function(_0x5bb3ef,_0x408f87){return db[_0x3393('0x16')][_0x3393('0x17')]({'raw':_0x4c7811[_0x3393('0x18')]?_0x4c7811[_0x3393('0x18')][_0x3393('0x19')]===undefined?!![]:![]:!![],'where':_0x4c7811[_0x3393('0x18')]?_0x4c7811[_0x3393('0x18')][_0x3393('0x1a')]||null:null,'attributes':_0x4c7811[_0x3393('0x18')]?_0x4c7811['options'][_0x3393('0x1b')]||null:null,'limit':_0x4c7811['options']?_0x4c7811[_0x3393('0x18')][_0x3393('0x1c')]||null:null,'include':_0x4c7811[_0x3393('0x18')]?_0x4c7811[_0x3393('0x18')][_0x3393('0x1d')]?_[_0x3393('0x1e')](_0x4c7811[_0x3393('0x18')][_0x3393('0x1d')],function(_0x2cee90){return{'model':db[_0x2cee90[_0x3393('0x1f')]],'as':_0x2cee90['as'],'attributes':_0x2cee90['attributes'],'include':_0x2cee90[_0x3393('0x1d')]?_['map'](_0x2cee90['include'],function(_0x3e05d2){return{'model':db[_0x3e05d2['model']],'as':_0x3e05d2['as'],'attributes':_0x3e05d2[_0x3393('0x1b')],'include':_0x3e05d2[_0x3393('0x1d')]?_[_0x3393('0x1e')](_0x3e05d2[_0x3393('0x1d')],function(_0x14d363){return{'model':db[_0x14d363[_0x3393('0x1f')]],'as':_0x14d363['as'],'attributes':_0x14d363[_0x3393('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x463bb3){logger[_0x3393('0x13')]('GetSalesforceAccount',_0x4c7811);logger[_0x3393('0xd')]('GetSalesforceAccount',_0x4c7811,JSON[_0x3393('0xf')](_0x463bb3));_0x5bb3ef(_0x463bb3);})[_0x3393('0x14')](function(_0x1473a7){logger[_0x3393('0x10')](_0x3393('0x15'),_0x1473a7[_0x3393('0x12')],_0x4c7811);_0x408f87(_0x23aa20[_0x3393('0x10')](0x1f4,_0x1473a7['message']));});});};exports[_0x3393('0x20')]=function(_0x291e10){var _0x14a901=this;return new Promise(function(_0x33340b,_0x4dba67){return db[_0x3393('0x16')]['find']({'raw':_0x291e10[_0x3393('0x18')]?_0x291e10[_0x3393('0x18')][_0x3393('0x19')]===undefined?!![]:![]:!![],'where':_0x291e10[_0x3393('0x18')]?_0x291e10['options'][_0x3393('0x1a')]||null:null,'attributes':_0x291e10[_0x3393('0x18')]?_0x291e10[_0x3393('0x18')]['attributes']||null:null,'include':_0x291e10[_0x3393('0x18')]?_0x291e10[_0x3393('0x18')]['include']?_[_0x3393('0x1e')](_0x291e10[_0x3393('0x18')][_0x3393('0x1d')],function(_0x1c17de){return{'model':db[_0x1c17de[_0x3393('0x1f')]],'as':_0x1c17de['as'],'attributes':_0x1c17de['attributes'],'include':_0x1c17de[_0x3393('0x1d')]?_[_0x3393('0x1e')](_0x1c17de[_0x3393('0x1d')],function(_0x28b33d){return{'model':db[_0x28b33d[_0x3393('0x1f')]],'as':_0x28b33d['as'],'attributes':_0x28b33d[_0x3393('0x1b')],'include':_0x28b33d[_0x3393('0x1d')]?_[_0x3393('0x1e')](_0x28b33d['include'],function(_0x19d750){return{'model':db[_0x19d750[_0x3393('0x1f')]],'as':_0x19d750['as'],'attributes':_0x19d750[_0x3393('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3393('0xb')](function(_0x14ab30){logger[_0x3393('0x13')](_0x3393('0x20'),_0x291e10);logger[_0x3393('0xd')](_0x3393('0x20'),_0x291e10,JSON['stringify'](_0x14ab30));_0x33340b(_0x14ab30);})[_0x3393('0x14')](function(_0x8185bf){logger[_0x3393('0x10')](_0x3393('0x20'),_0x8185bf[_0x3393('0x12')],_0x291e10);_0x4dba67(_0x14a901['error'](0x1f4,_0x8185bf[_0x3393('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index a718cf0..9bcba4d 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 _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(_0x352097,_0x45f83e){var _0x4fab06=function(_0x4a46be){while(--_0x4a46be){_0x352097['push'](_0x352097['shift']());}};_0x4fab06(++_0x45f83e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x486194,_0x55f113){_0x486194=_0x486194-0x0;var _0x59ba1d=_0x5f2f[_0x486194];return _0x59ba1d;};'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 +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(_0x5050c2,_0x3f7af3){var _0x5b2cab=function(_0x28ae57){while(--_0x28ae57){_0x5050c2['push'](_0x5050c2['shift']());}};_0x5b2cab(++_0x3f7af3);}(_0xadb5,0xad));var _0x5adb=function(_0x2311e2,_0x383855){_0x2311e2=_0x2311e2-0x0;var _0x43bf6a=_0xadb5[_0x2311e2];return _0x43bf6a;};'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 diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 1bff7ff..e52ca96 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 _0x91a7=['STRING','Task','contact','lead','account','ENUM','nothing','exports'];(function(_0x5c4a5b,_0x16747a){var _0x45fe3a=function(_0x867b95){while(--_0x867b95){_0x5c4a5b['push'](_0x5c4a5b['shift']());}};_0x45fe3a(++_0x16747a);}(_0x91a7,0xe7));var _0x791a=function(_0xd83d62,_0x30b3c6){_0xd83d62=_0xd83d62-0x0;var _0xec58f3=_0x91a7[_0xd83d62];return _0xec58f3;};'use strict';var Sequelize=require('sequelize');module[_0x791a('0x0')]={'name':{'type':Sequelize[_0x791a('0x1')]},'description':{'type':Sequelize[_0x791a('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0x791a('0x2'),'Case'),'defaultValue':_0x791a('0x2')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0x791a('0x3'),_0x791a('0x4'),'account_contact_lead',_0x791a('0x5')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x791a('0x6')](_0x791a('0x7'),'contact',_0x791a('0x4'),_0x791a('0x5')),'defaultValue':_0x791a('0x4')},'leadId':{'type':Sequelize[_0x791a('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x791a('0x1')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x791a('0x1')]}}; \ No newline at end of file +var _0x4a13=['Case','Task','ENUM','contact_lead','contact','lead','account_contact_lead','account','nothing','exports','STRING'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x4a13,0xa3));var _0x34a1=function(_0x121c41,_0x223e29){_0x121c41=_0x121c41-0x0;var _0x238afe=_0x4a13[_0x121c41];return _0x238afe;};'use strict';var Sequelize=require('sequelize');module[_0x34a1('0x0')]={'name':{'type':Sequelize[_0x34a1('0x1')]},'description':{'type':Sequelize[_0x34a1('0x1')]},'ticketType':{'type':Sequelize['ENUM']('Task',_0x34a1('0x2')),'defaultValue':_0x34a1('0x3')},'moduleSearch':{'type':Sequelize[_0x34a1('0x4')](_0x34a1('0x5'),_0x34a1('0x6'),_0x34a1('0x7'),_0x34a1('0x8'),_0x34a1('0x9')),'defaultValue':_0x34a1('0x5')},'moduleCreate':{'type':Sequelize['ENUM'](_0x34a1('0xa'),_0x34a1('0x6'),_0x34a1('0x7'),'account'),'defaultValue':_0x34a1('0x7')},'leadId':{'type':Sequelize[_0x34a1('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x34a1('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x34a1('0x1')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 14afd7b..0beba80 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 _0xcfaa=['where','filters','merge','VIRTUAL','filter','include','SalesforceConfiguration','findAll','rows','catch','show','params','options','create','body','update','find','destroy','getFields','findOne','SalesforceField','hasOwnProperty','nolimit','getSubjects','pick','getDescriptions','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','order','sort'];(function(_0x277492,_0x199fd1){var _0x4b8c46=function(_0x19f8dd){while(--_0x19f8dd){_0x277492['push'](_0x277492['shift']());}};_0x4b8c46(++_0x199fd1);}(_0xcfaa,0x104));var _0xacfa=function(_0x39e8a4,_0x45f64e){_0x39e8a4=_0x39e8a4-0x0;var _0x1793d3=_0xcfaa[_0x39e8a4];return _0x1793d3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xacfa('0x0'));var zipdir=require(_0xacfa('0x1'));var jsonpatch=require(_0xacfa('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xacfa('0x3'));var Mustache=require(_0xacfa('0x4'));var util=require(_0xacfa('0x5'));var path=require(_0xacfa('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xacfa('0x7'));var _=require(_0xacfa('0x8'));var squel=require('squel');var crypto=require(_0xacfa('0x9'));var jsforce=require(_0xacfa('0xa'));var deskjs=require(_0xacfa('0xb'));var toCsv=require('to-csv');var querystring=require(_0xacfa('0xc'));var Papa=require('papaparse');var Redis=require(_0xacfa('0xd'));var authService=require(_0xacfa('0xe'));var qs=require(_0xacfa('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xacfa('0x10'));var logger=require('../../config/logger')(_0xacfa('0x11'));var utils=require(_0xacfa('0x12'));var config=require(_0xacfa('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17b15c,_0x3ef5ac){_0x3ef5ac=_0x3ef5ac||0xcc;return function(_0x5bdaee){if(_0x5bdaee){return _0x17b15c[_0xacfa('0x14')](_0x3ef5ac);}return _0x17b15c[_0xacfa('0x15')](_0x3ef5ac)[_0xacfa('0x16')]();};}function respondWithResult(_0x233406,_0x4f8627){_0x4f8627=_0x4f8627||0xc8;return function(_0x562461){if(_0x562461){return _0x233406[_0xacfa('0x15')](_0x4f8627)[_0xacfa('0x17')](_0x562461);}};}function respondWithFilteredResult(_0x91e1b8,_0x34772c){return function(_0x5181bd){if(_0x5181bd){var _0x6c0423=typeof _0x34772c[_0xacfa('0x18')]===_0xacfa('0x19')&&typeof _0x34772c[_0xacfa('0x1a')]===_0xacfa('0x19');var _0x7ba2d6=_0x5181bd[_0xacfa('0x1b')];var _0x369343=_0x6c0423?0x0:_0x34772c[_0xacfa('0x18')];var _0x5e9cf4=_0x6c0423?_0x5181bd['count']:_0x34772c[_0xacfa('0x18')]+_0x34772c[_0xacfa('0x1a')];var _0x5e06b3;if(_0x5e9cf4>=_0x7ba2d6){_0x5e9cf4=_0x7ba2d6;_0x5e06b3=0xc8;}else{_0x5e06b3=0xce;}_0x91e1b8[_0xacfa('0x15')](_0x5e06b3);return _0x91e1b8[_0xacfa('0x1c')](_0xacfa('0x1d'),_0x369343+'-'+_0x5e9cf4+'/'+_0x7ba2d6)[_0xacfa('0x17')](_0x5181bd);}return null;};}function patchUpdates(_0x5c647b){return function(_0x4898e0){try{jsonpatch[_0xacfa('0x1e')](_0x4898e0,_0x5c647b,!![]);}catch(_0xe4fcae){return BPromise[_0xacfa('0x1f')](_0xe4fcae);}return _0x4898e0[_0xacfa('0x20')]();};}function saveUpdates(_0x26830f,_0x472b2d){return function(_0x531d23){if(_0x531d23){return _0x531d23['update'](_0x26830f)[_0xacfa('0x21')](function(_0x4558db){return _0x4558db;});}return null;};}function removeEntity(_0x91b9e4,_0x1a3787){return function(_0xf6d2e){if(_0xf6d2e){return _0xf6d2e['destroy']()[_0xacfa('0x21')](function(){_0x91b9e4[_0xacfa('0x15')](0xcc)[_0xacfa('0x16')]();});}};}function handleEntityNotFound(_0x40416f,_0x3c8d5b){return function(_0x3be648){if(!_0x3be648){_0x40416f[_0xacfa('0x14')](0x194);}return _0x3be648;};}function handleError(_0x2011f1,_0x2dbbf6){_0x2dbbf6=_0x2dbbf6||0x1f4;return function(_0x6c7328){logger[_0xacfa('0x22')](_0x6c7328[_0xacfa('0x23')]);if(_0x6c7328['name']){delete _0x6c7328[_0xacfa('0x24')];}_0x2011f1[_0xacfa('0x15')](_0x2dbbf6)[_0xacfa('0x25')](_0x6c7328);};}exports[_0xacfa('0x26')]=function(_0x45b6b3,_0x50a919){var _0x322c9b={},_0x54f94e={},_0x323b7b={'count':0x0,'rows':[]};var _0x2adcde=_[_0xacfa('0x27')](db['SalesforceConfiguration'][_0xacfa('0x28')],function(_0x448900){return{'name':_0x448900[_0xacfa('0x29')],'type':_0x448900[_0xacfa('0x2a')]['key']};});_0x54f94e[_0xacfa('0x2b')]=_[_0xacfa('0x27')](_0x2adcde,_0xacfa('0x24'));_0x54f94e[_0xacfa('0x2c')]=_[_0xacfa('0x2d')](_0x45b6b3['query']);_0x54f94e['filters']=_[_0xacfa('0x2e')](_0x54f94e['model'],_0x54f94e[_0xacfa('0x2c')]);_0x322c9b[_0xacfa('0x2f')]=_[_0xacfa('0x2e')](_0x54f94e['model'],qs[_0xacfa('0x30')](_0x45b6b3[_0xacfa('0x2c')]['fields']));_0x322c9b[_0xacfa('0x2f')]=_0x322c9b['attributes'][_0xacfa('0x31')]?_0x322c9b['attributes']:_0x54f94e[_0xacfa('0x2b')];if(!_0x45b6b3[_0xacfa('0x2c')]['hasOwnProperty']('nolimit')){_0x322c9b[_0xacfa('0x1a')]=qs[_0xacfa('0x1a')](_0x45b6b3['query']['limit']);_0x322c9b[_0xacfa('0x18')]=qs[_0xacfa('0x18')](_0x45b6b3[_0xacfa('0x2c')]['offset']);}_0x322c9b[_0xacfa('0x32')]=qs[_0xacfa('0x33')](_0x45b6b3[_0xacfa('0x2c')][_0xacfa('0x33')]);_0x322c9b[_0xacfa('0x34')]=qs[_0xacfa('0x35')](_['pick'](_0x45b6b3['query'],_0x54f94e[_0xacfa('0x35')]),_0x2adcde);if(_0x45b6b3[_0xacfa('0x2c')]['filter']){_0x322c9b['where']=_[_0xacfa('0x36')](_0x322c9b['where'],{'$or':_['map'](_0x2adcde,function(_0x174ac1){if(_0x174ac1[_0xacfa('0x2a')]!==_0xacfa('0x37')){var _0x1324bf={};_0x1324bf[_0x174ac1[_0xacfa('0x24')]]={'$like':'%'+_0x45b6b3[_0xacfa('0x2c')][_0xacfa('0x38')]+'%'};return _0x1324bf;}})});}_0x322c9b=_[_0xacfa('0x36')]({},_0x322c9b,_0x45b6b3['options']);var _0x57d0df={'where':_0x322c9b[_0xacfa('0x34')]};return db['SalesforceConfiguration'][_0xacfa('0x1b')](_0x57d0df)[_0xacfa('0x21')](function(_0xa29122){_0x323b7b[_0xacfa('0x1b')]=_0xa29122;if(_0x45b6b3[_0xacfa('0x2c')]['includeAll']){_0x322c9b[_0xacfa('0x39')]=[{'all':!![]}];}return db[_0xacfa('0x3a')][_0xacfa('0x3b')](_0x322c9b);})[_0xacfa('0x21')](function(_0xc398e0){_0x323b7b[_0xacfa('0x3c')]=_0xc398e0;return _0x323b7b;})[_0xacfa('0x21')](respondWithFilteredResult(_0x50a919,_0x322c9b))[_0xacfa('0x3d')](handleError(_0x50a919,null));};exports[_0xacfa('0x3e')]=function(_0x528239,_0x1eddc0){var _0x48f971={'raw':![],'where':{'id':_0x528239[_0xacfa('0x3f')]['id']}},_0x2193ea={};_0x2193ea[_0xacfa('0x2b')]=_[_0xacfa('0x2d')](db[_0xacfa('0x3a')][_0xacfa('0x28')]);_0x2193ea['query']=_[_0xacfa('0x2d')](_0x528239[_0xacfa('0x2c')]);_0x2193ea['filters']=_[_0xacfa('0x2e')](_0x2193ea[_0xacfa('0x2b')],_0x2193ea['query']);_0x48f971[_0xacfa('0x2f')]=_[_0xacfa('0x2e')](_0x2193ea[_0xacfa('0x2b')],qs['fields'](_0x528239[_0xacfa('0x2c')][_0xacfa('0x30')]));_0x48f971[_0xacfa('0x2f')]=_0x48f971[_0xacfa('0x2f')]['length']?_0x48f971['attributes']:_0x2193ea['model'];if(_0x528239[_0xacfa('0x2c')]['includeAll']){_0x48f971[_0xacfa('0x39')]=[{'all':!![]}];}_0x48f971=_['merge']({},_0x48f971,_0x528239[_0xacfa('0x40')]);return db['SalesforceConfiguration']['find'](_0x48f971)[_0xacfa('0x21')](handleEntityNotFound(_0x1eddc0,null))[_0xacfa('0x21')](respondWithResult(_0x1eddc0,null))['catch'](handleError(_0x1eddc0,null));};exports[_0xacfa('0x41')]=function(_0x160904,_0x1a79e6){return db[_0xacfa('0x3a')][_0xacfa('0x41')](_0x160904[_0xacfa('0x42')],{})['then'](respondWithResult(_0x1a79e6,0xc9))[_0xacfa('0x3d')](handleError(_0x1a79e6,null));};exports[_0xacfa('0x43')]=function(_0xf9b9bd,_0x5259b7){if(_0xf9b9bd['body']['id']){delete _0xf9b9bd[_0xacfa('0x42')]['id'];}return db[_0xacfa('0x3a')][_0xacfa('0x44')]({'where':{'id':_0xf9b9bd[_0xacfa('0x3f')]['id']}})[_0xacfa('0x21')](handleEntityNotFound(_0x5259b7,null))[_0xacfa('0x21')](saveUpdates(_0xf9b9bd[_0xacfa('0x42')],null))[_0xacfa('0x21')](respondWithResult(_0x5259b7,null))[_0xacfa('0x3d')](handleError(_0x5259b7,null));};exports[_0xacfa('0x45')]=function(_0x2055cc,_0x32bdda){return db[_0xacfa('0x3a')][_0xacfa('0x44')]({'where':{'id':_0x2055cc['params']['id']}})[_0xacfa('0x21')](handleEntityNotFound(_0x32bdda,null))[_0xacfa('0x21')](removeEntity(_0x32bdda,null))['catch'](handleError(_0x32bdda,null));};exports[_0xacfa('0x46')]=function(_0x3d2266,_0x1c5a89,_0x4036f7){var _0xd964d7={};var _0x4c47d3={};var _0x148e45;var _0x161e71;return db['SalesforceConfiguration'][_0xacfa('0x47')]({'where':{'id':_0x3d2266[_0xacfa('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1c5a89,null))[_0xacfa('0x21')](function(_0x13de98){if(_0x13de98){_0x148e45=_0x13de98;_0x4c47d3[_0xacfa('0x2b')]=_[_0xacfa('0x2d')](db[_0xacfa('0x48')][_0xacfa('0x28')]);_0x4c47d3[_0xacfa('0x2c')]=_[_0xacfa('0x2d')](_0x3d2266['query']);_0x4c47d3[_0xacfa('0x35')]=_[_0xacfa('0x2e')](_0x4c47d3['model'],_0x4c47d3['query']);_0xd964d7[_0xacfa('0x2f')]=_[_0xacfa('0x2e')](_0x4c47d3['model'],qs[_0xacfa('0x30')](_0x3d2266['query'][_0xacfa('0x30')]));_0xd964d7[_0xacfa('0x2f')]=_0xd964d7[_0xacfa('0x2f')][_0xacfa('0x31')]?_0xd964d7[_0xacfa('0x2f')]:_0x4c47d3[_0xacfa('0x2b')];_0xd964d7[_0xacfa('0x32')]=qs[_0xacfa('0x33')](_0x3d2266[_0xacfa('0x2c')]['sort']);_0xd964d7[_0xacfa('0x34')]=qs['filters'](_['pick'](_0x3d2266[_0xacfa('0x2c')],_0x4c47d3[_0xacfa('0x35')]));if(_0x3d2266['query']['filter']){_0xd964d7[_0xacfa('0x34')]=_[_0xacfa('0x36')](_0xd964d7['where'],{'$or':_[_0xacfa('0x27')](_0xd964d7['attributes'],function(_0x2a2852){var _0x351bce={};_0x351bce[_0x2a2852]={'$like':'%'+_0x3d2266[_0xacfa('0x2c')][_0xacfa('0x38')]+'%'};return _0x351bce;})});}_0xd964d7=_['merge']({},_0xd964d7,_0x3d2266['options']);return _0x148e45[_0xacfa('0x46')](_0xd964d7);}})[_0xacfa('0x21')](function(_0x479a47){if(_0x479a47){_0x161e71=_0x479a47[_0xacfa('0x31')];if(!_0x3d2266[_0xacfa('0x2c')][_0xacfa('0x49')](_0xacfa('0x4a'))){_0xd964d7[_0xacfa('0x1a')]=qs[_0xacfa('0x1a')](_0x3d2266[_0xacfa('0x2c')]['limit']);_0xd964d7['offset']=qs['offset'](_0x3d2266[_0xacfa('0x2c')][_0xacfa('0x18')]);}return _0x148e45[_0xacfa('0x46')](_0xd964d7);}})['then'](function(_0x5e5dc8){if(_0x5e5dc8){return _0x5e5dc8?{'count':_0x161e71,'rows':_0x5e5dc8}:null;}})['then'](respondWithResult(_0x1c5a89,null))[_0xacfa('0x3d')](handleError(_0x1c5a89,null));};exports[_0xacfa('0x4b')]=function(_0x3f94e7,_0x2b3c84,_0x408e5e){var _0x2e1fad={};var _0xbb5f87={};var _0xdb2041;var _0x196537;return db[_0xacfa('0x3a')][_0xacfa('0x47')]({'where':{'id':_0x3f94e7[_0xacfa('0x3f')]['id']}})[_0xacfa('0x21')](handleEntityNotFound(_0x2b3c84,null))[_0xacfa('0x21')](function(_0x3e6751){if(_0x3e6751){_0xdb2041=_0x3e6751;_0xbb5f87[_0xacfa('0x2b')]=_[_0xacfa('0x2d')](db[_0xacfa('0x48')]['rawAttributes']);_0xbb5f87[_0xacfa('0x2c')]=_[_0xacfa('0x2d')](_0x3f94e7[_0xacfa('0x2c')]);_0xbb5f87['filters']=_['intersection'](_0xbb5f87[_0xacfa('0x2b')],_0xbb5f87['query']);_0x2e1fad['attributes']=_[_0xacfa('0x2e')](_0xbb5f87[_0xacfa('0x2b')],qs[_0xacfa('0x30')](_0x3f94e7['query'][_0xacfa('0x30')]));_0x2e1fad[_0xacfa('0x2f')]=_0x2e1fad[_0xacfa('0x2f')]['length']?_0x2e1fad[_0xacfa('0x2f')]:_0xbb5f87[_0xacfa('0x2b')];_0x2e1fad[_0xacfa('0x32')]=qs[_0xacfa('0x33')](_0x3f94e7['query'][_0xacfa('0x33')]);_0x2e1fad[_0xacfa('0x34')]=qs['filters'](_[_0xacfa('0x4c')](_0x3f94e7[_0xacfa('0x2c')],_0xbb5f87[_0xacfa('0x35')]));if(_0x3f94e7[_0xacfa('0x2c')][_0xacfa('0x38')]){_0x2e1fad['where']=_['merge'](_0x2e1fad['where'],{'$or':_[_0xacfa('0x27')](_0x2e1fad[_0xacfa('0x2f')],function(_0x3893c9){var _0x3190e5={};_0x3190e5[_0x3893c9]={'$like':'%'+_0x3f94e7[_0xacfa('0x2c')][_0xacfa('0x38')]+'%'};return _0x3190e5;})});}_0x2e1fad=_[_0xacfa('0x36')]({},_0x2e1fad,_0x3f94e7[_0xacfa('0x40')]);return _0xdb2041['getSubjects'](_0x2e1fad);}})[_0xacfa('0x21')](function(_0x3632b7){if(_0x3632b7){_0x196537=_0x3632b7[_0xacfa('0x31')];if(!_0x3f94e7['query'][_0xacfa('0x49')](_0xacfa('0x4a'))){_0x2e1fad[_0xacfa('0x1a')]=qs[_0xacfa('0x1a')](_0x3f94e7[_0xacfa('0x2c')]['limit']);_0x2e1fad[_0xacfa('0x18')]=qs[_0xacfa('0x18')](_0x3f94e7[_0xacfa('0x2c')][_0xacfa('0x18')]);}return _0xdb2041['getSubjects'](_0x2e1fad);}})['then'](function(_0x1a14bb){if(_0x1a14bb){return _0x1a14bb?{'count':_0x196537,'rows':_0x1a14bb}:null;}})['then'](respondWithResult(_0x2b3c84,null))['catch'](handleError(_0x2b3c84,null));};exports[_0xacfa('0x4d')]=function(_0x15c2d6,_0x5d649b,_0x11498d){var _0x4eed0b={};var _0xacd2a4={};var _0x3943a2;var _0x5e3712;return db[_0xacfa('0x3a')][_0xacfa('0x47')]({'where':{'id':_0x15c2d6[_0xacfa('0x3f')]['id']}})[_0xacfa('0x21')](handleEntityNotFound(_0x5d649b,null))['then'](function(_0x176176){if(_0x176176){_0x3943a2=_0x176176;_0xacd2a4[_0xacfa('0x2b')]=_[_0xacfa('0x2d')](db[_0xacfa('0x48')]['rawAttributes']);_0xacd2a4[_0xacfa('0x2c')]=_[_0xacfa('0x2d')](_0x15c2d6['query']);_0xacd2a4[_0xacfa('0x35')]=_['intersection'](_0xacd2a4['model'],_0xacd2a4['query']);_0x4eed0b['attributes']=_['intersection'](_0xacd2a4[_0xacfa('0x2b')],qs[_0xacfa('0x30')](_0x15c2d6['query']['fields']));_0x4eed0b[_0xacfa('0x2f')]=_0x4eed0b[_0xacfa('0x2f')]['length']?_0x4eed0b['attributes']:_0xacd2a4[_0xacfa('0x2b')];_0x4eed0b['order']=qs['sort'](_0x15c2d6[_0xacfa('0x2c')]['sort']);_0x4eed0b[_0xacfa('0x34')]=qs['filters'](_[_0xacfa('0x4c')](_0x15c2d6[_0xacfa('0x2c')],_0xacd2a4[_0xacfa('0x35')]));if(_0x15c2d6[_0xacfa('0x2c')][_0xacfa('0x38')]){_0x4eed0b[_0xacfa('0x34')]=_[_0xacfa('0x36')](_0x4eed0b[_0xacfa('0x34')],{'$or':_['map'](_0x4eed0b[_0xacfa('0x2f')],function(_0x39ef08){var _0x53c9b0={};_0x53c9b0[_0x39ef08]={'$like':'%'+_0x15c2d6[_0xacfa('0x2c')]['filter']+'%'};return _0x53c9b0;})});}_0x4eed0b=_[_0xacfa('0x36')]({},_0x4eed0b,_0x15c2d6['options']);return _0x3943a2[_0xacfa('0x4d')](_0x4eed0b);}})['then'](function(_0x3c02b0){if(_0x3c02b0){_0x5e3712=_0x3c02b0[_0xacfa('0x31')];if(!_0x15c2d6[_0xacfa('0x2c')][_0xacfa('0x49')]('nolimit')){_0x4eed0b[_0xacfa('0x1a')]=qs[_0xacfa('0x1a')](_0x15c2d6[_0xacfa('0x2c')][_0xacfa('0x1a')]);_0x4eed0b[_0xacfa('0x18')]=qs['offset'](_0x15c2d6['query'][_0xacfa('0x18')]);}return _0x3943a2[_0xacfa('0x4d')](_0x4eed0b);}})[_0xacfa('0x21')](function(_0x43ff0b){if(_0x43ff0b){return _0x43ff0b?{'count':_0x5e3712,'rows':_0x43ff0b}:null;}})['then'](respondWithResult(_0x5d649b,null))[_0xacfa('0x3d')](handleError(_0x5d649b,null));}; \ No newline at end of file +var _0xcc3b=['send','index','map','SalesforceConfiguration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','findAll','rows','catch','show','params','rawAttributes','includeAll','include','find','create','body','update','getFields','findOne','SalesforceField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','then','error','name'];(function(_0x137740,_0x170ba0){var _0x4cd982=function(_0x5e7eee){while(--_0x5e7eee){_0x137740['push'](_0x137740['shift']());}};_0x4cd982(++_0x170ba0);}(_0xcc3b,0x119));var _0xbcc3=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xcc3b[_0xa148b7];return _0x51efd3;};'use strict';var emlformat=require(_0xbcc3('0x0'));var rimraf=require(_0xbcc3('0x1'));var zipdir=require(_0xbcc3('0x2'));var jsonpatch=require(_0xbcc3('0x3'));var rp=require(_0xbcc3('0x4'));var moment=require(_0xbcc3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbcc3('0x6'));var util=require(_0xbcc3('0x7'));var path=require(_0xbcc3('0x8'));var sox=require(_0xbcc3('0x9'));var csv=require(_0xbcc3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbcc3('0xb'));var _=require(_0xbcc3('0xc'));var squel=require('squel');var crypto=require(_0xbcc3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbcc3('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbcc3('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbcc3('0x10'));var qs=require(_0xbcc3('0x11'));var as=require(_0xbcc3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbcc3('0x13'))(_0xbcc3('0x14'));var utils=require(_0xbcc3('0x15'));var config=require(_0xbcc3('0x16'));var licenseUtil=require(_0xbcc3('0x17'));var db=require(_0xbcc3('0x18'))['db'];function respondWithStatusCode(_0x23d9cf,_0x38e790){_0x38e790=_0x38e790||0xcc;return function(_0x452696){if(_0x452696){return _0x23d9cf[_0xbcc3('0x19')](_0x38e790);}return _0x23d9cf[_0xbcc3('0x1a')](_0x38e790)[_0xbcc3('0x1b')]();};}function respondWithResult(_0x11fd59,_0x40450a){_0x40450a=_0x40450a||0xc8;return function(_0x4b5fe3){if(_0x4b5fe3){return _0x11fd59[_0xbcc3('0x1a')](_0x40450a)[_0xbcc3('0x1c')](_0x4b5fe3);}};}function respondWithFilteredResult(_0x1930bc,_0x58bd58){return function(_0x128f3a){if(_0x128f3a){var _0x93f6f0=typeof _0x58bd58[_0xbcc3('0x1d')]==='undefined'&&typeof _0x58bd58[_0xbcc3('0x1e')]===_0xbcc3('0x1f');var _0x14d8a8=_0x128f3a['count'];var _0x569122=_0x93f6f0?0x0:_0x58bd58[_0xbcc3('0x1d')];var _0x1b17bc=_0x93f6f0?_0x128f3a[_0xbcc3('0x20')]:_0x58bd58[_0xbcc3('0x1d')]+_0x58bd58['limit'];var _0x5af798;if(_0x1b17bc>=_0x14d8a8){_0x1b17bc=_0x14d8a8;_0x5af798=0xc8;}else{_0x5af798=0xce;}_0x1930bc[_0xbcc3('0x1a')](_0x5af798);return _0x1930bc['set'](_0xbcc3('0x21'),_0x569122+'-'+_0x1b17bc+'/'+_0x14d8a8)[_0xbcc3('0x1c')](_0x128f3a);}return null;};}function patchUpdates(_0x4b1c61){return function(_0x1cd691){try{jsonpatch[_0xbcc3('0x22')](_0x1cd691,_0x4b1c61,!![]);}catch(_0x2a65da){return BPromise['reject'](_0x2a65da);}return _0x1cd691[_0xbcc3('0x23')]();};}function saveUpdates(_0x338efd,_0x22ba13){return function(_0x1335f0){if(_0x1335f0){return _0x1335f0['update'](_0x338efd)[_0xbcc3('0x24')](function(_0x3aff27){return _0x3aff27;});}return null;};}function removeEntity(_0x5bc94c,_0x5a3f7c){return function(_0x19dc44){if(_0x19dc44){return _0x19dc44['destroy']()[_0xbcc3('0x24')](function(){_0x5bc94c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f34f0,_0x1dfa45){return function(_0x4dd565){if(!_0x4dd565){_0x4f34f0[_0xbcc3('0x19')](0x194);}return _0x4dd565;};}function handleError(_0x4a1e63,_0x3de799){_0x3de799=_0x3de799||0x1f4;return function(_0x952ea1){logger[_0xbcc3('0x25')](_0x952ea1['stack']);if(_0x952ea1['name']){delete _0x952ea1[_0xbcc3('0x26')];}_0x4a1e63['status'](_0x3de799)[_0xbcc3('0x27')](_0x952ea1);};}exports[_0xbcc3('0x28')]=function(_0xa7d5f8,_0x37bff7){var _0x5c8116={},_0x3601e8={},_0x27add5={'count':0x0,'rows':[]};var _0x5b1625=_[_0xbcc3('0x29')](db[_0xbcc3('0x2a')]['rawAttributes'],function(_0x1004bc){return{'name':_0x1004bc[_0xbcc3('0x2b')],'type':_0x1004bc[_0xbcc3('0x2c')][_0xbcc3('0x2d')]};});_0x3601e8[_0xbcc3('0x2e')]=_[_0xbcc3('0x29')](_0x5b1625,'name');_0x3601e8[_0xbcc3('0x2f')]=_[_0xbcc3('0x30')](_0xa7d5f8['query']);_0x3601e8[_0xbcc3('0x31')]=_[_0xbcc3('0x32')](_0x3601e8['model'],_0x3601e8[_0xbcc3('0x2f')]);_0x5c8116[_0xbcc3('0x33')]=_[_0xbcc3('0x32')](_0x3601e8[_0xbcc3('0x2e')],qs[_0xbcc3('0x34')](_0xa7d5f8[_0xbcc3('0x2f')][_0xbcc3('0x34')]));_0x5c8116[_0xbcc3('0x33')]=_0x5c8116[_0xbcc3('0x33')][_0xbcc3('0x35')]?_0x5c8116[_0xbcc3('0x33')]:_0x3601e8[_0xbcc3('0x2e')];if(!_0xa7d5f8[_0xbcc3('0x2f')][_0xbcc3('0x36')](_0xbcc3('0x37'))){_0x5c8116['limit']=qs[_0xbcc3('0x1e')](_0xa7d5f8[_0xbcc3('0x2f')][_0xbcc3('0x1e')]);_0x5c8116['offset']=qs[_0xbcc3('0x1d')](_0xa7d5f8['query'][_0xbcc3('0x1d')]);}_0x5c8116[_0xbcc3('0x38')]=qs[_0xbcc3('0x39')](_0xa7d5f8[_0xbcc3('0x2f')][_0xbcc3('0x39')]);_0x5c8116[_0xbcc3('0x3a')]=qs[_0xbcc3('0x31')](_[_0xbcc3('0x3b')](_0xa7d5f8[_0xbcc3('0x2f')],_0x3601e8[_0xbcc3('0x31')]),_0x5b1625);if(_0xa7d5f8[_0xbcc3('0x2f')][_0xbcc3('0x3c')]){_0x5c8116[_0xbcc3('0x3a')]=_[_0xbcc3('0x3d')](_0x5c8116[_0xbcc3('0x3a')],{'$or':_[_0xbcc3('0x29')](_0x5b1625,function(_0x21a8e6){if(_0x21a8e6[_0xbcc3('0x2c')]!=='VIRTUAL'){var _0x4f359b={};_0x4f359b[_0x21a8e6[_0xbcc3('0x26')]]={'$like':'%'+_0xa7d5f8[_0xbcc3('0x2f')][_0xbcc3('0x3c')]+'%'};return _0x4f359b;}})});}_0x5c8116=_[_0xbcc3('0x3d')]({},_0x5c8116,_0xa7d5f8[_0xbcc3('0x3e')]);var _0x1074ba={'where':_0x5c8116[_0xbcc3('0x3a')]};return db['SalesforceConfiguration'][_0xbcc3('0x20')](_0x1074ba)[_0xbcc3('0x24')](function(_0x144d86){_0x27add5[_0xbcc3('0x20')]=_0x144d86;if(_0xa7d5f8[_0xbcc3('0x2f')]['includeAll']){_0x5c8116['include']=[{'all':!![]}];}return db['SalesforceConfiguration'][_0xbcc3('0x3f')](_0x5c8116);})[_0xbcc3('0x24')](function(_0x1cec30){_0x27add5[_0xbcc3('0x40')]=_0x1cec30;return _0x27add5;})[_0xbcc3('0x24')](respondWithFilteredResult(_0x37bff7,_0x5c8116))[_0xbcc3('0x41')](handleError(_0x37bff7,null));};exports[_0xbcc3('0x42')]=function(_0x5004fe,_0x34e948){var _0x4d0670={'raw':![],'where':{'id':_0x5004fe[_0xbcc3('0x43')]['id']}},_0x18d8e3={};_0x18d8e3[_0xbcc3('0x2e')]=_[_0xbcc3('0x30')](db['SalesforceConfiguration'][_0xbcc3('0x44')]);_0x18d8e3['query']=_[_0xbcc3('0x30')](_0x5004fe[_0xbcc3('0x2f')]);_0x18d8e3[_0xbcc3('0x31')]=_[_0xbcc3('0x32')](_0x18d8e3[_0xbcc3('0x2e')],_0x18d8e3[_0xbcc3('0x2f')]);_0x4d0670[_0xbcc3('0x33')]=_[_0xbcc3('0x32')](_0x18d8e3['model'],qs['fields'](_0x5004fe[_0xbcc3('0x2f')][_0xbcc3('0x34')]));_0x4d0670[_0xbcc3('0x33')]=_0x4d0670[_0xbcc3('0x33')]['length']?_0x4d0670['attributes']:_0x18d8e3[_0xbcc3('0x2e')];if(_0x5004fe[_0xbcc3('0x2f')][_0xbcc3('0x45')]){_0x4d0670[_0xbcc3('0x46')]=[{'all':!![]}];}_0x4d0670=_[_0xbcc3('0x3d')]({},_0x4d0670,_0x5004fe['options']);return db[_0xbcc3('0x2a')][_0xbcc3('0x47')](_0x4d0670)[_0xbcc3('0x24')](handleEntityNotFound(_0x34e948,null))['then'](respondWithResult(_0x34e948,null))[_0xbcc3('0x41')](handleError(_0x34e948,null));};exports['create']=function(_0xde4827,_0x34fbc0){return db['SalesforceConfiguration'][_0xbcc3('0x48')](_0xde4827[_0xbcc3('0x49')],{})[_0xbcc3('0x24')](respondWithResult(_0x34fbc0,0xc9))[_0xbcc3('0x41')](handleError(_0x34fbc0,null));};exports[_0xbcc3('0x4a')]=function(_0x1eebe1,_0x4ce8c6){if(_0x1eebe1[_0xbcc3('0x49')]['id']){delete _0x1eebe1[_0xbcc3('0x49')]['id'];}return db[_0xbcc3('0x2a')]['find']({'where':{'id':_0x1eebe1[_0xbcc3('0x43')]['id']}})[_0xbcc3('0x24')](handleEntityNotFound(_0x4ce8c6,null))[_0xbcc3('0x24')](saveUpdates(_0x1eebe1[_0xbcc3('0x49')],null))['then'](respondWithResult(_0x4ce8c6,null))[_0xbcc3('0x41')](handleError(_0x4ce8c6,null));};exports['destroy']=function(_0x51f336,_0x212c41){return db[_0xbcc3('0x2a')][_0xbcc3('0x47')]({'where':{'id':_0x51f336[_0xbcc3('0x43')]['id']}})[_0xbcc3('0x24')](handleEntityNotFound(_0x212c41,null))['then'](removeEntity(_0x212c41,null))[_0xbcc3('0x41')](handleError(_0x212c41,null));};exports[_0xbcc3('0x4b')]=function(_0x56cd59,_0x2c226d,_0x4fbb7c){var _0x4112eb={};var _0x2d9c7b={};var _0x27a87e;var _0x1534b9;return db[_0xbcc3('0x2a')][_0xbcc3('0x4c')]({'where':{'id':_0x56cd59[_0xbcc3('0x43')]['id']}})[_0xbcc3('0x24')](handleEntityNotFound(_0x2c226d,null))[_0xbcc3('0x24')](function(_0x188873){if(_0x188873){_0x27a87e=_0x188873;_0x2d9c7b[_0xbcc3('0x2e')]=_['keys'](db[_0xbcc3('0x4d')][_0xbcc3('0x44')]);_0x2d9c7b[_0xbcc3('0x2f')]=_[_0xbcc3('0x30')](_0x56cd59['query']);_0x2d9c7b[_0xbcc3('0x31')]=_[_0xbcc3('0x32')](_0x2d9c7b[_0xbcc3('0x2e')],_0x2d9c7b[_0xbcc3('0x2f')]);_0x4112eb[_0xbcc3('0x33')]=_[_0xbcc3('0x32')](_0x2d9c7b[_0xbcc3('0x2e')],qs['fields'](_0x56cd59[_0xbcc3('0x2f')][_0xbcc3('0x34')]));_0x4112eb[_0xbcc3('0x33')]=_0x4112eb[_0xbcc3('0x33')][_0xbcc3('0x35')]?_0x4112eb['attributes']:_0x2d9c7b[_0xbcc3('0x2e')];_0x4112eb[_0xbcc3('0x38')]=qs['sort'](_0x56cd59[_0xbcc3('0x2f')][_0xbcc3('0x39')]);_0x4112eb[_0xbcc3('0x3a')]=qs[_0xbcc3('0x31')](_[_0xbcc3('0x3b')](_0x56cd59[_0xbcc3('0x2f')],_0x2d9c7b['filters']));if(_0x56cd59[_0xbcc3('0x2f')][_0xbcc3('0x3c')]){_0x4112eb[_0xbcc3('0x3a')]=_[_0xbcc3('0x3d')](_0x4112eb[_0xbcc3('0x3a')],{'$or':_[_0xbcc3('0x29')](_0x4112eb[_0xbcc3('0x33')],function(_0x450eb3){var _0x18c2c3={};_0x18c2c3[_0x450eb3]={'$like':'%'+_0x56cd59['query'][_0xbcc3('0x3c')]+'%'};return _0x18c2c3;})});}_0x4112eb=_[_0xbcc3('0x3d')]({},_0x4112eb,_0x56cd59[_0xbcc3('0x3e')]);return _0x27a87e[_0xbcc3('0x4b')](_0x4112eb);}})[_0xbcc3('0x24')](function(_0x1d6178){if(_0x1d6178){_0x1534b9=_0x1d6178['length'];if(!_0x56cd59[_0xbcc3('0x2f')]['hasOwnProperty'](_0xbcc3('0x37'))){_0x4112eb[_0xbcc3('0x1e')]=qs['limit'](_0x56cd59[_0xbcc3('0x2f')][_0xbcc3('0x1e')]);_0x4112eb[_0xbcc3('0x1d')]=qs['offset'](_0x56cd59[_0xbcc3('0x2f')]['offset']);}return _0x27a87e[_0xbcc3('0x4b')](_0x4112eb);}})[_0xbcc3('0x24')](function(_0x5dc108){if(_0x5dc108){return _0x5dc108?{'count':_0x1534b9,'rows':_0x5dc108}:null;}})['then'](respondWithResult(_0x2c226d,null))[_0xbcc3('0x41')](handleError(_0x2c226d,null));};exports[_0xbcc3('0x4e')]=function(_0x456137,_0x18468c,_0x18cbdf){var _0xf69f6d={};var _0x5c6b2d={};var _0x704bcb;var _0x139408;return db[_0xbcc3('0x2a')][_0xbcc3('0x4c')]({'where':{'id':_0x456137['params']['id']}})['then'](handleEntityNotFound(_0x18468c,null))[_0xbcc3('0x24')](function(_0x55c156){if(_0x55c156){_0x704bcb=_0x55c156;_0x5c6b2d['model']=_['keys'](db[_0xbcc3('0x4d')][_0xbcc3('0x44')]);_0x5c6b2d[_0xbcc3('0x2f')]=_[_0xbcc3('0x30')](_0x456137[_0xbcc3('0x2f')]);_0x5c6b2d['filters']=_[_0xbcc3('0x32')](_0x5c6b2d[_0xbcc3('0x2e')],_0x5c6b2d['query']);_0xf69f6d[_0xbcc3('0x33')]=_[_0xbcc3('0x32')](_0x5c6b2d[_0xbcc3('0x2e')],qs[_0xbcc3('0x34')](_0x456137[_0xbcc3('0x2f')][_0xbcc3('0x34')]));_0xf69f6d[_0xbcc3('0x33')]=_0xf69f6d[_0xbcc3('0x33')]['length']?_0xf69f6d[_0xbcc3('0x33')]:_0x5c6b2d[_0xbcc3('0x2e')];_0xf69f6d[_0xbcc3('0x38')]=qs[_0xbcc3('0x39')](_0x456137[_0xbcc3('0x2f')][_0xbcc3('0x39')]);_0xf69f6d[_0xbcc3('0x3a')]=qs[_0xbcc3('0x31')](_[_0xbcc3('0x3b')](_0x456137[_0xbcc3('0x2f')],_0x5c6b2d[_0xbcc3('0x31')]));if(_0x456137[_0xbcc3('0x2f')][_0xbcc3('0x3c')]){_0xf69f6d[_0xbcc3('0x3a')]=_['merge'](_0xf69f6d[_0xbcc3('0x3a')],{'$or':_[_0xbcc3('0x29')](_0xf69f6d[_0xbcc3('0x33')],function(_0x2321f7){var _0x1f7390={};_0x1f7390[_0x2321f7]={'$like':'%'+_0x456137[_0xbcc3('0x2f')][_0xbcc3('0x3c')]+'%'};return _0x1f7390;})});}_0xf69f6d=_[_0xbcc3('0x3d')]({},_0xf69f6d,_0x456137[_0xbcc3('0x3e')]);return _0x704bcb[_0xbcc3('0x4e')](_0xf69f6d);}})[_0xbcc3('0x24')](function(_0x20ebeb){if(_0x20ebeb){_0x139408=_0x20ebeb['length'];if(!_0x456137[_0xbcc3('0x2f')][_0xbcc3('0x36')](_0xbcc3('0x37'))){_0xf69f6d[_0xbcc3('0x1e')]=qs['limit'](_0x456137[_0xbcc3('0x2f')]['limit']);_0xf69f6d[_0xbcc3('0x1d')]=qs['offset'](_0x456137[_0xbcc3('0x2f')][_0xbcc3('0x1d')]);}return _0x704bcb[_0xbcc3('0x4e')](_0xf69f6d);}})[_0xbcc3('0x24')](function(_0x164017){if(_0x164017){return _0x164017?{'count':_0x139408,'rows':_0x164017}:null;}})[_0xbcc3('0x24')](respondWithResult(_0x18468c,null))[_0xbcc3('0x41')](handleError(_0x18468c,null));};exports[_0xbcc3('0x4f')]=function(_0x209cc3,_0xe37cf2,_0x57f865){var _0x1defef={};var _0x3208bd={};var _0x1162a3;var _0x59b380;return db['SalesforceConfiguration'][_0xbcc3('0x4c')]({'where':{'id':_0x209cc3[_0xbcc3('0x43')]['id']}})[_0xbcc3('0x24')](handleEntityNotFound(_0xe37cf2,null))[_0xbcc3('0x24')](function(_0x540bd0){if(_0x540bd0){_0x1162a3=_0x540bd0;_0x3208bd[_0xbcc3('0x2e')]=_[_0xbcc3('0x30')](db[_0xbcc3('0x4d')][_0xbcc3('0x44')]);_0x3208bd[_0xbcc3('0x2f')]=_[_0xbcc3('0x30')](_0x209cc3[_0xbcc3('0x2f')]);_0x3208bd[_0xbcc3('0x31')]=_[_0xbcc3('0x32')](_0x3208bd[_0xbcc3('0x2e')],_0x3208bd[_0xbcc3('0x2f')]);_0x1defef[_0xbcc3('0x33')]=_['intersection'](_0x3208bd[_0xbcc3('0x2e')],qs[_0xbcc3('0x34')](_0x209cc3[_0xbcc3('0x2f')][_0xbcc3('0x34')]));_0x1defef[_0xbcc3('0x33')]=_0x1defef[_0xbcc3('0x33')]['length']?_0x1defef[_0xbcc3('0x33')]:_0x3208bd[_0xbcc3('0x2e')];_0x1defef['order']=qs['sort'](_0x209cc3[_0xbcc3('0x2f')][_0xbcc3('0x39')]);_0x1defef[_0xbcc3('0x3a')]=qs['filters'](_['pick'](_0x209cc3[_0xbcc3('0x2f')],_0x3208bd[_0xbcc3('0x31')]));if(_0x209cc3[_0xbcc3('0x2f')][_0xbcc3('0x3c')]){_0x1defef['where']=_[_0xbcc3('0x3d')](_0x1defef[_0xbcc3('0x3a')],{'$or':_['map'](_0x1defef[_0xbcc3('0x33')],function(_0x45ea17){var _0xe81193={};_0xe81193[_0x45ea17]={'$like':'%'+_0x209cc3[_0xbcc3('0x2f')][_0xbcc3('0x3c')]+'%'};return _0xe81193;})});}_0x1defef=_[_0xbcc3('0x3d')]({},_0x1defef,_0x209cc3[_0xbcc3('0x3e')]);return _0x1162a3[_0xbcc3('0x4f')](_0x1defef);}})[_0xbcc3('0x24')](function(_0x1b6130){if(_0x1b6130){_0x59b380=_0x1b6130[_0xbcc3('0x35')];if(!_0x209cc3[_0xbcc3('0x2f')][_0xbcc3('0x36')](_0xbcc3('0x37'))){_0x1defef['limit']=qs[_0xbcc3('0x1e')](_0x209cc3['query'][_0xbcc3('0x1e')]);_0x1defef[_0xbcc3('0x1d')]=qs[_0xbcc3('0x1d')](_0x209cc3[_0xbcc3('0x2f')][_0xbcc3('0x1d')]);}return _0x1162a3[_0xbcc3('0x4f')](_0x1defef);}})[_0xbcc3('0x24')](function(_0x1873ad){if(_0x1873ad){return _0x1873ad?{'count':_0x59b380,'rows':_0x1873ad}:null;}})[_0xbcc3('0x24')](respondWithResult(_0xe37cf2,null))[_0xbcc3('0x41')](handleError(_0xe37cf2,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 894f1cf..a93af6d 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 _0x2533=['path','rimraf','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','lodash','../../config/logger','api','moment','request-promise'];(function(_0x34882f,_0x601a99){var _0x455929=function(_0x463c7c){while(--_0x463c7c){_0x34882f['push'](_0x34882f['shift']());}};_0x455929(++_0x601a99);}(_0x2533,0x187));var _0x3253=function(_0x9fb081,_0x48f480){_0x9fb081=_0x9fb081-0x0;var _0x43f8b0=_0x2533[_0x9fb081];return _0x43f8b0;};'use strict';var _=require(_0x3253('0x0'));var util=require('util');var logger=require(_0x3253('0x1'))(_0x3253('0x2'));var moment=require(_0x3253('0x3'));var BPromise=require('bluebird');var rp=require(_0x3253('0x4'));var fs=require('fs');var path=require(_0x3253('0x5'));var rimraf=require(_0x3253('0x6'));var config=require('../../config/environment');var attributes=require(_0x3253('0x7'));module[_0x3253('0x8')]=function(_0xbf2c8f,_0x528b4f){return _0xbf2c8f[_0x3253('0x9')](_0x3253('0xa'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb5a1=['moment','request-promise','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','int_salesforce_configurations','lodash','util','../../config/logger','api'];(function(_0x5eef05,_0x1be989){var _0x56d4b8=function(_0x57993d){while(--_0x57993d){_0x5eef05['push'](_0x5eef05['shift']());}};_0x56d4b8(++_0x1be989);}(_0xb5a1,0x1d5));var _0x1b5a=function(_0x46cf00,_0x457a43){_0x46cf00=_0x46cf00-0x0;var _0x3974dc=_0xb5a1[_0x46cf00];return _0x3974dc;};'use strict';var _=require(_0x1b5a('0x0'));var util=require(_0x1b5a('0x1'));var logger=require(_0x1b5a('0x2'))(_0x1b5a('0x3'));var moment=require(_0x1b5a('0x4'));var BPromise=require('bluebird');var rp=require(_0x1b5a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1b5a('0x6'));var attributes=require(_0x1b5a('0x7'));module[_0x1b5a('0x8')]=function(_0xdbdaa6,_0x5aaf2a){return _0xdbdaa6[_0x1b5a('0x9')]('SalesforceConfiguration',attributes,{'tableName':_0x1b5a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index b41ac0c..eff8f60 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 _0x5e7d=['request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x2f7162,_0x2c902d){var _0x3eacc5=function(_0x368931){while(--_0x368931){_0x2f7162['push'](_0x2f7162['shift']());}};_0x3eacc5(++_0x2c902d);}(_0x5e7d,0x136));var _0xd5e7=function(_0x1f9bcc,_0x400cb8){_0x1f9bcc=_0x1f9bcc-0x0;var _0x12831a=_0x5e7d[_0x1f9bcc];return _0x12831a;};'use strict';var _=require(_0xd5e7('0x0'));var util=require(_0xd5e7('0x1'));var moment=require(_0xd5e7('0x2'));var BPromise=require('bluebird');var rs=require(_0xd5e7('0x3'));var fs=require('fs');var Redis=require(_0xd5e7('0x4'));var db=require(_0xd5e7('0x5'))['db'];var utils=require(_0xd5e7('0x6'));var logger=require(_0xd5e7('0x7'))('rpc');var config=require(_0xd5e7('0x8'));var jayson=require(_0xd5e7('0x9'));var client=jayson[_0xd5e7('0xa')][_0xd5e7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c2a4e,_0x15d8ba,_0x188d5d){return new BPromise(function(_0x391f44,_0x4fd5df){return client[_0xd5e7('0xc')](_0x5c2a4e,_0x188d5d)[_0xd5e7('0xd')](function(_0x2ac5ba){logger[_0xd5e7('0xe')](_0xd5e7('0xf'),_0x15d8ba,_0xd5e7('0x10'));logger[_0xd5e7('0x11')](_0xd5e7('0x12'),_0x15d8ba,_0xd5e7('0x10'),JSON[_0xd5e7('0x13')](_0x2ac5ba));if(_0x2ac5ba[_0xd5e7('0x14')]){if(_0x2ac5ba[_0xd5e7('0x14')][_0xd5e7('0x15')]===0x1f4){logger[_0xd5e7('0x14')](_0xd5e7('0xf'),_0x15d8ba,_0x2ac5ba[_0xd5e7('0x14')][_0xd5e7('0x16')]);return _0x4fd5df(_0x2ac5ba[_0xd5e7('0x14')][_0xd5e7('0x16')]);}logger[_0xd5e7('0x14')](_0xd5e7('0xf'),_0x15d8ba,_0x2ac5ba[_0xd5e7('0x14')][_0xd5e7('0x16')]);return _0x391f44(_0x2ac5ba['error'][_0xd5e7('0x16')]);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x15d8ba,'request\x20sent');_0x391f44(_0x2ac5ba['result']['message']);}})['catch'](function(_0x51e4bf){logger[_0xd5e7('0x14')]('SalesforceConfiguration,\x20%s,\x20%s',_0x15d8ba,_0x51e4bf);_0x4fd5df(_0x51e4bf);});});} \ No newline at end of file +var _0xc12f=['code','message','result','lodash','util','moment','bluebird','../../config/logger','rpc','../../config/environment','client','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x30e77f,_0x4fe6d1){var _0x44b6ab=function(_0xad0a51){while(--_0xad0a51){_0x30e77f['push'](_0x30e77f['shift']());}};_0x44b6ab(++_0x4fe6d1);}(_0xc12f,0x146));var _0xfc12=function(_0x631a3c,_0x1b61b6){_0x631a3c=_0x631a3c-0x0;var _0x2bdfa3=_0xc12f[_0x631a3c];return _0x2bdfa3;};'use strict';var _=require(_0xfc12('0x0'));var util=require(_0xfc12('0x1'));var moment=require(_0xfc12('0x2'));var BPromise=require(_0xfc12('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfc12('0x4'))(_0xfc12('0x5'));var config=require(_0xfc12('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xfc12('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6f0628,_0x16a5b3,_0x271656){return new BPromise(function(_0x5a1c14,_0x7d1d1f){return client[_0xfc12('0x8')](_0x6f0628,_0x271656)[_0xfc12('0x9')](function(_0x295961){logger[_0xfc12('0xa')](_0xfc12('0xb'),_0x16a5b3,_0xfc12('0xc'));logger[_0xfc12('0xd')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x16a5b3,'request\x20sent',JSON[_0xfc12('0xe')](_0x295961));if(_0x295961[_0xfc12('0xf')]){if(_0x295961[_0xfc12('0xf')][_0xfc12('0x10')]===0x1f4){logger['error'](_0xfc12('0xb'),_0x16a5b3,_0x295961['error'][_0xfc12('0x11')]);return _0x7d1d1f(_0x295961['error'][_0xfc12('0x11')]);}logger[_0xfc12('0xf')](_0xfc12('0xb'),_0x16a5b3,_0x295961[_0xfc12('0xf')]['message']);return _0x5a1c14(_0x295961[_0xfc12('0xf')][_0xfc12('0x11')]);}else{logger[_0xfc12('0xa')](_0xfc12('0xb'),_0x16a5b3,_0xfc12('0xc'));_0x5a1c14(_0x295961[_0xfc12('0x12')]['message']);}})['catch'](function(_0x1a3fef){logger[_0xfc12('0xf')](_0xfc12('0xb'),_0x16a5b3,_0x1a3fef);_0x7d1d1f(_0x1a3fef);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index f0a1ae0..fba1ed0 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 _0x88a9=['update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','post','create'];(function(_0x3c3629,_0x233e67){var _0x40a721=function(_0x4b550b){while(--_0x4b550b){_0x3c3629['push'](_0x3c3629['shift']());}};_0x40a721(++_0x233e67);}(_0x88a9,0xa3));var _0x988a=function(_0x2a64c3,_0x1e4539){_0x2a64c3=_0x2a64c3-0x0;var _0x4a2a10=_0x88a9[_0x2a64c3];return _0x4a2a10;};'use strict';var multer=require(_0x988a('0x0'));var util=require(_0x988a('0x1'));var path=require(_0x988a('0x2'));var timeout=require(_0x988a('0x3'));var express=require(_0x988a('0x4'));var router=express[_0x988a('0x5')]();var fs_extra=require(_0x988a('0x6'));var auth=require(_0x988a('0x7'));var interaction=require(_0x988a('0x8'));var config=require(_0x988a('0x9'));var controller=require(_0x988a('0xa'));router[_0x988a('0xb')]('/',auth[_0x988a('0xc')](),controller[_0x988a('0xd')]);router[_0x988a('0xb')](_0x988a('0xe'),auth[_0x988a('0xc')](),controller['show']);router[_0x988a('0xf')]('/',auth[_0x988a('0xc')](),controller[_0x988a('0x10')]);router['put']('/:id',auth[_0x988a('0xc')](),controller[_0x988a('0x11')]);router[_0x988a('0x12')]('/:id',auth[_0x988a('0xc')](),controller['destroy']);module[_0x988a('0x13')]=router; \ No newline at end of file +var _0xdf14=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','create','put','/:id','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf14,0x12f));var _0x4df1=function(_0x5e400a,_0x41344f){_0x5e400a=_0x5e400a-0x0;var _0x4ad82a=_0xdf14[_0x5e400a];return _0x4ad82a;};'use strict';var multer=require(_0x4df1('0x0'));var util=require(_0x4df1('0x1'));var path=require('path');var timeout=require(_0x4df1('0x2'));var express=require(_0x4df1('0x3'));var router=express['Router']();var fs_extra=require(_0x4df1('0x4'));var auth=require(_0x4df1('0x5'));var interaction=require(_0x4df1('0x6'));var config=require(_0x4df1('0x7'));var controller=require('./intSalesforceField.controller');router[_0x4df1('0x8')]('/',auth[_0x4df1('0x9')](),controller[_0x4df1('0xa')]);router[_0x4df1('0x8')]('/:id',auth[_0x4df1('0x9')](),controller[_0x4df1('0xb')]);router['post']('/',auth[_0x4df1('0x9')](),controller[_0x4df1('0xc')]);router[_0x4df1('0xd')](_0x4df1('0xe'),auth[_0x4df1('0x9')](),controller['update']);router[_0x4df1('0xf')]('/:id',auth[_0x4df1('0x9')](),controller[_0x4df1('0x10')]);module[_0x4df1('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 d898ce7..99311a4 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 _0x1eb2=['ENUM','customVariable','keyValue','picklist','STRING','string','sequelize'];(function(_0x529ddb,_0x1ceb25){var _0x1efab2=function(_0x5644c2){while(--_0x5644c2){_0x529ddb['push'](_0x529ddb['shift']());}};_0x1efab2(++_0x1ceb25);}(_0x1eb2,0x1e9));var _0x21eb=function(_0x263f30,_0x314919){_0x263f30=_0x263f30-0x0;var _0x2faf1d=_0x1eb2[_0x263f30];return _0x2faf1d;};'use strict';var Sequelize=require(_0x21eb('0x0'));module['exports']={'type':{'type':Sequelize[_0x21eb('0x1')]('string','variable',_0x21eb('0x2'),_0x21eb('0x3'),_0x21eb('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x21eb('0x5')]},'key':{'type':Sequelize[_0x21eb('0x5')]},'keyType':{'type':Sequelize[_0x21eb('0x1')](_0x21eb('0x6'),'variable',_0x21eb('0x2'))},'keyContent':{'type':Sequelize[_0x21eb('0x5')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xada9=['variable','keyValue','STRING','sequelize','exports','ENUM','string'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xada9,0x10d));var _0x9ada=function(_0x1e9bf5,_0x2b8466){_0x1e9bf5=_0x1e9bf5-0x0;var _0x3e43a0=_0xada9[_0x1e9bf5];return _0x3e43a0;};'use strict';var Sequelize=require(_0x9ada('0x0'));module[_0x9ada('0x1')]={'type':{'type':Sequelize[_0x9ada('0x2')](_0x9ada('0x3'),_0x9ada('0x4'),'customVariable',_0x9ada('0x5'),'picklist'),'defaultValue':_0x9ada('0x3')},'content':{'type':Sequelize[_0x9ada('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9ada('0x2')](_0x9ada('0x3'),_0x9ada('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x9ada('0x6')]},'idField':{'type':Sequelize[_0x9ada('0x6')]},'variableName':{'type':Sequelize[_0x9ada('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 182b99e..66a01ff 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 _0x55cd=['keys','filters','intersection','attributes','fields','model','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','includeAll','findAll','show','params','length','include','find','catch','create','update','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','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','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','then','error','stack','name','send','index','map','SalesforceField','rawAttributes','type','query'];(function(_0xf8636f,_0x3f1e84){var _0x58f657=function(_0x3afaad){while(--_0x3afaad){_0xf8636f['push'](_0xf8636f['shift']());}};_0x58f657(++_0x3f1e84);}(_0x55cd,0x1e9));var _0xd55c=function(_0x27cc6b,_0x1f91df){_0x27cc6b=_0x27cc6b-0x0;var _0x195d8f=_0x55cd[_0x27cc6b];return _0x195d8f;};'use strict';var emlformat=require(_0xd55c('0x0'));var rimraf=require(_0xd55c('0x1'));var zipdir=require(_0xd55c('0x2'));var jsonpatch=require(_0xd55c('0x3'));var rp=require(_0xd55c('0x4'));var moment=require(_0xd55c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd55c('0x6'));var util=require(_0xd55c('0x7'));var path=require(_0xd55c('0x8'));var sox=require(_0xd55c('0x9'));var csv=require(_0xd55c('0xa'));var ejs=require(_0xd55c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd55c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd55c('0xd'));var deskjs=require(_0xd55c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd55c('0xf'));var Papa=require(_0xd55c('0x10'));var Redis=require(_0xd55c('0x11'));var authService=require(_0xd55c('0x12'));var qs=require(_0xd55c('0x13'));var as=require(_0xd55c('0x14'));var hardwareService=require(_0xd55c('0x15'));var logger=require(_0xd55c('0x16'))(_0xd55c('0x17'));var utils=require('../../config/utils');var config=require(_0xd55c('0x18'));var licenseUtil=require(_0xd55c('0x19'));var db=require(_0xd55c('0x1a'))['db'];function respondWithStatusCode(_0x77ccbb,_0x1a8baf){_0x1a8baf=_0x1a8baf||0xcc;return function(_0x154d2c){if(_0x154d2c){return _0x77ccbb[_0xd55c('0x1b')](_0x1a8baf);}return _0x77ccbb[_0xd55c('0x1c')](_0x1a8baf)[_0xd55c('0x1d')]();};}function respondWithResult(_0x10f34c,_0x218d5e){_0x218d5e=_0x218d5e||0xc8;return function(_0x4f341f){if(_0x4f341f){return _0x10f34c[_0xd55c('0x1c')](_0x218d5e)['json'](_0x4f341f);}};}function respondWithFilteredResult(_0x38c306,_0x3a114d){return function(_0xa3d78){if(_0xa3d78){var _0x30b19d=typeof _0x3a114d['offset']===_0xd55c('0x1e')&&typeof _0x3a114d[_0xd55c('0x1f')]===_0xd55c('0x1e');var _0x3260fb=_0xa3d78[_0xd55c('0x20')];var _0x50d409=_0x30b19d?0x0:_0x3a114d[_0xd55c('0x21')];var _0x36159e=_0x30b19d?_0xa3d78[_0xd55c('0x20')]:_0x3a114d['offset']+_0x3a114d[_0xd55c('0x1f')];var _0x5d9c03;if(_0x36159e>=_0x3260fb){_0x36159e=_0x3260fb;_0x5d9c03=0xc8;}else{_0x5d9c03=0xce;}_0x38c306[_0xd55c('0x1c')](_0x5d9c03);return _0x38c306[_0xd55c('0x22')](_0xd55c('0x23'),_0x50d409+'-'+_0x36159e+'/'+_0x3260fb)[_0xd55c('0x24')](_0xa3d78);}return null;};}function patchUpdates(_0xfe06d8){return function(_0x542f6f){try{jsonpatch[_0xd55c('0x25')](_0x542f6f,_0xfe06d8,!![]);}catch(_0x155268){return BPromise[_0xd55c('0x26')](_0x155268);}return _0x542f6f['save']();};}function saveUpdates(_0x1d5fe8,_0x1b3e77){return function(_0x1826c0){if(_0x1826c0){return _0x1826c0['update'](_0x1d5fe8)[_0xd55c('0x27')](function(_0x1204e0){return _0x1204e0;});}return null;};}function removeEntity(_0xf30354,_0xb13e83){return function(_0x427532){if(_0x427532){return _0x427532['destroy']()[_0xd55c('0x27')](function(){_0xf30354[_0xd55c('0x1c')](0xcc)[_0xd55c('0x1d')]();});}};}function handleEntityNotFound(_0x44bb48,_0x350570){return function(_0x8782b4){if(!_0x8782b4){_0x44bb48['sendStatus'](0x194);}return _0x8782b4;};}function handleError(_0x35b436,_0x3814b0){_0x3814b0=_0x3814b0||0x1f4;return function(_0x14e20b){logger[_0xd55c('0x28')](_0x14e20b[_0xd55c('0x29')]);if(_0x14e20b[_0xd55c('0x2a')]){delete _0x14e20b[_0xd55c('0x2a')];}_0x35b436[_0xd55c('0x1c')](_0x3814b0)[_0xd55c('0x2b')](_0x14e20b);};}exports[_0xd55c('0x2c')]=function(_0x6897b2,_0x2b96dc){var _0x36b545={},_0xd1f13={},_0x3709a7={'count':0x0,'rows':[]};var _0x122547=_[_0xd55c('0x2d')](db[_0xd55c('0x2e')][_0xd55c('0x2f')],function(_0x324bd6){return{'name':_0x324bd6['fieldName'],'type':_0x324bd6[_0xd55c('0x30')]['key']};});_0xd1f13['model']=_['map'](_0x122547,_0xd55c('0x2a'));_0xd1f13[_0xd55c('0x31')]=_[_0xd55c('0x32')](_0x6897b2[_0xd55c('0x31')]);_0xd1f13[_0xd55c('0x33')]=_[_0xd55c('0x34')](_0xd1f13['model'],_0xd1f13[_0xd55c('0x31')]);_0x36b545[_0xd55c('0x35')]=_[_0xd55c('0x34')](_0xd1f13['model'],qs['fields'](_0x6897b2[_0xd55c('0x31')][_0xd55c('0x36')]));_0x36b545[_0xd55c('0x35')]=_0x36b545['attributes']['length']?_0x36b545[_0xd55c('0x35')]:_0xd1f13[_0xd55c('0x37')];if(!_0x6897b2[_0xd55c('0x31')][_0xd55c('0x38')](_0xd55c('0x39'))){_0x36b545[_0xd55c('0x1f')]=qs[_0xd55c('0x1f')](_0x6897b2[_0xd55c('0x31')][_0xd55c('0x1f')]);_0x36b545['offset']=qs['offset'](_0x6897b2[_0xd55c('0x31')][_0xd55c('0x21')]);}_0x36b545[_0xd55c('0x3a')]=qs['sort'](_0x6897b2['query'][_0xd55c('0x3b')]);_0x36b545['where']=qs[_0xd55c('0x33')](_[_0xd55c('0x3c')](_0x6897b2[_0xd55c('0x31')],_0xd1f13[_0xd55c('0x33')]),_0x122547);if(_0x6897b2['query'][_0xd55c('0x3d')]){_0x36b545['where']=_[_0xd55c('0x3e')](_0x36b545[_0xd55c('0x3f')],{'$or':_[_0xd55c('0x2d')](_0x122547,function(_0xd38d9b){if(_0xd38d9b[_0xd55c('0x30')]!=='VIRTUAL'){var _0x16336d={};_0x16336d[_0xd38d9b[_0xd55c('0x2a')]]={'$like':'%'+_0x6897b2[_0xd55c('0x31')]['filter']+'%'};return _0x16336d;}})});}_0x36b545=_['merge']({},_0x36b545,_0x6897b2[_0xd55c('0x40')]);var _0x37caa0={'where':_0x36b545[_0xd55c('0x3f')]};return db['SalesforceField'][_0xd55c('0x20')](_0x37caa0)[_0xd55c('0x27')](function(_0x1456a4){_0x3709a7[_0xd55c('0x20')]=_0x1456a4;if(_0x6897b2['query'][_0xd55c('0x41')]){_0x36b545['include']=[{'all':!![]}];}return db[_0xd55c('0x2e')][_0xd55c('0x42')](_0x36b545);})[_0xd55c('0x27')](function(_0x40ec49){_0x3709a7['rows']=_0x40ec49;return _0x3709a7;})[_0xd55c('0x27')](respondWithFilteredResult(_0x2b96dc,_0x36b545))['catch'](handleError(_0x2b96dc,null));};exports[_0xd55c('0x43')]=function(_0xbf269c,_0x2395c6){var _0x13c8dd={'raw':!![],'where':{'id':_0xbf269c[_0xd55c('0x44')]['id']}},_0x1acc6c={};_0x1acc6c['model']=_['keys'](db[_0xd55c('0x2e')][_0xd55c('0x2f')]);_0x1acc6c[_0xd55c('0x31')]=_['keys'](_0xbf269c[_0xd55c('0x31')]);_0x1acc6c[_0xd55c('0x33')]=_[_0xd55c('0x34')](_0x1acc6c[_0xd55c('0x37')],_0x1acc6c[_0xd55c('0x31')]);_0x13c8dd[_0xd55c('0x35')]=_[_0xd55c('0x34')](_0x1acc6c[_0xd55c('0x37')],qs[_0xd55c('0x36')](_0xbf269c[_0xd55c('0x31')]['fields']));_0x13c8dd['attributes']=_0x13c8dd['attributes'][_0xd55c('0x45')]?_0x13c8dd[_0xd55c('0x35')]:_0x1acc6c[_0xd55c('0x37')];if(_0xbf269c[_0xd55c('0x31')]['includeAll']){_0x13c8dd[_0xd55c('0x46')]=[{'all':!![]}];}_0x13c8dd=_['merge']({},_0x13c8dd,_0xbf269c[_0xd55c('0x40')]);return db[_0xd55c('0x2e')][_0xd55c('0x47')](_0x13c8dd)[_0xd55c('0x27')](handleEntityNotFound(_0x2395c6,null))[_0xd55c('0x27')](respondWithResult(_0x2395c6,null))[_0xd55c('0x48')](handleError(_0x2395c6,null));};exports[_0xd55c('0x49')]=function(_0x14ba63,_0xa3de1){return db['SalesforceField'][_0xd55c('0x49')](_0x14ba63['body'],{})[_0xd55c('0x27')](respondWithResult(_0xa3de1,0xc9))[_0xd55c('0x48')](handleError(_0xa3de1,null));};exports[_0xd55c('0x4a')]=function(_0x21f74f,_0x32eb6b){if(_0x21f74f[_0xd55c('0x4b')]['id']){delete _0x21f74f[_0xd55c('0x4b')]['id'];}return db[_0xd55c('0x2e')][_0xd55c('0x47')]({'where':{'id':_0x21f74f[_0xd55c('0x44')]['id']}})[_0xd55c('0x27')](handleEntityNotFound(_0x32eb6b,null))[_0xd55c('0x27')](saveUpdates(_0x21f74f[_0xd55c('0x4b')],null))[_0xd55c('0x27')](respondWithResult(_0x32eb6b,null))[_0xd55c('0x48')](handleError(_0x32eb6b,null));};exports[_0xd55c('0x4c')]=function(_0x5524ca,_0x11b6b9){return db['SalesforceField']['find']({'where':{'id':_0x5524ca[_0xd55c('0x44')]['id']}})[_0xd55c('0x27')](handleEntityNotFound(_0x11b6b9,null))[_0xd55c('0x27')](removeEntity(_0x11b6b9,null))['catch'](handleError(_0x11b6b9,null));}; \ No newline at end of file +var _0x9f2f=['model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','SalesforceField','includeAll','include','findAll','params','length','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','reject','save','update','then','destroy','end','error','stack','name','index','rawAttributes','fieldName','type','key'];(function(_0x525864,_0x1bb3ea){var _0x4f9964=function(_0x5e2c0c){while(--_0x5e2c0c){_0x525864['push'](_0x525864['shift']());}};_0x4f9964(++_0x1bb3ea);}(_0x9f2f,0x18d));var _0xf9f2=function(_0xc0f31f,_0x59de1b){_0xc0f31f=_0xc0f31f-0x0;var _0x4541b6=_0x9f2f[_0xc0f31f];return _0x4541b6;};'use strict';var emlformat=require(_0xf9f2('0x0'));var rimraf=require(_0xf9f2('0x1'));var zipdir=require(_0xf9f2('0x2'));var jsonpatch=require(_0xf9f2('0x3'));var rp=require(_0xf9f2('0x4'));var moment=require(_0xf9f2('0x5'));var BPromise=require(_0xf9f2('0x6'));var Mustache=require(_0xf9f2('0x7'));var util=require(_0xf9f2('0x8'));var path=require('path');var sox=require(_0xf9f2('0x9'));var csv=require(_0xf9f2('0xa'));var ejs=require(_0xf9f2('0xb'));var fs=require('fs');var fs_extra=require(_0xf9f2('0xc'));var _=require(_0xf9f2('0xd'));var squel=require(_0xf9f2('0xe'));var crypto=require(_0xf9f2('0xf'));var jsforce=require(_0xf9f2('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xf9f2('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf9f2('0x11'));var authService=require(_0xf9f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf9f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf9f2('0x14'))(_0xf9f2('0x15'));var utils=require(_0xf9f2('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf9f2('0x17'));var db=require(_0xf9f2('0x18'))['db'];function respondWithStatusCode(_0x215c00,_0x356fa9){_0x356fa9=_0x356fa9||0xcc;return function(_0x470ef6){if(_0x470ef6){return _0x215c00[_0xf9f2('0x19')](_0x356fa9);}return _0x215c00[_0xf9f2('0x1a')](_0x356fa9)['end']();};}function respondWithResult(_0x575ec5,_0x42575){_0x42575=_0x42575||0xc8;return function(_0x3b0297){if(_0x3b0297){return _0x575ec5[_0xf9f2('0x1a')](_0x42575)[_0xf9f2('0x1b')](_0x3b0297);}};}function respondWithFilteredResult(_0x284d4c,_0x4e2370){return function(_0x1f02a9){if(_0x1f02a9){var _0x17e56a=typeof _0x4e2370['offset']===_0xf9f2('0x1c')&&typeof _0x4e2370[_0xf9f2('0x1d')]===_0xf9f2('0x1c');var _0x599a97=_0x1f02a9[_0xf9f2('0x1e')];var _0x4ce451=_0x17e56a?0x0:_0x4e2370[_0xf9f2('0x1f')];var _0x2b4bce=_0x17e56a?_0x1f02a9['count']:_0x4e2370[_0xf9f2('0x1f')]+_0x4e2370[_0xf9f2('0x1d')];var _0xe3d934;if(_0x2b4bce>=_0x599a97){_0x2b4bce=_0x599a97;_0xe3d934=0xc8;}else{_0xe3d934=0xce;}_0x284d4c[_0xf9f2('0x1a')](_0xe3d934);return _0x284d4c[_0xf9f2('0x20')]('Content-Range',_0x4ce451+'-'+_0x2b4bce+'/'+_0x599a97)[_0xf9f2('0x1b')](_0x1f02a9);}return null;};}function patchUpdates(_0x31b4e6){return function(_0x36c259){try{jsonpatch['apply'](_0x36c259,_0x31b4e6,!![]);}catch(_0x4c66be){return BPromise[_0xf9f2('0x21')](_0x4c66be);}return _0x36c259[_0xf9f2('0x22')]();};}function saveUpdates(_0x4b4bbe,_0x890cbc){return function(_0x553b37){if(_0x553b37){return _0x553b37[_0xf9f2('0x23')](_0x4b4bbe)[_0xf9f2('0x24')](function(_0x469097){return _0x469097;});}return null;};}function removeEntity(_0x1cf27d,_0x23fc96){return function(_0x35d426){if(_0x35d426){return _0x35d426[_0xf9f2('0x25')]()[_0xf9f2('0x24')](function(){_0x1cf27d['status'](0xcc)[_0xf9f2('0x26')]();});}};}function handleEntityNotFound(_0x1edc81,_0x10be6a){return function(_0x370661){if(!_0x370661){_0x1edc81[_0xf9f2('0x19')](0x194);}return _0x370661;};}function handleError(_0x5091c7,_0x9f31eb){_0x9f31eb=_0x9f31eb||0x1f4;return function(_0x2a08fe){logger[_0xf9f2('0x27')](_0x2a08fe[_0xf9f2('0x28')]);if(_0x2a08fe['name']){delete _0x2a08fe[_0xf9f2('0x29')];}_0x5091c7['status'](_0x9f31eb)['send'](_0x2a08fe);};}exports[_0xf9f2('0x2a')]=function(_0xd82897,_0x5a2b1e){var _0xc3fcb6={},_0x3808e6={},_0x5ca37b={'count':0x0,'rows':[]};var _0x2aa006=_['map'](db['SalesforceField'][_0xf9f2('0x2b')],function(_0x1464f5){return{'name':_0x1464f5[_0xf9f2('0x2c')],'type':_0x1464f5[_0xf9f2('0x2d')][_0xf9f2('0x2e')]};});_0x3808e6[_0xf9f2('0x2f')]=_[_0xf9f2('0x30')](_0x2aa006,'name');_0x3808e6[_0xf9f2('0x31')]=_[_0xf9f2('0x32')](_0xd82897[_0xf9f2('0x31')]);_0x3808e6[_0xf9f2('0x33')]=_[_0xf9f2('0x34')](_0x3808e6[_0xf9f2('0x2f')],_0x3808e6[_0xf9f2('0x31')]);_0xc3fcb6[_0xf9f2('0x35')]=_[_0xf9f2('0x34')](_0x3808e6[_0xf9f2('0x2f')],qs[_0xf9f2('0x36')](_0xd82897[_0xf9f2('0x31')][_0xf9f2('0x36')]));_0xc3fcb6[_0xf9f2('0x35')]=_0xc3fcb6['attributes']['length']?_0xc3fcb6[_0xf9f2('0x35')]:_0x3808e6[_0xf9f2('0x2f')];if(!_0xd82897[_0xf9f2('0x31')][_0xf9f2('0x37')](_0xf9f2('0x38'))){_0xc3fcb6[_0xf9f2('0x1d')]=qs[_0xf9f2('0x1d')](_0xd82897[_0xf9f2('0x31')][_0xf9f2('0x1d')]);_0xc3fcb6[_0xf9f2('0x1f')]=qs[_0xf9f2('0x1f')](_0xd82897[_0xf9f2('0x31')][_0xf9f2('0x1f')]);}_0xc3fcb6[_0xf9f2('0x39')]=qs[_0xf9f2('0x3a')](_0xd82897[_0xf9f2('0x31')]['sort']);_0xc3fcb6['where']=qs['filters'](_['pick'](_0xd82897['query'],_0x3808e6[_0xf9f2('0x33')]),_0x2aa006);if(_0xd82897[_0xf9f2('0x31')][_0xf9f2('0x3b')]){_0xc3fcb6['where']=_[_0xf9f2('0x3c')](_0xc3fcb6[_0xf9f2('0x3d')],{'$or':_[_0xf9f2('0x30')](_0x2aa006,function(_0xac093d){if(_0xac093d[_0xf9f2('0x2d')]!==_0xf9f2('0x3e')){var _0x1ea49b={};_0x1ea49b[_0xac093d[_0xf9f2('0x29')]]={'$like':'%'+_0xd82897[_0xf9f2('0x31')][_0xf9f2('0x3b')]+'%'};return _0x1ea49b;}})});}_0xc3fcb6=_[_0xf9f2('0x3c')]({},_0xc3fcb6,_0xd82897[_0xf9f2('0x3f')]);var _0x5a2492={'where':_0xc3fcb6['where']};return db[_0xf9f2('0x40')]['count'](_0x5a2492)[_0xf9f2('0x24')](function(_0x216f6e){_0x5ca37b[_0xf9f2('0x1e')]=_0x216f6e;if(_0xd82897[_0xf9f2('0x31')][_0xf9f2('0x41')]){_0xc3fcb6[_0xf9f2('0x42')]=[{'all':!![]}];}return db[_0xf9f2('0x40')][_0xf9f2('0x43')](_0xc3fcb6);})[_0xf9f2('0x24')](function(_0xdd9d4d){_0x5ca37b['rows']=_0xdd9d4d;return _0x5ca37b;})[_0xf9f2('0x24')](respondWithFilteredResult(_0x5a2b1e,_0xc3fcb6))['catch'](handleError(_0x5a2b1e,null));};exports['show']=function(_0x563722,_0x5401fc){var _0x4aa9ef={'raw':!![],'where':{'id':_0x563722[_0xf9f2('0x44')]['id']}},_0x568060={};_0x568060['model']=_['keys'](db['SalesforceField'][_0xf9f2('0x2b')]);_0x568060[_0xf9f2('0x31')]=_['keys'](_0x563722['query']);_0x568060[_0xf9f2('0x33')]=_[_0xf9f2('0x34')](_0x568060[_0xf9f2('0x2f')],_0x568060[_0xf9f2('0x31')]);_0x4aa9ef[_0xf9f2('0x35')]=_['intersection'](_0x568060[_0xf9f2('0x2f')],qs[_0xf9f2('0x36')](_0x563722['query'][_0xf9f2('0x36')]));_0x4aa9ef[_0xf9f2('0x35')]=_0x4aa9ef[_0xf9f2('0x35')][_0xf9f2('0x45')]?_0x4aa9ef[_0xf9f2('0x35')]:_0x568060['model'];if(_0x563722[_0xf9f2('0x31')][_0xf9f2('0x41')]){_0x4aa9ef[_0xf9f2('0x42')]=[{'all':!![]}];}_0x4aa9ef=_['merge']({},_0x4aa9ef,_0x563722[_0xf9f2('0x3f')]);return db[_0xf9f2('0x40')][_0xf9f2('0x46')](_0x4aa9ef)['then'](handleEntityNotFound(_0x5401fc,null))['then'](respondWithResult(_0x5401fc,null))[_0xf9f2('0x47')](handleError(_0x5401fc,null));};exports[_0xf9f2('0x48')]=function(_0x4f7c3a,_0x2db08b){return db['SalesforceField'][_0xf9f2('0x48')](_0x4f7c3a['body'],{})[_0xf9f2('0x24')](respondWithResult(_0x2db08b,0xc9))[_0xf9f2('0x47')](handleError(_0x2db08b,null));};exports[_0xf9f2('0x23')]=function(_0x5c9eb9,_0x5be125){if(_0x5c9eb9['body']['id']){delete _0x5c9eb9[_0xf9f2('0x49')]['id'];}return db[_0xf9f2('0x40')]['find']({'where':{'id':_0x5c9eb9['params']['id']}})[_0xf9f2('0x24')](handleEntityNotFound(_0x5be125,null))['then'](saveUpdates(_0x5c9eb9[_0xf9f2('0x49')],null))[_0xf9f2('0x24')](respondWithResult(_0x5be125,null))['catch'](handleError(_0x5be125,null));};exports['destroy']=function(_0x5ba5d9,_0x29973c){return db['SalesforceField'][_0xf9f2('0x46')]({'where':{'id':_0x5ba5d9[_0xf9f2('0x44')]['id']}})['then'](handleEntityNotFound(_0x29973c,null))[_0xf9f2('0x24')](removeEntity(_0x29973c,null))['catch'](handleError(_0x29973c,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 4c2be34..acfe0d0 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 _0x81d3=['./intSalesforceField.attributes','define','SalesforceField','salesforce_unique_index','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x5293cd,_0x1a921f){var _0x21be20=function(_0x5c05b9){while(--_0x5c05b9){_0x5293cd['push'](_0x5293cd['shift']());}};_0x21be20(++_0x1a921f);}(_0x81d3,0x178));var _0x381d=function(_0x390f54,_0x177b82){_0x390f54=_0x390f54-0x0;var _0x342546=_0x81d3[_0x390f54];return _0x342546;};'use strict';var _=require(_0x381d('0x0'));var util=require(_0x381d('0x1'));var logger=require('../../config/logger')(_0x381d('0x2'));var moment=require(_0x381d('0x3'));var BPromise=require('bluebird');var rp=require(_0x381d('0x4'));var fs=require('fs');var path=require(_0x381d('0x5'));var rimraf=require(_0x381d('0x6'));var config=require(_0x381d('0x7'));var attributes=require(_0x381d('0x8'));module['exports']=function(_0x2bea6d,_0x173a95){return _0x2bea6d[_0x381d('0x9')](_0x381d('0xa'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x381d('0xb'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x120e=['bluebird','request-promise','rimraf','../../config/environment','./intSalesforceField.attributes','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x195588,_0xacd327){var _0x5232f0=function(_0x571fe9){while(--_0x571fe9){_0x195588['push'](_0x195588['shift']());}};_0x5232f0(++_0xacd327);}(_0x120e,0x1eb));var _0xe120=function(_0x5dcab4,_0x358a12){_0x5dcab4=_0x5dcab4-0x0;var _0x5b571b=_0x120e[_0x5dcab4];return _0x5b571b;};'use strict';var _=require(_0xe120('0x0'));var util=require(_0xe120('0x1'));var logger=require(_0xe120('0x2'))(_0xe120('0x3'));var moment=require(_0xe120('0x4'));var BPromise=require(_0xe120('0x5'));var rp=require(_0xe120('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe120('0x7'));var config=require(_0xe120('0x8'));var attributes=require(_0xe120('0x9'));module['exports']=function(_0x1099fc,_0x302d4a){return _0x1099fc[_0xe120('0xa')](_0xe120('0xb'),attributes,{'tableName':_0xe120('0xc'),'paranoid':![],'indexes':[{'name':_0xe120('0xd'),'fields':[_0xe120('0xe'),_0xe120('0xf')],'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 5bd579b..c8c2cbb 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 _0xe481=['jayson/promise','client','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe481,0x8a));var _0x1e48=function(_0x478489,_0x3cdf57){_0x478489=_0x478489-0x0;var _0x544211=_0xe481[_0x478489];return _0x544211;};'use strict';var _=require(_0x1e48('0x0'));var util=require('util');var moment=require(_0x1e48('0x1'));var BPromise=require(_0x1e48('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1e48('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1e48('0x4'))(_0x1e48('0x5'));var config=require('../../config/environment');var jayson=require(_0x1e48('0x6'));var client=jayson[_0x1e48('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14b840,_0x58275e,_0x2c2d2c){return new BPromise(function(_0x16d187,_0x6f26aa){return client['request'](_0x14b840,_0x2c2d2c)['then'](function(_0x30eb68){logger['info'](_0x1e48('0x8'),_0x58275e,'request\x20sent');logger[_0x1e48('0x9')](_0x1e48('0xa'),_0x58275e,_0x1e48('0xb'),JSON[_0x1e48('0xc')](_0x30eb68));if(_0x30eb68[_0x1e48('0xd')]){if(_0x30eb68[_0x1e48('0xd')]['code']===0x1f4){logger[_0x1e48('0xd')]('SalesforceField,\x20%s,\x20%s',_0x58275e,_0x30eb68['error']['message']);return _0x6f26aa(_0x30eb68[_0x1e48('0xd')][_0x1e48('0xe')]);}logger[_0x1e48('0xd')](_0x1e48('0x8'),_0x58275e,_0x30eb68[_0x1e48('0xd')][_0x1e48('0xe')]);return _0x16d187(_0x30eb68[_0x1e48('0xd')]['message']);}else{logger['info'](_0x1e48('0x8'),_0x58275e,_0x1e48('0xb'));_0x16d187(_0x30eb68[_0x1e48('0xf')]['message']);}})['catch'](function(_0x4e8ec8){logger[_0x1e48('0xd')]('SalesforceField,\x20%s,\x20%s',_0x58275e,_0x4e8ec8);_0x6f26aa(_0x4e8ec8);});});} \ No newline at end of file +var _0xa16b=['SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa16b,0x1d3));var _0xba16=function(_0xcb6e3c,_0x59a4f2){_0xcb6e3c=_0xcb6e3c-0x0;var _0x2bf7a6=_0xa16b[_0xcb6e3c];return _0x2bf7a6;};'use strict';var _=require(_0xba16('0x0'));var util=require(_0xba16('0x1'));var moment=require(_0xba16('0x2'));var BPromise=require('bluebird');var rs=require(_0xba16('0x3'));var fs=require('fs');var Redis=require(_0xba16('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xba16('0x5'));var logger=require(_0xba16('0x6'))(_0xba16('0x7'));var config=require(_0xba16('0x8'));var jayson=require(_0xba16('0x9'));var client=jayson[_0xba16('0xa')][_0xba16('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x153043,_0x26e673,_0x53d5d4){return new BPromise(function(_0x2a8188,_0x5c1fe9){return client['request'](_0x153043,_0x53d5d4)[_0xba16('0xc')](function(_0x38271d){logger[_0xba16('0xd')](_0xba16('0xe'),_0x26e673,_0xba16('0xf'));logger['debug'](_0xba16('0x10'),_0x26e673,_0xba16('0xf'),JSON[_0xba16('0x11')](_0x38271d));if(_0x38271d[_0xba16('0x12')]){if(_0x38271d['error'][_0xba16('0x13')]===0x1f4){logger['error'](_0xba16('0xe'),_0x26e673,_0x38271d[_0xba16('0x12')]['message']);return _0x5c1fe9(_0x38271d[_0xba16('0x12')][_0xba16('0x14')]);}logger[_0xba16('0x12')](_0xba16('0xe'),_0x26e673,_0x38271d[_0xba16('0x12')][_0xba16('0x14')]);return _0x2a8188(_0x38271d['error'][_0xba16('0x14')]);}else{logger[_0xba16('0xd')](_0xba16('0xe'),_0x26e673,_0xba16('0xf'));_0x2a8188(_0x38271d[_0xba16('0x15')][_0xba16('0x14')]);}})[_0xba16('0x16')](function(_0x1f1dc6){logger['error']('SalesforceField,\x20%s,\x20%s',_0x26e673,_0x1f1dc6);_0x5c1fe9(_0x1f1dc6);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 8f702b8..052c5c5 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 _0x8ff9=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','get','/:id','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','delete','destroy','multer','util','path','express'];(function(_0x5289a9,_0x3346fa){var _0x2407d5=function(_0x13d7fe){while(--_0x13d7fe){_0x5289a9['push'](_0x5289a9['shift']());}};_0x2407d5(++_0x3346fa);}(_0x8ff9,0x188));var _0x98ff=function(_0x4473f6,_0x39a797){_0x4473f6=_0x4473f6-0x0;var _0x7db87e=_0x8ff9[_0x4473f6];return _0x7db87e;};'use strict';var multer=require(_0x98ff('0x0'));var util=require(_0x98ff('0x1'));var path=require(_0x98ff('0x2'));var timeout=require('connect-timeout');var express=require(_0x98ff('0x3'));var router=express[_0x98ff('0x4')]();var fs_extra=require(_0x98ff('0x5'));var auth=require(_0x98ff('0x6'));var interaction=require(_0x98ff('0x7'));var config=require(_0x98ff('0x8'));var controller=require(_0x98ff('0x9'));router['get']('/',auth[_0x98ff('0xa')](),controller['index']);router[_0x98ff('0xb')](_0x98ff('0xc'),auth['isAuthenticated'](),controller[_0x98ff('0xd')]);router[_0x98ff('0xb')](_0x98ff('0xe'),auth[_0x98ff('0xa')](),controller[_0x98ff('0xf')]);router[_0x98ff('0xb')]('/:id/fields',auth[_0x98ff('0xa')](),controller[_0x98ff('0x10')]);router[_0x98ff('0x11')]('/',auth[_0x98ff('0xa')](),controller['create']);router[_0x98ff('0x11')](_0x98ff('0xe'),auth[_0x98ff('0xa')](),controller[_0x98ff('0x12')]);router[_0x98ff('0x13')](_0x98ff('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x98ff('0x14')]('/:id',auth[_0x98ff('0xa')](),controller[_0x98ff('0x15')]);module['exports']=router; \ No newline at end of file +var _0xc2fe=['path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','getFields','post','update','delete','exports','multer','util'];(function(_0x273d59,_0x197997){var _0x3924e7=function(_0x552e34){while(--_0x552e34){_0x273d59['push'](_0x273d59['shift']());}};_0x3924e7(++_0x197997);}(_0xc2fe,0x1d9));var _0xec2f=function(_0x5dc2b2,_0xcd59e1){_0x5dc2b2=_0x5dc2b2-0x0;var _0x1cae92=_0xc2fe[_0x5dc2b2];return _0x1cae92;};'use strict';var multer=require(_0xec2f('0x0'));var util=require(_0xec2f('0x1'));var path=require(_0xec2f('0x2'));var timeout=require(_0xec2f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xec2f('0x4'));var auth=require(_0xec2f('0x5'));var interaction=require(_0xec2f('0x6'));var config=require('../../config/environment');var controller=require(_0xec2f('0x7'));router[_0xec2f('0x8')]('/',auth[_0xec2f('0x9')](),controller[_0xec2f('0xa')]);router['get'](_0xec2f('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xec2f('0x8')]('/:id/configurations',auth[_0xec2f('0x9')](),controller[_0xec2f('0xc')]);router[_0xec2f('0x8')](_0xec2f('0xd'),auth[_0xec2f('0x9')](),controller[_0xec2f('0xe')]);router[_0xec2f('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xec2f('0xf')]('/:id/configurations',auth[_0xec2f('0x9')](),controller['addConfiguration']);router['put'](_0xec2f('0xb'),auth[_0xec2f('0x9')](),controller[_0xec2f('0x10')]);router[_0xec2f('0x11')]('/:id',auth[_0xec2f('0x9')](),controller['destroy']);module[_0xec2f('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 3df3df9..347cc39 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 _0xb58b=['sequelize','exports','STRING','username','remoteUri'];(function(_0x398e44,_0x1b273c){var _0x27583c=function(_0x95bb80){while(--_0x95bb80){_0x398e44['push'](_0x398e44['shift']());}};_0x27583c(++_0x1b273c);}(_0xb58b,0x19a));var _0xbb58=function(_0xb2b3ae,_0x5f186d){_0xb2b3ae=_0xb2b3ae-0x0;var _0x2e18a3=_0xb58b[_0xb2b3ae];return _0x2e18a3;};'use strict';var Sequelize=require(_0xbb58('0x0'));module[_0xbb58('0x1')]={'name':{'type':Sequelize[_0xbb58('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xbb58('0x2')],'unique':_0xbb58('0x3')},'password':{'type':Sequelize[_0xbb58('0x2')]},'email':{'type':Sequelize[_0xbb58('0x2')]},'remoteUri':{'type':Sequelize[_0xbb58('0x2')],'unique':_0xbb58('0x4')},'serverUrl':{'type':Sequelize[_0xbb58('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x6b8b=['remoteUri','sequelize','STRING','username'];(function(_0x59659b,_0x38a9a7){var _0x5db166=function(_0x2f6c4c){while(--_0x2f6c4c){_0x59659b['push'](_0x59659b['shift']());}};_0x5db166(++_0x38a9a7);}(_0x6b8b,0x191));var _0xb6b8=function(_0x44fdef,_0x529ea6){_0x44fdef=_0x44fdef-0x0;var _0x125f32=_0x6b8b[_0x44fdef];return _0x125f32;};'use strict';var Sequelize=require(_0xb6b8('0x0'));module['exports']={'name':{'type':Sequelize[_0xb6b8('0x1')]},'description':{'type':Sequelize[_0xb6b8('0x1')]},'username':{'type':Sequelize[_0xb6b8('0x1')],'unique':_0xb6b8('0x2')},'password':{'type':Sequelize[_0xb6b8('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xb6b8('0x1')],'unique':_0xb6b8('0x3')},'serverUrl':{'type':Sequelize[_0xb6b8('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 1b146c1..e0c09ec 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 _0xf651=['correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','notify','close_notes','closed_by','follow_up','parent_incident','contact_type','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','approval','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','category','username','password','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','all','log','TCL:\x20_object','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','ServicenowAccount','includeAll','findAll','catch','show','params','rawAttributes','include','options','find','create','update','body','getConfigurations','findOne','ServicenowConfiguration','nolimit','Subjects','getSubjects','channel','Descriptions','ServicenowField','getFields','made_sla','hold_reason','close_code','incident_state','severity','parent','upon_reject','child_incidents','approval_history','number','resolved_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','knowledge','calendar_stc','closed_at','delivery_plan','impact','priority','sys_domain_path','rfc','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','subcategory','short_description'];(function(_0x5a2f3a,_0x4de4f2){var _0xa430f=function(_0x385508){while(--_0x385508){_0x5a2f3a['push'](_0x5a2f3a['shift']());}};_0xa430f(++_0x4de4f2);}(_0xf651,0xf7));var _0x1f65=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xf651[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1f65('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1f65('0x1'));var rp=require(_0x1f65('0x2'));var moment=require(_0x1f65('0x3'));var BPromise=require(_0x1f65('0x4'));var Mustache=require('mustache');var util=require(_0x1f65('0x5'));var path=require(_0x1f65('0x6'));var sox=require(_0x1f65('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1f65('0x8'));var _=require('lodash');var squel=require(_0x1f65('0x9'));var crypto=require(_0x1f65('0xa'));var jsforce=require(_0x1f65('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1f65('0xc'));var Papa=require(_0x1f65('0xd'));var Redis=require(_0x1f65('0xe'));var authService=require(_0x1f65('0xf'));var qs=require(_0x1f65('0x10'));var as=require(_0x1f65('0x11'));var hardwareService=require(_0x1f65('0x12'));var logger=require(_0x1f65('0x13'))('api');var utils=require(_0x1f65('0x14'));var config=require(_0x1f65('0x15'));var licenseUtil=require(_0x1f65('0x16'));var db=require(_0x1f65('0x17'))['db'];var integrations=require(_0x1f65('0x18'));function respondWithStatusCode(_0x3faab9,_0x9f46db){_0x9f46db=_0x9f46db||0xcc;return function(_0x3c125c){if(_0x3c125c){return _0x3faab9[_0x1f65('0x19')](_0x9f46db);}return _0x3faab9[_0x1f65('0x1a')](_0x9f46db)[_0x1f65('0x1b')]();};}function respondWithResult(_0x512cad,_0x4c7543){_0x4c7543=_0x4c7543||0xc8;return function(_0x3c6946){if(_0x3c6946){return _0x512cad[_0x1f65('0x1a')](_0x4c7543)[_0x1f65('0x1c')](_0x3c6946);}};}function respondWithFilteredResult(_0x19185f,_0x3e27a3){return function(_0x468922){if(_0x468922){var _0x3a3d45=typeof _0x3e27a3['offset']==='undefined'&&typeof _0x3e27a3['limit']===_0x1f65('0x1d');var _0x4e9c09=_0x468922[_0x1f65('0x1e')];var _0x1ceb1d=_0x3a3d45?0x0:_0x3e27a3[_0x1f65('0x1f')];var _0x1da44b=_0x3a3d45?_0x468922[_0x1f65('0x1e')]:_0x3e27a3[_0x1f65('0x1f')]+_0x3e27a3[_0x1f65('0x20')];var _0x154b6e;if(_0x1da44b>=_0x4e9c09){_0x1da44b=_0x4e9c09;_0x154b6e=0xc8;}else{_0x154b6e=0xce;}_0x19185f[_0x1f65('0x1a')](_0x154b6e);return _0x19185f[_0x1f65('0x21')](_0x1f65('0x22'),_0x1ceb1d+'-'+_0x1da44b+'/'+_0x4e9c09)[_0x1f65('0x1c')](_0x468922);}return null;};}function patchUpdates(_0x2f5923){return function(_0x5e4b90){try{jsonpatch[_0x1f65('0x23')](_0x5e4b90,_0x2f5923,!![]);}catch(_0x439fc9){return BPromise[_0x1f65('0x24')](_0x439fc9);}return _0x5e4b90['save']();};}function saveUpdates(_0x24b1cc,_0x1b1d55){return function(_0x4a559c){if(_0x4a559c){return _0x4a559c['update'](_0x24b1cc)[_0x1f65('0x25')](function(_0x4d439b){return _0x4d439b;});}return null;};}function removeEntity(_0x26b585,_0x51cee6){return function(_0x31cdf4){if(_0x31cdf4){return _0x31cdf4[_0x1f65('0x26')]()[_0x1f65('0x25')](function(){_0x26b585[_0x1f65('0x1a')](0xcc)[_0x1f65('0x1b')]();});}};}function handleEntityNotFound(_0x27adce,_0x518ed8){return function(_0x3f8517){if(!_0x3f8517){_0x27adce[_0x1f65('0x19')](0x194);}return _0x3f8517;};}function handleError(_0x52a860,_0x2f7d00){_0x2f7d00=_0x2f7d00||0x1f4;return function(_0x2df21b){logger[_0x1f65('0x27')](_0x2df21b[_0x1f65('0x28')]);if(_0x2df21b[_0x1f65('0x29')]){delete _0x2df21b[_0x1f65('0x29')];}_0x52a860[_0x1f65('0x1a')](_0x2f7d00)[_0x1f65('0x2a')](_0x2df21b);};}exports[_0x1f65('0x2b')]=function(_0x181218,_0x146147){var _0x1baaf4={},_0x11c105={},_0x28abb0={'count':0x0,'rows':[]};var _0x48f020=_[_0x1f65('0x2c')](db['ServicenowAccount']['rawAttributes'],function(_0x42f298){return{'name':_0x42f298['fieldName'],'type':_0x42f298[_0x1f65('0x2d')][_0x1f65('0x2e')]};});_0x11c105['model']=_['map'](_0x48f020,_0x1f65('0x29'));_0x11c105[_0x1f65('0x2f')]=_[_0x1f65('0x30')](_0x181218[_0x1f65('0x2f')]);_0x11c105[_0x1f65('0x31')]=_[_0x1f65('0x32')](_0x11c105[_0x1f65('0x33')],_0x11c105[_0x1f65('0x2f')]);_0x1baaf4[_0x1f65('0x34')]=_[_0x1f65('0x32')](_0x11c105['model'],qs[_0x1f65('0x35')](_0x181218[_0x1f65('0x2f')][_0x1f65('0x35')]));_0x1baaf4[_0x1f65('0x34')]=_0x1baaf4[_0x1f65('0x34')][_0x1f65('0x36')]?_0x1baaf4[_0x1f65('0x34')]:_0x11c105[_0x1f65('0x33')];if(!_0x181218[_0x1f65('0x2f')][_0x1f65('0x37')]('nolimit')){_0x1baaf4[_0x1f65('0x20')]=qs['limit'](_0x181218[_0x1f65('0x2f')][_0x1f65('0x20')]);_0x1baaf4[_0x1f65('0x1f')]=qs[_0x1f65('0x1f')](_0x181218[_0x1f65('0x2f')][_0x1f65('0x1f')]);}_0x1baaf4[_0x1f65('0x38')]=qs[_0x1f65('0x39')](_0x181218['query'][_0x1f65('0x39')]);_0x1baaf4[_0x1f65('0x3a')]=qs[_0x1f65('0x31')](_[_0x1f65('0x3b')](_0x181218['query'],_0x11c105[_0x1f65('0x31')]),_0x48f020);if(_0x181218[_0x1f65('0x2f')]['filter']){_0x1baaf4['where']=_[_0x1f65('0x3c')](_0x1baaf4['where'],{'$or':_[_0x1f65('0x2c')](_0x48f020,function(_0x220044){if(_0x220044[_0x1f65('0x2d')]!=='VIRTUAL'){var _0x1da49a={};_0x1da49a[_0x220044[_0x1f65('0x29')]]={'$like':'%'+_0x181218[_0x1f65('0x2f')][_0x1f65('0x3d')]+'%'};return _0x1da49a;}})});}_0x1baaf4=_[_0x1f65('0x3c')]({},_0x1baaf4,_0x181218['options']);var _0x1895b9={'where':_0x1baaf4[_0x1f65('0x3a')]};return db[_0x1f65('0x3e')]['count'](_0x1895b9)['then'](function(_0x1ba113){_0x28abb0[_0x1f65('0x1e')]=_0x1ba113;if(_0x181218['query'][_0x1f65('0x3f')]){_0x1baaf4['include']=[{'all':!![]}];}return db[_0x1f65('0x3e')][_0x1f65('0x40')](_0x1baaf4);})[_0x1f65('0x25')](function(_0x268a15){_0x28abb0['rows']=_0x268a15;return _0x28abb0;})['then'](respondWithFilteredResult(_0x146147,_0x1baaf4))[_0x1f65('0x41')](handleError(_0x146147,null));};exports[_0x1f65('0x42')]=function(_0x4f24f9,_0x321140){var _0x1599b6={'raw':![],'where':{'id':_0x4f24f9[_0x1f65('0x43')]['id']}},_0x524225={};_0x524225[_0x1f65('0x33')]=_[_0x1f65('0x30')](db[_0x1f65('0x3e')][_0x1f65('0x44')]);_0x524225[_0x1f65('0x2f')]=_['keys'](_0x4f24f9['query']);_0x524225[_0x1f65('0x31')]=_['intersection'](_0x524225[_0x1f65('0x33')],_0x524225[_0x1f65('0x2f')]);_0x1599b6[_0x1f65('0x34')]=_[_0x1f65('0x32')](_0x524225[_0x1f65('0x33')],qs[_0x1f65('0x35')](_0x4f24f9[_0x1f65('0x2f')]['fields']));_0x1599b6[_0x1f65('0x34')]=_0x1599b6['attributes']['length']?_0x1599b6[_0x1f65('0x34')]:_0x524225[_0x1f65('0x33')];if(_0x4f24f9[_0x1f65('0x2f')][_0x1f65('0x3f')]){_0x1599b6[_0x1f65('0x45')]=[{'all':!![]}];}_0x1599b6=_[_0x1f65('0x3c')]({},_0x1599b6,_0x4f24f9[_0x1f65('0x46')]);return db[_0x1f65('0x3e')][_0x1f65('0x47')](_0x1599b6)['then'](handleEntityNotFound(_0x321140,null))[_0x1f65('0x25')](respondWithResult(_0x321140,null))[_0x1f65('0x41')](handleError(_0x321140,null));};exports[_0x1f65('0x48')]=function(_0x2fca19,_0x39ac82){return db[_0x1f65('0x3e')][_0x1f65('0x48')](_0x2fca19['body'],{})['then'](respondWithResult(_0x39ac82,0xc9))['catch'](handleError(_0x39ac82,null));};exports[_0x1f65('0x49')]=function(_0x4028d6,_0x532b0a){if(_0x4028d6[_0x1f65('0x4a')]['id']){delete _0x4028d6[_0x1f65('0x4a')]['id'];}return db[_0x1f65('0x3e')]['find']({'where':{'id':_0x4028d6[_0x1f65('0x43')]['id']}})[_0x1f65('0x25')](handleEntityNotFound(_0x532b0a,null))[_0x1f65('0x25')](saveUpdates(_0x4028d6[_0x1f65('0x4a')],null))['then'](respondWithResult(_0x532b0a,null))['catch'](handleError(_0x532b0a,null));};exports[_0x1f65('0x26')]=function(_0x5441b6,_0x1c50eb){return db[_0x1f65('0x3e')]['find']({'where':{'id':_0x5441b6[_0x1f65('0x43')]['id']}})[_0x1f65('0x25')](handleEntityNotFound(_0x1c50eb,null))['then'](removeEntity(_0x1c50eb,null))[_0x1f65('0x41')](handleError(_0x1c50eb,null));};exports[_0x1f65('0x4b')]=function(_0x394c3e,_0x56c900,_0x3a557b){var _0x20ce04={};var _0x1276ca={};var _0x399e2a;var _0x5ada95;return db[_0x1f65('0x3e')][_0x1f65('0x4c')]({'where':{'id':_0x394c3e[_0x1f65('0x43')]['id']}})[_0x1f65('0x25')](handleEntityNotFound(_0x56c900,null))[_0x1f65('0x25')](function(_0x57451d){if(_0x57451d){_0x399e2a=_0x57451d;_0x1276ca['model']=_[_0x1f65('0x30')](db[_0x1f65('0x4d')][_0x1f65('0x44')]);_0x1276ca['query']=_[_0x1f65('0x30')](_0x394c3e[_0x1f65('0x2f')]);_0x1276ca['filters']=_[_0x1f65('0x32')](_0x1276ca[_0x1f65('0x33')],_0x1276ca[_0x1f65('0x2f')]);_0x20ce04[_0x1f65('0x34')]=_['intersection'](_0x1276ca['model'],qs[_0x1f65('0x35')](_0x394c3e['query']['fields']));_0x20ce04['attributes']=_0x20ce04[_0x1f65('0x34')][_0x1f65('0x36')]?_0x20ce04[_0x1f65('0x34')]:_0x1276ca['model'];_0x20ce04[_0x1f65('0x38')]=qs[_0x1f65('0x39')](_0x394c3e['query'][_0x1f65('0x39')]);_0x20ce04['where']=qs[_0x1f65('0x31')](_[_0x1f65('0x3b')](_0x394c3e[_0x1f65('0x2f')],_0x1276ca[_0x1f65('0x31')]));if(_0x394c3e[_0x1f65('0x2f')][_0x1f65('0x3d')]){_0x20ce04[_0x1f65('0x3a')]=_[_0x1f65('0x3c')](_0x20ce04['where'],{'$or':_[_0x1f65('0x2c')](_0x20ce04[_0x1f65('0x34')],function(_0x1e7ddd){var _0x610218={};_0x610218[_0x1e7ddd]={'$like':'%'+_0x394c3e[_0x1f65('0x2f')][_0x1f65('0x3d')]+'%'};return _0x610218;})});}_0x20ce04=_['merge']({},_0x20ce04,_0x394c3e[_0x1f65('0x46')]);return _0x399e2a[_0x1f65('0x4b')](_0x20ce04);}})[_0x1f65('0x25')](function(_0x4da0e0){if(_0x4da0e0){_0x5ada95=_0x4da0e0[_0x1f65('0x36')];if(!_0x394c3e['query'][_0x1f65('0x37')](_0x1f65('0x4e'))){_0x20ce04[_0x1f65('0x20')]=qs[_0x1f65('0x20')](_0x394c3e[_0x1f65('0x2f')]['limit']);_0x20ce04['offset']=qs[_0x1f65('0x1f')](_0x394c3e['query'][_0x1f65('0x1f')]);}return _0x399e2a[_0x1f65('0x4b')](_0x20ce04);}})[_0x1f65('0x25')](function(_0x1fdec6){if(_0x1fdec6){return _0x1fdec6?{'count':_0x5ada95,'rows':_0x1fdec6}:null;}})['then'](respondWithResult(_0x56c900,null))[_0x1f65('0x41')](handleError(_0x56c900,null));};exports['addConfiguration']=function(_0x576579,_0x46ec0b,_0x124bef){if(_0x576579[_0x1f65('0x4a')]['id']){delete _0x576579[_0x1f65('0x4a')]['id'];}return db['ServicenowAccount'][_0x1f65('0x4c')]({'where':{'id':_0x576579[_0x1f65('0x43')]['id']}})['then'](handleEntityNotFound(_0x46ec0b,null))[_0x1f65('0x25')](function(_0x2d065e){if(_0x2d065e){_0x576579[_0x1f65('0x4a')]['AccountId']=_0x2d065e['id'];_0x576579[_0x1f65('0x4a')][_0x1f65('0x4f')]=integrations[_0x1f65('0x50')](_0x576579['body'][_0x1f65('0x51')],_0x576579['body'][_0x1f65('0x2d')]);_0x576579[_0x1f65('0x4a')][_0x1f65('0x52')]=integrations['getDescriptions'](_0x576579[_0x1f65('0x4a')][_0x1f65('0x51')],_0x576579['body'][_0x1f65('0x2d')]);return db[_0x1f65('0x4d')][_0x1f65('0x48')](_0x576579[_0x1f65('0x4a')],{'include':[{'model':db[_0x1f65('0x53')],'as':_0x1f65('0x4f')},{'model':db['ServicenowField'],'as':'Descriptions'}]});}return null;})[_0x1f65('0x25')](respondWithResult(_0x46ec0b,null))['catch'](handleError(_0x46ec0b,null));};exports[_0x1f65('0x54')]=function(_0x2bb7b5,_0x2be419,_0x5e8797){var _0xd8ac83=[_0x1f65('0x55'),_0x1f65('0x56'),'knowledge','subcategory',_0x1f65('0x57'),'notify',_0x1f65('0x58'),_0x1f65('0x59'),'category'];var _0x2473be=[_0x1f65('0x5a'),'made_sla','caused_by','watch_list',_0x1f65('0x5b'),'sys_updated_on',_0x1f65('0x5c'),_0x1f65('0x56'),_0x1f65('0x5d'),_0x1f65('0x5e'),_0x1f65('0x5f'),'sys_updated_by',_0x1f65('0x60'),_0x1f65('0x61'),_0x1f65('0x62'),_0x1f65('0x63'),_0x1f65('0x64'),_0x1f65('0x65'),_0x1f65('0x66'),'order',_0x1f65('0x67'),_0x1f65('0x68'),'cmdb_ci',_0x1f65('0x69'),_0x1f65('0x6a'),'active','work_notes_list','business_service',_0x1f65('0x6b'),_0x1f65('0x6c'),_0x1f65('0x6d'),'time_worked',_0x1f65('0x6e'),_0x1f65('0x6f'),_0x1f65('0x70'),_0x1f65('0x71'),_0x1f65('0x72'),_0x1f65('0x73'),_0x1f65('0x74'),_0x1f65('0x75'),_0x1f65('0x76'),_0x1f65('0x77'),'work_notes',_0x1f65('0x78'),_0x1f65('0x57'),_0x1f65('0x79'),_0x1f65('0x7a'),_0x1f65('0x7b'),_0x1f65('0x7c'),_0x1f65('0x7d'),_0x1f65('0x7e'),_0x1f65('0x7f'),_0x1f65('0x80'),_0x1f65('0x81'),'sys_class_name',_0x1f65('0x82'),_0x1f65('0x83'),_0x1f65('0x84'),_0x1f65('0x85'),'sys_id',_0x1f65('0x86'),'reopened_by',_0x1f65('0x58'),_0x1f65('0x87'),_0x1f65('0x88'),_0x1f65('0x89'),_0x1f65('0x8a'),_0x1f65('0x8b'),_0x1f65('0x8c'),_0x1f65('0x59'),_0x1f65('0x8d'),'sla_due',_0x1f65('0x8e'),'comments_and_work_notes',_0x1f65('0x8f'),_0x1f65('0x90'),_0x1f65('0x91'),_0x1f65('0x92'),_0x1f65('0x93'),_0x1f65('0x94'),_0x1f65('0x95'),_0x1f65('0x96'),_0x1f65('0x97')];var _0x365ff9='';var _0x3df85f='';var _0x25704a=[];var _0xacba72='';var _0x28c838='';var _0x15f5d4=[];var _0xd61112='';var _0x50e2b7='';var _0x109f13={};var _0x961b84='';return db[_0x1f65('0x3e')][_0x1f65('0x4c')]({'where':{'id':_0x2bb7b5[_0x1f65('0x43')]['id']},'attributes':['id',_0x1f65('0x98'),_0x1f65('0x99'),'email',_0x1f65('0x9a'),'serverUrl']})[_0x1f65('0x25')](handleEntityNotFound(_0x2be419,null))[_0x1f65('0x25')](function(_0x460c56){if(_0x460c56){_0x961b84=_0x460c56[_0x1f65('0x9a')];var _0x4a773=_0x961b84[_0x1f65('0x9b')](-0x1);if(_0x4a773==='/'){_0x961b84=_0x961b84[_0x1f65('0x9c')](0x0,_0x961b84[_0x1f65('0x9d')](_0x4a773));}_0x50e2b7=util[_0x1f65('0x9e')]('%s/api/now/doc/table/schema/',_0x961b84);_0xd61112=util[_0x1f65('0x9e')](_0x1f65('0x9f'),_0x961b84);_0x109f13={'user':_0x460c56['username'],'pass':_0x460c56[_0x1f65('0x99')]};var _0x17f884={'method':_0x1f65('0xa0'),'uri':_0x50e2b7+_0x1f65('0xa1'),'auth':_0x109f13,'json':!![]};return rp(_0x17f884);}})['then'](function(_0x30bd62){if(_0x30bd62[_0x1f65('0xa2')][_0x1f65('0x36')]>0x0){_0x365ff9=_0x30bd62[_0x1f65('0xa2')];}console['log'](_0x1f65('0xa3'),_0x365ff9);_0x15f5d4=[];_0x3df85f=Object[_0x1f65('0xa4')]([],_0x365ff9);_[_0x1f65('0xa5')](_0x3df85f,function(_0x27c2b8){return!_0xd8ac83[_0x1f65('0xa6')](_0x27c2b8[_0x1f65('0x29')]);});_0x3df85f[_0x1f65('0xa7')](function(_0x5c8465){var _0x3ee30f=createFieldObject(_0xd61112,_0x109f13,_0x5c8465[_0x1f65('0xa8')],_0x5c8465[_0x1f65('0x29')],_0x5c8465[_0x1f65('0xa9')],![]);_0x15f5d4[_0x1f65('0xaa')](_0x3ee30f);});return Promise[_0x1f65('0xab')](_0x15f5d4);})[_0x1f65('0x25')](function(_0x58bcb4){_0x25704a=_0x58bcb4;_0xacba72=Object[_0x1f65('0xa4')]([],_0x365ff9);console[_0x1f65('0xac')](_0x1f65('0xad'),_0x365ff9);_['remove'](_0xacba72,function(_0x41e647){return _0x2473be[_0x1f65('0xa6')](_0x41e647[_0x1f65('0x29')]);});console[_0x1f65('0xac')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0xacba72);_0x15f5d4=[];_0xacba72[_0x1f65('0xa7')](function(_0x1f3871){var _0x65d97e=createFieldObject(_0xd61112,_0x109f13,_0x1f3871[_0x1f65('0xa8')],_0x1f3871[_0x1f65('0x29')],_0x1f3871['label'],!![]);_0x15f5d4[_0x1f65('0xaa')](_0x65d97e);});return Promise[_0x1f65('0xab')](_0x15f5d4);})[_0x1f65('0x25')](function(_0x32a18b){_0x28c838=_0x32a18b;var _0x5dcb32=_0x25704a['concat'](_0x28c838);return{'count':_0x5dcb32[_0x1f65('0x36')],'rows':_0x5dcb32};})[_0x1f65('0x25')](respondWithResult(_0x2be419,null))['catch'](function(_0x259a92){console['log'](_0x1f65('0xae')+_0x259a92);var _0x20d5a7=_0x2bb7b5[_0x1f65('0x2f')][_0x1f65('0xaf')]?0x1f4:_0x259a92[_0x1f65('0xb0')]||0x1f4;logger[_0x1f65('0x27')](_0x259a92[_0x1f65('0x28')]);delete _0x259a92[_0x1f65('0x29')];if(_0x20d5a7===0x191){_0x20d5a7=0x190;}_0x2be419['status'](_0x20d5a7)[_0x1f65('0x2a')](_0x2bb7b5[_0x1f65('0x2f')][_0x1f65('0xaf')]?{'message':_0x1f65('0xb1'),'statusCode':_0x259a92[_0x1f65('0xb0')]}:_0x259a92);});};function createFieldObject(_0x2a305d,_0x247f6c,_0x5b7809,_0x30b80f,_0x3e87e6,_0x3b2691){return new Promise(function(_0xf9fe31,_0x55716d){var _0x59c1a5={'id':_0x30b80f,'name':_0x3e87e6,'custom':_0x3b2691};if(_0x5b7809===_0x1f65('0xb2')){_0x59c1a5['options']=[{'name':_0x1f65('0xb3'),'value':'true'},{'name':_0x1f65('0xb4'),'value':_0x1f65('0xb5')}];_0xf9fe31(_0x59c1a5);}else{var _0x2820de={'method':'GET','uri':_0x2a305d+_0x1f65('0xb6')+_0x30b80f,'auth':_0x247f6c,'json':!![]};return rp(_0x2820de)[_0x1f65('0x25')](function(_0x4eb35c){var _0x177be7=[];if(_0x4eb35c[_0x1f65('0xa2')][_0x1f65('0x36')]>0x0){_0x4eb35c[_0x1f65('0xa2')][_0x1f65('0xa7')](function(_0x5407c9){if(_0x5407c9[_0x1f65('0xb7')]===_0x1f65('0xb5')){var _0x47c565={'name':_0x5407c9[_0x1f65('0xa9')],'value':_0x5407c9['value']};_0x177be7[_0x1f65('0xaa')](_0x47c565);}});}_0x59c1a5[_0x1f65('0x46')]=_0x177be7;if(_0x59c1a5[_0x1f65('0x46')]['length']>0x0){_0xf9fe31(_0x59c1a5);}else{if(_0x3b2691==![]){_0xf9fe31();}else{_0xf9fe31(_0x59c1a5);}}});}});} \ No newline at end of file +var _0x6c99=['getConfigurations','findOne','params','ServicenowConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','hold_reason','knowledge','subcategory','close_code','notify','incident_state','parent','made_sla','caused_by','upon_reject','sys_updated_on','child_incidents','approval_history','number','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','cmdb_ci','delivery_plan','impact','active','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','group_list','work_end','reopened_time','resolved_at','caller_id','short_description','delivery_task','work_start','business_stc','additional_assignee_list','description','close_notes','closed_by','parent_incident','sys_id','contact_type','urgency','problem_id','company','reassignment_count','severity','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','category','email','remoteUri','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','username','password','GET','result','incident\x20table\x20objects','assign','remove','forEach','all','TCL:\x20_object','log','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','push','test','Wrong\x20credentials','statusCode','true','False','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','end','error','stack','name','send','index','ServicenowAccount','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','keys','find','create','body'];(function(_0x4598e0,_0x2db834){var _0x3a58c9=function(_0x287aa7){while(--_0x287aa7){_0x4598e0['push'](_0x4598e0['shift']());}};_0x3a58c9(++_0x2db834);}(_0x6c99,0x6a));var _0x96c9=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x6c99[_0x710815];return _0x5b3b89;};'use strict';var emlformat=require(_0x96c9('0x0'));var rimraf=require(_0x96c9('0x1'));var zipdir=require(_0x96c9('0x2'));var jsonpatch=require(_0x96c9('0x3'));var rp=require(_0x96c9('0x4'));var moment=require(_0x96c9('0x5'));var BPromise=require(_0x96c9('0x6'));var Mustache=require(_0x96c9('0x7'));var util=require(_0x96c9('0x8'));var path=require(_0x96c9('0x9'));var sox=require('sox');var csv=require(_0x96c9('0xa'));var ejs=require(_0x96c9('0xb'));var fs=require('fs');var fs_extra=require(_0x96c9('0xc'));var _=require(_0x96c9('0xd'));var squel=require(_0x96c9('0xe'));var crypto=require(_0x96c9('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x96c9('0x10'));var toCsv=require(_0x96c9('0xa'));var querystring=require(_0x96c9('0x11'));var Papa=require(_0x96c9('0x12'));var Redis=require(_0x96c9('0x13'));var authService=require(_0x96c9('0x14'));var qs=require(_0x96c9('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x96c9('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x96c9('0x17'));var config=require(_0x96c9('0x18'));var licenseUtil=require(_0x96c9('0x19'));var db=require(_0x96c9('0x1a'))['db'];var integrations=require(_0x96c9('0x1b'));function respondWithStatusCode(_0x5d5c20,_0x520dc6){_0x520dc6=_0x520dc6||0xcc;return function(_0xfcb01f){if(_0xfcb01f){return _0x5d5c20[_0x96c9('0x1c')](_0x520dc6);}return _0x5d5c20[_0x96c9('0x1d')](_0x520dc6)['end']();};}function respondWithResult(_0x499fb5,_0x5a29d2){_0x5a29d2=_0x5a29d2||0xc8;return function(_0x5af0b1){if(_0x5af0b1){return _0x499fb5['status'](_0x5a29d2)[_0x96c9('0x1e')](_0x5af0b1);}};}function respondWithFilteredResult(_0x3c21ce,_0x10a32e){return function(_0xde2a6e){if(_0xde2a6e){var _0x363787=typeof _0x10a32e[_0x96c9('0x1f')]===_0x96c9('0x20')&&typeof _0x10a32e['limit']==='undefined';var _0x4ba35f=_0xde2a6e[_0x96c9('0x21')];var _0x1c58cf=_0x363787?0x0:_0x10a32e[_0x96c9('0x1f')];var _0x58fdd8=_0x363787?_0xde2a6e[_0x96c9('0x21')]:_0x10a32e[_0x96c9('0x1f')]+_0x10a32e[_0x96c9('0x22')];var _0x48a661;if(_0x58fdd8>=_0x4ba35f){_0x58fdd8=_0x4ba35f;_0x48a661=0xc8;}else{_0x48a661=0xce;}_0x3c21ce[_0x96c9('0x1d')](_0x48a661);return _0x3c21ce[_0x96c9('0x23')](_0x96c9('0x24'),_0x1c58cf+'-'+_0x58fdd8+'/'+_0x4ba35f)[_0x96c9('0x1e')](_0xde2a6e);}return null;};}function patchUpdates(_0x4d61c8){return function(_0x38a030){try{jsonpatch[_0x96c9('0x25')](_0x38a030,_0x4d61c8,!![]);}catch(_0xeec75b){return BPromise['reject'](_0xeec75b);}return _0x38a030['save']();};}function saveUpdates(_0x29426e,_0x43f9f6){return function(_0x26f841){if(_0x26f841){return _0x26f841[_0x96c9('0x26')](_0x29426e)[_0x96c9('0x27')](function(_0x489531){return _0x489531;});}return null;};}function removeEntity(_0xef2c1c,_0x10d1e3){return function(_0x350c4e){if(_0x350c4e){return _0x350c4e[_0x96c9('0x28')]()['then'](function(){_0xef2c1c['status'](0xcc)[_0x96c9('0x29')]();});}};}function handleEntityNotFound(_0x5a0d97,_0x33a41d){return function(_0x241777){if(!_0x241777){_0x5a0d97[_0x96c9('0x1c')](0x194);}return _0x241777;};}function handleError(_0x3fc319,_0x5f3e31){_0x5f3e31=_0x5f3e31||0x1f4;return function(_0x14dd02){logger[_0x96c9('0x2a')](_0x14dd02[_0x96c9('0x2b')]);if(_0x14dd02[_0x96c9('0x2c')]){delete _0x14dd02[_0x96c9('0x2c')];}_0x3fc319[_0x96c9('0x1d')](_0x5f3e31)[_0x96c9('0x2d')](_0x14dd02);};}exports[_0x96c9('0x2e')]=function(_0x13f951,_0x2b58c6){var _0x159824={},_0x3f52c2={},_0x4ac172={'count':0x0,'rows':[]};var _0x1d6835=_['map'](db[_0x96c9('0x2f')][_0x96c9('0x30')],function(_0x54eaa3){return{'name':_0x54eaa3[_0x96c9('0x31')],'type':_0x54eaa3[_0x96c9('0x32')]['key']};});_0x3f52c2[_0x96c9('0x33')]=_[_0x96c9('0x34')](_0x1d6835,_0x96c9('0x2c'));_0x3f52c2['query']=_['keys'](_0x13f951[_0x96c9('0x35')]);_0x3f52c2[_0x96c9('0x36')]=_[_0x96c9('0x37')](_0x3f52c2[_0x96c9('0x33')],_0x3f52c2['query']);_0x159824[_0x96c9('0x38')]=_[_0x96c9('0x37')](_0x3f52c2[_0x96c9('0x33')],qs[_0x96c9('0x39')](_0x13f951[_0x96c9('0x35')]['fields']));_0x159824['attributes']=_0x159824[_0x96c9('0x38')][_0x96c9('0x3a')]?_0x159824['attributes']:_0x3f52c2[_0x96c9('0x33')];if(!_0x13f951[_0x96c9('0x35')][_0x96c9('0x3b')](_0x96c9('0x3c'))){_0x159824[_0x96c9('0x22')]=qs[_0x96c9('0x22')](_0x13f951[_0x96c9('0x35')][_0x96c9('0x22')]);_0x159824[_0x96c9('0x1f')]=qs[_0x96c9('0x1f')](_0x13f951[_0x96c9('0x35')]['offset']);}_0x159824[_0x96c9('0x3d')]=qs['sort'](_0x13f951['query'][_0x96c9('0x3e')]);_0x159824[_0x96c9('0x3f')]=qs[_0x96c9('0x36')](_[_0x96c9('0x40')](_0x13f951[_0x96c9('0x35')],_0x3f52c2[_0x96c9('0x36')]),_0x1d6835);if(_0x13f951[_0x96c9('0x35')][_0x96c9('0x41')]){_0x159824['where']=_[_0x96c9('0x42')](_0x159824[_0x96c9('0x3f')],{'$or':_[_0x96c9('0x34')](_0x1d6835,function(_0x3d9e42){if(_0x3d9e42[_0x96c9('0x32')]!==_0x96c9('0x43')){var _0x5c4f7a={};_0x5c4f7a[_0x3d9e42['name']]={'$like':'%'+_0x13f951['query'][_0x96c9('0x41')]+'%'};return _0x5c4f7a;}})});}_0x159824=_['merge']({},_0x159824,_0x13f951[_0x96c9('0x44')]);var _0x227bb2={'where':_0x159824[_0x96c9('0x3f')]};return db[_0x96c9('0x2f')][_0x96c9('0x21')](_0x227bb2)['then'](function(_0x3a7702){_0x4ac172[_0x96c9('0x21')]=_0x3a7702;if(_0x13f951['query'][_0x96c9('0x45')]){_0x159824[_0x96c9('0x46')]=[{'all':!![]}];}return db[_0x96c9('0x2f')]['findAll'](_0x159824);})[_0x96c9('0x27')](function(_0x5a4c1c){_0x4ac172[_0x96c9('0x47')]=_0x5a4c1c;return _0x4ac172;})[_0x96c9('0x27')](respondWithFilteredResult(_0x2b58c6,_0x159824))[_0x96c9('0x48')](handleError(_0x2b58c6,null));};exports[_0x96c9('0x49')]=function(_0x426a81,_0x53a98a){var _0x38b6e8={'raw':![],'where':{'id':_0x426a81['params']['id']}},_0x2fcfa2={};_0x2fcfa2[_0x96c9('0x33')]=_[_0x96c9('0x4a')](db[_0x96c9('0x2f')]['rawAttributes']);_0x2fcfa2[_0x96c9('0x35')]=_[_0x96c9('0x4a')](_0x426a81[_0x96c9('0x35')]);_0x2fcfa2[_0x96c9('0x36')]=_[_0x96c9('0x37')](_0x2fcfa2[_0x96c9('0x33')],_0x2fcfa2[_0x96c9('0x35')]);_0x38b6e8[_0x96c9('0x38')]=_[_0x96c9('0x37')](_0x2fcfa2[_0x96c9('0x33')],qs['fields'](_0x426a81[_0x96c9('0x35')]['fields']));_0x38b6e8[_0x96c9('0x38')]=_0x38b6e8['attributes'][_0x96c9('0x3a')]?_0x38b6e8[_0x96c9('0x38')]:_0x2fcfa2[_0x96c9('0x33')];if(_0x426a81[_0x96c9('0x35')][_0x96c9('0x45')]){_0x38b6e8[_0x96c9('0x46')]=[{'all':!![]}];}_0x38b6e8=_[_0x96c9('0x42')]({},_0x38b6e8,_0x426a81['options']);return db[_0x96c9('0x2f')][_0x96c9('0x4b')](_0x38b6e8)[_0x96c9('0x27')](handleEntityNotFound(_0x53a98a,null))[_0x96c9('0x27')](respondWithResult(_0x53a98a,null))['catch'](handleError(_0x53a98a,null));};exports[_0x96c9('0x4c')]=function(_0xca2f7c,_0x475318){return db['ServicenowAccount'][_0x96c9('0x4c')](_0xca2f7c[_0x96c9('0x4d')],{})[_0x96c9('0x27')](respondWithResult(_0x475318,0xc9))[_0x96c9('0x48')](handleError(_0x475318,null));};exports[_0x96c9('0x26')]=function(_0x588052,_0x3fd776){if(_0x588052[_0x96c9('0x4d')]['id']){delete _0x588052['body']['id'];}return db['ServicenowAccount'][_0x96c9('0x4b')]({'where':{'id':_0x588052['params']['id']}})[_0x96c9('0x27')](handleEntityNotFound(_0x3fd776,null))[_0x96c9('0x27')](saveUpdates(_0x588052['body'],null))[_0x96c9('0x27')](respondWithResult(_0x3fd776,null))[_0x96c9('0x48')](handleError(_0x3fd776,null));};exports[_0x96c9('0x28')]=function(_0x2e22c5,_0x56b61f){return db['ServicenowAccount'][_0x96c9('0x4b')]({'where':{'id':_0x2e22c5['params']['id']}})[_0x96c9('0x27')](handleEntityNotFound(_0x56b61f,null))['then'](removeEntity(_0x56b61f,null))[_0x96c9('0x48')](handleError(_0x56b61f,null));};exports[_0x96c9('0x4e')]=function(_0x1d079e,_0x462e35,_0x4c82da){var _0x15086f={};var _0x512890={};var _0x445b42;var _0x1eac00;return db['ServicenowAccount'][_0x96c9('0x4f')]({'where':{'id':_0x1d079e[_0x96c9('0x50')]['id']}})[_0x96c9('0x27')](handleEntityNotFound(_0x462e35,null))[_0x96c9('0x27')](function(_0x1faa6c){if(_0x1faa6c){_0x445b42=_0x1faa6c;_0x512890[_0x96c9('0x33')]=_[_0x96c9('0x4a')](db[_0x96c9('0x51')][_0x96c9('0x30')]);_0x512890[_0x96c9('0x35')]=_[_0x96c9('0x4a')](_0x1d079e['query']);_0x512890['filters']=_[_0x96c9('0x37')](_0x512890[_0x96c9('0x33')],_0x512890[_0x96c9('0x35')]);_0x15086f['attributes']=_[_0x96c9('0x37')](_0x512890[_0x96c9('0x33')],qs['fields'](_0x1d079e[_0x96c9('0x35')][_0x96c9('0x39')]));_0x15086f[_0x96c9('0x38')]=_0x15086f[_0x96c9('0x38')][_0x96c9('0x3a')]?_0x15086f[_0x96c9('0x38')]:_0x512890[_0x96c9('0x33')];_0x15086f['order']=qs[_0x96c9('0x3e')](_0x1d079e[_0x96c9('0x35')][_0x96c9('0x3e')]);_0x15086f[_0x96c9('0x3f')]=qs[_0x96c9('0x36')](_[_0x96c9('0x40')](_0x1d079e[_0x96c9('0x35')],_0x512890[_0x96c9('0x36')]));if(_0x1d079e['query'][_0x96c9('0x41')]){_0x15086f[_0x96c9('0x3f')]=_[_0x96c9('0x42')](_0x15086f[_0x96c9('0x3f')],{'$or':_['map'](_0x15086f['attributes'],function(_0x1b67c1){var _0x153e9f={};_0x153e9f[_0x1b67c1]={'$like':'%'+_0x1d079e['query'][_0x96c9('0x41')]+'%'};return _0x153e9f;})});}_0x15086f=_[_0x96c9('0x42')]({},_0x15086f,_0x1d079e[_0x96c9('0x44')]);return _0x445b42[_0x96c9('0x4e')](_0x15086f);}})[_0x96c9('0x27')](function(_0x413749){if(_0x413749){_0x1eac00=_0x413749[_0x96c9('0x3a')];if(!_0x1d079e[_0x96c9('0x35')]['hasOwnProperty'](_0x96c9('0x3c'))){_0x15086f[_0x96c9('0x22')]=qs[_0x96c9('0x22')](_0x1d079e['query'][_0x96c9('0x22')]);_0x15086f['offset']=qs['offset'](_0x1d079e[_0x96c9('0x35')][_0x96c9('0x1f')]);}return _0x445b42[_0x96c9('0x4e')](_0x15086f);}})[_0x96c9('0x27')](function(_0x28bb81){if(_0x28bb81){return _0x28bb81?{'count':_0x1eac00,'rows':_0x28bb81}:null;}})[_0x96c9('0x27')](respondWithResult(_0x462e35,null))['catch'](handleError(_0x462e35,null));};exports['addConfiguration']=function(_0x246d7b,_0x1492c6,_0x23cf90){if(_0x246d7b[_0x96c9('0x4d')]['id']){delete _0x246d7b[_0x96c9('0x4d')]['id'];}return db[_0x96c9('0x2f')][_0x96c9('0x4f')]({'where':{'id':_0x246d7b[_0x96c9('0x50')]['id']}})[_0x96c9('0x27')](handleEntityNotFound(_0x1492c6,null))[_0x96c9('0x27')](function(_0x401aca){if(_0x401aca){_0x246d7b[_0x96c9('0x4d')]['AccountId']=_0x401aca['id'];_0x246d7b['body'][_0x96c9('0x52')]=integrations[_0x96c9('0x53')](_0x246d7b[_0x96c9('0x4d')][_0x96c9('0x54')],_0x246d7b['body'][_0x96c9('0x32')]);_0x246d7b[_0x96c9('0x4d')][_0x96c9('0x55')]=integrations[_0x96c9('0x56')](_0x246d7b[_0x96c9('0x4d')][_0x96c9('0x54')],_0x246d7b[_0x96c9('0x4d')]['type']);return db[_0x96c9('0x51')][_0x96c9('0x4c')](_0x246d7b[_0x96c9('0x4d')],{'include':[{'model':db[_0x96c9('0x57')],'as':_0x96c9('0x52')},{'model':db[_0x96c9('0x57')],'as':_0x96c9('0x55')}]});}return null;})[_0x96c9('0x27')](respondWithResult(_0x1492c6,null))[_0x96c9('0x48')](handleError(_0x1492c6,null));};exports[_0x96c9('0x58')]=function(_0x3e4931,_0x2fe0b7,_0x8dc8a1){var _0x34a213=['made_sla',_0x96c9('0x59'),_0x96c9('0x5a'),_0x96c9('0x5b'),_0x96c9('0x5c'),_0x96c9('0x5d'),_0x96c9('0x5e'),'severity','category'];var _0x307f8f=[_0x96c9('0x5f'),_0x96c9('0x60'),_0x96c9('0x61'),'watch_list',_0x96c9('0x62'),_0x96c9('0x63'),_0x96c9('0x64'),'hold_reason',_0x96c9('0x65'),_0x96c9('0x66'),'resolved_by','sys_updated_by',_0x96c9('0x67'),_0x96c9('0x68'),_0x96c9('0x69'),_0x96c9('0x6a'),_0x96c9('0x6b'),_0x96c9('0x6c'),_0x96c9('0x5a'),'order','calendar_stc','closed_at',_0x96c9('0x6d'),_0x96c9('0x6e'),_0x96c9('0x6f'),_0x96c9('0x70'),'work_notes_list',_0x96c9('0x71'),_0x96c9('0x72'),_0x96c9('0x73'),_0x96c9('0x74'),_0x96c9('0x75'),_0x96c9('0x76'),_0x96c9('0x77'),'business_duration',_0x96c9('0x78'),_0x96c9('0x79'),_0x96c9('0x7a'),_0x96c9('0x7b'),_0x96c9('0x7c'),'approval_set',_0x96c9('0x5b'),'work_notes',_0x96c9('0x7d'),'close_code','correlation_display',_0x96c9('0x7e'),_0x96c9('0x7f'),'assignment_group',_0x96c9('0x80'),_0x96c9('0x81'),_0x96c9('0x82'),'calendar_duration',_0x96c9('0x5d'),'sys_class_name',_0x96c9('0x83'),_0x96c9('0x84'),'follow_up',_0x96c9('0x85'),_0x96c9('0x86'),_0x96c9('0x87'),'reopened_by',_0x96c9('0x5e'),_0x96c9('0x88'),_0x96c9('0x89'),_0x96c9('0x8a'),_0x96c9('0x8b'),'activity_due','assigned_to',_0x96c9('0x8c'),_0x96c9('0x8d'),_0x96c9('0x8e'),_0x96c9('0x8f'),_0x96c9('0x90'),_0x96c9('0x91'),_0x96c9('0x92'),_0x96c9('0x93'),_0x96c9('0x94'),_0x96c9('0x95'),_0x96c9('0x96'),_0x96c9('0x97'),_0x96c9('0x98'),_0x96c9('0x99')];var _0x431182='';var _0x102fb5='';var _0x230d24=[];var _0x3868ba='';var _0x40f270='';var _0x54a46c=[];var _0x232d59='';var _0x517f64='';var _0x27500b={};var _0x37223e='';return db[_0x96c9('0x2f')][_0x96c9('0x4f')]({'where':{'id':_0x3e4931[_0x96c9('0x50')]['id']},'attributes':['id','username','password',_0x96c9('0x9a'),'remoteUri','serverUrl']})[_0x96c9('0x27')](handleEntityNotFound(_0x2fe0b7,null))['then'](function(_0x3d5ec0){if(_0x3d5ec0){_0x37223e=_0x3d5ec0[_0x96c9('0x9b')];var _0x3d9127=_0x37223e[_0x96c9('0x9c')](-0x1);if(_0x3d9127==='/'){_0x37223e=_0x37223e[_0x96c9('0x9d')](0x0,_0x37223e[_0x96c9('0x9e')](_0x3d9127));}_0x517f64=util['format'](_0x96c9('0x9f'),_0x37223e);_0x232d59=util[_0x96c9('0xa0')](_0x96c9('0xa1'),_0x37223e);_0x27500b={'user':_0x3d5ec0[_0x96c9('0xa2')],'pass':_0x3d5ec0[_0x96c9('0xa3')]};var _0x538e7d={'method':_0x96c9('0xa4'),'uri':_0x517f64+'incident?sysparm_display_value=all','auth':_0x27500b,'json':!![]};return rp(_0x538e7d);}})['then'](function(_0x53051e){if(_0x53051e[_0x96c9('0xa5')]['length']>0x0){_0x431182=_0x53051e['result'];}console['log'](_0x96c9('0xa6'),_0x431182);_0x54a46c=[];_0x102fb5=Object[_0x96c9('0xa7')]([],_0x431182);_[_0x96c9('0xa8')](_0x102fb5,function(_0x1fbb7b){return!_0x34a213['includes'](_0x1fbb7b[_0x96c9('0x2c')]);});_0x102fb5[_0x96c9('0xa9')](function(_0x525d2c){var _0x12fe33=createFieldObject(_0x232d59,_0x27500b,_0x525d2c['internalType'],_0x525d2c[_0x96c9('0x2c')],_0x525d2c['label'],![]);_0x54a46c['push'](_0x12fe33);});return Promise[_0x96c9('0xaa')](_0x54a46c);})[_0x96c9('0x27')](function(_0x3715c7){_0x230d24=_0x3715c7;_0x3868ba=Object[_0x96c9('0xa7')]([],_0x431182);console['log'](_0x96c9('0xab'),_0x431182);_[_0x96c9('0xa8')](_0x3868ba,function(_0x4a436a){return _0x307f8f['includes'](_0x4a436a[_0x96c9('0x2c')]);});console[_0x96c9('0xac')](_0x96c9('0xad'),_0x3868ba);_0x54a46c=[];_0x3868ba['forEach'](function(_0xb0df0c){var _0x25c36c=createFieldObject(_0x232d59,_0x27500b,_0xb0df0c[_0x96c9('0xae')],_0xb0df0c[_0x96c9('0x2c')],_0xb0df0c['label'],!![]);_0x54a46c[_0x96c9('0xaf')](_0x25c36c);});return Promise['all'](_0x54a46c);})[_0x96c9('0x27')](function(_0x4e1a84){_0x40f270=_0x4e1a84;var _0x166635=_0x230d24['concat'](_0x40f270);return{'count':_0x166635['length'],'rows':_0x166635};})['then'](respondWithResult(_0x2fe0b7,null))[_0x96c9('0x48')](function(_0x6cd6d2){console[_0x96c9('0xac')]('ServiceNow\x20error:\x20'+_0x6cd6d2);var _0x3d2e42=_0x3e4931['query'][_0x96c9('0xb0')]?0x1f4:_0x6cd6d2['statusCode']||0x1f4;logger[_0x96c9('0x2a')](_0x6cd6d2[_0x96c9('0x2b')]);delete _0x6cd6d2[_0x96c9('0x2c')];if(_0x3d2e42===0x191){_0x3d2e42=0x190;}_0x2fe0b7['status'](_0x3d2e42)[_0x96c9('0x2d')](_0x3e4931['query'][_0x96c9('0xb0')]?{'message':_0x96c9('0xb1'),'statusCode':_0x6cd6d2[_0x96c9('0xb2')]}:_0x6cd6d2);});};function createFieldObject(_0x5a8ea2,_0x3557f2,_0x168d1f,_0x473ed2,_0x45db6e,_0x57998c){return new Promise(function(_0x4a3058,_0x8d681c){var _0x56df59={'id':_0x473ed2,'name':_0x45db6e,'custom':_0x57998c};if(_0x168d1f==='boolean'){_0x56df59[_0x96c9('0x44')]=[{'name':'True','value':_0x96c9('0xb3')},{'name':_0x96c9('0xb4'),'value':'false'}];_0x4a3058(_0x56df59);}else{var _0x80a659={'method':'GET','uri':_0x5a8ea2+_0x96c9('0xb5')+_0x473ed2,'auth':_0x3557f2,'json':!![]};return rp(_0x80a659)[_0x96c9('0x27')](function(_0x445912){var _0x26b371=[];if(_0x445912[_0x96c9('0xa5')][_0x96c9('0x3a')]>0x0){_0x445912[_0x96c9('0xa5')][_0x96c9('0xa9')](function(_0x3ef7b3){if(_0x3ef7b3[_0x96c9('0xb6')]==='false'){var _0x42acd2={'name':_0x3ef7b3['label'],'value':_0x3ef7b3[_0x96c9('0xb7')]};_0x26b371['push'](_0x42acd2);}});}_0x56df59['options']=_0x26b371;if(_0x56df59[_0x96c9('0x44')][_0x96c9('0x3a')]>0x0){_0x4a3058(_0x56df59);}else{if(_0x57998c==![]){_0x4a3058();}else{_0x4a3058(_0x56df59);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index f2b59c0..5853242 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 _0xe2fe=['define','int_servicenow_accounts','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x40f68f,_0x352e1e){var _0x1d9cff=function(_0x1caf34){while(--_0x1caf34){_0x40f68f['push'](_0x40f68f['shift']());}};_0x1d9cff(++_0x352e1e);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee2f('0x1'));var moment=require('moment');var BPromise=require(_0xee2f('0x2'));var rp=require(_0xee2f('0x3'));var fs=require('fs');var path=require(_0xee2f('0x4'));var rimraf=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0xee2f('0x7'));module[_0xee2f('0x8')]=function(_0x49926b,_0x1533a0){return _0x49926b[_0xee2f('0x9')]('ServicenowAccount',attributes,{'tableName':_0xee2f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1883=['../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2484e6,_0x2cbe6c){var _0x20efaf=function(_0x15499e){while(--_0x15499e){_0x2484e6['push'](_0x2484e6['shift']());}};_0x20efaf(++_0x2cbe6c);}(_0x1883,0xab));var _0x3188=function(_0xe8f6a6,_0x1891a4){_0xe8f6a6=_0xe8f6a6-0x0;var _0x3bd518=_0x1883[_0xe8f6a6];return _0x3bd518;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var logger=require(_0x3188('0x2'))(_0x3188('0x3'));var moment=require(_0x3188('0x4'));var BPromise=require(_0x3188('0x5'));var rp=require(_0x3188('0x6'));var fs=require('fs');var path=require(_0x3188('0x7'));var rimraf=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var attributes=require(_0x3188('0xa'));var integrations=require(_0x3188('0xb'));module[_0x3188('0xc')]=function(_0x33b62d,_0x24f2f1){return _0x33b62d[_0x3188('0xd')](_0x3188('0xe'),attributes,{'tableName':'int_servicenow_accounts','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 404a966..f4f021c 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 _0xc368=['rpc','jayson/promise','client','then','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowAccount,\x20%s,\x20%s','result','ServicenowAccount','findAll','options','where','include','map','model','attributes','GetServicenowAccount','ShowServicenowAccount','find','raw','info','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xc368,0x108));var _0x8c36=function(_0x113f91,_0x25a96d){_0x113f91=_0x113f91-0x0;var _0x1c991d=_0xc368[_0x113f91];return _0x1c991d;};'use strict';var _=require(_0x8c36('0x0'));var util=require(_0x8c36('0x1'));var moment=require(_0x8c36('0x2'));var BPromise=require(_0x8c36('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c36('0x4'));var db=require(_0x8c36('0x5'))['db'];var utils=require(_0x8c36('0x6'));var logger=require(_0x8c36('0x7'))(_0x8c36('0x8'));var config=require('../../config/environment');var jayson=require(_0x8c36('0x9'));var client=jayson[_0x8c36('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a3bf9,_0x4d9918,_0xd39446){return new BPromise(function(_0x33ec14,_0x1c1a1d){return client['request'](_0x4a3bf9,_0xd39446)[_0x8c36('0xb')](function(_0x152677){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x4d9918,_0x8c36('0xc'));logger[_0x8c36('0xd')](_0x8c36('0xe'),_0x4d9918,_0x8c36('0xc'),JSON[_0x8c36('0xf')](_0x152677));if(_0x152677['error']){if(_0x152677[_0x8c36('0x10')][_0x8c36('0x11')]===0x1f4){logger[_0x8c36('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x4d9918,_0x152677[_0x8c36('0x10')]['message']);return _0x1c1a1d(_0x152677['error']['message']);}logger[_0x8c36('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x4d9918,_0x152677[_0x8c36('0x10')][_0x8c36('0x12')]);return _0x33ec14(_0x152677[_0x8c36('0x10')]['message']);}else{logger['info'](_0x8c36('0x13'),_0x4d9918,'request\x20sent');_0x33ec14(_0x152677[_0x8c36('0x14')][_0x8c36('0x12')]);}})['catch'](function(_0x5b7f3e){logger[_0x8c36('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x4d9918,_0x5b7f3e);_0x1c1a1d(_0x5b7f3e);});});}exports['GetServicenowAccount']=function(_0x45f1c4){var _0x52531e=this;return new Promise(function(_0x9f9449,_0x416a45){return db[_0x8c36('0x15')][_0x8c36('0x16')]({'raw':_0x45f1c4[_0x8c36('0x17')]?_0x45f1c4[_0x8c36('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x45f1c4[_0x8c36('0x17')]?_0x45f1c4[_0x8c36('0x17')][_0x8c36('0x18')]||null:null,'attributes':_0x45f1c4[_0x8c36('0x17')]?_0x45f1c4[_0x8c36('0x17')]['attributes']||null:null,'limit':_0x45f1c4['options']?_0x45f1c4[_0x8c36('0x17')]['limit']||null:null,'include':_0x45f1c4[_0x8c36('0x17')]?_0x45f1c4['options'][_0x8c36('0x19')]?_[_0x8c36('0x1a')](_0x45f1c4[_0x8c36('0x17')][_0x8c36('0x19')],function(_0xf0cb5f){return{'model':db[_0xf0cb5f[_0x8c36('0x1b')]],'as':_0xf0cb5f['as'],'attributes':_0xf0cb5f[_0x8c36('0x1c')],'include':_0xf0cb5f[_0x8c36('0x19')]?_[_0x8c36('0x1a')](_0xf0cb5f['include'],function(_0x16d016){return{'model':db[_0x16d016[_0x8c36('0x1b')]],'as':_0x16d016['as'],'attributes':_0x16d016['attributes'],'include':_0x16d016[_0x8c36('0x19')]?_['map'](_0x16d016[_0x8c36('0x19')],function(_0x4172ae){return{'model':db[_0x4172ae[_0x8c36('0x1b')]],'as':_0x4172ae['as'],'attributes':_0x4172ae[_0x8c36('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8c36('0xb')](function(_0x43d0f1){logger['info'](_0x8c36('0x1d'),_0x45f1c4);logger['debug'](_0x8c36('0x1d'),_0x45f1c4,JSON[_0x8c36('0xf')](_0x43d0f1));_0x9f9449(_0x43d0f1);})['catch'](function(_0x5f116d){logger[_0x8c36('0x10')](_0x8c36('0x1d'),_0x5f116d['message'],_0x45f1c4);_0x416a45(_0x52531e[_0x8c36('0x10')](0x1f4,_0x5f116d['message']));});});};exports[_0x8c36('0x1e')]=function(_0x517068){var _0x5a8b33=this;return new Promise(function(_0x58e546,_0x533516){return db['ServicenowAccount'][_0x8c36('0x1f')]({'raw':_0x517068[_0x8c36('0x17')]?_0x517068[_0x8c36('0x17')][_0x8c36('0x20')]===undefined?!![]:![]:!![],'where':_0x517068[_0x8c36('0x17')]?_0x517068[_0x8c36('0x17')]['where']||null:null,'attributes':_0x517068['options']?_0x517068[_0x8c36('0x17')]['attributes']||null:null,'include':_0x517068['options']?_0x517068[_0x8c36('0x17')]['include']?_[_0x8c36('0x1a')](_0x517068['options']['include'],function(_0x15a178){return{'model':db[_0x15a178[_0x8c36('0x1b')]],'as':_0x15a178['as'],'attributes':_0x15a178[_0x8c36('0x1c')],'include':_0x15a178[_0x8c36('0x19')]?_[_0x8c36('0x1a')](_0x15a178[_0x8c36('0x19')],function(_0x1ebe00){return{'model':db[_0x1ebe00[_0x8c36('0x1b')]],'as':_0x1ebe00['as'],'attributes':_0x1ebe00[_0x8c36('0x1c')],'include':_0x1ebe00[_0x8c36('0x19')]?_['map'](_0x1ebe00[_0x8c36('0x19')],function(_0x5e73ea){return{'model':db[_0x5e73ea[_0x8c36('0x1b')]],'as':_0x5e73ea['as'],'attributes':_0x5e73ea[_0x8c36('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8c36('0xb')](function(_0x52c724){logger[_0x8c36('0x21')](_0x8c36('0x1e'),_0x517068);logger[_0x8c36('0xd')](_0x8c36('0x1e'),_0x517068,JSON['stringify'](_0x52c724));_0x58e546(_0x52c724);})['catch'](function(_0xe0c867){logger[_0x8c36('0x10')](_0x8c36('0x1e'),_0xe0c867[_0x8c36('0x12')],_0x517068);_0x533516(_0x5a8b33['error'](0x1f4,_0xe0c867[_0x8c36('0x12')]));});});}; \ No newline at end of file +var _0x16bb=['debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ServicenowAccount,\x20%s,\x20%s','GetServicenowAccount','ServicenowAccount','options','raw','attributes','limit','include','map','model','ShowServicenowAccount','find','where','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x16bb,0x1a1));var _0xb16b=function(_0x19d11c,_0x285b34){_0x19d11c=_0x19d11c-0x0;var _0x933487=_0x16bb[_0x19d11c];return _0x933487;};'use strict';var _=require(_0xb16b('0x0'));var util=require(_0xb16b('0x1'));var moment=require('moment');var BPromise=require(_0xb16b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb16b('0x3'))['db'];var utils=require(_0xb16b('0x4'));var logger=require(_0xb16b('0x5'))(_0xb16b('0x6'));var config=require(_0xb16b('0x7'));var jayson=require(_0xb16b('0x8'));var client=jayson[_0xb16b('0x9')][_0xb16b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a702b,_0x36ee6c,_0x4d97a9){return new BPromise(function(_0x56936f,_0x11a1a8){return client[_0xb16b('0xb')](_0x3a702b,_0x4d97a9)[_0xb16b('0xc')](function(_0xb998e5){logger[_0xb16b('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x36ee6c,_0xb16b('0xe'));logger[_0xb16b('0xf')](_0xb16b('0x10'),_0x36ee6c,_0xb16b('0xe'),JSON[_0xb16b('0x11')](_0xb998e5));if(_0xb998e5[_0xb16b('0x12')]){if(_0xb998e5['error'][_0xb16b('0x13')]===0x1f4){logger[_0xb16b('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x36ee6c,_0xb998e5[_0xb16b('0x12')]['message']);return _0x11a1a8(_0xb998e5[_0xb16b('0x12')][_0xb16b('0x14')]);}logger[_0xb16b('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x36ee6c,_0xb998e5[_0xb16b('0x12')][_0xb16b('0x14')]);return _0x56936f(_0xb998e5[_0xb16b('0x12')][_0xb16b('0x14')]);}else{logger[_0xb16b('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x36ee6c,_0xb16b('0xe'));_0x56936f(_0xb998e5[_0xb16b('0x15')][_0xb16b('0x14')]);}})[_0xb16b('0x16')](function(_0x548d6b){logger[_0xb16b('0x12')](_0xb16b('0x17'),_0x36ee6c,_0x548d6b);_0x11a1a8(_0x548d6b);});});}exports[_0xb16b('0x18')]=function(_0x1e35d2){var _0xe05fb6=this;return new Promise(function(_0x237b4d,_0x5c83c8){return db[_0xb16b('0x19')]['findAll']({'raw':_0x1e35d2['options']?_0x1e35d2[_0xb16b('0x1a')][_0xb16b('0x1b')]===undefined?!![]:![]:!![],'where':_0x1e35d2[_0xb16b('0x1a')]?_0x1e35d2['options']['where']||null:null,'attributes':_0x1e35d2[_0xb16b('0x1a')]?_0x1e35d2['options'][_0xb16b('0x1c')]||null:null,'limit':_0x1e35d2[_0xb16b('0x1a')]?_0x1e35d2[_0xb16b('0x1a')][_0xb16b('0x1d')]||null:null,'include':_0x1e35d2[_0xb16b('0x1a')]?_0x1e35d2[_0xb16b('0x1a')][_0xb16b('0x1e')]?_[_0xb16b('0x1f')](_0x1e35d2[_0xb16b('0x1a')][_0xb16b('0x1e')],function(_0x141179){return{'model':db[_0x141179[_0xb16b('0x20')]],'as':_0x141179['as'],'attributes':_0x141179[_0xb16b('0x1c')],'include':_0x141179[_0xb16b('0x1e')]?_[_0xb16b('0x1f')](_0x141179[_0xb16b('0x1e')],function(_0x445925){return{'model':db[_0x445925[_0xb16b('0x20')]],'as':_0x445925['as'],'attributes':_0x445925[_0xb16b('0x1c')],'include':_0x445925['include']?_[_0xb16b('0x1f')](_0x445925[_0xb16b('0x1e')],function(_0xc0617c){return{'model':db[_0xc0617c[_0xb16b('0x20')]],'as':_0xc0617c['as'],'attributes':_0xc0617c[_0xb16b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb16b('0xc')](function(_0x432603){logger['info'](_0xb16b('0x18'),_0x1e35d2);logger[_0xb16b('0xf')](_0xb16b('0x18'),_0x1e35d2,JSON[_0xb16b('0x11')](_0x432603));_0x237b4d(_0x432603);})[_0xb16b('0x16')](function(_0x4f096b){logger[_0xb16b('0x12')]('GetServicenowAccount',_0x4f096b['message'],_0x1e35d2);_0x5c83c8(_0xe05fb6[_0xb16b('0x12')](0x1f4,_0x4f096b['message']));});});};exports[_0xb16b('0x21')]=function(_0x4954e9){var _0x472efd=this;return new Promise(function(_0x4d6b2e,_0x5ed569){return db['ServicenowAccount'][_0xb16b('0x22')]({'raw':_0x4954e9[_0xb16b('0x1a')]?_0x4954e9[_0xb16b('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4954e9[_0xb16b('0x1a')]?_0x4954e9[_0xb16b('0x1a')][_0xb16b('0x23')]||null:null,'attributes':_0x4954e9[_0xb16b('0x1a')]?_0x4954e9[_0xb16b('0x1a')][_0xb16b('0x1c')]||null:null,'include':_0x4954e9[_0xb16b('0x1a')]?_0x4954e9['options'][_0xb16b('0x1e')]?_['map'](_0x4954e9[_0xb16b('0x1a')][_0xb16b('0x1e')],function(_0x143ce8){return{'model':db[_0x143ce8[_0xb16b('0x20')]],'as':_0x143ce8['as'],'attributes':_0x143ce8['attributes'],'include':_0x143ce8[_0xb16b('0x1e')]?_['map'](_0x143ce8[_0xb16b('0x1e')],function(_0x2ffc61){return{'model':db[_0x2ffc61[_0xb16b('0x20')]],'as':_0x2ffc61['as'],'attributes':_0x2ffc61['attributes'],'include':_0x2ffc61[_0xb16b('0x1e')]?_[_0xb16b('0x1f')](_0x2ffc61[_0xb16b('0x1e')],function(_0x359abf){return{'model':db[_0x359abf[_0xb16b('0x20')]],'as':_0x359abf['as'],'attributes':_0x359abf[_0xb16b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb16b('0xc')](function(_0x29b01a){logger[_0xb16b('0xd')]('ShowServicenowAccount',_0x4954e9);logger['debug'](_0xb16b('0x21'),_0x4954e9,JSON[_0xb16b('0x11')](_0x29b01a));_0x4d6b2e(_0x29b01a);})['catch'](function(_0x2e6c21){logger[_0xb16b('0x12')](_0xb16b('0x21'),_0x2e6c21[_0xb16b('0x14')],_0x4954e9);_0x5ed569(_0x472efd[_0xb16b('0x12')](0x1f4,_0x2e6c21[_0xb16b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 6a80724..6668285 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 _0x186e=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','put','update','exports','multer','util'];(function(_0x4ebcb0,_0xc6b221){var _0x35e423=function(_0x2adc30){while(--_0x2adc30){_0x4ebcb0['push'](_0x4ebcb0['shift']());}};_0x35e423(++_0xc6b221);}(_0x186e,0x6c));var _0xe186=function(_0x3e63cd,_0x7e5793){_0x3e63cd=_0x3e63cd-0x0;var _0x21a363=_0x186e[_0x3e63cd];return _0x21a363;};'use strict';var multer=require(_0xe186('0x0'));var util=require(_0xe186('0x1'));var path=require('path');var timeout=require(_0xe186('0x2'));var express=require('express');var router=express[_0xe186('0x3')]();var fs_extra=require(_0xe186('0x4'));var auth=require(_0xe186('0x5'));var interaction=require(_0xe186('0x6'));var config=require(_0xe186('0x7'));var controller=require('./intServicenowConfiguration.controller');router[_0xe186('0x8')]('/',auth['isAuthenticated'](),controller[_0xe186('0x9')]);router[_0xe186('0x8')](_0xe186('0xa'),auth[_0xe186('0xb')](),controller[_0xe186('0xc')]);router[_0xe186('0x8')](_0xe186('0xd'),auth['isAuthenticated'](),controller[_0xe186('0xe')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xe186('0xf')]);router[_0xe186('0x8')](_0xe186('0x10'),auth['isAuthenticated'](),controller[_0xe186('0x11')]);router[_0xe186('0x12')]('/',auth[_0xe186('0xb')](),controller['create']);router[_0xe186('0x13')](_0xe186('0xa'),auth[_0xe186('0xb')](),controller[_0xe186('0x14')]);router['delete'](_0xe186('0xa'),auth[_0xe186('0xb')](),controller['destroy']);module[_0xe186('0x15')]=router; \ No newline at end of file +var _0xd30a=['/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','put','update','delete','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xd30a,0x1c4));var _0xad30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd30a[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0xad30('0x0'));var path=require('path');var timeout=require(_0xad30('0x1'));var express=require(_0xad30('0x2'));var router=express['Router']();var fs_extra=require(_0xad30('0x3'));var auth=require(_0xad30('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xad30('0x5'));var controller=require(_0xad30('0x6'));router[_0xad30('0x7')]('/',auth[_0xad30('0x8')](),controller[_0xad30('0x9')]);router[_0xad30('0x7')](_0xad30('0xa'),auth['isAuthenticated'](),controller[_0xad30('0xb')]);router[_0xad30('0x7')](_0xad30('0xc'),auth[_0xad30('0x8')](),controller[_0xad30('0xd')]);router[_0xad30('0x7')](_0xad30('0xe'),auth[_0xad30('0x8')](),controller[_0xad30('0xf')]);router[_0xad30('0x7')]('/:id/descriptions',auth[_0xad30('0x8')](),controller[_0xad30('0x10')]);router[_0xad30('0x11')]('/',auth[_0xad30('0x8')](),controller['create']);router[_0xad30('0x12')](_0xad30('0xa'),auth[_0xad30('0x8')](),controller[_0xad30('0x13')]);router[_0xad30('0x14')](_0xad30('0xa'),auth[_0xad30('0x8')](),controller['destroy']);module[_0xad30('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index af42895..1b69be9 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 _0x3da7=['sequelize','exports','STRING'];(function(_0x5555fd,_0x31b11c){var _0x174889=function(_0x1afb16){while(--_0x1afb16){_0x5555fd['push'](_0x5555fd['shift']());}};_0x174889(++_0x31b11c);}(_0x3da7,0xc6));var _0x73da=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x3da7[_0x2c7618];return _0x5ce3f0;};'use strict';var Sequelize=require(_0x73da('0x0'));module[_0x73da('0x1')]={'name':{'type':Sequelize[_0x73da('0x2')]},'description':{'type':Sequelize[_0x73da('0x2')]}}; \ No newline at end of file +var _0x1056=['sequelize','exports'];(function(_0x412dd8,_0x355780){var _0x47b96=function(_0x58b680){while(--_0x58b680){_0x412dd8['push'](_0x412dd8['shift']());}};_0x47b96(++_0x355780);}(_0x1056,0x94));var _0x6105=function(_0x2375b7,_0x1fdff6){_0x2375b7=_0x2375b7-0x0;var _0x196523=_0x1056[_0x2375b7];return _0x196523;};'use strict';var Sequelize=require(_0x6105('0x0'));module[_0x6105('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 2ee966e..b209b77 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 _0xe0a6=['body','getFields','merge','hasOwnProperty','ServicenowField','getSubjects','length','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','count','set','apply','reject','update','then','destroy','end','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','model','map','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe0a6,0x185));var _0x6e0a=function(_0x475272,_0x351425){_0x475272=_0x475272-0x0;var _0x2a17ec=_0xe0a6[_0x475272];return _0x2a17ec;};'use strict';var emlformat=require(_0x6e0a('0x0'));var rimraf=require(_0x6e0a('0x1'));var zipdir=require(_0x6e0a('0x2'));var jsonpatch=require(_0x6e0a('0x3'));var rp=require('request-promise');var moment=require(_0x6e0a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6e0a('0x5'));var util=require(_0x6e0a('0x6'));var path=require(_0x6e0a('0x7'));var sox=require(_0x6e0a('0x8'));var csv=require(_0x6e0a('0x9'));var ejs=require(_0x6e0a('0xa'));var fs=require('fs');var fs_extra=require(_0x6e0a('0xb'));var _=require(_0x6e0a('0xc'));var squel=require(_0x6e0a('0xd'));var crypto=require(_0x6e0a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x6e0a('0xf'));var toCsv=require(_0x6e0a('0x9'));var querystring=require(_0x6e0a('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6e0a('0x11'));var qs=require(_0x6e0a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6e0a('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x6e0a('0x14'));var config=require(_0x6e0a('0x15'));var licenseUtil=require(_0x6e0a('0x16'));var db=require(_0x6e0a('0x17'))['db'];function respondWithStatusCode(_0x233a29,_0x4db555){_0x4db555=_0x4db555||0xcc;return function(_0x3a4997){if(_0x3a4997){return _0x233a29[_0x6e0a('0x18')](_0x4db555);}return _0x233a29[_0x6e0a('0x19')](_0x4db555)['end']();};}function respondWithResult(_0x62804d,_0x47433d){_0x47433d=_0x47433d||0xc8;return function(_0x800bcd){if(_0x800bcd){return _0x62804d[_0x6e0a('0x19')](_0x47433d)['json'](_0x800bcd);}};}function respondWithFilteredResult(_0xf3c3f9,_0x571217){return function(_0x4198cd){if(_0x4198cd){var _0x33e159=typeof _0x571217[_0x6e0a('0x1a')]==='undefined'&&typeof _0x571217[_0x6e0a('0x1b')]==='undefined';var _0x448b6d=_0x4198cd[_0x6e0a('0x1c')];var _0x4a698c=_0x33e159?0x0:_0x571217['offset'];var _0x128c70=_0x33e159?_0x4198cd[_0x6e0a('0x1c')]:_0x571217[_0x6e0a('0x1a')]+_0x571217[_0x6e0a('0x1b')];var _0x3b45dd;if(_0x128c70>=_0x448b6d){_0x128c70=_0x448b6d;_0x3b45dd=0xc8;}else{_0x3b45dd=0xce;}_0xf3c3f9[_0x6e0a('0x19')](_0x3b45dd);return _0xf3c3f9[_0x6e0a('0x1d')]('Content-Range',_0x4a698c+'-'+_0x128c70+'/'+_0x448b6d)['json'](_0x4198cd);}return null;};}function patchUpdates(_0x3cfcbf){return function(_0xea80d5){try{jsonpatch[_0x6e0a('0x1e')](_0xea80d5,_0x3cfcbf,!![]);}catch(_0x29af0a){return BPromise[_0x6e0a('0x1f')](_0x29af0a);}return _0xea80d5['save']();};}function saveUpdates(_0x18dd30,_0x183bda){return function(_0x2fb7f8){if(_0x2fb7f8){return _0x2fb7f8[_0x6e0a('0x20')](_0x18dd30)[_0x6e0a('0x21')](function(_0x163b43){return _0x163b43;});}return null;};}function removeEntity(_0x45b1cd,_0x4203f0){return function(_0x27eccd){if(_0x27eccd){return _0x27eccd[_0x6e0a('0x22')]()[_0x6e0a('0x21')](function(){_0x45b1cd[_0x6e0a('0x19')](0xcc)[_0x6e0a('0x23')]();});}};}function handleEntityNotFound(_0x13d8d4,_0x26ae4c){return function(_0x109f46){if(!_0x109f46){_0x13d8d4[_0x6e0a('0x18')](0x194);}return _0x109f46;};}function handleError(_0x313f21,_0xd69960){_0xd69960=_0xd69960||0x1f4;return function(_0x240da9){logger['error'](_0x240da9['stack']);if(_0x240da9[_0x6e0a('0x24')]){delete _0x240da9[_0x6e0a('0x24')];}_0x313f21[_0x6e0a('0x19')](_0xd69960)[_0x6e0a('0x25')](_0x240da9);};}exports[_0x6e0a('0x26')]=function(_0x18b330,_0x4e2279){var _0x465f5c={},_0x58614={},_0x3be8a5={'count':0x0,'rows':[]};var _0x5461b0=_['map'](db[_0x6e0a('0x27')][_0x6e0a('0x28')],function(_0x5a08e9){return{'name':_0x5a08e9[_0x6e0a('0x29')],'type':_0x5a08e9['type']['key']};});_0x58614[_0x6e0a('0x2a')]=_[_0x6e0a('0x2b')](_0x5461b0,_0x6e0a('0x24'));_0x58614[_0x6e0a('0x2c')]=_[_0x6e0a('0x2d')](_0x18b330[_0x6e0a('0x2c')]);_0x58614['filters']=_[_0x6e0a('0x2e')](_0x58614['model'],_0x58614[_0x6e0a('0x2c')]);_0x465f5c[_0x6e0a('0x2f')]=_['intersection'](_0x58614['model'],qs['fields'](_0x18b330['query'][_0x6e0a('0x30')]));_0x465f5c[_0x6e0a('0x2f')]=_0x465f5c[_0x6e0a('0x2f')]['length']?_0x465f5c[_0x6e0a('0x2f')]:_0x58614['model'];if(!_0x18b330[_0x6e0a('0x2c')]['hasOwnProperty'](_0x6e0a('0x31'))){_0x465f5c[_0x6e0a('0x1b')]=qs[_0x6e0a('0x1b')](_0x18b330[_0x6e0a('0x2c')][_0x6e0a('0x1b')]);_0x465f5c[_0x6e0a('0x1a')]=qs[_0x6e0a('0x1a')](_0x18b330[_0x6e0a('0x2c')]['offset']);}_0x465f5c[_0x6e0a('0x32')]=qs['sort'](_0x18b330[_0x6e0a('0x2c')][_0x6e0a('0x33')]);_0x465f5c[_0x6e0a('0x34')]=qs[_0x6e0a('0x35')](_[_0x6e0a('0x36')](_0x18b330[_0x6e0a('0x2c')],_0x58614[_0x6e0a('0x35')]),_0x5461b0);if(_0x18b330[_0x6e0a('0x2c')][_0x6e0a('0x37')]){_0x465f5c['where']=_['merge'](_0x465f5c[_0x6e0a('0x34')],{'$or':_['map'](_0x5461b0,function(_0x4aeb99){if(_0x4aeb99['type']!==_0x6e0a('0x38')){var _0x27fd65={};_0x27fd65[_0x4aeb99['name']]={'$like':'%'+_0x18b330[_0x6e0a('0x2c')][_0x6e0a('0x37')]+'%'};return _0x27fd65;}})});}_0x465f5c=_['merge']({},_0x465f5c,_0x18b330['options']);var _0x3cf655={'where':_0x465f5c[_0x6e0a('0x34')]};return db[_0x6e0a('0x27')]['count'](_0x3cf655)[_0x6e0a('0x21')](function(_0x9ca949){_0x3be8a5[_0x6e0a('0x1c')]=_0x9ca949;if(_0x18b330[_0x6e0a('0x2c')][_0x6e0a('0x39')]){_0x465f5c[_0x6e0a('0x3a')]=[{'all':!![]}];}return db[_0x6e0a('0x27')][_0x6e0a('0x3b')](_0x465f5c);})[_0x6e0a('0x21')](function(_0x36ebfa){_0x3be8a5[_0x6e0a('0x3c')]=_0x36ebfa;return _0x3be8a5;})[_0x6e0a('0x21')](respondWithFilteredResult(_0x4e2279,_0x465f5c))[_0x6e0a('0x3d')](handleError(_0x4e2279,null));};exports[_0x6e0a('0x3e')]=function(_0x2b5a69,_0x4df28d){var _0x16fd16={'raw':![],'where':{'id':_0x2b5a69[_0x6e0a('0x3f')]['id']}},_0x249100={};_0x249100['model']=_[_0x6e0a('0x2d')](db['ServicenowConfiguration']['rawAttributes']);_0x249100[_0x6e0a('0x2c')]=_['keys'](_0x2b5a69[_0x6e0a('0x2c')]);_0x249100[_0x6e0a('0x35')]=_[_0x6e0a('0x2e')](_0x249100[_0x6e0a('0x2a')],_0x249100[_0x6e0a('0x2c')]);_0x16fd16[_0x6e0a('0x2f')]=_[_0x6e0a('0x2e')](_0x249100['model'],qs[_0x6e0a('0x30')](_0x2b5a69[_0x6e0a('0x2c')][_0x6e0a('0x30')]));_0x16fd16[_0x6e0a('0x2f')]=_0x16fd16[_0x6e0a('0x2f')]['length']?_0x16fd16[_0x6e0a('0x2f')]:_0x249100['model'];if(_0x2b5a69[_0x6e0a('0x2c')][_0x6e0a('0x39')]){_0x16fd16['include']=[{'all':!![]}];}_0x16fd16=_['merge']({},_0x16fd16,_0x2b5a69[_0x6e0a('0x40')]);return db[_0x6e0a('0x27')][_0x6e0a('0x41')](_0x16fd16)['then'](handleEntityNotFound(_0x4df28d,null))[_0x6e0a('0x21')](respondWithResult(_0x4df28d,null))[_0x6e0a('0x3d')](handleError(_0x4df28d,null));};exports[_0x6e0a('0x42')]=function(_0x44f52f,_0x57043b){return db[_0x6e0a('0x27')][_0x6e0a('0x42')](_0x44f52f[_0x6e0a('0x43')],{})[_0x6e0a('0x21')](respondWithResult(_0x57043b,0xc9))[_0x6e0a('0x3d')](handleError(_0x57043b,null));};exports['update']=function(_0x3989bb,_0x10993c){if(_0x3989bb['body']['id']){delete _0x3989bb[_0x6e0a('0x43')]['id'];}return db['ServicenowConfiguration'][_0x6e0a('0x41')]({'where':{'id':_0x3989bb[_0x6e0a('0x3f')]['id']}})[_0x6e0a('0x21')](handleEntityNotFound(_0x10993c,null))[_0x6e0a('0x21')](saveUpdates(_0x3989bb['body'],null))['then'](respondWithResult(_0x10993c,null))['catch'](handleError(_0x10993c,null));};exports[_0x6e0a('0x22')]=function(_0x268848,_0xa1c047){return db[_0x6e0a('0x27')][_0x6e0a('0x41')]({'where':{'id':_0x268848[_0x6e0a('0x3f')]['id']}})[_0x6e0a('0x21')](handleEntityNotFound(_0xa1c047,null))['then'](removeEntity(_0xa1c047,null))[_0x6e0a('0x3d')](handleError(_0xa1c047,null));};exports[_0x6e0a('0x44')]=function(_0x327f5d,_0x46ae53,_0x325292){var _0x50d9c4={};var _0x327127={};var _0x3a66ac;var _0xbe7e61;return db[_0x6e0a('0x27')]['findOne']({'where':{'id':_0x327f5d[_0x6e0a('0x3f')]['id']}})[_0x6e0a('0x21')](handleEntityNotFound(_0x46ae53,null))['then'](function(_0x138a6a){if(_0x138a6a){_0x3a66ac=_0x138a6a;_0x327127['model']=_['keys'](db['ServicenowField']['rawAttributes']);_0x327127[_0x6e0a('0x2c')]=_['keys'](_0x327f5d[_0x6e0a('0x2c')]);_0x327127['filters']=_[_0x6e0a('0x2e')](_0x327127[_0x6e0a('0x2a')],_0x327127[_0x6e0a('0x2c')]);_0x50d9c4[_0x6e0a('0x2f')]=_[_0x6e0a('0x2e')](_0x327127[_0x6e0a('0x2a')],qs[_0x6e0a('0x30')](_0x327f5d['query'][_0x6e0a('0x30')]));_0x50d9c4[_0x6e0a('0x2f')]=_0x50d9c4[_0x6e0a('0x2f')]['length']?_0x50d9c4[_0x6e0a('0x2f')]:_0x327127[_0x6e0a('0x2a')];_0x50d9c4['order']=qs['sort'](_0x327f5d[_0x6e0a('0x2c')][_0x6e0a('0x33')]);_0x50d9c4[_0x6e0a('0x34')]=qs[_0x6e0a('0x35')](_[_0x6e0a('0x36')](_0x327f5d[_0x6e0a('0x2c')],_0x327127['filters']));if(_0x327f5d['query'][_0x6e0a('0x37')]){_0x50d9c4[_0x6e0a('0x34')]=_['merge'](_0x50d9c4[_0x6e0a('0x34')],{'$or':_[_0x6e0a('0x2b')](_0x50d9c4[_0x6e0a('0x2f')],function(_0x30e4b1){var _0x4b6c12={};_0x4b6c12[_0x30e4b1]={'$like':'%'+_0x327f5d[_0x6e0a('0x2c')][_0x6e0a('0x37')]+'%'};return _0x4b6c12;})});}_0x50d9c4=_[_0x6e0a('0x45')]({},_0x50d9c4,_0x327f5d[_0x6e0a('0x40')]);return _0x3a66ac[_0x6e0a('0x44')](_0x50d9c4);}})[_0x6e0a('0x21')](function(_0x405743){if(_0x405743){_0xbe7e61=_0x405743['length'];if(!_0x327f5d[_0x6e0a('0x2c')][_0x6e0a('0x46')](_0x6e0a('0x31'))){_0x50d9c4['limit']=qs[_0x6e0a('0x1b')](_0x327f5d['query']['limit']);_0x50d9c4[_0x6e0a('0x1a')]=qs[_0x6e0a('0x1a')](_0x327f5d[_0x6e0a('0x2c')][_0x6e0a('0x1a')]);}return _0x3a66ac[_0x6e0a('0x44')](_0x50d9c4);}})[_0x6e0a('0x21')](function(_0x47f866){if(_0x47f866){return _0x47f866?{'count':_0xbe7e61,'rows':_0x47f866}:null;}})['then'](respondWithResult(_0x46ae53,null))[_0x6e0a('0x3d')](handleError(_0x46ae53,null));};exports['getSubjects']=function(_0x3bdd6a,_0x1d6eec,_0x1b1cbf){var _0x61ed47={};var _0x4e556e={};var _0x1455c6;var _0x3b66ea;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x3bdd6a[_0x6e0a('0x3f')]['id']}})[_0x6e0a('0x21')](handleEntityNotFound(_0x1d6eec,null))[_0x6e0a('0x21')](function(_0x331d6e){if(_0x331d6e){_0x1455c6=_0x331d6e;_0x4e556e[_0x6e0a('0x2a')]=_[_0x6e0a('0x2d')](db[_0x6e0a('0x47')][_0x6e0a('0x28')]);_0x4e556e[_0x6e0a('0x2c')]=_['keys'](_0x3bdd6a[_0x6e0a('0x2c')]);_0x4e556e[_0x6e0a('0x35')]=_[_0x6e0a('0x2e')](_0x4e556e[_0x6e0a('0x2a')],_0x4e556e[_0x6e0a('0x2c')]);_0x61ed47[_0x6e0a('0x2f')]=_['intersection'](_0x4e556e[_0x6e0a('0x2a')],qs['fields'](_0x3bdd6a[_0x6e0a('0x2c')][_0x6e0a('0x30')]));_0x61ed47[_0x6e0a('0x2f')]=_0x61ed47[_0x6e0a('0x2f')]['length']?_0x61ed47[_0x6e0a('0x2f')]:_0x4e556e['model'];_0x61ed47[_0x6e0a('0x32')]=qs[_0x6e0a('0x33')](_0x3bdd6a['query']['sort']);_0x61ed47[_0x6e0a('0x34')]=qs[_0x6e0a('0x35')](_[_0x6e0a('0x36')](_0x3bdd6a[_0x6e0a('0x2c')],_0x4e556e[_0x6e0a('0x35')]));if(_0x3bdd6a['query']['filter']){_0x61ed47[_0x6e0a('0x34')]=_['merge'](_0x61ed47[_0x6e0a('0x34')],{'$or':_[_0x6e0a('0x2b')](_0x61ed47[_0x6e0a('0x2f')],function(_0x1a16c5){var _0x15f6e9={};_0x15f6e9[_0x1a16c5]={'$like':'%'+_0x3bdd6a['query'][_0x6e0a('0x37')]+'%'};return _0x15f6e9;})});}_0x61ed47=_[_0x6e0a('0x45')]({},_0x61ed47,_0x3bdd6a[_0x6e0a('0x40')]);return _0x1455c6[_0x6e0a('0x48')](_0x61ed47);}})[_0x6e0a('0x21')](function(_0x2184aa){if(_0x2184aa){_0x3b66ea=_0x2184aa[_0x6e0a('0x49')];if(!_0x3bdd6a[_0x6e0a('0x2c')][_0x6e0a('0x46')](_0x6e0a('0x31'))){_0x61ed47[_0x6e0a('0x1b')]=qs[_0x6e0a('0x1b')](_0x3bdd6a[_0x6e0a('0x2c')][_0x6e0a('0x1b')]);_0x61ed47[_0x6e0a('0x1a')]=qs[_0x6e0a('0x1a')](_0x3bdd6a[_0x6e0a('0x2c')]['offset']);}return _0x1455c6[_0x6e0a('0x48')](_0x61ed47);}})[_0x6e0a('0x21')](function(_0x49113b){if(_0x49113b){return _0x49113b?{'count':_0x3b66ea,'rows':_0x49113b}:null;}})['then'](respondWithResult(_0x1d6eec,null))[_0x6e0a('0x3d')](handleError(_0x1d6eec,null));};exports['getDescriptions']=function(_0x3f311a,_0x5de40d,_0xa35c84){var _0x4b1622={};var _0xd25a1={};var _0x20ce91;var _0x2de981;return db['ServicenowConfiguration'][_0x6e0a('0x4a')]({'where':{'id':_0x3f311a[_0x6e0a('0x3f')]['id']}})[_0x6e0a('0x21')](handleEntityNotFound(_0x5de40d,null))[_0x6e0a('0x21')](function(_0x2c1c7c){if(_0x2c1c7c){_0x20ce91=_0x2c1c7c;_0xd25a1[_0x6e0a('0x2a')]=_['keys'](db[_0x6e0a('0x47')][_0x6e0a('0x28')]);_0xd25a1[_0x6e0a('0x2c')]=_['keys'](_0x3f311a[_0x6e0a('0x2c')]);_0xd25a1['filters']=_[_0x6e0a('0x2e')](_0xd25a1['model'],_0xd25a1[_0x6e0a('0x2c')]);_0x4b1622[_0x6e0a('0x2f')]=_['intersection'](_0xd25a1[_0x6e0a('0x2a')],qs['fields'](_0x3f311a['query'][_0x6e0a('0x30')]));_0x4b1622[_0x6e0a('0x2f')]=_0x4b1622[_0x6e0a('0x2f')]['length']?_0x4b1622[_0x6e0a('0x2f')]:_0xd25a1['model'];_0x4b1622[_0x6e0a('0x32')]=qs['sort'](_0x3f311a['query']['sort']);_0x4b1622[_0x6e0a('0x34')]=qs[_0x6e0a('0x35')](_[_0x6e0a('0x36')](_0x3f311a[_0x6e0a('0x2c')],_0xd25a1['filters']));if(_0x3f311a[_0x6e0a('0x2c')][_0x6e0a('0x37')]){_0x4b1622[_0x6e0a('0x34')]=_[_0x6e0a('0x45')](_0x4b1622['where'],{'$or':_[_0x6e0a('0x2b')](_0x4b1622['attributes'],function(_0x6833e0){var _0x4a3b48={};_0x4a3b48[_0x6833e0]={'$like':'%'+_0x3f311a[_0x6e0a('0x2c')]['filter']+'%'};return _0x4a3b48;})});}_0x4b1622=_['merge']({},_0x4b1622,_0x3f311a['options']);return _0x20ce91['getDescriptions'](_0x4b1622);}})[_0x6e0a('0x21')](function(_0x3d3ed8){if(_0x3d3ed8){_0x2de981=_0x3d3ed8[_0x6e0a('0x49')];if(!_0x3f311a[_0x6e0a('0x2c')][_0x6e0a('0x46')](_0x6e0a('0x31'))){_0x4b1622['limit']=qs[_0x6e0a('0x1b')](_0x3f311a[_0x6e0a('0x2c')]['limit']);_0x4b1622[_0x6e0a('0x1a')]=qs[_0x6e0a('0x1a')](_0x3f311a[_0x6e0a('0x2c')][_0x6e0a('0x1a')]);}return _0x20ce91[_0x6e0a('0x4b')](_0x4b1622);}})[_0x6e0a('0x21')](function(_0x48e3ea){if(_0x48e3ea){return _0x48e3ea?{'count':_0x2de981,'rows':_0x48e3ea}:null;}})[_0x6e0a('0x21')](respondWithResult(_0x5de40d,null))[_0x6e0a('0x3d')](handleError(_0x5de40d,null));}; \ No newline at end of file +var _0xaea2=['../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ServicenowConfiguration','fieldName','type','model','query','keys','filters','intersection','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','attributes','length','include','find','create','catch','body','getFields','ServicenowField','hasOwnProperty','getSubjects','findOne','getDescriptions','rimraf','request-promise','moment','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x102ff9,_0x907658){var _0x24fa97=function(_0x3622ff){while(--_0x3622ff){_0x102ff9['push'](_0x102ff9['shift']());}};_0x24fa97(++_0x907658);}(_0xaea2,0x1cd));var _0x2aea=function(_0x836c43,_0x5a3808){_0x836c43=_0x836c43-0x0;var _0x3f9fef=_0xaea2[_0x836c43];return _0x3f9fef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2aea('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2aea('0x1'));var moment=require(_0x2aea('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x2aea('0x3'));var util=require('util');var path=require('path');var sox=require(_0x2aea('0x4'));var csv=require('to-csv');var ejs=require(_0x2aea('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2aea('0x6'));var squel=require(_0x2aea('0x7'));var crypto=require(_0x2aea('0x8'));var jsforce=require(_0x2aea('0x9'));var deskjs=require(_0x2aea('0xa'));var toCsv=require(_0x2aea('0xb'));var querystring=require(_0x2aea('0xc'));var Papa=require(_0x2aea('0xd'));var Redis=require(_0x2aea('0xe'));var authService=require(_0x2aea('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2aea('0x10'));var hardwareService=require(_0x2aea('0x11'));var logger=require(_0x2aea('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x2aea('0x13'));var licenseUtil=require(_0x2aea('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ed3f7,_0x29d9ae){_0x29d9ae=_0x29d9ae||0xcc;return function(_0x5344fd){if(_0x5344fd){return _0x3ed3f7[_0x2aea('0x15')](_0x29d9ae);}return _0x3ed3f7[_0x2aea('0x16')](_0x29d9ae)[_0x2aea('0x17')]();};}function respondWithResult(_0x9479d1,_0x2421ff){_0x2421ff=_0x2421ff||0xc8;return function(_0x33db17){if(_0x33db17){return _0x9479d1[_0x2aea('0x16')](_0x2421ff)[_0x2aea('0x18')](_0x33db17);}};}function respondWithFilteredResult(_0x4daffb,_0x2f8707){return function(_0x5b47a6){if(_0x5b47a6){var _0x3c70fd=typeof _0x2f8707[_0x2aea('0x19')]==='undefined'&&typeof _0x2f8707['limit']===_0x2aea('0x1a');var _0x116fdd=_0x5b47a6[_0x2aea('0x1b')];var _0x1c7b43=_0x3c70fd?0x0:_0x2f8707[_0x2aea('0x19')];var _0x530793=_0x3c70fd?_0x5b47a6[_0x2aea('0x1b')]:_0x2f8707[_0x2aea('0x19')]+_0x2f8707[_0x2aea('0x1c')];var _0x3aeae6;if(_0x530793>=_0x116fdd){_0x530793=_0x116fdd;_0x3aeae6=0xc8;}else{_0x3aeae6=0xce;}_0x4daffb[_0x2aea('0x16')](_0x3aeae6);return _0x4daffb[_0x2aea('0x1d')](_0x2aea('0x1e'),_0x1c7b43+'-'+_0x530793+'/'+_0x116fdd)[_0x2aea('0x18')](_0x5b47a6);}return null;};}function patchUpdates(_0x3cd6fd){return function(_0x149559){try{jsonpatch[_0x2aea('0x1f')](_0x149559,_0x3cd6fd,!![]);}catch(_0x50175f){return BPromise[_0x2aea('0x20')](_0x50175f);}return _0x149559[_0x2aea('0x21')]();};}function saveUpdates(_0x2dc7a6,_0xb78d33){return function(_0x5d79fa){if(_0x5d79fa){return _0x5d79fa[_0x2aea('0x22')](_0x2dc7a6)[_0x2aea('0x23')](function(_0x51bcda){return _0x51bcda;});}return null;};}function removeEntity(_0x386238,_0x2d2d21){return function(_0x26ab1a){if(_0x26ab1a){return _0x26ab1a[_0x2aea('0x24')]()[_0x2aea('0x23')](function(){_0x386238[_0x2aea('0x16')](0xcc)[_0x2aea('0x17')]();});}};}function handleEntityNotFound(_0x24c129,_0x2ac211){return function(_0x1d610f){if(!_0x1d610f){_0x24c129[_0x2aea('0x15')](0x194);}return _0x1d610f;};}function handleError(_0x3cd885,_0xbcddcc){_0xbcddcc=_0xbcddcc||0x1f4;return function(_0xd95674){logger[_0x2aea('0x25')](_0xd95674[_0x2aea('0x26')]);if(_0xd95674['name']){delete _0xd95674[_0x2aea('0x27')];}_0x3cd885[_0x2aea('0x16')](_0xbcddcc)[_0x2aea('0x28')](_0xd95674);};}exports[_0x2aea('0x29')]=function(_0x32d6d2,_0x3faf67){var _0xc7f65b={},_0x33c35a={},_0x20d808={'count':0x0,'rows':[]};var _0x34d0fb=_[_0x2aea('0x2a')](db[_0x2aea('0x2b')]['rawAttributes'],function(_0x542804){return{'name':_0x542804[_0x2aea('0x2c')],'type':_0x542804[_0x2aea('0x2d')]['key']};});_0x33c35a[_0x2aea('0x2e')]=_[_0x2aea('0x2a')](_0x34d0fb,_0x2aea('0x27'));_0x33c35a[_0x2aea('0x2f')]=_[_0x2aea('0x30')](_0x32d6d2[_0x2aea('0x2f')]);_0x33c35a[_0x2aea('0x31')]=_['intersection'](_0x33c35a[_0x2aea('0x2e')],_0x33c35a[_0x2aea('0x2f')]);_0xc7f65b['attributes']=_[_0x2aea('0x32')](_0x33c35a[_0x2aea('0x2e')],qs['fields'](_0x32d6d2[_0x2aea('0x2f')][_0x2aea('0x33')]));_0xc7f65b['attributes']=_0xc7f65b['attributes']['length']?_0xc7f65b['attributes']:_0x33c35a[_0x2aea('0x2e')];if(!_0x32d6d2[_0x2aea('0x2f')]['hasOwnProperty'](_0x2aea('0x34'))){_0xc7f65b['limit']=qs[_0x2aea('0x1c')](_0x32d6d2[_0x2aea('0x2f')][_0x2aea('0x1c')]);_0xc7f65b[_0x2aea('0x19')]=qs[_0x2aea('0x19')](_0x32d6d2[_0x2aea('0x2f')][_0x2aea('0x19')]);}_0xc7f65b[_0x2aea('0x35')]=qs[_0x2aea('0x36')](_0x32d6d2[_0x2aea('0x2f')][_0x2aea('0x36')]);_0xc7f65b[_0x2aea('0x37')]=qs['filters'](_[_0x2aea('0x38')](_0x32d6d2[_0x2aea('0x2f')],_0x33c35a[_0x2aea('0x31')]),_0x34d0fb);if(_0x32d6d2[_0x2aea('0x2f')][_0x2aea('0x39')]){_0xc7f65b[_0x2aea('0x37')]=_[_0x2aea('0x3a')](_0xc7f65b[_0x2aea('0x37')],{'$or':_[_0x2aea('0x2a')](_0x34d0fb,function(_0x5dc5a3){if(_0x5dc5a3[_0x2aea('0x2d')]!==_0x2aea('0x3b')){var _0x40d589={};_0x40d589[_0x5dc5a3[_0x2aea('0x27')]]={'$like':'%'+_0x32d6d2['query'][_0x2aea('0x39')]+'%'};return _0x40d589;}})});}_0xc7f65b=_[_0x2aea('0x3a')]({},_0xc7f65b,_0x32d6d2[_0x2aea('0x3c')]);var _0x2e0731={'where':_0xc7f65b[_0x2aea('0x37')]};return db[_0x2aea('0x2b')][_0x2aea('0x1b')](_0x2e0731)['then'](function(_0x30fa3e){_0x20d808['count']=_0x30fa3e;if(_0x32d6d2[_0x2aea('0x2f')][_0x2aea('0x3d')]){_0xc7f65b['include']=[{'all':!![]}];}return db[_0x2aea('0x2b')][_0x2aea('0x3e')](_0xc7f65b);})[_0x2aea('0x23')](function(_0x4ef276){_0x20d808[_0x2aea('0x3f')]=_0x4ef276;return _0x20d808;})[_0x2aea('0x23')](respondWithFilteredResult(_0x3faf67,_0xc7f65b))['catch'](handleError(_0x3faf67,null));};exports[_0x2aea('0x40')]=function(_0x43cf50,_0xb3c353){var _0x11d10e={'raw':![],'where':{'id':_0x43cf50[_0x2aea('0x41')]['id']}},_0x1aef58={};_0x1aef58[_0x2aea('0x2e')]=_[_0x2aea('0x30')](db[_0x2aea('0x2b')][_0x2aea('0x42')]);_0x1aef58[_0x2aea('0x2f')]=_['keys'](_0x43cf50[_0x2aea('0x2f')]);_0x1aef58[_0x2aea('0x31')]=_['intersection'](_0x1aef58[_0x2aea('0x2e')],_0x1aef58[_0x2aea('0x2f')]);_0x11d10e['attributes']=_[_0x2aea('0x32')](_0x1aef58[_0x2aea('0x2e')],qs[_0x2aea('0x33')](_0x43cf50[_0x2aea('0x2f')][_0x2aea('0x33')]));_0x11d10e[_0x2aea('0x43')]=_0x11d10e[_0x2aea('0x43')][_0x2aea('0x44')]?_0x11d10e[_0x2aea('0x43')]:_0x1aef58[_0x2aea('0x2e')];if(_0x43cf50['query'][_0x2aea('0x3d')]){_0x11d10e[_0x2aea('0x45')]=[{'all':!![]}];}_0x11d10e=_[_0x2aea('0x3a')]({},_0x11d10e,_0x43cf50['options']);return db[_0x2aea('0x2b')][_0x2aea('0x46')](_0x11d10e)[_0x2aea('0x23')](handleEntityNotFound(_0xb3c353,null))[_0x2aea('0x23')](respondWithResult(_0xb3c353,null))['catch'](handleError(_0xb3c353,null));};exports['create']=function(_0x50e970,_0x1ae82c){return db['ServicenowConfiguration'][_0x2aea('0x47')](_0x50e970['body'],{})['then'](respondWithResult(_0x1ae82c,0xc9))[_0x2aea('0x48')](handleError(_0x1ae82c,null));};exports['update']=function(_0x5885be,_0x36615b){if(_0x5885be[_0x2aea('0x49')]['id']){delete _0x5885be[_0x2aea('0x49')]['id'];}return db[_0x2aea('0x2b')]['find']({'where':{'id':_0x5885be[_0x2aea('0x41')]['id']}})[_0x2aea('0x23')](handleEntityNotFound(_0x36615b,null))[_0x2aea('0x23')](saveUpdates(_0x5885be[_0x2aea('0x49')],null))[_0x2aea('0x23')](respondWithResult(_0x36615b,null))[_0x2aea('0x48')](handleError(_0x36615b,null));};exports[_0x2aea('0x24')]=function(_0x49bf89,_0xb7ddc4){return db['ServicenowConfiguration'][_0x2aea('0x46')]({'where':{'id':_0x49bf89[_0x2aea('0x41')]['id']}})['then'](handleEntityNotFound(_0xb7ddc4,null))['then'](removeEntity(_0xb7ddc4,null))[_0x2aea('0x48')](handleError(_0xb7ddc4,null));};exports[_0x2aea('0x4a')]=function(_0x385d20,_0x4b84fe,_0x233e53){var _0x9e9c1e={};var _0x4a68b3={};var _0x40daab;var _0x3f42f6;return db[_0x2aea('0x2b')]['findOne']({'where':{'id':_0x385d20[_0x2aea('0x41')]['id']}})[_0x2aea('0x23')](handleEntityNotFound(_0x4b84fe,null))['then'](function(_0x26b2ea){if(_0x26b2ea){_0x40daab=_0x26b2ea;_0x4a68b3['model']=_[_0x2aea('0x30')](db[_0x2aea('0x4b')][_0x2aea('0x42')]);_0x4a68b3['query']=_[_0x2aea('0x30')](_0x385d20[_0x2aea('0x2f')]);_0x4a68b3[_0x2aea('0x31')]=_[_0x2aea('0x32')](_0x4a68b3[_0x2aea('0x2e')],_0x4a68b3[_0x2aea('0x2f')]);_0x9e9c1e[_0x2aea('0x43')]=_['intersection'](_0x4a68b3[_0x2aea('0x2e')],qs[_0x2aea('0x33')](_0x385d20[_0x2aea('0x2f')][_0x2aea('0x33')]));_0x9e9c1e[_0x2aea('0x43')]=_0x9e9c1e[_0x2aea('0x43')][_0x2aea('0x44')]?_0x9e9c1e[_0x2aea('0x43')]:_0x4a68b3[_0x2aea('0x2e')];_0x9e9c1e['order']=qs['sort'](_0x385d20[_0x2aea('0x2f')][_0x2aea('0x36')]);_0x9e9c1e['where']=qs[_0x2aea('0x31')](_['pick'](_0x385d20[_0x2aea('0x2f')],_0x4a68b3[_0x2aea('0x31')]));if(_0x385d20[_0x2aea('0x2f')][_0x2aea('0x39')]){_0x9e9c1e[_0x2aea('0x37')]=_[_0x2aea('0x3a')](_0x9e9c1e[_0x2aea('0x37')],{'$or':_['map'](_0x9e9c1e[_0x2aea('0x43')],function(_0x197890){var _0x564573={};_0x564573[_0x197890]={'$like':'%'+_0x385d20[_0x2aea('0x2f')][_0x2aea('0x39')]+'%'};return _0x564573;})});}_0x9e9c1e=_[_0x2aea('0x3a')]({},_0x9e9c1e,_0x385d20['options']);return _0x40daab[_0x2aea('0x4a')](_0x9e9c1e);}})[_0x2aea('0x23')](function(_0x4c4517){if(_0x4c4517){_0x3f42f6=_0x4c4517['length'];if(!_0x385d20['query'][_0x2aea('0x4c')](_0x2aea('0x34'))){_0x9e9c1e['limit']=qs['limit'](_0x385d20[_0x2aea('0x2f')][_0x2aea('0x1c')]);_0x9e9c1e[_0x2aea('0x19')]=qs[_0x2aea('0x19')](_0x385d20[_0x2aea('0x2f')]['offset']);}return _0x40daab['getFields'](_0x9e9c1e);}})[_0x2aea('0x23')](function(_0x19846c){if(_0x19846c){return _0x19846c?{'count':_0x3f42f6,'rows':_0x19846c}:null;}})['then'](respondWithResult(_0x4b84fe,null))['catch'](handleError(_0x4b84fe,null));};exports[_0x2aea('0x4d')]=function(_0x284319,_0x4a35eb,_0x4b09b2){var _0xbce9a8={};var _0x4f492d={};var _0x3ded53;var _0x35f4f0;return db[_0x2aea('0x2b')][_0x2aea('0x4e')]({'where':{'id':_0x284319[_0x2aea('0x41')]['id']}})[_0x2aea('0x23')](handleEntityNotFound(_0x4a35eb,null))['then'](function(_0x281b6b){if(_0x281b6b){_0x3ded53=_0x281b6b;_0x4f492d[_0x2aea('0x2e')]=_[_0x2aea('0x30')](db[_0x2aea('0x4b')][_0x2aea('0x42')]);_0x4f492d['query']=_[_0x2aea('0x30')](_0x284319['query']);_0x4f492d[_0x2aea('0x31')]=_['intersection'](_0x4f492d[_0x2aea('0x2e')],_0x4f492d['query']);_0xbce9a8[_0x2aea('0x43')]=_[_0x2aea('0x32')](_0x4f492d[_0x2aea('0x2e')],qs[_0x2aea('0x33')](_0x284319['query'][_0x2aea('0x33')]));_0xbce9a8['attributes']=_0xbce9a8['attributes'][_0x2aea('0x44')]?_0xbce9a8[_0x2aea('0x43')]:_0x4f492d[_0x2aea('0x2e')];_0xbce9a8['order']=qs[_0x2aea('0x36')](_0x284319['query'][_0x2aea('0x36')]);_0xbce9a8[_0x2aea('0x37')]=qs[_0x2aea('0x31')](_[_0x2aea('0x38')](_0x284319['query'],_0x4f492d[_0x2aea('0x31')]));if(_0x284319[_0x2aea('0x2f')][_0x2aea('0x39')]){_0xbce9a8[_0x2aea('0x37')]=_[_0x2aea('0x3a')](_0xbce9a8[_0x2aea('0x37')],{'$or':_[_0x2aea('0x2a')](_0xbce9a8['attributes'],function(_0x17299b){var _0x12111c={};_0x12111c[_0x17299b]={'$like':'%'+_0x284319[_0x2aea('0x2f')][_0x2aea('0x39')]+'%'};return _0x12111c;})});}_0xbce9a8=_['merge']({},_0xbce9a8,_0x284319[_0x2aea('0x3c')]);return _0x3ded53[_0x2aea('0x4d')](_0xbce9a8);}})[_0x2aea('0x23')](function(_0xaad0d3){if(_0xaad0d3){_0x35f4f0=_0xaad0d3[_0x2aea('0x44')];if(!_0x284319[_0x2aea('0x2f')][_0x2aea('0x4c')]('nolimit')){_0xbce9a8[_0x2aea('0x1c')]=qs[_0x2aea('0x1c')](_0x284319[_0x2aea('0x2f')][_0x2aea('0x1c')]);_0xbce9a8['offset']=qs[_0x2aea('0x19')](_0x284319[_0x2aea('0x2f')][_0x2aea('0x19')]);}return _0x3ded53['getSubjects'](_0xbce9a8);}})[_0x2aea('0x23')](function(_0x4a568a){if(_0x4a568a){return _0x4a568a?{'count':_0x35f4f0,'rows':_0x4a568a}:null;}})[_0x2aea('0x23')](respondWithResult(_0x4a35eb,null))[_0x2aea('0x48')](handleError(_0x4a35eb,null));};exports['getDescriptions']=function(_0x1c315e,_0x29d15e,_0x1e5016){var _0x1a6409={};var _0x3690cd={};var _0x27785f;var _0x48addc;return db[_0x2aea('0x2b')][_0x2aea('0x4e')]({'where':{'id':_0x1c315e[_0x2aea('0x41')]['id']}})[_0x2aea('0x23')](handleEntityNotFound(_0x29d15e,null))[_0x2aea('0x23')](function(_0xcd40be){if(_0xcd40be){_0x27785f=_0xcd40be;_0x3690cd[_0x2aea('0x2e')]=_[_0x2aea('0x30')](db[_0x2aea('0x4b')][_0x2aea('0x42')]);_0x3690cd['query']=_[_0x2aea('0x30')](_0x1c315e['query']);_0x3690cd[_0x2aea('0x31')]=_[_0x2aea('0x32')](_0x3690cd['model'],_0x3690cd[_0x2aea('0x2f')]);_0x1a6409[_0x2aea('0x43')]=_[_0x2aea('0x32')](_0x3690cd['model'],qs[_0x2aea('0x33')](_0x1c315e[_0x2aea('0x2f')][_0x2aea('0x33')]));_0x1a6409[_0x2aea('0x43')]=_0x1a6409['attributes'][_0x2aea('0x44')]?_0x1a6409[_0x2aea('0x43')]:_0x3690cd[_0x2aea('0x2e')];_0x1a6409[_0x2aea('0x35')]=qs[_0x2aea('0x36')](_0x1c315e[_0x2aea('0x2f')][_0x2aea('0x36')]);_0x1a6409[_0x2aea('0x37')]=qs[_0x2aea('0x31')](_[_0x2aea('0x38')](_0x1c315e['query'],_0x3690cd[_0x2aea('0x31')]));if(_0x1c315e[_0x2aea('0x2f')]['filter']){_0x1a6409[_0x2aea('0x37')]=_['merge'](_0x1a6409[_0x2aea('0x37')],{'$or':_[_0x2aea('0x2a')](_0x1a6409[_0x2aea('0x43')],function(_0x426e98){var _0x4b218d={};_0x4b218d[_0x426e98]={'$like':'%'+_0x1c315e['query'][_0x2aea('0x39')]+'%'};return _0x4b218d;})});}_0x1a6409=_[_0x2aea('0x3a')]({},_0x1a6409,_0x1c315e[_0x2aea('0x3c')]);return _0x27785f['getDescriptions'](_0x1a6409);}})[_0x2aea('0x23')](function(_0x5a753b){if(_0x5a753b){_0x48addc=_0x5a753b[_0x2aea('0x44')];if(!_0x1c315e[_0x2aea('0x2f')][_0x2aea('0x4c')](_0x2aea('0x34'))){_0x1a6409['limit']=qs[_0x2aea('0x1c')](_0x1c315e[_0x2aea('0x2f')]['limit']);_0x1a6409['offset']=qs['offset'](_0x1c315e[_0x2aea('0x2f')][_0x2aea('0x19')]);}return _0x27785f[_0x2aea('0x4f')](_0x1a6409);}})[_0x2aea('0x23')](function(_0x534fa2){if(_0x534fa2){return _0x534fa2?{'count':_0x48addc,'rows':_0x534fa2}:null;}})[_0x2aea('0x23')](respondWithResult(_0x29d15e,null))[_0x2aea('0x48')](handleError(_0x29d15e,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 30e7d6f..7c311de 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 _0x87d9=['./intServicenowConfiguration.attributes','exports','define','int_servicenow_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x11f7f1,_0x589933){var _0x13ebfa=function(_0x231d3e){while(--_0x231d3e){_0x11f7f1['push'](_0x11f7f1['shift']());}};_0x13ebfa(++_0x589933);}(_0x87d9,0x143));var _0x987d=function(_0x17749b,_0x4b4e3e){_0x17749b=_0x17749b-0x0;var _0x37ad41=_0x87d9[_0x17749b];return _0x37ad41;};'use strict';var _=require(_0x987d('0x0'));var util=require('util');var logger=require(_0x987d('0x1'))(_0x987d('0x2'));var moment=require(_0x987d('0x3'));var BPromise=require(_0x987d('0x4'));var rp=require(_0x987d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x987d('0x6'));var config=require('../../config/environment');var attributes=require(_0x987d('0x7'));module[_0x987d('0x8')]=function(_0x4b7afc,_0x2abb89){return _0x4b7afc[_0x987d('0x9')]('ServicenowConfiguration',attributes,{'tableName':_0x987d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6da9=['int_servicenow_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./intServicenowConfiguration.attributes','exports','define'];(function(_0x54a761,_0x431fd4){var _0x37d1da=function(_0x5ca617){while(--_0x5ca617){_0x54a761['push'](_0x54a761['shift']());}};_0x37d1da(++_0x431fd4);}(_0x6da9,0x161));var _0x96da=function(_0x26d678,_0x550ce6){_0x26d678=_0x26d678-0x0;var _0x4fecc4=_0x6da9[_0x26d678];return _0x4fecc4;};'use strict';var _=require(_0x96da('0x0'));var util=require(_0x96da('0x1'));var logger=require(_0x96da('0x2'))(_0x96da('0x3'));var moment=require(_0x96da('0x4'));var BPromise=require(_0x96da('0x5'));var rp=require(_0x96da('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x96da('0x7'));module[_0x96da('0x8')]=function(_0x26fdbb,_0x5c4924){return _0x26fdbb[_0x96da('0x9')]('ServicenowConfiguration',attributes,{'tableName':_0x96da('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index e3c651c..48175f2 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 _0x5261=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','lodash','util','moment','bluebird','../../mysqldb'];(function(_0x3d0944,_0x5b3856){var _0x58cc78=function(_0x226203){while(--_0x226203){_0x3d0944['push'](_0x3d0944['shift']());}};_0x58cc78(++_0x5b3856);}(_0x5261,0x164));var _0x1526=function(_0x19b968,_0x3c94a4){_0x19b968=_0x19b968-0x0;var _0x2ad097=_0x5261[_0x19b968];return _0x2ad097;};'use strict';var _=require(_0x1526('0x0'));var util=require(_0x1526('0x1'));var moment=require(_0x1526('0x2'));var BPromise=require(_0x1526('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1526('0x4'))['db'];var utils=require(_0x1526('0x5'));var logger=require(_0x1526('0x6'))(_0x1526('0x7'));var config=require(_0x1526('0x8'));var jayson=require(_0x1526('0x9'));var client=jayson['client'][_0x1526('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16d830,_0x46bf36,_0x584a37){return new BPromise(function(_0x1d768f,_0x4fc838){return client[_0x1526('0xb')](_0x16d830,_0x584a37)[_0x1526('0xc')](function(_0x36e8b2){logger['info'](_0x1526('0xd'),_0x46bf36,_0x1526('0xe'));logger[_0x1526('0xf')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x46bf36,_0x1526('0xe'),JSON['stringify'](_0x36e8b2));if(_0x36e8b2[_0x1526('0x10')]){if(_0x36e8b2['error'][_0x1526('0x11')]===0x1f4){logger[_0x1526('0x10')](_0x1526('0xd'),_0x46bf36,_0x36e8b2[_0x1526('0x10')][_0x1526('0x12')]);return _0x4fc838(_0x36e8b2[_0x1526('0x10')][_0x1526('0x12')]);}logger[_0x1526('0x10')](_0x1526('0xd'),_0x46bf36,_0x36e8b2[_0x1526('0x10')][_0x1526('0x12')]);return _0x1d768f(_0x36e8b2[_0x1526('0x10')]['message']);}else{logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x46bf36,'request\x20sent');_0x1d768f(_0x36e8b2['result']['message']);}})['catch'](function(_0x4ee5ee){logger[_0x1526('0x10')](_0x1526('0xd'),_0x46bf36,_0x4ee5ee);_0x4fc838(_0x4ee5ee);});});} \ No newline at end of file +var _0x044a=['error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x33a727,_0x24368b){var _0x1dec3a=function(_0x494b76){while(--_0x494b76){_0x33a727['push'](_0x33a727['shift']());}};_0x1dec3a(++_0x24368b);}(_0x044a,0x173));var _0xa044=function(_0x55dfa6,_0x4addf3){_0x55dfa6=_0x55dfa6-0x0;var _0x1eb524=_0x044a[_0x55dfa6];return _0x1eb524;};'use strict';var _=require(_0xa044('0x0'));var util=require(_0xa044('0x1'));var moment=require(_0xa044('0x2'));var BPromise=require(_0xa044('0x3'));var rs=require(_0xa044('0x4'));var fs=require('fs');var Redis=require(_0xa044('0x5'));var db=require(_0xa044('0x6'))['db'];var utils=require(_0xa044('0x7'));var logger=require(_0xa044('0x8'))(_0xa044('0x9'));var config=require('../../config/environment');var jayson=require(_0xa044('0xa'));var client=jayson[_0xa044('0xb')][_0xa044('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1c04bb,_0x59b81b,_0xe12f7d){return new BPromise(function(_0x33f556,_0x936b2c){return client[_0xa044('0xd')](_0x1c04bb,_0xe12f7d)['then'](function(_0x3b1dcd){logger[_0xa044('0xe')](_0xa044('0xf'),_0x59b81b,'request\x20sent');logger[_0xa044('0x10')](_0xa044('0x11'),_0x59b81b,_0xa044('0x12'),JSON[_0xa044('0x13')](_0x3b1dcd));if(_0x3b1dcd['error']){if(_0x3b1dcd[_0xa044('0x14')]['code']===0x1f4){logger['error'](_0xa044('0xf'),_0x59b81b,_0x3b1dcd[_0xa044('0x14')][_0xa044('0x15')]);return _0x936b2c(_0x3b1dcd[_0xa044('0x14')][_0xa044('0x15')]);}logger[_0xa044('0x14')](_0xa044('0xf'),_0x59b81b,_0x3b1dcd['error'][_0xa044('0x15')]);return _0x33f556(_0x3b1dcd['error'][_0xa044('0x15')]);}else{logger[_0xa044('0xe')](_0xa044('0xf'),_0x59b81b,_0xa044('0x12'));_0x33f556(_0x3b1dcd[_0xa044('0x16')]['message']);}})['catch'](function(_0x21b78c){logger['error'](_0xa044('0xf'),_0x59b81b,_0x21b78c);_0x936b2c(_0x21b78c);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index dca0d8e..cbb4cad 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 _0xa10b=['post','create','update','delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x2d364e,_0x301c5e){var _0x1b9312=function(_0x1b05bb){while(--_0x1b05bb){_0x2d364e['push'](_0x2d364e['shift']());}};_0x1b9312(++_0x301c5e);}(_0xa10b,0x101));var _0xba10=function(_0x31aef5,_0x3879e6){_0x31aef5=_0x31aef5-0x0;var _0x1b5f22=_0xa10b[_0x31aef5];return _0x1b5f22;};'use strict';var multer=require('multer');var util=require(_0xba10('0x0'));var path=require('path');var timeout=require(_0xba10('0x1'));var express=require(_0xba10('0x2'));var router=express[_0xba10('0x3')]();var fs_extra=require(_0xba10('0x4'));var auth=require(_0xba10('0x5'));var interaction=require(_0xba10('0x6'));var config=require(_0xba10('0x7'));var controller=require('./intServicenowField.controller');router[_0xba10('0x8')]('/',auth[_0xba10('0x9')](),controller[_0xba10('0xa')]);router[_0xba10('0x8')](_0xba10('0xb'),auth[_0xba10('0x9')](),controller[_0xba10('0xc')]);router[_0xba10('0xd')]('/',auth[_0xba10('0x9')](),controller[_0xba10('0xe')]);router['put'](_0xba10('0xb'),auth[_0xba10('0x9')](),controller[_0xba10('0xf')]);router[_0xba10('0x10')](_0xba10('0xb'),auth[_0xba10('0x9')](),controller[_0xba10('0x11')]);module['exports']=router; \ No newline at end of file +var _0x4b2e=['fs-extra','./intServicenowField.controller','isAuthenticated','index','get','/:id','show','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x1f1da1,_0x5b5ee3){var _0xd366f6=function(_0x48dcf0){while(--_0x48dcf0){_0x1f1da1['push'](_0x1f1da1['shift']());}};_0xd366f6(++_0x5b5ee3);}(_0x4b2e,0x1ce));var _0xe4b2=function(_0x2e92b1,_0x340e42){_0x2e92b1=_0x2e92b1-0x0;var _0x4e61b8=_0x4b2e[_0x2e92b1];return _0x4e61b8;};'use strict';var multer=require(_0xe4b2('0x0'));var util=require(_0xe4b2('0x1'));var path=require(_0xe4b2('0x2'));var timeout=require(_0xe4b2('0x3'));var express=require(_0xe4b2('0x4'));var router=express[_0xe4b2('0x5')]();var fs_extra=require(_0xe4b2('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe4b2('0x7'));router['get']('/',auth[_0xe4b2('0x8')](),controller[_0xe4b2('0x9')]);router[_0xe4b2('0xa')](_0xe4b2('0xb'),auth[_0xe4b2('0x8')](),controller[_0xe4b2('0xc')]);router[_0xe4b2('0xd')]('/',auth[_0xe4b2('0x8')](),controller[_0xe4b2('0xe')]);router['put'](_0xe4b2('0xb'),auth[_0xe4b2('0x8')](),controller[_0xe4b2('0xf')]);router[_0xe4b2('0x10')](_0xe4b2('0xb'),auth[_0xe4b2('0x8')](),controller['destroy']);module[_0xe4b2('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 3a42ed3..676b32c 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 _0xd7f0=['STRING','ENUM','BOOLEAN','variable','customVariable','keyValue','string'];(function(_0x1ca29f,_0x318ac5){var _0x576c3b=function(_0x40caab){while(--_0x40caab){_0x1ca29f['push'](_0x1ca29f['shift']());}};_0x576c3b(++_0x318ac5);}(_0xd7f0,0x1df));var _0x0d7f=function(_0x5d1e8e,_0x1afedd){_0x5d1e8e=_0x5d1e8e-0x0;var _0x2bee33=_0xd7f0[_0x5d1e8e];return _0x2bee33;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM']('string',_0x0d7f('0x0'),_0x0d7f('0x1'),_0x0d7f('0x2'),'picklist'),'defaultValue':_0x0d7f('0x3')},'content':{'type':Sequelize[_0x0d7f('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0d7f('0x5')](_0x0d7f('0x3'),_0x0d7f('0x0'),'customVariable')},'keyContent':{'type':Sequelize[_0x0d7f('0x4')]},'idField':{'type':Sequelize[_0x0d7f('0x4')]},'nameField':{'type':Sequelize[_0x0d7f('0x4')]},'customField':{'type':Sequelize[_0x0d7f('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe989=['sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN'];(function(_0x126a50,_0x456371){var _0x47ffc3=function(_0x57022e){while(--_0x57022e){_0x126a50['push'](_0x126a50['shift']());}};_0x47ffc3(++_0x456371);}(_0xe989,0x168));var _0x9e98=function(_0x23f0dc,_0x525f0a){_0x23f0dc=_0x23f0dc-0x0;var _0x55cdf2=_0xe989[_0x23f0dc];return _0x55cdf2;};'use strict';var Sequelize=require(_0x9e98('0x0'));module[_0x9e98('0x1')]={'type':{'type':Sequelize['ENUM'](_0x9e98('0x2'),_0x9e98('0x3'),_0x9e98('0x4'),_0x9e98('0x5'),_0x9e98('0x6')),'defaultValue':_0x9e98('0x2')},'content':{'type':Sequelize[_0x9e98('0x7')]},'key':{'type':Sequelize[_0x9e98('0x7')]},'keyType':{'type':Sequelize[_0x9e98('0x8')](_0x9e98('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x9e98('0x7')]},'idField':{'type':Sequelize[_0x9e98('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9e98('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 92d083d..694e5d0 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 _0xccbb=['set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x2847d0,_0x10a787){var _0x1cc209=function(_0x3863ff){while(--_0x3863ff){_0x2847d0['push'](_0x2847d0['shift']());}};_0x1cc209(++_0x10a787);}(_0xccbb,0x169));var _0xbccb=function(_0x4726c5,_0x289849){_0x4726c5=_0x4726c5-0x0;var _0x475d80=_0xccbb[_0x4726c5];return _0x475d80;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbccb('0x0'));var zipdir=require(_0xbccb('0x1'));var jsonpatch=require(_0xbccb('0x2'));var rp=require(_0xbccb('0x3'));var moment=require(_0xbccb('0x4'));var BPromise=require(_0xbccb('0x5'));var Mustache=require(_0xbccb('0x6'));var util=require(_0xbccb('0x7'));var path=require(_0xbccb('0x8'));var sox=require(_0xbccb('0x9'));var csv=require(_0xbccb('0xa'));var ejs=require(_0xbccb('0xb'));var fs=require('fs');var fs_extra=require(_0xbccb('0xc'));var _=require(_0xbccb('0xd'));var squel=require(_0xbccb('0xe'));var crypto=require(_0xbccb('0xf'));var jsforce=require(_0xbccb('0x10'));var deskjs=require(_0xbccb('0x11'));var toCsv=require(_0xbccb('0xa'));var querystring=require(_0xbccb('0x12'));var Papa=require('papaparse');var Redis=require(_0xbccb('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbccb('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbccb('0x15'))(_0xbccb('0x16'));var utils=require('../../config/utils');var config=require(_0xbccb('0x17'));var licenseUtil=require(_0xbccb('0x18'));var db=require(_0xbccb('0x19'))['db'];function respondWithStatusCode(_0x1833a2,_0x58203a){_0x58203a=_0x58203a||0xcc;return function(_0x2ca633){if(_0x2ca633){return _0x1833a2[_0xbccb('0x1a')](_0x58203a);}return _0x1833a2[_0xbccb('0x1b')](_0x58203a)[_0xbccb('0x1c')]();};}function respondWithResult(_0x32edc4,_0x166646){_0x166646=_0x166646||0xc8;return function(_0x2bb7af){if(_0x2bb7af){return _0x32edc4[_0xbccb('0x1b')](_0x166646)[_0xbccb('0x1d')](_0x2bb7af);}};}function respondWithFilteredResult(_0xeb3025,_0xd0d786){return function(_0x1fdafd){if(_0x1fdafd){var _0x59d9c7=typeof _0xd0d786[_0xbccb('0x1e')]==='undefined'&&typeof _0xd0d786['limit']===_0xbccb('0x1f');var _0x4d6c94=_0x1fdafd['count'];var _0x13d414=_0x59d9c7?0x0:_0xd0d786[_0xbccb('0x1e')];var _0x12ffe7=_0x59d9c7?_0x1fdafd[_0xbccb('0x20')]:_0xd0d786['offset']+_0xd0d786[_0xbccb('0x21')];var _0x5de27a;if(_0x12ffe7>=_0x4d6c94){_0x12ffe7=_0x4d6c94;_0x5de27a=0xc8;}else{_0x5de27a=0xce;}_0xeb3025[_0xbccb('0x1b')](_0x5de27a);return _0xeb3025[_0xbccb('0x22')](_0xbccb('0x23'),_0x13d414+'-'+_0x12ffe7+'/'+_0x4d6c94)['json'](_0x1fdafd);}return null;};}function patchUpdates(_0x4be698){return function(_0xeafa67){try{jsonpatch[_0xbccb('0x24')](_0xeafa67,_0x4be698,!![]);}catch(_0x52e0f5){return BPromise[_0xbccb('0x25')](_0x52e0f5);}return _0xeafa67[_0xbccb('0x26')]();};}function saveUpdates(_0x4114a6,_0x3db3d2){return function(_0x3b2d82){if(_0x3b2d82){return _0x3b2d82[_0xbccb('0x27')](_0x4114a6)[_0xbccb('0x28')](function(_0x1087fd){return _0x1087fd;});}return null;};}function removeEntity(_0x373a37,_0xdd2e04){return function(_0x23ac6a){if(_0x23ac6a){return _0x23ac6a[_0xbccb('0x29')]()[_0xbccb('0x28')](function(){_0x373a37[_0xbccb('0x1b')](0xcc)[_0xbccb('0x1c')]();});}};}function handleEntityNotFound(_0x57432c,_0x499560){return function(_0x309b9e){if(!_0x309b9e){_0x57432c[_0xbccb('0x1a')](0x194);}return _0x309b9e;};}function handleError(_0x5f2167,_0x442e9d){_0x442e9d=_0x442e9d||0x1f4;return function(_0x557d2d){logger[_0xbccb('0x2a')](_0x557d2d[_0xbccb('0x2b')]);if(_0x557d2d['name']){delete _0x557d2d[_0xbccb('0x2c')];}_0x5f2167[_0xbccb('0x1b')](_0x442e9d)[_0xbccb('0x2d')](_0x557d2d);};}exports[_0xbccb('0x2e')]=function(_0x34e9d4,_0x4b3391){var _0x118384={},_0x808259={},_0xff0be0={'count':0x0,'rows':[]};var _0x3a61ce=_[_0xbccb('0x2f')](db[_0xbccb('0x30')][_0xbccb('0x31')],function(_0x413efb){return{'name':_0x413efb[_0xbccb('0x32')],'type':_0x413efb[_0xbccb('0x33')][_0xbccb('0x34')]};});_0x808259[_0xbccb('0x35')]=_['map'](_0x3a61ce,_0xbccb('0x2c'));_0x808259[_0xbccb('0x36')]=_[_0xbccb('0x37')](_0x34e9d4[_0xbccb('0x36')]);_0x808259['filters']=_[_0xbccb('0x38')](_0x808259[_0xbccb('0x35')],_0x808259[_0xbccb('0x36')]);_0x118384[_0xbccb('0x39')]=_[_0xbccb('0x38')](_0x808259[_0xbccb('0x35')],qs['fields'](_0x34e9d4[_0xbccb('0x36')][_0xbccb('0x3a')]));_0x118384['attributes']=_0x118384[_0xbccb('0x39')][_0xbccb('0x3b')]?_0x118384[_0xbccb('0x39')]:_0x808259[_0xbccb('0x35')];if(!_0x34e9d4[_0xbccb('0x36')][_0xbccb('0x3c')]('nolimit')){_0x118384[_0xbccb('0x21')]=qs[_0xbccb('0x21')](_0x34e9d4['query'][_0xbccb('0x21')]);_0x118384[_0xbccb('0x1e')]=qs[_0xbccb('0x1e')](_0x34e9d4[_0xbccb('0x36')][_0xbccb('0x1e')]);}_0x118384[_0xbccb('0x3d')]=qs[_0xbccb('0x3e')](_0x34e9d4[_0xbccb('0x36')][_0xbccb('0x3e')]);_0x118384[_0xbccb('0x3f')]=qs[_0xbccb('0x40')](_[_0xbccb('0x41')](_0x34e9d4[_0xbccb('0x36')],_0x808259[_0xbccb('0x40')]),_0x3a61ce);if(_0x34e9d4[_0xbccb('0x36')][_0xbccb('0x42')]){_0x118384[_0xbccb('0x3f')]=_[_0xbccb('0x43')](_0x118384[_0xbccb('0x3f')],{'$or':_[_0xbccb('0x2f')](_0x3a61ce,function(_0x5e2373){if(_0x5e2373[_0xbccb('0x33')]!==_0xbccb('0x44')){var _0x3c2a8b={};_0x3c2a8b[_0x5e2373[_0xbccb('0x2c')]]={'$like':'%'+_0x34e9d4['query'][_0xbccb('0x42')]+'%'};return _0x3c2a8b;}})});}_0x118384=_[_0xbccb('0x43')]({},_0x118384,_0x34e9d4[_0xbccb('0x45')]);var _0x4a99fa={'where':_0x118384[_0xbccb('0x3f')]};return db[_0xbccb('0x30')][_0xbccb('0x20')](_0x4a99fa)['then'](function(_0x594747){_0xff0be0['count']=_0x594747;if(_0x34e9d4[_0xbccb('0x36')][_0xbccb('0x46')]){_0x118384[_0xbccb('0x47')]=[{'all':!![]}];}return db[_0xbccb('0x30')][_0xbccb('0x48')](_0x118384);})['then'](function(_0x8ff009){_0xff0be0[_0xbccb('0x49')]=_0x8ff009;return _0xff0be0;})[_0xbccb('0x28')](respondWithFilteredResult(_0x4b3391,_0x118384))[_0xbccb('0x4a')](handleError(_0x4b3391,null));};exports['show']=function(_0x30e7e3,_0x56a404){var _0x2c1116={'raw':!![],'where':{'id':_0x30e7e3[_0xbccb('0x4b')]['id']}},_0x3118b1={};_0x3118b1[_0xbccb('0x35')]=_['keys'](db[_0xbccb('0x30')][_0xbccb('0x31')]);_0x3118b1[_0xbccb('0x36')]=_[_0xbccb('0x37')](_0x30e7e3[_0xbccb('0x36')]);_0x3118b1[_0xbccb('0x40')]=_[_0xbccb('0x38')](_0x3118b1[_0xbccb('0x35')],_0x3118b1[_0xbccb('0x36')]);_0x2c1116[_0xbccb('0x39')]=_['intersection'](_0x3118b1[_0xbccb('0x35')],qs[_0xbccb('0x3a')](_0x30e7e3['query'][_0xbccb('0x3a')]));_0x2c1116['attributes']=_0x2c1116['attributes'][_0xbccb('0x3b')]?_0x2c1116['attributes']:_0x3118b1[_0xbccb('0x35')];if(_0x30e7e3[_0xbccb('0x36')][_0xbccb('0x46')]){_0x2c1116[_0xbccb('0x47')]=[{'all':!![]}];}_0x2c1116=_[_0xbccb('0x43')]({},_0x2c1116,_0x30e7e3[_0xbccb('0x45')]);return db[_0xbccb('0x30')][_0xbccb('0x4c')](_0x2c1116)[_0xbccb('0x28')](handleEntityNotFound(_0x56a404,null))['then'](respondWithResult(_0x56a404,null))['catch'](handleError(_0x56a404,null));};exports[_0xbccb('0x4d')]=function(_0x345934,_0x4b0bb0){return db[_0xbccb('0x30')][_0xbccb('0x4d')](_0x345934[_0xbccb('0x4e')],{})['then'](respondWithResult(_0x4b0bb0,0xc9))[_0xbccb('0x4a')](handleError(_0x4b0bb0,null));};exports[_0xbccb('0x27')]=function(_0x3a3488,_0x5688c1){if(_0x3a3488[_0xbccb('0x4e')]['id']){delete _0x3a3488[_0xbccb('0x4e')]['id'];}return db['ServicenowField'][_0xbccb('0x4c')]({'where':{'id':_0x3a3488[_0xbccb('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5688c1,null))['then'](saveUpdates(_0x3a3488[_0xbccb('0x4e')],null))[_0xbccb('0x28')](respondWithResult(_0x5688c1,null))[_0xbccb('0x4a')](handleError(_0x5688c1,null));};exports[_0xbccb('0x29')]=function(_0x3b3fc3,_0x2f7868){return db['ServicenowField'][_0xbccb('0x4c')]({'where':{'id':_0x3b3fc3['params']['id']}})[_0xbccb('0x28')](handleEntityNotFound(_0x2f7868,null))[_0xbccb('0x28')](removeEntity(_0x2f7868,null))[_0xbccb('0x4a')](handleError(_0x2f7868,null));}; \ No newline at end of file +var _0x57f2=['filter','merge','VIRTUAL','ServicenowField','includeAll','include','show','params','keys','rawAttributes','length','options','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x212104,_0xd990f0){var _0xe68afb=function(_0x658915){while(--_0x658915){_0x212104['push'](_0x212104['shift']());}};_0xe68afb(++_0xd990f0);}(_0x57f2,0x145));var _0x257f=function(_0x4e3c6d,_0x2e932a){_0x4e3c6d=_0x4e3c6d-0x0;var _0x1f5aae=_0x57f2[_0x4e3c6d];return _0x1f5aae;};'use strict';var emlformat=require(_0x257f('0x0'));var rimraf=require(_0x257f('0x1'));var zipdir=require(_0x257f('0x2'));var jsonpatch=require(_0x257f('0x3'));var rp=require('request-promise');var moment=require(_0x257f('0x4'));var BPromise=require(_0x257f('0x5'));var Mustache=require(_0x257f('0x6'));var util=require('util');var path=require(_0x257f('0x7'));var sox=require(_0x257f('0x8'));var csv=require(_0x257f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x257f('0xa'));var _=require(_0x257f('0xb'));var squel=require(_0x257f('0xc'));var crypto=require(_0x257f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x257f('0xe'));var toCsv=require(_0x257f('0x9'));var querystring=require(_0x257f('0xf'));var Papa=require('papaparse');var Redis=require(_0x257f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x257f('0x11'));var as=require(_0x257f('0x12'));var hardwareService=require(_0x257f('0x13'));var logger=require(_0x257f('0x14'))('api');var utils=require(_0x257f('0x15'));var config=require(_0x257f('0x16'));var licenseUtil=require(_0x257f('0x17'));var db=require(_0x257f('0x18'))['db'];function respondWithStatusCode(_0xd81a99,_0x286e41){_0x286e41=_0x286e41||0xcc;return function(_0x2fd8a3){if(_0x2fd8a3){return _0xd81a99['sendStatus'](_0x286e41);}return _0xd81a99[_0x257f('0x19')](_0x286e41)[_0x257f('0x1a')]();};}function respondWithResult(_0x1cd6b1,_0x7dc4c5){_0x7dc4c5=_0x7dc4c5||0xc8;return function(_0xf2e9ef){if(_0xf2e9ef){return _0x1cd6b1[_0x257f('0x19')](_0x7dc4c5)[_0x257f('0x1b')](_0xf2e9ef);}};}function respondWithFilteredResult(_0xbfc692,_0x5a85c8){return function(_0x22eedc){if(_0x22eedc){var _0x470865=typeof _0x5a85c8[_0x257f('0x1c')]===_0x257f('0x1d')&&typeof _0x5a85c8[_0x257f('0x1e')]===_0x257f('0x1d');var _0x760cbb=_0x22eedc[_0x257f('0x1f')];var _0x8f5047=_0x470865?0x0:_0x5a85c8[_0x257f('0x1c')];var _0x541825=_0x470865?_0x22eedc['count']:_0x5a85c8[_0x257f('0x1c')]+_0x5a85c8[_0x257f('0x1e')];var _0x1be651;if(_0x541825>=_0x760cbb){_0x541825=_0x760cbb;_0x1be651=0xc8;}else{_0x1be651=0xce;}_0xbfc692['status'](_0x1be651);return _0xbfc692['set'](_0x257f('0x20'),_0x8f5047+'-'+_0x541825+'/'+_0x760cbb)['json'](_0x22eedc);}return null;};}function patchUpdates(_0xd5e879){return function(_0x258b0f){try{jsonpatch[_0x257f('0x21')](_0x258b0f,_0xd5e879,!![]);}catch(_0x19d79b){return BPromise[_0x257f('0x22')](_0x19d79b);}return _0x258b0f[_0x257f('0x23')]();};}function saveUpdates(_0x46e599,_0x394ab0){return function(_0x5b5e7f){if(_0x5b5e7f){return _0x5b5e7f[_0x257f('0x24')](_0x46e599)[_0x257f('0x25')](function(_0x502a54){return _0x502a54;});}return null;};}function removeEntity(_0xdc48b8,_0x1da3fb){return function(_0x23138b){if(_0x23138b){return _0x23138b['destroy']()[_0x257f('0x25')](function(){_0xdc48b8[_0x257f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34413a,_0x58d261){return function(_0x1af31){if(!_0x1af31){_0x34413a[_0x257f('0x26')](0x194);}return _0x1af31;};}function handleError(_0xdfb59c,_0x3f58a){_0x3f58a=_0x3f58a||0x1f4;return function(_0x3a8761){logger[_0x257f('0x27')](_0x3a8761[_0x257f('0x28')]);if(_0x3a8761[_0x257f('0x29')]){delete _0x3a8761['name'];}_0xdfb59c[_0x257f('0x19')](_0x3f58a)[_0x257f('0x2a')](_0x3a8761);};}exports[_0x257f('0x2b')]=function(_0x22be15,_0x14fa97){var _0x3cca7a={},_0x3c903b={},_0x4023b0={'count':0x0,'rows':[]};var _0x16a9c0=_[_0x257f('0x2c')](db['ServicenowField']['rawAttributes'],function(_0x59911a){return{'name':_0x59911a[_0x257f('0x2d')],'type':_0x59911a[_0x257f('0x2e')][_0x257f('0x2f')]};});_0x3c903b[_0x257f('0x30')]=_[_0x257f('0x2c')](_0x16a9c0,'name');_0x3c903b[_0x257f('0x31')]=_['keys'](_0x22be15[_0x257f('0x31')]);_0x3c903b[_0x257f('0x32')]=_[_0x257f('0x33')](_0x3c903b[_0x257f('0x30')],_0x3c903b['query']);_0x3cca7a[_0x257f('0x34')]=_[_0x257f('0x33')](_0x3c903b[_0x257f('0x30')],qs[_0x257f('0x35')](_0x22be15['query'][_0x257f('0x35')]));_0x3cca7a[_0x257f('0x34')]=_0x3cca7a[_0x257f('0x34')]['length']?_0x3cca7a[_0x257f('0x34')]:_0x3c903b[_0x257f('0x30')];if(!_0x22be15[_0x257f('0x31')][_0x257f('0x36')](_0x257f('0x37'))){_0x3cca7a['limit']=qs[_0x257f('0x1e')](_0x22be15['query'][_0x257f('0x1e')]);_0x3cca7a[_0x257f('0x1c')]=qs[_0x257f('0x1c')](_0x22be15[_0x257f('0x31')][_0x257f('0x1c')]);}_0x3cca7a[_0x257f('0x38')]=qs[_0x257f('0x39')](_0x22be15[_0x257f('0x31')]['sort']);_0x3cca7a[_0x257f('0x3a')]=qs[_0x257f('0x32')](_[_0x257f('0x3b')](_0x22be15[_0x257f('0x31')],_0x3c903b[_0x257f('0x32')]),_0x16a9c0);if(_0x22be15[_0x257f('0x31')][_0x257f('0x3c')]){_0x3cca7a[_0x257f('0x3a')]=_[_0x257f('0x3d')](_0x3cca7a[_0x257f('0x3a')],{'$or':_[_0x257f('0x2c')](_0x16a9c0,function(_0x12c00a){if(_0x12c00a[_0x257f('0x2e')]!==_0x257f('0x3e')){var _0x5cd489={};_0x5cd489[_0x12c00a[_0x257f('0x29')]]={'$like':'%'+_0x22be15[_0x257f('0x31')][_0x257f('0x3c')]+'%'};return _0x5cd489;}})});}_0x3cca7a=_['merge']({},_0x3cca7a,_0x22be15['options']);var _0x588856={'where':_0x3cca7a[_0x257f('0x3a')]};return db[_0x257f('0x3f')][_0x257f('0x1f')](_0x588856)[_0x257f('0x25')](function(_0x474b15){_0x4023b0[_0x257f('0x1f')]=_0x474b15;if(_0x22be15[_0x257f('0x31')][_0x257f('0x40')]){_0x3cca7a[_0x257f('0x41')]=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0x3cca7a);})[_0x257f('0x25')](function(_0x52ed7){_0x4023b0['rows']=_0x52ed7;return _0x4023b0;})[_0x257f('0x25')](respondWithFilteredResult(_0x14fa97,_0x3cca7a))['catch'](handleError(_0x14fa97,null));};exports[_0x257f('0x42')]=function(_0x223ca9,_0x2ddb9c){var _0x594cd1={'raw':!![],'where':{'id':_0x223ca9[_0x257f('0x43')]['id']}},_0x1da5e0={};_0x1da5e0['model']=_[_0x257f('0x44')](db['ServicenowField'][_0x257f('0x45')]);_0x1da5e0[_0x257f('0x31')]=_[_0x257f('0x44')](_0x223ca9[_0x257f('0x31')]);_0x1da5e0[_0x257f('0x32')]=_['intersection'](_0x1da5e0[_0x257f('0x30')],_0x1da5e0[_0x257f('0x31')]);_0x594cd1[_0x257f('0x34')]=_[_0x257f('0x33')](_0x1da5e0[_0x257f('0x30')],qs[_0x257f('0x35')](_0x223ca9[_0x257f('0x31')]['fields']));_0x594cd1[_0x257f('0x34')]=_0x594cd1[_0x257f('0x34')][_0x257f('0x46')]?_0x594cd1[_0x257f('0x34')]:_0x1da5e0[_0x257f('0x30')];if(_0x223ca9[_0x257f('0x31')][_0x257f('0x40')]){_0x594cd1['include']=[{'all':!![]}];}_0x594cd1=_[_0x257f('0x3d')]({},_0x594cd1,_0x223ca9[_0x257f('0x47')]);return db[_0x257f('0x3f')][_0x257f('0x48')](_0x594cd1)[_0x257f('0x25')](handleEntityNotFound(_0x2ddb9c,null))['then'](respondWithResult(_0x2ddb9c,null))[_0x257f('0x49')](handleError(_0x2ddb9c,null));};exports[_0x257f('0x4a')]=function(_0x3159d5,_0x5dcd2c){return db[_0x257f('0x3f')]['create'](_0x3159d5[_0x257f('0x4b')],{})[_0x257f('0x25')](respondWithResult(_0x5dcd2c,0xc9))['catch'](handleError(_0x5dcd2c,null));};exports[_0x257f('0x24')]=function(_0x182556,_0x51cf8c){if(_0x182556[_0x257f('0x4b')]['id']){delete _0x182556[_0x257f('0x4b')]['id'];}return db['ServicenowField'][_0x257f('0x48')]({'where':{'id':_0x182556[_0x257f('0x43')]['id']}})[_0x257f('0x25')](handleEntityNotFound(_0x51cf8c,null))[_0x257f('0x25')](saveUpdates(_0x182556['body'],null))[_0x257f('0x25')](respondWithResult(_0x51cf8c,null))['catch'](handleError(_0x51cf8c,null));};exports[_0x257f('0x4c')]=function(_0x229c65,_0x3eb478){return db[_0x257f('0x3f')][_0x257f('0x48')]({'where':{'id':_0x229c65[_0x257f('0x43')]['id']}})[_0x257f('0x25')](handleEntityNotFound(_0x3eb478,null))['then'](removeEntity(_0x3eb478,null))['catch'](handleError(_0x3eb478,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 6e3af69..73e2b2d 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 _0x096c=['FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./intServicenowField.attributes','exports','ServicenowField','servicenow_unique_index','idField'];(function(_0x39e1e1,_0xf4f793){var _0x1f3737=function(_0x300bc1){while(--_0x300bc1){_0x39e1e1['push'](_0x39e1e1['shift']());}};_0x1f3737(++_0xf4f793);}(_0x096c,0x1a5));var _0xc096=function(_0x3cb56f,_0x13bfe2){_0x3cb56f=_0x3cb56f-0x0;var _0x4af176=_0x096c[_0x3cb56f];return _0x4af176;};'use strict';var _=require(_0xc096('0x0'));var util=require(_0xc096('0x1'));var logger=require(_0xc096('0x2'))(_0xc096('0x3'));var moment=require(_0xc096('0x4'));var BPromise=require('bluebird');var rp=require(_0xc096('0x5'));var fs=require('fs');var path=require(_0xc096('0x6'));var rimraf=require(_0xc096('0x7'));var config=require('../../config/environment');var attributes=require(_0xc096('0x8'));module[_0xc096('0x9')]=function(_0x3e48ae,_0x4cf4f5){return _0x3e48ae['define'](_0xc096('0xa'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0xc096('0xb'),'fields':[_0xc096('0xc'),_0xc096('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdeab=['./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','FieldId','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x24cf28,_0x5101ca){var _0x1ed1d1=function(_0x32ba99){while(--_0x32ba99){_0x24cf28['push'](_0x24cf28['shift']());}};_0x1ed1d1(++_0x5101ca);}(_0xdeab,0x12d));var _0xbdea=function(_0x1b43fb,_0x169e3a){_0x1b43fb=_0x1b43fb-0x0;var _0x31f43e=_0xdeab[_0x1b43fb];return _0x31f43e;};'use strict';var _=require(_0xbdea('0x0'));var util=require(_0xbdea('0x1'));var logger=require('../../config/logger')(_0xbdea('0x2'));var moment=require(_0xbdea('0x3'));var BPromise=require(_0xbdea('0x4'));var rp=require(_0xbdea('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbdea('0x6'));var config=require('../../config/environment');var attributes=require(_0xbdea('0x7'));module[_0xbdea('0x8')]=function(_0x24f648,_0xbdf46f){return _0x24f648[_0xbdea('0x9')](_0xbdea('0xa'),attributes,{'tableName':_0xbdea('0xb'),'paranoid':![],'indexes':[{'name':_0xbdea('0xc'),'fields':['idField',_0xbdea('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 6114f56..8f3977a 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 _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x25f0ea,_0xd6d029){var _0x275268=function(_0x35492a){while(--_0x35492a){_0x25f0ea['push'](_0x25f0ea['shift']());}};_0x275268(++_0xd6d029);}(_0xaa88,0x137));var _0x8aa8=function(_0x51d71a,_0x596fda){_0x51d71a=_0x51d71a-0x0;var _0xff01f1=_0xaa88[_0x51d71a];return _0xff01f1;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file +var _0xda3f=['rpc','jayson/promise','client','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x1663ae,_0x10484a){var _0x30ffb8=function(_0x21e006){while(--_0x21e006){_0x1663ae['push'](_0x1663ae['shift']());}};_0x30ffb8(++_0x10484a);}(_0xda3f,0xec));var _0xfda3=function(_0x313c9d,_0x60022b){_0x313c9d=_0x313c9d-0x0;var _0xb0378c=_0xda3f[_0x313c9d];return _0xb0378c;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index bd7e0b8..abbd114 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(_0x3f2736,_0x2d3e94){var _0x30338a=function(_0x2c3f8a){while(--_0x2c3f8a){_0x3f2736['push'](_0x3f2736['shift']());}};_0x30338a(++_0x2d3e94);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _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(_0x14372c,_0x52ebed){var _0x331222=function(_0x54ba64){while(--_0x54ba64){_0x14372c['push'](_0x14372c['shift']());}};_0x331222(++_0x52ebed);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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 4a8606f..def7254 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(_0x1c5717,_0x1650a2){var _0x4b379f=function(_0x1d3fce){while(--_0x1d3fce){_0x1c5717['push'](_0x1c5717['shift']());}};_0x4b379f(++_0x1650a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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(_0x240d00,_0x2bb22d){var _0x3d7a9b=function(_0x3e22ed){while(--_0x3e22ed){_0x240d00['push'](_0x240d00['shift']());}};_0x3d7a9b(++_0x2bb22d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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 9c70334..480b574 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 _0xf98a=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','end','sendStatus','error','name','send','index','SugarcrmAccount','rawAttributes','fieldName','type','model','map','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','order','addConfiguration','getSubjects','channel','SugarcrmField','Subjects','Descriptions','getFields','assigned_user_id','created_by','description','date_start','duration_hours','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','lastIndexOf','format','%s%s','login','JSON','stringify','POST','/service/v4_1/rest.php','get_module_fields','Calls','values','module_fields','remove','includes','label','endsWith','value','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','zip-dir','fast-json-patch','request-promise','mustache','path','sox'];(function(_0x78c672,_0x252c61){var _0x3c9232=function(_0x3901fd){while(--_0x3901fd){_0x78c672['push'](_0x78c672['shift']());}};_0x3c9232(++_0x252c61);}(_0xf98a,0x162));var _0xaf98=function(_0x5e6bec,_0x1eb54d){_0x5e6bec=_0x5e6bec-0x0;var _0x5dc5cf=_0xf98a[_0x5e6bec];return _0x5dc5cf;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xaf98('0x0'));var jsonpatch=require(_0xaf98('0x1'));var rp=require(_0xaf98('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xaf98('0x3'));var util=require('util');var path=require(_0xaf98('0x4'));var sox=require(_0xaf98('0x5'));var csv=require(_0xaf98('0x6'));var ejs=require(_0xaf98('0x7'));var fs=require('fs');var fs_extra=require(_0xaf98('0x8'));var _=require(_0xaf98('0x9'));var squel=require(_0xaf98('0xa'));var crypto=require(_0xaf98('0xb'));var jsforce=require(_0xaf98('0xc'));var deskjs=require(_0xaf98('0xd'));var toCsv=require(_0xaf98('0x6'));var querystring=require(_0xaf98('0xe'));var Papa=require(_0xaf98('0xf'));var Redis=require('ioredis');var authService=require(_0xaf98('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xaf98('0x11'));var hardwareService=require(_0xaf98('0x12'));var logger=require(_0xaf98('0x13'))(_0xaf98('0x14'));var utils=require(_0xaf98('0x15'));var config=require(_0xaf98('0x16'));var licenseUtil=require(_0xaf98('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xaf98('0x18'));function respondWithStatusCode(_0x3e1477,_0x5d54ca){_0x5d54ca=_0x5d54ca||0xcc;return function(_0xe8dc40){if(_0xe8dc40){return _0x3e1477['sendStatus'](_0x5d54ca);}return _0x3e1477['status'](_0x5d54ca)['end']();};}function respondWithResult(_0x5cb3b4,_0x20e7ba){_0x20e7ba=_0x20e7ba||0xc8;return function(_0x553fe1){if(_0x553fe1){return _0x5cb3b4[_0xaf98('0x19')](_0x20e7ba)[_0xaf98('0x1a')](_0x553fe1);}};}function respondWithFilteredResult(_0x29f233,_0x9d153d){return function(_0x30b745){if(_0x30b745){var _0x1ec909=typeof _0x9d153d['offset']===_0xaf98('0x1b')&&typeof _0x9d153d[_0xaf98('0x1c')]==='undefined';var _0x2d6700=_0x30b745[_0xaf98('0x1d')];var _0xbd96=_0x1ec909?0x0:_0x9d153d['offset'];var _0x479284=_0x1ec909?_0x30b745[_0xaf98('0x1d')]:_0x9d153d[_0xaf98('0x1e')]+_0x9d153d[_0xaf98('0x1c')];var _0x11a12b;if(_0x479284>=_0x2d6700){_0x479284=_0x2d6700;_0x11a12b=0xc8;}else{_0x11a12b=0xce;}_0x29f233['status'](_0x11a12b);return _0x29f233[_0xaf98('0x1f')](_0xaf98('0x20'),_0xbd96+'-'+_0x479284+'/'+_0x2d6700)['json'](_0x30b745);}return null;};}function patchUpdates(_0x5d3296){return function(_0x4341f4){try{jsonpatch[_0xaf98('0x21')](_0x4341f4,_0x5d3296,!![]);}catch(_0x2d0f09){return BPromise['reject'](_0x2d0f09);}return _0x4341f4[_0xaf98('0x22')]();};}function saveUpdates(_0x15e63f,_0x53e96e){return function(_0x5199a2){if(_0x5199a2){return _0x5199a2['update'](_0x15e63f)[_0xaf98('0x23')](function(_0x336c89){return _0x336c89;});}return null;};}function removeEntity(_0x1af81d,_0x413c8b){return function(_0x36225b){if(_0x36225b){return _0x36225b[_0xaf98('0x24')]()[_0xaf98('0x23')](function(){_0x1af81d['status'](0xcc)[_0xaf98('0x25')]();});}};}function handleEntityNotFound(_0x5c0435,_0x1a9626){return function(_0x48dc1d){if(!_0x48dc1d){_0x5c0435[_0xaf98('0x26')](0x194);}return _0x48dc1d;};}function handleError(_0x45396,_0x59a416){_0x59a416=_0x59a416||0x1f4;return function(_0x2b724c){logger[_0xaf98('0x27')](_0x2b724c['stack']);if(_0x2b724c[_0xaf98('0x28')]){delete _0x2b724c[_0xaf98('0x28')];}_0x45396[_0xaf98('0x19')](_0x59a416)[_0xaf98('0x29')](_0x2b724c);};}exports[_0xaf98('0x2a')]=function(_0x3aa8d0,_0x27af52){var _0x4bfd15={},_0x4b6303={},_0x562484={'count':0x0,'rows':[]};var _0x45af19=_['map'](db[_0xaf98('0x2b')][_0xaf98('0x2c')],function(_0x3ced32){return{'name':_0x3ced32[_0xaf98('0x2d')],'type':_0x3ced32[_0xaf98('0x2e')]['key']};});_0x4b6303[_0xaf98('0x2f')]=_[_0xaf98('0x30')](_0x45af19,_0xaf98('0x28'));_0x4b6303['query']=_[_0xaf98('0x31')](_0x3aa8d0['query']);_0x4b6303[_0xaf98('0x32')]=_[_0xaf98('0x33')](_0x4b6303[_0xaf98('0x2f')],_0x4b6303[_0xaf98('0x34')]);_0x4bfd15[_0xaf98('0x35')]=_[_0xaf98('0x33')](_0x4b6303[_0xaf98('0x2f')],qs['fields'](_0x3aa8d0[_0xaf98('0x34')][_0xaf98('0x36')]));_0x4bfd15[_0xaf98('0x35')]=_0x4bfd15[_0xaf98('0x35')]['length']?_0x4bfd15[_0xaf98('0x35')]:_0x4b6303[_0xaf98('0x2f')];if(!_0x3aa8d0['query'][_0xaf98('0x37')](_0xaf98('0x38'))){_0x4bfd15[_0xaf98('0x1c')]=qs[_0xaf98('0x1c')](_0x3aa8d0[_0xaf98('0x34')][_0xaf98('0x1c')]);_0x4bfd15[_0xaf98('0x1e')]=qs['offset'](_0x3aa8d0[_0xaf98('0x34')][_0xaf98('0x1e')]);}_0x4bfd15['order']=qs[_0xaf98('0x39')](_0x3aa8d0['query'][_0xaf98('0x39')]);_0x4bfd15[_0xaf98('0x3a')]=qs[_0xaf98('0x32')](_[_0xaf98('0x3b')](_0x3aa8d0[_0xaf98('0x34')],_0x4b6303[_0xaf98('0x32')]),_0x45af19);if(_0x3aa8d0[_0xaf98('0x34')]['filter']){_0x4bfd15[_0xaf98('0x3a')]=_[_0xaf98('0x3c')](_0x4bfd15[_0xaf98('0x3a')],{'$or':_[_0xaf98('0x30')](_0x45af19,function(_0x59dac0){if(_0x59dac0[_0xaf98('0x2e')]!==_0xaf98('0x3d')){var _0x5015b9={};_0x5015b9[_0x59dac0[_0xaf98('0x28')]]={'$like':'%'+_0x3aa8d0[_0xaf98('0x34')][_0xaf98('0x3e')]+'%'};return _0x5015b9;}})});}_0x4bfd15=_['merge']({},_0x4bfd15,_0x3aa8d0[_0xaf98('0x3f')]);var _0x373a71={'where':_0x4bfd15[_0xaf98('0x3a')]};return db[_0xaf98('0x2b')][_0xaf98('0x1d')](_0x373a71)[_0xaf98('0x23')](function(_0x10a948){_0x562484[_0xaf98('0x1d')]=_0x10a948;if(_0x3aa8d0[_0xaf98('0x34')][_0xaf98('0x40')]){_0x4bfd15[_0xaf98('0x41')]=[{'all':!![]}];}return db[_0xaf98('0x2b')][_0xaf98('0x42')](_0x4bfd15);})['then'](function(_0x1f0fa7){_0x562484[_0xaf98('0x43')]=_0x1f0fa7;return _0x562484;})[_0xaf98('0x23')](respondWithFilteredResult(_0x27af52,_0x4bfd15))[_0xaf98('0x44')](handleError(_0x27af52,null));};exports[_0xaf98('0x45')]=function(_0x13dda3,_0x32bdc6){var _0x52d576={'raw':![],'where':{'id':_0x13dda3[_0xaf98('0x46')]['id']}},_0x39b5fd={};_0x39b5fd[_0xaf98('0x2f')]=_['keys'](db[_0xaf98('0x2b')][_0xaf98('0x2c')]);_0x39b5fd[_0xaf98('0x34')]=_[_0xaf98('0x31')](_0x13dda3[_0xaf98('0x34')]);_0x39b5fd['filters']=_['intersection'](_0x39b5fd[_0xaf98('0x2f')],_0x39b5fd[_0xaf98('0x34')]);_0x52d576[_0xaf98('0x35')]=_[_0xaf98('0x33')](_0x39b5fd[_0xaf98('0x2f')],qs['fields'](_0x13dda3[_0xaf98('0x34')][_0xaf98('0x36')]));_0x52d576[_0xaf98('0x35')]=_0x52d576[_0xaf98('0x35')][_0xaf98('0x47')]?_0x52d576[_0xaf98('0x35')]:_0x39b5fd[_0xaf98('0x2f')];if(_0x13dda3[_0xaf98('0x34')][_0xaf98('0x40')]){_0x52d576['include']=[{'all':!![]}];}_0x52d576=_[_0xaf98('0x3c')]({},_0x52d576,_0x13dda3[_0xaf98('0x3f')]);return db[_0xaf98('0x2b')][_0xaf98('0x48')](_0x52d576)[_0xaf98('0x23')](handleEntityNotFound(_0x32bdc6,null))[_0xaf98('0x23')](respondWithResult(_0x32bdc6,null))[_0xaf98('0x44')](handleError(_0x32bdc6,null));};exports[_0xaf98('0x49')]=function(_0x35bb6a,_0x53534b){return db[_0xaf98('0x2b')]['create'](_0x35bb6a[_0xaf98('0x4a')],{})[_0xaf98('0x23')](respondWithResult(_0x53534b,0xc9))[_0xaf98('0x44')](handleError(_0x53534b,null));};exports['update']=function(_0x3592ed,_0x3299e5){if(_0x3592ed[_0xaf98('0x4a')]['id']){delete _0x3592ed[_0xaf98('0x4a')]['id'];}return db['SugarcrmAccount'][_0xaf98('0x48')]({'where':{'id':_0x3592ed[_0xaf98('0x46')]['id']}})[_0xaf98('0x23')](handleEntityNotFound(_0x3299e5,null))[_0xaf98('0x23')](saveUpdates(_0x3592ed[_0xaf98('0x4a')],null))['then'](respondWithResult(_0x3299e5,null))['catch'](handleError(_0x3299e5,null));};exports[_0xaf98('0x24')]=function(_0x15b602,_0x560202){return db['SugarcrmAccount'][_0xaf98('0x48')]({'where':{'id':_0x15b602[_0xaf98('0x46')]['id']}})['then'](handleEntityNotFound(_0x560202,null))['then'](removeEntity(_0x560202,null))['catch'](handleError(_0x560202,null));};exports[_0xaf98('0x4b')]=function(_0xd8b4e2,_0x10ae5d,_0x4da766){var _0x31929d={};var _0x3658c6={};var _0x313a57;var _0x461f1c;return db['SugarcrmAccount'][_0xaf98('0x4c')]({'where':{'id':_0xd8b4e2['params']['id']}})['then'](handleEntityNotFound(_0x10ae5d,null))['then'](function(_0x26cfaa){if(_0x26cfaa){_0x313a57=_0x26cfaa;_0x3658c6[_0xaf98('0x2f')]=_[_0xaf98('0x31')](db[_0xaf98('0x4d')][_0xaf98('0x2c')]);_0x3658c6[_0xaf98('0x34')]=_['keys'](_0xd8b4e2[_0xaf98('0x34')]);_0x3658c6[_0xaf98('0x32')]=_['intersection'](_0x3658c6[_0xaf98('0x2f')],_0x3658c6[_0xaf98('0x34')]);_0x31929d['attributes']=_['intersection'](_0x3658c6[_0xaf98('0x2f')],qs[_0xaf98('0x36')](_0xd8b4e2[_0xaf98('0x34')][_0xaf98('0x36')]));_0x31929d['attributes']=_0x31929d['attributes'][_0xaf98('0x47')]?_0x31929d[_0xaf98('0x35')]:_0x3658c6[_0xaf98('0x2f')];_0x31929d[_0xaf98('0x4e')]=qs['sort'](_0xd8b4e2[_0xaf98('0x34')]['sort']);_0x31929d[_0xaf98('0x3a')]=qs['filters'](_[_0xaf98('0x3b')](_0xd8b4e2[_0xaf98('0x34')],_0x3658c6['filters']));if(_0xd8b4e2[_0xaf98('0x34')][_0xaf98('0x3e')]){_0x31929d['where']=_[_0xaf98('0x3c')](_0x31929d[_0xaf98('0x3a')],{'$or':_[_0xaf98('0x30')](_0x31929d[_0xaf98('0x35')],function(_0x716142){var _0x4cd2e2={};_0x4cd2e2[_0x716142]={'$like':'%'+_0xd8b4e2['query'][_0xaf98('0x3e')]+'%'};return _0x4cd2e2;})});}_0x31929d=_[_0xaf98('0x3c')]({},_0x31929d,_0xd8b4e2[_0xaf98('0x3f')]);return _0x313a57[_0xaf98('0x4b')](_0x31929d);}})['then'](function(_0x51e322){if(_0x51e322){_0x461f1c=_0x51e322['length'];if(!_0xd8b4e2['query'][_0xaf98('0x37')](_0xaf98('0x38'))){_0x31929d[_0xaf98('0x1c')]=qs['limit'](_0xd8b4e2[_0xaf98('0x34')]['limit']);_0x31929d[_0xaf98('0x1e')]=qs[_0xaf98('0x1e')](_0xd8b4e2[_0xaf98('0x34')][_0xaf98('0x1e')]);}return _0x313a57['getConfigurations'](_0x31929d);}})[_0xaf98('0x23')](function(_0x4bff98){if(_0x4bff98){return _0x4bff98?{'count':_0x461f1c,'rows':_0x4bff98}:null;}})['then'](respondWithResult(_0x10ae5d,null))[_0xaf98('0x44')](handleError(_0x10ae5d,null));};exports[_0xaf98('0x4f')]=function(_0x316684,_0x3280a1,_0x488d3){if(_0x316684[_0xaf98('0x4a')]['id']){delete _0x316684[_0xaf98('0x4a')]['id'];}return db[_0xaf98('0x2b')][_0xaf98('0x4c')]({'where':{'id':_0x316684[_0xaf98('0x46')]['id']}})['then'](handleEntityNotFound(_0x3280a1,null))['then'](function(_0x9bb19){if(_0x9bb19){_0x316684[_0xaf98('0x4a')]['AccountId']=_0x9bb19['id'];_0x316684[_0xaf98('0x4a')]['Subjects']=integrations[_0xaf98('0x50')](_0x316684[_0xaf98('0x4a')]['channel'],_0x316684['body'][_0xaf98('0x2e')]);_0x316684[_0xaf98('0x4a')]['Descriptions']=integrations['getDescriptions'](_0x316684['body'][_0xaf98('0x51')],_0x316684[_0xaf98('0x4a')][_0xaf98('0x2e')]);return db['SugarcrmConfiguration'][_0xaf98('0x49')](_0x316684[_0xaf98('0x4a')],{'include':[{'model':db[_0xaf98('0x52')],'as':_0xaf98('0x53')},{'model':db[_0xaf98('0x52')],'as':_0xaf98('0x54')}]});}return null;})[_0xaf98('0x23')](respondWithResult(_0x3280a1,null))[_0xaf98('0x44')](handleError(_0x3280a1,null));};exports[_0xaf98('0x55')]=function(_0xc8c9d8,_0x48bdf8,_0x3d5592){var _0x27e2e4='';var _0x1f1fa5=['id','name',_0xaf98('0x56'),_0xaf98('0x57'),_0xaf98('0x58'),_0xaf98('0x59'),_0xaf98('0x5a'),'duration_minutes',_0xaf98('0x5b'),_0xaf98('0x5c'),_0xaf98('0x5d'),_0xaf98('0x5e')];return db['SugarcrmAccount'][_0xaf98('0x4c')]({'where':{'id':_0xc8c9d8[_0xaf98('0x46')]['id']},'attributes':['id',_0xaf98('0x5f'),_0xaf98('0x60'),_0xaf98('0x61')]})['then'](handleEntityNotFound(_0x48bdf8,null))[_0xaf98('0x23')](function(_0x5495ff){if(_0x5495ff){_0x27e2e4=_0x5495ff[_0xaf98('0x61')];var _0x14bbd2=_0x27e2e4[_0xaf98('0x62')](-0x1);if(_0x14bbd2==='/'){_0x27e2e4=_0x27e2e4['substring'](0x0,_0x27e2e4[_0xaf98('0x63')](_0x14bbd2));}return rp({'method':'POST','uri':util[_0xaf98('0x64')](_0xaf98('0x65'),_0x27e2e4,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xaf98('0x66'),'input_type':_0xaf98('0x67'),'response_type':_0xaf98('0x67'),'rest_data':JSON[_0xaf98('0x68')]({'user_auth':{'user_name':_0x5495ff[_0xaf98('0x5f')],'password':_0x5495ff[_0xaf98('0x60')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})['then'](function(_0xec4acc){if(_0xec4acc&&_0xec4acc[_0xaf98('0x28')]!=='Invalid\x20Login'&&_0xec4acc[_0xaf98('0x28')]!=='Password\x20Expired'){return rp({'method':_0xaf98('0x69'),'uri':util[_0xaf98('0x64')](_0xaf98('0x65'),_0x27e2e4,_0xaf98('0x6a')),'json':!![],'form':{'method':_0xaf98('0x6b'),'input_type':'JSON','response_type':_0xaf98('0x67'),'rest_data':JSON[_0xaf98('0x68')]({'session':_0xec4acc['id'],'module_name':_0xaf98('0x6c')})}})[_0xaf98('0x23')](function(_0x47d78c){if(_0x47d78c){var _0x3e96eb=_[_0xaf98('0x6d')](_0x47d78c[_0xaf98('0x6e')]);_[_0xaf98('0x6f')](_0x3e96eb,function(_0x3a433f){return _0x1f1fa5[_0xaf98('0x70')](_0x3a433f['name']);});return{'count':_0x3e96eb[_0xaf98('0x47')],'rows':_['map'](_0x3e96eb,function(_0x41be72){return{'id':_0x41be72['name'],'name':_0x41be72[_0xaf98('0x71')],'custom':_[_0xaf98('0x72')](_0x41be72[_0xaf98('0x28')],'_c')?!![]:![],'options':_0x41be72[_0xaf98('0x3f')]?_['map'](_[_0xaf98('0x6d')](_0x41be72[_0xaf98('0x3f')]),function(_0x3eebc9){return{'name':_0x3eebc9[_0xaf98('0x73')],'value':_0x3eebc9['name']};}):[]};})};}})[_0xaf98('0x23')](respondWithResult(_0x48bdf8,null))[_0xaf98('0x44')](function(_0x3bb3f9){var _0x5f21a0=_0xc8c9d8['query'][_0xaf98('0x74')]?0x1f4:_0x3bb3f9['statusCode']||0x1f4;logger[_0xaf98('0x27')](_0xaf98('0x75'),_0xaf98('0x55'),_0x5f21a0,JSON[_0xaf98('0x68')](_0x3bb3f9));delete _0x3bb3f9[_0xaf98('0x28')];if(_0x5f21a0===0x191){_0x5f21a0=0x190;}_0x48bdf8[_0xaf98('0x19')](_0x5f21a0)[_0xaf98('0x29')](_0xc8c9d8['query'][_0xaf98('0x74')]?{'message':_0xaf98('0x76'),'statusCode':_0x3bb3f9[_0xaf98('0x77')]}:_0x3bb3f9);});}else{var _0xd8a139=0x1f4;_0x48bdf8[_0xaf98('0x19')](_0xd8a139)[_0xaf98('0x29')]({'message':_0xaf98('0x76'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xdfde=['model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','offset','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','length','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','order','nolimit','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SugarcrmField','getFields','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','substring','lastIndexOf','%s%s','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','format','/service/v4_1/rest.php','get_module_fields','Calls','module_fields','remove','includes','test','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','count','limit','apply','reject','save','update','then','destroy','error','name','index','map','SugarcrmAccount','rawAttributes','type','key'];(function(_0x59befa,_0x4af99b){var _0x1dd63d=function(_0x4c1df4){while(--_0x4c1df4){_0x59befa['push'](_0x59befa['shift']());}};_0x1dd63d(++_0x4af99b);}(_0xdfde,0xc2));var _0xedfd=function(_0x25efdf,_0x521462){_0x25efdf=_0x25efdf-0x0;var _0x22c495=_0xdfde[_0x25efdf];return _0x22c495;};'use strict';var emlformat=require(_0xedfd('0x0'));var rimraf=require(_0xedfd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xedfd('0x2'));var rp=require(_0xedfd('0x3'));var moment=require('moment');var BPromise=require(_0xedfd('0x4'));var Mustache=require(_0xedfd('0x5'));var util=require(_0xedfd('0x6'));var path=require(_0xedfd('0x7'));var sox=require(_0xedfd('0x8'));var csv=require(_0xedfd('0x9'));var ejs=require(_0xedfd('0xa'));var fs=require('fs');var fs_extra=require(_0xedfd('0xb'));var _=require(_0xedfd('0xc'));var squel=require(_0xedfd('0xd'));var crypto=require(_0xedfd('0xe'));var jsforce=require(_0xedfd('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xedfd('0x9'));var querystring=require(_0xedfd('0x10'));var Papa=require(_0xedfd('0x11'));var Redis=require('ioredis');var authService=require(_0xedfd('0x12'));var qs=require(_0xedfd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xedfd('0x14'));var logger=require(_0xedfd('0x15'))(_0xedfd('0x16'));var utils=require('../../config/utils');var config=require(_0xedfd('0x17'));var licenseUtil=require(_0xedfd('0x18'));var db=require(_0xedfd('0x19'))['db'];var integrations=require(_0xedfd('0x1a'));function respondWithStatusCode(_0x18b7fa,_0x5e1344){_0x5e1344=_0x5e1344||0xcc;return function(_0xba9809){if(_0xba9809){return _0x18b7fa[_0xedfd('0x1b')](_0x5e1344);}return _0x18b7fa[_0xedfd('0x1c')](_0x5e1344)[_0xedfd('0x1d')]();};}function respondWithResult(_0x1e258b,_0x4d3cfe){_0x4d3cfe=_0x4d3cfe||0xc8;return function(_0x45b33f){if(_0x45b33f){return _0x1e258b[_0xedfd('0x1c')](_0x4d3cfe)[_0xedfd('0x1e')](_0x45b33f);}};}function respondWithFilteredResult(_0x1360aa,_0x1f81ed){return function(_0x43c80f){if(_0x43c80f){var _0x2359c3=typeof _0x1f81ed['offset']===_0xedfd('0x1f')&&typeof _0x1f81ed['limit']==='undefined';var _0x264c2d=_0x43c80f[_0xedfd('0x20')];var _0x5cb9be=_0x2359c3?0x0:_0x1f81ed['offset'];var _0x499936=_0x2359c3?_0x43c80f[_0xedfd('0x20')]:_0x1f81ed['offset']+_0x1f81ed[_0xedfd('0x21')];var _0x372e81;if(_0x499936>=_0x264c2d){_0x499936=_0x264c2d;_0x372e81=0xc8;}else{_0x372e81=0xce;}_0x1360aa[_0xedfd('0x1c')](_0x372e81);return _0x1360aa['set']('Content-Range',_0x5cb9be+'-'+_0x499936+'/'+_0x264c2d)['json'](_0x43c80f);}return null;};}function patchUpdates(_0x43e351){return function(_0x5f2ce5){try{jsonpatch[_0xedfd('0x22')](_0x5f2ce5,_0x43e351,!![]);}catch(_0x1535b9){return BPromise[_0xedfd('0x23')](_0x1535b9);}return _0x5f2ce5[_0xedfd('0x24')]();};}function saveUpdates(_0x4c6ab3,_0x12d456){return function(_0x299bff){if(_0x299bff){return _0x299bff[_0xedfd('0x25')](_0x4c6ab3)[_0xedfd('0x26')](function(_0x6aa2f7){return _0x6aa2f7;});}return null;};}function removeEntity(_0x3d9865,_0x2f4bdb){return function(_0x6bc23d){if(_0x6bc23d){return _0x6bc23d[_0xedfd('0x27')]()[_0xedfd('0x26')](function(){_0x3d9865[_0xedfd('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b5c19,_0x122d73){return function(_0x534ee1){if(!_0x534ee1){_0x5b5c19[_0xedfd('0x1b')](0x194);}return _0x534ee1;};}function handleError(_0x5c55ea,_0x4d6614){_0x4d6614=_0x4d6614||0x1f4;return function(_0x44cecf){logger[_0xedfd('0x28')](_0x44cecf['stack']);if(_0x44cecf[_0xedfd('0x29')]){delete _0x44cecf[_0xedfd('0x29')];}_0x5c55ea['status'](_0x4d6614)['send'](_0x44cecf);};}exports[_0xedfd('0x2a')]=function(_0x5e1fc8,_0x307c62){var _0x23b27f={},_0x2012a0={},_0x2dc068={'count':0x0,'rows':[]};var _0x33d210=_[_0xedfd('0x2b')](db[_0xedfd('0x2c')][_0xedfd('0x2d')],function(_0x40be14){return{'name':_0x40be14['fieldName'],'type':_0x40be14[_0xedfd('0x2e')][_0xedfd('0x2f')]};});_0x2012a0[_0xedfd('0x30')]=_[_0xedfd('0x2b')](_0x33d210,_0xedfd('0x29'));_0x2012a0[_0xedfd('0x31')]=_[_0xedfd('0x32')](_0x5e1fc8[_0xedfd('0x31')]);_0x2012a0[_0xedfd('0x33')]=_[_0xedfd('0x34')](_0x2012a0['model'],_0x2012a0[_0xedfd('0x31')]);_0x23b27f[_0xedfd('0x35')]=_[_0xedfd('0x34')](_0x2012a0['model'],qs[_0xedfd('0x36')](_0x5e1fc8[_0xedfd('0x31')][_0xedfd('0x36')]));_0x23b27f[_0xedfd('0x35')]=_0x23b27f[_0xedfd('0x35')]['length']?_0x23b27f[_0xedfd('0x35')]:_0x2012a0['model'];if(!_0x5e1fc8['query'][_0xedfd('0x37')]('nolimit')){_0x23b27f[_0xedfd('0x21')]=qs[_0xedfd('0x21')](_0x5e1fc8['query'][_0xedfd('0x21')]);_0x23b27f[_0xedfd('0x38')]=qs[_0xedfd('0x38')](_0x5e1fc8[_0xedfd('0x31')][_0xedfd('0x38')]);}_0x23b27f['order']=qs[_0xedfd('0x39')](_0x5e1fc8[_0xedfd('0x31')][_0xedfd('0x39')]);_0x23b27f[_0xedfd('0x3a')]=qs['filters'](_[_0xedfd('0x3b')](_0x5e1fc8[_0xedfd('0x31')],_0x2012a0[_0xedfd('0x33')]),_0x33d210);if(_0x5e1fc8[_0xedfd('0x31')][_0xedfd('0x3c')]){_0x23b27f['where']=_[_0xedfd('0x3d')](_0x23b27f[_0xedfd('0x3a')],{'$or':_[_0xedfd('0x2b')](_0x33d210,function(_0x2122b8){if(_0x2122b8['type']!==_0xedfd('0x3e')){var _0x2b9915={};_0x2b9915[_0x2122b8[_0xedfd('0x29')]]={'$like':'%'+_0x5e1fc8[_0xedfd('0x31')][_0xedfd('0x3c')]+'%'};return _0x2b9915;}})});}_0x23b27f=_[_0xedfd('0x3d')]({},_0x23b27f,_0x5e1fc8[_0xedfd('0x3f')]);var _0x32fbfb={'where':_0x23b27f[_0xedfd('0x3a')]};return db[_0xedfd('0x2c')]['count'](_0x32fbfb)[_0xedfd('0x26')](function(_0x28ab0a){_0x2dc068[_0xedfd('0x20')]=_0x28ab0a;if(_0x5e1fc8[_0xedfd('0x31')][_0xedfd('0x40')]){_0x23b27f[_0xedfd('0x41')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0xedfd('0x42')](_0x23b27f);})[_0xedfd('0x26')](function(_0x354778){_0x2dc068['rows']=_0x354778;return _0x2dc068;})[_0xedfd('0x26')](respondWithFilteredResult(_0x307c62,_0x23b27f))[_0xedfd('0x43')](handleError(_0x307c62,null));};exports['show']=function(_0xa15c2c,_0x5c711a){var _0x1886ed={'raw':![],'where':{'id':_0xa15c2c[_0xedfd('0x44')]['id']}},_0x546df5={};_0x546df5[_0xedfd('0x30')]=_[_0xedfd('0x32')](db[_0xedfd('0x2c')][_0xedfd('0x2d')]);_0x546df5[_0xedfd('0x31')]=_[_0xedfd('0x32')](_0xa15c2c[_0xedfd('0x31')]);_0x546df5[_0xedfd('0x33')]=_[_0xedfd('0x34')](_0x546df5['model'],_0x546df5[_0xedfd('0x31')]);_0x1886ed[_0xedfd('0x35')]=_[_0xedfd('0x34')](_0x546df5[_0xedfd('0x30')],qs['fields'](_0xa15c2c[_0xedfd('0x31')][_0xedfd('0x36')]));_0x1886ed[_0xedfd('0x35')]=_0x1886ed[_0xedfd('0x35')][_0xedfd('0x45')]?_0x1886ed[_0xedfd('0x35')]:_0x546df5[_0xedfd('0x30')];if(_0xa15c2c[_0xedfd('0x31')][_0xedfd('0x40')]){_0x1886ed[_0xedfd('0x41')]=[{'all':!![]}];}_0x1886ed=_[_0xedfd('0x3d')]({},_0x1886ed,_0xa15c2c[_0xedfd('0x3f')]);return db[_0xedfd('0x2c')][_0xedfd('0x46')](_0x1886ed)['then'](handleEntityNotFound(_0x5c711a,null))[_0xedfd('0x26')](respondWithResult(_0x5c711a,null))[_0xedfd('0x43')](handleError(_0x5c711a,null));};exports['create']=function(_0x53fc14,_0x2df79c){return db[_0xedfd('0x2c')][_0xedfd('0x47')](_0x53fc14['body'],{})[_0xedfd('0x26')](respondWithResult(_0x2df79c,0xc9))['catch'](handleError(_0x2df79c,null));};exports[_0xedfd('0x25')]=function(_0x2fe689,_0x5e2b85){if(_0x2fe689[_0xedfd('0x48')]['id']){delete _0x2fe689[_0xedfd('0x48')]['id'];}return db['SugarcrmAccount'][_0xedfd('0x46')]({'where':{'id':_0x2fe689[_0xedfd('0x44')]['id']}})[_0xedfd('0x26')](handleEntityNotFound(_0x5e2b85,null))[_0xedfd('0x26')](saveUpdates(_0x2fe689[_0xedfd('0x48')],null))[_0xedfd('0x26')](respondWithResult(_0x5e2b85,null))[_0xedfd('0x43')](handleError(_0x5e2b85,null));};exports[_0xedfd('0x27')]=function(_0x4f5a31,_0x25f174){return db['SugarcrmAccount']['find']({'where':{'id':_0x4f5a31[_0xedfd('0x44')]['id']}})[_0xedfd('0x26')](handleEntityNotFound(_0x25f174,null))[_0xedfd('0x26')](removeEntity(_0x25f174,null))[_0xedfd('0x43')](handleError(_0x25f174,null));};exports[_0xedfd('0x49')]=function(_0x2fe0d2,_0x2a2683,_0xcb91ba){var _0x43d7eb={};var _0x1527e6={};var _0x3e8b51;var _0x503f6f;return db[_0xedfd('0x2c')][_0xedfd('0x4a')]({'where':{'id':_0x2fe0d2[_0xedfd('0x44')]['id']}})[_0xedfd('0x26')](handleEntityNotFound(_0x2a2683,null))[_0xedfd('0x26')](function(_0xbc311f){if(_0xbc311f){_0x3e8b51=_0xbc311f;_0x1527e6[_0xedfd('0x30')]=_['keys'](db[_0xedfd('0x4b')]['rawAttributes']);_0x1527e6['query']=_[_0xedfd('0x32')](_0x2fe0d2[_0xedfd('0x31')]);_0x1527e6[_0xedfd('0x33')]=_[_0xedfd('0x34')](_0x1527e6[_0xedfd('0x30')],_0x1527e6['query']);_0x43d7eb[_0xedfd('0x35')]=_['intersection'](_0x1527e6[_0xedfd('0x30')],qs[_0xedfd('0x36')](_0x2fe0d2[_0xedfd('0x31')][_0xedfd('0x36')]));_0x43d7eb[_0xedfd('0x35')]=_0x43d7eb['attributes'][_0xedfd('0x45')]?_0x43d7eb[_0xedfd('0x35')]:_0x1527e6['model'];_0x43d7eb[_0xedfd('0x4c')]=qs[_0xedfd('0x39')](_0x2fe0d2[_0xedfd('0x31')][_0xedfd('0x39')]);_0x43d7eb[_0xedfd('0x3a')]=qs[_0xedfd('0x33')](_[_0xedfd('0x3b')](_0x2fe0d2[_0xedfd('0x31')],_0x1527e6['filters']));if(_0x2fe0d2[_0xedfd('0x31')][_0xedfd('0x3c')]){_0x43d7eb[_0xedfd('0x3a')]=_[_0xedfd('0x3d')](_0x43d7eb[_0xedfd('0x3a')],{'$or':_[_0xedfd('0x2b')](_0x43d7eb[_0xedfd('0x35')],function(_0x1fdc6f){var _0x12093b={};_0x12093b[_0x1fdc6f]={'$like':'%'+_0x2fe0d2[_0xedfd('0x31')][_0xedfd('0x3c')]+'%'};return _0x12093b;})});}_0x43d7eb=_['merge']({},_0x43d7eb,_0x2fe0d2[_0xedfd('0x3f')]);return _0x3e8b51[_0xedfd('0x49')](_0x43d7eb);}})[_0xedfd('0x26')](function(_0x318765){if(_0x318765){_0x503f6f=_0x318765['length'];if(!_0x2fe0d2[_0xedfd('0x31')][_0xedfd('0x37')](_0xedfd('0x4d'))){_0x43d7eb['limit']=qs['limit'](_0x2fe0d2[_0xedfd('0x31')][_0xedfd('0x21')]);_0x43d7eb[_0xedfd('0x38')]=qs[_0xedfd('0x38')](_0x2fe0d2[_0xedfd('0x31')][_0xedfd('0x38')]);}return _0x3e8b51[_0xedfd('0x49')](_0x43d7eb);}})[_0xedfd('0x26')](function(_0x1b384f){if(_0x1b384f){return _0x1b384f?{'count':_0x503f6f,'rows':_0x1b384f}:null;}})[_0xedfd('0x26')](respondWithResult(_0x2a2683,null))[_0xedfd('0x43')](handleError(_0x2a2683,null));};exports['addConfiguration']=function(_0x13ef96,_0x447b51,_0x350935){if(_0x13ef96[_0xedfd('0x48')]['id']){delete _0x13ef96[_0xedfd('0x48')]['id'];}return db['SugarcrmAccount']['findOne']({'where':{'id':_0x13ef96[_0xedfd('0x44')]['id']}})[_0xedfd('0x26')](handleEntityNotFound(_0x447b51,null))[_0xedfd('0x26')](function(_0xdab957){if(_0xdab957){_0x13ef96['body'][_0xedfd('0x4e')]=_0xdab957['id'];_0x13ef96[_0xedfd('0x48')][_0xedfd('0x4f')]=integrations[_0xedfd('0x50')](_0x13ef96[_0xedfd('0x48')]['channel'],_0x13ef96[_0xedfd('0x48')]['type']);_0x13ef96[_0xedfd('0x48')][_0xedfd('0x51')]=integrations[_0xedfd('0x52')](_0x13ef96[_0xedfd('0x48')][_0xedfd('0x53')],_0x13ef96[_0xedfd('0x48')][_0xedfd('0x2e')]);return db[_0xedfd('0x4b')][_0xedfd('0x47')](_0x13ef96[_0xedfd('0x48')],{'include':[{'model':db[_0xedfd('0x54')],'as':'Subjects'},{'model':db[_0xedfd('0x54')],'as':_0xedfd('0x51')}]});}return null;})[_0xedfd('0x26')](respondWithResult(_0x447b51,null))[_0xedfd('0x43')](handleError(_0x447b51,null));};exports[_0xedfd('0x55')]=function(_0xdd6824,_0xbc9da0,_0x104504){var _0x2ea998='';var _0x41e990=['id',_0xedfd('0x29'),'assigned_user_id',_0xedfd('0x56'),_0xedfd('0x57'),_0xedfd('0x58'),_0xedfd('0x59'),_0xedfd('0x5a'),_0xedfd('0x5b'),_0xedfd('0x5c'),_0xedfd('0x5d'),_0xedfd('0x5e')];return db['SugarcrmAccount'][_0xedfd('0x4a')]({'where':{'id':_0xdd6824[_0xedfd('0x44')]['id']},'attributes':['id',_0xedfd('0x5f'),_0xedfd('0x60'),'remoteUri']})[_0xedfd('0x26')](handleEntityNotFound(_0xbc9da0,null))['then'](function(_0x122e19){if(_0x122e19){_0x2ea998=_0x122e19[_0xedfd('0x61')];var _0x2c0400=_0x2ea998['slice'](-0x1);if(_0x2c0400==='/'){_0x2ea998=_0x2ea998[_0xedfd('0x62')](0x0,_0x2ea998[_0xedfd('0x63')](_0x2c0400));}return rp({'method':'POST','uri':util['format'](_0xedfd('0x64'),_0x2ea998,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xedfd('0x65'),'input_type':_0xedfd('0x66'),'response_type':_0xedfd('0x66'),'rest_data':JSON[_0xedfd('0x67')]({'user_auth':{'user_name':_0x122e19[_0xedfd('0x5f')],'password':_0x122e19[_0xedfd('0x60')],'encryption':_0xedfd('0x68')},'application':_0xedfd('0x69')})}});}})[_0xedfd('0x26')](function(_0xb275e){if(_0xb275e&&_0xb275e[_0xedfd('0x29')]!==_0xedfd('0x6a')&&_0xb275e[_0xedfd('0x29')]!==_0xedfd('0x6b')){return rp({'method':_0xedfd('0x6c'),'uri':util[_0xedfd('0x6d')](_0xedfd('0x64'),_0x2ea998,_0xedfd('0x6e')),'json':!![],'form':{'method':_0xedfd('0x6f'),'input_type':_0xedfd('0x66'),'response_type':_0xedfd('0x66'),'rest_data':JSON[_0xedfd('0x67')]({'session':_0xb275e['id'],'module_name':_0xedfd('0x70')})}})[_0xedfd('0x26')](function(_0x1228ba){if(_0x1228ba){var _0x385607=_['values'](_0x1228ba[_0xedfd('0x71')]);_[_0xedfd('0x72')](_0x385607,function(_0x5e5636){return _0x41e990[_0xedfd('0x73')](_0x5e5636[_0xedfd('0x29')]);});return{'count':_0x385607['length'],'rows':_[_0xedfd('0x2b')](_0x385607,function(_0x4855b6){return{'id':_0x4855b6['name'],'name':_0x4855b6['label'],'custom':_['endsWith'](_0x4855b6['name'],'_c')?!![]:![],'options':_0x4855b6[_0xedfd('0x3f')]?_[_0xedfd('0x2b')](_['values'](_0x4855b6['options']),function(_0x2d4b78){return{'name':_0x2d4b78['value'],'value':_0x2d4b78['name']};}):[]};})};}})[_0xedfd('0x26')](respondWithResult(_0xbc9da0,null))[_0xedfd('0x43')](function(_0x2c060b){var _0x335d32=_0xdd6824[_0xedfd('0x31')][_0xedfd('0x74')]?0x1f4:_0x2c060b['statusCode']||0x1f4;logger['error'](_0xedfd('0x75'),_0xedfd('0x55'),_0x335d32,JSON[_0xedfd('0x67')](_0x2c060b));delete _0x2c060b['name'];if(_0x335d32===0x191){_0x335d32=0x190;}_0xbc9da0[_0xedfd('0x1c')](_0x335d32)[_0xedfd('0x76')](_0xdd6824[_0xedfd('0x31')][_0xedfd('0x74')]?{'message':_0xedfd('0x77'),'statusCode':_0x2c060b[_0xedfd('0x78')]}:_0x2c060b);});}else{var _0x39cea1=0x1f4;_0xbc9da0[_0xedfd('0x1c')](_0x39cea1)[_0xedfd('0x76')]({'message':_0xedfd('0x77'),'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 cd05344..7abb9c9 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 _0x3a52=['int_sugarcrm_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./intSugarcrmAccount.attributes','../../components/integrations/configuration','SugarcrmAccount'];(function(_0x5d4510,_0x5aa2c8){var _0x3dfae0=function(_0x5d5587){while(--_0x5d5587){_0x5d4510['push'](_0x5d4510['shift']());}};_0x3dfae0(++_0x5aa2c8);}(_0x3a52,0x182));var _0x23a5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3a52[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x23a5('0x0'));var util=require('util');var logger=require(_0x23a5('0x1'))(_0x23a5('0x2'));var moment=require(_0x23a5('0x3'));var BPromise=require(_0x23a5('0x4'));var rp=require(_0x23a5('0x5'));var fs=require('fs');var path=require(_0x23a5('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x23a5('0x7'));var integrations=require(_0x23a5('0x8'));module['exports']=function(_0x39a369,_0x20ddc8){return _0x39a369['define'](_0x23a5('0x9'),attributes,{'tableName':_0x23a5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x42f8=['rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4b91c4,_0x23f35f){var _0x25cb80=function(_0x48e283){while(--_0x48e283){_0x4b91c4['push'](_0x4b91c4['shift']());}};_0x25cb80(++_0x23f35f);}(_0x42f8,0x19e));var _0x842f=function(_0x53b84d,_0x5522e8){_0x53b84d=_0x53b84d-0x0;var _0x5ad0b0=_0x42f8[_0x53b84d];return _0x5ad0b0;};'use strict';var _=require('lodash');var util=require(_0x842f('0x0'));var logger=require(_0x842f('0x1'))(_0x842f('0x2'));var moment=require(_0x842f('0x3'));var BPromise=require(_0x842f('0x4'));var rp=require(_0x842f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x842f('0x6'));var config=require(_0x842f('0x7'));var attributes=require(_0x842f('0x8'));var integrations=require(_0x842f('0x9'));module[_0x842f('0xa')]=function(_0x59557,_0x2c8b74){return _0x59557[_0x842f('0xb')](_0x842f('0xc'),attributes,{'tableName':_0x842f('0xd'),'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 8c852e4..c3f3586 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 _0x539f=['where','limit','include','model','map','attributes','stringify','ShowSugarcrmAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','http','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','raw','options'];(function(_0x4eec9b,_0x4aea09){var _0x2e3849=function(_0x24c06d){while(--_0x24c06d){_0x4eec9b['push'](_0x4eec9b['shift']());}};_0x2e3849(++_0x4aea09);}(_0x539f,0x89));var _0xf539=function(_0x23eefd,_0x2ebce5){_0x23eefd=_0x23eefd-0x0;var _0x3aa7cb=_0x539f[_0x23eefd];return _0x3aa7cb;};'use strict';var _=require(_0xf539('0x0'));var util=require(_0xf539('0x1'));var moment=require(_0xf539('0x2'));var BPromise=require(_0xf539('0x3'));var rs=require(_0xf539('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf539('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf539('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xf539('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3d05ca,_0x41cc9f,_0x23d606){return new BPromise(function(_0x4dbaf2,_0x29b314){return client['request'](_0x3d05ca,_0x23d606)[_0xf539('0x8')](function(_0x41a265){logger[_0xf539('0x9')](_0xf539('0xa'),_0x41cc9f,'request\x20sent');logger[_0xf539('0xb')](_0xf539('0xc'),_0x41cc9f,_0xf539('0xd'),JSON['stringify'](_0x41a265));if(_0x41a265[_0xf539('0xe')]){if(_0x41a265[_0xf539('0xe')][_0xf539('0xf')]===0x1f4){logger[_0xf539('0xe')](_0xf539('0xa'),_0x41cc9f,_0x41a265['error']['message']);return _0x29b314(_0x41a265['error'][_0xf539('0x10')]);}logger[_0xf539('0xe')](_0xf539('0xa'),_0x41cc9f,_0x41a265[_0xf539('0xe')][_0xf539('0x10')]);return _0x4dbaf2(_0x41a265[_0xf539('0xe')][_0xf539('0x10')]);}else{logger['info'](_0xf539('0xa'),_0x41cc9f,_0xf539('0xd'));_0x4dbaf2(_0x41a265['result'][_0xf539('0x10')]);}})[_0xf539('0x11')](function(_0x2b432e){logger[_0xf539('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0x41cc9f,_0x2b432e);_0x29b314(_0x2b432e);});});}exports[_0xf539('0x12')]=function(_0x1b67cd){var _0x4cd73d=this;return new Promise(function(_0x541484,_0x3731b4){return db[_0xf539('0x13')][_0xf539('0x14')]({'raw':_0x1b67cd['options']?_0x1b67cd['options'][_0xf539('0x15')]===undefined?!![]:![]:!![],'where':_0x1b67cd[_0xf539('0x16')]?_0x1b67cd[_0xf539('0x16')][_0xf539('0x17')]||null:null,'attributes':_0x1b67cd[_0xf539('0x16')]?_0x1b67cd[_0xf539('0x16')]['attributes']||null:null,'limit':_0x1b67cd[_0xf539('0x16')]?_0x1b67cd[_0xf539('0x16')][_0xf539('0x18')]||null:null,'include':_0x1b67cd[_0xf539('0x16')]?_0x1b67cd[_0xf539('0x16')][_0xf539('0x19')]?_['map'](_0x1b67cd[_0xf539('0x16')][_0xf539('0x19')],function(_0x3c05e2){return{'model':db[_0x3c05e2[_0xf539('0x1a')]],'as':_0x3c05e2['as'],'attributes':_0x3c05e2['attributes'],'include':_0x3c05e2[_0xf539('0x19')]?_[_0xf539('0x1b')](_0x3c05e2[_0xf539('0x19')],function(_0x24ba38){return{'model':db[_0x24ba38[_0xf539('0x1a')]],'as':_0x24ba38['as'],'attributes':_0x24ba38[_0xf539('0x1c')],'include':_0x24ba38['include']?_[_0xf539('0x1b')](_0x24ba38[_0xf539('0x19')],function(_0x182dfd){return{'model':db[_0x182dfd[_0xf539('0x1a')]],'as':_0x182dfd['as'],'attributes':_0x182dfd[_0xf539('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf539('0x8')](function(_0x19b826){logger[_0xf539('0x9')]('GetSugarcrmAccount',_0x1b67cd);logger[_0xf539('0xb')](_0xf539('0x12'),_0x1b67cd,JSON[_0xf539('0x1d')](_0x19b826));_0x541484(_0x19b826);})[_0xf539('0x11')](function(_0x25fbc7){logger['error'](_0xf539('0x12'),_0x25fbc7[_0xf539('0x10')],_0x1b67cd);_0x3731b4(_0x4cd73d[_0xf539('0xe')](0x1f4,_0x25fbc7[_0xf539('0x10')]));});});};exports[_0xf539('0x1e')]=function(_0xfbb750){var _0x367e08=this;return new Promise(function(_0x28f8a6,_0xc28ae8){return db[_0xf539('0x13')][_0xf539('0x1f')]({'raw':_0xfbb750[_0xf539('0x16')]?_0xfbb750[_0xf539('0x16')][_0xf539('0x15')]===undefined?!![]:![]:!![],'where':_0xfbb750[_0xf539('0x16')]?_0xfbb750[_0xf539('0x16')]['where']||null:null,'attributes':_0xfbb750[_0xf539('0x16')]?_0xfbb750[_0xf539('0x16')][_0xf539('0x1c')]||null:null,'include':_0xfbb750[_0xf539('0x16')]?_0xfbb750[_0xf539('0x16')][_0xf539('0x19')]?_[_0xf539('0x1b')](_0xfbb750[_0xf539('0x16')][_0xf539('0x19')],function(_0x16e218){return{'model':db[_0x16e218[_0xf539('0x1a')]],'as':_0x16e218['as'],'attributes':_0x16e218[_0xf539('0x1c')],'include':_0x16e218[_0xf539('0x19')]?_[_0xf539('0x1b')](_0x16e218[_0xf539('0x19')],function(_0x542c27){return{'model':db[_0x542c27[_0xf539('0x1a')]],'as':_0x542c27['as'],'attributes':_0x542c27[_0xf539('0x1c')],'include':_0x542c27['include']?_[_0xf539('0x1b')](_0x542c27[_0xf539('0x19')],function(_0x4de8d7){return{'model':db[_0x4de8d7['model']],'as':_0x4de8d7['as'],'attributes':_0x4de8d7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f7f33){logger[_0xf539('0x9')](_0xf539('0x1e'),_0xfbb750);logger[_0xf539('0xb')](_0xf539('0x1e'),_0xfbb750,JSON['stringify'](_0x3f7f33));_0x28f8a6(_0x3f7f33);})[_0xf539('0x11')](function(_0x49e57d){logger['error']('ShowSugarcrmAccount',_0x49e57d[_0xf539('0x10')],_0xfbb750);_0xc28ae8(_0x367e08[_0xf539('0xe')](0x1f4,_0x49e57d[_0xf539('0x10')]));});});}; \ No newline at end of file +var _0x6552=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','SugarcrmAccount','findAll','options','raw','where','attributes','include','model','map','GetSugarcrmAccount','ShowSugarcrmAccount','find'];(function(_0x2fbd0e,_0x3460a9){var _0x481c9f=function(_0x4bc402){while(--_0x4bc402){_0x2fbd0e['push'](_0x2fbd0e['shift']());}};_0x481c9f(++_0x3460a9);}(_0x6552,0x168));var _0x2655=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x6552[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x2655('0x0'));var util=require(_0x2655('0x1'));var moment=require(_0x2655('0x2'));var BPromise=require(_0x2655('0x3'));var rs=require(_0x2655('0x4'));var fs=require('fs');var Redis=require(_0x2655('0x5'));var db=require(_0x2655('0x6'))['db'];var utils=require(_0x2655('0x7'));var logger=require(_0x2655('0x8'))(_0x2655('0x9'));var config=require('../../config/environment');var jayson=require(_0x2655('0xa'));var client=jayson[_0x2655('0xb')][_0x2655('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2cf9dc,_0x5a8c50,_0x23e594){return new BPromise(function(_0x4fde95,_0x5ecd68){return client[_0x2655('0xd')](_0x2cf9dc,_0x23e594)[_0x2655('0xe')](function(_0x156e0e){logger[_0x2655('0xf')](_0x2655('0x10'),_0x5a8c50,_0x2655('0x11'));logger[_0x2655('0x12')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x5a8c50,_0x2655('0x11'),JSON[_0x2655('0x13')](_0x156e0e));if(_0x156e0e[_0x2655('0x14')]){if(_0x156e0e[_0x2655('0x14')]['code']===0x1f4){logger[_0x2655('0x14')](_0x2655('0x10'),_0x5a8c50,_0x156e0e['error'][_0x2655('0x15')]);return _0x5ecd68(_0x156e0e[_0x2655('0x14')][_0x2655('0x15')]);}logger['error'](_0x2655('0x10'),_0x5a8c50,_0x156e0e['error']['message']);return _0x4fde95(_0x156e0e[_0x2655('0x14')][_0x2655('0x15')]);}else{logger['info'](_0x2655('0x10'),_0x5a8c50,_0x2655('0x11'));_0x4fde95(_0x156e0e[_0x2655('0x16')][_0x2655('0x15')]);}})[_0x2655('0x17')](function(_0x30191c){logger[_0x2655('0x14')](_0x2655('0x10'),_0x5a8c50,_0x30191c);_0x5ecd68(_0x30191c);});});}exports['GetSugarcrmAccount']=function(_0x456695){var _0xdcecf6=this;return new Promise(function(_0x256949,_0xc72e5b){return db[_0x2655('0x18')][_0x2655('0x19')]({'raw':_0x456695[_0x2655('0x1a')]?_0x456695[_0x2655('0x1a')][_0x2655('0x1b')]===undefined?!![]:![]:!![],'where':_0x456695[_0x2655('0x1a')]?_0x456695['options'][_0x2655('0x1c')]||null:null,'attributes':_0x456695[_0x2655('0x1a')]?_0x456695['options'][_0x2655('0x1d')]||null:null,'limit':_0x456695[_0x2655('0x1a')]?_0x456695[_0x2655('0x1a')]['limit']||null:null,'include':_0x456695['options']?_0x456695[_0x2655('0x1a')][_0x2655('0x1e')]?_['map'](_0x456695[_0x2655('0x1a')][_0x2655('0x1e')],function(_0x2a46c9){return{'model':db[_0x2a46c9[_0x2655('0x1f')]],'as':_0x2a46c9['as'],'attributes':_0x2a46c9[_0x2655('0x1d')],'include':_0x2a46c9['include']?_['map'](_0x2a46c9['include'],function(_0x191735){return{'model':db[_0x191735[_0x2655('0x1f')]],'as':_0x191735['as'],'attributes':_0x191735[_0x2655('0x1d')],'include':_0x191735[_0x2655('0x1e')]?_[_0x2655('0x20')](_0x191735[_0x2655('0x1e')],function(_0x11e4e9){return{'model':db[_0x11e4e9[_0x2655('0x1f')]],'as':_0x11e4e9['as'],'attributes':_0x11e4e9[_0x2655('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2655('0xe')](function(_0x43cc52){logger[_0x2655('0xf')](_0x2655('0x21'),_0x456695);logger['debug']('GetSugarcrmAccount',_0x456695,JSON[_0x2655('0x13')](_0x43cc52));_0x256949(_0x43cc52);})['catch'](function(_0x1de8ad){logger[_0x2655('0x14')](_0x2655('0x21'),_0x1de8ad[_0x2655('0x15')],_0x456695);_0xc72e5b(_0xdcecf6['error'](0x1f4,_0x1de8ad['message']));});});};exports[_0x2655('0x22')]=function(_0x5d6bdf){var _0x184fde=this;return new Promise(function(_0x2899b0,_0x242a62){return db[_0x2655('0x18')][_0x2655('0x23')]({'raw':_0x5d6bdf[_0x2655('0x1a')]?_0x5d6bdf[_0x2655('0x1a')][_0x2655('0x1b')]===undefined?!![]:![]:!![],'where':_0x5d6bdf[_0x2655('0x1a')]?_0x5d6bdf[_0x2655('0x1a')][_0x2655('0x1c')]||null:null,'attributes':_0x5d6bdf[_0x2655('0x1a')]?_0x5d6bdf[_0x2655('0x1a')]['attributes']||null:null,'include':_0x5d6bdf[_0x2655('0x1a')]?_0x5d6bdf['options'][_0x2655('0x1e')]?_[_0x2655('0x20')](_0x5d6bdf[_0x2655('0x1a')][_0x2655('0x1e')],function(_0x361272){return{'model':db[_0x361272[_0x2655('0x1f')]],'as':_0x361272['as'],'attributes':_0x361272[_0x2655('0x1d')],'include':_0x361272[_0x2655('0x1e')]?_[_0x2655('0x20')](_0x361272['include'],function(_0xdfaaea){return{'model':db[_0xdfaaea[_0x2655('0x1f')]],'as':_0xdfaaea['as'],'attributes':_0xdfaaea[_0x2655('0x1d')],'include':_0xdfaaea[_0x2655('0x1e')]?_[_0x2655('0x20')](_0xdfaaea[_0x2655('0x1e')],function(_0xe76925){return{'model':db[_0xe76925[_0x2655('0x1f')]],'as':_0xe76925['as'],'attributes':_0xe76925[_0x2655('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2655('0xe')](function(_0x2a3b98){logger[_0x2655('0xf')](_0x2655('0x22'),_0x5d6bdf);logger['debug'](_0x2655('0x22'),_0x5d6bdf,JSON['stringify'](_0x2a3b98));_0x2899b0(_0x2a3b98);})[_0x2655('0x17')](function(_0x26ca6b){logger[_0x2655('0x14')](_0x2655('0x22'),_0x26ca6b[_0x2655('0x15')],_0x5d6bdf);_0x242a62(_0x184fde[_0x2655('0x14')](0x1f4,_0x26ca6b[_0x2655('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 4bc6ef5..1b0ca96 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 _0x4cdf=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','/:id','update','destroy','exports'];(function(_0x33de47,_0xd91e63){var _0x102d23=function(_0x1268b){while(--_0x1268b){_0x33de47['push'](_0x33de47['shift']());}};_0x102d23(++_0xd91e63);}(_0x4cdf,0x180));var _0xf4cd=function(_0x4abdcd,_0x52dcc3){_0x4abdcd=_0x4abdcd-0x0;var _0x1aef0c=_0x4cdf[_0x4abdcd];return _0x1aef0c;};'use strict';var multer=require(_0xf4cd('0x0'));var util=require(_0xf4cd('0x1'));var path=require(_0xf4cd('0x2'));var timeout=require(_0xf4cd('0x3'));var express=require(_0xf4cd('0x4'));var router=express[_0xf4cd('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf4cd('0x6'));var interaction=require(_0xf4cd('0x7'));var config=require('../../config/environment');var controller=require(_0xf4cd('0x8'));router[_0xf4cd('0x9')]('/',auth[_0xf4cd('0xa')](),controller[_0xf4cd('0xb')]);router[_0xf4cd('0x9')]('/:id',auth[_0xf4cd('0xa')](),controller[_0xf4cd('0xc')]);router[_0xf4cd('0x9')](_0xf4cd('0xd'),auth['isAuthenticated'](),controller[_0xf4cd('0xe')]);router[_0xf4cd('0x9')](_0xf4cd('0xf'),auth[_0xf4cd('0xa')](),controller[_0xf4cd('0x10')]);router[_0xf4cd('0x9')](_0xf4cd('0x11'),auth['isAuthenticated'](),controller[_0xf4cd('0x12')]);router[_0xf4cd('0x13')]('/',auth[_0xf4cd('0xa')](),controller['create']);router['put'](_0xf4cd('0x14'),auth[_0xf4cd('0xa')](),controller[_0xf4cd('0x15')]);router['delete'](_0xf4cd('0x14'),auth[_0xf4cd('0xa')](),controller[_0xf4cd('0x16')]);module[_0xf4cd('0x17')]=router; \ No newline at end of file +var _0xee4c=['getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show','get','/:id/fields'];(function(_0x591e16,_0x5aefc1){var _0x543b35=function(_0x81e3be){while(--_0x81e3be){_0x591e16['push'](_0x591e16['shift']());}};_0x543b35(++_0x5aefc1);}(_0xee4c,0x163));var _0xcee4=function(_0x19db39,_0x2e83e8){_0x19db39=_0x19db39-0x0;var _0x21ca1f=_0xee4c[_0x19db39];return _0x21ca1f;};'use strict';var multer=require('multer');var util=require(_0xcee4('0x0'));var path=require(_0xcee4('0x1'));var timeout=require(_0xcee4('0x2'));var express=require(_0xcee4('0x3'));var router=express[_0xcee4('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcee4('0x5'));var config=require(_0xcee4('0x6'));var controller=require('./intSugarcrmConfiguration.controller');router['get']('/',auth[_0xcee4('0x7')](),controller[_0xcee4('0x8')]);router['get'](_0xcee4('0x9'),auth[_0xcee4('0x7')](),controller[_0xcee4('0xa')]);router[_0xcee4('0xb')](_0xcee4('0xc'),auth[_0xcee4('0x7')](),controller[_0xcee4('0xd')]);router['get'](_0xcee4('0xe'),auth['isAuthenticated'](),controller[_0xcee4('0xf')]);router[_0xcee4('0xb')](_0xcee4('0x10'),auth['isAuthenticated'](),controller[_0xcee4('0x11')]);router[_0xcee4('0x12')]('/',auth[_0xcee4('0x7')](),controller['create']);router['put'](_0xcee4('0x9'),auth[_0xcee4('0x7')](),controller[_0xcee4('0x13')]);router[_0xcee4('0x14')](_0xcee4('0x9'),auth['isAuthenticated'](),controller[_0xcee4('0x15')]);module[_0xcee4('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 140ef7d..5571c87 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 _0x412b=['STRING'];(function(_0x2ec2bf,_0x64e983){var _0x2c279c=function(_0x41fe42){while(--_0x41fe42){_0x2ec2bf['push'](_0x2ec2bf['shift']());}};_0x2c279c(++_0x64e983);}(_0x412b,0xae));var _0xb412=function(_0x21d27e,_0x34f6fe){_0x21d27e=_0x21d27e-0x0;var _0x20837e=_0x412b[_0x21d27e];return _0x20837e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb412('0x0')]},'description':{'type':Sequelize[_0xb412('0x0')]}}; \ No newline at end of file +var _0xf4cd=['sequelize','exports','STRING'];(function(_0x1eec9a,_0xb0d7d3){var _0xc54892=function(_0x1071e9){while(--_0x1071e9){_0x1eec9a['push'](_0x1eec9a['shift']());}};_0xc54892(++_0xb0d7d3);}(_0xf4cd,0x1ce));var _0xdf4c=function(_0x27bf1d,_0x3f1fe3){_0x27bf1d=_0x27bf1d-0x0;var _0x193275=_0xf4cd[_0x27bf1d];return _0x193275;};'use strict';var Sequelize=require(_0xdf4c('0x0'));module[_0xdf4c('0x1')]={'name':{'type':Sequelize[_0xdf4c('0x2')]},'description':{'type':Sequelize[_0xdf4c('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index fc5fb20..ecc6d19 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 _0x1eb0=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','json','undefined','limit','offset','count','set','Content-Range','reject','update','then','destroy','end','error','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','pick','filter','where','VIRTUAL','options','SugarcrmConfiguration','include','findAll','rows','catch','params','includeAll','create','body','find','findOne','SugarcrmField','merge','getFields','hasOwnProperty','getSubjects','getDescriptions','order','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis'];(function(_0x3683ec,_0x59069c){var _0x2e5c29=function(_0x3658cb){while(--_0x3658cb){_0x3683ec['push'](_0x3683ec['shift']());}};_0x2e5c29(++_0x59069c);}(_0x1eb0,0xdb));var _0x01eb=function(_0x29f0fd,_0x27e131){_0x29f0fd=_0x29f0fd-0x0;var _0x4492b1=_0x1eb0[_0x29f0fd];return _0x4492b1;};'use strict';var emlformat=require(_0x01eb('0x0'));var rimraf=require(_0x01eb('0x1'));var zipdir=require(_0x01eb('0x2'));var jsonpatch=require(_0x01eb('0x3'));var rp=require(_0x01eb('0x4'));var moment=require(_0x01eb('0x5'));var BPromise=require(_0x01eb('0x6'));var Mustache=require('mustache');var util=require(_0x01eb('0x7'));var path=require('path');var sox=require(_0x01eb('0x8'));var csv=require(_0x01eb('0x9'));var ejs=require(_0x01eb('0xa'));var fs=require('fs');var fs_extra=require(_0x01eb('0xb'));var _=require('lodash');var squel=require(_0x01eb('0xc'));var crypto=require(_0x01eb('0xd'));var jsforce=require(_0x01eb('0xe'));var deskjs=require(_0x01eb('0xf'));var toCsv=require(_0x01eb('0x9'));var querystring=require('querystring');var Papa=require(_0x01eb('0x10'));var Redis=require(_0x01eb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x01eb('0x12'));var as=require(_0x01eb('0x13'));var hardwareService=require(_0x01eb('0x14'));var logger=require('../../config/logger')(_0x01eb('0x15'));var utils=require(_0x01eb('0x16'));var config=require(_0x01eb('0x17'));var licenseUtil=require(_0x01eb('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d190e,_0xc4df17){_0xc4df17=_0xc4df17||0xcc;return function(_0x223ad0){if(_0x223ad0){return _0x1d190e['sendStatus'](_0xc4df17);}return _0x1d190e[_0x01eb('0x19')](_0xc4df17)['end']();};}function respondWithResult(_0x25ab51,_0x21f4b8){_0x21f4b8=_0x21f4b8||0xc8;return function(_0x4dd582){if(_0x4dd582){return _0x25ab51[_0x01eb('0x19')](_0x21f4b8)[_0x01eb('0x1a')](_0x4dd582);}};}function respondWithFilteredResult(_0x419ce6,_0x45c315){return function(_0x476846){if(_0x476846){var _0xab431=typeof _0x45c315['offset']===_0x01eb('0x1b')&&typeof _0x45c315[_0x01eb('0x1c')]===_0x01eb('0x1b');var _0x143ea9=_0x476846['count'];var _0x2399b7=_0xab431?0x0:_0x45c315[_0x01eb('0x1d')];var _0x157d58=_0xab431?_0x476846[_0x01eb('0x1e')]:_0x45c315[_0x01eb('0x1d')]+_0x45c315['limit'];var _0x1d4c74;if(_0x157d58>=_0x143ea9){_0x157d58=_0x143ea9;_0x1d4c74=0xc8;}else{_0x1d4c74=0xce;}_0x419ce6['status'](_0x1d4c74);return _0x419ce6[_0x01eb('0x1f')](_0x01eb('0x20'),_0x2399b7+'-'+_0x157d58+'/'+_0x143ea9)['json'](_0x476846);}return null;};}function patchUpdates(_0xd0dd83){return function(_0x245021){try{jsonpatch['apply'](_0x245021,_0xd0dd83,!![]);}catch(_0x328a2f){return BPromise[_0x01eb('0x21')](_0x328a2f);}return _0x245021['save']();};}function saveUpdates(_0x5742af,_0x54f393){return function(_0x3d04d4){if(_0x3d04d4){return _0x3d04d4[_0x01eb('0x22')](_0x5742af)[_0x01eb('0x23')](function(_0x4ceb91){return _0x4ceb91;});}return null;};}function removeEntity(_0x5c0d82,_0x430f91){return function(_0x5b0e2a){if(_0x5b0e2a){return _0x5b0e2a[_0x01eb('0x24')]()[_0x01eb('0x23')](function(){_0x5c0d82[_0x01eb('0x19')](0xcc)[_0x01eb('0x25')]();});}};}function handleEntityNotFound(_0x3b2632,_0x355275){return function(_0x599ad7){if(!_0x599ad7){_0x3b2632['sendStatus'](0x194);}return _0x599ad7;};}function handleError(_0x5519e7,_0x7c5bf){_0x7c5bf=_0x7c5bf||0x1f4;return function(_0x91b585){logger[_0x01eb('0x26')](_0x91b585['stack']);if(_0x91b585[_0x01eb('0x27')]){delete _0x91b585[_0x01eb('0x27')];}_0x5519e7[_0x01eb('0x19')](_0x7c5bf)[_0x01eb('0x28')](_0x91b585);};}exports['index']=function(_0x3044f3,_0x56e624){var _0x4eda36={},_0x2a83ed={},_0x7a1019={'count':0x0,'rows':[]};var _0xffd092=_[_0x01eb('0x29')](db['SugarcrmConfiguration'][_0x01eb('0x2a')],function(_0xf3eea4){return{'name':_0xf3eea4[_0x01eb('0x2b')],'type':_0xf3eea4[_0x01eb('0x2c')][_0x01eb('0x2d')]};});_0x2a83ed['model']=_['map'](_0xffd092,'name');_0x2a83ed[_0x01eb('0x2e')]=_[_0x01eb('0x2f')](_0x3044f3[_0x01eb('0x2e')]);_0x2a83ed[_0x01eb('0x30')]=_[_0x01eb('0x31')](_0x2a83ed[_0x01eb('0x32')],_0x2a83ed['query']);_0x4eda36[_0x01eb('0x33')]=_[_0x01eb('0x31')](_0x2a83ed[_0x01eb('0x32')],qs['fields'](_0x3044f3['query'][_0x01eb('0x34')]));_0x4eda36['attributes']=_0x4eda36[_0x01eb('0x33')][_0x01eb('0x35')]?_0x4eda36['attributes']:_0x2a83ed[_0x01eb('0x32')];if(!_0x3044f3[_0x01eb('0x2e')]['hasOwnProperty'](_0x01eb('0x36'))){_0x4eda36['limit']=qs[_0x01eb('0x1c')](_0x3044f3[_0x01eb('0x2e')][_0x01eb('0x1c')]);_0x4eda36[_0x01eb('0x1d')]=qs[_0x01eb('0x1d')](_0x3044f3[_0x01eb('0x2e')]['offset']);}_0x4eda36['order']=qs[_0x01eb('0x37')](_0x3044f3['query'][_0x01eb('0x37')]);_0x4eda36['where']=qs[_0x01eb('0x30')](_[_0x01eb('0x38')](_0x3044f3['query'],_0x2a83ed[_0x01eb('0x30')]),_0xffd092);if(_0x3044f3[_0x01eb('0x2e')][_0x01eb('0x39')]){_0x4eda36['where']=_['merge'](_0x4eda36[_0x01eb('0x3a')],{'$or':_[_0x01eb('0x29')](_0xffd092,function(_0x523562){if(_0x523562[_0x01eb('0x2c')]!==_0x01eb('0x3b')){var _0x24dd1f={};_0x24dd1f[_0x523562[_0x01eb('0x27')]]={'$like':'%'+_0x3044f3[_0x01eb('0x2e')][_0x01eb('0x39')]+'%'};return _0x24dd1f;}})});}_0x4eda36=_['merge']({},_0x4eda36,_0x3044f3[_0x01eb('0x3c')]);var _0x423b2f={'where':_0x4eda36[_0x01eb('0x3a')]};return db[_0x01eb('0x3d')][_0x01eb('0x1e')](_0x423b2f)[_0x01eb('0x23')](function(_0x42847d){_0x7a1019[_0x01eb('0x1e')]=_0x42847d;if(_0x3044f3[_0x01eb('0x2e')]['includeAll']){_0x4eda36[_0x01eb('0x3e')]=[{'all':!![]}];}return db[_0x01eb('0x3d')][_0x01eb('0x3f')](_0x4eda36);})[_0x01eb('0x23')](function(_0x4b3732){_0x7a1019[_0x01eb('0x40')]=_0x4b3732;return _0x7a1019;})['then'](respondWithFilteredResult(_0x56e624,_0x4eda36))[_0x01eb('0x41')](handleError(_0x56e624,null));};exports['show']=function(_0x408102,_0x2eda79){var _0x29d702={'raw':![],'where':{'id':_0x408102[_0x01eb('0x42')]['id']}},_0x551ffc={};_0x551ffc[_0x01eb('0x32')]=_[_0x01eb('0x2f')](db[_0x01eb('0x3d')][_0x01eb('0x2a')]);_0x551ffc[_0x01eb('0x2e')]=_[_0x01eb('0x2f')](_0x408102[_0x01eb('0x2e')]);_0x551ffc[_0x01eb('0x30')]=_[_0x01eb('0x31')](_0x551ffc[_0x01eb('0x32')],_0x551ffc[_0x01eb('0x2e')]);_0x29d702[_0x01eb('0x33')]=_[_0x01eb('0x31')](_0x551ffc[_0x01eb('0x32')],qs[_0x01eb('0x34')](_0x408102['query'][_0x01eb('0x34')]));_0x29d702['attributes']=_0x29d702[_0x01eb('0x33')][_0x01eb('0x35')]?_0x29d702[_0x01eb('0x33')]:_0x551ffc['model'];if(_0x408102[_0x01eb('0x2e')][_0x01eb('0x43')]){_0x29d702[_0x01eb('0x3e')]=[{'all':!![]}];}_0x29d702=_['merge']({},_0x29d702,_0x408102[_0x01eb('0x3c')]);return db['SugarcrmConfiguration']['find'](_0x29d702)[_0x01eb('0x23')](handleEntityNotFound(_0x2eda79,null))[_0x01eb('0x23')](respondWithResult(_0x2eda79,null))['catch'](handleError(_0x2eda79,null));};exports[_0x01eb('0x44')]=function(_0x20900c,_0x5bbbf1){return db['SugarcrmConfiguration']['create'](_0x20900c['body'],{})[_0x01eb('0x23')](respondWithResult(_0x5bbbf1,0xc9))[_0x01eb('0x41')](handleError(_0x5bbbf1,null));};exports['update']=function(_0x1e0d3b,_0x2e9949){if(_0x1e0d3b[_0x01eb('0x45')]['id']){delete _0x1e0d3b[_0x01eb('0x45')]['id'];}return db[_0x01eb('0x3d')][_0x01eb('0x46')]({'where':{'id':_0x1e0d3b[_0x01eb('0x42')]['id']}})[_0x01eb('0x23')](handleEntityNotFound(_0x2e9949,null))[_0x01eb('0x23')](saveUpdates(_0x1e0d3b[_0x01eb('0x45')],null))[_0x01eb('0x23')](respondWithResult(_0x2e9949,null))['catch'](handleError(_0x2e9949,null));};exports['destroy']=function(_0xfa376b,_0x3f7b4f){return db[_0x01eb('0x3d')][_0x01eb('0x46')]({'where':{'id':_0xfa376b[_0x01eb('0x42')]['id']}})[_0x01eb('0x23')](handleEntityNotFound(_0x3f7b4f,null))[_0x01eb('0x23')](removeEntity(_0x3f7b4f,null))['catch'](handleError(_0x3f7b4f,null));};exports['getFields']=function(_0x270777,_0x53de05,_0x52d3d6){var _0x1b8943={};var _0x530b6e={};var _0x45b92c;var _0x290c54;return db[_0x01eb('0x3d')][_0x01eb('0x47')]({'where':{'id':_0x270777['params']['id']}})['then'](handleEntityNotFound(_0x53de05,null))['then'](function(_0x18fed6){if(_0x18fed6){_0x45b92c=_0x18fed6;_0x530b6e[_0x01eb('0x32')]=_[_0x01eb('0x2f')](db[_0x01eb('0x48')][_0x01eb('0x2a')]);_0x530b6e['query']=_[_0x01eb('0x2f')](_0x270777[_0x01eb('0x2e')]);_0x530b6e['filters']=_['intersection'](_0x530b6e[_0x01eb('0x32')],_0x530b6e[_0x01eb('0x2e')]);_0x1b8943['attributes']=_[_0x01eb('0x31')](_0x530b6e[_0x01eb('0x32')],qs['fields'](_0x270777['query'][_0x01eb('0x34')]));_0x1b8943[_0x01eb('0x33')]=_0x1b8943[_0x01eb('0x33')][_0x01eb('0x35')]?_0x1b8943[_0x01eb('0x33')]:_0x530b6e[_0x01eb('0x32')];_0x1b8943['order']=qs['sort'](_0x270777[_0x01eb('0x2e')][_0x01eb('0x37')]);_0x1b8943[_0x01eb('0x3a')]=qs[_0x01eb('0x30')](_[_0x01eb('0x38')](_0x270777['query'],_0x530b6e['filters']));if(_0x270777['query']['filter']){_0x1b8943[_0x01eb('0x3a')]=_[_0x01eb('0x49')](_0x1b8943[_0x01eb('0x3a')],{'$or':_['map'](_0x1b8943['attributes'],function(_0x510444){var _0x6a88c={};_0x6a88c[_0x510444]={'$like':'%'+_0x270777[_0x01eb('0x2e')][_0x01eb('0x39')]+'%'};return _0x6a88c;})});}_0x1b8943=_[_0x01eb('0x49')]({},_0x1b8943,_0x270777[_0x01eb('0x3c')]);return _0x45b92c[_0x01eb('0x4a')](_0x1b8943);}})[_0x01eb('0x23')](function(_0x262546){if(_0x262546){_0x290c54=_0x262546[_0x01eb('0x35')];if(!_0x270777['query'][_0x01eb('0x4b')](_0x01eb('0x36'))){_0x1b8943[_0x01eb('0x1c')]=qs[_0x01eb('0x1c')](_0x270777[_0x01eb('0x2e')][_0x01eb('0x1c')]);_0x1b8943[_0x01eb('0x1d')]=qs[_0x01eb('0x1d')](_0x270777[_0x01eb('0x2e')]['offset']);}return _0x45b92c[_0x01eb('0x4a')](_0x1b8943);}})['then'](function(_0x32c9ff){if(_0x32c9ff){return _0x32c9ff?{'count':_0x290c54,'rows':_0x32c9ff}:null;}})['then'](respondWithResult(_0x53de05,null))[_0x01eb('0x41')](handleError(_0x53de05,null));};exports['getSubjects']=function(_0x39ecae,_0x21380f,_0x203509){var _0x2696f9={};var _0x135597={};var _0x4b426d;var _0x2840b7;return db[_0x01eb('0x3d')]['findOne']({'where':{'id':_0x39ecae[_0x01eb('0x42')]['id']}})[_0x01eb('0x23')](handleEntityNotFound(_0x21380f,null))['then'](function(_0x28c335){if(_0x28c335){_0x4b426d=_0x28c335;_0x135597['model']=_[_0x01eb('0x2f')](db[_0x01eb('0x48')][_0x01eb('0x2a')]);_0x135597[_0x01eb('0x2e')]=_[_0x01eb('0x2f')](_0x39ecae[_0x01eb('0x2e')]);_0x135597[_0x01eb('0x30')]=_[_0x01eb('0x31')](_0x135597['model'],_0x135597[_0x01eb('0x2e')]);_0x2696f9['attributes']=_[_0x01eb('0x31')](_0x135597[_0x01eb('0x32')],qs[_0x01eb('0x34')](_0x39ecae[_0x01eb('0x2e')][_0x01eb('0x34')]));_0x2696f9[_0x01eb('0x33')]=_0x2696f9[_0x01eb('0x33')]['length']?_0x2696f9[_0x01eb('0x33')]:_0x135597[_0x01eb('0x32')];_0x2696f9['order']=qs['sort'](_0x39ecae[_0x01eb('0x2e')][_0x01eb('0x37')]);_0x2696f9[_0x01eb('0x3a')]=qs[_0x01eb('0x30')](_[_0x01eb('0x38')](_0x39ecae['query'],_0x135597['filters']));if(_0x39ecae['query'][_0x01eb('0x39')]){_0x2696f9[_0x01eb('0x3a')]=_[_0x01eb('0x49')](_0x2696f9['where'],{'$or':_['map'](_0x2696f9[_0x01eb('0x33')],function(_0x5eaedb){var _0xcabf={};_0xcabf[_0x5eaedb]={'$like':'%'+_0x39ecae['query']['filter']+'%'};return _0xcabf;})});}_0x2696f9=_[_0x01eb('0x49')]({},_0x2696f9,_0x39ecae[_0x01eb('0x3c')]);return _0x4b426d[_0x01eb('0x4c')](_0x2696f9);}})[_0x01eb('0x23')](function(_0x535a64){if(_0x535a64){_0x2840b7=_0x535a64[_0x01eb('0x35')];if(!_0x39ecae[_0x01eb('0x2e')]['hasOwnProperty']('nolimit')){_0x2696f9['limit']=qs['limit'](_0x39ecae[_0x01eb('0x2e')][_0x01eb('0x1c')]);_0x2696f9[_0x01eb('0x1d')]=qs['offset'](_0x39ecae['query'][_0x01eb('0x1d')]);}return _0x4b426d[_0x01eb('0x4c')](_0x2696f9);}})[_0x01eb('0x23')](function(_0xe7bad4){if(_0xe7bad4){return _0xe7bad4?{'count':_0x2840b7,'rows':_0xe7bad4}:null;}})[_0x01eb('0x23')](respondWithResult(_0x21380f,null))[_0x01eb('0x41')](handleError(_0x21380f,null));};exports[_0x01eb('0x4d')]=function(_0x15dea3,_0x1fde8c,_0x2c93e9){var _0x27107d={};var _0x4c2d95={};var _0x369b43;var _0x7931cc;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x15dea3[_0x01eb('0x42')]['id']}})['then'](handleEntityNotFound(_0x1fde8c,null))['then'](function(_0x21ca05){if(_0x21ca05){_0x369b43=_0x21ca05;_0x4c2d95[_0x01eb('0x32')]=_[_0x01eb('0x2f')](db[_0x01eb('0x48')]['rawAttributes']);_0x4c2d95[_0x01eb('0x2e')]=_[_0x01eb('0x2f')](_0x15dea3[_0x01eb('0x2e')]);_0x4c2d95[_0x01eb('0x30')]=_[_0x01eb('0x31')](_0x4c2d95[_0x01eb('0x32')],_0x4c2d95['query']);_0x27107d['attributes']=_[_0x01eb('0x31')](_0x4c2d95[_0x01eb('0x32')],qs[_0x01eb('0x34')](_0x15dea3['query'][_0x01eb('0x34')]));_0x27107d[_0x01eb('0x33')]=_0x27107d[_0x01eb('0x33')][_0x01eb('0x35')]?_0x27107d[_0x01eb('0x33')]:_0x4c2d95['model'];_0x27107d[_0x01eb('0x4e')]=qs[_0x01eb('0x37')](_0x15dea3[_0x01eb('0x2e')][_0x01eb('0x37')]);_0x27107d[_0x01eb('0x3a')]=qs[_0x01eb('0x30')](_[_0x01eb('0x38')](_0x15dea3[_0x01eb('0x2e')],_0x4c2d95[_0x01eb('0x30')]));if(_0x15dea3['query'][_0x01eb('0x39')]){_0x27107d[_0x01eb('0x3a')]=_[_0x01eb('0x49')](_0x27107d['where'],{'$or':_[_0x01eb('0x29')](_0x27107d['attributes'],function(_0x4baf9e){var _0x26ab8a={};_0x26ab8a[_0x4baf9e]={'$like':'%'+_0x15dea3[_0x01eb('0x2e')][_0x01eb('0x39')]+'%'};return _0x26ab8a;})});}_0x27107d=_['merge']({},_0x27107d,_0x15dea3[_0x01eb('0x3c')]);return _0x369b43['getDescriptions'](_0x27107d);}})[_0x01eb('0x23')](function(_0x540d65){if(_0x540d65){_0x7931cc=_0x540d65[_0x01eb('0x35')];if(!_0x15dea3[_0x01eb('0x2e')][_0x01eb('0x4b')](_0x01eb('0x36'))){_0x27107d[_0x01eb('0x1c')]=qs[_0x01eb('0x1c')](_0x15dea3[_0x01eb('0x2e')][_0x01eb('0x1c')]);_0x27107d[_0x01eb('0x1d')]=qs[_0x01eb('0x1d')](_0x15dea3[_0x01eb('0x2e')][_0x01eb('0x1d')]);}return _0x369b43[_0x01eb('0x4d')](_0x27107d);}})[_0x01eb('0x23')](function(_0x447c7f){if(_0x447c7f){return _0x447c7f?{'count':_0x7931cc,'rows':_0x447c7f}:null;}})[_0x01eb('0x23')](respondWithResult(_0x1fde8c,null))[_0x01eb('0x41')](handleError(_0x1fde8c,null));}; \ No newline at end of file +var _0x4309=['include','findAll','catch','show','params','create','body','find','getFields','findOne','SugarcrmField','hasOwnProperty','nolimit','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','index','map','SugarcrmConfiguration','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll'];(function(_0x262f47,_0x300945){var _0x557f7c=function(_0x8988d0){while(--_0x8988d0){_0x262f47['push'](_0x262f47['shift']());}};_0x557f7c(++_0x300945);}(_0x4309,0x163));var _0x9430=function(_0x53e5a7,_0x582bde){_0x53e5a7=_0x53e5a7-0x0;var _0x3a0424=_0x4309[_0x53e5a7];return _0x3a0424;};'use strict';var emlformat=require(_0x9430('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9430('0x1'));var jsonpatch=require(_0x9430('0x2'));var rp=require(_0x9430('0x3'));var moment=require(_0x9430('0x4'));var BPromise=require(_0x9430('0x5'));var Mustache=require(_0x9430('0x6'));var util=require(_0x9430('0x7'));var path=require(_0x9430('0x8'));var sox=require(_0x9430('0x9'));var csv=require(_0x9430('0xa'));var ejs=require(_0x9430('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9430('0xc'));var squel=require(_0x9430('0xd'));var crypto=require(_0x9430('0xe'));var jsforce=require(_0x9430('0xf'));var deskjs=require(_0x9430('0x10'));var toCsv=require('to-csv');var querystring=require(_0x9430('0x11'));var Papa=require(_0x9430('0x12'));var Redis=require(_0x9430('0x13'));var authService=require(_0x9430('0x14'));var qs=require(_0x9430('0x15'));var as=require(_0x9430('0x16'));var hardwareService=require(_0x9430('0x17'));var logger=require(_0x9430('0x18'))(_0x9430('0x19'));var utils=require(_0x9430('0x1a'));var config=require(_0x9430('0x1b'));var licenseUtil=require(_0x9430('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f954c,_0xe3eefa){_0xe3eefa=_0xe3eefa||0xcc;return function(_0x36f1b0){if(_0x36f1b0){return _0x1f954c[_0x9430('0x1d')](_0xe3eefa);}return _0x1f954c[_0x9430('0x1e')](_0xe3eefa)['end']();};}function respondWithResult(_0x25302e,_0x386ef6){_0x386ef6=_0x386ef6||0xc8;return function(_0xaeb413){if(_0xaeb413){return _0x25302e[_0x9430('0x1e')](_0x386ef6)[_0x9430('0x1f')](_0xaeb413);}};}function respondWithFilteredResult(_0x131499,_0x3dda2d){return function(_0x2136d1){if(_0x2136d1){var _0x2666a3=typeof _0x3dda2d[_0x9430('0x20')]===_0x9430('0x21')&&typeof _0x3dda2d[_0x9430('0x22')]==='undefined';var _0x38f19a=_0x2136d1[_0x9430('0x23')];var _0xe15107=_0x2666a3?0x0:_0x3dda2d[_0x9430('0x20')];var _0x21708e=_0x2666a3?_0x2136d1['count']:_0x3dda2d[_0x9430('0x20')]+_0x3dda2d[_0x9430('0x22')];var _0x3caa1a;if(_0x21708e>=_0x38f19a){_0x21708e=_0x38f19a;_0x3caa1a=0xc8;}else{_0x3caa1a=0xce;}_0x131499[_0x9430('0x1e')](_0x3caa1a);return _0x131499[_0x9430('0x24')](_0x9430('0x25'),_0xe15107+'-'+_0x21708e+'/'+_0x38f19a)[_0x9430('0x1f')](_0x2136d1);}return null;};}function patchUpdates(_0xfb2edd){return function(_0x3378d5){try{jsonpatch[_0x9430('0x26')](_0x3378d5,_0xfb2edd,!![]);}catch(_0x2b5043){return BPromise[_0x9430('0x27')](_0x2b5043);}return _0x3378d5[_0x9430('0x28')]();};}function saveUpdates(_0x334278,_0x36149b){return function(_0x3378e2){if(_0x3378e2){return _0x3378e2[_0x9430('0x29')](_0x334278)[_0x9430('0x2a')](function(_0x3666f3){return _0x3666f3;});}return null;};}function removeEntity(_0x289f70,_0x32351d){return function(_0x2baa3e){if(_0x2baa3e){return _0x2baa3e['destroy']()[_0x9430('0x2a')](function(){_0x289f70[_0x9430('0x1e')](0xcc)[_0x9430('0x2b')]();});}};}function handleEntityNotFound(_0x12d6cf,_0x251547){return function(_0xce650){if(!_0xce650){_0x12d6cf[_0x9430('0x1d')](0x194);}return _0xce650;};}function handleError(_0x5608f9,_0x533e87){_0x533e87=_0x533e87||0x1f4;return function(_0x10d264){logger[_0x9430('0x2c')](_0x10d264[_0x9430('0x2d')]);if(_0x10d264[_0x9430('0x2e')]){delete _0x10d264[_0x9430('0x2e')];}_0x5608f9['status'](_0x533e87)['send'](_0x10d264);};}exports[_0x9430('0x2f')]=function(_0x2532c5,_0x2713be){var _0x799390={},_0x2ff068={},_0x8af53c={'count':0x0,'rows':[]};var _0x20e6c6=_[_0x9430('0x30')](db[_0x9430('0x31')][_0x9430('0x32')],function(_0x3bf5d6){return{'name':_0x3bf5d6[_0x9430('0x33')],'type':_0x3bf5d6['type']['key']};});_0x2ff068[_0x9430('0x34')]=_[_0x9430('0x30')](_0x20e6c6,_0x9430('0x2e'));_0x2ff068[_0x9430('0x35')]=_[_0x9430('0x36')](_0x2532c5[_0x9430('0x35')]);_0x2ff068['filters']=_[_0x9430('0x37')](_0x2ff068[_0x9430('0x34')],_0x2ff068['query']);_0x799390[_0x9430('0x38')]=_[_0x9430('0x37')](_0x2ff068[_0x9430('0x34')],qs['fields'](_0x2532c5[_0x9430('0x35')][_0x9430('0x39')]));_0x799390[_0x9430('0x38')]=_0x799390[_0x9430('0x38')][_0x9430('0x3a')]?_0x799390['attributes']:_0x2ff068[_0x9430('0x34')];if(!_0x2532c5[_0x9430('0x35')]['hasOwnProperty']('nolimit')){_0x799390[_0x9430('0x22')]=qs['limit'](_0x2532c5[_0x9430('0x35')]['limit']);_0x799390['offset']=qs[_0x9430('0x20')](_0x2532c5[_0x9430('0x35')]['offset']);}_0x799390[_0x9430('0x3b')]=qs['sort'](_0x2532c5[_0x9430('0x35')][_0x9430('0x3c')]);_0x799390[_0x9430('0x3d')]=qs[_0x9430('0x3e')](_[_0x9430('0x3f')](_0x2532c5['query'],_0x2ff068['filters']),_0x20e6c6);if(_0x2532c5[_0x9430('0x35')]['filter']){_0x799390['where']=_[_0x9430('0x40')](_0x799390[_0x9430('0x3d')],{'$or':_[_0x9430('0x30')](_0x20e6c6,function(_0x4e5c74){if(_0x4e5c74[_0x9430('0x41')]!==_0x9430('0x42')){var _0x1a75cd={};_0x1a75cd[_0x4e5c74[_0x9430('0x2e')]]={'$like':'%'+_0x2532c5[_0x9430('0x35')][_0x9430('0x43')]+'%'};return _0x1a75cd;}})});}_0x799390=_['merge']({},_0x799390,_0x2532c5[_0x9430('0x44')]);var _0x4debd4={'where':_0x799390[_0x9430('0x3d')]};return db[_0x9430('0x31')][_0x9430('0x23')](_0x4debd4)[_0x9430('0x2a')](function(_0x14bae1){_0x8af53c[_0x9430('0x23')]=_0x14bae1;if(_0x2532c5['query'][_0x9430('0x45')]){_0x799390[_0x9430('0x46')]=[{'all':!![]}];}return db[_0x9430('0x31')][_0x9430('0x47')](_0x799390);})[_0x9430('0x2a')](function(_0x812903){_0x8af53c['rows']=_0x812903;return _0x8af53c;})[_0x9430('0x2a')](respondWithFilteredResult(_0x2713be,_0x799390))[_0x9430('0x48')](handleError(_0x2713be,null));};exports[_0x9430('0x49')]=function(_0x2137dd,_0x3b5a97){var _0x187f4f={'raw':![],'where':{'id':_0x2137dd[_0x9430('0x4a')]['id']}},_0x58a7cd={};_0x58a7cd[_0x9430('0x34')]=_[_0x9430('0x36')](db[_0x9430('0x31')]['rawAttributes']);_0x58a7cd[_0x9430('0x35')]=_[_0x9430('0x36')](_0x2137dd['query']);_0x58a7cd[_0x9430('0x3e')]=_['intersection'](_0x58a7cd[_0x9430('0x34')],_0x58a7cd[_0x9430('0x35')]);_0x187f4f[_0x9430('0x38')]=_[_0x9430('0x37')](_0x58a7cd['model'],qs['fields'](_0x2137dd['query'][_0x9430('0x39')]));_0x187f4f[_0x9430('0x38')]=_0x187f4f['attributes'][_0x9430('0x3a')]?_0x187f4f[_0x9430('0x38')]:_0x58a7cd[_0x9430('0x34')];if(_0x2137dd['query'][_0x9430('0x45')]){_0x187f4f[_0x9430('0x46')]=[{'all':!![]}];}_0x187f4f=_[_0x9430('0x40')]({},_0x187f4f,_0x2137dd['options']);return db[_0x9430('0x31')]['find'](_0x187f4f)[_0x9430('0x2a')](handleEntityNotFound(_0x3b5a97,null))[_0x9430('0x2a')](respondWithResult(_0x3b5a97,null))['catch'](handleError(_0x3b5a97,null));};exports[_0x9430('0x4b')]=function(_0x5217f7,_0x2cc578){return db[_0x9430('0x31')][_0x9430('0x4b')](_0x5217f7[_0x9430('0x4c')],{})[_0x9430('0x2a')](respondWithResult(_0x2cc578,0xc9))[_0x9430('0x48')](handleError(_0x2cc578,null));};exports[_0x9430('0x29')]=function(_0x306810,_0x12e9cc){if(_0x306810['body']['id']){delete _0x306810[_0x9430('0x4c')]['id'];}return db[_0x9430('0x31')]['find']({'where':{'id':_0x306810[_0x9430('0x4a')]['id']}})['then'](handleEntityNotFound(_0x12e9cc,null))['then'](saveUpdates(_0x306810[_0x9430('0x4c')],null))[_0x9430('0x2a')](respondWithResult(_0x12e9cc,null))[_0x9430('0x48')](handleError(_0x12e9cc,null));};exports['destroy']=function(_0x4dd212,_0x56b608){return db[_0x9430('0x31')][_0x9430('0x4d')]({'where':{'id':_0x4dd212['params']['id']}})[_0x9430('0x2a')](handleEntityNotFound(_0x56b608,null))[_0x9430('0x2a')](removeEntity(_0x56b608,null))[_0x9430('0x48')](handleError(_0x56b608,null));};exports[_0x9430('0x4e')]=function(_0x235c97,_0x158dcb,_0xa0af1){var _0x1269ba={};var _0x1b1cce={};var _0x42fb6b;var _0x5773c9;return db[_0x9430('0x31')][_0x9430('0x4f')]({'where':{'id':_0x235c97['params']['id']}})[_0x9430('0x2a')](handleEntityNotFound(_0x158dcb,null))[_0x9430('0x2a')](function(_0x1f1199){if(_0x1f1199){_0x42fb6b=_0x1f1199;_0x1b1cce[_0x9430('0x34')]=_[_0x9430('0x36')](db[_0x9430('0x50')]['rawAttributes']);_0x1b1cce[_0x9430('0x35')]=_['keys'](_0x235c97[_0x9430('0x35')]);_0x1b1cce[_0x9430('0x3e')]=_[_0x9430('0x37')](_0x1b1cce[_0x9430('0x34')],_0x1b1cce[_0x9430('0x35')]);_0x1269ba[_0x9430('0x38')]=_[_0x9430('0x37')](_0x1b1cce[_0x9430('0x34')],qs['fields'](_0x235c97['query'][_0x9430('0x39')]));_0x1269ba['attributes']=_0x1269ba['attributes'][_0x9430('0x3a')]?_0x1269ba['attributes']:_0x1b1cce[_0x9430('0x34')];_0x1269ba[_0x9430('0x3b')]=qs[_0x9430('0x3c')](_0x235c97['query'][_0x9430('0x3c')]);_0x1269ba[_0x9430('0x3d')]=qs['filters'](_[_0x9430('0x3f')](_0x235c97[_0x9430('0x35')],_0x1b1cce['filters']));if(_0x235c97[_0x9430('0x35')][_0x9430('0x43')]){_0x1269ba[_0x9430('0x3d')]=_['merge'](_0x1269ba[_0x9430('0x3d')],{'$or':_[_0x9430('0x30')](_0x1269ba[_0x9430('0x38')],function(_0x58756c){var _0x7b37ac={};_0x7b37ac[_0x58756c]={'$like':'%'+_0x235c97[_0x9430('0x35')]['filter']+'%'};return _0x7b37ac;})});}_0x1269ba=_[_0x9430('0x40')]({},_0x1269ba,_0x235c97[_0x9430('0x44')]);return _0x42fb6b[_0x9430('0x4e')](_0x1269ba);}})[_0x9430('0x2a')](function(_0x419853){if(_0x419853){_0x5773c9=_0x419853[_0x9430('0x3a')];if(!_0x235c97[_0x9430('0x35')][_0x9430('0x51')](_0x9430('0x52'))){_0x1269ba[_0x9430('0x22')]=qs[_0x9430('0x22')](_0x235c97['query'][_0x9430('0x22')]);_0x1269ba[_0x9430('0x20')]=qs['offset'](_0x235c97['query'][_0x9430('0x20')]);}return _0x42fb6b['getFields'](_0x1269ba);}})[_0x9430('0x2a')](function(_0x588d42){if(_0x588d42){return _0x588d42?{'count':_0x5773c9,'rows':_0x588d42}:null;}})['then'](respondWithResult(_0x158dcb,null))[_0x9430('0x48')](handleError(_0x158dcb,null));};exports[_0x9430('0x53')]=function(_0x4c0662,_0xc9ae37,_0x16a2f3){var _0x1448f5={};var _0x4a0339={};var _0x2df4fe;var _0x1a0d99;return db[_0x9430('0x31')][_0x9430('0x4f')]({'where':{'id':_0x4c0662['params']['id']}})[_0x9430('0x2a')](handleEntityNotFound(_0xc9ae37,null))[_0x9430('0x2a')](function(_0x3e7182){if(_0x3e7182){_0x2df4fe=_0x3e7182;_0x4a0339[_0x9430('0x34')]=_[_0x9430('0x36')](db[_0x9430('0x50')][_0x9430('0x32')]);_0x4a0339['query']=_['keys'](_0x4c0662[_0x9430('0x35')]);_0x4a0339['filters']=_[_0x9430('0x37')](_0x4a0339[_0x9430('0x34')],_0x4a0339[_0x9430('0x35')]);_0x1448f5[_0x9430('0x38')]=_[_0x9430('0x37')](_0x4a0339[_0x9430('0x34')],qs[_0x9430('0x39')](_0x4c0662[_0x9430('0x35')][_0x9430('0x39')]));_0x1448f5[_0x9430('0x38')]=_0x1448f5[_0x9430('0x38')]['length']?_0x1448f5[_0x9430('0x38')]:_0x4a0339[_0x9430('0x34')];_0x1448f5[_0x9430('0x3b')]=qs[_0x9430('0x3c')](_0x4c0662[_0x9430('0x35')][_0x9430('0x3c')]);_0x1448f5[_0x9430('0x3d')]=qs[_0x9430('0x3e')](_['pick'](_0x4c0662[_0x9430('0x35')],_0x4a0339[_0x9430('0x3e')]));if(_0x4c0662[_0x9430('0x35')][_0x9430('0x43')]){_0x1448f5[_0x9430('0x3d')]=_[_0x9430('0x40')](_0x1448f5[_0x9430('0x3d')],{'$or':_[_0x9430('0x30')](_0x1448f5[_0x9430('0x38')],function(_0x13c7a9){var _0x197f0e={};_0x197f0e[_0x13c7a9]={'$like':'%'+_0x4c0662[_0x9430('0x35')][_0x9430('0x43')]+'%'};return _0x197f0e;})});}_0x1448f5=_[_0x9430('0x40')]({},_0x1448f5,_0x4c0662[_0x9430('0x44')]);return _0x2df4fe[_0x9430('0x53')](_0x1448f5);}})[_0x9430('0x2a')](function(_0x470c67){if(_0x470c67){_0x1a0d99=_0x470c67[_0x9430('0x3a')];if(!_0x4c0662[_0x9430('0x35')][_0x9430('0x51')](_0x9430('0x52'))){_0x1448f5[_0x9430('0x22')]=qs[_0x9430('0x22')](_0x4c0662[_0x9430('0x35')][_0x9430('0x22')]);_0x1448f5[_0x9430('0x20')]=qs[_0x9430('0x20')](_0x4c0662['query'][_0x9430('0x20')]);}return _0x2df4fe[_0x9430('0x53')](_0x1448f5);}})[_0x9430('0x2a')](function(_0x3fb28b){if(_0x3fb28b){return _0x3fb28b?{'count':_0x1a0d99,'rows':_0x3fb28b}:null;}})[_0x9430('0x2a')](respondWithResult(_0xc9ae37,null))['catch'](handleError(_0xc9ae37,null));};exports[_0x9430('0x54')]=function(_0xe66877,_0x40a4df,_0x26efb5){var _0x587d8c={};var _0x1efd2c={};var _0xd85270;var _0x146a6f;return db[_0x9430('0x31')]['findOne']({'where':{'id':_0xe66877[_0x9430('0x4a')]['id']}})[_0x9430('0x2a')](handleEntityNotFound(_0x40a4df,null))[_0x9430('0x2a')](function(_0x1edd92){if(_0x1edd92){_0xd85270=_0x1edd92;_0x1efd2c[_0x9430('0x34')]=_[_0x9430('0x36')](db['SugarcrmField']['rawAttributes']);_0x1efd2c[_0x9430('0x35')]=_[_0x9430('0x36')](_0xe66877['query']);_0x1efd2c[_0x9430('0x3e')]=_[_0x9430('0x37')](_0x1efd2c[_0x9430('0x34')],_0x1efd2c[_0x9430('0x35')]);_0x587d8c['attributes']=_[_0x9430('0x37')](_0x1efd2c[_0x9430('0x34')],qs[_0x9430('0x39')](_0xe66877[_0x9430('0x35')][_0x9430('0x39')]));_0x587d8c[_0x9430('0x38')]=_0x587d8c[_0x9430('0x38')][_0x9430('0x3a')]?_0x587d8c['attributes']:_0x1efd2c[_0x9430('0x34')];_0x587d8c[_0x9430('0x3b')]=qs[_0x9430('0x3c')](_0xe66877['query'][_0x9430('0x3c')]);_0x587d8c[_0x9430('0x3d')]=qs['filters'](_['pick'](_0xe66877[_0x9430('0x35')],_0x1efd2c['filters']));if(_0xe66877['query'][_0x9430('0x43')]){_0x587d8c[_0x9430('0x3d')]=_[_0x9430('0x40')](_0x587d8c['where'],{'$or':_['map'](_0x587d8c[_0x9430('0x38')],function(_0x1022e0){var _0x24f869={};_0x24f869[_0x1022e0]={'$like':'%'+_0xe66877['query'][_0x9430('0x43')]+'%'};return _0x24f869;})});}_0x587d8c=_['merge']({},_0x587d8c,_0xe66877['options']);return _0xd85270[_0x9430('0x54')](_0x587d8c);}})[_0x9430('0x2a')](function(_0x121935){if(_0x121935){_0x146a6f=_0x121935['length'];if(!_0xe66877['query'][_0x9430('0x51')]('nolimit')){_0x587d8c[_0x9430('0x22')]=qs[_0x9430('0x22')](_0xe66877[_0x9430('0x35')][_0x9430('0x22')]);_0x587d8c['offset']=qs['offset'](_0xe66877[_0x9430('0x35')]['offset']);}return _0xd85270[_0x9430('0x54')](_0x587d8c);}})['then'](function(_0xa0c67f){if(_0xa0c67f){return _0xa0c67f?{'count':_0x146a6f,'rows':_0xa0c67f}:null;}})[_0x9430('0x2a')](respondWithResult(_0x40a4df,null))[_0x9430('0x48')](handleError(_0x40a4df,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 44c8904..03a7f11 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 _0xe0c1=['rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3b79a1,_0x84a315){var _0x211b0a=function(_0x1e876e){while(--_0x1e876e){_0x3b79a1['push'](_0x3b79a1['shift']());}};_0x211b0a(++_0x84a315);}(_0xe0c1,0xa3));var _0x1e0c=function(_0x493298,_0x5cbd42){_0x493298=_0x493298-0x0;var _0x50b0dd=_0xe0c1[_0x493298];return _0x50b0dd;};'use strict';var _=require(_0x1e0c('0x0'));var util=require(_0x1e0c('0x1'));var logger=require(_0x1e0c('0x2'))('api');var moment=require(_0x1e0c('0x3'));var BPromise=require(_0x1e0c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1e0c('0x5'));var config=require(_0x1e0c('0x6'));var attributes=require(_0x1e0c('0x7'));module[_0x1e0c('0x8')]=function(_0x5beba0,_0xda5c0a){return _0x5beba0[_0x1e0c('0x9')](_0x1e0c('0xa'),attributes,{'tableName':_0x1e0c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5972=['SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x5e49ab,_0x457f92){var _0x229b42=function(_0x5b17ed){while(--_0x5b17ed){_0x5e49ab['push'](_0x5e49ab['shift']());}};_0x229b42(++_0x457f92);}(_0x5972,0x7a));var _0x2597=function(_0x1a8f86,_0x5ed9c4){_0x1a8f86=_0x1a8f86-0x0;var _0x20d876=_0x5972[_0x1a8f86];return _0x20d876;};'use strict';var _=require(_0x2597('0x0'));var util=require(_0x2597('0x1'));var logger=require(_0x2597('0x2'))(_0x2597('0x3'));var moment=require(_0x2597('0x4'));var BPromise=require(_0x2597('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2597('0x6'));var rimraf=require(_0x2597('0x7'));var config=require(_0x2597('0x8'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x2597('0x9')]=function(_0x5eef89,_0x53965e){return _0x5eef89['define'](_0x2597('0xa'),attributes,{'tableName':_0x2597('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 6757b56..ad41014 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 _0x84a1=['then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x211f03,_0x4132a4){var _0x3e2d0c=function(_0x4a4e01){while(--_0x4a4e01){_0x211f03['push'](_0x211f03['shift']());}};_0x3e2d0c(++_0x4132a4);}(_0x84a1,0x192));var _0x184a=function(_0x378fab,_0x836728){_0x378fab=_0x378fab-0x0;var _0x226090=_0x84a1[_0x378fab];return _0x226090;};'use strict';var _=require(_0x184a('0x0'));var util=require(_0x184a('0x1'));var moment=require('moment');var BPromise=require(_0x184a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x184a('0x3'));var db=require(_0x184a('0x4'))['db'];var utils=require(_0x184a('0x5'));var logger=require(_0x184a('0x6'))('rpc');var config=require(_0x184a('0x7'));var jayson=require(_0x184a('0x8'));var client=jayson[_0x184a('0x9')][_0x184a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d784d,_0x3db1a7,_0x1f2b6b){return new BPromise(function(_0x1a2503,_0x250838){return client[_0x184a('0xb')](_0x1d784d,_0x1f2b6b)[_0x184a('0xc')](function(_0x441b0b){logger[_0x184a('0xd')](_0x184a('0xe'),_0x3db1a7,'request\x20sent');logger[_0x184a('0xf')](_0x184a('0x10'),_0x3db1a7,'request\x20sent',JSON[_0x184a('0x11')](_0x441b0b));if(_0x441b0b[_0x184a('0x12')]){if(_0x441b0b[_0x184a('0x12')][_0x184a('0x13')]===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x3db1a7,_0x441b0b[_0x184a('0x12')][_0x184a('0x14')]);return _0x250838(_0x441b0b['error'][_0x184a('0x14')]);}logger[_0x184a('0x12')](_0x184a('0xe'),_0x3db1a7,_0x441b0b[_0x184a('0x12')][_0x184a('0x14')]);return _0x1a2503(_0x441b0b[_0x184a('0x12')][_0x184a('0x14')]);}else{logger[_0x184a('0xd')](_0x184a('0xe'),_0x3db1a7,_0x184a('0x15'));_0x1a2503(_0x441b0b['result']['message']);}})[_0x184a('0x16')](function(_0x44038e){logger['error'](_0x184a('0xe'),_0x3db1a7,_0x44038e);_0x250838(_0x44038e);});});} \ No newline at end of file +var _0x951d=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird'];(function(_0x3b756e,_0x28ddda){var _0x57e70a=function(_0x26b83c){while(--_0x26b83c){_0x3b756e['push'](_0x3b756e['shift']());}};_0x57e70a(++_0x28ddda);}(_0x951d,0x140));var _0xd951=function(_0x4b64a4,_0x1bdc50){_0x4b64a4=_0x4b64a4-0x0;var _0xd19b0e=_0x951d[_0x4b64a4];return _0xd19b0e;};'use strict';var _=require(_0xd951('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd951('0x1'));var rs=require(_0xd951('0x2'));var fs=require('fs');var Redis=require(_0xd951('0x3'));var db=require(_0xd951('0x4'))['db'];var utils=require(_0xd951('0x5'));var logger=require(_0xd951('0x6'))(_0xd951('0x7'));var config=require(_0xd951('0x8'));var jayson=require(_0xd951('0x9'));var client=jayson[_0xd951('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x350be8,_0x2069b5,_0x41881b){return new BPromise(function(_0x39bbb5,_0x51abcf){return client[_0xd951('0xb')](_0x350be8,_0x41881b)['then'](function(_0xbbc34a){logger[_0xd951('0xc')](_0xd951('0xd'),_0x2069b5,_0xd951('0xe'));logger[_0xd951('0xf')](_0xd951('0x10'),_0x2069b5,_0xd951('0xe'),JSON[_0xd951('0x11')](_0xbbc34a));if(_0xbbc34a[_0xd951('0x12')]){if(_0xbbc34a[_0xd951('0x12')][_0xd951('0x13')]===0x1f4){logger[_0xd951('0x12')](_0xd951('0xd'),_0x2069b5,_0xbbc34a[_0xd951('0x12')]['message']);return _0x51abcf(_0xbbc34a[_0xd951('0x12')][_0xd951('0x14')]);}logger[_0xd951('0x12')](_0xd951('0xd'),_0x2069b5,_0xbbc34a[_0xd951('0x12')][_0xd951('0x14')]);return _0x39bbb5(_0xbbc34a['error'][_0xd951('0x14')]);}else{logger[_0xd951('0xc')](_0xd951('0xd'),_0x2069b5,_0xd951('0xe'));_0x39bbb5(_0xbbc34a[_0xd951('0x15')][_0xd951('0x14')]);}})[_0xd951('0x16')](function(_0xd7741e){logger[_0xd951('0x12')](_0xd951('0xd'),_0x2069b5,_0xd7741e);_0x51abcf(_0xd7741e);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 3621b26..7ca6a28 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 _0x3c6f=['create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','post'];(function(_0x49d34a,_0x1dafc0){var _0x164371=function(_0x4bc78a){while(--_0x4bc78a){_0x49d34a['push'](_0x49d34a['shift']());}};_0x164371(++_0x1dafc0);}(_0x3c6f,0xcc));var _0xf3c6=function(_0x368c12,_0x426301){_0x368c12=_0x368c12-0x0;var _0x31b26c=_0x3c6f[_0x368c12];return _0x31b26c;};'use strict';var multer=require(_0xf3c6('0x0'));var util=require(_0xf3c6('0x1'));var path=require(_0xf3c6('0x2'));var timeout=require(_0xf3c6('0x3'));var express=require('express');var router=express[_0xf3c6('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf3c6('0x5'));var config=require(_0xf3c6('0x6'));var controller=require('./intSugarcrmField.controller');router['get']('/',auth[_0xf3c6('0x7')](),controller[_0xf3c6('0x8')]);router[_0xf3c6('0x9')]('/:id',auth[_0xf3c6('0x7')](),controller[_0xf3c6('0xa')]);router[_0xf3c6('0xb')]('/',auth[_0xf3c6('0x7')](),controller[_0xf3c6('0xc')]);router[_0xf3c6('0xd')](_0xf3c6('0xe'),auth['isAuthenticated'](),controller[_0xf3c6('0xf')]);router[_0xf3c6('0x10')](_0xf3c6('0xe'),auth[_0xf3c6('0x7')](),controller[_0xf3c6('0x11')]);module['exports']=router; \ No newline at end of file +var _0xba94=['create','put','/:id','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','index','get','show','post'];(function(_0x1a21ff,_0x4a7550){var _0x25afc1=function(_0x4a66ec){while(--_0x4a66ec){_0x1a21ff['push'](_0x1a21ff['shift']());}};_0x25afc1(++_0x4a7550);}(_0xba94,0x122));var _0x4ba9=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xba94[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0x4ba9('0x0'));var util=require(_0x4ba9('0x1'));var path=require('path');var timeout=require(_0x4ba9('0x2'));var express=require(_0x4ba9('0x3'));var router=express['Router']();var fs_extra=require(_0x4ba9('0x4'));var auth=require(_0x4ba9('0x5'));var interaction=require(_0x4ba9('0x6'));var config=require(_0x4ba9('0x7'));var controller=require(_0x4ba9('0x8'));router['get']('/',auth[_0x4ba9('0x9')](),controller[_0x4ba9('0xa')]);router[_0x4ba9('0xb')]('/:id',auth[_0x4ba9('0x9')](),controller[_0x4ba9('0xc')]);router[_0x4ba9('0xd')]('/',auth[_0x4ba9('0x9')](),controller[_0x4ba9('0xe')]);router[_0x4ba9('0xf')](_0x4ba9('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x4ba9('0x11')](_0x4ba9('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x4ba9('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 71daedd..a229dc9 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 _0x8a96=['picklist','STRING','variable','customVariable','exports','ENUM','string'];(function(_0x52d8da,_0x4609b1){var _0x2db5f0=function(_0xe302da){while(--_0xe302da){_0x52d8da['push'](_0x52d8da['shift']());}};_0x2db5f0(++_0x4609b1);}(_0x8a96,0xa5));var _0x68a9=function(_0x19af0d,_0x1d2771){_0x19af0d=_0x19af0d-0x0;var _0x89ba34=_0x8a96[_0x19af0d];return _0x89ba34;};'use strict';var Sequelize=require('sequelize');module[_0x68a9('0x0')]={'type':{'type':Sequelize[_0x68a9('0x1')](_0x68a9('0x2'),'variable','customVariable','keyValue',_0x68a9('0x3')),'defaultValue':_0x68a9('0x2')},'content':{'type':Sequelize[_0x68a9('0x4')]},'key':{'type':Sequelize[_0x68a9('0x4')]},'keyType':{'type':Sequelize[_0x68a9('0x1')]('string',_0x68a9('0x5'),_0x68a9('0x6'))},'keyContent':{'type':Sequelize[_0x68a9('0x4')]},'idField':{'type':Sequelize[_0x68a9('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x68a9('0x4')]}}; \ No newline at end of file +var _0x0326=['customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize','exports','string','variable'];(function(_0x31fe95,_0x451e5f){var _0x271caa=function(_0x2accac){while(--_0x2accac){_0x31fe95['push'](_0x31fe95['shift']());}};_0x271caa(++_0x451e5f);}(_0x0326,0x1c8));var _0x6032=function(_0x4bd9de,_0x4c79ec){_0x4bd9de=_0x4bd9de-0x0;var _0x4855c0=_0x0326[_0x4bd9de];return _0x4855c0;};'use strict';var Sequelize=require(_0x6032('0x0'));module[_0x6032('0x1')]={'type':{'type':Sequelize['ENUM'](_0x6032('0x2'),_0x6032('0x3'),_0x6032('0x4'),_0x6032('0x5'),_0x6032('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6032('0x7')]},'keyType':{'type':Sequelize[_0x6032('0x8')](_0x6032('0x2'),_0x6032('0x3'),_0x6032('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x6032('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6032('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6032('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index d16c2bf..747272a 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 _0xca6e=['keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','show','length','include','options','find','catch','create','body','params','destroy','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','key','model','query'];(function(_0x11c6dc,_0x356447){var _0x2e2abf=function(_0xf33f16){while(--_0xf33f16){_0x11c6dc['push'](_0x11c6dc['shift']());}};_0x2e2abf(++_0x356447);}(_0xca6e,0x106));var _0xeca6=function(_0x579d85,_0x3a88e9){_0x579d85=_0x579d85-0x0;var _0x4368ad=_0xca6e[_0x579d85];return _0x4368ad;};'use strict';var emlformat=require(_0xeca6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xeca6('0x1'));var rp=require(_0xeca6('0x2'));var moment=require(_0xeca6('0x3'));var BPromise=require(_0xeca6('0x4'));var Mustache=require(_0xeca6('0x5'));var util=require(_0xeca6('0x6'));var path=require('path');var sox=require(_0xeca6('0x7'));var csv=require(_0xeca6('0x8'));var ejs=require(_0xeca6('0x9'));var fs=require('fs');var fs_extra=require(_0xeca6('0xa'));var _=require(_0xeca6('0xb'));var squel=require(_0xeca6('0xc'));var crypto=require(_0xeca6('0xd'));var jsforce=require(_0xeca6('0xe'));var deskjs=require(_0xeca6('0xf'));var toCsv=require(_0xeca6('0x8'));var querystring=require(_0xeca6('0x10'));var Papa=require(_0xeca6('0x11'));var Redis=require('ioredis');var authService=require(_0xeca6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xeca6('0x13'));var hardwareService=require(_0xeca6('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xeca6('0x15'));var config=require(_0xeca6('0x16'));var licenseUtil=require(_0xeca6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1be98a,_0x5a3e6c){_0x5a3e6c=_0x5a3e6c||0xcc;return function(_0x50e925){if(_0x50e925){return _0x1be98a[_0xeca6('0x18')](_0x5a3e6c);}return _0x1be98a['status'](_0x5a3e6c)['end']();};}function respondWithResult(_0x128d86,_0x393e25){_0x393e25=_0x393e25||0xc8;return function(_0xb32db0){if(_0xb32db0){return _0x128d86[_0xeca6('0x19')](_0x393e25)[_0xeca6('0x1a')](_0xb32db0);}};}function respondWithFilteredResult(_0xe949a5,_0x5eb175){return function(_0x11fa5c){if(_0x11fa5c){var _0x2b1020=typeof _0x5eb175[_0xeca6('0x1b')]===_0xeca6('0x1c')&&typeof _0x5eb175[_0xeca6('0x1d')]==='undefined';var _0x1240f5=_0x11fa5c[_0xeca6('0x1e')];var _0x53fac5=_0x2b1020?0x0:_0x5eb175[_0xeca6('0x1b')];var _0x256c91=_0x2b1020?_0x11fa5c[_0xeca6('0x1e')]:_0x5eb175['offset']+_0x5eb175[_0xeca6('0x1d')];var _0x2af538;if(_0x256c91>=_0x1240f5){_0x256c91=_0x1240f5;_0x2af538=0xc8;}else{_0x2af538=0xce;}_0xe949a5[_0xeca6('0x19')](_0x2af538);return _0xe949a5[_0xeca6('0x1f')](_0xeca6('0x20'),_0x53fac5+'-'+_0x256c91+'/'+_0x1240f5)['json'](_0x11fa5c);}return null;};}function patchUpdates(_0x139b75){return function(_0x457089){try{jsonpatch[_0xeca6('0x21')](_0x457089,_0x139b75,!![]);}catch(_0x1ebdf7){return BPromise[_0xeca6('0x22')](_0x1ebdf7);}return _0x457089[_0xeca6('0x23')]();};}function saveUpdates(_0x29bf14,_0x5b3d5d){return function(_0x4f8839){if(_0x4f8839){return _0x4f8839[_0xeca6('0x24')](_0x29bf14)[_0xeca6('0x25')](function(_0x3ee0c0){return _0x3ee0c0;});}return null;};}function removeEntity(_0x17ecff,_0x888a44){return function(_0x104c26){if(_0x104c26){return _0x104c26['destroy']()[_0xeca6('0x25')](function(){_0x17ecff[_0xeca6('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ac818,_0x2d639f){return function(_0x2da946){if(!_0x2da946){_0x2ac818[_0xeca6('0x18')](0x194);}return _0x2da946;};}function handleError(_0x2abd50,_0x5cdcf3){_0x5cdcf3=_0x5cdcf3||0x1f4;return function(_0x21d752){logger[_0xeca6('0x26')](_0x21d752[_0xeca6('0x27')]);if(_0x21d752[_0xeca6('0x28')]){delete _0x21d752[_0xeca6('0x28')];}_0x2abd50[_0xeca6('0x19')](_0x5cdcf3)[_0xeca6('0x29')](_0x21d752);};}exports[_0xeca6('0x2a')]=function(_0x3d2adb,_0x350b3e){var _0x5de409={},_0x322db5={},_0x15d473={'count':0x0,'rows':[]};var _0x93bd62=_[_0xeca6('0x2b')](db[_0xeca6('0x2c')][_0xeca6('0x2d')],function(_0xf2138f){return{'name':_0xf2138f[_0xeca6('0x2e')],'type':_0xf2138f['type'][_0xeca6('0x2f')]};});_0x322db5[_0xeca6('0x30')]=_[_0xeca6('0x2b')](_0x93bd62,_0xeca6('0x28'));_0x322db5[_0xeca6('0x31')]=_[_0xeca6('0x32')](_0x3d2adb[_0xeca6('0x31')]);_0x322db5[_0xeca6('0x33')]=_['intersection'](_0x322db5['model'],_0x322db5['query']);_0x5de409[_0xeca6('0x34')]=_[_0xeca6('0x35')](_0x322db5[_0xeca6('0x30')],qs['fields'](_0x3d2adb[_0xeca6('0x31')][_0xeca6('0x36')]));_0x5de409[_0xeca6('0x34')]=_0x5de409[_0xeca6('0x34')]['length']?_0x5de409[_0xeca6('0x34')]:_0x322db5['model'];if(!_0x3d2adb['query'][_0xeca6('0x37')](_0xeca6('0x38'))){_0x5de409[_0xeca6('0x1d')]=qs[_0xeca6('0x1d')](_0x3d2adb[_0xeca6('0x31')]['limit']);_0x5de409[_0xeca6('0x1b')]=qs[_0xeca6('0x1b')](_0x3d2adb['query']['offset']);}_0x5de409[_0xeca6('0x39')]=qs[_0xeca6('0x3a')](_0x3d2adb[_0xeca6('0x31')][_0xeca6('0x3a')]);_0x5de409[_0xeca6('0x3b')]=qs[_0xeca6('0x33')](_[_0xeca6('0x3c')](_0x3d2adb['query'],_0x322db5[_0xeca6('0x33')]),_0x93bd62);if(_0x3d2adb['query'][_0xeca6('0x3d')]){_0x5de409[_0xeca6('0x3b')]=_[_0xeca6('0x3e')](_0x5de409[_0xeca6('0x3b')],{'$or':_[_0xeca6('0x2b')](_0x93bd62,function(_0x31c645){if(_0x31c645[_0xeca6('0x3f')]!==_0xeca6('0x40')){var _0x11119a={};_0x11119a[_0x31c645['name']]={'$like':'%'+_0x3d2adb['query'][_0xeca6('0x3d')]+'%'};return _0x11119a;}})});}_0x5de409=_['merge']({},_0x5de409,_0x3d2adb['options']);var _0x5ae51f={'where':_0x5de409[_0xeca6('0x3b')]};return db[_0xeca6('0x2c')]['count'](_0x5ae51f)[_0xeca6('0x25')](function(_0x361be6){_0x15d473[_0xeca6('0x1e')]=_0x361be6;if(_0x3d2adb['query'][_0xeca6('0x41')]){_0x5de409['include']=[{'all':!![]}];}return db['SugarcrmField'][_0xeca6('0x42')](_0x5de409);})['then'](function(_0x353fb9){_0x15d473[_0xeca6('0x43')]=_0x353fb9;return _0x15d473;})[_0xeca6('0x25')](respondWithFilteredResult(_0x350b3e,_0x5de409))['catch'](handleError(_0x350b3e,null));};exports[_0xeca6('0x44')]=function(_0x280069,_0x33de36){var _0x16083d={'raw':!![],'where':{'id':_0x280069['params']['id']}},_0x1ae131={};_0x1ae131[_0xeca6('0x30')]=_[_0xeca6('0x32')](db['SugarcrmField'][_0xeca6('0x2d')]);_0x1ae131['query']=_[_0xeca6('0x32')](_0x280069[_0xeca6('0x31')]);_0x1ae131['filters']=_[_0xeca6('0x35')](_0x1ae131[_0xeca6('0x30')],_0x1ae131[_0xeca6('0x31')]);_0x16083d[_0xeca6('0x34')]=_[_0xeca6('0x35')](_0x1ae131[_0xeca6('0x30')],qs[_0xeca6('0x36')](_0x280069[_0xeca6('0x31')][_0xeca6('0x36')]));_0x16083d[_0xeca6('0x34')]=_0x16083d[_0xeca6('0x34')][_0xeca6('0x45')]?_0x16083d[_0xeca6('0x34')]:_0x1ae131[_0xeca6('0x30')];if(_0x280069[_0xeca6('0x31')][_0xeca6('0x41')]){_0x16083d[_0xeca6('0x46')]=[{'all':!![]}];}_0x16083d=_['merge']({},_0x16083d,_0x280069[_0xeca6('0x47')]);return db['SugarcrmField'][_0xeca6('0x48')](_0x16083d)[_0xeca6('0x25')](handleEntityNotFound(_0x33de36,null))[_0xeca6('0x25')](respondWithResult(_0x33de36,null))[_0xeca6('0x49')](handleError(_0x33de36,null));};exports[_0xeca6('0x4a')]=function(_0x4d329c,_0x53adb3){return db[_0xeca6('0x2c')][_0xeca6('0x4a')](_0x4d329c['body'],{})['then'](respondWithResult(_0x53adb3,0xc9))['catch'](handleError(_0x53adb3,null));};exports['update']=function(_0x10201f,_0x178186){if(_0x10201f[_0xeca6('0x4b')]['id']){delete _0x10201f[_0xeca6('0x4b')]['id'];}return db['SugarcrmField'][_0xeca6('0x48')]({'where':{'id':_0x10201f[_0xeca6('0x4c')]['id']}})[_0xeca6('0x25')](handleEntityNotFound(_0x178186,null))[_0xeca6('0x25')](saveUpdates(_0x10201f['body'],null))['then'](respondWithResult(_0x178186,null))[_0xeca6('0x49')](handleError(_0x178186,null));};exports[_0xeca6('0x4d')]=function(_0x182b04,_0x590a5a){return db[_0xeca6('0x2c')][_0xeca6('0x48')]({'where':{'id':_0x182b04[_0xeca6('0x4c')]['id']}})['then'](handleEntityNotFound(_0x590a5a,null))[_0xeca6('0x25')](removeEntity(_0x590a5a,null))['catch'](handleError(_0x590a5a,null));}; \ No newline at end of file +var _0x6f9f=['error','stack','name','send','index','map','SugarcrmField','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','catch','params','create','body','destroy','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','json','undefined','count','offset','set','Content-Range','apply','save','update','then','end','sendStatus'];(function(_0x585133,_0x2412a1){var _0x18254a=function(_0x4c8aaf){while(--_0x4c8aaf){_0x585133['push'](_0x585133['shift']());}};_0x18254a(++_0x2412a1);}(_0x6f9f,0x149));var _0xf6f9=function(_0x1ce9e5,_0x587e2e){_0x1ce9e5=_0x1ce9e5-0x0;var _0x1cafc7=_0x6f9f[_0x1ce9e5];return _0x1cafc7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf6f9('0x0'));var zipdir=require(_0xf6f9('0x1'));var jsonpatch=require(_0xf6f9('0x2'));var rp=require(_0xf6f9('0x3'));var moment=require(_0xf6f9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf6f9('0x5'));var util=require('util');var path=require(_0xf6f9('0x6'));var sox=require('sox');var csv=require(_0xf6f9('0x7'));var ejs=require(_0xf6f9('0x8'));var fs=require('fs');var fs_extra=require(_0xf6f9('0x9'));var _=require(_0xf6f9('0xa'));var squel=require(_0xf6f9('0xb'));var crypto=require(_0xf6f9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf6f9('0xd'));var toCsv=require(_0xf6f9('0x7'));var querystring=require(_0xf6f9('0xe'));var Papa=require('papaparse');var Redis=require(_0xf6f9('0xf'));var authService=require(_0xf6f9('0x10'));var qs=require(_0xf6f9('0x11'));var as=require(_0xf6f9('0x12'));var hardwareService=require(_0xf6f9('0x13'));var logger=require('../../config/logger')(_0xf6f9('0x14'));var utils=require('../../config/utils');var config=require(_0xf6f9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf6f9('0x16'))['db'];function respondWithStatusCode(_0x3cee58,_0x21d0f4){_0x21d0f4=_0x21d0f4||0xcc;return function(_0x2ef1b2){if(_0x2ef1b2){return _0x3cee58['sendStatus'](_0x21d0f4);}return _0x3cee58[_0xf6f9('0x17')](_0x21d0f4)['end']();};}function respondWithResult(_0x5522f5,_0x117af0){_0x117af0=_0x117af0||0xc8;return function(_0xca65d1){if(_0xca65d1){return _0x5522f5[_0xf6f9('0x17')](_0x117af0)[_0xf6f9('0x18')](_0xca65d1);}};}function respondWithFilteredResult(_0x350de0,_0x551b17){return function(_0x58aa79){if(_0x58aa79){var _0x4dccee=typeof _0x551b17['offset']===_0xf6f9('0x19')&&typeof _0x551b17['limit']===_0xf6f9('0x19');var _0x3172e9=_0x58aa79[_0xf6f9('0x1a')];var _0x30d0a3=_0x4dccee?0x0:_0x551b17[_0xf6f9('0x1b')];var _0x4a13e3=_0x4dccee?_0x58aa79['count']:_0x551b17[_0xf6f9('0x1b')]+_0x551b17['limit'];var _0x17eda3;if(_0x4a13e3>=_0x3172e9){_0x4a13e3=_0x3172e9;_0x17eda3=0xc8;}else{_0x17eda3=0xce;}_0x350de0[_0xf6f9('0x17')](_0x17eda3);return _0x350de0[_0xf6f9('0x1c')](_0xf6f9('0x1d'),_0x30d0a3+'-'+_0x4a13e3+'/'+_0x3172e9)[_0xf6f9('0x18')](_0x58aa79);}return null;};}function patchUpdates(_0x2a2879){return function(_0x1092f9){try{jsonpatch[_0xf6f9('0x1e')](_0x1092f9,_0x2a2879,!![]);}catch(_0x2047f9){return BPromise['reject'](_0x2047f9);}return _0x1092f9[_0xf6f9('0x1f')]();};}function saveUpdates(_0x5e1d28,_0x1d5e9b){return function(_0xa54f02){if(_0xa54f02){return _0xa54f02[_0xf6f9('0x20')](_0x5e1d28)[_0xf6f9('0x21')](function(_0x2ca697){return _0x2ca697;});}return null;};}function removeEntity(_0x175ed6,_0x54b265){return function(_0x525d73){if(_0x525d73){return _0x525d73['destroy']()[_0xf6f9('0x21')](function(){_0x175ed6[_0xf6f9('0x17')](0xcc)[_0xf6f9('0x22')]();});}};}function handleEntityNotFound(_0x238e33,_0x241a94){return function(_0x2c4b39){if(!_0x2c4b39){_0x238e33[_0xf6f9('0x23')](0x194);}return _0x2c4b39;};}function handleError(_0x14f143,_0x5d473f){_0x5d473f=_0x5d473f||0x1f4;return function(_0x21ae45){logger[_0xf6f9('0x24')](_0x21ae45[_0xf6f9('0x25')]);if(_0x21ae45[_0xf6f9('0x26')]){delete _0x21ae45['name'];}_0x14f143[_0xf6f9('0x17')](_0x5d473f)[_0xf6f9('0x27')](_0x21ae45);};}exports[_0xf6f9('0x28')]=function(_0x51b1c4,_0x3d49eb){var _0x5117e1={},_0x3ce6bb={},_0x49131b={'count':0x0,'rows':[]};var _0x3a9d98=_[_0xf6f9('0x29')](db[_0xf6f9('0x2a')][_0xf6f9('0x2b')],function(_0x599dcc){return{'name':_0x599dcc['fieldName'],'type':_0x599dcc[_0xf6f9('0x2c')][_0xf6f9('0x2d')]};});_0x3ce6bb[_0xf6f9('0x2e')]=_[_0xf6f9('0x29')](_0x3a9d98,_0xf6f9('0x26'));_0x3ce6bb['query']=_[_0xf6f9('0x2f')](_0x51b1c4[_0xf6f9('0x30')]);_0x3ce6bb[_0xf6f9('0x31')]=_[_0xf6f9('0x32')](_0x3ce6bb[_0xf6f9('0x2e')],_0x3ce6bb['query']);_0x5117e1[_0xf6f9('0x33')]=_['intersection'](_0x3ce6bb['model'],qs[_0xf6f9('0x34')](_0x51b1c4[_0xf6f9('0x30')]['fields']));_0x5117e1[_0xf6f9('0x33')]=_0x5117e1[_0xf6f9('0x33')][_0xf6f9('0x35')]?_0x5117e1[_0xf6f9('0x33')]:_0x3ce6bb[_0xf6f9('0x2e')];if(!_0x51b1c4[_0xf6f9('0x30')][_0xf6f9('0x36')](_0xf6f9('0x37'))){_0x5117e1[_0xf6f9('0x38')]=qs[_0xf6f9('0x38')](_0x51b1c4[_0xf6f9('0x30')][_0xf6f9('0x38')]);_0x5117e1[_0xf6f9('0x1b')]=qs[_0xf6f9('0x1b')](_0x51b1c4[_0xf6f9('0x30')][_0xf6f9('0x1b')]);}_0x5117e1[_0xf6f9('0x39')]=qs[_0xf6f9('0x3a')](_0x51b1c4['query'][_0xf6f9('0x3a')]);_0x5117e1[_0xf6f9('0x3b')]=qs[_0xf6f9('0x31')](_[_0xf6f9('0x3c')](_0x51b1c4[_0xf6f9('0x30')],_0x3ce6bb[_0xf6f9('0x31')]),_0x3a9d98);if(_0x51b1c4[_0xf6f9('0x30')]['filter']){_0x5117e1[_0xf6f9('0x3b')]=_[_0xf6f9('0x3d')](_0x5117e1[_0xf6f9('0x3b')],{'$or':_[_0xf6f9('0x29')](_0x3a9d98,function(_0x44845e){if(_0x44845e[_0xf6f9('0x2c')]!=='VIRTUAL'){var _0x1b3886={};_0x1b3886[_0x44845e[_0xf6f9('0x26')]]={'$like':'%'+_0x51b1c4[_0xf6f9('0x30')][_0xf6f9('0x3e')]+'%'};return _0x1b3886;}})});}_0x5117e1=_['merge']({},_0x5117e1,_0x51b1c4[_0xf6f9('0x3f')]);var _0x5ef9a1={'where':_0x5117e1[_0xf6f9('0x3b')]};return db[_0xf6f9('0x2a')][_0xf6f9('0x1a')](_0x5ef9a1)[_0xf6f9('0x21')](function(_0x5287d6){_0x49131b['count']=_0x5287d6;if(_0x51b1c4[_0xf6f9('0x30')][_0xf6f9('0x40')]){_0x5117e1[_0xf6f9('0x41')]=[{'all':!![]}];}return db[_0xf6f9('0x2a')][_0xf6f9('0x42')](_0x5117e1);})['then'](function(_0x3b0341){_0x49131b['rows']=_0x3b0341;return _0x49131b;})[_0xf6f9('0x21')](respondWithFilteredResult(_0x3d49eb,_0x5117e1))[_0xf6f9('0x43')](handleError(_0x3d49eb,null));};exports['show']=function(_0x558a72,_0x28e416){var _0x291441={'raw':!![],'where':{'id':_0x558a72[_0xf6f9('0x44')]['id']}},_0xd8ca1d={};_0xd8ca1d[_0xf6f9('0x2e')]=_[_0xf6f9('0x2f')](db[_0xf6f9('0x2a')][_0xf6f9('0x2b')]);_0xd8ca1d[_0xf6f9('0x30')]=_['keys'](_0x558a72[_0xf6f9('0x30')]);_0xd8ca1d[_0xf6f9('0x31')]=_[_0xf6f9('0x32')](_0xd8ca1d[_0xf6f9('0x2e')],_0xd8ca1d[_0xf6f9('0x30')]);_0x291441[_0xf6f9('0x33')]=_[_0xf6f9('0x32')](_0xd8ca1d[_0xf6f9('0x2e')],qs[_0xf6f9('0x34')](_0x558a72['query'][_0xf6f9('0x34')]));_0x291441[_0xf6f9('0x33')]=_0x291441[_0xf6f9('0x33')][_0xf6f9('0x35')]?_0x291441[_0xf6f9('0x33')]:_0xd8ca1d[_0xf6f9('0x2e')];if(_0x558a72[_0xf6f9('0x30')][_0xf6f9('0x40')]){_0x291441[_0xf6f9('0x41')]=[{'all':!![]}];}_0x291441=_[_0xf6f9('0x3d')]({},_0x291441,_0x558a72[_0xf6f9('0x3f')]);return db[_0xf6f9('0x2a')]['find'](_0x291441)[_0xf6f9('0x21')](handleEntityNotFound(_0x28e416,null))[_0xf6f9('0x21')](respondWithResult(_0x28e416,null))[_0xf6f9('0x43')](handleError(_0x28e416,null));};exports[_0xf6f9('0x45')]=function(_0x5104e3,_0x249472){return db[_0xf6f9('0x2a')][_0xf6f9('0x45')](_0x5104e3[_0xf6f9('0x46')],{})[_0xf6f9('0x21')](respondWithResult(_0x249472,0xc9))[_0xf6f9('0x43')](handleError(_0x249472,null));};exports['update']=function(_0x4d03c9,_0x351d94){if(_0x4d03c9[_0xf6f9('0x46')]['id']){delete _0x4d03c9[_0xf6f9('0x46')]['id'];}return db[_0xf6f9('0x2a')]['find']({'where':{'id':_0x4d03c9[_0xf6f9('0x44')]['id']}})[_0xf6f9('0x21')](handleEntityNotFound(_0x351d94,null))[_0xf6f9('0x21')](saveUpdates(_0x4d03c9[_0xf6f9('0x46')],null))[_0xf6f9('0x21')](respondWithResult(_0x351d94,null))['catch'](handleError(_0x351d94,null));};exports[_0xf6f9('0x47')]=function(_0x3fdee9,_0x49fb09){return db[_0xf6f9('0x2a')][_0xf6f9('0x48')]({'where':{'id':_0x3fdee9[_0xf6f9('0x44')]['id']}})['then'](handleEntityNotFound(_0x49fb09,null))[_0xf6f9('0x21')](removeEntity(_0x49fb09,null))[_0xf6f9('0x43')](handleError(_0x49fb09,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index a7b3dde..27dfbed 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 _0x443e=['path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','SugarcrmField','int_sugarcrm_fields','idField','FieldId','util','../../config/logger','bluebird','request-promise'];(function(_0x2c6075,_0x50c95b){var _0x1ec271=function(_0x4507a6){while(--_0x4507a6){_0x2c6075['push'](_0x2c6075['shift']());}};_0x1ec271(++_0x50c95b);}(_0x443e,0x7e));var _0xe443=function(_0x4fa291,_0x56e289){_0x4fa291=_0x4fa291-0x0;var _0x506d9b=_0x443e[_0x4fa291];return _0x506d9b;};'use strict';var _=require('lodash');var util=require(_0xe443('0x0'));var logger=require(_0xe443('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe443('0x2'));var rp=require(_0xe443('0x3'));var fs=require('fs');var path=require(_0xe443('0x4'));var rimraf=require(_0xe443('0x5'));var config=require(_0xe443('0x6'));var attributes=require(_0xe443('0x7'));module[_0xe443('0x8')]=function(_0x37c9aa,_0x124b95){return _0x37c9aa['define'](_0xe443('0x9'),attributes,{'tableName':_0xe443('0xa'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0xe443('0xb'),_0xe443('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4f8e=['define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','lodash','util','../../config/logger','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4f8e,0xe2));var _0xe4f8=function(_0x32e758,_0x13c271){_0x32e758=_0x32e758-0x0;var _0x349316=_0x4f8e[_0x32e758];return _0x349316;};'use strict';var _=require(_0xe4f8('0x0'));var util=require(_0xe4f8('0x1'));var logger=require(_0xe4f8('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe4f8('0x3'));var rimraf=require(_0xe4f8('0x4'));var config=require(_0xe4f8('0x5'));var attributes=require(_0xe4f8('0x6'));module[_0xe4f8('0x7')]=function(_0x3e84c3,_0x303cd1){return _0x3e84c3[_0xe4f8('0x8')](_0xe4f8('0x9'),attributes,{'tableName':_0xe4f8('0xa'),'paranoid':![],'indexes':[{'name':_0xe4f8('0xb'),'fields':['idField',_0xe4f8('0xc')],'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 6aa5803..d3d993e 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 _0x4c84=['error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s'];(function(_0x5179a5,_0x419746){var _0x15c8ce=function(_0x1b13c4){while(--_0x1b13c4){_0x5179a5['push'](_0x5179a5['shift']());}};_0x15c8ce(++_0x419746);}(_0x4c84,0x13f));var _0x44c8=function(_0x160412,_0x5640a7){_0x160412=_0x160412-0x0;var _0x3c8a1b=_0x4c84[_0x160412];return _0x3c8a1b;};'use strict';var _=require(_0x44c8('0x0'));var util=require(_0x44c8('0x1'));var moment=require(_0x44c8('0x2'));var BPromise=require(_0x44c8('0x3'));var rs=require(_0x44c8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x44c8('0x5'))['db'];var utils=require(_0x44c8('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x44c8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x44c8('0x8')][_0x44c8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x584195,_0x5da1d1,_0x372358){return new BPromise(function(_0x2c9d6e,_0x1d100e){return client[_0x44c8('0xa')](_0x584195,_0x372358)[_0x44c8('0xb')](function(_0x5162c0){logger[_0x44c8('0xc')](_0x44c8('0xd'),_0x5da1d1,_0x44c8('0xe'));logger[_0x44c8('0xf')](_0x44c8('0x10'),_0x5da1d1,_0x44c8('0xe'),JSON['stringify'](_0x5162c0));if(_0x5162c0[_0x44c8('0x11')]){if(_0x5162c0[_0x44c8('0x11')][_0x44c8('0x12')]===0x1f4){logger['error'](_0x44c8('0xd'),_0x5da1d1,_0x5162c0['error'][_0x44c8('0x13')]);return _0x1d100e(_0x5162c0['error'][_0x44c8('0x13')]);}logger[_0x44c8('0x11')](_0x44c8('0xd'),_0x5da1d1,_0x5162c0[_0x44c8('0x11')][_0x44c8('0x13')]);return _0x2c9d6e(_0x5162c0['error'][_0x44c8('0x13')]);}else{logger['info'](_0x44c8('0xd'),_0x5da1d1,_0x44c8('0xe'));_0x2c9d6e(_0x5162c0['result'][_0x44c8('0x13')]);}})[_0x44c8('0x14')](function(_0x4a11eb){logger[_0x44c8('0x11')](_0x44c8('0xd'),_0x5da1d1,_0x4a11eb);_0x1d100e(_0x4a11eb);});});} \ No newline at end of file +var _0xc9b7=['info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then'];(function(_0x323e19,_0x53a361){var _0x473803=function(_0x53e09c){while(--_0x53e09c){_0x323e19['push'](_0x323e19['shift']());}};_0x473803(++_0x53a361);}(_0xc9b7,0x1ef));var _0x7c9b=function(_0x4ade33,_0x103537){_0x4ade33=_0x4ade33-0x0;var _0x162cc1=_0xc9b7[_0x4ade33];return _0x162cc1;};'use strict';var _=require(_0x7c9b('0x0'));var util=require(_0x7c9b('0x1'));var moment=require(_0x7c9b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c9b('0x3'))['db'];var utils=require(_0x7c9b('0x4'));var logger=require(_0x7c9b('0x5'))(_0x7c9b('0x6'));var config=require('../../config/environment');var jayson=require(_0x7c9b('0x7'));var client=jayson[_0x7c9b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43f3ee,_0x35fd70,_0x4be503){return new BPromise(function(_0xec7b68,_0x57d8d8){return client[_0x7c9b('0x9')](_0x43f3ee,_0x4be503)[_0x7c9b('0xa')](function(_0x5b7d5a){logger[_0x7c9b('0xb')](_0x7c9b('0xc'),_0x35fd70,_0x7c9b('0xd'));logger[_0x7c9b('0xe')](_0x7c9b('0xf'),_0x35fd70,_0x7c9b('0xd'),JSON[_0x7c9b('0x10')](_0x5b7d5a));if(_0x5b7d5a[_0x7c9b('0x11')]){if(_0x5b7d5a[_0x7c9b('0x11')][_0x7c9b('0x12')]===0x1f4){logger[_0x7c9b('0x11')](_0x7c9b('0xc'),_0x35fd70,_0x5b7d5a[_0x7c9b('0x11')][_0x7c9b('0x13')]);return _0x57d8d8(_0x5b7d5a[_0x7c9b('0x11')][_0x7c9b('0x13')]);}logger[_0x7c9b('0x11')](_0x7c9b('0xc'),_0x35fd70,_0x5b7d5a[_0x7c9b('0x11')][_0x7c9b('0x13')]);return _0xec7b68(_0x5b7d5a[_0x7c9b('0x11')]['message']);}else{logger['info'](_0x7c9b('0xc'),_0x35fd70,_0x7c9b('0xd'));_0xec7b68(_0x5b7d5a[_0x7c9b('0x14')][_0x7c9b('0x13')]);}})[_0x7c9b('0x15')](function(_0xbe899a){logger[_0x7c9b('0x11')](_0x7c9b('0xc'),_0x35fd70,_0xbe899a);_0x57d8d8(_0xbe899a);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index b37147d..22c57a6 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 _0xb647=['index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x4e40c4,_0x3ba615){var _0x3b5a22=function(_0x355593){while(--_0x355593){_0x4e40c4['push'](_0x4e40c4['shift']());}};_0x3b5a22(++_0x3ba615);}(_0xb647,0xdb));var _0x7b64=function(_0x12b664,_0x589fae){_0x12b664=_0x12b664-0x0;var _0x12d102=_0xb647[_0x12b664];return _0x12d102;};'use strict';var multer=require(_0x7b64('0x0'));var util=require(_0x7b64('0x1'));var path=require(_0x7b64('0x2'));var timeout=require(_0x7b64('0x3'));var express=require(_0x7b64('0x4'));var router=express[_0x7b64('0x5')]();var fs_extra=require(_0x7b64('0x6'));var auth=require(_0x7b64('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7b64('0x8'));var controller=require('./intVtigerAccount.controller');router[_0x7b64('0x9')]('/',auth[_0x7b64('0xa')](),controller[_0x7b64('0xb')]);router[_0x7b64('0x9')](_0x7b64('0xc'),auth[_0x7b64('0xa')](),controller[_0x7b64('0xd')]);router[_0x7b64('0x9')](_0x7b64('0xe'),auth['isAuthenticated'](),controller[_0x7b64('0xf')]);router['get'](_0x7b64('0x10'),auth['isAuthenticated'](),controller['getFields']);router[_0x7b64('0x11')]('/',auth[_0x7b64('0xa')](),controller['create']);router[_0x7b64('0x11')](_0x7b64('0xe'),auth[_0x7b64('0xa')](),controller[_0x7b64('0x12')]);router[_0x7b64('0x13')](_0x7b64('0xc'),auth[_0x7b64('0xa')](),controller['update']);router[_0x7b64('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x7b64('0x15')]);module[_0x7b64('0x16')]=router; \ No newline at end of file +var _0xd7ed=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','util'];(function(_0x3e0f20,_0x4c1204){var _0x4dc50e=function(_0x4a91d0){while(--_0x4a91d0){_0x3e0f20['push'](_0x3e0f20['shift']());}};_0x4dc50e(++_0x4c1204);}(_0xd7ed,0x1a8));var _0xdd7e=function(_0x5cc8b9,_0x20e3c3){_0x5cc8b9=_0x5cc8b9-0x0;var _0x58892e=_0xd7ed[_0x5cc8b9];return _0x58892e;};'use strict';var multer=require('multer');var util=require(_0xdd7e('0x0'));var path=require(_0xdd7e('0x1'));var timeout=require(_0xdd7e('0x2'));var express=require(_0xdd7e('0x3'));var router=express[_0xdd7e('0x4')]();var fs_extra=require(_0xdd7e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdd7e('0x6'));var config=require(_0xdd7e('0x7'));var controller=require(_0xdd7e('0x8'));router[_0xdd7e('0x9')]('/',auth[_0xdd7e('0xa')](),controller[_0xdd7e('0xb')]);router['get'](_0xdd7e('0xc'),auth['isAuthenticated'](),controller[_0xdd7e('0xd')]);router[_0xdd7e('0x9')](_0xdd7e('0xe'),auth[_0xdd7e('0xa')](),controller[_0xdd7e('0xf')]);router['get']('/:id/fields',auth[_0xdd7e('0xa')](),controller[_0xdd7e('0x10')]);router[_0xdd7e('0x11')]('/',auth['isAuthenticated'](),controller[_0xdd7e('0x12')]);router[_0xdd7e('0x11')](_0xdd7e('0xe'),auth[_0xdd7e('0xa')](),controller[_0xdd7e('0x13')]);router[_0xdd7e('0x14')]('/:id',auth[_0xdd7e('0xa')](),controller[_0xdd7e('0x15')]);router[_0xdd7e('0x16')](_0xdd7e('0xc'),auth[_0xdd7e('0xa')](),controller[_0xdd7e('0x17')]);module[_0xdd7e('0x18')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 7e856a0..290dcb6 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 _0x9545=['exports','STRING','HelpDesk','sequelize'];(function(_0x5a7c7c,_0x361d68){var _0xcf11da=function(_0x4b3f7c){while(--_0x4b3f7c){_0x5a7c7c['push'](_0x5a7c7c['shift']());}};_0xcf11da(++_0x361d68);}(_0x9545,0x13b));var _0x5954=function(_0x2074db,_0x10b81b){_0x2074db=_0x2074db-0x0;var _0x27324c=_0x9545[_0x2074db];return _0x27324c;};'use strict';var Sequelize=require(_0x5954('0x0'));module[_0x5954('0x1')]={'name':{'type':Sequelize[_0x5954('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5954('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x5954('0x2')],'allowNull':![],'defaultValue':_0x5954('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x5954('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x5954('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x6ec5=['HelpDesk','sequelize','exports','STRING'];(function(_0x17fb58,_0x2af120){var _0x180c1d=function(_0x59346b){while(--_0x59346b){_0x17fb58['push'](_0x17fb58['shift']());}};_0x180c1d(++_0x2af120);}(_0x6ec5,0x15d));var _0x56ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ec5[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x56ec('0x0'));module[_0x56ec('0x1')]={'name':{'type':Sequelize[_0x56ec('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x56ec('0x2')]},'username':{'type':Sequelize[_0x56ec('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x56ec('0x2')],'allowNull':![],'defaultValue':_0x56ec('0x3')},'remoteUri':{'type':Sequelize[_0x56ec('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x56ec('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x56ec('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index c37ef43..ea989fc 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 _0x2feb=['sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','rows','catch','params','VtigerAccount','rawAttributes','length','find','create','body','getConfigurations','findOne','VtigerConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','serverUrl','accessKey','remoteUri','slice','substring','lastIndexOf','%s/webservice.php','getchallenge','success','GET','result','sessionName','autogenerated','reference','owner','remove','editable','false','label','startsWith','cf_','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../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','map','type','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','order'];(function(_0x245574,_0x3815a5){var _0x3ae7e0=function(_0x6c2c01){while(--_0x6c2c01){_0x245574['push'](_0x245574['shift']());}};_0x3ae7e0(++_0x3815a5);}(_0x2feb,0x12f));var _0xb2fe=function(_0x428dbd,_0x30eeb5){_0x428dbd=_0x428dbd-0x0;var _0xc411d8=_0x2feb[_0x428dbd];return _0xc411d8;};'use strict';var emlformat=require(_0xb2fe('0x0'));var rimraf=require(_0xb2fe('0x1'));var zipdir=require(_0xb2fe('0x2'));var jsonpatch=require(_0xb2fe('0x3'));var rp=require('request-promise');var moment=require(_0xb2fe('0x4'));var BPromise=require(_0xb2fe('0x5'));var Mustache=require(_0xb2fe('0x6'));var util=require('util');var path=require(_0xb2fe('0x7'));var sox=require(_0xb2fe('0x8'));var csv=require(_0xb2fe('0x9'));var ejs=require(_0xb2fe('0xa'));var fs=require('fs');var fs_extra=require(_0xb2fe('0xb'));var _=require('lodash');var squel=require(_0xb2fe('0xc'));var crypto=require(_0xb2fe('0xd'));var jsforce=require(_0xb2fe('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb2fe('0xf'));var Redis=require(_0xb2fe('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb2fe('0x11'));var as=require(_0xb2fe('0x12'));var hardwareService=require(_0xb2fe('0x13'));var logger=require(_0xb2fe('0x14'))(_0xb2fe('0x15'));var utils=require('../../config/utils');var config=require(_0xb2fe('0x16'));var licenseUtil=require(_0xb2fe('0x17'));var db=require(_0xb2fe('0x18'))['db'];var integrations=require(_0xb2fe('0x19'));function respondWithStatusCode(_0x454374,_0x3af4ce){_0x3af4ce=_0x3af4ce||0xcc;return function(_0x30517d){if(_0x30517d){return _0x454374[_0xb2fe('0x1a')](_0x3af4ce);}return _0x454374[_0xb2fe('0x1b')](_0x3af4ce)[_0xb2fe('0x1c')]();};}function respondWithResult(_0x161d8e,_0x25655b){_0x25655b=_0x25655b||0xc8;return function(_0xd4b21d){if(_0xd4b21d){return _0x161d8e[_0xb2fe('0x1b')](_0x25655b)[_0xb2fe('0x1d')](_0xd4b21d);}};}function respondWithFilteredResult(_0x40ec92,_0x318324){return function(_0x40708c){if(_0x40708c){var _0x49a4e8=typeof _0x318324[_0xb2fe('0x1e')]===_0xb2fe('0x1f')&&typeof _0x318324[_0xb2fe('0x20')]===_0xb2fe('0x1f');var _0x321335=_0x40708c[_0xb2fe('0x21')];var _0x56d8d2=_0x49a4e8?0x0:_0x318324[_0xb2fe('0x1e')];var _0x580706=_0x49a4e8?_0x40708c[_0xb2fe('0x21')]:_0x318324[_0xb2fe('0x1e')]+_0x318324[_0xb2fe('0x20')];var _0x14eddc;if(_0x580706>=_0x321335){_0x580706=_0x321335;_0x14eddc=0xc8;}else{_0x14eddc=0xce;}_0x40ec92[_0xb2fe('0x1b')](_0x14eddc);return _0x40ec92['set']('Content-Range',_0x56d8d2+'-'+_0x580706+'/'+_0x321335)['json'](_0x40708c);}return null;};}function patchUpdates(_0x42d6c5){return function(_0x4fb6ec){try{jsonpatch[_0xb2fe('0x22')](_0x4fb6ec,_0x42d6c5,!![]);}catch(_0xee1cdc){return BPromise[_0xb2fe('0x23')](_0xee1cdc);}return _0x4fb6ec[_0xb2fe('0x24')]();};}function saveUpdates(_0x15be26,_0x42709b){return function(_0x35d845){if(_0x35d845){return _0x35d845[_0xb2fe('0x25')](_0x15be26)[_0xb2fe('0x26')](function(_0x29d848){return _0x29d848;});}return null;};}function removeEntity(_0x2c1157,_0x3d2f78){return function(_0x4f4cac){if(_0x4f4cac){return _0x4f4cac[_0xb2fe('0x27')]()[_0xb2fe('0x26')](function(){_0x2c1157[_0xb2fe('0x1b')](0xcc)[_0xb2fe('0x1c')]();});}};}function handleEntityNotFound(_0x4e7c32,_0x2195c8){return function(_0x35430d){if(!_0x35430d){_0x4e7c32['sendStatus'](0x194);}return _0x35430d;};}function handleError(_0x4a1729,_0x1e12b9){_0x1e12b9=_0x1e12b9||0x1f4;return function(_0x3550d3){logger[_0xb2fe('0x28')](_0x3550d3[_0xb2fe('0x29')]);if(_0x3550d3[_0xb2fe('0x2a')]){delete _0x3550d3[_0xb2fe('0x2a')];}_0x4a1729[_0xb2fe('0x1b')](_0x1e12b9)['send'](_0x3550d3);};}exports['index']=function(_0x321695,_0x39f8fb){var _0x449de4={},_0x4fc254={},_0x3cd10e={'count':0x0,'rows':[]};var _0xd939de=_[_0xb2fe('0x2b')](db['VtigerAccount']['rawAttributes'],function(_0xc8f96b){return{'name':_0xc8f96b['fieldName'],'type':_0xc8f96b[_0xb2fe('0x2c')]['key']};});_0x4fc254['model']=_[_0xb2fe('0x2b')](_0xd939de,_0xb2fe('0x2a'));_0x4fc254[_0xb2fe('0x2d')]=_[_0xb2fe('0x2e')](_0x321695[_0xb2fe('0x2d')]);_0x4fc254['filters']=_[_0xb2fe('0x2f')](_0x4fc254[_0xb2fe('0x30')],_0x4fc254[_0xb2fe('0x2d')]);_0x449de4['attributes']=_[_0xb2fe('0x2f')](_0x4fc254['model'],qs['fields'](_0x321695[_0xb2fe('0x2d')][_0xb2fe('0x31')]));_0x449de4['attributes']=_0x449de4[_0xb2fe('0x32')]['length']?_0x449de4[_0xb2fe('0x32')]:_0x4fc254[_0xb2fe('0x30')];if(!_0x321695[_0xb2fe('0x2d')][_0xb2fe('0x33')](_0xb2fe('0x34'))){_0x449de4[_0xb2fe('0x20')]=qs[_0xb2fe('0x20')](_0x321695[_0xb2fe('0x2d')][_0xb2fe('0x20')]);_0x449de4['offset']=qs[_0xb2fe('0x1e')](_0x321695[_0xb2fe('0x2d')][_0xb2fe('0x1e')]);}_0x449de4[_0xb2fe('0x35')]=qs['sort'](_0x321695[_0xb2fe('0x2d')][_0xb2fe('0x36')]);_0x449de4[_0xb2fe('0x37')]=qs[_0xb2fe('0x38')](_[_0xb2fe('0x39')](_0x321695[_0xb2fe('0x2d')],_0x4fc254[_0xb2fe('0x38')]),_0xd939de);if(_0x321695['query']['filter']){_0x449de4[_0xb2fe('0x37')]=_[_0xb2fe('0x3a')](_0x449de4['where'],{'$or':_['map'](_0xd939de,function(_0x20d01a){if(_0x20d01a[_0xb2fe('0x2c')]!=='VIRTUAL'){var _0x3cf121={};_0x3cf121[_0x20d01a[_0xb2fe('0x2a')]]={'$like':'%'+_0x321695['query'][_0xb2fe('0x3b')]+'%'};return _0x3cf121;}})});}_0x449de4=_[_0xb2fe('0x3a')]({},_0x449de4,_0x321695[_0xb2fe('0x3c')]);var _0xd164d3={'where':_0x449de4['where']};return db['VtigerAccount'][_0xb2fe('0x21')](_0xd164d3)['then'](function(_0x3c0aeb){_0x3cd10e['count']=_0x3c0aeb;if(_0x321695[_0xb2fe('0x2d')][_0xb2fe('0x3d')]){_0x449de4[_0xb2fe('0x3e')]=[{'all':!![]}];}return db['VtigerAccount'][_0xb2fe('0x3f')](_0x449de4);})[_0xb2fe('0x26')](function(_0x28f5f4){_0x3cd10e[_0xb2fe('0x40')]=_0x28f5f4;return _0x3cd10e;})[_0xb2fe('0x26')](respondWithFilteredResult(_0x39f8fb,_0x449de4))[_0xb2fe('0x41')](handleError(_0x39f8fb,null));};exports['show']=function(_0x32c798,_0xd1abbd){var _0x4a26d8={'raw':![],'where':{'id':_0x32c798[_0xb2fe('0x42')]['id']}},_0x437221={};_0x437221[_0xb2fe('0x30')]=_[_0xb2fe('0x2e')](db[_0xb2fe('0x43')][_0xb2fe('0x44')]);_0x437221[_0xb2fe('0x2d')]=_['keys'](_0x32c798[_0xb2fe('0x2d')]);_0x437221[_0xb2fe('0x38')]=_[_0xb2fe('0x2f')](_0x437221[_0xb2fe('0x30')],_0x437221[_0xb2fe('0x2d')]);_0x4a26d8[_0xb2fe('0x32')]=_['intersection'](_0x437221[_0xb2fe('0x30')],qs[_0xb2fe('0x31')](_0x32c798['query'][_0xb2fe('0x31')]));_0x4a26d8[_0xb2fe('0x32')]=_0x4a26d8[_0xb2fe('0x32')][_0xb2fe('0x45')]?_0x4a26d8['attributes']:_0x437221[_0xb2fe('0x30')];if(_0x32c798[_0xb2fe('0x2d')][_0xb2fe('0x3d')]){_0x4a26d8['include']=[{'all':!![]}];}_0x4a26d8=_[_0xb2fe('0x3a')]({},_0x4a26d8,_0x32c798[_0xb2fe('0x3c')]);return db['VtigerAccount'][_0xb2fe('0x46')](_0x4a26d8)[_0xb2fe('0x26')](handleEntityNotFound(_0xd1abbd,null))[_0xb2fe('0x26')](respondWithResult(_0xd1abbd,null))[_0xb2fe('0x41')](handleError(_0xd1abbd,null));};exports[_0xb2fe('0x47')]=function(_0x57f122,_0xfec9b){return db[_0xb2fe('0x43')][_0xb2fe('0x47')](_0x57f122[_0xb2fe('0x48')],{})['then'](respondWithResult(_0xfec9b,0xc9))[_0xb2fe('0x41')](handleError(_0xfec9b,null));};exports[_0xb2fe('0x25')]=function(_0x3892e9,_0x31ad43){if(_0x3892e9['body']['id']){delete _0x3892e9[_0xb2fe('0x48')]['id'];}return db[_0xb2fe('0x43')]['find']({'where':{'id':_0x3892e9['params']['id']}})['then'](handleEntityNotFound(_0x31ad43,null))[_0xb2fe('0x26')](saveUpdates(_0x3892e9['body'],null))['then'](respondWithResult(_0x31ad43,null))[_0xb2fe('0x41')](handleError(_0x31ad43,null));};exports[_0xb2fe('0x27')]=function(_0x56f1b9,_0x5d20d6){return db['VtigerAccount'][_0xb2fe('0x46')]({'where':{'id':_0x56f1b9[_0xb2fe('0x42')]['id']}})[_0xb2fe('0x26')](handleEntityNotFound(_0x5d20d6,null))[_0xb2fe('0x26')](removeEntity(_0x5d20d6,null))[_0xb2fe('0x41')](handleError(_0x5d20d6,null));};exports[_0xb2fe('0x49')]=function(_0x399538,_0x4ea378,_0x14ceaa){var _0x1c7e8c={};var _0x3af626={};var _0x16e099;var _0x1e4c1c;return db['VtigerAccount'][_0xb2fe('0x4a')]({'where':{'id':_0x399538[_0xb2fe('0x42')]['id']}})['then'](handleEntityNotFound(_0x4ea378,null))[_0xb2fe('0x26')](function(_0x34fa22){if(_0x34fa22){_0x16e099=_0x34fa22;_0x3af626[_0xb2fe('0x30')]=_[_0xb2fe('0x2e')](db[_0xb2fe('0x4b')][_0xb2fe('0x44')]);_0x3af626[_0xb2fe('0x2d')]=_['keys'](_0x399538['query']);_0x3af626[_0xb2fe('0x38')]=_[_0xb2fe('0x2f')](_0x3af626['model'],_0x3af626[_0xb2fe('0x2d')]);_0x1c7e8c[_0xb2fe('0x32')]=_[_0xb2fe('0x2f')](_0x3af626[_0xb2fe('0x30')],qs[_0xb2fe('0x31')](_0x399538[_0xb2fe('0x2d')][_0xb2fe('0x31')]));_0x1c7e8c[_0xb2fe('0x32')]=_0x1c7e8c[_0xb2fe('0x32')][_0xb2fe('0x45')]?_0x1c7e8c['attributes']:_0x3af626[_0xb2fe('0x30')];_0x1c7e8c[_0xb2fe('0x35')]=qs[_0xb2fe('0x36')](_0x399538[_0xb2fe('0x2d')][_0xb2fe('0x36')]);_0x1c7e8c[_0xb2fe('0x37')]=qs[_0xb2fe('0x38')](_[_0xb2fe('0x39')](_0x399538[_0xb2fe('0x2d')],_0x3af626[_0xb2fe('0x38')]));if(_0x399538[_0xb2fe('0x2d')][_0xb2fe('0x3b')]){_0x1c7e8c['where']=_[_0xb2fe('0x3a')](_0x1c7e8c[_0xb2fe('0x37')],{'$or':_[_0xb2fe('0x2b')](_0x1c7e8c['attributes'],function(_0x169bed){var _0x4875e2={};_0x4875e2[_0x169bed]={'$like':'%'+_0x399538[_0xb2fe('0x2d')][_0xb2fe('0x3b')]+'%'};return _0x4875e2;})});}_0x1c7e8c=_[_0xb2fe('0x3a')]({},_0x1c7e8c,_0x399538[_0xb2fe('0x3c')]);return _0x16e099[_0xb2fe('0x49')](_0x1c7e8c);}})[_0xb2fe('0x26')](function(_0x3a53f1){if(_0x3a53f1){_0x1e4c1c=_0x3a53f1[_0xb2fe('0x45')];if(!_0x399538[_0xb2fe('0x2d')][_0xb2fe('0x33')](_0xb2fe('0x34'))){_0x1c7e8c[_0xb2fe('0x20')]=qs[_0xb2fe('0x20')](_0x399538[_0xb2fe('0x2d')]['limit']);_0x1c7e8c['offset']=qs[_0xb2fe('0x1e')](_0x399538[_0xb2fe('0x2d')][_0xb2fe('0x1e')]);}return _0x16e099['getConfigurations'](_0x1c7e8c);}})[_0xb2fe('0x26')](function(_0x5dba22){if(_0x5dba22){return _0x5dba22?{'count':_0x1e4c1c,'rows':_0x5dba22}:null;}})[_0xb2fe('0x26')](respondWithResult(_0x4ea378,null))[_0xb2fe('0x41')](handleError(_0x4ea378,null));};exports[_0xb2fe('0x4c')]=function(_0x364abd,_0x576aed,_0x432cfa){if(_0x364abd[_0xb2fe('0x48')]['id']){delete _0x364abd['body']['id'];}return db[_0xb2fe('0x43')][_0xb2fe('0x4a')]({'where':{'id':_0x364abd[_0xb2fe('0x42')]['id']}})[_0xb2fe('0x26')](handleEntityNotFound(_0x576aed,null))[_0xb2fe('0x26')](function(_0xd01f6b){if(_0xd01f6b){_0x364abd[_0xb2fe('0x48')][_0xb2fe('0x4d')]=_0xd01f6b['id'];_0x364abd[_0xb2fe('0x48')][_0xb2fe('0x4e')]=integrations[_0xb2fe('0x4f')](_0x364abd['body'][_0xb2fe('0x50')],_0x364abd[_0xb2fe('0x48')][_0xb2fe('0x2c')]);_0x364abd[_0xb2fe('0x48')][_0xb2fe('0x51')]=integrations[_0xb2fe('0x52')](_0x364abd[_0xb2fe('0x48')][_0xb2fe('0x50')],_0x364abd['body']['type']);return db[_0xb2fe('0x4b')][_0xb2fe('0x47')](_0x364abd['body'],{'include':[{'model':db[_0xb2fe('0x53')],'as':_0xb2fe('0x4e')},{'model':db[_0xb2fe('0x53')],'as':_0xb2fe('0x51')}]});}return null;})['then'](respondWithResult(_0x576aed,null))[_0xb2fe('0x41')](handleError(_0x576aed,null));};var md5=require(_0xb2fe('0x54'));exports[_0xb2fe('0x55')]=function(_0xa050de,_0x172351,_0x19ec41){var _0x2f567b=null;var _0x3765b4=null;var _0x3a59e7=null;var _0x109e63=null;var _0x284d76='';return db[_0xb2fe('0x43')][_0xb2fe('0x4a')]({'where':{'id':_0xa050de[_0xb2fe('0x42')]['id']},'attributes':['id',_0xb2fe('0x2a'),_0xb2fe('0x56'),_0xb2fe('0x57'),_0xb2fe('0x58'),'remoteUri',_0xb2fe('0x59'),_0xb2fe('0x5a')]})[_0xb2fe('0x26')](handleEntityNotFound(_0x172351,null))[_0xb2fe('0x26')](function(_0x386e49){if(_0x386e49){_0x2f567b=_0x386e49['username'];_0x3765b4=_0x386e49[_0xb2fe('0x5a')];_0x3a59e7=_0x386e49['moduleName'];_0x284d76=_0x386e49[_0xb2fe('0x5b')];var _0x1d9495=_0x284d76[_0xb2fe('0x5c')](-0x1);if(_0x1d9495==='/'){_0x284d76=_0x284d76[_0xb2fe('0x5d')](0x0,_0x284d76[_0xb2fe('0x5e')](_0x1d9495));}_0x109e63=util['format'](_0xb2fe('0x5f'),_0x284d76);var _0x23e82c={'method':'GET','uri':_0x109e63,'qs':{'operation':_0xb2fe('0x60'),'username':_0x386e49[_0xb2fe('0x56')]},'json':!![]};return rp(_0x23e82c);}})['then'](function(_0x4fbf88){if(_0x4fbf88[_0xb2fe('0x61')]){var _0x392ed6={'method':'POST','uri':_0x109e63,'form':{'operation':'login','username':_0x2f567b,'accessKey':md5(_0x4fbf88['result']['token']+_0x3765b4)},'json':!![]};return rp(_0x392ed6);}})[_0xb2fe('0x26')](function(_0x1583c8){if(_0x1583c8[_0xb2fe('0x61')]){var _0x302464={'method':_0xb2fe('0x62'),'uri':_0x109e63,'qs':{'operation':'describe','username':_0x2f567b,'sessionName':_0x1583c8[_0xb2fe('0x63')][_0xb2fe('0x64')],'elementType':_0x3a59e7},'json':!![]};return rp(_0x302464);}})['then'](function(_0x283fa8){if(_0x283fa8[_0xb2fe('0x61')]){var _0x551ee6=[_0xb2fe('0x65'),_0xb2fe('0x66'),_0xb2fe('0x67')];_['remove'](_0x283fa8[_0xb2fe('0x63')]['fields'],function(_0x583561){return _0x551ee6['includes'](_0x583561[_0xb2fe('0x2c')][_0xb2fe('0x2a')]);});_[_0xb2fe('0x68')](_0x283fa8[_0xb2fe('0x63')]['fields'],function(_0x6f21d9){return _0x6f21d9[_0xb2fe('0x69')]===_0xb2fe('0x6a');});return{'count':_0x283fa8['result'][_0xb2fe('0x31')]['length'],'rows':_[_0xb2fe('0x2b')](_0x283fa8[_0xb2fe('0x63')][_0xb2fe('0x31')],function(_0x449255){return{'id':_0x449255[_0xb2fe('0x2a')],'name':_0x449255[_0xb2fe('0x6b')],'custom':_[_0xb2fe('0x6c')](_0x449255[_0xb2fe('0x2a')],_0xb2fe('0x6d'))?!![]:![],'options':_0x449255[_0xb2fe('0x2c')]['name']==='picklist'&&_0x449255[_0xb2fe('0x2c')][_0xb2fe('0x6e')][_0xb2fe('0x45')]>0x0?_[_0xb2fe('0x2b')](_0x449255['type']['picklistValues'],function(_0x3cd3e0){return{'name':_0x3cd3e0[_0xb2fe('0x6b')],'value':_0x3cd3e0[_0xb2fe('0x6f')]};}):[]};})};}})[_0xb2fe('0x26')](respondWithResult(_0x172351,null))[_0xb2fe('0x41')](function(_0x3976bc){console[_0xb2fe('0x70')](_0xb2fe('0x71')+_0x3976bc);var _0x60a655=_0xa050de['query'][_0xb2fe('0x72')]?0x1f4:_0x3976bc[_0xb2fe('0x73')]||0x1f4;logger[_0xb2fe('0x28')](_0xb2fe('0x74'),_0xb2fe('0x55'),_0x60a655,JSON[_0xb2fe('0x75')](_0x3976bc));delete _0x3976bc['name'];if(_0x60a655===0x191){_0x60a655=0x190;}_0x172351[_0xb2fe('0x1b')](_0x60a655)[_0xb2fe('0x76')](_0xa050de['query'][_0xb2fe('0x72')]?{'message':'Wrong\x20credentials','statusCode':_0x3976bc['statusCode']}:_0x3976bc);});}; \ No newline at end of file +var _0xc030=['fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','name','send','VtigerAccount','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','map','type','includeAll','include','findAll','rows','params','keys','options','find','body','catch','VtigerConfiguration','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','create','VtigerField','getFields','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','format','%s/webservice.php','getchallenge','username','POST','login','result','token','success','GET','describe','sessionName','autogenerated','owner','remove','includes','startsWith','picklist','picklistValues','log','vTiger\x20error:\x20','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf'];(function(_0xe58c5d,_0x432a0b){var _0x40031e=function(_0x19f5cb){while(--_0x19f5cb){_0xe58c5d['push'](_0xe58c5d['shift']());}};_0x40031e(++_0x432a0b);}(_0xc030,0xe3));var _0x0c03=function(_0x2cc046,_0x25e3f8){_0x2cc046=_0x2cc046-0x0;var _0x406f57=_0xc030[_0x2cc046];return _0x406f57;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0c03('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0c03('0x1'));var rp=require(_0x0c03('0x2'));var moment=require(_0x0c03('0x3'));var BPromise=require(_0x0c03('0x4'));var Mustache=require(_0x0c03('0x5'));var util=require('util');var path=require(_0x0c03('0x6'));var sox=require(_0x0c03('0x7'));var csv=require(_0x0c03('0x8'));var ejs=require(_0x0c03('0x9'));var fs=require('fs');var fs_extra=require(_0x0c03('0xa'));var _=require(_0x0c03('0xb'));var squel=require(_0x0c03('0xc'));var crypto=require(_0x0c03('0xd'));var jsforce=require(_0x0c03('0xe'));var deskjs=require(_0x0c03('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0c03('0x10'));var Papa=require(_0x0c03('0x11'));var Redis=require('ioredis');var authService=require(_0x0c03('0x12'));var qs=require(_0x0c03('0x13'));var as=require(_0x0c03('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0c03('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x0c03('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c03('0x17'))['db'];var integrations=require(_0x0c03('0x18'));function respondWithStatusCode(_0x5217d2,_0x3eb1a4){_0x3eb1a4=_0x3eb1a4||0xcc;return function(_0x1f6fe4){if(_0x1f6fe4){return _0x5217d2['sendStatus'](_0x3eb1a4);}return _0x5217d2[_0x0c03('0x19')](_0x3eb1a4)[_0x0c03('0x1a')]();};}function respondWithResult(_0x24308c,_0x115483){_0x115483=_0x115483||0xc8;return function(_0x2a58c9){if(_0x2a58c9){return _0x24308c[_0x0c03('0x19')](_0x115483)[_0x0c03('0x1b')](_0x2a58c9);}};}function respondWithFilteredResult(_0x422cfb,_0x28658e){return function(_0x48596e){if(_0x48596e){var _0x5a822c=typeof _0x28658e[_0x0c03('0x1c')]===_0x0c03('0x1d')&&typeof _0x28658e[_0x0c03('0x1e')]==='undefined';var _0xf81ba1=_0x48596e[_0x0c03('0x1f')];var _0x47c3b3=_0x5a822c?0x0:_0x28658e['offset'];var _0x5397f6=_0x5a822c?_0x48596e[_0x0c03('0x1f')]:_0x28658e[_0x0c03('0x1c')]+_0x28658e['limit'];var _0x14c7de;if(_0x5397f6>=_0xf81ba1){_0x5397f6=_0xf81ba1;_0x14c7de=0xc8;}else{_0x14c7de=0xce;}_0x422cfb[_0x0c03('0x19')](_0x14c7de);return _0x422cfb['set'](_0x0c03('0x20'),_0x47c3b3+'-'+_0x5397f6+'/'+_0xf81ba1)[_0x0c03('0x1b')](_0x48596e);}return null;};}function patchUpdates(_0x2b5d72){return function(_0xc28213){try{jsonpatch[_0x0c03('0x21')](_0xc28213,_0x2b5d72,!![]);}catch(_0xd7fafb){return BPromise[_0x0c03('0x22')](_0xd7fafb);}return _0xc28213[_0x0c03('0x23')]();};}function saveUpdates(_0xe58994,_0x5c9155){return function(_0xf8a6c6){if(_0xf8a6c6){return _0xf8a6c6[_0x0c03('0x24')](_0xe58994)['then'](function(_0x5ce084){return _0x5ce084;});}return null;};}function removeEntity(_0x51a831,_0x27de06){return function(_0x51727a){if(_0x51727a){return _0x51727a[_0x0c03('0x25')]()[_0x0c03('0x26')](function(){_0x51a831[_0x0c03('0x19')](0xcc)[_0x0c03('0x1a')]();});}};}function handleEntityNotFound(_0x1233fd,_0x9f5535){return function(_0x2ebe1e){if(!_0x2ebe1e){_0x1233fd['sendStatus'](0x194);}return _0x2ebe1e;};}function handleError(_0x100b35,_0x326a48){_0x326a48=_0x326a48||0x1f4;return function(_0x241d09){logger['error'](_0x241d09['stack']);if(_0x241d09[_0x0c03('0x27')]){delete _0x241d09[_0x0c03('0x27')];}_0x100b35[_0x0c03('0x19')](_0x326a48)[_0x0c03('0x28')](_0x241d09);};}exports['index']=function(_0x2ae984,_0x27aa6f){var _0x4c8e3e={},_0x264f77={},_0x33f970={'count':0x0,'rows':[]};var _0x5dc8d8=_['map'](db[_0x0c03('0x29')][_0x0c03('0x2a')],function(_0x40b435){return{'name':_0x40b435[_0x0c03('0x2b')],'type':_0x40b435['type'][_0x0c03('0x2c')]};});_0x264f77[_0x0c03('0x2d')]=_['map'](_0x5dc8d8,'name');_0x264f77[_0x0c03('0x2e')]=_['keys'](_0x2ae984['query']);_0x264f77[_0x0c03('0x2f')]=_[_0x0c03('0x30')](_0x264f77[_0x0c03('0x2d')],_0x264f77[_0x0c03('0x2e')]);_0x4c8e3e[_0x0c03('0x31')]=_[_0x0c03('0x30')](_0x264f77[_0x0c03('0x2d')],qs['fields'](_0x2ae984['query'][_0x0c03('0x32')]));_0x4c8e3e[_0x0c03('0x31')]=_0x4c8e3e[_0x0c03('0x31')][_0x0c03('0x33')]?_0x4c8e3e[_0x0c03('0x31')]:_0x264f77['model'];if(!_0x2ae984[_0x0c03('0x2e')][_0x0c03('0x34')]('nolimit')){_0x4c8e3e['limit']=qs[_0x0c03('0x1e')](_0x2ae984['query'][_0x0c03('0x1e')]);_0x4c8e3e[_0x0c03('0x1c')]=qs[_0x0c03('0x1c')](_0x2ae984[_0x0c03('0x2e')][_0x0c03('0x1c')]);}_0x4c8e3e[_0x0c03('0x35')]=qs[_0x0c03('0x36')](_0x2ae984[_0x0c03('0x2e')][_0x0c03('0x36')]);_0x4c8e3e['where']=qs[_0x0c03('0x2f')](_[_0x0c03('0x37')](_0x2ae984[_0x0c03('0x2e')],_0x264f77[_0x0c03('0x2f')]),_0x5dc8d8);if(_0x2ae984[_0x0c03('0x2e')][_0x0c03('0x38')]){_0x4c8e3e['where']=_[_0x0c03('0x39')](_0x4c8e3e[_0x0c03('0x3a')],{'$or':_[_0x0c03('0x3b')](_0x5dc8d8,function(_0x838bf2){if(_0x838bf2[_0x0c03('0x3c')]!=='VIRTUAL'){var _0x31e08e={};_0x31e08e[_0x838bf2['name']]={'$like':'%'+_0x2ae984[_0x0c03('0x2e')][_0x0c03('0x38')]+'%'};return _0x31e08e;}})});}_0x4c8e3e=_[_0x0c03('0x39')]({},_0x4c8e3e,_0x2ae984['options']);var _0x30a081={'where':_0x4c8e3e['where']};return db[_0x0c03('0x29')][_0x0c03('0x1f')](_0x30a081)[_0x0c03('0x26')](function(_0x18b75d){_0x33f970[_0x0c03('0x1f')]=_0x18b75d;if(_0x2ae984[_0x0c03('0x2e')][_0x0c03('0x3d')]){_0x4c8e3e[_0x0c03('0x3e')]=[{'all':!![]}];}return db[_0x0c03('0x29')][_0x0c03('0x3f')](_0x4c8e3e);})['then'](function(_0x39298a){_0x33f970[_0x0c03('0x40')]=_0x39298a;return _0x33f970;})[_0x0c03('0x26')](respondWithFilteredResult(_0x27aa6f,_0x4c8e3e))['catch'](handleError(_0x27aa6f,null));};exports['show']=function(_0x1c2fd7,_0x326314){var _0x2f78a4={'raw':![],'where':{'id':_0x1c2fd7[_0x0c03('0x41')]['id']}},_0x47ea02={};_0x47ea02['model']=_[_0x0c03('0x42')](db['VtigerAccount'][_0x0c03('0x2a')]);_0x47ea02['query']=_[_0x0c03('0x42')](_0x1c2fd7[_0x0c03('0x2e')]);_0x47ea02['filters']=_[_0x0c03('0x30')](_0x47ea02[_0x0c03('0x2d')],_0x47ea02[_0x0c03('0x2e')]);_0x2f78a4['attributes']=_[_0x0c03('0x30')](_0x47ea02[_0x0c03('0x2d')],qs[_0x0c03('0x32')](_0x1c2fd7['query']['fields']));_0x2f78a4[_0x0c03('0x31')]=_0x2f78a4['attributes'][_0x0c03('0x33')]?_0x2f78a4['attributes']:_0x47ea02[_0x0c03('0x2d')];if(_0x1c2fd7[_0x0c03('0x2e')][_0x0c03('0x3d')]){_0x2f78a4['include']=[{'all':!![]}];}_0x2f78a4=_[_0x0c03('0x39')]({},_0x2f78a4,_0x1c2fd7[_0x0c03('0x43')]);return db[_0x0c03('0x29')][_0x0c03('0x44')](_0x2f78a4)[_0x0c03('0x26')](handleEntityNotFound(_0x326314,null))[_0x0c03('0x26')](respondWithResult(_0x326314,null))['catch'](handleError(_0x326314,null));};exports['create']=function(_0x4d9d91,_0x450319){return db['VtigerAccount']['create'](_0x4d9d91[_0x0c03('0x45')],{})['then'](respondWithResult(_0x450319,0xc9))[_0x0c03('0x46')](handleError(_0x450319,null));};exports[_0x0c03('0x24')]=function(_0x4305cb,_0x428dcb){if(_0x4305cb[_0x0c03('0x45')]['id']){delete _0x4305cb[_0x0c03('0x45')]['id'];}return db['VtigerAccount'][_0x0c03('0x44')]({'where':{'id':_0x4305cb[_0x0c03('0x41')]['id']}})[_0x0c03('0x26')](handleEntityNotFound(_0x428dcb,null))[_0x0c03('0x26')](saveUpdates(_0x4305cb[_0x0c03('0x45')],null))[_0x0c03('0x26')](respondWithResult(_0x428dcb,null))[_0x0c03('0x46')](handleError(_0x428dcb,null));};exports['destroy']=function(_0x5eedf6,_0x126dba){return db['VtigerAccount'][_0x0c03('0x44')]({'where':{'id':_0x5eedf6['params']['id']}})[_0x0c03('0x26')](handleEntityNotFound(_0x126dba,null))[_0x0c03('0x26')](removeEntity(_0x126dba,null))[_0x0c03('0x46')](handleError(_0x126dba,null));};exports['getConfigurations']=function(_0x875d55,_0x10e63e,_0x5e018f){var _0x5a8173={};var _0x420ff3={};var _0x58921b;var _0x1eeb50;return db['VtigerAccount']['findOne']({'where':{'id':_0x875d55[_0x0c03('0x41')]['id']}})[_0x0c03('0x26')](handleEntityNotFound(_0x10e63e,null))['then'](function(_0x1228c8){if(_0x1228c8){_0x58921b=_0x1228c8;_0x420ff3['model']=_[_0x0c03('0x42')](db[_0x0c03('0x47')]['rawAttributes']);_0x420ff3[_0x0c03('0x2e')]=_[_0x0c03('0x42')](_0x875d55[_0x0c03('0x2e')]);_0x420ff3[_0x0c03('0x2f')]=_[_0x0c03('0x30')](_0x420ff3['model'],_0x420ff3[_0x0c03('0x2e')]);_0x5a8173['attributes']=_[_0x0c03('0x30')](_0x420ff3[_0x0c03('0x2d')],qs['fields'](_0x875d55['query'][_0x0c03('0x32')]));_0x5a8173['attributes']=_0x5a8173[_0x0c03('0x31')]['length']?_0x5a8173[_0x0c03('0x31')]:_0x420ff3[_0x0c03('0x2d')];_0x5a8173[_0x0c03('0x35')]=qs[_0x0c03('0x36')](_0x875d55[_0x0c03('0x2e')][_0x0c03('0x36')]);_0x5a8173['where']=qs[_0x0c03('0x2f')](_[_0x0c03('0x37')](_0x875d55['query'],_0x420ff3[_0x0c03('0x2f')]));if(_0x875d55[_0x0c03('0x2e')][_0x0c03('0x38')]){_0x5a8173[_0x0c03('0x3a')]=_[_0x0c03('0x39')](_0x5a8173['where'],{'$or':_[_0x0c03('0x3b')](_0x5a8173['attributes'],function(_0x2478f8){var _0x4a2d5e={};_0x4a2d5e[_0x2478f8]={'$like':'%'+_0x875d55[_0x0c03('0x2e')][_0x0c03('0x38')]+'%'};return _0x4a2d5e;})});}_0x5a8173=_[_0x0c03('0x39')]({},_0x5a8173,_0x875d55[_0x0c03('0x43')]);return _0x58921b['getConfigurations'](_0x5a8173);}})['then'](function(_0x544191){if(_0x544191){_0x1eeb50=_0x544191['length'];if(!_0x875d55['query'][_0x0c03('0x34')]('nolimit')){_0x5a8173[_0x0c03('0x1e')]=qs[_0x0c03('0x1e')](_0x875d55[_0x0c03('0x2e')][_0x0c03('0x1e')]);_0x5a8173[_0x0c03('0x1c')]=qs['offset'](_0x875d55[_0x0c03('0x2e')][_0x0c03('0x1c')]);}return _0x58921b['getConfigurations'](_0x5a8173);}})[_0x0c03('0x26')](function(_0x4fdbde){if(_0x4fdbde){return _0x4fdbde?{'count':_0x1eeb50,'rows':_0x4fdbde}:null;}})[_0x0c03('0x26')](respondWithResult(_0x10e63e,null))['catch'](handleError(_0x10e63e,null));};exports[_0x0c03('0x48')]=function(_0x2a4631,_0x271623,_0x48be5d){if(_0x2a4631['body']['id']){delete _0x2a4631[_0x0c03('0x45')]['id'];}return db[_0x0c03('0x29')][_0x0c03('0x49')]({'where':{'id':_0x2a4631[_0x0c03('0x41')]['id']}})[_0x0c03('0x26')](handleEntityNotFound(_0x271623,null))[_0x0c03('0x26')](function(_0x2d07e6){if(_0x2d07e6){_0x2a4631[_0x0c03('0x45')][_0x0c03('0x4a')]=_0x2d07e6['id'];_0x2a4631['body'][_0x0c03('0x4b')]=integrations['getSubjects'](_0x2a4631['body'][_0x0c03('0x4c')],_0x2a4631[_0x0c03('0x45')][_0x0c03('0x3c')]);_0x2a4631['body'][_0x0c03('0x4d')]=integrations[_0x0c03('0x4e')](_0x2a4631['body'][_0x0c03('0x4c')],_0x2a4631[_0x0c03('0x45')][_0x0c03('0x3c')]);return db[_0x0c03('0x47')][_0x0c03('0x4f')](_0x2a4631['body'],{'include':[{'model':db['VtigerField'],'as':'Subjects'},{'model':db[_0x0c03('0x50')],'as':_0x0c03('0x4d')}]});}return null;})['then'](respondWithResult(_0x271623,null))[_0x0c03('0x46')](handleError(_0x271623,null));};var md5=require('md5');exports[_0x0c03('0x51')]=function(_0x563ebe,_0x3da157,_0x4251c1){var _0x4d5254=null;var _0x173f3d=null;var _0x229973=null;var _0x2326bc=null;var _0x4dc794='';return db['VtigerAccount'][_0x0c03('0x49')]({'where':{'id':_0x563ebe[_0x0c03('0x41')]['id']},'attributes':['id',_0x0c03('0x27'),'username',_0x0c03('0x52'),_0x0c03('0x53'),_0x0c03('0x54'),_0x0c03('0x55'),_0x0c03('0x56')]})[_0x0c03('0x26')](handleEntityNotFound(_0x3da157,null))[_0x0c03('0x26')](function(_0x25c199){if(_0x25c199){_0x4d5254=_0x25c199['username'];_0x173f3d=_0x25c199[_0x0c03('0x56')];_0x229973=_0x25c199['moduleName'];_0x4dc794=_0x25c199[_0x0c03('0x54')];var _0x556c1c=_0x4dc794[_0x0c03('0x57')](-0x1);if(_0x556c1c==='/'){_0x4dc794=_0x4dc794[_0x0c03('0x58')](0x0,_0x4dc794['lastIndexOf'](_0x556c1c));}_0x2326bc=util[_0x0c03('0x59')](_0x0c03('0x5a'),_0x4dc794);var _0x422a7b={'method':'GET','uri':_0x2326bc,'qs':{'operation':_0x0c03('0x5b'),'username':_0x25c199[_0x0c03('0x5c')]},'json':!![]};return rp(_0x422a7b);}})[_0x0c03('0x26')](function(_0x592724){if(_0x592724['success']){var _0x454ced={'method':_0x0c03('0x5d'),'uri':_0x2326bc,'form':{'operation':_0x0c03('0x5e'),'username':_0x4d5254,'accessKey':md5(_0x592724[_0x0c03('0x5f')][_0x0c03('0x60')]+_0x173f3d)},'json':!![]};return rp(_0x454ced);}})[_0x0c03('0x26')](function(_0x8cefd8){if(_0x8cefd8[_0x0c03('0x61')]){var _0x51f6aa={'method':_0x0c03('0x62'),'uri':_0x2326bc,'qs':{'operation':_0x0c03('0x63'),'username':_0x4d5254,'sessionName':_0x8cefd8[_0x0c03('0x5f')][_0x0c03('0x64')],'elementType':_0x229973},'json':!![]};return rp(_0x51f6aa);}})[_0x0c03('0x26')](function(_0x978f62){if(_0x978f62[_0x0c03('0x61')]){var _0x40fc88=[_0x0c03('0x65'),'reference',_0x0c03('0x66')];_[_0x0c03('0x67')](_0x978f62[_0x0c03('0x5f')][_0x0c03('0x32')],function(_0xf5f2c){return _0x40fc88[_0x0c03('0x68')](_0xf5f2c[_0x0c03('0x3c')][_0x0c03('0x27')]);});_[_0x0c03('0x67')](_0x978f62['result'][_0x0c03('0x32')],function(_0x14f883){return _0x14f883['editable']==='false';});return{'count':_0x978f62['result'][_0x0c03('0x32')][_0x0c03('0x33')],'rows':_[_0x0c03('0x3b')](_0x978f62[_0x0c03('0x5f')]['fields'],function(_0x5062bb){return{'id':_0x5062bb[_0x0c03('0x27')],'name':_0x5062bb['label'],'custom':_[_0x0c03('0x69')](_0x5062bb[_0x0c03('0x27')],'cf_')?!![]:![],'options':_0x5062bb['type'][_0x0c03('0x27')]===_0x0c03('0x6a')&&_0x5062bb['type'][_0x0c03('0x6b')]['length']>0x0?_['map'](_0x5062bb[_0x0c03('0x3c')]['picklistValues'],function(_0xdf3215){return{'name':_0xdf3215['label'],'value':_0xdf3215['value']};}):[]};})};}})[_0x0c03('0x26')](respondWithResult(_0x3da157,null))[_0x0c03('0x46')](function(_0x1e3d15){console[_0x0c03('0x6c')](_0x0c03('0x6d')+_0x1e3d15);var _0x10bb77=_0x563ebe['query'][_0x0c03('0x6e')]?0x1f4:_0x1e3d15['statusCode']||0x1f4;logger[_0x0c03('0x6f')](_0x0c03('0x70'),'getFields',_0x10bb77,JSON[_0x0c03('0x71')](_0x1e3d15));delete _0x1e3d15[_0x0c03('0x27')];if(_0x10bb77===0x191){_0x10bb77=0x190;}_0x3da157[_0x0c03('0x19')](_0x10bb77)[_0x0c03('0x28')](_0x563ebe[_0x0c03('0x2e')][_0x0c03('0x6e')]?{'message':'Wrong\x20credentials','statusCode':_0x1e3d15['statusCode']}:_0x1e3d15);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 99e3c92..bb7052e 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 _0x0956=['moment','rimraf','./intVtigerAccount.attributes','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util'];(function(_0xf9e76,_0x2e6b9a){var _0x119a9b=function(_0x146396){while(--_0x146396){_0xf9e76['push'](_0xf9e76['shift']());}};_0x119a9b(++_0x2e6b9a);}(_0x0956,0x130));var _0x6095=function(_0x3a4f5d,_0x26e471){_0x3a4f5d=_0x3a4f5d-0x0;var _0x5ec484=_0x0956[_0x3a4f5d];return _0x5ec484;};'use strict';var _=require(_0x6095('0x0'));var util=require(_0x6095('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6095('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6095('0x3'));var config=require('../../config/environment');var attributes=require(_0x6095('0x4'));var integrations=require('../../components/integrations/configuration');module[_0x6095('0x5')]=function(_0x4be339,_0x36379c){return _0x4be339[_0x6095('0x6')](_0x6095('0x7'),attributes,{'tableName':_0x6095('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa5ea=['./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','int_vtiger_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xa655c8,_0x41ceeb){var _0xe71147=function(_0x5d47c4){while(--_0x5d47c4){_0xa655c8['push'](_0xa655c8['shift']());}};_0xe71147(++_0x41ceeb);}(_0xa5ea,0x155));var _0xaa5e=function(_0x32d869,_0x5df67c){_0x32d869=_0x32d869-0x0;var _0x349635=_0xa5ea[_0x32d869];return _0x349635;};'use strict';var _=require(_0xaa5e('0x0'));var util=require(_0xaa5e('0x1'));var logger=require('../../config/logger')(_0xaa5e('0x2'));var moment=require(_0xaa5e('0x3'));var BPromise=require(_0xaa5e('0x4'));var rp=require(_0xaa5e('0x5'));var fs=require('fs');var path=require(_0xaa5e('0x6'));var rimraf=require(_0xaa5e('0x7'));var config=require(_0xaa5e('0x8'));var attributes=require(_0xaa5e('0x9'));var integrations=require(_0xaa5e('0xa'));module[_0xaa5e('0xb')]=function(_0x50864d,_0x50ce77){return _0x50864d[_0xaa5e('0xc')]('VtigerAccount',attributes,{'tableName':_0xaa5e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index cbcf652..9263c0e 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 _0xe5b5=['GetVtigerAccount','VtigerAccount','options','where','attributes','include','map','model','debug','ShowVtigerAccount','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','VtigerAccount,\x20%s,\x20%s','message','result','catch'];(function(_0x5426d0,_0x4a4f10){var _0x37be89=function(_0x1fc9e1){while(--_0x1fc9e1){_0x5426d0['push'](_0x5426d0['shift']());}};_0x37be89(++_0x4a4f10);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xe5b5[_0x4b2863];return _0x567d67;};'use strict';var _=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var moment=require(_0x5e5b('0x2'));var BPromise=require(_0x5e5b('0x3'));var rs=require(_0x5e5b('0x4'));var fs=require('fs');var Redis=require(_0x5e5b('0x5'));var db=require(_0x5e5b('0x6'))['db'];var utils=require(_0x5e5b('0x7'));var logger=require(_0x5e5b('0x8'))(_0x5e5b('0x9'));var config=require(_0x5e5b('0xa'));var jayson=require(_0x5e5b('0xb'));var client=jayson[_0x5e5b('0xc')][_0x5e5b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x545eb3,_0x29db2c,_0xe089b1){return new BPromise(function(_0xcbd478,_0x258414){return client[_0x5e5b('0xe')](_0x545eb3,_0xe089b1)[_0x5e5b('0xf')](function(_0x3a37db){logger[_0x5e5b('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x29db2c,_0x5e5b('0x11'));logger['debug'](_0x5e5b('0x12'),_0x29db2c,_0x5e5b('0x11'),JSON[_0x5e5b('0x13')](_0x3a37db));if(_0x3a37db[_0x5e5b('0x14')]){if(_0x3a37db['error']['code']===0x1f4){logger['error'](_0x5e5b('0x15'),_0x29db2c,_0x3a37db[_0x5e5b('0x14')][_0x5e5b('0x16')]);return _0x258414(_0x3a37db[_0x5e5b('0x14')][_0x5e5b('0x16')]);}logger[_0x5e5b('0x14')](_0x5e5b('0x15'),_0x29db2c,_0x3a37db['error'][_0x5e5b('0x16')]);return _0xcbd478(_0x3a37db[_0x5e5b('0x14')]['message']);}else{logger[_0x5e5b('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x29db2c,'request\x20sent');_0xcbd478(_0x3a37db[_0x5e5b('0x17')][_0x5e5b('0x16')]);}})[_0x5e5b('0x18')](function(_0x5c7148){logger[_0x5e5b('0x14')]('VtigerAccount,\x20%s,\x20%s',_0x29db2c,_0x5c7148);_0x258414(_0x5c7148);});});}exports[_0x5e5b('0x19')]=function(_0x45a091){var _0x4c5f9a=this;return new Promise(function(_0xe5aa6b,_0x1560e1){return db[_0x5e5b('0x1a')]['findAll']({'raw':_0x45a091[_0x5e5b('0x1b')]?_0x45a091[_0x5e5b('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x45a091[_0x5e5b('0x1b')]?_0x45a091[_0x5e5b('0x1b')][_0x5e5b('0x1c')]||null:null,'attributes':_0x45a091[_0x5e5b('0x1b')]?_0x45a091[_0x5e5b('0x1b')][_0x5e5b('0x1d')]||null:null,'limit':_0x45a091[_0x5e5b('0x1b')]?_0x45a091[_0x5e5b('0x1b')]['limit']||null:null,'include':_0x45a091['options']?_0x45a091[_0x5e5b('0x1b')][_0x5e5b('0x1e')]?_[_0x5e5b('0x1f')](_0x45a091[_0x5e5b('0x1b')][_0x5e5b('0x1e')],function(_0x28cd95){return{'model':db[_0x28cd95[_0x5e5b('0x20')]],'as':_0x28cd95['as'],'attributes':_0x28cd95[_0x5e5b('0x1d')],'include':_0x28cd95[_0x5e5b('0x1e')]?_[_0x5e5b('0x1f')](_0x28cd95[_0x5e5b('0x1e')],function(_0x4da321){return{'model':db[_0x4da321[_0x5e5b('0x20')]],'as':_0x4da321['as'],'attributes':_0x4da321[_0x5e5b('0x1d')],'include':_0x4da321[_0x5e5b('0x1e')]?_['map'](_0x4da321[_0x5e5b('0x1e')],function(_0xdb2863){return{'model':db[_0xdb2863['model']],'as':_0xdb2863['as'],'attributes':_0xdb2863[_0x5e5b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5e5b('0xf')](function(_0x39ce16){logger[_0x5e5b('0x10')](_0x5e5b('0x19'),_0x45a091);logger[_0x5e5b('0x21')](_0x5e5b('0x19'),_0x45a091,JSON[_0x5e5b('0x13')](_0x39ce16));_0xe5aa6b(_0x39ce16);})[_0x5e5b('0x18')](function(_0x42da3b){logger[_0x5e5b('0x14')](_0x5e5b('0x19'),_0x42da3b['message'],_0x45a091);_0x1560e1(_0x4c5f9a['error'](0x1f4,_0x42da3b[_0x5e5b('0x16')]));});});};exports[_0x5e5b('0x22')]=function(_0xb68419){var _0x3dcdab=this;return new Promise(function(_0x12f1ee,_0x4b9be8){return db[_0x5e5b('0x1a')]['find']({'raw':_0xb68419[_0x5e5b('0x1b')]?_0xb68419[_0x5e5b('0x1b')][_0x5e5b('0x23')]===undefined?!![]:![]:!![],'where':_0xb68419[_0x5e5b('0x1b')]?_0xb68419['options'][_0x5e5b('0x1c')]||null:null,'attributes':_0xb68419[_0x5e5b('0x1b')]?_0xb68419['options'][_0x5e5b('0x1d')]||null:null,'include':_0xb68419[_0x5e5b('0x1b')]?_0xb68419[_0x5e5b('0x1b')][_0x5e5b('0x1e')]?_[_0x5e5b('0x1f')](_0xb68419[_0x5e5b('0x1b')][_0x5e5b('0x1e')],function(_0x317451){return{'model':db[_0x317451['model']],'as':_0x317451['as'],'attributes':_0x317451[_0x5e5b('0x1d')],'include':_0x317451[_0x5e5b('0x1e')]?_[_0x5e5b('0x1f')](_0x317451[_0x5e5b('0x1e')],function(_0x7da7a5){return{'model':db[_0x7da7a5[_0x5e5b('0x20')]],'as':_0x7da7a5['as'],'attributes':_0x7da7a5['attributes'],'include':_0x7da7a5['include']?_[_0x5e5b('0x1f')](_0x7da7a5[_0x5e5b('0x1e')],function(_0x8ec651){return{'model':db[_0x8ec651['model']],'as':_0x8ec651['as'],'attributes':_0x8ec651[_0x5e5b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5e5b('0xf')](function(_0x18f5ba){logger[_0x5e5b('0x10')]('ShowVtigerAccount',_0xb68419);logger[_0x5e5b('0x21')](_0x5e5b('0x22'),_0xb68419,JSON['stringify'](_0x18f5ba));_0x12f1ee(_0x18f5ba);})['catch'](function(_0xe9c586){logger[_0x5e5b('0x14')](_0x5e5b('0x22'),_0xe9c586['message'],_0xb68419);_0x4b9be8(_0x3dcdab[_0x5e5b('0x14')](0x1f4,_0xe9c586['message']));});});}; \ No newline at end of file +var _0x0abf=['VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','limit','include','map','model','attributes','debug','ShowVtigerAccount','then','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VtigerAccount,\x20%s,\x20%s'];(function(_0x82b210,_0x4f6612){var _0x38715e=function(_0x22d578){while(--_0x22d578){_0x82b210['push'](_0x82b210['shift']());}};_0x38715e(++_0x4f6612);}(_0x0abf,0xe8));var _0xf0ab=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x0abf[_0xbca1b1];return _0x4e1686;};'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')]({'raw':_0x1803f0[_0xf0ab('0x18')]?_0x1803f0[_0xf0ab('0x18')][_0xf0ab('0x19')]===undefined?!![]:![]:!![],'where':_0x1803f0[_0xf0ab('0x18')]?_0x1803f0[_0xf0ab('0x18')][_0xf0ab('0x1a')]||null:null,'attributes':_0x1803f0[_0xf0ab('0x18')]?_0x1803f0[_0xf0ab('0x18')]['attributes']||null:null,'limit':_0x1803f0[_0xf0ab('0x18')]?_0x1803f0[_0xf0ab('0x18')][_0xf0ab('0x1b')]||null:null,'include':_0x1803f0[_0xf0ab('0x18')]?_0x1803f0[_0xf0ab('0x18')][_0xf0ab('0x1c')]?_[_0xf0ab('0x1d')](_0x1803f0[_0xf0ab('0x18')][_0xf0ab('0x1c')],function(_0x18bb37){return{'model':db[_0x18bb37[_0xf0ab('0x1e')]],'as':_0x18bb37['as'],'attributes':_0x18bb37['attributes'],'include':_0x18bb37['include']?_['map'](_0x18bb37[_0xf0ab('0x1c')],function(_0x4f0caf){return{'model':db[_0x4f0caf[_0xf0ab('0x1e')]],'as':_0x4f0caf['as'],'attributes':_0x4f0caf[_0xf0ab('0x1f')],'include':_0x4f0caf['include']?_[_0xf0ab('0x1d')](_0x4f0caf[_0xf0ab('0x1c')],function(_0x10bf5f){return{'model':db[_0x10bf5f[_0xf0ab('0x1e')]],'as':_0x10bf5f['as'],'attributes':_0x10bf5f[_0xf0ab('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d0da7){logger['info']('GetVtigerAccount',_0x1803f0);logger[_0xf0ab('0x20')](_0xf0ab('0x15'),_0x1803f0,JSON[_0xf0ab('0xe')](_0x2d0da7));_0x776619(_0x2d0da7);})[_0xf0ab('0x14')](function(_0x43476c){logger[_0xf0ab('0xf')](_0xf0ab('0x15'),_0x43476c[_0xf0ab('0x11')],_0x1803f0);_0xb9a33(_0x1ffeb5[_0xf0ab('0xf')](0x1f4,_0x43476c[_0xf0ab('0x11')]));});});};exports[_0xf0ab('0x21')]=function(_0x199753){var _0x58cbe1=this;return new Promise(function(_0x1e1ffb,_0x35973a){return db['VtigerAccount']['find']({'raw':_0x199753[_0xf0ab('0x18')]?_0x199753[_0xf0ab('0x18')][_0xf0ab('0x19')]===undefined?!![]:![]:!![],'where':_0x199753['options']?_0x199753['options'][_0xf0ab('0x1a')]||null:null,'attributes':_0x199753['options']?_0x199753[_0xf0ab('0x18')]['attributes']||null:null,'include':_0x199753[_0xf0ab('0x18')]?_0x199753[_0xf0ab('0x18')]['include']?_['map'](_0x199753[_0xf0ab('0x18')][_0xf0ab('0x1c')],function(_0x2a3fac){return{'model':db[_0x2a3fac[_0xf0ab('0x1e')]],'as':_0x2a3fac['as'],'attributes':_0x2a3fac[_0xf0ab('0x1f')],'include':_0x2a3fac[_0xf0ab('0x1c')]?_[_0xf0ab('0x1d')](_0x2a3fac[_0xf0ab('0x1c')],function(_0x2a2f5d){return{'model':db[_0x2a2f5d[_0xf0ab('0x1e')]],'as':_0x2a2f5d['as'],'attributes':_0x2a2f5d[_0xf0ab('0x1f')],'include':_0x2a2f5d[_0xf0ab('0x1c')]?_[_0xf0ab('0x1d')](_0x2a2f5d[_0xf0ab('0x1c')],function(_0x5d8443){return{'model':db[_0x5d8443[_0xf0ab('0x1e')]],'as':_0x5d8443['as'],'attributes':_0x5d8443[_0xf0ab('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf0ab('0x22')](function(_0x5c9192){logger[_0xf0ab('0xb')](_0xf0ab('0x21'),_0x199753);logger[_0xf0ab('0x20')]('ShowVtigerAccount',_0x199753,JSON[_0xf0ab('0xe')](_0x5c9192));_0x1e1ffb(_0x5c9192);})['catch'](function(_0xda3971){logger['error'](_0xf0ab('0x21'),_0xda3971[_0xf0ab('0x11')],_0x199753);_0x35973a(_0x58cbe1[_0xf0ab('0xf')](0x1f4,_0xda3971[_0xf0ab('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 501fc15..27b93f5 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 _0x5cda=['../../config/environment','./intVtigerConfiguration.controller','get','index','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3b91d3,_0x56f013){var _0x4b96d2=function(_0x23aba8){while(--_0x23aba8){_0x3b91d3['push'](_0x3b91d3['shift']());}};_0x4b96d2(++_0x56f013);}(_0x5cda,0x149));var _0xa5cd=function(_0x2ca21c,_0x3e1037){_0x2ca21c=_0x2ca21c-0x0;var _0x3879b0=_0x5cda[_0x2ca21c];return _0x3879b0;};'use strict';var multer=require(_0xa5cd('0x0'));var util=require(_0xa5cd('0x1'));var path=require(_0xa5cd('0x2'));var timeout=require('connect-timeout');var express=require(_0xa5cd('0x3'));var router=express[_0xa5cd('0x4')]();var fs_extra=require(_0xa5cd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa5cd('0x6'));var config=require(_0xa5cd('0x7'));var controller=require(_0xa5cd('0x8'));router[_0xa5cd('0x9')]('/',auth['isAuthenticated'](),controller[_0xa5cd('0xa')]);router[_0xa5cd('0x9')](_0xa5cd('0xb'),auth['isAuthenticated'](),controller[_0xa5cd('0xc')]);router[_0xa5cd('0x9')](_0xa5cd('0xd'),auth[_0xa5cd('0xe')](),controller[_0xa5cd('0xf')]);router[_0xa5cd('0x9')](_0xa5cd('0x10'),auth[_0xa5cd('0xe')](),controller[_0xa5cd('0x11')]);router[_0xa5cd('0x9')]('/:id/descriptions',auth[_0xa5cd('0xe')](),controller[_0xa5cd('0x12')]);router['post']('/',auth[_0xa5cd('0xe')](),controller[_0xa5cd('0x13')]);router[_0xa5cd('0x14')]('/:id',auth[_0xa5cd('0xe')](),controller[_0xa5cd('0x15')]);router['delete'](_0xa5cd('0xb'),auth[_0xa5cd('0xe')](),controller[_0xa5cd('0x16')]);module[_0xa5cd('0x17')]=router; \ No newline at end of file +var _0xf3c8=['create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerConfiguration.controller','isAuthenticated','get','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf3c8,0x79));var _0x8f3c=function(_0x143eb9,_0x289646){_0x143eb9=_0x143eb9-0x0;var _0x372f76=_0xf3c8[_0x143eb9];return _0x372f76;};'use strict';var multer=require('multer');var util=require(_0x8f3c('0x0'));var path=require(_0x8f3c('0x1'));var timeout=require(_0x8f3c('0x2'));var express=require(_0x8f3c('0x3'));var router=express[_0x8f3c('0x4')]();var fs_extra=require(_0x8f3c('0x5'));var auth=require(_0x8f3c('0x6'));var interaction=require(_0x8f3c('0x7'));var config=require('../../config/environment');var controller=require(_0x8f3c('0x8'));router['get']('/',auth[_0x8f3c('0x9')](),controller['index']);router[_0x8f3c('0xa')](_0x8f3c('0xb'),auth[_0x8f3c('0x9')](),controller[_0x8f3c('0xc')]);router[_0x8f3c('0xa')](_0x8f3c('0xd'),auth[_0x8f3c('0x9')](),controller[_0x8f3c('0xe')]);router['get'](_0x8f3c('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x8f3c('0xa')](_0x8f3c('0x10'),auth[_0x8f3c('0x9')](),controller['getDescriptions']);router['post']('/',auth[_0x8f3c('0x9')](),controller[_0x8f3c('0x11')]);router[_0x8f3c('0x12')]('/:id',auth[_0x8f3c('0x9')](),controller[_0x8f3c('0x13')]);router[_0x8f3c('0x14')](_0x8f3c('0xb'),auth[_0x8f3c('0x9')](),controller[_0x8f3c('0x15')]);module[_0x8f3c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 3ce8956..d2fefa2 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 _0x9d39=['exports','STRING'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x9d39,0x1b4));var _0x99d3=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9d39[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require('sequelize');module[_0x99d3('0x0')]={'name':{'type':Sequelize[_0x99d3('0x1')]},'description':{'type':Sequelize[_0x99d3('0x1')]}}; \ No newline at end of file +var _0xf55e=['exports','STRING','sequelize'];(function(_0x54020d,_0x22dd03){var _0x28e7cf=function(_0x3f2db2){while(--_0x3f2db2){_0x54020d['push'](_0x54020d['shift']());}};_0x28e7cf(++_0x22dd03);}(_0xf55e,0x197));var _0xef55=function(_0x3ba67c,_0x326d97){_0x3ba67c=_0x3ba67c-0x0;var _0x4b1581=_0xf55e[_0x3ba67c];return _0x4b1581;};'use strict';var Sequelize=require(_0xef55('0x0'));module[_0xef55('0x1')]={'name':{'type':Sequelize[_0xef55('0x2')]},'description':{'type':Sequelize[_0xef55('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index b821379..e2bd31d 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 _0xe51b=['attributes','intersection','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','destroy','getFields','findOne','VtigerField','order','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','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','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','query','filters','model'];(function(_0x50b45a,_0x47e5ef){var _0xff0f85=function(_0x177fc2){while(--_0x177fc2){_0x50b45a['push'](_0x50b45a['shift']());}};_0xff0f85(++_0x47e5ef);}(_0xe51b,0x177));var _0xbe51=function(_0x71e27f,_0x58d37d){_0x71e27f=_0x71e27f-0x0;var _0x27ccfb=_0xe51b[_0x71e27f];return _0x27ccfb;};'use strict';var emlformat=require(_0xbe51('0x0'));var rimraf=require(_0xbe51('0x1'));var zipdir=require(_0xbe51('0x2'));var jsonpatch=require(_0xbe51('0x3'));var rp=require(_0xbe51('0x4'));var moment=require(_0xbe51('0x5'));var BPromise=require(_0xbe51('0x6'));var Mustache=require(_0xbe51('0x7'));var util=require(_0xbe51('0x8'));var path=require(_0xbe51('0x9'));var sox=require(_0xbe51('0xa'));var csv=require(_0xbe51('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbe51('0xc'));var _=require(_0xbe51('0xd'));var squel=require(_0xbe51('0xe'));var crypto=require(_0xbe51('0xf'));var jsforce=require(_0xbe51('0x10'));var deskjs=require(_0xbe51('0x11'));var toCsv=require(_0xbe51('0xb'));var querystring=require(_0xbe51('0x12'));var Papa=require(_0xbe51('0x13'));var Redis=require(_0xbe51('0x14'));var authService=require(_0xbe51('0x15'));var qs=require(_0xbe51('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe51('0x17'));var logger=require(_0xbe51('0x18'))(_0xbe51('0x19'));var utils=require(_0xbe51('0x1a'));var config=require(_0xbe51('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xbe51('0x1c'))['db'];function respondWithStatusCode(_0x1d0d06,_0x356acd){_0x356acd=_0x356acd||0xcc;return function(_0x5709dc){if(_0x5709dc){return _0x1d0d06[_0xbe51('0x1d')](_0x356acd);}return _0x1d0d06[_0xbe51('0x1e')](_0x356acd)['end']();};}function respondWithResult(_0x285466,_0xebcb41){_0xebcb41=_0xebcb41||0xc8;return function(_0x29c82c){if(_0x29c82c){return _0x285466['status'](_0xebcb41)[_0xbe51('0x1f')](_0x29c82c);}};}function respondWithFilteredResult(_0x45f98a,_0x2f1eb2){return function(_0x498abf){if(_0x498abf){var _0x532571=typeof _0x2f1eb2[_0xbe51('0x20')]===_0xbe51('0x21')&&typeof _0x2f1eb2[_0xbe51('0x22')]===_0xbe51('0x21');var _0x25e651=_0x498abf[_0xbe51('0x23')];var _0x3940c7=_0x532571?0x0:_0x2f1eb2[_0xbe51('0x20')];var _0x2bc8e8=_0x532571?_0x498abf[_0xbe51('0x23')]:_0x2f1eb2[_0xbe51('0x20')]+_0x2f1eb2[_0xbe51('0x22')];var _0x5115ce;if(_0x2bc8e8>=_0x25e651){_0x2bc8e8=_0x25e651;_0x5115ce=0xc8;}else{_0x5115ce=0xce;}_0x45f98a[_0xbe51('0x1e')](_0x5115ce);return _0x45f98a[_0xbe51('0x24')](_0xbe51('0x25'),_0x3940c7+'-'+_0x2bc8e8+'/'+_0x25e651)[_0xbe51('0x1f')](_0x498abf);}return null;};}function patchUpdates(_0x5b2ea8){return function(_0x1da81e){try{jsonpatch[_0xbe51('0x26')](_0x1da81e,_0x5b2ea8,!![]);}catch(_0xc2a617){return BPromise[_0xbe51('0x27')](_0xc2a617);}return _0x1da81e['save']();};}function saveUpdates(_0x12e055,_0x3696b5){return function(_0x2806dd){if(_0x2806dd){return _0x2806dd[_0xbe51('0x28')](_0x12e055)[_0xbe51('0x29')](function(_0x2ce111){return _0x2ce111;});}return null;};}function removeEntity(_0x1210a0,_0x539cdb){return function(_0x10fbc5){if(_0x10fbc5){return _0x10fbc5['destroy']()[_0xbe51('0x29')](function(){_0x1210a0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xdb139e,_0x2edd03){return function(_0x149572){if(!_0x149572){_0xdb139e[_0xbe51('0x1d')](0x194);}return _0x149572;};}function handleError(_0x529a81,_0x16caf3){_0x16caf3=_0x16caf3||0x1f4;return function(_0x2cfaf4){logger[_0xbe51('0x2a')](_0x2cfaf4[_0xbe51('0x2b')]);if(_0x2cfaf4[_0xbe51('0x2c')]){delete _0x2cfaf4[_0xbe51('0x2c')];}_0x529a81[_0xbe51('0x1e')](_0x16caf3)[_0xbe51('0x2d')](_0x2cfaf4);};}exports[_0xbe51('0x2e')]=function(_0x3ad733,_0x2df460){var _0xef5865={},_0x561c84={},_0x12bbf6={'count':0x0,'rows':[]};var _0x88e4cd=_[_0xbe51('0x2f')](db[_0xbe51('0x30')][_0xbe51('0x31')],function(_0x4fe8e2){return{'name':_0x4fe8e2[_0xbe51('0x32')],'type':_0x4fe8e2[_0xbe51('0x33')]['key']};});_0x561c84['model']=_[_0xbe51('0x2f')](_0x88e4cd,_0xbe51('0x2c'));_0x561c84[_0xbe51('0x34')]=_['keys'](_0x3ad733[_0xbe51('0x34')]);_0x561c84[_0xbe51('0x35')]=_['intersection'](_0x561c84[_0xbe51('0x36')],_0x561c84[_0xbe51('0x34')]);_0xef5865[_0xbe51('0x37')]=_[_0xbe51('0x38')](_0x561c84[_0xbe51('0x36')],qs[_0xbe51('0x39')](_0x3ad733[_0xbe51('0x34')][_0xbe51('0x39')]));_0xef5865[_0xbe51('0x37')]=_0xef5865[_0xbe51('0x37')][_0xbe51('0x3a')]?_0xef5865['attributes']:_0x561c84[_0xbe51('0x36')];if(!_0x3ad733[_0xbe51('0x34')]['hasOwnProperty'](_0xbe51('0x3b'))){_0xef5865[_0xbe51('0x22')]=qs['limit'](_0x3ad733[_0xbe51('0x34')][_0xbe51('0x22')]);_0xef5865[_0xbe51('0x20')]=qs[_0xbe51('0x20')](_0x3ad733[_0xbe51('0x34')]['offset']);}_0xef5865['order']=qs[_0xbe51('0x3c')](_0x3ad733[_0xbe51('0x34')][_0xbe51('0x3c')]);_0xef5865[_0xbe51('0x3d')]=qs[_0xbe51('0x35')](_[_0xbe51('0x3e')](_0x3ad733[_0xbe51('0x34')],_0x561c84[_0xbe51('0x35')]),_0x88e4cd);if(_0x3ad733['query'][_0xbe51('0x3f')]){_0xef5865[_0xbe51('0x3d')]=_['merge'](_0xef5865[_0xbe51('0x3d')],{'$or':_[_0xbe51('0x2f')](_0x88e4cd,function(_0x4941fb){if(_0x4941fb[_0xbe51('0x33')]!==_0xbe51('0x40')){var _0x56775f={};_0x56775f[_0x4941fb[_0xbe51('0x2c')]]={'$like':'%'+_0x3ad733[_0xbe51('0x34')]['filter']+'%'};return _0x56775f;}})});}_0xef5865=_[_0xbe51('0x41')]({},_0xef5865,_0x3ad733['options']);var _0x390555={'where':_0xef5865[_0xbe51('0x3d')]};return db[_0xbe51('0x30')][_0xbe51('0x23')](_0x390555)[_0xbe51('0x29')](function(_0x554442){_0x12bbf6[_0xbe51('0x23')]=_0x554442;if(_0x3ad733[_0xbe51('0x34')][_0xbe51('0x42')]){_0xef5865[_0xbe51('0x43')]=[{'all':!![]}];}return db[_0xbe51('0x30')][_0xbe51('0x44')](_0xef5865);})['then'](function(_0x1b523e){_0x12bbf6[_0xbe51('0x45')]=_0x1b523e;return _0x12bbf6;})[_0xbe51('0x29')](respondWithFilteredResult(_0x2df460,_0xef5865))[_0xbe51('0x46')](handleError(_0x2df460,null));};exports[_0xbe51('0x47')]=function(_0x290f8b,_0x20b5e2){var _0x1e2af7={'raw':![],'where':{'id':_0x290f8b[_0xbe51('0x48')]['id']}},_0x51fd22={};_0x51fd22[_0xbe51('0x36')]=_[_0xbe51('0x49')](db['VtigerConfiguration'][_0xbe51('0x31')]);_0x51fd22[_0xbe51('0x34')]=_['keys'](_0x290f8b[_0xbe51('0x34')]);_0x51fd22[_0xbe51('0x35')]=_['intersection'](_0x51fd22['model'],_0x51fd22[_0xbe51('0x34')]);_0x1e2af7[_0xbe51('0x37')]=_[_0xbe51('0x38')](_0x51fd22[_0xbe51('0x36')],qs[_0xbe51('0x39')](_0x290f8b['query'][_0xbe51('0x39')]));_0x1e2af7[_0xbe51('0x37')]=_0x1e2af7[_0xbe51('0x37')][_0xbe51('0x3a')]?_0x1e2af7[_0xbe51('0x37')]:_0x51fd22[_0xbe51('0x36')];if(_0x290f8b['query'][_0xbe51('0x42')]){_0x1e2af7[_0xbe51('0x43')]=[{'all':!![]}];}_0x1e2af7=_['merge']({},_0x1e2af7,_0x290f8b[_0xbe51('0x4a')]);return db[_0xbe51('0x30')][_0xbe51('0x4b')](_0x1e2af7)[_0xbe51('0x29')](handleEntityNotFound(_0x20b5e2,null))[_0xbe51('0x29')](respondWithResult(_0x20b5e2,null))['catch'](handleError(_0x20b5e2,null));};exports[_0xbe51('0x4c')]=function(_0x5f462c,_0x25c382){return db[_0xbe51('0x30')][_0xbe51('0x4c')](_0x5f462c[_0xbe51('0x4d')],{})[_0xbe51('0x29')](respondWithResult(_0x25c382,0xc9))[_0xbe51('0x46')](handleError(_0x25c382,null));};exports['update']=function(_0x2b7ac7,_0x1a6081){if(_0x2b7ac7[_0xbe51('0x4d')]['id']){delete _0x2b7ac7[_0xbe51('0x4d')]['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x2b7ac7[_0xbe51('0x48')]['id']}})[_0xbe51('0x29')](handleEntityNotFound(_0x1a6081,null))['then'](saveUpdates(_0x2b7ac7[_0xbe51('0x4d')],null))[_0xbe51('0x29')](respondWithResult(_0x1a6081,null))[_0xbe51('0x46')](handleError(_0x1a6081,null));};exports[_0xbe51('0x4e')]=function(_0x37d780,_0x1bc7f1){return db[_0xbe51('0x30')][_0xbe51('0x4b')]({'where':{'id':_0x37d780[_0xbe51('0x48')]['id']}})[_0xbe51('0x29')](handleEntityNotFound(_0x1bc7f1,null))[_0xbe51('0x29')](removeEntity(_0x1bc7f1,null))[_0xbe51('0x46')](handleError(_0x1bc7f1,null));};exports[_0xbe51('0x4f')]=function(_0x30493b,_0x209269,_0x18e4aa){var _0x275ebb={};var _0x5bd7ad={};var _0x46e169;var _0x23d810;return db[_0xbe51('0x30')][_0xbe51('0x50')]({'where':{'id':_0x30493b['params']['id']}})[_0xbe51('0x29')](handleEntityNotFound(_0x209269,null))[_0xbe51('0x29')](function(_0x12b5bf){if(_0x12b5bf){_0x46e169=_0x12b5bf;_0x5bd7ad[_0xbe51('0x36')]=_['keys'](db[_0xbe51('0x51')][_0xbe51('0x31')]);_0x5bd7ad[_0xbe51('0x34')]=_['keys'](_0x30493b[_0xbe51('0x34')]);_0x5bd7ad[_0xbe51('0x35')]=_[_0xbe51('0x38')](_0x5bd7ad['model'],_0x5bd7ad[_0xbe51('0x34')]);_0x275ebb[_0xbe51('0x37')]=_['intersection'](_0x5bd7ad[_0xbe51('0x36')],qs[_0xbe51('0x39')](_0x30493b[_0xbe51('0x34')][_0xbe51('0x39')]));_0x275ebb[_0xbe51('0x37')]=_0x275ebb[_0xbe51('0x37')][_0xbe51('0x3a')]?_0x275ebb[_0xbe51('0x37')]:_0x5bd7ad[_0xbe51('0x36')];_0x275ebb[_0xbe51('0x52')]=qs[_0xbe51('0x3c')](_0x30493b[_0xbe51('0x34')][_0xbe51('0x3c')]);_0x275ebb[_0xbe51('0x3d')]=qs[_0xbe51('0x35')](_[_0xbe51('0x3e')](_0x30493b[_0xbe51('0x34')],_0x5bd7ad[_0xbe51('0x35')]));if(_0x30493b[_0xbe51('0x34')][_0xbe51('0x3f')]){_0x275ebb[_0xbe51('0x3d')]=_[_0xbe51('0x41')](_0x275ebb[_0xbe51('0x3d')],{'$or':_['map'](_0x275ebb[_0xbe51('0x37')],function(_0x55322a){var _0x1563da={};_0x1563da[_0x55322a]={'$like':'%'+_0x30493b['query'][_0xbe51('0x3f')]+'%'};return _0x1563da;})});}_0x275ebb=_[_0xbe51('0x41')]({},_0x275ebb,_0x30493b[_0xbe51('0x4a')]);return _0x46e169['getFields'](_0x275ebb);}})[_0xbe51('0x29')](function(_0x1ff8ad){if(_0x1ff8ad){_0x23d810=_0x1ff8ad[_0xbe51('0x3a')];if(!_0x30493b[_0xbe51('0x34')][_0xbe51('0x53')](_0xbe51('0x3b'))){_0x275ebb[_0xbe51('0x22')]=qs[_0xbe51('0x22')](_0x30493b[_0xbe51('0x34')][_0xbe51('0x22')]);_0x275ebb['offset']=qs['offset'](_0x30493b['query']['offset']);}return _0x46e169[_0xbe51('0x4f')](_0x275ebb);}})[_0xbe51('0x29')](function(_0x1b4587){if(_0x1b4587){return _0x1b4587?{'count':_0x23d810,'rows':_0x1b4587}:null;}})[_0xbe51('0x29')](respondWithResult(_0x209269,null))[_0xbe51('0x46')](handleError(_0x209269,null));};exports[_0xbe51('0x54')]=function(_0xb819c0,_0x3215de,_0x18b7d6){var _0x25b357={};var _0x1a1d46={};var _0x2cbf26;var _0x1a7d63;return db[_0xbe51('0x30')]['findOne']({'where':{'id':_0xb819c0[_0xbe51('0x48')]['id']}})[_0xbe51('0x29')](handleEntityNotFound(_0x3215de,null))[_0xbe51('0x29')](function(_0x5f18ef){if(_0x5f18ef){_0x2cbf26=_0x5f18ef;_0x1a1d46[_0xbe51('0x36')]=_[_0xbe51('0x49')](db[_0xbe51('0x51')][_0xbe51('0x31')]);_0x1a1d46[_0xbe51('0x34')]=_[_0xbe51('0x49')](_0xb819c0[_0xbe51('0x34')]);_0x1a1d46[_0xbe51('0x35')]=_[_0xbe51('0x38')](_0x1a1d46[_0xbe51('0x36')],_0x1a1d46[_0xbe51('0x34')]);_0x25b357[_0xbe51('0x37')]=_['intersection'](_0x1a1d46[_0xbe51('0x36')],qs[_0xbe51('0x39')](_0xb819c0['query'][_0xbe51('0x39')]));_0x25b357[_0xbe51('0x37')]=_0x25b357['attributes'][_0xbe51('0x3a')]?_0x25b357[_0xbe51('0x37')]:_0x1a1d46[_0xbe51('0x36')];_0x25b357[_0xbe51('0x52')]=qs[_0xbe51('0x3c')](_0xb819c0[_0xbe51('0x34')][_0xbe51('0x3c')]);_0x25b357[_0xbe51('0x3d')]=qs[_0xbe51('0x35')](_['pick'](_0xb819c0['query'],_0x1a1d46['filters']));if(_0xb819c0[_0xbe51('0x34')][_0xbe51('0x3f')]){_0x25b357['where']=_[_0xbe51('0x41')](_0x25b357['where'],{'$or':_[_0xbe51('0x2f')](_0x25b357['attributes'],function(_0x430f24){var _0x2f28a6={};_0x2f28a6[_0x430f24]={'$like':'%'+_0xb819c0[_0xbe51('0x34')]['filter']+'%'};return _0x2f28a6;})});}_0x25b357=_[_0xbe51('0x41')]({},_0x25b357,_0xb819c0['options']);return _0x2cbf26[_0xbe51('0x54')](_0x25b357);}})[_0xbe51('0x29')](function(_0x4763d8){if(_0x4763d8){_0x1a7d63=_0x4763d8[_0xbe51('0x3a')];if(!_0xb819c0[_0xbe51('0x34')][_0xbe51('0x53')](_0xbe51('0x3b'))){_0x25b357['limit']=qs[_0xbe51('0x22')](_0xb819c0[_0xbe51('0x34')]['limit']);_0x25b357['offset']=qs[_0xbe51('0x20')](_0xb819c0[_0xbe51('0x34')]['offset']);}return _0x2cbf26['getSubjects'](_0x25b357);}})[_0xbe51('0x29')](function(_0x17df01){if(_0x17df01){return _0x17df01?{'count':_0x1a7d63,'rows':_0x17df01}:null;}})[_0xbe51('0x29')](respondWithResult(_0x3215de,null))[_0xbe51('0x46')](handleError(_0x3215de,null));};exports['getDescriptions']=function(_0x29647d,_0x1351dd,_0x1b2598){var _0x845a6a={};var _0x141c53={};var _0x4f8634;var _0x4f6433;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x29647d['params']['id']}})[_0xbe51('0x29')](handleEntityNotFound(_0x1351dd,null))[_0xbe51('0x29')](function(_0x20d21d){if(_0x20d21d){_0x4f8634=_0x20d21d;_0x141c53[_0xbe51('0x36')]=_[_0xbe51('0x49')](db[_0xbe51('0x51')][_0xbe51('0x31')]);_0x141c53[_0xbe51('0x34')]=_[_0xbe51('0x49')](_0x29647d[_0xbe51('0x34')]);_0x141c53[_0xbe51('0x35')]=_[_0xbe51('0x38')](_0x141c53[_0xbe51('0x36')],_0x141c53['query']);_0x845a6a[_0xbe51('0x37')]=_[_0xbe51('0x38')](_0x141c53[_0xbe51('0x36')],qs[_0xbe51('0x39')](_0x29647d[_0xbe51('0x34')][_0xbe51('0x39')]));_0x845a6a['attributes']=_0x845a6a[_0xbe51('0x37')][_0xbe51('0x3a')]?_0x845a6a['attributes']:_0x141c53[_0xbe51('0x36')];_0x845a6a[_0xbe51('0x52')]=qs['sort'](_0x29647d[_0xbe51('0x34')][_0xbe51('0x3c')]);_0x845a6a[_0xbe51('0x3d')]=qs[_0xbe51('0x35')](_['pick'](_0x29647d['query'],_0x141c53[_0xbe51('0x35')]));if(_0x29647d[_0xbe51('0x34')][_0xbe51('0x3f')]){_0x845a6a[_0xbe51('0x3d')]=_[_0xbe51('0x41')](_0x845a6a[_0xbe51('0x3d')],{'$or':_[_0xbe51('0x2f')](_0x845a6a[_0xbe51('0x37')],function(_0x5ddcce){var _0xc23ec2={};_0xc23ec2[_0x5ddcce]={'$like':'%'+_0x29647d[_0xbe51('0x34')]['filter']+'%'};return _0xc23ec2;})});}_0x845a6a=_['merge']({},_0x845a6a,_0x29647d[_0xbe51('0x4a')]);return _0x4f8634[_0xbe51('0x55')](_0x845a6a);}})[_0xbe51('0x29')](function(_0x29ee24){if(_0x29ee24){_0x4f6433=_0x29ee24['length'];if(!_0x29647d[_0xbe51('0x34')][_0xbe51('0x53')](_0xbe51('0x3b'))){_0x845a6a[_0xbe51('0x22')]=qs[_0xbe51('0x22')](_0x29647d[_0xbe51('0x34')]['limit']);_0x845a6a[_0xbe51('0x20')]=qs[_0xbe51('0x20')](_0x29647d[_0xbe51('0x34')][_0xbe51('0x20')]);}return _0x4f8634[_0xbe51('0x55')](_0x845a6a);}})[_0xbe51('0x29')](function(_0xd40a61){if(_0xd40a61){return _0xd40a61?{'count':_0x4f6433,'rows':_0xd40a61}:null;}})[_0xbe51('0x29')](respondWithResult(_0x1351dd,null))[_0xbe51('0x46')](handleError(_0x1351dd,null));}; \ No newline at end of file +var _0xffde=['Content-Range','json','apply','save','update','then','destroy','error','stack','name','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','show','include','find','catch','create','body','params','getFields','findOne','length','sort','pick','nolimit','getSubjects','getDescriptions','eml-format','rimraf','request-promise','moment','bluebird','util','path','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set'];(function(_0x5b38b8,_0x308102){var _0x395533=function(_0x520958){while(--_0x520958){_0x5b38b8['push'](_0x5b38b8['shift']());}};_0x395533(++_0x308102);}(_0xffde,0x7f));var _0xeffd=function(_0x348e1e,_0x7971e5){_0x348e1e=_0x348e1e-0x0;var _0x51417e=_0xffde[_0x348e1e];return _0x51417e;};'use strict';var emlformat=require(_0xeffd('0x0'));var rimraf=require(_0xeffd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xeffd('0x2'));var moment=require(_0xeffd('0x3'));var BPromise=require(_0xeffd('0x4'));var Mustache=require('mustache');var util=require(_0xeffd('0x5'));var path=require(_0xeffd('0x6'));var sox=require('sox');var csv=require(_0xeffd('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xeffd('0x8'));var jsforce=require(_0xeffd('0x9'));var deskjs=require(_0xeffd('0xa'));var toCsv=require(_0xeffd('0x7'));var querystring=require(_0xeffd('0xb'));var Papa=require(_0xeffd('0xc'));var Redis=require(_0xeffd('0xd'));var authService=require(_0xeffd('0xe'));var qs=require(_0xeffd('0xf'));var as=require(_0xeffd('0x10'));var hardwareService=require(_0xeffd('0x11'));var logger=require(_0xeffd('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xeffd('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xeffd('0x14'))['db'];function respondWithStatusCode(_0x5dac54,_0x3d4295){_0x3d4295=_0x3d4295||0xcc;return function(_0x3aa72c){if(_0x3aa72c){return _0x5dac54[_0xeffd('0x15')](_0x3d4295);}return _0x5dac54[_0xeffd('0x16')](_0x3d4295)[_0xeffd('0x17')]();};}function respondWithResult(_0x39c2ab,_0x15244d){_0x15244d=_0x15244d||0xc8;return function(_0x13775e){if(_0x13775e){return _0x39c2ab[_0xeffd('0x16')](_0x15244d)['json'](_0x13775e);}};}function respondWithFilteredResult(_0x2c3f40,_0x119791){return function(_0x4d8521){if(_0x4d8521){var _0x4e12e6=typeof _0x119791[_0xeffd('0x18')]===_0xeffd('0x19')&&typeof _0x119791[_0xeffd('0x1a')]===_0xeffd('0x19');var _0x515984=_0x4d8521[_0xeffd('0x1b')];var _0x47eb65=_0x4e12e6?0x0:_0x119791[_0xeffd('0x18')];var _0xee608b=_0x4e12e6?_0x4d8521['count']:_0x119791[_0xeffd('0x18')]+_0x119791[_0xeffd('0x1a')];var _0x4440ed;if(_0xee608b>=_0x515984){_0xee608b=_0x515984;_0x4440ed=0xc8;}else{_0x4440ed=0xce;}_0x2c3f40[_0xeffd('0x16')](_0x4440ed);return _0x2c3f40[_0xeffd('0x1c')](_0xeffd('0x1d'),_0x47eb65+'-'+_0xee608b+'/'+_0x515984)[_0xeffd('0x1e')](_0x4d8521);}return null;};}function patchUpdates(_0x1c1150){return function(_0x38df05){try{jsonpatch[_0xeffd('0x1f')](_0x38df05,_0x1c1150,!![]);}catch(_0x5e89f6){return BPromise['reject'](_0x5e89f6);}return _0x38df05[_0xeffd('0x20')]();};}function saveUpdates(_0x59b894,_0x41bcff){return function(_0x2c2f5d){if(_0x2c2f5d){return _0x2c2f5d[_0xeffd('0x21')](_0x59b894)[_0xeffd('0x22')](function(_0x230634){return _0x230634;});}return null;};}function removeEntity(_0x563e1e,_0x7e138d){return function(_0x2e1d7b){if(_0x2e1d7b){return _0x2e1d7b[_0xeffd('0x23')]()[_0xeffd('0x22')](function(){_0x563e1e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2df7d3,_0x1cca20){return function(_0x596021){if(!_0x596021){_0x2df7d3['sendStatus'](0x194);}return _0x596021;};}function handleError(_0x5d99c3,_0x127f72){_0x127f72=_0x127f72||0x1f4;return function(_0x47973a){logger[_0xeffd('0x24')](_0x47973a[_0xeffd('0x25')]);if(_0x47973a[_0xeffd('0x26')]){delete _0x47973a[_0xeffd('0x26')];}_0x5d99c3[_0xeffd('0x16')](_0x127f72)['send'](_0x47973a);};}exports[_0xeffd('0x27')]=function(_0x2305fe,_0x228ec5){var _0x5c5a28={},_0x9f1527={},_0x4219f0={'count':0x0,'rows':[]};var _0x467813=_[_0xeffd('0x28')](db[_0xeffd('0x29')][_0xeffd('0x2a')],function(_0x417b4b){return{'name':_0x417b4b[_0xeffd('0x2b')],'type':_0x417b4b[_0xeffd('0x2c')][_0xeffd('0x2d')]};});_0x9f1527[_0xeffd('0x2e')]=_['map'](_0x467813,_0xeffd('0x26'));_0x9f1527[_0xeffd('0x2f')]=_[_0xeffd('0x30')](_0x2305fe['query']);_0x9f1527['filters']=_[_0xeffd('0x31')](_0x9f1527[_0xeffd('0x2e')],_0x9f1527[_0xeffd('0x2f')]);_0x5c5a28[_0xeffd('0x32')]=_[_0xeffd('0x31')](_0x9f1527[_0xeffd('0x2e')],qs[_0xeffd('0x33')](_0x2305fe[_0xeffd('0x2f')][_0xeffd('0x33')]));_0x5c5a28[_0xeffd('0x32')]=_0x5c5a28[_0xeffd('0x32')]['length']?_0x5c5a28[_0xeffd('0x32')]:_0x9f1527[_0xeffd('0x2e')];if(!_0x2305fe[_0xeffd('0x2f')][_0xeffd('0x34')]('nolimit')){_0x5c5a28[_0xeffd('0x1a')]=qs[_0xeffd('0x1a')](_0x2305fe[_0xeffd('0x2f')][_0xeffd('0x1a')]);_0x5c5a28['offset']=qs[_0xeffd('0x18')](_0x2305fe[_0xeffd('0x2f')][_0xeffd('0x18')]);}_0x5c5a28[_0xeffd('0x35')]=qs['sort'](_0x2305fe['query']['sort']);_0x5c5a28['where']=qs[_0xeffd('0x36')](_['pick'](_0x2305fe[_0xeffd('0x2f')],_0x9f1527[_0xeffd('0x36')]),_0x467813);if(_0x2305fe['query'][_0xeffd('0x37')]){_0x5c5a28[_0xeffd('0x38')]=_['merge'](_0x5c5a28['where'],{'$or':_[_0xeffd('0x28')](_0x467813,function(_0x2cf792){if(_0x2cf792['type']!==_0xeffd('0x39')){var _0x1d940c={};_0x1d940c[_0x2cf792[_0xeffd('0x26')]]={'$like':'%'+_0x2305fe['query'][_0xeffd('0x37')]+'%'};return _0x1d940c;}})});}_0x5c5a28=_[_0xeffd('0x3a')]({},_0x5c5a28,_0x2305fe[_0xeffd('0x3b')]);var _0x39cf91={'where':_0x5c5a28[_0xeffd('0x38')]};return db['VtigerConfiguration']['count'](_0x39cf91)['then'](function(_0x45209a){_0x4219f0['count']=_0x45209a;if(_0x2305fe['query'][_0xeffd('0x3c')]){_0x5c5a28['include']=[{'all':!![]}];}return db[_0xeffd('0x29')][_0xeffd('0x3d')](_0x5c5a28);})[_0xeffd('0x22')](function(_0x162efc){_0x4219f0[_0xeffd('0x3e')]=_0x162efc;return _0x4219f0;})[_0xeffd('0x22')](respondWithFilteredResult(_0x228ec5,_0x5c5a28))['catch'](handleError(_0x228ec5,null));};exports[_0xeffd('0x3f')]=function(_0x1ce3e3,_0x413894){var _0x2132c3={'raw':![],'where':{'id':_0x1ce3e3['params']['id']}},_0x316cc3={};_0x316cc3[_0xeffd('0x2e')]=_[_0xeffd('0x30')](db[_0xeffd('0x29')]['rawAttributes']);_0x316cc3[_0xeffd('0x2f')]=_[_0xeffd('0x30')](_0x1ce3e3[_0xeffd('0x2f')]);_0x316cc3[_0xeffd('0x36')]=_['intersection'](_0x316cc3[_0xeffd('0x2e')],_0x316cc3['query']);_0x2132c3[_0xeffd('0x32')]=_[_0xeffd('0x31')](_0x316cc3[_0xeffd('0x2e')],qs[_0xeffd('0x33')](_0x1ce3e3[_0xeffd('0x2f')]['fields']));_0x2132c3[_0xeffd('0x32')]=_0x2132c3[_0xeffd('0x32')]['length']?_0x2132c3[_0xeffd('0x32')]:_0x316cc3['model'];if(_0x1ce3e3[_0xeffd('0x2f')][_0xeffd('0x3c')]){_0x2132c3[_0xeffd('0x40')]=[{'all':!![]}];}_0x2132c3=_[_0xeffd('0x3a')]({},_0x2132c3,_0x1ce3e3[_0xeffd('0x3b')]);return db[_0xeffd('0x29')][_0xeffd('0x41')](_0x2132c3)[_0xeffd('0x22')](handleEntityNotFound(_0x413894,null))[_0xeffd('0x22')](respondWithResult(_0x413894,null))[_0xeffd('0x42')](handleError(_0x413894,null));};exports[_0xeffd('0x43')]=function(_0x306f94,_0x3645eb){return db[_0xeffd('0x29')][_0xeffd('0x43')](_0x306f94[_0xeffd('0x44')],{})[_0xeffd('0x22')](respondWithResult(_0x3645eb,0xc9))['catch'](handleError(_0x3645eb,null));};exports[_0xeffd('0x21')]=function(_0x1355d0,_0x2b61e7){if(_0x1355d0[_0xeffd('0x44')]['id']){delete _0x1355d0[_0xeffd('0x44')]['id'];}return db['VtigerConfiguration'][_0xeffd('0x41')]({'where':{'id':_0x1355d0[_0xeffd('0x45')]['id']}})[_0xeffd('0x22')](handleEntityNotFound(_0x2b61e7,null))[_0xeffd('0x22')](saveUpdates(_0x1355d0[_0xeffd('0x44')],null))[_0xeffd('0x22')](respondWithResult(_0x2b61e7,null))['catch'](handleError(_0x2b61e7,null));};exports['destroy']=function(_0x3e542d,_0x5a0428){return db[_0xeffd('0x29')][_0xeffd('0x41')]({'where':{'id':_0x3e542d['params']['id']}})[_0xeffd('0x22')](handleEntityNotFound(_0x5a0428,null))['then'](removeEntity(_0x5a0428,null))[_0xeffd('0x42')](handleError(_0x5a0428,null));};exports[_0xeffd('0x46')]=function(_0x3bedcb,_0x555412,_0x4d43f1){var _0x124fb2={};var _0x522cbd={};var _0x3c2e3a;var _0x2dc7a5;return db[_0xeffd('0x29')][_0xeffd('0x47')]({'where':{'id':_0x3bedcb[_0xeffd('0x45')]['id']}})[_0xeffd('0x22')](handleEntityNotFound(_0x555412,null))[_0xeffd('0x22')](function(_0x4071b7){if(_0x4071b7){_0x3c2e3a=_0x4071b7;_0x522cbd['model']=_[_0xeffd('0x30')](db['VtigerField'][_0xeffd('0x2a')]);_0x522cbd['query']=_[_0xeffd('0x30')](_0x3bedcb[_0xeffd('0x2f')]);_0x522cbd[_0xeffd('0x36')]=_[_0xeffd('0x31')](_0x522cbd[_0xeffd('0x2e')],_0x522cbd['query']);_0x124fb2[_0xeffd('0x32')]=_[_0xeffd('0x31')](_0x522cbd[_0xeffd('0x2e')],qs[_0xeffd('0x33')](_0x3bedcb[_0xeffd('0x2f')][_0xeffd('0x33')]));_0x124fb2[_0xeffd('0x32')]=_0x124fb2['attributes'][_0xeffd('0x48')]?_0x124fb2[_0xeffd('0x32')]:_0x522cbd[_0xeffd('0x2e')];_0x124fb2['order']=qs[_0xeffd('0x49')](_0x3bedcb['query'][_0xeffd('0x49')]);_0x124fb2['where']=qs[_0xeffd('0x36')](_[_0xeffd('0x4a')](_0x3bedcb[_0xeffd('0x2f')],_0x522cbd[_0xeffd('0x36')]));if(_0x3bedcb[_0xeffd('0x2f')][_0xeffd('0x37')]){_0x124fb2['where']=_[_0xeffd('0x3a')](_0x124fb2['where'],{'$or':_['map'](_0x124fb2[_0xeffd('0x32')],function(_0x5d12b1){var _0x3fd2de={};_0x3fd2de[_0x5d12b1]={'$like':'%'+_0x3bedcb[_0xeffd('0x2f')][_0xeffd('0x37')]+'%'};return _0x3fd2de;})});}_0x124fb2=_[_0xeffd('0x3a')]({},_0x124fb2,_0x3bedcb[_0xeffd('0x3b')]);return _0x3c2e3a[_0xeffd('0x46')](_0x124fb2);}})[_0xeffd('0x22')](function(_0x4f1008){if(_0x4f1008){_0x2dc7a5=_0x4f1008[_0xeffd('0x48')];if(!_0x3bedcb[_0xeffd('0x2f')][_0xeffd('0x34')](_0xeffd('0x4b'))){_0x124fb2[_0xeffd('0x1a')]=qs[_0xeffd('0x1a')](_0x3bedcb['query'][_0xeffd('0x1a')]);_0x124fb2[_0xeffd('0x18')]=qs[_0xeffd('0x18')](_0x3bedcb[_0xeffd('0x2f')][_0xeffd('0x18')]);}return _0x3c2e3a['getFields'](_0x124fb2);}})['then'](function(_0x205ed1){if(_0x205ed1){return _0x205ed1?{'count':_0x2dc7a5,'rows':_0x205ed1}:null;}})[_0xeffd('0x22')](respondWithResult(_0x555412,null))[_0xeffd('0x42')](handleError(_0x555412,null));};exports[_0xeffd('0x4c')]=function(_0x209740,_0x4bb72a,_0x372d6a){var _0x4822fa={};var _0x17e717={};var _0xf376c;var _0x536633;return db[_0xeffd('0x29')][_0xeffd('0x47')]({'where':{'id':_0x209740[_0xeffd('0x45')]['id']}})[_0xeffd('0x22')](handleEntityNotFound(_0x4bb72a,null))[_0xeffd('0x22')](function(_0x4c07ef){if(_0x4c07ef){_0xf376c=_0x4c07ef;_0x17e717[_0xeffd('0x2e')]=_['keys'](db['VtigerField'][_0xeffd('0x2a')]);_0x17e717[_0xeffd('0x2f')]=_['keys'](_0x209740[_0xeffd('0x2f')]);_0x17e717['filters']=_[_0xeffd('0x31')](_0x17e717[_0xeffd('0x2e')],_0x17e717[_0xeffd('0x2f')]);_0x4822fa[_0xeffd('0x32')]=_['intersection'](_0x17e717[_0xeffd('0x2e')],qs[_0xeffd('0x33')](_0x209740[_0xeffd('0x2f')]['fields']));_0x4822fa['attributes']=_0x4822fa[_0xeffd('0x32')]['length']?_0x4822fa[_0xeffd('0x32')]:_0x17e717['model'];_0x4822fa[_0xeffd('0x35')]=qs[_0xeffd('0x49')](_0x209740[_0xeffd('0x2f')]['sort']);_0x4822fa[_0xeffd('0x38')]=qs[_0xeffd('0x36')](_['pick'](_0x209740[_0xeffd('0x2f')],_0x17e717[_0xeffd('0x36')]));if(_0x209740[_0xeffd('0x2f')][_0xeffd('0x37')]){_0x4822fa['where']=_[_0xeffd('0x3a')](_0x4822fa[_0xeffd('0x38')],{'$or':_['map'](_0x4822fa['attributes'],function(_0x2d3788){var _0x88d861={};_0x88d861[_0x2d3788]={'$like':'%'+_0x209740[_0xeffd('0x2f')][_0xeffd('0x37')]+'%'};return _0x88d861;})});}_0x4822fa=_[_0xeffd('0x3a')]({},_0x4822fa,_0x209740['options']);return _0xf376c[_0xeffd('0x4c')](_0x4822fa);}})['then'](function(_0x24c3f5){if(_0x24c3f5){_0x536633=_0x24c3f5['length'];if(!_0x209740[_0xeffd('0x2f')][_0xeffd('0x34')](_0xeffd('0x4b'))){_0x4822fa[_0xeffd('0x1a')]=qs[_0xeffd('0x1a')](_0x209740[_0xeffd('0x2f')]['limit']);_0x4822fa[_0xeffd('0x18')]=qs['offset'](_0x209740['query']['offset']);}return _0xf376c['getSubjects'](_0x4822fa);}})['then'](function(_0xbc6fc1){if(_0xbc6fc1){return _0xbc6fc1?{'count':_0x536633,'rows':_0xbc6fc1}:null;}})[_0xeffd('0x22')](respondWithResult(_0x4bb72a,null))['catch'](handleError(_0x4bb72a,null));};exports['getDescriptions']=function(_0x42924b,_0xe2550b,_0x48ed61){var _0x803067={};var _0xede541={};var _0x1d2480;var _0x26a71f;return db[_0xeffd('0x29')]['findOne']({'where':{'id':_0x42924b[_0xeffd('0x45')]['id']}})[_0xeffd('0x22')](handleEntityNotFound(_0xe2550b,null))[_0xeffd('0x22')](function(_0x259591){if(_0x259591){_0x1d2480=_0x259591;_0xede541['model']=_[_0xeffd('0x30')](db['VtigerField'][_0xeffd('0x2a')]);_0xede541[_0xeffd('0x2f')]=_[_0xeffd('0x30')](_0x42924b['query']);_0xede541[_0xeffd('0x36')]=_[_0xeffd('0x31')](_0xede541['model'],_0xede541['query']);_0x803067[_0xeffd('0x32')]=_[_0xeffd('0x31')](_0xede541[_0xeffd('0x2e')],qs[_0xeffd('0x33')](_0x42924b[_0xeffd('0x2f')][_0xeffd('0x33')]));_0x803067['attributes']=_0x803067[_0xeffd('0x32')]['length']?_0x803067[_0xeffd('0x32')]:_0xede541[_0xeffd('0x2e')];_0x803067[_0xeffd('0x35')]=qs['sort'](_0x42924b['query']['sort']);_0x803067['where']=qs[_0xeffd('0x36')](_[_0xeffd('0x4a')](_0x42924b['query'],_0xede541[_0xeffd('0x36')]));if(_0x42924b['query'][_0xeffd('0x37')]){_0x803067[_0xeffd('0x38')]=_[_0xeffd('0x3a')](_0x803067['where'],{'$or':_[_0xeffd('0x28')](_0x803067[_0xeffd('0x32')],function(_0x42d702){var _0x1509f3={};_0x1509f3[_0x42d702]={'$like':'%'+_0x42924b[_0xeffd('0x2f')]['filter']+'%'};return _0x1509f3;})});}_0x803067=_['merge']({},_0x803067,_0x42924b[_0xeffd('0x3b')]);return _0x1d2480[_0xeffd('0x4d')](_0x803067);}})[_0xeffd('0x22')](function(_0x174c4c){if(_0x174c4c){_0x26a71f=_0x174c4c[_0xeffd('0x48')];if(!_0x42924b[_0xeffd('0x2f')][_0xeffd('0x34')](_0xeffd('0x4b'))){_0x803067[_0xeffd('0x1a')]=qs[_0xeffd('0x1a')](_0x42924b[_0xeffd('0x2f')]['limit']);_0x803067[_0xeffd('0x18')]=qs[_0xeffd('0x18')](_0x42924b[_0xeffd('0x2f')][_0xeffd('0x18')]);}return _0x1d2480[_0xeffd('0x4d')](_0x803067);}})[_0xeffd('0x22')](function(_0x3955c2){if(_0x3955c2){return _0x3955c2?{'count':_0x26a71f,'rows':_0x3955c2}:null;}})[_0xeffd('0x22')](respondWithResult(_0xe2550b,null))[_0xeffd('0x42')](handleError(_0xe2550b,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index dc81dec..3844b88 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 _0x6f63=['path','../../config/environment','./intVtigerConfiguration.attributes','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x6f63,0x7d));var _0x36f6=function(_0x251f08,_0x1e09e5){_0x251f08=_0x251f08-0x0;var _0x1771e8=_0x6f63[_0x251f08];return _0x1771e8;};'use strict';var _=require(_0x36f6('0x0'));var util=require(_0x36f6('0x1'));var logger=require(_0x36f6('0x2'))(_0x36f6('0x3'));var moment=require(_0x36f6('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x36f6('0x5'));var rimraf=require('rimraf');var config=require(_0x36f6('0x6'));var attributes=require(_0x36f6('0x7'));module['exports']=function(_0x265b38,_0xce429b){return _0x265b38['define'](_0x36f6('0x8'),attributes,{'tableName':_0x36f6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3295=['path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','util','api','moment','bluebird','request-promise'];(function(_0x417664,_0x93b9cb){var _0x13089a=function(_0x5cb7b8){while(--_0x5cb7b8){_0x417664['push'](_0x417664['shift']());}};_0x13089a(++_0x93b9cb);}(_0x3295,0x133));var _0x5329=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0x3295[_0x4e6ae6];return _0x23c108;};'use strict';var _=require('lodash');var util=require(_0x5329('0x0'));var logger=require('../../config/logger')(_0x5329('0x1'));var moment=require(_0x5329('0x2'));var BPromise=require(_0x5329('0x3'));var rp=require(_0x5329('0x4'));var fs=require('fs');var path=require(_0x5329('0x5'));var rimraf=require(_0x5329('0x6'));var config=require(_0x5329('0x7'));var attributes=require(_0x5329('0x8'));module['exports']=function(_0x5343f7,_0x4aa3a1){return _0x5343f7[_0x5329('0x9')](_0x5329('0xa'),attributes,{'tableName':_0x5329('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 72cfe57..0cbd866 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 _0xb3db=['stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0xae099d,_0x2355bb){var _0x6ed1a1=function(_0x31e0c7){while(--_0x31e0c7){_0xae099d['push'](_0xae099d['shift']());}};_0x6ed1a1(++_0x2355bb);}(_0xb3db,0x103));var _0xbb3d=function(_0x1f7201,_0x141b79){_0x1f7201=_0x1f7201-0x0;var _0x289fd2=_0xb3db[_0x1f7201];return _0x289fd2;};'use strict';var _=require(_0xbb3d('0x0'));var util=require(_0xbb3d('0x1'));var moment=require(_0xbb3d('0x2'));var BPromise=require(_0xbb3d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb3d('0x4'));var db=require(_0xbb3d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb3d('0x6'))(_0xbb3d('0x7'));var config=require(_0xbb3d('0x8'));var jayson=require(_0xbb3d('0x9'));var client=jayson[_0xbb3d('0xa')][_0xbb3d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x377b44,_0x54571a,_0xa467f8){return new BPromise(function(_0x54c81e,_0x14cc44){return client['request'](_0x377b44,_0xa467f8)[_0xbb3d('0xc')](function(_0x37419b){logger[_0xbb3d('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0x54571a,_0xbb3d('0xe'));logger[_0xbb3d('0xf')](_0xbb3d('0x10'),_0x54571a,_0xbb3d('0xe'),JSON[_0xbb3d('0x11')](_0x37419b));if(_0x37419b[_0xbb3d('0x12')]){if(_0x37419b[_0xbb3d('0x12')][_0xbb3d('0x13')]===0x1f4){logger[_0xbb3d('0x12')](_0xbb3d('0x14'),_0x54571a,_0x37419b[_0xbb3d('0x12')][_0xbb3d('0x15')]);return _0x14cc44(_0x37419b[_0xbb3d('0x12')][_0xbb3d('0x15')]);}logger[_0xbb3d('0x12')](_0xbb3d('0x14'),_0x54571a,_0x37419b['error'][_0xbb3d('0x15')]);return _0x54c81e(_0x37419b[_0xbb3d('0x12')]['message']);}else{logger['info'](_0xbb3d('0x14'),_0x54571a,_0xbb3d('0xe'));_0x54c81e(_0x37419b[_0xbb3d('0x16')][_0xbb3d('0x15')]);}})['catch'](function(_0x146b67){logger[_0xbb3d('0x12')](_0xbb3d('0x14'),_0x54571a,_0x146b67);_0x14cc44(_0x146b67);});});} \ No newline at end of file +var _0x1476=['../../config/utils','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis'];(function(_0x1e596f,_0x5adb1d){var _0x5a66ff=function(_0x2766c1){while(--_0x2766c1){_0x1e596f['push'](_0x1e596f['shift']());}};_0x5a66ff(++_0x5adb1d);}(_0x1476,0x14c));var _0x6147=function(_0x1ad956,_0x2b69aa){_0x1ad956=_0x1ad956-0x0;var _0x40274e=_0x1476[_0x1ad956];return _0x40274e;};'use strict';var _=require('lodash');var util=require(_0x6147('0x0'));var moment=require(_0x6147('0x1'));var BPromise=require(_0x6147('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6147('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6147('0x4'));var logger=require('../../config/logger')(_0x6147('0x5'));var config=require(_0x6147('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6147('0x7')][_0x6147('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1599f5,_0x2de4a6,_0x163555){return new BPromise(function(_0x280154,_0x373249){return client[_0x6147('0x9')](_0x1599f5,_0x163555)['then'](function(_0x4d3394){logger[_0x6147('0xa')]('VtigerConfiguration,\x20%s,\x20%s',_0x2de4a6,_0x6147('0xb'));logger[_0x6147('0xc')](_0x6147('0xd'),_0x2de4a6,_0x6147('0xb'),JSON[_0x6147('0xe')](_0x4d3394));if(_0x4d3394['error']){if(_0x4d3394[_0x6147('0xf')][_0x6147('0x10')]===0x1f4){logger[_0x6147('0xf')](_0x6147('0x11'),_0x2de4a6,_0x4d3394['error'][_0x6147('0x12')]);return _0x373249(_0x4d3394[_0x6147('0xf')]['message']);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x2de4a6,_0x4d3394[_0x6147('0xf')]['message']);return _0x280154(_0x4d3394[_0x6147('0xf')][_0x6147('0x12')]);}else{logger['info'](_0x6147('0x11'),_0x2de4a6,_0x6147('0xb'));_0x280154(_0x4d3394[_0x6147('0x13')][_0x6147('0x12')]);}})[_0x6147('0x14')](function(_0x10aaf0){logger[_0x6147('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x2de4a6,_0x10aaf0);_0x373249(_0x10aaf0);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 2c4bb84..bccbf87 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 _0xa045=['isAuthenticated','index','/:id','show','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1dd17c,_0x4a1023){var _0x27d9b3=function(_0x143298){while(--_0x143298){_0x1dd17c['push'](_0x1dd17c['shift']());}};_0x27d9b3(++_0x4a1023);}(_0xa045,0xaa));var _0x5a04=function(_0x868bf8,_0x290a75){_0x868bf8=_0x868bf8-0x0;var _0x57b04b=_0xa045[_0x868bf8];return _0x57b04b;};'use strict';var multer=require(_0x5a04('0x0'));var util=require(_0x5a04('0x1'));var path=require(_0x5a04('0x2'));var timeout=require(_0x5a04('0x3'));var express=require(_0x5a04('0x4'));var router=express[_0x5a04('0x5')]();var fs_extra=require(_0x5a04('0x6'));var auth=require(_0x5a04('0x7'));var interaction=require(_0x5a04('0x8'));var config=require(_0x5a04('0x9'));var controller=require('./intVtigerField.controller');router['get']('/',auth[_0x5a04('0xa')](),controller[_0x5a04('0xb')]);router['get'](_0x5a04('0xc'),auth['isAuthenticated'](),controller[_0x5a04('0xd')]);router['post']('/',auth[_0x5a04('0xa')](),controller['create']);router[_0x5a04('0xe')](_0x5a04('0xc'),auth['isAuthenticated'](),controller[_0x5a04('0xf')]);router['delete'](_0x5a04('0xc'),auth[_0x5a04('0xa')](),controller[_0x5a04('0x10')]);module[_0x5a04('0x11')]=router; \ No newline at end of file +var _0x5849=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','put','update'];(function(_0x275f36,_0x1abdf9){var _0x251006=function(_0x276e54){while(--_0x276e54){_0x275f36['push'](_0x275f36['shift']());}};_0x251006(++_0x1abdf9);}(_0x5849,0x6e));var _0x9584=function(_0x5a9f25,_0x1e89a9){_0x5a9f25=_0x5a9f25-0x0;var _0x900d82=_0x5849[_0x5a9f25];return _0x900d82;};'use strict';var multer=require(_0x9584('0x0'));var util=require('util');var path=require(_0x9584('0x1'));var timeout=require(_0x9584('0x2'));var express=require(_0x9584('0x3'));var router=express[_0x9584('0x4')]();var fs_extra=require(_0x9584('0x5'));var auth=require(_0x9584('0x6'));var interaction=require(_0x9584('0x7'));var config=require(_0x9584('0x8'));var controller=require('./intVtigerField.controller');router[_0x9584('0x9')]('/',auth[_0x9584('0xa')](),controller[_0x9584('0xb')]);router[_0x9584('0x9')](_0x9584('0xc'),auth[_0x9584('0xa')](),controller[_0x9584('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x9584('0xe')](_0x9584('0xc'),auth['isAuthenticated'](),controller[_0x9584('0xf')]);router['delete'](_0x9584('0xc'),auth['isAuthenticated'](),controller[_0x9584('0x10')]);module[_0x9584('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index f539960..8226ad2 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 _0x3797=['variable','keyValue','string','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x3797,0x165));var _0x7379=function(_0x5e37f6,_0x508bde){_0x5e37f6=_0x5e37f6-0x0;var _0x1a5c73=_0x3797[_0x5e37f6];return _0x1a5c73;};'use strict';var Sequelize=require(_0x7379('0x0'));module[_0x7379('0x1')]={'type':{'type':Sequelize[_0x7379('0x2')]('string',_0x7379('0x3'),'customVariable',_0x7379('0x4'),'picklist'),'defaultValue':_0x7379('0x5')},'content':{'type':Sequelize[_0x7379('0x6')]},'key':{'type':Sequelize[_0x7379('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x7379('0x5'),_0x7379('0x3'),_0x7379('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x7379('0x6')]},'nameField':{'type':Sequelize[_0x7379('0x6')]},'customField':{'type':Sequelize[_0x7379('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7379('0x6')]}}; \ No newline at end of file +var _0x58a9=['string','STRING','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist'];(function(_0x12816e,_0x1073a1){var _0x5cb884=function(_0x210d1d){while(--_0x210d1d){_0x12816e['push'](_0x12816e['shift']());}};_0x5cb884(++_0x1073a1);}(_0x58a9,0xb6));var _0x958a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x58a9[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x958a('0x0'));module[_0x958a('0x1')]={'type':{'type':Sequelize[_0x958a('0x2')]('string',_0x958a('0x3'),_0x958a('0x4'),_0x958a('0x5'),_0x958a('0x6')),'defaultValue':_0x958a('0x7')},'content':{'type':Sequelize[_0x958a('0x8')]},'key':{'type':Sequelize[_0x958a('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x958a('0x7'),_0x958a('0x3'),_0x958a('0x4'))},'keyContent':{'type':Sequelize[_0x958a('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x958a('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x958a('0x8')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index e2facd2..a8ec0f5 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 _0x3290=['create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','index','map','VtigerField','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','catch','params','options','find'];(function(_0x401e62,_0x53bfd6){var _0x39c0e5=function(_0x1589e1){while(--_0x1589e1){_0x401e62['push'](_0x401e62['shift']());}};_0x39c0e5(++_0x53bfd6);}(_0x3290,0xe6));var _0x0329=function(_0xb3761d,_0x5bd58f){_0xb3761d=_0xb3761d-0x0;var _0x1e28ee=_0x3290[_0xb3761d];return _0x1e28ee;};'use strict';var emlformat=require(_0x0329('0x0'));var rimraf=require(_0x0329('0x1'));var zipdir=require(_0x0329('0x2'));var jsonpatch=require(_0x0329('0x3'));var rp=require(_0x0329('0x4'));var moment=require(_0x0329('0x5'));var BPromise=require(_0x0329('0x6'));var Mustache=require(_0x0329('0x7'));var util=require('util');var path=require(_0x0329('0x8'));var sox=require(_0x0329('0x9'));var csv=require(_0x0329('0xa'));var ejs=require(_0x0329('0xb'));var fs=require('fs');var fs_extra=require(_0x0329('0xc'));var _=require('lodash');var squel=require(_0x0329('0xd'));var crypto=require(_0x0329('0xe'));var jsforce=require(_0x0329('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0329('0xa'));var querystring=require('querystring');var Papa=require(_0x0329('0x10'));var Redis=require(_0x0329('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0329('0x12'));var as=require(_0x0329('0x13'));var hardwareService=require(_0x0329('0x14'));var logger=require(_0x0329('0x15'))('api');var utils=require(_0x0329('0x16'));var config=require(_0x0329('0x17'));var licenseUtil=require(_0x0329('0x18'));var db=require(_0x0329('0x19'))['db'];function respondWithStatusCode(_0x3866ba,_0x37e7e5){_0x37e7e5=_0x37e7e5||0xcc;return function(_0x30594f){if(_0x30594f){return _0x3866ba[_0x0329('0x1a')](_0x37e7e5);}return _0x3866ba[_0x0329('0x1b')](_0x37e7e5)['end']();};}function respondWithResult(_0x38c4d9,_0x131be2){_0x131be2=_0x131be2||0xc8;return function(_0x1ccc62){if(_0x1ccc62){return _0x38c4d9[_0x0329('0x1b')](_0x131be2)[_0x0329('0x1c')](_0x1ccc62);}};}function respondWithFilteredResult(_0x3e539c,_0x5ae31f){return function(_0x2f67ee){if(_0x2f67ee){var _0x4c0ad6=typeof _0x5ae31f[_0x0329('0x1d')]===_0x0329('0x1e')&&typeof _0x5ae31f[_0x0329('0x1f')]===_0x0329('0x1e');var _0x4df502=_0x2f67ee[_0x0329('0x20')];var _0x26ff39=_0x4c0ad6?0x0:_0x5ae31f[_0x0329('0x1d')];var _0x3c8934=_0x4c0ad6?_0x2f67ee[_0x0329('0x20')]:_0x5ae31f['offset']+_0x5ae31f['limit'];var _0x4446d9;if(_0x3c8934>=_0x4df502){_0x3c8934=_0x4df502;_0x4446d9=0xc8;}else{_0x4446d9=0xce;}_0x3e539c['status'](_0x4446d9);return _0x3e539c[_0x0329('0x21')](_0x0329('0x22'),_0x26ff39+'-'+_0x3c8934+'/'+_0x4df502)[_0x0329('0x1c')](_0x2f67ee);}return null;};}function patchUpdates(_0x38b569){return function(_0x277341){try{jsonpatch[_0x0329('0x23')](_0x277341,_0x38b569,!![]);}catch(_0x5848e1){return BPromise['reject'](_0x5848e1);}return _0x277341[_0x0329('0x24')]();};}function saveUpdates(_0x3c35c1,_0x3c7de7){return function(_0x37b643){if(_0x37b643){return _0x37b643[_0x0329('0x25')](_0x3c35c1)[_0x0329('0x26')](function(_0x292a32){return _0x292a32;});}return null;};}function removeEntity(_0x199754,_0x2358e0){return function(_0x32ca8a){if(_0x32ca8a){return _0x32ca8a[_0x0329('0x27')]()['then'](function(){_0x199754[_0x0329('0x1b')](0xcc)[_0x0329('0x28')]();});}};}function handleEntityNotFound(_0x4a071f,_0x3b2b7e){return function(_0x5e1325){if(!_0x5e1325){_0x4a071f[_0x0329('0x1a')](0x194);}return _0x5e1325;};}function handleError(_0x5956e5,_0x137565){_0x137565=_0x137565||0x1f4;return function(_0x34a732){logger[_0x0329('0x29')](_0x34a732[_0x0329('0x2a')]);if(_0x34a732[_0x0329('0x2b')]){delete _0x34a732[_0x0329('0x2b')];}_0x5956e5[_0x0329('0x1b')](_0x137565)['send'](_0x34a732);};}exports[_0x0329('0x2c')]=function(_0xe1d7d3,_0x1a3d17){var _0x11c622={},_0x58c183={},_0x114e69={'count':0x0,'rows':[]};var _0x298c4f=_[_0x0329('0x2d')](db[_0x0329('0x2e')][_0x0329('0x2f')],function(_0x30805b){return{'name':_0x30805b[_0x0329('0x30')],'type':_0x30805b['type'][_0x0329('0x31')]};});_0x58c183[_0x0329('0x32')]=_['map'](_0x298c4f,_0x0329('0x2b'));_0x58c183['query']=_[_0x0329('0x33')](_0xe1d7d3[_0x0329('0x34')]);_0x58c183['filters']=_[_0x0329('0x35')](_0x58c183[_0x0329('0x32')],_0x58c183['query']);_0x11c622[_0x0329('0x36')]=_[_0x0329('0x35')](_0x58c183[_0x0329('0x32')],qs[_0x0329('0x37')](_0xe1d7d3[_0x0329('0x34')][_0x0329('0x37')]));_0x11c622['attributes']=_0x11c622[_0x0329('0x36')][_0x0329('0x38')]?_0x11c622[_0x0329('0x36')]:_0x58c183[_0x0329('0x32')];if(!_0xe1d7d3[_0x0329('0x34')][_0x0329('0x39')](_0x0329('0x3a'))){_0x11c622[_0x0329('0x1f')]=qs[_0x0329('0x1f')](_0xe1d7d3[_0x0329('0x34')][_0x0329('0x1f')]);_0x11c622[_0x0329('0x1d')]=qs[_0x0329('0x1d')](_0xe1d7d3[_0x0329('0x34')]['offset']);}_0x11c622['order']=qs[_0x0329('0x3b')](_0xe1d7d3[_0x0329('0x34')][_0x0329('0x3b')]);_0x11c622[_0x0329('0x3c')]=qs[_0x0329('0x3d')](_['pick'](_0xe1d7d3['query'],_0x58c183[_0x0329('0x3d')]),_0x298c4f);if(_0xe1d7d3[_0x0329('0x34')]['filter']){_0x11c622[_0x0329('0x3c')]=_[_0x0329('0x3e')](_0x11c622[_0x0329('0x3c')],{'$or':_[_0x0329('0x2d')](_0x298c4f,function(_0x524ffa){if(_0x524ffa[_0x0329('0x3f')]!==_0x0329('0x40')){var _0x12aba1={};_0x12aba1[_0x524ffa[_0x0329('0x2b')]]={'$like':'%'+_0xe1d7d3['query'][_0x0329('0x41')]+'%'};return _0x12aba1;}})});}_0x11c622=_[_0x0329('0x3e')]({},_0x11c622,_0xe1d7d3['options']);var _0x3c8cee={'where':_0x11c622[_0x0329('0x3c')]};return db['VtigerField'][_0x0329('0x20')](_0x3c8cee)[_0x0329('0x26')](function(_0xb2b3fe){_0x114e69['count']=_0xb2b3fe;if(_0xe1d7d3[_0x0329('0x34')][_0x0329('0x42')]){_0x11c622[_0x0329('0x43')]=[{'all':!![]}];}return db[_0x0329('0x2e')][_0x0329('0x44')](_0x11c622);})[_0x0329('0x26')](function(_0x4250d0){_0x114e69[_0x0329('0x45')]=_0x4250d0;return _0x114e69;})[_0x0329('0x26')](respondWithFilteredResult(_0x1a3d17,_0x11c622))[_0x0329('0x46')](handleError(_0x1a3d17,null));};exports['show']=function(_0x27173a,_0x5450d5){var _0x128e15={'raw':!![],'where':{'id':_0x27173a[_0x0329('0x47')]['id']}},_0x3b98f3={};_0x3b98f3[_0x0329('0x32')]=_[_0x0329('0x33')](db[_0x0329('0x2e')]['rawAttributes']);_0x3b98f3['query']=_[_0x0329('0x33')](_0x27173a[_0x0329('0x34')]);_0x3b98f3[_0x0329('0x3d')]=_['intersection'](_0x3b98f3[_0x0329('0x32')],_0x3b98f3[_0x0329('0x34')]);_0x128e15['attributes']=_['intersection'](_0x3b98f3[_0x0329('0x32')],qs['fields'](_0x27173a['query'][_0x0329('0x37')]));_0x128e15[_0x0329('0x36')]=_0x128e15[_0x0329('0x36')]['length']?_0x128e15['attributes']:_0x3b98f3['model'];if(_0x27173a[_0x0329('0x34')][_0x0329('0x42')]){_0x128e15['include']=[{'all':!![]}];}_0x128e15=_['merge']({},_0x128e15,_0x27173a[_0x0329('0x48')]);return db['VtigerField'][_0x0329('0x49')](_0x128e15)[_0x0329('0x26')](handleEntityNotFound(_0x5450d5,null))['then'](respondWithResult(_0x5450d5,null))[_0x0329('0x46')](handleError(_0x5450d5,null));};exports['create']=function(_0x5c494c,_0x1454c2){return db[_0x0329('0x2e')][_0x0329('0x4a')](_0x5c494c['body'],{})[_0x0329('0x26')](respondWithResult(_0x1454c2,0xc9))[_0x0329('0x46')](handleError(_0x1454c2,null));};exports[_0x0329('0x25')]=function(_0x23de57,_0x2bd982){if(_0x23de57['body']['id']){delete _0x23de57[_0x0329('0x4b')]['id'];}return db[_0x0329('0x2e')]['find']({'where':{'id':_0x23de57[_0x0329('0x47')]['id']}})['then'](handleEntityNotFound(_0x2bd982,null))[_0x0329('0x26')](saveUpdates(_0x23de57['body'],null))[_0x0329('0x26')](respondWithResult(_0x2bd982,null))[_0x0329('0x46')](handleError(_0x2bd982,null));};exports[_0x0329('0x27')]=function(_0x24bb76,_0x161566){return db[_0x0329('0x2e')][_0x0329('0x49')]({'where':{'id':_0x24bb76[_0x0329('0x47')]['id']}})[_0x0329('0x26')](handleEntityNotFound(_0x161566,null))[_0x0329('0x26')](removeEntity(_0x161566,null))[_0x0329('0x46')](handleError(_0x161566,null));}; \ No newline at end of file +var _0x70f6=['../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','stack','name','index','map','VtigerField','rawAttributes','type','key','query','filters','model','attributes','intersection','fields','order','sort','where','pick','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x1e88d7,_0x1d4f4e){var _0x2ab7a2=function(_0x49a779){while(--_0x49a779){_0x1e88d7['push'](_0x1e88d7['shift']());}};_0x2ab7a2(++_0x1d4f4e);}(_0x70f6,0x1dd));var _0x670f=function(_0x14acd5,_0x361989){_0x14acd5=_0x14acd5-0x0;var _0x593ebd=_0x70f6[_0x14acd5];return _0x593ebd;};'use strict';var emlformat=require(_0x670f('0x0'));var rimraf=require(_0x670f('0x1'));var zipdir=require(_0x670f('0x2'));var jsonpatch=require(_0x670f('0x3'));var rp=require(_0x670f('0x4'));var moment=require('moment');var BPromise=require(_0x670f('0x5'));var Mustache=require(_0x670f('0x6'));var util=require(_0x670f('0x7'));var path=require(_0x670f('0x8'));var sox=require(_0x670f('0x9'));var csv=require('to-csv');var ejs=require(_0x670f('0xa'));var fs=require('fs');var fs_extra=require(_0x670f('0xb'));var _=require(_0x670f('0xc'));var squel=require(_0x670f('0xd'));var crypto=require(_0x670f('0xe'));var jsforce=require(_0x670f('0xf'));var deskjs=require(_0x670f('0x10'));var toCsv=require(_0x670f('0x11'));var querystring=require(_0x670f('0x12'));var Papa=require('papaparse');var Redis=require(_0x670f('0x13'));var authService=require(_0x670f('0x14'));var qs=require(_0x670f('0x15'));var as=require(_0x670f('0x16'));var hardwareService=require(_0x670f('0x17'));var logger=require(_0x670f('0x18'))(_0x670f('0x19'));var utils=require(_0x670f('0x1a'));var config=require(_0x670f('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x670f('0x1c'))['db'];function respondWithStatusCode(_0x5cc4ba,_0x3f7211){_0x3f7211=_0x3f7211||0xcc;return function(_0x18d4f0){if(_0x18d4f0){return _0x5cc4ba[_0x670f('0x1d')](_0x3f7211);}return _0x5cc4ba[_0x670f('0x1e')](_0x3f7211)['end']();};}function respondWithResult(_0xc16949,_0x46ba8b){_0x46ba8b=_0x46ba8b||0xc8;return function(_0x7b934a){if(_0x7b934a){return _0xc16949[_0x670f('0x1e')](_0x46ba8b)[_0x670f('0x1f')](_0x7b934a);}};}function respondWithFilteredResult(_0x41f74d,_0x512901){return function(_0x23e22b){if(_0x23e22b){var _0x59a12f=typeof _0x512901[_0x670f('0x20')]===_0x670f('0x21')&&typeof _0x512901[_0x670f('0x22')]===_0x670f('0x21');var _0xf9289b=_0x23e22b['count'];var _0x57d20c=_0x59a12f?0x0:_0x512901[_0x670f('0x20')];var _0x3a9b90=_0x59a12f?_0x23e22b[_0x670f('0x23')]:_0x512901['offset']+_0x512901[_0x670f('0x22')];var _0x1bf8ab;if(_0x3a9b90>=_0xf9289b){_0x3a9b90=_0xf9289b;_0x1bf8ab=0xc8;}else{_0x1bf8ab=0xce;}_0x41f74d[_0x670f('0x1e')](_0x1bf8ab);return _0x41f74d['set'](_0x670f('0x24'),_0x57d20c+'-'+_0x3a9b90+'/'+_0xf9289b)[_0x670f('0x1f')](_0x23e22b);}return null;};}function patchUpdates(_0x501865){return function(_0x57007a){try{jsonpatch[_0x670f('0x25')](_0x57007a,_0x501865,!![]);}catch(_0x82933){return BPromise['reject'](_0x82933);}return _0x57007a[_0x670f('0x26')]();};}function saveUpdates(_0x307121,_0x24e10c){return function(_0x51dce1){if(_0x51dce1){return _0x51dce1['update'](_0x307121)[_0x670f('0x27')](function(_0xa9e975){return _0xa9e975;});}return null;};}function removeEntity(_0x575f76,_0x48227b){return function(_0x20a10e){if(_0x20a10e){return _0x20a10e[_0x670f('0x28')]()[_0x670f('0x27')](function(){_0x575f76['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x303e7d,_0x1b87b2){return function(_0x499640){if(!_0x499640){_0x303e7d[_0x670f('0x1d')](0x194);}return _0x499640;};}function handleError(_0x466999,_0x2048d9){_0x2048d9=_0x2048d9||0x1f4;return function(_0x35ce64){logger['error'](_0x35ce64[_0x670f('0x29')]);if(_0x35ce64[_0x670f('0x2a')]){delete _0x35ce64['name'];}_0x466999[_0x670f('0x1e')](_0x2048d9)['send'](_0x35ce64);};}exports[_0x670f('0x2b')]=function(_0x130f78,_0xe11fa7){var _0x7041e0={},_0x199bac={},_0xdc76d2={'count':0x0,'rows':[]};var _0x4dbc71=_[_0x670f('0x2c')](db[_0x670f('0x2d')][_0x670f('0x2e')],function(_0x216384){return{'name':_0x216384['fieldName'],'type':_0x216384[_0x670f('0x2f')][_0x670f('0x30')]};});_0x199bac['model']=_['map'](_0x4dbc71,_0x670f('0x2a'));_0x199bac[_0x670f('0x31')]=_['keys'](_0x130f78[_0x670f('0x31')]);_0x199bac[_0x670f('0x32')]=_['intersection'](_0x199bac[_0x670f('0x33')],_0x199bac[_0x670f('0x31')]);_0x7041e0[_0x670f('0x34')]=_[_0x670f('0x35')](_0x199bac[_0x670f('0x33')],qs[_0x670f('0x36')](_0x130f78['query'][_0x670f('0x36')]));_0x7041e0[_0x670f('0x34')]=_0x7041e0['attributes']['length']?_0x7041e0['attributes']:_0x199bac['model'];if(!_0x130f78[_0x670f('0x31')]['hasOwnProperty']('nolimit')){_0x7041e0['limit']=qs['limit'](_0x130f78[_0x670f('0x31')]['limit']);_0x7041e0[_0x670f('0x20')]=qs['offset'](_0x130f78[_0x670f('0x31')][_0x670f('0x20')]);}_0x7041e0[_0x670f('0x37')]=qs[_0x670f('0x38')](_0x130f78[_0x670f('0x31')]['sort']);_0x7041e0[_0x670f('0x39')]=qs['filters'](_[_0x670f('0x3a')](_0x130f78[_0x670f('0x31')],_0x199bac[_0x670f('0x32')]),_0x4dbc71);if(_0x130f78[_0x670f('0x31')]['filter']){_0x7041e0[_0x670f('0x39')]=_[_0x670f('0x3b')](_0x7041e0[_0x670f('0x39')],{'$or':_[_0x670f('0x2c')](_0x4dbc71,function(_0x58168a){if(_0x58168a['type']!=='VIRTUAL'){var _0x318ce1={};_0x318ce1[_0x58168a['name']]={'$like':'%'+_0x130f78[_0x670f('0x31')]['filter']+'%'};return _0x318ce1;}})});}_0x7041e0=_[_0x670f('0x3b')]({},_0x7041e0,_0x130f78[_0x670f('0x3c')]);var _0x587d3a={'where':_0x7041e0[_0x670f('0x39')]};return db['VtigerField'][_0x670f('0x23')](_0x587d3a)['then'](function(_0x2f98aa){_0xdc76d2[_0x670f('0x23')]=_0x2f98aa;if(_0x130f78[_0x670f('0x31')][_0x670f('0x3d')]){_0x7041e0[_0x670f('0x3e')]=[{'all':!![]}];}return db[_0x670f('0x2d')][_0x670f('0x3f')](_0x7041e0);})[_0x670f('0x27')](function(_0x111a17){_0xdc76d2[_0x670f('0x40')]=_0x111a17;return _0xdc76d2;})[_0x670f('0x27')](respondWithFilteredResult(_0xe11fa7,_0x7041e0))[_0x670f('0x41')](handleError(_0xe11fa7,null));};exports['show']=function(_0x1d3ed3,_0x4eccbf){var _0x368905={'raw':!![],'where':{'id':_0x1d3ed3[_0x670f('0x42')]['id']}},_0x4864ec={};_0x4864ec[_0x670f('0x33')]=_[_0x670f('0x43')](db[_0x670f('0x2d')][_0x670f('0x2e')]);_0x4864ec[_0x670f('0x31')]=_[_0x670f('0x43')](_0x1d3ed3[_0x670f('0x31')]);_0x4864ec[_0x670f('0x32')]=_[_0x670f('0x35')](_0x4864ec[_0x670f('0x33')],_0x4864ec[_0x670f('0x31')]);_0x368905['attributes']=_[_0x670f('0x35')](_0x4864ec[_0x670f('0x33')],qs[_0x670f('0x36')](_0x1d3ed3[_0x670f('0x31')][_0x670f('0x36')]));_0x368905['attributes']=_0x368905[_0x670f('0x34')]['length']?_0x368905['attributes']:_0x4864ec['model'];if(_0x1d3ed3[_0x670f('0x31')]['includeAll']){_0x368905[_0x670f('0x3e')]=[{'all':!![]}];}_0x368905=_[_0x670f('0x3b')]({},_0x368905,_0x1d3ed3[_0x670f('0x3c')]);return db[_0x670f('0x2d')][_0x670f('0x44')](_0x368905)[_0x670f('0x27')](handleEntityNotFound(_0x4eccbf,null))['then'](respondWithResult(_0x4eccbf,null))[_0x670f('0x41')](handleError(_0x4eccbf,null));};exports[_0x670f('0x45')]=function(_0x591b9e,_0x138d04){return db[_0x670f('0x2d')]['create'](_0x591b9e[_0x670f('0x46')],{})[_0x670f('0x27')](respondWithResult(_0x138d04,0xc9))[_0x670f('0x41')](handleError(_0x138d04,null));};exports[_0x670f('0x47')]=function(_0x3424de,_0x2cee38){if(_0x3424de['body']['id']){delete _0x3424de[_0x670f('0x46')]['id'];}return db[_0x670f('0x2d')][_0x670f('0x44')]({'where':{'id':_0x3424de[_0x670f('0x42')]['id']}})[_0x670f('0x27')](handleEntityNotFound(_0x2cee38,null))[_0x670f('0x27')](saveUpdates(_0x3424de[_0x670f('0x46')],null))[_0x670f('0x27')](respondWithResult(_0x2cee38,null))['catch'](handleError(_0x2cee38,null));};exports['destroy']=function(_0x1fa6b3,_0x15d6c0){return db[_0x670f('0x2d')]['find']({'where':{'id':_0x1fa6b3[_0x670f('0x42')]['id']}})['then'](handleEntityNotFound(_0x15d6c0,null))['then'](removeEntity(_0x15d6c0,null))[_0x670f('0x41')](handleError(_0x15d6c0,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 7a9b1bc..329d9f2 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 _0x9860=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','int_vtiger_fields','vtiger_unique_index','idField','FieldId','util','../../config/logger','api'];(function(_0xefd4a8,_0x2e1c3d){var _0x49f44a=function(_0x58ef8f){while(--_0x58ef8f){_0xefd4a8['push'](_0xefd4a8['shift']());}};_0x49f44a(++_0x2e1c3d);}(_0x9860,0x12d));var _0x0986=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9860[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x0986('0x0'));var logger=require(_0x0986('0x1'))(_0x0986('0x2'));var moment=require(_0x0986('0x3'));var BPromise=require(_0x0986('0x4'));var rp=require(_0x0986('0x5'));var fs=require('fs');var path=require(_0x0986('0x6'));var rimraf=require(_0x0986('0x7'));var config=require(_0x0986('0x8'));var attributes=require(_0x0986('0x9'));module[_0x0986('0xa')]=function(_0x4de5eb,_0x3b1dcd){return _0x4de5eb[_0x0986('0xb')]('VtigerField',attributes,{'tableName':_0x0986('0xc'),'paranoid':![],'indexes':[{'name':_0x0986('0xd'),'fields':[_0x0986('0xe'),_0x0986('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0ed7=['path','rimraf','./intVtigerField.attributes','exports','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x0ed7,0x95));var _0x70ed=function(_0x4d3a9b,_0x20b47d){_0x4d3a9b=_0x4d3a9b-0x0;var _0x1b5471=_0x0ed7[_0x4d3a9b];return _0x1b5471;};'use strict';var _=require(_0x70ed('0x0'));var util=require('util');var logger=require(_0x70ed('0x1'))(_0x70ed('0x2'));var moment=require(_0x70ed('0x3'));var BPromise=require(_0x70ed('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x70ed('0x5'));var rimraf=require(_0x70ed('0x6'));var config=require('../../config/environment');var attributes=require(_0x70ed('0x7'));module[_0x70ed('0x8')]=function(_0x33a729,_0x4b0fdd){return _0x33a729['define'](_0x70ed('0x9'),attributes,{'tableName':_0x70ed('0xa'),'paranoid':![],'indexes':[{'name':_0x70ed('0xb'),'fields':[_0x70ed('0xc'),_0x70ed('0xd')],'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 7939493..da7eef2 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 _0x7468=['jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3677d6,_0xe1071a){var _0x41e72c=function(_0x76433a){while(--_0x76433a){_0x3677d6['push'](_0x3677d6['shift']());}};_0x41e72c(++_0xe1071a);}(_0x7468,0xfe));var _0x8746=function(_0xcacd97,_0x75304b){_0xcacd97=_0xcacd97-0x0;var _0x3c750a=_0x7468[_0xcacd97];return _0x3c750a;};'use strict';var _=require(_0x8746('0x0'));var util=require(_0x8746('0x1'));var moment=require(_0x8746('0x2'));var BPromise=require('bluebird');var rs=require(_0x8746('0x3'));var fs=require('fs');var Redis=require(_0x8746('0x4'));var db=require(_0x8746('0x5'))['db'];var utils=require(_0x8746('0x6'));var logger=require(_0x8746('0x7'))(_0x8746('0x8'));var config=require(_0x8746('0x9'));var jayson=require(_0x8746('0xa'));var client=jayson[_0x8746('0xb')][_0x8746('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4d2268,_0x302ebb,_0x21986f){return new BPromise(function(_0x18fd40,_0x3a0128){return client[_0x8746('0xd')](_0x4d2268,_0x21986f)[_0x8746('0xe')](function(_0x24d60e){logger[_0x8746('0xf')](_0x8746('0x10'),_0x302ebb,_0x8746('0x11'));logger[_0x8746('0x12')](_0x8746('0x13'),_0x302ebb,_0x8746('0x11'),JSON[_0x8746('0x14')](_0x24d60e));if(_0x24d60e[_0x8746('0x15')]){if(_0x24d60e[_0x8746('0x15')][_0x8746('0x16')]===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0x302ebb,_0x24d60e[_0x8746('0x15')][_0x8746('0x17')]);return _0x3a0128(_0x24d60e['error'][_0x8746('0x17')]);}logger[_0x8746('0x15')]('VtigerField,\x20%s,\x20%s',_0x302ebb,_0x24d60e['error'][_0x8746('0x17')]);return _0x18fd40(_0x24d60e[_0x8746('0x15')][_0x8746('0x17')]);}else{logger['info'](_0x8746('0x10'),_0x302ebb,_0x8746('0x11'));_0x18fd40(_0x24d60e['result'][_0x8746('0x17')]);}})['catch'](function(_0x3ac663){logger[_0x8746('0x15')](_0x8746('0x10'),_0x302ebb,_0x3ac663);_0x3a0128(_0x3ac663);});});} \ No newline at end of file +var _0xeedf=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3b531b,_0x253940){var _0x56032a=function(_0x46aa8b){while(--_0x46aa8b){_0x3b531b['push'](_0x3b531b['shift']());}};_0x56032a(++_0x253940);}(_0xeedf,0xc9));var _0xfeed=function(_0x1216a8,_0x184aca){_0x1216a8=_0x1216a8-0x0;var _0xce914c=_0xeedf[_0x1216a8];return _0xce914c;};'use strict';var _=require(_0xfeed('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfeed('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfeed('0x2'));var db=require(_0xfeed('0x3'))['db'];var utils=require(_0xfeed('0x4'));var logger=require(_0xfeed('0x5'))(_0xfeed('0x6'));var config=require(_0xfeed('0x7'));var jayson=require(_0xfeed('0x8'));var client=jayson[_0xfeed('0x9')][_0xfeed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35f8e5,_0x5d5701,_0x3183bc){return new BPromise(function(_0x3e7913,_0xeb34ad){return client[_0xfeed('0xb')](_0x35f8e5,_0x3183bc)[_0xfeed('0xc')](function(_0x3ac938){logger[_0xfeed('0xd')](_0xfeed('0xe'),_0x5d5701,'request\x20sent');logger[_0xfeed('0xf')](_0xfeed('0x10'),_0x5d5701,_0xfeed('0x11'),JSON[_0xfeed('0x12')](_0x3ac938));if(_0x3ac938[_0xfeed('0x13')]){if(_0x3ac938[_0xfeed('0x13')][_0xfeed('0x14')]===0x1f4){logger[_0xfeed('0x13')](_0xfeed('0xe'),_0x5d5701,_0x3ac938[_0xfeed('0x13')][_0xfeed('0x15')]);return _0xeb34ad(_0x3ac938['error']['message']);}logger['error'](_0xfeed('0xe'),_0x5d5701,_0x3ac938[_0xfeed('0x13')][_0xfeed('0x15')]);return _0x3e7913(_0x3ac938[_0xfeed('0x13')][_0xfeed('0x15')]);}else{logger[_0xfeed('0xd')](_0xfeed('0xe'),_0x5d5701,_0xfeed('0x11'));_0x3e7913(_0x3ac938['result'][_0xfeed('0x15')]);}})[_0xfeed('0x16')](function(_0x3452d1){logger[_0xfeed('0x13')](_0xfeed('0xe'),_0x5d5701,_0x3452d1);_0xeb34ad(_0x3452d1);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index dddfab9..519f47d 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 _0x143a=['getFields','post','create','addConfiguration','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x23b276,_0x39230b){var _0x19205f=function(_0x23bbcb){while(--_0x23bbcb){_0x23b276['push'](_0x23b276['shift']());}};_0x19205f(++_0x39230b);}(_0x143a,0x1c1));var _0xa143=function(_0x58c065,_0x15f2db){_0x58c065=_0x58c065-0x0;var _0x20c168=_0x143a[_0x58c065];return _0x20c168;};'use strict';var multer=require(_0xa143('0x0'));var util=require('util');var path=require(_0xa143('0x1'));var timeout=require(_0xa143('0x2'));var express=require(_0xa143('0x3'));var router=express[_0xa143('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa143('0x5'));var config=require(_0xa143('0x6'));var controller=require('./intZendeskAccount.controller');router[_0xa143('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa143('0x7')](_0xa143('0x8'),auth[_0xa143('0x9')](),controller['show']);router['get'](_0xa143('0xa'),auth[_0xa143('0x9')](),controller[_0xa143('0xb')]);router[_0xa143('0x7')](_0xa143('0xc'),auth['isAuthenticated'](),controller[_0xa143('0xd')]);router[_0xa143('0xe')]('/',auth[_0xa143('0x9')](),controller[_0xa143('0xf')]);router[_0xa143('0xe')](_0xa143('0xa'),auth[_0xa143('0x9')](),controller[_0xa143('0x10')]);router[_0xa143('0x11')](_0xa143('0x8'),auth['isAuthenticated'](),controller['update']);router[_0xa143('0x12')](_0xa143('0x8'),auth[_0xa143('0x9')](),controller[_0xa143('0x13')]);module[_0xa143('0x14')]=router; \ No newline at end of file +var _0x747f=['/:id/configurations','addConfiguration','put','/:id','destroy','multer','util','express','Router','../../components/auth/service','./intZendeskAccount.controller','get','isAuthenticated','index','show','getConfigurations','getFields','post','create'];(function(_0x107f10,_0x3fba20){var _0x4ab711=function(_0x21c8c4){while(--_0x21c8c4){_0x107f10['push'](_0x107f10['shift']());}};_0x4ab711(++_0x3fba20);}(_0x747f,0x8a));var _0xf747=function(_0x260b06,_0x4278c4){_0x260b06=_0x260b06-0x0;var _0x19d8e0=_0x747f[_0x260b06];return _0x19d8e0;};'use strict';var multer=require(_0xf747('0x0'));var util=require(_0xf747('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf747('0x2'));var router=express[_0xf747('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf747('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf747('0x5'));router[_0xf747('0x6')]('/',auth[_0xf747('0x7')](),controller[_0xf747('0x8')]);router['get']('/:id',auth[_0xf747('0x7')](),controller[_0xf747('0x9')]);router[_0xf747('0x6')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xf747('0xa')]);router[_0xf747('0x6')]('/:id/fields',auth['isAuthenticated'](),controller[_0xf747('0xb')]);router[_0xf747('0xc')]('/',auth[_0xf747('0x7')](),controller[_0xf747('0xd')]);router[_0xf747('0xc')](_0xf747('0xe'),auth[_0xf747('0x7')](),controller[_0xf747('0xf')]);router[_0xf747('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xf747('0x11'),auth[_0xf747('0x7')](),controller[_0xf747('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 1c408b2..94b415b 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 _0x8f9d=['token','password','integrationTab','sequelize','STRING','username','remoteUri','ENUM'];(function(_0x572b7e,_0xf883e3){var _0x37c748=function(_0x5b3e51){while(--_0x5b3e51){_0x572b7e['push'](_0x572b7e['shift']());}};_0x37c748(++_0xf883e3);}(_0x8f9d,0x93));var _0xd8f9=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8f9d[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0xd8f9('0x0'));module['exports']={'name':{'type':Sequelize[_0xd8f9('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xd8f9('0x1')],'unique':_0xd8f9('0x2')},'password':{'type':Sequelize[_0xd8f9('0x1')]},'token':{'type':Sequelize[_0xd8f9('0x1')]},'remoteUri':{'type':Sequelize[_0xd8f9('0x1')],'unique':_0xd8f9('0x3')},'authType':{'type':Sequelize[_0xd8f9('0x4')]('password',_0xd8f9('0x5')),'defaultValue':_0xd8f9('0x6')},'serverUrl':{'type':Sequelize[_0xd8f9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xd8f9('0x4')](_0xd8f9('0x7'),'newTab'),'defaultValue':_0xd8f9('0x7')}}; \ No newline at end of file +var _0x8710=['ENUM','token','password','integrationTab','newTab','sequelize','exports','STRING','username'];(function(_0x431a72,_0x8e1880){var _0x29c6dd=function(_0x28ff8c){while(--_0x28ff8c){_0x431a72['push'](_0x431a72['shift']());}};_0x29c6dd(++_0x8e1880);}(_0x8710,0x68));var _0x0871=function(_0x3e92a5,_0x4594cf){_0x3e92a5=_0x3e92a5-0x0;var _0x3aae51=_0x8710[_0x3e92a5];return _0x3aae51;};'use strict';var Sequelize=require(_0x0871('0x0'));module[_0x0871('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0871('0x2')]},'username':{'type':Sequelize[_0x0871('0x2')],'unique':_0x0871('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x0871('0x2')]},'remoteUri':{'type':Sequelize[_0x0871('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x0871('0x4')]('password',_0x0871('0x5')),'defaultValue':_0x0871('0x6')},'serverUrl':{'type':Sequelize[_0x0871('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x0871('0x4')](_0x0871('0x7'),_0x0871('0x8')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 8b98eb1..7fd38ee 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 _0x7334=['params','keys','rawAttributes','includeAll','options','find','create','body','destroy','ZendeskConfiguration','pick','getConfigurations','nolimit','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','getFields','findOne','username','token','authType','remoteUri','slice','substring','GET','format','%s/%s','ticket_fields','password','headers','toString','base64','ValidationError','subject','assignee','remove','position','title','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','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','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','end','sendStatus','stack','index','map','fieldName','model','name','query','filters','intersection','fields','length','attributes','hasOwnProperty','order','sort','filter','where','merge','type','VIRTUAL','ZendeskAccount','include','findAll','rows','catch','show'];(function(_0x2d393f,_0x4b84d9){var _0x4fd9ef=function(_0x12f76e){while(--_0x12f76e){_0x2d393f['push'](_0x2d393f['shift']());}};_0x4fd9ef(++_0x4b84d9);}(_0x7334,0x184));var _0x4733=function(_0x240abf,_0x22fb79){_0x240abf=_0x240abf-0x0;var _0xd2b890=_0x7334[_0x240abf];return _0xd2b890;};'use strict';var emlformat=require(_0x4733('0x0'));var rimraf=require(_0x4733('0x1'));var zipdir=require(_0x4733('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4733('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4733('0x4'));var util=require(_0x4733('0x5'));var path=require(_0x4733('0x6'));var sox=require(_0x4733('0x7'));var csv=require(_0x4733('0x8'));var ejs=require(_0x4733('0x9'));var fs=require('fs');var fs_extra=require(_0x4733('0xa'));var _=require(_0x4733('0xb'));var squel=require(_0x4733('0xc'));var crypto=require(_0x4733('0xd'));var jsforce=require(_0x4733('0xe'));var deskjs=require(_0x4733('0xf'));var toCsv=require(_0x4733('0x8'));var querystring=require(_0x4733('0x10'));var Papa=require(_0x4733('0x11'));var Redis=require(_0x4733('0x12'));var authService=require(_0x4733('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4733('0x14'));var hardwareService=require(_0x4733('0x15'));var logger=require('../../config/logger')(_0x4733('0x16'));var utils=require('../../config/utils');var config=require(_0x4733('0x17'));var licenseUtil=require(_0x4733('0x18'));var db=require(_0x4733('0x19'))['db'];var integrations=require(_0x4733('0x1a'));function respondWithStatusCode(_0x100ecd,_0x1c146c){_0x1c146c=_0x1c146c||0xcc;return function(_0x2c0f6b){if(_0x2c0f6b){return _0x100ecd['sendStatus'](_0x1c146c);}return _0x100ecd[_0x4733('0x1b')](_0x1c146c)['end']();};}function respondWithResult(_0x4327f3,_0x1a22e4){_0x1a22e4=_0x1a22e4||0xc8;return function(_0x2e5b1b){if(_0x2e5b1b){return _0x4327f3[_0x4733('0x1b')](_0x1a22e4)[_0x4733('0x1c')](_0x2e5b1b);}};}function respondWithFilteredResult(_0x167016,_0x12f111){return function(_0x9fff){if(_0x9fff){var _0x1920ce=typeof _0x12f111['offset']===_0x4733('0x1d')&&typeof _0x12f111[_0x4733('0x1e')]==='undefined';var _0x444824=_0x9fff[_0x4733('0x1f')];var _0x2aa223=_0x1920ce?0x0:_0x12f111[_0x4733('0x20')];var _0x579f67=_0x1920ce?_0x9fff['count']:_0x12f111[_0x4733('0x20')]+_0x12f111[_0x4733('0x1e')];var _0x50c585;if(_0x579f67>=_0x444824){_0x579f67=_0x444824;_0x50c585=0xc8;}else{_0x50c585=0xce;}_0x167016[_0x4733('0x1b')](_0x50c585);return _0x167016[_0x4733('0x21')](_0x4733('0x22'),_0x2aa223+'-'+_0x579f67+'/'+_0x444824)[_0x4733('0x1c')](_0x9fff);}return null;};}function patchUpdates(_0x493cd3){return function(_0x1232e5){try{jsonpatch[_0x4733('0x23')](_0x1232e5,_0x493cd3,!![]);}catch(_0x5d058d){return BPromise[_0x4733('0x24')](_0x5d058d);}return _0x1232e5[_0x4733('0x25')]();};}function saveUpdates(_0x478e34,_0x15a291){return function(_0x115ce4){if(_0x115ce4){return _0x115ce4[_0x4733('0x26')](_0x478e34)[_0x4733('0x27')](function(_0x3a2542){return _0x3a2542;});}return null;};}function removeEntity(_0x24db74,_0x180049){return function(_0x2bb78f){if(_0x2bb78f){return _0x2bb78f['destroy']()[_0x4733('0x27')](function(){_0x24db74[_0x4733('0x1b')](0xcc)[_0x4733('0x28')]();});}};}function handleEntityNotFound(_0x2cb247,_0x30ee9b){return function(_0x3bd683){if(!_0x3bd683){_0x2cb247[_0x4733('0x29')](0x194);}return _0x3bd683;};}function handleError(_0xc3ab0a,_0x13bc12){_0x13bc12=_0x13bc12||0x1f4;return function(_0x23fe6c){logger['error'](_0x23fe6c[_0x4733('0x2a')]);if(_0x23fe6c['name']){delete _0x23fe6c['name'];}_0xc3ab0a[_0x4733('0x1b')](_0x13bc12)['send'](_0x23fe6c);};}exports[_0x4733('0x2b')]=function(_0x479989,_0x4abc0d){var _0x517c73={},_0x2976b0={},_0x3bfe53={'count':0x0,'rows':[]};var _0x29621e=_[_0x4733('0x2c')](db['ZendeskAccount']['rawAttributes'],function(_0x50f67e){return{'name':_0x50f67e[_0x4733('0x2d')],'type':_0x50f67e['type']['key']};});_0x2976b0[_0x4733('0x2e')]=_[_0x4733('0x2c')](_0x29621e,_0x4733('0x2f'));_0x2976b0['query']=_['keys'](_0x479989[_0x4733('0x30')]);_0x2976b0[_0x4733('0x31')]=_[_0x4733('0x32')](_0x2976b0[_0x4733('0x2e')],_0x2976b0[_0x4733('0x30')]);_0x517c73['attributes']=_[_0x4733('0x32')](_0x2976b0[_0x4733('0x2e')],qs[_0x4733('0x33')](_0x479989[_0x4733('0x30')][_0x4733('0x33')]));_0x517c73['attributes']=_0x517c73['attributes'][_0x4733('0x34')]?_0x517c73[_0x4733('0x35')]:_0x2976b0[_0x4733('0x2e')];if(!_0x479989[_0x4733('0x30')][_0x4733('0x36')]('nolimit')){_0x517c73[_0x4733('0x1e')]=qs[_0x4733('0x1e')](_0x479989[_0x4733('0x30')]['limit']);_0x517c73[_0x4733('0x20')]=qs[_0x4733('0x20')](_0x479989[_0x4733('0x30')][_0x4733('0x20')]);}_0x517c73[_0x4733('0x37')]=qs[_0x4733('0x38')](_0x479989[_0x4733('0x30')][_0x4733('0x38')]);_0x517c73['where']=qs[_0x4733('0x31')](_['pick'](_0x479989[_0x4733('0x30')],_0x2976b0[_0x4733('0x31')]),_0x29621e);if(_0x479989[_0x4733('0x30')][_0x4733('0x39')]){_0x517c73[_0x4733('0x3a')]=_[_0x4733('0x3b')](_0x517c73[_0x4733('0x3a')],{'$or':_[_0x4733('0x2c')](_0x29621e,function(_0x592fc2){if(_0x592fc2[_0x4733('0x3c')]!==_0x4733('0x3d')){var _0x5e12c3={};_0x5e12c3[_0x592fc2[_0x4733('0x2f')]]={'$like':'%'+_0x479989[_0x4733('0x30')]['filter']+'%'};return _0x5e12c3;}})});}_0x517c73=_[_0x4733('0x3b')]({},_0x517c73,_0x479989['options']);var _0x43ac2d={'where':_0x517c73['where']};return db[_0x4733('0x3e')][_0x4733('0x1f')](_0x43ac2d)['then'](function(_0x515720){_0x3bfe53[_0x4733('0x1f')]=_0x515720;if(_0x479989[_0x4733('0x30')]['includeAll']){_0x517c73[_0x4733('0x3f')]=[{'all':!![]}];}return db[_0x4733('0x3e')][_0x4733('0x40')](_0x517c73);})[_0x4733('0x27')](function(_0x3ae58c){_0x3bfe53[_0x4733('0x41')]=_0x3ae58c;return _0x3bfe53;})[_0x4733('0x27')](respondWithFilteredResult(_0x4abc0d,_0x517c73))[_0x4733('0x42')](handleError(_0x4abc0d,null));};exports[_0x4733('0x43')]=function(_0x42e055,_0x444471){var _0x1d32df={'raw':![],'where':{'id':_0x42e055[_0x4733('0x44')]['id']}},_0x191c04={};_0x191c04[_0x4733('0x2e')]=_[_0x4733('0x45')](db[_0x4733('0x3e')][_0x4733('0x46')]);_0x191c04['query']=_[_0x4733('0x45')](_0x42e055[_0x4733('0x30')]);_0x191c04[_0x4733('0x31')]=_[_0x4733('0x32')](_0x191c04[_0x4733('0x2e')],_0x191c04[_0x4733('0x30')]);_0x1d32df[_0x4733('0x35')]=_[_0x4733('0x32')](_0x191c04[_0x4733('0x2e')],qs[_0x4733('0x33')](_0x42e055[_0x4733('0x30')][_0x4733('0x33')]));_0x1d32df[_0x4733('0x35')]=_0x1d32df[_0x4733('0x35')]['length']?_0x1d32df['attributes']:_0x191c04[_0x4733('0x2e')];if(_0x42e055[_0x4733('0x30')][_0x4733('0x47')]){_0x1d32df[_0x4733('0x3f')]=[{'all':!![]}];}_0x1d32df=_[_0x4733('0x3b')]({},_0x1d32df,_0x42e055[_0x4733('0x48')]);return db[_0x4733('0x3e')][_0x4733('0x49')](_0x1d32df)[_0x4733('0x27')](handleEntityNotFound(_0x444471,null))[_0x4733('0x27')](respondWithResult(_0x444471,null))['catch'](handleError(_0x444471,null));};exports['create']=function(_0x51e201,_0x521ad3){return db[_0x4733('0x3e')][_0x4733('0x4a')](_0x51e201[_0x4733('0x4b')],{})[_0x4733('0x27')](respondWithResult(_0x521ad3,0xc9))[_0x4733('0x42')](handleError(_0x521ad3,null));};exports[_0x4733('0x26')]=function(_0x1c6abf,_0x2484f4){if(_0x1c6abf[_0x4733('0x4b')]['id']){delete _0x1c6abf[_0x4733('0x4b')]['id'];}return db['ZendeskAccount']['find']({'where':{'id':_0x1c6abf[_0x4733('0x44')]['id']}})['then'](handleEntityNotFound(_0x2484f4,null))[_0x4733('0x27')](saveUpdates(_0x1c6abf[_0x4733('0x4b')],null))[_0x4733('0x27')](respondWithResult(_0x2484f4,null))['catch'](handleError(_0x2484f4,null));};exports[_0x4733('0x4c')]=function(_0x45c9ad,_0x31ae69){return db[_0x4733('0x3e')][_0x4733('0x49')]({'where':{'id':_0x45c9ad[_0x4733('0x44')]['id']}})[_0x4733('0x27')](handleEntityNotFound(_0x31ae69,null))[_0x4733('0x27')](removeEntity(_0x31ae69,null))[_0x4733('0x42')](handleError(_0x31ae69,null));};exports['getConfigurations']=function(_0x31fb69,_0xdb1561,_0x899344){var _0x491fa5={};var _0x2effd2={};var _0x130aee;var _0xafb3f8;return db[_0x4733('0x3e')]['findOne']({'where':{'id':_0x31fb69[_0x4733('0x44')]['id']}})['then'](handleEntityNotFound(_0xdb1561,null))[_0x4733('0x27')](function(_0x3b8165){if(_0x3b8165){_0x130aee=_0x3b8165;_0x2effd2[_0x4733('0x2e')]=_[_0x4733('0x45')](db[_0x4733('0x4d')]['rawAttributes']);_0x2effd2[_0x4733('0x30')]=_[_0x4733('0x45')](_0x31fb69['query']);_0x2effd2['filters']=_[_0x4733('0x32')](_0x2effd2[_0x4733('0x2e')],_0x2effd2[_0x4733('0x30')]);_0x491fa5[_0x4733('0x35')]=_[_0x4733('0x32')](_0x2effd2[_0x4733('0x2e')],qs[_0x4733('0x33')](_0x31fb69[_0x4733('0x30')]['fields']));_0x491fa5['attributes']=_0x491fa5[_0x4733('0x35')]['length']?_0x491fa5[_0x4733('0x35')]:_0x2effd2[_0x4733('0x2e')];_0x491fa5[_0x4733('0x37')]=qs['sort'](_0x31fb69['query']['sort']);_0x491fa5[_0x4733('0x3a')]=qs[_0x4733('0x31')](_[_0x4733('0x4e')](_0x31fb69['query'],_0x2effd2[_0x4733('0x31')]));if(_0x31fb69[_0x4733('0x30')][_0x4733('0x39')]){_0x491fa5[_0x4733('0x3a')]=_[_0x4733('0x3b')](_0x491fa5[_0x4733('0x3a')],{'$or':_[_0x4733('0x2c')](_0x491fa5['attributes'],function(_0x1ed9eb){var _0x2b5eec={};_0x2b5eec[_0x1ed9eb]={'$like':'%'+_0x31fb69['query']['filter']+'%'};return _0x2b5eec;})});}_0x491fa5=_[_0x4733('0x3b')]({},_0x491fa5,_0x31fb69[_0x4733('0x48')]);return _0x130aee[_0x4733('0x4f')](_0x491fa5);}})[_0x4733('0x27')](function(_0x475dad){if(_0x475dad){_0xafb3f8=_0x475dad[_0x4733('0x34')];if(!_0x31fb69[_0x4733('0x30')][_0x4733('0x36')](_0x4733('0x50'))){_0x491fa5['limit']=qs[_0x4733('0x1e')](_0x31fb69[_0x4733('0x30')][_0x4733('0x1e')]);_0x491fa5['offset']=qs[_0x4733('0x20')](_0x31fb69['query'][_0x4733('0x20')]);}return _0x130aee[_0x4733('0x4f')](_0x491fa5);}})[_0x4733('0x27')](function(_0x3696d6){if(_0x3696d6){return _0x3696d6?{'count':_0xafb3f8,'rows':_0x3696d6}:null;}})[_0x4733('0x27')](respondWithResult(_0xdb1561,null))[_0x4733('0x42')](handleError(_0xdb1561,null));};exports['addConfiguration']=function(_0x137793,_0x574787,_0x15552d){if(_0x137793[_0x4733('0x4b')]['id']){delete _0x137793['body']['id'];}return db[_0x4733('0x3e')]['findOne']({'where':{'id':_0x137793['params']['id']}})[_0x4733('0x27')](handleEntityNotFound(_0x574787,null))[_0x4733('0x27')](function(_0x1a0ebf){if(_0x1a0ebf){_0x137793[_0x4733('0x4b')][_0x4733('0x51')]=_0x1a0ebf['id'];_0x137793[_0x4733('0x4b')][_0x4733('0x52')]=integrations[_0x4733('0x53')](_0x137793[_0x4733('0x4b')]['channel'],_0x137793['body']['type']);_0x137793[_0x4733('0x4b')][_0x4733('0x54')]=integrations[_0x4733('0x55')](_0x137793[_0x4733('0x4b')]['channel'],_0x137793[_0x4733('0x4b')][_0x4733('0x3c')]);return db[_0x4733('0x4d')]['create'](_0x137793[_0x4733('0x4b')],{'include':[{'model':db['ZendeskField'],'as':_0x4733('0x52')},{'model':db['ZendeskField'],'as':'Descriptions'}]});}return null;})[_0x4733('0x27')](respondWithResult(_0x574787,null))['catch'](handleError(_0x574787,null));};exports[_0x4733('0x56')]=function(_0x523498,_0x4e835b,_0x1a7baf){var _0x5c6083='';return db['ZendeskAccount'][_0x4733('0x57')]({'where':{'id':_0x523498[_0x4733('0x44')]['id']},'attributes':['id',_0x4733('0x58'),'password',_0x4733('0x59'),_0x4733('0x5a'),_0x4733('0x5b')]})[_0x4733('0x27')](handleEntityNotFound(_0x4e835b,null))[_0x4733('0x27')](function(_0x29f4e8){if(_0x29f4e8){_0x5c6083=_0x29f4e8['remoteUri'];var _0x3c9e3b=_0x5c6083[_0x4733('0x5c')](-0x1);if(_0x3c9e3b==='/'){_0x5c6083=_0x5c6083[_0x4733('0x5d')](0x0,_0x5c6083['lastIndexOf'](_0x3c9e3b));}var _0x2c0377={'method':_0x4733('0x5e'),'uri':util[_0x4733('0x5f')](_0x4733('0x60'),_0x5c6083,_0x4733('0x61')),'json':!![]};switch(_0x29f4e8[_0x4733('0x5a')]){case _0x4733('0x62'):_0x2c0377[_0x4733('0x63')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x4733('0x5f')]('%s:%s',_0x29f4e8['username'],_0x29f4e8[_0x4733('0x62')]))[_0x4733('0x64')](_0x4733('0x65')))};break;case _0x4733('0x59'):_0x2c0377['headers']={'Authorization':util[_0x4733('0x5f')]('Basic\x20%s',new Buffer(util[_0x4733('0x5f')]('%s/token:%s',_0x29f4e8['username'],_0x29f4e8[_0x4733('0x59')]))['toString']('base64'))};break;default:throw new db['Sequelize'][(_0x4733('0x66'))]('Unknown\x20authentication\x20type');}return rp(_0x2c0377);}})[_0x4733('0x27')](function(_0x2fe1d3){if(_0x2fe1d3){var _0x59cc5b=[_0x4733('0x67'),'description','group',_0x4733('0x68')];_[_0x4733('0x69')](_0x2fe1d3[_0x4733('0x61')],function(_0x5a067b){return _0x59cc5b['includes'](_0x5a067b[_0x4733('0x3c')]);});return{'count':_0x2fe1d3['ticket_fields'][_0x4733('0x34')],'rows':_[_0x4733('0x2c')](_0x2fe1d3[_0x4733('0x61')],function(_0x42657b){return{'id':_0x42657b['id'],'name':_0x42657b[_0x4733('0x6a')]>0x7?_0x42657b[_0x4733('0x6b')]:_0x42657b['type'],'custom':_0x42657b[_0x4733('0x6a')]>0x7?!![]:![],'options':_0x42657b[_0x4733('0x6c')]?_0x42657b[_0x4733('0x6c')]:_0x42657b[_0x4733('0x6d')]?_0x42657b['custom_field_options']:[]};})};}})['then'](respondWithResult(_0x4e835b,null))[_0x4733('0x42')](function(_0x4d87c1){var _0x131595=_0x523498[_0x4733('0x30')][_0x4733('0x6e')]?0x1f4:_0x4d87c1[_0x4733('0x6f')]||0x1f4;logger[_0x4733('0x70')](_0x4733('0x71'),_0x4733('0x56'),_0x131595,JSON['stringify'](_0x4d87c1));delete _0x4d87c1[_0x4733('0x2f')];if(_0x131595===0x191){_0x131595=0x190;}_0x4e835b[_0x4733('0x1b')](_0x131595)['send'](_0x523498['query'][_0x4733('0x6e')]?{'message':'Wrong\x20credentials','statusCode':_0x4d87c1[_0x4733('0x6f')]}:_0x4d87c1);});}; \ No newline at end of file +var _0x5c00=['getDescriptions','username','token','authType','remoteUri','slice','substring','GET','%s/%s','ticket_fields','password','%s:%s','toString','headers','format','Basic\x20%s','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','description','group','assignee','includes','title','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','json','reject','save','update','then','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','show','options','find','catch','create','body','destroy','params','getConfigurations','findOne','ZendeskConfiguration','AccountId','channel'];(function(_0x4b7af6,_0x2bb0cd){var _0x4215b5=function(_0x3572cc){while(--_0x3572cc){_0x4b7af6['push'](_0x4b7af6['shift']());}};_0x4215b5(++_0x2bb0cd);}(_0x5c00,0x17e));var _0x05c0=function(_0x5f52a4,_0x5706d9){_0x5f52a4=_0x5f52a4-0x0;var _0xde1bce=_0x5c00[_0x5f52a4];return _0xde1bce;};'use strict';var emlformat=require(_0x05c0('0x0'));var rimraf=require(_0x05c0('0x1'));var zipdir=require(_0x05c0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x05c0('0x3'));var moment=require('moment');var BPromise=require(_0x05c0('0x4'));var Mustache=require(_0x05c0('0x5'));var util=require(_0x05c0('0x6'));var path=require(_0x05c0('0x7'));var sox=require('sox');var csv=require(_0x05c0('0x8'));var ejs=require(_0x05c0('0x9'));var fs=require('fs');var fs_extra=require(_0x05c0('0xa'));var _=require(_0x05c0('0xb'));var squel=require('squel');var crypto=require(_0x05c0('0xc'));var jsforce=require(_0x05c0('0xd'));var deskjs=require(_0x05c0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x05c0('0xf'));var Papa=require(_0x05c0('0x10'));var Redis=require(_0x05c0('0x11'));var authService=require(_0x05c0('0x12'));var qs=require(_0x05c0('0x13'));var as=require(_0x05c0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x05c0('0x15'));var utils=require('../../config/utils');var config=require(_0x05c0('0x16'));var licenseUtil=require(_0x05c0('0x17'));var db=require(_0x05c0('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4e39d4,_0x5eec41){_0x5eec41=_0x5eec41||0xcc;return function(_0x16a290){if(_0x16a290){return _0x4e39d4[_0x05c0('0x19')](_0x5eec41);}return _0x4e39d4[_0x05c0('0x1a')](_0x5eec41)[_0x05c0('0x1b')]();};}function respondWithResult(_0x25764b,_0xe57ed0){_0xe57ed0=_0xe57ed0||0xc8;return function(_0x331799){if(_0x331799){return _0x25764b[_0x05c0('0x1a')](_0xe57ed0)['json'](_0x331799);}};}function respondWithFilteredResult(_0x238e25,_0x161a5f){return function(_0x4bb164){if(_0x4bb164){var _0x29e6b0=typeof _0x161a5f[_0x05c0('0x1c')]===_0x05c0('0x1d')&&typeof _0x161a5f[_0x05c0('0x1e')]===_0x05c0('0x1d');var _0x38f994=_0x4bb164['count'];var _0x422401=_0x29e6b0?0x0:_0x161a5f[_0x05c0('0x1c')];var _0x4613c0=_0x29e6b0?_0x4bb164['count']:_0x161a5f[_0x05c0('0x1c')]+_0x161a5f[_0x05c0('0x1e')];var _0x10685b;if(_0x4613c0>=_0x38f994){_0x4613c0=_0x38f994;_0x10685b=0xc8;}else{_0x10685b=0xce;}_0x238e25[_0x05c0('0x1a')](_0x10685b);return _0x238e25[_0x05c0('0x1f')]('Content-Range',_0x422401+'-'+_0x4613c0+'/'+_0x38f994)[_0x05c0('0x20')](_0x4bb164);}return null;};}function patchUpdates(_0x1014ef){return function(_0x5313b0){try{jsonpatch['apply'](_0x5313b0,_0x1014ef,!![]);}catch(_0x5e4b80){return BPromise[_0x05c0('0x21')](_0x5e4b80);}return _0x5313b0[_0x05c0('0x22')]();};}function saveUpdates(_0x83f29,_0x8e2d4){return function(_0x5b3acb){if(_0x5b3acb){return _0x5b3acb[_0x05c0('0x23')](_0x83f29)[_0x05c0('0x24')](function(_0x5b4eef){return _0x5b4eef;});}return null;};}function removeEntity(_0x9b4930,_0x1abbf3){return function(_0x4ba978){if(_0x4ba978){return _0x4ba978['destroy']()['then'](function(){_0x9b4930['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3df135,_0x15b497){return function(_0x48b56f){if(!_0x48b56f){_0x3df135[_0x05c0('0x19')](0x194);}return _0x48b56f;};}function handleError(_0x336e1b,_0x3617dc){_0x3617dc=_0x3617dc||0x1f4;return function(_0x889c75){logger['error'](_0x889c75[_0x05c0('0x25')]);if(_0x889c75[_0x05c0('0x26')]){delete _0x889c75[_0x05c0('0x26')];}_0x336e1b[_0x05c0('0x1a')](_0x3617dc)[_0x05c0('0x27')](_0x889c75);};}exports[_0x05c0('0x28')]=function(_0x57886b,_0x56ba64){var _0x2df109={},_0xbe7d9e={},_0x2053d5={'count':0x0,'rows':[]};var _0xd6574e=_[_0x05c0('0x29')](db[_0x05c0('0x2a')][_0x05c0('0x2b')],function(_0x3c9eb1){return{'name':_0x3c9eb1[_0x05c0('0x2c')],'type':_0x3c9eb1[_0x05c0('0x2d')][_0x05c0('0x2e')]};});_0xbe7d9e[_0x05c0('0x2f')]=_['map'](_0xd6574e,'name');_0xbe7d9e[_0x05c0('0x30')]=_[_0x05c0('0x31')](_0x57886b[_0x05c0('0x30')]);_0xbe7d9e['filters']=_[_0x05c0('0x32')](_0xbe7d9e[_0x05c0('0x2f')],_0xbe7d9e['query']);_0x2df109[_0x05c0('0x33')]=_['intersection'](_0xbe7d9e[_0x05c0('0x2f')],qs[_0x05c0('0x34')](_0x57886b[_0x05c0('0x30')][_0x05c0('0x34')]));_0x2df109[_0x05c0('0x33')]=_0x2df109[_0x05c0('0x33')][_0x05c0('0x35')]?_0x2df109[_0x05c0('0x33')]:_0xbe7d9e[_0x05c0('0x2f')];if(!_0x57886b[_0x05c0('0x30')][_0x05c0('0x36')](_0x05c0('0x37'))){_0x2df109[_0x05c0('0x1e')]=qs[_0x05c0('0x1e')](_0x57886b[_0x05c0('0x30')][_0x05c0('0x1e')]);_0x2df109[_0x05c0('0x1c')]=qs[_0x05c0('0x1c')](_0x57886b[_0x05c0('0x30')][_0x05c0('0x1c')]);}_0x2df109[_0x05c0('0x38')]=qs[_0x05c0('0x39')](_0x57886b[_0x05c0('0x30')][_0x05c0('0x39')]);_0x2df109[_0x05c0('0x3a')]=qs[_0x05c0('0x3b')](_[_0x05c0('0x3c')](_0x57886b[_0x05c0('0x30')],_0xbe7d9e[_0x05c0('0x3b')]),_0xd6574e);if(_0x57886b[_0x05c0('0x30')][_0x05c0('0x3d')]){_0x2df109[_0x05c0('0x3a')]=_[_0x05c0('0x3e')](_0x2df109['where'],{'$or':_[_0x05c0('0x29')](_0xd6574e,function(_0x249101){if(_0x249101[_0x05c0('0x2d')]!==_0x05c0('0x3f')){var _0x49f829={};_0x49f829[_0x249101['name']]={'$like':'%'+_0x57886b[_0x05c0('0x30')][_0x05c0('0x3d')]+'%'};return _0x49f829;}})});}_0x2df109=_[_0x05c0('0x3e')]({},_0x2df109,_0x57886b['options']);var _0x29dc87={'where':_0x2df109[_0x05c0('0x3a')]};return db[_0x05c0('0x2a')][_0x05c0('0x40')](_0x29dc87)['then'](function(_0x152c6a){_0x2053d5[_0x05c0('0x40')]=_0x152c6a;if(_0x57886b['query'][_0x05c0('0x41')]){_0x2df109[_0x05c0('0x42')]=[{'all':!![]}];}return db[_0x05c0('0x2a')][_0x05c0('0x43')](_0x2df109);})[_0x05c0('0x24')](function(_0x398a6e){_0x2053d5[_0x05c0('0x44')]=_0x398a6e;return _0x2053d5;})['then'](respondWithFilteredResult(_0x56ba64,_0x2df109))['catch'](handleError(_0x56ba64,null));};exports[_0x05c0('0x45')]=function(_0x1d1d94,_0xaa5d53){var _0x11f079={'raw':![],'where':{'id':_0x1d1d94['params']['id']}},_0x14aba3={};_0x14aba3[_0x05c0('0x2f')]=_[_0x05c0('0x31')](db[_0x05c0('0x2a')][_0x05c0('0x2b')]);_0x14aba3[_0x05c0('0x30')]=_[_0x05c0('0x31')](_0x1d1d94[_0x05c0('0x30')]);_0x14aba3['filters']=_[_0x05c0('0x32')](_0x14aba3[_0x05c0('0x2f')],_0x14aba3[_0x05c0('0x30')]);_0x11f079[_0x05c0('0x33')]=_[_0x05c0('0x32')](_0x14aba3[_0x05c0('0x2f')],qs[_0x05c0('0x34')](_0x1d1d94[_0x05c0('0x30')][_0x05c0('0x34')]));_0x11f079[_0x05c0('0x33')]=_0x11f079[_0x05c0('0x33')]['length']?_0x11f079['attributes']:_0x14aba3[_0x05c0('0x2f')];if(_0x1d1d94[_0x05c0('0x30')][_0x05c0('0x41')]){_0x11f079[_0x05c0('0x42')]=[{'all':!![]}];}_0x11f079=_[_0x05c0('0x3e')]({},_0x11f079,_0x1d1d94[_0x05c0('0x46')]);return db['ZendeskAccount'][_0x05c0('0x47')](_0x11f079)[_0x05c0('0x24')](handleEntityNotFound(_0xaa5d53,null))[_0x05c0('0x24')](respondWithResult(_0xaa5d53,null))[_0x05c0('0x48')](handleError(_0xaa5d53,null));};exports['create']=function(_0x34e94e,_0x2440e8){return db[_0x05c0('0x2a')][_0x05c0('0x49')](_0x34e94e['body'],{})[_0x05c0('0x24')](respondWithResult(_0x2440e8,0xc9))[_0x05c0('0x48')](handleError(_0x2440e8,null));};exports[_0x05c0('0x23')]=function(_0x9b521b,_0x5ef6cf){if(_0x9b521b[_0x05c0('0x4a')]['id']){delete _0x9b521b[_0x05c0('0x4a')]['id'];}return db['ZendeskAccount'][_0x05c0('0x47')]({'where':{'id':_0x9b521b['params']['id']}})['then'](handleEntityNotFound(_0x5ef6cf,null))[_0x05c0('0x24')](saveUpdates(_0x9b521b['body'],null))[_0x05c0('0x24')](respondWithResult(_0x5ef6cf,null))[_0x05c0('0x48')](handleError(_0x5ef6cf,null));};exports[_0x05c0('0x4b')]=function(_0x371aff,_0x3ccae9){return db[_0x05c0('0x2a')]['find']({'where':{'id':_0x371aff[_0x05c0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3ccae9,null))[_0x05c0('0x24')](removeEntity(_0x3ccae9,null))[_0x05c0('0x48')](handleError(_0x3ccae9,null));};exports[_0x05c0('0x4d')]=function(_0x13ad38,_0x1496d4,_0x37ad50){var _0x156087={};var _0x551b7b={};var _0x5215b4;var _0x523153;return db[_0x05c0('0x2a')][_0x05c0('0x4e')]({'where':{'id':_0x13ad38['params']['id']}})['then'](handleEntityNotFound(_0x1496d4,null))[_0x05c0('0x24')](function(_0x1a72d6){if(_0x1a72d6){_0x5215b4=_0x1a72d6;_0x551b7b[_0x05c0('0x2f')]=_[_0x05c0('0x31')](db[_0x05c0('0x4f')][_0x05c0('0x2b')]);_0x551b7b[_0x05c0('0x30')]=_['keys'](_0x13ad38[_0x05c0('0x30')]);_0x551b7b[_0x05c0('0x3b')]=_[_0x05c0('0x32')](_0x551b7b[_0x05c0('0x2f')],_0x551b7b['query']);_0x156087[_0x05c0('0x33')]=_['intersection'](_0x551b7b[_0x05c0('0x2f')],qs[_0x05c0('0x34')](_0x13ad38['query'][_0x05c0('0x34')]));_0x156087['attributes']=_0x156087[_0x05c0('0x33')][_0x05c0('0x35')]?_0x156087[_0x05c0('0x33')]:_0x551b7b[_0x05c0('0x2f')];_0x156087[_0x05c0('0x38')]=qs[_0x05c0('0x39')](_0x13ad38['query'][_0x05c0('0x39')]);_0x156087[_0x05c0('0x3a')]=qs[_0x05c0('0x3b')](_[_0x05c0('0x3c')](_0x13ad38[_0x05c0('0x30')],_0x551b7b[_0x05c0('0x3b')]));if(_0x13ad38['query'][_0x05c0('0x3d')]){_0x156087[_0x05c0('0x3a')]=_[_0x05c0('0x3e')](_0x156087[_0x05c0('0x3a')],{'$or':_[_0x05c0('0x29')](_0x156087[_0x05c0('0x33')],function(_0xf5e123){var _0x866523={};_0x866523[_0xf5e123]={'$like':'%'+_0x13ad38[_0x05c0('0x30')][_0x05c0('0x3d')]+'%'};return _0x866523;})});}_0x156087=_[_0x05c0('0x3e')]({},_0x156087,_0x13ad38[_0x05c0('0x46')]);return _0x5215b4['getConfigurations'](_0x156087);}})['then'](function(_0x5269b4){if(_0x5269b4){_0x523153=_0x5269b4[_0x05c0('0x35')];if(!_0x13ad38[_0x05c0('0x30')][_0x05c0('0x36')]('nolimit')){_0x156087[_0x05c0('0x1e')]=qs[_0x05c0('0x1e')](_0x13ad38[_0x05c0('0x30')][_0x05c0('0x1e')]);_0x156087[_0x05c0('0x1c')]=qs[_0x05c0('0x1c')](_0x13ad38[_0x05c0('0x30')]['offset']);}return _0x5215b4[_0x05c0('0x4d')](_0x156087);}})[_0x05c0('0x24')](function(_0x355b44){if(_0x355b44){return _0x355b44?{'count':_0x523153,'rows':_0x355b44}:null;}})[_0x05c0('0x24')](respondWithResult(_0x1496d4,null))['catch'](handleError(_0x1496d4,null));};exports['addConfiguration']=function(_0x5e4941,_0x3b74c5,_0x2b8a13){if(_0x5e4941[_0x05c0('0x4a')]['id']){delete _0x5e4941[_0x05c0('0x4a')]['id'];}return db[_0x05c0('0x2a')][_0x05c0('0x4e')]({'where':{'id':_0x5e4941[_0x05c0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3b74c5,null))[_0x05c0('0x24')](function(_0x225397){if(_0x225397){_0x5e4941[_0x05c0('0x4a')][_0x05c0('0x50')]=_0x225397['id'];_0x5e4941[_0x05c0('0x4a')]['Subjects']=integrations['getSubjects'](_0x5e4941[_0x05c0('0x4a')][_0x05c0('0x51')],_0x5e4941['body'][_0x05c0('0x2d')]);_0x5e4941['body']['Descriptions']=integrations[_0x05c0('0x52')](_0x5e4941[_0x05c0('0x4a')][_0x05c0('0x51')],_0x5e4941['body']['type']);return db[_0x05c0('0x4f')][_0x05c0('0x49')](_0x5e4941[_0x05c0('0x4a')],{'include':[{'model':db['ZendeskField'],'as':'Subjects'},{'model':db['ZendeskField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x3b74c5,null))[_0x05c0('0x48')](handleError(_0x3b74c5,null));};exports['getFields']=function(_0x496acf,_0x5bb9ef,_0xd7a2f3){var _0x1a6dc4='';return db[_0x05c0('0x2a')]['findOne']({'where':{'id':_0x496acf[_0x05c0('0x4c')]['id']},'attributes':['id',_0x05c0('0x53'),'password',_0x05c0('0x54'),_0x05c0('0x55'),_0x05c0('0x56')]})[_0x05c0('0x24')](handleEntityNotFound(_0x5bb9ef,null))['then'](function(_0x35ef76){if(_0x35ef76){_0x1a6dc4=_0x35ef76[_0x05c0('0x56')];var _0xc150e3=_0x1a6dc4[_0x05c0('0x57')](-0x1);if(_0xc150e3==='/'){_0x1a6dc4=_0x1a6dc4[_0x05c0('0x58')](0x0,_0x1a6dc4['lastIndexOf'](_0xc150e3));}var _0x4aee38={'method':_0x05c0('0x59'),'uri':util['format'](_0x05c0('0x5a'),_0x1a6dc4,_0x05c0('0x5b')),'json':!![]};switch(_0x35ef76['authType']){case _0x05c0('0x5c'):_0x4aee38['headers']={'Authorization':util['format']('Basic\x20%s',new Buffer(util['format'](_0x05c0('0x5d'),_0x35ef76[_0x05c0('0x53')],_0x35ef76[_0x05c0('0x5c')]))[_0x05c0('0x5e')]('base64'))};break;case _0x05c0('0x54'):_0x4aee38[_0x05c0('0x5f')]={'Authorization':util[_0x05c0('0x60')](_0x05c0('0x61'),new Buffer(util[_0x05c0('0x60')]('%s/token:%s',_0x35ef76[_0x05c0('0x53')],_0x35ef76['token']))['toString'](_0x05c0('0x62')))};break;default:throw new db[(_0x05c0('0x63'))][(_0x05c0('0x64'))](_0x05c0('0x65'));}return rp(_0x4aee38);}})[_0x05c0('0x24')](function(_0x4577ee){if(_0x4577ee){var _0x4c3c73=['subject',_0x05c0('0x66'),_0x05c0('0x67'),_0x05c0('0x68')];_['remove'](_0x4577ee[_0x05c0('0x5b')],function(_0x7c5ce6){return _0x4c3c73[_0x05c0('0x69')](_0x7c5ce6[_0x05c0('0x2d')]);});return{'count':_0x4577ee[_0x05c0('0x5b')][_0x05c0('0x35')],'rows':_['map'](_0x4577ee[_0x05c0('0x5b')],function(_0x464ae0){return{'id':_0x464ae0['id'],'name':_0x464ae0['position']>0x7?_0x464ae0[_0x05c0('0x6a')]:_0x464ae0[_0x05c0('0x2d')],'custom':_0x464ae0['position']>0x7?!![]:![],'options':_0x464ae0[_0x05c0('0x6b')]?_0x464ae0[_0x05c0('0x6b')]:_0x464ae0[_0x05c0('0x6c')]?_0x464ae0[_0x05c0('0x6c')]:[]};})};}})[_0x05c0('0x24')](respondWithResult(_0x5bb9ef,null))[_0x05c0('0x48')](function(_0x544d6c){var _0x63f20=_0x496acf['query'][_0x05c0('0x6d')]?0x1f4:_0x544d6c[_0x05c0('0x6e')]||0x1f4;logger[_0x05c0('0x6f')](_0x05c0('0x70'),_0x05c0('0x71'),_0x63f20,JSON[_0x05c0('0x72')](_0x544d6c));delete _0x544d6c[_0x05c0('0x26')];if(_0x63f20===0x191){_0x63f20=0x190;}_0x5bb9ef[_0x05c0('0x1a')](_0x63f20)[_0x05c0('0x27')](_0x496acf[_0x05c0('0x30')]['test']?{'message':_0x05c0('0x73'),'statusCode':_0x544d6c['statusCode']}:_0x544d6c);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index e3aeea3..5af1bc9 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 _0x9b0b=['define','ZendeskAccount','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x4cdecc,_0x321d1a){var _0x3948a9=function(_0x2a247d){while(--_0x2a247d){_0x4cdecc['push'](_0x4cdecc['shift']());}};_0x3948a9(++_0x321d1a);}(_0x9b0b,0xff));var _0xb9b0=function(_0x53c256,_0x382a24){_0x53c256=_0x53c256-0x0;var _0x25feb6=_0x9b0b[_0x53c256];return _0x25feb6;};'use strict';var _=require('lodash');var util=require(_0xb9b0('0x0'));var logger=require(_0xb9b0('0x1'))(_0xb9b0('0x2'));var moment=require('moment');var BPromise=require(_0xb9b0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb9b0('0x4'));var rimraf=require(_0xb9b0('0x5'));var config=require(_0xb9b0('0x6'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xb9b0('0x7'));module[_0xb9b0('0x8')]=function(_0x1c5ecb,_0x195206){return _0x1c5ecb[_0xb9b0('0x9')](_0xb9b0('0xa'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac85=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x1cf110,_0x3aa12d){var _0x12abef=function(_0x5ec499){while(--_0x5ec499){_0x1cf110['push'](_0x1cf110['shift']());}};_0x12abef(++_0x3aa12d);}(_0xac85,0x122));var _0x5ac8=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xac85[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x5ac8('0x0'));var util=require(_0x5ac8('0x1'));var logger=require(_0x5ac8('0x2'))(_0x5ac8('0x3'));var moment=require('moment');var BPromise=require(_0x5ac8('0x4'));var rp=require(_0x5ac8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5ac8('0x6'));var config=require(_0x5ac8('0x7'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x5ac8('0x8'));module[_0x5ac8('0x9')]=function(_0x11ff51,_0x3edd50){return _0x11ff51['define']('ZendeskAccount',attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 5961335..098421a 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 _0x5844=['request','info','ZendeskAccount,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','ZendeskAccount','findAll','options','raw','include','map','attributes','model','then','GetZendeskAccount','ShowZendeskAccount','find','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http'];(function(_0x3732a2,_0x2d068c){var _0x42b217=function(_0xad58f0){while(--_0xad58f0){_0x3732a2['push'](_0x3732a2['shift']());}};_0x42b217(++_0x2d068c);}(_0x5844,0x10d));var _0x4584=function(_0x5ba676,_0x2b7e1e){_0x5ba676=_0x5ba676-0x0;var _0x107aba=_0x5844[_0x5ba676];return _0x107aba;};'use strict';var _=require(_0x4584('0x0'));var util=require(_0x4584('0x1'));var moment=require(_0x4584('0x2'));var BPromise=require(_0x4584('0x3'));var rs=require(_0x4584('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4584('0x5'))['db'];var utils=require(_0x4584('0x6'));var logger=require(_0x4584('0x7'))(_0x4584('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4584('0x9')][_0x4584('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x63747f,_0xee6aeb,_0x3ee4c8){return new BPromise(function(_0xdcbc2d,_0x24b6e7){return client[_0x4584('0xb')](_0x63747f,_0x3ee4c8)['then'](function(_0x244815){logger[_0x4584('0xc')](_0x4584('0xd'),_0xee6aeb,'request\x20sent');logger[_0x4584('0xe')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0xee6aeb,'request\x20sent',JSON[_0x4584('0xf')](_0x244815));if(_0x244815[_0x4584('0x10')]){if(_0x244815['error'][_0x4584('0x11')]===0x1f4){logger[_0x4584('0x10')](_0x4584('0xd'),_0xee6aeb,_0x244815[_0x4584('0x10')][_0x4584('0x12')]);return _0x24b6e7(_0x244815[_0x4584('0x10')][_0x4584('0x12')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0xee6aeb,_0x244815[_0x4584('0x10')][_0x4584('0x12')]);return _0xdcbc2d(_0x244815[_0x4584('0x10')][_0x4584('0x12')]);}else{logger[_0x4584('0xc')](_0x4584('0xd'),_0xee6aeb,_0x4584('0x13'));_0xdcbc2d(_0x244815[_0x4584('0x14')][_0x4584('0x12')]);}})[_0x4584('0x15')](function(_0x425bc0){logger[_0x4584('0x10')](_0x4584('0xd'),_0xee6aeb,_0x425bc0);_0x24b6e7(_0x425bc0);});});}exports['GetZendeskAccount']=function(_0xb282d3){var _0x31e4e0=this;return new Promise(function(_0x1efa10,_0x3c4050){return db[_0x4584('0x16')][_0x4584('0x17')]({'raw':_0xb282d3[_0x4584('0x18')]?_0xb282d3[_0x4584('0x18')][_0x4584('0x19')]===undefined?!![]:![]:!![],'where':_0xb282d3['options']?_0xb282d3['options']['where']||null:null,'attributes':_0xb282d3[_0x4584('0x18')]?_0xb282d3['options']['attributes']||null:null,'limit':_0xb282d3[_0x4584('0x18')]?_0xb282d3[_0x4584('0x18')]['limit']||null:null,'include':_0xb282d3[_0x4584('0x18')]?_0xb282d3[_0x4584('0x18')][_0x4584('0x1a')]?_[_0x4584('0x1b')](_0xb282d3[_0x4584('0x18')][_0x4584('0x1a')],function(_0xf90617){return{'model':db[_0xf90617['model']],'as':_0xf90617['as'],'attributes':_0xf90617[_0x4584('0x1c')],'include':_0xf90617[_0x4584('0x1a')]?_[_0x4584('0x1b')](_0xf90617[_0x4584('0x1a')],function(_0x207186){return{'model':db[_0x207186['model']],'as':_0x207186['as'],'attributes':_0x207186[_0x4584('0x1c')],'include':_0x207186[_0x4584('0x1a')]?_[_0x4584('0x1b')](_0x207186[_0x4584('0x1a')],function(_0x28c4dc){return{'model':db[_0x28c4dc[_0x4584('0x1d')]],'as':_0x28c4dc['as'],'attributes':_0x28c4dc[_0x4584('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4584('0x1e')](function(_0x55ef56){logger[_0x4584('0xc')](_0x4584('0x1f'),_0xb282d3);logger[_0x4584('0xe')]('GetZendeskAccount',_0xb282d3,JSON[_0x4584('0xf')](_0x55ef56));_0x1efa10(_0x55ef56);})[_0x4584('0x15')](function(_0x2d866d){logger[_0x4584('0x10')](_0x4584('0x1f'),_0x2d866d[_0x4584('0x12')],_0xb282d3);_0x3c4050(_0x31e4e0[_0x4584('0x10')](0x1f4,_0x2d866d[_0x4584('0x12')]));});});};exports[_0x4584('0x20')]=function(_0x2b6d1e){var _0x317c05=this;return new Promise(function(_0x36a03e,_0x3da509){return db[_0x4584('0x16')][_0x4584('0x21')]({'raw':_0x2b6d1e[_0x4584('0x18')]?_0x2b6d1e['options']['raw']===undefined?!![]:![]:!![],'where':_0x2b6d1e['options']?_0x2b6d1e[_0x4584('0x18')][_0x4584('0x22')]||null:null,'attributes':_0x2b6d1e[_0x4584('0x18')]?_0x2b6d1e[_0x4584('0x18')]['attributes']||null:null,'include':_0x2b6d1e['options']?_0x2b6d1e['options']['include']?_[_0x4584('0x1b')](_0x2b6d1e[_0x4584('0x18')][_0x4584('0x1a')],function(_0x1230c7){return{'model':db[_0x1230c7[_0x4584('0x1d')]],'as':_0x1230c7['as'],'attributes':_0x1230c7['attributes'],'include':_0x1230c7[_0x4584('0x1a')]?_[_0x4584('0x1b')](_0x1230c7[_0x4584('0x1a')],function(_0xbf4d02){return{'model':db[_0xbf4d02[_0x4584('0x1d')]],'as':_0xbf4d02['as'],'attributes':_0xbf4d02[_0x4584('0x1c')],'include':_0xbf4d02[_0x4584('0x1a')]?_[_0x4584('0x1b')](_0xbf4d02[_0x4584('0x1a')],function(_0x12c6cf){return{'model':db[_0x12c6cf[_0x4584('0x1d')]],'as':_0x12c6cf['as'],'attributes':_0x12c6cf[_0x4584('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4584('0x1e')](function(_0x39fa49){logger[_0x4584('0xc')](_0x4584('0x20'),_0x2b6d1e);logger['debug']('ShowZendeskAccount',_0x2b6d1e,JSON[_0x4584('0xf')](_0x39fa49));_0x36a03e(_0x39fa49);})[_0x4584('0x15')](function(_0xf83af1){logger['error']('ShowZendeskAccount',_0xf83af1['message'],_0x2b6d1e);_0x3da509(_0x317c05[_0x4584('0x10')](0x1f4,_0xf83af1['message']));});});}; \ No newline at end of file +var _0x4e81=['../../mysqldb','../../config/utils','client','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','attributes','limit','include','map','model','GetZendeskAccount','ShowZendeskAccount','ZendeskAccount','find','raw','where','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x217215,_0x454180){var _0x2263ac=function(_0x38897f){while(--_0x38897f){_0x217215['push'](_0x217215['shift']());}};_0x2263ac(++_0x454180);}(_0x4e81,0x1b5));var _0x14e8=function(_0x20b29c,_0xe22528){_0x20b29c=_0x20b29c-0x0;var _0x20d81b=_0x4e81[_0x20b29c];return _0x20d81b;};'use strict';var _=require(_0x14e8('0x0'));var util=require('util');var moment=require(_0x14e8('0x1'));var BPromise=require(_0x14e8('0x2'));var rs=require(_0x14e8('0x3'));var fs=require('fs');var Redis=require(_0x14e8('0x4'));var db=require(_0x14e8('0x5'))['db'];var utils=require(_0x14e8('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x14e8('0x7')][_0x14e8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x358664,_0x3d8327,_0x5b2838){return new BPromise(function(_0x34682a,_0x51642b){return client[_0x14e8('0x9')](_0x358664,_0x5b2838)['then'](function(_0x2fc0f7){logger[_0x14e8('0xa')](_0x14e8('0xb'),_0x3d8327,_0x14e8('0xc'));logger[_0x14e8('0xd')](_0x14e8('0xe'),_0x3d8327,'request\x20sent',JSON[_0x14e8('0xf')](_0x2fc0f7));if(_0x2fc0f7[_0x14e8('0x10')]){if(_0x2fc0f7['error'][_0x14e8('0x11')]===0x1f4){logger[_0x14e8('0x10')](_0x14e8('0xb'),_0x3d8327,_0x2fc0f7[_0x14e8('0x10')][_0x14e8('0x12')]);return _0x51642b(_0x2fc0f7[_0x14e8('0x10')][_0x14e8('0x12')]);}logger[_0x14e8('0x10')](_0x14e8('0xb'),_0x3d8327,_0x2fc0f7['error'][_0x14e8('0x12')]);return _0x34682a(_0x2fc0f7[_0x14e8('0x10')][_0x14e8('0x12')]);}else{logger[_0x14e8('0xa')]('ZendeskAccount,\x20%s,\x20%s',_0x3d8327,'request\x20sent');_0x34682a(_0x2fc0f7[_0x14e8('0x13')][_0x14e8('0x12')]);}})[_0x14e8('0x14')](function(_0x379a58){logger[_0x14e8('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x3d8327,_0x379a58);_0x51642b(_0x379a58);});});}exports['GetZendeskAccount']=function(_0x54302f){var _0x4cd721=this;return new Promise(function(_0x385c92,_0xa3866e){return db['ZendeskAccount'][_0x14e8('0x15')]({'raw':_0x54302f[_0x14e8('0x16')]?_0x54302f['options']['raw']===undefined?!![]:![]:!![],'where':_0x54302f[_0x14e8('0x16')]?_0x54302f[_0x14e8('0x16')]['where']||null:null,'attributes':_0x54302f[_0x14e8('0x16')]?_0x54302f[_0x14e8('0x16')][_0x14e8('0x17')]||null:null,'limit':_0x54302f[_0x14e8('0x16')]?_0x54302f[_0x14e8('0x16')][_0x14e8('0x18')]||null:null,'include':_0x54302f[_0x14e8('0x16')]?_0x54302f[_0x14e8('0x16')][_0x14e8('0x19')]?_[_0x14e8('0x1a')](_0x54302f[_0x14e8('0x16')][_0x14e8('0x19')],function(_0x2b6bb2){return{'model':db[_0x2b6bb2[_0x14e8('0x1b')]],'as':_0x2b6bb2['as'],'attributes':_0x2b6bb2[_0x14e8('0x17')],'include':_0x2b6bb2[_0x14e8('0x19')]?_[_0x14e8('0x1a')](_0x2b6bb2['include'],function(_0x4d8498){return{'model':db[_0x4d8498['model']],'as':_0x4d8498['as'],'attributes':_0x4d8498[_0x14e8('0x17')],'include':_0x4d8498[_0x14e8('0x19')]?_['map'](_0x4d8498[_0x14e8('0x19')],function(_0x480525){return{'model':db[_0x480525[_0x14e8('0x1b')]],'as':_0x480525['as'],'attributes':_0x480525[_0x14e8('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x151bc5){logger[_0x14e8('0xa')](_0x14e8('0x1c'),_0x54302f);logger[_0x14e8('0xd')]('GetZendeskAccount',_0x54302f,JSON['stringify'](_0x151bc5));_0x385c92(_0x151bc5);})[_0x14e8('0x14')](function(_0x244aac){logger[_0x14e8('0x10')](_0x14e8('0x1c'),_0x244aac[_0x14e8('0x12')],_0x54302f);_0xa3866e(_0x4cd721['error'](0x1f4,_0x244aac[_0x14e8('0x12')]));});});};exports[_0x14e8('0x1d')]=function(_0x16dad7){var _0x33e53e=this;return new Promise(function(_0x41bc88,_0x3a8a3b){return db[_0x14e8('0x1e')][_0x14e8('0x1f')]({'raw':_0x16dad7[_0x14e8('0x16')]?_0x16dad7[_0x14e8('0x16')][_0x14e8('0x20')]===undefined?!![]:![]:!![],'where':_0x16dad7[_0x14e8('0x16')]?_0x16dad7['options'][_0x14e8('0x21')]||null:null,'attributes':_0x16dad7['options']?_0x16dad7[_0x14e8('0x16')]['attributes']||null:null,'include':_0x16dad7[_0x14e8('0x16')]?_0x16dad7[_0x14e8('0x16')][_0x14e8('0x19')]?_['map'](_0x16dad7[_0x14e8('0x16')][_0x14e8('0x19')],function(_0x2af2df){return{'model':db[_0x2af2df[_0x14e8('0x1b')]],'as':_0x2af2df['as'],'attributes':_0x2af2df[_0x14e8('0x17')],'include':_0x2af2df['include']?_[_0x14e8('0x1a')](_0x2af2df[_0x14e8('0x19')],function(_0x175629){return{'model':db[_0x175629['model']],'as':_0x175629['as'],'attributes':_0x175629['attributes'],'include':_0x175629[_0x14e8('0x19')]?_[_0x14e8('0x1a')](_0x175629[_0x14e8('0x19')],function(_0x654bea){return{'model':db[_0x654bea[_0x14e8('0x1b')]],'as':_0x654bea['as'],'attributes':_0x654bea[_0x14e8('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4bee78){logger['info'](_0x14e8('0x1d'),_0x16dad7);logger[_0x14e8('0xd')](_0x14e8('0x1d'),_0x16dad7,JSON[_0x14e8('0xf')](_0x4bee78));_0x41bc88(_0x4bee78);})[_0x14e8('0x14')](function(_0x1bceec){logger[_0x14e8('0x10')](_0x14e8('0x1d'),_0x1bceec[_0x14e8('0x12')],_0x16dad7);_0x3a8a3b(_0x33e53e[_0x14e8('0x10')](0x1f4,_0x1bceec[_0x14e8('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 87660e4..936913f 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 _0xbdb7=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller','index','get','show','getFields','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','getTags','/:id/tags','update','delete','/:id'];(function(_0x35d4e9,_0x298c61){var _0x5c2770=function(_0x2f326a){while(--_0x2f326a){_0x35d4e9['push'](_0x35d4e9['shift']());}};_0x5c2770(++_0x298c61);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x23b946,_0x2653e1){_0x23b946=_0x23b946-0x0;var _0xcfad4f=_0xbdb7[_0x23b946];return _0xcfad4f;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require(_0x7bdb('0x2'));var timeout=require(_0x7bdb('0x3'));var express=require(_0x7bdb('0x4'));var router=express[_0x7bdb('0x5')]();var fs_extra=require(_0x7bdb('0x6'));var auth=require(_0x7bdb('0x7'));var interaction=require(_0x7bdb('0x8'));var config=require('../../config/environment');var controller=require(_0x7bdb('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x7bdb('0xa')]);router[_0x7bdb('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x7bdb('0xc')]);router[_0x7bdb('0xb')]('/:id/fields',auth['isAuthenticated'](),controller[_0x7bdb('0xd')]);router[_0x7bdb('0xb')](_0x7bdb('0xe'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x10')]);router[_0x7bdb('0xb')](_0x7bdb('0x11'),auth[_0x7bdb('0xf')](),controller['getDescriptions']);router['get']('/:id/tags',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x12')]);router['post']('/',auth[_0x7bdb('0xf')](),controller['create']);router['post'](_0x7bdb('0x13'),auth[_0x7bdb('0xf')](),controller['setTags']);router['put']('/:id',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x14')]);router[_0x7bdb('0x15')](_0x7bdb('0x16'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x17')]);module[_0x7bdb('0x18')]=router; \ No newline at end of file +var _0x757a=['index','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','setTags','put','/:id','update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get'];(function(_0x44c4ff,_0xabc5a4){var _0x415854=function(_0x4f414f){while(--_0x4f414f){_0x44c4ff['push'](_0x44c4ff['shift']());}};_0x415854(++_0xabc5a4);}(_0x757a,0xde));var _0xa757=function(_0x26cc6d,_0x93c155){_0x26cc6d=_0x26cc6d-0x0;var _0x19b11f=_0x757a[_0x26cc6d];return _0x19b11f;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['getFields']);router[_0xa757('0x7')](_0xa757('0xc'),auth[_0xa757('0x9')](),controller[_0xa757('0xd')]);router[_0xa757('0x7')](_0xa757('0xe'),auth[_0xa757('0x9')](),controller['getDescriptions']);router['get']('/:id/tags',auth['isAuthenticated'](),controller['getTags']);router[_0xa757('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa757('0xf')]('/:id/tags',auth['isAuthenticated'](),controller[_0xa757('0x10')]);router[_0xa757('0x11')](_0xa757('0x12'),auth[_0xa757('0x9')](),controller[_0xa757('0x13')]);router[_0xa757('0x14')](_0xa757('0x12'),auth[_0xa757('0x9')](),controller[_0xa757('0x15')]);module[_0xa757('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 4015a71..f832572 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 _0x9733=['sequelize','exports','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9733,0xfc));var _0x3973=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9733[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x3973('0x0'));module[_0x3973('0x1')]={'name':{'type':Sequelize[_0x3973('0x2')]},'description':{'type':Sequelize[_0x3973('0x2')]}}; \ No newline at end of file +var _0x606f=['sequelize','exports','STRING'];(function(_0x32bb25,_0x43d6ef){var _0x210ed3=function(_0x30466e){while(--_0x30466e){_0x32bb25['push'](_0x32bb25['shift']());}};_0x210ed3(++_0x43d6ef);}(_0x606f,0x78));var _0xf606=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x606f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf606('0x0'));module[_0xf606('0x1')]={'name':{'type':Sequelize[_0xf606('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index d9daeea..eed00ac 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 _0x2e6c=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','sendStatus','error','stack','name','index','ZendeskConfiguration','fieldName','type','key','model','map','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','include','rows','catch','keys','rawAttributes','length','find','create','body','params','getFields','findOne','ZendeskField','pick','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x2e6c,0x144));var _0xc2e6=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x2e6c[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0xc2e6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc2e6('0x1'));var jsonpatch=require(_0xc2e6('0x2'));var rp=require(_0xc2e6('0x3'));var moment=require(_0xc2e6('0x4'));var BPromise=require(_0xc2e6('0x5'));var Mustache=require(_0xc2e6('0x6'));var util=require('util');var path=require('path');var sox=require(_0xc2e6('0x7'));var csv=require(_0xc2e6('0x8'));var ejs=require(_0xc2e6('0x9'));var fs=require('fs');var fs_extra=require(_0xc2e6('0xa'));var _=require(_0xc2e6('0xb'));var squel=require(_0xc2e6('0xc'));var crypto=require(_0xc2e6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc2e6('0xe'));var toCsv=require(_0xc2e6('0x8'));var querystring=require(_0xc2e6('0xf'));var Papa=require(_0xc2e6('0x10'));var Redis=require(_0xc2e6('0x11'));var authService=require(_0xc2e6('0x12'));var qs=require(_0xc2e6('0x13'));var as=require(_0xc2e6('0x14'));var hardwareService=require(_0xc2e6('0x15'));var logger=require(_0xc2e6('0x16'))(_0xc2e6('0x17'));var utils=require(_0xc2e6('0x18'));var config=require(_0xc2e6('0x19'));var licenseUtil=require(_0xc2e6('0x1a'));var db=require(_0xc2e6('0x1b'))['db'];function respondWithStatusCode(_0x36e54b,_0xed06df){_0xed06df=_0xed06df||0xcc;return function(_0x18445e){if(_0x18445e){return _0x36e54b['sendStatus'](_0xed06df);}return _0x36e54b[_0xc2e6('0x1c')](_0xed06df)[_0xc2e6('0x1d')]();};}function respondWithResult(_0x596934,_0x5c792c){_0x5c792c=_0x5c792c||0xc8;return function(_0x1c694d){if(_0x1c694d){return _0x596934[_0xc2e6('0x1c')](_0x5c792c)[_0xc2e6('0x1e')](_0x1c694d);}};}function respondWithFilteredResult(_0x1a55d0,_0x11d284){return function(_0x53a482){if(_0x53a482){var _0x5222d8=typeof _0x11d284['offset']===_0xc2e6('0x1f')&&typeof _0x11d284[_0xc2e6('0x20')]===_0xc2e6('0x1f');var _0x3a8737=_0x53a482[_0xc2e6('0x21')];var _0x209811=_0x5222d8?0x0:_0x11d284[_0xc2e6('0x22')];var _0x51cbe=_0x5222d8?_0x53a482[_0xc2e6('0x21')]:_0x11d284[_0xc2e6('0x22')]+_0x11d284[_0xc2e6('0x20')];var _0x2cec49;if(_0x51cbe>=_0x3a8737){_0x51cbe=_0x3a8737;_0x2cec49=0xc8;}else{_0x2cec49=0xce;}_0x1a55d0[_0xc2e6('0x1c')](_0x2cec49);return _0x1a55d0[_0xc2e6('0x23')](_0xc2e6('0x24'),_0x209811+'-'+_0x51cbe+'/'+_0x3a8737)[_0xc2e6('0x1e')](_0x53a482);}return null;};}function patchUpdates(_0x1bf057){return function(_0x248aa5){try{jsonpatch[_0xc2e6('0x25')](_0x248aa5,_0x1bf057,!![]);}catch(_0x54c04c){return BPromise['reject'](_0x54c04c);}return _0x248aa5['save']();};}function saveUpdates(_0x1861ae,_0x145a78){return function(_0x4d358b){if(_0x4d358b){return _0x4d358b[_0xc2e6('0x26')](_0x1861ae)[_0xc2e6('0x27')](function(_0x988fe0){return _0x988fe0;});}return null;};}function removeEntity(_0x221858,_0x328f3c){return function(_0xfd4e8e){if(_0xfd4e8e){return _0xfd4e8e[_0xc2e6('0x28')]()[_0xc2e6('0x27')](function(){_0x221858['status'](0xcc)[_0xc2e6('0x1d')]();});}};}function handleEntityNotFound(_0x5b192b,_0x2fc353){return function(_0x44b7c1){if(!_0x44b7c1){_0x5b192b[_0xc2e6('0x29')](0x194);}return _0x44b7c1;};}function handleError(_0x404455,_0x35da11){_0x35da11=_0x35da11||0x1f4;return function(_0x33f961){logger[_0xc2e6('0x2a')](_0x33f961[_0xc2e6('0x2b')]);if(_0x33f961[_0xc2e6('0x2c')]){delete _0x33f961[_0xc2e6('0x2c')];}_0x404455[_0xc2e6('0x1c')](_0x35da11)['send'](_0x33f961);};}exports[_0xc2e6('0x2d')]=function(_0xa152da,_0x20f95b){var _0x3f43f8={},_0x3c3b0a={},_0x2cbad0={'count':0x0,'rows':[]};var _0x4563f3=_['map'](db[_0xc2e6('0x2e')]['rawAttributes'],function(_0x2c767d){return{'name':_0x2c767d[_0xc2e6('0x2f')],'type':_0x2c767d[_0xc2e6('0x30')][_0xc2e6('0x31')]};});_0x3c3b0a[_0xc2e6('0x32')]=_[_0xc2e6('0x33')](_0x4563f3,_0xc2e6('0x2c'));_0x3c3b0a['query']=_['keys'](_0xa152da[_0xc2e6('0x34')]);_0x3c3b0a['filters']=_[_0xc2e6('0x35')](_0x3c3b0a[_0xc2e6('0x32')],_0x3c3b0a['query']);_0x3f43f8[_0xc2e6('0x36')]=_[_0xc2e6('0x35')](_0x3c3b0a[_0xc2e6('0x32')],qs['fields'](_0xa152da[_0xc2e6('0x34')][_0xc2e6('0x37')]));_0x3f43f8[_0xc2e6('0x36')]=_0x3f43f8[_0xc2e6('0x36')]['length']?_0x3f43f8['attributes']:_0x3c3b0a[_0xc2e6('0x32')];if(!_0xa152da[_0xc2e6('0x34')][_0xc2e6('0x38')](_0xc2e6('0x39'))){_0x3f43f8[_0xc2e6('0x20')]=qs[_0xc2e6('0x20')](_0xa152da[_0xc2e6('0x34')][_0xc2e6('0x20')]);_0x3f43f8[_0xc2e6('0x22')]=qs[_0xc2e6('0x22')](_0xa152da[_0xc2e6('0x34')][_0xc2e6('0x22')]);}_0x3f43f8[_0xc2e6('0x3a')]=qs[_0xc2e6('0x3b')](_0xa152da[_0xc2e6('0x34')][_0xc2e6('0x3b')]);_0x3f43f8[_0xc2e6('0x3c')]=qs[_0xc2e6('0x3d')](_['pick'](_0xa152da['query'],_0x3c3b0a[_0xc2e6('0x3d')]),_0x4563f3);if(_0xa152da['query']['filter']){_0x3f43f8[_0xc2e6('0x3c')]=_[_0xc2e6('0x3e')](_0x3f43f8['where'],{'$or':_['map'](_0x4563f3,function(_0x14efcf){if(_0x14efcf[_0xc2e6('0x30')]!==_0xc2e6('0x3f')){var _0xf218a6={};_0xf218a6[_0x14efcf[_0xc2e6('0x2c')]]={'$like':'%'+_0xa152da[_0xc2e6('0x34')][_0xc2e6('0x40')]+'%'};return _0xf218a6;}})});}_0x3f43f8=_[_0xc2e6('0x3e')]({},_0x3f43f8,_0xa152da[_0xc2e6('0x41')]);var _0x5ce53d={'where':_0x3f43f8['where']};return db[_0xc2e6('0x2e')][_0xc2e6('0x21')](_0x5ce53d)[_0xc2e6('0x27')](function(_0x41f83d){_0x2cbad0['count']=_0x41f83d;if(_0xa152da[_0xc2e6('0x34')]['includeAll']){_0x3f43f8[_0xc2e6('0x42')]=[{'all':!![]}];}return db[_0xc2e6('0x2e')]['findAll'](_0x3f43f8);})[_0xc2e6('0x27')](function(_0x5b8294){_0x2cbad0[_0xc2e6('0x43')]=_0x5b8294;return _0x2cbad0;})[_0xc2e6('0x27')](respondWithFilteredResult(_0x20f95b,_0x3f43f8))[_0xc2e6('0x44')](handleError(_0x20f95b,null));};exports['show']=function(_0x3b137e,_0x47185f){var _0x5c7035={'raw':![],'where':{'id':_0x3b137e['params']['id']}},_0x42de36={};_0x42de36[_0xc2e6('0x32')]=_[_0xc2e6('0x45')](db[_0xc2e6('0x2e')][_0xc2e6('0x46')]);_0x42de36['query']=_[_0xc2e6('0x45')](_0x3b137e['query']);_0x42de36[_0xc2e6('0x3d')]=_[_0xc2e6('0x35')](_0x42de36[_0xc2e6('0x32')],_0x42de36[_0xc2e6('0x34')]);_0x5c7035[_0xc2e6('0x36')]=_['intersection'](_0x42de36[_0xc2e6('0x32')],qs['fields'](_0x3b137e[_0xc2e6('0x34')]['fields']));_0x5c7035[_0xc2e6('0x36')]=_0x5c7035[_0xc2e6('0x36')][_0xc2e6('0x47')]?_0x5c7035[_0xc2e6('0x36')]:_0x42de36[_0xc2e6('0x32')];if(_0x3b137e[_0xc2e6('0x34')]['includeAll']){_0x5c7035[_0xc2e6('0x42')]=[{'all':!![]}];}_0x5c7035=_['merge']({},_0x5c7035,_0x3b137e[_0xc2e6('0x41')]);return db[_0xc2e6('0x2e')][_0xc2e6('0x48')](_0x5c7035)[_0xc2e6('0x27')](handleEntityNotFound(_0x47185f,null))['then'](respondWithResult(_0x47185f,null))[_0xc2e6('0x44')](handleError(_0x47185f,null));};exports[_0xc2e6('0x49')]=function(_0x4ccf98,_0x1928a4){return db[_0xc2e6('0x2e')][_0xc2e6('0x49')](_0x4ccf98[_0xc2e6('0x4a')],{})[_0xc2e6('0x27')](respondWithResult(_0x1928a4,0xc9))[_0xc2e6('0x44')](handleError(_0x1928a4,null));};exports[_0xc2e6('0x26')]=function(_0x1b7866,_0x3c227a){if(_0x1b7866[_0xc2e6('0x4a')]['id']){delete _0x1b7866[_0xc2e6('0x4a')]['id'];}return db[_0xc2e6('0x2e')][_0xc2e6('0x48')]({'where':{'id':_0x1b7866[_0xc2e6('0x4b')]['id']}})[_0xc2e6('0x27')](handleEntityNotFound(_0x3c227a,null))[_0xc2e6('0x27')](saveUpdates(_0x1b7866[_0xc2e6('0x4a')],null))[_0xc2e6('0x27')](respondWithResult(_0x3c227a,null))[_0xc2e6('0x44')](handleError(_0x3c227a,null));};exports[_0xc2e6('0x28')]=function(_0x5e09c2,_0x5e1df0){return db[_0xc2e6('0x2e')][_0xc2e6('0x48')]({'where':{'id':_0x5e09c2[_0xc2e6('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5e1df0,null))[_0xc2e6('0x27')](removeEntity(_0x5e1df0,null))['catch'](handleError(_0x5e1df0,null));};exports[_0xc2e6('0x4c')]=function(_0x27d1b3,_0xde1c57,_0xb26218){var _0x44537e={};var _0x2c70b3={};var _0xde1e6e;var _0x1e8c36;return db['ZendeskConfiguration'][_0xc2e6('0x4d')]({'where':{'id':_0x27d1b3[_0xc2e6('0x4b')]['id']}})[_0xc2e6('0x27')](handleEntityNotFound(_0xde1c57,null))[_0xc2e6('0x27')](function(_0x26b0a3){if(_0x26b0a3){_0xde1e6e=_0x26b0a3;_0x2c70b3[_0xc2e6('0x32')]=_[_0xc2e6('0x45')](db[_0xc2e6('0x4e')][_0xc2e6('0x46')]);_0x2c70b3[_0xc2e6('0x34')]=_[_0xc2e6('0x45')](_0x27d1b3[_0xc2e6('0x34')]);_0x2c70b3[_0xc2e6('0x3d')]=_[_0xc2e6('0x35')](_0x2c70b3['model'],_0x2c70b3['query']);_0x44537e['attributes']=_[_0xc2e6('0x35')](_0x2c70b3[_0xc2e6('0x32')],qs[_0xc2e6('0x37')](_0x27d1b3[_0xc2e6('0x34')]['fields']));_0x44537e[_0xc2e6('0x36')]=_0x44537e[_0xc2e6('0x36')][_0xc2e6('0x47')]?_0x44537e['attributes']:_0x2c70b3[_0xc2e6('0x32')];_0x44537e['order']=qs[_0xc2e6('0x3b')](_0x27d1b3[_0xc2e6('0x34')][_0xc2e6('0x3b')]);_0x44537e[_0xc2e6('0x3c')]=qs['filters'](_['pick'](_0x27d1b3[_0xc2e6('0x34')],_0x2c70b3[_0xc2e6('0x3d')]));if(_0x27d1b3[_0xc2e6('0x34')][_0xc2e6('0x40')]){_0x44537e[_0xc2e6('0x3c')]=_['merge'](_0x44537e[_0xc2e6('0x3c')],{'$or':_[_0xc2e6('0x33')](_0x44537e[_0xc2e6('0x36')],function(_0x38e79e){var _0x476eb7={};_0x476eb7[_0x38e79e]={'$like':'%'+_0x27d1b3['query']['filter']+'%'};return _0x476eb7;})});}_0x44537e=_[_0xc2e6('0x3e')]({},_0x44537e,_0x27d1b3[_0xc2e6('0x41')]);return _0xde1e6e['getFields'](_0x44537e);}})[_0xc2e6('0x27')](function(_0x5a7ec9){if(_0x5a7ec9){_0x1e8c36=_0x5a7ec9[_0xc2e6('0x47')];if(!_0x27d1b3[_0xc2e6('0x34')][_0xc2e6('0x38')](_0xc2e6('0x39'))){_0x44537e[_0xc2e6('0x20')]=qs[_0xc2e6('0x20')](_0x27d1b3[_0xc2e6('0x34')][_0xc2e6('0x20')]);_0x44537e[_0xc2e6('0x22')]=qs[_0xc2e6('0x22')](_0x27d1b3['query']['offset']);}return _0xde1e6e[_0xc2e6('0x4c')](_0x44537e);}})['then'](function(_0x2ef4f9){if(_0x2ef4f9){return _0x2ef4f9?{'count':_0x1e8c36,'rows':_0x2ef4f9}:null;}})[_0xc2e6('0x27')](respondWithResult(_0xde1c57,null))[_0xc2e6('0x44')](handleError(_0xde1c57,null));};exports['getSubjects']=function(_0x565ef3,_0x520617,_0x3ebde8){var _0xeb36f0={};var _0x3c7270={};var _0x44615d;var _0x47dff4;return db[_0xc2e6('0x2e')]['findOne']({'where':{'id':_0x565ef3['params']['id']}})[_0xc2e6('0x27')](handleEntityNotFound(_0x520617,null))['then'](function(_0x6eced2){if(_0x6eced2){_0x44615d=_0x6eced2;_0x3c7270[_0xc2e6('0x32')]=_[_0xc2e6('0x45')](db[_0xc2e6('0x4e')]['rawAttributes']);_0x3c7270[_0xc2e6('0x34')]=_[_0xc2e6('0x45')](_0x565ef3[_0xc2e6('0x34')]);_0x3c7270[_0xc2e6('0x3d')]=_['intersection'](_0x3c7270[_0xc2e6('0x32')],_0x3c7270[_0xc2e6('0x34')]);_0xeb36f0[_0xc2e6('0x36')]=_[_0xc2e6('0x35')](_0x3c7270[_0xc2e6('0x32')],qs[_0xc2e6('0x37')](_0x565ef3[_0xc2e6('0x34')][_0xc2e6('0x37')]));_0xeb36f0[_0xc2e6('0x36')]=_0xeb36f0[_0xc2e6('0x36')][_0xc2e6('0x47')]?_0xeb36f0['attributes']:_0x3c7270[_0xc2e6('0x32')];_0xeb36f0[_0xc2e6('0x3a')]=qs['sort'](_0x565ef3[_0xc2e6('0x34')][_0xc2e6('0x3b')]);_0xeb36f0['where']=qs[_0xc2e6('0x3d')](_[_0xc2e6('0x4f')](_0x565ef3[_0xc2e6('0x34')],_0x3c7270[_0xc2e6('0x3d')]));if(_0x565ef3[_0xc2e6('0x34')][_0xc2e6('0x40')]){_0xeb36f0[_0xc2e6('0x3c')]=_[_0xc2e6('0x3e')](_0xeb36f0[_0xc2e6('0x3c')],{'$or':_[_0xc2e6('0x33')](_0xeb36f0['attributes'],function(_0x45c0e1){var _0x3b3b8a={};_0x3b3b8a[_0x45c0e1]={'$like':'%'+_0x565ef3[_0xc2e6('0x34')][_0xc2e6('0x40')]+'%'};return _0x3b3b8a;})});}_0xeb36f0=_[_0xc2e6('0x3e')]({},_0xeb36f0,_0x565ef3['options']);return _0x44615d['getSubjects'](_0xeb36f0);}})[_0xc2e6('0x27')](function(_0x57b01c){if(_0x57b01c){_0x47dff4=_0x57b01c['length'];if(!_0x565ef3['query']['hasOwnProperty'](_0xc2e6('0x39'))){_0xeb36f0[_0xc2e6('0x20')]=qs['limit'](_0x565ef3['query'][_0xc2e6('0x20')]);_0xeb36f0['offset']=qs[_0xc2e6('0x22')](_0x565ef3[_0xc2e6('0x34')][_0xc2e6('0x22')]);}return _0x44615d[_0xc2e6('0x50')](_0xeb36f0);}})[_0xc2e6('0x27')](function(_0x30eb54){if(_0x30eb54){return _0x30eb54?{'count':_0x47dff4,'rows':_0x30eb54}:null;}})['then'](respondWithResult(_0x520617,null))[_0xc2e6('0x44')](handleError(_0x520617,null));};exports[_0xc2e6('0x51')]=function(_0x38e5f9,_0x349721,_0x515337){var _0x358a4e={};var _0x4a366c={};var _0x3fb645;var _0x397529;return db[_0xc2e6('0x2e')][_0xc2e6('0x4d')]({'where':{'id':_0x38e5f9[_0xc2e6('0x4b')]['id']}})[_0xc2e6('0x27')](handleEntityNotFound(_0x349721,null))[_0xc2e6('0x27')](function(_0x4e109d){if(_0x4e109d){_0x3fb645=_0x4e109d;_0x4a366c[_0xc2e6('0x32')]=_[_0xc2e6('0x45')](db[_0xc2e6('0x4e')][_0xc2e6('0x46')]);_0x4a366c[_0xc2e6('0x34')]=_['keys'](_0x38e5f9['query']);_0x4a366c[_0xc2e6('0x3d')]=_[_0xc2e6('0x35')](_0x4a366c[_0xc2e6('0x32')],_0x4a366c[_0xc2e6('0x34')]);_0x358a4e[_0xc2e6('0x36')]=_['intersection'](_0x4a366c['model'],qs[_0xc2e6('0x37')](_0x38e5f9['query']['fields']));_0x358a4e[_0xc2e6('0x36')]=_0x358a4e[_0xc2e6('0x36')]['length']?_0x358a4e[_0xc2e6('0x36')]:_0x4a366c[_0xc2e6('0x32')];_0x358a4e[_0xc2e6('0x3a')]=qs[_0xc2e6('0x3b')](_0x38e5f9[_0xc2e6('0x34')][_0xc2e6('0x3b')]);_0x358a4e[_0xc2e6('0x3c')]=qs[_0xc2e6('0x3d')](_[_0xc2e6('0x4f')](_0x38e5f9[_0xc2e6('0x34')],_0x4a366c[_0xc2e6('0x3d')]));if(_0x38e5f9['query']['filter']){_0x358a4e[_0xc2e6('0x3c')]=_[_0xc2e6('0x3e')](_0x358a4e['where'],{'$or':_[_0xc2e6('0x33')](_0x358a4e[_0xc2e6('0x36')],function(_0x4559dd){var _0x3c8ed4={};_0x3c8ed4[_0x4559dd]={'$like':'%'+_0x38e5f9[_0xc2e6('0x34')][_0xc2e6('0x40')]+'%'};return _0x3c8ed4;})});}_0x358a4e=_['merge']({},_0x358a4e,_0x38e5f9['options']);return _0x3fb645['getDescriptions'](_0x358a4e);}})[_0xc2e6('0x27')](function(_0x1c347c){if(_0x1c347c){_0x397529=_0x1c347c['length'];if(!_0x38e5f9[_0xc2e6('0x34')]['hasOwnProperty'](_0xc2e6('0x39'))){_0x358a4e[_0xc2e6('0x20')]=qs[_0xc2e6('0x20')](_0x38e5f9['query'][_0xc2e6('0x20')]);_0x358a4e[_0xc2e6('0x22')]=qs[_0xc2e6('0x22')](_0x38e5f9[_0xc2e6('0x34')][_0xc2e6('0x22')]);}return _0x3fb645[_0xc2e6('0x51')](_0x358a4e);}})[_0xc2e6('0x27')](function(_0x2707a8){if(_0x2707a8){return _0x2707a8?{'count':_0x397529,'rows':_0x2707a8}:null;}})[_0xc2e6('0x27')](respondWithResult(_0x349721,null))['catch'](handleError(_0x349721,null));};exports['getTags']=function(_0x533c90,_0x5b59ba,_0x3f89de){var _0x1e8677={};var _0x128a94={};var _0x3cb499;var _0x20e736;return db['ZendeskConfiguration'][_0xc2e6('0x4d')]({'where':{'id':_0x533c90['params']['id']}})[_0xc2e6('0x27')](handleEntityNotFound(_0x5b59ba,null))[_0xc2e6('0x27')](function(_0x112628){if(_0x112628){_0x3cb499=_0x112628;_0x128a94[_0xc2e6('0x32')]=_[_0xc2e6('0x45')](db[_0xc2e6('0x52')]['rawAttributes']);_0x128a94['query']=_[_0xc2e6('0x45')](_0x533c90[_0xc2e6('0x34')]);_0x128a94[_0xc2e6('0x3d')]=_[_0xc2e6('0x35')](_0x128a94[_0xc2e6('0x32')],_0x128a94[_0xc2e6('0x34')]);_0x1e8677[_0xc2e6('0x36')]=_[_0xc2e6('0x35')](_0x128a94[_0xc2e6('0x32')],qs[_0xc2e6('0x37')](_0x533c90[_0xc2e6('0x34')][_0xc2e6('0x37')]));_0x1e8677[_0xc2e6('0x36')]=_0x1e8677[_0xc2e6('0x36')][_0xc2e6('0x47')]?_0x1e8677[_0xc2e6('0x36')]:_0x128a94[_0xc2e6('0x32')];_0x1e8677['order']=qs['sort'](_0x533c90[_0xc2e6('0x34')]['sort']);_0x1e8677[_0xc2e6('0x3c')]=qs[_0xc2e6('0x3d')](_[_0xc2e6('0x4f')](_0x533c90['query'],_0x128a94['filters']));if(_0x533c90[_0xc2e6('0x34')]['filter']){_0x1e8677[_0xc2e6('0x3c')]=_[_0xc2e6('0x3e')](_0x1e8677[_0xc2e6('0x3c')],{'$or':_[_0xc2e6('0x33')](_0x1e8677['attributes'],function(_0x335def){var _0x3eb6f8={};_0x3eb6f8[_0x335def]={'$like':'%'+_0x533c90[_0xc2e6('0x34')]['filter']+'%'};return _0x3eb6f8;})});}_0x1e8677=_[_0xc2e6('0x3e')]({},_0x1e8677,_0x533c90[_0xc2e6('0x41')]);return _0x3cb499['getTags'](_0x1e8677);}})[_0xc2e6('0x27')](function(_0x21c585){if(_0x21c585){_0x20e736=_0x21c585[_0xc2e6('0x47')];if(!_0x533c90['query'][_0xc2e6('0x38')](_0xc2e6('0x39'))){_0x1e8677[_0xc2e6('0x20')]=qs[_0xc2e6('0x20')](_0x533c90[_0xc2e6('0x34')]['limit']);_0x1e8677[_0xc2e6('0x22')]=qs['offset'](_0x533c90[_0xc2e6('0x34')][_0xc2e6('0x22')]);}return _0x3cb499[_0xc2e6('0x53')](_0x1e8677);}})[_0xc2e6('0x27')](function(_0x2228e8){if(_0x2228e8){return _0x2228e8?{'count':_0x20e736,'rows':_0x2228e8}:null;}})[_0xc2e6('0x27')](respondWithResult(_0x5b59ba,null))[_0xc2e6('0x44')](handleError(_0x5b59ba,null));};exports[_0xc2e6('0x54')]=function(_0x2eaef3,_0x5bf311,_0x3bf184){if(_0x2eaef3['body']['id']){delete _0x2eaef3['body']['id'];}return db[_0xc2e6('0x2e')]['findOne']({'where':{'id':_0x2eaef3['params']['id']}})['then'](handleEntityNotFound(_0x5bf311,null))[_0xc2e6('0x27')](function(_0x1a765a){if(_0x1a765a){return _0x1a765a[_0xc2e6('0x54')](_0x2eaef3[_0xc2e6('0x4a')][_0xc2e6('0x55')]||[]);}return null;})['then'](respondWithResult(_0x5bf311,null))['catch'](handleError(_0x5bf311,null));}; \ No newline at end of file +var _0xed23=['limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','body','update','getFields','findOne','ZendeskField','rawAttributes','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','reject','then','destroy','error','stack','send','index','map','ZendeskConfiguration','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xed23,0xc5));var _0x3ed2=function(_0x41fc0f,_0x684f1a){_0x41fc0f=_0x41fc0f-0x0;var _0x1b1c37=_0xed23[_0x41fc0f];return _0x1b1c37;};'use strict';var emlformat=require(_0x3ed2('0x0'));var rimraf=require(_0x3ed2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3ed2('0x2'));var rp=require(_0x3ed2('0x3'));var moment=require(_0x3ed2('0x4'));var BPromise=require(_0x3ed2('0x5'));var Mustache=require(_0x3ed2('0x6'));var util=require(_0x3ed2('0x7'));var path=require(_0x3ed2('0x8'));var sox=require(_0x3ed2('0x9'));var csv=require(_0x3ed2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3ed2('0xb'));var _=require(_0x3ed2('0xc'));var squel=require(_0x3ed2('0xd'));var crypto=require(_0x3ed2('0xe'));var jsforce=require(_0x3ed2('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3ed2('0x10'));var Papa=require(_0x3ed2('0x11'));var Redis=require(_0x3ed2('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3ed2('0x13'));var as=require(_0x3ed2('0x14'));var hardwareService=require(_0x3ed2('0x15'));var logger=require(_0x3ed2('0x16'))(_0x3ed2('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3ed2('0x18'))['db'];function respondWithStatusCode(_0x4c7704,_0x2b231a){_0x2b231a=_0x2b231a||0xcc;return function(_0x30e393){if(_0x30e393){return _0x4c7704[_0x3ed2('0x19')](_0x2b231a);}return _0x4c7704[_0x3ed2('0x1a')](_0x2b231a)[_0x3ed2('0x1b')]();};}function respondWithResult(_0x4131ee,_0x48ea9e){_0x48ea9e=_0x48ea9e||0xc8;return function(_0x55d96f){if(_0x55d96f){return _0x4131ee[_0x3ed2('0x1a')](_0x48ea9e)[_0x3ed2('0x1c')](_0x55d96f);}};}function respondWithFilteredResult(_0x774268,_0xef1f44){return function(_0x4f5a39){if(_0x4f5a39){var _0x41e9d5=typeof _0xef1f44[_0x3ed2('0x1d')]===_0x3ed2('0x1e')&&typeof _0xef1f44['limit']===_0x3ed2('0x1e');var _0x248a0c=_0x4f5a39[_0x3ed2('0x1f')];var _0x3999ed=_0x41e9d5?0x0:_0xef1f44[_0x3ed2('0x1d')];var _0x1e223a=_0x41e9d5?_0x4f5a39[_0x3ed2('0x1f')]:_0xef1f44[_0x3ed2('0x1d')]+_0xef1f44['limit'];var _0x27c14e;if(_0x1e223a>=_0x248a0c){_0x1e223a=_0x248a0c;_0x27c14e=0xc8;}else{_0x27c14e=0xce;}_0x774268['status'](_0x27c14e);return _0x774268[_0x3ed2('0x20')]('Content-Range',_0x3999ed+'-'+_0x1e223a+'/'+_0x248a0c)[_0x3ed2('0x1c')](_0x4f5a39);}return null;};}function patchUpdates(_0x726865){return function(_0x5c463c){try{jsonpatch['apply'](_0x5c463c,_0x726865,!![]);}catch(_0x36c115){return BPromise[_0x3ed2('0x21')](_0x36c115);}return _0x5c463c['save']();};}function saveUpdates(_0x3f6428,_0x1199eb){return function(_0xeaa5f5){if(_0xeaa5f5){return _0xeaa5f5['update'](_0x3f6428)[_0x3ed2('0x22')](function(_0x586d9d){return _0x586d9d;});}return null;};}function removeEntity(_0x10b045,_0x300ca8){return function(_0x3035bd){if(_0x3035bd){return _0x3035bd[_0x3ed2('0x23')]()[_0x3ed2('0x22')](function(){_0x10b045['status'](0xcc)[_0x3ed2('0x1b')]();});}};}function handleEntityNotFound(_0x4005cd,_0x2d1ff1){return function(_0x376ee9){if(!_0x376ee9){_0x4005cd[_0x3ed2('0x19')](0x194);}return _0x376ee9;};}function handleError(_0x25ae26,_0x5a8cdb){_0x5a8cdb=_0x5a8cdb||0x1f4;return function(_0x34059d){logger[_0x3ed2('0x24')](_0x34059d[_0x3ed2('0x25')]);if(_0x34059d['name']){delete _0x34059d['name'];}_0x25ae26[_0x3ed2('0x1a')](_0x5a8cdb)[_0x3ed2('0x26')](_0x34059d);};}exports[_0x3ed2('0x27')]=function(_0x3facbf,_0x119348){var _0x2a1cc2={},_0x2c10b8={},_0x5802da={'count':0x0,'rows':[]};var _0x46e23d=_[_0x3ed2('0x28')](db[_0x3ed2('0x29')]['rawAttributes'],function(_0x5ea1c5){return{'name':_0x5ea1c5['fieldName'],'type':_0x5ea1c5[_0x3ed2('0x2a')][_0x3ed2('0x2b')]};});_0x2c10b8[_0x3ed2('0x2c')]=_['map'](_0x46e23d,_0x3ed2('0x2d'));_0x2c10b8[_0x3ed2('0x2e')]=_[_0x3ed2('0x2f')](_0x3facbf[_0x3ed2('0x2e')]);_0x2c10b8[_0x3ed2('0x30')]=_[_0x3ed2('0x31')](_0x2c10b8[_0x3ed2('0x2c')],_0x2c10b8['query']);_0x2a1cc2['attributes']=_['intersection'](_0x2c10b8[_0x3ed2('0x2c')],qs[_0x3ed2('0x32')](_0x3facbf['query'][_0x3ed2('0x32')]));_0x2a1cc2[_0x3ed2('0x33')]=_0x2a1cc2['attributes'][_0x3ed2('0x34')]?_0x2a1cc2[_0x3ed2('0x33')]:_0x2c10b8[_0x3ed2('0x2c')];if(!_0x3facbf[_0x3ed2('0x2e')][_0x3ed2('0x35')](_0x3ed2('0x36'))){_0x2a1cc2[_0x3ed2('0x37')]=qs[_0x3ed2('0x37')](_0x3facbf[_0x3ed2('0x2e')][_0x3ed2('0x37')]);_0x2a1cc2[_0x3ed2('0x1d')]=qs[_0x3ed2('0x1d')](_0x3facbf[_0x3ed2('0x2e')][_0x3ed2('0x1d')]);}_0x2a1cc2[_0x3ed2('0x38')]=qs[_0x3ed2('0x39')](_0x3facbf[_0x3ed2('0x2e')][_0x3ed2('0x39')]);_0x2a1cc2[_0x3ed2('0x3a')]=qs[_0x3ed2('0x30')](_[_0x3ed2('0x3b')](_0x3facbf['query'],_0x2c10b8[_0x3ed2('0x30')]),_0x46e23d);if(_0x3facbf[_0x3ed2('0x2e')][_0x3ed2('0x3c')]){_0x2a1cc2[_0x3ed2('0x3a')]=_[_0x3ed2('0x3d')](_0x2a1cc2['where'],{'$or':_[_0x3ed2('0x28')](_0x46e23d,function(_0x18c691){if(_0x18c691[_0x3ed2('0x2a')]!==_0x3ed2('0x3e')){var _0x97dde5={};_0x97dde5[_0x18c691[_0x3ed2('0x2d')]]={'$like':'%'+_0x3facbf[_0x3ed2('0x2e')]['filter']+'%'};return _0x97dde5;}})});}_0x2a1cc2=_[_0x3ed2('0x3d')]({},_0x2a1cc2,_0x3facbf['options']);var _0x4f217d={'where':_0x2a1cc2[_0x3ed2('0x3a')]};return db[_0x3ed2('0x29')][_0x3ed2('0x1f')](_0x4f217d)[_0x3ed2('0x22')](function(_0x1e014e){_0x5802da[_0x3ed2('0x1f')]=_0x1e014e;if(_0x3facbf['query'][_0x3ed2('0x3f')]){_0x2a1cc2[_0x3ed2('0x40')]=[{'all':!![]}];}return db[_0x3ed2('0x29')][_0x3ed2('0x41')](_0x2a1cc2);})['then'](function(_0x3d1f72){_0x5802da[_0x3ed2('0x42')]=_0x3d1f72;return _0x5802da;})[_0x3ed2('0x22')](respondWithFilteredResult(_0x119348,_0x2a1cc2))[_0x3ed2('0x43')](handleError(_0x119348,null));};exports[_0x3ed2('0x44')]=function(_0x37036e,_0x64d6c6){var _0x58084c={'raw':![],'where':{'id':_0x37036e[_0x3ed2('0x45')]['id']}},_0x232bbe={};_0x232bbe[_0x3ed2('0x2c')]=_[_0x3ed2('0x2f')](db[_0x3ed2('0x29')]['rawAttributes']);_0x232bbe['query']=_[_0x3ed2('0x2f')](_0x37036e[_0x3ed2('0x2e')]);_0x232bbe['filters']=_[_0x3ed2('0x31')](_0x232bbe[_0x3ed2('0x2c')],_0x232bbe[_0x3ed2('0x2e')]);_0x58084c[_0x3ed2('0x33')]=_[_0x3ed2('0x31')](_0x232bbe[_0x3ed2('0x2c')],qs[_0x3ed2('0x32')](_0x37036e['query']['fields']));_0x58084c[_0x3ed2('0x33')]=_0x58084c[_0x3ed2('0x33')][_0x3ed2('0x34')]?_0x58084c['attributes']:_0x232bbe[_0x3ed2('0x2c')];if(_0x37036e[_0x3ed2('0x2e')][_0x3ed2('0x3f')]){_0x58084c[_0x3ed2('0x40')]=[{'all':!![]}];}_0x58084c=_[_0x3ed2('0x3d')]({},_0x58084c,_0x37036e[_0x3ed2('0x46')]);return db[_0x3ed2('0x29')][_0x3ed2('0x47')](_0x58084c)[_0x3ed2('0x22')](handleEntityNotFound(_0x64d6c6,null))[_0x3ed2('0x22')](respondWithResult(_0x64d6c6,null))[_0x3ed2('0x43')](handleError(_0x64d6c6,null));};exports['create']=function(_0x413dcb,_0x228b52){return db[_0x3ed2('0x29')]['create'](_0x413dcb[_0x3ed2('0x48')],{})[_0x3ed2('0x22')](respondWithResult(_0x228b52,0xc9))[_0x3ed2('0x43')](handleError(_0x228b52,null));};exports[_0x3ed2('0x49')]=function(_0x5c28d8,_0x504ddb){if(_0x5c28d8[_0x3ed2('0x48')]['id']){delete _0x5c28d8[_0x3ed2('0x48')]['id'];}return db[_0x3ed2('0x29')][_0x3ed2('0x47')]({'where':{'id':_0x5c28d8['params']['id']}})['then'](handleEntityNotFound(_0x504ddb,null))[_0x3ed2('0x22')](saveUpdates(_0x5c28d8[_0x3ed2('0x48')],null))[_0x3ed2('0x22')](respondWithResult(_0x504ddb,null))[_0x3ed2('0x43')](handleError(_0x504ddb,null));};exports['destroy']=function(_0x54f4c5,_0x57cc9b){return db['ZendeskConfiguration'][_0x3ed2('0x47')]({'where':{'id':_0x54f4c5[_0x3ed2('0x45')]['id']}})[_0x3ed2('0x22')](handleEntityNotFound(_0x57cc9b,null))[_0x3ed2('0x22')](removeEntity(_0x57cc9b,null))[_0x3ed2('0x43')](handleError(_0x57cc9b,null));};exports[_0x3ed2('0x4a')]=function(_0x1bc5ca,_0x5c56b2,_0x13312a){var _0x54fe1a={};var _0x3a5421={};var _0x58489d;var _0x215fa8;return db['ZendeskConfiguration'][_0x3ed2('0x4b')]({'where':{'id':_0x1bc5ca[_0x3ed2('0x45')]['id']}})[_0x3ed2('0x22')](handleEntityNotFound(_0x5c56b2,null))[_0x3ed2('0x22')](function(_0x229fd0){if(_0x229fd0){_0x58489d=_0x229fd0;_0x3a5421[_0x3ed2('0x2c')]=_['keys'](db[_0x3ed2('0x4c')][_0x3ed2('0x4d')]);_0x3a5421['query']=_[_0x3ed2('0x2f')](_0x1bc5ca[_0x3ed2('0x2e')]);_0x3a5421[_0x3ed2('0x30')]=_['intersection'](_0x3a5421[_0x3ed2('0x2c')],_0x3a5421[_0x3ed2('0x2e')]);_0x54fe1a[_0x3ed2('0x33')]=_[_0x3ed2('0x31')](_0x3a5421[_0x3ed2('0x2c')],qs[_0x3ed2('0x32')](_0x1bc5ca[_0x3ed2('0x2e')]['fields']));_0x54fe1a['attributes']=_0x54fe1a[_0x3ed2('0x33')][_0x3ed2('0x34')]?_0x54fe1a[_0x3ed2('0x33')]:_0x3a5421[_0x3ed2('0x2c')];_0x54fe1a[_0x3ed2('0x38')]=qs[_0x3ed2('0x39')](_0x1bc5ca[_0x3ed2('0x2e')][_0x3ed2('0x39')]);_0x54fe1a[_0x3ed2('0x3a')]=qs[_0x3ed2('0x30')](_[_0x3ed2('0x3b')](_0x1bc5ca[_0x3ed2('0x2e')],_0x3a5421[_0x3ed2('0x30')]));if(_0x1bc5ca[_0x3ed2('0x2e')][_0x3ed2('0x3c')]){_0x54fe1a[_0x3ed2('0x3a')]=_['merge'](_0x54fe1a[_0x3ed2('0x3a')],{'$or':_[_0x3ed2('0x28')](_0x54fe1a['attributes'],function(_0x296028){var _0xfbc773={};_0xfbc773[_0x296028]={'$like':'%'+_0x1bc5ca[_0x3ed2('0x2e')][_0x3ed2('0x3c')]+'%'};return _0xfbc773;})});}_0x54fe1a=_[_0x3ed2('0x3d')]({},_0x54fe1a,_0x1bc5ca[_0x3ed2('0x46')]);return _0x58489d['getFields'](_0x54fe1a);}})['then'](function(_0xb8a147){if(_0xb8a147){_0x215fa8=_0xb8a147[_0x3ed2('0x34')];if(!_0x1bc5ca['query'][_0x3ed2('0x35')](_0x3ed2('0x36'))){_0x54fe1a[_0x3ed2('0x37')]=qs[_0x3ed2('0x37')](_0x1bc5ca[_0x3ed2('0x2e')][_0x3ed2('0x37')]);_0x54fe1a[_0x3ed2('0x1d')]=qs[_0x3ed2('0x1d')](_0x1bc5ca[_0x3ed2('0x2e')][_0x3ed2('0x1d')]);}return _0x58489d[_0x3ed2('0x4a')](_0x54fe1a);}})[_0x3ed2('0x22')](function(_0x4ab786){if(_0x4ab786){return _0x4ab786?{'count':_0x215fa8,'rows':_0x4ab786}:null;}})[_0x3ed2('0x22')](respondWithResult(_0x5c56b2,null))[_0x3ed2('0x43')](handleError(_0x5c56b2,null));};exports['getSubjects']=function(_0x497a6b,_0x417ad5,_0x49b0c8){var _0x47271b={};var _0x280a27={};var _0xafbe9d;var _0x6376a1;return db[_0x3ed2('0x29')][_0x3ed2('0x4b')]({'where':{'id':_0x497a6b[_0x3ed2('0x45')]['id']}})['then'](handleEntityNotFound(_0x417ad5,null))['then'](function(_0x5ed9ae){if(_0x5ed9ae){_0xafbe9d=_0x5ed9ae;_0x280a27[_0x3ed2('0x2c')]=_[_0x3ed2('0x2f')](db['ZendeskField'][_0x3ed2('0x4d')]);_0x280a27[_0x3ed2('0x2e')]=_['keys'](_0x497a6b[_0x3ed2('0x2e')]);_0x280a27[_0x3ed2('0x30')]=_['intersection'](_0x280a27[_0x3ed2('0x2c')],_0x280a27[_0x3ed2('0x2e')]);_0x47271b['attributes']=_['intersection'](_0x280a27[_0x3ed2('0x2c')],qs[_0x3ed2('0x32')](_0x497a6b[_0x3ed2('0x2e')][_0x3ed2('0x32')]));_0x47271b[_0x3ed2('0x33')]=_0x47271b[_0x3ed2('0x33')][_0x3ed2('0x34')]?_0x47271b[_0x3ed2('0x33')]:_0x280a27[_0x3ed2('0x2c')];_0x47271b[_0x3ed2('0x38')]=qs['sort'](_0x497a6b[_0x3ed2('0x2e')][_0x3ed2('0x39')]);_0x47271b['where']=qs['filters'](_['pick'](_0x497a6b[_0x3ed2('0x2e')],_0x280a27[_0x3ed2('0x30')]));if(_0x497a6b[_0x3ed2('0x2e')][_0x3ed2('0x3c')]){_0x47271b[_0x3ed2('0x3a')]=_[_0x3ed2('0x3d')](_0x47271b[_0x3ed2('0x3a')],{'$or':_[_0x3ed2('0x28')](_0x47271b[_0x3ed2('0x33')],function(_0x4788b4){var _0x485b89={};_0x485b89[_0x4788b4]={'$like':'%'+_0x497a6b['query'][_0x3ed2('0x3c')]+'%'};return _0x485b89;})});}_0x47271b=_[_0x3ed2('0x3d')]({},_0x47271b,_0x497a6b[_0x3ed2('0x46')]);return _0xafbe9d[_0x3ed2('0x4e')](_0x47271b);}})['then'](function(_0xd62360){if(_0xd62360){_0x6376a1=_0xd62360[_0x3ed2('0x34')];if(!_0x497a6b['query']['hasOwnProperty'](_0x3ed2('0x36'))){_0x47271b[_0x3ed2('0x37')]=qs[_0x3ed2('0x37')](_0x497a6b[_0x3ed2('0x2e')]['limit']);_0x47271b[_0x3ed2('0x1d')]=qs[_0x3ed2('0x1d')](_0x497a6b[_0x3ed2('0x2e')]['offset']);}return _0xafbe9d[_0x3ed2('0x4e')](_0x47271b);}})[_0x3ed2('0x22')](function(_0x51ca22){if(_0x51ca22){return _0x51ca22?{'count':_0x6376a1,'rows':_0x51ca22}:null;}})[_0x3ed2('0x22')](respondWithResult(_0x417ad5,null))[_0x3ed2('0x43')](handleError(_0x417ad5,null));};exports['getDescriptions']=function(_0x1f0564,_0xe74344,_0x52c209){var _0xd5c486={};var _0x1115c5={};var _0x4ebd67;var _0x20c295;return db[_0x3ed2('0x29')][_0x3ed2('0x4b')]({'where':{'id':_0x1f0564['params']['id']}})[_0x3ed2('0x22')](handleEntityNotFound(_0xe74344,null))[_0x3ed2('0x22')](function(_0x3d2f60){if(_0x3d2f60){_0x4ebd67=_0x3d2f60;_0x1115c5[_0x3ed2('0x2c')]=_[_0x3ed2('0x2f')](db[_0x3ed2('0x4c')]['rawAttributes']);_0x1115c5[_0x3ed2('0x2e')]=_[_0x3ed2('0x2f')](_0x1f0564[_0x3ed2('0x2e')]);_0x1115c5[_0x3ed2('0x30')]=_[_0x3ed2('0x31')](_0x1115c5[_0x3ed2('0x2c')],_0x1115c5['query']);_0xd5c486[_0x3ed2('0x33')]=_[_0x3ed2('0x31')](_0x1115c5[_0x3ed2('0x2c')],qs['fields'](_0x1f0564['query'][_0x3ed2('0x32')]));_0xd5c486[_0x3ed2('0x33')]=_0xd5c486['attributes'][_0x3ed2('0x34')]?_0xd5c486['attributes']:_0x1115c5['model'];_0xd5c486['order']=qs[_0x3ed2('0x39')](_0x1f0564[_0x3ed2('0x2e')][_0x3ed2('0x39')]);_0xd5c486['where']=qs[_0x3ed2('0x30')](_[_0x3ed2('0x3b')](_0x1f0564[_0x3ed2('0x2e')],_0x1115c5[_0x3ed2('0x30')]));if(_0x1f0564[_0x3ed2('0x2e')][_0x3ed2('0x3c')]){_0xd5c486[_0x3ed2('0x3a')]=_[_0x3ed2('0x3d')](_0xd5c486[_0x3ed2('0x3a')],{'$or':_[_0x3ed2('0x28')](_0xd5c486[_0x3ed2('0x33')],function(_0x46f3ca){var _0x563076={};_0x563076[_0x46f3ca]={'$like':'%'+_0x1f0564[_0x3ed2('0x2e')][_0x3ed2('0x3c')]+'%'};return _0x563076;})});}_0xd5c486=_[_0x3ed2('0x3d')]({},_0xd5c486,_0x1f0564[_0x3ed2('0x46')]);return _0x4ebd67[_0x3ed2('0x4f')](_0xd5c486);}})[_0x3ed2('0x22')](function(_0x10e5f2){if(_0x10e5f2){_0x20c295=_0x10e5f2['length'];if(!_0x1f0564[_0x3ed2('0x2e')][_0x3ed2('0x35')](_0x3ed2('0x36'))){_0xd5c486['limit']=qs['limit'](_0x1f0564[_0x3ed2('0x2e')][_0x3ed2('0x37')]);_0xd5c486[_0x3ed2('0x1d')]=qs[_0x3ed2('0x1d')](_0x1f0564[_0x3ed2('0x2e')][_0x3ed2('0x1d')]);}return _0x4ebd67[_0x3ed2('0x4f')](_0xd5c486);}})[_0x3ed2('0x22')](function(_0x455a4b){if(_0x455a4b){return _0x455a4b?{'count':_0x20c295,'rows':_0x455a4b}:null;}})['then'](respondWithResult(_0xe74344,null))[_0x3ed2('0x43')](handleError(_0xe74344,null));};exports[_0x3ed2('0x50')]=function(_0x46cc73,_0x21a70a,_0x52058b){var _0x686a5={};var _0x3f5813={};var _0x5c294d;var _0x29c1f4;return db[_0x3ed2('0x29')]['findOne']({'where':{'id':_0x46cc73['params']['id']}})['then'](handleEntityNotFound(_0x21a70a,null))[_0x3ed2('0x22')](function(_0x2d0c6a){if(_0x2d0c6a){_0x5c294d=_0x2d0c6a;_0x3f5813[_0x3ed2('0x2c')]=_[_0x3ed2('0x2f')](db[_0x3ed2('0x51')][_0x3ed2('0x4d')]);_0x3f5813[_0x3ed2('0x2e')]=_[_0x3ed2('0x2f')](_0x46cc73[_0x3ed2('0x2e')]);_0x3f5813[_0x3ed2('0x30')]=_['intersection'](_0x3f5813[_0x3ed2('0x2c')],_0x3f5813['query']);_0x686a5[_0x3ed2('0x33')]=_[_0x3ed2('0x31')](_0x3f5813[_0x3ed2('0x2c')],qs[_0x3ed2('0x32')](_0x46cc73[_0x3ed2('0x2e')][_0x3ed2('0x32')]));_0x686a5['attributes']=_0x686a5[_0x3ed2('0x33')]['length']?_0x686a5[_0x3ed2('0x33')]:_0x3f5813[_0x3ed2('0x2c')];_0x686a5[_0x3ed2('0x38')]=qs[_0x3ed2('0x39')](_0x46cc73[_0x3ed2('0x2e')][_0x3ed2('0x39')]);_0x686a5['where']=qs[_0x3ed2('0x30')](_[_0x3ed2('0x3b')](_0x46cc73[_0x3ed2('0x2e')],_0x3f5813[_0x3ed2('0x30')]));if(_0x46cc73[_0x3ed2('0x2e')][_0x3ed2('0x3c')]){_0x686a5['where']=_[_0x3ed2('0x3d')](_0x686a5['where'],{'$or':_[_0x3ed2('0x28')](_0x686a5[_0x3ed2('0x33')],function(_0x2eeccb){var _0x33ec64={};_0x33ec64[_0x2eeccb]={'$like':'%'+_0x46cc73[_0x3ed2('0x2e')][_0x3ed2('0x3c')]+'%'};return _0x33ec64;})});}_0x686a5=_[_0x3ed2('0x3d')]({},_0x686a5,_0x46cc73[_0x3ed2('0x46')]);return _0x5c294d[_0x3ed2('0x50')](_0x686a5);}})[_0x3ed2('0x22')](function(_0x475a8d){if(_0x475a8d){_0x29c1f4=_0x475a8d['length'];if(!_0x46cc73['query']['hasOwnProperty'](_0x3ed2('0x36'))){_0x686a5[_0x3ed2('0x37')]=qs['limit'](_0x46cc73['query'][_0x3ed2('0x37')]);_0x686a5[_0x3ed2('0x1d')]=qs[_0x3ed2('0x1d')](_0x46cc73[_0x3ed2('0x2e')][_0x3ed2('0x1d')]);}return _0x5c294d[_0x3ed2('0x50')](_0x686a5);}})['then'](function(_0x355baf){if(_0x355baf){return _0x355baf?{'count':_0x29c1f4,'rows':_0x355baf}:null;}})[_0x3ed2('0x22')](respondWithResult(_0x21a70a,null))['catch'](handleError(_0x21a70a,null));};exports[_0x3ed2('0x52')]=function(_0x54d290,_0x4d304f,_0x3eefb8){if(_0x54d290['body']['id']){delete _0x54d290[_0x3ed2('0x48')]['id'];}return db[_0x3ed2('0x29')][_0x3ed2('0x4b')]({'where':{'id':_0x54d290[_0x3ed2('0x45')]['id']}})[_0x3ed2('0x22')](handleEntityNotFound(_0x4d304f,null))['then'](function(_0x262db5){if(_0x262db5){return _0x262db5[_0x3ed2('0x52')](_0x54d290['body'][_0x3ed2('0x53')]||[]);}return null;})[_0x3ed2('0x22')](respondWithResult(_0x4d304f,null))[_0x3ed2('0x43')](handleError(_0x4d304f,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index adc1279..2d4b9b4 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 _0x5eb8=['request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','ZendeskConfiguration','int_zendesk_configurations','../../config/logger','api','moment','bluebird'];(function(_0x5785c4,_0x300576){var _0x3bc66e=function(_0x4bddc7){while(--_0x4bddc7){_0x5785c4['push'](_0x5785c4['shift']());}};_0x3bc66e(++_0x300576);}(_0x5eb8,0xb0));var _0x85eb=function(_0x255ac0,_0x3f6645){_0x255ac0=_0x255ac0-0x0;var _0x437bf1=_0x5eb8[_0x255ac0];return _0x437bf1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x85eb('0x0'))(_0x85eb('0x1'));var moment=require(_0x85eb('0x2'));var BPromise=require(_0x85eb('0x3'));var rp=require(_0x85eb('0x4'));var fs=require('fs');var path=require(_0x85eb('0x5'));var rimraf=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var attributes=require(_0x85eb('0x8'));module[_0x85eb('0x9')]=function(_0x2bf83c,_0x1ba1d8){return _0x2bf83c['define'](_0x85eb('0xa'),attributes,{'tableName':_0x85eb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x69d3=['../../config/logger','moment','bluebird','rimraf','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x69d3,0xda));var _0x369d=function(_0x518631,_0x567458){_0x518631=_0x518631-0x0;var _0x520e2b=_0x69d3[_0x518631];return _0x520e2b;};'use strict';var _=require(_0x369d('0x0'));var util=require(_0x369d('0x1'));var logger=require(_0x369d('0x2'))('api');var moment=require(_0x369d('0x3'));var BPromise=require(_0x369d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x369d('0x5'));var config=require('../../config/environment');var attributes=require('./intZendeskConfiguration.attributes');module[_0x369d('0x6')]=function(_0x2f2a53,_0x18c9f1){return _0x2f2a53[_0x369d('0x7')](_0x369d('0x8'),attributes,{'tableName':_0x369d('0x9'),'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 9b5de6b..5c6284b 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 _0x0ff1=['jayson/promise','client','http','request','then','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0ff1,0x19b));var _0x10ff=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x0ff1[_0x1203f];return _0x365f0a;};'use strict';var _=require(_0x10ff('0x0'));var util=require(_0x10ff('0x1'));var moment=require(_0x10ff('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x10ff('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x10ff('0x4'));var logger=require(_0x10ff('0x5'))('rpc');var config=require(_0x10ff('0x6'));var jayson=require(_0x10ff('0x7'));var client=jayson[_0x10ff('0x8')][_0x10ff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20c74e,_0x7e1754,_0x44ea8b){return new BPromise(function(_0x34c81b,_0x3b9244){return client[_0x10ff('0xa')](_0x20c74e,_0x44ea8b)[_0x10ff('0xb')](function(_0x433168){logger[_0x10ff('0xc')]('ZendeskConfiguration,\x20%s,\x20%s',_0x7e1754,_0x10ff('0xd'));logger[_0x10ff('0xe')](_0x10ff('0xf'),_0x7e1754,'request\x20sent',JSON['stringify'](_0x433168));if(_0x433168[_0x10ff('0x10')]){if(_0x433168[_0x10ff('0x10')][_0x10ff('0x11')]===0x1f4){logger[_0x10ff('0x10')](_0x10ff('0x12'),_0x7e1754,_0x433168[_0x10ff('0x10')][_0x10ff('0x13')]);return _0x3b9244(_0x433168['error'][_0x10ff('0x13')]);}logger['error'](_0x10ff('0x12'),_0x7e1754,_0x433168[_0x10ff('0x10')][_0x10ff('0x13')]);return _0x34c81b(_0x433168[_0x10ff('0x10')][_0x10ff('0x13')]);}else{logger[_0x10ff('0xc')](_0x10ff('0x12'),_0x7e1754,_0x10ff('0xd'));_0x34c81b(_0x433168[_0x10ff('0x14')]['message']);}})[_0x10ff('0x15')](function(_0x44aea1){logger[_0x10ff('0x10')](_0x10ff('0x12'),_0x7e1754,_0x44aea1);_0x3b9244(_0x44aea1);});});} \ No newline at end of file +var _0x7e47=['debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x4a7906,_0x3ef77d){var _0x558373=function(_0xd892c3){while(--_0xd892c3){_0x4a7906['push'](_0x4a7906['shift']());}};_0x558373(++_0x3ef77d);}(_0x7e47,0x7a));var _0x77e4=function(_0x1aa801,_0x117979){_0x1aa801=_0x1aa801-0x0;var _0x21f6f7=_0x7e47[_0x1aa801];return _0x21f6f7;};'use strict';var _=require(_0x77e4('0x0'));var util=require(_0x77e4('0x1'));var moment=require(_0x77e4('0x2'));var BPromise=require(_0x77e4('0x3'));var rs=require(_0x77e4('0x4'));var fs=require('fs');var Redis=require(_0x77e4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x77e4('0x6'));var logger=require(_0x77e4('0x7'))(_0x77e4('0x8'));var config=require(_0x77e4('0x9'));var jayson=require(_0x77e4('0xa'));var client=jayson['client'][_0x77e4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dc904,_0x4d43c9,_0x20f4c2){return new BPromise(function(_0x4c461e,_0x1a8b5d){return client['request'](_0x5dc904,_0x20f4c2)[_0x77e4('0xc')](function(_0x384f19){logger[_0x77e4('0xd')](_0x77e4('0xe'),_0x4d43c9,_0x77e4('0xf'));logger[_0x77e4('0x10')](_0x77e4('0x11'),_0x4d43c9,_0x77e4('0xf'),JSON[_0x77e4('0x12')](_0x384f19));if(_0x384f19[_0x77e4('0x13')]){if(_0x384f19['error']['code']===0x1f4){logger['error'](_0x77e4('0xe'),_0x4d43c9,_0x384f19[_0x77e4('0x13')][_0x77e4('0x14')]);return _0x1a8b5d(_0x384f19[_0x77e4('0x13')][_0x77e4('0x14')]);}logger[_0x77e4('0x13')](_0x77e4('0xe'),_0x4d43c9,_0x384f19[_0x77e4('0x13')]['message']);return _0x4c461e(_0x384f19[_0x77e4('0x13')][_0x77e4('0x14')]);}else{logger['info'](_0x77e4('0xe'),_0x4d43c9,_0x77e4('0xf'));_0x4c461e(_0x384f19[_0x77e4('0x15')][_0x77e4('0x14')]);}})[_0x77e4('0x16')](function(_0x980a8){logger[_0x77e4('0x13')](_0x77e4('0xe'),_0x4d43c9,_0x980a8);_0x1a8b5d(_0x980a8);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 919d665..2f3531b 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 _0xf7d6=['../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','exports','util','path','Router','fs-extra','../../components/auth/service'];(function(_0x803915,_0x5525bc){var _0x57bdb4=function(_0x203ba2){while(--_0x203ba2){_0x803915['push'](_0x803915['shift']());}};_0x57bdb4(++_0x5525bc);}(_0xf7d6,0x1ab));var _0x6f7d=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xf7d6[_0x2a6809];return _0x11c371;};'use strict';var multer=require('multer');var util=require(_0x6f7d('0x0'));var path=require(_0x6f7d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6f7d('0x2')]();var fs_extra=require(_0x6f7d('0x3'));var auth=require(_0x6f7d('0x4'));var interaction=require(_0x6f7d('0x5'));var config=require(_0x6f7d('0x6'));var controller=require(_0x6f7d('0x7'));router[_0x6f7d('0x8')]('/',auth[_0x6f7d('0x9')](),controller[_0x6f7d('0xa')]);router[_0x6f7d('0x8')](_0x6f7d('0xb'),auth[_0x6f7d('0x9')](),controller[_0x6f7d('0xc')]);router[_0x6f7d('0xd')]('/',auth[_0x6f7d('0x9')](),controller[_0x6f7d('0xe')]);router['put'](_0x6f7d('0xb'),auth[_0x6f7d('0x9')](),controller[_0x6f7d('0xf')]);router[_0x6f7d('0x10')](_0x6f7d('0xb'),auth[_0x6f7d('0x9')](),controller['destroy']);module[_0x6f7d('0x11')]=router; \ No newline at end of file +var _0xd6b9=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','index','get','/:id','isAuthenticated','post','create','put','update','destroy','exports','multer','util'];(function(_0x50c7dd,_0x18c094){var _0x416d5d=function(_0x5e1b04){while(--_0x5e1b04){_0x50c7dd['push'](_0x50c7dd['shift']());}};_0x416d5d(++_0x18c094);}(_0xd6b9,0xfa));var _0x9d6b=function(_0x1565d4,_0x2316a4){_0x1565d4=_0x1565d4-0x0;var _0x6d398f=_0xd6b9[_0x1565d4];return _0x6d398f;};'use strict';var multer=require(_0x9d6b('0x0'));var util=require(_0x9d6b('0x1'));var path=require(_0x9d6b('0x2'));var timeout=require(_0x9d6b('0x3'));var express=require('express');var router=express[_0x9d6b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9d6b('0x5'));var interaction=require(_0x9d6b('0x6'));var config=require('../../config/environment');var controller=require(_0x9d6b('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x9d6b('0x8')]);router[_0x9d6b('0x9')](_0x9d6b('0xa'),auth[_0x9d6b('0xb')](),controller['show']);router[_0x9d6b('0xc')]('/',auth[_0x9d6b('0xb')](),controller[_0x9d6b('0xd')]);router[_0x9d6b('0xe')]('/:id',auth[_0x9d6b('0xb')](),controller[_0x9d6b('0xf')]);router['delete'](_0x9d6b('0xa'),auth['isAuthenticated'](),controller[_0x9d6b('0x10')]);module[_0x9d6b('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index d0fefc3..2c90312 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 _0x223e=['STRING','BOOLEAN','exports','ENUM','string','variable','customVariable','picklist'];(function(_0x3721ac,_0x2c1ec2){var _0x524337=function(_0x33018a){while(--_0x33018a){_0x3721ac['push'](_0x3721ac['shift']());}};_0x524337(++_0x2c1ec2);}(_0x223e,0x1da));var _0xe223=function(_0x5f0501,_0x19196e){_0x5f0501=_0x5f0501-0x0;var _0x3c2c45=_0x223e[_0x5f0501];return _0x3c2c45;};'use strict';var Sequelize=require('sequelize');module[_0xe223('0x0')]={'type':{'type':Sequelize[_0xe223('0x1')](_0xe223('0x2'),_0xe223('0x3'),_0xe223('0x4'),'keyValue',_0xe223('0x5')),'defaultValue':_0xe223('0x2')},'content':{'type':Sequelize[_0xe223('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xe223('0x1')](_0xe223('0x2'),_0xe223('0x3'),_0xe223('0x4'))},'keyContent':{'type':Sequelize[_0xe223('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xe223('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe223('0x6')]}}; \ No newline at end of file +var _0xc31f=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM','string'];(function(_0x112187,_0x1289a5){var _0x2875ff=function(_0x204047){while(--_0x204047){_0x112187['push'](_0x112187['shift']());}};_0x2875ff(++_0x1289a5);}(_0xc31f,0xe7));var _0xfc31=function(_0xb378b5,_0x12dcdd){_0xb378b5=_0xb378b5-0x0;var _0x5c5f5e=_0xc31f[_0xb378b5];return _0x5c5f5e;};'use strict';var Sequelize=require('sequelize');module[_0xfc31('0x0')]={'type':{'type':Sequelize[_0xfc31('0x1')](_0xfc31('0x2'),_0xfc31('0x3'),_0xfc31('0x4'),_0xfc31('0x5'),_0xfc31('0x6')),'defaultValue':_0xfc31('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xfc31('0x7')]},'keyType':{'type':Sequelize[_0xfc31('0x1')](_0xfc31('0x2'),_0xfc31('0x3'),_0xfc31('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xfc31('0x7')]},'nameField':{'type':Sequelize[_0xfc31('0x7')]},'customField':{'type':Sequelize[_0xfc31('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfc31('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 46c4aad..942c24e 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 _0x14f8=['../../mysqldb','status','end','json','offset','undefined','limit','count','reject','save','update','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','then','includeAll','findAll','rows','catch','params','ZendeskField','include','merge','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x4aa348,_0x1659bd){var _0x3d1670=function(_0x45d86f){while(--_0x45d86f){_0x4aa348['push'](_0x4aa348['shift']());}};_0x3d1670(++_0x1659bd);}(_0x14f8,0x193));var _0x814f=function(_0x2bdd5d,_0x2e0bda){_0x2bdd5d=_0x2bdd5d-0x0;var _0x257c00=_0x14f8[_0x2bdd5d];return _0x257c00;};'use strict';var emlformat=require(_0x814f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x814f('0x1'));var jsonpatch=require(_0x814f('0x2'));var rp=require(_0x814f('0x3'));var moment=require('moment');var BPromise=require(_0x814f('0x4'));var Mustache=require(_0x814f('0x5'));var util=require(_0x814f('0x6'));var path=require(_0x814f('0x7'));var sox=require('sox');var csv=require(_0x814f('0x8'));var ejs=require(_0x814f('0x9'));var fs=require('fs');var fs_extra=require(_0x814f('0xa'));var _=require(_0x814f('0xb'));var squel=require('squel');var crypto=require(_0x814f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x814f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x814f('0xe'));var Papa=require('papaparse');var Redis=require(_0x814f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x814f('0x10'));var as=require(_0x814f('0x11'));var hardwareService=require(_0x814f('0x12'));var logger=require(_0x814f('0x13'))(_0x814f('0x14'));var utils=require(_0x814f('0x15'));var config=require(_0x814f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x814f('0x17'))['db'];function respondWithStatusCode(_0x3b2d48,_0xfd9e05){_0xfd9e05=_0xfd9e05||0xcc;return function(_0x53a6a8){if(_0x53a6a8){return _0x3b2d48['sendStatus'](_0xfd9e05);}return _0x3b2d48[_0x814f('0x18')](_0xfd9e05)[_0x814f('0x19')]();};}function respondWithResult(_0x417d3b,_0x2af5fb){_0x2af5fb=_0x2af5fb||0xc8;return function(_0x1fea24){if(_0x1fea24){return _0x417d3b[_0x814f('0x18')](_0x2af5fb)[_0x814f('0x1a')](_0x1fea24);}};}function respondWithFilteredResult(_0x444aee,_0x49c7e6){return function(_0x171ab4){if(_0x171ab4){var _0x10b981=typeof _0x49c7e6[_0x814f('0x1b')]===_0x814f('0x1c')&&typeof _0x49c7e6[_0x814f('0x1d')]===_0x814f('0x1c');var _0x41179a=_0x171ab4['count'];var _0x24c03c=_0x10b981?0x0:_0x49c7e6['offset'];var _0x351f3d=_0x10b981?_0x171ab4[_0x814f('0x1e')]:_0x49c7e6['offset']+_0x49c7e6['limit'];var _0x627fe1;if(_0x351f3d>=_0x41179a){_0x351f3d=_0x41179a;_0x627fe1=0xc8;}else{_0x627fe1=0xce;}_0x444aee['status'](_0x627fe1);return _0x444aee['set']('Content-Range',_0x24c03c+'-'+_0x351f3d+'/'+_0x41179a)['json'](_0x171ab4);}return null;};}function patchUpdates(_0x3722ef){return function(_0x4ece43){try{jsonpatch['apply'](_0x4ece43,_0x3722ef,!![]);}catch(_0x3b792e){return BPromise[_0x814f('0x1f')](_0x3b792e);}return _0x4ece43[_0x814f('0x20')]();};}function saveUpdates(_0x5be5ca,_0x10d18c){return function(_0x67d119){if(_0x67d119){return _0x67d119[_0x814f('0x21')](_0x5be5ca)['then'](function(_0x160e6c){return _0x160e6c;});}return null;};}function removeEntity(_0x3c6144,_0x5a6465){return function(_0x35bbe3){if(_0x35bbe3){return _0x35bbe3[_0x814f('0x22')]()['then'](function(){_0x3c6144[_0x814f('0x18')](0xcc)[_0x814f('0x19')]();});}};}function handleEntityNotFound(_0xc162af,_0x418ca8){return function(_0x48c4ca){if(!_0x48c4ca){_0xc162af['sendStatus'](0x194);}return _0x48c4ca;};}function handleError(_0x5d7582,_0x2f6693){_0x2f6693=_0x2f6693||0x1f4;return function(_0x3704e7){logger[_0x814f('0x23')](_0x3704e7[_0x814f('0x24')]);if(_0x3704e7[_0x814f('0x25')]){delete _0x3704e7[_0x814f('0x25')];}_0x5d7582[_0x814f('0x18')](_0x2f6693)[_0x814f('0x26')](_0x3704e7);};}exports[_0x814f('0x27')]=function(_0x555aa0,_0x4cb3d9){var _0x583ad8={},_0x1e3bc6={},_0x204f64={'count':0x0,'rows':[]};var _0x5041ea=_['map'](db['ZendeskField'][_0x814f('0x28')],function(_0x317e52){return{'name':_0x317e52[_0x814f('0x29')],'type':_0x317e52[_0x814f('0x2a')][_0x814f('0x2b')]};});_0x1e3bc6[_0x814f('0x2c')]=_['map'](_0x5041ea,_0x814f('0x25'));_0x1e3bc6[_0x814f('0x2d')]=_[_0x814f('0x2e')](_0x555aa0[_0x814f('0x2d')]);_0x1e3bc6[_0x814f('0x2f')]=_[_0x814f('0x30')](_0x1e3bc6[_0x814f('0x2c')],_0x1e3bc6['query']);_0x583ad8['attributes']=_[_0x814f('0x30')](_0x1e3bc6[_0x814f('0x2c')],qs[_0x814f('0x31')](_0x555aa0[_0x814f('0x2d')][_0x814f('0x31')]));_0x583ad8[_0x814f('0x32')]=_0x583ad8[_0x814f('0x32')][_0x814f('0x33')]?_0x583ad8[_0x814f('0x32')]:_0x1e3bc6['model'];if(!_0x555aa0[_0x814f('0x2d')][_0x814f('0x34')](_0x814f('0x35'))){_0x583ad8['limit']=qs[_0x814f('0x1d')](_0x555aa0['query'][_0x814f('0x1d')]);_0x583ad8[_0x814f('0x1b')]=qs[_0x814f('0x1b')](_0x555aa0['query']['offset']);}_0x583ad8['order']=qs[_0x814f('0x36')](_0x555aa0['query'][_0x814f('0x36')]);_0x583ad8['where']=qs['filters'](_[_0x814f('0x37')](_0x555aa0[_0x814f('0x2d')],_0x1e3bc6[_0x814f('0x2f')]),_0x5041ea);if(_0x555aa0[_0x814f('0x2d')][_0x814f('0x38')]){_0x583ad8['where']=_['merge'](_0x583ad8[_0x814f('0x39')],{'$or':_['map'](_0x5041ea,function(_0x1f16c2){if(_0x1f16c2[_0x814f('0x2a')]!==_0x814f('0x3a')){var _0x26aa08={};_0x26aa08[_0x1f16c2[_0x814f('0x25')]]={'$like':'%'+_0x555aa0[_0x814f('0x2d')][_0x814f('0x38')]+'%'};return _0x26aa08;}})});}_0x583ad8=_['merge']({},_0x583ad8,_0x555aa0['options']);var _0x330b11={'where':_0x583ad8['where']};return db['ZendeskField'][_0x814f('0x1e')](_0x330b11)[_0x814f('0x3b')](function(_0x21fe7a){_0x204f64[_0x814f('0x1e')]=_0x21fe7a;if(_0x555aa0[_0x814f('0x2d')][_0x814f('0x3c')]){_0x583ad8['include']=[{'all':!![]}];}return db['ZendeskField'][_0x814f('0x3d')](_0x583ad8);})[_0x814f('0x3b')](function(_0x441bc4){_0x204f64[_0x814f('0x3e')]=_0x441bc4;return _0x204f64;})[_0x814f('0x3b')](respondWithFilteredResult(_0x4cb3d9,_0x583ad8))[_0x814f('0x3f')](handleError(_0x4cb3d9,null));};exports['show']=function(_0x3c8286,_0x2e6e7a){var _0x42e1a3={'raw':!![],'where':{'id':_0x3c8286[_0x814f('0x40')]['id']}},_0x44ceef={};_0x44ceef[_0x814f('0x2c')]=_[_0x814f('0x2e')](db[_0x814f('0x41')][_0x814f('0x28')]);_0x44ceef[_0x814f('0x2d')]=_[_0x814f('0x2e')](_0x3c8286[_0x814f('0x2d')]);_0x44ceef[_0x814f('0x2f')]=_[_0x814f('0x30')](_0x44ceef[_0x814f('0x2c')],_0x44ceef[_0x814f('0x2d')]);_0x42e1a3[_0x814f('0x32')]=_[_0x814f('0x30')](_0x44ceef[_0x814f('0x2c')],qs[_0x814f('0x31')](_0x3c8286[_0x814f('0x2d')][_0x814f('0x31')]));_0x42e1a3[_0x814f('0x32')]=_0x42e1a3['attributes']['length']?_0x42e1a3[_0x814f('0x32')]:_0x44ceef[_0x814f('0x2c')];if(_0x3c8286[_0x814f('0x2d')]['includeAll']){_0x42e1a3[_0x814f('0x42')]=[{'all':!![]}];}_0x42e1a3=_[_0x814f('0x43')]({},_0x42e1a3,_0x3c8286['options']);return db[_0x814f('0x41')][_0x814f('0x44')](_0x42e1a3)[_0x814f('0x3b')](handleEntityNotFound(_0x2e6e7a,null))['then'](respondWithResult(_0x2e6e7a,null))['catch'](handleError(_0x2e6e7a,null));};exports[_0x814f('0x45')]=function(_0xbe9a19,_0x597573){return db[_0x814f('0x41')][_0x814f('0x45')](_0xbe9a19[_0x814f('0x46')],{})[_0x814f('0x3b')](respondWithResult(_0x597573,0xc9))[_0x814f('0x3f')](handleError(_0x597573,null));};exports[_0x814f('0x21')]=function(_0x376d25,_0x289b30){if(_0x376d25[_0x814f('0x46')]['id']){delete _0x376d25[_0x814f('0x46')]['id'];}return db[_0x814f('0x41')][_0x814f('0x44')]({'where':{'id':_0x376d25[_0x814f('0x40')]['id']}})[_0x814f('0x3b')](handleEntityNotFound(_0x289b30,null))[_0x814f('0x3b')](saveUpdates(_0x376d25[_0x814f('0x46')],null))[_0x814f('0x3b')](respondWithResult(_0x289b30,null))[_0x814f('0x3f')](handleError(_0x289b30,null));};exports[_0x814f('0x22')]=function(_0x261f23,_0x5e682f){return db['ZendeskField'][_0x814f('0x44')]({'where':{'id':_0x261f23[_0x814f('0x40')]['id']}})[_0x814f('0x3b')](handleEntityNotFound(_0x5e682f,null))[_0x814f('0x3b')](removeEntity(_0x5e682f,null))['catch'](handleError(_0x5e682f,null));}; \ No newline at end of file +var _0x1095=['index','ZendeskField','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../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','apply','reject','save','then','destroy','error','name','send'];(function(_0x89efd1,_0xe83371){var _0x3af8f=function(_0x50b3f2){while(--_0x50b3f2){_0x89efd1['push'](_0x89efd1['shift']());}};_0x3af8f(++_0xe83371);}(_0x1095,0x1e9));var _0x5109=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x1095[_0x411add];return _0x238242;};'use strict';var emlformat=require(_0x5109('0x0'));var rimraf=require(_0x5109('0x1'));var zipdir=require(_0x5109('0x2'));var jsonpatch=require(_0x5109('0x3'));var rp=require(_0x5109('0x4'));var moment=require(_0x5109('0x5'));var BPromise=require(_0x5109('0x6'));var Mustache=require('mustache');var util=require(_0x5109('0x7'));var path=require(_0x5109('0x8'));var sox=require(_0x5109('0x9'));var csv=require('to-csv');var ejs=require(_0x5109('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5109('0xb'));var squel=require('squel');var crypto=require(_0x5109('0xc'));var jsforce=require(_0x5109('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5109('0xe'));var querystring=require(_0x5109('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5109('0x10'));var qs=require(_0x5109('0x11'));var as=require(_0x5109('0x12'));var hardwareService=require(_0x5109('0x13'));var logger=require(_0x5109('0x14'))(_0x5109('0x15'));var utils=require(_0x5109('0x16'));var config=require(_0x5109('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5109('0x18'))['db'];function respondWithStatusCode(_0x30d170,_0xec0e4c){_0xec0e4c=_0xec0e4c||0xcc;return function(_0x3837dd){if(_0x3837dd){return _0x30d170[_0x5109('0x19')](_0xec0e4c);}return _0x30d170['status'](_0xec0e4c)[_0x5109('0x1a')]();};}function respondWithResult(_0x25fea8,_0x5dbd6f){_0x5dbd6f=_0x5dbd6f||0xc8;return function(_0x15407a){if(_0x15407a){return _0x25fea8[_0x5109('0x1b')](_0x5dbd6f)[_0x5109('0x1c')](_0x15407a);}};}function respondWithFilteredResult(_0x37595c,_0x525ebd){return function(_0x4886de){if(_0x4886de){var _0x371b53=typeof _0x525ebd[_0x5109('0x1d')]===_0x5109('0x1e')&&typeof _0x525ebd[_0x5109('0x1f')]===_0x5109('0x1e');var _0xc9d8f=_0x4886de[_0x5109('0x20')];var _0xce7291=_0x371b53?0x0:_0x525ebd[_0x5109('0x1d')];var _0x3c63d9=_0x371b53?_0x4886de[_0x5109('0x20')]:_0x525ebd[_0x5109('0x1d')]+_0x525ebd['limit'];var _0x58ee87;if(_0x3c63d9>=_0xc9d8f){_0x3c63d9=_0xc9d8f;_0x58ee87=0xc8;}else{_0x58ee87=0xce;}_0x37595c[_0x5109('0x1b')](_0x58ee87);return _0x37595c[_0x5109('0x21')](_0x5109('0x22'),_0xce7291+'-'+_0x3c63d9+'/'+_0xc9d8f)[_0x5109('0x1c')](_0x4886de);}return null;};}function patchUpdates(_0x4ebcf1){return function(_0x1421ec){try{jsonpatch[_0x5109('0x23')](_0x1421ec,_0x4ebcf1,!![]);}catch(_0x1e2dde){return BPromise[_0x5109('0x24')](_0x1e2dde);}return _0x1421ec[_0x5109('0x25')]();};}function saveUpdates(_0x405de8,_0x271e88){return function(_0x30b767){if(_0x30b767){return _0x30b767['update'](_0x405de8)[_0x5109('0x26')](function(_0x5b7ed9){return _0x5b7ed9;});}return null;};}function removeEntity(_0x41159b,_0x3d32f1){return function(_0x5b5348){if(_0x5b5348){return _0x5b5348[_0x5109('0x27')]()[_0x5109('0x26')](function(){_0x41159b[_0x5109('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48e836,_0x3c312a){return function(_0x567a8a){if(!_0x567a8a){_0x48e836[_0x5109('0x19')](0x194);}return _0x567a8a;};}function handleError(_0x4ddaba,_0x2f324d){_0x2f324d=_0x2f324d||0x1f4;return function(_0x214a40){logger[_0x5109('0x28')](_0x214a40['stack']);if(_0x214a40['name']){delete _0x214a40[_0x5109('0x29')];}_0x4ddaba[_0x5109('0x1b')](_0x2f324d)[_0x5109('0x2a')](_0x214a40);};}exports[_0x5109('0x2b')]=function(_0x50477d,_0x1e0a74){var _0x2f525b={},_0x26a562={},_0x1ddd8a={'count':0x0,'rows':[]};var _0x7627a5=_['map'](db[_0x5109('0x2c')][_0x5109('0x2d')],function(_0x469a4c){return{'name':_0x469a4c[_0x5109('0x2e')],'type':_0x469a4c[_0x5109('0x2f')]['key']};});_0x26a562['model']=_[_0x5109('0x30')](_0x7627a5,'name');_0x26a562['query']=_['keys'](_0x50477d[_0x5109('0x31')]);_0x26a562[_0x5109('0x32')]=_[_0x5109('0x33')](_0x26a562[_0x5109('0x34')],_0x26a562[_0x5109('0x31')]);_0x2f525b[_0x5109('0x35')]=_[_0x5109('0x33')](_0x26a562[_0x5109('0x34')],qs[_0x5109('0x36')](_0x50477d[_0x5109('0x31')][_0x5109('0x36')]));_0x2f525b[_0x5109('0x35')]=_0x2f525b[_0x5109('0x35')]['length']?_0x2f525b[_0x5109('0x35')]:_0x26a562[_0x5109('0x34')];if(!_0x50477d[_0x5109('0x31')][_0x5109('0x37')](_0x5109('0x38'))){_0x2f525b['limit']=qs['limit'](_0x50477d[_0x5109('0x31')][_0x5109('0x1f')]);_0x2f525b['offset']=qs[_0x5109('0x1d')](_0x50477d[_0x5109('0x31')][_0x5109('0x1d')]);}_0x2f525b[_0x5109('0x39')]=qs[_0x5109('0x3a')](_0x50477d[_0x5109('0x31')][_0x5109('0x3a')]);_0x2f525b['where']=qs[_0x5109('0x32')](_[_0x5109('0x3b')](_0x50477d[_0x5109('0x31')],_0x26a562[_0x5109('0x32')]),_0x7627a5);if(_0x50477d[_0x5109('0x31')][_0x5109('0x3c')]){_0x2f525b[_0x5109('0x3d')]=_[_0x5109('0x3e')](_0x2f525b[_0x5109('0x3d')],{'$or':_[_0x5109('0x30')](_0x7627a5,function(_0x59c2cd){if(_0x59c2cd['type']!==_0x5109('0x3f')){var _0x1c3288={};_0x1c3288[_0x59c2cd[_0x5109('0x29')]]={'$like':'%'+_0x50477d['query'][_0x5109('0x3c')]+'%'};return _0x1c3288;}})});}_0x2f525b=_[_0x5109('0x3e')]({},_0x2f525b,_0x50477d[_0x5109('0x40')]);var _0x14e09b={'where':_0x2f525b[_0x5109('0x3d')]};return db[_0x5109('0x2c')]['count'](_0x14e09b)[_0x5109('0x26')](function(_0x34fe4a){_0x1ddd8a[_0x5109('0x20')]=_0x34fe4a;if(_0x50477d[_0x5109('0x31')][_0x5109('0x41')]){_0x2f525b[_0x5109('0x42')]=[{'all':!![]}];}return db[_0x5109('0x2c')][_0x5109('0x43')](_0x2f525b);})[_0x5109('0x26')](function(_0x35937f){_0x1ddd8a['rows']=_0x35937f;return _0x1ddd8a;})[_0x5109('0x26')](respondWithFilteredResult(_0x1e0a74,_0x2f525b))[_0x5109('0x44')](handleError(_0x1e0a74,null));};exports[_0x5109('0x45')]=function(_0x50a016,_0x4482d9){var _0x4f4c6b={'raw':!![],'where':{'id':_0x50a016[_0x5109('0x46')]['id']}},_0x3d162b={};_0x3d162b[_0x5109('0x34')]=_[_0x5109('0x47')](db[_0x5109('0x2c')]['rawAttributes']);_0x3d162b[_0x5109('0x31')]=_[_0x5109('0x47')](_0x50a016[_0x5109('0x31')]);_0x3d162b[_0x5109('0x32')]=_[_0x5109('0x33')](_0x3d162b[_0x5109('0x34')],_0x3d162b[_0x5109('0x31')]);_0x4f4c6b[_0x5109('0x35')]=_['intersection'](_0x3d162b['model'],qs[_0x5109('0x36')](_0x50a016[_0x5109('0x31')]['fields']));_0x4f4c6b[_0x5109('0x35')]=_0x4f4c6b[_0x5109('0x35')]['length']?_0x4f4c6b[_0x5109('0x35')]:_0x3d162b[_0x5109('0x34')];if(_0x50a016['query']['includeAll']){_0x4f4c6b[_0x5109('0x42')]=[{'all':!![]}];}_0x4f4c6b=_[_0x5109('0x3e')]({},_0x4f4c6b,_0x50a016[_0x5109('0x40')]);return db[_0x5109('0x2c')]['find'](_0x4f4c6b)[_0x5109('0x26')](handleEntityNotFound(_0x4482d9,null))['then'](respondWithResult(_0x4482d9,null))['catch'](handleError(_0x4482d9,null));};exports[_0x5109('0x48')]=function(_0x455498,_0x175154){return db[_0x5109('0x2c')][_0x5109('0x48')](_0x455498[_0x5109('0x49')],{})['then'](respondWithResult(_0x175154,0xc9))[_0x5109('0x44')](handleError(_0x175154,null));};exports[_0x5109('0x4a')]=function(_0x26108d,_0xcec845){if(_0x26108d[_0x5109('0x49')]['id']){delete _0x26108d[_0x5109('0x49')]['id'];}return db[_0x5109('0x2c')][_0x5109('0x4b')]({'where':{'id':_0x26108d[_0x5109('0x46')]['id']}})[_0x5109('0x26')](handleEntityNotFound(_0xcec845,null))[_0x5109('0x26')](saveUpdates(_0x26108d[_0x5109('0x49')],null))[_0x5109('0x26')](respondWithResult(_0xcec845,null))['catch'](handleError(_0xcec845,null));};exports[_0x5109('0x27')]=function(_0x47d62c,_0x2cb99a){return db[_0x5109('0x2c')]['find']({'where':{'id':_0x47d62c[_0x5109('0x46')]['id']}})[_0x5109('0x26')](handleEntityNotFound(_0x2cb99a,null))[_0x5109('0x26')](removeEntity(_0x2cb99a,null))[_0x5109('0x44')](handleError(_0x2cb99a,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 9430ec3..3a8a0ca 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 _0x5922=['moment','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','util','../../config/logger','api'];(function(_0x327afd,_0x1ecb90){var _0x15384f=function(_0xfcb49d){while(--_0xfcb49d){_0x327afd['push'](_0x327afd['shift']());}};_0x15384f(++_0x1ecb90);}(_0x5922,0xcd));var _0x2592=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0x5922[_0x18cd5b];return _0x5eaa52;};'use strict';var _=require('lodash');var util=require(_0x2592('0x0'));var logger=require(_0x2592('0x1'))(_0x2592('0x2'));var moment=require(_0x2592('0x3'));var BPromise=require('bluebird');var rp=require(_0x2592('0x4'));var fs=require('fs');var path=require(_0x2592('0x5'));var rimraf=require(_0x2592('0x6'));var config=require(_0x2592('0x7'));var attributes=require(_0x2592('0x8'));module[_0x2592('0x9')]=function(_0x8c828d,_0x310505){return _0x8c828d[_0x2592('0xa')](_0x2592('0xb'),attributes,{'tableName':_0x2592('0xc'),'paranoid':![],'indexes':[{'name':_0x2592('0xd'),'fields':[_0x2592('0xe'),_0x2592('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x473f=['./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0x473f,0xa1));var _0xf473=function(_0x150484,_0x2688d4){_0x150484=_0x150484-0x0;var _0x558170=_0x473f[_0x150484];return _0x558170;};'use strict';var _=require(_0xf473('0x0'));var util=require(_0xf473('0x1'));var logger=require('../../config/logger')(_0xf473('0x2'));var moment=require(_0xf473('0x3'));var BPromise=require(_0xf473('0x4'));var rp=require(_0xf473('0x5'));var fs=require('fs');var path=require(_0xf473('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf473('0x7'));module[_0xf473('0x8')]=function(_0xd31859,_0x121114){return _0xd31859[_0xf473('0x9')](_0xf473('0xa'),attributes,{'tableName':_0xf473('0xb'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xf473('0xc'),_0xf473('0xd')],'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 81d9e51..2cbe3d4 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 _0x9c50=['jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x4c54a6,_0x26208b){var _0x5038d7=function(_0x1360b6){while(--_0x1360b6){_0x4c54a6['push'](_0x4c54a6['shift']());}};_0x5038d7(++_0x26208b);}(_0x9c50,0xf6));var _0x09c5=function(_0x21976e,_0x136cdd){_0x21976e=_0x21976e-0x0;var _0x3efa3c=_0x9c50[_0x21976e];return _0x3efa3c;};'use strict';var _=require(_0x09c5('0x0'));var util=require('util');var moment=require(_0x09c5('0x1'));var BPromise=require(_0x09c5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x09c5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x09c5('0x4'));var logger=require('../../config/logger')(_0x09c5('0x5'));var config=require(_0x09c5('0x6'));var jayson=require(_0x09c5('0x7'));var client=jayson[_0x09c5('0x8')][_0x09c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x548d54,_0x119d35,_0x219f32){return new BPromise(function(_0x3f8368,_0x3abbbc){return client[_0x09c5('0xa')](_0x548d54,_0x219f32)[_0x09c5('0xb')](function(_0x5524d4){logger[_0x09c5('0xc')](_0x09c5('0xd'),_0x119d35,_0x09c5('0xe'));logger[_0x09c5('0xf')](_0x09c5('0x10'),_0x119d35,'request\x20sent',JSON[_0x09c5('0x11')](_0x5524d4));if(_0x5524d4['error']){if(_0x5524d4[_0x09c5('0x12')][_0x09c5('0x13')]===0x1f4){logger[_0x09c5('0x12')](_0x09c5('0xd'),_0x119d35,_0x5524d4[_0x09c5('0x12')][_0x09c5('0x14')]);return _0x3abbbc(_0x5524d4['error'][_0x09c5('0x14')]);}logger[_0x09c5('0x12')]('ZendeskField,\x20%s,\x20%s',_0x119d35,_0x5524d4[_0x09c5('0x12')]['message']);return _0x3f8368(_0x5524d4['error']['message']);}else{logger[_0x09c5('0xc')]('ZendeskField,\x20%s,\x20%s',_0x119d35,_0x09c5('0xe'));_0x3f8368(_0x5524d4[_0x09c5('0x15')][_0x09c5('0x14')]);}})[_0x09c5('0x16')](function(_0x3bec66){logger[_0x09c5('0x12')]('ZendeskField,\x20%s,\x20%s',_0x119d35,_0x3bec66);_0x3abbbc(_0x3bec66);});});} \ No newline at end of file +var _0x3fe0=['jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0x2c85ef,_0x1f6a5b){var _0x74e656=function(_0x1142c0){while(--_0x1142c0){_0x2c85ef['push'](_0x2c85ef['shift']());}};_0x74e656(++_0x1f6a5b);}(_0x3fe0,0xd5));var _0x03fe=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3fe0[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x03fe('0x0'));var BPromise=require(_0x03fe('0x1'));var rs=require(_0x03fe('0x2'));var fs=require('fs');var Redis=require(_0x03fe('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x03fe('0x4'))(_0x03fe('0x5'));var config=require(_0x03fe('0x6'));var jayson=require(_0x03fe('0x7'));var client=jayson[_0x03fe('0x8')][_0x03fe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f29a3,_0x6a4599,_0x4aead0){return new BPromise(function(_0x457b00,_0x25faf0){return client[_0x03fe('0xa')](_0x1f29a3,_0x4aead0)[_0x03fe('0xb')](function(_0x16164a){logger[_0x03fe('0xc')](_0x03fe('0xd'),_0x6a4599,_0x03fe('0xe'));logger[_0x03fe('0xf')](_0x03fe('0x10'),_0x6a4599,_0x03fe('0xe'),JSON['stringify'](_0x16164a));if(_0x16164a[_0x03fe('0x11')]){if(_0x16164a[_0x03fe('0x11')][_0x03fe('0x12')]===0x1f4){logger[_0x03fe('0x11')](_0x03fe('0xd'),_0x6a4599,_0x16164a[_0x03fe('0x11')][_0x03fe('0x13')]);return _0x25faf0(_0x16164a[_0x03fe('0x11')][_0x03fe('0x13')]);}logger[_0x03fe('0x11')](_0x03fe('0xd'),_0x6a4599,_0x16164a[_0x03fe('0x11')]['message']);return _0x457b00(_0x16164a['error'][_0x03fe('0x13')]);}else{logger[_0x03fe('0xc')](_0x03fe('0xd'),_0x6a4599,_0x03fe('0xe'));_0x457b00(_0x16164a[_0x03fe('0x14')][_0x03fe('0x13')]);}})[_0x03fe('0x15')](function(_0x78b128){logger[_0x03fe('0x11')]('ZendeskField,\x20%s,\x20%s',_0x6a4599,_0x78b128);_0x25faf0(_0x78b128);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index bb02a1d..49fccc4 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 _0x0da5=['/:id/configurations','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields'];(function(_0x2dd615,_0x18099c){var _0x5255a4=function(_0x3f4c54){while(--_0x3f4c54){_0x2dd615['push'](_0x2dd615['shift']());}};_0x5255a4(++_0x18099c);}(_0x0da5,0x1d4));var _0x50da=function(_0x52c251,_0x222728){_0x52c251=_0x52c251-0x0;var _0x30ef67=_0x0da5[_0x52c251];return _0x30ef67;};'use strict';var multer=require(_0x50da('0x0'));var util=require(_0x50da('0x1'));var path=require(_0x50da('0x2'));var timeout=require(_0x50da('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x50da('0x4'));var auth=require(_0x50da('0x5'));var interaction=require(_0x50da('0x6'));var config=require('../../config/environment');var controller=require(_0x50da('0x7'));router[_0x50da('0x8')]('/',auth[_0x50da('0x9')](),controller[_0x50da('0xa')]);router[_0x50da('0x8')](_0x50da('0xb'),auth[_0x50da('0x9')](),controller[_0x50da('0xc')]);router[_0x50da('0x8')]('/:id/configurations',auth[_0x50da('0x9')](),controller[_0x50da('0xd')]);router[_0x50da('0x8')](_0x50da('0xe'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0x50da('0x9')](),controller['create']);router['post'](_0x50da('0xf'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x50da('0x10')](_0x50da('0xb'),auth[_0x50da('0x9')](),controller[_0x50da('0x11')]);router[_0x50da('0x12')](_0x50da('0xb'),auth[_0x50da('0x9')](),controller[_0x50da('0x13')]);module[_0x50da('0x14')]=router; \ No newline at end of file +var _0x4c22=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','/:id','delete','destroy','exports'];(function(_0x62bff4,_0x29f6e5){var _0x350842=function(_0x3140f9){while(--_0x3140f9){_0x62bff4['push'](_0x62bff4['shift']());}};_0x350842(++_0x29f6e5);}(_0x4c22,0x168));var _0x24c2=function(_0x58bc74,_0x369f38){_0x58bc74=_0x58bc74-0x0;var _0x46f7ac=_0x4c22[_0x58bc74];return _0x46f7ac;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x24c2('0x0'));var express=require(_0x24c2('0x1'));var router=express[_0x24c2('0x2')]();var fs_extra=require(_0x24c2('0x3'));var auth=require(_0x24c2('0x4'));var interaction=require(_0x24c2('0x5'));var config=require(_0x24c2('0x6'));var controller=require(_0x24c2('0x7'));router[_0x24c2('0x8')]('/',auth[_0x24c2('0x9')](),controller[_0x24c2('0xa')]);router[_0x24c2('0x8')]('/:id',auth[_0x24c2('0x9')](),controller[_0x24c2('0xb')]);router['get']('/:id/configurations',auth[_0x24c2('0x9')](),controller[_0x24c2('0xc')]);router['get'](_0x24c2('0xd'),auth[_0x24c2('0x9')](),controller[_0x24c2('0xe')]);router[_0x24c2('0xf')]('/',auth[_0x24c2('0x9')](),controller[_0x24c2('0x10')]);router['post'](_0x24c2('0x11'),auth[_0x24c2('0x9')](),controller[_0x24c2('0x12')]);router[_0x24c2('0x13')](_0x24c2('0x14'),auth[_0x24c2('0x9')](),controller['update']);router[_0x24c2('0x15')](_0x24c2('0x14'),auth[_0x24c2('0x9')](),controller[_0x24c2('0x16')]);module[_0x24c2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 8d9fbda..d7b4abf 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 _0xfd28=['exports','STRING'];(function(_0x3f078b,_0x281b59){var _0x1b75a7=function(_0x52f4ac){while(--_0x52f4ac){_0x3f078b['push'](_0x3f078b['shift']());}};_0x1b75a7(++_0x281b59);}(_0xfd28,0x148));var _0x8fd2=function(_0x12ca5f,_0x223d98){_0x12ca5f=_0x12ca5f-0x0;var _0xfc3ae9=_0xfd28[_0x12ca5f];return _0xfc3ae9;};'use strict';var Sequelize=require('sequelize');module[_0x8fd2('0x0')]={'name':{'type':Sequelize[_0x8fd2('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x8fd2('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x8fd2('0x1')]},'clientSecret':{'type':Sequelize[_0x8fd2('0x1')]},'serverUrl':{'type':Sequelize[_0x8fd2('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x8fd2('0x1')]}}; \ No newline at end of file +var _0xee5b=['sequelize','STRING'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xee5b,0x1f4));var _0xbee5=function(_0x1c6191,_0x27cffa){_0x1c6191=_0x1c6191-0x0;var _0x4c69fa=_0xee5b[_0x1c6191];return _0x4c69fa;};'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 diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 2c7161d..471750d 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 _0xd4a3=['pick','filter','where','merge','VIRTUAL','options','ZohoAccount','includeAll','include','rows','catch','show','params','length','create','body','find','getConfigurations','findOne','ZohoConfiguration','addConfiguration','Subjects','Descriptions','getDescriptions','channel','ZohoField','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','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','zone','clientSecret','serverUrl','code','zoho.eu','com','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','Calls','Zoho-oauthtoken\x20','response','Owner','Description','WhoId','Call_Start_Time','remove','includes','api_name','system_mandatory','push','display_label','data_type','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd4a3,0x1c1));var _0x3d4a=function(_0xbe4add,_0xa37530){_0xbe4add=_0xbe4add-0x0;var _0x2aa84c=_0xd4a3[_0xbe4add];return _0x2aa84c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3d4a('0x0'));var zipdir=require(_0x3d4a('0x1'));var jsonpatch=require(_0x3d4a('0x2'));var rp=require(_0x3d4a('0x3'));var moment=require(_0x3d4a('0x4'));var BPromise=require(_0x3d4a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3d4a('0x6'));var sox=require('sox');var csv=require(_0x3d4a('0x7'));var ejs=require(_0x3d4a('0x8'));var fs=require('fs');var fs_extra=require(_0x3d4a('0x9'));var _=require(_0x3d4a('0xa'));var squel=require(_0x3d4a('0xb'));var crypto=require(_0x3d4a('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3d4a('0x7'));var querystring=require(_0x3d4a('0xd'));var Papa=require(_0x3d4a('0xe'));var Redis=require('ioredis');var authService=require(_0x3d4a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x3d4a('0x10'));var hardwareService=require(_0x3d4a('0x11'));var logger=require(_0x3d4a('0x12'))('api');var utils=require(_0x3d4a('0x13'));var config=require(_0x3d4a('0x14'));var licenseUtil=require(_0x3d4a('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0x3d4a('0x16'));function respondWithStatusCode(_0x473813,_0x2e8f34){_0x2e8f34=_0x2e8f34||0xcc;return function(_0x382770){if(_0x382770){return _0x473813[_0x3d4a('0x17')](_0x2e8f34);}return _0x473813['status'](_0x2e8f34)[_0x3d4a('0x18')]();};}function respondWithResult(_0x3b7374,_0x58b5d3){_0x58b5d3=_0x58b5d3||0xc8;return function(_0x18c99e){if(_0x18c99e){return _0x3b7374[_0x3d4a('0x19')](_0x58b5d3)['json'](_0x18c99e);}};}function respondWithFilteredResult(_0x17cf23,_0x4e106f){return function(_0x2b1384){if(_0x2b1384){var _0x326d78=typeof _0x4e106f[_0x3d4a('0x1a')]===_0x3d4a('0x1b')&&typeof _0x4e106f[_0x3d4a('0x1c')]===_0x3d4a('0x1b');var _0x3d1e52=_0x2b1384['count'];var _0x38a0cc=_0x326d78?0x0:_0x4e106f[_0x3d4a('0x1a')];var _0x55e5b1=_0x326d78?_0x2b1384[_0x3d4a('0x1d')]:_0x4e106f['offset']+_0x4e106f[_0x3d4a('0x1c')];var _0x1cc37d;if(_0x55e5b1>=_0x3d1e52){_0x55e5b1=_0x3d1e52;_0x1cc37d=0xc8;}else{_0x1cc37d=0xce;}_0x17cf23[_0x3d4a('0x19')](_0x1cc37d);return _0x17cf23[_0x3d4a('0x1e')](_0x3d4a('0x1f'),_0x38a0cc+'-'+_0x55e5b1+'/'+_0x3d1e52)[_0x3d4a('0x20')](_0x2b1384);}return null;};}function patchUpdates(_0x752685){return function(_0x285318){try{jsonpatch['apply'](_0x285318,_0x752685,!![]);}catch(_0x153897){return BPromise[_0x3d4a('0x21')](_0x153897);}return _0x285318[_0x3d4a('0x22')]();};}function saveUpdates(_0x1bed35,_0x13cd64){return function(_0x4e596c){if(_0x4e596c){return _0x4e596c[_0x3d4a('0x23')](_0x1bed35)['then'](function(_0x4ea4e8){return _0x4ea4e8;});}return null;};}function removeEntity(_0x224b25,_0x10049b){return function(_0x476fac){if(_0x476fac){return _0x476fac[_0x3d4a('0x24')]()[_0x3d4a('0x25')](function(){_0x224b25['status'](0xcc)[_0x3d4a('0x18')]();});}};}function handleEntityNotFound(_0xb4b628,_0x32ca57){return function(_0x1b3c71){if(!_0x1b3c71){_0xb4b628[_0x3d4a('0x17')](0x194);}return _0x1b3c71;};}function handleError(_0x24f984,_0x2a636c){_0x2a636c=_0x2a636c||0x1f4;return function(_0x3a7ca8){logger[_0x3d4a('0x26')](_0x3a7ca8[_0x3d4a('0x27')]);if(_0x3a7ca8[_0x3d4a('0x28')]){delete _0x3a7ca8[_0x3d4a('0x28')];}_0x24f984['status'](_0x2a636c)[_0x3d4a('0x29')](_0x3a7ca8);};}exports[_0x3d4a('0x2a')]=function(_0x147208,_0x48d4ea){var _0x319ccb={},_0x3c326d={},_0x2300ba={'count':0x0,'rows':[]};var _0x2168d9=_[_0x3d4a('0x2b')](db['ZohoAccount'][_0x3d4a('0x2c')],function(_0x3f676b){return{'name':_0x3f676b[_0x3d4a('0x2d')],'type':_0x3f676b[_0x3d4a('0x2e')][_0x3d4a('0x2f')]};});_0x3c326d[_0x3d4a('0x30')]=_[_0x3d4a('0x2b')](_0x2168d9,_0x3d4a('0x28'));_0x3c326d['query']=_[_0x3d4a('0x31')](_0x147208['query']);_0x3c326d[_0x3d4a('0x32')]=_[_0x3d4a('0x33')](_0x3c326d['model'],_0x3c326d[_0x3d4a('0x34')]);_0x319ccb[_0x3d4a('0x35')]=_[_0x3d4a('0x33')](_0x3c326d['model'],qs[_0x3d4a('0x36')](_0x147208[_0x3d4a('0x34')][_0x3d4a('0x36')]));_0x319ccb['attributes']=_0x319ccb[_0x3d4a('0x35')]['length']?_0x319ccb['attributes']:_0x3c326d[_0x3d4a('0x30')];if(!_0x147208[_0x3d4a('0x34')][_0x3d4a('0x37')](_0x3d4a('0x38'))){_0x319ccb[_0x3d4a('0x1c')]=qs[_0x3d4a('0x1c')](_0x147208[_0x3d4a('0x34')][_0x3d4a('0x1c')]);_0x319ccb[_0x3d4a('0x1a')]=qs['offset'](_0x147208[_0x3d4a('0x34')][_0x3d4a('0x1a')]);}_0x319ccb[_0x3d4a('0x39')]=qs[_0x3d4a('0x3a')](_0x147208[_0x3d4a('0x34')][_0x3d4a('0x3a')]);_0x319ccb['where']=qs['filters'](_[_0x3d4a('0x3b')](_0x147208['query'],_0x3c326d[_0x3d4a('0x32')]),_0x2168d9);if(_0x147208[_0x3d4a('0x34')][_0x3d4a('0x3c')]){_0x319ccb[_0x3d4a('0x3d')]=_[_0x3d4a('0x3e')](_0x319ccb['where'],{'$or':_[_0x3d4a('0x2b')](_0x2168d9,function(_0x8b850){if(_0x8b850[_0x3d4a('0x2e')]!==_0x3d4a('0x3f')){var _0x43b6bc={};_0x43b6bc[_0x8b850[_0x3d4a('0x28')]]={'$like':'%'+_0x147208[_0x3d4a('0x34')]['filter']+'%'};return _0x43b6bc;}})});}_0x319ccb=_['merge']({},_0x319ccb,_0x147208[_0x3d4a('0x40')]);var _0x4e5607={'where':_0x319ccb[_0x3d4a('0x3d')]};return db[_0x3d4a('0x41')][_0x3d4a('0x1d')](_0x4e5607)[_0x3d4a('0x25')](function(_0xee2428){_0x2300ba[_0x3d4a('0x1d')]=_0xee2428;if(_0x147208[_0x3d4a('0x34')][_0x3d4a('0x42')]){_0x319ccb[_0x3d4a('0x43')]=[{'all':!![]}];}return db[_0x3d4a('0x41')]['findAll'](_0x319ccb);})[_0x3d4a('0x25')](function(_0x3cb387){_0x2300ba[_0x3d4a('0x44')]=_0x3cb387;return _0x2300ba;})[_0x3d4a('0x25')](respondWithFilteredResult(_0x48d4ea,_0x319ccb))[_0x3d4a('0x45')](handleError(_0x48d4ea,null));};exports[_0x3d4a('0x46')]=function(_0x491d09,_0x28ed31){var _0x1344a8={'raw':![],'where':{'id':_0x491d09[_0x3d4a('0x47')]['id']}},_0x469cfb={};_0x469cfb['model']=_[_0x3d4a('0x31')](db[_0x3d4a('0x41')][_0x3d4a('0x2c')]);_0x469cfb[_0x3d4a('0x34')]=_[_0x3d4a('0x31')](_0x491d09['query']);_0x469cfb['filters']=_[_0x3d4a('0x33')](_0x469cfb[_0x3d4a('0x30')],_0x469cfb['query']);_0x1344a8[_0x3d4a('0x35')]=_[_0x3d4a('0x33')](_0x469cfb['model'],qs['fields'](_0x491d09[_0x3d4a('0x34')][_0x3d4a('0x36')]));_0x1344a8[_0x3d4a('0x35')]=_0x1344a8[_0x3d4a('0x35')][_0x3d4a('0x48')]?_0x1344a8[_0x3d4a('0x35')]:_0x469cfb[_0x3d4a('0x30')];if(_0x491d09[_0x3d4a('0x34')][_0x3d4a('0x42')]){_0x1344a8['include']=[{'all':!![]}];}_0x1344a8=_[_0x3d4a('0x3e')]({},_0x1344a8,_0x491d09[_0x3d4a('0x40')]);return db[_0x3d4a('0x41')]['find'](_0x1344a8)[_0x3d4a('0x25')](handleEntityNotFound(_0x28ed31,null))['then'](respondWithResult(_0x28ed31,null))[_0x3d4a('0x45')](handleError(_0x28ed31,null));};exports[_0x3d4a('0x49')]=function(_0x101788,_0x28afba){return db[_0x3d4a('0x41')][_0x3d4a('0x49')](_0x101788[_0x3d4a('0x4a')],{})[_0x3d4a('0x25')](respondWithResult(_0x28afba,0xc9))['catch'](handleError(_0x28afba,null));};exports[_0x3d4a('0x23')]=function(_0x313c70,_0x3f1656){if(_0x313c70['body']['id']){delete _0x313c70[_0x3d4a('0x4a')]['id'];}return db['ZohoAccount'][_0x3d4a('0x4b')]({'where':{'id':_0x313c70[_0x3d4a('0x47')]['id']}})[_0x3d4a('0x25')](handleEntityNotFound(_0x3f1656,null))['then'](saveUpdates(_0x313c70['body'],null))['then'](respondWithResult(_0x3f1656,null))[_0x3d4a('0x45')](handleError(_0x3f1656,null));};exports[_0x3d4a('0x24')]=function(_0x24ea72,_0x56317e){return db[_0x3d4a('0x41')][_0x3d4a('0x4b')]({'where':{'id':_0x24ea72[_0x3d4a('0x47')]['id']}})[_0x3d4a('0x25')](handleEntityNotFound(_0x56317e,null))[_0x3d4a('0x25')](removeEntity(_0x56317e,null))[_0x3d4a('0x45')](handleError(_0x56317e,null));};exports[_0x3d4a('0x4c')]=function(_0x3380f3,_0x5a6a9a,_0x2507bf){var _0x1d3729={};var _0x3f02cf={};var _0x17dc82;var _0x506385;return db[_0x3d4a('0x41')][_0x3d4a('0x4d')]({'where':{'id':_0x3380f3[_0x3d4a('0x47')]['id']}})[_0x3d4a('0x25')](handleEntityNotFound(_0x5a6a9a,null))['then'](function(_0x240e1f){if(_0x240e1f){_0x17dc82=_0x240e1f;_0x3f02cf[_0x3d4a('0x30')]=_[_0x3d4a('0x31')](db[_0x3d4a('0x4e')]['rawAttributes']);_0x3f02cf[_0x3d4a('0x34')]=_[_0x3d4a('0x31')](_0x3380f3[_0x3d4a('0x34')]);_0x3f02cf[_0x3d4a('0x32')]=_[_0x3d4a('0x33')](_0x3f02cf[_0x3d4a('0x30')],_0x3f02cf[_0x3d4a('0x34')]);_0x1d3729['attributes']=_[_0x3d4a('0x33')](_0x3f02cf['model'],qs[_0x3d4a('0x36')](_0x3380f3[_0x3d4a('0x34')][_0x3d4a('0x36')]));_0x1d3729[_0x3d4a('0x35')]=_0x1d3729['attributes']['length']?_0x1d3729[_0x3d4a('0x35')]:_0x3f02cf[_0x3d4a('0x30')];_0x1d3729[_0x3d4a('0x39')]=qs[_0x3d4a('0x3a')](_0x3380f3[_0x3d4a('0x34')]['sort']);_0x1d3729[_0x3d4a('0x3d')]=qs[_0x3d4a('0x32')](_['pick'](_0x3380f3['query'],_0x3f02cf[_0x3d4a('0x32')]));if(_0x3380f3[_0x3d4a('0x34')][_0x3d4a('0x3c')]){_0x1d3729[_0x3d4a('0x3d')]=_[_0x3d4a('0x3e')](_0x1d3729['where'],{'$or':_[_0x3d4a('0x2b')](_0x1d3729[_0x3d4a('0x35')],function(_0x5bbd5b){var _0x13997d={};_0x13997d[_0x5bbd5b]={'$like':'%'+_0x3380f3[_0x3d4a('0x34')][_0x3d4a('0x3c')]+'%'};return _0x13997d;})});}_0x1d3729=_[_0x3d4a('0x3e')]({},_0x1d3729,_0x3380f3[_0x3d4a('0x40')]);return _0x17dc82[_0x3d4a('0x4c')](_0x1d3729);}})[_0x3d4a('0x25')](function(_0xe5de72){if(_0xe5de72){_0x506385=_0xe5de72[_0x3d4a('0x48')];if(!_0x3380f3['query']['hasOwnProperty'](_0x3d4a('0x38'))){_0x1d3729[_0x3d4a('0x1c')]=qs['limit'](_0x3380f3[_0x3d4a('0x34')]['limit']);_0x1d3729[_0x3d4a('0x1a')]=qs[_0x3d4a('0x1a')](_0x3380f3['query'][_0x3d4a('0x1a')]);}return _0x17dc82[_0x3d4a('0x4c')](_0x1d3729);}})[_0x3d4a('0x25')](function(_0x5ce7d1){if(_0x5ce7d1){return _0x5ce7d1?{'count':_0x506385,'rows':_0x5ce7d1}:null;}})['then'](respondWithResult(_0x5a6a9a,null))[_0x3d4a('0x45')](handleError(_0x5a6a9a,null));};exports[_0x3d4a('0x4f')]=function(_0x9e9eba,_0x5aff07,_0x126872){if(_0x9e9eba[_0x3d4a('0x4a')]['id']){delete _0x9e9eba['body']['id'];}return db[_0x3d4a('0x41')][_0x3d4a('0x4d')]({'where':{'id':_0x9e9eba[_0x3d4a('0x47')]['id']}})[_0x3d4a('0x25')](handleEntityNotFound(_0x5aff07,null))[_0x3d4a('0x25')](function(_0x4b3817){if(_0x4b3817){_0x9e9eba[_0x3d4a('0x4a')]['AccountId']=_0x4b3817['id'];_0x9e9eba[_0x3d4a('0x4a')][_0x3d4a('0x50')]=integrations['getSubjects'](_0x9e9eba[_0x3d4a('0x4a')]['channel'],_0x9e9eba[_0x3d4a('0x4a')][_0x3d4a('0x2e')]);_0x9e9eba[_0x3d4a('0x4a')][_0x3d4a('0x51')]=integrations[_0x3d4a('0x52')](_0x9e9eba[_0x3d4a('0x4a')][_0x3d4a('0x53')],_0x9e9eba['body'][_0x3d4a('0x2e')]);return db[_0x3d4a('0x4e')][_0x3d4a('0x49')](_0x9e9eba[_0x3d4a('0x4a')],{'include':[{'model':db[_0x3d4a('0x54')],'as':_0x3d4a('0x50')},{'model':db['ZohoField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x5aff07,null))[_0x3d4a('0x45')](handleError(_0x5aff07,null));};function getAccessToken(_0x424a82){return new Promise(function(_0x205535,_0x2b111b){var _0x1c913c;switch(_0x424a82['zone']){case'US':_0x1c913c=_0x3d4a('0x55');break;case'AU':_0x1c913c=_0x3d4a('0x56');break;case'EU':_0x1c913c=_0x3d4a('0x57');break;case'IN':_0x1c913c=_0x3d4a('0x58');break;case'CN':_0x1c913c=_0x3d4a('0x59');break;default:_0x1c913c=_0x3d4a('0x57');break;}var _0x51d9e6={'method':_0x3d4a('0x5a'),'uri':_0x1c913c+_0x3d4a('0x5b'),'qs':{'refresh_token':_0x424a82[_0x3d4a('0x5c')],'client_id':_0x424a82[_0x3d4a('0x5d')],'client_secret':_0x424a82['clientSecret'],'grant_type':_0x3d4a('0x5e')},'json':!![]};return rp(_0x51d9e6)[_0x3d4a('0x25')](function(_0x2f85de){if(_0x2f85de[_0x3d4a('0x5f')]){_0x205535(_0x2f85de[_0x3d4a('0x5f')]);}else{_0x2b111b(_0x3d4a('0x60'));}})[_0x3d4a('0x45')](function(_0xd38f2e){_0x2b111b(_0xd38f2e);});});}exports[_0x3d4a('0x61')]=function(_0x104a4f,_0x1dc770,_0x3a8927){var _0x3d9eb2,_0x379b23,_0x41a7a1,_0x3adfbd,_0x3bc34a;return db['ZohoAccount'][_0x3d4a('0x4d')]({'where':{'id':_0x104a4f[_0x3d4a('0x47')]['id']},'attributes':['id',_0x3d4a('0x62'),_0x3d4a('0x63'),_0x3d4a('0x5d'),_0x3d4a('0x64'),_0x3d4a('0x65'),_0x3d4a('0x66'),_0x3d4a('0x5c')]})['then'](handleEntityNotFound(_0x1dc770,null))[_0x3d4a('0x25')](function(_0x70f112){_0x3bc34a=_0x70f112;_0x3d9eb2=_0x3bc34a[_0x3d4a('0x62')];_0x379b23=_0x3d9eb2===_0x3d4a('0x67')?'eu':_0x3d4a('0x68');_0x41a7a1=_0x3bc34a['serverUrl'];var _0x421777=_0x41a7a1['slice'](-0x1);if(_0x421777==='/'||_0x421777==='\x5c'||_0x421777===':'){_0x41a7a1=_0x41a7a1[_0x3d4a('0x69')](0x0,_0x41a7a1[_0x3d4a('0x6a')](_0x421777));}if(!_0x3bc34a[_0x3d4a('0x5c')]){throw new Error(_0x3d4a('0x6b'));}return getAccessToken(_0x3bc34a);})[_0x3d4a('0x25')](function(_0x4d8988){if(_0x4d8988){return rp({'method':'GET','uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0x379b23),'qs':{'module':_0x3d4a('0x6c')},'headers':{'Authorization':_0x3d4a('0x6d')+_0x4d8988},'json':!![]});}})[_0x3d4a('0x25')](function(_0x9d14fd){if(_0x9d14fd){if(_0x9d14fd[_0x3d4a('0x6e')]&&_0x9d14fd[_0x3d4a('0x6e')][_0x3d4a('0x26')]){throw new Error(_0x9d14fd[_0x3d4a('0x6e')][_0x3d4a('0x26')]['message']);}var _0x20ef85=[];var _0x22a75b=[];var _0x5217fa=[_0x3d4a('0x6f'),'Subject',_0x3d4a('0x70'),_0x3d4a('0x71'),'Call_Duration','Call_Result',_0x3d4a('0x72'),'Call_Type'];_0x22a75b=_[_0x3d4a('0x73')](_0x9d14fd[_0x3d4a('0x36')],function(_0x129490){return _0x5217fa[_0x3d4a('0x74')](_0x129490[_0x3d4a('0x75')]);});for(var _0x46ddb6=0x0;_0x46ddb6<_0x22a75b[_0x3d4a('0x48')];_0x46ddb6++){if(_0x22a75b[_0x46ddb6][_0x3d4a('0x76')]===![]){_0x20ef85[_0x3d4a('0x77')]({'id':_0x22a75b[_0x46ddb6]['id'],'name':_0x22a75b[_0x46ddb6][_0x3d4a('0x78')],'custom':_0x22a75b[_0x46ddb6]['custom_field'],'options':_0x22a75b[_0x46ddb6][_0x3d4a('0x79')]==='picklist'&&_0x22a75b[_0x46ddb6]['pick_list_values'][_0x3d4a('0x48')]>-0x1?_[_0x3d4a('0x2b')](_0x22a75b[_0x46ddb6]['pick_list_values'],function(_0x360b84){return{'name':_0x360b84,'value':_0x360b84};}):[]});}}return{'count':_0x20ef85[_0x3d4a('0x48')],'rows':_0x20ef85};}else{return{'count':0x0,'rows':[]};}})[_0x3d4a('0x25')](respondWithResult(_0x1dc770,null))[_0x3d4a('0x45')](function(_0x57241a){var _0x6bfd44=_0x104a4f[_0x3d4a('0x34')][_0x3d4a('0x7a')]?0x1f4:_0x57241a[_0x3d4a('0x7b')]||0x1f4;logger[_0x3d4a('0x26')](_0x3d4a('0x7c'),'getFields',_0x6bfd44,JSON[_0x3d4a('0x7d')](_0x57241a));delete _0x57241a['name'];if(_0x6bfd44===0x191){_0x6bfd44=0x190;}_0x1dc770[_0x3d4a('0x19')](_0x6bfd44)[_0x3d4a('0x29')](_0x104a4f[_0x3d4a('0x34')][_0x3d4a('0x7a')]?{'message':_0x3d4a('0x7e'),'statusCode':_0x57241a[_0x3d4a('0x7b')]}:_0x57241a);});}; \ No newline at end of file +var _0x908c=['model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','include','catch','params','keys','find','create','body','update','getConfigurations','findOne','ZohoConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','https://accounts.zoho.com','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','zone','serverUrl','code','zoho.eu','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','Calls','Zoho-oauthtoken\x20','response','message','Subject','WhoId','Call_Duration','Call_Start_Time','remove','api_name','system_mandatory','push','display_label','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','sox','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','error','name','index','map','ZohoAccount','rawAttributes','fieldName','key'];(function(_0x30aadd,_0x20a265){var _0x428865=function(_0x40e630){while(--_0x40e630){_0x30aadd['push'](_0x30aadd['shift']());}};_0x428865(++_0x20a265);}(_0x908c,0xc2));var _0xc908=function(_0x6c9938,_0x4db09c){_0x6c9938=_0x6c9938-0x0;var _0x185c9d=_0x908c[_0x6c9938];return _0x185c9d;};'use strict';var emlformat=require(_0xc908('0x0'));var rimraf=require(_0xc908('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc908('0x2'));var rp=require(_0xc908('0x3'));var moment=require(_0xc908('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc908('0x5'));var util=require('util');var path=require('path');var sox=require(_0xc908('0x6'));var csv=require('to-csv');var ejs=require(_0xc908('0x7'));var fs=require('fs');var fs_extra=require(_0xc908('0x8'));var _=require(_0xc908('0x9'));var squel=require(_0xc908('0xa'));var crypto=require(_0xc908('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc908('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc908('0xd'));var Papa=require(_0xc908('0xe'));var Redis=require(_0xc908('0xf'));var authService=require(_0xc908('0x10'));var qs=require(_0xc908('0x11'));var as=require(_0xc908('0x12'));var hardwareService=require(_0xc908('0x13'));var logger=require(_0xc908('0x14'))('api');var utils=require(_0xc908('0x15'));var config=require(_0xc908('0x16'));var licenseUtil=require(_0xc908('0x17'));var db=require(_0xc908('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1efcbf,_0x11666d){_0x11666d=_0x11666d||0xcc;return function(_0x4fde72){if(_0x4fde72){return _0x1efcbf['sendStatus'](_0x11666d);}return _0x1efcbf['status'](_0x11666d)[_0xc908('0x19')]();};}function respondWithResult(_0x42761d,_0x49f0da){_0x49f0da=_0x49f0da||0xc8;return function(_0x1c635b){if(_0x1c635b){return _0x42761d[_0xc908('0x1a')](_0x49f0da)['json'](_0x1c635b);}};}function respondWithFilteredResult(_0x3137d3,_0x3e6a02){return function(_0x32b3bb){if(_0x32b3bb){var _0x4cda58=typeof _0x3e6a02[_0xc908('0x1b')]==='undefined'&&typeof _0x3e6a02[_0xc908('0x1c')]==='undefined';var _0x18d23c=_0x32b3bb['count'];var _0x1ffaf4=_0x4cda58?0x0:_0x3e6a02['offset'];var _0x458b12=_0x4cda58?_0x32b3bb[_0xc908('0x1d')]:_0x3e6a02[_0xc908('0x1b')]+_0x3e6a02[_0xc908('0x1c')];var _0x2085b7;if(_0x458b12>=_0x18d23c){_0x458b12=_0x18d23c;_0x2085b7=0xc8;}else{_0x2085b7=0xce;}_0x3137d3[_0xc908('0x1a')](_0x2085b7);return _0x3137d3[_0xc908('0x1e')](_0xc908('0x1f'),_0x1ffaf4+'-'+_0x458b12+'/'+_0x18d23c)[_0xc908('0x20')](_0x32b3bb);}return null;};}function patchUpdates(_0x42a8df){return function(_0x49d63c){try{jsonpatch[_0xc908('0x21')](_0x49d63c,_0x42a8df,!![]);}catch(_0x12358c){return BPromise[_0xc908('0x22')](_0x12358c);}return _0x49d63c[_0xc908('0x23')]();};}function saveUpdates(_0x23b444,_0xeb3791){return function(_0x373222){if(_0x373222){return _0x373222['update'](_0x23b444)[_0xc908('0x24')](function(_0x34c857){return _0x34c857;});}return null;};}function removeEntity(_0x382753,_0x2358ad){return function(_0xe65efd){if(_0xe65efd){return _0xe65efd[_0xc908('0x25')]()[_0xc908('0x24')](function(){_0x382753[_0xc908('0x1a')](0xcc)[_0xc908('0x19')]();});}};}function handleEntityNotFound(_0x36f1b8,_0x254c22){return function(_0x154a78){if(!_0x154a78){_0x36f1b8['sendStatus'](0x194);}return _0x154a78;};}function handleError(_0x321010,_0xd7b487){_0xd7b487=_0xd7b487||0x1f4;return function(_0x4cd9db){logger[_0xc908('0x26')](_0x4cd9db['stack']);if(_0x4cd9db[_0xc908('0x27')]){delete _0x4cd9db['name'];}_0x321010[_0xc908('0x1a')](_0xd7b487)['send'](_0x4cd9db);};}exports[_0xc908('0x28')]=function(_0xf74099,_0x457c00){var _0x1b110b={},_0x552c8c={},_0x31703b={'count':0x0,'rows':[]};var _0x543452=_[_0xc908('0x29')](db[_0xc908('0x2a')][_0xc908('0x2b')],function(_0x56565b){return{'name':_0x56565b[_0xc908('0x2c')],'type':_0x56565b['type'][_0xc908('0x2d')]};});_0x552c8c[_0xc908('0x2e')]=_[_0xc908('0x29')](_0x543452,'name');_0x552c8c[_0xc908('0x2f')]=_['keys'](_0xf74099[_0xc908('0x2f')]);_0x552c8c['filters']=_[_0xc908('0x30')](_0x552c8c[_0xc908('0x2e')],_0x552c8c[_0xc908('0x2f')]);_0x1b110b[_0xc908('0x31')]=_[_0xc908('0x30')](_0x552c8c[_0xc908('0x2e')],qs[_0xc908('0x32')](_0xf74099[_0xc908('0x2f')][_0xc908('0x32')]));_0x1b110b['attributes']=_0x1b110b[_0xc908('0x31')][_0xc908('0x33')]?_0x1b110b['attributes']:_0x552c8c[_0xc908('0x2e')];if(!_0xf74099[_0xc908('0x2f')][_0xc908('0x34')](_0xc908('0x35'))){_0x1b110b[_0xc908('0x1c')]=qs[_0xc908('0x1c')](_0xf74099[_0xc908('0x2f')][_0xc908('0x1c')]);_0x1b110b['offset']=qs[_0xc908('0x1b')](_0xf74099[_0xc908('0x2f')]['offset']);}_0x1b110b['order']=qs['sort'](_0xf74099[_0xc908('0x2f')][_0xc908('0x36')]);_0x1b110b[_0xc908('0x37')]=qs[_0xc908('0x38')](_[_0xc908('0x39')](_0xf74099[_0xc908('0x2f')],_0x552c8c[_0xc908('0x38')]),_0x543452);if(_0xf74099[_0xc908('0x2f')]['filter']){_0x1b110b[_0xc908('0x37')]=_[_0xc908('0x3a')](_0x1b110b[_0xc908('0x37')],{'$or':_[_0xc908('0x29')](_0x543452,function(_0x3e336e){if(_0x3e336e[_0xc908('0x3b')]!==_0xc908('0x3c')){var _0x3974d9={};_0x3974d9[_0x3e336e[_0xc908('0x27')]]={'$like':'%'+_0xf74099[_0xc908('0x2f')][_0xc908('0x3d')]+'%'};return _0x3974d9;}})});}_0x1b110b=_[_0xc908('0x3a')]({},_0x1b110b,_0xf74099[_0xc908('0x3e')]);var _0x28c2fa={'where':_0x1b110b[_0xc908('0x37')]};return db[_0xc908('0x2a')][_0xc908('0x1d')](_0x28c2fa)[_0xc908('0x24')](function(_0xd4bb70){_0x31703b[_0xc908('0x1d')]=_0xd4bb70;if(_0xf74099['query']['includeAll']){_0x1b110b[_0xc908('0x3f')]=[{'all':!![]}];}return db[_0xc908('0x2a')]['findAll'](_0x1b110b);})[_0xc908('0x24')](function(_0x4d7560){_0x31703b['rows']=_0x4d7560;return _0x31703b;})[_0xc908('0x24')](respondWithFilteredResult(_0x457c00,_0x1b110b))[_0xc908('0x40')](handleError(_0x457c00,null));};exports['show']=function(_0x21dd64,_0x274099){var _0x21b988={'raw':![],'where':{'id':_0x21dd64[_0xc908('0x41')]['id']}},_0x4aba00={};_0x4aba00['model']=_[_0xc908('0x42')](db['ZohoAccount'][_0xc908('0x2b')]);_0x4aba00[_0xc908('0x2f')]=_[_0xc908('0x42')](_0x21dd64[_0xc908('0x2f')]);_0x4aba00[_0xc908('0x38')]=_['intersection'](_0x4aba00['model'],_0x4aba00[_0xc908('0x2f')]);_0x21b988['attributes']=_[_0xc908('0x30')](_0x4aba00[_0xc908('0x2e')],qs[_0xc908('0x32')](_0x21dd64[_0xc908('0x2f')][_0xc908('0x32')]));_0x21b988['attributes']=_0x21b988['attributes'][_0xc908('0x33')]?_0x21b988[_0xc908('0x31')]:_0x4aba00[_0xc908('0x2e')];if(_0x21dd64[_0xc908('0x2f')]['includeAll']){_0x21b988[_0xc908('0x3f')]=[{'all':!![]}];}_0x21b988=_[_0xc908('0x3a')]({},_0x21b988,_0x21dd64[_0xc908('0x3e')]);return db[_0xc908('0x2a')][_0xc908('0x43')](_0x21b988)['then'](handleEntityNotFound(_0x274099,null))[_0xc908('0x24')](respondWithResult(_0x274099,null))[_0xc908('0x40')](handleError(_0x274099,null));};exports[_0xc908('0x44')]=function(_0x595a05,_0x153f9e){return db[_0xc908('0x2a')][_0xc908('0x44')](_0x595a05[_0xc908('0x45')],{})['then'](respondWithResult(_0x153f9e,0xc9))[_0xc908('0x40')](handleError(_0x153f9e,null));};exports[_0xc908('0x46')]=function(_0x2ee2c4,_0x181cab){if(_0x2ee2c4[_0xc908('0x45')]['id']){delete _0x2ee2c4[_0xc908('0x45')]['id'];}return db['ZohoAccount']['find']({'where':{'id':_0x2ee2c4[_0xc908('0x41')]['id']}})[_0xc908('0x24')](handleEntityNotFound(_0x181cab,null))[_0xc908('0x24')](saveUpdates(_0x2ee2c4[_0xc908('0x45')],null))[_0xc908('0x24')](respondWithResult(_0x181cab,null))[_0xc908('0x40')](handleError(_0x181cab,null));};exports[_0xc908('0x25')]=function(_0x4a3724,_0x2af4a6){return db[_0xc908('0x2a')][_0xc908('0x43')]({'where':{'id':_0x4a3724[_0xc908('0x41')]['id']}})[_0xc908('0x24')](handleEntityNotFound(_0x2af4a6,null))[_0xc908('0x24')](removeEntity(_0x2af4a6,null))[_0xc908('0x40')](handleError(_0x2af4a6,null));};exports[_0xc908('0x47')]=function(_0x2123d3,_0xc5b18f,_0x568fb7){var _0x2fc3db={};var _0x38cb9d={};var _0x218960;var _0x7d938d;return db[_0xc908('0x2a')][_0xc908('0x48')]({'where':{'id':_0x2123d3['params']['id']}})[_0xc908('0x24')](handleEntityNotFound(_0xc5b18f,null))['then'](function(_0x48b511){if(_0x48b511){_0x218960=_0x48b511;_0x38cb9d['model']=_['keys'](db[_0xc908('0x49')][_0xc908('0x2b')]);_0x38cb9d['query']=_[_0xc908('0x42')](_0x2123d3[_0xc908('0x2f')]);_0x38cb9d[_0xc908('0x38')]=_['intersection'](_0x38cb9d['model'],_0x38cb9d[_0xc908('0x2f')]);_0x2fc3db[_0xc908('0x31')]=_[_0xc908('0x30')](_0x38cb9d[_0xc908('0x2e')],qs[_0xc908('0x32')](_0x2123d3['query'][_0xc908('0x32')]));_0x2fc3db[_0xc908('0x31')]=_0x2fc3db[_0xc908('0x31')]['length']?_0x2fc3db['attributes']:_0x38cb9d[_0xc908('0x2e')];_0x2fc3db['order']=qs[_0xc908('0x36')](_0x2123d3[_0xc908('0x2f')][_0xc908('0x36')]);_0x2fc3db[_0xc908('0x37')]=qs[_0xc908('0x38')](_[_0xc908('0x39')](_0x2123d3[_0xc908('0x2f')],_0x38cb9d[_0xc908('0x38')]));if(_0x2123d3['query']['filter']){_0x2fc3db[_0xc908('0x37')]=_[_0xc908('0x3a')](_0x2fc3db[_0xc908('0x37')],{'$or':_['map'](_0x2fc3db[_0xc908('0x31')],function(_0x538691){var _0x30e4c6={};_0x30e4c6[_0x538691]={'$like':'%'+_0x2123d3[_0xc908('0x2f')][_0xc908('0x3d')]+'%'};return _0x30e4c6;})});}_0x2fc3db=_[_0xc908('0x3a')]({},_0x2fc3db,_0x2123d3[_0xc908('0x3e')]);return _0x218960[_0xc908('0x47')](_0x2fc3db);}})[_0xc908('0x24')](function(_0x9e9be4){if(_0x9e9be4){_0x7d938d=_0x9e9be4[_0xc908('0x33')];if(!_0x2123d3['query'][_0xc908('0x34')](_0xc908('0x35'))){_0x2fc3db['limit']=qs['limit'](_0x2123d3['query'][_0xc908('0x1c')]);_0x2fc3db['offset']=qs['offset'](_0x2123d3[_0xc908('0x2f')]['offset']);}return _0x218960[_0xc908('0x47')](_0x2fc3db);}})[_0xc908('0x24')](function(_0x3f7cfe){if(_0x3f7cfe){return _0x3f7cfe?{'count':_0x7d938d,'rows':_0x3f7cfe}:null;}})[_0xc908('0x24')](respondWithResult(_0xc5b18f,null))[_0xc908('0x40')](handleError(_0xc5b18f,null));};exports[_0xc908('0x4a')]=function(_0x5a3c67,_0x39342f,_0x248bff){if(_0x5a3c67[_0xc908('0x45')]['id']){delete _0x5a3c67[_0xc908('0x45')]['id'];}return db[_0xc908('0x2a')][_0xc908('0x48')]({'where':{'id':_0x5a3c67[_0xc908('0x41')]['id']}})[_0xc908('0x24')](handleEntityNotFound(_0x39342f,null))[_0xc908('0x24')](function(_0x3ea7c4){if(_0x3ea7c4){_0x5a3c67[_0xc908('0x45')][_0xc908('0x4b')]=_0x3ea7c4['id'];_0x5a3c67[_0xc908('0x45')]['Subjects']=integrations[_0xc908('0x4c')](_0x5a3c67['body'][_0xc908('0x4d')],_0x5a3c67['body']['type']);_0x5a3c67['body'][_0xc908('0x4e')]=integrations[_0xc908('0x4f')](_0x5a3c67[_0xc908('0x45')]['channel'],_0x5a3c67[_0xc908('0x45')]['type']);return db[_0xc908('0x49')]['create'](_0x5a3c67[_0xc908('0x45')],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db['ZohoField'],'as':_0xc908('0x4e')}]});}return null;})['then'](respondWithResult(_0x39342f,null))[_0xc908('0x40')](handleError(_0x39342f,null));};function getAccessToken(_0x1b17dc){return new Promise(function(_0x32b0fb,_0x115dd7){var _0x5c1e40;switch(_0x1b17dc['zone']){case'US':_0x5c1e40=_0xc908('0x50');break;case'AU':_0x5c1e40='https://accounts.zoho.com.au';break;case'EU':_0x5c1e40=_0xc908('0x51');break;case'IN':_0x5c1e40='https://accounts.zoho.in';break;case'CN':_0x5c1e40='https://accounts.zoho.com.cn';break;default:_0x5c1e40='https://accounts.zoho.eu';break;}var _0x2d5f10={'method':_0xc908('0x52'),'uri':_0x5c1e40+_0xc908('0x53'),'qs':{'refresh_token':_0x1b17dc[_0xc908('0x54')],'client_id':_0x1b17dc[_0xc908('0x55')],'client_secret':_0x1b17dc[_0xc908('0x56')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x2d5f10)[_0xc908('0x24')](function(_0x316157){if(_0x316157[_0xc908('0x57')]){_0x32b0fb(_0x316157[_0xc908('0x57')]);}else{_0x115dd7(_0xc908('0x58'));}})[_0xc908('0x40')](function(_0x4f06c3){_0x115dd7(_0x4f06c3);});});}exports['getFields']=function(_0x156fc4,_0x4c1547,_0x360192){var _0x59c286,_0x4a8074,_0x346360,_0x524b71,_0x2331e3;return db[_0xc908('0x2a')][_0xc908('0x48')]({'where':{'id':_0x156fc4[_0xc908('0x41')]['id']},'attributes':['id',_0xc908('0x59'),_0xc908('0x5a'),_0xc908('0x55'),_0xc908('0x56'),_0xc908('0x5b'),_0xc908('0x5c'),_0xc908('0x54')]})['then'](handleEntityNotFound(_0x4c1547,null))[_0xc908('0x24')](function(_0x449cac){_0x2331e3=_0x449cac;_0x59c286=_0x2331e3['host'];_0x4a8074=_0x59c286===_0xc908('0x5d')?'eu':'com';_0x346360=_0x2331e3[_0xc908('0x5b')];var _0x21b201=_0x346360[_0xc908('0x5e')](-0x1);if(_0x21b201==='/'||_0x21b201==='\x5c'||_0x21b201===':'){_0x346360=_0x346360[_0xc908('0x5f')](0x0,_0x346360[_0xc908('0x60')](_0x21b201));}if(!_0x2331e3[_0xc908('0x54')]){throw new Error(_0xc908('0x61'));}return getAccessToken(_0x2331e3);})[_0xc908('0x24')](function(_0x52ef5e){if(_0x52ef5e){return rp({'method':_0xc908('0x62'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0x4a8074),'qs':{'module':_0xc908('0x63')},'headers':{'Authorization':_0xc908('0x64')+_0x52ef5e},'json':!![]});}})['then'](function(_0x285fc8){if(_0x285fc8){if(_0x285fc8[_0xc908('0x65')]&&_0x285fc8[_0xc908('0x65')][_0xc908('0x26')]){throw new Error(_0x285fc8[_0xc908('0x65')][_0xc908('0x26')][_0xc908('0x66')]);}var _0x3c15f9=[];var _0x22474c=[];var _0xb5ac60=['Owner',_0xc908('0x67'),'Description',_0xc908('0x68'),_0xc908('0x69'),'Call_Result',_0xc908('0x6a'),'Call_Type'];_0x22474c=_[_0xc908('0x6b')](_0x285fc8[_0xc908('0x32')],function(_0x264b07){return _0xb5ac60['includes'](_0x264b07[_0xc908('0x6c')]);});for(var _0x141fd4=0x0;_0x141fd4<_0x22474c[_0xc908('0x33')];_0x141fd4++){if(_0x22474c[_0x141fd4][_0xc908('0x6d')]===![]){_0x3c15f9[_0xc908('0x6e')]({'id':_0x22474c[_0x141fd4]['id'],'name':_0x22474c[_0x141fd4][_0xc908('0x6f')],'custom':_0x22474c[_0x141fd4]['custom_field'],'options':_0x22474c[_0x141fd4][_0xc908('0x70')]===_0xc908('0x71')&&_0x22474c[_0x141fd4][_0xc908('0x72')]['length']>-0x1?_['map'](_0x22474c[_0x141fd4][_0xc908('0x72')],function(_0x5764a6){return{'name':_0x5764a6,'value':_0x5764a6};}):[]});}}return{'count':_0x3c15f9['length'],'rows':_0x3c15f9};}else{return{'count':0x0,'rows':[]};}})[_0xc908('0x24')](respondWithResult(_0x4c1547,null))[_0xc908('0x40')](function(_0x557b38){var _0x29a634=_0x156fc4['query']['test']?0x1f4:_0x557b38[_0xc908('0x73')]||0x1f4;logger['error'](_0xc908('0x74'),_0xc908('0x75'),_0x29a634,JSON[_0xc908('0x76')](_0x557b38));delete _0x557b38['name'];if(_0x29a634===0x191){_0x29a634=0x190;}_0x4c1547[_0xc908('0x1a')](_0x29a634)['send'](_0x156fc4['query']['test']?{'message':_0xc908('0x77'),'statusCode':_0x557b38[_0xc908('0x73')]}:_0x557b38);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 9dbfcb7..4de08fc 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 _0xbe88=['ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','catch','lodash','util','api','moment','bluebird','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','refresh_token','refreshToken','info','format','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','substring','https://accounts.zoho.in','then','parse'];(function(_0x149cbe,_0x343453){var _0x1ccebd=function(_0x5b41a2){while(--_0x5b41a2){_0x149cbe['push'](_0x149cbe['shift']());}};_0x1ccebd(++_0x343453);}(_0xbe88,0x17c));var _0x8be8=function(_0x213ed5,_0x26712a){_0x213ed5=_0x213ed5-0x0;var _0x191514=_0xbe88[_0x213ed5];return _0x191514;};'use strict';var _=require(_0x8be8('0x0'));var util=require(_0x8be8('0x1'));var logger=require('../../config/logger')(_0x8be8('0x2'));var moment=require(_0x8be8('0x3'));var BPromise=require(_0x8be8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8be8('0x5'));var rimraf=require('rimraf');var config=require(_0x8be8('0x6'));var attributes=require(_0x8be8('0x7'));var integrations=require(_0x8be8('0x8'));module[_0x8be8('0x9')]=function(_0xcfe9fc,_0x57e9a3){return _0xcfe9fc['define'](_0x8be8('0xa'),attributes,{'tableName':_0x8be8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3992a5,_0x9301eb,_0x938ee2){if(_0x3992a5[_0x8be8('0xc')](_0x8be8('0xd'))||_0x3992a5[_0x8be8('0xc')](_0x8be8('0xe'))||_0x3992a5[_0x8be8('0xc')](_0x8be8('0xf'))||_0x3992a5[_0x8be8('0xc')](_0x8be8('0x10'))||_0x3992a5[_0x8be8('0xc')](_0x8be8('0x11'))||_0x3992a5['changed'](_0x8be8('0x12'))){var _0x4d2e22,_0x540711;_0x4d2e22=_0x3992a5[_0x8be8('0xe')];var _0x1312a1=_0x4d2e22[_0x8be8('0x13')](-0x1);if(_0x1312a1==='/'||_0x1312a1==='\x5c'||_0x1312a1===':'){_0x4d2e22=_0x4d2e22['substring'](0x0,_0x4d2e22[_0x8be8('0x14')](_0x1312a1));}switch(_0x3992a5['zone']){case'US':_0x540711=_0x8be8('0x15');break;case'AU':_0x540711=_0x8be8('0x16');break;case'IN':_0x540711='https://accounts.zoho.in';break;case'CN':_0x540711=_0x8be8('0x17');break;default:_0x540711='https://accounts.zoho.eu';break;}var _0x45074b={'method':_0x8be8('0x18'),'uri':_0x540711+_0x8be8('0x19'),'form':{'grant_type':_0x8be8('0x1a'),'client_id':_0x3992a5[_0x8be8('0xf')],'client_secret':_0x3992a5['clientSecret'],'redirect_uri':_0x3992a5[_0x8be8('0xe')],'code':_0x3992a5[_0x8be8('0x11')]},'headers':{'Content-Type':_0x8be8('0x1b')}};return rp(_0x45074b)['then'](function(_0x88f83c){var _0xd3dbf3=JSON['parse'](_0x88f83c);if(_0xd3dbf3[_0x8be8('0x1c')]){_0x3992a5[_0x8be8('0x1d')]=_0xd3dbf3[_0x8be8('0x1c')];logger[_0x8be8('0x1e')](util[_0x8be8('0x1f')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3992a5[_0x8be8('0x20')],_0x3992a5['id']));}else{logger[_0x8be8('0x21')](util[_0x8be8('0x1f')](_0x8be8('0x22'),_0x3992a5[_0x8be8('0x20')],_0x3992a5['id']),util[_0x8be8('0x23')](_0xd3dbf3,{'showHidden':![],'depth':null}));}return _0x938ee2(null,_0x9301eb);})['catch'](function(_0x70f11d){logger[_0x8be8('0x21')](util[_0x8be8('0x1f')](_0x8be8('0x22'),_0x3992a5[_0x8be8('0x20')],_0x3992a5['id']),util[_0x8be8('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x938ee2(_0x70f11d);});}else{return _0x938ee2(null,_0x9301eb);}},'beforeUpdate':function(_0x1977ef,_0x5bbb21,_0x266dd2){if(_0x1977ef[_0x8be8('0xc')](_0x8be8('0xd'))||_0x1977ef['changed'](_0x8be8('0xe'))||_0x1977ef['changed']('clientId')||_0x1977ef[_0x8be8('0xc')](_0x8be8('0x10'))||_0x1977ef[_0x8be8('0xc')](_0x8be8('0x11'))||_0x1977ef['changed']('host')){var _0x249752,_0xf0dc15;_0x249752=_0x1977ef[_0x8be8('0xe')];var _0x3c8e0f=_0x249752[_0x8be8('0x13')](-0x1);if(_0x3c8e0f==='/'||_0x3c8e0f==='\x5c'||_0x3c8e0f===':'){_0x249752=_0x249752[_0x8be8('0x24')](0x0,_0x249752[_0x8be8('0x14')](_0x3c8e0f));}switch(_0x1977ef[_0x8be8('0xd')]){case'US':_0xf0dc15=_0x8be8('0x15');break;case'AU':_0xf0dc15=_0x8be8('0x16');break;case'IN':_0xf0dc15=_0x8be8('0x25');break;case'CN':_0xf0dc15='https://accounts.zoho.com.cn';break;default:_0xf0dc15='https://accounts.zoho.eu';break;}var _0x1c73c0={'method':_0x8be8('0x18'),'uri':_0xf0dc15+_0x8be8('0x19'),'form':{'grant_type':_0x8be8('0x1a'),'client_id':_0x1977ef[_0x8be8('0xf')],'client_secret':_0x1977ef[_0x8be8('0x10')],'redirect_uri':_0x1977ef[_0x8be8('0xe')],'code':_0x1977ef['code']},'headers':{'Content-Type':_0x8be8('0x1b')}};return rp(_0x1c73c0)[_0x8be8('0x26')](function(_0x173513){var _0x5c90e4=JSON[_0x8be8('0x27')](_0x173513);if(_0x5c90e4[_0x8be8('0x1c')]){_0x1977ef['refreshToken']=_0x5c90e4[_0x8be8('0x1c')];logger['info'](util[_0x8be8('0x1f')](_0x8be8('0x28'),_0x1977ef[_0x8be8('0x20')],_0x1977ef['id']));}else{logger[_0x8be8('0x21')](util['format'](_0x8be8('0x22'),_0x1977ef[_0x8be8('0x20')],_0x1977ef['id']),util['inspect'](_0x5c90e4,{'showHidden':![],'depth':null}));}return _0x266dd2(null,_0x5bbb21);})[_0x8be8('0x29')](function(_0x221873){logger[_0x8be8('0x21')](util['format'](_0x8be8('0x22'),_0x1977ef[_0x8be8('0x20')],_0x1977ef['id']),util[_0x8be8('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x266dd2(_0x221873);});}else{return _0x266dd2(null,_0x5bbb21);}}}});}; \ No newline at end of file +var _0xc9d9=['https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientId','clientSecret','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','name','error','inspect','catch','https://accounts.zoho.com.cn','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports','changed','zone','code','host','serverUrl','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au'];(function(_0x57975f,_0x388556){var _0x4793b8=function(_0x652c05){while(--_0x652c05){_0x57975f['push'](_0x57975f['shift']());}};_0x4793b8(++_0x388556);}(_0xc9d9,0x65));var _0x9c9d=function(_0x36314d,_0x56bbd5){_0x36314d=_0x36314d-0x0;var _0x224656=_0xc9d9[_0x36314d];return _0x224656;};'use strict';var _=require(_0x9c9d('0x0'));var util=require(_0x9c9d('0x1'));var logger=require(_0x9c9d('0x2'))(_0x9c9d('0x3'));var moment=require(_0x9c9d('0x4'));var BPromise=require('bluebird');var rp=require(_0x9c9d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9c9d('0x6'));var config=require(_0x9c9d('0x7'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x9c9d('0x8'));module[_0x9c9d('0x9')]=function(_0x57ea26,_0x1c105a){return _0x57ea26['define']('ZohoAccount',attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x463a1f,_0x49e6ae,_0x3899bb){if(_0x463a1f[_0x9c9d('0xa')](_0x9c9d('0xb'))||_0x463a1f[_0x9c9d('0xa')]('serverUrl')||_0x463a1f[_0x9c9d('0xa')]('clientId')||_0x463a1f[_0x9c9d('0xa')]('clientSecret')||_0x463a1f[_0x9c9d('0xa')](_0x9c9d('0xc'))||_0x463a1f[_0x9c9d('0xa')](_0x9c9d('0xd'))){var _0x4e9a9a,_0x1f942c;_0x4e9a9a=_0x463a1f[_0x9c9d('0xe')];var _0x5400f1=_0x4e9a9a['slice'](-0x1);if(_0x5400f1==='/'||_0x5400f1==='\x5c'||_0x5400f1===':'){_0x4e9a9a=_0x4e9a9a[_0x9c9d('0xf')](0x0,_0x4e9a9a[_0x9c9d('0x10')](_0x5400f1));}switch(_0x463a1f[_0x9c9d('0xb')]){case'US':_0x1f942c=_0x9c9d('0x11');break;case'AU':_0x1f942c=_0x9c9d('0x12');break;case'IN':_0x1f942c=_0x9c9d('0x13');break;case'CN':_0x1f942c='https://accounts.zoho.com.cn';break;default:_0x1f942c=_0x9c9d('0x14');break;}var _0x2759e6={'method':_0x9c9d('0x15'),'uri':_0x1f942c+_0x9c9d('0x16'),'form':{'grant_type':_0x9c9d('0x17'),'client_id':_0x463a1f[_0x9c9d('0x18')],'client_secret':_0x463a1f[_0x9c9d('0x19')],'redirect_uri':_0x463a1f[_0x9c9d('0xe')],'code':_0x463a1f['code']},'headers':{'Content-Type':_0x9c9d('0x1a')}};return rp(_0x2759e6)[_0x9c9d('0x1b')](function(_0x330455){var _0x235ca0=JSON[_0x9c9d('0x1c')](_0x330455);if(_0x235ca0[_0x9c9d('0x1d')]){_0x463a1f[_0x9c9d('0x1e')]=_0x235ca0[_0x9c9d('0x1d')];logger[_0x9c9d('0x1f')](util[_0x9c9d('0x20')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x463a1f[_0x9c9d('0x21')],_0x463a1f['id']));}else{logger[_0x9c9d('0x22')](util[_0x9c9d('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x463a1f[_0x9c9d('0x21')],_0x463a1f['id']),util[_0x9c9d('0x23')](_0x235ca0,{'showHidden':![],'depth':null}));}return _0x3899bb(null,_0x49e6ae);})[_0x9c9d('0x24')](function(_0x49f23a){logger[_0x9c9d('0x22')](util[_0x9c9d('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x463a1f[_0x9c9d('0x21')],_0x463a1f['id']),util[_0x9c9d('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x3899bb(_0x49f23a);});}else{return _0x3899bb(null,_0x49e6ae);}},'beforeUpdate':function(_0x2149d3,_0x124933,_0x5d4f44){if(_0x2149d3['changed']('zone')||_0x2149d3[_0x9c9d('0xa')]('serverUrl')||_0x2149d3[_0x9c9d('0xa')]('clientId')||_0x2149d3[_0x9c9d('0xa')](_0x9c9d('0x19'))||_0x2149d3['changed'](_0x9c9d('0xc'))||_0x2149d3[_0x9c9d('0xa')](_0x9c9d('0xd'))){var _0x223222,_0x324bb1;_0x223222=_0x2149d3[_0x9c9d('0xe')];var _0x3d265a=_0x223222['slice'](-0x1);if(_0x3d265a==='/'||_0x3d265a==='\x5c'||_0x3d265a===':'){_0x223222=_0x223222[_0x9c9d('0xf')](0x0,_0x223222['lastIndexOf'](_0x3d265a));}switch(_0x2149d3[_0x9c9d('0xb')]){case'US':_0x324bb1=_0x9c9d('0x11');break;case'AU':_0x324bb1=_0x9c9d('0x12');break;case'IN':_0x324bb1=_0x9c9d('0x13');break;case'CN':_0x324bb1=_0x9c9d('0x25');break;default:_0x324bb1=_0x9c9d('0x14');break;}var _0x194995={'method':_0x9c9d('0x15'),'uri':_0x324bb1+_0x9c9d('0x16'),'form':{'grant_type':_0x9c9d('0x17'),'client_id':_0x2149d3[_0x9c9d('0x18')],'client_secret':_0x2149d3[_0x9c9d('0x19')],'redirect_uri':_0x2149d3[_0x9c9d('0xe')],'code':_0x2149d3['code']},'headers':{'Content-Type':_0x9c9d('0x1a')}};return rp(_0x194995)[_0x9c9d('0x1b')](function(_0x2d2b13){var _0x173ca6=JSON[_0x9c9d('0x1c')](_0x2d2b13);if(_0x173ca6[_0x9c9d('0x1d')]){_0x2149d3[_0x9c9d('0x1e')]=_0x173ca6[_0x9c9d('0x1d')];logger[_0x9c9d('0x1f')](util[_0x9c9d('0x20')](_0x9c9d('0x26'),_0x2149d3[_0x9c9d('0x21')],_0x2149d3['id']));}else{logger[_0x9c9d('0x22')](util[_0x9c9d('0x20')](_0x9c9d('0x27'),_0x2149d3['name'],_0x2149d3['id']),util[_0x9c9d('0x23')](_0x173ca6,{'showHidden':![],'depth':null}));}return _0x5d4f44(null,_0x124933);})['catch'](function(_0x39aac5){logger[_0x9c9d('0x22')](util['format'](_0x9c9d('0x27'),_0x2149d3[_0x9c9d('0x21')],_0x2149d3['id']),util[_0x9c9d('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x5d4f44(_0x39aac5);});}else{return _0x5d4f44(null,_0x124933);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 838abfe..f305524 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 _0x7880=['http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ZohoAccount','findAll','options','raw','where','attributes','limit','map','include','model','GetZohoAccount','find','ShowZohoAccount','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client'];(function(_0x27c2fd,_0x3b665d){var _0x3604ee=function(_0x2cf361){while(--_0x2cf361){_0x27c2fd['push'](_0x27c2fd['shift']());}};_0x3604ee(++_0x3b665d);}(_0x7880,0x10f));var _0x0788=function(_0x3760f1,_0x498373){_0x3760f1=_0x3760f1-0x0;var _0x14d886=_0x7880[_0x3760f1];return _0x14d886;};'use strict';var _=require(_0x0788('0x0'));var util=require('util');var moment=require(_0x0788('0x1'));var BPromise=require(_0x0788('0x2'));var rs=require(_0x0788('0x3'));var fs=require('fs');var Redis=require(_0x0788('0x4'));var db=require(_0x0788('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0788('0x6'));var config=require('../../config/environment');var jayson=require(_0x0788('0x7'));var client=jayson[_0x0788('0x8')][_0x0788('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ece1c,_0x14cfa5,_0x450b71){return new BPromise(function(_0x5366c7,_0x1662a2){return client[_0x0788('0xa')](_0x5ece1c,_0x450b71)[_0x0788('0xb')](function(_0x95ebe3){logger[_0x0788('0xc')](_0x0788('0xd'),_0x14cfa5,_0x0788('0xe'));logger[_0x0788('0xf')](_0x0788('0x10'),_0x14cfa5,_0x0788('0xe'),JSON[_0x0788('0x11')](_0x95ebe3));if(_0x95ebe3['error']){if(_0x95ebe3[_0x0788('0x12')]['code']===0x1f4){logger[_0x0788('0x12')](_0x0788('0xd'),_0x14cfa5,_0x95ebe3[_0x0788('0x12')][_0x0788('0x13')]);return _0x1662a2(_0x95ebe3[_0x0788('0x12')]['message']);}logger[_0x0788('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x14cfa5,_0x95ebe3[_0x0788('0x12')]['message']);return _0x5366c7(_0x95ebe3['error'][_0x0788('0x13')]);}else{logger[_0x0788('0xc')](_0x0788('0xd'),_0x14cfa5,'request\x20sent');_0x5366c7(_0x95ebe3[_0x0788('0x14')][_0x0788('0x13')]);}})['catch'](function(_0x334f58){logger[_0x0788('0x12')](_0x0788('0xd'),_0x14cfa5,_0x334f58);_0x1662a2(_0x334f58);});});}exports['GetZohoAccount']=function(_0x5e9ea6){var _0x1700b5=this;return new Promise(function(_0xf82fbc,_0x5ce32d){return db[_0x0788('0x15')][_0x0788('0x16')]({'raw':_0x5e9ea6[_0x0788('0x17')]?_0x5e9ea6[_0x0788('0x17')][_0x0788('0x18')]===undefined?!![]:![]:!![],'where':_0x5e9ea6[_0x0788('0x17')]?_0x5e9ea6[_0x0788('0x17')][_0x0788('0x19')]||null:null,'attributes':_0x5e9ea6['options']?_0x5e9ea6[_0x0788('0x17')][_0x0788('0x1a')]||null:null,'limit':_0x5e9ea6[_0x0788('0x17')]?_0x5e9ea6[_0x0788('0x17')][_0x0788('0x1b')]||null:null,'include':_0x5e9ea6[_0x0788('0x17')]?_0x5e9ea6[_0x0788('0x17')]['include']?_[_0x0788('0x1c')](_0x5e9ea6[_0x0788('0x17')][_0x0788('0x1d')],function(_0xefb51d){return{'model':db[_0xefb51d['model']],'as':_0xefb51d['as'],'attributes':_0xefb51d['attributes'],'include':_0xefb51d[_0x0788('0x1d')]?_[_0x0788('0x1c')](_0xefb51d['include'],function(_0xac4f64){return{'model':db[_0xac4f64[_0x0788('0x1e')]],'as':_0xac4f64['as'],'attributes':_0xac4f64['attributes'],'include':_0xac4f64[_0x0788('0x1d')]?_[_0x0788('0x1c')](_0xac4f64[_0x0788('0x1d')],function(_0x20da9f){return{'model':db[_0x20da9f['model']],'as':_0x20da9f['as'],'attributes':_0x20da9f[_0x0788('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x497af4){logger[_0x0788('0xc')](_0x0788('0x1f'),_0x5e9ea6);logger[_0x0788('0xf')](_0x0788('0x1f'),_0x5e9ea6,JSON['stringify'](_0x497af4));_0xf82fbc(_0x497af4);})['catch'](function(_0x5b3352){logger[_0x0788('0x12')](_0x0788('0x1f'),_0x5b3352['message'],_0x5e9ea6);_0x5ce32d(_0x1700b5[_0x0788('0x12')](0x1f4,_0x5b3352[_0x0788('0x13')]));});});};exports['ShowZohoAccount']=function(_0x29c442){var _0x5584a5=this;return new Promise(function(_0x7dd5b9,_0x4a08b2){return db[_0x0788('0x15')][_0x0788('0x20')]({'raw':_0x29c442[_0x0788('0x17')]?_0x29c442['options']['raw']===undefined?!![]:![]:!![],'where':_0x29c442[_0x0788('0x17')]?_0x29c442[_0x0788('0x17')][_0x0788('0x19')]||null:null,'attributes':_0x29c442['options']?_0x29c442[_0x0788('0x17')]['attributes']||null:null,'include':_0x29c442[_0x0788('0x17')]?_0x29c442[_0x0788('0x17')][_0x0788('0x1d')]?_[_0x0788('0x1c')](_0x29c442[_0x0788('0x17')][_0x0788('0x1d')],function(_0x4831be){return{'model':db[_0x4831be[_0x0788('0x1e')]],'as':_0x4831be['as'],'attributes':_0x4831be[_0x0788('0x1a')],'include':_0x4831be[_0x0788('0x1d')]?_[_0x0788('0x1c')](_0x4831be[_0x0788('0x1d')],function(_0x296b8d){return{'model':db[_0x296b8d[_0x0788('0x1e')]],'as':_0x296b8d['as'],'attributes':_0x296b8d[_0x0788('0x1a')],'include':_0x296b8d[_0x0788('0x1d')]?_[_0x0788('0x1c')](_0x296b8d[_0x0788('0x1d')],function(_0x5f5a35){return{'model':db[_0x5f5a35[_0x0788('0x1e')]],'as':_0x5f5a35['as'],'attributes':_0x5f5a35[_0x0788('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0788('0xb')](function(_0x17c6c3){logger[_0x0788('0xc')](_0x0788('0x21'),_0x29c442);logger['debug'](_0x0788('0x21'),_0x29c442,JSON['stringify'](_0x17c6c3));_0x7dd5b9(_0x17c6c3);})[_0x0788('0x22')](function(_0x14ccf8){logger[_0x0788('0x12')]('ShowZohoAccount',_0x14ccf8[_0x0788('0x13')],_0x29c442);_0x4a08b2(_0x5584a5[_0x0788('0x12')](0x1f4,_0x14ccf8['message']));});});}; \ No newline at end of file +var _0xb422=['code','message','info','result','catch','GetZohoAccount','ZohoAccount','options','where','limit','map','model','attributes','include','then','find','ShowZohoAccount','bluebird','../../mysqldb','../../config/logger','../../config/environment','client','http','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1fcf34,_0x30a8a9){var _0x475bda=function(_0x4abfdd){while(--_0x4abfdd){_0x1fcf34['push'](_0x1fcf34['shift']());}};_0x475bda(++_0x30a8a9);}(_0xb422,0x85));var _0x2b42=function(_0x6d8c8e,_0x52b57c){_0x6d8c8e=_0x6d8c8e-0x0;var _0x32ad6f=_0xb422[_0x6d8c8e];return _0x32ad6f;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x2b42('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2b42('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x2b42('0x2'))('rpc');var config=require(_0x2b42('0x3'));var jayson=require('jayson/promise');var client=jayson[_0x2b42('0x4')][_0x2b42('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x750c2,_0x51b3bd,_0xde9c67){return new BPromise(function(_0x1b64f7,_0x12b303){return client['request'](_0x750c2,_0xde9c67)['then'](function(_0x4174e8){logger['info'](_0x2b42('0x6'),_0x51b3bd,_0x2b42('0x7'));logger[_0x2b42('0x8')](_0x2b42('0x9'),_0x51b3bd,'request\x20sent',JSON[_0x2b42('0xa')](_0x4174e8));if(_0x4174e8[_0x2b42('0xb')]){if(_0x4174e8['error'][_0x2b42('0xc')]===0x1f4){logger[_0x2b42('0xb')](_0x2b42('0x6'),_0x51b3bd,_0x4174e8[_0x2b42('0xb')]['message']);return _0x12b303(_0x4174e8['error'][_0x2b42('0xd')]);}logger[_0x2b42('0xb')]('ZohoAccount,\x20%s,\x20%s',_0x51b3bd,_0x4174e8[_0x2b42('0xb')][_0x2b42('0xd')]);return _0x1b64f7(_0x4174e8[_0x2b42('0xb')][_0x2b42('0xd')]);}else{logger[_0x2b42('0xe')](_0x2b42('0x6'),_0x51b3bd,_0x2b42('0x7'));_0x1b64f7(_0x4174e8[_0x2b42('0xf')][_0x2b42('0xd')]);}})[_0x2b42('0x10')](function(_0x4897d8){logger[_0x2b42('0xb')](_0x2b42('0x6'),_0x51b3bd,_0x4897d8);_0x12b303(_0x4897d8);});});}exports[_0x2b42('0x11')]=function(_0x3e3426){var _0x27419d=this;return new Promise(function(_0x3ab83c,_0xa28ba4){return db[_0x2b42('0x12')]['findAll']({'raw':_0x3e3426[_0x2b42('0x13')]?_0x3e3426[_0x2b42('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x3e3426[_0x2b42('0x13')]?_0x3e3426['options'][_0x2b42('0x14')]||null:null,'attributes':_0x3e3426[_0x2b42('0x13')]?_0x3e3426[_0x2b42('0x13')]['attributes']||null:null,'limit':_0x3e3426['options']?_0x3e3426[_0x2b42('0x13')][_0x2b42('0x15')]||null:null,'include':_0x3e3426[_0x2b42('0x13')]?_0x3e3426[_0x2b42('0x13')]['include']?_[_0x2b42('0x16')](_0x3e3426[_0x2b42('0x13')]['include'],function(_0x2b9531){return{'model':db[_0x2b9531[_0x2b42('0x17')]],'as':_0x2b9531['as'],'attributes':_0x2b9531[_0x2b42('0x18')],'include':_0x2b9531[_0x2b42('0x19')]?_[_0x2b42('0x16')](_0x2b9531[_0x2b42('0x19')],function(_0x5367f0){return{'model':db[_0x5367f0[_0x2b42('0x17')]],'as':_0x5367f0['as'],'attributes':_0x5367f0[_0x2b42('0x18')],'include':_0x5367f0[_0x2b42('0x19')]?_[_0x2b42('0x16')](_0x5367f0[_0x2b42('0x19')],function(_0x807625){return{'model':db[_0x807625[_0x2b42('0x17')]],'as':_0x807625['as'],'attributes':_0x807625[_0x2b42('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2b42('0x1a')](function(_0xe32cdc){logger[_0x2b42('0xe')]('GetZohoAccount',_0x3e3426);logger['debug'](_0x2b42('0x11'),_0x3e3426,JSON[_0x2b42('0xa')](_0xe32cdc));_0x3ab83c(_0xe32cdc);})[_0x2b42('0x10')](function(_0x352ef7){logger['error'](_0x2b42('0x11'),_0x352ef7[_0x2b42('0xd')],_0x3e3426);_0xa28ba4(_0x27419d[_0x2b42('0xb')](0x1f4,_0x352ef7['message']));});});};exports['ShowZohoAccount']=function(_0x39e32e){var _0x15298d=this;return new Promise(function(_0x41d4ef,_0x17d28a){return db['ZohoAccount'][_0x2b42('0x1b')]({'raw':_0x39e32e[_0x2b42('0x13')]?_0x39e32e[_0x2b42('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x39e32e[_0x2b42('0x13')]?_0x39e32e[_0x2b42('0x13')][_0x2b42('0x14')]||null:null,'attributes':_0x39e32e[_0x2b42('0x13')]?_0x39e32e[_0x2b42('0x13')][_0x2b42('0x18')]||null:null,'include':_0x39e32e[_0x2b42('0x13')]?_0x39e32e[_0x2b42('0x13')][_0x2b42('0x19')]?_[_0x2b42('0x16')](_0x39e32e[_0x2b42('0x13')]['include'],function(_0x2b5d28){return{'model':db[_0x2b5d28['model']],'as':_0x2b5d28['as'],'attributes':_0x2b5d28['attributes'],'include':_0x2b5d28[_0x2b42('0x19')]?_[_0x2b42('0x16')](_0x2b5d28['include'],function(_0x480315){return{'model':db[_0x480315['model']],'as':_0x480315['as'],'attributes':_0x480315[_0x2b42('0x18')],'include':_0x480315[_0x2b42('0x19')]?_[_0x2b42('0x16')](_0x480315['include'],function(_0x45f8d5){return{'model':db[_0x45f8d5[_0x2b42('0x17')]],'as':_0x45f8d5['as'],'attributes':_0x45f8d5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2603f7){logger[_0x2b42('0xe')](_0x2b42('0x1c'),_0x39e32e);logger['debug'](_0x2b42('0x1c'),_0x39e32e,JSON[_0x2b42('0xa')](_0x2603f7));_0x41d4ef(_0x2603f7);})[_0x2b42('0x10')](function(_0x45d4ab){logger[_0x2b42('0xb')]('ShowZohoAccount',_0x45d4ab[_0x2b42('0xd')],_0x39e32e);_0x17d28a(_0x15298d[_0x2b42('0xb')](0x1f4,_0x45d4ab[_0x2b42('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index ab91bd0..000765f 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 _0x631f=['util','path','express','Router','fs-extra','../../components/interaction/service','./intZohoConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','delete','destroy','exports'];(function(_0x5978c1,_0x5d5da8){var _0x31c591=function(_0x8c9e25){while(--_0x8c9e25){_0x5978c1['push'](_0x5978c1['shift']());}};_0x31c591(++_0x5d5da8);}(_0x631f,0x19e));var _0xf631=function(_0x54a9e3,_0x4a3813){_0x54a9e3=_0x54a9e3-0x0;var _0x247cce=_0x631f[_0x54a9e3];return _0x247cce;};'use strict';var multer=require('multer');var util=require(_0xf631('0x0'));var path=require(_0xf631('0x1'));var timeout=require('connect-timeout');var express=require(_0xf631('0x2'));var router=express[_0xf631('0x3')]();var fs_extra=require(_0xf631('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf631('0x5'));var config=require('../../config/environment');var controller=require(_0xf631('0x6'));router[_0xf631('0x7')]('/',auth['isAuthenticated'](),controller[_0xf631('0x8')]);router[_0xf631('0x7')](_0xf631('0x9'),auth[_0xf631('0xa')](),controller['show']);router[_0xf631('0x7')](_0xf631('0xb'),auth['isAuthenticated'](),controller[_0xf631('0xc')]);router[_0xf631('0x7')](_0xf631('0xd'),auth[_0xf631('0xa')](),controller[_0xf631('0xe')]);router[_0xf631('0x7')](_0xf631('0xf'),auth[_0xf631('0xa')](),controller['getDescriptions']);router[_0xf631('0x10')]('/',auth[_0xf631('0xa')](),controller[_0xf631('0x11')]);router[_0xf631('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xf631('0x13')]);router[_0xf631('0x14')](_0xf631('0x9'),auth[_0xf631('0xa')](),controller[_0xf631('0x15')]);module[_0xf631('0x16')]=router; \ No newline at end of file +var _0xd40c=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','put','delete','multer','util'];(function(_0x25996d,_0x5b282e){var _0x12d802=function(_0x34fe7b){while(--_0x34fe7b){_0x25996d['push'](_0x25996d['shift']());}};_0x12d802(++_0x5b282e);}(_0xd40c,0x18a));var _0xcd40=function(_0x3091a6,_0x2b959d){_0x3091a6=_0x3091a6-0x0;var _0x2f0657=_0xd40c[_0x3091a6];return _0x2f0657;};'use strict';var multer=require(_0xcd40('0x0'));var util=require(_0xcd40('0x1'));var path=require(_0xcd40('0x2'));var timeout=require(_0xcd40('0x3'));var express=require(_0xcd40('0x4'));var router=express['Router']();var fs_extra=require(_0xcd40('0x5'));var auth=require(_0xcd40('0x6'));var interaction=require(_0xcd40('0x7'));var config=require(_0xcd40('0x8'));var controller=require(_0xcd40('0x9'));router[_0xcd40('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xcd40('0xa')](_0xcd40('0xb'),auth[_0xcd40('0xc')](),controller[_0xcd40('0xd')]);router[_0xcd40('0xa')](_0xcd40('0xe'),auth[_0xcd40('0xc')](),controller[_0xcd40('0xf')]);router['get'](_0xcd40('0x10'),auth[_0xcd40('0xc')](),controller[_0xcd40('0x11')]);router[_0xcd40('0xa')]('/:id/descriptions',auth[_0xcd40('0xc')](),controller[_0xcd40('0x12')]);router[_0xcd40('0x13')]('/',auth[_0xcd40('0xc')](),controller['create']);router[_0xcd40('0x14')](_0xcd40('0xb'),auth[_0xcd40('0xc')](),controller['update']);router[_0xcd40('0x15')](_0xcd40('0xb'),auth[_0xcd40('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 6d8db7f..91f6fac 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 _0x14c7=['ENUM','contact_lead','sequelize','exports','STRING','lead','contact'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x14c7,0x1d0));var _0x714c=function(_0xb6007a,_0x39a034){_0xb6007a=_0xb6007a-0x0;var _0xfae8f3=_0x14c7[_0xb6007a];return _0xfae8f3;};'use strict';var Sequelize=require(_0x714c('0x0'));module[_0x714c('0x1')]={'name':{'type':Sequelize[_0x714c('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x714c('0x3'),_0x714c('0x4'),'nothing'),'defaultValue':_0x714c('0x3')},'moduleSearch':{'type':Sequelize[_0x714c('0x5')](_0x714c('0x6'),_0x714c('0x4'),_0x714c('0x3')),'defaultValue':'contact_lead'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2d0c=['STRING','lead','contact','nothing','ENUM','contact_lead','exports'];(function(_0x195c21,_0x332612){var _0x3576a8=function(_0xa4bde2){while(--_0xa4bde2){_0x195c21['push'](_0x195c21['shift']());}};_0x3576a8(++_0x332612);}(_0x2d0c,0x1e2));var _0xc2d0=function(_0x2300f2,_0x315c5f){_0x2300f2=_0x2300f2-0x0;var _0x6bd508=_0x2d0c[_0x2300f2];return _0x6bd508;};'use strict';var Sequelize=require('sequelize');module[_0xc2d0('0x0')]={'name':{'type':Sequelize[_0xc2d0('0x1')]},'moduleCreate':{'type':Sequelize['ENUM'](_0xc2d0('0x2'),_0xc2d0('0x3'),_0xc2d0('0x4')),'defaultValue':_0xc2d0('0x2')},'moduleSearch':{'type':Sequelize[_0xc2d0('0x5')]('contact_lead','contact','lead'),'defaultValue':_0xc2d0('0x6')},'description':{'type':Sequelize[_0xc2d0('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index c97fd04..146b3c8 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 _0x054b=['key','model','query','filters','intersection','fields','attributes','length','nolimit','order','where','pick','merge','type','VIRTUAL','filter','options','count','findAll','params','keys','includeAll','include','catch','create','body','find','getFields','ZohoField','hasOwnProperty','getSubjects','findOne','getDescriptions','sort','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','ZohoConfiguration','rawAttributes','fieldName'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x054b,0xc4));var _0xb054=function(_0x5ce2dc,_0x1b9db0){_0x5ce2dc=_0x5ce2dc-0x0;var _0x3009cc=_0x054b[_0x5ce2dc];return _0x3009cc;};'use strict';var emlformat=require(_0xb054('0x0'));var rimraf=require(_0xb054('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb054('0x2'));var rp=require('request-promise');var moment=require(_0xb054('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb054('0x4'));var util=require(_0xb054('0x5'));var path=require(_0xb054('0x6'));var sox=require('sox');var csv=require(_0xb054('0x7'));var ejs=require(_0xb054('0x8'));var fs=require('fs');var fs_extra=require(_0xb054('0x9'));var _=require(_0xb054('0xa'));var squel=require('squel');var crypto=require(_0xb054('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb054('0xc'));var toCsv=require(_0xb054('0x7'));var querystring=require(_0xb054('0xd'));var Papa=require(_0xb054('0xe'));var Redis=require(_0xb054('0xf'));var authService=require(_0xb054('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb054('0x11'));var hardwareService=require(_0xb054('0x12'));var logger=require(_0xb054('0x13'))(_0xb054('0x14'));var utils=require(_0xb054('0x15'));var config=require(_0xb054('0x16'));var licenseUtil=require(_0xb054('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ddc70,_0x4d8e68){_0x4d8e68=_0x4d8e68||0xcc;return function(_0x632b43){if(_0x632b43){return _0x1ddc70[_0xb054('0x18')](_0x4d8e68);}return _0x1ddc70[_0xb054('0x19')](_0x4d8e68)[_0xb054('0x1a')]();};}function respondWithResult(_0x3d2b93,_0x4c2480){_0x4c2480=_0x4c2480||0xc8;return function(_0x5241e4){if(_0x5241e4){return _0x3d2b93[_0xb054('0x19')](_0x4c2480)[_0xb054('0x1b')](_0x5241e4);}};}function respondWithFilteredResult(_0x4c4b2e,_0x3ee449){return function(_0x11b720){if(_0x11b720){var _0x25156d=typeof _0x3ee449[_0xb054('0x1c')]===_0xb054('0x1d')&&typeof _0x3ee449[_0xb054('0x1e')]===_0xb054('0x1d');var _0xc5ad57=_0x11b720['count'];var _0x3f001f=_0x25156d?0x0:_0x3ee449['offset'];var _0x2d0462=_0x25156d?_0x11b720['count']:_0x3ee449[_0xb054('0x1c')]+_0x3ee449['limit'];var _0x74f931;if(_0x2d0462>=_0xc5ad57){_0x2d0462=_0xc5ad57;_0x74f931=0xc8;}else{_0x74f931=0xce;}_0x4c4b2e[_0xb054('0x19')](_0x74f931);return _0x4c4b2e[_0xb054('0x1f')](_0xb054('0x20'),_0x3f001f+'-'+_0x2d0462+'/'+_0xc5ad57)['json'](_0x11b720);}return null;};}function patchUpdates(_0x335754){return function(_0x271b32){try{jsonpatch[_0xb054('0x21')](_0x271b32,_0x335754,!![]);}catch(_0x528c04){return BPromise[_0xb054('0x22')](_0x528c04);}return _0x271b32[_0xb054('0x23')]();};}function saveUpdates(_0x550a80,_0x5c491a){return function(_0x66acb2){if(_0x66acb2){return _0x66acb2[_0xb054('0x24')](_0x550a80)[_0xb054('0x25')](function(_0x4a590f){return _0x4a590f;});}return null;};}function removeEntity(_0x16f4e1,_0x2e8494){return function(_0xd00332){if(_0xd00332){return _0xd00332[_0xb054('0x26')]()['then'](function(){_0x16f4e1[_0xb054('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x183a24,_0x546cdd){return function(_0x22c5d5){if(!_0x22c5d5){_0x183a24['sendStatus'](0x194);}return _0x22c5d5;};}function handleError(_0x4fb32b,_0x53ff3b){_0x53ff3b=_0x53ff3b||0x1f4;return function(_0x42ca9d){logger[_0xb054('0x27')](_0x42ca9d[_0xb054('0x28')]);if(_0x42ca9d[_0xb054('0x29')]){delete _0x42ca9d[_0xb054('0x29')];}_0x4fb32b[_0xb054('0x19')](_0x53ff3b)['send'](_0x42ca9d);};}exports[_0xb054('0x2a')]=function(_0x25c70e,_0x118392){var _0xa8a0b6={},_0x3b292e={},_0x55cdf7={'count':0x0,'rows':[]};var _0x1b12a6=_[_0xb054('0x2b')](db[_0xb054('0x2c')][_0xb054('0x2d')],function(_0x321582){return{'name':_0x321582[_0xb054('0x2e')],'type':_0x321582['type'][_0xb054('0x2f')]};});_0x3b292e[_0xb054('0x30')]=_[_0xb054('0x2b')](_0x1b12a6,_0xb054('0x29'));_0x3b292e[_0xb054('0x31')]=_['keys'](_0x25c70e['query']);_0x3b292e[_0xb054('0x32')]=_[_0xb054('0x33')](_0x3b292e['model'],_0x3b292e[_0xb054('0x31')]);_0xa8a0b6['attributes']=_[_0xb054('0x33')](_0x3b292e[_0xb054('0x30')],qs['fields'](_0x25c70e[_0xb054('0x31')][_0xb054('0x34')]));_0xa8a0b6[_0xb054('0x35')]=_0xa8a0b6['attributes'][_0xb054('0x36')]?_0xa8a0b6[_0xb054('0x35')]:_0x3b292e[_0xb054('0x30')];if(!_0x25c70e[_0xb054('0x31')]['hasOwnProperty'](_0xb054('0x37'))){_0xa8a0b6['limit']=qs[_0xb054('0x1e')](_0x25c70e[_0xb054('0x31')][_0xb054('0x1e')]);_0xa8a0b6[_0xb054('0x1c')]=qs[_0xb054('0x1c')](_0x25c70e['query'][_0xb054('0x1c')]);}_0xa8a0b6[_0xb054('0x38')]=qs['sort'](_0x25c70e[_0xb054('0x31')]['sort']);_0xa8a0b6[_0xb054('0x39')]=qs[_0xb054('0x32')](_[_0xb054('0x3a')](_0x25c70e['query'],_0x3b292e[_0xb054('0x32')]),_0x1b12a6);if(_0x25c70e[_0xb054('0x31')]['filter']){_0xa8a0b6[_0xb054('0x39')]=_[_0xb054('0x3b')](_0xa8a0b6[_0xb054('0x39')],{'$or':_[_0xb054('0x2b')](_0x1b12a6,function(_0x4c082d){if(_0x4c082d[_0xb054('0x3c')]!==_0xb054('0x3d')){var _0x3cda3a={};_0x3cda3a[_0x4c082d['name']]={'$like':'%'+_0x25c70e[_0xb054('0x31')][_0xb054('0x3e')]+'%'};return _0x3cda3a;}})});}_0xa8a0b6=_[_0xb054('0x3b')]({},_0xa8a0b6,_0x25c70e[_0xb054('0x3f')]);var _0x184e22={'where':_0xa8a0b6[_0xb054('0x39')]};return db[_0xb054('0x2c')][_0xb054('0x40')](_0x184e22)[_0xb054('0x25')](function(_0x3df696){_0x55cdf7[_0xb054('0x40')]=_0x3df696;if(_0x25c70e['query']['includeAll']){_0xa8a0b6['include']=[{'all':!![]}];}return db[_0xb054('0x2c')][_0xb054('0x41')](_0xa8a0b6);})[_0xb054('0x25')](function(_0x524bf8){_0x55cdf7['rows']=_0x524bf8;return _0x55cdf7;})[_0xb054('0x25')](respondWithFilteredResult(_0x118392,_0xa8a0b6))['catch'](handleError(_0x118392,null));};exports['show']=function(_0x46d868,_0x5f3a9c){var _0x379874={'raw':![],'where':{'id':_0x46d868[_0xb054('0x42')]['id']}},_0x591277={};_0x591277[_0xb054('0x30')]=_['keys'](db[_0xb054('0x2c')]['rawAttributes']);_0x591277[_0xb054('0x31')]=_[_0xb054('0x43')](_0x46d868[_0xb054('0x31')]);_0x591277[_0xb054('0x32')]=_[_0xb054('0x33')](_0x591277[_0xb054('0x30')],_0x591277[_0xb054('0x31')]);_0x379874[_0xb054('0x35')]=_[_0xb054('0x33')](_0x591277[_0xb054('0x30')],qs['fields'](_0x46d868[_0xb054('0x31')][_0xb054('0x34')]));_0x379874[_0xb054('0x35')]=_0x379874[_0xb054('0x35')][_0xb054('0x36')]?_0x379874[_0xb054('0x35')]:_0x591277['model'];if(_0x46d868[_0xb054('0x31')][_0xb054('0x44')]){_0x379874[_0xb054('0x45')]=[{'all':!![]}];}_0x379874=_[_0xb054('0x3b')]({},_0x379874,_0x46d868[_0xb054('0x3f')]);return db[_0xb054('0x2c')]['find'](_0x379874)['then'](handleEntityNotFound(_0x5f3a9c,null))[_0xb054('0x25')](respondWithResult(_0x5f3a9c,null))[_0xb054('0x46')](handleError(_0x5f3a9c,null));};exports[_0xb054('0x47')]=function(_0x4bfc40,_0x3df466){return db[_0xb054('0x2c')][_0xb054('0x47')](_0x4bfc40['body'],{})[_0xb054('0x25')](respondWithResult(_0x3df466,0xc9))[_0xb054('0x46')](handleError(_0x3df466,null));};exports[_0xb054('0x24')]=function(_0x1e0441,_0x5b4bc9){if(_0x1e0441[_0xb054('0x48')]['id']){delete _0x1e0441[_0xb054('0x48')]['id'];}return db[_0xb054('0x2c')][_0xb054('0x49')]({'where':{'id':_0x1e0441['params']['id']}})['then'](handleEntityNotFound(_0x5b4bc9,null))['then'](saveUpdates(_0x1e0441[_0xb054('0x48')],null))[_0xb054('0x25')](respondWithResult(_0x5b4bc9,null))[_0xb054('0x46')](handleError(_0x5b4bc9,null));};exports['destroy']=function(_0x2a9e87,_0x3fd28c){return db[_0xb054('0x2c')][_0xb054('0x49')]({'where':{'id':_0x2a9e87[_0xb054('0x42')]['id']}})[_0xb054('0x25')](handleEntityNotFound(_0x3fd28c,null))[_0xb054('0x25')](removeEntity(_0x3fd28c,null))[_0xb054('0x46')](handleError(_0x3fd28c,null));};exports[_0xb054('0x4a')]=function(_0x8f203c,_0x3be119,_0x1cbc5f){var _0x258e8d={};var _0x2d2ee6={};var _0x269f4b;var _0x789ec5;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x8f203c['params']['id']}})[_0xb054('0x25')](handleEntityNotFound(_0x3be119,null))[_0xb054('0x25')](function(_0x8a5d6a){if(_0x8a5d6a){_0x269f4b=_0x8a5d6a;_0x2d2ee6[_0xb054('0x30')]=_[_0xb054('0x43')](db[_0xb054('0x4b')][_0xb054('0x2d')]);_0x2d2ee6[_0xb054('0x31')]=_[_0xb054('0x43')](_0x8f203c[_0xb054('0x31')]);_0x2d2ee6['filters']=_['intersection'](_0x2d2ee6[_0xb054('0x30')],_0x2d2ee6['query']);_0x258e8d[_0xb054('0x35')]=_['intersection'](_0x2d2ee6[_0xb054('0x30')],qs['fields'](_0x8f203c['query']['fields']));_0x258e8d[_0xb054('0x35')]=_0x258e8d[_0xb054('0x35')][_0xb054('0x36')]?_0x258e8d[_0xb054('0x35')]:_0x2d2ee6[_0xb054('0x30')];_0x258e8d[_0xb054('0x38')]=qs['sort'](_0x8f203c[_0xb054('0x31')]['sort']);_0x258e8d[_0xb054('0x39')]=qs[_0xb054('0x32')](_[_0xb054('0x3a')](_0x8f203c[_0xb054('0x31')],_0x2d2ee6[_0xb054('0x32')]));if(_0x8f203c[_0xb054('0x31')][_0xb054('0x3e')]){_0x258e8d[_0xb054('0x39')]=_[_0xb054('0x3b')](_0x258e8d['where'],{'$or':_[_0xb054('0x2b')](_0x258e8d[_0xb054('0x35')],function(_0x8d7063){var _0x228b02={};_0x228b02[_0x8d7063]={'$like':'%'+_0x8f203c[_0xb054('0x31')][_0xb054('0x3e')]+'%'};return _0x228b02;})});}_0x258e8d=_[_0xb054('0x3b')]({},_0x258e8d,_0x8f203c[_0xb054('0x3f')]);return _0x269f4b['getFields'](_0x258e8d);}})['then'](function(_0x460f1b){if(_0x460f1b){_0x789ec5=_0x460f1b['length'];if(!_0x8f203c[_0xb054('0x31')][_0xb054('0x4c')](_0xb054('0x37'))){_0x258e8d['limit']=qs[_0xb054('0x1e')](_0x8f203c[_0xb054('0x31')]['limit']);_0x258e8d[_0xb054('0x1c')]=qs[_0xb054('0x1c')](_0x8f203c[_0xb054('0x31')][_0xb054('0x1c')]);}return _0x269f4b['getFields'](_0x258e8d);}})[_0xb054('0x25')](function(_0x10a103){if(_0x10a103){return _0x10a103?{'count':_0x789ec5,'rows':_0x10a103}:null;}})[_0xb054('0x25')](respondWithResult(_0x3be119,null))['catch'](handleError(_0x3be119,null));};exports[_0xb054('0x4d')]=function(_0x182e60,_0x113fb5,_0x279bea){var _0x21d011={};var _0xf1c31f={};var _0x25109d;var _0x592885;return db['ZohoConfiguration'][_0xb054('0x4e')]({'where':{'id':_0x182e60['params']['id']}})[_0xb054('0x25')](handleEntityNotFound(_0x113fb5,null))['then'](function(_0x202e1b){if(_0x202e1b){_0x25109d=_0x202e1b;_0xf1c31f[_0xb054('0x30')]=_[_0xb054('0x43')](db[_0xb054('0x4b')][_0xb054('0x2d')]);_0xf1c31f[_0xb054('0x31')]=_[_0xb054('0x43')](_0x182e60[_0xb054('0x31')]);_0xf1c31f[_0xb054('0x32')]=_['intersection'](_0xf1c31f[_0xb054('0x30')],_0xf1c31f['query']);_0x21d011[_0xb054('0x35')]=_[_0xb054('0x33')](_0xf1c31f[_0xb054('0x30')],qs[_0xb054('0x34')](_0x182e60[_0xb054('0x31')]['fields']));_0x21d011['attributes']=_0x21d011[_0xb054('0x35')][_0xb054('0x36')]?_0x21d011[_0xb054('0x35')]:_0xf1c31f[_0xb054('0x30')];_0x21d011[_0xb054('0x38')]=qs['sort'](_0x182e60[_0xb054('0x31')]['sort']);_0x21d011[_0xb054('0x39')]=qs[_0xb054('0x32')](_['pick'](_0x182e60[_0xb054('0x31')],_0xf1c31f[_0xb054('0x32')]));if(_0x182e60['query'][_0xb054('0x3e')]){_0x21d011[_0xb054('0x39')]=_['merge'](_0x21d011['where'],{'$or':_[_0xb054('0x2b')](_0x21d011[_0xb054('0x35')],function(_0xdc5f15){var _0x54ab1b={};_0x54ab1b[_0xdc5f15]={'$like':'%'+_0x182e60['query'][_0xb054('0x3e')]+'%'};return _0x54ab1b;})});}_0x21d011=_[_0xb054('0x3b')]({},_0x21d011,_0x182e60[_0xb054('0x3f')]);return _0x25109d[_0xb054('0x4d')](_0x21d011);}})[_0xb054('0x25')](function(_0x44d0ab){if(_0x44d0ab){_0x592885=_0x44d0ab['length'];if(!_0x182e60[_0xb054('0x31')][_0xb054('0x4c')](_0xb054('0x37'))){_0x21d011['limit']=qs[_0xb054('0x1e')](_0x182e60['query']['limit']);_0x21d011[_0xb054('0x1c')]=qs[_0xb054('0x1c')](_0x182e60['query'][_0xb054('0x1c')]);}return _0x25109d['getSubjects'](_0x21d011);}})[_0xb054('0x25')](function(_0x4a6357){if(_0x4a6357){return _0x4a6357?{'count':_0x592885,'rows':_0x4a6357}:null;}})[_0xb054('0x25')](respondWithResult(_0x113fb5,null))[_0xb054('0x46')](handleError(_0x113fb5,null));};exports[_0xb054('0x4f')]=function(_0x34ce9e,_0x74e264,_0x3663ab){var _0x53cc8c={};var _0x2bffe9={};var _0x5aa8d6;var _0x254ffc;return db[_0xb054('0x2c')][_0xb054('0x4e')]({'where':{'id':_0x34ce9e[_0xb054('0x42')]['id']}})[_0xb054('0x25')](handleEntityNotFound(_0x74e264,null))['then'](function(_0x57523a){if(_0x57523a){_0x5aa8d6=_0x57523a;_0x2bffe9[_0xb054('0x30')]=_['keys'](db[_0xb054('0x4b')]['rawAttributes']);_0x2bffe9['query']=_[_0xb054('0x43')](_0x34ce9e[_0xb054('0x31')]);_0x2bffe9['filters']=_[_0xb054('0x33')](_0x2bffe9[_0xb054('0x30')],_0x2bffe9['query']);_0x53cc8c[_0xb054('0x35')]=_[_0xb054('0x33')](_0x2bffe9[_0xb054('0x30')],qs[_0xb054('0x34')](_0x34ce9e[_0xb054('0x31')]['fields']));_0x53cc8c[_0xb054('0x35')]=_0x53cc8c[_0xb054('0x35')]['length']?_0x53cc8c[_0xb054('0x35')]:_0x2bffe9[_0xb054('0x30')];_0x53cc8c['order']=qs[_0xb054('0x50')](_0x34ce9e[_0xb054('0x31')][_0xb054('0x50')]);_0x53cc8c[_0xb054('0x39')]=qs['filters'](_[_0xb054('0x3a')](_0x34ce9e[_0xb054('0x31')],_0x2bffe9[_0xb054('0x32')]));if(_0x34ce9e[_0xb054('0x31')]['filter']){_0x53cc8c['where']=_[_0xb054('0x3b')](_0x53cc8c[_0xb054('0x39')],{'$or':_[_0xb054('0x2b')](_0x53cc8c[_0xb054('0x35')],function(_0x2c6d5d){var _0x53feac={};_0x53feac[_0x2c6d5d]={'$like':'%'+_0x34ce9e[_0xb054('0x31')][_0xb054('0x3e')]+'%'};return _0x53feac;})});}_0x53cc8c=_[_0xb054('0x3b')]({},_0x53cc8c,_0x34ce9e['options']);return _0x5aa8d6[_0xb054('0x4f')](_0x53cc8c);}})[_0xb054('0x25')](function(_0x27a0ab){if(_0x27a0ab){_0x254ffc=_0x27a0ab[_0xb054('0x36')];if(!_0x34ce9e[_0xb054('0x31')]['hasOwnProperty'](_0xb054('0x37'))){_0x53cc8c[_0xb054('0x1e')]=qs[_0xb054('0x1e')](_0x34ce9e[_0xb054('0x31')][_0xb054('0x1e')]);_0x53cc8c[_0xb054('0x1c')]=qs['offset'](_0x34ce9e[_0xb054('0x31')][_0xb054('0x1c')]);}return _0x5aa8d6[_0xb054('0x4f')](_0x53cc8c);}})[_0xb054('0x25')](function(_0xebffcf){if(_0xebffcf){return _0xebffcf?{'count':_0x254ffc,'rows':_0xebffcf}:null;}})['then'](respondWithResult(_0x74e264,null))[_0xb054('0x46')](handleError(_0x74e264,null));}; \ No newline at end of file +var _0x3783=['ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','name','send','index','rawAttributes','fieldName','type','query','keys','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','map','VIRTUAL','filter','options','ZohoConfiguration','includeAll','include','findAll','rows','length','catch','create','body','find','params','getFields','findOne','getSubjects','ZohoField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring'];(function(_0xdf160b,_0x59e73a){var _0x1ac51e=function(_0xb1d1a7){while(--_0xb1d1a7){_0xdf160b['push'](_0xdf160b['shift']());}};_0x1ac51e(++_0x59e73a);}(_0x3783,0x12f));var _0x3378=function(_0x205d5c,_0x2d8685){_0x205d5c=_0x205d5c-0x0;var _0x5d8f76=_0x3783[_0x205d5c];return _0x5d8f76;};'use strict';var emlformat=require(_0x3378('0x0'));var rimraf=require(_0x3378('0x1'));var zipdir=require(_0x3378('0x2'));var jsonpatch=require(_0x3378('0x3'));var rp=require('request-promise');var moment=require(_0x3378('0x4'));var BPromise=require(_0x3378('0x5'));var Mustache=require(_0x3378('0x6'));var util=require(_0x3378('0x7'));var path=require('path');var sox=require(_0x3378('0x8'));var csv=require(_0x3378('0x9'));var ejs=require(_0x3378('0xa'));var fs=require('fs');var fs_extra=require(_0x3378('0xb'));var _=require(_0x3378('0xc'));var squel=require(_0x3378('0xd'));var crypto=require('crypto');var jsforce=require(_0x3378('0xe'));var deskjs=require(_0x3378('0xf'));var toCsv=require(_0x3378('0x9'));var querystring=require(_0x3378('0x10'));var Papa=require('papaparse');var Redis=require(_0x3378('0x11'));var authService=require(_0x3378('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3378('0x13'));var logger=require(_0x3378('0x14'))(_0x3378('0x15'));var utils=require(_0x3378('0x16'));var config=require(_0x3378('0x17'));var licenseUtil=require(_0x3378('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x182ff7,_0x2f8ed2){_0x2f8ed2=_0x2f8ed2||0xcc;return function(_0x5d7b8a){if(_0x5d7b8a){return _0x182ff7[_0x3378('0x19')](_0x2f8ed2);}return _0x182ff7[_0x3378('0x1a')](_0x2f8ed2)[_0x3378('0x1b')]();};}function respondWithResult(_0x9e6aa2,_0x3ca9ef){_0x3ca9ef=_0x3ca9ef||0xc8;return function(_0x455b0e){if(_0x455b0e){return _0x9e6aa2[_0x3378('0x1a')](_0x3ca9ef)['json'](_0x455b0e);}};}function respondWithFilteredResult(_0x54fc01,_0x46ca5a){return function(_0x2906a6){if(_0x2906a6){var _0x3d0549=typeof _0x46ca5a[_0x3378('0x1c')]==='undefined'&&typeof _0x46ca5a[_0x3378('0x1d')]===_0x3378('0x1e');var _0x450002=_0x2906a6['count'];var _0x5c15a1=_0x3d0549?0x0:_0x46ca5a[_0x3378('0x1c')];var _0x556ce0=_0x3d0549?_0x2906a6[_0x3378('0x1f')]:_0x46ca5a['offset']+_0x46ca5a[_0x3378('0x1d')];var _0x61355f;if(_0x556ce0>=_0x450002){_0x556ce0=_0x450002;_0x61355f=0xc8;}else{_0x61355f=0xce;}_0x54fc01['status'](_0x61355f);return _0x54fc01[_0x3378('0x20')](_0x3378('0x21'),_0x5c15a1+'-'+_0x556ce0+'/'+_0x450002)[_0x3378('0x22')](_0x2906a6);}return null;};}function patchUpdates(_0xa5beb5){return function(_0x30bfeb){try{jsonpatch[_0x3378('0x23')](_0x30bfeb,_0xa5beb5,!![]);}catch(_0x3bc13d){return BPromise[_0x3378('0x24')](_0x3bc13d);}return _0x30bfeb['save']();};}function saveUpdates(_0xc6b88f,_0x2101d3){return function(_0x3c4bcc){if(_0x3c4bcc){return _0x3c4bcc[_0x3378('0x25')](_0xc6b88f)[_0x3378('0x26')](function(_0x45dce8){return _0x45dce8;});}return null;};}function removeEntity(_0x192b5a,_0x3e2533){return function(_0x3f1680){if(_0x3f1680){return _0x3f1680[_0x3378('0x27')]()[_0x3378('0x26')](function(){_0x192b5a['status'](0xcc)[_0x3378('0x1b')]();});}};}function handleEntityNotFound(_0x1cdac6,_0x45863d){return function(_0x12a24b){if(!_0x12a24b){_0x1cdac6[_0x3378('0x19')](0x194);}return _0x12a24b;};}function handleError(_0x3e1181,_0x92e585){_0x92e585=_0x92e585||0x1f4;return function(_0x1bf668){logger['error'](_0x1bf668['stack']);if(_0x1bf668[_0x3378('0x28')]){delete _0x1bf668[_0x3378('0x28')];}_0x3e1181['status'](_0x92e585)[_0x3378('0x29')](_0x1bf668);};}exports[_0x3378('0x2a')]=function(_0x116e00,_0x2d4f0b){var _0x65bbbf={},_0x42b777={},_0x48c1b7={'count':0x0,'rows':[]};var _0x3fbab6=_['map'](db['ZohoConfiguration'][_0x3378('0x2b')],function(_0x5c8198){return{'name':_0x5c8198[_0x3378('0x2c')],'type':_0x5c8198[_0x3378('0x2d')]['key']};});_0x42b777['model']=_['map'](_0x3fbab6,_0x3378('0x28'));_0x42b777[_0x3378('0x2e')]=_[_0x3378('0x2f')](_0x116e00[_0x3378('0x2e')]);_0x42b777['filters']=_[_0x3378('0x30')](_0x42b777['model'],_0x42b777['query']);_0x65bbbf[_0x3378('0x31')]=_[_0x3378('0x30')](_0x42b777[_0x3378('0x32')],qs['fields'](_0x116e00[_0x3378('0x2e')][_0x3378('0x33')]));_0x65bbbf['attributes']=_0x65bbbf[_0x3378('0x31')]['length']?_0x65bbbf[_0x3378('0x31')]:_0x42b777[_0x3378('0x32')];if(!_0x116e00[_0x3378('0x2e')][_0x3378('0x34')](_0x3378('0x35'))){_0x65bbbf[_0x3378('0x1d')]=qs['limit'](_0x116e00['query'][_0x3378('0x1d')]);_0x65bbbf[_0x3378('0x1c')]=qs[_0x3378('0x1c')](_0x116e00[_0x3378('0x2e')]['offset']);}_0x65bbbf[_0x3378('0x36')]=qs['sort'](_0x116e00[_0x3378('0x2e')][_0x3378('0x37')]);_0x65bbbf[_0x3378('0x38')]=qs[_0x3378('0x39')](_[_0x3378('0x3a')](_0x116e00['query'],_0x42b777[_0x3378('0x39')]),_0x3fbab6);if(_0x116e00[_0x3378('0x2e')]['filter']){_0x65bbbf[_0x3378('0x38')]=_[_0x3378('0x3b')](_0x65bbbf[_0x3378('0x38')],{'$or':_[_0x3378('0x3c')](_0x3fbab6,function(_0x31858d){if(_0x31858d[_0x3378('0x2d')]!==_0x3378('0x3d')){var _0x2d939b={};_0x2d939b[_0x31858d['name']]={'$like':'%'+_0x116e00[_0x3378('0x2e')][_0x3378('0x3e')]+'%'};return _0x2d939b;}})});}_0x65bbbf=_[_0x3378('0x3b')]({},_0x65bbbf,_0x116e00[_0x3378('0x3f')]);var _0x457c47={'where':_0x65bbbf[_0x3378('0x38')]};return db[_0x3378('0x40')]['count'](_0x457c47)[_0x3378('0x26')](function(_0x23770a){_0x48c1b7[_0x3378('0x1f')]=_0x23770a;if(_0x116e00[_0x3378('0x2e')][_0x3378('0x41')]){_0x65bbbf[_0x3378('0x42')]=[{'all':!![]}];}return db[_0x3378('0x40')][_0x3378('0x43')](_0x65bbbf);})[_0x3378('0x26')](function(_0x5e4c67){_0x48c1b7[_0x3378('0x44')]=_0x5e4c67;return _0x48c1b7;})[_0x3378('0x26')](respondWithFilteredResult(_0x2d4f0b,_0x65bbbf))['catch'](handleError(_0x2d4f0b,null));};exports['show']=function(_0x3c6531,_0x37d52d){var _0x4f6a3b={'raw':![],'where':{'id':_0x3c6531['params']['id']}},_0x4a1146={};_0x4a1146[_0x3378('0x32')]=_[_0x3378('0x2f')](db[_0x3378('0x40')][_0x3378('0x2b')]);_0x4a1146[_0x3378('0x2e')]=_[_0x3378('0x2f')](_0x3c6531['query']);_0x4a1146[_0x3378('0x39')]=_[_0x3378('0x30')](_0x4a1146[_0x3378('0x32')],_0x4a1146[_0x3378('0x2e')]);_0x4f6a3b[_0x3378('0x31')]=_[_0x3378('0x30')](_0x4a1146[_0x3378('0x32')],qs['fields'](_0x3c6531['query'][_0x3378('0x33')]));_0x4f6a3b[_0x3378('0x31')]=_0x4f6a3b[_0x3378('0x31')][_0x3378('0x45')]?_0x4f6a3b['attributes']:_0x4a1146[_0x3378('0x32')];if(_0x3c6531[_0x3378('0x2e')]['includeAll']){_0x4f6a3b[_0x3378('0x42')]=[{'all':!![]}];}_0x4f6a3b=_[_0x3378('0x3b')]({},_0x4f6a3b,_0x3c6531[_0x3378('0x3f')]);return db[_0x3378('0x40')]['find'](_0x4f6a3b)[_0x3378('0x26')](handleEntityNotFound(_0x37d52d,null))[_0x3378('0x26')](respondWithResult(_0x37d52d,null))[_0x3378('0x46')](handleError(_0x37d52d,null));};exports[_0x3378('0x47')]=function(_0x5615d9,_0x32fbe3){return db[_0x3378('0x40')][_0x3378('0x47')](_0x5615d9['body'],{})[_0x3378('0x26')](respondWithResult(_0x32fbe3,0xc9))[_0x3378('0x46')](handleError(_0x32fbe3,null));};exports[_0x3378('0x25')]=function(_0x3bf4cd,_0x6f2a76){if(_0x3bf4cd[_0x3378('0x48')]['id']){delete _0x3bf4cd['body']['id'];}return db[_0x3378('0x40')][_0x3378('0x49')]({'where':{'id':_0x3bf4cd[_0x3378('0x4a')]['id']}})['then'](handleEntityNotFound(_0x6f2a76,null))[_0x3378('0x26')](saveUpdates(_0x3bf4cd[_0x3378('0x48')],null))[_0x3378('0x26')](respondWithResult(_0x6f2a76,null))[_0x3378('0x46')](handleError(_0x6f2a76,null));};exports[_0x3378('0x27')]=function(_0x539eb6,_0x1523fb){return db[_0x3378('0x40')]['find']({'where':{'id':_0x539eb6[_0x3378('0x4a')]['id']}})[_0x3378('0x26')](handleEntityNotFound(_0x1523fb,null))[_0x3378('0x26')](removeEntity(_0x1523fb,null))[_0x3378('0x46')](handleError(_0x1523fb,null));};exports[_0x3378('0x4b')]=function(_0x5681df,_0x5e2ace,_0x15bc34){var _0x2ba9a8={};var _0x481e71={};var _0x382230;var _0x5f0d8c;return db[_0x3378('0x40')][_0x3378('0x4c')]({'where':{'id':_0x5681df['params']['id']}})['then'](handleEntityNotFound(_0x5e2ace,null))[_0x3378('0x26')](function(_0x3a1d19){if(_0x3a1d19){_0x382230=_0x3a1d19;_0x481e71[_0x3378('0x32')]=_[_0x3378('0x2f')](db['ZohoField'][_0x3378('0x2b')]);_0x481e71[_0x3378('0x2e')]=_['keys'](_0x5681df[_0x3378('0x2e')]);_0x481e71[_0x3378('0x39')]=_['intersection'](_0x481e71[_0x3378('0x32')],_0x481e71[_0x3378('0x2e')]);_0x2ba9a8[_0x3378('0x31')]=_[_0x3378('0x30')](_0x481e71[_0x3378('0x32')],qs[_0x3378('0x33')](_0x5681df[_0x3378('0x2e')]['fields']));_0x2ba9a8['attributes']=_0x2ba9a8[_0x3378('0x31')][_0x3378('0x45')]?_0x2ba9a8[_0x3378('0x31')]:_0x481e71[_0x3378('0x32')];_0x2ba9a8[_0x3378('0x36')]=qs[_0x3378('0x37')](_0x5681df[_0x3378('0x2e')]['sort']);_0x2ba9a8['where']=qs[_0x3378('0x39')](_[_0x3378('0x3a')](_0x5681df['query'],_0x481e71[_0x3378('0x39')]));if(_0x5681df[_0x3378('0x2e')]['filter']){_0x2ba9a8['where']=_['merge'](_0x2ba9a8[_0x3378('0x38')],{'$or':_[_0x3378('0x3c')](_0x2ba9a8[_0x3378('0x31')],function(_0x117053){var _0x34bc20={};_0x34bc20[_0x117053]={'$like':'%'+_0x5681df['query']['filter']+'%'};return _0x34bc20;})});}_0x2ba9a8=_[_0x3378('0x3b')]({},_0x2ba9a8,_0x5681df[_0x3378('0x3f')]);return _0x382230[_0x3378('0x4b')](_0x2ba9a8);}})[_0x3378('0x26')](function(_0xa250ba){if(_0xa250ba){_0x5f0d8c=_0xa250ba[_0x3378('0x45')];if(!_0x5681df[_0x3378('0x2e')][_0x3378('0x34')](_0x3378('0x35'))){_0x2ba9a8[_0x3378('0x1d')]=qs[_0x3378('0x1d')](_0x5681df[_0x3378('0x2e')][_0x3378('0x1d')]);_0x2ba9a8[_0x3378('0x1c')]=qs[_0x3378('0x1c')](_0x5681df[_0x3378('0x2e')][_0x3378('0x1c')]);}return _0x382230[_0x3378('0x4b')](_0x2ba9a8);}})['then'](function(_0x2f706b){if(_0x2f706b){return _0x2f706b?{'count':_0x5f0d8c,'rows':_0x2f706b}:null;}})[_0x3378('0x26')](respondWithResult(_0x5e2ace,null))[_0x3378('0x46')](handleError(_0x5e2ace,null));};exports[_0x3378('0x4d')]=function(_0x18a558,_0x1ef934,_0x7133f0){var _0x53cff1={};var _0x424dfb={};var _0x475549;var _0x458f1a;return db[_0x3378('0x40')][_0x3378('0x4c')]({'where':{'id':_0x18a558['params']['id']}})[_0x3378('0x26')](handleEntityNotFound(_0x1ef934,null))[_0x3378('0x26')](function(_0x3992db){if(_0x3992db){_0x475549=_0x3992db;_0x424dfb[_0x3378('0x32')]=_[_0x3378('0x2f')](db[_0x3378('0x4e')]['rawAttributes']);_0x424dfb['query']=_[_0x3378('0x2f')](_0x18a558['query']);_0x424dfb[_0x3378('0x39')]=_['intersection'](_0x424dfb[_0x3378('0x32')],_0x424dfb[_0x3378('0x2e')]);_0x53cff1[_0x3378('0x31')]=_['intersection'](_0x424dfb[_0x3378('0x32')],qs[_0x3378('0x33')](_0x18a558[_0x3378('0x2e')][_0x3378('0x33')]));_0x53cff1[_0x3378('0x31')]=_0x53cff1[_0x3378('0x31')][_0x3378('0x45')]?_0x53cff1[_0x3378('0x31')]:_0x424dfb[_0x3378('0x32')];_0x53cff1[_0x3378('0x36')]=qs[_0x3378('0x37')](_0x18a558['query']['sort']);_0x53cff1['where']=qs[_0x3378('0x39')](_[_0x3378('0x3a')](_0x18a558['query'],_0x424dfb[_0x3378('0x39')]));if(_0x18a558[_0x3378('0x2e')][_0x3378('0x3e')]){_0x53cff1[_0x3378('0x38')]=_[_0x3378('0x3b')](_0x53cff1[_0x3378('0x38')],{'$or':_[_0x3378('0x3c')](_0x53cff1[_0x3378('0x31')],function(_0x462765){var _0x438a64={};_0x438a64[_0x462765]={'$like':'%'+_0x18a558[_0x3378('0x2e')]['filter']+'%'};return _0x438a64;})});}_0x53cff1=_[_0x3378('0x3b')]({},_0x53cff1,_0x18a558[_0x3378('0x3f')]);return _0x475549[_0x3378('0x4d')](_0x53cff1);}})[_0x3378('0x26')](function(_0x162c5f){if(_0x162c5f){_0x458f1a=_0x162c5f[_0x3378('0x45')];if(!_0x18a558[_0x3378('0x2e')][_0x3378('0x34')](_0x3378('0x35'))){_0x53cff1[_0x3378('0x1d')]=qs[_0x3378('0x1d')](_0x18a558[_0x3378('0x2e')][_0x3378('0x1d')]);_0x53cff1['offset']=qs[_0x3378('0x1c')](_0x18a558[_0x3378('0x2e')][_0x3378('0x1c')]);}return _0x475549['getSubjects'](_0x53cff1);}})['then'](function(_0x3e5cee){if(_0x3e5cee){return _0x3e5cee?{'count':_0x458f1a,'rows':_0x3e5cee}:null;}})[_0x3378('0x26')](respondWithResult(_0x1ef934,null))[_0x3378('0x46')](handleError(_0x1ef934,null));};exports[_0x3378('0x4f')]=function(_0x288dac,_0x58b67e,_0x11524a){var _0x5bf7da={};var _0x509003={};var _0x48e491;var _0xdc6c6c;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x288dac[_0x3378('0x4a')]['id']}})['then'](handleEntityNotFound(_0x58b67e,null))[_0x3378('0x26')](function(_0x1f89a6){if(_0x1f89a6){_0x48e491=_0x1f89a6;_0x509003[_0x3378('0x32')]=_[_0x3378('0x2f')](db[_0x3378('0x4e')][_0x3378('0x2b')]);_0x509003['query']=_[_0x3378('0x2f')](_0x288dac[_0x3378('0x2e')]);_0x509003[_0x3378('0x39')]=_[_0x3378('0x30')](_0x509003[_0x3378('0x32')],_0x509003[_0x3378('0x2e')]);_0x5bf7da[_0x3378('0x31')]=_[_0x3378('0x30')](_0x509003['model'],qs[_0x3378('0x33')](_0x288dac[_0x3378('0x2e')][_0x3378('0x33')]));_0x5bf7da[_0x3378('0x31')]=_0x5bf7da[_0x3378('0x31')][_0x3378('0x45')]?_0x5bf7da[_0x3378('0x31')]:_0x509003[_0x3378('0x32')];_0x5bf7da[_0x3378('0x36')]=qs[_0x3378('0x37')](_0x288dac[_0x3378('0x2e')][_0x3378('0x37')]);_0x5bf7da['where']=qs[_0x3378('0x39')](_[_0x3378('0x3a')](_0x288dac[_0x3378('0x2e')],_0x509003['filters']));if(_0x288dac[_0x3378('0x2e')][_0x3378('0x3e')]){_0x5bf7da[_0x3378('0x38')]=_[_0x3378('0x3b')](_0x5bf7da[_0x3378('0x38')],{'$or':_['map'](_0x5bf7da['attributes'],function(_0x2e808a){var _0x3ba84c={};_0x3ba84c[_0x2e808a]={'$like':'%'+_0x288dac[_0x3378('0x2e')][_0x3378('0x3e')]+'%'};return _0x3ba84c;})});}_0x5bf7da=_[_0x3378('0x3b')]({},_0x5bf7da,_0x288dac[_0x3378('0x3f')]);return _0x48e491[_0x3378('0x4f')](_0x5bf7da);}})[_0x3378('0x26')](function(_0x5be85f){if(_0x5be85f){_0xdc6c6c=_0x5be85f[_0x3378('0x45')];if(!_0x288dac[_0x3378('0x2e')]['hasOwnProperty'](_0x3378('0x35'))){_0x5bf7da['limit']=qs[_0x3378('0x1d')](_0x288dac[_0x3378('0x2e')][_0x3378('0x1d')]);_0x5bf7da[_0x3378('0x1c')]=qs[_0x3378('0x1c')](_0x288dac[_0x3378('0x2e')][_0x3378('0x1c')]);}return _0x48e491['getDescriptions'](_0x5bf7da);}})[_0x3378('0x26')](function(_0x3bf054){if(_0x3bf054){return _0x3bf054?{'count':_0xdc6c6c,'rows':_0x3bf054}:null;}})[_0x3378('0x26')](respondWithResult(_0x58b67e,null))[_0x3378('0x46')](handleError(_0x58b67e,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 7c832d7..ad19606 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 _0x6eff=['util','api','bluebird','path','rimraf','../../config/environment','ZohoConfiguration','int_zoho_configurations'];(function(_0x4c2788,_0xddfe19){var _0x543c64=function(_0x4e7920){while(--_0x4e7920){_0x4c2788['push'](_0x4c2788['shift']());}};_0x543c64(++_0xddfe19);}(_0x6eff,0xe8));var _0xf6ef=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0x6eff[_0x5cb1af];return _0x8d7940;};'use strict';var _=require('lodash');var util=require(_0xf6ef('0x0'));var logger=require('../../config/logger')(_0xf6ef('0x1'));var moment=require('moment');var BPromise=require(_0xf6ef('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf6ef('0x3'));var rimraf=require(_0xf6ef('0x4'));var config=require(_0xf6ef('0x5'));var attributes=require('./intZohoConfiguration.attributes');module['exports']=function(_0x1dcba3,_0x40962f){return _0x1dcba3['define'](_0xf6ef('0x6'),attributes,{'tableName':_0xf6ef('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfc0c=['../../config/environment','int_zoho_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x7831c4,_0x1126cc){var _0xaf0e8=function(_0xf641b4){while(--_0xf641b4){_0x7831c4['push'](_0x7831c4['shift']());}};_0xaf0e8(++_0x1126cc);}(_0xfc0c,0xac));var _0xcfc0=function(_0x3053bb,_0x1e8eb4){_0x3053bb=_0x3053bb-0x0;var _0x30903b=_0xfc0c[_0x3053bb];return _0x30903b;};'use strict';var _=require('lodash');var util=require(_0xcfc0('0x0'));var logger=require(_0xcfc0('0x1'))(_0xcfc0('0x2'));var moment=require(_0xcfc0('0x3'));var BPromise=require(_0xcfc0('0x4'));var rp=require(_0xcfc0('0x5'));var fs=require('fs');var path=require(_0xcfc0('0x6'));var rimraf=require(_0xcfc0('0x7'));var config=require(_0xcfc0('0x8'));var attributes=require('./intZohoConfiguration.attributes');module['exports']=function(_0x783d16,_0x1a74c7){return _0x783d16['define']('ZohoConfiguration',attributes,{'tableName':_0xcfc0('0x9'),'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 1426be5..7e1edd3 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 _0x0e56=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x29e35f,_0x4859ef){var _0x266b74=function(_0xc09e1){while(--_0xc09e1){_0x29e35f['push'](_0x29e35f['shift']());}};_0x266b74(++_0x4859ef);}(_0x0e56,0x84));var _0x60e5=function(_0x275d85,_0x5a883e){_0x275d85=_0x275d85-0x0;var _0x3cd754=_0x0e56[_0x275d85];return _0x3cd754;};'use strict';var _=require('lodash');var util=require(_0x60e5('0x0'));var moment=require(_0x60e5('0x1'));var BPromise=require(_0x60e5('0x2'));var rs=require(_0x60e5('0x3'));var fs=require('fs');var Redis=require(_0x60e5('0x4'));var db=require(_0x60e5('0x5'))['db'];var utils=require(_0x60e5('0x6'));var logger=require(_0x60e5('0x7'))(_0x60e5('0x8'));var config=require(_0x60e5('0x9'));var jayson=require(_0x60e5('0xa'));var client=jayson[_0x60e5('0xb')][_0x60e5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x6dfcff,_0x2a1980,_0x56772b){return new BPromise(function(_0x319be8,_0xae0d0){return client[_0x60e5('0xd')](_0x6dfcff,_0x56772b)[_0x60e5('0xe')](function(_0x1274e6){logger['info'](_0x60e5('0xf'),_0x2a1980,_0x60e5('0x10'));logger[_0x60e5('0x11')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x2a1980,_0x60e5('0x10'),JSON[_0x60e5('0x12')](_0x1274e6));if(_0x1274e6[_0x60e5('0x13')]){if(_0x1274e6[_0x60e5('0x13')]['code']===0x1f4){logger['error'](_0x60e5('0xf'),_0x2a1980,_0x1274e6['error'][_0x60e5('0x14')]);return _0xae0d0(_0x1274e6[_0x60e5('0x13')][_0x60e5('0x14')]);}logger[_0x60e5('0x13')]('ZohoConfiguration,\x20%s,\x20%s',_0x2a1980,_0x1274e6[_0x60e5('0x13')][_0x60e5('0x14')]);return _0x319be8(_0x1274e6[_0x60e5('0x13')][_0x60e5('0x14')]);}else{logger[_0x60e5('0x15')]('ZohoConfiguration,\x20%s,\x20%s',_0x2a1980,_0x60e5('0x10'));_0x319be8(_0x1274e6['result'][_0x60e5('0x14')]);}})[_0x60e5('0x16')](function(_0x3a847a){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x2a1980,_0x3a847a);_0xae0d0(_0x3a847a);});});} \ No newline at end of file +var _0xe0e2=['catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x28f32c,_0x4cc342){var _0x355402=function(_0xdb5032){while(--_0xdb5032){_0x28f32c['push'](_0x28f32c['shift']());}};_0x355402(++_0x4cc342);}(_0xe0e2,0x1c3));var _0x2e0e=function(_0x496bb7,_0x32b9fa){_0x496bb7=_0x496bb7-0x0;var _0x589721=_0xe0e2[_0x496bb7];return _0x589721;};'use strict';var _=require('lodash');var util=require(_0x2e0e('0x0'));var moment=require(_0x2e0e('0x1'));var BPromise=require(_0x2e0e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e0e('0x3'));var db=require(_0x2e0e('0x4'))['db'];var utils=require(_0x2e0e('0x5'));var logger=require(_0x2e0e('0x6'))(_0x2e0e('0x7'));var config=require(_0x2e0e('0x8'));var jayson=require(_0x2e0e('0x9'));var client=jayson[_0x2e0e('0xa')][_0x2e0e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a296d,_0x29dd3f,_0x47abaa){return new BPromise(function(_0x44c6de,_0x4ac1f5){return client[_0x2e0e('0xc')](_0x2a296d,_0x47abaa)[_0x2e0e('0xd')](function(_0x16f80e){logger[_0x2e0e('0xe')](_0x2e0e('0xf'),_0x29dd3f,_0x2e0e('0x10'));logger[_0x2e0e('0x11')](_0x2e0e('0x12'),_0x29dd3f,_0x2e0e('0x10'),JSON[_0x2e0e('0x13')](_0x16f80e));if(_0x16f80e[_0x2e0e('0x14')]){if(_0x16f80e[_0x2e0e('0x14')][_0x2e0e('0x15')]===0x1f4){logger['error'](_0x2e0e('0xf'),_0x29dd3f,_0x16f80e['error'][_0x2e0e('0x16')]);return _0x4ac1f5(_0x16f80e[_0x2e0e('0x14')][_0x2e0e('0x16')]);}logger['error'](_0x2e0e('0xf'),_0x29dd3f,_0x16f80e['error']['message']);return _0x44c6de(_0x16f80e['error'][_0x2e0e('0x16')]);}else{logger['info'](_0x2e0e('0xf'),_0x29dd3f,_0x2e0e('0x10'));_0x44c6de(_0x16f80e[_0x2e0e('0x17')][_0x2e0e('0x16')]);}})[_0x2e0e('0x18')](function(_0x3dc08f){logger[_0x2e0e('0x14')]('ZohoConfiguration,\x20%s,\x20%s',_0x29dd3f,_0x3dc08f);_0x4ac1f5(_0x3dc08f);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index c73c1df..483f7ac 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 _0x3d38=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x376b04,_0x332bc5){var _0x32036c=function(_0x22c4e0){while(--_0x22c4e0){_0x376b04['push'](_0x376b04['shift']());}};_0x32036c(++_0x332bc5);}(_0x3d38,0xb9));var _0x83d3=function(_0x5967c0,_0x452377){_0x5967c0=_0x5967c0-0x0;var _0x2ad249=_0x3d38[_0x5967c0];return _0x2ad249;};'use strict';var multer=require(_0x83d3('0x0'));var util=require(_0x83d3('0x1'));var path=require(_0x83d3('0x2'));var timeout=require(_0x83d3('0x3'));var express=require(_0x83d3('0x4'));var router=express['Router']();var fs_extra=require(_0x83d3('0x5'));var auth=require(_0x83d3('0x6'));var interaction=require(_0x83d3('0x7'));var config=require(_0x83d3('0x8'));var controller=require(_0x83d3('0x9'));router[_0x83d3('0xa')]('/',auth[_0x83d3('0xb')](),controller[_0x83d3('0xc')]);router['get']('/:id',auth[_0x83d3('0xb')](),controller['show']);router['post']('/',auth[_0x83d3('0xb')](),controller[_0x83d3('0xd')]);router[_0x83d3('0xe')](_0x83d3('0xf'),auth[_0x83d3('0xb')](),controller[_0x83d3('0x10')]);router['delete'](_0x83d3('0xf'),auth['isAuthenticated'](),controller[_0x83d3('0x11')]);module[_0x83d3('0x12')]=router; \ No newline at end of file +var _0xb102=['/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xb102,0x16d));var _0x2b10=function(_0x4f458c,_0x3a1567){_0x4f458c=_0x4f458c-0x0;var _0x57851c=_0xb102[_0x4f458c];return _0x57851c;};'use strict';var multer=require(_0x2b10('0x0'));var util=require('util');var path=require(_0x2b10('0x1'));var timeout=require(_0x2b10('0x2'));var express=require(_0x2b10('0x3'));var router=express[_0x2b10('0x4')]();var fs_extra=require(_0x2b10('0x5'));var auth=require(_0x2b10('0x6'));var interaction=require(_0x2b10('0x7'));var config=require(_0x2b10('0x8'));var controller=require('./intZohoField.controller');router[_0x2b10('0x9')]('/',auth[_0x2b10('0xa')](),controller[_0x2b10('0xb')]);router[_0x2b10('0x9')]('/:id',auth[_0x2b10('0xa')](),controller[_0x2b10('0xc')]);router[_0x2b10('0xd')]('/',auth[_0x2b10('0xa')](),controller[_0x2b10('0xe')]);router['put'](_0x2b10('0xf'),auth[_0x2b10('0xa')](),controller[_0x2b10('0x10')]);router[_0x2b10('0x11')](_0x2b10('0xf'),auth[_0x2b10('0xa')](),controller[_0x2b10('0x12')]);module[_0x2b10('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 404ebb1..f9a3df1 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 _0x0928=['customVariable','picklist','STRING','variable','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x0928,0x101));var _0x8092=function(_0x29968c,_0x2988b0){_0x29968c=_0x29968c-0x0;var _0xe1efcf=_0x0928[_0x29968c];return _0xe1efcf;};'use strict';var Sequelize=require(_0x8092('0x0'));module[_0x8092('0x1')]={'type':{'type':Sequelize[_0x8092('0x2')](_0x8092('0x3'),'variable',_0x8092('0x4'),'keyValue',_0x8092('0x5')),'defaultValue':_0x8092('0x3')},'content':{'type':Sequelize[_0x8092('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8092('0x2')](_0x8092('0x3'),_0x8092('0x7'),_0x8092('0x4'))},'keyContent':{'type':Sequelize[_0x8092('0x6')]},'idField':{'type':Sequelize[_0x8092('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x8092('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8092('0x6')]}}; \ No newline at end of file +var _0xc3f7=['customVariable','keyValue','string','STRING','ENUM','exports','variable'];(function(_0x573917,_0x5bcc97){var _0x321283=function(_0x3f0dca){while(--_0x3f0dca){_0x573917['push'](_0x573917['shift']());}};_0x321283(++_0x5bcc97);}(_0xc3f7,0x1a2));var _0x7c3f=function(_0x45e725,_0x452382){_0x45e725=_0x45e725-0x0;var _0x1346a1=_0xc3f7[_0x45e725];return _0x1346a1;};'use strict';var Sequelize=require('sequelize');module[_0x7c3f('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0x7c3f('0x1'),_0x7c3f('0x2'),_0x7c3f('0x3'),'picklist'),'defaultValue':_0x7c3f('0x4')},'content':{'type':Sequelize[_0x7c3f('0x5')]},'key':{'type':Sequelize[_0x7c3f('0x5')]},'keyType':{'type':Sequelize[_0x7c3f('0x6')](_0x7c3f('0x4'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x7c3f('0x5')]},'idField':{'type':Sequelize[_0x7c3f('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7c3f('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index f61a47a..1cc83dc 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 _0x160a=['sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','ZohoField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','catch','params','length','merge','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x13be87,_0xebc47c){var _0x15334b=function(_0x20ba31){while(--_0x20ba31){_0x13be87['push'](_0x13be87['shift']());}};_0x15334b(++_0xebc47c);}(_0x160a,0x79));var _0xa160=function(_0x10dfdf,_0x36b623){_0x10dfdf=_0x10dfdf-0x0;var _0x4d857d=_0x160a[_0x10dfdf];return _0x4d857d;};'use strict';var emlformat=require(_0xa160('0x0'));var rimraf=require(_0xa160('0x1'));var zipdir=require(_0xa160('0x2'));var jsonpatch=require(_0xa160('0x3'));var rp=require(_0xa160('0x4'));var moment=require('moment');var BPromise=require(_0xa160('0x5'));var Mustache=require(_0xa160('0x6'));var util=require(_0xa160('0x7'));var path=require(_0xa160('0x8'));var sox=require(_0xa160('0x9'));var csv=require(_0xa160('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa160('0xb'));var _=require(_0xa160('0xc'));var squel=require('squel');var crypto=require(_0xa160('0xd'));var jsforce=require(_0xa160('0xe'));var deskjs=require(_0xa160('0xf'));var toCsv=require(_0xa160('0xa'));var querystring=require(_0xa160('0x10'));var Papa=require(_0xa160('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa160('0x12'));var as=require(_0xa160('0x13'));var hardwareService=require(_0xa160('0x14'));var logger=require(_0xa160('0x15'))(_0xa160('0x16'));var utils=require(_0xa160('0x17'));var config=require(_0xa160('0x18'));var licenseUtil=require(_0xa160('0x19'));var db=require(_0xa160('0x1a'))['db'];function respondWithStatusCode(_0x4fa923,_0x3148a7){_0x3148a7=_0x3148a7||0xcc;return function(_0x7d0c52){if(_0x7d0c52){return _0x4fa923[_0xa160('0x1b')](_0x3148a7);}return _0x4fa923[_0xa160('0x1c')](_0x3148a7)[_0xa160('0x1d')]();};}function respondWithResult(_0x5f4107,_0x4aff94){_0x4aff94=_0x4aff94||0xc8;return function(_0x13d8de){if(_0x13d8de){return _0x5f4107['status'](_0x4aff94)[_0xa160('0x1e')](_0x13d8de);}};}function respondWithFilteredResult(_0x3dbfe5,_0x516e0b){return function(_0x38c80c){if(_0x38c80c){var _0x47155c=typeof _0x516e0b[_0xa160('0x1f')]==='undefined'&&typeof _0x516e0b[_0xa160('0x20')]==='undefined';var _0x3d54f=_0x38c80c[_0xa160('0x21')];var _0x48f8c2=_0x47155c?0x0:_0x516e0b['offset'];var _0x19dabf=_0x47155c?_0x38c80c[_0xa160('0x21')]:_0x516e0b[_0xa160('0x1f')]+_0x516e0b[_0xa160('0x20')];var _0x18047b;if(_0x19dabf>=_0x3d54f){_0x19dabf=_0x3d54f;_0x18047b=0xc8;}else{_0x18047b=0xce;}_0x3dbfe5[_0xa160('0x1c')](_0x18047b);return _0x3dbfe5['set'](_0xa160('0x22'),_0x48f8c2+'-'+_0x19dabf+'/'+_0x3d54f)[_0xa160('0x1e')](_0x38c80c);}return null;};}function patchUpdates(_0x226f84){return function(_0x4036df){try{jsonpatch[_0xa160('0x23')](_0x4036df,_0x226f84,!![]);}catch(_0x2b2057){return BPromise[_0xa160('0x24')](_0x2b2057);}return _0x4036df[_0xa160('0x25')]();};}function saveUpdates(_0x418ace,_0x2794bf){return function(_0x338bbc){if(_0x338bbc){return _0x338bbc[_0xa160('0x26')](_0x418ace)[_0xa160('0x27')](function(_0x8ffb4f){return _0x8ffb4f;});}return null;};}function removeEntity(_0x4d66f6,_0xa46a03){return function(_0x2d5a85){if(_0x2d5a85){return _0x2d5a85[_0xa160('0x28')]()[_0xa160('0x27')](function(){_0x4d66f6[_0xa160('0x1c')](0xcc)[_0xa160('0x1d')]();});}};}function handleEntityNotFound(_0x4069de,_0x4bd0c3){return function(_0x21697d){if(!_0x21697d){_0x4069de[_0xa160('0x1b')](0x194);}return _0x21697d;};}function handleError(_0x41d219,_0xdae508){_0xdae508=_0xdae508||0x1f4;return function(_0x469175){logger[_0xa160('0x29')](_0x469175[_0xa160('0x2a')]);if(_0x469175[_0xa160('0x2b')]){delete _0x469175[_0xa160('0x2b')];}_0x41d219[_0xa160('0x1c')](_0xdae508)['send'](_0x469175);};}exports['index']=function(_0xd5d6d2,_0x539d5b){var _0x50d0d7={},_0x3b7f49={},_0x50c56a={'count':0x0,'rows':[]};var _0xaa30a9=_[_0xa160('0x2c')](db[_0xa160('0x2d')][_0xa160('0x2e')],function(_0x295c3a){return{'name':_0x295c3a[_0xa160('0x2f')],'type':_0x295c3a[_0xa160('0x30')]['key']};});_0x3b7f49[_0xa160('0x31')]=_[_0xa160('0x2c')](_0xaa30a9,_0xa160('0x2b'));_0x3b7f49[_0xa160('0x32')]=_[_0xa160('0x33')](_0xd5d6d2[_0xa160('0x32')]);_0x3b7f49[_0xa160('0x34')]=_[_0xa160('0x35')](_0x3b7f49['model'],_0x3b7f49[_0xa160('0x32')]);_0x50d0d7[_0xa160('0x36')]=_[_0xa160('0x35')](_0x3b7f49[_0xa160('0x31')],qs[_0xa160('0x37')](_0xd5d6d2[_0xa160('0x32')][_0xa160('0x37')]));_0x50d0d7[_0xa160('0x36')]=_0x50d0d7[_0xa160('0x36')]['length']?_0x50d0d7[_0xa160('0x36')]:_0x3b7f49[_0xa160('0x31')];if(!_0xd5d6d2[_0xa160('0x32')][_0xa160('0x38')](_0xa160('0x39'))){_0x50d0d7[_0xa160('0x20')]=qs['limit'](_0xd5d6d2['query'][_0xa160('0x20')]);_0x50d0d7['offset']=qs[_0xa160('0x1f')](_0xd5d6d2[_0xa160('0x32')][_0xa160('0x1f')]);}_0x50d0d7[_0xa160('0x3a')]=qs['sort'](_0xd5d6d2['query']['sort']);_0x50d0d7[_0xa160('0x3b')]=qs[_0xa160('0x34')](_[_0xa160('0x3c')](_0xd5d6d2[_0xa160('0x32')],_0x3b7f49[_0xa160('0x34')]),_0xaa30a9);if(_0xd5d6d2[_0xa160('0x32')]['filter']){_0x50d0d7[_0xa160('0x3b')]=_['merge'](_0x50d0d7[_0xa160('0x3b')],{'$or':_['map'](_0xaa30a9,function(_0x534e38){if(_0x534e38[_0xa160('0x30')]!==_0xa160('0x3d')){var _0x1a33ad={};_0x1a33ad[_0x534e38[_0xa160('0x2b')]]={'$like':'%'+_0xd5d6d2[_0xa160('0x32')][_0xa160('0x3e')]+'%'};return _0x1a33ad;}})});}_0x50d0d7=_['merge']({},_0x50d0d7,_0xd5d6d2[_0xa160('0x3f')]);var _0x248246={'where':_0x50d0d7[_0xa160('0x3b')]};return db['ZohoField'][_0xa160('0x21')](_0x248246)[_0xa160('0x27')](function(_0x43845e){_0x50c56a[_0xa160('0x21')]=_0x43845e;if(_0xd5d6d2[_0xa160('0x32')][_0xa160('0x40')]){_0x50d0d7[_0xa160('0x41')]=[{'all':!![]}];}return db[_0xa160('0x2d')][_0xa160('0x42')](_0x50d0d7);})[_0xa160('0x27')](function(_0x34ed24){_0x50c56a['rows']=_0x34ed24;return _0x50c56a;})[_0xa160('0x27')](respondWithFilteredResult(_0x539d5b,_0x50d0d7))[_0xa160('0x43')](handleError(_0x539d5b,null));};exports['show']=function(_0x581a95,_0x22c4b6){var _0x46b2bd={'raw':!![],'where':{'id':_0x581a95[_0xa160('0x44')]['id']}},_0x59c8df={};_0x59c8df[_0xa160('0x31')]=_['keys'](db[_0xa160('0x2d')]['rawAttributes']);_0x59c8df[_0xa160('0x32')]=_['keys'](_0x581a95['query']);_0x59c8df['filters']=_[_0xa160('0x35')](_0x59c8df[_0xa160('0x31')],_0x59c8df[_0xa160('0x32')]);_0x46b2bd[_0xa160('0x36')]=_[_0xa160('0x35')](_0x59c8df['model'],qs[_0xa160('0x37')](_0x581a95['query'][_0xa160('0x37')]));_0x46b2bd['attributes']=_0x46b2bd[_0xa160('0x36')][_0xa160('0x45')]?_0x46b2bd['attributes']:_0x59c8df[_0xa160('0x31')];if(_0x581a95[_0xa160('0x32')][_0xa160('0x40')]){_0x46b2bd[_0xa160('0x41')]=[{'all':!![]}];}_0x46b2bd=_[_0xa160('0x46')]({},_0x46b2bd,_0x581a95[_0xa160('0x3f')]);return db[_0xa160('0x2d')][_0xa160('0x47')](_0x46b2bd)[_0xa160('0x27')](handleEntityNotFound(_0x22c4b6,null))['then'](respondWithResult(_0x22c4b6,null))[_0xa160('0x43')](handleError(_0x22c4b6,null));};exports[_0xa160('0x48')]=function(_0x162f7b,_0x444630){return db[_0xa160('0x2d')][_0xa160('0x48')](_0x162f7b['body'],{})[_0xa160('0x27')](respondWithResult(_0x444630,0xc9))[_0xa160('0x43')](handleError(_0x444630,null));};exports['update']=function(_0x19b8df,_0x10811f){if(_0x19b8df[_0xa160('0x49')]['id']){delete _0x19b8df[_0xa160('0x49')]['id'];}return db[_0xa160('0x2d')][_0xa160('0x47')]({'where':{'id':_0x19b8df['params']['id']}})[_0xa160('0x27')](handleEntityNotFound(_0x10811f,null))[_0xa160('0x27')](saveUpdates(_0x19b8df[_0xa160('0x49')],null))[_0xa160('0x27')](respondWithResult(_0x10811f,null))[_0xa160('0x43')](handleError(_0x10811f,null));};exports[_0xa160('0x28')]=function(_0x208bff,_0x4448dd){return db[_0xa160('0x2d')][_0xa160('0x47')]({'where':{'id':_0x208bff[_0xa160('0x44')]['id']}})[_0xa160('0x27')](handleEntityNotFound(_0x4448dd,null))[_0xa160('0x27')](removeEntity(_0x4448dd,null))[_0xa160('0x43')](handleError(_0x4448dd,null));}; \ No newline at end of file +var _0x832c=['reject','save','update','then','destroy','error','name','index','ZohoField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','map','VIRTUAL','options','includeAll','findAll','catch','show','include','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','set','Content-Range'];(function(_0x36e0bf,_0x5bff08){var _0x4d40d7=function(_0xdfd307){while(--_0xdfd307){_0x36e0bf['push'](_0x36e0bf['shift']());}};_0x4d40d7(++_0x5bff08);}(_0x832c,0x193));var _0xc832=function(_0x5c0952,_0x1624fd){_0x5c0952=_0x5c0952-0x0;var _0x3f82e8=_0x832c[_0x5c0952];return _0x3f82e8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc832('0x0'));var zipdir=require(_0xc832('0x1'));var jsonpatch=require(_0xc832('0x2'));var rp=require(_0xc832('0x3'));var moment=require(_0xc832('0x4'));var BPromise=require(_0xc832('0x5'));var Mustache=require(_0xc832('0x6'));var util=require(_0xc832('0x7'));var path=require(_0xc832('0x8'));var sox=require(_0xc832('0x9'));var csv=require(_0xc832('0xa'));var ejs=require(_0xc832('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc832('0xc'));var crypto=require(_0xc832('0xd'));var jsforce=require(_0xc832('0xe'));var deskjs=require(_0xc832('0xf'));var toCsv=require(_0xc832('0xa'));var querystring=require('querystring');var Papa=require(_0xc832('0x10'));var Redis=require(_0xc832('0x11'));var authService=require(_0xc832('0x12'));var qs=require(_0xc832('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc832('0x14'));var logger=require('../../config/logger')(_0xc832('0x15'));var utils=require(_0xc832('0x16'));var config=require(_0xc832('0x17'));var licenseUtil=require(_0xc832('0x18'));var db=require(_0xc832('0x19'))['db'];function respondWithStatusCode(_0x456497,_0x3ffdd9){_0x3ffdd9=_0x3ffdd9||0xcc;return function(_0x5a086f){if(_0x5a086f){return _0x456497[_0xc832('0x1a')](_0x3ffdd9);}return _0x456497[_0xc832('0x1b')](_0x3ffdd9)[_0xc832('0x1c')]();};}function respondWithResult(_0x5b3949,_0x24f974){_0x24f974=_0x24f974||0xc8;return function(_0xbb3bdd){if(_0xbb3bdd){return _0x5b3949[_0xc832('0x1b')](_0x24f974)[_0xc832('0x1d')](_0xbb3bdd);}};}function respondWithFilteredResult(_0x328d21,_0x480d17){return function(_0x5de658){if(_0x5de658){var _0x303937=typeof _0x480d17['offset']==='undefined'&&typeof _0x480d17[_0xc832('0x1e')]===_0xc832('0x1f');var _0x1781f3=_0x5de658['count'];var _0x12e45d=_0x303937?0x0:_0x480d17[_0xc832('0x20')];var _0x1d6186=_0x303937?_0x5de658['count']:_0x480d17['offset']+_0x480d17[_0xc832('0x1e')];var _0x18e801;if(_0x1d6186>=_0x1781f3){_0x1d6186=_0x1781f3;_0x18e801=0xc8;}else{_0x18e801=0xce;}_0x328d21[_0xc832('0x1b')](_0x18e801);return _0x328d21[_0xc832('0x21')](_0xc832('0x22'),_0x12e45d+'-'+_0x1d6186+'/'+_0x1781f3)['json'](_0x5de658);}return null;};}function patchUpdates(_0x12e2b1){return function(_0x5dc0f2){try{jsonpatch['apply'](_0x5dc0f2,_0x12e2b1,!![]);}catch(_0x4200a9){return BPromise[_0xc832('0x23')](_0x4200a9);}return _0x5dc0f2[_0xc832('0x24')]();};}function saveUpdates(_0x80bf05,_0x12cb55){return function(_0x1e2247){if(_0x1e2247){return _0x1e2247[_0xc832('0x25')](_0x80bf05)[_0xc832('0x26')](function(_0x51269a){return _0x51269a;});}return null;};}function removeEntity(_0x40262a,_0x349578){return function(_0x4f9886){if(_0x4f9886){return _0x4f9886[_0xc832('0x27')]()[_0xc832('0x26')](function(){_0x40262a['status'](0xcc)[_0xc832('0x1c')]();});}};}function handleEntityNotFound(_0x168ed4,_0x4b977c){return function(_0x17d264){if(!_0x17d264){_0x168ed4[_0xc832('0x1a')](0x194);}return _0x17d264;};}function handleError(_0x41116b,_0x5f4f62){_0x5f4f62=_0x5f4f62||0x1f4;return function(_0x3f0b2e){logger[_0xc832('0x28')](_0x3f0b2e['stack']);if(_0x3f0b2e[_0xc832('0x29')]){delete _0x3f0b2e[_0xc832('0x29')];}_0x41116b[_0xc832('0x1b')](_0x5f4f62)['send'](_0x3f0b2e);};}exports[_0xc832('0x2a')]=function(_0x3ff354,_0x38c1b1){var _0x4883fa={},_0x4d10fa={},_0x2d1afd={'count':0x0,'rows':[]};var _0x4151ad=_['map'](db[_0xc832('0x2b')][_0xc832('0x2c')],function(_0x32f3fa){return{'name':_0x32f3fa[_0xc832('0x2d')],'type':_0x32f3fa[_0xc832('0x2e')]['key']};});_0x4d10fa[_0xc832('0x2f')]=_['map'](_0x4151ad,_0xc832('0x29'));_0x4d10fa[_0xc832('0x30')]=_[_0xc832('0x31')](_0x3ff354[_0xc832('0x30')]);_0x4d10fa[_0xc832('0x32')]=_[_0xc832('0x33')](_0x4d10fa[_0xc832('0x2f')],_0x4d10fa[_0xc832('0x30')]);_0x4883fa[_0xc832('0x34')]=_['intersection'](_0x4d10fa[_0xc832('0x2f')],qs[_0xc832('0x35')](_0x3ff354[_0xc832('0x30')][_0xc832('0x35')]));_0x4883fa['attributes']=_0x4883fa[_0xc832('0x34')][_0xc832('0x36')]?_0x4883fa[_0xc832('0x34')]:_0x4d10fa[_0xc832('0x2f')];if(!_0x3ff354[_0xc832('0x30')][_0xc832('0x37')](_0xc832('0x38'))){_0x4883fa[_0xc832('0x1e')]=qs['limit'](_0x3ff354[_0xc832('0x30')][_0xc832('0x1e')]);_0x4883fa[_0xc832('0x20')]=qs['offset'](_0x3ff354[_0xc832('0x30')][_0xc832('0x20')]);}_0x4883fa[_0xc832('0x39')]=qs[_0xc832('0x3a')](_0x3ff354[_0xc832('0x30')]['sort']);_0x4883fa[_0xc832('0x3b')]=qs[_0xc832('0x32')](_['pick'](_0x3ff354[_0xc832('0x30')],_0x4d10fa[_0xc832('0x32')]),_0x4151ad);if(_0x3ff354['query']['filter']){_0x4883fa[_0xc832('0x3b')]=_[_0xc832('0x3c')](_0x4883fa[_0xc832('0x3b')],{'$or':_[_0xc832('0x3d')](_0x4151ad,function(_0x27f491){if(_0x27f491[_0xc832('0x2e')]!==_0xc832('0x3e')){var _0x2d7cb7={};_0x2d7cb7[_0x27f491[_0xc832('0x29')]]={'$like':'%'+_0x3ff354[_0xc832('0x30')]['filter']+'%'};return _0x2d7cb7;}})});}_0x4883fa=_[_0xc832('0x3c')]({},_0x4883fa,_0x3ff354[_0xc832('0x3f')]);var _0x3f4aec={'where':_0x4883fa[_0xc832('0x3b')]};return db['ZohoField']['count'](_0x3f4aec)['then'](function(_0x49c31d){_0x2d1afd['count']=_0x49c31d;if(_0x3ff354[_0xc832('0x30')][_0xc832('0x40')]){_0x4883fa['include']=[{'all':!![]}];}return db[_0xc832('0x2b')][_0xc832('0x41')](_0x4883fa);})[_0xc832('0x26')](function(_0x2b1deb){_0x2d1afd['rows']=_0x2b1deb;return _0x2d1afd;})[_0xc832('0x26')](respondWithFilteredResult(_0x38c1b1,_0x4883fa))[_0xc832('0x42')](handleError(_0x38c1b1,null));};exports[_0xc832('0x43')]=function(_0x26b2b3,_0x123eef){var _0x595f09={'raw':!![],'where':{'id':_0x26b2b3['params']['id']}},_0x21b356={};_0x21b356[_0xc832('0x2f')]=_[_0xc832('0x31')](db[_0xc832('0x2b')]['rawAttributes']);_0x21b356[_0xc832('0x30')]=_['keys'](_0x26b2b3[_0xc832('0x30')]);_0x21b356[_0xc832('0x32')]=_['intersection'](_0x21b356['model'],_0x21b356[_0xc832('0x30')]);_0x595f09[_0xc832('0x34')]=_[_0xc832('0x33')](_0x21b356[_0xc832('0x2f')],qs[_0xc832('0x35')](_0x26b2b3[_0xc832('0x30')][_0xc832('0x35')]));_0x595f09['attributes']=_0x595f09['attributes'][_0xc832('0x36')]?_0x595f09[_0xc832('0x34')]:_0x21b356[_0xc832('0x2f')];if(_0x26b2b3[_0xc832('0x30')][_0xc832('0x40')]){_0x595f09[_0xc832('0x44')]=[{'all':!![]}];}_0x595f09=_[_0xc832('0x3c')]({},_0x595f09,_0x26b2b3['options']);return db[_0xc832('0x2b')][_0xc832('0x45')](_0x595f09)[_0xc832('0x26')](handleEntityNotFound(_0x123eef,null))[_0xc832('0x26')](respondWithResult(_0x123eef,null))[_0xc832('0x42')](handleError(_0x123eef,null));};exports[_0xc832('0x46')]=function(_0x397efd,_0x1ad636){return db[_0xc832('0x2b')]['create'](_0x397efd['body'],{})[_0xc832('0x26')](respondWithResult(_0x1ad636,0xc9))[_0xc832('0x42')](handleError(_0x1ad636,null));};exports[_0xc832('0x25')]=function(_0x4ed955,_0x4398ed){if(_0x4ed955[_0xc832('0x47')]['id']){delete _0x4ed955['body']['id'];}return db[_0xc832('0x2b')][_0xc832('0x45')]({'where':{'id':_0x4ed955[_0xc832('0x48')]['id']}})['then'](handleEntityNotFound(_0x4398ed,null))[_0xc832('0x26')](saveUpdates(_0x4ed955[_0xc832('0x47')],null))[_0xc832('0x26')](respondWithResult(_0x4398ed,null))[_0xc832('0x42')](handleError(_0x4398ed,null));};exports[_0xc832('0x27')]=function(_0x5f17fe,_0x488da2){return db[_0xc832('0x2b')][_0xc832('0x45')]({'where':{'id':_0x5f17fe[_0xc832('0x48')]['id']}})[_0xc832('0x26')](handleEntityNotFound(_0x488da2,null))[_0xc832('0x26')](removeEntity(_0x488da2,null))[_0xc832('0x42')](handleError(_0x488da2,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 91ce3ba..75d81dc 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 _0x4137=['path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5c08cb,_0x456960){var _0x147907=function(_0x1da1be){while(--_0x1da1be){_0x5c08cb['push'](_0x5c08cb['shift']());}};_0x147907(++_0x456960);}(_0x4137,0xf8));var _0x7413=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x4137[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var logger=require(_0x7413('0x2'))(_0x7413('0x3'));var moment=require(_0x7413('0x4'));var BPromise=require(_0x7413('0x5'));var rp=require(_0x7413('0x6'));var fs=require('fs');var path=require(_0x7413('0x7'));var rimraf=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var attributes=require(_0x7413('0xa'));module[_0x7413('0xb')]=function(_0x4fbade,_0xc808cd){return _0x4fbade[_0x7413('0xc')](_0x7413('0xd'),attributes,{'tableName':_0x7413('0xe'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x7413('0xf'),_0x7413('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6050=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','zoho_unique_index','idField','FieldId','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6050,0x196));var _0x0605=function(_0x546602,_0x183374){_0x546602=_0x546602-0x0;var _0x2614d4=_0x6050[_0x546602];return _0x2614d4;};'use strict';var _=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var logger=require(_0x0605('0x2'))(_0x0605('0x3'));var moment=require(_0x0605('0x4'));var BPromise=require(_0x0605('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0605('0x6'));var rimraf=require(_0x0605('0x7'));var config=require(_0x0605('0x8'));var attributes=require('./intZohoField.attributes');module['exports']=function(_0x4aca21,_0xd78d96){return _0x4aca21['define']('ZohoField',attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x0605('0x9'),'fields':[_0x0605('0xa'),_0x0605('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 8619d7a..acaef44 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 _0xe45e=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x39ccd6,_0x1bd838){var _0x4165a4=function(_0x8998e4){while(--_0x8998e4){_0x39ccd6['push'](_0x39ccd6['shift']());}};_0x4165a4(++_0x1bd838);}(_0xe45e,0xfe));var _0xee45=function(_0x2a0738,_0x3c0bc5){_0x2a0738=_0x2a0738-0x0;var _0x159679=_0xe45e[_0x2a0738];return _0x159679;};'use strict';var _=require(_0xee45('0x0'));var util=require(_0xee45('0x1'));var moment=require(_0xee45('0x2'));var BPromise=require(_0xee45('0x3'));var rs=require(_0xee45('0x4'));var fs=require('fs');var Redis=require(_0xee45('0x5'));var db=require(_0xee45('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xee45('0x7'))('rpc');var config=require(_0xee45('0x8'));var jayson=require(_0xee45('0x9'));var client=jayson[_0xee45('0xa')][_0xee45('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x20aad4,_0x5504e7,_0x5710f2){return new BPromise(function(_0x2acf9e,_0x1fd583){return client['request'](_0x20aad4,_0x5710f2)['then'](function(_0x5b1884){logger[_0xee45('0xc')](_0xee45('0xd'),_0x5504e7,_0xee45('0xe'));logger[_0xee45('0xf')](_0xee45('0x10'),_0x5504e7,'request\x20sent',JSON[_0xee45('0x11')](_0x5b1884));if(_0x5b1884['error']){if(_0x5b1884[_0xee45('0x12')]['code']===0x1f4){logger[_0xee45('0x12')](_0xee45('0xd'),_0x5504e7,_0x5b1884['error'][_0xee45('0x13')]);return _0x1fd583(_0x5b1884[_0xee45('0x12')]['message']);}logger[_0xee45('0x12')](_0xee45('0xd'),_0x5504e7,_0x5b1884['error'][_0xee45('0x13')]);return _0x2acf9e(_0x5b1884['error'][_0xee45('0x13')]);}else{logger[_0xee45('0xc')](_0xee45('0xd'),_0x5504e7,'request\x20sent');_0x2acf9e(_0x5b1884[_0xee45('0x14')][_0xee45('0x13')]);}})['catch'](function(_0x53acc2){logger[_0xee45('0x12')](_0xee45('0xd'),_0x5504e7,_0x53acc2);_0x1fd583(_0x53acc2);});});} \ No newline at end of file +var _0xbf1d=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','message','error','info','catch','lodash','util','moment','randomstring'];(function(_0x100e36,_0x4da225){var _0x1df0c9=function(_0xe4b84f){while(--_0xe4b84f){_0x100e36['push'](_0x100e36['shift']());}};_0x1df0c9(++_0x4da225);}(_0xbf1d,0xf8));var _0xdbf1=function(_0xb42354,_0x46e24d){_0xb42354=_0xb42354-0x0;var _0x21d2f3=_0xbf1d[_0xb42354];return _0x21d2f3;};'use strict';var _=require(_0xdbf1('0x0'));var util=require(_0xdbf1('0x1'));var moment=require(_0xdbf1('0x2'));var BPromise=require('bluebird');var rs=require(_0xdbf1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdbf1('0x4'))['db'];var utils=require(_0xdbf1('0x5'));var logger=require(_0xdbf1('0x6'))(_0xdbf1('0x7'));var config=require('../../config/environment');var jayson=require(_0xdbf1('0x8'));var client=jayson[_0xdbf1('0x9')][_0xdbf1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a910f,_0xa185aa,_0x3f72f4){return new BPromise(function(_0x1743ac,_0x31243b){return client[_0xdbf1('0xb')](_0x5a910f,_0x3f72f4)['then'](function(_0x280aea){logger['info'](_0xdbf1('0xc'),_0xa185aa,'request\x20sent');logger[_0xdbf1('0xd')](_0xdbf1('0xe'),_0xa185aa,_0xdbf1('0xf'),JSON[_0xdbf1('0x10')](_0x280aea));if(_0x280aea['error']){if(_0x280aea['error']['code']===0x1f4){logger['error'](_0xdbf1('0xc'),_0xa185aa,_0x280aea['error'][_0xdbf1('0x11')]);return _0x31243b(_0x280aea[_0xdbf1('0x12')][_0xdbf1('0x11')]);}logger[_0xdbf1('0x12')](_0xdbf1('0xc'),_0xa185aa,_0x280aea[_0xdbf1('0x12')][_0xdbf1('0x11')]);return _0x1743ac(_0x280aea[_0xdbf1('0x12')]['message']);}else{logger[_0xdbf1('0x13')](_0xdbf1('0xc'),_0xa185aa,_0xdbf1('0xf'));_0x1743ac(_0x280aea['result'][_0xdbf1('0x11')]);}})[_0xdbf1('0x14')](function(_0xb94194){logger[_0xdbf1('0x12')](_0xdbf1('0xc'),_0xa185aa,_0xb94194);_0x31243b(_0xb94194);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 7e9400b..47da56c 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1c8e1c,_0x2b9486){var _0x590279=function(_0x11d213){while(--_0x11d213){_0x1c8e1c['push'](_0x1c8e1c['shift']());}};_0x590279(++_0x2b9486);}(_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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x45595c,_0x35641d){var _0x37c5c3=function(_0x3948df){while(--_0x3948df){_0x45595c['push'](_0x45595c['shift']());}};_0x37c5c3(++_0x35641d);}(_0x9c44,0x178));var _0x49c4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9c44[_0xfae23b];return _0x200640;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 0109af1..d51c40b 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 _0xebff=['unique_name_and_version','app.js','state','sequelize','STRING'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xebff,0xf8));var _0xfebf=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0xebff[_0xe73080];return _0x12cbc4;};'use strict';var Sequelize=require(_0xfebf('0x0'));module['exports']={'name':{'type':Sequelize[_0xfebf('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xfebf('0x1')],'allowNull':![],'unique':_0xfebf('0x2')},'main':{'type':Sequelize[_0xfebf('0x1')],'defaultValue':_0xfebf('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0xfebf('0x1')]},'type':{'type':Sequelize[_0xfebf('0x1')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xfebf('0x1')]},'state':{'type':Sequelize['STRING'],'unique':_0xfebf('0x4')},'description':{'type':Sequelize[_0xfebf('0x1')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0xcd6a=['BOOLEAN','state','STRING','unique_name_and_version'];(function(_0x23ec06,_0x561142){var _0x2831d4=function(_0x3802bc){while(--_0x3802bc){_0x23ec06['push'](_0x23ec06['shift']());}};_0x2831d4(++_0x561142);}(_0xcd6a,0xbe));var _0xacd6=function(_0x5d846b,_0x155807){_0x5d846b=_0x5d846b-0x0;var _0x422ea7=_0xcd6a[_0x5d846b];return _0x422ea7;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xacd6('0x0')],'allowNull':![],'unique':_0xacd6('0x1')},'version':{'type':Sequelize[_0xacd6('0x0')],'allowNull':![],'unique':_0xacd6('0x1')},'main':{'type':Sequelize[_0xacd6('0x0')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0xacd6('0x0')]},'path':{'type':Sequelize[_0xacd6('0x0')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0xacd6('0x2')],'defaultValue':![]},'author':{'type':Sequelize[_0xacd6('0x0')]},'logo':{'type':Sequelize[_0xacd6('0x0')]},'state':{'type':Sequelize[_0xacd6('0x0')],'unique':_0xacd6('0x3')},'description':{'type':Sequelize[_0xacd6('0x0')]},'title':{'type':Sequelize[_0xacd6('0x0')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xacd6('0x0')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index f8463c8..0c7da0a 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 _0x9582=['rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','offset','count','set','json','reject','save','update','then','destroy','error','name','send','index','map','Integration','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format'];(function(_0x307086,_0x3bfe4e){var _0x699043=function(_0x1a7677){while(--_0x1a7677){_0x307086['push'](_0x307086['shift']());}};_0x699043(++_0x3bfe4e);}(_0x9582,0x95));var _0x2958=function(_0x58fa2b,_0x20f70e){_0x58fa2b=_0x58fa2b-0x0;var _0x11bd23=_0x9582[_0x58fa2b];return _0x11bd23;};'use strict';var emlformat=require(_0x2958('0x0'));var rimraf=require(_0x2958('0x1'));var zipdir=require(_0x2958('0x2'));var jsonpatch=require(_0x2958('0x3'));var rp=require(_0x2958('0x4'));var moment=require(_0x2958('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2958('0x6'));var util=require(_0x2958('0x7'));var path=require(_0x2958('0x8'));var sox=require(_0x2958('0x9'));var csv=require(_0x2958('0xa'));var ejs=require(_0x2958('0xb'));var fs=require('fs');var fs_extra=require(_0x2958('0xc'));var _=require(_0x2958('0xd'));var squel=require(_0x2958('0xe'));var crypto=require(_0x2958('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2958('0xa'));var querystring=require('querystring');var Papa=require(_0x2958('0x10'));var Redis=require('ioredis');var authService=require(_0x2958('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2958('0x12'));var hardwareService=require(_0x2958('0x13'));var logger=require(_0x2958('0x14'))(_0x2958('0x15'));var utils=require(_0x2958('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2958('0x17'));var db=require(_0x2958('0x18'))['db'];function respondWithStatusCode(_0x33a13a,_0x20e06a){_0x20e06a=_0x20e06a||0xcc;return function(_0x47067d){if(_0x47067d){return _0x33a13a[_0x2958('0x19')](_0x20e06a);}return _0x33a13a[_0x2958('0x1a')](_0x20e06a)[_0x2958('0x1b')]();};}function respondWithResult(_0x5bd520,_0x42e976){_0x42e976=_0x42e976||0xc8;return function(_0x2e12d4){if(_0x2e12d4){return _0x5bd520['status'](_0x42e976)['json'](_0x2e12d4);}};}function respondWithFilteredResult(_0x21ed6c,_0x38e724){return function(_0x5f06b1){if(_0x5f06b1){var _0x3bef50=typeof _0x38e724['offset']==='undefined'&&typeof _0x38e724[_0x2958('0x1c')]===_0x2958('0x1d');var _0x55e261=_0x5f06b1['count'];var _0x28a92c=_0x3bef50?0x0:_0x38e724[_0x2958('0x1e')];var _0x310d07=_0x3bef50?_0x5f06b1[_0x2958('0x1f')]:_0x38e724[_0x2958('0x1e')]+_0x38e724['limit'];var _0x19a614;if(_0x310d07>=_0x55e261){_0x310d07=_0x55e261;_0x19a614=0xc8;}else{_0x19a614=0xce;}_0x21ed6c[_0x2958('0x1a')](_0x19a614);return _0x21ed6c[_0x2958('0x20')]('Content-Range',_0x28a92c+'-'+_0x310d07+'/'+_0x55e261)[_0x2958('0x21')](_0x5f06b1);}return null;};}function patchUpdates(_0x53b100){return function(_0x1da684){try{jsonpatch['apply'](_0x1da684,_0x53b100,!![]);}catch(_0x5eaf36){return BPromise[_0x2958('0x22')](_0x5eaf36);}return _0x1da684[_0x2958('0x23')]();};}function saveUpdates(_0x2a02a4,_0x26c5a5){return function(_0x2202f8){if(_0x2202f8){return _0x2202f8[_0x2958('0x24')](_0x2a02a4)[_0x2958('0x25')](function(_0x2b9818){return _0x2b9818;});}return null;};}function removeEntity(_0x330763,_0x2aa514){return function(_0xaf5547){if(_0xaf5547){return _0xaf5547[_0x2958('0x26')]()[_0x2958('0x25')](function(){_0x330763[_0x2958('0x1a')](0xcc)[_0x2958('0x1b')]();});}};}function handleEntityNotFound(_0x4f811a,_0x574df5){return function(_0x3c1155){if(!_0x3c1155){_0x4f811a[_0x2958('0x19')](0x194);}return _0x3c1155;};}function handleError(_0x28c1f5,_0x43cf73){_0x43cf73=_0x43cf73||0x1f4;return function(_0x52bd32){logger[_0x2958('0x27')](_0x52bd32['stack']);if(_0x52bd32[_0x2958('0x28')]){delete _0x52bd32[_0x2958('0x28')];}_0x28c1f5[_0x2958('0x1a')](_0x43cf73)[_0x2958('0x29')](_0x52bd32);};}exports[_0x2958('0x2a')]=function(_0x36e2a5,_0x153958){var _0x5d1dfc={},_0x21b919={},_0x5053d0={'count':0x0,'rows':[]};var _0x48650d=_[_0x2958('0x2b')](db[_0x2958('0x2c')][_0x2958('0x2d')],function(_0x34e56e){return{'name':_0x34e56e[_0x2958('0x2e')],'type':_0x34e56e[_0x2958('0x2f')][_0x2958('0x30')]};});_0x21b919[_0x2958('0x31')]=_['map'](_0x48650d,_0x2958('0x28'));_0x21b919[_0x2958('0x32')]=_['keys'](_0x36e2a5[_0x2958('0x32')]);_0x21b919['filters']=_[_0x2958('0x33')](_0x21b919['model'],_0x21b919[_0x2958('0x32')]);_0x5d1dfc['attributes']=_[_0x2958('0x33')](_0x21b919[_0x2958('0x31')],qs[_0x2958('0x34')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x34')]));_0x5d1dfc[_0x2958('0x35')]=_0x5d1dfc[_0x2958('0x35')][_0x2958('0x36')]?_0x5d1dfc[_0x2958('0x35')]:_0x21b919['model'];if(!_0x36e2a5[_0x2958('0x32')]['hasOwnProperty'](_0x2958('0x37'))){_0x5d1dfc['limit']=qs[_0x2958('0x1c')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x1c')]);_0x5d1dfc[_0x2958('0x1e')]=qs[_0x2958('0x1e')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x1e')]);}_0x5d1dfc[_0x2958('0x38')]=qs[_0x2958('0x39')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x39')]);_0x5d1dfc[_0x2958('0x3a')]=qs[_0x2958('0x3b')](_['pick'](_0x36e2a5[_0x2958('0x32')],_0x21b919[_0x2958('0x3b')]),_0x48650d);if(_0x36e2a5[_0x2958('0x32')][_0x2958('0x3c')]){_0x5d1dfc['where']=_[_0x2958('0x3d')](_0x5d1dfc[_0x2958('0x3a')],{'$or':_[_0x2958('0x2b')](_0x48650d,function(_0x3f7e27){if(_0x3f7e27[_0x2958('0x2f')]!==_0x2958('0x3e')){var _0x1ed89b={};_0x1ed89b[_0x3f7e27[_0x2958('0x28')]]={'$like':'%'+_0x36e2a5[_0x2958('0x32')][_0x2958('0x3c')]+'%'};return _0x1ed89b;}})});}_0x5d1dfc=_[_0x2958('0x3d')]({},_0x5d1dfc,_0x36e2a5[_0x2958('0x3f')]);var _0x319243={'where':_0x5d1dfc['where']};return db[_0x2958('0x2c')][_0x2958('0x1f')](_0x319243)['then'](function(_0x4fe061){_0x5053d0[_0x2958('0x1f')]=_0x4fe061;if(_0x36e2a5[_0x2958('0x32')][_0x2958('0x40')]){_0x5d1dfc[_0x2958('0x41')]=[{'all':!![]}];}return db[_0x2958('0x2c')][_0x2958('0x42')](_0x5d1dfc);})[_0x2958('0x25')](function(_0x13be6d){_0x5053d0[_0x2958('0x43')]=_0x13be6d;return _0x5053d0;})[_0x2958('0x25')](respondWithFilteredResult(_0x153958,_0x5d1dfc))[_0x2958('0x44')](handleError(_0x153958,null));};exports[_0x2958('0x45')]=function(_0xe33c56,_0x5a58ea){var _0x645b66={'raw':![],'where':{'id':_0xe33c56[_0x2958('0x46')]['id']}},_0x112256={};_0x112256[_0x2958('0x31')]=_['keys'](db[_0x2958('0x2c')]['rawAttributes']);_0x112256['query']=_[_0x2958('0x47')](_0xe33c56[_0x2958('0x32')]);_0x112256[_0x2958('0x3b')]=_[_0x2958('0x33')](_0x112256[_0x2958('0x31')],_0x112256[_0x2958('0x32')]);_0x645b66['attributes']=_[_0x2958('0x33')](_0x112256['model'],qs['fields'](_0xe33c56[_0x2958('0x32')]['fields']));_0x645b66[_0x2958('0x35')]=_0x645b66[_0x2958('0x35')][_0x2958('0x36')]?_0x645b66[_0x2958('0x35')]:_0x112256[_0x2958('0x31')];if(_0xe33c56[_0x2958('0x32')][_0x2958('0x40')]){_0x645b66[_0x2958('0x41')]=[{'all':!![]}];}_0x645b66=_['merge']({},_0x645b66,_0xe33c56[_0x2958('0x3f')]);return db[_0x2958('0x2c')][_0x2958('0x48')](_0x645b66)[_0x2958('0x25')](handleEntityNotFound(_0x5a58ea,null))['then'](respondWithResult(_0x5a58ea,null))[_0x2958('0x44')](handleError(_0x5a58ea,null));};exports[_0x2958('0x49')]=function(_0x4a51b1,_0x1b6829){return db[_0x2958('0x2c')][_0x2958('0x49')](_0x4a51b1[_0x2958('0x4a')],{})[_0x2958('0x25')](respondWithResult(_0x1b6829,0xc9))[_0x2958('0x44')](handleError(_0x1b6829,null));};exports['update']=function(_0x1fff2a,_0x38b551){if(_0x1fff2a[_0x2958('0x4a')]['id']){delete _0x1fff2a[_0x2958('0x4a')]['id'];}return db[_0x2958('0x2c')][_0x2958('0x48')]({'where':{'id':_0x1fff2a[_0x2958('0x46')]['id']}})[_0x2958('0x25')](handleEntityNotFound(_0x38b551,null))[_0x2958('0x25')](saveUpdates(_0x1fff2a[_0x2958('0x4a')],null))[_0x2958('0x25')](respondWithResult(_0x38b551,null))[_0x2958('0x44')](handleError(_0x38b551,null));};exports[_0x2958('0x26')]=function(_0x3f7bc1,_0x1bb780){return db[_0x2958('0x2c')][_0x2958('0x48')]({'where':{'id':_0x3f7bc1['params']['id']}})[_0x2958('0x25')](handleEntityNotFound(_0x1bb780,null))['then'](removeEntity(_0x1bb780,null))[_0x2958('0x44')](handleError(_0x1bb780,null));}; \ No newline at end of file +var _0x2a07=['name','send','index','map','Integration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','catch','show','params','fields','includeAll','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','error'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x2a07,0x74));var _0x72a0=function(_0xc67563,_0x5d40fb){_0xc67563=_0xc67563-0x0;var _0x420434=_0x2a07[_0xc67563];return _0x420434;};'use strict';var emlformat=require(_0x72a0('0x0'));var rimraf=require(_0x72a0('0x1'));var zipdir=require(_0x72a0('0x2'));var jsonpatch=require(_0x72a0('0x3'));var rp=require(_0x72a0('0x4'));var moment=require('moment');var BPromise=require(_0x72a0('0x5'));var Mustache=require(_0x72a0('0x6'));var util=require(_0x72a0('0x7'));var path=require(_0x72a0('0x8'));var sox=require(_0x72a0('0x9'));var csv=require(_0x72a0('0xa'));var ejs=require(_0x72a0('0xb'));var fs=require('fs');var fs_extra=require(_0x72a0('0xc'));var _=require(_0x72a0('0xd'));var squel=require(_0x72a0('0xe'));var crypto=require(_0x72a0('0xf'));var jsforce=require(_0x72a0('0x10'));var deskjs=require(_0x72a0('0x11'));var toCsv=require(_0x72a0('0xa'));var querystring=require(_0x72a0('0x12'));var Papa=require(_0x72a0('0x13'));var Redis=require('ioredis');var authService=require(_0x72a0('0x14'));var qs=require(_0x72a0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72a0('0x16'));var logger=require(_0x72a0('0x17'))(_0x72a0('0x18'));var utils=require(_0x72a0('0x19'));var config=require(_0x72a0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x72a0('0x1b'))['db'];function respondWithStatusCode(_0x335b9f,_0x123ca4){_0x123ca4=_0x123ca4||0xcc;return function(_0xf91a82){if(_0xf91a82){return _0x335b9f[_0x72a0('0x1c')](_0x123ca4);}return _0x335b9f[_0x72a0('0x1d')](_0x123ca4)[_0x72a0('0x1e')]();};}function respondWithResult(_0x5e0b5f,_0x4930c5){_0x4930c5=_0x4930c5||0xc8;return function(_0xe103dc){if(_0xe103dc){return _0x5e0b5f[_0x72a0('0x1d')](_0x4930c5)[_0x72a0('0x1f')](_0xe103dc);}};}function respondWithFilteredResult(_0x1d1133,_0x23b001){return function(_0x3f3d62){if(_0x3f3d62){var _0x4ab55e=typeof _0x23b001[_0x72a0('0x20')]===_0x72a0('0x21')&&typeof _0x23b001[_0x72a0('0x22')]===_0x72a0('0x21');var _0x2d1e95=_0x3f3d62['count'];var _0x100d8f=_0x4ab55e?0x0:_0x23b001[_0x72a0('0x20')];var _0x131b73=_0x4ab55e?_0x3f3d62['count']:_0x23b001[_0x72a0('0x20')]+_0x23b001[_0x72a0('0x22')];var _0x30899b;if(_0x131b73>=_0x2d1e95){_0x131b73=_0x2d1e95;_0x30899b=0xc8;}else{_0x30899b=0xce;}_0x1d1133[_0x72a0('0x1d')](_0x30899b);return _0x1d1133['set'](_0x72a0('0x23'),_0x100d8f+'-'+_0x131b73+'/'+_0x2d1e95)['json'](_0x3f3d62);}return null;};}function patchUpdates(_0x3d0607){return function(_0x315413){try{jsonpatch[_0x72a0('0x24')](_0x315413,_0x3d0607,!![]);}catch(_0x5c7479){return BPromise[_0x72a0('0x25')](_0x5c7479);}return _0x315413[_0x72a0('0x26')]();};}function saveUpdates(_0x1d22d8,_0x3d1965){return function(_0x5d6145){if(_0x5d6145){return _0x5d6145[_0x72a0('0x27')](_0x1d22d8)[_0x72a0('0x28')](function(_0x1ddd54){return _0x1ddd54;});}return null;};}function removeEntity(_0x23b918,_0x3022b0){return function(_0x174b1b){if(_0x174b1b){return _0x174b1b['destroy']()['then'](function(){_0x23b918[_0x72a0('0x1d')](0xcc)[_0x72a0('0x1e')]();});}};}function handleEntityNotFound(_0x123df4,_0x1504ed){return function(_0xf5cb49){if(!_0xf5cb49){_0x123df4[_0x72a0('0x1c')](0x194);}return _0xf5cb49;};}function handleError(_0xa5bda0,_0x15922a){_0x15922a=_0x15922a||0x1f4;return function(_0xee99e2){logger[_0x72a0('0x29')](_0xee99e2['stack']);if(_0xee99e2[_0x72a0('0x2a')]){delete _0xee99e2[_0x72a0('0x2a')];}_0xa5bda0[_0x72a0('0x1d')](_0x15922a)[_0x72a0('0x2b')](_0xee99e2);};}exports[_0x72a0('0x2c')]=function(_0x177a3a,_0x432179){var _0x12eda2={},_0x23c96a={},_0x916733={'count':0x0,'rows':[]};var _0x4ba037=_[_0x72a0('0x2d')](db[_0x72a0('0x2e')][_0x72a0('0x2f')],function(_0xfbe9b3){return{'name':_0xfbe9b3[_0x72a0('0x30')],'type':_0xfbe9b3[_0x72a0('0x31')][_0x72a0('0x32')]};});_0x23c96a['model']=_[_0x72a0('0x2d')](_0x4ba037,_0x72a0('0x2a'));_0x23c96a[_0x72a0('0x33')]=_[_0x72a0('0x34')](_0x177a3a[_0x72a0('0x33')]);_0x23c96a[_0x72a0('0x35')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],_0x23c96a['query']);_0x12eda2[_0x72a0('0x38')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],qs['fields'](_0x177a3a[_0x72a0('0x33')]['fields']));_0x12eda2[_0x72a0('0x38')]=_0x12eda2[_0x72a0('0x38')][_0x72a0('0x39')]?_0x12eda2[_0x72a0('0x38')]:_0x23c96a[_0x72a0('0x37')];if(!_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3a')](_0x72a0('0x3b'))){_0x12eda2[_0x72a0('0x22')]=qs[_0x72a0('0x22')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x22')]);_0x12eda2['offset']=qs[_0x72a0('0x20')](_0x177a3a['query'][_0x72a0('0x20')]);}_0x12eda2[_0x72a0('0x3c')]=qs[_0x72a0('0x3d')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3d')]);_0x12eda2[_0x72a0('0x3e')]=qs[_0x72a0('0x35')](_[_0x72a0('0x3f')](_0x177a3a[_0x72a0('0x33')],_0x23c96a['filters']),_0x4ba037);if(_0x177a3a['query'][_0x72a0('0x40')]){_0x12eda2[_0x72a0('0x3e')]=_[_0x72a0('0x41')](_0x12eda2[_0x72a0('0x3e')],{'$or':_[_0x72a0('0x2d')](_0x4ba037,function(_0x512a06){if(_0x512a06[_0x72a0('0x31')]!==_0x72a0('0x42')){var _0x582c90={};_0x582c90[_0x512a06[_0x72a0('0x2a')]]={'$like':'%'+_0x177a3a['query']['filter']+'%'};return _0x582c90;}})});}_0x12eda2=_['merge']({},_0x12eda2,_0x177a3a[_0x72a0('0x43')]);var _0x49633b={'where':_0x12eda2[_0x72a0('0x3e')]};return db[_0x72a0('0x2e')][_0x72a0('0x44')](_0x49633b)[_0x72a0('0x28')](function(_0x4bf56e){_0x916733['count']=_0x4bf56e;if(_0x177a3a['query']['includeAll']){_0x12eda2[_0x72a0('0x45')]=[{'all':!![]}];}return db[_0x72a0('0x2e')]['findAll'](_0x12eda2);})[_0x72a0('0x28')](function(_0x35d790){_0x916733['rows']=_0x35d790;return _0x916733;})[_0x72a0('0x28')](respondWithFilteredResult(_0x432179,_0x12eda2))[_0x72a0('0x46')](handleError(_0x432179,null));};exports[_0x72a0('0x47')]=function(_0xe4abe1,_0x340153){var _0x341451={'raw':![],'where':{'id':_0xe4abe1[_0x72a0('0x48')]['id']}},_0x50eb7f={};_0x50eb7f['model']=_[_0x72a0('0x34')](db['Integration'][_0x72a0('0x2f')]);_0x50eb7f[_0x72a0('0x33')]=_['keys'](_0xe4abe1[_0x72a0('0x33')]);_0x50eb7f['filters']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],_0x50eb7f[_0x72a0('0x33')]);_0x341451['attributes']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],qs[_0x72a0('0x49')](_0xe4abe1['query']['fields']));_0x341451[_0x72a0('0x38')]=_0x341451['attributes'][_0x72a0('0x39')]?_0x341451[_0x72a0('0x38')]:_0x50eb7f[_0x72a0('0x37')];if(_0xe4abe1[_0x72a0('0x33')][_0x72a0('0x4a')]){_0x341451[_0x72a0('0x45')]=[{'all':!![]}];}_0x341451=_[_0x72a0('0x41')]({},_0x341451,_0xe4abe1[_0x72a0('0x43')]);return db[_0x72a0('0x2e')]['find'](_0x341451)[_0x72a0('0x28')](handleEntityNotFound(_0x340153,null))[_0x72a0('0x28')](respondWithResult(_0x340153,null))[_0x72a0('0x46')](handleError(_0x340153,null));};exports[_0x72a0('0x4b')]=function(_0x3a669d,_0x304400){return db[_0x72a0('0x2e')]['create'](_0x3a669d['body'],{})[_0x72a0('0x28')](respondWithResult(_0x304400,0xc9))[_0x72a0('0x46')](handleError(_0x304400,null));};exports[_0x72a0('0x27')]=function(_0x3cab6a,_0x35a6ad){if(_0x3cab6a[_0x72a0('0x4c')]['id']){delete _0x3cab6a[_0x72a0('0x4c')]['id'];}return db[_0x72a0('0x2e')][_0x72a0('0x4d')]({'where':{'id':_0x3cab6a[_0x72a0('0x48')]['id']}})['then'](handleEntityNotFound(_0x35a6ad,null))[_0x72a0('0x28')](saveUpdates(_0x3cab6a[_0x72a0('0x4c')],null))[_0x72a0('0x28')](respondWithResult(_0x35a6ad,null))[_0x72a0('0x46')](handleError(_0x35a6ad,null));};exports[_0x72a0('0x4e')]=function(_0x5c1570,_0x143410){return db['Integration']['find']({'where':{'id':_0x5c1570[_0x72a0('0x48')]['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x143410,null))[_0x72a0('0x28')](removeEntity(_0x143410,null))[_0x72a0('0x46')](handleError(_0x143410,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 838a84c..1130d04 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 _0x87b5=['./integration.attributes','exports','Integration','integrations','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x8c68b4,_0x4e32b7){var _0x22c99f=function(_0xc6aefe){while(--_0xc6aefe){_0x8c68b4['push'](_0x8c68b4['shift']());}};_0x22c99f(++_0x4e32b7);}(_0x87b5,0x67));var _0x587b=function(_0x527122,_0x596ead){_0x527122=_0x527122-0x0;var _0x4ab2d4=_0x87b5[_0x527122];return _0x4ab2d4;};'use strict';var _=require('lodash');var util=require(_0x587b('0x0'));var logger=require(_0x587b('0x1'))(_0x587b('0x2'));var moment=require(_0x587b('0x3'));var BPromise=require(_0x587b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x587b('0x5'));var rimraf=require(_0x587b('0x6'));var config=require('../../config/environment');var attributes=require(_0x587b('0x7'));module[_0x587b('0x8')]=function(_0x421909,_0x1cb516){return _0x421909['define'](_0x587b('0x9'),attributes,{'tableName':_0x587b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6fee=['define','Integration','moment','bluebird','request-promise','rimraf','../../config/environment','./integration.attributes'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x6fee,0xea));var _0xe6fe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6fee[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe6fe('0x0'));var BPromise=require(_0xe6fe('0x1'));var rp=require(_0xe6fe('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe6fe('0x3'));var config=require(_0xe6fe('0x4'));var attributes=require(_0xe6fe('0x5'));module['exports']=function(_0x446c78,_0xe41521){return _0x446c78[_0xe6fe('0x6')](_0xe6fe('0x7'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 708d543..5e5247a 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 _0x7880=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x27e336,_0x1ac35d){var _0xdb7dac=function(_0x3481ab){while(--_0x3481ab){_0x27e336['push'](_0x27e336['shift']());}};_0xdb7dac(++_0x1ac35d);}(_0x7880,0x1f4));var _0x0788=function(_0x5333ba,_0x22e1bb){_0x5333ba=_0x5333ba-0x0;var _0x20f9dc=_0x7880[_0x5333ba];return _0x20f9dc;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var moment=require(_0x0788('0x1'));var BPromise=require(_0x0788('0x2'));var rs=require(_0x0788('0x3'));var fs=require('fs');var Redis=require(_0x0788('0x4'));var db=require(_0x0788('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0788('0x6'))(_0x0788('0x7'));var config=require(_0x0788('0x8'));var jayson=require(_0x0788('0x9'));var client=jayson[_0x0788('0xa')][_0x0788('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f9cb8,_0x44bbb5,_0x3c29f3){return new BPromise(function(_0x422f8b,_0x55e48a){return client[_0x0788('0xc')](_0x3f9cb8,_0x3c29f3)['then'](function(_0xabaf81){logger['info'](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));logger[_0x0788('0xf')](_0x0788('0x10'),_0x44bbb5,_0x0788('0xe'),JSON['stringify'](_0xabaf81));if(_0xabaf81[_0x0788('0x11')]){if(_0xabaf81[_0x0788('0x11')][_0x0788('0x12')]===0x1f4){logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')][_0x0788('0x13')]);return _0x55e48a(_0xabaf81['error'][_0x0788('0x13')]);}logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')]['message']);return _0x422f8b(_0xabaf81[_0x0788('0x11')]['message']);}else{logger[_0x0788('0x14')](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));_0x422f8b(_0xabaf81[_0x0788('0x15')][_0x0788('0x13')]);}})[_0x0788('0x16')](function(_0x5e1a29){logger['error'](_0x0788('0xd'),_0x44bbb5,_0x5e1a29);_0x55e48a(_0x5e1a29);});});} \ No newline at end of file +var _0x4137=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','Integration,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0xd050c6,_0x58ffb4){var _0x7278a=function(_0x16d03e){while(--_0x16d03e){_0xd050c6['push'](_0xd050c6['shift']());}};_0x7278a(++_0x58ffb4);}(_0x4137,0xf8));var _0x7413=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x4137[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('Integration,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 2b99830..2bd3820 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 _0x955f=['post','create','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x44558a,_0x3404d5){var _0xe5cef4=function(_0x3e50a4){while(--_0x3e50a4){_0x44558a['push'](_0x44558a['shift']());}};_0xe5cef4(++_0x3404d5);}(_0x955f,0x1eb));var _0xf955=function(_0x20d022,_0x18d565){_0x20d022=_0x20d022-0x0;var _0x32552b=_0x955f[_0x20d022];return _0x32552b;};'use strict';var multer=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var path=require(_0xf955('0x2'));var timeout=require(_0xf955('0x3'));var express=require(_0xf955('0x4'));var router=express['Router']();var fs_extra=require(_0xf955('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf955('0x6'));var controller=require('./integrationReport.controller');router[_0xf955('0x7')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0x9')]);router['get'](_0xf955('0xa'),auth[_0xf955('0x8')](),controller['describe']);router[_0xf955('0x7')](_0xf955('0xb'),auth[_0xf955('0x8')](),controller[_0xf955('0xc')]);router[_0xf955('0xd')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0xe')]);router['put'](_0xf955('0xb'),auth['isAuthenticated'](),controller[_0xf955('0xf')]);router[_0xf955('0x10')](_0xf955('0xb'),auth['isAuthenticated'](),controller[_0xf955('0x11')]);module['exports']=router; \ No newline at end of file +var _0xba34=['exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete'];(function(_0x229488,_0x14b81a){var _0x5b2d0a=function(_0x3a93c7){while(--_0x3a93c7){_0x229488['push'](_0x229488['shift']());}};_0x5b2d0a(++_0x14b81a);}(_0xba34,0x119));var _0x4ba3=function(_0x4ec54a,_0x13521b){_0x4ec54a=_0x4ec54a-0x0;var _0x34bf9d=_0xba34[_0x4ec54a];return _0x34bf9d;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var controller=require(_0x4ba3('0x7'));router[_0x4ba3('0x8')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xa')]);router[_0x4ba3('0x8')]('/describe',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0x8')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0xe')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x10')](_0x4ba3('0xc'),auth['isAuthenticated'](),controller[_0x4ba3('0x11')]);router[_0x4ba3('0x12')]('/:id',auth[_0x4ba3('0x9')](),controller['destroy']);module[_0x4ba3('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 7464bbf..a600171 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 _0x74f9=['STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','exports'];(function(_0x33c49c,_0x51219a){var _0x3dceeb=function(_0x455219){while(--_0x455219){_0x33c49c['push'](_0x33c49c['shift']());}};_0x3dceeb(++_0x51219a);}(_0x74f9,0x11e));var _0x974f=function(_0x48d56a,_0x2e9164){_0x48d56a=_0x48d56a-0x0;var _0x271fe3=_0x74f9[_0x48d56a];return _0x271fe3;};'use strict';var Sequelize=require(_0x974f('0x0'));module[_0x974f('0x1')]={'integration':{'type':Sequelize[_0x974f('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x974f('0x2')]},'ticketId':{'type':Sequelize[_0x974f('0x2')]},'integrationId':{'type':Sequelize[_0x974f('0x3')]},'contacts':{'type':Sequelize[_0x974f('0x2')]},'uniqueid':{'type':Sequelize[_0x974f('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x974f('0x2')]},'queue':{'type':Sequelize[_0x974f('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x974f('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x974f('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x974f('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x974f('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x974f('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x974f('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x974f('0x4')]},'lastevent':{'type':Sequelize[_0x974f('0x2')]},'channel':{'type':Sequelize[_0x974f('0x2')]},'channelstate':{'type':Sequelize[_0x974f('0x3')]},'channelstatedesc':{'type':Sequelize[_0x974f('0x2')]},'connectedlinenum':{'type':Sequelize[_0x974f('0x2')]},'connectedlinename':{'type':Sequelize[_0x974f('0x2')]},'language':{'type':Sequelize[_0x974f('0x2')]},'accountcode':{'type':Sequelize[_0x974f('0x2')]},'context':{'type':Sequelize[_0x974f('0x2')]},'exten':{'type':Sequelize[_0x974f('0x2')]},'priority':{'type':Sequelize[_0x974f('0x2')]},'destchannel':{'type':Sequelize[_0x974f('0x2')]},'destchannelstate':{'type':Sequelize[_0x974f('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x974f('0x2')]},'destcalleridnum':{'type':Sequelize[_0x974f('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x974f('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x974f('0x2')]},'destlanguage':{'type':Sequelize[_0x974f('0x2')]},'destaccountcode':{'type':Sequelize[_0x974f('0x2')]},'destcontext':{'type':Sequelize[_0x974f('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x974f('0x2')]},'messageId':{'type':Sequelize[_0x974f('0x2')]},'inReplyTo':{'type':Sequelize[_0x974f('0x2')]},'subject':{'type':Sequelize[_0x974f('0x2')]},'from':{'type':Sequelize[_0x974f('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x974f('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x974f('0x6')]},'status':{'type':Sequelize[_0x974f('0x7')](_0x974f('0x8'),_0x974f('0x9'),_0x974f('0xa'),_0x974f('0xb'))},'url':{'type':Sequelize[_0x974f('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x974f('0x2')]},'projectId':{'type':Sequelize[_0x974f('0x3')]}}; \ No newline at end of file +var _0xf4a4=['FAILED','sequelize','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xf4a4,0x1b1));var _0x4f4a=function(_0x2ae33f,_0x4f8fc9){_0x2ae33f=_0x2ae33f-0x0;var _0x220bb3=_0xf4a4[_0x2ae33f];return _0x220bb3;};'use strict';var Sequelize=require(_0x4f4a('0x0'));module['exports']={'integration':{'type':Sequelize[_0x4f4a('0x1')]},'eventChannel':{'type':Sequelize[_0x4f4a('0x1')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x4f4a('0x1')]},'integrationId':{'type':Sequelize[_0x4f4a('0x2')]},'contacts':{'type':Sequelize[_0x4f4a('0x1')]},'uniqueid':{'type':Sequelize[_0x4f4a('0x1')]},'calleridnum':{'type':Sequelize[_0x4f4a('0x1')]},'calleridname':{'type':Sequelize[_0x4f4a('0x1')]},'queue':{'type':Sequelize[_0x4f4a('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x4f4a('0x3')]},'agentconnectAt':{'type':Sequelize[_0x4f4a('0x3')]},'holdtime':{'type':Sequelize[_0x4f4a('0x2')]},'agentcomplete':{'type':Sequelize[_0x4f4a('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x4f4a('0x3')]},'talktime':{'type':Sequelize[_0x4f4a('0x2')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4f4a('0x2')]},'reason':{'type':Sequelize[_0x4f4a('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x4f4a('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x4f4a('0x3')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x4f4a('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x4f4a('0x2')]},'channelstatedesc':{'type':Sequelize[_0x4f4a('0x1')]},'connectedlinenum':{'type':Sequelize[_0x4f4a('0x1')]},'connectedlinename':{'type':Sequelize[_0x4f4a('0x1')]},'language':{'type':Sequelize[_0x4f4a('0x1')]},'accountcode':{'type':Sequelize[_0x4f4a('0x1')]},'context':{'type':Sequelize[_0x4f4a('0x1')]},'exten':{'type':Sequelize[_0x4f4a('0x1')]},'priority':{'type':Sequelize[_0x4f4a('0x1')]},'destchannel':{'type':Sequelize[_0x4f4a('0x1')]},'destchannelstate':{'type':Sequelize[_0x4f4a('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x4f4a('0x1')]},'destcalleridnum':{'type':Sequelize[_0x4f4a('0x1')]},'destcalleridname':{'type':Sequelize[_0x4f4a('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x4f4a('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x4f4a('0x1')]},'destcontext':{'type':Sequelize[_0x4f4a('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x4f4a('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x4f4a('0x1')]},'inReplyTo':{'type':Sequelize[_0x4f4a('0x1')]},'subject':{'type':Sequelize[_0x4f4a('0x1')]},'from':{'type':Sequelize[_0x4f4a('0x1')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x4f4a('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x4f4a('0x5')]},'status':{'type':Sequelize[_0x4f4a('0x6')](_0x4f4a('0x7'),'SENDING','RECEIVED',_0x4f4a('0x8'))},'url':{'type':Sequelize[_0x4f4a('0x1')]},'app':{'type':Sequelize[_0x4f4a('0x1')]},'appdata':{'type':Sequelize[_0x4f4a('0x1')]},'projectId':{'type':Sequelize[_0x4f4a('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 4fad255..e1ad6db 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 _0x590f=['nolimit','sort','where','pick','merge','options','includeAll','findAll','rows','catch','show','keys','IntegrationReport','rawAttributes','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','error','stack','name','send','index','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x5a08f9,_0x2633c4){var _0x49dc98=function(_0x353c30){while(--_0x353c30){_0x5a08f9['push'](_0x5a08f9['shift']());}};_0x49dc98(++_0x2633c4);}(_0x590f,0x133));var _0xf590=function(_0x496464,_0x523e05){_0x496464=_0x496464-0x0;var _0x2f86f4=_0x590f[_0x496464];return _0x2f86f4;};'use strict';var emlformat=require(_0xf590('0x0'));var rimraf=require(_0xf590('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf590('0x2'));var rp=require(_0xf590('0x3'));var moment=require(_0xf590('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf590('0x5'));var util=require(_0xf590('0x6'));var path=require('path');var sox=require(_0xf590('0x7'));var csv=require('to-csv');var ejs=require(_0xf590('0x8'));var fs=require('fs');var fs_extra=require(_0xf590('0x9'));var _=require(_0xf590('0xa'));var squel=require(_0xf590('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf590('0xc'));var Papa=require('papaparse');var Redis=require(_0xf590('0xd'));var authService=require(_0xf590('0xe'));var qs=require(_0xf590('0xf'));var as=require(_0xf590('0x10'));var hardwareService=require(_0xf590('0x11'));var logger=require(_0xf590('0x12'))('api');var utils=require(_0xf590('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xf590('0x14'));var db=require(_0xf590('0x15'))['db'];function respondWithStatusCode(_0x315c64,_0xca83d5){_0xca83d5=_0xca83d5||0xcc;return function(_0x474ff9){if(_0x474ff9){return _0x315c64[_0xf590('0x16')](_0xca83d5);}return _0x315c64[_0xf590('0x17')](_0xca83d5)[_0xf590('0x18')]();};}function respondWithResult(_0x4cdaf1,_0x2b5e24){_0x2b5e24=_0x2b5e24||0xc8;return function(_0xb7c4f){if(_0xb7c4f){return _0x4cdaf1[_0xf590('0x17')](_0x2b5e24)[_0xf590('0x19')](_0xb7c4f);}};}function respondWithFilteredResult(_0x92fc02,_0x150d6f){return function(_0x2267aa){if(_0x2267aa){var _0x5f063e=typeof _0x150d6f[_0xf590('0x1a')]===_0xf590('0x1b')&&typeof _0x150d6f['limit']===_0xf590('0x1b');var _0x3d7892=_0x2267aa[_0xf590('0x1c')];var _0x53f57e=_0x5f063e?0x0:_0x150d6f['offset'];var _0x47ed0e=_0x5f063e?_0x2267aa[_0xf590('0x1c')]:_0x150d6f[_0xf590('0x1a')]+_0x150d6f[_0xf590('0x1d')];var _0x27eb08;if(_0x47ed0e>=_0x3d7892){_0x47ed0e=_0x3d7892;_0x27eb08=0xc8;}else{_0x27eb08=0xce;}_0x92fc02[_0xf590('0x17')](_0x27eb08);return _0x92fc02[_0xf590('0x1e')](_0xf590('0x1f'),_0x53f57e+'-'+_0x47ed0e+'/'+_0x3d7892)[_0xf590('0x19')](_0x2267aa);}return null;};}function patchUpdates(_0x45f9f6){return function(_0xfa1103){try{jsonpatch[_0xf590('0x20')](_0xfa1103,_0x45f9f6,!![]);}catch(_0xedce07){return BPromise['reject'](_0xedce07);}return _0xfa1103[_0xf590('0x21')]();};}function saveUpdates(_0xb0745,_0x1a0a3e){return function(_0xa4f699){if(_0xa4f699){return _0xa4f699[_0xf590('0x22')](_0xb0745)['then'](function(_0x29e1b7){return _0x29e1b7;});}return null;};}function removeEntity(_0x48b9d3,_0x585993){return function(_0xf1c511){if(_0xf1c511){return _0xf1c511['destroy']()[_0xf590('0x23')](function(){_0x48b9d3['status'](0xcc)[_0xf590('0x18')]();});}};}function handleEntityNotFound(_0x1caebc,_0x1b3398){return function(_0x4dfce6){if(!_0x4dfce6){_0x1caebc[_0xf590('0x16')](0x194);}return _0x4dfce6;};}function handleError(_0x35c325,_0x3a7009){_0x3a7009=_0x3a7009||0x1f4;return function(_0x2bfb84){logger[_0xf590('0x24')](_0x2bfb84[_0xf590('0x25')]);if(_0x2bfb84[_0xf590('0x26')]){delete _0x2bfb84[_0xf590('0x26')];}_0x35c325[_0xf590('0x17')](_0x3a7009)[_0xf590('0x27')](_0x2bfb84);};}exports[_0xf590('0x28')]=function(_0x4123b1,_0x5a7e0d){var _0x317070={},_0x128830={},_0x459304={'count':0x0,'rows':[]};var _0x4dd2e9=_['map'](db['IntegrationReport']['rawAttributes'],function(_0x2f622c){return{'name':_0x2f622c[_0xf590('0x29')],'type':_0x2f622c[_0xf590('0x2a')][_0xf590('0x2b')]};});_0x128830[_0xf590('0x2c')]=_[_0xf590('0x2d')](_0x4dd2e9,_0xf590('0x26'));_0x128830[_0xf590('0x2e')]=_['keys'](_0x4123b1[_0xf590('0x2e')]);_0x128830[_0xf590('0x2f')]=_[_0xf590('0x30')](_0x128830[_0xf590('0x2c')],_0x128830[_0xf590('0x2e')]);_0x317070[_0xf590('0x31')]=_[_0xf590('0x30')](_0x128830[_0xf590('0x2c')],qs['fields'](_0x4123b1[_0xf590('0x2e')][_0xf590('0x32')]));_0x317070['attributes']=_0x317070[_0xf590('0x31')][_0xf590('0x33')]?_0x317070[_0xf590('0x31')]:_0x128830['model'];if(!_0x4123b1[_0xf590('0x2e')][_0xf590('0x34')](_0xf590('0x35'))){_0x317070[_0xf590('0x1d')]=qs[_0xf590('0x1d')](_0x4123b1[_0xf590('0x2e')]['limit']);_0x317070[_0xf590('0x1a')]=qs[_0xf590('0x1a')](_0x4123b1[_0xf590('0x2e')][_0xf590('0x1a')]);}_0x317070['order']=qs[_0xf590('0x36')](_0x4123b1[_0xf590('0x2e')][_0xf590('0x36')]);_0x317070[_0xf590('0x37')]=qs[_0xf590('0x2f')](_[_0xf590('0x38')](_0x4123b1[_0xf590('0x2e')],_0x128830['filters']),_0x4dd2e9);if(_0x4123b1[_0xf590('0x2e')]['filter']){_0x317070['where']=_[_0xf590('0x39')](_0x317070[_0xf590('0x37')],{'$or':_['map'](_0x4dd2e9,function(_0x8213b5){if(_0x8213b5[_0xf590('0x2a')]!=='VIRTUAL'){var _0x263c47={};_0x263c47[_0x8213b5[_0xf590('0x26')]]={'$like':'%'+_0x4123b1[_0xf590('0x2e')]['filter']+'%'};return _0x263c47;}})});}_0x317070=_['merge']({},_0x317070,_0x4123b1[_0xf590('0x3a')]);var _0x3464d5={'where':_0x317070[_0xf590('0x37')]};return db['IntegrationReport'][_0xf590('0x1c')](_0x3464d5)[_0xf590('0x23')](function(_0x5847d5){_0x459304[_0xf590('0x1c')]=_0x5847d5;if(_0x4123b1[_0xf590('0x2e')][_0xf590('0x3b')]){_0x317070['include']=[{'all':!![]}];}return db['IntegrationReport'][_0xf590('0x3c')](_0x317070);})[_0xf590('0x23')](function(_0x1be844){_0x459304[_0xf590('0x3d')]=_0x1be844;return _0x459304;})[_0xf590('0x23')](respondWithFilteredResult(_0x5a7e0d,_0x317070))[_0xf590('0x3e')](handleError(_0x5a7e0d,null));};exports[_0xf590('0x3f')]=function(_0x32557b,_0x4ed71a){var _0x4cf842={'raw':![],'where':{'id':_0x32557b['params']['id']}},_0x4d69b7={};_0x4d69b7[_0xf590('0x2c')]=_[_0xf590('0x40')](db[_0xf590('0x41')][_0xf590('0x42')]);_0x4d69b7[_0xf590('0x2e')]=_[_0xf590('0x40')](_0x32557b[_0xf590('0x2e')]);_0x4d69b7['filters']=_[_0xf590('0x30')](_0x4d69b7[_0xf590('0x2c')],_0x4d69b7[_0xf590('0x2e')]);_0x4cf842[_0xf590('0x31')]=_[_0xf590('0x30')](_0x4d69b7[_0xf590('0x2c')],qs[_0xf590('0x32')](_0x32557b[_0xf590('0x2e')][_0xf590('0x32')]));_0x4cf842[_0xf590('0x31')]=_0x4cf842['attributes'][_0xf590('0x33')]?_0x4cf842['attributes']:_0x4d69b7[_0xf590('0x2c')];if(_0x32557b['query'][_0xf590('0x3b')]){_0x4cf842['include']=[{'all':!![]}];}_0x4cf842=_[_0xf590('0x39')]({},_0x4cf842,_0x32557b[_0xf590('0x3a')]);return db[_0xf590('0x41')][_0xf590('0x43')](_0x4cf842)[_0xf590('0x23')](handleEntityNotFound(_0x4ed71a,null))[_0xf590('0x23')](respondWithResult(_0x4ed71a,null))['catch'](handleError(_0x4ed71a,null));};exports[_0xf590('0x44')]=function(_0x143ee7,_0x4914b8){return db[_0xf590('0x41')][_0xf590('0x44')](_0x143ee7['body'],{})[_0xf590('0x23')](respondWithResult(_0x4914b8,0xc9))[_0xf590('0x3e')](handleError(_0x4914b8,null));};exports[_0xf590('0x22')]=function(_0x2cabed,_0x3a2ac2){if(_0x2cabed[_0xf590('0x45')]['id']){delete _0x2cabed['body']['id'];}return db[_0xf590('0x41')][_0xf590('0x43')]({'where':{'id':_0x2cabed[_0xf590('0x46')]['id']}})[_0xf590('0x23')](handleEntityNotFound(_0x3a2ac2,null))[_0xf590('0x23')](saveUpdates(_0x2cabed[_0xf590('0x45')],null))[_0xf590('0x23')](respondWithResult(_0x3a2ac2,null))[_0xf590('0x3e')](handleError(_0x3a2ac2,null));};exports['destroy']=function(_0x4681c5,_0x565633){return db[_0xf590('0x41')][_0xf590('0x43')]({'where':{'id':_0x4681c5[_0xf590('0x46')]['id']}})[_0xf590('0x23')](handleEntityNotFound(_0x565633,null))[_0xf590('0x23')](removeEntity(_0x565633,null))['catch'](handleError(_0x565633,null));};exports[_0xf590('0x47')]=function(_0x53563e,_0x4a3460){return db[_0xf590('0x41')][_0xf590('0x47')]()['then'](respondWithResult(_0x4a3460,null))['catch'](handleError(_0x4a3460,null));}; \ No newline at end of file +var _0xd8a1=['fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','length','create','body','find','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','error','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd8a1,0x1e2));var _0x1d8a=function(_0xf48a23,_0x1618f8){_0xf48a23=_0xf48a23-0x0;var _0x5a3ff6=_0xd8a1[_0xf48a23];return _0x5a3ff6;};'use strict';var emlformat=require(_0x1d8a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1d8a('0x1'));var jsonpatch=require(_0x1d8a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1d8a('0x3'));var Mustache=require('mustache');var util=require(_0x1d8a('0x4'));var path=require(_0x1d8a('0x5'));var sox=require(_0x1d8a('0x6'));var csv=require('to-csv');var ejs=require(_0x1d8a('0x7'));var fs=require('fs');var fs_extra=require(_0x1d8a('0x8'));var _=require(_0x1d8a('0x9'));var squel=require(_0x1d8a('0xa'));var crypto=require(_0x1d8a('0xb'));var jsforce=require(_0x1d8a('0xc'));var deskjs=require(_0x1d8a('0xd'));var toCsv=require(_0x1d8a('0xe'));var querystring=require(_0x1d8a('0xf'));var Papa=require(_0x1d8a('0x10'));var Redis=require('ioredis');var authService=require(_0x1d8a('0x11'));var qs=require(_0x1d8a('0x12'));var as=require(_0x1d8a('0x13'));var hardwareService=require(_0x1d8a('0x14'));var logger=require(_0x1d8a('0x15'))(_0x1d8a('0x16'));var utils=require(_0x1d8a('0x17'));var config=require(_0x1d8a('0x18'));var licenseUtil=require(_0x1d8a('0x19'));var db=require(_0x1d8a('0x1a'))['db'];function respondWithStatusCode(_0x112e6f,_0x395381){_0x395381=_0x395381||0xcc;return function(_0x199904){if(_0x199904){return _0x112e6f[_0x1d8a('0x1b')](_0x395381);}return _0x112e6f[_0x1d8a('0x1c')](_0x395381)[_0x1d8a('0x1d')]();};}function respondWithResult(_0x565979,_0x5570f7){_0x5570f7=_0x5570f7||0xc8;return function(_0x3b4f2f){if(_0x3b4f2f){return _0x565979[_0x1d8a('0x1c')](_0x5570f7)[_0x1d8a('0x1e')](_0x3b4f2f);}};}function respondWithFilteredResult(_0x2f7c6d,_0x491e87){return function(_0x5e1b94){if(_0x5e1b94){var _0x2bd7c5=typeof _0x491e87['offset']===_0x1d8a('0x1f')&&typeof _0x491e87[_0x1d8a('0x20')]==='undefined';var _0x3d29d5=_0x5e1b94[_0x1d8a('0x21')];var _0x16357f=_0x2bd7c5?0x0:_0x491e87[_0x1d8a('0x22')];var _0x432a92=_0x2bd7c5?_0x5e1b94[_0x1d8a('0x21')]:_0x491e87[_0x1d8a('0x22')]+_0x491e87[_0x1d8a('0x20')];var _0x5821df;if(_0x432a92>=_0x3d29d5){_0x432a92=_0x3d29d5;_0x5821df=0xc8;}else{_0x5821df=0xce;}_0x2f7c6d[_0x1d8a('0x1c')](_0x5821df);return _0x2f7c6d[_0x1d8a('0x23')]('Content-Range',_0x16357f+'-'+_0x432a92+'/'+_0x3d29d5)[_0x1d8a('0x1e')](_0x5e1b94);}return null;};}function patchUpdates(_0x3399f0){return function(_0x3f2b6c){try{jsonpatch[_0x1d8a('0x24')](_0x3f2b6c,_0x3399f0,!![]);}catch(_0x43547b){return BPromise[_0x1d8a('0x25')](_0x43547b);}return _0x3f2b6c[_0x1d8a('0x26')]();};}function saveUpdates(_0x2beb66,_0x4f7e88){return function(_0x39d577){if(_0x39d577){return _0x39d577[_0x1d8a('0x27')](_0x2beb66)[_0x1d8a('0x28')](function(_0x4939e8){return _0x4939e8;});}return null;};}function removeEntity(_0x500a38,_0xb18f05){return function(_0x31b038){if(_0x31b038){return _0x31b038[_0x1d8a('0x29')]()[_0x1d8a('0x28')](function(){_0x500a38[_0x1d8a('0x1c')](0xcc)[_0x1d8a('0x1d')]();});}};}function handleEntityNotFound(_0x193941,_0x36460f){return function(_0x1c07a3){if(!_0x1c07a3){_0x193941['sendStatus'](0x194);}return _0x1c07a3;};}function handleError(_0x30df68,_0x24300f){_0x24300f=_0x24300f||0x1f4;return function(_0xcfd92d){logger[_0x1d8a('0x2a')](_0xcfd92d['stack']);if(_0xcfd92d[_0x1d8a('0x2b')]){delete _0xcfd92d[_0x1d8a('0x2b')];}_0x30df68['status'](_0x24300f)[_0x1d8a('0x2c')](_0xcfd92d);};}exports[_0x1d8a('0x2d')]=function(_0x11dae5,_0x10bab8){var _0x206b89={},_0x436317={},_0x42be22={'count':0x0,'rows':[]};var _0x43d17c=_[_0x1d8a('0x2e')](db[_0x1d8a('0x2f')][_0x1d8a('0x30')],function(_0x403d48){return{'name':_0x403d48[_0x1d8a('0x31')],'type':_0x403d48[_0x1d8a('0x32')][_0x1d8a('0x33')]};});_0x436317[_0x1d8a('0x34')]=_[_0x1d8a('0x2e')](_0x43d17c,_0x1d8a('0x2b'));_0x436317[_0x1d8a('0x35')]=_[_0x1d8a('0x36')](_0x11dae5[_0x1d8a('0x35')]);_0x436317[_0x1d8a('0x37')]=_[_0x1d8a('0x38')](_0x436317['model'],_0x436317[_0x1d8a('0x35')]);_0x206b89['attributes']=_[_0x1d8a('0x38')](_0x436317[_0x1d8a('0x34')],qs[_0x1d8a('0x39')](_0x11dae5[_0x1d8a('0x35')]['fields']));_0x206b89[_0x1d8a('0x3a')]=_0x206b89[_0x1d8a('0x3a')]['length']?_0x206b89[_0x1d8a('0x3a')]:_0x436317[_0x1d8a('0x34')];if(!_0x11dae5['query'][_0x1d8a('0x3b')](_0x1d8a('0x3c'))){_0x206b89[_0x1d8a('0x20')]=qs[_0x1d8a('0x20')](_0x11dae5[_0x1d8a('0x35')]['limit']);_0x206b89[_0x1d8a('0x22')]=qs[_0x1d8a('0x22')](_0x11dae5[_0x1d8a('0x35')][_0x1d8a('0x22')]);}_0x206b89['order']=qs['sort'](_0x11dae5[_0x1d8a('0x35')][_0x1d8a('0x3d')]);_0x206b89[_0x1d8a('0x3e')]=qs[_0x1d8a('0x37')](_[_0x1d8a('0x3f')](_0x11dae5[_0x1d8a('0x35')],_0x436317[_0x1d8a('0x37')]),_0x43d17c);if(_0x11dae5[_0x1d8a('0x35')][_0x1d8a('0x40')]){_0x206b89[_0x1d8a('0x3e')]=_[_0x1d8a('0x41')](_0x206b89[_0x1d8a('0x3e')],{'$or':_['map'](_0x43d17c,function(_0x3e2186){if(_0x3e2186['type']!=='VIRTUAL'){var _0x4d9051={};_0x4d9051[_0x3e2186[_0x1d8a('0x2b')]]={'$like':'%'+_0x11dae5[_0x1d8a('0x35')][_0x1d8a('0x40')]+'%'};return _0x4d9051;}})});}_0x206b89=_[_0x1d8a('0x41')]({},_0x206b89,_0x11dae5[_0x1d8a('0x42')]);var _0x50709d={'where':_0x206b89[_0x1d8a('0x3e')]};return db[_0x1d8a('0x2f')][_0x1d8a('0x21')](_0x50709d)[_0x1d8a('0x28')](function(_0x3163b4){_0x42be22[_0x1d8a('0x21')]=_0x3163b4;if(_0x11dae5[_0x1d8a('0x35')][_0x1d8a('0x43')]){_0x206b89[_0x1d8a('0x44')]=[{'all':!![]}];}return db[_0x1d8a('0x2f')][_0x1d8a('0x45')](_0x206b89);})[_0x1d8a('0x28')](function(_0xfc0aef){_0x42be22[_0x1d8a('0x46')]=_0xfc0aef;return _0x42be22;})[_0x1d8a('0x28')](respondWithFilteredResult(_0x10bab8,_0x206b89))[_0x1d8a('0x47')](handleError(_0x10bab8,null));};exports['show']=function(_0x404e89,_0x3d6356){var _0x2a0d2d={'raw':![],'where':{'id':_0x404e89[_0x1d8a('0x48')]['id']}},_0xd7c55d={};_0xd7c55d[_0x1d8a('0x34')]=_[_0x1d8a('0x36')](db[_0x1d8a('0x2f')][_0x1d8a('0x30')]);_0xd7c55d[_0x1d8a('0x35')]=_[_0x1d8a('0x36')](_0x404e89[_0x1d8a('0x35')]);_0xd7c55d[_0x1d8a('0x37')]=_['intersection'](_0xd7c55d[_0x1d8a('0x34')],_0xd7c55d[_0x1d8a('0x35')]);_0x2a0d2d[_0x1d8a('0x3a')]=_[_0x1d8a('0x38')](_0xd7c55d[_0x1d8a('0x34')],qs[_0x1d8a('0x39')](_0x404e89[_0x1d8a('0x35')][_0x1d8a('0x39')]));_0x2a0d2d[_0x1d8a('0x3a')]=_0x2a0d2d[_0x1d8a('0x3a')][_0x1d8a('0x49')]?_0x2a0d2d[_0x1d8a('0x3a')]:_0xd7c55d[_0x1d8a('0x34')];if(_0x404e89[_0x1d8a('0x35')][_0x1d8a('0x43')]){_0x2a0d2d[_0x1d8a('0x44')]=[{'all':!![]}];}_0x2a0d2d=_['merge']({},_0x2a0d2d,_0x404e89[_0x1d8a('0x42')]);return db['IntegrationReport']['find'](_0x2a0d2d)[_0x1d8a('0x28')](handleEntityNotFound(_0x3d6356,null))[_0x1d8a('0x28')](respondWithResult(_0x3d6356,null))['catch'](handleError(_0x3d6356,null));};exports[_0x1d8a('0x4a')]=function(_0x3a75ac,_0x5d3d51){return db[_0x1d8a('0x2f')][_0x1d8a('0x4a')](_0x3a75ac[_0x1d8a('0x4b')],{})[_0x1d8a('0x28')](respondWithResult(_0x5d3d51,0xc9))[_0x1d8a('0x47')](handleError(_0x5d3d51,null));};exports[_0x1d8a('0x27')]=function(_0x5099ed,_0x555b80){if(_0x5099ed[_0x1d8a('0x4b')]['id']){delete _0x5099ed[_0x1d8a('0x4b')]['id'];}return db['IntegrationReport'][_0x1d8a('0x4c')]({'where':{'id':_0x5099ed['params']['id']}})[_0x1d8a('0x28')](handleEntityNotFound(_0x555b80,null))['then'](saveUpdates(_0x5099ed['body'],null))[_0x1d8a('0x28')](respondWithResult(_0x555b80,null))[_0x1d8a('0x47')](handleError(_0x555b80,null));};exports[_0x1d8a('0x29')]=function(_0x412fa8,_0x11c75c){return db['IntegrationReport'][_0x1d8a('0x4c')]({'where':{'id':_0x412fa8[_0x1d8a('0x48')]['id']}})[_0x1d8a('0x28')](handleEntityNotFound(_0x11c75c,null))['then'](removeEntity(_0x11c75c,null))[_0x1d8a('0x47')](handleError(_0x11c75c,null));};exports['describe']=function(_0x30a166,_0x2f664e){return db['IntegrationReport']['describe']()[_0x1d8a('0x28')](respondWithResult(_0x2f664e,null))['catch'](handleError(_0x2f664e,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 9d0869f..1edc4d4 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 _0xb01a=['report_integration','lodash','util','../../config/logger','api','moment','../../config/environment','IntegrationReport'];(function(_0x169a8a,_0x3526b1){var _0x2e8502=function(_0x4c37f3){while(--_0x4c37f3){_0x169a8a['push'](_0x169a8a['shift']());}};_0x2e8502(++_0x3526b1);}(_0xb01a,0x129));var _0xab01=function(_0x16e4c4,_0x1e67a1){_0x16e4c4=_0x16e4c4-0x0;var _0x2896fe=_0xb01a[_0x16e4c4];return _0x2896fe;};'use strict';var _=require(_0xab01('0x0'));var util=require(_0xab01('0x1'));var logger=require(_0xab01('0x2'))(_0xab01('0x3'));var moment=require(_0xab01('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xab01('0x5'));var attributes=require('./integrationReport.attributes');module['exports']=function(_0x318cb7,_0x41cd55){return _0x318cb7['define'](_0xab01('0x6'),attributes,{'tableName':_0xab01('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd0b2=['../../config/logger','api','moment','bluebird','path','../../config/environment','./integrationReport.attributes','exports','IntegrationReport','report_integration','lodash','util'];(function(_0x328591,_0x281393){var _0x1101aa=function(_0x588eea){while(--_0x588eea){_0x328591['push'](_0x328591['shift']());}};_0x1101aa(++_0x281393);}(_0xd0b2,0x1ae));var _0x2d0b=function(_0x3a8e22,_0x52a664){_0x3a8e22=_0x3a8e22-0x0;var _0x191309=_0xd0b2[_0x3a8e22];return _0x191309;};'use strict';var _=require(_0x2d0b('0x0'));var util=require(_0x2d0b('0x1'));var logger=require(_0x2d0b('0x2'))(_0x2d0b('0x3'));var moment=require(_0x2d0b('0x4'));var BPromise=require(_0x2d0b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d0b('0x6'));var rimraf=require('rimraf');var config=require(_0x2d0b('0x7'));var attributes=require(_0x2d0b('0x8'));module[_0x2d0b('0x9')]=function(_0x23bbdd,_0x31fe33){return _0x23bbdd['define'](_0x2d0b('0xa'),attributes,{'tableName':_0x2d0b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 4985666..93e257a 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 _0x4137=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','IntegrationReport,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0x36b400,_0x277ec5){var _0x4d47bf=function(_0x55372b){while(--_0x55372b){_0x36b400['push'](_0x36b400['shift']());}};_0x4d47bf(++_0x277ec5);}(_0x4137,0xf8));var _0x7413=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x4137[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});} \ No newline at end of file +var _0x187d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x55c1e1,_0x4a9b20){var _0x210ffe=function(_0x3479ce){while(--_0x3479ce){_0x55c1e1['push'](_0x55c1e1['shift']());}};_0x210ffe(++_0x4a9b20);}(_0x187d,0x93));var _0xd187=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x187d[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var moment=require(_0xd187('0x1'));var BPromise=require(_0xd187('0x2'));var rs=require(_0xd187('0x3'));var fs=require('fs');var Redis=require(_0xd187('0x4'));var db=require(_0xd187('0x5'))['db'];var utils=require(_0xd187('0x6'));var logger=require('../../config/logger')(_0xd187('0x7'));var config=require(_0xd187('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd187('0x9')][_0xd187('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x444a60,_0x1d3fe4,_0x28ce2f){return new BPromise(function(_0x2d6992,_0x358c45){return client[_0xd187('0xb')](_0x444a60,_0x28ce2f)['then'](function(_0x342539){logger[_0xd187('0xc')](_0xd187('0xd'),_0x1d3fe4,_0xd187('0xe'));logger[_0xd187('0xf')](_0xd187('0x10'),_0x1d3fe4,'request\x20sent',JSON[_0xd187('0x11')](_0x342539));if(_0x342539[_0xd187('0x12')]){if(_0x342539[_0xd187('0x12')]['code']===0x1f4){logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539[_0xd187('0x12')]['message']);return _0x358c45(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539['error'][_0xd187('0x13')]);return _0x2d6992(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}else{logger[_0xd187('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x1d3fe4,_0xd187('0xe'));_0x2d6992(_0x342539['result']['message']);}})[_0xd187('0x14')](function(_0x5a4986){logger['error'](_0xd187('0xd'),_0x1d3fe4,_0x5a4986);_0x358c45(_0x5a4986);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index aaadf3b..694cdd5 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 _0x308a=['create','/:id/sub_intervals/create_many','addIntervals','put','/:id','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','show','post'];(function(_0x533132,_0xf5b6fa){var _0x1a7447=function(_0x44d580){while(--_0x44d580){_0x533132['push'](_0x533132['shift']());}};_0x1a7447(++_0xf5b6fa);}(_0x308a,0x71));var _0xa308=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x308a[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xa308('0x0'));var util=require('util');var path=require(_0xa308('0x1'));var timeout=require(_0xa308('0x2'));var express=require(_0xa308('0x3'));var router=express[_0xa308('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa308('0x5'));var config=require(_0xa308('0x6'));var controller=require(_0xa308('0x7'));router[_0xa308('0x8')]('/',auth[_0xa308('0x9')](),controller[_0xa308('0xa')]);router[_0xa308('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xa308('0xb')]);router[_0xa308('0x8')]('/:id/sub_intervals',auth[_0xa308('0x9')](),controller['getIntervals']);router[_0xa308('0xc')]('/',auth['isAuthenticated'](),controller[_0xa308('0xd')]);router[_0xa308('0xc')]('/:id/sub_intervals',auth[_0xa308('0x9')](),controller['addInterval']);router['post'](_0xa308('0xe'),auth[_0xa308('0x9')](),controller[_0xa308('0xf')]);router[_0xa308('0x10')](_0xa308('0x11'),auth[_0xa308('0x9')](),controller['update']);router[_0xa308('0x12')](_0xa308('0x11'),auth[_0xa308('0x9')](),controller[_0xa308('0x13')]);module[_0xa308('0x14')]=router; \ No newline at end of file +var _0x1b20=['destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','getIntervals','post','create','/:id/sub_intervals','put','update'];(function(_0x1cc81b,_0x349807){var _0x27b056=function(_0xfad37b){while(--_0xfad37b){_0x1cc81b['push'](_0x1cc81b['shift']());}};_0x27b056(++_0x349807);}(_0x1b20,0x66));var _0x01b2=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1b20[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require(_0x01b2('0x0'));var path=require(_0x01b2('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x01b2('0x2')]();var fs_extra=require(_0x01b2('0x3'));var auth=require(_0x01b2('0x4'));var interaction=require(_0x01b2('0x5'));var config=require(_0x01b2('0x6'));var controller=require(_0x01b2('0x7'));router[_0x01b2('0x8')]('/',auth[_0x01b2('0x9')](),controller[_0x01b2('0xa')]);router[_0x01b2('0x8')](_0x01b2('0xb'),auth[_0x01b2('0x9')](),controller['show']);router[_0x01b2('0x8')]('/:id/sub_intervals',auth[_0x01b2('0x9')](),controller[_0x01b2('0xc')]);router[_0x01b2('0xd')]('/',auth[_0x01b2('0x9')](),controller[_0x01b2('0xe')]);router[_0x01b2('0xd')](_0x01b2('0xf'),auth[_0x01b2('0x9')](),controller['addInterval']);router[_0x01b2('0xd')]('/:id/sub_intervals/create_many',auth[_0x01b2('0x9')](),controller['addIntervals']);router[_0x01b2('0x10')](_0x01b2('0xb'),auth[_0x01b2('0x9')](),controller[_0x01b2('0x11')]);router['delete'](_0x01b2('0xb'),auth[_0x01b2('0x9')](),controller[_0x01b2('0x12')]);module[_0x01b2('0x13')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 1f1d951..e0c32a2 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 _0x0092=['STRING'];(function(_0x125c4c,_0x2704cc){var _0x21e21c=function(_0x1b3685){while(--_0x1b3685){_0x125c4c['push'](_0x125c4c['shift']());}};_0x21e21c(++_0x2704cc);}(_0x0092,0x1b1));var _0x2009=function(_0x11f418,_0x16283a){_0x11f418=_0x11f418-0x0;var _0x5d7f70=_0x0092[_0x11f418];return _0x5d7f70;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2009('0x0')]},'description':{'type':Sequelize[_0x2009('0x0')]},'interval':{'type':Sequelize[_0x2009('0x0')],'allowNull':!![]}}; \ No newline at end of file +var _0xdb11=['STRING','sequelize','exports'];(function(_0x59eb6c,_0x202fdd){var _0x1c79bb=function(_0x427a5e){while(--_0x427a5e){_0x59eb6c['push'](_0x59eb6c['shift']());}};_0x1c79bb(++_0x202fdd);}(_0xdb11,0x193));var _0x1db1=function(_0xbeb808,_0x881ddf){_0xbeb808=_0xbeb808-0x0;var _0x5d6909=_0xdb11[_0xbeb808];return _0x5d6909;};'use strict';var Sequelize=require(_0x1db1('0x0'));module[_0x1db1('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1db1('0x2')]},'interval':{'type':Sequelize[_0x1db1('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 16239c9..66257c2 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 _0xd668=['path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../components/extensions/rewrite','sendStatus','status','end','json','limit','undefined','count','Content-Range','apply','reject','then','destroy','get','Intervals','UserProfileResource','error','stack','name','send','Interval','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','addInterval','IntervalId','getIntervals','addIntervals','findOne','sequelize','transaction','map','bulkCreate','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util'];(function(_0x3bc7f5,_0x292824){var _0x14fe99=function(_0x4db81d){while(--_0x4db81d){_0x3bc7f5['push'](_0x3bc7f5['shift']());}};_0x14fe99(++_0x292824);}(_0xd668,0x1bf));var _0x8d66=function(_0x2aaaf3,_0x136e41){_0x2aaaf3=_0x2aaaf3-0x0;var _0x4afb4b=_0xd668[_0x2aaaf3];return _0x4afb4b;};'use strict';var emlformat=require(_0x8d66('0x0'));var rimraf=require(_0x8d66('0x1'));var zipdir=require(_0x8d66('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8d66('0x3'));var moment=require(_0x8d66('0x4'));var BPromise=require(_0x8d66('0x5'));var Mustache=require(_0x8d66('0x6'));var util=require(_0x8d66('0x7'));var path=require(_0x8d66('0x8'));var sox=require(_0x8d66('0x9'));var csv=require(_0x8d66('0xa'));var ejs=require(_0x8d66('0xb'));var fs=require('fs');var fs_extra=require(_0x8d66('0xc'));var _=require('lodash');var squel=require(_0x8d66('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8d66('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8d66('0xf'));var Papa=require('papaparse');var Redis=require(_0x8d66('0x10'));var authService=require(_0x8d66('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8d66('0x12'));var hardwareService=require(_0x8d66('0x13'));var logger=require(_0x8d66('0x14'))('api');var utils=require(_0x8d66('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8d66('0x16'));var db=require('../../mysqldb')['db'];var extensions=require(_0x8d66('0x17'));function respondWithStatusCode(_0x528f30,_0x29697b){_0x29697b=_0x29697b||0xcc;return function(_0x15ec16){if(_0x15ec16){return _0x528f30[_0x8d66('0x18')](_0x29697b);}return _0x528f30[_0x8d66('0x19')](_0x29697b)[_0x8d66('0x1a')]();};}function respondWithResult(_0x1987f7,_0x36f0be){_0x36f0be=_0x36f0be||0xc8;return function(_0x7001f0){if(_0x7001f0){return _0x1987f7['status'](_0x36f0be)[_0x8d66('0x1b')](_0x7001f0);}};}function respondWithFilteredResult(_0x398412,_0x36bbb4){return function(_0x104a35){if(_0x104a35){var _0x357404=typeof _0x36bbb4['offset']==='undefined'&&typeof _0x36bbb4[_0x8d66('0x1c')]===_0x8d66('0x1d');var _0x171ae5=_0x104a35[_0x8d66('0x1e')];var _0x35e46b=_0x357404?0x0:_0x36bbb4['offset'];var _0x57a508=_0x357404?_0x104a35['count']:_0x36bbb4['offset']+_0x36bbb4[_0x8d66('0x1c')];var _0x1d3886;if(_0x57a508>=_0x171ae5){_0x57a508=_0x171ae5;_0x1d3886=0xc8;}else{_0x1d3886=0xce;}_0x398412[_0x8d66('0x19')](_0x1d3886);return _0x398412['set'](_0x8d66('0x1f'),_0x35e46b+'-'+_0x57a508+'/'+_0x171ae5)['json'](_0x104a35);}return null;};}function patchUpdates(_0xd6d0f7){return function(_0x1b1fa4){try{jsonpatch[_0x8d66('0x20')](_0x1b1fa4,_0xd6d0f7,!![]);}catch(_0x19970e){return BPromise[_0x8d66('0x21')](_0x19970e);}return _0x1b1fa4['save']();};}function saveUpdates(_0x4f0cf2,_0x30fccb){return function(_0x11f31c){if(_0x11f31c){return _0x11f31c['update'](_0x4f0cf2)[_0x8d66('0x22')](function(_0x1bab06){return _0x1bab06;});}return null;};}function removeEntity(_0x102dbf,_0x5d93c6){return function(_0x500b55){if(_0x500b55){return _0x500b55[_0x8d66('0x23')]()['then'](function(){var _0x21673d=_0x500b55[_0x8d66('0x24')]({'plain':!![]});var _0x44ef68=_0x8d66('0x25');return db[_0x8d66('0x26')][_0x8d66('0x23')]({'where':{'type':_0x44ef68,'resourceId':_0x21673d['id']}})[_0x8d66('0x22')](function(){return _0x500b55;});})[_0x8d66('0x22')](function(){_0x102dbf['status'](0xcc)[_0x8d66('0x1a')]();});}};}function handleEntityNotFound(_0x344408,_0x1ebe76){return function(_0x2fe868){if(!_0x2fe868){_0x344408[_0x8d66('0x18')](0x194);}return _0x2fe868;};}function handleError(_0x5530fc,_0x526b43){_0x526b43=_0x526b43||0x1f4;return function(_0xdb1d93){logger[_0x8d66('0x27')](_0xdb1d93[_0x8d66('0x28')]);if(_0xdb1d93[_0x8d66('0x29')]){delete _0xdb1d93[_0x8d66('0x29')];}_0x5530fc['status'](_0x526b43)[_0x8d66('0x2a')](_0xdb1d93);};}exports['index']=function(_0x214e4a,_0x35269c){var _0x3035b3={},_0x4ad0a3={},_0x74eb36={'count':0x0,'rows':[]};var _0x3d9e49=_['map'](db[_0x8d66('0x2b')][_0x8d66('0x2c')],function(_0xd6e5e){return{'name':_0xd6e5e[_0x8d66('0x2d')],'type':_0xd6e5e[_0x8d66('0x2e')][_0x8d66('0x2f')]};});_0x4ad0a3[_0x8d66('0x30')]=_['map'](_0x3d9e49,_0x8d66('0x29'));_0x4ad0a3[_0x8d66('0x31')]=_[_0x8d66('0x32')](_0x214e4a[_0x8d66('0x31')]);_0x4ad0a3[_0x8d66('0x33')]=_[_0x8d66('0x34')](_0x4ad0a3[_0x8d66('0x30')],_0x4ad0a3[_0x8d66('0x31')]);_0x3035b3[_0x8d66('0x35')]=_[_0x8d66('0x34')](_0x4ad0a3[_0x8d66('0x30')],qs[_0x8d66('0x36')](_0x214e4a['query'][_0x8d66('0x36')]));_0x3035b3[_0x8d66('0x35')]=_0x3035b3[_0x8d66('0x35')][_0x8d66('0x37')]?_0x3035b3[_0x8d66('0x35')]:_0x4ad0a3[_0x8d66('0x30')];if(!_0x214e4a[_0x8d66('0x31')][_0x8d66('0x38')](_0x8d66('0x39'))){_0x3035b3[_0x8d66('0x1c')]=qs[_0x8d66('0x1c')](_0x214e4a['query'][_0x8d66('0x1c')]);_0x3035b3[_0x8d66('0x3a')]=qs['offset'](_0x214e4a[_0x8d66('0x31')][_0x8d66('0x3a')]);}_0x3035b3[_0x8d66('0x3b')]=qs[_0x8d66('0x3c')](_0x214e4a['query'][_0x8d66('0x3c')]);_0x3035b3[_0x8d66('0x3d')]=qs[_0x8d66('0x33')](_[_0x8d66('0x3e')](_0x214e4a['query'],_0x4ad0a3['filters']),_0x3d9e49);if(_0x214e4a[_0x8d66('0x31')][_0x8d66('0x3f')]){_0x3035b3[_0x8d66('0x3d')]=_['merge'](_0x3035b3[_0x8d66('0x3d')],{'$or':_['map'](_0x3d9e49,function(_0x531fb6){if(_0x531fb6[_0x8d66('0x2e')]!=='VIRTUAL'){var _0x142418={};_0x142418[_0x531fb6['name']]={'$like':'%'+_0x214e4a[_0x8d66('0x31')]['filter']+'%'};return _0x142418;}})});}_0x3035b3=_[_0x8d66('0x40')]({},_0x3035b3,_0x214e4a[_0x8d66('0x41')]);var _0x2a4e90={'where':_0x3035b3[_0x8d66('0x3d')]};return db[_0x8d66('0x2b')]['count'](_0x2a4e90)['then'](function(_0x3b816e){_0x74eb36[_0x8d66('0x1e')]=_0x3b816e;if(_0x214e4a[_0x8d66('0x31')][_0x8d66('0x42')]){_0x3035b3[_0x8d66('0x43')]=[{'all':!![]}];}return db[_0x8d66('0x2b')]['findAll'](_0x3035b3);})[_0x8d66('0x22')](function(_0xab9237){_0x74eb36[_0x8d66('0x44')]=_0xab9237;return _0x74eb36;})[_0x8d66('0x22')](respondWithFilteredResult(_0x35269c,_0x3035b3))['catch'](handleError(_0x35269c,null));};exports[_0x8d66('0x45')]=function(_0x5563c2,_0x986c21){var _0x19aeab={'raw':!![],'where':{'id':_0x5563c2['params']['id']}},_0x3f523={};_0x3f523[_0x8d66('0x30')]=_['keys'](db[_0x8d66('0x2b')][_0x8d66('0x2c')]);_0x3f523[_0x8d66('0x31')]=_['keys'](_0x5563c2[_0x8d66('0x31')]);_0x3f523[_0x8d66('0x33')]=_[_0x8d66('0x34')](_0x3f523['model'],_0x3f523[_0x8d66('0x31')]);_0x19aeab[_0x8d66('0x35')]=_[_0x8d66('0x34')](_0x3f523[_0x8d66('0x30')],qs[_0x8d66('0x36')](_0x5563c2['query'][_0x8d66('0x36')]));_0x19aeab[_0x8d66('0x35')]=_0x19aeab[_0x8d66('0x35')][_0x8d66('0x37')]?_0x19aeab[_0x8d66('0x35')]:_0x3f523[_0x8d66('0x30')];if(_0x5563c2['query'][_0x8d66('0x42')]){_0x19aeab[_0x8d66('0x43')]=[{'all':!![]}];}_0x19aeab=_['merge']({},_0x19aeab,_0x5563c2[_0x8d66('0x41')]);return db[_0x8d66('0x2b')]['find'](_0x19aeab)[_0x8d66('0x22')](handleEntityNotFound(_0x986c21,null))['then'](respondWithResult(_0x986c21,null))[_0x8d66('0x46')](handleError(_0x986c21,null));};exports['create']=function(_0x515cef,_0x580a36){return db[_0x8d66('0x2b')][_0x8d66('0x47')](_0x515cef[_0x8d66('0x48')],{})[_0x8d66('0x22')](function(_0x32cad1){var _0xb03e84=_0x515cef['user'][_0x8d66('0x24')]({'plain':!![]});if(!_0xb03e84)throw new Error(_0x8d66('0x49'));if(_0xb03e84[_0x8d66('0x4a')]===_0x8d66('0x4b')){var _0x18ef02=_0x32cad1[_0x8d66('0x24')]({'plain':!![]});var _0x34db7f=_0x8d66('0x25');return db[_0x8d66('0x4c')][_0x8d66('0x4d')]({'where':{'name':_0x34db7f,'userProfileId':_0xb03e84[_0x8d66('0x4e')]},'raw':!![]})[_0x8d66('0x22')](function(_0x4694e4){if(_0x4694e4&&_0x4694e4['autoAssociation']===0x0){return db[_0x8d66('0x26')][_0x8d66('0x47')]({'name':_0x18ef02[_0x8d66('0x29')],'resourceId':_0x18ef02['id'],'type':_0x4694e4[_0x8d66('0x29')],'sectionId':_0x4694e4['id']},{})[_0x8d66('0x22')](function(){return _0x32cad1;});}else{return _0x32cad1;}})[_0x8d66('0x46')](function(_0x11df39){logger[_0x8d66('0x27')](_0x8d66('0x4f'),_0x11df39);throw _0x11df39;});}return _0x32cad1;})[_0x8d66('0x22')](respondWithResult(_0x580a36,0xc9))[_0x8d66('0x46')](handleError(_0x580a36,null));};exports[_0x8d66('0x50')]=function(_0x4b4f6c,_0x4d958e){if(_0x4b4f6c[_0x8d66('0x48')]['id']){delete _0x4b4f6c[_0x8d66('0x48')]['id'];}return db[_0x8d66('0x2b')][_0x8d66('0x4d')]({'where':{'id':_0x4b4f6c[_0x8d66('0x51')]['id']}})[_0x8d66('0x22')](handleEntityNotFound(_0x4d958e,null))[_0x8d66('0x22')](saveUpdates(_0x4b4f6c[_0x8d66('0x48')],null))[_0x8d66('0x22')](respondWithResult(_0x4d958e,null))['catch'](handleError(_0x4d958e,null));};exports[_0x8d66('0x23')]=function(_0x434f54,_0xed46a1){return db[_0x8d66('0x2b')]['find']({'where':{'id':_0x434f54[_0x8d66('0x51')]['id']}})['then'](handleEntityNotFound(_0xed46a1,null))[_0x8d66('0x22')](removeEntity(_0xed46a1,null))[_0x8d66('0x46')](handleError(_0xed46a1,null));};exports[_0x8d66('0x52')]=function(_0x3d814e,_0x1f989a,_0x254167){if(_0x3d814e[_0x8d66('0x48')]['id']){delete _0x3d814e[_0x8d66('0x48')]['id'];}return db[_0x8d66('0x2b')][_0x8d66('0x4d')]({'where':{'id':_0x3d814e[_0x8d66('0x51')]['id']}})[_0x8d66('0x22')](handleEntityNotFound(_0x1f989a,null))['then'](function(_0x4e8203){if(_0x4e8203){_0x3d814e[_0x8d66('0x48')][_0x8d66('0x53')]=_0x4e8203['id'];return db[_0x8d66('0x2b')]['create'](_0x3d814e['body']);}})[_0x8d66('0x22')](respondWithResult(_0x1f989a,null))['catch'](handleError(_0x1f989a,null));};exports['getIntervals']=function(_0x414178,_0x4cf958,_0x19d9af){var _0x23af07={};var _0x5ca52f={};var _0x4679e1;var _0x2f3537;return db[_0x8d66('0x2b')]['findOne']({'where':{'id':_0x414178[_0x8d66('0x51')]['id']}})[_0x8d66('0x22')](handleEntityNotFound(_0x4cf958,null))[_0x8d66('0x22')](function(_0x290f33){if(_0x290f33){_0x4679e1=_0x290f33;_0x5ca52f[_0x8d66('0x30')]=_[_0x8d66('0x32')](db[_0x8d66('0x2b')]['rawAttributes']);_0x5ca52f[_0x8d66('0x31')]=_[_0x8d66('0x32')](_0x414178[_0x8d66('0x31')]);_0x5ca52f[_0x8d66('0x33')]=_[_0x8d66('0x34')](_0x5ca52f[_0x8d66('0x30')],_0x5ca52f[_0x8d66('0x31')]);_0x23af07[_0x8d66('0x35')]=_[_0x8d66('0x34')](_0x5ca52f[_0x8d66('0x30')],qs[_0x8d66('0x36')](_0x414178[_0x8d66('0x31')]['fields']));_0x23af07[_0x8d66('0x35')]=_0x23af07[_0x8d66('0x35')][_0x8d66('0x37')]?_0x23af07['attributes']:_0x5ca52f[_0x8d66('0x30')];_0x23af07['order']=qs[_0x8d66('0x3c')](_0x414178[_0x8d66('0x31')][_0x8d66('0x3c')]);_0x23af07[_0x8d66('0x3d')]=qs[_0x8d66('0x33')](_['pick'](_0x414178[_0x8d66('0x31')],_0x5ca52f[_0x8d66('0x33')]));if(_0x414178[_0x8d66('0x31')][_0x8d66('0x3f')]){_0x23af07[_0x8d66('0x3d')]=_[_0x8d66('0x40')](_0x23af07[_0x8d66('0x3d')],{'$or':_['map'](_0x23af07[_0x8d66('0x35')],function(_0x3d9ebd){var _0x148b5e={};_0x148b5e[_0x3d9ebd]={'$like':'%'+_0x414178[_0x8d66('0x31')][_0x8d66('0x3f')]+'%'};return _0x148b5e;})});}_0x23af07=_[_0x8d66('0x40')]({},_0x23af07,_0x414178[_0x8d66('0x41')]);return _0x4679e1[_0x8d66('0x54')](_0x23af07);}})['then'](function(_0x5129dc){if(_0x5129dc){_0x2f3537=_0x5129dc[_0x8d66('0x37')];if(!_0x414178['query'][_0x8d66('0x38')](_0x8d66('0x39'))){_0x23af07[_0x8d66('0x1c')]=qs[_0x8d66('0x1c')](_0x414178[_0x8d66('0x31')][_0x8d66('0x1c')]);_0x23af07['offset']=qs['offset'](_0x414178[_0x8d66('0x31')][_0x8d66('0x3a')]);}return _0x4679e1[_0x8d66('0x54')](_0x23af07);}})[_0x8d66('0x22')](function(_0x2a9718){if(_0x2a9718){return _0x2a9718?{'count':_0x2f3537,'rows':_0x2a9718}:null;}})[_0x8d66('0x22')](respondWithResult(_0x4cf958,null))[_0x8d66('0x46')](handleError(_0x4cf958,null));};exports[_0x8d66('0x55')]=function(_0x1fcaa5,_0x496231,_0x18105f){return db[_0x8d66('0x2b')][_0x8d66('0x56')]({'where':{'id':_0x1fcaa5['params']['id']}})[_0x8d66('0x22')](handleEntityNotFound(_0x496231,null))['then'](function(_0x2ba4c2){if(_0x2ba4c2){return db[_0x8d66('0x57')][_0x8d66('0x58')](function(_0xdb2d37){return db['Interval'][_0x8d66('0x23')]({'where':{'IntervalId':_0x1fcaa5[_0x8d66('0x51')]['id']},'transaction':_0xdb2d37})[_0x8d66('0x22')](function(_0x1c0940){var _0x437933=_[_0x8d66('0x59')](_0x1fcaa5[_0x8d66('0x48')],function(_0x4bf7a6){delete _0x4bf7a6['id'];_0x4bf7a6['IntervalId']=_0x1fcaa5[_0x8d66('0x51')]['id'];return _0x4bf7a6;});return db[_0x8d66('0x2b')][_0x8d66('0x5a')](_0x437933,{'transaction':_0xdb2d37});});})[_0x8d66('0x22')](function(){return db[_0x8d66('0x2b')]['findAll']({'where':{'IntervalId':_0x1fcaa5[_0x8d66('0x51')]['id']}});});}})[_0x8d66('0x22')](respondWithResult(_0x496231,null))['catch'](handleError(_0x496231,null));}; \ No newline at end of file +var _0xd5bf=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addInterval','getIntervals','findOne','keys','hasOwnProperty','nolimit','addIntervals','transaction','IntervalId','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','Intervals','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','order','sort','where','pick','filter','VIRTUAL','options','Interval','includeAll','include','findAll','rows','catch','show','length','merge','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','error'];(function(_0x3377a5,_0x3a600a){var _0x473b96=function(_0x3247f9){while(--_0x3247f9){_0x3377a5['push'](_0x3377a5['shift']());}};_0x473b96(++_0x3a600a);}(_0xd5bf,0x66));var _0xfd5b=function(_0x1fe001,_0x1c0158){_0x1fe001=_0x1fe001-0x0;var _0x57694c=_0xd5bf[_0x1fe001];return _0x57694c;};'use strict';var emlformat=require(_0xfd5b('0x0'));var rimraf=require(_0xfd5b('0x1'));var zipdir=require(_0xfd5b('0x2'));var jsonpatch=require(_0xfd5b('0x3'));var rp=require(_0xfd5b('0x4'));var moment=require(_0xfd5b('0x5'));var BPromise=require(_0xfd5b('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfd5b('0x7'));var sox=require(_0xfd5b('0x8'));var csv=require(_0xfd5b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfd5b('0xa'));var squel=require(_0xfd5b('0xb'));var crypto=require(_0xfd5b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xfd5b('0xd'));var toCsv=require(_0xfd5b('0x9'));var querystring=require('querystring');var Papa=require(_0xfd5b('0xe'));var Redis=require(_0xfd5b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xfd5b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfd5b('0x11'));var logger=require('../../config/logger')(_0xfd5b('0x12'));var utils=require('../../config/utils');var config=require(_0xfd5b('0x13'));var licenseUtil=require(_0xfd5b('0x14'));var db=require('../../mysqldb')['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x1c3e88,_0x2e1ee1){_0x2e1ee1=_0x2e1ee1||0xcc;return function(_0x50b2cb){if(_0x50b2cb){return _0x1c3e88[_0xfd5b('0x15')](_0x2e1ee1);}return _0x1c3e88[_0xfd5b('0x16')](_0x2e1ee1)[_0xfd5b('0x17')]();};}function respondWithResult(_0x3313d5,_0x22b2dc){_0x22b2dc=_0x22b2dc||0xc8;return function(_0x3b6ea7){if(_0x3b6ea7){return _0x3313d5[_0xfd5b('0x16')](_0x22b2dc)[_0xfd5b('0x18')](_0x3b6ea7);}};}function respondWithFilteredResult(_0x34cde5,_0x291630){return function(_0x51abd4){if(_0x51abd4){var _0x42c653=typeof _0x291630[_0xfd5b('0x19')]===_0xfd5b('0x1a')&&typeof _0x291630[_0xfd5b('0x1b')]==='undefined';var _0x2e2a4d=_0x51abd4['count'];var _0x5d54ae=_0x42c653?0x0:_0x291630[_0xfd5b('0x19')];var _0x38b45a=_0x42c653?_0x51abd4[_0xfd5b('0x1c')]:_0x291630[_0xfd5b('0x19')]+_0x291630[_0xfd5b('0x1b')];var _0x539fcd;if(_0x38b45a>=_0x2e2a4d){_0x38b45a=_0x2e2a4d;_0x539fcd=0xc8;}else{_0x539fcd=0xce;}_0x34cde5['status'](_0x539fcd);return _0x34cde5[_0xfd5b('0x1d')](_0xfd5b('0x1e'),_0x5d54ae+'-'+_0x38b45a+'/'+_0x2e2a4d)[_0xfd5b('0x18')](_0x51abd4);}return null;};}function patchUpdates(_0x5ac255){return function(_0x3bac94){try{jsonpatch['apply'](_0x3bac94,_0x5ac255,!![]);}catch(_0x3a778d){return BPromise[_0xfd5b('0x1f')](_0x3a778d);}return _0x3bac94[_0xfd5b('0x20')]();};}function saveUpdates(_0x387357,_0x2a4ed5){return function(_0x7e5417){if(_0x7e5417){return _0x7e5417[_0xfd5b('0x21')](_0x387357)[_0xfd5b('0x22')](function(_0x422b50){return _0x422b50;});}return null;};}function removeEntity(_0x204ce9,_0x19b3f7){return function(_0xd99554){if(_0xd99554){return _0xd99554[_0xfd5b('0x23')]()[_0xfd5b('0x22')](function(){var _0x2f5605=_0xd99554[_0xfd5b('0x24')]({'plain':!![]});var _0x52ea05=_0xfd5b('0x25');return db[_0xfd5b('0x26')][_0xfd5b('0x23')]({'where':{'type':_0x52ea05,'resourceId':_0x2f5605['id']}})[_0xfd5b('0x22')](function(){return _0xd99554;});})[_0xfd5b('0x22')](function(){_0x204ce9[_0xfd5b('0x16')](0xcc)[_0xfd5b('0x17')]();});}};}function handleEntityNotFound(_0xee1f2a,_0x33209a){return function(_0x30ae5d){if(!_0x30ae5d){_0xee1f2a['sendStatus'](0x194);}return _0x30ae5d;};}function handleError(_0x51230c,_0x443530){_0x443530=_0x443530||0x1f4;return function(_0x3907df){logger['error'](_0x3907df[_0xfd5b('0x27')]);if(_0x3907df[_0xfd5b('0x28')]){delete _0x3907df['name'];}_0x51230c[_0xfd5b('0x16')](_0x443530)[_0xfd5b('0x29')](_0x3907df);};}exports[_0xfd5b('0x2a')]=function(_0x43c66d,_0x571545){var _0x22a5ed={},_0x118610={},_0x17f26f={'count':0x0,'rows':[]};var _0x1592a1=_[_0xfd5b('0x2b')](db['Interval'][_0xfd5b('0x2c')],function(_0xfe60e6){return{'name':_0xfe60e6[_0xfd5b('0x2d')],'type':_0xfe60e6[_0xfd5b('0x2e')][_0xfd5b('0x2f')]};});_0x118610['model']=_[_0xfd5b('0x2b')](_0x1592a1,_0xfd5b('0x28'));_0x118610[_0xfd5b('0x30')]=_['keys'](_0x43c66d[_0xfd5b('0x30')]);_0x118610[_0xfd5b('0x31')]=_[_0xfd5b('0x32')](_0x118610[_0xfd5b('0x33')],_0x118610['query']);_0x22a5ed['attributes']=_['intersection'](_0x118610[_0xfd5b('0x33')],qs[_0xfd5b('0x34')](_0x43c66d['query']['fields']));_0x22a5ed[_0xfd5b('0x35')]=_0x22a5ed[_0xfd5b('0x35')]['length']?_0x22a5ed[_0xfd5b('0x35')]:_0x118610[_0xfd5b('0x33')];if(!_0x43c66d['query']['hasOwnProperty']('nolimit')){_0x22a5ed[_0xfd5b('0x1b')]=qs[_0xfd5b('0x1b')](_0x43c66d['query'][_0xfd5b('0x1b')]);_0x22a5ed[_0xfd5b('0x19')]=qs[_0xfd5b('0x19')](_0x43c66d[_0xfd5b('0x30')][_0xfd5b('0x19')]);}_0x22a5ed[_0xfd5b('0x36')]=qs[_0xfd5b('0x37')](_0x43c66d['query'][_0xfd5b('0x37')]);_0x22a5ed[_0xfd5b('0x38')]=qs['filters'](_[_0xfd5b('0x39')](_0x43c66d[_0xfd5b('0x30')],_0x118610[_0xfd5b('0x31')]),_0x1592a1);if(_0x43c66d[_0xfd5b('0x30')][_0xfd5b('0x3a')]){_0x22a5ed['where']=_['merge'](_0x22a5ed[_0xfd5b('0x38')],{'$or':_['map'](_0x1592a1,function(_0x223e5a){if(_0x223e5a['type']!==_0xfd5b('0x3b')){var _0x17a48b={};_0x17a48b[_0x223e5a[_0xfd5b('0x28')]]={'$like':'%'+_0x43c66d[_0xfd5b('0x30')][_0xfd5b('0x3a')]+'%'};return _0x17a48b;}})});}_0x22a5ed=_['merge']({},_0x22a5ed,_0x43c66d[_0xfd5b('0x3c')]);var _0x458009={'where':_0x22a5ed[_0xfd5b('0x38')]};return db[_0xfd5b('0x3d')][_0xfd5b('0x1c')](_0x458009)[_0xfd5b('0x22')](function(_0x29cd56){_0x17f26f[_0xfd5b('0x1c')]=_0x29cd56;if(_0x43c66d[_0xfd5b('0x30')][_0xfd5b('0x3e')]){_0x22a5ed[_0xfd5b('0x3f')]=[{'all':!![]}];}return db[_0xfd5b('0x3d')][_0xfd5b('0x40')](_0x22a5ed);})['then'](function(_0x28e878){_0x17f26f[_0xfd5b('0x41')]=_0x28e878;return _0x17f26f;})[_0xfd5b('0x22')](respondWithFilteredResult(_0x571545,_0x22a5ed))[_0xfd5b('0x42')](handleError(_0x571545,null));};exports[_0xfd5b('0x43')]=function(_0x4b3a70,_0x13c87b){var _0x1f09de={'raw':!![],'where':{'id':_0x4b3a70['params']['id']}},_0x517ff9={};_0x517ff9[_0xfd5b('0x33')]=_['keys'](db[_0xfd5b('0x3d')][_0xfd5b('0x2c')]);_0x517ff9[_0xfd5b('0x30')]=_['keys'](_0x4b3a70['query']);_0x517ff9['filters']=_[_0xfd5b('0x32')](_0x517ff9[_0xfd5b('0x33')],_0x517ff9[_0xfd5b('0x30')]);_0x1f09de[_0xfd5b('0x35')]=_[_0xfd5b('0x32')](_0x517ff9[_0xfd5b('0x33')],qs[_0xfd5b('0x34')](_0x4b3a70[_0xfd5b('0x30')]['fields']));_0x1f09de[_0xfd5b('0x35')]=_0x1f09de[_0xfd5b('0x35')][_0xfd5b('0x44')]?_0x1f09de[_0xfd5b('0x35')]:_0x517ff9[_0xfd5b('0x33')];if(_0x4b3a70[_0xfd5b('0x30')]['includeAll']){_0x1f09de[_0xfd5b('0x3f')]=[{'all':!![]}];}_0x1f09de=_[_0xfd5b('0x45')]({},_0x1f09de,_0x4b3a70[_0xfd5b('0x3c')]);return db[_0xfd5b('0x3d')][_0xfd5b('0x46')](_0x1f09de)[_0xfd5b('0x22')](handleEntityNotFound(_0x13c87b,null))[_0xfd5b('0x22')](respondWithResult(_0x13c87b,null))[_0xfd5b('0x42')](handleError(_0x13c87b,null));};exports[_0xfd5b('0x47')]=function(_0x587c99,_0xddd97b){return db[_0xfd5b('0x3d')][_0xfd5b('0x47')](_0x587c99['body'],{})[_0xfd5b('0x22')](function(_0x28d9d7){var _0x3869ce=_0x587c99[_0xfd5b('0x48')][_0xfd5b('0x24')]({'plain':!![]});if(!_0x3869ce)throw new Error(_0xfd5b('0x49'));if(_0x3869ce['role']==='user'){var _0x4778d0=_0x28d9d7['get']({'plain':!![]});var _0x2cf342=_0xfd5b('0x25');return db['UserProfileSection'][_0xfd5b('0x46')]({'where':{'name':_0x2cf342,'userProfileId':_0x3869ce['userProfileId']},'raw':!![]})[_0xfd5b('0x22')](function(_0x188acd){if(_0x188acd&&_0x188acd[_0xfd5b('0x4a')]===0x0){return db[_0xfd5b('0x26')][_0xfd5b('0x47')]({'name':_0x4778d0[_0xfd5b('0x28')],'resourceId':_0x4778d0['id'],'type':_0x188acd[_0xfd5b('0x28')],'sectionId':_0x188acd['id']},{})[_0xfd5b('0x22')](function(){return _0x28d9d7;});}else{return _0x28d9d7;}})[_0xfd5b('0x42')](function(_0x488ad2){logger[_0xfd5b('0x4b')](_0xfd5b('0x4c'),_0x488ad2);throw _0x488ad2;});}return _0x28d9d7;})[_0xfd5b('0x22')](respondWithResult(_0xddd97b,0xc9))[_0xfd5b('0x42')](handleError(_0xddd97b,null));};exports[_0xfd5b('0x21')]=function(_0x39cb56,_0x36f320){if(_0x39cb56[_0xfd5b('0x4d')]['id']){delete _0x39cb56[_0xfd5b('0x4d')]['id'];}return db['Interval'][_0xfd5b('0x46')]({'where':{'id':_0x39cb56[_0xfd5b('0x4e')]['id']}})[_0xfd5b('0x22')](handleEntityNotFound(_0x36f320,null))[_0xfd5b('0x22')](saveUpdates(_0x39cb56[_0xfd5b('0x4d')],null))[_0xfd5b('0x22')](respondWithResult(_0x36f320,null))[_0xfd5b('0x42')](handleError(_0x36f320,null));};exports['destroy']=function(_0x98e266,_0x25a587){return db[_0xfd5b('0x3d')][_0xfd5b('0x46')]({'where':{'id':_0x98e266['params']['id']}})[_0xfd5b('0x22')](handleEntityNotFound(_0x25a587,null))[_0xfd5b('0x22')](removeEntity(_0x25a587,null))['catch'](handleError(_0x25a587,null));};exports[_0xfd5b('0x4f')]=function(_0x150af6,_0x31991a,_0x2e022d){if(_0x150af6[_0xfd5b('0x4d')]['id']){delete _0x150af6[_0xfd5b('0x4d')]['id'];}return db[_0xfd5b('0x3d')][_0xfd5b('0x46')]({'where':{'id':_0x150af6[_0xfd5b('0x4e')]['id']}})[_0xfd5b('0x22')](handleEntityNotFound(_0x31991a,null))[_0xfd5b('0x22')](function(_0x359864){if(_0x359864){_0x150af6[_0xfd5b('0x4d')]['IntervalId']=_0x359864['id'];return db[_0xfd5b('0x3d')]['create'](_0x150af6['body']);}})[_0xfd5b('0x22')](respondWithResult(_0x31991a,null))['catch'](handleError(_0x31991a,null));};exports[_0xfd5b('0x50')]=function(_0x2d6c31,_0x9ba412,_0x1cfb14){var _0x5973c5={};var _0x3b9ba2={};var _0x198cd2;var _0x2db527;return db[_0xfd5b('0x3d')][_0xfd5b('0x51')]({'where':{'id':_0x2d6c31[_0xfd5b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x9ba412,null))[_0xfd5b('0x22')](function(_0xa5cc3){if(_0xa5cc3){_0x198cd2=_0xa5cc3;_0x3b9ba2[_0xfd5b('0x33')]=_[_0xfd5b('0x52')](db[_0xfd5b('0x3d')][_0xfd5b('0x2c')]);_0x3b9ba2[_0xfd5b('0x30')]=_[_0xfd5b('0x52')](_0x2d6c31[_0xfd5b('0x30')]);_0x3b9ba2[_0xfd5b('0x31')]=_[_0xfd5b('0x32')](_0x3b9ba2['model'],_0x3b9ba2[_0xfd5b('0x30')]);_0x5973c5[_0xfd5b('0x35')]=_[_0xfd5b('0x32')](_0x3b9ba2['model'],qs[_0xfd5b('0x34')](_0x2d6c31['query']['fields']));_0x5973c5[_0xfd5b('0x35')]=_0x5973c5[_0xfd5b('0x35')]['length']?_0x5973c5[_0xfd5b('0x35')]:_0x3b9ba2[_0xfd5b('0x33')];_0x5973c5[_0xfd5b('0x36')]=qs['sort'](_0x2d6c31[_0xfd5b('0x30')]['sort']);_0x5973c5[_0xfd5b('0x38')]=qs[_0xfd5b('0x31')](_[_0xfd5b('0x39')](_0x2d6c31[_0xfd5b('0x30')],_0x3b9ba2[_0xfd5b('0x31')]));if(_0x2d6c31[_0xfd5b('0x30')][_0xfd5b('0x3a')]){_0x5973c5['where']=_[_0xfd5b('0x45')](_0x5973c5[_0xfd5b('0x38')],{'$or':_[_0xfd5b('0x2b')](_0x5973c5[_0xfd5b('0x35')],function(_0x5e76a6){var _0x561501={};_0x561501[_0x5e76a6]={'$like':'%'+_0x2d6c31[_0xfd5b('0x30')]['filter']+'%'};return _0x561501;})});}_0x5973c5=_[_0xfd5b('0x45')]({},_0x5973c5,_0x2d6c31[_0xfd5b('0x3c')]);return _0x198cd2[_0xfd5b('0x50')](_0x5973c5);}})['then'](function(_0x4c9b44){if(_0x4c9b44){_0x2db527=_0x4c9b44[_0xfd5b('0x44')];if(!_0x2d6c31[_0xfd5b('0x30')][_0xfd5b('0x53')](_0xfd5b('0x54'))){_0x5973c5[_0xfd5b('0x1b')]=qs[_0xfd5b('0x1b')](_0x2d6c31[_0xfd5b('0x30')][_0xfd5b('0x1b')]);_0x5973c5[_0xfd5b('0x19')]=qs[_0xfd5b('0x19')](_0x2d6c31[_0xfd5b('0x30')][_0xfd5b('0x19')]);}return _0x198cd2[_0xfd5b('0x50')](_0x5973c5);}})[_0xfd5b('0x22')](function(_0x37baa1){if(_0x37baa1){return _0x37baa1?{'count':_0x2db527,'rows':_0x37baa1}:null;}})['then'](respondWithResult(_0x9ba412,null))[_0xfd5b('0x42')](handleError(_0x9ba412,null));};exports[_0xfd5b('0x55')]=function(_0xa9e31,_0xd35a7b,_0x7c85d5){return db['Interval']['findOne']({'where':{'id':_0xa9e31[_0xfd5b('0x4e')]['id']}})[_0xfd5b('0x22')](handleEntityNotFound(_0xd35a7b,null))[_0xfd5b('0x22')](function(_0x1e2383){if(_0x1e2383){return db['sequelize'][_0xfd5b('0x56')](function(_0x5025c6){return db[_0xfd5b('0x3d')][_0xfd5b('0x23')]({'where':{'IntervalId':_0xa9e31[_0xfd5b('0x4e')]['id']},'transaction':_0x5025c6})[_0xfd5b('0x22')](function(_0x54d77b){var _0x4659a5=_[_0xfd5b('0x2b')](_0xa9e31[_0xfd5b('0x4d')],function(_0x102f13){delete _0x102f13['id'];_0x102f13[_0xfd5b('0x57')]=_0xa9e31[_0xfd5b('0x4e')]['id'];return _0x102f13;});return db[_0xfd5b('0x3d')][_0xfd5b('0x58')](_0x4659a5,{'transaction':_0x5025c6});});})[_0xfd5b('0x22')](function(){return db[_0xfd5b('0x3d')]['findAll']({'where':{'IntervalId':_0xa9e31['params']['id']}});});}})[_0xfd5b('0x22')](respondWithResult(_0xd35a7b,null))[_0xfd5b('0x42')](handleError(_0xd35a7b,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 7f92544..2a23c69 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 _0x9cc3=['api','bluebird','path','rimraf','../../config/environment','./interval.attributes','exports','define','Interval','tools_intervals','rewrite','lodash','util','../../config/logger'];(function(_0x5bdebb,_0xfe4f65){var _0x3053c7=function(_0xfb87de){while(--_0xfb87de){_0x5bdebb['push'](_0x5bdebb['shift']());}};_0x3053c7(++_0xfe4f65);}(_0x9cc3,0xeb));var _0x39cc=function(_0x497ae4,_0x44559e){_0x497ae4=_0x497ae4-0x0;var _0x4141df=_0x9cc3[_0x497ae4];return _0x4141df;};'use strict';var _=require(_0x39cc('0x0'));var util=require(_0x39cc('0x1'));var logger=require(_0x39cc('0x2'))(_0x39cc('0x3'));var moment=require('moment');var BPromise=require(_0x39cc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x39cc('0x5'));var rimraf=require(_0x39cc('0x6'));var config=require(_0x39cc('0x7'));var attributes=require(_0x39cc('0x8'));var extensions=require('../../components/extensions/rewrite');module[_0x39cc('0x9')]=function(_0x34ead3,_0x207d08){return _0x34ead3[_0x39cc('0xa')](_0x39cc('0xb'),attributes,{'tableName':_0x39cc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xbebd69,_0x1a2103){extensions[_0x39cc('0xd')](_0x34ead3,_0xbebd69);},'afterBulkCreate':function(_0x2a214f,_0x29675f,_0x350e4c){_0x350e4c();extensions[_0x39cc('0xd')](_0x34ead3,_0x2a214f[0x0]);},'afterUpdate':function(_0x1eb160,_0x439c79){extensions[_0x39cc('0xd')](_0x34ead3,_0x1eb160);},'afterDestroy':function(_0xe4d6c2,_0x63083){extensions[_0x39cc('0xd')](_0x34ead3,_0xe4d6c2);}}});}; \ No newline at end of file +var _0xc8d6=['rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','tools_intervals','rewrite','lodash','api','bluebird'];(function(_0x4bf6b0,_0x133f2f){var _0x24ebd9=function(_0x58d6c0){while(--_0x58d6c0){_0x4bf6b0['push'](_0x4bf6b0['shift']());}};_0x24ebd9(++_0x133f2f);}(_0xc8d6,0x194));var _0x6c8d=function(_0x22316b,_0x30981c){_0x22316b=_0x22316b-0x0;var _0x2687e9=_0xc8d6[_0x22316b];return _0x2687e9;};'use strict';var _=require(_0x6c8d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6c8d('0x1'));var moment=require('moment');var BPromise=require(_0x6c8d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6c8d('0x3'));var config=require(_0x6c8d('0x4'));var attributes=require(_0x6c8d('0x5'));var extensions=require(_0x6c8d('0x6'));module[_0x6c8d('0x7')]=function(_0x4d3f75,_0x303e20){return _0x4d3f75[_0x6c8d('0x8')]('Interval',attributes,{'tableName':_0x6c8d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x10cdba,_0x24f707){extensions[_0x6c8d('0xa')](_0x4d3f75,_0x10cdba);},'afterBulkCreate':function(_0xef51d8,_0x2a40fe,_0xe108be){_0xe108be();extensions[_0x6c8d('0xa')](_0x4d3f75,_0xef51d8[0x0]);},'afterUpdate':function(_0x580242,_0x2b952d){extensions[_0x6c8d('0xa')](_0x4d3f75,_0x580242);},'afterDestroy':function(_0x3870ec,_0x2de5c6){extensions[_0x6c8d('0xa')](_0x4d3f75,_0x3870ec);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 213c636..47b85aa 100644 --- a/server/api/interval/interval.rpc.js +++ b/server/api/interval/interval.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x237f8b,_0xc5eddb){var _0x423f94=function(_0x1f18f9){while(--_0x1f18f9){_0x237f8b['push'](_0x237f8b['shift']());}};_0x423f94(++_0xc5eddb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x4f5108,_0x46a54b){var _0x2d56ca=function(_0x5b3c1e){while(--_0x5b3c1e){_0x4f5108['push'](_0x4f5108['shift']());}};_0x2d56ca(++_0x46a54b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index dc12f61..928e6aa 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 _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x4fe7e1,_0x136936){var _0x17bec9=function(_0x2212cd){while(--_0x2212cd){_0x4fe7e1['push'](_0x4fe7e1['shift']());}};_0x17bec9(++_0x136936);}(_0x2ef3,0xba));var _0x32ef=function(_0x6ae4d8,_0x2f2a09){_0x6ae4d8=_0x6ae4d8-0x0;var _0x2b1de1=_0x2ef3[_0x6ae4d8];return _0x2b1de1;};'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 +var _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x38255f,_0x3fd720){var _0x2dd103=function(_0x188c6e){while(--_0x188c6e){_0x38255f['push'](_0x38255f['shift']());}};_0x2dd103(++_0x3fd720);}(_0x2032,0xd9));var _0x2203=function(_0x3e2eec,_0x1481af){_0x3e2eec=_0x3e2eec-0x0;var _0x46f2b7=_0x2032[_0x3e2eec];return _0x46f2b7;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 0cc1029..64e0a1e 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 _0x0d3a=['x-forwarded-for','remoteAddress','connection','socket','body','https','../../config/logger','support','3eAmWpBVP0','key','summary','Report','\x20from\x20','description','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11504','reason','/rest/api/2/issue','POST','application/json','toString','base64','stringify','request','end','statusCode','json','parse','error','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','openIssue','send'];(function(_0x5ce945,_0x3ccfd4){var _0x144dd9=function(_0x8bbb45){while(--_0x8bbb45){_0x5ce945['push'](_0x5ce945['shift']());}};_0x144dd9(++_0x3ccfd4);}(_0x0d3a,0x155));var _0xa0d3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0d3a[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require('bluebird');var https=require(_0xa0d3('0x0'));var logger=require(_0xa0d3('0x1'))('api');var USERNAME=_0xa0d3('0x2');var PASSWORD=_0xa0d3('0x3');function openIssue(_0x3a54e5,_0x4641d3){var _0x481ab0={'fields':{'project':{'key':_0x3a54e5[_0xa0d3('0x4')]||'MOTGUI'},'summary':(_0x3a54e5[_0xa0d3('0x5')]||_0xa0d3('0x6'))+_0xa0d3('0x7')+_0x3a54e5['ip'],'description':_0x3a54e5[_0xa0d3('0x8')]||JSON['stringify'](_0x3a54e5),'issuetype':{'name':_0x3a54e5[_0xa0d3('0x9')]||_0xa0d3('0xa')}}};_0x481ab0[_0xa0d3('0xb')][_0xa0d3('0xc')]=_0x3a54e5[_0xa0d3('0xd')];_0x481ab0['fields'][_0xa0d3('0xe')]=_0x3a54e5[_0xa0d3('0xf')];_0x481ab0[_0xa0d3('0xb')][_0xa0d3('0x10')]=_0x3a54e5[_0xa0d3('0x11')];_0x481ab0[_0xa0d3('0xb')]['customfield_11503']=_0x3a54e5['name'];_0x481ab0[_0xa0d3('0xb')][_0xa0d3('0x12')]=_0x3a54e5[_0xa0d3('0x13')];_0x481ab0[_0xa0d3('0xb')]['customfield_10102']=_0x3a54e5['ip'];var _0x43f96d={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xa0d3('0x14'),'method':_0xa0d3('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0xa0d3('0x16'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xa0d3('0x17')](_0xa0d3('0x18'))}};var _0x1f2c06=JSON[_0xa0d3('0x19')](_0x481ab0);var _0x2b4769=https[_0xa0d3('0x1a')](_0x43f96d,function(_0x1a2a8a){_0x1a2a8a['setEncoding']('utf8');var _0x2e1519='';_0x1a2a8a['on']('data',function(_0x4fabe2){_0x2e1519+=_0x4fabe2;});_0x1a2a8a['on'](_0xa0d3('0x1b'),function(){if(_0x4641d3){return _0x4641d3['status'](_0x1a2a8a[_0xa0d3('0x1c')])[_0xa0d3('0x1d')](JSON[_0xa0d3('0x1e')](_0x2e1519));}});});_0x2b4769['on'](_0xa0d3('0x1f'),function(_0x53d7ad){if(_0x4641d3){return _0x4641d3[_0xa0d3('0x20')](0x1f4)['json']({'errors':[{'message':_0xa0d3('0x21'),'type':_0xa0d3('0x22')}]});}});_0x2b4769['write'](_0x1f2c06);_0x2b4769[_0xa0d3('0x1b')]();}exports[_0xa0d3('0x23')]=openIssue;exports[_0xa0d3('0x24')]=function(_0x2bccbd,_0x409904){_0x2bccbd['body']['ip']=_0x2bccbd['headers'][_0xa0d3('0x25')]||_0x2bccbd['connection'][_0xa0d3('0x26')]||_0x2bccbd['socket'][_0xa0d3('0x26')]||_0x2bccbd[_0xa0d3('0x27')][_0xa0d3('0x28')]['remoteAddress'];return openIssue(_0x2bccbd[_0xa0d3('0x29')],_0x409904);}; \ No newline at end of file +var _0x9783=['end','statusCode','json','parse','error','write','openIssue','send','body','headers','x-forwarded-for','remoteAddress','connection','socket','bluebird','https','../../config/logger','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','customfield_11500','email','oldToken','fields','customfield_11502','customfield_11503','name','reason','customfield_10102','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','utf8'];(function(_0x4addaa,_0x443146){var _0x3eb2eb=function(_0x192442){while(--_0x192442){_0x4addaa['push'](_0x4addaa['shift']());}};_0x3eb2eb(++_0x443146);}(_0x9783,0x19a));var _0x3978=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9783[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x3978('0x0'));var https=require(_0x3978('0x1'));var logger=require(_0x3978('0x2'))('api');var USERNAME='support';var PASSWORD=_0x3978('0x3');function openIssue(_0x24f9f8,_0x3c4286){var _0xbeede5={'fields':{'project':{'key':_0x24f9f8[_0x3978('0x4')]||_0x3978('0x5')},'summary':(_0x24f9f8[_0x3978('0x6')]||_0x3978('0x7'))+_0x3978('0x8')+_0x24f9f8['ip'],'description':_0x24f9f8[_0x3978('0x9')]||JSON[_0x3978('0xa')](_0x24f9f8),'issuetype':{'name':_0x24f9f8[_0x3978('0xb')]||_0x3978('0xc')}}};_0xbeede5['fields'][_0x3978('0xd')]=_0x24f9f8[_0x3978('0xe')];_0xbeede5['fields']['customfield_11501']=_0x24f9f8[_0x3978('0xf')];_0xbeede5[_0x3978('0x10')][_0x3978('0x11')]=_0x24f9f8['newToken'];_0xbeede5['fields'][_0x3978('0x12')]=_0x24f9f8[_0x3978('0x13')];_0xbeede5[_0x3978('0x10')]['customfield_11504']=_0x24f9f8[_0x3978('0x14')];_0xbeede5[_0x3978('0x10')][_0x3978('0x15')]=_0x24f9f8['ip'];var _0x4c3127={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x3978('0x16'),'method':_0x3978('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0x3978('0x18'),'Authorization':_0x3978('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0x3978('0x1a')](_0x3978('0x1b'))}};var _0x1dbbd6=JSON['stringify'](_0xbeede5);var _0x510069=https[_0x3978('0x1c')](_0x4c3127,function(_0x14e7ca){_0x14e7ca['setEncoding'](_0x3978('0x1d'));var _0x33efc1='';_0x14e7ca['on']('data',function(_0xc65529){_0x33efc1+=_0xc65529;});_0x14e7ca['on'](_0x3978('0x1e'),function(){if(_0x3c4286){return _0x3c4286['status'](_0x14e7ca[_0x3978('0x1f')])[_0x3978('0x20')](JSON[_0x3978('0x21')](_0x33efc1));}});});_0x510069['on'](_0x3978('0x22'),function(_0x294013){if(_0x3c4286){return _0x3c4286['status'](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':'api.jira'}]});}});_0x510069[_0x3978('0x23')](_0x1dbbd6);_0x510069[_0x3978('0x1e')]();}exports[_0x3978('0x24')]=openIssue;exports[_0x3978('0x25')]=function(_0x141c84,_0x35e19b){_0x141c84[_0x3978('0x26')]['ip']=_0x141c84[_0x3978('0x27')][_0x3978('0x28')]||_0x141c84['connection'][_0x3978('0x29')]||_0x141c84['socket'][_0x3978('0x29')]||_0x141c84[_0x3978('0x2a')][_0x3978('0x2b')]['remoteAddress'];return openIssue(_0x141c84[_0x3978('0x26')],_0x35e19b);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index c778284..4f01fcc 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 _0x5b02=['destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put','/:id','update','delete'];(function(_0x3e8c76,_0x554863){var _0x275b17=function(_0x7ef411){while(--_0x7ef411){_0x3e8c76['push'](_0x3e8c76['shift']());}};_0x275b17(++_0x554863);}(_0x5b02,0xe9));var _0x25b0=function(_0xc2c604,_0xf6ffc3){_0xc2c604=_0xc2c604-0x0;var _0x3ec252=_0x5b02[_0xc2c604];return _0x3ec252;};'use strict';var multer=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var path=require(_0x25b0('0x2'));var timeout=require(_0x25b0('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x25b0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x25b0('0x5'));var config=require(_0x25b0('0x6'));var controller=require(_0x25b0('0x7'));router[_0x25b0('0x8')]('/',auth[_0x25b0('0x9')](),controller['index']);router[_0x25b0('0x8')](_0x25b0('0xa'),auth['isAuthenticated'](),controller[_0x25b0('0xb')]);router['get']('/:id',auth[_0x25b0('0x9')](),controller[_0x25b0('0xc')]);router[_0x25b0('0xd')]('/',auth['isAuthenticated'](),controller[_0x25b0('0xe')]);router[_0x25b0('0xf')](_0x25b0('0x10'),auth[_0x25b0('0x9')](),controller[_0x25b0('0x11')]);router[_0x25b0('0x12')](_0x25b0('0x10'),auth[_0x25b0('0x9')](),controller[_0x25b0('0x13')]);module[_0x25b0('0x14')]=router; \ No newline at end of file +var _0x9f62=['../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','describe','post','/:id','delete','util','connect-timeout','express','Router','../../components/interaction/service'];(function(_0xa1e3ca,_0x559022){var _0x5005ab=function(_0x12f90e){while(--_0x12f90e){_0xa1e3ca['push'](_0xa1e3ca['shift']());}};_0x5005ab(++_0x559022);}(_0x9f62,0x154));var _0x29f6=function(_0x4444f7,_0x264fdc){_0x4444f7=_0x4444f7-0x0;var _0x31ed7f=_0x9f62[_0x4444f7];return _0x31ed7f;};'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 diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index c6a0a7d..0faa7ba 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(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7a54,0x106));var _0x47a5=function(_0x502a7b,_0x2b2654){_0x502a7b=_0x502a7b-0x0;var _0xeb23c8=_0x7a54[_0x502a7b];return _0xeb23c8;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7a54,0x106));var _0x47a5=function(_0x22bd95,_0x238916){_0x22bd95=_0x22bd95-0x0;var _0xcd5151=_0x7a54[_0x22bd95];return _0xcd5151;};'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 7b8e5d0..086c881 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 _0x8c46=['filter','VIRTUAL','merge','options','include','JscriptyAnswerReport','rows','catch','includeAll','find','create','body','params','describe','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick'];(function(_0x4ff317,_0x187e20){var _0x1ee505=function(_0x4b58d4){while(--_0x4b58d4){_0x4ff317['push'](_0x4ff317['shift']());}};_0x1ee505(++_0x187e20);}(_0x8c46,0x171));var _0x68c4=function(_0x43bb6e,_0x2209d8){_0x43bb6e=_0x43bb6e-0x0;var _0x4361b5=_0x8c46[_0x43bb6e];return _0x4361b5;};'use strict';var emlformat=require(_0x68c4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x68c4('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x68c4('0x2'));var Mustache=require(_0x68c4('0x3'));var util=require(_0x68c4('0x4'));var path=require(_0x68c4('0x5'));var sox=require(_0x68c4('0x6'));var csv=require(_0x68c4('0x7'));var ejs=require(_0x68c4('0x8'));var fs=require('fs');var fs_extra=require(_0x68c4('0x9'));var _=require(_0x68c4('0xa'));var squel=require(_0x68c4('0xb'));var crypto=require('crypto');var jsforce=require(_0x68c4('0xc'));var deskjs=require(_0x68c4('0xd'));var toCsv=require(_0x68c4('0x7'));var querystring=require('querystring');var Papa=require(_0x68c4('0xe'));var Redis=require(_0x68c4('0xf'));var authService=require(_0x68c4('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x68c4('0x11'));var logger=require(_0x68c4('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x68c4('0x13'));var licenseUtil=require(_0x68c4('0x14'));var db=require(_0x68c4('0x15'))['db'];function respondWithStatusCode(_0x48783b,_0x3a432a){_0x3a432a=_0x3a432a||0xcc;return function(_0x1f5f42){if(_0x1f5f42){return _0x48783b[_0x68c4('0x16')](_0x3a432a);}return _0x48783b['status'](_0x3a432a)[_0x68c4('0x17')]();};}function respondWithResult(_0x14919c,_0x5e1341){_0x5e1341=_0x5e1341||0xc8;return function(_0x52f031){if(_0x52f031){return _0x14919c[_0x68c4('0x18')](_0x5e1341)[_0x68c4('0x19')](_0x52f031);}};}function respondWithFilteredResult(_0x5be0de,_0xc25f7b){return function(_0x4ea2a4){if(_0x4ea2a4){var _0x1a7045=typeof _0xc25f7b['offset']==='undefined'&&typeof _0xc25f7b[_0x68c4('0x1a')]===_0x68c4('0x1b');var _0x4f4797=_0x4ea2a4[_0x68c4('0x1c')];var _0x1d757c=_0x1a7045?0x0:_0xc25f7b[_0x68c4('0x1d')];var _0x33c5c5=_0x1a7045?_0x4ea2a4[_0x68c4('0x1c')]:_0xc25f7b[_0x68c4('0x1d')]+_0xc25f7b[_0x68c4('0x1a')];var _0x415ef2;if(_0x33c5c5>=_0x4f4797){_0x33c5c5=_0x4f4797;_0x415ef2=0xc8;}else{_0x415ef2=0xce;}_0x5be0de[_0x68c4('0x18')](_0x415ef2);return _0x5be0de[_0x68c4('0x1e')](_0x68c4('0x1f'),_0x1d757c+'-'+_0x33c5c5+'/'+_0x4f4797)['json'](_0x4ea2a4);}return null;};}function patchUpdates(_0x398a71){return function(_0x4edf9f){try{jsonpatch['apply'](_0x4edf9f,_0x398a71,!![]);}catch(_0x34d3a6){return BPromise[_0x68c4('0x20')](_0x34d3a6);}return _0x4edf9f[_0x68c4('0x21')]();};}function saveUpdates(_0x42f0bc,_0x5b8135){return function(_0x35e865){if(_0x35e865){return _0x35e865[_0x68c4('0x22')](_0x42f0bc)['then'](function(_0x201742){return _0x201742;});}return null;};}function removeEntity(_0x392ccf,_0x45f9be){return function(_0x10278e){if(_0x10278e){return _0x10278e[_0x68c4('0x23')]()[_0x68c4('0x24')](function(){_0x392ccf[_0x68c4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ff4a5,_0x55355d){return function(_0xf16a78){if(!_0xf16a78){_0x2ff4a5[_0x68c4('0x16')](0x194);}return _0xf16a78;};}function handleError(_0x57f32,_0x4f9d32){_0x4f9d32=_0x4f9d32||0x1f4;return function(_0x1e14db){logger[_0x68c4('0x25')](_0x1e14db[_0x68c4('0x26')]);if(_0x1e14db[_0x68c4('0x27')]){delete _0x1e14db[_0x68c4('0x27')];}_0x57f32[_0x68c4('0x18')](_0x4f9d32)[_0x68c4('0x28')](_0x1e14db);};}exports['index']=function(_0x26d56b,_0x4b4634){var _0x3772b3={},_0x1442ba={},_0x56ed70={'count':0x0,'rows':[]};var _0x2847d1=_[_0x68c4('0x29')](db['JscriptyAnswerReport'][_0x68c4('0x2a')],function(_0x3a1b69){return{'name':_0x3a1b69[_0x68c4('0x2b')],'type':_0x3a1b69[_0x68c4('0x2c')][_0x68c4('0x2d')]};});_0x1442ba[_0x68c4('0x2e')]=_[_0x68c4('0x29')](_0x2847d1,_0x68c4('0x27'));_0x1442ba[_0x68c4('0x2f')]=_[_0x68c4('0x30')](_0x26d56b[_0x68c4('0x2f')]);_0x1442ba[_0x68c4('0x31')]=_[_0x68c4('0x32')](_0x1442ba[_0x68c4('0x2e')],_0x1442ba[_0x68c4('0x2f')]);_0x3772b3[_0x68c4('0x33')]=_[_0x68c4('0x32')](_0x1442ba[_0x68c4('0x2e')],qs['fields'](_0x26d56b[_0x68c4('0x2f')][_0x68c4('0x34')]));_0x3772b3[_0x68c4('0x33')]=_0x3772b3[_0x68c4('0x33')][_0x68c4('0x35')]?_0x3772b3['attributes']:_0x1442ba[_0x68c4('0x2e')];if(!_0x26d56b['query']['hasOwnProperty']('nolimit')){_0x3772b3[_0x68c4('0x1a')]=qs[_0x68c4('0x1a')](_0x26d56b[_0x68c4('0x2f')][_0x68c4('0x1a')]);_0x3772b3['offset']=qs[_0x68c4('0x1d')](_0x26d56b[_0x68c4('0x2f')][_0x68c4('0x1d')]);}_0x3772b3['order']=qs[_0x68c4('0x36')](_0x26d56b[_0x68c4('0x2f')][_0x68c4('0x36')]);_0x3772b3[_0x68c4('0x37')]=qs[_0x68c4('0x31')](_[_0x68c4('0x38')](_0x26d56b[_0x68c4('0x2f')],_0x1442ba[_0x68c4('0x31')]),_0x2847d1);if(_0x26d56b[_0x68c4('0x2f')][_0x68c4('0x39')]){_0x3772b3['where']=_['merge'](_0x3772b3[_0x68c4('0x37')],{'$or':_[_0x68c4('0x29')](_0x2847d1,function(_0x460e11){if(_0x460e11[_0x68c4('0x2c')]!==_0x68c4('0x3a')){var _0x13386d={};_0x13386d[_0x460e11[_0x68c4('0x27')]]={'$like':'%'+_0x26d56b[_0x68c4('0x2f')][_0x68c4('0x39')]+'%'};return _0x13386d;}})});}_0x3772b3=_[_0x68c4('0x3b')]({},_0x3772b3,_0x26d56b[_0x68c4('0x3c')]);var _0x30a1cd={'where':_0x3772b3[_0x68c4('0x37')]};return db['JscriptyAnswerReport']['count'](_0x30a1cd)[_0x68c4('0x24')](function(_0x2785b4){_0x56ed70[_0x68c4('0x1c')]=_0x2785b4;if(_0x26d56b[_0x68c4('0x2f')]['includeAll']){_0x3772b3[_0x68c4('0x3d')]=[{'all':!![]}];}return db[_0x68c4('0x3e')]['findAll'](_0x3772b3);})['then'](function(_0x4c564a){_0x56ed70[_0x68c4('0x3f')]=_0x4c564a;return _0x56ed70;})['then'](respondWithFilteredResult(_0x4b4634,_0x3772b3))[_0x68c4('0x40')](handleError(_0x4b4634,null));};exports['show']=function(_0x18da6f,_0x2406b1){var _0xbd848f={'raw':!![],'where':{'id':_0x18da6f['params']['id']}},_0xefe68d={};_0xefe68d[_0x68c4('0x2e')]=_[_0x68c4('0x30')](db[_0x68c4('0x3e')][_0x68c4('0x2a')]);_0xefe68d['query']=_[_0x68c4('0x30')](_0x18da6f[_0x68c4('0x2f')]);_0xefe68d[_0x68c4('0x31')]=_[_0x68c4('0x32')](_0xefe68d[_0x68c4('0x2e')],_0xefe68d['query']);_0xbd848f['attributes']=_['intersection'](_0xefe68d[_0x68c4('0x2e')],qs[_0x68c4('0x34')](_0x18da6f[_0x68c4('0x2f')][_0x68c4('0x34')]));_0xbd848f['attributes']=_0xbd848f[_0x68c4('0x33')][_0x68c4('0x35')]?_0xbd848f[_0x68c4('0x33')]:_0xefe68d[_0x68c4('0x2e')];if(_0x18da6f[_0x68c4('0x2f')][_0x68c4('0x41')]){_0xbd848f[_0x68c4('0x3d')]=[{'all':!![]}];}_0xbd848f=_[_0x68c4('0x3b')]({},_0xbd848f,_0x18da6f[_0x68c4('0x3c')]);return db[_0x68c4('0x3e')][_0x68c4('0x42')](_0xbd848f)['then'](handleEntityNotFound(_0x2406b1,null))[_0x68c4('0x24')](respondWithResult(_0x2406b1,null))['catch'](handleError(_0x2406b1,null));};exports[_0x68c4('0x43')]=function(_0x44e3c9,_0x463a6b){return db[_0x68c4('0x3e')]['create'](_0x44e3c9[_0x68c4('0x44')],{})['then'](respondWithResult(_0x463a6b,0xc9))[_0x68c4('0x40')](handleError(_0x463a6b,null));};exports[_0x68c4('0x22')]=function(_0x570e25,_0x250941){if(_0x570e25[_0x68c4('0x44')]['id']){delete _0x570e25[_0x68c4('0x44')]['id'];}return db[_0x68c4('0x3e')][_0x68c4('0x42')]({'where':{'id':_0x570e25[_0x68c4('0x45')]['id']}})['then'](handleEntityNotFound(_0x250941,null))[_0x68c4('0x24')](saveUpdates(_0x570e25[_0x68c4('0x44')],null))[_0x68c4('0x24')](respondWithResult(_0x250941,null))[_0x68c4('0x40')](handleError(_0x250941,null));};exports['destroy']=function(_0x40ecf6,_0x19aec2){return db[_0x68c4('0x3e')][_0x68c4('0x42')]({'where':{'id':_0x40ecf6[_0x68c4('0x45')]['id']}})[_0x68c4('0x24')](handleEntityNotFound(_0x19aec2,null))['then'](removeEntity(_0x19aec2,null))[_0x68c4('0x40')](handleError(_0x19aec2,null));};exports[_0x68c4('0x46')]=function(_0x3db854,_0x51db14){return db[_0x68c4('0x3e')][_0x68c4('0x46')]()['then'](respondWithResult(_0x51db14,null))['catch'](handleError(_0x51db14,null));}; \ No newline at end of file +var _0xff2a=['keys','find','create','body','describe','rimraf','zip-dir','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','reject','save','destroy','then','error','stack','name','send','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params'];(function(_0xc36ad0,_0x44f989){var _0x2be436=function(_0x2ba55c){while(--_0x2ba55c){_0xc36ad0['push'](_0xc36ad0['shift']());}};_0x2be436(++_0x44f989);}(_0xff2a,0x93));var _0xaff2=function(_0x4e11e7,_0x42d0b6){_0x4e11e7=_0x4e11e7-0x0;var _0x1d7d39=_0xff2a[_0x4e11e7];return _0x1d7d39;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaff2('0x0'));var zipdir=require(_0xaff2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaff2('0x2'));var moment=require(_0xaff2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xaff2('0x4'));var util=require('util');var path=require(_0xaff2('0x5'));var sox=require(_0xaff2('0x6'));var csv=require('to-csv');var ejs=require(_0xaff2('0x7'));var fs=require('fs');var fs_extra=require(_0xaff2('0x8'));var _=require(_0xaff2('0x9'));var squel=require(_0xaff2('0xa'));var crypto=require(_0xaff2('0xb'));var jsforce=require(_0xaff2('0xc'));var deskjs=require(_0xaff2('0xd'));var toCsv=require(_0xaff2('0xe'));var querystring=require(_0xaff2('0xf'));var Papa=require(_0xaff2('0x10'));var Redis=require('ioredis');var authService=require(_0xaff2('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaff2('0x12'));var logger=require(_0xaff2('0x13'))(_0xaff2('0x14'));var utils=require(_0xaff2('0x15'));var config=require(_0xaff2('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xaff2('0x17'))['db'];function respondWithStatusCode(_0x175f2c,_0x18e9bf){_0x18e9bf=_0x18e9bf||0xcc;return function(_0x58930b){if(_0x58930b){return _0x175f2c[_0xaff2('0x18')](_0x18e9bf);}return _0x175f2c[_0xaff2('0x19')](_0x18e9bf)['end']();};}function respondWithResult(_0x3388d0,_0x56b2d7){_0x56b2d7=_0x56b2d7||0xc8;return function(_0x259c5d){if(_0x259c5d){return _0x3388d0['status'](_0x56b2d7)['json'](_0x259c5d);}};}function respondWithFilteredResult(_0x32ec13,_0x5186d4){return function(_0x423844){if(_0x423844){var _0x19029b=typeof _0x5186d4[_0xaff2('0x1a')]===_0xaff2('0x1b')&&typeof _0x5186d4[_0xaff2('0x1c')]==='undefined';var _0xd2adb8=_0x423844[_0xaff2('0x1d')];var _0x28b387=_0x19029b?0x0:_0x5186d4[_0xaff2('0x1a')];var _0x18591a=_0x19029b?_0x423844[_0xaff2('0x1d')]:_0x5186d4[_0xaff2('0x1a')]+_0x5186d4['limit'];var _0x2e35e8;if(_0x18591a>=_0xd2adb8){_0x18591a=_0xd2adb8;_0x2e35e8=0xc8;}else{_0x2e35e8=0xce;}_0x32ec13['status'](_0x2e35e8);return _0x32ec13[_0xaff2('0x1e')]('Content-Range',_0x28b387+'-'+_0x18591a+'/'+_0xd2adb8)['json'](_0x423844);}return null;};}function patchUpdates(_0x353ed0){return function(_0x4e1d46){try{jsonpatch['apply'](_0x4e1d46,_0x353ed0,!![]);}catch(_0x26bfc4){return BPromise[_0xaff2('0x1f')](_0x26bfc4);}return _0x4e1d46[_0xaff2('0x20')]();};}function saveUpdates(_0x2d1be8,_0x3e2e81){return function(_0x366ac5){if(_0x366ac5){return _0x366ac5['update'](_0x2d1be8)['then'](function(_0x3d0176){return _0x3d0176;});}return null;};}function removeEntity(_0x211cd7,_0x545e23){return function(_0x50d111){if(_0x50d111){return _0x50d111[_0xaff2('0x21')]()[_0xaff2('0x22')](function(){_0x211cd7[_0xaff2('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24ccfb,_0x306eb6){return function(_0x3d3d39){if(!_0x3d3d39){_0x24ccfb[_0xaff2('0x18')](0x194);}return _0x3d3d39;};}function handleError(_0xac61b9,_0x19635b){_0x19635b=_0x19635b||0x1f4;return function(_0x28d59c){logger[_0xaff2('0x23')](_0x28d59c[_0xaff2('0x24')]);if(_0x28d59c[_0xaff2('0x25')]){delete _0x28d59c[_0xaff2('0x25')];}_0xac61b9[_0xaff2('0x19')](_0x19635b)[_0xaff2('0x26')](_0x28d59c);};}exports['index']=function(_0x3ccb90,_0x29a0ca){var _0x58e572={},_0x3bfca4={},_0x3e182f={'count':0x0,'rows':[]};var _0x4d51ff=_[_0xaff2('0x27')](db[_0xaff2('0x28')][_0xaff2('0x29')],function(_0x2b6959){return{'name':_0x2b6959[_0xaff2('0x2a')],'type':_0x2b6959[_0xaff2('0x2b')][_0xaff2('0x2c')]};});_0x3bfca4[_0xaff2('0x2d')]=_[_0xaff2('0x27')](_0x4d51ff,_0xaff2('0x25'));_0x3bfca4['query']=_['keys'](_0x3ccb90['query']);_0x3bfca4[_0xaff2('0x2e')]=_[_0xaff2('0x2f')](_0x3bfca4['model'],_0x3bfca4['query']);_0x58e572[_0xaff2('0x30')]=_[_0xaff2('0x2f')](_0x3bfca4[_0xaff2('0x2d')],qs[_0xaff2('0x31')](_0x3ccb90[_0xaff2('0x32')][_0xaff2('0x31')]));_0x58e572['attributes']=_0x58e572[_0xaff2('0x30')][_0xaff2('0x33')]?_0x58e572[_0xaff2('0x30')]:_0x3bfca4[_0xaff2('0x2d')];if(!_0x3ccb90[_0xaff2('0x32')][_0xaff2('0x34')](_0xaff2('0x35'))){_0x58e572[_0xaff2('0x1c')]=qs[_0xaff2('0x1c')](_0x3ccb90['query']['limit']);_0x58e572[_0xaff2('0x1a')]=qs[_0xaff2('0x1a')](_0x3ccb90[_0xaff2('0x32')][_0xaff2('0x1a')]);}_0x58e572[_0xaff2('0x36')]=qs[_0xaff2('0x37')](_0x3ccb90[_0xaff2('0x32')][_0xaff2('0x37')]);_0x58e572['where']=qs[_0xaff2('0x2e')](_['pick'](_0x3ccb90[_0xaff2('0x32')],_0x3bfca4['filters']),_0x4d51ff);if(_0x3ccb90['query']['filter']){_0x58e572[_0xaff2('0x38')]=_['merge'](_0x58e572[_0xaff2('0x38')],{'$or':_['map'](_0x4d51ff,function(_0x1e08ce){if(_0x1e08ce[_0xaff2('0x2b')]!=='VIRTUAL'){var _0x2d6de0={};_0x2d6de0[_0x1e08ce[_0xaff2('0x25')]]={'$like':'%'+_0x3ccb90['query'][_0xaff2('0x39')]+'%'};return _0x2d6de0;}})});}_0x58e572=_[_0xaff2('0x3a')]({},_0x58e572,_0x3ccb90[_0xaff2('0x3b')]);var _0x2e5a6f={'where':_0x58e572[_0xaff2('0x38')]};return db[_0xaff2('0x28')][_0xaff2('0x1d')](_0x2e5a6f)[_0xaff2('0x22')](function(_0x1e1bfd){_0x3e182f[_0xaff2('0x1d')]=_0x1e1bfd;if(_0x3ccb90[_0xaff2('0x32')][_0xaff2('0x3c')]){_0x58e572['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xaff2('0x3d')](_0x58e572);})[_0xaff2('0x22')](function(_0x4a1d6f){_0x3e182f[_0xaff2('0x3e')]=_0x4a1d6f;return _0x3e182f;})[_0xaff2('0x22')](respondWithFilteredResult(_0x29a0ca,_0x58e572))[_0xaff2('0x3f')](handleError(_0x29a0ca,null));};exports[_0xaff2('0x40')]=function(_0x56b4ab,_0x4ea1cc){var _0x245f44={'raw':!![],'where':{'id':_0x56b4ab[_0xaff2('0x41')]['id']}},_0x303108={};_0x303108[_0xaff2('0x2d')]=_['keys'](db['JscriptyAnswerReport'][_0xaff2('0x29')]);_0x303108['query']=_[_0xaff2('0x42')](_0x56b4ab[_0xaff2('0x32')]);_0x303108[_0xaff2('0x2e')]=_['intersection'](_0x303108[_0xaff2('0x2d')],_0x303108[_0xaff2('0x32')]);_0x245f44[_0xaff2('0x30')]=_['intersection'](_0x303108[_0xaff2('0x2d')],qs[_0xaff2('0x31')](_0x56b4ab[_0xaff2('0x32')][_0xaff2('0x31')]));_0x245f44['attributes']=_0x245f44['attributes'][_0xaff2('0x33')]?_0x245f44[_0xaff2('0x30')]:_0x303108['model'];if(_0x56b4ab[_0xaff2('0x32')]['includeAll']){_0x245f44['include']=[{'all':!![]}];}_0x245f44=_[_0xaff2('0x3a')]({},_0x245f44,_0x56b4ab['options']);return db['JscriptyAnswerReport'][_0xaff2('0x43')](_0x245f44)[_0xaff2('0x22')](handleEntityNotFound(_0x4ea1cc,null))[_0xaff2('0x22')](respondWithResult(_0x4ea1cc,null))[_0xaff2('0x3f')](handleError(_0x4ea1cc,null));};exports[_0xaff2('0x44')]=function(_0xa4b9c5,_0x4cdcf7){return db['JscriptyAnswerReport'][_0xaff2('0x44')](_0xa4b9c5[_0xaff2('0x45')],{})[_0xaff2('0x22')](respondWithResult(_0x4cdcf7,0xc9))[_0xaff2('0x3f')](handleError(_0x4cdcf7,null));};exports['update']=function(_0xd04518,_0x38f241){if(_0xd04518[_0xaff2('0x45')]['id']){delete _0xd04518[_0xaff2('0x45')]['id'];}return db['JscriptyAnswerReport'][_0xaff2('0x43')]({'where':{'id':_0xd04518[_0xaff2('0x41')]['id']}})[_0xaff2('0x22')](handleEntityNotFound(_0x38f241,null))[_0xaff2('0x22')](saveUpdates(_0xd04518[_0xaff2('0x45')],null))[_0xaff2('0x22')](respondWithResult(_0x38f241,null))[_0xaff2('0x3f')](handleError(_0x38f241,null));};exports['destroy']=function(_0x3e6215,_0x2c3855){return db[_0xaff2('0x28')][_0xaff2('0x43')]({'where':{'id':_0x3e6215[_0xaff2('0x41')]['id']}})[_0xaff2('0x22')](handleEntityNotFound(_0x2c3855,null))['then'](removeEntity(_0x2c3855,null))[_0xaff2('0x3f')](handleError(_0x2c3855,null));};exports['describe']=function(_0x31787e,_0x3e2e75){return db['JscriptyAnswerReport'][_0xaff2('0x46')]()[_0xaff2('0x22')](respondWithResult(_0x3e2e75,null))[_0xaff2('0x3f')](handleError(_0x3e2e75,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 56b7234..fff3e29 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 _0x4a15=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','JscriptyAnswerReport','report_jscripty_answers'];(function(_0x35a14d,_0x147792){var _0x5ceaf0=function(_0x5203d9){while(--_0x5203d9){_0x35a14d['push'](_0x35a14d['shift']());}};_0x5ceaf0(++_0x147792);}(_0x4a15,0x1e1));var _0x54a1=function(_0x4409e7,_0x307f17){_0x4409e7=_0x4409e7-0x0;var _0x24c751=_0x4a15[_0x4409e7];return _0x24c751;};'use strict';var _=require(_0x54a1('0x0'));var util=require(_0x54a1('0x1'));var logger=require('../../config/logger')(_0x54a1('0x2'));var moment=require(_0x54a1('0x3'));var BPromise=require(_0x54a1('0x4'));var rp=require(_0x54a1('0x5'));var fs=require('fs');var path=require(_0x54a1('0x6'));var rimraf=require(_0x54a1('0x7'));var config=require(_0x54a1('0x8'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x54a1('0x9')]=function(_0xfb9f9a,_0x41b536){return _0xfb9f9a[_0x54a1('0xa')](_0x54a1('0xb'),attributes,{'tableName':_0x54a1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x171b=['../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x5a6d8b,_0x102446){var _0x2b6546=function(_0x367709){while(--_0x367709){_0x5a6d8b['push'](_0x5a6d8b['shift']());}};_0x2b6546(++_0x102446);}(_0x171b,0xea));var _0xb171=function(_0x3814e7,_0x1f7fc4){_0x3814e7=_0x3814e7-0x0;var _0x4b5d4b=_0x171b[_0x3814e7];return _0x4b5d4b;};'use strict';var _=require('lodash');var util=require(_0xb171('0x0'));var logger=require(_0xb171('0x1'))(_0xb171('0x2'));var moment=require('moment');var BPromise=require(_0xb171('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb171('0x4'));var rimraf=require(_0xb171('0x5'));var config=require(_0xb171('0x6'));var attributes=require(_0xb171('0x7'));module[_0xb171('0x8')]=function(_0x5eb3fa,_0x3d05ef){return _0x5eb3fa[_0xb171('0x9')](_0xb171('0xa'),attributes,{'tableName':_0xb171('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 b03c9a5..8280da0 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 _0x1d7a=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','moment','bluebird','randomstring'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1d7a,0x189));var _0xa1d7=function(_0x28019c,_0x67743){_0x28019c=_0x28019c-0x0;var _0x48ca39=_0x1d7a[_0x28019c];return _0x48ca39;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa1d7('0x0'));var BPromise=require(_0xa1d7('0x1'));var rs=require(_0xa1d7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa1d7('0x3'))['db'];var utils=require(_0xa1d7('0x4'));var logger=require(_0xa1d7('0x5'))(_0xa1d7('0x6'));var config=require('../../config/environment');var jayson=require(_0xa1d7('0x7'));var client=jayson[_0xa1d7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1459eb,_0x3cf6ba,_0x2b8a24){return new BPromise(function(_0x748702,_0x1289cb){return client[_0xa1d7('0x9')](_0x1459eb,_0x2b8a24)[_0xa1d7('0xa')](function(_0x3422b6){logger['info'](_0xa1d7('0xb'),_0x3cf6ba,'request\x20sent');logger[_0xa1d7('0xc')](_0xa1d7('0xd'),_0x3cf6ba,_0xa1d7('0xe'),JSON[_0xa1d7('0xf')](_0x3422b6));if(_0x3422b6['error']){if(_0x3422b6['error'][_0xa1d7('0x10')]===0x1f4){logger[_0xa1d7('0x11')](_0xa1d7('0xb'),_0x3cf6ba,_0x3422b6[_0xa1d7('0x11')]['message']);return _0x1289cb(_0x3422b6[_0xa1d7('0x11')][_0xa1d7('0x12')]);}logger[_0xa1d7('0x11')](_0xa1d7('0xb'),_0x3cf6ba,_0x3422b6[_0xa1d7('0x11')][_0xa1d7('0x12')]);return _0x748702(_0x3422b6[_0xa1d7('0x11')][_0xa1d7('0x12')]);}else{logger[_0xa1d7('0x13')](_0xa1d7('0xb'),_0x3cf6ba,_0xa1d7('0xe'));_0x748702(_0x3422b6[_0xa1d7('0x14')][_0xa1d7('0x12')]);}})[_0xa1d7('0x15')](function(_0x1226b6){logger[_0xa1d7('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x3cf6ba,_0x1226b6);_0x1289cb(_0x1226b6);});});} \ No newline at end of file +var _0x8ca6=['JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyAnswerReport,\x20%s,\x20%s','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','info','request\x20sent','debug'];(function(_0x5cb4f0,_0xb16665){var _0x22208=function(_0xa6ac92){while(--_0xa6ac92){_0x5cb4f0['push'](_0x5cb4f0['shift']());}};_0x22208(++_0xb16665);}(_0x8ca6,0x1be));var _0x68ca=function(_0x334931,_0x4de26a){_0x334931=_0x334931-0x0;var _0x372e10=_0x8ca6[_0x334931];return _0x372e10;};'use strict';var _=require(_0x68ca('0x0'));var util=require('util');var moment=require(_0x68ca('0x1'));var BPromise=require(_0x68ca('0x2'));var rs=require(_0x68ca('0x3'));var fs=require('fs');var Redis=require(_0x68ca('0x4'));var db=require(_0x68ca('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ca('0x6'))(_0x68ca('0x7'));var config=require(_0x68ca('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x68ca('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25a38b,_0x6bbee0,_0xdaf58){return new BPromise(function(_0x1c400c,_0x340c9d){return client['request'](_0x25a38b,_0xdaf58)[_0x68ca('0xa')](function(_0x4b695a){logger[_0x68ca('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x6bbee0,_0x68ca('0xc'));logger[_0x68ca('0xd')](_0x68ca('0xe'),_0x6bbee0,_0x68ca('0xc'),JSON[_0x68ca('0xf')](_0x4b695a));if(_0x4b695a['error']){if(_0x4b695a[_0x68ca('0x10')][_0x68ca('0x11')]===0x1f4){logger[_0x68ca('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x6bbee0,_0x4b695a[_0x68ca('0x10')]['message']);return _0x340c9d(_0x4b695a[_0x68ca('0x10')][_0x68ca('0x12')]);}logger[_0x68ca('0x10')](_0x68ca('0x13'),_0x6bbee0,_0x4b695a[_0x68ca('0x10')]['message']);return _0x1c400c(_0x4b695a['error']['message']);}else{logger[_0x68ca('0xb')](_0x68ca('0x13'),_0x6bbee0,'request\x20sent');_0x1c400c(_0x4b695a['result']['message']);}})['catch'](function(_0x4e795a){logger[_0x68ca('0x10')](_0x68ca('0x13'),_0x6bbee0,_0x4e795a);_0x340c9d(_0x4e795a);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 5deba52..a467d9a 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 _0x3633=['/:id/sessions','getSessions','/:id/answers','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','index','get','/:id','isAuthenticated','show'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3633,0x65));var _0x3363=function(_0x1dc967,_0x5668df){_0x1dc967=_0x1dc967-0x0;var _0x33d0a6=_0x3633[_0x1dc967];return _0x33d0a6;};'use strict';var multer=require(_0x3363('0x0'));var util=require(_0x3363('0x1'));var path=require(_0x3363('0x2'));var timeout=require(_0x3363('0x3'));var express=require(_0x3363('0x4'));var router=express[_0x3363('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3363('0x6'));var interaction=require(_0x3363('0x7'));var config=require(_0x3363('0x8'));var controller=require(_0x3363('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x3363('0xa')]);router[_0x3363('0xb')](_0x3363('0xc'),auth[_0x3363('0xd')](),controller[_0x3363('0xe')]);router[_0x3363('0xb')](_0x3363('0xf'),auth['isAuthenticated'](),controller[_0x3363('0x10')]);router[_0x3363('0xb')](_0x3363('0x11'),auth[_0x3363('0xd')](),controller['getAnswers']);router[_0x3363('0xb')](_0x3363('0x12'),auth[_0x3363('0xd')](),timeout(_0x3363('0x13')),controller[_0x3363('0x14')]);router[_0x3363('0x15')]('/',auth[_0x3363('0xd')](),controller[_0x3363('0x16')]);router[_0x3363('0x15')](_0x3363('0x17'),auth[_0x3363('0xd')](),controller[_0x3363('0x18')]);router['put'](_0x3363('0xc'),auth[_0x3363('0xd')](),controller[_0x3363('0x19')]);router[_0x3363('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x3363('0x1b')]);module[_0x3363('0x1c')]=router; \ No newline at end of file +var _0xc3d0=['delete','destroy','exports','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','/:id/clone','clone','put'];(function(_0x16a330,_0xd7213a){var _0x27a68b=function(_0x5570dd){while(--_0x5570dd){_0x16a330['push'](_0x16a330['shift']());}};_0x27a68b(++_0xd7213a);}(_0xc3d0,0x153));var _0x0c3d=function(_0x3e554b,_0x7d8d19){_0x3e554b=_0x3e554b-0x0;var _0x257067=_0xc3d0[_0x3e554b];return _0x257067;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0c3d('0x0'));var timeout=require('connect-timeout');var express=require(_0x0c3d('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0c3d('0x2'));var interaction=require(_0x0c3d('0x3'));var config=require(_0x0c3d('0x4'));var controller=require(_0x0c3d('0x5'));router[_0x0c3d('0x6')]('/',auth[_0x0c3d('0x7')](),controller[_0x0c3d('0x8')]);router[_0x0c3d('0x6')](_0x0c3d('0x9'),auth[_0x0c3d('0x7')](),controller[_0x0c3d('0xa')]);router[_0x0c3d('0x6')]('/:id/sessions',auth[_0x0c3d('0x7')](),controller[_0x0c3d('0xb')]);router[_0x0c3d('0x6')](_0x0c3d('0xc'),auth[_0x0c3d('0x7')](),controller[_0x0c3d('0xd')]);router[_0x0c3d('0x6')](_0x0c3d('0xe'),auth[_0x0c3d('0x7')](),timeout(_0x0c3d('0xf')),controller[_0x0c3d('0x10')]);router[_0x0c3d('0x11')]('/',auth[_0x0c3d('0x7')](),controller['create']);router[_0x0c3d('0x11')](_0x0c3d('0x12'),auth[_0x0c3d('0x7')](),controller[_0x0c3d('0x13')]);router[_0x0c3d('0x14')](_0x0c3d('0x9'),auth[_0x0c3d('0x7')](),controller['update']);router[_0x0c3d('0x15')](_0x0c3d('0x9'),auth[_0x0c3d('0x7')](),controller[_0x0c3d('0x16')]);module[_0x0c3d('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 4e8144a..4bad34c 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 _0xeac6=['BOOLEAN','sequelize','lodash','util','exports','STRING','TEXT','stringify','isString','formData','setDataValue','format','getDataValue','name'];(function(_0x23477b,_0x4bcd1c){var _0xd6d2e2=function(_0xed3d35){while(--_0xed3d35){_0x23477b['push'](_0x23477b['shift']());}};_0xd6d2e2(++_0x4bcd1c);}(_0xeac6,0xc5));var _0x6eac=function(_0xeebcf3,_0x119794){_0xeebcf3=_0xeebcf3-0x0;var _0x2dda52=_0xeac6[_0xeebcf3];return _0x2dda52;};'use strict';var Sequelize=require(_0x6eac('0x0'));var _=require(_0x6eac('0x1'));var util=require(_0x6eac('0x2'));module[_0x6eac('0x3')]={'name':{'type':Sequelize[_0x6eac('0x4')],'unique':'name'},'description':{'type':Sequelize[_0x6eac('0x4')]},'formData':{'type':Sequelize[_0x6eac('0x5')]('long'),'set':function(_0x444d70){if(_['isObjectLike'](_0x444d70)){this['setDataValue']('formData',JSON[_0x6eac('0x6')](_0x444d70));}else if(_[_0x6eac('0x7')](_0x444d70)){this['setDataValue'](_0x6eac('0x8'),_0x444d70);}else{this[_0x6eac('0x9')](_0x6eac('0x8'),util[_0x6eac('0xa')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x6eac('0xb')](_0x6eac('0xc'))||'',this[_0x6eac('0xb')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x6eac('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x6eac('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0x2077=['exports','STRING','isObjectLike','setDataValue','formData','stringify','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x2077,0x1d9));var _0x7207=function(_0x2851b9,_0x15904e){_0x2851b9=_0x2851b9-0x0;var _0x789341=_0x2077[_0x2851b9];return _0x789341;};'use strict';var Sequelize=require(_0x7207('0x0'));var _=require(_0x7207('0x1'));var util=require(_0x7207('0x2'));module[_0x7207('0x3')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0x7207('0x4')]},'formData':{'type':Sequelize['TEXT']('long'),'set':function(_0x7bc02d){if(_[_0x7207('0x5')](_0x7bc02d)){this[_0x7207('0x6')](_0x7207('0x7'),JSON[_0x7207('0x8')](_0x7bc02d));}else if(_[_0x7207('0x9')](_0x7bc02d)){this[_0x7207('0x6')](_0x7207('0x7'),_0x7bc02d);}else{this[_0x7207('0x6')](_0x7207('0x7'),util['format'](_0x7207('0xa'),this[_0x7207('0xb')]('name')||'',this[_0x7207('0xb')](_0x7207('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x7207('0xd')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 2ff7899..a41a7b2 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 _0x8d62=['fast-json-patch','request-promise','moment','bluebird','mustache','util','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','Projects','UserProfileResource','sendStatus','error','stack','name','send','index','JscriptyProject','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','intersection','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','clone','include','find','omit','updatedAt','body','update','getSessions','findOne','JscriptySessionReport','ProjectId','map','getAnswers','JscriptyAnswerReport','number','indexOf','toString','replace','parse','startTime','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','answer','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','setHeader','Content-type','text/csv','rimraf','zip-dir'];(function(_0x3d07a8,_0x46d1f0){var _0x5bf605=function(_0x2c7274){while(--_0x2c7274){_0x3d07a8['push'](_0x3d07a8['shift']());}};_0x5bf605(++_0x46d1f0);}(_0x8d62,0xf8));var _0x28d6=function(_0x12e6ef,_0x554b17){_0x12e6ef=_0x12e6ef-0x0;var _0x4a4895=_0x8d62[_0x12e6ef];return _0x4a4895;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x28d6('0x0'));var zipdir=require(_0x28d6('0x1'));var jsonpatch=require(_0x28d6('0x2'));var rp=require(_0x28d6('0x3'));var moment=require(_0x28d6('0x4'));var BPromise=require(_0x28d6('0x5'));var Mustache=require(_0x28d6('0x6'));var util=require(_0x28d6('0x7'));var path=require(_0x28d6('0x8'));var sox=require(_0x28d6('0x9'));var csv=require(_0x28d6('0xa'));var ejs=require(_0x28d6('0xb'));var fs=require('fs');var fs_extra=require(_0x28d6('0xc'));var _=require(_0x28d6('0xd'));var squel=require('squel');var crypto=require(_0x28d6('0xe'));var jsforce=require(_0x28d6('0xf'));var deskjs=require(_0x28d6('0x10'));var toCsv=require('to-csv');var querystring=require(_0x28d6('0x11'));var Papa=require('papaparse');var Redis=require(_0x28d6('0x12'));var authService=require(_0x28d6('0x13'));var qs=require(_0x28d6('0x14'));var as=require(_0x28d6('0x15'));var hardwareService=require(_0x28d6('0x16'));var logger=require('../../config/logger')(_0x28d6('0x17'));var utils=require(_0x28d6('0x18'));var config=require(_0x28d6('0x19'));var licenseUtil=require(_0x28d6('0x1a'));var db=require(_0x28d6('0x1b'))['db'];function respondWithStatusCode(_0x240839,_0x2c29bd){_0x2c29bd=_0x2c29bd||0xcc;return function(_0x43d460){if(_0x43d460){return _0x240839['sendStatus'](_0x2c29bd);}return _0x240839[_0x28d6('0x1c')](_0x2c29bd)[_0x28d6('0x1d')]();};}function respondWithResult(_0x33ba38,_0x549b39){_0x549b39=_0x549b39||0xc8;return function(_0x1621ee){if(_0x1621ee){return _0x33ba38['status'](_0x549b39)[_0x28d6('0x1e')](_0x1621ee);}};}function respondWithFilteredResult(_0x425ffb,_0x4b82e2){return function(_0x1881a8){if(_0x1881a8){var _0x159d2a=typeof _0x4b82e2[_0x28d6('0x1f')]===_0x28d6('0x20')&&typeof _0x4b82e2[_0x28d6('0x21')]==='undefined';var _0x35317d=_0x1881a8['count'];var _0x44db1a=_0x159d2a?0x0:_0x4b82e2[_0x28d6('0x1f')];var _0x2824bd=_0x159d2a?_0x1881a8[_0x28d6('0x22')]:_0x4b82e2[_0x28d6('0x1f')]+_0x4b82e2[_0x28d6('0x21')];var _0x2d521d;if(_0x2824bd>=_0x35317d){_0x2824bd=_0x35317d;_0x2d521d=0xc8;}else{_0x2d521d=0xce;}_0x425ffb['status'](_0x2d521d);return _0x425ffb[_0x28d6('0x23')](_0x28d6('0x24'),_0x44db1a+'-'+_0x2824bd+'/'+_0x35317d)['json'](_0x1881a8);}return null;};}function patchUpdates(_0x26362e){return function(_0x24f764){try{jsonpatch[_0x28d6('0x25')](_0x24f764,_0x26362e,!![]);}catch(_0x252c1d){return BPromise[_0x28d6('0x26')](_0x252c1d);}return _0x24f764[_0x28d6('0x27')]();};}function saveUpdates(_0x376a64,_0x506be6){return function(_0xcf8fa0){if(_0xcf8fa0){return _0xcf8fa0['update'](_0x376a64)[_0x28d6('0x28')](function(_0x2288eb){return _0x2288eb;});}return null;};}function removeEntity(_0x455dd6,_0x3d128b){return function(_0x26809d){if(_0x26809d){return _0x26809d[_0x28d6('0x29')]()['then'](function(){var _0x5c4909=_0x26809d[_0x28d6('0x2a')]({'plain':!![]});var _0x2fb6f7=_0x28d6('0x2b');return db[_0x28d6('0x2c')]['destroy']({'where':{'type':_0x2fb6f7,'resourceId':_0x5c4909['id']}})[_0x28d6('0x28')](function(){return _0x26809d;});})[_0x28d6('0x28')](function(){_0x455dd6[_0x28d6('0x1c')](0xcc)[_0x28d6('0x1d')]();});}};}function handleEntityNotFound(_0x4757b1,_0x6a76a){return function(_0x60ded0){if(!_0x60ded0){_0x4757b1[_0x28d6('0x2d')](0x194);}return _0x60ded0;};}function handleError(_0x23ef1c,_0x12f77e){_0x12f77e=_0x12f77e||0x1f4;return function(_0x28aaa6){logger[_0x28d6('0x2e')](_0x28aaa6[_0x28d6('0x2f')]);if(_0x28aaa6[_0x28d6('0x30')]){delete _0x28aaa6['name'];}_0x23ef1c['status'](_0x12f77e)[_0x28d6('0x31')](_0x28aaa6);};}exports[_0x28d6('0x32')]=function(_0x3f4dd1,_0x124404){var _0x324cff={},_0x6b156e={},_0x5dfaaf={'count':0x0,'rows':[]};var _0x146a62=_['map'](db[_0x28d6('0x33')]['rawAttributes'],function(_0x1fc791){return{'name':_0x1fc791[_0x28d6('0x34')],'type':_0x1fc791[_0x28d6('0x35')][_0x28d6('0x36')]};});_0x6b156e[_0x28d6('0x37')]=_['map'](_0x146a62,'name');_0x6b156e[_0x28d6('0x38')]=_[_0x28d6('0x39')](_0x3f4dd1['query']);_0x6b156e[_0x28d6('0x3a')]=_['intersection'](_0x6b156e[_0x28d6('0x37')],_0x6b156e['query']);_0x324cff[_0x28d6('0x3b')]=_['intersection'](_0x6b156e[_0x28d6('0x37')],qs[_0x28d6('0x3c')](_0x3f4dd1[_0x28d6('0x38')][_0x28d6('0x3c')]));_0x324cff[_0x28d6('0x3b')]=_0x324cff[_0x28d6('0x3b')][_0x28d6('0x3d')]?_0x324cff['attributes']:_0x6b156e[_0x28d6('0x37')];if(!_0x3f4dd1[_0x28d6('0x38')][_0x28d6('0x3e')](_0x28d6('0x3f'))){_0x324cff['limit']=qs[_0x28d6('0x21')](_0x3f4dd1[_0x28d6('0x38')][_0x28d6('0x21')]);_0x324cff[_0x28d6('0x1f')]=qs['offset'](_0x3f4dd1[_0x28d6('0x38')][_0x28d6('0x1f')]);}_0x324cff[_0x28d6('0x40')]=qs[_0x28d6('0x41')](_0x3f4dd1[_0x28d6('0x38')][_0x28d6('0x41')]);_0x324cff[_0x28d6('0x42')]=qs[_0x28d6('0x3a')](_[_0x28d6('0x43')](_0x3f4dd1[_0x28d6('0x38')],_0x6b156e[_0x28d6('0x3a')]),_0x146a62);if(_0x3f4dd1[_0x28d6('0x38')][_0x28d6('0x44')]){_0x324cff[_0x28d6('0x42')]=_[_0x28d6('0x45')](_0x324cff[_0x28d6('0x42')],{'$or':_['map'](_0x146a62,function(_0x5eff10){if(_0x5eff10['type']!==_0x28d6('0x46')){var _0x4914d2={};_0x4914d2[_0x5eff10['name']]={'$like':'%'+_0x3f4dd1[_0x28d6('0x38')]['filter']+'%'};return _0x4914d2;}})});}_0x324cff=_[_0x28d6('0x45')]({},_0x324cff,_0x3f4dd1[_0x28d6('0x47')]);var _0x53362d={'where':_0x324cff[_0x28d6('0x42')]};return db[_0x28d6('0x33')][_0x28d6('0x22')](_0x53362d)[_0x28d6('0x28')](function(_0x3388dc){_0x5dfaaf[_0x28d6('0x22')]=_0x3388dc;if(_0x3f4dd1[_0x28d6('0x38')][_0x28d6('0x48')]){_0x324cff['include']=[{'all':!![]}];}return db[_0x28d6('0x33')][_0x28d6('0x49')](_0x324cff);})['then'](function(_0x25ac32){_0x5dfaaf[_0x28d6('0x4a')]=_0x25ac32;return _0x5dfaaf;})[_0x28d6('0x28')](respondWithFilteredResult(_0x124404,_0x324cff))['catch'](handleError(_0x124404,null));};exports[_0x28d6('0x4b')]=function(_0x5b407e,_0x2a89ec){var _0x1538ef={'raw':![],'where':{'id':_0x5b407e[_0x28d6('0x4c')]['id']}},_0x48ff48={};_0x48ff48[_0x28d6('0x37')]=_[_0x28d6('0x39')](db['JscriptyProject'][_0x28d6('0x4d')]);_0x48ff48[_0x28d6('0x38')]=_[_0x28d6('0x39')](_0x5b407e[_0x28d6('0x38')]);_0x48ff48['filters']=_[_0x28d6('0x4e')](_0x48ff48[_0x28d6('0x37')],_0x48ff48[_0x28d6('0x38')]);_0x1538ef[_0x28d6('0x3b')]=_[_0x28d6('0x4e')](_0x48ff48['model'],qs[_0x28d6('0x3c')](_0x5b407e[_0x28d6('0x38')][_0x28d6('0x3c')]));_0x1538ef[_0x28d6('0x3b')]=_0x1538ef[_0x28d6('0x3b')][_0x28d6('0x3d')]?_0x1538ef[_0x28d6('0x3b')]:_0x48ff48[_0x28d6('0x37')];if(_0x5b407e[_0x28d6('0x38')][_0x28d6('0x48')]){_0x1538ef['include']=[{'all':!![]}];}_0x1538ef=_['merge']({},_0x1538ef,_0x5b407e[_0x28d6('0x47')]);return db['JscriptyProject']['find'](_0x1538ef)['then'](handleEntityNotFound(_0x2a89ec,null))[_0x28d6('0x28')](respondWithResult(_0x2a89ec,null))['catch'](handleError(_0x2a89ec,null));};exports[_0x28d6('0x4f')]=function(_0x543f58,_0x1cfe1f){return db[_0x28d6('0x33')][_0x28d6('0x4f')](_0x543f58['body'],{})['then'](function(_0x4f9000){var _0x2720b1=_0x543f58[_0x28d6('0x50')]['get']({'plain':!![]});if(!_0x2720b1)throw new Error(_0x28d6('0x51'));if(_0x2720b1[_0x28d6('0x52')]===_0x28d6('0x50')){var _0x27e8e6=_0x4f9000[_0x28d6('0x2a')]({'plain':!![]});var _0x20e8cb=_0x28d6('0x2b');return db[_0x28d6('0x53')]['find']({'where':{'name':_0x20e8cb,'userProfileId':_0x2720b1[_0x28d6('0x54')]},'raw':!![]})[_0x28d6('0x28')](function(_0x9fbbe2){if(_0x9fbbe2&&_0x9fbbe2[_0x28d6('0x55')]===0x0){return db[_0x28d6('0x2c')][_0x28d6('0x4f')]({'name':_0x27e8e6[_0x28d6('0x30')],'resourceId':_0x27e8e6['id'],'type':_0x9fbbe2['name'],'sectionId':_0x9fbbe2['id']},{})[_0x28d6('0x28')](function(){return _0x4f9000;});}else{return _0x4f9000;}})['catch'](function(_0x39b2f3){logger[_0x28d6('0x2e')](_0x28d6('0x56'),_0x39b2f3);throw _0x39b2f3;});}return _0x4f9000;})[_0x28d6('0x28')](respondWithResult(_0x1cfe1f,0xc9))[_0x28d6('0x57')](handleError(_0x1cfe1f,null));};exports[_0x28d6('0x58')]=function(_0x5abffc,_0x30e0a3){var _0x5794ae={'where':{'id':_0x5abffc['params']['id']}},_0x22a140={};_0x22a140[_0x28d6('0x37')]=_[_0x28d6('0x39')](db[_0x28d6('0x33')][_0x28d6('0x4d')]);_0x5794ae['attributes']=_[_0x28d6('0x4e')](_0x22a140[_0x28d6('0x37')],qs[_0x28d6('0x3c')](_0x5abffc[_0x28d6('0x38')][_0x28d6('0x3c')]));_0x5794ae[_0x28d6('0x3b')]=_0x5794ae[_0x28d6('0x3b')][_0x28d6('0x3d')]?_0x5794ae[_0x28d6('0x3b')]:_0x22a140[_0x28d6('0x37')];if(_0x5abffc[_0x28d6('0x38')]['includeAll']){_0x5794ae[_0x28d6('0x59')]=[{'all':!![]}];}_0x5794ae=_[_0x28d6('0x45')]({},_0x5794ae,_0x5abffc[_0x28d6('0x47')]);return db[_0x28d6('0x33')][_0x28d6('0x5a')](_0x5794ae)['then'](handleEntityNotFound(_0x30e0a3,null))[_0x28d6('0x28')](function(_0x219967){if(_0x219967){var _0x40cd58=_0x219967[_0x28d6('0x2a')]({'plain':!![]});_0x40cd58=qs[_0x28d6('0x5b')](_0x40cd58,['id','createdAt',_0x28d6('0x5c')]);_0x5abffc[_0x28d6('0x5d')]=_[_0x28d6('0x5b')](_0x5abffc[_0x28d6('0x5d')],['id','createdAt',_0x28d6('0x5c')]);return db['JscriptyProject'][_0x28d6('0x4f')](_[_0x28d6('0x45')](_0x40cd58,_0x5abffc[_0x28d6('0x5d')]),{'include':_0x5abffc['query'][_0x28d6('0x48')]?[{'all':!![]}]:undefined})[_0x28d6('0x28')](function(_0x2fad72){var _0x16ced4=_0x5abffc[_0x28d6('0x50')][_0x28d6('0x2a')]({'plain':!![]});if(!_0x16ced4)throw new Error(_0x28d6('0x51'));if(_0x16ced4['role']===_0x28d6('0x50')){var _0x3daecc=_0x2fad72[_0x28d6('0x2a')]({'plain':!![]});var _0x2cfd63=_0x28d6('0x2b');return db[_0x28d6('0x53')][_0x28d6('0x5a')]({'where':{'name':_0x2cfd63,'userProfileId':_0x16ced4[_0x28d6('0x54')]},'raw':!![]})[_0x28d6('0x28')](function(_0x18d57e){if(_0x18d57e&&_0x18d57e['autoAssociation']===0x0){return db[_0x28d6('0x2c')][_0x28d6('0x4f')]({'name':_0x3daecc[_0x28d6('0x30')],'resourceId':_0x3daecc['id'],'type':_0x18d57e[_0x28d6('0x30')],'sectionId':_0x18d57e['id']},{})[_0x28d6('0x28')](function(){return _0x2fad72;});}else{return _0x2fad72;}})['catch'](function(_0x2322c6){logger[_0x28d6('0x2e')](_0x28d6('0x56'),_0x2322c6);throw _0x2322c6;});}return _0x2fad72;});}})[_0x28d6('0x28')](respondWithResult(_0x30e0a3,0xc9))[_0x28d6('0x57')](handleError(_0x30e0a3,null));};exports[_0x28d6('0x5e')]=function(_0x3341d,_0x534bf5){if(_0x3341d['body']['id']){delete _0x3341d[_0x28d6('0x5d')]['id'];}return db[_0x28d6('0x33')][_0x28d6('0x5a')]({'where':{'id':_0x3341d['params']['id']}})[_0x28d6('0x28')](handleEntityNotFound(_0x534bf5,null))['then'](saveUpdates(_0x3341d['body'],null))[_0x28d6('0x28')](respondWithResult(_0x534bf5,null))[_0x28d6('0x57')](handleError(_0x534bf5,null));};exports[_0x28d6('0x29')]=function(_0x2f0580,_0x45245a){return db[_0x28d6('0x33')][_0x28d6('0x5a')]({'where':{'id':_0x2f0580['params']['id']}})['then'](handleEntityNotFound(_0x45245a,null))['then'](removeEntity(_0x45245a,null))[_0x28d6('0x57')](handleError(_0x45245a,null));};exports[_0x28d6('0x5f')]=function(_0x3b2753,_0x3d80c7,_0xc851a8){var _0x1ad787={'raw':!![],'where':{}};var _0xb37a0a={};var _0xe3745e={'count':0x0,'rows':[]};return db[_0x28d6('0x33')][_0x28d6('0x60')]({'where':{'id':_0x3b2753['params']['id']}})[_0x28d6('0x28')](handleEntityNotFound(_0x3d80c7,null))[_0x28d6('0x28')](function(_0x1d9978){if(_0x1d9978){_0xb37a0a[_0x28d6('0x37')]=_[_0x28d6('0x39')](db[_0x28d6('0x61')][_0x28d6('0x4d')]);_0xb37a0a[_0x28d6('0x38')]=_[_0x28d6('0x39')](_0x3b2753['query']);_0xb37a0a['filters']=_[_0x28d6('0x4e')](_0xb37a0a[_0x28d6('0x37')],_0xb37a0a[_0x28d6('0x38')]);_0x1ad787['attributes']=_[_0x28d6('0x4e')](_0xb37a0a[_0x28d6('0x37')],qs[_0x28d6('0x3c')](_0x3b2753[_0x28d6('0x38')][_0x28d6('0x3c')]));_0x1ad787[_0x28d6('0x3b')]=_0x1ad787[_0x28d6('0x3b')][_0x28d6('0x3d')]?_0x1ad787[_0x28d6('0x3b')]:_0xb37a0a[_0x28d6('0x37')];if(!_0x3b2753[_0x28d6('0x38')][_0x28d6('0x3e')](_0x28d6('0x3f'))){_0x1ad787[_0x28d6('0x21')]=qs[_0x28d6('0x21')](_0x3b2753['query'][_0x28d6('0x21')]);_0x1ad787[_0x28d6('0x1f')]=qs[_0x28d6('0x1f')](_0x3b2753[_0x28d6('0x38')]['offset']);}_0x1ad787[_0x28d6('0x40')]=qs['sort'](_0x3b2753[_0x28d6('0x38')][_0x28d6('0x41')]);_0x1ad787['where']=qs[_0x28d6('0x3a')](_['pick'](_0x3b2753[_0x28d6('0x38')],_0xb37a0a[_0x28d6('0x3a')]));_0x1ad787[_0x28d6('0x42')][_0x28d6('0x62')]=_0x1d9978['id'];if(_0x3b2753[_0x28d6('0x38')][_0x28d6('0x44')]){_0x1ad787['where']=_[_0x28d6('0x45')](_0x1ad787[_0x28d6('0x42')],{'$or':_[_0x28d6('0x63')](_0x1ad787[_0x28d6('0x3b')],function(_0x3d5bd2){var _0x41ac7d={};_0x41ac7d[_0x3d5bd2]={'$like':'%'+_0x3b2753[_0x28d6('0x38')][_0x28d6('0x44')]+'%'};return _0x41ac7d;})});}_0x1ad787=_['merge']({},_0x1ad787,_0x3b2753[_0x28d6('0x47')]);return db[_0x28d6('0x61')][_0x28d6('0x22')]({'where':_0x1ad787['where']})[_0x28d6('0x28')](function(_0xc7bb3b){_0xe3745e[_0x28d6('0x22')]=_0xc7bb3b;if(_0x3b2753[_0x28d6('0x38')]['includeAll']){_0x1ad787['include']=[{'all':!![]}];}return db[_0x28d6('0x61')][_0x28d6('0x49')](_0x1ad787);})['then'](function(_0x15b53a){_0xe3745e['rows']=_0x15b53a;return _0xe3745e;});}})[_0x28d6('0x28')](respondWithFilteredResult(_0x3d80c7,_0x1ad787))[_0x28d6('0x57')](handleError(_0x3d80c7,null));};exports[_0x28d6('0x64')]=function(_0xca226b,_0x55f12c,_0x47dc3e){var _0x2a1f0b={'raw':!![],'where':{}};var _0x5e1ce0={};var _0x261cfb={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x28d6('0x60')]({'where':{'id':_0xca226b[_0x28d6('0x4c')]['id']}})[_0x28d6('0x28')](handleEntityNotFound(_0x55f12c,null))['then'](function(_0x1a615f){if(_0x1a615f){_0x5e1ce0['model']=_[_0x28d6('0x39')](db[_0x28d6('0x65')]['rawAttributes']);_0x5e1ce0[_0x28d6('0x38')]=_[_0x28d6('0x39')](_0xca226b[_0x28d6('0x38')]);_0x5e1ce0['filters']=_[_0x28d6('0x4e')](_0x5e1ce0['model'],_0x5e1ce0[_0x28d6('0x38')]);_0x2a1f0b['attributes']=_[_0x28d6('0x4e')](_0x5e1ce0['model'],qs[_0x28d6('0x3c')](_0xca226b['query'][_0x28d6('0x3c')]));_0x2a1f0b[_0x28d6('0x3b')]=_0x2a1f0b[_0x28d6('0x3b')][_0x28d6('0x3d')]?_0x2a1f0b[_0x28d6('0x3b')]:_0x5e1ce0['model'];if(!_0xca226b[_0x28d6('0x38')][_0x28d6('0x3e')]('nolimit')){_0x2a1f0b[_0x28d6('0x21')]=qs['limit'](_0xca226b[_0x28d6('0x38')][_0x28d6('0x21')]);_0x2a1f0b['offset']=qs[_0x28d6('0x1f')](_0xca226b['query'][_0x28d6('0x1f')]);}_0x2a1f0b[_0x28d6('0x40')]=qs[_0x28d6('0x41')](_0xca226b['query'][_0x28d6('0x41')]);_0x2a1f0b['where']=qs[_0x28d6('0x3a')](_[_0x28d6('0x43')](_0xca226b['query'],_0x5e1ce0[_0x28d6('0x3a')]));_0x2a1f0b[_0x28d6('0x42')][_0x28d6('0x62')]=_0x1a615f['id'];if(_0xca226b[_0x28d6('0x38')][_0x28d6('0x44')]){_0x2a1f0b['where']=_[_0x28d6('0x45')](_0x2a1f0b['where'],{'$or':_['map'](_0x2a1f0b[_0x28d6('0x3b')],function(_0x3ebbcd){var _0x1c6850={};_0x1c6850[_0x3ebbcd]={'$like':'%'+_0xca226b[_0x28d6('0x38')][_0x28d6('0x44')]+'%'};return _0x1c6850;})});}_0x2a1f0b=_[_0x28d6('0x45')]({},_0x2a1f0b,_0xca226b['options']);return db[_0x28d6('0x65')][_0x28d6('0x22')]({'where':_0x2a1f0b['where']})[_0x28d6('0x28')](function(_0x21143d){_0x261cfb[_0x28d6('0x22')]=_0x21143d;if(_0xca226b[_0x28d6('0x38')]['includeAll']){_0x2a1f0b[_0x28d6('0x59')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x28d6('0x49')](_0x2a1f0b);})[_0x28d6('0x28')](function(_0x31e000){_0x261cfb[_0x28d6('0x4a')]=_0x31e000;return _0x261cfb;});}})['then'](respondWithFilteredResult(_0x55f12c,_0x2a1f0b))[_0x28d6('0x57')](handleError(_0x55f12c,null));};function char(_0x15f2c9){return _0x28d6('0x66')===typeof _0x15f2c9?String['fromCharCode'][_0x28d6('0x25')](null,arguments):_0x15f2c9;}function needsEncapsulation(_0x3be657){return!!_0x3be657&&(_0x3be657['toString']()[_0x28d6('0x67')](char(0xd))>=0x0||_0x3be657[_0x28d6('0x68')]()[_0x28d6('0x67')](char(0xa))>=0x0||_0x3be657[_0x28d6('0x68')]()['indexOf'](char(0x2c))>=0x0||_0x3be657[_0x28d6('0x68')]()[_0x28d6('0x67')](char(0x22))>=0x0);}function encapsulate(_0x429563){var _0x9ff014=char(0x22),_0x23cd3e='\x5c'+char(0x22),_0x50e289=_0x429563[_0x28d6('0x68')]()[_0x28d6('0x69')](new RegExp(_0x9ff014,'g'),_0x23cd3e);return _0x9ff014+_0x50e289+_0x9ff014;}exports['getSummary']=function(_0x29c8cd,_0xc09ad7,_0x3bd614){var _0x3a44ae,_0x3b0c05;var _0x933217={'where':{'ProjectId':_0x29c8cd['params']['id']}};if(_0x29c8cd['query']['startTime']){_0x933217[_0x28d6('0x42')]['starttime']=JSON[_0x28d6('0x6a')](_0x29c8cd[_0x28d6('0x38')][_0x28d6('0x6b')]);}return db[_0x28d6('0x61')]['findAll'](_0x933217)[_0x28d6('0x28')](handleEntityNotFound(_0xc09ad7,null))[_0x28d6('0x28')](function(_0x1e91ce){if(_0x1e91ce){_0x3a44ae=_0x1e91ce;return db[_0x28d6('0x6c')][_0x28d6('0x49')]({'where':{'SessionId':{'$in':_[_0x28d6('0x63')](_0x3a44ae,'id')},'ProjectId':_0x29c8cd[_0x28d6('0x4c')]['id']},'order':_0x28d6('0x6d')});}})[_0x28d6('0x28')](handleEntityNotFound(_0xc09ad7,null))[_0x28d6('0x28')](function(_0x184f70){if(_0x184f70){_0x3b0c05=_0x184f70;var _0x17e923={};for(var _0x13b288=0x0,_0x329c8a=_0x3b0c05['length'];_0x13b288<_0x329c8a;_0x13b288++){if(!_0x17e923[_0x28d6('0x3e')](_0x3b0c05[_0x13b288]['questionId'])){_0x17e923[_0x3b0c05[_0x13b288][_0x28d6('0x6e')]]=needsEncapsulation(_0x3b0c05[_0x13b288][_0x28d6('0x6f')])?encapsulate(_0x3b0c05[_0x13b288][_0x28d6('0x6f')]):_0x3b0c05[_0x13b288][_0x28d6('0x6f')];}}var _0x1dabc3=[],_0xad0e98={};for(var _0x260738=0x0,_0x4658c3=_0x3a44ae[_0x28d6('0x3d')];_0x260738<_0x4658c3;_0x260738++){_0xad0e98={'ProjectId':_0x29c8cd[_0x28d6('0x4c')]['id'],'SessionId':_0x3a44ae[_0x260738]['id'],'StartTime':moment(_0x3a44ae[_0x260738][_0x28d6('0x70')])[_0x28d6('0x71')](_0x28d6('0x72'))};for(var _0x4cb4c7=0x0,_0x55e688=_0x3b0c05[_0x28d6('0x3d')];_0x4cb4c7<_0x55e688;_0x4cb4c7++){if(_0x3b0c05[_0x4cb4c7]['SessionId']==_0x3a44ae[_0x260738]['id']&&_0x17e923['hasOwnProperty'](_0x3b0c05[_0x4cb4c7][_0x28d6('0x6e')])){_0xad0e98[_0x17e923[_0x3b0c05[_0x4cb4c7][_0x28d6('0x6e')]]]=_0x3b0c05[_0x4cb4c7][_0x28d6('0x73')];}}for(var _0x2deca4 in _0x17e923){if(!_0xad0e98[_0x28d6('0x3e')](_0x17e923[_0x2deca4])){_0xad0e98[_0x17e923[_0x2deca4]]=null;}}_0x1dabc3['push'](_0xad0e98);}return _0x1dabc3;}})['then'](function(_0x46b411){if(!_[_0x28d6('0x74')](_0x46b411)){var _0xd02fdf=toCsv(_0x46b411);var _0x4edaf8=Date[_0x28d6('0x75')]();fs[_0x28d6('0x76')](util['format'](_0x28d6('0x77'),_0x29c8cd[_0x28d6('0x4c')]['id'],_0x4edaf8),_0xd02fdf);_0xc09ad7['setHeader'](_0x28d6('0x78'),_0x28d6('0x79')+util[_0x28d6('0x71')]('Jscripty_Project_%d_Summary_%s.csv',_0x29c8cd[_0x28d6('0x4c')]['id'],_0x4edaf8));_0xc09ad7[_0x28d6('0x7a')](_0x28d6('0x7b'),_0x28d6('0x7c'));return _0xc09ad7['download'](util[_0x28d6('0x71')](_0x28d6('0x77'),_0x29c8cd[_0x28d6('0x4c')]['id'],_0x4edaf8));}else{return _0xc09ad7[_0x28d6('0x2d')](0xcc);}})[_0x28d6('0x57')](handleError(_0xc09ad7,null));}; \ No newline at end of file +var _0xc2da=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','clone','params','omit','createdAt','updatedAt','find','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','findOne','JscriptySessionReport','ProjectId','getAnswers','JscriptyAnswerReport','findAll','toString','indexOf','replace','getSummary','starttime','parse','startTime','JscriptyQuestionReport','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','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','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','Projects','error','stack','name','send','index','JscriptyProject','rawAttributes','fieldName','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','include','rows','catch','includeAll'];(function(_0x29aac9,_0x21637a){var _0xff8b96=function(_0x9c59dd){while(--_0x9c59dd){_0x29aac9['push'](_0x29aac9['shift']());}};_0xff8b96(++_0x21637a);}(_0xc2da,0x124));var _0xac2d=function(_0x4c432d,_0x435c91){_0x4c432d=_0x4c432d-0x0;var _0x4213b0=_0xc2da[_0x4c432d];return _0x4213b0;};'use strict';var emlformat=require(_0xac2d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xac2d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xac2d('0x2'));var moment=require('moment');var BPromise=require(_0xac2d('0x3'));var Mustache=require(_0xac2d('0x4'));var util=require(_0xac2d('0x5'));var path=require(_0xac2d('0x6'));var sox=require(_0xac2d('0x7'));var csv=require(_0xac2d('0x8'));var ejs=require(_0xac2d('0x9'));var fs=require('fs');var fs_extra=require(_0xac2d('0xa'));var _=require(_0xac2d('0xb'));var squel=require(_0xac2d('0xc'));var crypto=require(_0xac2d('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac2d('0x8'));var querystring=require('querystring');var Papa=require(_0xac2d('0xe'));var Redis=require(_0xac2d('0xf'));var authService=require(_0xac2d('0x10'));var qs=require(_0xac2d('0x11'));var as=require(_0xac2d('0x12'));var hardwareService=require(_0xac2d('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xac2d('0x14'));var config=require(_0xac2d('0x15'));var licenseUtil=require(_0xac2d('0x16'));var db=require(_0xac2d('0x17'))['db'];function respondWithStatusCode(_0x4b9e88,_0x21aa1b){_0x21aa1b=_0x21aa1b||0xcc;return function(_0x20fa0d){if(_0x20fa0d){return _0x4b9e88[_0xac2d('0x18')](_0x21aa1b);}return _0x4b9e88[_0xac2d('0x19')](_0x21aa1b)[_0xac2d('0x1a')]();};}function respondWithResult(_0x2bed84,_0x284984){_0x284984=_0x284984||0xc8;return function(_0x897641){if(_0x897641){return _0x2bed84[_0xac2d('0x19')](_0x284984)[_0xac2d('0x1b')](_0x897641);}};}function respondWithFilteredResult(_0x11a3aa,_0x33d014){return function(_0x74853a){if(_0x74853a){var _0x2d92b5=typeof _0x33d014[_0xac2d('0x1c')]==='undefined'&&typeof _0x33d014[_0xac2d('0x1d')]===_0xac2d('0x1e');var _0x50ac65=_0x74853a[_0xac2d('0x1f')];var _0xed956b=_0x2d92b5?0x0:_0x33d014[_0xac2d('0x1c')];var _0x4d34fa=_0x2d92b5?_0x74853a[_0xac2d('0x1f')]:_0x33d014['offset']+_0x33d014[_0xac2d('0x1d')];var _0x3651e6;if(_0x4d34fa>=_0x50ac65){_0x4d34fa=_0x50ac65;_0x3651e6=0xc8;}else{_0x3651e6=0xce;}_0x11a3aa['status'](_0x3651e6);return _0x11a3aa[_0xac2d('0x20')]('Content-Range',_0xed956b+'-'+_0x4d34fa+'/'+_0x50ac65)['json'](_0x74853a);}return null;};}function patchUpdates(_0x510e85){return function(_0x5eaaef){try{jsonpatch[_0xac2d('0x21')](_0x5eaaef,_0x510e85,!![]);}catch(_0x21c407){return BPromise[_0xac2d('0x22')](_0x21c407);}return _0x5eaaef[_0xac2d('0x23')]();};}function saveUpdates(_0x211d26,_0x391911){return function(_0x3454ea){if(_0x3454ea){return _0x3454ea[_0xac2d('0x24')](_0x211d26)[_0xac2d('0x25')](function(_0x3f1212){return _0x3f1212;});}return null;};}function removeEntity(_0xafa502,_0x226b6b){return function(_0x1df55b){if(_0x1df55b){return _0x1df55b[_0xac2d('0x26')]()[_0xac2d('0x25')](function(){var _0x8d0e32=_0x1df55b[_0xac2d('0x27')]({'plain':!![]});var _0x10da1d=_0xac2d('0x28');return db['UserProfileResource'][_0xac2d('0x26')]({'where':{'type':_0x10da1d,'resourceId':_0x8d0e32['id']}})[_0xac2d('0x25')](function(){return _0x1df55b;});})[_0xac2d('0x25')](function(){_0xafa502[_0xac2d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x543f93,_0x1714c1){return function(_0x1c69f1){if(!_0x1c69f1){_0x543f93[_0xac2d('0x18')](0x194);}return _0x1c69f1;};}function handleError(_0x8c3390,_0x15d043){_0x15d043=_0x15d043||0x1f4;return function(_0x2906ac){logger[_0xac2d('0x29')](_0x2906ac[_0xac2d('0x2a')]);if(_0x2906ac[_0xac2d('0x2b')]){delete _0x2906ac['name'];}_0x8c3390['status'](_0x15d043)[_0xac2d('0x2c')](_0x2906ac);};}exports[_0xac2d('0x2d')]=function(_0x3f1094,_0x44b9d0){var _0x15776b={},_0x49d63f={},_0x778407={'count':0x0,'rows':[]};var _0x37f7ad=_['map'](db[_0xac2d('0x2e')][_0xac2d('0x2f')],function(_0xcd76f0){return{'name':_0xcd76f0[_0xac2d('0x30')],'type':_0xcd76f0['type'][_0xac2d('0x31')]};});_0x49d63f['model']=_[_0xac2d('0x32')](_0x37f7ad,_0xac2d('0x2b'));_0x49d63f['query']=_[_0xac2d('0x33')](_0x3f1094[_0xac2d('0x34')]);_0x49d63f[_0xac2d('0x35')]=_[_0xac2d('0x36')](_0x49d63f[_0xac2d('0x37')],_0x49d63f['query']);_0x15776b[_0xac2d('0x38')]=_['intersection'](_0x49d63f[_0xac2d('0x37')],qs['fields'](_0x3f1094[_0xac2d('0x34')][_0xac2d('0x39')]));_0x15776b['attributes']=_0x15776b['attributes'][_0xac2d('0x3a')]?_0x15776b[_0xac2d('0x38')]:_0x49d63f[_0xac2d('0x37')];if(!_0x3f1094[_0xac2d('0x34')][_0xac2d('0x3b')](_0xac2d('0x3c'))){_0x15776b[_0xac2d('0x1d')]=qs['limit'](_0x3f1094[_0xac2d('0x34')][_0xac2d('0x1d')]);_0x15776b[_0xac2d('0x1c')]=qs[_0xac2d('0x1c')](_0x3f1094[_0xac2d('0x34')]['offset']);}_0x15776b[_0xac2d('0x3d')]=qs[_0xac2d('0x3e')](_0x3f1094[_0xac2d('0x34')][_0xac2d('0x3e')]);_0x15776b[_0xac2d('0x3f')]=qs[_0xac2d('0x35')](_[_0xac2d('0x40')](_0x3f1094[_0xac2d('0x34')],_0x49d63f[_0xac2d('0x35')]),_0x37f7ad);if(_0x3f1094[_0xac2d('0x34')]['filter']){_0x15776b[_0xac2d('0x3f')]=_['merge'](_0x15776b[_0xac2d('0x3f')],{'$or':_[_0xac2d('0x32')](_0x37f7ad,function(_0x392554){if(_0x392554[_0xac2d('0x41')]!==_0xac2d('0x42')){var _0x589012={};_0x589012[_0x392554[_0xac2d('0x2b')]]={'$like':'%'+_0x3f1094[_0xac2d('0x34')][_0xac2d('0x43')]+'%'};return _0x589012;}})});}_0x15776b=_[_0xac2d('0x44')]({},_0x15776b,_0x3f1094[_0xac2d('0x45')]);var _0x5badbf={'where':_0x15776b['where']};return db['JscriptyProject'][_0xac2d('0x1f')](_0x5badbf)[_0xac2d('0x25')](function(_0x3b40e2){_0x778407[_0xac2d('0x1f')]=_0x3b40e2;if(_0x3f1094[_0xac2d('0x34')]['includeAll']){_0x15776b[_0xac2d('0x46')]=[{'all':!![]}];}return db[_0xac2d('0x2e')]['findAll'](_0x15776b);})[_0xac2d('0x25')](function(_0x16c3b0){_0x778407[_0xac2d('0x47')]=_0x16c3b0;return _0x778407;})[_0xac2d('0x25')](respondWithFilteredResult(_0x44b9d0,_0x15776b))[_0xac2d('0x48')](handleError(_0x44b9d0,null));};exports['show']=function(_0x233524,_0x2532e3){var _0x190191={'raw':![],'where':{'id':_0x233524['params']['id']}},_0x26bcaa={};_0x26bcaa['model']=_[_0xac2d('0x33')](db['JscriptyProject'][_0xac2d('0x2f')]);_0x26bcaa[_0xac2d('0x34')]=_['keys'](_0x233524['query']);_0x26bcaa[_0xac2d('0x35')]=_['intersection'](_0x26bcaa['model'],_0x26bcaa['query']);_0x190191[_0xac2d('0x38')]=_[_0xac2d('0x36')](_0x26bcaa[_0xac2d('0x37')],qs['fields'](_0x233524[_0xac2d('0x34')]['fields']));_0x190191[_0xac2d('0x38')]=_0x190191[_0xac2d('0x38')]['length']?_0x190191[_0xac2d('0x38')]:_0x26bcaa[_0xac2d('0x37')];if(_0x233524[_0xac2d('0x34')][_0xac2d('0x49')]){_0x190191[_0xac2d('0x46')]=[{'all':!![]}];}_0x190191=_['merge']({},_0x190191,_0x233524[_0xac2d('0x45')]);return db[_0xac2d('0x2e')]['find'](_0x190191)[_0xac2d('0x25')](handleEntityNotFound(_0x2532e3,null))['then'](respondWithResult(_0x2532e3,null))['catch'](handleError(_0x2532e3,null));};exports[_0xac2d('0x4a')]=function(_0x298bfa,_0x5edfa6){return db[_0xac2d('0x2e')][_0xac2d('0x4a')](_0x298bfa[_0xac2d('0x4b')],{})[_0xac2d('0x25')](function(_0xd53d4e){var _0x1ffa82=_0x298bfa[_0xac2d('0x4c')][_0xac2d('0x27')]({'plain':!![]});if(!_0x1ffa82)throw new Error(_0xac2d('0x4d'));if(_0x1ffa82[_0xac2d('0x4e')]==='user'){var _0x40e747=_0xd53d4e[_0xac2d('0x27')]({'plain':!![]});var _0x3b2c83=_0xac2d('0x28');return db[_0xac2d('0x4f')]['find']({'where':{'name':_0x3b2c83,'userProfileId':_0x1ffa82[_0xac2d('0x50')]},'raw':!![]})['then'](function(_0x51b099){if(_0x51b099&&_0x51b099[_0xac2d('0x51')]===0x0){return db['UserProfileResource'][_0xac2d('0x4a')]({'name':_0x40e747[_0xac2d('0x2b')],'resourceId':_0x40e747['id'],'type':_0x51b099[_0xac2d('0x2b')],'sectionId':_0x51b099['id']},{})[_0xac2d('0x25')](function(){return _0xd53d4e;});}else{return _0xd53d4e;}})[_0xac2d('0x48')](function(_0x3f8327){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f8327);throw _0x3f8327;});}return _0xd53d4e;})[_0xac2d('0x25')](respondWithResult(_0x5edfa6,0xc9))[_0xac2d('0x48')](handleError(_0x5edfa6,null));};exports[_0xac2d('0x52')]=function(_0x28806c,_0x501836){var _0x41baec={'where':{'id':_0x28806c[_0xac2d('0x53')]['id']}},_0xf4531d={};_0xf4531d['model']=_[_0xac2d('0x33')](db[_0xac2d('0x2e')][_0xac2d('0x2f')]);_0x41baec[_0xac2d('0x38')]=_['intersection'](_0xf4531d[_0xac2d('0x37')],qs[_0xac2d('0x39')](_0x28806c[_0xac2d('0x34')]['fields']));_0x41baec[_0xac2d('0x38')]=_0x41baec['attributes'][_0xac2d('0x3a')]?_0x41baec[_0xac2d('0x38')]:_0xf4531d['model'];if(_0x28806c[_0xac2d('0x34')][_0xac2d('0x49')]){_0x41baec[_0xac2d('0x46')]=[{'all':!![]}];}_0x41baec=_[_0xac2d('0x44')]({},_0x41baec,_0x28806c[_0xac2d('0x45')]);return db[_0xac2d('0x2e')]['find'](_0x41baec)['then'](handleEntityNotFound(_0x501836,null))[_0xac2d('0x25')](function(_0x460c34){if(_0x460c34){var _0x3c0196=_0x460c34[_0xac2d('0x27')]({'plain':!![]});_0x3c0196=qs[_0xac2d('0x54')](_0x3c0196,['id',_0xac2d('0x55'),'updatedAt']);_0x28806c[_0xac2d('0x4b')]=_[_0xac2d('0x54')](_0x28806c[_0xac2d('0x4b')],['id',_0xac2d('0x55'),_0xac2d('0x56')]);return db[_0xac2d('0x2e')][_0xac2d('0x4a')](_[_0xac2d('0x44')](_0x3c0196,_0x28806c[_0xac2d('0x4b')]),{'include':_0x28806c['query'][_0xac2d('0x49')]?[{'all':!![]}]:undefined})[_0xac2d('0x25')](function(_0x1be382){var _0xb20d81=_0x28806c[_0xac2d('0x4c')][_0xac2d('0x27')]({'plain':!![]});if(!_0xb20d81)throw new Error(_0xac2d('0x4d'));if(_0xb20d81[_0xac2d('0x4e')]==='user'){var _0x540af1=_0x1be382[_0xac2d('0x27')]({'plain':!![]});var _0x7a56da=_0xac2d('0x28');return db[_0xac2d('0x4f')][_0xac2d('0x57')]({'where':{'name':_0x7a56da,'userProfileId':_0xb20d81[_0xac2d('0x50')]},'raw':!![]})[_0xac2d('0x25')](function(_0x361cb8){if(_0x361cb8&&_0x361cb8[_0xac2d('0x51')]===0x0){return db[_0xac2d('0x58')]['create']({'name':_0x540af1[_0xac2d('0x2b')],'resourceId':_0x540af1['id'],'type':_0x361cb8[_0xac2d('0x2b')],'sectionId':_0x361cb8['id']},{})['then'](function(){return _0x1be382;});}else{return _0x1be382;}})[_0xac2d('0x48')](function(_0xb7b285){logger['error'](_0xac2d('0x59'),_0xb7b285);throw _0xb7b285;});}return _0x1be382;});}})[_0xac2d('0x25')](respondWithResult(_0x501836,0xc9))[_0xac2d('0x48')](handleError(_0x501836,null));};exports[_0xac2d('0x24')]=function(_0x581c4a,_0x594218){if(_0x581c4a['body']['id']){delete _0x581c4a[_0xac2d('0x4b')]['id'];}return db['JscriptyProject'][_0xac2d('0x57')]({'where':{'id':_0x581c4a[_0xac2d('0x53')]['id']}})[_0xac2d('0x25')](handleEntityNotFound(_0x594218,null))['then'](saveUpdates(_0x581c4a['body'],null))[_0xac2d('0x25')](respondWithResult(_0x594218,null))[_0xac2d('0x48')](handleError(_0x594218,null));};exports[_0xac2d('0x26')]=function(_0x28ec4a,_0x2a2e56){return db['JscriptyProject']['find']({'where':{'id':_0x28ec4a[_0xac2d('0x53')]['id']}})['then'](handleEntityNotFound(_0x2a2e56,null))['then'](removeEntity(_0x2a2e56,null))[_0xac2d('0x48')](handleError(_0x2a2e56,null));};exports[_0xac2d('0x5a')]=function(_0x2ef589,_0x424000,_0x1c08ee){var _0x334589={'raw':!![],'where':{}};var _0x88c7c7={};var _0x4379d2={'count':0x0,'rows':[]};return db[_0xac2d('0x2e')][_0xac2d('0x5b')]({'where':{'id':_0x2ef589[_0xac2d('0x53')]['id']}})['then'](handleEntityNotFound(_0x424000,null))['then'](function(_0x175031){if(_0x175031){_0x88c7c7[_0xac2d('0x37')]=_[_0xac2d('0x33')](db[_0xac2d('0x5c')]['rawAttributes']);_0x88c7c7[_0xac2d('0x34')]=_[_0xac2d('0x33')](_0x2ef589[_0xac2d('0x34')]);_0x88c7c7[_0xac2d('0x35')]=_['intersection'](_0x88c7c7[_0xac2d('0x37')],_0x88c7c7[_0xac2d('0x34')]);_0x334589[_0xac2d('0x38')]=_[_0xac2d('0x36')](_0x88c7c7[_0xac2d('0x37')],qs[_0xac2d('0x39')](_0x2ef589[_0xac2d('0x34')][_0xac2d('0x39')]));_0x334589[_0xac2d('0x38')]=_0x334589[_0xac2d('0x38')]['length']?_0x334589[_0xac2d('0x38')]:_0x88c7c7[_0xac2d('0x37')];if(!_0x2ef589[_0xac2d('0x34')][_0xac2d('0x3b')]('nolimit')){_0x334589[_0xac2d('0x1d')]=qs[_0xac2d('0x1d')](_0x2ef589[_0xac2d('0x34')][_0xac2d('0x1d')]);_0x334589[_0xac2d('0x1c')]=qs[_0xac2d('0x1c')](_0x2ef589[_0xac2d('0x34')]['offset']);}_0x334589[_0xac2d('0x3d')]=qs[_0xac2d('0x3e')](_0x2ef589[_0xac2d('0x34')]['sort']);_0x334589[_0xac2d('0x3f')]=qs[_0xac2d('0x35')](_[_0xac2d('0x40')](_0x2ef589[_0xac2d('0x34')],_0x88c7c7['filters']));_0x334589[_0xac2d('0x3f')][_0xac2d('0x5d')]=_0x175031['id'];if(_0x2ef589[_0xac2d('0x34')][_0xac2d('0x43')]){_0x334589[_0xac2d('0x3f')]=_[_0xac2d('0x44')](_0x334589[_0xac2d('0x3f')],{'$or':_[_0xac2d('0x32')](_0x334589['attributes'],function(_0x4bd2a1){var _0x35621f={};_0x35621f[_0x4bd2a1]={'$like':'%'+_0x2ef589[_0xac2d('0x34')][_0xac2d('0x43')]+'%'};return _0x35621f;})});}_0x334589=_[_0xac2d('0x44')]({},_0x334589,_0x2ef589['options']);return db[_0xac2d('0x5c')][_0xac2d('0x1f')]({'where':_0x334589[_0xac2d('0x3f')]})['then'](function(_0x3b4b36){_0x4379d2['count']=_0x3b4b36;if(_0x2ef589['query']['includeAll']){_0x334589[_0xac2d('0x46')]=[{'all':!![]}];}return db[_0xac2d('0x5c')]['findAll'](_0x334589);})['then'](function(_0xe67e3d){_0x4379d2[_0xac2d('0x47')]=_0xe67e3d;return _0x4379d2;});}})[_0xac2d('0x25')](respondWithFilteredResult(_0x424000,_0x334589))['catch'](handleError(_0x424000,null));};exports[_0xac2d('0x5e')]=function(_0x388536,_0x5d087d,_0x5eb692){var _0x267c69={'raw':!![],'where':{}};var _0xe7497={};var _0x14beac={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xac2d('0x5b')]({'where':{'id':_0x388536['params']['id']}})[_0xac2d('0x25')](handleEntityNotFound(_0x5d087d,null))['then'](function(_0x3f41b2){if(_0x3f41b2){_0xe7497['model']=_[_0xac2d('0x33')](db['JscriptyAnswerReport']['rawAttributes']);_0xe7497[_0xac2d('0x34')]=_[_0xac2d('0x33')](_0x388536[_0xac2d('0x34')]);_0xe7497[_0xac2d('0x35')]=_['intersection'](_0xe7497[_0xac2d('0x37')],_0xe7497[_0xac2d('0x34')]);_0x267c69['attributes']=_['intersection'](_0xe7497[_0xac2d('0x37')],qs[_0xac2d('0x39')](_0x388536[_0xac2d('0x34')][_0xac2d('0x39')]));_0x267c69['attributes']=_0x267c69[_0xac2d('0x38')][_0xac2d('0x3a')]?_0x267c69[_0xac2d('0x38')]:_0xe7497[_0xac2d('0x37')];if(!_0x388536['query']['hasOwnProperty']('nolimit')){_0x267c69['limit']=qs['limit'](_0x388536['query'][_0xac2d('0x1d')]);_0x267c69['offset']=qs[_0xac2d('0x1c')](_0x388536[_0xac2d('0x34')]['offset']);}_0x267c69[_0xac2d('0x3d')]=qs[_0xac2d('0x3e')](_0x388536[_0xac2d('0x34')]['sort']);_0x267c69[_0xac2d('0x3f')]=qs[_0xac2d('0x35')](_[_0xac2d('0x40')](_0x388536[_0xac2d('0x34')],_0xe7497[_0xac2d('0x35')]));_0x267c69[_0xac2d('0x3f')][_0xac2d('0x5d')]=_0x3f41b2['id'];if(_0x388536[_0xac2d('0x34')][_0xac2d('0x43')]){_0x267c69[_0xac2d('0x3f')]=_[_0xac2d('0x44')](_0x267c69[_0xac2d('0x3f')],{'$or':_[_0xac2d('0x32')](_0x267c69[_0xac2d('0x38')],function(_0xdf3319){var _0x537ae3={};_0x537ae3[_0xdf3319]={'$like':'%'+_0x388536[_0xac2d('0x34')][_0xac2d('0x43')]+'%'};return _0x537ae3;})});}_0x267c69=_[_0xac2d('0x44')]({},_0x267c69,_0x388536[_0xac2d('0x45')]);return db[_0xac2d('0x5f')][_0xac2d('0x1f')]({'where':_0x267c69[_0xac2d('0x3f')]})[_0xac2d('0x25')](function(_0x44e1c0){_0x14beac['count']=_0x44e1c0;if(_0x388536['query'][_0xac2d('0x49')]){_0x267c69[_0xac2d('0x46')]=[{'all':!![]}];}return db[_0xac2d('0x5f')][_0xac2d('0x60')](_0x267c69);})[_0xac2d('0x25')](function(_0x8d5065){_0x14beac[_0xac2d('0x47')]=_0x8d5065;return _0x14beac;});}})['then'](respondWithFilteredResult(_0x5d087d,_0x267c69))[_0xac2d('0x48')](handleError(_0x5d087d,null));};function char(_0x26495d){return'number'===typeof _0x26495d?String['fromCharCode']['apply'](null,arguments):_0x26495d;}function needsEncapsulation(_0x47513e){return!!_0x47513e&&(_0x47513e[_0xac2d('0x61')]()['indexOf'](char(0xd))>=0x0||_0x47513e[_0xac2d('0x61')]()[_0xac2d('0x62')](char(0xa))>=0x0||_0x47513e[_0xac2d('0x61')]()[_0xac2d('0x62')](char(0x2c))>=0x0||_0x47513e['toString']()[_0xac2d('0x62')](char(0x22))>=0x0);}function encapsulate(_0x11b149){var _0x408250=char(0x22),_0x1d2566='\x5c'+char(0x22),_0x2f45a3=_0x11b149[_0xac2d('0x61')]()[_0xac2d('0x63')](new RegExp(_0x408250,'g'),_0x1d2566);return _0x408250+_0x2f45a3+_0x408250;}exports[_0xac2d('0x64')]=function(_0x8159f8,_0x99e21e,_0x43cf2c){var _0x1ecc1e,_0x30e469;var _0x2beb62={'where':{'ProjectId':_0x8159f8['params']['id']}};if(_0x8159f8['query']['startTime']){_0x2beb62['where'][_0xac2d('0x65')]=JSON[_0xac2d('0x66')](_0x8159f8['query'][_0xac2d('0x67')]);}return db['JscriptySessionReport'][_0xac2d('0x60')](_0x2beb62)[_0xac2d('0x25')](handleEntityNotFound(_0x99e21e,null))[_0xac2d('0x25')](function(_0x339b85){if(_0x339b85){_0x1ecc1e=_0x339b85;return db[_0xac2d('0x68')]['findAll']({'where':{'SessionId':{'$in':_[_0xac2d('0x32')](_0x1ecc1e,'id')},'ProjectId':_0x8159f8[_0xac2d('0x53')]['id']},'order':_0xac2d('0x69')});}})[_0xac2d('0x25')](handleEntityNotFound(_0x99e21e,null))[_0xac2d('0x25')](function(_0x50b417){if(_0x50b417){_0x30e469=_0x50b417;var _0x3fa640={};for(var _0x28eccc=0x0,_0x128bf0=_0x30e469[_0xac2d('0x3a')];_0x28eccc<_0x128bf0;_0x28eccc++){if(!_0x3fa640[_0xac2d('0x3b')](_0x30e469[_0x28eccc][_0xac2d('0x6a')])){_0x3fa640[_0x30e469[_0x28eccc][_0xac2d('0x6a')]]=needsEncapsulation(_0x30e469[_0x28eccc][_0xac2d('0x6b')])?encapsulate(_0x30e469[_0x28eccc]['question']):_0x30e469[_0x28eccc][_0xac2d('0x6b')];}}var _0x115a33=[],_0x3325bc={};for(var _0x5dad74=0x0,_0x171ced=_0x1ecc1e[_0xac2d('0x3a')];_0x5dad74<_0x171ced;_0x5dad74++){_0x3325bc={'ProjectId':_0x8159f8[_0xac2d('0x53')]['id'],'SessionId':_0x1ecc1e[_0x5dad74]['id'],'StartTime':moment(_0x1ecc1e[_0x5dad74]['starttime'])['format'](_0xac2d('0x6c'))};for(var _0x8cfa47=0x0,_0x335e9d=_0x30e469[_0xac2d('0x3a')];_0x8cfa47<_0x335e9d;_0x8cfa47++){if(_0x30e469[_0x8cfa47][_0xac2d('0x6d')]==_0x1ecc1e[_0x5dad74]['id']&&_0x3fa640[_0xac2d('0x3b')](_0x30e469[_0x8cfa47]['questionId'])){_0x3325bc[_0x3fa640[_0x30e469[_0x8cfa47][_0xac2d('0x6a')]]]=_0x30e469[_0x8cfa47][_0xac2d('0x6e')];}}for(var _0x3029de in _0x3fa640){if(!_0x3325bc['hasOwnProperty'](_0x3fa640[_0x3029de])){_0x3325bc[_0x3fa640[_0x3029de]]=null;}}_0x115a33[_0xac2d('0x6f')](_0x3325bc);}return _0x115a33;}})[_0xac2d('0x25')](function(_0x259d65){if(!_['isEmpty'](_0x259d65)){var _0x32f0e0=toCsv(_0x259d65);var _0x16b465=Date[_0xac2d('0x70')]();fs[_0xac2d('0x71')](util[_0xac2d('0x72')](_0xac2d('0x73'),_0x8159f8[_0xac2d('0x53')]['id'],_0x16b465),_0x32f0e0);_0x99e21e[_0xac2d('0x74')](_0xac2d('0x75'),_0xac2d('0x76')+util[_0xac2d('0x72')](_0xac2d('0x77'),_0x8159f8[_0xac2d('0x53')]['id'],_0x16b465));_0x99e21e[_0xac2d('0x74')]('Content-type',_0xac2d('0x78'));return _0x99e21e[_0xac2d('0x79')](util[_0xac2d('0x72')](_0xac2d('0x73'),_0x8159f8[_0xac2d('0x53')]['id'],_0x16b465));}else{return _0x99e21e[_0xac2d('0x18')](0xcc);}})[_0xac2d('0x48')](handleError(_0x99e21e,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index bc04bc7..be36233 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 _0x089f=['../../config/environment','exports','JscriptyProject','jscripty_projects','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x40696a,_0x110176){var _0x56b95a=function(_0x5c9eb2){while(--_0x5c9eb2){_0x40696a['push'](_0x40696a['shift']());}};_0x56b95a(++_0x110176);}(_0x089f,0x1c7));var _0xf089=function(_0x2e4e26,_0x4ee241){_0x2e4e26=_0x2e4e26-0x0;var _0x4d45cb=_0x089f[_0x2e4e26];return _0x4d45cb;};'use strict';var _=require('lodash');var util=require(_0xf089('0x0'));var logger=require(_0xf089('0x1'))(_0xf089('0x2'));var moment=require(_0xf089('0x3'));var BPromise=require(_0xf089('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf089('0x5'));var rimraf=require(_0xf089('0x6'));var config=require(_0xf089('0x7'));var attributes=require('./jscriptyProject.attributes');module[_0xf089('0x8')]=function(_0x126d3d,_0x21bce2){return _0x126d3d['define'](_0xf089('0x9'),attributes,{'tableName':_0xf089('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf79=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects'];(function(_0x1787dc,_0x236be8){var _0x27d6fb=function(_0x2a21cf){while(--_0x2a21cf){_0x1787dc['push'](_0x1787dc['shift']());}};_0x27d6fb(++_0x236be8);}(_0xaf79,0x82));var _0x9af7=function(_0x1e1c7d,_0x1bb816){_0x1e1c7d=_0x1e1c7d-0x0;var _0x43ecaf=_0xaf79[_0x1e1c7d];return _0x43ecaf;};'use strict';var _=require('lodash');var util=require(_0x9af7('0x0'));var logger=require(_0x9af7('0x1'))(_0x9af7('0x2'));var moment=require(_0x9af7('0x3'));var BPromise=require(_0x9af7('0x4'));var rp=require(_0x9af7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9af7('0x6'));var config=require(_0x9af7('0x7'));var attributes=require(_0x9af7('0x8'));module[_0x9af7('0x9')]=function(_0x52cd01,_0x577aeb){return _0x52cd01[_0x9af7('0xa')](_0x9af7('0xb'),attributes,{'tableName':_0x9af7('0xc'),'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 360fdaa..3220791 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 _0xa9e0=['http','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\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(_0x203713,_0x436643){var _0x2c694d=function(_0x2fc5a0){while(--_0x2fc5a0){_0x203713['push'](_0x203713['shift']());}};_0x2c694d(++_0x436643);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xda3f=['rpc','jayson/promise','client','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x2ff4bd,_0x4780a6){var _0x28edc6=function(_0x792380){while(--_0x792380){_0x2ff4bd['push'](_0x2ff4bd['shift']());}};_0x28edc6(++_0x4780a6);}(_0xda3f,0xec));var _0xfda3=function(_0x4e8fc9,_0x363b4c){_0x4e8fc9=_0x4e8fc9-0x0;var _0x5c6e32=_0xda3f[_0x4e8fc9];return _0x5c6e32;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 941d12c..ee69366 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 _0x21be=['destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x5be652,_0x129d44){var _0x3c89da=function(_0x2f01ac){while(--_0x2f01ac){_0x5be652['push'](_0x5be652['shift']());}};_0x3c89da(++_0x129d44);}(_0x21be,0xaa));var _0xe21b=function(_0x353598,_0x33e234){_0x353598=_0x353598-0x0;var _0x4cf82e=_0x21be[_0x353598];return _0x4cf82e;};'use strict';var multer=require(_0xe21b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe21b('0x1'));var express=require(_0xe21b('0x2'));var router=express[_0xe21b('0x3')]();var fs_extra=require(_0xe21b('0x4'));var auth=require(_0xe21b('0x5'));var interaction=require(_0xe21b('0x6'));var config=require(_0xe21b('0x7'));var controller=require(_0xe21b('0x8'));router['get']('/',auth[_0xe21b('0x9')](),controller[_0xe21b('0xa')]);router[_0xe21b('0xb')]('/describe',auth[_0xe21b('0x9')](),controller[_0xe21b('0xc')]);router['get'](_0xe21b('0xd'),auth['isAuthenticated'](),controller[_0xe21b('0xe')]);router[_0xe21b('0xf')]('/',auth['isAuthenticated'](),controller[_0xe21b('0x10')]);router[_0xe21b('0x11')](_0xe21b('0xd'),auth[_0xe21b('0x9')](),controller[_0xe21b('0x12')]);router['delete'](_0xe21b('0xd'),auth[_0xe21b('0x9')](),controller[_0xe21b('0x13')]);module[_0xe21b('0x14')]=router; \ No newline at end of file +var _0x1eea=['/:id','show','post','create','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','get','/describe','describe'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x1eea,0x194));var _0xa1ee=function(_0x4d9f57,_0x455059){_0x4d9f57=_0x4d9f57-0x0;var _0x34630d=_0x1eea[_0x4d9f57];return _0x34630d;};'use strict';var multer=require(_0xa1ee('0x0'));var util=require(_0xa1ee('0x1'));var path=require(_0xa1ee('0x2'));var timeout=require(_0xa1ee('0x3'));var express=require(_0xa1ee('0x4'));var router=express['Router']();var fs_extra=require(_0xa1ee('0x5'));var auth=require(_0xa1ee('0x6'));var interaction=require(_0xa1ee('0x7'));var config=require(_0xa1ee('0x8'));var controller=require(_0xa1ee('0x9'));router['get']('/',auth[_0xa1ee('0xa')](),controller['index']);router[_0xa1ee('0xb')](_0xa1ee('0xc'),auth[_0xa1ee('0xa')](),controller[_0xa1ee('0xd')]);router[_0xa1ee('0xb')](_0xa1ee('0xe'),auth[_0xa1ee('0xa')](),controller[_0xa1ee('0xf')]);router[_0xa1ee('0x10')]('/',auth[_0xa1ee('0xa')](),controller[_0xa1ee('0x11')]);router['put'](_0xa1ee('0xe'),auth[_0xa1ee('0xa')](),controller['update']);router[_0xa1ee('0x12')](_0xa1ee('0xe'),auth[_0xa1ee('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 9f54a69..ca82f16 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(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x7a54,0x106));var _0x47a5=function(_0x3edd94,_0x2524c8){_0x3edd94=_0x3edd94-0x0;var _0x2b677f=_0x7a54[_0x3edd94];return _0x2b677f;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7a54,0x106));var _0x47a5=function(_0xf15671,_0x5451a3){_0xf15671=_0xf15671-0x0;var _0x40c90d=_0x7a54[_0xf15671];return _0x40c90d;};'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 ae57d25..da09c7f 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 _0x8036=['to-csv','fs-extra','lodash','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','update','then','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','JscriptyQuestionReport','include','findAll','rows','show','params','fields','catch','body','find','destroy','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox'];(function(_0x198aff,_0x5c37f2){var _0x3ca67b=function(_0x290373){while(--_0x290373){_0x198aff['push'](_0x198aff['shift']());}};_0x3ca67b(++_0x5c37f2);}(_0x8036,0x108));var _0x6803=function(_0x1c9f04,_0x48b590){_0x1c9f04=_0x1c9f04-0x0;var _0x44da1d=_0x8036[_0x1c9f04];return _0x44da1d;};'use strict';var emlformat=require(_0x6803('0x0'));var rimraf=require(_0x6803('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6803('0x2'));var rp=require('request-promise');var moment=require(_0x6803('0x3'));var BPromise=require(_0x6803('0x4'));var Mustache=require(_0x6803('0x5'));var util=require(_0x6803('0x6'));var path=require('path');var sox=require(_0x6803('0x7'));var csv=require(_0x6803('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6803('0x9'));var _=require(_0x6803('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6803('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6803('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6803('0xc'));var authService=require(_0x6803('0xd'));var qs=require(_0x6803('0xe'));var as=require(_0x6803('0xf'));var hardwareService=require(_0x6803('0x10'));var logger=require('../../config/logger')(_0x6803('0x11'));var utils=require(_0x6803('0x12'));var config=require(_0x6803('0x13'));var licenseUtil=require(_0x6803('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x475fd1,_0x94a6b5){_0x94a6b5=_0x94a6b5||0xcc;return function(_0x58470d){if(_0x58470d){return _0x475fd1[_0x6803('0x15')](_0x94a6b5);}return _0x475fd1[_0x6803('0x16')](_0x94a6b5)[_0x6803('0x17')]();};}function respondWithResult(_0xec333f,_0x3554c8){_0x3554c8=_0x3554c8||0xc8;return function(_0x221afd){if(_0x221afd){return _0xec333f['status'](_0x3554c8)[_0x6803('0x18')](_0x221afd);}};}function respondWithFilteredResult(_0x1d7a90,_0x3c8530){return function(_0x35850a){if(_0x35850a){var _0x16b995=typeof _0x3c8530['offset']===_0x6803('0x19')&&typeof _0x3c8530[_0x6803('0x1a')]===_0x6803('0x19');var _0x50fd71=_0x35850a[_0x6803('0x1b')];var _0x2a4f68=_0x16b995?0x0:_0x3c8530[_0x6803('0x1c')];var _0x4e2f69=_0x16b995?_0x35850a[_0x6803('0x1b')]:_0x3c8530[_0x6803('0x1c')]+_0x3c8530[_0x6803('0x1a')];var _0x1cd5d6;if(_0x4e2f69>=_0x50fd71){_0x4e2f69=_0x50fd71;_0x1cd5d6=0xc8;}else{_0x1cd5d6=0xce;}_0x1d7a90['status'](_0x1cd5d6);return _0x1d7a90[_0x6803('0x1d')]('Content-Range',_0x2a4f68+'-'+_0x4e2f69+'/'+_0x50fd71)['json'](_0x35850a);}return null;};}function patchUpdates(_0x4f7e17){return function(_0x827296){try{jsonpatch['apply'](_0x827296,_0x4f7e17,!![]);}catch(_0x241def){return BPromise[_0x6803('0x1e')](_0x241def);}return _0x827296['save']();};}function saveUpdates(_0x30032c,_0x14fec8){return function(_0x49ec87){if(_0x49ec87){return _0x49ec87[_0x6803('0x1f')](_0x30032c)[_0x6803('0x20')](function(_0x44e52d){return _0x44e52d;});}return null;};}function removeEntity(_0x2eb30b,_0x581ae9){return function(_0x3584aa){if(_0x3584aa){return _0x3584aa['destroy']()[_0x6803('0x20')](function(){_0x2eb30b[_0x6803('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f73f7,_0xe0b36c){return function(_0x340e46){if(!_0x340e46){_0x2f73f7[_0x6803('0x15')](0x194);}return _0x340e46;};}function handleError(_0x56bb46,_0x782cf9){_0x782cf9=_0x782cf9||0x1f4;return function(_0x528df6){logger['error'](_0x528df6['stack']);if(_0x528df6[_0x6803('0x21')]){delete _0x528df6[_0x6803('0x21')];}_0x56bb46[_0x6803('0x16')](_0x782cf9)[_0x6803('0x22')](_0x528df6);};}exports['index']=function(_0x199f94,_0x4269c6){var _0x7be6cb={},_0x3d5b1d={},_0xaf2139={'count':0x0,'rows':[]};var _0x3453cb=_[_0x6803('0x23')](db['JscriptyQuestionReport'][_0x6803('0x24')],function(_0x2ce105){return{'name':_0x2ce105[_0x6803('0x25')],'type':_0x2ce105[_0x6803('0x26')][_0x6803('0x27')]};});_0x3d5b1d[_0x6803('0x28')]=_['map'](_0x3453cb,_0x6803('0x21'));_0x3d5b1d['query']=_[_0x6803('0x29')](_0x199f94[_0x6803('0x2a')]);_0x3d5b1d[_0x6803('0x2b')]=_[_0x6803('0x2c')](_0x3d5b1d[_0x6803('0x28')],_0x3d5b1d[_0x6803('0x2a')]);_0x7be6cb[_0x6803('0x2d')]=_[_0x6803('0x2c')](_0x3d5b1d[_0x6803('0x28')],qs['fields'](_0x199f94[_0x6803('0x2a')]['fields']));_0x7be6cb[_0x6803('0x2d')]=_0x7be6cb[_0x6803('0x2d')][_0x6803('0x2e')]?_0x7be6cb[_0x6803('0x2d')]:_0x3d5b1d['model'];if(!_0x199f94['query'][_0x6803('0x2f')](_0x6803('0x30'))){_0x7be6cb[_0x6803('0x1a')]=qs['limit'](_0x199f94['query'][_0x6803('0x1a')]);_0x7be6cb[_0x6803('0x1c')]=qs[_0x6803('0x1c')](_0x199f94[_0x6803('0x2a')][_0x6803('0x1c')]);}_0x7be6cb['order']=qs[_0x6803('0x31')](_0x199f94[_0x6803('0x2a')][_0x6803('0x31')]);_0x7be6cb['where']=qs['filters'](_[_0x6803('0x32')](_0x199f94[_0x6803('0x2a')],_0x3d5b1d[_0x6803('0x2b')]),_0x3453cb);if(_0x199f94['query'][_0x6803('0x33')]){_0x7be6cb['where']=_[_0x6803('0x34')](_0x7be6cb[_0x6803('0x35')],{'$or':_['map'](_0x3453cb,function(_0xf8d342){if(_0xf8d342[_0x6803('0x26')]!==_0x6803('0x36')){var _0x15ca06={};_0x15ca06[_0xf8d342[_0x6803('0x21')]]={'$like':'%'+_0x199f94[_0x6803('0x2a')][_0x6803('0x33')]+'%'};return _0x15ca06;}})});}_0x7be6cb=_[_0x6803('0x34')]({},_0x7be6cb,_0x199f94[_0x6803('0x37')]);var _0x3ca0d0={'where':_0x7be6cb[_0x6803('0x35')]};return db[_0x6803('0x38')][_0x6803('0x1b')](_0x3ca0d0)['then'](function(_0x201204){_0xaf2139[_0x6803('0x1b')]=_0x201204;if(_0x199f94[_0x6803('0x2a')]['includeAll']){_0x7be6cb[_0x6803('0x39')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x6803('0x3a')](_0x7be6cb);})['then'](function(_0x291bc2){_0xaf2139[_0x6803('0x3b')]=_0x291bc2;return _0xaf2139;})[_0x6803('0x20')](respondWithFilteredResult(_0x4269c6,_0x7be6cb))['catch'](handleError(_0x4269c6,null));};exports[_0x6803('0x3c')]=function(_0x539a99,_0x382db3){var _0x513a20={'raw':!![],'where':{'id':_0x539a99[_0x6803('0x3d')]['id']}},_0x48feeb={};_0x48feeb[_0x6803('0x28')]=_[_0x6803('0x29')](db[_0x6803('0x38')][_0x6803('0x24')]);_0x48feeb[_0x6803('0x2a')]=_['keys'](_0x539a99[_0x6803('0x2a')]);_0x48feeb[_0x6803('0x2b')]=_[_0x6803('0x2c')](_0x48feeb[_0x6803('0x28')],_0x48feeb['query']);_0x513a20[_0x6803('0x2d')]=_['intersection'](_0x48feeb[_0x6803('0x28')],qs[_0x6803('0x3e')](_0x539a99[_0x6803('0x2a')][_0x6803('0x3e')]));_0x513a20['attributes']=_0x513a20[_0x6803('0x2d')][_0x6803('0x2e')]?_0x513a20[_0x6803('0x2d')]:_0x48feeb[_0x6803('0x28')];if(_0x539a99[_0x6803('0x2a')]['includeAll']){_0x513a20[_0x6803('0x39')]=[{'all':!![]}];}_0x513a20=_[_0x6803('0x34')]({},_0x513a20,_0x539a99[_0x6803('0x37')]);return db[_0x6803('0x38')]['find'](_0x513a20)[_0x6803('0x20')](handleEntityNotFound(_0x382db3,null))['then'](respondWithResult(_0x382db3,null))[_0x6803('0x3f')](handleError(_0x382db3,null));};exports['create']=function(_0x5bdc8f,_0x44a211){return db[_0x6803('0x38')]['create'](_0x5bdc8f[_0x6803('0x40')],{})[_0x6803('0x20')](respondWithResult(_0x44a211,0xc9))[_0x6803('0x3f')](handleError(_0x44a211,null));};exports[_0x6803('0x1f')]=function(_0x17ed86,_0x368fbf){if(_0x17ed86[_0x6803('0x40')]['id']){delete _0x17ed86[_0x6803('0x40')]['id'];}return db[_0x6803('0x38')][_0x6803('0x41')]({'where':{'id':_0x17ed86['params']['id']}})[_0x6803('0x20')](handleEntityNotFound(_0x368fbf,null))[_0x6803('0x20')](saveUpdates(_0x17ed86['body'],null))[_0x6803('0x20')](respondWithResult(_0x368fbf,null))[_0x6803('0x3f')](handleError(_0x368fbf,null));};exports[_0x6803('0x42')]=function(_0x176ce2,_0x3dc174){return db[_0x6803('0x38')]['find']({'where':{'id':_0x176ce2[_0x6803('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3dc174,null))[_0x6803('0x20')](removeEntity(_0x3dc174,null))[_0x6803('0x3f')](handleError(_0x3dc174,null));};exports[_0x6803('0x43')]=function(_0x16e9b4,_0x55dcc2){return db['JscriptyQuestionReport']['describe']()[_0x6803('0x20')](respondWithResult(_0x55dcc2,null))['catch'](handleError(_0x55dcc2,null));}; \ No newline at end of file +var _0x6d36=['describe','rimraf','zip-dir','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','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','query','intersection','model','attributes','fields','nolimit','sort','where','filters','pick','filter','merge','options','JscriptyQuestionReport','includeAll','include','findAll','rows','catch','params','keys','find','create','body'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6d36,0x129));var _0x66d3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6d36[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x66d3('0x0'));var zipdir=require(_0x66d3('0x1'));var jsonpatch=require(_0x66d3('0x2'));var rp=require(_0x66d3('0x3'));var moment=require(_0x66d3('0x4'));var BPromise=require(_0x66d3('0x5'));var Mustache=require(_0x66d3('0x6'));var util=require(_0x66d3('0x7'));var path=require('path');var sox=require(_0x66d3('0x8'));var csv=require(_0x66d3('0x9'));var ejs=require(_0x66d3('0xa'));var fs=require('fs');var fs_extra=require(_0x66d3('0xb'));var _=require(_0x66d3('0xc'));var squel=require(_0x66d3('0xd'));var crypto=require(_0x66d3('0xe'));var jsforce=require(_0x66d3('0xf'));var deskjs=require(_0x66d3('0x10'));var toCsv=require(_0x66d3('0x9'));var querystring=require('querystring');var Papa=require(_0x66d3('0x11'));var Redis=require(_0x66d3('0x12'));var authService=require(_0x66d3('0x13'));var qs=require(_0x66d3('0x14'));var as=require(_0x66d3('0x15'));var hardwareService=require(_0x66d3('0x16'));var logger=require(_0x66d3('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x66d3('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x66d3('0x19'))['db'];function respondWithStatusCode(_0x38343e,_0x4f4833){_0x4f4833=_0x4f4833||0xcc;return function(_0x250726){if(_0x250726){return _0x38343e['sendStatus'](_0x4f4833);}return _0x38343e[_0x66d3('0x1a')](_0x4f4833)[_0x66d3('0x1b')]();};}function respondWithResult(_0x2128dd,_0x438e6e){_0x438e6e=_0x438e6e||0xc8;return function(_0x531cea){if(_0x531cea){return _0x2128dd[_0x66d3('0x1a')](_0x438e6e)[_0x66d3('0x1c')](_0x531cea);}};}function respondWithFilteredResult(_0x6b0289,_0x28882e){return function(_0x190302){if(_0x190302){var _0x3c615b=typeof _0x28882e[_0x66d3('0x1d')]===_0x66d3('0x1e')&&typeof _0x28882e[_0x66d3('0x1f')]===_0x66d3('0x1e');var _0x149d44=_0x190302[_0x66d3('0x20')];var _0xf8af0a=_0x3c615b?0x0:_0x28882e['offset'];var _0x40d30a=_0x3c615b?_0x190302['count']:_0x28882e['offset']+_0x28882e['limit'];var _0x2f5dd2;if(_0x40d30a>=_0x149d44){_0x40d30a=_0x149d44;_0x2f5dd2=0xc8;}else{_0x2f5dd2=0xce;}_0x6b0289[_0x66d3('0x1a')](_0x2f5dd2);return _0x6b0289[_0x66d3('0x21')](_0x66d3('0x22'),_0xf8af0a+'-'+_0x40d30a+'/'+_0x149d44)[_0x66d3('0x1c')](_0x190302);}return null;};}function patchUpdates(_0x5a8659){return function(_0xcd24fb){try{jsonpatch[_0x66d3('0x23')](_0xcd24fb,_0x5a8659,!![]);}catch(_0x5c6421){return BPromise[_0x66d3('0x24')](_0x5c6421);}return _0xcd24fb[_0x66d3('0x25')]();};}function saveUpdates(_0x57df10,_0x4f3948){return function(_0xc324b6){if(_0xc324b6){return _0xc324b6[_0x66d3('0x26')](_0x57df10)[_0x66d3('0x27')](function(_0x49b500){return _0x49b500;});}return null;};}function removeEntity(_0x1d7b9f,_0x197637){return function(_0x2d17b2){if(_0x2d17b2){return _0x2d17b2[_0x66d3('0x28')]()[_0x66d3('0x27')](function(){_0x1d7b9f['status'](0xcc)[_0x66d3('0x1b')]();});}};}function handleEntityNotFound(_0x104e07,_0x2cc649){return function(_0x110bbc){if(!_0x110bbc){_0x104e07[_0x66d3('0x29')](0x194);}return _0x110bbc;};}function handleError(_0x7fb40c,_0x40aae3){_0x40aae3=_0x40aae3||0x1f4;return function(_0x4d0148){logger[_0x66d3('0x2a')](_0x4d0148[_0x66d3('0x2b')]);if(_0x4d0148[_0x66d3('0x2c')]){delete _0x4d0148['name'];}_0x7fb40c[_0x66d3('0x1a')](_0x40aae3)[_0x66d3('0x2d')](_0x4d0148);};}exports[_0x66d3('0x2e')]=function(_0x77f80c,_0x109ffa){var _0x55f72d={},_0x44f341={},_0x1e900a={'count':0x0,'rows':[]};var _0x4a80b0=_[_0x66d3('0x2f')](db['JscriptyQuestionReport'][_0x66d3('0x30')],function(_0x374d0e){return{'name':_0x374d0e['fieldName'],'type':_0x374d0e['type']['key']};});_0x44f341['model']=_['map'](_0x4a80b0,_0x66d3('0x2c'));_0x44f341[_0x66d3('0x31')]=_['keys'](_0x77f80c[_0x66d3('0x31')]);_0x44f341['filters']=_[_0x66d3('0x32')](_0x44f341[_0x66d3('0x33')],_0x44f341['query']);_0x55f72d[_0x66d3('0x34')]=_[_0x66d3('0x32')](_0x44f341[_0x66d3('0x33')],qs[_0x66d3('0x35')](_0x77f80c[_0x66d3('0x31')]['fields']));_0x55f72d['attributes']=_0x55f72d[_0x66d3('0x34')]['length']?_0x55f72d['attributes']:_0x44f341[_0x66d3('0x33')];if(!_0x77f80c[_0x66d3('0x31')]['hasOwnProperty'](_0x66d3('0x36'))){_0x55f72d[_0x66d3('0x1f')]=qs[_0x66d3('0x1f')](_0x77f80c[_0x66d3('0x31')][_0x66d3('0x1f')]);_0x55f72d[_0x66d3('0x1d')]=qs['offset'](_0x77f80c['query'][_0x66d3('0x1d')]);}_0x55f72d['order']=qs[_0x66d3('0x37')](_0x77f80c[_0x66d3('0x31')][_0x66d3('0x37')]);_0x55f72d[_0x66d3('0x38')]=qs[_0x66d3('0x39')](_[_0x66d3('0x3a')](_0x77f80c[_0x66d3('0x31')],_0x44f341[_0x66d3('0x39')]),_0x4a80b0);if(_0x77f80c[_0x66d3('0x31')][_0x66d3('0x3b')]){_0x55f72d['where']=_[_0x66d3('0x3c')](_0x55f72d['where'],{'$or':_[_0x66d3('0x2f')](_0x4a80b0,function(_0xffbe8c){if(_0xffbe8c['type']!=='VIRTUAL'){var _0x4ac1b7={};_0x4ac1b7[_0xffbe8c[_0x66d3('0x2c')]]={'$like':'%'+_0x77f80c[_0x66d3('0x31')][_0x66d3('0x3b')]+'%'};return _0x4ac1b7;}})});}_0x55f72d=_[_0x66d3('0x3c')]({},_0x55f72d,_0x77f80c[_0x66d3('0x3d')]);var _0x509dcf={'where':_0x55f72d[_0x66d3('0x38')]};return db[_0x66d3('0x3e')][_0x66d3('0x20')](_0x509dcf)[_0x66d3('0x27')](function(_0x577f07){_0x1e900a[_0x66d3('0x20')]=_0x577f07;if(_0x77f80c[_0x66d3('0x31')][_0x66d3('0x3f')]){_0x55f72d[_0x66d3('0x40')]=[{'all':!![]}];}return db[_0x66d3('0x3e')][_0x66d3('0x41')](_0x55f72d);})[_0x66d3('0x27')](function(_0x4ca5a8){_0x1e900a[_0x66d3('0x42')]=_0x4ca5a8;return _0x1e900a;})[_0x66d3('0x27')](respondWithFilteredResult(_0x109ffa,_0x55f72d))[_0x66d3('0x43')](handleError(_0x109ffa,null));};exports['show']=function(_0x477a6f,_0x1b430a){var _0x5d6f7e={'raw':!![],'where':{'id':_0x477a6f[_0x66d3('0x44')]['id']}},_0x3ca362={};_0x3ca362[_0x66d3('0x33')]=_['keys'](db[_0x66d3('0x3e')][_0x66d3('0x30')]);_0x3ca362[_0x66d3('0x31')]=_[_0x66d3('0x45')](_0x477a6f[_0x66d3('0x31')]);_0x3ca362['filters']=_[_0x66d3('0x32')](_0x3ca362['model'],_0x3ca362[_0x66d3('0x31')]);_0x5d6f7e[_0x66d3('0x34')]=_[_0x66d3('0x32')](_0x3ca362[_0x66d3('0x33')],qs['fields'](_0x477a6f['query'][_0x66d3('0x35')]));_0x5d6f7e[_0x66d3('0x34')]=_0x5d6f7e['attributes']['length']?_0x5d6f7e[_0x66d3('0x34')]:_0x3ca362[_0x66d3('0x33')];if(_0x477a6f[_0x66d3('0x31')][_0x66d3('0x3f')]){_0x5d6f7e['include']=[{'all':!![]}];}_0x5d6f7e=_[_0x66d3('0x3c')]({},_0x5d6f7e,_0x477a6f[_0x66d3('0x3d')]);return db[_0x66d3('0x3e')][_0x66d3('0x46')](_0x5d6f7e)[_0x66d3('0x27')](handleEntityNotFound(_0x1b430a,null))[_0x66d3('0x27')](respondWithResult(_0x1b430a,null))[_0x66d3('0x43')](handleError(_0x1b430a,null));};exports[_0x66d3('0x47')]=function(_0x31620b,_0x4ff650){return db['JscriptyQuestionReport']['create'](_0x31620b[_0x66d3('0x48')],{})['then'](respondWithResult(_0x4ff650,0xc9))[_0x66d3('0x43')](handleError(_0x4ff650,null));};exports[_0x66d3('0x26')]=function(_0x5058de,_0x4e0ff5){if(_0x5058de['body']['id']){delete _0x5058de[_0x66d3('0x48')]['id'];}return db[_0x66d3('0x3e')]['find']({'where':{'id':_0x5058de['params']['id']}})[_0x66d3('0x27')](handleEntityNotFound(_0x4e0ff5,null))[_0x66d3('0x27')](saveUpdates(_0x5058de[_0x66d3('0x48')],null))[_0x66d3('0x27')](respondWithResult(_0x4e0ff5,null))[_0x66d3('0x43')](handleError(_0x4e0ff5,null));};exports['destroy']=function(_0x562119,_0x281574){return db['JscriptyQuestionReport'][_0x66d3('0x46')]({'where':{'id':_0x562119['params']['id']}})[_0x66d3('0x27')](handleEntityNotFound(_0x281574,null))[_0x66d3('0x27')](removeEntity(_0x281574,null))['catch'](handleError(_0x281574,null));};exports[_0x66d3('0x49')]=function(_0x47e107,_0x285c84){return db[_0x66d3('0x3e')][_0x66d3('0x49')]()[_0x66d3('0x27')](respondWithResult(_0x285c84,null))[_0x66d3('0x43')](handleError(_0x285c84,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 026c565..668a687 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 _0x0dc5=['JscriptyQuestionReport','report_jscripty_questions','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define'];(function(_0x22d204,_0x42940a){var _0x13be8e=function(_0x2da994){while(--_0x2da994){_0x22d204['push'](_0x22d204['shift']());}};_0x13be8e(++_0x42940a);}(_0x0dc5,0x136));var _0x50dc=function(_0x4248a3,_0x6da3a7){_0x4248a3=_0x4248a3-0x0;var _0xda2fa1=_0x0dc5[_0x4248a3];return _0xda2fa1;};'use strict';var _=require('lodash');var util=require(_0x50dc('0x0'));var logger=require(_0x50dc('0x1'))(_0x50dc('0x2'));var moment=require(_0x50dc('0x3'));var BPromise=require(_0x50dc('0x4'));var rp=require(_0x50dc('0x5'));var fs=require('fs');var path=require(_0x50dc('0x6'));var rimraf=require(_0x50dc('0x7'));var config=require(_0x50dc('0x8'));var attributes=require(_0x50dc('0x9'));module[_0x50dc('0xa')]=function(_0xfb7820,_0x5d9af5){return _0xfb7820[_0x50dc('0xb')](_0x50dc('0xc'),attributes,{'tableName':_0x50dc('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x122c=['path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','report_jscripty_questions','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x25bc29,_0x445390){var _0x501c51=function(_0x40c7a8){while(--_0x40c7a8){_0x25bc29['push'](_0x25bc29['shift']());}};_0x501c51(++_0x445390);}(_0x122c,0xd6));var _0xc122=function(_0x32be22,_0x102c1e){_0x32be22=_0x32be22-0x0;var _0x514e16=_0x122c[_0x32be22];return _0x514e16;};'use strict';var _=require(_0xc122('0x0'));var util=require('util');var logger=require(_0xc122('0x1'))(_0xc122('0x2'));var moment=require(_0xc122('0x3'));var BPromise=require(_0xc122('0x4'));var rp=require(_0xc122('0x5'));var fs=require('fs');var path=require(_0xc122('0x6'));var rimraf=require(_0xc122('0x7'));var config=require(_0xc122('0x8'));var attributes=require(_0xc122('0x9'));module['exports']=function(_0x24a071,_0x9a1189){return _0x24a071['define']('JscriptyQuestionReport',attributes,{'tableName':_0xc122('0xa'),'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 630d707..06ad909 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 _0xbe13=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xbe13,0x141));var _0x3be1=function(_0x2ccc7f,_0x3b6af3){_0x2ccc7f=_0x2ccc7f-0x0;var _0x22fc54=_0xbe13[_0x2ccc7f];return _0x22fc54;};'use strict';var _=require(_0x3be1('0x0'));var util=require(_0x3be1('0x1'));var moment=require('moment');var BPromise=require(_0x3be1('0x2'));var rs=require(_0x3be1('0x3'));var fs=require('fs');var Redis=require(_0x3be1('0x4'));var db=require(_0x3be1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3be1('0x6'))(_0x3be1('0x7'));var config=require(_0x3be1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3be1('0x9')][_0x3be1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34abeb,_0xf55ff5,_0x37e87c){return new BPromise(function(_0x5ebf2f,_0x5e96c4){return client['request'](_0x34abeb,_0x37e87c)['then'](function(_0x568083){logger[_0x3be1('0xb')](_0x3be1('0xc'),_0xf55ff5,'request\x20sent');logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0xf55ff5,_0x3be1('0xd'),JSON[_0x3be1('0xe')](_0x568083));if(_0x568083[_0x3be1('0xf')]){if(_0x568083[_0x3be1('0xf')][_0x3be1('0x10')]===0x1f4){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0xf55ff5,_0x568083[_0x3be1('0xf')][_0x3be1('0x11')]);return _0x5e96c4(_0x568083[_0x3be1('0xf')][_0x3be1('0x11')]);}logger[_0x3be1('0xf')](_0x3be1('0xc'),_0xf55ff5,_0x568083['error'][_0x3be1('0x11')]);return _0x5ebf2f(_0x568083[_0x3be1('0xf')]['message']);}else{logger[_0x3be1('0xb')](_0x3be1('0xc'),_0xf55ff5,_0x3be1('0xd'));_0x5ebf2f(_0x568083[_0x3be1('0x12')][_0x3be1('0x11')]);}})[_0x3be1('0x13')](function(_0x3a62a1){logger['error'](_0x3be1('0xc'),_0xf55ff5,_0x3a62a1);_0x5e96c4(_0x3a62a1);});});} \ No newline at end of file +var _0x971e=['info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x39e3e4,_0x4eaf6b){var _0x3b2720=function(_0x149660){while(--_0x149660){_0x39e3e4['push'](_0x39e3e4['shift']());}};_0x3b2720(++_0x4eaf6b);}(_0x971e,0xf9));var _0xe971=function(_0x49ad0d,_0x4152ec){_0x49ad0d=_0x49ad0d-0x0;var _0x4d6886=_0x971e[_0x49ad0d];return _0x4d6886;};'use strict';var _=require(_0xe971('0x0'));var util=require(_0xe971('0x1'));var moment=require(_0xe971('0x2'));var BPromise=require(_0xe971('0x3'));var rs=require(_0xe971('0x4'));var fs=require('fs');var Redis=require(_0xe971('0x5'));var db=require(_0xe971('0x6'))['db'];var utils=require(_0xe971('0x7'));var logger=require(_0xe971('0x8'))(_0xe971('0x9'));var config=require(_0xe971('0xa'));var jayson=require(_0xe971('0xb'));var client=jayson[_0xe971('0xc')][_0xe971('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x990bfa,_0x4d6ad0,_0x484f2b){return new BPromise(function(_0x54321e,_0x2888bd){return client['request'](_0x990bfa,_0x484f2b)[_0xe971('0xe')](function(_0x2f62aa){logger[_0xe971('0xf')](_0xe971('0x10'),_0x4d6ad0,_0xe971('0x11'));logger[_0xe971('0x12')](_0xe971('0x13'),_0x4d6ad0,_0xe971('0x11'),JSON['stringify'](_0x2f62aa));if(_0x2f62aa[_0xe971('0x14')]){if(_0x2f62aa['error'][_0xe971('0x15')]===0x1f4){logger['error'](_0xe971('0x10'),_0x4d6ad0,_0x2f62aa[_0xe971('0x14')]['message']);return _0x2888bd(_0x2f62aa['error']['message']);}logger[_0xe971('0x14')](_0xe971('0x10'),_0x4d6ad0,_0x2f62aa['error'][_0xe971('0x16')]);return _0x54321e(_0x2f62aa[_0xe971('0x14')][_0xe971('0x16')]);}else{logger[_0xe971('0xf')](_0xe971('0x10'),_0x4d6ad0,_0xe971('0x11'));_0x54321e(_0x2f62aa[_0xe971('0x17')][_0xe971('0x16')]);}})['catch'](function(_0x4ea9b8){logger[_0xe971('0x14')](_0xe971('0x10'),_0x4d6ad0,_0x4ea9b8);_0x2888bd(_0x4ea9b8);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index f26174a..af77eb6 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 _0x9930=['create','put','update','delete','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','getQuestions'];(function(_0xa822a0,_0x38e2cc){var _0xaf7e66=function(_0x349fce){while(--_0x349fce){_0xa822a0['push'](_0xa822a0['shift']());}};_0xaf7e66(++_0x38e2cc);}(_0x9930,0x15a));var _0x0993=function(_0xf8b390,_0x342656){_0xf8b390=_0xf8b390-0x0;var _0x1a11e2=_0x9930[_0xf8b390];return _0x1a11e2;};'use strict';var multer=require(_0x0993('0x0'));var util=require(_0x0993('0x1'));var path=require(_0x0993('0x2'));var timeout=require('connect-timeout');var express=require(_0x0993('0x3'));var router=express['Router']();var fs_extra=require(_0x0993('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0993('0x5'));var config=require(_0x0993('0x6'));var controller=require('./jscriptySessionReport.controller');router[_0x0993('0x7')]('/',auth[_0x0993('0x8')](),controller[_0x0993('0x9')]);router[_0x0993('0x7')](_0x0993('0xa'),auth[_0x0993('0x8')](),controller[_0x0993('0xb')]);router[_0x0993('0x7')](_0x0993('0xc'),auth['isAuthenticated'](),controller[_0x0993('0xd')]);router[_0x0993('0x7')]('/:id/questions',auth[_0x0993('0x8')](),controller[_0x0993('0xe')]);router['post']('/',auth[_0x0993('0x8')](),controller[_0x0993('0xf')]);router[_0x0993('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x0993('0x11')]);router[_0x0993('0x12')](_0x0993('0xc'),auth[_0x0993('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbecf=['multer','util','path','express','Router','fs-extra','../../config/environment','./jscriptySessionReport.controller','get','index','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x19f9e6,_0x4f59a6){var _0x45c862=function(_0x3447fb){while(--_0x3447fb){_0x19f9e6['push'](_0x19f9e6['shift']());}};_0x45c862(++_0x4f59a6);}(_0xbecf,0x69));var _0xfbec=function(_0xe269b1,_0x5eff14){_0xe269b1=_0xe269b1-0x0;var _0x170c61=_0xbecf[_0xe269b1];return _0x170c61;};'use strict';var multer=require(_0xfbec('0x0'));var util=require(_0xfbec('0x1'));var path=require(_0xfbec('0x2'));var timeout=require('connect-timeout');var express=require(_0xfbec('0x3'));var router=express[_0xfbec('0x4')]();var fs_extra=require(_0xfbec('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfbec('0x6'));var controller=require(_0xfbec('0x7'));router[_0xfbec('0x8')]('/',auth['isAuthenticated'](),controller[_0xfbec('0x9')]);router[_0xfbec('0x8')]('/describe',auth[_0xfbec('0xa')](),controller[_0xfbec('0xb')]);router[_0xfbec('0x8')](_0xfbec('0xc'),auth[_0xfbec('0xa')](),controller[_0xfbec('0xd')]);router[_0xfbec('0x8')]('/:id/questions',auth[_0xfbec('0xa')](),controller['getQuestions']);router[_0xfbec('0xe')]('/',auth[_0xfbec('0xa')](),controller[_0xfbec('0xf')]);router[_0xfbec('0x10')]('/:id',auth[_0xfbec('0xa')](),controller[_0xfbec('0x11')]);router[_0xfbec('0x12')](_0xfbec('0xc'),auth[_0xfbec('0xa')](),controller[_0xfbec('0x13')]);module[_0xfbec('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 3b9980d..a3d4b8c 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 _0x93ab=['starttime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','exports','DATE','setDataValue'];(function(_0xd68a7d,_0x59af94){var _0x143847=function(_0x5a4772){while(--_0x5a4772){_0xd68a7d['push'](_0xd68a7d['shift']());}};_0x143847(++_0x59af94);}(_0x93ab,0x17f));var _0xb93a=function(_0x187279,_0x26d152){_0x187279=_0x187279-0x0;var _0x3da59d=_0x93ab[_0x187279];return _0x3da59d;};'use strict';var moment=require(_0xb93a('0x0'));var Sequelize=require('sequelize');module[_0xb93a('0x1')]={'starttime':{'type':Sequelize[_0xb93a('0x2')],'set':function(_0xee2555){this[_0xb93a('0x3')](_0xb93a('0x4'),_0xee2555);this[_0xb93a('0x3')]('endtime',moment()[_0xb93a('0x5')](_0xb93a('0x6')));}},'endtime':{'type':Sequelize[_0xb93a('0x2')]},'membername':{'type':Sequelize[_0xb93a('0x7')]},'projectname':{'type':Sequelize[_0xb93a('0x7')]},'queue':{'type':Sequelize[_0xb93a('0x7')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb93a('0x7')]},'calleridnum':{'type':Sequelize[_0xb93a('0x7')]},'completed':{'type':Sequelize[_0xb93a('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0xd71b=['moment','sequelize','exports','starttime','endtime','format','DATE','STRING'];(function(_0x16f228,_0x175c87){var _0x352517=function(_0x1043ad){while(--_0x1043ad){_0x16f228['push'](_0x16f228['shift']());}};_0x352517(++_0x175c87);}(_0xd71b,0xc0));var _0xbd71=function(_0x31b07e,_0x3ef6ab){_0x31b07e=_0x31b07e-0x0;var _0x55cb63=_0xd71b[_0x31b07e];return _0x55cb63;};'use strict';var moment=require(_0xbd71('0x0'));var Sequelize=require(_0xbd71('0x1'));module[_0xbd71('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x4d9a41){this['setDataValue'](_0xbd71('0x3'),_0x4d9a41);this['setDataValue'](_0xbd71('0x4'),moment()[_0xbd71('0x5')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0xbd71('0x6')]},'membername':{'type':Sequelize[_0xbd71('0x7')]},'projectname':{'type':Sequelize[_0xbd71('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xbd71('0x7')]},'calleridnum':{'type':Sequelize[_0xbd71('0x7')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 3475285..dfd5a9c 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 _0x6e55=['order','where','filter','VIRTUAL','merge','options','then','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','getQuestions','findOne','JscriptyQuestionReport','sort','SessionId','rows','rimraf','zip-dir','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','update','destroy','error','stack','name','index','map','JscriptySessionReport','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x6e55,0x1a7));var _0x56e5=function(_0x1c3844,_0x145508){_0x1c3844=_0x1c3844-0x0;var _0x2f229f=_0x6e55[_0x1c3844];return _0x2f229f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x56e5('0x0'));var zipdir=require(_0x56e5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x56e5('0x2'));var Mustache=require(_0x56e5('0x3'));var util=require('util');var path=require('path');var sox=require(_0x56e5('0x4'));var csv=require(_0x56e5('0x5'));var ejs=require(_0x56e5('0x6'));var fs=require('fs');var fs_extra=require(_0x56e5('0x7'));var _=require(_0x56e5('0x8'));var squel=require(_0x56e5('0x9'));var crypto=require(_0x56e5('0xa'));var jsforce=require(_0x56e5('0xb'));var deskjs=require(_0x56e5('0xc'));var toCsv=require(_0x56e5('0x5'));var querystring=require(_0x56e5('0xd'));var Papa=require(_0x56e5('0xe'));var Redis=require(_0x56e5('0xf'));var authService=require(_0x56e5('0x10'));var qs=require(_0x56e5('0x11'));var as=require(_0x56e5('0x12'));var hardwareService=require(_0x56e5('0x13'));var logger=require(_0x56e5('0x14'))(_0x56e5('0x15'));var utils=require(_0x56e5('0x16'));var config=require(_0x56e5('0x17'));var licenseUtil=require(_0x56e5('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11bfab,_0xbefa41){_0xbefa41=_0xbefa41||0xcc;return function(_0x5954a3){if(_0x5954a3){return _0x11bfab[_0x56e5('0x19')](_0xbefa41);}return _0x11bfab[_0x56e5('0x1a')](_0xbefa41)[_0x56e5('0x1b')]();};}function respondWithResult(_0x407f23,_0x1462fc){_0x1462fc=_0x1462fc||0xc8;return function(_0x441033){if(_0x441033){return _0x407f23[_0x56e5('0x1a')](_0x1462fc)[_0x56e5('0x1c')](_0x441033);}};}function respondWithFilteredResult(_0x9b9591,_0x4ef9e7){return function(_0x21340a){if(_0x21340a){var _0x108942=typeof _0x4ef9e7[_0x56e5('0x1d')]==='undefined'&&typeof _0x4ef9e7[_0x56e5('0x1e')]===_0x56e5('0x1f');var _0x2a70b8=_0x21340a[_0x56e5('0x20')];var _0x4ed38d=_0x108942?0x0:_0x4ef9e7[_0x56e5('0x1d')];var _0xbf3f01=_0x108942?_0x21340a[_0x56e5('0x20')]:_0x4ef9e7[_0x56e5('0x1d')]+_0x4ef9e7[_0x56e5('0x1e')];var _0x1ac5c2;if(_0xbf3f01>=_0x2a70b8){_0xbf3f01=_0x2a70b8;_0x1ac5c2=0xc8;}else{_0x1ac5c2=0xce;}_0x9b9591[_0x56e5('0x1a')](_0x1ac5c2);return _0x9b9591[_0x56e5('0x21')](_0x56e5('0x22'),_0x4ed38d+'-'+_0xbf3f01+'/'+_0x2a70b8)[_0x56e5('0x1c')](_0x21340a);}return null;};}function patchUpdates(_0x5cd915){return function(_0x24c0c3){try{jsonpatch['apply'](_0x24c0c3,_0x5cd915,!![]);}catch(_0x35f502){return BPromise[_0x56e5('0x23')](_0x35f502);}return _0x24c0c3['save']();};}function saveUpdates(_0x573251,_0x5e9c67){return function(_0xca3a69){if(_0xca3a69){return _0xca3a69[_0x56e5('0x24')](_0x573251)['then'](function(_0x36acf6){return _0x36acf6;});}return null;};}function removeEntity(_0x2dc000,_0x3e8524){return function(_0x1fcba7){if(_0x1fcba7){return _0x1fcba7[_0x56e5('0x25')]()['then'](function(){_0x2dc000[_0x56e5('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37cfb0,_0x442a43){return function(_0x2ff1f1){if(!_0x2ff1f1){_0x37cfb0[_0x56e5('0x19')](0x194);}return _0x2ff1f1;};}function handleError(_0x97dddd,_0x3ae4dc){_0x3ae4dc=_0x3ae4dc||0x1f4;return function(_0x3720c4){logger[_0x56e5('0x26')](_0x3720c4[_0x56e5('0x27')]);if(_0x3720c4[_0x56e5('0x28')]){delete _0x3720c4[_0x56e5('0x28')];}_0x97dddd[_0x56e5('0x1a')](_0x3ae4dc)['send'](_0x3720c4);};}exports[_0x56e5('0x29')]=function(_0x255b69,_0x39ef3e){var _0x3ef534={},_0x5028df={},_0x57651a={'count':0x0,'rows':[]};var _0x2603a4=_[_0x56e5('0x2a')](db[_0x56e5('0x2b')]['rawAttributes'],function(_0x2bb80a){return{'name':_0x2bb80a[_0x56e5('0x2c')],'type':_0x2bb80a[_0x56e5('0x2d')][_0x56e5('0x2e')]};});_0x5028df[_0x56e5('0x2f')]=_['map'](_0x2603a4,'name');_0x5028df['query']=_[_0x56e5('0x30')](_0x255b69['query']);_0x5028df[_0x56e5('0x31')]=_[_0x56e5('0x32')](_0x5028df['model'],_0x5028df['query']);_0x3ef534[_0x56e5('0x33')]=_[_0x56e5('0x32')](_0x5028df[_0x56e5('0x2f')],qs[_0x56e5('0x34')](_0x255b69[_0x56e5('0x35')][_0x56e5('0x34')]));_0x3ef534['attributes']=_0x3ef534[_0x56e5('0x33')][_0x56e5('0x36')]?_0x3ef534[_0x56e5('0x33')]:_0x5028df[_0x56e5('0x2f')];if(!_0x255b69['query'][_0x56e5('0x37')](_0x56e5('0x38'))){_0x3ef534[_0x56e5('0x1e')]=qs[_0x56e5('0x1e')](_0x255b69[_0x56e5('0x35')][_0x56e5('0x1e')]);_0x3ef534[_0x56e5('0x1d')]=qs[_0x56e5('0x1d')](_0x255b69['query'][_0x56e5('0x1d')]);}_0x3ef534[_0x56e5('0x39')]=qs['sort'](_0x255b69[_0x56e5('0x35')]['sort']);_0x3ef534[_0x56e5('0x3a')]=qs[_0x56e5('0x31')](_['pick'](_0x255b69[_0x56e5('0x35')],_0x5028df[_0x56e5('0x31')]),_0x2603a4);if(_0x255b69[_0x56e5('0x35')][_0x56e5('0x3b')]){_0x3ef534[_0x56e5('0x3a')]=_['merge'](_0x3ef534[_0x56e5('0x3a')],{'$or':_[_0x56e5('0x2a')](_0x2603a4,function(_0x446d20){if(_0x446d20[_0x56e5('0x2d')]!==_0x56e5('0x3c')){var _0x2324bd={};_0x2324bd[_0x446d20['name']]={'$like':'%'+_0x255b69[_0x56e5('0x35')][_0x56e5('0x3b')]+'%'};return _0x2324bd;}})});}_0x3ef534=_[_0x56e5('0x3d')]({},_0x3ef534,_0x255b69[_0x56e5('0x3e')]);var _0x2daff3={'where':_0x3ef534[_0x56e5('0x3a')]};return db[_0x56e5('0x2b')][_0x56e5('0x20')](_0x2daff3)[_0x56e5('0x3f')](function(_0x1e9c91){_0x57651a[_0x56e5('0x20')]=_0x1e9c91;if(_0x255b69[_0x56e5('0x35')][_0x56e5('0x40')]){_0x3ef534[_0x56e5('0x41')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x56e5('0x42')](_0x3ef534);})[_0x56e5('0x3f')](function(_0x2d436b){_0x57651a['rows']=_0x2d436b;return _0x57651a;})[_0x56e5('0x3f')](respondWithFilteredResult(_0x39ef3e,_0x3ef534))[_0x56e5('0x43')](handleError(_0x39ef3e,null));};exports[_0x56e5('0x44')]=function(_0x10b241,_0x5d031f){var _0x1c3a94={'raw':!![],'where':{'id':_0x10b241[_0x56e5('0x45')]['id']}},_0x5799a5={};_0x5799a5['model']=_[_0x56e5('0x30')](db[_0x56e5('0x2b')][_0x56e5('0x46')]);_0x5799a5[_0x56e5('0x35')]=_['keys'](_0x10b241[_0x56e5('0x35')]);_0x5799a5[_0x56e5('0x31')]=_[_0x56e5('0x32')](_0x5799a5[_0x56e5('0x2f')],_0x5799a5['query']);_0x1c3a94[_0x56e5('0x33')]=_[_0x56e5('0x32')](_0x5799a5['model'],qs[_0x56e5('0x34')](_0x10b241['query'][_0x56e5('0x34')]));_0x1c3a94[_0x56e5('0x33')]=_0x1c3a94[_0x56e5('0x33')]['length']?_0x1c3a94[_0x56e5('0x33')]:_0x5799a5[_0x56e5('0x2f')];if(_0x10b241['query']['includeAll']){_0x1c3a94[_0x56e5('0x41')]=[{'all':!![]}];}_0x1c3a94=_[_0x56e5('0x3d')]({},_0x1c3a94,_0x10b241[_0x56e5('0x3e')]);return db['JscriptySessionReport'][_0x56e5('0x47')](_0x1c3a94)[_0x56e5('0x3f')](handleEntityNotFound(_0x5d031f,null))[_0x56e5('0x3f')](respondWithResult(_0x5d031f,null))[_0x56e5('0x43')](handleError(_0x5d031f,null));};exports[_0x56e5('0x48')]=function(_0x31e5d5,_0x332ed6){return db[_0x56e5('0x2b')][_0x56e5('0x48')](_0x31e5d5['body'],{})[_0x56e5('0x3f')](respondWithResult(_0x332ed6,0xc9))[_0x56e5('0x43')](handleError(_0x332ed6,null));};exports[_0x56e5('0x24')]=function(_0x381faa,_0x1ec021){if(_0x381faa[_0x56e5('0x49')]['id']){delete _0x381faa[_0x56e5('0x49')]['id'];}return db['JscriptySessionReport']['find']({'where':{'id':_0x381faa[_0x56e5('0x45')]['id']}})['then'](handleEntityNotFound(_0x1ec021,null))[_0x56e5('0x3f')](saveUpdates(_0x381faa[_0x56e5('0x49')],null))[_0x56e5('0x3f')](respondWithResult(_0x1ec021,null))[_0x56e5('0x43')](handleError(_0x1ec021,null));};exports['destroy']=function(_0x1eb9ab,_0x222ea2){return db[_0x56e5('0x2b')][_0x56e5('0x47')]({'where':{'id':_0x1eb9ab[_0x56e5('0x45')]['id']}})[_0x56e5('0x3f')](handleEntityNotFound(_0x222ea2,null))[_0x56e5('0x3f')](removeEntity(_0x222ea2,null))[_0x56e5('0x43')](handleError(_0x222ea2,null));};exports['describe']=function(_0xd8edf8,_0x46ccf0){return db[_0x56e5('0x2b')]['describe']()[_0x56e5('0x3f')](respondWithResult(_0x46ccf0,null))[_0x56e5('0x43')](handleError(_0x46ccf0,null));};exports[_0x56e5('0x4a')]=function(_0x3ce7fd,_0x3a78a5,_0x37bc52){var _0x2a89aa={'raw':!![],'where':{}};var _0x46a804={};var _0x56e510={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x56e5('0x4b')]({'where':{'id':_0x3ce7fd[_0x56e5('0x45')]['id']}})[_0x56e5('0x3f')](handleEntityNotFound(_0x3a78a5,null))[_0x56e5('0x3f')](function(_0x51a170){if(_0x51a170){_0x46a804[_0x56e5('0x2f')]=_[_0x56e5('0x30')](db[_0x56e5('0x4c')]['rawAttributes']);_0x46a804['query']=_[_0x56e5('0x30')](_0x3ce7fd[_0x56e5('0x35')]);_0x46a804[_0x56e5('0x31')]=_[_0x56e5('0x32')](_0x46a804['model'],_0x46a804['query']);_0x2a89aa[_0x56e5('0x33')]=_[_0x56e5('0x32')](_0x46a804['model'],qs[_0x56e5('0x34')](_0x3ce7fd[_0x56e5('0x35')][_0x56e5('0x34')]));_0x2a89aa[_0x56e5('0x33')]=_0x2a89aa[_0x56e5('0x33')][_0x56e5('0x36')]?_0x2a89aa[_0x56e5('0x33')]:_0x46a804[_0x56e5('0x2f')];if(!_0x3ce7fd[_0x56e5('0x35')]['hasOwnProperty'](_0x56e5('0x38'))){_0x2a89aa[_0x56e5('0x1e')]=qs[_0x56e5('0x1e')](_0x3ce7fd['query'][_0x56e5('0x1e')]);_0x2a89aa[_0x56e5('0x1d')]=qs['offset'](_0x3ce7fd[_0x56e5('0x35')][_0x56e5('0x1d')]);}_0x2a89aa[_0x56e5('0x39')]=qs[_0x56e5('0x4d')](_0x3ce7fd['query'][_0x56e5('0x4d')]);_0x2a89aa[_0x56e5('0x3a')]=qs[_0x56e5('0x31')](_['pick'](_0x3ce7fd[_0x56e5('0x35')],_0x46a804[_0x56e5('0x31')]));_0x2a89aa[_0x56e5('0x3a')][_0x56e5('0x4e')]=_0x51a170['id'];if(_0x3ce7fd[_0x56e5('0x35')][_0x56e5('0x3b')]){_0x2a89aa['where']=_[_0x56e5('0x3d')](_0x2a89aa[_0x56e5('0x3a')],{'$or':_[_0x56e5('0x2a')](_0x2a89aa['attributes'],function(_0x27d8d0){var _0x571665={};_0x571665[_0x27d8d0]={'$like':'%'+_0x3ce7fd[_0x56e5('0x35')][_0x56e5('0x3b')]+'%'};return _0x571665;})});}_0x2a89aa=_['merge']({},_0x2a89aa,_0x3ce7fd[_0x56e5('0x3e')]);return db[_0x56e5('0x4c')]['count']({'where':_0x2a89aa['where']})['then'](function(_0x44d14a){_0x56e510[_0x56e5('0x20')]=_0x44d14a;if(_0x3ce7fd[_0x56e5('0x35')]['includeAll']){_0x2a89aa['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x56e5('0x42')](_0x2a89aa);})[_0x56e5('0x3f')](function(_0x164c7c){_0x56e510[_0x56e5('0x4f')]=_0x164c7c;return _0x56e510;});}})[_0x56e5('0x3f')](respondWithFilteredResult(_0x3a78a5,_0x2a89aa))[_0x56e5('0x43')](handleError(_0x3a78a5,null));}; \ No newline at end of file +var _0x7f11=['../../config/environment','../../config/license/util','../../mysqldb','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','end','sendStatus','error','stack','name','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','VIRTUAL','merge','then','includeAll','findAll','rows','catch','show','params','options','create','body','destroy','find','describe','findOne','JscriptyQuestionReport','hasOwnProperty','order','SessionId','filter','include','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7f11,0x8b));var _0x17f1=function(_0x569478,_0xec0107){_0x569478=_0x569478-0x0;var _0xd26ba8=_0x7f11[_0x569478];return _0xd26ba8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x17f1('0x0'));var zipdir=require(_0x17f1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x17f1('0x2'));var moment=require(_0x17f1('0x3'));var BPromise=require(_0x17f1('0x4'));var Mustache=require('mustache');var util=require(_0x17f1('0x5'));var path=require(_0x17f1('0x6'));var sox=require(_0x17f1('0x7'));var csv=require(_0x17f1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x17f1('0x9'));var _=require('lodash');var squel=require(_0x17f1('0xa'));var crypto=require(_0x17f1('0xb'));var jsforce=require(_0x17f1('0xc'));var deskjs=require(_0x17f1('0xd'));var toCsv=require(_0x17f1('0x8'));var querystring=require(_0x17f1('0xe'));var Papa=require(_0x17f1('0xf'));var Redis=require('ioredis');var authService=require(_0x17f1('0x10'));var qs=require(_0x17f1('0x11'));var as=require(_0x17f1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x17f1('0x13'))(_0x17f1('0x14'));var utils=require('../../config/utils');var config=require(_0x17f1('0x15'));var licenseUtil=require(_0x17f1('0x16'));var db=require(_0x17f1('0x17'))['db'];function respondWithStatusCode(_0x157a3e,_0x620e1c){_0x620e1c=_0x620e1c||0xcc;return function(_0x25c289){if(_0x25c289){return _0x157a3e['sendStatus'](_0x620e1c);}return _0x157a3e['status'](_0x620e1c)['end']();};}function respondWithResult(_0x22dfd5,_0x18b0e1){_0x18b0e1=_0x18b0e1||0xc8;return function(_0x986c39){if(_0x986c39){return _0x22dfd5['status'](_0x18b0e1)['json'](_0x986c39);}};}function respondWithFilteredResult(_0x40e5d1,_0x48d1ab){return function(_0x65fb17){if(_0x65fb17){var _0x405c20=typeof _0x48d1ab['offset']===_0x17f1('0x18')&&typeof _0x48d1ab[_0x17f1('0x19')]===_0x17f1('0x18');var _0x5ce18d=_0x65fb17['count'];var _0x35cabc=_0x405c20?0x0:_0x48d1ab['offset'];var _0x5b1d75=_0x405c20?_0x65fb17[_0x17f1('0x1a')]:_0x48d1ab[_0x17f1('0x1b')]+_0x48d1ab[_0x17f1('0x19')];var _0x1c1d0b;if(_0x5b1d75>=_0x5ce18d){_0x5b1d75=_0x5ce18d;_0x1c1d0b=0xc8;}else{_0x1c1d0b=0xce;}_0x40e5d1[_0x17f1('0x1c')](_0x1c1d0b);return _0x40e5d1[_0x17f1('0x1d')](_0x17f1('0x1e'),_0x35cabc+'-'+_0x5b1d75+'/'+_0x5ce18d)['json'](_0x65fb17);}return null;};}function patchUpdates(_0x5716ef){return function(_0x1c8f7d){try{jsonpatch[_0x17f1('0x1f')](_0x1c8f7d,_0x5716ef,!![]);}catch(_0x29ef7c){return BPromise[_0x17f1('0x20')](_0x29ef7c);}return _0x1c8f7d[_0x17f1('0x21')]();};}function saveUpdates(_0xfc7083,_0x27a248){return function(_0x530300){if(_0x530300){return _0x530300['update'](_0xfc7083)['then'](function(_0x5a85be){return _0x5a85be;});}return null;};}function removeEntity(_0x329b7b,_0x21677d){return function(_0x499d1b){if(_0x499d1b){return _0x499d1b['destroy']()['then'](function(){_0x329b7b['status'](0xcc)[_0x17f1('0x22')]();});}};}function handleEntityNotFound(_0x51dbfa,_0x17fd16){return function(_0x4af070){if(!_0x4af070){_0x51dbfa[_0x17f1('0x23')](0x194);}return _0x4af070;};}function handleError(_0x43d500,_0x477839){_0x477839=_0x477839||0x1f4;return function(_0x279ac1){logger[_0x17f1('0x24')](_0x279ac1[_0x17f1('0x25')]);if(_0x279ac1[_0x17f1('0x26')]){delete _0x279ac1[_0x17f1('0x26')];}_0x43d500['status'](_0x477839)['send'](_0x279ac1);};}exports[_0x17f1('0x27')]=function(_0x491d8e,_0x3905db){var _0x2a04cd={},_0x17af64={},_0x4d145e={'count':0x0,'rows':[]};var _0x51cbe6=_[_0x17f1('0x28')](db[_0x17f1('0x29')][_0x17f1('0x2a')],function(_0x119150){return{'name':_0x119150[_0x17f1('0x2b')],'type':_0x119150[_0x17f1('0x2c')][_0x17f1('0x2d')]};});_0x17af64[_0x17f1('0x2e')]=_[_0x17f1('0x28')](_0x51cbe6,_0x17f1('0x26'));_0x17af64[_0x17f1('0x2f')]=_[_0x17f1('0x30')](_0x491d8e[_0x17f1('0x2f')]);_0x17af64[_0x17f1('0x31')]=_[_0x17f1('0x32')](_0x17af64['model'],_0x17af64[_0x17f1('0x2f')]);_0x2a04cd['attributes']=_[_0x17f1('0x32')](_0x17af64[_0x17f1('0x2e')],qs['fields'](_0x491d8e['query'][_0x17f1('0x33')]));_0x2a04cd[_0x17f1('0x34')]=_0x2a04cd[_0x17f1('0x34')][_0x17f1('0x35')]?_0x2a04cd[_0x17f1('0x34')]:_0x17af64[_0x17f1('0x2e')];if(!_0x491d8e['query']['hasOwnProperty'](_0x17f1('0x36'))){_0x2a04cd[_0x17f1('0x19')]=qs[_0x17f1('0x19')](_0x491d8e[_0x17f1('0x2f')][_0x17f1('0x19')]);_0x2a04cd['offset']=qs['offset'](_0x491d8e[_0x17f1('0x2f')]['offset']);}_0x2a04cd['order']=qs[_0x17f1('0x37')](_0x491d8e[_0x17f1('0x2f')]['sort']);_0x2a04cd[_0x17f1('0x38')]=qs[_0x17f1('0x31')](_[_0x17f1('0x39')](_0x491d8e[_0x17f1('0x2f')],_0x17af64[_0x17f1('0x31')]),_0x51cbe6);if(_0x491d8e[_0x17f1('0x2f')]['filter']){_0x2a04cd[_0x17f1('0x38')]=_['merge'](_0x2a04cd[_0x17f1('0x38')],{'$or':_[_0x17f1('0x28')](_0x51cbe6,function(_0x123893){if(_0x123893[_0x17f1('0x2c')]!==_0x17f1('0x3a')){var _0x254082={};_0x254082[_0x123893[_0x17f1('0x26')]]={'$like':'%'+_0x491d8e[_0x17f1('0x2f')]['filter']+'%'};return _0x254082;}})});}_0x2a04cd=_[_0x17f1('0x3b')]({},_0x2a04cd,_0x491d8e['options']);var _0x746898={'where':_0x2a04cd[_0x17f1('0x38')]};return db[_0x17f1('0x29')][_0x17f1('0x1a')](_0x746898)[_0x17f1('0x3c')](function(_0x1bd330){_0x4d145e[_0x17f1('0x1a')]=_0x1bd330;if(_0x491d8e[_0x17f1('0x2f')][_0x17f1('0x3d')]){_0x2a04cd['include']=[{'all':!![]}];}return db[_0x17f1('0x29')][_0x17f1('0x3e')](_0x2a04cd);})['then'](function(_0x512851){_0x4d145e[_0x17f1('0x3f')]=_0x512851;return _0x4d145e;})[_0x17f1('0x3c')](respondWithFilteredResult(_0x3905db,_0x2a04cd))[_0x17f1('0x40')](handleError(_0x3905db,null));};exports[_0x17f1('0x41')]=function(_0x257ea9,_0x50448c){var _0x521164={'raw':!![],'where':{'id':_0x257ea9[_0x17f1('0x42')]['id']}},_0x2c2be5={};_0x2c2be5[_0x17f1('0x2e')]=_[_0x17f1('0x30')](db['JscriptySessionReport'][_0x17f1('0x2a')]);_0x2c2be5['query']=_[_0x17f1('0x30')](_0x257ea9['query']);_0x2c2be5[_0x17f1('0x31')]=_[_0x17f1('0x32')](_0x2c2be5[_0x17f1('0x2e')],_0x2c2be5[_0x17f1('0x2f')]);_0x521164['attributes']=_[_0x17f1('0x32')](_0x2c2be5[_0x17f1('0x2e')],qs[_0x17f1('0x33')](_0x257ea9[_0x17f1('0x2f')][_0x17f1('0x33')]));_0x521164[_0x17f1('0x34')]=_0x521164[_0x17f1('0x34')][_0x17f1('0x35')]?_0x521164['attributes']:_0x2c2be5[_0x17f1('0x2e')];if(_0x257ea9[_0x17f1('0x2f')][_0x17f1('0x3d')]){_0x521164['include']=[{'all':!![]}];}_0x521164=_[_0x17f1('0x3b')]({},_0x521164,_0x257ea9[_0x17f1('0x43')]);return db['JscriptySessionReport']['find'](_0x521164)[_0x17f1('0x3c')](handleEntityNotFound(_0x50448c,null))['then'](respondWithResult(_0x50448c,null))[_0x17f1('0x40')](handleError(_0x50448c,null));};exports[_0x17f1('0x44')]=function(_0x818c4f,_0x174dde){return db['JscriptySessionReport'][_0x17f1('0x44')](_0x818c4f[_0x17f1('0x45')],{})[_0x17f1('0x3c')](respondWithResult(_0x174dde,0xc9))[_0x17f1('0x40')](handleError(_0x174dde,null));};exports['update']=function(_0x238c50,_0x2de2ed){if(_0x238c50[_0x17f1('0x45')]['id']){delete _0x238c50[_0x17f1('0x45')]['id'];}return db[_0x17f1('0x29')]['find']({'where':{'id':_0x238c50['params']['id']}})[_0x17f1('0x3c')](handleEntityNotFound(_0x2de2ed,null))[_0x17f1('0x3c')](saveUpdates(_0x238c50['body'],null))[_0x17f1('0x3c')](respondWithResult(_0x2de2ed,null))[_0x17f1('0x40')](handleError(_0x2de2ed,null));};exports[_0x17f1('0x46')]=function(_0xa4d4d7,_0x5f06d9){return db[_0x17f1('0x29')][_0x17f1('0x47')]({'where':{'id':_0xa4d4d7[_0x17f1('0x42')]['id']}})[_0x17f1('0x3c')](handleEntityNotFound(_0x5f06d9,null))[_0x17f1('0x3c')](removeEntity(_0x5f06d9,null))[_0x17f1('0x40')](handleError(_0x5f06d9,null));};exports[_0x17f1('0x48')]=function(_0x555de8,_0x3761a3){return db[_0x17f1('0x29')]['describe']()['then'](respondWithResult(_0x3761a3,null))[_0x17f1('0x40')](handleError(_0x3761a3,null));};exports['getQuestions']=function(_0x168e1f,_0x497a5e,_0x5939ea){var _0x39b2aa={'raw':!![],'where':{}};var _0x5cf2fa={};var _0x324e60={'count':0x0,'rows':[]};return db[_0x17f1('0x29')][_0x17f1('0x49')]({'where':{'id':_0x168e1f[_0x17f1('0x42')]['id']}})[_0x17f1('0x3c')](handleEntityNotFound(_0x497a5e,null))[_0x17f1('0x3c')](function(_0x5ba46b){if(_0x5ba46b){_0x5cf2fa[_0x17f1('0x2e')]=_[_0x17f1('0x30')](db[_0x17f1('0x4a')][_0x17f1('0x2a')]);_0x5cf2fa[_0x17f1('0x2f')]=_[_0x17f1('0x30')](_0x168e1f['query']);_0x5cf2fa[_0x17f1('0x31')]=_['intersection'](_0x5cf2fa[_0x17f1('0x2e')],_0x5cf2fa[_0x17f1('0x2f')]);_0x39b2aa[_0x17f1('0x34')]=_[_0x17f1('0x32')](_0x5cf2fa[_0x17f1('0x2e')],qs[_0x17f1('0x33')](_0x168e1f['query'][_0x17f1('0x33')]));_0x39b2aa[_0x17f1('0x34')]=_0x39b2aa['attributes'][_0x17f1('0x35')]?_0x39b2aa[_0x17f1('0x34')]:_0x5cf2fa[_0x17f1('0x2e')];if(!_0x168e1f[_0x17f1('0x2f')][_0x17f1('0x4b')](_0x17f1('0x36'))){_0x39b2aa['limit']=qs[_0x17f1('0x19')](_0x168e1f[_0x17f1('0x2f')][_0x17f1('0x19')]);_0x39b2aa[_0x17f1('0x1b')]=qs[_0x17f1('0x1b')](_0x168e1f[_0x17f1('0x2f')][_0x17f1('0x1b')]);}_0x39b2aa[_0x17f1('0x4c')]=qs[_0x17f1('0x37')](_0x168e1f[_0x17f1('0x2f')][_0x17f1('0x37')]);_0x39b2aa['where']=qs[_0x17f1('0x31')](_[_0x17f1('0x39')](_0x168e1f[_0x17f1('0x2f')],_0x5cf2fa[_0x17f1('0x31')]));_0x39b2aa['where'][_0x17f1('0x4d')]=_0x5ba46b['id'];if(_0x168e1f[_0x17f1('0x2f')][_0x17f1('0x4e')]){_0x39b2aa[_0x17f1('0x38')]=_[_0x17f1('0x3b')](_0x39b2aa['where'],{'$or':_[_0x17f1('0x28')](_0x39b2aa[_0x17f1('0x34')],function(_0x2aaa6d){var _0x1c6e38={};_0x1c6e38[_0x2aaa6d]={'$like':'%'+_0x168e1f['query'][_0x17f1('0x4e')]+'%'};return _0x1c6e38;})});}_0x39b2aa=_[_0x17f1('0x3b')]({},_0x39b2aa,_0x168e1f[_0x17f1('0x43')]);return db['JscriptyQuestionReport'][_0x17f1('0x1a')]({'where':_0x39b2aa[_0x17f1('0x38')]})[_0x17f1('0x3c')](function(_0x8f75ee){_0x324e60[_0x17f1('0x1a')]=_0x8f75ee;if(_0x168e1f['query'][_0x17f1('0x3d')]){_0x39b2aa[_0x17f1('0x4f')]=[{'all':!![]}];}return db[_0x17f1('0x4a')][_0x17f1('0x3e')](_0x39b2aa);})['then'](function(_0x103230){_0x324e60[_0x17f1('0x3f')]=_0x103230;return _0x324e60;});}})['then'](respondWithFilteredResult(_0x497a5e,_0x39b2aa))[_0x17f1('0x40')](handleError(_0x497a5e,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 39cd915..29ead08 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 _0x4819=['report_jscripty_sessions','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','JscriptySessionReport'];(function(_0x11abdf,_0x124f07){var _0x9806d9=function(_0x4132a3){while(--_0x4132a3){_0x11abdf['push'](_0x11abdf['shift']());}};_0x9806d9(++_0x124f07);}(_0x4819,0xcd));var _0x9481=function(_0x4cc198,_0x11a598){_0x4cc198=_0x4cc198-0x0;var _0x3e8858=_0x4819[_0x4cc198];return _0x3e8858;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var logger=require(_0x9481('0x1'))(_0x9481('0x2'));var moment=require(_0x9481('0x3'));var BPromise=require(_0x9481('0x4'));var rp=require(_0x9481('0x5'));var fs=require('fs');var path=require(_0x9481('0x6'));var rimraf=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var attributes=require(_0x9481('0x9'));module['exports']=function(_0x4d9e3a,_0x5def07){return _0x4d9e3a['define'](_0x9481('0xa'),attributes,{'tableName':_0x9481('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d58=['request-promise','rimraf','../../config/environment','exports','define','report_jscripty_sessions','bluebird'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x5d58,0x187));var _0x85d5=function(_0x3f9e3d,_0x25823c){_0x3f9e3d=_0x3f9e3d-0x0;var _0x3a6eca=_0x5d58[_0x3f9e3d];return _0x3a6eca;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x85d5('0x0'));var rp=require(_0x85d5('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x85d5('0x2'));var config=require(_0x85d5('0x3'));var attributes=require('./jscriptySessionReport.attributes');module[_0x85d5('0x4')]=function(_0x2d457a,_0x578fad){return _0x2d457a[_0x85d5('0x5')]('JscriptySessionReport',attributes,{'tableName':_0x85d5('0x6'),'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 e4d37ea..e0f915a 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 _0x32f4=['info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x1a8396,_0x280126){var _0x29ce3=function(_0x2a205a){while(--_0x2a205a){_0x1a8396['push'](_0x1a8396['shift']());}};_0x29ce3(++_0x280126);}(_0x32f4,0x154));var _0x432f=function(_0x31193d,_0x220a47){_0x31193d=_0x31193d-0x0;var _0x1cb029=_0x32f4[_0x31193d];return _0x1cb029;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var moment=require(_0x432f('0x2'));var BPromise=require(_0x432f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x432f('0x4'));var db=require(_0x432f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x432f('0x6'))(_0x432f('0x7'));var config=require(_0x432f('0x8'));var jayson=require(_0x432f('0x9'));var client=jayson[_0x432f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b5f08,_0x2f66fd,_0x32b062){return new BPromise(function(_0x4a5b56,_0x2a2ef6){return client['request'](_0x5b5f08,_0x32b062)[_0x432f('0xb')](function(_0x340fe9){logger[_0x432f('0xc')](_0x432f('0xd'),_0x2f66fd,_0x432f('0xe'));logger['debug'](_0x432f('0xf'),_0x2f66fd,'request\x20sent',JSON[_0x432f('0x10')](_0x340fe9));if(_0x340fe9['error']){if(_0x340fe9[_0x432f('0x11')][_0x432f('0x12')]===0x1f4){logger['error'](_0x432f('0xd'),_0x2f66fd,_0x340fe9[_0x432f('0x11')]['message']);return _0x2a2ef6(_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x2f66fd,_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);return _0x4a5b56(_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);}else{logger[_0x432f('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x2f66fd,_0x432f('0xe'));_0x4a5b56(_0x340fe9[_0x432f('0x14')][_0x432f('0x13')]);}})[_0x432f('0x15')](function(_0x5bae29){logger[_0x432f('0x11')](_0x432f('0xd'),_0x2f66fd,_0x5bae29);_0x2a2ef6(_0x5bae29);});});} \ No newline at end of file +var _0x01d9=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x4e19a7,_0x10631c){var _0x594261=function(_0x44a415){while(--_0x44a415){_0x4e19a7['push'](_0x4e19a7['shift']());}};_0x594261(++_0x10631c);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var moment=require(_0x901d('0x2'));var BPromise=require(_0x901d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x901d('0x4'));var db=require(_0x901d('0x5'))['db'];var utils=require(_0x901d('0x6'));var logger=require(_0x901d('0x7'))(_0x901d('0x8'));var config=require(_0x901d('0x9'));var jayson=require(_0x901d('0xa'));var client=jayson['client'][_0x901d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6c9ac8,_0x21e1d7,_0x12c39f){return new BPromise(function(_0x313f85,_0x39fc94){return client[_0x901d('0xc')](_0x6c9ac8,_0x12c39f)[_0x901d('0xd')](function(_0x15076e){logger[_0x901d('0xe')](_0x901d('0xf'),_0x21e1d7,_0x901d('0x10'));logger[_0x901d('0x11')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x21e1d7,_0x901d('0x10'),JSON['stringify'](_0x15076e));if(_0x15076e[_0x901d('0x12')]){if(_0x15076e[_0x901d('0x12')][_0x901d('0x13')]===0x1f4){logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x15076e['error'][_0x901d('0x14')]);return _0x39fc94(_0x15076e[_0x901d('0x12')][_0x901d('0x14')]);}logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x15076e[_0x901d('0x12')]['message']);return _0x313f85(_0x15076e[_0x901d('0x12')][_0x901d('0x14')]);}else{logger[_0x901d('0xe')](_0x901d('0xf'),_0x21e1d7,_0x901d('0x10'));_0x313f85(_0x15076e[_0x901d('0x15')][_0x901d('0x14')]);}})[_0x901d('0x16')](function(_0x3368fc){logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x3368fc);_0x39fc94(_0x3368fc);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index d959f3c..66fd023 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 _0xc949=['./license.controller','get','index','put','isAuthenticated','update','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5a984d,_0x14b91f){var _0x44a167=function(_0x185392){while(--_0x185392){_0x5a984d['push'](_0x5a984d['shift']());}};_0x44a167(++_0x14b91f);}(_0xc949,0x181));var _0x9c94=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0xc949[_0xa6cc5c];return _0x44803d;};'use strict';var multer=require(_0x9c94('0x0'));var util=require('util');var path=require(_0x9c94('0x1'));var timeout=require(_0x9c94('0x2'));var express=require(_0x9c94('0x3'));var router=express[_0x9c94('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9c94('0x5'));var interaction=require(_0x9c94('0x6'));var config=require('../../config/environment');var controller=require(_0x9c94('0x7'));router[_0x9c94('0x8')]('/',controller[_0x9c94('0x9')]);router[_0x9c94('0xa')]('/:id',auth[_0x9c94('0xb')](),controller[_0x9c94('0xc')]);module[_0x9c94('0xd')]=router; \ No newline at end of file +var _0x8efc=['/:id','isAuthenticated','update','path','express','fs-extra','../../components/auth/service','./license.controller','index','put'];(function(_0x163d95,_0x4df28c){var _0x231cc2=function(_0xfa4159){while(--_0xfa4159){_0x163d95['push'](_0x163d95['shift']());}};_0x231cc2(++_0x4df28c);}(_0x8efc,0x8f));var _0xc8ef=function(_0x4ed1d4,_0x512d9a){_0x4ed1d4=_0x4ed1d4-0x0;var _0x28e363=_0x8efc[_0x4ed1d4];return _0x28e363;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc8ef('0x0'));var timeout=require('connect-timeout');var express=require(_0xc8ef('0x1'));var router=express['Router']();var fs_extra=require(_0xc8ef('0x2'));var auth=require(_0xc8ef('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc8ef('0x4'));router['get']('/',controller[_0xc8ef('0x5')]);router[_0xc8ef('0x6')](_0xc8ef('0x7'),auth[_0xc8ef('0x8')](),controller[_0xc8ef('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index b310aa7..328935f 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 _0x4ea6=['sequelize','exports','TEXT','STRING','INTEGER'];(function(_0x3a7d84,_0x35498d){var _0xf335a1=function(_0x4d3e95){while(--_0x4d3e95){_0x3a7d84['push'](_0x3a7d84['shift']());}};_0xf335a1(++_0x35498d);}(_0x4ea6,0x18b));var _0x64ea=function(_0x2a56ad,_0x2b94bf){_0x2a56ad=_0x2a56ad-0x0;var _0x425175=_0x4ea6[_0x2a56ad];return _0x425175;};'use strict';var Sequelize=require(_0x64ea('0x0'));module[_0x64ea('0x1')]={'license':{'type':Sequelize[_0x64ea('0x2')]},'data1':{'type':Sequelize[_0x64ea('0x3')]},'data2':{'type':Sequelize[_0x64ea('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x64ea('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd293=['INTEGER','sequelize','TEXT','STRING'];(function(_0x14d17d,_0x56493b){var _0x388bb6=function(_0x3dd963){while(--_0x3dd963){_0x14d17d['push'](_0x14d17d['shift']());}};_0x388bb6(++_0x56493b);}(_0xd293,0x1a1));var _0x3d29=function(_0x479193,_0x5825aa){_0x479193=_0x479193-0x0;var _0x451cdf=_0xd293[_0x479193];return _0x451cdf;};'use strict';var Sequelize=require(_0x3d29('0x0'));module['exports']={'license':{'type':Sequelize[_0x3d29('0x1')]},'data1':{'type':Sequelize[_0x3d29('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x3d29('0x3')],'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 ddefe5d..d774330 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 _0x5fc3=['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','index','model','keys','License','query','intersection','attributes','fields','merge','options','getLicense','catch','body','find','params','checkLicense','key','demo','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2ec2bf,_0x64e983){_0x2ec2bf=_0x2ec2bf-0x0;var _0x2c279c=_0x5fc3[_0x2ec2bf];return _0x2c279c;};'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);};}var utilLicense=require('../../config/license/util');exports[_0x35fc('0x28')]=function(_0x645eac,_0x383837){var _0x9f3c8a={'raw':!![],'where':{'id':0x1}},_0x3735da={};_0x3735da[_0x35fc('0x29')]=_[_0x35fc('0x2a')](db[_0x35fc('0x2b')]['rawAttributes']);_0x3735da[_0x35fc('0x2c')]=_[_0x35fc('0x2a')](_0x645eac[_0x35fc('0x2c')]);_0x3735da['filters']=_[_0x35fc('0x2d')](_0x3735da[_0x35fc('0x29')],_0x3735da[_0x35fc('0x2c')]);_0x9f3c8a[_0x35fc('0x2e')]=_[_0x35fc('0x2d')](_0x3735da[_0x35fc('0x29')],qs[_0x35fc('0x2f')](_0x645eac[_0x35fc('0x2c')][_0x35fc('0x2f')]));_0x9f3c8a[_0x35fc('0x2e')]=_0x9f3c8a['attributes']['length']?_0x9f3c8a[_0x35fc('0x2e')]:_0x3735da['model'];_0x9f3c8a=_[_0x35fc('0x30')]({},_0x9f3c8a,_0x645eac[_0x35fc('0x31')]);return utilLicense[_0x35fc('0x32')](_0x9f3c8a)[_0x35fc('0x24')](respondWithResult(_0x383837,null))[_0x35fc('0x33')](handleError(_0x383837,null));};exports[_0x35fc('0x23')]=function(_0x4e43b4,_0x3fe193){if(_0x4e43b4[_0x35fc('0x34')]['id']){delete _0x4e43b4[_0x35fc('0x34')]['id'];}return db[_0x35fc('0x2b')][_0x35fc('0x35')]({'where':{'id':_0x4e43b4[_0x35fc('0x36')]['id']}})['then'](handleEntityNotFound(_0x3fe193,null))[_0x35fc('0x24')](function(_0x38193d){var _0x1fecdf=_0x38193d['get']({'plain':!![]});return utilLicense[_0x35fc('0x37')](_0x1fecdf,_0x4e43b4['body'][_0x35fc('0x38')]);})[_0x35fc('0x24')](function(_0x266a11){if(!_0x266a11[_0x35fc('0x39')]){return saveUpdates(_0x4e43b4['body'],null);}return _0x266a11;})['then'](respondWithResult(_0x3fe193,null))['catch'](handleError(_0x3fe193,null));}; \ No newline at end of file +var _0xabce=['status','end','json','limit','count','offset','Content-Range','apply','reject','save','update','then','sendStatus','error','name','send','model','keys','License','rawAttributes','query','intersection','attributes','fields','merge','getLicense','catch','find','get','body','demo','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','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','../../config/license/util','../../mysqldb'];(function(_0x13feae,_0x15aae2){var _0x2199d9=function(_0x22f3fa){while(--_0x22f3fa){_0x13feae['push'](_0x13feae['shift']());}};_0x2199d9(++_0x15aae2);}(_0xabce,0x103));var _0xeabc=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0xabce[_0x4d07cc];return _0x42de3b;};'use strict';var emlformat=require(_0xeabc('0x0'));var rimraf=require(_0xeabc('0x1'));var zipdir=require(_0xeabc('0x2'));var jsonpatch=require(_0xeabc('0x3'));var rp=require(_0xeabc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeabc('0x5'));var util=require(_0xeabc('0x6'));var path=require(_0xeabc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeabc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];function respondWithStatusCode(_0x3fd0b5,_0x36a92e){_0x36a92e=_0x36a92e||0xcc;return function(_0xcfbf06){if(_0xcfbf06){return _0x3fd0b5['sendStatus'](_0x36a92e);}return _0x3fd0b5[_0xeabc('0x1a')](_0x36a92e)[_0xeabc('0x1b')]();};}function respondWithResult(_0x3251c6,_0x55f0de){_0x55f0de=_0x55f0de||0xc8;return function(_0x5f4ee8){if(_0x5f4ee8){return _0x3251c6[_0xeabc('0x1a')](_0x55f0de)[_0xeabc('0x1c')](_0x5f4ee8);}};}function respondWithFilteredResult(_0x326bac,_0x53d5cb){return function(_0xf913d7){if(_0xf913d7){var _0x638976=typeof _0x53d5cb['offset']==='undefined'&&typeof _0x53d5cb[_0xeabc('0x1d')]==='undefined';var _0x3d0e21=_0xf913d7[_0xeabc('0x1e')];var _0x58a3c0=_0x638976?0x0:_0x53d5cb[_0xeabc('0x1f')];var _0x31dd53=_0x638976?_0xf913d7[_0xeabc('0x1e')]:_0x53d5cb[_0xeabc('0x1f')]+_0x53d5cb[_0xeabc('0x1d')];var _0x5d92e5;if(_0x31dd53>=_0x3d0e21){_0x31dd53=_0x3d0e21;_0x5d92e5=0xc8;}else{_0x5d92e5=0xce;}_0x326bac[_0xeabc('0x1a')](_0x5d92e5);return _0x326bac['set'](_0xeabc('0x20'),_0x58a3c0+'-'+_0x31dd53+'/'+_0x3d0e21)[_0xeabc('0x1c')](_0xf913d7);}return null;};}function patchUpdates(_0x502947){return function(_0x28063a){try{jsonpatch[_0xeabc('0x21')](_0x28063a,_0x502947,!![]);}catch(_0x254590){return BPromise[_0xeabc('0x22')](_0x254590);}return _0x28063a[_0xeabc('0x23')]();};}function saveUpdates(_0x4e99a4,_0xecdbf){return function(_0x10c675){if(_0x10c675){return _0x10c675[_0xeabc('0x24')](_0x4e99a4)['then'](function(_0x457f27){return _0x457f27;});}return null;};}function removeEntity(_0x3854d2,_0x214953){return function(_0x319119){if(_0x319119){return _0x319119['destroy']()[_0xeabc('0x25')](function(){_0x3854d2['status'](0xcc)[_0xeabc('0x1b')]();});}};}function handleEntityNotFound(_0x4d4e29,_0x811f0d){return function(_0x12acbd){if(!_0x12acbd){_0x4d4e29[_0xeabc('0x26')](0x194);}return _0x12acbd;};}function handleError(_0x3f194e,_0x3a1a04){_0x3a1a04=_0x3a1a04||0x1f4;return function(_0x137293){logger[_0xeabc('0x27')](_0x137293['stack']);if(_0x137293['name']){delete _0x137293[_0xeabc('0x28')];}_0x3f194e['status'](_0x3a1a04)[_0xeabc('0x29')](_0x137293);};}var utilLicense=require(_0xeabc('0x18'));exports['index']=function(_0x2163e6,_0x38572d){var _0x2b568f={'raw':!![],'where':{'id':0x1}},_0x2f8633={};_0x2f8633[_0xeabc('0x2a')]=_[_0xeabc('0x2b')](db[_0xeabc('0x2c')][_0xeabc('0x2d')]);_0x2f8633[_0xeabc('0x2e')]=_['keys'](_0x2163e6[_0xeabc('0x2e')]);_0x2f8633['filters']=_[_0xeabc('0x2f')](_0x2f8633[_0xeabc('0x2a')],_0x2f8633[_0xeabc('0x2e')]);_0x2b568f[_0xeabc('0x30')]=_[_0xeabc('0x2f')](_0x2f8633[_0xeabc('0x2a')],qs[_0xeabc('0x31')](_0x2163e6['query'][_0xeabc('0x31')]));_0x2b568f[_0xeabc('0x30')]=_0x2b568f[_0xeabc('0x30')]['length']?_0x2b568f[_0xeabc('0x30')]:_0x2f8633[_0xeabc('0x2a')];_0x2b568f=_[_0xeabc('0x32')]({},_0x2b568f,_0x2163e6['options']);return utilLicense[_0xeabc('0x33')](_0x2b568f)[_0xeabc('0x25')](respondWithResult(_0x38572d,null))[_0xeabc('0x34')](handleError(_0x38572d,null));};exports['update']=function(_0xf98c7c,_0x286203){if(_0xf98c7c['body']['id']){delete _0xf98c7c['body']['id'];}return db[_0xeabc('0x2c')][_0xeabc('0x35')]({'where':{'id':_0xf98c7c['params']['id']}})[_0xeabc('0x25')](handleEntityNotFound(_0x286203,null))[_0xeabc('0x25')](function(_0x3edee7){var _0x10434e=_0x3edee7[_0xeabc('0x36')]({'plain':!![]});return utilLicense['checkLicense'](_0x10434e,_0xf98c7c[_0xeabc('0x37')]['key']);})[_0xeabc('0x25')](function(_0x2bda29){if(!_0x2bda29[_0xeabc('0x38')]){return saveUpdates(_0xf98c7c['body'],null);}return _0x2bda29;})['then'](respondWithResult(_0x286203,null))[_0xeabc('0x34')](handleError(_0x286203,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 768880d..0125cf2 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 _0x6347=['define','license','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./license.attributes','exports'];(function(_0x28ade3,_0x3849b9){var _0x20ca87=function(_0x47515f){while(--_0x47515f){_0x28ade3['push'](_0x28ade3['shift']());}};_0x20ca87(++_0x3849b9);}(_0x6347,0x15e));var _0x7634=function(_0x44ffe8,_0x1c8534){_0x44ffe8=_0x44ffe8-0x0;var _0x5ca756=_0x6347[_0x44ffe8];return _0x5ca756;};'use strict';var _=require(_0x7634('0x0'));var util=require(_0x7634('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7634('0x2'));var BPromise=require(_0x7634('0x3'));var rp=require(_0x7634('0x4'));var fs=require('fs');var path=require(_0x7634('0x5'));var rimraf=require(_0x7634('0x6'));var config=require(_0x7634('0x7'));var attributes=require(_0x7634('0x8'));module[_0x7634('0x9')]=function(_0x8fb446,_0x10c8d7){return _0x8fb446[_0x7634('0xa')]('License',attributes,{'tableName':_0x7634('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3217=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./license.attributes','License','license'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x3217,0x1b8));var _0x7321=function(_0x50a046,_0x44cc0b){_0x50a046=_0x50a046-0x0;var _0x4f006b=_0x3217[_0x50a046];return _0x4f006b;};'use strict';var _=require('lodash');var util=require(_0x7321('0x0'));var logger=require('../../config/logger')(_0x7321('0x1'));var moment=require(_0x7321('0x2'));var BPromise=require(_0x7321('0x3'));var rp=require(_0x7321('0x4'));var fs=require('fs');var path=require(_0x7321('0x5'));var rimraf=require(_0x7321('0x6'));var config=require(_0x7321('0x7'));var attributes=require(_0x7321('0x8'));module['exports']=function(_0x28e482,_0x4f7cff){return _0x28e482['define'](_0x7321('0x9'),attributes,{'tableName':_0x7321('0xa'),'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 09650ff..2df7c57 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 _0x7f5c=['http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x15942a,_0x13b58c){var _0x36a9fb=function(_0x549c27){while(--_0x549c27){_0x15942a['push'](_0x15942a['shift']());}};_0x36a9fb(++_0x13b58c);}(_0x7f5c,0x19c));var _0xc7f5=function(_0x59db67,_0x1d9a35){_0x59db67=_0x59db67-0x0;var _0x4dbc65=_0x7f5c[_0x59db67];return _0x4dbc65;};'use strict';var _=require(_0xc7f5('0x0'));var util=require(_0xc7f5('0x1'));var moment=require(_0xc7f5('0x2'));var BPromise=require(_0xc7f5('0x3'));var rs=require(_0xc7f5('0x4'));var fs=require('fs');var Redis=require(_0xc7f5('0x5'));var db=require(_0xc7f5('0x6'))['db'];var utils=require(_0xc7f5('0x7'));var logger=require(_0xc7f5('0x8'))(_0xc7f5('0x9'));var config=require(_0xc7f5('0xa'));var jayson=require(_0xc7f5('0xb'));var client=jayson[_0xc7f5('0xc')][_0xc7f5('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x416460,_0x4a9ee4,_0x324dc7){return new BPromise(function(_0x15d2df,_0x2b0662){return client[_0xc7f5('0xe')](_0x416460,_0x324dc7)[_0xc7f5('0xf')](function(_0x2fa8fd){logger[_0xc7f5('0x10')](_0xc7f5('0x11'),_0x4a9ee4,_0xc7f5('0x12'));logger[_0xc7f5('0x13')](_0xc7f5('0x14'),_0x4a9ee4,_0xc7f5('0x12'),JSON['stringify'](_0x2fa8fd));if(_0x2fa8fd[_0xc7f5('0x15')]){if(_0x2fa8fd[_0xc7f5('0x15')][_0xc7f5('0x16')]===0x1f4){logger[_0xc7f5('0x15')](_0xc7f5('0x11'),_0x4a9ee4,_0x2fa8fd[_0xc7f5('0x15')][_0xc7f5('0x17')]);return _0x2b0662(_0x2fa8fd['error']['message']);}logger[_0xc7f5('0x15')](_0xc7f5('0x11'),_0x4a9ee4,_0x2fa8fd[_0xc7f5('0x15')][_0xc7f5('0x17')]);return _0x15d2df(_0x2fa8fd[_0xc7f5('0x15')]['message']);}else{logger[_0xc7f5('0x10')](_0xc7f5('0x11'),_0x4a9ee4,_0xc7f5('0x12'));_0x15d2df(_0x2fa8fd['result']['message']);}})[_0xc7f5('0x18')](function(_0x43553c){logger[_0xc7f5('0x15')](_0xc7f5('0x11'),_0x4a9ee4,_0x43553c);_0x2b0662(_0x43553c);});});} \ No newline at end of file +var _0x1e96=['result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x5ef9e8,_0x57f8a4){var _0x36f1e1=function(_0x14cef7){while(--_0x14cef7){_0x5ef9e8['push'](_0x5ef9e8['shift']());}};_0x36f1e1(++_0x57f8a4);}(_0x1e96,0x16a));var _0x61e9=function(_0x460144,_0x3c8413){_0x460144=_0x460144-0x0;var _0x2003d0=_0x1e96[_0x460144];return _0x2003d0;};'use strict';var _=require('lodash');var util=require(_0x61e9('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x61e9('0x1'));var fs=require('fs');var Redis=require(_0x61e9('0x2'));var db=require(_0x61e9('0x3'))['db'];var utils=require(_0x61e9('0x4'));var logger=require(_0x61e9('0x5'))(_0x61e9('0x6'));var config=require(_0x61e9('0x7'));var jayson=require(_0x61e9('0x8'));var client=jayson[_0x61e9('0x9')][_0x61e9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c82da,_0x52cb54,_0xf42231){return new BPromise(function(_0x311e69,_0x1f3212){return client[_0x61e9('0xb')](_0x2c82da,_0xf42231)[_0x61e9('0xc')](function(_0x56ab44){logger[_0x61e9('0xd')](_0x61e9('0xe'),_0x52cb54,'request\x20sent');logger[_0x61e9('0xf')](_0x61e9('0x10'),_0x52cb54,_0x61e9('0x11'),JSON[_0x61e9('0x12')](_0x56ab44));if(_0x56ab44[_0x61e9('0x13')]){if(_0x56ab44[_0x61e9('0x13')][_0x61e9('0x14')]===0x1f4){logger[_0x61e9('0x13')]('License,\x20%s,\x20%s',_0x52cb54,_0x56ab44[_0x61e9('0x13')][_0x61e9('0x15')]);return _0x1f3212(_0x56ab44[_0x61e9('0x13')][_0x61e9('0x15')]);}logger[_0x61e9('0x13')](_0x61e9('0xe'),_0x52cb54,_0x56ab44[_0x61e9('0x13')][_0x61e9('0x15')]);return _0x311e69(_0x56ab44['error'][_0x61e9('0x15')]);}else{logger[_0x61e9('0xd')]('License,\x20%s,\x20%s',_0x52cb54,_0x61e9('0x11'));_0x311e69(_0x56ab44[_0x61e9('0x16')]['message']);}})[_0x61e9('0x17')](function(_0x1f4915){logger['error']('License,\x20%s,\x20%s',_0x52cb54,_0x1f4915);_0x1f3212(_0x1f4915);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index c9669b9..0c128b6 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 _0xf9c6=['getDispositions','/:id/canned_answers','getAnswers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','getMessages','/:id/verify','post','/:id/dispositions','addDisposition','addAnswer','/:id/in_servers','addImap','addSmtp','addApplications','/:id/send','send','/:id/users','addAgents','put','delete','removeImap','removeSmtp','removeAgents','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0xe033e7,_0x561a6d){var _0x63031f=function(_0x246e1f){while(--_0x246e1f){_0xe033e7['push'](_0xe033e7['shift']());}};_0x63031f(++_0x561a6d);}(_0xf9c6,0x118));var _0x6f9c=function(_0x139bde,_0x9ded43){_0x139bde=_0x139bde-0x0;var _0x5bd03e=_0xf9c6[_0x139bde];return _0x5bd03e;};'use strict';var multer=require(_0x6f9c('0x0'));var util=require('util');var path=require(_0x6f9c('0x1'));var timeout=require('connect-timeout');var express=require(_0x6f9c('0x2'));var router=express[_0x6f9c('0x3')]();var fs_extra=require(_0x6f9c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6f9c('0x5'));var config=require(_0x6f9c('0x6'));var controller=require('./mailAccount.controller');router[_0x6f9c('0x7')]('/',auth['isAuthenticated'](),controller[_0x6f9c('0x8')]);router['get'](_0x6f9c('0x9'),auth[_0x6f9c('0xa')](),controller[_0x6f9c('0xb')]);router[_0x6f9c('0x7')](_0x6f9c('0xc'),auth['isAuthenticated'](),controller[_0x6f9c('0xd')]);router[_0x6f9c('0x7')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x6f9c('0xe')]);router[_0x6f9c('0x7')](_0x6f9c('0xf'),auth[_0x6f9c('0xa')](),controller[_0x6f9c('0x10')]);router[_0x6f9c('0x7')]('/:id/in_servers',auth[_0x6f9c('0xa')](),controller[_0x6f9c('0x11')]);router['get'](_0x6f9c('0x12'),auth[_0x6f9c('0xa')](),controller[_0x6f9c('0x13')]);router['get'](_0x6f9c('0x14'),auth['isAuthenticated'](),controller[_0x6f9c('0x15')]);router['get']('/:id/applications',auth[_0x6f9c('0xa')](),controller['getApplications']);router[_0x6f9c('0x7')]('/:id/messages',auth[_0x6f9c('0xa')](),controller[_0x6f9c('0x16')]);router[_0x6f9c('0x7')](_0x6f9c('0x17'),auth[_0x6f9c('0xa')](),controller['verifySmtp']);router['get']('/:id/users',auth[_0x6f9c('0xa')](),controller['getAgents']);router[_0x6f9c('0x18')](_0x6f9c('0x19'),auth[_0x6f9c('0xa')](),controller[_0x6f9c('0x1a')]);router[_0x6f9c('0x18')](_0x6f9c('0xf'),auth[_0x6f9c('0xa')](),controller[_0x6f9c('0x1b')]);router[_0x6f9c('0x18')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x6f9c('0x1c'),auth['isAuthenticated'](),controller[_0x6f9c('0x1d')]);router[_0x6f9c('0x18')]('/:id/out_servers',auth[_0x6f9c('0xa')](),controller[_0x6f9c('0x1e')]);router[_0x6f9c('0x18')](_0x6f9c('0x14'),auth['isAuthenticated'](),controller['addInteraction']);router[_0x6f9c('0x18')]('/:id/applications',auth[_0x6f9c('0xa')](),controller[_0x6f9c('0x1f')]);router[_0x6f9c('0x18')](_0x6f9c('0x20'),auth[_0x6f9c('0xa')](),controller[_0x6f9c('0x21')]);router[_0x6f9c('0x18')](_0x6f9c('0x22'),auth['isAuthenticated'](),controller[_0x6f9c('0x23')]);router[_0x6f9c('0x24')]('/:id',auth[_0x6f9c('0xa')](),controller['update']);router[_0x6f9c('0x25')]('/:id/dispositions',auth[_0x6f9c('0xa')](),controller['removeDispositions']);router[_0x6f9c('0x25')](_0x6f9c('0xf'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x6f9c('0x25')]('/:id/in_servers',auth[_0x6f9c('0xa')](),controller[_0x6f9c('0x26')]);router[_0x6f9c('0x25')](_0x6f9c('0x12'),auth['isAuthenticated'](),controller[_0x6f9c('0x27')]);router[_0x6f9c('0x25')](_0x6f9c('0xc'),auth[_0x6f9c('0xa')](),controller['destroy']);router[_0x6f9c('0x25')](_0x6f9c('0x22'),auth['isAuthenticated'](),controller[_0x6f9c('0x28')]);module[_0x6f9c('0x29')]=router; \ No newline at end of file +var _0x2c54=['util','path','fs-extra','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','get','isAuthenticated','index','/describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','verifySmtp','getAgents','post','addAnswer','create','addImap','/:id/out_servers','addSmtp','addInteraction','addApplications','/:id/send','send','/:id/users','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','/:id','destroy','removeAgents','exports','multer'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x2c54,0xef));var _0x42c5=function(_0x4ac6e7,_0x1eefde){_0x4ac6e7=_0x4ac6e7-0x0;var _0x443b0c=_0x2c54[_0x4ac6e7];return _0x443b0c;};'use strict';var multer=require(_0x42c5('0x0'));var util=require(_0x42c5('0x1'));var path=require(_0x42c5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x42c5('0x3'));var auth=require(_0x42c5('0x4'));var interaction=require(_0x42c5('0x5'));var config=require('../../config/environment');var controller=require(_0x42c5('0x6'));router[_0x42c5('0x7')]('/',auth[_0x42c5('0x8')](),controller[_0x42c5('0x9')]);router[_0x42c5('0x7')](_0x42c5('0xa'),auth[_0x42c5('0x8')](),controller['describe']);router[_0x42c5('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x42c5('0xb')]);router[_0x42c5('0x7')](_0x42c5('0xc'),auth[_0x42c5('0x8')](),controller[_0x42c5('0xd')]);router[_0x42c5('0x7')](_0x42c5('0xe'),auth[_0x42c5('0x8')](),controller[_0x42c5('0xf')]);router[_0x42c5('0x7')](_0x42c5('0x10'),auth[_0x42c5('0x8')](),controller[_0x42c5('0x11')]);router[_0x42c5('0x7')]('/:id/out_servers',auth[_0x42c5('0x8')](),controller[_0x42c5('0x12')]);router[_0x42c5('0x7')](_0x42c5('0x13'),auth[_0x42c5('0x8')](),controller[_0x42c5('0x14')]);router[_0x42c5('0x7')](_0x42c5('0x15'),auth[_0x42c5('0x8')](),controller['getApplications']);router['get'](_0x42c5('0x16'),auth['isAuthenticated'](),controller[_0x42c5('0x17')]);router[_0x42c5('0x7')]('/:id/verify',auth[_0x42c5('0x8')](),controller[_0x42c5('0x18')]);router[_0x42c5('0x7')]('/:id/users',auth[_0x42c5('0x8')](),controller[_0x42c5('0x19')]);router[_0x42c5('0x1a')](_0x42c5('0xc'),auth[_0x42c5('0x8')](),controller['addDisposition']);router[_0x42c5('0x1a')](_0x42c5('0xe'),auth[_0x42c5('0x8')](),controller[_0x42c5('0x1b')]);router[_0x42c5('0x1a')]('/',auth['isAuthenticated'](),controller[_0x42c5('0x1c')]);router[_0x42c5('0x1a')](_0x42c5('0x10'),auth[_0x42c5('0x8')](),controller[_0x42c5('0x1d')]);router['post'](_0x42c5('0x1e'),auth['isAuthenticated'](),controller[_0x42c5('0x1f')]);router[_0x42c5('0x1a')](_0x42c5('0x13'),auth[_0x42c5('0x8')](),controller[_0x42c5('0x20')]);router[_0x42c5('0x1a')]('/:id/applications',auth['isAuthenticated'](),controller[_0x42c5('0x21')]);router['post'](_0x42c5('0x22'),auth['isAuthenticated'](),controller[_0x42c5('0x23')]);router[_0x42c5('0x1a')](_0x42c5('0x24'),auth['isAuthenticated'](),controller['addAgents']);router[_0x42c5('0x25')]('/:id',auth[_0x42c5('0x8')](),controller[_0x42c5('0x26')]);router[_0x42c5('0x27')](_0x42c5('0xc'),auth[_0x42c5('0x8')](),controller[_0x42c5('0x28')]);router[_0x42c5('0x27')](_0x42c5('0xe'),auth[_0x42c5('0x8')](),controller[_0x42c5('0x29')]);router[_0x42c5('0x27')](_0x42c5('0x10'),auth[_0x42c5('0x8')](),controller[_0x42c5('0x2a')]);router[_0x42c5('0x27')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0x42c5('0x2b')]);router[_0x42c5('0x27')](_0x42c5('0x2c'),auth[_0x42c5('0x8')](),controller[_0x42c5('0x2d')]);router[_0x42c5('0x27')]('/:id/users',auth[_0x42c5('0x8')](),controller[_0x42c5('0x2e')]);module[_0x42c5('0x2f')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index f56a99b..43d8c71 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 _0xeedf=['sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId'];(function(_0x2bd4d9,_0x53b8f1){var _0x5aa078=function(_0x1f9fa3){while(--_0x1f9fa3){_0x2bd4d9['push'](_0x2bd4d9['shift']());}};_0x5aa078(++_0x53b8f1);}(_0xeedf,0x12c));var _0xfeed=function(_0x58aa37,_0x262b5c){_0x58aa37=_0x58aa37-0x0;var _0x41b164=_0xeedf[_0x58aa37];return _0x41b164;};'use strict';var Sequelize=require(_0xfeed('0x0'));module[_0xfeed('0x1')]={'description':{'type':Sequelize[_0xfeed('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0xfeed('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xfeed('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xfeed('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xfeed('0x4')]},'markAsUnread':{'type':Sequelize[_0xfeed('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xfeed('0x5')},'fontSize':{'type':Sequelize[_0xfeed('0x6')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xfeed('0x4')],'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[_0xfeed('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfeed('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfeed('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfeed('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xfeed('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xfeed('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1e39c8){if(!_0x1e39c8)this[_0xfeed('0x8')](_0xfeed('0x9'),null);this[_0xfeed('0x8')]('mandatoryDisposition',_0x1e39c8);}}}; \ No newline at end of file +var _0x0c02=['setDataValue','mandatoryDisposition','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','mandatoryDispositionPauseId'];(function(_0x2312a8,_0x3b96b1){var _0x2ab51a=function(_0xc03943){while(--_0xc03943){_0x2312a8['push'](_0x2312a8['shift']());}};_0x2ab51a(++_0x3b96b1);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x20c0('0x0')]={'description':{'type':Sequelize[_0x20c0('0x1')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x20c0('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x20c0('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x20c0('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x20c0('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x20c0('0x3')]},'markAsUnread':{'type':Sequelize[_0x20c0('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x20c0('0x1')],'allowNull':![],'defaultValue':_0x20c0('0x4')},'fontSize':{'type':Sequelize[_0x20c0('0x5')](0x2)[_0x20c0('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'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['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x20c0('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x20c0('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x20c0('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x20c0('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x20c0('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x20c0('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x578592){if(!_0x578592)this['setDataValue'](_0x20c0('0x7'),null);this[_0x20c0('0x8')](_0x20c0('0x9'),_0x578592);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 0ab25b7..1d389ea 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 _0x8ced=['emit','userMailAccount:save','isArray','userMailAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','path','ejs','fs-extra','lodash','jsforce','to-csv','querystring','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','then','info','request\x20sent','debug','stringify','error','MailAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','MailAccounts','status','stack','send','index','MailServerIn','Imap','MailServerOut','Smtp','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','model','name','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','length','body','params','Pause','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','hasOwnProperty','include','removeDispositions','find','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','key','email','isNil','active','description','cservice','cauthentication','user','cuser','pass','cpassword','authentication','port','host','service','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','findOne','addImap','removeImap','getSmtp','setSmtp','addInteraction','getInteractions','CmContact','Contact','User','Owner','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','getApplications','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','CmList','List','Contacts','updatedAt','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','auth','secure','sendMail','ListId','List\x20not\x20found','messageId','subject','attach','out','Interaction','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread'];(function(_0xd8b2aa,_0x3b5e2c){var _0x5255c5=function(_0x2dce14){while(--_0x2dce14){_0xd8b2aa['push'](_0xd8b2aa['shift']());}};_0x5255c5(++_0x3b5e2c);}(_0x8ced,0xc7));var _0xd8ce=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x8ced[_0x4d07cc];return _0x42de3b;};'use strict';var emlformat=require(_0xd8ce('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd8ce('0x1'));var jsonpatch=require(_0xd8ce('0x2'));var rp=require(_0xd8ce('0x3'));var moment=require(_0xd8ce('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xd8ce('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd8ce('0x6'));var fs=require('fs');var fs_extra=require(_0xd8ce('0x7'));var _=require(_0xd8ce('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd8ce('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xd8ce('0xa'));var querystring=require(_0xd8ce('0xb'));var Papa=require('papaparse');var htmlToText=require(_0xd8ce('0xc'));var juice=require(_0xd8ce('0xd'));var Redis=require(_0xd8ce('0xe'));var authService=require(_0xd8ce('0xf'));var qs=require(_0xd8ce('0x10'));var as=require(_0xd8ce('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd8ce('0x12'))(_0xd8ce('0x13'));var utils=require('../../config/utils');var config=require(_0xd8ce('0x14'));var licenseUtil=require(_0xd8ce('0x15'));var db=require(_0xd8ce('0x16'))['db'];config[_0xd8ce('0x17')]=_[_0xd8ce('0x18')](config[_0xd8ce('0x17')],{'host':_0xd8ce('0x19'),'port':0x18eb});var socket=require(_0xd8ce('0x1a'))(new Redis(config[_0xd8ce('0x17')]));require('./mailAccount.socket')[_0xd8ce('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xd8ce('0x1c')][_0xd8ce('0x1d')]({'port':0x232b});function respondWithRpcPromise(_0x364d9c,_0x3fd350,_0x5827a0,_0x1ee1a3){return new BPromise(function(_0x422cd1,_0x54bb4f){var _0x209b92=_0x1ee1a3||client;return _0x209b92['request'](_0x364d9c,_0x5827a0)[_0xd8ce('0x1e')](function(_0x6c6d57){logger[_0xd8ce('0x1f')]('MailAccount,\x20%s,\x20%s',_0x3fd350,_0xd8ce('0x20'));logger[_0xd8ce('0x21')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x3fd350,'request\x20sent',JSON[_0xd8ce('0x22')](_0x6c6d57));if(_0x6c6d57[_0xd8ce('0x23')]){if(_0x6c6d57[_0xd8ce('0x23')]['code']===0x1f4){logger[_0xd8ce('0x23')](_0xd8ce('0x24'),_0x3fd350,_0x6c6d57[_0xd8ce('0x23')]['message']);return _0x54bb4f(_0x6c6d57['error'][_0xd8ce('0x25')]);}logger[_0xd8ce('0x23')](_0xd8ce('0x24'),_0x3fd350,_0x6c6d57[_0xd8ce('0x23')][_0xd8ce('0x25')]);return _0x422cd1(_0x6c6d57[_0xd8ce('0x23')][_0xd8ce('0x25')]);}else{logger[_0xd8ce('0x1f')](_0xd8ce('0x24'),_0x3fd350,_0xd8ce('0x20'));_0x422cd1(_0x6c6d57[_0xd8ce('0x26')]['message']);}})[_0xd8ce('0x27')](function(_0x47ac73){logger[_0xd8ce('0x23')](_0xd8ce('0x24'),_0x3fd350,_0x47ac73);_0x54bb4f(_0x47ac73);});});}function respondWithStatusCode(_0x5a321b,_0x30999a){_0x30999a=_0x30999a||0xcc;return function(_0x4e9965){if(_0x4e9965){return _0x5a321b[_0xd8ce('0x28')](_0x30999a);}return _0x5a321b['status'](_0x30999a)[_0xd8ce('0x29')]();};}function respondWithResult(_0x3109d1,_0x90fc04){_0x90fc04=_0x90fc04||0xc8;return function(_0x5d2eff){if(_0x5d2eff){return _0x3109d1['status'](_0x90fc04)[_0xd8ce('0x2a')](_0x5d2eff);}};}function respondWithFilteredResult(_0xb9acbc,_0x1f6a7d){return function(_0x4020c6){if(_0x4020c6){var _0x133160=typeof _0x1f6a7d[_0xd8ce('0x2b')]===_0xd8ce('0x2c')&&typeof _0x1f6a7d[_0xd8ce('0x2d')]===_0xd8ce('0x2c');var _0x2993f8=_0x4020c6[_0xd8ce('0x2e')];var _0xbfd281=_0x133160?0x0:_0x1f6a7d[_0xd8ce('0x2b')];var _0x50431f=_0x133160?_0x4020c6[_0xd8ce('0x2e')]:_0x1f6a7d[_0xd8ce('0x2b')]+_0x1f6a7d['limit'];var _0x27e588;if(_0x50431f>=_0x2993f8){_0x50431f=_0x2993f8;_0x27e588=0xc8;}else{_0x27e588=0xce;}_0xb9acbc['status'](_0x27e588);return _0xb9acbc[_0xd8ce('0x2f')](_0xd8ce('0x30'),_0xbfd281+'-'+_0x50431f+'/'+_0x2993f8)[_0xd8ce('0x2a')](_0x4020c6);}return null;};}function patchUpdates(_0x1c6edc){return function(_0x2504ac){try{jsonpatch[_0xd8ce('0x31')](_0x2504ac,_0x1c6edc,!![]);}catch(_0x1fe22a){return BPromise[_0xd8ce('0x32')](_0x1fe22a);}return _0x2504ac[_0xd8ce('0x33')]();};}function saveUpdates(_0x5fcac8,_0x32e4a6){return function(_0x2298aa){if(_0x2298aa){return _0x2298aa[_0xd8ce('0x34')](_0x5fcac8)[_0xd8ce('0x1e')](function(_0x51da67){return _0x51da67;});}return null;};}function removeEntity(_0x515b85,_0xd9fcb0){return function(_0xd7ab9c){if(_0xd7ab9c){return _0xd7ab9c[_0xd8ce('0x35')]()['then'](function(){var _0x37526a=_0xd7ab9c['get']({'plain':!![]});var _0x28e891=_0xd8ce('0x36');return db['UserProfileResource'][_0xd8ce('0x35')]({'where':{'type':_0x28e891,'resourceId':_0x37526a['id']}})['then'](function(){return _0xd7ab9c;});})[_0xd8ce('0x1e')](function(){_0x515b85[_0xd8ce('0x37')](0xcc)[_0xd8ce('0x29')]();});}};}function handleEntityNotFound(_0x220622,_0x2e27dd){return function(_0x5f1e6d){if(!_0x5f1e6d){_0x220622['sendStatus'](0x194);}return _0x5f1e6d;};}function handleError(_0x28e4be,_0x378af7){_0x378af7=_0x378af7||0x1f4;return function(_0x15b75b){logger[_0xd8ce('0x23')](_0x15b75b[_0xd8ce('0x38')]);if(_0x15b75b['name']){delete _0x15b75b['name'];}_0x28e4be['status'](_0x378af7)[_0xd8ce('0x39')](_0x15b75b);};}exports[_0xd8ce('0x3a')]=function(_0x4b39eb,_0x1e4543){var _0x46065c={'include':[{'model':db[_0xd8ce('0x3b')],'as':_0xd8ce('0x3c')},{'model':db[_0xd8ce('0x3d')],'as':_0xd8ce('0x3e')},{'model':db['Pause'],'as':_0xd8ce('0x3f')}]},_0x1f68c7={},_0x2daece={'count':0x0,'rows':[]};var _0x39570e=_[_0xd8ce('0x40')](db[_0xd8ce('0x41')][_0xd8ce('0x42')],function(_0x4e6d08){return{'name':_0x4e6d08[_0xd8ce('0x43')],'type':_0x4e6d08[_0xd8ce('0x44')]['key']};});_0x1f68c7[_0xd8ce('0x45')]=_[_0xd8ce('0x40')](_0x39570e,_0xd8ce('0x46'));_0x1f68c7[_0xd8ce('0x47')]=_[_0xd8ce('0x48')](_0x4b39eb[_0xd8ce('0x47')]);_0x1f68c7['filters']=_[_0xd8ce('0x49')](_0x1f68c7[_0xd8ce('0x45')],_0x1f68c7[_0xd8ce('0x47')]);_0x46065c[_0xd8ce('0x4a')]=_[_0xd8ce('0x49')](_0x1f68c7[_0xd8ce('0x45')],qs[_0xd8ce('0x4b')](_0x4b39eb[_0xd8ce('0x47')]['fields']));_0x46065c[_0xd8ce('0x4a')]=_0x46065c[_0xd8ce('0x4a')]['length']?_0x46065c['attributes']:_0x1f68c7[_0xd8ce('0x45')];if(!_0x4b39eb[_0xd8ce('0x47')]['hasOwnProperty'](_0xd8ce('0x4c'))){_0x46065c[_0xd8ce('0x2d')]=qs['limit'](_0x4b39eb[_0xd8ce('0x47')][_0xd8ce('0x2d')]);_0x46065c[_0xd8ce('0x2b')]=qs[_0xd8ce('0x2b')](_0x4b39eb['query'][_0xd8ce('0x2b')]);}_0x46065c[_0xd8ce('0x4d')]=qs['sort'](_0x4b39eb['query'][_0xd8ce('0x4e')]);_0x46065c[_0xd8ce('0x4f')]=qs[_0xd8ce('0x50')](_[_0xd8ce('0x51')](_0x4b39eb[_0xd8ce('0x47')],_0x1f68c7[_0xd8ce('0x50')]),_0x39570e);if(_0x4b39eb[_0xd8ce('0x47')][_0xd8ce('0x52')]){_0x46065c[_0xd8ce('0x4f')]=_[_0xd8ce('0x53')](_0x46065c[_0xd8ce('0x4f')],{'$or':_[_0xd8ce('0x40')](_0x39570e,function(_0x45a260){if(_0x45a260['type']!==_0xd8ce('0x54')){var _0xf154e1={};_0xf154e1[_0x45a260[_0xd8ce('0x46')]]={'$like':'%'+_0x4b39eb[_0xd8ce('0x47')][_0xd8ce('0x52')]+'%'};return _0xf154e1;}})});}_0x46065c=_['merge']({},_0x46065c,_0x4b39eb[_0xd8ce('0x55')]);var _0xf8b316={'where':_0x46065c[_0xd8ce('0x4f')]};return db['MailAccount'][_0xd8ce('0x2e')](_0xf8b316)[_0xd8ce('0x1e')](function(_0x3827b1){_0x2daece['count']=_0x3827b1;if(_0x4b39eb[_0xd8ce('0x47')][_0xd8ce('0x56')]){_0x46065c['include']=[{'all':!![]}];}return db['MailAccount'][_0xd8ce('0x57')](_0x46065c);})['then'](function(_0x726531){_0x2daece[_0xd8ce('0x58')]=_0x726531;return _0x2daece;})[_0xd8ce('0x1e')](respondWithFilteredResult(_0x1e4543,_0x46065c))[_0xd8ce('0x27')](handleError(_0x1e4543,null));};exports[_0xd8ce('0x59')]=function(_0x54c65f,_0x4482c6){var _0x50036e={'raw':![],'where':{'id':_0x54c65f['params']['id']},'include':[{'model':db[_0xd8ce('0x3b')],'as':_0xd8ce('0x3c')},{'model':db['MailServerOut'],'as':_0xd8ce('0x3e')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x247a60={};_0x247a60[_0xd8ce('0x45')]=_['keys'](db[_0xd8ce('0x41')][_0xd8ce('0x42')]);_0x247a60[_0xd8ce('0x47')]=_[_0xd8ce('0x48')](_0x54c65f['query']);_0x247a60[_0xd8ce('0x50')]=_['intersection'](_0x247a60[_0xd8ce('0x45')],_0x247a60[_0xd8ce('0x47')]);_0x50036e[_0xd8ce('0x4a')]=_[_0xd8ce('0x49')](_0x247a60[_0xd8ce('0x45')],qs[_0xd8ce('0x4b')](_0x54c65f[_0xd8ce('0x47')][_0xd8ce('0x4b')]));_0x50036e[_0xd8ce('0x4a')]=_0x50036e[_0xd8ce('0x4a')][_0xd8ce('0x5a')]?_0x50036e['attributes']:_0x247a60[_0xd8ce('0x45')];if(_0x54c65f[_0xd8ce('0x47')][_0xd8ce('0x56')]){_0x50036e['include']=[{'all':!![]}];}_0x50036e=_[_0xd8ce('0x53')]({},_0x50036e,_0x54c65f[_0xd8ce('0x55')]);return db[_0xd8ce('0x41')]['find'](_0x50036e)[_0xd8ce('0x1e')](handleEntityNotFound(_0x4482c6,null))[_0xd8ce('0x1e')](respondWithResult(_0x4482c6,null))[_0xd8ce('0x27')](handleError(_0x4482c6,null));};exports['update']=function(_0x48ba34,_0x389d33){if(_0x48ba34['body']['id']){delete _0x48ba34[_0xd8ce('0x5b')]['id'];}return db[_0xd8ce('0x41')]['find']({'where':{'id':_0x48ba34[_0xd8ce('0x5c')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xd8ce('0x3c')},{'model':db[_0xd8ce('0x3d')],'as':_0xd8ce('0x3e')},{'model':db[_0xd8ce('0x5d')],'as':_0xd8ce('0x3f')}]})[_0xd8ce('0x1e')](handleEntityNotFound(_0x389d33,null))['then'](saveUpdates(_0x48ba34[_0xd8ce('0x5b')],null))[_0xd8ce('0x1e')](function(_0x4f1cbb){if(_0x4f1cbb&&_0x48ba34[_0xd8ce('0x5b')][_0xd8ce('0x3c')]){return db[_0xd8ce('0x3b')][_0xd8ce('0x34')](_0x48ba34[_0xd8ce('0x5b')][_0xd8ce('0x3c')],{'where':{'MailAccountId':_0x4f1cbb['id']}})[_0xd8ce('0x1e')](function(){return _0x4f1cbb;});}return _0x4f1cbb;})['then'](function(_0x30ad5e){if(_0x30ad5e&&_0x48ba34[_0xd8ce('0x5b')][_0xd8ce('0x3e')]){return db['MailServerOut'][_0xd8ce('0x34')](_0x48ba34['body'][_0xd8ce('0x3e')],{'where':{'MailAccountId':_0x30ad5e['id']}})['then'](function(){return _0x30ad5e;});}return _0x30ad5e;})[_0xd8ce('0x1e')](respondWithResult(_0x389d33,null))[_0xd8ce('0x27')](handleError(_0x389d33,null));};exports[_0xd8ce('0x5e')]=function(_0x94a905,_0x2f6c82){return db['MailAccount'][_0xd8ce('0x5e')]()[_0xd8ce('0x1e')](respondWithResult(_0x2f6c82,null))[_0xd8ce('0x27')](handleError(_0x2f6c82,null));};exports[_0xd8ce('0x5f')]=function(_0xfb064f,_0x223545,_0x39ee24){if(_0xfb064f[_0xd8ce('0x5b')]['id']){delete _0xfb064f[_0xd8ce('0x5b')]['id'];}return db[_0xd8ce('0x41')]['find']({'where':{'id':_0xfb064f[_0xd8ce('0x5c')]['id']}})[_0xd8ce('0x1e')](handleEntityNotFound(_0x223545,null))['then'](function(_0x55480d){if(_0x55480d){_0xfb064f[_0xd8ce('0x5b')][_0xd8ce('0x60')]=_0x55480d['id'];return db[_0xd8ce('0x61')][_0xd8ce('0x62')](_0xfb064f['body']);}})[_0xd8ce('0x1e')](respondWithResult(_0x223545,null))[_0xd8ce('0x27')](handleError(_0x223545,null));};exports[_0xd8ce('0x63')]=function(_0x40991a,_0x1d2ef3,_0x40c463){var _0x51ad70={'raw':![],'where':{}};var _0x4ebd0a={};var _0x26db72={'count':0x0,'rows':[]};return db[_0xd8ce('0x41')]['findOne']({'where':{'id':_0x40991a['params']['id']}})[_0xd8ce('0x1e')](handleEntityNotFound(_0x1d2ef3,null))['then'](function(_0x4a92bf){if(_0x4a92bf){_0x4ebd0a['model']=_['keys'](db[_0xd8ce('0x61')][_0xd8ce('0x42')]);_0x4ebd0a[_0xd8ce('0x47')]=_[_0xd8ce('0x48')](_0x40991a[_0xd8ce('0x47')]);_0x4ebd0a[_0xd8ce('0x50')]=_['intersection'](_0x4ebd0a[_0xd8ce('0x45')],_0x4ebd0a[_0xd8ce('0x47')]);_0x51ad70['attributes']=_[_0xd8ce('0x49')](_0x4ebd0a[_0xd8ce('0x45')],qs['fields'](_0x40991a[_0xd8ce('0x47')]['fields']));_0x51ad70[_0xd8ce('0x4a')]=_0x51ad70['attributes'][_0xd8ce('0x5a')]?_0x51ad70[_0xd8ce('0x4a')]:_0x4ebd0a['model'];if(!_0x40991a[_0xd8ce('0x47')][_0xd8ce('0x64')](_0xd8ce('0x4c'))){_0x51ad70[_0xd8ce('0x2d')]=qs[_0xd8ce('0x2d')](_0x40991a[_0xd8ce('0x47')][_0xd8ce('0x2d')]);_0x51ad70[_0xd8ce('0x2b')]=qs[_0xd8ce('0x2b')](_0x40991a['query'][_0xd8ce('0x2b')]);}_0x51ad70['order']=qs[_0xd8ce('0x4e')](_0x40991a[_0xd8ce('0x47')][_0xd8ce('0x4e')]);_0x51ad70[_0xd8ce('0x4f')]=qs['filters'](_[_0xd8ce('0x51')](_0x40991a[_0xd8ce('0x47')],_0x4ebd0a['filters']));_0x51ad70[_0xd8ce('0x4f')][_0xd8ce('0x60')]=_0x4a92bf['id'];if(_0x40991a['query'][_0xd8ce('0x52')]){_0x51ad70['where']=_[_0xd8ce('0x53')](_0x51ad70[_0xd8ce('0x4f')],{'$or':_[_0xd8ce('0x40')](_0x51ad70['attributes'],function(_0xa658e5){var _0x248ca3={};_0x248ca3[_0xa658e5]={'$like':'%'+_0x40991a[_0xd8ce('0x47')][_0xd8ce('0x52')]+'%'};return _0x248ca3;})});}_0x51ad70=_[_0xd8ce('0x53')]({},_0x51ad70,_0x40991a['options']);return db['Disposition'][_0xd8ce('0x2e')]({'where':_0x51ad70['where']})[_0xd8ce('0x1e')](function(_0x2fde3f){_0x26db72[_0xd8ce('0x2e')]=_0x2fde3f;if(_0x40991a['query']['includeAll']){_0x51ad70[_0xd8ce('0x65')]=[{'all':!![]}];}return db[_0xd8ce('0x61')]['findAll'](_0x51ad70);})['then'](function(_0x4bacfb){_0x26db72[_0xd8ce('0x58')]=_0x4bacfb;return _0x26db72;});}})[_0xd8ce('0x1e')](respondWithFilteredResult(_0x1d2ef3,_0x51ad70))['catch'](handleError(_0x1d2ef3,null));};exports[_0xd8ce('0x66')]=function(_0x1bafa3,_0x2a7a20,_0x4a2a96){return db[_0xd8ce('0x41')][_0xd8ce('0x67')]({'where':{'id':_0x1bafa3[_0xd8ce('0x5c')]['id']}})[_0xd8ce('0x1e')](handleEntityNotFound(_0x2a7a20,null))['then'](function(_0x30c8f2){if(_0x30c8f2){return _0x30c8f2[_0xd8ce('0x66')](_0x1bafa3[_0xd8ce('0x47')][_0xd8ce('0x68')]);}})['then'](respondWithStatusCode(_0x2a7a20,null))['catch'](handleError(_0x2a7a20,null));};exports[_0xd8ce('0x69')]=function(_0x597771,_0x50d34e,_0x1cd273){if(_0x597771['body']['id']){delete _0x597771[_0xd8ce('0x5b')]['id'];}return db[_0xd8ce('0x41')][_0xd8ce('0x67')]({'where':{'id':_0x597771[_0xd8ce('0x5c')]['id']}})[_0xd8ce('0x1e')](handleEntityNotFound(_0x50d34e,null))['then'](function(_0xe55eca){if(_0xe55eca){_0x597771['body'][_0xd8ce('0x60')]=_0xe55eca['id'];return db[_0xd8ce('0x6a')][_0xd8ce('0x62')](_0x597771[_0xd8ce('0x5b')]);}})[_0xd8ce('0x1e')](respondWithResult(_0x50d34e,null))['catch'](handleError(_0x50d34e,null));};exports[_0xd8ce('0x6b')]=function(_0x870536,_0x122fc0,_0x618fc4){var _0x47308b={'raw':![],'where':{}};var _0xac5aec={};var _0xa60581={'count':0x0,'rows':[]};return db[_0xd8ce('0x41')]['findOne']({'where':{'id':_0x870536[_0xd8ce('0x5c')]['id']}})['then'](handleEntityNotFound(_0x122fc0,null))[_0xd8ce('0x1e')](function(_0x30e59b){if(_0x30e59b){_0xac5aec['model']=_[_0xd8ce('0x48')](db[_0xd8ce('0x6a')]['rawAttributes']);_0xac5aec['query']=_['keys'](_0x870536['query']);_0xac5aec['filters']=_['intersection'](_0xac5aec[_0xd8ce('0x45')],_0xac5aec['query']);_0x47308b[_0xd8ce('0x4a')]=_[_0xd8ce('0x49')](_0xac5aec[_0xd8ce('0x45')],qs[_0xd8ce('0x4b')](_0x870536[_0xd8ce('0x47')][_0xd8ce('0x4b')]));_0x47308b['attributes']=_0x47308b[_0xd8ce('0x4a')][_0xd8ce('0x5a')]?_0x47308b[_0xd8ce('0x4a')]:_0xac5aec[_0xd8ce('0x45')];if(!_0x870536[_0xd8ce('0x47')][_0xd8ce('0x64')](_0xd8ce('0x4c'))){_0x47308b[_0xd8ce('0x2d')]=qs[_0xd8ce('0x2d')](_0x870536[_0xd8ce('0x47')][_0xd8ce('0x2d')]);_0x47308b[_0xd8ce('0x2b')]=qs[_0xd8ce('0x2b')](_0x870536[_0xd8ce('0x47')][_0xd8ce('0x2b')]);}_0x47308b['order']=qs[_0xd8ce('0x4e')](_0x870536[_0xd8ce('0x47')]['sort']);_0x47308b['where']=qs[_0xd8ce('0x50')](_[_0xd8ce('0x51')](_0x870536[_0xd8ce('0x47')],_0xac5aec[_0xd8ce('0x50')]));_0x47308b['where'][_0xd8ce('0x60')]=_0x30e59b['id'];if(_0x870536[_0xd8ce('0x47')][_0xd8ce('0x52')]){_0x47308b[_0xd8ce('0x4f')]=_[_0xd8ce('0x53')](_0x47308b[_0xd8ce('0x4f')],{'$or':_[_0xd8ce('0x40')](_0x47308b['attributes'],function(_0x333397){var _0x3d5227={};_0x3d5227[_0x333397]={'$like':'%'+_0x870536['query']['filter']+'%'};return _0x3d5227;})});}_0x47308b=_[_0xd8ce('0x53')]({},_0x47308b,_0x870536[_0xd8ce('0x55')]);return db[_0xd8ce('0x6a')][_0xd8ce('0x2e')]({'where':_0x47308b[_0xd8ce('0x4f')]})[_0xd8ce('0x1e')](function(_0x396fcf){_0xa60581[_0xd8ce('0x2e')]=_0x396fcf;if(_0x870536['query'][_0xd8ce('0x56')]){_0x47308b[_0xd8ce('0x65')]=[{'all':!![]}];}return db['CannedAnswer'][_0xd8ce('0x57')](_0x47308b);})[_0xd8ce('0x1e')](function(_0x4a6296){_0xa60581['rows']=_0x4a6296;return _0xa60581;});}})['then'](respondWithFilteredResult(_0x122fc0,_0x47308b))[_0xd8ce('0x27')](handleError(_0x122fc0,null));};exports[_0xd8ce('0x6c')]=function(_0x369412,_0x1012da,_0x2e0edf){return db[_0xd8ce('0x41')]['find']({'where':{'id':_0x369412[_0xd8ce('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1012da,null))[_0xd8ce('0x1e')](function(_0x284a60){if(_0x284a60){return _0x284a60[_0xd8ce('0x6c')](_0x369412['query'][_0xd8ce('0x68')]);}})[_0xd8ce('0x1e')](respondWithStatusCode(_0x1012da,null))[_0xd8ce('0x27')](handleError(_0x1012da,null));};exports[_0xd8ce('0x62')]=function(_0x5231cc,_0x1bd82f){var _0x6883e1={'name':_0x5231cc[_0xd8ce('0x5b')][_0xd8ce('0x46')],'key':_0x5231cc[_0xd8ce('0x5b')][_0xd8ce('0x6d')],'email':_0x5231cc[_0xd8ce('0x5b')][_0xd8ce('0x6e')],'ListId':_0x5231cc[_0xd8ce('0x5b')]['ListId'],'active':!_[_0xd8ce('0x6f')](_0x5231cc[_0xd8ce('0x5b')][_0xd8ce('0x70')])?_0x5231cc[_0xd8ce('0x5b')][_0xd8ce('0x70')]:!![],'description':_0x5231cc[_0xd8ce('0x5b')][_0xd8ce('0x71')]||null,'Imap':{},'Smtp':{}};if(_[_0xd8ce('0x6f')](_0x5231cc[_0xd8ce('0x5b')][_0xd8ce('0x72')])){if(_0x5231cc[_0xd8ce('0x5b')][_0xd8ce('0x73')]){_0x6883e1[_0xd8ce('0x3c')][_0xd8ce('0x74')]=_0x6883e1['Smtp']['user']=_0x5231cc[_0xd8ce('0x5b')][_0xd8ce('0x75')];_0x6883e1[_0xd8ce('0x3c')]['password']=_0x6883e1[_0xd8ce('0x3e')][_0xd8ce('0x76')]=_0x5231cc[_0xd8ce('0x5b')][_0xd8ce('0x77')];}else{_0x6883e1[_0xd8ce('0x3c')][_0xd8ce('0x78')]=_0x6883e1[_0xd8ce('0x3e')]['authentication']=![];}_0x6883e1[_0xd8ce('0x3c')]['host']=_0x5231cc[_0xd8ce('0x5b')][_0xd8ce('0x3c')]['host'];_0x6883e1[_0xd8ce('0x3c')][_0xd8ce('0x79')]=_0x5231cc[_0xd8ce('0x5b')]['Imap']['port'];_0x6883e1[_0xd8ce('0x3e')]['host']=_0x5231cc['body']['Smtp'][_0xd8ce('0x7a')];_0x6883e1[_0xd8ce('0x3e')][_0xd8ce('0x79')]=_0x5231cc[_0xd8ce('0x5b')][_0xd8ce('0x3e')][_0xd8ce('0x79')];}else{_0x6883e1[_0xd8ce('0x3c')][_0xd8ce('0x7b')]=_0x6883e1['Smtp'][_0xd8ce('0x7b')]=_0x5231cc[_0xd8ce('0x5b')][_0xd8ce('0x72')];_0x6883e1['Imap']['user']=_0x6883e1[_0xd8ce('0x3e')][_0xd8ce('0x74')]=_0x5231cc[_0xd8ce('0x5b')][_0xd8ce('0x75')];_0x6883e1[_0xd8ce('0x3c')]['password']=_0x6883e1[_0xd8ce('0x3e')][_0xd8ce('0x76')]=_0x5231cc[_0xd8ce('0x5b')][_0xd8ce('0x77')];}return db['MailAccount'][_0xd8ce('0x62')](_0x6883e1,{'include':[{'model':db[_0xd8ce('0x3d')],'as':_0xd8ce('0x3e')},{'model':db['MailServerIn'],'as':_0xd8ce('0x3c')}]})[_0xd8ce('0x1e')](function(_0x37f420){var _0x299afa=_0x5231cc[_0xd8ce('0x74')][_0xd8ce('0x7c')]({'plain':!![]});if(!_0x299afa)throw new Error(_0xd8ce('0x7d'));if(_0x299afa['role']==='user'){var _0x49c2b8=_0x37f420['get']({'plain':!![]});return db[_0xd8ce('0x7e')][_0xd8ce('0x67')]({'where':{'name':_0xd8ce('0x36'),'userProfileId':_0x299afa[_0xd8ce('0x7f')]},'raw':!![]})[_0xd8ce('0x1e')](function(_0x3f360a){if(_0x3f360a&&_0x3f360a[_0xd8ce('0x80')]===0x0){return db[_0xd8ce('0x81')][_0xd8ce('0x62')]({'name':_0x49c2b8[_0xd8ce('0x46')],'resourceId':_0x49c2b8['id'],'type':_0x3f360a[_0xd8ce('0x46')],'sectionId':_0x3f360a['id']},{})[_0xd8ce('0x1e')](function(){return _0x37f420;});}else{return _0x37f420;}})[_0xd8ce('0x27')](function(_0x2e0aeb){logger[_0xd8ce('0x23')](_0xd8ce('0x82'),_0x2e0aeb);throw _0x2e0aeb;});}return _0x37f420;})[_0xd8ce('0x1e')](respondWithResult(_0x1bd82f,0xc9))[_0xd8ce('0x27')](handleError(_0x1bd82f,null));};exports[_0xd8ce('0x83')]=function(_0x500960,_0x4720d6,_0x56a151){return db[_0xd8ce('0x41')][_0xd8ce('0x84')]({'where':{'id':_0x500960[_0xd8ce('0x5c')]['id']}})[_0xd8ce('0x1e')](handleEntityNotFound(_0x4720d6,null))[_0xd8ce('0x1e')](function(_0x1a9aa1){if(_0x1a9aa1){return _0x1a9aa1[_0xd8ce('0x83')]();}return null;})[_0xd8ce('0x1e')](respondWithResult(_0x4720d6,null))[_0xd8ce('0x27')](handleError(_0x4720d6,null));};exports[_0xd8ce('0x85')]=function(_0x11dff6,_0x2c8c63,_0x2ffcb9){if(_0x11dff6[_0xd8ce('0x5b')]['id']){delete _0x11dff6[_0xd8ce('0x5b')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x11dff6[_0xd8ce('0x5c')]['id']}})[_0xd8ce('0x1e')](handleEntityNotFound(_0x2c8c63,null))[_0xd8ce('0x1e')](function(_0x272a5e){if(_0x272a5e){_0x11dff6['body'][_0xd8ce('0x60')]=_0x272a5e['id'];return db[_0xd8ce('0x3b')][_0xd8ce('0x62')](_0x11dff6[_0xd8ce('0x5b')]);}})['then'](respondWithResult(_0x2c8c63,null))[_0xd8ce('0x27')](handleError(_0x2c8c63,null));};exports[_0xd8ce('0x86')]=function(_0x72df9a,_0x48ae56,_0x51a534){return db[_0xd8ce('0x41')][_0xd8ce('0x84')]({'where':{'id':_0x72df9a[_0xd8ce('0x5c')]['id']}})[_0xd8ce('0x1e')](handleEntityNotFound(_0x48ae56,null))[_0xd8ce('0x1e')](function(_0x56062d){if(_0x56062d){return _0x56062d['setImap'](null);}return null;})[_0xd8ce('0x1e')](respondWithStatusCode(_0x48ae56,null))[_0xd8ce('0x27')](handleError(_0x48ae56,null));};exports[_0xd8ce('0x87')]=function(_0x7fc7cb,_0x33e507,_0x4d2ed5){return db[_0xd8ce('0x41')][_0xd8ce('0x84')]({'where':{'id':_0x7fc7cb['params']['id']}})[_0xd8ce('0x1e')](handleEntityNotFound(_0x33e507,null))[_0xd8ce('0x1e')](function(_0x5b05a7){if(_0x5b05a7){return _0x5b05a7['getSmtp']();}return null;})[_0xd8ce('0x1e')](respondWithResult(_0x33e507,null))[_0xd8ce('0x27')](handleError(_0x33e507,null));};exports['addSmtp']=function(_0x4a1d87,_0x16ef09,_0x5c3248){if(_0x4a1d87[_0xd8ce('0x5b')]['id']){delete _0x4a1d87[_0xd8ce('0x5b')]['id'];}return db[_0xd8ce('0x41')][_0xd8ce('0x67')]({'where':{'id':_0x4a1d87[_0xd8ce('0x5c')]['id']}})[_0xd8ce('0x1e')](handleEntityNotFound(_0x16ef09,null))[_0xd8ce('0x1e')](function(_0x5b674c){if(_0x5b674c){_0x4a1d87['body'][_0xd8ce('0x60')]=_0x5b674c['id'];return db[_0xd8ce('0x3d')][_0xd8ce('0x62')](_0x4a1d87[_0xd8ce('0x5b')]);}})['then'](respondWithResult(_0x16ef09,null))[_0xd8ce('0x27')](handleError(_0x16ef09,null));};exports['removeSmtp']=function(_0x2d0fc6,_0x5896ba,_0x2301aa){return db[_0xd8ce('0x41')][_0xd8ce('0x84')]({'where':{'id':_0x2d0fc6['params']['id']}})[_0xd8ce('0x1e')](handleEntityNotFound(_0x5896ba,null))[_0xd8ce('0x1e')](function(_0x561d62){if(_0x561d62){return _0x561d62[_0xd8ce('0x88')](null);}return null;})['then'](respondWithStatusCode(_0x5896ba,null))[_0xd8ce('0x27')](handleError(_0x5896ba,null));};exports[_0xd8ce('0x89')]=function(_0x172adf,_0x2f5fc9,_0x179b8e){return db['MailInteraction'][_0xd8ce('0x67')]({'where':{'id':_0x172adf[_0xd8ce('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2f5fc9,null))[_0xd8ce('0x1e')](function(_0x10edf8){if(_0x10edf8){return _0x10edf8[_0xd8ce('0x89')](_0x172adf[_0xd8ce('0x5b')]['ids'],_['omit'](_0x172adf[_0xd8ce('0x5b')],[_0xd8ce('0x68'),'id'])||{});}})[_0xd8ce('0x1e')](respondWithResult(_0x2f5fc9,null))[_0xd8ce('0x27')](handleError(_0x2f5fc9,null));};exports[_0xd8ce('0x8a')]=function(_0x376318,_0x122c3e,_0x536cf8){var _0x278c0a={'raw':![],'where':{}};var _0x66626e={};var _0x200869={'count':0x0,'rows':[]};return db[_0xd8ce('0x41')][_0xd8ce('0x84')]({'where':{'id':_0x376318[_0xd8ce('0x5c')]['id']}})[_0xd8ce('0x1e')](handleEntityNotFound(_0x122c3e,null))[_0xd8ce('0x1e')](function(_0x1be5cd){if(_0x1be5cd){_0x66626e[_0xd8ce('0x45')]=_[_0xd8ce('0x48')](db['MailInteraction'][_0xd8ce('0x42')]);_0x66626e[_0xd8ce('0x47')]=_['keys'](_0x376318[_0xd8ce('0x47')]);_0x66626e[_0xd8ce('0x50')]=_[_0xd8ce('0x49')](_0x66626e['model'],_0x66626e['query']);_0x278c0a[_0xd8ce('0x4a')]=_[_0xd8ce('0x49')](_0x66626e[_0xd8ce('0x45')],qs['fields'](_0x376318[_0xd8ce('0x47')][_0xd8ce('0x4b')]));_0x278c0a[_0xd8ce('0x4a')]=_0x278c0a[_0xd8ce('0x4a')][_0xd8ce('0x5a')]?_0x278c0a[_0xd8ce('0x4a')]:_0x66626e['model'];if(!_0x376318[_0xd8ce('0x47')][_0xd8ce('0x64')]('nolimit')){_0x278c0a[_0xd8ce('0x2d')]=qs[_0xd8ce('0x2d')](_0x376318[_0xd8ce('0x47')][_0xd8ce('0x2d')]);_0x278c0a[_0xd8ce('0x2b')]=qs[_0xd8ce('0x2b')](_0x376318[_0xd8ce('0x47')]['offset']);}_0x278c0a[_0xd8ce('0x4d')]=qs[_0xd8ce('0x4e')](_0x376318[_0xd8ce('0x47')][_0xd8ce('0x4e')]);_0x278c0a['where']=qs[_0xd8ce('0x50')](_[_0xd8ce('0x51')](_0x376318[_0xd8ce('0x47')],_0x66626e[_0xd8ce('0x50')]));_0x278c0a[_0xd8ce('0x4f')][_0xd8ce('0x60')]=_0x1be5cd['id'];if(_0x376318[_0xd8ce('0x47')][_0xd8ce('0x52')]){_0x278c0a['where']=_['merge'](_0x278c0a[_0xd8ce('0x4f')],{'$or':_[_0xd8ce('0x40')](_0x278c0a[_0xd8ce('0x4a')],function(_0x4c1fe5){var _0x6f8315={};_0x6f8315[_0x4c1fe5]={'$like':'%'+_0x376318[_0xd8ce('0x47')][_0xd8ce('0x52')]+'%'};return _0x6f8315;})});}_0x278c0a=_[_0xd8ce('0x53')]({},_0x278c0a,_0x376318[_0xd8ce('0x55')]);return db['MailInteraction'][_0xd8ce('0x2e')]({'where':_0x278c0a[_0xd8ce('0x4f')]})[_0xd8ce('0x1e')](function(_0x1e3cee){_0x200869[_0xd8ce('0x2e')]=_0x1e3cee;if(_0x376318[_0xd8ce('0x47')][_0xd8ce('0x56')]){_0x278c0a[_0xd8ce('0x65')]=[{'model':db[_0xd8ce('0x8b')],'as':_0xd8ce('0x8c'),'required':![]},{'model':db[_0xd8ce('0x8d')],'as':_0xd8ce('0x8e'),'attributes':[_0xd8ce('0x46'),'fullname',_0xd8ce('0x8f')],'required':![]},{'model':db[_0xd8ce('0x90')],'as':_0xd8ce('0x91'),'attributes':['id',_0xd8ce('0x46'),_0xd8ce('0x92')],'where':_0x376318[_0xd8ce('0x47')][_0xd8ce('0x93')]?{'id':_0x376318[_0xd8ce('0x47')]['tag']}:undefined,'required':_0x376318[_0xd8ce('0x47')][_0xd8ce('0x93')]?!![]:![]}];}return db['MailInteraction'][_0xd8ce('0x57')](_0x278c0a);})[_0xd8ce('0x1e')](function(_0x2a637d){_0x200869['rows']=_0x2a637d;return _0x200869;});}})[_0xd8ce('0x1e')](respondWithFilteredResult(_0x122c3e,_0x278c0a))[_0xd8ce('0x27')](handleError(_0x122c3e,null));};exports[_0xd8ce('0x94')]=function(_0x2282ea,_0x6bd304,_0x5e389d){return db[_0xd8ce('0x41')][_0xd8ce('0x84')]({'where':{'id':_0x2282ea[_0xd8ce('0x5c')]['id']}})['then'](handleEntityNotFound(_0x6bd304,null))[_0xd8ce('0x1e')](function(_0x161ef0){if(_0x161ef0){return db[_0xd8ce('0x95')][_0xd8ce('0x96')](function(_0x563d05){return db[_0xd8ce('0x97')][_0xd8ce('0x35')]({'where':{'MailAccountId':_0x2282ea[_0xd8ce('0x5c')]['id']},'transaction':_0x563d05})[_0xd8ce('0x1e')](function(_0x4ed058){var _0x4af91d=_[_0xd8ce('0x40')](_0x2282ea[_0xd8ce('0x5b')],function(_0x5aabfd){_0x5aabfd[_0xd8ce('0x60')]=_0x2282ea[_0xd8ce('0x5c')]['id'];return _0x5aabfd;});return db[_0xd8ce('0x97')][_0xd8ce('0x98')](_0x4af91d,{'transaction':_0x563d05});});})[_0xd8ce('0x1e')](function(){return db[_0xd8ce('0x97')][_0xd8ce('0x99')]({'where':{'MailAccountId':_0x2282ea['params']['id']},'order':'priority'});});}})['then'](respondWithResult(_0x6bd304,null))[_0xd8ce('0x27')](handleError(_0x6bd304,null));};exports[_0xd8ce('0x9a')]=function(_0x514c66,_0x103e6a,_0x3aa369){var _0xe047b0={};var _0x1bfccf={};var _0xa92547;var _0x485571;return db[_0xd8ce('0x41')]['findOne']({'where':{'id':_0x514c66['params']['id']}})[_0xd8ce('0x1e')](handleEntityNotFound(_0x103e6a,null))[_0xd8ce('0x1e')](function(_0x28552d){if(_0x28552d){_0xa92547=_0x28552d;_0x1bfccf[_0xd8ce('0x45')]=_['keys'](db['MailApplication']['rawAttributes']);_0x1bfccf[_0xd8ce('0x47')]=_[_0xd8ce('0x48')](_0x514c66['query']);_0x1bfccf['filters']=_[_0xd8ce('0x49')](_0x1bfccf[_0xd8ce('0x45')],_0x1bfccf[_0xd8ce('0x47')]);_0xe047b0[_0xd8ce('0x4a')]=_[_0xd8ce('0x49')](_0x1bfccf[_0xd8ce('0x45')],qs[_0xd8ce('0x4b')](_0x514c66[_0xd8ce('0x47')][_0xd8ce('0x4b')]));_0xe047b0[_0xd8ce('0x4a')]=_0xe047b0[_0xd8ce('0x4a')][_0xd8ce('0x5a')]?_0xe047b0[_0xd8ce('0x4a')]:_0x1bfccf[_0xd8ce('0x45')];_0xe047b0[_0xd8ce('0x4d')]=qs['sort'](_0x514c66[_0xd8ce('0x47')][_0xd8ce('0x4e')]);_0xe047b0[_0xd8ce('0x4f')]=qs['filters'](_[_0xd8ce('0x51')](_0x514c66[_0xd8ce('0x47')],_0x1bfccf[_0xd8ce('0x50')]));if(_0x514c66[_0xd8ce('0x47')]['filter']){_0xe047b0['where']=_[_0xd8ce('0x53')](_0xe047b0['where'],{'$or':_['map'](_0xe047b0[_0xd8ce('0x4a')],function(_0x261d4a){var _0x31a84d={};_0x31a84d[_0x261d4a]={'$like':'%'+_0x514c66[_0xd8ce('0x47')]['filter']+'%'};return _0x31a84d;})});}_0xe047b0=_[_0xd8ce('0x53')]({},_0xe047b0,_0x514c66[_0xd8ce('0x55')]);return _0xa92547[_0xd8ce('0x9a')](_0xe047b0);}})['then'](function(_0x2cfe3b){if(_0x2cfe3b){_0x485571=_0x2cfe3b[_0xd8ce('0x5a')];if(!_0x514c66[_0xd8ce('0x47')][_0xd8ce('0x64')](_0xd8ce('0x4c'))){_0xe047b0[_0xd8ce('0x2d')]=qs[_0xd8ce('0x2d')](_0x514c66['query'][_0xd8ce('0x2d')]);_0xe047b0[_0xd8ce('0x2b')]=qs[_0xd8ce('0x2b')](_0x514c66[_0xd8ce('0x47')][_0xd8ce('0x2b')]);}return _0xa92547['getApplications'](_0xe047b0);}})['then'](function(_0x5f0d54){if(_0x5f0d54){return _0x5f0d54?{'count':_0x485571,'rows':_0x5f0d54}:null;}})['then'](respondWithResult(_0x103e6a,null))['catch'](handleError(_0x103e6a,null));};exports[_0xd8ce('0x9b')]=function(_0x162d39,_0x13cedb,_0x45960c){var _0x56cbeb={'raw':!![],'where':{}};var _0x140637={};var _0x529ccc={'count':0x0,'rows':[]};return db[_0xd8ce('0x41')][_0xd8ce('0x84')]({'where':{'id':_0x162d39[_0xd8ce('0x5c')]['id']}})['then'](handleEntityNotFound(_0x13cedb,null))[_0xd8ce('0x1e')](function(_0xba0d99){if(_0xba0d99){_0x140637[_0xd8ce('0x45')]=_[_0xd8ce('0x48')](db['MailMessage']['rawAttributes']);_0x140637[_0xd8ce('0x47')]=_[_0xd8ce('0x48')](_0x162d39[_0xd8ce('0x47')]);_0x140637[_0xd8ce('0x50')]=_[_0xd8ce('0x49')](_0x140637[_0xd8ce('0x45')],_0x140637[_0xd8ce('0x47')]);_0x56cbeb['attributes']=_[_0xd8ce('0x49')](_0x140637[_0xd8ce('0x45')],qs[_0xd8ce('0x4b')](_0x162d39[_0xd8ce('0x47')][_0xd8ce('0x4b')]));_0x56cbeb[_0xd8ce('0x4a')]=_0x56cbeb['attributes'][_0xd8ce('0x5a')]?_0x56cbeb[_0xd8ce('0x4a')]:_0x140637['model'];if(!_0x162d39[_0xd8ce('0x47')]['hasOwnProperty'](_0xd8ce('0x4c'))){_0x56cbeb[_0xd8ce('0x2d')]=qs['limit'](_0x162d39['query'][_0xd8ce('0x2d')]);_0x56cbeb['offset']=qs['offset'](_0x162d39[_0xd8ce('0x47')][_0xd8ce('0x2b')]);}_0x56cbeb['order']=qs[_0xd8ce('0x4e')](_0x162d39[_0xd8ce('0x47')][_0xd8ce('0x4e')]);_0x56cbeb[_0xd8ce('0x4f')]=qs['filters'](_['pick'](_0x162d39[_0xd8ce('0x47')],_0x140637[_0xd8ce('0x50')]));_0x56cbeb[_0xd8ce('0x4f')]['MailAccountId']=_0xba0d99['id'];if(_0x162d39[_0xd8ce('0x47')]['filter']){_0x56cbeb[_0xd8ce('0x4f')]=_['merge'](_0x56cbeb[_0xd8ce('0x4f')],{'$or':_[_0xd8ce('0x40')](_0x56cbeb[_0xd8ce('0x4a')],function(_0x5c0619){var _0x239b8={};_0x239b8[_0x5c0619]={'$like':'%'+_0x162d39['query'][_0xd8ce('0x52')]+'%'};return _0x239b8;})});}if(_0x162d39[_0xd8ce('0x47')][_0xd8ce('0x9c')]){var _0x5d2cc6=_0x162d39[_0xd8ce('0x47')][_0xd8ce('0x9c')]['split'](',');var _0x498c72={};_0x498c72[_0x5d2cc6[0x0]]={'$gte':moment(_0x5d2cc6[0x1])[_0xd8ce('0x9d')](_0xd8ce('0x9e'))};_0x56cbeb[_0xd8ce('0x4f')]=_[_0xd8ce('0x53')](_0x56cbeb[_0xd8ce('0x4f')],_0x498c72);}_0x56cbeb=_[_0xd8ce('0x53')]({},_0x56cbeb,_0x162d39[_0xd8ce('0x55')]);return db[_0xd8ce('0x9f')][_0xd8ce('0x2e')]({'where':_0x56cbeb['where']})['then'](function(_0x4a5dc4){_0x529ccc[_0xd8ce('0x2e')]=_0x4a5dc4;if(_0x162d39[_0xd8ce('0x47')]['includeAll']){_0x56cbeb['include']=[{'all':!![]}];}return db[_0xd8ce('0x9f')][_0xd8ce('0x57')](_0x56cbeb);})[_0xd8ce('0x1e')](function(_0x11e373){if(_0x162d39[_0xd8ce('0x47')][_0xd8ce('0xa0')]===_0xd8ce('0xa1')){for(var _0x3a8d6d=0x0;_0x3a8d6d<_0x11e373['length'];_0x3a8d6d++){_0x11e373[_0x3a8d6d][_0xd8ce('0x5b')]=juice(_0x11e373[_0x3a8d6d][_0xd8ce('0x5b')]);}}_0x529ccc[_0xd8ce('0x58')]=_0x11e373;return _0x529ccc;});}})[_0xd8ce('0x1e')](respondWithFilteredResult(_0x13cedb,_0x56cbeb))[_0xd8ce('0x27')](handleError(_0x13cedb,null));};exports['send']=function(_0x4a1da2,_0x154a46,_0x4421c1){var _0x2bba7b,_0x14e1a2={},_0x36cf70;if(_0x4a1da2[_0xd8ce('0x5b')]['to']){_0x36cf70=_0x4a1da2[_0xd8ce('0x5b')]['to']['split'](',')[0x0];}return db[_0xd8ce('0x41')][_0xd8ce('0x67')]({'where':{'id':_0x4a1da2[_0xd8ce('0x5c')]['id']},'include':[{'model':db[_0xd8ce('0xa2')],'as':_0xd8ce('0xa3'),'include':[{'model':db[_0xd8ce('0x8b')],'as':_0xd8ce('0xa4'),'where':{'email':_0x36cf70},'limit':0x1,'order':[[_0xd8ce('0xa5'),'DESC']]}]},{'model':db[_0xd8ce('0x3d')],'as':'Smtp','raw':!![]}]})[_0xd8ce('0x1e')](handleEntityNotFound(_0x154a46,null))[_0xd8ce('0x1e')](function(_0xa71a95){if(_0xa71a95){_0x2bba7b=_0xa71a95;if(_0xa71a95[_0xd8ce('0x3e')]){if(_['isNil'](_0x4a1da2['body'][_0xd8ce('0xa6')])){_0x4a1da2[_0xd8ce('0x5b')]['from']=util[_0xd8ce('0x9d')](_0xd8ce('0xa7'),_0xa71a95['name'],_0xa71a95[_0xd8ce('0x6e')]||_0xa71a95[_0xd8ce('0x3e')][_0xd8ce('0x74')]);}if(_0x4a1da2[_0xd8ce('0x5b')]['attachments']&&_0x4a1da2[_0xd8ce('0x5b')][_0xd8ce('0xa8')][_0xd8ce('0x5a')]){for(var _0x459737=0x0;_0x459737<_0x4a1da2[_0xd8ce('0x5b')][_0xd8ce('0xa8')][_0xd8ce('0x5a')];_0x459737+=0x1){_0x4a1da2[_0xd8ce('0x5b')][_0xd8ce('0xa8')][_0x459737]={'filename':_0x4a1da2[_0xd8ce('0x5b')][_0xd8ce('0xa8')][_0x459737][_0xd8ce('0x46')],'path':path[_0xd8ce('0xa9')](config[_0xd8ce('0xaa')],_0xd8ce('0xab'),_0x4a1da2[_0xd8ce('0x5b')][_0xd8ce('0xa8')][_0x459737][_0xd8ce('0xac')])};}}var _0x20f01c={'tls':{'rejectUnauthorized':![]}};if(_[_0xd8ce('0x6f')](_0xa71a95['Smtp'][_0xd8ce('0x7b')])){if(_0xa71a95[_0xd8ce('0x3e')][_0xd8ce('0x78')]){_0x20f01c[_0xd8ce('0xad')]={'user':_0xa71a95[_0xd8ce('0x3e')][_0xd8ce('0x74')],'pass':_0xa71a95['Smtp']['pass']};}_0x20f01c[_0xd8ce('0x7a')]=_0xa71a95[_0xd8ce('0x3e')][_0xd8ce('0x7a')];_0x20f01c['port']=_0xa71a95['Smtp'][_0xd8ce('0x79')];_0x20f01c[_0xd8ce('0xae')]=_0xa71a95[_0xd8ce('0x3e')]['secure'];}else{_0x20f01c[_0xd8ce('0x7b')]=_0xa71a95['Smtp']['service'];_0x20f01c[_0xd8ce('0xad')]={'user':_0xa71a95['Smtp'][_0xd8ce('0x74')],'pass':_0xa71a95['Smtp'][_0xd8ce('0x76')]};}return respondWithRpcPromise('SendMail',_0xd8ce('0xaf'),{'account':_0x20f01c,'message':_0x4a1da2[_0xd8ce('0x5b')]});}else{throw new Error('List\x20not\x20found');}}})[_0xd8ce('0x1e')](function(_0x295fe3){if(_0x295fe3){_0x14e1a2=_0x295fe3;if(_0x2bba7b['List']){if(_0x2bba7b[_0xd8ce('0xa3')]['Contacts'][_0xd8ce('0x5a')]){return _0x2bba7b[_0xd8ce('0xa3')][_0xd8ce('0xa4')][0x0];}else{return db[_0xd8ce('0x8b')][_0xd8ce('0x62')](_[_0xd8ce('0x18')](_0x4a1da2[_0xd8ce('0x5b')],{'firstName':_0x4a1da2[_0xd8ce('0x5b')]['to'],'email':_0x4a1da2['body']['to'],'phone':_0x4a1da2[_0xd8ce('0x5b')]['to'],'ListId':_0x2bba7b[_0xd8ce('0xb0')]}));}}else{throw new Error(_0xd8ce('0xb1'));}}})[_0xd8ce('0x1e')](function(_0x10e56e){if(_0x10e56e){var _0x32a2cd={'UserId':_0x4a1da2[_0xd8ce('0x74')]['id'],'ContactId':_0x10e56e['id'],'MailAccountId':_0x2bba7b['id'],'inReplyTo':_0x14e1a2[_0xd8ce('0xb2')],'to':_0x4a1da2[_0xd8ce('0x5b')][_0xd8ce('0xa6')],'cc':_0x4a1da2[_0xd8ce('0x5b')]['cc'],'subject':_0x4a1da2[_0xd8ce('0x5b')][_0xd8ce('0xb3')],'attach':_0x4a1da2[_0xd8ce('0x5b')][_0xd8ce('0xb4')],'firstMsgDirection':_0xd8ce('0xb5'),'lastMsgAt':moment()[_0xd8ce('0x9d')](_0xd8ce('0x9e')),'lastMsgDirection':_0xd8ce('0xb5'),'Messages':[_[_0xd8ce('0x53')](_0x4a1da2['body'],{'messageId':_0x14e1a2[_0xd8ce('0xb2')],'sentAt':moment()[_0xd8ce('0x9d')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x2bba7b['id'],'UserId':_0x4a1da2[_0xd8ce('0x74')]['id'],'ContactId':_0x10e56e['id']})]};if(_0x4a1da2[_0xd8ce('0x5b')][_0xd8ce('0xb6')]){_0x32a2cd=_[_0xd8ce('0x53')](_0x32a2cd,_0x4a1da2['body'][_0xd8ce('0xb6')]);}return db['MailInteraction']['create'](_0x32a2cd,{'include':[{'model':db[_0xd8ce('0x9f')],'as':'Messages'}]});}})['then'](respondWithResult(_0x154a46,null))[_0xd8ce('0x27')](handleError(_0x154a46,null));};exports[_0xd8ce('0xb7')]=function(_0xa3e271,_0x42aa59,_0xd81f73){return db[_0xd8ce('0x41')][_0xd8ce('0x67')]({'where':{'id':_0xa3e271[_0xd8ce('0x5c')]['id']},'include':[{'model':db[_0xd8ce('0x3d')],'as':_0xd8ce('0x3e'),'raw':!![]}]})[_0xd8ce('0x1e')](handleEntityNotFound(_0x42aa59,null))[_0xd8ce('0x1e')](function(_0x38ab04){if(_0x38ab04&&_0x38ab04[_0xd8ce('0x3e')]){var _0x1d9bba={'id':_0x38ab04['id'],'tls':{'rejectUnauthorized':![]}};if(_0x38ab04['Smtp']['service']){_0x1d9bba['service']=_0x38ab04['Smtp']['service'];}else{_0x1d9bba[_0xd8ce('0x7a')]=_0x38ab04[_0xd8ce('0x3e')]['host'];_0x1d9bba[_0xd8ce('0x79')]=_0x38ab04[_0xd8ce('0x3e')]['port'];_0x1d9bba['secure']=_0x38ab04[_0xd8ce('0x3e')]['secure'];}if(_0x38ab04[_0xd8ce('0x3e')][_0xd8ce('0x78')]){_0x1d9bba[_0xd8ce('0xad')]={'user':_0x38ab04[_0xd8ce('0x3e')]['user'],'pass':_0x38ab04['Smtp'][_0xd8ce('0x76')]};}return respondWithRpcPromise(_0xd8ce('0xb8'),_0xd8ce('0xb7'),{'account':_0x1d9bba});}})[_0xd8ce('0x1e')](respondWithResult(_0x42aa59,null))[_0xd8ce('0x27')](handleError(_0x42aa59,null));};exports['destroy']=function(_0x38e69f,_0x12044a){return db[_0xd8ce('0x41')][_0xd8ce('0x67')]({'where':{'id':_0x38e69f['params']['id']}})[_0xd8ce('0x1e')](handleEntityNotFound(_0x12044a,null))['then'](function(_0x5c4b25){if(_0x5c4b25&&_0x5c4b25[_0xd8ce('0x7b')]){throw new db[(_0xd8ce('0xb9'))]['ValidationError'](_0xd8ce('0xba'));}return _0x5c4b25;})[_0xd8ce('0x1e')](removeEntity(_0x12044a,null))[_0xd8ce('0x27')](handleError(_0x12044a,null));};exports[_0xd8ce('0xbb')]=function(_0x5c76a1,_0x3f4154,_0x3ef1ae){return db['MailAccount'][_0xd8ce('0x67')]({'where':{'id':_0x5c76a1[_0xd8ce('0x5c')]['id']}})[_0xd8ce('0x1e')](handleEntityNotFound(_0x3f4154,null))[_0xd8ce('0x1e')](function(_0x2f7654){if(_0x2f7654){return _0x2f7654['addAgents'](_0x5c76a1[_0xd8ce('0x5b')][_0xd8ce('0x68')],_['omit'](_0x5c76a1['body'],[_0xd8ce('0x68'),'id'])||{})[_0xd8ce('0xbc')](function(_0x6edbeb){for(var _0x188595=0x0;_0x188595<_0x5c76a1['body'][_0xd8ce('0x68')][_0xd8ce('0x5a')];_0x188595+=0x1){socket[_0xd8ce('0xbd')](_0xd8ce('0xbe'),{'UserId':Number(_0x5c76a1[_0xd8ce('0x5b')][_0xd8ce('0x68')][_0x188595]),'MailAccountId':Number(_0x5c76a1[_0xd8ce('0x5c')]['id'])});}return _0x6edbeb;});}})[_0xd8ce('0x1e')](respondWithResult(_0x3f4154,null))[_0xd8ce('0x27')](handleError(_0x3f4154,null));};exports['removeAgents']=function(_0x517c36,_0x221344,_0x5680e2){return db[_0xd8ce('0x41')]['find']({'where':{'id':_0x517c36[_0xd8ce('0x5c')]['id']}})[_0xd8ce('0x1e')](handleEntityNotFound(_0x221344,null))[_0xd8ce('0x1e')](function(_0x2f5a7a){if(_0x2f5a7a){return _0x2f5a7a['removeAgents'](_0x517c36[_0xd8ce('0x47')][_0xd8ce('0x68')])['then'](function(){if(_[_0xd8ce('0xbf')](_0x517c36[_0xd8ce('0x47')][_0xd8ce('0x68')])){for(var _0x2ebe60=0x0;_0x2ebe60<_0x517c36[_0xd8ce('0x47')]['ids'][_0xd8ce('0x5a')];_0x2ebe60+=0x1){socket[_0xd8ce('0xbd')](_0xd8ce('0xc0'),{'UserId':Number(_0x517c36['query']['ids'][_0x2ebe60]),'MailAccountId':Number(_0x517c36[_0xd8ce('0x5c')]['id'])});}}else{socket['emit']('userMailAccount:remove',{'UserId':Number(_0x517c36[_0xd8ce('0x47')][_0xd8ce('0x68')]),'MailAccountId':Number(_0x517c36[_0xd8ce('0x5c')]['id'])});}});}})[_0xd8ce('0x1e')](respondWithStatusCode(_0x221344,null))[_0xd8ce('0x27')](handleError(_0x221344,null));};exports[_0xd8ce('0xc1')]=function(_0x336bee,_0x26c1e8,_0x58d705){var _0x41837d={};var _0x493bea={};var _0x4189ac;var _0x5e21dd;return db[_0xd8ce('0x41')][_0xd8ce('0x84')]({'where':{'id':_0x336bee[_0xd8ce('0x5c')]['id']}})['then'](handleEntityNotFound(_0x26c1e8,null))[_0xd8ce('0x1e')](function(_0x1e32c4){if(_0x1e32c4){_0x4189ac=_0x1e32c4;_0x493bea[_0xd8ce('0x45')]=_[_0xd8ce('0x48')](db[_0xd8ce('0x8d')][_0xd8ce('0x42')]);_0x493bea[_0xd8ce('0x47')]=_[_0xd8ce('0x48')](_0x336bee['query']);_0x493bea[_0xd8ce('0x50')]=_[_0xd8ce('0x49')](_0x493bea['model'],_0x493bea[_0xd8ce('0x47')]);_0x41837d[_0xd8ce('0x4a')]=_[_0xd8ce('0x49')](_0x493bea[_0xd8ce('0x45')],qs[_0xd8ce('0x4b')](_0x336bee[_0xd8ce('0x47')][_0xd8ce('0x4b')]));_0x41837d[_0xd8ce('0x4a')]=_0x41837d[_0xd8ce('0x4a')]['length']?_0x41837d[_0xd8ce('0x4a')]:_0x493bea['model'];_0x41837d[_0xd8ce('0x4d')]=qs[_0xd8ce('0x4e')](_0x336bee[_0xd8ce('0x47')]['sort']);_0x41837d[_0xd8ce('0x4f')]=qs[_0xd8ce('0x50')](_[_0xd8ce('0x51')](_0x336bee[_0xd8ce('0x47')],_0x493bea[_0xd8ce('0x50')]));if(_0x336bee[_0xd8ce('0x47')][_0xd8ce('0x52')]){_0x41837d[_0xd8ce('0x4f')]=_[_0xd8ce('0x53')](_0x41837d[_0xd8ce('0x4f')],{'$or':_[_0xd8ce('0x40')](_0x41837d[_0xd8ce('0x4a')],function(_0x2cd5e9){var _0x232371={};_0x232371[_0x2cd5e9]={'$like':'%'+_0x336bee['query']['filter']+'%'};return _0x232371;})});}_0x41837d=_['merge']({},_0x41837d,_0x336bee[_0xd8ce('0x55')]);return _0x4189ac[_0xd8ce('0xc1')](_0x41837d);}})[_0xd8ce('0x1e')](function(_0x3c6a09){if(_0x3c6a09){_0x5e21dd=_0x3c6a09['length'];if(!_0x336bee[_0xd8ce('0x47')]['hasOwnProperty'](_0xd8ce('0x4c'))){_0x41837d[_0xd8ce('0x2d')]=qs[_0xd8ce('0x2d')](_0x336bee[_0xd8ce('0x47')][_0xd8ce('0x2d')]);_0x41837d[_0xd8ce('0x2b')]=qs['offset'](_0x336bee[_0xd8ce('0x47')][_0xd8ce('0x2b')]);}return _0x4189ac[_0xd8ce('0xc1')](_0x41837d);}})[_0xd8ce('0x1e')](function(_0x4e0bd9){if(_0x4e0bd9){return _0x4e0bd9?{'count':_0x5e21dd,'rows':_0x4e0bd9}:null;}})['then'](respondWithResult(_0x26c1e8,null))[_0xd8ce('0x27')](handleError(_0x26c1e8,null));}; \ No newline at end of file +var _0x0bc5=['rows','catch','show','params','MailServerIn','includeAll','find','body','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','hasOwnProperty','order','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','email','ListId','isNil','active','cuser','password','pass','host','port','service','cservice','user','cpassword','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','addSmtp','setSmtp','addInteraction','omit','MailInteraction','CmContact','Contact','User','Owner','fullname','internal','Tags','color','tag','addApplications','sequelize','MailApplication','bulkCreate','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','Contacts','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','sendMail','List','List\x20not\x20found','messageId','attach','out','Interaction','verifySmtp','authentication','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','removeAgents','isArray','emit','userMailAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','html-to-text','juice','ioredis','../../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','./mailAccount.socket','register','jayson/promise','http','then','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','sendStatus','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','MailAccounts','UserProfileResource','stack','name','send','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll'];(function(_0x244183,_0x4e4297){var _0x2c2ec8=function(_0x57392a){while(--_0x57392a){_0x244183['push'](_0x244183['shift']());}};_0x2c2ec8(++_0x4e4297);}(_0x0bc5,0x68));var _0x50bc=function(_0x4422e0,_0x4a077f){_0x4422e0=_0x4422e0-0x0;var _0x25dd47=_0x0bc5[_0x4422e0];return _0x25dd47;};'use strict';var emlformat=require(_0x50bc('0x0'));var rimraf=require(_0x50bc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x50bc('0x2'));var rp=require(_0x50bc('0x3'));var moment=require('moment');var BPromise=require(_0x50bc('0x4'));var Mustache=require(_0x50bc('0x5'));var util=require(_0x50bc('0x6'));var path=require(_0x50bc('0x7'));var sox=require(_0x50bc('0x8'));var csv=require(_0x50bc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x50bc('0xa'));var squel=require(_0x50bc('0xb'));var crypto=require(_0x50bc('0xc'));var jsforce=require(_0x50bc('0xd'));var deskjs=require(_0x50bc('0xe'));var toCsv=require(_0x50bc('0x9'));var querystring=require(_0x50bc('0xf'));var Papa=require('papaparse');var htmlToText=require(_0x50bc('0x10'));var juice=require(_0x50bc('0x11'));var Redis=require(_0x50bc('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x50bc('0x13'));var as=require(_0x50bc('0x14'));var hardwareService=require(_0x50bc('0x15'));var logger=require(_0x50bc('0x16'))(_0x50bc('0x17'));var utils=require(_0x50bc('0x18'));var config=require(_0x50bc('0x19'));var licenseUtil=require(_0x50bc('0x1a'));var db=require(_0x50bc('0x1b'))['db'];config[_0x50bc('0x1c')]=_[_0x50bc('0x1d')](config[_0x50bc('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x50bc('0x1e'))(new Redis(config[_0x50bc('0x1c')]));require(_0x50bc('0x1f'))[_0x50bc('0x20')](socket);var jayson=require(_0x50bc('0x21'));var client=jayson['client'][_0x50bc('0x22')]({'port':0x232b});function respondWithRpcPromise(_0x3910fc,_0x472add,_0x232bed,_0x285197){return new BPromise(function(_0x1cd6d6,_0x436f90){var _0x26daf6=_0x285197||client;return _0x26daf6['request'](_0x3910fc,_0x232bed)[_0x50bc('0x23')](function(_0x352dd1){logger['info'](_0x50bc('0x24'),_0x472add,_0x50bc('0x25'));logger['debug'](_0x50bc('0x26'),_0x472add,_0x50bc('0x25'),JSON[_0x50bc('0x27')](_0x352dd1));if(_0x352dd1[_0x50bc('0x28')]){if(_0x352dd1[_0x50bc('0x28')]['code']===0x1f4){logger[_0x50bc('0x28')](_0x50bc('0x24'),_0x472add,_0x352dd1[_0x50bc('0x28')][_0x50bc('0x29')]);return _0x436f90(_0x352dd1[_0x50bc('0x28')][_0x50bc('0x29')]);}logger[_0x50bc('0x28')](_0x50bc('0x24'),_0x472add,_0x352dd1[_0x50bc('0x28')][_0x50bc('0x29')]);return _0x1cd6d6(_0x352dd1['error'][_0x50bc('0x29')]);}else{logger[_0x50bc('0x2a')](_0x50bc('0x24'),_0x472add,_0x50bc('0x25'));_0x1cd6d6(_0x352dd1['result'][_0x50bc('0x29')]);}})['catch'](function(_0x6df2f0){logger[_0x50bc('0x28')](_0x50bc('0x24'),_0x472add,_0x6df2f0);_0x436f90(_0x6df2f0);});});}function respondWithStatusCode(_0x25b858,_0x32d91a){_0x32d91a=_0x32d91a||0xcc;return function(_0x89156f){if(_0x89156f){return _0x25b858[_0x50bc('0x2b')](_0x32d91a);}return _0x25b858['status'](_0x32d91a)[_0x50bc('0x2c')]();};}function respondWithResult(_0x3ea22e,_0xda0bfa){_0xda0bfa=_0xda0bfa||0xc8;return function(_0x1e77a6){if(_0x1e77a6){return _0x3ea22e['status'](_0xda0bfa)[_0x50bc('0x2d')](_0x1e77a6);}};}function respondWithFilteredResult(_0x4746f6,_0x295fce){return function(_0x5893ae){if(_0x5893ae){var _0x48193c=typeof _0x295fce[_0x50bc('0x2e')]===_0x50bc('0x2f')&&typeof _0x295fce[_0x50bc('0x30')]===_0x50bc('0x2f');var _0x509024=_0x5893ae['count'];var _0x51c0a0=_0x48193c?0x0:_0x295fce[_0x50bc('0x2e')];var _0x57b6dc=_0x48193c?_0x5893ae[_0x50bc('0x31')]:_0x295fce[_0x50bc('0x2e')]+_0x295fce[_0x50bc('0x30')];var _0x407666;if(_0x57b6dc>=_0x509024){_0x57b6dc=_0x509024;_0x407666=0xc8;}else{_0x407666=0xce;}_0x4746f6['status'](_0x407666);return _0x4746f6['set'](_0x50bc('0x32'),_0x51c0a0+'-'+_0x57b6dc+'/'+_0x509024)[_0x50bc('0x2d')](_0x5893ae);}return null;};}function patchUpdates(_0xebe323){return function(_0x2fa446){try{jsonpatch['apply'](_0x2fa446,_0xebe323,!![]);}catch(_0x7e7f55){return BPromise[_0x50bc('0x33')](_0x7e7f55);}return _0x2fa446[_0x50bc('0x34')]();};}function saveUpdates(_0xf3293a,_0x1465c1){return function(_0x3aa7a4){if(_0x3aa7a4){return _0x3aa7a4[_0x50bc('0x35')](_0xf3293a)['then'](function(_0x49d15c){return _0x49d15c;});}return null;};}function removeEntity(_0xf86a1c,_0x325cdf){return function(_0x440fd4){if(_0x440fd4){return _0x440fd4[_0x50bc('0x36')]()[_0x50bc('0x23')](function(){var _0x29e795=_0x440fd4['get']({'plain':!![]});var _0x3dde08=_0x50bc('0x37');return db[_0x50bc('0x38')][_0x50bc('0x36')]({'where':{'type':_0x3dde08,'resourceId':_0x29e795['id']}})[_0x50bc('0x23')](function(){return _0x440fd4;});})[_0x50bc('0x23')](function(){_0xf86a1c['status'](0xcc)[_0x50bc('0x2c')]();});}};}function handleEntityNotFound(_0x56558c,_0x19b636){return function(_0x32eaac){if(!_0x32eaac){_0x56558c[_0x50bc('0x2b')](0x194);}return _0x32eaac;};}function handleError(_0x25458d,_0x6a5fa3){_0x6a5fa3=_0x6a5fa3||0x1f4;return function(_0x56e8c8){logger[_0x50bc('0x28')](_0x56e8c8[_0x50bc('0x39')]);if(_0x56e8c8[_0x50bc('0x3a')]){delete _0x56e8c8[_0x50bc('0x3a')];}_0x25458d['status'](_0x6a5fa3)[_0x50bc('0x3b')](_0x56e8c8);};}exports['index']=function(_0x4cbd4e,_0x2c5b49){var _0xb8340={'include':[{'model':db['MailServerIn'],'as':_0x50bc('0x3c')},{'model':db[_0x50bc('0x3d')],'as':_0x50bc('0x3e')},{'model':db[_0x50bc('0x3f')],'as':_0x50bc('0x40')}]},_0x3d7880={},_0x5bbc11={'count':0x0,'rows':[]};var _0x305253=_[_0x50bc('0x41')](db[_0x50bc('0x42')][_0x50bc('0x43')],function(_0xe2e6c){return{'name':_0xe2e6c[_0x50bc('0x44')],'type':_0xe2e6c['type'][_0x50bc('0x45')]};});_0x3d7880[_0x50bc('0x46')]=_[_0x50bc('0x41')](_0x305253,_0x50bc('0x3a'));_0x3d7880[_0x50bc('0x47')]=_[_0x50bc('0x48')](_0x4cbd4e[_0x50bc('0x47')]);_0x3d7880[_0x50bc('0x49')]=_[_0x50bc('0x4a')](_0x3d7880[_0x50bc('0x46')],_0x3d7880[_0x50bc('0x47')]);_0xb8340[_0x50bc('0x4b')]=_['intersection'](_0x3d7880[_0x50bc('0x46')],qs[_0x50bc('0x4c')](_0x4cbd4e[_0x50bc('0x47')]['fields']));_0xb8340[_0x50bc('0x4b')]=_0xb8340['attributes'][_0x50bc('0x4d')]?_0xb8340['attributes']:_0x3d7880[_0x50bc('0x46')];if(!_0x4cbd4e[_0x50bc('0x47')]['hasOwnProperty'](_0x50bc('0x4e'))){_0xb8340['limit']=qs[_0x50bc('0x30')](_0x4cbd4e[_0x50bc('0x47')][_0x50bc('0x30')]);_0xb8340[_0x50bc('0x2e')]=qs['offset'](_0x4cbd4e[_0x50bc('0x47')][_0x50bc('0x2e')]);}_0xb8340['order']=qs[_0x50bc('0x4f')](_0x4cbd4e[_0x50bc('0x47')]['sort']);_0xb8340[_0x50bc('0x50')]=qs[_0x50bc('0x49')](_[_0x50bc('0x51')](_0x4cbd4e[_0x50bc('0x47')],_0x3d7880[_0x50bc('0x49')]),_0x305253);if(_0x4cbd4e[_0x50bc('0x47')][_0x50bc('0x52')]){_0xb8340[_0x50bc('0x50')]=_[_0x50bc('0x53')](_0xb8340[_0x50bc('0x50')],{'$or':_[_0x50bc('0x41')](_0x305253,function(_0x4c3800){if(_0x4c3800['type']!==_0x50bc('0x54')){var _0x260b48={};_0x260b48[_0x4c3800[_0x50bc('0x3a')]]={'$like':'%'+_0x4cbd4e[_0x50bc('0x47')]['filter']+'%'};return _0x260b48;}})});}_0xb8340=_[_0x50bc('0x53')]({},_0xb8340,_0x4cbd4e[_0x50bc('0x55')]);var _0x30de63={'where':_0xb8340[_0x50bc('0x50')]};return db[_0x50bc('0x42')]['count'](_0x30de63)[_0x50bc('0x23')](function(_0x3ee5c8){_0x5bbc11['count']=_0x3ee5c8;if(_0x4cbd4e['query']['includeAll']){_0xb8340[_0x50bc('0x56')]=[{'all':!![]}];}return db['MailAccount'][_0x50bc('0x57')](_0xb8340);})[_0x50bc('0x23')](function(_0xee08b8){_0x5bbc11[_0x50bc('0x58')]=_0xee08b8;return _0x5bbc11;})['then'](respondWithFilteredResult(_0x2c5b49,_0xb8340))[_0x50bc('0x59')](handleError(_0x2c5b49,null));};exports[_0x50bc('0x5a')]=function(_0x3781c6,_0xdcc9a3){var _0x431361={'raw':![],'where':{'id':_0x3781c6[_0x50bc('0x5b')]['id']},'include':[{'model':db[_0x50bc('0x5c')],'as':'Imap'},{'model':db[_0x50bc('0x3d')],'as':'Smtp'},{'model':db[_0x50bc('0x3f')],'as':_0x50bc('0x40')}]},_0x115d60={};_0x115d60[_0x50bc('0x46')]=_[_0x50bc('0x48')](db['MailAccount'][_0x50bc('0x43')]);_0x115d60[_0x50bc('0x47')]=_[_0x50bc('0x48')](_0x3781c6[_0x50bc('0x47')]);_0x115d60[_0x50bc('0x49')]=_[_0x50bc('0x4a')](_0x115d60[_0x50bc('0x46')],_0x115d60[_0x50bc('0x47')]);_0x431361['attributes']=_['intersection'](_0x115d60[_0x50bc('0x46')],qs[_0x50bc('0x4c')](_0x3781c6[_0x50bc('0x47')][_0x50bc('0x4c')]));_0x431361[_0x50bc('0x4b')]=_0x431361[_0x50bc('0x4b')][_0x50bc('0x4d')]?_0x431361[_0x50bc('0x4b')]:_0x115d60[_0x50bc('0x46')];if(_0x3781c6[_0x50bc('0x47')][_0x50bc('0x5d')]){_0x431361[_0x50bc('0x56')]=[{'all':!![]}];}_0x431361=_[_0x50bc('0x53')]({},_0x431361,_0x3781c6[_0x50bc('0x55')]);return db[_0x50bc('0x42')][_0x50bc('0x5e')](_0x431361)[_0x50bc('0x23')](handleEntityNotFound(_0xdcc9a3,null))[_0x50bc('0x23')](respondWithResult(_0xdcc9a3,null))['catch'](handleError(_0xdcc9a3,null));};exports[_0x50bc('0x35')]=function(_0x1851ce,_0x379800){if(_0x1851ce[_0x50bc('0x5f')]['id']){delete _0x1851ce['body']['id'];}return db[_0x50bc('0x42')][_0x50bc('0x5e')]({'where':{'id':_0x1851ce[_0x50bc('0x5b')]['id']},'include':[{'model':db[_0x50bc('0x5c')],'as':_0x50bc('0x3c')},{'model':db[_0x50bc('0x3d')],'as':_0x50bc('0x3e')},{'model':db[_0x50bc('0x3f')],'as':'mandatoryDispositionPause'}]})[_0x50bc('0x23')](handleEntityNotFound(_0x379800,null))[_0x50bc('0x23')](saveUpdates(_0x1851ce[_0x50bc('0x5f')],null))[_0x50bc('0x23')](function(_0x3ac636){if(_0x3ac636&&_0x1851ce[_0x50bc('0x5f')][_0x50bc('0x3c')]){return db[_0x50bc('0x5c')][_0x50bc('0x35')](_0x1851ce[_0x50bc('0x5f')]['Imap'],{'where':{'MailAccountId':_0x3ac636['id']}})[_0x50bc('0x23')](function(){return _0x3ac636;});}return _0x3ac636;})[_0x50bc('0x23')](function(_0xf85e57){if(_0xf85e57&&_0x1851ce[_0x50bc('0x5f')][_0x50bc('0x3e')]){return db['MailServerOut'][_0x50bc('0x35')](_0x1851ce[_0x50bc('0x5f')][_0x50bc('0x3e')],{'where':{'MailAccountId':_0xf85e57['id']}})[_0x50bc('0x23')](function(){return _0xf85e57;});}return _0xf85e57;})[_0x50bc('0x23')](respondWithResult(_0x379800,null))[_0x50bc('0x59')](handleError(_0x379800,null));};exports[_0x50bc('0x60')]=function(_0x5228f6,_0x2c333e){return db[_0x50bc('0x42')][_0x50bc('0x60')]()[_0x50bc('0x23')](respondWithResult(_0x2c333e,null))[_0x50bc('0x59')](handleError(_0x2c333e,null));};exports[_0x50bc('0x61')]=function(_0x2bb831,_0x23ab9d,_0x45df1d){if(_0x2bb831[_0x50bc('0x5f')]['id']){delete _0x2bb831[_0x50bc('0x5f')]['id'];}return db[_0x50bc('0x42')]['find']({'where':{'id':_0x2bb831[_0x50bc('0x5b')]['id']}})[_0x50bc('0x23')](handleEntityNotFound(_0x23ab9d,null))[_0x50bc('0x23')](function(_0x4b819b){if(_0x4b819b){_0x2bb831['body'][_0x50bc('0x62')]=_0x4b819b['id'];return db[_0x50bc('0x63')][_0x50bc('0x64')](_0x2bb831['body']);}})['then'](respondWithResult(_0x23ab9d,null))[_0x50bc('0x59')](handleError(_0x23ab9d,null));};exports[_0x50bc('0x65')]=function(_0x4db24c,_0x7960b0,_0x40ff2b){var _0x5b8766={'raw':![],'where':{}};var _0x44d726={};var _0x70950c={'count':0x0,'rows':[]};return db['MailAccount'][_0x50bc('0x66')]({'where':{'id':_0x4db24c[_0x50bc('0x5b')]['id']}})[_0x50bc('0x23')](handleEntityNotFound(_0x7960b0,null))[_0x50bc('0x23')](function(_0x46bcc9){if(_0x46bcc9){_0x44d726['model']=_['keys'](db[_0x50bc('0x63')]['rawAttributes']);_0x44d726[_0x50bc('0x47')]=_[_0x50bc('0x48')](_0x4db24c[_0x50bc('0x47')]);_0x44d726[_0x50bc('0x49')]=_[_0x50bc('0x4a')](_0x44d726['model'],_0x44d726[_0x50bc('0x47')]);_0x5b8766[_0x50bc('0x4b')]=_[_0x50bc('0x4a')](_0x44d726[_0x50bc('0x46')],qs[_0x50bc('0x4c')](_0x4db24c['query']['fields']));_0x5b8766[_0x50bc('0x4b')]=_0x5b8766['attributes'][_0x50bc('0x4d')]?_0x5b8766[_0x50bc('0x4b')]:_0x44d726[_0x50bc('0x46')];if(!_0x4db24c['query'][_0x50bc('0x67')](_0x50bc('0x4e'))){_0x5b8766[_0x50bc('0x30')]=qs['limit'](_0x4db24c['query'][_0x50bc('0x30')]);_0x5b8766['offset']=qs[_0x50bc('0x2e')](_0x4db24c[_0x50bc('0x47')][_0x50bc('0x2e')]);}_0x5b8766[_0x50bc('0x68')]=qs[_0x50bc('0x4f')](_0x4db24c[_0x50bc('0x47')]['sort']);_0x5b8766['where']=qs[_0x50bc('0x49')](_['pick'](_0x4db24c['query'],_0x44d726[_0x50bc('0x49')]));_0x5b8766['where']['MailAccountId']=_0x46bcc9['id'];if(_0x4db24c[_0x50bc('0x47')][_0x50bc('0x52')]){_0x5b8766[_0x50bc('0x50')]=_[_0x50bc('0x53')](_0x5b8766[_0x50bc('0x50')],{'$or':_[_0x50bc('0x41')](_0x5b8766[_0x50bc('0x4b')],function(_0xe695c3){var _0x699061={};_0x699061[_0xe695c3]={'$like':'%'+_0x4db24c[_0x50bc('0x47')]['filter']+'%'};return _0x699061;})});}_0x5b8766=_[_0x50bc('0x53')]({},_0x5b8766,_0x4db24c[_0x50bc('0x55')]);return db[_0x50bc('0x63')][_0x50bc('0x31')]({'where':_0x5b8766[_0x50bc('0x50')]})[_0x50bc('0x23')](function(_0x235857){_0x70950c[_0x50bc('0x31')]=_0x235857;if(_0x4db24c[_0x50bc('0x47')][_0x50bc('0x5d')]){_0x5b8766[_0x50bc('0x56')]=[{'all':!![]}];}return db[_0x50bc('0x63')][_0x50bc('0x57')](_0x5b8766);})[_0x50bc('0x23')](function(_0x33ce46){_0x70950c['rows']=_0x33ce46;return _0x70950c;});}})[_0x50bc('0x23')](respondWithFilteredResult(_0x7960b0,_0x5b8766))[_0x50bc('0x59')](handleError(_0x7960b0,null));};exports[_0x50bc('0x69')]=function(_0x4e6e1b,_0x237a42,_0x44130e){return db[_0x50bc('0x42')]['find']({'where':{'id':_0x4e6e1b[_0x50bc('0x5b')]['id']}})[_0x50bc('0x23')](handleEntityNotFound(_0x237a42,null))[_0x50bc('0x23')](function(_0x4dd4b4){if(_0x4dd4b4){return _0x4dd4b4[_0x50bc('0x69')](_0x4e6e1b[_0x50bc('0x47')][_0x50bc('0x6a')]);}})['then'](respondWithStatusCode(_0x237a42,null))[_0x50bc('0x59')](handleError(_0x237a42,null));};exports[_0x50bc('0x6b')]=function(_0x36d28f,_0x2b53e3,_0xd9285c){if(_0x36d28f[_0x50bc('0x5f')]['id']){delete _0x36d28f[_0x50bc('0x5f')]['id'];}return db[_0x50bc('0x42')][_0x50bc('0x5e')]({'where':{'id':_0x36d28f['params']['id']}})['then'](handleEntityNotFound(_0x2b53e3,null))[_0x50bc('0x23')](function(_0x28660d){if(_0x28660d){_0x36d28f[_0x50bc('0x5f')][_0x50bc('0x62')]=_0x28660d['id'];return db['CannedAnswer'][_0x50bc('0x64')](_0x36d28f['body']);}})[_0x50bc('0x23')](respondWithResult(_0x2b53e3,null))[_0x50bc('0x59')](handleError(_0x2b53e3,null));};exports[_0x50bc('0x6c')]=function(_0x44df90,_0x416f3d,_0x5bf33f){var _0x333fad={'raw':![],'where':{}};var _0x5cdf92={};var _0x31ab26={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x44df90['params']['id']}})[_0x50bc('0x23')](handleEntityNotFound(_0x416f3d,null))['then'](function(_0x42553){if(_0x42553){_0x5cdf92[_0x50bc('0x46')]=_[_0x50bc('0x48')](db[_0x50bc('0x6d')][_0x50bc('0x43')]);_0x5cdf92[_0x50bc('0x47')]=_[_0x50bc('0x48')](_0x44df90[_0x50bc('0x47')]);_0x5cdf92['filters']=_['intersection'](_0x5cdf92['model'],_0x5cdf92[_0x50bc('0x47')]);_0x333fad['attributes']=_[_0x50bc('0x4a')](_0x5cdf92['model'],qs[_0x50bc('0x4c')](_0x44df90[_0x50bc('0x47')][_0x50bc('0x4c')]));_0x333fad[_0x50bc('0x4b')]=_0x333fad[_0x50bc('0x4b')]['length']?_0x333fad[_0x50bc('0x4b')]:_0x5cdf92[_0x50bc('0x46')];if(!_0x44df90[_0x50bc('0x47')][_0x50bc('0x67')](_0x50bc('0x4e'))){_0x333fad[_0x50bc('0x30')]=qs[_0x50bc('0x30')](_0x44df90[_0x50bc('0x47')][_0x50bc('0x30')]);_0x333fad[_0x50bc('0x2e')]=qs[_0x50bc('0x2e')](_0x44df90[_0x50bc('0x47')][_0x50bc('0x2e')]);}_0x333fad[_0x50bc('0x68')]=qs[_0x50bc('0x4f')](_0x44df90[_0x50bc('0x47')]['sort']);_0x333fad[_0x50bc('0x50')]=qs[_0x50bc('0x49')](_[_0x50bc('0x51')](_0x44df90[_0x50bc('0x47')],_0x5cdf92[_0x50bc('0x49')]));_0x333fad[_0x50bc('0x50')][_0x50bc('0x62')]=_0x42553['id'];if(_0x44df90[_0x50bc('0x47')]['filter']){_0x333fad[_0x50bc('0x50')]=_[_0x50bc('0x53')](_0x333fad[_0x50bc('0x50')],{'$or':_['map'](_0x333fad[_0x50bc('0x4b')],function(_0x4c84dc){var _0x4e1c29={};_0x4e1c29[_0x4c84dc]={'$like':'%'+_0x44df90['query'][_0x50bc('0x52')]+'%'};return _0x4e1c29;})});}_0x333fad=_[_0x50bc('0x53')]({},_0x333fad,_0x44df90['options']);return db['CannedAnswer'][_0x50bc('0x31')]({'where':_0x333fad[_0x50bc('0x50')]})[_0x50bc('0x23')](function(_0x449cdb){_0x31ab26[_0x50bc('0x31')]=_0x449cdb;if(_0x44df90[_0x50bc('0x47')][_0x50bc('0x5d')]){_0x333fad[_0x50bc('0x56')]=[{'all':!![]}];}return db['CannedAnswer'][_0x50bc('0x57')](_0x333fad);})[_0x50bc('0x23')](function(_0xa2fcd3){_0x31ab26[_0x50bc('0x58')]=_0xa2fcd3;return _0x31ab26;});}})[_0x50bc('0x23')](respondWithFilteredResult(_0x416f3d,_0x333fad))[_0x50bc('0x59')](handleError(_0x416f3d,null));};exports['removeAnswers']=function(_0x5588c8,_0x59c39b,_0x319607){return db[_0x50bc('0x42')][_0x50bc('0x5e')]({'where':{'id':_0x5588c8[_0x50bc('0x5b')]['id']}})['then'](handleEntityNotFound(_0x59c39b,null))[_0x50bc('0x23')](function(_0x5814e1){if(_0x5814e1){return _0x5814e1[_0x50bc('0x6e')](_0x5588c8[_0x50bc('0x47')][_0x50bc('0x6a')]);}})[_0x50bc('0x23')](respondWithStatusCode(_0x59c39b,null))['catch'](handleError(_0x59c39b,null));};exports[_0x50bc('0x64')]=function(_0x17c57e,_0x4e05ff){var _0x1c1f42={'name':_0x17c57e[_0x50bc('0x5f')][_0x50bc('0x3a')],'key':_0x17c57e['body'][_0x50bc('0x45')],'email':_0x17c57e[_0x50bc('0x5f')][_0x50bc('0x6f')],'ListId':_0x17c57e[_0x50bc('0x5f')][_0x50bc('0x70')],'active':!_[_0x50bc('0x71')](_0x17c57e['body'][_0x50bc('0x72')])?_0x17c57e[_0x50bc('0x5f')][_0x50bc('0x72')]:!![],'description':_0x17c57e[_0x50bc('0x5f')]['description']||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x17c57e[_0x50bc('0x5f')]['cservice'])){if(_0x17c57e[_0x50bc('0x5f')]['cauthentication']){_0x1c1f42[_0x50bc('0x3c')]['user']=_0x1c1f42[_0x50bc('0x3e')]['user']=_0x17c57e[_0x50bc('0x5f')][_0x50bc('0x73')];_0x1c1f42[_0x50bc('0x3c')][_0x50bc('0x74')]=_0x1c1f42[_0x50bc('0x3e')][_0x50bc('0x75')]=_0x17c57e[_0x50bc('0x5f')]['cpassword'];}else{_0x1c1f42[_0x50bc('0x3c')]['authentication']=_0x1c1f42[_0x50bc('0x3e')]['authentication']=![];}_0x1c1f42[_0x50bc('0x3c')][_0x50bc('0x76')]=_0x17c57e[_0x50bc('0x5f')][_0x50bc('0x3c')]['host'];_0x1c1f42[_0x50bc('0x3c')][_0x50bc('0x77')]=_0x17c57e[_0x50bc('0x5f')]['Imap'][_0x50bc('0x77')];_0x1c1f42[_0x50bc('0x3e')][_0x50bc('0x76')]=_0x17c57e[_0x50bc('0x5f')][_0x50bc('0x3e')]['host'];_0x1c1f42[_0x50bc('0x3e')][_0x50bc('0x77')]=_0x17c57e['body'][_0x50bc('0x3e')]['port'];}else{_0x1c1f42[_0x50bc('0x3c')]['service']=_0x1c1f42[_0x50bc('0x3e')][_0x50bc('0x78')]=_0x17c57e['body'][_0x50bc('0x79')];_0x1c1f42[_0x50bc('0x3c')][_0x50bc('0x7a')]=_0x1c1f42['Smtp']['user']=_0x17c57e[_0x50bc('0x5f')][_0x50bc('0x73')];_0x1c1f42[_0x50bc('0x3c')][_0x50bc('0x74')]=_0x1c1f42['Smtp']['pass']=_0x17c57e[_0x50bc('0x5f')][_0x50bc('0x7b')];}return db['MailAccount']['create'](_0x1c1f42,{'include':[{'model':db[_0x50bc('0x3d')],'as':_0x50bc('0x3e')},{'model':db[_0x50bc('0x5c')],'as':_0x50bc('0x3c')}]})[_0x50bc('0x23')](function(_0x1eb6ce){var _0x456890=_0x17c57e[_0x50bc('0x7a')][_0x50bc('0x7c')]({'plain':!![]});if(!_0x456890)throw new Error(_0x50bc('0x7d'));if(_0x456890[_0x50bc('0x7e')]===_0x50bc('0x7a')){var _0x29d3ca=_0x1eb6ce[_0x50bc('0x7c')]({'plain':!![]});return db[_0x50bc('0x7f')]['find']({'where':{'name':_0x50bc('0x37'),'userProfileId':_0x456890['userProfileId']},'raw':!![]})[_0x50bc('0x23')](function(_0x1f8d2d){if(_0x1f8d2d&&_0x1f8d2d[_0x50bc('0x80')]===0x0){return db['UserProfileResource'][_0x50bc('0x64')]({'name':_0x29d3ca['name'],'resourceId':_0x29d3ca['id'],'type':_0x1f8d2d['name'],'sectionId':_0x1f8d2d['id']},{})['then'](function(){return _0x1eb6ce;});}else{return _0x1eb6ce;}})[_0x50bc('0x59')](function(_0x2c80bd){logger['error'](_0x50bc('0x81'),_0x2c80bd);throw _0x2c80bd;});}return _0x1eb6ce;})[_0x50bc('0x23')](respondWithResult(_0x4e05ff,0xc9))[_0x50bc('0x59')](handleError(_0x4e05ff,null));};exports[_0x50bc('0x82')]=function(_0x5c7093,_0x321681,_0x2af15f){return db[_0x50bc('0x42')][_0x50bc('0x66')]({'where':{'id':_0x5c7093[_0x50bc('0x5b')]['id']}})['then'](handleEntityNotFound(_0x321681,null))[_0x50bc('0x23')](function(_0x53d8d3){if(_0x53d8d3){return _0x53d8d3['getImap']();}return null;})[_0x50bc('0x23')](respondWithResult(_0x321681,null))[_0x50bc('0x59')](handleError(_0x321681,null));};exports[_0x50bc('0x83')]=function(_0x575b97,_0x507094,_0x2feb12){if(_0x575b97[_0x50bc('0x5f')]['id']){delete _0x575b97['body']['id'];}return db[_0x50bc('0x42')][_0x50bc('0x5e')]({'where':{'id':_0x575b97[_0x50bc('0x5b')]['id']}})['then'](handleEntityNotFound(_0x507094,null))['then'](function(_0xbf2ae9){if(_0xbf2ae9){_0x575b97[_0x50bc('0x5f')][_0x50bc('0x62')]=_0xbf2ae9['id'];return db[_0x50bc('0x5c')][_0x50bc('0x64')](_0x575b97[_0x50bc('0x5f')]);}})['then'](respondWithResult(_0x507094,null))[_0x50bc('0x59')](handleError(_0x507094,null));};exports['removeImap']=function(_0x3fe056,_0x1198b6,_0x43d822){return db[_0x50bc('0x42')][_0x50bc('0x66')]({'where':{'id':_0x3fe056[_0x50bc('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1198b6,null))[_0x50bc('0x23')](function(_0x4fdc0c){if(_0x4fdc0c){return _0x4fdc0c[_0x50bc('0x84')](null);}return null;})['then'](respondWithStatusCode(_0x1198b6,null))[_0x50bc('0x59')](handleError(_0x1198b6,null));};exports[_0x50bc('0x85')]=function(_0x1db022,_0x88bd30,_0x29384d){return db[_0x50bc('0x42')][_0x50bc('0x66')]({'where':{'id':_0x1db022[_0x50bc('0x5b')]['id']}})[_0x50bc('0x23')](handleEntityNotFound(_0x88bd30,null))[_0x50bc('0x23')](function(_0x5600c7){if(_0x5600c7){return _0x5600c7[_0x50bc('0x85')]();}return null;})[_0x50bc('0x23')](respondWithResult(_0x88bd30,null))['catch'](handleError(_0x88bd30,null));};exports[_0x50bc('0x86')]=function(_0x2af5ec,_0x2d64b4,_0x3f7385){if(_0x2af5ec[_0x50bc('0x5f')]['id']){delete _0x2af5ec[_0x50bc('0x5f')]['id'];}return db[_0x50bc('0x42')][_0x50bc('0x5e')]({'where':{'id':_0x2af5ec['params']['id']}})[_0x50bc('0x23')](handleEntityNotFound(_0x2d64b4,null))['then'](function(_0x4374d8){if(_0x4374d8){_0x2af5ec[_0x50bc('0x5f')]['MailAccountId']=_0x4374d8['id'];return db[_0x50bc('0x3d')][_0x50bc('0x64')](_0x2af5ec[_0x50bc('0x5f')]);}})[_0x50bc('0x23')](respondWithResult(_0x2d64b4,null))[_0x50bc('0x59')](handleError(_0x2d64b4,null));};exports['removeSmtp']=function(_0x5bd976,_0x55063b,_0x2af7b1){return db['MailAccount'][_0x50bc('0x66')]({'where':{'id':_0x5bd976['params']['id']}})[_0x50bc('0x23')](handleEntityNotFound(_0x55063b,null))['then'](function(_0x778eb8){if(_0x778eb8){return _0x778eb8[_0x50bc('0x87')](null);}return null;})[_0x50bc('0x23')](respondWithStatusCode(_0x55063b,null))[_0x50bc('0x59')](handleError(_0x55063b,null));};exports[_0x50bc('0x88')]=function(_0x5d0c80,_0x2ed133,_0x40a717){return db['MailInteraction'][_0x50bc('0x5e')]({'where':{'id':_0x5d0c80[_0x50bc('0x5b')]['id']}})[_0x50bc('0x23')](handleEntityNotFound(_0x2ed133,null))[_0x50bc('0x23')](function(_0x402385){if(_0x402385){return _0x402385['addInteraction'](_0x5d0c80['body'][_0x50bc('0x6a')],_[_0x50bc('0x89')](_0x5d0c80[_0x50bc('0x5f')],[_0x50bc('0x6a'),'id'])||{});}})['then'](respondWithResult(_0x2ed133,null))['catch'](handleError(_0x2ed133,null));};exports['getInteractions']=function(_0x14fd6e,_0x190d49,_0x3f05c1){var _0xba5d51={'raw':![],'where':{}};var _0x51b857={};var _0xcc3f6f={'count':0x0,'rows':[]};return db[_0x50bc('0x42')][_0x50bc('0x66')]({'where':{'id':_0x14fd6e[_0x50bc('0x5b')]['id']}})[_0x50bc('0x23')](handleEntityNotFound(_0x190d49,null))[_0x50bc('0x23')](function(_0xc80bfe){if(_0xc80bfe){_0x51b857[_0x50bc('0x46')]=_['keys'](db[_0x50bc('0x8a')][_0x50bc('0x43')]);_0x51b857[_0x50bc('0x47')]=_['keys'](_0x14fd6e[_0x50bc('0x47')]);_0x51b857['filters']=_[_0x50bc('0x4a')](_0x51b857[_0x50bc('0x46')],_0x51b857[_0x50bc('0x47')]);_0xba5d51[_0x50bc('0x4b')]=_[_0x50bc('0x4a')](_0x51b857[_0x50bc('0x46')],qs[_0x50bc('0x4c')](_0x14fd6e[_0x50bc('0x47')]['fields']));_0xba5d51[_0x50bc('0x4b')]=_0xba5d51[_0x50bc('0x4b')]['length']?_0xba5d51['attributes']:_0x51b857[_0x50bc('0x46')];if(!_0x14fd6e[_0x50bc('0x47')][_0x50bc('0x67')](_0x50bc('0x4e'))){_0xba5d51[_0x50bc('0x30')]=qs[_0x50bc('0x30')](_0x14fd6e[_0x50bc('0x47')][_0x50bc('0x30')]);_0xba5d51[_0x50bc('0x2e')]=qs['offset'](_0x14fd6e[_0x50bc('0x47')][_0x50bc('0x2e')]);}_0xba5d51[_0x50bc('0x68')]=qs[_0x50bc('0x4f')](_0x14fd6e[_0x50bc('0x47')]['sort']);_0xba5d51['where']=qs['filters'](_[_0x50bc('0x51')](_0x14fd6e[_0x50bc('0x47')],_0x51b857['filters']));_0xba5d51[_0x50bc('0x50')][_0x50bc('0x62')]=_0xc80bfe['id'];if(_0x14fd6e[_0x50bc('0x47')]['filter']){_0xba5d51[_0x50bc('0x50')]=_[_0x50bc('0x53')](_0xba5d51[_0x50bc('0x50')],{'$or':_[_0x50bc('0x41')](_0xba5d51['attributes'],function(_0x151ca0){var _0x1b7403={};_0x1b7403[_0x151ca0]={'$like':'%'+_0x14fd6e[_0x50bc('0x47')]['filter']+'%'};return _0x1b7403;})});}_0xba5d51=_['merge']({},_0xba5d51,_0x14fd6e['options']);return db[_0x50bc('0x8a')][_0x50bc('0x31')]({'where':_0xba5d51[_0x50bc('0x50')]})[_0x50bc('0x23')](function(_0x584c60){_0xcc3f6f[_0x50bc('0x31')]=_0x584c60;if(_0x14fd6e[_0x50bc('0x47')][_0x50bc('0x5d')]){_0xba5d51['include']=[{'model':db[_0x50bc('0x8b')],'as':_0x50bc('0x8c'),'required':![]},{'model':db[_0x50bc('0x8d')],'as':_0x50bc('0x8e'),'attributes':['name',_0x50bc('0x8f'),_0x50bc('0x90')],'required':![]},{'model':db['Tag'],'as':_0x50bc('0x91'),'attributes':['id',_0x50bc('0x3a'),_0x50bc('0x92')],'where':_0x14fd6e[_0x50bc('0x47')][_0x50bc('0x93')]?{'id':_0x14fd6e[_0x50bc('0x47')][_0x50bc('0x93')]}:undefined,'required':_0x14fd6e[_0x50bc('0x47')][_0x50bc('0x93')]?!![]:![]}];}return db[_0x50bc('0x8a')]['findAll'](_0xba5d51);})[_0x50bc('0x23')](function(_0x17565c){_0xcc3f6f['rows']=_0x17565c;return _0xcc3f6f;});}})[_0x50bc('0x23')](respondWithFilteredResult(_0x190d49,_0xba5d51))[_0x50bc('0x59')](handleError(_0x190d49,null));};exports[_0x50bc('0x94')]=function(_0x5588cb,_0x2693b5,_0x2a3a90){return db[_0x50bc('0x42')][_0x50bc('0x66')]({'where':{'id':_0x5588cb[_0x50bc('0x5b')]['id']}})[_0x50bc('0x23')](handleEntityNotFound(_0x2693b5,null))[_0x50bc('0x23')](function(_0xefca59){if(_0xefca59){return db[_0x50bc('0x95')]['transaction'](function(_0x13272b){return db[_0x50bc('0x96')][_0x50bc('0x36')]({'where':{'MailAccountId':_0x5588cb['params']['id']},'transaction':_0x13272b})[_0x50bc('0x23')](function(_0x39d929){var _0x463e2c=_['map'](_0x5588cb['body'],function(_0x423070){_0x423070['MailAccountId']=_0x5588cb['params']['id'];return _0x423070;});return db['MailApplication'][_0x50bc('0x97')](_0x463e2c,{'transaction':_0x13272b});});})[_0x50bc('0x23')](function(){return db[_0x50bc('0x96')]['findAndCountAll']({'where':{'MailAccountId':_0x5588cb[_0x50bc('0x5b')]['id']},'order':_0x50bc('0x98')});});}})[_0x50bc('0x23')](respondWithResult(_0x2693b5,null))[_0x50bc('0x59')](handleError(_0x2693b5,null));};exports[_0x50bc('0x99')]=function(_0x730731,_0x50673e,_0x281849){var _0x44407e={};var _0x571048={};var _0x521807;var _0x51eb86;return db[_0x50bc('0x42')][_0x50bc('0x66')]({'where':{'id':_0x730731[_0x50bc('0x5b')]['id']}})[_0x50bc('0x23')](handleEntityNotFound(_0x50673e,null))['then'](function(_0x23d01f){if(_0x23d01f){_0x521807=_0x23d01f;_0x571048[_0x50bc('0x46')]=_[_0x50bc('0x48')](db[_0x50bc('0x96')][_0x50bc('0x43')]);_0x571048['query']=_[_0x50bc('0x48')](_0x730731['query']);_0x571048['filters']=_[_0x50bc('0x4a')](_0x571048[_0x50bc('0x46')],_0x571048['query']);_0x44407e['attributes']=_[_0x50bc('0x4a')](_0x571048[_0x50bc('0x46')],qs['fields'](_0x730731[_0x50bc('0x47')]['fields']));_0x44407e[_0x50bc('0x4b')]=_0x44407e[_0x50bc('0x4b')][_0x50bc('0x4d')]?_0x44407e[_0x50bc('0x4b')]:_0x571048['model'];_0x44407e[_0x50bc('0x68')]=qs[_0x50bc('0x4f')](_0x730731[_0x50bc('0x47')]['sort']);_0x44407e['where']=qs['filters'](_[_0x50bc('0x51')](_0x730731['query'],_0x571048[_0x50bc('0x49')]));if(_0x730731[_0x50bc('0x47')][_0x50bc('0x52')]){_0x44407e[_0x50bc('0x50')]=_[_0x50bc('0x53')](_0x44407e[_0x50bc('0x50')],{'$or':_[_0x50bc('0x41')](_0x44407e[_0x50bc('0x4b')],function(_0x474bb3){var _0x1d71ac={};_0x1d71ac[_0x474bb3]={'$like':'%'+_0x730731[_0x50bc('0x47')][_0x50bc('0x52')]+'%'};return _0x1d71ac;})});}_0x44407e=_[_0x50bc('0x53')]({},_0x44407e,_0x730731[_0x50bc('0x55')]);return _0x521807[_0x50bc('0x99')](_0x44407e);}})[_0x50bc('0x23')](function(_0x46698c){if(_0x46698c){_0x51eb86=_0x46698c[_0x50bc('0x4d')];if(!_0x730731[_0x50bc('0x47')][_0x50bc('0x67')](_0x50bc('0x4e'))){_0x44407e[_0x50bc('0x30')]=qs[_0x50bc('0x30')](_0x730731['query']['limit']);_0x44407e[_0x50bc('0x2e')]=qs[_0x50bc('0x2e')](_0x730731['query'][_0x50bc('0x2e')]);}return _0x521807[_0x50bc('0x99')](_0x44407e);}})['then'](function(_0x55bc9a){if(_0x55bc9a){return _0x55bc9a?{'count':_0x51eb86,'rows':_0x55bc9a}:null;}})[_0x50bc('0x23')](respondWithResult(_0x50673e,null))['catch'](handleError(_0x50673e,null));};exports[_0x50bc('0x9a')]=function(_0xa0b428,_0x15c194,_0x5c4c10){var _0x16887a={'raw':!![],'where':{}};var _0x2a2b9b={};var _0x59a0ce={'count':0x0,'rows':[]};return db[_0x50bc('0x42')][_0x50bc('0x66')]({'where':{'id':_0xa0b428[_0x50bc('0x5b')]['id']}})[_0x50bc('0x23')](handleEntityNotFound(_0x15c194,null))[_0x50bc('0x23')](function(_0x25718f){if(_0x25718f){_0x2a2b9b['model']=_[_0x50bc('0x48')](db[_0x50bc('0x9b')][_0x50bc('0x43')]);_0x2a2b9b['query']=_[_0x50bc('0x48')](_0xa0b428[_0x50bc('0x47')]);_0x2a2b9b['filters']=_['intersection'](_0x2a2b9b[_0x50bc('0x46')],_0x2a2b9b[_0x50bc('0x47')]);_0x16887a['attributes']=_[_0x50bc('0x4a')](_0x2a2b9b[_0x50bc('0x46')],qs[_0x50bc('0x4c')](_0xa0b428['query'][_0x50bc('0x4c')]));_0x16887a[_0x50bc('0x4b')]=_0x16887a['attributes']['length']?_0x16887a[_0x50bc('0x4b')]:_0x2a2b9b[_0x50bc('0x46')];if(!_0xa0b428['query'][_0x50bc('0x67')](_0x50bc('0x4e'))){_0x16887a[_0x50bc('0x30')]=qs[_0x50bc('0x30')](_0xa0b428[_0x50bc('0x47')][_0x50bc('0x30')]);_0x16887a['offset']=qs[_0x50bc('0x2e')](_0xa0b428[_0x50bc('0x47')][_0x50bc('0x2e')]);}_0x16887a['order']=qs[_0x50bc('0x4f')](_0xa0b428['query']['sort']);_0x16887a[_0x50bc('0x50')]=qs[_0x50bc('0x49')](_[_0x50bc('0x51')](_0xa0b428['query'],_0x2a2b9b[_0x50bc('0x49')]));_0x16887a[_0x50bc('0x50')][_0x50bc('0x62')]=_0x25718f['id'];if(_0xa0b428[_0x50bc('0x47')][_0x50bc('0x52')]){_0x16887a[_0x50bc('0x50')]=_['merge'](_0x16887a[_0x50bc('0x50')],{'$or':_[_0x50bc('0x41')](_0x16887a[_0x50bc('0x4b')],function(_0x305829){var _0x1ec753={};_0x1ec753[_0x305829]={'$like':'%'+_0xa0b428['query'][_0x50bc('0x52')]+'%'};return _0x1ec753;})});}if(_0xa0b428[_0x50bc('0x47')][_0x50bc('0x9c')]){var _0x4e189f=_0xa0b428['query'][_0x50bc('0x9c')][_0x50bc('0x9d')](',');var _0x971df7={};_0x971df7[_0x4e189f[0x0]]={'$gte':moment(_0x4e189f[0x1])[_0x50bc('0x9e')](_0x50bc('0x9f'))};_0x16887a[_0x50bc('0x50')]=_['merge'](_0x16887a['where'],_0x971df7);}_0x16887a=_[_0x50bc('0x53')]({},_0x16887a,_0xa0b428['options']);return db[_0x50bc('0x9b')][_0x50bc('0x31')]({'where':_0x16887a[_0x50bc('0x50')]})[_0x50bc('0x23')](function(_0x52291b){_0x59a0ce[_0x50bc('0x31')]=_0x52291b;if(_0xa0b428[_0x50bc('0x47')][_0x50bc('0x5d')]){_0x16887a[_0x50bc('0x56')]=[{'all':!![]}];}return db[_0x50bc('0x9b')][_0x50bc('0x57')](_0x16887a);})[_0x50bc('0x23')](function(_0x10b285){if(_0xa0b428['query'][_0x50bc('0xa0')]===_0x50bc('0xa1')){for(var _0x246e39=0x0;_0x246e39<_0x10b285[_0x50bc('0x4d')];_0x246e39++){_0x10b285[_0x246e39][_0x50bc('0x5f')]=juice(_0x10b285[_0x246e39][_0x50bc('0x5f')]);}}_0x59a0ce[_0x50bc('0x58')]=_0x10b285;return _0x59a0ce;});}})[_0x50bc('0x23')](respondWithFilteredResult(_0x15c194,_0x16887a))[_0x50bc('0x59')](handleError(_0x15c194,null));};exports[_0x50bc('0x3b')]=function(_0x3aa07a,_0x4f3ae1,_0x1af84b){var _0x447b0c,_0x361b82={},_0x535dc1;if(_0x3aa07a['body']['to']){_0x535dc1=_0x3aa07a['body']['to'][_0x50bc('0x9d')](',')[0x0];}return db[_0x50bc('0x42')][_0x50bc('0x5e')]({'where':{'id':_0x3aa07a['params']['id']},'include':[{'model':db[_0x50bc('0xa2')],'as':'List','include':[{'model':db[_0x50bc('0x8b')],'as':_0x50bc('0xa3'),'where':{'email':_0x535dc1},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x50bc('0x3d')],'as':_0x50bc('0x3e'),'raw':!![]}]})[_0x50bc('0x23')](handleEntityNotFound(_0x4f3ae1,null))[_0x50bc('0x23')](function(_0x2a6e25){if(_0x2a6e25){_0x447b0c=_0x2a6e25;if(_0x2a6e25[_0x50bc('0x3e')]){if(_[_0x50bc('0x71')](_0x3aa07a[_0x50bc('0x5f')]['from'])){_0x3aa07a[_0x50bc('0x5f')][_0x50bc('0xa4')]=util[_0x50bc('0x9e')](_0x50bc('0xa5'),_0x2a6e25['name'],_0x2a6e25['email']||_0x2a6e25[_0x50bc('0x3e')]['user']);}if(_0x3aa07a[_0x50bc('0x5f')]['attachments']&&_0x3aa07a[_0x50bc('0x5f')][_0x50bc('0xa6')][_0x50bc('0x4d')]){for(var _0x59873d=0x0;_0x59873d<_0x3aa07a['body'][_0x50bc('0xa6')][_0x50bc('0x4d')];_0x59873d+=0x1){_0x3aa07a[_0x50bc('0x5f')][_0x50bc('0xa6')][_0x59873d]={'filename':_0x3aa07a[_0x50bc('0x5f')][_0x50bc('0xa6')][_0x59873d]['name'],'path':path[_0x50bc('0xa7')](config[_0x50bc('0xa8')],_0x50bc('0xa9'),_0x3aa07a[_0x50bc('0x5f')][_0x50bc('0xa6')][_0x59873d][_0x50bc('0xaa')])};}}var _0x2fe36c={'tls':{'rejectUnauthorized':![]}};if(_[_0x50bc('0x71')](_0x2a6e25['Smtp'][_0x50bc('0x78')])){if(_0x2a6e25[_0x50bc('0x3e')]['authentication']){_0x2fe36c[_0x50bc('0xab')]={'user':_0x2a6e25[_0x50bc('0x3e')]['user'],'pass':_0x2a6e25['Smtp'][_0x50bc('0x75')]};}_0x2fe36c[_0x50bc('0x76')]=_0x2a6e25[_0x50bc('0x3e')][_0x50bc('0x76')];_0x2fe36c[_0x50bc('0x77')]=_0x2a6e25['Smtp'][_0x50bc('0x77')];_0x2fe36c[_0x50bc('0xac')]=_0x2a6e25[_0x50bc('0x3e')]['secure'];}else{_0x2fe36c['service']=_0x2a6e25[_0x50bc('0x3e')][_0x50bc('0x78')];_0x2fe36c[_0x50bc('0xab')]={'user':_0x2a6e25[_0x50bc('0x3e')][_0x50bc('0x7a')],'pass':_0x2a6e25[_0x50bc('0x3e')][_0x50bc('0x75')]};}return respondWithRpcPromise(_0x50bc('0xad'),_0x50bc('0xae'),{'account':_0x2fe36c,'message':_0x3aa07a[_0x50bc('0x5f')]});}else{throw new Error('List\x20not\x20found');}}})[_0x50bc('0x23')](function(_0x34026a){if(_0x34026a){_0x361b82=_0x34026a;if(_0x447b0c[_0x50bc('0xaf')]){if(_0x447b0c[_0x50bc('0xaf')][_0x50bc('0xa3')][_0x50bc('0x4d')]){return _0x447b0c[_0x50bc('0xaf')]['Contacts'][0x0];}else{return db['CmContact'][_0x50bc('0x64')](_[_0x50bc('0x1d')](_0x3aa07a[_0x50bc('0x5f')],{'firstName':_0x3aa07a[_0x50bc('0x5f')]['to'],'email':_0x3aa07a[_0x50bc('0x5f')]['to'],'phone':_0x3aa07a[_0x50bc('0x5f')]['to'],'ListId':_0x447b0c[_0x50bc('0x70')]}));}}else{throw new Error(_0x50bc('0xb0'));}}})[_0x50bc('0x23')](function(_0x1dcb42){if(_0x1dcb42){var _0x391f97={'UserId':_0x3aa07a['user']['id'],'ContactId':_0x1dcb42['id'],'MailAccountId':_0x447b0c['id'],'inReplyTo':_0x361b82[_0x50bc('0xb1')],'to':_0x3aa07a[_0x50bc('0x5f')][_0x50bc('0xa4')],'cc':_0x3aa07a[_0x50bc('0x5f')]['cc'],'subject':_0x3aa07a['body']['subject'],'attach':_0x3aa07a['body'][_0x50bc('0xb2')],'firstMsgDirection':_0x50bc('0xb3'),'lastMsgAt':moment()['format'](_0x50bc('0x9f')),'lastMsgDirection':_0x50bc('0xb3'),'Messages':[_[_0x50bc('0x53')](_0x3aa07a[_0x50bc('0x5f')],{'messageId':_0x361b82['messageId'],'sentAt':moment()[_0x50bc('0x9e')](_0x50bc('0x9f')),'read':!![],'MailAccountId':_0x447b0c['id'],'UserId':_0x3aa07a[_0x50bc('0x7a')]['id'],'ContactId':_0x1dcb42['id']})]};if(_0x3aa07a['body'][_0x50bc('0xb4')]){_0x391f97=_[_0x50bc('0x53')](_0x391f97,_0x3aa07a[_0x50bc('0x5f')]['Interaction']);}return db['MailInteraction'][_0x50bc('0x64')](_0x391f97,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});}})['then'](respondWithResult(_0x4f3ae1,null))[_0x50bc('0x59')](handleError(_0x4f3ae1,null));};exports[_0x50bc('0xb5')]=function(_0x26ebaf,_0x28d1d2,_0x54e0b4){return db[_0x50bc('0x42')][_0x50bc('0x5e')]({'where':{'id':_0x26ebaf[_0x50bc('0x5b')]['id']},'include':[{'model':db[_0x50bc('0x3d')],'as':_0x50bc('0x3e'),'raw':!![]}]})['then'](handleEntityNotFound(_0x28d1d2,null))['then'](function(_0x3f8a61){if(_0x3f8a61&&_0x3f8a61[_0x50bc('0x3e')]){var _0x486ff2={'id':_0x3f8a61['id'],'tls':{'rejectUnauthorized':![]}};if(_0x3f8a61[_0x50bc('0x3e')]['service']){_0x486ff2[_0x50bc('0x78')]=_0x3f8a61[_0x50bc('0x3e')]['service'];}else{_0x486ff2['host']=_0x3f8a61[_0x50bc('0x3e')][_0x50bc('0x76')];_0x486ff2[_0x50bc('0x77')]=_0x3f8a61[_0x50bc('0x3e')][_0x50bc('0x77')];_0x486ff2[_0x50bc('0xac')]=_0x3f8a61[_0x50bc('0x3e')]['secure'];}if(_0x3f8a61[_0x50bc('0x3e')][_0x50bc('0xb6')]){_0x486ff2[_0x50bc('0xab')]={'user':_0x3f8a61[_0x50bc('0x3e')][_0x50bc('0x7a')],'pass':_0x3f8a61['Smtp'][_0x50bc('0x75')]};}return respondWithRpcPromise('VerifySmtp','verifySmtp',{'account':_0x486ff2});}})[_0x50bc('0x23')](respondWithResult(_0x28d1d2,null))['catch'](handleError(_0x28d1d2,null));};exports['destroy']=function(_0x1064d6,_0x5eb0a6){return db[_0x50bc('0x42')][_0x50bc('0x5e')]({'where':{'id':_0x1064d6[_0x50bc('0x5b')]['id']}})[_0x50bc('0x23')](handleEntityNotFound(_0x5eb0a6,null))[_0x50bc('0x23')](function(_0x40b462){if(_0x40b462&&_0x40b462['service']){throw new db[(_0x50bc('0xb7'))]['ValidationError'](_0x50bc('0xb8'));}return _0x40b462;})[_0x50bc('0x23')](removeEntity(_0x5eb0a6,null))[_0x50bc('0x59')](handleError(_0x5eb0a6,null));};exports['addAgents']=function(_0x15f9ca,_0x241073,_0x4c7704){return db[_0x50bc('0x42')][_0x50bc('0x5e')]({'where':{'id':_0x15f9ca['params']['id']}})[_0x50bc('0x23')](handleEntityNotFound(_0x241073,null))[_0x50bc('0x23')](function(_0x46216e){if(_0x46216e){return _0x46216e[_0x50bc('0xb9')](_0x15f9ca[_0x50bc('0x5f')]['ids'],_['omit'](_0x15f9ca['body'],[_0x50bc('0x6a'),'id'])||{})[_0x50bc('0xba')](function(_0xcce85e){for(var _0x1e78dd=0x0;_0x1e78dd<_0x15f9ca[_0x50bc('0x5f')][_0x50bc('0x6a')]['length'];_0x1e78dd+=0x1){socket['emit']('userMailAccount:save',{'UserId':Number(_0x15f9ca[_0x50bc('0x5f')][_0x50bc('0x6a')][_0x1e78dd]),'MailAccountId':Number(_0x15f9ca[_0x50bc('0x5b')]['id'])});}return _0xcce85e;});}})['then'](respondWithResult(_0x241073,null))[_0x50bc('0x59')](handleError(_0x241073,null));};exports['removeAgents']=function(_0x2121ae,_0x1de223,_0x2ae703){return db[_0x50bc('0x42')][_0x50bc('0x5e')]({'where':{'id':_0x2121ae[_0x50bc('0x5b')]['id']}})[_0x50bc('0x23')](handleEntityNotFound(_0x1de223,null))[_0x50bc('0x23')](function(_0x5e2f5c){if(_0x5e2f5c){return _0x5e2f5c[_0x50bc('0xbb')](_0x2121ae[_0x50bc('0x47')][_0x50bc('0x6a')])[_0x50bc('0x23')](function(){if(_[_0x50bc('0xbc')](_0x2121ae[_0x50bc('0x47')][_0x50bc('0x6a')])){for(var _0x1b9f7=0x0;_0x1b9f7<_0x2121ae[_0x50bc('0x47')][_0x50bc('0x6a')][_0x50bc('0x4d')];_0x1b9f7+=0x1){socket[_0x50bc('0xbd')](_0x50bc('0xbe'),{'UserId':Number(_0x2121ae['query'][_0x50bc('0x6a')][_0x1b9f7]),'MailAccountId':Number(_0x2121ae['params']['id'])});}}else{socket[_0x50bc('0xbd')](_0x50bc('0xbe'),{'UserId':Number(_0x2121ae[_0x50bc('0x47')][_0x50bc('0x6a')]),'MailAccountId':Number(_0x2121ae[_0x50bc('0x5b')]['id'])});}});}})[_0x50bc('0x23')](respondWithStatusCode(_0x1de223,null))[_0x50bc('0x59')](handleError(_0x1de223,null));};exports[_0x50bc('0xbf')]=function(_0x3d1efd,_0x40e7b4,_0x330cf4){var _0x46737d={};var _0x565725={};var _0x19b6e4;var _0x5e5bdf;return db[_0x50bc('0x42')]['findOne']({'where':{'id':_0x3d1efd[_0x50bc('0x5b')]['id']}})['then'](handleEntityNotFound(_0x40e7b4,null))['then'](function(_0x52301c){if(_0x52301c){_0x19b6e4=_0x52301c;_0x565725[_0x50bc('0x46')]=_[_0x50bc('0x48')](db[_0x50bc('0x8d')][_0x50bc('0x43')]);_0x565725['query']=_[_0x50bc('0x48')](_0x3d1efd[_0x50bc('0x47')]);_0x565725[_0x50bc('0x49')]=_[_0x50bc('0x4a')](_0x565725[_0x50bc('0x46')],_0x565725[_0x50bc('0x47')]);_0x46737d[_0x50bc('0x4b')]=_[_0x50bc('0x4a')](_0x565725[_0x50bc('0x46')],qs[_0x50bc('0x4c')](_0x3d1efd[_0x50bc('0x47')][_0x50bc('0x4c')]));_0x46737d['attributes']=_0x46737d[_0x50bc('0x4b')][_0x50bc('0x4d')]?_0x46737d[_0x50bc('0x4b')]:_0x565725[_0x50bc('0x46')];_0x46737d['order']=qs[_0x50bc('0x4f')](_0x3d1efd[_0x50bc('0x47')]['sort']);_0x46737d[_0x50bc('0x50')]=qs[_0x50bc('0x49')](_[_0x50bc('0x51')](_0x3d1efd['query'],_0x565725[_0x50bc('0x49')]));if(_0x3d1efd['query'][_0x50bc('0x52')]){_0x46737d[_0x50bc('0x50')]=_[_0x50bc('0x53')](_0x46737d[_0x50bc('0x50')],{'$or':_[_0x50bc('0x41')](_0x46737d[_0x50bc('0x4b')],function(_0x5c3f13){var _0x42bcb5={};_0x42bcb5[_0x5c3f13]={'$like':'%'+_0x3d1efd[_0x50bc('0x47')]['filter']+'%'};return _0x42bcb5;})});}_0x46737d=_[_0x50bc('0x53')]({},_0x46737d,_0x3d1efd[_0x50bc('0x55')]);return _0x19b6e4[_0x50bc('0xbf')](_0x46737d);}})['then'](function(_0x295b85){if(_0x295b85){_0x5e5bdf=_0x295b85['length'];if(!_0x3d1efd[_0x50bc('0x47')][_0x50bc('0x67')]('nolimit')){_0x46737d[_0x50bc('0x30')]=qs[_0x50bc('0x30')](_0x3d1efd[_0x50bc('0x47')][_0x50bc('0x30')]);_0x46737d[_0x50bc('0x2e')]=qs['offset'](_0x3d1efd[_0x50bc('0x47')]['offset']);}return _0x19b6e4['getAgents'](_0x46737d);}})[_0x50bc('0x23')](function(_0x31f52f){if(_0x31f52f){return _0x31f52f?{'count':_0x5e5bdf,'rows':_0x31f52f}:null;}})[_0x50bc('0x23')](respondWithResult(_0x40e7b4,null))[_0x50bc('0x59')](handleError(_0x40e7b4,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 24b7fc9..08a7e28 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 _0xe091=['../../mysqldb','MailAccount','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x247fe1,_0x46cec4){var _0x217740=function(_0x1a01c9){while(--_0x1a01c9){_0x247fe1['push'](_0x247fe1['shift']());}};_0x217740(++_0x46cec4);}(_0xe091,0x1ad));var _0x1e09=function(_0x45f1b3,_0x2300fa){_0x45f1b3=_0x45f1b3-0x0;var _0x5744d6=_0xe091[_0x45f1b3];return _0x5744d6;};'use strict';var EventEmitter=require(_0x1e09('0x0'));var MailAccount=require(_0x1e09('0x1'))['db'][_0x1e09('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1e09('0x3'),'afterUpdate':_0x1e09('0x4'),'afterDestroy':_0x1e09('0x5')};function emitEvent(_0x4e0879){return function(_0x1a43af,_0x110900,_0x1d9cc4){MailAccountEvents[_0x1e09('0x6')](_0x4e0879+':'+_0x1a43af['id'],_0x1a43af);MailAccountEvents[_0x1e09('0x6')](_0x4e0879,_0x1a43af);_0x1d9cc4(null);};}for(var e in events){if(events[_0x1e09('0x7')](e)){var event=events[e];MailAccount[_0x1e09('0x8')](e,emitEvent(event));}}module[_0x1e09('0x9')]=MailAccountEvents; \ No newline at end of file +var _0x236e=['MailAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x6de9fa,_0x4c0492){var _0x387c06=function(_0x33a8ff){while(--_0x33a8ff){_0x6de9fa['push'](_0x6de9fa['shift']());}};_0x387c06(++_0x4c0492);}(_0x236e,0x148));var _0xe236=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x236e[_0x513aa5];return _0x1a1a7c;};'use strict';var EventEmitter=require(_0xe236('0x0'));var MailAccount=require(_0xe236('0x1'))['db'][_0xe236('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xe236('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe236('0x4'),'afterDestroy':_0xe236('0x5')};function emitEvent(_0x512082){return function(_0x638e9e,_0x128914,_0x449ceb){MailAccountEvents[_0xe236('0x6')](_0x512082+':'+_0x638e9e['id'],_0x638e9e);MailAccountEvents[_0xe236('0x6')](_0x512082,_0x638e9e);_0x449ceb(null);};}for(var e in events){if(events[_0xe236('0x7')](e)){var event=events[e];MailAccount[_0xe236('0x8')](e,emitEvent(event));}}module[_0xe236('0x9')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index f551265..7f0ffb8 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 _0x9f39=['bluebird','rimraf','../../config/environment','./mailAccount.attributes','exports','define','MailAccount','lodash','util','api','moment'];(function(_0x10d0f0,_0x1eba3d){var _0x93e308=function(_0x388548){while(--_0x388548){_0x10d0f0['push'](_0x10d0f0['shift']());}};_0x93e308(++_0x1eba3d);}(_0x9f39,0xd8));var _0x99f3=function(_0x16351c,_0x56e09a){_0x16351c=_0x16351c-0x0;var _0x52efc2=_0x9f39[_0x16351c];return _0x52efc2;};'use strict';var _=require(_0x99f3('0x0'));var util=require(_0x99f3('0x1'));var logger=require('../../config/logger')(_0x99f3('0x2'));var moment=require(_0x99f3('0x3'));var BPromise=require(_0x99f3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x99f3('0x5'));var config=require(_0x99f3('0x6'));var attributes=require(_0x99f3('0x7'));module[_0x99f3('0x8')]=function(_0x504afe,_0x3d6ead){return _0x504afe[_0x99f3('0x9')](_0x99f3('0xa'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1634=['./mailAccount.attributes','MailAccount','mail_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x1634,0xc6));var _0x4163=function(_0x312f64,_0x408f74){_0x312f64=_0x312f64-0x0;var _0x4fe3c4=_0x1634[_0x312f64];return _0x4fe3c4;};'use strict';var _=require(_0x4163('0x0'));var util=require(_0x4163('0x1'));var logger=require(_0x4163('0x2'))(_0x4163('0x3'));var moment=require(_0x4163('0x4'));var BPromise=require(_0x4163('0x5'));var rp=require(_0x4163('0x6'));var fs=require('fs');var path=require(_0x4163('0x7'));var rimraf=require(_0x4163('0x8'));var config=require(_0x4163('0x9'));var attributes=require(_0x4163('0xa'));module['exports']=function(_0x5cb52d,_0x2e21b3){return _0x5cb52d['define'](_0x4163('0xb'),attributes,{'tableName':_0x4163('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index a26597f..85d25a5 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 _0x36d8=['MailInteraction','MailMessage','inReplyTo','Contact\x20not\x20found','spread','update','YYYY-MM-DD\x20HH:mm:ss','interaction','created','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','Attachment','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client','http','redis','defaults','localhost','socket.io-emitter','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','include','map','attributes','model','then','info','ShowMailAccount','find','body','mail','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','get','omit','applications','list','List','orderBy','asc','autoclose','*,*,*,*','length','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format'];(function(_0xa96b73,_0x5d4c0c){var _0x4aacc7=function(_0x2b4e29){while(--_0x2b4e29){_0xa96b73['push'](_0xa96b73['shift']());}};_0x4aacc7(++_0x5d4c0c);}(_0x36d8,0x1ba));var _0x836d=function(_0x4a5aa1,_0x498901){_0x4a5aa1=_0x4a5aa1-0x0;var _0x330afc=_0x36d8[_0x4a5aa1];return _0x330afc;};'use strict';var _=require('lodash');var util=require(_0x836d('0x0'));var moment=require('moment');var BPromise=require(_0x836d('0x1'));var rs=require(_0x836d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x836d('0x3'))['db'];var utils=require(_0x836d('0x4'));var logger=require('../../config/logger')(_0x836d('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x836d('0x6')][_0x836d('0x7')]({'port':0x232c});config[_0x836d('0x8')]=_[_0x836d('0x9')](config['redis'],{'host':_0x836d('0xa'),'port':0x18eb});var socket=require(_0x836d('0xb'))(new Redis(config[_0x836d('0x8')]));require('./mailAccount.socket')['register'](socket);function respondWithRpcPromise(_0x311628,_0x61b256,_0x4fe5cc){return new BPromise(function(_0x25955e,_0x39068b){return client['request'](_0x311628,_0x4fe5cc)['then'](function(_0x989215){logger['info'](_0x836d('0xc'),_0x61b256,'request\x20sent');logger[_0x836d('0xd')](_0x836d('0xe'),_0x61b256,_0x836d('0xf'),JSON[_0x836d('0x10')](_0x989215));if(_0x989215[_0x836d('0x11')]){if(_0x989215[_0x836d('0x11')][_0x836d('0x12')]===0x1f4){logger[_0x836d('0x11')](_0x836d('0xc'),_0x61b256,_0x989215[_0x836d('0x11')][_0x836d('0x13')]);return _0x39068b(_0x989215[_0x836d('0x11')][_0x836d('0x13')]);}logger[_0x836d('0x11')]('MailAccount,\x20%s,\x20%s',_0x61b256,_0x989215[_0x836d('0x11')][_0x836d('0x13')]);return _0x25955e(_0x989215[_0x836d('0x11')][_0x836d('0x13')]);}else{logger['info'](_0x836d('0xc'),_0x61b256,_0x836d('0xf'));_0x25955e(_0x989215[_0x836d('0x14')][_0x836d('0x13')]);}})[_0x836d('0x15')](function(_0x21d39d){logger[_0x836d('0x11')](_0x836d('0xc'),_0x61b256,_0x21d39d);_0x39068b(_0x21d39d);});});}exports[_0x836d('0x16')]=function(_0x5a4af3){var _0x379d89=this;return new Promise(function(_0x48f9d3,_0x7d934){return db[_0x836d('0x17')][_0x836d('0x18')]({'raw':_0x5a4af3[_0x836d('0x19')]?_0x5a4af3[_0x836d('0x19')][_0x836d('0x1a')]===undefined?!![]:![]:!![],'where':_0x5a4af3[_0x836d('0x19')]?_0x5a4af3[_0x836d('0x19')][_0x836d('0x1b')]||null:null,'attributes':_0x5a4af3[_0x836d('0x19')]?_0x5a4af3[_0x836d('0x19')]['attributes']||null:null,'limit':_0x5a4af3['options']?_0x5a4af3[_0x836d('0x19')]['limit']||null:null,'include':_0x5a4af3[_0x836d('0x19')]?_0x5a4af3[_0x836d('0x19')][_0x836d('0x1c')]?_[_0x836d('0x1d')](_0x5a4af3['options'][_0x836d('0x1c')],function(_0x57b7dc){return{'model':db[_0x57b7dc['model']],'as':_0x57b7dc['as'],'attributes':_0x57b7dc[_0x836d('0x1e')],'include':_0x57b7dc[_0x836d('0x1c')]?_['map'](_0x57b7dc['include'],function(_0x4879f1){return{'model':db[_0x4879f1[_0x836d('0x1f')]],'as':_0x4879f1['as'],'attributes':_0x4879f1[_0x836d('0x1e')],'include':_0x4879f1[_0x836d('0x1c')]?_[_0x836d('0x1d')](_0x4879f1[_0x836d('0x1c')],function(_0x5211fb){return{'model':db[_0x5211fb[_0x836d('0x1f')]],'as':_0x5211fb['as'],'attributes':_0x5211fb[_0x836d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x836d('0x20')](function(_0x17d3a8){logger[_0x836d('0x21')](_0x836d('0x16'),_0x5a4af3);logger['debug'](_0x836d('0x16'),_0x5a4af3,JSON[_0x836d('0x10')](_0x17d3a8));_0x48f9d3(_0x17d3a8);})['catch'](function(_0x3b64f6){logger[_0x836d('0x11')](_0x836d('0x16'),_0x3b64f6['message'],_0x5a4af3);_0x7d934(_0x379d89['error'](0x1f4,_0x3b64f6[_0x836d('0x13')]));});});};exports[_0x836d('0x22')]=function(_0x12f230){var _0x24e542=this;return new Promise(function(_0x27257e,_0x1550bf){return db['MailAccount'][_0x836d('0x23')]({'raw':_0x12f230[_0x836d('0x19')]?_0x12f230[_0x836d('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x12f230[_0x836d('0x19')]?_0x12f230[_0x836d('0x19')][_0x836d('0x1b')]||null:null,'attributes':_0x12f230['options']?_0x12f230[_0x836d('0x19')][_0x836d('0x1e')]||null:null,'include':_0x12f230['options']?_0x12f230['options'][_0x836d('0x1c')]?_[_0x836d('0x1d')](_0x12f230[_0x836d('0x19')][_0x836d('0x1c')],function(_0x5238e6){return{'model':db[_0x5238e6[_0x836d('0x1f')]],'as':_0x5238e6['as'],'attributes':_0x5238e6[_0x836d('0x1e')],'include':_0x5238e6[_0x836d('0x1c')]?_['map'](_0x5238e6[_0x836d('0x1c')],function(_0x4b1870){return{'model':db[_0x4b1870[_0x836d('0x1f')]],'as':_0x4b1870['as'],'attributes':_0x4b1870[_0x836d('0x1e')],'include':_0x4b1870[_0x836d('0x1c')]?_[_0x836d('0x1d')](_0x4b1870[_0x836d('0x1c')],function(_0x946397){return{'model':db[_0x946397['model']],'as':_0x946397['as'],'attributes':_0x946397['attributes']};}):[]};}):[]};}):[]:[]})[_0x836d('0x20')](function(_0xa63708){logger['info']('ShowMailAccount',_0x12f230);logger[_0x836d('0xd')](_0x836d('0x22'),_0x12f230,JSON['stringify'](_0xa63708));_0x27257e(_0xa63708);})[_0x836d('0x15')](function(_0x3ca77c){logger[_0x836d('0x11')](_0x836d('0x22'),_0x3ca77c[_0x836d('0x13')],_0x12f230);_0x1550bf(_0x24e542['error'](0x1f4,_0x3ca77c['message']));});});};exports['NotifyMailAccount']=function(_0x2d03bc){var _0x2f9c42=this;return new Promise(function(_0xe45fa1,_0xf17295){var _0x3f8e44={'body':_0x2d03bc[_0x836d('0x24')],'channel':_0x836d('0x25')};var _0xf7ef8a=_['difference'](_[_0x836d('0x26')](db[_0x836d('0x27')][_0x836d('0x28')]),[_0x836d('0x29'),_0x836d('0x2a'),_0x836d('0x2b'),_0x836d('0x2c')]);var _0x20b8e8=![];if(_0x2d03bc[_0x836d('0x24')]['id']){delete _0x2d03bc[_0x836d('0x24')]['id'];}if(_[_0x836d('0x2d')](_0x2d03bc[_0x836d('0x24')][_0x836d('0x2e')])){return _0xf17295(_0x2f9c42[_0x836d('0x11')](0x1f4,_0x836d('0x2f')));}if(_['isNil'](_0x2d03bc[_0x836d('0x24')][_0x836d('0x24')])||_0x2d03bc[_0x836d('0x24')][_0x836d('0x24')]===''){return _0xf17295(_0x2f9c42[_0x836d('0x11')](0x1f4,_0x836d('0x30')));}if(_['isNil'](_0x2d03bc[_0x836d('0x24')]['mapKey'])){return _0xf17295(_0x2f9c42[_0x836d('0x11')](0x1f4,_0x836d('0x31')+_0xf7ef8a));}if(!_['includes'](_0xf7ef8a,_0x2d03bc['body'][_0x836d('0x32')])){return _0xf17295(_0x2f9c42['error'](0x1f4,_0x836d('0x33')+_0xf7ef8a));}var _0x21a5bf={};_0x21a5bf[_0x2d03bc['body'][_0x836d('0x32')]]=_0x2d03bc[_0x836d('0x24')][_0x836d('0x2e')];return db[_0x836d('0x17')]['find']({'where':{'id':_0x2d03bc[_0x836d('0x34')]['id']},'include':[{'model':db[_0x836d('0x35')],'as':'List','include':[{'model':db[_0x836d('0x27')],'as':_0x836d('0x36'),'where':_0x21a5bf,'limit':0x1,'order':[[_0x836d('0x2a'),_0x836d('0x37')]]}]},{'model':db[_0x836d('0x38')],'as':_0x836d('0x39')},{'model':db[_0x836d('0x3a')],'as':_0x836d('0x3b')}]})[_0x836d('0x20')](function(_0x43a6a2){if(_0x43a6a2&&_0x43a6a2['List']){var _0x12cbe9=_0x43a6a2[_0x836d('0x3c')]({'plain':!![]});_0x3f8e44[_0x836d('0x34')]=_[_0x836d('0x3d')](_0x12cbe9,[_0x836d('0x39'),'List']);_0x3f8e44[_0x836d('0x3e')]=_0x12cbe9[_0x836d('0x39')];_0x3f8e44[_0x836d('0x3f')]=_0x12cbe9[_0x836d('0x40')];_0x3f8e44[_0x836d('0x3e')]=_[_0x836d('0x41')](_0x3f8e44[_0x836d('0x3e')],['priority'],[_0x836d('0x42')]);if(_0x3f8e44[_0x836d('0x34')]&&_0x3f8e44[_0x836d('0x34')][_0x836d('0x43')]){_0x3f8e44[_0x836d('0x3e')]['push']({'id':0x0,'priority':_0x3f8e44[_0x836d('0x3e')]['length']+0x1,'app':'close','appdata':_0x836d('0x43'),'interval':_0x836d('0x44')});}if(_0x3f8e44[_0x836d('0x34')][_0x836d('0x39')]){delete _0x3f8e44[_0x836d('0x34')]['Applications'];}if(_0x3f8e44[_0x836d('0x34')][_0x836d('0x40')]){delete _0x3f8e44[_0x836d('0x34')][_0x836d('0x40')];}if(_0x12cbe9['List'][_0x836d('0x36')][_0x836d('0x45')]){return _0x12cbe9[_0x836d('0x40')][_0x836d('0x36')][0x0];}var _0x3716c7=_[_0x836d('0x9')](_0x2d03bc[_0x836d('0x24')],{'firstName':_0x2d03bc[_0x836d('0x24')][_0x836d('0x2e')],'ListId':_0x12cbe9[_0x836d('0x2c')]});_0x3716c7[_0x2d03bc[_0x836d('0x24')]['mapKey']]=_0x2d03bc[_0x836d('0x24')][_0x836d('0x2e')];return db['CmContact'][_0x836d('0x46')](_0x3716c7);}else{throw new Error(_0x836d('0x47'));}})[_0x836d('0x20')](function(_0x2e83e5){_0x3f8e44[_0x836d('0x48')]=_0x2e83e5;if(_0x2e83e5){if(!_0x2d03bc[_0x836d('0x24')][_0x836d('0x13')][_0x836d('0x49')]){_0x2d03bc['body'][_0x836d('0x13')]['messageId']=rs[_0x836d('0x4a')]()+'\x20'+_0x2d03bc[_0x836d('0x24')][_0x836d('0x13')]['from'];}var _0x59a899={'ContactId':_0x2e83e5['id'],'MailAccountId':_0x2d03bc[_0x836d('0x34')]['id'],'inReplyTo':_0x2d03bc['body'][_0x836d('0x13')]['messageId'],'to':_0x2d03bc[_0x836d('0x24')]['message'][_0x836d('0x2e')],'cc':_0x2d03bc[_0x836d('0x24')][_0x836d('0x13')]['cc'],'subject':_0x2d03bc[_0x836d('0x24')]['message'][_0x836d('0x4b')],'attach':_0x2d03bc[_0x836d('0x24')]['message'][_0x836d('0x4c')],'lastMsgAt':moment()[_0x836d('0x4d')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x836d('0x4e')][_0x836d('0x23')]({'where':{'closed':![],'MailAccountId':_0x2d03bc[_0x836d('0x34')]['id']},'include':[{'model':db[_0x836d('0x4f')],'as':'Messages','attributes':[_0x836d('0x49')],'where':{'messageId':_0x2d03bc[_0x836d('0x24')][_0x836d('0x13')][_0x836d('0x50')]}}]})[_0x836d('0x20')](function(_0x186e38){if(_0x186e38){return[_0x186e38,![]];}return db['MailInteraction'][_0x836d('0x46')](_0x59a899)[_0x836d('0x20')](function(_0x17dc1b){return[_0x17dc1b,!![]];});});}else{throw new Error(_0x836d('0x51'));}})[_0x836d('0x52')](function(_0x27342e,_0x23872e){if(_0x27342e){_0x20b8e8=_0x23872e;if(!_0x23872e){return _0x27342e[_0x836d('0x53')]({'inReplyTo':_0x2d03bc[_0x836d('0x24')][_0x836d('0x13')][_0x836d('0x49')],'to':_0x2d03bc[_0x836d('0x24')][_0x836d('0x13')][_0x836d('0x2e')],'cc':_0x2d03bc[_0x836d('0x24')][_0x836d('0x13')]['cc'],'subject':_0x2d03bc['body'][_0x836d('0x13')]['subject'],'attach':_0x27342e[_0x836d('0x4c')]?_0x27342e['attach']:_0x2d03bc[_0x836d('0x24')][_0x836d('0x13')]['attach'],'substatus':null,'substatusAt':moment()[_0x836d('0x4d')](_0x836d('0x54')),'lastMsgAt':moment()[_0x836d('0x4d')](_0x836d('0x54')),'lastMsgDirection':'in'});}else{return _0x27342e;}}})['then'](function(_0xa20527){_0x3f8e44[_0x836d('0x55')]=_0xa20527[_0x836d('0x3c')]({'plain':!![]});_0x3f8e44['interaction'][_0x836d('0x56')]=_0x20b8e8;return db[_0x836d('0x4f')][_0x836d('0x46')]({'body':_0x2d03bc[_0x836d('0x24')][_0x836d('0x24')],'MailAccountId':_0x2d03bc[_0x836d('0x34')]['id'],'MailInteractionId':_0xa20527['id'],'direction':'in','ContactId':_0x3f8e44[_0x836d('0x48')]['id'],'messageId':_0x2d03bc[_0x836d('0x24')][_0x836d('0x13')][_0x836d('0x49')],'from':_0x2d03bc[_0x836d('0x24')]['message'][_0x836d('0x2e')],'to':_0x2d03bc[_0x836d('0x24')]['message']['to'],'cc':_0x2d03bc[_0x836d('0x24')][_0x836d('0x13')]['cc'],'subject':_0x2d03bc[_0x836d('0x24')]['message']['subject'],'attach':_0x2d03bc['body'][_0x836d('0x13')][_0x836d('0x4c')],'Attachments':_0x2d03bc[_0x836d('0x24')][_0x836d('0x13')][_0x836d('0x57')],'originTo':_0x2d03bc[_0x836d('0x24')]['message'][_0x836d('0x58')],'originCc':_0x2d03bc[_0x836d('0x24')]['message'][_0x836d('0x59')],'bcc':_0x2d03bc[_0x836d('0x24')][_0x836d('0x13')][_0x836d('0x5a')],'ChatWebsiteId':_0x2d03bc[_0x836d('0x24')][_0x836d('0x13')][_0x836d('0x5b')]||null,'originChannel':_0x2d03bc['body'][_0x836d('0x13')][_0x836d('0x5c')]||_0x836d('0x5d'),'ChatOfflineMessageId':_0x2d03bc[_0x836d('0x24')][_0x836d('0x13')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x836d('0x5e')],'as':_0x836d('0x5f')}]});})[_0x836d('0x20')](function(_0x11e219){_0x3f8e44[_0x836d('0x13')]=_0x11e219;if(_0x3f8e44[_0x836d('0x55')][_0x836d('0x60')]){return db[_0x836d('0x61')][_0x836d('0x23')]({'attributes':['id',_0x836d('0x62')],'where':{'id':_0x3f8e44[_0x836d('0x55')][_0x836d('0x60')]}})[_0x836d('0x20')](function(_0x55884e){if(_0x55884e){_0x3f8e44[_0x836d('0x3e')][_0x836d('0x63')]({'id':0x0,'priority':0x0,'app':_0x836d('0x64'),'appdata':_0x55884e[_0x836d('0x62')]+','+(_0x3f8e44[_0x836d('0x34')][_0x836d('0x65')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x3f8e44);});}return respondWithRpcPromise(_0x836d('0x66'),_0x836d('0x67'),_0x3f8e44);})['then'](function(_0x21a027){_0xe45fa1(_0x21a027);})['catch'](function(_0x18668a){_0xf17295(_0x2f9c42[_0x836d('0x11')](0x1f4,_0x18668a[_0x836d('0x13')]));});});}; \ No newline at end of file +var _0x0efb=['body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','MailApplication','MailServerOut','Smtp','get','omit','Applications','applications','list','asc','autoclose','push','length','close','*,*,*,*','create','List\x20not\x20found','contact','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','inReplyTo','Contact\x20not\x20found','spread','format','interaction','MailMessage','attachments','originCc','ChatWebsiteId','originChannel','ChatOfflineMessageId','Attachments','UserId','User','name','agent','waitForTheAssignedAgent','Start','startRouting','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','http','defaults','redis','localhost','socket.io-emitter','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetMailAccount','MailAccount','raw','options','where','attributes','map','include','model','ShowMailAccount','find','stringify','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0efb,0x99));var _0xb0ef=function(_0x5ec453,_0x30b0ba){_0x5ec453=_0x5ec453-0x0;var _0x25548f=_0x0efb[_0x5ec453];return _0x25548f;};'use strict';var _=require('lodash');var util=require(_0xb0ef('0x0'));var moment=require(_0xb0ef('0x1'));var BPromise=require(_0xb0ef('0x2'));var rs=require(_0xb0ef('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb0ef('0x4'));var logger=require(_0xb0ef('0x5'))(_0xb0ef('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xb0ef('0x7')]({'port':0x232c});config['redis']=_[_0xb0ef('0x8')](config[_0xb0ef('0x9')],{'host':_0xb0ef('0xa'),'port':0x18eb});var socket=require(_0xb0ef('0xb'))(new Redis(config[_0xb0ef('0x9')]));require('./mailAccount.socket')['register'](socket);function respondWithRpcPromise(_0x1101d9,_0x44fac0,_0x78d350){return new BPromise(function(_0x2450a0,_0x17c7f4){return client['request'](_0x1101d9,_0x78d350)[_0xb0ef('0xc')](function(_0x3d7ede){logger[_0xb0ef('0xd')](_0xb0ef('0xe'),_0x44fac0,'request\x20sent');logger[_0xb0ef('0xf')](_0xb0ef('0x10'),_0x44fac0,_0xb0ef('0x11'),JSON['stringify'](_0x3d7ede));if(_0x3d7ede['error']){if(_0x3d7ede[_0xb0ef('0x12')][_0xb0ef('0x13')]===0x1f4){logger[_0xb0ef('0x12')]('MailAccount,\x20%s,\x20%s',_0x44fac0,_0x3d7ede[_0xb0ef('0x12')][_0xb0ef('0x14')]);return _0x17c7f4(_0x3d7ede[_0xb0ef('0x12')][_0xb0ef('0x14')]);}logger[_0xb0ef('0x12')]('MailAccount,\x20%s,\x20%s',_0x44fac0,_0x3d7ede[_0xb0ef('0x12')]['message']);return _0x2450a0(_0x3d7ede[_0xb0ef('0x12')][_0xb0ef('0x14')]);}else{logger[_0xb0ef('0xd')](_0xb0ef('0xe'),_0x44fac0,'request\x20sent');_0x2450a0(_0x3d7ede[_0xb0ef('0x15')][_0xb0ef('0x14')]);}})[_0xb0ef('0x16')](function(_0x47784b){logger[_0xb0ef('0x12')](_0xb0ef('0xe'),_0x44fac0,_0x47784b);_0x17c7f4(_0x47784b);});});}exports[_0xb0ef('0x17')]=function(_0x397fa8){var _0x7fea9f=this;return new Promise(function(_0x1973e7,_0x35644f){return db[_0xb0ef('0x18')]['findAll']({'raw':_0x397fa8['options']?_0x397fa8['options'][_0xb0ef('0x19')]===undefined?!![]:![]:!![],'where':_0x397fa8[_0xb0ef('0x1a')]?_0x397fa8[_0xb0ef('0x1a')][_0xb0ef('0x1b')]||null:null,'attributes':_0x397fa8['options']?_0x397fa8['options'][_0xb0ef('0x1c')]||null:null,'limit':_0x397fa8['options']?_0x397fa8[_0xb0ef('0x1a')]['limit']||null:null,'include':_0x397fa8['options']?_0x397fa8[_0xb0ef('0x1a')]['include']?_[_0xb0ef('0x1d')](_0x397fa8[_0xb0ef('0x1a')][_0xb0ef('0x1e')],function(_0x24637c){return{'model':db[_0x24637c['model']],'as':_0x24637c['as'],'attributes':_0x24637c[_0xb0ef('0x1c')],'include':_0x24637c['include']?_[_0xb0ef('0x1d')](_0x24637c['include'],function(_0xc7c694){return{'model':db[_0xc7c694[_0xb0ef('0x1f')]],'as':_0xc7c694['as'],'attributes':_0xc7c694[_0xb0ef('0x1c')],'include':_0xc7c694['include']?_[_0xb0ef('0x1d')](_0xc7c694[_0xb0ef('0x1e')],function(_0x4dbd8b){return{'model':db[_0x4dbd8b['model']],'as':_0x4dbd8b['as'],'attributes':_0x4dbd8b[_0xb0ef('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb0ef('0xc')](function(_0x36d2bd){logger[_0xb0ef('0xd')](_0xb0ef('0x17'),_0x397fa8);logger[_0xb0ef('0xf')](_0xb0ef('0x17'),_0x397fa8,JSON['stringify'](_0x36d2bd));_0x1973e7(_0x36d2bd);})[_0xb0ef('0x16')](function(_0x145a25){logger[_0xb0ef('0x12')](_0xb0ef('0x17'),_0x145a25[_0xb0ef('0x14')],_0x397fa8);_0x35644f(_0x7fea9f[_0xb0ef('0x12')](0x1f4,_0x145a25[_0xb0ef('0x14')]));});});};exports[_0xb0ef('0x20')]=function(_0x5d7b5b){var _0x3661bd=this;return new Promise(function(_0xaf2f05,_0x36968a){return db[_0xb0ef('0x18')][_0xb0ef('0x21')]({'raw':_0x5d7b5b[_0xb0ef('0x1a')]?_0x5d7b5b[_0xb0ef('0x1a')][_0xb0ef('0x19')]===undefined?!![]:![]:!![],'where':_0x5d7b5b['options']?_0x5d7b5b[_0xb0ef('0x1a')][_0xb0ef('0x1b')]||null:null,'attributes':_0x5d7b5b[_0xb0ef('0x1a')]?_0x5d7b5b['options'][_0xb0ef('0x1c')]||null:null,'include':_0x5d7b5b['options']?_0x5d7b5b[_0xb0ef('0x1a')]['include']?_[_0xb0ef('0x1d')](_0x5d7b5b[_0xb0ef('0x1a')][_0xb0ef('0x1e')],function(_0x2cd191){return{'model':db[_0x2cd191[_0xb0ef('0x1f')]],'as':_0x2cd191['as'],'attributes':_0x2cd191[_0xb0ef('0x1c')],'include':_0x2cd191[_0xb0ef('0x1e')]?_[_0xb0ef('0x1d')](_0x2cd191['include'],function(_0x5e5064){return{'model':db[_0x5e5064['model']],'as':_0x5e5064['as'],'attributes':_0x5e5064[_0xb0ef('0x1c')],'include':_0x5e5064[_0xb0ef('0x1e')]?_[_0xb0ef('0x1d')](_0x5e5064[_0xb0ef('0x1e')],function(_0xda864a){return{'model':db[_0xda864a[_0xb0ef('0x1f')]],'as':_0xda864a['as'],'attributes':_0xda864a[_0xb0ef('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb0ef('0xc')](function(_0x1659a0){logger['info'](_0xb0ef('0x20'),_0x5d7b5b);logger[_0xb0ef('0xf')](_0xb0ef('0x20'),_0x5d7b5b,JSON[_0xb0ef('0x22')](_0x1659a0));_0xaf2f05(_0x1659a0);})[_0xb0ef('0x16')](function(_0x33b825){logger[_0xb0ef('0x12')](_0xb0ef('0x20'),_0x33b825[_0xb0ef('0x14')],_0x5d7b5b);_0x36968a(_0x3661bd[_0xb0ef('0x12')](0x1f4,_0x33b825[_0xb0ef('0x14')]));});});};exports[_0xb0ef('0x23')]=function(_0x50c7db){var _0x1e9dca=this;return new Promise(function(_0x3e6031,_0xeef54e){var _0x159cf0={'body':_0x50c7db[_0xb0ef('0x24')],'channel':_0xb0ef('0x25')};var _0x4713b9=_[_0xb0ef('0x26')](_[_0xb0ef('0x27')](db[_0xb0ef('0x28')][_0xb0ef('0x29')]),[_0xb0ef('0x2a'),_0xb0ef('0x2b'),_0xb0ef('0x2c'),_0xb0ef('0x2d')]);var _0x3a1ffe=![];if(_0x50c7db[_0xb0ef('0x24')]['id']){delete _0x50c7db[_0xb0ef('0x24')]['id'];}if(_[_0xb0ef('0x2e')](_0x50c7db['body'][_0xb0ef('0x2f')])){return _0xeef54e(_0x1e9dca[_0xb0ef('0x12')](0x1f4,_0xb0ef('0x30')));}if(_['isNil'](_0x50c7db[_0xb0ef('0x24')][_0xb0ef('0x24')])||_0x50c7db[_0xb0ef('0x24')][_0xb0ef('0x24')]===''){return _0xeef54e(_0x1e9dca[_0xb0ef('0x12')](0x1f4,_0xb0ef('0x31')));}if(_[_0xb0ef('0x2e')](_0x50c7db[_0xb0ef('0x24')][_0xb0ef('0x32')])){return _0xeef54e(_0x1e9dca[_0xb0ef('0x12')](0x1f4,_0xb0ef('0x33')+_0x4713b9));}if(!_['includes'](_0x4713b9,_0x50c7db['body'][_0xb0ef('0x32')])){return _0xeef54e(_0x1e9dca[_0xb0ef('0x12')](0x1f4,_0xb0ef('0x34')+_0x4713b9));}var _0x31a00c={};_0x31a00c[_0x50c7db[_0xb0ef('0x24')][_0xb0ef('0x32')]]=_0x50c7db[_0xb0ef('0x24')][_0xb0ef('0x2f')];return db[_0xb0ef('0x18')][_0xb0ef('0x21')]({'where':{'id':_0x50c7db[_0xb0ef('0x35')]['id']},'include':[{'model':db[_0xb0ef('0x36')],'as':_0xb0ef('0x37'),'include':[{'model':db[_0xb0ef('0x28')],'as':_0xb0ef('0x38'),'where':_0x31a00c,'limit':0x1,'order':[[_0xb0ef('0x2b'),_0xb0ef('0x39')]]}]},{'model':db[_0xb0ef('0x3a')],'as':'Applications'},{'model':db[_0xb0ef('0x3b')],'as':_0xb0ef('0x3c')}]})[_0xb0ef('0xc')](function(_0x25d3b8){if(_0x25d3b8&&_0x25d3b8['List']){var _0x56e760=_0x25d3b8[_0xb0ef('0x3d')]({'plain':!![]});_0x159cf0[_0xb0ef('0x35')]=_[_0xb0ef('0x3e')](_0x56e760,[_0xb0ef('0x3f'),_0xb0ef('0x37')]);_0x159cf0[_0xb0ef('0x40')]=_0x56e760[_0xb0ef('0x3f')];_0x159cf0[_0xb0ef('0x41')]=_0x56e760[_0xb0ef('0x37')];_0x159cf0['applications']=_['orderBy'](_0x159cf0['applications'],['priority'],[_0xb0ef('0x42')]);if(_0x159cf0[_0xb0ef('0x35')]&&_0x159cf0[_0xb0ef('0x35')][_0xb0ef('0x43')]){_0x159cf0[_0xb0ef('0x40')][_0xb0ef('0x44')]({'id':0x0,'priority':_0x159cf0[_0xb0ef('0x40')][_0xb0ef('0x45')]+0x1,'app':_0xb0ef('0x46'),'appdata':_0xb0ef('0x43'),'interval':_0xb0ef('0x47')});}if(_0x159cf0['account'][_0xb0ef('0x3f')]){delete _0x159cf0['account']['Applications'];}if(_0x159cf0[_0xb0ef('0x35')][_0xb0ef('0x37')]){delete _0x159cf0['account']['List'];}if(_0x56e760[_0xb0ef('0x37')][_0xb0ef('0x38')]['length']){return _0x56e760[_0xb0ef('0x37')][_0xb0ef('0x38')][0x0];}var _0x46db2c=_[_0xb0ef('0x8')](_0x50c7db[_0xb0ef('0x24')],{'firstName':_0x50c7db[_0xb0ef('0x24')]['from'],'ListId':_0x56e760[_0xb0ef('0x2d')]});_0x46db2c[_0x50c7db['body']['mapKey']]=_0x50c7db[_0xb0ef('0x24')][_0xb0ef('0x2f')];return db['CmContact'][_0xb0ef('0x48')](_0x46db2c);}else{throw new Error(_0xb0ef('0x49'));}})[_0xb0ef('0xc')](function(_0x215944){_0x159cf0[_0xb0ef('0x4a')]=_0x215944;if(_0x215944){if(!_0x50c7db['body'][_0xb0ef('0x14')]['messageId']){_0x50c7db['body']['message'][_0xb0ef('0x4b')]=rs[_0xb0ef('0x4c')]()+'\x20'+_0x50c7db[_0xb0ef('0x24')][_0xb0ef('0x14')]['from'];}var _0x4b1428={'ContactId':_0x215944['id'],'MailAccountId':_0x50c7db[_0xb0ef('0x35')]['id'],'inReplyTo':_0x50c7db[_0xb0ef('0x24')][_0xb0ef('0x14')][_0xb0ef('0x4b')],'to':_0x50c7db[_0xb0ef('0x24')]['message'][_0xb0ef('0x2f')],'cc':_0x50c7db[_0xb0ef('0x24')][_0xb0ef('0x14')]['cc'],'subject':_0x50c7db[_0xb0ef('0x24')][_0xb0ef('0x14')][_0xb0ef('0x4d')],'attach':_0x50c7db[_0xb0ef('0x24')][_0xb0ef('0x14')][_0xb0ef('0x4e')],'lastMsgAt':moment()['format'](_0xb0ef('0x4f')),'lastMsgDirection':'in'};return db[_0xb0ef('0x50')]['find']({'where':{'closed':![],'MailAccountId':_0x50c7db[_0xb0ef('0x35')]['id']},'include':[{'model':db['MailMessage'],'as':_0xb0ef('0x51'),'attributes':[_0xb0ef('0x4b')],'where':{'messageId':_0x50c7db[_0xb0ef('0x24')][_0xb0ef('0x14')][_0xb0ef('0x52')]}}]})[_0xb0ef('0xc')](function(_0x5e71ac){if(_0x5e71ac){return[_0x5e71ac,![]];}return db[_0xb0ef('0x50')][_0xb0ef('0x48')](_0x4b1428)[_0xb0ef('0xc')](function(_0x3d8a5b){return[_0x3d8a5b,!![]];});});}else{throw new Error(_0xb0ef('0x53'));}})[_0xb0ef('0x54')](function(_0x260bc3,_0x3a5d07){if(_0x260bc3){_0x3a1ffe=_0x3a5d07;if(!_0x3a5d07){return _0x260bc3['update']({'inReplyTo':_0x50c7db[_0xb0ef('0x24')][_0xb0ef('0x14')][_0xb0ef('0x4b')],'to':_0x50c7db[_0xb0ef('0x24')][_0xb0ef('0x14')][_0xb0ef('0x2f')],'cc':_0x50c7db['body'][_0xb0ef('0x14')]['cc'],'subject':_0x50c7db[_0xb0ef('0x24')][_0xb0ef('0x14')][_0xb0ef('0x4d')],'attach':_0x260bc3[_0xb0ef('0x4e')]?_0x260bc3[_0xb0ef('0x4e')]:_0x50c7db['body']['message']['attach'],'substatus':null,'substatusAt':moment()[_0xb0ef('0x55')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()['format'](_0xb0ef('0x4f')),'lastMsgDirection':'in'});}else{return _0x260bc3;}}})[_0xb0ef('0xc')](function(_0x53baf9){_0x159cf0['interaction']=_0x53baf9[_0xb0ef('0x3d')]({'plain':!![]});_0x159cf0[_0xb0ef('0x56')]['created']=_0x3a1ffe;return db[_0xb0ef('0x57')][_0xb0ef('0x48')]({'body':_0x50c7db[_0xb0ef('0x24')][_0xb0ef('0x24')],'MailAccountId':_0x50c7db[_0xb0ef('0x35')]['id'],'MailInteractionId':_0x53baf9['id'],'direction':'in','ContactId':_0x159cf0[_0xb0ef('0x4a')]['id'],'messageId':_0x50c7db['body']['message'][_0xb0ef('0x4b')],'from':_0x50c7db[_0xb0ef('0x24')][_0xb0ef('0x14')][_0xb0ef('0x2f')],'to':_0x50c7db[_0xb0ef('0x24')][_0xb0ef('0x14')]['to'],'cc':_0x50c7db['body']['message']['cc'],'subject':_0x50c7db['body']['message']['subject'],'attach':_0x50c7db[_0xb0ef('0x24')][_0xb0ef('0x14')][_0xb0ef('0x4e')],'Attachments':_0x50c7db[_0xb0ef('0x24')][_0xb0ef('0x14')][_0xb0ef('0x58')],'originTo':_0x50c7db['body'][_0xb0ef('0x14')]['originTo'],'originCc':_0x50c7db[_0xb0ef('0x24')]['message'][_0xb0ef('0x59')],'bcc':_0x50c7db[_0xb0ef('0x24')][_0xb0ef('0x14')]['bcc'],'ChatWebsiteId':_0x50c7db[_0xb0ef('0x24')][_0xb0ef('0x14')][_0xb0ef('0x5a')]||null,'originChannel':_0x50c7db[_0xb0ef('0x24')][_0xb0ef('0x14')][_0xb0ef('0x5b')]||'Email','ChatOfflineMessageId':_0x50c7db[_0xb0ef('0x24')][_0xb0ef('0x14')][_0xb0ef('0x5c')]||null},{'include':[{'model':db['Attachment'],'as':_0xb0ef('0x5d')}]});})[_0xb0ef('0xc')](function(_0x13f144){_0x159cf0[_0xb0ef('0x14')]=_0x13f144;if(_0x159cf0['interaction'][_0xb0ef('0x5e')]){return db[_0xb0ef('0x5f')]['find']({'attributes':['id',_0xb0ef('0x60')],'where':{'id':_0x159cf0[_0xb0ef('0x56')]['UserId']}})[_0xb0ef('0xc')](function(_0x2703bb){if(_0x2703bb){_0x159cf0[_0xb0ef('0x40')]['unshift']({'id':0x0,'priority':0x0,'app':_0xb0ef('0x61'),'appdata':_0x2703bb['name']+','+(_0x159cf0[_0xb0ef('0x35')][_0xb0ef('0x62')]||0xa),'interval':_0xb0ef('0x47')});}return respondWithRpcPromise(_0xb0ef('0x63'),'startRouting',_0x159cf0);});}return respondWithRpcPromise(_0xb0ef('0x63'),_0xb0ef('0x64'),_0x159cf0);})['then'](function(_0x27fa27){_0x3e6031(_0x27fa27);})['catch'](function(_0x271203){_0xeef54e(_0x1e9dca[_0xb0ef('0x12')](0x1f4,_0x271203[_0xb0ef('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 928da31..62988bf 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 _0xe203=['register','mailAccount:','./mailAccount.events','save','remove','update'];(function(_0x3dd60f,_0x4566bd){var _0x2cb70e=function(_0x43112b){while(--_0x43112b){_0x3dd60f['push'](_0x3dd60f['shift']());}};_0x2cb70e(++_0x4566bd);}(_0xe203,0x1be));var _0x3e20=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe203[_0x3dd15e];return _0x231fd0;};'use strict';var MailAccountEvents=require(_0x3e20('0x0'));var events=[_0x3e20('0x1'),_0x3e20('0x2'),_0x3e20('0x3')];function createListener(_0x48c31b,_0x2c2963){return function(_0x5703c6){_0x2c2963['emit'](_0x48c31b,_0x5703c6);};}function removeListener(_0x409b11,_0x3d433b){return function(){MailAccountEvents['removeListener'](_0x409b11,_0x3d433b);};}exports[_0x3e20('0x4')]=function(_0x5c00a8){for(var _0x39e0d9=0x0,_0x57249a=events['length'];_0x39e0d9<_0x57249a;_0x39e0d9++){var _0x3e384e=events[_0x39e0d9];var _0x467332=createListener(_0x3e20('0x5')+_0x3e384e,_0x5c00a8);MailAccountEvents['on'](_0x3e384e,_0x467332);}}; \ No newline at end of file +var _0x6be9=['emit','removeListener','register','length','./mailAccount.events','save','remove','update'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x6be9,0xec));var _0x96be=function(_0x24856d,_0x211053){_0x24856d=_0x24856d-0x0;var _0x194452=_0x6be9[_0x24856d];return _0x194452;};'use strict';var MailAccountEvents=require(_0x96be('0x0'));var events=[_0x96be('0x1'),_0x96be('0x2'),_0x96be('0x3')];function createListener(_0x4e5867,_0x3c193a){return function(_0x2e6d4e){_0x3c193a[_0x96be('0x4')](_0x4e5867,_0x2e6d4e);};}function removeListener(_0x162adc,_0x301fc6){return function(){MailAccountEvents[_0x96be('0x5')](_0x162adc,_0x301fc6);};}exports[_0x96be('0x6')]=function(_0x1be12f){for(var _0x2e3645=0x0,_0x8fa50b=events[_0x96be('0x7')];_0x2e3645<_0x8fa50b;_0x2e3645++){var _0x3a3384=events[_0x2e3645];var _0x59534c=createListener('mailAccount:'+_0x3a3384,_0x1be12f);MailAccountEvents['on'](_0x3a3384,_0x59534c);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index f6e256c..c243a00 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 _0xa435=['/:id','isAuthenticated','update','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller'];(function(_0xb7fe61,_0x25b304){var _0xe78a0a=function(_0x39f57d){while(--_0x39f57d){_0xb7fe61['push'](_0xb7fe61['shift']());}};_0xe78a0a(++_0x25b304);}(_0xa435,0x75));var _0x5a43=function(_0x1abaf1,_0x27bc15){_0x1abaf1=_0x1abaf1-0x0;var _0x2b511f=_0xa435[_0x1abaf1];return _0x2b511f;};'use strict';var multer=require(_0x5a43('0x0'));var util=require('util');var path=require(_0x5a43('0x1'));var timeout=require('connect-timeout');var express=require(_0x5a43('0x2'));var router=express[_0x5a43('0x3')]();var fs_extra=require(_0x5a43('0x4'));var auth=require(_0x5a43('0x5'));var interaction=require(_0x5a43('0x6'));var config=require(_0x5a43('0x7'));var controller=require(_0x5a43('0x8'));router['get'](_0x5a43('0x9'),auth['isAuthenticated'](),controller['show']);router['put'](_0x5a43('0x9'),auth[_0x5a43('0xa')](),controller[_0x5a43('0xb')]);router[_0x5a43('0xc')](_0x5a43('0x9'),auth[_0x5a43('0xa')](),controller[_0x5a43('0xd')]);module['exports']=router; \ No newline at end of file +var _0x498f=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','put','update','delete','destroy','exports','multer','util'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x498f,0x7e));var _0xf498=function(_0x567d26,_0x33f613){_0x567d26=_0x567d26-0x0;var _0x1c4805=_0x498f[_0x567d26];return _0x1c4805;};'use strict';var multer=require(_0xf498('0x0'));var util=require(_0xf498('0x1'));var path=require(_0xf498('0x2'));var timeout=require('connect-timeout');var express=require(_0xf498('0x3'));var router=express[_0xf498('0x4')]();var fs_extra=require(_0xf498('0x5'));var auth=require(_0xf498('0x6'));var interaction=require(_0xf498('0x7'));var config=require('../../config/environment');var controller=require('./mailApplication.controller');router[_0xf498('0x8')](_0xf498('0x9'),auth[_0xf498('0xa')](),controller['show']);router[_0xf498('0xb')](_0xf498('0x9'),auth[_0xf498('0xa')](),controller[_0xf498('0xc')]);router[_0xf498('0xd')](_0xf498('0x9'),auth[_0xf498('0xa')](),controller[_0xf498('0xe')]);module[_0xf498('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index f843607..2097278 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 _0x8329=['INTEGER','STRING','noop','sequelize','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x8329,0xda));var _0x9832=function(_0x1bf480,_0x48964b){_0x1bf480=_0x1bf480-0x0;var _0x4aef81=_0x8329[_0x1bf480];return _0x4aef81;};'use strict';var Sequelize=require(_0x9832('0x0'));module[_0x9832('0x1')]={'priority':{'type':Sequelize[_0x9832('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9832('0x3')],'allowNull':![],'defaultValue':_0x9832('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x9832('0x3')]},'interval':{'type':Sequelize[_0x9832('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x5028=['STRING','*,*,*,*','sequelize','exports','INTEGER','noop'];(function(_0x30077e,_0x25bed2){var _0x4d1583=function(_0x2403eb){while(--_0x2403eb){_0x30077e['push'](_0x30077e['shift']());}};_0x4d1583(++_0x25bed2);}(_0x5028,0x10a));var _0x8502=function(_0x271362,_0x4cf2f8){_0x271362=_0x271362-0x0;var _0x33c17a=_0x5028[_0x271362];return _0x33c17a;};'use strict';var Sequelize=require(_0x8502('0x0'));module[_0x8502('0x1')]={'priority':{'type':Sequelize[_0x8502('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8502('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x8502('0x4')]},'interval':{'type':Sequelize[_0x8502('0x4')],'defaultValue':_0x8502('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index a25a982..889348e 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 _0xd8b0=['attributes','length','include','merge','find','catch','body','params','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','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','count','set','Content-Range','apply','save','update','then','destroy','error','name','show','model','MailApplication','query','keys','intersection','fields'];(function(_0xade8bc,_0x570901){var _0x8461a3=function(_0x5e7aac){while(--_0x5e7aac){_0xade8bc['push'](_0xade8bc['shift']());}};_0x8461a3(++_0x570901);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x0d8b('0x0'));var rimraf=require(_0x0d8b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d8b('0x2'));var BPromise=require(_0x0d8b('0x3'));var Mustache=require(_0x0d8b('0x4'));var util=require(_0x0d8b('0x5'));var path=require(_0x0d8b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d8b('0x7'));var fs=require('fs');var fs_extra=require(_0x0d8b('0x8'));var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0xc'));var querystring=require(_0x0d8b('0xd'));var Papa=require(_0x0d8b('0xe'));var Redis=require(_0x0d8b('0xf'));var authService=require(_0x0d8b('0x10'));var qs=require(_0x0d8b('0x11'));var as=require(_0x0d8b('0x12'));var hardwareService=require(_0x0d8b('0x13'));var logger=require('../../config/logger')(_0x0d8b('0x14'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x15'));var licenseUtil=require(_0x0d8b('0x16'));var db=require(_0x0d8b('0x17'))['db'];function respondWithStatusCode(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xcc;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0x18')](_0x35a07b);}return _0x92cdd8[_0x0d8b('0x19')](_0x35a07b)[_0x0d8b('0x1a')]();};}function respondWithResult(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0xc8;return function(_0xe65334){if(_0xe65334){return _0x2ce75e[_0x0d8b('0x19')](_0x5ad086)[_0x0d8b('0x1b')](_0xe65334);}};}function respondWithFilteredResult(_0x4f6f21,_0x23eb7b){return function(_0xa86349){if(_0xa86349){var _0x17f7df=typeof _0x23eb7b[_0x0d8b('0x1c')]===_0x0d8b('0x1d')&&typeof _0x23eb7b['limit']===_0x0d8b('0x1d');var _0x4586c2=_0xa86349[_0x0d8b('0x1e')];var _0x5fecbd=_0x17f7df?0x0:_0x23eb7b[_0x0d8b('0x1c')];var _0x18dd2d=_0x17f7df?_0xa86349[_0x0d8b('0x1e')]:_0x23eb7b[_0x0d8b('0x1c')]+_0x23eb7b['limit'];var _0x27512e;if(_0x18dd2d>=_0x4586c2){_0x18dd2d=_0x4586c2;_0x27512e=0xc8;}else{_0x27512e=0xce;}_0x4f6f21[_0x0d8b('0x19')](_0x27512e);return _0x4f6f21[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x5fecbd+'-'+_0x18dd2d+'/'+_0x4586c2)[_0x0d8b('0x1b')](_0xa86349);}return null;};}function patchUpdates(_0x5b709c){return function(_0x393beb){try{jsonpatch[_0x0d8b('0x21')](_0x393beb,_0x5b709c,!![]);}catch(_0x50ec1e){return BPromise['reject'](_0x50ec1e);}return _0x393beb[_0x0d8b('0x22')]();};}function saveUpdates(_0x54a9a7,_0x56c729){return function(_0x5527d8){if(_0x5527d8){return _0x5527d8[_0x0d8b('0x23')](_0x54a9a7)[_0x0d8b('0x24')](function(_0x214778){return _0x214778;});}return null;};}function removeEntity(_0x38efc8,_0x221071){return function(_0x2c64e2){if(_0x2c64e2){return _0x2c64e2[_0x0d8b('0x25')]()[_0x0d8b('0x24')](function(){_0x38efc8[_0x0d8b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe8bbee,_0x4463ee){return function(_0x5363e3){if(!_0x5363e3){_0xe8bbee[_0x0d8b('0x18')](0x194);}return _0x5363e3;};}function handleError(_0x4a0ae4,_0x3dd149){_0x3dd149=_0x3dd149||0x1f4;return function(_0x234bdd){logger[_0x0d8b('0x26')](_0x234bdd['stack']);if(_0x234bdd['name']){delete _0x234bdd[_0x0d8b('0x27')];}_0x4a0ae4[_0x0d8b('0x19')](_0x3dd149)['send'](_0x234bdd);};}exports[_0x0d8b('0x28')]=function(_0x59aa83,_0x1b2b59){var _0x4b59e5={'raw':!![],'where':{'id':_0x59aa83['params']['id']}},_0x97050a={};_0x97050a[_0x0d8b('0x29')]=_['keys'](db[_0x0d8b('0x2a')]['rawAttributes']);_0x97050a[_0x0d8b('0x2b')]=_[_0x0d8b('0x2c')](_0x59aa83[_0x0d8b('0x2b')]);_0x97050a['filters']=_['intersection'](_0x97050a['model'],_0x97050a[_0x0d8b('0x2b')]);_0x4b59e5['attributes']=_[_0x0d8b('0x2d')](_0x97050a['model'],qs['fields'](_0x59aa83[_0x0d8b('0x2b')][_0x0d8b('0x2e')]));_0x4b59e5[_0x0d8b('0x2f')]=_0x4b59e5[_0x0d8b('0x2f')][_0x0d8b('0x30')]?_0x4b59e5[_0x0d8b('0x2f')]:_0x97050a[_0x0d8b('0x29')];if(_0x59aa83[_0x0d8b('0x2b')]['includeAll']){_0x4b59e5[_0x0d8b('0x31')]=[{'all':!![]}];}_0x4b59e5=_[_0x0d8b('0x32')]({},_0x4b59e5,_0x59aa83['options']);return db[_0x0d8b('0x2a')][_0x0d8b('0x33')](_0x4b59e5)[_0x0d8b('0x24')](handleEntityNotFound(_0x1b2b59,null))['then'](respondWithResult(_0x1b2b59,null))[_0x0d8b('0x34')](handleError(_0x1b2b59,null));};exports[_0x0d8b('0x23')]=function(_0x206157,_0x31ceba){if(_0x206157[_0x0d8b('0x35')]['id']){delete _0x206157['body']['id'];}return db[_0x0d8b('0x2a')][_0x0d8b('0x33')]({'where':{'id':_0x206157['params']['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x31ceba,null))[_0x0d8b('0x24')](saveUpdates(_0x206157[_0x0d8b('0x35')],null))[_0x0d8b('0x24')](respondWithResult(_0x31ceba,null))[_0x0d8b('0x34')](handleError(_0x31ceba,null));};exports['destroy']=function(_0x497a71,_0x41b4f9){return db['MailApplication']['find']({'where':{'id':_0x497a71[_0x0d8b('0x36')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x41b4f9,null))[_0x0d8b('0x24')](removeEntity(_0x41b4f9,null))[_0x0d8b('0x34')](handleError(_0x41b4f9,null));}; \ No newline at end of file +var _0xf4eb=['limit','count','Content-Range','json','apply','reject','save','then','destroy','error','name','send','params','keys','MailApplication','rawAttributes','query','filters','intersection','model','fields','attributes','includeAll','include','options','find','catch','body','eml-format','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined'];(function(_0x6813e1,_0x24f31c){var _0x389620=function(_0x33f553){while(--_0x33f553){_0x6813e1['push'](_0x6813e1['shift']());}};_0x389620(++_0x24f31c);}(_0xf4eb,0xec));var _0xbf4e=function(_0x5989fb,_0x5d3ce1){_0x5989fb=_0x5989fb-0x0;var _0x25a33f=_0xf4eb[_0x5989fb];return _0x25a33f;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fd01,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x56d185){if(_0x56d185){return _0x17fd01[_0xbf4e('0x13')](_0x5a3035);}return _0x17fd01[_0xbf4e('0x14')](_0x5a3035)[_0xbf4e('0x15')]();};}function respondWithResult(_0x302841,_0x3b74bd){_0x3b74bd=_0x3b74bd||0xc8;return function(_0x61bd54){if(_0x61bd54){return _0x302841['status'](_0x3b74bd)['json'](_0x61bd54);}};}function respondWithFilteredResult(_0x180432,_0x1735ae){return function(_0x28fc6b){if(_0x28fc6b){var _0x542909=typeof _0x1735ae[_0xbf4e('0x16')]===_0xbf4e('0x17')&&typeof _0x1735ae[_0xbf4e('0x18')]===_0xbf4e('0x17');var _0x5a631e=_0x28fc6b[_0xbf4e('0x19')];var _0x577c27=_0x542909?0x0:_0x1735ae['offset'];var _0x566ec3=_0x542909?_0x28fc6b['count']:_0x1735ae[_0xbf4e('0x16')]+_0x1735ae[_0xbf4e('0x18')];var _0x1fc800;if(_0x566ec3>=_0x5a631e){_0x566ec3=_0x5a631e;_0x1fc800=0xc8;}else{_0x1fc800=0xce;}_0x180432['status'](_0x1fc800);return _0x180432['set'](_0xbf4e('0x1a'),_0x577c27+'-'+_0x566ec3+'/'+_0x5a631e)[_0xbf4e('0x1b')](_0x28fc6b);}return null;};}function patchUpdates(_0x3be138){return function(_0x3a875b){try{jsonpatch[_0xbf4e('0x1c')](_0x3a875b,_0x3be138,!![]);}catch(_0x1e2a68){return BPromise[_0xbf4e('0x1d')](_0x1e2a68);}return _0x3a875b[_0xbf4e('0x1e')]();};}function saveUpdates(_0xd09e12,_0x376832){return function(_0x30539b){if(_0x30539b){return _0x30539b['update'](_0xd09e12)[_0xbf4e('0x1f')](function(_0x2e7673){return _0x2e7673;});}return null;};}function removeEntity(_0x51648c,_0x31e3f5){return function(_0x30994d){if(_0x30994d){return _0x30994d[_0xbf4e('0x20')]()[_0xbf4e('0x1f')](function(){_0x51648c[_0xbf4e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x90635e,_0x36688a){return function(_0x3d6863){if(!_0x3d6863){_0x90635e['sendStatus'](0x194);}return _0x3d6863;};}function handleError(_0x2fb490,_0x5e08b1){_0x5e08b1=_0x5e08b1||0x1f4;return function(_0x5bcf71){logger[_0xbf4e('0x21')](_0x5bcf71['stack']);if(_0x5bcf71[_0xbf4e('0x22')]){delete _0x5bcf71[_0xbf4e('0x22')];}_0x2fb490[_0xbf4e('0x14')](_0x5e08b1)[_0xbf4e('0x23')](_0x5bcf71);};}exports['show']=function(_0x2d4686,_0x8e0ab5){var _0x43879d={'raw':!![],'where':{'id':_0x2d4686[_0xbf4e('0x24')]['id']}},_0x4cd4a1={};_0x4cd4a1['model']=_[_0xbf4e('0x25')](db[_0xbf4e('0x26')][_0xbf4e('0x27')]);_0x4cd4a1['query']=_[_0xbf4e('0x25')](_0x2d4686[_0xbf4e('0x28')]);_0x4cd4a1[_0xbf4e('0x29')]=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],_0x4cd4a1[_0xbf4e('0x28')]);_0x43879d['attributes']=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],qs['fields'](_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2c')]));_0x43879d['attributes']=_0x43879d[_0xbf4e('0x2d')]['length']?_0x43879d[_0xbf4e('0x2d')]:_0x4cd4a1['model'];if(_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2e')]){_0x43879d[_0xbf4e('0x2f')]=[{'all':!![]}];}_0x43879d=_['merge']({},_0x43879d,_0x2d4686[_0xbf4e('0x30')]);return db[_0xbf4e('0x26')][_0xbf4e('0x31')](_0x43879d)[_0xbf4e('0x1f')](handleEntityNotFound(_0x8e0ab5,null))[_0xbf4e('0x1f')](respondWithResult(_0x8e0ab5,null))[_0xbf4e('0x32')](handleError(_0x8e0ab5,null));};exports['update']=function(_0x99b320,_0x3dbb2b){if(_0x99b320[_0xbf4e('0x33')]['id']){delete _0x99b320[_0xbf4e('0x33')]['id'];}return db[_0xbf4e('0x26')]['find']({'where':{'id':_0x99b320['params']['id']}})['then'](handleEntityNotFound(_0x3dbb2b,null))['then'](saveUpdates(_0x99b320[_0xbf4e('0x33')],null))[_0xbf4e('0x1f')](respondWithResult(_0x3dbb2b,null))[_0xbf4e('0x32')](handleError(_0x3dbb2b,null));};exports[_0xbf4e('0x20')]=function(_0x22ddde,_0x257b74){return db[_0xbf4e('0x26')][_0xbf4e('0x31')]({'where':{'id':_0x22ddde[_0xbf4e('0x24')]['id']}})['then'](handleEntityNotFound(_0x257b74,null))['then'](removeEntity(_0x257b74,null))[_0xbf4e('0x32')](handleError(_0x257b74,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 7eb3a0d..4ed5002 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 _0x418e=['request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','define','MailApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird'];(function(_0x3ebff4,_0x5efe9a){var _0x6331b7=function(_0x4860d6){while(--_0x4860d6){_0x3ebff4['push'](_0x3ebff4['shift']());}};_0x6331b7(++_0x5efe9a);}(_0x418e,0xbf));var _0xe418=function(_0x17dad4,_0x50b0b3){_0x17dad4=_0x17dad4-0x0;var _0x14374e=_0x418e[_0x17dad4];return _0x14374e;};'use strict';var _=require(_0xe418('0x0'));var util=require(_0xe418('0x1'));var logger=require(_0xe418('0x2'))(_0xe418('0x3'));var moment=require('moment');var BPromise=require(_0xe418('0x4'));var rp=require(_0xe418('0x5'));var fs=require('fs');var path=require(_0xe418('0x6'));var rimraf=require(_0xe418('0x7'));var config=require(_0xe418('0x8'));var attributes=require(_0xe418('0x9'));module['exports']=function(_0x1af16a,_0xe63dea){return _0x1af16a[_0xe418('0xa')](_0xe418('0xb'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe418('0xc'),'collate':_0xe418('0xd')});}; \ No newline at end of file +var _0xed27=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailApplication.attributes','exports','define','mail_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x4c3837,_0x2e9491){var _0x149c80=function(_0xb7594){while(--_0xb7594){_0x4c3837['push'](_0x4c3837['shift']());}};_0x149c80(++_0x2e9491);}(_0xed27,0xb4));var _0x7ed2=function(_0x5d502c,_0x5bb0f8){_0x5d502c=_0x5d502c-0x0;var _0x5038d4=_0xed27[_0x5d502c];return _0x5038d4;};'use strict';var _=require(_0x7ed2('0x0'));var util=require(_0x7ed2('0x1'));var logger=require(_0x7ed2('0x2'))(_0x7ed2('0x3'));var moment=require(_0x7ed2('0x4'));var BPromise=require(_0x7ed2('0x5'));var rp=require(_0x7ed2('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7ed2('0x7'));var config=require(_0x7ed2('0x8'));var attributes=require(_0x7ed2('0x9'));module[_0x7ed2('0xa')]=function(_0x2b00c0,_0x2f3923){return _0x2b00c0[_0x7ed2('0xb')]('MailApplication',attributes,{'tableName':_0x7ed2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7ed2('0xd'),'collate':_0x7ed2('0xe')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 698bc2a..7d767e1 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 _0xbc3c=['options','attributes','limit','stringify','moment','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','UpdateMailApplication','MailApplication','update','body'];(function(_0x1edf3f,_0x4c288b){var _0x34a0e3=function(_0x54e66b){while(--_0x54e66b){_0x1edf3f['push'](_0x1edf3f['shift']());}};_0x34a0e3(++_0x4c288b);}(_0xbc3c,0x1b4));var _0xcbc3=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xbc3c[_0xaa0309];return _0x5de7ce;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcbc3('0x0'));var BPromise=require('bluebird');var rs=require(_0xcbc3('0x1'));var fs=require('fs');var Redis=require(_0xcbc3('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcbc3('0x3'))('rpc');var config=require(_0xcbc3('0x4'));var jayson=require(_0xcbc3('0x5'));var client=jayson[_0xcbc3('0x6')][_0xcbc3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1116fd,_0x5a1e6d,_0x288d52){return new BPromise(function(_0x4ee101,_0x5247d1){return client[_0xcbc3('0x8')](_0x1116fd,_0x288d52)[_0xcbc3('0x9')](function(_0x21d1d0){logger['info'](_0xcbc3('0xa'),_0x5a1e6d,_0xcbc3('0xb'));logger[_0xcbc3('0xc')](_0xcbc3('0xd'),_0x5a1e6d,'request\x20sent',JSON['stringify'](_0x21d1d0));if(_0x21d1d0['error']){if(_0x21d1d0[_0xcbc3('0xe')][_0xcbc3('0xf')]===0x1f4){logger['error'](_0xcbc3('0xa'),_0x5a1e6d,_0x21d1d0['error'][_0xcbc3('0x10')]);return _0x5247d1(_0x21d1d0[_0xcbc3('0xe')][_0xcbc3('0x10')]);}logger[_0xcbc3('0xe')](_0xcbc3('0xa'),_0x5a1e6d,_0x21d1d0[_0xcbc3('0xe')][_0xcbc3('0x10')]);return _0x4ee101(_0x21d1d0[_0xcbc3('0xe')][_0xcbc3('0x10')]);}else{logger[_0xcbc3('0x11')](_0xcbc3('0xa'),_0x5a1e6d,'request\x20sent');_0x4ee101(_0x21d1d0['result'][_0xcbc3('0x10')]);}})[_0xcbc3('0x12')](function(_0x10ab6b){logger[_0xcbc3('0xe')]('MailApplication,\x20%s,\x20%s',_0x5a1e6d,_0x10ab6b);_0x5247d1(_0x10ab6b);});});}exports[_0xcbc3('0x13')]=function(_0xa5d5a9){var _0x4c984d=this;return new Promise(function(_0x42e303,_0x30b5cd){return db[_0xcbc3('0x14')][_0xcbc3('0x15')](_0xa5d5a9[_0xcbc3('0x16')],{'raw':_0xa5d5a9[_0xcbc3('0x17')]?_0xa5d5a9['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa5d5a9[_0xcbc3('0x17')]?_0xa5d5a9['options']['where']||null:null,'attributes':_0xa5d5a9[_0xcbc3('0x17')]?_0xa5d5a9[_0xcbc3('0x17')][_0xcbc3('0x18')]||null:null,'limit':_0xa5d5a9['options']?_0xa5d5a9['options'][_0xcbc3('0x19')]||null:null})[_0xcbc3('0x9')](function(_0x131d00){logger[_0xcbc3('0x11')](_0xcbc3('0x13'),_0xa5d5a9);logger[_0xcbc3('0xc')]('UpdateMailApplication',_0xa5d5a9,JSON[_0xcbc3('0x1a')](_0x131d00));_0x42e303(_0x131d00);})[_0xcbc3('0x12')](function(_0x7af15a){logger[_0xcbc3('0xe')](_0xcbc3('0x13'),_0x7af15a[_0xcbc3('0x10')],_0xa5d5a9);_0x30b5cd(_0x4c984d[_0xcbc3('0xe')](0x1f4,_0x7af15a[_0xcbc3('0x10')]));});});}; \ No newline at end of file +var _0x68a2=['request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailApplication','update','body','options','attributes','UpdateMailApplication','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x1db336,_0x28358d){var _0x365c3c=function(_0x1212e7){while(--_0x1212e7){_0x1db336['push'](_0x1db336['shift']());}};_0x365c3c(++_0x28358d);}(_0x68a2,0x1a8));var _0x268a=function(_0x1b8ccc,_0x4c99a4){_0x1b8ccc=_0x1b8ccc-0x0;var _0x493112=_0x68a2[_0x1b8ccc];return _0x493112;};'use strict';var _=require(_0x268a('0x0'));var util=require(_0x268a('0x1'));var moment=require(_0x268a('0x2'));var BPromise=require('bluebird');var rs=require(_0x268a('0x3'));var fs=require('fs');var Redis=require(_0x268a('0x4'));var db=require(_0x268a('0x5'))['db'];var utils=require(_0x268a('0x6'));var logger=require('../../config/logger')(_0x268a('0x7'));var config=require(_0x268a('0x8'));var jayson=require(_0x268a('0x9'));var client=jayson[_0x268a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x259b0b,_0x4931b5,_0x5e06f3){return new BPromise(function(_0x12ab4c,_0x27db13){return client[_0x268a('0xb')](_0x259b0b,_0x5e06f3)[_0x268a('0xc')](function(_0x24bd62){logger[_0x268a('0xd')](_0x268a('0xe'),_0x4931b5,_0x268a('0xf'));logger[_0x268a('0x10')](_0x268a('0x11'),_0x4931b5,_0x268a('0xf'),JSON[_0x268a('0x12')](_0x24bd62));if(_0x24bd62[_0x268a('0x13')]){if(_0x24bd62[_0x268a('0x13')][_0x268a('0x14')]===0x1f4){logger[_0x268a('0x13')](_0x268a('0xe'),_0x4931b5,_0x24bd62[_0x268a('0x13')][_0x268a('0x15')]);return _0x27db13(_0x24bd62[_0x268a('0x13')][_0x268a('0x15')]);}logger['error'](_0x268a('0xe'),_0x4931b5,_0x24bd62[_0x268a('0x13')][_0x268a('0x15')]);return _0x12ab4c(_0x24bd62[_0x268a('0x13')]['message']);}else{logger[_0x268a('0xd')](_0x268a('0xe'),_0x4931b5,_0x268a('0xf'));_0x12ab4c(_0x24bd62['result']['message']);}})['catch'](function(_0x2c306c){logger[_0x268a('0x13')](_0x268a('0xe'),_0x4931b5,_0x2c306c);_0x27db13(_0x2c306c);});});}exports['UpdateMailApplication']=function(_0x4bb7e5){var _0x5e0e49=this;return new Promise(function(_0x3c2833,_0x287e31){return db[_0x268a('0x16')][_0x268a('0x17')](_0x4bb7e5[_0x268a('0x18')],{'raw':_0x4bb7e5[_0x268a('0x19')]?_0x4bb7e5[_0x268a('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4bb7e5[_0x268a('0x19')]?_0x4bb7e5[_0x268a('0x19')]['where']||null:null,'attributes':_0x4bb7e5[_0x268a('0x19')]?_0x4bb7e5[_0x268a('0x19')][_0x268a('0x1a')]||null:null,'limit':_0x4bb7e5[_0x268a('0x19')]?_0x4bb7e5[_0x268a('0x19')]['limit']||null:null})[_0x268a('0xc')](function(_0x4a5821){logger['info'](_0x268a('0x1b'),_0x4bb7e5);logger['debug'](_0x268a('0x1b'),_0x4bb7e5,JSON['stringify'](_0x4a5821));_0x3c2833(_0x4a5821);})[_0x268a('0x1c')](function(_0x14557f){logger['error'](_0x268a('0x1b'),_0x14557f[_0x268a('0x15')],_0x4bb7e5);_0x287e31(_0x5e0e49[_0x268a('0x13')](0x1f4,_0x14557f[_0x268a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 8448cc0..77e4851 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 _0x5305=['mailinteraction:update','update','mailinteraction:destroy','destroy','express','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','mail','addTags','put'];(function(_0x11ec6c,_0x1a8169){var _0xb59506=function(_0x58e31d){while(--_0x58e31d){_0x11ec6c['push'](_0x11ec6c['shift']());}};_0xb59506(++_0x1a8169);}(_0x5305,0x194));var _0x5530=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5305[_0x3947c9];return _0x2e7871;};'use strict';var express=require(_0x5530('0x0'));var router=express[_0x5530('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x5530('0x2'));var controller=require('./mailInteraction.controller');router[_0x5530('0x3')]('/',auth[_0x5530('0x4')](),controller[_0x5530('0x5')]);router['get'](_0x5530('0x6'),auth[_0x5530('0x4')](),controller['describe']);router[_0x5530('0x3')](_0x5530('0x7'),auth[_0x5530('0x4')](),controller[_0x5530('0x8')]);router[_0x5530('0x3')](_0x5530('0x9'),auth[_0x5530('0x4')](),controller[_0x5530('0xa')]);router['get'](_0x5530('0xb'),auth[_0x5530('0x4')](),controller[_0x5530('0xc')]);router['post']('/',auth[_0x5530('0x4')](),controller[_0x5530('0xd')]);router[_0x5530('0xe')](_0x5530('0x9'),auth['isAuthenticated'](),controller[_0x5530('0xf')]);router[_0x5530('0xe')](_0x5530('0x10'),auth[_0x5530('0x4')](),interaction[_0x5530('0x11')](_0x5530('0x12'),'mailinteraction:addtags'),controller[_0x5530('0x13')]);router[_0x5530('0x14')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x5530('0x12'),_0x5530('0x15')),controller[_0x5530('0x16')]);router['delete']('/:id',auth[_0x5530('0x4')](),interaction[_0x5530('0x11')](_0x5530('0x12'),_0x5530('0x17')),controller[_0x5530('0x18')]);router['delete']('/:id/tags',auth[_0x5530('0x4')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xc58a=['addTags','put','tracked','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/tags','mail','mailinteraction:addtags'];(function(_0x2e6b4c,_0x33d4e2){var _0x58f8da=function(_0x2d7cc1){while(--_0x2d7cc1){_0x2e6b4c['push'](_0x2e6b4c['shift']());}};_0x58f8da(++_0x33d4e2);}(_0xc58a,0x165));var _0xac58=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0xc58a[_0x1a72f3];return _0x57ef47;};'use strict';var express=require(_0xac58('0x0'));var router=express[_0xac58('0x1')]();var auth=require(_0xac58('0x2'));var interaction=require(_0xac58('0x3'));var controller=require(_0xac58('0x4'));router[_0xac58('0x5')]('/',auth['isAuthenticated'](),controller[_0xac58('0x6')]);router['get'](_0xac58('0x7'),auth[_0xac58('0x8')](),controller[_0xac58('0x9')]);router[_0xac58('0x5')](_0xac58('0xa'),auth[_0xac58('0x8')](),controller[_0xac58('0xb')]);router['get']('/:id/messages',auth[_0xac58('0x8')](),controller[_0xac58('0xc')]);router[_0xac58('0x5')](_0xac58('0xd'),auth[_0xac58('0x8')](),controller[_0xac58('0xe')]);router[_0xac58('0xf')]('/',auth[_0xac58('0x8')](),controller[_0xac58('0x10')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0xac58('0xf')](_0xac58('0x11'),auth[_0xac58('0x8')](),interaction['tracked'](_0xac58('0x12'),_0xac58('0x13')),controller[_0xac58('0x14')]);router[_0xac58('0x15')](_0xac58('0xa'),auth['isAuthenticated'](),interaction[_0xac58('0x16')](_0xac58('0x12'),_0xac58('0x17')),controller[_0xac58('0x18')]);router[_0xac58('0x19')](_0xac58('0xa'),auth[_0xac58('0x8')](),interaction[_0xac58('0x16')](_0xac58('0x12'),_0xac58('0x1a')),controller[_0xac58('0x1b')]);router[_0xac58('0x19')](_0xac58('0x11'),auth['isAuthenticated'](),controller['removeTags']);module[_0xac58('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index ede28ec..f6400dd 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 _0xc991=['sequelize','exports','BOOLEAN','STRING','TEXT','long','DATE','ENUM','out'];(function(_0xabfec4,_0x35076e){var _0x7bafa2=function(_0x52d551){while(--_0x52d551){_0xabfec4['push'](_0xabfec4['shift']());}};_0x7bafa2(++_0x35076e);}(_0xc991,0x1d4));var _0x1c99=function(_0x5d38c8,_0x35285a){_0x5d38c8=_0x5d38c8-0x0;var _0x3800e1=_0xc991[_0x5d38c8];return _0x3800e1;};'use strict';var Sequelize=require(_0x1c99('0x0'));var iconv=require('iconv');module[_0x1c99('0x1')]={'closed':{'type':Sequelize[_0x1c99('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x1c99('0x3')]},'secondDisposition':{'type':Sequelize[_0x1c99('0x3')]},'thirdDisposition':{'type':Sequelize[_0x1c99('0x3')]},'note':{'type':Sequelize[_0x1c99('0x3')]},'inReplyTo':{'type':Sequelize[_0x1c99('0x3')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x1c99('0x4')](_0x1c99('0x5'))},'subject':{'type':Sequelize[_0x1c99('0x4')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x1c99('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x1c99('0x6')]},'firstMsgDirection':{'type':Sequelize[_0x1c99('0x7')]('in',_0x1c99('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1c99('0x6')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x1c99('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1c99('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x59a8=['STRING','long','ENUM','out','sequelize','iconv','exports','BOOLEAN','DATE'];(function(_0x501472,_0x546a69){var _0x329bec=function(_0x3c4e82){while(--_0x3c4e82){_0x501472['push'](_0x501472['shift']());}};_0x329bec(++_0x546a69);}(_0x59a8,0x100));var _0x859a=function(_0xffd525,_0x4f4f7b){_0xffd525=_0xffd525-0x0;var _0x16c9de=_0x59a8[_0xffd525];return _0x16c9de;};'use strict';var Sequelize=require(_0x859a('0x0'));var iconv=require(_0x859a('0x1'));module[_0x859a('0x2')]={'closed':{'type':Sequelize[_0x859a('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x859a('0x4')]},'disposition':{'type':Sequelize[_0x859a('0x5')]},'secondDisposition':{'type':Sequelize[_0x859a('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x859a('0x5')]},'inReplyTo':{'type':Sequelize[_0x859a('0x5')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT'](_0x859a('0x6'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x859a('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x859a('0x7')]('in',_0x859a('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x859a('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x859a('0x7')]('in',_0x859a('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x859a('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 3527a4e..746b4ae 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 _0x8b9c=['setTags','spread','Tag','emit','mailInteractionTags:save','removeTags','download','unix','join','server','tmp','root','files','attachments','transcript-%d-%s.zip','Messages','bcc','subject','get','each','decode','headers','Bcc','Attachments','basename','readFileSync','build','writeFileSync','eml-format','rimraf','zip-dir','moment','bluebird','util','squel','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','html-entities','redis','socket.io-emitter','./mailInteraction.socket','sendStatus','status','end','offset','undefined','limit','count','set','then','destroy','error','stack','send','Users','map','fullname','Tags','TagIds','split','forEach','push','MailMessage','findOne','out','plainBody','-id','lastMsgText','trimStart','catch','index','MailInteraction','rawAttributes','fieldName','type','key','model','name','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','select','field','color','from','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isEmail','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.updatedAt','i.closedAt','i.attach','i.lastMsgDirection','i.subject','i.disposition','i.substatus','i.to','i.MailAccountId','i.UserId','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','ui.MailInteractionId\x20IN\x20?','groupBy','Setting','enableEmailPreview','all','rows','show','includeAll','include','merge','options','create','update','body','params','describe','addMessage','ids','getMessages','pick','MailInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','true'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x8b9c,0x1e6));var _0xc8b9=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x8b9c[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0xc8b9('0x0'));var rimraf=require(_0xc8b9('0x1'));var zipdir=require(_0xc8b9('0x2'));var moment=require(_0xc8b9('0x3'));var BPromise=require(_0xc8b9('0x4'));var util=require(_0xc8b9('0x5'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0xc8b9('0x6'));var juice=require(_0xc8b9('0x7'));var Redis=require(_0xc8b9('0x8'));var qs=require(_0xc8b9('0x9'));var as=require(_0xc8b9('0xa'));var logger=require(_0xc8b9('0xb'))(_0xc8b9('0xc'));var config=require(_0xc8b9('0xd'));var db=require('../../mysqldb')['db'];var htmlEntities=require(_0xc8b9('0xe'));config[_0xc8b9('0xf')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc8b9('0x10'))(new Redis(config[_0xc8b9('0xf')]));require(_0xc8b9('0x11'))['register'](socket);function respondWithStatusCode(_0x3626d4,_0x42cb84){_0x42cb84=_0x42cb84||0xcc;return function(_0x2159bf){if(_0x2159bf){return _0x3626d4[_0xc8b9('0x12')](_0x42cb84);}return _0x3626d4[_0xc8b9('0x13')](_0x42cb84)[_0xc8b9('0x14')]();};}function respondWithResult(_0x43a735,_0x103cce){_0x103cce=_0x103cce||0xc8;return function(_0x5a8faa){if(_0x5a8faa){return _0x43a735[_0xc8b9('0x13')](_0x103cce)['json'](_0x5a8faa);}};}function respondWithFilteredResult(_0xf6bf65,_0x12c441){return function(_0x16185b){if(_0x16185b){var _0x4954d0=typeof _0x12c441[_0xc8b9('0x15')]===_0xc8b9('0x16')&&typeof _0x12c441[_0xc8b9('0x17')]==='undefined';var _0x5a239b=_0x16185b[_0xc8b9('0x18')];var _0xe30509=_0x4954d0?0x0:_0x12c441[_0xc8b9('0x15')];var _0x4183ba=_0x4954d0?_0x16185b['count']:_0x12c441['offset']+_0x12c441[_0xc8b9('0x17')];var _0x2151ff;if(_0x4183ba>=_0x5a239b){_0x4183ba=_0x5a239b;_0x2151ff=0xc8;}else{_0x2151ff=0xce;}_0xf6bf65['status'](_0x2151ff);return _0xf6bf65[_0xc8b9('0x19')]('Content-Range',_0xe30509+'-'+_0x4183ba+'/'+_0x5a239b)['json'](_0x16185b);}return null;};}function saveUpdates(_0x416524){return function(_0x1d63c2){if(_0x1d63c2){return _0x1d63c2['update'](_0x416524)[_0xc8b9('0x1a')](function(_0x5efca5){return _0x5efca5;});}return null;};}function removeEntity(_0x4d6932){return function(_0xb5067c){if(_0xb5067c){return _0xb5067c[_0xc8b9('0x1b')]()[_0xc8b9('0x1a')](function(){_0x4d6932[_0xc8b9('0x13')](0xcc)[_0xc8b9('0x14')]();});}};}function handleEntityNotFound(_0x2fe9e4){return function(_0x3e3cbd){if(!_0x3e3cbd){_0x2fe9e4[_0xc8b9('0x12')](0x194);}return _0x3e3cbd;};}function handleError(_0x4cf67a,_0x3c1776){_0x3c1776=_0x3c1776||0x1f4;return function(_0x12e145){logger[_0xc8b9('0x1c')](_0x12e145[_0xc8b9('0x1d')]);if(_0x12e145['name']){delete _0x12e145['name'];}_0x4cf67a['status'](_0x3c1776)[_0xc8b9('0x1e')](_0x12e145);};}function getInteractionUsers(_0x45e736,_0x7cac5f){return new BPromise(function(_0xafc777,_0x1c4cd4){try{if(_0x7cac5f[_0x45e736['id']]){_0x45e736[_0xc8b9('0x1f')]=_[_0xc8b9('0x20')](_0x7cac5f[_0x45e736['id']],function(_0x25ebca){return{'id':_0x25ebca['id'],'fullname':_0x25ebca[_0xc8b9('0x21')]};});}}catch(_0x37ed6b){_0x1c4cd4(_0x37ed6b);}_0xafc777(_0x45e736);});}function getInteractionTags(_0x21f6a2,_0x3138fc){return new BPromise(function(_0x4b3861,_0xfe4bca){try{if(_0x21f6a2['TagIds']){_0x21f6a2[_0xc8b9('0x22')]=[];_0x21f6a2[_0xc8b9('0x23')][_0xc8b9('0x24')](',')[_0xc8b9('0x25')](function(_0x1dc283){_0x21f6a2[_0xc8b9('0x22')][_0xc8b9('0x26')](_0x3138fc[_0x1dc283]);});}delete _0x21f6a2[_0xc8b9('0x23')];}catch(_0x40d74c){_0xfe4bca(_0x40d74c);}_0x4b3861(_0x21f6a2);});}function getLastMessageText(_0x5e7f9a){return new BPromise(function(_0x26b575,_0x4cb8d8){return db[_0xc8b9('0x27')][_0xc8b9('0x28')]({'where':{'$and':[{'MailInteractionId':_0x5e7f9a['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xc8b9('0x29')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xc8b9('0x2a')],'order':_0xc8b9('0x2b'),'raw':!![]})[_0xc8b9('0x1a')](function(_0xa7bc2e){if(_0xa7bc2e&&_0xa7bc2e[_0xc8b9('0x2a')]){_0x5e7f9a[_0xc8b9('0x2c')]=_[_0xc8b9('0x2d')](_0xa7bc2e[_0xc8b9('0x2a')]);}_0x26b575(_0x5e7f9a);})[_0xc8b9('0x2e')](function(_0x43fc90){_0x4cb8d8(_0x43fc90);});});}function updateMailInteraction(_0x3a07f2,_0x13f1cb,_0x4f0265,_0x35ecf2){return new BPromise(function(_0x191c7a,_0x4088d9){return getInteractionUsers(_0x3a07f2,_0x4f0265)[_0xc8b9('0x1a')](function(_0x503799){return getInteractionTags(_0x503799,_0x13f1cb);})[_0xc8b9('0x1a')](function(_0x5799e6){if(_0x35ecf2){_0x191c7a(getLastMessageText(_0x5799e6));}else{_0x191c7a(_0x5799e6);}})['catch'](function(_0xfaea62){_0x4088d9(_0xfaea62);});});}exports[_0xc8b9('0x2f')]=function(_0x5200e4,_0x1b15b4){var _0x5107e7={},_0x48a1da={},_0x2938a3={'count':0x0,'rows':[]};var _0x5e0088=_['map'](db[_0xc8b9('0x30')][_0xc8b9('0x31')],function(_0x569221){return{'name':_0x569221[_0xc8b9('0x32')],'type':_0x569221[_0xc8b9('0x33')][_0xc8b9('0x34')]};});_0x48a1da[_0xc8b9('0x35')]=_['map'](_0x5e0088,_0xc8b9('0x36'));_0x48a1da[_0xc8b9('0x37')]=_[_0xc8b9('0x38')](_0x5200e4[_0xc8b9('0x37')]);_0x48a1da['filters']=_['intersection'](_0x48a1da[_0xc8b9('0x35')],_0x48a1da[_0xc8b9('0x37')]);_0x5107e7[_0xc8b9('0x39')]=_[_0xc8b9('0x3a')](_0x48a1da[_0xc8b9('0x35')],qs[_0xc8b9('0x3b')](_0x5200e4['query']['fields']));_0x5107e7[_0xc8b9('0x39')]=_0x5107e7[_0xc8b9('0x39')][_0xc8b9('0x3c')]?_0x5107e7['attributes']:_0x48a1da[_0xc8b9('0x35')];if(!_0x5200e4[_0xc8b9('0x37')][_0xc8b9('0x3d')](_0xc8b9('0x3e'))){_0x5107e7[_0xc8b9('0x17')]=qs[_0xc8b9('0x17')](_0x5200e4[_0xc8b9('0x37')][_0xc8b9('0x17')]);_0x5107e7[_0xc8b9('0x15')]=qs[_0xc8b9('0x15')](_0x5200e4[_0xc8b9('0x37')]['offset']);}_0x5107e7[_0xc8b9('0x3f')]=qs[_0xc8b9('0x40')](_0x5200e4['query'][_0xc8b9('0x40')]);_0x5107e7[_0xc8b9('0x41')]=qs[_0xc8b9('0x42')](_['pick'](_0x5200e4[_0xc8b9('0x37')],_0x48a1da['filters']),_0x5e0088);var _0x5805e0=[];var _0x3cb68a=squel[_0xc8b9('0x43')]()[_0xc8b9('0x44')]('id')[_0xc8b9('0x44')](_0xc8b9('0x36'))[_0xc8b9('0x44')](_0xc8b9('0x45'))[_0xc8b9('0x46')]('tools_tags');var _0x2184d4=squel[_0xc8b9('0x43')]()[_0xc8b9('0x44')]('u.id')[_0xc8b9('0x44')](_0xc8b9('0x47'))['field'](_0xc8b9('0x48'))[_0xc8b9('0x46')](_0xc8b9('0x49'),'ui')[_0xc8b9('0x4a')]('users','u',_0xc8b9('0x4b'));var _0x324c74=squel[_0xc8b9('0x43')]()[_0xc8b9('0x46')](_0xc8b9('0x4c'),'i')[_0xc8b9('0x4a')](_0xc8b9('0x4d'),'c',_0xc8b9('0x4e'))[_0xc8b9('0x4a')]('users','o',_0xc8b9('0x4f'))[_0xc8b9('0x4a')](_0xc8b9('0x50'),'a',_0xc8b9('0x51'))[_0xc8b9('0x4a')](_0xc8b9('0x52'),'me','me.MailInteractionId\x20=\x20i.id')[_0xc8b9('0x4a')](_0xc8b9('0x53'),'it',_0xc8b9('0x54'))[_0xc8b9('0x4a')](_0xc8b9('0x55'),'t',_0xc8b9('0x56'));var _0x40ae3e=squel['expr']();var _0x303068=[];var _0x28f812=squel[_0xc8b9('0x57')]();var _0x34cd15;if(_0x5200e4[_0xc8b9('0x37')]['search']){_0x34cd15=as[_0xc8b9('0x58')](_0x5200e4[_0xc8b9('0x37')][_0xc8b9('0x59')]);var _0x299920=_0x34cd15[_0xc8b9('0x5a')];for(var _0x507592=0x0;_0x507592<_0x34cd15[_0xc8b9('0x5b')]['length'];_0x507592++){var _0x1ac013=_0x34cd15['conditions'][_0x507592];var _0x1d8113='i';var _0x5d46bf=_[_0xc8b9('0x5c')](_0x5e0088,[_0xc8b9('0x36'),_0x1ac013['field']]);if(!_0x5d46bf){switch(_0x1ac013[_0xc8b9('0x44')]){case _0xc8b9('0x5d'):if(_0x1ac013[_0xc8b9('0x5e')]==0x1){_0x324c74[_0xc8b9('0x5f')]('`'+_0x1ac013[_0xc8b9('0x44')]+'`\x20=\x200');}else{_0x324c74['having']('`'+_0x1ac013['field']+_0xc8b9('0x60'));}break;case _0xc8b9('0x61'):if(_0x1ac013[_0xc8b9('0x62')]===_0xc8b9('0x63')){if(_0x1ac013[_0xc8b9('0x5e')][_0xc8b9('0x24')]('\x20')[_0xc8b9('0x3c')]>0x1){_0x40ae3e[_0x299920](_0xc8b9('0x64'),qs['getFullTextValue'](_0x1ac013['value']),null);}else{var _0x2e785f='%'+_0x1ac013['value']+'%';_0x40ae3e[_0x299920](_0xc8b9('0x65'),_0x2e785f,_0x2e785f,_0x2e785f);}}else{_0x5d46bf=_[_0xc8b9('0x5c')](_0x5e0088,[_0xc8b9('0x36'),_0xc8b9('0x66')]);_0x1ac013['field']=_0xc8b9('0x66');_0x2ee46c=as[_0xc8b9('0x67')](_0x1d8113,_0x5d46bf[_0xc8b9('0x33')],_0x1ac013);_0x40ae3e[_0x299920](_0x2ee46c[_0xc8b9('0x68')],_0x2ee46c[_0xc8b9('0x5e')][_0xc8b9('0x69')],_0x2ee46c[_0xc8b9('0x5e')]['end']);}break;case'Tag':var _0x31feee=_0x1ac013[_0xc8b9('0x5e')][_0xc8b9('0x24')](',')[_0xc8b9('0x20')](function(_0x587ad6){return Number(_0x587ad6);});_0x31feee[_0xc8b9('0x25')](function(_0x4391fb){_0x28f812['or'](_0xc8b9('0x6a'),'%,'+_0x4391fb+',%');});_0x303068=_[_0xc8b9('0x6b')](_0x303068,_0x31feee);break;case _0xc8b9('0x6c'):if(_0x1ac013['operator']===_0xc8b9('0x63')){_0x40ae3e[_0x299920](_0xc8b9('0x6d'),'%'+_0x1ac013[_0xc8b9('0x5e')]+'%',null);}else{_0x5d46bf=_[_0xc8b9('0x5c')](_0x5e0088,[_0xc8b9('0x36'),_0xc8b9('0x6e')]);_0x1ac013[_0xc8b9('0x44')]=_0xc8b9('0x6e');_0x2ee46c=as[_0xc8b9('0x67')](_0x1d8113,_0x5d46bf[_0xc8b9('0x33')],_0x1ac013);_0x40ae3e[_0x299920](_0x2ee46c[_0xc8b9('0x68')],_0x2ee46c[_0xc8b9('0x5e')][_0xc8b9('0x69')],_0x2ee46c[_0xc8b9('0x5e')]['end']);}break;case _0xc8b9('0x2a'):_0x2ee46c=as['buildExpression']('me',null,_0x1ac013);_0x40ae3e[_0x299920](_0x2ee46c[_0xc8b9('0x68')],_0x2ee46c[_0xc8b9('0x5e')]['start'],_0x2ee46c[_0xc8b9('0x5e')]['end']);break;}}else{var _0x2ee46c=as[_0xc8b9('0x67')](_0x1d8113,_0x5d46bf['type'],_0x1ac013);_0x40ae3e[_0x299920](_0x2ee46c[_0xc8b9('0x68')],_0x2ee46c['value'][_0xc8b9('0x69')],_0x2ee46c[_0xc8b9('0x5e')][_0xc8b9('0x14')]);}}}else{var _0x3767aa=_(_0x5200e4[_0xc8b9('0x37')])[_0xc8b9('0x38')]()[_0xc8b9('0x20')](function(_0x3d3a45){return _[_0xc8b9('0x6f')](_0x5e0088,[_0xc8b9('0x36'),_0x3d3a45])?_0x3d3a45:undefined;})[_0xc8b9('0x70')]()[_0xc8b9('0x5e')]();if(!_[_0xc8b9('0x71')](_0x3767aa)){_0x3767aa['forEach'](function(_0x5225b6){if(_0x5225b6===_0xc8b9('0x72')){_0x324c74['where'](_0xc8b9('0x73'),[][_0xc8b9('0x74')](_0x5200e4[_0xc8b9('0x37')][_0x5225b6]));}else if(_0x5225b6===_0xc8b9('0x75')){var _0x49819b=JSON[_0xc8b9('0x76')](_0x5200e4[_0xc8b9('0x37')][_0x5225b6])[_0xc8b9('0x77')];var _0x2785da=JSON[_0xc8b9('0x76')](_0x5200e4['query'][_0x5225b6])[_0xc8b9('0x78')];_0x324c74[_0xc8b9('0x41')](_0xc8b9('0x79'),_0x49819b,_0x2785da);}else{if(_0x5200e4[_0xc8b9('0x37')][_0x5225b6]===_0xc8b9('0x7a')){_0x324c74[_0xc8b9('0x41')]('i.'+_0x5225b6+_0xc8b9('0x7b'));}else{_0x324c74[_0xc8b9('0x41')]('i.'+_0x5225b6+'\x20=\x20?',_0x5200e4[_0xc8b9('0x37')][_0x5225b6]);}}});}if(_0x5200e4['query'][_0xc8b9('0x7c')]){if(_0x5200e4[_0xc8b9('0x37')][_0xc8b9('0x7c')]==0x1){_0x324c74[_0xc8b9('0x5f')](_0xc8b9('0x7d'));}else{_0x324c74[_0xc8b9('0x5f')](_0xc8b9('0x7e'));}}if(_0x5200e4[_0xc8b9('0x37')][_0xc8b9('0x7f')]){_0x303068=_[_0xc8b9('0x80')](_0x5200e4[_0xc8b9('0x37')][_0xc8b9('0x7f')])?_0x5200e4[_0xc8b9('0x37')][_0xc8b9('0x7f')]:new Array(_0x5200e4[_0xc8b9('0x37')][_0xc8b9('0x7f')]);_0x303068['forEach'](function(_0x434537){_0x28f812['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x434537+',%');});}if(_0x5200e4[_0xc8b9('0x37')][_0xc8b9('0x81')]){var _0x29b2ee=_0x5200e4['query'][_0xc8b9('0x81')][_0xc8b9('0x82')]('\x5c','\x5c\x5c')[_0xc8b9('0x82')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x29b2ee)){_0x40ae3e['or']('i.id\x20LIKE\x20?',_0x29b2ee+'%');}else if(qs[_0xc8b9('0x83')](_0x29b2ee)){_0x40ae3e['or']('c.email\x20LIKE\x20?',_0x29b2ee+'%');}else{_0x40ae3e['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc8b9('0x84')](_0x29b2ee))['or'](_0xc8b9('0x85'),qs[_0xc8b9('0x84')](_0x29b2ee));}}}_0x324c74[_0xc8b9('0x41')](_0x40ae3e);_0x324c74[_0xc8b9('0x86')](_0xc8b9('0x87'));var _0x21367b={'type':db[_0xc8b9('0x88')][_0xc8b9('0x89')][_0xc8b9('0x8a')],'raw':!![]};var _0x2d6682=_0x324c74[_0xc8b9('0x8b')]();_0x2d6682['field']('i.id');_0x2d6682[_0xc8b9('0x44')](_0xc8b9('0x8c'),_0xc8b9('0x5d'));if(_0x5107e7['order']){_0x5107e7['order'][_0xc8b9('0x25')](function(_0x1bf59e){var _0x349ffd=_0x1bf59e[0x0]==='contactName'?_0x1bf59e[0x0]:'i.'+_0x1bf59e[0x0];_0x324c74['order'](_0x349ffd,_0x1bf59e[0x1]==='DESC'?![]:!![]);});}if(!_[_0xc8b9('0x71')](_0x303068)){_0x324c74[_0xc8b9('0x5f')](_0x28f812);_0x2d6682[_0xc8b9('0x41')](_0xc8b9('0x8d'),_0x303068);}BPromise['resolve']()[_0xc8b9('0x1a')](function(){if(!_0x34cd15){if(_0x5200e4[_0xc8b9('0x37')]['MailAccountId'])return;_0x2d6682['where'](_0xc8b9('0x8e'));_0x324c74[_0xc8b9('0x41')](_0xc8b9('0x8e'));return;}if(_0x5200e4[_0xc8b9('0x8f')][_0xc8b9('0x90')]!==_0xc8b9('0x91'))return;return _0x5200e4[_0xc8b9('0x8f')][_0xc8b9('0x92')]({'attributes':['id'],'raw':!![]})[_0xc8b9('0x1a')](function(_0x52b5d3){if(_[_0xc8b9('0x71')](_0x52b5d3)){_0x2d6682[_0xc8b9('0x41')](_0xc8b9('0x93'));_0x324c74['where'](_0xc8b9('0x93'));}else{_0x2d6682[_0xc8b9('0x41')]('i.MailAccountId\x20IN\x20?',_[_0xc8b9('0x20')](_0x52b5d3,'id'));_0x324c74[_0xc8b9('0x41')](_0xc8b9('0x73'),_[_0xc8b9('0x20')](_0x52b5d3,'id'));}});})['then'](function(){if(_0x5200e4[_0xc8b9('0x8f')][_0xc8b9('0x90')]===_0xc8b9('0x91')&&!_0x34cd15&&!_0x5200e4[_0xc8b9('0x37')][_0xc8b9('0x72')])return[];return db['sequelize']['query'](_0x2d6682['toString'](),_0x21367b);})['then'](function(_0x9c5044){_0x2938a3[_0xc8b9('0x18')]=_0x9c5044[_0xc8b9('0x3c')];if(_0x2938a3[_0xc8b9('0x18')]===0x0)return[];return db[_0xc8b9('0x94')][_0xc8b9('0x37')](_0x3cb68a[_0xc8b9('0x95')](),_0x21367b)['then'](function(_0x1b21e0){_0x5805e0=_['keyBy'](_0x1b21e0,'id');_0x21367b=_['merge'](_0x21367b,{'model':db[_0xc8b9('0x30')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5200e4[_0xc8b9('0x37')][_0xc8b9('0x3b')]){_0x5107e7[_0xc8b9('0x39')][_0xc8b9('0x25')](function(_0x486674){_0x324c74[_0xc8b9('0x44')]('i.'+_0x486674);});}else{_0x324c74[_0xc8b9('0x44')](_0xc8b9('0x8c'),_0xc8b9('0x5d'));_0x324c74[_0xc8b9('0x44')]('a.key',_0xc8b9('0x96'));_0x324c74[_0xc8b9('0x44')](_0xc8b9('0x97'),_0xc8b9('0x98'));_0x324c74[_0xc8b9('0x44')](_0xc8b9('0x99'),_0xc8b9('0x9a'));_0x324c74[_0xc8b9('0x44')](_0xc8b9('0x87'));_0x324c74[_0xc8b9('0x44')]('i.createdAt');_0x324c74[_0xc8b9('0x44')](_0xc8b9('0x9b'));_0x324c74[_0xc8b9('0x44')]('i.closed');_0x324c74[_0xc8b9('0x44')](_0xc8b9('0x9c'));_0x324c74[_0xc8b9('0x44')](_0xc8b9('0x9d'));_0x324c74['field']('i.lastMsgAt');_0x324c74[_0xc8b9('0x44')](_0xc8b9('0x9e'));_0x324c74[_0xc8b9('0x44')](_0xc8b9('0x9f'));_0x324c74[_0xc8b9('0x44')](_0xc8b9('0xa0'));_0x324c74['field']('i.secondDisposition');_0x324c74[_0xc8b9('0x44')]('i.thirdDisposition');_0x324c74[_0xc8b9('0x44')](_0xc8b9('0xa1'));_0x324c74[_0xc8b9('0x44')](_0xc8b9('0xa2'));_0x324c74[_0xc8b9('0x44')]('i.ContactId');_0x324c74[_0xc8b9('0x44')](_0xc8b9('0xa3'));_0x324c74[_0xc8b9('0x44')](_0xc8b9('0xa4'));_0x324c74[_0xc8b9('0x44')]('c.firstName',_0xc8b9('0xa5'));_0x324c74[_0xc8b9('0x44')](_0xc8b9('0xa6'),_0xc8b9('0xa7'));_0x324c74[_0xc8b9('0x44')](_0xc8b9('0xa8'),'Contact.email');_0x324c74[_0xc8b9('0x44')]('c.phone',_0xc8b9('0xa9'));_0x324c74['field']('c.mobile',_0xc8b9('0xaa'));_0x324c74[_0xc8b9('0x44')](_0xc8b9('0xab'),_0xc8b9('0xac'));_0x324c74[_0xc8b9('0x44')](_0xc8b9('0xad'),_0xc8b9('0xae'));_0x324c74[_0xc8b9('0x44')](_0xc8b9('0xaf'),'Owner.internal');_0x324c74['field']('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x5107e7['limit'])_0x324c74[_0xc8b9('0x17')](_0x5107e7['limit']);if(_0x5107e7['offset'])_0x324c74[_0xc8b9('0x15')](_0x5107e7[_0xc8b9('0x15')]);return db['sequelize'][_0xc8b9('0x37')](_0x324c74[_0xc8b9('0x95')](),_0x21367b);})[_0xc8b9('0x1a')](function(_0x10cc22){if(_0x10cc22['length']>0x0)_0x2184d4[_0xc8b9('0x41')](_0xc8b9('0xb0'),_['map'](_0x10cc22,'id'));return db['sequelize'][_0xc8b9('0x37')](_0x2184d4[_0xc8b9('0x95')](),_0x21367b)[_0xc8b9('0x1a')](function(_0x2ca982){var _0x15164e=_[_0xc8b9('0xb1')](_0x2ca982,'MailInteractionId');var _0x5576f1=[];return db[_0xc8b9('0xb2')]['findOne']({'attributes':[_0xc8b9('0xb3')],'raw':!![]})[_0xc8b9('0x1a')](function(_0x2c3400){var _0x59f9e6=_0x2c3400['enableEmailPreview'];_0x10cc22[_0xc8b9('0x25')](function(_0x7045d8){_0x5576f1[_0xc8b9('0x26')](updateMailInteraction(_0x7045d8,_0x5805e0,_0x15164e,_0x59f9e6));});return BPromise[_0xc8b9('0xb4')](_0x5576f1);});});});})[_0xc8b9('0x1a')](function(_0x78089c){_0x2938a3[_0xc8b9('0xb5')]=_0x78089c;return _0x2938a3;})[_0xc8b9('0x1a')](respondWithFilteredResult(_0x1b15b4,_0x5107e7))[_0xc8b9('0x2e')](handleError(_0x1b15b4,null));};exports[_0xc8b9('0xb6')]=function(_0xe04cdd,_0x59e3f8){var _0x2f9040={'raw':![],'where':{'id':_0xe04cdd['params']['id']}},_0x1b6788={};_0x1b6788[_0xc8b9('0x35')]=_[_0xc8b9('0x38')](db[_0xc8b9('0x30')][_0xc8b9('0x31')]);_0x1b6788['query']=_[_0xc8b9('0x38')](_0xe04cdd[_0xc8b9('0x37')]);_0x1b6788[_0xc8b9('0x42')]=_[_0xc8b9('0x3a')](_0x1b6788['model'],_0x1b6788[_0xc8b9('0x37')]);_0x2f9040[_0xc8b9('0x39')]=_[_0xc8b9('0x3a')](_0x1b6788['model'],qs[_0xc8b9('0x3b')](_0xe04cdd[_0xc8b9('0x37')]['fields']));_0x2f9040[_0xc8b9('0x39')]=_0x2f9040[_0xc8b9('0x39')][_0xc8b9('0x3c')]?_0x2f9040['attributes']:_0x1b6788[_0xc8b9('0x35')];if(_0xe04cdd[_0xc8b9('0x37')][_0xc8b9('0xb7')]){_0x2f9040[_0xc8b9('0xb8')]=[{'all':!![]}];}_0x2f9040=_[_0xc8b9('0xb9')]({},_0x2f9040,_0xe04cdd[_0xc8b9('0xba')]);return db['MailInteraction'][_0xc8b9('0x5c')](_0x2f9040)['then'](handleEntityNotFound(_0x59e3f8,null))[_0xc8b9('0x1a')](respondWithResult(_0x59e3f8,null))['catch'](handleError(_0x59e3f8,null));};exports[_0xc8b9('0xbb')]=function(_0x5b33ef,_0x2782fa){return db['MailInteraction'][_0xc8b9('0xbb')](_0x5b33ef['body'],{})['then'](respondWithResult(_0x2782fa,0xc9))[_0xc8b9('0x2e')](handleError(_0x2782fa,null));};exports[_0xc8b9('0xbc')]=function(_0x2e7ea2,_0x55fe26){if(_0x2e7ea2[_0xc8b9('0xbd')]['id']){delete _0x2e7ea2[_0xc8b9('0xbd')]['id'];}return db[_0xc8b9('0x30')][_0xc8b9('0x5c')]({'where':{'id':_0x2e7ea2['params']['id']}})['then'](handleEntityNotFound(_0x55fe26,null))['then'](saveUpdates(_0x2e7ea2['body'],null))['then'](respondWithResult(_0x55fe26,null))[_0xc8b9('0x2e')](handleError(_0x55fe26,null));};exports[_0xc8b9('0x1b')]=function(_0x1846b1,_0x34c657){return db[_0xc8b9('0x30')]['find']({'where':{'id':_0x1846b1[_0xc8b9('0xbe')]['id']}})[_0xc8b9('0x1a')](handleEntityNotFound(_0x34c657,null))[_0xc8b9('0x1a')](removeEntity(_0x34c657,null))[_0xc8b9('0x2e')](handleError(_0x34c657,null));};exports[_0xc8b9('0xbf')]=function(_0x4a21d8,_0x1bd58b){return db[_0xc8b9('0x30')]['describe']()[_0xc8b9('0x1a')](respondWithResult(_0x1bd58b,null))[_0xc8b9('0x2e')](handleError(_0x1bd58b,null));};exports['addMessage']=function(_0x2e3f29,_0x326bca){return db[_0xc8b9('0x27')][_0xc8b9('0x5c')]({'where':{'id':_0x2e3f29[_0xc8b9('0xbe')]['id']}})[_0xc8b9('0x1a')](handleEntityNotFound(_0x326bca,null))[_0xc8b9('0x1a')](function(_0xf14294){if(_0xf14294){return _0xf14294[_0xc8b9('0xc0')](_0x2e3f29[_0xc8b9('0xbd')][_0xc8b9('0xc1')],_['omit'](_0x2e3f29[_0xc8b9('0xbd')],[_0xc8b9('0xc1'),'id'])||{});}})[_0xc8b9('0x1a')](respondWithResult(_0x326bca,null))[_0xc8b9('0x2e')](handleError(_0x326bca,null));};exports[_0xc8b9('0xc2')]=function(_0x402d82,_0x3585ef){var _0x450525={'raw':![],'where':{}};var _0x56a07a={};var _0x50db80={'count':0x0,'rows':[]};return db[_0xc8b9('0x30')][_0xc8b9('0x28')]({'where':{'id':_0x402d82['params']['id']}})[_0xc8b9('0x1a')](handleEntityNotFound(_0x3585ef,null))[_0xc8b9('0x1a')](function(_0x5ac87c){if(_0x5ac87c){_0x56a07a[_0xc8b9('0x35')]=_[_0xc8b9('0x38')](db[_0xc8b9('0x27')]['rawAttributes']);_0x56a07a[_0xc8b9('0x37')]=_[_0xc8b9('0x38')](_0x402d82['query']);_0x56a07a[_0xc8b9('0x42')]=_[_0xc8b9('0x3a')](_0x56a07a[_0xc8b9('0x35')],_0x56a07a[_0xc8b9('0x37')]);_0x450525[_0xc8b9('0x39')]=_[_0xc8b9('0x3a')](_0x56a07a['model'],qs['fields'](_0x402d82[_0xc8b9('0x37')][_0xc8b9('0x3b')]));_0x450525[_0xc8b9('0x39')]=_0x450525[_0xc8b9('0x39')][_0xc8b9('0x3c')]?_0x450525[_0xc8b9('0x39')]:_0x56a07a[_0xc8b9('0x35')];if(!_0x402d82[_0xc8b9('0x37')][_0xc8b9('0x3d')](_0xc8b9('0x3e'))){_0x450525[_0xc8b9('0x17')]=qs[_0xc8b9('0x17')](_0x402d82[_0xc8b9('0x37')][_0xc8b9('0x17')]);_0x450525[_0xc8b9('0x15')]=qs[_0xc8b9('0x15')](_0x402d82[_0xc8b9('0x37')][_0xc8b9('0x15')]);}_0x450525[_0xc8b9('0x3f')]=qs[_0xc8b9('0x40')](_0x402d82['query'][_0xc8b9('0x40')]);_0x450525[_0xc8b9('0x41')]=qs[_0xc8b9('0x42')](_[_0xc8b9('0xc3')](_0x402d82[_0xc8b9('0x37')],_0x56a07a[_0xc8b9('0x42')]));_0x450525['where'][_0xc8b9('0xc4')]=_0x5ac87c['id'];if(_0x402d82[_0xc8b9('0x37')]['filter']){_0x450525['where']=_[_0xc8b9('0xb9')](_0x450525[_0xc8b9('0x41')],{'$or':_['map'](_0x450525[_0xc8b9('0x39')],function(_0x38e4b0){var _0x4da787={};_0x4da787[_0x38e4b0]={'$like':'%'+_0x402d82[_0xc8b9('0x37')][_0xc8b9('0x81')]+'%'};return _0x4da787;})});}if(_0x402d82[_0xc8b9('0x37')]['$gte']){var _0x1c0ce9=_0x402d82[_0xc8b9('0x37')][_0xc8b9('0x77')][_0xc8b9('0x24')](',');var _0x1a7616={};_0x1a7616[_0x1c0ce9[0x0]]={'$gte':moment(_0x1c0ce9[0x1])[_0xc8b9('0xc5')](_0xc8b9('0xc6'))};_0x450525[_0xc8b9('0x41')]=_[_0xc8b9('0xb9')](_0x450525[_0xc8b9('0x41')],_0x1a7616);}_0x450525=_[_0xc8b9('0xb9')]({},_0x450525,_0x402d82['options']);return db[_0xc8b9('0x27')][_0xc8b9('0x18')]({'where':_0x450525[_0xc8b9('0x41')]})[_0xc8b9('0x1a')](function(_0x5e5f21){_0x50db80[_0xc8b9('0x18')]=_0x5e5f21;if(_0x402d82[_0xc8b9('0x37')][_0xc8b9('0xb7')]){_0x450525[_0xc8b9('0xb8')]=[{'all':!![]}];}return db[_0xc8b9('0x27')][_0xc8b9('0xc7')](_0x450525);})[_0xc8b9('0x1a')](function(_0xd63bb9){if(_0x402d82[_0xc8b9('0x37')]['inlineCss']===_0xc8b9('0xc8')){for(var _0x528a58=0x0;_0x528a58<_0xd63bb9['length'];_0x528a58++){_0xd63bb9[_0x528a58][_0xc8b9('0xbd')]=juice(_0xd63bb9[_0x528a58][_0xc8b9('0xbd')]);}}_0x50db80[_0xc8b9('0xb5')]=_0xd63bb9;return _0x50db80;});}})['then'](respondWithFilteredResult(_0x3585ef,_0x450525))['catch'](handleError(_0x3585ef,null));};exports['addTags']=function(_0x300f72,_0x3a2d08){return db[_0xc8b9('0x30')][_0xc8b9('0x5c')]({'where':{'id':_0x300f72['params']['id']}})['then'](handleEntityNotFound(_0x3a2d08,null))[_0xc8b9('0x1a')](function(_0x5e777a){if(_0x5e777a){return _0x5e777a[_0xc8b9('0xc9')](_0x300f72[_0xc8b9('0xbd')][_0xc8b9('0xc1')],_['omit'](_0x300f72[_0xc8b9('0xbd')],[_0xc8b9('0xc1'),'id'])||{})[_0xc8b9('0xca')](function(){return db[_0xc8b9('0xcb')]['findAll']({'attributes':['id',_0xc8b9('0x36'),_0xc8b9('0x45')],'where':{'id':_0x300f72['body'][_0xc8b9('0xc1')]}});})[_0xc8b9('0x1a')](function(_0x1fd337){socket[_0xc8b9('0xcc')](_0xc8b9('0xcd'),{'id':Number(_0x300f72[_0xc8b9('0xbe')]['id']),'tags':_0x1fd337||[]});return{'id':Number(_0x300f72[_0xc8b9('0xbe')]['id']),'tags':_0x1fd337||[]};});}})[_0xc8b9('0x1a')](respondWithResult(_0x3a2d08,null))[_0xc8b9('0x2e')](handleError(_0x3a2d08,null));};exports[_0xc8b9('0xce')]=function(_0x106ffa,_0x236389){return db['MailInteraction'][_0xc8b9('0x5c')]({'where':{'id':_0x106ffa[_0xc8b9('0xbe')]['id']}})['then'](handleEntityNotFound(_0x236389,null))['then'](function(_0x2706b3){if(_0x2706b3){return _0x2706b3[_0xc8b9('0xce')](_0x106ffa[_0xc8b9('0x37')][_0xc8b9('0xc1')]);}})[_0xc8b9('0x1a')](respondWithStatusCode(_0x236389,null))[_0xc8b9('0x2e')](handleError(_0x236389,null));};exports[_0xc8b9('0xcf')]=function(_0x1ff75e,_0xf9ca24){var _0x43e5ba=moment()[_0xc8b9('0xd0')]()[_0xc8b9('0x95')]();var _0x198437=path[_0xc8b9('0xd1')](config['root'],_0xc8b9('0xd2'),'files',_0xc8b9('0xd3'));var _0x21fdf4=path['join'](config[_0xc8b9('0xd4')],_0xc8b9('0xd2'),_0xc8b9('0xd5'),_0xc8b9('0xd6'));var _0x22d02d=path['join'](_0x198437,_0x43e5ba);var _0x35b28b=util[_0xc8b9('0xc5')](_0xc8b9('0xd7'),_0x1ff75e[_0xc8b9('0xbe')]['id'],_0x43e5ba);var _0x2a3007=path['join'](_0x198437,_0x35b28b);var _0x9fce98=[];if(_0x1ff75e[_0xc8b9('0x37')][_0xc8b9('0xd6')]){_0x9fce98[_0xc8b9('0x26')]({'model':db['Attachment'],'as':'Attachments','raw':!![]});}var _0x4066d4=[{'model':db[_0xc8b9('0x27')],'as':_0xc8b9('0xd8'),'attributes':['id',_0xc8b9('0xbd'),_0xc8b9('0x46'),'to','cc',_0xc8b9('0xd9'),_0xc8b9('0xda'),_0xc8b9('0x75')],'where':{'secret':![]},'order':qs[_0xc8b9('0x40')]('id'),'include':_0x9fce98}];return db[_0xc8b9('0x30')]['find']({'where':{'id':_0x1ff75e[_0xc8b9('0xbe')]['id']},'include':_0x4066d4})[_0xc8b9('0x1a')](handleEntityNotFound(_0xf9ca24,null))[_0xc8b9('0x1a')](function(_0x3a3f99){if(_0x3a3f99&&_0x3a3f99['Messages']){var _0x5ab028=_0x3a3f99[_0xc8b9('0xdb')]({'plain':!![]});fs['mkdirSync'](_0x22d02d);return BPromise[_0xc8b9('0xdc')](_0x5ab028[_0xc8b9('0xd8')],function(_0x4e4fd1,_0xdc48de){var _0x765bb7={'from':_0x4e4fd1['from'],'to':_0x4e4fd1['to'],'subject':_0x4e4fd1[_0xc8b9('0xda')],'html':htmlEntities[_0xc8b9('0xdd')](_0x4e4fd1[_0xc8b9('0xbd')]),'headers':{'Date':moment(_0x4e4fd1['createdAt'])[_0xc8b9('0xc5')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x4e4fd1['cc']){_0x765bb7[_0xc8b9('0xde')]['Cc']=_0x4e4fd1['cc'];}if(_0x4e4fd1[_0xc8b9('0xd9')]){_0x765bb7[_0xc8b9('0xde')][_0xc8b9('0xdf')]=_0x4e4fd1[_0xc8b9('0xd9')];}return new BPromise(function(_0x41bc0b,_0x2690c9){if(_0x4e4fd1[_0xc8b9('0xe0')]){for(var _0x215a5e=0x0;_0x215a5e<_0x4e4fd1[_0xc8b9('0xe0')]['length'];_0x215a5e++){var _0x12356d=_0x4e4fd1[_0xc8b9('0xe0')][_0x215a5e];var _0x50a55a=path[_0xc8b9('0xd1')](_0x21fdf4,_0x12356d[_0xc8b9('0xe1')]);if(fs['existsSync'](_0x50a55a)){_0x765bb7['attachments']['push']({'name':_0x12356d[_0xc8b9('0x36')],'contentType':_0x12356d[_0xc8b9('0x33')],'data':fs[_0xc8b9('0xe2')](_0x50a55a)});}}}emlformat[_0xc8b9('0xe3')](_0x765bb7,function(_0xcf2420,_0x52546d){if(_0xcf2420)return _0x2690c9(_0xcf2420);fs[_0xc8b9('0xe4')](path[_0xc8b9('0xd1')](_0x22d02d,util[_0xc8b9('0xc5')]('message%d.eml',_0xdc48de)),_0x52546d);return _0x41bc0b(_0x52546d);});});})['then'](function(){return new BPromise(function(_0x11c46f,_0x568d9e){zipdir(_0x22d02d,{'saveTo':_0x2a3007},function(_0x208475,_0x112a8a){if(_0x208475)return _0x568d9e(_0x208475);return _0x11c46f(_0x112a8a);});})[_0xc8b9('0x1a')](function(){return new BPromise(function(_0x4e1212,_0x137069){rimraf(_0x22d02d,function(_0x48c92a){if(_0x48c92a)_0x137069(_0x48c92a);return _0x4e1212();});});})[_0xc8b9('0x1a')](function(){return _0xf9ca24['download'](_0x2a3007,_0x35b28b,function(_0x4e9a76){if(!_0x4e9a76)fs['unlinkSync'](_0x2a3007);});});});}else{return _0xf9ca24[_0xc8b9('0x12')](0xc8);}})[_0xc8b9('0x2e')](handleError(_0xf9ca24,null));}; \ No newline at end of file +var _0xb7f7=['MailMessage','ids','hasOwnProperty','split','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','rows','addTags','omit','spread','Tag','emit','mailInteractionTags:save','removeTags','download','join','files','tmp','root','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','subject','get','mkdirSync','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','rimraf','moment','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','then','destroy','error','name','send','Users','map','fullname','TagIds','Tags','forEach','findOne','out','plainBody','-id','lastMsgText','trimStart','catch','MailInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','select','field','color','from','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20>\x200','tag','isArray','filter','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','agent','user','i.MailAccountId\x20IS\x20NULL','role','sequelize','toString','count','keyBy','merge','a.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.closed','i.attach','i.lastMsgAt','i.subject','i.disposition','i.to','i.ContactId','i.MailAccountId','i.UserId','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','enableEmailPreview','all','show','includeAll','include','options','body','update','params','describe','addMessage'];(function(_0x2cc660,_0x2ebeec){var _0x222764=function(_0x251deb){while(--_0x251deb){_0x2cc660['push'](_0x2cc660['shift']());}};_0x222764(++_0x2ebeec);}(_0xb7f7,0x10d));var _0x7b7f=function(_0x6b226d,_0x485ebb){_0x6b226d=_0x6b226d-0x0;var _0x54b270=_0xb7f7[_0x6b226d];return _0x54b270;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7b7f('0x0'));var zipdir=require('zip-dir');var moment=require(_0x7b7f('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x7b7f('0x2'));var fs=require('fs');var _=require(_0x7b7f('0x3'));var squel=require('squel');var juice=require(_0x7b7f('0x4'));var Redis=require(_0x7b7f('0x5'));var qs=require(_0x7b7f('0x6'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0x7b7f('0x7'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var htmlEntities=require(_0x7b7f('0x8'));config[_0x7b7f('0x9')]=_[_0x7b7f('0xa')](config['redis'],{'host':_0x7b7f('0xb'),'port':0x18eb});var socket=require(_0x7b7f('0xc'))(new Redis(config[_0x7b7f('0x9')]));require(_0x7b7f('0xd'))[_0x7b7f('0xe')](socket);function respondWithStatusCode(_0x1a21df,_0x3c052d){_0x3c052d=_0x3c052d||0xcc;return function(_0x25f21f){if(_0x25f21f){return _0x1a21df[_0x7b7f('0xf')](_0x3c052d);}return _0x1a21df[_0x7b7f('0x10')](_0x3c052d)[_0x7b7f('0x11')]();};}function respondWithResult(_0x5c4e06,_0x41bba0){_0x41bba0=_0x41bba0||0xc8;return function(_0x354a07){if(_0x354a07){return _0x5c4e06[_0x7b7f('0x10')](_0x41bba0)[_0x7b7f('0x12')](_0x354a07);}};}function respondWithFilteredResult(_0xd4dc48,_0x35f235){return function(_0xe84496){if(_0xe84496){var _0x4a5650=typeof _0x35f235[_0x7b7f('0x13')]===_0x7b7f('0x14')&&typeof _0x35f235[_0x7b7f('0x15')]===_0x7b7f('0x14');var _0x1ea579=_0xe84496['count'];var _0x49104a=_0x4a5650?0x0:_0x35f235[_0x7b7f('0x13')];var _0x43dc64=_0x4a5650?_0xe84496['count']:_0x35f235[_0x7b7f('0x13')]+_0x35f235[_0x7b7f('0x15')];var _0x5639c0;if(_0x43dc64>=_0x1ea579){_0x43dc64=_0x1ea579;_0x5639c0=0xc8;}else{_0x5639c0=0xce;}_0xd4dc48[_0x7b7f('0x10')](_0x5639c0);return _0xd4dc48[_0x7b7f('0x16')](_0x7b7f('0x17'),_0x49104a+'-'+_0x43dc64+'/'+_0x1ea579)['json'](_0xe84496);}return null;};}function saveUpdates(_0x42828e){return function(_0x48f0be){if(_0x48f0be){return _0x48f0be['update'](_0x42828e)[_0x7b7f('0x18')](function(_0x1efe62){return _0x1efe62;});}return null;};}function removeEntity(_0x971adc){return function(_0x13d865){if(_0x13d865){return _0x13d865[_0x7b7f('0x19')]()['then'](function(){_0x971adc[_0x7b7f('0x10')](0xcc)[_0x7b7f('0x11')]();});}};}function handleEntityNotFound(_0x5ae8e0){return function(_0x21787c){if(!_0x21787c){_0x5ae8e0[_0x7b7f('0xf')](0x194);}return _0x21787c;};}function handleError(_0x65d863,_0x16c50b){_0x16c50b=_0x16c50b||0x1f4;return function(_0x470322){logger[_0x7b7f('0x1a')](_0x470322['stack']);if(_0x470322[_0x7b7f('0x1b')]){delete _0x470322[_0x7b7f('0x1b')];}_0x65d863['status'](_0x16c50b)[_0x7b7f('0x1c')](_0x470322);};}function getInteractionUsers(_0x40c941,_0x594125){return new BPromise(function(_0x3305a7,_0x340d8d){try{if(_0x594125[_0x40c941['id']]){_0x40c941[_0x7b7f('0x1d')]=_[_0x7b7f('0x1e')](_0x594125[_0x40c941['id']],function(_0x5b49b9){return{'id':_0x5b49b9['id'],'fullname':_0x5b49b9[_0x7b7f('0x1f')]};});}}catch(_0x4f1579){_0x340d8d(_0x4f1579);}_0x3305a7(_0x40c941);});}function getInteractionTags(_0x23a8c2,_0x197939){return new BPromise(function(_0xf50043,_0x45869c){try{if(_0x23a8c2[_0x7b7f('0x20')]){_0x23a8c2[_0x7b7f('0x21')]=[];_0x23a8c2[_0x7b7f('0x20')]['split'](',')[_0x7b7f('0x22')](function(_0x96bc22){_0x23a8c2[_0x7b7f('0x21')]['push'](_0x197939[_0x96bc22]);});}delete _0x23a8c2['TagIds'];}catch(_0x1e020d){_0x45869c(_0x1e020d);}_0xf50043(_0x23a8c2);});}function getLastMessageText(_0x6a2f37){return new BPromise(function(_0x15ddc1,_0x170392){return db['MailMessage'][_0x7b7f('0x23')]({'where':{'$and':[{'MailInteractionId':_0x6a2f37['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x7b7f('0x24')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x7b7f('0x25')],'order':_0x7b7f('0x26'),'raw':!![]})[_0x7b7f('0x18')](function(_0x328703){if(_0x328703&&_0x328703[_0x7b7f('0x25')]){_0x6a2f37[_0x7b7f('0x27')]=_[_0x7b7f('0x28')](_0x328703[_0x7b7f('0x25')]);}_0x15ddc1(_0x6a2f37);})[_0x7b7f('0x29')](function(_0x523f36){_0x170392(_0x523f36);});});}function updateMailInteraction(_0x4c490f,_0x18eb45,_0x3f2edf,_0x43a35e){return new BPromise(function(_0x4c8f5b,_0x1dcfca){return getInteractionUsers(_0x4c490f,_0x3f2edf)['then'](function(_0x29b9a7){return getInteractionTags(_0x29b9a7,_0x18eb45);})[_0x7b7f('0x18')](function(_0x1a027e){if(_0x43a35e){_0x4c8f5b(getLastMessageText(_0x1a027e));}else{_0x4c8f5b(_0x1a027e);}})['catch'](function(_0x439441){_0x1dcfca(_0x439441);});});}exports['index']=function(_0x350175,_0x4b58e6){var _0x3e9892={},_0x264c41={},_0x3cef4d={'count':0x0,'rows':[]};var _0x1c0a7c=_[_0x7b7f('0x1e')](db[_0x7b7f('0x2a')][_0x7b7f('0x2b')],function(_0x43be37){return{'name':_0x43be37[_0x7b7f('0x2c')],'type':_0x43be37[_0x7b7f('0x2d')][_0x7b7f('0x2e')]};});_0x264c41[_0x7b7f('0x2f')]=_['map'](_0x1c0a7c,_0x7b7f('0x1b'));_0x264c41[_0x7b7f('0x30')]=_[_0x7b7f('0x31')](_0x350175[_0x7b7f('0x30')]);_0x264c41[_0x7b7f('0x32')]=_[_0x7b7f('0x33')](_0x264c41[_0x7b7f('0x2f')],_0x264c41['query']);_0x3e9892[_0x7b7f('0x34')]=_[_0x7b7f('0x33')](_0x264c41[_0x7b7f('0x2f')],qs[_0x7b7f('0x35')](_0x350175[_0x7b7f('0x30')][_0x7b7f('0x35')]));_0x3e9892['attributes']=_0x3e9892[_0x7b7f('0x34')][_0x7b7f('0x36')]?_0x3e9892[_0x7b7f('0x34')]:_0x264c41['model'];if(!_0x350175[_0x7b7f('0x30')]['hasOwnProperty'](_0x7b7f('0x37'))){_0x3e9892[_0x7b7f('0x15')]=qs['limit'](_0x350175['query']['limit']);_0x3e9892['offset']=qs[_0x7b7f('0x13')](_0x350175['query']['offset']);}_0x3e9892[_0x7b7f('0x38')]=qs[_0x7b7f('0x39')](_0x350175[_0x7b7f('0x30')]['sort']);_0x3e9892[_0x7b7f('0x3a')]=qs[_0x7b7f('0x32')](_[_0x7b7f('0x3b')](_0x350175[_0x7b7f('0x30')],_0x264c41[_0x7b7f('0x32')]),_0x1c0a7c);var _0x26218f=[];var _0x13da86=squel[_0x7b7f('0x3c')]()['field']('id')[_0x7b7f('0x3d')](_0x7b7f('0x1b'))[_0x7b7f('0x3d')](_0x7b7f('0x3e'))[_0x7b7f('0x3f')]('tools_tags');var _0x5cca0d=squel[_0x7b7f('0x3c')]()[_0x7b7f('0x3d')]('u.id')[_0x7b7f('0x3d')](_0x7b7f('0x40'))[_0x7b7f('0x3d')](_0x7b7f('0x41'))[_0x7b7f('0x3f')](_0x7b7f('0x42'),'ui')[_0x7b7f('0x43')](_0x7b7f('0x44'),'u',_0x7b7f('0x45'));var _0xa650d1=squel['select']()['from'](_0x7b7f('0x46'),'i')['left_join'](_0x7b7f('0x47'),'c',_0x7b7f('0x48'))[_0x7b7f('0x43')]('users','o',_0x7b7f('0x49'))[_0x7b7f('0x43')](_0x7b7f('0x4a'),'a',_0x7b7f('0x4b'))[_0x7b7f('0x43')]('mail_messages','me',_0x7b7f('0x4c'))['left_join'](_0x7b7f('0x4d'),'it','it.MailInteractionId\x20=\x20i.id')['left_join']('tools_tags','t',_0x7b7f('0x4e'));var _0x59ea65=squel[_0x7b7f('0x4f')]();var _0x44d1bf=[];var _0xe699b=squel[_0x7b7f('0x4f')]();var _0x43cd4a;if(_0x350175[_0x7b7f('0x30')][_0x7b7f('0x50')]){_0x43cd4a=as['parseSearch'](_0x350175['query'][_0x7b7f('0x50')]);var _0x115b17=_0x43cd4a[_0x7b7f('0x51')];for(var _0x1ed339=0x0;_0x1ed339<_0x43cd4a['conditions']['length'];_0x1ed339++){var _0x1f273e=_0x43cd4a[_0x7b7f('0x52')][_0x1ed339];var _0x3d42b8='i';var _0x551b02=_[_0x7b7f('0x53')](_0x1c0a7c,['name',_0x1f273e[_0x7b7f('0x3d')]]);if(!_0x551b02){switch(_0x1f273e[_0x7b7f('0x3d')]){case'unreadMessages':if(_0x1f273e['value']==0x1){_0xa650d1['having']('`'+_0x1f273e[_0x7b7f('0x3d')]+_0x7b7f('0x54'));}else{_0xa650d1[_0x7b7f('0x55')]('`'+_0x1f273e['field']+_0x7b7f('0x56'));}break;case _0x7b7f('0x57'):if(_0x1f273e[_0x7b7f('0x58')]===_0x7b7f('0x59')){if(_0x1f273e['value']['split']('\x20')['length']>0x1){_0x59ea65[_0x115b17](_0x7b7f('0x5a'),qs[_0x7b7f('0x5b')](_0x1f273e[_0x7b7f('0x5c')]),null);}else{var _0x439eed='%'+_0x1f273e[_0x7b7f('0x5c')]+'%';_0x59ea65[_0x115b17](_0x7b7f('0x5d'),_0x439eed,_0x439eed,_0x439eed);}}else{_0x551b02=_['find'](_0x1c0a7c,['name',_0x7b7f('0x5e')]);_0x1f273e[_0x7b7f('0x3d')]=_0x7b7f('0x5e');_0x376c63=as[_0x7b7f('0x5f')](_0x3d42b8,_0x551b02[_0x7b7f('0x2d')],_0x1f273e);_0x59ea65[_0x115b17](_0x376c63[_0x7b7f('0x60')],_0x376c63['value']['start'],_0x376c63[_0x7b7f('0x5c')]['end']);}break;case'Tag':var _0x4342c1=_0x1f273e[_0x7b7f('0x5c')]['split'](',')[_0x7b7f('0x1e')](function(_0xdcd66c){return Number(_0xdcd66c);});_0x4342c1[_0x7b7f('0x22')](function(_0x40e050){_0xe699b['or'](_0x7b7f('0x61'),'%,'+_0x40e050+',%');});_0x44d1bf=_[_0x7b7f('0x62')](_0x44d1bf,_0x4342c1);break;case'User':if(_0x1f273e[_0x7b7f('0x58')]===_0x7b7f('0x59')){_0x59ea65[_0x115b17](_0x7b7f('0x63'),'%'+_0x1f273e[_0x7b7f('0x5c')]+'%',null);}else{_0x551b02=_[_0x7b7f('0x53')](_0x1c0a7c,['name','UserId']);_0x1f273e['field']=_0x7b7f('0x64');_0x376c63=as['buildExpression'](_0x3d42b8,_0x551b02[_0x7b7f('0x2d')],_0x1f273e);_0x59ea65[_0x115b17](_0x376c63[_0x7b7f('0x60')],_0x376c63[_0x7b7f('0x5c')][_0x7b7f('0x65')],_0x376c63[_0x7b7f('0x5c')][_0x7b7f('0x11')]);}break;case _0x7b7f('0x25'):_0x376c63=as[_0x7b7f('0x5f')]('me',null,_0x1f273e);_0x59ea65[_0x115b17](_0x376c63['text'],_0x376c63['value'][_0x7b7f('0x65')],_0x376c63[_0x7b7f('0x5c')]['end']);break;}}else{var _0x376c63=as[_0x7b7f('0x5f')](_0x3d42b8,_0x551b02[_0x7b7f('0x2d')],_0x1f273e);_0x59ea65[_0x115b17](_0x376c63[_0x7b7f('0x60')],_0x376c63[_0x7b7f('0x5c')]['start'],_0x376c63[_0x7b7f('0x5c')][_0x7b7f('0x11')]);}}}else{var _0xbd9506=_(_0x350175['query'])[_0x7b7f('0x31')]()[_0x7b7f('0x1e')](function(_0x157988){return _['some'](_0x1c0a7c,[_0x7b7f('0x1b'),_0x157988])?_0x157988:undefined;})[_0x7b7f('0x66')]()[_0x7b7f('0x5c')]();if(!_[_0x7b7f('0x67')](_0xbd9506)){_0xbd9506['forEach'](function(_0x8349d9){if(_0x8349d9===_0x7b7f('0x68')){_0xa650d1['where'](_0x7b7f('0x69'),[][_0x7b7f('0x6a')](_0x350175[_0x7b7f('0x30')][_0x8349d9]));}else if(_0x8349d9===_0x7b7f('0x6b')){var _0x172a2b=JSON['parse'](_0x350175[_0x7b7f('0x30')][_0x8349d9])[_0x7b7f('0x6c')];var _0x12efa2=JSON['parse'](_0x350175['query'][_0x8349d9])[_0x7b7f('0x6d')];_0xa650d1[_0x7b7f('0x3a')](_0x7b7f('0x6e'),_0x172a2b,_0x12efa2);}else{if(_0x350175[_0x7b7f('0x30')][_0x8349d9]===_0x7b7f('0x6f')){_0xa650d1['where']('i.'+_0x8349d9+_0x7b7f('0x70'));}else{_0xa650d1[_0x7b7f('0x3a')]('i.'+_0x8349d9+'\x20=\x20?',_0x350175[_0x7b7f('0x30')][_0x8349d9]);}}});}if(_0x350175['query'][_0x7b7f('0x71')]){if(_0x350175['query']['read']==0x1){_0xa650d1['having']('`unreadMessages`\x20=\x200');}else{_0xa650d1[_0x7b7f('0x55')](_0x7b7f('0x72'));}}if(_0x350175['query'][_0x7b7f('0x73')]){_0x44d1bf=_[_0x7b7f('0x74')](_0x350175['query']['tag'])?_0x350175['query'][_0x7b7f('0x73')]:new Array(_0x350175[_0x7b7f('0x30')][_0x7b7f('0x73')]);_0x44d1bf['forEach'](function(_0x991b83){_0xe699b['or'](_0x7b7f('0x61'),'%,'+_0x991b83+',%');});}if(_0x350175['query'][_0x7b7f('0x75')]){var _0x10be0f=_0x350175[_0x7b7f('0x30')][_0x7b7f('0x75')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x7b7f('0x76')](_0x10be0f)){_0x59ea65['or'](_0x7b7f('0x77'),_0x10be0f+'%');}else if(qs[_0x7b7f('0x78')](_0x10be0f)){_0x59ea65['or'](_0x7b7f('0x79'),_0x10be0f+'%');}else{_0x59ea65['or'](_0x7b7f('0x7a'),qs['getFullTextValue'](_0x10be0f))['or'](_0x7b7f('0x7b'),qs[_0x7b7f('0x5b')](_0x10be0f));}}}_0xa650d1['where'](_0x59ea65);_0xa650d1['group'](_0x7b7f('0x7c'));var _0x595eb3={'type':db['Sequelize'][_0x7b7f('0x7d')]['SELECT'],'raw':!![]};var _0xd38a57=_0xa650d1[_0x7b7f('0x7e')]();_0xd38a57[_0x7b7f('0x3d')](_0x7b7f('0x7c'));_0xd38a57[_0x7b7f('0x3d')](_0x7b7f('0x7f'),_0x7b7f('0x80'));if(_0x3e9892['order']){_0x3e9892['order'][_0x7b7f('0x22')](function(_0x5ced27){var _0x175f77=_0x5ced27[0x0]===_0x7b7f('0x81')?_0x5ced27[0x0]:'i.'+_0x5ced27[0x0];_0xa650d1[_0x7b7f('0x38')](_0x175f77,_0x5ced27[0x1]==='DESC'?![]:!![]);});}if(!_[_0x7b7f('0x67')](_0x44d1bf)){_0xa650d1[_0x7b7f('0x55')](_0xe699b);_0xd38a57['where'](_0x7b7f('0x82'),_0x44d1bf);}BPromise[_0x7b7f('0x83')]()[_0x7b7f('0x18')](function(){if(!_0x43cd4a){if(_0x350175['query'][_0x7b7f('0x68')])return;_0xd38a57[_0x7b7f('0x3a')](_0x7b7f('0x84'));_0xa650d1[_0x7b7f('0x3a')](_0x7b7f('0x84'));return;}if(_0x350175['user']['role']!==_0x7b7f('0x85'))return;return _0x350175[_0x7b7f('0x86')]['getMailAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x331d7b){if(_[_0x7b7f('0x67')](_0x331d7b)){_0xd38a57[_0x7b7f('0x3a')](_0x7b7f('0x87'));_0xa650d1[_0x7b7f('0x3a')](_0x7b7f('0x87'));}else{_0xd38a57[_0x7b7f('0x3a')](_0x7b7f('0x69'),_[_0x7b7f('0x1e')](_0x331d7b,'id'));_0xa650d1[_0x7b7f('0x3a')](_0x7b7f('0x69'),_[_0x7b7f('0x1e')](_0x331d7b,'id'));}});})['then'](function(){if(_0x350175[_0x7b7f('0x86')][_0x7b7f('0x88')]===_0x7b7f('0x85')&&!_0x43cd4a&&!_0x350175[_0x7b7f('0x30')][_0x7b7f('0x68')])return[];return db[_0x7b7f('0x89')][_0x7b7f('0x30')](_0xd38a57[_0x7b7f('0x8a')](),_0x595eb3);})[_0x7b7f('0x18')](function(_0x419a6c){_0x3cef4d[_0x7b7f('0x8b')]=_0x419a6c[_0x7b7f('0x36')];if(_0x3cef4d[_0x7b7f('0x8b')]===0x0)return[];return db[_0x7b7f('0x89')][_0x7b7f('0x30')](_0x13da86['toString'](),_0x595eb3)[_0x7b7f('0x18')](function(_0xb9cc41){_0x26218f=_[_0x7b7f('0x8c')](_0xb9cc41,'id');_0x595eb3=_[_0x7b7f('0x8d')](_0x595eb3,{'model':db[_0x7b7f('0x2a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x350175[_0x7b7f('0x30')][_0x7b7f('0x35')]){_0x3e9892[_0x7b7f('0x34')][_0x7b7f('0x22')](function(_0x3503c0){_0xa650d1[_0x7b7f('0x3d')]('i.'+_0x3503c0);});}else{_0xa650d1[_0x7b7f('0x3d')](_0x7b7f('0x7f'),_0x7b7f('0x80'));_0xa650d1['field'](_0x7b7f('0x8e'),'Account.key');_0xa650d1['field'](_0x7b7f('0x8f'),'Account.mandatoryDisposition');_0xa650d1[_0x7b7f('0x3d')](_0x7b7f('0x90'),_0x7b7f('0x81'));_0xa650d1[_0x7b7f('0x3d')](_0x7b7f('0x7c'));_0xa650d1[_0x7b7f('0x3d')](_0x7b7f('0x91'));_0xa650d1['field']('i.updatedAt');_0xa650d1['field'](_0x7b7f('0x92'));_0xa650d1[_0x7b7f('0x3d')]('i.closedAt');_0xa650d1[_0x7b7f('0x3d')](_0x7b7f('0x93'));_0xa650d1['field'](_0x7b7f('0x94'));_0xa650d1['field']('i.lastMsgDirection');_0xa650d1[_0x7b7f('0x3d')](_0x7b7f('0x95'));_0xa650d1[_0x7b7f('0x3d')](_0x7b7f('0x96'));_0xa650d1[_0x7b7f('0x3d')]('i.secondDisposition');_0xa650d1[_0x7b7f('0x3d')]('i.thirdDisposition');_0xa650d1[_0x7b7f('0x3d')]('i.substatus');_0xa650d1['field'](_0x7b7f('0x97'));_0xa650d1[_0x7b7f('0x3d')](_0x7b7f('0x98'));_0xa650d1['field'](_0x7b7f('0x99'));_0xa650d1['field'](_0x7b7f('0x9a'));_0xa650d1[_0x7b7f('0x3d')]('c.firstName',_0x7b7f('0x9b'));_0xa650d1['field'](_0x7b7f('0x9c'),_0x7b7f('0x9d'));_0xa650d1[_0x7b7f('0x3d')]('c.email',_0x7b7f('0x9e'));_0xa650d1[_0x7b7f('0x3d')](_0x7b7f('0x9f'),_0x7b7f('0xa0'));_0xa650d1['field'](_0x7b7f('0xa1'),_0x7b7f('0xa2'));_0xa650d1[_0x7b7f('0x3d')](_0x7b7f('0xa3'),_0x7b7f('0xa4'));_0xa650d1[_0x7b7f('0x3d')](_0x7b7f('0xa5'),_0x7b7f('0xa6'));_0xa650d1[_0x7b7f('0x3d')](_0x7b7f('0xa7'),_0x7b7f('0xa8'));_0xa650d1[_0x7b7f('0x3d')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x7b7f('0x20'));}if(_0x3e9892[_0x7b7f('0x15')])_0xa650d1['limit'](_0x3e9892['limit']);if(_0x3e9892[_0x7b7f('0x13')])_0xa650d1['offset'](_0x3e9892[_0x7b7f('0x13')]);return db[_0x7b7f('0x89')][_0x7b7f('0x30')](_0xa650d1[_0x7b7f('0x8a')](),_0x595eb3);})[_0x7b7f('0x18')](function(_0x3a3a6a){if(_0x3a3a6a[_0x7b7f('0x36')]>0x0)_0x5cca0d[_0x7b7f('0x3a')](_0x7b7f('0xa9'),_[_0x7b7f('0x1e')](_0x3a3a6a,'id'));return db[_0x7b7f('0x89')]['query'](_0x5cca0d['toString'](),_0x595eb3)[_0x7b7f('0x18')](function(_0x1c3d37){var _0x5d7dee=_[_0x7b7f('0xaa')](_0x1c3d37,_0x7b7f('0xab'));var _0x5bcfa4=[];return db['Setting'][_0x7b7f('0x23')]({'attributes':[_0x7b7f('0xac')],'raw':!![]})[_0x7b7f('0x18')](function(_0x13ba47){var _0xf7b8fd=_0x13ba47[_0x7b7f('0xac')];_0x3a3a6a['forEach'](function(_0x3ec0b7){_0x5bcfa4['push'](updateMailInteraction(_0x3ec0b7,_0x26218f,_0x5d7dee,_0xf7b8fd));});return BPromise[_0x7b7f('0xad')](_0x5bcfa4);});});});})[_0x7b7f('0x18')](function(_0x5d1a1e){_0x3cef4d['rows']=_0x5d1a1e;return _0x3cef4d;})[_0x7b7f('0x18')](respondWithFilteredResult(_0x4b58e6,_0x3e9892))[_0x7b7f('0x29')](handleError(_0x4b58e6,null));};exports[_0x7b7f('0xae')]=function(_0x4d6f29,_0x4bbca3){var _0x431d5f={'raw':![],'where':{'id':_0x4d6f29['params']['id']}},_0x2037c4={};_0x2037c4[_0x7b7f('0x2f')]=_[_0x7b7f('0x31')](db[_0x7b7f('0x2a')][_0x7b7f('0x2b')]);_0x2037c4[_0x7b7f('0x30')]=_[_0x7b7f('0x31')](_0x4d6f29[_0x7b7f('0x30')]);_0x2037c4['filters']=_[_0x7b7f('0x33')](_0x2037c4[_0x7b7f('0x2f')],_0x2037c4[_0x7b7f('0x30')]);_0x431d5f['attributes']=_[_0x7b7f('0x33')](_0x2037c4[_0x7b7f('0x2f')],qs[_0x7b7f('0x35')](_0x4d6f29[_0x7b7f('0x30')]['fields']));_0x431d5f[_0x7b7f('0x34')]=_0x431d5f['attributes'][_0x7b7f('0x36')]?_0x431d5f[_0x7b7f('0x34')]:_0x2037c4[_0x7b7f('0x2f')];if(_0x4d6f29[_0x7b7f('0x30')][_0x7b7f('0xaf')]){_0x431d5f[_0x7b7f('0xb0')]=[{'all':!![]}];}_0x431d5f=_[_0x7b7f('0x8d')]({},_0x431d5f,_0x4d6f29[_0x7b7f('0xb1')]);return db[_0x7b7f('0x2a')]['find'](_0x431d5f)['then'](handleEntityNotFound(_0x4bbca3,null))[_0x7b7f('0x18')](respondWithResult(_0x4bbca3,null))[_0x7b7f('0x29')](handleError(_0x4bbca3,null));};exports['create']=function(_0x1087b8,_0xa582a4){return db['MailInteraction']['create'](_0x1087b8[_0x7b7f('0xb2')],{})[_0x7b7f('0x18')](respondWithResult(_0xa582a4,0xc9))[_0x7b7f('0x29')](handleError(_0xa582a4,null));};exports[_0x7b7f('0xb3')]=function(_0x44908c,_0x1874bf){if(_0x44908c['body']['id']){delete _0x44908c[_0x7b7f('0xb2')]['id'];}return db[_0x7b7f('0x2a')][_0x7b7f('0x53')]({'where':{'id':_0x44908c[_0x7b7f('0xb4')]['id']}})['then'](handleEntityNotFound(_0x1874bf,null))[_0x7b7f('0x18')](saveUpdates(_0x44908c[_0x7b7f('0xb2')],null))[_0x7b7f('0x18')](respondWithResult(_0x1874bf,null))[_0x7b7f('0x29')](handleError(_0x1874bf,null));};exports[_0x7b7f('0x19')]=function(_0x1da91e,_0x4f724e){return db[_0x7b7f('0x2a')]['find']({'where':{'id':_0x1da91e[_0x7b7f('0xb4')]['id']}})['then'](handleEntityNotFound(_0x4f724e,null))[_0x7b7f('0x18')](removeEntity(_0x4f724e,null))[_0x7b7f('0x29')](handleError(_0x4f724e,null));};exports[_0x7b7f('0xb5')]=function(_0xdfe2d7,_0x213c12){return db[_0x7b7f('0x2a')]['describe']()[_0x7b7f('0x18')](respondWithResult(_0x213c12,null))[_0x7b7f('0x29')](handleError(_0x213c12,null));};exports[_0x7b7f('0xb6')]=function(_0x134f0f,_0x580492){return db[_0x7b7f('0xb7')][_0x7b7f('0x53')]({'where':{'id':_0x134f0f[_0x7b7f('0xb4')]['id']}})[_0x7b7f('0x18')](handleEntityNotFound(_0x580492,null))['then'](function(_0x4c351a){if(_0x4c351a){return _0x4c351a[_0x7b7f('0xb6')](_0x134f0f[_0x7b7f('0xb2')][_0x7b7f('0xb8')],_['omit'](_0x134f0f[_0x7b7f('0xb2')],[_0x7b7f('0xb8'),'id'])||{});}})[_0x7b7f('0x18')](respondWithResult(_0x580492,null))['catch'](handleError(_0x580492,null));};exports['getMessages']=function(_0x96ff64,_0x5eb572){var _0x12e3d8={'raw':![],'where':{}};var _0x3a82c4={};var _0x1107d0={'count':0x0,'rows':[]};return db[_0x7b7f('0x2a')]['findOne']({'where':{'id':_0x96ff64['params']['id']}})['then'](handleEntityNotFound(_0x5eb572,null))[_0x7b7f('0x18')](function(_0x16cd6f){if(_0x16cd6f){_0x3a82c4[_0x7b7f('0x2f')]=_['keys'](db[_0x7b7f('0xb7')][_0x7b7f('0x2b')]);_0x3a82c4[_0x7b7f('0x30')]=_[_0x7b7f('0x31')](_0x96ff64['query']);_0x3a82c4['filters']=_[_0x7b7f('0x33')](_0x3a82c4[_0x7b7f('0x2f')],_0x3a82c4[_0x7b7f('0x30')]);_0x12e3d8[_0x7b7f('0x34')]=_[_0x7b7f('0x33')](_0x3a82c4[_0x7b7f('0x2f')],qs[_0x7b7f('0x35')](_0x96ff64['query'][_0x7b7f('0x35')]));_0x12e3d8[_0x7b7f('0x34')]=_0x12e3d8['attributes'][_0x7b7f('0x36')]?_0x12e3d8['attributes']:_0x3a82c4['model'];if(!_0x96ff64[_0x7b7f('0x30')][_0x7b7f('0xb9')](_0x7b7f('0x37'))){_0x12e3d8['limit']=qs['limit'](_0x96ff64[_0x7b7f('0x30')][_0x7b7f('0x15')]);_0x12e3d8[_0x7b7f('0x13')]=qs[_0x7b7f('0x13')](_0x96ff64[_0x7b7f('0x30')][_0x7b7f('0x13')]);}_0x12e3d8['order']=qs['sort'](_0x96ff64[_0x7b7f('0x30')][_0x7b7f('0x39')]);_0x12e3d8[_0x7b7f('0x3a')]=qs['filters'](_[_0x7b7f('0x3b')](_0x96ff64['query'],_0x3a82c4[_0x7b7f('0x32')]));_0x12e3d8['where'][_0x7b7f('0xab')]=_0x16cd6f['id'];if(_0x96ff64['query'][_0x7b7f('0x75')]){_0x12e3d8[_0x7b7f('0x3a')]=_['merge'](_0x12e3d8[_0x7b7f('0x3a')],{'$or':_[_0x7b7f('0x1e')](_0x12e3d8['attributes'],function(_0x5ac255){var _0x58ee39={};_0x58ee39[_0x5ac255]={'$like':'%'+_0x96ff64['query'][_0x7b7f('0x75')]+'%'};return _0x58ee39;})});}if(_0x96ff64[_0x7b7f('0x30')]['$gte']){var _0x446565=_0x96ff64[_0x7b7f('0x30')][_0x7b7f('0x6c')][_0x7b7f('0xba')](',');var _0x42a88e={};_0x42a88e[_0x446565[0x0]]={'$gte':moment(_0x446565[0x1])[_0x7b7f('0xbb')](_0x7b7f('0xbc'))};_0x12e3d8[_0x7b7f('0x3a')]=_[_0x7b7f('0x8d')](_0x12e3d8['where'],_0x42a88e);}_0x12e3d8=_[_0x7b7f('0x8d')]({},_0x12e3d8,_0x96ff64[_0x7b7f('0xb1')]);return db[_0x7b7f('0xb7')][_0x7b7f('0x8b')]({'where':_0x12e3d8[_0x7b7f('0x3a')]})['then'](function(_0x29ab8d){_0x1107d0[_0x7b7f('0x8b')]=_0x29ab8d;if(_0x96ff64[_0x7b7f('0x30')][_0x7b7f('0xaf')]){_0x12e3d8[_0x7b7f('0xb0')]=[{'all':!![]}];}return db[_0x7b7f('0xb7')][_0x7b7f('0xbd')](_0x12e3d8);})[_0x7b7f('0x18')](function(_0x12582e){if(_0x96ff64[_0x7b7f('0x30')][_0x7b7f('0xbe')]===_0x7b7f('0xbf')){for(var _0x1f17b2=0x0;_0x1f17b2<_0x12582e[_0x7b7f('0x36')];_0x1f17b2++){_0x12582e[_0x1f17b2][_0x7b7f('0xb2')]=juice(_0x12582e[_0x1f17b2][_0x7b7f('0xb2')]);}}_0x1107d0[_0x7b7f('0xc0')]=_0x12582e;return _0x1107d0;});}})[_0x7b7f('0x18')](respondWithFilteredResult(_0x5eb572,_0x12e3d8))['catch'](handleError(_0x5eb572,null));};exports[_0x7b7f('0xc1')]=function(_0x467e16,_0x51edf1){return db[_0x7b7f('0x2a')][_0x7b7f('0x53')]({'where':{'id':_0x467e16[_0x7b7f('0xb4')]['id']}})[_0x7b7f('0x18')](handleEntityNotFound(_0x51edf1,null))[_0x7b7f('0x18')](function(_0x4a802e){if(_0x4a802e){return _0x4a802e['setTags'](_0x467e16['body'][_0x7b7f('0xb8')],_[_0x7b7f('0xc2')](_0x467e16['body'],['ids','id'])||{})[_0x7b7f('0xc3')](function(){return db[_0x7b7f('0xc4')][_0x7b7f('0xbd')]({'attributes':['id',_0x7b7f('0x1b'),_0x7b7f('0x3e')],'where':{'id':_0x467e16['body'][_0x7b7f('0xb8')]}});})[_0x7b7f('0x18')](function(_0x429744){socket[_0x7b7f('0xc5')](_0x7b7f('0xc6'),{'id':Number(_0x467e16['params']['id']),'tags':_0x429744||[]});return{'id':Number(_0x467e16[_0x7b7f('0xb4')]['id']),'tags':_0x429744||[]};});}})[_0x7b7f('0x18')](respondWithResult(_0x51edf1,null))[_0x7b7f('0x29')](handleError(_0x51edf1,null));};exports[_0x7b7f('0xc7')]=function(_0x12ed79,_0x2c0471){return db[_0x7b7f('0x2a')]['find']({'where':{'id':_0x12ed79[_0x7b7f('0xb4')]['id']}})[_0x7b7f('0x18')](handleEntityNotFound(_0x2c0471,null))[_0x7b7f('0x18')](function(_0x407314){if(_0x407314){return _0x407314[_0x7b7f('0xc7')](_0x12ed79[_0x7b7f('0x30')][_0x7b7f('0xb8')]);}})['then'](respondWithStatusCode(_0x2c0471,null))[_0x7b7f('0x29')](handleError(_0x2c0471,null));};exports[_0x7b7f('0xc8')]=function(_0x5a4a5b,_0x3a6621){var _0x1bbc1a=moment()['unix']()['toString']();var _0x3891b9=path[_0x7b7f('0xc9')](config['root'],'server',_0x7b7f('0xca'),_0x7b7f('0xcb'));var _0x2ea8ea=path['join'](config[_0x7b7f('0xcc')],'server',_0x7b7f('0xca'),_0x7b7f('0xcd'));var _0x302109=path[_0x7b7f('0xc9')](_0x3891b9,_0x1bbc1a);var _0x5d22d2=util[_0x7b7f('0xbb')](_0x7b7f('0xce'),_0x5a4a5b[_0x7b7f('0xb4')]['id'],_0x1bbc1a);var _0x3908a2=path[_0x7b7f('0xc9')](_0x3891b9,_0x5d22d2);var _0xcab63c=[];if(_0x5a4a5b[_0x7b7f('0x30')][_0x7b7f('0xcd')]){_0xcab63c['push']({'model':db[_0x7b7f('0xcf')],'as':_0x7b7f('0xd0'),'raw':!![]});}var _0x345a5a=[{'model':db['MailMessage'],'as':_0x7b7f('0xd1'),'attributes':['id',_0x7b7f('0xb2'),_0x7b7f('0x3f'),'to','cc',_0x7b7f('0xd2'),_0x7b7f('0xd3'),'createdAt'],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0xcab63c}];return db[_0x7b7f('0x2a')][_0x7b7f('0x53')]({'where':{'id':_0x5a4a5b['params']['id']},'include':_0x345a5a})[_0x7b7f('0x18')](handleEntityNotFound(_0x3a6621,null))[_0x7b7f('0x18')](function(_0x1ee986){if(_0x1ee986&&_0x1ee986[_0x7b7f('0xd1')]){var _0x583b2d=_0x1ee986[_0x7b7f('0xd4')]({'plain':!![]});fs[_0x7b7f('0xd5')](_0x302109);return BPromise[_0x7b7f('0xd6')](_0x583b2d[_0x7b7f('0xd1')],function(_0x2318b4,_0x598fc5){var _0x38406d={'from':_0x2318b4['from'],'to':_0x2318b4['to'],'subject':_0x2318b4[_0x7b7f('0xd3')],'html':htmlEntities[_0x7b7f('0xd7')](_0x2318b4[_0x7b7f('0xb2')]),'headers':{'Date':moment(_0x2318b4[_0x7b7f('0x6b')])['format'](_0x7b7f('0xd8'))},'attachments':[]};if(_0x2318b4['cc']){_0x38406d['headers']['Cc']=_0x2318b4['cc'];}if(_0x2318b4[_0x7b7f('0xd2')]){_0x38406d[_0x7b7f('0xd9')][_0x7b7f('0xda')]=_0x2318b4[_0x7b7f('0xd2')];}return new BPromise(function(_0x1ce930,_0x113d20){if(_0x2318b4[_0x7b7f('0xd0')]){for(var _0x56310b=0x0;_0x56310b<_0x2318b4[_0x7b7f('0xd0')]['length'];_0x56310b++){var _0xdb6862=_0x2318b4[_0x7b7f('0xd0')][_0x56310b];var _0x2b6958=path[_0x7b7f('0xc9')](_0x2ea8ea,_0xdb6862[_0x7b7f('0xdb')]);if(fs[_0x7b7f('0xdc')](_0x2b6958)){_0x38406d[_0x7b7f('0xcd')][_0x7b7f('0xdd')]({'name':_0xdb6862[_0x7b7f('0x1b')],'contentType':_0xdb6862[_0x7b7f('0x2d')],'data':fs[_0x7b7f('0xde')](_0x2b6958)});}}}emlformat[_0x7b7f('0xdf')](_0x38406d,function(_0x4488bb,_0x3e2fd6){if(_0x4488bb)return _0x113d20(_0x4488bb);fs[_0x7b7f('0xe0')](path['join'](_0x302109,util[_0x7b7f('0xbb')]('message%d.eml',_0x598fc5)),_0x3e2fd6);return _0x1ce930(_0x3e2fd6);});});})[_0x7b7f('0x18')](function(){return new BPromise(function(_0x3d551e,_0x117da4){zipdir(_0x302109,{'saveTo':_0x3908a2},function(_0x5daea5,_0x105db1){if(_0x5daea5)return _0x117da4(_0x5daea5);return _0x3d551e(_0x105db1);});})[_0x7b7f('0x18')](function(){return new BPromise(function(_0x3c4f06,_0x465894){rimraf(_0x302109,function(_0x3e095f){if(_0x3e095f)_0x465894(_0x3e095f);return _0x3c4f06();});});})['then'](function(){return _0x3a6621['download'](_0x3908a2,_0x5d22d2,function(_0x22464b){if(!_0x22464b)fs[_0x7b7f('0xe1')](_0x3908a2);});});});}else{return _0x3a6621[_0x7b7f('0xf')](0xc8);}})[_0x7b7f('0x29')](handleError(_0x3a6621,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 83f7dc3..599eca9 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 _0x002a=['setMaxListeners','save','update','remove','getUsers','Users','map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','MailMessage'];(function(_0x59d1fb,_0x39ed2d){var _0x37ab20=function(_0x5c955e){while(--_0x5c955e){_0x59d1fb['push'](_0x59d1fb['shift']());}};_0x37ab20(++_0x39ed2d);}(_0x002a,0x130));var _0xa002=function(_0x4ee602,_0x3c24e3){_0x4ee602=_0x4ee602-0x0;var _0x39c747=_0x002a[_0x4ee602];return _0x39c747;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db']['MailInteraction'];var MailMessage=require(_0xa002('0x0'))['db'][_0xa002('0x1')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xa002('0x2')](0x0);var events={'afterCreate':_0xa002('0x3'),'afterUpdate':_0xa002('0x4'),'afterDestroy':_0xa002('0x5')};function emitEvent(_0x5982d3){return function(_0x10735f,_0x196d07,_0x394186){_0x10735f[_0xa002('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0xbef3c3){_0x10735f['setDataValue'](_0xa002('0x7'),_0xbef3c3[_0xa002('0x8')](function(_0x1540df){return{'id':_0x1540df['id']};}));return MailMessage[_0xa002('0x9')]({'where':{'MailInteractionId':_0x10735f['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa002('0xa')](function(_0x3bd83a){_0x10735f['setDataValue'](_0xa002('0xb'),_0x3bd83a[_0xa002('0xc')]);MailInteractionEvents[_0xa002('0xd')](_0x5982d3+':'+_0x10735f['id'],_0x10735f);MailInteractionEvents['emit'](_0x5982d3,_0x10735f);_0x394186(null);})[_0xa002('0xe')](_0x394186(null));};}for(var e in events){if(events[_0xa002('0xf')](e)){var event=events[e];MailInteraction[_0xa002('0x10')](e,emitEvent(event));}}module[_0xa002('0x11')]=MailInteractionEvents; \ No newline at end of file +var _0x352d=['save','update','remove','then','map','findAll','setDataValue','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction'];(function(_0x1e74c5,_0x3ddf77){var _0x30f177=function(_0x324979){while(--_0x324979){_0x1e74c5['push'](_0x1e74c5['shift']());}};_0x30f177(++_0x3ddf77);}(_0x352d,0x1e7));var _0xd352=function(_0xdfd458,_0x33c838){_0xdfd458=_0xdfd458-0x0;var _0x269ee4=_0x352d[_0xdfd458];return _0x269ee4;};'use strict';var EventEmitter=require(_0xd352('0x0'));var MailInteraction=require(_0xd352('0x1'))['db'][_0xd352('0x2')];var MailMessage=require(_0xd352('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd352('0x3'),'afterUpdate':_0xd352('0x4'),'afterDestroy':_0xd352('0x5')};function emitEvent(_0x5b5bdb){return function(_0x1d9d59,_0x6840a8,_0x236e39){_0x1d9d59['getUsers']({'attributes':['id'],'raw':!![]})[_0xd352('0x6')](function(_0x5d1c6e){_0x1d9d59['setDataValue']('Users',_0x5d1c6e[_0xd352('0x7')](function(_0x391f91){return{'id':_0x391f91['id']};}));return MailMessage[_0xd352('0x8')]({'where':{'MailInteractionId':_0x1d9d59['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd352('0x6')](function(_0x319076){_0x1d9d59[_0xd352('0x9')]('unreadMessages',_0x319076['length']);MailInteractionEvents['emit'](_0x5b5bdb+':'+_0x1d9d59['id'],_0x1d9d59);MailInteractionEvents[_0xd352('0xa')](_0x5b5bdb,_0x1d9d59);_0x236e39(null);})['catch'](_0x236e39(null));};}for(var e in events){if(events[_0xd352('0xb')](e)){var event=events[e];MailInteraction[_0xd352('0xc')](e,emitEvent(event));}}module[_0xd352('0xd')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 510bdef..231d1c2 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 _0x75ed=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closedAt','format','changed','closed','models','get','MailMessage','update','catch'];(function(_0x4dd656,_0x1dba9a){var _0x4217b3=function(_0x5d7c8c){while(--_0x5d7c8c){_0x4dd656['push'](_0x4dd656['shift']());}};_0x4217b3(++_0x1dba9a);}(_0x75ed,0x188));var _0xd75e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x75ed[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xd75e('0x0'));var util=require(_0xd75e('0x1'));var logger=require(_0xd75e('0x2'))(_0xd75e('0x3'));var moment=require(_0xd75e('0x4'));var BPromise=require('bluebird');var rp=require(_0xd75e('0x5'));var fs=require('fs');var path=require(_0xd75e('0x6'));var rimraf=require(_0xd75e('0x7'));var config=require(_0xd75e('0x8'));var attributes=require(_0xd75e('0x9'));module[_0xd75e('0xa')]=function(_0x3052da,_0x12da4e){return _0x3052da['define'](_0xd75e('0xb'),attributes,{'tableName':_0xd75e('0xc'),'paranoid':![],'indexes':[{'name':_0xd75e('0xd'),'fields':[_0xd75e('0xe'),'to'],'type':_0xd75e('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1bcb77,_0x25ba42,_0x5a6690){if(_0x1bcb77[_0xd75e('0x10')]){_0x1bcb77[_0xd75e('0x11')]=moment()['format'](_0xd75e('0x12'));}if(_0x1bcb77['closed']){_0x1bcb77[_0xd75e('0x13')]=moment()[_0xd75e('0x14')](_0xd75e('0x12'));}_0x5a6690(null,_0x25ba42);},'beforeUpdate':function(_0x5be1b6,_0x2e23b0,_0x2b79e6){if(_0x5be1b6[_0xd75e('0x15')](_0xd75e('0x10'))){_0x5be1b6[_0xd75e('0x11')]=_0x5be1b6[_0xd75e('0x10')]?moment()[_0xd75e('0x14')](_0xd75e('0x12')):null;}if(_0x5be1b6[_0xd75e('0x15')](_0xd75e('0x16'))){_0x5be1b6['closedAt']=moment()[_0xd75e('0x14')](_0xd75e('0x12'));_0x5be1b6[_0xd75e('0x10')]=null;_0x5be1b6[_0xd75e('0x11')]=null;}_0x2b79e6(null,_0x5be1b6);},'afterUpdate':function(_0x4bd3df,_0x3131a6,_0x534293){var _0x30004c=_0x3052da[_0xd75e('0x17')];var _0x48b951=_0x4bd3df[_0xd75e('0x18')]({'plain':!![]});if(_0x48b951['closed']){return _0x30004c[_0xd75e('0x19')][_0xd75e('0x1a')]({'read':!![]},{'where':{'MailInteractionId':_0x48b951['id']}})['then'](function(){_0x534293();})[_0xd75e('0x1b')](function(_0x29d627){_0x534293(_0x29d627);});}else{_0x534293();}}},'charset':_0xd75e('0x1c'),'collate':_0xd75e('0x1d')});}; \ No newline at end of file +var _0x88cc=['closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','get','MailMessage','catch','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','closed'];(function(_0x4f7897,_0x3ecf30){var _0x313c70=function(_0x1b4d48){while(--_0x1b4d48){_0x4f7897['push'](_0x4f7897['shift']());}};_0x313c70(++_0x3ecf30);}(_0x88cc,0x1c8));var _0xc88c=function(_0x113c43,_0x171537){_0x113c43=_0x113c43-0x0;var _0x25a1ac=_0x88cc[_0x113c43];return _0x25a1ac;};'use strict';var _=require('lodash');var util=require(_0xc88c('0x0'));var logger=require(_0xc88c('0x1'))(_0xc88c('0x2'));var moment=require(_0xc88c('0x3'));var BPromise=require(_0xc88c('0x4'));var rp=require(_0xc88c('0x5'));var fs=require('fs');var path=require(_0xc88c('0x6'));var rimraf=require(_0xc88c('0x7'));var config=require(_0xc88c('0x8'));var attributes=require(_0xc88c('0x9'));module[_0xc88c('0xa')]=function(_0x271fc5,_0x79aaa2){return _0x271fc5[_0xc88c('0xb')](_0xc88c('0xc'),attributes,{'tableName':_0xc88c('0xd'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0xc88c('0xe'),'to'],'type':_0xc88c('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x11db45,_0x54ab8c,_0x46266f){if(_0x11db45[_0xc88c('0x10')]){_0x11db45[_0xc88c('0x11')]=moment()[_0xc88c('0x12')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x11db45[_0xc88c('0x13')]){_0x11db45[_0xc88c('0x14')]=moment()[_0xc88c('0x12')](_0xc88c('0x15'));}_0x46266f(null,_0x54ab8c);},'beforeUpdate':function(_0x600202,_0x5720b1,_0x521450){if(_0x600202['changed'](_0xc88c('0x10'))){_0x600202[_0xc88c('0x11')]=_0x600202[_0xc88c('0x10')]?moment()[_0xc88c('0x12')](_0xc88c('0x15')):null;}if(_0x600202[_0xc88c('0x16')](_0xc88c('0x13'))){_0x600202['closedAt']=moment()[_0xc88c('0x12')](_0xc88c('0x15'));_0x600202[_0xc88c('0x10')]=null;_0x600202['substatusAt']=null;}_0x521450(null,_0x600202);},'afterUpdate':function(_0x250b80,_0x569f93,_0x50eedf){var _0x58148c=_0x271fc5['models'];var _0x13f059=_0x250b80[_0xc88c('0x17')]({'plain':!![]});if(_0x13f059['closed']){return _0x58148c[_0xc88c('0x18')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x13f059['id']}})['then'](function(){_0x50eedf();})[_0xc88c('0x19')](function(_0x4324e3){_0x50eedf(_0x4324e3);});}else{_0x50eedf();}}},'charset':_0xc88c('0x1a'),'collate':_0xc88c('0x1b')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 56e0f22..3b50c58 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 _0xe774=['where','addTags','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UpdateMailInteraction','update','body','options','attributes','limit','then','AddTagsToMailInteraction','find'];(function(_0x54d301,_0x1bea35){var _0x546df7=function(_0x3d09ec){while(--_0x3d09ec){_0x54d301['push'](_0x54d301['shift']());}};_0x546df7(++_0x1bea35);}(_0xe774,0x135));var _0x4e77=function(_0xc30612,_0x5387bb){_0xc30612=_0xc30612-0x0;var _0x318ec5=_0xe774[_0xc30612];return _0x318ec5;};'use strict';var _=require(_0x4e77('0x0'));var util=require(_0x4e77('0x1'));var moment=require(_0x4e77('0x2'));var BPromise=require('bluebird');var rs=require(_0x4e77('0x3'));var fs=require('fs');var Redis=require(_0x4e77('0x4'));var db=require(_0x4e77('0x5'))['db'];var utils=require(_0x4e77('0x6'));var logger=require(_0x4e77('0x7'))(_0x4e77('0x8'));var config=require(_0x4e77('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4e77('0xa')][_0x4e77('0xb')]({'port':0x232a});config[_0x4e77('0xc')]=_['defaults'](config['redis'],{'host':_0x4e77('0xd'),'port':0x18eb});var socket=require(_0x4e77('0xe'))(new Redis(config[_0x4e77('0xc')]));require('./mailInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x948797,_0x2519ed,_0x5027f4){return new BPromise(function(_0x216add,_0x56312c){return client['request'](_0x948797,_0x5027f4)['then'](function(_0x3d3bcc){logger[_0x4e77('0xf')](_0x4e77('0x10'),_0x2519ed,_0x4e77('0x11'));logger[_0x4e77('0x12')](_0x4e77('0x13'),_0x2519ed,'request\x20sent',JSON[_0x4e77('0x14')](_0x3d3bcc));if(_0x3d3bcc[_0x4e77('0x15')]){if(_0x3d3bcc[_0x4e77('0x15')][_0x4e77('0x16')]===0x1f4){logger[_0x4e77('0x15')](_0x4e77('0x10'),_0x2519ed,_0x3d3bcc[_0x4e77('0x15')][_0x4e77('0x17')]);return _0x56312c(_0x3d3bcc[_0x4e77('0x15')][_0x4e77('0x17')]);}logger[_0x4e77('0x15')]('MailInteraction,\x20%s,\x20%s',_0x2519ed,_0x3d3bcc[_0x4e77('0x15')][_0x4e77('0x17')]);return _0x216add(_0x3d3bcc['error'][_0x4e77('0x17')]);}else{logger[_0x4e77('0xf')](_0x4e77('0x10'),_0x2519ed,_0x4e77('0x11'));_0x216add(_0x3d3bcc['result'][_0x4e77('0x17')]);}})['catch'](function(_0x318993){logger[_0x4e77('0x15')](_0x4e77('0x10'),_0x2519ed,_0x318993);_0x56312c(_0x318993);});});}exports[_0x4e77('0x18')]=function(_0x468d59){var _0x11bfe5=this;return new Promise(function(_0x3e58e5,_0xd68760){return db['MailInteraction'][_0x4e77('0x19')](_0x468d59[_0x4e77('0x1a')],{'raw':_0x468d59[_0x4e77('0x1b')]?_0x468d59[_0x4e77('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x468d59[_0x4e77('0x1b')]?_0x468d59[_0x4e77('0x1b')]['where']||null:null,'attributes':_0x468d59[_0x4e77('0x1b')]?_0x468d59[_0x4e77('0x1b')][_0x4e77('0x1c')]||null:null,'limit':_0x468d59[_0x4e77('0x1b')]?_0x468d59[_0x4e77('0x1b')][_0x4e77('0x1d')]||null:null})[_0x4e77('0x1e')](function(_0x11f1ef){logger['info']('UpdateMailInteraction',_0x468d59);logger[_0x4e77('0x12')](_0x4e77('0x18'),_0x468d59,JSON[_0x4e77('0x14')](_0x11f1ef));_0x3e58e5(_0x11f1ef);})['catch'](function(_0x3360de){logger['error'](_0x4e77('0x18'),_0x3360de['message'],_0x468d59);_0xd68760(_0x11bfe5['error'](0x1f4,_0x3360de[_0x4e77('0x17')]));});});};exports[_0x4e77('0x1f')]=function(_0x76a51e){return new Promise(function(_0x25e86f,_0x4a32d8){return db['MailInteraction'][_0x4e77('0x20')]({'where':_0x76a51e[_0x4e77('0x1b')]?_0x76a51e[_0x4e77('0x1b')][_0x4e77('0x21')]||null:null})['then'](function(_0x17acc4){if(_0x17acc4){return _0x17acc4[_0x4e77('0x22')](_0x76a51e[_0x4e77('0x1a')]['ids'],_[_0x4e77('0x23')](_0x76a51e['body'],['ids','id'])||{});}})[_0x4e77('0x24')](function(_0x29affe){logger[_0x4e77('0xf')](_0x4e77('0x25'),_0x76a51e);logger[_0x4e77('0x12')](_0x4e77('0x25'),_0x76a51e,JSON[_0x4e77('0x14')](_0x29affe));_0x25e86f(_0x29affe);})['catch'](function(_0x22d351){logger[_0x4e77('0x15')](_0x4e77('0x25'),_0x22d351[_0x4e77('0x17')],_0x76a51e);_0x4a32d8(_this[_0x4e77('0x15')](0x1f4,_0x22d351[_0x4e77('0x17')]));});});}; \ No newline at end of file +var _0x31f0=['../../config/environment','redis','localhost','socket.io-emitter','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailInteraction','update','body','options','where','limit','MailInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x56a631,_0x171ebd){var _0x9462fb=function(_0x3630d1){while(--_0x3630d1){_0x56a631['push'](_0x56a631['shift']());}};_0x9462fb(++_0x171ebd);}(_0x31f0,0xb7));var _0x031f=function(_0x2ffb5b,_0x3373d9){_0x2ffb5b=_0x2ffb5b-0x0;var _0x545ed7=_0x31f0[_0x2ffb5b];return _0x545ed7;};'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});config[_0x031f('0x8')]=_['defaults'](config[_0x031f('0x8')],{'host':_0x031f('0x9'),'port':0x18eb});var socket=require(_0x031f('0xa'))(new Redis(config[_0x031f('0x8')]));require('./mailInteraction.socket')[_0x031f('0xb')](socket);function respondWithRpcPromise(_0x24145f,_0x327f11,_0x439940){return new BPromise(function(_0x3dd729,_0x3b0a17){return client[_0x031f('0xc')](_0x24145f,_0x439940)[_0x031f('0xd')](function(_0x4df318){logger[_0x031f('0xe')](_0x031f('0xf'),_0x327f11,_0x031f('0x10'));logger[_0x031f('0x11')](_0x031f('0x12'),_0x327f11,_0x031f('0x10'),JSON[_0x031f('0x13')](_0x4df318));if(_0x4df318['error']){if(_0x4df318[_0x031f('0x14')][_0x031f('0x15')]===0x1f4){logger[_0x031f('0x14')](_0x031f('0xf'),_0x327f11,_0x4df318[_0x031f('0x14')]['message']);return _0x3b0a17(_0x4df318['error'][_0x031f('0x16')]);}logger[_0x031f('0x14')](_0x031f('0xf'),_0x327f11,_0x4df318[_0x031f('0x14')]['message']);return _0x3dd729(_0x4df318[_0x031f('0x14')][_0x031f('0x16')]);}else{logger['info'](_0x031f('0xf'),_0x327f11,'request\x20sent');_0x3dd729(_0x4df318[_0x031f('0x17')][_0x031f('0x16')]);}})[_0x031f('0x18')](function(_0xaa155){logger[_0x031f('0x14')](_0x031f('0xf'),_0x327f11,_0xaa155);_0x3b0a17(_0xaa155);});});}exports[_0x031f('0x19')]=function(_0x2825ef){var _0xf76f1b=this;return new Promise(function(_0x345bde,_0x29dd6e){return db['MailInteraction'][_0x031f('0x1a')](_0x2825ef[_0x031f('0x1b')],{'raw':_0x2825ef[_0x031f('0x1c')]?_0x2825ef['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2825ef[_0x031f('0x1c')]?_0x2825ef['options'][_0x031f('0x1d')]||null:null,'attributes':_0x2825ef['options']?_0x2825ef['options']['attributes']||null:null,'limit':_0x2825ef[_0x031f('0x1c')]?_0x2825ef[_0x031f('0x1c')][_0x031f('0x1e')]||null:null})[_0x031f('0xd')](function(_0x494568){logger[_0x031f('0xe')]('UpdateMailInteraction',_0x2825ef);logger[_0x031f('0x11')](_0x031f('0x19'),_0x2825ef,JSON[_0x031f('0x13')](_0x494568));_0x345bde(_0x494568);})['catch'](function(_0x35af16){logger[_0x031f('0x14')]('UpdateMailInteraction',_0x35af16[_0x031f('0x16')],_0x2825ef);_0x29dd6e(_0xf76f1b[_0x031f('0x14')](0x1f4,_0x35af16[_0x031f('0x16')]));});});};exports['AddTagsToMailInteraction']=function(_0xa308b){return new Promise(function(_0x114e34,_0xb6ed6c){return db[_0x031f('0x1f')][_0x031f('0x20')]({'where':_0xa308b[_0x031f('0x1c')]?_0xa308b['options'][_0x031f('0x1d')]||null:null})[_0x031f('0xd')](function(_0x34f249){if(_0x34f249){return _0x34f249[_0x031f('0x21')](_0xa308b[_0x031f('0x1b')][_0x031f('0x22')],_[_0x031f('0x23')](_0xa308b[_0x031f('0x1b')],[_0x031f('0x22'),'id'])||{});}})[_0x031f('0x24')](function(_0x2cf3a8){logger['info'](_0x031f('0x25'),_0xa308b);logger[_0x031f('0x11')](_0x031f('0x25'),_0xa308b,JSON[_0x031f('0x13')](_0x2cf3a8));_0x114e34(_0x2cf3a8);})[_0x031f('0x18')](function(_0xb774cf){logger[_0x031f('0x14')](_0x031f('0x25'),_0xb774cf[_0x031f('0x16')],_0xa308b);_0xb6ed6c(_this[_0x031f('0x14')](0x1f4,_0xb774cf[_0x031f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 83f8c92..53783ed 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 _0xa5a5=['register','mailInteraction:','update'];(function(_0x59ff09,_0x6f9e1){var _0x4f5dab=function(_0x4f011a){while(--_0x4f011a){_0x59ff09['push'](_0x59ff09['shift']());}};_0x4f5dab(++_0x6f9e1);}(_0xa5a5,0x173));var _0x5a5a=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xa5a5[_0x4f9b18];return _0x29f20c;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=['save','remove',_0x5a5a('0x0')];function createListener(_0x519ba6,_0x2f84b3){return function(_0x50d0a6){_0x2f84b3['emit'](_0x519ba6,_0x50d0a6);};}function removeListener(_0x1eb73a,_0x237c52){return function(){MailInteractionEvents['removeListener'](_0x1eb73a,_0x237c52);};}exports[_0x5a5a('0x1')]=function(_0x4daf09){for(var _0x1e58f4=0x0,_0x4be37e=events['length'];_0x1e58f4<_0x4be37e;_0x1e58f4++){var _0x43ae9f=events[_0x1e58f4];var _0x33189c=createListener(_0x5a5a('0x2')+_0x43ae9f,_0x4daf09);MailInteractionEvents['on'](_0x43ae9f,_0x33189c);}}; \ No newline at end of file +var _0x4583=['mailInteraction:','./mailInteraction.events','remove','register'];(function(_0x37a4cc,_0x1531a8){var _0x4ffbbf=function(_0x5d7be5){while(--_0x5d7be5){_0x37a4cc['push'](_0x37a4cc['shift']());}};_0x4ffbbf(++_0x1531a8);}(_0x4583,0xfd));var _0x3458=function(_0x4ac25d,_0x75e6cd){_0x4ac25d=_0x4ac25d-0x0;var _0x1a0ead=_0x4583[_0x4ac25d];return _0x1a0ead;};'use strict';var MailInteractionEvents=require(_0x3458('0x0'));var events=['save',_0x3458('0x1'),'update'];function createListener(_0x170aea,_0x3102b3){return function(_0x412eff){_0x3102b3['emit'](_0x170aea,_0x412eff);};}function removeListener(_0x43b55a,_0x54ff1d){return function(){MailInteractionEvents['removeListener'](_0x43b55a,_0x54ff1d);};}exports[_0x3458('0x2')]=function(_0x32656a){for(var _0xbc1cbe=0x0,_0x2d36e2=events['length'];_0xbc1cbe<_0x2d36e2;_0xbc1cbe++){var _0x26218a=events[_0xbc1cbe];var _0x1a4066=createListener(_0x3458('0x3')+_0x26218a,_0x32656a);MailInteractionEvents['on'](_0x26218a,_0x1a4066);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 6e2e135..085b42b 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 _0x2242=['../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','post','tracked','create','put','/:id/accept','/:id/reject','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2242,0x1a3));var _0x2224=function(_0x572ab7,_0x2bdfb1){_0x572ab7=_0x572ab7-0x0;var _0x174a7c=_0x2242[_0x572ab7];return _0x174a7c;};'use strict';var multer=require(_0x2224('0x0'));var util=require(_0x2224('0x1'));var path=require(_0x2224('0x2'));var timeout=require('connect-timeout');var express=require(_0x2224('0x3'));var router=express[_0x2224('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2224('0x5'));var interaction=require(_0x2224('0x6'));var config=require('../../config/environment');var controller=require(_0x2224('0x7'));router[_0x2224('0x8')]('/',auth[_0x2224('0x9')](),controller['index']);router[_0x2224('0x8')](_0x2224('0xa'),auth[_0x2224('0x9')](),controller[_0x2224('0xb')]);router[_0x2224('0x8')](_0x2224('0xc'),auth[_0x2224('0x9')](),controller[_0x2224('0xd')]);router[_0x2224('0x8')](_0x2224('0xe'),auth[_0x2224('0x9')](),controller[_0x2224('0xf')]);router[_0x2224('0x10')]('/',auth[_0x2224('0x9')](),interaction[_0x2224('0x11')]('mail','mailmessage:create'),controller[_0x2224('0x12')]);router[_0x2224('0x13')](_0x2224('0xc'),auth[_0x2224('0x9')](),controller['update']);router[_0x2224('0x13')](_0x2224('0x14'),auth['isAuthenticated'](),controller['accept']);router[_0x2224('0x13')](_0x2224('0x15'),auth['isAuthenticated'](),controller['reject']);router[_0x2224('0x16')](_0x2224('0xc'),auth[_0x2224('0x9')](),controller[_0x2224('0x17')]);module[_0x2224('0x18')]=router; \ No newline at end of file +var _0x8b6f=['connect-timeout','Router','fs-extra','../../components/auth/service','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','tracked','mail','create','put','update','accept','/:id/reject','delete','destroy','multer','util','path'];(function(_0x1fadc7,_0x112730){var _0x5885ac=function(_0x10302e){while(--_0x10302e){_0x1fadc7['push'](_0x1fadc7['shift']());}};_0x5885ac(++_0x112730);}(_0x8b6f,0x177));var _0xf8b6=function(_0x116f37,_0x13d9ae){_0x116f37=_0x116f37-0x0;var _0x52d6fa=_0x8b6f[_0x116f37];return _0x52d6fa;};'use strict';var multer=require(_0xf8b6('0x0'));var util=require(_0xf8b6('0x1'));var path=require(_0xf8b6('0x2'));var timeout=require(_0xf8b6('0x3'));var express=require('express');var router=express[_0xf8b6('0x4')]();var fs_extra=require(_0xf8b6('0x5'));var auth=require(_0xf8b6('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf8b6('0x7'));router[_0xf8b6('0x8')]('/',auth[_0xf8b6('0x9')](),controller[_0xf8b6('0xa')]);router[_0xf8b6('0x8')](_0xf8b6('0xb'),auth[_0xf8b6('0x9')](),controller[_0xf8b6('0xc')]);router[_0xf8b6('0x8')](_0xf8b6('0xd'),auth[_0xf8b6('0x9')](),controller[_0xf8b6('0xe')]);router[_0xf8b6('0x8')](_0xf8b6('0xf'),auth[_0xf8b6('0x9')](),controller[_0xf8b6('0x10')]);router[_0xf8b6('0x11')]('/',auth[_0xf8b6('0x9')](),interaction[_0xf8b6('0x12')](_0xf8b6('0x13'),'mailmessage:create'),controller[_0xf8b6('0x14')]);router[_0xf8b6('0x15')]('/:id',auth[_0xf8b6('0x9')](),controller[_0xf8b6('0x16')]);router['put']('/:id/accept',auth[_0xf8b6('0x9')](),controller[_0xf8b6('0x17')]);router[_0xf8b6('0x15')](_0xf8b6('0x18'),auth[_0xf8b6('0x9')](),controller['reject']);router[_0xf8b6('0x19')]('/:id',auth['isAuthenticated'](),controller[_0xf8b6('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 366f294..9bcb8c9 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 _0x77d3=['out','STRING','long','DATE','INTEGER','Chat','Email','sequelize','exports','TEXT','medium','ENUM'];(function(_0x38786d,_0x39d47e){var _0x5053fc=function(_0x1a30df){while(--_0x1a30df){_0x38786d['push'](_0x38786d['shift']());}};_0x5053fc(++_0x39d47e);}(_0x77d3,0x1f3));var _0x377d=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x77d3[_0x2ec461];return _0x28603d;};'use strict';var Sequelize=require(_0x377d('0x0'));var _=require('lodash');module[_0x377d('0x1')]={'body':{'type':Sequelize[_0x377d('0x2')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x377d('0x3'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x377d('0x4')]('in',_0x377d('0x5')),'defaultValue':_0x377d('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x377d('0x6')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x377d('0x2')](_0x377d('0x7'))},'cc':{'type':Sequelize[_0x377d('0x2')](_0x377d('0x7'))},'bcc':{'type':Sequelize[_0x377d('0x2')]('long')},'subject':{'type':Sequelize[_0x377d('0x2')]},'sentAt':{'type':Sequelize[_0x377d('0x8')]},'attach':{'type':Sequelize[_0x377d('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x377d('0x8')]},'originTo':{'type':Sequelize['TEXT'](_0x377d('0x7'))},'originCc':{'type':Sequelize['TEXT'](_0x377d('0x7'))},'originChannel':{'type':Sequelize['ENUM']('Email',_0x377d('0xa')),'defaultValue':_0x377d('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0x370b=['Email','sequelize','lodash','exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x370b,0xaa));var _0xb370=function(_0xc9a40a,_0x99c66a){_0xc9a40a=_0xc9a40a-0x0;var _0x5e4f34=_0x370b[_0xc9a40a];return _0x5e4f34;};'use strict';var Sequelize=require(_0xb370('0x0'));var _=require(_0xb370('0x1'));module[_0xb370('0x2')]={'body':{'type':Sequelize[_0xb370('0x3')](_0xb370('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xb370('0x3')](_0xb370('0x5'))},'read':{'type':Sequelize[_0xb370('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb370('0x7')]('in',_0xb370('0x8')),'defaultValue':_0xb370('0x8'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0xb370('0x9')]},'to':{'type':Sequelize[_0xb370('0x3')]('long')},'cc':{'type':Sequelize[_0xb370('0x3')](_0xb370('0x4'))},'bcc':{'type':Sequelize[_0xb370('0x3')](_0xb370('0x4'))},'subject':{'type':Sequelize[_0xb370('0x3')]},'sentAt':{'type':Sequelize[_0xb370('0xa')]},'attach':{'type':Sequelize[_0xb370('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0xb370('0xa')]},'originTo':{'type':Sequelize[_0xb370('0x3')](_0xb370('0x4'))},'originCc':{'type':Sequelize[_0xb370('0x3')](_0xb370('0x4'))},'originChannel':{'type':Sequelize[_0xb370('0x7')](_0xb370('0xc'),'Chat'),'defaultValue':_0xb370('0xc'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 6588094..f87dc5c 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 _0x747b=['MailInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','fromString','acceptmessage','reject','interaction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','sequelize','User','EventManager','rejectmessage','download','unix','toString','join','root','server','files','tmp','message-%s.eml','from','bcc','subject','Attachment','decode','createdAt','headers','Bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','path','lodash','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','status','json','offset','undefined','limit','count','set','update','then','destroy','end','sendStatus','stack','name','send','index','MailMessage','fieldName','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','map','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','body','describe','create','direction','out','secret','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','server/files/attachments','ListId','List\x20not\x20found','SendMail','accept','mail','read','readAt','format','UserId','agent','get','MailInteraction'];(function(_0x26cdd8,_0x3c3136){var _0x4687aa=function(_0x58aa46){while(--_0x58aa46){_0x26cdd8['push'](_0x26cdd8['shift']());}};_0x4687aa(++_0x3c3136);}(_0x747b,0xe2));var _0xb747=function(_0x4f21c4,_0x960024){_0x4f21c4=_0x4f21c4-0x0;var _0x2f9fa6=_0x747b[_0x4f21c4];return _0x2f9fa6;};'use strict';var emlformat=require(_0xb747('0x0'));var moment=require(_0xb747('0x1'));var BPromise=require(_0xb747('0x2'));var util=require(_0xb747('0x3'));var path=require(_0xb747('0x4'));var fs=require('fs');var _=require(_0xb747('0x5'));var Redis=require('ioredis');var htmlToText=require(_0xb747('0x6'));var qs=require(_0xb747('0x7'));var logger=require(_0xb747('0x8'))(_0xb747('0x9'));var interaction_log=require(_0xb747('0x8'))(_0xb747('0xa'));var config=require(_0xb747('0xb'));var db=require('../../mysqldb')['db'];config[_0xb747('0xc')]=_[_0xb747('0xd')](config['redis'],{'host':_0xb747('0xe'),'port':0x18eb});var socket=require(_0xb747('0xf'))(new Redis(config[_0xb747('0xc')]));var htmlEntities=require(_0xb747('0x10'));require(_0xb747('0x11'))[_0xb747('0x12')](socket);var jayson=require(_0xb747('0x13'));var client=jayson[_0xb747('0x14')][_0xb747('0x15')]({'port':0x232c});var client9003=jayson[_0xb747('0x14')][_0xb747('0x15')]({'port':0x232b});var client9002=jayson[_0xb747('0x14')][_0xb747('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x5e74b6,_0x36262e,_0x4b9c02,_0x2e82bd){return new BPromise(function(_0xbdda68,_0x27ce79){var _0x43603f=_0x2e82bd||client;return _0x43603f['request'](_0x5e74b6,_0x4b9c02)['then'](function(_0x3c62b7){logger[_0xb747('0x16')](_0xb747('0x17'),_0x36262e,'request\x20sent');logger[_0xb747('0x18')](_0xb747('0x19'),_0x36262e,_0xb747('0x1a'),JSON[_0xb747('0x1b')](_0x3c62b7));if(_0x3c62b7[_0xb747('0x1c')]){if(_0x3c62b7['error']['code']===0x1f4){logger[_0xb747('0x1c')](_0xb747('0x17'),_0x36262e,_0x3c62b7[_0xb747('0x1c')][_0xb747('0x1d')]);return _0x27ce79(_0x3c62b7[_0xb747('0x1c')]['message']);}logger['error']('MailMessage,\x20%s,\x20%s',_0x36262e,_0x3c62b7[_0xb747('0x1c')][_0xb747('0x1d')]);return _0xbdda68(_0x3c62b7['error']['message']);}else{logger[_0xb747('0x16')]('MailMessage,\x20%s,\x20%s',_0x36262e,_0xb747('0x1a'));_0xbdda68(_0x3c62b7['result'][_0xb747('0x1d')]);}})['catch'](function(_0x59a765){logger[_0xb747('0x1c')](_0xb747('0x17'),_0x36262e,_0x59a765);_0x27ce79(_0x59a765);});});}function respondWithResult(_0x20273a,_0x512982){_0x512982=_0x512982||0xc8;return function(_0x30225b){if(_0x30225b){return _0x20273a[_0xb747('0x1e')](_0x512982)[_0xb747('0x1f')](_0x30225b);}};}function respondWithFilteredResult(_0x2a6e5e,_0x1fce65){return function(_0x3e36f7){if(_0x3e36f7){var _0x400b04=typeof _0x1fce65[_0xb747('0x20')]===_0xb747('0x21')&&typeof _0x1fce65[_0xb747('0x22')]===_0xb747('0x21');var _0x342740=_0x3e36f7[_0xb747('0x23')];var _0x26cb49=_0x400b04?0x0:_0x1fce65[_0xb747('0x20')];var _0x57abde=_0x400b04?_0x3e36f7[_0xb747('0x23')]:_0x1fce65['offset']+_0x1fce65[_0xb747('0x22')];var _0x5d2622;if(_0x57abde>=_0x342740){_0x57abde=_0x342740;_0x5d2622=0xc8;}else{_0x5d2622=0xce;}_0x2a6e5e['status'](_0x5d2622);return _0x2a6e5e[_0xb747('0x24')]('Content-Range',_0x26cb49+'-'+_0x57abde+'/'+_0x342740)['json'](_0x3e36f7);}return null;};}function saveUpdates(_0xcf1d2f){return function(_0x529273){if(_0x529273){return _0x529273[_0xb747('0x25')](_0xcf1d2f)[_0xb747('0x26')](function(_0x4a3c91){return _0x4a3c91;});}return null;};}function removeEntity(_0x584fc2){return function(_0x2cc053){if(_0x2cc053){return _0x2cc053[_0xb747('0x27')]()[_0xb747('0x26')](function(){_0x584fc2[_0xb747('0x1e')](0xcc)[_0xb747('0x28')]();});}};}function handleEntityNotFound(_0x3375d4){return function(_0xa4d031){if(!_0xa4d031){_0x3375d4[_0xb747('0x29')](0x194);}return _0xa4d031;};}function handleError(_0x47ce1c,_0x7f4300){_0x7f4300=_0x7f4300||0x1f4;return function(_0x43227a){logger[_0xb747('0x1c')](_0x43227a[_0xb747('0x2a')]);if(_0x43227a[_0xb747('0x2b')]){delete _0x43227a['name'];}_0x47ce1c[_0xb747('0x1e')](_0x7f4300)[_0xb747('0x2c')](_0x43227a);};}exports[_0xb747('0x2d')]=function(_0x5e3a56,_0x43bc33){var _0x1dc356={},_0x46cfcc={},_0x5acce8={'count':0x0,'rows':[]};var _0x1b5853=_['map'](db[_0xb747('0x2e')]['rawAttributes'],function(_0x2dba98){return{'name':_0x2dba98[_0xb747('0x2f')],'type':_0x2dba98['type'][_0xb747('0x30')]};});_0x46cfcc['model']=_['map'](_0x1b5853,_0xb747('0x2b'));_0x46cfcc[_0xb747('0x31')]=_[_0xb747('0x32')](_0x5e3a56['query']);_0x46cfcc['filters']=_['intersection'](_0x46cfcc[_0xb747('0x33')],_0x46cfcc['query']);_0x1dc356[_0xb747('0x34')]=_[_0xb747('0x35')](_0x46cfcc[_0xb747('0x33')],qs[_0xb747('0x36')](_0x5e3a56[_0xb747('0x31')]['fields']));_0x1dc356[_0xb747('0x34')]=_0x1dc356[_0xb747('0x34')][_0xb747('0x37')]?_0x1dc356[_0xb747('0x34')]:_0x46cfcc[_0xb747('0x33')];if(!_0x5e3a56['query'][_0xb747('0x38')](_0xb747('0x39'))){_0x1dc356['limit']=qs[_0xb747('0x22')](_0x5e3a56[_0xb747('0x31')]['limit']);_0x1dc356[_0xb747('0x20')]=qs[_0xb747('0x20')](_0x5e3a56[_0xb747('0x31')][_0xb747('0x20')]);}_0x1dc356[_0xb747('0x3a')]=qs[_0xb747('0x3b')](_0x5e3a56['query']['sort']);_0x1dc356['where']=qs[_0xb747('0x3c')](_[_0xb747('0x3d')](_0x5e3a56[_0xb747('0x31')],_0x46cfcc[_0xb747('0x3c')]),_0x1b5853);if(_0x5e3a56['query'][_0xb747('0x3e')]){_0x1dc356[_0xb747('0x3f')]=_[_0xb747('0x40')](_0x1dc356[_0xb747('0x3f')],{'$or':_[_0xb747('0x41')](_0x1b5853,function(_0x2d0516){if(_0x2d0516[_0xb747('0x42')]!==_0xb747('0x43')){var _0x42c4d9={};_0x42c4d9[_0x2d0516[_0xb747('0x2b')]]={'$like':'%'+_0x5e3a56['query'][_0xb747('0x3e')]+'%'};return _0x42c4d9;}})});}_0x1dc356=_['merge']({},_0x1dc356,_0x5e3a56[_0xb747('0x44')]);var _0x16a811={'where':_0x1dc356[_0xb747('0x3f')]};return db[_0xb747('0x2e')][_0xb747('0x23')](_0x16a811)[_0xb747('0x26')](function(_0x2be435){_0x5acce8[_0xb747('0x23')]=_0x2be435;if(_0x5e3a56[_0xb747('0x31')][_0xb747('0x45')]){_0x1dc356[_0xb747('0x46')]=[{'all':!![]}];}return db[_0xb747('0x2e')][_0xb747('0x47')](_0x1dc356);})['then'](function(_0xb34af4){_0x5acce8['rows']=_0xb34af4;return _0x5acce8;})[_0xb747('0x26')](respondWithFilteredResult(_0x43bc33,_0x1dc356))[_0xb747('0x48')](handleError(_0x43bc33,null));};exports[_0xb747('0x49')]=function(_0xdfd1b9,_0x1052ea){var _0x22c619={'raw':!![],'where':{'id':_0xdfd1b9[_0xb747('0x4a')]['id']}},_0x8b344c={};_0x8b344c[_0xb747('0x33')]=_['keys'](db[_0xb747('0x2e')][_0xb747('0x4b')]);_0x8b344c['query']=_[_0xb747('0x32')](_0xdfd1b9[_0xb747('0x31')]);_0x8b344c[_0xb747('0x3c')]=_[_0xb747('0x35')](_0x8b344c[_0xb747('0x33')],_0x8b344c['query']);_0x22c619[_0xb747('0x34')]=_[_0xb747('0x35')](_0x8b344c['model'],qs[_0xb747('0x36')](_0xdfd1b9[_0xb747('0x31')][_0xb747('0x36')]));_0x22c619[_0xb747('0x34')]=_0x22c619[_0xb747('0x34')][_0xb747('0x37')]?_0x22c619['attributes']:_0x8b344c[_0xb747('0x33')];if(_0xdfd1b9[_0xb747('0x31')][_0xb747('0x45')]){_0x22c619[_0xb747('0x46')]=[{'all':!![]}];}_0x22c619=_['merge']({},_0x22c619,_0xdfd1b9[_0xb747('0x44')]);return db[_0xb747('0x2e')][_0xb747('0x4c')](_0x22c619)[_0xb747('0x26')](handleEntityNotFound(_0x1052ea,null))['then'](respondWithResult(_0x1052ea,null))[_0xb747('0x48')](handleError(_0x1052ea,null));};exports[_0xb747('0x25')]=function(_0x34407c,_0xc0444a){if(_0x34407c[_0xb747('0x4d')]['id']){delete _0x34407c['body']['id'];}return db['MailMessage']['find']({'where':{'id':_0x34407c[_0xb747('0x4a')]['id']}})[_0xb747('0x26')](handleEntityNotFound(_0xc0444a,null))[_0xb747('0x26')](saveUpdates(_0x34407c[_0xb747('0x4d')],null))[_0xb747('0x26')](respondWithResult(_0xc0444a,null))[_0xb747('0x48')](handleError(_0xc0444a,null));};exports['destroy']=function(_0x55e8ee,_0x337f2c){return db[_0xb747('0x2e')][_0xb747('0x4c')]({'where':{'id':_0x55e8ee[_0xb747('0x4a')]['id']}})[_0xb747('0x26')](handleEntityNotFound(_0x337f2c,null))[_0xb747('0x26')](removeEntity(_0x337f2c,null))[_0xb747('0x48')](handleError(_0x337f2c,null));};exports[_0xb747('0x4e')]=function(_0x14821f,_0xc6d821){return db[_0xb747('0x2e')][_0xb747('0x4e')]()['then'](respondWithResult(_0xc6d821,null))[_0xb747('0x48')](handleError(_0xc6d821,null));};exports[_0xb747('0x4f')]=function(_0x4abe53,_0x1665f0){return db[_0xb747('0x2e')][_0xb747('0x4f')](_0x4abe53[_0xb747('0x4d')])[_0xb747('0x26')](function(_0x2734e7){if(_0x2734e7){if(_0x2734e7[_0xb747('0x50')]===_0xb747('0x51')&&!_0x2734e7[_0xb747('0x52')]){var _0x25d4a4,_0x3ee70e,_0xbf9b13;if(_0x4abe53[_0xb747('0x4d')]['to']){_0x3ee70e=_0x4abe53[_0xb747('0x4d')]['to']['split'](',')[0x0];}return db[_0xb747('0x53')][_0xb747('0x54')]({'where':{'id':_0x2734e7[_0xb747('0x55')]},'include':[{'model':db[_0xb747('0x56')],'as':_0xb747('0x57'),'include':[{'model':db[_0xb747('0x58')],'as':_0xb747('0x59'),'where':{'email':_0x3ee70e},'limit':0x1,'order':[['updatedAt',_0xb747('0x5a')]]}]},{'model':db[_0xb747('0x5b')],'as':_0xb747('0x5c'),'raw':!![]}]})[_0xb747('0x26')](function(_0xe39e9b){_0x25d4a4=_0xe39e9b;if(_0x25d4a4&&_0x25d4a4['Smtp']){var _0x576584={'tls':{'rejectUnauthorized':![]}};if(_[_0xb747('0x5d')](_0x25d4a4['Smtp'][_0xb747('0x5e')])){_0x576584[_0xb747('0x5f')]=_0x25d4a4[_0xb747('0x5c')][_0xb747('0x5f')];_0x576584['port']=_0x25d4a4['Smtp'][_0xb747('0x60')];_0x576584[_0xb747('0x61')]=_0x25d4a4['Smtp']['secure'];if(_0x25d4a4[_0xb747('0x5c')][_0xb747('0x62')]){_0x576584[_0xb747('0x63')]={'user':_0x25d4a4[_0xb747('0x5c')][_0xb747('0x64')],'pass':_0x25d4a4[_0xb747('0x5c')][_0xb747('0x65')]};}}else{_0x576584['service']=_0x25d4a4[_0xb747('0x5c')]['service'];_0x576584['auth']={'user':_0x25d4a4[_0xb747('0x5c')][_0xb747('0x64')],'pass':_0x25d4a4[_0xb747('0x5c')][_0xb747('0x65')]};_0x576584[_0xb747('0x61')]=_0x25d4a4[_0xb747('0x5c')][_0xb747('0x61')];}if(_0x4abe53[_0xb747('0x4d')][_0xb747('0x66')]&&_0x4abe53[_0xb747('0x4d')]['attachments'][_0xb747('0x37')]){for(var _0x3fca6c=0x0;_0x3fca6c<_0x4abe53[_0xb747('0x4d')][_0xb747('0x66')][_0xb747('0x37')];_0x3fca6c+=0x1){_0x4abe53[_0xb747('0x4d')][_0xb747('0x66')][_0x3fca6c]={'filename':_0x4abe53[_0xb747('0x4d')][_0xb747('0x66')][_0x3fca6c][_0xb747('0x2b')],'path':path['join'](config['root'],_0xb747('0x67'),_0x4abe53['body']['attachments'][_0x3fca6c]['basename'])};}}_0xbf9b13={'account':_0x576584,'message':_0x4abe53[_0xb747('0x4d')]};return;}})[_0xb747('0x26')](function(){if(_0x25d4a4[_0xb747('0x57')]){if(_0x25d4a4[_0xb747('0x57')]['Contacts']['length']){return _0x25d4a4['List'][_0xb747('0x59')][0x0];}else{return db[_0xb747('0x58')][_0xb747('0x4f')](_[_0xb747('0xd')](_0x4abe53['body'],{'firstName':_0x4abe53[_0xb747('0x4d')]['to'],'email':_0x4abe53[_0xb747('0x4d')]['to'],'phone':_0x4abe53['body']['to'],'ListId':_0x25d4a4[_0xb747('0x68')]}));}}else{throw new Error(_0xb747('0x69'));}})[_0xb747('0x26')](function(){if(_0xbf9b13){return respondWithRpcPromise(_0xb747('0x6a'),'sendMail',_0xbf9b13,client9003)[_0xb747('0x26')](function(_0x531103){return _0x2734e7['update']({'read':!![],'messageId':_0x531103['messageId'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0xb747('0x48')](function(_0x568330){logger[_0xb747('0x1c')]('%s',JSON[_0xb747('0x1b')](_0x568330));return _0x2734e7;});}return _0x2734e7;});}return _0x2734e7;}})[_0xb747('0x26')](respondWithResult(_0x1665f0,0xc9))[_0xb747('0x48')](handleError(_0x1665f0,null));};exports[_0xb747('0x6b')]=function(_0x52a276,_0x51c42f){var _0x57e704={'agent':{},'channel':_0xb747('0x6c')};if(_0x52a276[_0xb747('0x4d')]['id']){delete _0x52a276[_0xb747('0x4d')]['id'];}_0x52a276[_0xb747('0x4d')][_0xb747('0x6d')]=!![];_0x52a276[_0xb747('0x4d')][_0xb747('0x6e')]=moment()[_0xb747('0x6f')]('YYYY-MM-DD\x20HH:mm:ss');_0x52a276[_0xb747('0x4d')][_0xb747('0x70')]=_0x52a276['body'][_0xb747('0x70')]||_0x52a276['user']['id'];_0x57e704[_0xb747('0x71')]['id']=_0x52a276['body'][_0xb747('0x70')];return db[_0xb747('0x2e')]['find']({'where':{'id':_0x52a276[_0xb747('0x4a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x51c42f,null))[_0xb747('0x26')](saveUpdates(_0x52a276[_0xb747('0x4d')],null))['then'](function(_0xbf03bc){if(_0xbf03bc){_0x57e704[_0xb747('0x1d')]=_0xbf03bc[_0xb747('0x72')]({'plain':!![]});return db[_0xb747('0x73')][_0xb747('0x4c')]({'where':{'id':_0xbf03bc[_0xb747('0x74')]}});}return null;})[_0xb747('0x26')](handleEntityNotFound(_0x51c42f,null))[_0xb747('0x26')](function(_0x165ac9){if(_0x165ac9){return _0x165ac9[_0xb747('0x25')]({'UserId':_0x52a276[_0xb747('0x4d')][_0xb747('0x70')],'read1stAt':_['isNil'](_0x165ac9[_0xb747('0x75')])?moment()[_0xb747('0x6f')](_0xb747('0x76')):undefined});}return null;})['then'](function(_0x646023){if(_0x646023){_0x57e704['interaction']=_0x646023[_0xb747('0x72')]({'plain':!![]});interaction_log[_0xb747('0x16')](_0xb747('0x77'),_0x52a276['user']['id'],_0x52a276[_0xb747('0x64')][_0xb747('0x2b')],_0x52a276[_0xb747('0x64')][_0xb747('0x78')],_0x57e704['interaction']['id'],_0x52a276[_0xb747('0x4d')]?JSON[_0xb747('0x1b')](_0x52a276['body']):'null');return respondWithRpcPromise(_0xb747('0x79'),'acceptMessage',_0x57e704);}return null;})[_0xb747('0x26')](function(_0x11def7){var _0x5f2ad2=_0xb747('0x7a')+_0x11def7['message'][_0xb747('0x7b')];return db['sequelize'][_0xb747('0x31')](_0x5f2ad2,{'type':db[_0xb747('0x7c')][_0xb747('0x7d')][_0xb747('0x7e')],'raw':!![]})[_0xb747('0x26')](function(_0x6cf1bf){return _0x6cf1bf;});})[_0xb747('0x26')](function(_0x33a024){if(_0x33a024){_0x57e704[_0xb747('0x1d')][_0xb747('0x7f')]=_0x33a024[0x0];if(!_0x52a276[_0xb747('0x4d')][_0xb747('0x70')])return;return db['User'][_0xb747('0x4c')]({'where':{'id':_0x52a276[_0xb747('0x4d')][_0xb747('0x70')],'role':_0xb747('0x71')},'attributes':['id',_0xb747('0x2b'),_0xb747('0x80'),_0xb747('0x81'),_0xb747('0x82')],'raw':!![]});}return null;})[_0xb747('0x26')](function(_0x5efe11){if(!_0x5efe11)return null;_0x57e704[_0xb747('0x1d')][_0xb747('0x71')]=_0x5efe11;return _0x57e704;})[_0xb747('0x26')](function(_0x19e292){if(_0x19e292){if(_0x52a276[_0xb747('0x4d')][_0xb747('0x83')]){_0x57e704[_0xb747('0x1d')][_0xb747('0x84')]=util[_0xb747('0x6f')](_0xb747('0x85'),_0x52a276['user'][_0xb747('0x2b')]);_0x57e704['message'][_0xb747('0x86')]=_0x57e704[_0xb747('0x86')];_0x57e704['message'][_0xb747('0x87')]=_0x57e704[_0xb747('0x86')];_0x57e704['message'][_0xb747('0x88')]=_0xb747('0x6b');_0x57e704['message'][_0xb747('0x4d')]=htmlToText[_0xb747('0x89')](_0x57e704['message'][_0xb747('0x4d')]);return respondWithRpcPromise('EventManager','EventManager',{'event':_0xb747('0x8a'),'message':_0x57e704[_0xb747('0x1d')]},client9002)[_0xb747('0x26')](function(){return _0x57e704;});}return _0x57e704;}return null;})[_0xb747('0x26')](respondWithResult(_0x51c42f,null))[_0xb747('0x48')](handleError(_0x51c42f,null));};exports[_0xb747('0x8b')]=function(_0x51468e,_0x55f9f3){var _0xf363bd={'agent':{},'channel':'mail'};if(_0x51468e[_0xb747('0x4d')]['id']){delete _0x51468e[_0xb747('0x4d')]['id'];}_0x51468e['body'][_0xb747('0x70')]=_0x51468e[_0xb747('0x4d')]['UserId']||_0x51468e['user']['id'];_0xf363bd[_0xb747('0x71')]['id']=_0x51468e[_0xb747('0x4d')][_0xb747('0x70')];return db[_0xb747('0x2e')][_0xb747('0x4c')]({'where':{'id':_0x51468e['params']['id'],'UserId':null}})[_0xb747('0x26')](handleEntityNotFound(_0x55f9f3,null))[_0xb747('0x26')](function(_0x3924b0){if(_0x3924b0){_0xf363bd[_0xb747('0x1d')]=_0x3924b0[_0xb747('0x72')]({'plain':!![]});return db[_0xb747('0x73')][_0xb747('0x4c')]({'where':{'id':_0x3924b0['MailInteractionId']}});}return null;})[_0xb747('0x26')](handleEntityNotFound(_0x55f9f3,null))['then'](function(_0xd47ebc){if(_0xd47ebc){_0xf363bd[_0xb747('0x8c')]=_0xd47ebc[_0xb747('0x72')]({'plain':!![]});interaction_log[_0xb747('0x16')](_0xb747('0x8d'),_0x51468e[_0xb747('0x64')]['id'],_0x51468e[_0xb747('0x64')][_0xb747('0x2b')],_0x51468e['user'][_0xb747('0x78')],_0xf363bd[_0xb747('0x8c')]['id'],_0x51468e[_0xb747('0x4d')]?JSON['stringify'](_0x51468e['body']):'null');return respondWithRpcPromise(_0xb747('0x8e'),'rejectMessage',_0xf363bd);}return null;})['then'](function(_0x5d47a3){var _0x2acb3e=_0xb747('0x7a')+_0x5d47a3[_0xb747('0x1d')][_0xb747('0x7b')];return db[_0xb747('0x8f')][_0xb747('0x31')](_0x2acb3e,{'type':db[_0xb747('0x7c')][_0xb747('0x7d')][_0xb747('0x7e')],'raw':!![]})[_0xb747('0x26')](function(_0x90a1dc){return _0x90a1dc;});})['then'](function(_0x2be236){if(_0x2be236){_0xf363bd['message'][_0xb747('0x7f')]=_0x2be236[0x0];if(!_0x51468e[_0xb747('0x4d')][_0xb747('0x70')])return;return db[_0xb747('0x90')][_0xb747('0x4c')]({'where':{'id':_0x51468e['body'][_0xb747('0x70')],'role':_0xb747('0x71')},'attributes':['id','name','fullname',_0xb747('0x81'),'internal'],'raw':!![]});}return null;})[_0xb747('0x26')](function(_0xe44dcd){if(!_0xe44dcd)return null;_0xf363bd[_0xb747('0x1d')][_0xb747('0x71')]=_0xe44dcd;return _0xf363bd;})[_0xb747('0x26')](function(_0x21d259){if(_0x21d259){_0x21d259['message'][_0xb747('0x84')]=util['format'](_0xb747('0x85'),_0x51468e[_0xb747('0x64')]['name']);_0x21d259['message']['channel']=_0xf363bd[_0xb747('0x86')];_0x21d259[_0xb747('0x1d')]['motionChannel']=_0xf363bd['channel'];_0x21d259[_0xb747('0x1d')][_0xb747('0x88')]='reject';_0x21d259[_0xb747('0x1d')][_0xb747('0x4d')]=htmlToText['fromString'](_0xf363bd['message'][_0xb747('0x4d')]);respondWithRpcPromise(_0xb747('0x91'),_0xb747('0x91'),{'event':_0xb747('0x92'),'message':_0x21d259['message']},client9002);return _0xf363bd;}return null;})[_0xb747('0x26')](respondWithResult(_0x55f9f3,null))[_0xb747('0x48')](handleError(_0x55f9f3,null));};exports[_0xb747('0x93')]=function(_0x12a852,_0x26b6f9){var _0x27f52c=moment()[_0xb747('0x94')]()[_0xb747('0x95')]();var _0x3721db=path[_0xb747('0x96')](config[_0xb747('0x97')],_0xb747('0x98'),_0xb747('0x99'),_0xb747('0x9a'));var _0x16e1f7=path['join'](config[_0xb747('0x97')],_0xb747('0x98'),'files',_0xb747('0x66'));var _0x34dc0d=util[_0xb747('0x6f')](_0xb747('0x9b'),_0x27f52c);return db[_0xb747('0x2e')][_0xb747('0x4c')]({'where':{'id':_0x12a852[_0xb747('0x4a')]['id']},'attributes':['id','body',_0xb747('0x9c'),'to','cc',_0xb747('0x9d'),_0xb747('0x9e'),'createdAt'],'include':_0x12a852[_0xb747('0x31')][_0xb747('0x66')]?[{'model':db[_0xb747('0x9f')],'as':'Attachments'}]:undefined})[_0xb747('0x26')](handleEntityNotFound(_0x26b6f9,null))['then'](function(_0x2d5122){if(_0x2d5122){var _0x19b64e=_0x2d5122;var _0x3153da={'from':_0x19b64e[_0xb747('0x9c')],'to':_0x19b64e['to'],'subject':_0x19b64e[_0xb747('0x9e')],'html':htmlEntities[_0xb747('0xa0')](_0x19b64e['body']),'headers':{'Date':moment(_0x19b64e[_0xb747('0xa1')])[_0xb747('0x6f')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x2d5122['cc']){_0x3153da[_0xb747('0xa2')]['Cc']=_0x2d5122['cc'];}if(_0x2d5122['bcc']){_0x3153da['headers'][_0xb747('0xa3')]=_0x2d5122['bcc'];}return new BPromise(function(_0x52dd88,_0x4697ce){if(_0x2d5122[_0xb747('0xa4')]){for(var _0x191f6b=0x0;_0x191f6b<_0x2d5122[_0xb747('0xa4')]['length'];_0x191f6b++){var _0x1ba4fd=_0x2d5122[_0xb747('0xa4')][_0x191f6b];var _0x6071cd=path[_0xb747('0x96')](_0x16e1f7,_0x1ba4fd[_0xb747('0xa5')]);if(fs[_0xb747('0xa6')](_0x6071cd)){_0x3153da['attachments']['push']({'name':_0x1ba4fd[_0xb747('0x2b')],'contentType':_0x1ba4fd['type'],'data':fs[_0xb747('0xa7')](_0x6071cd)});}}}emlformat[_0xb747('0xa8')](_0x3153da,function(_0x3d51ce,_0x29472b){if(_0x3d51ce)return _0x4697ce(_0x3d51ce);fs[_0xb747('0xa9')](path[_0xb747('0x96')](_0x3721db,_0x34dc0d),_0x29472b);return _0x52dd88(_0x29472b);});});}})[_0xb747('0x26')](function(_0x247340){if(_0x247340){return _0x26b6f9[_0xb747('0x93')](path[_0xb747('0x96')](_0x3721db,_0x34dc0d),_0x34dc0d,function(_0x14af75){if(!_0x14af75)fs[_0xb747('0xaa')](path[_0xb747('0x96')](_0x3721db,_0x34dc0d));});}})[_0xb747('0x48')](handleError(_0x26b6f9,null));}; \ No newline at end of file +var _0x04b0=['download','unix','files','tmp','server','message-%s.eml','from','bcc','subject','createdAt','Attachments','decode','headers','Bcc','existsSync','push','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','mail-interactions','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','client','http','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','json','undefined','limit','count','offset','set','destroy','then','end','sendStatus','stack','name','send','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','MailMessage','includeAll','include','rows','show','params','find','update','body','describe','create','direction','secret','split','MailAccount','findOne','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','service','host','port','secure','authentication','auth','user','pass','attachments','join','root','server/files/attachments','basename','List\x20not\x20found','SendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','read','readAt','UserId','agent','get','MailInteractionId','isNil','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','internal','interface','SIP/%s','channel','event','fromString','EventManager','acceptmessage','reject','MailInteraction','interaction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','contact','rejectmessage'];(function(_0x1bed69,_0x12cf5d){var _0x33fd30=function(_0x50b7a5){while(--_0x50b7a5){_0x1bed69['push'](_0x1bed69['shift']());}};_0x33fd30(++_0x12cf5d);}(_0x04b0,0xb5));var _0x004b=function(_0x2a58f7,_0x3db045){_0x2a58f7=_0x2a58f7-0x0;var _0x57af34=_0x04b0[_0x2a58f7];return _0x57af34;};'use strict';var emlformat=require(_0x004b('0x0'));var moment=require(_0x004b('0x1'));var BPromise=require(_0x004b('0x2'));var util=require(_0x004b('0x3'));var path=require(_0x004b('0x4'));var fs=require('fs');var _=require(_0x004b('0x5'));var Redis=require(_0x004b('0x6'));var htmlToText=require(_0x004b('0x7'));var qs=require(_0x004b('0x8'));var logger=require(_0x004b('0x9'))('api');var interaction_log=require(_0x004b('0x9'))(_0x004b('0xa'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x004b('0xb')]=_[_0x004b('0xc')](config['redis'],{'host':_0x004b('0xd'),'port':0x18eb});var socket=require(_0x004b('0xe'))(new Redis(config[_0x004b('0xb')]));var htmlEntities=require(_0x004b('0xf'));require(_0x004b('0x10'))[_0x004b('0x11')](socket);var jayson=require('jayson/promise');var client=jayson[_0x004b('0x12')][_0x004b('0x13')]({'port':0x232c});var client9003=jayson[_0x004b('0x12')][_0x004b('0x13')]({'port':0x232b});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2bb7e9,_0x49c8c4,_0x1d3028,_0x38f8bf){return new BPromise(function(_0x5e7951,_0x204e0a){var _0x844965=_0x38f8bf||client;return _0x844965['request'](_0x2bb7e9,_0x1d3028)['then'](function(_0x211711){logger[_0x004b('0x14')](_0x004b('0x15'),_0x49c8c4,_0x004b('0x16'));logger[_0x004b('0x17')](_0x004b('0x18'),_0x49c8c4,_0x004b('0x16'),JSON['stringify'](_0x211711));if(_0x211711[_0x004b('0x19')]){if(_0x211711[_0x004b('0x19')]['code']===0x1f4){logger[_0x004b('0x19')](_0x004b('0x15'),_0x49c8c4,_0x211711[_0x004b('0x19')][_0x004b('0x1a')]);return _0x204e0a(_0x211711[_0x004b('0x19')][_0x004b('0x1a')]);}logger['error'](_0x004b('0x15'),_0x49c8c4,_0x211711[_0x004b('0x19')][_0x004b('0x1a')]);return _0x5e7951(_0x211711[_0x004b('0x19')]['message']);}else{logger[_0x004b('0x14')](_0x004b('0x15'),_0x49c8c4,_0x004b('0x16'));_0x5e7951(_0x211711[_0x004b('0x1b')][_0x004b('0x1a')]);}})[_0x004b('0x1c')](function(_0x155f4f){logger[_0x004b('0x19')](_0x004b('0x15'),_0x49c8c4,_0x155f4f);_0x204e0a(_0x155f4f);});});}function respondWithResult(_0x1774ae,_0x3c7a3b){_0x3c7a3b=_0x3c7a3b||0xc8;return function(_0x1836f0){if(_0x1836f0){return _0x1774ae[_0x004b('0x1d')](_0x3c7a3b)[_0x004b('0x1e')](_0x1836f0);}};}function respondWithFilteredResult(_0x3d7fd8,_0x5c2615){return function(_0x54d297){if(_0x54d297){var _0x16c701=typeof _0x5c2615['offset']===_0x004b('0x1f')&&typeof _0x5c2615[_0x004b('0x20')]===_0x004b('0x1f');var _0x25aeb3=_0x54d297[_0x004b('0x21')];var _0x244896=_0x16c701?0x0:_0x5c2615[_0x004b('0x22')];var _0x3ddee4=_0x16c701?_0x54d297[_0x004b('0x21')]:_0x5c2615[_0x004b('0x22')]+_0x5c2615[_0x004b('0x20')];var _0x441cef;if(_0x3ddee4>=_0x25aeb3){_0x3ddee4=_0x25aeb3;_0x441cef=0xc8;}else{_0x441cef=0xce;}_0x3d7fd8[_0x004b('0x1d')](_0x441cef);return _0x3d7fd8[_0x004b('0x23')]('Content-Range',_0x244896+'-'+_0x3ddee4+'/'+_0x25aeb3)['json'](_0x54d297);}return null;};}function saveUpdates(_0x2d10b9){return function(_0x17edcb){if(_0x17edcb){return _0x17edcb['update'](_0x2d10b9)['then'](function(_0x21531c){return _0x21531c;});}return null;};}function removeEntity(_0x20ab7e){return function(_0x36b453){if(_0x36b453){return _0x36b453[_0x004b('0x24')]()[_0x004b('0x25')](function(){_0x20ab7e['status'](0xcc)[_0x004b('0x26')]();});}};}function handleEntityNotFound(_0x26d7cc){return function(_0x5cf44b){if(!_0x5cf44b){_0x26d7cc[_0x004b('0x27')](0x194);}return _0x5cf44b;};}function handleError(_0x356724,_0x1a06d9){_0x1a06d9=_0x1a06d9||0x1f4;return function(_0x324e0c){logger[_0x004b('0x19')](_0x324e0c[_0x004b('0x28')]);if(_0x324e0c[_0x004b('0x29')]){delete _0x324e0c[_0x004b('0x29')];}_0x356724[_0x004b('0x1d')](_0x1a06d9)[_0x004b('0x2a')](_0x324e0c);};}exports[_0x004b('0x2b')]=function(_0xf00168,_0x5d5f44){var _0x54dff7={},_0x397ab6={},_0x27c4ca={'count':0x0,'rows':[]};var _0x263f64=_[_0x004b('0x2c')](db['MailMessage']['rawAttributes'],function(_0x2e558b){return{'name':_0x2e558b[_0x004b('0x2d')],'type':_0x2e558b[_0x004b('0x2e')][_0x004b('0x2f')]};});_0x397ab6[_0x004b('0x30')]=_[_0x004b('0x2c')](_0x263f64,'name');_0x397ab6[_0x004b('0x31')]=_[_0x004b('0x32')](_0xf00168[_0x004b('0x31')]);_0x397ab6['filters']=_[_0x004b('0x33')](_0x397ab6[_0x004b('0x30')],_0x397ab6[_0x004b('0x31')]);_0x54dff7[_0x004b('0x34')]=_[_0x004b('0x33')](_0x397ab6[_0x004b('0x30')],qs[_0x004b('0x35')](_0xf00168[_0x004b('0x31')][_0x004b('0x35')]));_0x54dff7[_0x004b('0x34')]=_0x54dff7['attributes'][_0x004b('0x36')]?_0x54dff7[_0x004b('0x34')]:_0x397ab6['model'];if(!_0xf00168[_0x004b('0x31')][_0x004b('0x37')](_0x004b('0x38'))){_0x54dff7['limit']=qs['limit'](_0xf00168['query']['limit']);_0x54dff7[_0x004b('0x22')]=qs[_0x004b('0x22')](_0xf00168[_0x004b('0x31')][_0x004b('0x22')]);}_0x54dff7[_0x004b('0x39')]=qs['sort'](_0xf00168['query'][_0x004b('0x3a')]);_0x54dff7[_0x004b('0x3b')]=qs['filters'](_['pick'](_0xf00168['query'],_0x397ab6[_0x004b('0x3c')]),_0x263f64);if(_0xf00168[_0x004b('0x31')]['filter']){_0x54dff7[_0x004b('0x3b')]=_[_0x004b('0x3d')](_0x54dff7[_0x004b('0x3b')],{'$or':_['map'](_0x263f64,function(_0x1fbf3b){if(_0x1fbf3b[_0x004b('0x2e')]!==_0x004b('0x3e')){var _0x230a99={};_0x230a99[_0x1fbf3b[_0x004b('0x29')]]={'$like':'%'+_0xf00168[_0x004b('0x31')][_0x004b('0x3f')]+'%'};return _0x230a99;}})});}_0x54dff7=_[_0x004b('0x3d')]({},_0x54dff7,_0xf00168[_0x004b('0x40')]);var _0x196dc7={'where':_0x54dff7[_0x004b('0x3b')]};return db[_0x004b('0x41')][_0x004b('0x21')](_0x196dc7)['then'](function(_0x48b78e){_0x27c4ca[_0x004b('0x21')]=_0x48b78e;if(_0xf00168[_0x004b('0x31')][_0x004b('0x42')]){_0x54dff7[_0x004b('0x43')]=[{'all':!![]}];}return db[_0x004b('0x41')]['findAll'](_0x54dff7);})[_0x004b('0x25')](function(_0x527ef1){_0x27c4ca[_0x004b('0x44')]=_0x527ef1;return _0x27c4ca;})['then'](respondWithFilteredResult(_0x5d5f44,_0x54dff7))[_0x004b('0x1c')](handleError(_0x5d5f44,null));};exports[_0x004b('0x45')]=function(_0x270038,_0x4925f4){var _0x40dc5c={'raw':!![],'where':{'id':_0x270038[_0x004b('0x46')]['id']}},_0x5d2f3c={};_0x5d2f3c['model']=_[_0x004b('0x32')](db[_0x004b('0x41')]['rawAttributes']);_0x5d2f3c[_0x004b('0x31')]=_[_0x004b('0x32')](_0x270038[_0x004b('0x31')]);_0x5d2f3c[_0x004b('0x3c')]=_[_0x004b('0x33')](_0x5d2f3c[_0x004b('0x30')],_0x5d2f3c[_0x004b('0x31')]);_0x40dc5c[_0x004b('0x34')]=_[_0x004b('0x33')](_0x5d2f3c[_0x004b('0x30')],qs[_0x004b('0x35')](_0x270038['query'][_0x004b('0x35')]));_0x40dc5c[_0x004b('0x34')]=_0x40dc5c[_0x004b('0x34')][_0x004b('0x36')]?_0x40dc5c['attributes']:_0x5d2f3c[_0x004b('0x30')];if(_0x270038['query'][_0x004b('0x42')]){_0x40dc5c[_0x004b('0x43')]=[{'all':!![]}];}_0x40dc5c=_[_0x004b('0x3d')]({},_0x40dc5c,_0x270038[_0x004b('0x40')]);return db[_0x004b('0x41')][_0x004b('0x47')](_0x40dc5c)[_0x004b('0x25')](handleEntityNotFound(_0x4925f4,null))[_0x004b('0x25')](respondWithResult(_0x4925f4,null))[_0x004b('0x1c')](handleError(_0x4925f4,null));};exports[_0x004b('0x48')]=function(_0x271571,_0x2e223a){if(_0x271571['body']['id']){delete _0x271571['body']['id'];}return db[_0x004b('0x41')][_0x004b('0x47')]({'where':{'id':_0x271571['params']['id']}})['then'](handleEntityNotFound(_0x2e223a,null))[_0x004b('0x25')](saveUpdates(_0x271571[_0x004b('0x49')],null))[_0x004b('0x25')](respondWithResult(_0x2e223a,null))[_0x004b('0x1c')](handleError(_0x2e223a,null));};exports[_0x004b('0x24')]=function(_0x3c7e84,_0x420651){return db[_0x004b('0x41')][_0x004b('0x47')]({'where':{'id':_0x3c7e84[_0x004b('0x46')]['id']}})[_0x004b('0x25')](handleEntityNotFound(_0x420651,null))['then'](removeEntity(_0x420651,null))['catch'](handleError(_0x420651,null));};exports[_0x004b('0x4a')]=function(_0x4c708a,_0x107cf0){return db[_0x004b('0x41')][_0x004b('0x4a')]()[_0x004b('0x25')](respondWithResult(_0x107cf0,null))[_0x004b('0x1c')](handleError(_0x107cf0,null));};exports[_0x004b('0x4b')]=function(_0x21a95a,_0xd7931d){return db[_0x004b('0x41')][_0x004b('0x4b')](_0x21a95a[_0x004b('0x49')])[_0x004b('0x25')](function(_0x44c0f2){if(_0x44c0f2){if(_0x44c0f2[_0x004b('0x4c')]==='out'&&!_0x44c0f2[_0x004b('0x4d')]){var _0x27b739,_0x359e6c,_0x84e518;if(_0x21a95a['body']['to']){_0x359e6c=_0x21a95a['body']['to'][_0x004b('0x4e')](',')[0x0];}return db[_0x004b('0x4f')][_0x004b('0x50')]({'where':{'id':_0x44c0f2['MailAccountId']},'include':[{'model':db[_0x004b('0x51')],'as':_0x004b('0x52'),'include':[{'model':db[_0x004b('0x53')],'as':_0x004b('0x54'),'where':{'email':_0x359e6c},'limit':0x1,'order':[[_0x004b('0x55'),_0x004b('0x56')]]}]},{'model':db[_0x004b('0x57')],'as':_0x004b('0x58'),'raw':!![]}]})['then'](function(_0x3c0c7f){_0x27b739=_0x3c0c7f;if(_0x27b739&&_0x27b739['Smtp']){var _0x4de8b8={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x27b739['Smtp'][_0x004b('0x59')])){_0x4de8b8[_0x004b('0x5a')]=_0x27b739[_0x004b('0x58')][_0x004b('0x5a')];_0x4de8b8[_0x004b('0x5b')]=_0x27b739[_0x004b('0x58')][_0x004b('0x5b')];_0x4de8b8[_0x004b('0x5c')]=_0x27b739['Smtp']['secure'];if(_0x27b739[_0x004b('0x58')][_0x004b('0x5d')]){_0x4de8b8[_0x004b('0x5e')]={'user':_0x27b739[_0x004b('0x58')][_0x004b('0x5f')],'pass':_0x27b739[_0x004b('0x58')][_0x004b('0x60')]};}}else{_0x4de8b8[_0x004b('0x59')]=_0x27b739[_0x004b('0x58')][_0x004b('0x59')];_0x4de8b8['auth']={'user':_0x27b739[_0x004b('0x58')][_0x004b('0x5f')],'pass':_0x27b739[_0x004b('0x58')][_0x004b('0x60')]};_0x4de8b8[_0x004b('0x5c')]=_0x27b739[_0x004b('0x58')][_0x004b('0x5c')];}if(_0x21a95a[_0x004b('0x49')][_0x004b('0x61')]&&_0x21a95a['body'][_0x004b('0x61')][_0x004b('0x36')]){for(var _0x49bc02=0x0;_0x49bc02<_0x21a95a[_0x004b('0x49')]['attachments']['length'];_0x49bc02+=0x1){_0x21a95a[_0x004b('0x49')]['attachments'][_0x49bc02]={'filename':_0x21a95a[_0x004b('0x49')][_0x004b('0x61')][_0x49bc02]['name'],'path':path[_0x004b('0x62')](config[_0x004b('0x63')],_0x004b('0x64'),_0x21a95a[_0x004b('0x49')][_0x004b('0x61')][_0x49bc02][_0x004b('0x65')])};}}_0x84e518={'account':_0x4de8b8,'message':_0x21a95a[_0x004b('0x49')]};return;}})[_0x004b('0x25')](function(){if(_0x27b739[_0x004b('0x52')]){if(_0x27b739[_0x004b('0x52')][_0x004b('0x54')][_0x004b('0x36')]){return _0x27b739[_0x004b('0x52')]['Contacts'][0x0];}else{return db[_0x004b('0x53')]['create'](_[_0x004b('0xc')](_0x21a95a['body'],{'firstName':_0x21a95a[_0x004b('0x49')]['to'],'email':_0x21a95a[_0x004b('0x49')]['to'],'phone':_0x21a95a[_0x004b('0x49')]['to'],'ListId':_0x27b739['ListId']}));}}else{throw new Error(_0x004b('0x66'));}})[_0x004b('0x25')](function(){if(_0x84e518){return respondWithRpcPromise(_0x004b('0x67'),'sendMail',_0x84e518,client9003)['then'](function(_0x2f5540){return _0x44c0f2[_0x004b('0x48')]({'read':!![],'messageId':_0x2f5540[_0x004b('0x68')],'sentAt':moment()[_0x004b('0x69')](_0x004b('0x6a'))});})[_0x004b('0x1c')](function(_0x3cc7bf){logger[_0x004b('0x19')]('%s',JSON['stringify'](_0x3cc7bf));return _0x44c0f2;});}return _0x44c0f2;});}return _0x44c0f2;}})[_0x004b('0x25')](respondWithResult(_0xd7931d,0xc9))[_0x004b('0x1c')](handleError(_0xd7931d,null));};exports[_0x004b('0x6b')]=function(_0x10fce8,_0x125b80){var _0xc1d52={'agent':{},'channel':'mail'};if(_0x10fce8[_0x004b('0x49')]['id']){delete _0x10fce8[_0x004b('0x49')]['id'];}_0x10fce8['body'][_0x004b('0x6c')]=!![];_0x10fce8[_0x004b('0x49')][_0x004b('0x6d')]=moment()[_0x004b('0x69')](_0x004b('0x6a'));_0x10fce8[_0x004b('0x49')]['UserId']=_0x10fce8[_0x004b('0x49')][_0x004b('0x6e')]||_0x10fce8['user']['id'];_0xc1d52[_0x004b('0x6f')]['id']=_0x10fce8[_0x004b('0x49')][_0x004b('0x6e')];return db[_0x004b('0x41')][_0x004b('0x47')]({'where':{'id':_0x10fce8[_0x004b('0x46')]['id'],'UserId':null}})[_0x004b('0x25')](handleEntityNotFound(_0x125b80,null))[_0x004b('0x25')](saveUpdates(_0x10fce8[_0x004b('0x49')],null))[_0x004b('0x25')](function(_0x43e58a){if(_0x43e58a){_0xc1d52['message']=_0x43e58a[_0x004b('0x70')]({'plain':!![]});return db['MailInteraction'][_0x004b('0x47')]({'where':{'id':_0x43e58a[_0x004b('0x71')]}});}return null;})[_0x004b('0x25')](handleEntityNotFound(_0x125b80,null))[_0x004b('0x25')](function(_0x3c1967){if(_0x3c1967){return _0x3c1967[_0x004b('0x48')]({'UserId':_0x10fce8[_0x004b('0x49')][_0x004b('0x6e')],'read1stAt':_[_0x004b('0x72')](_0x3c1967['read1stAt'])?moment()[_0x004b('0x69')](_0x004b('0x6a')):undefined});}return null;})[_0x004b('0x25')](function(_0x3184f0){if(_0x3184f0){_0xc1d52['interaction']=_0x3184f0[_0x004b('0x70')]({'plain':!![]});interaction_log['info'](_0x004b('0x73'),_0x10fce8[_0x004b('0x5f')]['id'],_0x10fce8[_0x004b('0x5f')][_0x004b('0x29')],_0x10fce8[_0x004b('0x5f')]['role'],_0xc1d52['interaction']['id'],_0x10fce8['body']?JSON[_0x004b('0x74')](_0x10fce8[_0x004b('0x49')]):_0x004b('0x75'));return respondWithRpcPromise(_0x004b('0x76'),_0x004b('0x77'),_0xc1d52);}return null;})[_0x004b('0x25')](function(_0x16a845){var _0x30ef38=_0x004b('0x78')+_0x16a845['message'][_0x004b('0x79')];return db[_0x004b('0x7a')]['query'](_0x30ef38,{'type':db[_0x004b('0x7b')][_0x004b('0x7c')][_0x004b('0x7d')],'raw':!![]})[_0x004b('0x25')](function(_0x2571f3){return _0x2571f3;});})[_0x004b('0x25')](function(_0xef793a){if(_0xef793a){_0xc1d52[_0x004b('0x1a')]['contact']=_0xef793a[0x0];if(!_0x10fce8[_0x004b('0x49')]['UserId'])return;return db[_0x004b('0x7e')][_0x004b('0x47')]({'where':{'id':_0x10fce8['body'][_0x004b('0x6e')],'role':_0x004b('0x6f')},'attributes':['id','name',_0x004b('0x7f'),'email',_0x004b('0x80')],'raw':!![]});}return null;})[_0x004b('0x25')](function(_0x3c7b5c){if(!_0x3c7b5c)return null;_0xc1d52[_0x004b('0x1a')][_0x004b('0x6f')]=_0x3c7b5c;return _0xc1d52;})[_0x004b('0x25')](function(_0x3be127){if(_0x3be127){if(_0x10fce8[_0x004b('0x49')]['manual']){_0xc1d52[_0x004b('0x1a')][_0x004b('0x81')]=util[_0x004b('0x69')](_0x004b('0x82'),_0x10fce8['user'][_0x004b('0x29')]);_0xc1d52[_0x004b('0x1a')][_0x004b('0x83')]=_0xc1d52[_0x004b('0x83')];_0xc1d52[_0x004b('0x1a')]['motionChannel']=_0xc1d52[_0x004b('0x83')];_0xc1d52[_0x004b('0x1a')][_0x004b('0x84')]=_0x004b('0x6b');_0xc1d52[_0x004b('0x1a')][_0x004b('0x49')]=htmlToText[_0x004b('0x85')](_0xc1d52[_0x004b('0x1a')][_0x004b('0x49')]);return respondWithRpcPromise(_0x004b('0x86'),_0x004b('0x86'),{'event':_0x004b('0x87'),'message':_0xc1d52[_0x004b('0x1a')]},client9002)[_0x004b('0x25')](function(){return _0xc1d52;});}return _0xc1d52;}return null;})['then'](respondWithResult(_0x125b80,null))[_0x004b('0x1c')](handleError(_0x125b80,null));};exports[_0x004b('0x88')]=function(_0x11b415,_0x3fda33){var _0x170cd6={'agent':{},'channel':'mail'};if(_0x11b415[_0x004b('0x49')]['id']){delete _0x11b415['body']['id'];}_0x11b415[_0x004b('0x49')][_0x004b('0x6e')]=_0x11b415['body']['UserId']||_0x11b415[_0x004b('0x5f')]['id'];_0x170cd6['agent']['id']=_0x11b415[_0x004b('0x49')][_0x004b('0x6e')];return db['MailMessage'][_0x004b('0x47')]({'where':{'id':_0x11b415[_0x004b('0x46')]['id'],'UserId':null}})[_0x004b('0x25')](handleEntityNotFound(_0x3fda33,null))[_0x004b('0x25')](function(_0x2e5be0){if(_0x2e5be0){_0x170cd6[_0x004b('0x1a')]=_0x2e5be0['get']({'plain':!![]});return db[_0x004b('0x89')][_0x004b('0x47')]({'where':{'id':_0x2e5be0[_0x004b('0x71')]}});}return null;})['then'](handleEntityNotFound(_0x3fda33,null))[_0x004b('0x25')](function(_0x22ce4e){if(_0x22ce4e){_0x170cd6[_0x004b('0x8a')]=_0x22ce4e['get']({'plain':!![]});interaction_log['info'](_0x004b('0x8b'),_0x11b415[_0x004b('0x5f')]['id'],_0x11b415[_0x004b('0x5f')][_0x004b('0x29')],_0x11b415[_0x004b('0x5f')]['role'],_0x170cd6[_0x004b('0x8a')]['id'],_0x11b415[_0x004b('0x49')]?JSON['stringify'](_0x11b415[_0x004b('0x49')]):_0x004b('0x75'));return respondWithRpcPromise('RejectMessage',_0x004b('0x8c'),_0x170cd6);}return null;})[_0x004b('0x25')](function(_0x4f53af){var _0x333d02=_0x004b('0x78')+_0x4f53af[_0x004b('0x1a')][_0x004b('0x79')];return db[_0x004b('0x7a')][_0x004b('0x31')](_0x333d02,{'type':db[_0x004b('0x7b')][_0x004b('0x7c')]['SELECT'],'raw':!![]})[_0x004b('0x25')](function(_0x432d38){return _0x432d38;});})['then'](function(_0x18b713){if(_0x18b713){_0x170cd6[_0x004b('0x1a')][_0x004b('0x8d')]=_0x18b713[0x0];if(!_0x11b415['body'][_0x004b('0x6e')])return;return db[_0x004b('0x7e')][_0x004b('0x47')]({'where':{'id':_0x11b415['body'][_0x004b('0x6e')],'role':_0x004b('0x6f')},'attributes':['id',_0x004b('0x29'),_0x004b('0x7f'),'email',_0x004b('0x80')],'raw':!![]});}return null;})[_0x004b('0x25')](function(_0x44d52a){if(!_0x44d52a)return null;_0x170cd6[_0x004b('0x1a')][_0x004b('0x6f')]=_0x44d52a;return _0x170cd6;})['then'](function(_0x26c759){if(_0x26c759){_0x26c759[_0x004b('0x1a')][_0x004b('0x81')]=util[_0x004b('0x69')](_0x004b('0x82'),_0x11b415[_0x004b('0x5f')][_0x004b('0x29')]);_0x26c759[_0x004b('0x1a')][_0x004b('0x83')]=_0x170cd6[_0x004b('0x83')];_0x26c759[_0x004b('0x1a')]['motionChannel']=_0x170cd6[_0x004b('0x83')];_0x26c759[_0x004b('0x1a')][_0x004b('0x84')]=_0x004b('0x88');_0x26c759[_0x004b('0x1a')]['body']=htmlToText[_0x004b('0x85')](_0x170cd6[_0x004b('0x1a')]['body']);respondWithRpcPromise(_0x004b('0x86'),_0x004b('0x86'),{'event':_0x004b('0x8e'),'message':_0x26c759['message']},client9002);return _0x170cd6;}return null;})['then'](respondWithResult(_0x3fda33,null))[_0x004b('0x1c')](handleError(_0x3fda33,null));};exports[_0x004b('0x8f')]=function(_0x304662,_0x2ffbc1){var _0x4ae898=moment()[_0x004b('0x90')]()['toString']();var _0x4bf671=path[_0x004b('0x62')](config['root'],'server',_0x004b('0x91'),_0x004b('0x92'));var _0xcbe807=path[_0x004b('0x62')](config[_0x004b('0x63')],_0x004b('0x93'),_0x004b('0x91'),_0x004b('0x61'));var _0x1e4ab3=util['format'](_0x004b('0x94'),_0x4ae898);return db[_0x004b('0x41')][_0x004b('0x47')]({'where':{'id':_0x304662['params']['id']},'attributes':['id',_0x004b('0x49'),_0x004b('0x95'),'to','cc',_0x004b('0x96'),_0x004b('0x97'),_0x004b('0x98')],'include':_0x304662[_0x004b('0x31')]['attachments']?[{'model':db['Attachment'],'as':_0x004b('0x99')}]:undefined})[_0x004b('0x25')](handleEntityNotFound(_0x2ffbc1,null))['then'](function(_0x317199){if(_0x317199){var _0x55fcbe=_0x317199;var _0x4c647e={'from':_0x55fcbe[_0x004b('0x95')],'to':_0x55fcbe['to'],'subject':_0x55fcbe[_0x004b('0x97')],'html':htmlEntities[_0x004b('0x9a')](_0x55fcbe['body']),'headers':{'Date':moment(_0x55fcbe[_0x004b('0x98')])[_0x004b('0x69')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x317199['cc']){_0x4c647e[_0x004b('0x9b')]['Cc']=_0x317199['cc'];}if(_0x317199['bcc']){_0x4c647e[_0x004b('0x9b')][_0x004b('0x9c')]=_0x317199[_0x004b('0x96')];}return new BPromise(function(_0x29933,_0x49a16e){if(_0x317199[_0x004b('0x99')]){for(var _0x5978c5=0x0;_0x5978c5<_0x317199[_0x004b('0x99')]['length'];_0x5978c5++){var _0x16f1b9=_0x317199[_0x004b('0x99')][_0x5978c5];var _0x1dff3a=path[_0x004b('0x62')](_0xcbe807,_0x16f1b9[_0x004b('0x65')]);if(fs[_0x004b('0x9d')](_0x1dff3a)){_0x4c647e[_0x004b('0x61')][_0x004b('0x9e')]({'name':_0x16f1b9['name'],'contentType':_0x16f1b9[_0x004b('0x2e')],'data':fs['readFileSync'](_0x1dff3a)});}}}emlformat[_0x004b('0x9f')](_0x4c647e,function(_0xee3edc,_0xa718b3){if(_0xee3edc)return _0x49a16e(_0xee3edc);fs[_0x004b('0xa0')](path[_0x004b('0x62')](_0x4bf671,_0x1e4ab3),_0xa718b3);return _0x29933(_0xa718b3);});});}})[_0x004b('0x25')](function(_0x3ec770){if(_0x3ec770){return _0x2ffbc1[_0x004b('0x8f')](path['join'](_0x4bf671,_0x1e4ab3),_0x1e4ab3,function(_0x326a55){if(!_0x326a55)fs[_0x004b('0xa1')](path[_0x004b('0x62')](_0x4bf671,_0x1e4ab3));});}})[_0x004b('0x1c')](handleError(_0x2ffbc1,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 0373201..04adf0b 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 _0xdfbc=['update','remove','emit','hook','exports','MailMessage','setMaxListeners','save'];(function(_0x4c3982,_0x99acc8){var _0x33801c=function(_0x586e52){while(--_0x586e52){_0x4c3982['push'](_0x4c3982['shift']());}};_0x33801c(++_0x99acc8);}(_0xdfbc,0x16d));var _0xcdfb=function(_0x531510,_0x2ad435){_0x531510=_0x531510-0x0;var _0x44a745=_0xdfbc[_0x531510];return _0x44a745;};'use strict';var EventEmitter=require('events');var MailMessage=require('../../mysqldb')['db'][_0xcdfb('0x0')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xcdfb('0x1')](0x0);var events={'afterCreate':_0xcdfb('0x2'),'afterUpdate':_0xcdfb('0x3'),'afterDestroy':_0xcdfb('0x4')};function emitEvent(_0x413e05){return function(_0x3102e8,_0x1b0dca,_0x4b3047){MailMessageEvents[_0xcdfb('0x5')](_0x413e05+':'+_0x3102e8['id'],_0x3102e8);MailMessageEvents[_0xcdfb('0x5')](_0x413e05,_0x3102e8);_0x4b3047(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xcdfb('0x6')](e,emitEvent(event));}}module[_0xcdfb('0x7')]=MailMessageEvents; \ No newline at end of file +var _0xe0b8=['exports','events','../../mysqldb','setMaxListeners','save','emit','hook'];(function(_0x44efb7,_0x45bba3){var _0x18cf6f=function(_0x40e5e2){while(--_0x40e5e2){_0x44efb7['push'](_0x44efb7['shift']());}};_0x18cf6f(++_0x45bba3);}(_0xe0b8,0x94));var _0x8e0b=function(_0x222fca,_0x1d7d51){_0x222fca=_0x222fca-0x0;var _0x4c44ee=_0xe0b8[_0x222fca];return _0x4c44ee;};'use strict';var EventEmitter=require(_0x8e0b('0x0'));var MailMessage=require(_0x8e0b('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x8e0b('0x2')](0x0);var events={'afterCreate':_0x8e0b('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x14daea){return function(_0x47f442,_0x3f93ba,_0x3f223d){MailMessageEvents[_0x8e0b('0x4')](_0x14daea+':'+_0x47f442['id'],_0x47f442);MailMessageEvents['emit'](_0x14daea,_0x47f442);_0x3f223d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x8e0b('0x5')](e,emitEvent(event));}}module[_0x8e0b('0x6')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 664240d..46d0c0b 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 _0xcb03=['MailInteractionId','then','update','createdAt','toLowerCase','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','FULLTEXT','body','models','get','out','secret','UserId','findOne'];(function(_0x4ce028,_0x526d4b){var _0x583d0c=function(_0x874178){while(--_0x874178){_0x4ce028['push'](_0x4ce028['shift']());}};_0x583d0c(++_0x526d4b);}(_0xcb03,0x144));var _0x3cb0=function(_0x3787e4,_0x1332d2){_0x3787e4=_0x3787e4-0x0;var _0x4824e1=_0xcb03[_0x3787e4];return _0x4824e1;};'use strict';var _=require(_0x3cb0('0x0'));var util=require(_0x3cb0('0x1'));var logger=require(_0x3cb0('0x2'))(_0x3cb0('0x3'));var moment=require(_0x3cb0('0x4'));var BPromise=require(_0x3cb0('0x5'));var rp=require(_0x3cb0('0x6'));var htmlToText=require(_0x3cb0('0x7'));var fs=require('fs');var path=require(_0x3cb0('0x8'));var rimraf=require(_0x3cb0('0x9'));var config=require(_0x3cb0('0xa'));var attributes=require(_0x3cb0('0xb'));module[_0x3cb0('0xc')]=function(_0x4d84ea,_0x11277e){return _0x4d84ea['define'](_0x3cb0('0xd'),attributes,{'tableName':_0x3cb0('0xe'),'paranoid':![],'indexes':[{'name':_0x3cb0('0xf'),'fields':['messageId']},{'name':_0x3cb0('0x10'),'fields':[_0x3cb0('0x11'),'subject'],'type':_0x3cb0('0x12')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2e98f3,_0x48a787,_0x3fa507){if(_0x2e98f3[_0x3cb0('0x13')]){_0x2e98f3[_0x3cb0('0x11')]=htmlToText['fromString'](_0x2e98f3[_0x3cb0('0x13')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x3fa507(null,_0x48a787);},'afterCreate':function(_0x1a4e6f,_0x120489,_0x4829d9){var _0x2920bc=_0x4d84ea[_0x3cb0('0x14')];var _0x3984e3=_0x1a4e6f[_0x3cb0('0x15')]({'plain':!![]});if(_0x3984e3['direction']['toLowerCase']()==='in'||_0x3984e3['direction']['toLowerCase']()===_0x3cb0('0x16')&&!_0x3984e3[_0x3cb0('0x17')]&&!_['isNil'](_0x3984e3[_0x3cb0('0x18')])){_0x2920bc['MailInteraction'][_0x3cb0('0x19')]({'where':{'id':_0x3984e3[_0x3cb0('0x1a')]}})[_0x3cb0('0x1b')](function(_0x275b55){if(_0x275b55){_0x275b55[_0x3cb0('0x1c')]({'lastMsgAt':_0x3984e3[_0x3cb0('0x1d')],'lastMsgDirection':_0x3984e3['direction'][_0x3cb0('0x1e')]()});}})[_0x3cb0('0x1f')](function(_0x53ae12){console[_0x3cb0('0x20')](_0x53ae12);});}_0x4829d9();}},'charset':_0x3cb0('0x21'),'collate':_0x3cb0('0x22')});}; \ No newline at end of file +var _0x5875=['error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','html-to-text','path','../../config/environment','./mailMessage.attributes','exports','define','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','update','catch'];(function(_0x4ae45d,_0x466ff8){var _0x5aebd0=function(_0x172b37){while(--_0x172b37){_0x4ae45d['push'](_0x4ae45d['shift']());}};_0x5aebd0(++_0x466ff8);}(_0x5875,0xc3));var _0x5587=function(_0x68a546,_0x37dcd0){_0x68a546=_0x68a546-0x0;var _0x6ae8d3=_0x5875[_0x68a546];return _0x6ae8d3;};'use strict';var _=require(_0x5587('0x0'));var util=require(_0x5587('0x1'));var logger=require('../../config/logger')(_0x5587('0x2'));var moment=require(_0x5587('0x3'));var BPromise=require(_0x5587('0x4'));var rp=require(_0x5587('0x5'));var htmlToText=require(_0x5587('0x6'));var fs=require('fs');var path=require(_0x5587('0x7'));var rimraf=require('rimraf');var config=require(_0x5587('0x8'));var attributes=require(_0x5587('0x9'));module[_0x5587('0xa')]=function(_0x3ab177,_0x508eb3){return _0x3ab177[_0x5587('0xb')]('MailMessage',attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x5587('0xc'),'fields':[_0x5587('0xc')]},{'name':_0x5587('0xd'),'fields':[_0x5587('0xe'),_0x5587('0xf')],'type':_0x5587('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x321ae5,_0x164f27,_0x2623b2){if(_0x321ae5[_0x5587('0x11')]){_0x321ae5[_0x5587('0xe')]=htmlToText['fromString'](_0x321ae5[_0x5587('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2623b2(null,_0x164f27);},'afterCreate':function(_0x2ff78b,_0x51d5b6,_0x2d4903){var _0x4f3cc2=_0x3ab177[_0x5587('0x12')];var _0x226492=_0x2ff78b[_0x5587('0x13')]({'plain':!![]});if(_0x226492[_0x5587('0x14')][_0x5587('0x15')]()==='in'||_0x226492[_0x5587('0x14')][_0x5587('0x15')]()===_0x5587('0x16')&&!_0x226492[_0x5587('0x17')]&&!_[_0x5587('0x18')](_0x226492[_0x5587('0x19')])){_0x4f3cc2['MailInteraction'][_0x5587('0x1a')]({'where':{'id':_0x226492['MailInteractionId']}})['then'](function(_0x2330ee){if(_0x2330ee){_0x2330ee[_0x5587('0x1b')]({'lastMsgAt':_0x226492['createdAt'],'lastMsgDirection':_0x226492[_0x5587('0x14')][_0x5587('0x15')]()});}})[_0x5587('0x1c')](function(_0x2fdca0){console[_0x5587('0x1d')](_0x2fdca0);});}_0x2d4903();}},'charset':_0x5587('0x1e'),'collate':_0x5587('0x1f')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 36362ba..901b99d 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 _0x5c3c=['../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreateMailMessage','MailMessage','create','options','raw','stringify','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x319d26,_0x3a0aa6){var _0x27eea0=function(_0x30f39e){while(--_0x30f39e){_0x319d26['push'](_0x319d26['shift']());}};_0x27eea0(++_0x3a0aa6);}(_0x5c3c,0x132));var _0xc5c3=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x5c3c[_0x1f9f37];return _0x21c080;};'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});config['redis']=_['defaults'](config['redis'],{'host':_0xc5c3('0xd'),'port':0x18eb});var socket=require(_0xc5c3('0xe'))(new Redis(config['redis']));require(_0xc5c3('0xf'))[_0xc5c3('0x10')](socket);function respondWithRpcPromise(_0x52f3eb,_0x14140f,_0x2a1d19){return new BPromise(function(_0x4e329f,_0x1f2e34){return client[_0xc5c3('0x11')](_0x52f3eb,_0x2a1d19)[_0xc5c3('0x12')](function(_0x59fb60){logger[_0xc5c3('0x13')](_0xc5c3('0x14'),_0x14140f,'request\x20sent');logger[_0xc5c3('0x15')](_0xc5c3('0x16'),_0x14140f,_0xc5c3('0x17'),JSON['stringify'](_0x59fb60));if(_0x59fb60[_0xc5c3('0x18')]){if(_0x59fb60[_0xc5c3('0x18')][_0xc5c3('0x19')]===0x1f4){logger[_0xc5c3('0x18')](_0xc5c3('0x14'),_0x14140f,_0x59fb60['error']['message']);return _0x1f2e34(_0x59fb60[_0xc5c3('0x18')][_0xc5c3('0x1a')]);}logger[_0xc5c3('0x18')](_0xc5c3('0x14'),_0x14140f,_0x59fb60['error']['message']);return _0x4e329f(_0x59fb60[_0xc5c3('0x18')]['message']);}else{logger[_0xc5c3('0x13')](_0xc5c3('0x14'),_0x14140f,_0xc5c3('0x17'));_0x4e329f(_0x59fb60[_0xc5c3('0x1b')][_0xc5c3('0x1a')]);}})['catch'](function(_0x364f42){logger[_0xc5c3('0x18')](_0xc5c3('0x14'),_0x14140f,_0x364f42);_0x1f2e34(_0x364f42);});});}exports[_0xc5c3('0x1c')]=function(_0x4e570f){var _0x25ef16=this;return new Promise(function(_0x41578a,_0x3cc612){return db[_0xc5c3('0x1d')][_0xc5c3('0x1e')](_0x4e570f['body'],{'raw':_0x4e570f[_0xc5c3('0x1f')]?_0x4e570f[_0xc5c3('0x1f')][_0xc5c3('0x20')]===undefined?!![]:![]:!![]})[_0xc5c3('0x12')](function(_0x1c5793){logger[_0xc5c3('0x13')](_0xc5c3('0x1c'),_0x4e570f);logger['debug']('CreateMailMessage',_0x4e570f,JSON[_0xc5c3('0x21')](_0x1c5793));_0x41578a(_0x1c5793);})[_0xc5c3('0x22')](function(_0x53ab72){logger['error'](_0xc5c3('0x1c'),_0x53ab72[_0xc5c3('0x1a')],_0x4e570f);_0x3cc612(_0x25ef16[_0xc5c3('0x18')](0x1f4,_0x53ab72['message']));});});}; \ No newline at end of file +var _0x6343=['jayson/promise','client','redis','defaults','socket.io-emitter','./mailMessage.socket','register','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','create','options','raw','moment','bluebird','../../config/logger','rpc'];(function(_0x4c0ce1,_0x3b3885){var _0x725c23=function(_0x2bd05c){while(--_0x2bd05c){_0x4c0ce1['push'](_0x4c0ce1['shift']());}};_0x725c23(++_0x3b3885);}(_0x6343,0x168));var _0x3634=function(_0x2ec702,_0x3ae1b7){_0x2ec702=_0x2ec702-0x0;var _0x16d5ba=_0x6343[_0x2ec702];return _0x16d5ba;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3634('0x0'));var BPromise=require(_0x3634('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3634('0x2'))(_0x3634('0x3'));var config=require('../../config/environment');var jayson=require(_0x3634('0x4'));var client=jayson[_0x3634('0x5')]['http']({'port':0x232a});config[_0x3634('0x6')]=_[_0x3634('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3634('0x8'))(new Redis(config[_0x3634('0x6')]));require(_0x3634('0x9'))[_0x3634('0xa')](socket);function respondWithRpcPromise(_0x2e8e8b,_0x43f681,_0x5e907a){return new BPromise(function(_0x4b965a,_0x31bcfc){return client[_0x3634('0xb')](_0x2e8e8b,_0x5e907a)['then'](function(_0x2bb4db){logger[_0x3634('0xc')](_0x3634('0xd'),_0x43f681,_0x3634('0xe'));logger[_0x3634('0xf')](_0x3634('0x10'),_0x43f681,_0x3634('0xe'),JSON[_0x3634('0x11')](_0x2bb4db));if(_0x2bb4db[_0x3634('0x12')]){if(_0x2bb4db[_0x3634('0x12')][_0x3634('0x13')]===0x1f4){logger[_0x3634('0x12')](_0x3634('0xd'),_0x43f681,_0x2bb4db[_0x3634('0x12')]['message']);return _0x31bcfc(_0x2bb4db[_0x3634('0x12')]['message']);}logger[_0x3634('0x12')](_0x3634('0xd'),_0x43f681,_0x2bb4db[_0x3634('0x12')][_0x3634('0x14')]);return _0x4b965a(_0x2bb4db[_0x3634('0x12')]['message']);}else{logger[_0x3634('0xc')]('MailMessage,\x20%s,\x20%s',_0x43f681,'request\x20sent');_0x4b965a(_0x2bb4db[_0x3634('0x15')]['message']);}})[_0x3634('0x16')](function(_0x32e3c6){logger[_0x3634('0x12')]('MailMessage,\x20%s,\x20%s',_0x43f681,_0x32e3c6);_0x31bcfc(_0x32e3c6);});});}exports[_0x3634('0x17')]=function(_0x4366bc){var _0x577a6c=this;return new Promise(function(_0xeb9231,_0x506281){return db[_0x3634('0x18')][_0x3634('0x19')](_0x4366bc['body'],{'raw':_0x4366bc[_0x3634('0x1a')]?_0x4366bc[_0x3634('0x1a')][_0x3634('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x22b7ef){logger[_0x3634('0xc')]('CreateMailMessage',_0x4366bc);logger[_0x3634('0xf')]('CreateMailMessage',_0x4366bc,JSON['stringify'](_0x22b7ef));_0xeb9231(_0x22b7ef);})[_0x3634('0x16')](function(_0x862ab5){logger['error'](_0x3634('0x17'),_0x862ab5[_0x3634('0x14')],_0x4366bc);_0x506281(_0x577a6c[_0x3634('0x12')](0x1f4,_0x862ab5[_0x3634('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index bd98871..7d56fe7 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 _0x86b6=['mailMessage:','./mailMessage.events','save','remove','update','register'];(function(_0x86e30c,_0x3b0d1b){var _0x3caba0=function(_0x3c71fc){while(--_0x3c71fc){_0x86e30c['push'](_0x86e30c['shift']());}};_0x3caba0(++_0x3b0d1b);}(_0x86b6,0x157));var _0x686b=function(_0x59e21c,_0x4d77b9){_0x59e21c=_0x59e21c-0x0;var _0x199b4c=_0x86b6[_0x59e21c];return _0x199b4c;};'use strict';var MailMessageEvents=require(_0x686b('0x0'));var events=[_0x686b('0x1'),_0x686b('0x2'),_0x686b('0x3')];function createListener(_0x51d849,_0x2a94ac){return function(_0x3a3b28){_0x2a94ac['emit'](_0x51d849,_0x3a3b28);};}function removeListener(_0x27a32f,_0x3e2048){return function(){MailMessageEvents['removeListener'](_0x27a32f,_0x3e2048);};}exports[_0x686b('0x4')]=function(_0xb2f371){for(var _0x388e70=0x0,_0x4cd47d=events['length'];_0x388e70<_0x4cd47d;_0x388e70++){var _0x1dd04c=events[_0x388e70];var _0x3d1388=createListener(_0x686b('0x5')+_0x1dd04c,_0xb2f371);MailMessageEvents['on'](_0x1dd04c,_0x3d1388);}}; \ No newline at end of file +var _0x80b4=['emit','removeListener','./mailMessage.events','save','remove','update'];(function(_0x495e6f,_0x378c59){var _0x327172=function(_0x422c6a){while(--_0x422c6a){_0x495e6f['push'](_0x495e6f['shift']());}};_0x327172(++_0x378c59);}(_0x80b4,0x6e));var _0x480b=function(_0x331671,_0x148089){_0x331671=_0x331671-0x0;var _0x14cc5b=_0x80b4[_0x331671];return _0x14cc5b;};'use strict';var MailMessageEvents=require(_0x480b('0x0'));var events=[_0x480b('0x1'),_0x480b('0x2'),_0x480b('0x3')];function createListener(_0x593a2d,_0x131b64){return function(_0x5f2dfd){_0x131b64[_0x480b('0x4')](_0x593a2d,_0x5f2dfd);};}function removeListener(_0x549a4e,_0x54eea5){return function(){MailMessageEvents[_0x480b('0x5')](_0x549a4e,_0x54eea5);};}exports['register']=function(_0x2ea0fd){for(var _0xe98874=0x0,_0x224a6d=events['length'];_0xe98874<_0x224a6d;_0xe98874++){var _0x5b990a=events[_0xe98874];var _0x1118ba=createListener('mailMessage:'+_0x5b990a,_0x2ea0fd);MailMessageEvents['on'](_0x5b990a,_0x1118ba);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 9b4cd19..ee4c430 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 _0x8388=['post','addTeams','addAgents','/:id','update','destroy','delete','removeTeams','removeAgents','exports','multer','util','path','express','fs-extra','../../components/auth/service','./mailQueue.controller','get','isAuthenticated','index','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','create'];(function(_0x35cb3a,_0x3302c6){var _0x9a73f8=function(_0x2d1ad1){while(--_0x2d1ad1){_0x35cb3a['push'](_0x35cb3a['shift']());}};_0x9a73f8(++_0x3302c6);}(_0x8388,0x1ba));var _0x8838=function(_0x1c0f41,_0x26d95d){_0x1c0f41=_0x1c0f41-0x0;var _0x369a9f=_0x8388[_0x1c0f41];return _0x369a9f;};'use strict';var multer=require(_0x8838('0x0'));var util=require(_0x8838('0x1'));var path=require(_0x8838('0x2'));var timeout=require('connect-timeout');var express=require(_0x8838('0x3'));var router=express['Router']();var fs_extra=require(_0x8838('0x4'));var auth=require(_0x8838('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8838('0x6'));router[_0x8838('0x7')]('/',auth[_0x8838('0x8')](),controller[_0x8838('0x9')]);router[_0x8838('0x7')]('/describe',auth[_0x8838('0x8')](),controller['describe']);router[_0x8838('0x7')]('/:id',auth[_0x8838('0x8')](),controller[_0x8838('0xa')]);router['get'](_0x8838('0xb'),auth[_0x8838('0x8')](),controller[_0x8838('0xc')]);router[_0x8838('0x7')](_0x8838('0xd'),auth['isAuthenticated'](),controller[_0x8838('0xe')]);router['get'](_0x8838('0xf'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0x8838('0x8')](),controller[_0x8838('0x10')]);router[_0x8838('0x11')](_0x8838('0xd'),auth[_0x8838('0x8')](),controller[_0x8838('0x12')]);router[_0x8838('0x11')](_0x8838('0xf'),auth[_0x8838('0x8')](),controller[_0x8838('0x13')]);router['put'](_0x8838('0x14'),auth[_0x8838('0x8')](),controller[_0x8838('0x15')]);router['delete']('/:id',auth[_0x8838('0x8')](),controller[_0x8838('0x16')]);router[_0x8838('0x17')]('/:id/teams',auth[_0x8838('0x8')](),controller[_0x8838('0x18')]);router[_0x8838('0x17')](_0x8838('0xf'),auth[_0x8838('0x8')](),controller[_0x8838('0x19')]);module[_0x8838('0x1a')]=router; \ No newline at end of file +var _0xbba9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','/:id','update','destroy','delete','removeTeams','removeAgents','multer'];(function(_0x15ddee,_0x9fa0de){var _0x4fff58=function(_0x447789){while(--_0x447789){_0x15ddee['push'](_0x15ddee['shift']());}};_0x4fff58(++_0x9fa0de);}(_0xbba9,0x116));var _0x9bba=function(_0x57ae0b,_0x30cbb8){_0x57ae0b=_0x57ae0b-0x0;var _0x564ca8=_0xbba9[_0x57ae0b];return _0x564ca8;};'use strict';var multer=require(_0x9bba('0x0'));var util=require(_0x9bba('0x1'));var path=require(_0x9bba('0x2'));var timeout=require(_0x9bba('0x3'));var express=require(_0x9bba('0x4'));var router=express[_0x9bba('0x5')]();var fs_extra=require(_0x9bba('0x6'));var auth=require(_0x9bba('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x9bba('0x8'));var controller=require(_0x9bba('0x9'));router[_0x9bba('0xa')]('/',auth[_0x9bba('0xb')](),controller[_0x9bba('0xc')]);router[_0x9bba('0xa')](_0x9bba('0xd'),auth['isAuthenticated'](),controller[_0x9bba('0xe')]);router[_0x9bba('0xa')]('/:id',auth[_0x9bba('0xb')](),controller[_0x9bba('0xf')]);router[_0x9bba('0xa')](_0x9bba('0x10'),auth[_0x9bba('0xb')](),controller['getMembers']);router[_0x9bba('0xa')]('/:id/teams',auth[_0x9bba('0xb')](),controller[_0x9bba('0x11')]);router[_0x9bba('0xa')]('/:id/users',auth[_0x9bba('0xb')](),controller[_0x9bba('0x12')]);router[_0x9bba('0x13')]('/',auth['isAuthenticated'](),controller[_0x9bba('0x14')]);router[_0x9bba('0x13')]('/:id/teams',auth['isAuthenticated'](),controller[_0x9bba('0x15')]);router['post'](_0x9bba('0x16'),auth[_0x9bba('0xb')](),controller[_0x9bba('0x17')]);router[_0x9bba('0x18')](_0x9bba('0x19'),auth[_0x9bba('0xb')](),controller[_0x9bba('0x1a')]);router['delete'](_0x9bba('0x19'),auth[_0x9bba('0xb')](),controller[_0x9bba('0x1b')]);router[_0x9bba('0x1c')]('/:id/teams',auth['isAuthenticated'](),controller[_0x9bba('0x1d')]);router[_0x9bba('0x1c')](_0x9bba('0x16'),auth[_0x9bba('0xb')](),controller[_0x9bba('0x1e')]);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 0e6a052..176f188 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 _0xb711=['name','INTEGER','ENUM','roundrobin','sequelize','STRING'];(function(_0x58b14f,_0x50833f){var _0x10ce5a=function(_0x43fea6){while(--_0x43fea6){_0x58b14f['push'](_0x58b14f['shift']());}};_0x10ce5a(++_0x50833f);}(_0xb711,0x12a));var _0x1b71=function(_0x98d384,_0x5c5d13){_0x98d384=_0x98d384-0x0;var _0xd95ed5=_0xb711[_0x98d384];return _0xd95ed5;};'use strict';var Sequelize=require(_0x1b71('0x0'));module['exports']={'name':{'type':Sequelize[_0x1b71('0x1')],'unique':_0x1b71('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1b71('0x1')]},'timeout':{'type':Sequelize[_0x1b71('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1b71('0x4')]('rrmemory','beepall',_0x1b71('0x5'))}}; \ No newline at end of file +var _0x20b4=['exports','STRING','name','INTEGER','rrmemory','roundrobin','sequelize'];(function(_0x1e38b9,_0x39ae75){var _0xd84f77=function(_0x35914b){while(--_0x35914b){_0x1e38b9['push'](_0x1e38b9['shift']());}};_0xd84f77(++_0x39ae75);}(_0x20b4,0x84));var _0x420b=function(_0x201920,_0x23a42e){_0x201920=_0x201920-0x0;var _0x11ca83=_0x20b4[_0x201920];return _0x11ca83;};'use strict';var Sequelize=require(_0x420b('0x0'));module[_0x420b('0x1')]={'name':{'type':Sequelize[_0x420b('0x2')],'unique':_0x420b('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x420b('0x2')]},'timeout':{'type':Sequelize[_0x420b('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x420b('0x5'),'beepall',_0x420b('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 5e7bfcc..b5bd1a7 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 _0x16c1=['count','set','Content-Range','apply','save','update','then','destroy','MailQueues','UserProfileResource','error','stack','name','send','index','map','MailQueue','fieldName','model','query','keys','filters','attributes','intersection','fields','nolimit','sort','pick','where','merge','type','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','get','role','user','UserProfileSection','userProfileId','autoAssociation','findOne','UserMailQueue','rawAttributes','length','hasOwnProperty','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','order','addTeams','ids','User','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','emit','userMailQueue:save','removeTeams','select','tq.TeamId','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','SELECT','includes','all','union','value','isEmpty','forEach','omit','spread','removeAgents','isArray','userMailQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','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','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x118eca,_0x28bc0a){var _0xe507c8=function(_0x493527){while(--_0x493527){_0x118eca['push'](_0x118eca['shift']());}};_0xe507c8(++_0x28bc0a);}(_0x16c1,0x66));var _0x116c=function(_0x5da65e,_0x37c881){_0x5da65e=_0x5da65e-0x0;var _0x4f1ea3=_0x16c1[_0x5da65e];return _0x4f1ea3;};'use strict';var emlformat=require(_0x116c('0x0'));var rimraf=require(_0x116c('0x1'));var zipdir=require(_0x116c('0x2'));var jsonpatch=require(_0x116c('0x3'));var rp=require(_0x116c('0x4'));var moment=require(_0x116c('0x5'));var BPromise=require(_0x116c('0x6'));var Mustache=require(_0x116c('0x7'));var util=require(_0x116c('0x8'));var path=require('path');var sox=require(_0x116c('0x9'));var csv=require('to-csv');var ejs=require(_0x116c('0xa'));var fs=require('fs');var fs_extra=require(_0x116c('0xb'));var _=require(_0x116c('0xc'));var squel=require(_0x116c('0xd'));var crypto=require(_0x116c('0xe'));var jsforce=require(_0x116c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x116c('0x10'));var querystring=require(_0x116c('0x11'));var Papa=require(_0x116c('0x12'));var Redis=require(_0x116c('0x13'));var authService=require(_0x116c('0x14'));var qs=require(_0x116c('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x116c('0x16'));var logger=require(_0x116c('0x17'))(_0x116c('0x18'));var utils=require(_0x116c('0x19'));var config=require(_0x116c('0x1a'));var licenseUtil=require(_0x116c('0x1b'));var db=require(_0x116c('0x1c'))['db'];config[_0x116c('0x1d')]=_[_0x116c('0x1e')](config['redis'],{'host':_0x116c('0x1f'),'port':0x18eb});var socket=require(_0x116c('0x20'))(new Redis(config[_0x116c('0x1d')]));require(_0x116c('0x21'))['register'](socket);function respondWithStatusCode(_0x2da2d7,_0x1a4646){_0x1a4646=_0x1a4646||0xcc;return function(_0x22c1f9){if(_0x22c1f9){return _0x2da2d7[_0x116c('0x22')](_0x1a4646);}return _0x2da2d7[_0x116c('0x23')](_0x1a4646)[_0x116c('0x24')]();};}function respondWithResult(_0x5e5d06,_0x493aa7){_0x493aa7=_0x493aa7||0xc8;return function(_0x357d9f){if(_0x357d9f){return _0x5e5d06[_0x116c('0x23')](_0x493aa7)[_0x116c('0x25')](_0x357d9f);}};}function respondWithFilteredResult(_0x1d026c,_0x2a890e){return function(_0x29b75e){if(_0x29b75e){var _0x5c198f=typeof _0x2a890e[_0x116c('0x26')]===_0x116c('0x27')&&typeof _0x2a890e[_0x116c('0x28')]===_0x116c('0x27');var _0x288eb2=_0x29b75e[_0x116c('0x29')];var _0x320bdc=_0x5c198f?0x0:_0x2a890e[_0x116c('0x26')];var _0x53110e=_0x5c198f?_0x29b75e[_0x116c('0x29')]:_0x2a890e['offset']+_0x2a890e[_0x116c('0x28')];var _0x3b7f9e;if(_0x53110e>=_0x288eb2){_0x53110e=_0x288eb2;_0x3b7f9e=0xc8;}else{_0x3b7f9e=0xce;}_0x1d026c['status'](_0x3b7f9e);return _0x1d026c[_0x116c('0x2a')](_0x116c('0x2b'),_0x320bdc+'-'+_0x53110e+'/'+_0x288eb2)['json'](_0x29b75e);}return null;};}function patchUpdates(_0x330ed9){return function(_0x5a68ec){try{jsonpatch[_0x116c('0x2c')](_0x5a68ec,_0x330ed9,!![]);}catch(_0x538ce0){return BPromise['reject'](_0x538ce0);}return _0x5a68ec[_0x116c('0x2d')]();};}function saveUpdates(_0x4ad2c5,_0x46a3bd){return function(_0x35ba32){if(_0x35ba32){return _0x35ba32[_0x116c('0x2e')](_0x4ad2c5)[_0x116c('0x2f')](function(_0x5a879b){return _0x5a879b;});}return null;};}function removeEntity(_0x432cac,_0x40b219){return function(_0x34a39e){if(_0x34a39e){return _0x34a39e[_0x116c('0x30')]()[_0x116c('0x2f')](function(){var _0x101d19=_0x34a39e['get']({'plain':!![]});var _0x5c255a=_0x116c('0x31');return db[_0x116c('0x32')][_0x116c('0x30')]({'where':{'type':_0x5c255a,'resourceId':_0x101d19['id']}})[_0x116c('0x2f')](function(){return _0x34a39e;});})[_0x116c('0x2f')](function(){_0x432cac[_0x116c('0x23')](0xcc)[_0x116c('0x24')]();});}};}function handleEntityNotFound(_0x2ba6b4,_0x2a1140){return function(_0x4330fd){if(!_0x4330fd){_0x2ba6b4[_0x116c('0x22')](0x194);}return _0x4330fd;};}function handleError(_0x433906,_0x11b75f){_0x11b75f=_0x11b75f||0x1f4;return function(_0x20b3e7){logger[_0x116c('0x33')](_0x20b3e7[_0x116c('0x34')]);if(_0x20b3e7[_0x116c('0x35')]){delete _0x20b3e7[_0x116c('0x35')];}_0x433906[_0x116c('0x23')](_0x11b75f)[_0x116c('0x36')](_0x20b3e7);};}exports[_0x116c('0x37')]=function(_0x10493d,_0x3e5826){var _0x408f43={},_0x5adba7={},_0x2046bc={'count':0x0,'rows':[]};var _0x500222=_[_0x116c('0x38')](db[_0x116c('0x39')]['rawAttributes'],function(_0x21a274){return{'name':_0x21a274[_0x116c('0x3a')],'type':_0x21a274['type']['key']};});_0x5adba7[_0x116c('0x3b')]=_[_0x116c('0x38')](_0x500222,_0x116c('0x35'));_0x5adba7[_0x116c('0x3c')]=_[_0x116c('0x3d')](_0x10493d[_0x116c('0x3c')]);_0x5adba7[_0x116c('0x3e')]=_['intersection'](_0x5adba7[_0x116c('0x3b')],_0x5adba7[_0x116c('0x3c')]);_0x408f43[_0x116c('0x3f')]=_[_0x116c('0x40')](_0x5adba7[_0x116c('0x3b')],qs[_0x116c('0x41')](_0x10493d[_0x116c('0x3c')][_0x116c('0x41')]));_0x408f43['attributes']=_0x408f43[_0x116c('0x3f')]['length']?_0x408f43[_0x116c('0x3f')]:_0x5adba7[_0x116c('0x3b')];if(!_0x10493d[_0x116c('0x3c')]['hasOwnProperty'](_0x116c('0x42'))){_0x408f43[_0x116c('0x28')]=qs[_0x116c('0x28')](_0x10493d[_0x116c('0x3c')]['limit']);_0x408f43[_0x116c('0x26')]=qs[_0x116c('0x26')](_0x10493d[_0x116c('0x3c')][_0x116c('0x26')]);}_0x408f43['order']=qs[_0x116c('0x43')](_0x10493d['query']['sort']);_0x408f43['where']=qs[_0x116c('0x3e')](_[_0x116c('0x44')](_0x10493d[_0x116c('0x3c')],_0x5adba7[_0x116c('0x3e')]),_0x500222);if(_0x10493d[_0x116c('0x3c')]['filter']){_0x408f43[_0x116c('0x45')]=_[_0x116c('0x46')](_0x408f43[_0x116c('0x45')],{'$or':_[_0x116c('0x38')](_0x500222,function(_0x194eb3){if(_0x194eb3[_0x116c('0x47')]!==_0x116c('0x48')){var _0xba8ee={};_0xba8ee[_0x194eb3[_0x116c('0x35')]]={'$like':'%'+_0x10493d[_0x116c('0x3c')][_0x116c('0x49')]+'%'};return _0xba8ee;}})});}_0x408f43=_[_0x116c('0x46')]({},_0x408f43,_0x10493d[_0x116c('0x4a')]);var _0x33e5df={'where':_0x408f43[_0x116c('0x45')]};return db[_0x116c('0x39')]['count'](_0x33e5df)[_0x116c('0x2f')](function(_0x1e6419){_0x2046bc[_0x116c('0x29')]=_0x1e6419;if(_0x10493d['query']['includeAll']){_0x408f43[_0x116c('0x4b')]=[{'all':!![]}];}return db[_0x116c('0x39')][_0x116c('0x4c')](_0x408f43);})['then'](function(_0xe751bd){_0x2046bc[_0x116c('0x4d')]=_0xe751bd;return _0x2046bc;})['then'](respondWithFilteredResult(_0x3e5826,_0x408f43))[_0x116c('0x4e')](handleError(_0x3e5826,null));};exports[_0x116c('0x4f')]=function(_0x4e48e6,_0x1416b7){var _0x4e471f={'raw':!![],'where':{'id':_0x4e48e6[_0x116c('0x50')]['id']}},_0x3a5b9f={};_0x3a5b9f[_0x116c('0x3b')]=_[_0x116c('0x3d')](db[_0x116c('0x39')]['rawAttributes']);_0x3a5b9f[_0x116c('0x3c')]=_[_0x116c('0x3d')](_0x4e48e6[_0x116c('0x3c')]);_0x3a5b9f[_0x116c('0x3e')]=_['intersection'](_0x3a5b9f[_0x116c('0x3b')],_0x3a5b9f[_0x116c('0x3c')]);_0x4e471f[_0x116c('0x3f')]=_[_0x116c('0x40')](_0x3a5b9f[_0x116c('0x3b')],qs[_0x116c('0x41')](_0x4e48e6[_0x116c('0x3c')][_0x116c('0x41')]));_0x4e471f['attributes']=_0x4e471f['attributes']['length']?_0x4e471f[_0x116c('0x3f')]:_0x3a5b9f[_0x116c('0x3b')];if(_0x4e48e6[_0x116c('0x3c')][_0x116c('0x51')]){_0x4e471f[_0x116c('0x4b')]=[{'all':!![]}];}_0x4e471f=_[_0x116c('0x46')]({},_0x4e471f,_0x4e48e6[_0x116c('0x4a')]);return db['MailQueue'][_0x116c('0x52')](_0x4e471f)[_0x116c('0x2f')](handleEntityNotFound(_0x1416b7,null))[_0x116c('0x2f')](respondWithResult(_0x1416b7,null))[_0x116c('0x4e')](handleError(_0x1416b7,null));};exports[_0x116c('0x53')]=function(_0x244653,_0x38820e){return db[_0x116c('0x39')][_0x116c('0x53')](_0x244653[_0x116c('0x54')],{})['then'](function(_0x34eac2){var _0x105856=_0x244653['user'][_0x116c('0x55')]({'plain':!![]});if(!_0x105856)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x105856[_0x116c('0x56')]===_0x116c('0x57')){var _0x5c2249=_0x34eac2['get']({'plain':!![]});var _0x5f4a5e=_0x116c('0x31');return db[_0x116c('0x58')][_0x116c('0x52')]({'where':{'name':_0x5f4a5e,'userProfileId':_0x105856[_0x116c('0x59')]},'raw':!![]})['then'](function(_0x199272){if(_0x199272&&_0x199272[_0x116c('0x5a')]===0x0){return db[_0x116c('0x32')]['create']({'name':_0x5c2249[_0x116c('0x35')],'resourceId':_0x5c2249['id'],'type':_0x199272['name'],'sectionId':_0x199272['id']},{})[_0x116c('0x2f')](function(){return _0x34eac2;});}else{return _0x34eac2;}})[_0x116c('0x4e')](function(_0x3a916d){logger[_0x116c('0x33')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a916d);throw _0x3a916d;});}return _0x34eac2;})[_0x116c('0x2f')](respondWithResult(_0x38820e,0xc9))[_0x116c('0x4e')](handleError(_0x38820e,null));};exports['update']=function(_0x271ee5,_0x29096f){if(_0x271ee5[_0x116c('0x54')]['id']){delete _0x271ee5[_0x116c('0x54')]['id'];}return db[_0x116c('0x39')][_0x116c('0x52')]({'where':{'id':_0x271ee5[_0x116c('0x50')]['id']}})['then'](handleEntityNotFound(_0x29096f,null))[_0x116c('0x2f')](saveUpdates(_0x271ee5[_0x116c('0x54')],null))['then'](respondWithResult(_0x29096f,null))['catch'](handleError(_0x29096f,null));};exports[_0x116c('0x30')]=function(_0x579461,_0x1ca7a0){return db[_0x116c('0x39')][_0x116c('0x52')]({'where':{'id':_0x579461[_0x116c('0x50')]['id']}})[_0x116c('0x2f')](handleEntityNotFound(_0x1ca7a0,null))[_0x116c('0x2f')](removeEntity(_0x1ca7a0,null))[_0x116c('0x4e')](handleError(_0x1ca7a0,null));};exports['describe']=function(_0x44f4dc,_0x38b8ff){return db[_0x116c('0x39')]['describe']()[_0x116c('0x2f')](respondWithResult(_0x38b8ff,null))['catch'](handleError(_0x38b8ff,null));};exports['getMembers']=function(_0xeca4b,_0x21dd58,_0x4d99d6){var _0x4d5fbd={'raw':!![],'where':{}},_0x548cb3={},_0x9552dd;return db[_0x116c('0x39')][_0x116c('0x5b')]({'where':{'id':_0xeca4b[_0x116c('0x50')]['id']}})[_0x116c('0x2f')](handleEntityNotFound(_0x21dd58,null))[_0x116c('0x2f')](function(_0x3860c8){if(_0x3860c8){_0x9552dd=_0x3860c8[_0x116c('0x55')]({'plain':!![]});_0x548cb3[_0x116c('0x3b')]=_[_0x116c('0x3d')](db[_0x116c('0x5c')][_0x116c('0x5d')]);_0x548cb3[_0x116c('0x3c')]=_[_0x116c('0x3d')](_0xeca4b[_0x116c('0x3c')]);_0x548cb3['filters']=_[_0x116c('0x40')](_0x548cb3['model'],_0x548cb3[_0x116c('0x3c')]);_0x4d5fbd[_0x116c('0x3f')]=_[_0x116c('0x40')](_0x548cb3[_0x116c('0x3b')],qs[_0x116c('0x41')](_0xeca4b['query'][_0x116c('0x41')]));_0x4d5fbd[_0x116c('0x3f')]=_0x4d5fbd['attributes'][_0x116c('0x5e')]?_0x4d5fbd[_0x116c('0x3f')]:_0x548cb3[_0x116c('0x3b')];if(!_0xeca4b[_0x116c('0x3c')][_0x116c('0x5f')](_0x116c('0x42'))){_0x4d5fbd['limit']=qs['limit'](_0xeca4b['query'][_0x116c('0x28')]);_0x4d5fbd[_0x116c('0x26')]=qs['offset'](_0xeca4b[_0x116c('0x3c')][_0x116c('0x26')]);}_0x4d5fbd['order']=qs[_0x116c('0x43')](_0xeca4b[_0x116c('0x3c')][_0x116c('0x43')]);_0x4d5fbd[_0x116c('0x45')]=qs[_0x116c('0x3e')](_[_0x116c('0x44')](_0xeca4b['query'],_0x548cb3[_0x116c('0x3e')]));_0x4d5fbd[_0x116c('0x45')]['MailQueueId']=_0x3860c8['id'];if(_0xeca4b[_0x116c('0x3c')][_0x116c('0x49')]){_0x4d5fbd[_0x116c('0x45')]=_[_0x116c('0x46')](_0x4d5fbd['where'],{'$or':_[_0x116c('0x38')](_0x4d5fbd['attributes'],function(_0x385da3){var _0x180584={};_0x180584[_0x385da3]={'$like':'%'+_0xeca4b[_0x116c('0x3c')][_0x116c('0x49')]+'%'};return _0x180584;})});}_0x4d5fbd=_[_0x116c('0x46')]({},_0x4d5fbd,_0xeca4b[_0x116c('0x4a')]);return db['UserMailQueue'][_0x116c('0x4c')](_0x4d5fbd);}})['then'](function(_0x2c58e0){if(_0x2c58e0){return db['User']['findAndCountAll']({'where':{'id':_[_0x116c('0x38')](_0x2c58e0,_0x116c('0x60')),'role':_0x116c('0x61')},'attributes':['id',_0x116c('0x35'),_0x116c('0x62'),_0x116c('0x63'),_0x116c('0x64')]});}})[_0x116c('0x2f')](function(_0x1b7780){if(_0x1b7780){return{'count':_0x1b7780['count'],'rows':_['map'](_0x1b7780['rows'],function(_0x245b91){return{'membername':_0x245b91[_0x116c('0x35')],'UserId':_0x245b91['id'],'queue_name':_0x9552dd[_0x116c('0x35')],'MailQueueId':_0x9552dd['id'],'interface':util[_0x116c('0x65')](_0x116c('0x66'),_0x116c('0x67'),_0x245b91[_0x116c('0x35')]),'penalty':0x0,'paused':_0x245b91[_0x116c('0x62')],'createdAt':_0x245b91[_0x116c('0x64')],'updatedAt':_0x245b91[_0x116c('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x116c('0x2f')](respondWithFilteredResult(_0x21dd58,_0x4d5fbd))['catch'](handleError(_0x21dd58,null));};exports[_0x116c('0x68')]=function(_0x320e28,_0x50b192,_0x548378){var _0x49cf22={};var _0x40b745={};var _0x266bf1;var _0x5a1748;return db[_0x116c('0x39')][_0x116c('0x5b')]({'where':{'id':_0x320e28[_0x116c('0x50')]['id']}})[_0x116c('0x2f')](handleEntityNotFound(_0x50b192,null))[_0x116c('0x2f')](function(_0x13acf7){if(_0x13acf7){_0x266bf1=_0x13acf7;_0x40b745[_0x116c('0x3b')]=_[_0x116c('0x3d')](db[_0x116c('0x69')]['rawAttributes']);_0x40b745[_0x116c('0x3c')]=_[_0x116c('0x3d')](_0x320e28[_0x116c('0x3c')]);_0x40b745[_0x116c('0x3e')]=_[_0x116c('0x40')](_0x40b745[_0x116c('0x3b')],_0x40b745['query']);_0x49cf22['attributes']=_[_0x116c('0x40')](_0x40b745[_0x116c('0x3b')],qs[_0x116c('0x41')](_0x320e28[_0x116c('0x3c')][_0x116c('0x41')]));_0x49cf22[_0x116c('0x3f')]=_0x49cf22['attributes'][_0x116c('0x5e')]?_0x49cf22['attributes']:_0x40b745[_0x116c('0x3b')];_0x49cf22[_0x116c('0x6a')]=qs[_0x116c('0x43')](_0x320e28[_0x116c('0x3c')][_0x116c('0x43')]);_0x49cf22[_0x116c('0x45')]=qs[_0x116c('0x3e')](_[_0x116c('0x44')](_0x320e28[_0x116c('0x3c')],_0x40b745['filters']));if(_0x320e28[_0x116c('0x3c')]['filter']){_0x49cf22[_0x116c('0x45')]=_[_0x116c('0x46')](_0x49cf22['where'],{'$or':_[_0x116c('0x38')](_0x49cf22[_0x116c('0x3f')],function(_0x3f2a16){var _0xf1cc75={};_0xf1cc75[_0x3f2a16]={'$like':'%'+_0x320e28[_0x116c('0x3c')][_0x116c('0x49')]+'%'};return _0xf1cc75;})});}_0x49cf22=_[_0x116c('0x46')]({},_0x49cf22,_0x320e28[_0x116c('0x4a')]);return _0x266bf1[_0x116c('0x68')](_0x49cf22);}})['then'](function(_0x442462){if(_0x442462){_0x5a1748=_0x442462[_0x116c('0x5e')];if(!_0x320e28[_0x116c('0x3c')][_0x116c('0x5f')](_0x116c('0x42'))){_0x49cf22['limit']=qs[_0x116c('0x28')](_0x320e28[_0x116c('0x3c')][_0x116c('0x28')]);_0x49cf22[_0x116c('0x26')]=qs[_0x116c('0x26')](_0x320e28['query'][_0x116c('0x26')]);}return _0x266bf1[_0x116c('0x68')](_0x49cf22);}})[_0x116c('0x2f')](function(_0x2e48d2){if(_0x2e48d2){return _0x2e48d2?{'count':_0x5a1748,'rows':_0x2e48d2}:null;}})['then'](respondWithResult(_0x50b192,null))['catch'](handleError(_0x50b192,null));};exports[_0x116c('0x6b')]=function(_0x1b928e,_0x44cdd9,_0x1e698c){var _0x562022=_0x1b928e[_0x116c('0x54')][_0x116c('0x6c')];return db['Team'][_0x116c('0x4c')]({'where':{'id':_0x562022},'attributes':['id'],'include':[{'model':db[_0x116c('0x6d')],'as':_0x116c('0x6e'),'attributes':['id',_0x116c('0x35'),_0x116c('0x6f'),_0x116c('0x70'),'interface'],'raw':!![]}]})['then'](function(_0x19f4e5){if(_0x19f4e5){var _0x1ef93b=_[_0x116c('0x71')](_0x19f4e5,function(_0x472a8e){var _0x43801b=_0x472a8e[_0x116c('0x55')]({'plain':!![]});return _0x43801b[_0x116c('0x6e')];});return db['MailQueue'][_0x116c('0x52')]({'where':{'id':_0x1b928e[_0x116c('0x50')]['id']}})['then'](function(_0x1ba07a){return db[_0x116c('0x72')][_0x116c('0x73')](function(_0x3455ac){return _0x1ba07a['addTeams'](_0x562022,{'transaction':_0x3455ac})[_0x116c('0x2f')](function(){return BPromise[_0x116c('0x74')](_0x1ef93b,function(_0x4516bf){return db[_0x116c('0x5c')][_0x116c('0x75')]({'where':{'UserId':_0x4516bf['id'],'MailQueueId':_0x1b928e[_0x116c('0x50')]['id']},'transaction':_0x3455ac});});})[_0x116c('0x2f')](function(){_0x1ef93b['forEach'](function(_0x5469bc){socket[_0x116c('0x76')](_0x116c('0x77'),{'UserId':_0x5469bc['id'],'MailQueueId':_0x1ba07a['id']});});});});});}})['then'](respondWithStatusCode(_0x44cdd9,null))[_0x116c('0x4e')](handleError(_0x44cdd9,null));};exports[_0x116c('0x78')]=function(_0x15d457,_0x4b6315,_0x242ade){return db[_0x116c('0x69')][_0x116c('0x4c')]({'where':{'id':_0x15d457['query'][_0x116c('0x6c')]},'attributes':['id'],'include':[{'model':db[_0x116c('0x6d')],'as':_0x116c('0x6e'),'attributes':['id'],'raw':!![]}]})[_0x116c('0x2f')](handleEntityNotFound(_0x4b6315,null))[_0x116c('0x2f')](function(_0x5da792){var _0x139ac4=_['map'](_0x5da792,'id');var _0x180348=[];var _0x3dba4a=[];var _0x2ab64a=squel[_0x116c('0x79')]();_0x2ab64a['field'](_0x116c('0x7a'))['from'](_0x116c('0x7b'),'tq')[_0x116c('0x7c')](_0x116c('0x7d'),'ut',_0x116c('0x7e'))['where'](_0x116c('0x7f'),_0x15d457['params']['id']);for(var _0x46fffc=0x0;_0x46fffc<_0x5da792[_0x116c('0x5e')];_0x46fffc+=0x1){let _0x5b2ae6=_0x5da792[_0x46fffc];for(var _0x4cc7fb=0x0;_0x4cc7fb<_0x5b2ae6['Agents'][_0x116c('0x5e')];_0x4cc7fb+=0x1){let _0x2f9d43=_0x5b2ae6[_0x116c('0x6e')][_0x4cc7fb];var _0x144564=_0x2ab64a[_0x116c('0x80')]();_0x144564[_0x116c('0x45')](_0x116c('0x81'),_0x2f9d43['id']);_0x3dba4a['push'](db['sequelize'][_0x116c('0x3c')](_0x144564['toString'](),{'type':db[_0x116c('0x72')]['QueryTypes'][_0x116c('0x82')]})[_0x116c('0x2f')](function(_0x2ebc99){if(_0x2ebc99['length']===0x1){return _0x2f9d43['id'];}else{var _0x14cb26=_['every'](_[_0x116c('0x38')](_0x2ebc99,'TeamId'),function(_0x449eae){return _[_0x116c('0x83')](_0x139ac4,_0x449eae);});if(_0x14cb26){return _0x2f9d43['id'];}}}));}}return BPromise[_0x116c('0x84')](_0x3dba4a)[_0x116c('0x2f')](function(_0x324218){_0x180348=_(_0x180348)[_0x116c('0x85')](_0x324218)['compact']()[_0x116c('0x86')]();return db['MailQueue'][_0x116c('0x52')]({'where':{'id':_0x15d457[_0x116c('0x50')]['id']}})[_0x116c('0x2f')](function(_0xfb27e3){return db[_0x116c('0x72')]['transaction'](function(_0x5e740f){return _0xfb27e3[_0x116c('0x78')](_0x15d457[_0x116c('0x3c')][_0x116c('0x6c')],{'transaction':_0x5e740f})['then'](function(){if(!_[_0x116c('0x87')](_0x180348)){return _0xfb27e3['removeAgents'](_0x180348,{'transaction':_0x5e740f});}})[_0x116c('0x2f')](function(){_0x180348[_0x116c('0x88')](function(_0x9a8302){socket[_0x116c('0x76')]('userMailQueue:remove',{'UserId':_0x9a8302,'MailQueueId':_0xfb27e3['id']});});});});});});})[_0x116c('0x2f')](respondWithStatusCode(_0x4b6315,null))['catch'](handleError(_0x4b6315,null));};exports['addAgents']=function(_0x4e4f69,_0x116b2f,_0x5d4e68){return db[_0x116c('0x39')]['find']({'where':{'id':_0x4e4f69['params']['id']}})[_0x116c('0x2f')](handleEntityNotFound(_0x116b2f,null))[_0x116c('0x2f')](function(_0x579823){if(_0x579823){return _0x579823['addAgents'](_0x4e4f69['body'][_0x116c('0x6c')],_[_0x116c('0x89')](_0x4e4f69[_0x116c('0x54')],[_0x116c('0x6c'),'id'])||{})[_0x116c('0x8a')](function(_0x31367b){for(var _0x48a048=0x0;_0x48a048<_0x4e4f69['body'][_0x116c('0x6c')][_0x116c('0x5e')];_0x48a048+=0x1){socket['emit'](_0x116c('0x77'),{'UserId':Number(_0x4e4f69['body'][_0x116c('0x6c')][_0x48a048]),'MailQueueId':Number(_0x4e4f69[_0x116c('0x50')]['id'])});}return _0x31367b;});}})['then'](respondWithResult(_0x116b2f,null))[_0x116c('0x4e')](handleError(_0x116b2f,null));};exports[_0x116c('0x8b')]=function(_0x1cc352,_0x29d5f7,_0x44ce3a){return db[_0x116c('0x39')][_0x116c('0x52')]({'where':{'id':_0x1cc352[_0x116c('0x50')]['id']}})[_0x116c('0x2f')](handleEntityNotFound(_0x29d5f7,null))[_0x116c('0x2f')](function(_0x45fc5a){if(_0x45fc5a){return _0x45fc5a[_0x116c('0x8b')](_0x1cc352[_0x116c('0x3c')][_0x116c('0x6c')])[_0x116c('0x2f')](function(){if(_[_0x116c('0x8c')](_0x1cc352['query'][_0x116c('0x6c')])){for(var _0x546bde=0x0;_0x546bde<_0x1cc352[_0x116c('0x3c')][_0x116c('0x6c')][_0x116c('0x5e')];_0x546bde+=0x1){socket[_0x116c('0x76')](_0x116c('0x8d'),{'UserId':Number(_0x1cc352['query'][_0x116c('0x6c')][_0x546bde]),'MailQueueId':Number(_0x1cc352[_0x116c('0x50')]['id'])});}}else{socket[_0x116c('0x76')]('userMailQueue:remove',{'UserId':Number(_0x1cc352[_0x116c('0x3c')][_0x116c('0x6c')]),'MailQueueId':Number(_0x1cc352[_0x116c('0x50')]['id'])});}});}})[_0x116c('0x2f')](respondWithStatusCode(_0x29d5f7,null))['catch'](handleError(_0x29d5f7,null));};exports[_0x116c('0x8e')]=function(_0x5a9e02,_0x1aaa4f,_0x5d8a48){var _0x3fe99c={};var _0x1ef3bf={};var _0x3e5041;var _0x3ecaa4;return db['MailQueue'][_0x116c('0x5b')]({'where':{'id':_0x5a9e02[_0x116c('0x50')]['id']}})[_0x116c('0x2f')](handleEntityNotFound(_0x1aaa4f,null))['then'](function(_0x253cf1){if(_0x253cf1){_0x3e5041=_0x253cf1;_0x1ef3bf[_0x116c('0x3b')]=_[_0x116c('0x3d')](db[_0x116c('0x6d')][_0x116c('0x5d')]);_0x1ef3bf['query']=_[_0x116c('0x3d')](_0x5a9e02['query']);_0x1ef3bf['filters']=_['intersection'](_0x1ef3bf[_0x116c('0x3b')],_0x1ef3bf[_0x116c('0x3c')]);_0x3fe99c[_0x116c('0x3f')]=_[_0x116c('0x40')](_0x1ef3bf[_0x116c('0x3b')],qs[_0x116c('0x41')](_0x5a9e02[_0x116c('0x3c')][_0x116c('0x41')]));_0x3fe99c[_0x116c('0x3f')]=_0x3fe99c[_0x116c('0x3f')][_0x116c('0x5e')]?_0x3fe99c['attributes']:_0x1ef3bf[_0x116c('0x3b')];_0x3fe99c[_0x116c('0x6a')]=qs[_0x116c('0x43')](_0x5a9e02[_0x116c('0x3c')][_0x116c('0x43')]);_0x3fe99c['where']=qs['filters'](_['pick'](_0x5a9e02['query'],_0x1ef3bf[_0x116c('0x3e')]));if(_0x5a9e02['query']['filter']){_0x3fe99c[_0x116c('0x45')]=_['merge'](_0x3fe99c[_0x116c('0x45')],{'$or':_[_0x116c('0x38')](_0x3fe99c[_0x116c('0x3f')],function(_0x333f81){var _0x5c0191={};_0x5c0191[_0x333f81]={'$like':'%'+_0x5a9e02[_0x116c('0x3c')][_0x116c('0x49')]+'%'};return _0x5c0191;})});}_0x3fe99c=_[_0x116c('0x46')]({},_0x3fe99c,_0x5a9e02['options']);return _0x3e5041['getAgents'](_0x3fe99c);}})[_0x116c('0x2f')](function(_0x348b52){if(_0x348b52){_0x3ecaa4=_0x348b52[_0x116c('0x5e')];if(!_0x5a9e02[_0x116c('0x3c')][_0x116c('0x5f')](_0x116c('0x42'))){_0x3fe99c[_0x116c('0x28')]=qs['limit'](_0x5a9e02[_0x116c('0x3c')][_0x116c('0x28')]);_0x3fe99c['offset']=qs[_0x116c('0x26')](_0x5a9e02['query'][_0x116c('0x26')]);}return _0x3e5041[_0x116c('0x8e')](_0x3fe99c);}})[_0x116c('0x2f')](function(_0x454e93){if(_0x454e93){return _0x454e93?{'count':_0x3ecaa4,'rows':_0x454e93}:null;}})[_0x116c('0x2f')](respondWithResult(_0x1aaa4f,null))['catch'](handleError(_0x1aaa4f,null));}; \ No newline at end of file +var _0x1d60=['query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserMailQueue','pick','User','findAndCountAll','UserId','agent','mailPause','createdAt','format','SIP','getTeams','Team','Agents','online','voicePause','interface','transaction','addTeams','each','findOrCreate','forEach','emit','userMailQueue:save','select','field','tq.TeamId','from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','all','compact','value','removeTeams','isEmpty','removeAgents','userMailQueue:remove','addAgents','ids','omit','isArray','getAgents','hasOwnProperty','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','get','MailQueues','sendStatus','error','stack','name','map','MailQueue','rawAttributes','type','key','model'];(function(_0xb60c0e,_0x190168){var _0x14047c=function(_0x3320e5){while(--_0x3320e5){_0xb60c0e['push'](_0xb60c0e['shift']());}};_0x14047c(++_0x190168);}(_0x1d60,0xe8));var _0x01d6=function(_0x9215b9,_0x35e2a2){_0x9215b9=_0x9215b9-0x0;var _0x4f9ddb=_0x1d60[_0x9215b9];return _0x4f9ddb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x01d6('0x0'));var rp=require(_0x01d6('0x1'));var moment=require(_0x01d6('0x2'));var BPromise=require(_0x01d6('0x3'));var Mustache=require(_0x01d6('0x4'));var util=require(_0x01d6('0x5'));var path=require('path');var sox=require(_0x01d6('0x6'));var csv=require('to-csv');var ejs=require(_0x01d6('0x7'));var fs=require('fs');var fs_extra=require(_0x01d6('0x8'));var _=require('lodash');var squel=require(_0x01d6('0x9'));var crypto=require(_0x01d6('0xa'));var jsforce=require(_0x01d6('0xb'));var deskjs=require(_0x01d6('0xc'));var toCsv=require('to-csv');var querystring=require(_0x01d6('0xd'));var Papa=require(_0x01d6('0xe'));var Redis=require(_0x01d6('0xf'));var authService=require(_0x01d6('0x10'));var qs=require(_0x01d6('0x11'));var as=require(_0x01d6('0x12'));var hardwareService=require(_0x01d6('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x01d6('0x14'));var config=require(_0x01d6('0x15'));var licenseUtil=require(_0x01d6('0x16'));var db=require(_0x01d6('0x17'))['db'];config['redis']=_[_0x01d6('0x18')](config[_0x01d6('0x19')],{'host':_0x01d6('0x1a'),'port':0x18eb});var socket=require(_0x01d6('0x1b'))(new Redis(config[_0x01d6('0x19')]));require(_0x01d6('0x1c'))[_0x01d6('0x1d')](socket);function respondWithStatusCode(_0x42e883,_0xcc409e){_0xcc409e=_0xcc409e||0xcc;return function(_0xaebef0){if(_0xaebef0){return _0x42e883['sendStatus'](_0xcc409e);}return _0x42e883[_0x01d6('0x1e')](_0xcc409e)[_0x01d6('0x1f')]();};}function respondWithResult(_0x2c4325,_0x2d4d87){_0x2d4d87=_0x2d4d87||0xc8;return function(_0x570997){if(_0x570997){return _0x2c4325['status'](_0x2d4d87)[_0x01d6('0x20')](_0x570997);}};}function respondWithFilteredResult(_0x9288ce,_0x2adc64){return function(_0x3a5714){if(_0x3a5714){var _0x228f2a=typeof _0x2adc64[_0x01d6('0x21')]===_0x01d6('0x22')&&typeof _0x2adc64[_0x01d6('0x23')]===_0x01d6('0x22');var _0x142948=_0x3a5714['count'];var _0x59a7d3=_0x228f2a?0x0:_0x2adc64['offset'];var _0x1cbb6c=_0x228f2a?_0x3a5714[_0x01d6('0x24')]:_0x2adc64[_0x01d6('0x21')]+_0x2adc64['limit'];var _0x410259;if(_0x1cbb6c>=_0x142948){_0x1cbb6c=_0x142948;_0x410259=0xc8;}else{_0x410259=0xce;}_0x9288ce[_0x01d6('0x1e')](_0x410259);return _0x9288ce[_0x01d6('0x25')](_0x01d6('0x26'),_0x59a7d3+'-'+_0x1cbb6c+'/'+_0x142948)['json'](_0x3a5714);}return null;};}function patchUpdates(_0x1fdb6a){return function(_0x13df38){try{jsonpatch[_0x01d6('0x27')](_0x13df38,_0x1fdb6a,!![]);}catch(_0x108eaf){return BPromise['reject'](_0x108eaf);}return _0x13df38['save']();};}function saveUpdates(_0x12347b,_0x539266){return function(_0x8ed5de){if(_0x8ed5de){return _0x8ed5de['update'](_0x12347b)[_0x01d6('0x28')](function(_0x326759){return _0x326759;});}return null;};}function removeEntity(_0x2cdb54,_0xd1b55c){return function(_0x3ea180){if(_0x3ea180){return _0x3ea180[_0x01d6('0x29')]()[_0x01d6('0x28')](function(){var _0x4426c8=_0x3ea180[_0x01d6('0x2a')]({'plain':!![]});var _0x54c275=_0x01d6('0x2b');return db['UserProfileResource'][_0x01d6('0x29')]({'where':{'type':_0x54c275,'resourceId':_0x4426c8['id']}})[_0x01d6('0x28')](function(){return _0x3ea180;});})[_0x01d6('0x28')](function(){_0x2cdb54[_0x01d6('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x132446,_0xc26a25){return function(_0x99e998){if(!_0x99e998){_0x132446[_0x01d6('0x2c')](0x194);}return _0x99e998;};}function handleError(_0x55a8e0,_0x2e4cb2){_0x2e4cb2=_0x2e4cb2||0x1f4;return function(_0x2f0c78){logger[_0x01d6('0x2d')](_0x2f0c78[_0x01d6('0x2e')]);if(_0x2f0c78[_0x01d6('0x2f')]){delete _0x2f0c78[_0x01d6('0x2f')];}_0x55a8e0['status'](_0x2e4cb2)['send'](_0x2f0c78);};}exports['index']=function(_0xca1b12,_0x55d068){var _0x15164a={},_0x1c58bd={},_0x45a155={'count':0x0,'rows':[]};var _0x3b8c69=_[_0x01d6('0x30')](db[_0x01d6('0x31')][_0x01d6('0x32')],function(_0x354bda){return{'name':_0x354bda['fieldName'],'type':_0x354bda[_0x01d6('0x33')][_0x01d6('0x34')]};});_0x1c58bd[_0x01d6('0x35')]=_['map'](_0x3b8c69,_0x01d6('0x2f'));_0x1c58bd[_0x01d6('0x36')]=_[_0x01d6('0x37')](_0xca1b12['query']);_0x1c58bd[_0x01d6('0x38')]=_['intersection'](_0x1c58bd[_0x01d6('0x35')],_0x1c58bd[_0x01d6('0x36')]);_0x15164a['attributes']=_[_0x01d6('0x39')](_0x1c58bd[_0x01d6('0x35')],qs['fields'](_0xca1b12['query'][_0x01d6('0x3a')]));_0x15164a['attributes']=_0x15164a[_0x01d6('0x3b')][_0x01d6('0x3c')]?_0x15164a[_0x01d6('0x3b')]:_0x1c58bd[_0x01d6('0x35')];if(!_0xca1b12[_0x01d6('0x36')]['hasOwnProperty'](_0x01d6('0x3d'))){_0x15164a[_0x01d6('0x23')]=qs[_0x01d6('0x23')](_0xca1b12[_0x01d6('0x36')][_0x01d6('0x23')]);_0x15164a[_0x01d6('0x21')]=qs[_0x01d6('0x21')](_0xca1b12[_0x01d6('0x36')][_0x01d6('0x21')]);}_0x15164a[_0x01d6('0x3e')]=qs[_0x01d6('0x3f')](_0xca1b12['query'][_0x01d6('0x3f')]);_0x15164a[_0x01d6('0x40')]=qs['filters'](_['pick'](_0xca1b12[_0x01d6('0x36')],_0x1c58bd['filters']),_0x3b8c69);if(_0xca1b12[_0x01d6('0x36')]['filter']){_0x15164a['where']=_[_0x01d6('0x41')](_0x15164a[_0x01d6('0x40')],{'$or':_['map'](_0x3b8c69,function(_0x5ecc86){if(_0x5ecc86[_0x01d6('0x33')]!==_0x01d6('0x42')){var _0x2c8380={};_0x2c8380[_0x5ecc86[_0x01d6('0x2f')]]={'$like':'%'+_0xca1b12[_0x01d6('0x36')][_0x01d6('0x43')]+'%'};return _0x2c8380;}})});}_0x15164a=_['merge']({},_0x15164a,_0xca1b12[_0x01d6('0x44')]);var _0x3cf5e8={'where':_0x15164a['where']};return db[_0x01d6('0x31')][_0x01d6('0x24')](_0x3cf5e8)['then'](function(_0x10d408){_0x45a155[_0x01d6('0x24')]=_0x10d408;if(_0xca1b12[_0x01d6('0x36')]['includeAll']){_0x15164a[_0x01d6('0x45')]=[{'all':!![]}];}return db[_0x01d6('0x31')][_0x01d6('0x46')](_0x15164a);})[_0x01d6('0x28')](function(_0x424029){_0x45a155[_0x01d6('0x47')]=_0x424029;return _0x45a155;})[_0x01d6('0x28')](respondWithFilteredResult(_0x55d068,_0x15164a))[_0x01d6('0x48')](handleError(_0x55d068,null));};exports[_0x01d6('0x49')]=function(_0x13cf47,_0x23d8e7){var _0x30267c={'raw':!![],'where':{'id':_0x13cf47[_0x01d6('0x4a')]['id']}},_0x4efea8={};_0x4efea8[_0x01d6('0x35')]=_['keys'](db[_0x01d6('0x31')][_0x01d6('0x32')]);_0x4efea8['query']=_[_0x01d6('0x37')](_0x13cf47['query']);_0x4efea8[_0x01d6('0x38')]=_[_0x01d6('0x39')](_0x4efea8[_0x01d6('0x35')],_0x4efea8[_0x01d6('0x36')]);_0x30267c[_0x01d6('0x3b')]=_[_0x01d6('0x39')](_0x4efea8[_0x01d6('0x35')],qs[_0x01d6('0x3a')](_0x13cf47[_0x01d6('0x36')]['fields']));_0x30267c[_0x01d6('0x3b')]=_0x30267c[_0x01d6('0x3b')][_0x01d6('0x3c')]?_0x30267c[_0x01d6('0x3b')]:_0x4efea8[_0x01d6('0x35')];if(_0x13cf47['query'][_0x01d6('0x4b')]){_0x30267c[_0x01d6('0x45')]=[{'all':!![]}];}_0x30267c=_['merge']({},_0x30267c,_0x13cf47['options']);return db[_0x01d6('0x31')][_0x01d6('0x4c')](_0x30267c)['then'](handleEntityNotFound(_0x23d8e7,null))[_0x01d6('0x28')](respondWithResult(_0x23d8e7,null))[_0x01d6('0x48')](handleError(_0x23d8e7,null));};exports['create']=function(_0x56cb11,_0x2843b3){return db['MailQueue'][_0x01d6('0x4d')](_0x56cb11[_0x01d6('0x4e')],{})['then'](function(_0x4732f5){var _0x2f1a90=_0x56cb11[_0x01d6('0x4f')]['get']({'plain':!![]});if(!_0x2f1a90)throw new Error(_0x01d6('0x50'));if(_0x2f1a90[_0x01d6('0x51')]==='user'){var _0x179110=_0x4732f5[_0x01d6('0x2a')]({'plain':!![]});var _0x1219eb='MailQueues';return db['UserProfileSection']['find']({'where':{'name':_0x1219eb,'userProfileId':_0x2f1a90[_0x01d6('0x52')]},'raw':!![]})[_0x01d6('0x28')](function(_0x5e3321){if(_0x5e3321&&_0x5e3321[_0x01d6('0x53')]===0x0){return db[_0x01d6('0x54')][_0x01d6('0x4d')]({'name':_0x179110[_0x01d6('0x2f')],'resourceId':_0x179110['id'],'type':_0x5e3321[_0x01d6('0x2f')],'sectionId':_0x5e3321['id']},{})[_0x01d6('0x28')](function(){return _0x4732f5;});}else{return _0x4732f5;}})[_0x01d6('0x48')](function(_0x1735f4){logger['error'](_0x01d6('0x55'),_0x1735f4);throw _0x1735f4;});}return _0x4732f5;})[_0x01d6('0x28')](respondWithResult(_0x2843b3,0xc9))[_0x01d6('0x48')](handleError(_0x2843b3,null));};exports[_0x01d6('0x56')]=function(_0x11a38d,_0x5de3fb){if(_0x11a38d[_0x01d6('0x4e')]['id']){delete _0x11a38d[_0x01d6('0x4e')]['id'];}return db[_0x01d6('0x31')][_0x01d6('0x4c')]({'where':{'id':_0x11a38d[_0x01d6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5de3fb,null))['then'](saveUpdates(_0x11a38d[_0x01d6('0x4e')],null))['then'](respondWithResult(_0x5de3fb,null))['catch'](handleError(_0x5de3fb,null));};exports[_0x01d6('0x29')]=function(_0x5eb4c5,_0x4c10bb){return db[_0x01d6('0x31')]['find']({'where':{'id':_0x5eb4c5[_0x01d6('0x4a')]['id']}})[_0x01d6('0x28')](handleEntityNotFound(_0x4c10bb,null))[_0x01d6('0x28')](removeEntity(_0x4c10bb,null))['catch'](handleError(_0x4c10bb,null));};exports[_0x01d6('0x57')]=function(_0x4c08f0,_0x2c9db4){return db[_0x01d6('0x31')][_0x01d6('0x57')]()['then'](respondWithResult(_0x2c9db4,null))['catch'](handleError(_0x2c9db4,null));};exports[_0x01d6('0x58')]=function(_0x2c40ab,_0x1a03d9,_0x4372f4){var _0x1f275c={'raw':!![],'where':{}},_0x3e054f={},_0x559ede;return db['MailQueue'][_0x01d6('0x59')]({'where':{'id':_0x2c40ab[_0x01d6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1a03d9,null))[_0x01d6('0x28')](function(_0x66e520){if(_0x66e520){_0x559ede=_0x66e520['get']({'plain':!![]});_0x3e054f[_0x01d6('0x35')]=_[_0x01d6('0x37')](db[_0x01d6('0x5a')]['rawAttributes']);_0x3e054f[_0x01d6('0x36')]=_[_0x01d6('0x37')](_0x2c40ab[_0x01d6('0x36')]);_0x3e054f[_0x01d6('0x38')]=_[_0x01d6('0x39')](_0x3e054f['model'],_0x3e054f[_0x01d6('0x36')]);_0x1f275c['attributes']=_[_0x01d6('0x39')](_0x3e054f[_0x01d6('0x35')],qs[_0x01d6('0x3a')](_0x2c40ab[_0x01d6('0x36')][_0x01d6('0x3a')]));_0x1f275c[_0x01d6('0x3b')]=_0x1f275c[_0x01d6('0x3b')][_0x01d6('0x3c')]?_0x1f275c[_0x01d6('0x3b')]:_0x3e054f[_0x01d6('0x35')];if(!_0x2c40ab[_0x01d6('0x36')]['hasOwnProperty'](_0x01d6('0x3d'))){_0x1f275c[_0x01d6('0x23')]=qs[_0x01d6('0x23')](_0x2c40ab['query'][_0x01d6('0x23')]);_0x1f275c[_0x01d6('0x21')]=qs['offset'](_0x2c40ab[_0x01d6('0x36')][_0x01d6('0x21')]);}_0x1f275c[_0x01d6('0x3e')]=qs[_0x01d6('0x3f')](_0x2c40ab[_0x01d6('0x36')][_0x01d6('0x3f')]);_0x1f275c[_0x01d6('0x40')]=qs[_0x01d6('0x38')](_[_0x01d6('0x5b')](_0x2c40ab['query'],_0x3e054f['filters']));_0x1f275c[_0x01d6('0x40')]['MailQueueId']=_0x66e520['id'];if(_0x2c40ab[_0x01d6('0x36')]['filter']){_0x1f275c[_0x01d6('0x40')]=_['merge'](_0x1f275c['where'],{'$or':_['map'](_0x1f275c['attributes'],function(_0x47a104){var _0x4961df={};_0x4961df[_0x47a104]={'$like':'%'+_0x2c40ab['query'][_0x01d6('0x43')]+'%'};return _0x4961df;})});}_0x1f275c=_['merge']({},_0x1f275c,_0x2c40ab[_0x01d6('0x44')]);return db['UserMailQueue'][_0x01d6('0x46')](_0x1f275c);}})[_0x01d6('0x28')](function(_0x586bd1){if(_0x586bd1){return db[_0x01d6('0x5c')][_0x01d6('0x5d')]({'where':{'id':_[_0x01d6('0x30')](_0x586bd1,_0x01d6('0x5e')),'role':_0x01d6('0x5f')},'attributes':['id',_0x01d6('0x2f'),_0x01d6('0x60'),'updatedAt',_0x01d6('0x61')]});}})[_0x01d6('0x28')](function(_0x3b747b){if(_0x3b747b){return{'count':_0x3b747b[_0x01d6('0x24')],'rows':_['map'](_0x3b747b[_0x01d6('0x47')],function(_0xd6c098){return{'membername':_0xd6c098[_0x01d6('0x2f')],'UserId':_0xd6c098['id'],'queue_name':_0x559ede[_0x01d6('0x2f')],'MailQueueId':_0x559ede['id'],'interface':util[_0x01d6('0x62')]('%s/%s',_0x01d6('0x63'),_0xd6c098['name']),'penalty':0x0,'paused':_0xd6c098[_0x01d6('0x60')],'createdAt':_0xd6c098[_0x01d6('0x61')],'updatedAt':_0xd6c098['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x01d6('0x28')](respondWithFilteredResult(_0x1a03d9,_0x1f275c))[_0x01d6('0x48')](handleError(_0x1a03d9,null));};exports[_0x01d6('0x64')]=function(_0x2dc710,_0x35c539,_0x535600){var _0x5ebbaf={};var _0x2a5645={};var _0x4f97d2;var _0x547200;return db[_0x01d6('0x31')]['findOne']({'where':{'id':_0x2dc710['params']['id']}})[_0x01d6('0x28')](handleEntityNotFound(_0x35c539,null))[_0x01d6('0x28')](function(_0x320452){if(_0x320452){_0x4f97d2=_0x320452;_0x2a5645[_0x01d6('0x35')]=_[_0x01d6('0x37')](db[_0x01d6('0x65')][_0x01d6('0x32')]);_0x2a5645[_0x01d6('0x36')]=_['keys'](_0x2dc710[_0x01d6('0x36')]);_0x2a5645[_0x01d6('0x38')]=_['intersection'](_0x2a5645[_0x01d6('0x35')],_0x2a5645[_0x01d6('0x36')]);_0x5ebbaf[_0x01d6('0x3b')]=_[_0x01d6('0x39')](_0x2a5645[_0x01d6('0x35')],qs[_0x01d6('0x3a')](_0x2dc710[_0x01d6('0x36')][_0x01d6('0x3a')]));_0x5ebbaf[_0x01d6('0x3b')]=_0x5ebbaf['attributes'][_0x01d6('0x3c')]?_0x5ebbaf[_0x01d6('0x3b')]:_0x2a5645['model'];_0x5ebbaf[_0x01d6('0x3e')]=qs[_0x01d6('0x3f')](_0x2dc710[_0x01d6('0x36')]['sort']);_0x5ebbaf[_0x01d6('0x40')]=qs[_0x01d6('0x38')](_['pick'](_0x2dc710[_0x01d6('0x36')],_0x2a5645[_0x01d6('0x38')]));if(_0x2dc710[_0x01d6('0x36')][_0x01d6('0x43')]){_0x5ebbaf[_0x01d6('0x40')]=_[_0x01d6('0x41')](_0x5ebbaf[_0x01d6('0x40')],{'$or':_[_0x01d6('0x30')](_0x5ebbaf['attributes'],function(_0x4ae275){var _0x1ac83a={};_0x1ac83a[_0x4ae275]={'$like':'%'+_0x2dc710[_0x01d6('0x36')][_0x01d6('0x43')]+'%'};return _0x1ac83a;})});}_0x5ebbaf=_[_0x01d6('0x41')]({},_0x5ebbaf,_0x2dc710['options']);return _0x4f97d2['getTeams'](_0x5ebbaf);}})[_0x01d6('0x28')](function(_0x110a72){if(_0x110a72){_0x547200=_0x110a72[_0x01d6('0x3c')];if(!_0x2dc710[_0x01d6('0x36')]['hasOwnProperty'](_0x01d6('0x3d'))){_0x5ebbaf['limit']=qs[_0x01d6('0x23')](_0x2dc710[_0x01d6('0x36')]['limit']);_0x5ebbaf['offset']=qs[_0x01d6('0x21')](_0x2dc710[_0x01d6('0x36')][_0x01d6('0x21')]);}return _0x4f97d2[_0x01d6('0x64')](_0x5ebbaf);}})['then'](function(_0x1210ac){if(_0x1210ac){return _0x1210ac?{'count':_0x547200,'rows':_0x1210ac}:null;}})['then'](respondWithResult(_0x35c539,null))[_0x01d6('0x48')](handleError(_0x35c539,null));};exports['addTeams']=function(_0x279094,_0x52fbb4,_0x580d38){var _0x43666c=_0x279094['body']['ids'];return db[_0x01d6('0x65')][_0x01d6('0x46')]({'where':{'id':_0x43666c},'attributes':['id'],'include':[{'model':db[_0x01d6('0x5c')],'as':_0x01d6('0x66'),'attributes':['id',_0x01d6('0x2f'),_0x01d6('0x67'),_0x01d6('0x68'),_0x01d6('0x69')],'raw':!![]}]})[_0x01d6('0x28')](function(_0x568c7a){if(_0x568c7a){var _0x3334d9=_['flatMap'](_0x568c7a,function(_0x199e75){var _0x1b6754=_0x199e75[_0x01d6('0x2a')]({'plain':!![]});return _0x1b6754[_0x01d6('0x66')];});return db[_0x01d6('0x31')][_0x01d6('0x4c')]({'where':{'id':_0x279094['params']['id']}})[_0x01d6('0x28')](function(_0x282b65){return db['sequelize'][_0x01d6('0x6a')](function(_0x19972a){return _0x282b65[_0x01d6('0x6b')](_0x43666c,{'transaction':_0x19972a})[_0x01d6('0x28')](function(){return BPromise[_0x01d6('0x6c')](_0x3334d9,function(_0x3141ad){return db[_0x01d6('0x5a')][_0x01d6('0x6d')]({'where':{'UserId':_0x3141ad['id'],'MailQueueId':_0x279094[_0x01d6('0x4a')]['id']},'transaction':_0x19972a});});})['then'](function(){_0x3334d9[_0x01d6('0x6e')](function(_0x1eee64){socket[_0x01d6('0x6f')](_0x01d6('0x70'),{'UserId':_0x1eee64['id'],'MailQueueId':_0x282b65['id']});});});});});}})[_0x01d6('0x28')](respondWithStatusCode(_0x52fbb4,null))[_0x01d6('0x48')](handleError(_0x52fbb4,null));};exports['removeTeams']=function(_0x15a63b,_0x4dcb7e,_0xd0fb7b){return db[_0x01d6('0x65')][_0x01d6('0x46')]({'where':{'id':_0x15a63b[_0x01d6('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0x01d6('0x5c')],'as':_0x01d6('0x66'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4dcb7e,null))['then'](function(_0x11c03e){var _0x5af46b=_[_0x01d6('0x30')](_0x11c03e,'id');var _0x1aa87f=[];var _0x439b5e=[];var _0x3d3626=squel[_0x01d6('0x71')]();_0x3d3626[_0x01d6('0x72')](_0x01d6('0x73'))[_0x01d6('0x74')](_0x01d6('0x75'),'tq')[_0x01d6('0x76')]('user_has_teams','ut',_0x01d6('0x77'))['where'](_0x01d6('0x78'),_0x15a63b[_0x01d6('0x4a')]['id']);for(var _0x3bf3f4=0x0;_0x3bf3f4<_0x11c03e[_0x01d6('0x3c')];_0x3bf3f4+=0x1){let _0x4d809d=_0x11c03e[_0x3bf3f4];for(var _0x1b976c=0x0;_0x1b976c<_0x4d809d[_0x01d6('0x66')][_0x01d6('0x3c')];_0x1b976c+=0x1){let _0x138052=_0x4d809d['Agents'][_0x1b976c];var _0x360369=_0x3d3626[_0x01d6('0x79')]();_0x360369[_0x01d6('0x40')](_0x01d6('0x7a'),_0x138052['id']);_0x439b5e[_0x01d6('0x7b')](db[_0x01d6('0x7c')][_0x01d6('0x36')](_0x360369[_0x01d6('0x7d')](),{'type':db[_0x01d6('0x7c')][_0x01d6('0x7e')][_0x01d6('0x7f')]})['then'](function(_0x28597b){if(_0x28597b[_0x01d6('0x3c')]===0x1){return _0x138052['id'];}else{var _0x951d5=_[_0x01d6('0x80')](_[_0x01d6('0x30')](_0x28597b,_0x01d6('0x81')),function(_0x3b2f41){return _['includes'](_0x5af46b,_0x3b2f41);});if(_0x951d5){return _0x138052['id'];}}}));}}return BPromise[_0x01d6('0x82')](_0x439b5e)[_0x01d6('0x28')](function(_0x3046ee){_0x1aa87f=_(_0x1aa87f)['union'](_0x3046ee)[_0x01d6('0x83')]()[_0x01d6('0x84')]();return db['MailQueue'][_0x01d6('0x4c')]({'where':{'id':_0x15a63b[_0x01d6('0x4a')]['id']}})[_0x01d6('0x28')](function(_0x175e22){return db[_0x01d6('0x7c')]['transaction'](function(_0x19381a){return _0x175e22[_0x01d6('0x85')](_0x15a63b[_0x01d6('0x36')]['ids'],{'transaction':_0x19381a})['then'](function(){if(!_[_0x01d6('0x86')](_0x1aa87f)){return _0x175e22[_0x01d6('0x87')](_0x1aa87f,{'transaction':_0x19381a});}})[_0x01d6('0x28')](function(){_0x1aa87f[_0x01d6('0x6e')](function(_0x3fbcda){socket[_0x01d6('0x6f')](_0x01d6('0x88'),{'UserId':_0x3fbcda,'MailQueueId':_0x175e22['id']});});});});});});})[_0x01d6('0x28')](respondWithStatusCode(_0x4dcb7e,null))['catch'](handleError(_0x4dcb7e,null));};exports[_0x01d6('0x89')]=function(_0x2b80c9,_0x3cf73f,_0x2ac9d4){return db[_0x01d6('0x31')]['find']({'where':{'id':_0x2b80c9[_0x01d6('0x4a')]['id']}})[_0x01d6('0x28')](handleEntityNotFound(_0x3cf73f,null))[_0x01d6('0x28')](function(_0x4f0b30){if(_0x4f0b30){return _0x4f0b30['addAgents'](_0x2b80c9[_0x01d6('0x4e')][_0x01d6('0x8a')],_[_0x01d6('0x8b')](_0x2b80c9[_0x01d6('0x4e')],[_0x01d6('0x8a'),'id'])||{})['spread'](function(_0x445d76){for(var _0x2fb5a5=0x0;_0x2fb5a5<_0x2b80c9['body'][_0x01d6('0x8a')]['length'];_0x2fb5a5+=0x1){socket['emit']('userMailQueue:save',{'UserId':Number(_0x2b80c9[_0x01d6('0x4e')][_0x01d6('0x8a')][_0x2fb5a5]),'MailQueueId':Number(_0x2b80c9[_0x01d6('0x4a')]['id'])});}return _0x445d76;});}})[_0x01d6('0x28')](respondWithResult(_0x3cf73f,null))[_0x01d6('0x48')](handleError(_0x3cf73f,null));};exports[_0x01d6('0x87')]=function(_0x2465a6,_0x43a7f8,_0x18fd8e){return db[_0x01d6('0x31')][_0x01d6('0x4c')]({'where':{'id':_0x2465a6[_0x01d6('0x4a')]['id']}})[_0x01d6('0x28')](handleEntityNotFound(_0x43a7f8,null))[_0x01d6('0x28')](function(_0x26ee60){if(_0x26ee60){return _0x26ee60['removeAgents'](_0x2465a6[_0x01d6('0x36')]['ids'])[_0x01d6('0x28')](function(){if(_[_0x01d6('0x8c')](_0x2465a6[_0x01d6('0x36')][_0x01d6('0x8a')])){for(var _0x194217=0x0;_0x194217<_0x2465a6[_0x01d6('0x36')]['ids'][_0x01d6('0x3c')];_0x194217+=0x1){socket[_0x01d6('0x6f')]('userMailQueue:remove',{'UserId':Number(_0x2465a6[_0x01d6('0x36')][_0x01d6('0x8a')][_0x194217]),'MailQueueId':Number(_0x2465a6[_0x01d6('0x4a')]['id'])});}}else{socket[_0x01d6('0x6f')](_0x01d6('0x88'),{'UserId':Number(_0x2465a6[_0x01d6('0x36')][_0x01d6('0x8a')]),'MailQueueId':Number(_0x2465a6[_0x01d6('0x4a')]['id'])});}});}})[_0x01d6('0x28')](respondWithStatusCode(_0x43a7f8,null))[_0x01d6('0x48')](handleError(_0x43a7f8,null));};exports[_0x01d6('0x8d')]=function(_0xf715ae,_0x535363,_0x3466b0){var _0x3a8bfa={};var _0xd6bf5d={};var _0x3f102e;var _0x5f30fd;return db['MailQueue']['findOne']({'where':{'id':_0xf715ae['params']['id']}})[_0x01d6('0x28')](handleEntityNotFound(_0x535363,null))['then'](function(_0x18d984){if(_0x18d984){_0x3f102e=_0x18d984;_0xd6bf5d[_0x01d6('0x35')]=_[_0x01d6('0x37')](db[_0x01d6('0x5c')][_0x01d6('0x32')]);_0xd6bf5d[_0x01d6('0x36')]=_[_0x01d6('0x37')](_0xf715ae['query']);_0xd6bf5d['filters']=_['intersection'](_0xd6bf5d[_0x01d6('0x35')],_0xd6bf5d['query']);_0x3a8bfa[_0x01d6('0x3b')]=_[_0x01d6('0x39')](_0xd6bf5d['model'],qs['fields'](_0xf715ae[_0x01d6('0x36')][_0x01d6('0x3a')]));_0x3a8bfa[_0x01d6('0x3b')]=_0x3a8bfa[_0x01d6('0x3b')]['length']?_0x3a8bfa[_0x01d6('0x3b')]:_0xd6bf5d[_0x01d6('0x35')];_0x3a8bfa[_0x01d6('0x3e')]=qs[_0x01d6('0x3f')](_0xf715ae[_0x01d6('0x36')][_0x01d6('0x3f')]);_0x3a8bfa[_0x01d6('0x40')]=qs[_0x01d6('0x38')](_[_0x01d6('0x5b')](_0xf715ae['query'],_0xd6bf5d['filters']));if(_0xf715ae[_0x01d6('0x36')]['filter']){_0x3a8bfa[_0x01d6('0x40')]=_[_0x01d6('0x41')](_0x3a8bfa[_0x01d6('0x40')],{'$or':_[_0x01d6('0x30')](_0x3a8bfa[_0x01d6('0x3b')],function(_0x19f4b4){var _0x4a36db={};_0x4a36db[_0x19f4b4]={'$like':'%'+_0xf715ae['query'][_0x01d6('0x43')]+'%'};return _0x4a36db;})});}_0x3a8bfa=_[_0x01d6('0x41')]({},_0x3a8bfa,_0xf715ae['options']);return _0x3f102e[_0x01d6('0x8d')](_0x3a8bfa);}})[_0x01d6('0x28')](function(_0xefd140){if(_0xefd140){_0x5f30fd=_0xefd140[_0x01d6('0x3c')];if(!_0xf715ae[_0x01d6('0x36')][_0x01d6('0x8e')](_0x01d6('0x3d'))){_0x3a8bfa[_0x01d6('0x23')]=qs[_0x01d6('0x23')](_0xf715ae[_0x01d6('0x36')]['limit']);_0x3a8bfa[_0x01d6('0x21')]=qs[_0x01d6('0x21')](_0xf715ae[_0x01d6('0x36')][_0x01d6('0x21')]);}return _0x3f102e[_0x01d6('0x8d')](_0x3a8bfa);}})[_0x01d6('0x28')](function(_0x41cea0){if(_0x41cea0){return _0x41cea0?{'count':_0x5f30fd,'rows':_0x41cea0}:null;}})['then'](respondWithResult(_0x535363,null))[_0x01d6('0x48')](handleError(_0x535363,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 1d5ed7f..10f3b91 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 _0x4745=['save','update','remove','emit','hasOwnProperty','hook','exports','events','MailQueue'];(function(_0x384c01,_0x1e0dc5){var _0x300793=function(_0x32bb86){while(--_0x32bb86){_0x384c01['push'](_0x384c01['shift']());}};_0x300793(++_0x1e0dc5);}(_0x4745,0xd6));var _0x5474=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x4745[_0x13ea00];return _0x1f7347;};'use strict';var EventEmitter=require(_0x5474('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x5474('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5474('0x2'),'afterUpdate':_0x5474('0x3'),'afterDestroy':_0x5474('0x4')};function emitEvent(_0x298344){return function(_0x9b503,_0x48419d,_0x33e7df){MailQueueEvents[_0x5474('0x5')](_0x298344+':'+_0x9b503['id'],_0x9b503);MailQueueEvents[_0x5474('0x5')](_0x298344,_0x9b503);_0x33e7df(null);};}for(var e in events){if(events[_0x5474('0x6')](e)){var event=events[e];MailQueue[_0x5474('0x7')](e,emitEvent(event));}}module[_0x5474('0x8')]=MailQueueEvents; \ No newline at end of file +var _0xf893=['hook','exports','../../mysqldb','MailQueue','update','remove','emit','hasOwnProperty'];(function(_0x4017b0,_0x4347db){var _0x5ed4f7=function(_0x706c26){while(--_0x706c26){_0x4017b0['push'](_0x4017b0['shift']());}};_0x5ed4f7(++_0x4347db);}(_0xf893,0xe2));var _0x3f89=function(_0x1fd327,_0x15d391){_0x1fd327=_0x1fd327-0x0;var _0x205970=_0xf893[_0x1fd327];return _0x205970;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x3f89('0x0'))['db'][_0x3f89('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x3f89('0x2'),'afterDestroy':_0x3f89('0x3')};function emitEvent(_0x3c6d58){return function(_0x41c69f,_0x467305,_0x2283ab){MailQueueEvents[_0x3f89('0x4')](_0x3c6d58+':'+_0x41c69f['id'],_0x41c69f);MailQueueEvents[_0x3f89('0x4')](_0x3c6d58,_0x41c69f);_0x2283ab(null);};}for(var e in events){if(events[_0x3f89('0x5')](e)){var event=events[e];MailQueue[_0x3f89('0x6')](e,emitEvent(event));}}module[_0x3f89('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 071c7e5..e2b9c38 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 _0xb47d=['moment','bluebird','path','rimraf','../../config/environment','define','util'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0xb47d,0x1e9));var _0xdb47=function(_0x1d943f,_0x10d69e){_0x1d943f=_0x1d943f-0x0;var _0x35e828=_0xb47d[_0x1d943f];return _0x35e828;};'use strict';var _=require('lodash');var util=require(_0xdb47('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xdb47('0x1'));var BPromise=require(_0xdb47('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdb47('0x3'));var rimraf=require(_0xdb47('0x4'));var config=require(_0xdb47('0x5'));var attributes=require('./mailQueue.attributes');module['exports']=function(_0x24c62f,_0x5a4fcf){return _0x24c62f[_0xdb47('0x6')]('MailQueue',attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9caa=['../../config/logger','bluebird','request-promise','../../config/environment','./mailQueue.attributes','define','MailQueue','mail_queues','lodash'];(function(_0x595de0,_0x2f9c28){var _0x168e8a=function(_0x5d9699){while(--_0x5d9699){_0x595de0['push'](_0x595de0['shift']());}};_0x168e8a(++_0x2f9c28);}(_0x9caa,0x1c1));var _0xa9ca=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9caa[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa9ca('0x0'));var util=require('util');var logger=require(_0xa9ca('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa9ca('0x2'));var rp=require(_0xa9ca('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa9ca('0x4'));var attributes=require(_0xa9ca('0x5'));module['exports']=function(_0xc7c82,_0x1e10a3){return _0xc7c82[_0xa9ca('0x6')](_0xa9ca('0x7'),attributes,{'tableName':_0xa9ca('0x8'),'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 687d29d..513a705 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 _0x6e37=['MailQueue,\x20%s,\x20%s','message','result','catch','GetMailQueue','MailQueue','findAll','raw','options','where','limit','include','map','model','attributes','stringify','ShowMailQueue','find','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3e69ae,_0x366e8d){var _0x3d7f42=function(_0x5df093){while(--_0x5df093){_0x3e69ae['push'](_0x3e69ae['shift']());}};_0x3d7f42(++_0x366e8d);}(_0x6e37,0xee));var _0x76e3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6e37[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x76e3('0x0'));var util=require(_0x76e3('0x1'));var moment=require(_0x76e3('0x2'));var BPromise=require('bluebird');var rs=require(_0x76e3('0x3'));var fs=require('fs');var Redis=require(_0x76e3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76e3('0x5'));var logger=require(_0x76e3('0x6'))(_0x76e3('0x7'));var config=require(_0x76e3('0x8'));var jayson=require(_0x76e3('0x9'));var client=jayson[_0x76e3('0xa')][_0x76e3('0xb')]({'port':0x232a});config[_0x76e3('0xc')]=_[_0x76e3('0xd')](config[_0x76e3('0xc')],{'host':_0x76e3('0xe'),'port':0x18eb});var socket=require(_0x76e3('0xf'))(new Redis(config['redis']));require(_0x76e3('0x10'))[_0x76e3('0x11')](socket);function respondWithRpcPromise(_0x25ee27,_0x2b19c1,_0x2c3a35){return new BPromise(function(_0x62712b,_0x3a53e9){return client[_0x76e3('0x12')](_0x25ee27,_0x2c3a35)[_0x76e3('0x13')](function(_0x497339){logger[_0x76e3('0x14')]('MailQueue,\x20%s,\x20%s',_0x2b19c1,_0x76e3('0x15'));logger[_0x76e3('0x16')](_0x76e3('0x17'),_0x2b19c1,_0x76e3('0x15'),JSON['stringify'](_0x497339));if(_0x497339[_0x76e3('0x18')]){if(_0x497339[_0x76e3('0x18')][_0x76e3('0x19')]===0x1f4){logger['error'](_0x76e3('0x1a'),_0x2b19c1,_0x497339[_0x76e3('0x18')][_0x76e3('0x1b')]);return _0x3a53e9(_0x497339[_0x76e3('0x18')][_0x76e3('0x1b')]);}logger[_0x76e3('0x18')]('MailQueue,\x20%s,\x20%s',_0x2b19c1,_0x497339[_0x76e3('0x18')][_0x76e3('0x1b')]);return _0x62712b(_0x497339[_0x76e3('0x18')]['message']);}else{logger[_0x76e3('0x14')](_0x76e3('0x1a'),_0x2b19c1,_0x76e3('0x15'));_0x62712b(_0x497339[_0x76e3('0x1c')][_0x76e3('0x1b')]);}})[_0x76e3('0x1d')](function(_0x3f32a){logger[_0x76e3('0x18')]('MailQueue,\x20%s,\x20%s',_0x2b19c1,_0x3f32a);_0x3a53e9(_0x3f32a);});});}exports[_0x76e3('0x1e')]=function(_0x2c7ac0){var _0x51d7d3=this;return new Promise(function(_0x5bbfd8,_0x34a09f){return db[_0x76e3('0x1f')][_0x76e3('0x20')]({'raw':_0x2c7ac0['options']?_0x2c7ac0['options'][_0x76e3('0x21')]===undefined?!![]:![]:!![],'where':_0x2c7ac0[_0x76e3('0x22')]?_0x2c7ac0['options'][_0x76e3('0x23')]||null:null,'attributes':_0x2c7ac0[_0x76e3('0x22')]?_0x2c7ac0[_0x76e3('0x22')]['attributes']||null:null,'limit':_0x2c7ac0[_0x76e3('0x22')]?_0x2c7ac0['options'][_0x76e3('0x24')]||null:null,'include':_0x2c7ac0[_0x76e3('0x22')]?_0x2c7ac0[_0x76e3('0x22')][_0x76e3('0x25')]?_[_0x76e3('0x26')](_0x2c7ac0[_0x76e3('0x22')][_0x76e3('0x25')],function(_0x22b89b){return{'model':db[_0x22b89b[_0x76e3('0x27')]],'as':_0x22b89b['as'],'attributes':_0x22b89b[_0x76e3('0x28')],'include':_0x22b89b[_0x76e3('0x25')]?_[_0x76e3('0x26')](_0x22b89b[_0x76e3('0x25')],function(_0x5f0af3){return{'model':db[_0x5f0af3[_0x76e3('0x27')]],'as':_0x5f0af3['as'],'attributes':_0x5f0af3[_0x76e3('0x28')],'include':_0x5f0af3['include']?_['map'](_0x5f0af3[_0x76e3('0x25')],function(_0xb34713){return{'model':db[_0xb34713['model']],'as':_0xb34713['as'],'attributes':_0xb34713['attributes']};}):[]};}):[]};}):[]:[]})[_0x76e3('0x13')](function(_0x188604){logger['info'](_0x76e3('0x1e'),_0x2c7ac0);logger[_0x76e3('0x16')](_0x76e3('0x1e'),_0x2c7ac0,JSON[_0x76e3('0x29')](_0x188604));_0x5bbfd8(_0x188604);})[_0x76e3('0x1d')](function(_0x109b2f){logger[_0x76e3('0x18')](_0x76e3('0x1e'),_0x109b2f[_0x76e3('0x1b')],_0x2c7ac0);_0x34a09f(_0x51d7d3[_0x76e3('0x18')](0x1f4,_0x109b2f[_0x76e3('0x1b')]));});});};exports[_0x76e3('0x2a')]=function(_0x5952f7){var _0x3108d9=this;return new Promise(function(_0x59665f,_0x1efe93){return db[_0x76e3('0x1f')][_0x76e3('0x2b')]({'raw':_0x5952f7[_0x76e3('0x22')]?_0x5952f7[_0x76e3('0x22')]['raw']===undefined?!![]:![]:!![],'where':_0x5952f7[_0x76e3('0x22')]?_0x5952f7['options']['where']||null:null,'attributes':_0x5952f7[_0x76e3('0x22')]?_0x5952f7[_0x76e3('0x22')]['attributes']||null:null,'include':_0x5952f7['options']?_0x5952f7[_0x76e3('0x22')]['include']?_[_0x76e3('0x26')](_0x5952f7[_0x76e3('0x22')][_0x76e3('0x25')],function(_0x4d8138){return{'model':db[_0x4d8138[_0x76e3('0x27')]],'as':_0x4d8138['as'],'attributes':_0x4d8138[_0x76e3('0x28')],'include':_0x4d8138[_0x76e3('0x25')]?_['map'](_0x4d8138[_0x76e3('0x25')],function(_0x46d55a){return{'model':db[_0x46d55a[_0x76e3('0x27')]],'as':_0x46d55a['as'],'attributes':_0x46d55a[_0x76e3('0x28')],'include':_0x46d55a[_0x76e3('0x25')]?_[_0x76e3('0x26')](_0x46d55a[_0x76e3('0x25')],function(_0x3cf9a6){return{'model':db[_0x3cf9a6[_0x76e3('0x27')]],'as':_0x3cf9a6['as'],'attributes':_0x3cf9a6[_0x76e3('0x28')]};}):[]};}):[]};}):[]:[]})[_0x76e3('0x13')](function(_0x32676a){logger[_0x76e3('0x14')](_0x76e3('0x2a'),_0x5952f7);logger[_0x76e3('0x16')]('ShowMailQueue',_0x5952f7,JSON[_0x76e3('0x29')](_0x32676a));_0x59665f(_0x32676a);})[_0x76e3('0x1d')](function(_0x3c3c35){logger[_0x76e3('0x18')](_0x76e3('0x2a'),_0x3c3c35[_0x76e3('0x1b')],_0x5952f7);_0x1efe93(_0x3108d9['error'](0x1f4,_0x3c3c35[_0x76e3('0x1b')]));});});}; \ No newline at end of file +var _0x3931=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','GetMailQueue','MailQueue','findAll','options','raw','where','limit','map','include','attributes','model','catch','ShowMailQueue','find','util','moment','bluebird','randomstring'];(function(_0x1aa24c,_0x367d79){var _0x278a81=function(_0x27830b){while(--_0x27830b){_0x1aa24c['push'](_0x1aa24c['shift']());}};_0x278a81(++_0x367d79);}(_0x3931,0x14c));var _0x1393=function(_0x2b225,_0x4f989f){_0x2b225=_0x2b225-0x0;var _0xcacf37=_0x3931[_0x2b225];return _0xcacf37;};'use strict';var _=require('lodash');var util=require(_0x1393('0x0'));var moment=require(_0x1393('0x1'));var BPromise=require(_0x1393('0x2'));var rs=require(_0x1393('0x3'));var fs=require('fs');var Redis=require(_0x1393('0x4'));var db=require(_0x1393('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1393('0x6'))(_0x1393('0x7'));var config=require(_0x1393('0x8'));var jayson=require(_0x1393('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x1393('0xa')]=_[_0x1393('0xb')](config[_0x1393('0xa')],{'host':_0x1393('0xc'),'port':0x18eb});var socket=require(_0x1393('0xd'))(new Redis(config[_0x1393('0xa')]));require(_0x1393('0xe'))[_0x1393('0xf')](socket);function respondWithRpcPromise(_0x19b1b1,_0x247ce7,_0x9bbec9){return new BPromise(function(_0x541db5,_0x26d7a0){return client[_0x1393('0x10')](_0x19b1b1,_0x9bbec9)[_0x1393('0x11')](function(_0x59b736){logger['info'](_0x1393('0x12'),_0x247ce7,'request\x20sent');logger[_0x1393('0x13')](_0x1393('0x14'),_0x247ce7,_0x1393('0x15'),JSON[_0x1393('0x16')](_0x59b736));if(_0x59b736[_0x1393('0x17')]){if(_0x59b736['error'][_0x1393('0x18')]===0x1f4){logger[_0x1393('0x17')](_0x1393('0x12'),_0x247ce7,_0x59b736[_0x1393('0x17')]['message']);return _0x26d7a0(_0x59b736[_0x1393('0x17')][_0x1393('0x19')]);}logger[_0x1393('0x17')](_0x1393('0x12'),_0x247ce7,_0x59b736['error']['message']);return _0x541db5(_0x59b736[_0x1393('0x17')][_0x1393('0x19')]);}else{logger[_0x1393('0x1a')](_0x1393('0x12'),_0x247ce7,_0x1393('0x15'));_0x541db5(_0x59b736[_0x1393('0x1b')]['message']);}})['catch'](function(_0x2aa9a0){logger[_0x1393('0x17')](_0x1393('0x12'),_0x247ce7,_0x2aa9a0);_0x26d7a0(_0x2aa9a0);});});}exports[_0x1393('0x1c')]=function(_0x48449f){var _0x3dcd31=this;return new Promise(function(_0x4da44d,_0x1842c6){return db[_0x1393('0x1d')][_0x1393('0x1e')]({'raw':_0x48449f[_0x1393('0x1f')]?_0x48449f[_0x1393('0x1f')][_0x1393('0x20')]===undefined?!![]:![]:!![],'where':_0x48449f[_0x1393('0x1f')]?_0x48449f[_0x1393('0x1f')][_0x1393('0x21')]||null:null,'attributes':_0x48449f[_0x1393('0x1f')]?_0x48449f[_0x1393('0x1f')]['attributes']||null:null,'limit':_0x48449f[_0x1393('0x1f')]?_0x48449f['options'][_0x1393('0x22')]||null:null,'include':_0x48449f['options']?_0x48449f['options']['include']?_[_0x1393('0x23')](_0x48449f[_0x1393('0x1f')][_0x1393('0x24')],function(_0x13ecf6){return{'model':db[_0x13ecf6['model']],'as':_0x13ecf6['as'],'attributes':_0x13ecf6[_0x1393('0x25')],'include':_0x13ecf6[_0x1393('0x24')]?_[_0x1393('0x23')](_0x13ecf6[_0x1393('0x24')],function(_0x4fbca1){return{'model':db[_0x4fbca1[_0x1393('0x26')]],'as':_0x4fbca1['as'],'attributes':_0x4fbca1[_0x1393('0x25')],'include':_0x4fbca1['include']?_[_0x1393('0x23')](_0x4fbca1[_0x1393('0x24')],function(_0x37d0e5){return{'model':db[_0x37d0e5['model']],'as':_0x37d0e5['as'],'attributes':_0x37d0e5[_0x1393('0x25')]};}):[]};}):[]};}):[]:[]})[_0x1393('0x11')](function(_0x96097c){logger[_0x1393('0x1a')]('GetMailQueue',_0x48449f);logger[_0x1393('0x13')](_0x1393('0x1c'),_0x48449f,JSON['stringify'](_0x96097c));_0x4da44d(_0x96097c);})[_0x1393('0x27')](function(_0x197634){logger[_0x1393('0x17')](_0x1393('0x1c'),_0x197634['message'],_0x48449f);_0x1842c6(_0x3dcd31['error'](0x1f4,_0x197634[_0x1393('0x19')]));});});};exports[_0x1393('0x28')]=function(_0x4c14a8){var _0x34b9ce=this;return new Promise(function(_0xb0fb39,_0xf46700){return db[_0x1393('0x1d')][_0x1393('0x29')]({'raw':_0x4c14a8[_0x1393('0x1f')]?_0x4c14a8[_0x1393('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x4c14a8[_0x1393('0x1f')]?_0x4c14a8[_0x1393('0x1f')]['where']||null:null,'attributes':_0x4c14a8[_0x1393('0x1f')]?_0x4c14a8[_0x1393('0x1f')][_0x1393('0x25')]||null:null,'include':_0x4c14a8[_0x1393('0x1f')]?_0x4c14a8[_0x1393('0x1f')][_0x1393('0x24')]?_[_0x1393('0x23')](_0x4c14a8['options'][_0x1393('0x24')],function(_0x54bb37){return{'model':db[_0x54bb37[_0x1393('0x26')]],'as':_0x54bb37['as'],'attributes':_0x54bb37['attributes'],'include':_0x54bb37[_0x1393('0x24')]?_[_0x1393('0x23')](_0x54bb37[_0x1393('0x24')],function(_0x50a5a1){return{'model':db[_0x50a5a1[_0x1393('0x26')]],'as':_0x50a5a1['as'],'attributes':_0x50a5a1[_0x1393('0x25')],'include':_0x50a5a1[_0x1393('0x24')]?_['map'](_0x50a5a1[_0x1393('0x24')],function(_0x46c154){return{'model':db[_0x46c154[_0x1393('0x26')]],'as':_0x46c154['as'],'attributes':_0x46c154[_0x1393('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f462a){logger['info'](_0x1393('0x28'),_0x4c14a8);logger['debug'](_0x1393('0x28'),_0x4c14a8,JSON[_0x1393('0x16')](_0x3f462a));_0xb0fb39(_0x3f462a);})['catch'](function(_0x18cbd9){logger[_0x1393('0x17')](_0x1393('0x28'),_0x18cbd9[_0x1393('0x19')],_0x4c14a8);_0xf46700(_0x34b9ce[_0x1393('0x17')](0x1f4,_0x18cbd9[_0x1393('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 178dd2d..032ca57 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 _0x0c71=['update','removeListener','register','length','mailQueue:','save'];(function(_0x5e7d10,_0x4308e2){var _0x59dbbf=function(_0x3a24f5){while(--_0x3a24f5){_0x5e7d10['push'](_0x5e7d10['shift']());}};_0x59dbbf(++_0x4308e2);}(_0x0c71,0xfb));var _0x10c7=function(_0x87d86f,_0x3f753e){_0x87d86f=_0x87d86f-0x0;var _0x51ea58=_0x0c71[_0x87d86f];return _0x51ea58;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x10c7('0x0'),'remove',_0x10c7('0x1')];function createListener(_0xac267a,_0x1dfbb9){return function(_0x4858c1){_0x1dfbb9['emit'](_0xac267a,_0x4858c1);};}function removeListener(_0xa72176,_0x57f92f){return function(){MailQueueEvents[_0x10c7('0x2')](_0xa72176,_0x57f92f);};}exports[_0x10c7('0x3')]=function(_0x21da60){for(var _0x4480c2=0x0,_0x2dbe32=events[_0x10c7('0x4')];_0x4480c2<_0x2dbe32;_0x4480c2++){var _0x4d8fc8=events[_0x4480c2];var _0x3cbcd7=createListener(_0x10c7('0x5')+_0x4d8fc8,_0x21da60);MailQueueEvents['on'](_0x4d8fc8,_0x3cbcd7);}}; \ No newline at end of file +var _0xf0b0=['update','emit','removeListener','length','save','remove'];(function(_0x7f3cb1,_0x17b8dd){var _0x57ffa4=function(_0x353818){while(--_0x353818){_0x7f3cb1['push'](_0x7f3cb1['shift']());}};_0x57ffa4(++_0x17b8dd);}(_0xf0b0,0x16c));var _0x0f0b=function(_0x443050,_0x2babd6){_0x443050=_0x443050-0x0;var _0x185657=_0xf0b0[_0x443050];return _0x185657;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x0f0b('0x0'),_0x0f0b('0x1'),_0x0f0b('0x2')];function createListener(_0x2d5e5e,_0x749d6d){return function(_0x55b3e9){_0x749d6d[_0x0f0b('0x3')](_0x2d5e5e,_0x55b3e9);};}function removeListener(_0x586496,_0x1d5692){return function(){MailQueueEvents[_0x0f0b('0x4')](_0x586496,_0x1d5692);};}exports['register']=function(_0x9b1573){for(var _0x504ad5=0x0,_0x1fcbb9=events[_0x0f0b('0x5')];_0x504ad5<_0x1fcbb9;_0x504ad5++){var _0x34712e=events[_0x504ad5];var _0x2bd5f5=createListener('mailQueue:'+_0x34712e,_0x9b1573);MailQueueEvents['on'](_0x34712e,_0x2bd5f5);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 44e705d..a540f8a 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 _0xcada=['./mailQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','delete','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcada,0x1e6));var _0xacad=function(_0x844747,_0xa7332a){_0x844747=_0x844747-0x0;var _0x56ffe6=_0xcada[_0x844747];return _0x56ffe6;};'use strict';var multer=require(_0xacad('0x0'));var util=require(_0xacad('0x1'));var path=require(_0xacad('0x2'));var timeout=require(_0xacad('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xacad('0x4'));var auth=require(_0xacad('0x5'));var interaction=require(_0xacad('0x6'));var config=require(_0xacad('0x7'));var controller=require(_0xacad('0x8'));router[_0xacad('0x9')]('/',auth['isAuthenticated'](),controller[_0xacad('0xa')]);router[_0xacad('0x9')](_0xacad('0xb'),auth[_0xacad('0xc')](),controller[_0xacad('0xd')]);router['get'](_0xacad('0xe'),auth['isAuthenticated'](),controller[_0xacad('0xf')]);router[_0xacad('0x10')]('/',auth[_0xacad('0xc')](),controller[_0xacad('0x11')]);router['put'](_0xacad('0xe'),auth[_0xacad('0xc')](),controller['update']);router[_0xacad('0x12')](_0xacad('0xe'),auth[_0xacad('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8c3a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','util','path'];(function(_0x3834bc,_0x3ed661){var _0x277827=function(_0x47e5b6){while(--_0x47e5b6){_0x3834bc['push'](_0x3834bc['shift']());}};_0x277827(++_0x3ed661);}(_0x8c3a,0x1a0));var _0xa8c3=function(_0x4d34f9,_0x313c5f){_0x4d34f9=_0x4d34f9-0x0;var _0x29dd2a=_0x8c3a[_0x4d34f9];return _0x29dd2a;};'use strict';var multer=require('multer');var util=require(_0xa8c3('0x0'));var path=require(_0xa8c3('0x1'));var timeout=require(_0xa8c3('0x2'));var express=require(_0xa8c3('0x3'));var router=express[_0xa8c3('0x4')]();var fs_extra=require(_0xa8c3('0x5'));var auth=require(_0xa8c3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa8c3('0x7'));var controller=require(_0xa8c3('0x8'));router['get']('/',auth[_0xa8c3('0x9')](),controller[_0xa8c3('0xa')]);router[_0xa8c3('0xb')](_0xa8c3('0xc'),auth[_0xa8c3('0x9')](),controller[_0xa8c3('0xd')]);router[_0xa8c3('0xb')](_0xa8c3('0xe'),auth[_0xa8c3('0x9')](),controller[_0xa8c3('0xf')]);router[_0xa8c3('0x10')]('/',auth[_0xa8c3('0x9')](),controller[_0xa8c3('0x11')]);router[_0xa8c3('0x12')]('/:id',auth[_0xa8c3('0x9')](),controller[_0xa8c3('0x13')]);router[_0xa8c3('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xa8c3('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index b43989c..3a8e162 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 _0x2eb2=['exports','STRING','DATE','sequelize'];(function(_0x2c7ef7,_0x327a9d){var _0x226600=function(_0x19a827){while(--_0x19a827){_0x2c7ef7['push'](_0x2c7ef7['shift']());}};_0x226600(++_0x327a9d);}(_0x2eb2,0x19f));var _0x22eb=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0x2eb2[_0x2160a9];return _0xa88cf7;};'use strict';var moment=require('moment');var Sequelize=require(_0x22eb('0x0'));module[_0x22eb('0x1')]={'uniqueid':{'type':Sequelize[_0x22eb('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x22eb('0x2')]},'joinAt':{'type':Sequelize[_0x22eb('0x3')]},'leaveAt':{'type':Sequelize[_0x22eb('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x22eb('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcad3=['DATE','sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcad3,0xc4));var _0x3cad=function(_0x39caaa,_0x1f37bc){_0x39caaa=_0x39caaa-0x0;var _0x9b9c7d=_0xcad3[_0x39caaa];return _0x9b9c7d;};'use strict';var moment=require('moment');var Sequelize=require(_0x3cad('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x3cad('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x3cad('0x1')]},'joinAt':{'type':Sequelize[_0x3cad('0x2')]},'leaveAt':{'type':Sequelize[_0x3cad('0x2')]},'acceptAt':{'type':Sequelize[_0x3cad('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x3cad('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 0cd7494..9d1c218 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 _0x3d04=['Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','MailQueueReport','rows','catch','show','params','rawAttributes','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset'];(function(_0xfe0ab7,_0x554514){var _0x431c21=function(_0x334173){while(--_0x334173){_0xfe0ab7['push'](_0xfe0ab7['shift']());}};_0x431c21(++_0x554514);}(_0x3d04,0xbe));var _0x43d0=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x3d04[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x43d0('0x0'));var rimraf=require(_0x43d0('0x1'));var zipdir=require(_0x43d0('0x2'));var jsonpatch=require(_0x43d0('0x3'));var rp=require(_0x43d0('0x4'));var moment=require(_0x43d0('0x5'));var BPromise=require(_0x43d0('0x6'));var Mustache=require(_0x43d0('0x7'));var util=require('util');var path=require(_0x43d0('0x8'));var sox=require(_0x43d0('0x9'));var csv=require(_0x43d0('0xa'));var ejs=require(_0x43d0('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x43d0('0xc'));var deskjs=require(_0x43d0('0xd'));var toCsv=require(_0x43d0('0xa'));var querystring=require(_0x43d0('0xe'));var Papa=require(_0x43d0('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43d0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x43d0('0x11'))(_0x43d0('0x12'));var utils=require(_0x43d0('0x13'));var config=require(_0x43d0('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x43d0('0x15'))['db'];function respondWithStatusCode(_0x23daaa,_0x546b23){_0x546b23=_0x546b23||0xcc;return function(_0x29773b){if(_0x29773b){return _0x23daaa[_0x43d0('0x16')](_0x546b23);}return _0x23daaa[_0x43d0('0x17')](_0x546b23)['end']();};}function respondWithResult(_0xd262a8,_0x2454fa){_0x2454fa=_0x2454fa||0xc8;return function(_0x436130){if(_0x436130){return _0xd262a8['status'](_0x2454fa)[_0x43d0('0x18')](_0x436130);}};}function respondWithFilteredResult(_0x357f87,_0x44e6ec){return function(_0x1218b5){if(_0x1218b5){var _0x91b4a1=typeof _0x44e6ec['offset']==='undefined'&&typeof _0x44e6ec[_0x43d0('0x19')]===_0x43d0('0x1a');var _0x35decf=_0x1218b5['count'];var _0x2c641e=_0x91b4a1?0x0:_0x44e6ec['offset'];var _0x2c9d06=_0x91b4a1?_0x1218b5[_0x43d0('0x1b')]:_0x44e6ec[_0x43d0('0x1c')]+_0x44e6ec['limit'];var _0x3d7dcc;if(_0x2c9d06>=_0x35decf){_0x2c9d06=_0x35decf;_0x3d7dcc=0xc8;}else{_0x3d7dcc=0xce;}_0x357f87[_0x43d0('0x17')](_0x3d7dcc);return _0x357f87['set'](_0x43d0('0x1d'),_0x2c641e+'-'+_0x2c9d06+'/'+_0x35decf)[_0x43d0('0x18')](_0x1218b5);}return null;};}function patchUpdates(_0x348429){return function(_0x248622){try{jsonpatch[_0x43d0('0x1e')](_0x248622,_0x348429,!![]);}catch(_0x28381b){return BPromise[_0x43d0('0x1f')](_0x28381b);}return _0x248622[_0x43d0('0x20')]();};}function saveUpdates(_0x30febc,_0xc8a644){return function(_0xec5f07){if(_0xec5f07){return _0xec5f07[_0x43d0('0x21')](_0x30febc)[_0x43d0('0x22')](function(_0xbc72e6){return _0xbc72e6;});}return null;};}function removeEntity(_0x2efd77,_0x48aa18){return function(_0x2c7b24){if(_0x2c7b24){return _0x2c7b24[_0x43d0('0x23')]()['then'](function(){_0x2efd77[_0x43d0('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29c111,_0x44497b){return function(_0x5dd310){if(!_0x5dd310){_0x29c111[_0x43d0('0x16')](0x194);}return _0x5dd310;};}function handleError(_0x238c64,_0x5ac4c0){_0x5ac4c0=_0x5ac4c0||0x1f4;return function(_0x12df30){logger[_0x43d0('0x24')](_0x12df30[_0x43d0('0x25')]);if(_0x12df30['name']){delete _0x12df30[_0x43d0('0x26')];}_0x238c64[_0x43d0('0x17')](_0x5ac4c0)[_0x43d0('0x27')](_0x12df30);};}exports[_0x43d0('0x28')]=function(_0x37d78f,_0x440ecb){var _0x31a057={},_0x4a3cd4={},_0x2b0784={'count':0x0,'rows':[]};var _0x2f5bc5=_[_0x43d0('0x29')](db['MailQueueReport']['rawAttributes'],function(_0x52c37b){return{'name':_0x52c37b[_0x43d0('0x2a')],'type':_0x52c37b[_0x43d0('0x2b')][_0x43d0('0x2c')]};});_0x4a3cd4[_0x43d0('0x2d')]=_[_0x43d0('0x29')](_0x2f5bc5,_0x43d0('0x26'));_0x4a3cd4['query']=_[_0x43d0('0x2e')](_0x37d78f[_0x43d0('0x2f')]);_0x4a3cd4[_0x43d0('0x30')]=_[_0x43d0('0x31')](_0x4a3cd4[_0x43d0('0x2d')],_0x4a3cd4[_0x43d0('0x2f')]);_0x31a057[_0x43d0('0x32')]=_[_0x43d0('0x31')](_0x4a3cd4[_0x43d0('0x2d')],qs[_0x43d0('0x33')](_0x37d78f[_0x43d0('0x2f')]['fields']));_0x31a057[_0x43d0('0x32')]=_0x31a057[_0x43d0('0x32')][_0x43d0('0x34')]?_0x31a057[_0x43d0('0x32')]:_0x4a3cd4['model'];if(!_0x37d78f[_0x43d0('0x2f')]['hasOwnProperty'](_0x43d0('0x35'))){_0x31a057[_0x43d0('0x19')]=qs['limit'](_0x37d78f[_0x43d0('0x2f')][_0x43d0('0x19')]);_0x31a057[_0x43d0('0x1c')]=qs[_0x43d0('0x1c')](_0x37d78f[_0x43d0('0x2f')][_0x43d0('0x1c')]);}_0x31a057[_0x43d0('0x36')]=qs[_0x43d0('0x37')](_0x37d78f[_0x43d0('0x2f')][_0x43d0('0x37')]);_0x31a057[_0x43d0('0x38')]=qs['filters'](_[_0x43d0('0x39')](_0x37d78f[_0x43d0('0x2f')],_0x4a3cd4[_0x43d0('0x30')]),_0x2f5bc5);if(_0x37d78f[_0x43d0('0x2f')][_0x43d0('0x3a')]){_0x31a057[_0x43d0('0x38')]=_[_0x43d0('0x3b')](_0x31a057[_0x43d0('0x38')],{'$or':_[_0x43d0('0x29')](_0x2f5bc5,function(_0x43bcc5){if(_0x43bcc5[_0x43d0('0x2b')]!==_0x43d0('0x3c')){var _0x19843c={};_0x19843c[_0x43bcc5[_0x43d0('0x26')]]={'$like':'%'+_0x37d78f['query'][_0x43d0('0x3a')]+'%'};return _0x19843c;}})});}_0x31a057=_[_0x43d0('0x3b')]({},_0x31a057,_0x37d78f[_0x43d0('0x3d')]);var _0xc3f9c7={'where':_0x31a057[_0x43d0('0x38')]};return db[_0x43d0('0x3e')][_0x43d0('0x1b')](_0xc3f9c7)[_0x43d0('0x22')](function(_0x4ae965){_0x2b0784['count']=_0x4ae965;if(_0x37d78f[_0x43d0('0x2f')]['includeAll']){_0x31a057['include']=[{'all':!![]}];}return db[_0x43d0('0x3e')]['findAll'](_0x31a057);})[_0x43d0('0x22')](function(_0x5027d0){_0x2b0784[_0x43d0('0x3f')]=_0x5027d0;return _0x2b0784;})['then'](respondWithFilteredResult(_0x440ecb,_0x31a057))[_0x43d0('0x40')](handleError(_0x440ecb,null));};exports[_0x43d0('0x41')]=function(_0x468b32,_0x4e817e){var _0x3eb2e9={'raw':!![],'where':{'id':_0x468b32[_0x43d0('0x42')]['id']}},_0x520406={};_0x520406['model']=_['keys'](db[_0x43d0('0x3e')][_0x43d0('0x43')]);_0x520406['query']=_[_0x43d0('0x2e')](_0x468b32[_0x43d0('0x2f')]);_0x520406[_0x43d0('0x30')]=_[_0x43d0('0x31')](_0x520406[_0x43d0('0x2d')],_0x520406['query']);_0x3eb2e9[_0x43d0('0x32')]=_[_0x43d0('0x31')](_0x520406[_0x43d0('0x2d')],qs[_0x43d0('0x33')](_0x468b32['query'][_0x43d0('0x33')]));_0x3eb2e9[_0x43d0('0x32')]=_0x3eb2e9[_0x43d0('0x32')][_0x43d0('0x34')]?_0x3eb2e9[_0x43d0('0x32')]:_0x520406['model'];if(_0x468b32[_0x43d0('0x2f')][_0x43d0('0x44')]){_0x3eb2e9['include']=[{'all':!![]}];}_0x3eb2e9=_[_0x43d0('0x3b')]({},_0x3eb2e9,_0x468b32[_0x43d0('0x3d')]);return db[_0x43d0('0x3e')]['find'](_0x3eb2e9)[_0x43d0('0x22')](handleEntityNotFound(_0x4e817e,null))['then'](respondWithResult(_0x4e817e,null))[_0x43d0('0x40')](handleError(_0x4e817e,null));};exports['create']=function(_0x1f55e9,_0x269d99){return db[_0x43d0('0x3e')][_0x43d0('0x45')](_0x1f55e9[_0x43d0('0x46')],{})['then'](respondWithResult(_0x269d99,0xc9))[_0x43d0('0x40')](handleError(_0x269d99,null));};exports['update']=function(_0x5a6364,_0x3e7392){if(_0x5a6364[_0x43d0('0x46')]['id']){delete _0x5a6364[_0x43d0('0x46')]['id'];}return db[_0x43d0('0x3e')][_0x43d0('0x47')]({'where':{'id':_0x5a6364[_0x43d0('0x42')]['id']}})[_0x43d0('0x22')](handleEntityNotFound(_0x3e7392,null))[_0x43d0('0x22')](saveUpdates(_0x5a6364[_0x43d0('0x46')],null))[_0x43d0('0x22')](respondWithResult(_0x3e7392,null))[_0x43d0('0x40')](handleError(_0x3e7392,null));};exports['destroy']=function(_0x338203,_0xd78af1){return db[_0x43d0('0x3e')]['find']({'where':{'id':_0x338203[_0x43d0('0x42')]['id']}})['then'](handleEntityNotFound(_0xd78af1,null))['then'](removeEntity(_0xd78af1,null))[_0x43d0('0x40')](handleError(_0xd78af1,null));};exports[_0x43d0('0x48')]=function(_0x234571,_0x127815){return db[_0x43d0('0x3e')]['describe']()['then'](respondWithResult(_0x127815,null))[_0x43d0('0x40')](handleError(_0x127815,null));}; \ No newline at end of file +var _0x4137=['key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','show','params','includeAll','options','find','catch','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','limit','count','set','apply','reject','save','update','destroy','then','end','sendStatus','error','name','send','index','map','MailQueueReport','rawAttributes','type'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x4137,0xf8));var _0x7413=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4137[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x7413('0x0'));var rimraf=require(_0x7413('0x1'));var zipdir=require(_0x7413('0x2'));var jsonpatch=require(_0x7413('0x3'));var rp=require(_0x7413('0x4'));var moment=require(_0x7413('0x5'));var BPromise=require(_0x7413('0x6'));var Mustache=require(_0x7413('0x7'));var util=require(_0x7413('0x8'));var path=require(_0x7413('0x9'));var sox=require(_0x7413('0xa'));var csv=require(_0x7413('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7413('0xc'));var _=require(_0x7413('0xd'));var squel=require(_0x7413('0xe'));var crypto=require(_0x7413('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7413('0x10'));var toCsv=require(_0x7413('0xb'));var querystring=require('querystring');var Papa=require(_0x7413('0x11'));var Redis=require(_0x7413('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7413('0x13'));var as=require(_0x7413('0x14'));var hardwareService=require(_0x7413('0x15'));var logger=require(_0x7413('0x16'))(_0x7413('0x17'));var utils=require('../../config/utils');var config=require(_0x7413('0x18'));var licenseUtil=require(_0x7413('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18a874,_0xa26ca4){_0xa26ca4=_0xa26ca4||0xcc;return function(_0x13e6bd){if(_0x13e6bd){return _0x18a874['sendStatus'](_0xa26ca4);}return _0x18a874['status'](_0xa26ca4)['end']();};}function respondWithResult(_0x2267f6,_0x336c4c){_0x336c4c=_0x336c4c||0xc8;return function(_0x49f0f6){if(_0x49f0f6){return _0x2267f6[_0x7413('0x1a')](_0x336c4c)[_0x7413('0x1b')](_0x49f0f6);}};}function respondWithFilteredResult(_0x4955d3,_0x38b3d1){return function(_0x50f301){if(_0x50f301){var _0x4b9a5b=typeof _0x38b3d1[_0x7413('0x1c')]==='undefined'&&typeof _0x38b3d1[_0x7413('0x1d')]==='undefined';var _0x2036b6=_0x50f301[_0x7413('0x1e')];var _0x19157f=_0x4b9a5b?0x0:_0x38b3d1[_0x7413('0x1c')];var _0x2a3417=_0x4b9a5b?_0x50f301[_0x7413('0x1e')]:_0x38b3d1['offset']+_0x38b3d1[_0x7413('0x1d')];var _0x17c062;if(_0x2a3417>=_0x2036b6){_0x2a3417=_0x2036b6;_0x17c062=0xc8;}else{_0x17c062=0xce;}_0x4955d3[_0x7413('0x1a')](_0x17c062);return _0x4955d3[_0x7413('0x1f')]('Content-Range',_0x19157f+'-'+_0x2a3417+'/'+_0x2036b6)[_0x7413('0x1b')](_0x50f301);}return null;};}function patchUpdates(_0x12d94d){return function(_0x206afc){try{jsonpatch[_0x7413('0x20')](_0x206afc,_0x12d94d,!![]);}catch(_0x409392){return BPromise[_0x7413('0x21')](_0x409392);}return _0x206afc[_0x7413('0x22')]();};}function saveUpdates(_0x4e18cb,_0x56a06a){return function(_0x5f12a2){if(_0x5f12a2){return _0x5f12a2[_0x7413('0x23')](_0x4e18cb)['then'](function(_0x1585ba){return _0x1585ba;});}return null;};}function removeEntity(_0x372944,_0x3b0c81){return function(_0x2fc0f4){if(_0x2fc0f4){return _0x2fc0f4[_0x7413('0x24')]()[_0x7413('0x25')](function(){_0x372944[_0x7413('0x1a')](0xcc)[_0x7413('0x26')]();});}};}function handleEntityNotFound(_0x1d455b,_0x5a8329){return function(_0x5cb15f){if(!_0x5cb15f){_0x1d455b[_0x7413('0x27')](0x194);}return _0x5cb15f;};}function handleError(_0x48c2dc,_0x46c895){_0x46c895=_0x46c895||0x1f4;return function(_0x71cbb4){logger[_0x7413('0x28')](_0x71cbb4['stack']);if(_0x71cbb4[_0x7413('0x29')]){delete _0x71cbb4[_0x7413('0x29')];}_0x48c2dc[_0x7413('0x1a')](_0x46c895)[_0x7413('0x2a')](_0x71cbb4);};}exports[_0x7413('0x2b')]=function(_0x2e521f,_0x5eb4d9){var _0x24dce7={},_0x4ed662={},_0x1d0bde={'count':0x0,'rows':[]};var _0x23e682=_[_0x7413('0x2c')](db[_0x7413('0x2d')][_0x7413('0x2e')],function(_0x2004ea){return{'name':_0x2004ea['fieldName'],'type':_0x2004ea[_0x7413('0x2f')][_0x7413('0x30')]};});_0x4ed662[_0x7413('0x31')]=_[_0x7413('0x2c')](_0x23e682,_0x7413('0x29'));_0x4ed662[_0x7413('0x32')]=_[_0x7413('0x33')](_0x2e521f['query']);_0x4ed662[_0x7413('0x34')]=_[_0x7413('0x35')](_0x4ed662[_0x7413('0x31')],_0x4ed662[_0x7413('0x32')]);_0x24dce7[_0x7413('0x36')]=_['intersection'](_0x4ed662[_0x7413('0x31')],qs['fields'](_0x2e521f[_0x7413('0x32')][_0x7413('0x37')]));_0x24dce7[_0x7413('0x36')]=_0x24dce7['attributes'][_0x7413('0x38')]?_0x24dce7['attributes']:_0x4ed662[_0x7413('0x31')];if(!_0x2e521f[_0x7413('0x32')]['hasOwnProperty']('nolimit')){_0x24dce7[_0x7413('0x1d')]=qs[_0x7413('0x1d')](_0x2e521f[_0x7413('0x32')]['limit']);_0x24dce7['offset']=qs[_0x7413('0x1c')](_0x2e521f['query']['offset']);}_0x24dce7[_0x7413('0x39')]=qs['sort'](_0x2e521f[_0x7413('0x32')][_0x7413('0x3a')]);_0x24dce7[_0x7413('0x3b')]=qs[_0x7413('0x34')](_[_0x7413('0x3c')](_0x2e521f['query'],_0x4ed662[_0x7413('0x34')]),_0x23e682);if(_0x2e521f[_0x7413('0x32')][_0x7413('0x3d')]){_0x24dce7[_0x7413('0x3b')]=_[_0x7413('0x3e')](_0x24dce7[_0x7413('0x3b')],{'$or':_[_0x7413('0x2c')](_0x23e682,function(_0x385156){if(_0x385156[_0x7413('0x2f')]!==_0x7413('0x3f')){var _0x5c03eb={};_0x5c03eb[_0x385156[_0x7413('0x29')]]={'$like':'%'+_0x2e521f['query'][_0x7413('0x3d')]+'%'};return _0x5c03eb;}})});}_0x24dce7=_['merge']({},_0x24dce7,_0x2e521f['options']);var _0x5b592c={'where':_0x24dce7['where']};return db['MailQueueReport'][_0x7413('0x1e')](_0x5b592c)['then'](function(_0x535e49){_0x1d0bde[_0x7413('0x1e')]=_0x535e49;if(_0x2e521f['query']['includeAll']){_0x24dce7[_0x7413('0x40')]=[{'all':!![]}];}return db[_0x7413('0x2d')][_0x7413('0x41')](_0x24dce7);})[_0x7413('0x25')](function(_0x8049c0){_0x1d0bde['rows']=_0x8049c0;return _0x1d0bde;})[_0x7413('0x25')](respondWithFilteredResult(_0x5eb4d9,_0x24dce7))['catch'](handleError(_0x5eb4d9,null));};exports[_0x7413('0x42')]=function(_0x1d8219,_0xa063d1){var _0xfe0daa={'raw':!![],'where':{'id':_0x1d8219[_0x7413('0x43')]['id']}},_0x3f7da2={};_0x3f7da2[_0x7413('0x31')]=_[_0x7413('0x33')](db[_0x7413('0x2d')][_0x7413('0x2e')]);_0x3f7da2[_0x7413('0x32')]=_[_0x7413('0x33')](_0x1d8219[_0x7413('0x32')]);_0x3f7da2['filters']=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],_0x3f7da2[_0x7413('0x32')]);_0xfe0daa[_0x7413('0x36')]=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],qs[_0x7413('0x37')](_0x1d8219[_0x7413('0x32')][_0x7413('0x37')]));_0xfe0daa[_0x7413('0x36')]=_0xfe0daa[_0x7413('0x36')]['length']?_0xfe0daa[_0x7413('0x36')]:_0x3f7da2['model'];if(_0x1d8219[_0x7413('0x32')][_0x7413('0x44')]){_0xfe0daa[_0x7413('0x40')]=[{'all':!![]}];}_0xfe0daa=_[_0x7413('0x3e')]({},_0xfe0daa,_0x1d8219[_0x7413('0x45')]);return db[_0x7413('0x2d')][_0x7413('0x46')](_0xfe0daa)[_0x7413('0x25')](handleEntityNotFound(_0xa063d1,null))[_0x7413('0x25')](respondWithResult(_0xa063d1,null))[_0x7413('0x47')](handleError(_0xa063d1,null));};exports['create']=function(_0x513657,_0x3c1f1a){return db['MailQueueReport']['create'](_0x513657[_0x7413('0x48')],{})[_0x7413('0x25')](respondWithResult(_0x3c1f1a,0xc9))['catch'](handleError(_0x3c1f1a,null));};exports[_0x7413('0x23')]=function(_0x586d25,_0x562bae){if(_0x586d25[_0x7413('0x48')]['id']){delete _0x586d25['body']['id'];}return db[_0x7413('0x2d')][_0x7413('0x46')]({'where':{'id':_0x586d25[_0x7413('0x43')]['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x562bae,null))[_0x7413('0x25')](saveUpdates(_0x586d25[_0x7413('0x48')],null))[_0x7413('0x25')](respondWithResult(_0x562bae,null))[_0x7413('0x47')](handleError(_0x562bae,null));};exports[_0x7413('0x24')]=function(_0x2031e3,_0x50a27d){return db[_0x7413('0x2d')]['find']({'where':{'id':_0x2031e3['params']['id']}})['then'](handleEntityNotFound(_0x50a27d,null))[_0x7413('0x25')](removeEntity(_0x50a27d,null))[_0x7413('0x47')](handleError(_0x50a27d,null));};exports[_0x7413('0x49')]=function(_0x1ba4e9,_0x4bc337){return db['MailQueueReport'][_0x7413('0x49')]()['then'](respondWithResult(_0x4bc337,null))[_0x7413('0x47')](handleError(_0x4bc337,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 3dea7bf..11733e6 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 _0xc269=['../../config/environment','./mailQueueReport.attributes','define','uniqueid','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x1e2da5,_0x40bce6){var _0x1eb655=function(_0x3dd2eb){while(--_0x3dd2eb){_0x1e2da5['push'](_0x1e2da5['shift']());}};_0x1eb655(++_0x40bce6);}(_0xc269,0x194));var _0x9c26=function(_0x461c94,_0x483844){_0x461c94=_0x461c94-0x0;var _0x47f99e=_0xc269[_0x461c94];return _0x47f99e;};'use strict';var _=require(_0x9c26('0x0'));var util=require(_0x9c26('0x1'));var logger=require(_0x9c26('0x2'))('api');var moment=require(_0x9c26('0x3'));var BPromise=require('bluebird');var rp=require(_0x9c26('0x4'));var fs=require('fs');var path=require(_0x9c26('0x5'));var rimraf=require('rimraf');var config=require(_0x9c26('0x6'));var attributes=require(_0x9c26('0x7'));module['exports']=function(_0x32b398,_0x727102){return _0x32b398[_0x9c26('0x8')]('MailQueueReport',attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x9c26('0x9'),'fields':[_0x9c26('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf12d=['bluebird','request-promise','path','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','api'];(function(_0x2867d8,_0xef3ee0){var _0x3b8176=function(_0x2b9eb8){while(--_0x2b9eb8){_0x2867d8['push'](_0x2867d8['shift']());}};_0x3b8176(++_0xef3ee0);}(_0xf12d,0x1b7));var _0xdf12=function(_0x342017,_0xe3637a){_0x342017=_0x342017-0x0;var _0x5c76a5=_0xf12d[_0x342017];return _0x5c76a5;};'use strict';var _=require(_0xdf12('0x0'));var util=require(_0xdf12('0x1'));var logger=require('../../config/logger')(_0xdf12('0x2'));var moment=require('moment');var BPromise=require(_0xdf12('0x3'));var rp=require(_0xdf12('0x4'));var fs=require('fs');var path=require(_0xdf12('0x5'));var rimraf=require('rimraf');var config=require(_0xdf12('0x6'));var attributes=require(_0xdf12('0x7'));module[_0xdf12('0x8')]=function(_0x397e72,_0x227df3){return _0x397e72[_0xdf12('0x9')](_0xdf12('0xa'),attributes,{'tableName':_0xdf12('0xb'),'paranoid':![],'indexes':[{'name':_0xdf12('0xc'),'fields':[_0xdf12('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 c3bb339..c730b9d 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 _0xadb5=['MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailQueueReport','create','options','raw','debug','MailQueueReport','body','attributes','limit','UpdateMailQueueReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x2e0976,_0x18ccc5){var _0x5bf61c=function(_0x4be6cc){while(--_0x4be6cc){_0x2e0976['push'](_0x2e0976['shift']());}};_0x5bf61c(++_0x18ccc5);}(_0xadb5,0xad));var _0x5adb=function(_0x2022ca,_0x5354c8){_0x2022ca=_0x2022ca-0x0;var _0x1441a8=_0xadb5[_0x2022ca];return _0x1441a8;};'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']('MailQueueReport,\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);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['MailQueueReport'][_0x5adb('0x16')](_0x529b65['body'],{'raw':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x18')]===undefined?!![]:![]:!![]})[_0x5adb('0xb')](function(_0x1fd4a7){logger[_0x5adb('0xc')]('CreateMailQueueReport',_0x529b65);logger[_0x5adb('0x19')]('CreateMailQueueReport',_0x529b65,JSON['stringify'](_0x1fd4a7));_0x5de028(_0x1fd4a7);})[_0x5adb('0x14')](function(_0x379b33){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x379b33[_0x5adb('0x12')],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x379b33[_0x5adb('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x4b1957){var _0x373cc3=this;return new Promise(function(_0x3220cd,_0x3839fb){return db[_0x5adb('0x1a')]['update'](_0x4b1957[_0x5adb('0x1b')],{'raw':_0x4b1957[_0x5adb('0x17')]?_0x4b1957['options'][_0x5adb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')]['where']||null:null,'attributes':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1c')]||null:null,'limit':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1d')]||null:null})['then'](function(_0x49992e){logger['info'](_0x5adb('0x1e'),_0x4b1957);logger[_0x5adb('0x19')](_0x5adb('0x1e'),_0x4b1957,JSON[_0x5adb('0xf')](_0x49992e));_0x3220cd(_0x49992e);})[_0x5adb('0x14')](function(_0x4de310){logger[_0x5adb('0x10')](_0x5adb('0x1e'),_0x4de310[_0x5adb('0x12')],_0x4b1957);_0x3839fb(_0x373cc3[_0x5adb('0x10')](0x1f4,_0x4de310[_0x5adb('0x12')]));});});}; \ No newline at end of file +var _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x317bb4,_0x58ddff){var _0x27b614=function(_0x2834da){while(--_0x2834da){_0x317bb4['push'](_0x317bb4['shift']());}};_0x27b614(++_0x58ddff);}(_0x7a54,0x106));var _0x47a5=function(_0x18e540,_0xf11714){_0x18e540=_0x18e540-0x0;var _0xd344eb=_0x7a54[_0x18e540];return _0xd344eb;};'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')]('MailQueueReport,\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['CreateMailQueueReport']=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')]('CreateMailQueueReport',_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')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index cc8644a..6c441de 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4036d4,_0x5994ab){var _0x3bc2a4=function(_0x4303f7){while(--_0x4303f7){_0x4036d4['push'](_0x4036d4['shift']());}};_0x3bc2a4(++_0x5994ab);}(_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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1ebc88,_0x638cd6){var _0xcef294=function(_0x5104bb){while(--_0x5104bb){_0x1ebc88['push'](_0x1ebc88['shift']());}};_0xcef294(++_0x638cd6);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index b68d61d..237fce3 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 _0xc788=['BOOLEAN','sequelize','exports','STRING','INTEGER'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0xc788,0xc4));var _0x8c78=function(_0x19616a,_0x545c46){_0x19616a=_0x19616a-0x0;var _0x57bfb4=_0xc788[_0x19616a];return _0x57bfb4;};'use strict';var Sequelize=require(_0x8c78('0x0'));module[_0x8c78('0x1')]={'description':{'type':Sequelize[_0x8c78('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x8c78('0x2')]},'password':{'type':Sequelize[_0x8c78('0x2')]},'port':{'type':Sequelize[_0x8c78('0x3')]},'tls':{'type':Sequelize[_0x8c78('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x8c78('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x8c78('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x8c78('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x8c78('0x2')]}}; \ No newline at end of file +var _0x8580=['STRING','INTEGER','INBOX','exports'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x8580,0x1c7));var _0x0858=function(_0xb641b7,_0x4cdbe4){_0xb641b7=_0xb641b7-0x0;var _0x151ff7=_0x8580[_0xb641b7];return _0x151ff7;};'use strict';var Sequelize=require('sequelize');module[_0x0858('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x0858('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x0858('0x1')]},'port':{'type':Sequelize[_0x0858('0x2')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x0858('0x1')],'defaultValue':_0x0858('0x3')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x0858('0x2')],'defaultValue':0x5},'service':{'type':Sequelize[_0x0858('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 3da2264..c63acc7 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 _0x6d6f=['rimraf','../../config/environment','./mailServerIn.attributes','exports','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x6d6f,0x1aa));var _0xf6d6=function(_0x199c03,_0x3254aa){_0x199c03=_0x199c03-0x0;var _0x11a7d4=_0x6d6f[_0x199c03];return _0x11a7d4;};'use strict';var _=require(_0xf6d6('0x0'));var util=require(_0xf6d6('0x1'));var logger=require(_0xf6d6('0x2'))(_0xf6d6('0x3'));var moment=require(_0xf6d6('0x4'));var BPromise=require(_0xf6d6('0x5'));var rp=require(_0xf6d6('0x6'));var fs=require('fs');var path=require(_0xf6d6('0x7'));var rimraf=require(_0xf6d6('0x8'));var config=require(_0xf6d6('0x9'));var attributes=require(_0xf6d6('0xa'));module[_0xf6d6('0xb')]=function(_0x46b21e,_0x30432d){return _0x46b21e['define'](_0xf6d6('0xc'),attributes,{'tableName':_0xf6d6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x413f=['api','request-promise','path','rimraf','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','../../config/logger'];(function(_0x1c56f7,_0x3ca1d6){var _0x4abade=function(_0x6a605f){while(--_0x6a605f){_0x1c56f7['push'](_0x1c56f7['shift']());}};_0x4abade(++_0x3ca1d6);}(_0x413f,0xda));var _0xf413=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x413f[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xf413('0x0'));var util=require('util');var logger=require(_0xf413('0x1'))(_0xf413('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf413('0x3'));var fs=require('fs');var path=require(_0xf413('0x4'));var rimraf=require(_0xf413('0x5'));var config=require('../../config/environment');var attributes=require(_0xf413('0x6'));module[_0xf413('0x7')]=function(_0x1252c1,_0x5d2b11){return _0x1252c1[_0xf413('0x8')](_0xf413('0x9'),attributes,{'tableName':_0xf413('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 c5e7b41..f233acc 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 _0x7dfc=['../../config/environment','client','http','request','info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','MailServerIn,\x20%s,\x20%s','message','result','catch','MailServerIn','findAll','raw','options','attributes','limit','map','model','include','then','GetMailServerIn','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xf3f65d,_0x50a11f){var _0x4107f8=function(_0x18f3da){while(--_0x18f3da){_0xf3f65d['push'](_0xf3f65d['shift']());}};_0x4107f8(++_0x50a11f);}(_0x7dfc,0x19b));var _0xc7df=function(_0x4e76ae,_0x714614){_0x4e76ae=_0x4e76ae-0x0;var _0x3ffb1b=_0x7dfc[_0x4e76ae];return _0x3ffb1b;};'use strict';var _=require(_0xc7df('0x0'));var util=require(_0xc7df('0x1'));var moment=require('moment');var BPromise=require(_0xc7df('0x2'));var rs=require(_0xc7df('0x3'));var fs=require('fs');var Redis=require(_0xc7df('0x4'));var db=require(_0xc7df('0x5'))['db'];var utils=require(_0xc7df('0x6'));var logger=require(_0xc7df('0x7'))(_0xc7df('0x8'));var config=require(_0xc7df('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc7df('0xa')][_0xc7df('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x288e4e,_0x2d142c,_0x2fbf63){return new BPromise(function(_0x491233,_0x69cedb){return client[_0xc7df('0xc')](_0x288e4e,_0x2fbf63)['then'](function(_0x4c81f9){logger[_0xc7df('0xd')]('MailServerIn,\x20%s,\x20%s',_0x2d142c,_0xc7df('0xe'));logger[_0xc7df('0xf')](_0xc7df('0x10'),_0x2d142c,_0xc7df('0xe'),JSON['stringify'](_0x4c81f9));if(_0x4c81f9['error']){if(_0x4c81f9[_0xc7df('0x11')][_0xc7df('0x12')]===0x1f4){logger[_0xc7df('0x11')](_0xc7df('0x13'),_0x2d142c,_0x4c81f9['error'][_0xc7df('0x14')]);return _0x69cedb(_0x4c81f9[_0xc7df('0x11')][_0xc7df('0x14')]);}logger[_0xc7df('0x11')]('MailServerIn,\x20%s,\x20%s',_0x2d142c,_0x4c81f9[_0xc7df('0x11')][_0xc7df('0x14')]);return _0x491233(_0x4c81f9[_0xc7df('0x11')][_0xc7df('0x14')]);}else{logger[_0xc7df('0xd')](_0xc7df('0x13'),_0x2d142c,'request\x20sent');_0x491233(_0x4c81f9[_0xc7df('0x15')][_0xc7df('0x14')]);}})[_0xc7df('0x16')](function(_0x3c580b){logger['error'](_0xc7df('0x13'),_0x2d142c,_0x3c580b);_0x69cedb(_0x3c580b);});});}exports['GetMailServerIn']=function(_0x548b20){var _0x43a869=this;return new Promise(function(_0x242fe3,_0x2d6932){return db[_0xc7df('0x17')][_0xc7df('0x18')]({'raw':_0x548b20['options']?_0x548b20['options'][_0xc7df('0x19')]===undefined?!![]:![]:!![],'where':_0x548b20['options']?_0x548b20['options']['where']||null:null,'attributes':_0x548b20[_0xc7df('0x1a')]?_0x548b20['options'][_0xc7df('0x1b')]||null:null,'limit':_0x548b20['options']?_0x548b20['options'][_0xc7df('0x1c')]||null:null,'include':_0x548b20['options']?_0x548b20[_0xc7df('0x1a')]['include']?_[_0xc7df('0x1d')](_0x548b20['options']['include'],function(_0x5840bf){return{'model':db[_0x5840bf[_0xc7df('0x1e')]],'as':_0x5840bf['as'],'attributes':_0x5840bf[_0xc7df('0x1b')],'include':_0x5840bf[_0xc7df('0x1f')]?_[_0xc7df('0x1d')](_0x5840bf['include'],function(_0x131bde){return{'model':db[_0x131bde[_0xc7df('0x1e')]],'as':_0x131bde['as'],'attributes':_0x131bde[_0xc7df('0x1b')],'include':_0x131bde[_0xc7df('0x1f')]?_['map'](_0x131bde[_0xc7df('0x1f')],function(_0x1c33e5){return{'model':db[_0x1c33e5[_0xc7df('0x1e')]],'as':_0x1c33e5['as'],'attributes':_0x1c33e5['attributes']};}):[]};}):[]};}):[]:[]})[_0xc7df('0x20')](function(_0x141282){logger[_0xc7df('0xd')](_0xc7df('0x21'),_0x548b20);logger[_0xc7df('0xf')](_0xc7df('0x21'),_0x548b20,JSON[_0xc7df('0x22')](_0x141282));_0x242fe3(_0x141282);})[_0xc7df('0x16')](function(_0x5c418c){logger['error'](_0xc7df('0x21'),_0x5c418c[_0xc7df('0x14')],_0x548b20);_0x2d6932(_0x43a869[_0xc7df('0x11')](0x1f4,_0x5c418c['message']));});});}; \ No newline at end of file +var _0x3cfb=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','where','attributes','limit','include','map','model','lodash','util'];(function(_0x5d5071,_0x1e4773){var _0x367d9f=function(_0x383ac7){while(--_0x383ac7){_0x5d5071['push'](_0x5d5071['shift']());}};_0x367d9f(++_0x1e4773);}(_0x3cfb,0x1b8));var _0xb3cf=function(_0x1f5f2e,_0x1b935c){_0x1f5f2e=_0x1f5f2e-0x0;var _0x6a1a07=_0x3cfb[_0x1f5f2e];return _0x6a1a07;};'use strict';var _=require(_0xb3cf('0x0'));var util=require(_0xb3cf('0x1'));var moment=require(_0xb3cf('0x2'));var BPromise=require(_0xb3cf('0x3'));var rs=require(_0xb3cf('0x4'));var fs=require('fs');var Redis=require(_0xb3cf('0x5'));var db=require(_0xb3cf('0x6'))['db'];var utils=require(_0xb3cf('0x7'));var logger=require('../../config/logger')(_0xb3cf('0x8'));var config=require(_0xb3cf('0x9'));var jayson=require(_0xb3cf('0xa'));var client=jayson['client'][_0xb3cf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b7131,_0x42ce15,_0x53be8c){return new BPromise(function(_0x19ed7d,_0x4e4cc8){return client['request'](_0x1b7131,_0x53be8c)[_0xb3cf('0xc')](function(_0x44a55d){logger[_0xb3cf('0xd')](_0xb3cf('0xe'),_0x42ce15,_0xb3cf('0xf'));logger[_0xb3cf('0x10')](_0xb3cf('0x11'),_0x42ce15,_0xb3cf('0xf'),JSON[_0xb3cf('0x12')](_0x44a55d));if(_0x44a55d[_0xb3cf('0x13')]){if(_0x44a55d[_0xb3cf('0x13')][_0xb3cf('0x14')]===0x1f4){logger[_0xb3cf('0x13')](_0xb3cf('0xe'),_0x42ce15,_0x44a55d[_0xb3cf('0x13')]['message']);return _0x4e4cc8(_0x44a55d['error'][_0xb3cf('0x15')]);}logger[_0xb3cf('0x13')]('MailServerIn,\x20%s,\x20%s',_0x42ce15,_0x44a55d[_0xb3cf('0x13')]['message']);return _0x19ed7d(_0x44a55d['error'][_0xb3cf('0x15')]);}else{logger[_0xb3cf('0xd')](_0xb3cf('0xe'),_0x42ce15,'request\x20sent');_0x19ed7d(_0x44a55d[_0xb3cf('0x16')][_0xb3cf('0x15')]);}})[_0xb3cf('0x17')](function(_0x442fd6){logger[_0xb3cf('0x13')](_0xb3cf('0xe'),_0x42ce15,_0x442fd6);_0x4e4cc8(_0x442fd6);});});}exports[_0xb3cf('0x18')]=function(_0x2d0018){var _0x1526c9=this;return new Promise(function(_0x222c1d,_0x4b0a82){return db[_0xb3cf('0x19')][_0xb3cf('0x1a')]({'raw':_0x2d0018[_0xb3cf('0x1b')]?_0x2d0018[_0xb3cf('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2d0018[_0xb3cf('0x1b')]?_0x2d0018[_0xb3cf('0x1b')][_0xb3cf('0x1c')]||null:null,'attributes':_0x2d0018[_0xb3cf('0x1b')]?_0x2d0018[_0xb3cf('0x1b')][_0xb3cf('0x1d')]||null:null,'limit':_0x2d0018[_0xb3cf('0x1b')]?_0x2d0018[_0xb3cf('0x1b')][_0xb3cf('0x1e')]||null:null,'include':_0x2d0018[_0xb3cf('0x1b')]?_0x2d0018['options'][_0xb3cf('0x1f')]?_[_0xb3cf('0x20')](_0x2d0018[_0xb3cf('0x1b')][_0xb3cf('0x1f')],function(_0x1fb3ea){return{'model':db[_0x1fb3ea[_0xb3cf('0x21')]],'as':_0x1fb3ea['as'],'attributes':_0x1fb3ea[_0xb3cf('0x1d')],'include':_0x1fb3ea[_0xb3cf('0x1f')]?_[_0xb3cf('0x20')](_0x1fb3ea[_0xb3cf('0x1f')],function(_0x5d939e){return{'model':db[_0x5d939e[_0xb3cf('0x21')]],'as':_0x5d939e['as'],'attributes':_0x5d939e[_0xb3cf('0x1d')],'include':_0x5d939e[_0xb3cf('0x1f')]?_['map'](_0x5d939e['include'],function(_0x15cf4d){return{'model':db[_0x15cf4d[_0xb3cf('0x21')]],'as':_0x15cf4d['as'],'attributes':_0x15cf4d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xfc0f5b){logger[_0xb3cf('0xd')]('GetMailServerIn',_0x2d0018);logger[_0xb3cf('0x10')](_0xb3cf('0x18'),_0x2d0018,JSON[_0xb3cf('0x12')](_0xfc0f5b));_0x222c1d(_0xfc0f5b);})[_0xb3cf('0x17')](function(_0x1b1460){logger[_0xb3cf('0x13')](_0xb3cf('0x18'),_0x1b1460[_0xb3cf('0x15')],_0x2d0018);_0x4b0a82(_0x1526c9[_0xb3cf('0x13')](0x1f4,_0x1b1460[_0xb3cf('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index b15d930..3755dd8 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(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x7a54,0x106));var _0x47a5=function(_0x2ce0e3,_0x655e45){_0x2ce0e3=_0x2ce0e3-0x0;var _0x7ae9df=_0x7a54[_0x2ce0e3];return _0x7ae9df;};'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(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x7a54,0x106));var _0x47a5=function(_0x1eee51,_0x3d7796){_0x1eee51=_0x1eee51-0x0;var _0x5ab1c7=_0x7a54[_0x1eee51];return _0x5ab1c7;};'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 b074bf0..953c92a 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 _0x541e=['BOOLEAN','sequelize','exports','STRING'];(function(_0x1c1080,_0x3f4ddd){var _0x3bdb51=function(_0x1a23f3){while(--_0x1a23f3){_0x1c1080['push'](_0x1c1080['shift']());}};_0x3bdb51(++_0x3f4ddd);}(_0x541e,0x1b5));var _0xe541=function(_0x2a45ed,_0x5d09df){_0x2a45ed=_0x2a45ed-0x0;var _0x59e079=_0x541e[_0x2a45ed];return _0x59e079;};'use strict';var Sequelize=require(_0xe541('0x0'));module[_0xe541('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xe541('0x2')]},'user':{'type':Sequelize[_0xe541('0x2')]},'pass':{'type':Sequelize[_0xe541('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0xe541('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xe541('0x2')]},'authentication':{'type':Sequelize[_0xe541('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x2729=['STRING','BOOLEAN','sequelize','exports'];(function(_0x356312,_0x4e93b7){var _0x1b1055=function(_0x224f96){while(--_0x224f96){_0x356312['push'](_0x356312['shift']());}};_0x1b1055(++_0x4e93b7);}(_0x2729,0x10e));var _0x9272=function(_0x57e0ca,_0x596976){_0x57e0ca=_0x57e0ca-0x0;var _0x310a0a=_0x2729[_0x57e0ca];return _0x310a0a;};'use strict';var Sequelize=require(_0x9272('0x0'));module[_0x9272('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x9272('0x2')]},'user':{'type':Sequelize[_0x9272('0x2')]},'pass':{'type':Sequelize[_0x9272('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x9272('0x2')]},'authentication':{'type':Sequelize[_0x9272('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 b014595..fe35268 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 _0x0522=['querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','fs-extra','crypto','jsforce','desk.js'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x0522,0xc5));var _0x2052=function(_0x433557,_0x24c4a4){_0x433557=_0x433557-0x0;var _0x18dd55=_0x0522[_0x433557];return _0x18dd55;};'use strict';var emlformat=require(_0x2052('0x0'));var rimraf=require(_0x2052('0x1'));var zipdir=require(_0x2052('0x2'));var jsonpatch=require(_0x2052('0x3'));var rp=require('request-promise');var moment=require(_0x2052('0x4'));var BPromise=require(_0x2052('0x5'));var Mustache=require(_0x2052('0x6'));var util=require(_0x2052('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x2052('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2052('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2052('0xa'));var jsforce=require(_0x2052('0xb'));var deskjs=require(_0x2052('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2052('0xd'));var Papa=require(_0x2052('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2052('0xf'));var as=require(_0x2052('0x10'));var hardwareService=require(_0x2052('0x11'));var logger=require(_0x2052('0x12'))(_0x2052('0x13'));var utils=require(_0x2052('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2052('0x15'))['db'];function respondWithStatusCode(_0x7dc4b,_0x55d014){_0x55d014=_0x55d014||0xcc;return function(_0x28dcea){if(_0x28dcea){return _0x7dc4b['sendStatus'](_0x55d014);}return _0x7dc4b[_0x2052('0x16')](_0x55d014)[_0x2052('0x17')]();};}function respondWithResult(_0x376e69,_0x9a1e03){_0x9a1e03=_0x9a1e03||0xc8;return function(_0x289981){if(_0x289981){return _0x376e69[_0x2052('0x16')](_0x9a1e03)[_0x2052('0x18')](_0x289981);}};}function respondWithFilteredResult(_0x367c8d,_0x1f3f1e){return function(_0x3ea319){if(_0x3ea319){var _0x3dc398=typeof _0x1f3f1e[_0x2052('0x19')]===_0x2052('0x1a')&&typeof _0x1f3f1e[_0x2052('0x1b')]===_0x2052('0x1a');var _0x5eb853=_0x3ea319[_0x2052('0x1c')];var _0x416f4d=_0x3dc398?0x0:_0x1f3f1e['offset'];var _0x2eb24c=_0x3dc398?_0x3ea319[_0x2052('0x1c')]:_0x1f3f1e[_0x2052('0x19')]+_0x1f3f1e[_0x2052('0x1b')];var _0x417a86;if(_0x2eb24c>=_0x5eb853){_0x2eb24c=_0x5eb853;_0x417a86=0xc8;}else{_0x417a86=0xce;}_0x367c8d[_0x2052('0x16')](_0x417a86);return _0x367c8d[_0x2052('0x1d')]('Content-Range',_0x416f4d+'-'+_0x2eb24c+'/'+_0x5eb853)[_0x2052('0x18')](_0x3ea319);}return null;};}function patchUpdates(_0x2193a9){return function(_0x4527c5){try{jsonpatch['apply'](_0x4527c5,_0x2193a9,!![]);}catch(_0x831547){return BPromise['reject'](_0x831547);}return _0x4527c5[_0x2052('0x1e')]();};}function saveUpdates(_0x16e1af,_0x148578){return function(_0x24ab1b){if(_0x24ab1b){return _0x24ab1b[_0x2052('0x1f')](_0x16e1af)[_0x2052('0x20')](function(_0xcf62e){return _0xcf62e;});}return null;};}function removeEntity(_0x5bb3f3,_0x16bd61){return function(_0xfcd464){if(_0xfcd464){return _0xfcd464[_0x2052('0x21')]()[_0x2052('0x20')](function(){_0x5bb3f3[_0x2052('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c3ca8,_0x3ed92d){return function(_0x4414a5){if(!_0x4414a5){_0x4c3ca8[_0x2052('0x22')](0x194);}return _0x4414a5;};}function handleError(_0x346cba,_0x43cb30){_0x43cb30=_0x43cb30||0x1f4;return function(_0x44dee9){logger[_0x2052('0x23')](_0x44dee9[_0x2052('0x24')]);if(_0x44dee9[_0x2052('0x25')]){delete _0x44dee9[_0x2052('0x25')];}_0x346cba[_0x2052('0x16')](_0x43cb30)[_0x2052('0x26')](_0x44dee9);};}exports[_0x2052('0x27')]=function(_0x4257b5,_0x2d363a){var _0x36f58e={},_0x4da8ff={},_0x17e3b8={'count':0x0,'rows':[]};var _0x494e97=_[_0x2052('0x28')](db[_0x2052('0x29')][_0x2052('0x2a')],function(_0x55750c){return{'name':_0x55750c[_0x2052('0x2b')],'type':_0x55750c[_0x2052('0x2c')]['key']};});_0x4da8ff[_0x2052('0x2d')]=_['map'](_0x494e97,_0x2052('0x25'));_0x4da8ff['query']=_[_0x2052('0x2e')](_0x4257b5[_0x2052('0x2f')]);_0x4da8ff[_0x2052('0x30')]=_[_0x2052('0x31')](_0x4da8ff[_0x2052('0x2d')],_0x4da8ff[_0x2052('0x2f')]);_0x36f58e[_0x2052('0x32')]=_[_0x2052('0x31')](_0x4da8ff[_0x2052('0x2d')],qs[_0x2052('0x33')](_0x4257b5['query'][_0x2052('0x33')]));_0x36f58e['attributes']=_0x36f58e[_0x2052('0x32')][_0x2052('0x34')]?_0x36f58e[_0x2052('0x32')]:_0x4da8ff[_0x2052('0x2d')];if(!_0x4257b5['query']['hasOwnProperty']('nolimit')){_0x36f58e['limit']=qs['limit'](_0x4257b5[_0x2052('0x2f')][_0x2052('0x1b')]);_0x36f58e[_0x2052('0x19')]=qs[_0x2052('0x19')](_0x4257b5[_0x2052('0x2f')]['offset']);}_0x36f58e[_0x2052('0x35')]=qs[_0x2052('0x36')](_0x4257b5[_0x2052('0x2f')]['sort']);_0x36f58e[_0x2052('0x37')]=qs['filters'](_[_0x2052('0x38')](_0x4257b5[_0x2052('0x2f')],_0x4da8ff[_0x2052('0x30')]),_0x494e97);if(_0x4257b5[_0x2052('0x2f')]['filter']){_0x36f58e[_0x2052('0x37')]=_[_0x2052('0x39')](_0x36f58e[_0x2052('0x37')],{'$or':_[_0x2052('0x28')](_0x494e97,function(_0x4abdf3){if(_0x4abdf3[_0x2052('0x2c')]!==_0x2052('0x3a')){var _0x257b9e={};_0x257b9e[_0x4abdf3[_0x2052('0x25')]]={'$like':'%'+_0x4257b5[_0x2052('0x2f')]['filter']+'%'};return _0x257b9e;}})});}_0x36f58e=_['merge']({},_0x36f58e,_0x4257b5[_0x2052('0x3b')]);var _0x368801={'where':_0x36f58e['where']};return db['MailServerOut']['count'](_0x368801)[_0x2052('0x20')](function(_0x6ea5e8){_0x17e3b8[_0x2052('0x1c')]=_0x6ea5e8;if(_0x4257b5[_0x2052('0x2f')][_0x2052('0x3c')]){_0x36f58e[_0x2052('0x3d')]=[{'all':!![]}];}return db[_0x2052('0x29')][_0x2052('0x3e')](_0x36f58e);})[_0x2052('0x20')](function(_0x484059){_0x17e3b8[_0x2052('0x3f')]=_0x484059;return _0x17e3b8;})[_0x2052('0x20')](respondWithFilteredResult(_0x2d363a,_0x36f58e))[_0x2052('0x40')](handleError(_0x2d363a,null));};exports[_0x2052('0x41')]=function(_0x46638c,_0x21d814){var _0x443f94={'raw':!![],'where':{'id':_0x46638c[_0x2052('0x42')]['id']}},_0x5327af={};_0x5327af['model']=_['keys'](db['MailServerOut'][_0x2052('0x2a')]);_0x5327af['query']=_[_0x2052('0x2e')](_0x46638c['query']);_0x5327af[_0x2052('0x30')]=_[_0x2052('0x31')](_0x5327af[_0x2052('0x2d')],_0x5327af[_0x2052('0x2f')]);_0x443f94[_0x2052('0x32')]=_['intersection'](_0x5327af['model'],qs['fields'](_0x46638c[_0x2052('0x2f')]['fields']));_0x443f94[_0x2052('0x32')]=_0x443f94[_0x2052('0x32')][_0x2052('0x34')]?_0x443f94['attributes']:_0x5327af[_0x2052('0x2d')];if(_0x46638c[_0x2052('0x2f')][_0x2052('0x3c')]){_0x443f94['include']=[{'all':!![]}];}_0x443f94=_[_0x2052('0x39')]({},_0x443f94,_0x46638c[_0x2052('0x3b')]);return db[_0x2052('0x29')]['find'](_0x443f94)[_0x2052('0x20')](handleEntityNotFound(_0x21d814,null))['then'](respondWithResult(_0x21d814,null))[_0x2052('0x40')](handleError(_0x21d814,null));};exports[_0x2052('0x43')]=function(_0x55efb5,_0x3a8182){return db[_0x2052('0x29')][_0x2052('0x43')](_0x55efb5['body'],{})['then'](respondWithResult(_0x3a8182,0xc9))[_0x2052('0x40')](handleError(_0x3a8182,null));};exports[_0x2052('0x1f')]=function(_0x5013db,_0x2e7247){if(_0x5013db['body']['id']){delete _0x5013db['body']['id'];}return db['MailServerOut']['find']({'where':{'id':_0x5013db['params']['id']}})[_0x2052('0x20')](handleEntityNotFound(_0x2e7247,null))[_0x2052('0x20')](saveUpdates(_0x5013db[_0x2052('0x44')],null))[_0x2052('0x20')](respondWithResult(_0x2e7247,null))[_0x2052('0x40')](handleError(_0x2e7247,null));};exports['destroy']=function(_0x20a23b,_0x4ab8d4){return db[_0x2052('0x29')][_0x2052('0x45')]({'where':{'id':_0x20a23b[_0x2052('0x42')]['id']}})[_0x2052('0x20')](handleEntityNotFound(_0x4ab8d4,null))[_0x2052('0x20')](removeEntity(_0x4ab8d4,null))[_0x2052('0x40')](handleError(_0x4ab8d4,null));}; \ No newline at end of file +var _0xb0aa=['body','catch','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','keys','find','create'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb0aa,0xe1));var _0xab0a=function(_0x4511e5,_0xa4e38){_0x4511e5=_0x4511e5-0x0;var _0x5d3f51=_0xb0aa[_0x4511e5];return _0x5d3f51;};'use strict';var emlformat=require(_0xab0a('0x0'));var rimraf=require(_0xab0a('0x1'));var zipdir=require(_0xab0a('0x2'));var jsonpatch=require(_0xab0a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xab0a('0x4'));var Mustache=require('mustache');var util=require(_0xab0a('0x5'));var path=require('path');var sox=require(_0xab0a('0x6'));var csv=require(_0xab0a('0x7'));var ejs=require(_0xab0a('0x8'));var fs=require('fs');var fs_extra=require(_0xab0a('0x9'));var _=require('lodash');var squel=require(_0xab0a('0xa'));var crypto=require(_0xab0a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xab0a('0xc'));var toCsv=require(_0xab0a('0x7'));var querystring=require('querystring');var Papa=require(_0xab0a('0xd'));var Redis=require(_0xab0a('0xe'));var authService=require(_0xab0a('0xf'));var qs=require(_0xab0a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xab0a('0x11'));var logger=require(_0xab0a('0x12'))('api');var utils=require(_0xab0a('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xab0a('0x14'))['db'];function respondWithStatusCode(_0x2a1fd4,_0x2b2fb4){_0x2b2fb4=_0x2b2fb4||0xcc;return function(_0x2ffaf6){if(_0x2ffaf6){return _0x2a1fd4[_0xab0a('0x15')](_0x2b2fb4);}return _0x2a1fd4[_0xab0a('0x16')](_0x2b2fb4)[_0xab0a('0x17')]();};}function respondWithResult(_0x430469,_0x48c4b7){_0x48c4b7=_0x48c4b7||0xc8;return function(_0x18a96f){if(_0x18a96f){return _0x430469[_0xab0a('0x16')](_0x48c4b7)[_0xab0a('0x18')](_0x18a96f);}};}function respondWithFilteredResult(_0x3270b2,_0x4ab496){return function(_0x487240){if(_0x487240){var _0x3ea7b7=typeof _0x4ab496[_0xab0a('0x19')]===_0xab0a('0x1a')&&typeof _0x4ab496[_0xab0a('0x1b')]===_0xab0a('0x1a');var _0x37b0b5=_0x487240[_0xab0a('0x1c')];var _0x4070f4=_0x3ea7b7?0x0:_0x4ab496['offset'];var _0xba144=_0x3ea7b7?_0x487240[_0xab0a('0x1c')]:_0x4ab496[_0xab0a('0x19')]+_0x4ab496[_0xab0a('0x1b')];var _0x387df0;if(_0xba144>=_0x37b0b5){_0xba144=_0x37b0b5;_0x387df0=0xc8;}else{_0x387df0=0xce;}_0x3270b2[_0xab0a('0x16')](_0x387df0);return _0x3270b2[_0xab0a('0x1d')](_0xab0a('0x1e'),_0x4070f4+'-'+_0xba144+'/'+_0x37b0b5)[_0xab0a('0x18')](_0x487240);}return null;};}function patchUpdates(_0x54497c){return function(_0x463b44){try{jsonpatch[_0xab0a('0x1f')](_0x463b44,_0x54497c,!![]);}catch(_0x14ea48){return BPromise[_0xab0a('0x20')](_0x14ea48);}return _0x463b44[_0xab0a('0x21')]();};}function saveUpdates(_0x31e6a3,_0x3370fc){return function(_0x416a64){if(_0x416a64){return _0x416a64[_0xab0a('0x22')](_0x31e6a3)[_0xab0a('0x23')](function(_0x3c009a){return _0x3c009a;});}return null;};}function removeEntity(_0x3e8984,_0x24c0dc){return function(_0x180cb6){if(_0x180cb6){return _0x180cb6[_0xab0a('0x24')]()[_0xab0a('0x23')](function(){_0x3e8984[_0xab0a('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd2202e,_0x2972b9){return function(_0x590631){if(!_0x590631){_0xd2202e['sendStatus'](0x194);}return _0x590631;};}function handleError(_0x5ce4b1,_0x3d74fc){_0x3d74fc=_0x3d74fc||0x1f4;return function(_0x565729){logger[_0xab0a('0x25')](_0x565729[_0xab0a('0x26')]);if(_0x565729[_0xab0a('0x27')]){delete _0x565729['name'];}_0x5ce4b1[_0xab0a('0x16')](_0x3d74fc)[_0xab0a('0x28')](_0x565729);};}exports[_0xab0a('0x29')]=function(_0x41fa03,_0x1aee7b){var _0x1d4518={},_0x580f28={},_0x1140f8={'count':0x0,'rows':[]};var _0x178fc6=_[_0xab0a('0x2a')](db[_0xab0a('0x2b')][_0xab0a('0x2c')],function(_0x52fd67){return{'name':_0x52fd67[_0xab0a('0x2d')],'type':_0x52fd67[_0xab0a('0x2e')]['key']};});_0x580f28[_0xab0a('0x2f')]=_[_0xab0a('0x2a')](_0x178fc6,_0xab0a('0x27'));_0x580f28[_0xab0a('0x30')]=_['keys'](_0x41fa03['query']);_0x580f28[_0xab0a('0x31')]=_[_0xab0a('0x32')](_0x580f28[_0xab0a('0x2f')],_0x580f28[_0xab0a('0x30')]);_0x1d4518[_0xab0a('0x33')]=_[_0xab0a('0x32')](_0x580f28[_0xab0a('0x2f')],qs[_0xab0a('0x34')](_0x41fa03['query'][_0xab0a('0x34')]));_0x1d4518['attributes']=_0x1d4518[_0xab0a('0x33')][_0xab0a('0x35')]?_0x1d4518['attributes']:_0x580f28['model'];if(!_0x41fa03[_0xab0a('0x30')][_0xab0a('0x36')](_0xab0a('0x37'))){_0x1d4518[_0xab0a('0x1b')]=qs['limit'](_0x41fa03[_0xab0a('0x30')]['limit']);_0x1d4518['offset']=qs[_0xab0a('0x19')](_0x41fa03['query'][_0xab0a('0x19')]);}_0x1d4518['order']=qs[_0xab0a('0x38')](_0x41fa03[_0xab0a('0x30')][_0xab0a('0x38')]);_0x1d4518[_0xab0a('0x39')]=qs['filters'](_[_0xab0a('0x3a')](_0x41fa03['query'],_0x580f28[_0xab0a('0x31')]),_0x178fc6);if(_0x41fa03['query']['filter']){_0x1d4518[_0xab0a('0x39')]=_[_0xab0a('0x3b')](_0x1d4518[_0xab0a('0x39')],{'$or':_['map'](_0x178fc6,function(_0x2d6311){if(_0x2d6311[_0xab0a('0x2e')]!==_0xab0a('0x3c')){var _0x3d41b7={};_0x3d41b7[_0x2d6311[_0xab0a('0x27')]]={'$like':'%'+_0x41fa03[_0xab0a('0x30')][_0xab0a('0x3d')]+'%'};return _0x3d41b7;}})});}_0x1d4518=_['merge']({},_0x1d4518,_0x41fa03[_0xab0a('0x3e')]);var _0x33892a={'where':_0x1d4518[_0xab0a('0x39')]};return db[_0xab0a('0x2b')][_0xab0a('0x1c')](_0x33892a)[_0xab0a('0x23')](function(_0x4d8662){_0x1140f8[_0xab0a('0x1c')]=_0x4d8662;if(_0x41fa03[_0xab0a('0x30')][_0xab0a('0x3f')]){_0x1d4518[_0xab0a('0x40')]=[{'all':!![]}];}return db[_0xab0a('0x2b')][_0xab0a('0x41')](_0x1d4518);})[_0xab0a('0x23')](function(_0x381001){_0x1140f8[_0xab0a('0x42')]=_0x381001;return _0x1140f8;})[_0xab0a('0x23')](respondWithFilteredResult(_0x1aee7b,_0x1d4518))['catch'](handleError(_0x1aee7b,null));};exports[_0xab0a('0x43')]=function(_0x4d8caa,_0x47d7ee){var _0xc50114={'raw':!![],'where':{'id':_0x4d8caa['params']['id']}},_0x15b0ff={};_0x15b0ff[_0xab0a('0x2f')]=_['keys'](db['MailServerOut'][_0xab0a('0x2c')]);_0x15b0ff[_0xab0a('0x30')]=_[_0xab0a('0x44')](_0x4d8caa[_0xab0a('0x30')]);_0x15b0ff['filters']=_[_0xab0a('0x32')](_0x15b0ff[_0xab0a('0x2f')],_0x15b0ff[_0xab0a('0x30')]);_0xc50114[_0xab0a('0x33')]=_[_0xab0a('0x32')](_0x15b0ff[_0xab0a('0x2f')],qs[_0xab0a('0x34')](_0x4d8caa[_0xab0a('0x30')][_0xab0a('0x34')]));_0xc50114[_0xab0a('0x33')]=_0xc50114['attributes'][_0xab0a('0x35')]?_0xc50114['attributes']:_0x15b0ff[_0xab0a('0x2f')];if(_0x4d8caa['query'][_0xab0a('0x3f')]){_0xc50114[_0xab0a('0x40')]=[{'all':!![]}];}_0xc50114=_[_0xab0a('0x3b')]({},_0xc50114,_0x4d8caa[_0xab0a('0x3e')]);return db[_0xab0a('0x2b')][_0xab0a('0x45')](_0xc50114)[_0xab0a('0x23')](handleEntityNotFound(_0x47d7ee,null))[_0xab0a('0x23')](respondWithResult(_0x47d7ee,null))['catch'](handleError(_0x47d7ee,null));};exports[_0xab0a('0x46')]=function(_0x51106d,_0x34b8a5){return db[_0xab0a('0x2b')]['create'](_0x51106d[_0xab0a('0x47')],{})[_0xab0a('0x23')](respondWithResult(_0x34b8a5,0xc9))['catch'](handleError(_0x34b8a5,null));};exports['update']=function(_0x404e0a,_0x3e8630){if(_0x404e0a[_0xab0a('0x47')]['id']){delete _0x404e0a['body']['id'];}return db['MailServerOut'][_0xab0a('0x45')]({'where':{'id':_0x404e0a['params']['id']}})[_0xab0a('0x23')](handleEntityNotFound(_0x3e8630,null))[_0xab0a('0x23')](saveUpdates(_0x404e0a[_0xab0a('0x47')],null))[_0xab0a('0x23')](respondWithResult(_0x3e8630,null))[_0xab0a('0x48')](handleError(_0x3e8630,null));};exports[_0xab0a('0x24')]=function(_0x4da04c,_0x485b03){return db[_0xab0a('0x2b')]['find']({'where':{'id':_0x4da04c[_0xab0a('0x49')]['id']}})[_0xab0a('0x23')](handleEntityNotFound(_0x485b03,null))[_0xab0a('0x23')](removeEntity(_0x485b03,null))['catch'](handleError(_0x485b03,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index e639a51..3850531 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 _0xe302=['MailServerOut','util','../../config/logger','bluebird','request-promise','../../config/environment','exports','define'];(function(_0x323c9a,_0x2e06c3){var _0x1c8f0d=function(_0x42ec63){while(--_0x42ec63){_0x323c9a['push'](_0x323c9a['shift']());}};_0x1c8f0d(++_0x2e06c3);}(_0xe302,0x149));var _0x2e30=function(_0x247cb6,_0x136177){_0x247cb6=_0x247cb6-0x0;var _0x554363=_0xe302[_0x247cb6];return _0x554363;};'use strict';var _=require('lodash');var util=require(_0x2e30('0x0'));var logger=require(_0x2e30('0x1'))('api');var moment=require('moment');var BPromise=require(_0x2e30('0x2'));var rp=require(_0x2e30('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2e30('0x4'));var attributes=require('./mailServerOut.attributes');module[_0x2e30('0x5')]=function(_0x264411,_0x2a0997){return _0x264411[_0x2e30('0x6')](_0x2e30('0x7'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2b6=['api','moment','request-promise','path','rimraf','./mailServerOut.attributes','define','MailServerOut','util','../../config/logger'];(function(_0x48498f,_0x4837a7){var _0x33e431=function(_0x471bf0){while(--_0x471bf0){_0x48498f['push'](_0x48498f['shift']());}};_0x33e431(++_0x4837a7);}(_0xf2b6,0x148));var _0x6f2b=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xf2b6[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require(_0x6f2b('0x0'));var logger=require(_0x6f2b('0x1'))(_0x6f2b('0x2'));var moment=require(_0x6f2b('0x3'));var BPromise=require('bluebird');var rp=require(_0x6f2b('0x4'));var fs=require('fs');var path=require(_0x6f2b('0x5'));var rimraf=require(_0x6f2b('0x6'));var config=require('../../config/environment');var attributes=require(_0x6f2b('0x7'));module['exports']=function(_0x1d317d,_0x5dd1ff){return _0x1d317d[_0x6f2b('0x8')](_0x6f2b('0x9'),attributes,{'tableName':'mail_servers_out','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 8361865..48dc3f6 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x2d2fdd,_0x3f30d3){var _0x3a3c66=function(_0x2aff35){while(--_0x2aff35){_0x2d2fdd['push'](_0x2d2fdd['shift']());}};_0x3a3c66(++_0x3f30d3);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc4aa[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2d015c,_0x31bb7e){var _0x403093=function(_0x2dc795){while(--_0x2dc795){_0x2d015c['push'](_0x2d015c['shift']());}};_0x403093(++_0x31bb7e);}(_0xadb5,0xad));var _0x5adb=function(_0xb08561,_0x1caccc){_0xb08561=_0xb08561-0x0;var _0x155714=_0xadb5[_0xb08561];return _0x155714;};'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']('MailServerOut,\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/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index ae42434..e06973d 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 _0xa6ab=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','delete','destroy','exports'];(function(_0x3fa3e4,_0x27f723){var _0x2b144b=function(_0x1f8c6e){while(--_0x1f8c6e){_0x3fa3e4['push'](_0x3fa3e4['shift']());}};_0x2b144b(++_0x27f723);}(_0xa6ab,0x18c));var _0xba6a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa6ab[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xba6a('0x0'));var util=require(_0xba6a('0x1'));var path=require(_0xba6a('0x2'));var timeout=require(_0xba6a('0x3'));var express=require(_0xba6a('0x4'));var router=express['Router']();var fs_extra=require(_0xba6a('0x5'));var auth=require(_0xba6a('0x6'));var interaction=require(_0xba6a('0x7'));var config=require(_0xba6a('0x8'));var controller=require(_0xba6a('0x9'));router[_0xba6a('0xa')]('/',auth[_0xba6a('0xb')](),controller[_0xba6a('0xc')]);router['get'](_0xba6a('0xd'),auth[_0xba6a('0xb')](),controller[_0xba6a('0xe')]);router[_0xba6a('0xa')](_0xba6a('0xf'),auth[_0xba6a('0xb')](),controller[_0xba6a('0x10')]);router[_0xba6a('0x11')]('/',auth[_0xba6a('0xb')](),controller['create']);router['put'](_0xba6a('0xf'),auth[_0xba6a('0xb')](),controller[_0xba6a('0x12')]);router[_0xba6a('0x13')](_0xba6a('0xf'),auth[_0xba6a('0xb')](),controller[_0xba6a('0x14')]);module[_0xba6a('0x15')]=router; \ No newline at end of file +var _0x6d50=['exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','index','get','/describe','isAuthenticated','describe','show','post','create','/:id','update','delete'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6d50,0x17d));var _0x06d5=function(_0x1caa1e,_0x4755a1){_0x1caa1e=_0x1caa1e-0x0;var _0x502c47=_0x6d50[_0x1caa1e];return _0x502c47;};'use strict';var multer=require(_0x06d5('0x0'));var util=require(_0x06d5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x06d5('0x2'));var router=express['Router']();var fs_extra=require(_0x06d5('0x3'));var auth=require(_0x06d5('0x4'));var interaction=require(_0x06d5('0x5'));var config=require(_0x06d5('0x6'));var controller=require(_0x06d5('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x06d5('0x8')]);router[_0x06d5('0x9')](_0x06d5('0xa'),auth[_0x06d5('0xb')](),controller[_0x06d5('0xc')]);router[_0x06d5('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x06d5('0xd')]);router[_0x06d5('0xe')]('/',auth[_0x06d5('0xb')](),controller[_0x06d5('0xf')]);router['put'](_0x06d5('0x10'),auth[_0x06d5('0xb')](),controller[_0x06d5('0x11')]);router[_0x06d5('0x12')](_0x06d5('0x10'),auth[_0x06d5('0xb')](),controller['destroy']);module[_0x06d5('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 a5fb045..44d17d5 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 _0xba18=['STRING','name','sequelize','exports'];(function(_0x8b247d,_0x9401a9){var _0x4e10a3=function(_0x176b53){while(--_0x176b53){_0x8b247d['push'](_0x8b247d['shift']());}};_0x4e10a3(++_0x9401a9);}(_0xba18,0x1ea));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8ba1('0x0'));module[_0x8ba1('0x1')]={'name':{'type':Sequelize[_0x8ba1('0x2')],'unique':_0x8ba1('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8ba1('0x2')]}}; \ No newline at end of file +var _0x2eb2=['name','exports','STRING'];(function(_0x1e91eb,_0x5829a3){var _0x2af75a=function(_0x1815d1){while(--_0x1815d1){_0x1e91eb['push'](_0x1e91eb['shift']());}};_0x2af75a(++_0x5829a3);}(_0x2eb2,0x19f));var _0x22eb=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x2eb2[_0x491a7f];return _0x3d8f44;};'use strict';var Sequelize=require('sequelize');module[_0x22eb('0x0')]={'name':{'type':Sequelize[_0x22eb('0x1')],'unique':_0x22eb('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x22eb('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 063afac..6ae43a7 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 _0x6d7e=['merge','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter'];(function(_0x38f823,_0x3cee3c){var _0x310838=function(_0x2c69b7){while(--_0x2c69b7){_0x38f823['push'](_0x38f823['shift']());}};_0x310838(++_0x3cee3c);}(_0x6d7e,0x1bc));var _0xe6d7=function(_0x30d679,_0x63fb68){_0x30d679=_0x30d679-0x0;var _0x1d3fcf=_0x6d7e[_0x30d679];return _0x1d3fcf;};'use strict';var emlformat=require(_0xe6d7('0x0'));var rimraf=require(_0xe6d7('0x1'));var zipdir=require(_0xe6d7('0x2'));var jsonpatch=require(_0xe6d7('0x3'));var rp=require(_0xe6d7('0x4'));var moment=require(_0xe6d7('0x5'));var BPromise=require(_0xe6d7('0x6'));var Mustache=require(_0xe6d7('0x7'));var util=require('util');var path=require(_0xe6d7('0x8'));var sox=require('sox');var csv=require(_0xe6d7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe6d7('0xa'));var _=require('lodash');var squel=require(_0xe6d7('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe6d7('0xc'));var toCsv=require(_0xe6d7('0x9'));var querystring=require('querystring');var Papa=require(_0xe6d7('0xd'));var Redis=require('ioredis');var authService=require(_0xe6d7('0xe'));var qs=require(_0xe6d7('0xf'));var as=require(_0xe6d7('0x10'));var hardwareService=require(_0xe6d7('0x11'));var logger=require(_0xe6d7('0x12'))(_0xe6d7('0x13'));var utils=require('../../config/utils');var config=require(_0xe6d7('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xced2ac,_0x4e5362){_0x4e5362=_0x4e5362||0xcc;return function(_0x1b43f2){if(_0x1b43f2){return _0xced2ac[_0xe6d7('0x15')](_0x4e5362);}return _0xced2ac[_0xe6d7('0x16')](_0x4e5362)[_0xe6d7('0x17')]();};}function respondWithResult(_0x2d7067,_0x32a4d1){_0x32a4d1=_0x32a4d1||0xc8;return function(_0xaa044b){if(_0xaa044b){return _0x2d7067[_0xe6d7('0x16')](_0x32a4d1)[_0xe6d7('0x18')](_0xaa044b);}};}function respondWithFilteredResult(_0x3f402b,_0x1520bc){return function(_0x4c7b24){if(_0x4c7b24){var _0x50e566=typeof _0x1520bc[_0xe6d7('0x19')]==='undefined'&&typeof _0x1520bc[_0xe6d7('0x1a')]===_0xe6d7('0x1b');var _0x488e83=_0x4c7b24[_0xe6d7('0x1c')];var _0x1b7c92=_0x50e566?0x0:_0x1520bc[_0xe6d7('0x19')];var _0x3028b3=_0x50e566?_0x4c7b24['count']:_0x1520bc[_0xe6d7('0x19')]+_0x1520bc[_0xe6d7('0x1a')];var _0x5caaf4;if(_0x3028b3>=_0x488e83){_0x3028b3=_0x488e83;_0x5caaf4=0xc8;}else{_0x5caaf4=0xce;}_0x3f402b['status'](_0x5caaf4);return _0x3f402b[_0xe6d7('0x1d')](_0xe6d7('0x1e'),_0x1b7c92+'-'+_0x3028b3+'/'+_0x488e83)[_0xe6d7('0x18')](_0x4c7b24);}return null;};}function patchUpdates(_0x58f4a0){return function(_0x3800a9){try{jsonpatch[_0xe6d7('0x1f')](_0x3800a9,_0x58f4a0,!![]);}catch(_0x3a626d){return BPromise[_0xe6d7('0x20')](_0x3a626d);}return _0x3800a9['save']();};}function saveUpdates(_0x507c79,_0x126601){return function(_0x4dd7d4){if(_0x4dd7d4){return _0x4dd7d4[_0xe6d7('0x21')](_0x507c79)['then'](function(_0x899ce){return _0x899ce;});}return null;};}function removeEntity(_0x208baf,_0x2cee06){return function(_0x3663c1){if(_0x3663c1){return _0x3663c1[_0xe6d7('0x22')]()[_0xe6d7('0x23')](function(){_0x208baf[_0xe6d7('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bd99d,_0x172e49){return function(_0x18af44){if(!_0x18af44){_0x1bd99d[_0xe6d7('0x15')](0x194);}return _0x18af44;};}function handleError(_0x3de292,_0x100449){_0x100449=_0x100449||0x1f4;return function(_0x53917a){logger[_0xe6d7('0x24')](_0x53917a[_0xe6d7('0x25')]);if(_0x53917a[_0xe6d7('0x26')]){delete _0x53917a[_0xe6d7('0x26')];}_0x3de292[_0xe6d7('0x16')](_0x100449)['send'](_0x53917a);};}exports[_0xe6d7('0x27')]=function(_0x1f7437,_0x5c9efd){var _0x59b414={},_0xc50a57={},_0x6f6c6a={'count':0x0,'rows':[]};var _0x55fe08=_[_0xe6d7('0x28')](db[_0xe6d7('0x29')][_0xe6d7('0x2a')],function(_0x45b2e1){return{'name':_0x45b2e1[_0xe6d7('0x2b')],'type':_0x45b2e1[_0xe6d7('0x2c')][_0xe6d7('0x2d')]};});_0xc50a57[_0xe6d7('0x2e')]=_[_0xe6d7('0x28')](_0x55fe08,_0xe6d7('0x26'));_0xc50a57[_0xe6d7('0x2f')]=_[_0xe6d7('0x30')](_0x1f7437[_0xe6d7('0x2f')]);_0xc50a57['filters']=_['intersection'](_0xc50a57[_0xe6d7('0x2e')],_0xc50a57[_0xe6d7('0x2f')]);_0x59b414['attributes']=_[_0xe6d7('0x31')](_0xc50a57[_0xe6d7('0x2e')],qs['fields'](_0x1f7437['query'][_0xe6d7('0x32')]));_0x59b414[_0xe6d7('0x33')]=_0x59b414['attributes'][_0xe6d7('0x34')]?_0x59b414['attributes']:_0xc50a57[_0xe6d7('0x2e')];if(!_0x1f7437[_0xe6d7('0x2f')][_0xe6d7('0x35')]('nolimit')){_0x59b414['limit']=qs[_0xe6d7('0x1a')](_0x1f7437[_0xe6d7('0x2f')][_0xe6d7('0x1a')]);_0x59b414[_0xe6d7('0x19')]=qs[_0xe6d7('0x19')](_0x1f7437[_0xe6d7('0x2f')][_0xe6d7('0x19')]);}_0x59b414[_0xe6d7('0x36')]=qs['sort'](_0x1f7437[_0xe6d7('0x2f')][_0xe6d7('0x37')]);_0x59b414[_0xe6d7('0x38')]=qs[_0xe6d7('0x39')](_[_0xe6d7('0x3a')](_0x1f7437[_0xe6d7('0x2f')],_0xc50a57[_0xe6d7('0x39')]),_0x55fe08);if(_0x1f7437[_0xe6d7('0x2f')][_0xe6d7('0x3b')]){_0x59b414[_0xe6d7('0x38')]=_['merge'](_0x59b414[_0xe6d7('0x38')],{'$or':_[_0xe6d7('0x28')](_0x55fe08,function(_0x195fab){if(_0x195fab[_0xe6d7('0x2c')]!=='VIRTUAL'){var _0x4e7d0b={};_0x4e7d0b[_0x195fab[_0xe6d7('0x26')]]={'$like':'%'+_0x1f7437[_0xe6d7('0x2f')][_0xe6d7('0x3b')]+'%'};return _0x4e7d0b;}})});}_0x59b414=_[_0xe6d7('0x3c')]({},_0x59b414,_0x1f7437[_0xe6d7('0x3d')]);var _0x3aec6d={'where':_0x59b414[_0xe6d7('0x38')]};return db[_0xe6d7('0x29')][_0xe6d7('0x1c')](_0x3aec6d)[_0xe6d7('0x23')](function(_0x228ca5){_0x6f6c6a[_0xe6d7('0x1c')]=_0x228ca5;if(_0x1f7437[_0xe6d7('0x2f')][_0xe6d7('0x3e')]){_0x59b414[_0xe6d7('0x3f')]=[{'all':!![]}];}return db[_0xe6d7('0x29')][_0xe6d7('0x40')](_0x59b414);})[_0xe6d7('0x23')](function(_0xd3e621){_0x6f6c6a['rows']=_0xd3e621;return _0x6f6c6a;})['then'](respondWithFilteredResult(_0x5c9efd,_0x59b414))[_0xe6d7('0x41')](handleError(_0x5c9efd,null));};exports[_0xe6d7('0x42')]=function(_0x42357c,_0x284fb5){var _0x22cd13={'raw':!![],'where':{'id':_0x42357c[_0xe6d7('0x43')]['id']}},_0x1c78b5={};_0x1c78b5[_0xe6d7('0x2e')]=_['keys'](db[_0xe6d7('0x29')][_0xe6d7('0x2a')]);_0x1c78b5[_0xe6d7('0x2f')]=_['keys'](_0x42357c['query']);_0x1c78b5['filters']=_['intersection'](_0x1c78b5[_0xe6d7('0x2e')],_0x1c78b5[_0xe6d7('0x2f')]);_0x22cd13[_0xe6d7('0x33')]=_[_0xe6d7('0x31')](_0x1c78b5['model'],qs[_0xe6d7('0x32')](_0x42357c['query'][_0xe6d7('0x32')]));_0x22cd13[_0xe6d7('0x33')]=_0x22cd13[_0xe6d7('0x33')][_0xe6d7('0x34')]?_0x22cd13['attributes']:_0x1c78b5[_0xe6d7('0x2e')];if(_0x42357c['query'][_0xe6d7('0x3e')]){_0x22cd13[_0xe6d7('0x3f')]=[{'all':!![]}];}_0x22cd13=_['merge']({},_0x22cd13,_0x42357c[_0xe6d7('0x3d')]);return db[_0xe6d7('0x29')][_0xe6d7('0x44')](_0x22cd13)[_0xe6d7('0x23')](handleEntityNotFound(_0x284fb5,null))['then'](respondWithResult(_0x284fb5,null))[_0xe6d7('0x41')](handleError(_0x284fb5,null));};exports['create']=function(_0x1f1ec8,_0x7ae004){return db['MailSubstatus'][_0xe6d7('0x45')](_0x1f1ec8[_0xe6d7('0x46')],{})[_0xe6d7('0x23')](respondWithResult(_0x7ae004,0xc9))['catch'](handleError(_0x7ae004,null));};exports[_0xe6d7('0x21')]=function(_0x854358,_0x357025){if(_0x854358[_0xe6d7('0x46')]['id']){delete _0x854358[_0xe6d7('0x46')]['id'];}return db[_0xe6d7('0x29')][_0xe6d7('0x44')]({'where':{'id':_0x854358[_0xe6d7('0x43')]['id']}})[_0xe6d7('0x23')](handleEntityNotFound(_0x357025,null))[_0xe6d7('0x23')](saveUpdates(_0x854358['body'],null))[_0xe6d7('0x23')](respondWithResult(_0x357025,null))['catch'](handleError(_0x357025,null));};exports[_0xe6d7('0x22')]=function(_0x41f7b5,_0x3da70a){return db[_0xe6d7('0x29')][_0xe6d7('0x44')]({'where':{'id':_0x41f7b5[_0xe6d7('0x43')]['id']}})['then'](handleEntityNotFound(_0x3da70a,null))['then'](removeEntity(_0x3da70a,null))['catch'](handleError(_0x3da70a,null));};exports[_0xe6d7('0x47')]=function(_0x345dc7,_0x4c93ec){return db[_0xe6d7('0x29')][_0xe6d7('0x47')]()[_0xe6d7('0x23')](respondWithResult(_0x4c93ec,null))[_0xe6d7('0x41')](handleError(_0x4c93ec,null));}; \ No newline at end of file +var _0x87ae=['../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','status','error','name','send','MailSubstatus','fieldName','type','key','model','map','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','filter','merge','options','include','findAll','catch','params','length','includeAll','find','create','body','describe','zip-dir','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x18409f,_0x57d910){var _0x40cfee=function(_0x3cc36f){while(--_0x3cc36f){_0x18409f['push'](_0x18409f['shift']());}};_0x40cfee(++_0x57d910);}(_0x87ae,0xf5));var _0xe87a=function(_0x202d24,_0x5e8641){_0x202d24=_0x202d24-0x0;var _0x2b3a8e=_0x87ae[_0x202d24];return _0x2b3a8e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe87a('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe87a('0x1'));var BPromise=require(_0xe87a('0x2'));var Mustache=require(_0xe87a('0x3'));var util=require('util');var path=require(_0xe87a('0x4'));var sox=require(_0xe87a('0x5'));var csv=require(_0xe87a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe87a('0x7'));var squel=require(_0xe87a('0x8'));var crypto=require('crypto');var jsforce=require(_0xe87a('0x9'));var deskjs=require(_0xe87a('0xa'));var toCsv=require('to-csv');var querystring=require(_0xe87a('0xb'));var Papa=require(_0xe87a('0xc'));var Redis=require('ioredis');var authService=require(_0xe87a('0xd'));var qs=require(_0xe87a('0xe'));var as=require(_0xe87a('0xf'));var hardwareService=require(_0xe87a('0x10'));var logger=require(_0xe87a('0x11'))(_0xe87a('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe87a('0x13'));var db=require(_0xe87a('0x14'))['db'];function respondWithStatusCode(_0x3e990c,_0x4db185){_0x4db185=_0x4db185||0xcc;return function(_0x1a725a){if(_0x1a725a){return _0x3e990c[_0xe87a('0x15')](_0x4db185);}return _0x3e990c['status'](_0x4db185)[_0xe87a('0x16')]();};}function respondWithResult(_0x353c52,_0x136340){_0x136340=_0x136340||0xc8;return function(_0x5032c5){if(_0x5032c5){return _0x353c52['status'](_0x136340)['json'](_0x5032c5);}};}function respondWithFilteredResult(_0x53a4f7,_0x44474f){return function(_0x1fa2cd){if(_0x1fa2cd){var _0xd2ca53=typeof _0x44474f[_0xe87a('0x17')]==='undefined'&&typeof _0x44474f[_0xe87a('0x18')]===_0xe87a('0x19');var _0x527c58=_0x1fa2cd['count'];var _0x4160e2=_0xd2ca53?0x0:_0x44474f['offset'];var _0x182e6f=_0xd2ca53?_0x1fa2cd[_0xe87a('0x1a')]:_0x44474f[_0xe87a('0x17')]+_0x44474f['limit'];var _0x444eeb;if(_0x182e6f>=_0x527c58){_0x182e6f=_0x527c58;_0x444eeb=0xc8;}else{_0x444eeb=0xce;}_0x53a4f7['status'](_0x444eeb);return _0x53a4f7[_0xe87a('0x1b')](_0xe87a('0x1c'),_0x4160e2+'-'+_0x182e6f+'/'+_0x527c58)[_0xe87a('0x1d')](_0x1fa2cd);}return null;};}function patchUpdates(_0x4059e1){return function(_0x104f67){try{jsonpatch[_0xe87a('0x1e')](_0x104f67,_0x4059e1,!![]);}catch(_0x1e37aa){return BPromise[_0xe87a('0x1f')](_0x1e37aa);}return _0x104f67['save']();};}function saveUpdates(_0x59c17c,_0x42ba03){return function(_0x363c6a){if(_0x363c6a){return _0x363c6a[_0xe87a('0x20')](_0x59c17c)[_0xe87a('0x21')](function(_0x15ced2){return _0x15ced2;});}return null;};}function removeEntity(_0x46731f,_0x56eba0){return function(_0x59d9f7){if(_0x59d9f7){return _0x59d9f7['destroy']()['then'](function(){_0x46731f[_0xe87a('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1108d0,_0x59dc1a){return function(_0x19f21e){if(!_0x19f21e){_0x1108d0[_0xe87a('0x15')](0x194);}return _0x19f21e;};}function handleError(_0x13e0a8,_0x16ee69){_0x16ee69=_0x16ee69||0x1f4;return function(_0x294d8b){logger[_0xe87a('0x23')](_0x294d8b['stack']);if(_0x294d8b[_0xe87a('0x24')]){delete _0x294d8b['name'];}_0x13e0a8['status'](_0x16ee69)[_0xe87a('0x25')](_0x294d8b);};}exports['index']=function(_0x537b52,_0x58a2b8){var _0x17c895={},_0x6feaf6={},_0x36d4cc={'count':0x0,'rows':[]};var _0x4eae3f=_['map'](db[_0xe87a('0x26')]['rawAttributes'],function(_0x4f61f7){return{'name':_0x4f61f7[_0xe87a('0x27')],'type':_0x4f61f7[_0xe87a('0x28')][_0xe87a('0x29')]};});_0x6feaf6[_0xe87a('0x2a')]=_[_0xe87a('0x2b')](_0x4eae3f,'name');_0x6feaf6[_0xe87a('0x2c')]=_['keys'](_0x537b52[_0xe87a('0x2c')]);_0x6feaf6['filters']=_[_0xe87a('0x2d')](_0x6feaf6[_0xe87a('0x2a')],_0x6feaf6[_0xe87a('0x2c')]);_0x17c895[_0xe87a('0x2e')]=_[_0xe87a('0x2d')](_0x6feaf6[_0xe87a('0x2a')],qs[_0xe87a('0x2f')](_0x537b52[_0xe87a('0x2c')][_0xe87a('0x2f')]));_0x17c895[_0xe87a('0x2e')]=_0x17c895['attributes']['length']?_0x17c895['attributes']:_0x6feaf6[_0xe87a('0x2a')];if(!_0x537b52['query'][_0xe87a('0x30')](_0xe87a('0x31'))){_0x17c895['limit']=qs[_0xe87a('0x18')](_0x537b52['query']['limit']);_0x17c895[_0xe87a('0x17')]=qs[_0xe87a('0x17')](_0x537b52[_0xe87a('0x2c')][_0xe87a('0x17')]);}_0x17c895['order']=qs[_0xe87a('0x32')](_0x537b52[_0xe87a('0x2c')]['sort']);_0x17c895[_0xe87a('0x33')]=qs[_0xe87a('0x34')](_['pick'](_0x537b52[_0xe87a('0x2c')],_0x6feaf6[_0xe87a('0x34')]),_0x4eae3f);if(_0x537b52[_0xe87a('0x2c')][_0xe87a('0x35')]){_0x17c895[_0xe87a('0x33')]=_['merge'](_0x17c895[_0xe87a('0x33')],{'$or':_['map'](_0x4eae3f,function(_0x28ed95){if(_0x28ed95['type']!=='VIRTUAL'){var _0x4315f5={};_0x4315f5[_0x28ed95[_0xe87a('0x24')]]={'$like':'%'+_0x537b52[_0xe87a('0x2c')][_0xe87a('0x35')]+'%'};return _0x4315f5;}})});}_0x17c895=_[_0xe87a('0x36')]({},_0x17c895,_0x537b52[_0xe87a('0x37')]);var _0x8423ba={'where':_0x17c895[_0xe87a('0x33')]};return db[_0xe87a('0x26')][_0xe87a('0x1a')](_0x8423ba)[_0xe87a('0x21')](function(_0x211a3e){_0x36d4cc[_0xe87a('0x1a')]=_0x211a3e;if(_0x537b52[_0xe87a('0x2c')]['includeAll']){_0x17c895[_0xe87a('0x38')]=[{'all':!![]}];}return db[_0xe87a('0x26')][_0xe87a('0x39')](_0x17c895);})[_0xe87a('0x21')](function(_0x5eb4e1){_0x36d4cc['rows']=_0x5eb4e1;return _0x36d4cc;})['then'](respondWithFilteredResult(_0x58a2b8,_0x17c895))[_0xe87a('0x3a')](handleError(_0x58a2b8,null));};exports['show']=function(_0x5400ff,_0x3bcee7){var _0x5eb62e={'raw':!![],'where':{'id':_0x5400ff[_0xe87a('0x3b')]['id']}},_0x5b1f55={};_0x5b1f55[_0xe87a('0x2a')]=_['keys'](db[_0xe87a('0x26')]['rawAttributes']);_0x5b1f55['query']=_['keys'](_0x5400ff[_0xe87a('0x2c')]);_0x5b1f55[_0xe87a('0x34')]=_['intersection'](_0x5b1f55[_0xe87a('0x2a')],_0x5b1f55[_0xe87a('0x2c')]);_0x5eb62e[_0xe87a('0x2e')]=_['intersection'](_0x5b1f55['model'],qs['fields'](_0x5400ff['query'][_0xe87a('0x2f')]));_0x5eb62e['attributes']=_0x5eb62e[_0xe87a('0x2e')][_0xe87a('0x3c')]?_0x5eb62e[_0xe87a('0x2e')]:_0x5b1f55[_0xe87a('0x2a')];if(_0x5400ff['query'][_0xe87a('0x3d')]){_0x5eb62e[_0xe87a('0x38')]=[{'all':!![]}];}_0x5eb62e=_['merge']({},_0x5eb62e,_0x5400ff[_0xe87a('0x37')]);return db[_0xe87a('0x26')][_0xe87a('0x3e')](_0x5eb62e)[_0xe87a('0x21')](handleEntityNotFound(_0x3bcee7,null))[_0xe87a('0x21')](respondWithResult(_0x3bcee7,null))[_0xe87a('0x3a')](handleError(_0x3bcee7,null));};exports[_0xe87a('0x3f')]=function(_0x4595be,_0x2aa508){return db['MailSubstatus'][_0xe87a('0x3f')](_0x4595be[_0xe87a('0x40')],{})[_0xe87a('0x21')](respondWithResult(_0x2aa508,0xc9))[_0xe87a('0x3a')](handleError(_0x2aa508,null));};exports['update']=function(_0x6ddec4,_0x28c00b){if(_0x6ddec4[_0xe87a('0x40')]['id']){delete _0x6ddec4[_0xe87a('0x40')]['id'];}return db[_0xe87a('0x26')][_0xe87a('0x3e')]({'where':{'id':_0x6ddec4[_0xe87a('0x3b')]['id']}})[_0xe87a('0x21')](handleEntityNotFound(_0x28c00b,null))['then'](saveUpdates(_0x6ddec4[_0xe87a('0x40')],null))[_0xe87a('0x21')](respondWithResult(_0x28c00b,null))[_0xe87a('0x3a')](handleError(_0x28c00b,null));};exports['destroy']=function(_0x19d380,_0xc43c4a){return db[_0xe87a('0x26')][_0xe87a('0x3e')]({'where':{'id':_0x19d380[_0xe87a('0x3b')]['id']}})[_0xe87a('0x21')](handleEntityNotFound(_0xc43c4a,null))[_0xe87a('0x21')](removeEntity(_0xc43c4a,null))[_0xe87a('0x3a')](handleError(_0xc43c4a,null));};exports[_0xe87a('0x41')]=function(_0x2a0a39,_0x1ec3f5){return db[_0xe87a('0x26')]['describe']()[_0xe87a('0x21')](respondWithResult(_0x1ec3f5,null))[_0xe87a('0x3a')](handleError(_0x1ec3f5,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 9db80b1..2fa557c 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 _0xfebc=['util','api','moment','bluebird','path','rimraf','../../config/environment','./mailSubstatus.attributes','exports','define','MailSubstatus','lodash'];(function(_0x1e9df3,_0x3ec5ea){var _0x4ae252=function(_0x2ac97e){while(--_0x2ac97e){_0x1e9df3['push'](_0x1e9df3['shift']());}};_0x4ae252(++_0x3ec5ea);}(_0xfebc,0x6b));var _0xcfeb=function(_0x3a5fdd,_0x410065){_0x3a5fdd=_0x3a5fdd-0x0;var _0x46fcd6=_0xfebc[_0x3a5fdd];return _0x46fcd6;};'use strict';var _=require(_0xcfeb('0x0'));var util=require(_0xcfeb('0x1'));var logger=require('../../config/logger')(_0xcfeb('0x2'));var moment=require(_0xcfeb('0x3'));var BPromise=require(_0xcfeb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcfeb('0x5'));var rimraf=require(_0xcfeb('0x6'));var config=require(_0xcfeb('0x7'));var attributes=require(_0xcfeb('0x8'));module[_0xcfeb('0x9')]=function(_0x5e3dda,_0x537593){return _0x5e3dda[_0xcfeb('0xa')](_0xcfeb('0xb'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa08a=['./mailSubstatus.attributes','define','MailSubstatus','mail_substatuses','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x2b5fee,_0x499b19){var _0x4cbb69=function(_0xd23f31){while(--_0xd23f31){_0x2b5fee['push'](_0x2b5fee['shift']());}};_0x4cbb69(++_0x499b19);}(_0xa08a,0x1dd));var _0xaa08=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0xa08a[_0x50aa2e];return _0x5e07f0;};'use strict';var _=require(_0xaa08('0x0'));var util=require('util');var logger=require(_0xaa08('0x1'))(_0xaa08('0x2'));var moment=require(_0xaa08('0x3'));var BPromise=require(_0xaa08('0x4'));var rp=require(_0xaa08('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xaa08('0x6'));var attributes=require(_0xaa08('0x7'));module['exports']=function(_0x23a925,_0x112dc9){return _0x23a925[_0xaa08('0x8')](_0xaa08('0x9'),attributes,{'tableName':_0xaa08('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index ee1efc8..2a164a3 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 _0xe527=['then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x5bb207,_0x157700){var _0x4b198e=function(_0x4d6c36){while(--_0x4d6c36){_0x5bb207['push'](_0x5bb207['shift']());}};_0x4b198e(++_0x157700);}(_0xe527,0xaa));var _0x7e52=function(_0x139eb2,_0x5b8ced){_0x139eb2=_0x139eb2-0x0;var _0x3e6086=_0xe527[_0x139eb2];return _0x3e6086;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7e52('0x0'));var BPromise=require('bluebird');var rs=require(_0x7e52('0x1'));var fs=require('fs');var Redis=require(_0x7e52('0x2'));var db=require(_0x7e52('0x3'))['db'];var utils=require(_0x7e52('0x4'));var logger=require(_0x7e52('0x5'))('rpc');var config=require(_0x7e52('0x6'));var jayson=require(_0x7e52('0x7'));var client=jayson[_0x7e52('0x8')][_0x7e52('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x22b817,_0x43b76d,_0x39ad03){return new BPromise(function(_0xd4f14e,_0x2474d0){return client['request'](_0x22b817,_0x39ad03)[_0x7e52('0xa')](function(_0xa51327){logger[_0x7e52('0xb')](_0x7e52('0xc'),_0x43b76d,_0x7e52('0xd'));logger[_0x7e52('0xe')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x43b76d,'request\x20sent',JSON[_0x7e52('0xf')](_0xa51327));if(_0xa51327['error']){if(_0xa51327[_0x7e52('0x10')]['code']===0x1f4){logger[_0x7e52('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x43b76d,_0xa51327[_0x7e52('0x10')][_0x7e52('0x11')]);return _0x2474d0(_0xa51327[_0x7e52('0x10')][_0x7e52('0x11')]);}logger[_0x7e52('0x10')](_0x7e52('0xc'),_0x43b76d,_0xa51327[_0x7e52('0x10')]['message']);return _0xd4f14e(_0xa51327[_0x7e52('0x10')][_0x7e52('0x11')]);}else{logger[_0x7e52('0xb')](_0x7e52('0xc'),_0x43b76d,_0x7e52('0xd'));_0xd4f14e(_0xa51327[_0x7e52('0x12')]['message']);}})[_0x7e52('0x13')](function(_0x11e737){logger[_0x7e52('0x10')](_0x7e52('0xc'),_0x43b76d,_0x11e737);_0x2474d0(_0x11e737);});});} \ No newline at end of file +var _0x8845=['stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s'];(function(_0x4facc0,_0x5a3365){var _0x536ca9=function(_0x3a1c12){while(--_0x3a1c12){_0x4facc0['push'](_0x4facc0['shift']());}};_0x536ca9(++_0x5a3365);}(_0x8845,0xec));var _0x5884=function(_0x1d5610,_0x152b31){_0x1d5610=_0x1d5610-0x0;var _0x3b75cd=_0x8845[_0x1d5610];return _0x3b75cd;};'use strict';var _=require(_0x5884('0x0'));var util=require(_0x5884('0x1'));var moment=require('moment');var BPromise=require(_0x5884('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5884('0x3'));var db=require(_0x5884('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5884('0x5'))('rpc');var config=require(_0x5884('0x6'));var jayson=require(_0x5884('0x7'));var client=jayson[_0x5884('0x8')][_0x5884('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x238de1,_0x113747,_0x2616e5){return new BPromise(function(_0x14e38a,_0x350374){return client['request'](_0x238de1,_0x2616e5)[_0x5884('0xa')](function(_0x103956){logger[_0x5884('0xb')](_0x5884('0xc'),_0x113747,_0x5884('0xd'));logger[_0x5884('0xe')](_0x5884('0xf'),_0x113747,_0x5884('0xd'),JSON[_0x5884('0x10')](_0x103956));if(_0x103956[_0x5884('0x11')]){if(_0x103956['error'][_0x5884('0x12')]===0x1f4){logger[_0x5884('0x11')](_0x5884('0xc'),_0x113747,_0x103956[_0x5884('0x11')]['message']);return _0x350374(_0x103956['error'][_0x5884('0x13')]);}logger[_0x5884('0x11')](_0x5884('0xc'),_0x113747,_0x103956['error'][_0x5884('0x13')]);return _0x14e38a(_0x103956[_0x5884('0x11')][_0x5884('0x13')]);}else{logger[_0x5884('0xb')](_0x5884('0xc'),_0x113747,_0x5884('0xd'));_0x14e38a(_0x103956['result']['message']);}})[_0x5884('0x14')](function(_0x996efc){logger['error'](_0x5884('0xc'),_0x113747,_0x996efc);_0x350374(_0x996efc);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 6b3ca4b..ff26357 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 _0x0ad3=['../../config/environment','./mailTransferReport.controller','isAuthenticated','get','/describe','describe','/:id','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1b8524,_0x1bb669){var _0x81418d=function(_0x5f5795){while(--_0x5f5795){_0x1b8524['push'](_0x1b8524['shift']());}};_0x81418d(++_0x1bb669);}(_0x0ad3,0x161));var _0x30ad=function(_0x680b65,_0x5b2e9c){_0x680b65=_0x680b65-0x0;var _0x1c2053=_0x0ad3[_0x680b65];return _0x1c2053;};'use strict';var multer=require(_0x30ad('0x0'));var util=require('util');var path=require(_0x30ad('0x1'));var timeout=require(_0x30ad('0x2'));var express=require(_0x30ad('0x3'));var router=express['Router']();var fs_extra=require(_0x30ad('0x4'));var auth=require(_0x30ad('0x5'));var interaction=require(_0x30ad('0x6'));var config=require(_0x30ad('0x7'));var controller=require(_0x30ad('0x8'));router['get']('/',auth[_0x30ad('0x9')](),controller['index']);router[_0x30ad('0xa')](_0x30ad('0xb'),auth[_0x30ad('0x9')](),controller[_0x30ad('0xc')]);router[_0x30ad('0xa')](_0x30ad('0xd'),auth[_0x30ad('0x9')](),controller['show']);router[_0x30ad('0xe')]('/',auth[_0x30ad('0x9')](),controller['create']);router[_0x30ad('0xf')]('/:id',auth[_0x30ad('0x9')](),controller[_0x30ad('0x10')]);router[_0x30ad('0x11')](_0x30ad('0xd'),auth[_0x30ad('0x9')](),controller[_0x30ad('0x12')]);module[_0x30ad('0x13')]=router; \ No newline at end of file +var _0x8701=['/describe','describe','get','isAuthenticated','show','put','update','delete','/:id','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','index'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x8701,0xc7));var _0x1870=function(_0x1f3cac,_0x354c4c){_0x1f3cac=_0x1f3cac-0x0;var _0x248e80=_0x8701[_0x1f3cac];return _0x248e80;};'use strict';var multer=require(_0x1870('0x0'));var util=require('util');var path=require(_0x1870('0x1'));var timeout=require(_0x1870('0x2'));var express=require(_0x1870('0x3'));var router=express[_0x1870('0x4')]();var fs_extra=require(_0x1870('0x5'));var auth=require(_0x1870('0x6'));var interaction=require(_0x1870('0x7'));var config=require(_0x1870('0x8'));var controller=require(_0x1870('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1870('0xa')]);router['get'](_0x1870('0xb'),auth['isAuthenticated'](),controller[_0x1870('0xc')]);router[_0x1870('0xd')]('/:id',auth[_0x1870('0xe')](),controller[_0x1870('0xf')]);router['post']('/',auth[_0x1870('0xe')](),controller['create']);router[_0x1870('0x10')]('/:id',auth[_0x1870('0xe')](),controller[_0x1870('0x11')]);router[_0x1870('0x12')](_0x1870('0x13'),auth[_0x1870('0xe')](),controller['destroy']);module[_0x1870('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 4f0df7a..619b79e 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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x333bc7,_0x4a50fd){var _0x5c2ea3=function(_0x2359e0){while(--_0x2359e0){_0x333bc7['push'](_0x333bc7['shift']());}};_0x5c2ea3(++_0x4a50fd);}(_0xaa88,0x137));var _0x8aa8=function(_0x3ee55a,_0x19aeea){_0x3ee55a=_0x3ee55a-0x0;var _0x581800=_0xaa88[_0x3ee55a];return _0x581800;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x5442a5,_0x4110f1){var _0x130af0=function(_0x457ec2){while(--_0x457ec2){_0x5442a5['push'](_0x5442a5['shift']());}};_0x130af0(++_0x4110f1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 42a1e11..9f043f1 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 _0xe903=['order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','catch','show','includeAll','include','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','reject','save','update','then','error','stack','name','send','MailTransferReport','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit'];(function(_0x3d6db1,_0x4358f8){var _0x5e1cc3=function(_0x3ad5af){while(--_0x3ad5af){_0x3d6db1['push'](_0x3d6db1['shift']());}};_0x5e1cc3(++_0x4358f8);}(_0xe903,0x1e1));var _0x3e90=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0xe903[_0x455c6c];return _0x488242;};'use strict';var emlformat=require(_0x3e90('0x0'));var rimraf=require(_0x3e90('0x1'));var zipdir=require(_0x3e90('0x2'));var jsonpatch=require(_0x3e90('0x3'));var rp=require(_0x3e90('0x4'));var moment=require('moment');var BPromise=require(_0x3e90('0x5'));var Mustache=require(_0x3e90('0x6'));var util=require(_0x3e90('0x7'));var path=require(_0x3e90('0x8'));var sox=require(_0x3e90('0x9'));var csv=require(_0x3e90('0xa'));var ejs=require(_0x3e90('0xb'));var fs=require('fs');var fs_extra=require(_0x3e90('0xc'));var _=require(_0x3e90('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3e90('0xe'));var deskjs=require(_0x3e90('0xf'));var toCsv=require(_0x3e90('0xa'));var querystring=require(_0x3e90('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3e90('0x11'));var qs=require(_0x3e90('0x12'));var as=require(_0x3e90('0x13'));var hardwareService=require(_0x3e90('0x14'));var logger=require('../../config/logger')(_0x3e90('0x15'));var utils=require('../../config/utils');var config=require(_0x3e90('0x16'));var licenseUtil=require(_0x3e90('0x17'));var db=require(_0x3e90('0x18'))['db'];function respondWithStatusCode(_0x5602aa,_0x2e7dd8){_0x2e7dd8=_0x2e7dd8||0xcc;return function(_0x3bfa17){if(_0x3bfa17){return _0x5602aa[_0x3e90('0x19')](_0x2e7dd8);}return _0x5602aa[_0x3e90('0x1a')](_0x2e7dd8)[_0x3e90('0x1b')]();};}function respondWithResult(_0x1e76ed,_0x559bd4){_0x559bd4=_0x559bd4||0xc8;return function(_0x5c6c35){if(_0x5c6c35){return _0x1e76ed[_0x3e90('0x1a')](_0x559bd4)['json'](_0x5c6c35);}};}function respondWithFilteredResult(_0xba33ba,_0x390a99){return function(_0x67125d){if(_0x67125d){var _0x4ee436=typeof _0x390a99[_0x3e90('0x1c')]===_0x3e90('0x1d')&&typeof _0x390a99['limit']===_0x3e90('0x1d');var _0x5ced59=_0x67125d[_0x3e90('0x1e')];var _0x2cb9c5=_0x4ee436?0x0:_0x390a99[_0x3e90('0x1c')];var _0x2d01f4=_0x4ee436?_0x67125d[_0x3e90('0x1e')]:_0x390a99[_0x3e90('0x1c')]+_0x390a99['limit'];var _0xd69c2b;if(_0x2d01f4>=_0x5ced59){_0x2d01f4=_0x5ced59;_0xd69c2b=0xc8;}else{_0xd69c2b=0xce;}_0xba33ba['status'](_0xd69c2b);return _0xba33ba[_0x3e90('0x1f')](_0x3e90('0x20'),_0x2cb9c5+'-'+_0x2d01f4+'/'+_0x5ced59)[_0x3e90('0x21')](_0x67125d);}return null;};}function patchUpdates(_0x3ba0d1){return function(_0x2c3e0d){try{jsonpatch['apply'](_0x2c3e0d,_0x3ba0d1,!![]);}catch(_0x254467){return BPromise[_0x3e90('0x22')](_0x254467);}return _0x2c3e0d[_0x3e90('0x23')]();};}function saveUpdates(_0x36cf14,_0x29ea2e){return function(_0x2f6db0){if(_0x2f6db0){return _0x2f6db0[_0x3e90('0x24')](_0x36cf14)[_0x3e90('0x25')](function(_0x4bf58f){return _0x4bf58f;});}return null;};}function removeEntity(_0x2911a0,_0x239c3c){return function(_0x547938){if(_0x547938){return _0x547938['destroy']()[_0x3e90('0x25')](function(){_0x2911a0[_0x3e90('0x1a')](0xcc)[_0x3e90('0x1b')]();});}};}function handleEntityNotFound(_0x50b7af,_0x3d2754){return function(_0x5b4d7a){if(!_0x5b4d7a){_0x50b7af[_0x3e90('0x19')](0x194);}return _0x5b4d7a;};}function handleError(_0x556008,_0xd0dee0){_0xd0dee0=_0xd0dee0||0x1f4;return function(_0x588ea9){logger[_0x3e90('0x26')](_0x588ea9[_0x3e90('0x27')]);if(_0x588ea9[_0x3e90('0x28')]){delete _0x588ea9[_0x3e90('0x28')];}_0x556008['status'](_0xd0dee0)[_0x3e90('0x29')](_0x588ea9);};}exports['index']=function(_0x12d0ad,_0x38890e){var _0x3745dc={},_0x198054={},_0x459c32={'count':0x0,'rows':[]};var _0x2c84b3=_['map'](db[_0x3e90('0x2a')][_0x3e90('0x2b')],function(_0x26a485){return{'name':_0x26a485['fieldName'],'type':_0x26a485[_0x3e90('0x2c')][_0x3e90('0x2d')]};});_0x198054[_0x3e90('0x2e')]=_[_0x3e90('0x2f')](_0x2c84b3,'name');_0x198054['query']=_[_0x3e90('0x30')](_0x12d0ad[_0x3e90('0x31')]);_0x198054[_0x3e90('0x32')]=_[_0x3e90('0x33')](_0x198054[_0x3e90('0x2e')],_0x198054[_0x3e90('0x31')]);_0x3745dc[_0x3e90('0x34')]=_[_0x3e90('0x33')](_0x198054[_0x3e90('0x2e')],qs[_0x3e90('0x35')](_0x12d0ad[_0x3e90('0x31')]['fields']));_0x3745dc[_0x3e90('0x34')]=_0x3745dc['attributes'][_0x3e90('0x36')]?_0x3745dc[_0x3e90('0x34')]:_0x198054[_0x3e90('0x2e')];if(!_0x12d0ad['query'][_0x3e90('0x37')](_0x3e90('0x38'))){_0x3745dc[_0x3e90('0x39')]=qs['limit'](_0x12d0ad['query'][_0x3e90('0x39')]);_0x3745dc[_0x3e90('0x1c')]=qs[_0x3e90('0x1c')](_0x12d0ad[_0x3e90('0x31')][_0x3e90('0x1c')]);}_0x3745dc[_0x3e90('0x3a')]=qs['sort'](_0x12d0ad[_0x3e90('0x31')][_0x3e90('0x3b')]);_0x3745dc['where']=qs['filters'](_[_0x3e90('0x3c')](_0x12d0ad[_0x3e90('0x31')],_0x198054['filters']),_0x2c84b3);if(_0x12d0ad[_0x3e90('0x31')][_0x3e90('0x3d')]){_0x3745dc[_0x3e90('0x3e')]=_[_0x3e90('0x3f')](_0x3745dc[_0x3e90('0x3e')],{'$or':_[_0x3e90('0x2f')](_0x2c84b3,function(_0x1caff2){if(_0x1caff2['type']!==_0x3e90('0x40')){var _0x19d392={};_0x19d392[_0x1caff2['name']]={'$like':'%'+_0x12d0ad[_0x3e90('0x31')][_0x3e90('0x3d')]+'%'};return _0x19d392;}})});}_0x3745dc=_[_0x3e90('0x3f')]({},_0x3745dc,_0x12d0ad[_0x3e90('0x41')]);var _0x305747={'where':_0x3745dc[_0x3e90('0x3e')]};return db[_0x3e90('0x2a')][_0x3e90('0x1e')](_0x305747)[_0x3e90('0x25')](function(_0x2832dc){_0x459c32[_0x3e90('0x1e')]=_0x2832dc;if(_0x12d0ad['query']['includeAll']){_0x3745dc['include']=[{'all':!![]}];}return db['MailTransferReport'][_0x3e90('0x42')](_0x3745dc);})['then'](function(_0xdc6cd7){_0x459c32[_0x3e90('0x43')]=_0xdc6cd7;return _0x459c32;})[_0x3e90('0x25')](respondWithFilteredResult(_0x38890e,_0x3745dc))[_0x3e90('0x44')](handleError(_0x38890e,null));};exports[_0x3e90('0x45')]=function(_0x21286b,_0x2cfb8e){var _0x9539ec={'raw':!![],'where':{'id':_0x21286b['params']['id']}},_0x3068ca={};_0x3068ca[_0x3e90('0x2e')]=_[_0x3e90('0x30')](db[_0x3e90('0x2a')][_0x3e90('0x2b')]);_0x3068ca[_0x3e90('0x31')]=_[_0x3e90('0x30')](_0x21286b[_0x3e90('0x31')]);_0x3068ca['filters']=_[_0x3e90('0x33')](_0x3068ca[_0x3e90('0x2e')],_0x3068ca[_0x3e90('0x31')]);_0x9539ec[_0x3e90('0x34')]=_['intersection'](_0x3068ca[_0x3e90('0x2e')],qs[_0x3e90('0x35')](_0x21286b[_0x3e90('0x31')][_0x3e90('0x35')]));_0x9539ec[_0x3e90('0x34')]=_0x9539ec[_0x3e90('0x34')]['length']?_0x9539ec[_0x3e90('0x34')]:_0x3068ca[_0x3e90('0x2e')];if(_0x21286b[_0x3e90('0x31')][_0x3e90('0x46')]){_0x9539ec[_0x3e90('0x47')]=[{'all':!![]}];}_0x9539ec=_[_0x3e90('0x3f')]({},_0x9539ec,_0x21286b['options']);return db[_0x3e90('0x2a')][_0x3e90('0x48')](_0x9539ec)['then'](handleEntityNotFound(_0x2cfb8e,null))[_0x3e90('0x25')](respondWithResult(_0x2cfb8e,null))[_0x3e90('0x44')](handleError(_0x2cfb8e,null));};exports[_0x3e90('0x49')]=function(_0x4dfa1c,_0x116edf){return db[_0x3e90('0x2a')][_0x3e90('0x49')](_0x4dfa1c['body'],{})[_0x3e90('0x25')](respondWithResult(_0x116edf,0xc9))[_0x3e90('0x44')](handleError(_0x116edf,null));};exports[_0x3e90('0x24')]=function(_0xdca136,_0x67bd13){if(_0xdca136[_0x3e90('0x4a')]['id']){delete _0xdca136[_0x3e90('0x4a')]['id'];}return db[_0x3e90('0x2a')][_0x3e90('0x48')]({'where':{'id':_0xdca136[_0x3e90('0x4b')]['id']}})['then'](handleEntityNotFound(_0x67bd13,null))[_0x3e90('0x25')](saveUpdates(_0xdca136['body'],null))[_0x3e90('0x25')](respondWithResult(_0x67bd13,null))['catch'](handleError(_0x67bd13,null));};exports['destroy']=function(_0x2c1f7d,_0x297cba){return db['MailTransferReport']['find']({'where':{'id':_0x2c1f7d[_0x3e90('0x4b')]['id']}})[_0x3e90('0x25')](handleEntityNotFound(_0x297cba,null))[_0x3e90('0x25')](removeEntity(_0x297cba,null))[_0x3e90('0x44')](handleError(_0x297cba,null));};exports[_0x3e90('0x4c')]=function(_0x4edd7f,_0x2fed30){return db['MailTransferReport'][_0x3e90('0x4c')]()['then'](respondWithResult(_0x2fed30,null))[_0x3e90('0x44')](handleError(_0x2fed30,null));}; \ No newline at end of file +var _0xc858=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','MailTransferReport','type','key','map','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','catch','create','body','describe','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x16363b,_0x55063b){var _0x5b9897=function(_0x3bcac6){while(--_0x3bcac6){_0x16363b['push'](_0x16363b['shift']());}};_0x5b9897(++_0x55063b);}(_0xc858,0x11b));var _0x8c85=function(_0x13a7a2,_0x28589a){_0x13a7a2=_0x13a7a2-0x0;var _0x3e6e0a=_0xc858[_0x13a7a2];return _0x3e6e0a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8c85('0x0'));var rp=require(_0x8c85('0x1'));var moment=require(_0x8c85('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x8c85('0x3'));var util=require(_0x8c85('0x4'));var path=require(_0x8c85('0x5'));var sox=require(_0x8c85('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8c85('0x7'));var _=require(_0x8c85('0x8'));var squel=require('squel');var crypto=require(_0x8c85('0x9'));var jsforce=require(_0x8c85('0xa'));var deskjs=require(_0x8c85('0xb'));var toCsv=require(_0x8c85('0xc'));var querystring=require(_0x8c85('0xd'));var Papa=require(_0x8c85('0xe'));var Redis=require('ioredis');var authService=require(_0x8c85('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x8c85('0x10'));var hardwareService=require(_0x8c85('0x11'));var logger=require(_0x8c85('0x12'))(_0x8c85('0x13'));var utils=require(_0x8c85('0x14'));var config=require(_0x8c85('0x15'));var licenseUtil=require(_0x8c85('0x16'));var db=require(_0x8c85('0x17'))['db'];function respondWithStatusCode(_0x202b95,_0x24cbc0){_0x24cbc0=_0x24cbc0||0xcc;return function(_0x1699f5){if(_0x1699f5){return _0x202b95[_0x8c85('0x18')](_0x24cbc0);}return _0x202b95[_0x8c85('0x19')](_0x24cbc0)[_0x8c85('0x1a')]();};}function respondWithResult(_0x3d60f7,_0x5b2149){_0x5b2149=_0x5b2149||0xc8;return function(_0x1af47c){if(_0x1af47c){return _0x3d60f7[_0x8c85('0x19')](_0x5b2149)[_0x8c85('0x1b')](_0x1af47c);}};}function respondWithFilteredResult(_0x302d96,_0x2c5291){return function(_0x23dbc1){if(_0x23dbc1){var _0x39b228=typeof _0x2c5291[_0x8c85('0x1c')]===_0x8c85('0x1d')&&typeof _0x2c5291[_0x8c85('0x1e')]===_0x8c85('0x1d');var _0x515fc1=_0x23dbc1[_0x8c85('0x1f')];var _0x492ee1=_0x39b228?0x0:_0x2c5291[_0x8c85('0x1c')];var _0x3e34e0=_0x39b228?_0x23dbc1[_0x8c85('0x1f')]:_0x2c5291[_0x8c85('0x1c')]+_0x2c5291[_0x8c85('0x1e')];var _0x361731;if(_0x3e34e0>=_0x515fc1){_0x3e34e0=_0x515fc1;_0x361731=0xc8;}else{_0x361731=0xce;}_0x302d96[_0x8c85('0x19')](_0x361731);return _0x302d96[_0x8c85('0x20')](_0x8c85('0x21'),_0x492ee1+'-'+_0x3e34e0+'/'+_0x515fc1)[_0x8c85('0x1b')](_0x23dbc1);}return null;};}function patchUpdates(_0xb8eb39){return function(_0x418ff9){try{jsonpatch[_0x8c85('0x22')](_0x418ff9,_0xb8eb39,!![]);}catch(_0x18a718){return BPromise[_0x8c85('0x23')](_0x18a718);}return _0x418ff9[_0x8c85('0x24')]();};}function saveUpdates(_0x150c8d,_0x33be43){return function(_0x31024c){if(_0x31024c){return _0x31024c[_0x8c85('0x25')](_0x150c8d)[_0x8c85('0x26')](function(_0x21f777){return _0x21f777;});}return null;};}function removeEntity(_0x57b280,_0x57966d){return function(_0x252e74){if(_0x252e74){return _0x252e74[_0x8c85('0x27')]()[_0x8c85('0x26')](function(){_0x57b280[_0x8c85('0x19')](0xcc)[_0x8c85('0x1a')]();});}};}function handleEntityNotFound(_0xe4fd71,_0x2478db){return function(_0x27fa87){if(!_0x27fa87){_0xe4fd71[_0x8c85('0x18')](0x194);}return _0x27fa87;};}function handleError(_0x20cfe8,_0x30d16b){_0x30d16b=_0x30d16b||0x1f4;return function(_0x27bc0d){logger[_0x8c85('0x28')](_0x27bc0d[_0x8c85('0x29')]);if(_0x27bc0d[_0x8c85('0x2a')]){delete _0x27bc0d['name'];}_0x20cfe8[_0x8c85('0x19')](_0x30d16b)[_0x8c85('0x2b')](_0x27bc0d);};}exports['index']=function(_0x3090ca,_0x45a600){var _0x1060de={},_0xfd7a99={},_0x5a8c6e={'count':0x0,'rows':[]};var _0x3e3a40=_['map'](db[_0x8c85('0x2c')]['rawAttributes'],function(_0xa18901){return{'name':_0xa18901['fieldName'],'type':_0xa18901[_0x8c85('0x2d')][_0x8c85('0x2e')]};});_0xfd7a99['model']=_[_0x8c85('0x2f')](_0x3e3a40,_0x8c85('0x2a'));_0xfd7a99[_0x8c85('0x30')]=_['keys'](_0x3090ca[_0x8c85('0x30')]);_0xfd7a99[_0x8c85('0x31')]=_['intersection'](_0xfd7a99[_0x8c85('0x32')],_0xfd7a99[_0x8c85('0x30')]);_0x1060de[_0x8c85('0x33')]=_[_0x8c85('0x34')](_0xfd7a99[_0x8c85('0x32')],qs[_0x8c85('0x35')](_0x3090ca[_0x8c85('0x30')][_0x8c85('0x35')]));_0x1060de[_0x8c85('0x33')]=_0x1060de[_0x8c85('0x33')][_0x8c85('0x36')]?_0x1060de['attributes']:_0xfd7a99[_0x8c85('0x32')];if(!_0x3090ca['query'][_0x8c85('0x37')]('nolimit')){_0x1060de[_0x8c85('0x1e')]=qs[_0x8c85('0x1e')](_0x3090ca[_0x8c85('0x30')][_0x8c85('0x1e')]);_0x1060de[_0x8c85('0x1c')]=qs[_0x8c85('0x1c')](_0x3090ca['query'][_0x8c85('0x1c')]);}_0x1060de[_0x8c85('0x38')]=qs[_0x8c85('0x39')](_0x3090ca['query'][_0x8c85('0x39')]);_0x1060de[_0x8c85('0x3a')]=qs[_0x8c85('0x31')](_[_0x8c85('0x3b')](_0x3090ca[_0x8c85('0x30')],_0xfd7a99[_0x8c85('0x31')]),_0x3e3a40);if(_0x3090ca[_0x8c85('0x30')]['filter']){_0x1060de[_0x8c85('0x3a')]=_[_0x8c85('0x3c')](_0x1060de[_0x8c85('0x3a')],{'$or':_[_0x8c85('0x2f')](_0x3e3a40,function(_0x3b397d){if(_0x3b397d['type']!==_0x8c85('0x3d')){var _0x31333c={};_0x31333c[_0x3b397d['name']]={'$like':'%'+_0x3090ca[_0x8c85('0x30')][_0x8c85('0x3e')]+'%'};return _0x31333c;}})});}_0x1060de=_[_0x8c85('0x3c')]({},_0x1060de,_0x3090ca[_0x8c85('0x3f')]);var _0x1f150c={'where':_0x1060de[_0x8c85('0x3a')]};return db[_0x8c85('0x2c')][_0x8c85('0x1f')](_0x1f150c)['then'](function(_0x1e7e5c){_0x5a8c6e['count']=_0x1e7e5c;if(_0x3090ca[_0x8c85('0x30')][_0x8c85('0x40')]){_0x1060de[_0x8c85('0x41')]=[{'all':!![]}];}return db[_0x8c85('0x2c')][_0x8c85('0x42')](_0x1060de);})['then'](function(_0x3deade){_0x5a8c6e[_0x8c85('0x43')]=_0x3deade;return _0x5a8c6e;})[_0x8c85('0x26')](respondWithFilteredResult(_0x45a600,_0x1060de))['catch'](handleError(_0x45a600,null));};exports[_0x8c85('0x44')]=function(_0x330132,_0x62fc59){var _0x456a97={'raw':!![],'where':{'id':_0x330132[_0x8c85('0x45')]['id']}},_0x497d20={};_0x497d20['model']=_[_0x8c85('0x46')](db['MailTransferReport'][_0x8c85('0x47')]);_0x497d20['query']=_[_0x8c85('0x46')](_0x330132[_0x8c85('0x30')]);_0x497d20['filters']=_[_0x8c85('0x34')](_0x497d20[_0x8c85('0x32')],_0x497d20[_0x8c85('0x30')]);_0x456a97[_0x8c85('0x33')]=_['intersection'](_0x497d20[_0x8c85('0x32')],qs[_0x8c85('0x35')](_0x330132['query'][_0x8c85('0x35')]));_0x456a97[_0x8c85('0x33')]=_0x456a97['attributes']['length']?_0x456a97[_0x8c85('0x33')]:_0x497d20[_0x8c85('0x32')];if(_0x330132['query'][_0x8c85('0x40')]){_0x456a97['include']=[{'all':!![]}];}_0x456a97=_['merge']({},_0x456a97,_0x330132['options']);return db['MailTransferReport'][_0x8c85('0x48')](_0x456a97)[_0x8c85('0x26')](handleEntityNotFound(_0x62fc59,null))[_0x8c85('0x26')](respondWithResult(_0x62fc59,null))[_0x8c85('0x49')](handleError(_0x62fc59,null));};exports[_0x8c85('0x4a')]=function(_0x5b42a5,_0x2e197c){return db['MailTransferReport']['create'](_0x5b42a5['body'],{})[_0x8c85('0x26')](respondWithResult(_0x2e197c,0xc9))[_0x8c85('0x49')](handleError(_0x2e197c,null));};exports[_0x8c85('0x25')]=function(_0x1092e4,_0x20250c){if(_0x1092e4['body']['id']){delete _0x1092e4[_0x8c85('0x4b')]['id'];}return db[_0x8c85('0x2c')]['find']({'where':{'id':_0x1092e4[_0x8c85('0x45')]['id']}})[_0x8c85('0x26')](handleEntityNotFound(_0x20250c,null))[_0x8c85('0x26')](saveUpdates(_0x1092e4[_0x8c85('0x4b')],null))[_0x8c85('0x26')](respondWithResult(_0x20250c,null))[_0x8c85('0x49')](handleError(_0x20250c,null));};exports['destroy']=function(_0xb81e7b,_0x34d9eb){return db[_0x8c85('0x2c')]['find']({'where':{'id':_0xb81e7b['params']['id']}})[_0x8c85('0x26')](handleEntityNotFound(_0x34d9eb,null))[_0x8c85('0x26')](removeEntity(_0x34d9eb,null))['catch'](handleError(_0x34d9eb,null));};exports[_0x8c85('0x4c')]=function(_0x3ae804,_0x4ce40f){return db[_0x8c85('0x2c')][_0x8c85('0x4c')]()[_0x8c85('0x26')](respondWithResult(_0x4ce40f,null))[_0x8c85('0x49')](handleError(_0x4ce40f,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 034619c..d3a4b08 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 _0xeb3a=['exports','define','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./mailTransferReport.attributes'];(function(_0x514e1a,_0x61e551){var _0x3c3ee1=function(_0x32ee9e){while(--_0x32ee9e){_0x514e1a['push'](_0x514e1a['shift']());}};_0x3c3ee1(++_0x61e551);}(_0xeb3a,0x12f));var _0xaeb3=function(_0x5baa08,_0x99a3e4){_0x5baa08=_0x5baa08-0x0;var _0x553691=_0xeb3a[_0x5baa08];return _0x553691;};'use strict';var _=require(_0xaeb3('0x0'));var util=require(_0xaeb3('0x1'));var logger=require(_0xaeb3('0x2'))(_0xaeb3('0x3'));var moment=require(_0xaeb3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xaeb3('0x5'));var rimraf=require(_0xaeb3('0x6'));var config=require(_0xaeb3('0x7'));var attributes=require(_0xaeb3('0x8'));module[_0xaeb3('0x9')]=function(_0x45d14c,_0x1fdc7c){return _0x45d14c[_0xaeb3('0xa')]('MailTransferReport',attributes,{'tableName':_0xaeb3('0xb'),'paranoid':![],'indexes':[{'name':_0xaeb3('0xc'),'fields':[_0xaeb3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xda7f=['report_mail_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailTransferReport'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0xda7f,0xc6));var _0xfda7=function(_0x25d4ab,_0x307164){_0x25d4ab=_0x25d4ab-0x0;var _0x3b31f3=_0xda7f[_0x25d4ab];return _0x3b31f3;};'use strict';var _=require(_0xfda7('0x0'));var util=require('util');var logger=require(_0xfda7('0x1'))(_0xfda7('0x2'));var moment=require(_0xfda7('0x3'));var BPromise=require(_0xfda7('0x4'));var rp=require(_0xfda7('0x5'));var fs=require('fs');var path=require(_0xfda7('0x6'));var rimraf=require(_0xfda7('0x7'));var config=require(_0xfda7('0x8'));var attributes=require('./mailTransferReport.attributes');module[_0xfda7('0x9')]=function(_0x593e9c,_0x4e6707){return _0x593e9c[_0xfda7('0xa')](_0xfda7('0xb'),attributes,{'tableName':_0xfda7('0xc'),'paranoid':![],'indexes':[{'name':_0xfda7('0xd'),'fields':[_0xfda7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 39177cb..fa4347e 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 _0xcbbf=['client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x30a5b5,_0x21e05e){var _0x58e1c4=function(_0x67af6f){while(--_0x67af6f){_0x30a5b5['push'](_0x30a5b5['shift']());}};_0x58e1c4(++_0x21e05e);}(_0xcbbf,0x14e));var _0xfcbb=function(_0x3af78f,_0x424e4f){_0x3af78f=_0x3af78f-0x0;var _0x4d3637=_0xcbbf[_0x3af78f];return _0x4d3637;};'use strict';var _=require(_0xfcbb('0x0'));var util=require(_0xfcbb('0x1'));var moment=require(_0xfcbb('0x2'));var BPromise=require(_0xfcbb('0x3'));var rs=require(_0xfcbb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfcbb('0x5'))['db'];var utils=require(_0xfcbb('0x6'));var logger=require(_0xfcbb('0x7'))(_0xfcbb('0x8'));var config=require(_0xfcbb('0x9'));var jayson=require(_0xfcbb('0xa'));var client=jayson[_0xfcbb('0xb')][_0xfcbb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5d8313,_0x22ae2b,_0x18f606){return new BPromise(function(_0x4346ad,_0x263b2f){return client[_0xfcbb('0xd')](_0x5d8313,_0x18f606)[_0xfcbb('0xe')](function(_0x44c923){logger[_0xfcbb('0xf')](_0xfcbb('0x10'),_0x22ae2b,_0xfcbb('0x11'));logger[_0xfcbb('0x12')](_0xfcbb('0x13'),_0x22ae2b,_0xfcbb('0x11'),JSON[_0xfcbb('0x14')](_0x44c923));if(_0x44c923[_0xfcbb('0x15')]){if(_0x44c923[_0xfcbb('0x15')]['code']===0x1f4){logger[_0xfcbb('0x15')](_0xfcbb('0x10'),_0x22ae2b,_0x44c923[_0xfcbb('0x15')][_0xfcbb('0x16')]);return _0x263b2f(_0x44c923[_0xfcbb('0x15')][_0xfcbb('0x16')]);}logger[_0xfcbb('0x15')]('MailTransferReport,\x20%s,\x20%s',_0x22ae2b,_0x44c923[_0xfcbb('0x15')][_0xfcbb('0x16')]);return _0x4346ad(_0x44c923[_0xfcbb('0x15')][_0xfcbb('0x16')]);}else{logger[_0xfcbb('0xf')](_0xfcbb('0x10'),_0x22ae2b,_0xfcbb('0x11'));_0x4346ad(_0x44c923['result'][_0xfcbb('0x16')]);}})['catch'](function(_0x8e0bbe){logger[_0xfcbb('0x15')](_0xfcbb('0x10'),_0x22ae2b,_0x8e0bbe);_0x263b2f(_0x8e0bbe);});});} \ No newline at end of file +var _0xe450=['stringify','error','MailTransferReport,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x429e86,_0x264475){var _0x365d12=function(_0x213207){while(--_0x213207){_0x429e86['push'](_0x429e86['shift']());}};_0x365d12(++_0x264475);}(_0xe450,0x175));var _0x0e45=function(_0x10f90e,_0x5047c2){_0x10f90e=_0x10f90e-0x0;var _0x5cd0f0=_0xe450[_0x10f90e];return _0x5cd0f0;};'use strict';var _=require('lodash');var util=require(_0x0e45('0x0'));var moment=require(_0x0e45('0x1'));var BPromise=require(_0x0e45('0x2'));var rs=require(_0x0e45('0x3'));var fs=require('fs');var Redis=require(_0x0e45('0x4'));var db=require(_0x0e45('0x5'))['db'];var utils=require(_0x0e45('0x6'));var logger=require(_0x0e45('0x7'))(_0x0e45('0x8'));var config=require('../../config/environment');var jayson=require(_0x0e45('0x9'));var client=jayson[_0x0e45('0xa')][_0x0e45('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x527e52,_0x1dc73b,_0x22cada){return new BPromise(function(_0x496e17,_0x500f30){return client[_0x0e45('0xc')](_0x527e52,_0x22cada)[_0x0e45('0xd')](function(_0x517576){logger[_0x0e45('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x1dc73b,_0x0e45('0xf'));logger[_0x0e45('0x10')](_0x0e45('0x11'),_0x1dc73b,_0x0e45('0xf'),JSON[_0x0e45('0x12')](_0x517576));if(_0x517576[_0x0e45('0x13')]){if(_0x517576[_0x0e45('0x13')]['code']===0x1f4){logger['error'](_0x0e45('0x14'),_0x1dc73b,_0x517576[_0x0e45('0x13')][_0x0e45('0x15')]);return _0x500f30(_0x517576[_0x0e45('0x13')][_0x0e45('0x15')]);}logger[_0x0e45('0x13')](_0x0e45('0x14'),_0x1dc73b,_0x517576[_0x0e45('0x13')][_0x0e45('0x15')]);return _0x496e17(_0x517576[_0x0e45('0x13')][_0x0e45('0x15')]);}else{logger[_0x0e45('0xe')](_0x0e45('0x14'),_0x1dc73b,_0x0e45('0xf'));_0x496e17(_0x517576[_0x0e45('0x16')][_0x0e45('0x15')]);}})['catch'](function(_0x46cb3c){logger[_0x0e45('0x13')](_0x0e45('0x14'),_0x1dc73b,_0x46cb3c);_0x500f30(_0x46cb3c);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 897975e..cceb3b8 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 _0x532f=['show','post','isAuthenticated','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','index','/describe','get','/:id'];(function(_0x3e20cb,_0x4b8ca3){var _0x1ec7aa=function(_0xb41a5e){while(--_0xb41a5e){_0x3e20cb['push'](_0x3e20cb['shift']());}};_0x1ec7aa(++_0x4b8ca3);}(_0x532f,0x1a9));var _0xf532=function(_0x479e82,_0xe6a054){_0x479e82=_0x479e82-0x0;var _0x4bfe85=_0x532f[_0x479e82];return _0x4bfe85;};'use strict';var multer=require(_0xf532('0x0'));var util=require(_0xf532('0x1'));var path=require(_0xf532('0x2'));var timeout=require(_0xf532('0x3'));var express=require(_0xf532('0x4'));var router=express[_0xf532('0x5')]();var fs_extra=require(_0xf532('0x6'));var auth=require(_0xf532('0x7'));var interaction=require(_0xf532('0x8'));var config=require(_0xf532('0x9'));var controller=require(_0xf532('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0xf532('0xb')]);router['get'](_0xf532('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xf532('0xd')](_0xf532('0xe'),auth['isAuthenticated'](),controller[_0xf532('0xf')]);router[_0xf532('0x10')]('/',auth[_0xf532('0x11')](),controller[_0xf532('0x12')]);router['put'](_0xf532('0xe'),auth[_0xf532('0x11')](),controller[_0xf532('0x13')]);router[_0xf532('0x14')](_0xf532('0xe'),auth[_0xf532('0x11')](),controller['destroy']);module[_0xf532('0x15')]=router; \ No newline at end of file +var _0x95dc=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','post','create','put','/:id','update','delete','exports','util','connect-timeout','express','Router'];(function(_0x1c2f50,_0x4a121f){var _0x2aa4fc=function(_0x4a317a){while(--_0x4a317a){_0x1c2f50['push'](_0x1c2f50['shift']());}};_0x2aa4fc(++_0x4a121f);}(_0x95dc,0x1a0));var _0xc95d=function(_0x50c1c1,_0x4d5063){_0x50c1c1=_0x50c1c1-0x0;var _0xba0564=_0x95dc[_0x50c1c1];return _0xba0564;};'use strict';var multer=require('multer');var util=require(_0xc95d('0x0'));var path=require('path');var timeout=require(_0xc95d('0x1'));var express=require(_0xc95d('0x2'));var router=express[_0xc95d('0x3')]();var fs_extra=require(_0xc95d('0x4'));var auth=require(_0xc95d('0x5'));var interaction=require(_0xc95d('0x6'));var config=require(_0xc95d('0x7'));var controller=require(_0xc95d('0x8'));router[_0xc95d('0x9')]('/',auth[_0xc95d('0xa')](),controller[_0xc95d('0xb')]);router[_0xc95d('0x9')](_0xc95d('0xc'),auth[_0xc95d('0xa')](),controller[_0xc95d('0xd')]);router['get']('/:id',auth[_0xc95d('0xa')](),controller['show']);router[_0xc95d('0xe')]('/',auth[_0xc95d('0xa')](),controller[_0xc95d('0xf')]);router[_0xc95d('0x10')](_0xc95d('0x11'),auth[_0xc95d('0xa')](),controller[_0xc95d('0x12')]);router[_0xc95d('0x13')](_0xc95d('0x11'),auth[_0xc95d('0xa')](),controller['destroy']);module[_0xc95d('0x14')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 3d28df4..1b01a06 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 _0x48ea=['INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','sequelize','exports','STRING','DEFAULT\x20PAUSE'];(function(_0x2e8889,_0xcd72f9){var _0x19dae6=function(_0x4a7100){while(--_0x4a7100){_0x2e8889['push'](_0x2e8889['shift']());}};_0x19dae6(++_0xcd72f9);}(_0x48ea,0x9c));var _0xa48e=function(_0x380085,_0x228a75){_0x380085=_0x380085-0x0;var _0x43b7b4=_0x48ea[_0x380085];return _0x43b7b4;};'use strict';var Sequelize=require(_0xa48e('0x0'));var moment=require('moment');module[_0xa48e('0x1')]={'channel':{'type':Sequelize[_0xa48e('0x2')]},'membername':{'type':Sequelize[_0xa48e('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':_0xa48e('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0xa48e('0x4')]},'enterAt':{'type':Sequelize[_0xa48e('0x5')]},'exitAt':{'type':Sequelize[_0xa48e('0x5')],'set':function(_0x4387b5){var _0x2b058d=moment(_0x4387b5);var _0x405033=moment(this[_0xa48e('0x6')](_0xa48e('0x7')));var _0x3bdc25=_0x2b058d[_0xa48e('0x8')](_0x405033,_0xa48e('0x9'));this[_0xa48e('0xa')](_0xa48e('0xb'),_0x4387b5);this[_0xa48e('0xa')](_0xa48e('0xc'),_0x3bdc25||null);}},'data1':{'type':Sequelize['STRING'],'comment':_0xa48e('0xd')},'data2':{'type':Sequelize['STRING'],'comment':'talk:[start]'},'data3':{'type':Sequelize['STRING'],'comment':_0xa48e('0xe')},'data4':{'type':Sequelize[_0xa48e('0x2')],'comment':_0xa48e('0xf')},'data5':{'type':Sequelize[_0xa48e('0x2')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0xa48e('0x2')]},'internal':{'type':Sequelize[_0xa48e('0x4')]},'uniqueid':{'type':Sequelize[_0xa48e('0x2')]}}; \ No newline at end of file +var _0x95c5=['DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','STRING'];(function(_0x5ccb98,_0x4bb08c){var _0x3f93ea=function(_0x224a61){while(--_0x224a61){_0x5ccb98['push'](_0x5ccb98['shift']());}};_0x3f93ea(++_0x4bb08c);}(_0x95c5,0x153));var _0x595c=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0x95c5[_0x424a9a];return _0xa7831c;};'use strict';var Sequelize=require(_0x595c('0x0'));var moment=require(_0x595c('0x1'));module['exports']={'channel':{'type':Sequelize[_0x595c('0x2')]},'membername':{'type':Sequelize[_0x595c('0x2')]},'interface':{'type':Sequelize[_0x595c('0x2')]},'type':{'type':Sequelize[_0x595c('0x2')],'defaultValue':_0x595c('0x3'),'comment':_0x595c('0x4')},'duration':{'type':Sequelize[_0x595c('0x5')]},'enterAt':{'type':Sequelize[_0x595c('0x6')]},'exitAt':{'type':Sequelize[_0x595c('0x6')],'set':function(_0x46be42){var _0x4ff80b=moment(_0x46be42);var _0x49a115=moment(this[_0x595c('0x7')](_0x595c('0x8')));var _0x218eca=_0x4ff80b[_0x595c('0x9')](_0x49a115,_0x595c('0xa'));this[_0x595c('0xb')](_0x595c('0xc'),_0x46be42);this[_0x595c('0xb')](_0x595c('0xd'),_0x218eca||null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x595c('0xe')},'data2':{'type':Sequelize[_0x595c('0x2')],'comment':_0x595c('0xf')},'data3':{'type':Sequelize['STRING'],'comment':_0x595c('0x10')},'data4':{'type':Sequelize[_0x595c('0x2')],'comment':_0x595c('0x11')},'data5':{'type':Sequelize[_0x595c('0x2')],'comment':_0x595c('0x12')},'role':{'type':Sequelize[_0x595c('0x2')]},'internal':{'type':Sequelize[_0x595c('0x5')]},'uniqueid':{'type':Sequelize[_0x595c('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 76f3c11..b7f1ae2 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xedd9,0xfc));var _0x9edd=function(_0x10751e,_0x1e937d){_0x10751e=_0x10751e-0x0;var _0x2d04fc=_0xedd9[_0x10751e];return _0x2d04fc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file +var _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x34e8,0x12c));var _0x834e=function(_0x2379d9,_0x227b84){_0x2379d9=_0x2379d9-0x0;var _0x31f44b=_0x34e8[_0x2379d9];return _0x31f44b;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 97e1876..384cc6e 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 _0x8f04=['define','MemberReport','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8f04,0xbc));var _0x48f0=function(_0x2cf7aa,_0xdc5b6a){_0x2cf7aa=_0x2cf7aa-0x0;var _0xd7ec9b=_0x8f04[_0x2cf7aa];return _0xd7ec9b;};'use strict';var _=require(_0x48f0('0x0'));var util=require(_0x48f0('0x1'));var logger=require(_0x48f0('0x2'))(_0x48f0('0x3'));var moment=require('moment');var BPromise=require(_0x48f0('0x4'));var rp=require(_0x48f0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x48f0('0x6'));var attributes=require('./memberReport.attributes');module[_0x48f0('0x7')]=function(_0x36553a,_0x2a1f98){return _0x36553a[_0x48f0('0x8')](_0x48f0('0x9'),attributes,{'tableName':_0x48f0('0xa'),'paranoid':![],'indexes':[{'name':_0x48f0('0xb'),'fields':[_0x48f0('0xc'),_0x48f0('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7f6c=['api','moment','bluebird','path','../../config/environment','./memberReport.attributes','define','MemberReport','report_member','membername','interface','util','../../config/logger'];(function(_0x4f2ec9,_0x463849){var _0xc31c3a=function(_0x4f5ba3){while(--_0x4f5ba3){_0x4f2ec9['push'](_0x4f2ec9['shift']());}};_0xc31c3a(++_0x463849);}(_0x7f6c,0x1b8));var _0xc7f6=function(_0x24744e,_0xcabe0){_0x24744e=_0x24744e-0x0;var _0x49322e=_0x7f6c[_0x24744e];return _0x49322e;};'use strict';var _=require('lodash');var util=require(_0xc7f6('0x0'));var logger=require(_0xc7f6('0x1'))(_0xc7f6('0x2'));var moment=require(_0xc7f6('0x3'));var BPromise=require(_0xc7f6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc7f6('0x5'));var rimraf=require('rimraf');var config=require(_0xc7f6('0x6'));var attributes=require(_0xc7f6('0x7'));module['exports']=function(_0x4a693e,_0x4a2e44){return _0x4a693e[_0xc7f6('0x8')](_0xc7f6('0x9'),attributes,{'tableName':_0xc7f6('0xa'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0xc7f6('0xb'),_0xc7f6('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 0f32623..bec7cba 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 _0x2c8f=['result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','limit','include','map','model','attributes','CreateMemberReport','create','body','update','util','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x5cf162,_0x293cb7){var _0x229102=function(_0x5b59e0){while(--_0x5b59e0){_0x5cf162['push'](_0x5cf162['shift']());}};_0x229102(++_0x293cb7);}(_0x2c8f,0x192));var _0xf2c8=function(_0x40f25f,_0x259a31){_0x40f25f=_0x40f25f-0x0;var _0x7e2449=_0x2c8f[_0x40f25f];return _0x7e2449;};'use strict';var _=require('lodash');var util=require(_0xf2c8('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf2c8('0x1'));var db=require(_0xf2c8('0x2'))['db'];var utils=require(_0xf2c8('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xf2c8('0x4'));var jayson=require(_0xf2c8('0x5'));var client=jayson[_0xf2c8('0x6')][_0xf2c8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2785ee,_0x4eae22,_0x475616){return new BPromise(function(_0x28cc0d,_0x4e3109){return client[_0xf2c8('0x8')](_0x2785ee,_0x475616)[_0xf2c8('0x9')](function(_0x2112fc){logger['info'](_0xf2c8('0xa'),_0x4eae22,_0xf2c8('0xb'));logger[_0xf2c8('0xc')](_0xf2c8('0xd'),_0x4eae22,_0xf2c8('0xb'),JSON[_0xf2c8('0xe')](_0x2112fc));if(_0x2112fc[_0xf2c8('0xf')]){if(_0x2112fc[_0xf2c8('0xf')]['code']===0x1f4){logger[_0xf2c8('0xf')]('MemberReport,\x20%s,\x20%s',_0x4eae22,_0x2112fc[_0xf2c8('0xf')][_0xf2c8('0x10')]);return _0x4e3109(_0x2112fc[_0xf2c8('0xf')][_0xf2c8('0x10')]);}logger[_0xf2c8('0xf')](_0xf2c8('0xa'),_0x4eae22,_0x2112fc['error'][_0xf2c8('0x10')]);return _0x28cc0d(_0x2112fc[_0xf2c8('0xf')][_0xf2c8('0x10')]);}else{logger[_0xf2c8('0x11')](_0xf2c8('0xa'),_0x4eae22,_0xf2c8('0xb'));_0x28cc0d(_0x2112fc[_0xf2c8('0x12')]['message']);}})[_0xf2c8('0x13')](function(_0x3cbc33){logger[_0xf2c8('0xf')](_0xf2c8('0xa'),_0x4eae22,_0x3cbc33);_0x4e3109(_0x3cbc33);});});}exports[_0xf2c8('0x14')]=function(_0x52e9d0){var _0x49a07c=this;return new Promise(function(_0x104d9d,_0x290953){return db[_0xf2c8('0x15')][_0xf2c8('0x16')]({'raw':_0x52e9d0['options']?_0x52e9d0[_0xf2c8('0x17')][_0xf2c8('0x18')]===undefined?!![]:![]:!![],'where':_0x52e9d0[_0xf2c8('0x17')]?_0x52e9d0['options'][_0xf2c8('0x19')]||null:null,'attributes':_0x52e9d0[_0xf2c8('0x17')]?_0x52e9d0['options']['attributes']||null:null,'limit':_0x52e9d0[_0xf2c8('0x17')]?_0x52e9d0[_0xf2c8('0x17')][_0xf2c8('0x1a')]||null:null,'include':_0x52e9d0['options']?_0x52e9d0[_0xf2c8('0x17')][_0xf2c8('0x1b')]?_[_0xf2c8('0x1c')](_0x52e9d0[_0xf2c8('0x17')]['include'],function(_0x17956f){return{'model':db[_0x17956f[_0xf2c8('0x1d')]],'as':_0x17956f['as'],'attributes':_0x17956f[_0xf2c8('0x1e')],'include':_0x17956f[_0xf2c8('0x1b')]?_[_0xf2c8('0x1c')](_0x17956f['include'],function(_0x93707c){return{'model':db[_0x93707c['model']],'as':_0x93707c['as'],'attributes':_0x93707c[_0xf2c8('0x1e')],'include':_0x93707c[_0xf2c8('0x1b')]?_[_0xf2c8('0x1c')](_0x93707c[_0xf2c8('0x1b')],function(_0x1d2e74){return{'model':db[_0x1d2e74[_0xf2c8('0x1d')]],'as':_0x1d2e74['as'],'attributes':_0x1d2e74[_0xf2c8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf2c8('0x9')](function(_0x33f1b0){logger[_0xf2c8('0x11')](_0xf2c8('0x14'),_0x52e9d0);logger[_0xf2c8('0xc')](_0xf2c8('0x14'),_0x52e9d0,JSON['stringify'](_0x33f1b0));_0x104d9d(_0x33f1b0);})[_0xf2c8('0x13')](function(_0x5146e4){logger['error'](_0xf2c8('0x14'),_0x5146e4['message'],_0x52e9d0);_0x290953(_0x49a07c[_0xf2c8('0xf')](0x1f4,_0x5146e4[_0xf2c8('0x10')]));});});};exports[_0xf2c8('0x1f')]=function(_0x10c825){var _0x123b45=this;return new Promise(function(_0x12a547,_0x27a7dc){return db['MemberReport'][_0xf2c8('0x20')](_0x10c825[_0xf2c8('0x21')],{'raw':_0x10c825[_0xf2c8('0x17')]?_0x10c825[_0xf2c8('0x17')][_0xf2c8('0x18')]===undefined?!![]:![]:!![]})[_0xf2c8('0x9')](function(_0x5e0b43){logger[_0xf2c8('0x11')]('CreateMemberReport',_0x10c825);logger[_0xf2c8('0xc')]('CreateMemberReport',_0x10c825,JSON[_0xf2c8('0xe')](_0x5e0b43));_0x12a547(_0x5e0b43);})[_0xf2c8('0x13')](function(_0x8ea71a){logger[_0xf2c8('0xf')](_0xf2c8('0x1f'),_0x8ea71a['message'],_0x10c825);_0x27a7dc(_0x123b45[_0xf2c8('0xf')](0x1f4,_0x8ea71a[_0xf2c8('0x10')]));});});};exports['UpdateMemberReport']=function(_0x309232){var _0x23f6be=this;return new Promise(function(_0x4a24e8,_0x1935c7){return db[_0xf2c8('0x15')][_0xf2c8('0x22')](_0x309232[_0xf2c8('0x21')],{'raw':_0x309232[_0xf2c8('0x17')]?_0x309232['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x309232[_0xf2c8('0x17')]?_0x309232[_0xf2c8('0x17')][_0xf2c8('0x19')]||null:null,'attributes':_0x309232[_0xf2c8('0x17')]?_0x309232[_0xf2c8('0x17')][_0xf2c8('0x1e')]||null:null,'limit':_0x309232[_0xf2c8('0x17')]?_0x309232[_0xf2c8('0x17')]['limit']||null:null})[_0xf2c8('0x9')](function(_0x4775c6){logger[_0xf2c8('0x11')]('UpdateMemberReport',_0x309232);logger['debug']('UpdateMemberReport',_0x309232,JSON['stringify'](_0x4775c6));_0x4a24e8(_0x4775c6);})[_0xf2c8('0x13')](function(_0x49ac22){logger[_0xf2c8('0xf')]('UpdateMemberReport',_0x49ac22[_0xf2c8('0x10')],_0x309232);_0x1935c7(_0x23f6be['error'](0x1f4,_0x49ac22['message']));});});}; \ No newline at end of file +var _0x8efc=['error','message','result','catch','GetMemberReport','options','raw','attributes','limit','include','map','model','debug','CreateMemberReport','body','UpdateMemberReport','MemberReport','update','where','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','http','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x445c98,_0x132bf7){var _0x2fe913=function(_0x32e864){while(--_0x32e864){_0x445c98['push'](_0x445c98['shift']());}};_0x2fe913(++_0x132bf7);}(_0x8efc,0x8f));var _0xc8ef=function(_0x3e4db1,_0x385cd6){_0x3e4db1=_0x3e4db1-0x0;var _0x33ecd5=_0x8efc[_0x3e4db1];return _0x33ecd5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc8ef('0x0'));var BPromise=require('bluebird');var rs=require(_0xc8ef('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc8ef('0x2'))['db'];var utils=require(_0xc8ef('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xc8ef('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xc8ef('0x5')][_0xc8ef('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1648ac,_0x1f7596,_0x819e70){return new BPromise(function(_0x522d75,_0x4331d3){return client['request'](_0x1648ac,_0x819e70)[_0xc8ef('0x7')](function(_0xbdd184){logger[_0xc8ef('0x8')](_0xc8ef('0x9'),_0x1f7596,'request\x20sent');logger['debug']('MemberReport,\x20%s,\x20%s,\x20%s',_0x1f7596,_0xc8ef('0xa'),JSON[_0xc8ef('0xb')](_0xbdd184));if(_0xbdd184[_0xc8ef('0xc')]){if(_0xbdd184[_0xc8ef('0xc')]['code']===0x1f4){logger[_0xc8ef('0xc')](_0xc8ef('0x9'),_0x1f7596,_0xbdd184[_0xc8ef('0xc')][_0xc8ef('0xd')]);return _0x4331d3(_0xbdd184[_0xc8ef('0xc')][_0xc8ef('0xd')]);}logger[_0xc8ef('0xc')](_0xc8ef('0x9'),_0x1f7596,_0xbdd184['error']['message']);return _0x522d75(_0xbdd184[_0xc8ef('0xc')][_0xc8ef('0xd')]);}else{logger[_0xc8ef('0x8')](_0xc8ef('0x9'),_0x1f7596,_0xc8ef('0xa'));_0x522d75(_0xbdd184[_0xc8ef('0xe')][_0xc8ef('0xd')]);}})[_0xc8ef('0xf')](function(_0x5569c0){logger['error'](_0xc8ef('0x9'),_0x1f7596,_0x5569c0);_0x4331d3(_0x5569c0);});});}exports[_0xc8ef('0x10')]=function(_0x166ec4){var _0x183c85=this;return new Promise(function(_0x5a2815,_0x5dc90b){return db['MemberReport']['findAll']({'raw':_0x166ec4[_0xc8ef('0x11')]?_0x166ec4['options'][_0xc8ef('0x12')]===undefined?!![]:![]:!![],'where':_0x166ec4[_0xc8ef('0x11')]?_0x166ec4[_0xc8ef('0x11')]['where']||null:null,'attributes':_0x166ec4[_0xc8ef('0x11')]?_0x166ec4[_0xc8ef('0x11')][_0xc8ef('0x13')]||null:null,'limit':_0x166ec4[_0xc8ef('0x11')]?_0x166ec4[_0xc8ef('0x11')][_0xc8ef('0x14')]||null:null,'include':_0x166ec4[_0xc8ef('0x11')]?_0x166ec4[_0xc8ef('0x11')][_0xc8ef('0x15')]?_[_0xc8ef('0x16')](_0x166ec4[_0xc8ef('0x11')][_0xc8ef('0x15')],function(_0x52f695){return{'model':db[_0x52f695['model']],'as':_0x52f695['as'],'attributes':_0x52f695[_0xc8ef('0x13')],'include':_0x52f695[_0xc8ef('0x15')]?_[_0xc8ef('0x16')](_0x52f695[_0xc8ef('0x15')],function(_0x16c6d4){return{'model':db[_0x16c6d4['model']],'as':_0x16c6d4['as'],'attributes':_0x16c6d4['attributes'],'include':_0x16c6d4[_0xc8ef('0x15')]?_[_0xc8ef('0x16')](_0x16c6d4[_0xc8ef('0x15')],function(_0x50bb55){return{'model':db[_0x50bb55[_0xc8ef('0x17')]],'as':_0x50bb55['as'],'attributes':_0x50bb55[_0xc8ef('0x13')]};}):[]};}):[]};}):[]:[]})[_0xc8ef('0x7')](function(_0xc6749){logger['info']('GetMemberReport',_0x166ec4);logger[_0xc8ef('0x18')](_0xc8ef('0x10'),_0x166ec4,JSON[_0xc8ef('0xb')](_0xc6749));_0x5a2815(_0xc6749);})['catch'](function(_0x309985){logger[_0xc8ef('0xc')](_0xc8ef('0x10'),_0x309985['message'],_0x166ec4);_0x5dc90b(_0x183c85[_0xc8ef('0xc')](0x1f4,_0x309985[_0xc8ef('0xd')]));});});};exports[_0xc8ef('0x19')]=function(_0x3a54d4){var _0x17c07c=this;return new Promise(function(_0x5b8fbe,_0x27fd8d){return db['MemberReport']['create'](_0x3a54d4[_0xc8ef('0x1a')],{'raw':_0x3a54d4['options']?_0x3a54d4[_0xc8ef('0x11')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x21a1c5){logger[_0xc8ef('0x8')](_0xc8ef('0x19'),_0x3a54d4);logger[_0xc8ef('0x18')](_0xc8ef('0x19'),_0x3a54d4,JSON[_0xc8ef('0xb')](_0x21a1c5));_0x5b8fbe(_0x21a1c5);})['catch'](function(_0x673423){logger[_0xc8ef('0xc')]('CreateMemberReport',_0x673423[_0xc8ef('0xd')],_0x3a54d4);_0x27fd8d(_0x17c07c['error'](0x1f4,_0x673423['message']));});});};exports[_0xc8ef('0x1b')]=function(_0x18680b){var _0x122546=this;return new Promise(function(_0x43d1df,_0x4791b4){return db[_0xc8ef('0x1c')][_0xc8ef('0x1d')](_0x18680b[_0xc8ef('0x1a')],{'raw':_0x18680b[_0xc8ef('0x11')]?_0x18680b[_0xc8ef('0x11')][_0xc8ef('0x12')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18680b[_0xc8ef('0x11')]?_0x18680b['options'][_0xc8ef('0x1e')]||null:null,'attributes':_0x18680b['options']?_0x18680b['options'][_0xc8ef('0x13')]||null:null,'limit':_0x18680b[_0xc8ef('0x11')]?_0x18680b[_0xc8ef('0x11')][_0xc8ef('0x14')]||null:null})[_0xc8ef('0x7')](function(_0x194e89){logger[_0xc8ef('0x8')](_0xc8ef('0x1b'),_0x18680b);logger[_0xc8ef('0x18')](_0xc8ef('0x1b'),_0x18680b,JSON[_0xc8ef('0xb')](_0x194e89));_0x43d1df(_0x194e89);})[_0xc8ef('0xf')](function(_0x2039c6){logger['error']('UpdateMemberReport',_0x2039c6[_0xc8ef('0xd')],_0x18680b);_0x4791b4(_0x122546[_0xc8ef('0xc')](0x1f4,_0x2039c6[_0xc8ef('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index bbc7785..37af80a 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 _0x9a14=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1c7386,_0x298a93){var _0x2b6b71=function(_0x3dfaf0){while(--_0x3dfaf0){_0x1c7386['push'](_0x1c7386['shift']());}};_0x2b6b71(++_0x298a93);}(_0x9a14,0xa8));var _0x49a1=function(_0x1dcef5,_0x3bf0ad){_0x1dcef5=_0x1dcef5-0x0;var _0x3b121f=_0x9a14[_0x1dcef5];return _0x3b121f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49a1('0x0'));var timeout=require(_0x49a1('0x1'));var express=require(_0x49a1('0x2'));var router=express[_0x49a1('0x3')]();var fs_extra=require(_0x49a1('0x4'));var auth=require(_0x49a1('0x5'));var interaction=require(_0x49a1('0x6'));var config=require(_0x49a1('0x7'));var controller=require('./migration.controller');router['get']('/',controller['index']);module['exports']=router; \ No newline at end of file +var _0x0a63=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x11b5a7,_0x53cd97){var _0x45f256=function(_0x3c3fc5){while(--_0x3c3fc5){_0x11b5a7['push'](_0x11b5a7['shift']());}};_0x45f256(++_0x53cd97);}(_0x0a63,0x1e5));var _0x30a6=function(_0x497672,_0x12ffe6){_0x497672=_0x497672-0x0;var _0x392c0b=_0x0a63[_0x497672];return _0x392c0b;};'use strict';var multer=require(_0x30a6('0x0'));var util=require(_0x30a6('0x1'));var path=require(_0x30a6('0x2'));var timeout=require(_0x30a6('0x3'));var express=require(_0x30a6('0x4'));var router=express[_0x30a6('0x5')]();var fs_extra=require(_0x30a6('0x6'));var auth=require(_0x30a6('0x7'));var interaction=require(_0x30a6('0x8'));var config=require(_0x30a6('0x9'));var controller=require('./migration.controller');router[_0x30a6('0xa')]('/',controller['index']);module[_0x30a6('0xb')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 2088d0c..17b687b 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 _0x914e=['STRING','sequelize'];(function(_0x6f0460,_0x2526f4){var _0x6dcdb6=function(_0x5d5244){while(--_0x5d5244){_0x6f0460['push'](_0x6f0460['shift']());}};_0x6dcdb6(++_0x2526f4);}(_0x914e,0xd5));var _0xe914=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x914e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe914('0x0'));module['exports']={'version':{'type':Sequelize[_0xe914('0x1')],'unique':'version'}}; \ No newline at end of file +var _0x62d8=['sequelize'];(function(_0x39bf21,_0x5c2e3f){var _0x19c6e9=function(_0xe79045){while(--_0xe79045){_0x39bf21['push'](_0x39bf21['shift']());}};_0x19c6e9(++_0x5c2e3f);}(_0x62d8,0x78));var _0x862d=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x62d8[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x862d('0x0'));module['exports']={'version':{'type':Sequelize['STRING'],'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 39a5866..650821b 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 _0xce68=['sox','ejs','fs-extra','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','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','name','send','index','Migration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','map','type','merge','options','then','include','findAll','rows','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xce68,0x10c));var _0x8ce6=function(_0x481b93,_0x58b946){_0x481b93=_0x481b93-0x0;var _0x5d8ff1=_0xce68[_0x481b93];return _0x5d8ff1;};'use strict';var emlformat=require(_0x8ce6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8ce6('0x1'));var jsonpatch=require(_0x8ce6('0x2'));var rp=require(_0x8ce6('0x3'));var moment=require(_0x8ce6('0x4'));var BPromise=require(_0x8ce6('0x5'));var Mustache=require('mustache');var util=require(_0x8ce6('0x6'));var path=require(_0x8ce6('0x7'));var sox=require(_0x8ce6('0x8'));var csv=require('to-csv');var ejs=require(_0x8ce6('0x9'));var fs=require('fs');var fs_extra=require(_0x8ce6('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8ce6('0xb'));var jsforce=require(_0x8ce6('0xc'));var deskjs=require(_0x8ce6('0xd'));var toCsv=require(_0x8ce6('0xe'));var querystring=require('querystring');var Papa=require(_0x8ce6('0xf'));var Redis=require(_0x8ce6('0x10'));var authService=require(_0x8ce6('0x11'));var qs=require(_0x8ce6('0x12'));var as=require(_0x8ce6('0x13'));var hardwareService=require(_0x8ce6('0x14'));var logger=require(_0x8ce6('0x15'))(_0x8ce6('0x16'));var utils=require(_0x8ce6('0x17'));var config=require(_0x8ce6('0x18'));var licenseUtil=require(_0x8ce6('0x19'));var db=require(_0x8ce6('0x1a'))['db'];function respondWithStatusCode(_0x301a9b,_0x40e7ab){_0x40e7ab=_0x40e7ab||0xcc;return function(_0x1e8b85){if(_0x1e8b85){return _0x301a9b[_0x8ce6('0x1b')](_0x40e7ab);}return _0x301a9b[_0x8ce6('0x1c')](_0x40e7ab)[_0x8ce6('0x1d')]();};}function respondWithResult(_0x4a68fd,_0x20752c){_0x20752c=_0x20752c||0xc8;return function(_0x5f0ff5){if(_0x5f0ff5){return _0x4a68fd[_0x8ce6('0x1c')](_0x20752c)[_0x8ce6('0x1e')](_0x5f0ff5);}};}function respondWithFilteredResult(_0x150f89,_0x2ac4b3){return function(_0x2c2d7e){if(_0x2c2d7e){var _0x34cce2=typeof _0x2ac4b3[_0x8ce6('0x1f')]===_0x8ce6('0x20')&&typeof _0x2ac4b3[_0x8ce6('0x21')]===_0x8ce6('0x20');var _0x4fd6a6=_0x2c2d7e[_0x8ce6('0x22')];var _0x4ba248=_0x34cce2?0x0:_0x2ac4b3[_0x8ce6('0x1f')];var _0x175a74=_0x34cce2?_0x2c2d7e[_0x8ce6('0x22')]:_0x2ac4b3['offset']+_0x2ac4b3['limit'];var _0x30e233;if(_0x175a74>=_0x4fd6a6){_0x175a74=_0x4fd6a6;_0x30e233=0xc8;}else{_0x30e233=0xce;}_0x150f89[_0x8ce6('0x1c')](_0x30e233);return _0x150f89['set'](_0x8ce6('0x23'),_0x4ba248+'-'+_0x175a74+'/'+_0x4fd6a6)[_0x8ce6('0x1e')](_0x2c2d7e);}return null;};}function patchUpdates(_0x444cba){return function(_0x5c5cff){try{jsonpatch[_0x8ce6('0x24')](_0x5c5cff,_0x444cba,!![]);}catch(_0x1b2b91){return BPromise[_0x8ce6('0x25')](_0x1b2b91);}return _0x5c5cff[_0x8ce6('0x26')]();};}function saveUpdates(_0x2fef1c,_0x3427f8){return function(_0x2c4043){if(_0x2c4043){return _0x2c4043[_0x8ce6('0x27')](_0x2fef1c)['then'](function(_0x462c8b){return _0x462c8b;});}return null;};}function removeEntity(_0x5e5702,_0xdf5830){return function(_0x28c639){if(_0x28c639){return _0x28c639[_0x8ce6('0x28')]()['then'](function(){_0x5e5702['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c2b61,_0x3a8325){return function(_0x1e95cb){if(!_0x1e95cb){_0x5c2b61[_0x8ce6('0x1b')](0x194);}return _0x1e95cb;};}function handleError(_0xed5ae7,_0x35c2d6){_0x35c2d6=_0x35c2d6||0x1f4;return function(_0xadc624){logger['error'](_0xadc624['stack']);if(_0xadc624[_0x8ce6('0x29')]){delete _0xadc624[_0x8ce6('0x29')];}_0xed5ae7[_0x8ce6('0x1c')](_0x35c2d6)[_0x8ce6('0x2a')](_0xadc624);};}exports[_0x8ce6('0x2b')]=function(_0x10a3f9,_0x552251){var _0x4c5a7e={},_0x1eabc8={},_0xb35316={'count':0x0,'rows':[]};var _0x3ebbbc=_['map'](db[_0x8ce6('0x2c')][_0x8ce6('0x2d')],function(_0x3abed8){return{'name':_0x3abed8[_0x8ce6('0x2e')],'type':_0x3abed8['type'][_0x8ce6('0x2f')]};});_0x1eabc8[_0x8ce6('0x30')]=_['map'](_0x3ebbbc,'name');_0x1eabc8[_0x8ce6('0x31')]=_[_0x8ce6('0x32')](_0x10a3f9[_0x8ce6('0x31')]);_0x1eabc8[_0x8ce6('0x33')]=_[_0x8ce6('0x34')](_0x1eabc8[_0x8ce6('0x30')],_0x1eabc8[_0x8ce6('0x31')]);_0x4c5a7e[_0x8ce6('0x35')]=_[_0x8ce6('0x34')](_0x1eabc8[_0x8ce6('0x30')],qs[_0x8ce6('0x36')](_0x10a3f9[_0x8ce6('0x31')][_0x8ce6('0x36')]));_0x4c5a7e[_0x8ce6('0x35')]=_0x4c5a7e[_0x8ce6('0x35')][_0x8ce6('0x37')]?_0x4c5a7e[_0x8ce6('0x35')]:_0x1eabc8[_0x8ce6('0x30')];if(!_0x10a3f9[_0x8ce6('0x31')]['hasOwnProperty'](_0x8ce6('0x38'))){_0x4c5a7e[_0x8ce6('0x21')]=qs[_0x8ce6('0x21')](_0x10a3f9[_0x8ce6('0x31')][_0x8ce6('0x21')]);_0x4c5a7e['offset']=qs['offset'](_0x10a3f9[_0x8ce6('0x31')][_0x8ce6('0x1f')]);}_0x4c5a7e['order']=qs['sort'](_0x10a3f9[_0x8ce6('0x31')][_0x8ce6('0x39')]);_0x4c5a7e[_0x8ce6('0x3a')]=qs[_0x8ce6('0x33')](_[_0x8ce6('0x3b')](_0x10a3f9[_0x8ce6('0x31')],_0x1eabc8['filters']),_0x3ebbbc);if(_0x10a3f9[_0x8ce6('0x31')]['filter']){_0x4c5a7e[_0x8ce6('0x3a')]=_['merge'](_0x4c5a7e[_0x8ce6('0x3a')],{'$or':_[_0x8ce6('0x3c')](_0x3ebbbc,function(_0x118db5){if(_0x118db5[_0x8ce6('0x3d')]!=='VIRTUAL'){var _0x2d0775={};_0x2d0775[_0x118db5['name']]={'$like':'%'+_0x10a3f9[_0x8ce6('0x31')]['filter']+'%'};return _0x2d0775;}})});}_0x4c5a7e=_[_0x8ce6('0x3e')]({},_0x4c5a7e,_0x10a3f9[_0x8ce6('0x3f')]);var _0x265495={'where':_0x4c5a7e['where']};return db[_0x8ce6('0x2c')][_0x8ce6('0x22')](_0x265495)[_0x8ce6('0x40')](function(_0x4f0e3f){_0xb35316[_0x8ce6('0x22')]=_0x4f0e3f;if(_0x10a3f9[_0x8ce6('0x31')]['includeAll']){_0x4c5a7e[_0x8ce6('0x41')]=[{'all':!![]}];}return db[_0x8ce6('0x2c')][_0x8ce6('0x42')](_0x4c5a7e);})['then'](function(_0x2e36f8){_0xb35316[_0x8ce6('0x43')]=_0x2e36f8;return _0xb35316;})[_0x8ce6('0x40')](respondWithFilteredResult(_0x552251,_0x4c5a7e))[_0x8ce6('0x44')](handleError(_0x552251,null));}; \ No newline at end of file +var _0x9554=['hasOwnProperty','nolimit','sort','filter','merge','where','includeAll','include','findAll','rows','catch','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','stack','name','send','map','Migration','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length'];(function(_0x77d310,_0x2b2fe7){var _0x2cdce4=function(_0xbaa481){while(--_0xbaa481){_0x77d310['push'](_0x77d310['shift']());}};_0x2cdce4(++_0x2b2fe7);}(_0x9554,0x14b));var _0x4955=function(_0x809dd7,_0x4770b8){_0x809dd7=_0x809dd7-0x0;var _0x5b2e78=_0x9554[_0x809dd7];return _0x5b2e78;};'use strict';var emlformat=require(_0x4955('0x0'));var rimraf=require(_0x4955('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4955('0x2'));var moment=require(_0x4955('0x3'));var BPromise=require(_0x4955('0x4'));var Mustache=require(_0x4955('0x5'));var util=require('util');var path=require(_0x4955('0x6'));var sox=require(_0x4955('0x7'));var csv=require(_0x4955('0x8'));var ejs=require(_0x4955('0x9'));var fs=require('fs');var fs_extra=require(_0x4955('0xa'));var _=require(_0x4955('0xb'));var squel=require(_0x4955('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4955('0xd'));var toCsv=require(_0x4955('0x8'));var querystring=require(_0x4955('0xe'));var Papa=require(_0x4955('0xf'));var Redis=require(_0x4955('0x10'));var authService=require(_0x4955('0x11'));var qs=require(_0x4955('0x12'));var as=require(_0x4955('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4955('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x4955('0x15'));var licenseUtil=require(_0x4955('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e08d9,_0x181d38){_0x181d38=_0x181d38||0xcc;return function(_0x4edb42){if(_0x4edb42){return _0x3e08d9[_0x4955('0x17')](_0x181d38);}return _0x3e08d9[_0x4955('0x18')](_0x181d38)[_0x4955('0x19')]();};}function respondWithResult(_0x57873a,_0x1bb3a9){_0x1bb3a9=_0x1bb3a9||0xc8;return function(_0x44ce6c){if(_0x44ce6c){return _0x57873a[_0x4955('0x18')](_0x1bb3a9)[_0x4955('0x1a')](_0x44ce6c);}};}function respondWithFilteredResult(_0x4bfc2f,_0x232f00){return function(_0x313816){if(_0x313816){var _0x51f685=typeof _0x232f00[_0x4955('0x1b')]===_0x4955('0x1c')&&typeof _0x232f00[_0x4955('0x1d')]==='undefined';var _0x3f3a38=_0x313816[_0x4955('0x1e')];var _0x50d22a=_0x51f685?0x0:_0x232f00[_0x4955('0x1b')];var _0xd8d92b=_0x51f685?_0x313816[_0x4955('0x1e')]:_0x232f00[_0x4955('0x1b')]+_0x232f00[_0x4955('0x1d')];var _0x144b7d;if(_0xd8d92b>=_0x3f3a38){_0xd8d92b=_0x3f3a38;_0x144b7d=0xc8;}else{_0x144b7d=0xce;}_0x4bfc2f[_0x4955('0x18')](_0x144b7d);return _0x4bfc2f['set']('Content-Range',_0x50d22a+'-'+_0xd8d92b+'/'+_0x3f3a38)[_0x4955('0x1a')](_0x313816);}return null;};}function patchUpdates(_0x4ce6ce){return function(_0x21e505){try{jsonpatch[_0x4955('0x1f')](_0x21e505,_0x4ce6ce,!![]);}catch(_0x5d837a){return BPromise[_0x4955('0x20')](_0x5d837a);}return _0x21e505[_0x4955('0x21')]();};}function saveUpdates(_0x5016e4,_0x30fcec){return function(_0xba3cee){if(_0xba3cee){return _0xba3cee[_0x4955('0x22')](_0x5016e4)[_0x4955('0x23')](function(_0x2cb627){return _0x2cb627;});}return null;};}function removeEntity(_0x534bba,_0x41b526){return function(_0x4effa6){if(_0x4effa6){return _0x4effa6[_0x4955('0x24')]()[_0x4955('0x23')](function(){_0x534bba[_0x4955('0x18')](0xcc)[_0x4955('0x19')]();});}};}function handleEntityNotFound(_0x1c27eb,_0x97248e){return function(_0x3fda94){if(!_0x3fda94){_0x1c27eb[_0x4955('0x17')](0x194);}return _0x3fda94;};}function handleError(_0x322702,_0x4e5548){_0x4e5548=_0x4e5548||0x1f4;return function(_0x37c805){logger['error'](_0x37c805[_0x4955('0x25')]);if(_0x37c805[_0x4955('0x26')]){delete _0x37c805[_0x4955('0x26')];}_0x322702[_0x4955('0x18')](_0x4e5548)[_0x4955('0x27')](_0x37c805);};}exports['index']=function(_0x1ce5dd,_0x527e0a){var _0x6ffaeb={},_0x487b1f={},_0x12b97b={'count':0x0,'rows':[]};var _0x3d0b1a=_[_0x4955('0x28')](db[_0x4955('0x29')]['rawAttributes'],function(_0x508530){return{'name':_0x508530[_0x4955('0x2a')],'type':_0x508530[_0x4955('0x2b')][_0x4955('0x2c')]};});_0x487b1f[_0x4955('0x2d')]=_['map'](_0x3d0b1a,_0x4955('0x26'));_0x487b1f[_0x4955('0x2e')]=_[_0x4955('0x2f')](_0x1ce5dd['query']);_0x487b1f[_0x4955('0x30')]=_[_0x4955('0x31')](_0x487b1f[_0x4955('0x2d')],_0x487b1f['query']);_0x6ffaeb['attributes']=_['intersection'](_0x487b1f[_0x4955('0x2d')],qs[_0x4955('0x32')](_0x1ce5dd[_0x4955('0x2e')][_0x4955('0x32')]));_0x6ffaeb[_0x4955('0x33')]=_0x6ffaeb[_0x4955('0x33')][_0x4955('0x34')]?_0x6ffaeb[_0x4955('0x33')]:_0x487b1f['model'];if(!_0x1ce5dd[_0x4955('0x2e')][_0x4955('0x35')](_0x4955('0x36'))){_0x6ffaeb[_0x4955('0x1d')]=qs[_0x4955('0x1d')](_0x1ce5dd[_0x4955('0x2e')][_0x4955('0x1d')]);_0x6ffaeb[_0x4955('0x1b')]=qs[_0x4955('0x1b')](_0x1ce5dd['query'][_0x4955('0x1b')]);}_0x6ffaeb['order']=qs[_0x4955('0x37')](_0x1ce5dd[_0x4955('0x2e')][_0x4955('0x37')]);_0x6ffaeb['where']=qs[_0x4955('0x30')](_['pick'](_0x1ce5dd['query'],_0x487b1f[_0x4955('0x30')]),_0x3d0b1a);if(_0x1ce5dd[_0x4955('0x2e')][_0x4955('0x38')]){_0x6ffaeb['where']=_[_0x4955('0x39')](_0x6ffaeb[_0x4955('0x3a')],{'$or':_[_0x4955('0x28')](_0x3d0b1a,function(_0x5487a4){if(_0x5487a4[_0x4955('0x2b')]!=='VIRTUAL'){var _0x554815={};_0x554815[_0x5487a4[_0x4955('0x26')]]={'$like':'%'+_0x1ce5dd[_0x4955('0x2e')][_0x4955('0x38')]+'%'};return _0x554815;}})});}_0x6ffaeb=_[_0x4955('0x39')]({},_0x6ffaeb,_0x1ce5dd['options']);var _0x3cfa66={'where':_0x6ffaeb[_0x4955('0x3a')]};return db[_0x4955('0x29')][_0x4955('0x1e')](_0x3cfa66)[_0x4955('0x23')](function(_0x41dd08){_0x12b97b[_0x4955('0x1e')]=_0x41dd08;if(_0x1ce5dd[_0x4955('0x2e')][_0x4955('0x3b')]){_0x6ffaeb[_0x4955('0x3c')]=[{'all':!![]}];}return db[_0x4955('0x29')][_0x4955('0x3d')](_0x6ffaeb);})[_0x4955('0x23')](function(_0x1fb62c){_0x12b97b[_0x4955('0x3e')]=_0x1fb62c;return _0x12b97b;})[_0x4955('0x23')](respondWithFilteredResult(_0x527e0a,_0x6ffaeb))[_0x4955('0x3f')](handleError(_0x527e0a,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index b12243a..8fe9104 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 _0x5bbf=['request-promise','path','rimraf','../../config/environment','exports','define','Migration','util','../../config/logger','moment','bluebird'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5bbf,0x10f));var _0xf5bb=function(_0x11160d,_0x413adc){_0x11160d=_0x11160d-0x0;var _0x21520a=_0x5bbf[_0x11160d];return _0x21520a;};'use strict';var _=require('lodash');var util=require(_0xf5bb('0x0'));var logger=require(_0xf5bb('0x1'))('api');var moment=require(_0xf5bb('0x2'));var BPromise=require(_0xf5bb('0x3'));var rp=require(_0xf5bb('0x4'));var fs=require('fs');var path=require(_0xf5bb('0x5'));var rimraf=require(_0xf5bb('0x6'));var config=require(_0xf5bb('0x7'));var attributes=require('./migration.attributes');module[_0xf5bb('0x8')]=function(_0x517178,_0xc6c4ba){return _0x517178[_0xf5bb('0x9')](_0xf5bb('0xa'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7325=['migrations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./migration.attributes','exports'];(function(_0x5ae2ba,_0xee679c){var _0x112ffc=function(_0x16c67e){while(--_0x16c67e){_0x5ae2ba['push'](_0x5ae2ba['shift']());}};_0x112ffc(++_0xee679c);}(_0x7325,0x90));var _0x5732=function(_0x2b39c7,_0x31e257){_0x2b39c7=_0x2b39c7-0x0;var _0x12e380=_0x7325[_0x2b39c7];return _0x12e380;};'use strict';var _=require(_0x5732('0x0'));var util=require(_0x5732('0x1'));var logger=require(_0x5732('0x2'))(_0x5732('0x3'));var moment=require(_0x5732('0x4'));var BPromise=require(_0x5732('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5732('0x6'));var rimraf=require(_0x5732('0x7'));var config=require('../../config/environment');var attributes=require(_0x5732('0x8'));module[_0x5732('0x9')]=function(_0x3ff8de,_0x2ecce1){return _0x3ff8de['define']('Migration',attributes,{'tableName':_0x5732('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 55573fa..8bdfc1c 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 _0x25a3=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x1fe5a1,_0x261860){var _0x1f5842=function(_0x5eab22){while(--_0x5eab22){_0x1fe5a1['push'](_0x1fe5a1['shift']());}};_0x1f5842(++_0x261860);}(_0x25a3,0x121));var _0x325a=function(_0x8be9fb,_0x2f90d9){_0x8be9fb=_0x8be9fb-0x0;var _0x3b41ac=_0x25a3[_0x8be9fb];return _0x3b41ac;};'use strict';var _=require(_0x325a('0x0'));var util=require(_0x325a('0x1'));var moment=require(_0x325a('0x2'));var BPromise=require('bluebird');var rs=require(_0x325a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x325a('0x4'))['db'];var utils=require(_0x325a('0x5'));var logger=require(_0x325a('0x6'))('rpc');var config=require(_0x325a('0x7'));var jayson=require(_0x325a('0x8'));var client=jayson[_0x325a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x533867,_0x3bb82f,_0x209f5e){return new BPromise(function(_0x43bd79,_0x33f09a){return client['request'](_0x533867,_0x209f5e)['then'](function(_0x37e954){logger[_0x325a('0xa')](_0x325a('0xb'),_0x3bb82f,_0x325a('0xc'));logger[_0x325a('0xd')](_0x325a('0xe'),_0x3bb82f,'request\x20sent',JSON[_0x325a('0xf')](_0x37e954));if(_0x37e954[_0x325a('0x10')]){if(_0x37e954['error'][_0x325a('0x11')]===0x1f4){logger[_0x325a('0x10')](_0x325a('0xb'),_0x3bb82f,_0x37e954[_0x325a('0x10')]['message']);return _0x33f09a(_0x37e954['error'][_0x325a('0x12')]);}logger['error'](_0x325a('0xb'),_0x3bb82f,_0x37e954[_0x325a('0x10')][_0x325a('0x12')]);return _0x43bd79(_0x37e954[_0x325a('0x10')][_0x325a('0x12')]);}else{logger[_0x325a('0xa')](_0x325a('0xb'),_0x3bb82f,_0x325a('0xc'));_0x43bd79(_0x37e954[_0x325a('0x13')][_0x325a('0x12')]);}})[_0x325a('0x14')](function(_0x21315f){logger[_0x325a('0x10')](_0x325a('0xb'),_0x3bb82f,_0x21315f);_0x33f09a(_0x21315f);});});} \ No newline at end of file +var _0x4227=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash'];(function(_0x4cd734,_0x4950f9){var _0x15ce0b=function(_0x52b3b3){while(--_0x52b3b3){_0x4cd734['push'](_0x4cd734['shift']());}};_0x15ce0b(++_0x4950f9);}(_0x4227,0x89));var _0x7422=function(_0x24db31,_0x2fb738){_0x24db31=_0x24db31-0x0;var _0x374bc5=_0x4227[_0x24db31];return _0x374bc5;};'use strict';var _=require(_0x7422('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7422('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7422('0x2'));var db=require(_0x7422('0x3'))['db'];var utils=require(_0x7422('0x4'));var logger=require('../../config/logger')(_0x7422('0x5'));var config=require(_0x7422('0x6'));var jayson=require(_0x7422('0x7'));var client=jayson[_0x7422('0x8')][_0x7422('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b3432,_0xe99299,_0x45ca1a){return new BPromise(function(_0x12965e,_0x599d78){return client[_0x7422('0xa')](_0x2b3432,_0x45ca1a)[_0x7422('0xb')](function(_0x25de34){logger['info'](_0x7422('0xc'),_0xe99299,'request\x20sent');logger[_0x7422('0xd')](_0x7422('0xe'),_0xe99299,_0x7422('0xf'),JSON[_0x7422('0x10')](_0x25de34));if(_0x25de34[_0x7422('0x11')]){if(_0x25de34['error'][_0x7422('0x12')]===0x1f4){logger[_0x7422('0x11')]('Migration,\x20%s,\x20%s',_0xe99299,_0x25de34[_0x7422('0x11')][_0x7422('0x13')]);return _0x599d78(_0x25de34['error'][_0x7422('0x13')]);}logger[_0x7422('0x11')]('Migration,\x20%s,\x20%s',_0xe99299,_0x25de34['error'][_0x7422('0x13')]);return _0x12965e(_0x25de34['error'][_0x7422('0x13')]);}else{logger[_0x7422('0x14')]('Migration,\x20%s,\x20%s',_0xe99299,_0x7422('0xf'));_0x12965e(_0x25de34[_0x7422('0x15')][_0x7422('0x13')]);}})[_0x7422('0x16')](function(_0x2946ca){logger[_0x7422('0x11')]('Migration,\x20%s,\x20%s',_0xe99299,_0x2946ca);_0x599d78(_0x2946ca);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 05fabc5..a73755b 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 _0x1173=['show','create','put','delete','destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id'];(function(_0xf74372,_0x51fe82){var _0x36bb65=function(_0x499b7a){while(--_0x499b7a){_0xf74372['push'](_0xf74372['shift']());}};_0x36bb65(++_0x51fe82);}(_0x1173,0x138));var _0x3117=function(_0x23fe4a,_0x5e6044){_0x23fe4a=_0x23fe4a-0x0;var _0x13ff94=_0x1173[_0x23fe4a];return _0x13ff94;};'use strict';var multer=require('multer');var util=require(_0x3117('0x0'));var path=require(_0x3117('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3117('0x2')]();var fs_extra=require(_0x3117('0x3'));var auth=require(_0x3117('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3117('0x5'));var controller=require(_0x3117('0x6'));router[_0x3117('0x7')]('/',auth[_0x3117('0x8')](),controller[_0x3117('0x9')]);router[_0x3117('0x7')](_0x3117('0xa'),auth[_0x3117('0x8')](),controller[_0x3117('0xb')]);router['post']('/',auth[_0x3117('0x8')](),controller[_0x3117('0xc')]);router[_0x3117('0xd')](_0x3117('0xa'),auth[_0x3117('0x8')](),controller['update']);router[_0x3117('0xe')](_0x3117('0xa'),auth[_0x3117('0x8')](),controller[_0x3117('0xf')]);module[_0x3117('0x10')]=router; \ No newline at end of file +var _0x14d8=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x4c9380,_0x2fefc0){var _0x49a523=function(_0x165e85){while(--_0x165e85){_0x4c9380['push'](_0x4c9380['shift']());}};_0x49a523(++_0x2fefc0);}(_0x14d8,0x87));var _0x814d=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x14d8[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x814d('0x0'));var util=require(_0x814d('0x1'));var path=require(_0x814d('0x2'));var timeout=require(_0x814d('0x3'));var express=require(_0x814d('0x4'));var router=express[_0x814d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x814d('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./network.controller');router[_0x814d('0x7')]('/',auth[_0x814d('0x8')](),controller[_0x814d('0x9')]);router['get'](_0x814d('0xa'),auth[_0x814d('0x8')](),controller[_0x814d('0xb')]);router[_0x814d('0xc')]('/',auth[_0x814d('0x8')](),controller[_0x814d('0xd')]);router[_0x814d('0xe')]('/:id',auth[_0x814d('0x8')](),controller[_0x814d('0xf')]);router[_0x814d('0x10')](_0x814d('0xa'),auth[_0x814d('0x8')](),controller[_0x814d('0x11')]);module[_0x814d('0x12')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 9253aaa..b1454c4 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 _0xb958=['externip','stun','turn','STRING','sequelize','exports','ENUM','localnet'];(function(_0x4f5557,_0x2aee40){var _0x374d03=function(_0x14fe02){while(--_0x14fe02){_0x4f5557['push'](_0x4f5557['shift']());}};_0x374d03(++_0x2aee40);}(_0xb958,0xdc));var _0x8b95=function(_0x5280f4,_0x3c36d0){_0x5280f4=_0x5280f4-0x0;var _0xba93e7=_0xb958[_0x5280f4];return _0xba93e7;};'use strict';var Sequelize=require(_0x8b95('0x0'));module[_0x8b95('0x1')]={'type':{'type':Sequelize[_0x8b95('0x2')](_0x8b95('0x3'),_0x8b95('0x4'),_0x8b95('0x5'),_0x8b95('0x6'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x8b95('0x7')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6eb0=['localnet','externip','stun','turn','STRING','sequelize','exports','ENUM'];(function(_0x1f4bed,_0x4cad75){var _0x116f50=function(_0x5f449b){while(--_0x5f449b){_0x1f4bed['push'](_0x1f4bed['shift']());}};_0x116f50(++_0x4cad75);}(_0x6eb0,0xc5));var _0x06eb=function(_0x73ab45,_0x5a6855){_0x73ab45=_0x73ab45-0x0;var _0x423d82=_0x6eb0[_0x73ab45];return _0x423d82;};'use strict';var Sequelize=require(_0x06eb('0x0'));module[_0x06eb('0x1')]={'type':{'type':Sequelize[_0x06eb('0x2')](_0x06eb('0x3'),_0x06eb('0x4'),_0x06eb('0x5'),_0x06eb('0x6'))},'value':{'type':Sequelize[_0x06eb('0x7')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x06eb('0x7')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index f4b3ee9..890d421 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 _0xfe11=['order','sort','pick','filter','where','merge','options','Network','includeAll','include','findAll','rows','show','find','create','sequelize','body','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','render','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','TURN','join','writeFileSync','/etc/asterisk/turn_xcally.conf','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','Reload','transaction','params','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','client','http','request','then','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xfe11,0x94));var _0x1fe1=function(_0x2a26da,_0x3dfca3){_0x2a26da=_0x2a26da-0x0;var _0x59fc7f=_0xfe11[_0x2a26da];return _0x59fc7f;};'use strict';var emlformat=require(_0x1fe1('0x0'));var rimraf=require(_0x1fe1('0x1'));var zipdir=require(_0x1fe1('0x2'));var jsonpatch=require(_0x1fe1('0x3'));var rp=require(_0x1fe1('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1fe1('0x5'));var util=require(_0x1fe1('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1fe1('0x7'));var _=require(_0x1fe1('0x8'));var squel=require(_0x1fe1('0x9'));var crypto=require(_0x1fe1('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1fe1('0xb'));var toCsv=require(_0x1fe1('0xc'));var querystring=require(_0x1fe1('0xd'));var Papa=require(_0x1fe1('0xe'));var Redis=require(_0x1fe1('0xf'));var authService=require(_0x1fe1('0x10'));var qs=require(_0x1fe1('0x11'));var as=require(_0x1fe1('0x12'));var hardwareService=require(_0x1fe1('0x13'));var logger=require(_0x1fe1('0x14'))('api');var utils=require(_0x1fe1('0x15'));var config=require(_0x1fe1('0x16'));var licenseUtil=require(_0x1fe1('0x17'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x1fe1('0x18')][_0x1fe1('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x10a5cd,_0x205a46,_0x20c967,_0x4320e0){return new BPromise(function(_0x19bc68,_0x3fe105){var _0x45db0a=_0x4320e0||client;return _0x45db0a[_0x1fe1('0x1a')](_0x10a5cd,_0x20c967)[_0x1fe1('0x1b')](function(_0x405e77){logger['info'](_0x1fe1('0x1c'),_0x205a46,_0x1fe1('0x1d'));logger[_0x1fe1('0x1e')](_0x1fe1('0x1f'),_0x205a46,_0x1fe1('0x1d'),JSON[_0x1fe1('0x20')](_0x405e77));if(_0x405e77['error']){if(_0x405e77[_0x1fe1('0x21')][_0x1fe1('0x22')]===0x1f4){logger[_0x1fe1('0x21')](_0x1fe1('0x1c'),_0x205a46,_0x405e77[_0x1fe1('0x21')][_0x1fe1('0x23')]);return _0x3fe105(_0x405e77[_0x1fe1('0x21')]['message']);}logger[_0x1fe1('0x21')](_0x1fe1('0x1c'),_0x205a46,_0x405e77[_0x1fe1('0x21')]['message']);return _0x19bc68(_0x405e77[_0x1fe1('0x21')][_0x1fe1('0x23')]);}else{logger[_0x1fe1('0x24')](_0x1fe1('0x1c'),_0x205a46,'request\x20sent');_0x19bc68(_0x405e77[_0x1fe1('0x25')][_0x1fe1('0x23')]);}})[_0x1fe1('0x26')](function(_0x5af052){logger[_0x1fe1('0x21')](_0x1fe1('0x1c'),_0x205a46,_0x5af052);_0x3fe105(_0x5af052);});});}function respondWithStatusCode(_0x5e9aee,_0x1fc074){_0x1fc074=_0x1fc074||0xcc;return function(_0x2da3fa){if(_0x2da3fa){return _0x5e9aee[_0x1fe1('0x27')](_0x1fc074);}return _0x5e9aee[_0x1fe1('0x28')](_0x1fc074)[_0x1fe1('0x29')]();};}function respondWithResult(_0x5eb7aa,_0x191940){_0x191940=_0x191940||0xc8;return function(_0x18a457){if(_0x18a457){return _0x5eb7aa['status'](_0x191940)[_0x1fe1('0x2a')](_0x18a457);}};}function respondWithFilteredResult(_0x1d685b,_0x2b89e0){return function(_0x20c1e4){if(_0x20c1e4){var _0x477d3a=typeof _0x2b89e0['offset']===_0x1fe1('0x2b')&&typeof _0x2b89e0[_0x1fe1('0x2c')]===_0x1fe1('0x2b');var _0x40a1bf=_0x20c1e4[_0x1fe1('0x2d')];var _0x4877af=_0x477d3a?0x0:_0x2b89e0[_0x1fe1('0x2e')];var _0x13d2bf=_0x477d3a?_0x20c1e4['count']:_0x2b89e0[_0x1fe1('0x2e')]+_0x2b89e0['limit'];var _0x4c4d2f;if(_0x13d2bf>=_0x40a1bf){_0x13d2bf=_0x40a1bf;_0x4c4d2f=0xc8;}else{_0x4c4d2f=0xce;}_0x1d685b[_0x1fe1('0x28')](_0x4c4d2f);return _0x1d685b[_0x1fe1('0x2f')](_0x1fe1('0x30'),_0x4877af+'-'+_0x13d2bf+'/'+_0x40a1bf)[_0x1fe1('0x2a')](_0x20c1e4);}return null;};}function patchUpdates(_0x3efe9c){return function(_0x5a31a7){try{jsonpatch[_0x1fe1('0x31')](_0x5a31a7,_0x3efe9c,!![]);}catch(_0x581e02){return BPromise[_0x1fe1('0x32')](_0x581e02);}return _0x5a31a7[_0x1fe1('0x33')]();};}function saveUpdates(_0xf1ffb,_0x631f34){return function(_0x2ecfb7){if(_0x2ecfb7){return _0x2ecfb7[_0x1fe1('0x34')](_0xf1ffb)[_0x1fe1('0x1b')](function(_0x3d0dbd){return _0x3d0dbd;});}return null;};}function removeEntity(_0x4e6b79,_0x1fc4fb){return function(_0x1c811d){if(_0x1c811d){return _0x1c811d[_0x1fe1('0x35')]()[_0x1fe1('0x1b')](function(){_0x4e6b79[_0x1fe1('0x28')](0xcc)[_0x1fe1('0x29')]();});}};}function handleEntityNotFound(_0x4d64ea,_0x4e03b7){return function(_0x39292c){if(!_0x39292c){_0x4d64ea[_0x1fe1('0x27')](0x194);}return _0x39292c;};}function handleError(_0x429cb6,_0x3be60d){_0x3be60d=_0x3be60d||0x1f4;return function(_0x241dc7){logger[_0x1fe1('0x21')](_0x241dc7['stack']);if(_0x241dc7[_0x1fe1('0x36')]){delete _0x241dc7['name'];}_0x429cb6[_0x1fe1('0x28')](_0x3be60d)[_0x1fe1('0x37')](_0x241dc7);};}exports[_0x1fe1('0x38')]=function(_0x23f09d,_0x30597f){var _0x3cb239={},_0x3114c9={},_0x4a3e81={'count':0x0,'rows':[]};var _0x3397b8=_[_0x1fe1('0x39')](db['Network'][_0x1fe1('0x3a')],function(_0x17e517){return{'name':_0x17e517[_0x1fe1('0x3b')],'type':_0x17e517[_0x1fe1('0x3c')]['key']};});_0x3114c9[_0x1fe1('0x3d')]=_['map'](_0x3397b8,_0x1fe1('0x36'));_0x3114c9[_0x1fe1('0x3e')]=_[_0x1fe1('0x3f')](_0x23f09d[_0x1fe1('0x3e')]);_0x3114c9[_0x1fe1('0x40')]=_[_0x1fe1('0x41')](_0x3114c9[_0x1fe1('0x3d')],_0x3114c9[_0x1fe1('0x3e')]);_0x3cb239[_0x1fe1('0x42')]=_[_0x1fe1('0x41')](_0x3114c9[_0x1fe1('0x3d')],qs[_0x1fe1('0x43')](_0x23f09d[_0x1fe1('0x3e')]['fields']));_0x3cb239[_0x1fe1('0x42')]=_0x3cb239[_0x1fe1('0x42')][_0x1fe1('0x44')]?_0x3cb239[_0x1fe1('0x42')]:_0x3114c9['model'];if(!_0x23f09d[_0x1fe1('0x3e')][_0x1fe1('0x45')]('nolimit')){_0x3cb239['limit']=qs[_0x1fe1('0x2c')](_0x23f09d[_0x1fe1('0x3e')][_0x1fe1('0x2c')]);_0x3cb239[_0x1fe1('0x2e')]=qs['offset'](_0x23f09d[_0x1fe1('0x3e')]['offset']);}_0x3cb239[_0x1fe1('0x46')]=qs[_0x1fe1('0x47')](_0x23f09d[_0x1fe1('0x3e')]['sort']);_0x3cb239['where']=qs[_0x1fe1('0x40')](_[_0x1fe1('0x48')](_0x23f09d['query'],_0x3114c9[_0x1fe1('0x40')]),_0x3397b8);if(_0x23f09d[_0x1fe1('0x3e')][_0x1fe1('0x49')]){_0x3cb239[_0x1fe1('0x4a')]=_[_0x1fe1('0x4b')](_0x3cb239['where'],{'$or':_[_0x1fe1('0x39')](_0x3397b8,function(_0x1516f0){if(_0x1516f0['type']!=='VIRTUAL'){var _0x16274f={};_0x16274f[_0x1516f0[_0x1fe1('0x36')]]={'$like':'%'+_0x23f09d[_0x1fe1('0x3e')]['filter']+'%'};return _0x16274f;}})});}_0x3cb239=_[_0x1fe1('0x4b')]({},_0x3cb239,_0x23f09d[_0x1fe1('0x4c')]);var _0x4c92={'where':_0x3cb239[_0x1fe1('0x4a')]};return db[_0x1fe1('0x4d')][_0x1fe1('0x2d')](_0x4c92)[_0x1fe1('0x1b')](function(_0x16b6d4){_0x4a3e81[_0x1fe1('0x2d')]=_0x16b6d4;if(_0x23f09d[_0x1fe1('0x3e')][_0x1fe1('0x4e')]){_0x3cb239[_0x1fe1('0x4f')]=[{'all':!![]}];}return db['Network'][_0x1fe1('0x50')](_0x3cb239);})[_0x1fe1('0x1b')](function(_0x5c7c1d){_0x4a3e81[_0x1fe1('0x51')]=_0x5c7c1d;return _0x4a3e81;})[_0x1fe1('0x1b')](respondWithFilteredResult(_0x30597f,_0x3cb239))[_0x1fe1('0x26')](handleError(_0x30597f,null));};exports[_0x1fe1('0x52')]=function(_0x261bfb,_0x128dc7){var _0x13d7db={'raw':!![],'where':{'id':_0x261bfb['params']['id']}},_0x54343e={};_0x54343e[_0x1fe1('0x3d')]=_[_0x1fe1('0x3f')](db[_0x1fe1('0x4d')][_0x1fe1('0x3a')]);_0x54343e['query']=_[_0x1fe1('0x3f')](_0x261bfb[_0x1fe1('0x3e')]);_0x54343e['filters']=_[_0x1fe1('0x41')](_0x54343e[_0x1fe1('0x3d')],_0x54343e[_0x1fe1('0x3e')]);_0x13d7db['attributes']=_[_0x1fe1('0x41')](_0x54343e[_0x1fe1('0x3d')],qs[_0x1fe1('0x43')](_0x261bfb[_0x1fe1('0x3e')][_0x1fe1('0x43')]));_0x13d7db[_0x1fe1('0x42')]=_0x13d7db[_0x1fe1('0x42')]['length']?_0x13d7db[_0x1fe1('0x42')]:_0x54343e['model'];if(_0x261bfb[_0x1fe1('0x3e')][_0x1fe1('0x4e')]){_0x13d7db[_0x1fe1('0x4f')]=[{'all':!![]}];}_0x13d7db=_[_0x1fe1('0x4b')]({},_0x13d7db,_0x261bfb[_0x1fe1('0x4c')]);return db[_0x1fe1('0x4d')][_0x1fe1('0x53')](_0x13d7db)[_0x1fe1('0x1b')](handleEntityNotFound(_0x128dc7,null))['then'](respondWithResult(_0x128dc7,null))['catch'](handleError(_0x128dc7,null));};exports[_0x1fe1('0x54')]=function(_0x12508f,_0x1af533,_0x59a0f1){var _0x6dc73e;return db[_0x1fe1('0x55')]['transaction'](function(_0x266448){return db[_0x1fe1('0x4d')]['create'](_0x12508f['body'],{'raw':!![]})[_0x1fe1('0x1b')](function(_0x5ef4ab){_0x6dc73e=_0x5ef4ab;return db[_0x1fe1('0x4d')][_0x1fe1('0x50')]({'where':{'type':_0x12508f[_0x1fe1('0x56')][_0x1fe1('0x3c')]},'raw':!![]});})[_0x1fe1('0x1b')](function(_0x52bdc1){if(_0x6dc73e[_0x1fe1('0x3c')][_0x1fe1('0x57')]()==_0x1fe1('0x58')){var _0x444fac=fs[_0x1fe1('0x59')](path['join'](config[_0x1fe1('0x5a')],_0x1fe1('0x5b')),_0x1fe1('0x5c'));var _0x55705f=ejs[_0x1fe1('0x5d')](_0x444fac,{'networks':_0x52bdc1||[]});fs['writeFileSync'](_0x1fe1('0x5e'),_0x55705f);return respondWithRpcPromise('Reload',_0x1fe1('0x54'),{'module':_0x1fe1('0x5f')});}else if(_0x6dc73e[_0x1fe1('0x3c')][_0x1fe1('0x57')]()==_0x1fe1('0x60')){var _0xdd6bd6=fs['readFileSync'](path[_0x1fe1('0x61')](config[_0x1fe1('0x5a')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x553363=ejs[_0x1fe1('0x5d')](_0xdd6bd6,{'networks':_0x52bdc1||[]});fs[_0x1fe1('0x62')](_0x1fe1('0x63'),_0x553363);return respondWithRpcPromise('Reload',_0x1fe1('0x54'),{'module':_0x1fe1('0x5f')});}else{var _0x53b189=fs[_0x1fe1('0x59')](path[_0x1fe1('0x61')](config[_0x1fe1('0x5a')],'server/files/templates/network.ejs'),_0x1fe1('0x5c'));var _0x1c14bc=ejs[_0x1fe1('0x5d')](_0x53b189,{'networks':_0x52bdc1||[]});fs[_0x1fe1('0x62')](util[_0x1fe1('0x64')](_0x1fe1('0x65'),_0x12508f[_0x1fe1('0x56')][_0x1fe1('0x3c')][_0x1fe1('0x66')]()),_0x1c14bc);return respondWithRpcPromise(_0x1fe1('0x67'),_0x1fe1('0x54'),{'module':'chan_sip.so'});}return null;})[_0x1fe1('0x1b')](function(){return _0x6dc73e;});})['then'](respondWithResult(_0x1af533,0xc9))['catch'](handleError(_0x1af533,null));};exports[_0x1fe1('0x34')]=function(_0x26e1a2,_0x1f2f3a,_0x3f212a){var _0x37ddab;return db[_0x1fe1('0x55')][_0x1fe1('0x68')](function(_0x3ef595){return db[_0x1fe1('0x4d')][_0x1fe1('0x53')]({'where':{'id':_0x26e1a2[_0x1fe1('0x69')]['id']}})['then'](handleEntityNotFound(_0x1f2f3a,null))[_0x1fe1('0x1b')](saveUpdates(_0x26e1a2['body'],null))[_0x1fe1('0x1b')](function(_0x184cff){if(_0x184cff){_0x37ddab=_0x184cff;return db['Network'][_0x1fe1('0x50')]({'where':{'type':_0x37ddab['type']},'raw':!![]});}return null;})[_0x1fe1('0x1b')](function(_0x27cadd){if(_0x37ddab[_0x1fe1('0x3c')][_0x1fe1('0x57')]()==_0x1fe1('0x58')){var _0x57875e=fs[_0x1fe1('0x59')](path[_0x1fe1('0x61')](config[_0x1fe1('0x5a')],_0x1fe1('0x5b')),_0x1fe1('0x5c'));var _0x161070=ejs[_0x1fe1('0x5d')](_0x57875e,{'networks':_0x27cadd||[]});fs[_0x1fe1('0x62')]('/etc/asterisk/stun_xcally.conf',_0x161070);return respondWithRpcPromise(_0x1fe1('0x67'),_0x1fe1('0x34'),{'module':_0x1fe1('0x5f')});}else if(_0x37ddab[_0x1fe1('0x3c')][_0x1fe1('0x57')]()=='TURN'){var _0x1df5ca=fs[_0x1fe1('0x59')](path[_0x1fe1('0x61')](config['root'],_0x1fe1('0x6a')),_0x1fe1('0x5c'));var _0x21fd6c=ejs[_0x1fe1('0x5d')](_0x1df5ca,{'networks':_0x27cadd||[]});fs[_0x1fe1('0x62')]('/etc/asterisk/turn_xcally.conf',_0x21fd6c);return respondWithRpcPromise('Reload','update',{'module':_0x1fe1('0x5f')});}else{var _0x53702d=fs[_0x1fe1('0x59')](path[_0x1fe1('0x61')](config['root'],_0x1fe1('0x6b')),_0x1fe1('0x5c'));var _0x399e1b=ejs[_0x1fe1('0x5d')](_0x53702d,{'networks':_0x27cadd||[]});fs[_0x1fe1('0x62')](util[_0x1fe1('0x64')](_0x1fe1('0x65'),_0x26e1a2[_0x1fe1('0x56')][_0x1fe1('0x3c')][_0x1fe1('0x66')]()),_0x399e1b);return respondWithRpcPromise(_0x1fe1('0x67'),'update',{'module':'chan_sip.so'});}return null;})[_0x1fe1('0x1b')](function(_0x4f4d81){if(_0x4f4d81){return _0x37ddab;}return null;});})['then'](respondWithResult(_0x1f2f3a,null))['catch'](handleError(_0x1f2f3a,null));};exports[_0x1fe1('0x35')]=function(_0x3d5084,_0x36f502,_0x33dde4){var _0x1e51b9;return db[_0x1fe1('0x4d')]['find']({'where':{'id':_0x3d5084[_0x1fe1('0x69')]['id']}})['then'](function(_0x27cd7f){_0x1e51b9=_0x27cd7f;return _0x27cd7f;})[_0x1fe1('0x1b')](handleEntityNotFound(_0x36f502,null))[_0x1fe1('0x1b')](removeEntity(_0x36f502,null))[_0x1fe1('0x1b')](function(){if(_0x1e51b9){return db[_0x1fe1('0x4d')][_0x1fe1('0x50')]({'where':{'type':_0x1e51b9[_0x1fe1('0x3c')]},'raw':!![]});}})['then'](function(_0x586707){if(_0x1e51b9[_0x1fe1('0x3c')][_0x1fe1('0x57')]()==_0x1fe1('0x58')){var _0x459bbb=fs[_0x1fe1('0x59')](path[_0x1fe1('0x61')](config[_0x1fe1('0x5a')],_0x1fe1('0x5b')),'utf8');var _0x43e382=ejs[_0x1fe1('0x5d')](_0x459bbb,{'networks':_0x586707||[]});fs['writeFileSync'](_0x1fe1('0x5e'),_0x43e382);return respondWithRpcPromise(_0x1fe1('0x67'),'destroy',{'module':_0x1fe1('0x5f')});}else if(_0x1e51b9[_0x1fe1('0x3c')][_0x1fe1('0x57')]()==_0x1fe1('0x60')){var _0x83ac1=fs[_0x1fe1('0x59')](path[_0x1fe1('0x61')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x1fe1('0x5c'));var _0x4822f9=ejs[_0x1fe1('0x5d')](_0x83ac1,{'networks':_0x586707||[]});fs[_0x1fe1('0x62')](_0x1fe1('0x63'),_0x4822f9);return respondWithRpcPromise(_0x1fe1('0x67'),_0x1fe1('0x35'),{'module':_0x1fe1('0x5f')});}else{var _0x33f457=fs[_0x1fe1('0x59')](path[_0x1fe1('0x61')](config['root'],'server/files/templates/network.ejs'),_0x1fe1('0x5c'));var _0x2d748d=ejs['render'](_0x33f457,{'networks':_0x586707||[]});fs['writeFileSync'](util[_0x1fe1('0x64')](_0x1fe1('0x65'),_0x3d5084['body']['type']['toLowerCase']()),_0x2d748d);return respondWithRpcPromise(_0x1fe1('0x67'),_0x1fe1('0x35'),{'module':_0x1fe1('0x6c')});}return null;})[_0x1fe1('0x26')](handleError(_0x36f502,null));}; \ No newline at end of file +var _0x88ac=['desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','Network,\x20%s,\x20%s','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','name','send','map','Network','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','show','params','options','find','sequelize','create','body','toUpperCase','readFileSync','join','render','writeFileSync','Reload','TURN','root','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','utf8','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','transaction','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','STUN','server/files/templates/stun_multiple.ejs','eml-format','fast-json-patch','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','crypto','jsforce'];(function(_0x3758dd,_0x3608b9){var _0x16ba2f=function(_0x2c4d3b){while(--_0x2c4d3b){_0x3758dd['push'](_0x3758dd['shift']());}};_0x16ba2f(++_0x3608b9);}(_0x88ac,0x12d));var _0xc88a=function(_0x253099,_0x4761b5){_0x253099=_0x253099-0x0;var _0x1f0861=_0x88ac[_0x253099];return _0x1f0861;};'use strict';var emlformat=require(_0xc88a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc88a('0x1'));var rp=require('request-promise');var moment=require(_0xc88a('0x2'));var BPromise=require(_0xc88a('0x3'));var Mustache=require(_0xc88a('0x4'));var util=require('util');var path=require('path');var sox=require(_0xc88a('0x5'));var csv=require('to-csv');var ejs=require(_0xc88a('0x6'));var fs=require('fs');var fs_extra=require(_0xc88a('0x7'));var _=require(_0xc88a('0x8'));var squel=require('squel');var crypto=require(_0xc88a('0x9'));var jsforce=require(_0xc88a('0xa'));var deskjs=require(_0xc88a('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc88a('0xc'));var Papa=require(_0xc88a('0xd'));var Redis=require(_0xc88a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc88a('0xf'));var as=require(_0xc88a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc88a('0x11'))('api');var utils=require(_0xc88a('0x12'));var config=require(_0xc88a('0x13'));var licenseUtil=require(_0xc88a('0x14'));var db=require(_0xc88a('0x15'))['db'];var jayson=require(_0xc88a('0x16'));var client=jayson[_0xc88a('0x17')][_0xc88a('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x1df1c3,_0x2a9012,_0xa6ad46,_0x479479){return new BPromise(function(_0x55a27a,_0x11d787){var _0x16dd48=_0x479479||client;return _0x16dd48[_0xc88a('0x19')](_0x1df1c3,_0xa6ad46)[_0xc88a('0x1a')](function(_0x2b63cd){logger['info'](_0xc88a('0x1b'),_0x2a9012,'request\x20sent');logger['debug'](_0xc88a('0x1c'),_0x2a9012,'request\x20sent',JSON[_0xc88a('0x1d')](_0x2b63cd));if(_0x2b63cd['error']){if(_0x2b63cd[_0xc88a('0x1e')][_0xc88a('0x1f')]===0x1f4){logger[_0xc88a('0x1e')](_0xc88a('0x1b'),_0x2a9012,_0x2b63cd[_0xc88a('0x1e')][_0xc88a('0x20')]);return _0x11d787(_0x2b63cd[_0xc88a('0x1e')]['message']);}logger[_0xc88a('0x1e')](_0xc88a('0x1b'),_0x2a9012,_0x2b63cd[_0xc88a('0x1e')][_0xc88a('0x20')]);return _0x55a27a(_0x2b63cd[_0xc88a('0x1e')]['message']);}else{logger[_0xc88a('0x21')](_0xc88a('0x1b'),_0x2a9012,'request\x20sent');_0x55a27a(_0x2b63cd[_0xc88a('0x22')][_0xc88a('0x20')]);}})[_0xc88a('0x23')](function(_0x552db0){logger[_0xc88a('0x1e')](_0xc88a('0x1b'),_0x2a9012,_0x552db0);_0x11d787(_0x552db0);});});}function respondWithStatusCode(_0x53c637,_0xc605f0){_0xc605f0=_0xc605f0||0xcc;return function(_0x530e2b){if(_0x530e2b){return _0x53c637[_0xc88a('0x24')](_0xc605f0);}return _0x53c637[_0xc88a('0x25')](_0xc605f0)[_0xc88a('0x26')]();};}function respondWithResult(_0x59f1e9,_0x2a9e1b){_0x2a9e1b=_0x2a9e1b||0xc8;return function(_0x2daff0){if(_0x2daff0){return _0x59f1e9[_0xc88a('0x25')](_0x2a9e1b)['json'](_0x2daff0);}};}function respondWithFilteredResult(_0x5603d8,_0x5e6f3e){return function(_0x4f5959){if(_0x4f5959){var _0x4d15cc=typeof _0x5e6f3e[_0xc88a('0x27')]===_0xc88a('0x28')&&typeof _0x5e6f3e[_0xc88a('0x29')]===_0xc88a('0x28');var _0x1baf88=_0x4f5959[_0xc88a('0x2a')];var _0x3eda6f=_0x4d15cc?0x0:_0x5e6f3e[_0xc88a('0x27')];var _0x5a0358=_0x4d15cc?_0x4f5959[_0xc88a('0x2a')]:_0x5e6f3e[_0xc88a('0x27')]+_0x5e6f3e[_0xc88a('0x29')];var _0xffab72;if(_0x5a0358>=_0x1baf88){_0x5a0358=_0x1baf88;_0xffab72=0xc8;}else{_0xffab72=0xce;}_0x5603d8[_0xc88a('0x25')](_0xffab72);return _0x5603d8[_0xc88a('0x2b')]('Content-Range',_0x3eda6f+'-'+_0x5a0358+'/'+_0x1baf88)[_0xc88a('0x2c')](_0x4f5959);}return null;};}function patchUpdates(_0xb77887){return function(_0x1156cc){try{jsonpatch[_0xc88a('0x2d')](_0x1156cc,_0xb77887,!![]);}catch(_0x48c404){return BPromise[_0xc88a('0x2e')](_0x48c404);}return _0x1156cc[_0xc88a('0x2f')]();};}function saveUpdates(_0x221306,_0x1d4908){return function(_0x1de375){if(_0x1de375){return _0x1de375[_0xc88a('0x30')](_0x221306)[_0xc88a('0x1a')](function(_0x44cbbc){return _0x44cbbc;});}return null;};}function removeEntity(_0x2d404b,_0x7ba587){return function(_0x13b9fc){if(_0x13b9fc){return _0x13b9fc[_0xc88a('0x31')]()['then'](function(){_0x2d404b[_0xc88a('0x25')](0xcc)[_0xc88a('0x26')]();});}};}function handleEntityNotFound(_0x46129a,_0x243c6f){return function(_0x18ef7b){if(!_0x18ef7b){_0x46129a[_0xc88a('0x24')](0x194);}return _0x18ef7b;};}function handleError(_0x5231d2,_0x56e3ea){_0x56e3ea=_0x56e3ea||0x1f4;return function(_0x3f0bb7){logger['error'](_0x3f0bb7['stack']);if(_0x3f0bb7[_0xc88a('0x32')]){delete _0x3f0bb7['name'];}_0x5231d2['status'](_0x56e3ea)[_0xc88a('0x33')](_0x3f0bb7);};}exports['index']=function(_0x182c9b,_0x42b0c7){var _0x480cc3={},_0x16b762={},_0xfd8dab={'count':0x0,'rows':[]};var _0xd399df=_[_0xc88a('0x34')](db[_0xc88a('0x35')][_0xc88a('0x36')],function(_0x485fc5){return{'name':_0x485fc5[_0xc88a('0x37')],'type':_0x485fc5[_0xc88a('0x38')]['key']};});_0x16b762['model']=_[_0xc88a('0x34')](_0xd399df,_0xc88a('0x32'));_0x16b762[_0xc88a('0x39')]=_[_0xc88a('0x3a')](_0x182c9b['query']);_0x16b762[_0xc88a('0x3b')]=_[_0xc88a('0x3c')](_0x16b762[_0xc88a('0x3d')],_0x16b762['query']);_0x480cc3[_0xc88a('0x3e')]=_[_0xc88a('0x3c')](_0x16b762[_0xc88a('0x3d')],qs[_0xc88a('0x3f')](_0x182c9b['query'][_0xc88a('0x3f')]));_0x480cc3[_0xc88a('0x3e')]=_0x480cc3[_0xc88a('0x3e')][_0xc88a('0x40')]?_0x480cc3[_0xc88a('0x3e')]:_0x16b762['model'];if(!_0x182c9b[_0xc88a('0x39')][_0xc88a('0x41')](_0xc88a('0x42'))){_0x480cc3['limit']=qs['limit'](_0x182c9b[_0xc88a('0x39')]['limit']);_0x480cc3[_0xc88a('0x27')]=qs[_0xc88a('0x27')](_0x182c9b['query'][_0xc88a('0x27')]);}_0x480cc3[_0xc88a('0x43')]=qs[_0xc88a('0x44')](_0x182c9b[_0xc88a('0x39')][_0xc88a('0x44')]);_0x480cc3[_0xc88a('0x45')]=qs['filters'](_[_0xc88a('0x46')](_0x182c9b['query'],_0x16b762[_0xc88a('0x3b')]),_0xd399df);if(_0x182c9b['query'][_0xc88a('0x47')]){_0x480cc3[_0xc88a('0x45')]=_['merge'](_0x480cc3['where'],{'$or':_[_0xc88a('0x34')](_0xd399df,function(_0x3f6994){if(_0x3f6994['type']!=='VIRTUAL'){var _0x2890f7={};_0x2890f7[_0x3f6994[_0xc88a('0x32')]]={'$like':'%'+_0x182c9b[_0xc88a('0x39')][_0xc88a('0x47')]+'%'};return _0x2890f7;}})});}_0x480cc3=_[_0xc88a('0x48')]({},_0x480cc3,_0x182c9b['options']);var _0x2f8942={'where':_0x480cc3['where']};return db[_0xc88a('0x35')][_0xc88a('0x2a')](_0x2f8942)['then'](function(_0x56c88){_0xfd8dab[_0xc88a('0x2a')]=_0x56c88;if(_0x182c9b['query'][_0xc88a('0x49')]){_0x480cc3[_0xc88a('0x4a')]=[{'all':!![]}];}return db[_0xc88a('0x35')][_0xc88a('0x4b')](_0x480cc3);})['then'](function(_0x57ff2e){_0xfd8dab['rows']=_0x57ff2e;return _0xfd8dab;})[_0xc88a('0x1a')](respondWithFilteredResult(_0x42b0c7,_0x480cc3))[_0xc88a('0x23')](handleError(_0x42b0c7,null));};exports[_0xc88a('0x4c')]=function(_0x595c35,_0x55d14a){var _0x8a7d16={'raw':!![],'where':{'id':_0x595c35[_0xc88a('0x4d')]['id']}},_0x436fe3={};_0x436fe3[_0xc88a('0x3d')]=_[_0xc88a('0x3a')](db[_0xc88a('0x35')][_0xc88a('0x36')]);_0x436fe3[_0xc88a('0x39')]=_[_0xc88a('0x3a')](_0x595c35[_0xc88a('0x39')]);_0x436fe3[_0xc88a('0x3b')]=_[_0xc88a('0x3c')](_0x436fe3[_0xc88a('0x3d')],_0x436fe3[_0xc88a('0x39')]);_0x8a7d16[_0xc88a('0x3e')]=_[_0xc88a('0x3c')](_0x436fe3[_0xc88a('0x3d')],qs[_0xc88a('0x3f')](_0x595c35[_0xc88a('0x39')]['fields']));_0x8a7d16[_0xc88a('0x3e')]=_0x8a7d16[_0xc88a('0x3e')]['length']?_0x8a7d16['attributes']:_0x436fe3[_0xc88a('0x3d')];if(_0x595c35[_0xc88a('0x39')][_0xc88a('0x49')]){_0x8a7d16[_0xc88a('0x4a')]=[{'all':!![]}];}_0x8a7d16=_['merge']({},_0x8a7d16,_0x595c35[_0xc88a('0x4e')]);return db[_0xc88a('0x35')][_0xc88a('0x4f')](_0x8a7d16)[_0xc88a('0x1a')](handleEntityNotFound(_0x55d14a,null))[_0xc88a('0x1a')](respondWithResult(_0x55d14a,null))[_0xc88a('0x23')](handleError(_0x55d14a,null));};exports['create']=function(_0x16b15b,_0x26d0d8,_0x1febb9){var _0x1abd9c;return db[_0xc88a('0x50')]['transaction'](function(_0x2b47c1){return db[_0xc88a('0x35')][_0xc88a('0x51')](_0x16b15b[_0xc88a('0x52')],{'raw':!![]})[_0xc88a('0x1a')](function(_0x173640){_0x1abd9c=_0x173640;return db['Network']['findAll']({'where':{'type':_0x16b15b[_0xc88a('0x52')]['type']},'raw':!![]});})[_0xc88a('0x1a')](function(_0x30ce96){if(_0x1abd9c['type'][_0xc88a('0x53')]()=='STUN'){var _0xa2f891=fs[_0xc88a('0x54')](path[_0xc88a('0x55')](config['root'],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x1d4e5a=ejs[_0xc88a('0x56')](_0xa2f891,{'networks':_0x30ce96||[]});fs[_0xc88a('0x57')]('/etc/asterisk/stun_xcally.conf',_0x1d4e5a);return respondWithRpcPromise(_0xc88a('0x58'),_0xc88a('0x51'),{'module':'res_stun_monitor.so'});}else if(_0x1abd9c[_0xc88a('0x38')][_0xc88a('0x53')]()==_0xc88a('0x59')){var _0x579bd1=fs[_0xc88a('0x54')](path[_0xc88a('0x55')](config[_0xc88a('0x5a')],_0xc88a('0x5b')),'utf8');var _0x111a1d=ejs['render'](_0x579bd1,{'networks':_0x30ce96||[]});fs[_0xc88a('0x57')](_0xc88a('0x5c'),_0x111a1d);return respondWithRpcPromise(_0xc88a('0x58'),'create',{'module':'res_stun_monitor.so'});}else{var _0x332153=fs[_0xc88a('0x54')](path[_0xc88a('0x55')](config['root'],_0xc88a('0x5d')),_0xc88a('0x5e'));var _0x103c36=ejs[_0xc88a('0x56')](_0x332153,{'networks':_0x30ce96||[]});fs[_0xc88a('0x57')](util[_0xc88a('0x5f')](_0xc88a('0x60'),_0x16b15b[_0xc88a('0x52')]['type'][_0xc88a('0x61')]()),_0x103c36);return respondWithRpcPromise(_0xc88a('0x58'),_0xc88a('0x51'),{'module':_0xc88a('0x62')});}return null;})[_0xc88a('0x1a')](function(){return _0x1abd9c;});})[_0xc88a('0x1a')](respondWithResult(_0x26d0d8,0xc9))['catch'](handleError(_0x26d0d8,null));};exports[_0xc88a('0x30')]=function(_0x5e2479,_0x3aba4a,_0x8cbdef){var _0x1bd216;return db[_0xc88a('0x50')][_0xc88a('0x63')](function(_0x913fdf){return db['Network'][_0xc88a('0x4f')]({'where':{'id':_0x5e2479[_0xc88a('0x4d')]['id']}})[_0xc88a('0x1a')](handleEntityNotFound(_0x3aba4a,null))[_0xc88a('0x1a')](saveUpdates(_0x5e2479[_0xc88a('0x52')],null))[_0xc88a('0x1a')](function(_0x10cc07){if(_0x10cc07){_0x1bd216=_0x10cc07;return db[_0xc88a('0x35')][_0xc88a('0x4b')]({'where':{'type':_0x1bd216['type']},'raw':!![]});}return null;})['then'](function(_0x1a1d45){if(_0x1bd216[_0xc88a('0x38')][_0xc88a('0x53')]()=='STUN'){var _0x36c228=fs[_0xc88a('0x54')](path[_0xc88a('0x55')](config[_0xc88a('0x5a')],'server/files/templates/stun_multiple.ejs'),_0xc88a('0x5e'));var _0x39367e=ejs[_0xc88a('0x56')](_0x36c228,{'networks':_0x1a1d45||[]});fs['writeFileSync'](_0xc88a('0x64'),_0x39367e);return respondWithRpcPromise(_0xc88a('0x58'),_0xc88a('0x30'),{'module':'res_stun_monitor.so'});}else if(_0x1bd216['type']['toUpperCase']()==_0xc88a('0x59')){var _0x2e8925=fs[_0xc88a('0x54')](path[_0xc88a('0x55')](config[_0xc88a('0x5a')],_0xc88a('0x5b')),'utf8');var _0x4ba508=ejs[_0xc88a('0x56')](_0x2e8925,{'networks':_0x1a1d45||[]});fs[_0xc88a('0x57')](_0xc88a('0x5c'),_0x4ba508);return respondWithRpcPromise(_0xc88a('0x58'),'update',{'module':_0xc88a('0x65')});}else{var _0x52af5d=fs[_0xc88a('0x54')](path[_0xc88a('0x55')](config[_0xc88a('0x5a')],_0xc88a('0x5d')),_0xc88a('0x5e'));var _0x29194d=ejs['render'](_0x52af5d,{'networks':_0x1a1d45||[]});fs['writeFileSync'](util['format'](_0xc88a('0x60'),_0x5e2479[_0xc88a('0x52')][_0xc88a('0x38')][_0xc88a('0x61')]()),_0x29194d);return respondWithRpcPromise(_0xc88a('0x58'),_0xc88a('0x30'),{'module':_0xc88a('0x62')});}return null;})[_0xc88a('0x1a')](function(_0x17d529){if(_0x17d529){return _0x1bd216;}return null;});})[_0xc88a('0x1a')](respondWithResult(_0x3aba4a,null))[_0xc88a('0x23')](handleError(_0x3aba4a,null));};exports[_0xc88a('0x31')]=function(_0x5b0a2d,_0x138fd6,_0x41b2c7){var _0x5f426c;return db['Network']['find']({'where':{'id':_0x5b0a2d[_0xc88a('0x4d')]['id']}})['then'](function(_0x854949){_0x5f426c=_0x854949;return _0x854949;})[_0xc88a('0x1a')](handleEntityNotFound(_0x138fd6,null))[_0xc88a('0x1a')](removeEntity(_0x138fd6,null))[_0xc88a('0x1a')](function(){if(_0x5f426c){return db[_0xc88a('0x35')]['findAll']({'where':{'type':_0x5f426c[_0xc88a('0x38')]},'raw':!![]});}})[_0xc88a('0x1a')](function(_0x510cd8){if(_0x5f426c[_0xc88a('0x38')][_0xc88a('0x53')]()==_0xc88a('0x66')){var _0x23603b=fs[_0xc88a('0x54')](path['join'](config[_0xc88a('0x5a')],_0xc88a('0x67')),'utf8');var _0x3c02dd=ejs['render'](_0x23603b,{'networks':_0x510cd8||[]});fs[_0xc88a('0x57')]('/etc/asterisk/stun_xcally.conf',_0x3c02dd);return respondWithRpcPromise(_0xc88a('0x58'),_0xc88a('0x31'),{'module':_0xc88a('0x65')});}else if(_0x5f426c[_0xc88a('0x38')][_0xc88a('0x53')]()==_0xc88a('0x59')){var _0x2d5c54=fs[_0xc88a('0x54')](path[_0xc88a('0x55')](config[_0xc88a('0x5a')],_0xc88a('0x5b')),_0xc88a('0x5e'));var _0x2fb70b=ejs[_0xc88a('0x56')](_0x2d5c54,{'networks':_0x510cd8||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x2fb70b);return respondWithRpcPromise(_0xc88a('0x58'),_0xc88a('0x31'),{'module':'res_stun_monitor.so'});}else{var _0x4f4c92=fs[_0xc88a('0x54')](path['join'](config['root'],_0xc88a('0x5d')),'utf8');var _0xd1e3b0=ejs[_0xc88a('0x56')](_0x4f4c92,{'networks':_0x510cd8||[]});fs[_0xc88a('0x57')](util[_0xc88a('0x5f')]('/etc/asterisk/sip_xcally_%s.conf',_0x5b0a2d['body'][_0xc88a('0x38')]['toLowerCase']()),_0xd1e3b0);return respondWithRpcPromise(_0xc88a('0x58'),_0xc88a('0x31'),{'module':_0xc88a('0x62')});}return null;})['catch'](handleError(_0x138fd6,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 59a5801..ada5623 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 _0xaf93=['bluebird','path','rimraf','../../config/environment','./network.attributes','exports','Network','lodash','util','moment'];(function(_0x608943,_0x4c0dcf){var _0x4d8f8f=function(_0x482b7a){while(--_0x482b7a){_0x608943['push'](_0x608943['shift']());}};_0x4d8f8f(++_0x4c0dcf);}(_0xaf93,0x151));var _0x3af9=function(_0x316923,_0x435111){_0x316923=_0x316923-0x0;var _0x1ce888=_0xaf93[_0x316923];return _0x1ce888;};'use strict';var _=require(_0x3af9('0x0'));var util=require(_0x3af9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3af9('0x2'));var BPromise=require(_0x3af9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3af9('0x4'));var rimraf=require(_0x3af9('0x5'));var config=require(_0x3af9('0x6'));var attributes=require(_0x3af9('0x7'));module[_0x3af9('0x8')]=function(_0x1ad446,_0x333abb){return _0x1ad446['define'](_0x3af9('0x9'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0bb5=['define','Network','network','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','exports'];(function(_0x1d0cba,_0x2731b1){var _0xdc3278=function(_0x3b20f5){while(--_0x3b20f5){_0x1d0cba['push'](_0x1d0cba['shift']());}};_0xdc3278(++_0x2731b1);}(_0x0bb5,0x148));var _0x50bb=function(_0x40a481,_0x3b1512){_0x40a481=_0x40a481-0x0;var _0x1a8b20=_0x0bb5[_0x40a481];return _0x1a8b20;};'use strict';var _=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x50bb('0x2'));var BPromise=require(_0x50bb('0x3'));var rp=require(_0x50bb('0x4'));var fs=require('fs');var path=require(_0x50bb('0x5'));var rimraf=require(_0x50bb('0x6'));var config=require(_0x50bb('0x7'));var attributes=require(_0x50bb('0x8'));module[_0x50bb('0x9')]=function(_0x4e6093,_0x4a105c){return _0x4e6093[_0x50bb('0xa')](_0x50bb('0xb'),attributes,{'tableName':_0x50bb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index ec95f9e..61693bc 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5f1d51,_0x132709){var _0x27e871=function(_0x2bbdfd){while(--_0x2bbdfd){_0x5f1d51['push'](_0x5f1d51['shift']());}};_0x27e871(++_0x132709);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x4e78ac,_0x1179f2){_0x4e78ac=_0x4e78ac-0x0;var _0x63d201=_0x7a54[_0x4e78ac];return _0x63d201;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 57851df..85c9c0c 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 _0x4045=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','/:id/users','getAgents','post','create','addAnswer','/:id/notify','/:id/applications','addApplications','addAgents','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x4045,0x1ac));var _0x5404=function(_0x581181,_0xc683a0){_0x581181=_0x581181-0x0;var _0x1f2025=_0x4045[_0x581181];return _0x1f2025;};'use strict';var multer=require(_0x5404('0x0'));var util=require('util');var path=require(_0x5404('0x1'));var timeout=require(_0x5404('0x2'));var express=require(_0x5404('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5404('0x4'));var interaction=require(_0x5404('0x5'));var config=require(_0x5404('0x6'));var controller=require('./openchannelAccount.controller');router[_0x5404('0x7')]('/',auth['isAuthenticated'](),controller[_0x5404('0x8')]);router[_0x5404('0x7')]('/describe',auth[_0x5404('0x9')](),controller[_0x5404('0xa')]);router[_0x5404('0x7')](_0x5404('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0x5404('0xc'),auth[_0x5404('0x9')](),controller[_0x5404('0xd')]);router[_0x5404('0x7')](_0x5404('0xe'),auth[_0x5404('0x9')](),controller[_0x5404('0xf')]);router[_0x5404('0x7')]('/:id/applications',auth[_0x5404('0x9')](),controller[_0x5404('0x10')]);router[_0x5404('0x7')](_0x5404('0x11'),auth[_0x5404('0x9')](),controller['getInteractions']);router['get'](_0x5404('0x12'),auth[_0x5404('0x9')](),controller[_0x5404('0x13')]);router[_0x5404('0x14')]('/',auth[_0x5404('0x9')](),controller[_0x5404('0x15')]);router[_0x5404('0x14')]('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router[_0x5404('0x14')](_0x5404('0xe'),auth[_0x5404('0x9')](),controller[_0x5404('0x16')]);router['post'](_0x5404('0x17'),controller['notify']);router['post'](_0x5404('0x18'),auth[_0x5404('0x9')](),controller[_0x5404('0x19')]);router[_0x5404('0x14')](_0x5404('0x12'),auth[_0x5404('0x9')](),controller[_0x5404('0x1a')]);router[_0x5404('0x14')]('/:id/send',auth[_0x5404('0x9')](),controller[_0x5404('0x1b')]);router[_0x5404('0x1c')](_0x5404('0xb'),auth['isAuthenticated'](),controller[_0x5404('0x1d')]);router[_0x5404('0x1e')](_0x5404('0xb'),auth['isAuthenticated'](),controller[_0x5404('0x1f')]);router[_0x5404('0x1e')]('/:id/dispositions',auth[_0x5404('0x9')](),controller[_0x5404('0x20')]);router['delete'](_0x5404('0xe'),auth['isAuthenticated'](),controller[_0x5404('0x21')]);router[_0x5404('0x1e')](_0x5404('0x12'),auth[_0x5404('0x9')](),controller[_0x5404('0x22')]);module[_0x5404('0x23')]=router; \ No newline at end of file +var _0xda84=['/:id/interactions','getInteractions','/:id/users','getAgents','post','addDisposition','/:id/notify','notify','/:id/send','send','update','delete','destroy','removeDispositions','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications'];(function(_0x3e0a4e,_0x55117b){var _0x129f2d=function(_0x5e8305){while(--_0x5e8305){_0x3e0a4e['push'](_0x3e0a4e['shift']());}};_0x129f2d(++_0x55117b);}(_0xda84,0xe1));var _0x4da8=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xda84[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x4da8('0x0'));var util=require(_0x4da8('0x1'));var path=require('path');var timeout=require(_0x4da8('0x2'));var express=require('express');var router=express[_0x4da8('0x3')]();var fs_extra=require(_0x4da8('0x4'));var auth=require(_0x4da8('0x5'));var interaction=require(_0x4da8('0x6'));var config=require(_0x4da8('0x7'));var controller=require(_0x4da8('0x8'));router[_0x4da8('0x9')]('/',auth[_0x4da8('0xa')](),controller[_0x4da8('0xb')]);router['get'](_0x4da8('0xc'),auth[_0x4da8('0xa')](),controller['describe']);router[_0x4da8('0x9')](_0x4da8('0xd'),auth['isAuthenticated'](),controller[_0x4da8('0xe')]);router[_0x4da8('0x9')](_0x4da8('0xf'),auth[_0x4da8('0xa')](),controller[_0x4da8('0x10')]);router[_0x4da8('0x9')](_0x4da8('0x11'),auth[_0x4da8('0xa')](),controller['getAnswers']);router[_0x4da8('0x9')](_0x4da8('0x12'),auth[_0x4da8('0xa')](),controller[_0x4da8('0x13')]);router['get'](_0x4da8('0x14'),auth[_0x4da8('0xa')](),controller[_0x4da8('0x15')]);router[_0x4da8('0x9')](_0x4da8('0x16'),auth[_0x4da8('0xa')](),controller[_0x4da8('0x17')]);router[_0x4da8('0x18')]('/',auth[_0x4da8('0xa')](),controller['create']);router[_0x4da8('0x18')](_0x4da8('0xf'),auth['isAuthenticated'](),controller[_0x4da8('0x19')]);router['post']('/:id/canned_answers',auth[_0x4da8('0xa')](),controller['addAnswer']);router['post'](_0x4da8('0x1a'),controller[_0x4da8('0x1b')]);router[_0x4da8('0x18')](_0x4da8('0x12'),auth[_0x4da8('0xa')](),controller['addApplications']);router[_0x4da8('0x18')](_0x4da8('0x16'),auth[_0x4da8('0xa')](),controller['addAgents']);router[_0x4da8('0x18')](_0x4da8('0x1c'),auth[_0x4da8('0xa')](),controller[_0x4da8('0x1d')]);router['put']('/:id',auth[_0x4da8('0xa')](),controller[_0x4da8('0x1e')]);router[_0x4da8('0x1f')](_0x4da8('0xd'),auth[_0x4da8('0xa')](),controller[_0x4da8('0x20')]);router[_0x4da8('0x1f')]('/:id/dispositions',auth[_0x4da8('0xa')](),controller[_0x4da8('0x21')]);router['delete']('/:id/canned_answers',auth[_0x4da8('0xa')](),controller['removeAnswers']);router['delete']('/:id/users',auth[_0x4da8('0xa')](),controller['removeAgents']);module[_0x4da8('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 275a73c..3569160 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 _0xe901=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0xbbc3d8,_0x13c839){var _0x45c0a3=function(_0x40845b){while(--_0x40845b){_0xbbc3d8['push'](_0xbbc3d8['shift']());}};_0x45c0a3(++_0x13c839);}(_0xe901,0x109));var _0x1e90=function(_0x37f5a1,_0x461925){_0x37f5a1=_0x37f5a1-0x0;var _0x3a97a5=_0xe901[_0x37f5a1];return _0x3a97a5;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x1e90('0x0'));module[_0x1e90('0x1')]={'name':{'type':Sequelize[_0x1e90('0x2')],'unique':_0x1e90('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x1e90('0x2')]},'token':{'type':Sequelize[_0x1e90('0x2')],'defaultValue':function(){return rs[_0x1e90('0x4')]();}},'replyUri':{'type':Sequelize[_0x1e90('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x1e90('0x5');}},'notificationSound':{'type':Sequelize[_0x1e90('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x1e90('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1e90('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x1e90('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x1e90('0x6')],'defaultValue':![],'comment':_0x1e90('0x9'),'set':function(_0x1718e1){if(!_0x1718e1)this[_0x1e90('0xa')](_0x1e90('0xb'),null);this['setDataValue'](_0x1e90('0xc'),_0x1718e1);}}}; \ No newline at end of file +var _0x71cb=['generate','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING'];(function(_0x3dd07d,_0x133f23){var _0xc1ff05=function(_0x219aa5){while(--_0x219aa5){_0x3dd07d['push'](_0x3dd07d['shift']());}};_0xc1ff05(++_0x133f23);}(_0x71cb,0x17d));var _0xb71c=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x71cb[_0x2bf141];return _0x48277b;};'use strict';var Sequelize=require(_0xb71c('0x0'));var rs=require(_0xb71c('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xb71c('0x2')]},'token':{'type':Sequelize[_0xb71c('0x2')],'defaultValue':function(){return rs[_0xb71c('0x3')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xb71c('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xb71c('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xb71c('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb71c('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb71c('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xb71c('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb71c('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb71c('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xb71c('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xb71c('0x5')],'defaultValue':![],'comment':_0xb71c('0x8'),'set':function(_0x18700e){if(!_0x18700e)this[_0xb71c('0x9')](_0xb71c('0xa'),null);this[_0xb71c('0x9')](_0xb71c('0xb'),_0x18700e);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 89e2acc..6771363 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 _0xa89b=['list','applications','orderBy','priority','asc','Contacts','defaults','ListId','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','update','interaction','created','push','close','unmanaged','OpenchannelMessage','AttachmentId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','internal','Tag','Tags','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','User','body\x20is\x20mandatory\x20and\x20not\x20empty','out','Messages','dataValues','eml-format','fast-json-patch','moment','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','OpenchannelAccounts','name','send','index','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','include','rows','show','params','Pause','keys','includeAll','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','notify','openchannel','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','isNil','from','Sequelize','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','OpenchannelApplication','Applications','account'];(function(_0x1d4297,_0x3cf1f9){var _0x3ba0c9=function(_0x23685d){while(--_0x23685d){_0x1d4297['push'](_0x1d4297['shift']());}};_0x3ba0c9(++_0x3cf1f9);}(_0xa89b,0x1a5));var _0xba89=function(_0x1e9992,_0x24a7db){_0x1e9992=_0x1e9992-0x0;var _0x4204e2=_0xa89b[_0x1e9992];return _0x4204e2;};'use strict';var emlformat=require(_0xba89('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xba89('0x1'));var rp=require('request-promise');var moment=require(_0xba89('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xba89('0x3'));var path=require(_0xba89('0x4'));var sox=require(_0xba89('0x5'));var csv=require(_0xba89('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xba89('0x7'));var _=require(_0xba89('0x8'));var squel=require(_0xba89('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xba89('0xa'));var toCsv=require(_0xba89('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xba89('0xb'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xba89('0xc'));var logger=require('../../config/logger')('api');var utils=require(_0xba89('0xd'));var config=require('../../config/environment');var licenseUtil=require(_0xba89('0xe'));var db=require('../../mysqldb')['db'];config[_0xba89('0xf')]=_['defaults'](config[_0xba89('0xf')],{'host':_0xba89('0x10'),'port':0x18eb});var socket=require(_0xba89('0x11'))(new Redis(config[_0xba89('0xf')]));require(_0xba89('0x12'))[_0xba89('0x13')](socket);var jayson=require(_0xba89('0x14'));var client=jayson[_0xba89('0x15')]['http']({'port':0x232c});var client9002=jayson[_0xba89('0x15')][_0xba89('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x36839b,_0x2db2c7,_0x1241ad,_0x4321d0){return new BPromise(function(_0x1e5665,_0xc2d646){var _0x2a3adb=_0x4321d0||client;return _0x2a3adb[_0xba89('0x17')](_0x36839b,_0x1241ad)[_0xba89('0x18')](function(_0x32fb40){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x2db2c7,_0xba89('0x19'));logger[_0xba89('0x1a')](_0xba89('0x1b'),_0x2db2c7,_0xba89('0x19'),JSON[_0xba89('0x1c')](_0x32fb40));if(_0x32fb40[_0xba89('0x1d')]){if(_0x32fb40[_0xba89('0x1d')]['code']===0x1f4){logger[_0xba89('0x1d')](_0xba89('0x1e'),_0x2db2c7,_0x32fb40[_0xba89('0x1d')][_0xba89('0x1f')]);return _0xc2d646(_0x32fb40[_0xba89('0x1d')][_0xba89('0x1f')]);}logger[_0xba89('0x1d')](_0xba89('0x1e'),_0x2db2c7,_0x32fb40[_0xba89('0x1d')]['message']);return _0x1e5665(_0x32fb40['error'][_0xba89('0x1f')]);}else{logger['info'](_0xba89('0x1e'),_0x2db2c7,_0xba89('0x19'));_0x1e5665(_0x32fb40[_0xba89('0x20')][_0xba89('0x1f')]);}})[_0xba89('0x21')](function(_0x506bae){logger[_0xba89('0x1d')](_0xba89('0x1e'),_0x2db2c7,_0x506bae);_0xc2d646(_0x506bae);});});}function respondWithStatusCode(_0x3b8c25,_0x5d798f){_0x5d798f=_0x5d798f||0xcc;return function(_0x4b6207){if(_0x4b6207){return _0x3b8c25[_0xba89('0x22')](_0x5d798f);}return _0x3b8c25[_0xba89('0x23')](_0x5d798f)[_0xba89('0x24')]();};}function respondWithResult(_0x25b5e8,_0x5bd930){_0x5bd930=_0x5bd930||0xc8;return function(_0x126fa9){if(_0x126fa9){return _0x25b5e8[_0xba89('0x23')](_0x5bd930)[_0xba89('0x25')](_0x126fa9);}};}function respondWithFilteredResult(_0x3f9ba3,_0x21d615){return function(_0x2efc8e){if(_0x2efc8e){var _0x55d2ea=typeof _0x21d615[_0xba89('0x26')]===_0xba89('0x27')&&typeof _0x21d615[_0xba89('0x28')]===_0xba89('0x27');var _0x36a2ff=_0x2efc8e[_0xba89('0x29')];var _0x40e4e4=_0x55d2ea?0x0:_0x21d615['offset'];var _0x4a5023=_0x55d2ea?_0x2efc8e[_0xba89('0x29')]:_0x21d615[_0xba89('0x26')]+_0x21d615['limit'];var _0x3fecac;if(_0x4a5023>=_0x36a2ff){_0x4a5023=_0x36a2ff;_0x3fecac=0xc8;}else{_0x3fecac=0xce;}_0x3f9ba3[_0xba89('0x23')](_0x3fecac);return _0x3f9ba3['set'](_0xba89('0x2a'),_0x40e4e4+'-'+_0x4a5023+'/'+_0x36a2ff)[_0xba89('0x25')](_0x2efc8e);}return null;};}function patchUpdates(_0x4c60ab){return function(_0x5a172b){try{jsonpatch[_0xba89('0x2b')](_0x5a172b,_0x4c60ab,!![]);}catch(_0x20272e){return BPromise[_0xba89('0x2c')](_0x20272e);}return _0x5a172b[_0xba89('0x2d')]();};}function saveUpdates(_0x5b1e7a,_0x477ce6){return function(_0x1bc7cd){if(_0x1bc7cd){return _0x1bc7cd['update'](_0x5b1e7a)['then'](function(_0x5e3981){return _0x5e3981;});}return null;};}function removeEntity(_0x29a9fa,_0x3cfca2){return function(_0x3a2f85){if(_0x3a2f85){return _0x3a2f85[_0xba89('0x2e')]()[_0xba89('0x18')](function(){var _0x5c7e5e=_0x3a2f85['get']({'plain':!![]});var _0x3e2519=_0xba89('0x2f');return db['UserProfileResource'][_0xba89('0x2e')]({'where':{'type':_0x3e2519,'resourceId':_0x5c7e5e['id']}})[_0xba89('0x18')](function(){return _0x3a2f85;});})['then'](function(){_0x29a9fa[_0xba89('0x23')](0xcc)[_0xba89('0x24')]();});}};}function handleEntityNotFound(_0x5e4f47,_0x45eee3){return function(_0xc85121){if(!_0xc85121){_0x5e4f47[_0xba89('0x22')](0x194);}return _0xc85121;};}function handleError(_0x1fe4fa,_0x336beb){_0x336beb=_0x336beb||0x1f4;return function(_0x53ab37){logger[_0xba89('0x1d')](_0x53ab37['stack']);if(_0x53ab37[_0xba89('0x30')]){delete _0x53ab37[_0xba89('0x30')];}_0x1fe4fa['status'](_0x336beb)[_0xba89('0x31')](_0x53ab37);};}exports[_0xba89('0x32')]=function(_0x276450,_0x211143){var _0x103b9d={'include':[{'model':db['Pause'],'as':_0xba89('0x33')}]},_0x324bb4={},_0x368ab0={'count':0x0,'rows':[]};var _0x4a4f21=_[_0xba89('0x34')](db[_0xba89('0x35')][_0xba89('0x36')],function(_0x597404){return{'name':_0x597404['fieldName'],'type':_0x597404['type']['key']};});_0x324bb4[_0xba89('0x37')]=_['map'](_0x4a4f21,'name');_0x324bb4[_0xba89('0x38')]=_['keys'](_0x276450[_0xba89('0x38')]);_0x324bb4[_0xba89('0x39')]=_['intersection'](_0x324bb4['model'],_0x324bb4['query']);_0x103b9d[_0xba89('0x3a')]=_[_0xba89('0x3b')](_0x324bb4['model'],qs['fields'](_0x276450[_0xba89('0x38')][_0xba89('0x3c')]));_0x103b9d[_0xba89('0x3a')]=_0x103b9d[_0xba89('0x3a')][_0xba89('0x3d')]?_0x103b9d['attributes']:_0x324bb4[_0xba89('0x37')];if(!_0x276450[_0xba89('0x38')][_0xba89('0x3e')](_0xba89('0x3f'))){_0x103b9d[_0xba89('0x28')]=qs[_0xba89('0x28')](_0x276450['query']['limit']);_0x103b9d[_0xba89('0x26')]=qs[_0xba89('0x26')](_0x276450[_0xba89('0x38')][_0xba89('0x26')]);}_0x103b9d[_0xba89('0x40')]=qs['sort'](_0x276450['query'][_0xba89('0x41')]);_0x103b9d[_0xba89('0x42')]=qs['filters'](_[_0xba89('0x43')](_0x276450[_0xba89('0x38')],_0x324bb4[_0xba89('0x39')]),_0x4a4f21);if(_0x276450[_0xba89('0x38')][_0xba89('0x44')]){_0x103b9d['where']=_['merge'](_0x103b9d['where'],{'$or':_[_0xba89('0x34')](_0x4a4f21,function(_0x133f42){if(_0x133f42[_0xba89('0x45')]!==_0xba89('0x46')){var _0x14e7e3={};_0x14e7e3[_0x133f42[_0xba89('0x30')]]={'$like':'%'+_0x276450[_0xba89('0x38')][_0xba89('0x44')]+'%'};return _0x14e7e3;}})});}_0x103b9d=_[_0xba89('0x47')]({},_0x103b9d,_0x276450['options']);var _0xcc1ca9={'where':_0x103b9d[_0xba89('0x42')]};return db[_0xba89('0x35')][_0xba89('0x29')](_0xcc1ca9)[_0xba89('0x18')](function(_0x404ea9){_0x368ab0[_0xba89('0x29')]=_0x404ea9;if(_0x276450[_0xba89('0x38')]['includeAll']){_0x103b9d[_0xba89('0x48')]=[{'all':!![]}];}return db[_0xba89('0x35')]['findAll'](_0x103b9d);})[_0xba89('0x18')](function(_0x17a419){_0x368ab0[_0xba89('0x49')]=_0x17a419;return _0x368ab0;})[_0xba89('0x18')](respondWithFilteredResult(_0x211143,_0x103b9d))[_0xba89('0x21')](handleError(_0x211143,null));};exports[_0xba89('0x4a')]=function(_0x12ea1b,_0xcf1a1a){var _0x1c77e0={'raw':![],'where':{'id':_0x12ea1b[_0xba89('0x4b')]['id']},'include':[{'model':db[_0xba89('0x4c')],'as':'mandatoryDispositionPause'}]},_0x535744={};_0x535744[_0xba89('0x37')]=_[_0xba89('0x4d')](db[_0xba89('0x35')]['rawAttributes']);_0x535744[_0xba89('0x38')]=_[_0xba89('0x4d')](_0x12ea1b[_0xba89('0x38')]);_0x535744['filters']=_[_0xba89('0x3b')](_0x535744[_0xba89('0x37')],_0x535744[_0xba89('0x38')]);_0x1c77e0[_0xba89('0x3a')]=_[_0xba89('0x3b')](_0x535744[_0xba89('0x37')],qs['fields'](_0x12ea1b[_0xba89('0x38')][_0xba89('0x3c')]));_0x1c77e0['attributes']=_0x1c77e0[_0xba89('0x3a')][_0xba89('0x3d')]?_0x1c77e0['attributes']:_0x535744[_0xba89('0x37')];if(_0x12ea1b[_0xba89('0x38')][_0xba89('0x4e')]){_0x1c77e0[_0xba89('0x48')]=[{'all':!![]}];}_0x1c77e0=_[_0xba89('0x47')]({},_0x1c77e0,_0x12ea1b[_0xba89('0x4f')]);return db['OpenchannelAccount'][_0xba89('0x50')](_0x1c77e0)[_0xba89('0x18')](handleEntityNotFound(_0xcf1a1a,null))[_0xba89('0x18')](respondWithResult(_0xcf1a1a,null))['catch'](handleError(_0xcf1a1a,null));};exports['create']=function(_0x4caeb4,_0x492b21){return db[_0xba89('0x35')][_0xba89('0x51')](_0x4caeb4['body'],{})[_0xba89('0x18')](function(_0x135264){var _0x49fbf6=_0x4caeb4[_0xba89('0x52')][_0xba89('0x53')]({'plain':!![]});if(!_0x49fbf6)throw new Error(_0xba89('0x54'));if(_0x49fbf6[_0xba89('0x55')]===_0xba89('0x52')){var _0xaac0d7=_0x135264['get']({'plain':!![]});var _0x1059fa=_0xba89('0x2f');return db['UserProfileSection'][_0xba89('0x50')]({'where':{'name':_0x1059fa,'userProfileId':_0x49fbf6[_0xba89('0x56')]},'raw':!![]})[_0xba89('0x18')](function(_0x1d0e9f){if(_0x1d0e9f&&_0x1d0e9f['autoAssociation']===0x0){return db[_0xba89('0x57')][_0xba89('0x51')]({'name':_0xaac0d7['name'],'resourceId':_0xaac0d7['id'],'type':_0x1d0e9f[_0xba89('0x30')],'sectionId':_0x1d0e9f['id']},{})['then'](function(){return _0x135264;});}else{return _0x135264;}})[_0xba89('0x21')](function(_0x145388){logger[_0xba89('0x1d')](_0xba89('0x58'),_0x145388);throw _0x145388;});}return _0x135264;})['then'](respondWithResult(_0x492b21,0xc9))[_0xba89('0x21')](handleError(_0x492b21,null));};exports['update']=function(_0x2e858d,_0x37d28e){if(_0x2e858d[_0xba89('0x59')]['id']){delete _0x2e858d['body']['id'];}return db['OpenchannelAccount'][_0xba89('0x50')]({'where':{'id':_0x2e858d['params']['id']},'include':[{'model':db[_0xba89('0x4c')],'as':_0xba89('0x33')}]})[_0xba89('0x18')](handleEntityNotFound(_0x37d28e,null))[_0xba89('0x18')](saveUpdates(_0x2e858d[_0xba89('0x59')],null))[_0xba89('0x18')](respondWithResult(_0x37d28e,null))['catch'](handleError(_0x37d28e,null));};exports[_0xba89('0x2e')]=function(_0x476e25,_0x28be00){return db[_0xba89('0x35')][_0xba89('0x50')]({'where':{'id':_0x476e25['params']['id']}})[_0xba89('0x18')](handleEntityNotFound(_0x28be00,null))['then'](removeEntity(_0x28be00,null))[_0xba89('0x21')](handleError(_0x28be00,null));};exports[_0xba89('0x5a')]=function(_0x133f24,_0x31f746){return db['OpenchannelAccount']['describe']()[_0xba89('0x18')](respondWithResult(_0x31f746,null))['catch'](handleError(_0x31f746,null));};exports['addDisposition']=function(_0x7522a2,_0x146893,_0x539833){if(_0x7522a2[_0xba89('0x59')]['id']){delete _0x7522a2[_0xba89('0x59')]['id'];}return db[_0xba89('0x35')][_0xba89('0x50')]({'where':{'id':_0x7522a2[_0xba89('0x4b')]['id']}})[_0xba89('0x18')](handleEntityNotFound(_0x146893,null))['then'](function(_0x45f071){if(_0x45f071){_0x7522a2['body'][_0xba89('0x5b')]=_0x45f071['id'];return db[_0xba89('0x5c')][_0xba89('0x51')](_0x7522a2[_0xba89('0x59')]);}})[_0xba89('0x18')](respondWithResult(_0x146893,null))[_0xba89('0x21')](handleError(_0x146893,null));};exports[_0xba89('0x5d')]=function(_0x2b01f9,_0x3df629,_0x54ccbb){var _0x1b1340={'raw':![],'where':{}};var _0x4771d8={};var _0x109057={'count':0x0,'rows':[]};return db[_0xba89('0x35')][_0xba89('0x5e')]({'where':{'id':_0x2b01f9[_0xba89('0x4b')]['id']}})[_0xba89('0x18')](handleEntityNotFound(_0x3df629,null))['then'](function(_0x3c2cd4){if(_0x3c2cd4){_0x4771d8[_0xba89('0x37')]=_['keys'](db['Disposition'][_0xba89('0x36')]);_0x4771d8['query']=_[_0xba89('0x4d')](_0x2b01f9[_0xba89('0x38')]);_0x4771d8[_0xba89('0x39')]=_[_0xba89('0x3b')](_0x4771d8['model'],_0x4771d8['query']);_0x1b1340[_0xba89('0x3a')]=_[_0xba89('0x3b')](_0x4771d8[_0xba89('0x37')],qs[_0xba89('0x3c')](_0x2b01f9[_0xba89('0x38')][_0xba89('0x3c')]));_0x1b1340[_0xba89('0x3a')]=_0x1b1340[_0xba89('0x3a')][_0xba89('0x3d')]?_0x1b1340[_0xba89('0x3a')]:_0x4771d8[_0xba89('0x37')];if(!_0x2b01f9[_0xba89('0x38')][_0xba89('0x3e')](_0xba89('0x3f'))){_0x1b1340[_0xba89('0x28')]=qs['limit'](_0x2b01f9[_0xba89('0x38')][_0xba89('0x28')]);_0x1b1340[_0xba89('0x26')]=qs[_0xba89('0x26')](_0x2b01f9[_0xba89('0x38')][_0xba89('0x26')]);}_0x1b1340['order']=qs[_0xba89('0x41')](_0x2b01f9[_0xba89('0x38')][_0xba89('0x41')]);_0x1b1340[_0xba89('0x42')]=qs['filters'](_[_0xba89('0x43')](_0x2b01f9['query'],_0x4771d8[_0xba89('0x39')]));_0x1b1340[_0xba89('0x42')][_0xba89('0x5b')]=_0x3c2cd4['id'];if(_0x2b01f9[_0xba89('0x38')][_0xba89('0x44')]){_0x1b1340[_0xba89('0x42')]=_[_0xba89('0x47')](_0x1b1340[_0xba89('0x42')],{'$or':_[_0xba89('0x34')](_0x1b1340[_0xba89('0x3a')],function(_0x55a970){var _0x176390={};_0x176390[_0x55a970]={'$like':'%'+_0x2b01f9['query'][_0xba89('0x44')]+'%'};return _0x176390;})});}_0x1b1340=_['merge']({},_0x1b1340,_0x2b01f9[_0xba89('0x4f')]);return db['Disposition'][_0xba89('0x29')]({'where':_0x1b1340[_0xba89('0x42')]})[_0xba89('0x18')](function(_0x423523){_0x109057['count']=_0x423523;if(_0x2b01f9[_0xba89('0x38')][_0xba89('0x4e')]){_0x1b1340[_0xba89('0x48')]=[{'all':!![]}];}return db[_0xba89('0x5c')][_0xba89('0x5f')](_0x1b1340);})[_0xba89('0x18')](function(_0x4f3934){_0x109057[_0xba89('0x49')]=_0x4f3934;return _0x109057;});}})[_0xba89('0x18')](respondWithFilteredResult(_0x3df629,_0x1b1340))['catch'](handleError(_0x3df629,null));};exports['removeDispositions']=function(_0xe2b812,_0x29c09d,_0x27cd94){return db['OpenchannelAccount'][_0xba89('0x50')]({'where':{'id':_0xe2b812[_0xba89('0x4b')]['id']}})['then'](handleEntityNotFound(_0x29c09d,null))[_0xba89('0x18')](function(_0x16a95d){if(_0x16a95d){return _0x16a95d[_0xba89('0x60')](_0xe2b812[_0xba89('0x38')]['ids']);}})[_0xba89('0x18')](respondWithStatusCode(_0x29c09d,null))[_0xba89('0x21')](handleError(_0x29c09d,null));};exports[_0xba89('0x61')]=function(_0x2038ba,_0x566e21,_0x1ac052){if(_0x2038ba[_0xba89('0x59')]['id']){delete _0x2038ba[_0xba89('0x59')]['id'];}return db[_0xba89('0x35')][_0xba89('0x50')]({'where':{'id':_0x2038ba['params']['id']}})[_0xba89('0x18')](handleEntityNotFound(_0x566e21,null))['then'](function(_0x408da0){if(_0x408da0){_0x2038ba[_0xba89('0x59')][_0xba89('0x5b')]=_0x408da0['id'];return db[_0xba89('0x62')][_0xba89('0x51')](_0x2038ba[_0xba89('0x59')]);}})[_0xba89('0x18')](respondWithResult(_0x566e21,null))[_0xba89('0x21')](handleError(_0x566e21,null));};exports[_0xba89('0x63')]=function(_0xa4da4c,_0x69911b,_0x56e7d3){var _0x2b6ba7={'raw':![],'where':{}};var _0xc21a55={};var _0xe34166={'count':0x0,'rows':[]};return db[_0xba89('0x35')][_0xba89('0x5e')]({'where':{'id':_0xa4da4c[_0xba89('0x4b')]['id']}})[_0xba89('0x18')](handleEntityNotFound(_0x69911b,null))[_0xba89('0x18')](function(_0x2b4003){if(_0x2b4003){_0xc21a55[_0xba89('0x37')]=_['keys'](db['CannedAnswer']['rawAttributes']);_0xc21a55[_0xba89('0x38')]=_[_0xba89('0x4d')](_0xa4da4c[_0xba89('0x38')]);_0xc21a55[_0xba89('0x39')]=_[_0xba89('0x3b')](_0xc21a55[_0xba89('0x37')],_0xc21a55[_0xba89('0x38')]);_0x2b6ba7['attributes']=_[_0xba89('0x3b')](_0xc21a55[_0xba89('0x37')],qs[_0xba89('0x3c')](_0xa4da4c[_0xba89('0x38')][_0xba89('0x3c')]));_0x2b6ba7['attributes']=_0x2b6ba7['attributes'][_0xba89('0x3d')]?_0x2b6ba7['attributes']:_0xc21a55[_0xba89('0x37')];if(!_0xa4da4c[_0xba89('0x38')][_0xba89('0x3e')](_0xba89('0x3f'))){_0x2b6ba7[_0xba89('0x28')]=qs[_0xba89('0x28')](_0xa4da4c[_0xba89('0x38')][_0xba89('0x28')]);_0x2b6ba7['offset']=qs['offset'](_0xa4da4c[_0xba89('0x38')]['offset']);}_0x2b6ba7['order']=qs['sort'](_0xa4da4c[_0xba89('0x38')][_0xba89('0x41')]);_0x2b6ba7[_0xba89('0x42')]=qs['filters'](_[_0xba89('0x43')](_0xa4da4c[_0xba89('0x38')],_0xc21a55['filters']));_0x2b6ba7[_0xba89('0x42')][_0xba89('0x5b')]=_0x2b4003['id'];if(_0xa4da4c[_0xba89('0x38')][_0xba89('0x44')]){_0x2b6ba7[_0xba89('0x42')]=_[_0xba89('0x47')](_0x2b6ba7[_0xba89('0x42')],{'$or':_[_0xba89('0x34')](_0x2b6ba7[_0xba89('0x3a')],function(_0x3d8b2e){var _0x1d47cd={};_0x1d47cd[_0x3d8b2e]={'$like':'%'+_0xa4da4c[_0xba89('0x38')][_0xba89('0x44')]+'%'};return _0x1d47cd;})});}_0x2b6ba7=_['merge']({},_0x2b6ba7,_0xa4da4c[_0xba89('0x4f')]);return db[_0xba89('0x62')]['count']({'where':_0x2b6ba7[_0xba89('0x42')]})[_0xba89('0x18')](function(_0x235b65){_0xe34166[_0xba89('0x29')]=_0x235b65;if(_0xa4da4c[_0xba89('0x38')]['includeAll']){_0x2b6ba7[_0xba89('0x48')]=[{'all':!![]}];}return db[_0xba89('0x62')][_0xba89('0x5f')](_0x2b6ba7);})[_0xba89('0x18')](function(_0x157b77){_0xe34166['rows']=_0x157b77;return _0xe34166;});}})['then'](respondWithFilteredResult(_0x69911b,_0x2b6ba7))[_0xba89('0x21')](handleError(_0x69911b,null));};exports[_0xba89('0x64')]=function(_0x53f96a,_0x21ad0b,_0x1f997d){return db[_0xba89('0x35')][_0xba89('0x50')]({'where':{'id':_0x53f96a[_0xba89('0x4b')]['id']}})[_0xba89('0x18')](handleEntityNotFound(_0x21ad0b,null))['then'](function(_0x33c838){if(_0x33c838){return _0x33c838['removeAnswers'](_0x53f96a['query'][_0xba89('0x65')]);}})['then'](respondWithStatusCode(_0x21ad0b,null))[_0xba89('0x21')](handleError(_0x21ad0b,null));};exports[_0xba89('0x66')]=function(_0x3df58c,_0x17f31e,_0x3fc28d){var _0x4cd7af={'body':_0x3df58c[_0xba89('0x59')],'channel':_0xba89('0x67')};var _0x1ea595=[];var _0x45b7f1=[];var _0x27c6bb={};var _0x19b318=![];return db[_0xba89('0x68')][_0xba89('0x5a')]()[_0xba89('0x18')](function(_0x428327){if(!_0x428327){throw new db['Sequelize'][(_0xba89('0x69'))](_0xba89('0x6a'));}_0x1ea595=_[_0xba89('0x6b')](_[_0xba89('0x4d')](_0x428327),[_0xba89('0x6c'),_0xba89('0x6d')]);_0x45b7f1=_['difference'](_[_0xba89('0x4d')](_0x428327),[_0xba89('0x6c'),_0xba89('0x6d'),_0xba89('0x6e'),'ListId']);if(_0x3df58c[_0xba89('0x59')]['id']){delete _0x3df58c[_0xba89('0x59')]['id'];}if(_[_0xba89('0x6f')](_0x3df58c[_0xba89('0x59')][_0xba89('0x70')])){throw new db[(_0xba89('0x71'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0xba89('0x6f')](_0x3df58c[_0xba89('0x59')][_0xba89('0x59')])||_0x3df58c[_0xba89('0x59')][_0xba89('0x59')]===''){throw new db[(_0xba89('0x71'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xba89('0x6f')](_0x3df58c[_0xba89('0x59')][_0xba89('0x72')])){throw new db[(_0xba89('0x71'))][(_0xba89('0x69'))](_0xba89('0x73')+_0x45b7f1);}if(!_['includes'](_0x45b7f1,_0x3df58c[_0xba89('0x59')][_0xba89('0x72')])){throw new db[(_0xba89('0x71'))][(_0xba89('0x69'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x45b7f1);}_0x27c6bb[_0x3df58c[_0xba89('0x59')][_0xba89('0x72')]]=_0x3df58c['body'][_0xba89('0x70')];})[_0xba89('0x18')](function(){return db['OpenchannelAccount'][_0xba89('0x50')]({'where':{'id':_0x3df58c[_0xba89('0x4b')]['id']},'include':[{'model':db[_0xba89('0x74')],'as':_0xba89('0x75'),'include':[{'model':db[_0xba89('0x68')],'as':'Contacts','where':_0x27c6bb,'limit':0x1,'order':[[_0xba89('0x6d'),_0xba89('0x76')]]}]},{'model':db[_0xba89('0x77')],'as':_0xba89('0x78')}]});})[_0xba89('0x18')](handleEntityNotFound(_0x17f31e,null))[_0xba89('0x18')](function(_0x55917e){if(_0x55917e&&_0x55917e[_0xba89('0x75')]){_0x4cd7af[_0xba89('0x79')]=_0x55917e;_0x4cd7af['applications']=_0x55917e['Applications'];_0x4cd7af[_0xba89('0x7a')]=_0x55917e[_0xba89('0x75')];_0x4cd7af[_0xba89('0x7b')]=_[_0xba89('0x7c')](_0x4cd7af[_0xba89('0x7b')],[_0xba89('0x7d')],[_0xba89('0x7e')]);if(_0x4cd7af['account'][_0xba89('0x78')]){delete _0x4cd7af[_0xba89('0x79')][_0xba89('0x78')];}if(_0x4cd7af[_0xba89('0x79')]['List']&&_0x4cd7af[_0xba89('0x79')][_0xba89('0x75')][_0xba89('0x7f')][_0xba89('0x3d')]){return _0x4cd7af[_0xba89('0x79')][_0xba89('0x75')][_0xba89('0x7f')][0x0];}var _0x3b4fec=_[_0xba89('0x80')](_0x3df58c[_0xba89('0x59')],{'firstName':_0x3df58c['body'][_0xba89('0x70')],'ListId':_0x55917e[_0xba89('0x81')]});_0x3b4fec[_0x3df58c[_0xba89('0x59')][_0xba89('0x72')]]=_0x3df58c[_0xba89('0x59')]['from'];return db[_0xba89('0x68')]['create'](_0x3b4fec,{'fields':_0x1ea595,'raw':!![]});}})[_0xba89('0x18')](handleEntityNotFound(_0x17f31e,null))[_0xba89('0x18')](function(_0x197b01){_0x4cd7af[_0xba89('0x82')]=_0x197b01;if(_0x197b01){var _0x4bbf71={'ContactId':_0x197b01['id'],'OpenchannelAccountId':_0x3df58c[_0xba89('0x4b')]['id'],'from':(_0x197b01[_0xba89('0x83')]||'')+'\x20'+(_0x197b01[_0xba89('0x84')]||'')};var _0x5964cf={'OpenchannelAccountId':_0x3df58c[_0xba89('0x4b')]['id'],'closed':![]};if(_0x3df58c[_0xba89('0x59')][_0xba89('0x85')]){_0x5964cf[_0xba89('0x85')]=_0x3df58c['body'][_0xba89('0x85')];return db[_0xba89('0x86')][_0xba89('0x50')]({'where':_0x5964cf})[_0xba89('0x18')](function(_0x1edc0b){if(_0x1edc0b){return[_0x1edc0b,![]];}_0x4bbf71['threadId']=_0x3df58c[_0xba89('0x59')][_0xba89('0x85')];_0x4bbf71[_0xba89('0x87')]=_0x3df58c[_0xba89('0x59')][_0xba89('0x87')];return db[_0xba89('0x86')][_0xba89('0x51')](_0x4bbf71)['then'](function(_0x2b1640){return[_0x2b1640,!![]];});});}else{_0x5964cf[_0xba89('0x85')]=null;}_0x5964cf[_0xba89('0x88')]=_0x197b01['id'];return db[_0xba89('0x86')]['find']({'where':_0x5964cf})['then'](function(_0x234c7a){if(_0x234c7a){return[_0x234c7a,![]];}return db[_0xba89('0x86')][_0xba89('0x51')](_0x4bbf71)[_0xba89('0x18')](function(_0x470232){return[_0x470232,!![]];});});}})[_0xba89('0x89')](function(_0x4f79e1,_0x252311){if(_0x4f79e1){_0x19b318=_0x252311;if(!_0x252311){var _0x221d5b={'from':(_0x4cd7af[_0xba89('0x82')][_0xba89('0x83')]||'')+'\x20'+(_0x4cd7af['contact'][_0xba89('0x84')]||'')};if(_0x3df58c[_0xba89('0x59')]['threadId']&&_0x3df58c[_0xba89('0x59')]['messageId']&&_0x3df58c[_0xba89('0x59')][_0xba89('0x85')]!=_0x3df58c[_0xba89('0x59')][_0xba89('0x8a')]){_0x221d5b[_0xba89('0x85')]=_0x3df58c[_0xba89('0x59')][_0xba89('0x8a')];}return _0x4f79e1[_0xba89('0x8b')](_0x221d5b);}else{return _0x4f79e1;}}})[_0xba89('0x18')](function(_0x46c45b){_0x4cd7af['interaction']=_0x46c45b['get']({'plain':!![]});_0x4cd7af[_0xba89('0x8c')]['created']=_0x19b318;if(_0x4cd7af[_0xba89('0x8c')][_0xba89('0x8d')]){if(_0x4cd7af[_0xba89('0x79')]['autoclose']){_0x4cd7af[_0xba89('0x7b')][_0xba89('0x8e')]({'id':0x0,'priority':_0x4cd7af['applications']['length']+0x1,'app':_0xba89('0x8f'),'appdata':_0xba89('0x90'),'interval':'*,*,*,*'});}}return db[_0xba89('0x91')]['create']({'body':_0x3df58c[_0xba89('0x59')][_0xba89('0x59')],'OpenchannelAccountId':_0x3df58c['params']['id'],'OpenchannelInteractionId':_0x46c45b['id'],'direction':'in','ContactId':_0x4cd7af['contact']['id'],'AttachmentId':_0x3df58c[_0xba89('0x59')][_0xba89('0x92')]});})['then'](function(_0x19fe05){_0x4cd7af['message']=_0x19fe05;if(_0x4cd7af[_0xba89('0x8c')]['UserId']){return db['User'][_0xba89('0x50')]({'attributes':['id',_0xba89('0x30')],'where':{'id':_0x4cd7af[_0xba89('0x8c')]['UserId']}})['then'](function(_0x86be8f){if(_0x86be8f){_0x4cd7af[_0xba89('0x7b')][_0xba89('0x93')]({'id':0x0,'priority':0x0,'app':_0xba89('0x94'),'appdata':_0x86be8f[_0xba89('0x30')]+','+(_0x4cd7af[_0xba89('0x79')][_0xba89('0x95')]||0xa),'interval':_0xba89('0x96')});_0x4cd7af[_0xba89('0x97')]=![];}return respondWithRpcPromise(_0xba89('0x98'),_0xba89('0x99'),_0x4cd7af);});}return respondWithRpcPromise(_0xba89('0x98'),_0xba89('0x99'),_0x4cd7af);})[_0xba89('0x18')](function(_0x1e16b2){respondWithRpcPromise(_0xba89('0x9a'),_0xba89('0x9a'),{'event':_0xba89('0x66'),'message':_0x1e16b2},client9002);return _0x1e16b2;})[_0xba89('0x18')](respondWithResult(_0x17f31e,null))['catch'](handleError(_0x17f31e,null));};exports[_0xba89('0x9b')]=function(_0x4c20b6,_0x24c787,_0x31a397){return db['OpenchannelAccount']['findOne']({'where':{'id':_0x4c20b6[_0xba89('0x4b')]['id']}})[_0xba89('0x18')](handleEntityNotFound(_0x24c787,null))[_0xba89('0x18')](function(_0x2efd0e){if(_0x2efd0e){return db[_0xba89('0x9c')][_0xba89('0x9d')](function(_0x81ec9b){return db[_0xba89('0x77')][_0xba89('0x2e')]({'where':{'OpenchannelAccountId':_0x4c20b6[_0xba89('0x4b')]['id']},'transaction':_0x81ec9b})[_0xba89('0x18')](function(_0x24087a){var _0x526da7=_[_0xba89('0x34')](_0x4c20b6[_0xba89('0x59')],function(_0x50df32){_0x50df32[_0xba89('0x5b')]=_0x4c20b6[_0xba89('0x4b')]['id'];return _0x50df32;});return db[_0xba89('0x77')][_0xba89('0x9e')](_0x526da7,{'transaction':_0x81ec9b});});})[_0xba89('0x18')](function(){return db[_0xba89('0x77')][_0xba89('0x9f')]({'where':{'OpenchannelAccountId':_0x4c20b6[_0xba89('0x4b')]['id']},'order':'priority'});});}})[_0xba89('0x18')](respondWithResult(_0x24c787,null))[_0xba89('0x21')](handleError(_0x24c787,null));};exports[_0xba89('0xa0')]=function(_0x51a825,_0x4487ee,_0x59b4f3){var _0x42e5af={};var _0x36d13f={};var _0x320b33;var _0x4e73b5;return db['OpenchannelAccount'][_0xba89('0x5e')]({'where':{'id':_0x51a825['params']['id']}})[_0xba89('0x18')](handleEntityNotFound(_0x4487ee,null))[_0xba89('0x18')](function(_0x5a103e){if(_0x5a103e){_0x320b33=_0x5a103e;_0x36d13f[_0xba89('0x37')]=_['keys'](db[_0xba89('0x77')]['rawAttributes']);_0x36d13f[_0xba89('0x38')]=_['keys'](_0x51a825[_0xba89('0x38')]);_0x36d13f[_0xba89('0x39')]=_[_0xba89('0x3b')](_0x36d13f['model'],_0x36d13f['query']);_0x42e5af['attributes']=_[_0xba89('0x3b')](_0x36d13f[_0xba89('0x37')],qs['fields'](_0x51a825['query']['fields']));_0x42e5af['attributes']=_0x42e5af[_0xba89('0x3a')][_0xba89('0x3d')]?_0x42e5af['attributes']:_0x36d13f[_0xba89('0x37')];_0x42e5af['order']=qs[_0xba89('0x41')](_0x51a825[_0xba89('0x38')][_0xba89('0x41')]);_0x42e5af['where']=qs[_0xba89('0x39')](_['pick'](_0x51a825[_0xba89('0x38')],_0x36d13f[_0xba89('0x39')]));if(_0x51a825[_0xba89('0x38')][_0xba89('0x44')]){_0x42e5af[_0xba89('0x42')]=_[_0xba89('0x47')](_0x42e5af['where'],{'$or':_['map'](_0x42e5af['attributes'],function(_0x5cf386){var _0x53308a={};_0x53308a[_0x5cf386]={'$like':'%'+_0x51a825['query'][_0xba89('0x44')]+'%'};return _0x53308a;})});}_0x42e5af=_[_0xba89('0x47')]({},_0x42e5af,_0x51a825['options']);return _0x320b33[_0xba89('0xa0')](_0x42e5af);}})['then'](function(_0xe4d5d2){if(_0xe4d5d2){_0x4e73b5=_0xe4d5d2[_0xba89('0x3d')];if(!_0x51a825[_0xba89('0x38')][_0xba89('0x3e')]('nolimit')){_0x42e5af[_0xba89('0x28')]=qs[_0xba89('0x28')](_0x51a825[_0xba89('0x38')][_0xba89('0x28')]);_0x42e5af['offset']=qs[_0xba89('0x26')](_0x51a825[_0xba89('0x38')]['offset']);}return _0x320b33['getApplications'](_0x42e5af);}})[_0xba89('0x18')](function(_0x24a123){if(_0x24a123){return _0x24a123?{'count':_0x4e73b5,'rows':_0x24a123}:null;}})[_0xba89('0x18')](respondWithResult(_0x4487ee,null))[_0xba89('0x21')](handleError(_0x4487ee,null));};exports[_0xba89('0xa1')]=function(_0xd6871e,_0x1055ac,_0x6e60f9){var _0x20dad1={'raw':![],'where':{}};var _0x4d126d={};var _0x12709b={'count':0x0,'rows':[]};return db[_0xba89('0x35')][_0xba89('0x5e')]({'where':{'id':_0xd6871e[_0xba89('0x4b')]['id']}})[_0xba89('0x18')](handleEntityNotFound(_0x1055ac,null))['then'](function(_0x4dcec5){if(_0x4dcec5){_0x4d126d[_0xba89('0x37')]=_[_0xba89('0x4d')](db[_0xba89('0x86')][_0xba89('0x36')]);_0x4d126d[_0xba89('0x38')]=_[_0xba89('0x4d')](_0xd6871e[_0xba89('0x38')]);_0x4d126d[_0xba89('0x39')]=_['intersection'](_0x4d126d['model'],_0x4d126d[_0xba89('0x38')]);_0x20dad1[_0xba89('0x3a')]=_['intersection'](_0x4d126d['model'],qs[_0xba89('0x3c')](_0xd6871e[_0xba89('0x38')][_0xba89('0x3c')]));_0x20dad1[_0xba89('0x3a')]=_0x20dad1[_0xba89('0x3a')][_0xba89('0x3d')]?_0x20dad1['attributes']:_0x4d126d[_0xba89('0x37')];if(!_0xd6871e['query'][_0xba89('0x3e')](_0xba89('0x3f'))){_0x20dad1[_0xba89('0x28')]=qs[_0xba89('0x28')](_0xd6871e['query']['limit']);_0x20dad1[_0xba89('0x26')]=qs[_0xba89('0x26')](_0xd6871e[_0xba89('0x38')][_0xba89('0x26')]);}_0x20dad1[_0xba89('0x40')]=qs[_0xba89('0x41')](_0xd6871e[_0xba89('0x38')][_0xba89('0x41')]);_0x20dad1[_0xba89('0x42')]=qs['filters'](_[_0xba89('0x43')](_0xd6871e['query'],_0x4d126d[_0xba89('0x39')]));_0x20dad1[_0xba89('0x42')]['OpenchannelAccountId']=_0x4dcec5['id'];if(_0xd6871e[_0xba89('0x38')][_0xba89('0x44')]){_0x20dad1[_0xba89('0x42')]=_[_0xba89('0x47')](_0x20dad1['where'],{'$or':_[_0xba89('0x34')](_0x20dad1[_0xba89('0x3a')],function(_0x84e112){var _0x560950={};_0x560950[_0x84e112]={'$like':'%'+_0xd6871e[_0xba89('0x38')][_0xba89('0x44')]+'%'};return _0x560950;})});}_0x20dad1=_[_0xba89('0x47')]({},_0x20dad1,_0xd6871e[_0xba89('0x4f')]);return db[_0xba89('0x86')]['count']({'where':_0x20dad1['where']})[_0xba89('0x18')](function(_0x533e8c){_0x12709b[_0xba89('0x29')]=_0x533e8c;if(_0xd6871e['query']['includeAll']){_0x20dad1[_0xba89('0x48')]=[{'model':db[_0xba89('0x68')],'as':_0xba89('0xa2'),'required':![]},{'model':db['User'],'as':_0xba89('0xa3'),'attributes':[_0xba89('0x30'),'fullname',_0xba89('0xa4')],'required':![]},{'model':db[_0xba89('0xa5')],'as':_0xba89('0xa6'),'attributes':['id',_0xba89('0x30'),'color'],'where':_0xd6871e[_0xba89('0x38')][_0xba89('0xa7')]?{'id':_0xd6871e[_0xba89('0x38')][_0xba89('0xa7')]}:undefined,'required':_0xd6871e[_0xba89('0x38')][_0xba89('0xa7')]?!![]:![]}];}return db[_0xba89('0x86')]['findAll'](_0x20dad1);})['then'](function(_0x32a071){_0x12709b['rows']=_0x32a071;return _0x12709b;});}})[_0xba89('0x18')](respondWithFilteredResult(_0x1055ac,_0x20dad1))[_0xba89('0x21')](handleError(_0x1055ac,null));};exports[_0xba89('0xa8')]=function(_0x3c99f7,_0x2247a5,_0x4d9e4d){return db['OpenchannelAccount'][_0xba89('0x50')]({'where':{'id':_0x3c99f7[_0xba89('0x4b')]['id']}})[_0xba89('0x18')](handleEntityNotFound(_0x2247a5,null))['then'](function(_0x399b64){if(_0x399b64){return _0x399b64['addAgents'](_0x3c99f7[_0xba89('0x59')]['ids'],_[_0xba89('0xa9')](_0x3c99f7['body'],[_0xba89('0x65'),'id'])||{})[_0xba89('0x89')](function(_0x3fe3e1){for(var _0x123962=0x0;_0x123962<_0x3c99f7[_0xba89('0x59')]['ids']['length'];_0x123962+=0x1){socket[_0xba89('0xaa')](_0xba89('0xab'),{'UserId':Number(_0x3c99f7[_0xba89('0x59')][_0xba89('0x65')][_0x123962]),'OpenchannelAccountId':Number(_0x3c99f7[_0xba89('0x4b')]['id'])});}return _0x3fe3e1;});}})[_0xba89('0x18')](respondWithResult(_0x2247a5,null))[_0xba89('0x21')](handleError(_0x2247a5,null));};exports[_0xba89('0xac')]=function(_0xe9992d,_0x1a5abf,_0x1e3940){return db['OpenchannelAccount']['find']({'where':{'id':_0xe9992d['params']['id']}})[_0xba89('0x18')](handleEntityNotFound(_0x1a5abf,null))[_0xba89('0x18')](function(_0x3d8460){if(_0x3d8460){return _0x3d8460['removeAgents'](_0xe9992d[_0xba89('0x38')][_0xba89('0x65')])[_0xba89('0x18')](function(){if(_[_0xba89('0xad')](_0xe9992d['query'][_0xba89('0x65')])){for(var _0x222885=0x0;_0x222885<_0xe9992d[_0xba89('0x38')][_0xba89('0x65')][_0xba89('0x3d')];_0x222885+=0x1){socket[_0xba89('0xaa')]('userOpenchannelAccount:remove',{'UserId':Number(_0xe9992d[_0xba89('0x38')][_0xba89('0x65')][_0x222885]),'OpenchannelAccountId':Number(_0xe9992d['params']['id'])});}}else{socket[_0xba89('0xaa')](_0xba89('0xae'),{'UserId':Number(_0xe9992d[_0xba89('0x38')][_0xba89('0x65')]),'OpenchannelAccountId':Number(_0xe9992d[_0xba89('0x4b')]['id'])});}});}})[_0xba89('0x18')](respondWithStatusCode(_0x1a5abf,null))[_0xba89('0x21')](handleError(_0x1a5abf,null));};exports[_0xba89('0xaf')]=function(_0xa78fe1,_0x325919,_0x4d97ff){var _0x23e049={};var _0x837afa={};var _0x34926d;var _0xaabe96;return db[_0xba89('0x35')][_0xba89('0x5e')]({'where':{'id':_0xa78fe1[_0xba89('0x4b')]['id']}})['then'](handleEntityNotFound(_0x325919,null))[_0xba89('0x18')](function(_0x515b96){if(_0x515b96){_0x34926d=_0x515b96;_0x837afa[_0xba89('0x37')]=_[_0xba89('0x4d')](db[_0xba89('0xb0')]['rawAttributes']);_0x837afa[_0xba89('0x38')]=_[_0xba89('0x4d')](_0xa78fe1[_0xba89('0x38')]);_0x837afa[_0xba89('0x39')]=_[_0xba89('0x3b')](_0x837afa[_0xba89('0x37')],_0x837afa[_0xba89('0x38')]);_0x23e049[_0xba89('0x3a')]=_[_0xba89('0x3b')](_0x837afa[_0xba89('0x37')],qs[_0xba89('0x3c')](_0xa78fe1[_0xba89('0x38')][_0xba89('0x3c')]));_0x23e049[_0xba89('0x3a')]=_0x23e049[_0xba89('0x3a')][_0xba89('0x3d')]?_0x23e049['attributes']:_0x837afa[_0xba89('0x37')];_0x23e049[_0xba89('0x40')]=qs['sort'](_0xa78fe1['query']['sort']);_0x23e049[_0xba89('0x42')]=qs[_0xba89('0x39')](_[_0xba89('0x43')](_0xa78fe1[_0xba89('0x38')],_0x837afa[_0xba89('0x39')]));if(_0xa78fe1['query']['filter']){_0x23e049['where']=_['merge'](_0x23e049[_0xba89('0x42')],{'$or':_[_0xba89('0x34')](_0x23e049[_0xba89('0x3a')],function(_0x22a559){var _0xc0b9cb={};_0xc0b9cb[_0x22a559]={'$like':'%'+_0xa78fe1[_0xba89('0x38')][_0xba89('0x44')]+'%'};return _0xc0b9cb;})});}_0x23e049=_[_0xba89('0x47')]({},_0x23e049,_0xa78fe1[_0xba89('0x4f')]);return _0x34926d[_0xba89('0xaf')](_0x23e049);}})[_0xba89('0x18')](function(_0x30625e){if(_0x30625e){_0xaabe96=_0x30625e[_0xba89('0x3d')];if(!_0xa78fe1[_0xba89('0x38')]['hasOwnProperty'](_0xba89('0x3f'))){_0x23e049['limit']=qs['limit'](_0xa78fe1[_0xba89('0x38')][_0xba89('0x28')]);_0x23e049[_0xba89('0x26')]=qs[_0xba89('0x26')](_0xa78fe1['query'][_0xba89('0x26')]);}return _0x34926d['getAgents'](_0x23e049);}})[_0xba89('0x18')](function(_0x4a156b){if(_0x4a156b){return _0x4a156b?{'count':_0xaabe96,'rows':_0x4a156b}:null;}})[_0xba89('0x18')](respondWithResult(_0x325919,null))[_0xba89('0x21')](handleError(_0x325919,null));};exports['send']=function(_0xb83d8e,_0x43e133,_0x3e72bd){var _0x15c750,_0x760902,_0x33480e;if(_[_0xba89('0x6f')](_0xb83d8e[_0xba89('0x59')][_0xba89('0x59')])||_0xb83d8e[_0xba89('0x59')][_0xba89('0x59')]===''){throw new db[(_0xba89('0x71'))][(_0xba89('0x69'))](_0xba89('0xb1'));}if(_[_0xba89('0x6f')](_0xb83d8e[_0xba89('0x59')]['to'])){}_0x15c750=_0xb83d8e['body']['to'];return db[_0xba89('0x35')][_0xba89('0x5e')]({'where':{'id':_0xb83d8e['params']['id']}})[_0xba89('0x18')](handleEntityNotFound(_0x43e133,null))[_0xba89('0x18')](function(_0x4a5bf4){if(_0x4a5bf4){return db[_0xba89('0x35')][_0xba89('0x50')]({'where':{'id':_0x4a5bf4['id']},'include':[{'model':db[_0xba89('0x74')],'as':_0xba89('0x75'),'include':[{'model':db[_0xba89('0x68')],'as':_0xba89('0x7f'),'where':{[_0x4a5bf4[_0xba89('0x72')]]:_0x15c750},'limit':0x1,'order':[[_0xba89('0x6d'),_0xba89('0x76')]]}]}]})['then'](handleEntityNotFound(_0x43e133,null))['then'](function(_0x2223d2){if(_0x2223d2&&_0x2223d2[_0xba89('0x75')]){_0x760902=_0x2223d2[_0xba89('0x53')]({'plain':!![]});if(_0x760902[_0xba89('0x75')]&&_0x760902['List'][_0xba89('0x7f')][_0xba89('0x3d')]){return _0x760902[_0xba89('0x75')][_0xba89('0x7f')][0x0];}return db[_0xba89('0x68')][_0xba89('0x51')](_['defaults'](_0xb83d8e[_0xba89('0x59')],{'firstName':_0x15c750,[_0x2223d2[_0xba89('0x72')]]:_0x15c750,'phone':_0x15c750,'ListId':_0x760902[_0xba89('0x81')]}));}})[_0xba89('0x18')](handleEntityNotFound(_0x43e133,null))[_0xba89('0x18')](function(_0x4cb9d4){if(_0x4cb9d4){_0x33480e=_0x4cb9d4;return db[_0xba89('0x86')][_0xba89('0x50')]({'where':{'ContactId':_0x33480e['id'],'closed':![],'OpenchannelAccountId':_0x760902['id']}})[_0xba89('0x18')](function(_0x20dccd){if(_0x20dccd){return[_0x20dccd,![]];}return db[_0xba89('0x86')][_0xba89('0x51')]({'UserId':_0xb83d8e[_0xba89('0x52')]['id'],'ContactId':_0x33480e['id'],'OpenchannelAccountId':_0x760902['id'],'lastMsgDirection':_0xba89('0xb2'),'Messages':[_[_0xba89('0x47')](_0xb83d8e[_0xba89('0x59')],{'read':![],'body':_0xb83d8e[_0xba89('0x59')][_0xba89('0x59')],'OpenchannelAccountId':_0x760902['id'],'UserId':_0xb83d8e['user']['id'],'ContactId':_0x33480e['id']})]},{'include':[{'model':db[_0xba89('0x91')],'as':_0xba89('0xb3')}]})[_0xba89('0x18')](function(_0x387ac2){return[_0x387ac2,!![]];});});}})[_0xba89('0x89')](function(_0x59801f,_0x1997cf){if(_0x1997cf){return _0x59801f;}return db['OpenchannelMessage']['create'](_[_0xba89('0x47')](_0xb83d8e[_0xba89('0x59')],{'read':![],'body':_0xb83d8e[_0xba89('0x59')][_0xba89('0x59')],'OpenchannelAccountId':_0x760902['id'],'OpenchannelInteractionId':_0x59801f['id'],'UserId':_0xb83d8e['user']['id'],'ContactId':_0x33480e['id']}))[_0xba89('0x18')](function(_0x5078f4){_0x59801f[_0xba89('0xb4')][_0xba89('0xb3')]=[];_0x59801f[_0xba89('0xb4')][_0xba89('0xb3')][_0xba89('0x8e')](_0x5078f4[_0xba89('0xb4')]);return _0x59801f;});});}})[_0xba89('0x18')](respondWithResult(_0x43e133,null))['catch'](handleError(_0x43e133,null));}; \ No newline at end of file +var _0xff98=['interaction','autoclose','push','close','unmanaged','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','startRouting','EventManager','notify','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','rawAttributes','getInteractions','Contact','Owner','fullname','internal','Tag','color','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','OpenchannelMessage','Messages','dataValues','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','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','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','OpenchannelAccounts','UserProfileResource','destroy','sendStatus','stack','name','send','mandatoryDispositionPause','map','OpenchannelAccount','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','merge','where','VIRTUAL','includeAll','findAll','rows','show','params','Pause','include','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','find','describe','Disposition','getDispositions','findOne','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','isNil','from','mapKey','includes','CmList','List','Contacts','DESC','OpenchannelApplication','applications','Applications','list','orderBy','priority','asc','account','ListId','contact','firstName','lastName','threadId','externalUrl','ContactId','OpenchannelInteraction','spread','messageId'];(function(_0x1ed559,_0x1a5039){var _0x1ec0da=function(_0x41cbb0){while(--_0x41cbb0){_0x1ed559['push'](_0x1ed559['shift']());}};_0x1ec0da(++_0x1a5039);}(_0xff98,0x1a2));var _0x8ff9=function(_0xab4f44,_0xdbb7cd){_0xab4f44=_0xab4f44-0x0;var _0x511878=_0xff98[_0xab4f44];return _0x511878;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8ff9('0x0'));var zipdir=require(_0x8ff9('0x1'));var jsonpatch=require(_0x8ff9('0x2'));var rp=require('request-promise');var moment=require(_0x8ff9('0x3'));var BPromise=require(_0x8ff9('0x4'));var Mustache=require(_0x8ff9('0x5'));var util=require('util');var path=require('path');var sox=require(_0x8ff9('0x6'));var csv=require(_0x8ff9('0x7'));var ejs=require(_0x8ff9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8ff9('0x9'));var squel=require(_0x8ff9('0xa'));var crypto=require(_0x8ff9('0xb'));var jsforce=require(_0x8ff9('0xc'));var deskjs=require(_0x8ff9('0xd'));var toCsv=require(_0x8ff9('0x7'));var querystring=require(_0x8ff9('0xe'));var Papa=require('papaparse');var Redis=require(_0x8ff9('0xf'));var authService=require(_0x8ff9('0x10'));var qs=require(_0x8ff9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x8ff9('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x8ff9('0x13'));var db=require(_0x8ff9('0x14'))['db'];config[_0x8ff9('0x15')]=_[_0x8ff9('0x16')](config[_0x8ff9('0x15')],{'host':_0x8ff9('0x17'),'port':0x18eb});var socket=require(_0x8ff9('0x18'))(new Redis(config[_0x8ff9('0x15')]));require(_0x8ff9('0x19'))[_0x8ff9('0x1a')](socket);var jayson=require(_0x8ff9('0x1b'));var client=jayson[_0x8ff9('0x1c')][_0x8ff9('0x1d')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4d5e73,_0x113c47,_0x359ba7,_0x53eb6b){return new BPromise(function(_0x549d59,_0x5ba1e6){var _0x578db0=_0x53eb6b||client;return _0x578db0[_0x8ff9('0x1e')](_0x4d5e73,_0x359ba7)[_0x8ff9('0x1f')](function(_0x2eed19){logger[_0x8ff9('0x20')](_0x8ff9('0x21'),_0x113c47,_0x8ff9('0x22'));logger[_0x8ff9('0x23')](_0x8ff9('0x24'),_0x113c47,_0x8ff9('0x22'),JSON[_0x8ff9('0x25')](_0x2eed19));if(_0x2eed19[_0x8ff9('0x26')]){if(_0x2eed19[_0x8ff9('0x26')][_0x8ff9('0x27')]===0x1f4){logger[_0x8ff9('0x26')](_0x8ff9('0x21'),_0x113c47,_0x2eed19['error'][_0x8ff9('0x28')]);return _0x5ba1e6(_0x2eed19[_0x8ff9('0x26')][_0x8ff9('0x28')]);}logger[_0x8ff9('0x26')](_0x8ff9('0x21'),_0x113c47,_0x2eed19['error']['message']);return _0x549d59(_0x2eed19[_0x8ff9('0x26')]['message']);}else{logger['info'](_0x8ff9('0x21'),_0x113c47,_0x8ff9('0x22'));_0x549d59(_0x2eed19[_0x8ff9('0x29')][_0x8ff9('0x28')]);}})[_0x8ff9('0x2a')](function(_0x358f8e){logger[_0x8ff9('0x26')](_0x8ff9('0x21'),_0x113c47,_0x358f8e);_0x5ba1e6(_0x358f8e);});});}function respondWithStatusCode(_0x1ac6f3,_0x2f59c6){_0x2f59c6=_0x2f59c6||0xcc;return function(_0x527239){if(_0x527239){return _0x1ac6f3['sendStatus'](_0x2f59c6);}return _0x1ac6f3[_0x8ff9('0x2b')](_0x2f59c6)[_0x8ff9('0x2c')]();};}function respondWithResult(_0x15aa6c,_0x5cca9b){_0x5cca9b=_0x5cca9b||0xc8;return function(_0x2a76bc){if(_0x2a76bc){return _0x15aa6c[_0x8ff9('0x2b')](_0x5cca9b)[_0x8ff9('0x2d')](_0x2a76bc);}};}function respondWithFilteredResult(_0x1b7dae,_0x3a841a){return function(_0x51b900){if(_0x51b900){var _0x164782=typeof _0x3a841a[_0x8ff9('0x2e')]===_0x8ff9('0x2f')&&typeof _0x3a841a[_0x8ff9('0x30')]===_0x8ff9('0x2f');var _0x84b777=_0x51b900['count'];var _0x19fa59=_0x164782?0x0:_0x3a841a[_0x8ff9('0x2e')];var _0x51c3f2=_0x164782?_0x51b900[_0x8ff9('0x31')]:_0x3a841a[_0x8ff9('0x2e')]+_0x3a841a['limit'];var _0x1c0e1b;if(_0x51c3f2>=_0x84b777){_0x51c3f2=_0x84b777;_0x1c0e1b=0xc8;}else{_0x1c0e1b=0xce;}_0x1b7dae[_0x8ff9('0x2b')](_0x1c0e1b);return _0x1b7dae[_0x8ff9('0x32')]('Content-Range',_0x19fa59+'-'+_0x51c3f2+'/'+_0x84b777)[_0x8ff9('0x2d')](_0x51b900);}return null;};}function patchUpdates(_0x5d0ddf){return function(_0x444b01){try{jsonpatch[_0x8ff9('0x33')](_0x444b01,_0x5d0ddf,!![]);}catch(_0x5acfff){return BPromise[_0x8ff9('0x34')](_0x5acfff);}return _0x444b01[_0x8ff9('0x35')]();};}function saveUpdates(_0xd05374,_0x37bdb5){return function(_0x4393e1){if(_0x4393e1){return _0x4393e1[_0x8ff9('0x36')](_0xd05374)[_0x8ff9('0x1f')](function(_0x498154){return _0x498154;});}return null;};}function removeEntity(_0x5b0b68,_0x43a569){return function(_0x335f18){if(_0x335f18){return _0x335f18['destroy']()['then'](function(){var _0x1c8109=_0x335f18['get']({'plain':!![]});var _0x5e8510=_0x8ff9('0x37');return db[_0x8ff9('0x38')][_0x8ff9('0x39')]({'where':{'type':_0x5e8510,'resourceId':_0x1c8109['id']}})['then'](function(){return _0x335f18;});})['then'](function(){_0x5b0b68[_0x8ff9('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e28f3,_0x56c395){return function(_0x412c7c){if(!_0x412c7c){_0x1e28f3[_0x8ff9('0x3a')](0x194);}return _0x412c7c;};}function handleError(_0x40e2e3,_0x134d1c){_0x134d1c=_0x134d1c||0x1f4;return function(_0xd99489){logger[_0x8ff9('0x26')](_0xd99489[_0x8ff9('0x3b')]);if(_0xd99489[_0x8ff9('0x3c')]){delete _0xd99489['name'];}_0x40e2e3[_0x8ff9('0x2b')](_0x134d1c)[_0x8ff9('0x3d')](_0xd99489);};}exports['index']=function(_0x1fa935,_0xde33d7){var _0x4822e0={'include':[{'model':db['Pause'],'as':_0x8ff9('0x3e')}]},_0x352c58={},_0x4f34ae={'count':0x0,'rows':[]};var _0x25e657=_[_0x8ff9('0x3f')](db[_0x8ff9('0x40')]['rawAttributes'],function(_0x36e910){return{'name':_0x36e910[_0x8ff9('0x41')],'type':_0x36e910[_0x8ff9('0x42')][_0x8ff9('0x43')]};});_0x352c58['model']=_[_0x8ff9('0x3f')](_0x25e657,_0x8ff9('0x3c'));_0x352c58[_0x8ff9('0x44')]=_[_0x8ff9('0x45')](_0x1fa935[_0x8ff9('0x44')]);_0x352c58['filters']=_[_0x8ff9('0x46')](_0x352c58[_0x8ff9('0x47')],_0x352c58['query']);_0x4822e0[_0x8ff9('0x48')]=_['intersection'](_0x352c58[_0x8ff9('0x47')],qs[_0x8ff9('0x49')](_0x1fa935[_0x8ff9('0x44')][_0x8ff9('0x49')]));_0x4822e0[_0x8ff9('0x48')]=_0x4822e0[_0x8ff9('0x48')][_0x8ff9('0x4a')]?_0x4822e0['attributes']:_0x352c58[_0x8ff9('0x47')];if(!_0x1fa935['query'][_0x8ff9('0x4b')](_0x8ff9('0x4c'))){_0x4822e0[_0x8ff9('0x30')]=qs[_0x8ff9('0x30')](_0x1fa935[_0x8ff9('0x44')][_0x8ff9('0x30')]);_0x4822e0[_0x8ff9('0x2e')]=qs[_0x8ff9('0x2e')](_0x1fa935[_0x8ff9('0x44')]['offset']);}_0x4822e0[_0x8ff9('0x4d')]=qs[_0x8ff9('0x4e')](_0x1fa935['query'][_0x8ff9('0x4e')]);_0x4822e0['where']=qs['filters'](_[_0x8ff9('0x4f')](_0x1fa935[_0x8ff9('0x44')],_0x352c58[_0x8ff9('0x50')]),_0x25e657);if(_0x1fa935['query'][_0x8ff9('0x51')]){_0x4822e0['where']=_[_0x8ff9('0x52')](_0x4822e0[_0x8ff9('0x53')],{'$or':_['map'](_0x25e657,function(_0xe42c65){if(_0xe42c65[_0x8ff9('0x42')]!==_0x8ff9('0x54')){var _0xa5516c={};_0xa5516c[_0xe42c65['name']]={'$like':'%'+_0x1fa935[_0x8ff9('0x44')][_0x8ff9('0x51')]+'%'};return _0xa5516c;}})});}_0x4822e0=_[_0x8ff9('0x52')]({},_0x4822e0,_0x1fa935['options']);var _0x3dbffc={'where':_0x4822e0[_0x8ff9('0x53')]};return db['OpenchannelAccount'][_0x8ff9('0x31')](_0x3dbffc)[_0x8ff9('0x1f')](function(_0x19d986){_0x4f34ae[_0x8ff9('0x31')]=_0x19d986;if(_0x1fa935[_0x8ff9('0x44')][_0x8ff9('0x55')]){_0x4822e0['include']=[{'all':!![]}];}return db[_0x8ff9('0x40')][_0x8ff9('0x56')](_0x4822e0);})[_0x8ff9('0x1f')](function(_0x208586){_0x4f34ae[_0x8ff9('0x57')]=_0x208586;return _0x4f34ae;})[_0x8ff9('0x1f')](respondWithFilteredResult(_0xde33d7,_0x4822e0))['catch'](handleError(_0xde33d7,null));};exports[_0x8ff9('0x58')]=function(_0x279fce,_0x5eafff){var _0x575c1e={'raw':![],'where':{'id':_0x279fce[_0x8ff9('0x59')]['id']},'include':[{'model':db[_0x8ff9('0x5a')],'as':_0x8ff9('0x3e')}]},_0x2ee1cd={};_0x2ee1cd[_0x8ff9('0x47')]=_[_0x8ff9('0x45')](db['OpenchannelAccount']['rawAttributes']);_0x2ee1cd['query']=_[_0x8ff9('0x45')](_0x279fce[_0x8ff9('0x44')]);_0x2ee1cd[_0x8ff9('0x50')]=_['intersection'](_0x2ee1cd[_0x8ff9('0x47')],_0x2ee1cd['query']);_0x575c1e[_0x8ff9('0x48')]=_[_0x8ff9('0x46')](_0x2ee1cd['model'],qs[_0x8ff9('0x49')](_0x279fce['query']['fields']));_0x575c1e[_0x8ff9('0x48')]=_0x575c1e[_0x8ff9('0x48')][_0x8ff9('0x4a')]?_0x575c1e[_0x8ff9('0x48')]:_0x2ee1cd[_0x8ff9('0x47')];if(_0x279fce[_0x8ff9('0x44')]['includeAll']){_0x575c1e[_0x8ff9('0x5b')]=[{'all':!![]}];}_0x575c1e=_[_0x8ff9('0x52')]({},_0x575c1e,_0x279fce[_0x8ff9('0x5c')]);return db[_0x8ff9('0x40')]['find'](_0x575c1e)[_0x8ff9('0x1f')](handleEntityNotFound(_0x5eafff,null))['then'](respondWithResult(_0x5eafff,null))[_0x8ff9('0x2a')](handleError(_0x5eafff,null));};exports[_0x8ff9('0x5d')]=function(_0x3233ae,_0x10658f){return db[_0x8ff9('0x40')][_0x8ff9('0x5d')](_0x3233ae[_0x8ff9('0x5e')],{})[_0x8ff9('0x1f')](function(_0x2d0fa1){var _0x166393=_0x3233ae[_0x8ff9('0x5f')][_0x8ff9('0x60')]({'plain':!![]});if(!_0x166393)throw new Error(_0x8ff9('0x61'));if(_0x166393[_0x8ff9('0x62')]==='user'){var _0x5a6763=_0x2d0fa1[_0x8ff9('0x60')]({'plain':!![]});var _0x5310b2=_0x8ff9('0x37');return db[_0x8ff9('0x63')]['find']({'where':{'name':_0x5310b2,'userProfileId':_0x166393[_0x8ff9('0x64')]},'raw':!![]})['then'](function(_0x1bad21){if(_0x1bad21&&_0x1bad21[_0x8ff9('0x65')]===0x0){return db[_0x8ff9('0x38')]['create']({'name':_0x5a6763['name'],'resourceId':_0x5a6763['id'],'type':_0x1bad21[_0x8ff9('0x3c')],'sectionId':_0x1bad21['id']},{})[_0x8ff9('0x1f')](function(){return _0x2d0fa1;});}else{return _0x2d0fa1;}})[_0x8ff9('0x2a')](function(_0x27d710){logger[_0x8ff9('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x27d710);throw _0x27d710;});}return _0x2d0fa1;})[_0x8ff9('0x1f')](respondWithResult(_0x10658f,0xc9))[_0x8ff9('0x2a')](handleError(_0x10658f,null));};exports[_0x8ff9('0x36')]=function(_0x5a3e05,_0x3ed38d){if(_0x5a3e05[_0x8ff9('0x5e')]['id']){delete _0x5a3e05[_0x8ff9('0x5e')]['id'];}return db[_0x8ff9('0x40')][_0x8ff9('0x66')]({'where':{'id':_0x5a3e05[_0x8ff9('0x59')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x3ed38d,null))[_0x8ff9('0x1f')](saveUpdates(_0x5a3e05[_0x8ff9('0x5e')],null))['then'](respondWithResult(_0x3ed38d,null))[_0x8ff9('0x2a')](handleError(_0x3ed38d,null));};exports[_0x8ff9('0x39')]=function(_0x5a04e4,_0x19eeec){return db[_0x8ff9('0x40')]['find']({'where':{'id':_0x5a04e4[_0x8ff9('0x59')]['id']}})[_0x8ff9('0x1f')](handleEntityNotFound(_0x19eeec,null))['then'](removeEntity(_0x19eeec,null))['catch'](handleError(_0x19eeec,null));};exports[_0x8ff9('0x67')]=function(_0x1b750f,_0x21c2c2){return db[_0x8ff9('0x40')][_0x8ff9('0x67')]()[_0x8ff9('0x1f')](respondWithResult(_0x21c2c2,null))[_0x8ff9('0x2a')](handleError(_0x21c2c2,null));};exports['addDisposition']=function(_0x4e6169,_0xbf8761,_0x4e35b8){if(_0x4e6169[_0x8ff9('0x5e')]['id']){delete _0x4e6169[_0x8ff9('0x5e')]['id'];}return db[_0x8ff9('0x40')][_0x8ff9('0x66')]({'where':{'id':_0x4e6169[_0x8ff9('0x59')]['id']}})[_0x8ff9('0x1f')](handleEntityNotFound(_0xbf8761,null))[_0x8ff9('0x1f')](function(_0x1a3a23){if(_0x1a3a23){_0x4e6169[_0x8ff9('0x5e')]['OpenchannelAccountId']=_0x1a3a23['id'];return db[_0x8ff9('0x68')]['create'](_0x4e6169['body']);}})['then'](respondWithResult(_0xbf8761,null))[_0x8ff9('0x2a')](handleError(_0xbf8761,null));};exports[_0x8ff9('0x69')]=function(_0x30dc6a,_0x1713c7,_0x37647d){var _0x1e2b33={'raw':![],'where':{}};var _0x5bea9f={};var _0xfa10fb={'count':0x0,'rows':[]};return db[_0x8ff9('0x40')][_0x8ff9('0x6a')]({'where':{'id':_0x30dc6a[_0x8ff9('0x59')]['id']}})[_0x8ff9('0x1f')](handleEntityNotFound(_0x1713c7,null))['then'](function(_0x413729){if(_0x413729){_0x5bea9f['model']=_[_0x8ff9('0x45')](db[_0x8ff9('0x68')]['rawAttributes']);_0x5bea9f[_0x8ff9('0x44')]=_[_0x8ff9('0x45')](_0x30dc6a[_0x8ff9('0x44')]);_0x5bea9f['filters']=_[_0x8ff9('0x46')](_0x5bea9f[_0x8ff9('0x47')],_0x5bea9f[_0x8ff9('0x44')]);_0x1e2b33[_0x8ff9('0x48')]=_[_0x8ff9('0x46')](_0x5bea9f[_0x8ff9('0x47')],qs[_0x8ff9('0x49')](_0x30dc6a[_0x8ff9('0x44')][_0x8ff9('0x49')]));_0x1e2b33[_0x8ff9('0x48')]=_0x1e2b33[_0x8ff9('0x48')]['length']?_0x1e2b33[_0x8ff9('0x48')]:_0x5bea9f[_0x8ff9('0x47')];if(!_0x30dc6a[_0x8ff9('0x44')]['hasOwnProperty']('nolimit')){_0x1e2b33[_0x8ff9('0x30')]=qs[_0x8ff9('0x30')](_0x30dc6a[_0x8ff9('0x44')][_0x8ff9('0x30')]);_0x1e2b33[_0x8ff9('0x2e')]=qs[_0x8ff9('0x2e')](_0x30dc6a['query'][_0x8ff9('0x2e')]);}_0x1e2b33[_0x8ff9('0x4d')]=qs[_0x8ff9('0x4e')](_0x30dc6a[_0x8ff9('0x44')][_0x8ff9('0x4e')]);_0x1e2b33[_0x8ff9('0x53')]=qs[_0x8ff9('0x50')](_['pick'](_0x30dc6a['query'],_0x5bea9f[_0x8ff9('0x50')]));_0x1e2b33['where'][_0x8ff9('0x6b')]=_0x413729['id'];if(_0x30dc6a[_0x8ff9('0x44')]['filter']){_0x1e2b33[_0x8ff9('0x53')]=_[_0x8ff9('0x52')](_0x1e2b33[_0x8ff9('0x53')],{'$or':_[_0x8ff9('0x3f')](_0x1e2b33['attributes'],function(_0x62948e){var _0x50a743={};_0x50a743[_0x62948e]={'$like':'%'+_0x30dc6a[_0x8ff9('0x44')][_0x8ff9('0x51')]+'%'};return _0x50a743;})});}_0x1e2b33=_[_0x8ff9('0x52')]({},_0x1e2b33,_0x30dc6a[_0x8ff9('0x5c')]);return db[_0x8ff9('0x68')][_0x8ff9('0x31')]({'where':_0x1e2b33[_0x8ff9('0x53')]})[_0x8ff9('0x1f')](function(_0x114a4d){_0xfa10fb[_0x8ff9('0x31')]=_0x114a4d;if(_0x30dc6a['query'][_0x8ff9('0x55')]){_0x1e2b33[_0x8ff9('0x5b')]=[{'all':!![]}];}return db[_0x8ff9('0x68')][_0x8ff9('0x56')](_0x1e2b33);})[_0x8ff9('0x1f')](function(_0x534d2d){_0xfa10fb[_0x8ff9('0x57')]=_0x534d2d;return _0xfa10fb;});}})[_0x8ff9('0x1f')](respondWithFilteredResult(_0x1713c7,_0x1e2b33))[_0x8ff9('0x2a')](handleError(_0x1713c7,null));};exports[_0x8ff9('0x6c')]=function(_0x148669,_0x396df1,_0x28c86c){return db[_0x8ff9('0x40')][_0x8ff9('0x66')]({'where':{'id':_0x148669[_0x8ff9('0x59')]['id']}})[_0x8ff9('0x1f')](handleEntityNotFound(_0x396df1,null))[_0x8ff9('0x1f')](function(_0x2ddac4){if(_0x2ddac4){return _0x2ddac4['removeDispositions'](_0x148669[_0x8ff9('0x44')][_0x8ff9('0x6d')]);}})[_0x8ff9('0x1f')](respondWithStatusCode(_0x396df1,null))[_0x8ff9('0x2a')](handleError(_0x396df1,null));};exports[_0x8ff9('0x6e')]=function(_0x267388,_0x5484e3,_0xe7c4ac){if(_0x267388[_0x8ff9('0x5e')]['id']){delete _0x267388[_0x8ff9('0x5e')]['id'];}return db[_0x8ff9('0x40')][_0x8ff9('0x66')]({'where':{'id':_0x267388[_0x8ff9('0x59')]['id']}})[_0x8ff9('0x1f')](handleEntityNotFound(_0x5484e3,null))[_0x8ff9('0x1f')](function(_0x5bb487){if(_0x5bb487){_0x267388['body'][_0x8ff9('0x6b')]=_0x5bb487['id'];return db[_0x8ff9('0x6f')]['create'](_0x267388['body']);}})[_0x8ff9('0x1f')](respondWithResult(_0x5484e3,null))[_0x8ff9('0x2a')](handleError(_0x5484e3,null));};exports[_0x8ff9('0x70')]=function(_0x13030d,_0x5b4067,_0x1ed37f){var _0x428a4d={'raw':![],'where':{}};var _0x45269f={};var _0x545090={'count':0x0,'rows':[]};return db[_0x8ff9('0x40')]['findOne']({'where':{'id':_0x13030d[_0x8ff9('0x59')]['id']}})[_0x8ff9('0x1f')](handleEntityNotFound(_0x5b4067,null))[_0x8ff9('0x1f')](function(_0x18b36b){if(_0x18b36b){_0x45269f['model']=_['keys'](db['CannedAnswer']['rawAttributes']);_0x45269f[_0x8ff9('0x44')]=_[_0x8ff9('0x45')](_0x13030d['query']);_0x45269f[_0x8ff9('0x50')]=_[_0x8ff9('0x46')](_0x45269f['model'],_0x45269f[_0x8ff9('0x44')]);_0x428a4d[_0x8ff9('0x48')]=_['intersection'](_0x45269f[_0x8ff9('0x47')],qs[_0x8ff9('0x49')](_0x13030d[_0x8ff9('0x44')][_0x8ff9('0x49')]));_0x428a4d[_0x8ff9('0x48')]=_0x428a4d[_0x8ff9('0x48')]['length']?_0x428a4d[_0x8ff9('0x48')]:_0x45269f[_0x8ff9('0x47')];if(!_0x13030d[_0x8ff9('0x44')][_0x8ff9('0x4b')](_0x8ff9('0x4c'))){_0x428a4d['limit']=qs[_0x8ff9('0x30')](_0x13030d[_0x8ff9('0x44')][_0x8ff9('0x30')]);_0x428a4d[_0x8ff9('0x2e')]=qs[_0x8ff9('0x2e')](_0x13030d[_0x8ff9('0x44')]['offset']);}_0x428a4d[_0x8ff9('0x4d')]=qs['sort'](_0x13030d[_0x8ff9('0x44')][_0x8ff9('0x4e')]);_0x428a4d[_0x8ff9('0x53')]=qs[_0x8ff9('0x50')](_[_0x8ff9('0x4f')](_0x13030d[_0x8ff9('0x44')],_0x45269f[_0x8ff9('0x50')]));_0x428a4d[_0x8ff9('0x53')][_0x8ff9('0x6b')]=_0x18b36b['id'];if(_0x13030d[_0x8ff9('0x44')][_0x8ff9('0x51')]){_0x428a4d['where']=_[_0x8ff9('0x52')](_0x428a4d[_0x8ff9('0x53')],{'$or':_['map'](_0x428a4d[_0x8ff9('0x48')],function(_0x33cc3b){var _0x4dd008={};_0x4dd008[_0x33cc3b]={'$like':'%'+_0x13030d[_0x8ff9('0x44')][_0x8ff9('0x51')]+'%'};return _0x4dd008;})});}_0x428a4d=_[_0x8ff9('0x52')]({},_0x428a4d,_0x13030d['options']);return db[_0x8ff9('0x6f')]['count']({'where':_0x428a4d[_0x8ff9('0x53')]})[_0x8ff9('0x1f')](function(_0x39e695){_0x545090['count']=_0x39e695;if(_0x13030d[_0x8ff9('0x44')][_0x8ff9('0x55')]){_0x428a4d[_0x8ff9('0x5b')]=[{'all':!![]}];}return db[_0x8ff9('0x6f')][_0x8ff9('0x56')](_0x428a4d);})[_0x8ff9('0x1f')](function(_0x107b9e){_0x545090[_0x8ff9('0x57')]=_0x107b9e;return _0x545090;});}})[_0x8ff9('0x1f')](respondWithFilteredResult(_0x5b4067,_0x428a4d))[_0x8ff9('0x2a')](handleError(_0x5b4067,null));};exports['removeAnswers']=function(_0x22d944,_0x2e1b06,_0x51eed7){return db[_0x8ff9('0x40')][_0x8ff9('0x66')]({'where':{'id':_0x22d944[_0x8ff9('0x59')]['id']}})['then'](handleEntityNotFound(_0x2e1b06,null))[_0x8ff9('0x1f')](function(_0x5563bd){if(_0x5563bd){return _0x5563bd[_0x8ff9('0x71')](_0x22d944['query'][_0x8ff9('0x6d')]);}})[_0x8ff9('0x1f')](respondWithStatusCode(_0x2e1b06,null))[_0x8ff9('0x2a')](handleError(_0x2e1b06,null));};exports['notify']=function(_0x286cd3,_0xbff0ad,_0xfcf958){var _0xa2734e={'body':_0x286cd3[_0x8ff9('0x5e')],'channel':_0x8ff9('0x72')};var _0x2b574a=[];var _0x278be2=[];var _0xc3661b={};var _0xbe72d0=![];return db[_0x8ff9('0x73')][_0x8ff9('0x67')]()[_0x8ff9('0x1f')](function(_0x423ccd){if(!_0x423ccd){throw new db[(_0x8ff9('0x74'))][(_0x8ff9('0x75'))](_0x8ff9('0x76'));}_0x2b574a=_[_0x8ff9('0x77')](_[_0x8ff9('0x45')](_0x423ccd),[_0x8ff9('0x78'),_0x8ff9('0x79')]);_0x278be2=_['difference'](_[_0x8ff9('0x45')](_0x423ccd),[_0x8ff9('0x78'),_0x8ff9('0x79'),_0x8ff9('0x7a'),'ListId']);if(_0x286cd3[_0x8ff9('0x5e')]['id']){delete _0x286cd3[_0x8ff9('0x5e')]['id'];}if(_[_0x8ff9('0x7b')](_0x286cd3[_0x8ff9('0x5e')][_0x8ff9('0x7c')])){throw new db[(_0x8ff9('0x74'))][(_0x8ff9('0x75'))]('from\x20is\x20mandatory');}if(_[_0x8ff9('0x7b')](_0x286cd3[_0x8ff9('0x5e')]['body'])||_0x286cd3['body'][_0x8ff9('0x5e')]===''){throw new db['Sequelize'][(_0x8ff9('0x75'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x286cd3[_0x8ff9('0x5e')][_0x8ff9('0x7d')])){throw new db[(_0x8ff9('0x74'))][(_0x8ff9('0x75'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x278be2);}if(!_[_0x8ff9('0x7e')](_0x278be2,_0x286cd3[_0x8ff9('0x5e')][_0x8ff9('0x7d')])){throw new db[(_0x8ff9('0x74'))][(_0x8ff9('0x75'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x278be2);}_0xc3661b[_0x286cd3['body'][_0x8ff9('0x7d')]]=_0x286cd3[_0x8ff9('0x5e')][_0x8ff9('0x7c')];})['then'](function(){return db[_0x8ff9('0x40')][_0x8ff9('0x66')]({'where':{'id':_0x286cd3[_0x8ff9('0x59')]['id']},'include':[{'model':db[_0x8ff9('0x7f')],'as':_0x8ff9('0x80'),'include':[{'model':db[_0x8ff9('0x73')],'as':_0x8ff9('0x81'),'where':_0xc3661b,'limit':0x1,'order':[[_0x8ff9('0x79'),_0x8ff9('0x82')]]}]},{'model':db[_0x8ff9('0x83')],'as':'Applications'}]});})[_0x8ff9('0x1f')](handleEntityNotFound(_0xbff0ad,null))[_0x8ff9('0x1f')](function(_0x310c2a){if(_0x310c2a&&_0x310c2a['List']){_0xa2734e['account']=_0x310c2a;_0xa2734e[_0x8ff9('0x84')]=_0x310c2a[_0x8ff9('0x85')];_0xa2734e[_0x8ff9('0x86')]=_0x310c2a[_0x8ff9('0x80')];_0xa2734e[_0x8ff9('0x84')]=_[_0x8ff9('0x87')](_0xa2734e[_0x8ff9('0x84')],[_0x8ff9('0x88')],[_0x8ff9('0x89')]);if(_0xa2734e[_0x8ff9('0x8a')][_0x8ff9('0x85')]){delete _0xa2734e[_0x8ff9('0x8a')][_0x8ff9('0x85')];}if(_0xa2734e[_0x8ff9('0x8a')][_0x8ff9('0x80')]&&_0xa2734e[_0x8ff9('0x8a')][_0x8ff9('0x80')]['Contacts']['length']){return _0xa2734e[_0x8ff9('0x8a')][_0x8ff9('0x80')][_0x8ff9('0x81')][0x0];}var _0x4f230f=_[_0x8ff9('0x16')](_0x286cd3[_0x8ff9('0x5e')],{'firstName':_0x286cd3['body'][_0x8ff9('0x7c')],'ListId':_0x310c2a[_0x8ff9('0x8b')]});_0x4f230f[_0x286cd3[_0x8ff9('0x5e')][_0x8ff9('0x7d')]]=_0x286cd3['body']['from'];return db['CmContact'][_0x8ff9('0x5d')](_0x4f230f,{'fields':_0x2b574a,'raw':!![]});}})[_0x8ff9('0x1f')](handleEntityNotFound(_0xbff0ad,null))['then'](function(_0x5ac13d){_0xa2734e[_0x8ff9('0x8c')]=_0x5ac13d;if(_0x5ac13d){var _0x4ca844={'ContactId':_0x5ac13d['id'],'OpenchannelAccountId':_0x286cd3[_0x8ff9('0x59')]['id'],'from':(_0x5ac13d[_0x8ff9('0x8d')]||'')+'\x20'+(_0x5ac13d[_0x8ff9('0x8e')]||'')};var _0xca7707={'OpenchannelAccountId':_0x286cd3[_0x8ff9('0x59')]['id'],'closed':![]};if(_0x286cd3['body']['threadId']){_0xca7707[_0x8ff9('0x8f')]=_0x286cd3['body'][_0x8ff9('0x8f')];return db['OpenchannelInteraction'][_0x8ff9('0x66')]({'where':_0xca7707})[_0x8ff9('0x1f')](function(_0x494943){if(_0x494943){return[_0x494943,![]];}_0x4ca844[_0x8ff9('0x8f')]=_0x286cd3[_0x8ff9('0x5e')][_0x8ff9('0x8f')];_0x4ca844[_0x8ff9('0x90')]=_0x286cd3[_0x8ff9('0x5e')][_0x8ff9('0x90')];return db['OpenchannelInteraction'][_0x8ff9('0x5d')](_0x4ca844)['then'](function(_0x510179){return[_0x510179,!![]];});});}else{_0xca7707[_0x8ff9('0x8f')]=null;}_0xca7707[_0x8ff9('0x91')]=_0x5ac13d['id'];return db[_0x8ff9('0x92')][_0x8ff9('0x66')]({'where':_0xca7707})['then'](function(_0x2d6f34){if(_0x2d6f34){return[_0x2d6f34,![]];}return db['OpenchannelInteraction'][_0x8ff9('0x5d')](_0x4ca844)[_0x8ff9('0x1f')](function(_0x3e9c0c){return[_0x3e9c0c,!![]];});});}})[_0x8ff9('0x93')](function(_0x2e68a1,_0x57dcf2){if(_0x2e68a1){_0xbe72d0=_0x57dcf2;if(!_0x57dcf2){var _0x548d5e={'from':(_0xa2734e[_0x8ff9('0x8c')][_0x8ff9('0x8d')]||'')+'\x20'+(_0xa2734e[_0x8ff9('0x8c')][_0x8ff9('0x8e')]||'')};if(_0x286cd3['body']['threadId']&&_0x286cd3['body'][_0x8ff9('0x94')]&&_0x286cd3[_0x8ff9('0x5e')][_0x8ff9('0x8f')]!=_0x286cd3[_0x8ff9('0x5e')]['messageId']){_0x548d5e['threadId']=_0x286cd3[_0x8ff9('0x5e')][_0x8ff9('0x94')];}return _0x2e68a1[_0x8ff9('0x36')](_0x548d5e);}else{return _0x2e68a1;}}})[_0x8ff9('0x1f')](function(_0x41b45e){_0xa2734e[_0x8ff9('0x95')]=_0x41b45e[_0x8ff9('0x60')]({'plain':!![]});_0xa2734e[_0x8ff9('0x95')]['created']=_0xbe72d0;if(_0xa2734e['interaction']['created']){if(_0xa2734e[_0x8ff9('0x8a')][_0x8ff9('0x96')]){_0xa2734e['applications'][_0x8ff9('0x97')]({'id':0x0,'priority':_0xa2734e[_0x8ff9('0x84')][_0x8ff9('0x4a')]+0x1,'app':_0x8ff9('0x98'),'appdata':_0x8ff9('0x99'),'interval':'*,*,*,*'});}}return db['OpenchannelMessage']['create']({'body':_0x286cd3[_0x8ff9('0x5e')][_0x8ff9('0x5e')],'OpenchannelAccountId':_0x286cd3[_0x8ff9('0x59')]['id'],'OpenchannelInteractionId':_0x41b45e['id'],'direction':'in','ContactId':_0xa2734e[_0x8ff9('0x8c')]['id'],'AttachmentId':_0x286cd3['body']['AttachmentId']});})[_0x8ff9('0x1f')](function(_0x1460b4){_0xa2734e[_0x8ff9('0x28')]=_0x1460b4;if(_0xa2734e['interaction'][_0x8ff9('0x9a')]){return db[_0x8ff9('0x9b')][_0x8ff9('0x66')]({'attributes':['id',_0x8ff9('0x3c')],'where':{'id':_0xa2734e[_0x8ff9('0x95')][_0x8ff9('0x9a')]}})[_0x8ff9('0x1f')](function(_0xfa1c19){if(_0xfa1c19){_0xa2734e['applications'][_0x8ff9('0x9c')]({'id':0x0,'priority':0x0,'app':_0x8ff9('0x9d'),'appdata':_0xfa1c19[_0x8ff9('0x3c')]+','+(_0xa2734e[_0x8ff9('0x8a')][_0x8ff9('0x9e')]||0xa),'interval':_0x8ff9('0x9f')});_0xa2734e['forcedOwnership']=![];}return respondWithRpcPromise('Start',_0x8ff9('0xa0'),_0xa2734e);});}return respondWithRpcPromise('Start',_0x8ff9('0xa0'),_0xa2734e);})[_0x8ff9('0x1f')](function(_0x188b4c){respondWithRpcPromise(_0x8ff9('0xa1'),_0x8ff9('0xa1'),{'event':_0x8ff9('0xa2'),'message':_0x188b4c},client9002);return _0x188b4c;})['then'](respondWithResult(_0xbff0ad,null))[_0x8ff9('0x2a')](handleError(_0xbff0ad,null));};exports[_0x8ff9('0xa3')]=function(_0x20fae6,_0x44c4c4,_0x754bc1){return db[_0x8ff9('0x40')][_0x8ff9('0x6a')]({'where':{'id':_0x20fae6[_0x8ff9('0x59')]['id']}})[_0x8ff9('0x1f')](handleEntityNotFound(_0x44c4c4,null))[_0x8ff9('0x1f')](function(_0x415db2){if(_0x415db2){return db[_0x8ff9('0xa4')][_0x8ff9('0xa5')](function(_0x5748f3){return db[_0x8ff9('0x83')][_0x8ff9('0x39')]({'where':{'OpenchannelAccountId':_0x20fae6['params']['id']},'transaction':_0x5748f3})[_0x8ff9('0x1f')](function(_0x590b92){var _0x2d3db8=_[_0x8ff9('0x3f')](_0x20fae6[_0x8ff9('0x5e')],function(_0x30bb05){_0x30bb05[_0x8ff9('0x6b')]=_0x20fae6[_0x8ff9('0x59')]['id'];return _0x30bb05;});return db[_0x8ff9('0x83')][_0x8ff9('0xa6')](_0x2d3db8,{'transaction':_0x5748f3});});})[_0x8ff9('0x1f')](function(){return db[_0x8ff9('0x83')][_0x8ff9('0xa7')]({'where':{'OpenchannelAccountId':_0x20fae6[_0x8ff9('0x59')]['id']},'order':'priority'});});}})[_0x8ff9('0x1f')](respondWithResult(_0x44c4c4,null))[_0x8ff9('0x2a')](handleError(_0x44c4c4,null));};exports[_0x8ff9('0xa8')]=function(_0x2ab7f8,_0x20872a,_0x498490){var _0x2a5802={};var _0x4393e9={};var _0x51c6dd;var _0x506811;return db[_0x8ff9('0x40')][_0x8ff9('0x6a')]({'where':{'id':_0x2ab7f8[_0x8ff9('0x59')]['id']}})[_0x8ff9('0x1f')](handleEntityNotFound(_0x20872a,null))[_0x8ff9('0x1f')](function(_0x2dfce2){if(_0x2dfce2){_0x51c6dd=_0x2dfce2;_0x4393e9[_0x8ff9('0x47')]=_[_0x8ff9('0x45')](db[_0x8ff9('0x83')][_0x8ff9('0xa9')]);_0x4393e9['query']=_['keys'](_0x2ab7f8[_0x8ff9('0x44')]);_0x4393e9[_0x8ff9('0x50')]=_[_0x8ff9('0x46')](_0x4393e9[_0x8ff9('0x47')],_0x4393e9[_0x8ff9('0x44')]);_0x2a5802[_0x8ff9('0x48')]=_[_0x8ff9('0x46')](_0x4393e9['model'],qs['fields'](_0x2ab7f8[_0x8ff9('0x44')][_0x8ff9('0x49')]));_0x2a5802[_0x8ff9('0x48')]=_0x2a5802[_0x8ff9('0x48')][_0x8ff9('0x4a')]?_0x2a5802['attributes']:_0x4393e9[_0x8ff9('0x47')];_0x2a5802[_0x8ff9('0x4d')]=qs[_0x8ff9('0x4e')](_0x2ab7f8['query'][_0x8ff9('0x4e')]);_0x2a5802[_0x8ff9('0x53')]=qs[_0x8ff9('0x50')](_[_0x8ff9('0x4f')](_0x2ab7f8[_0x8ff9('0x44')],_0x4393e9[_0x8ff9('0x50')]));if(_0x2ab7f8[_0x8ff9('0x44')][_0x8ff9('0x51')]){_0x2a5802['where']=_[_0x8ff9('0x52')](_0x2a5802[_0x8ff9('0x53')],{'$or':_[_0x8ff9('0x3f')](_0x2a5802[_0x8ff9('0x48')],function(_0x481f3b){var _0x1bbd5c={};_0x1bbd5c[_0x481f3b]={'$like':'%'+_0x2ab7f8[_0x8ff9('0x44')][_0x8ff9('0x51')]+'%'};return _0x1bbd5c;})});}_0x2a5802=_[_0x8ff9('0x52')]({},_0x2a5802,_0x2ab7f8[_0x8ff9('0x5c')]);return _0x51c6dd[_0x8ff9('0xa8')](_0x2a5802);}})['then'](function(_0x484919){if(_0x484919){_0x506811=_0x484919['length'];if(!_0x2ab7f8[_0x8ff9('0x44')][_0x8ff9('0x4b')](_0x8ff9('0x4c'))){_0x2a5802[_0x8ff9('0x30')]=qs[_0x8ff9('0x30')](_0x2ab7f8['query'][_0x8ff9('0x30')]);_0x2a5802[_0x8ff9('0x2e')]=qs['offset'](_0x2ab7f8['query']['offset']);}return _0x51c6dd[_0x8ff9('0xa8')](_0x2a5802);}})['then'](function(_0xbccc71){if(_0xbccc71){return _0xbccc71?{'count':_0x506811,'rows':_0xbccc71}:null;}})[_0x8ff9('0x1f')](respondWithResult(_0x20872a,null))[_0x8ff9('0x2a')](handleError(_0x20872a,null));};exports[_0x8ff9('0xaa')]=function(_0x264571,_0x207af,_0x20cbb8){var _0x4b64fe={'raw':![],'where':{}};var _0x189af3={};var _0x36fc0c={'count':0x0,'rows':[]};return db[_0x8ff9('0x40')][_0x8ff9('0x6a')]({'where':{'id':_0x264571[_0x8ff9('0x59')]['id']}})[_0x8ff9('0x1f')](handleEntityNotFound(_0x207af,null))[_0x8ff9('0x1f')](function(_0x4ef38e){if(_0x4ef38e){_0x189af3['model']=_[_0x8ff9('0x45')](db[_0x8ff9('0x92')][_0x8ff9('0xa9')]);_0x189af3[_0x8ff9('0x44')]=_[_0x8ff9('0x45')](_0x264571[_0x8ff9('0x44')]);_0x189af3['filters']=_[_0x8ff9('0x46')](_0x189af3['model'],_0x189af3[_0x8ff9('0x44')]);_0x4b64fe[_0x8ff9('0x48')]=_[_0x8ff9('0x46')](_0x189af3[_0x8ff9('0x47')],qs[_0x8ff9('0x49')](_0x264571[_0x8ff9('0x44')][_0x8ff9('0x49')]));_0x4b64fe[_0x8ff9('0x48')]=_0x4b64fe[_0x8ff9('0x48')]['length']?_0x4b64fe[_0x8ff9('0x48')]:_0x189af3[_0x8ff9('0x47')];if(!_0x264571[_0x8ff9('0x44')][_0x8ff9('0x4b')]('nolimit')){_0x4b64fe[_0x8ff9('0x30')]=qs['limit'](_0x264571[_0x8ff9('0x44')]['limit']);_0x4b64fe[_0x8ff9('0x2e')]=qs[_0x8ff9('0x2e')](_0x264571[_0x8ff9('0x44')][_0x8ff9('0x2e')]);}_0x4b64fe[_0x8ff9('0x4d')]=qs[_0x8ff9('0x4e')](_0x264571[_0x8ff9('0x44')][_0x8ff9('0x4e')]);_0x4b64fe[_0x8ff9('0x53')]=qs['filters'](_[_0x8ff9('0x4f')](_0x264571['query'],_0x189af3[_0x8ff9('0x50')]));_0x4b64fe[_0x8ff9('0x53')]['OpenchannelAccountId']=_0x4ef38e['id'];if(_0x264571['query'][_0x8ff9('0x51')]){_0x4b64fe[_0x8ff9('0x53')]=_['merge'](_0x4b64fe[_0x8ff9('0x53')],{'$or':_['map'](_0x4b64fe[_0x8ff9('0x48')],function(_0x51c8a5){var _0x24bf7c={};_0x24bf7c[_0x51c8a5]={'$like':'%'+_0x264571[_0x8ff9('0x44')][_0x8ff9('0x51')]+'%'};return _0x24bf7c;})});}_0x4b64fe=_[_0x8ff9('0x52')]({},_0x4b64fe,_0x264571['options']);return db[_0x8ff9('0x92')][_0x8ff9('0x31')]({'where':_0x4b64fe[_0x8ff9('0x53')]})['then'](function(_0x51c071){_0x36fc0c[_0x8ff9('0x31')]=_0x51c071;if(_0x264571[_0x8ff9('0x44')]['includeAll']){_0x4b64fe[_0x8ff9('0x5b')]=[{'model':db[_0x8ff9('0x73')],'as':_0x8ff9('0xab'),'required':![]},{'model':db[_0x8ff9('0x9b')],'as':_0x8ff9('0xac'),'attributes':['name',_0x8ff9('0xad'),_0x8ff9('0xae')],'required':![]},{'model':db[_0x8ff9('0xaf')],'as':'Tags','attributes':['id',_0x8ff9('0x3c'),_0x8ff9('0xb0')],'where':_0x264571['query'][_0x8ff9('0xb1')]?{'id':_0x264571[_0x8ff9('0x44')][_0x8ff9('0xb1')]}:undefined,'required':_0x264571[_0x8ff9('0x44')][_0x8ff9('0xb1')]?!![]:![]}];}return db[_0x8ff9('0x92')][_0x8ff9('0x56')](_0x4b64fe);})['then'](function(_0x4e228){_0x36fc0c[_0x8ff9('0x57')]=_0x4e228;return _0x36fc0c;});}})[_0x8ff9('0x1f')](respondWithFilteredResult(_0x207af,_0x4b64fe))[_0x8ff9('0x2a')](handleError(_0x207af,null));};exports[_0x8ff9('0xb2')]=function(_0x48013e,_0x57fbbe,_0xc89829){return db['OpenchannelAccount'][_0x8ff9('0x66')]({'where':{'id':_0x48013e[_0x8ff9('0x59')]['id']}})[_0x8ff9('0x1f')](handleEntityNotFound(_0x57fbbe,null))[_0x8ff9('0x1f')](function(_0x4e8166){if(_0x4e8166){return _0x4e8166['addAgents'](_0x48013e[_0x8ff9('0x5e')][_0x8ff9('0x6d')],_[_0x8ff9('0xb3')](_0x48013e['body'],['ids','id'])||{})['spread'](function(_0x1947b4){for(var _0x71deb=0x0;_0x71deb<_0x48013e[_0x8ff9('0x5e')][_0x8ff9('0x6d')]['length'];_0x71deb+=0x1){socket[_0x8ff9('0xb4')]('userOpenchannelAccount:save',{'UserId':Number(_0x48013e[_0x8ff9('0x5e')][_0x8ff9('0x6d')][_0x71deb]),'OpenchannelAccountId':Number(_0x48013e[_0x8ff9('0x59')]['id'])});}return _0x1947b4;});}})['then'](respondWithResult(_0x57fbbe,null))['catch'](handleError(_0x57fbbe,null));};exports[_0x8ff9('0xb5')]=function(_0x218f5b,_0x5403cc,_0x2a5dea){return db[_0x8ff9('0x40')]['find']({'where':{'id':_0x218f5b[_0x8ff9('0x59')]['id']}})[_0x8ff9('0x1f')](handleEntityNotFound(_0x5403cc,null))['then'](function(_0x44560d){if(_0x44560d){return _0x44560d['removeAgents'](_0x218f5b[_0x8ff9('0x44')][_0x8ff9('0x6d')])[_0x8ff9('0x1f')](function(){if(_[_0x8ff9('0xb6')](_0x218f5b[_0x8ff9('0x44')][_0x8ff9('0x6d')])){for(var _0x390c14=0x0;_0x390c14<_0x218f5b[_0x8ff9('0x44')]['ids'][_0x8ff9('0x4a')];_0x390c14+=0x1){socket[_0x8ff9('0xb4')](_0x8ff9('0xb7'),{'UserId':Number(_0x218f5b[_0x8ff9('0x44')][_0x8ff9('0x6d')][_0x390c14]),'OpenchannelAccountId':Number(_0x218f5b['params']['id'])});}}else{socket[_0x8ff9('0xb4')](_0x8ff9('0xb7'),{'UserId':Number(_0x218f5b['query'][_0x8ff9('0x6d')]),'OpenchannelAccountId':Number(_0x218f5b[_0x8ff9('0x59')]['id'])});}});}})[_0x8ff9('0x1f')](respondWithStatusCode(_0x5403cc,null))[_0x8ff9('0x2a')](handleError(_0x5403cc,null));};exports['getAgents']=function(_0xac097f,_0x2d883a,_0x89efa0){var _0x2cf798={};var _0x4878e7={};var _0x1f3d00;var _0x2c0c7e;return db['OpenchannelAccount'][_0x8ff9('0x6a')]({'where':{'id':_0xac097f[_0x8ff9('0x59')]['id']}})['then'](handleEntityNotFound(_0x2d883a,null))['then'](function(_0x3afeab){if(_0x3afeab){_0x1f3d00=_0x3afeab;_0x4878e7[_0x8ff9('0x47')]=_[_0x8ff9('0x45')](db[_0x8ff9('0x9b')][_0x8ff9('0xa9')]);_0x4878e7['query']=_[_0x8ff9('0x45')](_0xac097f['query']);_0x4878e7[_0x8ff9('0x50')]=_[_0x8ff9('0x46')](_0x4878e7[_0x8ff9('0x47')],_0x4878e7[_0x8ff9('0x44')]);_0x2cf798[_0x8ff9('0x48')]=_[_0x8ff9('0x46')](_0x4878e7[_0x8ff9('0x47')],qs['fields'](_0xac097f[_0x8ff9('0x44')][_0x8ff9('0x49')]));_0x2cf798[_0x8ff9('0x48')]=_0x2cf798['attributes']['length']?_0x2cf798[_0x8ff9('0x48')]:_0x4878e7[_0x8ff9('0x47')];_0x2cf798['order']=qs['sort'](_0xac097f[_0x8ff9('0x44')][_0x8ff9('0x4e')]);_0x2cf798[_0x8ff9('0x53')]=qs[_0x8ff9('0x50')](_['pick'](_0xac097f[_0x8ff9('0x44')],_0x4878e7[_0x8ff9('0x50')]));if(_0xac097f[_0x8ff9('0x44')]['filter']){_0x2cf798[_0x8ff9('0x53')]=_['merge'](_0x2cf798[_0x8ff9('0x53')],{'$or':_[_0x8ff9('0x3f')](_0x2cf798[_0x8ff9('0x48')],function(_0x4d74f6){var _0x3f83d5={};_0x3f83d5[_0x4d74f6]={'$like':'%'+_0xac097f[_0x8ff9('0x44')][_0x8ff9('0x51')]+'%'};return _0x3f83d5;})});}_0x2cf798=_[_0x8ff9('0x52')]({},_0x2cf798,_0xac097f[_0x8ff9('0x5c')]);return _0x1f3d00[_0x8ff9('0xb8')](_0x2cf798);}})[_0x8ff9('0x1f')](function(_0x290cfa){if(_0x290cfa){_0x2c0c7e=_0x290cfa[_0x8ff9('0x4a')];if(!_0xac097f['query'][_0x8ff9('0x4b')]('nolimit')){_0x2cf798['limit']=qs[_0x8ff9('0x30')](_0xac097f['query'][_0x8ff9('0x30')]);_0x2cf798[_0x8ff9('0x2e')]=qs[_0x8ff9('0x2e')](_0xac097f[_0x8ff9('0x44')][_0x8ff9('0x2e')]);}return _0x1f3d00[_0x8ff9('0xb8')](_0x2cf798);}})[_0x8ff9('0x1f')](function(_0x3f74ac){if(_0x3f74ac){return _0x3f74ac?{'count':_0x2c0c7e,'rows':_0x3f74ac}:null;}})[_0x8ff9('0x1f')](respondWithResult(_0x2d883a,null))[_0x8ff9('0x2a')](handleError(_0x2d883a,null));};exports[_0x8ff9('0x3d')]=function(_0xc6046f,_0xbe392d,_0x24aeac){var _0x28efb8,_0x4261dc,_0x592b1e;if(_[_0x8ff9('0x7b')](_0xc6046f[_0x8ff9('0x5e')]['body'])||_0xc6046f[_0x8ff9('0x5e')][_0x8ff9('0x5e')]===''){throw new db[(_0x8ff9('0x74'))][(_0x8ff9('0x75'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x8ff9('0x7b')](_0xc6046f[_0x8ff9('0x5e')]['to'])){}_0x28efb8=_0xc6046f[_0x8ff9('0x5e')]['to'];return db['OpenchannelAccount'][_0x8ff9('0x6a')]({'where':{'id':_0xc6046f[_0x8ff9('0x59')]['id']}})['then'](handleEntityNotFound(_0xbe392d,null))[_0x8ff9('0x1f')](function(_0x17a7c2){if(_0x17a7c2){return db[_0x8ff9('0x40')][_0x8ff9('0x66')]({'where':{'id':_0x17a7c2['id']},'include':[{'model':db[_0x8ff9('0x7f')],'as':_0x8ff9('0x80'),'include':[{'model':db[_0x8ff9('0x73')],'as':'Contacts','where':{[_0x17a7c2['mapKey']]:_0x28efb8},'limit':0x1,'order':[[_0x8ff9('0x79'),_0x8ff9('0x82')]]}]}]})[_0x8ff9('0x1f')](handleEntityNotFound(_0xbe392d,null))['then'](function(_0x1a3ce2){if(_0x1a3ce2&&_0x1a3ce2[_0x8ff9('0x80')]){_0x4261dc=_0x1a3ce2[_0x8ff9('0x60')]({'plain':!![]});if(_0x4261dc['List']&&_0x4261dc[_0x8ff9('0x80')][_0x8ff9('0x81')]['length']){return _0x4261dc['List']['Contacts'][0x0];}return db['CmContact'][_0x8ff9('0x5d')](_['defaults'](_0xc6046f['body'],{'firstName':_0x28efb8,[_0x1a3ce2[_0x8ff9('0x7d')]]:_0x28efb8,'phone':_0x28efb8,'ListId':_0x4261dc[_0x8ff9('0x8b')]}));}})['then'](handleEntityNotFound(_0xbe392d,null))['then'](function(_0x54c28e){if(_0x54c28e){_0x592b1e=_0x54c28e;return db['OpenchannelInteraction'][_0x8ff9('0x66')]({'where':{'ContactId':_0x592b1e['id'],'closed':![],'OpenchannelAccountId':_0x4261dc['id']}})[_0x8ff9('0x1f')](function(_0x2f7cb5){if(_0x2f7cb5){return[_0x2f7cb5,![]];}return db['OpenchannelInteraction'][_0x8ff9('0x5d')]({'UserId':_0xc6046f[_0x8ff9('0x5f')]['id'],'ContactId':_0x592b1e['id'],'OpenchannelAccountId':_0x4261dc['id'],'lastMsgDirection':_0x8ff9('0xb9'),'Messages':[_[_0x8ff9('0x52')](_0xc6046f[_0x8ff9('0x5e')],{'read':![],'body':_0xc6046f[_0x8ff9('0x5e')][_0x8ff9('0x5e')],'OpenchannelAccountId':_0x4261dc['id'],'UserId':_0xc6046f['user']['id'],'ContactId':_0x592b1e['id']})]},{'include':[{'model':db[_0x8ff9('0xba')],'as':_0x8ff9('0xbb')}]})[_0x8ff9('0x1f')](function(_0x413b9e){return[_0x413b9e,!![]];});});}})[_0x8ff9('0x93')](function(_0x4cfc5a,_0x4e1748){if(_0x4e1748){return _0x4cfc5a;}return db[_0x8ff9('0xba')][_0x8ff9('0x5d')](_['merge'](_0xc6046f[_0x8ff9('0x5e')],{'read':![],'body':_0xc6046f['body'][_0x8ff9('0x5e')],'OpenchannelAccountId':_0x4261dc['id'],'OpenchannelInteractionId':_0x4cfc5a['id'],'UserId':_0xc6046f[_0x8ff9('0x5f')]['id'],'ContactId':_0x592b1e['id']}))[_0x8ff9('0x1f')](function(_0xbe75ef){_0x4cfc5a[_0x8ff9('0xbc')][_0x8ff9('0xbb')]=[];_0x4cfc5a[_0x8ff9('0xbc')][_0x8ff9('0xbb')][_0x8ff9('0x97')](_0xbe75ef[_0x8ff9('0xbc')]);return _0x4cfc5a;});});}})[_0x8ff9('0x1f')](respondWithResult(_0xbe392d,null))[_0x8ff9('0x2a')](handleError(_0xbe392d,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 123a4d5..9371a90 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 _0x4ea3=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','setMaxListeners','update'];(function(_0xd2c332,_0x1b5f38){var _0x4efc6f=function(_0x56d70c){while(--_0x56d70c){_0xd2c332['push'](_0xd2c332['shift']());}};_0x4efc6f(++_0x1b5f38);}(_0x4ea3,0x70));var _0x34ea=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4ea3[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x34ea('0x0'));var OpenchannelAccount=require(_0x34ea('0x1'))['db'][_0x34ea('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x34ea('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x34ea('0x4'),'afterDestroy':'remove'};function emitEvent(_0x269d4c){return function(_0x571f1b,_0x5e5a84,_0x2ce955){OpenchannelAccountEvents[_0x34ea('0x5')](_0x269d4c+':'+_0x571f1b['id'],_0x571f1b);OpenchannelAccountEvents[_0x34ea('0x5')](_0x269d4c,_0x571f1b);_0x2ce955(null);};}for(var e in events){if(events[_0x34ea('0x6')](e)){var event=events[e];OpenchannelAccount[_0x34ea('0x7')](e,emitEvent(event));}}module[_0x34ea('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xdace=['save','remove','emit','hasOwnProperty','exports','events','OpenchannelAccount','setMaxListeners'];(function(_0xfb0281,_0x3ff38b){var _0x408dd3=function(_0x5d8017){while(--_0x5d8017){_0xfb0281['push'](_0xfb0281['shift']());}};_0x408dd3(++_0x3ff38b);}(_0xdace,0xc5));var _0xedac=function(_0xa388a2,_0x40bde6){_0xa388a2=_0xa388a2-0x0;var _0x7ce7f6=_0xdace[_0xa388a2];return _0x7ce7f6;};'use strict';var EventEmitter=require(_0xedac('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0xedac('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xedac('0x2')](0x0);var events={'afterCreate':_0xedac('0x3'),'afterUpdate':'update','afterDestroy':_0xedac('0x4')};function emitEvent(_0x36bcd2){return function(_0x15d3bd,_0xefb142,_0x5a97c0){OpenchannelAccountEvents[_0xedac('0x5')](_0x36bcd2+':'+_0x15d3bd['id'],_0x15d3bd);OpenchannelAccountEvents[_0xedac('0x5')](_0x36bcd2,_0x15d3bd);_0x5a97c0(null);};}for(var e in events){if(events[_0xedac('0x6')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0xedac('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index b661527..c4b0b99 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(_0x29d2a8,_0x102796){var _0x442be2=function(_0x2d586a){while(--_0x2d586a){_0x29d2a8['push'](_0x29d2a8['shift']());}};_0x442be2(++_0x102796);}(_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 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(_0x489fba,_0x137bfe){var _0x5068fc=function(_0x557076){while(--_0x557076){_0x489fba['push'](_0x489fba['shift']());}};_0x5068fc(++_0x137bfe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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 93fd634..12be6de 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 _0xc901=['info','OpenchannelAccount,\x20%s,\x20%s','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelAccount.socket','register'];(function(_0x55ba2a,_0x4df633){var _0x3a41ee=function(_0x241916){while(--_0x241916){_0x55ba2a['push'](_0x55ba2a['shift']());}};_0x3a41ee(++_0x4df633);}(_0xc901,0x142));var _0x1c90=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc901[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x1c90('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c90('0x1'));var db=require(_0x1c90('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x1c90('0x3'))(_0x1c90('0x4'));var config=require(_0x1c90('0x5'));var jayson=require(_0x1c90('0x6'));var client=jayson[_0x1c90('0x7')][_0x1c90('0x8')]({'port':0x232a});config[_0x1c90('0x9')]=_[_0x1c90('0xa')](config[_0x1c90('0x9')],{'host':_0x1c90('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1c90('0x9')]));require(_0x1c90('0xc'))[_0x1c90('0xd')](socket);function respondWithRpcPromise(_0x1f2c61,_0x374852,_0x66c02){return new BPromise(function(_0x616ad0,_0x3890e1){return client['request'](_0x1f2c61,_0x66c02)['then'](function(_0x17d8ae){logger[_0x1c90('0xe')](_0x1c90('0xf'),_0x374852,'request\x20sent');logger['debug'](_0x1c90('0x10'),_0x374852,_0x1c90('0x11'),JSON['stringify'](_0x17d8ae));if(_0x17d8ae[_0x1c90('0x12')]){if(_0x17d8ae[_0x1c90('0x12')][_0x1c90('0x13')]===0x1f4){logger['error'](_0x1c90('0xf'),_0x374852,_0x17d8ae['error'][_0x1c90('0x14')]);return _0x3890e1(_0x17d8ae[_0x1c90('0x12')][_0x1c90('0x14')]);}logger[_0x1c90('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x374852,_0x17d8ae[_0x1c90('0x12')]['message']);return _0x616ad0(_0x17d8ae[_0x1c90('0x12')][_0x1c90('0x14')]);}else{logger['info'](_0x1c90('0xf'),_0x374852,'request\x20sent');_0x616ad0(_0x17d8ae['result'][_0x1c90('0x14')]);}})['catch'](function(_0x341228){logger[_0x1c90('0x12')](_0x1c90('0xf'),_0x374852,_0x341228);_0x3890e1(_0x341228);});});} \ No newline at end of file +var _0x6215=['OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','info'];(function(_0x38201c,_0x3ad0d4){var _0x11234e=function(_0x3be722){while(--_0x3be722){_0x38201c['push'](_0x38201c['shift']());}};_0x11234e(++_0x3ad0d4);}(_0x6215,0x198));var _0x5621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6215[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5621('0x0'));var util=require(_0x5621('0x1'));var moment=require(_0x5621('0x2'));var BPromise=require('bluebird');var rs=require(_0x5621('0x3'));var fs=require('fs');var Redis=require(_0x5621('0x4'));var db=require(_0x5621('0x5'))['db'];var utils=require(_0x5621('0x6'));var logger=require(_0x5621('0x7'))(_0x5621('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x5621('0x9')]=_[_0x5621('0xa')](config[_0x5621('0x9')],{'host':_0x5621('0xb'),'port':0x18eb});var socket=require(_0x5621('0xc'))(new Redis(config['redis']));require(_0x5621('0xd'))[_0x5621('0xe')](socket);function respondWithRpcPromise(_0x3aa022,_0x418114,_0x53625c){return new BPromise(function(_0x1f4148,_0x10bb32){return client[_0x5621('0xf')](_0x3aa022,_0x53625c)['then'](function(_0x2b0f51){logger[_0x5621('0x10')](_0x5621('0x11'),_0x418114,_0x5621('0x12'));logger[_0x5621('0x13')](_0x5621('0x14'),_0x418114,_0x5621('0x12'),JSON[_0x5621('0x15')](_0x2b0f51));if(_0x2b0f51[_0x5621('0x16')]){if(_0x2b0f51[_0x5621('0x16')]['code']===0x1f4){logger[_0x5621('0x16')](_0x5621('0x11'),_0x418114,_0x2b0f51[_0x5621('0x16')]['message']);return _0x10bb32(_0x2b0f51[_0x5621('0x16')][_0x5621('0x17')]);}logger['error'](_0x5621('0x11'),_0x418114,_0x2b0f51[_0x5621('0x16')][_0x5621('0x17')]);return _0x1f4148(_0x2b0f51[_0x5621('0x16')][_0x5621('0x17')]);}else{logger[_0x5621('0x10')](_0x5621('0x11'),_0x418114,_0x5621('0x12'));_0x1f4148(_0x2b0f51[_0x5621('0x18')][_0x5621('0x17')]);}})['catch'](function(_0x1111b2){logger[_0x5621('0x16')]('OpenchannelAccount,\x20%s,\x20%s',_0x418114,_0x1111b2);_0x10bb32(_0x1111b2);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index e7c8b4a..a97ca35 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 _0xaefc=['./openchannelAccount.events','save','remove','length','openchannelAccount:'];(function(_0xa61bdc,_0x1d9fc0){var _0x5d25c9=function(_0x465591){while(--_0x465591){_0xa61bdc['push'](_0xa61bdc['shift']());}};_0x5d25c9(++_0x1d9fc0);}(_0xaefc,0xc8));var _0xcaef=function(_0x13b7d2,_0x46c7c5){_0x13b7d2=_0x13b7d2-0x0;var _0x279e13=_0xaefc[_0x13b7d2];return _0x279e13;};'use strict';var OpenchannelAccountEvents=require(_0xcaef('0x0'));var events=[_0xcaef('0x1'),_0xcaef('0x2'),'update'];function createListener(_0x1da249,_0xd60229){return function(_0x49cc54){_0xd60229['emit'](_0x1da249,_0x49cc54);};}function removeListener(_0x37a134,_0x46a35e){return function(){OpenchannelAccountEvents['removeListener'](_0x37a134,_0x46a35e);};}exports['register']=function(_0x47457d){for(var _0x4471a1=0x0,_0x567a8f=events[_0xcaef('0x3')];_0x4471a1<_0x567a8f;_0x4471a1++){var _0x538f22=events[_0x4471a1];var _0x49d64c=createListener(_0xcaef('0x4')+_0x538f22,_0x47457d);OpenchannelAccountEvents['on'](_0x538f22,_0x49d64c);}}; \ No newline at end of file +var _0x4b8a=['openchannelAccount:','save','update','emit','removeListener','register','length'];(function(_0x59840e,_0x5b13d2){var _0xe1899d=function(_0x9f0bb6){while(--_0x9f0bb6){_0x59840e['push'](_0x59840e['shift']());}};_0xe1899d(++_0x5b13d2);}(_0x4b8a,0xd3));var _0xa4b8=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4b8a[_0x167cc1];return _0x10bc4b;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0xa4b8('0x0'),'remove',_0xa4b8('0x1')];function createListener(_0x3ed3b6,_0x20eea6){return function(_0x34c820){_0x20eea6[_0xa4b8('0x2')](_0x3ed3b6,_0x34c820);};}function removeListener(_0x3a22d1,_0xb147cb){return function(){OpenchannelAccountEvents[_0xa4b8('0x3')](_0x3a22d1,_0xb147cb);};}exports[_0xa4b8('0x4')]=function(_0x719605){for(var _0x2c9e45=0x0,_0x2de84d=events[_0xa4b8('0x5')];_0x2c9e45<_0x2de84d;_0x2c9e45++){var _0x1fea78=events[_0x2c9e45];var _0x517970=createListener(_0xa4b8('0x6')+_0x1fea78,_0x719605);OpenchannelAccountEvents['on'](_0x1fea78,_0x517970);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 847aac8..18e3347 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 _0x10d3=['util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','create','update','delete','destroy','exports','multer'];(function(_0x327c69,_0x27e755){var _0x49c1af=function(_0x21f59e){while(--_0x21f59e){_0x327c69['push'](_0x327c69['shift']());}};_0x49c1af(++_0x27e755);}(_0x10d3,0xff));var _0x310d=function(_0x5babe6,_0x3b7b70){_0x5babe6=_0x5babe6-0x0;var _0x40f6af=_0x10d3[_0x5babe6];return _0x40f6af;};'use strict';var multer=require(_0x310d('0x0'));var util=require(_0x310d('0x1'));var path=require('path');var timeout=require(_0x310d('0x2'));var express=require('express');var router=express[_0x310d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x310d('0x4'));var interaction=require(_0x310d('0x5'));var config=require(_0x310d('0x6'));var controller=require('./openchannelApplication.controller');router['get']('/',auth[_0x310d('0x7')](),controller['index']);router[_0x310d('0x8')](_0x310d('0x9'),auth[_0x310d('0x7')](),controller[_0x310d('0xa')]);router['post']('/',auth[_0x310d('0x7')](),controller[_0x310d('0xb')]);router['put'](_0x310d('0x9'),auth[_0x310d('0x7')](),controller[_0x310d('0xc')]);router[_0x310d('0xd')]('/:id',auth[_0x310d('0x7')](),controller[_0x310d('0xe')]);module[_0x310d('0xf')]=router; \ No newline at end of file +var _0xd6c9=['./openchannelApplication.controller','isAuthenticated','index','/:id','show','post','create','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xa72f73,_0x8058d1){var _0x190264=function(_0x547589){while(--_0x547589){_0xa72f73['push'](_0xa72f73['shift']());}};_0x190264(++_0x8058d1);}(_0xd6c9,0xac));var _0x9d6c=function(_0x15c19a,_0xd4667b){_0x15c19a=_0x15c19a-0x0;var _0x3290d9=_0xd6c9[_0x15c19a];return _0x3290d9;};'use strict';var multer=require(_0x9d6c('0x0'));var util=require(_0x9d6c('0x1'));var path=require(_0x9d6c('0x2'));var timeout=require(_0x9d6c('0x3'));var express=require(_0x9d6c('0x4'));var router=express[_0x9d6c('0x5')]();var fs_extra=require(_0x9d6c('0x6'));var auth=require(_0x9d6c('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9d6c('0x8'));router['get']('/',auth[_0x9d6c('0x9')](),controller[_0x9d6c('0xa')]);router['get'](_0x9d6c('0xb'),auth[_0x9d6c('0x9')](),controller[_0x9d6c('0xc')]);router[_0x9d6c('0xd')]('/',auth[_0x9d6c('0x9')](),controller[_0x9d6c('0xe')]);router[_0x9d6c('0xf')](_0x9d6c('0xb'),auth['isAuthenticated'](),controller[_0x9d6c('0x10')]);router[_0x9d6c('0x11')](_0x9d6c('0xb'),auth[_0x9d6c('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 220e176..054aab9 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 _0x65b0=['sequelize','exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x676335,_0x187b50){var _0x3b3628=function(_0x31d5eb){while(--_0x31d5eb){_0x676335['push'](_0x676335['shift']());}};_0x3b3628(++_0x187b50);}(_0x65b0,0x8a));var _0x065b=function(_0x1ca998,_0x581ddc){_0x1ca998=_0x1ca998-0x0;var _0x13f9ca=_0x65b0[_0x1ca998];return _0x13f9ca;};'use strict';var Sequelize=require(_0x065b('0x0'));module[_0x065b('0x1')]={'priority':{'type':Sequelize[_0x065b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x065b('0x3')],'allowNull':![],'defaultValue':_0x065b('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x065b('0x3')]},'interval':{'type':Sequelize[_0x065b('0x3')],'defaultValue':_0x065b('0x5')}}; \ No newline at end of file +var _0xe8ec=['sequelize','exports','INTEGER','STRING','noop'];(function(_0x615319,_0x162199){var _0x1135f5=function(_0x590824){while(--_0x590824){_0x615319['push'](_0x615319['shift']());}};_0x1135f5(++_0x162199);}(_0xe8ec,0x172));var _0xce8e=function(_0x71ae55,_0x277835){_0x71ae55=_0x71ae55-0x0;var _0x71fc81=_0xe8ec[_0x71ae55];return _0x71fc81;};'use strict';var Sequelize=require(_0xce8e('0x0'));module[_0xce8e('0x1')]={'priority':{'type':Sequelize[_0xce8e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xce8e('0x3')],'allowNull':![],'defaultValue':_0xce8e('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xce8e('0x3')]},'interval':{'type':Sequelize[_0xce8e('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 ed89732..d67c9da 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 _0x3d53=['nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','rows','show','params','rawAttributes','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','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/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','then','destroy','error','name','send','map','OpenchannelApplication','fieldName','key','model','keys','query','intersection','attributes','fields','length'];(function(_0x371a32,_0x2886d3){var _0x2077da=function(_0x2655e6){while(--_0x2655e6){_0x371a32['push'](_0x371a32['shift']());}};_0x2077da(++_0x2886d3);}(_0x3d53,0xf3));var _0x33d5=function(_0x4bf96c,_0x4d24fd){_0x4bf96c=_0x4bf96c-0x0;var _0x281d09=_0x3d53[_0x4bf96c];return _0x281d09;};'use strict';var emlformat=require(_0x33d5('0x0'));var rimraf=require(_0x33d5('0x1'));var zipdir=require(_0x33d5('0x2'));var jsonpatch=require(_0x33d5('0x3'));var rp=require('request-promise');var moment=require(_0x33d5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x33d5('0x5'));var path=require(_0x33d5('0x6'));var sox=require(_0x33d5('0x7'));var csv=require(_0x33d5('0x8'));var ejs=require(_0x33d5('0x9'));var fs=require('fs');var fs_extra=require(_0x33d5('0xa'));var _=require(_0x33d5('0xb'));var squel=require(_0x33d5('0xc'));var crypto=require(_0x33d5('0xd'));var jsforce=require(_0x33d5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x33d5('0x8'));var querystring=require(_0x33d5('0xf'));var Papa=require(_0x33d5('0x10'));var Redis=require(_0x33d5('0x11'));var authService=require(_0x33d5('0x12'));var qs=require(_0x33d5('0x13'));var as=require(_0x33d5('0x14'));var hardwareService=require(_0x33d5('0x15'));var logger=require(_0x33d5('0x16'))(_0x33d5('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x33d5('0x18'));var db=require(_0x33d5('0x19'))['db'];function respondWithStatusCode(_0x36aae4,_0x25a029){_0x25a029=_0x25a029||0xcc;return function(_0x3dd0b5){if(_0x3dd0b5){return _0x36aae4[_0x33d5('0x1a')](_0x25a029);}return _0x36aae4['status'](_0x25a029)[_0x33d5('0x1b')]();};}function respondWithResult(_0x239d3e,_0xda8b1d){_0xda8b1d=_0xda8b1d||0xc8;return function(_0x462f63){if(_0x462f63){return _0x239d3e[_0x33d5('0x1c')](_0xda8b1d)[_0x33d5('0x1d')](_0x462f63);}};}function respondWithFilteredResult(_0x5f48cd,_0x213620){return function(_0x452252){if(_0x452252){var _0xe205aa=typeof _0x213620[_0x33d5('0x1e')]===_0x33d5('0x1f')&&typeof _0x213620['limit']===_0x33d5('0x1f');var _0x3e1263=_0x452252['count'];var _0x1f94bd=_0xe205aa?0x0:_0x213620['offset'];var _0x37c602=_0xe205aa?_0x452252[_0x33d5('0x20')]:_0x213620[_0x33d5('0x1e')]+_0x213620['limit'];var _0x80f39;if(_0x37c602>=_0x3e1263){_0x37c602=_0x3e1263;_0x80f39=0xc8;}else{_0x80f39=0xce;}_0x5f48cd[_0x33d5('0x1c')](_0x80f39);return _0x5f48cd[_0x33d5('0x21')](_0x33d5('0x22'),_0x1f94bd+'-'+_0x37c602+'/'+_0x3e1263)[_0x33d5('0x1d')](_0x452252);}return null;};}function patchUpdates(_0x5dc9d6){return function(_0x58e43d){try{jsonpatch[_0x33d5('0x23')](_0x58e43d,_0x5dc9d6,!![]);}catch(_0x36e68e){return BPromise[_0x33d5('0x24')](_0x36e68e);}return _0x58e43d['save']();};}function saveUpdates(_0x5dee82,_0x2093bb){return function(_0x2591fa){if(_0x2591fa){return _0x2591fa['update'](_0x5dee82)[_0x33d5('0x25')](function(_0x13a845){return _0x13a845;});}return null;};}function removeEntity(_0x499fc7,_0x4bc8d8){return function(_0x4e17fc){if(_0x4e17fc){return _0x4e17fc[_0x33d5('0x26')]()['then'](function(){_0x499fc7[_0x33d5('0x1c')](0xcc)[_0x33d5('0x1b')]();});}};}function handleEntityNotFound(_0x42cc14,_0x3d8ebc){return function(_0x1ce811){if(!_0x1ce811){_0x42cc14['sendStatus'](0x194);}return _0x1ce811;};}function handleError(_0x3e256e,_0x28887a){_0x28887a=_0x28887a||0x1f4;return function(_0x205c25){logger[_0x33d5('0x27')](_0x205c25['stack']);if(_0x205c25[_0x33d5('0x28')]){delete _0x205c25['name'];}_0x3e256e[_0x33d5('0x1c')](_0x28887a)[_0x33d5('0x29')](_0x205c25);};}exports['index']=function(_0x45b06a,_0x3c15ac){var _0x5620f5={},_0x53e327={},_0x1d4972={'count':0x0,'rows':[]};var _0x24bf11=_[_0x33d5('0x2a')](db[_0x33d5('0x2b')]['rawAttributes'],function(_0x3b3f7a){return{'name':_0x3b3f7a[_0x33d5('0x2c')],'type':_0x3b3f7a['type'][_0x33d5('0x2d')]};});_0x53e327[_0x33d5('0x2e')]=_[_0x33d5('0x2a')](_0x24bf11,'name');_0x53e327['query']=_[_0x33d5('0x2f')](_0x45b06a[_0x33d5('0x30')]);_0x53e327['filters']=_[_0x33d5('0x31')](_0x53e327[_0x33d5('0x2e')],_0x53e327[_0x33d5('0x30')]);_0x5620f5[_0x33d5('0x32')]=_['intersection'](_0x53e327[_0x33d5('0x2e')],qs[_0x33d5('0x33')](_0x45b06a[_0x33d5('0x30')][_0x33d5('0x33')]));_0x5620f5[_0x33d5('0x32')]=_0x5620f5[_0x33d5('0x32')][_0x33d5('0x34')]?_0x5620f5[_0x33d5('0x32')]:_0x53e327[_0x33d5('0x2e')];if(!_0x45b06a['query']['hasOwnProperty'](_0x33d5('0x35'))){_0x5620f5[_0x33d5('0x36')]=qs[_0x33d5('0x36')](_0x45b06a[_0x33d5('0x30')]['limit']);_0x5620f5['offset']=qs[_0x33d5('0x1e')](_0x45b06a[_0x33d5('0x30')][_0x33d5('0x1e')]);}_0x5620f5[_0x33d5('0x37')]=qs[_0x33d5('0x38')](_0x45b06a[_0x33d5('0x30')][_0x33d5('0x38')]);_0x5620f5[_0x33d5('0x39')]=qs[_0x33d5('0x3a')](_[_0x33d5('0x3b')](_0x45b06a[_0x33d5('0x30')],_0x53e327['filters']),_0x24bf11);if(_0x45b06a[_0x33d5('0x30')][_0x33d5('0x3c')]){_0x5620f5['where']=_[_0x33d5('0x3d')](_0x5620f5[_0x33d5('0x39')],{'$or':_[_0x33d5('0x2a')](_0x24bf11,function(_0x3ce595){if(_0x3ce595['type']!==_0x33d5('0x3e')){var _0x372016={};_0x372016[_0x3ce595[_0x33d5('0x28')]]={'$like':'%'+_0x45b06a[_0x33d5('0x30')]['filter']+'%'};return _0x372016;}})});}_0x5620f5=_[_0x33d5('0x3d')]({},_0x5620f5,_0x45b06a[_0x33d5('0x3f')]);var _0x34095b={'where':_0x5620f5[_0x33d5('0x39')]};return db[_0x33d5('0x2b')]['count'](_0x34095b)['then'](function(_0x15c8a4){_0x1d4972[_0x33d5('0x20')]=_0x15c8a4;if(_0x45b06a[_0x33d5('0x30')]['includeAll']){_0x5620f5[_0x33d5('0x40')]=[{'all':!![]}];}return db['OpenchannelApplication']['findAll'](_0x5620f5);})['then'](function(_0xaf7bed){_0x1d4972[_0x33d5('0x41')]=_0xaf7bed;return _0x1d4972;})[_0x33d5('0x25')](respondWithFilteredResult(_0x3c15ac,_0x5620f5))['catch'](handleError(_0x3c15ac,null));};exports[_0x33d5('0x42')]=function(_0x1a1e06,_0x32d8d9){var _0x25e9a2={'raw':!![],'where':{'id':_0x1a1e06[_0x33d5('0x43')]['id']}},_0x1931f5={};_0x1931f5[_0x33d5('0x2e')]=_[_0x33d5('0x2f')](db['OpenchannelApplication'][_0x33d5('0x44')]);_0x1931f5[_0x33d5('0x30')]=_['keys'](_0x1a1e06[_0x33d5('0x30')]);_0x1931f5[_0x33d5('0x3a')]=_[_0x33d5('0x31')](_0x1931f5[_0x33d5('0x2e')],_0x1931f5['query']);_0x25e9a2[_0x33d5('0x32')]=_[_0x33d5('0x31')](_0x1931f5[_0x33d5('0x2e')],qs[_0x33d5('0x33')](_0x1a1e06['query'][_0x33d5('0x33')]));_0x25e9a2[_0x33d5('0x32')]=_0x25e9a2[_0x33d5('0x32')][_0x33d5('0x34')]?_0x25e9a2[_0x33d5('0x32')]:_0x1931f5['model'];if(_0x1a1e06['query']['includeAll']){_0x25e9a2['include']=[{'all':!![]}];}_0x25e9a2=_[_0x33d5('0x3d')]({},_0x25e9a2,_0x1a1e06[_0x33d5('0x3f')]);return db[_0x33d5('0x2b')][_0x33d5('0x45')](_0x25e9a2)['then'](handleEntityNotFound(_0x32d8d9,null))[_0x33d5('0x25')](respondWithResult(_0x32d8d9,null))[_0x33d5('0x46')](handleError(_0x32d8d9,null));};exports['create']=function(_0x3c2de4,_0x4e9af6){return db[_0x33d5('0x2b')][_0x33d5('0x47')](_0x3c2de4[_0x33d5('0x48')],{})['then'](respondWithResult(_0x4e9af6,0xc9))['catch'](handleError(_0x4e9af6,null));};exports[_0x33d5('0x49')]=function(_0x48ec2d,_0x2c1381){if(_0x48ec2d[_0x33d5('0x48')]['id']){delete _0x48ec2d['body']['id'];}return db[_0x33d5('0x2b')]['find']({'where':{'id':_0x48ec2d[_0x33d5('0x43')]['id']}})[_0x33d5('0x25')](handleEntityNotFound(_0x2c1381,null))['then'](saveUpdates(_0x48ec2d[_0x33d5('0x48')],null))['then'](respondWithResult(_0x2c1381,null))[_0x33d5('0x46')](handleError(_0x2c1381,null));};exports[_0x33d5('0x26')]=function(_0x51709,_0x37927b){return db[_0x33d5('0x2b')]['find']({'where':{'id':_0x51709[_0x33d5('0x43')]['id']}})['then'](handleEntityNotFound(_0x37927b,null))[_0x33d5('0x25')](removeEntity(_0x37927b,null))[_0x33d5('0x46')](handleError(_0x37927b,null));}; \ No newline at end of file +var _0xb16f=['catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show'];(function(_0x2f2a79,_0x239139){var _0x2d30c1=function(_0x5e26c9){while(--_0x5e26c9){_0x2f2a79['push'](_0x2f2a79['shift']());}};_0x2d30c1(++_0x239139);}(_0xb16f,0x1ae));var _0xfb16=function(_0x1af8d3,_0x544d86){_0x1af8d3=_0x1af8d3-0x0;var _0x3a50c5=_0xb16f[_0x1af8d3];return _0x3a50c5;};'use strict';var emlformat=require(_0xfb16('0x0'));var rimraf=require(_0xfb16('0x1'));var zipdir=require(_0xfb16('0x2'));var jsonpatch=require(_0xfb16('0x3'));var rp=require(_0xfb16('0x4'));var moment=require(_0xfb16('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfb16('0x6'));var util=require('util');var path=require(_0xfb16('0x7'));var sox=require('sox');var csv=require(_0xfb16('0x8'));var ejs=require(_0xfb16('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfb16('0xa'));var crypto=require(_0xfb16('0xb'));var jsforce=require(_0xfb16('0xc'));var deskjs=require(_0xfb16('0xd'));var toCsv=require(_0xfb16('0x8'));var querystring=require(_0xfb16('0xe'));var Papa=require(_0xfb16('0xf'));var Redis=require(_0xfb16('0x10'));var authService=require(_0xfb16('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfb16('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfb16('0x13'))(_0xfb16('0x14'));var utils=require(_0xfb16('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfb16('0x16'))['db'];function respondWithStatusCode(_0x3cecf7,_0x410ec2){_0x410ec2=_0x410ec2||0xcc;return function(_0x45dd21){if(_0x45dd21){return _0x3cecf7[_0xfb16('0x17')](_0x410ec2);}return _0x3cecf7[_0xfb16('0x18')](_0x410ec2)[_0xfb16('0x19')]();};}function respondWithResult(_0x135326,_0x21f2c9){_0x21f2c9=_0x21f2c9||0xc8;return function(_0x842c9a){if(_0x842c9a){return _0x135326[_0xfb16('0x18')](_0x21f2c9)[_0xfb16('0x1a')](_0x842c9a);}};}function respondWithFilteredResult(_0x3cecf5,_0x2310d8){return function(_0x207619){if(_0x207619){var _0x45e2d7=typeof _0x2310d8[_0xfb16('0x1b')]==='undefined'&&typeof _0x2310d8[_0xfb16('0x1c')]===_0xfb16('0x1d');var _0x323ca7=_0x207619['count'];var _0x683f54=_0x45e2d7?0x0:_0x2310d8[_0xfb16('0x1b')];var _0x25b33b=_0x45e2d7?_0x207619[_0xfb16('0x1e')]:_0x2310d8['offset']+_0x2310d8[_0xfb16('0x1c')];var _0x576b2f;if(_0x25b33b>=_0x323ca7){_0x25b33b=_0x323ca7;_0x576b2f=0xc8;}else{_0x576b2f=0xce;}_0x3cecf5[_0xfb16('0x18')](_0x576b2f);return _0x3cecf5[_0xfb16('0x1f')](_0xfb16('0x20'),_0x683f54+'-'+_0x25b33b+'/'+_0x323ca7)[_0xfb16('0x1a')](_0x207619);}return null;};}function patchUpdates(_0x325a5e){return function(_0x4df203){try{jsonpatch['apply'](_0x4df203,_0x325a5e,!![]);}catch(_0x5522ee){return BPromise[_0xfb16('0x21')](_0x5522ee);}return _0x4df203['save']();};}function saveUpdates(_0x1c61e4,_0x1a3e89){return function(_0x12a1a4){if(_0x12a1a4){return _0x12a1a4[_0xfb16('0x22')](_0x1c61e4)[_0xfb16('0x23')](function(_0x3119f8){return _0x3119f8;});}return null;};}function removeEntity(_0x1d9fb4,_0x2c9201){return function(_0x68ced6){if(_0x68ced6){return _0x68ced6[_0xfb16('0x24')]()[_0xfb16('0x23')](function(){_0x1d9fb4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x113c70,_0x2cf686){return function(_0x4c6ce5){if(!_0x4c6ce5){_0x113c70['sendStatus'](0x194);}return _0x4c6ce5;};}function handleError(_0x38ea34,_0x3fc3b1){_0x3fc3b1=_0x3fc3b1||0x1f4;return function(_0x490ef6){logger['error'](_0x490ef6['stack']);if(_0x490ef6[_0xfb16('0x25')]){delete _0x490ef6[_0xfb16('0x25')];}_0x38ea34['status'](_0x3fc3b1)[_0xfb16('0x26')](_0x490ef6);};}exports[_0xfb16('0x27')]=function(_0x3a1ff9,_0x37e610){var _0x58515a={},_0x110924={},_0x48d1bc={'count':0x0,'rows':[]};var _0x105078=_[_0xfb16('0x28')](db[_0xfb16('0x29')][_0xfb16('0x2a')],function(_0xe9cfa0){return{'name':_0xe9cfa0[_0xfb16('0x2b')],'type':_0xe9cfa0[_0xfb16('0x2c')][_0xfb16('0x2d')]};});_0x110924['model']=_[_0xfb16('0x28')](_0x105078,_0xfb16('0x25'));_0x110924[_0xfb16('0x2e')]=_[_0xfb16('0x2f')](_0x3a1ff9[_0xfb16('0x2e')]);_0x110924[_0xfb16('0x30')]=_[_0xfb16('0x31')](_0x110924[_0xfb16('0x32')],_0x110924[_0xfb16('0x2e')]);_0x58515a[_0xfb16('0x33')]=_['intersection'](_0x110924[_0xfb16('0x32')],qs[_0xfb16('0x34')](_0x3a1ff9[_0xfb16('0x2e')][_0xfb16('0x34')]));_0x58515a[_0xfb16('0x33')]=_0x58515a[_0xfb16('0x33')][_0xfb16('0x35')]?_0x58515a[_0xfb16('0x33')]:_0x110924[_0xfb16('0x32')];if(!_0x3a1ff9[_0xfb16('0x2e')]['hasOwnProperty'](_0xfb16('0x36'))){_0x58515a[_0xfb16('0x1c')]=qs[_0xfb16('0x1c')](_0x3a1ff9['query'][_0xfb16('0x1c')]);_0x58515a[_0xfb16('0x1b')]=qs[_0xfb16('0x1b')](_0x3a1ff9[_0xfb16('0x2e')]['offset']);}_0x58515a[_0xfb16('0x37')]=qs['sort'](_0x3a1ff9[_0xfb16('0x2e')][_0xfb16('0x38')]);_0x58515a[_0xfb16('0x39')]=qs[_0xfb16('0x30')](_[_0xfb16('0x3a')](_0x3a1ff9['query'],_0x110924[_0xfb16('0x30')]),_0x105078);if(_0x3a1ff9[_0xfb16('0x2e')][_0xfb16('0x3b')]){_0x58515a[_0xfb16('0x39')]=_[_0xfb16('0x3c')](_0x58515a[_0xfb16('0x39')],{'$or':_[_0xfb16('0x28')](_0x105078,function(_0x2fa145){if(_0x2fa145[_0xfb16('0x2c')]!==_0xfb16('0x3d')){var _0x71f432={};_0x71f432[_0x2fa145[_0xfb16('0x25')]]={'$like':'%'+_0x3a1ff9[_0xfb16('0x2e')]['filter']+'%'};return _0x71f432;}})});}_0x58515a=_[_0xfb16('0x3c')]({},_0x58515a,_0x3a1ff9[_0xfb16('0x3e')]);var _0x1d648d={'where':_0x58515a[_0xfb16('0x39')]};return db[_0xfb16('0x29')][_0xfb16('0x1e')](_0x1d648d)[_0xfb16('0x23')](function(_0x48a173){_0x48d1bc[_0xfb16('0x1e')]=_0x48a173;if(_0x3a1ff9[_0xfb16('0x2e')][_0xfb16('0x3f')]){_0x58515a[_0xfb16('0x40')]=[{'all':!![]}];}return db[_0xfb16('0x29')]['findAll'](_0x58515a);})[_0xfb16('0x23')](function(_0x35eaf3){_0x48d1bc[_0xfb16('0x41')]=_0x35eaf3;return _0x48d1bc;})['then'](respondWithFilteredResult(_0x37e610,_0x58515a))['catch'](handleError(_0x37e610,null));};exports[_0xfb16('0x42')]=function(_0x122274,_0x19347e){var _0x4a7bd7={'raw':!![],'where':{'id':_0x122274['params']['id']}},_0x562e61={};_0x562e61[_0xfb16('0x32')]=_[_0xfb16('0x2f')](db[_0xfb16('0x29')][_0xfb16('0x2a')]);_0x562e61[_0xfb16('0x2e')]=_[_0xfb16('0x2f')](_0x122274[_0xfb16('0x2e')]);_0x562e61[_0xfb16('0x30')]=_[_0xfb16('0x31')](_0x562e61[_0xfb16('0x32')],_0x562e61[_0xfb16('0x2e')]);_0x4a7bd7[_0xfb16('0x33')]=_[_0xfb16('0x31')](_0x562e61[_0xfb16('0x32')],qs[_0xfb16('0x34')](_0x122274[_0xfb16('0x2e')][_0xfb16('0x34')]));_0x4a7bd7['attributes']=_0x4a7bd7['attributes'][_0xfb16('0x35')]?_0x4a7bd7['attributes']:_0x562e61['model'];if(_0x122274[_0xfb16('0x2e')]['includeAll']){_0x4a7bd7[_0xfb16('0x40')]=[{'all':!![]}];}_0x4a7bd7=_[_0xfb16('0x3c')]({},_0x4a7bd7,_0x122274['options']);return db['OpenchannelApplication']['find'](_0x4a7bd7)[_0xfb16('0x23')](handleEntityNotFound(_0x19347e,null))['then'](respondWithResult(_0x19347e,null))[_0xfb16('0x43')](handleError(_0x19347e,null));};exports[_0xfb16('0x44')]=function(_0x25d93b,_0x1ef9cc){return db['OpenchannelApplication'][_0xfb16('0x44')](_0x25d93b[_0xfb16('0x45')],{})['then'](respondWithResult(_0x1ef9cc,0xc9))[_0xfb16('0x43')](handleError(_0x1ef9cc,null));};exports['update']=function(_0x48ec54,_0x5ca1cd){if(_0x48ec54[_0xfb16('0x45')]['id']){delete _0x48ec54[_0xfb16('0x45')]['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0x48ec54['params']['id']}})[_0xfb16('0x23')](handleEntityNotFound(_0x5ca1cd,null))[_0xfb16('0x23')](saveUpdates(_0x48ec54[_0xfb16('0x45')],null))[_0xfb16('0x23')](respondWithResult(_0x5ca1cd,null))[_0xfb16('0x43')](handleError(_0x5ca1cd,null));};exports[_0xfb16('0x24')]=function(_0x5a7c69,_0x26fb2e){return db[_0xfb16('0x29')]['find']({'where':{'id':_0x5a7c69[_0xfb16('0x46')]['id']}})[_0xfb16('0x23')](handleEntityNotFound(_0x26fb2e,null))[_0xfb16('0x23')](removeEntity(_0x26fb2e,null))[_0xfb16('0x43')](handleError(_0x26fb2e,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 5cfd370..c449b1b 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 _0x882f=['lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci'];(function(_0x13991c,_0x207424){var _0x55ab8f=function(_0x5b512a){while(--_0x5b512a){_0x13991c['push'](_0x13991c['shift']());}};_0x55ab8f(++_0x207424);}(_0x882f,0xa8));var _0xf882=function(_0x34b863,_0x572731){_0x34b863=_0x34b863-0x0;var _0x42e135=_0x882f[_0x34b863];return _0x42e135;};'use strict';var _=require(_0xf882('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf882('0x1'));var moment=require(_0xf882('0x2'));var BPromise=require(_0xf882('0x3'));var rp=require(_0xf882('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf882('0x5'));var config=require(_0xf882('0x6'));var attributes=require('./openchannelApplication.attributes');module[_0xf882('0x7')]=function(_0x3f08da,_0xe545ff){return _0x3f08da[_0xf882('0x8')](_0xf882('0x9'),attributes,{'tableName':_0xf882('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf882('0xb')});}; \ No newline at end of file +var _0xcaa6=['./openchannelApplication.attributes','exports','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2aebb2,_0x21f452){var _0x17406c=function(_0x7ae2df){while(--_0x7ae2df){_0x2aebb2['push'](_0x2aebb2['shift']());}};_0x17406c(++_0x21f452);}(_0xcaa6,0x1e5));var _0x6caa=function(_0x5c399d,_0x2d7e9e){_0x5c399d=_0x5c399d-0x0;var _0x16b93d=_0xcaa6[_0x5c399d];return _0x16b93d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6caa('0x0'))(_0x6caa('0x1'));var moment=require('moment');var BPromise=require(_0x6caa('0x2'));var rp=require(_0x6caa('0x3'));var fs=require('fs');var path=require(_0x6caa('0x4'));var rimraf=require(_0x6caa('0x5'));var config=require(_0x6caa('0x6'));var attributes=require(_0x6caa('0x7'));module[_0x6caa('0x8')]=function(_0x547a84,_0x181ebe){return _0x547a84['define'](_0x6caa('0x9'),attributes,{'tableName':_0x6caa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6caa('0xb')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 1b73e44..d3e00ce 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 _0x9971=['result','catch','UpdateOpenchannelApplication','OpenchannelApplication','body','options','where','attributes','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x3b709d,_0x178ad6){var _0x5905ff=function(_0x50a113){while(--_0x50a113){_0x3b709d['push'](_0x3b709d['shift']());}};_0x5905ff(++_0x178ad6);}(_0x9971,0x79));var _0x1997=function(_0x32c050,_0x39cae4){_0x32c050=_0x32c050-0x0;var _0x155ece=_0x9971[_0x32c050];return _0x155ece;};'use strict';var _=require(_0x1997('0x0'));var util=require(_0x1997('0x1'));var moment=require(_0x1997('0x2'));var BPromise=require('bluebird');var rs=require(_0x1997('0x3'));var fs=require('fs');var Redis=require(_0x1997('0x4'));var db=require(_0x1997('0x5'))['db'];var utils=require(_0x1997('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x1997('0x7'));var jayson=require(_0x1997('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x539e0b,_0x3518ab,_0x117cab){return new BPromise(function(_0x35864d,_0x2116af){return client[_0x1997('0x9')](_0x539e0b,_0x117cab)['then'](function(_0x816523){logger['info'](_0x1997('0xa'),_0x3518ab,_0x1997('0xb'));logger[_0x1997('0xc')](_0x1997('0xd'),_0x3518ab,'request\x20sent',JSON[_0x1997('0xe')](_0x816523));if(_0x816523['error']){if(_0x816523[_0x1997('0xf')][_0x1997('0x10')]===0x1f4){logger[_0x1997('0xf')](_0x1997('0xa'),_0x3518ab,_0x816523[_0x1997('0xf')]['message']);return _0x2116af(_0x816523['error'][_0x1997('0x11')]);}logger[_0x1997('0xf')](_0x1997('0xa'),_0x3518ab,_0x816523[_0x1997('0xf')][_0x1997('0x11')]);return _0x35864d(_0x816523['error']['message']);}else{logger[_0x1997('0x12')](_0x1997('0xa'),_0x3518ab,'request\x20sent');_0x35864d(_0x816523[_0x1997('0x13')][_0x1997('0x11')]);}})[_0x1997('0x14')](function(_0x4de098){logger[_0x1997('0xf')](_0x1997('0xa'),_0x3518ab,_0x4de098);_0x2116af(_0x4de098);});});}exports[_0x1997('0x15')]=function(_0xcdebcb){var _0x59c2d9=this;return new Promise(function(_0x122896,_0x4352cf){return db[_0x1997('0x16')]['update'](_0xcdebcb[_0x1997('0x17')],{'raw':_0xcdebcb[_0x1997('0x18')]?_0xcdebcb[_0x1997('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcdebcb['options']?_0xcdebcb[_0x1997('0x18')][_0x1997('0x19')]||null:null,'attributes':_0xcdebcb[_0x1997('0x18')]?_0xcdebcb['options'][_0x1997('0x1a')]||null:null,'limit':_0xcdebcb[_0x1997('0x18')]?_0xcdebcb['options']['limit']||null:null})[_0x1997('0x1b')](function(_0x297372){logger[_0x1997('0x12')]('UpdateOpenchannelApplication',_0xcdebcb);logger[_0x1997('0xc')](_0x1997('0x15'),_0xcdebcb,JSON[_0x1997('0xe')](_0x297372));_0x122896(_0x297372);})[_0x1997('0x14')](function(_0x5a61d0){logger['error'](_0x1997('0x15'),_0x5a61d0[_0x1997('0x11')],_0xcdebcb);_0x4352cf(_0x59c2d9[_0x1997('0xf')](0x1f4,_0x5a61d0[_0x1997('0x11')]));});});}; \ No newline at end of file +var _0x5f29=['error','code','message','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','attributes','limit','debug','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s'];(function(_0x10da6c,_0x271bb6){var _0x328e64=function(_0x279951){while(--_0x279951){_0x10da6c['push'](_0x10da6c['shift']());}};_0x328e64(++_0x271bb6);}(_0x5f29,0x16c));var _0x95f2=function(_0x548ccb,_0x1fab15){_0x548ccb=_0x548ccb-0x0;var _0x2f7701=_0x5f29[_0x548ccb];return _0x2f7701;};'use strict';var _=require(_0x95f2('0x0'));var util=require(_0x95f2('0x1'));var moment=require('moment');var BPromise=require(_0x95f2('0x2'));var rs=require(_0x95f2('0x3'));var fs=require('fs');var Redis=require(_0x95f2('0x4'));var db=require(_0x95f2('0x5'))['db'];var utils=require(_0x95f2('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x95f2('0x7'));var jayson=require(_0x95f2('0x8'));var client=jayson[_0x95f2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15fd25,_0x5856a5,_0x3c896e){return new BPromise(function(_0x1558cd,_0x7470a8){return client['request'](_0x15fd25,_0x3c896e)[_0x95f2('0xa')](function(_0x410de1){logger['info'](_0x95f2('0xb'),_0x5856a5,_0x95f2('0xc'));logger['debug'](_0x95f2('0xd'),_0x5856a5,_0x95f2('0xc'),JSON['stringify'](_0x410de1));if(_0x410de1[_0x95f2('0xe')]){if(_0x410de1['error'][_0x95f2('0xf')]===0x1f4){logger['error'](_0x95f2('0xb'),_0x5856a5,_0x410de1[_0x95f2('0xe')][_0x95f2('0x10')]);return _0x7470a8(_0x410de1[_0x95f2('0xe')][_0x95f2('0x10')]);}logger[_0x95f2('0xe')]('OpenchannelApplication,\x20%s,\x20%s',_0x5856a5,_0x410de1[_0x95f2('0xe')][_0x95f2('0x10')]);return _0x1558cd(_0x410de1[_0x95f2('0xe')][_0x95f2('0x10')]);}else{logger['info'](_0x95f2('0xb'),_0x5856a5,_0x95f2('0xc'));_0x1558cd(_0x410de1['result'][_0x95f2('0x10')]);}})['catch'](function(_0x3fe411){logger[_0x95f2('0xe')]('OpenchannelApplication,\x20%s,\x20%s',_0x5856a5,_0x3fe411);_0x7470a8(_0x3fe411);});});}exports[_0x95f2('0x11')]=function(_0x5e7bbf){var _0x4ae4c6=this;return new Promise(function(_0x36ba02,_0x1ecad7){return db[_0x95f2('0x12')][_0x95f2('0x13')](_0x5e7bbf[_0x95f2('0x14')],{'raw':_0x5e7bbf[_0x95f2('0x15')]?_0x5e7bbf['options'][_0x95f2('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e7bbf[_0x95f2('0x15')]?_0x5e7bbf['options']['where']||null:null,'attributes':_0x5e7bbf[_0x95f2('0x15')]?_0x5e7bbf[_0x95f2('0x15')][_0x95f2('0x17')]||null:null,'limit':_0x5e7bbf[_0x95f2('0x15')]?_0x5e7bbf['options'][_0x95f2('0x18')]||null:null})['then'](function(_0x41ad9d){logger['info'](_0x95f2('0x11'),_0x5e7bbf);logger[_0x95f2('0x19')]('UpdateOpenchannelApplication',_0x5e7bbf,JSON['stringify'](_0x41ad9d));_0x36ba02(_0x41ad9d);})[_0x95f2('0x1a')](function(_0x1d76d5){logger[_0x95f2('0xe')](_0x95f2('0x11'),_0x1d76d5['message'],_0x5e7bbf);_0x1ecad7(_0x4ae4c6[_0x95f2('0xe')](0x1f4,_0x1d76d5[_0x95f2('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 21f183d..ebd4363 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 _0x71fc=['put','openchannelinteraction:update','update','delete','/:id/tags','removeTags','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','tracked','openchannel','addTags'];(function(_0x2a78d9,_0x51231e){var _0x5505cc=function(_0x1d4be7){while(--_0x1d4be7){_0x2a78d9['push'](_0x2a78d9['shift']());}};_0x5505cc(++_0x51231e);}(_0x71fc,0xba));var _0xc71f=function(_0xd12357,_0x3ae637){_0xd12357=_0xd12357-0x0;var _0x23bdce=_0x71fc[_0xd12357];return _0x23bdce;};'use strict';var multer=require(_0xc71f('0x0'));var util=require(_0xc71f('0x1'));var path=require('path');var timeout=require(_0xc71f('0x2'));var express=require('express');var router=express[_0xc71f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc71f('0x4'));var interaction=require(_0xc71f('0x5'));var config=require(_0xc71f('0x6'));var controller=require(_0xc71f('0x7'));router[_0xc71f('0x8')]('/',auth[_0xc71f('0x9')](),controller[_0xc71f('0xa')]);router['get']('/describe',auth[_0xc71f('0x9')](),controller[_0xc71f('0xb')]);router[_0xc71f('0x8')](_0xc71f('0xc'),auth[_0xc71f('0x9')](),controller[_0xc71f('0xd')]);router['get']('/:id/messages',auth[_0xc71f('0x9')](),controller[_0xc71f('0xe')]);router[_0xc71f('0x8')](_0xc71f('0xf'),auth[_0xc71f('0x9')](),controller[_0xc71f('0x10')]);router[_0xc71f('0x11')]('/',auth['isAuthenticated'](),controller[_0xc71f('0x12')]);router[_0xc71f('0x11')](_0xc71f('0x13'),auth[_0xc71f('0x9')](),controller[_0xc71f('0x14')]);router['post']('/:id/tags',auth['isAuthenticated'](),interaction[_0xc71f('0x15')](_0xc71f('0x16'),'openchannelinteraction:addtags'),controller[_0xc71f('0x17')]);router[_0xc71f('0x18')]('/:id',auth['isAuthenticated'](),interaction[_0xc71f('0x15')](_0xc71f('0x16'),_0xc71f('0x19')),controller[_0xc71f('0x1a')]);router[_0xc71f('0x1b')]('/:id',auth[_0xc71f('0x9')](),interaction[_0xc71f('0x15')]('openchannel','openchannelinteraction:destroy'),controller['destroy']);router[_0xc71f('0x1b')](_0xc71f('0x1c'),auth[_0xc71f('0x9')](),controller[_0xc71f('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x51a8=['./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','download','post','addMessage','/:id/tags','openchannel','put','tracked','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1b074f,_0x31d960){var _0x47f7c6=function(_0x358af8){while(--_0x358af8){_0x1b074f['push'](_0x1b074f['shift']());}};_0x47f7c6(++_0x31d960);}(_0x51a8,0x17f));var _0x851a=function(_0x4e590d,_0x3c34af){_0x4e590d=_0x4e590d-0x0;var _0x10a2e2=_0x51a8[_0x4e590d];return _0x10a2e2;};'use strict';var multer=require(_0x851a('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x851a('0x1'));var router=express[_0x851a('0x2')]();var fs_extra=require(_0x851a('0x3'));var auth=require(_0x851a('0x4'));var interaction=require(_0x851a('0x5'));var config=require(_0x851a('0x6'));var controller=require(_0x851a('0x7'));router[_0x851a('0x8')]('/',auth[_0x851a('0x9')](),controller[_0x851a('0xa')]);router['get'](_0x851a('0xb'),auth[_0x851a('0x9')](),controller[_0x851a('0xc')]);router['get'](_0x851a('0xd'),auth[_0x851a('0x9')](),controller['show']);router[_0x851a('0x8')](_0x851a('0xe'),auth[_0x851a('0x9')](),controller[_0x851a('0xf')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x851a('0x10')]);router[_0x851a('0x11')]('/',auth[_0x851a('0x9')](),controller['create']);router['post'](_0x851a('0xe'),auth['isAuthenticated'](),controller[_0x851a('0x12')]);router['post'](_0x851a('0x13'),auth[_0x851a('0x9')](),interaction['tracked'](_0x851a('0x14'),'openchannelinteraction:addtags'),controller['addTags']);router[_0x851a('0x15')](_0x851a('0xd'),auth['isAuthenticated'](),interaction[_0x851a('0x16')]('openchannel',_0x851a('0x17')),controller[_0x851a('0x18')]);router[_0x851a('0x19')]('/:id',auth[_0x851a('0x9')](),interaction['tracked'](_0x851a('0x14'),_0x851a('0x1a')),controller[_0x851a('0x1b')]);router[_0x851a('0x19')]('/:id/tags',auth[_0x851a('0x9')](),controller[_0x851a('0x1c')]);module[_0x851a('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index a22c76c..0b74856 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 _0x99e9=['exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x15d9c6,_0x1d4651){var _0xa658e=function(_0x18efb4){while(--_0x18efb4){_0x15d9c6['push'](_0x15d9c6['shift']());}};_0xa658e(++_0x1d4651);}(_0x99e9,0xb4));var _0x999e=function(_0x1bb6aa,_0x40fe82){_0x1bb6aa=_0x1bb6aa-0x0;var _0x2ef28e=_0x99e9[_0x1bb6aa];return _0x2ef28e;};'use strict';var Sequelize=require('sequelize');module[_0x999e('0x0')]={'closed':{'type':Sequelize[_0x999e('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x999e('0x2')]},'disposition':{'type':Sequelize[_0x999e('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x999e('0x3')]},'note':{'type':Sequelize[_0x999e('0x3')]},'read1stAt':{'type':Sequelize[_0x999e('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x999e('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x999e('0x4')]('in',_0x999e('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x999e('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x999e('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x9428=['STRING','DATE','ENUM','sequelize','exports','BOOLEAN'];(function(_0x3f4dd9,_0xe0b819){var _0x31c54a=function(_0x25e6c6){while(--_0x25e6c6){_0x3f4dd9['push'](_0x3f4dd9['shift']());}};_0x31c54a(++_0xe0b819);}(_0x9428,0xa5));var _0x8942=function(_0x4c05da,_0x414720){_0x4c05da=_0x4c05da-0x0;var _0x1614db=_0x9428[_0x4c05da];return _0x1614db;};'use strict';var Sequelize=require(_0x8942('0x0'));module[_0x8942('0x1')]={'closed':{'type':Sequelize[_0x8942('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x8942('0x3')]},'note':{'type':Sequelize[_0x8942('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x8942('0x3')]},'externalUrl':{'type':Sequelize[_0x8942('0x3')]},'lastMsgAt':{'type':Sequelize[_0x8942('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x8942('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x8942('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x8942('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index c79a5ed..dd519f1 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 _0x1127=['threadId','Private','Messages','existsSync','createReadStream','createWriteStream','basename','out','System','firstName','lastName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','log','err','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./openchannelInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','rawAttributes','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','field','from','tools_tags','select','u.id','u.fullname','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','length','find','`\x20=\x200','having','`\x20>\x200','operator','$substring','getFullTextValue','value','ContactId','buildExpression','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','UserId','body','isEmpty','OpenchannelAccountId','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','tag','isArray','replace','isNumeric','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','sequelize','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','all','rows','show','params','OpenchannelInteraction','include','merge','create','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','filter','format','options','findAll','addTags','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','root','server','tmp','join','files','attachments','transcript-%d-%s.zip','Contact','Attachment','direction','secret','OpenchannelAccount','Owner','get','mkdirSync','Openchannel','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition'];(function(_0x49e2f4,_0x10ad67){var _0x361887=function(_0x5365a6){while(--_0x5365a6){_0x49e2f4['push'](_0x49e2f4['shift']());}};_0x361887(++_0x10ad67);}(_0x1127,0xff));var _0x7112=function(_0x5bdf8e,_0x45d970){_0x5bdf8e=_0x5bdf8e-0x0;var _0x3e0750=_0x1127[_0x5bdf8e];return _0x3e0750;};'use strict';var emlformat=require(_0x7112('0x0'));var rimraf=require(_0x7112('0x1'));var zipdir=require(_0x7112('0x2'));var jsonpatch=require(_0x7112('0x3'));var rp=require('request-promise');var moment=require(_0x7112('0x4'));var BPromise=require(_0x7112('0x5'));var Mustache=require('mustache');var util=require(_0x7112('0x6'));var path=require('path');var sox=require(_0x7112('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7112('0x8'));var _=require(_0x7112('0x9'));var squel=require(_0x7112('0xa'));var crypto=require(_0x7112('0xb'));var jsforce=require(_0x7112('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7112('0xd'));var Papa=require(_0x7112('0xe'));var Redis=require(_0x7112('0xf'));var authService=require(_0x7112('0x10'));var qs=require(_0x7112('0x11'));var as=require(_0x7112('0x12'));var pdf=require(_0x7112('0x13'));var hardwareService=require(_0x7112('0x14'));var logger=require('../../config/logger')(_0x7112('0x15'));var utils=require('../../config/utils');var config=require(_0x7112('0x16'));var licenseUtil=require(_0x7112('0x17'));var db=require(_0x7112('0x18'))['db'];config['redis']=_['defaults'](config[_0x7112('0x19')],{'host':_0x7112('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7112('0x19')]));require(_0x7112('0x1b'))[_0x7112('0x1c')](socket);function respondWithStatusCode(_0x3cd860,_0x176f7b){_0x176f7b=_0x176f7b||0xcc;return function(_0x33382a){if(_0x33382a){return _0x3cd860[_0x7112('0x1d')](_0x176f7b);}return _0x3cd860[_0x7112('0x1e')](_0x176f7b)[_0x7112('0x1f')]();};}function respondWithResult(_0x21b733,_0x817216){_0x817216=_0x817216||0xc8;return function(_0x1b0879){if(_0x1b0879){return _0x21b733[_0x7112('0x1e')](_0x817216)['json'](_0x1b0879);}};}function respondWithFilteredResult(_0xc957bc,_0x495804){return function(_0x1ae416){if(_0x1ae416){var _0x21a314=typeof _0x495804[_0x7112('0x20')]===_0x7112('0x21')&&typeof _0x495804[_0x7112('0x22')]===_0x7112('0x21');var _0x1fe148=_0x1ae416['count'];var _0x197ba3=_0x21a314?0x0:_0x495804[_0x7112('0x20')];var _0x1fd1d6=_0x21a314?_0x1ae416[_0x7112('0x23')]:_0x495804[_0x7112('0x20')]+_0x495804[_0x7112('0x22')];var _0x1f38ae;if(_0x1fd1d6>=_0x1fe148){_0x1fd1d6=_0x1fe148;_0x1f38ae=0xc8;}else{_0x1f38ae=0xce;}_0xc957bc[_0x7112('0x1e')](_0x1f38ae);return _0xc957bc[_0x7112('0x24')]('Content-Range',_0x197ba3+'-'+_0x1fd1d6+'/'+_0x1fe148)[_0x7112('0x25')](_0x1ae416);}return null;};}function patchUpdates(_0x1235c6){return function(_0x1a9775){try{jsonpatch[_0x7112('0x26')](_0x1a9775,_0x1235c6,!![]);}catch(_0x3a6097){return BPromise[_0x7112('0x27')](_0x3a6097);}return _0x1a9775[_0x7112('0x28')]();};}function saveUpdates(_0x19dd0c,_0x2cd0b7){return function(_0x33d3f2){if(_0x33d3f2){return _0x33d3f2[_0x7112('0x29')](_0x19dd0c)[_0x7112('0x2a')](function(_0x2ba9d3){return _0x2ba9d3;});}return null;};}function removeEntity(_0x54e1f7,_0x15cee4){return function(_0x3b7c3f){if(_0x3b7c3f){return _0x3b7c3f[_0x7112('0x2b')]()[_0x7112('0x2a')](function(){_0x54e1f7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x176ace,_0x1e81a1){return function(_0xf06fa7){if(!_0xf06fa7){_0x176ace[_0x7112('0x1d')](0x194);}return _0xf06fa7;};}function handleError(_0x2415c5,_0x51f6f0){_0x51f6f0=_0x51f6f0||0x1f4;return function(_0x260084){logger['error'](_0x260084[_0x7112('0x2c')]);if(_0x260084[_0x7112('0x2d')]){delete _0x260084['name'];}_0x2415c5[_0x7112('0x1e')](_0x51f6f0)[_0x7112('0x2e')](_0x260084);};}function getInteractionUsers(_0x473c9f,_0x170c5e){return new BPromise(function(_0x549e8e,_0x5946df){try{if(_0x170c5e[_0x473c9f['id']]){_0x473c9f[_0x7112('0x2f')]=_[_0x7112('0x30')](_0x170c5e[_0x473c9f['id']],function(_0x28d78e){return{'id':_0x28d78e['id'],'fullname':_0x28d78e[_0x7112('0x31')]};});}}catch(_0x3b0ce6){_0x5946df(_0x3b0ce6);}_0x549e8e(_0x473c9f);});}function getInteractionTags(_0x140a90,_0x5df64d){return new BPromise(function(_0x1c856d,_0xd570da){try{if(_0x140a90[_0x7112('0x32')]){_0x140a90[_0x7112('0x33')]=[];_0x140a90['TagIds'][_0x7112('0x34')](',')[_0x7112('0x35')](function(_0x274cb5){_0x140a90['Tags'][_0x7112('0x36')](_0x5df64d[_0x274cb5]);});}delete _0x140a90[_0x7112('0x32')];}catch(_0x38ab8b){_0xd570da(_0x38ab8b);}_0x1c856d(_0x140a90);});}function updateOpenchannelInteraction(_0x22bfd5,_0x21929c,_0x5d377e){return new BPromise(function(_0x27dbce,_0x50f526){return getInteractionUsers(_0x22bfd5,_0x5d377e)['then'](function(_0x1ef3ca){return getInteractionTags(_0x1ef3ca,_0x21929c);})['then'](function(_0x18cd33){_0x27dbce(_0x18cd33);})[_0x7112('0x37')](function(_0x3c8e76){_0x50f526(_0x3c8e76);});});}exports[_0x7112('0x38')]=function(_0x1a1be7,_0x4a61b3){var _0x519cd4={},_0x197a98={},_0x526c66={'count':0x0,'rows':[]};var _0x569c03=_[_0x7112('0x30')](db['OpenchannelInteraction'][_0x7112('0x39')],function(_0xb402aa){return{'name':_0xb402aa['fieldName'],'type':_0xb402aa['type'][_0x7112('0x3a')]};});_0x197a98[_0x7112('0x3b')]=_[_0x7112('0x30')](_0x569c03,'name');_0x197a98['query']=_[_0x7112('0x3c')](_0x1a1be7[_0x7112('0x3d')]);_0x197a98[_0x7112('0x3e')]=_[_0x7112('0x3f')](_0x197a98[_0x7112('0x3b')],_0x197a98[_0x7112('0x3d')]);_0x519cd4['attributes']=_[_0x7112('0x3f')](_0x197a98[_0x7112('0x3b')],qs[_0x7112('0x40')](_0x1a1be7[_0x7112('0x3d')]['fields']));_0x519cd4[_0x7112('0x41')]=_0x519cd4[_0x7112('0x41')]['length']?_0x519cd4[_0x7112('0x41')]:_0x197a98[_0x7112('0x3b')];if(!_0x1a1be7[_0x7112('0x3d')][_0x7112('0x42')](_0x7112('0x43'))){_0x519cd4[_0x7112('0x22')]=qs[_0x7112('0x22')](_0x1a1be7[_0x7112('0x3d')]['limit']);_0x519cd4['offset']=qs[_0x7112('0x20')](_0x1a1be7[_0x7112('0x3d')][_0x7112('0x20')]);}_0x519cd4[_0x7112('0x44')]=qs[_0x7112('0x45')](_0x1a1be7[_0x7112('0x3d')][_0x7112('0x45')]);_0x519cd4[_0x7112('0x46')]=qs[_0x7112('0x3e')](_[_0x7112('0x47')](_0x1a1be7[_0x7112('0x3d')],_0x197a98[_0x7112('0x3e')]),_0x569c03);var _0x5b1b77=[];var _0x5084ed=squel['select']()[_0x7112('0x48')]('id')[_0x7112('0x48')]('name')[_0x7112('0x48')]('color')[_0x7112('0x49')](_0x7112('0x4a'));var _0x13e47f=squel[_0x7112('0x4b')]()[_0x7112('0x48')](_0x7112('0x4c'))[_0x7112('0x48')](_0x7112('0x4d'))[_0x7112('0x48')]('ui.OpenchannelInteractionId')[_0x7112('0x49')]('user_has_openchannel_interactions','ui')[_0x7112('0x4e')](_0x7112('0x4f'),'u',_0x7112('0x50'));var _0x5616f3=squel['select']()['from'](_0x7112('0x51'),'i')[_0x7112('0x4e')](_0x7112('0x52'),'c',_0x7112('0x53'))[_0x7112('0x4e')](_0x7112('0x4f'),'o',_0x7112('0x54'))[_0x7112('0x4e')](_0x7112('0x55'),'a',_0x7112('0x56'))[_0x7112('0x4e')](_0x7112('0x57'),'me',_0x7112('0x58'))[_0x7112('0x4e')]('openchannel_interaction_has_tags','it','it.OpenchannelInteractionId\x20=\x20i.id')[_0x7112('0x4e')](_0x7112('0x4a'),'t',_0x7112('0x59'));var _0x49a9e7=squel[_0x7112('0x5a')]();var _0x3496ea=[];var _0x17f1fe=squel[_0x7112('0x5a')]();var _0x227f2e;if(_0x1a1be7[_0x7112('0x3d')][_0x7112('0x5b')]){_0x227f2e=as['parseSearch'](_0x1a1be7['query'][_0x7112('0x5b')]);var _0x430d26=_0x227f2e[_0x7112('0x5c')];for(var _0x3b3fdc=0x0;_0x3b3fdc<_0x227f2e['conditions'][_0x7112('0x5d')];_0x3b3fdc++){var _0x1491cf=_0x227f2e['conditions'][_0x3b3fdc];var _0xe4fcf8='i';var _0x3039a5=_[_0x7112('0x5e')](_0x569c03,[_0x7112('0x2d'),_0x1491cf[_0x7112('0x48')]]);if(!_0x3039a5){switch(_0x1491cf[_0x7112('0x48')]){case'unreadMessages':if(_0x1491cf['value']==0x1){_0x5616f3['having']('`'+_0x1491cf[_0x7112('0x48')]+_0x7112('0x5f'));}else{_0x5616f3[_0x7112('0x60')]('`'+_0x1491cf['field']+_0x7112('0x61'));}break;case'Contact':if(_0x1491cf[_0x7112('0x62')]===_0x7112('0x63')){if(_0x1491cf['value'][_0x7112('0x34')]('\x20')[_0x7112('0x5d')]>0x1){_0x49a9e7[_0x430d26]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x7112('0x64')](_0x1491cf[_0x7112('0x65')]),null);}else{var _0x329b6b='%'+_0x1491cf[_0x7112('0x65')]+'%';_0x49a9e7[_0x430d26]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x329b6b,_0x329b6b,_0x329b6b);}}else{_0x3039a5=_[_0x7112('0x5e')](_0x569c03,[_0x7112('0x2d'),'ContactId']);_0x1491cf['field']=_0x7112('0x66');_0x3c697c=as[_0x7112('0x67')](_0xe4fcf8,_0x3039a5[_0x7112('0x68')],_0x1491cf);_0x49a9e7[_0x430d26](_0x3c697c[_0x7112('0x69')],_0x3c697c[_0x7112('0x65')][_0x7112('0x6a')],_0x3c697c[_0x7112('0x65')][_0x7112('0x1f')]);}break;case _0x7112('0x6b'):var _0x20126c=_0x1491cf['value'][_0x7112('0x34')](',')['map'](function(_0x327b33){return Number(_0x327b33);});_0x20126c[_0x7112('0x35')](function(_0x3d2e9e){_0x17f1fe['or'](_0x7112('0x6c'),'%,'+_0x3d2e9e+',%');});_0x3496ea=_['union'](_0x3496ea,_0x20126c);break;case _0x7112('0x6d'):if(_0x1491cf['operator']==='$substring'){_0x49a9e7[_0x430d26]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1491cf['value']+'%',null);}else{_0x3039a5=_[_0x7112('0x5e')](_0x569c03,[_0x7112('0x2d'),_0x7112('0x6e')]);_0x1491cf['field']='UserId';_0x3c697c=as[_0x7112('0x67')](_0xe4fcf8,_0x3039a5['type'],_0x1491cf);_0x49a9e7[_0x430d26](_0x3c697c['text'],_0x3c697c['value'][_0x7112('0x6a')],_0x3c697c[_0x7112('0x65')][_0x7112('0x1f')]);}break;case _0x7112('0x6f'):_0x3c697c=as[_0x7112('0x67')]('me',null,_0x1491cf);_0x49a9e7[_0x430d26](_0x3c697c[_0x7112('0x69')],_0x3c697c[_0x7112('0x65')][_0x7112('0x6a')],_0x3c697c['value'][_0x7112('0x1f')]);break;}}else{var _0x3c697c=as['buildExpression'](_0xe4fcf8,_0x3039a5[_0x7112('0x68')],_0x1491cf);_0x49a9e7[_0x430d26](_0x3c697c['text'],_0x3c697c['value'][_0x7112('0x6a')],_0x3c697c[_0x7112('0x65')][_0x7112('0x1f')]);}}}else{var _0x30919a=_(_0x1a1be7[_0x7112('0x3d')])[_0x7112('0x3c')]()[_0x7112('0x30')](function(_0x24f93b){return _['some'](_0x569c03,[_0x7112('0x2d'),_0x24f93b])?_0x24f93b:undefined;})['compact']()['value']();if(!_[_0x7112('0x70')](_0x30919a)){_0x30919a[_0x7112('0x35')](function(_0x1cf0e3){if(_0x1cf0e3===_0x7112('0x71')){_0x5616f3[_0x7112('0x46')]('i.OpenchannelAccountId\x20IN\x20?',[][_0x7112('0x72')](_0x1a1be7['query'][_0x1cf0e3]));}else if(_0x1cf0e3===_0x7112('0x73')){var _0x20083e=JSON[_0x7112('0x74')](_0x1a1be7['query'][_0x1cf0e3])[_0x7112('0x75')];var _0x1cd585=JSON[_0x7112('0x74')](_0x1a1be7['query'][_0x1cf0e3])[_0x7112('0x76')];_0x5616f3[_0x7112('0x46')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x20083e,_0x1cd585);}else{if(_0x1a1be7[_0x7112('0x3d')][_0x1cf0e3]===_0x7112('0x77')){_0x5616f3[_0x7112('0x46')]('i.'+_0x1cf0e3+_0x7112('0x78'));}else{_0x5616f3[_0x7112('0x46')]('i.'+_0x1cf0e3+_0x7112('0x79'),_0x1a1be7['query'][_0x1cf0e3]);}}});}if(_0x1a1be7[_0x7112('0x3d')][_0x7112('0x7a')]){if(_0x1a1be7[_0x7112('0x3d')][_0x7112('0x7a')]==0x1){_0x5616f3['having']('`unreadMessages`\x20=\x200');}else{_0x5616f3[_0x7112('0x60')]('`unreadMessages`\x20>\x200');}}if(_0x1a1be7[_0x7112('0x3d')][_0x7112('0x7b')]){_0x3496ea=_[_0x7112('0x7c')](_0x1a1be7['query'][_0x7112('0x7b')])?_0x1a1be7[_0x7112('0x3d')][_0x7112('0x7b')]:new Array(_0x1a1be7[_0x7112('0x3d')][_0x7112('0x7b')]);_0x3496ea[_0x7112('0x35')](function(_0x52ad66){_0x17f1fe['or'](_0x7112('0x6c'),'%,'+_0x52ad66+',%');});}if(_0x1a1be7['query']['filter']){var _0x153230=_0x1a1be7['query']['filter'][_0x7112('0x7d')]('\x5c','\x5c\x5c')[_0x7112('0x7d')](/'/g,'\x27\x27');if(qs[_0x7112('0x7e')](_0x153230)){_0x49a9e7['or']('i.id\x20LIKE\x20?',_0x153230+'%');}else{_0x49a9e7['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x7112('0x64')](_0x153230))['or'](_0x7112('0x7f'),_0x153230+'%')['or'](_0x7112('0x80'),_0x153230+'%');}}}_0x5616f3[_0x7112('0x46')](_0x49a9e7);_0x5616f3[_0x7112('0x81')](_0x7112('0x82'));var _0x23c6d1={'type':db[_0x7112('0x83')][_0x7112('0x84')][_0x7112('0x85')],'raw':!![]};var _0x40ca5c=_0x5616f3[_0x7112('0x86')]();_0x40ca5c[_0x7112('0x48')](_0x7112('0x82'));_0x40ca5c['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x7112('0x87'));if(_0x519cd4[_0x7112('0x44')]){_0x519cd4[_0x7112('0x44')]['forEach'](function(_0x530cf1){var _0xfb6b3e=_0x530cf1[0x0]===_0x7112('0x88')?_0x530cf1[0x0]:'i.'+_0x530cf1[0x0];_0x5616f3[_0x7112('0x44')](_0xfb6b3e,_0x530cf1[0x1]===_0x7112('0x89')?![]:!![]);});}if(!_[_0x7112('0x70')](_0x3496ea)){_0x5616f3[_0x7112('0x60')](_0x17f1fe);_0x40ca5c[_0x7112('0x46')](_0x7112('0x8a'),_0x3496ea);}BPromise[_0x7112('0x8b')]()[_0x7112('0x2a')](function(){if(!_0x227f2e){if(_0x1a1be7[_0x7112('0x3d')]['OpenchannelAccountId'])return;_0x40ca5c[_0x7112('0x46')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x5616f3[_0x7112('0x46')](_0x7112('0x8c'));return;}if(_0x1a1be7[_0x7112('0x8d')][_0x7112('0x8e')]!==_0x7112('0x8f'))return;return _0x1a1be7[_0x7112('0x8d')][_0x7112('0x90')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3ca5cc){if(_[_0x7112('0x70')](_0x3ca5cc)){_0x40ca5c[_0x7112('0x46')](_0x7112('0x91'));_0x5616f3[_0x7112('0x46')](_0x7112('0x91'));}else{_0x40ca5c['where'](_0x7112('0x92'),_[_0x7112('0x30')](_0x3ca5cc,'id'));_0x5616f3[_0x7112('0x46')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x7112('0x30')](_0x3ca5cc,'id'));}});})[_0x7112('0x2a')](function(){if(_0x1a1be7[_0x7112('0x8d')]['role']===_0x7112('0x8f')&&!_0x227f2e&&!_0x1a1be7[_0x7112('0x3d')][_0x7112('0x71')])return[];return db[_0x7112('0x93')][_0x7112('0x3d')](_0x40ca5c[_0x7112('0x94')](),_0x23c6d1);})[_0x7112('0x2a')](function(_0x4c3f48){_0x526c66[_0x7112('0x23')]=_0x4c3f48[_0x7112('0x5d')];if(_0x526c66['count']===0x0)return[];return db[_0x7112('0x93')][_0x7112('0x3d')](_0x5084ed[_0x7112('0x94')](),_0x23c6d1)[_0x7112('0x2a')](function(_0x16901d){_0x5b1b77=_[_0x7112('0x95')](_0x16901d,'id');_0x23c6d1=_['merge'](_0x23c6d1,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1a1be7[_0x7112('0x3d')][_0x7112('0x40')]){_0x519cd4[_0x7112('0x41')][_0x7112('0x35')](function(_0x558f5b){_0x5616f3[_0x7112('0x48')]('i.'+_0x558f5b);});}else{_0x5616f3[_0x7112('0x48')](_0x7112('0x96'),_0x7112('0x87'));_0x5616f3[_0x7112('0x48')](_0x7112('0x97'),'Account.key');_0x5616f3[_0x7112('0x48')](_0x7112('0x98'),_0x7112('0x99'));_0x5616f3[_0x7112('0x48')](_0x7112('0x9a'),_0x7112('0x88'));_0x5616f3[_0x7112('0x48')](_0x7112('0x9b'));_0x5616f3['field'](_0x7112('0x9c'),_0x7112('0x9d'));_0x5616f3[_0x7112('0x48')](_0x7112('0x9e'),_0x7112('0x9f'));_0x5616f3['field'](_0x7112('0xa0'),_0x7112('0xa1'));_0x5616f3[_0x7112('0x48')](_0x7112('0xa2'),_0x7112('0xa3'));_0x5616f3[_0x7112('0x48')](_0x7112('0xa4'),_0x7112('0xa5'));_0x5616f3[_0x7112('0x48')](_0x7112('0xa6'),'Contact.fax');_0x5616f3[_0x7112('0x48')](_0x7112('0xa7'),_0x7112('0xa8'));_0x5616f3[_0x7112('0x48')](_0x7112('0xa9'),'Owner.internal');_0x5616f3[_0x7112('0x48')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x7112('0x32'));}if(_0x519cd4[_0x7112('0x22')])_0x5616f3[_0x7112('0x22')](_0x519cd4['limit']);if(_0x519cd4[_0x7112('0x20')])_0x5616f3[_0x7112('0x20')](_0x519cd4[_0x7112('0x20')]);return db[_0x7112('0x93')]['query'](_0x5616f3[_0x7112('0x94')](),_0x23c6d1);})['then'](function(_0x282cd0){if(_0x282cd0[_0x7112('0x5d')]>0x0)_0x13e47f[_0x7112('0x46')](_0x7112('0xaa'),_[_0x7112('0x30')](_0x282cd0,'id'));return db[_0x7112('0x93')][_0x7112('0x3d')](_0x13e47f[_0x7112('0x94')](),_0x23c6d1)[_0x7112('0x2a')](function(_0x27824f){var _0x556ff3=_[_0x7112('0xab')](_0x27824f,'OpenchannelInteractionId');var _0x40004b=[];_0x282cd0[_0x7112('0x35')](function(_0x55a2fa){_0x40004b[_0x7112('0x36')](updateOpenchannelInteraction(_0x55a2fa,_0x5b1b77,_0x556ff3));});return BPromise[_0x7112('0xac')](_0x40004b);});});})[_0x7112('0x2a')](function(_0x48a25a){_0x526c66[_0x7112('0xad')]=_0x48a25a;return _0x526c66;})[_0x7112('0x2a')](respondWithFilteredResult(_0x4a61b3,_0x519cd4))[_0x7112('0x37')](handleError(_0x4a61b3,null));};exports[_0x7112('0xae')]=function(_0x3562c2,_0x189a87){var _0x307b75={};if(_0x3562c2['query'][_0x7112('0x68')]&&_0x3562c2[_0x7112('0x3d')][_0x7112('0x68')]===_0x7112('0x49')){_0x307b75[_0x7112('0x49')]=_0x3562c2[_0x7112('0xaf')]['id'];}else{_0x307b75['id']=_0x3562c2[_0x7112('0xaf')]['id'];}var _0x5aea34={'raw':![],'where':_0x307b75},_0x3fd924={};_0x3fd924[_0x7112('0x3b')]=_[_0x7112('0x3c')](db[_0x7112('0xb0')][_0x7112('0x39')]);_0x3fd924[_0x7112('0x3d')]=_[_0x7112('0x3c')](_0x3562c2[_0x7112('0x3d')]);_0x3fd924[_0x7112('0x3e')]=_[_0x7112('0x3f')](_0x3fd924[_0x7112('0x3b')],_0x3fd924[_0x7112('0x3d')]);_0x5aea34[_0x7112('0x41')]=_[_0x7112('0x3f')](_0x3fd924[_0x7112('0x3b')],qs[_0x7112('0x40')](_0x3562c2[_0x7112('0x3d')][_0x7112('0x40')]));_0x5aea34[_0x7112('0x41')]=_0x5aea34[_0x7112('0x41')]['length']?_0x5aea34[_0x7112('0x41')]:_0x3fd924[_0x7112('0x3b')];if(_0x3562c2['query']['includeAll']){_0x5aea34[_0x7112('0xb1')]=[{'all':!![]}];}_0x5aea34=_[_0x7112('0xb2')]({},_0x5aea34,_0x3562c2['options']);return db[_0x7112('0xb0')][_0x7112('0x5e')](_0x5aea34)[_0x7112('0x2a')](handleEntityNotFound(_0x189a87,null))[_0x7112('0x2a')](respondWithResult(_0x189a87,null))[_0x7112('0x37')](handleError(_0x189a87,null));};exports[_0x7112('0xb3')]=function(_0x3f4cf9,_0x4a3b62){return db[_0x7112('0xb0')][_0x7112('0xb3')](_0x3f4cf9['body'],{})[_0x7112('0x2a')](respondWithResult(_0x4a3b62,0xc9))[_0x7112('0x37')](handleError(_0x4a3b62,null));};exports[_0x7112('0x29')]=function(_0x53d823,_0x399217){if(_0x53d823[_0x7112('0x6f')]['id']){delete _0x53d823[_0x7112('0x6f')]['id'];}return db[_0x7112('0xb0')][_0x7112('0x5e')]({'where':{'id':_0x53d823[_0x7112('0xaf')]['id']}})[_0x7112('0x2a')](handleEntityNotFound(_0x399217,null))[_0x7112('0x2a')](saveUpdates(_0x53d823[_0x7112('0x6f')],null))[_0x7112('0x2a')](respondWithResult(_0x399217,null))[_0x7112('0x37')](handleError(_0x399217,null));};exports[_0x7112('0x2b')]=function(_0x4d0af2,_0xb3d508){return db['OpenchannelInteraction'][_0x7112('0x5e')]({'where':{'id':_0x4d0af2[_0x7112('0xaf')]['id']}})[_0x7112('0x2a')](handleEntityNotFound(_0xb3d508,null))['then'](removeEntity(_0xb3d508,null))[_0x7112('0x37')](handleError(_0xb3d508,null));};exports[_0x7112('0xb4')]=function(_0x43ce33,_0x3cad6a){return db['OpenchannelInteraction'][_0x7112('0xb4')]()[_0x7112('0x2a')](respondWithResult(_0x3cad6a,null))[_0x7112('0x37')](handleError(_0x3cad6a,null));};exports[_0x7112('0xb5')]=function(_0x38e23a,_0x1e2787,_0x199279){return db[_0x7112('0xb6')][_0x7112('0x5e')]({'where':{'id':_0x38e23a[_0x7112('0xaf')]['id']}})['then'](handleEntityNotFound(_0x1e2787,null))[_0x7112('0x2a')](function(_0x496da4){if(_0x496da4){return _0x496da4[_0x7112('0xb5')](_0x38e23a[_0x7112('0x6f')][_0x7112('0xb7')],_[_0x7112('0xb8')](_0x38e23a[_0x7112('0x6f')],[_0x7112('0xb7'),'id'])||{});}})[_0x7112('0x2a')](respondWithResult(_0x1e2787,null))['catch'](handleError(_0x1e2787,null));};exports[_0x7112('0xb9')]=function(_0x2cb1e8,_0x252086,_0x5bcc25){var _0x371ee1={'raw':![],'where':{}};var _0x2f72b9={};var _0x511b93={'count':0x0,'rows':[]};return db[_0x7112('0xb0')]['findOne']({'where':{'id':_0x2cb1e8[_0x7112('0xaf')]['id']}})[_0x7112('0x2a')](handleEntityNotFound(_0x252086,null))[_0x7112('0x2a')](function(_0x16d17b){if(_0x16d17b){_0x2f72b9[_0x7112('0x3b')]=_[_0x7112('0x3c')](db[_0x7112('0xb6')][_0x7112('0x39')]);_0x2f72b9[_0x7112('0x3d')]=_[_0x7112('0x3c')](_0x2cb1e8['query']);_0x2f72b9[_0x7112('0x3e')]=_['intersection'](_0x2f72b9[_0x7112('0x3b')],_0x2f72b9['query']);_0x371ee1['attributes']=_[_0x7112('0x3f')](_0x2f72b9[_0x7112('0x3b')],qs[_0x7112('0x40')](_0x2cb1e8[_0x7112('0x3d')][_0x7112('0x40')]));_0x371ee1[_0x7112('0x41')]=_0x371ee1[_0x7112('0x41')][_0x7112('0x5d')]?_0x371ee1[_0x7112('0x41')]:_0x2f72b9['model'];if(!_0x2cb1e8[_0x7112('0x3d')][_0x7112('0x42')](_0x7112('0x43'))){_0x371ee1[_0x7112('0x22')]=qs[_0x7112('0x22')](_0x2cb1e8[_0x7112('0x3d')][_0x7112('0x22')]);_0x371ee1[_0x7112('0x20')]=qs[_0x7112('0x20')](_0x2cb1e8[_0x7112('0x3d')][_0x7112('0x20')]);}_0x371ee1[_0x7112('0x44')]=qs['sort'](_0x2cb1e8['query'][_0x7112('0x45')]);_0x371ee1['where']=qs[_0x7112('0x3e')](_[_0x7112('0x47')](_0x2cb1e8[_0x7112('0x3d')],_0x2f72b9[_0x7112('0x3e')]));_0x371ee1[_0x7112('0x46')]['OpenchannelInteractionId']=_0x16d17b['id'];if(_0x2cb1e8[_0x7112('0x3d')]['filter']){_0x371ee1[_0x7112('0x46')]=_[_0x7112('0xb2')](_0x371ee1[_0x7112('0x46')],{'$or':_[_0x7112('0x30')](_0x371ee1[_0x7112('0x41')],function(_0x5598f5){var _0x44aab4={};_0x44aab4[_0x5598f5]={'$like':'%'+_0x2cb1e8[_0x7112('0x3d')][_0x7112('0xba')]+'%'};return _0x44aab4;})});}if(_0x2cb1e8[_0x7112('0x3d')][_0x7112('0x75')]){var _0x205ba9=_0x2cb1e8['query'][_0x7112('0x75')][_0x7112('0x34')](',');var _0xe62df7={};_0xe62df7[_0x205ba9[0x0]]={'$gte':moment(_0x205ba9[0x1])[_0x7112('0xbb')]('YYYY-MM-DD\x20HH:mm:ss')};_0x371ee1['where']=_[_0x7112('0xb2')](_0x371ee1['where'],_0xe62df7);}_0x371ee1=_[_0x7112('0xb2')]({},_0x371ee1,_0x2cb1e8[_0x7112('0xbc')]);return db[_0x7112('0xb6')][_0x7112('0x23')]({'where':_0x371ee1['where']})[_0x7112('0x2a')](function(_0x3ab778){_0x511b93['count']=_0x3ab778;if(_0x2cb1e8[_0x7112('0x3d')]['includeAll']){_0x371ee1[_0x7112('0xb1')]=[{'all':!![]}];}return db[_0x7112('0xb6')][_0x7112('0xbd')](_0x371ee1);})[_0x7112('0x2a')](function(_0x2b39ed){_0x511b93['rows']=_0x2b39ed;return _0x511b93;});}})[_0x7112('0x2a')](respondWithFilteredResult(_0x252086,_0x371ee1))[_0x7112('0x37')](handleError(_0x252086,null));};exports[_0x7112('0xbe')]=function(_0x44eb06,_0x161d33,_0xb9180b){return db[_0x7112('0xb0')][_0x7112('0x5e')]({'where':{'id':_0x44eb06[_0x7112('0xaf')]['id']}})['then'](handleEntityNotFound(_0x161d33,null))['then'](function(_0x7c5abd){if(_0x7c5abd){return _0x7c5abd['setTags'](_0x44eb06[_0x7112('0x6f')][_0x7112('0xb7')],_['omit'](_0x44eb06[_0x7112('0x6f')],[_0x7112('0xb7'),'id'])||{})[_0x7112('0xbf')](function(){return db[_0x7112('0x6b')][_0x7112('0xbd')]({'attributes':['id','name','color'],'where':{'id':_0x44eb06[_0x7112('0x6f')][_0x7112('0xb7')]}});})[_0x7112('0x2a')](function(_0x410326){socket[_0x7112('0xc0')](_0x7112('0xc1'),{'id':Number(_0x44eb06[_0x7112('0xaf')]['id']),'tags':_0x410326||[]});return{'id':Number(_0x44eb06[_0x7112('0xaf')]['id']),'tags':_0x410326||[]};});}})[_0x7112('0x2a')](respondWithResult(_0x161d33,null))['catch'](handleError(_0x161d33,null));};exports[_0x7112('0xc2')]=function(_0x5cfb86,_0x403319,_0x2c50b6){return db[_0x7112('0xb0')][_0x7112('0x5e')]({'where':{'id':_0x5cfb86[_0x7112('0xaf')]['id']}})['then'](handleEntityNotFound(_0x403319,null))['then'](function(_0x30c42e){if(_0x30c42e){return _0x30c42e[_0x7112('0xc2')](_0x5cfb86[_0x7112('0x3d')][_0x7112('0xb7')]);}})[_0x7112('0x2a')](respondWithStatusCode(_0x403319,null))[_0x7112('0x37')](handleError(_0x403319,null));};exports[_0x7112('0xc3')]=function(_0xaaac23,_0x1366dc){var _0x351ea2=moment()[_0x7112('0xc4')]()['toString']();var _0x4bceaf=path['join'](config[_0x7112('0xc5')],_0x7112('0xc6'),'files',_0x7112('0xc7'));var _0x5509a6=path[_0x7112('0xc8')](config[_0x7112('0xc5')],_0x7112('0xc6'),_0x7112('0xc9'),_0x7112('0xca'));var _0x546cbf=path[_0x7112('0xc8')](_0x4bceaf,_0x351ea2);var _0x1af44b=util[_0x7112('0xbb')](_0x7112('0xcb'),_0xaaac23[_0x7112('0xaf')]['id'],_0x351ea2);var _0x4a8917=path[_0x7112('0xc8')](_0x4bceaf,_0x1af44b);var _0x47e9ce=[];_0x47e9ce[_0x7112('0x36')]({'model':db[_0x7112('0x6d')],'as':_0x7112('0x6d'),'attributes':['id',_0x7112('0x31')],'raw':!![]});_0x47e9ce[_0x7112('0x36')]({'model':db['CmContact'],'as':_0x7112('0xcc'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0xaaac23[_0x7112('0x3d')][_0x7112('0xca')]){_0x47e9ce[_0x7112('0x36')]({'model':db['Attachment'],'as':_0x7112('0xcd'),'raw':!![]});}var _0x541d8e=[{'model':db['OpenchannelMessage'],'as':'Messages','attributes':['id','body',_0x7112('0x73'),_0x7112('0xce'),_0x7112('0xcf'),_0x7112('0x7a')],'include':_0x47e9ce}];_0x541d8e[_0x7112('0x36')]({'model':db[_0x7112('0xd0')],'as':'Account','attributes':['id',_0x7112('0x2d')]});_0x541d8e['push']({'model':db['User'],'as':_0x7112('0xd1'),'attributes':['id',_0x7112('0x31')]});return db[_0x7112('0xb0')]['find']({'where':{'id':_0xaaac23['params']['id']},'include':_0x541d8e})[_0x7112('0x2a')](handleEntityNotFound(_0x1366dc,null))[_0x7112('0x2a')](function(_0xd13ca0){if(_0xd13ca0){var _0x15a30=_0xd13ca0[_0x7112('0xd2')]({'plain':!![]});fs[_0x7112('0xd3')](_0x546cbf);var _0xff4b53={'channel':_0x7112('0xd4'),'account':_0x15a30[_0x7112('0xd5')]['name'],'agent':_0x15a30[_0x7112('0xd1')]?_0x15a30[_0x7112('0xd1')][_0x7112('0x31')]:_0x7112('0xd6'),'createdAt':moment(_0x15a30[_0x7112('0x73')])[_0x7112('0xbb')](_0x7112('0xd7'))[_0x7112('0x94')](),'closedAt':_0x15a30[_0x7112('0xd8')]?moment(_0x15a30[_0x7112('0xd9')])[_0x7112('0xbb')](_0x7112('0xd7'))[_0x7112('0x94')]():'','disposition':_0x15a30[_0x7112('0xda')],'visibility':_0x15a30[_0x7112('0xdb')]?'Public':_0x7112('0xdc'),'messages':_(_0x15a30[_0x7112('0xdd')])['filter']({'secret':![]})['map'](function(_0xb3f855){if(_0xb3f855['Attachment']){var _0x44a3de=path['join'](_0x5509a6,_0xb3f855[_0x7112('0xcd')]['basename']);if(fs[_0x7112('0xde')](_0x44a3de)){fs[_0x7112('0xdf')](_0x44a3de)['pipe'](fs[_0x7112('0xe0')](path['join'](_0x546cbf,_0xb3f855['Attachment'][_0x7112('0xe1')])));}}return{'date':moment(_0xb3f855[_0x7112('0x73')])['format'](_0x7112('0xd7'))[_0x7112('0x94')](),'sender':_0xb3f855[_0x7112('0xce')]===_0x7112('0xe2')?_0xb3f855[_0x7112('0x6d')]?_0xb3f855[_0x7112('0x6d')]['fullname']:_0x7112('0xe3'):_0xb3f855[_0x7112('0xcc')][_0x7112('0xe4')]+(_0xb3f855['Contact'][_0x7112('0xe5')]?'\x20'+_0xb3f855[_0x7112('0xcc')][_0x7112('0xe5')]:''),'body':_0xb3f855[_0x7112('0xcd')]?_0xb3f855[_0x7112('0xcd')]['basename']:_0xb3f855['body'],'direction':_0xb3f855[_0x7112('0xce')]===_0x7112('0xe2')?'A':'C','secret':_0xb3f855[_0x7112('0xcf')],'read':_0xb3f855['read'],'attachment':_0xb3f855[_0x7112('0xcd')]};})[_0x7112('0x65')]()};return ejs[_0x7112('0xe6')](path['join'](config[_0x7112('0xc5')],_0x7112('0xc6'),_0x7112('0xe7'),_0x7112('0xe8')),{'interaction':_0xff4b53})[_0x7112('0x2a')](function(_0x1c4770){var _0x27093c=path['join'](_0x546cbf,_0x7112('0xe9')+_0x15a30['id']+'-'+_0x351ea2+_0x7112('0xea'));var _0x35e254={'path':_0x27093c,'channel':_0x7112('0xd4'),'interactionId':_0x15a30['id']};return pdf['createPdfFromHTML'](_0x1c4770,_0x35e254);})[_0x7112('0x2a')](function(){return new BPromise(function(_0x53b1b6,_0x455514){zipdir(_0x546cbf,{'saveTo':_0x4a8917},function(_0x57a20f,_0x753e16){if(_0x57a20f)return _0x455514(_0x57a20f);return _0x53b1b6(_0x753e16);});})['then'](function(){return new BPromise(function(_0x3bf841,_0xfeb90){rimraf(_0x546cbf,function(_0xe69f85){if(_0xe69f85)_0xfeb90(_0xe69f85);return _0x3bf841();});});})[_0x7112('0x2a')](function(){return _0x1366dc[_0x7112('0xc3')](_0x4a8917,_0x1af44b,function(_0x27ea6a){if(_0x27ea6a){console[_0x7112('0xeb')](_0x7112('0xec'),_0x27ea6a);}else{fs['unlinkSync'](_0x4a8917);}});});});}else{return _0x1366dc[_0x7112('0x1d')](0xc8);}})[_0x7112('0x37')](handleError(_0x1366dc,null));}; \ No newline at end of file +var _0x8aef=['socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','limit','count','apply','reject','save','update','then','destroy','error','stack','name','Users','map','fullname','TagIds','Tags','split','forEach','push','OpenchannelInteraction','rawAttributes','fieldName','key','keys','query','intersection','model','fields','attributes','length','nolimit','sort','where','filters','pick','select','field','color','from','tools_tags','u.id','ui.OpenchannelInteractionId','user_has_openchannel_interactions','users','openchannel_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','type','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','text','some','compact','isEmpty','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','OpenchannelAccountId','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.email','Contact.phone','c.mobile','c.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','show','params','includeAll','include','options','catch','create','describe','addMessage','OpenchannelMessage','ids','omit','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','findAll','openchannelInteractionTags:save','removeTags','download','unix','root','server','join','files','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','Owner','get','mkdirSync','Openchannel','Account','N.A.','closed','closedAt','disposition','Public','Private','existsSync','createReadStream','pipe','createWriteStream','out','System','Contact','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','localhost'];(function(_0x431d1d,_0x3b9d36){var _0x1b0835=function(_0x783eb9){while(--_0x783eb9){_0x431d1d['push'](_0x431d1d['shift']());}};_0x1b0835(++_0x3b9d36);}(_0x8aef,0x1c8));var _0xf8ae=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x8aef[_0x2dea24];return _0x309d58;};'use strict';var emlformat=require(_0xf8ae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf8ae('0x1'));var jsonpatch=require(_0xf8ae('0x2'));var rp=require(_0xf8ae('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf8ae('0x4'));var path=require(_0xf8ae('0x5'));var sox=require(_0xf8ae('0x6'));var csv=require(_0xf8ae('0x7'));var ejs=require(_0xf8ae('0x8'));var fs=require('fs');var fs_extra=require(_0xf8ae('0x9'));var _=require(_0xf8ae('0xa'));var squel=require('squel');var crypto=require(_0xf8ae('0xb'));var jsforce=require(_0xf8ae('0xc'));var deskjs=require(_0xf8ae('0xd'));var toCsv=require(_0xf8ae('0x7'));var querystring=require(_0xf8ae('0xe'));var Papa=require(_0xf8ae('0xf'));var Redis=require(_0xf8ae('0x10'));var authService=require(_0xf8ae('0x11'));var qs=require(_0xf8ae('0x12'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xf8ae('0x13'));var hardwareService=require(_0xf8ae('0x14'));var logger=require(_0xf8ae('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf8ae('0x16'));var db=require(_0xf8ae('0x17'))['db'];config[_0xf8ae('0x18')]=_['defaults'](config[_0xf8ae('0x18')],{'host':_0xf8ae('0x19'),'port':0x18eb});var socket=require(_0xf8ae('0x1a'))(new Redis(config['redis']));require(_0xf8ae('0x1b'))[_0xf8ae('0x1c')](socket);function respondWithStatusCode(_0x58d63b,_0x5a5b93){_0x5a5b93=_0x5a5b93||0xcc;return function(_0x558413){if(_0x558413){return _0x58d63b[_0xf8ae('0x1d')](_0x5a5b93);}return _0x58d63b[_0xf8ae('0x1e')](_0x5a5b93)[_0xf8ae('0x1f')]();};}function respondWithResult(_0x3b1e08,_0x4d9430){_0x4d9430=_0x4d9430||0xc8;return function(_0x480cf7){if(_0x480cf7){return _0x3b1e08['status'](_0x4d9430)[_0xf8ae('0x20')](_0x480cf7);}};}function respondWithFilteredResult(_0x2fd0b0,_0x400ccc){return function(_0x5f47bb){if(_0x5f47bb){var _0x3f4931=typeof _0x400ccc[_0xf8ae('0x21')]==='undefined'&&typeof _0x400ccc[_0xf8ae('0x22')]==='undefined';var _0x48ac79=_0x5f47bb['count'];var _0x25f9c2=_0x3f4931?0x0:_0x400ccc[_0xf8ae('0x21')];var _0xda79cc=_0x3f4931?_0x5f47bb[_0xf8ae('0x23')]:_0x400ccc[_0xf8ae('0x21')]+_0x400ccc[_0xf8ae('0x22')];var _0x51ffa6;if(_0xda79cc>=_0x48ac79){_0xda79cc=_0x48ac79;_0x51ffa6=0xc8;}else{_0x51ffa6=0xce;}_0x2fd0b0[_0xf8ae('0x1e')](_0x51ffa6);return _0x2fd0b0['set']('Content-Range',_0x25f9c2+'-'+_0xda79cc+'/'+_0x48ac79)[_0xf8ae('0x20')](_0x5f47bb);}return null;};}function patchUpdates(_0x2be5e3){return function(_0x4357c2){try{jsonpatch[_0xf8ae('0x24')](_0x4357c2,_0x2be5e3,!![]);}catch(_0x4ba0f9){return BPromise[_0xf8ae('0x25')](_0x4ba0f9);}return _0x4357c2[_0xf8ae('0x26')]();};}function saveUpdates(_0x2b4d33,_0x151e23){return function(_0x6e055d){if(_0x6e055d){return _0x6e055d[_0xf8ae('0x27')](_0x2b4d33)[_0xf8ae('0x28')](function(_0x5a316c){return _0x5a316c;});}return null;};}function removeEntity(_0x14d01f,_0x15c223){return function(_0x232c34){if(_0x232c34){return _0x232c34[_0xf8ae('0x29')]()[_0xf8ae('0x28')](function(){_0x14d01f[_0xf8ae('0x1e')](0xcc)[_0xf8ae('0x1f')]();});}};}function handleEntityNotFound(_0x1c70a6,_0x49f241){return function(_0x3eec2f){if(!_0x3eec2f){_0x1c70a6[_0xf8ae('0x1d')](0x194);}return _0x3eec2f;};}function handleError(_0xfeb29a,_0xa5b14c){_0xa5b14c=_0xa5b14c||0x1f4;return function(_0x4bad6a){logger[_0xf8ae('0x2a')](_0x4bad6a[_0xf8ae('0x2b')]);if(_0x4bad6a['name']){delete _0x4bad6a[_0xf8ae('0x2c')];}_0xfeb29a['status'](_0xa5b14c)['send'](_0x4bad6a);};}function getInteractionUsers(_0x23c15c,_0x819559){return new BPromise(function(_0x2a510d,_0x1ff8f8){try{if(_0x819559[_0x23c15c['id']]){_0x23c15c[_0xf8ae('0x2d')]=_[_0xf8ae('0x2e')](_0x819559[_0x23c15c['id']],function(_0x2958e5){return{'id':_0x2958e5['id'],'fullname':_0x2958e5[_0xf8ae('0x2f')]};});}}catch(_0x52beea){_0x1ff8f8(_0x52beea);}_0x2a510d(_0x23c15c);});}function getInteractionTags(_0x1ae8d4,_0x247a47){return new BPromise(function(_0x3acb8d,_0x336a33){try{if(_0x1ae8d4[_0xf8ae('0x30')]){_0x1ae8d4[_0xf8ae('0x31')]=[];_0x1ae8d4[_0xf8ae('0x30')][_0xf8ae('0x32')](',')[_0xf8ae('0x33')](function(_0x2ffa5b){_0x1ae8d4['Tags'][_0xf8ae('0x34')](_0x247a47[_0x2ffa5b]);});}delete _0x1ae8d4[_0xf8ae('0x30')];}catch(_0xea14d0){_0x336a33(_0xea14d0);}_0x3acb8d(_0x1ae8d4);});}function updateOpenchannelInteraction(_0x478616,_0xf4637e,_0x206e13){return new BPromise(function(_0x5ab0b8,_0x5da1db){return getInteractionUsers(_0x478616,_0x206e13)[_0xf8ae('0x28')](function(_0x95dffa){return getInteractionTags(_0x95dffa,_0xf4637e);})[_0xf8ae('0x28')](function(_0x4ddbf2){_0x5ab0b8(_0x4ddbf2);})['catch'](function(_0x3a0ecd){_0x5da1db(_0x3a0ecd);});});}exports['index']=function(_0x21ffd0,_0x5b7dad){var _0x382e55={},_0x265338={},_0x14aee5={'count':0x0,'rows':[]};var _0xe543ba=_[_0xf8ae('0x2e')](db[_0xf8ae('0x35')][_0xf8ae('0x36')],function(_0x11edab){return{'name':_0x11edab[_0xf8ae('0x37')],'type':_0x11edab['type'][_0xf8ae('0x38')]};});_0x265338['model']=_['map'](_0xe543ba,_0xf8ae('0x2c'));_0x265338['query']=_[_0xf8ae('0x39')](_0x21ffd0[_0xf8ae('0x3a')]);_0x265338['filters']=_[_0xf8ae('0x3b')](_0x265338[_0xf8ae('0x3c')],_0x265338[_0xf8ae('0x3a')]);_0x382e55['attributes']=_['intersection'](_0x265338[_0xf8ae('0x3c')],qs[_0xf8ae('0x3d')](_0x21ffd0['query'][_0xf8ae('0x3d')]));_0x382e55[_0xf8ae('0x3e')]=_0x382e55[_0xf8ae('0x3e')][_0xf8ae('0x3f')]?_0x382e55['attributes']:_0x265338[_0xf8ae('0x3c')];if(!_0x21ffd0[_0xf8ae('0x3a')]['hasOwnProperty'](_0xf8ae('0x40'))){_0x382e55[_0xf8ae('0x22')]=qs[_0xf8ae('0x22')](_0x21ffd0[_0xf8ae('0x3a')][_0xf8ae('0x22')]);_0x382e55['offset']=qs[_0xf8ae('0x21')](_0x21ffd0[_0xf8ae('0x3a')][_0xf8ae('0x21')]);}_0x382e55['order']=qs[_0xf8ae('0x41')](_0x21ffd0[_0xf8ae('0x3a')]['sort']);_0x382e55[_0xf8ae('0x42')]=qs[_0xf8ae('0x43')](_[_0xf8ae('0x44')](_0x21ffd0[_0xf8ae('0x3a')],_0x265338[_0xf8ae('0x43')]),_0xe543ba);var _0x167b8b=[];var _0x36ad62=squel[_0xf8ae('0x45')]()[_0xf8ae('0x46')]('id')[_0xf8ae('0x46')](_0xf8ae('0x2c'))['field'](_0xf8ae('0x47'))[_0xf8ae('0x48')](_0xf8ae('0x49'));var _0x6d6d54=squel[_0xf8ae('0x45')]()['field'](_0xf8ae('0x4a'))[_0xf8ae('0x46')]('u.fullname')[_0xf8ae('0x46')](_0xf8ae('0x4b'))[_0xf8ae('0x48')](_0xf8ae('0x4c'),'ui')['left_join'](_0xf8ae('0x4d'),'u','u.id\x20=\x20ui.UserId');var _0x263673=squel[_0xf8ae('0x45')]()[_0xf8ae('0x48')](_0xf8ae('0x4e'),'i')[_0xf8ae('0x4f')](_0xf8ae('0x50'),'c',_0xf8ae('0x51'))[_0xf8ae('0x4f')]('users','o',_0xf8ae('0x52'))['left_join'](_0xf8ae('0x53'),'a',_0xf8ae('0x54'))['left_join'](_0xf8ae('0x55'),'me',_0xf8ae('0x56'))[_0xf8ae('0x4f')]('openchannel_interaction_has_tags','it',_0xf8ae('0x57'))[_0xf8ae('0x4f')](_0xf8ae('0x49'),'t',_0xf8ae('0x58'));var _0x3f1398=squel[_0xf8ae('0x59')]();var _0x803e5b=[];var _0x2e0cde=squel[_0xf8ae('0x59')]();var _0x2a8b5b;if(_0x21ffd0[_0xf8ae('0x3a')]['search']){_0x2a8b5b=as['parseSearch'](_0x21ffd0[_0xf8ae('0x3a')][_0xf8ae('0x5a')]);var _0x44558e=_0x2a8b5b[_0xf8ae('0x5b')];for(var _0x12e203=0x0;_0x12e203<_0x2a8b5b['conditions'][_0xf8ae('0x3f')];_0x12e203++){var _0x24507d=_0x2a8b5b['conditions'][_0x12e203];var _0x1a9c97='i';var _0x362771=_['find'](_0xe543ba,['name',_0x24507d[_0xf8ae('0x46')]]);if(!_0x362771){switch(_0x24507d[_0xf8ae('0x46')]){case _0xf8ae('0x5c'):if(_0x24507d[_0xf8ae('0x5d')]==0x1){_0x263673[_0xf8ae('0x5e')]('`'+_0x24507d['field']+_0xf8ae('0x5f'));}else{_0x263673[_0xf8ae('0x5e')]('`'+_0x24507d[_0xf8ae('0x46')]+_0xf8ae('0x60'));}break;case'Contact':if(_0x24507d[_0xf8ae('0x61')]===_0xf8ae('0x62')){if(_0x24507d[_0xf8ae('0x5d')][_0xf8ae('0x32')]('\x20')[_0xf8ae('0x3f')]>0x1){_0x3f1398[_0x44558e](_0xf8ae('0x63'),qs[_0xf8ae('0x64')](_0x24507d[_0xf8ae('0x5d')]),null);}else{var _0x59f9b0='%'+_0x24507d[_0xf8ae('0x5d')]+'%';_0x3f1398[_0x44558e](_0xf8ae('0x65'),_0x59f9b0,_0x59f9b0,_0x59f9b0);}}else{_0x362771=_[_0xf8ae('0x66')](_0xe543ba,[_0xf8ae('0x2c'),'ContactId']);_0x24507d[_0xf8ae('0x46')]=_0xf8ae('0x67');_0x5ad9ef=as[_0xf8ae('0x68')](_0x1a9c97,_0x362771[_0xf8ae('0x69')],_0x24507d);_0x3f1398[_0x44558e](_0x5ad9ef['text'],_0x5ad9ef[_0xf8ae('0x5d')][_0xf8ae('0x6a')],_0x5ad9ef[_0xf8ae('0x5d')][_0xf8ae('0x1f')]);}break;case _0xf8ae('0x6b'):var _0x112a39=_0x24507d[_0xf8ae('0x5d')][_0xf8ae('0x32')](',')[_0xf8ae('0x2e')](function(_0x5f31aa){return Number(_0x5f31aa);});_0x112a39[_0xf8ae('0x33')](function(_0x428755){_0x2e0cde['or'](_0xf8ae('0x6c'),'%,'+_0x428755+',%');});_0x803e5b=_[_0xf8ae('0x6d')](_0x803e5b,_0x112a39);break;case _0xf8ae('0x6e'):if(_0x24507d[_0xf8ae('0x61')]===_0xf8ae('0x62')){_0x3f1398[_0x44558e](_0xf8ae('0x6f'),'%'+_0x24507d[_0xf8ae('0x5d')]+'%',null);}else{_0x362771=_[_0xf8ae('0x66')](_0xe543ba,[_0xf8ae('0x2c'),_0xf8ae('0x70')]);_0x24507d[_0xf8ae('0x46')]=_0xf8ae('0x70');_0x5ad9ef=as[_0xf8ae('0x68')](_0x1a9c97,_0x362771[_0xf8ae('0x69')],_0x24507d);_0x3f1398[_0x44558e](_0x5ad9ef['text'],_0x5ad9ef[_0xf8ae('0x5d')]['start'],_0x5ad9ef[_0xf8ae('0x5d')][_0xf8ae('0x1f')]);}break;case _0xf8ae('0x71'):_0x5ad9ef=as[_0xf8ae('0x68')]('me',null,_0x24507d);_0x3f1398[_0x44558e](_0x5ad9ef[_0xf8ae('0x72')],_0x5ad9ef['value'][_0xf8ae('0x6a')],_0x5ad9ef[_0xf8ae('0x5d')][_0xf8ae('0x1f')]);break;}}else{var _0x5ad9ef=as['buildExpression'](_0x1a9c97,_0x362771[_0xf8ae('0x69')],_0x24507d);_0x3f1398[_0x44558e](_0x5ad9ef[_0xf8ae('0x72')],_0x5ad9ef[_0xf8ae('0x5d')][_0xf8ae('0x6a')],_0x5ad9ef['value'][_0xf8ae('0x1f')]);}}}else{var _0x1f1253=_(_0x21ffd0[_0xf8ae('0x3a')])[_0xf8ae('0x39')]()[_0xf8ae('0x2e')](function(_0x48efcf){return _[_0xf8ae('0x73')](_0xe543ba,[_0xf8ae('0x2c'),_0x48efcf])?_0x48efcf:undefined;})[_0xf8ae('0x74')]()[_0xf8ae('0x5d')]();if(!_[_0xf8ae('0x75')](_0x1f1253)){_0x1f1253[_0xf8ae('0x33')](function(_0x548a8d){if(_0x548a8d==='OpenchannelAccountId'){_0x263673[_0xf8ae('0x42')](_0xf8ae('0x76'),[][_0xf8ae('0x77')](_0x21ffd0[_0xf8ae('0x3a')][_0x548a8d]));}else if(_0x548a8d===_0xf8ae('0x78')){var _0x59ce72=JSON[_0xf8ae('0x79')](_0x21ffd0[_0xf8ae('0x3a')][_0x548a8d])[_0xf8ae('0x7a')];var _0xeecd44=JSON[_0xf8ae('0x79')](_0x21ffd0[_0xf8ae('0x3a')][_0x548a8d])[_0xf8ae('0x7b')];_0x263673['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x59ce72,_0xeecd44);}else{if(_0x21ffd0[_0xf8ae('0x3a')][_0x548a8d]===_0xf8ae('0x7c')){_0x263673[_0xf8ae('0x42')]('i.'+_0x548a8d+_0xf8ae('0x7d'));}else{_0x263673['where']('i.'+_0x548a8d+_0xf8ae('0x7e'),_0x21ffd0[_0xf8ae('0x3a')][_0x548a8d]);}}});}if(_0x21ffd0[_0xf8ae('0x3a')]['read']){if(_0x21ffd0[_0xf8ae('0x3a')][_0xf8ae('0x7f')]==0x1){_0x263673[_0xf8ae('0x5e')]('`unreadMessages`\x20=\x200');}else{_0x263673['having'](_0xf8ae('0x80'));}}if(_0x21ffd0[_0xf8ae('0x3a')][_0xf8ae('0x81')]){_0x803e5b=_[_0xf8ae('0x82')](_0x21ffd0[_0xf8ae('0x3a')][_0xf8ae('0x81')])?_0x21ffd0[_0xf8ae('0x3a')][_0xf8ae('0x81')]:new Array(_0x21ffd0[_0xf8ae('0x3a')][_0xf8ae('0x81')]);_0x803e5b[_0xf8ae('0x33')](function(_0x44b238){_0x2e0cde['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x44b238+',%');});}if(_0x21ffd0['query'][_0xf8ae('0x83')]){var _0x1426a0=_0x21ffd0['query'][_0xf8ae('0x83')][_0xf8ae('0x84')]('\x5c','\x5c\x5c')[_0xf8ae('0x84')](/'/g,'\x27\x27');if(qs[_0xf8ae('0x85')](_0x1426a0)){_0x3f1398['or'](_0xf8ae('0x86'),_0x1426a0+'%');}else{_0x3f1398['or'](_0xf8ae('0x87'),qs[_0xf8ae('0x64')](_0x1426a0))['or'](_0xf8ae('0x88'),_0x1426a0+'%')['or'](_0xf8ae('0x89'),_0x1426a0+'%');}}}_0x263673['where'](_0x3f1398);_0x263673[_0xf8ae('0x8a')](_0xf8ae('0x8b'));var _0x380b51={'type':db[_0xf8ae('0x8c')][_0xf8ae('0x8d')][_0xf8ae('0x8e')],'raw':!![]};var _0x3bd689=_0x263673[_0xf8ae('0x8f')]();_0x3bd689['field'](_0xf8ae('0x8b'));_0x3bd689['field'](_0xf8ae('0x90'),_0xf8ae('0x5c'));if(_0x382e55[_0xf8ae('0x91')]){_0x382e55['order'][_0xf8ae('0x33')](function(_0xc9f7e0){var _0x38337c=_0xc9f7e0[0x0]===_0xf8ae('0x92')?_0xc9f7e0[0x0]:'i.'+_0xc9f7e0[0x0];_0x263673[_0xf8ae('0x91')](_0x38337c,_0xc9f7e0[0x1]===_0xf8ae('0x93')?![]:!![]);});}if(!_['isEmpty'](_0x803e5b)){_0x263673[_0xf8ae('0x5e')](_0x2e0cde);_0x3bd689[_0xf8ae('0x42')](_0xf8ae('0x94'),_0x803e5b);}BPromise[_0xf8ae('0x95')]()[_0xf8ae('0x28')](function(){if(!_0x2a8b5b){if(_0x21ffd0[_0xf8ae('0x3a')][_0xf8ae('0x96')])return;_0x3bd689[_0xf8ae('0x42')](_0xf8ae('0x97'));_0x263673[_0xf8ae('0x42')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x21ffd0[_0xf8ae('0x98')][_0xf8ae('0x99')]!==_0xf8ae('0x9a'))return;return _0x21ffd0[_0xf8ae('0x98')][_0xf8ae('0x9b')]({'attributes':['id'],'raw':!![]})[_0xf8ae('0x28')](function(_0x20e4a6){if(_[_0xf8ae('0x75')](_0x20e4a6)){_0x3bd689[_0xf8ae('0x42')](_0xf8ae('0x9c'));_0x263673[_0xf8ae('0x42')](_0xf8ae('0x9c'));}else{_0x3bd689[_0xf8ae('0x42')](_0xf8ae('0x76'),_[_0xf8ae('0x2e')](_0x20e4a6,'id'));_0x263673[_0xf8ae('0x42')](_0xf8ae('0x76'),_[_0xf8ae('0x2e')](_0x20e4a6,'id'));}});})['then'](function(){if(_0x21ffd0[_0xf8ae('0x98')][_0xf8ae('0x99')]===_0xf8ae('0x9a')&&!_0x2a8b5b&&!_0x21ffd0[_0xf8ae('0x3a')][_0xf8ae('0x96')])return[];return db['sequelize'][_0xf8ae('0x3a')](_0x3bd689[_0xf8ae('0x9d')](),_0x380b51);})[_0xf8ae('0x28')](function(_0xd2c653){_0x14aee5[_0xf8ae('0x23')]=_0xd2c653['length'];if(_0x14aee5[_0xf8ae('0x23')]===0x0)return[];return db[_0xf8ae('0x9e')][_0xf8ae('0x3a')](_0x36ad62['toString'](),_0x380b51)[_0xf8ae('0x28')](function(_0x511278){_0x167b8b=_[_0xf8ae('0x9f')](_0x511278,'id');_0x380b51=_[_0xf8ae('0xa0')](_0x380b51,{'model':db[_0xf8ae('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x21ffd0[_0xf8ae('0x3a')][_0xf8ae('0x3d')]){_0x382e55['attributes'][_0xf8ae('0x33')](function(_0x2e103f){_0x263673[_0xf8ae('0x46')]('i.'+_0x2e103f);});}else{_0x263673[_0xf8ae('0x46')](_0xf8ae('0x90'),'unreadMessages');_0x263673[_0xf8ae('0x46')](_0xf8ae('0xa1'),_0xf8ae('0xa2'));_0x263673[_0xf8ae('0x46')](_0xf8ae('0xa3'),'Account.mandatoryDisposition');_0x263673[_0xf8ae('0x46')](_0xf8ae('0xa4'),_0xf8ae('0x92'));_0x263673[_0xf8ae('0x46')](_0xf8ae('0xa5'));_0x263673[_0xf8ae('0x46')](_0xf8ae('0xa6'),'Contact.firstName');_0x263673[_0xf8ae('0x46')]('c.lastName','Contact.lastName');_0x263673[_0xf8ae('0x46')](_0xf8ae('0xa7'),'Contact.email');_0x263673['field']('c.phone',_0xf8ae('0xa8'));_0x263673[_0xf8ae('0x46')](_0xf8ae('0xa9'),'Contact.mobile');_0x263673[_0xf8ae('0x46')](_0xf8ae('0xaa'),'Contact.fax');_0x263673[_0xf8ae('0x46')]('o.fullname',_0xf8ae('0xab'));_0x263673['field'](_0xf8ae('0xac'),'Owner.internal');_0x263673[_0xf8ae('0x46')](_0xf8ae('0xad'),_0xf8ae('0x30'));}if(_0x382e55[_0xf8ae('0x22')])_0x263673['limit'](_0x382e55[_0xf8ae('0x22')]);if(_0x382e55[_0xf8ae('0x21')])_0x263673['offset'](_0x382e55[_0xf8ae('0x21')]);return db[_0xf8ae('0x9e')][_0xf8ae('0x3a')](_0x263673[_0xf8ae('0x9d')](),_0x380b51);})['then'](function(_0x51adf5){if(_0x51adf5[_0xf8ae('0x3f')]>0x0)_0x6d6d54[_0xf8ae('0x42')](_0xf8ae('0xae'),_['map'](_0x51adf5,'id'));return db[_0xf8ae('0x9e')][_0xf8ae('0x3a')](_0x6d6d54[_0xf8ae('0x9d')](),_0x380b51)[_0xf8ae('0x28')](function(_0x4e6890){var _0x966937=_[_0xf8ae('0xaf')](_0x4e6890,_0xf8ae('0xb0'));var _0x8beab5=[];_0x51adf5[_0xf8ae('0x33')](function(_0x4fde7d){_0x8beab5[_0xf8ae('0x34')](updateOpenchannelInteraction(_0x4fde7d,_0x167b8b,_0x966937));});return BPromise[_0xf8ae('0xb1')](_0x8beab5);});});})[_0xf8ae('0x28')](function(_0x33d7b2){_0x14aee5['rows']=_0x33d7b2;return _0x14aee5;})[_0xf8ae('0x28')](respondWithFilteredResult(_0x5b7dad,_0x382e55))['catch'](handleError(_0x5b7dad,null));};exports[_0xf8ae('0xb2')]=function(_0x1a6d96,_0x4e84e8){var _0x3445bc={};if(_0x1a6d96[_0xf8ae('0x3a')]['type']&&_0x1a6d96[_0xf8ae('0x3a')]['type']==='from'){_0x3445bc[_0xf8ae('0x48')]=_0x1a6d96[_0xf8ae('0xb3')]['id'];}else{_0x3445bc['id']=_0x1a6d96[_0xf8ae('0xb3')]['id'];}var _0x34d126={'raw':![],'where':_0x3445bc},_0x56eaec={};_0x56eaec['model']=_['keys'](db['OpenchannelInteraction'][_0xf8ae('0x36')]);_0x56eaec[_0xf8ae('0x3a')]=_[_0xf8ae('0x39')](_0x1a6d96['query']);_0x56eaec[_0xf8ae('0x43')]=_[_0xf8ae('0x3b')](_0x56eaec[_0xf8ae('0x3c')],_0x56eaec[_0xf8ae('0x3a')]);_0x34d126[_0xf8ae('0x3e')]=_[_0xf8ae('0x3b')](_0x56eaec[_0xf8ae('0x3c')],qs[_0xf8ae('0x3d')](_0x1a6d96[_0xf8ae('0x3a')]['fields']));_0x34d126[_0xf8ae('0x3e')]=_0x34d126[_0xf8ae('0x3e')][_0xf8ae('0x3f')]?_0x34d126['attributes']:_0x56eaec[_0xf8ae('0x3c')];if(_0x1a6d96[_0xf8ae('0x3a')][_0xf8ae('0xb4')]){_0x34d126[_0xf8ae('0xb5')]=[{'all':!![]}];}_0x34d126=_['merge']({},_0x34d126,_0x1a6d96[_0xf8ae('0xb6')]);return db[_0xf8ae('0x35')][_0xf8ae('0x66')](_0x34d126)[_0xf8ae('0x28')](handleEntityNotFound(_0x4e84e8,null))[_0xf8ae('0x28')](respondWithResult(_0x4e84e8,null))[_0xf8ae('0xb7')](handleError(_0x4e84e8,null));};exports[_0xf8ae('0xb8')]=function(_0x1f526d,_0xf3a4b1){return db['OpenchannelInteraction'][_0xf8ae('0xb8')](_0x1f526d[_0xf8ae('0x71')],{})[_0xf8ae('0x28')](respondWithResult(_0xf3a4b1,0xc9))[_0xf8ae('0xb7')](handleError(_0xf3a4b1,null));};exports[_0xf8ae('0x27')]=function(_0x3b477d,_0x425650){if(_0x3b477d['body']['id']){delete _0x3b477d[_0xf8ae('0x71')]['id'];}return db[_0xf8ae('0x35')][_0xf8ae('0x66')]({'where':{'id':_0x3b477d['params']['id']}})[_0xf8ae('0x28')](handleEntityNotFound(_0x425650,null))['then'](saveUpdates(_0x3b477d[_0xf8ae('0x71')],null))[_0xf8ae('0x28')](respondWithResult(_0x425650,null))[_0xf8ae('0xb7')](handleError(_0x425650,null));};exports['destroy']=function(_0xede21d,_0x572364){return db[_0xf8ae('0x35')][_0xf8ae('0x66')]({'where':{'id':_0xede21d[_0xf8ae('0xb3')]['id']}})['then'](handleEntityNotFound(_0x572364,null))[_0xf8ae('0x28')](removeEntity(_0x572364,null))[_0xf8ae('0xb7')](handleError(_0x572364,null));};exports[_0xf8ae('0xb9')]=function(_0x5f0738,_0x536252){return db[_0xf8ae('0x35')][_0xf8ae('0xb9')]()[_0xf8ae('0x28')](respondWithResult(_0x536252,null))[_0xf8ae('0xb7')](handleError(_0x536252,null));};exports[_0xf8ae('0xba')]=function(_0x48a8e4,_0x1f06d3,_0x206588){return db[_0xf8ae('0xbb')][_0xf8ae('0x66')]({'where':{'id':_0x48a8e4['params']['id']}})[_0xf8ae('0x28')](handleEntityNotFound(_0x1f06d3,null))[_0xf8ae('0x28')](function(_0x27f69e){if(_0x27f69e){return _0x27f69e[_0xf8ae('0xba')](_0x48a8e4['body'][_0xf8ae('0xbc')],_[_0xf8ae('0xbd')](_0x48a8e4[_0xf8ae('0x71')],[_0xf8ae('0xbc'),'id'])||{});}})[_0xf8ae('0x28')](respondWithResult(_0x1f06d3,null))[_0xf8ae('0xb7')](handleError(_0x1f06d3,null));};exports['getMessages']=function(_0xcda64b,_0x3382fd,_0x1210e8){var _0x27a8de={'raw':![],'where':{}};var _0x2c9607={};var _0x3f0f0b={'count':0x0,'rows':[]};return db[_0xf8ae('0x35')]['findOne']({'where':{'id':_0xcda64b[_0xf8ae('0xb3')]['id']}})['then'](handleEntityNotFound(_0x3382fd,null))[_0xf8ae('0x28')](function(_0x45a622){if(_0x45a622){_0x2c9607[_0xf8ae('0x3c')]=_[_0xf8ae('0x39')](db[_0xf8ae('0xbb')]['rawAttributes']);_0x2c9607[_0xf8ae('0x3a')]=_['keys'](_0xcda64b[_0xf8ae('0x3a')]);_0x2c9607[_0xf8ae('0x43')]=_[_0xf8ae('0x3b')](_0x2c9607[_0xf8ae('0x3c')],_0x2c9607[_0xf8ae('0x3a')]);_0x27a8de[_0xf8ae('0x3e')]=_[_0xf8ae('0x3b')](_0x2c9607[_0xf8ae('0x3c')],qs[_0xf8ae('0x3d')](_0xcda64b[_0xf8ae('0x3a')][_0xf8ae('0x3d')]));_0x27a8de[_0xf8ae('0x3e')]=_0x27a8de[_0xf8ae('0x3e')][_0xf8ae('0x3f')]?_0x27a8de[_0xf8ae('0x3e')]:_0x2c9607['model'];if(!_0xcda64b[_0xf8ae('0x3a')][_0xf8ae('0xbe')](_0xf8ae('0x40'))){_0x27a8de[_0xf8ae('0x22')]=qs[_0xf8ae('0x22')](_0xcda64b[_0xf8ae('0x3a')][_0xf8ae('0x22')]);_0x27a8de[_0xf8ae('0x21')]=qs[_0xf8ae('0x21')](_0xcda64b[_0xf8ae('0x3a')][_0xf8ae('0x21')]);}_0x27a8de[_0xf8ae('0x91')]=qs[_0xf8ae('0x41')](_0xcda64b['query']['sort']);_0x27a8de[_0xf8ae('0x42')]=qs[_0xf8ae('0x43')](_['pick'](_0xcda64b['query'],_0x2c9607[_0xf8ae('0x43')]));_0x27a8de[_0xf8ae('0x42')]['OpenchannelInteractionId']=_0x45a622['id'];if(_0xcda64b[_0xf8ae('0x3a')][_0xf8ae('0x83')]){_0x27a8de[_0xf8ae('0x42')]=_[_0xf8ae('0xa0')](_0x27a8de['where'],{'$or':_[_0xf8ae('0x2e')](_0x27a8de[_0xf8ae('0x3e')],function(_0x3e3420){var _0x435066={};_0x435066[_0x3e3420]={'$like':'%'+_0xcda64b['query']['filter']+'%'};return _0x435066;})});}if(_0xcda64b[_0xf8ae('0x3a')]['$gte']){var _0x48478a=_0xcda64b[_0xf8ae('0x3a')]['$gte'][_0xf8ae('0x32')](',');var _0x593421={};_0x593421[_0x48478a[0x0]]={'$gte':moment(_0x48478a[0x1])[_0xf8ae('0xbf')](_0xf8ae('0xc0'))};_0x27a8de[_0xf8ae('0x42')]=_['merge'](_0x27a8de[_0xf8ae('0x42')],_0x593421);}_0x27a8de=_['merge']({},_0x27a8de,_0xcda64b[_0xf8ae('0xb6')]);return db['OpenchannelMessage'][_0xf8ae('0x23')]({'where':_0x27a8de[_0xf8ae('0x42')]})[_0xf8ae('0x28')](function(_0x2413d6){_0x3f0f0b['count']=_0x2413d6;if(_0xcda64b['query']['includeAll']){_0x27a8de['include']=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x27a8de);})['then'](function(_0x18f7ce){_0x3f0f0b[_0xf8ae('0xc1')]=_0x18f7ce;return _0x3f0f0b;});}})[_0xf8ae('0x28')](respondWithFilteredResult(_0x3382fd,_0x27a8de))[_0xf8ae('0xb7')](handleError(_0x3382fd,null));};exports[_0xf8ae('0xc2')]=function(_0x1c3670,_0xd61f35,_0x5a8854){return db['OpenchannelInteraction']['find']({'where':{'id':_0x1c3670['params']['id']}})[_0xf8ae('0x28')](handleEntityNotFound(_0xd61f35,null))['then'](function(_0x43f49c){if(_0x43f49c){return _0x43f49c[_0xf8ae('0xc3')](_0x1c3670[_0xf8ae('0x71')][_0xf8ae('0xbc')],_[_0xf8ae('0xbd')](_0x1c3670[_0xf8ae('0x71')],[_0xf8ae('0xbc'),'id'])||{})[_0xf8ae('0xc4')](function(){return db[_0xf8ae('0x6b')][_0xf8ae('0xc5')]({'attributes':['id',_0xf8ae('0x2c'),_0xf8ae('0x47')],'where':{'id':_0x1c3670[_0xf8ae('0x71')][_0xf8ae('0xbc')]}});})[_0xf8ae('0x28')](function(_0xfd38f0){socket['emit'](_0xf8ae('0xc6'),{'id':Number(_0x1c3670['params']['id']),'tags':_0xfd38f0||[]});return{'id':Number(_0x1c3670[_0xf8ae('0xb3')]['id']),'tags':_0xfd38f0||[]};});}})['then'](respondWithResult(_0xd61f35,null))[_0xf8ae('0xb7')](handleError(_0xd61f35,null));};exports['removeTags']=function(_0xe37bf6,_0x549c8d,_0x5ea5b6){return db[_0xf8ae('0x35')][_0xf8ae('0x66')]({'where':{'id':_0xe37bf6['params']['id']}})[_0xf8ae('0x28')](handleEntityNotFound(_0x549c8d,null))['then'](function(_0x495191){if(_0x495191){return _0x495191[_0xf8ae('0xc7')](_0xe37bf6[_0xf8ae('0x3a')][_0xf8ae('0xbc')]);}})[_0xf8ae('0x28')](respondWithStatusCode(_0x549c8d,null))[_0xf8ae('0xb7')](handleError(_0x549c8d,null));};exports[_0xf8ae('0xc8')]=function(_0x30e49b,_0x4259e9){var _0x29cd76=moment()[_0xf8ae('0xc9')]()[_0xf8ae('0x9d')]();var _0x242b7e=path['join'](config[_0xf8ae('0xca')],_0xf8ae('0xcb'),'files','tmp');var _0x24a858=path[_0xf8ae('0xcc')](config[_0xf8ae('0xca')],'server',_0xf8ae('0xcd'),_0xf8ae('0xce'));var _0x11e534=path['join'](_0x242b7e,_0x29cd76);var _0x38e423=util[_0xf8ae('0xbf')](_0xf8ae('0xcf'),_0x30e49b['params']['id'],_0x29cd76);var _0x1cfd60=path[_0xf8ae('0xcc')](_0x242b7e,_0x38e423);var _0x5c338d=[];_0x5c338d[_0xf8ae('0x34')]({'model':db[_0xf8ae('0x6e')],'as':_0xf8ae('0x6e'),'attributes':['id',_0xf8ae('0x2f')],'raw':!![]});_0x5c338d['push']({'model':db[_0xf8ae('0xd0')],'as':'Contact','attributes':['id',_0xf8ae('0xd1'),_0xf8ae('0xd2')],'raw':!![]});if(_0x30e49b['query'][_0xf8ae('0xce')]){_0x5c338d[_0xf8ae('0x34')]({'model':db[_0xf8ae('0xd3')],'as':'Attachment','raw':!![]});}var _0x1985fd=[{'model':db[_0xf8ae('0xbb')],'as':_0xf8ae('0xd4'),'attributes':['id',_0xf8ae('0x71'),_0xf8ae('0x78'),_0xf8ae('0xd5'),_0xf8ae('0xd6'),'read'],'include':_0x5c338d}];_0x1985fd['push']({'model':db[_0xf8ae('0xd7')],'as':'Account','attributes':['id','name']});_0x1985fd[_0xf8ae('0x34')]({'model':db[_0xf8ae('0x6e')],'as':_0xf8ae('0xd8'),'attributes':['id','fullname']});return db[_0xf8ae('0x35')][_0xf8ae('0x66')]({'where':{'id':_0x30e49b['params']['id']},'include':_0x1985fd})[_0xf8ae('0x28')](handleEntityNotFound(_0x4259e9,null))['then'](function(_0x31622f){if(_0x31622f){var _0x1e4cc2=_0x31622f[_0xf8ae('0xd9')]({'plain':!![]});fs[_0xf8ae('0xda')](_0x11e534);var _0x593779={'channel':_0xf8ae('0xdb'),'account':_0x1e4cc2[_0xf8ae('0xdc')][_0xf8ae('0x2c')],'agent':_0x1e4cc2['Owner']?_0x1e4cc2[_0xf8ae('0xd8')][_0xf8ae('0x2f')]:_0xf8ae('0xdd'),'createdAt':moment(_0x1e4cc2[_0xf8ae('0x78')])[_0xf8ae('0xbf')](_0xf8ae('0xc0'))[_0xf8ae('0x9d')](),'closedAt':_0x1e4cc2[_0xf8ae('0xde')]?moment(_0x1e4cc2[_0xf8ae('0xdf')])[_0xf8ae('0xbf')](_0xf8ae('0xc0'))[_0xf8ae('0x9d')]():'','disposition':_0x1e4cc2[_0xf8ae('0xe0')],'visibility':_0x1e4cc2['threadId']?_0xf8ae('0xe1'):_0xf8ae('0xe2'),'messages':_(_0x1e4cc2[_0xf8ae('0xd4')])[_0xf8ae('0x83')]({'secret':![]})[_0xf8ae('0x2e')](function(_0x23fe51){if(_0x23fe51[_0xf8ae('0xd3')]){var _0x8613e2=path[_0xf8ae('0xcc')](_0x24a858,_0x23fe51['Attachment']['basename']);if(fs[_0xf8ae('0xe3')](_0x8613e2)){fs[_0xf8ae('0xe4')](_0x8613e2)[_0xf8ae('0xe5')](fs[_0xf8ae('0xe6')](path['join'](_0x11e534,_0x23fe51[_0xf8ae('0xd3')]['basename'])));}}return{'date':moment(_0x23fe51[_0xf8ae('0x78')])[_0xf8ae('0xbf')](_0xf8ae('0xc0'))[_0xf8ae('0x9d')](),'sender':_0x23fe51['direction']===_0xf8ae('0xe7')?_0x23fe51[_0xf8ae('0x6e')]?_0x23fe51['User']['fullname']:_0xf8ae('0xe8'):_0x23fe51[_0xf8ae('0xe9')]['firstName']+(_0x23fe51[_0xf8ae('0xe9')][_0xf8ae('0xd2')]?'\x20'+_0x23fe51['Contact']['lastName']:''),'body':_0x23fe51[_0xf8ae('0xd3')]?_0x23fe51[_0xf8ae('0xd3')]['basename']:_0x23fe51[_0xf8ae('0x71')],'direction':_0x23fe51[_0xf8ae('0xd5')]===_0xf8ae('0xe7')?'A':'C','secret':_0x23fe51[_0xf8ae('0xd6')],'read':_0x23fe51[_0xf8ae('0x7f')],'attachment':_0x23fe51[_0xf8ae('0xd3')]};})[_0xf8ae('0x5d')]()};return ejs[_0xf8ae('0xea')](path[_0xf8ae('0xcc')](config[_0xf8ae('0xca')],_0xf8ae('0xcb'),_0xf8ae('0xeb'),_0xf8ae('0xec')),{'interaction':_0x593779})[_0xf8ae('0x28')](function(_0x408033){var _0x4af6ca=path['join'](_0x11e534,'transcript-'+_0x1e4cc2['id']+'-'+_0x29cd76+_0xf8ae('0xed'));var _0x5f4f7d={'path':_0x4af6ca,'channel':_0xf8ae('0xdb'),'interactionId':_0x1e4cc2['id']};return pdf[_0xf8ae('0xee')](_0x408033,_0x5f4f7d);})[_0xf8ae('0x28')](function(){return new BPromise(function(_0x2e4ac8,_0x3c9344){zipdir(_0x11e534,{'saveTo':_0x1cfd60},function(_0x288e1f,_0x232c1e){if(_0x288e1f)return _0x3c9344(_0x288e1f);return _0x2e4ac8(_0x232c1e);});})[_0xf8ae('0x28')](function(){return new BPromise(function(_0x54e620,_0x247c4e){rimraf(_0x11e534,function(_0x3283cf){if(_0x3283cf)_0x247c4e(_0x3283cf);return _0x54e620();});});})[_0xf8ae('0x28')](function(){return _0x4259e9['download'](_0x1cfd60,_0x38e423,function(_0x2a4e9e){if(_0x2a4e9e){console[_0xf8ae('0xef')]('err',_0x2a4e9e);}else{fs[_0xf8ae('0xf0')](_0x1cfd60);}});});});}else{return _0x4259e9[_0xf8ae('0x1d')](0xc8);}})[_0xf8ae('0xb7')](handleError(_0x4259e9,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 1d30d68..7735b1a 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 _0x666f=['then','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','map','findAll'];(function(_0x2498b5,_0x514ddb){var _0x5c48d8=function(_0xee9bb5){while(--_0xee9bb5){_0x2498b5['push'](_0x2498b5['shift']());}};_0x5c48d8(++_0x514ddb);}(_0x666f,0x1ab));var _0xf666=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x666f[_0x19950b];return _0x3c6b41;};'use strict';var EventEmitter=require(_0xf666('0x0'));var OpenchannelInteraction=require(_0xf666('0x1'))['db'][_0xf666('0x2')];var OpenchannelMessage=require('../../mysqldb')['db'][_0xf666('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xf666('0x4')](0x0);var events={'afterCreate':_0xf666('0x5'),'afterUpdate':_0xf666('0x6'),'afterDestroy':_0xf666('0x7')};function emitEvent(_0x23bdba){return function(_0x27a413,_0x4aebd9,_0x4da6c5){_0x27a413[_0xf666('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x306804){_0x27a413[_0xf666('0x9')](_0xf666('0xa'),_0x306804[_0xf666('0xb')](function(_0xe9a17c){return{'id':_0xe9a17c['id']};}));return OpenchannelMessage[_0xf666('0xc')]({'where':{'OpenchannelInteractionId':_0x27a413['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf666('0xd')](function(_0x58c665){_0x27a413['setDataValue'](_0xf666('0xe'),_0x58c665[_0xf666('0xf')]);OpenchannelInteractionEvents[_0xf666('0x10')](_0x23bdba+':'+_0x27a413['id'],_0x27a413);OpenchannelInteractionEvents[_0xf666('0x10')](_0x23bdba,_0x27a413);_0x4da6c5(null);})[_0xf666('0x11')](_0x4da6c5(null));};}for(var e in events){if(events[_0xf666('0x12')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0xf666('0x13')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xa948=['OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','map','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','OpenchannelInteraction'];(function(_0x4f1874,_0x2aff4d){var _0x5e8a73=function(_0x2e19e6){while(--_0x2e19e6){_0x4f1874['push'](_0x4f1874['shift']());}};_0x5e8a73(++_0x2aff4d);}(_0xa948,0x178));var _0x8a94=function(_0x1d8f95,_0xcd1d0e){_0x1d8f95=_0x1d8f95-0x0;var _0x4cb618=_0xa948[_0x1d8f95];return _0x4cb618;};'use strict';var EventEmitter=require(_0x8a94('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x8a94('0x1')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x8a94('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x8a94('0x3')](0x0);var events={'afterCreate':_0x8a94('0x4'),'afterUpdate':_0x8a94('0x5'),'afterDestroy':_0x8a94('0x6')};function emitEvent(_0x10ba40){return function(_0x5ced52,_0x38498f,_0x806aa8){_0x5ced52[_0x8a94('0x7')]({'attributes':['id'],'raw':!![]})[_0x8a94('0x8')](function(_0x355dac){_0x5ced52[_0x8a94('0x9')]('Users',_0x355dac[_0x8a94('0xa')](function(_0x31770d){return{'id':_0x31770d['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x5ced52['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8a94('0x8')](function(_0xc8341e){_0x5ced52['setDataValue'](_0x8a94('0xb'),_0xc8341e[_0x8a94('0xc')]);OpenchannelInteractionEvents[_0x8a94('0xd')](_0x10ba40+':'+_0x5ced52['id'],_0x5ced52);OpenchannelInteractionEvents[_0x8a94('0xd')](_0x10ba40,_0x5ced52);_0x806aa8(null);})[_0x8a94('0xe')](_0x806aa8(null));};}for(var e in events){if(events[_0x8a94('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x8a94('0x10')](e,emitEvent(event));}}module[_0x8a94('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 6c31027..1bd1b10 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 _0x8caf=['utf8mb4_unicode_ci','changed','format','lodash','util','api','moment','bluebird','request-promise','path','rimraf','OpenchannelInteraction','openchannel_interactions','utf8mb4'];(function(_0x211786,_0xf52e6b){var _0x5ec5fb=function(_0x4b1eb4){while(--_0x4b1eb4){_0x211786['push'](_0x211786['shift']());}};_0x5ec5fb(++_0xf52e6b);}(_0x8caf,0x16f));var _0xf8ca=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x8caf[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0xf8ca('0x0'));var util=require(_0xf8ca('0x1'));var logger=require('../../config/logger')(_0xf8ca('0x2'));var moment=require(_0xf8ca('0x3'));var BPromise=require(_0xf8ca('0x4'));var rp=require(_0xf8ca('0x5'));var fs=require('fs');var path=require(_0xf8ca('0x6'));var rimraf=require(_0xf8ca('0x7'));var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module['exports']=function(_0x5808d5,_0x1ebd7e){return _0x5808d5['define'](_0xf8ca('0x8'),attributes,{'tableName':_0xf8ca('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf8ca('0xa'),'collate':_0xf8ca('0xb'),'hooks':{'beforeUpdate':function(_0x565270,_0x13c556,_0x288464){if(_0x565270[_0xf8ca('0xc')]('closed')){_0x565270['closedAt']=moment()[_0xf8ca('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x288464(null,_0x565270);}}});}; \ No newline at end of file +var _0x73e0=['moment','bluebird','path','rimraf','define','openchannel_interactions','utf8mb4_unicode_ci','closed','closedAt','format','util'];(function(_0x102977,_0x3a99a6){var _0x15c466=function(_0x1a6a12){while(--_0x1a6a12){_0x102977['push'](_0x102977['shift']());}};_0x15c466(++_0x3a99a6);}(_0x73e0,0x1ac));var _0x073e=function(_0x32690c,_0x250b6e){_0x32690c=_0x32690c-0x0;var _0x3694c5=_0x73e0[_0x32690c];return _0x3694c5;};'use strict';var _=require('lodash');var util=require(_0x073e('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x073e('0x1'));var BPromise=require(_0x073e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x073e('0x3'));var rimraf=require(_0x073e('0x4'));var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module['exports']=function(_0x486d3a,_0x1791e0){return _0x486d3a[_0x073e('0x5')]('OpenchannelInteraction',attributes,{'tableName':_0x073e('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x073e('0x7'),'hooks':{'beforeUpdate':function(_0x4ad76d,_0xb3bb1,_0x2ccd2e){if(_0x4ad76d['changed'](_0x073e('0x8'))){_0x4ad76d[_0x073e('0x9')]=moment()[_0x073e('0xa')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2ccd2e(null,_0x4ad76d);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index a3962f2..73042af 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 _0x0dd6=['rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','OpenchannelInteraction','options','where','attributes','limit','UpdateOpenchannelInteraction','stringify','AddTagsToOpenchannelInteraction','addTags','body','ids','spread','AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x5f2a7c,_0x4c4b4a){var _0x5c8983=function(_0x564655){while(--_0x564655){_0x5f2a7c['push'](_0x5f2a7c['shift']());}};_0x5c8983(++_0x4c4b4a);}(_0x0dd6,0x6f));var _0x60dd=function(_0x270061,_0x4e41e1){_0x270061=_0x270061-0x0;var _0x329604=_0x0dd6[_0x270061];return _0x329604;};'use strict';var _=require(_0x60dd('0x0'));var util=require(_0x60dd('0x1'));var moment=require('moment');var BPromise=require(_0x60dd('0x2'));var rs=require(_0x60dd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x60dd('0x4'))['db'];var utils=require(_0x60dd('0x5'));var logger=require('../../config/logger')(_0x60dd('0x6'));var config=require(_0x60dd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x60dd('0x8')][_0x60dd('0x9')]({'port':0x232a});config[_0x60dd('0xa')]=_[_0x60dd('0xb')](config[_0x60dd('0xa')],{'host':_0x60dd('0xc'),'port':0x18eb});var socket=require(_0x60dd('0xd'))(new Redis(config['redis']));require('./openchannelInteraction.socket')[_0x60dd('0xe')](socket);function respondWithRpcPromise(_0x1b0784,_0x11c745,_0x53868d){return new BPromise(function(_0xd3dc96,_0x4bf239){return client[_0x60dd('0xf')](_0x1b0784,_0x53868d)[_0x60dd('0x10')](function(_0x4c4f5f){logger[_0x60dd('0x11')](_0x60dd('0x12'),_0x11c745,'request\x20sent');logger[_0x60dd('0x13')](_0x60dd('0x14'),_0x11c745,'request\x20sent',JSON['stringify'](_0x4c4f5f));if(_0x4c4f5f[_0x60dd('0x15')]){if(_0x4c4f5f[_0x60dd('0x15')][_0x60dd('0x16')]===0x1f4){logger[_0x60dd('0x15')](_0x60dd('0x12'),_0x11c745,_0x4c4f5f[_0x60dd('0x15')][_0x60dd('0x17')]);return _0x4bf239(_0x4c4f5f[_0x60dd('0x15')][_0x60dd('0x17')]);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x11c745,_0x4c4f5f[_0x60dd('0x15')][_0x60dd('0x17')]);return _0xd3dc96(_0x4c4f5f[_0x60dd('0x15')][_0x60dd('0x17')]);}else{logger[_0x60dd('0x11')]('OpenchannelInteraction,\x20%s,\x20%s',_0x11c745,'request\x20sent');_0xd3dc96(_0x4c4f5f[_0x60dd('0x18')][_0x60dd('0x17')]);}})[_0x60dd('0x19')](function(_0x333d0d){logger[_0x60dd('0x15')](_0x60dd('0x12'),_0x11c745,_0x333d0d);_0x4bf239(_0x333d0d);});});}exports['UpdateOpenchannelInteraction']=function(_0x5acaa4){var _0x70b3a8=this;return new Promise(function(_0x104b63,_0x214854){return db[_0x60dd('0x1a')]['update'](_0x5acaa4['body'],{'raw':_0x5acaa4[_0x60dd('0x1b')]?_0x5acaa4['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5acaa4[_0x60dd('0x1b')]?_0x5acaa4[_0x60dd('0x1b')][_0x60dd('0x1c')]||null:null,'attributes':_0x5acaa4[_0x60dd('0x1b')]?_0x5acaa4['options'][_0x60dd('0x1d')]||null:null,'limit':_0x5acaa4['options']?_0x5acaa4['options'][_0x60dd('0x1e')]||null:null})['then'](function(_0x22a7da){logger[_0x60dd('0x11')](_0x60dd('0x1f'),_0x5acaa4);logger[_0x60dd('0x13')](_0x60dd('0x1f'),_0x5acaa4,JSON[_0x60dd('0x20')](_0x22a7da));_0x104b63(_0x22a7da);})[_0x60dd('0x19')](function(_0x39c784){logger['error'](_0x60dd('0x1f'),_0x39c784[_0x60dd('0x17')],_0x5acaa4);_0x214854(_0x70b3a8[_0x60dd('0x15')](0x1f4,_0x39c784[_0x60dd('0x17')]));});});};exports[_0x60dd('0x21')]=function(_0x44df74){return new Promise(function(_0x43b770,_0x134e36){return db[_0x60dd('0x1a')]['find']({'where':_0x44df74[_0x60dd('0x1b')]?_0x44df74[_0x60dd('0x1b')][_0x60dd('0x1c')]||null:null})[_0x60dd('0x10')](function(_0x59af81){if(_0x59af81){return _0x59af81[_0x60dd('0x22')](_0x44df74[_0x60dd('0x23')][_0x60dd('0x24')],_['omit'](_0x44df74['body'],['ids','id'])||{});}})[_0x60dd('0x25')](function(_0x1be510){logger['info'](_0x60dd('0x26'),_0x44df74);logger[_0x60dd('0x13')](_0x60dd('0x26'),_0x44df74,JSON[_0x60dd('0x20')](_0x1be510));_0x43b770(_0x1be510);})[_0x60dd('0x19')](function(_0x278b01){logger[_0x60dd('0x15')](_0x60dd('0x26'),_0x278b01[_0x60dd('0x17')],_0x44df74);_0x134e36(_this[_0x60dd('0x15')](0x1f4,_0x278b01['message']));});});}; \ No newline at end of file +var _0xf0c0=['OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','where','attributes','limit','find','addTags','body','ids','spread','AddTags','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','register','then','info'];(function(_0x120376,_0x571898){var _0x28c529=function(_0x4f130c){while(--_0x4f130c){_0x120376['push'](_0x120376['shift']());}};_0x28c529(++_0x571898);}(_0xf0c0,0x1eb));var _0x0f0c=function(_0x464cab,_0x3c8a07){_0x464cab=_0x464cab-0x0;var _0x3336f6=_0xf0c0[_0x464cab];return _0x3336f6;};'use strict';var _=require(_0x0f0c('0x0'));var util=require(_0x0f0c('0x1'));var moment=require(_0x0f0c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f0c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0f0c('0x4'));var logger=require(_0x0f0c('0x5'))(_0x0f0c('0x6'));var config=require(_0x0f0c('0x7'));var jayson=require(_0x0f0c('0x8'));var client=jayson[_0x0f0c('0x9')][_0x0f0c('0xa')]({'port':0x232a});config[_0x0f0c('0xb')]=_[_0x0f0c('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0f0c('0xb')]));require('./openchannelInteraction.socket')[_0x0f0c('0xd')](socket);function respondWithRpcPromise(_0x2f66be,_0x19abaf,_0x2e467a){return new BPromise(function(_0x4e6386,_0x15aa67){return client['request'](_0x2f66be,_0x2e467a)[_0x0f0c('0xe')](function(_0x54d528){logger[_0x0f0c('0xf')](_0x0f0c('0x10'),_0x19abaf,_0x0f0c('0x11'));logger[_0x0f0c('0x12')](_0x0f0c('0x13'),_0x19abaf,_0x0f0c('0x11'),JSON[_0x0f0c('0x14')](_0x54d528));if(_0x54d528[_0x0f0c('0x15')]){if(_0x54d528[_0x0f0c('0x15')][_0x0f0c('0x16')]===0x1f4){logger[_0x0f0c('0x15')](_0x0f0c('0x10'),_0x19abaf,_0x54d528[_0x0f0c('0x15')][_0x0f0c('0x17')]);return _0x15aa67(_0x54d528[_0x0f0c('0x15')][_0x0f0c('0x17')]);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x19abaf,_0x54d528[_0x0f0c('0x15')][_0x0f0c('0x17')]);return _0x4e6386(_0x54d528[_0x0f0c('0x15')]['message']);}else{logger[_0x0f0c('0xf')](_0x0f0c('0x10'),_0x19abaf,_0x0f0c('0x11'));_0x4e6386(_0x54d528[_0x0f0c('0x18')][_0x0f0c('0x17')]);}})[_0x0f0c('0x19')](function(_0x471c38){logger[_0x0f0c('0x15')](_0x0f0c('0x10'),_0x19abaf,_0x471c38);_0x15aa67(_0x471c38);});});}exports[_0x0f0c('0x1a')]=function(_0xd3f616){var _0x5a2cf2=this;return new Promise(function(_0x202b34,_0x21e148){return db[_0x0f0c('0x1b')][_0x0f0c('0x1c')](_0xd3f616['body'],{'raw':_0xd3f616[_0x0f0c('0x1d')]?_0xd3f616[_0x0f0c('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd3f616['options']?_0xd3f616[_0x0f0c('0x1d')][_0x0f0c('0x1e')]||null:null,'attributes':_0xd3f616['options']?_0xd3f616[_0x0f0c('0x1d')][_0x0f0c('0x1f')]||null:null,'limit':_0xd3f616[_0x0f0c('0x1d')]?_0xd3f616[_0x0f0c('0x1d')][_0x0f0c('0x20')]||null:null})['then'](function(_0xa8c882){logger['info'](_0x0f0c('0x1a'),_0xd3f616);logger['debug'](_0x0f0c('0x1a'),_0xd3f616,JSON['stringify'](_0xa8c882));_0x202b34(_0xa8c882);})[_0x0f0c('0x19')](function(_0x1edfee){logger['error'](_0x0f0c('0x1a'),_0x1edfee[_0x0f0c('0x17')],_0xd3f616);_0x21e148(_0x5a2cf2[_0x0f0c('0x15')](0x1f4,_0x1edfee[_0x0f0c('0x17')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x1a3053){return new Promise(function(_0x583981,_0x628bfb){return db[_0x0f0c('0x1b')][_0x0f0c('0x21')]({'where':_0x1a3053[_0x0f0c('0x1d')]?_0x1a3053['options'][_0x0f0c('0x1e')]||null:null})[_0x0f0c('0xe')](function(_0x291565){if(_0x291565){return _0x291565[_0x0f0c('0x22')](_0x1a3053[_0x0f0c('0x23')][_0x0f0c('0x24')],_['omit'](_0x1a3053[_0x0f0c('0x23')],[_0x0f0c('0x24'),'id'])||{});}})[_0x0f0c('0x25')](function(_0x193f19){logger[_0x0f0c('0xf')](_0x0f0c('0x26'),_0x1a3053);logger[_0x0f0c('0x12')](_0x0f0c('0x26'),_0x1a3053,JSON['stringify'](_0x193f19));_0x583981(_0x193f19);})[_0x0f0c('0x19')](function(_0x50c54f){logger['error'](_0x0f0c('0x26'),_0x50c54f[_0x0f0c('0x17')],_0x1a3053);_0x628bfb(_this[_0x0f0c('0x15')](0x1f4,_0x50c54f[_0x0f0c('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index c61cdac..c31d1e9 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 _0xf79d=['openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit','removeListener','register','length'];(function(_0x493a7b,_0x316a7f){var _0x4e4153=function(_0x2744fe){while(--_0x2744fe){_0x493a7b['push'](_0x493a7b['shift']());}};_0x4e4153(++_0x316a7f);}(_0xf79d,0x106));var _0xdf79=function(_0x263863,_0x28da3e){_0x263863=_0x263863-0x0;var _0x3e88f1=_0xf79d[_0x263863];return _0x3e88f1;};'use strict';var OpenchannelInteractionEvents=require(_0xdf79('0x0'));var events=[_0xdf79('0x1'),_0xdf79('0x2'),_0xdf79('0x3')];function createListener(_0x13d25f,_0x4f167f){return function(_0xe35eda){_0x4f167f[_0xdf79('0x4')](_0x13d25f,_0xe35eda);};}function removeListener(_0x56d2ef,_0x27abf3){return function(){OpenchannelInteractionEvents[_0xdf79('0x5')](_0x56d2ef,_0x27abf3);};}exports[_0xdf79('0x6')]=function(_0x296275){for(var _0x46ec43=0x0,_0x5cf220=events[_0xdf79('0x7')];_0x46ec43<_0x5cf220;_0x46ec43++){var _0x3a71d6=events[_0x46ec43];var _0x6d038c=createListener(_0xdf79('0x8')+_0x3a71d6,_0x296275);OpenchannelInteractionEvents['on'](_0x3a71d6,_0x6d038c);}}; \ No newline at end of file +var _0xce18=['./openchannelInteraction.events','save','update','emit','register','length','openchannelInteraction:'];(function(_0x433778,_0xf42c22){var _0x2f530f=function(_0x340373){while(--_0x340373){_0x433778['push'](_0x433778['shift']());}};_0x2f530f(++_0xf42c22);}(_0xce18,0xf5));var _0x8ce1=function(_0x17352f,_0x38d201){_0x17352f=_0x17352f-0x0;var _0x150d8c=_0xce18[_0x17352f];return _0x150d8c;};'use strict';var OpenchannelInteractionEvents=require(_0x8ce1('0x0'));var events=[_0x8ce1('0x1'),'remove',_0x8ce1('0x2')];function createListener(_0x10a9c6,_0x4c48fe){return function(_0x4b07c9){_0x4c48fe[_0x8ce1('0x3')](_0x10a9c6,_0x4b07c9);};}function removeListener(_0x4d9271,_0x245ff1){return function(){OpenchannelInteractionEvents['removeListener'](_0x4d9271,_0x245ff1);};}exports[_0x8ce1('0x4')]=function(_0x2fa433){for(var _0x429c76=0x0,_0x130f51=events[_0x8ce1('0x5')];_0x429c76<_0x130f51;_0x429c76++){var _0x52ec78=events[_0x429c76];var _0x2611d0=createListener(_0x8ce1('0x6')+_0x52ec78,_0x2fa433);OpenchannelInteractionEvents['on'](_0x52ec78,_0x2611d0);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 6a5eb1e..c275809 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(_0x58622a,_0x4ad356){var _0x2888db=function(_0x794b69){while(--_0x794b69){_0x58622a['push'](_0x58622a['shift']());}};_0x2888db(++_0x4ad356);}(_0x9c44,0x178));var _0x49c4=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x9c44[_0xdea41a];return _0x15d0d8;};'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 _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(_0x53e3c2,_0x90a8fd){var _0x10aa40=function(_0x535ead){while(--_0x535ead){_0x53e3c2['push'](_0x53e3c2['shift']());}};_0x10aa40(++_0x90a8fd);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 2732bfe..3bf683b 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 _0xd4a2=['sequelize','medium','BOOLEAN','out','DATE','STRING','TEXT'];(function(_0x21de89,_0x367053){var _0x290b7e=function(_0x540704){while(--_0x540704){_0x21de89['push'](_0x21de89['shift']());}};_0x290b7e(++_0x367053);}(_0xd4a2,0x173));var _0x2d4a=function(_0x45d796,_0x5ccda6){_0x45d796=_0x45d796-0x0;var _0x2d5803=_0xd4a2[_0x45d796];return _0x2d5803;};'use strict';var Sequelize=require(_0x2d4a('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x2d4a('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x2d4a('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x2d4a('0x3')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x2d4a('0x4')]},'providerName':{'type':Sequelize[_0x2d4a('0x5')]},'providerResponse':{'type':Sequelize[_0x2d4a('0x6')]}}; \ No newline at end of file +var _0x8f59=['medium','BOOLEAN','out','DATE','STRING','sequelize','exports','TEXT'];(function(_0x3cd618,_0x4dd7b2){var _0x513573=function(_0x10317e){while(--_0x10317e){_0x3cd618['push'](_0x3cd618['shift']());}};_0x513573(++_0x4dd7b2);}(_0x8f59,0x11d));var _0x98f5=function(_0x14a6cf,_0x27e1cb){_0x14a6cf=_0x14a6cf-0x0;var _0x66d8e7=_0x8f59[_0x14a6cf];return _0x66d8e7;};'use strict';var Sequelize=require(_0x98f5('0x0'));module[_0x98f5('0x1')]={'body':{'type':Sequelize[_0x98f5('0x2')](_0x98f5('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x98f5('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x98f5('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x98f5('0x5')),'defaultValue':_0x98f5('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x98f5('0x6')]},'providerName':{'type':Sequelize[_0x98f5('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 bef8a05..a3663ac 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 _0xe27b=['path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','redis','register','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','destroy','stack','name','send','index','map','OpenchannelMessage','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','find','create','body','describe','openchannel-interactions','accept','openchannel','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','isNil','read1stAt','format','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','ContactId','Sequelize','QueryTypes','SELECT','contact','fullname','email','interface','channel','motionChannel','event','EventManager','acceptmessage','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','sequelize','User','internal','SIP/%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0xe27b,0xf9));var _0xbe27=function(_0x545b01,_0x2e66bf){_0x545b01=_0x545b01-0x0;var _0x1a1dd6=_0xe27b[_0x545b01];return _0x1a1dd6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbe27('0x0'));var zipdir=require(_0xbe27('0x1'));var jsonpatch=require(_0xbe27('0x2'));var rp=require(_0xbe27('0x3'));var moment=require(_0xbe27('0x4'));var BPromise=require(_0xbe27('0x5'));var Mustache=require('mustache');var util=require(_0xbe27('0x6'));var path=require(_0xbe27('0x7'));var sox=require(_0xbe27('0x8'));var csv=require('to-csv');var ejs=require(_0xbe27('0x9'));var fs=require('fs');var fs_extra=require(_0xbe27('0xa'));var _=require(_0xbe27('0xb'));var squel=require(_0xbe27('0xc'));var crypto=require(_0xbe27('0xd'));var jsforce=require(_0xbe27('0xe'));var deskjs=require(_0xbe27('0xf'));var toCsv=require('to-csv');var querystring=require(_0xbe27('0x10'));var Papa=require('papaparse');var Redis=require(_0xbe27('0x11'));var authService=require(_0xbe27('0x12'));var qs=require(_0xbe27('0x13'));var as=require(_0xbe27('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbe27('0x15'))(_0xbe27('0x16'));var utils=require('../../config/utils');var config=require(_0xbe27('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xbe27('0x18')]=_['defaults'](config[_0xbe27('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbe27('0x18')]));require('./openchannelMessage.socket')[_0xbe27('0x19')](socket);var jayson=require(_0xbe27('0x1a'));var client=jayson[_0xbe27('0x1b')][_0xbe27('0x1c')]({'port':0x232c});var client9002=jayson[_0xbe27('0x1b')][_0xbe27('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x456128,_0x3e6b2d,_0x124aed,_0x16ffa0){return new BPromise(function(_0x362ec0,_0x244486){var _0x420a0e=_0x16ffa0||client;return _0x420a0e[_0xbe27('0x1d')](_0x456128,_0x124aed)[_0xbe27('0x1e')](function(_0x3ed77e){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x3e6b2d,_0xbe27('0x1f'));logger[_0xbe27('0x20')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x3e6b2d,_0xbe27('0x1f'),JSON[_0xbe27('0x21')](_0x3ed77e));if(_0x3ed77e[_0xbe27('0x22')]){if(_0x3ed77e['error'][_0xbe27('0x23')]===0x1f4){logger[_0xbe27('0x22')](_0xbe27('0x24'),_0x3e6b2d,_0x3ed77e[_0xbe27('0x22')][_0xbe27('0x25')]);return _0x244486(_0x3ed77e[_0xbe27('0x22')]['message']);}logger['error'](_0xbe27('0x24'),_0x3e6b2d,_0x3ed77e[_0xbe27('0x22')][_0xbe27('0x25')]);return _0x362ec0(_0x3ed77e[_0xbe27('0x22')][_0xbe27('0x25')]);}else{logger[_0xbe27('0x26')](_0xbe27('0x24'),_0x3e6b2d,_0xbe27('0x1f'));_0x362ec0(_0x3ed77e[_0xbe27('0x27')]['message']);}})[_0xbe27('0x28')](function(_0xa43431){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x3e6b2d,_0xa43431);_0x244486(_0xa43431);});});}function respondWithStatusCode(_0x397a8c,_0x2e4521){_0x2e4521=_0x2e4521||0xcc;return function(_0x59ffc0){if(_0x59ffc0){return _0x397a8c[_0xbe27('0x29')](_0x2e4521);}return _0x397a8c[_0xbe27('0x2a')](_0x2e4521)['end']();};}function respondWithResult(_0x32532d,_0x4cd3bc){_0x4cd3bc=_0x4cd3bc||0xc8;return function(_0x43cca5){if(_0x43cca5){return _0x32532d[_0xbe27('0x2a')](_0x4cd3bc)[_0xbe27('0x2b')](_0x43cca5);}};}function respondWithFilteredResult(_0x2aa1a3,_0x2397e6){return function(_0x14bc1c){if(_0x14bc1c){var _0xa9266f=typeof _0x2397e6[_0xbe27('0x2c')]===_0xbe27('0x2d')&&typeof _0x2397e6[_0xbe27('0x2e')]===_0xbe27('0x2d');var _0x593e70=_0x14bc1c['count'];var _0x3158fd=_0xa9266f?0x0:_0x2397e6['offset'];var _0x132dfa=_0xa9266f?_0x14bc1c[_0xbe27('0x2f')]:_0x2397e6[_0xbe27('0x2c')]+_0x2397e6[_0xbe27('0x2e')];var _0x3506de;if(_0x132dfa>=_0x593e70){_0x132dfa=_0x593e70;_0x3506de=0xc8;}else{_0x3506de=0xce;}_0x2aa1a3[_0xbe27('0x2a')](_0x3506de);return _0x2aa1a3[_0xbe27('0x30')]('Content-Range',_0x3158fd+'-'+_0x132dfa+'/'+_0x593e70)[_0xbe27('0x2b')](_0x14bc1c);}return null;};}function patchUpdates(_0x2b1f06){return function(_0x44228d){try{jsonpatch['apply'](_0x44228d,_0x2b1f06,!![]);}catch(_0xeb3284){return BPromise[_0xbe27('0x31')](_0xeb3284);}return _0x44228d[_0xbe27('0x32')]();};}function saveUpdates(_0x65a7d1,_0x5d4eab){return function(_0x5b17b5){if(_0x5b17b5){return _0x5b17b5['update'](_0x65a7d1)['then'](function(_0x40cb7a){return _0x40cb7a;});}return null;};}function removeEntity(_0x4a0b25,_0xa5c040){return function(_0x381f64){if(_0x381f64){return _0x381f64[_0xbe27('0x33')]()[_0xbe27('0x1e')](function(){_0x4a0b25[_0xbe27('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35634b,_0x1cb2e5){return function(_0x53042f){if(!_0x53042f){_0x35634b[_0xbe27('0x29')](0x194);}return _0x53042f;};}function handleError(_0x13811f,_0x2651b8){_0x2651b8=_0x2651b8||0x1f4;return function(_0x30670b){logger[_0xbe27('0x22')](_0x30670b[_0xbe27('0x34')]);if(_0x30670b[_0xbe27('0x35')]){delete _0x30670b[_0xbe27('0x35')];}_0x13811f['status'](_0x2651b8)[_0xbe27('0x36')](_0x30670b);};}exports[_0xbe27('0x37')]=function(_0x3437d3,_0x32569a){var _0x187257={},_0x4e144e={},_0xd6a389={'count':0x0,'rows':[]};var _0x5d5f51=_[_0xbe27('0x38')](db[_0xbe27('0x39')]['rawAttributes'],function(_0x3d847d){return{'name':_0x3d847d[_0xbe27('0x3a')],'type':_0x3d847d[_0xbe27('0x3b')][_0xbe27('0x3c')]};});_0x4e144e[_0xbe27('0x3d')]=_['map'](_0x5d5f51,_0xbe27('0x35'));_0x4e144e['query']=_[_0xbe27('0x3e')](_0x3437d3[_0xbe27('0x3f')]);_0x4e144e[_0xbe27('0x40')]=_[_0xbe27('0x41')](_0x4e144e[_0xbe27('0x3d')],_0x4e144e['query']);_0x187257[_0xbe27('0x42')]=_['intersection'](_0x4e144e['model'],qs[_0xbe27('0x43')](_0x3437d3[_0xbe27('0x3f')][_0xbe27('0x43')]));_0x187257[_0xbe27('0x42')]=_0x187257[_0xbe27('0x42')][_0xbe27('0x44')]?_0x187257[_0xbe27('0x42')]:_0x4e144e[_0xbe27('0x3d')];if(!_0x3437d3['query'][_0xbe27('0x45')](_0xbe27('0x46'))){_0x187257[_0xbe27('0x2e')]=qs[_0xbe27('0x2e')](_0x3437d3['query']['limit']);_0x187257['offset']=qs['offset'](_0x3437d3[_0xbe27('0x3f')][_0xbe27('0x2c')]);}_0x187257[_0xbe27('0x47')]=qs[_0xbe27('0x48')](_0x3437d3[_0xbe27('0x3f')][_0xbe27('0x48')]);_0x187257[_0xbe27('0x49')]=qs['filters'](_['pick'](_0x3437d3[_0xbe27('0x3f')],_0x4e144e['filters']),_0x5d5f51);if(_0x3437d3['query'][_0xbe27('0x4a')]){_0x187257[_0xbe27('0x49')]=_[_0xbe27('0x4b')](_0x187257[_0xbe27('0x49')],{'$or':_[_0xbe27('0x38')](_0x5d5f51,function(_0x4153c4){if(_0x4153c4[_0xbe27('0x3b')]!==_0xbe27('0x4c')){var _0x31b273={};_0x31b273[_0x4153c4['name']]={'$like':'%'+_0x3437d3['query'][_0xbe27('0x4a')]+'%'};return _0x31b273;}})});}_0x187257=_[_0xbe27('0x4b')]({},_0x187257,_0x3437d3[_0xbe27('0x4d')]);var _0x38daa7={'where':_0x187257[_0xbe27('0x49')]};return db[_0xbe27('0x39')]['count'](_0x38daa7)[_0xbe27('0x1e')](function(_0x42f053){_0xd6a389[_0xbe27('0x2f')]=_0x42f053;if(_0x3437d3['query'][_0xbe27('0x4e')]){_0x187257[_0xbe27('0x4f')]=[{'all':!![]}];}return db[_0xbe27('0x39')][_0xbe27('0x50')](_0x187257);})[_0xbe27('0x1e')](function(_0x4bf1b3){_0xd6a389[_0xbe27('0x51')]=_0x4bf1b3;return _0xd6a389;})[_0xbe27('0x1e')](respondWithFilteredResult(_0x32569a,_0x187257))[_0xbe27('0x28')](handleError(_0x32569a,null));};exports['show']=function(_0x44c120,_0x3046ea){var _0x57dd97={'raw':!![],'where':{'id':_0x44c120[_0xbe27('0x52')]['id']}},_0x18e0b4={};_0x18e0b4[_0xbe27('0x3d')]=_[_0xbe27('0x3e')](db['OpenchannelMessage'][_0xbe27('0x53')]);_0x18e0b4[_0xbe27('0x3f')]=_[_0xbe27('0x3e')](_0x44c120[_0xbe27('0x3f')]);_0x18e0b4['filters']=_[_0xbe27('0x41')](_0x18e0b4[_0xbe27('0x3d')],_0x18e0b4[_0xbe27('0x3f')]);_0x57dd97['attributes']=_[_0xbe27('0x41')](_0x18e0b4[_0xbe27('0x3d')],qs[_0xbe27('0x43')](_0x44c120[_0xbe27('0x3f')][_0xbe27('0x43')]));_0x57dd97[_0xbe27('0x42')]=_0x57dd97[_0xbe27('0x42')][_0xbe27('0x44')]?_0x57dd97[_0xbe27('0x42')]:_0x18e0b4[_0xbe27('0x3d')];if(_0x44c120[_0xbe27('0x3f')][_0xbe27('0x4e')]){_0x57dd97[_0xbe27('0x4f')]=[{'all':!![]}];}_0x57dd97=_[_0xbe27('0x4b')]({},_0x57dd97,_0x44c120[_0xbe27('0x4d')]);return db[_0xbe27('0x39')][_0xbe27('0x54')](_0x57dd97)['then'](handleEntityNotFound(_0x3046ea,null))[_0xbe27('0x1e')](respondWithResult(_0x3046ea,null))[_0xbe27('0x28')](handleError(_0x3046ea,null));};exports['create']=function(_0x5c3619,_0x5ae182){return db['OpenchannelMessage'][_0xbe27('0x55')](_0x5c3619[_0xbe27('0x56')],{})[_0xbe27('0x1e')](respondWithResult(_0x5ae182,0xc9))[_0xbe27('0x28')](handleError(_0x5ae182,null));};exports['update']=function(_0x4fe0b8,_0xe19252){if(_0x4fe0b8[_0xbe27('0x56')]['id']){delete _0x4fe0b8['body']['id'];}return db[_0xbe27('0x39')][_0xbe27('0x54')]({'where':{'id':_0x4fe0b8[_0xbe27('0x52')]['id']}})[_0xbe27('0x1e')](handleEntityNotFound(_0xe19252,null))[_0xbe27('0x1e')](saveUpdates(_0x4fe0b8['body'],null))['then'](respondWithResult(_0xe19252,null))[_0xbe27('0x28')](handleError(_0xe19252,null));};exports[_0xbe27('0x33')]=function(_0x4cea66,_0x828193){return db[_0xbe27('0x39')][_0xbe27('0x54')]({'where':{'id':_0x4cea66[_0xbe27('0x52')]['id']}})[_0xbe27('0x1e')](handleEntityNotFound(_0x828193,null))[_0xbe27('0x1e')](removeEntity(_0x828193,null))[_0xbe27('0x28')](handleError(_0x828193,null));};exports[_0xbe27('0x57')]=function(_0x1c8571,_0x457281){return db['OpenchannelMessage'][_0xbe27('0x57')]()[_0xbe27('0x1e')](respondWithResult(_0x457281,null))['catch'](handleError(_0x457281,null));};var interaction_log=require(_0xbe27('0x15'))(_0xbe27('0x58'));exports[_0xbe27('0x59')]=function(_0x12fba6,_0x542d52,_0x539146){var _0x447dcb={'agent':{},'channel':_0xbe27('0x5a')};if(_0x12fba6[_0xbe27('0x56')]['id']){delete _0x12fba6[_0xbe27('0x56')]['id'];}_0x12fba6[_0xbe27('0x56')][_0xbe27('0x5b')]=!![];_0x12fba6['body']['readAt']=moment()['format'](_0xbe27('0x5c'));_0x12fba6['body'][_0xbe27('0x5d')]=_0x12fba6[_0xbe27('0x56')][_0xbe27('0x5d')]||_0x12fba6[_0xbe27('0x5e')]['id'];_0x447dcb[_0xbe27('0x5f')]['id']=_0x12fba6[_0xbe27('0x56')][_0xbe27('0x5d')];return db[_0xbe27('0x39')][_0xbe27('0x54')]({'where':{'id':_0x12fba6['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x542d52,null))['then'](saveUpdates(_0x12fba6[_0xbe27('0x56')],null))[_0xbe27('0x1e')](function(_0x593574){if(_0x593574){_0x447dcb[_0xbe27('0x25')]=_0x593574[_0xbe27('0x60')]({'plain':!![]});return db[_0xbe27('0x61')][_0xbe27('0x54')]({'where':{'id':_0x593574['OpenchannelInteractionId']}});}return null;})[_0xbe27('0x1e')](handleEntityNotFound(_0x542d52,null))['then'](function(_0x9daafe){if(_0x9daafe){return _0x9daafe['update']({'UserId':_0x12fba6['body'][_0xbe27('0x5d')],'read1stAt':_[_0xbe27('0x62')](_0x9daafe[_0xbe27('0x63')])?moment()[_0xbe27('0x64')](_0xbe27('0x5c')):undefined});}return null;})['then'](function(_0x332a06){if(_0x332a06){_0x447dcb[_0xbe27('0x65')]=_0x332a06[_0xbe27('0x60')]({'plain':!![]});interaction_log[_0xbe27('0x26')](_0xbe27('0x66'),_0x12fba6[_0xbe27('0x5e')]['id'],_0x12fba6[_0xbe27('0x5e')][_0xbe27('0x35')],_0x12fba6[_0xbe27('0x5e')]['role'],_0x447dcb[_0xbe27('0x65')]['id'],_0x12fba6['body']?JSON[_0xbe27('0x21')](_0x12fba6[_0xbe27('0x56')]):_0xbe27('0x67'));return respondWithRpcPromise(_0xbe27('0x68'),_0xbe27('0x69'),_0x447dcb);}return null;})['then'](function(_0x22dda2){var _0x2b60f1='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x22dda2[_0xbe27('0x25')][_0xbe27('0x6a')];return db['sequelize'][_0xbe27('0x3f')](_0x2b60f1,{'type':db[_0xbe27('0x6b')][_0xbe27('0x6c')][_0xbe27('0x6d')],'raw':!![]})[_0xbe27('0x1e')](function(_0x289167){return _0x289167;});})[_0xbe27('0x1e')](function(_0x834ca3){if(_0x834ca3){_0x447dcb['message'][_0xbe27('0x6e')]=_0x834ca3[0x0];if(!_0x12fba6['body'][_0xbe27('0x5d')])return;return db['User'][_0xbe27('0x54')]({'where':{'id':_0x12fba6[_0xbe27('0x56')][_0xbe27('0x5d')],'role':_0xbe27('0x5f')},'attributes':['id',_0xbe27('0x35'),_0xbe27('0x6f'),_0xbe27('0x70'),'internal'],'raw':!![]});}return null;})[_0xbe27('0x1e')](function(_0x3da0c0){if(!_0x3da0c0)return null;_0x447dcb['message'][_0xbe27('0x5f')]=_0x3da0c0;return _0x447dcb;})[_0xbe27('0x1e')](function(_0x2d02a0){if(_0x2d02a0){if(_0x12fba6[_0xbe27('0x56')]['manual']){_0x447dcb[_0xbe27('0x25')][_0xbe27('0x71')]=util[_0xbe27('0x64')]('SIP/%s',_0x12fba6[_0xbe27('0x5e')]['name']);_0x447dcb[_0xbe27('0x25')]['channel']=_0x447dcb[_0xbe27('0x72')];_0x447dcb['message'][_0xbe27('0x73')]=_0x447dcb[_0xbe27('0x72')];_0x447dcb['message'][_0xbe27('0x74')]=_0xbe27('0x59');return respondWithRpcPromise(_0xbe27('0x75'),'EventManager',{'event':_0xbe27('0x76'),'message':_0x447dcb[_0xbe27('0x25')]},client9002)[_0xbe27('0x1e')](function(){return _0x447dcb;});}return _0x447dcb;}return null;})[_0xbe27('0x1e')](respondWithResult(_0x542d52,null))[_0xbe27('0x28')](handleError(_0x542d52,null));};var interaction_log=require(_0xbe27('0x15'))('openchannel-interactions');exports[_0xbe27('0x31')]=function(_0x4c2067,_0x18eb68,_0x1cc029){var _0x3e10a4={'agent':{},'channel':_0xbe27('0x5a')};if(_0x4c2067[_0xbe27('0x56')]['id']){delete _0x4c2067['body']['id'];}_0x4c2067[_0xbe27('0x56')][_0xbe27('0x5d')]=_0x4c2067[_0xbe27('0x56')][_0xbe27('0x5d')]||_0x4c2067['user']['id'];_0x3e10a4[_0xbe27('0x5f')]['id']=_0x4c2067[_0xbe27('0x56')]['UserId'];return db[_0xbe27('0x39')]['find']({'where':{'id':_0x4c2067['params']['id'],'UserId':null}})[_0xbe27('0x1e')](handleEntityNotFound(_0x18eb68,null))['then'](function(_0x5dccb5){if(_0x5dccb5){_0x3e10a4[_0xbe27('0x25')]=_0x5dccb5[_0xbe27('0x60')]({'plain':!![]});return db[_0xbe27('0x61')]['find']({'where':{'id':_0x5dccb5[_0xbe27('0x77')]}});}return null;})['then'](handleEntityNotFound(_0x18eb68,null))[_0xbe27('0x1e')](function(_0x51399c){if(_0x51399c){_0x3e10a4[_0xbe27('0x65')]=_0x51399c[_0xbe27('0x60')]({'plain':!![]});interaction_log[_0xbe27('0x26')](_0xbe27('0x78'),_0x4c2067[_0xbe27('0x5e')]['id'],_0x4c2067[_0xbe27('0x5e')][_0xbe27('0x35')],_0x4c2067[_0xbe27('0x5e')][_0xbe27('0x79')],_0x3e10a4[_0xbe27('0x65')]['id'],_0x4c2067['body']?JSON[_0xbe27('0x21')](_0x4c2067[_0xbe27('0x56')]):_0xbe27('0x67'));return respondWithRpcPromise(_0xbe27('0x7a'),_0xbe27('0x7b'),_0x3e10a4);}return null;})[_0xbe27('0x1e')](function(_0x354034){var _0x11ace7='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x354034[_0xbe27('0x25')][_0xbe27('0x6a')];return db[_0xbe27('0x7c')][_0xbe27('0x3f')](_0x11ace7,{'type':db['Sequelize'][_0xbe27('0x6c')]['SELECT'],'raw':!![]})['then'](function(_0x23dfe8){return _0x23dfe8;});})[_0xbe27('0x1e')](function(_0x3aa0ed){if(_0x3aa0ed){_0x3e10a4[_0xbe27('0x25')]['contact']=_0x3aa0ed[0x0];if(!_0x4c2067['body']['UserId'])return;return db[_0xbe27('0x7d')]['find']({'where':{'id':_0x4c2067[_0xbe27('0x56')][_0xbe27('0x5d')],'role':_0xbe27('0x5f')},'attributes':['id',_0xbe27('0x35'),'fullname','email',_0xbe27('0x7e')],'raw':!![]});}return null;})[_0xbe27('0x1e')](function(_0x15785c){if(!_0x15785c)return null;_0x3e10a4[_0xbe27('0x25')][_0xbe27('0x5f')]=_0x15785c;return _0x3e10a4;})[_0xbe27('0x1e')](function(_0x4d7f3c){if(_0x4d7f3c){_0x4d7f3c[_0xbe27('0x25')][_0xbe27('0x71')]=util[_0xbe27('0x64')](_0xbe27('0x7f'),_0x4c2067[_0xbe27('0x5e')]['name']);_0x4d7f3c['message'][_0xbe27('0x72')]=_0x3e10a4[_0xbe27('0x72')];_0x4d7f3c[_0xbe27('0x25')]['motionChannel']=_0x3e10a4[_0xbe27('0x72')];_0x4d7f3c[_0xbe27('0x25')][_0xbe27('0x74')]='reject';respondWithRpcPromise(_0xbe27('0x75'),_0xbe27('0x75'),{'event':'rejectmessage','message':_0x4d7f3c[_0xbe27('0x25')]},client9002);return _0x3e10a4;}return null;})['then'](respondWithResult(_0x18eb68,null))[_0xbe27('0x28')](handleError(_0x18eb68,null));}; \ No newline at end of file +var _0xb658=['limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','filter','options','include','findAll','rows','show','params','keys','includeAll','find','create','body','openchannel-interactions','openchannel','read','readAt','format','UserId','user','agent','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','get','info','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','User','fullname','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./openchannelMessage.socket','jayson/promise','client','http','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','end','status','json','offset','undefined'];(function(_0x413b4d,_0xa3459c){var _0x8b810a=function(_0x22d441){while(--_0x22d441){_0x413b4d['push'](_0x413b4d['shift']());}};_0x8b810a(++_0xa3459c);}(_0xb658,0x15a));var _0x8b65=function(_0x53dfa4,_0x4e7692){_0x53dfa4=_0x53dfa4-0x0;var _0x27c8be=_0xb658[_0x53dfa4];return _0x27c8be;};'use strict';var emlformat=require(_0x8b65('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8b65('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8b65('0x2'));var moment=require(_0x8b65('0x3'));var BPromise=require(_0x8b65('0x4'));var Mustache=require(_0x8b65('0x5'));var util=require(_0x8b65('0x6'));var path=require(_0x8b65('0x7'));var sox=require('sox');var csv=require(_0x8b65('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b65('0x9'));var _=require('lodash');var squel=require(_0x8b65('0xa'));var crypto=require(_0x8b65('0xb'));var jsforce=require(_0x8b65('0xc'));var deskjs=require(_0x8b65('0xd'));var toCsv=require(_0x8b65('0x8'));var querystring=require(_0x8b65('0xe'));var Papa=require(_0x8b65('0xf'));var Redis=require(_0x8b65('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8b65('0x11'));var logger=require('../../config/logger')(_0x8b65('0x12'));var utils=require(_0x8b65('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x8b65('0x14'));var db=require(_0x8b65('0x15'))['db'];config[_0x8b65('0x16')]=_['defaults'](config[_0x8b65('0x16')],{'host':_0x8b65('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8b65('0x16')]));require(_0x8b65('0x18'))['register'](socket);var jayson=require(_0x8b65('0x19'));var client=jayson[_0x8b65('0x1a')]['http']({'port':0x232c});var client9002=jayson['client'][_0x8b65('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x37aab8,_0x5e369a,_0x4e17a4,_0x449f01){return new BPromise(function(_0x5a6275,_0x3b43d9){var _0x7631bc=_0x449f01||client;return _0x7631bc[_0x8b65('0x1c')](_0x37aab8,_0x4e17a4)[_0x8b65('0x1d')](function(_0x15227){logger['info'](_0x8b65('0x1e'),_0x5e369a,'request\x20sent');logger[_0x8b65('0x1f')](_0x8b65('0x20'),_0x5e369a,_0x8b65('0x21'),JSON['stringify'](_0x15227));if(_0x15227[_0x8b65('0x22')]){if(_0x15227[_0x8b65('0x22')][_0x8b65('0x23')]===0x1f4){logger[_0x8b65('0x22')](_0x8b65('0x1e'),_0x5e369a,_0x15227[_0x8b65('0x22')][_0x8b65('0x24')]);return _0x3b43d9(_0x15227['error']['message']);}logger[_0x8b65('0x22')](_0x8b65('0x1e'),_0x5e369a,_0x15227[_0x8b65('0x22')][_0x8b65('0x24')]);return _0x5a6275(_0x15227[_0x8b65('0x22')][_0x8b65('0x24')]);}else{logger['info'](_0x8b65('0x1e'),_0x5e369a,_0x8b65('0x21'));_0x5a6275(_0x15227[_0x8b65('0x25')][_0x8b65('0x24')]);}})[_0x8b65('0x26')](function(_0x47b4ca){logger[_0x8b65('0x22')](_0x8b65('0x1e'),_0x5e369a,_0x47b4ca);_0x3b43d9(_0x47b4ca);});});}function respondWithStatusCode(_0x2bf0fa,_0x58ce99){_0x58ce99=_0x58ce99||0xcc;return function(_0x3c1046){if(_0x3c1046){return _0x2bf0fa['sendStatus'](_0x58ce99);}return _0x2bf0fa['status'](_0x58ce99)[_0x8b65('0x27')]();};}function respondWithResult(_0x3fba2f,_0x194bf8){_0x194bf8=_0x194bf8||0xc8;return function(_0x3fdb8e){if(_0x3fdb8e){return _0x3fba2f[_0x8b65('0x28')](_0x194bf8)[_0x8b65('0x29')](_0x3fdb8e);}};}function respondWithFilteredResult(_0xa8809b,_0x4035df){return function(_0x52caa9){if(_0x52caa9){var _0xbeef8c=typeof _0x4035df[_0x8b65('0x2a')]===_0x8b65('0x2b')&&typeof _0x4035df[_0x8b65('0x2c')]===_0x8b65('0x2b');var _0x58e34a=_0x52caa9[_0x8b65('0x2d')];var _0x1fe749=_0xbeef8c?0x0:_0x4035df[_0x8b65('0x2a')];var _0x1c6977=_0xbeef8c?_0x52caa9['count']:_0x4035df[_0x8b65('0x2a')]+_0x4035df[_0x8b65('0x2c')];var _0x118203;if(_0x1c6977>=_0x58e34a){_0x1c6977=_0x58e34a;_0x118203=0xc8;}else{_0x118203=0xce;}_0xa8809b[_0x8b65('0x28')](_0x118203);return _0xa8809b[_0x8b65('0x2e')](_0x8b65('0x2f'),_0x1fe749+'-'+_0x1c6977+'/'+_0x58e34a)[_0x8b65('0x29')](_0x52caa9);}return null;};}function patchUpdates(_0x58ae3f){return function(_0x12228a){try{jsonpatch[_0x8b65('0x30')](_0x12228a,_0x58ae3f,!![]);}catch(_0x4bcb3b){return BPromise[_0x8b65('0x31')](_0x4bcb3b);}return _0x12228a[_0x8b65('0x32')]();};}function saveUpdates(_0x187114,_0x190814){return function(_0x2aa1ee){if(_0x2aa1ee){return _0x2aa1ee[_0x8b65('0x33')](_0x187114)[_0x8b65('0x1d')](function(_0x326307){return _0x326307;});}return null;};}function removeEntity(_0xa85add,_0x5efd04){return function(_0x2a509f){if(_0x2a509f){return _0x2a509f[_0x8b65('0x34')]()[_0x8b65('0x1d')](function(){_0xa85add[_0x8b65('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57dfe2,_0x490cc1){return function(_0x31df27){if(!_0x31df27){_0x57dfe2[_0x8b65('0x35')](0x194);}return _0x31df27;};}function handleError(_0x334213,_0x2d7719){_0x2d7719=_0x2d7719||0x1f4;return function(_0x37587e){logger[_0x8b65('0x22')](_0x37587e[_0x8b65('0x36')]);if(_0x37587e[_0x8b65('0x37')]){delete _0x37587e[_0x8b65('0x37')];}_0x334213['status'](_0x2d7719)['send'](_0x37587e);};}exports[_0x8b65('0x38')]=function(_0x42989b,_0x5da1d2){var _0x4951b2={},_0x3e300f={},_0x260228={'count':0x0,'rows':[]};var _0x5ba2d2=_[_0x8b65('0x39')](db[_0x8b65('0x3a')][_0x8b65('0x3b')],function(_0x2dc15d){return{'name':_0x2dc15d[_0x8b65('0x3c')],'type':_0x2dc15d[_0x8b65('0x3d')][_0x8b65('0x3e')]};});_0x3e300f[_0x8b65('0x3f')]=_['map'](_0x5ba2d2,_0x8b65('0x37'));_0x3e300f[_0x8b65('0x40')]=_['keys'](_0x42989b['query']);_0x3e300f[_0x8b65('0x41')]=_[_0x8b65('0x42')](_0x3e300f[_0x8b65('0x3f')],_0x3e300f[_0x8b65('0x40')]);_0x4951b2[_0x8b65('0x43')]=_[_0x8b65('0x42')](_0x3e300f['model'],qs[_0x8b65('0x44')](_0x42989b['query'][_0x8b65('0x44')]));_0x4951b2[_0x8b65('0x43')]=_0x4951b2[_0x8b65('0x43')][_0x8b65('0x45')]?_0x4951b2['attributes']:_0x3e300f['model'];if(!_0x42989b[_0x8b65('0x40')][_0x8b65('0x46')]('nolimit')){_0x4951b2[_0x8b65('0x2c')]=qs[_0x8b65('0x2c')](_0x42989b[_0x8b65('0x40')][_0x8b65('0x2c')]);_0x4951b2[_0x8b65('0x2a')]=qs[_0x8b65('0x2a')](_0x42989b[_0x8b65('0x40')][_0x8b65('0x2a')]);}_0x4951b2['order']=qs['sort'](_0x42989b[_0x8b65('0x40')][_0x8b65('0x47')]);_0x4951b2[_0x8b65('0x48')]=qs['filters'](_[_0x8b65('0x49')](_0x42989b['query'],_0x3e300f[_0x8b65('0x41')]),_0x5ba2d2);if(_0x42989b[_0x8b65('0x40')]['filter']){_0x4951b2[_0x8b65('0x48')]=_[_0x8b65('0x4a')](_0x4951b2[_0x8b65('0x48')],{'$or':_[_0x8b65('0x39')](_0x5ba2d2,function(_0x4bc30b){if(_0x4bc30b[_0x8b65('0x3d')]!=='VIRTUAL'){var _0xe782d7={};_0xe782d7[_0x4bc30b[_0x8b65('0x37')]]={'$like':'%'+_0x42989b[_0x8b65('0x40')][_0x8b65('0x4b')]+'%'};return _0xe782d7;}})});}_0x4951b2=_[_0x8b65('0x4a')]({},_0x4951b2,_0x42989b[_0x8b65('0x4c')]);var _0x4d9220={'where':_0x4951b2[_0x8b65('0x48')]};return db['OpenchannelMessage'][_0x8b65('0x2d')](_0x4d9220)['then'](function(_0x144789){_0x260228['count']=_0x144789;if(_0x42989b['query']['includeAll']){_0x4951b2[_0x8b65('0x4d')]=[{'all':!![]}];}return db[_0x8b65('0x3a')][_0x8b65('0x4e')](_0x4951b2);})[_0x8b65('0x1d')](function(_0x8429b0){_0x260228[_0x8b65('0x4f')]=_0x8429b0;return _0x260228;})[_0x8b65('0x1d')](respondWithFilteredResult(_0x5da1d2,_0x4951b2))[_0x8b65('0x26')](handleError(_0x5da1d2,null));};exports[_0x8b65('0x50')]=function(_0x562e08,_0x229480){var _0x19797f={'raw':!![],'where':{'id':_0x562e08[_0x8b65('0x51')]['id']}},_0x550636={};_0x550636['model']=_[_0x8b65('0x52')](db[_0x8b65('0x3a')]['rawAttributes']);_0x550636['query']=_[_0x8b65('0x52')](_0x562e08['query']);_0x550636[_0x8b65('0x41')]=_['intersection'](_0x550636[_0x8b65('0x3f')],_0x550636[_0x8b65('0x40')]);_0x19797f['attributes']=_[_0x8b65('0x42')](_0x550636[_0x8b65('0x3f')],qs[_0x8b65('0x44')](_0x562e08[_0x8b65('0x40')][_0x8b65('0x44')]));_0x19797f['attributes']=_0x19797f['attributes'][_0x8b65('0x45')]?_0x19797f[_0x8b65('0x43')]:_0x550636[_0x8b65('0x3f')];if(_0x562e08[_0x8b65('0x40')][_0x8b65('0x53')]){_0x19797f[_0x8b65('0x4d')]=[{'all':!![]}];}_0x19797f=_['merge']({},_0x19797f,_0x562e08['options']);return db[_0x8b65('0x3a')][_0x8b65('0x54')](_0x19797f)[_0x8b65('0x1d')](handleEntityNotFound(_0x229480,null))['then'](respondWithResult(_0x229480,null))['catch'](handleError(_0x229480,null));};exports[_0x8b65('0x55')]=function(_0xebbde1,_0x1da030){return db[_0x8b65('0x3a')][_0x8b65('0x55')](_0xebbde1[_0x8b65('0x56')],{})[_0x8b65('0x1d')](respondWithResult(_0x1da030,0xc9))[_0x8b65('0x26')](handleError(_0x1da030,null));};exports[_0x8b65('0x33')]=function(_0x501c93,_0x563f97){if(_0x501c93[_0x8b65('0x56')]['id']){delete _0x501c93['body']['id'];}return db[_0x8b65('0x3a')][_0x8b65('0x54')]({'where':{'id':_0x501c93[_0x8b65('0x51')]['id']}})[_0x8b65('0x1d')](handleEntityNotFound(_0x563f97,null))['then'](saveUpdates(_0x501c93['body'],null))[_0x8b65('0x1d')](respondWithResult(_0x563f97,null))[_0x8b65('0x26')](handleError(_0x563f97,null));};exports[_0x8b65('0x34')]=function(_0x56e46b,_0x3f3c96){return db['OpenchannelMessage'][_0x8b65('0x54')]({'where':{'id':_0x56e46b[_0x8b65('0x51')]['id']}})[_0x8b65('0x1d')](handleEntityNotFound(_0x3f3c96,null))[_0x8b65('0x1d')](removeEntity(_0x3f3c96,null))[_0x8b65('0x26')](handleError(_0x3f3c96,null));};exports['describe']=function(_0x1ce76c,_0x5c8428){return db[_0x8b65('0x3a')]['describe']()[_0x8b65('0x1d')](respondWithResult(_0x5c8428,null))[_0x8b65('0x26')](handleError(_0x5c8428,null));};var interaction_log=require('../../config/logger')(_0x8b65('0x57'));exports['accept']=function(_0x16ef7c,_0x3306be,_0xf66b24){var _0x4761ed={'agent':{},'channel':_0x8b65('0x58')};if(_0x16ef7c[_0x8b65('0x56')]['id']){delete _0x16ef7c[_0x8b65('0x56')]['id'];}_0x16ef7c[_0x8b65('0x56')][_0x8b65('0x59')]=!![];_0x16ef7c[_0x8b65('0x56')][_0x8b65('0x5a')]=moment()[_0x8b65('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');_0x16ef7c[_0x8b65('0x56')]['UserId']=_0x16ef7c[_0x8b65('0x56')][_0x8b65('0x5c')]||_0x16ef7c[_0x8b65('0x5d')]['id'];_0x4761ed[_0x8b65('0x5e')]['id']=_0x16ef7c[_0x8b65('0x56')][_0x8b65('0x5c')];return db[_0x8b65('0x3a')][_0x8b65('0x54')]({'where':{'id':_0x16ef7c[_0x8b65('0x51')]['id'],'UserId':null}})[_0x8b65('0x1d')](handleEntityNotFound(_0x3306be,null))[_0x8b65('0x1d')](saveUpdates(_0x16ef7c[_0x8b65('0x56')],null))[_0x8b65('0x1d')](function(_0x43f08c){if(_0x43f08c){_0x4761ed[_0x8b65('0x24')]=_0x43f08c['get']({'plain':!![]});return db[_0x8b65('0x5f')][_0x8b65('0x54')]({'where':{'id':_0x43f08c[_0x8b65('0x60')]}});}return null;})[_0x8b65('0x1d')](handleEntityNotFound(_0x3306be,null))['then'](function(_0xaf73a){if(_0xaf73a){return _0xaf73a[_0x8b65('0x33')]({'UserId':_0x16ef7c['body']['UserId'],'read1stAt':_[_0x8b65('0x61')](_0xaf73a[_0x8b65('0x62')])?moment()['format'](_0x8b65('0x63')):undefined});}return null;})[_0x8b65('0x1d')](function(_0x2b3f0d){if(_0x2b3f0d){_0x4761ed['interaction']=_0x2b3f0d[_0x8b65('0x64')]({'plain':!![]});interaction_log[_0x8b65('0x65')](_0x8b65('0x66'),_0x16ef7c['user']['id'],_0x16ef7c[_0x8b65('0x5d')][_0x8b65('0x37')],_0x16ef7c[_0x8b65('0x5d')][_0x8b65('0x67')],_0x4761ed[_0x8b65('0x68')]['id'],_0x16ef7c[_0x8b65('0x56')]?JSON['stringify'](_0x16ef7c[_0x8b65('0x56')]):_0x8b65('0x69'));return respondWithRpcPromise(_0x8b65('0x6a'),_0x8b65('0x6b'),_0x4761ed);}return null;})['then'](function(_0x1b7939){var _0x507cb3=_0x8b65('0x6c')+_0x1b7939[_0x8b65('0x24')][_0x8b65('0x6d')];return db['sequelize'][_0x8b65('0x40')](_0x507cb3,{'type':db[_0x8b65('0x6e')][_0x8b65('0x6f')][_0x8b65('0x70')],'raw':!![]})[_0x8b65('0x1d')](function(_0x29779f){return _0x29779f;});})[_0x8b65('0x1d')](function(_0x24679c){if(_0x24679c){_0x4761ed[_0x8b65('0x24')][_0x8b65('0x71')]=_0x24679c[0x0];if(!_0x16ef7c['body'][_0x8b65('0x5c')])return;return db['User'][_0x8b65('0x54')]({'where':{'id':_0x16ef7c['body'][_0x8b65('0x5c')],'role':_0x8b65('0x5e')},'attributes':['id',_0x8b65('0x37'),'fullname',_0x8b65('0x72'),_0x8b65('0x73')],'raw':!![]});}return null;})[_0x8b65('0x1d')](function(_0x217148){if(!_0x217148)return null;_0x4761ed[_0x8b65('0x24')][_0x8b65('0x5e')]=_0x217148;return _0x4761ed;})['then'](function(_0x597c67){if(_0x597c67){if(_0x16ef7c[_0x8b65('0x56')][_0x8b65('0x74')]){_0x4761ed[_0x8b65('0x24')][_0x8b65('0x75')]=util['format'](_0x8b65('0x76'),_0x16ef7c[_0x8b65('0x5d')]['name']);_0x4761ed[_0x8b65('0x24')][_0x8b65('0x77')]=_0x4761ed['channel'];_0x4761ed['message'][_0x8b65('0x78')]=_0x4761ed[_0x8b65('0x77')];_0x4761ed[_0x8b65('0x24')][_0x8b65('0x79')]=_0x8b65('0x7a');return respondWithRpcPromise(_0x8b65('0x7b'),'EventManager',{'event':_0x8b65('0x7c'),'message':_0x4761ed['message']},client9002)['then'](function(){return _0x4761ed;});}return _0x4761ed;}return null;})[_0x8b65('0x1d')](respondWithResult(_0x3306be,null))[_0x8b65('0x26')](handleError(_0x3306be,null));};var interaction_log=require('../../config/logger')(_0x8b65('0x57'));exports[_0x8b65('0x31')]=function(_0x2f4dc5,_0x433980,_0x3e81b1){var _0xbff27d={'agent':{},'channel':_0x8b65('0x58')};if(_0x2f4dc5['body']['id']){delete _0x2f4dc5[_0x8b65('0x56')]['id'];}_0x2f4dc5['body'][_0x8b65('0x5c')]=_0x2f4dc5[_0x8b65('0x56')]['UserId']||_0x2f4dc5[_0x8b65('0x5d')]['id'];_0xbff27d['agent']['id']=_0x2f4dc5[_0x8b65('0x56')][_0x8b65('0x5c')];return db[_0x8b65('0x3a')][_0x8b65('0x54')]({'where':{'id':_0x2f4dc5[_0x8b65('0x51')]['id'],'UserId':null}})[_0x8b65('0x1d')](handleEntityNotFound(_0x433980,null))[_0x8b65('0x1d')](function(_0x4c6845){if(_0x4c6845){_0xbff27d[_0x8b65('0x24')]=_0x4c6845[_0x8b65('0x64')]({'plain':!![]});return db[_0x8b65('0x5f')]['find']({'where':{'id':_0x4c6845['OpenchannelInteractionId']}});}return null;})[_0x8b65('0x1d')](handleEntityNotFound(_0x433980,null))['then'](function(_0x50a79b){if(_0x50a79b){_0xbff27d[_0x8b65('0x68')]=_0x50a79b[_0x8b65('0x64')]({'plain':!![]});interaction_log[_0x8b65('0x65')](_0x8b65('0x7d'),_0x2f4dc5[_0x8b65('0x5d')]['id'],_0x2f4dc5['user'][_0x8b65('0x37')],_0x2f4dc5[_0x8b65('0x5d')][_0x8b65('0x67')],_0xbff27d[_0x8b65('0x68')]['id'],_0x2f4dc5['body']?JSON['stringify'](_0x2f4dc5[_0x8b65('0x56')]):_0x8b65('0x69'));return respondWithRpcPromise(_0x8b65('0x7e'),_0x8b65('0x7f'),_0xbff27d);}return null;})[_0x8b65('0x1d')](function(_0x47aff9){var _0x17ea30=_0x8b65('0x6c')+_0x47aff9[_0x8b65('0x24')][_0x8b65('0x6d')];return db['sequelize']['query'](_0x17ea30,{'type':db[_0x8b65('0x6e')][_0x8b65('0x6f')][_0x8b65('0x70')],'raw':!![]})[_0x8b65('0x1d')](function(_0x5ef849){return _0x5ef849;});})[_0x8b65('0x1d')](function(_0x553e3b){if(_0x553e3b){_0xbff27d[_0x8b65('0x24')][_0x8b65('0x71')]=_0x553e3b[0x0];if(!_0x2f4dc5[_0x8b65('0x56')][_0x8b65('0x5c')])return;return db[_0x8b65('0x80')][_0x8b65('0x54')]({'where':{'id':_0x2f4dc5[_0x8b65('0x56')][_0x8b65('0x5c')],'role':_0x8b65('0x5e')},'attributes':['id',_0x8b65('0x37'),_0x8b65('0x81'),_0x8b65('0x72'),_0x8b65('0x73')],'raw':!![]});}return null;})[_0x8b65('0x1d')](function(_0x46550f){if(!_0x46550f)return null;_0xbff27d['message']['agent']=_0x46550f;return _0xbff27d;})[_0x8b65('0x1d')](function(_0x378163){if(_0x378163){_0x378163[_0x8b65('0x24')][_0x8b65('0x75')]=util[_0x8b65('0x5b')]('SIP/%s',_0x2f4dc5[_0x8b65('0x5d')][_0x8b65('0x37')]);_0x378163[_0x8b65('0x24')][_0x8b65('0x77')]=_0xbff27d[_0x8b65('0x77')];_0x378163[_0x8b65('0x24')][_0x8b65('0x78')]=_0xbff27d[_0x8b65('0x77')];_0x378163['message'][_0x8b65('0x79')]=_0x8b65('0x31');respondWithRpcPromise('EventManager',_0x8b65('0x7b'),{'event':'rejectmessage','message':_0x378163['message']},client9002);return _0xbff27d;}return null;})[_0x8b65('0x1d')](respondWithResult(_0x433980,null))['catch'](handleError(_0x433980,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index c7083d1..3858ed3 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 _0x2aec=['OpenchannelMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x3c04ef,_0x9d110c){var _0x6a3a69=function(_0x333514){while(--_0x333514){_0x3c04ef['push'](_0x3c04ef['shift']());}};_0x6a3a69(++_0x9d110c);}(_0x2aec,0x187));var _0xc2ae=function(_0x588c40,_0x254367){_0x588c40=_0x588c40-0x0;var _0x5016ad=_0x2aec[_0x588c40];return _0x5016ad;};'use strict';var EventEmitter=require(_0xc2ae('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0xc2ae('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xc2ae('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc2ae('0x3'),'afterDestroy':_0xc2ae('0x4')};function emitEvent(_0x52cb5b){return function(_0x916ee2,_0x548536,_0x36da1d){OpenchannelMessageEvents['emit'](_0x52cb5b+':'+_0x916ee2['id'],_0x916ee2);OpenchannelMessageEvents[_0xc2ae('0x5')](_0x52cb5b,_0x916ee2);_0x36da1d(null);};}for(var e in events){if(events[_0xc2ae('0x6')](e)){var event=events[e];OpenchannelMessage[_0xc2ae('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0xd966=['hasOwnProperty','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','emit'];(function(_0x2fc2ca,_0x318219){var _0x5d3f1a=function(_0x41f7e3){while(--_0x41f7e3){_0x2fc2ca['push'](_0x2fc2ca['shift']());}};_0x5d3f1a(++_0x318219);}(_0xd966,0x138));var _0x6d96=function(_0x21fc0a,_0x1c3a72){_0x21fc0a=_0x21fc0a-0x0;var _0x485574=_0xd966[_0x21fc0a];return _0x485574;};'use strict';var EventEmitter=require(_0x6d96('0x0'));var OpenchannelMessage=require(_0x6d96('0x1'))['db'][_0x6d96('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x6d96('0x3')](0x0);var events={'afterCreate':_0x6d96('0x4'),'afterUpdate':_0x6d96('0x5'),'afterDestroy':_0x6d96('0x6')};function emitEvent(_0x1b1701){return function(_0x32af45,_0x3190ff,_0x178507){OpenchannelMessageEvents[_0x6d96('0x7')](_0x1b1701+':'+_0x32af45['id'],_0x32af45);OpenchannelMessageEvents[_0x6d96('0x7')](_0x1b1701,_0x32af45);_0x178507(null);};}for(var e in events){if(events[_0x6d96('0x8')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x6d96('0x9')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 5ea48e3..f73e50b 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 _0x36ee=['request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','fti_openchannel_messages','FULLTEXT','get','direction','toLowerCase','out','secret','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','catch','error','CmContact','then','find','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','length','POST','method','GET','body','format','threadId','update','Interaction','inspect','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','bluebird'];(function(_0x216803,_0x1e4791){var _0x11e87b=function(_0x396842){while(--_0x396842){_0x216803['push'](_0x216803['shift']());}};_0x11e87b(++_0x1e4791);}(_0x36ee,0xe8));var _0xe36e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x36ee[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe36e('0x0'))('api');var moment=require(_0xe36e('0x1'));var BPromise=require(_0xe36e('0x2'));var rp=require(_0xe36e('0x3'));var fs=require('fs');var path=require(_0xe36e('0x4'));var rimraf=require(_0xe36e('0x5'));var config=require(_0xe36e('0x6'));var attributes=require(_0xe36e('0x7'));module[_0xe36e('0x8')]=function(_0x25a07d,_0x190404){return _0x25a07d[_0xe36e('0x9')](_0xe36e('0xa'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xe36e('0xb'),'fields':['body'],'type':_0xe36e('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x123c16,_0x46f239,_0x47ce3a){var _0xf119e4=_0x25a07d['models'];var _0x2e968d=_0x123c16[_0xe36e('0xd')]({'plain':!![]});if(_0x2e968d[_0xe36e('0xe')][_0xe36e('0xf')]()==='in'||_0x2e968d[_0xe36e('0xe')][_0xe36e('0xf')]()===_0xe36e('0x10')&&!_0x2e968d[_0xe36e('0x11')]&&!_['isNil'](_0x2e968d[_0xe36e('0x12')])){_0xf119e4[_0xe36e('0x13')][_0xe36e('0x14')]({'where':{'id':_0x2e968d[_0xe36e('0x15')]}})['then'](function(_0x3e264a){if(_0x3e264a){_0x3e264a['update']({'lastMsgAt':_0x2e968d['createdAt'],'lastMsgDirection':_0x2e968d[_0xe36e('0xe')][_0xe36e('0xf')]()});}})[_0xe36e('0x16')](function(_0x278135){console[_0xe36e('0x17')](_0x278135);});}if(_0x2e968d[_0xe36e('0xe')]===_0xe36e('0x10')&&!_0x2e968d[_0xe36e('0x11')]){var _0x387c37;_0xf119e4[_0xe36e('0x18')]['describe']()[_0xe36e('0x19')](function(_0x2184ae){return _0xf119e4['OpenchannelAccount'][_0xe36e('0x1a')]({'where':{'id':_0x2e968d['OpenchannelAccountId']},'include':[{'model':_0xf119e4[_0xe36e('0x13')],'as':_0xe36e('0x1b'),'where':{'id':_0x2e968d['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0xf119e4[_0xe36e('0x18')],'as':_0xe36e('0x1c'),'attributes':_[_0xe36e('0x1d')](_0x2184ae)}]}]});})['then'](function(_0x21e95e){_0x387c37=_0x21e95e[_0xe36e('0xd')]({'plain':!![]});if(_0x387c37&&_0x387c37[_0xe36e('0x1e')]){logger[_0xe36e('0x1f')](_0xe36e('0x20'),_0xe36e('0x21'),util['format'](_0xe36e('0x22'),_0x2e968d['id'],_0x387c37[_0xe36e('0x1e')]));if(_0x387c37[_0xe36e('0x1b')]&&_0x387c37[_0xe36e('0x1b')][_0xe36e('0x23')]){_0x2e968d['Interaction']=_['omit'](_0x387c37[_0xe36e('0x1b')][0x0],_0xe36e('0x1c'));_0x2e968d[_0xe36e('0x1c')]=_0x387c37[_0xe36e('0x1b')][0x0][_0xe36e('0x1c')];}var _0x46f239={'method':_0xe36e('0x24'),'uri':encodeURI(_0x387c37['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x46f239[_0xe36e('0x25')]){case _0xe36e('0x26'):_0x46f239['qs']=_0x2e968d;break;case _0xe36e('0x24'):_0x46f239[_0xe36e('0x27')]=_0x2e968d;break;}return rp(_0x46f239)['then'](function(_0x2d757c){logger['info'](_0xe36e('0x20'),'afterCreate',util[_0xe36e('0x28')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x2e968d['id'],_0x387c37[_0xe36e('0x1e')]));if(_0x2d757c['body'][_0xe36e('0x29')]&&_0x2d757c['body']['threadId']!=_0x2e968d['Interaction']['threadId']){return _0xf119e4[_0xe36e('0x13')][_0xe36e('0x2a')]({'threadId':_0x2d757c['body']['threadId']},{'logging':!![],'where':{'id':_0x2e968d[_0xe36e('0x2b')]['id']}});}else{return;}})[_0xe36e('0x19')](function(){return _0x123c16[_0xe36e('0x2a')]({'read':!![]});})[_0xe36e('0x16')](function(_0x3d826e){logger[_0xe36e('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0xe36e('0x21'),util[_0xe36e('0x2c')](_0x3d826e,{'showHidden':![],'depth':null}));_0x47ce3a();});}else{_0x47ce3a();}})['finally'](function(){_0x47ce3a();});}else{_0x47ce3a();}}},'charset':_0xe36e('0x2d'),'collate':_0xe36e('0x2e')});}; \ No newline at end of file +var _0x5c3c=['Forwarding\x20message\x20%d\x20to\x20%s','omit','Contact','method','GET','POST','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','fti_openchannel_messages','body','models','get','direction','toLowerCase','out','isNil','UserId','OpenchannelInteraction','OpenchannelInteractionId','then','update','createdAt','catch','error','describe','OpenchannelAccount','find','Interactions','CmContact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format'];(function(_0x13ecac,_0x217b62){var _0x2be29b=function(_0x5ab443){while(--_0x5ab443){_0x13ecac['push'](_0x13ecac['shift']());}};_0x2be29b(++_0x217b62);}(_0x5c3c,0x132));var _0xc5c3=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x5c3c[_0x9fd887];return _0x1a54ab;};'use strict';var _=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var logger=require(_0xc5c3('0x2'))(_0xc5c3('0x3'));var moment=require('moment');var BPromise=require(_0xc5c3('0x4'));var rp=require(_0xc5c3('0x5'));var fs=require('fs');var path=require(_0xc5c3('0x6'));var rimraf=require(_0xc5c3('0x7'));var config=require(_0xc5c3('0x8'));var attributes=require(_0xc5c3('0x9'));module[_0xc5c3('0xa')]=function(_0x23a6b5,_0x28bdd9){return _0x23a6b5['define']('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xc5c3('0xb'),'fields':[_0xc5c3('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x110b89,_0x46e2c1,_0x52f3eb){var _0x14140f=_0x23a6b5[_0xc5c3('0xd')];var _0x4e329f=_0x110b89[_0xc5c3('0xe')]({'plain':!![]});if(_0x4e329f[_0xc5c3('0xf')][_0xc5c3('0x10')]()==='in'||_0x4e329f['direction'][_0xc5c3('0x10')]()===_0xc5c3('0x11')&&!_0x4e329f['secret']&&!_[_0xc5c3('0x12')](_0x4e329f[_0xc5c3('0x13')])){_0x14140f[_0xc5c3('0x14')]['findOne']({'where':{'id':_0x4e329f[_0xc5c3('0x15')]}})[_0xc5c3('0x16')](function(_0x1488ab){if(_0x1488ab){_0x1488ab[_0xc5c3('0x17')]({'lastMsgAt':_0x4e329f[_0xc5c3('0x18')],'lastMsgDirection':_0x4e329f['direction']['toLowerCase']()});}})[_0xc5c3('0x19')](function(_0x577e1a){console[_0xc5c3('0x1a')](_0x577e1a);});}if(_0x4e329f[_0xc5c3('0xf')]==='out'&&!_0x4e329f['secret']){var _0x467ba9;_0x14140f['CmContact'][_0xc5c3('0x1b')]()[_0xc5c3('0x16')](function(_0x2ff158){return _0x14140f[_0xc5c3('0x1c')][_0xc5c3('0x1d')]({'where':{'id':_0x4e329f['OpenchannelAccountId']},'include':[{'model':_0x14140f[_0xc5c3('0x14')],'as':_0xc5c3('0x1e'),'where':{'id':_0x4e329f[_0xc5c3('0x15')]},'limit':0x1,'include':[{'model':_0x14140f[_0xc5c3('0x1f')],'as':'Contact','attributes':_[_0xc5c3('0x20')](_0x2ff158)}]}]});})[_0xc5c3('0x16')](function(_0x3cc612){_0x467ba9=_0x3cc612[_0xc5c3('0xe')]({'plain':!![]});if(_0x467ba9&&_0x467ba9[_0xc5c3('0x21')]){logger['info'](_0xc5c3('0x22'),_0xc5c3('0x23'),util[_0xc5c3('0x24')](_0xc5c3('0x25'),_0x4e329f['id'],_0x467ba9[_0xc5c3('0x21')]));if(_0x467ba9[_0xc5c3('0x1e')]&&_0x467ba9[_0xc5c3('0x1e')]['length']){_0x4e329f['Interaction']=_[_0xc5c3('0x26')](_0x467ba9[_0xc5c3('0x1e')][0x0],'Contact');_0x4e329f['Contact']=_0x467ba9[_0xc5c3('0x1e')][0x0][_0xc5c3('0x27')];}var _0x46e2c1={'method':'POST','uri':encodeURI(_0x467ba9['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x46e2c1[_0xc5c3('0x28')]){case _0xc5c3('0x29'):_0x46e2c1['qs']=_0x4e329f;break;case _0xc5c3('0x2a'):_0x46e2c1[_0xc5c3('0xc')]=_0x4e329f;break;}return rp(_0x46e2c1)['then'](function(_0x21efd6){logger['info'](_0xc5c3('0x22'),'afterCreate',util[_0xc5c3('0x24')](_0xc5c3('0x2b'),_0x4e329f['id'],_0x467ba9[_0xc5c3('0x21')]));if(_0x21efd6[_0xc5c3('0xc')][_0xc5c3('0x2c')]&&_0x21efd6[_0xc5c3('0xc')][_0xc5c3('0x2c')]!=_0x4e329f['Interaction'][_0xc5c3('0x2c')]){return _0x14140f['OpenchannelInteraction'][_0xc5c3('0x17')]({'threadId':_0x21efd6[_0xc5c3('0xc')]['threadId']},{'logging':!![],'where':{'id':_0x4e329f['Interaction']['id']}});}else{return;}})[_0xc5c3('0x16')](function(){return _0x110b89[_0xc5c3('0x17')]({'read':!![]});})[_0xc5c3('0x19')](function(_0x19e482){logger['error'](_0xc5c3('0x22'),_0xc5c3('0x23'),util[_0xc5c3('0x2d')](_0x19e482,{'showHidden':![],'depth':null}));_0x52f3eb();});}else{_0x52f3eb();}})[_0xc5c3('0x2e')](function(){_0x52f3eb();});}else{_0x52f3eb();}}},'charset':_0xc5c3('0x2f'),'collate':_0xc5c3('0x30')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index ad15d34..0dba9e9 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(_0x3d5af9,_0x196049){var _0x23936e=function(_0x405238){while(--_0x405238){_0x3d5af9['push'](_0x3d5af9['shift']());}};_0x23936e(++_0x196049);}(_0xadb5,0xad));var _0x5adb=function(_0x8c30d2,_0x4e45f0){_0x8c30d2=_0x8c30d2-0x0;var _0x1ad441=_0xadb5[_0x8c30d2];return _0x1ad441;};'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 _0x2ef3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateOpenchannelMessage','create','options','info'];(function(_0x4b033b,_0x5e06a0){var _0x208fd2=function(_0x4b063c){while(--_0x4b063c){_0x4b033b['push'](_0x4b033b['shift']());}};_0x208fd2(++_0x5e06a0);}(_0x2ef3,0xba));var _0x32ef=function(_0x307a69,_0x275c50){_0x307a69=_0x307a69-0x0;var _0x7553b3=_0x2ef3[_0x307a69];return _0x7553b3;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});}exports[_0x32ef('0x1b')]=function(_0x26aff3){var _0x251084=this;return new Promise(function(_0x445cda,_0x3aec05){return db['OpenchannelMessage'][_0x32ef('0x1c')](_0x26aff3['body'],{'raw':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x32ef('0x11')](function(_0x97780){logger[_0x32ef('0x1e')]('CreateOpenchannelMessage',_0x26aff3);logger['debug'](_0x32ef('0x1b'),_0x26aff3,JSON[_0x32ef('0x15')](_0x97780));_0x445cda(_0x97780);})[_0x32ef('0x1a')](function(_0x478bef){logger['error'](_0x32ef('0x1b'),_0x478bef['message'],_0x26aff3);_0x3aec05(_0x251084['error'](0x1f4,_0x478bef[_0x32ef('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index cc772ea..46d5cb2 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 _0x4491=['remove','emit','register','length','openchannelMessage:','./openchannelMessage.events'];(function(_0x5c96dd,_0x3017af){var _0x20416f=function(_0x30a54e){while(--_0x30a54e){_0x5c96dd['push'](_0x5c96dd['shift']());}};_0x20416f(++_0x3017af);}(_0x4491,0x1bb));var _0x1449=function(_0xe8194,_0xc7ec76){_0xe8194=_0xe8194-0x0;var _0x1cb195=_0x4491[_0xe8194];return _0x1cb195;};'use strict';var OpenchannelMessageEvents=require(_0x1449('0x0'));var events=['save',_0x1449('0x1'),'update'];function createListener(_0x4273ee,_0x176880){return function(_0x45474c){_0x176880[_0x1449('0x2')](_0x4273ee,_0x45474c);};}function removeListener(_0x1ff47f,_0x1b2870){return function(){OpenchannelMessageEvents['removeListener'](_0x1ff47f,_0x1b2870);};}exports[_0x1449('0x3')]=function(_0x557482){for(var _0x1d45eb=0x0,_0x5dfe4c=events[_0x1449('0x4')];_0x1d45eb<_0x5dfe4c;_0x1d45eb++){var _0x2f4189=events[_0x1d45eb];var _0x10e119=createListener(_0x1449('0x5')+_0x2f4189,_0x557482);OpenchannelMessageEvents['on'](_0x2f4189,_0x10e119);}}; \ No newline at end of file +var _0xf767=['remove','update','emit','removeListener','length','openchannelMessage:','save'];(function(_0x25a299,_0x349722){var _0xe0c9ca=function(_0x2c38ca){while(--_0x2c38ca){_0x25a299['push'](_0x25a299['shift']());}};_0xe0c9ca(++_0x349722);}(_0xf767,0x76));var _0x7f76=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xf767[_0x3947c9];return _0x2e7871;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x7f76('0x0'),_0x7f76('0x1'),_0x7f76('0x2')];function createListener(_0x23f0c3,_0x90398d){return function(_0x5d215a){_0x90398d[_0x7f76('0x3')](_0x23f0c3,_0x5d215a);};}function removeListener(_0x2aa5e1,_0x40ba50){return function(){OpenchannelMessageEvents[_0x7f76('0x4')](_0x2aa5e1,_0x40ba50);};}exports['register']=function(_0x23c243){for(var _0x2f2588=0x0,_0x45ddcc=events[_0x7f76('0x5')];_0x2f2588<_0x45ddcc;_0x2f2588++){var _0x1fc46c=events[_0x2f2588];var _0x5acfee=createListener(_0x7f76('0x6')+_0x1fc46c,_0x23c243);OpenchannelMessageEvents['on'](_0x1fc46c,_0x5acfee);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 88d71cc..b0ee13c 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 _0x23f9=['show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe'];(function(_0x3cf39f,_0x506e67){var _0x39c202=function(_0x27dcad){while(--_0x27dcad){_0x3cf39f['push'](_0x3cf39f['shift']());}};_0x39c202(++_0x506e67);}(_0x23f9,0x116));var _0x923f=function(_0x27c071,_0x51f1cc){_0x27c071=_0x27c071-0x0;var _0x450cba=_0x23f9[_0x27c071];return _0x450cba;};'use strict';var multer=require(_0x923f('0x0'));var util=require('util');var path=require(_0x923f('0x1'));var timeout=require(_0x923f('0x2'));var express=require(_0x923f('0x3'));var router=express[_0x923f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x923f('0x5'));var interaction=require(_0x923f('0x6'));var config=require(_0x923f('0x7'));var controller=require('./openchannelQueue.controller');router[_0x923f('0x8')]('/',auth[_0x923f('0x9')](),controller[_0x923f('0xa')]);router[_0x923f('0x8')]('/describe',auth[_0x923f('0x9')](),controller[_0x923f('0xb')]);router[_0x923f('0x8')]('/:id',auth[_0x923f('0x9')](),controller[_0x923f('0xc')]);router[_0x923f('0x8')](_0x923f('0xd'),auth['isAuthenticated'](),controller[_0x923f('0xe')]);router[_0x923f('0x8')](_0x923f('0xf'),auth[_0x923f('0x9')](),controller[_0x923f('0x10')]);router[_0x923f('0x8')](_0x923f('0x11'),auth[_0x923f('0x9')](),controller[_0x923f('0x12')]);router[_0x923f('0x13')]('/',auth[_0x923f('0x9')](),controller[_0x923f('0x14')]);router[_0x923f('0x13')](_0x923f('0xf'),auth['isAuthenticated'](),controller[_0x923f('0x15')]);router['post'](_0x923f('0x11'),auth['isAuthenticated'](),controller[_0x923f('0x16')]);router[_0x923f('0x17')]('/:id',auth[_0x923f('0x9')](),controller[_0x923f('0x18')]);router[_0x923f('0x19')]('/:id',auth[_0x923f('0x9')](),controller[_0x923f('0x1a')]);router[_0x923f('0x19')](_0x923f('0xf'),auth[_0x923f('0x9')](),controller[_0x923f('0x1b')]);router[_0x923f('0x19')]('/:id/users',auth[_0x923f('0x9')](),controller['removeAgents']);module[_0x923f('0x1c')]=router; \ No newline at end of file +var _0xb611=['exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','addTeams','post','delete','destroy','/:id/teams','removeTeams','removeAgents'];(function(_0x40e8b9,_0x5ee28b){var _0x4b64a9=function(_0x38749f){while(--_0x38749f){_0x40e8b9['push'](_0x40e8b9['shift']());}};_0x4b64a9(++_0x5ee28b);}(_0xb611,0xa3));var _0x1b61=function(_0x5cbb32,_0x233ace){_0x5cbb32=_0x5cbb32-0x0;var _0x49363c=_0xb611[_0x5cbb32];return _0x49363c;};'use strict';var multer=require('multer');var util=require(_0x1b61('0x0'));var path=require('path');var timeout=require(_0x1b61('0x1'));var express=require('express');var router=express[_0x1b61('0x2')]();var fs_extra=require(_0x1b61('0x3'));var auth=require(_0x1b61('0x4'));var interaction=require(_0x1b61('0x5'));var config=require('../../config/environment');var controller=require(_0x1b61('0x6'));router[_0x1b61('0x7')]('/',auth['isAuthenticated'](),controller[_0x1b61('0x8')]);router[_0x1b61('0x7')](_0x1b61('0x9'),auth['isAuthenticated'](),controller[_0x1b61('0xa')]);router[_0x1b61('0x7')](_0x1b61('0xb'),auth[_0x1b61('0xc')](),controller[_0x1b61('0xd')]);router['get'](_0x1b61('0xe'),auth[_0x1b61('0xc')](),controller[_0x1b61('0xf')]);router[_0x1b61('0x7')]('/:id/teams',auth[_0x1b61('0xc')](),controller[_0x1b61('0x10')]);router[_0x1b61('0x7')](_0x1b61('0x11'),auth[_0x1b61('0xc')](),controller[_0x1b61('0x12')]);router['post']('/',auth[_0x1b61('0xc')](),controller['create']);router['post']('/:id/teams',auth[_0x1b61('0xc')](),controller[_0x1b61('0x13')]);router[_0x1b61('0x14')](_0x1b61('0x11'),auth['isAuthenticated'](),controller['addAgents']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x1b61('0x15')](_0x1b61('0xb'),auth[_0x1b61('0xc')](),controller[_0x1b61('0x16')]);router[_0x1b61('0x15')](_0x1b61('0x17'),auth['isAuthenticated'](),controller[_0x1b61('0x18')]);router[_0x1b61('0x15')]('/:id/users',auth['isAuthenticated'](),controller[_0x1b61('0x19')]);module[_0x1b61('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 5e4cded..add6de0 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 _0x58bd=['beepall','roundrobin','sequelize','exports','STRING','name','ENUM','rrmemory'];(function(_0x3dd23c,_0x18c32f){var _0x520bf8=function(_0x462f87){while(--_0x462f87){_0x3dd23c['push'](_0x3dd23c['shift']());}};_0x520bf8(++_0x18c32f);}(_0x58bd,0x182));var _0xd58b=function(_0x3135b8,_0x302bfb){_0x3135b8=_0x3135b8-0x0;var _0xddeb0f=_0x58bd[_0x3135b8];return _0xddeb0f;};'use strict';var Sequelize=require(_0xd58b('0x0'));module[_0xd58b('0x1')]={'name':{'type':Sequelize[_0xd58b('0x2')],'unique':_0xd58b('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd58b('0x4')](_0xd58b('0x5'),_0xd58b('0x6'),_0xd58b('0x7'))}}; \ No newline at end of file +var _0x2bf9=['ENUM','rrmemory','beepall','roundrobin','exports','STRING','name','INTEGER'];(function(_0x2a881e,_0x36850b){var _0x3c5732=function(_0x443a6e){while(--_0x443a6e){_0x2a881e['push'](_0x2a881e['shift']());}};_0x3c5732(++_0x36850b);}(_0x2bf9,0x1cc));var _0x92bf=function(_0x5ce8b9,_0x5cded8){_0x5ce8b9=_0x5ce8b9-0x0;var _0xe34be0=_0x2bf9[_0x5ce8b9];return _0xe34be0;};'use strict';var Sequelize=require('sequelize');module[_0x92bf('0x0')]={'name':{'type':Sequelize[_0x92bf('0x1')],'unique':_0x92bf('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x92bf('0x1')]},'timeout':{'type':Sequelize[_0x92bf('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x92bf('0x4')](_0x92bf('0x5'),_0x92bf('0x6'),_0x92bf('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index ca7d3c1..bf8739a 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 _0x9da5=['union','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','spread','isArray','getAgents','nolimit','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','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','defaults','redis','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','name','send','index','OpenchannelQueue','rawAttributes','fieldName','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filters','filter','merge','where','type','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','keys','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','OpenchannelQueueId','UserOpenchannelQueue','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x9da5,0x9d));var _0x59da=function(_0x1bfe2b,_0x34856e){_0x1bfe2b=_0x1bfe2b-0x0;var _0x1477d4=_0x9da5[_0x1bfe2b];return _0x1477d4;};'use strict';var emlformat=require(_0x59da('0x0'));var rimraf=require(_0x59da('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x59da('0x2'));var rp=require(_0x59da('0x3'));var moment=require(_0x59da('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x59da('0x5'));var util=require(_0x59da('0x6'));var path=require('path');var sox=require(_0x59da('0x7'));var csv=require(_0x59da('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x59da('0x9'));var _=require(_0x59da('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x59da('0xb'));var deskjs=require(_0x59da('0xc'));var toCsv=require(_0x59da('0x8'));var querystring=require(_0x59da('0xd'));var Papa=require('papaparse');var Redis=require(_0x59da('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x59da('0xf'));var as=require(_0x59da('0x10'));var hardwareService=require(_0x59da('0x11'));var logger=require(_0x59da('0x12'))(_0x59da('0x13'));var utils=require(_0x59da('0x14'));var config=require(_0x59da('0x15'));var licenseUtil=require(_0x59da('0x16'));var db=require(_0x59da('0x17'))['db'];config['redis']=_[_0x59da('0x18')](config[_0x59da('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x59da('0x1a'))(new Redis(config[_0x59da('0x19')]));require(_0x59da('0x1b'))['register'](socket);function respondWithStatusCode(_0x2bd02b,_0x4b1431){_0x4b1431=_0x4b1431||0xcc;return function(_0x2b60a4){if(_0x2b60a4){return _0x2bd02b[_0x59da('0x1c')](_0x4b1431);}return _0x2bd02b[_0x59da('0x1d')](_0x4b1431)[_0x59da('0x1e')]();};}function respondWithResult(_0x3a5832,_0x50da39){_0x50da39=_0x50da39||0xc8;return function(_0x5c0132){if(_0x5c0132){return _0x3a5832[_0x59da('0x1d')](_0x50da39)[_0x59da('0x1f')](_0x5c0132);}};}function respondWithFilteredResult(_0x375ea9,_0x2941cd){return function(_0x3efd55){if(_0x3efd55){var _0x4d845a=typeof _0x2941cd[_0x59da('0x20')]==='undefined'&&typeof _0x2941cd[_0x59da('0x21')]===_0x59da('0x22');var _0xd12297=_0x3efd55['count'];var _0x227691=_0x4d845a?0x0:_0x2941cd['offset'];var _0x130a1a=_0x4d845a?_0x3efd55['count']:_0x2941cd['offset']+_0x2941cd[_0x59da('0x21')];var _0x3582b1;if(_0x130a1a>=_0xd12297){_0x130a1a=_0xd12297;_0x3582b1=0xc8;}else{_0x3582b1=0xce;}_0x375ea9[_0x59da('0x1d')](_0x3582b1);return _0x375ea9[_0x59da('0x23')](_0x59da('0x24'),_0x227691+'-'+_0x130a1a+'/'+_0xd12297)[_0x59da('0x1f')](_0x3efd55);}return null;};}function patchUpdates(_0x34f8c6){return function(_0x5de872){try{jsonpatch[_0x59da('0x25')](_0x5de872,_0x34f8c6,!![]);}catch(_0x1b61ac){return BPromise[_0x59da('0x26')](_0x1b61ac);}return _0x5de872[_0x59da('0x27')]();};}function saveUpdates(_0x154ddd,_0xa9d16d){return function(_0x5bbe11){if(_0x5bbe11){return _0x5bbe11[_0x59da('0x28')](_0x154ddd)[_0x59da('0x29')](function(_0x3ca408){return _0x3ca408;});}return null;};}function removeEntity(_0x1ab375,_0x67bbf0){return function(_0x53472a){if(_0x53472a){return _0x53472a[_0x59da('0x2a')]()[_0x59da('0x29')](function(){var _0x1c5630=_0x53472a[_0x59da('0x2b')]({'plain':!![]});var _0x59ef54=_0x59da('0x2c');return db[_0x59da('0x2d')][_0x59da('0x2a')]({'where':{'type':_0x59ef54,'resourceId':_0x1c5630['id']}})[_0x59da('0x29')](function(){return _0x53472a;});})[_0x59da('0x29')](function(){_0x1ab375[_0x59da('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bb54f,_0x4ae651){return function(_0x2770e8){if(!_0x2770e8){_0x1bb54f[_0x59da('0x1c')](0x194);}return _0x2770e8;};}function handleError(_0x1d1c7b,_0x1a4ca9){_0x1a4ca9=_0x1a4ca9||0x1f4;return function(_0x3e217f){logger['error'](_0x3e217f['stack']);if(_0x3e217f[_0x59da('0x2e')]){delete _0x3e217f[_0x59da('0x2e')];}_0x1d1c7b[_0x59da('0x1d')](_0x1a4ca9)[_0x59da('0x2f')](_0x3e217f);};}exports[_0x59da('0x30')]=function(_0x307b4c,_0x12389b){var _0xc70930={},_0x33edd4={},_0x37e6b0={'count':0x0,'rows':[]};var _0x492971=_['map'](db[_0x59da('0x31')][_0x59da('0x32')],function(_0xe61c93){return{'name':_0xe61c93[_0x59da('0x33')],'type':_0xe61c93['type'][_0x59da('0x34')]};});_0x33edd4[_0x59da('0x35')]=_[_0x59da('0x36')](_0x492971,_0x59da('0x2e'));_0x33edd4[_0x59da('0x37')]=_['keys'](_0x307b4c[_0x59da('0x37')]);_0x33edd4['filters']=_['intersection'](_0x33edd4[_0x59da('0x35')],_0x33edd4[_0x59da('0x37')]);_0xc70930['attributes']=_[_0x59da('0x38')](_0x33edd4['model'],qs[_0x59da('0x39')](_0x307b4c[_0x59da('0x37')][_0x59da('0x39')]));_0xc70930['attributes']=_0xc70930[_0x59da('0x3a')][_0x59da('0x3b')]?_0xc70930['attributes']:_0x33edd4['model'];if(!_0x307b4c[_0x59da('0x37')][_0x59da('0x3c')]('nolimit')){_0xc70930[_0x59da('0x21')]=qs[_0x59da('0x21')](_0x307b4c[_0x59da('0x37')][_0x59da('0x21')]);_0xc70930['offset']=qs[_0x59da('0x20')](_0x307b4c[_0x59da('0x37')][_0x59da('0x20')]);}_0xc70930[_0x59da('0x3d')]=qs[_0x59da('0x3e')](_0x307b4c[_0x59da('0x37')][_0x59da('0x3e')]);_0xc70930['where']=qs['filters'](_[_0x59da('0x3f')](_0x307b4c['query'],_0x33edd4[_0x59da('0x40')]),_0x492971);if(_0x307b4c[_0x59da('0x37')][_0x59da('0x41')]){_0xc70930['where']=_[_0x59da('0x42')](_0xc70930[_0x59da('0x43')],{'$or':_[_0x59da('0x36')](_0x492971,function(_0x5b97be){if(_0x5b97be[_0x59da('0x44')]!==_0x59da('0x45')){var _0x3d623e={};_0x3d623e[_0x5b97be[_0x59da('0x2e')]]={'$like':'%'+_0x307b4c[_0x59da('0x37')][_0x59da('0x41')]+'%'};return _0x3d623e;}})});}_0xc70930=_[_0x59da('0x42')]({},_0xc70930,_0x307b4c[_0x59da('0x46')]);var _0x280c1f={'where':_0xc70930['where']};return db[_0x59da('0x31')]['count'](_0x280c1f)[_0x59da('0x29')](function(_0x2aedf6){_0x37e6b0[_0x59da('0x47')]=_0x2aedf6;if(_0x307b4c[_0x59da('0x37')][_0x59da('0x48')]){_0xc70930[_0x59da('0x49')]=[{'all':!![]}];}return db[_0x59da('0x31')][_0x59da('0x4a')](_0xc70930);})[_0x59da('0x29')](function(_0x3aacbd){_0x37e6b0[_0x59da('0x4b')]=_0x3aacbd;return _0x37e6b0;})['then'](respondWithFilteredResult(_0x12389b,_0xc70930))['catch'](handleError(_0x12389b,null));};exports[_0x59da('0x4c')]=function(_0x416313,_0x9b34a0){var _0x56fa75={'raw':!![],'where':{'id':_0x416313[_0x59da('0x4d')]['id']}},_0x4198d4={};_0x4198d4[_0x59da('0x35')]=_[_0x59da('0x4e')](db['OpenchannelQueue']['rawAttributes']);_0x4198d4[_0x59da('0x37')]=_[_0x59da('0x4e')](_0x416313[_0x59da('0x37')]);_0x4198d4[_0x59da('0x40')]=_[_0x59da('0x38')](_0x4198d4['model'],_0x4198d4[_0x59da('0x37')]);_0x56fa75['attributes']=_['intersection'](_0x4198d4[_0x59da('0x35')],qs[_0x59da('0x39')](_0x416313[_0x59da('0x37')]['fields']));_0x56fa75[_0x59da('0x3a')]=_0x56fa75[_0x59da('0x3a')][_0x59da('0x3b')]?_0x56fa75['attributes']:_0x4198d4[_0x59da('0x35')];if(_0x416313[_0x59da('0x37')][_0x59da('0x48')]){_0x56fa75[_0x59da('0x49')]=[{'all':!![]}];}_0x56fa75=_['merge']({},_0x56fa75,_0x416313[_0x59da('0x46')]);return db[_0x59da('0x31')]['find'](_0x56fa75)[_0x59da('0x29')](handleEntityNotFound(_0x9b34a0,null))[_0x59da('0x29')](respondWithResult(_0x9b34a0,null))[_0x59da('0x4f')](handleError(_0x9b34a0,null));};exports[_0x59da('0x50')]=function(_0x26cb6c,_0x249652){return db[_0x59da('0x31')]['create'](_0x26cb6c[_0x59da('0x51')],{})[_0x59da('0x29')](function(_0x1f9e54){var _0x48367c=_0x26cb6c[_0x59da('0x52')][_0x59da('0x2b')]({'plain':!![]});if(!_0x48367c)throw new Error(_0x59da('0x53'));if(_0x48367c[_0x59da('0x54')]===_0x59da('0x52')){var _0x23aa13=_0x1f9e54[_0x59da('0x2b')]({'plain':!![]});var _0x2c6331='OpenchannelQueues';return db['UserProfileSection'][_0x59da('0x55')]({'where':{'name':_0x2c6331,'userProfileId':_0x48367c[_0x59da('0x56')]},'raw':!![]})[_0x59da('0x29')](function(_0x2a221d){if(_0x2a221d&&_0x2a221d[_0x59da('0x57')]===0x0){return db[_0x59da('0x2d')][_0x59da('0x50')]({'name':_0x23aa13[_0x59da('0x2e')],'resourceId':_0x23aa13['id'],'type':_0x2a221d[_0x59da('0x2e')],'sectionId':_0x2a221d['id']},{})[_0x59da('0x29')](function(){return _0x1f9e54;});}else{return _0x1f9e54;}})['catch'](function(_0x52c68a){logger[_0x59da('0x58')](_0x59da('0x59'),_0x52c68a);throw _0x52c68a;});}return _0x1f9e54;})['then'](respondWithResult(_0x249652,0xc9))[_0x59da('0x4f')](handleError(_0x249652,null));};exports[_0x59da('0x28')]=function(_0x2e44b9,_0x3e08d4){if(_0x2e44b9[_0x59da('0x51')]['id']){delete _0x2e44b9['body']['id'];}return db[_0x59da('0x31')][_0x59da('0x55')]({'where':{'id':_0x2e44b9[_0x59da('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3e08d4,null))[_0x59da('0x29')](saveUpdates(_0x2e44b9['body'],null))[_0x59da('0x29')](respondWithResult(_0x3e08d4,null))[_0x59da('0x4f')](handleError(_0x3e08d4,null));};exports[_0x59da('0x2a')]=function(_0x4663fb,_0x248a0c){return db[_0x59da('0x31')]['find']({'where':{'id':_0x4663fb['params']['id']}})['then'](handleEntityNotFound(_0x248a0c,null))['then'](removeEntity(_0x248a0c,null))[_0x59da('0x4f')](handleError(_0x248a0c,null));};exports[_0x59da('0x5a')]=function(_0x4dba40,_0x41aba3){return db[_0x59da('0x31')][_0x59da('0x5a')]()[_0x59da('0x29')](respondWithResult(_0x41aba3,null))['catch'](handleError(_0x41aba3,null));};exports['getMembers']=function(_0x505515,_0x1a7704,_0x568f98){var _0x4fe8d6={'raw':!![],'where':{}},_0x33a9b7={},_0xcb7f5b;return db['OpenchannelQueue'][_0x59da('0x5b')]({'where':{'id':_0x505515['params']['id']}})[_0x59da('0x29')](handleEntityNotFound(_0x1a7704,null))[_0x59da('0x29')](function(_0x2e9921){if(_0x2e9921){_0xcb7f5b=_0x2e9921[_0x59da('0x2b')]({'plain':!![]});_0x33a9b7['model']=_['keys'](db['UserOpenchannelQueue'][_0x59da('0x32')]);_0x33a9b7[_0x59da('0x37')]=_[_0x59da('0x4e')](_0x505515['query']);_0x33a9b7[_0x59da('0x40')]=_['intersection'](_0x33a9b7[_0x59da('0x35')],_0x33a9b7[_0x59da('0x37')]);_0x4fe8d6[_0x59da('0x3a')]=_[_0x59da('0x38')](_0x33a9b7[_0x59da('0x35')],qs[_0x59da('0x39')](_0x505515[_0x59da('0x37')]['fields']));_0x4fe8d6['attributes']=_0x4fe8d6[_0x59da('0x3a')]['length']?_0x4fe8d6[_0x59da('0x3a')]:_0x33a9b7[_0x59da('0x35')];if(!_0x505515['query'][_0x59da('0x3c')]('nolimit')){_0x4fe8d6['limit']=qs[_0x59da('0x21')](_0x505515[_0x59da('0x37')][_0x59da('0x21')]);_0x4fe8d6[_0x59da('0x20')]=qs[_0x59da('0x20')](_0x505515[_0x59da('0x37')]['offset']);}_0x4fe8d6[_0x59da('0x3d')]=qs[_0x59da('0x3e')](_0x505515['query']['sort']);_0x4fe8d6[_0x59da('0x43')]=qs[_0x59da('0x40')](_['pick'](_0x505515[_0x59da('0x37')],_0x33a9b7[_0x59da('0x40')]));_0x4fe8d6['where'][_0x59da('0x5c')]=_0x2e9921['id'];if(_0x505515[_0x59da('0x37')][_0x59da('0x41')]){_0x4fe8d6[_0x59da('0x43')]=_[_0x59da('0x42')](_0x4fe8d6['where'],{'$or':_[_0x59da('0x36')](_0x4fe8d6[_0x59da('0x3a')],function(_0x360dda){var _0x159b56={};_0x159b56[_0x360dda]={'$like':'%'+_0x505515['query'][_0x59da('0x41')]+'%'};return _0x159b56;})});}_0x4fe8d6=_[_0x59da('0x42')]({},_0x4fe8d6,_0x505515[_0x59da('0x46')]);return db[_0x59da('0x5d')]['findAll'](_0x4fe8d6);}})['then'](function(_0x1cae89){if(_0x1cae89){return db[_0x59da('0x5e')][_0x59da('0x5f')]({'where':{'id':_[_0x59da('0x36')](_0x1cae89,_0x59da('0x60')),'role':_0x59da('0x61')},'attributes':['id','name',_0x59da('0x62'),_0x59da('0x63'),_0x59da('0x64')]});}})['then'](function(_0x30dcc2){if(_0x30dcc2){return{'count':_0x30dcc2['count'],'rows':_['map'](_0x30dcc2[_0x59da('0x4b')],function(_0x31ba44){return{'membername':_0x31ba44[_0x59da('0x2e')],'UserId':_0x31ba44['id'],'queue_name':_0xcb7f5b[_0x59da('0x2e')],'OpenchannelQueueId':_0xcb7f5b['id'],'interface':util['format']('%s/%s',_0x59da('0x65'),_0x31ba44['name']),'penalty':0x0,'paused':_0x31ba44[_0x59da('0x62')],'createdAt':_0x31ba44[_0x59da('0x64')],'updatedAt':_0x31ba44['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x59da('0x29')](respondWithFilteredResult(_0x1a7704,_0x4fe8d6))[_0x59da('0x4f')](handleError(_0x1a7704,null));};exports[_0x59da('0x66')]=function(_0xe86af4,_0x2c90b7,_0x5a9a2e){var _0x1c9ed4={};var _0x367c99={};var _0x16085b;var _0x48de68;return db[_0x59da('0x31')][_0x59da('0x5b')]({'where':{'id':_0xe86af4['params']['id']}})['then'](handleEntityNotFound(_0x2c90b7,null))['then'](function(_0x36544c){if(_0x36544c){_0x16085b=_0x36544c;_0x367c99['model']=_[_0x59da('0x4e')](db['Team'][_0x59da('0x32')]);_0x367c99[_0x59da('0x37')]=_[_0x59da('0x4e')](_0xe86af4['query']);_0x367c99[_0x59da('0x40')]=_[_0x59da('0x38')](_0x367c99[_0x59da('0x35')],_0x367c99['query']);_0x1c9ed4[_0x59da('0x3a')]=_[_0x59da('0x38')](_0x367c99[_0x59da('0x35')],qs[_0x59da('0x39')](_0xe86af4['query'][_0x59da('0x39')]));_0x1c9ed4[_0x59da('0x3a')]=_0x1c9ed4[_0x59da('0x3a')][_0x59da('0x3b')]?_0x1c9ed4[_0x59da('0x3a')]:_0x367c99[_0x59da('0x35')];_0x1c9ed4[_0x59da('0x3d')]=qs[_0x59da('0x3e')](_0xe86af4[_0x59da('0x37')][_0x59da('0x3e')]);_0x1c9ed4[_0x59da('0x43')]=qs[_0x59da('0x40')](_[_0x59da('0x3f')](_0xe86af4['query'],_0x367c99[_0x59da('0x40')]));if(_0xe86af4[_0x59da('0x37')][_0x59da('0x41')]){_0x1c9ed4[_0x59da('0x43')]=_['merge'](_0x1c9ed4[_0x59da('0x43')],{'$or':_['map'](_0x1c9ed4[_0x59da('0x3a')],function(_0x5d9937){var _0x263880={};_0x263880[_0x5d9937]={'$like':'%'+_0xe86af4[_0x59da('0x37')]['filter']+'%'};return _0x263880;})});}_0x1c9ed4=_['merge']({},_0x1c9ed4,_0xe86af4[_0x59da('0x46')]);return _0x16085b[_0x59da('0x66')](_0x1c9ed4);}})['then'](function(_0x42d9e3){if(_0x42d9e3){_0x48de68=_0x42d9e3[_0x59da('0x3b')];if(!_0xe86af4[_0x59da('0x37')]['hasOwnProperty']('nolimit')){_0x1c9ed4['limit']=qs['limit'](_0xe86af4[_0x59da('0x37')][_0x59da('0x21')]);_0x1c9ed4[_0x59da('0x20')]=qs[_0x59da('0x20')](_0xe86af4[_0x59da('0x37')][_0x59da('0x20')]);}return _0x16085b['getTeams'](_0x1c9ed4);}})[_0x59da('0x29')](function(_0x19da39){if(_0x19da39){return _0x19da39?{'count':_0x48de68,'rows':_0x19da39}:null;}})[_0x59da('0x29')](respondWithResult(_0x2c90b7,null))[_0x59da('0x4f')](handleError(_0x2c90b7,null));};exports[_0x59da('0x67')]=function(_0x5a28fe,_0xa1de3c,_0x2f5840){var _0x30fd08=_0x5a28fe[_0x59da('0x51')][_0x59da('0x68')];return db[_0x59da('0x69')][_0x59da('0x4a')]({'where':{'id':_0x30fd08},'attributes':['id'],'include':[{'model':db[_0x59da('0x5e')],'as':_0x59da('0x6a'),'attributes':['id','name',_0x59da('0x6b'),_0x59da('0x6c'),_0x59da('0x6d')],'raw':!![]}]})['then'](function(_0x144002){if(_0x144002){var _0x48014d=_[_0x59da('0x6e')](_0x144002,function(_0x22897b){var _0x5bca04=_0x22897b[_0x59da('0x2b')]({'plain':!![]});return _0x5bca04[_0x59da('0x6a')];});return db[_0x59da('0x31')][_0x59da('0x55')]({'where':{'id':_0x5a28fe[_0x59da('0x4d')]['id']}})['then'](function(_0x3a629d){return db[_0x59da('0x6f')][_0x59da('0x70')](function(_0x57a671){return _0x3a629d[_0x59da('0x67')](_0x30fd08,{'transaction':_0x57a671})[_0x59da('0x29')](function(){return BPromise[_0x59da('0x71')](_0x48014d,function(_0x3b616c){return db[_0x59da('0x5d')][_0x59da('0x72')]({'where':{'UserId':_0x3b616c['id'],'OpenchannelQueueId':_0x5a28fe[_0x59da('0x4d')]['id']},'transaction':_0x57a671});});})[_0x59da('0x29')](function(){_0x48014d[_0x59da('0x73')](function(_0x5ae207){socket[_0x59da('0x74')](_0x59da('0x75'),{'UserId':_0x5ae207['id'],'OpenchannelQueueId':_0x3a629d['id']});});});});});}})[_0x59da('0x29')](respondWithStatusCode(_0xa1de3c,null))[_0x59da('0x4f')](handleError(_0xa1de3c,null));};exports[_0x59da('0x76')]=function(_0x3a2cf5,_0x1c6092,_0x37e7cb){return db[_0x59da('0x69')][_0x59da('0x4a')]({'where':{'id':_0x3a2cf5[_0x59da('0x37')][_0x59da('0x68')]},'attributes':['id'],'include':[{'model':db[_0x59da('0x5e')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1c6092,null))[_0x59da('0x29')](function(_0x323848){var _0x24386c=_[_0x59da('0x36')](_0x323848,'id');var _0x23edb2=[];var _0x90e282=[];var _0x25ba7d=squel[_0x59da('0x77')]();_0x25ba7d[_0x59da('0x78')](_0x59da('0x79'))[_0x59da('0x7a')]('team_has_openchannel_queues','tq')[_0x59da('0x7b')](_0x59da('0x7c'),'ut',_0x59da('0x7d'))[_0x59da('0x43')](_0x59da('0x7e'),_0x3a2cf5[_0x59da('0x4d')]['id']);for(var _0x38ea67=0x0;_0x38ea67<_0x323848['length'];_0x38ea67+=0x1){let _0xd980a3=_0x323848[_0x38ea67];for(var _0xe8ee0=0x0;_0xe8ee0<_0xd980a3['Agents'][_0x59da('0x3b')];_0xe8ee0+=0x1){let _0x5a3e06=_0xd980a3[_0x59da('0x6a')][_0xe8ee0];var _0x338546=_0x25ba7d[_0x59da('0x7f')]();_0x338546[_0x59da('0x43')](_0x59da('0x80'),_0x5a3e06['id']);_0x90e282['push'](db[_0x59da('0x6f')][_0x59da('0x37')](_0x338546[_0x59da('0x81')](),{'type':db[_0x59da('0x6f')][_0x59da('0x82')][_0x59da('0x83')]})['then'](function(_0x2f18d2){if(_0x2f18d2['length']===0x1){return _0x5a3e06['id'];}else{var _0x5e2c2c=_[_0x59da('0x84')](_['map'](_0x2f18d2,'TeamId'),function(_0xdc7800){return _[_0x59da('0x85')](_0x24386c,_0xdc7800);});if(_0x5e2c2c){return _0x5a3e06['id'];}}}));}}return BPromise[_0x59da('0x86')](_0x90e282)['then'](function(_0x4f5612){_0x23edb2=_(_0x23edb2)[_0x59da('0x87')](_0x4f5612)[_0x59da('0x88')]()[_0x59da('0x89')]();return db[_0x59da('0x31')][_0x59da('0x55')]({'where':{'id':_0x3a2cf5['params']['id']}})[_0x59da('0x29')](function(_0x5df381){return db['sequelize'][_0x59da('0x70')](function(_0x18c429){return _0x5df381[_0x59da('0x76')](_0x3a2cf5[_0x59da('0x37')][_0x59da('0x68')],{'transaction':_0x18c429})[_0x59da('0x29')](function(){if(!_[_0x59da('0x8a')](_0x23edb2)){return _0x5df381[_0x59da('0x8b')](_0x23edb2,{'transaction':_0x18c429});}})[_0x59da('0x29')](function(){_0x23edb2[_0x59da('0x73')](function(_0x32640b){socket[_0x59da('0x74')](_0x59da('0x8c'),{'UserId':_0x32640b,'OpenchannelQueueId':_0x5df381['id']});});});});});});})['then'](respondWithStatusCode(_0x1c6092,null))[_0x59da('0x4f')](handleError(_0x1c6092,null));};exports[_0x59da('0x8d')]=function(_0x2a82f4,_0x11b9b5,_0x18724a){return db[_0x59da('0x31')][_0x59da('0x55')]({'where':{'id':_0x2a82f4['params']['id']}})[_0x59da('0x29')](handleEntityNotFound(_0x11b9b5,null))[_0x59da('0x29')](function(_0x5a0b61){if(_0x5a0b61){return _0x5a0b61['addAgents'](_0x2a82f4[_0x59da('0x51')][_0x59da('0x68')],_['omit'](_0x2a82f4[_0x59da('0x51')],[_0x59da('0x68'),'id'])||{})[_0x59da('0x8e')](function(_0x1537f0){for(var _0x2a19fc=0x0;_0x2a19fc<_0x2a82f4[_0x59da('0x51')][_0x59da('0x68')]['length'];_0x2a19fc+=0x1){socket[_0x59da('0x74')](_0x59da('0x75'),{'UserId':Number(_0x2a82f4['body']['ids'][_0x2a19fc]),'OpenchannelQueueId':Number(_0x2a82f4[_0x59da('0x4d')]['id'])});}return _0x1537f0;});}})[_0x59da('0x29')](respondWithResult(_0x11b9b5,null))[_0x59da('0x4f')](handleError(_0x11b9b5,null));};exports[_0x59da('0x8b')]=function(_0x5885f5,_0x4235fb,_0x32ab1d){return db['OpenchannelQueue'][_0x59da('0x55')]({'where':{'id':_0x5885f5[_0x59da('0x4d')]['id']}})[_0x59da('0x29')](handleEntityNotFound(_0x4235fb,null))[_0x59da('0x29')](function(_0x7cfb05){if(_0x7cfb05){return _0x7cfb05[_0x59da('0x8b')](_0x5885f5[_0x59da('0x37')]['ids'])[_0x59da('0x29')](function(){if(_[_0x59da('0x8f')](_0x5885f5[_0x59da('0x37')]['ids'])){for(var _0x2f981f=0x0;_0x2f981f<_0x5885f5[_0x59da('0x37')][_0x59da('0x68')][_0x59da('0x3b')];_0x2f981f+=0x1){socket['emit'](_0x59da('0x8c'),{'UserId':Number(_0x5885f5[_0x59da('0x37')][_0x59da('0x68')][_0x2f981f]),'OpenchannelQueueId':Number(_0x5885f5['params']['id'])});}}else{socket['emit'](_0x59da('0x8c'),{'UserId':Number(_0x5885f5[_0x59da('0x37')][_0x59da('0x68')]),'OpenchannelQueueId':Number(_0x5885f5['params']['id'])});}});}})[_0x59da('0x29')](respondWithStatusCode(_0x4235fb,null))[_0x59da('0x4f')](handleError(_0x4235fb,null));};exports[_0x59da('0x90')]=function(_0x4b1b41,_0x4b64b4,_0x253274){var _0x737c4={};var _0x5d6e6b={};var _0x305a6f;var _0x1bc389;return db[_0x59da('0x31')][_0x59da('0x5b')]({'where':{'id':_0x4b1b41[_0x59da('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4b64b4,null))[_0x59da('0x29')](function(_0xf1759e){if(_0xf1759e){_0x305a6f=_0xf1759e;_0x5d6e6b[_0x59da('0x35')]=_['keys'](db[_0x59da('0x5e')]['rawAttributes']);_0x5d6e6b[_0x59da('0x37')]=_[_0x59da('0x4e')](_0x4b1b41[_0x59da('0x37')]);_0x5d6e6b[_0x59da('0x40')]=_[_0x59da('0x38')](_0x5d6e6b[_0x59da('0x35')],_0x5d6e6b[_0x59da('0x37')]);_0x737c4['attributes']=_[_0x59da('0x38')](_0x5d6e6b[_0x59da('0x35')],qs['fields'](_0x4b1b41[_0x59da('0x37')][_0x59da('0x39')]));_0x737c4[_0x59da('0x3a')]=_0x737c4[_0x59da('0x3a')][_0x59da('0x3b')]?_0x737c4[_0x59da('0x3a')]:_0x5d6e6b[_0x59da('0x35')];_0x737c4[_0x59da('0x3d')]=qs[_0x59da('0x3e')](_0x4b1b41[_0x59da('0x37')]['sort']);_0x737c4[_0x59da('0x43')]=qs[_0x59da('0x40')](_[_0x59da('0x3f')](_0x4b1b41[_0x59da('0x37')],_0x5d6e6b[_0x59da('0x40')]));if(_0x4b1b41[_0x59da('0x37')]['filter']){_0x737c4[_0x59da('0x43')]=_[_0x59da('0x42')](_0x737c4[_0x59da('0x43')],{'$or':_[_0x59da('0x36')](_0x737c4['attributes'],function(_0x1b9fca){var _0x294f19={};_0x294f19[_0x1b9fca]={'$like':'%'+_0x4b1b41[_0x59da('0x37')][_0x59da('0x41')]+'%'};return _0x294f19;})});}_0x737c4=_['merge']({},_0x737c4,_0x4b1b41[_0x59da('0x46')]);return _0x305a6f[_0x59da('0x90')](_0x737c4);}})[_0x59da('0x29')](function(_0x81dc32){if(_0x81dc32){_0x1bc389=_0x81dc32[_0x59da('0x3b')];if(!_0x4b1b41[_0x59da('0x37')][_0x59da('0x3c')](_0x59da('0x91'))){_0x737c4[_0x59da('0x21')]=qs[_0x59da('0x21')](_0x4b1b41['query'][_0x59da('0x21')]);_0x737c4[_0x59da('0x20')]=qs[_0x59da('0x20')](_0x4b1b41[_0x59da('0x37')][_0x59da('0x20')]);}return _0x305a6f[_0x59da('0x90')](_0x737c4);}})[_0x59da('0x29')](function(_0x18f74c){if(_0x18f74c){return _0x18f74c?{'count':_0x1bc389,'rows':_0x18f74c}:null;}})[_0x59da('0x29')](respondWithResult(_0x4b64b4,null))[_0x59da('0x4f')](handleError(_0x4b64b4,null));}; \ No newline at end of file +var _0x0d76=['role','OpenchannelQueues','find','create','body','describe','findOne','UserOpenchannelQueue','hasOwnProperty','sort','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','getTeams','addTeams','Team','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','removeTeams','ids','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','compact','isEmpty','removeAgents','emit','userOpenchannelQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','defaults','redis','localhost','register','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','index','OpenchannelQueue','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x104def,_0xdb8a19){var _0x2e0f01=function(_0x370975){while(--_0x370975){_0x104def['push'](_0x104def['shift']());}};_0x2e0f01(++_0xdb8a19);}(_0x0d76,0xc9));var _0x60d7=function(_0x26bdbb,_0x4d4785){_0x26bdbb=_0x26bdbb-0x0;var _0x58a564=_0x0d76[_0x26bdbb];return _0x58a564;};'use strict';var emlformat=require(_0x60d7('0x0'));var rimraf=require(_0x60d7('0x1'));var zipdir=require(_0x60d7('0x2'));var jsonpatch=require(_0x60d7('0x3'));var rp=require(_0x60d7('0x4'));var moment=require(_0x60d7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x60d7('0x6'));var util=require(_0x60d7('0x7'));var path=require(_0x60d7('0x8'));var sox=require(_0x60d7('0x9'));var csv=require(_0x60d7('0xa'));var ejs=require(_0x60d7('0xb'));var fs=require('fs');var fs_extra=require(_0x60d7('0xc'));var _=require(_0x60d7('0xd'));var squel=require(_0x60d7('0xe'));var crypto=require(_0x60d7('0xf'));var jsforce=require(_0x60d7('0x10'));var deskjs=require(_0x60d7('0x11'));var toCsv=require('to-csv');var querystring=require(_0x60d7('0x12'));var Papa=require('papaparse');var Redis=require(_0x60d7('0x13'));var authService=require(_0x60d7('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x60d7('0x15'));var hardwareService=require(_0x60d7('0x16'));var logger=require(_0x60d7('0x17'))(_0x60d7('0x18'));var utils=require(_0x60d7('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x60d7('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x60d7('0x1b')](config[_0x60d7('0x1c')],{'host':_0x60d7('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelQueue.socket')[_0x60d7('0x1e')](socket);function respondWithStatusCode(_0x5343cc,_0x50670a){_0x50670a=_0x50670a||0xcc;return function(_0x3d49b5){if(_0x3d49b5){return _0x5343cc[_0x60d7('0x1f')](_0x50670a);}return _0x5343cc['status'](_0x50670a)['end']();};}function respondWithResult(_0x3989b9,_0x54d7e8){_0x54d7e8=_0x54d7e8||0xc8;return function(_0x14a5c2){if(_0x14a5c2){return _0x3989b9[_0x60d7('0x20')](_0x54d7e8)[_0x60d7('0x21')](_0x14a5c2);}};}function respondWithFilteredResult(_0x347042,_0x2e01d9){return function(_0x1abe4b){if(_0x1abe4b){var _0x179cd1=typeof _0x2e01d9[_0x60d7('0x22')]==='undefined'&&typeof _0x2e01d9[_0x60d7('0x23')]==='undefined';var _0x182cc0=_0x1abe4b[_0x60d7('0x24')];var _0x12908b=_0x179cd1?0x0:_0x2e01d9['offset'];var _0x2e5245=_0x179cd1?_0x1abe4b[_0x60d7('0x24')]:_0x2e01d9['offset']+_0x2e01d9['limit'];var _0x262fec;if(_0x2e5245>=_0x182cc0){_0x2e5245=_0x182cc0;_0x262fec=0xc8;}else{_0x262fec=0xce;}_0x347042[_0x60d7('0x20')](_0x262fec);return _0x347042[_0x60d7('0x25')](_0x60d7('0x26'),_0x12908b+'-'+_0x2e5245+'/'+_0x182cc0)[_0x60d7('0x21')](_0x1abe4b);}return null;};}function patchUpdates(_0x11430c){return function(_0x2553e8){try{jsonpatch[_0x60d7('0x27')](_0x2553e8,_0x11430c,!![]);}catch(_0x5a0601){return BPromise[_0x60d7('0x28')](_0x5a0601);}return _0x2553e8[_0x60d7('0x29')]();};}function saveUpdates(_0x340c03,_0x49ec1f){return function(_0xe9c8da){if(_0xe9c8da){return _0xe9c8da['update'](_0x340c03)[_0x60d7('0x2a')](function(_0x4ec895){return _0x4ec895;});}return null;};}function removeEntity(_0x261755,_0x115a50){return function(_0x291a58){if(_0x291a58){return _0x291a58[_0x60d7('0x2b')]()[_0x60d7('0x2a')](function(){var _0x1c3c2a=_0x291a58[_0x60d7('0x2c')]({'plain':!![]});var _0xb34c5d='OpenchannelQueues';return db[_0x60d7('0x2d')][_0x60d7('0x2b')]({'where':{'type':_0xb34c5d,'resourceId':_0x1c3c2a['id']}})['then'](function(){return _0x291a58;});})[_0x60d7('0x2a')](function(){_0x261755[_0x60d7('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd5cd47,_0x3afe59){return function(_0x262b7d){if(!_0x262b7d){_0xd5cd47[_0x60d7('0x1f')](0x194);}return _0x262b7d;};}function handleError(_0x488cb4,_0x3ffdf7){_0x3ffdf7=_0x3ffdf7||0x1f4;return function(_0x57ea6a){logger[_0x60d7('0x2e')](_0x57ea6a[_0x60d7('0x2f')]);if(_0x57ea6a[_0x60d7('0x30')]){delete _0x57ea6a[_0x60d7('0x30')];}_0x488cb4[_0x60d7('0x20')](_0x3ffdf7)[_0x60d7('0x31')](_0x57ea6a);};}exports[_0x60d7('0x32')]=function(_0x360966,_0x12e4f4){var _0x1a22d7={},_0x3477a7={},_0x55a1b0={'count':0x0,'rows':[]};var _0x2edace=_['map'](db[_0x60d7('0x33')]['rawAttributes'],function(_0xe79943){return{'name':_0xe79943['fieldName'],'type':_0xe79943[_0x60d7('0x34')][_0x60d7('0x35')]};});_0x3477a7[_0x60d7('0x36')]=_[_0x60d7('0x37')](_0x2edace,_0x60d7('0x30'));_0x3477a7[_0x60d7('0x38')]=_['keys'](_0x360966['query']);_0x3477a7[_0x60d7('0x39')]=_[_0x60d7('0x3a')](_0x3477a7[_0x60d7('0x36')],_0x3477a7[_0x60d7('0x38')]);_0x1a22d7[_0x60d7('0x3b')]=_[_0x60d7('0x3a')](_0x3477a7[_0x60d7('0x36')],qs[_0x60d7('0x3c')](_0x360966[_0x60d7('0x38')][_0x60d7('0x3c')]));_0x1a22d7['attributes']=_0x1a22d7[_0x60d7('0x3b')][_0x60d7('0x3d')]?_0x1a22d7[_0x60d7('0x3b')]:_0x3477a7[_0x60d7('0x36')];if(!_0x360966[_0x60d7('0x38')]['hasOwnProperty'](_0x60d7('0x3e'))){_0x1a22d7[_0x60d7('0x23')]=qs[_0x60d7('0x23')](_0x360966['query']['limit']);_0x1a22d7[_0x60d7('0x22')]=qs[_0x60d7('0x22')](_0x360966['query'][_0x60d7('0x22')]);}_0x1a22d7[_0x60d7('0x3f')]=qs['sort'](_0x360966['query']['sort']);_0x1a22d7[_0x60d7('0x40')]=qs[_0x60d7('0x39')](_[_0x60d7('0x41')](_0x360966[_0x60d7('0x38')],_0x3477a7[_0x60d7('0x39')]),_0x2edace);if(_0x360966['query'][_0x60d7('0x42')]){_0x1a22d7[_0x60d7('0x40')]=_['merge'](_0x1a22d7['where'],{'$or':_[_0x60d7('0x37')](_0x2edace,function(_0x33c1fe){if(_0x33c1fe[_0x60d7('0x34')]!=='VIRTUAL'){var _0x31398e={};_0x31398e[_0x33c1fe[_0x60d7('0x30')]]={'$like':'%'+_0x360966['query'][_0x60d7('0x42')]+'%'};return _0x31398e;}})});}_0x1a22d7=_[_0x60d7('0x43')]({},_0x1a22d7,_0x360966[_0x60d7('0x44')]);var _0x332916={'where':_0x1a22d7[_0x60d7('0x40')]};return db[_0x60d7('0x33')][_0x60d7('0x24')](_0x332916)[_0x60d7('0x2a')](function(_0x28d7cb){_0x55a1b0[_0x60d7('0x24')]=_0x28d7cb;if(_0x360966[_0x60d7('0x38')][_0x60d7('0x45')]){_0x1a22d7[_0x60d7('0x46')]=[{'all':!![]}];}return db[_0x60d7('0x33')][_0x60d7('0x47')](_0x1a22d7);})[_0x60d7('0x2a')](function(_0x5884a6){_0x55a1b0[_0x60d7('0x48')]=_0x5884a6;return _0x55a1b0;})[_0x60d7('0x2a')](respondWithFilteredResult(_0x12e4f4,_0x1a22d7))[_0x60d7('0x49')](handleError(_0x12e4f4,null));};exports['show']=function(_0x438c3d,_0x590e2f){var _0x493dfd={'raw':!![],'where':{'id':_0x438c3d[_0x60d7('0x4a')]['id']}},_0x3bc3e1={};_0x3bc3e1[_0x60d7('0x36')]=_[_0x60d7('0x4b')](db[_0x60d7('0x33')][_0x60d7('0x4c')]);_0x3bc3e1[_0x60d7('0x38')]=_[_0x60d7('0x4b')](_0x438c3d[_0x60d7('0x38')]);_0x3bc3e1[_0x60d7('0x39')]=_[_0x60d7('0x3a')](_0x3bc3e1['model'],_0x3bc3e1[_0x60d7('0x38')]);_0x493dfd[_0x60d7('0x3b')]=_[_0x60d7('0x3a')](_0x3bc3e1['model'],qs['fields'](_0x438c3d[_0x60d7('0x38')][_0x60d7('0x3c')]));_0x493dfd[_0x60d7('0x3b')]=_0x493dfd[_0x60d7('0x3b')]['length']?_0x493dfd[_0x60d7('0x3b')]:_0x3bc3e1[_0x60d7('0x36')];if(_0x438c3d['query'][_0x60d7('0x45')]){_0x493dfd[_0x60d7('0x46')]=[{'all':!![]}];}_0x493dfd=_[_0x60d7('0x43')]({},_0x493dfd,_0x438c3d['options']);return db['OpenchannelQueue']['find'](_0x493dfd)[_0x60d7('0x2a')](handleEntityNotFound(_0x590e2f,null))['then'](respondWithResult(_0x590e2f,null))[_0x60d7('0x49')](handleError(_0x590e2f,null));};exports['create']=function(_0x515ee7,_0x3efa08){return db[_0x60d7('0x33')]['create'](_0x515ee7['body'],{})['then'](function(_0x395f96){var _0x587f87=_0x515ee7[_0x60d7('0x4d')][_0x60d7('0x2c')]({'plain':!![]});if(!_0x587f87)throw new Error(_0x60d7('0x4e'));if(_0x587f87[_0x60d7('0x4f')]===_0x60d7('0x4d')){var _0x3375de=_0x395f96[_0x60d7('0x2c')]({'plain':!![]});var _0x3bd8bb=_0x60d7('0x50');return db['UserProfileSection'][_0x60d7('0x51')]({'where':{'name':_0x3bd8bb,'userProfileId':_0x587f87['userProfileId']},'raw':!![]})[_0x60d7('0x2a')](function(_0x529adc){if(_0x529adc&&_0x529adc['autoAssociation']===0x0){return db[_0x60d7('0x2d')][_0x60d7('0x52')]({'name':_0x3375de[_0x60d7('0x30')],'resourceId':_0x3375de['id'],'type':_0x529adc[_0x60d7('0x30')],'sectionId':_0x529adc['id']},{})[_0x60d7('0x2a')](function(){return _0x395f96;});}else{return _0x395f96;}})['catch'](function(_0x472e5e){logger[_0x60d7('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x472e5e);throw _0x472e5e;});}return _0x395f96;})[_0x60d7('0x2a')](respondWithResult(_0x3efa08,0xc9))[_0x60d7('0x49')](handleError(_0x3efa08,null));};exports['update']=function(_0x5a39e7,_0x50d58a){if(_0x5a39e7[_0x60d7('0x53')]['id']){delete _0x5a39e7['body']['id'];}return db[_0x60d7('0x33')][_0x60d7('0x51')]({'where':{'id':_0x5a39e7['params']['id']}})[_0x60d7('0x2a')](handleEntityNotFound(_0x50d58a,null))['then'](saveUpdates(_0x5a39e7[_0x60d7('0x53')],null))[_0x60d7('0x2a')](respondWithResult(_0x50d58a,null))[_0x60d7('0x49')](handleError(_0x50d58a,null));};exports[_0x60d7('0x2b')]=function(_0x101c5d,_0x2d474d){return db['OpenchannelQueue'][_0x60d7('0x51')]({'where':{'id':_0x101c5d['params']['id']}})[_0x60d7('0x2a')](handleEntityNotFound(_0x2d474d,null))[_0x60d7('0x2a')](removeEntity(_0x2d474d,null))[_0x60d7('0x49')](handleError(_0x2d474d,null));};exports['describe']=function(_0xfb0f37,_0xee0ce2){return db[_0x60d7('0x33')][_0x60d7('0x54')]()[_0x60d7('0x2a')](respondWithResult(_0xee0ce2,null))[_0x60d7('0x49')](handleError(_0xee0ce2,null));};exports['getMembers']=function(_0xd4c9d4,_0xc66cd7,_0x39a213){var _0x494b37={'raw':!![],'where':{}},_0x19cf51={},_0x48adfe;return db[_0x60d7('0x33')][_0x60d7('0x55')]({'where':{'id':_0xd4c9d4[_0x60d7('0x4a')]['id']}})[_0x60d7('0x2a')](handleEntityNotFound(_0xc66cd7,null))[_0x60d7('0x2a')](function(_0x250258){if(_0x250258){_0x48adfe=_0x250258[_0x60d7('0x2c')]({'plain':!![]});_0x19cf51['model']=_[_0x60d7('0x4b')](db[_0x60d7('0x56')]['rawAttributes']);_0x19cf51['query']=_[_0x60d7('0x4b')](_0xd4c9d4[_0x60d7('0x38')]);_0x19cf51['filters']=_[_0x60d7('0x3a')](_0x19cf51['model'],_0x19cf51['query']);_0x494b37['attributes']=_[_0x60d7('0x3a')](_0x19cf51['model'],qs[_0x60d7('0x3c')](_0xd4c9d4[_0x60d7('0x38')][_0x60d7('0x3c')]));_0x494b37['attributes']=_0x494b37[_0x60d7('0x3b')][_0x60d7('0x3d')]?_0x494b37[_0x60d7('0x3b')]:_0x19cf51[_0x60d7('0x36')];if(!_0xd4c9d4[_0x60d7('0x38')][_0x60d7('0x57')](_0x60d7('0x3e'))){_0x494b37[_0x60d7('0x23')]=qs[_0x60d7('0x23')](_0xd4c9d4[_0x60d7('0x38')][_0x60d7('0x23')]);_0x494b37[_0x60d7('0x22')]=qs['offset'](_0xd4c9d4['query'][_0x60d7('0x22')]);}_0x494b37[_0x60d7('0x3f')]=qs[_0x60d7('0x58')](_0xd4c9d4[_0x60d7('0x38')][_0x60d7('0x58')]);_0x494b37[_0x60d7('0x40')]=qs[_0x60d7('0x39')](_[_0x60d7('0x41')](_0xd4c9d4['query'],_0x19cf51[_0x60d7('0x39')]));_0x494b37[_0x60d7('0x40')][_0x60d7('0x59')]=_0x250258['id'];if(_0xd4c9d4['query'][_0x60d7('0x42')]){_0x494b37['where']=_[_0x60d7('0x43')](_0x494b37[_0x60d7('0x40')],{'$or':_['map'](_0x494b37[_0x60d7('0x3b')],function(_0x49cb53){var _0x32214e={};_0x32214e[_0x49cb53]={'$like':'%'+_0xd4c9d4['query'][_0x60d7('0x42')]+'%'};return _0x32214e;})});}_0x494b37=_[_0x60d7('0x43')]({},_0x494b37,_0xd4c9d4[_0x60d7('0x44')]);return db[_0x60d7('0x56')][_0x60d7('0x47')](_0x494b37);}})[_0x60d7('0x2a')](function(_0x327663){if(_0x327663){return db[_0x60d7('0x5a')][_0x60d7('0x5b')]({'where':{'id':_['map'](_0x327663,_0x60d7('0x5c')),'role':_0x60d7('0x5d')},'attributes':['id','name',_0x60d7('0x5e'),_0x60d7('0x5f'),_0x60d7('0x60')]});}})[_0x60d7('0x2a')](function(_0x19ea27){if(_0x19ea27){return{'count':_0x19ea27[_0x60d7('0x24')],'rows':_[_0x60d7('0x37')](_0x19ea27[_0x60d7('0x48')],function(_0x18d0ad){return{'membername':_0x18d0ad['name'],'UserId':_0x18d0ad['id'],'queue_name':_0x48adfe['name'],'OpenchannelQueueId':_0x48adfe['id'],'interface':util[_0x60d7('0x61')](_0x60d7('0x62'),'SIP',_0x18d0ad[_0x60d7('0x30')]),'penalty':0x0,'paused':_0x18d0ad[_0x60d7('0x5e')],'createdAt':_0x18d0ad[_0x60d7('0x60')],'updatedAt':_0x18d0ad[_0x60d7('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xc66cd7,_0x494b37))[_0x60d7('0x49')](handleError(_0xc66cd7,null));};exports[_0x60d7('0x63')]=function(_0x19a0a9,_0x5ed7cb,_0x3034fd){var _0x293b7a={};var _0x57e32d={};var _0x45a2a1;var _0x35c1c8;return db[_0x60d7('0x33')][_0x60d7('0x55')]({'where':{'id':_0x19a0a9['params']['id']}})[_0x60d7('0x2a')](handleEntityNotFound(_0x5ed7cb,null))[_0x60d7('0x2a')](function(_0x5c7540){if(_0x5c7540){_0x45a2a1=_0x5c7540;_0x57e32d['model']=_[_0x60d7('0x4b')](db['Team']['rawAttributes']);_0x57e32d[_0x60d7('0x38')]=_[_0x60d7('0x4b')](_0x19a0a9[_0x60d7('0x38')]);_0x57e32d[_0x60d7('0x39')]=_['intersection'](_0x57e32d[_0x60d7('0x36')],_0x57e32d[_0x60d7('0x38')]);_0x293b7a['attributes']=_[_0x60d7('0x3a')](_0x57e32d[_0x60d7('0x36')],qs[_0x60d7('0x3c')](_0x19a0a9['query'][_0x60d7('0x3c')]));_0x293b7a[_0x60d7('0x3b')]=_0x293b7a[_0x60d7('0x3b')][_0x60d7('0x3d')]?_0x293b7a[_0x60d7('0x3b')]:_0x57e32d['model'];_0x293b7a[_0x60d7('0x3f')]=qs[_0x60d7('0x58')](_0x19a0a9[_0x60d7('0x38')][_0x60d7('0x58')]);_0x293b7a[_0x60d7('0x40')]=qs[_0x60d7('0x39')](_['pick'](_0x19a0a9[_0x60d7('0x38')],_0x57e32d[_0x60d7('0x39')]));if(_0x19a0a9['query'][_0x60d7('0x42')]){_0x293b7a[_0x60d7('0x40')]=_[_0x60d7('0x43')](_0x293b7a[_0x60d7('0x40')],{'$or':_[_0x60d7('0x37')](_0x293b7a['attributes'],function(_0xd0ed53){var _0xee2691={};_0xee2691[_0xd0ed53]={'$like':'%'+_0x19a0a9[_0x60d7('0x38')][_0x60d7('0x42')]+'%'};return _0xee2691;})});}_0x293b7a=_[_0x60d7('0x43')]({},_0x293b7a,_0x19a0a9[_0x60d7('0x44')]);return _0x45a2a1['getTeams'](_0x293b7a);}})[_0x60d7('0x2a')](function(_0x687b94){if(_0x687b94){_0x35c1c8=_0x687b94['length'];if(!_0x19a0a9[_0x60d7('0x38')][_0x60d7('0x57')]('nolimit')){_0x293b7a[_0x60d7('0x23')]=qs[_0x60d7('0x23')](_0x19a0a9[_0x60d7('0x38')][_0x60d7('0x23')]);_0x293b7a['offset']=qs[_0x60d7('0x22')](_0x19a0a9['query'][_0x60d7('0x22')]);}return _0x45a2a1[_0x60d7('0x63')](_0x293b7a);}})[_0x60d7('0x2a')](function(_0x112af8){if(_0x112af8){return _0x112af8?{'count':_0x35c1c8,'rows':_0x112af8}:null;}})[_0x60d7('0x2a')](respondWithResult(_0x5ed7cb,null))[_0x60d7('0x49')](handleError(_0x5ed7cb,null));};exports[_0x60d7('0x64')]=function(_0x35aa45,_0xfa6972,_0x3a2b28){var _0x2845a2=_0x35aa45[_0x60d7('0x53')]['ids'];return db[_0x60d7('0x65')][_0x60d7('0x47')]({'where':{'id':_0x2845a2},'attributes':['id'],'include':[{'model':db[_0x60d7('0x5a')],'as':'Agents','attributes':['id','name',_0x60d7('0x66'),_0x60d7('0x67'),_0x60d7('0x68')],'raw':!![]}]})[_0x60d7('0x2a')](function(_0x4d29c1){if(_0x4d29c1){var _0x170437=_[_0x60d7('0x69')](_0x4d29c1,function(_0x3cc60c){var _0x1cf84f=_0x3cc60c['get']({'plain':!![]});return _0x1cf84f[_0x60d7('0x6a')];});return db[_0x60d7('0x33')][_0x60d7('0x51')]({'where':{'id':_0x35aa45[_0x60d7('0x4a')]['id']}})['then'](function(_0x238d86){return db[_0x60d7('0x6b')][_0x60d7('0x6c')](function(_0x208a59){return _0x238d86[_0x60d7('0x64')](_0x2845a2,{'transaction':_0x208a59})[_0x60d7('0x2a')](function(){return BPromise[_0x60d7('0x6d')](_0x170437,function(_0x557245){return db['UserOpenchannelQueue'][_0x60d7('0x6e')]({'where':{'UserId':_0x557245['id'],'OpenchannelQueueId':_0x35aa45[_0x60d7('0x4a')]['id']},'transaction':_0x208a59});});})[_0x60d7('0x2a')](function(){_0x170437[_0x60d7('0x6f')](function(_0x142541){socket['emit']('userOpenchannelQueue:save',{'UserId':_0x142541['id'],'OpenchannelQueueId':_0x238d86['id']});});});});});}})['then'](respondWithStatusCode(_0xfa6972,null))[_0x60d7('0x49')](handleError(_0xfa6972,null));};exports[_0x60d7('0x70')]=function(_0x5c5dc8,_0x3dd32f,_0x511cae){return db[_0x60d7('0x65')][_0x60d7('0x47')]({'where':{'id':_0x5c5dc8[_0x60d7('0x38')][_0x60d7('0x71')]},'attributes':['id'],'include':[{'model':db[_0x60d7('0x5a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x60d7('0x2a')](handleEntityNotFound(_0x3dd32f,null))['then'](function(_0x364d95){var _0x357fee=_['map'](_0x364d95,'id');var _0x378a03=[];var _0x42b7a0=[];var _0x102188=squel[_0x60d7('0x72')]();_0x102188[_0x60d7('0x73')](_0x60d7('0x74'))[_0x60d7('0x75')](_0x60d7('0x76'),'tq')[_0x60d7('0x77')](_0x60d7('0x78'),'ut',_0x60d7('0x79'))[_0x60d7('0x40')](_0x60d7('0x7a'),_0x5c5dc8[_0x60d7('0x4a')]['id']);for(var _0x1227fd=0x0;_0x1227fd<_0x364d95[_0x60d7('0x3d')];_0x1227fd+=0x1){let _0x28fed2=_0x364d95[_0x1227fd];for(var _0x1b12ae=0x0;_0x1b12ae<_0x28fed2[_0x60d7('0x6a')][_0x60d7('0x3d')];_0x1b12ae+=0x1){let _0x59a874=_0x28fed2['Agents'][_0x1b12ae];var _0x18a68e=_0x102188['clone']();_0x18a68e[_0x60d7('0x40')](_0x60d7('0x7b'),_0x59a874['id']);_0x42b7a0[_0x60d7('0x7c')](db[_0x60d7('0x6b')][_0x60d7('0x38')](_0x18a68e[_0x60d7('0x7d')](),{'type':db['sequelize'][_0x60d7('0x7e')][_0x60d7('0x7f')]})['then'](function(_0x279600){if(_0x279600['length']===0x1){return _0x59a874['id'];}else{var _0x64ba46=_['every'](_[_0x60d7('0x37')](_0x279600,_0x60d7('0x80')),function(_0x4764e9){return _[_0x60d7('0x81')](_0x357fee,_0x4764e9);});if(_0x64ba46){return _0x59a874['id'];}}}));}}return BPromise[_0x60d7('0x82')](_0x42b7a0)[_0x60d7('0x2a')](function(_0x30b0d7){_0x378a03=_(_0x378a03)['union'](_0x30b0d7)[_0x60d7('0x83')]()['value']();return db[_0x60d7('0x33')][_0x60d7('0x51')]({'where':{'id':_0x5c5dc8[_0x60d7('0x4a')]['id']}})[_0x60d7('0x2a')](function(_0x43b3df){return db[_0x60d7('0x6b')]['transaction'](function(_0xcf038){return _0x43b3df[_0x60d7('0x70')](_0x5c5dc8[_0x60d7('0x38')][_0x60d7('0x71')],{'transaction':_0xcf038})['then'](function(){if(!_[_0x60d7('0x84')](_0x378a03)){return _0x43b3df[_0x60d7('0x85')](_0x378a03,{'transaction':_0xcf038});}})[_0x60d7('0x2a')](function(){_0x378a03[_0x60d7('0x6f')](function(_0x2f2d0c){socket[_0x60d7('0x86')](_0x60d7('0x87'),{'UserId':_0x2f2d0c,'OpenchannelQueueId':_0x43b3df['id']});});});});});});})[_0x60d7('0x2a')](respondWithStatusCode(_0x3dd32f,null))[_0x60d7('0x49')](handleError(_0x3dd32f,null));};exports['addAgents']=function(_0x2f6c00,_0x4868be,_0x429282){return db[_0x60d7('0x33')][_0x60d7('0x51')]({'where':{'id':_0x2f6c00[_0x60d7('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4868be,null))['then'](function(_0x1927c1){if(_0x1927c1){return _0x1927c1[_0x60d7('0x88')](_0x2f6c00['body'][_0x60d7('0x71')],_['omit'](_0x2f6c00[_0x60d7('0x53')],['ids','id'])||{})[_0x60d7('0x89')](function(_0x268e01){for(var _0xab4f30=0x0;_0xab4f30<_0x2f6c00['body'][_0x60d7('0x71')]['length'];_0xab4f30+=0x1){socket['emit']('userOpenchannelQueue:save',{'UserId':Number(_0x2f6c00[_0x60d7('0x53')][_0x60d7('0x71')][_0xab4f30]),'OpenchannelQueueId':Number(_0x2f6c00['params']['id'])});}return _0x268e01;});}})[_0x60d7('0x2a')](respondWithResult(_0x4868be,null))[_0x60d7('0x49')](handleError(_0x4868be,null));};exports[_0x60d7('0x85')]=function(_0x44e985,_0x4f9fa0,_0x379e71){return db['OpenchannelQueue'][_0x60d7('0x51')]({'where':{'id':_0x44e985[_0x60d7('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4f9fa0,null))['then'](function(_0x1f70e8){if(_0x1f70e8){return _0x1f70e8['removeAgents'](_0x44e985[_0x60d7('0x38')]['ids'])[_0x60d7('0x2a')](function(){if(_[_0x60d7('0x8a')](_0x44e985[_0x60d7('0x38')][_0x60d7('0x71')])){for(var _0x4d14cf=0x0;_0x4d14cf<_0x44e985[_0x60d7('0x38')][_0x60d7('0x71')]['length'];_0x4d14cf+=0x1){socket[_0x60d7('0x86')](_0x60d7('0x87'),{'UserId':Number(_0x44e985['query'][_0x60d7('0x71')][_0x4d14cf]),'OpenchannelQueueId':Number(_0x44e985[_0x60d7('0x4a')]['id'])});}}else{socket[_0x60d7('0x86')]('userOpenchannelQueue:remove',{'UserId':Number(_0x44e985[_0x60d7('0x38')][_0x60d7('0x71')]),'OpenchannelQueueId':Number(_0x44e985['params']['id'])});}});}})[_0x60d7('0x2a')](respondWithStatusCode(_0x4f9fa0,null))['catch'](handleError(_0x4f9fa0,null));};exports[_0x60d7('0x8b')]=function(_0x15ccdb,_0x393329,_0x2b0755){var _0x1e02df={};var _0x129a1b={};var _0x19c44d;var _0x4fe272;return db[_0x60d7('0x33')][_0x60d7('0x55')]({'where':{'id':_0x15ccdb[_0x60d7('0x4a')]['id']}})[_0x60d7('0x2a')](handleEntityNotFound(_0x393329,null))[_0x60d7('0x2a')](function(_0x443dfb){if(_0x443dfb){_0x19c44d=_0x443dfb;_0x129a1b[_0x60d7('0x36')]=_[_0x60d7('0x4b')](db[_0x60d7('0x5a')]['rawAttributes']);_0x129a1b[_0x60d7('0x38')]=_['keys'](_0x15ccdb[_0x60d7('0x38')]);_0x129a1b['filters']=_['intersection'](_0x129a1b[_0x60d7('0x36')],_0x129a1b[_0x60d7('0x38')]);_0x1e02df[_0x60d7('0x3b')]=_[_0x60d7('0x3a')](_0x129a1b[_0x60d7('0x36')],qs[_0x60d7('0x3c')](_0x15ccdb[_0x60d7('0x38')][_0x60d7('0x3c')]));_0x1e02df['attributes']=_0x1e02df['attributes'][_0x60d7('0x3d')]?_0x1e02df[_0x60d7('0x3b')]:_0x129a1b[_0x60d7('0x36')];_0x1e02df[_0x60d7('0x3f')]=qs['sort'](_0x15ccdb[_0x60d7('0x38')][_0x60d7('0x58')]);_0x1e02df[_0x60d7('0x40')]=qs['filters'](_[_0x60d7('0x41')](_0x15ccdb[_0x60d7('0x38')],_0x129a1b['filters']));if(_0x15ccdb[_0x60d7('0x38')][_0x60d7('0x42')]){_0x1e02df[_0x60d7('0x40')]=_['merge'](_0x1e02df[_0x60d7('0x40')],{'$or':_[_0x60d7('0x37')](_0x1e02df[_0x60d7('0x3b')],function(_0x2c88ff){var _0x158f80={};_0x158f80[_0x2c88ff]={'$like':'%'+_0x15ccdb[_0x60d7('0x38')]['filter']+'%'};return _0x158f80;})});}_0x1e02df=_[_0x60d7('0x43')]({},_0x1e02df,_0x15ccdb[_0x60d7('0x44')]);return _0x19c44d[_0x60d7('0x8b')](_0x1e02df);}})[_0x60d7('0x2a')](function(_0x517553){if(_0x517553){_0x4fe272=_0x517553[_0x60d7('0x3d')];if(!_0x15ccdb[_0x60d7('0x38')]['hasOwnProperty'](_0x60d7('0x3e'))){_0x1e02df[_0x60d7('0x23')]=qs['limit'](_0x15ccdb['query'][_0x60d7('0x23')]);_0x1e02df[_0x60d7('0x22')]=qs[_0x60d7('0x22')](_0x15ccdb[_0x60d7('0x38')]['offset']);}return _0x19c44d['getAgents'](_0x1e02df);}})[_0x60d7('0x2a')](function(_0x408dc7){if(_0x408dc7){return _0x408dc7?{'count':_0x4fe272,'rows':_0x408dc7}:null;}})[_0x60d7('0x2a')](respondWithResult(_0x393329,null))[_0x60d7('0x49')](handleError(_0x393329,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 6eab674..7e19262 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 _0xb692=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','OpenchannelQueue'];(function(_0x276506,_0x103190){var _0x1ee03e=function(_0x2cdc9e){while(--_0x2cdc9e){_0x276506['push'](_0x276506['shift']());}};_0x1ee03e(++_0x103190);}(_0xb692,0x183));var _0x2b69=function(_0xef4cf0,_0x16c9c3){_0xef4cf0=_0xef4cf0-0x0;var _0x497ad2=_0xb692[_0xef4cf0];return _0x497ad2;};'use strict';var EventEmitter=require(_0x2b69('0x0'));var OpenchannelQueue=require(_0x2b69('0x1'))['db'][_0x2b69('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x2b69('0x3')](0x0);var events={'afterCreate':_0x2b69('0x4'),'afterUpdate':_0x2b69('0x5'),'afterDestroy':_0x2b69('0x6')};function emitEvent(_0x354b27){return function(_0x396c6b,_0x3d371d,_0x343c8c){OpenchannelQueueEvents['emit'](_0x354b27+':'+_0x396c6b['id'],_0x396c6b);OpenchannelQueueEvents[_0x2b69('0x7')](_0x354b27,_0x396c6b);_0x343c8c(null);};}for(var e in events){if(events[_0x2b69('0x8')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x2b69('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x97b3=['remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0xea034a,_0x17da73){var _0x4608b3=function(_0x3311fc){while(--_0x3311fc){_0xea034a['push'](_0xea034a['shift']());}};_0x4608b3(++_0x17da73);}(_0x97b3,0x70));var _0x397b=function(_0xa08526,_0xd2a376){_0xa08526=_0xa08526-0x0;var _0x2684eb=_0x97b3[_0xa08526];return _0x2684eb;};'use strict';var EventEmitter=require(_0x397b('0x0'));var OpenchannelQueue=require(_0x397b('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x397b('0x2')](0x0);var events={'afterCreate':_0x397b('0x3'),'afterUpdate':_0x397b('0x4'),'afterDestroy':_0x397b('0x5')};function emitEvent(_0x29f764){return function(_0x12ef7e,_0x49049a,_0x47950e){OpenchannelQueueEvents[_0x397b('0x6')](_0x29f764+':'+_0x12ef7e['id'],_0x12ef7e);OpenchannelQueueEvents[_0x397b('0x6')](_0x29f764,_0x12ef7e);_0x47950e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x397b('0x7')](e,emitEvent(event));}}module[_0x397b('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 0401fc6..c42c18b 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 _0x5384=['define','openchannel_queues','util','api','bluebird','request-promise','../../config/environment','./openchannelQueue.attributes','exports'];(function(_0x2e107c,_0x31ed8e){var _0x3a69a6=function(_0x15679a){while(--_0x15679a){_0x2e107c['push'](_0x2e107c['shift']());}};_0x3a69a6(++_0x31ed8e);}(_0x5384,0x1a9));var _0x4538=function(_0x396587,_0x231d16){_0x396587=_0x396587-0x0;var _0x3cab9d=_0x5384[_0x396587];return _0x3cab9d;};'use strict';var _=require('lodash');var util=require(_0x4538('0x0'));var logger=require('../../config/logger')(_0x4538('0x1'));var moment=require('moment');var BPromise=require(_0x4538('0x2'));var rp=require(_0x4538('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4538('0x4'));var attributes=require(_0x4538('0x5'));module[_0x4538('0x6')]=function(_0x2ded7c,_0x143a48){return _0x2ded7c[_0x4538('0x7')]('OpenchannelQueue',attributes,{'tableName':_0x4538('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac1b=['bluebird','./openchannelQueue.attributes','exports','define','OpenchannelQueue','lodash','../../config/logger','moment'];(function(_0x3eda98,_0x32b3eb){var _0x29d8e3=function(_0x5895ad){while(--_0x5895ad){_0x3eda98['push'](_0x3eda98['shift']());}};_0x29d8e3(++_0x32b3eb);}(_0xac1b,0x10d));var _0xbac1=function(_0x18ae16,_0x2cce1b){_0x18ae16=_0x18ae16-0x0;var _0x49b798=_0xac1b[_0x18ae16];return _0x49b798;};'use strict';var _=require(_0xbac1('0x0'));var util=require('util');var logger=require(_0xbac1('0x1'))('api');var moment=require(_0xbac1('0x2'));var BPromise=require(_0xbac1('0x3'));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(_0xbac1('0x4'));module[_0xbac1('0x5')]=function(_0x1f48a5,_0x5e855c){return _0x1f48a5[_0xbac1('0x6')](_0xbac1('0x7'),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 445b738..0f5ec10 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 _0xd2d2=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./openchannelQueue.socket','info','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','include','map','model','then','catch','ShowOpenchannelQueue','find','lodash','util','bluebird','randomstring','ioredis'];(function(_0x1d5400,_0x567e3c){var _0x21d9fe=function(_0x23fb75){while(--_0x23fb75){_0x1d5400['push'](_0x1d5400['shift']());}};_0x21d9fe(++_0x567e3c);}(_0xd2d2,0x15a));var _0x2d2d=function(_0x4e5c1b,_0x142748){_0x4e5c1b=_0x4e5c1b-0x0;var _0x488c3e=_0xd2d2[_0x4e5c1b];return _0x488c3e;};'use strict';var _=require(_0x2d2d('0x0'));var util=require(_0x2d2d('0x1'));var moment=require('moment');var BPromise=require(_0x2d2d('0x2'));var rs=require(_0x2d2d('0x3'));var fs=require('fs');var Redis=require(_0x2d2d('0x4'));var db=require(_0x2d2d('0x5'))['db'];var utils=require(_0x2d2d('0x6'));var logger=require(_0x2d2d('0x7'))(_0x2d2d('0x8'));var config=require(_0x2d2d('0x9'));var jayson=require(_0x2d2d('0xa'));var client=jayson[_0x2d2d('0xb')]['http']({'port':0x232a});config[_0x2d2d('0xc')]=_['defaults'](config[_0x2d2d('0xc')],{'host':_0x2d2d('0xd'),'port':0x18eb});var socket=require(_0x2d2d('0xe'))(new Redis(config['redis']));require(_0x2d2d('0xf'))['register'](socket);function respondWithRpcPromise(_0x3efd2e,_0x1aeefa,_0x3232eb){return new BPromise(function(_0x30d345,_0x1f254d){return client['request'](_0x3efd2e,_0x3232eb)['then'](function(_0x29bc21){logger[_0x2d2d('0x10')](_0x2d2d('0x11'),_0x1aeefa,'request\x20sent');logger[_0x2d2d('0x12')](_0x2d2d('0x13'),_0x1aeefa,_0x2d2d('0x14'),JSON[_0x2d2d('0x15')](_0x29bc21));if(_0x29bc21['error']){if(_0x29bc21['error']['code']===0x1f4){logger[_0x2d2d('0x16')](_0x2d2d('0x11'),_0x1aeefa,_0x29bc21[_0x2d2d('0x16')][_0x2d2d('0x17')]);return _0x1f254d(_0x29bc21[_0x2d2d('0x16')][_0x2d2d('0x17')]);}logger[_0x2d2d('0x16')](_0x2d2d('0x11'),_0x1aeefa,_0x29bc21[_0x2d2d('0x16')][_0x2d2d('0x17')]);return _0x30d345(_0x29bc21[_0x2d2d('0x16')][_0x2d2d('0x17')]);}else{logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x1aeefa,'request\x20sent');_0x30d345(_0x29bc21[_0x2d2d('0x18')][_0x2d2d('0x17')]);}})['catch'](function(_0x24dc48){logger[_0x2d2d('0x16')](_0x2d2d('0x11'),_0x1aeefa,_0x24dc48);_0x1f254d(_0x24dc48);});});}exports[_0x2d2d('0x19')]=function(_0x1e9f66){var _0x17ac04=this;return new Promise(function(_0x1d1f98,_0x3ae785){return db[_0x2d2d('0x1a')][_0x2d2d('0x1b')]({'raw':_0x1e9f66[_0x2d2d('0x1c')]?_0x1e9f66[_0x2d2d('0x1c')][_0x2d2d('0x1d')]===undefined?!![]:![]:!![],'where':_0x1e9f66['options']?_0x1e9f66['options'][_0x2d2d('0x1e')]||null:null,'attributes':_0x1e9f66[_0x2d2d('0x1c')]?_0x1e9f66[_0x2d2d('0x1c')][_0x2d2d('0x1f')]||null:null,'limit':_0x1e9f66[_0x2d2d('0x1c')]?_0x1e9f66[_0x2d2d('0x1c')]['limit']||null:null,'include':_0x1e9f66[_0x2d2d('0x1c')]?_0x1e9f66[_0x2d2d('0x1c')]['include']?_['map'](_0x1e9f66[_0x2d2d('0x1c')]['include'],function(_0x59e165){return{'model':db[_0x59e165['model']],'as':_0x59e165['as'],'attributes':_0x59e165[_0x2d2d('0x1f')],'include':_0x59e165[_0x2d2d('0x20')]?_[_0x2d2d('0x21')](_0x59e165[_0x2d2d('0x20')],function(_0x8efe41){return{'model':db[_0x8efe41['model']],'as':_0x8efe41['as'],'attributes':_0x8efe41[_0x2d2d('0x1f')],'include':_0x8efe41[_0x2d2d('0x20')]?_[_0x2d2d('0x21')](_0x8efe41[_0x2d2d('0x20')],function(_0x5ae7ca){return{'model':db[_0x5ae7ca[_0x2d2d('0x22')]],'as':_0x5ae7ca['as'],'attributes':_0x5ae7ca[_0x2d2d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2d2d('0x23')](function(_0x5975f4){logger[_0x2d2d('0x10')]('GetOpenchannelQueue',_0x1e9f66);logger[_0x2d2d('0x12')]('GetOpenchannelQueue',_0x1e9f66,JSON[_0x2d2d('0x15')](_0x5975f4));_0x1d1f98(_0x5975f4);})[_0x2d2d('0x24')](function(_0x1fc928){logger[_0x2d2d('0x16')](_0x2d2d('0x19'),_0x1fc928['message'],_0x1e9f66);_0x3ae785(_0x17ac04[_0x2d2d('0x16')](0x1f4,_0x1fc928['message']));});});};exports[_0x2d2d('0x25')]=function(_0x237f9c){var _0x82d981=this;return new Promise(function(_0x342d99,_0xfa100f){return db[_0x2d2d('0x1a')][_0x2d2d('0x26')]({'raw':_0x237f9c['options']?_0x237f9c[_0x2d2d('0x1c')][_0x2d2d('0x1d')]===undefined?!![]:![]:!![],'where':_0x237f9c[_0x2d2d('0x1c')]?_0x237f9c['options'][_0x2d2d('0x1e')]||null:null,'attributes':_0x237f9c[_0x2d2d('0x1c')]?_0x237f9c['options'][_0x2d2d('0x1f')]||null:null,'include':_0x237f9c['options']?_0x237f9c[_0x2d2d('0x1c')][_0x2d2d('0x20')]?_['map'](_0x237f9c[_0x2d2d('0x1c')][_0x2d2d('0x20')],function(_0x4aedf8){return{'model':db[_0x4aedf8[_0x2d2d('0x22')]],'as':_0x4aedf8['as'],'attributes':_0x4aedf8[_0x2d2d('0x1f')],'include':_0x4aedf8[_0x2d2d('0x20')]?_[_0x2d2d('0x21')](_0x4aedf8[_0x2d2d('0x20')],function(_0x1390e5){return{'model':db[_0x1390e5[_0x2d2d('0x22')]],'as':_0x1390e5['as'],'attributes':_0x1390e5[_0x2d2d('0x1f')],'include':_0x1390e5[_0x2d2d('0x20')]?_['map'](_0x1390e5[_0x2d2d('0x20')],function(_0x55d665){return{'model':db[_0x55d665['model']],'as':_0x55d665['as'],'attributes':_0x55d665[_0x2d2d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2d2d('0x23')](function(_0xb293ee){logger[_0x2d2d('0x10')](_0x2d2d('0x25'),_0x237f9c);logger[_0x2d2d('0x12')](_0x2d2d('0x25'),_0x237f9c,JSON[_0x2d2d('0x15')](_0xb293ee));_0x342d99(_0xb293ee);})[_0x2d2d('0x24')](function(_0x4dade2){logger[_0x2d2d('0x16')]('ShowOpenchannelQueue',_0x4dade2[_0x2d2d('0x17')],_0x237f9c);_0xfa100f(_0x82d981[_0x2d2d('0x16')](0x1f4,_0x4dade2[_0x2d2d('0x17')]));});});}; \ No newline at end of file +var _0x4c61=['rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','info','OpenchannelQueue,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','GetOpenchannelQueue','findAll','options','raw','where','attributes','include','map','model','ShowOpenchannelQueue','find','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x5858d1,_0x39818a){var _0x4a2fbf=function(_0x29b468){while(--_0x29b468){_0x5858d1['push'](_0x5858d1['shift']());}};_0x4a2fbf(++_0x39818a);}(_0x4c61,0x92));var _0x14c6=function(_0x1347ac,_0x3220f8){_0x1347ac=_0x1347ac-0x0;var _0x2e4bb0=_0x4c61[_0x1347ac];return _0x2e4bb0;};'use strict';var _=require(_0x14c6('0x0'));var util=require('util');var moment=require(_0x14c6('0x1'));var BPromise=require(_0x14c6('0x2'));var rs=require(_0x14c6('0x3'));var fs=require('fs');var Redis=require(_0x14c6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x14c6('0x5'));var logger=require('../../config/logger')(_0x14c6('0x6'));var config=require(_0x14c6('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x14c6('0x8')]({'port':0x232a});config[_0x14c6('0x9')]=_[_0x14c6('0xa')](config[_0x14c6('0x9')],{'host':_0x14c6('0xb'),'port':0x18eb});var socket=require(_0x14c6('0xc'))(new Redis(config[_0x14c6('0x9')]));require(_0x14c6('0xd'))[_0x14c6('0xe')](socket);function respondWithRpcPromise(_0xd1bcc4,_0x436c8e,_0x2c6384){return new BPromise(function(_0x50d683,_0xeb01c4){return client[_0x14c6('0xf')](_0xd1bcc4,_0x2c6384)['then'](function(_0x4818b6){logger[_0x14c6('0x10')](_0x14c6('0x11'),_0x436c8e,'request\x20sent');logger[_0x14c6('0x12')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x436c8e,'request\x20sent',JSON[_0x14c6('0x13')](_0x4818b6));if(_0x4818b6[_0x14c6('0x14')]){if(_0x4818b6[_0x14c6('0x14')][_0x14c6('0x15')]===0x1f4){logger[_0x14c6('0x14')](_0x14c6('0x11'),_0x436c8e,_0x4818b6[_0x14c6('0x14')][_0x14c6('0x16')]);return _0xeb01c4(_0x4818b6['error'][_0x14c6('0x16')]);}logger['error'](_0x14c6('0x11'),_0x436c8e,_0x4818b6['error'][_0x14c6('0x16')]);return _0x50d683(_0x4818b6[_0x14c6('0x14')][_0x14c6('0x16')]);}else{logger[_0x14c6('0x10')](_0x14c6('0x11'),_0x436c8e,_0x14c6('0x17'));_0x50d683(_0x4818b6[_0x14c6('0x18')]['message']);}})[_0x14c6('0x19')](function(_0x570b27){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x436c8e,_0x570b27);_0xeb01c4(_0x570b27);});});}exports[_0x14c6('0x1a')]=function(_0x12acc7){var _0xdee1e5=this;return new Promise(function(_0x11fd77,_0x120515){return db['OpenchannelQueue'][_0x14c6('0x1b')]({'raw':_0x12acc7[_0x14c6('0x1c')]?_0x12acc7[_0x14c6('0x1c')][_0x14c6('0x1d')]===undefined?!![]:![]:!![],'where':_0x12acc7[_0x14c6('0x1c')]?_0x12acc7[_0x14c6('0x1c')][_0x14c6('0x1e')]||null:null,'attributes':_0x12acc7['options']?_0x12acc7[_0x14c6('0x1c')][_0x14c6('0x1f')]||null:null,'limit':_0x12acc7['options']?_0x12acc7[_0x14c6('0x1c')]['limit']||null:null,'include':_0x12acc7['options']?_0x12acc7[_0x14c6('0x1c')][_0x14c6('0x20')]?_[_0x14c6('0x21')](_0x12acc7[_0x14c6('0x1c')][_0x14c6('0x20')],function(_0x41b49b){return{'model':db[_0x41b49b[_0x14c6('0x22')]],'as':_0x41b49b['as'],'attributes':_0x41b49b[_0x14c6('0x1f')],'include':_0x41b49b[_0x14c6('0x20')]?_[_0x14c6('0x21')](_0x41b49b[_0x14c6('0x20')],function(_0x20d3f7){return{'model':db[_0x20d3f7['model']],'as':_0x20d3f7['as'],'attributes':_0x20d3f7['attributes'],'include':_0x20d3f7[_0x14c6('0x20')]?_['map'](_0x20d3f7[_0x14c6('0x20')],function(_0x556b5c){return{'model':db[_0x556b5c[_0x14c6('0x22')]],'as':_0x556b5c['as'],'attributes':_0x556b5c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x413d68){logger[_0x14c6('0x10')](_0x14c6('0x1a'),_0x12acc7);logger[_0x14c6('0x12')](_0x14c6('0x1a'),_0x12acc7,JSON[_0x14c6('0x13')](_0x413d68));_0x11fd77(_0x413d68);})['catch'](function(_0xceb954){logger[_0x14c6('0x14')](_0x14c6('0x1a'),_0xceb954['message'],_0x12acc7);_0x120515(_0xdee1e5[_0x14c6('0x14')](0x1f4,_0xceb954['message']));});});};exports[_0x14c6('0x23')]=function(_0x4586a2){var _0x424636=this;return new Promise(function(_0x32e3ca,_0x16b1c3){return db['OpenchannelQueue'][_0x14c6('0x24')]({'raw':_0x4586a2['options']?_0x4586a2[_0x14c6('0x1c')][_0x14c6('0x1d')]===undefined?!![]:![]:!![],'where':_0x4586a2['options']?_0x4586a2[_0x14c6('0x1c')][_0x14c6('0x1e')]||null:null,'attributes':_0x4586a2[_0x14c6('0x1c')]?_0x4586a2[_0x14c6('0x1c')]['attributes']||null:null,'include':_0x4586a2[_0x14c6('0x1c')]?_0x4586a2[_0x14c6('0x1c')]['include']?_[_0x14c6('0x21')](_0x4586a2[_0x14c6('0x1c')]['include'],function(_0x1ab9fb){return{'model':db[_0x1ab9fb[_0x14c6('0x22')]],'as':_0x1ab9fb['as'],'attributes':_0x1ab9fb[_0x14c6('0x1f')],'include':_0x1ab9fb[_0x14c6('0x20')]?_[_0x14c6('0x21')](_0x1ab9fb[_0x14c6('0x20')],function(_0x27e456){return{'model':db[_0x27e456[_0x14c6('0x22')]],'as':_0x27e456['as'],'attributes':_0x27e456[_0x14c6('0x1f')],'include':_0x27e456[_0x14c6('0x20')]?_['map'](_0x27e456[_0x14c6('0x20')],function(_0x5e31a9){return{'model':db[_0x5e31a9[_0x14c6('0x22')]],'as':_0x5e31a9['as'],'attributes':_0x5e31a9[_0x14c6('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x14c6('0x25')](function(_0x4b86bb){logger[_0x14c6('0x10')](_0x14c6('0x23'),_0x4586a2);logger[_0x14c6('0x12')](_0x14c6('0x23'),_0x4586a2,JSON['stringify'](_0x4b86bb));_0x32e3ca(_0x4b86bb);})[_0x14c6('0x19')](function(_0x3b7ad3){logger['error'](_0x14c6('0x23'),_0x3b7ad3[_0x14c6('0x16')],_0x4586a2);_0x16b1c3(_0x424636['error'](0x1f4,_0x3b7ad3['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index a844309..07b1f81 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 _0x74c1=['removeListener','register','openchannelQueue:','./openchannelQueue.events','remove','update'];(function(_0x56bc94,_0x12ef5d){var _0x3b771b=function(_0x1986ea){while(--_0x1986ea){_0x56bc94['push'](_0x56bc94['shift']());}};_0x3b771b(++_0x12ef5d);}(_0x74c1,0x16b));var _0x174c=function(_0x1c889e,_0x652b56){_0x1c889e=_0x1c889e-0x0;var _0x2fb2b7=_0x74c1[_0x1c889e];return _0x2fb2b7;};'use strict';var OpenchannelQueueEvents=require(_0x174c('0x0'));var events=['save',_0x174c('0x1'),_0x174c('0x2')];function createListener(_0x156d12,_0x469c04){return function(_0x1bd34f){_0x469c04['emit'](_0x156d12,_0x1bd34f);};}function removeListener(_0x2754ad,_0x38fc98){return function(){OpenchannelQueueEvents[_0x174c('0x3')](_0x2754ad,_0x38fc98);};}exports[_0x174c('0x4')]=function(_0x47447d){for(var _0x51e926=0x0,_0xa78c03=events['length'];_0x51e926<_0xa78c03;_0x51e926++){var _0x2eb4b9=events[_0x51e926];var _0x46c61c=createListener(_0x174c('0x5')+_0x2eb4b9,_0x47447d);OpenchannelQueueEvents['on'](_0x2eb4b9,_0x46c61c);}}; \ No newline at end of file +var _0xfa98=['emit','removeListener','register','openchannelQueue:','./openchannelQueue.events'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xfa98,0xc2));var _0x8fa9=function(_0x31ed9d,_0x422472){_0x31ed9d=_0x31ed9d-0x0;var _0x3cb82d=_0xfa98[_0x31ed9d];return _0x3cb82d;};'use strict';var OpenchannelQueueEvents=require(_0x8fa9('0x0'));var events=['save','remove','update'];function createListener(_0x35ab4c,_0x4593a3){return function(_0x5eae94){_0x4593a3[_0x8fa9('0x1')](_0x35ab4c,_0x5eae94);};}function removeListener(_0x21674f,_0x197d01){return function(){OpenchannelQueueEvents[_0x8fa9('0x2')](_0x21674f,_0x197d01);};}exports[_0x8fa9('0x3')]=function(_0x5804b4){for(var _0x58c824=0x0,_0x32f445=events['length'];_0x58c824<_0x32f445;_0x58c824++){var _0x4885dc=events[_0x58c824];var _0x1a3dcf=createListener(_0x8fa9('0x4')+_0x4885dc,_0x5804b4);OpenchannelQueueEvents['on'](_0x4885dc,_0x1a3dcf);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index c6929e9..561eb25 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 _0x86fc=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','get','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0x86fc,0x1a4));var _0xc86f=function(_0x211b1e,_0x4c7e93){_0x211b1e=_0x211b1e-0x0;var _0x39571a=_0x86fc[_0x211b1e];return _0x39571a;};'use strict';var multer=require(_0xc86f('0x0'));var util=require(_0xc86f('0x1'));var path=require(_0xc86f('0x2'));var timeout=require(_0xc86f('0x3'));var express=require(_0xc86f('0x4'));var router=express[_0xc86f('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc86f('0x6'));var controller=require('./openchannelQueueReport.controller');router[_0xc86f('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc86f('0x7')](_0xc86f('0x8'),auth[_0xc86f('0x9')](),controller[_0xc86f('0xa')]);router[_0xc86f('0x7')](_0xc86f('0xb'),auth[_0xc86f('0x9')](),controller['show']);router[_0xc86f('0xc')]('/',auth[_0xc86f('0x9')](),controller[_0xc86f('0xd')]);router[_0xc86f('0xe')](_0xc86f('0xb'),auth[_0xc86f('0x9')](),controller[_0xc86f('0xf')]);router[_0xc86f('0x10')](_0xc86f('0xb'),auth['isAuthenticated'](),controller[_0xc86f('0x11')]);module[_0xc86f('0x12')]=router; \ No newline at end of file +var _0x9cbd=['get','isAuthenticated','index','/describe','describe','/:id','show','put','update','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3203fe,_0x1937b0){var _0x1e8c25=function(_0x36a3e3){while(--_0x36a3e3){_0x3203fe['push'](_0x3203fe['shift']());}};_0x1e8c25(++_0x1937b0);}(_0x9cbd,0x109));var _0xd9cb=function(_0x599d34,_0x207e97){_0x599d34=_0x599d34-0x0;var _0x140736=_0x9cbd[_0x599d34];return _0x140736;};'use strict';var multer=require('multer');var util=require(_0xd9cb('0x0'));var path=require('path');var timeout=require(_0xd9cb('0x1'));var express=require(_0xd9cb('0x2'));var router=express['Router']();var fs_extra=require(_0xd9cb('0x3'));var auth=require(_0xd9cb('0x4'));var interaction=require(_0xd9cb('0x5'));var config=require(_0xd9cb('0x6'));var controller=require('./openchannelQueueReport.controller');router[_0xd9cb('0x7')]('/',auth[_0xd9cb('0x8')](),controller[_0xd9cb('0x9')]);router[_0xd9cb('0x7')](_0xd9cb('0xa'),auth[_0xd9cb('0x8')](),controller[_0xd9cb('0xb')]);router[_0xd9cb('0x7')](_0xd9cb('0xc'),auth[_0xd9cb('0x8')](),controller[_0xd9cb('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xd9cb('0xe')](_0xd9cb('0xc'),auth[_0xd9cb('0x8')](),controller[_0xd9cb('0xf')]);router['delete'](_0xd9cb('0xc'),auth[_0xd9cb('0x8')](),controller['destroy']);module[_0xd9cb('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index f1185e9..e7e694d 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 _0xd7ba=['sequelize','exports','STRING','DATE','moment'];(function(_0x32cc05,_0x106d41){var _0x445e74=function(_0x5209d0){while(--_0x5209d0){_0x32cc05['push'](_0x32cc05['shift']());}};_0x445e74(++_0x106d41);}(_0xd7ba,0xef));var _0xad7b=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xd7ba[_0x13d07a];return _0x5ee0ee;};'use strict';var moment=require(_0xad7b('0x0'));var Sequelize=require(_0xad7b('0x1'));module[_0xad7b('0x2')]={'uniqueid':{'type':Sequelize[_0xad7b('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xad7b('0x3')]},'joinAt':{'type':Sequelize[_0xad7b('0x4')]},'leaveAt':{'type':Sequelize[_0xad7b('0x4')]},'acceptAt':{'type':Sequelize[_0xad7b('0x4')]},'exitAt':{'type':Sequelize[_0xad7b('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb1c4=['exports','STRING','DATE','sequelize'];(function(_0x16c72c,_0x440d7c){var _0x49d353=function(_0x5a9eb4){while(--_0x5a9eb4){_0x16c72c['push'](_0x16c72c['shift']());}};_0x49d353(++_0x440d7c);}(_0xb1c4,0x8f));var _0x4b1c=function(_0x50805b,_0x6429ae){_0x50805b=_0x50805b-0x0;var _0x1b9e5=_0xb1c4[_0x50805b];return _0x1b9e5;};'use strict';var moment=require('moment');var Sequelize=require(_0x4b1c('0x0'));module[_0x4b1c('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x4b1c('0x2')]},'joinAt':{'type':Sequelize[_0x4b1c('0x3')]},'leaveAt':{'type':Sequelize[_0x4b1c('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x4b1c('0x3')]},'reason':{'type':Sequelize[_0x4b1c('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 30144d4..67c5456 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 _0xf044=['Content-Range','reject','save','update','then','destroy','end','error','name','index','OpenchannelQueueReport','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','count','include','findAll','show','params','includeAll','find','catch','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf044,0x111));var _0x4f04=function(_0x54ce9f,_0x483b1a){_0x54ce9f=_0x54ce9f-0x0;var _0x1ecf83=_0xf044[_0x54ce9f];return _0x1ecf83;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4f04('0x0'));var zipdir=require(_0x4f04('0x1'));var jsonpatch=require(_0x4f04('0x2'));var rp=require('request-promise');var moment=require(_0x4f04('0x3'));var BPromise=require(_0x4f04('0x4'));var Mustache=require(_0x4f04('0x5'));var util=require(_0x4f04('0x6'));var path=require(_0x4f04('0x7'));var sox=require(_0x4f04('0x8'));var csv=require(_0x4f04('0x9'));var ejs=require(_0x4f04('0xa'));var fs=require('fs');var fs_extra=require(_0x4f04('0xb'));var _=require(_0x4f04('0xc'));var squel=require(_0x4f04('0xd'));var crypto=require(_0x4f04('0xe'));var jsforce=require(_0x4f04('0xf'));var deskjs=require(_0x4f04('0x10'));var toCsv=require(_0x4f04('0x9'));var querystring=require(_0x4f04('0x11'));var Papa=require(_0x4f04('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4f04('0x13'));var as=require(_0x4f04('0x14'));var hardwareService=require(_0x4f04('0x15'));var logger=require(_0x4f04('0x16'))(_0x4f04('0x17'));var utils=require(_0x4f04('0x18'));var config=require(_0x4f04('0x19'));var licenseUtil=require(_0x4f04('0x1a'));var db=require(_0x4f04('0x1b'))['db'];function respondWithStatusCode(_0x16e7ad,_0x1f8901){_0x1f8901=_0x1f8901||0xcc;return function(_0x3d6daf){if(_0x3d6daf){return _0x16e7ad[_0x4f04('0x1c')](_0x1f8901);}return _0x16e7ad[_0x4f04('0x1d')](_0x1f8901)['end']();};}function respondWithResult(_0x4c0067,_0x40250d){_0x40250d=_0x40250d||0xc8;return function(_0x44e78a){if(_0x44e78a){return _0x4c0067['status'](_0x40250d)[_0x4f04('0x1e')](_0x44e78a);}};}function respondWithFilteredResult(_0x32f468,_0x144ee3){return function(_0x546b68){if(_0x546b68){var _0x4c61e4=typeof _0x144ee3[_0x4f04('0x1f')]===_0x4f04('0x20')&&typeof _0x144ee3[_0x4f04('0x21')]===_0x4f04('0x20');var _0x22a9f5=_0x546b68['count'];var _0x5d8f1e=_0x4c61e4?0x0:_0x144ee3['offset'];var _0x15e666=_0x4c61e4?_0x546b68['count']:_0x144ee3[_0x4f04('0x1f')]+_0x144ee3['limit'];var _0x3ce586;if(_0x15e666>=_0x22a9f5){_0x15e666=_0x22a9f5;_0x3ce586=0xc8;}else{_0x3ce586=0xce;}_0x32f468[_0x4f04('0x1d')](_0x3ce586);return _0x32f468[_0x4f04('0x22')](_0x4f04('0x23'),_0x5d8f1e+'-'+_0x15e666+'/'+_0x22a9f5)['json'](_0x546b68);}return null;};}function patchUpdates(_0x466d07){return function(_0x48668e){try{jsonpatch['apply'](_0x48668e,_0x466d07,!![]);}catch(_0xda63bd){return BPromise[_0x4f04('0x24')](_0xda63bd);}return _0x48668e[_0x4f04('0x25')]();};}function saveUpdates(_0x3e188c,_0x5998fb){return function(_0x5d46fc){if(_0x5d46fc){return _0x5d46fc[_0x4f04('0x26')](_0x3e188c)[_0x4f04('0x27')](function(_0x3fb565){return _0x3fb565;});}return null;};}function removeEntity(_0x377b72,_0x298208){return function(_0x24eb1f){if(_0x24eb1f){return _0x24eb1f[_0x4f04('0x28')]()[_0x4f04('0x27')](function(){_0x377b72[_0x4f04('0x1d')](0xcc)[_0x4f04('0x29')]();});}};}function handleEntityNotFound(_0x21d7d4,_0x57f08d){return function(_0x44ff5a){if(!_0x44ff5a){_0x21d7d4[_0x4f04('0x1c')](0x194);}return _0x44ff5a;};}function handleError(_0x480b3c,_0x578bf8){_0x578bf8=_0x578bf8||0x1f4;return function(_0x79916f){logger[_0x4f04('0x2a')](_0x79916f['stack']);if(_0x79916f[_0x4f04('0x2b')]){delete _0x79916f['name'];}_0x480b3c[_0x4f04('0x1d')](_0x578bf8)['send'](_0x79916f);};}exports[_0x4f04('0x2c')]=function(_0x3fb4f7,_0x4b59b7){var _0x105fa1={},_0x51ed13={},_0x47afaa={'count':0x0,'rows':[]};var _0x26977e=_['map'](db[_0x4f04('0x2d')][_0x4f04('0x2e')],function(_0x2923b9){return{'name':_0x2923b9[_0x4f04('0x2f')],'type':_0x2923b9[_0x4f04('0x30')][_0x4f04('0x31')]};});_0x51ed13['model']=_[_0x4f04('0x32')](_0x26977e,'name');_0x51ed13[_0x4f04('0x33')]=_[_0x4f04('0x34')](_0x3fb4f7[_0x4f04('0x33')]);_0x51ed13[_0x4f04('0x35')]=_[_0x4f04('0x36')](_0x51ed13[_0x4f04('0x37')],_0x51ed13[_0x4f04('0x33')]);_0x105fa1[_0x4f04('0x38')]=_[_0x4f04('0x36')](_0x51ed13['model'],qs[_0x4f04('0x39')](_0x3fb4f7[_0x4f04('0x33')][_0x4f04('0x39')]));_0x105fa1[_0x4f04('0x38')]=_0x105fa1['attributes'][_0x4f04('0x3a')]?_0x105fa1['attributes']:_0x51ed13[_0x4f04('0x37')];if(!_0x3fb4f7[_0x4f04('0x33')][_0x4f04('0x3b')](_0x4f04('0x3c'))){_0x105fa1[_0x4f04('0x21')]=qs[_0x4f04('0x21')](_0x3fb4f7[_0x4f04('0x33')][_0x4f04('0x21')]);_0x105fa1[_0x4f04('0x1f')]=qs[_0x4f04('0x1f')](_0x3fb4f7[_0x4f04('0x33')][_0x4f04('0x1f')]);}_0x105fa1['order']=qs['sort'](_0x3fb4f7['query'][_0x4f04('0x3d')]);_0x105fa1[_0x4f04('0x3e')]=qs['filters'](_[_0x4f04('0x3f')](_0x3fb4f7[_0x4f04('0x33')],_0x51ed13[_0x4f04('0x35')]),_0x26977e);if(_0x3fb4f7[_0x4f04('0x33')][_0x4f04('0x40')]){_0x105fa1[_0x4f04('0x3e')]=_[_0x4f04('0x41')](_0x105fa1[_0x4f04('0x3e')],{'$or':_['map'](_0x26977e,function(_0x15a9e3){if(_0x15a9e3[_0x4f04('0x30')]!==_0x4f04('0x42')){var _0x2d775e={};_0x2d775e[_0x15a9e3[_0x4f04('0x2b')]]={'$like':'%'+_0x3fb4f7[_0x4f04('0x33')]['filter']+'%'};return _0x2d775e;}})});}_0x105fa1=_[_0x4f04('0x41')]({},_0x105fa1,_0x3fb4f7['options']);var _0x5e4f66={'where':_0x105fa1[_0x4f04('0x3e')]};return db[_0x4f04('0x2d')][_0x4f04('0x43')](_0x5e4f66)[_0x4f04('0x27')](function(_0x26a2b7){_0x47afaa['count']=_0x26a2b7;if(_0x3fb4f7[_0x4f04('0x33')]['includeAll']){_0x105fa1[_0x4f04('0x44')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x4f04('0x45')](_0x105fa1);})[_0x4f04('0x27')](function(_0x46107f){_0x47afaa['rows']=_0x46107f;return _0x47afaa;})[_0x4f04('0x27')](respondWithFilteredResult(_0x4b59b7,_0x105fa1))['catch'](handleError(_0x4b59b7,null));};exports[_0x4f04('0x46')]=function(_0x392954,_0x38ac39){var _0x3f1855={'raw':!![],'where':{'id':_0x392954[_0x4f04('0x47')]['id']}},_0x144616={};_0x144616[_0x4f04('0x37')]=_['keys'](db[_0x4f04('0x2d')][_0x4f04('0x2e')]);_0x144616['query']=_[_0x4f04('0x34')](_0x392954[_0x4f04('0x33')]);_0x144616[_0x4f04('0x35')]=_[_0x4f04('0x36')](_0x144616[_0x4f04('0x37')],_0x144616[_0x4f04('0x33')]);_0x3f1855['attributes']=_['intersection'](_0x144616[_0x4f04('0x37')],qs[_0x4f04('0x39')](_0x392954[_0x4f04('0x33')][_0x4f04('0x39')]));_0x3f1855['attributes']=_0x3f1855[_0x4f04('0x38')][_0x4f04('0x3a')]?_0x3f1855['attributes']:_0x144616['model'];if(_0x392954['query'][_0x4f04('0x48')]){_0x3f1855['include']=[{'all':!![]}];}_0x3f1855=_[_0x4f04('0x41')]({},_0x3f1855,_0x392954['options']);return db[_0x4f04('0x2d')][_0x4f04('0x49')](_0x3f1855)['then'](handleEntityNotFound(_0x38ac39,null))[_0x4f04('0x27')](respondWithResult(_0x38ac39,null))[_0x4f04('0x4a')](handleError(_0x38ac39,null));};exports[_0x4f04('0x4b')]=function(_0x32162c,_0x4f18fb){return db[_0x4f04('0x2d')][_0x4f04('0x4b')](_0x32162c[_0x4f04('0x4c')],{})[_0x4f04('0x27')](respondWithResult(_0x4f18fb,0xc9))[_0x4f04('0x4a')](handleError(_0x4f18fb,null));};exports[_0x4f04('0x26')]=function(_0x10a5eb,_0x415077){if(_0x10a5eb[_0x4f04('0x4c')]['id']){delete _0x10a5eb[_0x4f04('0x4c')]['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x10a5eb['params']['id']}})[_0x4f04('0x27')](handleEntityNotFound(_0x415077,null))[_0x4f04('0x27')](saveUpdates(_0x10a5eb['body'],null))['then'](respondWithResult(_0x415077,null))[_0x4f04('0x4a')](handleError(_0x415077,null));};exports[_0x4f04('0x28')]=function(_0x26977c,_0x520cb7){return db[_0x4f04('0x2d')][_0x4f04('0x49')]({'where':{'id':_0x26977c[_0x4f04('0x47')]['id']}})[_0x4f04('0x27')](handleEntityNotFound(_0x520cb7,null))[_0x4f04('0x27')](removeEntity(_0x520cb7,null))[_0x4f04('0x4a')](handleError(_0x520cb7,null));};exports['describe']=function(_0xb6b04,_0x24b40c){return db[_0x4f04('0x2d')]['describe']()[_0x4f04('0x27')](respondWithResult(_0x24b40c,null))[_0x4f04('0x4a')](handleError(_0x24b40c,null));}; \ No newline at end of file +var _0x8b59=['stack','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x1484c1,_0x5cb7c5){var _0x36ca69=function(_0x3761a7){while(--_0x3761a7){_0x1484c1['push'](_0x1484c1['shift']());}};_0x36ca69(++_0x5cb7c5);}(_0x8b59,0x74));var _0x98b5=function(_0x3a1e1c,_0xeb4a1){_0x3a1e1c=_0x3a1e1c-0x0;var _0x3cc920=_0x8b59[_0x3a1e1c];return _0x3cc920;};'use strict';var emlformat=require(_0x98b5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x98b5('0x1'));var jsonpatch=require(_0x98b5('0x2'));var rp=require(_0x98b5('0x3'));var moment=require(_0x98b5('0x4'));var BPromise=require(_0x98b5('0x5'));var Mustache=require('mustache');var util=require(_0x98b5('0x6'));var path=require('path');var sox=require(_0x98b5('0x7'));var csv=require(_0x98b5('0x8'));var ejs=require(_0x98b5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x98b5('0xa'));var squel=require(_0x98b5('0xb'));var crypto=require(_0x98b5('0xc'));var jsforce=require(_0x98b5('0xd'));var deskjs=require(_0x98b5('0xe'));var toCsv=require(_0x98b5('0x8'));var querystring=require(_0x98b5('0xf'));var Papa=require(_0x98b5('0x10'));var Redis=require('ioredis');var authService=require(_0x98b5('0x11'));var qs=require(_0x98b5('0x12'));var as=require(_0x98b5('0x13'));var hardwareService=require(_0x98b5('0x14'));var logger=require(_0x98b5('0x15'))(_0x98b5('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x98b5('0x17'));var db=require(_0x98b5('0x18'))['db'];function respondWithStatusCode(_0x3e26b3,_0x3bbbdd){_0x3bbbdd=_0x3bbbdd||0xcc;return function(_0x57a8f7){if(_0x57a8f7){return _0x3e26b3[_0x98b5('0x19')](_0x3bbbdd);}return _0x3e26b3[_0x98b5('0x1a')](_0x3bbbdd)[_0x98b5('0x1b')]();};}function respondWithResult(_0x51f54f,_0x48c16a){_0x48c16a=_0x48c16a||0xc8;return function(_0x218907){if(_0x218907){return _0x51f54f[_0x98b5('0x1a')](_0x48c16a)[_0x98b5('0x1c')](_0x218907);}};}function respondWithFilteredResult(_0x19d268,_0x247a70){return function(_0x35f76d){if(_0x35f76d){var _0x9fb320=typeof _0x247a70[_0x98b5('0x1d')]==='undefined'&&typeof _0x247a70[_0x98b5('0x1e')]===_0x98b5('0x1f');var _0x3b86d3=_0x35f76d[_0x98b5('0x20')];var _0x3e7ad1=_0x9fb320?0x0:_0x247a70[_0x98b5('0x1d')];var _0x142156=_0x9fb320?_0x35f76d[_0x98b5('0x20')]:_0x247a70['offset']+_0x247a70[_0x98b5('0x1e')];var _0x13fe9a;if(_0x142156>=_0x3b86d3){_0x142156=_0x3b86d3;_0x13fe9a=0xc8;}else{_0x13fe9a=0xce;}_0x19d268[_0x98b5('0x1a')](_0x13fe9a);return _0x19d268['set'](_0x98b5('0x21'),_0x3e7ad1+'-'+_0x142156+'/'+_0x3b86d3)['json'](_0x35f76d);}return null;};}function patchUpdates(_0x47441c){return function(_0x28f176){try{jsonpatch[_0x98b5('0x22')](_0x28f176,_0x47441c,!![]);}catch(_0x4ac1b9){return BPromise[_0x98b5('0x23')](_0x4ac1b9);}return _0x28f176[_0x98b5('0x24')]();};}function saveUpdates(_0x3058cc,_0x200353){return function(_0x467fbe){if(_0x467fbe){return _0x467fbe[_0x98b5('0x25')](_0x3058cc)[_0x98b5('0x26')](function(_0x42d43a){return _0x42d43a;});}return null;};}function removeEntity(_0x3b4f2f,_0x3c49aa){return function(_0x201288){if(_0x201288){return _0x201288[_0x98b5('0x27')]()[_0x98b5('0x26')](function(){_0x3b4f2f[_0x98b5('0x1a')](0xcc)[_0x98b5('0x1b')]();});}};}function handleEntityNotFound(_0x2e35c5,_0x4adccd){return function(_0x4471b2){if(!_0x4471b2){_0x2e35c5[_0x98b5('0x19')](0x194);}return _0x4471b2;};}function handleError(_0x42e179,_0x319852){_0x319852=_0x319852||0x1f4;return function(_0x5212ec){logger['error'](_0x5212ec[_0x98b5('0x28')]);if(_0x5212ec['name']){delete _0x5212ec['name'];}_0x42e179[_0x98b5('0x1a')](_0x319852)[_0x98b5('0x29')](_0x5212ec);};}exports[_0x98b5('0x2a')]=function(_0x2f236f,_0x2a69dd){var _0x2440fb={},_0x175393={},_0x6208={'count':0x0,'rows':[]};var _0x3fa136=_[_0x98b5('0x2b')](db[_0x98b5('0x2c')][_0x98b5('0x2d')],function(_0x3efa37){return{'name':_0x3efa37[_0x98b5('0x2e')],'type':_0x3efa37[_0x98b5('0x2f')][_0x98b5('0x30')]};});_0x175393[_0x98b5('0x31')]=_[_0x98b5('0x2b')](_0x3fa136,'name');_0x175393[_0x98b5('0x32')]=_['keys'](_0x2f236f['query']);_0x175393[_0x98b5('0x33')]=_[_0x98b5('0x34')](_0x175393['model'],_0x175393[_0x98b5('0x32')]);_0x2440fb[_0x98b5('0x35')]=_[_0x98b5('0x34')](_0x175393[_0x98b5('0x31')],qs['fields'](_0x2f236f[_0x98b5('0x32')][_0x98b5('0x36')]));_0x2440fb[_0x98b5('0x35')]=_0x2440fb['attributes'][_0x98b5('0x37')]?_0x2440fb[_0x98b5('0x35')]:_0x175393['model'];if(!_0x2f236f[_0x98b5('0x32')][_0x98b5('0x38')](_0x98b5('0x39'))){_0x2440fb[_0x98b5('0x1e')]=qs[_0x98b5('0x1e')](_0x2f236f[_0x98b5('0x32')]['limit']);_0x2440fb[_0x98b5('0x1d')]=qs[_0x98b5('0x1d')](_0x2f236f[_0x98b5('0x32')][_0x98b5('0x1d')]);}_0x2440fb[_0x98b5('0x3a')]=qs[_0x98b5('0x3b')](_0x2f236f[_0x98b5('0x32')][_0x98b5('0x3b')]);_0x2440fb[_0x98b5('0x3c')]=qs[_0x98b5('0x33')](_[_0x98b5('0x3d')](_0x2f236f[_0x98b5('0x32')],_0x175393[_0x98b5('0x33')]),_0x3fa136);if(_0x2f236f[_0x98b5('0x32')]['filter']){_0x2440fb[_0x98b5('0x3c')]=_[_0x98b5('0x3e')](_0x2440fb['where'],{'$or':_[_0x98b5('0x2b')](_0x3fa136,function(_0x5e1ac6){if(_0x5e1ac6['type']!==_0x98b5('0x3f')){var _0x472499={};_0x472499[_0x5e1ac6[_0x98b5('0x40')]]={'$like':'%'+_0x2f236f[_0x98b5('0x32')]['filter']+'%'};return _0x472499;}})});}_0x2440fb=_['merge']({},_0x2440fb,_0x2f236f[_0x98b5('0x41')]);var _0x3993aa={'where':_0x2440fb[_0x98b5('0x3c')]};return db[_0x98b5('0x2c')][_0x98b5('0x20')](_0x3993aa)['then'](function(_0x3144a6){_0x6208[_0x98b5('0x20')]=_0x3144a6;if(_0x2f236f[_0x98b5('0x32')][_0x98b5('0x42')]){_0x2440fb[_0x98b5('0x43')]=[{'all':!![]}];}return db[_0x98b5('0x2c')][_0x98b5('0x44')](_0x2440fb);})[_0x98b5('0x26')](function(_0x5826e8){_0x6208[_0x98b5('0x45')]=_0x5826e8;return _0x6208;})[_0x98b5('0x26')](respondWithFilteredResult(_0x2a69dd,_0x2440fb))[_0x98b5('0x46')](handleError(_0x2a69dd,null));};exports[_0x98b5('0x47')]=function(_0x28dcc6,_0x43c9d2){var _0x58a1e8={'raw':!![],'where':{'id':_0x28dcc6[_0x98b5('0x48')]['id']}},_0xb3606b={};_0xb3606b[_0x98b5('0x31')]=_[_0x98b5('0x49')](db['OpenchannelQueueReport'][_0x98b5('0x2d')]);_0xb3606b[_0x98b5('0x32')]=_[_0x98b5('0x49')](_0x28dcc6[_0x98b5('0x32')]);_0xb3606b[_0x98b5('0x33')]=_[_0x98b5('0x34')](_0xb3606b[_0x98b5('0x31')],_0xb3606b[_0x98b5('0x32')]);_0x58a1e8[_0x98b5('0x35')]=_['intersection'](_0xb3606b['model'],qs[_0x98b5('0x36')](_0x28dcc6[_0x98b5('0x32')]['fields']));_0x58a1e8['attributes']=_0x58a1e8[_0x98b5('0x35')]['length']?_0x58a1e8[_0x98b5('0x35')]:_0xb3606b[_0x98b5('0x31')];if(_0x28dcc6[_0x98b5('0x32')][_0x98b5('0x42')]){_0x58a1e8[_0x98b5('0x43')]=[{'all':!![]}];}_0x58a1e8=_[_0x98b5('0x3e')]({},_0x58a1e8,_0x28dcc6[_0x98b5('0x41')]);return db[_0x98b5('0x2c')][_0x98b5('0x4a')](_0x58a1e8)[_0x98b5('0x26')](handleEntityNotFound(_0x43c9d2,null))[_0x98b5('0x26')](respondWithResult(_0x43c9d2,null))['catch'](handleError(_0x43c9d2,null));};exports[_0x98b5('0x4b')]=function(_0x5a49e3,_0x21967c){return db['OpenchannelQueueReport'][_0x98b5('0x4b')](_0x5a49e3[_0x98b5('0x4c')],{})[_0x98b5('0x26')](respondWithResult(_0x21967c,0xc9))[_0x98b5('0x46')](handleError(_0x21967c,null));};exports['update']=function(_0x58f4fd,_0x566295){if(_0x58f4fd[_0x98b5('0x4c')]['id']){delete _0x58f4fd[_0x98b5('0x4c')]['id'];}return db[_0x98b5('0x2c')][_0x98b5('0x4a')]({'where':{'id':_0x58f4fd['params']['id']}})[_0x98b5('0x26')](handleEntityNotFound(_0x566295,null))[_0x98b5('0x26')](saveUpdates(_0x58f4fd[_0x98b5('0x4c')],null))[_0x98b5('0x26')](respondWithResult(_0x566295,null))[_0x98b5('0x46')](handleError(_0x566295,null));};exports[_0x98b5('0x27')]=function(_0x5016e9,_0x1257b0){return db[_0x98b5('0x2c')]['find']({'where':{'id':_0x5016e9[_0x98b5('0x48')]['id']}})[_0x98b5('0x26')](handleEntityNotFound(_0x1257b0,null))[_0x98b5('0x26')](removeEntity(_0x1257b0,null))[_0x98b5('0x46')](handleError(_0x1257b0,null));};exports[_0x98b5('0x4d')]=function(_0x1e017c,_0x55a774){return db[_0x98b5('0x2c')][_0x98b5('0x4d')]()[_0x98b5('0x26')](respondWithResult(_0x55a774,null))[_0x98b5('0x46')](handleError(_0x55a774,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 2930aba..d3d0440 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 _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x11a925,_0x2e1580){var _0x19a704=function(_0x125dae){while(--_0x125dae){_0x11a925['push'](_0x11a925['shift']());}};_0x19a704(++_0x2e1580);}(_0x326f,0xd1));var _0xf326=function(_0x387c55,_0x447ca2){_0x387c55=_0x387c55-0x0;var _0x5ac07e=_0x326f[_0x387c55];return _0x5ac07e;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x5d3c62,_0x3e5216){var _0x137012=function(_0x68582b){while(--_0x68582b){_0x5d3c62['push'](_0x5d3c62['shift']());}};_0x137012(++_0x3e5216);}(_0x326f,0xd1));var _0xf326=function(_0x24a676,_0x15cd54){_0x24a676=_0x24a676-0x0;var _0x3c947f=_0x326f[_0x24a676];return _0x3c947f;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 94e4e8f..9161b16 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 _0x4fc2=['limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','create','body','options','raw','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','where','attributes'];(function(_0x9d639c,_0x524dbe){var _0x1671de=function(_0x27888e){while(--_0x27888e){_0x9d639c['push'](_0x9d639c['shift']());}};_0x1671de(++_0x524dbe);}(_0x4fc2,0x111));var _0x24fc=function(_0x2d2885,_0x667d70){_0x2d2885=_0x2d2885-0x0;var _0x2cea6=_0x4fc2[_0x2d2885];return _0x2cea6;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var moment=require(_0x24fc('0x2'));var BPromise=require(_0x24fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24fc('0x4'));var db=require(_0x24fc('0x5'))['db'];var utils=require(_0x24fc('0x6'));var logger=require('../../config/logger')(_0x24fc('0x7'));var config=require(_0x24fc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x24fc('0x9')][_0x24fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4889f4,_0x115851,_0x22a0c8){return new BPromise(function(_0x220f9a,_0x123eff){return client[_0x24fc('0xb')](_0x4889f4,_0x22a0c8)[_0x24fc('0xc')](function(_0x5afdf1){logger[_0x24fc('0xd')](_0x24fc('0xe'),_0x115851,_0x24fc('0xf'));logger[_0x24fc('0x10')](_0x24fc('0x11'),_0x115851,_0x24fc('0xf'),JSON[_0x24fc('0x12')](_0x5afdf1));if(_0x5afdf1[_0x24fc('0x13')]){if(_0x5afdf1['error'][_0x24fc('0x14')]===0x1f4){logger[_0x24fc('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x115851,_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);return _0x123eff(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x5afdf1['error'][_0x24fc('0x15')]);return _0x220f9a(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}else{logger[_0x24fc('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x115851,_0x24fc('0xf'));_0x220f9a(_0x5afdf1['result'][_0x24fc('0x15')]);}})[_0x24fc('0x16')](function(_0x218fb6){logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x218fb6);_0x123eff(_0x218fb6);});});}exports['CreateOpenchannelQueueReport']=function(_0x23873c){var _0x1cb3d0=this;return new Promise(function(_0x6cfa0a,_0x8ac114){return db['OpenchannelQueueReport'][_0x24fc('0x17')](_0x23873c[_0x24fc('0x18')],{'raw':_0x23873c[_0x24fc('0x19')]?_0x23873c['options'][_0x24fc('0x1a')]===undefined?!![]:![]:!![]})[_0x24fc('0xc')](function(_0xbf1d6b){logger[_0x24fc('0xd')]('CreateOpenchannelQueueReport',_0x23873c);logger[_0x24fc('0x10')]('CreateOpenchannelQueueReport',_0x23873c,JSON[_0x24fc('0x12')](_0xbf1d6b));_0x6cfa0a(_0xbf1d6b);})['catch'](function(_0x3ed464){logger[_0x24fc('0x13')](_0x24fc('0x1b'),_0x3ed464['message'],_0x23873c);_0x8ac114(_0x1cb3d0[_0x24fc('0x13')](0x1f4,_0x3ed464['message']));});});};exports[_0x24fc('0x1c')]=function(_0x2bb93a){var _0x36a9b4=this;return new Promise(function(_0x34b5b2,_0x3296fc){return db[_0x24fc('0x1d')][_0x24fc('0x1e')](_0x2bb93a[_0x24fc('0x18')],{'raw':_0x2bb93a[_0x24fc('0x19')]?_0x2bb93a[_0x24fc('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2bb93a[_0x24fc('0x19')]?_0x2bb93a[_0x24fc('0x19')][_0x24fc('0x1f')]||null:null,'attributes':_0x2bb93a['options']?_0x2bb93a[_0x24fc('0x19')][_0x24fc('0x20')]||null:null,'limit':_0x2bb93a[_0x24fc('0x19')]?_0x2bb93a[_0x24fc('0x19')][_0x24fc('0x21')]||null:null})[_0x24fc('0xc')](function(_0x5ac1f2){logger[_0x24fc('0xd')](_0x24fc('0x1c'),_0x2bb93a);logger[_0x24fc('0x10')](_0x24fc('0x1c'),_0x2bb93a,JSON[_0x24fc('0x12')](_0x5ac1f2));_0x34b5b2(_0x5ac1f2);})['catch'](function(_0x55c27f){logger['error'](_0x24fc('0x1c'),_0x55c27f['message'],_0x2bb93a);_0x3296fc(_0x36a9b4[_0x24fc('0x13')](0x1f4,_0x55c27f[_0x24fc('0x15')]));});});}; \ No newline at end of file +var _0xd523=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','where','attributes','lodash'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0xd523,0x153));var _0x3d52=function(_0x84265a,_0x38dee0){_0x84265a=_0x84265a-0x0;var _0x20b1e7=_0xd523[_0x84265a];return _0x20b1e7;};'use strict';var _=require(_0x3d52('0x0'));var util=require(_0x3d52('0x1'));var moment=require(_0x3d52('0x2'));var BPromise=require(_0x3d52('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d52('0x4'));var db=require(_0x3d52('0x5'))['db'];var utils=require(_0x3d52('0x6'));var logger=require('../../config/logger')(_0x3d52('0x7'));var config=require(_0x3d52('0x8'));var jayson=require(_0x3d52('0x9'));var client=jayson[_0x3d52('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fcc92,_0x189147,_0x2f3ebc){return new BPromise(function(_0x232bd4,_0x2e03c0){return client[_0x3d52('0xb')](_0x4fcc92,_0x2f3ebc)[_0x3d52('0xc')](function(_0x34c184){logger[_0x3d52('0xd')](_0x3d52('0xe'),_0x189147,'request\x20sent');logger[_0x3d52('0xf')](_0x3d52('0x10'),_0x189147,_0x3d52('0x11'),JSON[_0x3d52('0x12')](_0x34c184));if(_0x34c184[_0x3d52('0x13')]){if(_0x34c184['error'][_0x3d52('0x14')]===0x1f4){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x189147,_0x34c184[_0x3d52('0x13')][_0x3d52('0x15')]);return _0x2e03c0(_0x34c184['error']['message']);}logger['error'](_0x3d52('0xe'),_0x189147,_0x34c184[_0x3d52('0x13')][_0x3d52('0x15')]);return _0x232bd4(_0x34c184[_0x3d52('0x13')][_0x3d52('0x15')]);}else{logger[_0x3d52('0xd')](_0x3d52('0xe'),_0x189147,_0x3d52('0x11'));_0x232bd4(_0x34c184[_0x3d52('0x16')][_0x3d52('0x15')]);}})[_0x3d52('0x17')](function(_0x15cc02){logger[_0x3d52('0x13')](_0x3d52('0xe'),_0x189147,_0x15cc02);_0x2e03c0(_0x15cc02);});});}exports[_0x3d52('0x18')]=function(_0x5bce9a){var _0x163d88=this;return new Promise(function(_0x3b3451,_0x386cdb){return db['OpenchannelQueueReport'][_0x3d52('0x19')](_0x5bce9a[_0x3d52('0x1a')],{'raw':_0x5bce9a[_0x3d52('0x1b')]?_0x5bce9a['options'][_0x3d52('0x1c')]===undefined?!![]:![]:!![]})[_0x3d52('0xc')](function(_0x1163c5){logger[_0x3d52('0xd')](_0x3d52('0x18'),_0x5bce9a);logger[_0x3d52('0xf')](_0x3d52('0x18'),_0x5bce9a,JSON[_0x3d52('0x12')](_0x1163c5));_0x3b3451(_0x1163c5);})['catch'](function(_0x419c05){logger[_0x3d52('0x13')](_0x3d52('0x18'),_0x419c05['message'],_0x5bce9a);_0x386cdb(_0x163d88[_0x3d52('0x13')](0x1f4,_0x419c05[_0x3d52('0x15')]));});});};exports[_0x3d52('0x1d')]=function(_0xc6c76){var _0x3816bc=this;return new Promise(function(_0x349b30,_0xdf73cd){return db[_0x3d52('0x1e')][_0x3d52('0x1f')](_0xc6c76[_0x3d52('0x1a')],{'raw':_0xc6c76[_0x3d52('0x1b')]?_0xc6c76['options'][_0x3d52('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc6c76[_0x3d52('0x1b')]?_0xc6c76[_0x3d52('0x1b')][_0x3d52('0x20')]||null:null,'attributes':_0xc6c76['options']?_0xc6c76['options'][_0x3d52('0x21')]||null:null,'limit':_0xc6c76[_0x3d52('0x1b')]?_0xc6c76[_0x3d52('0x1b')]['limit']||null:null})[_0x3d52('0xc')](function(_0x4312a7){logger[_0x3d52('0xd')](_0x3d52('0x1d'),_0xc6c76);logger['debug'](_0x3d52('0x1d'),_0xc6c76,JSON[_0x3d52('0x12')](_0x4312a7));_0x349b30(_0x4312a7);})[_0x3d52('0x17')](function(_0x193bf1){logger['error'](_0x3d52('0x1d'),_0x193bf1['message'],_0xc6c76);_0xdf73cd(_0x3816bc[_0x3d52('0x13')](0x1f4,_0x193bf1[_0x3d52('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index b6b6423..45caad4 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 _0x6b67=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer'];(function(_0x274638,_0x578968){var _0x5755df=function(_0x3227d5){while(--_0x3227d5){_0x274638['push'](_0x274638['shift']());}};_0x5755df(++_0x578968);}(_0x6b67,0x13a));var _0x76b6=function(_0x195686,_0xd329df){_0x195686=_0x195686-0x0;var _0xaf27a1=_0x6b67[_0x195686];return _0xaf27a1;};'use strict';var multer=require(_0x76b6('0x0'));var util=require(_0x76b6('0x1'));var path=require(_0x76b6('0x2'));var timeout=require(_0x76b6('0x3'));var express=require('express');var router=express[_0x76b6('0x4')]();var fs_extra=require(_0x76b6('0x5'));var auth=require(_0x76b6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x76b6('0x7'));var controller=require('./openchannelTransferReport.controller');router[_0x76b6('0x8')]('/',auth[_0x76b6('0x9')](),controller[_0x76b6('0xa')]);router['get'](_0x76b6('0xb'),auth[_0x76b6('0x9')](),controller[_0x76b6('0xc')]);router[_0x76b6('0x8')](_0x76b6('0xd'),auth['isAuthenticated'](),controller[_0x76b6('0xe')]);router[_0x76b6('0xf')]('/',auth['isAuthenticated'](),controller[_0x76b6('0x10')]);router[_0x76b6('0x11')](_0x76b6('0xd'),auth['isAuthenticated'](),controller[_0x76b6('0x12')]);router[_0x76b6('0x13')]('/:id',auth[_0x76b6('0x9')](),controller[_0x76b6('0x14')]);module['exports']=router; \ No newline at end of file +var _0x221b=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','put','update'];(function(_0x4b3c05,_0x2eb5ff){var _0x213e10=function(_0x274340){while(--_0x274340){_0x4b3c05['push'](_0x4b3c05['shift']());}};_0x213e10(++_0x2eb5ff);}(_0x221b,0x1cf));var _0xb221=function(_0xf54f84,_0x3b567b){_0xf54f84=_0xf54f84-0x0;var _0x21f1b1=_0x221b[_0xf54f84];return _0x21f1b1;};'use strict';var multer=require(_0xb221('0x0'));var util=require(_0xb221('0x1'));var path=require(_0xb221('0x2'));var timeout=require(_0xb221('0x3'));var express=require(_0xb221('0x4'));var router=express[_0xb221('0x5')]();var fs_extra=require(_0xb221('0x6'));var auth=require(_0xb221('0x7'));var interaction=require(_0xb221('0x8'));var config=require(_0xb221('0x9'));var controller=require(_0xb221('0xa'));router[_0xb221('0xb')]('/',auth[_0xb221('0xc')](),controller[_0xb221('0xd')]);router[_0xb221('0xb')](_0xb221('0xe'),auth[_0xb221('0xc')](),controller['describe']);router[_0xb221('0xb')](_0xb221('0xf'),auth['isAuthenticated'](),controller[_0xb221('0x10')]);router[_0xb221('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb221('0x12')](_0xb221('0xf'),auth[_0xb221('0xc')](),controller[_0xb221('0x13')]);router[_0xb221('0x14')]('/:id',auth[_0xb221('0xc')](),controller[_0xb221('0x15')]);module[_0xb221('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 1860e15..b9b9c12 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x1662b5,_0x20d5ed){var _0x13da1c=function(_0x1b29b9){while(--_0x1b29b9){_0x1662b5['push'](_0x1662b5['shift']());}};_0x13da1c(++_0x20d5ed);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xcb91[_0x5f1391];return _0x50ebe3;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x220216,_0x4ecb61){var _0x39eab9=function(_0x427fbf){while(--_0x427fbf){_0x220216['push'](_0x220216['shift']());}};_0x39eab9(++_0x4ecb61);}(_0x00bb,0x1d8));var _0xb00b=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x00bb[_0x55f8b4];return _0x2475f9;};'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/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index aa7af3c..f784853 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 _0xbdec=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','end','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','order','where','pick','merge','filter','findAll','show','params','includeAll','include','options','catch','create','update','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x3c077f,_0x3d8cee){var _0x4783da=function(_0x18dbb2){while(--_0x18dbb2){_0x3c077f['push'](_0x3c077f['shift']());}};_0x4783da(++_0x3d8cee);}(_0xbdec,0x93));var _0xcbde=function(_0x2e723a,_0x5590f5){_0x2e723a=_0x2e723a-0x0;var _0x15a487=_0xbdec[_0x2e723a];return _0x15a487;};'use strict';var emlformat=require(_0xcbde('0x0'));var rimraf=require(_0xcbde('0x1'));var zipdir=require(_0xcbde('0x2'));var jsonpatch=require(_0xcbde('0x3'));var rp=require(_0xcbde('0x4'));var moment=require(_0xcbde('0x5'));var BPromise=require(_0xcbde('0x6'));var Mustache=require(_0xcbde('0x7'));var util=require(_0xcbde('0x8'));var path=require(_0xcbde('0x9'));var sox=require(_0xcbde('0xa'));var csv=require(_0xcbde('0xb'));var ejs=require(_0xcbde('0xc'));var fs=require('fs');var fs_extra=require(_0xcbde('0xd'));var _=require(_0xcbde('0xe'));var squel=require(_0xcbde('0xf'));var crypto=require(_0xcbde('0x10'));var jsforce=require(_0xcbde('0x11'));var deskjs=require(_0xcbde('0x12'));var toCsv=require(_0xcbde('0xb'));var querystring=require(_0xcbde('0x13'));var Papa=require(_0xcbde('0x14'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcbde('0x15'));var as=require(_0xcbde('0x16'));var hardwareService=require(_0xcbde('0x17'));var logger=require(_0xcbde('0x18'))(_0xcbde('0x19'));var utils=require(_0xcbde('0x1a'));var config=require(_0xcbde('0x1b'));var licenseUtil=require(_0xcbde('0x1c'));var db=require(_0xcbde('0x1d'))['db'];function respondWithStatusCode(_0x39b6fc,_0x17f7a9){_0x17f7a9=_0x17f7a9||0xcc;return function(_0xaeab55){if(_0xaeab55){return _0x39b6fc[_0xcbde('0x1e')](_0x17f7a9);}return _0x39b6fc[_0xcbde('0x1f')](_0x17f7a9)['end']();};}function respondWithResult(_0x214d54,_0x3ad5c2){_0x3ad5c2=_0x3ad5c2||0xc8;return function(_0x5ae8c2){if(_0x5ae8c2){return _0x214d54['status'](_0x3ad5c2)[_0xcbde('0x20')](_0x5ae8c2);}};}function respondWithFilteredResult(_0x206ce8,_0x5652d7){return function(_0x458b7d){if(_0x458b7d){var _0x5aa24d=typeof _0x5652d7[_0xcbde('0x21')]===_0xcbde('0x22')&&typeof _0x5652d7[_0xcbde('0x23')]===_0xcbde('0x22');var _0x36b8a7=_0x458b7d[_0xcbde('0x24')];var _0x221cc2=_0x5aa24d?0x0:_0x5652d7[_0xcbde('0x21')];var _0x54af3c=_0x5aa24d?_0x458b7d['count']:_0x5652d7[_0xcbde('0x21')]+_0x5652d7[_0xcbde('0x23')];var _0x2fb641;if(_0x54af3c>=_0x36b8a7){_0x54af3c=_0x36b8a7;_0x2fb641=0xc8;}else{_0x2fb641=0xce;}_0x206ce8[_0xcbde('0x1f')](_0x2fb641);return _0x206ce8['set'](_0xcbde('0x25'),_0x221cc2+'-'+_0x54af3c+'/'+_0x36b8a7)[_0xcbde('0x20')](_0x458b7d);}return null;};}function patchUpdates(_0x3a62c1){return function(_0x5c9ef3){try{jsonpatch[_0xcbde('0x26')](_0x5c9ef3,_0x3a62c1,!![]);}catch(_0x177a7e){return BPromise[_0xcbde('0x27')](_0x177a7e);}return _0x5c9ef3['save']();};}function saveUpdates(_0x45bdcb,_0x476c4){return function(_0x27355a){if(_0x27355a){return _0x27355a['update'](_0x45bdcb)[_0xcbde('0x28')](function(_0x1db05){return _0x1db05;});}return null;};}function removeEntity(_0x1468ed,_0x4106c6){return function(_0x41aaec){if(_0x41aaec){return _0x41aaec[_0xcbde('0x29')]()[_0xcbde('0x28')](function(){_0x1468ed['status'](0xcc)[_0xcbde('0x2a')]();});}};}function handleEntityNotFound(_0x456d13,_0x13b2b5){return function(_0x4cf758){if(!_0x4cf758){_0x456d13[_0xcbde('0x1e')](0x194);}return _0x4cf758;};}function handleError(_0x33e7a1,_0x4f746f){_0x4f746f=_0x4f746f||0x1f4;return function(_0x4bfc89){logger[_0xcbde('0x2b')](_0x4bfc89[_0xcbde('0x2c')]);if(_0x4bfc89[_0xcbde('0x2d')]){delete _0x4bfc89['name'];}_0x33e7a1[_0xcbde('0x1f')](_0x4f746f)[_0xcbde('0x2e')](_0x4bfc89);};}exports[_0xcbde('0x2f')]=function(_0x4383b1,_0x3f4af1){var _0x33919c={},_0x392723={},_0x261b57={'count':0x0,'rows':[]};var _0x417f1d=_[_0xcbde('0x30')](db[_0xcbde('0x31')][_0xcbde('0x32')],function(_0x458ce2){return{'name':_0x458ce2[_0xcbde('0x33')],'type':_0x458ce2[_0xcbde('0x34')]['key']};});_0x392723['model']=_['map'](_0x417f1d,_0xcbde('0x2d'));_0x392723[_0xcbde('0x35')]=_[_0xcbde('0x36')](_0x4383b1[_0xcbde('0x35')]);_0x392723[_0xcbde('0x37')]=_[_0xcbde('0x38')](_0x392723[_0xcbde('0x39')],_0x392723['query']);_0x33919c[_0xcbde('0x3a')]=_['intersection'](_0x392723['model'],qs[_0xcbde('0x3b')](_0x4383b1[_0xcbde('0x35')][_0xcbde('0x3b')]));_0x33919c[_0xcbde('0x3a')]=_0x33919c[_0xcbde('0x3a')][_0xcbde('0x3c')]?_0x33919c['attributes']:_0x392723[_0xcbde('0x39')];if(!_0x4383b1[_0xcbde('0x35')]['hasOwnProperty']('nolimit')){_0x33919c[_0xcbde('0x23')]=qs[_0xcbde('0x23')](_0x4383b1[_0xcbde('0x35')]['limit']);_0x33919c[_0xcbde('0x21')]=qs[_0xcbde('0x21')](_0x4383b1[_0xcbde('0x35')]['offset']);}_0x33919c[_0xcbde('0x3d')]=qs['sort'](_0x4383b1['query']['sort']);_0x33919c[_0xcbde('0x3e')]=qs[_0xcbde('0x37')](_[_0xcbde('0x3f')](_0x4383b1['query'],_0x392723['filters']),_0x417f1d);if(_0x4383b1[_0xcbde('0x35')]['filter']){_0x33919c['where']=_[_0xcbde('0x40')](_0x33919c[_0xcbde('0x3e')],{'$or':_[_0xcbde('0x30')](_0x417f1d,function(_0x6d08b2){if(_0x6d08b2[_0xcbde('0x34')]!=='VIRTUAL'){var _0x302c99={};_0x302c99[_0x6d08b2['name']]={'$like':'%'+_0x4383b1[_0xcbde('0x35')][_0xcbde('0x41')]+'%'};return _0x302c99;}})});}_0x33919c=_[_0xcbde('0x40')]({},_0x33919c,_0x4383b1['options']);var _0xd483a={'where':_0x33919c[_0xcbde('0x3e')]};return db['OpenchannelTransferReport'][_0xcbde('0x24')](_0xd483a)[_0xcbde('0x28')](function(_0x414319){_0x261b57[_0xcbde('0x24')]=_0x414319;if(_0x4383b1['query']['includeAll']){_0x33919c['include']=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0xcbde('0x42')](_0x33919c);})[_0xcbde('0x28')](function(_0x3e5c76){_0x261b57['rows']=_0x3e5c76;return _0x261b57;})['then'](respondWithFilteredResult(_0x3f4af1,_0x33919c))['catch'](handleError(_0x3f4af1,null));};exports[_0xcbde('0x43')]=function(_0x1f4223,_0xba0081){var _0x1aa947={'raw':!![],'where':{'id':_0x1f4223[_0xcbde('0x44')]['id']}},_0x3b6c20={};_0x3b6c20['model']=_[_0xcbde('0x36')](db[_0xcbde('0x31')][_0xcbde('0x32')]);_0x3b6c20[_0xcbde('0x35')]=_[_0xcbde('0x36')](_0x1f4223['query']);_0x3b6c20[_0xcbde('0x37')]=_['intersection'](_0x3b6c20[_0xcbde('0x39')],_0x3b6c20[_0xcbde('0x35')]);_0x1aa947[_0xcbde('0x3a')]=_[_0xcbde('0x38')](_0x3b6c20[_0xcbde('0x39')],qs[_0xcbde('0x3b')](_0x1f4223[_0xcbde('0x35')][_0xcbde('0x3b')]));_0x1aa947[_0xcbde('0x3a')]=_0x1aa947['attributes']['length']?_0x1aa947[_0xcbde('0x3a')]:_0x3b6c20[_0xcbde('0x39')];if(_0x1f4223['query'][_0xcbde('0x45')]){_0x1aa947[_0xcbde('0x46')]=[{'all':!![]}];}_0x1aa947=_[_0xcbde('0x40')]({},_0x1aa947,_0x1f4223[_0xcbde('0x47')]);return db[_0xcbde('0x31')]['find'](_0x1aa947)[_0xcbde('0x28')](handleEntityNotFound(_0xba0081,null))[_0xcbde('0x28')](respondWithResult(_0xba0081,null))[_0xcbde('0x48')](handleError(_0xba0081,null));};exports[_0xcbde('0x49')]=function(_0x36a98f,_0x4e69c8){return db[_0xcbde('0x31')][_0xcbde('0x49')](_0x36a98f['body'],{})[_0xcbde('0x28')](respondWithResult(_0x4e69c8,0xc9))['catch'](handleError(_0x4e69c8,null));};exports[_0xcbde('0x4a')]=function(_0x584a21,_0x4481f5){if(_0x584a21[_0xcbde('0x4b')]['id']){delete _0x584a21[_0xcbde('0x4b')]['id'];}return db[_0xcbde('0x31')][_0xcbde('0x4c')]({'where':{'id':_0x584a21['params']['id']}})['then'](handleEntityNotFound(_0x4481f5,null))['then'](saveUpdates(_0x584a21[_0xcbde('0x4b')],null))[_0xcbde('0x28')](respondWithResult(_0x4481f5,null))[_0xcbde('0x48')](handleError(_0x4481f5,null));};exports[_0xcbde('0x29')]=function(_0x2e1f2,_0x50544d){return db[_0xcbde('0x31')][_0xcbde('0x4c')]({'where':{'id':_0x2e1f2[_0xcbde('0x44')]['id']}})['then'](handleEntityNotFound(_0x50544d,null))[_0xcbde('0x28')](removeEntity(_0x50544d,null))[_0xcbde('0x48')](handleError(_0x50544d,null));};exports[_0xcbde('0x4d')]=function(_0x12af2e,_0x60906b){return db['OpenchannelTransferReport'][_0xcbde('0x4d')]()[_0xcbde('0x28')](respondWithResult(_0x60906b,null))[_0xcbde('0x48')](handleError(_0x60906b,null));}; \ No newline at end of file +var _0x29a9=['to-csv','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','reject','save','update','then','destroy','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','OpenchannelTransferReport','includeAll','findAll','catch','show','params','include','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js'];(function(_0x33a053,_0x5c7fd7){var _0x5ad7a8=function(_0x4894f5){while(--_0x4894f5){_0x33a053['push'](_0x33a053['shift']());}};_0x5ad7a8(++_0x5c7fd7);}(_0x29a9,0x19c));var _0x929a=function(_0x5f0488,_0x6c662f){_0x5f0488=_0x5f0488-0x0;var _0x27740d=_0x29a9[_0x5f0488];return _0x27740d;};'use strict';var emlformat=require(_0x929a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x929a('0x1'));var jsonpatch=require(_0x929a('0x2'));var rp=require(_0x929a('0x3'));var moment=require(_0x929a('0x4'));var BPromise=require(_0x929a('0x5'));var Mustache=require(_0x929a('0x6'));var util=require('util');var path=require(_0x929a('0x7'));var sox=require(_0x929a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x929a('0x9'));var squel=require(_0x929a('0xa'));var crypto=require(_0x929a('0xb'));var jsforce=require(_0x929a('0xc'));var deskjs=require(_0x929a('0xd'));var toCsv=require(_0x929a('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x929a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x929a('0x10'));var hardwareService=require(_0x929a('0x11'));var logger=require('../../config/logger')(_0x929a('0x12'));var utils=require(_0x929a('0x13'));var config=require(_0x929a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x929a('0x15'))['db'];function respondWithStatusCode(_0x244d67,_0x5924de){_0x5924de=_0x5924de||0xcc;return function(_0x2b7072){if(_0x2b7072){return _0x244d67[_0x929a('0x16')](_0x5924de);}return _0x244d67['status'](_0x5924de)[_0x929a('0x17')]();};}function respondWithResult(_0x4f8a49,_0x4eb5d4){_0x4eb5d4=_0x4eb5d4||0xc8;return function(_0x5a9cdf){if(_0x5a9cdf){return _0x4f8a49[_0x929a('0x18')](_0x4eb5d4)[_0x929a('0x19')](_0x5a9cdf);}};}function respondWithFilteredResult(_0x5e69c5,_0x2202e6){return function(_0x138899){if(_0x138899){var _0x410d01=typeof _0x2202e6[_0x929a('0x1a')]==='undefined'&&typeof _0x2202e6[_0x929a('0x1b')]===_0x929a('0x1c');var _0x5c4c00=_0x138899[_0x929a('0x1d')];var _0x4a2446=_0x410d01?0x0:_0x2202e6[_0x929a('0x1a')];var _0x5c4867=_0x410d01?_0x138899[_0x929a('0x1d')]:_0x2202e6[_0x929a('0x1a')]+_0x2202e6['limit'];var _0x5f1c33;if(_0x5c4867>=_0x5c4c00){_0x5c4867=_0x5c4c00;_0x5f1c33=0xc8;}else{_0x5f1c33=0xce;}_0x5e69c5[_0x929a('0x18')](_0x5f1c33);return _0x5e69c5[_0x929a('0x1e')]('Content-Range',_0x4a2446+'-'+_0x5c4867+'/'+_0x5c4c00)['json'](_0x138899);}return null;};}function patchUpdates(_0x46ff4e){return function(_0x1ab7d8){try{jsonpatch['apply'](_0x1ab7d8,_0x46ff4e,!![]);}catch(_0x3d7112){return BPromise[_0x929a('0x1f')](_0x3d7112);}return _0x1ab7d8[_0x929a('0x20')]();};}function saveUpdates(_0x2cc76f,_0x4707f2){return function(_0x90e3bf){if(_0x90e3bf){return _0x90e3bf[_0x929a('0x21')](_0x2cc76f)[_0x929a('0x22')](function(_0x24025b){return _0x24025b;});}return null;};}function removeEntity(_0x4d7fbc,_0x43cd67){return function(_0x56147b){if(_0x56147b){return _0x56147b[_0x929a('0x23')]()[_0x929a('0x22')](function(){_0x4d7fbc[_0x929a('0x18')](0xcc)[_0x929a('0x17')]();});}};}function handleEntityNotFound(_0x2e42ba,_0x515d39){return function(_0x557d7a){if(!_0x557d7a){_0x2e42ba[_0x929a('0x16')](0x194);}return _0x557d7a;};}function handleError(_0xb32916,_0x3bf5e6){_0x3bf5e6=_0x3bf5e6||0x1f4;return function(_0x267b7e){logger['error'](_0x267b7e['stack']);if(_0x267b7e[_0x929a('0x24')]){delete _0x267b7e[_0x929a('0x24')];}_0xb32916[_0x929a('0x18')](_0x3bf5e6)[_0x929a('0x25')](_0x267b7e);};}exports[_0x929a('0x26')]=function(_0x2878ae,_0xcd3ab9){var _0x514f0e={},_0x4a24c4={},_0x3e3653={'count':0x0,'rows':[]};var _0x5310b1=_[_0x929a('0x27')](db['OpenchannelTransferReport'][_0x929a('0x28')],function(_0x3f1624){return{'name':_0x3f1624[_0x929a('0x29')],'type':_0x3f1624[_0x929a('0x2a')]['key']};});_0x4a24c4[_0x929a('0x2b')]=_[_0x929a('0x27')](_0x5310b1,_0x929a('0x24'));_0x4a24c4[_0x929a('0x2c')]=_[_0x929a('0x2d')](_0x2878ae[_0x929a('0x2c')]);_0x4a24c4[_0x929a('0x2e')]=_[_0x929a('0x2f')](_0x4a24c4[_0x929a('0x2b')],_0x4a24c4[_0x929a('0x2c')]);_0x514f0e[_0x929a('0x30')]=_['intersection'](_0x4a24c4[_0x929a('0x2b')],qs[_0x929a('0x31')](_0x2878ae[_0x929a('0x2c')][_0x929a('0x31')]));_0x514f0e[_0x929a('0x30')]=_0x514f0e['attributes'][_0x929a('0x32')]?_0x514f0e[_0x929a('0x30')]:_0x4a24c4['model'];if(!_0x2878ae['query'][_0x929a('0x33')](_0x929a('0x34'))){_0x514f0e[_0x929a('0x1b')]=qs[_0x929a('0x1b')](_0x2878ae[_0x929a('0x2c')]['limit']);_0x514f0e['offset']=qs['offset'](_0x2878ae['query'][_0x929a('0x1a')]);}_0x514f0e[_0x929a('0x35')]=qs[_0x929a('0x36')](_0x2878ae[_0x929a('0x2c')]['sort']);_0x514f0e[_0x929a('0x37')]=qs['filters'](_[_0x929a('0x38')](_0x2878ae[_0x929a('0x2c')],_0x4a24c4[_0x929a('0x2e')]),_0x5310b1);if(_0x2878ae[_0x929a('0x2c')][_0x929a('0x39')]){_0x514f0e['where']=_[_0x929a('0x3a')](_0x514f0e['where'],{'$or':_[_0x929a('0x27')](_0x5310b1,function(_0x3ad237){if(_0x3ad237[_0x929a('0x2a')]!=='VIRTUAL'){var _0x33b08a={};_0x33b08a[_0x3ad237[_0x929a('0x24')]]={'$like':'%'+_0x2878ae['query']['filter']+'%'};return _0x33b08a;}})});}_0x514f0e=_[_0x929a('0x3a')]({},_0x514f0e,_0x2878ae[_0x929a('0x3b')]);var _0xb5d4d8={'where':_0x514f0e['where']};return db[_0x929a('0x3c')][_0x929a('0x1d')](_0xb5d4d8)[_0x929a('0x22')](function(_0x26db9e){_0x3e3653[_0x929a('0x1d')]=_0x26db9e;if(_0x2878ae[_0x929a('0x2c')][_0x929a('0x3d')]){_0x514f0e['include']=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x929a('0x3e')](_0x514f0e);})[_0x929a('0x22')](function(_0x5bbbd1){_0x3e3653['rows']=_0x5bbbd1;return _0x3e3653;})[_0x929a('0x22')](respondWithFilteredResult(_0xcd3ab9,_0x514f0e))[_0x929a('0x3f')](handleError(_0xcd3ab9,null));};exports[_0x929a('0x40')]=function(_0x3ebfea,_0x1ed6da){var _0x2681b6={'raw':!![],'where':{'id':_0x3ebfea[_0x929a('0x41')]['id']}},_0x277a68={};_0x277a68[_0x929a('0x2b')]=_[_0x929a('0x2d')](db['OpenchannelTransferReport'][_0x929a('0x28')]);_0x277a68[_0x929a('0x2c')]=_['keys'](_0x3ebfea['query']);_0x277a68[_0x929a('0x2e')]=_[_0x929a('0x2f')](_0x277a68[_0x929a('0x2b')],_0x277a68[_0x929a('0x2c')]);_0x2681b6[_0x929a('0x30')]=_[_0x929a('0x2f')](_0x277a68[_0x929a('0x2b')],qs[_0x929a('0x31')](_0x3ebfea[_0x929a('0x2c')]['fields']));_0x2681b6[_0x929a('0x30')]=_0x2681b6['attributes'][_0x929a('0x32')]?_0x2681b6[_0x929a('0x30')]:_0x277a68[_0x929a('0x2b')];if(_0x3ebfea[_0x929a('0x2c')][_0x929a('0x3d')]){_0x2681b6[_0x929a('0x42')]=[{'all':!![]}];}_0x2681b6=_[_0x929a('0x3a')]({},_0x2681b6,_0x3ebfea[_0x929a('0x3b')]);return db[_0x929a('0x3c')][_0x929a('0x43')](_0x2681b6)['then'](handleEntityNotFound(_0x1ed6da,null))[_0x929a('0x22')](respondWithResult(_0x1ed6da,null))[_0x929a('0x3f')](handleError(_0x1ed6da,null));};exports[_0x929a('0x44')]=function(_0x12b1cf,_0x421cdc){return db[_0x929a('0x3c')][_0x929a('0x44')](_0x12b1cf[_0x929a('0x45')],{})[_0x929a('0x22')](respondWithResult(_0x421cdc,0xc9))[_0x929a('0x3f')](handleError(_0x421cdc,null));};exports['update']=function(_0x45f79f,_0x340f6e){if(_0x45f79f[_0x929a('0x45')]['id']){delete _0x45f79f[_0x929a('0x45')]['id'];}return db[_0x929a('0x3c')][_0x929a('0x43')]({'where':{'id':_0x45f79f['params']['id']}})[_0x929a('0x22')](handleEntityNotFound(_0x340f6e,null))[_0x929a('0x22')](saveUpdates(_0x45f79f[_0x929a('0x45')],null))[_0x929a('0x22')](respondWithResult(_0x340f6e,null))[_0x929a('0x3f')](handleError(_0x340f6e,null));};exports[_0x929a('0x23')]=function(_0x332f38,_0x2ff0e8){return db['OpenchannelTransferReport']['find']({'where':{'id':_0x332f38['params']['id']}})['then'](handleEntityNotFound(_0x2ff0e8,null))[_0x929a('0x22')](removeEntity(_0x2ff0e8,null))[_0x929a('0x3f')](handleError(_0x2ff0e8,null));};exports[_0x929a('0x46')]=function(_0x172b1a,_0x3ffa63){return db[_0x929a('0x3c')]['describe']()[_0x929a('0x22')](respondWithResult(_0x3ffa63,null))[_0x929a('0x3f')](handleError(_0x3ffa63,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 1a4c891..da1603b 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 _0xef24=['OpenchannelTransferReport','uniqueid','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelTransferReport.attributes','exports','define'];(function(_0x1e4296,_0x47b40c){var _0x36fae6=function(_0x57f86b){while(--_0x57f86b){_0x1e4296['push'](_0x1e4296['shift']());}};_0x36fae6(++_0x47b40c);}(_0xef24,0x1b2));var _0x4ef2=function(_0x38c8ef,_0x223a33){_0x38c8ef=_0x38c8ef-0x0;var _0x379dad=_0xef24[_0x38c8ef];return _0x379dad;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4ef2('0x0'))(_0x4ef2('0x1'));var moment=require(_0x4ef2('0x2'));var BPromise=require(_0x4ef2('0x3'));var rp=require(_0x4ef2('0x4'));var fs=require('fs');var path=require(_0x4ef2('0x5'));var rimraf=require('rimraf');var config=require(_0x4ef2('0x6'));var attributes=require(_0x4ef2('0x7'));module[_0x4ef2('0x8')]=function(_0x419c29,_0x409e09){return _0x419c29[_0x4ef2('0x9')](_0x4ef2('0xa'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x4ef2('0xb'),'fields':[_0x4ef2('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x73e9=['report_openchannel_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','OpenchannelTransferReport'];(function(_0x562fdb,_0x5684bb){var _0x318876=function(_0xcd34d9){while(--_0xcd34d9){_0x562fdb['push'](_0x562fdb['shift']());}};_0x318876(++_0x5684bb);}(_0x73e9,0x1af));var _0x973e=function(_0x26158a,_0x35e5ab){_0x26158a=_0x26158a-0x0;var _0x1cf4ac=_0x73e9[_0x26158a];return _0x1cf4ac;};'use strict';var _=require(_0x973e('0x0'));var util=require('util');var logger=require(_0x973e('0x1'))(_0x973e('0x2'));var moment=require(_0x973e('0x3'));var BPromise=require(_0x973e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x973e('0x5'));var rimraf=require(_0x973e('0x6'));var config=require(_0x973e('0x7'));var attributes=require('./openchannelTransferReport.attributes');module[_0x973e('0x8')]=function(_0x3f1b7b,_0x414890){return _0x3f1b7b[_0x973e('0x9')](_0x973e('0xa'),attributes,{'tableName':_0x973e('0xb'),'paranoid':![],'indexes':[{'name':_0x973e('0xc'),'fields':[_0x973e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 914f983..1305059 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 _0x91c6=['request','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x23224c,_0x482d9b){var _0xa86d0d=function(_0x4cfa72){while(--_0x4cfa72){_0x23224c['push'](_0x23224c['shift']());}};_0xa86d0d(++_0x482d9b);}(_0x91c6,0xf9));var _0x691c=function(_0x4dac0f,_0x57c3ac){_0x4dac0f=_0x4dac0f-0x0;var _0x4b245e=_0x91c6[_0x4dac0f];return _0x4b245e;};'use strict';var _=require(_0x691c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x691c('0x1'));var rs=require(_0x691c('0x2'));var fs=require('fs');var Redis=require(_0x691c('0x3'));var db=require(_0x691c('0x4'))['db'];var utils=require(_0x691c('0x5'));var logger=require('../../config/logger')(_0x691c('0x6'));var config=require(_0x691c('0x7'));var jayson=require(_0x691c('0x8'));var client=jayson[_0x691c('0x9')][_0x691c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29876a,_0x5ccbe0,_0x93b7b0){return new BPromise(function(_0x40629a,_0xda904f){return client[_0x691c('0xb')](_0x29876a,_0x93b7b0)['then'](function(_0x2cfa1f){logger[_0x691c('0xc')](_0x691c('0xd'),_0x5ccbe0,'request\x20sent');logger['debug']('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x5ccbe0,_0x691c('0xe'),JSON[_0x691c('0xf')](_0x2cfa1f));if(_0x2cfa1f[_0x691c('0x10')]){if(_0x2cfa1f[_0x691c('0x10')]['code']===0x1f4){logger['error'](_0x691c('0xd'),_0x5ccbe0,_0x2cfa1f[_0x691c('0x10')][_0x691c('0x11')]);return _0xda904f(_0x2cfa1f[_0x691c('0x10')][_0x691c('0x11')]);}logger[_0x691c('0x10')](_0x691c('0xd'),_0x5ccbe0,_0x2cfa1f[_0x691c('0x10')]['message']);return _0x40629a(_0x2cfa1f[_0x691c('0x10')][_0x691c('0x11')]);}else{logger[_0x691c('0xc')](_0x691c('0xd'),_0x5ccbe0,_0x691c('0xe'));_0x40629a(_0x2cfa1f[_0x691c('0x12')][_0x691c('0x11')]);}})[_0x691c('0x13')](function(_0x482351){logger[_0x691c('0x10')](_0x691c('0xd'),_0x5ccbe0,_0x482351);_0xda904f(_0x482351);});});} \ No newline at end of file +var _0x9f5a=['client','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x2e9ffd,_0x596e19){var _0x4d1482=function(_0xf0abef){while(--_0xf0abef){_0x2e9ffd['push'](_0x2e9ffd['shift']());}};_0x4d1482(++_0x596e19);}(_0x9f5a,0xbd));var _0xa9f5=function(_0xca6724,_0x5a7acf){_0xca6724=_0xca6724-0x0;var _0xe77a99=_0x9f5a[_0xca6724];return _0xe77a99;};'use strict';var _=require(_0xa9f5('0x0'));var util=require(_0xa9f5('0x1'));var moment=require(_0xa9f5('0x2'));var BPromise=require(_0xa9f5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa9f5('0x4'));var db=require(_0xa9f5('0x5'))['db'];var utils=require(_0xa9f5('0x6'));var logger=require('../../config/logger')(_0xa9f5('0x7'));var config=require('../../config/environment');var jayson=require(_0xa9f5('0x8'));var client=jayson[_0xa9f5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6c040d,_0x285dad,_0x3f644f){return new BPromise(function(_0x1f6c78,_0x21006b){return client[_0xa9f5('0xa')](_0x6c040d,_0x3f644f)[_0xa9f5('0xb')](function(_0x4cb5a5){logger[_0xa9f5('0xc')](_0xa9f5('0xd'),_0x285dad,'request\x20sent');logger[_0xa9f5('0xe')](_0xa9f5('0xf'),_0x285dad,'request\x20sent',JSON['stringify'](_0x4cb5a5));if(_0x4cb5a5[_0xa9f5('0x10')]){if(_0x4cb5a5[_0xa9f5('0x10')][_0xa9f5('0x11')]===0x1f4){logger[_0xa9f5('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x285dad,_0x4cb5a5[_0xa9f5('0x10')][_0xa9f5('0x12')]);return _0x21006b(_0x4cb5a5[_0xa9f5('0x10')]['message']);}logger[_0xa9f5('0x10')](_0xa9f5('0xd'),_0x285dad,_0x4cb5a5['error']['message']);return _0x1f6c78(_0x4cb5a5['error'][_0xa9f5('0x12')]);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x285dad,_0xa9f5('0x13'));_0x1f6c78(_0x4cb5a5[_0xa9f5('0x14')][_0xa9f5('0x12')]);}})[_0xa9f5('0x15')](function(_0x4c70f0){logger[_0xa9f5('0x10')](_0xa9f5('0xd'),_0x285dad,_0x4c70f0);_0x21006b(_0x4c70f0);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index d19943b..6370585 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 _0x780d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','/:id','post','create','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x5c0944,_0x1eae68){var _0x17fa50=function(_0x4df239){while(--_0x4df239){_0x5c0944['push'](_0x5c0944['shift']());}};_0x17fa50(++_0x1eae68);}(_0x780d,0x10a));var _0xd780=function(_0x227543,_0x417820){_0x227543=_0x227543-0x0;var _0x156565=_0x780d[_0x227543];return _0x156565;};'use strict';var multer=require(_0xd780('0x0'));var util=require(_0xd780('0x1'));var path=require('path');var timeout=require(_0xd780('0x2'));var express=require(_0xd780('0x3'));var router=express[_0xd780('0x4')]();var fs_extra=require(_0xd780('0x5'));var auth=require(_0xd780('0x6'));var interaction=require(_0xd780('0x7'));var config=require(_0xd780('0x8'));var controller=require(_0xd780('0x9'));router[_0xd780('0xa')]('/',auth[_0xd780('0xb')](),controller['index']);router[_0xd780('0xa')](_0xd780('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xd780('0xd')]('/',auth[_0xd780('0xb')](),controller[_0xd780('0xe')]);router['put'](_0xd780('0xc'),auth[_0xd780('0xb')](),controller['update']);router['delete'](_0xd780('0xc'),auth[_0xd780('0xb')](),controller['destroy']);module[_0xd780('0xf')]=router; \ No newline at end of file +var _0x53d1=['../../components/auth/service','../../config/environment','./pause.controller','get','index','/:id','show','isAuthenticated','create','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x503f7c,_0x4432b2){var _0x551f00=function(_0x5e0280){while(--_0x5e0280){_0x503f7c['push'](_0x503f7c['shift']());}};_0x551f00(++_0x4432b2);}(_0x53d1,0x174));var _0x153d=function(_0x468e81,_0x3aae7a){_0x468e81=_0x468e81-0x0;var _0xde4fb=_0x53d1[_0x468e81];return _0xde4fb;};'use strict';var multer=require(_0x153d('0x0'));var util=require(_0x153d('0x1'));var path=require('path');var timeout=require(_0x153d('0x2'));var express=require(_0x153d('0x3'));var router=express[_0x153d('0x4')]();var fs_extra=require(_0x153d('0x5'));var auth=require(_0x153d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x153d('0x7'));var controller=require(_0x153d('0x8'));router[_0x153d('0x9')]('/',auth['isAuthenticated'](),controller[_0x153d('0xa')]);router[_0x153d('0x9')](_0x153d('0xb'),auth['isAuthenticated'](),controller[_0x153d('0xc')]);router['post']('/',auth[_0x153d('0xd')](),controller[_0x153d('0xe')]);router['put'](_0x153d('0xb'),auth[_0x153d('0xd')](),controller[_0x153d('0xf')]);router['delete'](_0x153d('0xb'),auth[_0x153d('0xd')](),controller[_0x153d('0x10')]);module[_0x153d('0x11')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 4d8e94b..14095fa 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 _0xdb14=['STRING','sequelize','exports','name'];(function(_0x110fcd,_0x1cbd47){var _0x13fd87=function(_0x4c0ce5){while(--_0x4c0ce5){_0x110fcd['push'](_0x110fcd['shift']());}};_0x13fd87(++_0x1cbd47);}(_0xdb14,0x18d));var _0x4db1=function(_0x55b9dc,_0x2c7227){_0x55b9dc=_0x55b9dc-0x0;var _0x15d404=_0xdb14[_0x55b9dc];return _0x15d404;};'use strict';var Sequelize=require(_0x4db1('0x0'));module[_0x4db1('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x4db1('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x4db1('0x3')]}}; \ No newline at end of file +var _0x6a8c=['STRING','sequelize'];(function(_0x3c4208,_0x22a6ca){var _0x2e2b75=function(_0x1b5f4c){while(--_0x1b5f4c){_0x3c4208['push'](_0x3c4208['shift']());}};_0x2e2b75(++_0x22a6ca);}(_0x6a8c,0x1b7));var _0xc6a8=function(_0x3054f8,_0x1e6528){_0x3054f8=_0x3054f8-0x0;var _0x45d366=_0x6a8c[_0x3054f8];return _0x45d366;};'use strict';var Sequelize=require(_0xc6a8('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xc6a8('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 29e9301..5cbc137 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 _0xb5da=['UserProfileResource','error','stack','name','send','map','Pause','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','include','find','create','body','get','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','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','limit','undefined','set','Content-Range','apply','reject','save','update','then','destroy','Pauses'];(function(_0x3ebd13,_0x48e271){var _0x527ef6=function(_0x373a85){while(--_0x373a85){_0x3ebd13['push'](_0x3ebd13['shift']());}};_0x527ef6(++_0x48e271);}(_0xb5da,0xd7));var _0xab5d=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb5da[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xab5d('0x0'));var zipdir=require(_0xab5d('0x1'));var jsonpatch=require(_0xab5d('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xab5d('0x3'));var Mustache=require('mustache');var util=require(_0xab5d('0x4'));var path=require(_0xab5d('0x5'));var sox=require(_0xab5d('0x6'));var csv=require(_0xab5d('0x7'));var ejs=require(_0xab5d('0x8'));var fs=require('fs');var fs_extra=require(_0xab5d('0x9'));var _=require('lodash');var squel=require(_0xab5d('0xa'));var crypto=require('crypto');var jsforce=require(_0xab5d('0xb'));var deskjs=require(_0xab5d('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xab5d('0xd'));var Redis=require(_0xab5d('0xe'));var authService=require(_0xab5d('0xf'));var qs=require(_0xab5d('0x10'));var as=require(_0xab5d('0x11'));var hardwareService=require(_0xab5d('0x12'));var logger=require(_0xab5d('0x13'))(_0xab5d('0x14'));var utils=require('../../config/utils');var config=require(_0xab5d('0x15'));var licenseUtil=require(_0xab5d('0x16'));var db=require(_0xab5d('0x17'))['db'];function respondWithStatusCode(_0x9ea2df,_0x3a87df){_0x3a87df=_0x3a87df||0xcc;return function(_0x571584){if(_0x571584){return _0x9ea2df[_0xab5d('0x18')](_0x3a87df);}return _0x9ea2df[_0xab5d('0x19')](_0x3a87df)[_0xab5d('0x1a')]();};}function respondWithResult(_0x1015ef,_0x471430){_0x471430=_0x471430||0xc8;return function(_0x21f472){if(_0x21f472){return _0x1015ef['status'](_0x471430)[_0xab5d('0x1b')](_0x21f472);}};}function respondWithFilteredResult(_0x47e607,_0x4a1bb9){return function(_0x532a52){if(_0x532a52){var _0x58babb=typeof _0x4a1bb9[_0xab5d('0x1c')]==='undefined'&&typeof _0x4a1bb9[_0xab5d('0x1d')]===_0xab5d('0x1e');var _0x10bc8d=_0x532a52['count'];var _0x28a825=_0x58babb?0x0:_0x4a1bb9['offset'];var _0x4116d1=_0x58babb?_0x532a52['count']:_0x4a1bb9[_0xab5d('0x1c')]+_0x4a1bb9[_0xab5d('0x1d')];var _0x3129ac;if(_0x4116d1>=_0x10bc8d){_0x4116d1=_0x10bc8d;_0x3129ac=0xc8;}else{_0x3129ac=0xce;}_0x47e607[_0xab5d('0x19')](_0x3129ac);return _0x47e607[_0xab5d('0x1f')](_0xab5d('0x20'),_0x28a825+'-'+_0x4116d1+'/'+_0x10bc8d)[_0xab5d('0x1b')](_0x532a52);}return null;};}function patchUpdates(_0x17e4e6){return function(_0x9dc1d2){try{jsonpatch[_0xab5d('0x21')](_0x9dc1d2,_0x17e4e6,!![]);}catch(_0x3fed3c){return BPromise[_0xab5d('0x22')](_0x3fed3c);}return _0x9dc1d2[_0xab5d('0x23')]();};}function saveUpdates(_0x467ba7,_0x3f4373){return function(_0x425e79){if(_0x425e79){return _0x425e79[_0xab5d('0x24')](_0x467ba7)[_0xab5d('0x25')](function(_0x2b69a8){return _0x2b69a8;});}return null;};}function removeEntity(_0xd6e9c7,_0x59efe2){return function(_0x151f6a){if(_0x151f6a){return _0x151f6a[_0xab5d('0x26')]()[_0xab5d('0x25')](function(){var _0x45300d=_0x151f6a['get']({'plain':!![]});var _0x59f9e6=_0xab5d('0x27');return db[_0xab5d('0x28')][_0xab5d('0x26')]({'where':{'type':_0x59f9e6,'resourceId':_0x45300d['id']}})[_0xab5d('0x25')](function(){return _0x151f6a;});})['then'](function(){_0xd6e9c7[_0xab5d('0x19')](0xcc)[_0xab5d('0x1a')]();});}};}function handleEntityNotFound(_0x2f538f,_0x2fa232){return function(_0x195aef){if(!_0x195aef){_0x2f538f[_0xab5d('0x18')](0x194);}return _0x195aef;};}function handleError(_0x278406,_0x3b1bd1){_0x3b1bd1=_0x3b1bd1||0x1f4;return function(_0x4d69ba){logger[_0xab5d('0x29')](_0x4d69ba[_0xab5d('0x2a')]);if(_0x4d69ba[_0xab5d('0x2b')]){delete _0x4d69ba[_0xab5d('0x2b')];}_0x278406[_0xab5d('0x19')](_0x3b1bd1)[_0xab5d('0x2c')](_0x4d69ba);};}exports['index']=function(_0x4d2875,_0x28b736){var _0x124134={},_0x1af9ac={},_0x309253={'count':0x0,'rows':[]};var _0x4a7905=_[_0xab5d('0x2d')](db[_0xab5d('0x2e')][_0xab5d('0x2f')],function(_0x4054bf){return{'name':_0x4054bf['fieldName'],'type':_0x4054bf['type'][_0xab5d('0x30')]};});_0x1af9ac[_0xab5d('0x31')]=_['map'](_0x4a7905,_0xab5d('0x2b'));_0x1af9ac[_0xab5d('0x32')]=_[_0xab5d('0x33')](_0x4d2875[_0xab5d('0x32')]);_0x1af9ac[_0xab5d('0x34')]=_['intersection'](_0x1af9ac[_0xab5d('0x31')],_0x1af9ac[_0xab5d('0x32')]);_0x124134[_0xab5d('0x35')]=_[_0xab5d('0x36')](_0x1af9ac['model'],qs['fields'](_0x4d2875[_0xab5d('0x32')][_0xab5d('0x37')]));_0x124134[_0xab5d('0x35')]=_0x124134['attributes'][_0xab5d('0x38')]?_0x124134[_0xab5d('0x35')]:_0x1af9ac[_0xab5d('0x31')];if(!_0x4d2875[_0xab5d('0x32')]['hasOwnProperty'](_0xab5d('0x39'))){_0x124134['limit']=qs['limit'](_0x4d2875[_0xab5d('0x32')][_0xab5d('0x1d')]);_0x124134[_0xab5d('0x1c')]=qs[_0xab5d('0x1c')](_0x4d2875[_0xab5d('0x32')]['offset']);}_0x124134[_0xab5d('0x3a')]=qs['sort'](_0x4d2875[_0xab5d('0x32')][_0xab5d('0x3b')]);_0x124134[_0xab5d('0x3c')]=qs[_0xab5d('0x34')](_[_0xab5d('0x3d')](_0x4d2875['query'],_0x1af9ac[_0xab5d('0x34')]),_0x4a7905);if(_0x4d2875[_0xab5d('0x32')][_0xab5d('0x3e')]){_0x124134[_0xab5d('0x3c')]=_[_0xab5d('0x3f')](_0x124134[_0xab5d('0x3c')],{'$or':_['map'](_0x4a7905,function(_0x318861){if(_0x318861[_0xab5d('0x40')]!==_0xab5d('0x41')){var _0x991746={};_0x991746[_0x318861[_0xab5d('0x2b')]]={'$like':'%'+_0x4d2875[_0xab5d('0x32')][_0xab5d('0x3e')]+'%'};return _0x991746;}})});}_0x124134=_[_0xab5d('0x3f')]({},_0x124134,_0x4d2875[_0xab5d('0x42')]);var _0x4ddaf5={'where':_0x124134[_0xab5d('0x3c')]};return db[_0xab5d('0x2e')][_0xab5d('0x43')](_0x4ddaf5)[_0xab5d('0x25')](function(_0x16aec8){_0x309253[_0xab5d('0x43')]=_0x16aec8;if(_0x4d2875['query'][_0xab5d('0x44')]){_0x124134['include']=[{'all':!![]}];}return db[_0xab5d('0x2e')][_0xab5d('0x45')](_0x124134);})[_0xab5d('0x25')](function(_0x4999ef){_0x309253[_0xab5d('0x46')]=_0x4999ef;return _0x309253;})['then'](respondWithFilteredResult(_0x28b736,_0x124134))[_0xab5d('0x47')](handleError(_0x28b736,null));};exports[_0xab5d('0x48')]=function(_0x5a1934,_0x1c2e19){var _0x5bbeab={'raw':!![],'where':{'id':_0x5a1934[_0xab5d('0x49')]['id']}},_0x41768b={};_0x41768b[_0xab5d('0x31')]=_[_0xab5d('0x33')](db[_0xab5d('0x2e')][_0xab5d('0x2f')]);_0x41768b[_0xab5d('0x32')]=_[_0xab5d('0x33')](_0x5a1934[_0xab5d('0x32')]);_0x41768b[_0xab5d('0x34')]=_[_0xab5d('0x36')](_0x41768b[_0xab5d('0x31')],_0x41768b[_0xab5d('0x32')]);_0x5bbeab[_0xab5d('0x35')]=_[_0xab5d('0x36')](_0x41768b[_0xab5d('0x31')],qs[_0xab5d('0x37')](_0x5a1934[_0xab5d('0x32')]['fields']));_0x5bbeab['attributes']=_0x5bbeab[_0xab5d('0x35')][_0xab5d('0x38')]?_0x5bbeab[_0xab5d('0x35')]:_0x41768b['model'];if(_0x5a1934[_0xab5d('0x32')]['includeAll']){_0x5bbeab[_0xab5d('0x4a')]=[{'all':!![]}];}_0x5bbeab=_[_0xab5d('0x3f')]({},_0x5bbeab,_0x5a1934[_0xab5d('0x42')]);return db[_0xab5d('0x2e')][_0xab5d('0x4b')](_0x5bbeab)['then'](handleEntityNotFound(_0x1c2e19,null))[_0xab5d('0x25')](respondWithResult(_0x1c2e19,null))[_0xab5d('0x47')](handleError(_0x1c2e19,null));};exports[_0xab5d('0x4c')]=function(_0x3eeaf7,_0x1131b5){return db['Pause'][_0xab5d('0x4c')](_0x3eeaf7[_0xab5d('0x4d')],{})[_0xab5d('0x25')](function(_0x1621a6){var _0x37bc83=_0x3eeaf7['user'][_0xab5d('0x4e')]({'plain':!![]});if(!_0x37bc83)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x37bc83[_0xab5d('0x4f')]===_0xab5d('0x50')){var _0x37b790=_0x1621a6[_0xab5d('0x4e')]({'plain':!![]});var _0x16c160='Pauses';return db[_0xab5d('0x51')][_0xab5d('0x4b')]({'where':{'name':_0x16c160,'userProfileId':_0x37bc83[_0xab5d('0x52')]},'raw':!![]})[_0xab5d('0x25')](function(_0x45d993){if(_0x45d993&&_0x45d993[_0xab5d('0x53')]===0x0){return db['UserProfileResource'][_0xab5d('0x4c')]({'name':_0x37b790[_0xab5d('0x2b')],'resourceId':_0x37b790['id'],'type':_0x45d993['name'],'sectionId':_0x45d993['id']},{})[_0xab5d('0x25')](function(){return _0x1621a6;});}else{return _0x1621a6;}})[_0xab5d('0x47')](function(_0x216c66){logger[_0xab5d('0x29')](_0xab5d('0x54'),_0x216c66);throw _0x216c66;});}return _0x1621a6;})[_0xab5d('0x25')](respondWithResult(_0x1131b5,0xc9))[_0xab5d('0x47')](handleError(_0x1131b5,null));};exports['update']=function(_0x19e409,_0x47667a){if(_0x19e409['body']['id']){delete _0x19e409[_0xab5d('0x4d')]['id'];}return db[_0xab5d('0x2e')][_0xab5d('0x4b')]({'where':{'id':_0x19e409[_0xab5d('0x49')]['id']}})[_0xab5d('0x25')](handleEntityNotFound(_0x47667a,null))['then'](saveUpdates(_0x19e409['body'],null))['then'](respondWithResult(_0x47667a,null))['catch'](handleError(_0x47667a,null));};exports['destroy']=function(_0x2701c1,_0x14ec53){return db[_0xab5d('0x2e')][_0xab5d('0x4b')]({'where':{'id':_0x2701c1[_0xab5d('0x49')]['id']}})[_0xab5d('0x25')](handleEntityNotFound(_0x14ec53,null))['then'](removeEntity(_0x14ec53,null))['catch'](handleError(_0x14ec53,null));}; \ No newline at end of file +var _0xc04a=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../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','then','destroy','get','UserProfileResource','stack','name','index','map','Pause','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce'];(function(_0x26abf6,_0x617188){var _0x590f20=function(_0x52fdf8){while(--_0x52fdf8){_0x26abf6['push'](_0x26abf6['shift']());}};_0x590f20(++_0x617188);}(_0xc04a,0x9a));var _0xac04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc04a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xac04('0x0'));var zipdir=require(_0xac04('0x1'));var jsonpatch=require(_0xac04('0x2'));var rp=require('request-promise');var moment=require(_0xac04('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xac04('0x4'));var util=require(_0xac04('0x5'));var path=require('path');var sox=require(_0xac04('0x6'));var csv=require(_0xac04('0x7'));var ejs=require(_0xac04('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xac04('0x9'));var crypto=require(_0xac04('0xa'));var jsforce=require(_0xac04('0xb'));var deskjs=require(_0xac04('0xc'));var toCsv=require('to-csv');var querystring=require(_0xac04('0xd'));var Papa=require(_0xac04('0xe'));var Redis=require(_0xac04('0xf'));var authService=require(_0xac04('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xac04('0x11'))(_0xac04('0x12'));var utils=require(_0xac04('0x13'));var config=require(_0xac04('0x14'));var licenseUtil=require(_0xac04('0x15'));var db=require(_0xac04('0x16'))['db'];function respondWithStatusCode(_0x5d2208,_0x5b4fd3){_0x5b4fd3=_0x5b4fd3||0xcc;return function(_0x3474d6){if(_0x3474d6){return _0x5d2208[_0xac04('0x17')](_0x5b4fd3);}return _0x5d2208[_0xac04('0x18')](_0x5b4fd3)[_0xac04('0x19')]();};}function respondWithResult(_0x212a89,_0x4c6729){_0x4c6729=_0x4c6729||0xc8;return function(_0x10fbf9){if(_0x10fbf9){return _0x212a89['status'](_0x4c6729)[_0xac04('0x1a')](_0x10fbf9);}};}function respondWithFilteredResult(_0x4f7d42,_0xc8b3a9){return function(_0x116281){if(_0x116281){var _0x5dade2=typeof _0xc8b3a9['offset']===_0xac04('0x1b')&&typeof _0xc8b3a9[_0xac04('0x1c')]===_0xac04('0x1b');var _0x231877=_0x116281[_0xac04('0x1d')];var _0xdeb18=_0x5dade2?0x0:_0xc8b3a9['offset'];var _0x46d0e2=_0x5dade2?_0x116281[_0xac04('0x1d')]:_0xc8b3a9[_0xac04('0x1e')]+_0xc8b3a9[_0xac04('0x1c')];var _0x582961;if(_0x46d0e2>=_0x231877){_0x46d0e2=_0x231877;_0x582961=0xc8;}else{_0x582961=0xce;}_0x4f7d42[_0xac04('0x18')](_0x582961);return _0x4f7d42[_0xac04('0x1f')](_0xac04('0x20'),_0xdeb18+'-'+_0x46d0e2+'/'+_0x231877)[_0xac04('0x1a')](_0x116281);}return null;};}function patchUpdates(_0x5731b8){return function(_0x17068e){try{jsonpatch[_0xac04('0x21')](_0x17068e,_0x5731b8,!![]);}catch(_0x1f823b){return BPromise[_0xac04('0x22')](_0x1f823b);}return _0x17068e[_0xac04('0x23')]();};}function saveUpdates(_0x5a54a0,_0x4ac056){return function(_0x248563){if(_0x248563){return _0x248563['update'](_0x5a54a0)[_0xac04('0x24')](function(_0x4c7471){return _0x4c7471;});}return null;};}function removeEntity(_0x3f1038,_0x13e73b){return function(_0x49f40e){if(_0x49f40e){return _0x49f40e[_0xac04('0x25')]()[_0xac04('0x24')](function(){var _0xdd431f=_0x49f40e[_0xac04('0x26')]({'plain':!![]});var _0x56164e='Pauses';return db[_0xac04('0x27')]['destroy']({'where':{'type':_0x56164e,'resourceId':_0xdd431f['id']}})['then'](function(){return _0x49f40e;});})[_0xac04('0x24')](function(){_0x3f1038[_0xac04('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x454cd9,_0x18b94c){return function(_0x270426){if(!_0x270426){_0x454cd9[_0xac04('0x17')](0x194);}return _0x270426;};}function handleError(_0x277ee9,_0x1de563){_0x1de563=_0x1de563||0x1f4;return function(_0x1b8067){logger['error'](_0x1b8067[_0xac04('0x28')]);if(_0x1b8067[_0xac04('0x29')]){delete _0x1b8067[_0xac04('0x29')];}_0x277ee9['status'](_0x1de563)['send'](_0x1b8067);};}exports[_0xac04('0x2a')]=function(_0x5c2605,_0x4955a0){var _0x526edf={},_0x4e3e02={},_0x577c25={'count':0x0,'rows':[]};var _0x5a07ae=_[_0xac04('0x2b')](db[_0xac04('0x2c')][_0xac04('0x2d')],function(_0x4aeaaa){return{'name':_0x4aeaaa[_0xac04('0x2e')],'type':_0x4aeaaa[_0xac04('0x2f')][_0xac04('0x30')]};});_0x4e3e02['model']=_[_0xac04('0x2b')](_0x5a07ae,'name');_0x4e3e02[_0xac04('0x31')]=_[_0xac04('0x32')](_0x5c2605[_0xac04('0x31')]);_0x4e3e02[_0xac04('0x33')]=_[_0xac04('0x34')](_0x4e3e02[_0xac04('0x35')],_0x4e3e02[_0xac04('0x31')]);_0x526edf[_0xac04('0x36')]=_[_0xac04('0x34')](_0x4e3e02[_0xac04('0x35')],qs[_0xac04('0x37')](_0x5c2605[_0xac04('0x31')][_0xac04('0x37')]));_0x526edf[_0xac04('0x36')]=_0x526edf[_0xac04('0x36')][_0xac04('0x38')]?_0x526edf[_0xac04('0x36')]:_0x4e3e02[_0xac04('0x35')];if(!_0x5c2605[_0xac04('0x31')]['hasOwnProperty'](_0xac04('0x39'))){_0x526edf[_0xac04('0x1c')]=qs[_0xac04('0x1c')](_0x5c2605[_0xac04('0x31')][_0xac04('0x1c')]);_0x526edf[_0xac04('0x1e')]=qs[_0xac04('0x1e')](_0x5c2605['query'][_0xac04('0x1e')]);}_0x526edf[_0xac04('0x3a')]=qs[_0xac04('0x3b')](_0x5c2605[_0xac04('0x31')][_0xac04('0x3b')]);_0x526edf['where']=qs[_0xac04('0x33')](_[_0xac04('0x3c')](_0x5c2605[_0xac04('0x31')],_0x4e3e02[_0xac04('0x33')]),_0x5a07ae);if(_0x5c2605[_0xac04('0x31')][_0xac04('0x3d')]){_0x526edf[_0xac04('0x3e')]=_[_0xac04('0x3f')](_0x526edf[_0xac04('0x3e')],{'$or':_[_0xac04('0x2b')](_0x5a07ae,function(_0x2cf83b){if(_0x2cf83b[_0xac04('0x2f')]!==_0xac04('0x40')){var _0x49747a={};_0x49747a[_0x2cf83b[_0xac04('0x29')]]={'$like':'%'+_0x5c2605[_0xac04('0x31')][_0xac04('0x3d')]+'%'};return _0x49747a;}})});}_0x526edf=_[_0xac04('0x3f')]({},_0x526edf,_0x5c2605[_0xac04('0x41')]);var _0x9bbf8b={'where':_0x526edf['where']};return db[_0xac04('0x2c')]['count'](_0x9bbf8b)[_0xac04('0x24')](function(_0x3505dd){_0x577c25[_0xac04('0x1d')]=_0x3505dd;if(_0x5c2605[_0xac04('0x31')]['includeAll']){_0x526edf[_0xac04('0x42')]=[{'all':!![]}];}return db[_0xac04('0x2c')][_0xac04('0x43')](_0x526edf);})['then'](function(_0x4bac1c){_0x577c25[_0xac04('0x44')]=_0x4bac1c;return _0x577c25;})['then'](respondWithFilteredResult(_0x4955a0,_0x526edf))[_0xac04('0x45')](handleError(_0x4955a0,null));};exports[_0xac04('0x46')]=function(_0x29a38b,_0x3c39c6){var _0x3d1282={'raw':!![],'where':{'id':_0x29a38b['params']['id']}},_0x197338={};_0x197338['model']=_[_0xac04('0x32')](db[_0xac04('0x2c')][_0xac04('0x2d')]);_0x197338[_0xac04('0x31')]=_[_0xac04('0x32')](_0x29a38b[_0xac04('0x31')]);_0x197338['filters']=_[_0xac04('0x34')](_0x197338[_0xac04('0x35')],_0x197338[_0xac04('0x31')]);_0x3d1282[_0xac04('0x36')]=_[_0xac04('0x34')](_0x197338[_0xac04('0x35')],qs['fields'](_0x29a38b[_0xac04('0x31')]['fields']));_0x3d1282['attributes']=_0x3d1282[_0xac04('0x36')][_0xac04('0x38')]?_0x3d1282[_0xac04('0x36')]:_0x197338[_0xac04('0x35')];if(_0x29a38b['query'][_0xac04('0x47')]){_0x3d1282[_0xac04('0x42')]=[{'all':!![]}];}_0x3d1282=_[_0xac04('0x3f')]({},_0x3d1282,_0x29a38b[_0xac04('0x41')]);return db[_0xac04('0x2c')][_0xac04('0x48')](_0x3d1282)[_0xac04('0x24')](handleEntityNotFound(_0x3c39c6,null))['then'](respondWithResult(_0x3c39c6,null))[_0xac04('0x45')](handleError(_0x3c39c6,null));};exports[_0xac04('0x49')]=function(_0x31a926,_0x72281e){return db[_0xac04('0x2c')]['create'](_0x31a926[_0xac04('0x4a')],{})[_0xac04('0x24')](function(_0x136428){var _0x1d1500=_0x31a926[_0xac04('0x4b')]['get']({'plain':!![]});if(!_0x1d1500)throw new Error(_0xac04('0x4c'));if(_0x1d1500[_0xac04('0x4d')]===_0xac04('0x4b')){var _0x3453c4=_0x136428[_0xac04('0x26')]({'plain':!![]});var _0x47f46a=_0xac04('0x4e');return db['UserProfileSection'][_0xac04('0x48')]({'where':{'name':_0x47f46a,'userProfileId':_0x1d1500[_0xac04('0x4f')]},'raw':!![]})[_0xac04('0x24')](function(_0x59dad2){if(_0x59dad2&&_0x59dad2['autoAssociation']===0x0){return db[_0xac04('0x27')][_0xac04('0x49')]({'name':_0x3453c4[_0xac04('0x29')],'resourceId':_0x3453c4['id'],'type':_0x59dad2[_0xac04('0x29')],'sectionId':_0x59dad2['id']},{})[_0xac04('0x24')](function(){return _0x136428;});}else{return _0x136428;}})['catch'](function(_0xd7e5fb){logger[_0xac04('0x50')](_0xac04('0x51'),_0xd7e5fb);throw _0xd7e5fb;});}return _0x136428;})[_0xac04('0x24')](respondWithResult(_0x72281e,0xc9))[_0xac04('0x45')](handleError(_0x72281e,null));};exports[_0xac04('0x52')]=function(_0x2872e6,_0x1ff0a6){if(_0x2872e6[_0xac04('0x4a')]['id']){delete _0x2872e6['body']['id'];}return db['Pause'][_0xac04('0x48')]({'where':{'id':_0x2872e6['params']['id']}})['then'](handleEntityNotFound(_0x1ff0a6,null))[_0xac04('0x24')](saveUpdates(_0x2872e6[_0xac04('0x4a')],null))[_0xac04('0x24')](respondWithResult(_0x1ff0a6,null))[_0xac04('0x45')](handleError(_0x1ff0a6,null));};exports[_0xac04('0x25')]=function(_0x288206,_0x4cb506){return db[_0xac04('0x2c')][_0xac04('0x48')]({'where':{'id':_0x288206['params']['id']}})[_0xac04('0x24')](handleEntityNotFound(_0x4cb506,null))['then'](removeEntity(_0x4cb506,null))['catch'](handleError(_0x4cb506,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 437c9c7..b7cc2ff 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 _0x814b=['define','Pause','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./pause.attributes','exports'];(function(_0x395896,_0xd38f7a){var _0xa7dadd=function(_0x54537c){while(--_0x54537c){_0x395896['push'](_0x395896['shift']());}};_0xa7dadd(++_0xd38f7a);}(_0x814b,0x1a2));var _0xb814=function(_0x24392f,_0x15a3e5){_0x24392f=_0x24392f-0x0;var _0x591e33=_0x814b[_0x24392f];return _0x591e33;};'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':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xc4aa[_0x342baa];return _0x1208f3;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 19eaffe..03d9752 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(_0x4375a1,_0x36bc26){var _0xe68e65=function(_0x34f23d){while(--_0x34f23d){_0x4375a1['push'](_0x4375a1['shift']());}};_0xe68e65(++_0x36bc26);}(_0xb10b,0x12a));var _0xbb10=function(_0x16ca4a,_0x1ed3e7){_0x16ca4a=_0x16ca4a-0x0;var _0x48f844=_0xb10b[_0x16ca4a];return _0x48f844;};'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(_0x3b6191,_0x584a4c){var _0x3a109e=function(_0x41ef95){while(--_0x41ef95){_0x3b6191['push'](_0x3b6191['shift']());}};_0x3a109e(++_0x584a4c);}(_0x7a54,0x106));var _0x47a5=function(_0x4f34d2,_0x5c6bb3){_0x4f34d2=_0x4f34d2-0x0;var _0x2b6f05=_0x7a54[_0x4f34d2];return _0x2b6f05;};'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 57ae79e..cad8eb6 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 _0x29d4=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','show','download','root','server/files/plugins','originalname','replace','%s-%s%s','basename','extname','now','post','file','webhookPost','put','update','delete','exports','multer','path','connect-timeout'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x29d4,0x1a1));var _0x429d=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x29d4[_0xc6be3a];return _0x56a310;};'use strict';var multer=require(_0x429d('0x0'));var util=require('util');var path=require(_0x429d('0x1'));var timeout=require(_0x429d('0x2'));var express=require(_0x429d('0x3'));var router=express[_0x429d('0x4')]();var fs_extra=require(_0x429d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x429d('0x6'));var config=require(_0x429d('0x7'));var controller=require(_0x429d('0x8'));router[_0x429d('0x9')]('/',auth[_0x429d('0xa')](),controller[_0x429d('0xb')]);router[_0x429d('0x9')](_0x429d('0xc'),controller['webhookGet']);router[_0x429d('0x9')]('/:id',auth[_0x429d('0xa')](),controller[_0x429d('0xd')]);router[_0x429d('0x9')]('/:id/download',auth[_0x429d('0xa')](),controller[_0x429d('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x31ff87,_0x2fd1ca,_0x417f77){_0x417f77(null,path['join'](config[_0x429d('0xf')],_0x429d('0x10')));},'filename':function(_0x1d933b,_0x1cb1cf,_0x4843af){_0x1cb1cf[_0x429d('0x11')]=_0x1cb1cf[_0x429d('0x11')][_0x429d('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4843af(null,util['format'](_0x429d('0x13'),path[_0x429d('0x14')](_0x1cb1cf['originalname'],path[_0x429d('0x15')](_0x1cb1cf[_0x429d('0x11')])),Date[_0x429d('0x16')](),path[_0x429d('0x15')](_0x1cb1cf[_0x429d('0x11')])));}})});router[_0x429d('0x17')]('/',upload['single'](_0x429d('0x18')),controller['upload']);router[_0x429d('0x17')](_0x429d('0xc'),controller[_0x429d('0x19')]);router[_0x429d('0x1a')]('/:id',auth[_0x429d('0xa')](),controller[_0x429d('0x1b')]);router[_0x429d('0x1c')]('/:id',auth[_0x429d('0xa')](),controller[_0x429d('0x1c')]);module[_0x429d('0x1d')]=router; \ No newline at end of file +var _0x55e0=['webhookPost','update','delete','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','webhookGet','/:id','isAuthenticated','show','/:id/download','download','diskStorage','join','server/files/plugins','originalname','replace','%s-%s%s','basename','extname','post','file','upload','/webhook'];(function(_0x1759b7,_0x14ae1b){var _0x21fe8a=function(_0x31ad56){while(--_0x31ad56){_0x1759b7['push'](_0x1759b7['shift']());}};_0x21fe8a(++_0x14ae1b);}(_0x55e0,0xdc));var _0x055e=function(_0x5d554d,_0x4c65b4){_0x5d554d=_0x5d554d-0x0;var _0x28bb46=_0x55e0[_0x5d554d];return _0x28bb46;};'use strict';var multer=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var path=require(_0x055e('0x2'));var timeout=require(_0x055e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x055e('0x4'));var auth=require(_0x055e('0x5'));var interaction=require(_0x055e('0x6'));var config=require(_0x055e('0x7'));var controller=require(_0x055e('0x8'));router[_0x055e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x055e('0x9')]('/webhook',controller[_0x055e('0xa')]);router[_0x055e('0x9')](_0x055e('0xb'),auth[_0x055e('0xc')](),controller[_0x055e('0xd')]);router['get'](_0x055e('0xe'),auth[_0x055e('0xc')](),controller[_0x055e('0xf')]);var upload=multer({'storage':multer[_0x055e('0x10')]({'destination':function(_0x238068,_0x5237d9,_0x56c78a){_0x56c78a(null,path[_0x055e('0x11')](config['root'],_0x055e('0x12')));},'filename':function(_0x466da3,_0x72d424,_0x101bc3){_0x72d424[_0x055e('0x13')]=_0x72d424[_0x055e('0x13')][_0x055e('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x101bc3(null,util['format'](_0x055e('0x15'),path[_0x055e('0x16')](_0x72d424[_0x055e('0x13')],path[_0x055e('0x17')](_0x72d424[_0x055e('0x13')])),Date['now'](),path[_0x055e('0x17')](_0x72d424[_0x055e('0x13')])));}})});router[_0x055e('0x18')]('/',upload['single'](_0x055e('0x19')),controller[_0x055e('0x1a')]);router[_0x055e('0x18')](_0x055e('0x1b'),controller[_0x055e('0x1c')]);router['put'](_0x055e('0xb'),auth[_0x055e('0xc')](),controller[_0x055e('0x1d')]);router[_0x055e('0x1e')]('/:id',auth[_0x055e('0xc')](),controller[_0x055e('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 13442e0..b11e071 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 _0xfad7=['adminOnly','agentOnly','never','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','ENUM','script','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'];(function(_0x47a5bd,_0x508329){var _0x5c2184=function(_0x40ddea){while(--_0x40ddea){_0x47a5bd['push'](_0x47a5bd['shift']());}};_0x5c2184(++_0x508329);}(_0xfad7,0xbb));var _0x7fad=function(_0x5a37cb,_0x22ed30){_0x5a37cb=_0x5a37cb-0x0;var _0x2942c8=_0xfad7[_0x5a37cb];return _0x2942c8;};'use strict';var Sequelize=require(_0x7fad('0x0'));module[_0x7fad('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7fad('0x2')]('html',_0x7fad('0x3'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x7fad('0x4')],'comment':_0x7fad('0x5')},'active':{'type':Sequelize[_0x7fad('0x6')],'defaultValue':0x0,'comment':_0x7fad('0x7')},'sidebar':{'type':Sequelize[_0x7fad('0x2')](_0x7fad('0x8'),_0x7fad('0x9'),'always',_0x7fad('0xa')),'defaultValue':_0x7fad('0xb'),'comment':_0x7fad('0xc')},'icon':{'type':Sequelize[_0x7fad('0x4')]},'adminUrl':{'type':Sequelize[_0x7fad('0x4')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x7fad('0x4')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3d87=['ENUM','html','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','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','STRING'];(function(_0x429f1c,_0x2a4a86){var _0x3b36c9=function(_0xa43f4c){while(--_0xa43f4c){_0x429f1c['push'](_0x429f1c['shift']());}};_0x3b36c9(++_0x2a4a86);}(_0x3d87,0x10e));var _0x73d8=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x3d87[_0x5b561d];return _0x431060;};'use strict';var Sequelize=require(_0x73d8('0x0'));module[_0x73d8('0x1')]={'name':{'type':Sequelize[_0x73d8('0x2')]},'type':{'type':Sequelize[_0x73d8('0x3')](_0x73d8('0x4'),'script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x73d8('0x2')],'comment':_0x73d8('0x5')},'active':{'type':Sequelize[_0x73d8('0x6')],'defaultValue':0x0,'comment':_0x73d8('0x7')},'sidebar':{'type':Sequelize[_0x73d8('0x3')](_0x73d8('0x8'),_0x73d8('0x9'),_0x73d8('0xa'),_0x73d8('0xb')),'defaultValue':_0x73d8('0xa'),'comment':_0x73d8('0xc')},'icon':{'type':Sequelize[_0x73d8('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x73d8('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x73d8('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index b6a3e61..2dc8a96 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 _0x2899=['options','includeAll','include','show','params','find','catch','download','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','ENOENT','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','dirname','node_modules/**/*','finalize','close','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','upload','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','info','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','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','scriptName','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','json','encoding','method','%s%s','headers','content-length','endsWith','statusCode','webhookPost','content-type','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','Plugins','UserProfileResource','sendStatus','stack','name','send','Plugin','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','map','VIRTUAL','merge'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x2899,0x107));var _0x9289=function(_0x4723d3,_0x429390){_0x4723d3=_0x4723d3-0x0;var _0x1a41da=_0x2899[_0x4723d3];return _0x1a41da;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9289('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9289('0x1'));var rp=require('request-promise');var moment=require(_0x9289('0x2'));var BPromise=require(_0x9289('0x3'));var Mustache=require(_0x9289('0x4'));var util=require(_0x9289('0x5'));var path=require(_0x9289('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9289('0x7'));var fs=require('fs');var fs_extra=require(_0x9289('0x8'));var _=require(_0x9289('0x9'));var squel=require(_0x9289('0xa'));var crypto=require(_0x9289('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9289('0xc'));var Papa=require(_0x9289('0xd'));var extract=require('extract-zip');var rimraf=require('rimraf');var archiver=require('archiver');var Redis=require(_0x9289('0xe'));var authService=require(_0x9289('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9289('0x10'));var logger=require('../../config/logger')(_0x9289('0x11'));var utils=require(_0x9289('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x9289('0x13'));var db=require(_0x9289('0x14'))['db'];config['redis']=_[_0x9289('0x15')](config[_0x9289('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x9289('0x17'))(new Redis(config['redis']));require('./plugin.socket')[_0x9289('0x18')](socket);function respondWithStatusCode(_0x42a903,_0x9de36e){_0x9de36e=_0x9de36e||0xcc;return function(_0x5a6fb2){if(_0x5a6fb2){return _0x42a903['sendStatus'](_0x9de36e);}return _0x42a903[_0x9289('0x19')](_0x9de36e)[_0x9289('0x1a')]();};}function respondWithResult(_0x1dbf29,_0x591ca3){_0x591ca3=_0x591ca3||0xc8;return function(_0x32ed54){if(_0x32ed54){return _0x1dbf29['status'](_0x591ca3)['json'](_0x32ed54);}};}function respondWithFilteredResult(_0x24a026,_0x296991){return function(_0x3a256a){if(_0x3a256a){var _0x2a1f85=typeof _0x296991[_0x9289('0x1b')]===_0x9289('0x1c')&&typeof _0x296991['limit']===_0x9289('0x1c');var _0x178ecf=_0x3a256a[_0x9289('0x1d')];var _0x23eb7d=_0x2a1f85?0x0:_0x296991[_0x9289('0x1b')];var _0x57c88c=_0x2a1f85?_0x3a256a[_0x9289('0x1d')]:_0x296991['offset']+_0x296991[_0x9289('0x1e')];var _0x4bb47d;if(_0x57c88c>=_0x178ecf){_0x57c88c=_0x178ecf;_0x4bb47d=0xc8;}else{_0x4bb47d=0xce;}_0x24a026['status'](_0x4bb47d);return _0x24a026[_0x9289('0x1f')](_0x9289('0x20'),_0x23eb7d+'-'+_0x57c88c+'/'+_0x178ecf)['json'](_0x3a256a);}return null;};}function patchUpdates(_0x485be7){return function(_0x3c2fc4){try{jsonpatch[_0x9289('0x21')](_0x3c2fc4,_0x485be7,!![]);}catch(_0x2ddaf0){return BPromise[_0x9289('0x22')](_0x2ddaf0);}return _0x3c2fc4[_0x9289('0x23')]();};}function saveUpdates(_0x5689d8,_0x55e746){return function(_0x2f7d90){if(_0x2f7d90){return _0x2f7d90[_0x9289('0x24')](_0x5689d8)['then'](function(_0x3f2822){return _0x3f2822;});}return null;};}function removeEntity(_0x13d808,_0x4fa7f8){return function(_0x441380){if(_0x441380){return _0x441380[_0x9289('0x25')]()[_0x9289('0x26')](function(){var _0x458f91=_0x441380[_0x9289('0x27')]({'plain':!![]});var _0x1f3ed5=_0x9289('0x28');return db[_0x9289('0x29')][_0x9289('0x25')]({'where':{'type':_0x1f3ed5,'resourceId':_0x458f91['id']}})['then'](function(){return _0x441380;});})['then'](function(){_0x13d808['status'](0xcc)[_0x9289('0x1a')]();});}};}function handleEntityNotFound(_0x4392eb,_0x76bb1f){return function(_0x399ddf){if(!_0x399ddf){_0x4392eb[_0x9289('0x2a')](0x194);}return _0x399ddf;};}function handleError(_0x1c49aa,_0x2765fb){_0x2765fb=_0x2765fb||0x1f4;return function(_0x17ae7c){logger['error'](_0x17ae7c[_0x9289('0x2b')]);if(_0x17ae7c[_0x9289('0x2c')]){delete _0x17ae7c[_0x9289('0x2c')];}_0x1c49aa[_0x9289('0x19')](_0x2765fb)[_0x9289('0x2d')](_0x17ae7c);};}exports['index']=function(_0x54fac4,_0x157e85){var _0x21b6c7={},_0x29241a={},_0x4f2e89={'count':0x0,'rows':[]};var _0x286191=_['map'](db[_0x9289('0x2e')][_0x9289('0x2f')],function(_0x177b77){return{'name':_0x177b77[_0x9289('0x30')],'type':_0x177b77[_0x9289('0x31')][_0x9289('0x32')]};});_0x29241a[_0x9289('0x33')]=_['map'](_0x286191,_0x9289('0x2c'));_0x29241a[_0x9289('0x34')]=_[_0x9289('0x35')](_0x54fac4['query']);_0x29241a[_0x9289('0x36')]=_[_0x9289('0x37')](_0x29241a['model'],_0x29241a[_0x9289('0x34')]);_0x21b6c7[_0x9289('0x38')]=_[_0x9289('0x37')](_0x29241a[_0x9289('0x33')],qs[_0x9289('0x39')](_0x54fac4[_0x9289('0x34')]['fields']));_0x21b6c7['attributes']=_0x21b6c7[_0x9289('0x38')][_0x9289('0x3a')]?_0x21b6c7[_0x9289('0x38')]:_0x29241a[_0x9289('0x33')];if(!_0x54fac4['query']['hasOwnProperty']('nolimit')){_0x21b6c7[_0x9289('0x1e')]=qs[_0x9289('0x1e')](_0x54fac4[_0x9289('0x34')][_0x9289('0x1e')]);_0x21b6c7[_0x9289('0x1b')]=qs['offset'](_0x54fac4[_0x9289('0x34')][_0x9289('0x1b')]);}_0x21b6c7[_0x9289('0x3b')]=qs[_0x9289('0x3c')](_0x54fac4[_0x9289('0x34')]['sort']);_0x21b6c7[_0x9289('0x3d')]=qs[_0x9289('0x36')](_[_0x9289('0x3e')](_0x54fac4[_0x9289('0x34')],_0x29241a[_0x9289('0x36')]),_0x286191);if(_0x54fac4[_0x9289('0x34')][_0x9289('0x3f')]){_0x21b6c7[_0x9289('0x3d')]=_['merge'](_0x21b6c7['where'],{'$or':_[_0x9289('0x40')](_0x286191,function(_0x13ff1f){if(_0x13ff1f[_0x9289('0x31')]!==_0x9289('0x41')){var _0x531b42={};_0x531b42[_0x13ff1f[_0x9289('0x2c')]]={'$like':'%'+_0x54fac4['query'][_0x9289('0x3f')]+'%'};return _0x531b42;}})});}_0x21b6c7=_[_0x9289('0x42')]({},_0x21b6c7,_0x54fac4[_0x9289('0x43')]);var _0x3d5d35={'where':_0x21b6c7[_0x9289('0x3d')]};return db[_0x9289('0x2e')]['count'](_0x3d5d35)[_0x9289('0x26')](function(_0x219104){_0x4f2e89[_0x9289('0x1d')]=_0x219104;if(_0x54fac4[_0x9289('0x34')][_0x9289('0x44')]){_0x21b6c7[_0x9289('0x45')]=[{'all':!![]}];}return db[_0x9289('0x2e')]['findAll'](_0x21b6c7);})[_0x9289('0x26')](function(_0x73fa58){_0x4f2e89['rows']=_0x73fa58;return _0x4f2e89;})['then'](respondWithFilteredResult(_0x157e85,_0x21b6c7))['catch'](handleError(_0x157e85,null));};exports[_0x9289('0x46')]=function(_0x91ce36,_0x3e2eaf){var _0x30a43b={'raw':!![],'where':{'id':_0x91ce36[_0x9289('0x47')]['id']}},_0x420884={};_0x420884[_0x9289('0x33')]=_[_0x9289('0x35')](db[_0x9289('0x2e')][_0x9289('0x2f')]);_0x420884[_0x9289('0x34')]=_[_0x9289('0x35')](_0x91ce36['query']);_0x420884['filters']=_[_0x9289('0x37')](_0x420884[_0x9289('0x33')],_0x420884[_0x9289('0x34')]);_0x30a43b[_0x9289('0x38')]=_[_0x9289('0x37')](_0x420884[_0x9289('0x33')],qs[_0x9289('0x39')](_0x91ce36['query'][_0x9289('0x39')]));_0x30a43b[_0x9289('0x38')]=_0x30a43b[_0x9289('0x38')][_0x9289('0x3a')]?_0x30a43b[_0x9289('0x38')]:_0x420884['model'];if(_0x91ce36[_0x9289('0x34')][_0x9289('0x44')]){_0x30a43b[_0x9289('0x45')]=[{'all':!![]}];}_0x30a43b=_[_0x9289('0x42')]({},_0x30a43b,_0x91ce36['options']);return db[_0x9289('0x2e')][_0x9289('0x48')](_0x30a43b)[_0x9289('0x26')](handleEntityNotFound(_0x3e2eaf,null))[_0x9289('0x26')](respondWithResult(_0x3e2eaf,null))[_0x9289('0x49')](handleError(_0x3e2eaf,null));};exports[_0x9289('0x4a')]=function(_0x3dfa4c,_0x459f93,_0x13ebfd){return db[_0x9289('0x2e')][_0x9289('0x48')]({'where':{'id':_0x3dfa4c[_0x9289('0x47')]['id']},'attributes':['name',_0x9289('0x6')],'raw':!![]})[_0x9289('0x26')](handleEntityNotFound(_0x459f93,null))[_0x9289('0x26')](function(_0x234c32){if(_0x234c32){var _0x3bd1ae=path[_0x9289('0x4b')](config[_0x9289('0x4c')],_0x9289('0x4d'),util[_0x9289('0x4e')](_0x9289('0x4f'),path[_0x9289('0x50')](_0x234c32[_0x9289('0x6')])));var _0xf94fa6=fs[_0x9289('0x51')](_0x3bd1ae);var _0x5ba0be=archiver(_0x9289('0x52'),{'zlib':{'level':0x9}});_0x5ba0be['on']('warning',function(_0x21f90e){if(_0x21f90e['code']===_0x9289('0x53')){logger[_0x9289('0x54')](_0x21f90e);}else{throw new db[(_0x9289('0x55'))][(_0x9289('0x56'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x5ba0be['on'](_0x9289('0x54'),function(_0x1d57e9){throw new db[(_0x9289('0x55'))][(_0x9289('0x56'))](_0x9289('0x57'));});_0x5ba0be['pipe'](_0xf94fa6);_0x5ba0be[_0x9289('0x58')](_0x9289('0x59'),{'cwd':path[_0x9289('0x4b')](config['root'],_0x9289('0x4d'),path[_0x9289('0x5a')](_0x234c32[_0x9289('0x6')])),'ignore':[path[_0x9289('0x4b')](path[_0x9289('0x50')](_0x234c32['path']),_0x9289('0x5b')),path[_0x9289('0x4b')](path[_0x9289('0x50')](_0x234c32[_0x9289('0x6')]),'attachments/**/*')],'nodir':!![]})[_0x9289('0x5c')]();_0xf94fa6['on'](_0x9289('0x5d'),function(){if(!fs['existsSync'](_0x3bd1ae)){throw new db['Sequelize'][(_0x9289('0x56'))](_0x9289('0x5e'));}return _0x459f93[_0x9289('0x4a')](_0x3bd1ae,util[_0x9289('0x4e')](_0x9289('0x4f'),path[_0x9289('0x50')](_0x234c32['path'])),function(_0x37b572){if(_0x37b572){throw new db[(_0x9289('0x55'))][(_0x9289('0x56'))](_0x9289('0x5f'));}fs[_0x9289('0x60')](_0x3bd1ae);logger['info'](_0x9289('0x61'));logger['info']('Temporary\x20file\x20removed');});});}return null;})[_0x9289('0x49')](handleError(_0x459f93,null));};exports[_0x9289('0x62')]=function(_0x374cf8,_0x4fe785,_0x422d4b){var _0x18296f=path[_0x9289('0x50')](_0x374cf8[_0x9289('0x63')]['filename'],path[_0x9289('0x64')](_0x374cf8['file'][_0x9289('0x65')]));var _0x183d36=path[_0x9289('0x4b')](config[_0x9289('0x4c')],'server/files/plugins',_0x374cf8[_0x9289('0x63')][_0x9289('0x65')]);var _0x178464=path[_0x9289('0x4b')](config[_0x9289('0x4c')],_0x9289('0x4d'),_0x18296f);logger['info'](_0x9289('0x66'),_0x183d36);logger[_0x9289('0x67')](_0x9289('0x68'),_0x178464);try{fs[_0x9289('0x69')](_0x183d36,parseInt(_0x9289('0x6a'),0x8));extract(_0x183d36,{'dir':_0x178464},function(_0x3f84a6){if(_0x3f84a6){logger[_0x9289('0x54')](_0x3f84a6);handleError(_0x3f84a6,!![]);};var _0x295ef9=fs[_0x9289('0x6b')](_0x178464);if(_0x295ef9[_0x9289('0x3a')]>0x1){removeReferences(_0x183d36,_0x178464);logger[_0x9289('0x54')](_0x9289('0x6c'));return _0x422d4b(new Error(_0x9289('0x6c')));}var _0x3d05bb=fs[_0x9289('0x6d')](path[_0x9289('0x4b')](_0x178464,_0x295ef9[0x0]));if(_0x3d05bb['isFile']()){removeReferences(_0x183d36,_0x178464);logger[_0x9289('0x54')](_0x9289('0x6c'));return _0x422d4b(new Error(_0x9289('0x6c')));}if(_0x3d05bb[_0x9289('0x6e')]()){var _0x5c03fb=fs[_0x9289('0x6b')](path[_0x9289('0x4b')](_0x178464,_0x295ef9[0x0]));if(_0x5c03fb[_0x9289('0x3a')]===0x0){removeReferences(_0x183d36,_0x178464);logger['error']('Invalid\x20plugin\x20structure');return _0x422d4b(new Error(_0x9289('0x6c')));}var _0x39367d=_0x5c03fb['some'](function(_0x1af746){return _0x1af746===_0x9289('0x6f');});if(!_0x39367d){return _0x422d4b(new Error(_0x9289('0x70')));}var _0x3ba452=fs[_0x9289('0x71')](path['join'](_0x178464,_0x295ef9[0x0],_0x9289('0x6f')));var _0x48af6d=JSON[_0x9289('0x72')](_0x3ba452);if(_0x9289('0x1c')==typeof _0x48af6d['name']){return _0x422d4b(new Error(_0x9289('0x73')));}if(_0x9289('0x1c')==typeof _0x48af6d[_0x9289('0x31')]){return _0x422d4b(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x9289('0x1c')==typeof _0x48af6d[_0x9289('0x74')]){return _0x422d4b(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x9289('0x1c')==typeof _0x48af6d[_0x9289('0x75')]){return _0x422d4b(new Error(_0x9289('0x76')));}if(_0x48af6d[_0x9289('0x31')]===_0x9289('0x77')){if(_0x9289('0x1c')==typeof _0x48af6d[_0x9289('0x75')]['views']){return _0x422d4b(new Error(_0x9289('0x78')));}if(_0x9289('0x1c')==typeof _0x48af6d[_0x9289('0x75')]['views']['admin']&&'undefined'==typeof _0x48af6d[_0x9289('0x75')][_0x9289('0x79')][_0x9289('0x7a')]){return _0x422d4b(new Error(_0x9289('0x7b')));}}else if(_0x48af6d[_0x9289('0x31')]===_0x9289('0x7c')){if('undefined'==typeof _0x48af6d[_0x9289('0x75')]['scriptName']){return _0x422d4b(new Error(_0x9289('0x7d')));}if(_0x9289('0x1c')==typeof _0x48af6d[_0x9289('0x75')][_0x9289('0x7e')]){return _0x422d4b(new Error(_0x9289('0x7f')));}}else{return _0x422d4b(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x30b72e=_0x48af6d[_0x9289('0x2c')];var _0x5142dc=_0x48af6d['description'];var _0x3a7078=_0x48af6d['type'];var _0x1b5fac=_0x48af6d[_0x9289('0x80')]?_0x48af6d[_0x9289('0x80')]:_0x9289('0x81');var _0x2518d3=_0x48af6d[_0x9289('0x82')]?_0x48af6d['icon']:_0x9289('0x83');var _0x1129bf='';var _0x344d30='';var _0xde29a8='';var _0x28c03d='';var _0xc79679=_0x48af6d[_0x9289('0x74')];if(_0x3a7078===_0x9289('0x77')){if(_0x9289('0x1c')!=typeof _0x48af6d[_0x9289('0x75')]['views']['admin']){var _0x1201f3=_0x48af6d['parameters'][_0x9289('0x79')][_0x9289('0x84')];if(!/^(f|ht)tps?:\/\//i[_0x9289('0x85')](_0x1201f3)){_0x1129bf=path[_0x9289('0x4b')](_0x9289('0x86'),_0x18296f,_0x295ef9[0x0],_0x1201f3);}else{_0x1129bf=_0x1201f3;}}else{logger['info'](_0x9289('0x87'));}if(_0x9289('0x1c')!=typeof _0x48af6d[_0x9289('0x75')][_0x9289('0x79')]['agent']){var _0x5cedf7=_0x48af6d[_0x9289('0x75')][_0x9289('0x79')][_0x9289('0x7a')];if(!/^(f|ht)tps?:\/\//i[_0x9289('0x85')](_0x5cedf7)){_0x344d30=path[_0x9289('0x4b')](_0x9289('0x86'),_0x18296f,_0x295ef9[0x0],_0x5cedf7);}else{_0x344d30=_0x5cedf7;}}else{logger['info'](_0x9289('0x88'));}}else if(_0x3a7078===_0x9289('0x7c')){_0xde29a8=_0x48af6d[_0x9289('0x75')][_0x9289('0x89')];_0x28c03d=_0x48af6d['parameters'][_0x9289('0x7e')];if('undefined'!=typeof _0x48af6d[_0x9289('0x75')][_0x9289('0x79')]){if('undefined'!=typeof _0x48af6d[_0x9289('0x75')][_0x9289('0x79')]['admin']){var _0x1201f3=_0x48af6d['parameters'][_0x9289('0x79')][_0x9289('0x84')];if(!/^(f|ht)tps?:\/\//i[_0x9289('0x85')](_0x1201f3)){_0x1129bf=path['join'](_0x9289('0x86'),_0x18296f,_0x295ef9[0x0],_0x1201f3);}else{_0x1129bf=_0x1201f3;}}if(_0x9289('0x1c')!=typeof _0x48af6d[_0x9289('0x75')][_0x9289('0x79')][_0x9289('0x7a')]){var _0x5cedf7=_0x48af6d[_0x9289('0x75')][_0x9289('0x79')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x9289('0x85')](_0x5cedf7)){_0x344d30=path[_0x9289('0x4b')](_0x9289('0x86'),_0x18296f,_0x295ef9[0x0],_0x5cedf7);}else{_0x344d30=_0x5cedf7;}}}}var _0x155518={'name':_0x30b72e,'description':_0x5142dc,'path':path[_0x9289('0x4b')](_0x18296f,_0x295ef9[0x0]),'type':_0x3a7078,'sidebar':_0x1b5fac,'icon':_0x2518d3,'adminUrl':_0x1129bf,'agentUrl':_0x344d30,'scriptName':_0xde29a8,'scriptPath':_0x28c03d,'version':_0xc79679};removeReferences(_0x183d36,null);return db[_0x9289('0x2e')][_0x9289('0x8a')](_0x155518)['then'](function(_0x133635){var _0x2a7618={'role':_0x374cf8[_0x9289('0x8b')][_0x9289('0x8c')],'userProfileId':_0x374cf8[_0x9289('0x8b')][_0x9289('0x8d')]};if(!_0x2a7618)throw new Error(_0x9289('0x8e'));if(_0x2a7618[_0x9289('0x8c')]===_0x9289('0x8f')){var _0x43ed29=_0x133635[_0x9289('0x27')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x9289('0x28'),'userProfileId':_0x2a7618['userProfileId']},'raw':!![]})[_0x9289('0x26')](function(_0x2a6ce7){if(_0x2a6ce7&&_0x2a6ce7['autoAssociation']===0x0){return db[_0x9289('0x29')][_0x9289('0x8a')]({'name':_0x43ed29['name'],'resourceId':_0x43ed29['id'],'type':_0x2a6ce7[_0x9289('0x2c')],'sectionId':_0x2a6ce7['id']},{})[_0x9289('0x26')](function(){return _0x133635;});}else{return _0x133635;}})[_0x9289('0x49')](function(_0x11b92f){logger['error'](_0x9289('0x90'),_0x11b92f);throw _0x11b92f;});}return _0x133635;})[_0x9289('0x26')](respondWithResult(_0x4fe785,null))[_0x9289('0x49')](handleError(_0x4fe785,null));}});}catch(_0x392cf9){_0x4fe785[_0x9289('0x19')](0x1f4)['send'](_0x392cf9);}};function removeReferences(_0x313bd3,_0x5958d6){try{if(_0x313bd3){fs['unlinkSync'](_0x313bd3);logger[_0x9289('0x67')](_0x9289('0x91'));}if(_0x5958d6){rimraf(_0x5958d6,function(){});logger[_0x9289('0x67')](_0x9289('0x92'));}}catch(_0x55236b){logger[_0x9289('0x54')](_0x55236b);}}exports[_0x9289('0x24')]=function(_0x1fc9a3,_0x28d1b8,_0x45f0a6){return db[_0x9289('0x2e')][_0x9289('0x48')]({'where':{'id':_0x1fc9a3[_0x9289('0x47')]['id']}})['then'](handleEntityNotFound(_0x28d1b8,null))['then'](saveUpdates(_0x1fc9a3[_0x9289('0x8b')],null))[_0x9289('0x26')](respondWithResult(_0x28d1b8,null))['catch'](handleError(_0x28d1b8,null));};exports[_0x9289('0x93')]=function(_0x3bedca,_0x54a8e3,_0x586278){return db[_0x9289('0x2e')]['find']({'where':{'id':_0x3bedca[_0x9289('0x47')]['id']}})[_0x9289('0x26')](function(_0x46e0d7){if(_0x46e0d7){return _0x46e0d7[_0x9289('0x25')]();}})[_0x9289('0x26')](function(_0x1e73eb){rimraf(path[_0x9289('0x4b')](config[_0x9289('0x4c')],_0x9289('0x4d'),path[_0x9289('0x5a')](_0x1e73eb[_0x9289('0x6')])),function(){});return _0x1e73eb;})[_0x9289('0x26')](handleEntityNotFound(_0x54a8e3,null))[_0x9289('0x26')](respondWithStatusCode(_0x54a8e3,null))[_0x9289('0x49')](handleError(_0x54a8e3,null));};exports[_0x9289('0x94')]=function(_0x5ca6fa,_0x32a138,_0x9a66e3){return BPromise[_0x9289('0x95')]()[_0x9289('0x26')](function(){if(!_0x5ca6fa['query'][_0x9289('0x6')]){throw new Error(_0x9289('0x96'));}if(!_0x5ca6fa[_0x9289('0x34')][_0x9289('0x97')]){throw new Error(_0x9289('0x98'));}var _0x542844=_0x5ca6fa[_0x9289('0x34')][_0x9289('0x99')]?_0x5ca6fa[_0x9289('0x34')][_0x9289('0x99')]+':'+_0x5ca6fa[_0x9289('0x34')][_0x9289('0x97')]:_0x9289('0x9a')+_0x5ca6fa['query'][_0x9289('0x97')];var _0x1c4ef8=_0x5ca6fa['query']['json']?_0x5ca6fa[_0x9289('0x34')][_0x9289('0x9b')]:!![];var _0x5bf019=_0x5ca6fa[_0x9289('0x34')]['encoding']?_0x5ca6fa['query'][_0x9289('0x9c')]:null;var _0x3f4fc9={'method':_0x5ca6fa[_0x9289('0x9d')],'uri':util['format'](_0x9289('0x9e'),_0x542844,_0x5ca6fa[_0x9289('0x34')][_0x9289('0x6')]),'json':_0x1c4ef8,'resolveWithFullResponse':!![],'encoding':_0x5bf019,'qs':_0x5ca6fa[_0x9289('0x34')]};if(_0x5ca6fa['headers']){_0x3f4fc9[_0x9289('0x9f')]=_0x5ca6fa[_0x9289('0x9f')];if(_0x3f4fc9[_0x9289('0x9f')][_0x9289('0xa0')]){delete _0x3f4fc9[_0x9289('0x9f')]['content-length'];}}if(_0x3f4fc9[_0x9289('0x9f')]['content-type']){delete _0x3f4fc9[_0x9289('0x9f')]['content-type'];}return rp(_0x3f4fc9);})['then'](function(_0x3a05fc){if(_0x3a05fc){_0x32a138[_0x9289('0x1f')](_0x3a05fc[_0x9289('0x9f')]);logger['info'](_0x3a05fc[_0x9289('0x8b')]);if(_[_0x9289('0xa1')](_0x5ca6fa[_0x9289('0x34')][_0x9289('0x6')],_0x9289('0x4a'))&&_0x3a05fc[_0x9289('0xa2')]==0x1f4){return _0x32a138[_0x9289('0x2a')](_0x3a05fc[_0x9289('0xa2')]);}else{return _0x32a138[_0x9289('0x19')](_0x3a05fc[_0x9289('0xa2')])[_0x9289('0x2d')](_0x3a05fc['body']);}}else{return _0x32a138[_0x9289('0x2a')](0xc8);}})[_0x9289('0x49')](handleError(_0x32a138,null));};exports[_0x9289('0xa3')]=function(_0x3e9df9,_0x39c9ea,_0x4d550c){return BPromise[_0x9289('0x95')]()[_0x9289('0x26')](function(){if(!_0x3e9df9[_0x9289('0x34')][_0x9289('0x6')]){throw new Error(_0x9289('0x96'));}if(!_0x3e9df9[_0x9289('0x34')]['port']){throw new Error(_0x9289('0x98'));}var _0x3b0f60=_0x3e9df9[_0x9289('0x34')][_0x9289('0x99')]?_0x3e9df9['query'][_0x9289('0x99')]+':'+_0x3e9df9[_0x9289('0x34')][_0x9289('0x97')]:_0x9289('0x9a')+_0x3e9df9[_0x9289('0x34')][_0x9289('0x97')];var _0x2bb8ee=_0x3e9df9[_0x9289('0x34')][_0x9289('0x9b')]?_0x3e9df9[_0x9289('0x34')][_0x9289('0x9b')]:!![];var _0x17813b=_0x3e9df9[_0x9289('0x34')][_0x9289('0x9c')]?_0x3e9df9[_0x9289('0x34')][_0x9289('0x9c')]:null;var _0x241175={'method':_0x3e9df9[_0x9289('0x9d')],'uri':util['format']('%s%s',_0x3b0f60,_0x3e9df9[_0x9289('0x34')]['path']),'json':_0x2bb8ee,'resolveWithFullResponse':!![],'encoding':_0x17813b,'body':_0x3e9df9[_0x9289('0x8b')]};if(_0x3e9df9['headers']){_0x241175[_0x9289('0x9f')]=_0x3e9df9[_0x9289('0x9f')];if(_0x241175[_0x9289('0x9f')][_0x9289('0xa0')]){delete _0x241175[_0x9289('0x9f')][_0x9289('0xa0')];}}if(_0x241175[_0x9289('0x9f')]['content-type']){delete _0x241175['headers'][_0x9289('0xa4')];}return rp(_0x241175);})[_0x9289('0x26')](function(_0xc2aec3){if(_0xc2aec3){_0x39c9ea[_0x9289('0x1f')](_0xc2aec3['headers']);logger['info'](_0xc2aec3[_0x9289('0x8b')]);return _0x39c9ea['status'](_0xc2aec3['statusCode'])[_0x9289('0x2d')](_0xc2aec3[_0x9289('0x8b')]);}else{return _0x39c9ea[_0x9289('0x2a')](0xc8);}})[_0x9289('0x49')](handleError(_0x39c9ea,null));}; \ No newline at end of file +var _0xe7a3=['intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','rows','show','params','rawAttributes','find','catch','join','root','server/files/plugins','format','%s.zip','basename','zip','warning','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Sequelize','unlinkSync','info','Temporary\x20file\x20removed','upload','filename','extname','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','parse','undefined','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','Invalid\x20manifest:\x20views\x20missing','views','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Plugins','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','delete','dirname','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','headers','content-length','endsWith','statusCode','webhookPost','resolve','content-type','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','crypto','jsforce','querystring','extract-zip','rimraf','archiver','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','Plugin','fieldName','key','model','map','query','keys','filters'];(function(_0x415657,_0x39092e){var _0x9607a1=function(_0x4ec67e){while(--_0x4ec67e){_0x415657['push'](_0x415657['shift']());}};_0x9607a1(++_0x39092e);}(_0xe7a3,0x1c0));var _0x3e7a=function(_0xf35bfb,_0x365fb){_0xf35bfb=_0xf35bfb-0x0;var _0x5e9e04=_0xe7a3[_0xf35bfb];return _0x5e9e04;};'use strict';var emlformat=require(_0x3e7a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3e7a('0x1'));var jsonpatch=require(_0x3e7a('0x2'));var rp=require(_0x3e7a('0x3'));var moment=require(_0x3e7a('0x4'));var BPromise=require(_0x3e7a('0x5'));var Mustache=require(_0x3e7a('0x6'));var util=require('util');var path=require(_0x3e7a('0x7'));var sox=require(_0x3e7a('0x8'));var csv=require('to-csv');var ejs=require(_0x3e7a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3e7a('0xa'));var jsforce=require(_0x3e7a('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3e7a('0xc'));var Papa=require('papaparse');var extract=require(_0x3e7a('0xd'));var rimraf=require(_0x3e7a('0xe'));var archiver=require(_0x3e7a('0xf'));var Redis=require('ioredis');var authService=require(_0x3e7a('0x10'));var qs=require(_0x3e7a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e7a('0x12'));var logger=require(_0x3e7a('0x13'))(_0x3e7a('0x14'));var utils=require('../../config/utils');var config=require(_0x3e7a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3e7a('0x16'))['db'];config[_0x3e7a('0x17')]=_[_0x3e7a('0x18')](config['redis'],{'host':_0x3e7a('0x19'),'port':0x18eb});var socket=require(_0x3e7a('0x1a'))(new Redis(config[_0x3e7a('0x17')]));require(_0x3e7a('0x1b'))['register'](socket);function respondWithStatusCode(_0x24875c,_0x120889){_0x120889=_0x120889||0xcc;return function(_0x5be0a4){if(_0x5be0a4){return _0x24875c[_0x3e7a('0x1c')](_0x120889);}return _0x24875c[_0x3e7a('0x1d')](_0x120889)[_0x3e7a('0x1e')]();};}function respondWithResult(_0x2c08bd,_0x5bf897){_0x5bf897=_0x5bf897||0xc8;return function(_0x3c6acf){if(_0x3c6acf){return _0x2c08bd[_0x3e7a('0x1d')](_0x5bf897)[_0x3e7a('0x1f')](_0x3c6acf);}};}function respondWithFilteredResult(_0x509181,_0x3febc0){return function(_0x298733){if(_0x298733){var _0x31cf7e=typeof _0x3febc0[_0x3e7a('0x20')]==='undefined'&&typeof _0x3febc0[_0x3e7a('0x21')]==='undefined';var _0x26b13c=_0x298733[_0x3e7a('0x22')];var _0x4ce500=_0x31cf7e?0x0:_0x3febc0[_0x3e7a('0x20')];var _0x3f22e6=_0x31cf7e?_0x298733[_0x3e7a('0x22')]:_0x3febc0[_0x3e7a('0x20')]+_0x3febc0[_0x3e7a('0x21')];var _0x49c1f9;if(_0x3f22e6>=_0x26b13c){_0x3f22e6=_0x26b13c;_0x49c1f9=0xc8;}else{_0x49c1f9=0xce;}_0x509181[_0x3e7a('0x1d')](_0x49c1f9);return _0x509181[_0x3e7a('0x23')](_0x3e7a('0x24'),_0x4ce500+'-'+_0x3f22e6+'/'+_0x26b13c)[_0x3e7a('0x1f')](_0x298733);}return null;};}function patchUpdates(_0x24ff76){return function(_0x582c94){try{jsonpatch['apply'](_0x582c94,_0x24ff76,!![]);}catch(_0xbdc954){return BPromise[_0x3e7a('0x25')](_0xbdc954);}return _0x582c94[_0x3e7a('0x26')]();};}function saveUpdates(_0x2865fc,_0x344eb0){return function(_0x53f333){if(_0x53f333){return _0x53f333[_0x3e7a('0x27')](_0x2865fc)[_0x3e7a('0x28')](function(_0x11f182){return _0x11f182;});}return null;};}function removeEntity(_0x54a7cc,_0x5767ae){return function(_0x4257f3){if(_0x4257f3){return _0x4257f3['destroy']()[_0x3e7a('0x28')](function(){var _0xd5ef88=_0x4257f3[_0x3e7a('0x29')]({'plain':!![]});var _0x3dfd34='Plugins';return db[_0x3e7a('0x2a')][_0x3e7a('0x2b')]({'where':{'type':_0x3dfd34,'resourceId':_0xd5ef88['id']}})[_0x3e7a('0x28')](function(){return _0x4257f3;});})[_0x3e7a('0x28')](function(){_0x54a7cc[_0x3e7a('0x1d')](0xcc)[_0x3e7a('0x1e')]();});}};}function handleEntityNotFound(_0x102b0a,_0x2a643c){return function(_0xe72f37){if(!_0xe72f37){_0x102b0a[_0x3e7a('0x1c')](0x194);}return _0xe72f37;};}function handleError(_0x1c9690,_0x4ebc80){_0x4ebc80=_0x4ebc80||0x1f4;return function(_0x4cd981){logger[_0x3e7a('0x2c')](_0x4cd981[_0x3e7a('0x2d')]);if(_0x4cd981['name']){delete _0x4cd981[_0x3e7a('0x2e')];}_0x1c9690[_0x3e7a('0x1d')](_0x4ebc80)[_0x3e7a('0x2f')](_0x4cd981);};}exports['index']=function(_0x3b836c,_0x360c7e){var _0x33b435={},_0x15ba14={},_0x38d3d4={'count':0x0,'rows':[]};var _0x5224a2=_['map'](db[_0x3e7a('0x30')]['rawAttributes'],function(_0x29b74e){return{'name':_0x29b74e[_0x3e7a('0x31')],'type':_0x29b74e['type'][_0x3e7a('0x32')]};});_0x15ba14[_0x3e7a('0x33')]=_[_0x3e7a('0x34')](_0x5224a2,'name');_0x15ba14[_0x3e7a('0x35')]=_[_0x3e7a('0x36')](_0x3b836c[_0x3e7a('0x35')]);_0x15ba14[_0x3e7a('0x37')]=_[_0x3e7a('0x38')](_0x15ba14[_0x3e7a('0x33')],_0x15ba14[_0x3e7a('0x35')]);_0x33b435[_0x3e7a('0x39')]=_['intersection'](_0x15ba14[_0x3e7a('0x33')],qs[_0x3e7a('0x3a')](_0x3b836c[_0x3e7a('0x35')][_0x3e7a('0x3a')]));_0x33b435['attributes']=_0x33b435[_0x3e7a('0x39')][_0x3e7a('0x3b')]?_0x33b435[_0x3e7a('0x39')]:_0x15ba14[_0x3e7a('0x33')];if(!_0x3b836c['query'][_0x3e7a('0x3c')]('nolimit')){_0x33b435[_0x3e7a('0x21')]=qs[_0x3e7a('0x21')](_0x3b836c['query'][_0x3e7a('0x21')]);_0x33b435[_0x3e7a('0x20')]=qs[_0x3e7a('0x20')](_0x3b836c[_0x3e7a('0x35')][_0x3e7a('0x20')]);}_0x33b435[_0x3e7a('0x3d')]=qs[_0x3e7a('0x3e')](_0x3b836c[_0x3e7a('0x35')][_0x3e7a('0x3e')]);_0x33b435[_0x3e7a('0x3f')]=qs[_0x3e7a('0x37')](_[_0x3e7a('0x40')](_0x3b836c['query'],_0x15ba14[_0x3e7a('0x37')]),_0x5224a2);if(_0x3b836c[_0x3e7a('0x35')][_0x3e7a('0x41')]){_0x33b435['where']=_['merge'](_0x33b435[_0x3e7a('0x3f')],{'$or':_[_0x3e7a('0x34')](_0x5224a2,function(_0x3f566d){if(_0x3f566d[_0x3e7a('0x42')]!==_0x3e7a('0x43')){var _0x189c54={};_0x189c54[_0x3f566d[_0x3e7a('0x2e')]]={'$like':'%'+_0x3b836c[_0x3e7a('0x35')][_0x3e7a('0x41')]+'%'};return _0x189c54;}})});}_0x33b435=_[_0x3e7a('0x44')]({},_0x33b435,_0x3b836c[_0x3e7a('0x45')]);var _0x144d38={'where':_0x33b435[_0x3e7a('0x3f')]};return db['Plugin'][_0x3e7a('0x22')](_0x144d38)[_0x3e7a('0x28')](function(_0x2826dd){_0x38d3d4['count']=_0x2826dd;if(_0x3b836c[_0x3e7a('0x35')][_0x3e7a('0x46')]){_0x33b435[_0x3e7a('0x47')]=[{'all':!![]}];}return db['Plugin']['findAll'](_0x33b435);})['then'](function(_0x236c4c){_0x38d3d4[_0x3e7a('0x48')]=_0x236c4c;return _0x38d3d4;})[_0x3e7a('0x28')](respondWithFilteredResult(_0x360c7e,_0x33b435))['catch'](handleError(_0x360c7e,null));};exports[_0x3e7a('0x49')]=function(_0x59db3d,_0x32d572){var _0x2075d5={'raw':!![],'where':{'id':_0x59db3d[_0x3e7a('0x4a')]['id']}},_0x59c177={};_0x59c177[_0x3e7a('0x33')]=_['keys'](db[_0x3e7a('0x30')][_0x3e7a('0x4b')]);_0x59c177[_0x3e7a('0x35')]=_['keys'](_0x59db3d[_0x3e7a('0x35')]);_0x59c177[_0x3e7a('0x37')]=_[_0x3e7a('0x38')](_0x59c177['model'],_0x59c177[_0x3e7a('0x35')]);_0x2075d5['attributes']=_[_0x3e7a('0x38')](_0x59c177['model'],qs[_0x3e7a('0x3a')](_0x59db3d[_0x3e7a('0x35')][_0x3e7a('0x3a')]));_0x2075d5['attributes']=_0x2075d5[_0x3e7a('0x39')][_0x3e7a('0x3b')]?_0x2075d5[_0x3e7a('0x39')]:_0x59c177[_0x3e7a('0x33')];if(_0x59db3d[_0x3e7a('0x35')][_0x3e7a('0x46')]){_0x2075d5[_0x3e7a('0x47')]=[{'all':!![]}];}_0x2075d5=_[_0x3e7a('0x44')]({},_0x2075d5,_0x59db3d[_0x3e7a('0x45')]);return db['Plugin'][_0x3e7a('0x4c')](_0x2075d5)[_0x3e7a('0x28')](handleEntityNotFound(_0x32d572,null))[_0x3e7a('0x28')](respondWithResult(_0x32d572,null))[_0x3e7a('0x4d')](handleError(_0x32d572,null));};exports['download']=function(_0x307555,_0x14fae5,_0x785821){return db[_0x3e7a('0x30')][_0x3e7a('0x4c')]({'where':{'id':_0x307555[_0x3e7a('0x4a')]['id']},'attributes':[_0x3e7a('0x2e'),'path'],'raw':!![]})['then'](handleEntityNotFound(_0x14fae5,null))['then'](function(_0x45d3ac){if(_0x45d3ac){var _0x50a267=path[_0x3e7a('0x4e')](config[_0x3e7a('0x4f')],_0x3e7a('0x50'),util[_0x3e7a('0x51')](_0x3e7a('0x52'),path[_0x3e7a('0x53')](_0x45d3ac[_0x3e7a('0x7')])));var _0x2fe118=fs['createWriteStream'](_0x50a267);var _0xda333a=archiver(_0x3e7a('0x54'),{'zlib':{'level':0x9}});_0xda333a['on'](_0x3e7a('0x55'),function(_0x34eece){if(_0x34eece[_0x3e7a('0x56')]===_0x3e7a('0x57')){logger[_0x3e7a('0x2c')](_0x34eece);}else{throw new db['Sequelize'][(_0x3e7a('0x58'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0xda333a['on']('error',function(_0x534d59){throw new db['Sequelize'][(_0x3e7a('0x58'))](_0x3e7a('0x59'));});_0xda333a[_0x3e7a('0x5a')](_0x2fe118);_0xda333a[_0x3e7a('0x5b')](_0x3e7a('0x5c'),{'cwd':path[_0x3e7a('0x4e')](config[_0x3e7a('0x4f')],_0x3e7a('0x50'),path['dirname'](_0x45d3ac[_0x3e7a('0x7')])),'ignore':[path[_0x3e7a('0x4e')](path[_0x3e7a('0x53')](_0x45d3ac[_0x3e7a('0x7')]),_0x3e7a('0x5d')),path[_0x3e7a('0x4e')](path[_0x3e7a('0x53')](_0x45d3ac[_0x3e7a('0x7')]),_0x3e7a('0x5e'))],'nodir':!![]})[_0x3e7a('0x5f')]();_0x2fe118['on'](_0x3e7a('0x60'),function(){if(!fs[_0x3e7a('0x61')](_0x50a267)){throw new db['Sequelize'][(_0x3e7a('0x58'))](_0x3e7a('0x62'));}return _0x14fae5['download'](_0x50a267,util[_0x3e7a('0x51')](_0x3e7a('0x52'),path[_0x3e7a('0x53')](_0x45d3ac['path'])),function(_0x2cb503){if(_0x2cb503){throw new db[(_0x3e7a('0x63'))][(_0x3e7a('0x58'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x3e7a('0x64')](_0x50a267);logger['info']('Download\x20completed');logger[_0x3e7a('0x65')](_0x3e7a('0x66'));});});}return null;})[_0x3e7a('0x4d')](handleError(_0x14fae5,null));};exports[_0x3e7a('0x67')]=function(_0x123986,_0x11aaf5,_0x5e3c72){var _0x42aed4=path['basename'](_0x123986['file'][_0x3e7a('0x68')],path[_0x3e7a('0x69')](_0x123986[_0x3e7a('0x6a')][_0x3e7a('0x68')]));var _0x142b85=path[_0x3e7a('0x4e')](config[_0x3e7a('0x4f')],_0x3e7a('0x50'),_0x123986[_0x3e7a('0x6a')][_0x3e7a('0x68')]);var _0x489cbb=path[_0x3e7a('0x4e')](config[_0x3e7a('0x4f')],_0x3e7a('0x50'),_0x42aed4);logger[_0x3e7a('0x65')](_0x3e7a('0x6b'),_0x142b85);logger['info'](_0x3e7a('0x6c'),_0x489cbb);try{fs[_0x3e7a('0x6d')](_0x142b85,parseInt(_0x3e7a('0x6e'),0x8));extract(_0x142b85,{'dir':_0x489cbb},function(_0x13fee5){if(_0x13fee5){logger[_0x3e7a('0x2c')](_0x13fee5);handleError(_0x13fee5,!![]);};var _0xcde9d6=fs[_0x3e7a('0x6f')](_0x489cbb);if(_0xcde9d6[_0x3e7a('0x3b')]>0x1){removeReferences(_0x142b85,_0x489cbb);logger[_0x3e7a('0x2c')](_0x3e7a('0x70'));return _0x5e3c72(new Error(_0x3e7a('0x70')));}var _0xdb8d94=fs[_0x3e7a('0x71')](path[_0x3e7a('0x4e')](_0x489cbb,_0xcde9d6[0x0]));if(_0xdb8d94[_0x3e7a('0x72')]()){removeReferences(_0x142b85,_0x489cbb);logger[_0x3e7a('0x2c')](_0x3e7a('0x70'));return _0x5e3c72(new Error(_0x3e7a('0x70')));}if(_0xdb8d94[_0x3e7a('0x73')]()){var _0x44c55=fs[_0x3e7a('0x6f')](path[_0x3e7a('0x4e')](_0x489cbb,_0xcde9d6[0x0]));if(_0x44c55['length']===0x0){removeReferences(_0x142b85,_0x489cbb);logger[_0x3e7a('0x2c')](_0x3e7a('0x70'));return _0x5e3c72(new Error('Invalid\x20plugin\x20structure'));}var _0x1a8f13=_0x44c55[_0x3e7a('0x74')](function(_0x12047f){return _0x12047f===_0x3e7a('0x75');});if(!_0x1a8f13){return _0x5e3c72(new Error(_0x3e7a('0x76')));}var _0x3de12d=fs['readFileSync'](path[_0x3e7a('0x4e')](_0x489cbb,_0xcde9d6[0x0],_0x3e7a('0x75')));var _0x79dbee=JSON[_0x3e7a('0x77')](_0x3de12d);if(_0x3e7a('0x78')==typeof _0x79dbee['name']){return _0x5e3c72(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x3e7a('0x78')==typeof _0x79dbee[_0x3e7a('0x42')]){return _0x5e3c72(new Error(_0x3e7a('0x79')));}if(_0x3e7a('0x78')==typeof _0x79dbee[_0x3e7a('0x7a')]){return _0x5e3c72(new Error(_0x3e7a('0x7b')));}if('undefined'==typeof _0x79dbee[_0x3e7a('0x7c')]){return _0x5e3c72(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x79dbee[_0x3e7a('0x42')]===_0x3e7a('0x7d')){if(_0x3e7a('0x78')==typeof _0x79dbee['parameters']['views']){return _0x5e3c72(new Error(_0x3e7a('0x7e')));}if(_0x3e7a('0x78')==typeof _0x79dbee[_0x3e7a('0x7c')][_0x3e7a('0x7f')]['admin']&&'undefined'==typeof _0x79dbee[_0x3e7a('0x7c')][_0x3e7a('0x7f')]['agent']){return _0x5e3c72(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x79dbee[_0x3e7a('0x42')]===_0x3e7a('0x80')){if(_0x3e7a('0x78')==typeof _0x79dbee[_0x3e7a('0x7c')][_0x3e7a('0x81')]){return _0x5e3c72(new Error(_0x3e7a('0x82')));}if(_0x3e7a('0x78')==typeof _0x79dbee[_0x3e7a('0x7c')][_0x3e7a('0x83')]){return _0x5e3c72(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x5e3c72(new Error(_0x3e7a('0x84')));}var _0x5bcf95=_0x79dbee[_0x3e7a('0x2e')];var _0x584db0=_0x79dbee[_0x3e7a('0x85')];var _0x161f16=_0x79dbee[_0x3e7a('0x42')];var _0x9bb323=_0x79dbee[_0x3e7a('0x86')]?_0x79dbee[_0x3e7a('0x86')]:_0x3e7a('0x87');var _0x5e8683=_0x79dbee['icon']?_0x79dbee['icon']:'icon-apps';var _0x3a7ea8='';var _0x5841d7='';var _0x339053='';var _0x3c9a88='';var _0x86c186=_0x79dbee[_0x3e7a('0x7a')];if(_0x161f16===_0x3e7a('0x7d')){if(_0x3e7a('0x78')!=typeof _0x79dbee[_0x3e7a('0x7c')][_0x3e7a('0x7f')][_0x3e7a('0x88')]){var _0x2b7271=_0x79dbee[_0x3e7a('0x7c')][_0x3e7a('0x7f')][_0x3e7a('0x88')];if(!/^(f|ht)tps?:\/\//i[_0x3e7a('0x89')](_0x2b7271)){_0x3a7ea8=path[_0x3e7a('0x4e')](_0x3e7a('0x8a'),_0x42aed4,_0xcde9d6[0x0],_0x2b7271);}else{_0x3a7ea8=_0x2b7271;}}else{logger[_0x3e7a('0x65')](_0x3e7a('0x8b'));}if(_0x3e7a('0x78')!=typeof _0x79dbee[_0x3e7a('0x7c')][_0x3e7a('0x7f')][_0x3e7a('0x8c')]){var _0x1d5d4d=_0x79dbee['parameters']['views'][_0x3e7a('0x8c')];if(!/^(f|ht)tps?:\/\//i[_0x3e7a('0x89')](_0x1d5d4d)){_0x5841d7=path[_0x3e7a('0x4e')]('plugins',_0x42aed4,_0xcde9d6[0x0],_0x1d5d4d);}else{_0x5841d7=_0x1d5d4d;}}else{logger[_0x3e7a('0x65')](_0x3e7a('0x8d'));}}else if(_0x161f16===_0x3e7a('0x80')){_0x339053=_0x79dbee[_0x3e7a('0x7c')]['scriptName'];_0x3c9a88=_0x79dbee[_0x3e7a('0x7c')][_0x3e7a('0x83')];if(_0x3e7a('0x78')!=typeof _0x79dbee[_0x3e7a('0x7c')][_0x3e7a('0x7f')]){if(_0x3e7a('0x78')!=typeof _0x79dbee[_0x3e7a('0x7c')]['views']['admin']){var _0x2b7271=_0x79dbee['parameters'][_0x3e7a('0x7f')][_0x3e7a('0x88')];if(!/^(f|ht)tps?:\/\//i[_0x3e7a('0x89')](_0x2b7271)){_0x3a7ea8=path[_0x3e7a('0x4e')]('plugins',_0x42aed4,_0xcde9d6[0x0],_0x2b7271);}else{_0x3a7ea8=_0x2b7271;}}if('undefined'!=typeof _0x79dbee['parameters'][_0x3e7a('0x7f')][_0x3e7a('0x8c')]){var _0x1d5d4d=_0x79dbee[_0x3e7a('0x7c')][_0x3e7a('0x7f')][_0x3e7a('0x8c')];if(!/^(f|ht)tps?:\/\//i[_0x3e7a('0x89')](_0x1d5d4d)){_0x5841d7=path[_0x3e7a('0x4e')](_0x3e7a('0x8a'),_0x42aed4,_0xcde9d6[0x0],_0x1d5d4d);}else{_0x5841d7=_0x1d5d4d;}}}}var _0x36652b={'name':_0x5bcf95,'description':_0x584db0,'path':path['join'](_0x42aed4,_0xcde9d6[0x0]),'type':_0x161f16,'sidebar':_0x9bb323,'icon':_0x5e8683,'adminUrl':_0x3a7ea8,'agentUrl':_0x5841d7,'scriptName':_0x339053,'scriptPath':_0x3c9a88,'version':_0x86c186};removeReferences(_0x142b85,null);return db['Plugin'][_0x3e7a('0x8e')](_0x36652b)[_0x3e7a('0x28')](function(_0x559b3f){var _0x47d94d={'role':_0x123986[_0x3e7a('0x8f')][_0x3e7a('0x90')],'userProfileId':_0x123986[_0x3e7a('0x8f')]['userProfileId']};if(!_0x47d94d)throw new Error(_0x3e7a('0x91'));if(_0x47d94d['role']===_0x3e7a('0x92')){var _0x39d8a7=_0x559b3f['get']({'plain':!![]});return db['UserProfileSection'][_0x3e7a('0x4c')]({'where':{'name':_0x3e7a('0x93'),'userProfileId':_0x47d94d[_0x3e7a('0x94')]},'raw':!![]})[_0x3e7a('0x28')](function(_0x2a9212){if(_0x2a9212&&_0x2a9212[_0x3e7a('0x95')]===0x0){return db[_0x3e7a('0x2a')][_0x3e7a('0x8e')]({'name':_0x39d8a7[_0x3e7a('0x2e')],'resourceId':_0x39d8a7['id'],'type':_0x2a9212[_0x3e7a('0x2e')],'sectionId':_0x2a9212['id']},{})[_0x3e7a('0x28')](function(){return _0x559b3f;});}else{return _0x559b3f;}})[_0x3e7a('0x4d')](function(_0xcd6384){logger['error'](_0x3e7a('0x96'),_0xcd6384);throw _0xcd6384;});}return _0x559b3f;})[_0x3e7a('0x28')](respondWithResult(_0x11aaf5,null))['catch'](handleError(_0x11aaf5,null));}});}catch(_0x36b831){_0x11aaf5[_0x3e7a('0x1d')](0x1f4)[_0x3e7a('0x2f')](_0x36b831);}};function removeReferences(_0x115177,_0x5ab99a){try{if(_0x115177){fs[_0x3e7a('0x64')](_0x115177);logger[_0x3e7a('0x65')]('Zip\x20archive\x20removed');}if(_0x5ab99a){rimraf(_0x5ab99a,function(){});logger[_0x3e7a('0x65')]('Extracted\x20folder\x20removed');}}catch(_0xcfe3a1){logger[_0x3e7a('0x2c')](_0xcfe3a1);}}exports[_0x3e7a('0x27')]=function(_0x35ac92,_0x59322f,_0x4237df){return db[_0x3e7a('0x30')][_0x3e7a('0x4c')]({'where':{'id':_0x35ac92[_0x3e7a('0x4a')]['id']}})[_0x3e7a('0x28')](handleEntityNotFound(_0x59322f,null))[_0x3e7a('0x28')](saveUpdates(_0x35ac92[_0x3e7a('0x8f')],null))[_0x3e7a('0x28')](respondWithResult(_0x59322f,null))['catch'](handleError(_0x59322f,null));};exports[_0x3e7a('0x97')]=function(_0x491a5f,_0x39c68d,_0x483c1f){return db[_0x3e7a('0x30')][_0x3e7a('0x4c')]({'where':{'id':_0x491a5f[_0x3e7a('0x4a')]['id']}})['then'](function(_0x467c96){if(_0x467c96){return _0x467c96['destroy']();}})[_0x3e7a('0x28')](function(_0x242a14){rimraf(path['join'](config[_0x3e7a('0x4f')],_0x3e7a('0x50'),path[_0x3e7a('0x98')](_0x242a14['path'])),function(){});return _0x242a14;})['then'](handleEntityNotFound(_0x39c68d,null))[_0x3e7a('0x28')](respondWithStatusCode(_0x39c68d,null))[_0x3e7a('0x4d')](handleError(_0x39c68d,null));};exports[_0x3e7a('0x99')]=function(_0x46e8f5,_0x159b55,_0x3ccd4){return BPromise['resolve']()[_0x3e7a('0x28')](function(){if(!_0x46e8f5['query'][_0x3e7a('0x7')]){throw new Error(_0x3e7a('0x9a'));}if(!_0x46e8f5[_0x3e7a('0x35')]['port']){throw new Error(_0x3e7a('0x9b'));}var _0x3b9337=_0x46e8f5[_0x3e7a('0x35')]['hostname']?_0x46e8f5[_0x3e7a('0x35')][_0x3e7a('0x9c')]+':'+_0x46e8f5[_0x3e7a('0x35')][_0x3e7a('0x9d')]:_0x3e7a('0x9e')+_0x46e8f5[_0x3e7a('0x35')][_0x3e7a('0x9d')];var _0x5b9cbd=_0x46e8f5[_0x3e7a('0x35')]['json']?_0x46e8f5['query'][_0x3e7a('0x1f')]:!![];var _0x5b7326=_0x46e8f5[_0x3e7a('0x35')][_0x3e7a('0x9f')]?_0x46e8f5['query'][_0x3e7a('0x9f')]:null;var _0x16d8df={'method':_0x46e8f5[_0x3e7a('0xa0')],'uri':util['format']('%s%s',_0x3b9337,_0x46e8f5['query']['path']),'json':_0x5b9cbd,'resolveWithFullResponse':!![],'encoding':_0x5b7326,'qs':_0x46e8f5['query']};if(_0x46e8f5['headers']){_0x16d8df['headers']=_0x46e8f5[_0x3e7a('0xa1')];if(_0x16d8df[_0x3e7a('0xa1')][_0x3e7a('0xa2')]){delete _0x16d8df[_0x3e7a('0xa1')][_0x3e7a('0xa2')];}}if(_0x16d8df[_0x3e7a('0xa1')]['content-type']){delete _0x16d8df[_0x3e7a('0xa1')]['content-type'];}return rp(_0x16d8df);})['then'](function(_0x3d6705){if(_0x3d6705){_0x159b55['set'](_0x3d6705['headers']);logger['info'](_0x3d6705['body']);if(_[_0x3e7a('0xa3')](_0x46e8f5[_0x3e7a('0x35')][_0x3e7a('0x7')],'download')&&_0x3d6705[_0x3e7a('0xa4')]==0x1f4){return _0x159b55[_0x3e7a('0x1c')](_0x3d6705[_0x3e7a('0xa4')]);}else{return _0x159b55[_0x3e7a('0x1d')](_0x3d6705[_0x3e7a('0xa4')])['send'](_0x3d6705[_0x3e7a('0x8f')]);}}else{return _0x159b55[_0x3e7a('0x1c')](0xc8);}})[_0x3e7a('0x4d')](handleError(_0x159b55,null));};exports[_0x3e7a('0xa5')]=function(_0x357e61,_0x1c7773,_0x6f2fbf){return BPromise[_0x3e7a('0xa6')]()['then'](function(){if(!_0x357e61[_0x3e7a('0x35')][_0x3e7a('0x7')]){throw new Error(_0x3e7a('0x9a'));}if(!_0x357e61['query'][_0x3e7a('0x9d')]){throw new Error(_0x3e7a('0x9b'));}var _0x376051=_0x357e61[_0x3e7a('0x35')][_0x3e7a('0x9c')]?_0x357e61[_0x3e7a('0x35')][_0x3e7a('0x9c')]+':'+_0x357e61[_0x3e7a('0x35')][_0x3e7a('0x9d')]:'http://localhost:'+_0x357e61[_0x3e7a('0x35')][_0x3e7a('0x9d')];var _0x4f04f0=_0x357e61[_0x3e7a('0x35')][_0x3e7a('0x1f')]?_0x357e61['query']['json']:!![];var _0x58d92d=_0x357e61[_0x3e7a('0x35')][_0x3e7a('0x9f')]?_0x357e61[_0x3e7a('0x35')][_0x3e7a('0x9f')]:null;var _0x454c00={'method':_0x357e61[_0x3e7a('0xa0')],'uri':util[_0x3e7a('0x51')]('%s%s',_0x376051,_0x357e61['query'][_0x3e7a('0x7')]),'json':_0x4f04f0,'resolveWithFullResponse':!![],'encoding':_0x58d92d,'body':_0x357e61['body']};if(_0x357e61[_0x3e7a('0xa1')]){_0x454c00[_0x3e7a('0xa1')]=_0x357e61[_0x3e7a('0xa1')];if(_0x454c00[_0x3e7a('0xa1')]['content-length']){delete _0x454c00[_0x3e7a('0xa1')][_0x3e7a('0xa2')];}}if(_0x454c00['headers'][_0x3e7a('0xa7')]){delete _0x454c00[_0x3e7a('0xa1')][_0x3e7a('0xa7')];}return rp(_0x454c00);})['then'](function(_0x147339){if(_0x147339){_0x1c7773[_0x3e7a('0x23')](_0x147339['headers']);logger[_0x3e7a('0x65')](_0x147339[_0x3e7a('0x8f')]);return _0x1c7773[_0x3e7a('0x1d')](_0x147339[_0x3e7a('0xa4')])[_0x3e7a('0x2f')](_0x147339[_0x3e7a('0x8f')]);}else{return _0x1c7773[_0x3e7a('0x1c')](0xc8);}})['catch'](handleError(_0x1c7773,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 56953c2..79874ff 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 _0x0324=['../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0xc5c1ac,_0xfe1ed2){var _0x5bc58c=function(_0x52b2b9){while(--_0x52b2b9){_0xc5c1ac['push'](_0xc5c1ac['shift']());}};_0x5bc58c(++_0xfe1ed2);}(_0x0324,0x90));var _0x4032=function(_0x1608d7,_0x44bcbe){_0x1608d7=_0x1608d7-0x0;var _0x2cfd80=_0x0324[_0x1608d7];return _0x2cfd80;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x4032('0x0'))['db'][_0x4032('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x4032('0x2')](0x0);var events={'afterCreate':_0x4032('0x3'),'afterUpdate':_0x4032('0x4'),'afterDestroy':_0x4032('0x5')};function emitEvent(_0x4fbc08){return function(_0x17e87f,_0x23bfd7,_0x297bc9){PluginEvents[_0x4032('0x6')](_0x4fbc08+':'+_0x17e87f['id'],_0x17e87f);PluginEvents[_0x4032('0x6')](_0x4fbc08,_0x17e87f);_0x297bc9(null);};}for(var e in events){if(events[_0x4032('0x7')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x4032('0x8')]=PluginEvents; \ No newline at end of file +var _0xbd0e=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0xbd0e,0x187));var _0xebd0=function(_0x462b3a,_0x52fa71){_0x462b3a=_0x462b3a-0x0;var _0xbc5daa=_0xbd0e[_0x462b3a];return _0xbc5daa;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xebd0('0x0'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0xebd0('0x1')](0x0);var events={'afterCreate':_0xebd0('0x2'),'afterUpdate':_0xebd0('0x3'),'afterDestroy':_0xebd0('0x4')};function emitEvent(_0x1f7733){return function(_0x811ddd,_0x4df56d,_0x54075a){PluginEvents[_0xebd0('0x5')](_0x1f7733+':'+_0x811ddd['id'],_0x811ddd);PluginEvents[_0xebd0('0x5')](_0x1f7733,_0x811ddd);_0x54075a(null);};}for(var e in events){if(events[_0xebd0('0x6')](e)){var event=events[e];Plugin[_0xebd0('0x7')](e,emitEvent(event));}}module[_0xebd0('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 977879c..b6e2ea6 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 _0xb2cb=['path','../../config/environment','./plugin.attributes','exports','define','Plugin','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x261ebb,_0x52f159){var _0x5397fc=function(_0x5b86c4){while(--_0x5b86c4){_0x261ebb['push'](_0x261ebb['shift']());}};_0x5397fc(++_0x52f159);}(_0xb2cb,0x8a));var _0xbb2c=function(_0xf34895,_0x21fb70){_0xf34895=_0xf34895-0x0;var _0x143f44=_0xb2cb[_0xf34895];return _0x143f44;};'use strict';var _=require(_0xbb2c('0x0'));var util=require(_0xbb2c('0x1'));var logger=require(_0xbb2c('0x2'))(_0xbb2c('0x3'));var moment=require('moment');var BPromise=require(_0xbb2c('0x4'));var rp=require(_0xbb2c('0x5'));var fs=require('fs');var path=require(_0xbb2c('0x6'));var rimraf=require('rimraf');var config=require(_0xbb2c('0x7'));var attributes=require(_0xbb2c('0x8'));module[_0xbb2c('0x9')]=function(_0x23340d,_0x4c3cad){return _0x23340d[_0xbb2c('0xa')](_0xbb2c('0xb'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0aaf=['./plugin.attributes','exports','define','Plugin','plugins','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x528a02,_0x87d9eb){var _0x2478b1=function(_0x30561e){while(--_0x30561e){_0x528a02['push'](_0x528a02['shift']());}};_0x2478b1(++_0x87d9eb);}(_0x0aaf,0xfc));var _0xf0aa=function(_0x2242a1,_0x38f44d){_0x2242a1=_0x2242a1-0x0;var _0x2c298b=_0x0aaf[_0x2242a1];return _0x2c298b;};'use strict';var _=require(_0xf0aa('0x0'));var util=require(_0xf0aa('0x1'));var logger=require(_0xf0aa('0x2'))(_0xf0aa('0x3'));var moment=require(_0xf0aa('0x4'));var BPromise=require(_0xf0aa('0x5'));var rp=require(_0xf0aa('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf0aa('0x7'));var config=require('../../config/environment');var attributes=require(_0xf0aa('0x8'));module[_0xf0aa('0x9')]=function(_0x16d06f,_0xfbc6ac){return _0x16d06f[_0xf0aa('0xa')](_0xf0aa('0xb'),attributes,{'tableName':_0xf0aa('0xc'),'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 baefd55..b018af8 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 _0x2531=['options','raw','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreatePlugin','Plugin','body'];(function(_0x58930b,_0x326c01){var _0x311416=function(_0x5bb674){while(--_0x5bb674){_0x58930b['push'](_0x58930b['shift']());}};_0x311416(++_0x326c01);}(_0x2531,0x1d1));var _0x1253=function(_0x2f9dea,_0x4fa8b4){_0x2f9dea=_0x2f9dea-0x0;var _0x256542=_0x2531[_0x2f9dea];return _0x256542;};'use strict';var _=require(_0x1253('0x0'));var util=require(_0x1253('0x1'));var moment=require(_0x1253('0x2'));var BPromise=require('bluebird');var rs=require(_0x1253('0x3'));var fs=require('fs');var Redis=require(_0x1253('0x4'));var db=require(_0x1253('0x5'))['db'];var utils=require(_0x1253('0x6'));var logger=require(_0x1253('0x7'))(_0x1253('0x8'));var config=require('../../config/environment');var jayson=require(_0x1253('0x9'));var client=jayson[_0x1253('0xa')][_0x1253('0xb')]({'port':0x232a});config[_0x1253('0xc')]=_[_0x1253('0xd')](config[_0x1253('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x1253('0xe'))(new Redis(config[_0x1253('0xc')]));require('./plugin.socket')[_0x1253('0xf')](socket);function respondWithRpcPromise(_0x4396ba,_0x38eb6e,_0xdc361f){return new BPromise(function(_0x48e602,_0x329a70){return client[_0x1253('0x10')](_0x4396ba,_0xdc361f)['then'](function(_0x168581){logger[_0x1253('0x11')](_0x1253('0x12'),_0x38eb6e,_0x1253('0x13'));logger[_0x1253('0x14')](_0x1253('0x15'),_0x38eb6e,_0x1253('0x13'),JSON[_0x1253('0x16')](_0x168581));if(_0x168581[_0x1253('0x17')]){if(_0x168581[_0x1253('0x17')]['code']===0x1f4){logger[_0x1253('0x17')]('Plugin,\x20%s,\x20%s',_0x38eb6e,_0x168581[_0x1253('0x17')]['message']);return _0x329a70(_0x168581[_0x1253('0x17')][_0x1253('0x18')]);}logger[_0x1253('0x17')](_0x1253('0x12'),_0x38eb6e,_0x168581[_0x1253('0x17')][_0x1253('0x18')]);return _0x48e602(_0x168581[_0x1253('0x17')][_0x1253('0x18')]);}else{logger['info'](_0x1253('0x12'),_0x38eb6e,'request\x20sent');_0x48e602(_0x168581[_0x1253('0x19')][_0x1253('0x18')]);}})[_0x1253('0x1a')](function(_0x1a55ae){logger['error'](_0x1253('0x12'),_0x38eb6e,_0x1a55ae);_0x329a70(_0x1a55ae);});});}exports[_0x1253('0x1b')]=function(_0x4ce9fc){var _0x11c04d=this;return new Promise(function(_0x4ad630,_0x93f372){return db[_0x1253('0x1c')]['create'](_0x4ce9fc[_0x1253('0x1d')],{'raw':_0x4ce9fc[_0x1253('0x1e')]?_0x4ce9fc['options'][_0x1253('0x1f')]===undefined?!![]:![]:!![]})[_0x1253('0x20')](function(_0xd6073){logger[_0x1253('0x11')](_0x1253('0x1b'),_0x4ce9fc);logger[_0x1253('0x14')](_0x1253('0x1b'),_0x4ce9fc,JSON[_0x1253('0x16')](_0xd6073));_0x4ad630(_0xd6073);})['catch'](function(_0x4fa6cd){logger[_0x1253('0x17')](_0x1253('0x1b'),_0x4fa6cd[_0x1253('0x18')],_0x4ce9fc);_0x93f372(_0x11c04d[_0x1253('0x17')](0x1f4,_0x4fa6cd['message']));});});}; \ No newline at end of file +var _0x6713=['register','request','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','options','CreatePlugin','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./plugin.socket'];(function(_0x4a3168,_0x494f38){var _0x35c154=function(_0x1ab446){while(--_0x1ab446){_0x4a3168['push'](_0x4a3168['shift']());}};_0x35c154(++_0x494f38);}(_0x6713,0x6a));var _0x3671=function(_0x5aef17,_0x592cd4){_0x5aef17=_0x5aef17-0x0;var _0x43f9d0=_0x6713[_0x5aef17];return _0x43f9d0;};'use strict';var _=require(_0x3671('0x0'));var util=require('util');var moment=require(_0x3671('0x1'));var BPromise=require('bluebird');var rs=require(_0x3671('0x2'));var fs=require('fs');var Redis=require(_0x3671('0x3'));var db=require(_0x3671('0x4'))['db'];var utils=require(_0x3671('0x5'));var logger=require(_0x3671('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3671('0x7'));var client=jayson[_0x3671('0x8')]['http']({'port':0x232a});config[_0x3671('0x9')]=_[_0x3671('0xa')](config[_0x3671('0x9')],{'host':_0x3671('0xb'),'port':0x18eb});var socket=require(_0x3671('0xc'))(new Redis(config['redis']));require(_0x3671('0xd'))[_0x3671('0xe')](socket);function respondWithRpcPromise(_0x3efb43,_0x351ab6,_0x19a77b){return new BPromise(function(_0x44ce24,_0x16a348){return client[_0x3671('0xf')](_0x3efb43,_0x19a77b)[_0x3671('0x10')](function(_0x15253e){logger['info'](_0x3671('0x11'),_0x351ab6,_0x3671('0x12'));logger[_0x3671('0x13')](_0x3671('0x14'),_0x351ab6,'request\x20sent',JSON[_0x3671('0x15')](_0x15253e));if(_0x15253e['error']){if(_0x15253e[_0x3671('0x16')][_0x3671('0x17')]===0x1f4){logger['error']('Plugin,\x20%s,\x20%s',_0x351ab6,_0x15253e[_0x3671('0x16')][_0x3671('0x18')]);return _0x16a348(_0x15253e[_0x3671('0x16')][_0x3671('0x18')]);}logger[_0x3671('0x16')](_0x3671('0x11'),_0x351ab6,_0x15253e[_0x3671('0x16')][_0x3671('0x18')]);return _0x44ce24(_0x15253e[_0x3671('0x16')][_0x3671('0x18')]);}else{logger[_0x3671('0x19')](_0x3671('0x11'),_0x351ab6,_0x3671('0x12'));_0x44ce24(_0x15253e[_0x3671('0x1a')][_0x3671('0x18')]);}})[_0x3671('0x1b')](function(_0x29a1ae){logger[_0x3671('0x16')](_0x3671('0x11'),_0x351ab6,_0x29a1ae);_0x16a348(_0x29a1ae);});});}exports['CreatePlugin']=function(_0x23346d){var _0x49a8fa=this;return new Promise(function(_0x5f1154,_0xdbdd3b){return db['Plugin']['create'](_0x23346d['body'],{'raw':_0x23346d['options']?_0x23346d[_0x3671('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x3671('0x10')](function(_0x15c222){logger[_0x3671('0x19')](_0x3671('0x1d'),_0x23346d);logger[_0x3671('0x13')](_0x3671('0x1d'),_0x23346d,JSON[_0x3671('0x15')](_0x15c222));_0x5f1154(_0x15c222);})[_0x3671('0x1b')](function(_0x51f1f6){logger[_0x3671('0x16')](_0x3671('0x1d'),_0x51f1f6[_0x3671('0x18')],_0x23346d);_0xdbdd3b(_0x49a8fa['error'](0x1f4,_0x51f1f6[_0x3671('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index b4f3157..d1dbcb4 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 _0x4f2b=['removeListener','length','plugin:','./plugin.events','save','update'];(function(_0x1ad2d9,_0xb23fcf){var _0x4f73d9=function(_0xa858ca){while(--_0xa858ca){_0x1ad2d9['push'](_0x1ad2d9['shift']());}};_0x4f73d9(++_0xb23fcf);}(_0x4f2b,0x1b3));var _0xb4f2=function(_0x25b20e,_0x32d483){_0x25b20e=_0x25b20e-0x0;var _0x115dfd=_0x4f2b[_0x25b20e];return _0x115dfd;};'use strict';var PluginEvents=require(_0xb4f2('0x0'));var events=[_0xb4f2('0x1'),'remove',_0xb4f2('0x2')];function createListener(_0x40b083,_0x82a247){return function(_0x4a7796){_0x82a247['emit'](_0x40b083,_0x4a7796);};}function removeListener(_0x47be28,_0x1040d6){return function(){PluginEvents[_0xb4f2('0x3')](_0x47be28,_0x1040d6);};}exports['register']=function(_0x35bb34){for(var _0x1d8028=0x0,_0x2edb1f=events[_0xb4f2('0x4')];_0x1d8028<_0x2edb1f;_0x1d8028++){var _0x2fc792=events[_0x1d8028];var _0x1869f4=createListener(_0xb4f2('0x5')+_0x2fc792,_0x35bb34);PluginEvents['on'](_0x2fc792,_0x1869f4);}}; \ No newline at end of file +var _0xd216=['removeListener','register','length','plugin:','./plugin.events','save','remove','update','emit'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xd216,0x79));var _0x6d21=function(_0xa11792,_0x5c3e62){_0xa11792=_0xa11792-0x0;var _0x5826f8=_0xd216[_0xa11792];return _0x5826f8;};'use strict';var PluginEvents=require(_0x6d21('0x0'));var events=[_0x6d21('0x1'),_0x6d21('0x2'),_0x6d21('0x3')];function createListener(_0x103ba2,_0x236a13){return function(_0x360627){_0x236a13[_0x6d21('0x4')](_0x103ba2,_0x360627);};}function removeListener(_0x76b7f4,_0x4e5935){return function(){PluginEvents[_0x6d21('0x5')](_0x76b7f4,_0x4e5935);};}exports[_0x6d21('0x6')]=function(_0x48b106){for(var _0x1954aa=0x0,_0x262a18=events[_0x6d21('0x7')];_0x1954aa<_0x262a18;_0x1954aa++){var _0x40657d=events[_0x1954aa];var _0x544991=createListener(_0x6d21('0x8')+_0x40657d,_0x48b106);PluginEvents['on'](_0x40657d,_0x544991);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 00900fe..31b6686 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(_0x12a997,_0x1d9635){var _0x2a6822=function(_0x1d2c00){while(--_0x1d2c00){_0x12a997['push'](_0x12a997['shift']());}};_0x2a6822(++_0x1d9635);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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(_0x30cfca,_0x543dd1){var _0x225ad1=function(_0x1048d3){while(--_0x1048d3){_0x30cfca['push'](_0x30cfca['shift']());}};_0x225ad1(++_0x543dd1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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 f11569b..f25c77d 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 _0x4483=['error','stack','name','send','npm\x20install','info','list','express','motion2','length','then','catch','show','describe','body','script','join','../../files/plugins','chdir','dirname','start','dump','update','restart','stop','hasOwnProperty','params','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','path','child_process','exec','bluebird','sendStatus','status','json'];(function(_0xa4fe9f,_0x2944c1){var _0x9f0e3e=function(_0x44dbf8){while(--_0x44dbf8){_0xa4fe9f['push'](_0xa4fe9f['shift']());}};_0x9f0e3e(++_0x2944c1);}(_0x4483,0x1a3));var _0x3448=function(_0xb47bc9,_0x1f9b7d){_0xb47bc9=_0xb47bc9-0x0;var _0xf631b8=_0x4483[_0xb47bc9];return _0xf631b8;};'use strict';var _=require(_0x3448('0x0'));var pm2=require(_0x3448('0x1'));var logger=require(_0x3448('0x2'))('api');var path=require(_0x3448('0x3'));var exec=require(_0x3448('0x4'))[_0x3448('0x5')];var BPromise=require(_0x3448('0x6'));function handleEntityNotFound(_0xef1a93,_0x5f5163){return function(_0xeb5b8){if(!_0xeb5b8){_0xef1a93[_0x3448('0x7')](0x194);;}return _0xeb5b8;};}function respondWithResult(_0x1b05db,_0xd3606d){_0xd3606d=_0xd3606d||0xc8;return function(_0x1bb7e5){if(_0x1bb7e5){return _0x1b05db[_0x3448('0x8')](_0xd3606d)[_0x3448('0x9')](_0x1bb7e5);}return null;};}function handleError(_0x34b926,_0x5923ee){_0x5923ee=_0x5923ee||0x1f4;return function(_0x5c82c6){logger[_0x3448('0xa')](_0x5c82c6[_0x3448('0xb')]);if(_0x5c82c6[_0x3448('0xc')]){delete _0x5c82c6[_0x3448('0xc')];}_0x34b926[_0x3448('0x8')](_0x5923ee)[_0x3448('0xd')](_0x5c82c6);};}function execChildProcess(){return new BPromise(function(_0x2bdf02,_0x32cd61){exec(_0x3448('0xe'),function(_0x35bb7b,_0x2a6048,_0x481a6f){logger['info'](_0x2a6048);logger[_0x3448('0xf')](_0x481a6f);if(_0x35bb7b){logger[_0x3448('0xa')](_0x35bb7b);return _0x32cd61(_0x35bb7b);}return _0x2bdf02(_0x2a6048);});});}exports['index']=function(_0x2661e1,_0xdfb89d){return pm2[_0x3448('0x10')]()['then'](function(_0x14104c){if(_0x14104c){var _0x2952a6=_['reject'](_0x14104c,function(_0x2387a3){return _0x2387a3[_0x3448('0xc')]===_0x3448('0x11')||_0x2387a3['name']===_0x3448('0x12');});return{'rows':_0x2952a6,'count':_0x2952a6[_0x3448('0x13')]};}return null;})[_0x3448('0x14')](respondWithResult(_0xdfb89d,null))[_0x3448('0x15')](handleError(_0xdfb89d,null));};exports[_0x3448('0x16')]=function(_0x1b2081,_0x247d1a){return pm2[_0x3448('0x17')](_0x1b2081['params']['id'])[_0x3448('0x14')](respondWithResult(_0x247d1a,null))['then'](handleEntityNotFound(_0x247d1a,null))['catch'](handleError(_0x247d1a,null));};exports['create']=function(_0x1e9774,_0x278736){if(_0x1e9774[_0x3448('0x18')]['name']&&_0x1e9774[_0x3448('0x18')][_0x3448('0x19')]){var _0x317de6=path[_0x3448('0x1a')](__dirname,_0x3448('0x1b'),_0x1e9774[_0x3448('0x18')]['script']);var _0x54c7ee=process['cwd']();process[_0x3448('0x1c')](path[_0x3448('0x1d')](_0x317de6));return execChildProcess()['then'](function(_0x5b1f7c){process[_0x3448('0x1c')](_0x54c7ee);return pm2[_0x3448('0x1e')]({'name':_0x1e9774[_0x3448('0x18')][_0x3448('0xc')],'script':_0x317de6});})[_0x3448('0x14')](function(_0x566ff5){pm2[_0x3448('0x1f')]();return _0x566ff5[0x0];})[_0x3448('0x14')](respondWithResult(_0x278736,0xc9))[_0x3448('0x15')](handleError(_0x278736,null));}else{return _0x278736[_0x3448('0x8')](0x1f4)[_0x3448('0xd')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x3448('0x20')]=function(_0x393081,_0x52c163){if(_0x393081[_0x3448('0x18')]['id']){delete _0x393081[_0x3448('0x18')]['id'];}var _0x310912={'online':_0x3448('0x21'),'stopped':_0x3448('0x22')};if(_0x310912[_0x3448('0x23')](_0x393081[_0x3448('0x18')][_0x3448('0x8')])){return pm2[_0x310912[_0x393081['body'][_0x3448('0x8')]]](_0x393081[_0x3448('0x24')]['id'])[_0x3448('0x14')](respondWithResult(_0x52c163,0xc8))['catch'](handleError(_0x52c163,null));}else{return _0x52c163[_0x3448('0x8')](0x1f4)['send']({'message':'Unknown\x20status'});}};exports['destroy']=function(_0x52fb48,_0xff6513){if(_0x52fb48['body']['id']){delete _0x52fb48['body']['id'];}if(_0x52fb48[_0x3448('0x24')]['id']){return pm2[_0x3448('0x25')](_0x52fb48[_0x3448('0x24')]['id'])[_0x3448('0x14')](function(_0x4f4f32){pm2[_0x3448('0x1f')]();return _0x4f4f32[0x0];})[_0x3448('0x14')](respondWithResult(_0xff6513,null))[_0x3448('0x15')](handleError(_0xff6513,null));}else{return _0xff6513['status'](0x1f4)[_0x3448('0xd')]({'message':_0x3448('0x26')});}}; \ No newline at end of file +var _0xbec5=['Unknown\x20id','lodash','../../config/pm2','api','path','child_process','exec','bluebird','sendStatus','status','json','error','name','send','npm\x20install','info','index','list','then','reject','express','motion2','catch','show','create','body','join','../../files/plugins','script','cwd','dirname','chdir','start','dump','restart','hasOwnProperty','params','destroy'];(function(_0x2c9604,_0x501497){var _0x1fc3e1=function(_0x5abcbc){while(--_0x5abcbc){_0x2c9604['push'](_0x2c9604['shift']());}};_0x1fc3e1(++_0x501497);}(_0xbec5,0xe5));var _0x5bec=function(_0x10791d,_0x2562b6){_0x10791d=_0x10791d-0x0;var _0x1b4f9c=_0xbec5[_0x10791d];return _0x1b4f9c;};'use strict';var _=require(_0x5bec('0x0'));var pm2=require(_0x5bec('0x1'));var logger=require('../../config/logger')(_0x5bec('0x2'));var path=require(_0x5bec('0x3'));var exec=require(_0x5bec('0x4'))[_0x5bec('0x5')];var BPromise=require(_0x5bec('0x6'));function handleEntityNotFound(_0x4ee982,_0x1f8933){return function(_0x376cdb){if(!_0x376cdb){_0x4ee982[_0x5bec('0x7')](0x194);;}return _0x376cdb;};}function respondWithResult(_0x4aaac6,_0x3ed67a){_0x3ed67a=_0x3ed67a||0xc8;return function(_0x28a427){if(_0x28a427){return _0x4aaac6[_0x5bec('0x8')](_0x3ed67a)[_0x5bec('0x9')](_0x28a427);}return null;};}function handleError(_0x43d96e,_0x302aae){_0x302aae=_0x302aae||0x1f4;return function(_0x6406a1){logger[_0x5bec('0xa')](_0x6406a1['stack']);if(_0x6406a1[_0x5bec('0xb')]){delete _0x6406a1['name'];}_0x43d96e[_0x5bec('0x8')](_0x302aae)[_0x5bec('0xc')](_0x6406a1);};}function execChildProcess(){return new BPromise(function(_0x117162,_0x4a5482){exec(_0x5bec('0xd'),function(_0x18fa47,_0x16226b,_0x57ffc4){logger[_0x5bec('0xe')](_0x16226b);logger[_0x5bec('0xe')](_0x57ffc4);if(_0x18fa47){logger['error'](_0x18fa47);return _0x4a5482(_0x18fa47);}return _0x117162(_0x16226b);});});}exports[_0x5bec('0xf')]=function(_0xaa984d,_0x35393a){return pm2[_0x5bec('0x10')]()[_0x5bec('0x11')](function(_0xcd6d90){if(_0xcd6d90){var _0x24dcd6=_[_0x5bec('0x12')](_0xcd6d90,function(_0x259588){return _0x259588[_0x5bec('0xb')]===_0x5bec('0x13')||_0x259588[_0x5bec('0xb')]===_0x5bec('0x14');});return{'rows':_0x24dcd6,'count':_0x24dcd6['length']};}return null;})['then'](respondWithResult(_0x35393a,null))[_0x5bec('0x15')](handleError(_0x35393a,null));};exports[_0x5bec('0x16')]=function(_0x31ad9c,_0x1771e7){return pm2['describe'](_0x31ad9c['params']['id'])[_0x5bec('0x11')](respondWithResult(_0x1771e7,null))[_0x5bec('0x11')](handleEntityNotFound(_0x1771e7,null))['catch'](handleError(_0x1771e7,null));};exports[_0x5bec('0x17')]=function(_0xa7e223,_0x32a846){if(_0xa7e223[_0x5bec('0x18')]['name']&&_0xa7e223[_0x5bec('0x18')]['script']){var _0x191c0f=path[_0x5bec('0x19')](__dirname,_0x5bec('0x1a'),_0xa7e223[_0x5bec('0x18')][_0x5bec('0x1b')]);var _0x5e154e=process[_0x5bec('0x1c')]();process['chdir'](path[_0x5bec('0x1d')](_0x191c0f));return execChildProcess()[_0x5bec('0x11')](function(_0x5b2636){process[_0x5bec('0x1e')](_0x5e154e);return pm2[_0x5bec('0x1f')]({'name':_0xa7e223['body'][_0x5bec('0xb')],'script':_0x191c0f});})[_0x5bec('0x11')](function(_0x43d460){pm2[_0x5bec('0x20')]();return _0x43d460[0x0];})[_0x5bec('0x11')](respondWithResult(_0x32a846,0xc9))[_0x5bec('0x15')](handleError(_0x32a846,null));}else{return _0x32a846[_0x5bec('0x8')](0x1f4)['send']({'message':'Missing\x20name\x20and/or\x20path'});}};exports['update']=function(_0x2961bd,_0x2cdd2f){if(_0x2961bd[_0x5bec('0x18')]['id']){delete _0x2961bd['body']['id'];}var _0x2b3b2c={'online':_0x5bec('0x21'),'stopped':'stop'};if(_0x2b3b2c[_0x5bec('0x22')](_0x2961bd[_0x5bec('0x18')]['status'])){return pm2[_0x2b3b2c[_0x2961bd['body'][_0x5bec('0x8')]]](_0x2961bd[_0x5bec('0x23')]['id'])[_0x5bec('0x11')](respondWithResult(_0x2cdd2f,0xc8))[_0x5bec('0x15')](handleError(_0x2cdd2f,null));}else{return _0x2cdd2f[_0x5bec('0x8')](0x1f4)[_0x5bec('0xc')]({'message':'Unknown\x20status'});}};exports[_0x5bec('0x24')]=function(_0x59b5b6,_0x45863b){if(_0x59b5b6[_0x5bec('0x18')]['id']){delete _0x59b5b6[_0x5bec('0x18')]['id'];}if(_0x59b5b6[_0x5bec('0x23')]['id']){return pm2['delete'](_0x59b5b6[_0x5bec('0x23')]['id'])[_0x5bec('0x11')](function(_0xfc7d41){pm2['dump']();return _0xfc7d41[0x0];})[_0x5bec('0x11')](respondWithResult(_0x45863b,null))['catch'](handleError(_0x45863b,null));}else{return _0x45863b[_0x5bec('0x8')](0x1f4)[_0x5bec('0xc')]({'message':_0x5bec('0x25')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 1098c0a..64ebc5c 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 _0x285b=['./realtime.controller','/queues','isAuthenticated','getQueues','exports','express','../../components/auth/service'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x285b,0x171));var _0xb285=function(_0x1659fa,_0x58982c){_0x1659fa=_0x1659fa-0x0;var _0x1c2eb4=_0x285b[_0x1659fa];return _0x1c2eb4;};'use strict';var express=require(_0xb285('0x0'));var router=express['Router']();var auth=require(_0xb285('0x1'));var controller=require(_0xb285('0x2'));router['get'](_0xb285('0x3'),auth[_0xb285('0x4')](),controller[_0xb285('0x5')]);module[_0xb285('0x6')]=router; \ No newline at end of file +var _0xaf30=['get','/queues','getQueues','exports','Router','./realtime.controller'];(function(_0x593499,_0x141a0c){var _0x2309a9=function(_0x3553eb){while(--_0x3553eb){_0x593499['push'](_0x593499['shift']());}};_0x2309a9(++_0x141a0c);}(_0xaf30,0xd0));var _0x0af3=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xaf30[_0x2dadb9];return _0x2f0097;};'use strict';var express=require('express');var router=express[_0x0af3('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x0af3('0x1'));router[_0x0af3('0x2')](_0x0af3('0x3'),auth['isAuthenticated'](),controller[_0x0af3('0x4')]);module[_0x0af3('0x5')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index ec18f2c..5246ce8 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 _0xbd51=['offset','undefined','limit','count','set','json','error','stack','name','send','getQueues','chat','sms','openchannel','fax','whatsapp','voice','query','channel','includes','toLowerCase','Invalid\x20channel','startCase','Queue','map','rawAttributes','fieldName','key','user','role','type','outbound','Queues','filter','UserProfile','getResources','findAndCountAll','then','request','result','loggedIn','available','waiting','talking','push','pTalking','originated','message','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','rows','get','paused','loggedInDb','agents','find','merge','pick','getAgents','online','User','Pause','findAll','QueueId','agent','all','catch','util','jayson/promise','../../components/parsers/qs','../../config/logger','api','http'];(function(_0x4cb11f,_0x5b59a8){var _0x10581c=function(_0x138636){while(--_0x138636){_0x4cb11f['push'](_0x4cb11f['shift']());}};_0x10581c(++_0x5b59a8);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x1de839,_0x1e2b40){_0x1de839=_0x1de839-0x0;var _0x4678cf=_0xbd51[_0x1de839];return _0x4678cf;};'use strict';var util=require(_0x1bd5('0x0'));var _=require('lodash');var jayson=require(_0x1bd5('0x1'));var qs=require(_0x1bd5('0x2'));var logger=require(_0x1bd5('0x3'))(_0x1bd5('0x4'));var db=require('../../mysqldb')['db'];var client=jayson['client']['http']({'port':0x232a});var routingClient=jayson['client'][_0x1bd5('0x5')]({'port':0x232c});function respondWithFilteredResult(_0x362b24,_0x43e6b6){return function(_0x59ddfb){if(_0x59ddfb){var _0x29abea=typeof _0x43e6b6[_0x1bd5('0x6')]===_0x1bd5('0x7')&&typeof _0x43e6b6[_0x1bd5('0x8')]===_0x1bd5('0x7');var _0x4a7f90=_0x59ddfb[_0x1bd5('0x9')];var _0x5c8e0d=_0x29abea?0x0:_0x43e6b6[_0x1bd5('0x6')];var _0x28df8e=_0x29abea?_0x59ddfb[_0x1bd5('0x9')]:_0x43e6b6[_0x1bd5('0x6')]+_0x43e6b6[_0x1bd5('0x8')];var _0x3e3d06;if(_0x28df8e>=_0x4a7f90){_0x28df8e=_0x4a7f90;_0x3e3d06=0xc8;}else{_0x3e3d06=0xce;}_0x362b24['status'](_0x3e3d06);return _0x362b24[_0x1bd5('0xa')]('Content-Range',_0x5c8e0d+'-'+_0x28df8e+'/'+_0x4a7f90)[_0x1bd5('0xb')](_0x59ddfb);}return null;};}function handleError(_0x24e38c,_0x37e8e1){_0x37e8e1=_0x37e8e1||0x1f4;return function(_0x14606b){logger[_0x1bd5('0xc')](_0x14606b[_0x1bd5('0xd')]);if(_0x14606b[_0x1bd5('0xe')]){delete _0x14606b['name'];}_0x24e38c['status'](_0x37e8e1)[_0x1bd5('0xf')](_0x14606b);};}exports[_0x1bd5('0x10')]=function(_0x33f82a,_0x39c44b){var _0x48d048=['mail',_0x1bd5('0x11'),_0x1bd5('0x12'),_0x1bd5('0x13'),_0x1bd5('0x14'),_0x1bd5('0x15'),_0x1bd5('0x16')];var _0x13cf34={'count':0x0,'rows':[]},_0x3afc4a={},_0x4670b5;Promise['resolve']()['then'](function(){if(_0x33f82a[_0x1bd5('0x17')][_0x1bd5('0x18')]){if(!_[_0x1bd5('0x19')](_0x48d048,_0x33f82a[_0x1bd5('0x17')][_0x1bd5('0x18')][_0x1bd5('0x1a')]()))throw new Error(_0x1bd5('0x1b'));_0x4670b5=_0x33f82a[_0x1bd5('0x17')][_0x1bd5('0x18')][_0x1bd5('0x1a')]();}var _0x34bd6a=_[_0x1bd5('0x1c')](_0x4670b5)+_0x1bd5('0x1d');var _0x7ff933=_[_0x1bd5('0x1e')](db[_0x34bd6a][_0x1bd5('0x1f')],function(_0x1f13e7){return{'name':_0x1f13e7[_0x1bd5('0x20')],'type':_0x1f13e7['type'][_0x1bd5('0x21')]};});_0x3afc4a=qs['getOptions'](_0x7ff933,_0x33f82a);if(_0x33f82a[_0x1bd5('0x22')][_0x1bd5('0x23')]===_0x1bd5('0x22')){var _0x48316b={'params':{'id':_0x33f82a[_0x1bd5('0x22')]['userProfileId']},'query':{'section':_0x4670b5===_0x1bd5('0x16')&&_0x33f82a[_0x1bd5('0x17')][_0x1bd5('0x24')]===_0x1bd5('0x25')?'QueueCampaigns':_[_0x1bd5('0x1c')](_0x4670b5)+_0x1bd5('0x26'),'type':_0x33f82a[_0x1bd5('0x17')][_0x1bd5('0x24')],'nolimit':!![],'sort':'name','filter':_0x33f82a[_0x1bd5('0x17')][_0x1bd5('0x27')]}};return db[_0x1bd5('0x28')][_0x1bd5('0x29')](_0x48316b);}return db[_0x34bd6a][_0x1bd5('0x2a')](_0x3afc4a);})[_0x1bd5('0x2b')](function(_0x4e72b2){_0x13cf34[_0x1bd5('0x9')]=_0x4e72b2[_0x1bd5('0x9')];var _0x8d53ba=_0x4670b5==='voice'?client:routingClient;return _0x8d53ba[_0x1bd5('0x2c')](_[_0x1bd5('0x1c')](_0x4670b5)+_0x1bd5('0x26'),_0x33f82a)[_0x1bd5('0x2b')](function(_0x1f4456){if(_0x1f4456[_0x1bd5('0xc')])throw new Error(util['format']('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x4670b5));var _0x26be8e=_0x1f4456[_0x1bd5('0x2d')];var _0x5542aa=[_0x1bd5('0x2e'),_0x1bd5('0x2f'),_0x1bd5('0x30'),_0x1bd5('0x31'),'paused'];if(_0x4670b5===_0x1bd5('0x16')&&_0x33f82a[_0x1bd5('0x17')][_0x1bd5('0x24')]===_0x1bd5('0x25')){_0x5542aa[_0x1bd5('0x32')](_0x1bd5('0x33'),_0x1bd5('0x34'),_0x1bd5('0x35'),'dialActive',_0x1bd5('0x36'),_0x1bd5('0x37'),_0x1bd5('0x38'),_0x1bd5('0x39'),_0x1bd5('0x3a'),_0x1bd5('0x3b'),_0x1bd5('0x3c'),'erlangBusyFactor',_0x1bd5('0x3d'),_0x1bd5('0x3e'),_0x1bd5('0x3f'),_0x1bd5('0x40'),_0x1bd5('0x41'),_0x1bd5('0x42'),_0x1bd5('0x43'),'predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime',_0x1bd5('0x44'));}var _0x2f8897=_0x4e72b2[_0x1bd5('0x45')]['map'](function(_0x4595a0){var _0x5af974=_0x4595a0[_0x1bd5('0x46')]({'plain':!![]});_0x5af974[_0x1bd5('0x47')]=0x0;_0x5af974[_0x1bd5('0x48')]=0x0;_0x5af974[_0x1bd5('0x2e')]=0x0;_0x5af974[_0x1bd5('0x2f')]=0x0;_0x5af974[_0x1bd5('0x47')]=0x0;_0x5af974[_0x1bd5('0x30')]=0x0;if(_0x4670b5===_0x1bd5('0x16')){_0x5af974['talking']=0x0;if(_0x33f82a[_0x1bd5('0x17')][_0x1bd5('0x24')]==='outbound'){_0x5af974[_0x1bd5('0x33')]=0x0;_0x5af974[_0x1bd5('0x34')]=0x0;}}_0x5af974[_0x1bd5('0x49')]=[];var _0x5c3b08=_[_0x1bd5('0x4a')](_0x26be8e[_0x1bd5('0x45')],['id',_0x5af974['id']]);if(_0x5c3b08)_[_0x1bd5('0x4b')](_0x5af974,_[_0x1bd5('0x4c')](_0x5c3b08,_0x5542aa));if(_0x4670b5==='voice'){return _0x4595a0[_0x1bd5('0x4d')]({'attributes':['id',_0x1bd5('0xe'),_0x1bd5('0x4e')],'joinTableAttributes':[],'raw':!![]})[_0x1bd5('0x2b')](function(_0x4de69a){return _0x4595a0['getMembers']({'raw':!![]})[_0x1bd5('0x2b')](function(_0x35afc7){for(var _0x453544=0x0;_0x453544<_0x4de69a['length'];_0x453544++){var _0x2a28c6=_[_0x1bd5('0x4a')](_0x35afc7,['UserId',_0x4de69a[_0x453544]['id']]);var _0x1eacac={'id':_0x4de69a[_0x453544]['id'],'name':_0x4de69a[_0x453544]['name'],'online':Boolean(_0x4de69a[_0x453544][_0x1bd5('0x4e')]),'paused':_0x2a28c6?Boolean(_0x2a28c6[_0x1bd5('0x47')]):![]};if(_0x1eacac['online'])_0x5af974[_0x1bd5('0x48')]++;if(_0x1eacac[_0x1bd5('0x47')])_0x5af974[_0x1bd5('0x47')]++;_0x5af974[_0x1bd5('0x49')][_0x1bd5('0x32')](_0x1eacac);}return _0x5af974;});});}else{var _0x25b35a=_0x1bd5('0x4f')+_[_0x1bd5('0x1c')](_0x4670b5)+_0x1bd5('0x1d');var _0x3e31d3=_0x4670b5+_0x1bd5('0x50');return db[_0x25b35a][_0x1bd5('0x51')]({'where':{[_['startCase'](_0x4670b5)+_0x1bd5('0x52')]:_0x4595a0['id']},'raw':!![]})[_0x1bd5('0x2b')](function(_0x335125){return db['User'][_0x1bd5('0x51')]({'attributes':['id',_0x1bd5('0xe'),'online',_0x3e31d3],'where':{'id':_[_0x1bd5('0x1e')](_0x335125,'UserId'),'role':_0x1bd5('0x53')},'raw':!![]});})['then'](function(_0x35a876){for(var _0xdd6c1a=0x0;_0xdd6c1a<_0x35a876['length'];_0xdd6c1a++){var _0xea034c={'id':_0x35a876[_0xdd6c1a]['id'],'name':_0x35a876[_0xdd6c1a]['name'],'online':Boolean(_0x35a876[_0xdd6c1a][_0x1bd5('0x4e')]),'paused':Boolean(_0x35a876[_0xdd6c1a][_0x3e31d3])};if(_0xea034c[_0x1bd5('0x4e')])_0x5af974[_0x1bd5('0x48')]++;if(_0xea034c[_0x1bd5('0x47')])_0x5af974[_0x1bd5('0x47')]++;_0x5af974[_0x1bd5('0x49')][_0x1bd5('0x32')](_0xea034c);}return _0x5af974;});}});return Promise[_0x1bd5('0x54')](_0x2f8897);});})['then'](function(_0x13985e){_0x13cf34[_0x1bd5('0x45')]=_0x13985e;return _0x13cf34;})[_0x1bd5('0x2b')](respondWithFilteredResult(_0x39c44b,_0x3afc4a))[_0x1bd5('0x55')](handleError(_0x39c44b,null));}; \ No newline at end of file +var _0x33af=['count','status','set','Content-Range','json','error','name','send','getQueues','mail','sms','fax','whatsapp','resolve','then','query','channel','toLowerCase','Invalid\x20channel','startCase','Queue','map','rawAttributes','fieldName','type','getOptions','role','user','userProfileId','UserProfile','getResources','findAndCountAll','voice','request','Queues','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','available','waiting','talking','paused','outbound','push','pTalking','originated','message','Trunk','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','loggedInDb','loggedIn','agents','rows','merge','getAgents','length','UserId','online','User','findAll','QueueId','agent','all','catch','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','offset','undefined','limit'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x33af,0xec));var _0xf33a=function(_0x320b9e,_0x1f892f){_0x320b9e=_0x320b9e-0x0;var _0x5e4416=_0x33af[_0x320b9e];return _0x5e4416;};'use strict';var util=require('util');var _=require(_0xf33a('0x0'));var jayson=require('jayson/promise');var qs=require(_0xf33a('0x1'));var logger=require(_0xf33a('0x2'))(_0xf33a('0x3'));var db=require(_0xf33a('0x4'))['db'];var client=jayson[_0xf33a('0x5')][_0xf33a('0x6')]({'port':0x232a});var routingClient=jayson['client'][_0xf33a('0x6')]({'port':0x232c});function respondWithFilteredResult(_0x44cfa5,_0x583e54){return function(_0xc0dd13){if(_0xc0dd13){var _0x384b14=typeof _0x583e54[_0xf33a('0x7')]===_0xf33a('0x8')&&typeof _0x583e54[_0xf33a('0x9')]===_0xf33a('0x8');var _0x52517f=_0xc0dd13[_0xf33a('0xa')];var _0x14eb0e=_0x384b14?0x0:_0x583e54[_0xf33a('0x7')];var _0x457b3b=_0x384b14?_0xc0dd13[_0xf33a('0xa')]:_0x583e54[_0xf33a('0x7')]+_0x583e54['limit'];var _0x4ea282;if(_0x457b3b>=_0x52517f){_0x457b3b=_0x52517f;_0x4ea282=0xc8;}else{_0x4ea282=0xce;}_0x44cfa5[_0xf33a('0xb')](_0x4ea282);return _0x44cfa5[_0xf33a('0xc')](_0xf33a('0xd'),_0x14eb0e+'-'+_0x457b3b+'/'+_0x52517f)[_0xf33a('0xe')](_0xc0dd13);}return null;};}function handleError(_0x338d1b,_0x5959c9){_0x5959c9=_0x5959c9||0x1f4;return function(_0x9f87bc){logger[_0xf33a('0xf')](_0x9f87bc['stack']);if(_0x9f87bc['name']){delete _0x9f87bc[_0xf33a('0x10')];}_0x338d1b[_0xf33a('0xb')](_0x5959c9)[_0xf33a('0x11')](_0x9f87bc);};}exports[_0xf33a('0x12')]=function(_0x1e9be2,_0xc01217){var _0x45e311=[_0xf33a('0x13'),'chat',_0xf33a('0x14'),'openchannel',_0xf33a('0x15'),_0xf33a('0x16'),'voice'];var _0x37e76c={'count':0x0,'rows':[]},_0x25c931={},_0x524109;Promise[_0xf33a('0x17')]()[_0xf33a('0x18')](function(){if(_0x1e9be2[_0xf33a('0x19')][_0xf33a('0x1a')]){if(!_['includes'](_0x45e311,_0x1e9be2[_0xf33a('0x19')][_0xf33a('0x1a')][_0xf33a('0x1b')]()))throw new Error(_0xf33a('0x1c'));_0x524109=_0x1e9be2[_0xf33a('0x19')][_0xf33a('0x1a')][_0xf33a('0x1b')]();}var _0x288275=_[_0xf33a('0x1d')](_0x524109)+_0xf33a('0x1e');var _0x520dc4=_[_0xf33a('0x1f')](db[_0x288275][_0xf33a('0x20')],function(_0x1bf9bc){return{'name':_0x1bf9bc[_0xf33a('0x21')],'type':_0x1bf9bc[_0xf33a('0x22')]['key']};});_0x25c931=qs[_0xf33a('0x23')](_0x520dc4,_0x1e9be2);if(_0x1e9be2['user'][_0xf33a('0x24')]===_0xf33a('0x25')){var _0x394468={'params':{'id':_0x1e9be2[_0xf33a('0x25')][_0xf33a('0x26')]},'query':{'section':_0x524109==='voice'&&_0x1e9be2[_0xf33a('0x19')][_0xf33a('0x22')]==='outbound'?'QueueCampaigns':_[_0xf33a('0x1d')](_0x524109)+'Queues','type':_0x1e9be2['query'][_0xf33a('0x22')],'nolimit':!![],'sort':'name','filter':_0x1e9be2[_0xf33a('0x19')]['filter']}};return db[_0xf33a('0x27')][_0xf33a('0x28')](_0x394468);}return db[_0x288275][_0xf33a('0x29')](_0x25c931);})[_0xf33a('0x18')](function(_0x4552c9){_0x37e76c[_0xf33a('0xa')]=_0x4552c9[_0xf33a('0xa')];var _0x1246ff=_0x524109===_0xf33a('0x2a')?client:routingClient;return _0x1246ff[_0xf33a('0x2b')](_[_0xf33a('0x1d')](_0x524109)+_0xf33a('0x2c'),_0x1e9be2)[_0xf33a('0x18')](function(_0x3f714e){if(_0x3f714e[_0xf33a('0xf')])throw new Error(util['format'](_0xf33a('0x2d'),_0x524109));var _0x293cb5=_0x3f714e[_0xf33a('0x2e')];var _0xbdc10e=['loggedIn',_0xf33a('0x2f'),_0xf33a('0x30'),_0xf33a('0x31'),_0xf33a('0x32')];if(_0x524109===_0xf33a('0x2a')&&_0x1e9be2[_0xf33a('0x19')]['type']===_0xf33a('0x33')){_0xbdc10e[_0xf33a('0x34')](_0xf33a('0x35'),_0xf33a('0x36'),_0xf33a('0x37'),'dialActive','dialMethod',_0xf33a('0x38'),'startPredictive','startProgressive','erlangCalls',_0xf33a('0x39'),_0xf33a('0x3a'),'erlangBusyFactor',_0xf33a('0x3b'),'dialPredictiveIntervalMaxThreshold',_0xf33a('0x3c'),_0xf33a('0x3d'),_0xf33a('0x3e'),_0xf33a('0x3f'),_0xf33a('0x40'),_0xf33a('0x41'),'predictiveIntervalAvgHoldtime',_0xf33a('0x42'));}var _0x29a39f=_0x4552c9['rows'][_0xf33a('0x1f')](function(_0x3793b4){var _0x3e0a98=_0x3793b4['get']({'plain':!![]});_0x3e0a98[_0xf33a('0x32')]=0x0;_0x3e0a98[_0xf33a('0x43')]=0x0;_0x3e0a98[_0xf33a('0x44')]=0x0;_0x3e0a98[_0xf33a('0x2f')]=0x0;_0x3e0a98[_0xf33a('0x32')]=0x0;_0x3e0a98[_0xf33a('0x30')]=0x0;if(_0x524109===_0xf33a('0x2a')){_0x3e0a98[_0xf33a('0x31')]=0x0;if(_0x1e9be2[_0xf33a('0x19')]['type']===_0xf33a('0x33')){_0x3e0a98[_0xf33a('0x35')]=0x0;_0x3e0a98['originated']=0x0;}}_0x3e0a98[_0xf33a('0x45')]=[];var _0x4c6906=_['find'](_0x293cb5[_0xf33a('0x46')],['id',_0x3e0a98['id']]);if(_0x4c6906)_[_0xf33a('0x47')](_0x3e0a98,_['pick'](_0x4c6906,_0xbdc10e));if(_0x524109===_0xf33a('0x2a')){return _0x3793b4[_0xf33a('0x48')]({'attributes':['id',_0xf33a('0x10'),'online'],'joinTableAttributes':[],'raw':!![]})[_0xf33a('0x18')](function(_0x21b8da){return _0x3793b4['getMembers']({'raw':!![]})[_0xf33a('0x18')](function(_0x20e57b){for(var _0x36b9c9=0x0;_0x36b9c9<_0x21b8da[_0xf33a('0x49')];_0x36b9c9++){var _0x40954c=_['find'](_0x20e57b,[_0xf33a('0x4a'),_0x21b8da[_0x36b9c9]['id']]);var _0x1722e5={'id':_0x21b8da[_0x36b9c9]['id'],'name':_0x21b8da[_0x36b9c9][_0xf33a('0x10')],'online':Boolean(_0x21b8da[_0x36b9c9][_0xf33a('0x4b')]),'paused':_0x40954c?Boolean(_0x40954c[_0xf33a('0x32')]):![]};if(_0x1722e5['online'])_0x3e0a98[_0xf33a('0x43')]++;if(_0x1722e5[_0xf33a('0x32')])_0x3e0a98[_0xf33a('0x32')]++;_0x3e0a98['agents'][_0xf33a('0x34')](_0x1722e5);}return _0x3e0a98;});});}else{var _0x43889e=_0xf33a('0x4c')+_[_0xf33a('0x1d')](_0x524109)+_0xf33a('0x1e');var _0x6380fa=_0x524109+'Pause';return db[_0x43889e][_0xf33a('0x4d')]({'where':{[_[_0xf33a('0x1d')](_0x524109)+_0xf33a('0x4e')]:_0x3793b4['id']},'raw':!![]})[_0xf33a('0x18')](function(_0x229533){return db['User'][_0xf33a('0x4d')]({'attributes':['id',_0xf33a('0x10'),_0xf33a('0x4b'),_0x6380fa],'where':{'id':_['map'](_0x229533,_0xf33a('0x4a')),'role':_0xf33a('0x4f')},'raw':!![]});})['then'](function(_0x4c0f24){for(var _0x3cb451=0x0;_0x3cb451<_0x4c0f24['length'];_0x3cb451++){var _0x36b8f6={'id':_0x4c0f24[_0x3cb451]['id'],'name':_0x4c0f24[_0x3cb451][_0xf33a('0x10')],'online':Boolean(_0x4c0f24[_0x3cb451][_0xf33a('0x4b')]),'paused':Boolean(_0x4c0f24[_0x3cb451][_0x6380fa])};if(_0x36b8f6[_0xf33a('0x4b')])_0x3e0a98[_0xf33a('0x43')]++;if(_0x36b8f6[_0xf33a('0x32')])_0x3e0a98[_0xf33a('0x32')]++;_0x3e0a98[_0xf33a('0x45')][_0xf33a('0x34')](_0x36b8f6);}return _0x3e0a98;});}});return Promise[_0xf33a('0x50')](_0x29a39f);});})[_0xf33a('0x18')](function(_0x4107b1){_0x37e76c[_0xf33a('0x46')]=_0x4107b1;return _0x37e76c;})[_0xf33a('0x18')](respondWithFilteredResult(_0xc01217,_0x25c931))[_0xf33a('0x51')](handleError(_0xc01217,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index b84a227..9afe45e 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x44e75a,_0x1a0a06){var _0x261782=function(_0x3686b5){while(--_0x3686b5){_0x44e75a['push'](_0x44e75a['shift']());}};_0x261782(++_0x1a0a06);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x32bdac,_0x59db24){var _0x33b460=function(_0x5235df){while(--_0x5235df){_0x32bdac['push'](_0x32bdac['shift']());}};_0x33b460(++_0x59db24);}(_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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 04e35d2..2c21b87 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 _0xa786=['INTEGER','DATE','STRING','sequelize','exports'];(function(_0x144337,_0x31044f){var _0x27c2d4=function(_0x4ec4d8){while(--_0x4ec4d8){_0x144337['push'](_0x144337['shift']());}};_0x27c2d4(++_0x31044f);}(_0xa786,0x71));var _0x6a78=function(_0x72b3b7,_0x5a5949){_0x72b3b7=_0x72b3b7-0x0;var _0x431d19=_0xa786[_0x72b3b7];return _0x431d19;};'use strict';var Sequelize=require(_0x6a78('0x0'));module[_0x6a78('0x1')]={'state':{'type':Sequelize[_0x6a78('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x6a78('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x6a78('0x3')]},'ringtime':{'type':Sequelize[_0x6a78('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x6a78('0x4')]},'campaigntype':{'type':Sequelize[_0x6a78('0x4')]},'membername':{'type':Sequelize[_0x6a78('0x4')]}}; \ No newline at end of file +var _0xe714=['STRING','DATE','sequelize','INTEGER'];(function(_0x3fa26d,_0x3aa9fd){var _0x3de17d=function(_0x36f4e0){while(--_0x36f4e0){_0x3fa26d['push'](_0x3fa26d['shift']());}};_0x3de17d(++_0x3aa9fd);}(_0xe714,0xe2));var _0x4e71=function(_0x99eeb6,_0x403066){_0x99eeb6=_0x99eeb6-0x0;var _0x1a0fe8=_0xe714[_0x99eeb6];return _0x1a0fe8;};'use strict';var Sequelize=require(_0x4e71('0x0'));module['exports']={'state':{'type':Sequelize[_0x4e71('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x4e71('0x2')]},'scheduledat':{'type':Sequelize[_0x4e71('0x3')]},'uniqueid':{'type':Sequelize[_0x4e71('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x4e71('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x4e71('0x2')]},'campaigntype':{'type':Sequelize[_0x4e71('0x2')]},'membername':{'type':Sequelize[_0x4e71('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 4d405cf..69df60f 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 _0xe4eb=['rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x16da03,_0x2b276e){var _0x598215=function(_0x5366c0){while(--_0x5366c0){_0x16da03['push'](_0x16da03['shift']());}};_0x598215(++_0x2b276e);}(_0xe4eb,0xaf));var _0xbe4e=function(_0x3377ef,_0xcd2120){_0x3377ef=_0x3377ef-0x0;var _0x3d2638=_0xe4eb[_0x3377ef];return _0x3d2638;};'use strict';var _=require(_0xbe4e('0x0'));var util=require(_0xbe4e('0x1'));var logger=require(_0xbe4e('0x2'))(_0xbe4e('0x3'));var moment=require(_0xbe4e('0x4'));var BPromise=require(_0xbe4e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe4e('0x6'));var rimraf=require(_0xbe4e('0x7'));var config=require(_0xbe4e('0x8'));var attributes=require(_0xbe4e('0x9'));module[_0xbe4e('0xa')]=function(_0x4659fb,_0x4e25c9){return _0x4659fb[_0xbe4e('0xb')](_0xbe4e('0xc'),attributes,{'tableName':_0xbe4e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb1ae=['bluebird','request-promise','path','rimraf','../../config/environment','define','ReportAgentPreview','report_agent_preview','lodash','../../config/logger','api'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb1ae,0x1e1));var _0xeb1a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb1ae[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xeb1a('0x0'));var util=require('util');var logger=require(_0xeb1a('0x1'))(_0xeb1a('0x2'));var moment=require('moment');var BPromise=require(_0xeb1a('0x3'));var rp=require(_0xeb1a('0x4'));var fs=require('fs');var path=require(_0xeb1a('0x5'));var rimraf=require(_0xeb1a('0x6'));var config=require(_0xeb1a('0x7'));var attributes=require('./reportAgentPreview.attributes');module['exports']=function(_0x1367fa,_0x4c15c8){return _0x1367fa[_0xeb1a('0x8')](_0xeb1a('0x9'),attributes,{'tableName':_0xeb1a('0xa'),'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 a3d25f2..b961cb7 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 _0xd109=['http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','message','catch','CreateReportAgentPreview','create','body','options','raw','stringify','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client'];(function(_0x576f07,_0x200fb4){var _0x3c85e3=function(_0x5e8db7){while(--_0x5e8db7){_0x576f07['push'](_0x576f07['shift']());}};_0x3c85e3(++_0x200fb4);}(_0xd109,0x10b));var _0x9d10=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xd109[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0x9d10('0x0'));var moment=require(_0x9d10('0x1'));var BPromise=require('bluebird');var rs=require(_0x9d10('0x2'));var fs=require('fs');var Redis=require(_0x9d10('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9d10('0x4'))(_0x9d10('0x5'));var config=require(_0x9d10('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9d10('0x7')][_0x9d10('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5505d7,_0x13927e,_0x34b5a2){return new BPromise(function(_0x1af00e,_0x3a68d2){return client[_0x9d10('0x9')](_0x5505d7,_0x34b5a2)[_0x9d10('0xa')](function(_0x5ab23c){logger[_0x9d10('0xb')](_0x9d10('0xc'),_0x13927e,_0x9d10('0xd'));logger[_0x9d10('0xe')](_0x9d10('0xf'),_0x13927e,_0x9d10('0xd'),JSON['stringify'](_0x5ab23c));if(_0x5ab23c[_0x9d10('0x10')]){if(_0x5ab23c[_0x9d10('0x10')]['code']===0x1f4){logger[_0x9d10('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x13927e,_0x5ab23c[_0x9d10('0x10')][_0x9d10('0x11')]);return _0x3a68d2(_0x5ab23c['error']['message']);}logger[_0x9d10('0x10')](_0x9d10('0xc'),_0x13927e,_0x5ab23c[_0x9d10('0x10')][_0x9d10('0x11')]);return _0x1af00e(_0x5ab23c['error'][_0x9d10('0x11')]);}else{logger[_0x9d10('0xb')]('ReportAgentPreview,\x20%s,\x20%s',_0x13927e,_0x9d10('0xd'));_0x1af00e(_0x5ab23c['result'][_0x9d10('0x11')]);}})[_0x9d10('0x12')](function(_0x477662){logger[_0x9d10('0x10')](_0x9d10('0xc'),_0x13927e,_0x477662);_0x3a68d2(_0x477662);});});}exports[_0x9d10('0x13')]=function(_0x440150){var _0x342f25=this;return new Promise(function(_0x365a0b,_0x189e66){return db['ReportAgentPreview'][_0x9d10('0x14')](_0x440150[_0x9d10('0x15')],{'raw':_0x440150[_0x9d10('0x16')]?_0x440150[_0x9d10('0x16')][_0x9d10('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x3c40af){logger[_0x9d10('0xb')](_0x9d10('0x13'),_0x440150);logger[_0x9d10('0xe')](_0x9d10('0x13'),_0x440150,JSON[_0x9d10('0x18')](_0x3c40af));_0x365a0b(_0x3c40af);})['catch'](function(_0xdd8c43){logger[_0x9d10('0x10')](_0x9d10('0x13'),_0xdd8c43[_0x9d10('0x11')],_0x440150);_0x189e66(_0x342f25[_0x9d10('0x10')](0x1f4,_0xdd8c43[_0x9d10('0x11')]));});});}; \ No newline at end of file +var _0x65a4=['moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','error','message','CreateReportAgentPreview','ReportAgentPreview','options','raw','stringify','catch','lodash','util'];(function(_0x4923eb,_0x181906){var _0x1a37a6=function(_0x136433){while(--_0x136433){_0x4923eb['push'](_0x4923eb['shift']());}};_0x1a37a6(++_0x181906);}(_0x65a4,0x166));var _0x465a=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x65a4[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x465a('0x0'));var util=require(_0x465a('0x1'));var moment=require(_0x465a('0x2'));var BPromise=require(_0x465a('0x3'));var rs=require(_0x465a('0x4'));var fs=require('fs');var Redis=require(_0x465a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x465a('0x6'));var logger=require('../../config/logger')(_0x465a('0x7'));var config=require('../../config/environment');var jayson=require(_0x465a('0x8'));var client=jayson[_0x465a('0x9')][_0x465a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x470952,_0x11682,_0x16480c){return new BPromise(function(_0x1247f0,_0x449e00){return client[_0x465a('0xb')](_0x470952,_0x16480c)['then'](function(_0x42c1f5){logger[_0x465a('0xc')](_0x465a('0xd'),_0x11682,_0x465a('0xe'));logger[_0x465a('0xf')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x11682,_0x465a('0xe'),JSON['stringify'](_0x42c1f5));if(_0x42c1f5['error']){if(_0x42c1f5[_0x465a('0x10')]['code']===0x1f4){logger[_0x465a('0x10')](_0x465a('0xd'),_0x11682,_0x42c1f5['error']['message']);return _0x449e00(_0x42c1f5[_0x465a('0x10')]['message']);}logger[_0x465a('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x11682,_0x42c1f5[_0x465a('0x10')][_0x465a('0x11')]);return _0x1247f0(_0x42c1f5[_0x465a('0x10')][_0x465a('0x11')]);}else{logger[_0x465a('0xc')]('ReportAgentPreview,\x20%s,\x20%s',_0x11682,_0x465a('0xe'));_0x1247f0(_0x42c1f5['result'][_0x465a('0x11')]);}})['catch'](function(_0x2f4e31){logger[_0x465a('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x11682,_0x2f4e31);_0x449e00(_0x2f4e31);});});}exports[_0x465a('0x12')]=function(_0x4fa800){var _0x190a4a=this;return new Promise(function(_0x2d421b,_0x1d536f){return db[_0x465a('0x13')]['create'](_0x4fa800['body'],{'raw':_0x4fa800[_0x465a('0x14')]?_0x4fa800[_0x465a('0x14')][_0x465a('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x16023f){logger[_0x465a('0xc')](_0x465a('0x12'),_0x4fa800);logger['debug'](_0x465a('0x12'),_0x4fa800,JSON[_0x465a('0x16')](_0x16023f));_0x2d421b(_0x16023f);})[_0x465a('0x17')](function(_0x406321){logger[_0x465a('0x10')]('CreateReportAgentPreview',_0x406321[_0x465a('0x11')],_0x4fa800);_0x1d536f(_0x190a4a['error'](0x1f4,_0x406321[_0x465a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 98ad3c8..0560763 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 _0x182e=['outboundChannels','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','whatsappQueues','faxQueues','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','put','updateVoiceQueue','/outbound','outbound','/outbound/channels'];(function(_0x441dd4,_0x582db9){var _0x54ea8b=function(_0x308f42){while(--_0x308f42){_0x441dd4['push'](_0x441dd4['shift']());}};_0x54ea8b(++_0x582db9);}(_0x182e,0x116));var _0xe182=function(_0x1bc0ae,_0x439dfe){_0x1bc0ae=_0x1bc0ae-0x0;var _0x501104=_0x182e[_0x1bc0ae];return _0x501104;};'use strict';var multer=require(_0xe182('0x0'));var util=require(_0xe182('0x1'));var path=require(_0xe182('0x2'));var express=require(_0xe182('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./rpc.controller');router[_0xe182('0x4')]('/voice/channels',auth[_0xe182('0x5')](),controller[_0xe182('0x6')]);router[_0xe182('0x4')](_0xe182('0x7'),auth[_0xe182('0x5')](),controller[_0xe182('0x8')]);router[_0xe182('0x4')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0xe182('0x5')](),controller[_0xe182('0x9')]);router[_0xe182('0x4')](_0xe182('0xa'),auth['isAuthenticated'](),controller[_0xe182('0xb')]);router[_0xe182('0x4')]('/chat/queues',auth['isAuthenticated'](),controller[_0xe182('0xc')]);router[_0xe182('0x4')](_0xe182('0xd'),auth[_0xe182('0x5')](),controller[_0xe182('0xe')]);router[_0xe182('0x4')](_0xe182('0xf'),auth['isAuthenticated'](),controller[_0xe182('0x10')]);router['get'](_0xe182('0x11'),auth[_0xe182('0x5')](),controller[_0xe182('0x12')]);router['get']('/sms/queues',auth[_0xe182('0x5')](),controller['smsQueues']);router[_0xe182('0x4')]('/whatsapp/queues',auth[_0xe182('0x5')](),controller[_0xe182('0x13')]);router['get']('/fax/queues',auth[_0xe182('0x5')](),controller[_0xe182('0x14')]);router[_0xe182('0x4')]('/voice/queues/preview/:id',auth[_0xe182('0x5')](),controller['voiceQueuesPreview']);router[_0xe182('0x4')]('/voice/queues/channels',auth[_0xe182('0x5')](),controller[_0xe182('0x15')]);router[_0xe182('0x4')](_0xe182('0x16'),auth[_0xe182('0x5')](),controller[_0xe182('0x17')]);router[_0xe182('0x4')](_0xe182('0x18'),auth['isAuthenticated'](),controller[_0xe182('0x19')]);router['get'](_0xe182('0x1a'),auth[_0xe182('0x5')](),controller[_0xe182('0x1b')]);router[_0xe182('0x4')](_0xe182('0x1c'),auth[_0xe182('0x5')](),controller['showVoiceQueues']);router[_0xe182('0x1d')]('/voice/queues/:id',auth['isAuthenticated'](),controller[_0xe182('0x1e')]);router[_0xe182('0x4')](_0xe182('0x1f'),auth[_0xe182('0x5')](),controller[_0xe182('0x20')]);router[_0xe182('0x4')](_0xe182('0x21'),auth['isAuthenticated'](),controller[_0xe182('0x22')]);router['get']('/agents',auth['isAuthenticated'](),controller[_0xe182('0x23')]);router['put'](_0xe182('0x24'),auth['isAuthenticated'](),controller[_0xe182('0x25')]);router[_0xe182('0x4')](_0xe182('0x26'),auth['isAuthenticated'](),controller[_0xe182('0x27')]);router['get']('/trunks',auth[_0xe182('0x5')](),controller['trunks']);router[_0xe182('0x4')]('/campaigns',auth['isAuthenticated'](),controller['campaigns']);router[_0xe182('0x4')](_0xe182('0x28'),auth[_0xe182('0x5')](),controller[_0xe182('0x29')]);router[_0xe182('0x4')]('/chat/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xe182('0x2a')]);router[_0xe182('0x4')](_0xe182('0x2b'),auth[_0xe182('0x5')](),controller[_0xe182('0x2c')]);router[_0xe182('0x4')](_0xe182('0x2d'),auth[_0xe182('0x5')](),controller[_0xe182('0x2e')]);router[_0xe182('0x4')]('/openchannel/queues/:id/waitinginteractions',auth[_0xe182('0x5')](),controller[_0xe182('0x2f')]);router['get']('/sms/queues/waitinginteractions',auth[_0xe182('0x5')](),controller[_0xe182('0x30')]);router[_0xe182('0x4')](_0xe182('0x31'),auth[_0xe182('0x5')](),controller[_0xe182('0x32')]);router[_0xe182('0x4')](_0xe182('0x33'),auth[_0xe182('0x5')](),controller[_0xe182('0x34')]);router[_0xe182('0x35')](_0xe182('0x36'),auth[_0xe182('0x5')](),controller[_0xe182('0x37')](_0xe182('0x38')));router[_0xe182('0x4')](_0xe182('0x39'),auth[_0xe182('0x5')](),controller[_0xe182('0x3a')]);router[_0xe182('0x35')](_0xe182('0x3b'),auth['isAuthenticated'](),controller[_0xe182('0x37')]('chat'));router[_0xe182('0x4')]('/chat/queues/:id',auth[_0xe182('0x5')](),controller[_0xe182('0x3c')]);router[_0xe182('0x35')](_0xe182('0x3d'),auth[_0xe182('0x5')](),controller['queueNotify'](_0xe182('0x3e')));router['get'](_0xe182('0x3f'),auth[_0xe182('0x5')](),controller[_0xe182('0x40')]);router[_0xe182('0x35')](_0xe182('0x41'),auth['isAuthenticated'](),controller[_0xe182('0x37')](_0xe182('0x42')));router[_0xe182('0x4')](_0xe182('0x43'),auth[_0xe182('0x5')](),controller[_0xe182('0x44')]);router['post'](_0xe182('0x45'),auth[_0xe182('0x5')](),controller[_0xe182('0x37')]('sms'));router[_0xe182('0x35')](_0xe182('0x46'),auth[_0xe182('0x5')](),controller[_0xe182('0x37')](_0xe182('0x47')));router['get']('/sms/queues/:id',auth[_0xe182('0x5')](),controller[_0xe182('0x48')]);router[_0xe182('0x4')](_0xe182('0x49'),auth[_0xe182('0x5')](),controller[_0xe182('0x4a')]);router[_0xe182('0x35')](_0xe182('0x4b'),auth['isAuthenticated'](),controller[_0xe182('0x4c')]);module[_0xe182('0x4d')]=router; \ No newline at end of file +var _0xaa5a=['trunks','/campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','/mail/queues/:id','/chat/queues/:id/notify','/fax/queues/:id/notify','fax','/fax/queues/:id','/openchannel/queues/:id/notify','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','agentNotify','multer','util','express','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','outbound','/outbound/channels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','/trunks'];(function(_0x31b9cf,_0x1a809b){var _0x357b8a=function(_0x50a273){while(--_0x50a273){_0x31b9cf['push'](_0x31b9cf['shift']());}};_0x357b8a(++_0x1a809b);}(_0xaa5a,0x1d3));var _0xaaa5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa5a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xaaa5('0x0'));var util=require(_0xaaa5('0x1'));var path=require('path');var express=require(_0xaaa5('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xaaa5('0x3'));router[_0xaaa5('0x4')](_0xaaa5('0x5'),auth[_0xaaa5('0x6')](),controller[_0xaaa5('0x7')]);router[_0xaaa5('0x4')](_0xaaa5('0x8'),auth[_0xaaa5('0x6')](),controller[_0xaaa5('0x9')]);router[_0xaaa5('0x4')](_0xaaa5('0xa'),auth[_0xaaa5('0x6')](),controller[_0xaaa5('0xb')]);router[_0xaaa5('0x4')](_0xaaa5('0xc'),auth[_0xaaa5('0x6')](),controller[_0xaaa5('0xd')]);router[_0xaaa5('0x4')](_0xaaa5('0xe'),auth[_0xaaa5('0x6')](),controller[_0xaaa5('0xf')]);router[_0xaaa5('0x4')](_0xaaa5('0x10'),auth[_0xaaa5('0x6')](),controller[_0xaaa5('0x11')]);router[_0xaaa5('0x4')](_0xaaa5('0x12'),auth[_0xaaa5('0x6')](),controller['mailAccounts']);router[_0xaaa5('0x4')]('/openchannel/queues',auth['isAuthenticated'](),controller['openchannelQueues']);router[_0xaaa5('0x4')](_0xaaa5('0x13'),auth[_0xaaa5('0x6')](),controller[_0xaaa5('0x14')]);router[_0xaaa5('0x4')](_0xaaa5('0x15'),auth[_0xaaa5('0x6')](),controller['whatsappQueues']);router[_0xaaa5('0x4')](_0xaaa5('0x16'),auth['isAuthenticated'](),controller[_0xaaa5('0x17')]);router['get'](_0xaaa5('0x18'),auth[_0xaaa5('0x6')](),controller[_0xaaa5('0x19')]);router[_0xaaa5('0x4')](_0xaaa5('0x1a'),auth[_0xaaa5('0x6')](),controller['voiceQueuesChannels']);router[_0xaaa5('0x4')](_0xaaa5('0x1b'),auth[_0xaaa5('0x6')](),controller[_0xaaa5('0x1c')]);router[_0xaaa5('0x4')]('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller[_0xaaa5('0x1d')]);router[_0xaaa5('0x4')](_0xaaa5('0x1e'),auth[_0xaaa5('0x6')](),controller[_0xaaa5('0x1f')]);router['get'](_0xaaa5('0x20'),auth['isAuthenticated'](),controller[_0xaaa5('0x21')]);router[_0xaaa5('0x22')](_0xaaa5('0x20'),auth['isAuthenticated'](),controller[_0xaaa5('0x23')]);router[_0xaaa5('0x4')]('/outbound',auth[_0xaaa5('0x6')](),controller[_0xaaa5('0x24')]);router[_0xaaa5('0x4')](_0xaaa5('0x25'),auth[_0xaaa5('0x6')](),controller['outboundChannels']);router[_0xaaa5('0x4')](_0xaaa5('0x26'),auth[_0xaaa5('0x6')](),controller[_0xaaa5('0x27')]);router[_0xaaa5('0x22')](_0xaaa5('0x28'),auth[_0xaaa5('0x6')](),controller[_0xaaa5('0x29')]);router[_0xaaa5('0x4')](_0xaaa5('0x2a'),auth[_0xaaa5('0x6')](),controller['telephones']);router[_0xaaa5('0x4')](_0xaaa5('0x2b'),auth['isAuthenticated'](),controller[_0xaaa5('0x2c')]);router[_0xaaa5('0x4')](_0xaaa5('0x2d'),auth[_0xaaa5('0x6')](),controller['campaigns']);router[_0xaaa5('0x4')](_0xaaa5('0x2e'),auth['isAuthenticated'](),controller['faxAccounts']);router[_0xaaa5('0x4')](_0xaaa5('0x2f'),auth[_0xaaa5('0x6')](),controller[_0xaaa5('0x30')]);router[_0xaaa5('0x4')]('/mail/queues/waitinginteractions',auth[_0xaaa5('0x6')](),controller[_0xaaa5('0x31')]);router[_0xaaa5('0x4')](_0xaaa5('0x32'),auth['isAuthenticated'](),controller[_0xaaa5('0x33')]);router[_0xaaa5('0x4')](_0xaaa5('0x34'),auth['isAuthenticated'](),controller['openchannelQueuesIdWaitingInteractions']);router[_0xaaa5('0x4')](_0xaaa5('0x35'),auth['isAuthenticated'](),controller[_0xaaa5('0x36')]);router[_0xaaa5('0x4')](_0xaaa5('0x37'),auth[_0xaaa5('0x6')](),controller['whatsappQueuesWaitingInteractions']);router[_0xaaa5('0x4')](_0xaaa5('0x38'),auth['isAuthenticated'](),controller[_0xaaa5('0x39')]);router[_0xaaa5('0x3a')]('/mail/queues/:id/notify',auth[_0xaaa5('0x6')](),controller[_0xaaa5('0x3b')]('mail'));router[_0xaaa5('0x4')](_0xaaa5('0x3c'),auth[_0xaaa5('0x6')](),controller['showMailQueues']);router[_0xaaa5('0x3a')](_0xaaa5('0x3d'),auth[_0xaaa5('0x6')](),controller[_0xaaa5('0x3b')]('chat'));router[_0xaaa5('0x4')]('/chat/queues/:id',auth[_0xaaa5('0x6')](),controller['showChatQueues']);router[_0xaaa5('0x3a')](_0xaaa5('0x3e'),auth[_0xaaa5('0x6')](),controller[_0xaaa5('0x3b')](_0xaaa5('0x3f')));router[_0xaaa5('0x4')](_0xaaa5('0x40'),auth[_0xaaa5('0x6')](),controller['showFaxQueues']);router[_0xaaa5('0x3a')](_0xaaa5('0x41'),auth['isAuthenticated'](),controller['queueNotify']('openchannel'));router[_0xaaa5('0x4')]('/openchannel/queues/:id',auth[_0xaaa5('0x6')](),controller['showOpenchannelQueues']);router[_0xaaa5('0x3a')](_0xaaa5('0x42'),auth[_0xaaa5('0x6')](),controller[_0xaaa5('0x3b')](_0xaaa5('0x43')));router[_0xaaa5('0x3a')](_0xaaa5('0x44'),auth[_0xaaa5('0x6')](),controller[_0xaaa5('0x3b')](_0xaaa5('0x45')));router[_0xaaa5('0x4')]('/sms/queues/:id',auth['isAuthenticated'](),controller[_0xaaa5('0x46')]);router[_0xaaa5('0x4')](_0xaaa5('0x47'),auth[_0xaaa5('0x6')](),controller['showWhatsappQueues']);router[_0xaaa5('0x3a')]('/agents/:id/notify',auth[_0xaaa5('0x6')](),controller[_0xaaa5('0x48')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 5d6f292..06c1d68 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 _0x0e85=['util','../../mysqldb','client','http','request','error','code','message','status','json','sendStatus','stack','send','isNil','find','rows','voiceChannels','VoiceChannels','then','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','catch','voiceQueues','VoiceQueues','query','showVoiceQueues','updateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','name','hasOwnProperty','MemberReport','findAll','format','length','updateAttributes','findOrCreate','INTERACTION','interface','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','capacity','Telephones','trunks','Trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','showMailQueues','MailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','queue_id','uniq','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','chat','Account','findOne','\x20Queue\x20not\x20found','Message','Interaction','update','queue','From','QueueId','TransferReport','Start','queueTransferTimeout','channel','Channel\x20field\x20is\x20mandatory','capitalize','Website','User','Agent\x20not\x20found','\x20Message\x20not\x20found','MessageId','InteractionId','create','*,*,*,*','bluebird','moment'];(function(_0x2e2a9c,_0xc9041){var _0x521c07=function(_0x1bd957){while(--_0x1bd957){_0x2e2a9c['push'](_0x2e2a9c['shift']());}};_0x521c07(++_0xc9041);}(_0x0e85,0x7c));var _0x50e8=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x0e85[_0x4b7895];return _0x264180;};'use strict';var BPromise=require(_0x50e8('0x0'));var moment=require(_0x50e8('0x1'));var _=require('lodash');var util=require(_0x50e8('0x2'));var db=require(_0x50e8('0x3'))['db'];var logger=require('../../config/logger')('api');var jayson=require('jayson/promise');var amiClient=jayson[_0x50e8('0x4')]['http']({'port':0x232a});var mailClient=jayson[_0x50e8('0x4')][_0x50e8('0x5')]({'port':0x232b});var routingClient=jayson[_0x50e8('0x4')][_0x50e8('0x5')]({'port':0x232c});function respondWithRpcPromise(_0x5e8b01,_0x3ce904,_0x108edc){return new BPromise(function(_0x42665e,_0x988da0){var _0x1fafb0=_0x108edc?_0x108edc:amiClient;return _0x1fafb0[_0x50e8('0x6')](_0x5e8b01,_0x3ce904)['then'](function(_0x11717c){if(_0x11717c[_0x50e8('0x7')]){if(_0x11717c[_0x50e8('0x7')][_0x50e8('0x8')]===0x1f4){return _0x988da0(_0x11717c[_0x50e8('0x7')][_0x50e8('0x9')]);}return _0x42665e(_0x11717c[_0x50e8('0x7')][_0x50e8('0x9')]);}else{_0x42665e(_0x11717c['result']);}})['catch'](function(_0xfc6bb9){_0x988da0(_0xfc6bb9);});});}function respondWithResult(_0x24d381,_0x508377){_0x508377=_0x508377||0xc8;return function(_0x49e02f){if(_0x49e02f){return _0x24d381[_0x50e8('0xa')](_0x508377)[_0x50e8('0xb')](_0x49e02f);}return _0x24d381[_0x50e8('0xc')](0x194);};}function handleError(_0x473aa7,_0x54efd3){_0x54efd3=_0x54efd3||0x1f4;return function(_0x18596f){logger[_0x50e8('0x7')](_0x18596f[_0x50e8('0xd')]);if(_0x18596f['name']){delete _0x18596f['name'];}_0x473aa7[_0x50e8('0xa')](_0x54efd3)[_0x50e8('0xe')](_0x18596f);};}function findById(_0x40c184){return function(_0x291fb7){if(!_[_0x50e8('0xf')](_0x40c184)&&!_[_0x50e8('0xf')](_0x291fb7)&&!_['isNil'](_0x291fb7['rows'])){return _[_0x50e8('0x10')](_0x291fb7[_0x50e8('0x11')],function(_0x40d060){return _0x40d060['id']==_0x40c184;});}return null;};}exports[_0x50e8('0x12')]=function(_0x5dae4e,_0x90c54c){return respondWithRpcPromise(_0x50e8('0x13'),_0x5dae4e['query'])[_0x50e8('0x14')](respondWithResult(_0x90c54c,null))['catch'](handleError(_0x90c54c,null));};exports[_0x50e8('0x15')]=function(_0xe04a5c,_0xd263d){return respondWithRpcPromise(_0x50e8('0x16'),_[_0x50e8('0x17')](_0xe04a5c['query'],_0xe04a5c[_0x50e8('0x18')]))[_0x50e8('0x14')](respondWithResult(_0xd263d,null))['catch'](handleError(_0xd263d,null));};exports[_0x50e8('0x19')]=function(_0x41500f,_0x5691b2){return respondWithRpcPromise(_0x50e8('0x1a'),_[_0x50e8('0x17')](_0x41500f['query'],_0x41500f['params']))['then'](respondWithResult(_0x5691b2,null))[_0x50e8('0x1b')](handleError(_0x5691b2,null));};exports[_0x50e8('0x1c')]=function(_0x124402,_0x371a1f){return respondWithRpcPromise(_0x50e8('0x1d'),_0x124402[_0x50e8('0x1e')])['then'](respondWithResult(_0x371a1f,null))[_0x50e8('0x1b')](handleError(_0x371a1f,null));};exports[_0x50e8('0x1f')]=function(_0x4b3a09,_0x177201){return respondWithRpcPromise(_0x50e8('0x1d'),_0x4b3a09[_0x50e8('0x1e')])[_0x50e8('0x14')](findById(_0x4b3a09['params']['id']))[_0x50e8('0x14')](respondWithResult(_0x177201,null))['catch'](handleError(_0x177201,null));};exports[_0x50e8('0x20')]=function(_0x39c0c6,_0x42bbef){return respondWithRpcPromise('UpdateVoiceQueue',_[_0x50e8('0x17')](_0x39c0c6[_0x50e8('0x21')],_0x39c0c6[_0x50e8('0x18')]))[_0x50e8('0x14')](respondWithResult(_0x42bbef,null))[_0x50e8('0x1b')](handleError(_0x42bbef,null));};exports[_0x50e8('0x22')]=function(_0x2c6fb3,_0x54d81d){return respondWithRpcPromise(_0x50e8('0x23'),_[_0x50e8('0x17')](_0x2c6fb3['query'],_0x2c6fb3['params']))[_0x50e8('0x14')](respondWithResult(_0x54d81d,null))[_0x50e8('0x1b')](handleError(_0x54d81d,null));};exports[_0x50e8('0x24')]=function(_0x47ace2,_0x594187){return respondWithRpcPromise(_0x50e8('0x25'),_0x47ace2[_0x50e8('0x1e')])['then'](respondWithResult(_0x594187,null))[_0x50e8('0x1b')](handleError(_0x594187,null));};exports[_0x50e8('0x26')]=function(_0x38df5a,_0x40e09d){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x50e8('0x17')](_0x38df5a['query'],_0x38df5a[_0x50e8('0x18')]))[_0x50e8('0x14')](respondWithResult(_0x40e09d,null))[_0x50e8('0x1b')](handleError(_0x40e09d,null));};exports['voiceQueuesChannelHangup']=function(_0x306816,_0x40f566){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x50e8('0x17')](_0x306816[_0x50e8('0x1e')],_0x306816[_0x50e8('0x18')]))[_0x50e8('0x14')](respondWithResult(_0x40f566,null))['catch'](handleError(_0x40f566,null));};exports[_0x50e8('0x27')]=function(_0x40dbe8,_0x24d3ea){return respondWithRpcPromise(_0x50e8('0x28'),_['merge'](_0x40dbe8[_0x50e8('0x1e')],_0x40dbe8[_0x50e8('0x18')]))[_0x50e8('0x14')](respondWithResult(_0x24d3ea,null))['catch'](handleError(_0x24d3ea,null));};exports['outbound']=function(_0x5dff99,_0xd39553){return respondWithRpcPromise(_0x50e8('0x29'),_0x5dff99[_0x50e8('0x1e')])[_0x50e8('0x14')](respondWithResult(_0xd39553,null))[_0x50e8('0x1b')](handleError(_0xd39553,null));};exports[_0x50e8('0x2a')]=function(_0xb566c2,_0x40b57c){return respondWithRpcPromise(_0x50e8('0x2b'),_0xb566c2[_0x50e8('0x1e')])['then'](respondWithResult(_0x40b57c,null))[_0x50e8('0x1b')](handleError(_0x40b57c,null));};exports[_0x50e8('0x2c')]=function(_0x2379cf,_0x2bf413){var _0x5dbbe1;return respondWithRpcPromise(_0x50e8('0x2d'),_0x2379cf[_0x50e8('0x1e')])[_0x50e8('0x14')](function(_0x169b4f){_0x5dbbe1=_0x169b4f;return respondWithRpcPromise(_0x50e8('0x2d'),_0x2379cf['query'],routingClient);})['then'](function(_0x81e6f3){return _[_0x50e8('0x17')]({},_0x81e6f3,_0x5dbbe1);})['then'](respondWithResult(_0x2bf413,null))[_0x50e8('0x1b')](handleError(_0x2bf413,null));};exports[_0x50e8('0x2e')]=function(_0x3db1ab,_0x3179a0){if(_0x3db1ab[_0x50e8('0x21')]&&_0x3db1ab[_0x50e8('0x21')][_0x50e8('0x2f')]&&_0x3db1ab[_0x50e8('0x30')]&&_0x3db1ab['user'][_0x50e8('0x31')]){for(var _0x44e0ca in _0x3db1ab[_0x50e8('0x21')][_0x50e8('0x2f')]){if(_0x3db1ab['body'][_0x50e8('0x2f')][_0x50e8('0x32')](_0x44e0ca)){db[_0x50e8('0x33')][_0x50e8('0x34')]({'where':{'channel':_0x44e0ca,'membername':_0x3db1ab['user'][_0x50e8('0x31')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3db1ab['body']['interaction'][_0x44e0ca]&&_0x3db1ab[_0x50e8('0x21')][_0x50e8('0x2f')][_0x44e0ca]['length']?{'$notIn':_0x3db1ab[_0x50e8('0x21')][_0x50e8('0x2f')][_0x44e0ca]}:{'$ne':null}}})[_0x50e8('0x14')](function(_0x6e37ad){var _0x387481=moment()[_0x50e8('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x16fdf6=0x0,_0x596f62=_0x6e37ad[_0x50e8('0x36')];_0x16fdf6<_0x596f62;_0x16fdf6+=0x1){_0x6e37ad[_0x16fdf6][_0x50e8('0x37')]({'exitAt':_0x387481});}});for(var _0x537762=0x0;_0x537762<_0x3db1ab[_0x50e8('0x21')]['interaction'][_0x44e0ca][_0x50e8('0x36')];_0x537762+=0x1){db[_0x50e8('0x33')][_0x50e8('0x38')]({'where':{'channel':_0x44e0ca,'membername':_0x3db1ab[_0x50e8('0x30')][_0x50e8('0x31')],'type':_0x50e8('0x39'),'uniqueid':_0x3db1ab[_0x50e8('0x21')][_0x50e8('0x2f')][_0x44e0ca][_0x537762],'exitAt':null},'defaults':{'channel':_0x44e0ca,'membername':_0x3db1ab[_0x50e8('0x30')][_0x50e8('0x31')],'interface':_[_0x50e8('0xf')](_0x3db1ab['user'][_0x50e8('0x3a')])?util[_0x50e8('0x35')]('SIP/%s',_0x3db1ab[_0x50e8('0x30')]['name']):_0x3db1ab[_0x50e8('0x30')]['interface'],'type':_0x50e8('0x39'),'enterAt':moment()[_0x50e8('0x35')](_0x50e8('0x3b')),'role':_0x50e8('0x3c'),'internal':_0x3db1ab[_0x50e8('0x30')][_0x50e8('0x3d')],'uniqueid':_0x3db1ab[_0x50e8('0x21')]['interaction'][_0x44e0ca][_0x537762]}});}}}}return respondWithRpcPromise(_0x50e8('0x3e'),{'id':_0x3db1ab[_0x50e8('0x18')]['id'],'capacity':_0x3db1ab[_0x50e8('0x21')][_0x50e8('0x3f')]},routingClient)[_0x50e8('0x14')](respondWithResult(_0x3179a0,null))[_0x50e8('0x1b')](handleError(_0x3179a0,null));};exports['telephones']=function(_0x5122a2,_0x250b28){return respondWithRpcPromise(_0x50e8('0x40'),_0x5122a2[_0x50e8('0x1e')])['then'](respondWithResult(_0x250b28,null))[_0x50e8('0x1b')](handleError(_0x250b28,null));};exports[_0x50e8('0x41')]=function(_0x3476c5,_0x15db71){return respondWithRpcPromise(_0x50e8('0x42'),_0x3476c5[_0x50e8('0x1e')])[_0x50e8('0x14')](respondWithResult(_0x15db71,null))['catch'](handleError(_0x15db71,null));};exports['campaigns']=function(_0x55083e,_0x2b54ad){return respondWithRpcPromise(_0x50e8('0x43'),_0x55083e[_0x50e8('0x1e')])[_0x50e8('0x14')](respondWithResult(_0x2b54ad,null))[_0x50e8('0x1b')](handleError(_0x2b54ad,null));};exports[_0x50e8('0x44')]=function(_0x566723,_0x2f2154){return respondWithRpcPromise(_0x50e8('0x45'),_0x566723[_0x50e8('0x1e')],routingClient)[_0x50e8('0x14')](respondWithResult(_0x2f2154,null))['catch'](handleError(_0x2f2154,null));};exports[_0x50e8('0x46')]=function(_0xf773fd,_0x373b41){return respondWithRpcPromise(_0x50e8('0x45'),_0xf773fd[_0x50e8('0x1e')],routingClient)[_0x50e8('0x14')](findById(_0xf773fd['params']['id']))[_0x50e8('0x14')](respondWithResult(_0x373b41,null))['catch'](handleError(_0x373b41,null));};exports['mailQueues']=function(_0x5af2a4,_0x23216a){return respondWithRpcPromise('MailQueues',_0x5af2a4[_0x50e8('0x1e')],routingClient)[_0x50e8('0x14')](respondWithResult(_0x23216a,null))[_0x50e8('0x1b')](handleError(_0x23216a,null));};exports[_0x50e8('0x47')]=function(_0x279cf4,_0x12224d){return respondWithRpcPromise(_0x50e8('0x48'),_0x279cf4['query'],routingClient)[_0x50e8('0x14')](findById(_0x279cf4[_0x50e8('0x18')]['id']))[_0x50e8('0x14')](respondWithResult(_0x12224d,null))['catch'](handleError(_0x12224d,null));};exports['mailAccounts']=function(_0x53dcdc,_0x3d7311){return respondWithRpcPromise(_0x50e8('0x49'),_0x53dcdc[_0x50e8('0x1e')],mailClient)[_0x50e8('0x14')](respondWithResult(_0x3d7311,null))[_0x50e8('0x1b')](handleError(_0x3d7311,null));};exports[_0x50e8('0x4a')]=function(_0x583d6a,_0x42c2d0){return respondWithRpcPromise('OpenchannelQueues',_0x583d6a[_0x50e8('0x1e')],routingClient)[_0x50e8('0x14')](respondWithResult(_0x42c2d0,null))['catch'](handleError(_0x42c2d0,null));};exports['showOpenchannelQueues']=function(_0x51775a,_0x2eed72){return respondWithRpcPromise(_0x50e8('0x4b'),_0x51775a['query'],routingClient)[_0x50e8('0x14')](findById(_0x51775a[_0x50e8('0x18')]['id']))[_0x50e8('0x14')](respondWithResult(_0x2eed72,null))[_0x50e8('0x1b')](handleError(_0x2eed72,null));};exports[_0x50e8('0x4c')]=function(_0x47b428,_0x125e92){return respondWithRpcPromise(_0x50e8('0x4d'),_0x47b428[_0x50e8('0x1e')],routingClient)['then'](respondWithResult(_0x125e92,null))['catch'](handleError(_0x125e92,null));};exports[_0x50e8('0x4e')]=function(_0x44e9a2,_0xd21879){return respondWithRpcPromise(_0x50e8('0x4d'),_0x44e9a2[_0x50e8('0x1e')],routingClient)[_0x50e8('0x14')](findById(_0x44e9a2['params']['id']))['then'](respondWithResult(_0xd21879,null))[_0x50e8('0x1b')](handleError(_0xd21879,null));};exports['whatsappQueues']=function(_0x1fc530,_0x36a288){return respondWithRpcPromise('WhatsappQueues',_0x1fc530[_0x50e8('0x1e')],routingClient)['then'](respondWithResult(_0x36a288,null))['catch'](handleError(_0x36a288,null));};exports['showWhatsappQueues']=function(_0x22b6f3,_0x2d4fe8){return respondWithRpcPromise(_0x50e8('0x4f'),_0x22b6f3[_0x50e8('0x1e')],routingClient)['then'](findById(_0x22b6f3['params']['id']))[_0x50e8('0x14')](respondWithResult(_0x2d4fe8,null))[_0x50e8('0x1b')](handleError(_0x2d4fe8,null));};exports[_0x50e8('0x50')]=function(_0x3ac7cc,_0x20c5e8){return respondWithRpcPromise(_0x50e8('0x51'),_0x3ac7cc[_0x50e8('0x1e')],routingClient)[_0x50e8('0x14')](respondWithResult(_0x20c5e8,null))[_0x50e8('0x1b')](handleError(_0x20c5e8,null));};exports[_0x50e8('0x52')]=function(_0x109920,_0x38b535){return respondWithRpcPromise(_0x50e8('0x51'),_0x109920[_0x50e8('0x1e')],routingClient)[_0x50e8('0x14')](findById(_0x109920[_0x50e8('0x18')]['id']))[_0x50e8('0x14')](respondWithResult(_0x38b535,null))[_0x50e8('0x1b')](handleError(_0x38b535,null));};exports['faxAccounts']=function(_0x35a382,_0x474978){return respondWithRpcPromise(_0x50e8('0x53'),_0x35a382[_0x50e8('0x1e')])['then'](respondWithResult(_0x474978,null))[_0x50e8('0x1b')](handleError(_0x474978,null));};exports[_0x50e8('0x54')]=function(_0x26c505,_0x161a07){return respondWithRpcPromise(_0x50e8('0x55'),_0x26c505[_0x50e8('0x1e')],routingClient)['then'](respondWithResult(_0x161a07,null))[_0x50e8('0x1b')](handleError(_0x161a07,null));};exports[_0x50e8('0x56')]=function(_0x19e44c,_0x13667e){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x19e44c[_0x50e8('0x1e')],routingClient)['then'](respondWithResult(_0x13667e,null))[_0x50e8('0x1b')](handleError(_0x13667e,null));};exports[_0x50e8('0x57')]=function(_0x365c9e,_0x1637b2){return respondWithRpcPromise(_0x50e8('0x58'),_0x365c9e['query'],routingClient)[_0x50e8('0x14')](respondWithResult(_0x1637b2,null))[_0x50e8('0x1b')](handleError(_0x1637b2,null));};exports[_0x50e8('0x59')]=function(_0x309015,_0x3a3820){return respondWithRpcPromise(_0x50e8('0x58'),_0x309015['query'],routingClient)[_0x50e8('0x14')](function(_0x1cc566){if(_0x309015['query'][_0x50e8('0x5a')]!==undefined){var _0x2fc1b6=_(_0x1cc566['rows'])[_0x50e8('0x5b')]([_0x309015['query'][_0x50e8('0x5a')],_0x309015[_0x50e8('0x18')]['id']])['map'](_0x50e8('0x5c'))[_0x50e8('0x5d')]()[_0x50e8('0x5e')]();return _0x1cc566[_0x50e8('0x11')]['filter'](function(_0xf21b2f){return _0x2fc1b6['indexOf'](_0xf21b2f[_0x50e8('0x5c')])>-0x1;});}else{return _0x1cc566[_0x50e8('0x11')]['filter'](function(_0x68342){return _0x68342[_0x50e8('0x5c')]===parseInt(_0x309015[_0x50e8('0x18')]['id']);});}})[_0x50e8('0x14')](respondWithResult(_0x3a3820,null))[_0x50e8('0x1b')](handleError(_0x3a3820,null));};exports[_0x50e8('0x5f')]=function(_0x2c85a6,_0x410e7b){return respondWithRpcPromise(_0x50e8('0x60'),_0x2c85a6['query'],routingClient)[_0x50e8('0x14')](respondWithResult(_0x410e7b,null))[_0x50e8('0x1b')](handleError(_0x410e7b,null));};exports[_0x50e8('0x61')]=function(_0x5a79c4,_0x7d64e0){return respondWithRpcPromise(_0x50e8('0x62'),_0x5a79c4[_0x50e8('0x1e')],routingClient)['then'](respondWithResult(_0x7d64e0,null))['catch'](handleError(_0x7d64e0,null));};exports[_0x50e8('0x63')]=function(_0x440fc7,_0x5d922b){return respondWithRpcPromise(_0x50e8('0x64'),_0x440fc7['query'],routingClient)[_0x50e8('0x14')](respondWithResult(_0x5d922b,null))[_0x50e8('0x1b')](handleError(_0x5d922b,null));};exports[_0x50e8('0x65')]=function(_0x157b27){return function(_0x49828b,_0x22d2e){var _0x4ac008,_0x29af7b;var _0x51ea2a=_['capitalize'](_0x157b27);var _0x368d17=_0x157b27===_0x50e8('0x66')?'Website':_0x50e8('0x67');return db[_0x51ea2a+'Queue'][_0x50e8('0x68')]({'raw':!![],'where':{'id':_0x49828b['params']['id']}})['then'](function(_0x27dae3){if(_[_0x50e8('0xf')](_0x27dae3)){throw new Error(_0x51ea2a+_0x50e8('0x69'));}_0x4ac008=_0x27dae3;return db[_0x51ea2a+_0x50e8('0x6a')]['findOne']({'where':{'id':_0x49828b[_0x50e8('0x21')]['messageId']},'include':[{'model':db[_0x51ea2a+'Interaction'],'as':_0x50e8('0x6b')},{'model':db[_0x51ea2a+_0x368d17],'as':_0x50e8('0x67')}]});})[_0x50e8('0x14')](function(_0x50d925){if(_['isNil'](_0x50d925)){throw new Error(_0x51ea2a+'\x20Message\x20not\x20found');}_0x29af7b=_0x50d925;return _0x50d925[_0x50e8('0x6c')]({'read':0x0,'readAt':null,'UserId':null});})[_0x50e8('0x14')](function(){var _0x1decc9={'uniqueid':_0x157b27+'.'+_0x29af7b['id']+'.'+_0x29af7b[_0x50e8('0x6b')]['id'],'FromUserId':_0x49828b[_0x50e8('0x30')]['id'],'type':_0x50e8('0x6d')};_0x1decc9[_0x51ea2a+'MessageId']=_0x29af7b['id'];_0x1decc9[_0x51ea2a+'InteractionId']=_0x29af7b[_0x50e8('0x6b')]['id'];_0x1decc9[_0x50e8('0x6e')+_0x51ea2a+_0x368d17+'Id']=_0x29af7b[_0x50e8('0x67')]['id'];_0x1decc9['To'+_0x51ea2a+_0x50e8('0x6f')]=_0x4ac008['id'];return db[_0x51ea2a+_0x50e8('0x70')]['create'](_0x1decc9);})[_0x50e8('0x14')](function(){return respondWithRpcPromise(_0x50e8('0x71'),{'channel':_0x157b27,'interaction':_0x29af7b[_0x50e8('0x6b')],'message':_0x29af7b,'account':_0x29af7b['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x4ac008[_0x50e8('0x31')]+','+(_0x29af7b[_0x50e8('0x67')][_0x50e8('0x72')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x50e8('0x14')](respondWithResult(_0x22d2e,null))[_0x50e8('0x1b')](handleError(_0x22d2e,null));};};exports['agentNotify']=function(_0x29e664,_0x52929f){var _0x306fc0,_0x1e38ea;if(_[_0x50e8('0xf')](_0x29e664[_0x50e8('0x21')][_0x50e8('0x73')])){throw new Error(_0x50e8('0x74'));}var _0x1c4f8f=_0x29e664[_0x50e8('0x21')][_0x50e8('0x73')];var _0x5b4032=_[_0x50e8('0x75')](_0x1c4f8f);var _0x4e431e=_0x1c4f8f===_0x50e8('0x66')?_0x50e8('0x76'):_0x50e8('0x67');return db[_0x50e8('0x77')][_0x50e8('0x68')]({'raw':!![],'where':{'id':_0x29e664[_0x50e8('0x18')]['id'],'role':'agent'}})[_0x50e8('0x14')](function(_0xe57ebc){if(_[_0x50e8('0xf')](_0xe57ebc)){throw new Error(_0x50e8('0x78'));}_0x306fc0=_0xe57ebc;return db[_0x5b4032+_0x50e8('0x6a')][_0x50e8('0x68')]({'where':{'id':_0x29e664[_0x50e8('0x21')]['messageId']},'include':[{'model':db[_0x5b4032+_0x50e8('0x6b')],'as':_0x50e8('0x6b')},{'model':db[_0x5b4032+_0x4e431e],'as':_0x50e8('0x67')}]});})[_0x50e8('0x14')](function(_0x28ce03){if(_[_0x50e8('0xf')](_0x28ce03)){throw new Error(_0x5b4032+_0x50e8('0x79'));}_0x1e38ea=_0x28ce03;return _0x28ce03[_0x50e8('0x6c')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x4e67ca={'uniqueid':_0x1c4f8f+'.'+_0x1e38ea['id']+'.'+_0x1e38ea['Interaction']['id'],'FromUserId':_0x29e664[_0x50e8('0x30')]['id'],'type':'queue','ToUserId':_0x306fc0['id']};_0x4e67ca[_0x5b4032+_0x50e8('0x7a')]=_0x1e38ea['id'];_0x4e67ca[_0x5b4032+_0x50e8('0x7b')]=_0x1e38ea[_0x50e8('0x6b')]['id'];_0x4e67ca[_0x50e8('0x6e')+_0x5b4032+_0x4e431e+'Id']=_0x1e38ea[_0x50e8('0x67')]['id'];return db[_0x5b4032+_0x50e8('0x70')][_0x50e8('0x7c')](_0x4e67ca);})[_0x50e8('0x14')](function(){return respondWithRpcPromise(_0x50e8('0x71'),{'channel':_0x1c4f8f,'interaction':_0x1e38ea[_0x50e8('0x6b')],'message':_0x1e38ea,'account':_0x1e38ea[_0x50e8('0x67')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x306fc0[_0x50e8('0x31')]+','+(_0x1e38ea[_0x50e8('0x67')]['agentTransferTimeout']||0x12c),'interval':_0x50e8('0x7d')}]},routingClient);})[_0x50e8('0x14')](respondWithResult(_0x52929f,null))[_0x50e8('0x1b')](handleError(_0x52929f,null));}; \ No newline at end of file +var _0x8ef6=['name','send','isNil','find','rows','VoiceChannels','voiceChannelMixMonitor','VoiceChannelMixMonitor','query','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','findOrCreate','interface','SIP/%s','INTERACTION','agent','internal','AgentCapacity','telephones','trunks','Trunks','campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','queue_id','value','filter','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','create','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','User','Agent\x20not\x20found','TransferReport','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','catch','status','sendStatus','stack'];(function(_0xef4ee7,_0x59690c){var _0xc4683=function(_0x595328){while(--_0x595328){_0xef4ee7['push'](_0xef4ee7['shift']());}};_0xc4683(++_0x59690c);}(_0x8ef6,0xf2));var _0x68ef=function(_0xe2a332,_0x268220){_0xe2a332=_0xe2a332-0x0;var _0x5e514d=_0x8ef6[_0xe2a332];return _0x5e514d;};'use strict';var BPromise=require(_0x68ef('0x0'));var moment=require(_0x68ef('0x1'));var _=require(_0x68ef('0x2'));var util=require(_0x68ef('0x3'));var db=require(_0x68ef('0x4'))['db'];var logger=require(_0x68ef('0x5'))(_0x68ef('0x6'));var jayson=require('jayson/promise');var amiClient=jayson[_0x68ef('0x7')][_0x68ef('0x8')]({'port':0x232a});var mailClient=jayson[_0x68ef('0x7')][_0x68ef('0x8')]({'port':0x232b});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){var _0x31007e=_0x2de776?_0x2de776:amiClient;return _0x31007e[_0x68ef('0x9')](_0x3c2ff3,_0x4740e8)[_0x68ef('0xa')](function(_0x112b18){if(_0x112b18[_0x68ef('0xb')]){if(_0x112b18[_0x68ef('0xb')][_0x68ef('0xc')]===0x1f4){return _0x228967(_0x112b18[_0x68ef('0xb')][_0x68ef('0xd')]);}return _0x4eb5eb(_0x112b18[_0x68ef('0xb')][_0x68ef('0xd')]);}else{_0x4eb5eb(_0x112b18['result']);}})[_0x68ef('0xe')](function(_0x46356f){_0x228967(_0x46356f);});});}function respondWithResult(_0x1e117a,_0x454ef4){_0x454ef4=_0x454ef4||0xc8;return function(_0x40f253){if(_0x40f253){return _0x1e117a[_0x68ef('0xf')](_0x454ef4)['json'](_0x40f253);}return _0x1e117a[_0x68ef('0x10')](0x194);};}function handleError(_0xc50cce,_0x2657c5){_0x2657c5=_0x2657c5||0x1f4;return function(_0x47fbb5){logger[_0x68ef('0xb')](_0x47fbb5[_0x68ef('0x11')]);if(_0x47fbb5[_0x68ef('0x12')]){delete _0x47fbb5['name'];}_0xc50cce[_0x68ef('0xf')](_0x2657c5)[_0x68ef('0x13')](_0x47fbb5);};}function findById(_0x3d1e90){return function(_0x3780a4){if(!_['isNil'](_0x3d1e90)&&!_[_0x68ef('0x14')](_0x3780a4)&&!_['isNil'](_0x3780a4['rows'])){return _[_0x68ef('0x15')](_0x3780a4[_0x68ef('0x16')],function(_0x4ade0d){return _0x4ade0d['id']==_0x3d1e90;});}return null;};}exports['voiceChannels']=function(_0x3c4c1f,_0x2cd92c){return respondWithRpcPromise(_0x68ef('0x17'),_0x3c4c1f['query'])[_0x68ef('0xa')](respondWithResult(_0x2cd92c,null))[_0x68ef('0xe')](handleError(_0x2cd92c,null));};exports[_0x68ef('0x18')]=function(_0x5b246b,_0x3c46d4){return respondWithRpcPromise(_0x68ef('0x19'),_['merge'](_0x5b246b[_0x68ef('0x1a')],_0x5b246b[_0x68ef('0x1b')]))[_0x68ef('0xa')](respondWithResult(_0x3c46d4,null))['catch'](handleError(_0x3c46d4,null));};exports['voiceChannelStopMixMonitor']=function(_0x59bebc,_0x26018d){return respondWithRpcPromise(_0x68ef('0x1c'),_[_0x68ef('0x1d')](_0x59bebc[_0x68ef('0x1a')],_0x59bebc[_0x68ef('0x1b')]))[_0x68ef('0xa')](respondWithResult(_0x26018d,null))[_0x68ef('0xe')](handleError(_0x26018d,null));};exports[_0x68ef('0x1e')]=function(_0x65fd09,_0x13280b){return respondWithRpcPromise('VoiceQueues',_0x65fd09[_0x68ef('0x1a')])['then'](respondWithResult(_0x13280b,null))['catch'](handleError(_0x13280b,null));};exports['showVoiceQueues']=function(_0x1a7ce1,_0x268f32){return respondWithRpcPromise(_0x68ef('0x1f'),_0x1a7ce1[_0x68ef('0x1a')])['then'](findById(_0x1a7ce1['params']['id']))[_0x68ef('0xa')](respondWithResult(_0x268f32,null))[_0x68ef('0xe')](handleError(_0x268f32,null));};exports[_0x68ef('0x20')]=function(_0x263b30,_0x22ef25){return respondWithRpcPromise(_0x68ef('0x21'),_[_0x68ef('0x1d')](_0x263b30[_0x68ef('0x22')],_0x263b30['params']))[_0x68ef('0xa')](respondWithResult(_0x22ef25,null))[_0x68ef('0xe')](handleError(_0x22ef25,null));};exports[_0x68ef('0x23')]=function(_0x4c25aa,_0x370a8f){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x68ef('0x1d')](_0x4c25aa[_0x68ef('0x1a')],_0x4c25aa['params']))['then'](respondWithResult(_0x370a8f,null))[_0x68ef('0xe')](handleError(_0x370a8f,null));};exports[_0x68ef('0x24')]=function(_0x4b8fc8,_0xf58fa1){return respondWithRpcPromise(_0x68ef('0x25'),_0x4b8fc8[_0x68ef('0x1a')])[_0x68ef('0xa')](respondWithResult(_0xf58fa1,null))['catch'](handleError(_0xf58fa1,null));};exports[_0x68ef('0x26')]=function(_0x1d69ac,_0x5f137b){return respondWithRpcPromise(_0x68ef('0x27'),_['merge'](_0x1d69ac[_0x68ef('0x1a')],_0x1d69ac[_0x68ef('0x1b')]))['then'](respondWithResult(_0x5f137b,null))[_0x68ef('0xe')](handleError(_0x5f137b,null));};exports['voiceQueuesChannelHangup']=function(_0x38c2f8,_0x575f43){return respondWithRpcPromise(_0x68ef('0x28'),_[_0x68ef('0x1d')](_0x38c2f8[_0x68ef('0x1a')],_0x38c2f8['params']))[_0x68ef('0xa')](respondWithResult(_0x575f43,null))['catch'](handleError(_0x575f43,null));};exports[_0x68ef('0x29')]=function(_0x4c9506,_0x474ffa){return respondWithRpcPromise(_0x68ef('0x2a'),_[_0x68ef('0x1d')](_0x4c9506[_0x68ef('0x1a')],_0x4c9506[_0x68ef('0x1b')]))[_0x68ef('0xa')](respondWithResult(_0x474ffa,null))['catch'](handleError(_0x474ffa,null));};exports[_0x68ef('0x2b')]=function(_0x15a6ab,_0x32074a){return respondWithRpcPromise('Outbound',_0x15a6ab[_0x68ef('0x1a')])[_0x68ef('0xa')](respondWithResult(_0x32074a,null))[_0x68ef('0xe')](handleError(_0x32074a,null));};exports['outboundChannels']=function(_0x49f260,_0x14f0fc){return respondWithRpcPromise(_0x68ef('0x2c'),_0x49f260[_0x68ef('0x1a')])[_0x68ef('0xa')](respondWithResult(_0x14f0fc,null))[_0x68ef('0xe')](handleError(_0x14f0fc,null));};exports[_0x68ef('0x2d')]=function(_0x41ffe0,_0x5b1246){var _0xaf7df1;return respondWithRpcPromise(_0x68ef('0x2e'),_0x41ffe0[_0x68ef('0x1a')])[_0x68ef('0xa')](function(_0x492b74){_0xaf7df1=_0x492b74;return respondWithRpcPromise(_0x68ef('0x2e'),_0x41ffe0[_0x68ef('0x1a')],routingClient);})[_0x68ef('0xa')](function(_0x410c10){return _[_0x68ef('0x1d')]({},_0x410c10,_0xaf7df1);})[_0x68ef('0xa')](respondWithResult(_0x5b1246,null))['catch'](handleError(_0x5b1246,null));};exports[_0x68ef('0x2f')]=function(_0x3f7699,_0xf5010c){if(_0x3f7699[_0x68ef('0x22')]&&_0x3f7699[_0x68ef('0x22')][_0x68ef('0x30')]&&_0x3f7699[_0x68ef('0x31')]&&_0x3f7699[_0x68ef('0x31')][_0x68ef('0x12')]){for(var _0x531096 in _0x3f7699[_0x68ef('0x22')][_0x68ef('0x30')]){if(_0x3f7699[_0x68ef('0x22')][_0x68ef('0x30')][_0x68ef('0x32')](_0x531096)){db[_0x68ef('0x33')][_0x68ef('0x34')]({'where':{'channel':_0x531096,'membername':_0x3f7699['user'][_0x68ef('0x12')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3f7699[_0x68ef('0x22')][_0x68ef('0x30')][_0x531096]&&_0x3f7699[_0x68ef('0x22')][_0x68ef('0x30')][_0x531096]['length']?{'$notIn':_0x3f7699[_0x68ef('0x22')]['interaction'][_0x531096]}:{'$ne':null}}})[_0x68ef('0xa')](function(_0x499423){var _0x227e36=moment()[_0x68ef('0x35')](_0x68ef('0x36'));for(var _0x5c4a66=0x0,_0x59b148=_0x499423[_0x68ef('0x37')];_0x5c4a66<_0x59b148;_0x5c4a66+=0x1){_0x499423[_0x5c4a66][_0x68ef('0x38')]({'exitAt':_0x227e36});}});for(var _0x58d72a=0x0;_0x58d72a<_0x3f7699['body']['interaction'][_0x531096][_0x68ef('0x37')];_0x58d72a+=0x1){db[_0x68ef('0x33')][_0x68ef('0x39')]({'where':{'channel':_0x531096,'membername':_0x3f7699[_0x68ef('0x31')][_0x68ef('0x12')],'type':'INTERACTION','uniqueid':_0x3f7699['body'][_0x68ef('0x30')][_0x531096][_0x58d72a],'exitAt':null},'defaults':{'channel':_0x531096,'membername':_0x3f7699[_0x68ef('0x31')][_0x68ef('0x12')],'interface':_[_0x68ef('0x14')](_0x3f7699['user'][_0x68ef('0x3a')])?util[_0x68ef('0x35')](_0x68ef('0x3b'),_0x3f7699[_0x68ef('0x31')]['name']):_0x3f7699['user'][_0x68ef('0x3a')],'type':_0x68ef('0x3c'),'enterAt':moment()['format'](_0x68ef('0x36')),'role':_0x68ef('0x3d'),'internal':_0x3f7699[_0x68ef('0x31')][_0x68ef('0x3e')],'uniqueid':_0x3f7699[_0x68ef('0x22')]['interaction'][_0x531096][_0x58d72a]}});}}}}return respondWithRpcPromise(_0x68ef('0x3f'),{'id':_0x3f7699[_0x68ef('0x1b')]['id'],'capacity':_0x3f7699[_0x68ef('0x22')]['capacity']},routingClient)[_0x68ef('0xa')](respondWithResult(_0xf5010c,null))[_0x68ef('0xe')](handleError(_0xf5010c,null));};exports[_0x68ef('0x40')]=function(_0x50ef1f,_0x7dce90){return respondWithRpcPromise('Telephones',_0x50ef1f['query'])[_0x68ef('0xa')](respondWithResult(_0x7dce90,null))['catch'](handleError(_0x7dce90,null));};exports[_0x68ef('0x41')]=function(_0xb33afd,_0x53ebd){return respondWithRpcPromise(_0x68ef('0x42'),_0xb33afd[_0x68ef('0x1a')])[_0x68ef('0xa')](respondWithResult(_0x53ebd,null))[_0x68ef('0xe')](handleError(_0x53ebd,null));};exports[_0x68ef('0x43')]=function(_0x2b35f4,_0x247915){return respondWithRpcPromise('Campaigns',_0x2b35f4['query'])[_0x68ef('0xa')](respondWithResult(_0x247915,null))[_0x68ef('0xe')](handleError(_0x247915,null));};exports[_0x68ef('0x44')]=function(_0xdc83f4,_0x82df12){return respondWithRpcPromise(_0x68ef('0x45'),_0xdc83f4[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](respondWithResult(_0x82df12,null))[_0x68ef('0xe')](handleError(_0x82df12,null));};exports['showChatQueues']=function(_0x5685bb,_0x42a4b2){return respondWithRpcPromise('ChatQueues',_0x5685bb[_0x68ef('0x1a')],routingClient)['then'](findById(_0x5685bb[_0x68ef('0x1b')]['id']))[_0x68ef('0xa')](respondWithResult(_0x42a4b2,null))['catch'](handleError(_0x42a4b2,null));};exports[_0x68ef('0x46')]=function(_0x4e097e,_0x407c6d){return respondWithRpcPromise(_0x68ef('0x47'),_0x4e097e[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](respondWithResult(_0x407c6d,null))[_0x68ef('0xe')](handleError(_0x407c6d,null));};exports[_0x68ef('0x48')]=function(_0x5c347c,_0x1cdaef){return respondWithRpcPromise(_0x68ef('0x47'),_0x5c347c[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](findById(_0x5c347c[_0x68ef('0x1b')]['id']))[_0x68ef('0xa')](respondWithResult(_0x1cdaef,null))['catch'](handleError(_0x1cdaef,null));};exports[_0x68ef('0x49')]=function(_0x42d2a3,_0x4886af){return respondWithRpcPromise(_0x68ef('0x4a'),_0x42d2a3[_0x68ef('0x1a')],mailClient)[_0x68ef('0xa')](respondWithResult(_0x4886af,null))['catch'](handleError(_0x4886af,null));};exports[_0x68ef('0x4b')]=function(_0x49d197,_0x5412ea){return respondWithRpcPromise(_0x68ef('0x4c'),_0x49d197['query'],routingClient)[_0x68ef('0xa')](respondWithResult(_0x5412ea,null))['catch'](handleError(_0x5412ea,null));};exports[_0x68ef('0x4d')]=function(_0x9e8554,_0x304405){return respondWithRpcPromise(_0x68ef('0x4c'),_0x9e8554[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](findById(_0x9e8554['params']['id']))[_0x68ef('0xa')](respondWithResult(_0x304405,null))['catch'](handleError(_0x304405,null));};exports[_0x68ef('0x4e')]=function(_0x4b0c3e,_0x2f97c5){return respondWithRpcPromise(_0x68ef('0x4f'),_0x4b0c3e[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](respondWithResult(_0x2f97c5,null))[_0x68ef('0xe')](handleError(_0x2f97c5,null));};exports[_0x68ef('0x50')]=function(_0x1be626,_0x52d29a){return respondWithRpcPromise(_0x68ef('0x4f'),_0x1be626[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](findById(_0x1be626[_0x68ef('0x1b')]['id']))[_0x68ef('0xa')](respondWithResult(_0x52d29a,null))['catch'](handleError(_0x52d29a,null));};exports[_0x68ef('0x51')]=function(_0x561e8d,_0x1ed172){return respondWithRpcPromise('WhatsappQueues',_0x561e8d['query'],routingClient)[_0x68ef('0xa')](respondWithResult(_0x1ed172,null))[_0x68ef('0xe')](handleError(_0x1ed172,null));};exports[_0x68ef('0x52')]=function(_0x21b2ce,_0x51f905){return respondWithRpcPromise(_0x68ef('0x53'),_0x21b2ce['query'],routingClient)[_0x68ef('0xa')](findById(_0x21b2ce[_0x68ef('0x1b')]['id']))[_0x68ef('0xa')](respondWithResult(_0x51f905,null))['catch'](handleError(_0x51f905,null));};exports['faxQueues']=function(_0x3e74d2,_0x1092f8){return respondWithRpcPromise(_0x68ef('0x54'),_0x3e74d2[_0x68ef('0x1a')],routingClient)['then'](respondWithResult(_0x1092f8,null))[_0x68ef('0xe')](handleError(_0x1092f8,null));};exports[_0x68ef('0x55')]=function(_0x19c20f,_0x21b104){return respondWithRpcPromise('FaxQueues',_0x19c20f[_0x68ef('0x1a')],routingClient)['then'](findById(_0x19c20f[_0x68ef('0x1b')]['id']))[_0x68ef('0xa')](respondWithResult(_0x21b104,null))[_0x68ef('0xe')](handleError(_0x21b104,null));};exports[_0x68ef('0x56')]=function(_0xed16d1,_0x52cb2a){return respondWithRpcPromise(_0x68ef('0x57'),_0xed16d1[_0x68ef('0x1a')])[_0x68ef('0xa')](respondWithResult(_0x52cb2a,null))['catch'](handleError(_0x52cb2a,null));};exports[_0x68ef('0x58')]=function(_0x4de108,_0x69b1c){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x4de108['query'],routingClient)[_0x68ef('0xa')](respondWithResult(_0x69b1c,null))[_0x68ef('0xe')](handleError(_0x69b1c,null));};exports[_0x68ef('0x59')]=function(_0x405971,_0x501004){return respondWithRpcPromise(_0x68ef('0x5a'),_0x405971[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](respondWithResult(_0x501004,null))['catch'](handleError(_0x501004,null));};exports[_0x68ef('0x5b')]=function(_0x2db826,_0xea2a81){return respondWithRpcPromise(_0x68ef('0x5c'),_0x2db826[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](respondWithResult(_0xea2a81,null))[_0x68ef('0xe')](handleError(_0xea2a81,null));};exports[_0x68ef('0x5d')]=function(_0x156ce3,_0x11feff){return respondWithRpcPromise(_0x68ef('0x5c'),_0x156ce3[_0x68ef('0x1a')],routingClient)['then'](function(_0x15378c){if(_0x156ce3[_0x68ef('0x1a')]['type']!==undefined){var _0x513c69=_(_0x15378c[_0x68ef('0x16')])['filter']([_0x156ce3[_0x68ef('0x1a')][_0x68ef('0x5e')],_0x156ce3['params']['id']])['map'](_0x68ef('0x5f'))['uniq']()[_0x68ef('0x60')]();return _0x15378c['rows'][_0x68ef('0x61')](function(_0x4f425f){return _0x513c69[_0x68ef('0x62')](_0x4f425f[_0x68ef('0x5f')])>-0x1;});}else{return _0x15378c['rows'][_0x68ef('0x61')](function(_0x357be7){return _0x357be7[_0x68ef('0x5f')]===parseInt(_0x156ce3[_0x68ef('0x1b')]['id']);});}})['then'](respondWithResult(_0x11feff,null))[_0x68ef('0xe')](handleError(_0x11feff,null));};exports[_0x68ef('0x63')]=function(_0x5b2e89,_0x3bb3b6){return respondWithRpcPromise(_0x68ef('0x64'),_0x5b2e89[_0x68ef('0x1a')],routingClient)['then'](respondWithResult(_0x3bb3b6,null))[_0x68ef('0xe')](handleError(_0x3bb3b6,null));};exports['whatsappQueuesWaitingInteractions']=function(_0xe6bf05,_0x36c109){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0xe6bf05['query'],routingClient)['then'](respondWithResult(_0x36c109,null))['catch'](handleError(_0x36c109,null));};exports[_0x68ef('0x65')]=function(_0x28ad22,_0x1217f9){return respondWithRpcPromise(_0x68ef('0x66'),_0x28ad22[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](respondWithResult(_0x1217f9,null))[_0x68ef('0xe')](handleError(_0x1217f9,null));};exports[_0x68ef('0x67')]=function(_0x24ba34){return function(_0x3ae3e9,_0x17892c){var _0x108223,_0x717d7b;var _0x4bd5c3=_[_0x68ef('0x68')](_0x24ba34);var _0x556dfc=_0x24ba34===_0x68ef('0x69')?'Website':'Account';return db[_0x4bd5c3+_0x68ef('0x6a')][_0x68ef('0x6b')]({'raw':!![],'where':{'id':_0x3ae3e9[_0x68ef('0x1b')]['id']}})[_0x68ef('0xa')](function(_0x518c9a){if(_['isNil'](_0x518c9a)){throw new Error(_0x4bd5c3+_0x68ef('0x6c'));}_0x108223=_0x518c9a;return db[_0x4bd5c3+_0x68ef('0x6d')][_0x68ef('0x6b')]({'where':{'id':_0x3ae3e9['body'][_0x68ef('0x6e')]},'include':[{'model':db[_0x4bd5c3+_0x68ef('0x6f')],'as':_0x68ef('0x6f')},{'model':db[_0x4bd5c3+_0x556dfc],'as':_0x68ef('0x70')}]});})['then'](function(_0x214e89){if(_[_0x68ef('0x14')](_0x214e89)){throw new Error(_0x4bd5c3+_0x68ef('0x71'));}_0x717d7b=_0x214e89;return _0x214e89[_0x68ef('0x72')]({'read':0x0,'readAt':null,'UserId':null});})[_0x68ef('0xa')](function(){var _0x346049={'uniqueid':_0x24ba34+'.'+_0x717d7b['id']+'.'+_0x717d7b['Interaction']['id'],'FromUserId':_0x3ae3e9[_0x68ef('0x31')]['id'],'type':'queue'};_0x346049[_0x4bd5c3+_0x68ef('0x73')]=_0x717d7b['id'];_0x346049[_0x4bd5c3+_0x68ef('0x74')]=_0x717d7b[_0x68ef('0x6f')]['id'];_0x346049[_0x68ef('0x75')+_0x4bd5c3+_0x556dfc+'Id']=_0x717d7b['Account']['id'];_0x346049['To'+_0x4bd5c3+_0x68ef('0x76')]=_0x108223['id'];return db[_0x4bd5c3+'TransferReport'][_0x68ef('0x77')](_0x346049);})[_0x68ef('0xa')](function(){return respondWithRpcPromise('Start',{'channel':_0x24ba34,'interaction':_0x717d7b['Interaction'],'message':_0x717d7b,'account':_0x717d7b[_0x68ef('0x70')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x108223[_0x68ef('0x12')]+','+(_0x717d7b['Account'][_0x68ef('0x78')]||0x12c),'interval':_0x68ef('0x79')}]},routingClient);})[_0x68ef('0xa')](respondWithResult(_0x17892c,null))[_0x68ef('0xe')](handleError(_0x17892c,null));};};exports[_0x68ef('0x7a')]=function(_0x66a7a8,_0x51b8db){var _0x17d014,_0x463356;if(_[_0x68ef('0x14')](_0x66a7a8[_0x68ef('0x22')][_0x68ef('0x7b')])){throw new Error(_0x68ef('0x7c'));}var _0x303add=_0x66a7a8['body'][_0x68ef('0x7b')];var _0x373ab4=_[_0x68ef('0x68')](_0x303add);var _0x2e20aa=_0x303add===_0x68ef('0x69')?_0x68ef('0x7d'):_0x68ef('0x70');return db[_0x68ef('0x7e')][_0x68ef('0x6b')]({'raw':!![],'where':{'id':_0x66a7a8['params']['id'],'role':_0x68ef('0x3d')}})['then'](function(_0x5f3b79){if(_['isNil'](_0x5f3b79)){throw new Error(_0x68ef('0x7f'));}_0x17d014=_0x5f3b79;return db[_0x373ab4+_0x68ef('0x6d')][_0x68ef('0x6b')]({'where':{'id':_0x66a7a8['body']['messageId']},'include':[{'model':db[_0x373ab4+'Interaction'],'as':_0x68ef('0x6f')},{'model':db[_0x373ab4+_0x2e20aa],'as':_0x68ef('0x70')}]});})[_0x68ef('0xa')](function(_0x40996e){if(_[_0x68ef('0x14')](_0x40996e)){throw new Error(_0x373ab4+_0x68ef('0x71'));}_0x463356=_0x40996e;return _0x40996e['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x68ef('0xa')](function(){var _0x2c7f18={'uniqueid':_0x303add+'.'+_0x463356['id']+'.'+_0x463356[_0x68ef('0x6f')]['id'],'FromUserId':_0x66a7a8[_0x68ef('0x31')]['id'],'type':'queue','ToUserId':_0x17d014['id']};_0x2c7f18[_0x373ab4+_0x68ef('0x73')]=_0x463356['id'];_0x2c7f18[_0x373ab4+_0x68ef('0x74')]=_0x463356[_0x68ef('0x6f')]['id'];_0x2c7f18[_0x68ef('0x75')+_0x373ab4+_0x2e20aa+'Id']=_0x463356[_0x68ef('0x70')]['id'];return db[_0x373ab4+_0x68ef('0x80')][_0x68ef('0x77')](_0x2c7f18);})[_0x68ef('0xa')](function(){return respondWithRpcPromise('Start',{'channel':_0x303add,'interaction':_0x463356[_0x68ef('0x6f')],'message':_0x463356,'account':_0x463356[_0x68ef('0x70')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x17d014[_0x68ef('0x12')]+','+(_0x463356[_0x68ef('0x70')][_0x68ef('0x81')]||0x12c),'interval':_0x68ef('0x79')}]},routingClient);})[_0x68ef('0xa')](respondWithResult(_0x51b8db,null))[_0x68ef('0xe')](handleError(_0x51b8db,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 393478b..ebf22d7 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 _0x5b8d=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run','run','post','create','put','update','destroy','exports'];(function(_0x205ed2,_0x248ed0){var _0x540c3b=function(_0x9a7918){while(--_0x9a7918){_0x205ed2['push'](_0x205ed2['shift']());}};_0x540c3b(++_0x248ed0);}(_0x5b8d,0x142));var _0xd5b8=function(_0x456185,_0x421fe8){_0x456185=_0x456185-0x0;var _0x48c928=_0x5b8d[_0x456185];return _0x48c928;};'use strict';var multer=require(_0xd5b8('0x0'));var util=require(_0xd5b8('0x1'));var path=require(_0xd5b8('0x2'));var timeout=require(_0xd5b8('0x3'));var express=require('express');var router=express[_0xd5b8('0x4')]();var fs_extra=require(_0xd5b8('0x5'));var auth=require(_0xd5b8('0x6'));var interaction=require(_0xd5b8('0x7'));var config=require(_0xd5b8('0x8'));var controller=require(_0xd5b8('0x9'));router[_0xd5b8('0xa')]('/',auth[_0xd5b8('0xb')](),controller[_0xd5b8('0xc')]);router['get'](_0xd5b8('0xd'),auth['isAuthenticated'](),controller[_0xd5b8('0xe')]);router[_0xd5b8('0xa')](_0xd5b8('0xf'),auth[_0xd5b8('0xb')](),controller[_0xd5b8('0x10')]);router[_0xd5b8('0x11')]('/',auth[_0xd5b8('0xb')](),controller[_0xd5b8('0x12')]);router[_0xd5b8('0x13')](_0xd5b8('0xd'),auth['isAuthenticated'](),controller[_0xd5b8('0x14')]);router['delete'](_0xd5b8('0xd'),auth['isAuthenticated'](),controller[_0xd5b8('0x15')]);module[_0xd5b8('0x16')]=router; \ No newline at end of file +var _0xd20d=['isAuthenticated','index','/:id','run','create','update','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./schedule.controller','get'];(function(_0x46a2b4,_0x57e4e3){var _0x4e3f71=function(_0x1cf628){while(--_0x1cf628){_0x46a2b4['push'](_0x46a2b4['shift']());}};_0x4e3f71(++_0x57e4e3);}(_0xd20d,0x1b8));var _0xdd20=function(_0x259d65,_0x458b4a){_0x259d65=_0x259d65-0x0;var _0x1ce90d=_0xd20d[_0x259d65];return _0x1ce90d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdd20('0x0'));var timeout=require(_0xdd20('0x1'));var express=require('express');var router=express[_0xdd20('0x2')]();var fs_extra=require(_0xdd20('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xdd20('0x4'));var config=require(_0xdd20('0x5'));var controller=require(_0xdd20('0x6'));router[_0xdd20('0x7')]('/',auth[_0xdd20('0x8')](),controller[_0xdd20('0x9')]);router[_0xdd20('0x7')](_0xdd20('0xa'),auth[_0xdd20('0x8')](),controller['show']);router['get']('/:id/run',auth[_0xdd20('0x8')](),controller[_0xdd20('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdd20('0xc')]);router['put'](_0xdd20('0xa'),auth[_0xdd20('0x8')](),controller[_0xdd20('0xd')]);router['delete'](_0xdd20('0xa'),auth['isAuthenticated'](),controller[_0xdd20('0xe')]);module[_0xdd20('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 5006692..729d411 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 _0xd6f0=['pdf','xlsx','custom','BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks','days','hours','csv'];(function(_0x2e7a35,_0x485b21){var _0x3d8264=function(_0x9d1512){while(--_0x9d1512){_0x2e7a35['push'](_0x2e7a35['shift']());}};_0x3d8264(++_0x485b21);}(_0xd6f0,0x194));var _0x0d6f=function(_0x548aea,_0x363013){_0x548aea=_0x548aea-0x0;var _0x17b16c=_0xd6f0[_0x548aea];return _0x17b16c;};'use strict';var Sequelize=require(_0x0d6f('0x0'));module[_0x0d6f('0x1')]={'name':{'type':Sequelize[_0x0d6f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x0d6f('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x0d6f('0x2')],'allowNull':![],'defaultValue':_0x0d6f('0x3')},'startAt':{'type':Sequelize[_0x0d6f('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x0d6f('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x0d6f('0x6')](_0x0d6f('0x7'),_0x0d6f('0x8'),_0x0d6f('0x9'),_0x0d6f('0xa'),_0x0d6f('0xb'),_0x0d6f('0xc'),'minutes'),'allowNull':![],'defaultValue':_0x0d6f('0xb')},'output':{'type':Sequelize['ENUM'](_0x0d6f('0xd'),_0x0d6f('0xe'),_0x0d6f('0xf')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM'](_0x0d6f('0x10'),'default'),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x0d6f('0x11')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x0d6f('0x12')]},'sendIfEmpty':{'type':Sequelize[_0x0d6f('0x11')],'defaultValue':!![]}}; \ No newline at end of file +var _0x39d2=['quarters','months','days','hours','minutes','csv','pdf','custom','BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years'];(function(_0xb2d2f7,_0x3dfd6e){var _0x464963=function(_0xb5e234){while(--_0xb5e234){_0xb2d2f7['push'](_0xb2d2f7['shift']());}};_0x464963(++_0x3dfd6e);}(_0x39d2,0x196));var _0x239d=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x39d2[_0x1b7368];return _0x25d54c;};'use strict';var Sequelize=require(_0x239d('0x0'));module[_0x239d('0x1')]={'name':{'type':Sequelize[_0x239d('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x239d('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x239d('0x2')],'allowNull':![],'defaultValue':_0x239d('0x3')},'startAt':{'type':Sequelize[_0x239d('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x239d('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x239d('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x239d('0x6')](_0x239d('0x7'),_0x239d('0x8'),_0x239d('0x9'),'weeks',_0x239d('0xa'),_0x239d('0xb'),_0x239d('0xc')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize['ENUM'](_0x239d('0xd'),_0x239d('0xe'),'xlsx'),'allowNull':![],'defaultValue':_0x239d('0xd')},'type':{'type':Sequelize[_0x239d('0x6')](_0x239d('0xf'),'default'),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x239d('0x10')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x239d('0x11')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x239d('0x10')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 69c8bf6..7bdb819 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 _0xb3ab=['Content-Range','apply','reject','update','destroy','get','Scheduler','UserProfileResource','then','error','index','Schedule','rawAttributes','fieldName','type','model','map','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','show','params','length','include','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','count','limit','set'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0xb3ab,0x86));var _0xbb3a=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xb3ab[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0xbb3a('0x0'));var rimraf=require(_0xbb3a('0x1'));var zipdir=require(_0xbb3a('0x2'));var jsonpatch=require(_0xbb3a('0x3'));var rp=require(_0xbb3a('0x4'));var moment=require('moment');var BPromise=require(_0xbb3a('0x5'));var Mustache=require(_0xbb3a('0x6'));var util=require('util');var path=require(_0xbb3a('0x7'));var sox=require(_0xbb3a('0x8'));var csv=require(_0xbb3a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb3a('0xa'));var _=require(_0xbb3a('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbb3a('0xc'));var deskjs=require(_0xbb3a('0xd'));var toCsv=require(_0xbb3a('0x9'));var querystring=require('querystring');var Papa=require(_0xbb3a('0xe'));var Redis=require(_0xbb3a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xbb3a('0x10'));var as=require(_0xbb3a('0x11'));var hardwareService=require(_0xbb3a('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xbb3a('0x13'));var config=require(_0xbb3a('0x14'));var licenseUtil=require(_0xbb3a('0x15'));var db=require(_0xbb3a('0x16'))['db'];function respondWithStatusCode(_0x9871f3,_0xcf4c8b){_0xcf4c8b=_0xcf4c8b||0xcc;return function(_0x422843){if(_0x422843){return _0x9871f3['sendStatus'](_0xcf4c8b);}return _0x9871f3['status'](_0xcf4c8b)[_0xbb3a('0x17')]();};}function respondWithResult(_0x340896,_0x55a9b6){_0x55a9b6=_0x55a9b6||0xc8;return function(_0x52ace5){if(_0x52ace5){return _0x340896[_0xbb3a('0x18')](_0x55a9b6)['json'](_0x52ace5);}};}function respondWithFilteredResult(_0x22ecd5,_0x38fedd){return function(_0x5870ea){if(_0x5870ea){var _0xc2cca8=typeof _0x38fedd[_0xbb3a('0x19')]===_0xbb3a('0x1a')&&typeof _0x38fedd['limit']===_0xbb3a('0x1a');var _0x143f46=_0x5870ea[_0xbb3a('0x1b')];var _0x4666dc=_0xc2cca8?0x0:_0x38fedd[_0xbb3a('0x19')];var _0x4cb690=_0xc2cca8?_0x5870ea[_0xbb3a('0x1b')]:_0x38fedd[_0xbb3a('0x19')]+_0x38fedd[_0xbb3a('0x1c')];var _0x37d6ac;if(_0x4cb690>=_0x143f46){_0x4cb690=_0x143f46;_0x37d6ac=0xc8;}else{_0x37d6ac=0xce;}_0x22ecd5['status'](_0x37d6ac);return _0x22ecd5[_0xbb3a('0x1d')](_0xbb3a('0x1e'),_0x4666dc+'-'+_0x4cb690+'/'+_0x143f46)['json'](_0x5870ea);}return null;};}function patchUpdates(_0x138a71){return function(_0x79f5a6){try{jsonpatch[_0xbb3a('0x1f')](_0x79f5a6,_0x138a71,!![]);}catch(_0x4e0c43){return BPromise[_0xbb3a('0x20')](_0x4e0c43);}return _0x79f5a6['save']();};}function saveUpdates(_0x5c304f,_0xc56f65){return function(_0x467bd8){if(_0x467bd8){return _0x467bd8[_0xbb3a('0x21')](_0x5c304f)['then'](function(_0x34fb28){return _0x34fb28;});}return null;};}function removeEntity(_0x11eff9,_0x56e7c4){return function(_0x24df10){if(_0x24df10){return _0x24df10[_0xbb3a('0x22')]()['then'](function(){var _0xd7a34d=_0x24df10[_0xbb3a('0x23')]({'plain':!![]});var _0x25ddba=_0xbb3a('0x24');return db[_0xbb3a('0x25')][_0xbb3a('0x22')]({'where':{'type':_0x25ddba,'resourceId':_0xd7a34d['id']}})[_0xbb3a('0x26')](function(){return _0x24df10;});})[_0xbb3a('0x26')](function(){_0x11eff9['status'](0xcc)[_0xbb3a('0x17')]();});}};}function handleEntityNotFound(_0x31d3e0,_0x1de30f){return function(_0x33e68f){if(!_0x33e68f){_0x31d3e0['sendStatus'](0x194);}return _0x33e68f;};}function handleError(_0x2c281a,_0x12c5cc){_0x12c5cc=_0x12c5cc||0x1f4;return function(_0x32fa05){logger[_0xbb3a('0x27')](_0x32fa05['stack']);if(_0x32fa05['name']){delete _0x32fa05['name'];}_0x2c281a[_0xbb3a('0x18')](_0x12c5cc)['send'](_0x32fa05);};}exports[_0xbb3a('0x28')]=function(_0x3c6580,_0x7ac71){var _0x2b034c={},_0x3f7b4a={},_0x41e439={'count':0x0,'rows':[]};var _0x5f5666=_['map'](db[_0xbb3a('0x29')][_0xbb3a('0x2a')],function(_0x173a1a){return{'name':_0x173a1a[_0xbb3a('0x2b')],'type':_0x173a1a[_0xbb3a('0x2c')]['key']};});_0x3f7b4a[_0xbb3a('0x2d')]=_[_0xbb3a('0x2e')](_0x5f5666,_0xbb3a('0x2f'));_0x3f7b4a[_0xbb3a('0x30')]=_[_0xbb3a('0x31')](_0x3c6580[_0xbb3a('0x30')]);_0x3f7b4a[_0xbb3a('0x32')]=_[_0xbb3a('0x33')](_0x3f7b4a['model'],_0x3f7b4a[_0xbb3a('0x30')]);_0x2b034c[_0xbb3a('0x34')]=_[_0xbb3a('0x33')](_0x3f7b4a['model'],qs[_0xbb3a('0x35')](_0x3c6580[_0xbb3a('0x30')][_0xbb3a('0x35')]));_0x2b034c[_0xbb3a('0x34')]=_0x2b034c[_0xbb3a('0x34')]['length']?_0x2b034c[_0xbb3a('0x34')]:_0x3f7b4a[_0xbb3a('0x2d')];if(!_0x3c6580[_0xbb3a('0x30')][_0xbb3a('0x36')](_0xbb3a('0x37'))){_0x2b034c[_0xbb3a('0x1c')]=qs[_0xbb3a('0x1c')](_0x3c6580[_0xbb3a('0x30')][_0xbb3a('0x1c')]);_0x2b034c[_0xbb3a('0x19')]=qs[_0xbb3a('0x19')](_0x3c6580['query'][_0xbb3a('0x19')]);}_0x2b034c['order']=qs[_0xbb3a('0x38')](_0x3c6580[_0xbb3a('0x30')][_0xbb3a('0x38')]);_0x2b034c[_0xbb3a('0x39')]=qs['filters'](_[_0xbb3a('0x3a')](_0x3c6580[_0xbb3a('0x30')],_0x3f7b4a['filters']),_0x5f5666);if(_0x3c6580[_0xbb3a('0x30')][_0xbb3a('0x3b')]){_0x2b034c[_0xbb3a('0x39')]=_[_0xbb3a('0x3c')](_0x2b034c['where'],{'$or':_[_0xbb3a('0x2e')](_0x5f5666,function(_0x5deabc){if(_0x5deabc['type']!==_0xbb3a('0x3d')){var _0x1d943b={};_0x1d943b[_0x5deabc[_0xbb3a('0x2f')]]={'$like':'%'+_0x3c6580[_0xbb3a('0x30')][_0xbb3a('0x3b')]+'%'};return _0x1d943b;}})});}_0x2b034c=_[_0xbb3a('0x3c')]({},_0x2b034c,_0x3c6580['options']);var _0x314a5a={'where':_0x2b034c[_0xbb3a('0x39')]};return db[_0xbb3a('0x29')][_0xbb3a('0x1b')](_0x314a5a)[_0xbb3a('0x26')](function(_0x451e83){_0x41e439[_0xbb3a('0x1b')]=_0x451e83;if(_0x3c6580[_0xbb3a('0x30')]['includeAll']){_0x2b034c['include']=[{'all':!![]}];}return db['Schedule'][_0xbb3a('0x3e')](_0x2b034c);})[_0xbb3a('0x26')](function(_0x24890f){_0x41e439[_0xbb3a('0x3f')]=_0x24890f;return _0x41e439;})[_0xbb3a('0x26')](respondWithFilteredResult(_0x7ac71,_0x2b034c))['catch'](handleError(_0x7ac71,null));};exports[_0xbb3a('0x40')]=function(_0x2bde32,_0x1f9c83){var _0x1d796b={'raw':![],'where':{'id':_0x2bde32[_0xbb3a('0x41')]['id']}},_0x225a82={};_0x225a82['model']=_['keys'](db[_0xbb3a('0x29')][_0xbb3a('0x2a')]);_0x225a82['query']=_['keys'](_0x2bde32[_0xbb3a('0x30')]);_0x225a82[_0xbb3a('0x32')]=_[_0xbb3a('0x33')](_0x225a82[_0xbb3a('0x2d')],_0x225a82['query']);_0x1d796b[_0xbb3a('0x34')]=_[_0xbb3a('0x33')](_0x225a82[_0xbb3a('0x2d')],qs[_0xbb3a('0x35')](_0x2bde32[_0xbb3a('0x30')]['fields']));_0x1d796b[_0xbb3a('0x34')]=_0x1d796b['attributes'][_0xbb3a('0x42')]?_0x1d796b[_0xbb3a('0x34')]:_0x225a82[_0xbb3a('0x2d')];if(_0x2bde32[_0xbb3a('0x30')]['includeAll']){_0x1d796b[_0xbb3a('0x43')]=[{'all':!![]}];}_0x1d796b=_[_0xbb3a('0x3c')]({},_0x1d796b,_0x2bde32[_0xbb3a('0x44')]);return db[_0xbb3a('0x29')][_0xbb3a('0x45')](_0x1d796b)['then'](handleEntityNotFound(_0x1f9c83,null))[_0xbb3a('0x26')](respondWithResult(_0x1f9c83,null))[_0xbb3a('0x46')](handleError(_0x1f9c83,null));};exports[_0xbb3a('0x47')]=function(_0x3d89e1,_0x38756b){return db[_0xbb3a('0x29')][_0xbb3a('0x47')](_0x3d89e1[_0xbb3a('0x48')],{})[_0xbb3a('0x26')](function(_0x3d953e){var _0x2e890d=_0x3d89e1[_0xbb3a('0x49')][_0xbb3a('0x23')]({'plain':!![]});if(!_0x2e890d)throw new Error(_0xbb3a('0x4a'));if(_0x2e890d[_0xbb3a('0x4b')]==='user'){var _0x40be0f=_0x3d953e[_0xbb3a('0x23')]({'plain':!![]});var _0x4f38f6=_0xbb3a('0x24');return db[_0xbb3a('0x4c')][_0xbb3a('0x45')]({'where':{'name':_0x4f38f6,'userProfileId':_0x2e890d[_0xbb3a('0x4d')]},'raw':!![]})[_0xbb3a('0x26')](function(_0x54430f){if(_0x54430f&&_0x54430f[_0xbb3a('0x4e')]===0x0){return db[_0xbb3a('0x25')][_0xbb3a('0x47')]({'name':_0x40be0f[_0xbb3a('0x2f')],'resourceId':_0x40be0f['id'],'type':_0x54430f[_0xbb3a('0x2f')],'sectionId':_0x54430f['id']},{})[_0xbb3a('0x26')](function(){return _0x3d953e;});}else{return _0x3d953e;}})[_0xbb3a('0x46')](function(_0x6ed6ec){logger['error'](_0xbb3a('0x4f'),_0x6ed6ec);throw _0x6ed6ec;});}return _0x3d953e;})['then'](respondWithResult(_0x38756b,0xc9))['catch'](handleError(_0x38756b,null));};exports['update']=function(_0x41eb7d,_0x327f2f){if(_0x41eb7d[_0xbb3a('0x48')]['id']){delete _0x41eb7d['body']['id'];}return db[_0xbb3a('0x29')][_0xbb3a('0x45')]({'where':{'id':_0x41eb7d[_0xbb3a('0x41')]['id']}})['then'](handleEntityNotFound(_0x327f2f,null))[_0xbb3a('0x26')](saveUpdates(_0x41eb7d[_0xbb3a('0x48')],null))[_0xbb3a('0x26')](respondWithResult(_0x327f2f,null))[_0xbb3a('0x46')](handleError(_0x327f2f,null));};exports[_0xbb3a('0x22')]=function(_0x321b87,_0x1fb1fc){return db[_0xbb3a('0x29')][_0xbb3a('0x45')]({'where':{'id':_0x321b87['params']['id']}})[_0xbb3a('0x26')](handleEntityNotFound(_0x1fb1fc,null))[_0xbb3a('0x26')](removeEntity(_0x1fb1fc,null))[_0xbb3a('0x46')](handleError(_0x1fb1fc,null));};exports[_0xbb3a('0x50')]=function(_0x2eaeb4,_0x43de7b,_0x2bdfee){var _0x2a1c4e=require(_0xbb3a('0x51'));return db[_0xbb3a('0x29')]['find']({'where':{'id':_0x2eaeb4[_0xbb3a('0x41')]['id']},'raw':!![]})[_0xbb3a('0x26')](handleEntityNotFound(_0x43de7b,null))[_0xbb3a('0x26')](function(){_0x2a1c4e[_0xbb3a('0x50')](_0x2eaeb4[_0xbb3a('0x41')]['id']);})['then'](respondWithStatusCode(_0x43de7b,null))[_0xbb3a('0x46')](handleError(_0x43de7b,null));}; \ No newline at end of file +var _0xdf8b=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','then','get','Scheduler','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','Schedule','catch','show','params','includeAll','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','../../config/schedule','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis'];(function(_0x80d831,_0xf55728){var _0x4a6ab0=function(_0x5734e6){while(--_0x5734e6){_0x80d831['push'](_0x80d831['shift']());}};_0x4a6ab0(++_0xf55728);}(_0xdf8b,0x1e1));var _0xbdf8=function(_0x523414,_0x58a86a){_0x523414=_0x523414-0x0;var _0x354b87=_0xdf8b[_0x523414];return _0x354b87;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbdf8('0x0'));var zipdir=require(_0xbdf8('0x1'));var jsonpatch=require(_0xbdf8('0x2'));var rp=require('request-promise');var moment=require(_0xbdf8('0x3'));var BPromise=require(_0xbdf8('0x4'));var Mustache=require(_0xbdf8('0x5'));var util=require(_0xbdf8('0x6'));var path=require(_0xbdf8('0x7'));var sox=require(_0xbdf8('0x8'));var csv=require(_0xbdf8('0x9'));var ejs=require(_0xbdf8('0xa'));var fs=require('fs');var fs_extra=require(_0xbdf8('0xb'));var _=require(_0xbdf8('0xc'));var squel=require('squel');var crypto=require(_0xbdf8('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbdf8('0xe'));var toCsv=require(_0xbdf8('0x9'));var querystring=require(_0xbdf8('0xf'));var Papa=require('papaparse');var Redis=require(_0xbdf8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbdf8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbdf8('0x12'));var logger=require(_0xbdf8('0x13'))(_0xbdf8('0x14'));var utils=require('../../config/utils');var config=require(_0xbdf8('0x15'));var licenseUtil=require(_0xbdf8('0x16'));var db=require(_0xbdf8('0x17'))['db'];function respondWithStatusCode(_0x181b14,_0x3f80ad){_0x3f80ad=_0x3f80ad||0xcc;return function(_0x508c1b){if(_0x508c1b){return _0x181b14[_0xbdf8('0x18')](_0x3f80ad);}return _0x181b14[_0xbdf8('0x19')](_0x3f80ad)[_0xbdf8('0x1a')]();};}function respondWithResult(_0x2251a5,_0xe17e6d){_0xe17e6d=_0xe17e6d||0xc8;return function(_0x23133f){if(_0x23133f){return _0x2251a5[_0xbdf8('0x19')](_0xe17e6d)[_0xbdf8('0x1b')](_0x23133f);}};}function respondWithFilteredResult(_0x40d6d1,_0x33efb8){return function(_0x10ab5f){if(_0x10ab5f){var _0x135170=typeof _0x33efb8['offset']==='undefined'&&typeof _0x33efb8['limit']==='undefined';var _0x824b15=_0x10ab5f[_0xbdf8('0x1c')];var _0x526525=_0x135170?0x0:_0x33efb8[_0xbdf8('0x1d')];var _0x4839e3=_0x135170?_0x10ab5f[_0xbdf8('0x1c')]:_0x33efb8['offset']+_0x33efb8[_0xbdf8('0x1e')];var _0x581070;if(_0x4839e3>=_0x824b15){_0x4839e3=_0x824b15;_0x581070=0xc8;}else{_0x581070=0xce;}_0x40d6d1[_0xbdf8('0x19')](_0x581070);return _0x40d6d1[_0xbdf8('0x1f')]('Content-Range',_0x526525+'-'+_0x4839e3+'/'+_0x824b15)[_0xbdf8('0x1b')](_0x10ab5f);}return null;};}function patchUpdates(_0x3a2296){return function(_0x3cdba5){try{jsonpatch[_0xbdf8('0x20')](_0x3cdba5,_0x3a2296,!![]);}catch(_0x1507eb){return BPromise[_0xbdf8('0x21')](_0x1507eb);}return _0x3cdba5[_0xbdf8('0x22')]();};}function saveUpdates(_0x82b55c,_0x2a2f7f){return function(_0x586e94){if(_0x586e94){return _0x586e94[_0xbdf8('0x23')](_0x82b55c)['then'](function(_0x452dbe){return _0x452dbe;});}return null;};}function removeEntity(_0x447917,_0x4b6510){return function(_0x5e58f3){if(_0x5e58f3){return _0x5e58f3[_0xbdf8('0x24')]()[_0xbdf8('0x25')](function(){var _0x12a2d1=_0x5e58f3[_0xbdf8('0x26')]({'plain':!![]});var _0x2bc8f1=_0xbdf8('0x27');return db['UserProfileResource'][_0xbdf8('0x24')]({'where':{'type':_0x2bc8f1,'resourceId':_0x12a2d1['id']}})[_0xbdf8('0x25')](function(){return _0x5e58f3;});})['then'](function(){_0x447917['status'](0xcc)[_0xbdf8('0x1a')]();});}};}function handleEntityNotFound(_0x81171c,_0x2e75bc){return function(_0x58d371){if(!_0x58d371){_0x81171c[_0xbdf8('0x18')](0x194);}return _0x58d371;};}function handleError(_0x5b5165,_0x4798c9){_0x4798c9=_0x4798c9||0x1f4;return function(_0x1c6ddf){logger[_0xbdf8('0x28')](_0x1c6ddf[_0xbdf8('0x29')]);if(_0x1c6ddf['name']){delete _0x1c6ddf[_0xbdf8('0x2a')];}_0x5b5165[_0xbdf8('0x19')](_0x4798c9)[_0xbdf8('0x2b')](_0x1c6ddf);};}exports[_0xbdf8('0x2c')]=function(_0x223e23,_0xa8c943){var _0x4dd001={},_0x4c8f9e={},_0x4ca048={'count':0x0,'rows':[]};var _0x2f2da8=_[_0xbdf8('0x2d')](db['Schedule'][_0xbdf8('0x2e')],function(_0x309427){return{'name':_0x309427[_0xbdf8('0x2f')],'type':_0x309427[_0xbdf8('0x30')][_0xbdf8('0x31')]};});_0x4c8f9e['model']=_[_0xbdf8('0x2d')](_0x2f2da8,'name');_0x4c8f9e['query']=_[_0xbdf8('0x32')](_0x223e23[_0xbdf8('0x33')]);_0x4c8f9e[_0xbdf8('0x34')]=_['intersection'](_0x4c8f9e[_0xbdf8('0x35')],_0x4c8f9e[_0xbdf8('0x33')]);_0x4dd001[_0xbdf8('0x36')]=_[_0xbdf8('0x37')](_0x4c8f9e[_0xbdf8('0x35')],qs[_0xbdf8('0x38')](_0x223e23[_0xbdf8('0x33')]['fields']));_0x4dd001[_0xbdf8('0x36')]=_0x4dd001[_0xbdf8('0x36')]['length']?_0x4dd001[_0xbdf8('0x36')]:_0x4c8f9e['model'];if(!_0x223e23['query'][_0xbdf8('0x39')](_0xbdf8('0x3a'))){_0x4dd001[_0xbdf8('0x1e')]=qs['limit'](_0x223e23[_0xbdf8('0x33')][_0xbdf8('0x1e')]);_0x4dd001['offset']=qs[_0xbdf8('0x1d')](_0x223e23[_0xbdf8('0x33')][_0xbdf8('0x1d')]);}_0x4dd001[_0xbdf8('0x3b')]=qs[_0xbdf8('0x3c')](_0x223e23[_0xbdf8('0x33')]['sort']);_0x4dd001['where']=qs[_0xbdf8('0x34')](_[_0xbdf8('0x3d')](_0x223e23[_0xbdf8('0x33')],_0x4c8f9e[_0xbdf8('0x34')]),_0x2f2da8);if(_0x223e23[_0xbdf8('0x33')]['filter']){_0x4dd001[_0xbdf8('0x3e')]=_[_0xbdf8('0x3f')](_0x4dd001[_0xbdf8('0x3e')],{'$or':_['map'](_0x2f2da8,function(_0x3609d9){if(_0x3609d9['type']!==_0xbdf8('0x40')){var _0x5a87ff={};_0x5a87ff[_0x3609d9[_0xbdf8('0x2a')]]={'$like':'%'+_0x223e23[_0xbdf8('0x33')][_0xbdf8('0x41')]+'%'};return _0x5a87ff;}})});}_0x4dd001=_['merge']({},_0x4dd001,_0x223e23['options']);var _0x181219={'where':_0x4dd001['where']};return db[_0xbdf8('0x42')]['count'](_0x181219)[_0xbdf8('0x25')](function(_0x16b921){_0x4ca048[_0xbdf8('0x1c')]=_0x16b921;if(_0x223e23[_0xbdf8('0x33')]['includeAll']){_0x4dd001['include']=[{'all':!![]}];}return db[_0xbdf8('0x42')]['findAll'](_0x4dd001);})[_0xbdf8('0x25')](function(_0x525229){_0x4ca048['rows']=_0x525229;return _0x4ca048;})['then'](respondWithFilteredResult(_0xa8c943,_0x4dd001))[_0xbdf8('0x43')](handleError(_0xa8c943,null));};exports[_0xbdf8('0x44')]=function(_0x4693c4,_0x355096){var _0x5ce7e4={'raw':![],'where':{'id':_0x4693c4[_0xbdf8('0x45')]['id']}},_0x4cb6a8={};_0x4cb6a8[_0xbdf8('0x35')]=_[_0xbdf8('0x32')](db[_0xbdf8('0x42')][_0xbdf8('0x2e')]);_0x4cb6a8[_0xbdf8('0x33')]=_[_0xbdf8('0x32')](_0x4693c4[_0xbdf8('0x33')]);_0x4cb6a8[_0xbdf8('0x34')]=_[_0xbdf8('0x37')](_0x4cb6a8[_0xbdf8('0x35')],_0x4cb6a8[_0xbdf8('0x33')]);_0x5ce7e4[_0xbdf8('0x36')]=_[_0xbdf8('0x37')](_0x4cb6a8[_0xbdf8('0x35')],qs[_0xbdf8('0x38')](_0x4693c4[_0xbdf8('0x33')]['fields']));_0x5ce7e4[_0xbdf8('0x36')]=_0x5ce7e4['attributes']['length']?_0x5ce7e4['attributes']:_0x4cb6a8[_0xbdf8('0x35')];if(_0x4693c4[_0xbdf8('0x33')][_0xbdf8('0x46')]){_0x5ce7e4[_0xbdf8('0x47')]=[{'all':!![]}];}_0x5ce7e4=_['merge']({},_0x5ce7e4,_0x4693c4['options']);return db[_0xbdf8('0x42')][_0xbdf8('0x48')](_0x5ce7e4)['then'](handleEntityNotFound(_0x355096,null))['then'](respondWithResult(_0x355096,null))[_0xbdf8('0x43')](handleError(_0x355096,null));};exports[_0xbdf8('0x49')]=function(_0x567ad9,_0x4e6988){return db[_0xbdf8('0x42')]['create'](_0x567ad9['body'],{})[_0xbdf8('0x25')](function(_0x18c57f){var _0x595bd6=_0x567ad9[_0xbdf8('0x4a')][_0xbdf8('0x26')]({'plain':!![]});if(!_0x595bd6)throw new Error(_0xbdf8('0x4b'));if(_0x595bd6['role']===_0xbdf8('0x4a')){var _0x490928=_0x18c57f[_0xbdf8('0x26')]({'plain':!![]});var _0x5e964f=_0xbdf8('0x27');return db[_0xbdf8('0x4c')][_0xbdf8('0x48')]({'where':{'name':_0x5e964f,'userProfileId':_0x595bd6[_0xbdf8('0x4d')]},'raw':!![]})['then'](function(_0x238953){if(_0x238953&&_0x238953['autoAssociation']===0x0){return db[_0xbdf8('0x4e')]['create']({'name':_0x490928[_0xbdf8('0x2a')],'resourceId':_0x490928['id'],'type':_0x238953[_0xbdf8('0x2a')],'sectionId':_0x238953['id']},{})[_0xbdf8('0x25')](function(){return _0x18c57f;});}else{return _0x18c57f;}})[_0xbdf8('0x43')](function(_0x2fbdc4){logger[_0xbdf8('0x28')](_0xbdf8('0x4f'),_0x2fbdc4);throw _0x2fbdc4;});}return _0x18c57f;})[_0xbdf8('0x25')](respondWithResult(_0x4e6988,0xc9))[_0xbdf8('0x43')](handleError(_0x4e6988,null));};exports[_0xbdf8('0x23')]=function(_0x3889b8,_0x41bf88){if(_0x3889b8[_0xbdf8('0x50')]['id']){delete _0x3889b8['body']['id'];}return db['Schedule'][_0xbdf8('0x48')]({'where':{'id':_0x3889b8[_0xbdf8('0x45')]['id']}})['then'](handleEntityNotFound(_0x41bf88,null))[_0xbdf8('0x25')](saveUpdates(_0x3889b8['body'],null))[_0xbdf8('0x25')](respondWithResult(_0x41bf88,null))[_0xbdf8('0x43')](handleError(_0x41bf88,null));};exports[_0xbdf8('0x24')]=function(_0x3724d5,_0x3597e3){return db[_0xbdf8('0x42')][_0xbdf8('0x48')]({'where':{'id':_0x3724d5[_0xbdf8('0x45')]['id']}})[_0xbdf8('0x25')](handleEntityNotFound(_0x3597e3,null))[_0xbdf8('0x25')](removeEntity(_0x3597e3,null))[_0xbdf8('0x43')](handleError(_0x3597e3,null));};exports[_0xbdf8('0x51')]=function(_0x59f3ab,_0x371502,_0x4794fb){var _0x4c5085=require(_0xbdf8('0x52'));return db[_0xbdf8('0x42')][_0xbdf8('0x48')]({'where':{'id':_0x59f3ab[_0xbdf8('0x45')]['id']},'raw':!![]})[_0xbdf8('0x25')](handleEntityNotFound(_0x371502,null))[_0xbdf8('0x25')](function(){_0x4c5085['run'](_0x59f3ab['params']['id']);})[_0xbdf8('0x25')](respondWithStatusCode(_0x371502,null))[_0xbdf8('0x43')](handleError(_0x371502,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 52fceaa..3196ea5 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 _0x79d6=['moment','bluebird','path','rimraf','./schedule.attributes','exports','Schedule','tools_schedules','lodash','../../config/logger'];(function(_0x42b79e,_0x383ea1){var _0x4b599c=function(_0x422cf7){while(--_0x422cf7){_0x42b79e['push'](_0x42b79e['shift']());}};_0x4b599c(++_0x383ea1);}(_0x79d6,0xa8));var _0x679d=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x79d6[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x679d('0x0'));var util=require('util');var logger=require(_0x679d('0x1'))('api');var moment=require(_0x679d('0x2'));var BPromise=require(_0x679d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x679d('0x4'));var rimraf=require(_0x679d('0x5'));var config=require('../../config/environment');var attributes=require(_0x679d('0x6'));module[_0x679d('0x7')]=function(_0x28fa25,_0x5cfe09){return _0x28fa25['define'](_0x679d('0x8'),attributes,{'tableName':_0x679d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c69=['bluebird','request-promise','rimraf','../../config/environment','./schedule.attributes','define','lodash','util','../../config/logger','moment'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x4c69,0xec));var _0x94c6=function(_0x5093cf,_0x43ce3c){_0x5093cf=_0x5093cf-0x0;var _0x32e80f=_0x4c69[_0x5093cf];return _0x32e80f;};'use strict';var _=require(_0x94c6('0x0'));var util=require(_0x94c6('0x1'));var logger=require(_0x94c6('0x2'))('api');var moment=require(_0x94c6('0x3'));var BPromise=require(_0x94c6('0x4'));var rp=require(_0x94c6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x94c6('0x6'));var config=require(_0x94c6('0x7'));var attributes=require(_0x94c6('0x8'));module['exports']=function(_0x1b2cf4,_0x5db1ed){return _0x1b2cf4[_0x94c6('0x9')]('Schedule',attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index df86401..84ef214 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 _0xdebc=['error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3cc7c2,_0x3c0e00){var _0x30fb86=function(_0x27fff7){while(--_0x27fff7){_0x3cc7c2['push'](_0x3cc7c2['shift']());}};_0x30fb86(++_0x3c0e00);}(_0xdebc,0xc1));var _0xcdeb=function(_0x5e946d,_0x4d1d22){_0x5e946d=_0x5e946d-0x0;var _0x3ceb9b=_0xdebc[_0x5e946d];return _0x3ceb9b;};'use strict';var _=require(_0xcdeb('0x0'));var util=require(_0xcdeb('0x1'));var moment=require(_0xcdeb('0x2'));var BPromise=require('bluebird');var rs=require(_0xcdeb('0x3'));var fs=require('fs');var Redis=require(_0xcdeb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcdeb('0x5'));var logger=require('../../config/logger')(_0xcdeb('0x6'));var config=require(_0xcdeb('0x7'));var jayson=require(_0xcdeb('0x8'));var client=jayson['client'][_0xcdeb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47af2e,_0x46967a,_0x3419e1){return new BPromise(function(_0x1dcad3,_0x232f3f){return client['request'](_0x47af2e,_0x3419e1)[_0xcdeb('0xa')](function(_0x230ed8){logger[_0xcdeb('0xb')](_0xcdeb('0xc'),_0x46967a,_0xcdeb('0xd'));logger[_0xcdeb('0xe')](_0xcdeb('0xf'),_0x46967a,_0xcdeb('0xd'),JSON[_0xcdeb('0x10')](_0x230ed8));if(_0x230ed8[_0xcdeb('0x11')]){if(_0x230ed8['error']['code']===0x1f4){logger[_0xcdeb('0x11')](_0xcdeb('0xc'),_0x46967a,_0x230ed8[_0xcdeb('0x11')][_0xcdeb('0x12')]);return _0x232f3f(_0x230ed8['error'][_0xcdeb('0x12')]);}logger[_0xcdeb('0x11')](_0xcdeb('0xc'),_0x46967a,_0x230ed8[_0xcdeb('0x11')]['message']);return _0x1dcad3(_0x230ed8[_0xcdeb('0x11')][_0xcdeb('0x12')]);}else{logger[_0xcdeb('0xb')]('Schedule,\x20%s,\x20%s',_0x46967a,'request\x20sent');_0x1dcad3(_0x230ed8[_0xcdeb('0x13')][_0xcdeb('0x12')]);}})[_0xcdeb('0x14')](function(_0x1c45cf){logger[_0xcdeb('0x11')](_0xcdeb('0xc'),_0x46967a,_0x1c45cf);_0x232f3f(_0x1c45cf);});});} \ No newline at end of file +var _0xd3da=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','randomstring'];(function(_0x1a595a,_0x263824){var _0x33f008=function(_0x1e2f9c){while(--_0x1e2f9c){_0x1a595a['push'](_0x1a595a['shift']());}};_0x33f008(++_0x263824);}(_0xd3da,0x7b));var _0xad3d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd3da[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xad3d('0x0'));var util=require(_0xad3d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xad3d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad3d('0x3'))['db'];var utils=require(_0xad3d('0x4'));var logger=require(_0xad3d('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xad3d('0x6'));var client=jayson[_0xad3d('0x7')][_0xad3d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x401f47,_0x33fc81,_0x4feec2){return new BPromise(function(_0x3eda19,_0x6b94c5){return client[_0xad3d('0x9')](_0x401f47,_0x4feec2)[_0xad3d('0xa')](function(_0x24d485){logger[_0xad3d('0xb')](_0xad3d('0xc'),_0x33fc81,'request\x20sent');logger[_0xad3d('0xd')](_0xad3d('0xe'),_0x33fc81,_0xad3d('0xf'),JSON[_0xad3d('0x10')](_0x24d485));if(_0x24d485[_0xad3d('0x11')]){if(_0x24d485[_0xad3d('0x11')]['code']===0x1f4){logger['error']('Schedule,\x20%s,\x20%s',_0x33fc81,_0x24d485[_0xad3d('0x11')][_0xad3d('0x12')]);return _0x6b94c5(_0x24d485[_0xad3d('0x11')][_0xad3d('0x12')]);}logger[_0xad3d('0x11')]('Schedule,\x20%s,\x20%s',_0x33fc81,_0x24d485['error'][_0xad3d('0x12')]);return _0x3eda19(_0x24d485[_0xad3d('0x11')][_0xad3d('0x12')]);}else{logger['info'](_0xad3d('0xc'),_0x33fc81,_0xad3d('0xf'));_0x3eda19(_0x24d485[_0xad3d('0x13')][_0xad3d('0x12')]);}})[_0xad3d('0x14')](function(_0x991ca0){logger['error']('Schedule,\x20%s,\x20%s',_0x33fc81,_0x991ca0);_0x6b94c5(_0x991ca0);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index b1daa6d..8ec7d3a 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 _0xc86d=['/describe','describe','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index'];(function(_0x32663d,_0x454b23){var _0x1a4ad0=function(_0x53dabc){while(--_0x53dabc){_0x32663d['push'](_0x32663d['shift']());}};_0x1a4ad0(++_0x454b23);}(_0xc86d,0x10a));var _0xdc86=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xc86d[_0x16d10f];return _0x50c823;};'use strict';var multer=require(_0xdc86('0x0'));var util=require(_0xdc86('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdc86('0x2'));var router=express['Router']();var fs_extra=require(_0xdc86('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xdc86('0x4'));var config=require(_0xdc86('0x5'));var controller=require(_0xdc86('0x6'));router[_0xdc86('0x7')]('/',auth[_0xdc86('0x8')](),controller[_0xdc86('0x9')]);router[_0xdc86('0x7')](_0xdc86('0xa'),auth[_0xdc86('0x8')](),controller[_0xdc86('0xb')]);router[_0xdc86('0x7')](_0xdc86('0xc'),auth['isAuthenticated'](),controller[_0xdc86('0xd')]);router[_0xdc86('0x7')](_0xdc86('0xe'),auth[_0xdc86('0x8')](),controller[_0xdc86('0xf')]);router[_0xdc86('0x10')]('/',auth['isAuthenticated'](),controller[_0xdc86('0x11')]);router[_0xdc86('0x12')](_0xdc86('0xc'),auth[_0xdc86('0x8')](),controller[_0xdc86('0x13')]);router[_0xdc86('0x14')](_0xdc86('0xc'),auth[_0xdc86('0x8')](),controller[_0xdc86('0x15')]);module[_0xdc86('0x16')]=router; \ No newline at end of file +var _0x0d63=['Router','fs-extra','../../components/auth/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','post','create','put','update','destroy','exports','multer','util','path','express'];(function(_0xc73090,_0xa38942){var _0x98d8bf=function(_0x17e906){while(--_0x17e906){_0xc73090['push'](_0xc73090['shift']());}};_0x98d8bf(++_0xa38942);}(_0x0d63,0x1b1));var _0x30d6=function(_0x13415d,_0x2c36dd){_0x13415d=_0x13415d-0x0;var _0x348280=_0x0d63[_0x13415d];return _0x348280;};'use strict';var multer=require(_0x30d6('0x0'));var util=require(_0x30d6('0x1'));var path=require(_0x30d6('0x2'));var timeout=require('connect-timeout');var express=require(_0x30d6('0x3'));var router=express[_0x30d6('0x4')]();var fs_extra=require(_0x30d6('0x5'));var auth=require(_0x30d6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x30d6('0x7'));var controller=require(_0x30d6('0x8'));router[_0x30d6('0x9')]('/',auth[_0x30d6('0xa')](),controller['index']);router[_0x30d6('0x9')](_0x30d6('0xb'),auth[_0x30d6('0xa')](),controller[_0x30d6('0xc')]);router[_0x30d6('0x9')](_0x30d6('0xd'),auth[_0x30d6('0xa')](),controller[_0x30d6('0xe')]);router['get'](_0x30d6('0xf'),auth[_0x30d6('0xa')](),controller[_0x30d6('0x10')]);router[_0x30d6('0x11')]('/',auth[_0x30d6('0xa')](),controller[_0x30d6('0x12')]);router[_0x30d6('0x13')]('/:id',auth[_0x30d6('0xa')](),controller[_0x30d6('0x14')]);router['delete'](_0x30d6('0xd'),auth[_0x30d6('0xa')](),controller[_0x30d6('0x15')]);module[_0x30d6('0x16')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 0e88331..3a9b247 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 _0x5532=['INTEGER','startedAt','subtract','duration','DATE','format','closedAt','MM-DD-YYYY\x20HH:mm','createdAt','toString','updatedAt','sequelize','moment','path','exports','getDataValue','value','extname','STRING','replace','setDataValue'];(function(_0x3701c8,_0x5b0b4f){var _0x11397c=function(_0x11919b){while(--_0x11919b){_0x3701c8['push'](_0x3701c8['shift']());}};_0x11397c(++_0x5b0b4f);}(_0x5532,0x19a));var _0x2553=function(_0x189b62,_0xe44b06){_0x189b62=_0x189b62-0x0;var _0xcd1405=_0x5532[_0x189b62];return _0xcd1405;};'use strict';var Sequelize=require(_0x2553('0x0'));var moment=require(_0x2553('0x1'));var path=require(_0x2553('0x2'));var config=require('../../config/environment');module[_0x2553('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x2553('0x4')](_0x2553('0x5'))?path[_0x2553('0x6')](this['getDataValue'](_0x2553('0x5'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x2553('0x7')],'set':function(_0x2d718e){var _0x568778=_0x2d718e[_0x2553('0x8')](/\\/g,'/');this[_0x2553('0x9')](_0x2553('0x5'),_0x568778);}},'rating':{'type':Sequelize[_0x2553('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x2553('0xa')],'set':function(_0x183d20){this[_0x2553('0x9')](_0x2553('0xb'),moment()[_0x2553('0xc')](_0x183d20,'ms'));this[_0x2553('0x9')]('closedAt',moment());this[_0x2553('0x9')](_0x2553('0xd'),_0x183d20);}},'startedAt':{'type':Sequelize[_0x2553('0xe')],'get':function(){return moment(this['getDataValue'](_0x2553('0xb')))[_0x2553('0xf')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'closedAt':{'type':Sequelize[_0x2553('0xe')],'get':function(){return moment(this['getDataValue'](_0x2553('0x10')))[_0x2553('0xf')](_0x2553('0x11'))['toString']();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x2553('0x4')](_0x2553('0x12')))[_0x2553('0xf')](_0x2553('0x11'))[_0x2553('0x13')]();}},'updatedAt':{'type':Sequelize[_0x2553('0xe')],'get':function(){return moment(this['getDataValue'](_0x2553('0x14')))[_0x2553('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x2553('0x13')]();}}}; \ No newline at end of file +var _0xf1f9=['moment','path','../../config/environment','exports','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','MM-DD-YYYY\x20HH:mm','format','toString','createdAt','updatedAt','sequelize'];(function(_0x24325d,_0x3bf645){var _0x47b231=function(_0x3d3b3e){while(--_0x3d3b3e){_0x24325d['push'](_0x24325d['shift']());}};_0x47b231(++_0x3bf645);}(_0xf1f9,0x1cd));var _0x9f1f=function(_0x1c9ad3,_0x4b36fc){_0x1c9ad3=_0x1c9ad3-0x0;var _0x4d6a26=_0xf1f9[_0x1c9ad3];return _0x4d6a26;};'use strict';var Sequelize=require(_0x9f1f('0x0'));var moment=require(_0x9f1f('0x1'));var path=require(_0x9f1f('0x2'));var config=require(_0x9f1f('0x3'));module[_0x9f1f('0x4')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x9f1f('0x5')](_0x9f1f('0x6'))?path[_0x9f1f('0x7')](this[_0x9f1f('0x5')](_0x9f1f('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x9f1f('0x8')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING'],'set':function(_0x363d26){var _0x373b98=_0x363d26[_0x9f1f('0x9')](/\\/g,'/');this[_0x9f1f('0xa')]('value',_0x373b98);}},'rating':{'type':Sequelize[_0x9f1f('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x9f1f('0xb')],'set':function(_0x3efac2){this[_0x9f1f('0xa')](_0x9f1f('0xc'),moment()[_0x9f1f('0xd')](_0x3efac2,'ms'));this[_0x9f1f('0xa')](_0x9f1f('0xe'),moment());this['setDataValue'](_0x9f1f('0xf'),_0x3efac2);}},'startedAt':{'type':Sequelize[_0x9f1f('0x10')],'get':function(){return moment(this[_0x9f1f('0x5')]('startedAt'))['format'](_0x9f1f('0x11'))['toString']();}},'closedAt':{'type':Sequelize[_0x9f1f('0x10')],'get':function(){return moment(this[_0x9f1f('0x5')](_0x9f1f('0xe')))[_0x9f1f('0x12')](_0x9f1f('0x11'))[_0x9f1f('0x13')]();}},'createdAt':{'type':Sequelize[_0x9f1f('0x10')],'get':function(){return moment(this['getDataValue'](_0x9f1f('0x14')))['format'](_0x9f1f('0x11'))[_0x9f1f('0x13')]();}},'updatedAt':{'type':Sequelize[_0x9f1f('0x10')],'get':function(){return moment(this[_0x9f1f('0x5')](_0x9f1f('0x15')))['format'](_0x9f1f('0x11'))[_0x9f1f('0x13')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index af67c6f..b92ce4f 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 _0xb4c7=['rawAttributes','fieldName','type','format','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','keys','include','find','create','body','duration','createdAt','closedAt','value','describe','../../components/encryptor','uniqueid','params','join','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','root','ValidationError','download','filename','extname','unlink','message','Not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','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','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ScreenRecording'];(function(_0x2ca9d4,_0x51d5c6){var _0x258956=function(_0x47a0e5){while(--_0x47a0e5){_0x2ca9d4['push'](_0x2ca9d4['shift']());}};_0x258956(++_0x51d5c6);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x2777c6,_0x4dd533){_0x2777c6=_0x2777c6-0x0;var _0x511622=_0xb4c7[_0x2777c6];return _0x511622;};'use strict';var emlformat=require(_0x7b4c('0x0'));var rimraf=require(_0x7b4c('0x1'));var zipdir=require(_0x7b4c('0x2'));var jsonpatch=require(_0x7b4c('0x3'));var rp=require(_0x7b4c('0x4'));var moment=require('moment');var BPromise=require(_0x7b4c('0x5'));var Mustache=require(_0x7b4c('0x6'));var util=require(_0x7b4c('0x7'));var path=require(_0x7b4c('0x8'));var sox=require(_0x7b4c('0x9'));var csv=require('to-csv');var ejs=require(_0x7b4c('0xa'));var fs=require('fs');var fs_extra=require(_0x7b4c('0xb'));var _=require(_0x7b4c('0xc'));var squel=require('squel');var crypto=require(_0x7b4c('0xd'));var jsforce=require(_0x7b4c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7b4c('0xf'));var querystring=require(_0x7b4c('0x10'));var Papa=require(_0x7b4c('0x11'));var Redis=require(_0x7b4c('0x12'));var authService=require(_0x7b4c('0x13'));var qs=require(_0x7b4c('0x14'));var as=require(_0x7b4c('0x15'));var hardwareService=require(_0x7b4c('0x16'));var logger=require(_0x7b4c('0x17'))(_0x7b4c('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7b4c('0x19'));var db=require(_0x7b4c('0x1a'))['db'];function respondWithStatusCode(_0x38656b,_0x1722ad){_0x1722ad=_0x1722ad||0xcc;return function(_0x3e1558){if(_0x3e1558){return _0x38656b[_0x7b4c('0x1b')](_0x1722ad);}return _0x38656b[_0x7b4c('0x1c')](_0x1722ad)[_0x7b4c('0x1d')]();};}function respondWithResult(_0x25b90b,_0x387488){_0x387488=_0x387488||0xc8;return function(_0x593a19){if(_0x593a19){return _0x25b90b[_0x7b4c('0x1c')](_0x387488)[_0x7b4c('0x1e')](_0x593a19);}};}function respondWithFilteredResult(_0xdc71cd,_0x2a0e2f){return function(_0xa0a812){if(_0xa0a812){var _0x2471b3=typeof _0x2a0e2f[_0x7b4c('0x1f')]===_0x7b4c('0x20')&&typeof _0x2a0e2f['limit']===_0x7b4c('0x20');var _0xe71d88=_0xa0a812[_0x7b4c('0x21')];var _0x36c02a=_0x2471b3?0x0:_0x2a0e2f['offset'];var _0x3ce10c=_0x2471b3?_0xa0a812[_0x7b4c('0x21')]:_0x2a0e2f[_0x7b4c('0x1f')]+_0x2a0e2f[_0x7b4c('0x22')];var _0x2d4c72;if(_0x3ce10c>=_0xe71d88){_0x3ce10c=_0xe71d88;_0x2d4c72=0xc8;}else{_0x2d4c72=0xce;}_0xdc71cd[_0x7b4c('0x1c')](_0x2d4c72);return _0xdc71cd[_0x7b4c('0x23')](_0x7b4c('0x24'),_0x36c02a+'-'+_0x3ce10c+'/'+_0xe71d88)[_0x7b4c('0x1e')](_0xa0a812);}return null;};}function patchUpdates(_0x55e3df){return function(_0x1f06ec){try{jsonpatch[_0x7b4c('0x25')](_0x1f06ec,_0x55e3df,!![]);}catch(_0x11996d){return BPromise[_0x7b4c('0x26')](_0x11996d);}return _0x1f06ec[_0x7b4c('0x27')]();};}function saveUpdates(_0x168ac9,_0x176704){return function(_0x3d4826){if(_0x3d4826){return _0x3d4826[_0x7b4c('0x28')](_0x168ac9)[_0x7b4c('0x29')](function(_0x5eec1e){return _0x5eec1e;});}return null;};}function removeEntity(_0x45438c,_0x4350c9){return function(_0x276271){if(_0x276271){return _0x276271[_0x7b4c('0x2a')]()[_0x7b4c('0x29')](function(){_0x45438c[_0x7b4c('0x1c')](0xcc)[_0x7b4c('0x1d')]();});}};}function handleEntityNotFound(_0x459eb4,_0x1f311e){return function(_0x1a69db){if(!_0x1a69db){_0x459eb4[_0x7b4c('0x1b')](0x194);}return _0x1a69db;};}function handleError(_0x257da2,_0x316e5f){_0x316e5f=_0x316e5f||0x1f4;return function(_0x501f75){logger[_0x7b4c('0x2b')](_0x501f75[_0x7b4c('0x2c')]);if(_0x501f75[_0x7b4c('0x2d')]){delete _0x501f75[_0x7b4c('0x2d')];}_0x257da2[_0x7b4c('0x1c')](_0x316e5f)[_0x7b4c('0x2e')](_0x501f75);};}exports[_0x7b4c('0x2f')]=function(_0x2552f9,_0x3e4a46){var _0x9a799b={},_0x3585cd={},_0x130ace={'count':0x0,'rows':[]};var _0x3544bc=_[_0x7b4c('0x30')](db[_0x7b4c('0x31')][_0x7b4c('0x32')],function(_0x1d0724){return{'name':_0x1d0724[_0x7b4c('0x33')],'type':_0x1d0724[_0x7b4c('0x34')]['key']};});_0x3585cd['model']=_['differenceBy'](_[_0x7b4c('0x30')](_0x3544bc,_0x7b4c('0x2d')),[_0x7b4c('0x35')]);_0x3585cd[_0x7b4c('0x36')]=_['keys'](_0x2552f9[_0x7b4c('0x36')]);_0x3585cd[_0x7b4c('0x37')]=_['intersection'](_0x3585cd[_0x7b4c('0x38')],_0x3585cd['query']);_0x9a799b[_0x7b4c('0x39')]=_[_0x7b4c('0x3a')](_0x3585cd[_0x7b4c('0x38')],qs['fields'](_0x2552f9[_0x7b4c('0x36')][_0x7b4c('0x3b')]));_0x9a799b['attributes']=_0x9a799b[_0x7b4c('0x39')][_0x7b4c('0x3c')]?_0x9a799b[_0x7b4c('0x39')]:_0x3585cd[_0x7b4c('0x38')];if(!_0x2552f9['query']['hasOwnProperty'](_0x7b4c('0x3d'))){_0x9a799b[_0x7b4c('0x22')]=qs['limit'](_0x2552f9[_0x7b4c('0x36')]['limit']);_0x9a799b['offset']=qs[_0x7b4c('0x1f')](_0x2552f9[_0x7b4c('0x36')][_0x7b4c('0x1f')]);}_0x9a799b[_0x7b4c('0x3e')]=qs['sort'](_0x2552f9[_0x7b4c('0x36')][_0x7b4c('0x3f')]);_0x9a799b[_0x7b4c('0x40')]=qs[_0x7b4c('0x37')](_[_0x7b4c('0x41')](_0x2552f9[_0x7b4c('0x36')],_0x3585cd[_0x7b4c('0x37')]),_0x3544bc);if(_0x2552f9['query']['filter']){_0x9a799b[_0x7b4c('0x40')]=_[_0x7b4c('0x42')](_0x9a799b[_0x7b4c('0x40')],{'$or':_[_0x7b4c('0x30')](_0x3544bc,function(_0xb8486d){if(_0xb8486d['type']!==_0x7b4c('0x43')){var _0x902367={};_0x902367[_0xb8486d[_0x7b4c('0x2d')]]={'$like':'%'+_0x2552f9[_0x7b4c('0x36')][_0x7b4c('0x44')]+'%'};return _0x902367;}})});}_0x9a799b=_[_0x7b4c('0x42')]({},_0x9a799b,_0x2552f9[_0x7b4c('0x45')]);var _0x1080fc={'where':_0x9a799b[_0x7b4c('0x40')]};return db['ScreenRecording'][_0x7b4c('0x21')](_0x1080fc)['then'](function(_0x2a3a74){_0x130ace['count']=_0x2a3a74;if(_0x2552f9[_0x7b4c('0x36')][_0x7b4c('0x46')]){_0x9a799b['include']=[{'all':!![]}];}return db['ScreenRecording'][_0x7b4c('0x47')](_0x9a799b);})[_0x7b4c('0x29')](function(_0x1def44){_0x130ace[_0x7b4c('0x48')]=_0x1def44;return _0x130ace;})['then'](respondWithFilteredResult(_0x3e4a46,_0x9a799b))[_0x7b4c('0x49')](handleError(_0x3e4a46,null));};exports[_0x7b4c('0x4a')]=function(_0x100774,_0x5d4ed8){var _0x45ad59={'raw':![],'where':{'id':_0x100774['params']['id']}},_0x4b4757={};_0x4b4757[_0x7b4c('0x38')]=_['keys'](db[_0x7b4c('0x31')][_0x7b4c('0x32')]);_0x4b4757[_0x7b4c('0x36')]=_[_0x7b4c('0x4b')](_0x100774[_0x7b4c('0x36')]);_0x4b4757[_0x7b4c('0x37')]=_[_0x7b4c('0x3a')](_0x4b4757[_0x7b4c('0x38')],_0x4b4757[_0x7b4c('0x36')]);_0x45ad59['attributes']=_[_0x7b4c('0x3a')](_0x4b4757['model'],qs['fields'](_0x100774[_0x7b4c('0x36')][_0x7b4c('0x3b')]));_0x45ad59['attributes']=_0x45ad59['attributes'][_0x7b4c('0x3c')]?_0x45ad59[_0x7b4c('0x39')]:_0x4b4757[_0x7b4c('0x38')];if(_0x100774[_0x7b4c('0x36')][_0x7b4c('0x46')]){_0x45ad59[_0x7b4c('0x4c')]=[{'all':!![]}];}_0x45ad59=_[_0x7b4c('0x42')]({},_0x45ad59,_0x100774[_0x7b4c('0x45')]);return db['ScreenRecording'][_0x7b4c('0x4d')](_0x45ad59)[_0x7b4c('0x29')](handleEntityNotFound(_0x5d4ed8,null))[_0x7b4c('0x29')](respondWithResult(_0x5d4ed8,null))[_0x7b4c('0x49')](handleError(_0x5d4ed8,null));};exports[_0x7b4c('0x4e')]=function(_0x379f15,_0x11a6f9){return db[_0x7b4c('0x31')][_0x7b4c('0x4e')](_0x379f15['body'],{})['then'](respondWithResult(_0x11a6f9,0xc9))[_0x7b4c('0x49')](handleError(_0x11a6f9,null));};exports[_0x7b4c('0x28')]=function(_0x97eadf,_0x5d4192){if(_0x97eadf[_0x7b4c('0x4f')]['id']){delete _0x97eadf[_0x7b4c('0x4f')]['id'];}delete _0x97eadf['body'][_0x7b4c('0x50')];delete _0x97eadf['body'][_0x7b4c('0x51')];delete _0x97eadf['body'][_0x7b4c('0x52')];delete _0x97eadf['body'][_0x7b4c('0x53')];return db[_0x7b4c('0x31')]['find']({'where':{'id':_0x97eadf['params']['id']}})[_0x7b4c('0x29')](handleEntityNotFound(_0x5d4192,null))[_0x7b4c('0x29')](saveUpdates(_0x97eadf[_0x7b4c('0x4f')],null))['then'](respondWithResult(_0x5d4192,null))['catch'](handleError(_0x5d4192,null));};exports[_0x7b4c('0x54')]=function(_0x1c118a,_0x4cbf1b){return db['ScreenRecording'][_0x7b4c('0x54')]()[_0x7b4c('0x29')](respondWithResult(_0x4cbf1b,null))[_0x7b4c('0x49')](handleError(_0x4cbf1b,null));};exports['download']=function(_0x1d017d,_0x2f009a,_0x4aaf57){var _0x484e80=require(_0x7b4c('0x55'));var _0x4d8491=![];var _0x59db20={};if(_0x1d017d[_0x7b4c('0x36')]['type']&&_0x1d017d['query'][_0x7b4c('0x34')]===_0x7b4c('0x56')){_0x59db20[_0x7b4c('0x56')]=_0x1d017d[_0x7b4c('0x57')]['id'];}else{_0x59db20['id']=_0x1d017d['params']['id'];}return db['ScreenRecording'][_0x7b4c('0x4d')]({'where':_0x59db20,'attributes':['id',_0x7b4c('0x53')],'raw':!![]})[_0x7b4c('0x29')](handleEntityNotFound(_0x2f009a,null))['then'](function(_0x255262){if(_0x255262){var _0x3d81fb=path[_0x7b4c('0x58')](config['root'],_0x7b4c('0x59'),_0x255262[_0x7b4c('0x53')]);var _0x529803=util[_0x7b4c('0x35')](_0x7b4c('0x5a'),_0x3d81fb);if(fs[_0x7b4c('0x5b')](_0x529803)){_0x4d8491=!![];return _0x484e80[_0x7b4c('0x5c')](_0x529803,_0x3d81fb,config[_0x7b4c('0x5d')][_0x7b4c('0x5e')])[_0x7b4c('0x29')](function(){return _0x255262;});}return _0x255262;}})['then'](function(_0x4443d0){if(_0x4443d0){var _0x2dc79a=path['join'](config[_0x7b4c('0x5f')],_0x7b4c('0x59'),_0x4443d0[_0x7b4c('0x53')]);if(!fs[_0x7b4c('0x5b')](_0x2dc79a)){throw new db['Sequelize'][(_0x7b4c('0x60'))]('ScreenRecording\x20not\x20found');}if(_0x4443d0['filename']){return _0x2f009a[_0x7b4c('0x61')](_0x2dc79a,_0x4443d0[_0x7b4c('0x62')]+path[_0x7b4c('0x63')](_0x2dc79a),function(){if(_0x4d8491){fs[_0x7b4c('0x64')](_0x2dc79a);}});}else{return _0x2f009a[_0x7b4c('0x61')](_0x2dc79a,function(_0x5b24f6){if(_0x4d8491){fs['unlink'](_0x2dc79a);}});}}})[_0x7b4c('0x49')](function(_0x3c84af){if(_0x3c84af[_0x7b4c('0x65')]==='ScreenRecording\x20not\x20found'){_0x2f009a[_0x7b4c('0x1c')](0x194)[_0x7b4c('0x2e')](_0x7b4c('0x66'));}else{return handleError(_0x2f009a,null);}});};exports['destroy']=function(_0x222b47,_0x3b2144){return db[_0x7b4c('0x31')]['find']({'where':{'id':_0x222b47[_0x7b4c('0x57')]['id']}})[_0x7b4c('0x29')](function(_0x4ac03e){if(_[_0x7b4c('0x67')](_0x4ac03e)){throw new ReferenceError('Entity\x20not\x20found');}return _0x4ac03e;})[_0x7b4c('0x29')](function(_0x11ae6e){var _0x3a3713=path['join'](config['root'],_0x7b4c('0x59'),_0x11ae6e[_0x7b4c('0x53')]);logger[_0x7b4c('0x68')]('cancellazione\x20fisica\x20documento\x20%s',_0x3a3713);if(!_[_0x7b4c('0x67')](_0x11ae6e['value'])&&fs[_0x7b4c('0x5b')](_0x3a3713)){logger[_0x7b4c('0x68')](_0x7b4c('0x69')+_0x3a3713+_0x7b4c('0x6a'));fs[_0x7b4c('0x6b')](_0x3a3713);}_0x3a3713=_0x3a3713+'.cypher';if(!_[_0x7b4c('0x67')](_0x11ae6e[_0x7b4c('0x53')])&&fs['existsSync'](_0x3a3713)){logger[_0x7b4c('0x68')](_0x7b4c('0x69')+_0x3a3713+_0x7b4c('0x6a'));fs[_0x7b4c('0x6b')](_0x3a3713);}return _0x11ae6e;})[_0x7b4c('0x29')](function(_0x2befd7){if(!_0x2befd7)throw new InternalError();return _0x2befd7[_0x7b4c('0x2a')]();})[_0x7b4c('0x29')](function(){_0x3b2144['status'](0xcc)[_0x7b4c('0x1d')]();})[_0x7b4c('0x49')](handleError(_0x3b2144,null));}; \ No newline at end of file +var _0x2eb2=['zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','update','then','destroy','end','stack','name','send','map','ScreenRecording','rawAttributes','fieldName','type','key','differenceBy','format','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','find','create','body','duration','createdAt','closedAt','value','describe','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','download','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf'];(function(_0x45c8b5,_0x58c6e8){var _0x246451=function(_0x180155){while(--_0x180155){_0x45c8b5['push'](_0x45c8b5['shift']());}};_0x246451(++_0x58c6e8);}(_0x2eb2,0x19f));var _0x22eb=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x2eb2[_0x5b78e8];return _0xf2c321;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x22eb('0x0'));var zipdir=require(_0x22eb('0x1'));var jsonpatch=require(_0x22eb('0x2'));var rp=require(_0x22eb('0x3'));var moment=require(_0x22eb('0x4'));var BPromise=require(_0x22eb('0x5'));var Mustache=require('mustache');var util=require(_0x22eb('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x22eb('0x7'));var ejs=require(_0x22eb('0x8'));var fs=require('fs');var fs_extra=require(_0x22eb('0x9'));var _=require(_0x22eb('0xa'));var squel=require(_0x22eb('0xb'));var crypto=require(_0x22eb('0xc'));var jsforce=require(_0x22eb('0xd'));var deskjs=require(_0x22eb('0xe'));var toCsv=require(_0x22eb('0x7'));var querystring=require(_0x22eb('0xf'));var Papa=require(_0x22eb('0x10'));var Redis=require(_0x22eb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x22eb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x22eb('0x13'))('api');var utils=require(_0x22eb('0x14'));var config=require(_0x22eb('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f286c,_0x189f05){_0x189f05=_0x189f05||0xcc;return function(_0x128d43){if(_0x128d43){return _0x1f286c[_0x22eb('0x16')](_0x189f05);}return _0x1f286c[_0x22eb('0x17')](_0x189f05)['end']();};}function respondWithResult(_0x350ade,_0x53f14e){_0x53f14e=_0x53f14e||0xc8;return function(_0x1f5089){if(_0x1f5089){return _0x350ade['status'](_0x53f14e)[_0x22eb('0x18')](_0x1f5089);}};}function respondWithFilteredResult(_0x84c668,_0x53abbf){return function(_0x48b63c){if(_0x48b63c){var _0x4bc29a=typeof _0x53abbf[_0x22eb('0x19')]==='undefined'&&typeof _0x53abbf['limit']===_0x22eb('0x1a');var _0x4d9a71=_0x48b63c['count'];var _0xb7a73a=_0x4bc29a?0x0:_0x53abbf[_0x22eb('0x19')];var _0x385bcb=_0x4bc29a?_0x48b63c[_0x22eb('0x1b')]:_0x53abbf[_0x22eb('0x19')]+_0x53abbf['limit'];var _0x4182a8;if(_0x385bcb>=_0x4d9a71){_0x385bcb=_0x4d9a71;_0x4182a8=0xc8;}else{_0x4182a8=0xce;}_0x84c668[_0x22eb('0x17')](_0x4182a8);return _0x84c668[_0x22eb('0x1c')](_0x22eb('0x1d'),_0xb7a73a+'-'+_0x385bcb+'/'+_0x4d9a71)[_0x22eb('0x18')](_0x48b63c);}return null;};}function patchUpdates(_0x517313){return function(_0x2eb115){try{jsonpatch[_0x22eb('0x1e')](_0x2eb115,_0x517313,!![]);}catch(_0x2fc36e){return BPromise['reject'](_0x2fc36e);}return _0x2eb115['save']();};}function saveUpdates(_0x4335b7,_0x267d97){return function(_0x434ecb){if(_0x434ecb){return _0x434ecb[_0x22eb('0x1f')](_0x4335b7)[_0x22eb('0x20')](function(_0x3e8c1c){return _0x3e8c1c;});}return null;};}function removeEntity(_0x43dacb,_0x4e7e69){return function(_0x2e8f7c){if(_0x2e8f7c){return _0x2e8f7c[_0x22eb('0x21')]()[_0x22eb('0x20')](function(){_0x43dacb[_0x22eb('0x17')](0xcc)[_0x22eb('0x22')]();});}};}function handleEntityNotFound(_0x4da252,_0x12c133){return function(_0x6f8ff3){if(!_0x6f8ff3){_0x4da252[_0x22eb('0x16')](0x194);}return _0x6f8ff3;};}function handleError(_0x5a001e,_0xe0783c){_0xe0783c=_0xe0783c||0x1f4;return function(_0x259847){logger['error'](_0x259847[_0x22eb('0x23')]);if(_0x259847[_0x22eb('0x24')]){delete _0x259847[_0x22eb('0x24')];}_0x5a001e[_0x22eb('0x17')](_0xe0783c)[_0x22eb('0x25')](_0x259847);};}exports['index']=function(_0x49dd59,_0x2a950e){var _0x25e5bc={},_0x44cf91={},_0x7c0119={'count':0x0,'rows':[]};var _0x1599c7=_[_0x22eb('0x26')](db[_0x22eb('0x27')][_0x22eb('0x28')],function(_0x382784){return{'name':_0x382784[_0x22eb('0x29')],'type':_0x382784[_0x22eb('0x2a')][_0x22eb('0x2b')]};});_0x44cf91['model']=_[_0x22eb('0x2c')](_['map'](_0x1599c7,_0x22eb('0x24')),[_0x22eb('0x2d')]);_0x44cf91[_0x22eb('0x2e')]=_[_0x22eb('0x2f')](_0x49dd59[_0x22eb('0x2e')]);_0x44cf91[_0x22eb('0x30')]=_[_0x22eb('0x31')](_0x44cf91[_0x22eb('0x32')],_0x44cf91[_0x22eb('0x2e')]);_0x25e5bc[_0x22eb('0x33')]=_['intersection'](_0x44cf91['model'],qs[_0x22eb('0x34')](_0x49dd59['query']['fields']));_0x25e5bc[_0x22eb('0x33')]=_0x25e5bc[_0x22eb('0x33')][_0x22eb('0x35')]?_0x25e5bc[_0x22eb('0x33')]:_0x44cf91[_0x22eb('0x32')];if(!_0x49dd59[_0x22eb('0x2e')][_0x22eb('0x36')](_0x22eb('0x37'))){_0x25e5bc[_0x22eb('0x38')]=qs[_0x22eb('0x38')](_0x49dd59['query'][_0x22eb('0x38')]);_0x25e5bc['offset']=qs['offset'](_0x49dd59[_0x22eb('0x2e')][_0x22eb('0x19')]);}_0x25e5bc['order']=qs[_0x22eb('0x39')](_0x49dd59[_0x22eb('0x2e')][_0x22eb('0x39')]);_0x25e5bc[_0x22eb('0x3a')]=qs[_0x22eb('0x30')](_['pick'](_0x49dd59[_0x22eb('0x2e')],_0x44cf91[_0x22eb('0x30')]),_0x1599c7);if(_0x49dd59['query'][_0x22eb('0x3b')]){_0x25e5bc[_0x22eb('0x3a')]=_[_0x22eb('0x3c')](_0x25e5bc[_0x22eb('0x3a')],{'$or':_[_0x22eb('0x26')](_0x1599c7,function(_0x5382eb){if(_0x5382eb['type']!==_0x22eb('0x3d')){var _0x6cd651={};_0x6cd651[_0x5382eb['name']]={'$like':'%'+_0x49dd59[_0x22eb('0x2e')][_0x22eb('0x3b')]+'%'};return _0x6cd651;}})});}_0x25e5bc=_[_0x22eb('0x3c')]({},_0x25e5bc,_0x49dd59['options']);var _0x1d977c={'where':_0x25e5bc[_0x22eb('0x3a')]};return db[_0x22eb('0x27')][_0x22eb('0x1b')](_0x1d977c)[_0x22eb('0x20')](function(_0x39778e){_0x7c0119['count']=_0x39778e;if(_0x49dd59[_0x22eb('0x2e')][_0x22eb('0x3e')]){_0x25e5bc['include']=[{'all':!![]}];}return db[_0x22eb('0x27')][_0x22eb('0x3f')](_0x25e5bc);})[_0x22eb('0x20')](function(_0x30cb10){_0x7c0119[_0x22eb('0x40')]=_0x30cb10;return _0x7c0119;})[_0x22eb('0x20')](respondWithFilteredResult(_0x2a950e,_0x25e5bc))[_0x22eb('0x41')](handleError(_0x2a950e,null));};exports[_0x22eb('0x42')]=function(_0x1bafa3,_0x82ace8){var _0x3e1826={'raw':![],'where':{'id':_0x1bafa3[_0x22eb('0x43')]['id']}},_0x1cf1e0={};_0x1cf1e0[_0x22eb('0x32')]=_[_0x22eb('0x2f')](db[_0x22eb('0x27')][_0x22eb('0x28')]);_0x1cf1e0[_0x22eb('0x2e')]=_['keys'](_0x1bafa3[_0x22eb('0x2e')]);_0x1cf1e0[_0x22eb('0x30')]=_['intersection'](_0x1cf1e0[_0x22eb('0x32')],_0x1cf1e0[_0x22eb('0x2e')]);_0x3e1826['attributes']=_['intersection'](_0x1cf1e0['model'],qs[_0x22eb('0x34')](_0x1bafa3[_0x22eb('0x2e')]['fields']));_0x3e1826['attributes']=_0x3e1826[_0x22eb('0x33')][_0x22eb('0x35')]?_0x3e1826[_0x22eb('0x33')]:_0x1cf1e0[_0x22eb('0x32')];if(_0x1bafa3[_0x22eb('0x2e')][_0x22eb('0x3e')]){_0x3e1826[_0x22eb('0x44')]=[{'all':!![]}];}_0x3e1826=_[_0x22eb('0x3c')]({},_0x3e1826,_0x1bafa3['options']);return db['ScreenRecording'][_0x22eb('0x45')](_0x3e1826)['then'](handleEntityNotFound(_0x82ace8,null))[_0x22eb('0x20')](respondWithResult(_0x82ace8,null))['catch'](handleError(_0x82ace8,null));};exports[_0x22eb('0x46')]=function(_0x5c41c0,_0x4b2f86){return db['ScreenRecording']['create'](_0x5c41c0[_0x22eb('0x47')],{})['then'](respondWithResult(_0x4b2f86,0xc9))[_0x22eb('0x41')](handleError(_0x4b2f86,null));};exports[_0x22eb('0x1f')]=function(_0x490bef,_0x24e6ba){if(_0x490bef['body']['id']){delete _0x490bef[_0x22eb('0x47')]['id'];}delete _0x490bef[_0x22eb('0x47')][_0x22eb('0x48')];delete _0x490bef[_0x22eb('0x47')][_0x22eb('0x49')];delete _0x490bef[_0x22eb('0x47')][_0x22eb('0x4a')];delete _0x490bef[_0x22eb('0x47')][_0x22eb('0x4b')];return db['ScreenRecording'][_0x22eb('0x45')]({'where':{'id':_0x490bef[_0x22eb('0x43')]['id']}})['then'](handleEntityNotFound(_0x24e6ba,null))[_0x22eb('0x20')](saveUpdates(_0x490bef[_0x22eb('0x47')],null))[_0x22eb('0x20')](respondWithResult(_0x24e6ba,null))[_0x22eb('0x41')](handleError(_0x24e6ba,null));};exports['describe']=function(_0x6c0600,_0x169ae1){return db[_0x22eb('0x27')][_0x22eb('0x4c')]()[_0x22eb('0x20')](respondWithResult(_0x169ae1,null))[_0x22eb('0x41')](handleError(_0x169ae1,null));};exports['download']=function(_0x29d7ca,_0x4e5b9f,_0x3ff406){var _0x5eecef=require(_0x22eb('0x4d'));var _0x254b53=![];var _0x4028ef={};if(_0x29d7ca[_0x22eb('0x2e')][_0x22eb('0x2a')]&&_0x29d7ca['query']['type']===_0x22eb('0x4e')){_0x4028ef[_0x22eb('0x4e')]=_0x29d7ca['params']['id'];}else{_0x4028ef['id']=_0x29d7ca[_0x22eb('0x43')]['id'];}return db[_0x22eb('0x27')][_0x22eb('0x45')]({'where':_0x4028ef,'attributes':['id',_0x22eb('0x4b')],'raw':!![]})[_0x22eb('0x20')](handleEntityNotFound(_0x4e5b9f,null))[_0x22eb('0x20')](function(_0x3a8588){if(_0x3a8588){var _0x35c997=path[_0x22eb('0x4f')](config[_0x22eb('0x50')],_0x22eb('0x51'),_0x3a8588['value']);var _0x19cadf=util[_0x22eb('0x2d')](_0x22eb('0x52'),_0x35c997);if(fs[_0x22eb('0x53')](_0x19cadf)){_0x254b53=!![];return _0x5eecef[_0x22eb('0x54')](_0x19cadf,_0x35c997,config[_0x22eb('0x55')][_0x22eb('0x56')])[_0x22eb('0x20')](function(){return _0x3a8588;});}return _0x3a8588;}})[_0x22eb('0x20')](function(_0x9f8465){if(_0x9f8465){var _0x3e9ab5=path[_0x22eb('0x4f')](config[_0x22eb('0x50')],_0x22eb('0x51'),_0x9f8465['value']);if(!fs['existsSync'](_0x3e9ab5)){throw new db[(_0x22eb('0x57'))][(_0x22eb('0x58'))](_0x22eb('0x59'));}if(_0x9f8465[_0x22eb('0x5a')]){return _0x4e5b9f[_0x22eb('0x5b')](_0x3e9ab5,_0x9f8465['filename']+path[_0x22eb('0x5c')](_0x3e9ab5),function(){if(_0x254b53){fs[_0x22eb('0x5d')](_0x3e9ab5);}});}else{return _0x4e5b9f['download'](_0x3e9ab5,function(_0x485408){if(_0x254b53){fs[_0x22eb('0x5d')](_0x3e9ab5);}});}}})[_0x22eb('0x41')](function(_0xb5c8ae){if(_0xb5c8ae[_0x22eb('0x5e')]===_0x22eb('0x59')){_0x4e5b9f[_0x22eb('0x17')](0x194)[_0x22eb('0x25')](_0x22eb('0x5f'));}else{return handleError(_0x4e5b9f,null);}});};exports[_0x22eb('0x21')]=function(_0x19b579,_0x164645){return db[_0x22eb('0x27')][_0x22eb('0x45')]({'where':{'id':_0x19b579[_0x22eb('0x43')]['id']}})['then'](function(_0x29dd8b){if(_[_0x22eb('0x60')](_0x29dd8b)){throw new ReferenceError(_0x22eb('0x61'));}return _0x29dd8b;})['then'](function(_0x1787ec){var _0x5ac4c5=path[_0x22eb('0x4f')](config['root'],_0x22eb('0x51'),_0x1787ec[_0x22eb('0x4b')]);logger['info'](_0x22eb('0x62'),_0x5ac4c5);if(!_[_0x22eb('0x60')](_0x1787ec['value'])&&fs['existsSync'](_0x5ac4c5)){logger[_0x22eb('0x63')](_0x22eb('0x64')+_0x5ac4c5+_0x22eb('0x65'));fs[_0x22eb('0x66')](_0x5ac4c5);}_0x5ac4c5=_0x5ac4c5+_0x22eb('0x67');if(!_[_0x22eb('0x60')](_0x1787ec['value'])&&fs[_0x22eb('0x53')](_0x5ac4c5)){logger['info']('File:\x20\x22'+_0x5ac4c5+_0x22eb('0x65'));fs[_0x22eb('0x66')](_0x5ac4c5);}return _0x1787ec;})[_0x22eb('0x20')](function(_0x22b5c6){if(!_0x22b5c6)throw new InternalError();return _0x22b5c6[_0x22eb('0x21')]();})[_0x22eb('0x20')](function(){_0x164645[_0x22eb('0x17')](0xcc)[_0x22eb('0x22')]();})['catch'](handleError(_0x164645,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 3e3e614..855b617 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 _0x8615=['define','ScreenRecording','interactionid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3e271e,_0x42e44d){var _0x5ac70b=function(_0x451766){while(--_0x451766){_0x3e271e['push'](_0x3e271e['shift']());}};_0x5ac70b(++_0x42e44d);}(_0x8615,0x15f));var _0x5861=function(_0xdd27d1,_0xb6f0da){_0xdd27d1=_0xdd27d1-0x0;var _0x58220e=_0x8615[_0xdd27d1];return _0x58220e;};'use strict';var _=require(_0x5861('0x0'));var util=require(_0x5861('0x1'));var logger=require('../../config/logger')(_0x5861('0x2'));var moment=require(_0x5861('0x3'));var BPromise=require(_0x5861('0x4'));var rp=require(_0x5861('0x5'));var fs=require('fs');var path=require(_0x5861('0x6'));var rimraf=require(_0x5861('0x7'));var config=require(_0x5861('0x8'));var attributes=require('./screenRecording.attributes');module['exports']=function(_0x24b31e,_0x51d64b){return _0x24b31e[_0x5861('0x9')](_0x5861('0xa'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x5861('0xb'),'fields':[_0x5861('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7bf9=['api','moment','bluebird','request-promise','rimraf','./screenRecording.attributes','exports','define','screen_recordings','interactionid','lodash','util','../../config/logger'];(function(_0x59b154,_0x387cbd){var _0x5a43b2=function(_0x5393da){while(--_0x5393da){_0x59b154['push'](_0x59b154['shift']());}};_0x5a43b2(++_0x387cbd);}(_0x7bf9,0x1eb));var _0x97bf=function(_0x396b41,_0xacfe9b){_0x396b41=_0x396b41-0x0;var _0x4f0aa3=_0x7bf9[_0x396b41];return _0x4f0aa3;};'use strict';var _=require(_0x97bf('0x0'));var util=require(_0x97bf('0x1'));var logger=require(_0x97bf('0x2'))(_0x97bf('0x3'));var moment=require(_0x97bf('0x4'));var BPromise=require(_0x97bf('0x5'));var rp=require(_0x97bf('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x97bf('0x7'));var config=require('../../config/environment');var attributes=require(_0x97bf('0x8'));module[_0x97bf('0x9')]=function(_0x52db6c,_0x53a0eb){return _0x52db6c[_0x97bf('0xa')]('ScreenRecording',attributes,{'tableName':_0x97bf('0xb'),'paranoid':![],'indexes':[{'name':_0x97bf('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 40a0e5c..4d6cafe 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 _0x203a=['message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0x1e82af,_0x17f514){var _0x20e8aa=function(_0x533fb0){while(--_0x533fb0){_0x1e82af['push'](_0x1e82af['shift']());}};_0x20e8aa(++_0x17f514);}(_0x203a,0x95));var _0xa203=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x203a[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xa203('0x0'));var util=require(_0xa203('0x1'));var moment=require(_0xa203('0x2'));var BPromise=require('bluebird');var rs=require(_0xa203('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa203('0x4'))['db'];var utils=require(_0xa203('0x5'));var logger=require(_0xa203('0x6'))('rpc');var config=require(_0xa203('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa203('0x8')][_0xa203('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f310e,_0x134a03,_0x14610a){return new BPromise(function(_0xe3559a,_0x10dff7){return client[_0xa203('0xa')](_0x4f310e,_0x14610a)[_0xa203('0xb')](function(_0x12c277){logger[_0xa203('0xc')](_0xa203('0xd'),_0x134a03,'request\x20sent');logger[_0xa203('0xe')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x134a03,_0xa203('0xf'),JSON[_0xa203('0x10')](_0x12c277));if(_0x12c277[_0xa203('0x11')]){if(_0x12c277['error'][_0xa203('0x12')]===0x1f4){logger['error'](_0xa203('0xd'),_0x134a03,_0x12c277['error'][_0xa203('0x13')]);return _0x10dff7(_0x12c277[_0xa203('0x11')]['message']);}logger[_0xa203('0x11')](_0xa203('0xd'),_0x134a03,_0x12c277[_0xa203('0x11')]['message']);return _0xe3559a(_0x12c277[_0xa203('0x11')][_0xa203('0x13')]);}else{logger[_0xa203('0xc')](_0xa203('0xd'),_0x134a03,_0xa203('0xf'));_0xe3559a(_0x12c277['result'][_0xa203('0x13')]);}})[_0xa203('0x14')](function(_0x4e7e39){logger['error'](_0xa203('0xd'),_0x134a03,_0x4e7e39);_0x10dff7(_0x4e7e39);});});} \ No newline at end of file +var _0xfbc3=['message','info','result','catch','lodash','util','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x12f388,_0x5b54e5){var _0x398ad8=function(_0x58aaa4){while(--_0x58aaa4){_0x12f388['push'](_0x12f388['shift']());}};_0x398ad8(++_0x5b54e5);}(_0xfbc3,0x158));var _0x3fbc=function(_0x3b8798,_0xdbad70){_0x3b8798=_0x3b8798-0x0;var _0x42ccf6=_0xfbc3[_0x3b8798];return _0x42ccf6;};'use strict';var _=require(_0x3fbc('0x0'));var util=require(_0x3fbc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3fbc('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x3fbc('0x3'))(_0x3fbc('0x4'));var config=require('../../config/environment');var jayson=require(_0x3fbc('0x5'));var client=jayson['client'][_0x3fbc('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x6341cf,_0x2e57d7,_0x410838){return new BPromise(function(_0x12b201,_0x30dc07){return client[_0x3fbc('0x7')](_0x6341cf,_0x410838)[_0x3fbc('0x8')](function(_0x5e3cae){logger['info'](_0x3fbc('0x9'),_0x2e57d7,'request\x20sent');logger[_0x3fbc('0xa')](_0x3fbc('0xb'),_0x2e57d7,_0x3fbc('0xc'),JSON[_0x3fbc('0xd')](_0x5e3cae));if(_0x5e3cae['error']){if(_0x5e3cae[_0x3fbc('0xe')][_0x3fbc('0xf')]===0x1f4){logger[_0x3fbc('0xe')]('ScreenRecording,\x20%s,\x20%s',_0x2e57d7,_0x5e3cae[_0x3fbc('0xe')]['message']);return _0x30dc07(_0x5e3cae[_0x3fbc('0xe')][_0x3fbc('0x10')]);}logger[_0x3fbc('0xe')]('ScreenRecording,\x20%s,\x20%s',_0x2e57d7,_0x5e3cae['error'][_0x3fbc('0x10')]);return _0x12b201(_0x5e3cae[_0x3fbc('0xe')][_0x3fbc('0x10')]);}else{logger[_0x3fbc('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x2e57d7,'request\x20sent');_0x12b201(_0x5e3cae[_0x3fbc('0x12')][_0x3fbc('0x10')]);}})[_0x3fbc('0x13')](function(_0xced049){logger[_0x3fbc('0xe')](_0x3fbc('0x9'),_0x2e57d7,_0xced049);_0x30dc07(_0xced049);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 75f6095..5e478dd 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 _0xb7de=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./setting.controller','get','isAuthenticated','index','/:id','show','getLogo','/:id/logo_login','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','join','root','format','%s%s','originalname','post','file','addLogo','server/files/images/logos/','extname','single','diskStorage','preferred','addPreferred','favicon','addFavicon','put','update','exports','multer'];(function(_0x483f0,_0x329df8){var _0x59a8eb=function(_0x369025){while(--_0x369025){_0x483f0['push'](_0x483f0['shift']());}};_0x59a8eb(++_0x329df8);}(_0xb7de,0xc7));var _0xeb7d=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xb7de[_0x1d9aa0];return _0x226868;};'use strict';var multer=require(_0xeb7d('0x0'));var util=require(_0xeb7d('0x1'));var path=require(_0xeb7d('0x2'));var timeout=require('connect-timeout');var express=require(_0xeb7d('0x3'));var router=express[_0xeb7d('0x4')]();var fs_extra=require(_0xeb7d('0x5'));var auth=require(_0xeb7d('0x6'));var interaction=require(_0xeb7d('0x7'));var config=require('../../config/environment');var controller=require(_0xeb7d('0x8'));router[_0xeb7d('0x9')]('/',auth[_0xeb7d('0xa')](),controller[_0xeb7d('0xb')]);router[_0xeb7d('0x9')]('/now',controller['getDate']);router[_0xeb7d('0x9')](_0xeb7d('0xc'),controller[_0xeb7d('0xd')]);router[_0xeb7d('0x9')]('/:id/logo',controller[_0xeb7d('0xe')]);router[_0xeb7d('0x9')](_0xeb7d('0xf'),controller['getLogoLogin']);router['get'](_0xeb7d('0x10'),controller['gdpr']);router[_0xeb7d('0x9')](_0xeb7d('0x11'),controller[_0xeb7d('0x12')]);router[_0xeb7d('0x9')](_0xeb7d('0x13'),controller[_0xeb7d('0x14')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2defe5,_0x2fabf1,_0x296355){_0x296355(null,path[_0xeb7d('0x15')](config[_0xeb7d('0x16')],'server/files/images/logos/'));},'filename':function(_0xdc94e7,_0x598da2,_0x284575){_0x284575(null,util[_0xeb7d('0x17')](_0xeb7d('0x18'),'logo',path['extname'](_0x598da2[_0xeb7d('0x19')])));}})});router[_0xeb7d('0x1a')]('/:id/logo',upload['single'](_0xeb7d('0x1b')),controller[_0xeb7d('0x1c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1bfa8a,_0x4584c2,_0x32fb0b){_0x32fb0b(null,path[_0xeb7d('0x15')](config[_0xeb7d('0x16')],_0xeb7d('0x1d')));},'filename':function(_0xa47b92,_0x38d591,_0x4023ff){_0x4023ff(null,util['format'](_0xeb7d('0x18'),'logologin',path[_0xeb7d('0x1e')](_0x38d591[_0xeb7d('0x19')])));}})});router[_0xeb7d('0x1a')]('/:id/logo_login',upload[_0xeb7d('0x1f')](_0xeb7d('0x1b')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0xeb7d('0x20')]({'destination':function(_0x374f35,_0x431dc0,_0x3666db){_0x3666db(null,path[_0xeb7d('0x15')](config[_0xeb7d('0x16')],_0xeb7d('0x1d')));},'filename':function(_0x4833b6,_0x3ac528,_0x392ba1){_0x392ba1(null,util[_0xeb7d('0x17')](_0xeb7d('0x18'),_0xeb7d('0x21'),path[_0xeb7d('0x1e')](_0x3ac528[_0xeb7d('0x19')])));}})});router['post'](_0xeb7d('0x11'),upload[_0xeb7d('0x1f')](_0xeb7d('0x1b')),controller[_0xeb7d('0x22')]);var upload=multer({'storage':multer[_0xeb7d('0x20')]({'destination':function(_0x32c518,_0x58ba4f,_0x310f25){_0x310f25(null,path[_0xeb7d('0x15')](config['root'],_0xeb7d('0x1d')));},'filename':function(_0x3fcff4,_0x9abd4b,_0xc1c4c6){_0xc1c4c6(null,util[_0xeb7d('0x17')](_0xeb7d('0x18'),_0xeb7d('0x23'),path[_0xeb7d('0x1e')](_0x9abd4b[_0xeb7d('0x19')])));}})});router[_0xeb7d('0x1a')](_0xeb7d('0x13'),upload[_0xeb7d('0x1f')](_0xeb7d('0x1b')),controller[_0xeb7d('0x24')]);router[_0xeb7d('0x25')](_0xeb7d('0xc'),auth[_0xeb7d('0xa')](),controller[_0xeb7d('0x26')]);module[_0xeb7d('0x27')]=router; \ No newline at end of file +var _0xaf2b=['/:id/favicon','getFavicon','root','server/files/images/logos/','format','extname','originalname','post','/:id/logo','addLogo','join','%s%s','/:id/logo_login','preferred','/:id/preferred','single','file','addPreferred','diskStorage','favicon','addFavicon','put','isAuthenticated','update','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','/now','getDate','/:id','getLogo','getLogoLogin','/:id/gdpr','gdpr','getPreferred'];(function(_0x16723d,_0xfaeaed){var _0x43ee0d=function(_0x3c5022){while(--_0x3c5022){_0x16723d['push'](_0x16723d['shift']());}};_0x43ee0d(++_0xfaeaed);}(_0xaf2b,0xea));var _0xbaf2=function(_0x369534,_0x5557c4){_0x369534=_0x369534-0x0;var _0x524bf9=_0xaf2b[_0x369534];return _0x524bf9;};'use strict';var multer=require(_0xbaf2('0x0'));var util=require('util');var path=require(_0xbaf2('0x1'));var timeout=require(_0xbaf2('0x2'));var express=require(_0xbaf2('0x3'));var router=express[_0xbaf2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbaf2('0x5'));var interaction=require(_0xbaf2('0x6'));var config=require(_0xbaf2('0x7'));var controller=require(_0xbaf2('0x8'));router[_0xbaf2('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbaf2('0x9')](_0xbaf2('0xa'),controller[_0xbaf2('0xb')]);router['get'](_0xbaf2('0xc'),controller['show']);router[_0xbaf2('0x9')]('/:id/logo',controller[_0xbaf2('0xd')]);router['get']('/:id/logo_login',controller[_0xbaf2('0xe')]);router[_0xbaf2('0x9')](_0xbaf2('0xf'),controller[_0xbaf2('0x10')]);router[_0xbaf2('0x9')]('/:id/preferred',controller[_0xbaf2('0x11')]);router['get'](_0xbaf2('0x12'),controller[_0xbaf2('0x13')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x51c81a,_0x576834,_0x4113bf){_0x4113bf(null,path['join'](config[_0xbaf2('0x14')],_0xbaf2('0x15')));},'filename':function(_0x461935,_0x2f9466,_0x46aee3){_0x46aee3(null,util[_0xbaf2('0x16')]('%s%s','logo',path[_0xbaf2('0x17')](_0x2f9466[_0xbaf2('0x18')])));}})});router[_0xbaf2('0x19')](_0xbaf2('0x1a'),upload['single']('file'),controller[_0xbaf2('0x1b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x271f77,_0x5e5bf4,_0x18c0f3){_0x18c0f3(null,path[_0xbaf2('0x1c')](config[_0xbaf2('0x14')],'server/files/images/logos/'));},'filename':function(_0x51e39a,_0x431db9,_0x1fb746){_0x1fb746(null,util[_0xbaf2('0x16')](_0xbaf2('0x1d'),'logologin',path[_0xbaf2('0x17')](_0x431db9[_0xbaf2('0x18')])));}})});router[_0xbaf2('0x19')](_0xbaf2('0x1e'),upload['single']('file'),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x16629f,_0x4338d2,_0x4b819e){_0x4b819e(null,path[_0xbaf2('0x1c')](config['root'],_0xbaf2('0x15')));},'filename':function(_0x196ff2,_0x3c6d21,_0x5cda8d){_0x5cda8d(null,util[_0xbaf2('0x16')](_0xbaf2('0x1d'),_0xbaf2('0x1f'),path['extname'](_0x3c6d21[_0xbaf2('0x18')])));}})});router['post'](_0xbaf2('0x20'),upload[_0xbaf2('0x21')](_0xbaf2('0x22')),controller[_0xbaf2('0x23')]);var upload=multer({'storage':multer[_0xbaf2('0x24')]({'destination':function(_0x2d8d1e,_0x3bc70e,_0x1c7e70){_0x1c7e70(null,path[_0xbaf2('0x1c')](config[_0xbaf2('0x14')],_0xbaf2('0x15')));},'filename':function(_0x6a82d7,_0x2daa80,_0x21aa0b){_0x21aa0b(null,util[_0xbaf2('0x16')](_0xbaf2('0x1d'),_0xbaf2('0x25'),path['extname'](_0x2daa80[_0xbaf2('0x18')])));}})});router[_0xbaf2('0x19')](_0xbaf2('0x12'),upload[_0xbaf2('0x21')](_0xbaf2('0x22')),controller[_0xbaf2('0x26')]);router[_0xbaf2('0x27')]('/:id',auth[_0xbaf2('0x28')](),controller[_0xbaf2('0x29')]);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 0733f33..b11c160 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 _0x5f66=['STRING','BOOLEAN','UNSIGNED','exports','min_internal','INTEGER','min_mailbox'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x5f66[_0x5f0089];return _0x193892;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x65f6('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x65f6('0x2')](0xb),'unique':_0x65f6('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x65f6('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x65f6('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x65f6('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x65f6('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x65f6('0x4')]},'turnaddr':{'type':Sequelize[_0x65f6('0x4')]},'turnusername':{'type':Sequelize[_0x65f6('0x4')]},'turnpassword':{'type':Sequelize[_0x65f6('0x4')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x65f6('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x65f6('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x65f6('0x4')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x65f6('0x4')]},'defaultPreferred':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x65f6('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x65f6('0x4')]},'defaultFavicon':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x65f6('0x4')]},'sentiment':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x65f6('0x2')]},'sentimentRegion':{'type':Sequelize[_0x65f6('0x4')]},'language':{'type':Sequelize[_0x65f6('0x4')]},'bucket':{'type':Sequelize[_0x65f6('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x65f6('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)[_0x65f6('0x6')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x65f6('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xdb28=['INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xdb28,0x106));var _0x8db2=function(_0x4f9915,_0x5277a1){_0x4f9915=_0x4f9915-0x0;var _0x40e7f0=_0xdb28[_0x4f9915];return _0x40e7f0;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'min_internal':{'type':Sequelize[_0x8db2('0x2')](0xb),'unique':_0x8db2('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x8db2('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x8db2('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x8db2('0x5')],'defaultValue':_0x8db2('0x6')},'logo':{'type':Sequelize[_0x8db2('0x5')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x8db2('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x8db2('0x5')]},'turnaddr':{'type':Sequelize[_0x8db2('0x5')]},'turnusername':{'type':Sequelize[_0x8db2('0x5')]},'turnpassword':{'type':Sequelize[_0x8db2('0x5')]},'pageTitle':{'type':Sequelize[_0x8db2('0x5')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x8db2('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x8db2('0x8')},'enableEmailPreview':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x8db2('0x5')],'defaultValue':_0x8db2('0x9')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x8db2('0x5')]},'defaultPreferred':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x8db2('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x8db2('0x5')]},'defaultFavicon':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x8db2('0x2')]},'transcribeRegion':{'type':Sequelize[_0x8db2('0x5')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x8db2('0x2')]},'sentimentRegion':{'type':Sequelize[_0x8db2('0x5')]},'language':{'type':Sequelize[_0x8db2('0x5')]},'bucket':{'type':Sequelize[_0x8db2('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x8db2('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x8db2('0x2')](0x2)[_0x8db2('0xa')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x8db2('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x8db2('0x2')](0x2)[_0x8db2('0xa')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x8db2('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 7909922..0d1705b 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 _0xa671=['query','filters','attributes','intersection','fields','length','nolimit','offset','sort','where','pick','filter','VIRTUAL','merge','options','Setting','includeAll','include','rows','params','body','find','addLogo','file','filename','logo','addLogoLogin','getLogo','loginLogo','preferred','favicon','defaultLogo','defaultFavicon','existsSync','join','root','toLower','upperFirst','Sequelize','download','getLogoLogin','server/files/images/logos','getLicense','defaultPreferred','default_loginLogo.svg','default','ValidationError','gdpr','securePassword','addPreferred','default_preferred.png','defaultLoginLogo','default_favicon.ico','custom','\x20not\x20found','getDate','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','http','request','then','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','Setting,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','rawAttributes','fieldName','model','keys'];(function(_0x236c89,_0xd76ba9){var _0x3b2a15=function(_0x89e4f9){while(--_0x89e4f9){_0x236c89['push'](_0x236c89['shift']());}};_0x3b2a15(++_0xd76ba9);}(_0xa671,0x1a4));var _0x1a67=function(_0x2720d4,_0x4d10c3){_0x2720d4=_0x2720d4-0x0;var _0x1b0f29=_0xa671[_0x2720d4];return _0x1b0f29;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1a67('0x0'));var zipdir=require(_0x1a67('0x1'));var jsonpatch=require(_0x1a67('0x2'));var rp=require(_0x1a67('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1a67('0x4'));var util=require('util');var path=require(_0x1a67('0x5'));var sox=require(_0x1a67('0x6'));var csv=require(_0x1a67('0x7'));var ejs=require(_0x1a67('0x8'));var fs=require('fs');var fs_extra=require(_0x1a67('0x9'));var _=require('lodash');var squel=require(_0x1a67('0xa'));var crypto=require(_0x1a67('0xb'));var jsforce=require(_0x1a67('0xc'));var deskjs=require(_0x1a67('0xd'));var toCsv=require(_0x1a67('0x7'));var querystring=require(_0x1a67('0xe'));var Papa=require(_0x1a67('0xf'));var Redis=require(_0x1a67('0x10'));var authService=require(_0x1a67('0x11'));var qs=require(_0x1a67('0x12'));var as=require(_0x1a67('0x13'));var hardwareService=require(_0x1a67('0x14'));var logger=require(_0x1a67('0x15'))(_0x1a67('0x16'));var utils=require('../../config/utils');var config=require(_0x1a67('0x17'));var licenseUtil=require(_0x1a67('0x18'));var db=require(_0x1a67('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x1a67('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x5b4365,_0x162640,_0x4b985a,_0x28c5d0){return new BPromise(function(_0x499416,_0x1b81d7){var _0x5a71b4=_0x28c5d0||client;return _0x5a71b4[_0x1a67('0x1b')](_0x5b4365,_0x4b985a)[_0x1a67('0x1c')](function(_0x592278){logger['info']('Setting,\x20%s,\x20%s',_0x162640,_0x1a67('0x1d'));logger[_0x1a67('0x1e')](_0x1a67('0x1f'),_0x162640,_0x1a67('0x1d'),JSON['stringify'](_0x592278));if(_0x592278[_0x1a67('0x20')]){if(_0x592278['error']['code']===0x1f4){logger[_0x1a67('0x20')](_0x1a67('0x21'),_0x162640,_0x592278[_0x1a67('0x20')]['message']);return _0x1b81d7(_0x592278['error'][_0x1a67('0x22')]);}logger[_0x1a67('0x20')](_0x1a67('0x21'),_0x162640,_0x592278[_0x1a67('0x20')][_0x1a67('0x22')]);return _0x499416(_0x592278[_0x1a67('0x20')][_0x1a67('0x22')]);}else{logger[_0x1a67('0x23')](_0x1a67('0x21'),_0x162640,_0x1a67('0x1d'));_0x499416(_0x592278[_0x1a67('0x24')]['message']);}})[_0x1a67('0x25')](function(_0x41068a){logger['error'](_0x1a67('0x21'),_0x162640,_0x41068a);_0x1b81d7(_0x41068a);});});}function respondWithStatusCode(_0x2ee67b,_0x4d04dd){_0x4d04dd=_0x4d04dd||0xcc;return function(_0x1addf1){if(_0x1addf1){return _0x2ee67b[_0x1a67('0x26')](_0x4d04dd);}return _0x2ee67b[_0x1a67('0x27')](_0x4d04dd)[_0x1a67('0x28')]();};}function respondWithResult(_0x4cc706,_0x501a28){_0x501a28=_0x501a28||0xc8;return function(_0x19c8da){if(_0x19c8da){return _0x4cc706[_0x1a67('0x27')](_0x501a28)[_0x1a67('0x29')](_0x19c8da);}};}function respondWithFilteredResult(_0x710e5e,_0x4ae97a){return function(_0x44b19d){if(_0x44b19d){var _0x1feda2=typeof _0x4ae97a['offset']===_0x1a67('0x2a')&&typeof _0x4ae97a[_0x1a67('0x2b')]===_0x1a67('0x2a');var _0x9af90e=_0x44b19d[_0x1a67('0x2c')];var _0x3633fb=_0x1feda2?0x0:_0x4ae97a['offset'];var _0x6b4816=_0x1feda2?_0x44b19d['count']:_0x4ae97a['offset']+_0x4ae97a[_0x1a67('0x2b')];var _0x1f86b0;if(_0x6b4816>=_0x9af90e){_0x6b4816=_0x9af90e;_0x1f86b0=0xc8;}else{_0x1f86b0=0xce;}_0x710e5e[_0x1a67('0x27')](_0x1f86b0);return _0x710e5e[_0x1a67('0x2d')](_0x1a67('0x2e'),_0x3633fb+'-'+_0x6b4816+'/'+_0x9af90e)['json'](_0x44b19d);}return null;};}function patchUpdates(_0x5bb462){return function(_0x18ba79){try{jsonpatch[_0x1a67('0x2f')](_0x18ba79,_0x5bb462,!![]);}catch(_0x56f455){return BPromise[_0x1a67('0x30')](_0x56f455);}return _0x18ba79[_0x1a67('0x31')]();};}function saveUpdates(_0x5a0db4,_0x2c2a3f){return function(_0x271365){if(_0x271365){return _0x271365[_0x1a67('0x32')](_0x5a0db4)[_0x1a67('0x1c')](function(_0x312e10){return _0x312e10;});}return null;};}function removeEntity(_0x51f0fa,_0xedb6dd){return function(_0x56f38b){if(_0x56f38b){return _0x56f38b[_0x1a67('0x33')]()[_0x1a67('0x1c')](function(){_0x51f0fa[_0x1a67('0x27')](0xcc)[_0x1a67('0x28')]();});}};}function handleEntityNotFound(_0x2e6b49,_0xd75949){return function(_0xb4de2){if(!_0xb4de2){_0x2e6b49['sendStatus'](0x194);}return _0xb4de2;};}function handleError(_0x369733,_0x1ef413){_0x1ef413=_0x1ef413||0x1f4;return function(_0x5ca2ba){logger[_0x1a67('0x20')](_0x5ca2ba[_0x1a67('0x34')]);if(_0x5ca2ba[_0x1a67('0x35')]){delete _0x5ca2ba['name'];}_0x369733['status'](_0x1ef413)[_0x1a67('0x36')](_0x5ca2ba);};}exports['index']=function(_0x1a1713,_0x5e3a51){var _0x3fd361={},_0x12c512={},_0x4668cf={'count':0x0,'rows':[]};var _0x42f721=_[_0x1a67('0x37')](db['Setting'][_0x1a67('0x38')],function(_0x2b23d5){return{'name':_0x2b23d5[_0x1a67('0x39')],'type':_0x2b23d5['type']['key']};});_0x12c512[_0x1a67('0x3a')]=_[_0x1a67('0x37')](_0x42f721,'name');_0x12c512['query']=_[_0x1a67('0x3b')](_0x1a1713[_0x1a67('0x3c')]);_0x12c512[_0x1a67('0x3d')]=_['intersection'](_0x12c512[_0x1a67('0x3a')],_0x12c512['query']);_0x3fd361[_0x1a67('0x3e')]=_[_0x1a67('0x3f')](_0x12c512[_0x1a67('0x3a')],qs[_0x1a67('0x40')](_0x1a1713['query']['fields']));_0x3fd361[_0x1a67('0x3e')]=_0x3fd361[_0x1a67('0x3e')][_0x1a67('0x41')]?_0x3fd361[_0x1a67('0x3e')]:_0x12c512[_0x1a67('0x3a')];if(!_0x1a1713[_0x1a67('0x3c')]['hasOwnProperty'](_0x1a67('0x42'))){_0x3fd361['limit']=qs['limit'](_0x1a1713['query'][_0x1a67('0x2b')]);_0x3fd361['offset']=qs[_0x1a67('0x43')](_0x1a1713[_0x1a67('0x3c')]['offset']);}_0x3fd361['order']=qs[_0x1a67('0x44')](_0x1a1713[_0x1a67('0x3c')][_0x1a67('0x44')]);_0x3fd361[_0x1a67('0x45')]=qs[_0x1a67('0x3d')](_[_0x1a67('0x46')](_0x1a1713['query'],_0x12c512[_0x1a67('0x3d')]),_0x42f721);if(_0x1a1713['query'][_0x1a67('0x47')]){_0x3fd361[_0x1a67('0x45')]=_['merge'](_0x3fd361[_0x1a67('0x45')],{'$or':_['map'](_0x42f721,function(_0x293473){if(_0x293473['type']!==_0x1a67('0x48')){var _0x13f29a={};_0x13f29a[_0x293473[_0x1a67('0x35')]]={'$like':'%'+_0x1a1713['query'][_0x1a67('0x47')]+'%'};return _0x13f29a;}})});}_0x3fd361=_[_0x1a67('0x49')]({},_0x3fd361,_0x1a1713[_0x1a67('0x4a')]);var _0x2ed539={'where':_0x3fd361['where']};return db[_0x1a67('0x4b')]['count'](_0x2ed539)[_0x1a67('0x1c')](function(_0x3b8158){_0x4668cf[_0x1a67('0x2c')]=_0x3b8158;if(_0x1a1713[_0x1a67('0x3c')][_0x1a67('0x4c')]){_0x3fd361[_0x1a67('0x4d')]=[{'all':!![]}];}return db[_0x1a67('0x4b')]['findAll'](_0x3fd361);})[_0x1a67('0x1c')](function(_0x44c88e){_0x4668cf[_0x1a67('0x4e')]=_0x44c88e;return _0x4668cf;})[_0x1a67('0x1c')](respondWithFilteredResult(_0x5e3a51,_0x3fd361))[_0x1a67('0x25')](handleError(_0x5e3a51,null));};exports['show']=function(_0xa17168,_0x4dd65a){var _0x4e7539={'raw':![],'where':{'id':_0xa17168[_0x1a67('0x4f')]['id']}},_0x2f4f3c={};_0x2f4f3c[_0x1a67('0x3a')]=_[_0x1a67('0x3b')](db[_0x1a67('0x4b')][_0x1a67('0x38')]);_0x2f4f3c[_0x1a67('0x3c')]=_[_0x1a67('0x3b')](_0xa17168[_0x1a67('0x3c')]);_0x2f4f3c[_0x1a67('0x3d')]=_[_0x1a67('0x3f')](_0x2f4f3c['model'],_0x2f4f3c['query']);_0x4e7539[_0x1a67('0x3e')]=_[_0x1a67('0x3f')](_0x2f4f3c[_0x1a67('0x3a')],qs[_0x1a67('0x40')](_0xa17168[_0x1a67('0x3c')][_0x1a67('0x40')]));_0x4e7539[_0x1a67('0x3e')]=_0x4e7539['attributes'][_0x1a67('0x41')]?_0x4e7539[_0x1a67('0x3e')]:_0x2f4f3c[_0x1a67('0x3a')];if(_0xa17168[_0x1a67('0x3c')][_0x1a67('0x4c')]){_0x4e7539[_0x1a67('0x4d')]=[{'all':!![]}];}_0x4e7539=_[_0x1a67('0x49')]({},_0x4e7539,_0xa17168[_0x1a67('0x4a')]);return db[_0x1a67('0x4b')]['find'](_0x4e7539)[_0x1a67('0x1c')](handleEntityNotFound(_0x4dd65a,null))[_0x1a67('0x1c')](respondWithResult(_0x4dd65a,null))[_0x1a67('0x25')](handleError(_0x4dd65a,null));};exports[_0x1a67('0x32')]=function(_0x132a3f,_0x4a5e5b){if(_0x132a3f[_0x1a67('0x50')]['id']){delete _0x132a3f[_0x1a67('0x50')]['id'];}return db['Setting'][_0x1a67('0x51')]({'where':{'id':_0x132a3f[_0x1a67('0x4f')]['id']}})[_0x1a67('0x1c')](handleEntityNotFound(_0x4a5e5b,null))[_0x1a67('0x1c')](saveUpdates(_0x132a3f[_0x1a67('0x50')],null))[_0x1a67('0x1c')](respondWithResult(_0x4a5e5b,null))[_0x1a67('0x25')](handleError(_0x4a5e5b,null));};exports[_0x1a67('0x52')]=function(_0x3493ec,_0x35af7f,_0xa398bb){if(_0x3493ec[_0x1a67('0x53')]&&_0x3493ec['file'][_0x1a67('0x54')]){_0x3493ec[_0x1a67('0x50')][_0x1a67('0x55')]=_0x3493ec[_0x1a67('0x53')][_0x1a67('0x54')];}return db[_0x1a67('0x4b')]['find']({'where':{'id':_0x3493ec['params']['id']}})['then'](handleEntityNotFound(_0x35af7f,null))['then'](saveUpdates(_0x3493ec[_0x1a67('0x50')],null))[_0x1a67('0x1c')](respondWithResult(_0x35af7f,null))[_0x1a67('0x25')](handleError(_0x35af7f,null));};exports[_0x1a67('0x56')]=function(_0xebe965,_0x3425af,_0x36984e){if(_0xebe965[_0x1a67('0x53')]&&_0xebe965[_0x1a67('0x53')][_0x1a67('0x54')]){_0xebe965['body']['loginLogo']=_0xebe965[_0x1a67('0x53')][_0x1a67('0x54')];}return db[_0x1a67('0x4b')][_0x1a67('0x51')]({'where':{'id':_0xebe965['params']['id']}})[_0x1a67('0x1c')](handleEntityNotFound(_0x3425af,null))[_0x1a67('0x1c')](saveUpdates(_0xebe965[_0x1a67('0x50')],null))[_0x1a67('0x1c')](respondWithResult(_0x3425af,null))[_0x1a67('0x25')](handleError(_0x3425af,null));};var utilLicense=require(_0x1a67('0x18'));exports[_0x1a67('0x57')]=function(_0x3100c4,_0x5bcd6a,_0xcc295d){var _0xe37876='server/files/images/logos';var _0x1a8fe4={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x5b304a){if(_0x5b304a){_0x1a8fe4=_0x5b304a;}return db[_0x1a67('0x4b')]['find']({'where':{'id':_0x3100c4[_0x1a67('0x4f')]['id']},'attributes':[_0x1a67('0x55'),_0x1a67('0x58'),_0x1a67('0x59'),_0x1a67('0x5a'),_0x1a67('0x5b'),'defaultLoginLogo','defaultPreferred',_0x1a67('0x5c')],'raw':!![]});})[_0x1a67('0x1c')](handleEntityNotFound(_0x5bcd6a,null))['then'](function(_0x3a5dd8){if(_0x3a5dd8){var _0x158a4d=_0x3a5dd8['logo']&&fs[_0x1a67('0x5d')](path[_0x1a67('0x5e')](config[_0x1a67('0x5f')],_0xe37876,_[_0x1a67('0x60')](_0x3a5dd8[_0x1a67('0x55')])))?path['join'](config[_0x1a67('0x5f')],_0xe37876,_[_0x1a67('0x60')](_0x3a5dd8[_0x1a67('0x55')])):path[_0x1a67('0x5e')](config[_0x1a67('0x5f')],_0xe37876,_['toLower']('default_logo.svg'));var _0xed58c8='default'+_[_0x1a67('0x61')](_0x1a67('0x55'));if(_0x3a5dd8[_0xed58c8]||!_0x1a8fe4['custom']){_0x158a4d=path[_0x1a67('0x5e')](config['root'],_0xe37876,_[_0x1a67('0x60')]('default_logo.svg'));}if(!fs['existsSync'](_0x158a4d)){throw new db[(_0x1a67('0x62'))]['ValidationError'](_[_0x1a67('0x61')]('logo')+'\x20not\x20found');}return _0x5bcd6a[_0x1a67('0x63')](_0x158a4d);}})[_0x1a67('0x25')](handleError(_0x5bcd6a,null));};var utilLicense=require(_0x1a67('0x18'));exports[_0x1a67('0x64')]=function(_0x57c4ea,_0x476155,_0x5d5db3){var _0x10ccf9=_0x1a67('0x65');var _0x3ae0cf={'custom':![]};return utilLicense[_0x1a67('0x66')]()[_0x1a67('0x1c')](function(_0x8ce313){if(_0x8ce313){_0x3ae0cf=_0x8ce313;}return db[_0x1a67('0x4b')][_0x1a67('0x51')]({'where':{'id':_0x57c4ea[_0x1a67('0x4f')]['id']},'attributes':[_0x1a67('0x55'),_0x1a67('0x58'),_0x1a67('0x59'),_0x1a67('0x5a'),'defaultLogo','defaultLoginLogo',_0x1a67('0x67'),_0x1a67('0x5c')],'raw':!![]});})[_0x1a67('0x1c')](handleEntityNotFound(_0x476155,null))[_0x1a67('0x1c')](function(_0x2efa36){if(_0x2efa36){var _0x270c03=_0x2efa36[_0x1a67('0x58')]&&fs[_0x1a67('0x5d')](path['join'](config['root'],_0x10ccf9,_[_0x1a67('0x60')](_0x2efa36[_0x1a67('0x58')])))?path['join'](config[_0x1a67('0x5f')],_0x10ccf9,_['toLower'](_0x2efa36['loginLogo'])):path['join'](config[_0x1a67('0x5f')],_0x10ccf9,_[_0x1a67('0x60')](_0x1a67('0x68')));var _0x210d68=_0x1a67('0x69')+_[_0x1a67('0x61')](_0x1a67('0x58'));if(_0x2efa36[_0x210d68]||!_0x3ae0cf['custom']){_0x270c03=path['join'](config[_0x1a67('0x5f')],_0x10ccf9,_[_0x1a67('0x60')](_0x1a67('0x68')));}if(!fs[_0x1a67('0x5d')](_0x270c03)){throw new db[(_0x1a67('0x62'))][(_0x1a67('0x6a'))](_['upperFirst'](_0x1a67('0x58'))+'\x20not\x20found');}return _0x476155[_0x1a67('0x63')](_0x270c03);}})[_0x1a67('0x25')](handleError(_0x476155,null));};exports[_0x1a67('0x6b')]=function(_0x48a304,_0x462d4f){return db[_0x1a67('0x4b')]['find']({'where':{'id':_0x48a304[_0x1a67('0x4f')]['id']},'attributes':[_0x1a67('0x6c')]})[_0x1a67('0x1c')](respondWithResult(_0x462d4f,null))[_0x1a67('0x25')](handleError(_0x462d4f,null));};exports[_0x1a67('0x6d')]=function(_0x335796,_0x3e990f,_0x104e7a){if(_0x335796[_0x1a67('0x53')]&&_0x335796['file'][_0x1a67('0x54')]){_0x335796[_0x1a67('0x50')][_0x1a67('0x59')]=_0x335796[_0x1a67('0x53')][_0x1a67('0x54')];}return db[_0x1a67('0x4b')][_0x1a67('0x51')]({'where':{'id':_0x335796[_0x1a67('0x4f')]['id']}})[_0x1a67('0x1c')](handleEntityNotFound(_0x3e990f,null))['then'](saveUpdates(_0x335796['body'],null))['then'](respondWithResult(_0x3e990f,null))[_0x1a67('0x25')](handleError(_0x3e990f,null));};var utilLicense=require(_0x1a67('0x18'));exports['getPreferred']=function(_0x2506eb,_0x4451bc,_0x291f25){var _0x4c0b96=_0x1a67('0x65');var _0x151b26={'custom':![]};return utilLicense[_0x1a67('0x66')]()[_0x1a67('0x1c')](function(_0x5d5bcb){if(_0x5d5bcb){_0x151b26=_0x5d5bcb;}return db['Setting'][_0x1a67('0x51')]({'where':{'id':_0x2506eb[_0x1a67('0x4f')]['id']},'attributes':['logo',_0x1a67('0x58'),_0x1a67('0x59'),_0x1a67('0x5a'),'defaultLogo','defaultLoginLogo','defaultPreferred',_0x1a67('0x5c')],'raw':!![]});})[_0x1a67('0x1c')](handleEntityNotFound(_0x4451bc,null))[_0x1a67('0x1c')](function(_0x36a146){if(_0x36a146){var _0x701fcf=_0x36a146[_0x1a67('0x59')]&&fs['existsSync'](path['join'](config[_0x1a67('0x5f')],_0x4c0b96,_[_0x1a67('0x60')](_0x36a146[_0x1a67('0x59')])))?path[_0x1a67('0x5e')](config[_0x1a67('0x5f')],_0x4c0b96,_[_0x1a67('0x60')](_0x36a146[_0x1a67('0x59')])):path[_0x1a67('0x5e')](config[_0x1a67('0x5f')],_0x4c0b96,_[_0x1a67('0x60')]('default_preferred.png'));var _0xa99f8e=_0x1a67('0x69')+_['upperFirst'](_0x1a67('0x59'));if(_0x36a146[_0xa99f8e]||!_0x151b26['custom']||!_0x151b26[_0x1a67('0x59')]){_0x701fcf=path['join'](config[_0x1a67('0x5f')],_0x4c0b96,_['toLower'](_0x1a67('0x6e')));}if(!fs[_0x1a67('0x5d')](_0x701fcf)){throw new db['Sequelize']['ValidationError'](_[_0x1a67('0x61')]('preferred')+'\x20not\x20found');}return _0x4451bc[_0x1a67('0x63')](_0x701fcf);}})[_0x1a67('0x25')](handleError(_0x4451bc,null));};exports['addFavicon']=function(_0x108a13,_0xd31717,_0x17a3df){if(_0x108a13[_0x1a67('0x53')]&&_0x108a13['file'][_0x1a67('0x54')]){_0x108a13['body'][_0x1a67('0x5a')]=_0x108a13[_0x1a67('0x53')][_0x1a67('0x54')];}return db[_0x1a67('0x4b')][_0x1a67('0x51')]({'where':{'id':_0x108a13[_0x1a67('0x4f')]['id']}})[_0x1a67('0x1c')](handleEntityNotFound(_0xd31717,null))[_0x1a67('0x1c')](saveUpdates(_0x108a13[_0x1a67('0x50')],null))[_0x1a67('0x1c')](respondWithResult(_0xd31717,null))['catch'](handleError(_0xd31717,null));};var utilLicense=require(_0x1a67('0x18'));exports['getFavicon']=function(_0x2ea929,_0x3696f1,_0x2c1ac3){var _0x3c24c5='server/files/images/logos';var _0xd02ac1={'custom':![]};return utilLicense[_0x1a67('0x66')]()[_0x1a67('0x1c')](function(_0x3c9954){if(_0x3c9954){_0xd02ac1=_0x3c9954;}return db['Setting'][_0x1a67('0x51')]({'where':{'id':_0x2ea929[_0x1a67('0x4f')]['id']},'attributes':[_0x1a67('0x55'),'loginLogo',_0x1a67('0x59'),_0x1a67('0x5a'),_0x1a67('0x5b'),_0x1a67('0x6f'),_0x1a67('0x67'),_0x1a67('0x5c')],'raw':!![]});})['then'](handleEntityNotFound(_0x3696f1,null))[_0x1a67('0x1c')](function(_0x193fb3){if(_0x193fb3){var _0x335143=_0x193fb3['favicon']&&fs['existsSync'](path[_0x1a67('0x5e')](config[_0x1a67('0x5f')],_0x3c24c5,_[_0x1a67('0x60')](_0x193fb3[_0x1a67('0x5a')])))?path[_0x1a67('0x5e')](config['root'],_0x3c24c5,_[_0x1a67('0x60')](_0x193fb3[_0x1a67('0x5a')])):path['join'](config[_0x1a67('0x5f')],_0x3c24c5,_[_0x1a67('0x60')](_0x1a67('0x70')));var _0x49c892=_0x1a67('0x69')+_[_0x1a67('0x61')](_0x1a67('0x5a'));if(_0x193fb3[_0x49c892]||!_0xd02ac1[_0x1a67('0x71')]){_0x335143=path[_0x1a67('0x5e')](config[_0x1a67('0x5f')],_0x3c24c5,_['toLower'](_0x1a67('0x70')));}if(!fs[_0x1a67('0x5d')](_0x335143)){throw new db['Sequelize']['ValidationError'](_[_0x1a67('0x61')](_0x1a67('0x5a'))+_0x1a67('0x72'));}return _0x3696f1[_0x1a67('0x63')](_0x335143);}})[_0x1a67('0x25')](handleError(_0x3696f1,null));};exports[_0x1a67('0x73')]=function(_0x3a0da8,_0x7b9b1a){var _0x3f673d={'offset':moment()['utcOffset']()};_0x3f673d[_0x1a67('0x74')]=moment()[_0x1a67('0x75')](_0x3f673d[_0x1a67('0x43')])[_0x1a67('0x76')](_0x1a67('0x77'));return _0x7b9b1a['status'](0xc8)['send'](_0x3f673d);}; \ No newline at end of file +var _0x9d92=['desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','destroy','stack','name','index','Setting','rawAttributes','fieldName','type','key','map','query','intersection','model','attributes','fields','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','keys','options','find','body','addLogo','file','logo','filename','addLogoLogin','loginLogo','getLogo','server/files/images/logos','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','root','toLower','join','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','getLogoLogin','getLicense','default_loginLogo.svg','download','gdpr','securePassword','addPreferred','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x31cf74,_0x2fa0ee){var _0x5c5c4a=function(_0x27bb86){while(--_0x27bb86){_0x31cf74['push'](_0x31cf74['shift']());}};_0x5c5c4a(++_0x2fa0ee);}(_0x9d92,0xdf));var _0x29d9=function(_0xb6e43,_0x1568fc){_0xb6e43=_0xb6e43-0x0;var _0x47c40f=_0x9d92[_0xb6e43];return _0x47c40f;};'use strict';var emlformat=require(_0x29d9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x29d9('0x1'));var rp=require(_0x29d9('0x2'));var moment=require('moment');var BPromise=require(_0x29d9('0x3'));var Mustache=require(_0x29d9('0x4'));var util=require(_0x29d9('0x5'));var path=require(_0x29d9('0x6'));var sox=require(_0x29d9('0x7'));var csv=require(_0x29d9('0x8'));var ejs=require(_0x29d9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x29d9('0xa'));var squel=require(_0x29d9('0xb'));var crypto=require(_0x29d9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x29d9('0xd'));var toCsv=require(_0x29d9('0x8'));var querystring=require(_0x29d9('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x29d9('0xf'));var hardwareService=require(_0x29d9('0x10'));var logger=require(_0x29d9('0x11'))('api');var utils=require(_0x29d9('0x12'));var config=require(_0x29d9('0x13'));var licenseUtil=require(_0x29d9('0x14'));var db=require(_0x29d9('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x29d9('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a888b,_0x5d05b5,_0x399643,_0x24b770){return new BPromise(function(_0x112b59,_0x32c7c9){var _0x47b33c=_0x24b770||client;return _0x47b33c[_0x29d9('0x17')](_0x5a888b,_0x399643)[_0x29d9('0x18')](function(_0xa5b923){logger[_0x29d9('0x19')](_0x29d9('0x1a'),_0x5d05b5,_0x29d9('0x1b'));logger[_0x29d9('0x1c')](_0x29d9('0x1d'),_0x5d05b5,_0x29d9('0x1b'),JSON[_0x29d9('0x1e')](_0xa5b923));if(_0xa5b923[_0x29d9('0x1f')]){if(_0xa5b923['error'][_0x29d9('0x20')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x5d05b5,_0xa5b923[_0x29d9('0x1f')][_0x29d9('0x21')]);return _0x32c7c9(_0xa5b923['error'][_0x29d9('0x21')]);}logger[_0x29d9('0x1f')](_0x29d9('0x1a'),_0x5d05b5,_0xa5b923[_0x29d9('0x1f')][_0x29d9('0x21')]);return _0x112b59(_0xa5b923[_0x29d9('0x1f')][_0x29d9('0x21')]);}else{logger['info'](_0x29d9('0x1a'),_0x5d05b5,_0x29d9('0x1b'));_0x112b59(_0xa5b923[_0x29d9('0x22')][_0x29d9('0x21')]);}})['catch'](function(_0x52f99d){logger[_0x29d9('0x1f')](_0x29d9('0x1a'),_0x5d05b5,_0x52f99d);_0x32c7c9(_0x52f99d);});});}function respondWithStatusCode(_0x47a7f3,_0x590476){_0x590476=_0x590476||0xcc;return function(_0x512e5c){if(_0x512e5c){return _0x47a7f3[_0x29d9('0x23')](_0x590476);}return _0x47a7f3[_0x29d9('0x24')](_0x590476)[_0x29d9('0x25')]();};}function respondWithResult(_0x5d80c4,_0x45da6c){_0x45da6c=_0x45da6c||0xc8;return function(_0x10b1e8){if(_0x10b1e8){return _0x5d80c4[_0x29d9('0x24')](_0x45da6c)[_0x29d9('0x26')](_0x10b1e8);}};}function respondWithFilteredResult(_0x47d353,_0xea5b4b){return function(_0x596b69){if(_0x596b69){var _0x5e664f=typeof _0xea5b4b[_0x29d9('0x27')]===_0x29d9('0x28')&&typeof _0xea5b4b['limit']===_0x29d9('0x28');var _0x5c5de5=_0x596b69[_0x29d9('0x29')];var _0x29a034=_0x5e664f?0x0:_0xea5b4b[_0x29d9('0x27')];var _0x30d4e7=_0x5e664f?_0x596b69[_0x29d9('0x29')]:_0xea5b4b[_0x29d9('0x27')]+_0xea5b4b[_0x29d9('0x2a')];var _0x509a8f;if(_0x30d4e7>=_0x5c5de5){_0x30d4e7=_0x5c5de5;_0x509a8f=0xc8;}else{_0x509a8f=0xce;}_0x47d353['status'](_0x509a8f);return _0x47d353['set'](_0x29d9('0x2b'),_0x29a034+'-'+_0x30d4e7+'/'+_0x5c5de5)[_0x29d9('0x26')](_0x596b69);}return null;};}function patchUpdates(_0x1dc82f){return function(_0x43bdf8){try{jsonpatch[_0x29d9('0x2c')](_0x43bdf8,_0x1dc82f,!![]);}catch(_0x165a5b){return BPromise['reject'](_0x165a5b);}return _0x43bdf8[_0x29d9('0x2d')]();};}function saveUpdates(_0x4d1067,_0x39c915){return function(_0x168f26){if(_0x168f26){return _0x168f26[_0x29d9('0x2e')](_0x4d1067)['then'](function(_0x564dc7){return _0x564dc7;});}return null;};}function removeEntity(_0x548276,_0x576c86){return function(_0x54bdbe){if(_0x54bdbe){return _0x54bdbe[_0x29d9('0x2f')]()[_0x29d9('0x18')](function(){_0x548276[_0x29d9('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bec86,_0x2e986b){return function(_0x3ff48d){if(!_0x3ff48d){_0x1bec86[_0x29d9('0x23')](0x194);}return _0x3ff48d;};}function handleError(_0x1584b1,_0x31ffd7){_0x31ffd7=_0x31ffd7||0x1f4;return function(_0x523b40){logger[_0x29d9('0x1f')](_0x523b40[_0x29d9('0x30')]);if(_0x523b40[_0x29d9('0x31')]){delete _0x523b40[_0x29d9('0x31')];}_0x1584b1[_0x29d9('0x24')](_0x31ffd7)['send'](_0x523b40);};}exports[_0x29d9('0x32')]=function(_0x1b0999,_0x753805){var _0x2e5759={},_0x4332d7={},_0x2b0100={'count':0x0,'rows':[]};var _0x2623df=_['map'](db[_0x29d9('0x33')][_0x29d9('0x34')],function(_0x207da6){return{'name':_0x207da6[_0x29d9('0x35')],'type':_0x207da6[_0x29d9('0x36')][_0x29d9('0x37')]};});_0x4332d7['model']=_[_0x29d9('0x38')](_0x2623df,'name');_0x4332d7['query']=_['keys'](_0x1b0999[_0x29d9('0x39')]);_0x4332d7['filters']=_[_0x29d9('0x3a')](_0x4332d7[_0x29d9('0x3b')],_0x4332d7[_0x29d9('0x39')]);_0x2e5759[_0x29d9('0x3c')]=_[_0x29d9('0x3a')](_0x4332d7[_0x29d9('0x3b')],qs[_0x29d9('0x3d')](_0x1b0999[_0x29d9('0x39')][_0x29d9('0x3d')]));_0x2e5759[_0x29d9('0x3c')]=_0x2e5759[_0x29d9('0x3c')]['length']?_0x2e5759[_0x29d9('0x3c')]:_0x4332d7[_0x29d9('0x3b')];if(!_0x1b0999['query']['hasOwnProperty']('nolimit')){_0x2e5759[_0x29d9('0x2a')]=qs[_0x29d9('0x2a')](_0x1b0999[_0x29d9('0x39')][_0x29d9('0x2a')]);_0x2e5759[_0x29d9('0x27')]=qs['offset'](_0x1b0999[_0x29d9('0x39')][_0x29d9('0x27')]);}_0x2e5759[_0x29d9('0x3e')]=qs['sort'](_0x1b0999[_0x29d9('0x39')][_0x29d9('0x3f')]);_0x2e5759[_0x29d9('0x40')]=qs[_0x29d9('0x41')](_['pick'](_0x1b0999[_0x29d9('0x39')],_0x4332d7[_0x29d9('0x41')]),_0x2623df);if(_0x1b0999[_0x29d9('0x39')][_0x29d9('0x42')]){_0x2e5759['where']=_[_0x29d9('0x43')](_0x2e5759['where'],{'$or':_['map'](_0x2623df,function(_0x19e54f){if(_0x19e54f[_0x29d9('0x36')]!==_0x29d9('0x44')){var _0x4041e1={};_0x4041e1[_0x19e54f[_0x29d9('0x31')]]={'$like':'%'+_0x1b0999[_0x29d9('0x39')][_0x29d9('0x42')]+'%'};return _0x4041e1;}})});}_0x2e5759=_[_0x29d9('0x43')]({},_0x2e5759,_0x1b0999['options']);var _0xd633a0={'where':_0x2e5759['where']};return db['Setting'][_0x29d9('0x29')](_0xd633a0)['then'](function(_0x787bf1){_0x2b0100[_0x29d9('0x29')]=_0x787bf1;if(_0x1b0999[_0x29d9('0x39')][_0x29d9('0x45')]){_0x2e5759[_0x29d9('0x46')]=[{'all':!![]}];}return db['Setting']['findAll'](_0x2e5759);})[_0x29d9('0x18')](function(_0x31b647){_0x2b0100[_0x29d9('0x47')]=_0x31b647;return _0x2b0100;})[_0x29d9('0x18')](respondWithFilteredResult(_0x753805,_0x2e5759))[_0x29d9('0x48')](handleError(_0x753805,null));};exports[_0x29d9('0x49')]=function(_0x1a29f4,_0x3ab793){var _0xa4be4a={'raw':![],'where':{'id':_0x1a29f4[_0x29d9('0x4a')]['id']}},_0x3b13f3={};_0x3b13f3['model']=_[_0x29d9('0x4b')](db[_0x29d9('0x33')][_0x29d9('0x34')]);_0x3b13f3[_0x29d9('0x39')]=_[_0x29d9('0x4b')](_0x1a29f4[_0x29d9('0x39')]);_0x3b13f3['filters']=_[_0x29d9('0x3a')](_0x3b13f3['model'],_0x3b13f3[_0x29d9('0x39')]);_0xa4be4a[_0x29d9('0x3c')]=_['intersection'](_0x3b13f3[_0x29d9('0x3b')],qs['fields'](_0x1a29f4[_0x29d9('0x39')][_0x29d9('0x3d')]));_0xa4be4a[_0x29d9('0x3c')]=_0xa4be4a[_0x29d9('0x3c')]['length']?_0xa4be4a[_0x29d9('0x3c')]:_0x3b13f3['model'];if(_0x1a29f4['query'][_0x29d9('0x45')]){_0xa4be4a[_0x29d9('0x46')]=[{'all':!![]}];}_0xa4be4a=_[_0x29d9('0x43')]({},_0xa4be4a,_0x1a29f4[_0x29d9('0x4c')]);return db[_0x29d9('0x33')][_0x29d9('0x4d')](_0xa4be4a)[_0x29d9('0x18')](handleEntityNotFound(_0x3ab793,null))[_0x29d9('0x18')](respondWithResult(_0x3ab793,null))[_0x29d9('0x48')](handleError(_0x3ab793,null));};exports[_0x29d9('0x2e')]=function(_0x5164ef,_0x35b991){if(_0x5164ef[_0x29d9('0x4e')]['id']){delete _0x5164ef[_0x29d9('0x4e')]['id'];}return db[_0x29d9('0x33')]['find']({'where':{'id':_0x5164ef[_0x29d9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x35b991,null))['then'](saveUpdates(_0x5164ef['body'],null))['then'](respondWithResult(_0x35b991,null))[_0x29d9('0x48')](handleError(_0x35b991,null));};exports[_0x29d9('0x4f')]=function(_0x329e37,_0x34e0af,_0x28bf93){if(_0x329e37[_0x29d9('0x50')]&&_0x329e37[_0x29d9('0x50')]['filename']){_0x329e37[_0x29d9('0x4e')][_0x29d9('0x51')]=_0x329e37[_0x29d9('0x50')][_0x29d9('0x52')];}return db[_0x29d9('0x33')][_0x29d9('0x4d')]({'where':{'id':_0x329e37[_0x29d9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x34e0af,null))[_0x29d9('0x18')](saveUpdates(_0x329e37[_0x29d9('0x4e')],null))[_0x29d9('0x18')](respondWithResult(_0x34e0af,null))[_0x29d9('0x48')](handleError(_0x34e0af,null));};exports[_0x29d9('0x53')]=function(_0x1eb83e,_0x2d73be,_0x2cb3aa){if(_0x1eb83e[_0x29d9('0x50')]&&_0x1eb83e[_0x29d9('0x50')][_0x29d9('0x52')]){_0x1eb83e['body'][_0x29d9('0x54')]=_0x1eb83e[_0x29d9('0x50')]['filename'];}return db[_0x29d9('0x33')][_0x29d9('0x4d')]({'where':{'id':_0x1eb83e[_0x29d9('0x4a')]['id']}})[_0x29d9('0x18')](handleEntityNotFound(_0x2d73be,null))[_0x29d9('0x18')](saveUpdates(_0x1eb83e[_0x29d9('0x4e')],null))['then'](respondWithResult(_0x2d73be,null))[_0x29d9('0x48')](handleError(_0x2d73be,null));};var utilLicense=require('../../config/license/util');exports[_0x29d9('0x55')]=function(_0x1e8a1e,_0x2207cc,_0xed4f78){var _0x464f4a=_0x29d9('0x56');var _0x4ef90e={'custom':![]};return utilLicense['getLicense']()[_0x29d9('0x18')](function(_0x3e6c68){if(_0x3e6c68){_0x4ef90e=_0x3e6c68;}return db[_0x29d9('0x33')][_0x29d9('0x4d')]({'where':{'id':_0x1e8a1e['params']['id']},'attributes':['logo',_0x29d9('0x54'),_0x29d9('0x57'),_0x29d9('0x58'),_0x29d9('0x59'),_0x29d9('0x5a'),_0x29d9('0x5b'),_0x29d9('0x5c')],'raw':!![]});})[_0x29d9('0x18')](handleEntityNotFound(_0x2207cc,null))['then'](function(_0x3510e7){if(_0x3510e7){var _0x1e51fe=_0x3510e7[_0x29d9('0x51')]&&fs[_0x29d9('0x5d')](path['join'](config[_0x29d9('0x5e')],_0x464f4a,_['toLower'](_0x3510e7[_0x29d9('0x51')])))?path['join'](config[_0x29d9('0x5e')],_0x464f4a,_[_0x29d9('0x5f')](_0x3510e7[_0x29d9('0x51')])):path[_0x29d9('0x60')](config['root'],_0x464f4a,_['toLower'](_0x29d9('0x61')));var _0x3f00ee=_0x29d9('0x62')+_[_0x29d9('0x63')]('logo');if(_0x3510e7[_0x3f00ee]||!_0x4ef90e[_0x29d9('0x64')]){_0x1e51fe=path['join'](config[_0x29d9('0x5e')],_0x464f4a,_['toLower'](_0x29d9('0x61')));}if(!fs['existsSync'](_0x1e51fe)){throw new db[(_0x29d9('0x65'))][(_0x29d9('0x66'))](_[_0x29d9('0x63')](_0x29d9('0x51'))+_0x29d9('0x67'));}return _0x2207cc['download'](_0x1e51fe);}})[_0x29d9('0x48')](handleError(_0x2207cc,null));};var utilLicense=require(_0x29d9('0x14'));exports[_0x29d9('0x68')]=function(_0x41a887,_0x2567d0,_0x21f84d){var _0x976a66=_0x29d9('0x56');var _0x18fadc={'custom':![]};return utilLicense[_0x29d9('0x69')]()['then'](function(_0x5147b3){if(_0x5147b3){_0x18fadc=_0x5147b3;}return db['Setting'][_0x29d9('0x4d')]({'where':{'id':_0x41a887[_0x29d9('0x4a')]['id']},'attributes':[_0x29d9('0x51'),'loginLogo','preferred',_0x29d9('0x58'),_0x29d9('0x59'),'defaultLoginLogo','defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x29d9('0x18')](handleEntityNotFound(_0x2567d0,null))[_0x29d9('0x18')](function(_0x48effa){if(_0x48effa){var _0x19e347=_0x48effa[_0x29d9('0x54')]&&fs[_0x29d9('0x5d')](path['join'](config[_0x29d9('0x5e')],_0x976a66,_[_0x29d9('0x5f')](_0x48effa[_0x29d9('0x54')])))?path[_0x29d9('0x60')](config[_0x29d9('0x5e')],_0x976a66,_[_0x29d9('0x5f')](_0x48effa[_0x29d9('0x54')])):path[_0x29d9('0x60')](config['root'],_0x976a66,_[_0x29d9('0x5f')](_0x29d9('0x6a')));var _0x23d5a8=_0x29d9('0x62')+_[_0x29d9('0x63')](_0x29d9('0x54'));if(_0x48effa[_0x23d5a8]||!_0x18fadc[_0x29d9('0x64')]){_0x19e347=path['join'](config['root'],_0x976a66,_[_0x29d9('0x5f')](_0x29d9('0x6a')));}if(!fs[_0x29d9('0x5d')](_0x19e347)){throw new db[(_0x29d9('0x65'))][(_0x29d9('0x66'))](_[_0x29d9('0x63')]('loginLogo')+'\x20not\x20found');}return _0x2567d0[_0x29d9('0x6b')](_0x19e347);}})['catch'](handleError(_0x2567d0,null));};exports[_0x29d9('0x6c')]=function(_0x3d0ff9,_0x178b4c){return db[_0x29d9('0x33')]['find']({'where':{'id':_0x3d0ff9[_0x29d9('0x4a')]['id']},'attributes':[_0x29d9('0x6d')]})['then'](respondWithResult(_0x178b4c,null))[_0x29d9('0x48')](handleError(_0x178b4c,null));};exports[_0x29d9('0x6e')]=function(_0x3e3742,_0x4ee5d1,_0x2e1e52){if(_0x3e3742[_0x29d9('0x50')]&&_0x3e3742[_0x29d9('0x50')][_0x29d9('0x52')]){_0x3e3742[_0x29d9('0x4e')][_0x29d9('0x57')]=_0x3e3742[_0x29d9('0x50')][_0x29d9('0x52')];}return db[_0x29d9('0x33')][_0x29d9('0x4d')]({'where':{'id':_0x3e3742['params']['id']}})[_0x29d9('0x18')](handleEntityNotFound(_0x4ee5d1,null))[_0x29d9('0x18')](saveUpdates(_0x3e3742[_0x29d9('0x4e')],null))['then'](respondWithResult(_0x4ee5d1,null))[_0x29d9('0x48')](handleError(_0x4ee5d1,null));};var utilLicense=require(_0x29d9('0x14'));exports['getPreferred']=function(_0x4983f6,_0x70bc5c,_0x2c3bfa){var _0x473b06='server/files/images/logos';var _0x571fe={'custom':![]};return utilLicense[_0x29d9('0x69')]()[_0x29d9('0x18')](function(_0x3a3110){if(_0x3a3110){_0x571fe=_0x3a3110;}return db[_0x29d9('0x33')][_0x29d9('0x4d')]({'where':{'id':_0x4983f6[_0x29d9('0x4a')]['id']},'attributes':['logo','loginLogo',_0x29d9('0x57'),_0x29d9('0x58'),'defaultLogo','defaultLoginLogo',_0x29d9('0x5b'),_0x29d9('0x5c')],'raw':!![]});})[_0x29d9('0x18')](handleEntityNotFound(_0x70bc5c,null))[_0x29d9('0x18')](function(_0x144aaf){if(_0x144aaf){var _0x6375b7=_0x144aaf[_0x29d9('0x57')]&&fs['existsSync'](path[_0x29d9('0x60')](config[_0x29d9('0x5e')],_0x473b06,_['toLower'](_0x144aaf['preferred'])))?path[_0x29d9('0x60')](config[_0x29d9('0x5e')],_0x473b06,_['toLower'](_0x144aaf['preferred'])):path['join'](config[_0x29d9('0x5e')],_0x473b06,_['toLower']('default_preferred.png'));var _0x2896c6=_0x29d9('0x62')+_[_0x29d9('0x63')](_0x29d9('0x57'));if(_0x144aaf[_0x2896c6]||!_0x571fe['custom']||!_0x571fe['preferred']){_0x6375b7=path['join'](config[_0x29d9('0x5e')],_0x473b06,_[_0x29d9('0x5f')]('default_preferred.png'));}if(!fs['existsSync'](_0x6375b7)){throw new db[(_0x29d9('0x65'))][(_0x29d9('0x66'))](_['upperFirst'](_0x29d9('0x57'))+_0x29d9('0x67'));}return _0x70bc5c[_0x29d9('0x6b')](_0x6375b7);}})['catch'](handleError(_0x70bc5c,null));};exports[_0x29d9('0x6f')]=function(_0xfdc313,_0x147c2c,_0xa649e3){if(_0xfdc313[_0x29d9('0x50')]&&_0xfdc313[_0x29d9('0x50')]['filename']){_0xfdc313['body']['favicon']=_0xfdc313[_0x29d9('0x50')][_0x29d9('0x52')];}return db['Setting'][_0x29d9('0x4d')]({'where':{'id':_0xfdc313[_0x29d9('0x4a')]['id']}})[_0x29d9('0x18')](handleEntityNotFound(_0x147c2c,null))[_0x29d9('0x18')](saveUpdates(_0xfdc313[_0x29d9('0x4e')],null))[_0x29d9('0x18')](respondWithResult(_0x147c2c,null))['catch'](handleError(_0x147c2c,null));};var utilLicense=require(_0x29d9('0x14'));exports[_0x29d9('0x70')]=function(_0x3010e9,_0x5d9e10,_0x1d4f66){var _0x4ef974=_0x29d9('0x56');var _0x574454={'custom':![]};return utilLicense[_0x29d9('0x69')]()[_0x29d9('0x18')](function(_0x57be10){if(_0x57be10){_0x574454=_0x57be10;}return db[_0x29d9('0x33')][_0x29d9('0x4d')]({'where':{'id':_0x3010e9[_0x29d9('0x4a')]['id']},'attributes':['logo',_0x29d9('0x54'),_0x29d9('0x57'),'favicon',_0x29d9('0x59'),_0x29d9('0x5a'),_0x29d9('0x5b'),_0x29d9('0x5c')],'raw':!![]});})[_0x29d9('0x18')](handleEntityNotFound(_0x5d9e10,null))['then'](function(_0x276e88){if(_0x276e88){var _0x45ff8c=_0x276e88[_0x29d9('0x58')]&&fs[_0x29d9('0x5d')](path[_0x29d9('0x60')](config['root'],_0x4ef974,_['toLower'](_0x276e88[_0x29d9('0x58')])))?path[_0x29d9('0x60')](config[_0x29d9('0x5e')],_0x4ef974,_[_0x29d9('0x5f')](_0x276e88['favicon'])):path[_0x29d9('0x60')](config[_0x29d9('0x5e')],_0x4ef974,_[_0x29d9('0x5f')](_0x29d9('0x71')));var _0x37bee2=_0x29d9('0x62')+_[_0x29d9('0x63')]('favicon');if(_0x276e88[_0x37bee2]||!_0x574454[_0x29d9('0x64')]){_0x45ff8c=path[_0x29d9('0x60')](config[_0x29d9('0x5e')],_0x4ef974,_[_0x29d9('0x5f')](_0x29d9('0x71')));}if(!fs[_0x29d9('0x5d')](_0x45ff8c)){throw new db['Sequelize'][(_0x29d9('0x66'))](_['upperFirst'](_0x29d9('0x58'))+_0x29d9('0x67'));}return _0x5d9e10[_0x29d9('0x6b')](_0x45ff8c);}})[_0x29d9('0x48')](handleError(_0x5d9e10,null));};exports[_0x29d9('0x72')]=function(_0x4a9978,_0x34c75f){var _0x477d74={'offset':moment()['utcOffset']()};_0x477d74['now']=moment()[_0x29d9('0x73')](_0x477d74[_0x29d9('0x27')])['format'](_0x29d9('0x74'));return _0x34c75f[_0x29d9('0x24')](0xc8)[_0x29d9('0x75')](_0x477d74);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index bad41bf..77d53c1 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 _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2a1b33,_0x409f50){var _0x4c50e7=function(_0x13e16d){while(--_0x13e16d){_0x2a1b33['push'](_0x2a1b33['shift']());}};_0x4c50e7(++_0x409f50);}(_0x7217,0x19e));var _0x7721=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x7217[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x55ca,0x126));var _0xa55c=function(_0x4fa665,_0x1ae12a){_0x4fa665=_0x4fa665-0x0;var _0x62ccff=_0x55ca[_0x4fa665];return _0x62ccff;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 5702345..8d23ffd 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 _0x2fd0=['Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','Setting','find','options','raw','where','include','model','attributes','map','ShowSetting','stringify','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x391c2b,_0x4f6068){var _0x3ce26b=function(_0x386a3e){while(--_0x386a3e){_0x391c2b['push'](_0x391c2b['shift']());}};_0x3ce26b(++_0x4f6068);}(_0x2fd0,0x102));var _0x02fd=function(_0x43fb15,_0x4b3f5b){_0x43fb15=_0x43fb15-0x0;var _0x42d47a=_0x2fd0[_0x43fb15];return _0x42d47a;};'use strict';var _=require(_0x02fd('0x0'));var util=require(_0x02fd('0x1'));var moment=require(_0x02fd('0x2'));var BPromise=require(_0x02fd('0x3'));var rs=require(_0x02fd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x02fd('0x5'))['db'];var utils=require(_0x02fd('0x6'));var logger=require('../../config/logger')(_0x02fd('0x7'));var config=require(_0x02fd('0x8'));var jayson=require(_0x02fd('0x9'));var client=jayson['client'][_0x02fd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5457b6,_0x3c0dba,_0x635a8e){return new BPromise(function(_0x93baa4,_0x2c4de2){return client[_0x02fd('0xb')](_0x5457b6,_0x635a8e)[_0x02fd('0xc')](function(_0xc2fcb3){logger[_0x02fd('0xd')](_0x02fd('0xe'),_0x3c0dba,_0x02fd('0xf'));logger[_0x02fd('0x10')](_0x02fd('0x11'),_0x3c0dba,_0x02fd('0xf'),JSON['stringify'](_0xc2fcb3));if(_0xc2fcb3[_0x02fd('0x12')]){if(_0xc2fcb3['error'][_0x02fd('0x13')]===0x1f4){logger[_0x02fd('0x12')](_0x02fd('0xe'),_0x3c0dba,_0xc2fcb3[_0x02fd('0x12')][_0x02fd('0x14')]);return _0x2c4de2(_0xc2fcb3[_0x02fd('0x12')][_0x02fd('0x14')]);}logger[_0x02fd('0x12')](_0x02fd('0xe'),_0x3c0dba,_0xc2fcb3[_0x02fd('0x12')]['message']);return _0x93baa4(_0xc2fcb3[_0x02fd('0x12')][_0x02fd('0x14')]);}else{logger[_0x02fd('0xd')]('Setting,\x20%s,\x20%s',_0x3c0dba,'request\x20sent');_0x93baa4(_0xc2fcb3[_0x02fd('0x15')][_0x02fd('0x14')]);}})['catch'](function(_0x5636b1){logger[_0x02fd('0x12')](_0x02fd('0xe'),_0x3c0dba,_0x5636b1);_0x2c4de2(_0x5636b1);});});}exports['ShowSetting']=function(_0x425193){var _0x16d7b1=this;return new Promise(function(_0x589b7c,_0x1007a3){return db[_0x02fd('0x16')][_0x02fd('0x17')]({'raw':_0x425193['options']?_0x425193[_0x02fd('0x18')][_0x02fd('0x19')]===undefined?!![]:![]:!![],'where':_0x425193[_0x02fd('0x18')]?_0x425193[_0x02fd('0x18')][_0x02fd('0x1a')]||null:null,'attributes':_0x425193[_0x02fd('0x18')]?_0x425193[_0x02fd('0x18')]['attributes']||null:null,'include':_0x425193[_0x02fd('0x18')]?_0x425193[_0x02fd('0x18')][_0x02fd('0x1b')]?_['map'](_0x425193[_0x02fd('0x18')][_0x02fd('0x1b')],function(_0x3a1004){return{'model':db[_0x3a1004[_0x02fd('0x1c')]],'as':_0x3a1004['as'],'attributes':_0x3a1004[_0x02fd('0x1d')],'include':_0x3a1004['include']?_[_0x02fd('0x1e')](_0x3a1004[_0x02fd('0x1b')],function(_0x51875d){return{'model':db[_0x51875d[_0x02fd('0x1c')]],'as':_0x51875d['as'],'attributes':_0x51875d[_0x02fd('0x1d')],'include':_0x51875d[_0x02fd('0x1b')]?_[_0x02fd('0x1e')](_0x51875d[_0x02fd('0x1b')],function(_0x291cec){return{'model':db[_0x291cec[_0x02fd('0x1c')]],'as':_0x291cec['as'],'attributes':_0x291cec[_0x02fd('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xcc7c8a){logger[_0x02fd('0xd')](_0x02fd('0x1f'),_0x425193);logger[_0x02fd('0x10')]('ShowSetting',_0x425193,JSON[_0x02fd('0x20')](_0xcc7c8a));_0x589b7c(_0xcc7c8a);})[_0x02fd('0x21')](function(_0x308c3f){logger[_0x02fd('0x12')]('ShowSetting',_0x308c3f[_0x02fd('0x14')],_0x425193);_0x1007a3(_0x16d7b1[_0x02fd('0x12')](0x1f4,_0x308c3f[_0x02fd('0x14')]));});});}; \ No newline at end of file +var _0x3a16=['ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','find','options','raw','where','include','map','attributes','model','ShowSetting','stringify','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x2312d3,_0x277d99){var _0x446418=function(_0x14e280){while(--_0x14e280){_0x2312d3['push'](_0x2312d3['shift']());}};_0x446418(++_0x277d99);}(_0x3a16,0x11b));var _0x63a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a16[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x63a1('0x0'));var util=require(_0x63a1('0x1'));var moment=require(_0x63a1('0x2'));var BPromise=require(_0x63a1('0x3'));var rs=require(_0x63a1('0x4'));var fs=require('fs');var Redis=require(_0x63a1('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x63a1('0x6'))('rpc');var config=require(_0x63a1('0x7'));var jayson=require(_0x63a1('0x8'));var client=jayson[_0x63a1('0x9')][_0x63a1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36ad7c,_0x1450b1,_0x1a7be5){return new BPromise(function(_0x303c5f,_0x30f32e){return client['request'](_0x36ad7c,_0x1a7be5)[_0x63a1('0xb')](function(_0x42deb0){logger[_0x63a1('0xc')](_0x63a1('0xd'),_0x1450b1,_0x63a1('0xe'));logger[_0x63a1('0xf')](_0x63a1('0x10'),_0x1450b1,_0x63a1('0xe'),JSON['stringify'](_0x42deb0));if(_0x42deb0[_0x63a1('0x11')]){if(_0x42deb0['error'][_0x63a1('0x12')]===0x1f4){logger[_0x63a1('0x11')](_0x63a1('0xd'),_0x1450b1,_0x42deb0[_0x63a1('0x11')]['message']);return _0x30f32e(_0x42deb0[_0x63a1('0x11')][_0x63a1('0x13')]);}logger[_0x63a1('0x11')](_0x63a1('0xd'),_0x1450b1,_0x42deb0[_0x63a1('0x11')][_0x63a1('0x13')]);return _0x303c5f(_0x42deb0['error'][_0x63a1('0x13')]);}else{logger[_0x63a1('0xc')](_0x63a1('0xd'),_0x1450b1,_0x63a1('0xe'));_0x303c5f(_0x42deb0[_0x63a1('0x14')]['message']);}})['catch'](function(_0x231e24){logger[_0x63a1('0x11')](_0x63a1('0xd'),_0x1450b1,_0x231e24);_0x30f32e(_0x231e24);});});}exports['ShowSetting']=function(_0x55f11d){var _0x1fd845=this;return new Promise(function(_0x5c3df6,_0x4ce59b){return db['Setting'][_0x63a1('0x15')]({'raw':_0x55f11d[_0x63a1('0x16')]?_0x55f11d['options'][_0x63a1('0x17')]===undefined?!![]:![]:!![],'where':_0x55f11d[_0x63a1('0x16')]?_0x55f11d['options'][_0x63a1('0x18')]||null:null,'attributes':_0x55f11d['options']?_0x55f11d[_0x63a1('0x16')]['attributes']||null:null,'include':_0x55f11d['options']?_0x55f11d[_0x63a1('0x16')][_0x63a1('0x19')]?_[_0x63a1('0x1a')](_0x55f11d[_0x63a1('0x16')][_0x63a1('0x19')],function(_0x62c1ab){return{'model':db[_0x62c1ab['model']],'as':_0x62c1ab['as'],'attributes':_0x62c1ab['attributes'],'include':_0x62c1ab[_0x63a1('0x19')]?_[_0x63a1('0x1a')](_0x62c1ab[_0x63a1('0x19')],function(_0xb8c4a){return{'model':db[_0xb8c4a['model']],'as':_0xb8c4a['as'],'attributes':_0xb8c4a[_0x63a1('0x1b')],'include':_0xb8c4a[_0x63a1('0x19')]?_['map'](_0xb8c4a[_0x63a1('0x19')],function(_0x315d0a){return{'model':db[_0x315d0a[_0x63a1('0x1c')]],'as':_0x315d0a['as'],'attributes':_0x315d0a[_0x63a1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x63a1('0xb')](function(_0x279620){logger[_0x63a1('0xc')](_0x63a1('0x1d'),_0x55f11d);logger[_0x63a1('0xf')](_0x63a1('0x1d'),_0x55f11d,JSON[_0x63a1('0x1e')](_0x279620));_0x5c3df6(_0x279620);})[_0x63a1('0x1f')](function(_0x2b4f04){logger[_0x63a1('0x11')](_0x63a1('0x1d'),_0x2b4f04['message'],_0x55f11d);_0x4ce59b(_0x1fd845[_0x63a1('0x11')](0x1f4,_0x2b4f04[_0x63a1('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 83fb09c..2c5d730 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 _0xf494=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','getAgents','post','/:id/applications','addApplications','/:id/send','send','/:id/users','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf494,0x1c6));var _0x4f49=function(_0x364222,_0x299a9f){_0x364222=_0x364222-0x0;var _0x5e1715=_0xf494[_0x364222];return _0x5e1715;};'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')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0xc')]);router[_0x4f49('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xa')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0xa')](_0x4f49('0x10'),auth[_0x4f49('0xb')](),controller['getDispositions']);router[_0x4f49('0xa')](_0x4f49('0x11'),auth['isAuthenticated'](),controller[_0x4f49('0x12')]);router['get']('/:id/applications',auth[_0x4f49('0xb')](),controller[_0x4f49('0x13')]);router['get'](_0x4f49('0x14'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x15')]);router[_0x4f49('0xa')](_0x4f49('0x16'),controller[_0x4f49('0x17')]);router[_0x4f49('0xa')]('/:id/users',auth[_0x4f49('0xb')](),controller[_0x4f49('0x18')]);router[_0x4f49('0x19')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4f49('0x19')](_0x4f49('0x10'),auth[_0x4f49('0xb')](),controller['addDisposition']);router[_0x4f49('0x19')](_0x4f49('0x11'),auth[_0x4f49('0xb')](),controller['addAnswer']);router['post']('/:id/notify',controller['notify']);router[_0x4f49('0x19')](_0x4f49('0x1a'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x1b')]);router['post'](_0x4f49('0x1c'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x1d')]);router[_0x4f49('0x19')](_0x4f49('0x16'),controller['status']);router[_0x4f49('0x19')](_0x4f49('0x1e'),auth[_0x4f49('0xb')](),controller['addAgents']);router[_0x4f49('0x1f')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x20')]);router[_0x4f49('0x21')](_0x4f49('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0x4f49('0x21')](_0x4f49('0x10'),auth['isAuthenticated'](),controller[_0x4f49('0x22')]);router[_0x4f49('0x21')](_0x4f49('0x11'),auth['isAuthenticated'](),controller[_0x4f49('0x23')]);router[_0x4f49('0x21')](_0x4f49('0x1e'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x24')]);module[_0x4f49('0x25')]=router; \ No newline at end of file +var _0xe14b=['./smsAccount.controller','get','isAuthenticated','index','/describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','put','update','/:id','destroy','removeDispositions','delete','/:id/users','removeAgents','multer','util','express','Router','../../components/auth/service'];(function(_0x539ce1,_0x4a65eb){var _0x20be8e=function(_0x45efa4){while(--_0x45efa4){_0x539ce1['push'](_0x539ce1['shift']());}};_0x20be8e(++_0x4a65eb);}(_0xe14b,0x93));var _0xbe14=function(_0x59ae6b,_0x1c0fe9){_0x59ae6b=_0x59ae6b-0x0;var _0x28b254=_0xe14b[_0x59ae6b];return _0x28b254;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x6')](_0xbe14('0x10'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x6')](_0xbe14('0x12'),controller[_0xbe14('0x13')]);router[_0xbe14('0x6')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x14')]);router[_0xbe14('0x15')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x16')]);router['post'](_0xbe14('0xb'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x15')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);router['post'](_0xbe14('0x19'),controller[_0xbe14('0x1a')]);router[_0xbe14('0x15')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x1b')]);router['post'](_0xbe14('0x1c'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x1d')]);router[_0xbe14('0x15')](_0xbe14('0x12'),controller['status']);router[_0xbe14('0x15')]('/:id/users',auth[_0xbe14('0x7')](),controller['addAgents']);router[_0xbe14('0x1e')]('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0x1f')]);router['delete'](_0xbe14('0x20'),auth['isAuthenticated'](),controller[_0xbe14('0x21')]);router['delete'](_0xbe14('0xb'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x22')]);router[_0xbe14('0x23')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeAnswers']);router[_0xbe14('0x23')](_0xbe14('0x24'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x25')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 6334110..3fcbabe 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 _0xef82=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','ENUM','twilio','skebby','connectel','clicksend','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x1334d5,_0x3f368c){var _0x14146b=function(_0x5cb035){while(--_0x5cb035){_0x1334d5['push'](_0x1334d5['shift']());}};_0x14146b(++_0x3f368c);}(_0xef82,0x124));var _0x2ef8=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xef82[_0x4a53d];return _0x27410e;};'use strict';var Sequelize=require(_0x2ef8('0x0'));var rs=require(_0x2ef8('0x1'));module[_0x2ef8('0x2')]={'name':{'type':Sequelize[_0x2ef8('0x3')],'unique':_0x2ef8('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x2ef8('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x2ef8('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x2ef8('0x3')]},'type':{'type':Sequelize[_0x2ef8('0x5')](_0x2ef8('0x6'),_0x2ef8('0x7'),_0x2ef8('0x8'),_0x2ef8('0x9'),'plivo','clickatell','bandwidth','csc','infobip','intelepeer')},'accountSid':{'type':Sequelize[_0x2ef8('0x3')]},'authId':{'type':Sequelize[_0x2ef8('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x2ef8('0x3')]},'password':{'type':Sequelize[_0x2ef8('0x3')]},'apiKey':{'type':Sequelize[_0x2ef8('0x3')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x2ef8('0x3')]},'senderString':{'type':Sequelize[_0x2ef8('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x2ef8('0x3')]},'notificationTemplate':{'type':Sequelize[_0x2ef8('0xa')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x2ef8('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2ef8('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2ef8('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2ef8('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2ef8('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x2ef8('0xb')],'defaultValue':![],'comment':_0x2ef8('0xd'),'set':function(_0x4e929f){if(!_0x4e929f)this[_0x2ef8('0xe')](_0x2ef8('0xf'),null);this[_0x2ef8('0xe')](_0x2ef8('0x10'),_0x4e929f);}}}; \ No newline at end of file +var _0x224a=['ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate'];(function(_0x474d97,_0x5909ce){var _0x1edf25=function(_0x2831df){while(--_0x2831df){_0x474d97['push'](_0x474d97['shift']());}};_0x1edf25(++_0x5909ce);}(_0x224a,0x8b));var _0xa224=function(_0x5ed937,_0x3e0db8){_0x5ed937=_0x5ed937-0x0;var _0x3c0cf6=_0x224a[_0x5ed937];return _0x3c0cf6;};'use strict';var Sequelize=require(_0xa224('0x0'));var rs=require(_0xa224('0x1'));module[_0xa224('0x2')]={'name':{'type':Sequelize[_0xa224('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xa224('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xa224('0x3')],'defaultValue':function(){return rs[_0xa224('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa224('0x5')](_0xa224('0x6'),_0xa224('0x7'),_0xa224('0x8'),_0xa224('0x9'),_0xa224('0xa'),_0xa224('0xb'),_0xa224('0xc'),_0xa224('0xd'),_0xa224('0xe'),_0xa224('0xf'))},'accountSid':{'type':Sequelize[_0xa224('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xa224('0x3')]},'smsMethod':{'type':Sequelize[_0xa224('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xa224('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0xa224('0x3')]},'senderString':{'type':Sequelize[_0xa224('0x3')]},'deliveryReport':{'type':Sequelize[_0xa224('0x10')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xa224('0x11')],'defaultValue':function(){return _0xa224('0x12');}},'notificationSound':{'type':Sequelize[_0xa224('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa224('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa224('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa224('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa224('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa224('0x13')],'comment':_0xa224('0x14')},'mandatoryDisposition':{'type':Sequelize[_0xa224('0x10')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xdecf78){if(!_0xdecf78)this['setDataValue'](_0xa224('0x15'),null);this[_0xa224('0x16')](_0xa224('0x17'),_0xdecf78);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 285274a..a0b282d 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 _0xcfcb=['bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','to\x20is\x20mandatory','List','Messages','spread','dataValues','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','statusInt','requestid','status_code','groupName','DELIVERED','clickatell','redif','connectel','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','limit','count','set','reject','save','update','destroy','get','SmsAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','map','options','SmsAccount','includeAll','include','rows','catch','show','params','merge','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','body','describe','addDisposition','SmsAccountId','Disposition','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','order','removeAnswers','sms','Applications','account','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','twilio','from','From','Body','messageId','MessageSid','sender','text','clicksend','message_id','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','fromNumber','replyMessageId','bandwidth','intelepeer','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','CmList','ListId','CmContact','Contacts','DESC','list','SmsInteraction','interaction','created','applications','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','startRouting','Start','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','addApplications','SmsApplication'];(function(_0x8f3d3,_0x5bec91){var _0xaf125d=function(_0x119c4e){while(--_0x119c4e){_0x8f3d3['push'](_0x8f3d3['shift']());}};_0xaf125d(++_0x5bec91);}(_0xcfcb,0x110));var _0xbcfc=function(_0x3359b0,_0x13700a){_0x3359b0=_0x3359b0-0x0;var _0x2e823b=_0xcfcb[_0x3359b0];return _0x2e823b;};'use strict';var emlformat=require(_0xbcfc('0x0'));var rimraf=require(_0xbcfc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbcfc('0x2'));var moment=require(_0xbcfc('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbcfc('0x4'));var path=require(_0xbcfc('0x5'));var sox=require('sox');var csv=require(_0xbcfc('0x6'));var ejs=require(_0xbcfc('0x7'));var fs=require('fs');var fs_extra=require(_0xbcfc('0x8'));var _=require(_0xbcfc('0x9'));var squel=require(_0xbcfc('0xa'));var crypto=require(_0xbcfc('0xb'));var jsforce=require(_0xbcfc('0xc'));var deskjs=require(_0xbcfc('0xd'));var toCsv=require('to-csv');var querystring=require(_0xbcfc('0xe'));var Papa=require(_0xbcfc('0xf'));var Redis=require(_0xbcfc('0x10'));var authService=require(_0xbcfc('0x11'));var qs=require(_0xbcfc('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbcfc('0x13'));var logger=require(_0xbcfc('0x14'))(_0xbcfc('0x15'));var utils=require(_0xbcfc('0x16'));var config=require(_0xbcfc('0x17'));var licenseUtil=require(_0xbcfc('0x18'));var db=require(_0xbcfc('0x19'))['db'];config['redis']=_[_0xbcfc('0x1a')](config[_0xbcfc('0x1b')],{'host':_0xbcfc('0x1c'),'port':0x18eb});var socket=require(_0xbcfc('0x1d'))(new Redis(config[_0xbcfc('0x1b')]));require(_0xbcfc('0x1e'))[_0xbcfc('0x1f')](socket);var jayson=require(_0xbcfc('0x20'));var client=jayson[_0xbcfc('0x21')]['http']({'port':0x232c});function respondWithRpcPromise(_0x12a527,_0x33a99e,_0x3ec725,_0x1baef7){return new BPromise(function(_0x764c80,_0x136e72){var _0x5d2998=_0x1baef7||client;return _0x5d2998['request'](_0x12a527,_0x3ec725)[_0xbcfc('0x22')](function(_0xd89294){logger[_0xbcfc('0x23')](_0xbcfc('0x24'),_0x33a99e,_0xbcfc('0x25'));logger['debug'](_0xbcfc('0x26'),_0x33a99e,_0xbcfc('0x25'),JSON[_0xbcfc('0x27')](_0xd89294));if(_0xd89294[_0xbcfc('0x28')]){if(_0xd89294[_0xbcfc('0x28')][_0xbcfc('0x29')]===0x1f4){logger[_0xbcfc('0x28')]('SmsAccount,\x20%s,\x20%s',_0x33a99e,_0xd89294[_0xbcfc('0x28')][_0xbcfc('0x2a')]);return _0x136e72(_0xd89294[_0xbcfc('0x28')]['message']);}logger[_0xbcfc('0x28')]('SmsAccount,\x20%s,\x20%s',_0x33a99e,_0xd89294[_0xbcfc('0x28')][_0xbcfc('0x2a')]);return _0x764c80(_0xd89294[_0xbcfc('0x28')][_0xbcfc('0x2a')]);}else{logger[_0xbcfc('0x23')](_0xbcfc('0x24'),_0x33a99e,_0xbcfc('0x25'));_0x764c80(_0xd89294[_0xbcfc('0x2b')][_0xbcfc('0x2a')]);}})['catch'](function(_0x2dccfc){logger[_0xbcfc('0x28')](_0xbcfc('0x24'),_0x33a99e,_0x2dccfc);_0x136e72(_0x2dccfc);});});}function respondWithStatusCode(_0x28997e,_0x553c5d){_0x553c5d=_0x553c5d||0xcc;return function(_0x122d61){if(_0x122d61){return _0x28997e[_0xbcfc('0x2c')](_0x553c5d);}return _0x28997e[_0xbcfc('0x2d')](_0x553c5d)[_0xbcfc('0x2e')]();};}function respondWithResult(_0x416856,_0x9b12d6){_0x9b12d6=_0x9b12d6||0xc8;return function(_0x50f6bd){if(_0x50f6bd){return _0x416856[_0xbcfc('0x2d')](_0x9b12d6)[_0xbcfc('0x2f')](_0x50f6bd);}};}function respondWithFilteredResult(_0x426437,_0x1ff15d){return function(_0x161dff){if(_0x161dff){var _0x5e0e4d=typeof _0x1ff15d[_0xbcfc('0x30')]==='undefined'&&typeof _0x1ff15d[_0xbcfc('0x31')]==='undefined';var _0x5bb415=_0x161dff[_0xbcfc('0x32')];var _0xe9e660=_0x5e0e4d?0x0:_0x1ff15d['offset'];var _0x5835aa=_0x5e0e4d?_0x161dff[_0xbcfc('0x32')]:_0x1ff15d[_0xbcfc('0x30')]+_0x1ff15d['limit'];var _0x34f3a6;if(_0x5835aa>=_0x5bb415){_0x5835aa=_0x5bb415;_0x34f3a6=0xc8;}else{_0x34f3a6=0xce;}_0x426437[_0xbcfc('0x2d')](_0x34f3a6);return _0x426437[_0xbcfc('0x33')]('Content-Range',_0xe9e660+'-'+_0x5835aa+'/'+_0x5bb415)['json'](_0x161dff);}return null;};}function patchUpdates(_0x56f76e){return function(_0x287300){try{jsonpatch['apply'](_0x287300,_0x56f76e,!![]);}catch(_0x2729eb){return BPromise[_0xbcfc('0x34')](_0x2729eb);}return _0x287300[_0xbcfc('0x35')]();};}function saveUpdates(_0x5711b0,_0x38aa27){return function(_0x237dd6){if(_0x237dd6){return _0x237dd6[_0xbcfc('0x36')](_0x5711b0)['then'](function(_0x1bc7a4){return _0x1bc7a4;});}return null;};}function removeEntity(_0x2f142d,_0x292260){return function(_0x988cd0){if(_0x988cd0){return _0x988cd0[_0xbcfc('0x37')]()[_0xbcfc('0x22')](function(){var _0x4fed25=_0x988cd0[_0xbcfc('0x38')]({'plain':!![]});var _0x5acb7c=_0xbcfc('0x39');return db['UserProfileResource']['destroy']({'where':{'type':_0x5acb7c,'resourceId':_0x4fed25['id']}})[_0xbcfc('0x22')](function(){return _0x988cd0;});})[_0xbcfc('0x22')](function(){_0x2f142d[_0xbcfc('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbd54ee,_0x3018f6){return function(_0xf4d476){if(!_0xf4d476){_0xbd54ee['sendStatus'](0x194);}return _0xf4d476;};}function handleError(_0x480aa4,_0x131fd5){_0x131fd5=_0x131fd5||0x1f4;return function(_0x11dacd){logger[_0xbcfc('0x28')](_0x11dacd[_0xbcfc('0x3a')]);if(_0x11dacd['name']){delete _0x11dacd[_0xbcfc('0x3b')];}_0x480aa4[_0xbcfc('0x2d')](_0x131fd5)[_0xbcfc('0x3c')](_0x11dacd);};}exports[_0xbcfc('0x3d')]=function(_0x87aae7,_0x49a881){var _0x588eac={'include':[{'model':db[_0xbcfc('0x3e')],'as':_0xbcfc('0x3f')}]},_0x3db2f6={},_0x321f44={'count':0x0,'rows':[]};var _0x118765=_['map'](db['SmsAccount'][_0xbcfc('0x40')],function(_0x11418b){return{'name':_0x11418b[_0xbcfc('0x41')],'type':_0x11418b[_0xbcfc('0x42')][_0xbcfc('0x43')]};});_0x3db2f6[_0xbcfc('0x44')]=_['map'](_0x118765,_0xbcfc('0x3b'));_0x3db2f6['query']=_[_0xbcfc('0x45')](_0x87aae7[_0xbcfc('0x46')]);_0x3db2f6[_0xbcfc('0x47')]=_['intersection'](_0x3db2f6['model'],_0x3db2f6[_0xbcfc('0x46')]);_0x588eac[_0xbcfc('0x48')]=_[_0xbcfc('0x49')](_0x3db2f6[_0xbcfc('0x44')],qs['fields'](_0x87aae7[_0xbcfc('0x46')][_0xbcfc('0x4a')]));_0x588eac[_0xbcfc('0x48')]=_0x588eac['attributes'][_0xbcfc('0x4b')]?_0x588eac[_0xbcfc('0x48')]:_0x3db2f6['model'];if(!_0x87aae7['query'][_0xbcfc('0x4c')](_0xbcfc('0x4d'))){_0x588eac[_0xbcfc('0x31')]=qs['limit'](_0x87aae7[_0xbcfc('0x46')]['limit']);_0x588eac[_0xbcfc('0x30')]=qs[_0xbcfc('0x30')](_0x87aae7[_0xbcfc('0x46')][_0xbcfc('0x30')]);}_0x588eac['order']=qs[_0xbcfc('0x4e')](_0x87aae7[_0xbcfc('0x46')][_0xbcfc('0x4e')]);_0x588eac[_0xbcfc('0x4f')]=qs[_0xbcfc('0x47')](_[_0xbcfc('0x50')](_0x87aae7[_0xbcfc('0x46')],_0x3db2f6['filters']),_0x118765);if(_0x87aae7[_0xbcfc('0x46')][_0xbcfc('0x51')]){_0x588eac[_0xbcfc('0x4f')]=_['merge'](_0x588eac[_0xbcfc('0x4f')],{'$or':_[_0xbcfc('0x52')](_0x118765,function(_0x351bb6){if(_0x351bb6[_0xbcfc('0x42')]!=='VIRTUAL'){var _0x19057c={};_0x19057c[_0x351bb6[_0xbcfc('0x3b')]]={'$like':'%'+_0x87aae7[_0xbcfc('0x46')][_0xbcfc('0x51')]+'%'};return _0x19057c;}})});}_0x588eac=_['merge']({},_0x588eac,_0x87aae7[_0xbcfc('0x53')]);var _0x382312={'where':_0x588eac[_0xbcfc('0x4f')]};return db[_0xbcfc('0x54')][_0xbcfc('0x32')](_0x382312)['then'](function(_0x58dbdc){_0x321f44['count']=_0x58dbdc;if(_0x87aae7[_0xbcfc('0x46')][_0xbcfc('0x55')]){_0x588eac[_0xbcfc('0x56')]=[{'all':!![]}];}return db[_0xbcfc('0x54')]['findAll'](_0x588eac);})[_0xbcfc('0x22')](function(_0x3d5ba3){_0x321f44[_0xbcfc('0x57')]=_0x3d5ba3;return _0x321f44;})[_0xbcfc('0x22')](respondWithFilteredResult(_0x49a881,_0x588eac))[_0xbcfc('0x58')](handleError(_0x49a881,null));};exports[_0xbcfc('0x59')]=function(_0x2d581e,_0x5d4141){var _0x1714b1={'raw':![],'where':{'id':_0x2d581e[_0xbcfc('0x5a')]['id']},'include':[{'model':db[_0xbcfc('0x3e')],'as':_0xbcfc('0x3f')}]},_0x39dd0e={};_0x39dd0e[_0xbcfc('0x44')]=_[_0xbcfc('0x45')](db['SmsAccount'][_0xbcfc('0x40')]);_0x39dd0e['query']=_['keys'](_0x2d581e[_0xbcfc('0x46')]);_0x39dd0e[_0xbcfc('0x47')]=_[_0xbcfc('0x49')](_0x39dd0e['model'],_0x39dd0e[_0xbcfc('0x46')]);_0x1714b1[_0xbcfc('0x48')]=_[_0xbcfc('0x49')](_0x39dd0e[_0xbcfc('0x44')],qs['fields'](_0x2d581e[_0xbcfc('0x46')]['fields']));_0x1714b1[_0xbcfc('0x48')]=_0x1714b1['attributes'][_0xbcfc('0x4b')]?_0x1714b1['attributes']:_0x39dd0e[_0xbcfc('0x44')];if(_0x2d581e[_0xbcfc('0x46')][_0xbcfc('0x55')]){_0x1714b1[_0xbcfc('0x56')]=[{'all':!![]}];}_0x1714b1=_[_0xbcfc('0x5b')]({},_0x1714b1,_0x2d581e[_0xbcfc('0x53')]);return db[_0xbcfc('0x54')][_0xbcfc('0x5c')](_0x1714b1)[_0xbcfc('0x22')](handleEntityNotFound(_0x5d4141,null))[_0xbcfc('0x22')](respondWithResult(_0x5d4141,null))['catch'](handleError(_0x5d4141,null));};exports[_0xbcfc('0x5d')]=function(_0x40f24a,_0x349e74){return db['SmsAccount'][_0xbcfc('0x5d')](_0x40f24a['body'],{})[_0xbcfc('0x22')](function(_0x2a3e4d){var _0x3fced4=_0x40f24a[_0xbcfc('0x5e')][_0xbcfc('0x38')]({'plain':!![]});if(!_0x3fced4)throw new Error(_0xbcfc('0x5f'));if(_0x3fced4[_0xbcfc('0x60')]==='user'){var _0x14c25d=_0x2a3e4d[_0xbcfc('0x38')]({'plain':!![]});var _0x47f754='SmsAccounts';return db[_0xbcfc('0x61')][_0xbcfc('0x5c')]({'where':{'name':_0x47f754,'userProfileId':_0x3fced4[_0xbcfc('0x62')]},'raw':!![]})[_0xbcfc('0x22')](function(_0x43de91){if(_0x43de91&&_0x43de91['autoAssociation']===0x0){return db['UserProfileResource'][_0xbcfc('0x5d')]({'name':_0x14c25d[_0xbcfc('0x3b')],'resourceId':_0x14c25d['id'],'type':_0x43de91['name'],'sectionId':_0x43de91['id']},{})['then'](function(){return _0x2a3e4d;});}else{return _0x2a3e4d;}})[_0xbcfc('0x58')](function(_0x5a36c1){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a36c1);throw _0x5a36c1;});}return _0x2a3e4d;})[_0xbcfc('0x22')](respondWithResult(_0x349e74,0xc9))['catch'](handleError(_0x349e74,null));};exports['update']=function(_0x458a60,_0x5c7372){if(_0x458a60[_0xbcfc('0x63')]['id']){delete _0x458a60[_0xbcfc('0x63')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x458a60[_0xbcfc('0x5a')]['id']},'include':[{'model':db[_0xbcfc('0x3e')],'as':_0xbcfc('0x3f')}]})[_0xbcfc('0x22')](handleEntityNotFound(_0x5c7372,null))[_0xbcfc('0x22')](saveUpdates(_0x458a60['body'],null))['then'](respondWithResult(_0x5c7372,null))['catch'](handleError(_0x5c7372,null));};exports['destroy']=function(_0x987a09,_0x3443db){return db[_0xbcfc('0x54')][_0xbcfc('0x5c')]({'where':{'id':_0x987a09[_0xbcfc('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3443db,null))[_0xbcfc('0x22')](removeEntity(_0x3443db,null))[_0xbcfc('0x58')](handleError(_0x3443db,null));};exports['describe']=function(_0x4a68f6,_0x52df69){return db[_0xbcfc('0x54')][_0xbcfc('0x64')]()[_0xbcfc('0x22')](respondWithResult(_0x52df69,null))[_0xbcfc('0x58')](handleError(_0x52df69,null));};exports[_0xbcfc('0x65')]=function(_0x461ac1,_0x1dfab1,_0x453496){if(_0x461ac1[_0xbcfc('0x63')]['id']){delete _0x461ac1[_0xbcfc('0x63')]['id'];}return db[_0xbcfc('0x54')][_0xbcfc('0x5c')]({'where':{'id':_0x461ac1[_0xbcfc('0x5a')]['id']}})[_0xbcfc('0x22')](handleEntityNotFound(_0x1dfab1,null))[_0xbcfc('0x22')](function(_0x5c463a){if(_0x5c463a){_0x461ac1[_0xbcfc('0x63')][_0xbcfc('0x66')]=_0x5c463a['id'];return db['Disposition'][_0xbcfc('0x5d')](_0x461ac1['body']);}})[_0xbcfc('0x22')](respondWithResult(_0x1dfab1,null))['catch'](handleError(_0x1dfab1,null));};exports['getDispositions']=function(_0x534ed9,_0x403089,_0x53cba2){var _0x2933b2={'raw':![],'where':{}};var _0x2d7c9d={};var _0x36acc2={'count':0x0,'rows':[]};return db[_0xbcfc('0x54')]['findOne']({'where':{'id':_0x534ed9[_0xbcfc('0x5a')]['id']}})[_0xbcfc('0x22')](handleEntityNotFound(_0x403089,null))[_0xbcfc('0x22')](function(_0x1e1a63){if(_0x1e1a63){_0x2d7c9d[_0xbcfc('0x44')]=_['keys'](db[_0xbcfc('0x67')]['rawAttributes']);_0x2d7c9d[_0xbcfc('0x46')]=_[_0xbcfc('0x45')](_0x534ed9[_0xbcfc('0x46')]);_0x2d7c9d[_0xbcfc('0x47')]=_['intersection'](_0x2d7c9d[_0xbcfc('0x44')],_0x2d7c9d[_0xbcfc('0x46')]);_0x2933b2['attributes']=_[_0xbcfc('0x49')](_0x2d7c9d['model'],qs[_0xbcfc('0x4a')](_0x534ed9[_0xbcfc('0x46')][_0xbcfc('0x4a')]));_0x2933b2[_0xbcfc('0x48')]=_0x2933b2[_0xbcfc('0x48')][_0xbcfc('0x4b')]?_0x2933b2[_0xbcfc('0x48')]:_0x2d7c9d['model'];if(!_0x534ed9[_0xbcfc('0x46')][_0xbcfc('0x4c')](_0xbcfc('0x4d'))){_0x2933b2[_0xbcfc('0x31')]=qs[_0xbcfc('0x31')](_0x534ed9[_0xbcfc('0x46')][_0xbcfc('0x31')]);_0x2933b2[_0xbcfc('0x30')]=qs[_0xbcfc('0x30')](_0x534ed9[_0xbcfc('0x46')][_0xbcfc('0x30')]);}_0x2933b2['order']=qs[_0xbcfc('0x4e')](_0x534ed9[_0xbcfc('0x46')][_0xbcfc('0x4e')]);_0x2933b2[_0xbcfc('0x4f')]=qs[_0xbcfc('0x47')](_[_0xbcfc('0x50')](_0x534ed9[_0xbcfc('0x46')],_0x2d7c9d[_0xbcfc('0x47')]));_0x2933b2[_0xbcfc('0x4f')][_0xbcfc('0x66')]=_0x1e1a63['id'];if(_0x534ed9[_0xbcfc('0x46')][_0xbcfc('0x51')]){_0x2933b2[_0xbcfc('0x4f')]=_['merge'](_0x2933b2[_0xbcfc('0x4f')],{'$or':_[_0xbcfc('0x52')](_0x2933b2['attributes'],function(_0x5d8b16){var _0x40a2e3={};_0x40a2e3[_0x5d8b16]={'$like':'%'+_0x534ed9[_0xbcfc('0x46')][_0xbcfc('0x51')]+'%'};return _0x40a2e3;})});}_0x2933b2=_['merge']({},_0x2933b2,_0x534ed9['options']);return db['Disposition']['count']({'where':_0x2933b2['where']})['then'](function(_0x41fec4){_0x36acc2['count']=_0x41fec4;if(_0x534ed9[_0xbcfc('0x46')][_0xbcfc('0x55')]){_0x2933b2[_0xbcfc('0x56')]=[{'all':!![]}];}return db[_0xbcfc('0x67')][_0xbcfc('0x68')](_0x2933b2);})[_0xbcfc('0x22')](function(_0x196cba){_0x36acc2[_0xbcfc('0x57')]=_0x196cba;return _0x36acc2;});}})[_0xbcfc('0x22')](respondWithFilteredResult(_0x403089,_0x2933b2))['catch'](handleError(_0x403089,null));};exports['removeDispositions']=function(_0x348977,_0x3aedb5,_0x2d54c0){return db['SmsAccount']['find']({'where':{'id':_0x348977['params']['id']}})[_0xbcfc('0x22')](handleEntityNotFound(_0x3aedb5,null))[_0xbcfc('0x22')](function(_0x5aac03){if(_0x5aac03){return _0x5aac03[_0xbcfc('0x69')](_0x348977[_0xbcfc('0x46')][_0xbcfc('0x6a')]);}})[_0xbcfc('0x22')](respondWithStatusCode(_0x3aedb5,null))['catch'](handleError(_0x3aedb5,null));};exports[_0xbcfc('0x6b')]=function(_0x2c9904,_0x1d6a02,_0x5d0ed2){if(_0x2c9904[_0xbcfc('0x63')]['id']){delete _0x2c9904[_0xbcfc('0x63')]['id'];}return db['SmsAccount'][_0xbcfc('0x5c')]({'where':{'id':_0x2c9904[_0xbcfc('0x5a')]['id']}})[_0xbcfc('0x22')](handleEntityNotFound(_0x1d6a02,null))[_0xbcfc('0x22')](function(_0x2e2cb1){if(_0x2e2cb1){_0x2c9904[_0xbcfc('0x63')][_0xbcfc('0x66')]=_0x2e2cb1['id'];return db[_0xbcfc('0x6c')][_0xbcfc('0x5d')](_0x2c9904[_0xbcfc('0x63')]);}})[_0xbcfc('0x22')](respondWithResult(_0x1d6a02,null))[_0xbcfc('0x58')](handleError(_0x1d6a02,null));};exports[_0xbcfc('0x6d')]=function(_0x3e15e6,_0x48691d,_0x5267f9){var _0x319d45={'raw':![],'where':{}};var _0x24c0a7={};var _0x59fbc7={'count':0x0,'rows':[]};return db[_0xbcfc('0x54')][_0xbcfc('0x6e')]({'where':{'id':_0x3e15e6[_0xbcfc('0x5a')]['id']}})[_0xbcfc('0x22')](handleEntityNotFound(_0x48691d,null))['then'](function(_0xca2761){if(_0xca2761){_0x24c0a7[_0xbcfc('0x44')]=_['keys'](db['CannedAnswer'][_0xbcfc('0x40')]);_0x24c0a7[_0xbcfc('0x46')]=_[_0xbcfc('0x45')](_0x3e15e6[_0xbcfc('0x46')]);_0x24c0a7[_0xbcfc('0x47')]=_[_0xbcfc('0x49')](_0x24c0a7[_0xbcfc('0x44')],_0x24c0a7[_0xbcfc('0x46')]);_0x319d45[_0xbcfc('0x48')]=_['intersection'](_0x24c0a7['model'],qs[_0xbcfc('0x4a')](_0x3e15e6[_0xbcfc('0x46')][_0xbcfc('0x4a')]));_0x319d45[_0xbcfc('0x48')]=_0x319d45['attributes']['length']?_0x319d45[_0xbcfc('0x48')]:_0x24c0a7[_0xbcfc('0x44')];if(!_0x3e15e6[_0xbcfc('0x46')][_0xbcfc('0x4c')]('nolimit')){_0x319d45['limit']=qs[_0xbcfc('0x31')](_0x3e15e6['query']['limit']);_0x319d45[_0xbcfc('0x30')]=qs[_0xbcfc('0x30')](_0x3e15e6['query'][_0xbcfc('0x30')]);}_0x319d45[_0xbcfc('0x6f')]=qs[_0xbcfc('0x4e')](_0x3e15e6[_0xbcfc('0x46')][_0xbcfc('0x4e')]);_0x319d45[_0xbcfc('0x4f')]=qs[_0xbcfc('0x47')](_['pick'](_0x3e15e6['query'],_0x24c0a7[_0xbcfc('0x47')]));_0x319d45[_0xbcfc('0x4f')]['SmsAccountId']=_0xca2761['id'];if(_0x3e15e6[_0xbcfc('0x46')][_0xbcfc('0x51')]){_0x319d45['where']=_[_0xbcfc('0x5b')](_0x319d45['where'],{'$or':_[_0xbcfc('0x52')](_0x319d45[_0xbcfc('0x48')],function(_0x20926b){var _0x2e2957={};_0x2e2957[_0x20926b]={'$like':'%'+_0x3e15e6['query']['filter']+'%'};return _0x2e2957;})});}_0x319d45=_['merge']({},_0x319d45,_0x3e15e6[_0xbcfc('0x53')]);return db[_0xbcfc('0x6c')][_0xbcfc('0x32')]({'where':_0x319d45[_0xbcfc('0x4f')]})[_0xbcfc('0x22')](function(_0x38c9cc){_0x59fbc7[_0xbcfc('0x32')]=_0x38c9cc;if(_0x3e15e6[_0xbcfc('0x46')][_0xbcfc('0x55')]){_0x319d45[_0xbcfc('0x56')]=[{'all':!![]}];}return db[_0xbcfc('0x6c')][_0xbcfc('0x68')](_0x319d45);})['then'](function(_0x2c671d){_0x59fbc7[_0xbcfc('0x57')]=_0x2c671d;return _0x59fbc7;});}})[_0xbcfc('0x22')](respondWithFilteredResult(_0x48691d,_0x319d45))['catch'](handleError(_0x48691d,null));};exports[_0xbcfc('0x70')]=function(_0x11ea6a,_0x3c150c,_0x34b4e5){return db['SmsAccount'][_0xbcfc('0x5c')]({'where':{'id':_0x11ea6a[_0xbcfc('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3c150c,null))[_0xbcfc('0x22')](function(_0x32b50f){if(_0x32b50f){return _0x32b50f[_0xbcfc('0x70')](_0x11ea6a[_0xbcfc('0x46')][_0xbcfc('0x6a')]);}})[_0xbcfc('0x22')](respondWithStatusCode(_0x3c150c,null))[_0xbcfc('0x58')](handleError(_0x3c150c,null));};exports['notify']=function(_0x984280,_0x346745,_0x2aee85){var _0x13a020={'channel':_0xbcfc('0x71')};var _0x21a599=[];var _0x2e0050=[];var _0x23656e={};return db['SmsAccount'][_0xbcfc('0x5c')]({'where':{'id':_0x984280[_0xbcfc('0x5a')]['id']},'include':[{'model':db['SmsApplication'],'as':_0xbcfc('0x72')}]})[_0xbcfc('0x22')](handleEntityNotFound(_0x346745,null))[_0xbcfc('0x22')](function(_0x4d2ea7){_0x13a020[_0xbcfc('0x73')]=_0x4d2ea7;_0x13a020['applications']=_['orderBy'](_0x4d2ea7[_0xbcfc('0x72')],['priority'],['asc']);if(_0x13a020[_0xbcfc('0x73')][_0xbcfc('0x72')]){delete _0x13a020['account'][_0xbcfc('0x72')];}return db['CmContact'][_0xbcfc('0x64')]();})['then'](function(_0x161a22){if(!_0x161a22){throw new db[(_0xbcfc('0x74'))][(_0xbcfc('0x75'))](_0xbcfc('0x76'));}_0x21a599=_[_0xbcfc('0x77')](_[_0xbcfc('0x45')](_0x161a22),[_0xbcfc('0x78'),_0xbcfc('0x79')]);_0x2e0050=_[_0xbcfc('0x77')](_[_0xbcfc('0x45')](_0x161a22),[_0xbcfc('0x78'),_0xbcfc('0x79'),_0xbcfc('0x7a'),'ListId']);_0x13a020[_0xbcfc('0x63')]={'mapKey':'mobile'};if(_0x13a020[_0xbcfc('0x73')][_0xbcfc('0x42')]){switch(_0x13a020[_0xbcfc('0x73')]['type']){case _0xbcfc('0x7b'):_0x13a020[_0xbcfc('0x63')][_0xbcfc('0x7c')]=_0x984280[_0xbcfc('0x63')][_0xbcfc('0x7d')];_0x13a020[_0xbcfc('0x63')][_0xbcfc('0x63')]=_0x984280['body'][_0xbcfc('0x7e')];_0x13a020[_0xbcfc('0x63')][_0xbcfc('0x7f')]=_0x984280['body'][_0xbcfc('0x80')];break;case'skebby':_0x13a020['body'][_0xbcfc('0x7c')]='+'+_0x984280[_0xbcfc('0x63')][_0xbcfc('0x81')];_0x13a020[_0xbcfc('0x63')][_0xbcfc('0x63')]=_0x984280[_0xbcfc('0x63')][_0xbcfc('0x82')];break;case'connectel':_0x13a020[_0xbcfc('0x63')][_0xbcfc('0x7c')]=_0x984280['body'][_0xbcfc('0x7c')];_0x13a020[_0xbcfc('0x63')][_0xbcfc('0x63')]=_0x984280['body']['message'];break;case _0xbcfc('0x83'):_0x13a020['body']['from']=_0x984280['body'][_0xbcfc('0x7c')];_0x13a020[_0xbcfc('0x63')][_0xbcfc('0x63')]=_0x984280[_0xbcfc('0x63')][_0xbcfc('0x63')];_0x13a020[_0xbcfc('0x63')][_0xbcfc('0x7f')]=_0x984280[_0xbcfc('0x63')][_0xbcfc('0x84')];break;case'plivo':_0x13a020['body'][_0xbcfc('0x7c')]=_0x984280[_0xbcfc('0x63')][_0xbcfc('0x7d')];_0x13a020[_0xbcfc('0x63')]['body']=_0x984280[_0xbcfc('0x63')][_0xbcfc('0x85')];_0x13a020[_0xbcfc('0x63')][_0xbcfc('0x7f')]=_0x984280[_0xbcfc('0x63')][_0xbcfc('0x86')];break;case _0xbcfc('0x87'):_0x13a020[_0xbcfc('0x63')][_0xbcfc('0x7c')]='+'+_0x984280[_0xbcfc('0x63')][_0xbcfc('0x88')][0x0][_0xbcfc('0x7c')];_0x13a020['body'][_0xbcfc('0x63')]=_0x984280[_0xbcfc('0x63')][_0xbcfc('0x88')][0x0]['text'];_0x13a020[_0xbcfc('0x63')][_0xbcfc('0x7f')]=_0x984280[_0xbcfc('0x63')][_0xbcfc('0x88')][0x0]['messageId'];break;case _0xbcfc('0x89'):_0x13a020[_0xbcfc('0x63')][_0xbcfc('0x7c')]=_0x984280['body'][_0xbcfc('0x8a')];_0x13a020[_0xbcfc('0x63')][_0xbcfc('0x63')]=_0x984280[_0xbcfc('0x63')][_0xbcfc('0x8b')][_0xbcfc('0x2a')];break;case'clickatell':_0x13a020[_0xbcfc('0x63')][_0xbcfc('0x7c')]=_0x984280[_0xbcfc('0x63')][_0xbcfc('0x8c')];_0x13a020['body'][_0xbcfc('0x63')]=_0x984280['body'][_0xbcfc('0x82')];_0x13a020['body']['messageId']=_0x984280['body'][_0xbcfc('0x8d')];break;case _0xbcfc('0x8e'):_0x13a020['body'][_0xbcfc('0x7f')]=_0x984280[_0xbcfc('0x63')][0x0][_0xbcfc('0x2a')]['id'];_0x13a020[_0xbcfc('0x63')][_0xbcfc('0x7c')]=_0x984280[_0xbcfc('0x63')][0x0][_0xbcfc('0x2a')][_0xbcfc('0x7c')];_0x13a020[_0xbcfc('0x63')][_0xbcfc('0x63')]=_0x984280[_0xbcfc('0x63')][0x0]['message'][_0xbcfc('0x82')];break;case _0xbcfc('0x8f'):_0x13a020[_0xbcfc('0x63')][_0xbcfc('0x7c')]=_0x984280['body'][_0xbcfc('0x7c')];_0x13a020[_0xbcfc('0x63')]['body']=_0x984280[_0xbcfc('0x63')][_0xbcfc('0x2a')];_0x13a020['body']['messageId']=_0x984280[_0xbcfc('0x63')]['refid'];break;}}if(_0x13a020[_0xbcfc('0x63')]['id']){delete _0x13a020['body']['id'];}if(_[_0xbcfc('0x90')](_0x13a020[_0xbcfc('0x63')]['from'])){throw new db[(_0xbcfc('0x74'))]['ValidationError'](_0xbcfc('0x91'));}if(_[_0xbcfc('0x90')](_0x13a020[_0xbcfc('0x63')][_0xbcfc('0x63')])||_0x13a020[_0xbcfc('0x63')]['body']===''){throw new db[(_0xbcfc('0x74'))][(_0xbcfc('0x75'))](_0xbcfc('0x92'));}if(_[_0xbcfc('0x90')](_0x13a020[_0xbcfc('0x63')][_0xbcfc('0x93')])){throw new db[(_0xbcfc('0x74'))]['ValidationError'](_0xbcfc('0x94')+_0x2e0050);}if(!_['includes'](_0x2e0050,_0x13a020[_0xbcfc('0x63')][_0xbcfc('0x93')])){throw new db[(_0xbcfc('0x74'))][(_0xbcfc('0x75'))](_0xbcfc('0x95')+_0x2e0050);}_0x23656e[_0x13a020['body'][_0xbcfc('0x93')]]=_0x13a020[_0xbcfc('0x63')][_0xbcfc('0x7c')];return db[_0xbcfc('0x96')][_0xbcfc('0x5c')]({'where':{'id':_0x13a020[_0xbcfc('0x73')][_0xbcfc('0x97')]},'include':[{'model':db[_0xbcfc('0x98')],'as':_0xbcfc('0x99'),'where':_0x23656e,'limit':0x1,'order':[[_0xbcfc('0x79'),_0xbcfc('0x9a')]]}]});})[_0xbcfc('0x22')](handleEntityNotFound(_0x346745,null))[_0xbcfc('0x22')](function(_0x48ab0b){if(_0x48ab0b){_0x13a020[_0xbcfc('0x9b')]=_['omit'](_0x48ab0b,[_0xbcfc('0x99')]);if(_0x48ab0b[_0xbcfc('0x99')][_0xbcfc('0x4b')]){return _0x48ab0b['Contacts'][0x0];}var _0x364593=_[_0xbcfc('0x1a')](_0x13a020[_0xbcfc('0x63')],{'firstName':_0x13a020[_0xbcfc('0x63')][_0xbcfc('0x7c')],'ListId':_0x48ab0b['id']});_0x364593[_0x13a020[_0xbcfc('0x63')]['mapKey']]=_0x13a020[_0xbcfc('0x63')]['from'];return db[_0xbcfc('0x98')][_0xbcfc('0x5d')](_0x364593,{'fields':_0x21a599,'raw':!![]});}})[_0xbcfc('0x22')](handleEntityNotFound(_0x346745,null))['then'](function(_0x519a8d){if(_0x519a8d){_0x13a020['contact']=_0x519a8d;var _0x2295c3={'ContactId':_0x519a8d['id'],'phone':_0x13a020['body'][_0xbcfc('0x7c')],'SmsAccountId':_0x984280[_0xbcfc('0x5a')]['id']};var _0x1f6d2d={'ContactId':_0x519a8d['id'],'SmsAccountId':_0x984280[_0xbcfc('0x5a')]['id'],'closed':![]};return db[_0xbcfc('0x9c')][_0xbcfc('0x5c')]({'where':_0x1f6d2d})[_0xbcfc('0x22')](function(_0x29dad2){if(_0x29dad2){return[_0x29dad2,![]];}return db['SmsInteraction']['create'](_0x2295c3)[_0xbcfc('0x22')](function(_0x57b0e1){return[_0x57b0e1,!![]];});});}})['spread'](function(_0x5eec8d,_0x4af047){_0x13a020['interaction']=_0x5eec8d[_0xbcfc('0x38')]({'plain':!![]});_0x13a020[_0xbcfc('0x9d')][_0xbcfc('0x9e')]=![];if(_0x4af047){if(_0x13a020[_0xbcfc('0x73')]['autoclose']){_0x13a020[_0xbcfc('0x9f')][_0xbcfc('0xa0')]({'id':0x0,'priority':_0x13a020[_0xbcfc('0x9f')][_0xbcfc('0x4b')]+0x1,'app':_0xbcfc('0xa1'),'appdata':_0xbcfc('0xa2'),'interval':_0xbcfc('0xa3')});}_0x13a020[_0xbcfc('0x9d')][_0xbcfc('0x9e')]=!![];}return db[_0xbcfc('0xa4')][_0xbcfc('0x5d')]({'phone':_0x13a020[_0xbcfc('0x63')][_0xbcfc('0x7c')],'messageId':_0x13a020['body'][_0xbcfc('0x7f')],'body':_0x13a020[_0xbcfc('0x63')][_0xbcfc('0x63')],'SmsAccountId':_0x984280['params']['id'],'SmsInteractionId':_0x5eec8d['id'],'direction':'in','ContactId':_0x5eec8d[_0xbcfc('0xa5')],'AttachmentId':_0x13a020[_0xbcfc('0x63')][_0xbcfc('0xa6')]});})[_0xbcfc('0x22')](function(_0x3f72cc){_0x13a020[_0xbcfc('0x2a')]=_0x3f72cc;if(_0x13a020[_0xbcfc('0x9d')][_0xbcfc('0xa7')]){return db[_0xbcfc('0xa8')][_0xbcfc('0x5c')]({'attributes':['id','name'],'where':{'id':_0x13a020['interaction'][_0xbcfc('0xa7')]}})[_0xbcfc('0x22')](function(_0xf66b30){if(_0xf66b30){_0x13a020[_0xbcfc('0x9f')][_0xbcfc('0xa9')]({'id':0x0,'priority':0x0,'app':_0xbcfc('0xaa'),'appdata':_0xf66b30[_0xbcfc('0x3b')]+','+(_0x13a020[_0xbcfc('0x73')]['waitForTheAssignedAgent']||0xa),'interval':_0xbcfc('0xa3')});}return respondWithRpcPromise('Start',_0xbcfc('0xab'),_0x13a020);});}return respondWithRpcPromise(_0xbcfc('0xac'),'startRouting',_0x13a020);})['then'](function(_0x1f0291){if(_0x1f0291){var _0x1defdd=0xc8;var _0x25f977=_0xbcfc('0xad');logger[_0xbcfc('0x23')](_0xbcfc('0x26'),_0x25f977,_0x1defdd,_0xbcfc('0xae'));logger[_0xbcfc('0xaf')](_0xbcfc('0xb0'),_0x25f977,_0x1defdd,'entity\x20found',JSON[_0xbcfc('0x27')](_0x1f0291));if(_0x13a020[_0xbcfc('0x73')]['type']===_0xbcfc('0x7b')){return _0x346745[_0xbcfc('0x2d')](_0x1defdd)[_0xbcfc('0x33')](_0xbcfc('0xb1'),_0xbcfc('0xb2'))[_0xbcfc('0x3c')](_0xbcfc('0xb3'));}else{return _0x346745[_0xbcfc('0x2d')](_0x1defdd)[_0xbcfc('0x2f')](_0x1f0291);}}})[_0xbcfc('0x58')](handleError(_0x346745,null));};exports[_0xbcfc('0xb4')]=function(_0x55b971,_0x10b76c,_0x4bf1b9){return db[_0xbcfc('0x54')][_0xbcfc('0x6e')]({'where':{'id':_0x55b971[_0xbcfc('0x5a')]['id']}})[_0xbcfc('0x22')](handleEntityNotFound(_0x10b76c,null))[_0xbcfc('0x22')](function(_0x52fb6c){if(_0x52fb6c){return db['sequelize']['transaction'](function(_0x4a2c83){return db[_0xbcfc('0xb5')][_0xbcfc('0x37')]({'where':{'SmsAccountId':_0x55b971[_0xbcfc('0x5a')]['id']},'transaction':_0x4a2c83})[_0xbcfc('0x22')](function(_0xf372d6){var _0x5557c2=_[_0xbcfc('0x52')](_0x55b971[_0xbcfc('0x63')],function(_0x43b4bd){_0x43b4bd[_0xbcfc('0x66')]=_0x55b971[_0xbcfc('0x5a')]['id'];return _0x43b4bd;});return db[_0xbcfc('0xb5')][_0xbcfc('0xb6')](_0x5557c2,{'transaction':_0x4a2c83});});})[_0xbcfc('0x22')](function(){return db['SmsApplication'][_0xbcfc('0xb7')]({'where':{'SmsAccountId':_0x55b971[_0xbcfc('0x5a')]['id']},'order':_0xbcfc('0xb8')});});}})[_0xbcfc('0x22')](respondWithResult(_0x10b76c,null))[_0xbcfc('0x58')](handleError(_0x10b76c,null));};exports['getApplications']=function(_0x5243c9,_0x59fec8,_0x4d4668){var _0x5a7cc9={};var _0x55d0be={};var _0x1d6ddd;var _0x3013d4;return db['SmsAccount'][_0xbcfc('0x6e')]({'where':{'id':_0x5243c9[_0xbcfc('0x5a')]['id']}})['then'](handleEntityNotFound(_0x59fec8,null))['then'](function(_0x656e42){if(_0x656e42){_0x1d6ddd=_0x656e42;_0x55d0be[_0xbcfc('0x44')]=_[_0xbcfc('0x45')](db[_0xbcfc('0xb5')][_0xbcfc('0x40')]);_0x55d0be[_0xbcfc('0x46')]=_[_0xbcfc('0x45')](_0x5243c9[_0xbcfc('0x46')]);_0x55d0be[_0xbcfc('0x47')]=_[_0xbcfc('0x49')](_0x55d0be['model'],_0x55d0be[_0xbcfc('0x46')]);_0x5a7cc9[_0xbcfc('0x48')]=_['intersection'](_0x55d0be[_0xbcfc('0x44')],qs['fields'](_0x5243c9[_0xbcfc('0x46')][_0xbcfc('0x4a')]));_0x5a7cc9[_0xbcfc('0x48')]=_0x5a7cc9[_0xbcfc('0x48')][_0xbcfc('0x4b')]?_0x5a7cc9['attributes']:_0x55d0be[_0xbcfc('0x44')];_0x5a7cc9[_0xbcfc('0x6f')]=qs[_0xbcfc('0x4e')](_0x5243c9[_0xbcfc('0x46')]['sort']);_0x5a7cc9['where']=qs[_0xbcfc('0x47')](_['pick'](_0x5243c9['query'],_0x55d0be[_0xbcfc('0x47')]));if(_0x5243c9[_0xbcfc('0x46')][_0xbcfc('0x51')]){_0x5a7cc9[_0xbcfc('0x4f')]=_[_0xbcfc('0x5b')](_0x5a7cc9[_0xbcfc('0x4f')],{'$or':_[_0xbcfc('0x52')](_0x5a7cc9[_0xbcfc('0x48')],function(_0x222abf){var _0x53a7e9={};_0x53a7e9[_0x222abf]={'$like':'%'+_0x5243c9[_0xbcfc('0x46')][_0xbcfc('0x51')]+'%'};return _0x53a7e9;})});}_0x5a7cc9=_['merge']({},_0x5a7cc9,_0x5243c9[_0xbcfc('0x53')]);return _0x1d6ddd[_0xbcfc('0xb9')](_0x5a7cc9);}})[_0xbcfc('0x22')](function(_0x2d346c){if(_0x2d346c){_0x3013d4=_0x2d346c['length'];if(!_0x5243c9[_0xbcfc('0x46')][_0xbcfc('0x4c')](_0xbcfc('0x4d'))){_0x5a7cc9[_0xbcfc('0x31')]=qs['limit'](_0x5243c9['query'][_0xbcfc('0x31')]);_0x5a7cc9[_0xbcfc('0x30')]=qs[_0xbcfc('0x30')](_0x5243c9[_0xbcfc('0x46')][_0xbcfc('0x30')]);}return _0x1d6ddd[_0xbcfc('0xb9')](_0x5a7cc9);}})[_0xbcfc('0x22')](function(_0x5bbc11){if(_0x5bbc11){return _0x5bbc11?{'count':_0x3013d4,'rows':_0x5bbc11}:null;}})[_0xbcfc('0x22')](respondWithResult(_0x59fec8,null))[_0xbcfc('0x58')](handleError(_0x59fec8,null));};exports[_0xbcfc('0xba')]=function(_0x263bad,_0x362ca0,_0x774090){var _0x353c5b={'raw':![],'where':{}};var _0x130105={};var _0x2b453d={'count':0x0,'rows':[]};return db[_0xbcfc('0x54')]['findOne']({'where':{'id':_0x263bad[_0xbcfc('0x5a')]['id']}})[_0xbcfc('0x22')](handleEntityNotFound(_0x362ca0,null))[_0xbcfc('0x22')](function(_0xd36c49){if(_0xd36c49){_0x130105['model']=_[_0xbcfc('0x45')](db[_0xbcfc('0x9c')][_0xbcfc('0x40')]);_0x130105[_0xbcfc('0x46')]=_[_0xbcfc('0x45')](_0x263bad[_0xbcfc('0x46')]);_0x130105['filters']=_[_0xbcfc('0x49')](_0x130105[_0xbcfc('0x44')],_0x130105[_0xbcfc('0x46')]);_0x353c5b[_0xbcfc('0x48')]=_[_0xbcfc('0x49')](_0x130105[_0xbcfc('0x44')],qs[_0xbcfc('0x4a')](_0x263bad['query'][_0xbcfc('0x4a')]));_0x353c5b[_0xbcfc('0x48')]=_0x353c5b['attributes'][_0xbcfc('0x4b')]?_0x353c5b[_0xbcfc('0x48')]:_0x130105['model'];if(!_0x263bad['query']['hasOwnProperty'](_0xbcfc('0x4d'))){_0x353c5b[_0xbcfc('0x31')]=qs['limit'](_0x263bad[_0xbcfc('0x46')][_0xbcfc('0x31')]);_0x353c5b[_0xbcfc('0x30')]=qs[_0xbcfc('0x30')](_0x263bad[_0xbcfc('0x46')][_0xbcfc('0x30')]);}_0x353c5b['order']=qs[_0xbcfc('0x4e')](_0x263bad[_0xbcfc('0x46')][_0xbcfc('0x4e')]);_0x353c5b[_0xbcfc('0x4f')]=qs[_0xbcfc('0x47')](_[_0xbcfc('0x50')](_0x263bad[_0xbcfc('0x46')],_0x130105[_0xbcfc('0x47')]));_0x353c5b[_0xbcfc('0x4f')][_0xbcfc('0x66')]=_0xd36c49['id'];if(_0x263bad[_0xbcfc('0x46')][_0xbcfc('0x51')]){_0x353c5b[_0xbcfc('0x4f')]=_[_0xbcfc('0x5b')](_0x353c5b[_0xbcfc('0x4f')],{'$or':_['map'](_0x353c5b[_0xbcfc('0x48')],function(_0xe96254){var _0x3ac67c={};_0x3ac67c[_0xe96254]={'$like':'%'+_0x263bad[_0xbcfc('0x46')][_0xbcfc('0x51')]+'%'};return _0x3ac67c;})});}_0x353c5b=_[_0xbcfc('0x5b')]({},_0x353c5b,_0x263bad[_0xbcfc('0x53')]);return db[_0xbcfc('0x9c')][_0xbcfc('0x32')]({'where':_0x353c5b[_0xbcfc('0x4f')]})['then'](function(_0x186ed4){_0x2b453d[_0xbcfc('0x32')]=_0x186ed4;if(_0x263bad[_0xbcfc('0x46')][_0xbcfc('0x55')]){_0x353c5b[_0xbcfc('0x56')]=[{'model':db['CmContact'],'as':_0xbcfc('0xbb'),'required':![]},{'model':db[_0xbcfc('0xa8')],'as':_0xbcfc('0xbc'),'attributes':[_0xbcfc('0x3b'),_0xbcfc('0xbd'),'internal'],'required':![]},{'model':db[_0xbcfc('0xbe')],'as':_0xbcfc('0xbf'),'attributes':['id',_0xbcfc('0x3b'),_0xbcfc('0xc0')],'where':_0x263bad['query'][_0xbcfc('0xc1')]?{'id':_0x263bad[_0xbcfc('0x46')]['tag']}:undefined,'required':_0x263bad[_0xbcfc('0x46')][_0xbcfc('0xc1')]?!![]:![]}];}return db[_0xbcfc('0x9c')][_0xbcfc('0x68')](_0x353c5b);})[_0xbcfc('0x22')](function(_0xdd428b){_0x2b453d[_0xbcfc('0x57')]=_0xdd428b;return _0x2b453d;});}})['then'](respondWithFilteredResult(_0x362ca0,_0x353c5b))['catch'](handleError(_0x362ca0,null));};exports['send']=function(_0x4f8449,_0x3bf810,_0x54b3f4){var _0x348c91,_0x4f0628,_0x101f4f;if(_[_0xbcfc('0x90')](_0x4f8449[_0xbcfc('0x63')][_0xbcfc('0x63')])||_0x4f8449['body']['body']===''){throw new db[(_0xbcfc('0x74'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xbcfc('0x90')](_0x4f8449[_0xbcfc('0x63')]['to'])){throw new db[(_0xbcfc('0x74'))][(_0xbcfc('0x75'))](_0xbcfc('0xc2'));}_0x348c91=_0x4f8449[_0xbcfc('0x63')]['to'];return db[_0xbcfc('0x54')][_0xbcfc('0x5c')]({'where':{'id':_0x4f8449[_0xbcfc('0x5a')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0xbcfc('0x99'),'where':{'mobile':_0x348c91},'limit':0x1,'order':[[_0xbcfc('0x79'),_0xbcfc('0x9a')]]}]}]})[_0xbcfc('0x22')](handleEntityNotFound(_0x3bf810,null))[_0xbcfc('0x22')](function(_0x1c1f85){if(_0x1c1f85&&_0x1c1f85[_0xbcfc('0xc3')]){_0x4f0628=_0x1c1f85[_0xbcfc('0x38')]({'plain':!![]});if(_0x4f0628[_0xbcfc('0xc3')]&&_0x4f0628[_0xbcfc('0xc3')][_0xbcfc('0x99')]['length']){return _0x4f0628[_0xbcfc('0xc3')][_0xbcfc('0x99')][0x0];}return db[_0xbcfc('0x98')][_0xbcfc('0x5d')](_[_0xbcfc('0x1a')](_0x4f8449[_0xbcfc('0x63')],{'firstName':_0x348c91,'mobile':_0x348c91,'phone':_0x348c91,'ListId':_0x4f0628[_0xbcfc('0x97')]}));}})[_0xbcfc('0x22')](handleEntityNotFound(_0x3bf810,null))[_0xbcfc('0x22')](function(_0x2ab393){if(_0x2ab393){_0x101f4f=_0x2ab393;return db[_0xbcfc('0x9c')]['find']({'where':{'ContactId':_0x101f4f['id'],'closed':![],'SmsAccountId':_0x4f0628['id']}})[_0xbcfc('0x22')](function(_0x13a5c6){if(_0x13a5c6){return[_0x13a5c6,![]];}return db[_0xbcfc('0x9c')][_0xbcfc('0x5d')]({'UserId':_0x4f8449[_0xbcfc('0x5e')]['id'],'ContactId':_0x101f4f['id'],'SmsAccountId':_0x4f0628['id'],'phone':_0x348c91,'firstMsgDirection':'out','Messages':[_[_0xbcfc('0x5b')](_0x4f8449['body'],{'read':![],'body':_0x4f8449['body'][_0xbcfc('0x63')],'phone':_0x348c91,'SmsAccountId':_0x4f0628['id'],'UserId':_0x4f8449[_0xbcfc('0x5e')]['id'],'ContactId':_0x101f4f['id']})]},{'include':[{'model':db[_0xbcfc('0xa4')],'as':_0xbcfc('0xc4')}]})['then'](function(_0x31f533){return[_0x31f533,!![]];});});}})[_0xbcfc('0xc5')](function(_0x49ee07,_0x527216){if(_0x527216){return _0x49ee07;}return db[_0xbcfc('0xa4')]['create'](_[_0xbcfc('0x5b')](_0x4f8449[_0xbcfc('0x63')],{'read':![],'body':_0x4f8449['body'][_0xbcfc('0x63')],'phone':_0x348c91,'SmsAccountId':_0x4f0628['id'],'SmsInteractionId':_0x49ee07['id'],'UserId':_0x4f8449[_0xbcfc('0x5e')]['id'],'ContactId':_0x101f4f['id']}))[_0xbcfc('0x22')](function(_0x14a74e){_0x49ee07[_0xbcfc('0xc6')][_0xbcfc('0xc4')]=[];_0x49ee07[_0xbcfc('0xc6')][_0xbcfc('0xc4')][_0xbcfc('0xa0')](_0x14a74e[_0xbcfc('0xc6')]);return _0x49ee07;});})[_0xbcfc('0x22')](respondWithResult(_0x3bf810,null))['catch'](handleError(_0x3bf810,null));};exports[_0xbcfc('0x2d')]=function(_0x4e944b,_0x1b3e4b,_0x2d119d){if(_0x4e944b[_0xbcfc('0x63')]['id']){delete _0x4e944b[_0xbcfc('0x63')]['id'];}var _0x2127a3,_0x81691,_0xb51c65;return db[_0xbcfc('0x54')][_0xbcfc('0x5c')]({'where':{'id':_0x4e944b[_0xbcfc('0x5a')]['id']}})[_0xbcfc('0x22')](handleEntityNotFound(_0x1b3e4b,null))[_0xbcfc('0x22')](function(_0x37f800){if(_0x37f800){_0xb51c65=_0x37f800;logger['debug'](_0xbcfc('0x26'),'status',_0xbcfc('0xc7'),_0x37f800[_0xbcfc('0x42')],util[_0xbcfc('0xc8')](_0x4e944b[_0xbcfc('0x63')],{'showHidden':![],'depth':null}));switch(_0x37f800['type']){case _0xbcfc('0xc9'):if(_0x4e944b[_0xbcfc('0x63')][_0xbcfc('0xca')]&&_0x4e944b['body']['status']){_0x81691=_0x4e944b[_0xbcfc('0x63')][_0xbcfc('0x2d')];return db[_0xbcfc('0xa4')][_0xbcfc('0x5c')]({'where':{'messageId':_0x4e944b['body'][_0xbcfc('0xca')]}});}break;case'connectel':if(_0x4e944b['body']['requestid']&&_0x4e944b[_0xbcfc('0x63')]['statusInt']){_0x81691=_0x4e944b[_0xbcfc('0x63')][_0xbcfc('0xcb')];return db[_0xbcfc('0xa4')][_0xbcfc('0x5c')]({'where':{'messageId':_0x4e944b[_0xbcfc('0x63')][_0xbcfc('0xcc')]}});}break;case'clicksend':if(_0x4e944b[_0xbcfc('0x63')][_0xbcfc('0x84')]&&_0x4e944b['body'][_0xbcfc('0xcd')]){_0x81691=_0x4e944b[_0xbcfc('0x63')][_0xbcfc('0xcd')];return db['SmsMessage']['find']({'where':{'messageId':_0x4e944b[_0xbcfc('0x63')][_0xbcfc('0x84')]}});}break;case _0xbcfc('0x87'):var _0x3660b4=_0x4e944b[_0xbcfc('0x63')][_0xbcfc('0x88')][0x0];if(_0x3660b4[_0xbcfc('0x7f')]&&_0x3660b4[_0xbcfc('0x2d')][_0xbcfc('0xce')]===_0xbcfc('0xcf')){_0x81691=_0x3660b4[_0xbcfc('0x2d')][_0xbcfc('0xce')];return db[_0xbcfc('0xa4')]['find']({'where':{'messageId':_0x3660b4[_0xbcfc('0x7f')]}});}break;case _0xbcfc('0xd0'):if(_0x4e944b[_0xbcfc('0x63')]['messageId']&&_0x4e944b[_0xbcfc('0x63')][_0xbcfc('0x2d')]){_0x81691=_0x4e944b[_0xbcfc('0x63')][_0xbcfc('0x2d')];return db[_0xbcfc('0xa4')]['find']({'where':{'messageId':_0x4e944b[_0xbcfc('0x63')][_0xbcfc('0x7f')]}});}break;case _0xbcfc('0x8e'):if(_0x4e944b[_0xbcfc('0x63')][0x0][_0xbcfc('0x2a')]['id']){_0x81691=_0x4e944b['body'][0x0][_0xbcfc('0x42')];return db[_0xbcfc('0xa4')][_0xbcfc('0x5c')]({'where':{'messageId':_0x4e944b['body'][0x0][_0xbcfc('0x2a')]['id']}});}break;case'intelepeer':if(_0x4e944b[_0xbcfc('0x63')][_0xbcfc('0xd1')]&&_0x4e944b[_0xbcfc('0x63')]['status']){_0x81691=_0x4e944b[_0xbcfc('0x63')][_0xbcfc('0x2d')];return db['SmsMessage'][_0xbcfc('0x5c')]({'where':{'messageId':_0x4e944b[_0xbcfc('0x63')]['redif']}});}break;}}})['then'](handleEntityNotFound(_0x1b3e4b,null))[_0xbcfc('0x22')](function(_0x469c29){if(_0x469c29){_0x2127a3=_0x469c29;switch(_0xb51c65[_0xbcfc('0x42')]){case _0xbcfc('0xc9'):if(_0x81691==='DELIVERED'){return _0x2127a3[_0xbcfc('0x36')]({'read':!![]});}else{logger[_0xbcfc('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','skebby',util[_0xbcfc('0xc8')](_0x4e944b[_0xbcfc('0x63')],{'showHidden':![],'depth':null}));}break;case _0xbcfc('0xd2'):if(_0x81691==='1'){return _0x2127a3['update']({'read':!![]});}else{logger[_0xbcfc('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xbcfc('0x2d'),_0xbcfc('0xc9'),util[_0xbcfc('0xc8')](_0x4e944b[_0xbcfc('0x63')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x4e944b[_0xbcfc('0x63')][_0xbcfc('0xd3')]&&_0x81691>=0xc8&&_0x81691<=0xce){return _0x2127a3[_0xbcfc('0x36')]({'read':!![]});}else{logger[_0xbcfc('0x28')](_0xbcfc('0x26'),'status','clicksend',util[_0xbcfc('0xc8')](_0x4e944b[_0xbcfc('0x63')],{'showHidden':![],'depth':null}));}break;case _0xbcfc('0x87'):var _0x3d10fd=_0x4e944b[_0xbcfc('0x63')][_0xbcfc('0x88')][0x0];if(_0x3d10fd[_0xbcfc('0x2d')][_0xbcfc('0xce')]===_0xbcfc('0xcf')){return _0x2127a3[_0xbcfc('0x36')]({'read':!![]});}else{logger[_0xbcfc('0x28')](_0xbcfc('0x26'),'status',_0xbcfc('0x87'),util['inspect'](_0x4e944b[_0xbcfc('0x63')],{'showHidden':![],'depth':null}));}break;case _0xbcfc('0xd0'):if(_0x81691==_0xbcfc('0xd4')||_0x81691==_0xbcfc('0xd5')){return _0x2127a3['update']({'read':!![]});}else{logger[_0xbcfc('0x28')](_0xbcfc('0x26'),_0xbcfc('0x2d'),_0xbcfc('0xd0'),util[_0xbcfc('0xc8')](_0x4e944b[_0xbcfc('0x63')],{'showHidden':![],'depth':null}));}break;case _0xbcfc('0x8e'):if(_0x81691==_0xbcfc('0xd6')){return _0x2127a3[_0xbcfc('0x36')]({'read':!![]});}else{logger[_0xbcfc('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','bandwidth',util[_0xbcfc('0xc8')](_0x4e944b[_0xbcfc('0x63')],{'showHidden':![],'depth':null}));}break;case _0xbcfc('0x8f'):if(_0x81691===_0xbcfc('0xd7')||_0x81691===_0xbcfc('0xd8')){return _0x2127a3[_0xbcfc('0x36')]({'read':!![]});}else{logger[_0xbcfc('0x28')](_0xbcfc('0x26'),_0xbcfc('0x2d'),_0xbcfc('0x8f'),util[_0xbcfc('0xc8')](_0x4e944b['body'],{'showHidden':![],'depth':null}));}break;}return _0x2127a3;}})['then'](respondWithResult(_0x1b3e4b,null))[_0xbcfc('0x58')](handleError(_0x1b3e4b,null));};exports[_0xbcfc('0xd9')]=function(_0x5313be,_0x5ab377,_0x22fdeb){var _0x4bef92,_0x37eeb8,_0x16161d;return db[_0xbcfc('0x54')][_0xbcfc('0x5c')]({'where':{'id':_0x5313be[_0xbcfc('0x5a')]['id']}})[_0xbcfc('0x22')](handleEntityNotFound(_0x5ab377,null))[_0xbcfc('0x22')](function(_0x5c2785){if(_0x5c2785){_0x16161d=_0x5c2785;logger[_0xbcfc('0xaf')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xbcfc('0x2d'),_0xbcfc('0xc7'),_0x5c2785['type'],util[_0xbcfc('0xc8')](_0x5313be[_0xbcfc('0x46')],{'showHidden':![],'depth':null}));switch(_0x5c2785[_0xbcfc('0x42')]){case _0xbcfc('0x89'):if(_0x5313be['query'][_0xbcfc('0xda')]&&_0x5313be[_0xbcfc('0x46')][_0xbcfc('0xdb')]){_0x37eeb8=_0x5313be[_0xbcfc('0x46')][_0xbcfc('0xdb')];return db['SmsMessage'][_0xbcfc('0x5c')]({'where':{'messageId':_0x5313be[_0xbcfc('0x46')]['message-id']}});}break;}}})['then'](handleEntityNotFound(_0x5ab377,null))[_0xbcfc('0x22')](function(_0x11b6f8){if(_0x11b6f8){_0x4bef92=_0x11b6f8;switch(_0x16161d[_0xbcfc('0x42')]){case _0xbcfc('0x89'):if(_0x37eeb8==='2'||_0x37eeb8==='6'){return _0x4bef92[_0xbcfc('0x36')]({'read':!![]});}else{logger[_0xbcfc('0x28')](_0xbcfc('0x26'),_0xbcfc('0x2d'),_0xbcfc('0x89'),util[_0xbcfc('0xc8')](_0x5313be['query'],{'showHidden':![],'depth':null}));};break;}return _0x4bef92;}})['then'](respondWithResult(_0x5ab377,null))[_0xbcfc('0x58')](handleError(_0x5ab377,null));};exports[_0xbcfc('0xdc')]=function(_0x3cf637,_0x559ba4,_0x3a2180){return db[_0xbcfc('0x54')][_0xbcfc('0x5c')]({'where':{'id':_0x3cf637[_0xbcfc('0x5a')]['id']}})[_0xbcfc('0x22')](handleEntityNotFound(_0x559ba4,null))[_0xbcfc('0x22')](function(_0x2fcb6c){if(_0x2fcb6c){return _0x2fcb6c['addAgents'](_0x3cf637[_0xbcfc('0x63')]['ids'],_['omit'](_0x3cf637[_0xbcfc('0x63')],[_0xbcfc('0x6a'),'id'])||{})[_0xbcfc('0xc5')](function(_0x14cb96){for(var _0x5d753e=0x0;_0x5d753e<_0x3cf637[_0xbcfc('0x63')]['ids'][_0xbcfc('0x4b')];_0x5d753e+=0x1){socket[_0xbcfc('0xdd')](_0xbcfc('0xde'),{'UserId':Number(_0x3cf637[_0xbcfc('0x63')][_0xbcfc('0x6a')][_0x5d753e]),'SmsAccountId':Number(_0x3cf637[_0xbcfc('0x5a')]['id'])});}return _0x14cb96;});}})[_0xbcfc('0x22')](respondWithResult(_0x559ba4,null))[_0xbcfc('0x58')](handleError(_0x559ba4,null));};exports[_0xbcfc('0xdf')]=function(_0x295207,_0x44aa03,_0x16e217){return db[_0xbcfc('0x54')][_0xbcfc('0x5c')]({'where':{'id':_0x295207[_0xbcfc('0x5a')]['id']}})[_0xbcfc('0x22')](handleEntityNotFound(_0x44aa03,null))[_0xbcfc('0x22')](function(_0x2ab4e6){if(_0x2ab4e6){return _0x2ab4e6[_0xbcfc('0xdf')](_0x295207[_0xbcfc('0x46')]['ids'])['then'](function(){if(_[_0xbcfc('0xe0')](_0x295207['query'][_0xbcfc('0x6a')])){for(var _0x174dd4=0x0;_0x174dd4<_0x295207['query'][_0xbcfc('0x6a')][_0xbcfc('0x4b')];_0x174dd4+=0x1){socket[_0xbcfc('0xdd')](_0xbcfc('0xe1'),{'UserId':Number(_0x295207['query'][_0xbcfc('0x6a')][_0x174dd4]),'SmsAccountId':Number(_0x295207[_0xbcfc('0x5a')]['id'])});}}else{socket['emit'](_0xbcfc('0xe1'),{'UserId':Number(_0x295207[_0xbcfc('0x46')][_0xbcfc('0x6a')]),'SmsAccountId':Number(_0x295207[_0xbcfc('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x44aa03,null))[_0xbcfc('0x58')](handleError(_0x44aa03,null));};exports[_0xbcfc('0xe2')]=function(_0x4daf45,_0x3409be,_0xf9da81){var _0x1ca02b={};var _0x2f3048={};var _0x11331f;var _0x48b86c;return db['SmsAccount'][_0xbcfc('0x6e')]({'where':{'id':_0x4daf45[_0xbcfc('0x5a')]['id']}})[_0xbcfc('0x22')](handleEntityNotFound(_0x3409be,null))['then'](function(_0x5bfdf2){if(_0x5bfdf2){_0x11331f=_0x5bfdf2;_0x2f3048[_0xbcfc('0x44')]=_['keys'](db['User'][_0xbcfc('0x40')]);_0x2f3048[_0xbcfc('0x46')]=_[_0xbcfc('0x45')](_0x4daf45[_0xbcfc('0x46')]);_0x2f3048[_0xbcfc('0x47')]=_['intersection'](_0x2f3048[_0xbcfc('0x44')],_0x2f3048['query']);_0x1ca02b[_0xbcfc('0x48')]=_[_0xbcfc('0x49')](_0x2f3048['model'],qs[_0xbcfc('0x4a')](_0x4daf45[_0xbcfc('0x46')][_0xbcfc('0x4a')]));_0x1ca02b[_0xbcfc('0x48')]=_0x1ca02b[_0xbcfc('0x48')][_0xbcfc('0x4b')]?_0x1ca02b[_0xbcfc('0x48')]:_0x2f3048[_0xbcfc('0x44')];_0x1ca02b[_0xbcfc('0x6f')]=qs[_0xbcfc('0x4e')](_0x4daf45[_0xbcfc('0x46')][_0xbcfc('0x4e')]);_0x1ca02b['where']=qs['filters'](_[_0xbcfc('0x50')](_0x4daf45[_0xbcfc('0x46')],_0x2f3048[_0xbcfc('0x47')]));if(_0x4daf45[_0xbcfc('0x46')]['filter']){_0x1ca02b['where']=_['merge'](_0x1ca02b[_0xbcfc('0x4f')],{'$or':_['map'](_0x1ca02b['attributes'],function(_0x5768a0){var _0x1eba8a={};_0x1eba8a[_0x5768a0]={'$like':'%'+_0x4daf45[_0xbcfc('0x46')][_0xbcfc('0x51')]+'%'};return _0x1eba8a;})});}_0x1ca02b=_[_0xbcfc('0x5b')]({},_0x1ca02b,_0x4daf45[_0xbcfc('0x53')]);return _0x11331f[_0xbcfc('0xe2')](_0x1ca02b);}})[_0xbcfc('0x22')](function(_0x3d2be2){if(_0x3d2be2){_0x48b86c=_0x3d2be2['length'];if(!_0x4daf45[_0xbcfc('0x46')]['hasOwnProperty'](_0xbcfc('0x4d'))){_0x1ca02b[_0xbcfc('0x31')]=qs[_0xbcfc('0x31')](_0x4daf45[_0xbcfc('0x46')][_0xbcfc('0x31')]);_0x1ca02b[_0xbcfc('0x30')]=qs[_0xbcfc('0x30')](_0x4daf45[_0xbcfc('0x46')]['offset']);}return _0x11331f[_0xbcfc('0xe2')](_0x1ca02b);}})[_0xbcfc('0x22')](function(_0x30f433){if(_0x30f433){return _0x30f433?{'count':_0x48b86c,'rows':_0x30f433}:null;}})['then'](respondWithResult(_0x3409be,null))[_0xbcfc('0x58')](handleError(_0x3409be,null));}; \ No newline at end of file +var _0xc275=['unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','interaction','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','set','text/xml','send','\x0a','addApplications','transaction','SmsApplication','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','user','out','Messages','dataValues','skebby','skebby_dispatch_id','connectel','statusInt','requestid','status_code','DELIVERED','groupName','redif','inspect','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','state','csc','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','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','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsAccount.socket','jayson/promise','client','http','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','sendStatus','status','end','json','limit','undefined','offset','count','Content-Range','apply','save','update','destroy','get','SmsAccounts','stack','name','index','Pause','map','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','type','VIRTUAL','SmsAccount','includeAll','findAll','show','params','include','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','mandatoryDispositionPause','find','describe','SmsAccountId','Disposition','getDispositions','rows','removeDispositions','addAnswer','getAnswers','findOne','nolimit','options','CannedAnswer','removeAnswers','ids','notify','sms','Applications','account','applications','priority','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','messageId','sender','text','clicksend','message_id','plivo','Text','infobip','results','originatingAddress','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','mapKey','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','DESC','omit','Contacts','CmContact','contact','SmsInteraction','spread','created','autoclose','push'];(function(_0x15e71f,_0x21022b){var _0x72a68b=function(_0x592be7){while(--_0x592be7){_0x15e71f['push'](_0x15e71f['shift']());}};_0x72a68b(++_0x21022b);}(_0xc275,0x11b));var _0x5c27=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xc275[_0xa148b7];return _0x51efd3;};'use strict';var emlformat=require(_0x5c27('0x0'));var rimraf=require(_0x5c27('0x1'));var zipdir=require(_0x5c27('0x2'));var jsonpatch=require(_0x5c27('0x3'));var rp=require(_0x5c27('0x4'));var moment=require('moment');var BPromise=require(_0x5c27('0x5'));var Mustache=require('mustache');var util=require(_0x5c27('0x6'));var path=require(_0x5c27('0x7'));var sox=require(_0x5c27('0x8'));var csv=require(_0x5c27('0x9'));var ejs=require(_0x5c27('0xa'));var fs=require('fs');var fs_extra=require(_0x5c27('0xb'));var _=require(_0x5c27('0xc'));var squel=require(_0x5c27('0xd'));var crypto=require('crypto');var jsforce=require(_0x5c27('0xe'));var deskjs=require(_0x5c27('0xf'));var toCsv=require(_0x5c27('0x9'));var querystring=require(_0x5c27('0x10'));var Papa=require(_0x5c27('0x11'));var Redis=require(_0x5c27('0x12'));var authService=require(_0x5c27('0x13'));var qs=require(_0x5c27('0x14'));var as=require(_0x5c27('0x15'));var hardwareService=require(_0x5c27('0x16'));var logger=require(_0x5c27('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x5c27('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x5c27('0x19'))['db'];config[_0x5c27('0x1a')]=_[_0x5c27('0x1b')](config[_0x5c27('0x1a')],{'host':_0x5c27('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5c27('0x1a')]));require(_0x5c27('0x1d'))['register'](socket);var jayson=require(_0x5c27('0x1e'));var client=jayson[_0x5c27('0x1f')][_0x5c27('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x469e37,_0x2bc7bd,_0x5e62b0,_0xeed205){return new BPromise(function(_0x3d53aa,_0x4bfa4e){var _0xb014c3=_0xeed205||client;return _0xb014c3[_0x5c27('0x21')](_0x469e37,_0x5e62b0)[_0x5c27('0x22')](function(_0x4c6f6f){logger['info'](_0x5c27('0x23'),_0x2bc7bd,_0x5c27('0x24'));logger[_0x5c27('0x25')](_0x5c27('0x26'),_0x2bc7bd,_0x5c27('0x24'),JSON[_0x5c27('0x27')](_0x4c6f6f));if(_0x4c6f6f[_0x5c27('0x28')]){if(_0x4c6f6f['error']['code']===0x1f4){logger[_0x5c27('0x28')](_0x5c27('0x23'),_0x2bc7bd,_0x4c6f6f[_0x5c27('0x28')][_0x5c27('0x29')]);return _0x4bfa4e(_0x4c6f6f[_0x5c27('0x28')][_0x5c27('0x29')]);}logger['error'](_0x5c27('0x23'),_0x2bc7bd,_0x4c6f6f[_0x5c27('0x28')]['message']);return _0x3d53aa(_0x4c6f6f['error'][_0x5c27('0x29')]);}else{logger[_0x5c27('0x2a')](_0x5c27('0x23'),_0x2bc7bd,_0x5c27('0x24'));_0x3d53aa(_0x4c6f6f[_0x5c27('0x2b')][_0x5c27('0x29')]);}})['catch'](function(_0xe51d6e){logger[_0x5c27('0x28')](_0x5c27('0x23'),_0x2bc7bd,_0xe51d6e);_0x4bfa4e(_0xe51d6e);});});}function respondWithStatusCode(_0x20d165,_0x5088e7){_0x5088e7=_0x5088e7||0xcc;return function(_0x6ad31a){if(_0x6ad31a){return _0x20d165[_0x5c27('0x2c')](_0x5088e7);}return _0x20d165[_0x5c27('0x2d')](_0x5088e7)[_0x5c27('0x2e')]();};}function respondWithResult(_0x3a3bfe,_0xe55c47){_0xe55c47=_0xe55c47||0xc8;return function(_0x28a712){if(_0x28a712){return _0x3a3bfe[_0x5c27('0x2d')](_0xe55c47)[_0x5c27('0x2f')](_0x28a712);}};}function respondWithFilteredResult(_0x4e620a,_0x772ca2){return function(_0x1cdf01){if(_0x1cdf01){var _0x289353=typeof _0x772ca2['offset']==='undefined'&&typeof _0x772ca2[_0x5c27('0x30')]===_0x5c27('0x31');var _0x23b889=_0x1cdf01['count'];var _0x4eb090=_0x289353?0x0:_0x772ca2[_0x5c27('0x32')];var _0x2b3edb=_0x289353?_0x1cdf01[_0x5c27('0x33')]:_0x772ca2['offset']+_0x772ca2['limit'];var _0x4cee25;if(_0x2b3edb>=_0x23b889){_0x2b3edb=_0x23b889;_0x4cee25=0xc8;}else{_0x4cee25=0xce;}_0x4e620a[_0x5c27('0x2d')](_0x4cee25);return _0x4e620a['set'](_0x5c27('0x34'),_0x4eb090+'-'+_0x2b3edb+'/'+_0x23b889)[_0x5c27('0x2f')](_0x1cdf01);}return null;};}function patchUpdates(_0x9351af){return function(_0x59e43d){try{jsonpatch[_0x5c27('0x35')](_0x59e43d,_0x9351af,!![]);}catch(_0x32b816){return BPromise['reject'](_0x32b816);}return _0x59e43d[_0x5c27('0x36')]();};}function saveUpdates(_0x2c4ff4,_0x7928b9){return function(_0x47eaa0){if(_0x47eaa0){return _0x47eaa0[_0x5c27('0x37')](_0x2c4ff4)['then'](function(_0x172cc1){return _0x172cc1;});}return null;};}function removeEntity(_0x255c66,_0x1be6e7){return function(_0x1358bf){if(_0x1358bf){return _0x1358bf[_0x5c27('0x38')]()[_0x5c27('0x22')](function(){var _0x38435e=_0x1358bf[_0x5c27('0x39')]({'plain':!![]});var _0x39d1b3=_0x5c27('0x3a');return db['UserProfileResource'][_0x5c27('0x38')]({'where':{'type':_0x39d1b3,'resourceId':_0x38435e['id']}})['then'](function(){return _0x1358bf;});})['then'](function(){_0x255c66['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x467c40,_0x5b9191){return function(_0x406399){if(!_0x406399){_0x467c40[_0x5c27('0x2c')](0x194);}return _0x406399;};}function handleError(_0x21abbe,_0x2f0b07){_0x2f0b07=_0x2f0b07||0x1f4;return function(_0xdf7f93){logger[_0x5c27('0x28')](_0xdf7f93[_0x5c27('0x3b')]);if(_0xdf7f93[_0x5c27('0x3c')]){delete _0xdf7f93[_0x5c27('0x3c')];}_0x21abbe[_0x5c27('0x2d')](_0x2f0b07)['send'](_0xdf7f93);};}exports[_0x5c27('0x3d')]=function(_0xf31f0,_0x4ab04b){var _0x2ceff4={'include':[{'model':db[_0x5c27('0x3e')],'as':'mandatoryDispositionPause'}]},_0x2ab0cc={},_0x374c91={'count':0x0,'rows':[]};var _0x1a509a=_[_0x5c27('0x3f')](db['SmsAccount'][_0x5c27('0x40')],function(_0x4a807c){return{'name':_0x4a807c[_0x5c27('0x41')],'type':_0x4a807c['type'][_0x5c27('0x42')]};});_0x2ab0cc['model']=_['map'](_0x1a509a,_0x5c27('0x3c'));_0x2ab0cc[_0x5c27('0x43')]=_[_0x5c27('0x44')](_0xf31f0[_0x5c27('0x43')]);_0x2ab0cc[_0x5c27('0x45')]=_[_0x5c27('0x46')](_0x2ab0cc['model'],_0x2ab0cc[_0x5c27('0x43')]);_0x2ceff4[_0x5c27('0x47')]=_[_0x5c27('0x46')](_0x2ab0cc[_0x5c27('0x48')],qs['fields'](_0xf31f0[_0x5c27('0x43')][_0x5c27('0x49')]));_0x2ceff4[_0x5c27('0x47')]=_0x2ceff4['attributes'][_0x5c27('0x4a')]?_0x2ceff4['attributes']:_0x2ab0cc[_0x5c27('0x48')];if(!_0xf31f0[_0x5c27('0x43')][_0x5c27('0x4b')]('nolimit')){_0x2ceff4[_0x5c27('0x30')]=qs[_0x5c27('0x30')](_0xf31f0['query'][_0x5c27('0x30')]);_0x2ceff4[_0x5c27('0x32')]=qs[_0x5c27('0x32')](_0xf31f0[_0x5c27('0x43')][_0x5c27('0x32')]);}_0x2ceff4[_0x5c27('0x4c')]=qs['sort'](_0xf31f0[_0x5c27('0x43')][_0x5c27('0x4d')]);_0x2ceff4['where']=qs['filters'](_[_0x5c27('0x4e')](_0xf31f0[_0x5c27('0x43')],_0x2ab0cc['filters']),_0x1a509a);if(_0xf31f0[_0x5c27('0x43')][_0x5c27('0x4f')]){_0x2ceff4['where']=_[_0x5c27('0x50')](_0x2ceff4[_0x5c27('0x51')],{'$or':_[_0x5c27('0x3f')](_0x1a509a,function(_0x5d511e){if(_0x5d511e[_0x5c27('0x52')]!==_0x5c27('0x53')){var _0x302886={};_0x302886[_0x5d511e[_0x5c27('0x3c')]]={'$like':'%'+_0xf31f0[_0x5c27('0x43')][_0x5c27('0x4f')]+'%'};return _0x302886;}})});}_0x2ceff4=_[_0x5c27('0x50')]({},_0x2ceff4,_0xf31f0['options']);var _0x5cb7ee={'where':_0x2ceff4[_0x5c27('0x51')]};return db[_0x5c27('0x54')][_0x5c27('0x33')](_0x5cb7ee)[_0x5c27('0x22')](function(_0x2664e6){_0x374c91[_0x5c27('0x33')]=_0x2664e6;if(_0xf31f0['query'][_0x5c27('0x55')]){_0x2ceff4['include']=[{'all':!![]}];}return db[_0x5c27('0x54')][_0x5c27('0x56')](_0x2ceff4);})['then'](function(_0x179a9c){_0x374c91['rows']=_0x179a9c;return _0x374c91;})[_0x5c27('0x22')](respondWithFilteredResult(_0x4ab04b,_0x2ceff4))['catch'](handleError(_0x4ab04b,null));};exports[_0x5c27('0x57')]=function(_0x23ba06,_0x3367c5){var _0x1b9ec5={'raw':![],'where':{'id':_0x23ba06[_0x5c27('0x58')]['id']},'include':[{'model':db[_0x5c27('0x3e')],'as':'mandatoryDispositionPause'}]},_0x6cfaf0={};_0x6cfaf0[_0x5c27('0x48')]=_['keys'](db[_0x5c27('0x54')][_0x5c27('0x40')]);_0x6cfaf0[_0x5c27('0x43')]=_[_0x5c27('0x44')](_0x23ba06[_0x5c27('0x43')]);_0x6cfaf0['filters']=_[_0x5c27('0x46')](_0x6cfaf0[_0x5c27('0x48')],_0x6cfaf0[_0x5c27('0x43')]);_0x1b9ec5[_0x5c27('0x47')]=_['intersection'](_0x6cfaf0[_0x5c27('0x48')],qs[_0x5c27('0x49')](_0x23ba06[_0x5c27('0x43')][_0x5c27('0x49')]));_0x1b9ec5[_0x5c27('0x47')]=_0x1b9ec5[_0x5c27('0x47')][_0x5c27('0x4a')]?_0x1b9ec5['attributes']:_0x6cfaf0[_0x5c27('0x48')];if(_0x23ba06['query'][_0x5c27('0x55')]){_0x1b9ec5[_0x5c27('0x59')]=[{'all':!![]}];}_0x1b9ec5=_[_0x5c27('0x50')]({},_0x1b9ec5,_0x23ba06['options']);return db['SmsAccount']['find'](_0x1b9ec5)[_0x5c27('0x22')](handleEntityNotFound(_0x3367c5,null))[_0x5c27('0x22')](respondWithResult(_0x3367c5,null))[_0x5c27('0x5a')](handleError(_0x3367c5,null));};exports[_0x5c27('0x5b')]=function(_0x40bbb2,_0x2dd07c){return db['SmsAccount']['create'](_0x40bbb2['body'],{})[_0x5c27('0x22')](function(_0x18ca35){var _0x1ef7db=_0x40bbb2['user'][_0x5c27('0x39')]({'plain':!![]});if(!_0x1ef7db)throw new Error(_0x5c27('0x5c'));if(_0x1ef7db['role']==='user'){var _0x314b1b=_0x18ca35[_0x5c27('0x39')]({'plain':!![]});var _0x4a6e0f=_0x5c27('0x3a');return db[_0x5c27('0x5d')]['find']({'where':{'name':_0x4a6e0f,'userProfileId':_0x1ef7db['userProfileId']},'raw':!![]})['then'](function(_0x3c484f){if(_0x3c484f&&_0x3c484f['autoAssociation']===0x0){return db['UserProfileResource'][_0x5c27('0x5b')]({'name':_0x314b1b[_0x5c27('0x3c')],'resourceId':_0x314b1b['id'],'type':_0x3c484f[_0x5c27('0x3c')],'sectionId':_0x3c484f['id']},{})[_0x5c27('0x22')](function(){return _0x18ca35;});}else{return _0x18ca35;}})[_0x5c27('0x5a')](function(_0xc6f66c){logger[_0x5c27('0x28')](_0x5c27('0x5e'),_0xc6f66c);throw _0xc6f66c;});}return _0x18ca35;})[_0x5c27('0x22')](respondWithResult(_0x2dd07c,0xc9))['catch'](handleError(_0x2dd07c,null));};exports[_0x5c27('0x37')]=function(_0x37afac,_0x1584f6){if(_0x37afac[_0x5c27('0x5f')]['id']){delete _0x37afac['body']['id'];}return db[_0x5c27('0x54')]['find']({'where':{'id':_0x37afac[_0x5c27('0x58')]['id']},'include':[{'model':db[_0x5c27('0x3e')],'as':_0x5c27('0x60')}]})['then'](handleEntityNotFound(_0x1584f6,null))['then'](saveUpdates(_0x37afac[_0x5c27('0x5f')],null))[_0x5c27('0x22')](respondWithResult(_0x1584f6,null))[_0x5c27('0x5a')](handleError(_0x1584f6,null));};exports[_0x5c27('0x38')]=function(_0x4db2a7,_0x53ba15){return db[_0x5c27('0x54')][_0x5c27('0x61')]({'where':{'id':_0x4db2a7[_0x5c27('0x58')]['id']}})[_0x5c27('0x22')](handleEntityNotFound(_0x53ba15,null))[_0x5c27('0x22')](removeEntity(_0x53ba15,null))[_0x5c27('0x5a')](handleError(_0x53ba15,null));};exports[_0x5c27('0x62')]=function(_0x595f4e,_0x14ef7f){return db[_0x5c27('0x54')][_0x5c27('0x62')]()[_0x5c27('0x22')](respondWithResult(_0x14ef7f,null))[_0x5c27('0x5a')](handleError(_0x14ef7f,null));};exports['addDisposition']=function(_0x573702,_0x264b73,_0x115385){if(_0x573702[_0x5c27('0x5f')]['id']){delete _0x573702[_0x5c27('0x5f')]['id'];}return db[_0x5c27('0x54')][_0x5c27('0x61')]({'where':{'id':_0x573702[_0x5c27('0x58')]['id']}})[_0x5c27('0x22')](handleEntityNotFound(_0x264b73,null))['then'](function(_0x831fae){if(_0x831fae){_0x573702['body'][_0x5c27('0x63')]=_0x831fae['id'];return db[_0x5c27('0x64')]['create'](_0x573702[_0x5c27('0x5f')]);}})[_0x5c27('0x22')](respondWithResult(_0x264b73,null))['catch'](handleError(_0x264b73,null));};exports[_0x5c27('0x65')]=function(_0x37c866,_0x4e3e9c,_0x1b0662){var _0x418742={'raw':![],'where':{}};var _0x50d182={};var _0x542733={'count':0x0,'rows':[]};return db[_0x5c27('0x54')]['findOne']({'where':{'id':_0x37c866[_0x5c27('0x58')]['id']}})[_0x5c27('0x22')](handleEntityNotFound(_0x4e3e9c,null))['then'](function(_0xdaf50d){if(_0xdaf50d){_0x50d182[_0x5c27('0x48')]=_['keys'](db[_0x5c27('0x64')][_0x5c27('0x40')]);_0x50d182['query']=_[_0x5c27('0x44')](_0x37c866[_0x5c27('0x43')]);_0x50d182['filters']=_[_0x5c27('0x46')](_0x50d182[_0x5c27('0x48')],_0x50d182[_0x5c27('0x43')]);_0x418742[_0x5c27('0x47')]=_[_0x5c27('0x46')](_0x50d182['model'],qs['fields'](_0x37c866[_0x5c27('0x43')]['fields']));_0x418742[_0x5c27('0x47')]=_0x418742[_0x5c27('0x47')][_0x5c27('0x4a')]?_0x418742['attributes']:_0x50d182[_0x5c27('0x48')];if(!_0x37c866['query']['hasOwnProperty']('nolimit')){_0x418742[_0x5c27('0x30')]=qs[_0x5c27('0x30')](_0x37c866[_0x5c27('0x43')][_0x5c27('0x30')]);_0x418742[_0x5c27('0x32')]=qs[_0x5c27('0x32')](_0x37c866[_0x5c27('0x43')][_0x5c27('0x32')]);}_0x418742['order']=qs['sort'](_0x37c866[_0x5c27('0x43')][_0x5c27('0x4d')]);_0x418742[_0x5c27('0x51')]=qs[_0x5c27('0x45')](_[_0x5c27('0x4e')](_0x37c866[_0x5c27('0x43')],_0x50d182[_0x5c27('0x45')]));_0x418742[_0x5c27('0x51')][_0x5c27('0x63')]=_0xdaf50d['id'];if(_0x37c866[_0x5c27('0x43')][_0x5c27('0x4f')]){_0x418742[_0x5c27('0x51')]=_[_0x5c27('0x50')](_0x418742['where'],{'$or':_[_0x5c27('0x3f')](_0x418742[_0x5c27('0x47')],function(_0x46994f){var _0x29f65b={};_0x29f65b[_0x46994f]={'$like':'%'+_0x37c866[_0x5c27('0x43')][_0x5c27('0x4f')]+'%'};return _0x29f65b;})});}_0x418742=_[_0x5c27('0x50')]({},_0x418742,_0x37c866['options']);return db['Disposition'][_0x5c27('0x33')]({'where':_0x418742[_0x5c27('0x51')]})['then'](function(_0x58299d){_0x542733[_0x5c27('0x33')]=_0x58299d;if(_0x37c866[_0x5c27('0x43')][_0x5c27('0x55')]){_0x418742[_0x5c27('0x59')]=[{'all':!![]}];}return db[_0x5c27('0x64')][_0x5c27('0x56')](_0x418742);})['then'](function(_0x217cf1){_0x542733[_0x5c27('0x66')]=_0x217cf1;return _0x542733;});}})[_0x5c27('0x22')](respondWithFilteredResult(_0x4e3e9c,_0x418742))[_0x5c27('0x5a')](handleError(_0x4e3e9c,null));};exports[_0x5c27('0x67')]=function(_0x4f384b,_0x316938,_0xc8b3b4){return db[_0x5c27('0x54')][_0x5c27('0x61')]({'where':{'id':_0x4f384b[_0x5c27('0x58')]['id']}})['then'](handleEntityNotFound(_0x316938,null))[_0x5c27('0x22')](function(_0x3a0009){if(_0x3a0009){return _0x3a0009['removeDispositions'](_0x4f384b[_0x5c27('0x43')]['ids']);}})['then'](respondWithStatusCode(_0x316938,null))['catch'](handleError(_0x316938,null));};exports[_0x5c27('0x68')]=function(_0x1519ca,_0x4ced0a,_0x284c54){if(_0x1519ca[_0x5c27('0x5f')]['id']){delete _0x1519ca[_0x5c27('0x5f')]['id'];}return db[_0x5c27('0x54')][_0x5c27('0x61')]({'where':{'id':_0x1519ca[_0x5c27('0x58')]['id']}})[_0x5c27('0x22')](handleEntityNotFound(_0x4ced0a,null))[_0x5c27('0x22')](function(_0x49a92a){if(_0x49a92a){_0x1519ca[_0x5c27('0x5f')][_0x5c27('0x63')]=_0x49a92a['id'];return db['CannedAnswer'][_0x5c27('0x5b')](_0x1519ca['body']);}})[_0x5c27('0x22')](respondWithResult(_0x4ced0a,null))['catch'](handleError(_0x4ced0a,null));};exports[_0x5c27('0x69')]=function(_0x1cf81f,_0x34ddba,_0x4e8a70){var _0x339774={'raw':![],'where':{}};var _0x3bc343={};var _0xa186ad={'count':0x0,'rows':[]};return db[_0x5c27('0x54')][_0x5c27('0x6a')]({'where':{'id':_0x1cf81f[_0x5c27('0x58')]['id']}})['then'](handleEntityNotFound(_0x34ddba,null))['then'](function(_0x5b9170){if(_0x5b9170){_0x3bc343['model']=_[_0x5c27('0x44')](db['CannedAnswer'][_0x5c27('0x40')]);_0x3bc343['query']=_['keys'](_0x1cf81f[_0x5c27('0x43')]);_0x3bc343[_0x5c27('0x45')]=_[_0x5c27('0x46')](_0x3bc343[_0x5c27('0x48')],_0x3bc343[_0x5c27('0x43')]);_0x339774[_0x5c27('0x47')]=_[_0x5c27('0x46')](_0x3bc343['model'],qs[_0x5c27('0x49')](_0x1cf81f[_0x5c27('0x43')][_0x5c27('0x49')]));_0x339774[_0x5c27('0x47')]=_0x339774[_0x5c27('0x47')][_0x5c27('0x4a')]?_0x339774[_0x5c27('0x47')]:_0x3bc343[_0x5c27('0x48')];if(!_0x1cf81f[_0x5c27('0x43')][_0x5c27('0x4b')](_0x5c27('0x6b'))){_0x339774['limit']=qs[_0x5c27('0x30')](_0x1cf81f['query'][_0x5c27('0x30')]);_0x339774[_0x5c27('0x32')]=qs[_0x5c27('0x32')](_0x1cf81f[_0x5c27('0x43')][_0x5c27('0x32')]);}_0x339774[_0x5c27('0x4c')]=qs[_0x5c27('0x4d')](_0x1cf81f[_0x5c27('0x43')][_0x5c27('0x4d')]);_0x339774[_0x5c27('0x51')]=qs[_0x5c27('0x45')](_['pick'](_0x1cf81f[_0x5c27('0x43')],_0x3bc343[_0x5c27('0x45')]));_0x339774[_0x5c27('0x51')][_0x5c27('0x63')]=_0x5b9170['id'];if(_0x1cf81f[_0x5c27('0x43')][_0x5c27('0x4f')]){_0x339774[_0x5c27('0x51')]=_['merge'](_0x339774['where'],{'$or':_['map'](_0x339774['attributes'],function(_0x1ef46b){var _0x1ab371={};_0x1ab371[_0x1ef46b]={'$like':'%'+_0x1cf81f[_0x5c27('0x43')][_0x5c27('0x4f')]+'%'};return _0x1ab371;})});}_0x339774=_['merge']({},_0x339774,_0x1cf81f[_0x5c27('0x6c')]);return db[_0x5c27('0x6d')][_0x5c27('0x33')]({'where':_0x339774[_0x5c27('0x51')]})[_0x5c27('0x22')](function(_0x336416){_0xa186ad['count']=_0x336416;if(_0x1cf81f[_0x5c27('0x43')][_0x5c27('0x55')]){_0x339774[_0x5c27('0x59')]=[{'all':!![]}];}return db[_0x5c27('0x6d')][_0x5c27('0x56')](_0x339774);})['then'](function(_0x5b7165){_0xa186ad[_0x5c27('0x66')]=_0x5b7165;return _0xa186ad;});}})['then'](respondWithFilteredResult(_0x34ddba,_0x339774))[_0x5c27('0x5a')](handleError(_0x34ddba,null));};exports[_0x5c27('0x6e')]=function(_0x35a874,_0x4f5480,_0x41a41c){return db[_0x5c27('0x54')][_0x5c27('0x61')]({'where':{'id':_0x35a874['params']['id']}})[_0x5c27('0x22')](handleEntityNotFound(_0x4f5480,null))[_0x5c27('0x22')](function(_0x5bafaf){if(_0x5bafaf){return _0x5bafaf[_0x5c27('0x6e')](_0x35a874[_0x5c27('0x43')][_0x5c27('0x6f')]);}})[_0x5c27('0x22')](respondWithStatusCode(_0x4f5480,null))[_0x5c27('0x5a')](handleError(_0x4f5480,null));};exports[_0x5c27('0x70')]=function(_0x463d3b,_0x3b9af7,_0x55e1c9){var _0x3a13c1={'channel':_0x5c27('0x71')};var _0x3b3e16=[];var _0x36003c=[];var _0x324c6f={};return db[_0x5c27('0x54')][_0x5c27('0x61')]({'where':{'id':_0x463d3b['params']['id']},'include':[{'model':db['SmsApplication'],'as':_0x5c27('0x72')}]})[_0x5c27('0x22')](handleEntityNotFound(_0x3b9af7,null))[_0x5c27('0x22')](function(_0x405446){_0x3a13c1[_0x5c27('0x73')]=_0x405446;_0x3a13c1[_0x5c27('0x74')]=_['orderBy'](_0x405446[_0x5c27('0x72')],[_0x5c27('0x75')],['asc']);if(_0x3a13c1[_0x5c27('0x73')][_0x5c27('0x72')]){delete _0x3a13c1[_0x5c27('0x73')]['Applications'];}return db['CmContact']['describe']();})['then'](function(_0x2f737a){if(!_0x2f737a){throw new db[(_0x5c27('0x76'))]['ValidationError'](_0x5c27('0x77'));}_0x3b3e16=_[_0x5c27('0x78')](_['keys'](_0x2f737a),[_0x5c27('0x79'),_0x5c27('0x7a')]);_0x36003c=_[_0x5c27('0x78')](_[_0x5c27('0x44')](_0x2f737a),[_0x5c27('0x79'),_0x5c27('0x7a'),_0x5c27('0x7b'),_0x5c27('0x7c')]);_0x3a13c1[_0x5c27('0x5f')]={'mapKey':_0x5c27('0x7d')};if(_0x3a13c1[_0x5c27('0x73')]['type']){switch(_0x3a13c1[_0x5c27('0x73')][_0x5c27('0x52')]){case'twilio':_0x3a13c1[_0x5c27('0x5f')][_0x5c27('0x7e')]=_0x463d3b[_0x5c27('0x5f')][_0x5c27('0x7f')];_0x3a13c1[_0x5c27('0x5f')][_0x5c27('0x5f')]=_0x463d3b[_0x5c27('0x5f')]['Body'];_0x3a13c1['body'][_0x5c27('0x80')]=_0x463d3b[_0x5c27('0x5f')]['MessageSid'];break;case'skebby':_0x3a13c1[_0x5c27('0x5f')][_0x5c27('0x7e')]='+'+_0x463d3b[_0x5c27('0x5f')][_0x5c27('0x81')];_0x3a13c1['body'][_0x5c27('0x5f')]=_0x463d3b[_0x5c27('0x5f')][_0x5c27('0x82')];break;case'connectel':_0x3a13c1[_0x5c27('0x5f')]['from']=_0x463d3b[_0x5c27('0x5f')][_0x5c27('0x7e')];_0x3a13c1[_0x5c27('0x5f')][_0x5c27('0x5f')]=_0x463d3b['body']['message'];break;case _0x5c27('0x83'):_0x3a13c1[_0x5c27('0x5f')][_0x5c27('0x7e')]=_0x463d3b[_0x5c27('0x5f')][_0x5c27('0x7e')];_0x3a13c1[_0x5c27('0x5f')]['body']=_0x463d3b[_0x5c27('0x5f')][_0x5c27('0x5f')];_0x3a13c1['body'][_0x5c27('0x80')]=_0x463d3b[_0x5c27('0x5f')][_0x5c27('0x84')];break;case _0x5c27('0x85'):_0x3a13c1[_0x5c27('0x5f')][_0x5c27('0x7e')]=_0x463d3b[_0x5c27('0x5f')]['From'];_0x3a13c1[_0x5c27('0x5f')][_0x5c27('0x5f')]=_0x463d3b[_0x5c27('0x5f')][_0x5c27('0x86')];_0x3a13c1[_0x5c27('0x5f')]['messageId']=_0x463d3b[_0x5c27('0x5f')]['MessageUUID'];break;case _0x5c27('0x87'):_0x3a13c1[_0x5c27('0x5f')][_0x5c27('0x7e')]='+'+_0x463d3b['body'][_0x5c27('0x88')][0x0][_0x5c27('0x7e')];_0x3a13c1[_0x5c27('0x5f')][_0x5c27('0x5f')]=_0x463d3b['body'][_0x5c27('0x88')][0x0][_0x5c27('0x82')];_0x3a13c1[_0x5c27('0x5f')]['messageId']=_0x463d3b[_0x5c27('0x5f')][_0x5c27('0x88')][0x0][_0x5c27('0x80')];break;case'csc':_0x3a13c1[_0x5c27('0x5f')][_0x5c27('0x7e')]=_0x463d3b[_0x5c27('0x5f')][_0x5c27('0x89')];_0x3a13c1[_0x5c27('0x5f')][_0x5c27('0x5f')]=_0x463d3b['body']['segmentedMessage']['message'];break;case _0x5c27('0x8a'):_0x3a13c1[_0x5c27('0x5f')][_0x5c27('0x7e')]=_0x463d3b[_0x5c27('0x5f')][_0x5c27('0x8b')];_0x3a13c1['body'][_0x5c27('0x5f')]=_0x463d3b[_0x5c27('0x5f')][_0x5c27('0x82')];_0x3a13c1['body']['messageId']=_0x463d3b[_0x5c27('0x5f')][_0x5c27('0x8c')];break;case _0x5c27('0x8d'):_0x3a13c1[_0x5c27('0x5f')][_0x5c27('0x80')]=_0x463d3b[_0x5c27('0x5f')][0x0][_0x5c27('0x29')]['id'];_0x3a13c1['body'][_0x5c27('0x7e')]=_0x463d3b[_0x5c27('0x5f')][0x0][_0x5c27('0x29')][_0x5c27('0x7e')];_0x3a13c1[_0x5c27('0x5f')]['body']=_0x463d3b[_0x5c27('0x5f')][0x0]['message'][_0x5c27('0x82')];break;case _0x5c27('0x8e'):_0x3a13c1[_0x5c27('0x5f')][_0x5c27('0x7e')]=_0x463d3b[_0x5c27('0x5f')][_0x5c27('0x7e')];_0x3a13c1[_0x5c27('0x5f')]['body']=_0x463d3b[_0x5c27('0x5f')]['message'];_0x3a13c1[_0x5c27('0x5f')][_0x5c27('0x80')]=_0x463d3b[_0x5c27('0x5f')][_0x5c27('0x8f')];break;}}if(_0x3a13c1[_0x5c27('0x5f')]['id']){delete _0x3a13c1[_0x5c27('0x5f')]['id'];}if(_[_0x5c27('0x90')](_0x3a13c1[_0x5c27('0x5f')][_0x5c27('0x7e')])){throw new db[(_0x5c27('0x76'))]['ValidationError'](_0x5c27('0x91'));}if(_[_0x5c27('0x90')](_0x3a13c1['body']['body'])||_0x3a13c1[_0x5c27('0x5f')]['body']===''){throw new db[(_0x5c27('0x76'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x5c27('0x90')](_0x3a13c1[_0x5c27('0x5f')][_0x5c27('0x92')])){throw new db[(_0x5c27('0x76'))][(_0x5c27('0x93'))](_0x5c27('0x94')+_0x36003c);}if(!_[_0x5c27('0x95')](_0x36003c,_0x3a13c1[_0x5c27('0x5f')][_0x5c27('0x92')])){throw new db[(_0x5c27('0x76'))][(_0x5c27('0x93'))](_0x5c27('0x96')+_0x36003c);}_0x324c6f[_0x3a13c1[_0x5c27('0x5f')][_0x5c27('0x92')]]=_0x3a13c1[_0x5c27('0x5f')]['from'];return db['CmList']['find']({'where':{'id':_0x3a13c1[_0x5c27('0x73')][_0x5c27('0x7c')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x324c6f,'limit':0x1,'order':[[_0x5c27('0x7a'),_0x5c27('0x97')]]}]});})[_0x5c27('0x22')](handleEntityNotFound(_0x3b9af7,null))[_0x5c27('0x22')](function(_0x26d100){if(_0x26d100){_0x3a13c1['list']=_[_0x5c27('0x98')](_0x26d100,[_0x5c27('0x99')]);if(_0x26d100[_0x5c27('0x99')][_0x5c27('0x4a')]){return _0x26d100[_0x5c27('0x99')][0x0];}var _0x303bf8=_[_0x5c27('0x1b')](_0x3a13c1[_0x5c27('0x5f')],{'firstName':_0x3a13c1[_0x5c27('0x5f')][_0x5c27('0x7e')],'ListId':_0x26d100['id']});_0x303bf8[_0x3a13c1[_0x5c27('0x5f')][_0x5c27('0x92')]]=_0x3a13c1[_0x5c27('0x5f')][_0x5c27('0x7e')];return db[_0x5c27('0x9a')][_0x5c27('0x5b')](_0x303bf8,{'fields':_0x3b3e16,'raw':!![]});}})[_0x5c27('0x22')](handleEntityNotFound(_0x3b9af7,null))['then'](function(_0x231b39){if(_0x231b39){_0x3a13c1[_0x5c27('0x9b')]=_0x231b39;var _0x243007={'ContactId':_0x231b39['id'],'phone':_0x3a13c1['body']['from'],'SmsAccountId':_0x463d3b['params']['id']};var _0x3b2940={'ContactId':_0x231b39['id'],'SmsAccountId':_0x463d3b['params']['id'],'closed':![]};return db[_0x5c27('0x9c')][_0x5c27('0x61')]({'where':_0x3b2940})['then'](function(_0x3502c7){if(_0x3502c7){return[_0x3502c7,![]];}return db['SmsInteraction'][_0x5c27('0x5b')](_0x243007)[_0x5c27('0x22')](function(_0x50c8a8){return[_0x50c8a8,!![]];});});}})[_0x5c27('0x9d')](function(_0x381d27,_0x5bb816){_0x3a13c1['interaction']=_0x381d27[_0x5c27('0x39')]({'plain':!![]});_0x3a13c1['interaction'][_0x5c27('0x9e')]=![];if(_0x5bb816){if(_0x3a13c1['account'][_0x5c27('0x9f')]){_0x3a13c1[_0x5c27('0x74')][_0x5c27('0xa0')]({'id':0x0,'priority':_0x3a13c1['applications']['length']+0x1,'app':'close','appdata':_0x5c27('0xa1'),'interval':_0x5c27('0xa2')});}_0x3a13c1['interaction'][_0x5c27('0x9e')]=!![];}return db[_0x5c27('0xa3')][_0x5c27('0x5b')]({'phone':_0x3a13c1[_0x5c27('0x5f')][_0x5c27('0x7e')],'messageId':_0x3a13c1[_0x5c27('0x5f')][_0x5c27('0x80')],'body':_0x3a13c1[_0x5c27('0x5f')][_0x5c27('0x5f')],'SmsAccountId':_0x463d3b['params']['id'],'SmsInteractionId':_0x381d27['id'],'direction':'in','ContactId':_0x381d27[_0x5c27('0xa4')],'AttachmentId':_0x3a13c1[_0x5c27('0x5f')][_0x5c27('0xa5')]});})[_0x5c27('0x22')](function(_0x57a998){_0x3a13c1['message']=_0x57a998;if(_0x3a13c1[_0x5c27('0xa6')][_0x5c27('0xa7')]){return db[_0x5c27('0xa8')][_0x5c27('0x61')]({'attributes':['id',_0x5c27('0x3c')],'where':{'id':_0x3a13c1[_0x5c27('0xa6')]['UserId']}})[_0x5c27('0x22')](function(_0x2e270a){if(_0x2e270a){_0x3a13c1[_0x5c27('0x74')][_0x5c27('0xa9')]({'id':0x0,'priority':0x0,'app':_0x5c27('0xaa'),'appdata':_0x2e270a[_0x5c27('0x3c')]+','+(_0x3a13c1[_0x5c27('0x73')][_0x5c27('0xab')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x3a13c1);});}return respondWithRpcPromise(_0x5c27('0xac'),_0x5c27('0xad'),_0x3a13c1);})[_0x5c27('0x22')](function(_0x3be2fe){if(_0x3be2fe){var _0x5f0106=0xc8;var _0x93839=_0x5c27('0xae');logger[_0x5c27('0x2a')](_0x5c27('0x26'),_0x93839,_0x5f0106,_0x5c27('0xaf'));logger[_0x5c27('0x25')](_0x5c27('0xb0'),_0x93839,_0x5f0106,_0x5c27('0xaf'),JSON[_0x5c27('0x27')](_0x3be2fe));if(_0x3a13c1[_0x5c27('0x73')]['type']===_0x5c27('0xb1')){return _0x3b9af7['status'](_0x5f0106)[_0x5c27('0xb2')]('Content-Type',_0x5c27('0xb3'))[_0x5c27('0xb4')](_0x5c27('0xb5'));}else{return _0x3b9af7['status'](_0x5f0106)[_0x5c27('0x2f')](_0x3be2fe);}}})[_0x5c27('0x5a')](handleError(_0x3b9af7,null));};exports[_0x5c27('0xb6')]=function(_0x2ff0f5,_0x2ff864,_0x1a3c06){return db[_0x5c27('0x54')]['findOne']({'where':{'id':_0x2ff0f5[_0x5c27('0x58')]['id']}})['then'](handleEntityNotFound(_0x2ff864,null))[_0x5c27('0x22')](function(_0x580a91){if(_0x580a91){return db['sequelize'][_0x5c27('0xb7')](function(_0x6be0d8){return db['SmsApplication']['destroy']({'where':{'SmsAccountId':_0x2ff0f5[_0x5c27('0x58')]['id']},'transaction':_0x6be0d8})[_0x5c27('0x22')](function(_0x497b87){var _0x3bb9e6=_[_0x5c27('0x3f')](_0x2ff0f5[_0x5c27('0x5f')],function(_0x2007b1){_0x2007b1[_0x5c27('0x63')]=_0x2ff0f5[_0x5c27('0x58')]['id'];return _0x2007b1;});return db[_0x5c27('0xb8')][_0x5c27('0xb9')](_0x3bb9e6,{'transaction':_0x6be0d8});});})[_0x5c27('0x22')](function(){return db[_0x5c27('0xb8')][_0x5c27('0xba')]({'where':{'SmsAccountId':_0x2ff0f5['params']['id']},'order':_0x5c27('0x75')});});}})[_0x5c27('0x22')](respondWithResult(_0x2ff864,null))['catch'](handleError(_0x2ff864,null));};exports['getApplications']=function(_0x29fd3a,_0x18b3ff,_0x303ae5){var _0x37da31={};var _0x129304={};var _0x4b46c0;var _0x4f7574;return db[_0x5c27('0x54')][_0x5c27('0x6a')]({'where':{'id':_0x29fd3a[_0x5c27('0x58')]['id']}})[_0x5c27('0x22')](handleEntityNotFound(_0x18b3ff,null))['then'](function(_0x1f72fe){if(_0x1f72fe){_0x4b46c0=_0x1f72fe;_0x129304[_0x5c27('0x48')]=_[_0x5c27('0x44')](db[_0x5c27('0xb8')]['rawAttributes']);_0x129304[_0x5c27('0x43')]=_['keys'](_0x29fd3a[_0x5c27('0x43')]);_0x129304[_0x5c27('0x45')]=_[_0x5c27('0x46')](_0x129304[_0x5c27('0x48')],_0x129304[_0x5c27('0x43')]);_0x37da31[_0x5c27('0x47')]=_['intersection'](_0x129304[_0x5c27('0x48')],qs['fields'](_0x29fd3a[_0x5c27('0x43')][_0x5c27('0x49')]));_0x37da31[_0x5c27('0x47')]=_0x37da31[_0x5c27('0x47')][_0x5c27('0x4a')]?_0x37da31[_0x5c27('0x47')]:_0x129304[_0x5c27('0x48')];_0x37da31[_0x5c27('0x4c')]=qs[_0x5c27('0x4d')](_0x29fd3a[_0x5c27('0x43')][_0x5c27('0x4d')]);_0x37da31[_0x5c27('0x51')]=qs[_0x5c27('0x45')](_['pick'](_0x29fd3a['query'],_0x129304[_0x5c27('0x45')]));if(_0x29fd3a[_0x5c27('0x43')]['filter']){_0x37da31[_0x5c27('0x51')]=_[_0x5c27('0x50')](_0x37da31[_0x5c27('0x51')],{'$or':_[_0x5c27('0x3f')](_0x37da31[_0x5c27('0x47')],function(_0x44f720){var _0x33ec88={};_0x33ec88[_0x44f720]={'$like':'%'+_0x29fd3a['query'][_0x5c27('0x4f')]+'%'};return _0x33ec88;})});}_0x37da31=_[_0x5c27('0x50')]({},_0x37da31,_0x29fd3a[_0x5c27('0x6c')]);return _0x4b46c0[_0x5c27('0xbb')](_0x37da31);}})[_0x5c27('0x22')](function(_0x2885b6){if(_0x2885b6){_0x4f7574=_0x2885b6[_0x5c27('0x4a')];if(!_0x29fd3a[_0x5c27('0x43')][_0x5c27('0x4b')](_0x5c27('0x6b'))){_0x37da31[_0x5c27('0x30')]=qs[_0x5c27('0x30')](_0x29fd3a[_0x5c27('0x43')]['limit']);_0x37da31[_0x5c27('0x32')]=qs[_0x5c27('0x32')](_0x29fd3a[_0x5c27('0x43')][_0x5c27('0x32')]);}return _0x4b46c0[_0x5c27('0xbb')](_0x37da31);}})[_0x5c27('0x22')](function(_0x46d571){if(_0x46d571){return _0x46d571?{'count':_0x4f7574,'rows':_0x46d571}:null;}})[_0x5c27('0x22')](respondWithResult(_0x18b3ff,null))['catch'](handleError(_0x18b3ff,null));};exports[_0x5c27('0xbc')]=function(_0x591ae4,_0x4589fa,_0x1e1e90){var _0x27150b={'raw':![],'where':{}};var _0x3268a1={};var _0x3d99a6={'count':0x0,'rows':[]};return db[_0x5c27('0x54')][_0x5c27('0x6a')]({'where':{'id':_0x591ae4[_0x5c27('0x58')]['id']}})[_0x5c27('0x22')](handleEntityNotFound(_0x4589fa,null))[_0x5c27('0x22')](function(_0x4f4af5){if(_0x4f4af5){_0x3268a1[_0x5c27('0x48')]=_[_0x5c27('0x44')](db[_0x5c27('0x9c')]['rawAttributes']);_0x3268a1[_0x5c27('0x43')]=_[_0x5c27('0x44')](_0x591ae4['query']);_0x3268a1[_0x5c27('0x45')]=_[_0x5c27('0x46')](_0x3268a1[_0x5c27('0x48')],_0x3268a1['query']);_0x27150b[_0x5c27('0x47')]=_['intersection'](_0x3268a1[_0x5c27('0x48')],qs[_0x5c27('0x49')](_0x591ae4[_0x5c27('0x43')][_0x5c27('0x49')]));_0x27150b['attributes']=_0x27150b[_0x5c27('0x47')][_0x5c27('0x4a')]?_0x27150b['attributes']:_0x3268a1[_0x5c27('0x48')];if(!_0x591ae4[_0x5c27('0x43')][_0x5c27('0x4b')](_0x5c27('0x6b'))){_0x27150b['limit']=qs[_0x5c27('0x30')](_0x591ae4[_0x5c27('0x43')][_0x5c27('0x30')]);_0x27150b[_0x5c27('0x32')]=qs[_0x5c27('0x32')](_0x591ae4[_0x5c27('0x43')][_0x5c27('0x32')]);}_0x27150b[_0x5c27('0x4c')]=qs[_0x5c27('0x4d')](_0x591ae4[_0x5c27('0x43')]['sort']);_0x27150b[_0x5c27('0x51')]=qs['filters'](_['pick'](_0x591ae4[_0x5c27('0x43')],_0x3268a1[_0x5c27('0x45')]));_0x27150b['where'][_0x5c27('0x63')]=_0x4f4af5['id'];if(_0x591ae4[_0x5c27('0x43')][_0x5c27('0x4f')]){_0x27150b[_0x5c27('0x51')]=_[_0x5c27('0x50')](_0x27150b[_0x5c27('0x51')],{'$or':_['map'](_0x27150b[_0x5c27('0x47')],function(_0x48b08d){var _0x45a2c0={};_0x45a2c0[_0x48b08d]={'$like':'%'+_0x591ae4[_0x5c27('0x43')][_0x5c27('0x4f')]+'%'};return _0x45a2c0;})});}_0x27150b=_[_0x5c27('0x50')]({},_0x27150b,_0x591ae4[_0x5c27('0x6c')]);return db[_0x5c27('0x9c')][_0x5c27('0x33')]({'where':_0x27150b['where']})[_0x5c27('0x22')](function(_0x38ad1e){_0x3d99a6[_0x5c27('0x33')]=_0x38ad1e;if(_0x591ae4[_0x5c27('0x43')][_0x5c27('0x55')]){_0x27150b['include']=[{'model':db['CmContact'],'as':_0x5c27('0xbd'),'required':![]},{'model':db['User'],'as':_0x5c27('0xbe'),'attributes':['name',_0x5c27('0xbf'),_0x5c27('0xc0')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x5c27('0x3c'),'color'],'where':_0x591ae4[_0x5c27('0x43')]['tag']?{'id':_0x591ae4[_0x5c27('0x43')][_0x5c27('0xc1')]}:undefined,'required':_0x591ae4['query'][_0x5c27('0xc1')]?!![]:![]}];}return db[_0x5c27('0x9c')][_0x5c27('0x56')](_0x27150b);})[_0x5c27('0x22')](function(_0x177b6e){_0x3d99a6[_0x5c27('0x66')]=_0x177b6e;return _0x3d99a6;});}})[_0x5c27('0x22')](respondWithFilteredResult(_0x4589fa,_0x27150b))[_0x5c27('0x5a')](handleError(_0x4589fa,null));};exports['send']=function(_0x487e7d,_0x3dd322,_0x369b5c){var _0x455e8a,_0x27c13d,_0x422e23;if(_[_0x5c27('0x90')](_0x487e7d[_0x5c27('0x5f')][_0x5c27('0x5f')])||_0x487e7d[_0x5c27('0x5f')][_0x5c27('0x5f')]===''){throw new db[(_0x5c27('0x76'))][(_0x5c27('0x93'))](_0x5c27('0xc2'));}if(_[_0x5c27('0x90')](_0x487e7d[_0x5c27('0x5f')]['to'])){throw new db[(_0x5c27('0x76'))]['ValidationError'](_0x5c27('0xc3'));}_0x455e8a=_0x487e7d['body']['to'];return db[_0x5c27('0x54')][_0x5c27('0x61')]({'where':{'id':_0x487e7d[_0x5c27('0x58')]['id']},'include':[{'model':db['CmList'],'as':_0x5c27('0xc4'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x455e8a},'limit':0x1,'order':[[_0x5c27('0x7a'),_0x5c27('0x97')]]}]}]})[_0x5c27('0x22')](handleEntityNotFound(_0x3dd322,null))[_0x5c27('0x22')](function(_0x511837){if(_0x511837&&_0x511837[_0x5c27('0xc4')]){_0x27c13d=_0x511837['get']({'plain':!![]});if(_0x27c13d[_0x5c27('0xc4')]&&_0x27c13d['List'][_0x5c27('0x99')][_0x5c27('0x4a')]){return _0x27c13d[_0x5c27('0xc4')][_0x5c27('0x99')][0x0];}return db['CmContact'][_0x5c27('0x5b')](_[_0x5c27('0x1b')](_0x487e7d['body'],{'firstName':_0x455e8a,'mobile':_0x455e8a,'phone':_0x455e8a,'ListId':_0x27c13d[_0x5c27('0x7c')]}));}})['then'](handleEntityNotFound(_0x3dd322,null))[_0x5c27('0x22')](function(_0x45b5ce){if(_0x45b5ce){_0x422e23=_0x45b5ce;return db[_0x5c27('0x9c')]['find']({'where':{'ContactId':_0x422e23['id'],'closed':![],'SmsAccountId':_0x27c13d['id']}})[_0x5c27('0x22')](function(_0xcad93c){if(_0xcad93c){return[_0xcad93c,![]];}return db[_0x5c27('0x9c')][_0x5c27('0x5b')]({'UserId':_0x487e7d[_0x5c27('0xc5')]['id'],'ContactId':_0x422e23['id'],'SmsAccountId':_0x27c13d['id'],'phone':_0x455e8a,'firstMsgDirection':_0x5c27('0xc6'),'Messages':[_[_0x5c27('0x50')](_0x487e7d[_0x5c27('0x5f')],{'read':![],'body':_0x487e7d[_0x5c27('0x5f')][_0x5c27('0x5f')],'phone':_0x455e8a,'SmsAccountId':_0x27c13d['id'],'UserId':_0x487e7d[_0x5c27('0xc5')]['id'],'ContactId':_0x422e23['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x5c27('0xc7')}]})[_0x5c27('0x22')](function(_0x5a167c){return[_0x5a167c,!![]];});});}})[_0x5c27('0x9d')](function(_0x21cfe1,_0x4860f0){if(_0x4860f0){return _0x21cfe1;}return db[_0x5c27('0xa3')]['create'](_['merge'](_0x487e7d[_0x5c27('0x5f')],{'read':![],'body':_0x487e7d[_0x5c27('0x5f')]['body'],'phone':_0x455e8a,'SmsAccountId':_0x27c13d['id'],'SmsInteractionId':_0x21cfe1['id'],'UserId':_0x487e7d[_0x5c27('0xc5')]['id'],'ContactId':_0x422e23['id']}))['then'](function(_0x1a84ce){_0x21cfe1[_0x5c27('0xc8')][_0x5c27('0xc7')]=[];_0x21cfe1[_0x5c27('0xc8')]['Messages'][_0x5c27('0xa0')](_0x1a84ce['dataValues']);return _0x21cfe1;});})[_0x5c27('0x22')](respondWithResult(_0x3dd322,null))['catch'](handleError(_0x3dd322,null));};exports[_0x5c27('0x2d')]=function(_0x3def3c,_0x6ca2ea,_0x1ad73d){if(_0x3def3c[_0x5c27('0x5f')]['id']){delete _0x3def3c[_0x5c27('0x5f')]['id'];}var _0x339364,_0x9df557,_0x342452;return db[_0x5c27('0x54')]['find']({'where':{'id':_0x3def3c[_0x5c27('0x58')]['id']}})['then'](handleEntityNotFound(_0x6ca2ea,null))[_0x5c27('0x22')](function(_0x494d66){if(_0x494d66){_0x342452=_0x494d66;logger[_0x5c27('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5c27('0x2d'),'received\x20delivery\x20report\x20from',_0x494d66['type'],util['inspect'](_0x3def3c[_0x5c27('0x5f')],{'showHidden':![],'depth':null}));switch(_0x494d66[_0x5c27('0x52')]){case _0x5c27('0xc9'):if(_0x3def3c[_0x5c27('0x5f')][_0x5c27('0xca')]&&_0x3def3c[_0x5c27('0x5f')][_0x5c27('0x2d')]){_0x9df557=_0x3def3c[_0x5c27('0x5f')][_0x5c27('0x2d')];return db[_0x5c27('0xa3')][_0x5c27('0x61')]({'where':{'messageId':_0x3def3c[_0x5c27('0x5f')][_0x5c27('0xca')]}});}break;case _0x5c27('0xcb'):if(_0x3def3c['body']['requestid']&&_0x3def3c['body'][_0x5c27('0xcc')]){_0x9df557=_0x3def3c[_0x5c27('0x5f')]['statusInt'];return db['SmsMessage']['find']({'where':{'messageId':_0x3def3c[_0x5c27('0x5f')][_0x5c27('0xcd')]}});}break;case _0x5c27('0x83'):if(_0x3def3c[_0x5c27('0x5f')][_0x5c27('0x84')]&&_0x3def3c[_0x5c27('0x5f')][_0x5c27('0xce')]){_0x9df557=_0x3def3c[_0x5c27('0x5f')][_0x5c27('0xce')];return db[_0x5c27('0xa3')][_0x5c27('0x61')]({'where':{'messageId':_0x3def3c[_0x5c27('0x5f')][_0x5c27('0x84')]}});}break;case _0x5c27('0x87'):var _0x1ead99=_0x3def3c['body'][_0x5c27('0x88')][0x0];if(_0x1ead99['messageId']&&_0x1ead99[_0x5c27('0x2d')]['groupName']===_0x5c27('0xcf')){_0x9df557=_0x1ead99[_0x5c27('0x2d')][_0x5c27('0xd0')];return db[_0x5c27('0xa3')][_0x5c27('0x61')]({'where':{'messageId':_0x1ead99['messageId']}});}break;case _0x5c27('0x8a'):if(_0x3def3c[_0x5c27('0x5f')][_0x5c27('0x80')]&&_0x3def3c[_0x5c27('0x5f')][_0x5c27('0x2d')]){_0x9df557=_0x3def3c[_0x5c27('0x5f')][_0x5c27('0x2d')];return db[_0x5c27('0xa3')][_0x5c27('0x61')]({'where':{'messageId':_0x3def3c['body'][_0x5c27('0x80')]}});}break;case'bandwidth':if(_0x3def3c[_0x5c27('0x5f')][0x0][_0x5c27('0x29')]['id']){_0x9df557=_0x3def3c[_0x5c27('0x5f')][0x0][_0x5c27('0x52')];return db[_0x5c27('0xa3')][_0x5c27('0x61')]({'where':{'messageId':_0x3def3c[_0x5c27('0x5f')][0x0][_0x5c27('0x29')]['id']}});}break;case _0x5c27('0x8e'):if(_0x3def3c[_0x5c27('0x5f')]['redif']&&_0x3def3c[_0x5c27('0x5f')]['status']){_0x9df557=_0x3def3c['body'][_0x5c27('0x2d')];return db[_0x5c27('0xa3')][_0x5c27('0x61')]({'where':{'messageId':_0x3def3c[_0x5c27('0x5f')][_0x5c27('0xd1')]}});}break;}}})[_0x5c27('0x22')](handleEntityNotFound(_0x6ca2ea,null))[_0x5c27('0x22')](function(_0x156230){if(_0x156230){_0x339364=_0x156230;switch(_0x342452[_0x5c27('0x52')]){case'skebby':if(_0x9df557===_0x5c27('0xcf')){return _0x339364[_0x5c27('0x37')]({'read':!![]});}else{logger[_0x5c27('0x28')](_0x5c27('0x26'),_0x5c27('0x2d'),_0x5c27('0xc9'),util['inspect'](_0x3def3c[_0x5c27('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x5c27('0xcb'):if(_0x9df557==='1'){return _0x339364[_0x5c27('0x37')]({'read':!![]});}else{logger['error'](_0x5c27('0x26'),_0x5c27('0x2d'),_0x5c27('0xc9'),util[_0x5c27('0xd2')](_0x3def3c[_0x5c27('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x5c27('0x83'):if(!_0x3def3c[_0x5c27('0x5f')]['error_code']&&_0x9df557>=0xc8&&_0x9df557<=0xce){return _0x339364['update']({'read':!![]});}else{logger['error'](_0x5c27('0x26'),_0x5c27('0x2d'),'clicksend',util[_0x5c27('0xd2')](_0x3def3c[_0x5c27('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x5c27('0x87'):var _0xcb4100=_0x3def3c[_0x5c27('0x5f')]['results'][0x0];if(_0xcb4100[_0x5c27('0x2d')][_0x5c27('0xd0')]===_0x5c27('0xcf')){return _0x339364[_0x5c27('0x37')]({'read':!![]});}else{logger[_0x5c27('0x28')](_0x5c27('0x26'),_0x5c27('0x2d'),_0x5c27('0x87'),util[_0x5c27('0xd2')](_0x3def3c[_0x5c27('0x5f')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x9df557=='DELIVERED_TO_GATEWAY'||_0x9df557==_0x5c27('0xd3')){return _0x339364[_0x5c27('0x37')]({'read':!![]});}else{logger[_0x5c27('0x28')](_0x5c27('0x26'),'status',_0x5c27('0x8a'),util[_0x5c27('0xd2')](_0x3def3c[_0x5c27('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x5c27('0x8d'):if(_0x9df557==_0x5c27('0xd4')){return _0x339364[_0x5c27('0x37')]({'read':!![]});}else{logger[_0x5c27('0x28')](_0x5c27('0x26'),_0x5c27('0x2d'),_0x5c27('0x8d'),util[_0x5c27('0xd2')](_0x3def3c[_0x5c27('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x5c27('0x8e'):if(_0x9df557==='DELIVRD'||_0x9df557===_0x5c27('0xd5')){return _0x339364[_0x5c27('0x37')]({'read':!![]});}else{logger[_0x5c27('0x28')](_0x5c27('0x26'),_0x5c27('0x2d'),'intelepeer',util[_0x5c27('0xd2')](_0x3def3c[_0x5c27('0x5f')],{'showHidden':![],'depth':null}));}break;}return _0x339364;}})[_0x5c27('0x22')](respondWithResult(_0x6ca2ea,null))[_0x5c27('0x5a')](handleError(_0x6ca2ea,null));};exports['statusGet']=function(_0x47b7f7,_0x4c884f,_0x2c63f3){var _0x4f5cde,_0x5e1a84,_0x1fd776;return db[_0x5c27('0x54')][_0x5c27('0x61')]({'where':{'id':_0x47b7f7[_0x5c27('0x58')]['id']}})[_0x5c27('0x22')](handleEntityNotFound(_0x4c884f,null))[_0x5c27('0x22')](function(_0x215be4){if(_0x215be4){_0x1fd776=_0x215be4;logger[_0x5c27('0x25')](_0x5c27('0x26'),_0x5c27('0x2d'),'received\x20delivery\x20report\x20from',_0x215be4[_0x5c27('0x52')],util['inspect'](_0x47b7f7['query'],{'showHidden':![],'depth':null}));switch(_0x215be4[_0x5c27('0x52')]){case'csc':if(_0x47b7f7[_0x5c27('0x43')]['message-id']&&_0x47b7f7[_0x5c27('0x43')][_0x5c27('0xd6')]){_0x5e1a84=_0x47b7f7[_0x5c27('0x43')]['state'];return db['SmsMessage'][_0x5c27('0x61')]({'where':{'messageId':_0x47b7f7[_0x5c27('0x43')]['message-id']}});}break;}}})['then'](handleEntityNotFound(_0x4c884f,null))[_0x5c27('0x22')](function(_0xc6efb7){if(_0xc6efb7){_0x4f5cde=_0xc6efb7;switch(_0x1fd776['type']){case _0x5c27('0xd7'):if(_0x5e1a84==='2'||_0x5e1a84==='6'){return _0x4f5cde[_0x5c27('0x37')]({'read':!![]});}else{logger[_0x5c27('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','csc',util['inspect'](_0x47b7f7[_0x5c27('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x4f5cde;}})[_0x5c27('0x22')](respondWithResult(_0x4c884f,null))['catch'](handleError(_0x4c884f,null));};exports[_0x5c27('0xd8')]=function(_0x1877db,_0x4533ef,_0x43ee28){return db[_0x5c27('0x54')][_0x5c27('0x61')]({'where':{'id':_0x1877db[_0x5c27('0x58')]['id']}})[_0x5c27('0x22')](handleEntityNotFound(_0x4533ef,null))[_0x5c27('0x22')](function(_0xc9d691){if(_0xc9d691){return _0xc9d691['addAgents'](_0x1877db[_0x5c27('0x5f')]['ids'],_['omit'](_0x1877db['body'],[_0x5c27('0x6f'),'id'])||{})[_0x5c27('0x9d')](function(_0xced118){for(var _0x13f222=0x0;_0x13f222<_0x1877db['body'][_0x5c27('0x6f')]['length'];_0x13f222+=0x1){socket[_0x5c27('0xd9')](_0x5c27('0xda'),{'UserId':Number(_0x1877db['body'][_0x5c27('0x6f')][_0x13f222]),'SmsAccountId':Number(_0x1877db[_0x5c27('0x58')]['id'])});}return _0xced118;});}})[_0x5c27('0x22')](respondWithResult(_0x4533ef,null))[_0x5c27('0x5a')](handleError(_0x4533ef,null));};exports[_0x5c27('0xdb')]=function(_0x62ab15,_0x3e5a3f,_0x3fab94){return db[_0x5c27('0x54')][_0x5c27('0x61')]({'where':{'id':_0x62ab15['params']['id']}})['then'](handleEntityNotFound(_0x3e5a3f,null))[_0x5c27('0x22')](function(_0x179954){if(_0x179954){return _0x179954['removeAgents'](_0x62ab15['query'][_0x5c27('0x6f')])['then'](function(){if(_['isArray'](_0x62ab15[_0x5c27('0x43')][_0x5c27('0x6f')])){for(var _0x1eb5b3=0x0;_0x1eb5b3<_0x62ab15['query'][_0x5c27('0x6f')][_0x5c27('0x4a')];_0x1eb5b3+=0x1){socket[_0x5c27('0xd9')](_0x5c27('0xdc'),{'UserId':Number(_0x62ab15[_0x5c27('0x43')][_0x5c27('0x6f')][_0x1eb5b3]),'SmsAccountId':Number(_0x62ab15[_0x5c27('0x58')]['id'])});}}else{socket['emit'](_0x5c27('0xdc'),{'UserId':Number(_0x62ab15[_0x5c27('0x43')][_0x5c27('0x6f')]),'SmsAccountId':Number(_0x62ab15['params']['id'])});}});}})[_0x5c27('0x22')](respondWithStatusCode(_0x3e5a3f,null))[_0x5c27('0x5a')](handleError(_0x3e5a3f,null));};exports[_0x5c27('0xdd')]=function(_0x29d946,_0x155a3c,_0x2d00c7){var _0x59cbf4={};var _0x874ff7={};var _0x462545;var _0x46ab29;return db[_0x5c27('0x54')][_0x5c27('0x6a')]({'where':{'id':_0x29d946[_0x5c27('0x58')]['id']}})[_0x5c27('0x22')](handleEntityNotFound(_0x155a3c,null))[_0x5c27('0x22')](function(_0xb29a53){if(_0xb29a53){_0x462545=_0xb29a53;_0x874ff7[_0x5c27('0x48')]=_[_0x5c27('0x44')](db[_0x5c27('0xa8')]['rawAttributes']);_0x874ff7['query']=_[_0x5c27('0x44')](_0x29d946[_0x5c27('0x43')]);_0x874ff7[_0x5c27('0x45')]=_[_0x5c27('0x46')](_0x874ff7[_0x5c27('0x48')],_0x874ff7[_0x5c27('0x43')]);_0x59cbf4[_0x5c27('0x47')]=_['intersection'](_0x874ff7[_0x5c27('0x48')],qs['fields'](_0x29d946['query'][_0x5c27('0x49')]));_0x59cbf4[_0x5c27('0x47')]=_0x59cbf4[_0x5c27('0x47')][_0x5c27('0x4a')]?_0x59cbf4[_0x5c27('0x47')]:_0x874ff7[_0x5c27('0x48')];_0x59cbf4[_0x5c27('0x4c')]=qs[_0x5c27('0x4d')](_0x29d946[_0x5c27('0x43')][_0x5c27('0x4d')]);_0x59cbf4[_0x5c27('0x51')]=qs[_0x5c27('0x45')](_[_0x5c27('0x4e')](_0x29d946[_0x5c27('0x43')],_0x874ff7[_0x5c27('0x45')]));if(_0x29d946[_0x5c27('0x43')][_0x5c27('0x4f')]){_0x59cbf4['where']=_[_0x5c27('0x50')](_0x59cbf4[_0x5c27('0x51')],{'$or':_[_0x5c27('0x3f')](_0x59cbf4[_0x5c27('0x47')],function(_0x2392f5){var _0x33e6ee={};_0x33e6ee[_0x2392f5]={'$like':'%'+_0x29d946[_0x5c27('0x43')][_0x5c27('0x4f')]+'%'};return _0x33e6ee;})});}_0x59cbf4=_[_0x5c27('0x50')]({},_0x59cbf4,_0x29d946[_0x5c27('0x6c')]);return _0x462545[_0x5c27('0xdd')](_0x59cbf4);}})[_0x5c27('0x22')](function(_0x243e27){if(_0x243e27){_0x46ab29=_0x243e27[_0x5c27('0x4a')];if(!_0x29d946[_0x5c27('0x43')][_0x5c27('0x4b')](_0x5c27('0x6b'))){_0x59cbf4[_0x5c27('0x30')]=qs['limit'](_0x29d946['query'][_0x5c27('0x30')]);_0x59cbf4[_0x5c27('0x32')]=qs['offset'](_0x29d946[_0x5c27('0x43')][_0x5c27('0x32')]);}return _0x462545[_0x5c27('0xdd')](_0x59cbf4);}})[_0x5c27('0x22')](function(_0x2fc574){if(_0x2fc574){return _0x2fc574?{'count':_0x46ab29,'rows':_0x2fc574}:null;}})['then'](respondWithResult(_0x155a3c,null))[_0x5c27('0x5a')](handleError(_0x155a3c,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 8ff09b4..3deb2f8 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 _0x61fe=['remove','emit','hook','events','../../mysqldb','SmsAccount','save','update'];(function(_0x119275,_0x39fe82){var _0x1474fb=function(_0x582385){while(--_0x582385){_0x119275['push'](_0x119275['shift']());}};_0x1474fb(++_0x39fe82);}(_0x61fe,0x1bb));var _0xe61f=function(_0x147916,_0x490c14){_0x147916=_0x147916-0x0;var _0x59892b=_0x61fe[_0x147916];return _0x59892b;};'use strict';var EventEmitter=require(_0xe61f('0x0'));var SmsAccount=require(_0xe61f('0x1'))['db'][_0xe61f('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe61f('0x3'),'afterUpdate':_0xe61f('0x4'),'afterDestroy':_0xe61f('0x5')};function emitEvent(_0x291e60){return function(_0x2a9ef3,_0x32640a,_0x4e194a){SmsAccountEvents[_0xe61f('0x6')](_0x291e60+':'+_0x2a9ef3['id'],_0x2a9ef3);SmsAccountEvents[_0xe61f('0x6')](_0x291e60,_0x2a9ef3);_0x4e194a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0xe61f('0x7')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0xdc2e=['../../mysqldb','SmsAccount','setMaxListeners','save','emit','hook','exports','events'];(function(_0x4d9835,_0x11d9d7){var _0x57c779=function(_0x3b1813){while(--_0x3b1813){_0x4d9835['push'](_0x4d9835['shift']());}};_0x57c779(++_0x11d9d7);}(_0xdc2e,0xbf));var _0xedc2=function(_0x91c951,_0x2988ba){_0x91c951=_0x91c951-0x0;var _0xc454d1=_0xdc2e[_0x91c951];return _0xc454d1;};'use strict';var EventEmitter=require(_0xedc2('0x0'));var SmsAccount=require(_0xedc2('0x1'))['db'][_0xedc2('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xedc2('0x3')](0x0);var events={'afterCreate':_0xedc2('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4b9c56){return function(_0xda79cf,_0x2daab9,_0x5f5192){SmsAccountEvents[_0xedc2('0x5')](_0x4b9c56+':'+_0xda79cf['id'],_0xda79cf);SmsAccountEvents[_0xedc2('0x5')](_0x4b9c56,_0xda79cf);_0x5f5192(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0xedc2('0x6')](e,emitEvent(event));}}module[_0xedc2('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 2b15f3a..c1b0cf2 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 _0x7ad6=['define','sms_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsAccount.attributes','exports'];(function(_0x23f2df,_0x370261){var _0x29ceeb=function(_0x39f2cd){while(--_0x39f2cd){_0x23f2df['push'](_0x23f2df['shift']());}};_0x29ceeb(++_0x370261);}(_0x7ad6,0x188));var _0x67ad=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x7ad6[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0x67ad('0x0'));var util=require(_0x67ad('0x1'));var logger=require(_0x67ad('0x2'))(_0x67ad('0x3'));var moment=require(_0x67ad('0x4'));var BPromise=require(_0x67ad('0x5'));var rp=require(_0x67ad('0x6'));var fs=require('fs');var path=require(_0x67ad('0x7'));var rimraf=require('rimraf');var config=require(_0x67ad('0x8'));var attributes=require(_0x67ad('0x9'));module[_0x67ad('0xa')]=function(_0x235595,_0x5bf7f7){return _0x235595[_0x67ad('0xb')]('SmsAccount',attributes,{'tableName':_0x67ad('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec60=['request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','moment','bluebird'];(function(_0x221272,_0x29146a){var _0xe0a9d7=function(_0x44ee43){while(--_0x44ee43){_0x221272['push'](_0x221272['shift']());}};_0xe0a9d7(++_0x29146a);}(_0xec60,0x1f3));var _0x0ec6=function(_0x87c66a,_0x1693cf){_0x87c66a=_0x87c66a-0x0;var _0x4c56be=_0xec60[_0x87c66a];return _0x4c56be;};'use strict';var _=require(_0x0ec6('0x0'));var util=require(_0x0ec6('0x1'));var logger=require(_0x0ec6('0x2'))('api');var moment=require(_0x0ec6('0x3'));var BPromise=require(_0x0ec6('0x4'));var rp=require(_0x0ec6('0x5'));var fs=require('fs');var path=require(_0x0ec6('0x6'));var rimraf=require(_0x0ec6('0x7'));var config=require(_0x0ec6('0x8'));var attributes=require(_0x0ec6('0x9'));module[_0x0ec6('0xa')]=function(_0x340af2,_0x5202db){return _0x340af2[_0x0ec6('0xb')](_0x0ec6('0xc'),attributes,{'tableName':_0x0ec6('0xd'),'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 f4cab8d..c9bc7b5 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 _0x26a5=['client','http','localhost','socket.io-emitter','redis','./smsAccount.socket','register','request','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','ShowSmsAccount','SmsAccount','find','options','where','include','model','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x183fdb,_0x288b39){var _0x1c2e04=function(_0x17b84f){while(--_0x17b84f){_0x183fdb['push'](_0x183fdb['shift']());}};_0x1c2e04(++_0x288b39);}(_0x26a5,0xda));var _0x526a=function(_0x377a12,_0x2f4d41){_0x377a12=_0x377a12-0x0;var _0x17bed8=_0x26a5[_0x377a12];return _0x17bed8;};'use strict';var _=require(_0x526a('0x0'));var util=require(_0x526a('0x1'));var moment=require(_0x526a('0x2'));var BPromise=require(_0x526a('0x3'));var rs=require(_0x526a('0x4'));var fs=require('fs');var Redis=require(_0x526a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x526a('0x6'));var logger=require('../../config/logger')(_0x526a('0x7'));var config=require(_0x526a('0x8'));var jayson=require(_0x526a('0x9'));var client=jayson[_0x526a('0xa')][_0x526a('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x526a('0xc'),'port':0x18eb});var socket=require(_0x526a('0xd'))(new Redis(config[_0x526a('0xe')]));require(_0x526a('0xf'))[_0x526a('0x10')](socket);function respondWithRpcPromise(_0xe3b94f,_0x386ad4,_0x18224b){return new BPromise(function(_0x12fe67,_0x4b1e82){return client[_0x526a('0x11')](_0xe3b94f,_0x18224b)[_0x526a('0x12')](function(_0x5a5088){logger[_0x526a('0x13')]('SmsAccount,\x20%s,\x20%s',_0x386ad4,_0x526a('0x14'));logger[_0x526a('0x15')](_0x526a('0x16'),_0x386ad4,_0x526a('0x14'),JSON[_0x526a('0x17')](_0x5a5088));if(_0x5a5088[_0x526a('0x18')]){if(_0x5a5088['error'][_0x526a('0x19')]===0x1f4){logger[_0x526a('0x18')](_0x526a('0x1a'),_0x386ad4,_0x5a5088[_0x526a('0x18')]['message']);return _0x4b1e82(_0x5a5088[_0x526a('0x18')]['message']);}logger['error'](_0x526a('0x1a'),_0x386ad4,_0x5a5088['error'][_0x526a('0x1b')]);return _0x12fe67(_0x5a5088[_0x526a('0x18')][_0x526a('0x1b')]);}else{logger['info'](_0x526a('0x1a'),_0x386ad4,_0x526a('0x14'));_0x12fe67(_0x5a5088[_0x526a('0x1c')][_0x526a('0x1b')]);}})[_0x526a('0x1d')](function(_0x25b9a3){logger[_0x526a('0x18')](_0x526a('0x1a'),_0x386ad4,_0x25b9a3);_0x4b1e82(_0x25b9a3);});});}exports[_0x526a('0x1e')]=function(_0x18f1c3){var _0x5f3179=this;return new Promise(function(_0x217137,_0x282d6f){return db[_0x526a('0x1f')][_0x526a('0x20')]({'raw':_0x18f1c3['options']?_0x18f1c3['options']['raw']===undefined?!![]:![]:!![],'where':_0x18f1c3['options']?_0x18f1c3[_0x526a('0x21')][_0x526a('0x22')]||null:null,'attributes':_0x18f1c3[_0x526a('0x21')]?_0x18f1c3['options']['attributes']||null:null,'include':_0x18f1c3[_0x526a('0x21')]?_0x18f1c3[_0x526a('0x21')][_0x526a('0x23')]?_['map'](_0x18f1c3['options']['include'],function(_0x98defd){return{'model':db[_0x98defd[_0x526a('0x24')]],'as':_0x98defd['as'],'attributes':_0x98defd['attributes'],'include':_0x98defd[_0x526a('0x23')]?_['map'](_0x98defd['include'],function(_0xc4ab6f){return{'model':db[_0xc4ab6f[_0x526a('0x24')]],'as':_0xc4ab6f['as'],'attributes':_0xc4ab6f[_0x526a('0x25')],'include':_0xc4ab6f[_0x526a('0x23')]?_['map'](_0xc4ab6f['include'],function(_0x4a39b1){return{'model':db[_0x4a39b1['model']],'as':_0x4a39b1['as'],'attributes':_0x4a39b1[_0x526a('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3415dd){logger[_0x526a('0x13')](_0x526a('0x1e'),_0x18f1c3);logger[_0x526a('0x15')](_0x526a('0x1e'),_0x18f1c3,JSON[_0x526a('0x17')](_0x3415dd));_0x217137(_0x3415dd);})['catch'](function(_0x54f6de){logger[_0x526a('0x18')](_0x526a('0x1e'),_0x54f6de[_0x526a('0x1b')],_0x18f1c3);_0x282d6f(_0x5f3179[_0x526a('0x18')](0x1f4,_0x54f6de[_0x526a('0x1b')]));});});}; \ No newline at end of file +var _0xb44d=['request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','ShowSmsAccount','find','options','raw','where','attributes','include','map','model','debug','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','./smsAccount.socket','register','request','then','SmsAccount,\x20%s,\x20%s'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xb44d,0x1cc));var _0xdb44=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xb44d[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0xdb44('0x0'));var moment=require(_0xdb44('0x1'));var BPromise=require(_0xdb44('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdb44('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xdb44('0x4'))('rpc');var config=require(_0xdb44('0x5'));var jayson=require(_0xdb44('0x6'));var client=jayson['client'][_0xdb44('0x7')]({'port':0x232a});config[_0xdb44('0x8')]=_[_0xdb44('0x9')](config[_0xdb44('0x8')],{'host':_0xdb44('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xdb44('0xb'))[_0xdb44('0xc')](socket);function respondWithRpcPromise(_0x3501eb,_0x40c08f,_0x5820d5){return new BPromise(function(_0x20a946,_0x3e1fa0){return client[_0xdb44('0xd')](_0x3501eb,_0x5820d5)[_0xdb44('0xe')](function(_0x3a1ee1){logger['info'](_0xdb44('0xf'),_0x40c08f,_0xdb44('0x10'));logger['debug'](_0xdb44('0x11'),_0x40c08f,_0xdb44('0x10'),JSON[_0xdb44('0x12')](_0x3a1ee1));if(_0x3a1ee1[_0xdb44('0x13')]){if(_0x3a1ee1[_0xdb44('0x13')][_0xdb44('0x14')]===0x1f4){logger[_0xdb44('0x13')](_0xdb44('0xf'),_0x40c08f,_0x3a1ee1[_0xdb44('0x13')][_0xdb44('0x15')]);return _0x3e1fa0(_0x3a1ee1[_0xdb44('0x13')][_0xdb44('0x15')]);}logger[_0xdb44('0x13')]('SmsAccount,\x20%s,\x20%s',_0x40c08f,_0x3a1ee1[_0xdb44('0x13')][_0xdb44('0x15')]);return _0x20a946(_0x3a1ee1[_0xdb44('0x13')][_0xdb44('0x15')]);}else{logger[_0xdb44('0x16')](_0xdb44('0xf'),_0x40c08f,_0xdb44('0x10'));_0x20a946(_0x3a1ee1['result'][_0xdb44('0x15')]);}})[_0xdb44('0x17')](function(_0x346d2d){logger['error']('SmsAccount,\x20%s,\x20%s',_0x40c08f,_0x346d2d);_0x3e1fa0(_0x346d2d);});});}exports[_0xdb44('0x18')]=function(_0x23eaf3){var _0x4c04ba=this;return new Promise(function(_0x2c28bf,_0x4f511d){return db['SmsAccount'][_0xdb44('0x19')]({'raw':_0x23eaf3['options']?_0x23eaf3[_0xdb44('0x1a')][_0xdb44('0x1b')]===undefined?!![]:![]:!![],'where':_0x23eaf3[_0xdb44('0x1a')]?_0x23eaf3[_0xdb44('0x1a')][_0xdb44('0x1c')]||null:null,'attributes':_0x23eaf3['options']?_0x23eaf3[_0xdb44('0x1a')][_0xdb44('0x1d')]||null:null,'include':_0x23eaf3['options']?_0x23eaf3[_0xdb44('0x1a')][_0xdb44('0x1e')]?_[_0xdb44('0x1f')](_0x23eaf3[_0xdb44('0x1a')][_0xdb44('0x1e')],function(_0x3fd185){return{'model':db[_0x3fd185['model']],'as':_0x3fd185['as'],'attributes':_0x3fd185[_0xdb44('0x1d')],'include':_0x3fd185[_0xdb44('0x1e')]?_['map'](_0x3fd185[_0xdb44('0x1e')],function(_0x5636f7){return{'model':db[_0x5636f7[_0xdb44('0x20')]],'as':_0x5636f7['as'],'attributes':_0x5636f7['attributes'],'include':_0x5636f7['include']?_['map'](_0x5636f7[_0xdb44('0x1e')],function(_0x4b94cf){return{'model':db[_0x4b94cf[_0xdb44('0x20')]],'as':_0x4b94cf['as'],'attributes':_0x4b94cf[_0xdb44('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdb44('0xe')](function(_0x489f8a){logger[_0xdb44('0x16')](_0xdb44('0x18'),_0x23eaf3);logger[_0xdb44('0x21')]('ShowSmsAccount',_0x23eaf3,JSON[_0xdb44('0x12')](_0x489f8a));_0x2c28bf(_0x489f8a);})['catch'](function(_0x546b9f){logger[_0xdb44('0x13')]('ShowSmsAccount',_0x546b9f[_0xdb44('0x15')],_0x23eaf3);_0x4f511d(_0x4c04ba[_0xdb44('0x13')](0x1f4,_0x546b9f[_0xdb44('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index bcf79f6..72f05f8 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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 25ad1fa..83be240 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 _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','create'];(function(_0x59d822,_0x22cb65){var _0x3aad52=function(_0x1b7949){while(--_0x1b7949){_0x59d822['push'](_0x59d822['shift']());}};_0x3aad52(++_0x22cb65);}(_0x55ca,0x126));var _0xa55c=function(_0x39efbf,_0x118364){_0x39efbf=_0x39efbf-0x0;var _0xcbd510=_0x55ca[_0x39efbf];return _0xcbd510;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xb')]);router['put']('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);module[_0xa55c('0x10')]=router; \ No newline at end of file +var _0x7217=['Router','fs-extra','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x48b029,_0x1d9037){var _0x43347f=function(_0x5d8c90){while(--_0x5d8c90){_0x48b029['push'](_0x48b029['shift']());}};_0x43347f(++_0x1d9037);}(_0x7217,0x19e));var _0x7721=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x7217[_0x5783f4];return _0x28e380;};'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('0xd')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 8afaf86..35083c2 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 _0xc6f1=['INTEGER','noop','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xc6f1,0x1af));var _0x1c6f=function(_0x302ebe,_0x4f4943){_0x302ebe=_0x302ebe-0x0;var _0x3c7926=_0xc6f1[_0x302ebe];return _0x3c7926;};'use strict';var Sequelize=require(_0x1c6f('0x0'));module['exports']={'priority':{'type':Sequelize[_0x1c6f('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1c6f('0x2')},'appdata':{'type':Sequelize[_0x1c6f('0x3')]()},'description':{'type':Sequelize[_0x1c6f('0x4')]},'interval':{'type':Sequelize[_0x1c6f('0x4')],'defaultValue':_0x1c6f('0x5')}}; \ No newline at end of file +var _0xdbfd=['INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0x673722,_0x275d7e){var _0x21249c=function(_0x25b4e7){while(--_0x25b4e7){_0x673722['push'](_0x673722['shift']());}};_0x21249c(++_0x275d7e);}(_0xdbfd,0x149));var _0xddbf=function(_0x27b704,_0x348a59){_0x27b704=_0x27b704-0x0;var _0x55f1f9=_0xdbfd[_0x27b704];return _0x55f1f9;};'use strict';var Sequelize=require(_0xddbf('0x0'));module['exports']={'priority':{'type':Sequelize[_0xddbf('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xddbf('0x2')],'allowNull':![],'defaultValue':_0xddbf('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xddbf('0x2')]},'interval':{'type':Sequelize[_0xddbf('0x2')],'defaultValue':_0xddbf('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 5e827a3..b518d21 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 _0x6265=['includeAll','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','SmsApplication','rawAttributes','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filters','merge','VIRTUAL','filter','options','include','findAll','catch','show','params','keys'];(function(_0x551aef,_0x3a75be){var _0x4b5526=function(_0x486c73){while(--_0x486c73){_0x551aef['push'](_0x551aef['shift']());}};_0x4b5526(++_0x3a75be);}(_0x6265,0x11c));var _0x5626=function(_0x51fee8,_0x5d4310){_0x51fee8=_0x51fee8-0x0;var _0x4dd5a7=_0x6265[_0x51fee8];return _0x4dd5a7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5626('0x0'));var zipdir=require(_0x5626('0x1'));var jsonpatch=require(_0x5626('0x2'));var rp=require(_0x5626('0x3'));var moment=require(_0x5626('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5626('0x5'));var util=require(_0x5626('0x6'));var path=require(_0x5626('0x7'));var sox=require('sox');var csv=require(_0x5626('0x8'));var ejs=require(_0x5626('0x9'));var fs=require('fs');var fs_extra=require(_0x5626('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5626('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5626('0xc'));var Papa=require(_0x5626('0xd'));var Redis=require(_0x5626('0xe'));var authService=require(_0x5626('0xf'));var qs=require(_0x5626('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5626('0x11'));var logger=require('../../config/logger')(_0x5626('0x12'));var utils=require(_0x5626('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5626('0x14'))['db'];function respondWithStatusCode(_0x1a75ff,_0x50a90e){_0x50a90e=_0x50a90e||0xcc;return function(_0x3947b9){if(_0x3947b9){return _0x1a75ff['sendStatus'](_0x50a90e);}return _0x1a75ff[_0x5626('0x15')](_0x50a90e)['end']();};}function respondWithResult(_0x5d5975,_0x41eb62){_0x41eb62=_0x41eb62||0xc8;return function(_0x3ee496){if(_0x3ee496){return _0x5d5975['status'](_0x41eb62)[_0x5626('0x16')](_0x3ee496);}};}function respondWithFilteredResult(_0x5904a7,_0xc66bb0){return function(_0x35ffb3){if(_0x35ffb3){var _0x28f3f6=typeof _0xc66bb0[_0x5626('0x17')]===_0x5626('0x18')&&typeof _0xc66bb0[_0x5626('0x19')]===_0x5626('0x18');var _0x3bf260=_0x35ffb3[_0x5626('0x1a')];var _0x1d2489=_0x28f3f6?0x0:_0xc66bb0[_0x5626('0x17')];var _0x5ef853=_0x28f3f6?_0x35ffb3[_0x5626('0x1a')]:_0xc66bb0[_0x5626('0x17')]+_0xc66bb0[_0x5626('0x19')];var _0xe345c;if(_0x5ef853>=_0x3bf260){_0x5ef853=_0x3bf260;_0xe345c=0xc8;}else{_0xe345c=0xce;}_0x5904a7['status'](_0xe345c);return _0x5904a7['set'](_0x5626('0x1b'),_0x1d2489+'-'+_0x5ef853+'/'+_0x3bf260)[_0x5626('0x16')](_0x35ffb3);}return null;};}function patchUpdates(_0x47fac5){return function(_0x15df63){try{jsonpatch[_0x5626('0x1c')](_0x15df63,_0x47fac5,!![]);}catch(_0x11c3d7){return BPromise[_0x5626('0x1d')](_0x11c3d7);}return _0x15df63['save']();};}function saveUpdates(_0x71d792,_0x3137d6){return function(_0x5836e0){if(_0x5836e0){return _0x5836e0[_0x5626('0x1e')](_0x71d792)[_0x5626('0x1f')](function(_0x547828){return _0x547828;});}return null;};}function removeEntity(_0x3f0fcb,_0x3bf785){return function(_0x30623d){if(_0x30623d){return _0x30623d[_0x5626('0x20')]()[_0x5626('0x1f')](function(){_0x3f0fcb[_0x5626('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x459548,_0x42ed8b){return function(_0x2153b3){if(!_0x2153b3){_0x459548[_0x5626('0x21')](0x194);}return _0x2153b3;};}function handleError(_0x5d7b5c,_0x3bd98f){_0x3bd98f=_0x3bd98f||0x1f4;return function(_0x291867){logger[_0x5626('0x22')](_0x291867[_0x5626('0x23')]);if(_0x291867['name']){delete _0x291867[_0x5626('0x24')];}_0x5d7b5c[_0x5626('0x15')](_0x3bd98f)[_0x5626('0x25')](_0x291867);};}exports[_0x5626('0x26')]=function(_0x2de5cc,_0x7cdf07){var _0x4c965b={},_0x4ffb8f={},_0x202b09={'count':0x0,'rows':[]};var _0x18a872=_[_0x5626('0x27')](db[_0x5626('0x28')][_0x5626('0x29')],function(_0x2f8672){return{'name':_0x2f8672['fieldName'],'type':_0x2f8672[_0x5626('0x2a')][_0x5626('0x2b')]};});_0x4ffb8f[_0x5626('0x2c')]=_[_0x5626('0x27')](_0x18a872,_0x5626('0x24'));_0x4ffb8f[_0x5626('0x2d')]=_['keys'](_0x2de5cc[_0x5626('0x2d')]);_0x4ffb8f['filters']=_[_0x5626('0x2e')](_0x4ffb8f[_0x5626('0x2c')],_0x4ffb8f[_0x5626('0x2d')]);_0x4c965b['attributes']=_[_0x5626('0x2e')](_0x4ffb8f['model'],qs['fields'](_0x2de5cc[_0x5626('0x2d')][_0x5626('0x2f')]));_0x4c965b[_0x5626('0x30')]=_0x4c965b[_0x5626('0x30')][_0x5626('0x31')]?_0x4c965b[_0x5626('0x30')]:_0x4ffb8f[_0x5626('0x2c')];if(!_0x2de5cc[_0x5626('0x2d')][_0x5626('0x32')](_0x5626('0x33'))){_0x4c965b[_0x5626('0x19')]=qs[_0x5626('0x19')](_0x2de5cc[_0x5626('0x2d')]['limit']);_0x4c965b[_0x5626('0x17')]=qs[_0x5626('0x17')](_0x2de5cc[_0x5626('0x2d')]['offset']);}_0x4c965b[_0x5626('0x34')]=qs['sort'](_0x2de5cc[_0x5626('0x2d')]['sort']);_0x4c965b[_0x5626('0x35')]=qs['filters'](_[_0x5626('0x36')](_0x2de5cc[_0x5626('0x2d')],_0x4ffb8f[_0x5626('0x37')]),_0x18a872);if(_0x2de5cc[_0x5626('0x2d')]['filter']){_0x4c965b[_0x5626('0x35')]=_[_0x5626('0x38')](_0x4c965b['where'],{'$or':_[_0x5626('0x27')](_0x18a872,function(_0x33ba5d){if(_0x33ba5d[_0x5626('0x2a')]!==_0x5626('0x39')){var _0x4efd2f={};_0x4efd2f[_0x33ba5d[_0x5626('0x24')]]={'$like':'%'+_0x2de5cc['query'][_0x5626('0x3a')]+'%'};return _0x4efd2f;}})});}_0x4c965b=_['merge']({},_0x4c965b,_0x2de5cc[_0x5626('0x3b')]);var _0x282431={'where':_0x4c965b[_0x5626('0x35')]};return db[_0x5626('0x28')][_0x5626('0x1a')](_0x282431)['then'](function(_0xa0b928){_0x202b09['count']=_0xa0b928;if(_0x2de5cc[_0x5626('0x2d')]['includeAll']){_0x4c965b[_0x5626('0x3c')]=[{'all':!![]}];}return db[_0x5626('0x28')][_0x5626('0x3d')](_0x4c965b);})[_0x5626('0x1f')](function(_0xcfdf77){_0x202b09['rows']=_0xcfdf77;return _0x202b09;})['then'](respondWithFilteredResult(_0x7cdf07,_0x4c965b))[_0x5626('0x3e')](handleError(_0x7cdf07,null));};exports[_0x5626('0x3f')]=function(_0x18eaf6,_0x5ba14b){var _0x134c01={'raw':!![],'where':{'id':_0x18eaf6[_0x5626('0x40')]['id']}},_0x38b5d4={};_0x38b5d4[_0x5626('0x2c')]=_['keys'](db[_0x5626('0x28')][_0x5626('0x29')]);_0x38b5d4[_0x5626('0x2d')]=_[_0x5626('0x41')](_0x18eaf6[_0x5626('0x2d')]);_0x38b5d4[_0x5626('0x37')]=_[_0x5626('0x2e')](_0x38b5d4[_0x5626('0x2c')],_0x38b5d4['query']);_0x134c01[_0x5626('0x30')]=_[_0x5626('0x2e')](_0x38b5d4['model'],qs[_0x5626('0x2f')](_0x18eaf6[_0x5626('0x2d')]['fields']));_0x134c01[_0x5626('0x30')]=_0x134c01[_0x5626('0x30')][_0x5626('0x31')]?_0x134c01[_0x5626('0x30')]:_0x38b5d4['model'];if(_0x18eaf6[_0x5626('0x2d')][_0x5626('0x42')]){_0x134c01[_0x5626('0x3c')]=[{'all':!![]}];}_0x134c01=_['merge']({},_0x134c01,_0x18eaf6[_0x5626('0x3b')]);return db[_0x5626('0x28')][_0x5626('0x43')](_0x134c01)[_0x5626('0x1f')](handleEntityNotFound(_0x5ba14b,null))[_0x5626('0x1f')](respondWithResult(_0x5ba14b,null))[_0x5626('0x3e')](handleError(_0x5ba14b,null));};exports[_0x5626('0x44')]=function(_0x14e0c4,_0x442063){return db[_0x5626('0x28')][_0x5626('0x44')](_0x14e0c4[_0x5626('0x45')],{})[_0x5626('0x1f')](respondWithResult(_0x442063,0xc9))[_0x5626('0x3e')](handleError(_0x442063,null));};exports['update']=function(_0x2b65c2,_0x264b03){if(_0x2b65c2[_0x5626('0x45')]['id']){delete _0x2b65c2[_0x5626('0x45')]['id'];}return db[_0x5626('0x28')][_0x5626('0x43')]({'where':{'id':_0x2b65c2[_0x5626('0x40')]['id']}})[_0x5626('0x1f')](handleEntityNotFound(_0x264b03,null))[_0x5626('0x1f')](saveUpdates(_0x2b65c2[_0x5626('0x45')],null))[_0x5626('0x1f')](respondWithResult(_0x264b03,null))[_0x5626('0x3e')](handleError(_0x264b03,null));};exports[_0x5626('0x20')]=function(_0x53a27f,_0x4a3313){return db['SmsApplication'][_0x5626('0x43')]({'where':{'id':_0x53a27f['params']['id']}})[_0x5626('0x1f')](handleEntityNotFound(_0x4a3313,null))[_0x5626('0x1f')](removeEntity(_0x4a3313,null))[_0x5626('0x3e')](handleError(_0x4a3313,null));}; \ No newline at end of file +var _0x9855=['../../config/license/util','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','limit','order','sort','filters','pick','filter','where','merge','SmsApplication','includeAll','rows','catch','show','params','rawAttributes','options','find','create','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','fs-extra','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x342421,_0x4cfa17){var _0x1b28bb=function(_0x5f1466){while(--_0x5f1466){_0x342421['push'](_0x342421['shift']());}};_0x1b28bb(++_0x4cfa17);}(_0x9855,0xbb));var _0x5985=function(_0xe63db9,_0x101574){_0xe63db9=_0xe63db9-0x0;var _0x5b9ae2=_0x9855[_0xe63db9];return _0x5b9ae2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5985('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5985('0x1'));var rp=require(_0x5985('0x2'));var moment=require(_0x5985('0x3'));var BPromise=require(_0x5985('0x4'));var Mustache=require(_0x5985('0x5'));var util=require('util');var path=require(_0x5985('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5985('0x7'));var _=require('lodash');var squel=require(_0x5985('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5985('0x9'));var toCsv=require(_0x5985('0xa'));var querystring=require(_0x5985('0xb'));var Papa=require(_0x5985('0xc'));var Redis=require('ioredis');var authService=require(_0x5985('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x5985('0xe'));var hardwareService=require(_0x5985('0xf'));var logger=require(_0x5985('0x10'))(_0x5985('0x11'));var utils=require(_0x5985('0x12'));var config=require(_0x5985('0x13'));var licenseUtil=require(_0x5985('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49456d,_0x40ba1b){_0x40ba1b=_0x40ba1b||0xcc;return function(_0x2cbae6){if(_0x2cbae6){return _0x49456d[_0x5985('0x15')](_0x40ba1b);}return _0x49456d['status'](_0x40ba1b)[_0x5985('0x16')]();};}function respondWithResult(_0x2343c5,_0x41df26){_0x41df26=_0x41df26||0xc8;return function(_0x23f30d){if(_0x23f30d){return _0x2343c5[_0x5985('0x17')](_0x41df26)[_0x5985('0x18')](_0x23f30d);}};}function respondWithFilteredResult(_0x5bbd0e,_0x4f825c){return function(_0x98f3b5){if(_0x98f3b5){var _0x19758b=typeof _0x4f825c[_0x5985('0x19')]===_0x5985('0x1a')&&typeof _0x4f825c['limit']==='undefined';var _0x451151=_0x98f3b5[_0x5985('0x1b')];var _0x4584df=_0x19758b?0x0:_0x4f825c[_0x5985('0x19')];var _0x238551=_0x19758b?_0x98f3b5[_0x5985('0x1b')]:_0x4f825c[_0x5985('0x19')]+_0x4f825c['limit'];var _0x5db349;if(_0x238551>=_0x451151){_0x238551=_0x451151;_0x5db349=0xc8;}else{_0x5db349=0xce;}_0x5bbd0e[_0x5985('0x17')](_0x5db349);return _0x5bbd0e[_0x5985('0x1c')](_0x5985('0x1d'),_0x4584df+'-'+_0x238551+'/'+_0x451151)[_0x5985('0x18')](_0x98f3b5);}return null;};}function patchUpdates(_0x34633b){return function(_0x44d4f4){try{jsonpatch['apply'](_0x44d4f4,_0x34633b,!![]);}catch(_0x477630){return BPromise[_0x5985('0x1e')](_0x477630);}return _0x44d4f4[_0x5985('0x1f')]();};}function saveUpdates(_0x1ec7f2,_0x234b55){return function(_0x266c51){if(_0x266c51){return _0x266c51[_0x5985('0x20')](_0x1ec7f2)[_0x5985('0x21')](function(_0x26b7fb){return _0x26b7fb;});}return null;};}function removeEntity(_0x2aad77,_0x24703d){return function(_0x39a712){if(_0x39a712){return _0x39a712[_0x5985('0x22')]()[_0x5985('0x21')](function(){_0x2aad77[_0x5985('0x17')](0xcc)[_0x5985('0x16')]();});}};}function handleEntityNotFound(_0x403e68,_0x257bdd){return function(_0x4ddc46){if(!_0x4ddc46){_0x403e68[_0x5985('0x15')](0x194);}return _0x4ddc46;};}function handleError(_0x498832,_0x15cc68){_0x15cc68=_0x15cc68||0x1f4;return function(_0x14804a){logger[_0x5985('0x23')](_0x14804a[_0x5985('0x24')]);if(_0x14804a[_0x5985('0x25')]){delete _0x14804a[_0x5985('0x25')];}_0x498832[_0x5985('0x17')](_0x15cc68)[_0x5985('0x26')](_0x14804a);};}exports[_0x5985('0x27')]=function(_0x4a47be,_0xe83d81){var _0x1076c2={},_0x573af8={},_0x1f78ed={'count':0x0,'rows':[]};var _0x293266=_[_0x5985('0x28')](db['SmsApplication']['rawAttributes'],function(_0x399e01){return{'name':_0x399e01[_0x5985('0x29')],'type':_0x399e01[_0x5985('0x2a')][_0x5985('0x2b')]};});_0x573af8['model']=_[_0x5985('0x28')](_0x293266,_0x5985('0x25'));_0x573af8[_0x5985('0x2c')]=_[_0x5985('0x2d')](_0x4a47be[_0x5985('0x2c')]);_0x573af8['filters']=_['intersection'](_0x573af8[_0x5985('0x2e')],_0x573af8[_0x5985('0x2c')]);_0x1076c2[_0x5985('0x2f')]=_[_0x5985('0x30')](_0x573af8['model'],qs[_0x5985('0x31')](_0x4a47be[_0x5985('0x2c')][_0x5985('0x31')]));_0x1076c2[_0x5985('0x2f')]=_0x1076c2[_0x5985('0x2f')][_0x5985('0x32')]?_0x1076c2[_0x5985('0x2f')]:_0x573af8[_0x5985('0x2e')];if(!_0x4a47be['query']['hasOwnProperty']('nolimit')){_0x1076c2['limit']=qs[_0x5985('0x33')](_0x4a47be[_0x5985('0x2c')][_0x5985('0x33')]);_0x1076c2[_0x5985('0x19')]=qs['offset'](_0x4a47be['query']['offset']);}_0x1076c2[_0x5985('0x34')]=qs[_0x5985('0x35')](_0x4a47be['query'][_0x5985('0x35')]);_0x1076c2['where']=qs[_0x5985('0x36')](_[_0x5985('0x37')](_0x4a47be[_0x5985('0x2c')],_0x573af8[_0x5985('0x36')]),_0x293266);if(_0x4a47be[_0x5985('0x2c')][_0x5985('0x38')]){_0x1076c2[_0x5985('0x39')]=_['merge'](_0x1076c2['where'],{'$or':_['map'](_0x293266,function(_0x36279d){if(_0x36279d[_0x5985('0x2a')]!=='VIRTUAL'){var _0x137954={};_0x137954[_0x36279d[_0x5985('0x25')]]={'$like':'%'+_0x4a47be['query'][_0x5985('0x38')]+'%'};return _0x137954;}})});}_0x1076c2=_[_0x5985('0x3a')]({},_0x1076c2,_0x4a47be['options']);var _0x480461={'where':_0x1076c2[_0x5985('0x39')]};return db[_0x5985('0x3b')][_0x5985('0x1b')](_0x480461)[_0x5985('0x21')](function(_0x3f1891){_0x1f78ed[_0x5985('0x1b')]=_0x3f1891;if(_0x4a47be['query'][_0x5985('0x3c')]){_0x1076c2['include']=[{'all':!![]}];}return db[_0x5985('0x3b')]['findAll'](_0x1076c2);})[_0x5985('0x21')](function(_0x32c15e){_0x1f78ed[_0x5985('0x3d')]=_0x32c15e;return _0x1f78ed;})['then'](respondWithFilteredResult(_0xe83d81,_0x1076c2))[_0x5985('0x3e')](handleError(_0xe83d81,null));};exports[_0x5985('0x3f')]=function(_0x2e715b,_0x35ef8e){var _0xb99339={'raw':!![],'where':{'id':_0x2e715b[_0x5985('0x40')]['id']}},_0x4234f7={};_0x4234f7[_0x5985('0x2e')]=_['keys'](db['SmsApplication'][_0x5985('0x41')]);_0x4234f7[_0x5985('0x2c')]=_[_0x5985('0x2d')](_0x2e715b['query']);_0x4234f7[_0x5985('0x36')]=_['intersection'](_0x4234f7[_0x5985('0x2e')],_0x4234f7[_0x5985('0x2c')]);_0xb99339[_0x5985('0x2f')]=_[_0x5985('0x30')](_0x4234f7[_0x5985('0x2e')],qs[_0x5985('0x31')](_0x2e715b['query']['fields']));_0xb99339[_0x5985('0x2f')]=_0xb99339[_0x5985('0x2f')]['length']?_0xb99339[_0x5985('0x2f')]:_0x4234f7[_0x5985('0x2e')];if(_0x2e715b[_0x5985('0x2c')][_0x5985('0x3c')]){_0xb99339['include']=[{'all':!![]}];}_0xb99339=_[_0x5985('0x3a')]({},_0xb99339,_0x2e715b[_0x5985('0x42')]);return db[_0x5985('0x3b')][_0x5985('0x43')](_0xb99339)['then'](handleEntityNotFound(_0x35ef8e,null))[_0x5985('0x21')](respondWithResult(_0x35ef8e,null))[_0x5985('0x3e')](handleError(_0x35ef8e,null));};exports['create']=function(_0x159ad8,_0x3de0f3){return db[_0x5985('0x3b')][_0x5985('0x44')](_0x159ad8['body'],{})['then'](respondWithResult(_0x3de0f3,0xc9))[_0x5985('0x3e')](handleError(_0x3de0f3,null));};exports[_0x5985('0x20')]=function(_0x524e2a,_0x213075){if(_0x524e2a['body']['id']){delete _0x524e2a['body']['id'];}return db[_0x5985('0x3b')][_0x5985('0x43')]({'where':{'id':_0x524e2a[_0x5985('0x40')]['id']}})[_0x5985('0x21')](handleEntityNotFound(_0x213075,null))['then'](saveUpdates(_0x524e2a['body'],null))[_0x5985('0x21')](respondWithResult(_0x213075,null))[_0x5985('0x3e')](handleError(_0x213075,null));};exports[_0x5985('0x22')]=function(_0x39175d,_0x92d384){return db[_0x5985('0x3b')]['find']({'where':{'id':_0x39175d[_0x5985('0x40')]['id']}})[_0x5985('0x21')](handleEntityNotFound(_0x92d384,null))[_0x5985('0x21')](removeEntity(_0x92d384,null))[_0x5985('0x3e')](handleError(_0x92d384,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index b9a8e36..74cf4ea 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 _0x8a24=['rimraf','../../config/environment','exports','define','SmsApplication','sms_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1fdd3b,_0x39c433){var _0x817306=function(_0x4629b3){while(--_0x4629b3){_0x1fdd3b['push'](_0x1fdd3b['shift']());}};_0x817306(++_0x39c433);}(_0x8a24,0x132));var _0x48a2=function(_0x27a618,_0xbc5174){_0x27a618=_0x27a618-0x0;var _0x209ba0=_0x8a24[_0x27a618];return _0x209ba0;};'use strict';var _=require(_0x48a2('0x0'));var util=require(_0x48a2('0x1'));var logger=require(_0x48a2('0x2'))(_0x48a2('0x3'));var moment=require(_0x48a2('0x4'));var BPromise=require(_0x48a2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x48a2('0x6'));var config=require(_0x48a2('0x7'));var attributes=require('./smsApplication.attributes');module[_0x48a2('0x8')]=function(_0x6f75a4,_0x59fa68){return _0x6f75a4[_0x48a2('0x9')](_0x48a2('0xa'),attributes,{'tableName':_0x48a2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x48a2('0xc')});}; \ No newline at end of file +var _0x3245=['exports','define','utf8mb4','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x14476b,_0xd1a7a4){var _0x24e2e8=function(_0x52ed26){while(--_0x52ed26){_0x14476b['push'](_0x14476b['shift']());}};_0x24e2e8(++_0xd1a7a4);}(_0x3245,0x1b1));var _0x5324=function(_0x176a46,_0x49942c){_0x176a46=_0x176a46-0x0;var _0x44cb5b=_0x3245[_0x176a46];return _0x44cb5b;};'use strict';var _=require(_0x5324('0x0'));var util=require(_0x5324('0x1'));var logger=require('../../config/logger')(_0x5324('0x2'));var moment=require(_0x5324('0x3'));var BPromise=require('bluebird');var rp=require(_0x5324('0x4'));var fs=require('fs');var path=require(_0x5324('0x5'));var rimraf=require(_0x5324('0x6'));var config=require('../../config/environment');var attributes=require('./smsApplication.attributes');module[_0x5324('0x7')]=function(_0x5594eb,_0x1a0565){return _0x5594eb[_0x5324('0x8')]('SmsApplication',attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5324('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index ebf3b19..5e7aee2 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 _0xc74c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x296923,_0x4adaed){var _0x29af70=function(_0x4eeedb){while(--_0x4eeedb){_0x296923['push'](_0x296923['shift']());}};_0x29af70(++_0x4adaed);}(_0xc74c,0x163));var _0xcc74=function(_0x1a47f8,_0xe88229){_0x1a47f8=_0x1a47f8-0x0;var _0x20626d=_0xc74c[_0x1a47f8];return _0x20626d;};'use strict';var _=require(_0xcc74('0x0'));var util=require(_0xcc74('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcc74('0x2'));var fs=require('fs');var Redis=require(_0xcc74('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcc74('0x4'));var logger=require(_0xcc74('0x5'))(_0xcc74('0x6'));var config=require(_0xcc74('0x7'));var jayson=require(_0xcc74('0x8'));var client=jayson[_0xcc74('0x9')][_0xcc74('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d46a6,_0x15248f,_0x86f429){return new BPromise(function(_0x1eb886,_0x473308){return client[_0xcc74('0xb')](_0x5d46a6,_0x86f429)['then'](function(_0x4b4534){logger[_0xcc74('0xc')](_0xcc74('0xd'),_0x15248f,_0xcc74('0xe'));logger['debug'](_0xcc74('0xf'),_0x15248f,_0xcc74('0xe'),JSON[_0xcc74('0x10')](_0x4b4534));if(_0x4b4534['error']){if(_0x4b4534[_0xcc74('0x11')]['code']===0x1f4){logger[_0xcc74('0x11')]('SmsApplication,\x20%s,\x20%s',_0x15248f,_0x4b4534['error']['message']);return _0x473308(_0x4b4534[_0xcc74('0x11')][_0xcc74('0x12')]);}logger[_0xcc74('0x11')](_0xcc74('0xd'),_0x15248f,_0x4b4534[_0xcc74('0x11')]['message']);return _0x1eb886(_0x4b4534[_0xcc74('0x11')][_0xcc74('0x12')]);}else{logger[_0xcc74('0xc')](_0xcc74('0xd'),_0x15248f,_0xcc74('0xe'));_0x1eb886(_0x4b4534['result'][_0xcc74('0x12')]);}})[_0xcc74('0x13')](function(_0xe44014){logger[_0xcc74('0x11')](_0xcc74('0xd'),_0x15248f,_0xe44014);_0x473308(_0xe44014);});});} \ No newline at end of file +var _0x5204=['rpc','jayson/promise','client','http','request','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5204,0xdf));var _0x4520=function(_0x5a636f,_0x3fec2b){_0x5a636f=_0x5a636f-0x0;var _0x6a8cfb=_0x5204[_0x5a636f];return _0x6a8cfb;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var moment=require('moment');var BPromise=require(_0x4520('0x2'));var rs=require(_0x4520('0x3'));var fs=require('fs');var Redis=require(_0x4520('0x4'));var db=require(_0x4520('0x5'))['db'];var utils=require(_0x4520('0x6'));var logger=require('../../config/logger')(_0x4520('0x7'));var config=require('../../config/environment');var jayson=require(_0x4520('0x8'));var client=jayson[_0x4520('0x9')][_0x4520('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe741c2,_0x396d29,_0x446dc9){return new BPromise(function(_0x27890f,_0x55b44f){return client[_0x4520('0xb')](_0xe741c2,_0x446dc9)['then'](function(_0x168e62){logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));logger[_0x4520('0xf')](_0x4520('0x10'),_0x396d29,_0x4520('0xe'),JSON[_0x4520('0x11')](_0x168e62));if(_0x168e62[_0x4520('0x12')]){if(_0x168e62[_0x4520('0x12')][_0x4520('0x13')]===0x1f4){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x55b44f(_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);}logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x27890f(_0x168e62['error'][_0x4520('0x14')]);}else{logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));_0x27890f(_0x168e62[_0x4520('0x15')]['message']);}})[_0x4520('0x16')](function(_0x33ac29){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x33ac29);_0x55b44f(_0x33ac29);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index f36faeb..a139824 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 _0xefda=['../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','/describe','isAuthenticated','/:id','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','sms','addTags','put','smsinteraction:update','update','smsinteraction:destroy','destroy','removeTags','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x337082,_0x403d1d){var _0x547ccb=function(_0xd13a1c){while(--_0xd13a1c){_0x337082['push'](_0x337082['shift']());}};_0x547ccb(++_0x403d1d);}(_0xefda,0x96));var _0xaefd=function(_0x33a2b4,_0x5aab9b){_0x33a2b4=_0x33a2b4-0x0;var _0x42f2a7=_0xefda[_0x33a2b4];return _0x42f2a7;};'use strict';var multer=require(_0xaefd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaefd('0x1'));var express=require(_0xaefd('0x2'));var router=express['Router']();var fs_extra=require(_0xaefd('0x3'));var auth=require(_0xaefd('0x4'));var interaction=require(_0xaefd('0x5'));var config=require(_0xaefd('0x6'));var controller=require(_0xaefd('0x7'));router[_0xaefd('0x8')]('/',auth['isAuthenticated'](),controller[_0xaefd('0x9')]);router[_0xaefd('0x8')](_0xaefd('0xa'),auth[_0xaefd('0xb')](),controller['describe']);router[_0xaefd('0x8')](_0xaefd('0xc'),auth[_0xaefd('0xb')](),controller['show']);router['get']('/:id/messages',auth[_0xaefd('0xb')](),controller[_0xaefd('0xd')]);router[_0xaefd('0x8')](_0xaefd('0xe'),auth[_0xaefd('0xb')](),controller[_0xaefd('0xf')]);router[_0xaefd('0x10')]('/',auth[_0xaefd('0xb')](),controller[_0xaefd('0x11')]);router[_0xaefd('0x10')](_0xaefd('0x12'),auth['isAuthenticated'](),controller[_0xaefd('0x13')]);router['post'](_0xaefd('0x14'),auth[_0xaefd('0xb')](),interaction[_0xaefd('0x15')](_0xaefd('0x16'),'smsinteraction:addtags'),controller[_0xaefd('0x17')]);router[_0xaefd('0x18')](_0xaefd('0xc'),auth[_0xaefd('0xb')](),interaction[_0xaefd('0x15')](_0xaefd('0x16'),_0xaefd('0x19')),controller[_0xaefd('0x1a')]);router['delete'](_0xaefd('0xc'),auth[_0xaefd('0xb')](),interaction[_0xaefd('0x15')](_0xaefd('0x16'),_0xaefd('0x1b')),controller[_0xaefd('0x1c')]);router['delete'](_0xaefd('0x14'),auth[_0xaefd('0xb')](),controller[_0xaefd('0x1d')]);module[_0xaefd('0x1e')]=router; \ No newline at end of file +var _0xf4f4=['/:id/tags','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','post','create','tracked','sms','smsinteraction:addtags','put','smsinteraction:update','update','delete','/:id','smsinteraction:destroy','destroy'];(function(_0x25a969,_0x5a6c17){var _0x518215=function(_0x3969fb){while(--_0x3969fb){_0x25a969['push'](_0x25a969['shift']());}};_0x518215(++_0x5a6c17);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x2df74b,_0x4a41ce){_0x2df74b=_0x2df74b-0x0;var _0xa871ea=_0xf4f4[_0x2df74b];return _0xa871ea;};'use strict';var multer=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var path=require('path');var timeout=require(_0x4f4f('0x2'));var express=require(_0x4f4f('0x3'));var router=express[_0x4f4f('0x4')]();var fs_extra=require(_0x4f4f('0x5'));var auth=require(_0x4f4f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4f4f('0x7'));var controller=require('./smsInteraction.controller');router[_0x4f4f('0x8')]('/',auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xa')]);router[_0x4f4f('0x8')](_0x4f4f('0xb'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xc')]);router[_0x4f4f('0x8')]('/:id',auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xd')]);router[_0x4f4f('0x8')](_0x4f4f('0xe'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xf')]);router[_0x4f4f('0x8')](_0x4f4f('0x10'),auth['isAuthenticated'](),controller['download']);router[_0x4f4f('0x11')]('/',auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x12')]);router[_0x4f4f('0x11')](_0x4f4f('0xe'),auth[_0x4f4f('0x9')](),controller['addMessage']);router[_0x4f4f('0x11')]('/:id/tags',auth[_0x4f4f('0x9')](),interaction[_0x4f4f('0x13')](_0x4f4f('0x14'),_0x4f4f('0x15')),controller['addTags']);router[_0x4f4f('0x16')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x4f4f('0x14'),_0x4f4f('0x17')),controller[_0x4f4f('0x18')]);router[_0x4f4f('0x19')](_0x4f4f('0x1a'),auth[_0x4f4f('0x9')](),interaction[_0x4f4f('0x13')](_0x4f4f('0x14'),_0x4f4f('0x1b')),controller[_0x4f4f('0x1c')]);router[_0x4f4f('0x19')](_0x4f4f('0x1d'),auth['isAuthenticated'](),controller[_0x4f4f('0x1e')]);module[_0x4f4f('0x1f')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 1e7a1b4..e340f1c 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 _0xab86=['exports','STRING','DATE','ENUM','out','BOOLEAN','sequelize','moment'];(function(_0x59dac6,_0x1b8801){var _0x1fada5=function(_0x598d46){while(--_0x598d46){_0x59dac6['push'](_0x59dac6['shift']());}};_0x1fada5(++_0x1b8801);}(_0xab86,0x13e));var _0x6ab8=function(_0x581fac,_0x165cbc){_0x581fac=_0x581fac-0x0;var _0x207776=_0xab86[_0x581fac];return _0x207776;};'use strict';var Sequelize=require(_0x6ab8('0x0'));var moment=require(_0x6ab8('0x1'));module[_0x6ab8('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x6ab8('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x6ab8('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x6ab8('0x3')]},'read1stAt':{'type':Sequelize[_0x6ab8('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x6ab8('0x5')]('in',_0x6ab8('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6ab8('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x6ab8('0x5')]('in',_0x6ab8('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x6ab8('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x0619=['sequelize','moment','exports','BOOLEAN','STRING','DATE','ENUM','out'];(function(_0x1628b3,_0x5f1805){var _0x4bad95=function(_0x1afa12){while(--_0x1afa12){_0x1628b3['push'](_0x1628b3['shift']());}};_0x4bad95(++_0x5f1805);}(_0x0619,0x90));var _0x9061=function(_0x1c97d3,_0x3a6f0a){_0x1c97d3=_0x1c97d3-0x0;var _0x1d58f2=_0x0619[_0x1c97d3];return _0x1d58f2;};'use strict';var Sequelize=require(_0x9061('0x0'));var moment=require(_0x9061('0x1'));module[_0x9061('0x2')]={'closed':{'type':Sequelize[_0x9061('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x9061('0x4')]},'secondDisposition':{'type':Sequelize[_0x9061('0x4')]},'thirdDisposition':{'type':Sequelize[_0x9061('0x4')]},'note':{'type':Sequelize[_0x9061('0x4')]},'phone':{'type':Sequelize[_0x9061('0x4')]},'read1stAt':{'type':Sequelize[_0x9061('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x9061('0x6')]('in',_0x9061('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9061('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x9061('0x6')]('in',_0x9061('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 0d58a67..54d4639 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 _0x95e0=['body','some','compact','isEmpty','SmsAccountId','parse','$gte','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','DESC','t.id\x20IN\x20?','i.SmsAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','toString','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','show','params','includeAll','options','describe','addMessage','ids','findOne','SmsMessage','nolimit','format','YYYY-MM-DD\x20HH:mm:ss','include','addTags','omit','spread','findAll','color','emit','smsInteractionTags:save','removeTags','download','unix','root','files','tmp','join','server','attachments','transcript-%d-%s.zip','CmContact','lastName','Messages','createdAt','direction','secret','SmsAccount','Account','Owner','get','mkdirSync','Sms','N.A.','closedAt','disposition','out','System','firstName','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','fullname','Tags','TagIds','split','forEach','push','catch','index','map','SmsInteraction','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','sort','pick','select','field','tools_tags','u.id','ui.SmsInteractionId','from','user_has_sms_interactions','left_join','users','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','length','find','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','buildExpression','type','text','start','Tag','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?'];(function(_0x17f5b7,_0x5c575c){var _0x4f6e7=function(_0x305da6){while(--_0x305da6){_0x17f5b7['push'](_0x17f5b7['shift']());}};_0x4f6e7(++_0x5c575c);}(_0x95e0,0x163));var _0x095e=function(_0x5cbb9c,_0x490dcb){_0x5cbb9c=_0x5cbb9c-0x0;var _0x5c3dda=_0x95e0[_0x5cbb9c];return _0x5c3dda;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x095e('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x095e('0x1'));var moment=require(_0x095e('0x2'));var BPromise=require(_0x095e('0x3'));var Mustache=require(_0x095e('0x4'));var util=require('util');var path=require(_0x095e('0x5'));var sox=require(_0x095e('0x6'));var csv=require(_0x095e('0x7'));var ejs=require(_0x095e('0x8'));var fs=require('fs');var fs_extra=require(_0x095e('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x095e('0xa'));var deskjs=require(_0x095e('0xb'));var toCsv=require('to-csv');var querystring=require(_0x095e('0xc'));var Papa=require(_0x095e('0xd'));var Redis=require(_0x095e('0xe'));var authService=require(_0x095e('0xf'));var qs=require(_0x095e('0x10'));var as=require(_0x095e('0x11'));var pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require(_0x095e('0x12'))('api');var utils=require(_0x095e('0x13'));var config=require(_0x095e('0x14'));var licenseUtil=require(_0x095e('0x15'));var db=require(_0x095e('0x16'))['db'];config[_0x095e('0x17')]=_[_0x095e('0x18')](config[_0x095e('0x17')],{'host':_0x095e('0x19'),'port':0x18eb});var socket=require(_0x095e('0x1a'))(new Redis(config[_0x095e('0x17')]));require('./smsInteraction.socket')[_0x095e('0x1b')](socket);function respondWithStatusCode(_0x2686fe,_0x1d1248){_0x1d1248=_0x1d1248||0xcc;return function(_0x54e9d3){if(_0x54e9d3){return _0x2686fe['sendStatus'](_0x1d1248);}return _0x2686fe[_0x095e('0x1c')](_0x1d1248)[_0x095e('0x1d')]();};}function respondWithResult(_0x818439,_0x139b3d){_0x139b3d=_0x139b3d||0xc8;return function(_0x332369){if(_0x332369){return _0x818439[_0x095e('0x1c')](_0x139b3d)[_0x095e('0x1e')](_0x332369);}};}function respondWithFilteredResult(_0x1fb9c5,_0x1bc05b){return function(_0x3d731a){if(_0x3d731a){var _0x55183a=typeof _0x1bc05b[_0x095e('0x1f')]===_0x095e('0x20')&&typeof _0x1bc05b[_0x095e('0x21')]===_0x095e('0x20');var _0x4fc7b2=_0x3d731a['count'];var _0x48e4b4=_0x55183a?0x0:_0x1bc05b[_0x095e('0x1f')];var _0x1f59fd=_0x55183a?_0x3d731a[_0x095e('0x22')]:_0x1bc05b[_0x095e('0x1f')]+_0x1bc05b[_0x095e('0x21')];var _0x2b4025;if(_0x1f59fd>=_0x4fc7b2){_0x1f59fd=_0x4fc7b2;_0x2b4025=0xc8;}else{_0x2b4025=0xce;}_0x1fb9c5['status'](_0x2b4025);return _0x1fb9c5[_0x095e('0x23')](_0x095e('0x24'),_0x48e4b4+'-'+_0x1f59fd+'/'+_0x4fc7b2)[_0x095e('0x1e')](_0x3d731a);}return null;};}function patchUpdates(_0x5cf027){return function(_0x44f7c4){try{jsonpatch[_0x095e('0x25')](_0x44f7c4,_0x5cf027,!![]);}catch(_0x411c81){return BPromise[_0x095e('0x26')](_0x411c81);}return _0x44f7c4[_0x095e('0x27')]();};}function saveUpdates(_0x55a0b7,_0x59eb9f){return function(_0x3a57ae){if(_0x3a57ae){return _0x3a57ae[_0x095e('0x28')](_0x55a0b7)[_0x095e('0x29')](function(_0x1490cd){return _0x1490cd;});}return null;};}function removeEntity(_0x5d2ce8,_0x581ec1){return function(_0x175dac){if(_0x175dac){return _0x175dac[_0x095e('0x2a')]()[_0x095e('0x29')](function(){_0x5d2ce8[_0x095e('0x1c')](0xcc)[_0x095e('0x1d')]();});}};}function handleEntityNotFound(_0x22764d,_0x524b7e){return function(_0x3897b0){if(!_0x3897b0){_0x22764d[_0x095e('0x2b')](0x194);}return _0x3897b0;};}function handleError(_0x35da02,_0x199add){_0x199add=_0x199add||0x1f4;return function(_0x21652f){logger[_0x095e('0x2c')](_0x21652f[_0x095e('0x2d')]);if(_0x21652f[_0x095e('0x2e')]){delete _0x21652f[_0x095e('0x2e')];}_0x35da02['status'](_0x199add)[_0x095e('0x2f')](_0x21652f);};}function getInteractionUsers(_0x54f507,_0x4efbdc){return new BPromise(function(_0x39afed,_0x1605d8){try{if(_0x4efbdc[_0x54f507['id']]){_0x54f507['Users']=_['map'](_0x4efbdc[_0x54f507['id']],function(_0x2b066a){return{'id':_0x2b066a['id'],'fullname':_0x2b066a[_0x095e('0x30')]};});}}catch(_0x3ddf2e){_0x1605d8(_0x3ddf2e);}_0x39afed(_0x54f507);});}function getInteractionTags(_0x56e524,_0xde3942){return new BPromise(function(_0x3ad817,_0x35b57d){try{if(_0x56e524['TagIds']){_0x56e524[_0x095e('0x31')]=[];_0x56e524[_0x095e('0x32')][_0x095e('0x33')](',')[_0x095e('0x34')](function(_0x469e41){_0x56e524[_0x095e('0x31')][_0x095e('0x35')](_0xde3942[_0x469e41]);});}delete _0x56e524[_0x095e('0x32')];}catch(_0x432921){_0x35b57d(_0x432921);}_0x3ad817(_0x56e524);});}function updateSmsInteraction(_0x9e67,_0x4dbf2f,_0x51814e){return new BPromise(function(_0xec1904,_0x245dab){return getInteractionUsers(_0x9e67,_0x51814e)[_0x095e('0x29')](function(_0x48ab7e){return getInteractionTags(_0x48ab7e,_0x4dbf2f);})[_0x095e('0x29')](function(_0x3bea44){_0xec1904(_0x3bea44);})[_0x095e('0x36')](function(_0x3140ba){_0x245dab(_0x3140ba);});});}exports[_0x095e('0x37')]=function(_0x27664a,_0x39e8c1){var _0x1b9c85={},_0x3a5d61={},_0x499f75={'count':0x0,'rows':[]};var _0x4f16ab=_[_0x095e('0x38')](db[_0x095e('0x39')][_0x095e('0x3a')],function(_0x2e09c9){return{'name':_0x2e09c9['fieldName'],'type':_0x2e09c9['type'][_0x095e('0x3b')]};});_0x3a5d61[_0x095e('0x3c')]=_[_0x095e('0x38')](_0x4f16ab,_0x095e('0x2e'));_0x3a5d61[_0x095e('0x3d')]=_[_0x095e('0x3e')](_0x27664a['query']);_0x3a5d61[_0x095e('0x3f')]=_['intersection'](_0x3a5d61[_0x095e('0x3c')],_0x3a5d61['query']);_0x1b9c85[_0x095e('0x40')]=_[_0x095e('0x41')](_0x3a5d61[_0x095e('0x3c')],qs[_0x095e('0x42')](_0x27664a[_0x095e('0x3d')]['fields']));_0x1b9c85[_0x095e('0x40')]=_0x1b9c85[_0x095e('0x40')]['length']?_0x1b9c85[_0x095e('0x40')]:_0x3a5d61[_0x095e('0x3c')];if(!_0x27664a[_0x095e('0x3d')][_0x095e('0x43')]('nolimit')){_0x1b9c85[_0x095e('0x21')]=qs['limit'](_0x27664a['query'][_0x095e('0x21')]);_0x1b9c85[_0x095e('0x1f')]=qs['offset'](_0x27664a[_0x095e('0x3d')][_0x095e('0x1f')]);}_0x1b9c85['order']=qs[_0x095e('0x44')](_0x27664a[_0x095e('0x3d')]['sort']);_0x1b9c85['where']=qs[_0x095e('0x3f')](_[_0x095e('0x45')](_0x27664a['query'],_0x3a5d61[_0x095e('0x3f')]),_0x4f16ab);var _0x3330ba=[];var _0x48e119=squel[_0x095e('0x46')]()['field']('id')[_0x095e('0x47')](_0x095e('0x2e'))['field']('color')['from'](_0x095e('0x48'));var _0x54bd5d=squel[_0x095e('0x46')]()[_0x095e('0x47')](_0x095e('0x49'))[_0x095e('0x47')]('u.fullname')['field'](_0x095e('0x4a'))[_0x095e('0x4b')](_0x095e('0x4c'),'ui')[_0x095e('0x4d')](_0x095e('0x4e'),'u','u.id\x20=\x20ui.UserId');var _0x13a520=squel['select']()['from'](_0x095e('0x4f'),'i')[_0x095e('0x4d')](_0x095e('0x50'),'c',_0x095e('0x51'))['left_join'](_0x095e('0x4e'),'o',_0x095e('0x52'))[_0x095e('0x4d')](_0x095e('0x53'),'a',_0x095e('0x54'))['left_join'](_0x095e('0x55'),'me',_0x095e('0x56'))['left_join']('sms_interaction_has_tags','it',_0x095e('0x57'))[_0x095e('0x4d')]('tools_tags','t',_0x095e('0x58'));var _0x3f643b=squel[_0x095e('0x59')]();var _0x36a3ff=[];var _0x6dd360=squel[_0x095e('0x59')]();var _0x5883a7;if(_0x27664a[_0x095e('0x3d')][_0x095e('0x5a')]){_0x5883a7=as[_0x095e('0x5b')](_0x27664a[_0x095e('0x3d')]['search']);var _0x275b75=_0x5883a7['sqlOperator'];for(var _0x5b74b8=0x0;_0x5b74b8<_0x5883a7['conditions'][_0x095e('0x5c')];_0x5b74b8++){var _0x20323d=_0x5883a7['conditions'][_0x5b74b8];var _0x52b051='i';var _0x29bd9d=_[_0x095e('0x5d')](_0x4f16ab,[_0x095e('0x2e'),_0x20323d[_0x095e('0x47')]]);if(!_0x29bd9d){switch(_0x20323d[_0x095e('0x47')]){case'unreadMessages':if(_0x20323d[_0x095e('0x5e')]==0x1){_0x13a520[_0x095e('0x5f')]('`'+_0x20323d['field']+_0x095e('0x60'));}else{_0x13a520[_0x095e('0x5f')]('`'+_0x20323d[_0x095e('0x47')]+_0x095e('0x61'));}break;case _0x095e('0x62'):if(_0x20323d['operator']===_0x095e('0x63')){if(_0x20323d[_0x095e('0x5e')][_0x095e('0x33')]('\x20')[_0x095e('0x5c')]>0x1){_0x3f643b[_0x275b75](_0x095e('0x64'),qs[_0x095e('0x65')](_0x20323d[_0x095e('0x5e')]),null);}else{var _0x1b439='%'+_0x20323d['value']+'%';_0x3f643b[_0x275b75]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x1b439,_0x1b439,_0x1b439);}}else{_0x29bd9d=_['find'](_0x4f16ab,[_0x095e('0x2e'),'ContactId']);_0x20323d[_0x095e('0x47')]='ContactId';_0x698e7f=as[_0x095e('0x66')](_0x52b051,_0x29bd9d[_0x095e('0x67')],_0x20323d);_0x3f643b[_0x275b75](_0x698e7f[_0x095e('0x68')],_0x698e7f[_0x095e('0x5e')][_0x095e('0x69')],_0x698e7f[_0x095e('0x5e')]['end']);}break;case _0x095e('0x6a'):var _0x3f98ea=_0x20323d[_0x095e('0x5e')][_0x095e('0x33')](',')[_0x095e('0x38')](function(_0x30ef68){return Number(_0x30ef68);});_0x3f98ea[_0x095e('0x34')](function(_0x1bbd34){_0x6dd360['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1bbd34+',%');});_0x36a3ff=_[_0x095e('0x6b')](_0x36a3ff,_0x3f98ea);break;case _0x095e('0x6c'):if(_0x20323d[_0x095e('0x6d')]===_0x095e('0x63')){_0x3f643b[_0x275b75](_0x095e('0x6e'),'%'+_0x20323d[_0x095e('0x5e')]+'%',null);}else{_0x29bd9d=_['find'](_0x4f16ab,[_0x095e('0x2e'),'UserId']);_0x20323d[_0x095e('0x47')]='UserId';_0x698e7f=as['buildExpression'](_0x52b051,_0x29bd9d[_0x095e('0x67')],_0x20323d);_0x3f643b[_0x275b75](_0x698e7f[_0x095e('0x68')],_0x698e7f[_0x095e('0x5e')]['start'],_0x698e7f[_0x095e('0x5e')]['end']);}break;case _0x095e('0x6f'):_0x698e7f=as[_0x095e('0x66')]('me',null,_0x20323d);_0x3f643b[_0x275b75](_0x698e7f[_0x095e('0x68')],_0x698e7f[_0x095e('0x5e')][_0x095e('0x69')],_0x698e7f[_0x095e('0x5e')]['end']);break;}}else{var _0x698e7f=as[_0x095e('0x66')](_0x52b051,_0x29bd9d[_0x095e('0x67')],_0x20323d);_0x3f643b[_0x275b75](_0x698e7f[_0x095e('0x68')],_0x698e7f['value'][_0x095e('0x69')],_0x698e7f[_0x095e('0x5e')][_0x095e('0x1d')]);}}}else{var _0x40f2b8=_(_0x27664a[_0x095e('0x3d')])['keys']()[_0x095e('0x38')](function(_0x8fd63a){return _[_0x095e('0x70')](_0x4f16ab,[_0x095e('0x2e'),_0x8fd63a])?_0x8fd63a:undefined;})[_0x095e('0x71')]()[_0x095e('0x5e')]();if(!_[_0x095e('0x72')](_0x40f2b8)){_0x40f2b8['forEach'](function(_0x4943e0){if(_0x4943e0===_0x095e('0x73')){_0x13a520['where']('i.SmsAccountId\x20IN\x20?',[]['concat'](_0x27664a['query'][_0x4943e0]));}else if(_0x4943e0==='createdAt'){var _0x227b50=JSON[_0x095e('0x74')](_0x27664a['query'][_0x4943e0])[_0x095e('0x75')];var _0xa4706f=JSON['parse'](_0x27664a[_0x095e('0x3d')][_0x4943e0])[_0x095e('0x76')];_0x13a520[_0x095e('0x77')](_0x095e('0x78'),_0x227b50,_0xa4706f);}else{if(_0x27664a[_0x095e('0x3d')][_0x4943e0]===_0x095e('0x79')){_0x13a520[_0x095e('0x77')]('i.'+_0x4943e0+'\x20IS\x20NULL');}else{_0x13a520[_0x095e('0x77')]('i.'+_0x4943e0+_0x095e('0x7a'),_0x27664a[_0x095e('0x3d')][_0x4943e0]);}}});}if(_0x27664a['query'][_0x095e('0x7b')]){if(_0x27664a['query'][_0x095e('0x7b')]==0x1){_0x13a520['having'](_0x095e('0x7c'));}else{_0x13a520[_0x095e('0x5f')](_0x095e('0x7d'));}}if(_0x27664a[_0x095e('0x3d')]['tag']){_0x36a3ff=_[_0x095e('0x7e')](_0x27664a[_0x095e('0x3d')][_0x095e('0x7f')])?_0x27664a['query'][_0x095e('0x7f')]:new Array(_0x27664a[_0x095e('0x3d')]['tag']);_0x36a3ff[_0x095e('0x34')](function(_0x2c9001){_0x6dd360['or'](_0x095e('0x80'),'%,'+_0x2c9001+',%');});}if(_0x27664a[_0x095e('0x3d')][_0x095e('0x81')]){var _0x55dbfd=_0x27664a[_0x095e('0x3d')][_0x095e('0x81')]['replace']('\x5c','\x5c\x5c')[_0x095e('0x82')](/'/g,'\x27\x27');if(qs[_0x095e('0x83')](_0x55dbfd)){_0x3f643b['or'](_0x095e('0x84'),_0x55dbfd+'%')['or'](_0x095e('0x85'),_0x55dbfd+'%');}else{_0x3f643b['or'](_0x095e('0x86'),qs[_0x095e('0x65')](_0x55dbfd))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x55dbfd+'%');}}}_0x13a520[_0x095e('0x77')](_0x3f643b);_0x13a520[_0x095e('0x87')](_0x095e('0x88'));var _0x1e9eeb={'type':db[_0x095e('0x89')][_0x095e('0x8a')][_0x095e('0x8b')],'raw':!![]};var _0x179361=_0x13a520[_0x095e('0x8c')]();_0x179361[_0x095e('0x47')](_0x095e('0x88'));_0x179361[_0x095e('0x47')](_0x095e('0x8d'),_0x095e('0x8e'));if(_0x1b9c85[_0x095e('0x8f')]){_0x1b9c85[_0x095e('0x8f')]['forEach'](function(_0x2cb6d1){var _0x1ec556=_0x2cb6d1[0x0]==='contactName'?_0x2cb6d1[0x0]:'i.'+_0x2cb6d1[0x0];_0x13a520['order'](_0x1ec556,_0x2cb6d1[0x1]===_0x095e('0x90')?![]:!![]);});}if(!_['isEmpty'](_0x36a3ff)){_0x13a520[_0x095e('0x5f')](_0x6dd360);_0x179361['where'](_0x095e('0x91'),_0x36a3ff);}BPromise['resolve']()['then'](function(){if(!_0x5883a7){if(_0x27664a[_0x095e('0x3d')][_0x095e('0x73')])return;_0x179361[_0x095e('0x77')](_0x095e('0x92'));_0x13a520['where'](_0x095e('0x92'));return;}if(_0x27664a['user'][_0x095e('0x93')]!==_0x095e('0x94'))return;return _0x27664a[_0x095e('0x95')][_0x095e('0x96')]({'attributes':['id'],'raw':!![]})[_0x095e('0x29')](function(_0x4a8393){if(_[_0x095e('0x72')](_0x4a8393)){_0x179361[_0x095e('0x77')]('i.SmsAccountId\x20IS\x20NULL');_0x13a520['where'](_0x095e('0x97'));}else{_0x179361[_0x095e('0x77')](_0x095e('0x98'),_[_0x095e('0x38')](_0x4a8393,'id'));_0x13a520[_0x095e('0x77')]('i.SmsAccountId\x20IN\x20?',_[_0x095e('0x38')](_0x4a8393,'id'));}});})[_0x095e('0x29')](function(){if(_0x27664a['user']['role']===_0x095e('0x94')&&!_0x5883a7&&!_0x27664a[_0x095e('0x3d')][_0x095e('0x73')])return[];return db['sequelize'][_0x095e('0x3d')](_0x179361[_0x095e('0x99')](),_0x1e9eeb);})[_0x095e('0x29')](function(_0x4b4d88){_0x499f75['count']=_0x4b4d88['length'];if(_0x499f75[_0x095e('0x22')]===0x0)return[];return db['sequelize'][_0x095e('0x3d')](_0x48e119[_0x095e('0x99')](),_0x1e9eeb)[_0x095e('0x29')](function(_0x5b5008){_0x3330ba=_['keyBy'](_0x5b5008,'id');_0x1e9eeb=_[_0x095e('0x9a')](_0x1e9eeb,{'model':db[_0x095e('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x27664a[_0x095e('0x3d')][_0x095e('0x42')]){_0x1b9c85[_0x095e('0x40')][_0x095e('0x34')](function(_0x3822ae){_0x13a520[_0x095e('0x47')]('i.'+_0x3822ae);});}else{_0x13a520[_0x095e('0x47')](_0x095e('0x8d'),_0x095e('0x8e'));_0x13a520[_0x095e('0x47')](_0x095e('0x9b'),_0x095e('0x9c'));_0x13a520[_0x095e('0x47')](_0x095e('0x9d'),_0x095e('0x9e'));_0x13a520[_0x095e('0x47')](_0x095e('0x9f'),_0x095e('0xa0'));_0x13a520['field'](_0x095e('0xa1'));_0x13a520[_0x095e('0x47')](_0x095e('0xa2'),_0x095e('0xa3'));_0x13a520['field'](_0x095e('0xa4'),_0x095e('0xa5'));_0x13a520[_0x095e('0x47')]('c.email',_0x095e('0xa6'));_0x13a520[_0x095e('0x47')](_0x095e('0xa7'),'Contact.phone');_0x13a520[_0x095e('0x47')]('c.mobile',_0x095e('0xa8'));_0x13a520[_0x095e('0x47')](_0x095e('0xa9'),_0x095e('0xaa'));_0x13a520[_0x095e('0x47')](_0x095e('0xab'),_0x095e('0xac'));_0x13a520['field'](_0x095e('0xad'),'Owner.internal');_0x13a520[_0x095e('0x47')](_0x095e('0xae'),_0x095e('0x32'));}if(_0x1b9c85[_0x095e('0x21')])_0x13a520[_0x095e('0x21')](_0x1b9c85[_0x095e('0x21')]);if(_0x1b9c85['offset'])_0x13a520[_0x095e('0x1f')](_0x1b9c85['offset']);return db[_0x095e('0xaf')][_0x095e('0x3d')](_0x13a520['toString'](),_0x1e9eeb);})['then'](function(_0x4b45c4){if(_0x4b45c4[_0x095e('0x5c')]>0x0)_0x54bd5d[_0x095e('0x77')](_0x095e('0xb0'),_[_0x095e('0x38')](_0x4b45c4,'id'));return db['sequelize'][_0x095e('0x3d')](_0x54bd5d[_0x095e('0x99')](),_0x1e9eeb)[_0x095e('0x29')](function(_0x3fd187){var _0x5ecf72=_[_0x095e('0xb1')](_0x3fd187,_0x095e('0xb2'));var _0x54188a=[];_0x4b45c4['forEach'](function(_0x8203e2){_0x54188a[_0x095e('0x35')](updateSmsInteraction(_0x8203e2,_0x3330ba,_0x5ecf72));});return BPromise[_0x095e('0xb3')](_0x54188a);});});})[_0x095e('0x29')](function(_0x443c00){_0x499f75['rows']=_0x443c00;return _0x499f75;})['then'](respondWithFilteredResult(_0x39e8c1,_0x1b9c85))[_0x095e('0x36')](handleError(_0x39e8c1,null));};exports[_0x095e('0xb4')]=function(_0xb04d58,_0x19209b){var _0x1d185e={'raw':![],'where':{'id':_0xb04d58[_0x095e('0xb5')]['id']}},_0x4b25e1={};_0x4b25e1[_0x095e('0x3c')]=_['keys'](db[_0x095e('0x39')][_0x095e('0x3a')]);_0x4b25e1[_0x095e('0x3d')]=_[_0x095e('0x3e')](_0xb04d58[_0x095e('0x3d')]);_0x4b25e1[_0x095e('0x3f')]=_['intersection'](_0x4b25e1['model'],_0x4b25e1['query']);_0x1d185e[_0x095e('0x40')]=_[_0x095e('0x41')](_0x4b25e1[_0x095e('0x3c')],qs[_0x095e('0x42')](_0xb04d58['query'][_0x095e('0x42')]));_0x1d185e[_0x095e('0x40')]=_0x1d185e['attributes']['length']?_0x1d185e[_0x095e('0x40')]:_0x4b25e1[_0x095e('0x3c')];if(_0xb04d58[_0x095e('0x3d')][_0x095e('0xb6')]){_0x1d185e['include']=[{'all':!![]}];}_0x1d185e=_[_0x095e('0x9a')]({},_0x1d185e,_0xb04d58[_0x095e('0xb7')]);return db[_0x095e('0x39')]['find'](_0x1d185e)[_0x095e('0x29')](handleEntityNotFound(_0x19209b,null))['then'](respondWithResult(_0x19209b,null))['catch'](handleError(_0x19209b,null));};exports['create']=function(_0x57e347,_0x1490ab){return db[_0x095e('0x39')]['create'](_0x57e347[_0x095e('0x6f')],{})[_0x095e('0x29')](respondWithResult(_0x1490ab,0xc9))['catch'](handleError(_0x1490ab,null));};exports[_0x095e('0x28')]=function(_0xdd37ca,_0xccf5b7){if(_0xdd37ca[_0x095e('0x6f')]['id']){delete _0xdd37ca[_0x095e('0x6f')]['id'];}return db[_0x095e('0x39')][_0x095e('0x5d')]({'where':{'id':_0xdd37ca['params']['id']}})[_0x095e('0x29')](handleEntityNotFound(_0xccf5b7,null))['then'](saveUpdates(_0xdd37ca[_0x095e('0x6f')],null))[_0x095e('0x29')](respondWithResult(_0xccf5b7,null))[_0x095e('0x36')](handleError(_0xccf5b7,null));};exports['destroy']=function(_0x28210c,_0x1a98ca){return db[_0x095e('0x39')][_0x095e('0x5d')]({'where':{'id':_0x28210c[_0x095e('0xb5')]['id']}})[_0x095e('0x29')](handleEntityNotFound(_0x1a98ca,null))[_0x095e('0x29')](removeEntity(_0x1a98ca,null))[_0x095e('0x36')](handleError(_0x1a98ca,null));};exports[_0x095e('0xb8')]=function(_0x5a7af6,_0x493b2e){return db[_0x095e('0x39')][_0x095e('0xb8')]()[_0x095e('0x29')](respondWithResult(_0x493b2e,null))[_0x095e('0x36')](handleError(_0x493b2e,null));};exports[_0x095e('0xb9')]=function(_0x5f0024,_0x17fcb5,_0x31c1b0){return db['SmsMessage']['find']({'where':{'id':_0x5f0024[_0x095e('0xb5')]['id']}})[_0x095e('0x29')](handleEntityNotFound(_0x17fcb5,null))[_0x095e('0x29')](function(_0x31d609){if(_0x31d609){return _0x31d609[_0x095e('0xb9')](_0x5f0024[_0x095e('0x6f')][_0x095e('0xba')],_['omit'](_0x5f0024['body'],[_0x095e('0xba'),'id'])||{});}})[_0x095e('0x29')](respondWithResult(_0x17fcb5,null))[_0x095e('0x36')](handleError(_0x17fcb5,null));};exports['getMessages']=function(_0x4f703e,_0x547ff8,_0x96c149){var _0x3e98c4={'raw':![],'where':{}};var _0x32c619={};var _0x1bad1f={'count':0x0,'rows':[]};return db[_0x095e('0x39')][_0x095e('0xbb')]({'where':{'id':_0x4f703e[_0x095e('0xb5')]['id']}})[_0x095e('0x29')](handleEntityNotFound(_0x547ff8,null))[_0x095e('0x29')](function(_0x12f2d1){if(_0x12f2d1){_0x32c619['model']=_[_0x095e('0x3e')](db[_0x095e('0xbc')][_0x095e('0x3a')]);_0x32c619['query']=_[_0x095e('0x3e')](_0x4f703e[_0x095e('0x3d')]);_0x32c619[_0x095e('0x3f')]=_['intersection'](_0x32c619[_0x095e('0x3c')],_0x32c619[_0x095e('0x3d')]);_0x3e98c4['attributes']=_['intersection'](_0x32c619[_0x095e('0x3c')],qs[_0x095e('0x42')](_0x4f703e[_0x095e('0x3d')]['fields']));_0x3e98c4[_0x095e('0x40')]=_0x3e98c4[_0x095e('0x40')][_0x095e('0x5c')]?_0x3e98c4[_0x095e('0x40')]:_0x32c619[_0x095e('0x3c')];if(!_0x4f703e[_0x095e('0x3d')][_0x095e('0x43')](_0x095e('0xbd'))){_0x3e98c4[_0x095e('0x21')]=qs[_0x095e('0x21')](_0x4f703e[_0x095e('0x3d')][_0x095e('0x21')]);_0x3e98c4[_0x095e('0x1f')]=qs[_0x095e('0x1f')](_0x4f703e['query']['offset']);}_0x3e98c4['order']=qs[_0x095e('0x44')](_0x4f703e[_0x095e('0x3d')]['sort']);_0x3e98c4['where']=qs[_0x095e('0x3f')](_[_0x095e('0x45')](_0x4f703e[_0x095e('0x3d')],_0x32c619[_0x095e('0x3f')]));_0x3e98c4[_0x095e('0x77')][_0x095e('0xb2')]=_0x12f2d1['id'];if(_0x4f703e['query'][_0x095e('0x81')]){_0x3e98c4[_0x095e('0x77')]=_[_0x095e('0x9a')](_0x3e98c4['where'],{'$or':_[_0x095e('0x38')](_0x3e98c4[_0x095e('0x40')],function(_0x5ee16a){var _0x33cb8b={};_0x33cb8b[_0x5ee16a]={'$like':'%'+_0x4f703e['query'][_0x095e('0x81')]+'%'};return _0x33cb8b;})});}if(_0x4f703e[_0x095e('0x3d')]['$gte']){var _0xb70190=_0x4f703e[_0x095e('0x3d')][_0x095e('0x75')][_0x095e('0x33')](',');var _0x211183={};_0x211183[_0xb70190[0x0]]={'$gte':moment(_0xb70190[0x1])[_0x095e('0xbe')](_0x095e('0xbf'))};_0x3e98c4[_0x095e('0x77')]=_[_0x095e('0x9a')](_0x3e98c4[_0x095e('0x77')],_0x211183);}_0x3e98c4=_[_0x095e('0x9a')]({},_0x3e98c4,_0x4f703e[_0x095e('0xb7')]);return db[_0x095e('0xbc')][_0x095e('0x22')]({'where':_0x3e98c4[_0x095e('0x77')]})['then'](function(_0x1c9e34){_0x1bad1f[_0x095e('0x22')]=_0x1c9e34;if(_0x4f703e[_0x095e('0x3d')][_0x095e('0xb6')]){_0x3e98c4[_0x095e('0xc0')]=[{'all':!![]}];}return db[_0x095e('0xbc')]['findAll'](_0x3e98c4);})['then'](function(_0x23442c){_0x1bad1f['rows']=_0x23442c;return _0x1bad1f;});}})[_0x095e('0x29')](respondWithFilteredResult(_0x547ff8,_0x3e98c4))['catch'](handleError(_0x547ff8,null));};exports[_0x095e('0xc1')]=function(_0x552c1,_0x118c3b,_0x5f2b34){return db['SmsInteraction'][_0x095e('0x5d')]({'where':{'id':_0x552c1[_0x095e('0xb5')]['id']}})[_0x095e('0x29')](handleEntityNotFound(_0x118c3b,null))[_0x095e('0x29')](function(_0x3f7e62){if(_0x3f7e62){return _0x3f7e62['setTags'](_0x552c1['body'][_0x095e('0xba')],_[_0x095e('0xc2')](_0x552c1['body'],[_0x095e('0xba'),'id'])||{})[_0x095e('0xc3')](function(){return db[_0x095e('0x6a')][_0x095e('0xc4')]({'attributes':['id',_0x095e('0x2e'),_0x095e('0xc5')],'where':{'id':_0x552c1['body']['ids']}});})['then'](function(_0x1223b5){socket[_0x095e('0xc6')](_0x095e('0xc7'),{'id':Number(_0x552c1[_0x095e('0xb5')]['id']),'tags':_0x1223b5||[]});return{'id':Number(_0x552c1[_0x095e('0xb5')]['id']),'tags':_0x1223b5||[]};});}})[_0x095e('0x29')](respondWithResult(_0x118c3b,null))[_0x095e('0x36')](handleError(_0x118c3b,null));};exports[_0x095e('0xc8')]=function(_0x230bb0,_0x34b0c8,_0x3a73a6){return db['SmsInteraction'][_0x095e('0x5d')]({'where':{'id':_0x230bb0[_0x095e('0xb5')]['id']}})['then'](handleEntityNotFound(_0x34b0c8,null))[_0x095e('0x29')](function(_0x13ad59){if(_0x13ad59){return _0x13ad59[_0x095e('0xc8')](_0x230bb0['query'][_0x095e('0xba')]);}})[_0x095e('0x29')](respondWithStatusCode(_0x34b0c8,null))[_0x095e('0x36')](handleError(_0x34b0c8,null));};exports[_0x095e('0xc9')]=function(_0x186288,_0x9f16f5){var _0x4d45c5=moment()[_0x095e('0xca')]()[_0x095e('0x99')]();var _0x5de19e=path['join'](config[_0x095e('0xcb')],'server',_0x095e('0xcc'),_0x095e('0xcd'));var _0x3c1e92=path[_0x095e('0xce')](config[_0x095e('0xcb')],_0x095e('0xcf'),_0x095e('0xcc'),_0x095e('0xd0'));var _0x25b3e8=path[_0x095e('0xce')](_0x5de19e,_0x4d45c5);var _0x5e3683=util[_0x095e('0xbe')](_0x095e('0xd1'),_0x186288[_0x095e('0xb5')]['id'],_0x4d45c5);var _0x549188=path['join'](_0x5de19e,_0x5e3683);var _0x267e27=[];_0x267e27[_0x095e('0x35')]({'model':db[_0x095e('0x6c')],'as':'User','attributes':['id',_0x095e('0x30')],'raw':!![]});_0x267e27['push']({'model':db[_0x095e('0xd2')],'as':_0x095e('0x62'),'attributes':['id','firstName',_0x095e('0xd3')],'raw':!![]});var _0x2c13a5=[{'model':db[_0x095e('0xbc')],'as':_0x095e('0xd4'),'attributes':['id','body',_0x095e('0xd5'),_0x095e('0xd6'),_0x095e('0xd7'),'read'],'include':_0x267e27}];_0x2c13a5[_0x095e('0x35')]({'model':db[_0x095e('0xd8')],'as':_0x095e('0xd9'),'attributes':['id',_0x095e('0x2e')]});_0x2c13a5['push']({'model':db[_0x095e('0x6c')],'as':_0x095e('0xda'),'attributes':['id','fullname']});return db['SmsInteraction'][_0x095e('0x5d')]({'where':{'id':_0x186288['params']['id']},'include':_0x2c13a5})[_0x095e('0x29')](handleEntityNotFound(_0x9f16f5,null))['then'](function(_0x4e2ecb){if(_0x4e2ecb){var _0x381a5d=_0x4e2ecb[_0x095e('0xdb')]({'plain':!![]});fs[_0x095e('0xdc')](_0x25b3e8);var _0x518881={'channel':_0x095e('0xdd'),'account':_0x381a5d[_0x095e('0xd9')][_0x095e('0x2e')],'agent':_0x381a5d[_0x095e('0xda')]?_0x381a5d['Owner']['fullname']:_0x095e('0xde'),'createdAt':moment(_0x381a5d[_0x095e('0xd5')])[_0x095e('0xbe')](_0x095e('0xbf'))['toString'](),'closedAt':_0x381a5d['closed']?moment(_0x381a5d[_0x095e('0xdf')])['format'](_0x095e('0xbf'))[_0x095e('0x99')]():'','disposition':_0x381a5d[_0x095e('0xe0')],'messages':_(_0x381a5d['Messages'])[_0x095e('0x81')]({'secret':![]})[_0x095e('0x38')](function(_0xe84c7c){return{'date':moment(_0xe84c7c[_0x095e('0xd5')])[_0x095e('0xbe')](_0x095e('0xbf'))[_0x095e('0x99')](),'sender':_0xe84c7c[_0x095e('0xd6')]===_0x095e('0xe1')?_0xe84c7c[_0x095e('0x6c')]?_0xe84c7c[_0x095e('0x6c')]['fullname']:_0x095e('0xe2'):_0xe84c7c[_0x095e('0x62')][_0x095e('0xe3')]+(_0xe84c7c[_0x095e('0x62')][_0x095e('0xd3')]?'\x20'+_0xe84c7c['Contact'][_0x095e('0xd3')]:''),'body':_0xe84c7c[_0x095e('0x6f')],'direction':_0xe84c7c[_0x095e('0xd6')]===_0x095e('0xe1')?'A':'C','secret':_0xe84c7c[_0x095e('0xd7')],'read':_0xe84c7c[_0x095e('0x7b')]};})[_0x095e('0x5e')]()};return ejs['renderFile'](path['join'](config[_0x095e('0xcb')],'server',_0x095e('0xe4'),_0x095e('0xe5')),{'interaction':_0x518881})[_0x095e('0x29')](function(_0x39d498){var _0x2930c5=path[_0x095e('0xce')](_0x25b3e8,'transcript-'+_0x381a5d['id']+'-'+_0x4d45c5+_0x095e('0xe6'));var _0x1ad7f9={'path':_0x2930c5,'channel':'Sms','interactionId':_0x381a5d['id']};return pdf[_0x095e('0xe7')](_0x39d498,_0x1ad7f9);})[_0x095e('0x29')](function(){return new BPromise(function(_0x2fa5cc,_0x553105){zipdir(_0x25b3e8,{'saveTo':_0x549188},function(_0x46a180,_0x5658e6){if(_0x46a180)return _0x553105(_0x46a180);return _0x2fa5cc(_0x5658e6);});})[_0x095e('0x29')](function(){return new BPromise(function(_0x16f297,_0x338d4b){rimraf(_0x25b3e8,function(_0x312370){if(_0x312370)_0x338d4b(_0x312370);return _0x16f297();});});})[_0x095e('0x29')](function(){return _0x9f16f5['download'](_0x549188,_0x5e3683,function(_0x1fd962){if(_0x1fd962){console[_0x095e('0xe8')]('err',_0x1fd962);}else{fs['unlinkSync'](_0x549188);}});});});}else{return _0x9f16f5['sendStatus'](0xc8);}})[_0x095e('0x36')](handleError(_0x9f16f5,null));}; \ No newline at end of file +var _0xaeff=['SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','parse','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','isEmpty','i.SmsAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','SmsInteractionId','all','rows','include','options','create','params','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','spread','color','emit','smsInteractionTags:save','removeTags','download','unix','join','root','files','tmp','server','attachments','User','CmContact','lastName','Messages','secret','SmsAccount','Account','Owner','get','N.A.','disposition','direction','System','out','renderFile','downloadInteraction.ejs','transcript-','.pdf','Sms','createPdfFromHTML','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','catch','index','SmsInteraction','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','select','field','from','tools_tags','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','users','u.id\x20=\x20ui.UserId','sms_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','length','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','type','text','start','Tag','forEach','union','UserId','body','some'];(function(_0x23c875,_0x33e9e7){var _0x46b9c6=function(_0x1b50d1){while(--_0x1b50d1){_0x23c875['push'](_0x23c875['shift']());}};_0x46b9c6(++_0x33e9e7);}(_0xaeff,0x71));var _0xfaef=function(_0xe63d92,_0x11f8b0){_0xe63d92=_0xe63d92-0x0;var _0x53eb24=_0xaeff[_0xe63d92];return _0x53eb24;};'use strict';var emlformat=require(_0xfaef('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfaef('0x1'));var jsonpatch=require(_0xfaef('0x2'));var rp=require(_0xfaef('0x3'));var moment=require(_0xfaef('0x4'));var BPromise=require(_0xfaef('0x5'));var Mustache=require(_0xfaef('0x6'));var util=require(_0xfaef('0x7'));var path=require(_0xfaef('0x8'));var sox=require('sox');var csv=require(_0xfaef('0x9'));var ejs=require(_0xfaef('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfaef('0xb'));var squel=require(_0xfaef('0xc'));var crypto=require(_0xfaef('0xd'));var jsforce=require(_0xfaef('0xe'));var deskjs=require(_0xfaef('0xf'));var toCsv=require(_0xfaef('0x9'));var querystring=require(_0xfaef('0x10'));var Papa=require(_0xfaef('0x11'));var Redis=require(_0xfaef('0x12'));var authService=require(_0xfaef('0x13'));var qs=require(_0xfaef('0x14'));var as=require(_0xfaef('0x15'));var pdf=require(_0xfaef('0x16'));var hardwareService=require(_0xfaef('0x17'));var logger=require(_0xfaef('0x18'))(_0xfaef('0x19'));var utils=require('../../config/utils');var config=require(_0xfaef('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xfaef('0x1b')](config[_0xfaef('0x1c')],{'host':_0xfaef('0x1d'),'port':0x18eb});var socket=require(_0xfaef('0x1e'))(new Redis(config[_0xfaef('0x1c')]));require(_0xfaef('0x1f'))[_0xfaef('0x20')](socket);function respondWithStatusCode(_0x3123fd,_0x7fb9e9){_0x7fb9e9=_0x7fb9e9||0xcc;return function(_0x4d7b2a){if(_0x4d7b2a){return _0x3123fd[_0xfaef('0x21')](_0x7fb9e9);}return _0x3123fd[_0xfaef('0x22')](_0x7fb9e9)['end']();};}function respondWithResult(_0x3deccc,_0x533edb){_0x533edb=_0x533edb||0xc8;return function(_0x2783fd){if(_0x2783fd){return _0x3deccc[_0xfaef('0x22')](_0x533edb)[_0xfaef('0x23')](_0x2783fd);}};}function respondWithFilteredResult(_0x27067a,_0x4d40e5){return function(_0xffb8b){if(_0xffb8b){var _0x342c3d=typeof _0x4d40e5[_0xfaef('0x24')]===_0xfaef('0x25')&&typeof _0x4d40e5[_0xfaef('0x26')]===_0xfaef('0x25');var _0x557d18=_0xffb8b[_0xfaef('0x27')];var _0x634600=_0x342c3d?0x0:_0x4d40e5[_0xfaef('0x24')];var _0x2dd87a=_0x342c3d?_0xffb8b[_0xfaef('0x27')]:_0x4d40e5[_0xfaef('0x24')]+_0x4d40e5['limit'];var _0x270088;if(_0x2dd87a>=_0x557d18){_0x2dd87a=_0x557d18;_0x270088=0xc8;}else{_0x270088=0xce;}_0x27067a[_0xfaef('0x22')](_0x270088);return _0x27067a[_0xfaef('0x28')](_0xfaef('0x29'),_0x634600+'-'+_0x2dd87a+'/'+_0x557d18)['json'](_0xffb8b);}return null;};}function patchUpdates(_0x293f4f){return function(_0x19daa3){try{jsonpatch[_0xfaef('0x2a')](_0x19daa3,_0x293f4f,!![]);}catch(_0x373cda){return BPromise[_0xfaef('0x2b')](_0x373cda);}return _0x19daa3[_0xfaef('0x2c')]();};}function saveUpdates(_0x3a4563,_0x2ca746){return function(_0x2e7055){if(_0x2e7055){return _0x2e7055[_0xfaef('0x2d')](_0x3a4563)[_0xfaef('0x2e')](function(_0x910ce2){return _0x910ce2;});}return null;};}function removeEntity(_0x756844,_0x12df33){return function(_0x52eefc){if(_0x52eefc){return _0x52eefc[_0xfaef('0x2f')]()[_0xfaef('0x2e')](function(){_0x756844['status'](0xcc)[_0xfaef('0x30')]();});}};}function handleEntityNotFound(_0x30a3c3,_0x54e841){return function(_0x38da32){if(!_0x38da32){_0x30a3c3['sendStatus'](0x194);}return _0x38da32;};}function handleError(_0x40fdbb,_0x3f5d5c){_0x3f5d5c=_0x3f5d5c||0x1f4;return function(_0xd6a1df){logger[_0xfaef('0x31')](_0xd6a1df[_0xfaef('0x32')]);if(_0xd6a1df['name']){delete _0xd6a1df[_0xfaef('0x33')];}_0x40fdbb[_0xfaef('0x22')](_0x3f5d5c)[_0xfaef('0x34')](_0xd6a1df);};}function getInteractionUsers(_0x3516f7,_0x2b14aa){return new BPromise(function(_0x40c235,_0x4bc4fb){try{if(_0x2b14aa[_0x3516f7['id']]){_0x3516f7[_0xfaef('0x35')]=_[_0xfaef('0x36')](_0x2b14aa[_0x3516f7['id']],function(_0x5e9750){return{'id':_0x5e9750['id'],'fullname':_0x5e9750[_0xfaef('0x37')]};});}}catch(_0xa6fdee){_0x4bc4fb(_0xa6fdee);}_0x40c235(_0x3516f7);});}function getInteractionTags(_0x55e00c,_0x37452e){return new BPromise(function(_0x5a60cb,_0x4a3788){try{if(_0x55e00c[_0xfaef('0x38')]){_0x55e00c[_0xfaef('0x39')]=[];_0x55e00c[_0xfaef('0x38')][_0xfaef('0x3a')](',')['forEach'](function(_0xa4063c){_0x55e00c[_0xfaef('0x39')][_0xfaef('0x3b')](_0x37452e[_0xa4063c]);});}delete _0x55e00c[_0xfaef('0x38')];}catch(_0x346153){_0x4a3788(_0x346153);}_0x5a60cb(_0x55e00c);});}function updateSmsInteraction(_0x437b7b,_0x1bb4f6,_0x48bb14){return new BPromise(function(_0x14bb6c,_0x171afc){return getInteractionUsers(_0x437b7b,_0x48bb14)['then'](function(_0x4f2f11){return getInteractionTags(_0x4f2f11,_0x1bb4f6);})[_0xfaef('0x2e')](function(_0x1b8821){_0x14bb6c(_0x1b8821);})[_0xfaef('0x3c')](function(_0x5e6ce1){_0x171afc(_0x5e6ce1);});});}exports[_0xfaef('0x3d')]=function(_0x5c2c16,_0x36ad37){var _0x1e2704={},_0x213c28={},_0x422387={'count':0x0,'rows':[]};var _0x50902a=_[_0xfaef('0x36')](db[_0xfaef('0x3e')][_0xfaef('0x3f')],function(_0x277fb8){return{'name':_0x277fb8[_0xfaef('0x40')],'type':_0x277fb8['type'][_0xfaef('0x41')]};});_0x213c28['model']=_[_0xfaef('0x36')](_0x50902a,_0xfaef('0x33'));_0x213c28[_0xfaef('0x42')]=_[_0xfaef('0x43')](_0x5c2c16[_0xfaef('0x42')]);_0x213c28[_0xfaef('0x44')]=_['intersection'](_0x213c28[_0xfaef('0x45')],_0x213c28[_0xfaef('0x42')]);_0x1e2704[_0xfaef('0x46')]=_[_0xfaef('0x47')](_0x213c28[_0xfaef('0x45')],qs[_0xfaef('0x48')](_0x5c2c16[_0xfaef('0x42')]['fields']));_0x1e2704[_0xfaef('0x46')]=_0x1e2704[_0xfaef('0x46')]['length']?_0x1e2704[_0xfaef('0x46')]:_0x213c28[_0xfaef('0x45')];if(!_0x5c2c16[_0xfaef('0x42')][_0xfaef('0x49')](_0xfaef('0x4a'))){_0x1e2704[_0xfaef('0x26')]=qs['limit'](_0x5c2c16[_0xfaef('0x42')]['limit']);_0x1e2704[_0xfaef('0x24')]=qs['offset'](_0x5c2c16['query'][_0xfaef('0x24')]);}_0x1e2704[_0xfaef('0x4b')]=qs[_0xfaef('0x4c')](_0x5c2c16[_0xfaef('0x42')][_0xfaef('0x4c')]);_0x1e2704['where']=qs[_0xfaef('0x44')](_[_0xfaef('0x4d')](_0x5c2c16[_0xfaef('0x42')],_0x213c28[_0xfaef('0x44')]),_0x50902a);var _0x2d1566=[];var _0x105cdf=squel[_0xfaef('0x4e')]()[_0xfaef('0x4f')]('id')['field'](_0xfaef('0x33'))['field']('color')[_0xfaef('0x50')](_0xfaef('0x51'));var _0x557798=squel[_0xfaef('0x4e')]()['field']('u.id')[_0xfaef('0x4f')](_0xfaef('0x52'))[_0xfaef('0x4f')](_0xfaef('0x53'))['from'](_0xfaef('0x54'),'ui')['left_join'](_0xfaef('0x55'),'u',_0xfaef('0x56'));var _0xde56e2=squel[_0xfaef('0x4e')]()[_0xfaef('0x50')](_0xfaef('0x57'),'i')[_0xfaef('0x58')](_0xfaef('0x59'),'c',_0xfaef('0x5a'))[_0xfaef('0x58')](_0xfaef('0x55'),'o',_0xfaef('0x5b'))[_0xfaef('0x58')](_0xfaef('0x5c'),'a',_0xfaef('0x5d'))['left_join'](_0xfaef('0x5e'),'me',_0xfaef('0x5f'))[_0xfaef('0x58')](_0xfaef('0x60'),'it','it.SmsInteractionId\x20=\x20i.id')['left_join'](_0xfaef('0x51'),'t',_0xfaef('0x61'));var _0x394763=squel[_0xfaef('0x62')]();var _0x1b58cb=[];var _0x28dc42=squel[_0xfaef('0x62')]();var _0x38fe07;if(_0x5c2c16['query'][_0xfaef('0x63')]){_0x38fe07=as[_0xfaef('0x64')](_0x5c2c16['query']['search']);var _0x2dc33c=_0x38fe07['sqlOperator'];for(var _0x3a4929=0x0;_0x3a4929<_0x38fe07[_0xfaef('0x65')][_0xfaef('0x66')];_0x3a4929++){var _0x238722=_0x38fe07[_0xfaef('0x65')][_0x3a4929];var _0xfa5eb4='i';var _0x681be5=_['find'](_0x50902a,[_0xfaef('0x33'),_0x238722[_0xfaef('0x4f')]]);if(!_0x681be5){switch(_0x238722[_0xfaef('0x4f')]){case _0xfaef('0x67'):if(_0x238722[_0xfaef('0x68')]==0x1){_0xde56e2[_0xfaef('0x69')]('`'+_0x238722['field']+_0xfaef('0x6a'));}else{_0xde56e2[_0xfaef('0x69')]('`'+_0x238722[_0xfaef('0x4f')]+_0xfaef('0x6b'));}break;case _0xfaef('0x6c'):if(_0x238722['operator']===_0xfaef('0x6d')){if(_0x238722[_0xfaef('0x68')][_0xfaef('0x3a')]('\x20')['length']>0x1){_0x394763[_0x2dc33c]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xfaef('0x6e')](_0x238722[_0xfaef('0x68')]),null);}else{var _0x1592c4='%'+_0x238722[_0xfaef('0x68')]+'%';_0x394763[_0x2dc33c](_0xfaef('0x6f'),_0x1592c4,_0x1592c4,_0x1592c4);}}else{_0x681be5=_[_0xfaef('0x70')](_0x50902a,[_0xfaef('0x33'),_0xfaef('0x71')]);_0x238722[_0xfaef('0x4f')]=_0xfaef('0x71');_0x359010=as[_0xfaef('0x72')](_0xfa5eb4,_0x681be5[_0xfaef('0x73')],_0x238722);_0x394763[_0x2dc33c](_0x359010[_0xfaef('0x74')],_0x359010['value'][_0xfaef('0x75')],_0x359010[_0xfaef('0x68')][_0xfaef('0x30')]);}break;case _0xfaef('0x76'):var _0xcdf1d0=_0x238722['value']['split'](',')[_0xfaef('0x36')](function(_0xa57f6e){return Number(_0xa57f6e);});_0xcdf1d0[_0xfaef('0x77')](function(_0x28f906){_0x28dc42['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x28f906+',%');});_0x1b58cb=_[_0xfaef('0x78')](_0x1b58cb,_0xcdf1d0);break;case'User':if(_0x238722['operator']===_0xfaef('0x6d')){_0x394763[_0x2dc33c]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x238722[_0xfaef('0x68')]+'%',null);}else{_0x681be5=_[_0xfaef('0x70')](_0x50902a,[_0xfaef('0x33'),_0xfaef('0x79')]);_0x238722[_0xfaef('0x4f')]=_0xfaef('0x79');_0x359010=as[_0xfaef('0x72')](_0xfa5eb4,_0x681be5[_0xfaef('0x73')],_0x238722);_0x394763[_0x2dc33c](_0x359010[_0xfaef('0x74')],_0x359010['value'][_0xfaef('0x75')],_0x359010['value'][_0xfaef('0x30')]);}break;case _0xfaef('0x7a'):_0x359010=as[_0xfaef('0x72')]('me',null,_0x238722);_0x394763[_0x2dc33c](_0x359010[_0xfaef('0x74')],_0x359010[_0xfaef('0x68')][_0xfaef('0x75')],_0x359010['value'][_0xfaef('0x30')]);break;}}else{var _0x359010=as[_0xfaef('0x72')](_0xfa5eb4,_0x681be5['type'],_0x238722);_0x394763[_0x2dc33c](_0x359010['text'],_0x359010[_0xfaef('0x68')][_0xfaef('0x75')],_0x359010[_0xfaef('0x68')]['end']);}}}else{var _0x3c05c4=_(_0x5c2c16[_0xfaef('0x42')])['keys']()[_0xfaef('0x36')](function(_0x1b75dc){return _[_0xfaef('0x7b')](_0x50902a,[_0xfaef('0x33'),_0x1b75dc])?_0x1b75dc:undefined;})['compact']()[_0xfaef('0x68')]();if(!_['isEmpty'](_0x3c05c4)){_0x3c05c4[_0xfaef('0x77')](function(_0x2fdbb1){if(_0x2fdbb1===_0xfaef('0x7c')){_0xde56e2['where'](_0xfaef('0x7d'),[]['concat'](_0x5c2c16['query'][_0x2fdbb1]));}else if(_0x2fdbb1===_0xfaef('0x7e')){var _0x5c41c7=JSON[_0xfaef('0x7f')](_0x5c2c16[_0xfaef('0x42')][_0x2fdbb1])['$gte'];var _0x51b11f=JSON[_0xfaef('0x7f')](_0x5c2c16[_0xfaef('0x42')][_0x2fdbb1])[_0xfaef('0x80')];_0xde56e2[_0xfaef('0x81')](_0xfaef('0x82'),_0x5c41c7,_0x51b11f);}else{if(_0x5c2c16[_0xfaef('0x42')][_0x2fdbb1]===_0xfaef('0x83')){_0xde56e2[_0xfaef('0x81')]('i.'+_0x2fdbb1+_0xfaef('0x84'));}else{_0xde56e2[_0xfaef('0x81')]('i.'+_0x2fdbb1+'\x20=\x20?',_0x5c2c16[_0xfaef('0x42')][_0x2fdbb1]);}}});}if(_0x5c2c16[_0xfaef('0x42')]['read']){if(_0x5c2c16[_0xfaef('0x42')][_0xfaef('0x85')]==0x1){_0xde56e2[_0xfaef('0x69')]('`unreadMessages`\x20=\x200');}else{_0xde56e2[_0xfaef('0x69')](_0xfaef('0x86'));}}if(_0x5c2c16[_0xfaef('0x42')]['tag']){_0x1b58cb=_['isArray'](_0x5c2c16[_0xfaef('0x42')][_0xfaef('0x87')])?_0x5c2c16[_0xfaef('0x42')][_0xfaef('0x87')]:new Array(_0x5c2c16[_0xfaef('0x42')][_0xfaef('0x87')]);_0x1b58cb['forEach'](function(_0x5e2785){_0x28dc42['or'](_0xfaef('0x88'),'%,'+_0x5e2785+',%');});}if(_0x5c2c16[_0xfaef('0x42')][_0xfaef('0x89')]){var _0x46267f=_0x5c2c16[_0xfaef('0x42')][_0xfaef('0x89')]['replace']('\x5c','\x5c\x5c')[_0xfaef('0x8a')](/'/g,'\x27\x27');if(qs[_0xfaef('0x8b')](_0x46267f)){_0x394763['or'](_0xfaef('0x8c'),_0x46267f+'%')['or']('i.phone\x20LIKE\x20?',_0x46267f+'%');}else{_0x394763['or'](_0xfaef('0x8d'),qs[_0xfaef('0x6e')](_0x46267f))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x46267f+'%');}}}_0xde56e2[_0xfaef('0x81')](_0x394763);_0xde56e2[_0xfaef('0x8e')](_0xfaef('0x8f'));var _0x41159b={'type':db[_0xfaef('0x90')][_0xfaef('0x91')][_0xfaef('0x92')],'raw':!![]};var _0x254b45=_0xde56e2[_0xfaef('0x93')]();_0x254b45[_0xfaef('0x4f')](_0xfaef('0x8f'));_0x254b45[_0xfaef('0x4f')](_0xfaef('0x94'),'unreadMessages');if(_0x1e2704[_0xfaef('0x4b')]){_0x1e2704['order']['forEach'](function(_0x8d5120){var _0x2871b7=_0x8d5120[0x0]===_0xfaef('0x95')?_0x8d5120[0x0]:'i.'+_0x8d5120[0x0];_0xde56e2[_0xfaef('0x4b')](_0x2871b7,_0x8d5120[0x1]===_0xfaef('0x96')?![]:!![]);});}if(!_['isEmpty'](_0x1b58cb)){_0xde56e2['having'](_0x28dc42);_0x254b45['where'](_0xfaef('0x97'),_0x1b58cb);}BPromise[_0xfaef('0x98')]()[_0xfaef('0x2e')](function(){if(!_0x38fe07){if(_0x5c2c16[_0xfaef('0x42')][_0xfaef('0x7c')])return;_0x254b45['where'](_0xfaef('0x99'));_0xde56e2['where'](_0xfaef('0x99'));return;}if(_0x5c2c16[_0xfaef('0x9a')][_0xfaef('0x9b')]!==_0xfaef('0x9c'))return;return _0x5c2c16[_0xfaef('0x9a')][_0xfaef('0x9d')]({'attributes':['id'],'raw':!![]})[_0xfaef('0x2e')](function(_0x288f55){if(_[_0xfaef('0x9e')](_0x288f55)){_0x254b45[_0xfaef('0x81')](_0xfaef('0x9f'));_0xde56e2[_0xfaef('0x81')](_0xfaef('0x9f'));}else{_0x254b45[_0xfaef('0x81')](_0xfaef('0x7d'),_['map'](_0x288f55,'id'));_0xde56e2[_0xfaef('0x81')](_0xfaef('0x7d'),_[_0xfaef('0x36')](_0x288f55,'id'));}});})[_0xfaef('0x2e')](function(){if(_0x5c2c16['user'][_0xfaef('0x9b')]===_0xfaef('0x9c')&&!_0x38fe07&&!_0x5c2c16[_0xfaef('0x42')][_0xfaef('0x7c')])return[];return db['sequelize']['query'](_0x254b45[_0xfaef('0xa0')](),_0x41159b);})[_0xfaef('0x2e')](function(_0x334c83){_0x422387['count']=_0x334c83[_0xfaef('0x66')];if(_0x422387[_0xfaef('0x27')]===0x0)return[];return db[_0xfaef('0xa1')][_0xfaef('0x42')](_0x105cdf[_0xfaef('0xa0')](),_0x41159b)[_0xfaef('0x2e')](function(_0x2c4ec0){_0x2d1566=_[_0xfaef('0xa2')](_0x2c4ec0,'id');_0x41159b=_[_0xfaef('0xa3')](_0x41159b,{'model':db[_0xfaef('0x3e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5c2c16['query'][_0xfaef('0x48')]){_0x1e2704[_0xfaef('0x46')][_0xfaef('0x77')](function(_0x1dbe71){_0xde56e2['field']('i.'+_0x1dbe71);});}else{_0xde56e2['field'](_0xfaef('0x94'),_0xfaef('0x67'));_0xde56e2[_0xfaef('0x4f')]('a.key',_0xfaef('0xa4'));_0xde56e2[_0xfaef('0x4f')]('a.mandatoryDisposition',_0xfaef('0xa5'));_0xde56e2[_0xfaef('0x4f')](_0xfaef('0xa6'),_0xfaef('0x95'));_0xde56e2[_0xfaef('0x4f')]('i.*');_0xde56e2['field']('c.firstName',_0xfaef('0xa7'));_0xde56e2[_0xfaef('0x4f')](_0xfaef('0xa8'),_0xfaef('0xa9'));_0xde56e2['field'](_0xfaef('0xaa'),_0xfaef('0xab'));_0xde56e2[_0xfaef('0x4f')](_0xfaef('0xac'),'Contact.phone');_0xde56e2['field'](_0xfaef('0xad'),_0xfaef('0xae'));_0xde56e2[_0xfaef('0x4f')](_0xfaef('0xaf'),_0xfaef('0xb0'));_0xde56e2[_0xfaef('0x4f')](_0xfaef('0xb1'),'Owner.fullname');_0xde56e2[_0xfaef('0x4f')](_0xfaef('0xb2'),_0xfaef('0xb3'));_0xde56e2[_0xfaef('0x4f')](_0xfaef('0xb4'),_0xfaef('0x38'));}if(_0x1e2704[_0xfaef('0x26')])_0xde56e2[_0xfaef('0x26')](_0x1e2704['limit']);if(_0x1e2704[_0xfaef('0x24')])_0xde56e2[_0xfaef('0x24')](_0x1e2704[_0xfaef('0x24')]);return db[_0xfaef('0xa1')]['query'](_0xde56e2[_0xfaef('0xa0')](),_0x41159b);})[_0xfaef('0x2e')](function(_0x3e1400){if(_0x3e1400[_0xfaef('0x66')]>0x0)_0x557798[_0xfaef('0x81')](_0xfaef('0xb5'),_[_0xfaef('0x36')](_0x3e1400,'id'));return db[_0xfaef('0xa1')][_0xfaef('0x42')](_0x557798[_0xfaef('0xa0')](),_0x41159b)[_0xfaef('0x2e')](function(_0x2671b1){var _0x4fdfb5=_['groupBy'](_0x2671b1,_0xfaef('0xb6'));var _0x121bcb=[];_0x3e1400[_0xfaef('0x77')](function(_0x226874){_0x121bcb[_0xfaef('0x3b')](updateSmsInteraction(_0x226874,_0x2d1566,_0x4fdfb5));});return BPromise[_0xfaef('0xb7')](_0x121bcb);});});})[_0xfaef('0x2e')](function(_0x298e96){_0x422387[_0xfaef('0xb8')]=_0x298e96;return _0x422387;})['then'](respondWithFilteredResult(_0x36ad37,_0x1e2704))[_0xfaef('0x3c')](handleError(_0x36ad37,null));};exports['show']=function(_0x1fa735,_0x5648b2){var _0x3e4138={'raw':![],'where':{'id':_0x1fa735['params']['id']}},_0x473731={};_0x473731[_0xfaef('0x45')]=_[_0xfaef('0x43')](db[_0xfaef('0x3e')][_0xfaef('0x3f')]);_0x473731[_0xfaef('0x42')]=_[_0xfaef('0x43')](_0x1fa735[_0xfaef('0x42')]);_0x473731[_0xfaef('0x44')]=_[_0xfaef('0x47')](_0x473731['model'],_0x473731['query']);_0x3e4138[_0xfaef('0x46')]=_[_0xfaef('0x47')](_0x473731[_0xfaef('0x45')],qs[_0xfaef('0x48')](_0x1fa735['query'][_0xfaef('0x48')]));_0x3e4138[_0xfaef('0x46')]=_0x3e4138[_0xfaef('0x46')][_0xfaef('0x66')]?_0x3e4138[_0xfaef('0x46')]:_0x473731[_0xfaef('0x45')];if(_0x1fa735['query']['includeAll']){_0x3e4138[_0xfaef('0xb9')]=[{'all':!![]}];}_0x3e4138=_[_0xfaef('0xa3')]({},_0x3e4138,_0x1fa735[_0xfaef('0xba')]);return db[_0xfaef('0x3e')][_0xfaef('0x70')](_0x3e4138)[_0xfaef('0x2e')](handleEntityNotFound(_0x5648b2,null))[_0xfaef('0x2e')](respondWithResult(_0x5648b2,null))[_0xfaef('0x3c')](handleError(_0x5648b2,null));};exports[_0xfaef('0xbb')]=function(_0x1735bb,_0x556f59){return db[_0xfaef('0x3e')]['create'](_0x1735bb['body'],{})['then'](respondWithResult(_0x556f59,0xc9))[_0xfaef('0x3c')](handleError(_0x556f59,null));};exports['update']=function(_0x566d5b,_0x5320ce){if(_0x566d5b[_0xfaef('0x7a')]['id']){delete _0x566d5b['body']['id'];}return db[_0xfaef('0x3e')]['find']({'where':{'id':_0x566d5b[_0xfaef('0xbc')]['id']}})['then'](handleEntityNotFound(_0x5320ce,null))[_0xfaef('0x2e')](saveUpdates(_0x566d5b[_0xfaef('0x7a')],null))[_0xfaef('0x2e')](respondWithResult(_0x5320ce,null))['catch'](handleError(_0x5320ce,null));};exports[_0xfaef('0x2f')]=function(_0x4912da,_0x5ce296){return db[_0xfaef('0x3e')][_0xfaef('0x70')]({'where':{'id':_0x4912da[_0xfaef('0xbc')]['id']}})['then'](handleEntityNotFound(_0x5ce296,null))[_0xfaef('0x2e')](removeEntity(_0x5ce296,null))[_0xfaef('0x3c')](handleError(_0x5ce296,null));};exports[_0xfaef('0xbd')]=function(_0x330cc6,_0x4d4ffc){return db[_0xfaef('0x3e')][_0xfaef('0xbd')]()[_0xfaef('0x2e')](respondWithResult(_0x4d4ffc,null))[_0xfaef('0x3c')](handleError(_0x4d4ffc,null));};exports[_0xfaef('0xbe')]=function(_0x1821ed,_0x241497,_0x155c06){return db[_0xfaef('0xbf')]['find']({'where':{'id':_0x1821ed[_0xfaef('0xbc')]['id']}})['then'](handleEntityNotFound(_0x241497,null))[_0xfaef('0x2e')](function(_0x12a84c){if(_0x12a84c){return _0x12a84c[_0xfaef('0xbe')](_0x1821ed['body'][_0xfaef('0xc0')],_[_0xfaef('0xc1')](_0x1821ed[_0xfaef('0x7a')],['ids','id'])||{});}})[_0xfaef('0x2e')](respondWithResult(_0x241497,null))['catch'](handleError(_0x241497,null));};exports[_0xfaef('0xc2')]=function(_0x5734bb,_0x1e75f7,_0x271901){var _0x4eb909={'raw':![],'where':{}};var _0x5ae0ad={};var _0x235e2c={'count':0x0,'rows':[]};return db[_0xfaef('0x3e')][_0xfaef('0xc3')]({'where':{'id':_0x5734bb[_0xfaef('0xbc')]['id']}})[_0xfaef('0x2e')](handleEntityNotFound(_0x1e75f7,null))[_0xfaef('0x2e')](function(_0x14b3e3){if(_0x14b3e3){_0x5ae0ad['model']=_[_0xfaef('0x43')](db[_0xfaef('0xbf')]['rawAttributes']);_0x5ae0ad[_0xfaef('0x42')]=_['keys'](_0x5734bb[_0xfaef('0x42')]);_0x5ae0ad[_0xfaef('0x44')]=_['intersection'](_0x5ae0ad['model'],_0x5ae0ad[_0xfaef('0x42')]);_0x4eb909[_0xfaef('0x46')]=_[_0xfaef('0x47')](_0x5ae0ad['model'],qs[_0xfaef('0x48')](_0x5734bb[_0xfaef('0x42')]['fields']));_0x4eb909[_0xfaef('0x46')]=_0x4eb909['attributes'][_0xfaef('0x66')]?_0x4eb909['attributes']:_0x5ae0ad['model'];if(!_0x5734bb['query']['hasOwnProperty'](_0xfaef('0x4a'))){_0x4eb909['limit']=qs[_0xfaef('0x26')](_0x5734bb[_0xfaef('0x42')]['limit']);_0x4eb909['offset']=qs[_0xfaef('0x24')](_0x5734bb[_0xfaef('0x42')][_0xfaef('0x24')]);}_0x4eb909[_0xfaef('0x4b')]=qs[_0xfaef('0x4c')](_0x5734bb[_0xfaef('0x42')][_0xfaef('0x4c')]);_0x4eb909[_0xfaef('0x81')]=qs['filters'](_[_0xfaef('0x4d')](_0x5734bb[_0xfaef('0x42')],_0x5ae0ad[_0xfaef('0x44')]));_0x4eb909[_0xfaef('0x81')][_0xfaef('0xb6')]=_0x14b3e3['id'];if(_0x5734bb[_0xfaef('0x42')]['filter']){_0x4eb909[_0xfaef('0x81')]=_['merge'](_0x4eb909[_0xfaef('0x81')],{'$or':_[_0xfaef('0x36')](_0x4eb909[_0xfaef('0x46')],function(_0x308fce){var _0xda9e09={};_0xda9e09[_0x308fce]={'$like':'%'+_0x5734bb[_0xfaef('0x42')]['filter']+'%'};return _0xda9e09;})});}if(_0x5734bb[_0xfaef('0x42')][_0xfaef('0xc4')]){var _0x291ee3=_0x5734bb['query'][_0xfaef('0xc4')][_0xfaef('0x3a')](',');var _0x31174b={};_0x31174b[_0x291ee3[0x0]]={'$gte':moment(_0x291ee3[0x1])[_0xfaef('0xc5')](_0xfaef('0xc6'))};_0x4eb909['where']=_[_0xfaef('0xa3')](_0x4eb909[_0xfaef('0x81')],_0x31174b);}_0x4eb909=_[_0xfaef('0xa3')]({},_0x4eb909,_0x5734bb[_0xfaef('0xba')]);return db[_0xfaef('0xbf')][_0xfaef('0x27')]({'where':_0x4eb909[_0xfaef('0x81')]})[_0xfaef('0x2e')](function(_0x45674c){_0x235e2c[_0xfaef('0x27')]=_0x45674c;if(_0x5734bb['query'][_0xfaef('0xc7')]){_0x4eb909[_0xfaef('0xb9')]=[{'all':!![]}];}return db[_0xfaef('0xbf')][_0xfaef('0xc8')](_0x4eb909);})['then'](function(_0x3fe8b9){_0x235e2c['rows']=_0x3fe8b9;return _0x235e2c;});}})['then'](respondWithFilteredResult(_0x1e75f7,_0x4eb909))[_0xfaef('0x3c')](handleError(_0x1e75f7,null));};exports[_0xfaef('0xc9')]=function(_0x5b6663,_0x4b3449,_0x22f314){return db[_0xfaef('0x3e')][_0xfaef('0x70')]({'where':{'id':_0x5b6663[_0xfaef('0xbc')]['id']}})['then'](handleEntityNotFound(_0x4b3449,null))['then'](function(_0x3f0c45){if(_0x3f0c45){return _0x3f0c45[_0xfaef('0xca')](_0x5b6663[_0xfaef('0x7a')]['ids'],_['omit'](_0x5b6663['body'],[_0xfaef('0xc0'),'id'])||{})[_0xfaef('0xcb')](function(){return db[_0xfaef('0x76')]['findAll']({'attributes':['id',_0xfaef('0x33'),_0xfaef('0xcc')],'where':{'id':_0x5b6663['body'][_0xfaef('0xc0')]}});})[_0xfaef('0x2e')](function(_0x41df8e){socket[_0xfaef('0xcd')](_0xfaef('0xce'),{'id':Number(_0x5b6663[_0xfaef('0xbc')]['id']),'tags':_0x41df8e||[]});return{'id':Number(_0x5b6663[_0xfaef('0xbc')]['id']),'tags':_0x41df8e||[]};});}})[_0xfaef('0x2e')](respondWithResult(_0x4b3449,null))[_0xfaef('0x3c')](handleError(_0x4b3449,null));};exports[_0xfaef('0xcf')]=function(_0x599678,_0x146690,_0x3c0f34){return db[_0xfaef('0x3e')][_0xfaef('0x70')]({'where':{'id':_0x599678[_0xfaef('0xbc')]['id']}})[_0xfaef('0x2e')](handleEntityNotFound(_0x146690,null))['then'](function(_0x515bb6){if(_0x515bb6){return _0x515bb6[_0xfaef('0xcf')](_0x599678[_0xfaef('0x42')]['ids']);}})[_0xfaef('0x2e')](respondWithStatusCode(_0x146690,null))[_0xfaef('0x3c')](handleError(_0x146690,null));};exports[_0xfaef('0xd0')]=function(_0x306e4d,_0x4b2f13){var _0x1bd751=moment()[_0xfaef('0xd1')]()[_0xfaef('0xa0')]();var _0x3594df=path[_0xfaef('0xd2')](config[_0xfaef('0xd3')],'server',_0xfaef('0xd4'),_0xfaef('0xd5'));var _0x49267e=path['join'](config[_0xfaef('0xd3')],_0xfaef('0xd6'),'files',_0xfaef('0xd7'));var _0xed9c8=path[_0xfaef('0xd2')](_0x3594df,_0x1bd751);var _0x23ceb4=util['format']('transcript-%d-%s.zip',_0x306e4d[_0xfaef('0xbc')]['id'],_0x1bd751);var _0x3c87c1=path[_0xfaef('0xd2')](_0x3594df,_0x23ceb4);var _0x1c9e8b=[];_0x1c9e8b[_0xfaef('0x3b')]({'model':db[_0xfaef('0xd8')],'as':_0xfaef('0xd8'),'attributes':['id','fullname'],'raw':!![]});_0x1c9e8b[_0xfaef('0x3b')]({'model':db[_0xfaef('0xd9')],'as':_0xfaef('0x6c'),'attributes':['id','firstName',_0xfaef('0xda')],'raw':!![]});var _0x391165=[{'model':db[_0xfaef('0xbf')],'as':_0xfaef('0xdb'),'attributes':['id',_0xfaef('0x7a'),_0xfaef('0x7e'),'direction',_0xfaef('0xdc'),_0xfaef('0x85')],'include':_0x1c9e8b}];_0x391165[_0xfaef('0x3b')]({'model':db[_0xfaef('0xdd')],'as':_0xfaef('0xde'),'attributes':['id','name']});_0x391165[_0xfaef('0x3b')]({'model':db['User'],'as':_0xfaef('0xdf'),'attributes':['id',_0xfaef('0x37')]});return db['SmsInteraction'][_0xfaef('0x70')]({'where':{'id':_0x306e4d[_0xfaef('0xbc')]['id']},'include':_0x391165})[_0xfaef('0x2e')](handleEntityNotFound(_0x4b2f13,null))['then'](function(_0x12220a){if(_0x12220a){var _0x10e222=_0x12220a[_0xfaef('0xe0')]({'plain':!![]});fs['mkdirSync'](_0xed9c8);var _0x30cf79={'channel':'Sms','account':_0x10e222[_0xfaef('0xde')]['name'],'agent':_0x10e222[_0xfaef('0xdf')]?_0x10e222['Owner'][_0xfaef('0x37')]:_0xfaef('0xe1'),'createdAt':moment(_0x10e222[_0xfaef('0x7e')])[_0xfaef('0xc5')](_0xfaef('0xc6'))['toString'](),'closedAt':_0x10e222['closed']?moment(_0x10e222['closedAt'])[_0xfaef('0xc5')]('YYYY-MM-DD\x20HH:mm:ss')[_0xfaef('0xa0')]():'','disposition':_0x10e222[_0xfaef('0xe2')],'messages':_(_0x10e222['Messages'])['filter']({'secret':![]})[_0xfaef('0x36')](function(_0x46b3fb){return{'date':moment(_0x46b3fb[_0xfaef('0x7e')])['format'](_0xfaef('0xc6'))[_0xfaef('0xa0')](),'sender':_0x46b3fb[_0xfaef('0xe3')]==='out'?_0x46b3fb[_0xfaef('0xd8')]?_0x46b3fb[_0xfaef('0xd8')][_0xfaef('0x37')]:_0xfaef('0xe4'):_0x46b3fb[_0xfaef('0x6c')]['firstName']+(_0x46b3fb[_0xfaef('0x6c')][_0xfaef('0xda')]?'\x20'+_0x46b3fb[_0xfaef('0x6c')]['lastName']:''),'body':_0x46b3fb[_0xfaef('0x7a')],'direction':_0x46b3fb[_0xfaef('0xe3')]===_0xfaef('0xe5')?'A':'C','secret':_0x46b3fb[_0xfaef('0xdc')],'read':_0x46b3fb[_0xfaef('0x85')]};})['value']()};return ejs[_0xfaef('0xe6')](path[_0xfaef('0xd2')](config[_0xfaef('0xd3')],_0xfaef('0xd6'),'views',_0xfaef('0xe7')),{'interaction':_0x30cf79})[_0xfaef('0x2e')](function(_0x44b23b){var _0xb1f007=path['join'](_0xed9c8,_0xfaef('0xe8')+_0x10e222['id']+'-'+_0x1bd751+_0xfaef('0xe9'));var _0x4934b7={'path':_0xb1f007,'channel':_0xfaef('0xea'),'interactionId':_0x10e222['id']};return pdf[_0xfaef('0xeb')](_0x44b23b,_0x4934b7);})[_0xfaef('0x2e')](function(){return new BPromise(function(_0x12c945,_0x161a7c){zipdir(_0xed9c8,{'saveTo':_0x3c87c1},function(_0x21548e,_0xdb95d0){if(_0x21548e)return _0x161a7c(_0x21548e);return _0x12c945(_0xdb95d0);});})[_0xfaef('0x2e')](function(){return new BPromise(function(_0xe42d84,_0x5ed654){rimraf(_0xed9c8,function(_0x34cb54){if(_0x34cb54)_0x5ed654(_0x34cb54);return _0xe42d84();});});})[_0xfaef('0x2e')](function(){return _0x4b2f13[_0xfaef('0xd0')](_0x3c87c1,_0x23ceb4,function(_0x3cff87){if(_0x3cff87){console['log']('err',_0x3cff87);}else{fs[_0xfaef('0xec')](_0x3c87c1);}});});});}else{return _0x4b2f13['sendStatus'](0xc8);}})[_0xfaef('0x3c')](handleError(_0x4b2f13,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 27b560e..5322c72 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 _0xdb28=['Users','map','findAll','then','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','SmsInteraction','setMaxListeners','save','update','remove','setDataValue'];(function(_0xe3f0b0,_0x43edc9){var _0x3a839e=function(_0x45e9cf){while(--_0x45e9cf){_0xe3f0b0['push'](_0xe3f0b0['shift']());}};_0x3a839e(++_0x43edc9);}(_0xdb28,0x106));var _0x8db2=function(_0xe8cac3,_0x11ef4d){_0xe8cac3=_0xe8cac3-0x0;var _0x5e332c=_0xdb28[_0xe8cac3];return _0x5e332c;};'use strict';var EventEmitter=require(_0x8db2('0x0'));var SmsInteraction=require(_0x8db2('0x1'))['db'][_0x8db2('0x2')];var SmsMessage=require(_0x8db2('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x8db2('0x3')](0x0);var events={'afterCreate':_0x8db2('0x4'),'afterUpdate':_0x8db2('0x5'),'afterDestroy':_0x8db2('0x6')};function emitEvent(_0x11109e){return function(_0x52bf99,_0x21a03e,_0x1d2dd3){_0x52bf99['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x477f50){_0x52bf99[_0x8db2('0x7')](_0x8db2('0x8'),_0x477f50[_0x8db2('0x9')](function(_0x2f3f2f){return{'id':_0x2f3f2f['id']};}));return SmsMessage[_0x8db2('0xa')]({'where':{'SmsInteractionId':_0x52bf99['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8db2('0xb')](function(_0x4ba340){_0x52bf99[_0x8db2('0x7')](_0x8db2('0xc'),_0x4ba340[_0x8db2('0xd')]);SmsInteractionEvents['emit'](_0x11109e+':'+_0x52bf99['id'],_0x52bf99);SmsInteractionEvents[_0x8db2('0xe')](_0x11109e,_0x52bf99);_0x1d2dd3(null);})[_0x8db2('0xf')](_0x1d2dd3(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x8db2('0x10')](e,emitEvent(event));}}module[_0x8db2('0x11')]=SmsInteractionEvents; \ No newline at end of file +var _0x66fa=['remove','getUsers','then','setDataValue','map','findAll','emit','hasOwnProperty','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update'];(function(_0x2105e0,_0x5fc778){var _0xdc3aef=function(_0x480699){while(--_0x480699){_0x2105e0['push'](_0x2105e0['shift']());}};_0xdc3aef(++_0x5fc778);}(_0x66fa,0x117));var _0xa66f=function(_0x126054,_0x5b3ea1){_0x126054=_0x126054-0x0;var _0x764d7e=_0x66fa[_0x126054];return _0x764d7e;};'use strict';var EventEmitter=require(_0xa66f('0x0'));var SmsInteraction=require(_0xa66f('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0xa66f('0x1'))['db'][_0xa66f('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xa66f('0x3')](0x0);var events={'afterCreate':_0xa66f('0x4'),'afterUpdate':_0xa66f('0x5'),'afterDestroy':_0xa66f('0x6')};function emitEvent(_0x3f4904){return function(_0x5ebea5,_0x4fd9d0,_0x2239d3){_0x5ebea5[_0xa66f('0x7')]({'attributes':['id'],'raw':!![]})[_0xa66f('0x8')](function(_0x1d02fc){_0x5ebea5[_0xa66f('0x9')]('Users',_0x1d02fc[_0xa66f('0xa')](function(_0x4f6717){return{'id':_0x4f6717['id']};}));return SmsMessage[_0xa66f('0xb')]({'where':{'SmsInteractionId':_0x5ebea5['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x101e10){_0x5ebea5['setDataValue']('unreadMessages',_0x101e10['length']);SmsInteractionEvents[_0xa66f('0xc')](_0x3f4904+':'+_0x5ebea5['id'],_0x5ebea5);SmsInteractionEvents[_0xa66f('0xc')](_0x3f4904,_0x5ebea5);_0x2239d3(null);})['catch'](_0x2239d3(null));};}for(var e in events){if(events[_0xa66f('0xd')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0xa66f('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 afe7930..4f0eaf6 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 _0x4d94=['YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','request-promise','path','rimraf','./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','changed','closed','closedAt','format'];(function(_0x156608,_0x313f53){var _0xf7e226=function(_0x6fc28){while(--_0x6fc28){_0x156608['push'](_0x156608['shift']());}};_0xf7e226(++_0x313f53);}(_0x4d94,0x178));var _0x44d9=function(_0x58aa13,_0x533e05){_0x58aa13=_0x58aa13-0x0;var _0x33c614=_0x4d94[_0x58aa13];return _0x33c614;};'use strict';var _=require('lodash');var util=require(_0x44d9('0x0'));var logger=require(_0x44d9('0x1'))('api');var moment=require(_0x44d9('0x2'));var BPromise=require('bluebird');var rp=require(_0x44d9('0x3'));var fs=require('fs');var path=require(_0x44d9('0x4'));var rimraf=require(_0x44d9('0x5'));var config=require('../../config/environment');var attributes=require(_0x44d9('0x6'));module[_0x44d9('0x7')]=function(_0x305666,_0x187aa1){return _0x305666['define'](_0x44d9('0x8'),attributes,{'tableName':_0x44d9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1ad23a,_0x3b1279,_0x10744b){if(_0x1ad23a[_0x44d9('0xa')](_0x44d9('0xb'))){_0x1ad23a[_0x44d9('0xc')]=moment()[_0x44d9('0xd')](_0x44d9('0xe'));}_0x10744b(null,_0x1ad23a);}}});}; \ No newline at end of file +var _0xf989=['closedAt','YYYY-MM-DD\x20HH:mm:ss','util','api','moment','request-promise','path','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions'];(function(_0x45718e,_0x253b97){var _0x18ab22=function(_0xfcb2d){while(--_0xfcb2d){_0x45718e['push'](_0x45718e['shift']());}};_0x18ab22(++_0x253b97);}(_0xf989,0x195));var _0x9f98=function(_0x1fa760,_0x1bf063){_0x1fa760=_0x1fa760-0x0;var _0xd8eda1=_0xf989[_0x1fa760];return _0xd8eda1;};'use strict';var _=require('lodash');var util=require(_0x9f98('0x0'));var logger=require('../../config/logger')(_0x9f98('0x1'));var moment=require(_0x9f98('0x2'));var BPromise=require('bluebird');var rp=require(_0x9f98('0x3'));var fs=require('fs');var path=require(_0x9f98('0x4'));var rimraf=require('rimraf');var config=require(_0x9f98('0x5'));var attributes=require(_0x9f98('0x6'));module[_0x9f98('0x7')]=function(_0x1e914c,_0x2c2da0){return _0x1e914c[_0x9f98('0x8')](_0x9f98('0x9'),attributes,{'tableName':_0x9f98('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x43a1d6,_0x393420,_0x6a2120){if(_0x43a1d6['changed']('closed')){_0x43a1d6[_0x9f98('0xb')]=moment()['format'](_0x9f98('0xc'));}_0x6a2120(null,_0x43a1d6);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 37adb29..451d2c7 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 _0x8986=['addTags','omit','spread','AddTags','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','register','request','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','then','AddTagsToSmsInteraction','find'];(function(_0x1143c9,_0x407c2d){var _0x557b90=function(_0xb6dbe1){while(--_0xb6dbe1){_0x1143c9['push'](_0x1143c9['shift']());}};_0x557b90(++_0x407c2d);}(_0x8986,0x124));var _0x6898=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x8986[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6898('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6898('0x1'))['db'];var utils=require(_0x6898('0x2'));var logger=require(_0x6898('0x3'))('rpc');var config=require(_0x6898('0x4'));var jayson=require(_0x6898('0x5'));var client=jayson['client'][_0x6898('0x6')]({'port':0x232a});config[_0x6898('0x7')]=_['defaults'](config[_0x6898('0x7')],{'host':_0x6898('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6898('0x7')]));require('./smsInteraction.socket')[_0x6898('0x9')](socket);function respondWithRpcPromise(_0x2763a5,_0xdc7f37,_0xe071a6){return new BPromise(function(_0xcfe998,_0x280c82){return client[_0x6898('0xa')](_0x2763a5,_0xe071a6)['then'](function(_0x5427f7){logger[_0x6898('0xb')](_0x6898('0xc'),_0xdc7f37,_0x6898('0xd'));logger[_0x6898('0xe')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0xdc7f37,_0x6898('0xd'),JSON[_0x6898('0xf')](_0x5427f7));if(_0x5427f7[_0x6898('0x10')]){if(_0x5427f7['error'][_0x6898('0x11')]===0x1f4){logger[_0x6898('0x10')](_0x6898('0xc'),_0xdc7f37,_0x5427f7[_0x6898('0x10')][_0x6898('0x12')]);return _0x280c82(_0x5427f7[_0x6898('0x10')]['message']);}logger['error'](_0x6898('0xc'),_0xdc7f37,_0x5427f7['error'][_0x6898('0x12')]);return _0xcfe998(_0x5427f7['error'][_0x6898('0x12')]);}else{logger[_0x6898('0xb')](_0x6898('0xc'),_0xdc7f37,_0x6898('0xd'));_0xcfe998(_0x5427f7[_0x6898('0x13')][_0x6898('0x12')]);}})[_0x6898('0x14')](function(_0x1cedfe){logger[_0x6898('0x10')]('SmsInteraction,\x20%s,\x20%s',_0xdc7f37,_0x1cedfe);_0x280c82(_0x1cedfe);});});}exports[_0x6898('0x15')]=function(_0x26347e){var _0x17c0c0=this;return new Promise(function(_0x422dc1,_0x1941ff){return db[_0x6898('0x16')][_0x6898('0x17')](_0x26347e[_0x6898('0x18')],{'raw':_0x26347e[_0x6898('0x19')]?_0x26347e[_0x6898('0x19')][_0x6898('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26347e[_0x6898('0x19')]?_0x26347e[_0x6898('0x19')][_0x6898('0x1b')]||null:null,'attributes':_0x26347e[_0x6898('0x19')]?_0x26347e['options'][_0x6898('0x1c')]||null:null,'limit':_0x26347e['options']?_0x26347e[_0x6898('0x19')]['limit']||null:null})[_0x6898('0x1d')](function(_0x30066a){logger[_0x6898('0xb')]('UpdateSmsInteraction',_0x26347e);logger[_0x6898('0xe')](_0x6898('0x15'),_0x26347e,JSON['stringify'](_0x30066a));_0x422dc1(_0x30066a);})[_0x6898('0x14')](function(_0x253275){logger[_0x6898('0x10')](_0x6898('0x15'),_0x253275[_0x6898('0x12')],_0x26347e);_0x1941ff(_0x17c0c0[_0x6898('0x10')](0x1f4,_0x253275['message']));});});};exports[_0x6898('0x1e')]=function(_0xc5f512){return new Promise(function(_0x5629d3,_0x2265cc){return db[_0x6898('0x16')][_0x6898('0x1f')]({'where':_0xc5f512[_0x6898('0x19')]?_0xc5f512[_0x6898('0x19')][_0x6898('0x1b')]||null:null})['then'](function(_0x4dea8a){if(_0x4dea8a){return _0x4dea8a[_0x6898('0x20')](_0xc5f512[_0x6898('0x18')]['ids'],_[_0x6898('0x21')](_0xc5f512[_0x6898('0x18')],['ids','id'])||{});}})[_0x6898('0x22')](function(_0x28e5d0){logger['info']('AddTags',_0xc5f512);logger[_0x6898('0xe')](_0x6898('0x23'),_0xc5f512,JSON['stringify'](_0x28e5d0));_0x5629d3(_0x28e5d0);})['catch'](function(_0x1b7b78){logger[_0x6898('0x10')](_0x6898('0x23'),_0x1b7b78[_0x6898('0x12')],_0xc5f512);_0x2265cc(_this[_0x6898('0x10')](0x1f4,_0x1b7b78[_0x6898('0x12')]));});});}; \ No newline at end of file +var _0x320a=['redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','AddTagsToSmsInteraction','find','addTags','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x20add8,_0x29e5f6){var _0x22655e=function(_0x3e928c){while(--_0x3e928c){_0x20add8['push'](_0x20add8['shift']());}};_0x22655e(++_0x29e5f6);}(_0x320a,0x14e));var _0xa320=function(_0x5db359,_0x42007d){_0x5db359=_0x5db359-0x0;var _0x37392d=_0x320a[_0x5db359];return _0x37392d;};'use strict';var _=require('lodash');var util=require(_0xa320('0x0'));var moment=require(_0xa320('0x1'));var BPromise=require(_0xa320('0x2'));var rs=require(_0xa320('0x3'));var fs=require('fs');var Redis=require(_0xa320('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa320('0x5'));var logger=require(_0xa320('0x6'))(_0xa320('0x7'));var config=require(_0xa320('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa320('0x9')]['http']({'port':0x232a});config[_0xa320('0xa')]=_[_0xa320('0xb')](config[_0xa320('0xa')],{'host':_0xa320('0xc'),'port':0x18eb});var socket=require(_0xa320('0xd'))(new Redis(config[_0xa320('0xa')]));require(_0xa320('0xe'))[_0xa320('0xf')](socket);function respondWithRpcPromise(_0x4a63e9,_0x25d9c5,_0x1d47e4){return new BPromise(function(_0x30358d,_0x5c94ad){return client[_0xa320('0x10')](_0x4a63e9,_0x1d47e4)[_0xa320('0x11')](function(_0x29be4c){logger[_0xa320('0x12')](_0xa320('0x13'),_0x25d9c5,_0xa320('0x14'));logger[_0xa320('0x15')](_0xa320('0x16'),_0x25d9c5,_0xa320('0x14'),JSON[_0xa320('0x17')](_0x29be4c));if(_0x29be4c[_0xa320('0x18')]){if(_0x29be4c['error'][_0xa320('0x19')]===0x1f4){logger[_0xa320('0x18')](_0xa320('0x13'),_0x25d9c5,_0x29be4c['error'][_0xa320('0x1a')]);return _0x5c94ad(_0x29be4c[_0xa320('0x18')][_0xa320('0x1a')]);}logger[_0xa320('0x18')](_0xa320('0x13'),_0x25d9c5,_0x29be4c['error'][_0xa320('0x1a')]);return _0x30358d(_0x29be4c[_0xa320('0x18')][_0xa320('0x1a')]);}else{logger[_0xa320('0x12')](_0xa320('0x13'),_0x25d9c5,_0xa320('0x14'));_0x30358d(_0x29be4c['result']['message']);}})[_0xa320('0x1b')](function(_0x478241){logger[_0xa320('0x18')](_0xa320('0x13'),_0x25d9c5,_0x478241);_0x5c94ad(_0x478241);});});}exports[_0xa320('0x1c')]=function(_0x20d395){var _0x195a90=this;return new Promise(function(_0x5bab16,_0x3d4408){return db[_0xa320('0x1d')][_0xa320('0x1e')](_0x20d395[_0xa320('0x1f')],{'raw':_0x20d395['options']?_0x20d395[_0xa320('0x20')][_0xa320('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20d395[_0xa320('0x20')]?_0x20d395[_0xa320('0x20')][_0xa320('0x22')]||null:null,'attributes':_0x20d395['options']?_0x20d395[_0xa320('0x20')][_0xa320('0x23')]||null:null,'limit':_0x20d395[_0xa320('0x20')]?_0x20d395[_0xa320('0x20')]['limit']||null:null})[_0xa320('0x11')](function(_0x1e5f69){logger[_0xa320('0x12')](_0xa320('0x1c'),_0x20d395);logger[_0xa320('0x15')](_0xa320('0x1c'),_0x20d395,JSON[_0xa320('0x17')](_0x1e5f69));_0x5bab16(_0x1e5f69);})['catch'](function(_0xb8a5e5){logger[_0xa320('0x18')](_0xa320('0x1c'),_0xb8a5e5[_0xa320('0x1a')],_0x20d395);_0x3d4408(_0x195a90[_0xa320('0x18')](0x1f4,_0xb8a5e5[_0xa320('0x1a')]));});});};exports[_0xa320('0x24')]=function(_0x1dd0b3){return new Promise(function(_0x20b944,_0x5d79a3){return db[_0xa320('0x1d')][_0xa320('0x25')]({'where':_0x1dd0b3['options']?_0x1dd0b3[_0xa320('0x20')]['where']||null:null})[_0xa320('0x11')](function(_0x2acc5d){if(_0x2acc5d){return _0x2acc5d[_0xa320('0x26')](_0x1dd0b3[_0xa320('0x1f')][_0xa320('0x27')],_[_0xa320('0x28')](_0x1dd0b3[_0xa320('0x1f')],[_0xa320('0x27'),'id'])||{});}})[_0xa320('0x29')](function(_0xddf81f){logger['info'](_0xa320('0x2a'),_0x1dd0b3);logger[_0xa320('0x15')](_0xa320('0x2a'),_0x1dd0b3,JSON[_0xa320('0x17')](_0xddf81f));_0x20b944(_0xddf81f);})[_0xa320('0x1b')](function(_0x5df112){logger['error'](_0xa320('0x2a'),_0x5df112['message'],_0x1dd0b3);_0x5d79a3(_this['error'](0x1f4,_0x5df112['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 215fdf4..4e3680f 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 _0xcced=['emit','register','length','smsInteraction:','./smsInteraction.events','save','remove'];(function(_0x2d61b2,_0x142947){var _0x12df89=function(_0x31c717){while(--_0x31c717){_0x2d61b2['push'](_0x2d61b2['shift']());}};_0x12df89(++_0x142947);}(_0xcced,0x6d));var _0xdcce=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0xcced[_0x409353];return _0x4f4b59;};'use strict';var SmsInteractionEvents=require(_0xdcce('0x0'));var events=[_0xdcce('0x1'),_0xdcce('0x2'),'update'];function createListener(_0x5bd20b,_0x2d3738){return function(_0x1f88eb){_0x2d3738[_0xdcce('0x3')](_0x5bd20b,_0x1f88eb);};}function removeListener(_0x254c7a,_0x2c8937){return function(){SmsInteractionEvents['removeListener'](_0x254c7a,_0x2c8937);};}exports[_0xdcce('0x4')]=function(_0x2bbd0a){for(var _0x24718d=0x0,_0x535544=events[_0xdcce('0x5')];_0x24718d<_0x535544;_0x24718d++){var _0x3ff4a7=events[_0x24718d];var _0x535674=createListener(_0xdcce('0x6')+_0x3ff4a7,_0x2bbd0a);SmsInteractionEvents['on'](_0x3ff4a7,_0x535674);}}; \ No newline at end of file +var _0xae6f=['emit','removeListener','register','smsInteraction:','save','update'];(function(_0x57e50b,_0x16e856){var _0x4a1016=function(_0x3db554){while(--_0x3db554){_0x57e50b['push'](_0x57e50b['shift']());}};_0x4a1016(++_0x16e856);}(_0xae6f,0xbe));var _0xfae6=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xae6f[_0x46e363];return _0x3fb059;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xfae6('0x0'),'remove',_0xfae6('0x1')];function createListener(_0x32ccea,_0x272a8c){return function(_0x3d081c){_0x272a8c[_0xfae6('0x2')](_0x32ccea,_0x3d081c);};}function removeListener(_0x35184d,_0x290337){return function(){SmsInteractionEvents[_0xfae6('0x3')](_0x35184d,_0x290337);};}exports[_0xfae6('0x4')]=function(_0x2e4f82){for(var _0x3aabc3=0x0,_0x5d4e0a=events['length'];_0x3aabc3<_0x5d4e0a;_0x3aabc3++){var _0x4e3c5c=events[_0x3aabc3];var _0x41c22a=createListener(_0xfae6('0x5')+_0x4e3c5c,_0x2e4f82);SmsInteractionEvents['on'](_0x4e3c5c,_0x41c22a);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 5c250f1..9e85088 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 _0x18af=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','tracked','smsmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','delete','exports','multer','path','connect-timeout'];(function(_0x3fefd2,_0x1a39dc){var _0x520b72=function(_0x209deb){while(--_0x209deb){_0x3fefd2['push'](_0x3fefd2['shift']());}};_0x520b72(++_0x1a39dc);}(_0x18af,0x19d));var _0xf18a=function(_0x5489c7,_0x4ddaac){_0x5489c7=_0x5489c7-0x0;var _0xadc532=_0x18af[_0x5489c7];return _0xadc532;};'use strict';var multer=require(_0xf18a('0x0'));var util=require('util');var path=require(_0xf18a('0x1'));var timeout=require(_0xf18a('0x2'));var express=require(_0xf18a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf18a('0x4'));var interaction=require(_0xf18a('0x5'));var config=require(_0xf18a('0x6'));var controller=require('./smsMessage.controller');router[_0xf18a('0x7')]('/',auth[_0xf18a('0x8')](),controller[_0xf18a('0x9')]);router['get']('/describe',auth[_0xf18a('0x8')](),controller[_0xf18a('0xa')]);router['get'](_0xf18a('0xb'),auth[_0xf18a('0x8')](),controller[_0xf18a('0xc')]);router[_0xf18a('0xd')]('/',auth[_0xf18a('0x8')](),interaction[_0xf18a('0xe')]('sms',_0xf18a('0xf')),controller[_0xf18a('0x10')]);router[_0xf18a('0xd')](_0xf18a('0x11'),controller[_0xf18a('0x12')]);router[_0xf18a('0x13')](_0xf18a('0xb'),auth[_0xf18a('0x8')](),controller[_0xf18a('0x14')]);router['put'](_0xf18a('0x15'),auth[_0xf18a('0x8')](),controller[_0xf18a('0x16')]);router[_0xf18a('0x13')](_0xf18a('0x17'),auth['isAuthenticated'](),controller['reject']);router[_0xf18a('0x18')]('/:id',auth[_0xf18a('0x8')](),controller['destroy']);module[_0xf18a('0x19')]=router; \ No newline at end of file +var _0xef0a=['isAuthenticated','index','/describe','describe','/:id','post','tracked','sms','smsmessage:create','create','/:id/status','put','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x13f788,_0x46939a){var _0x3dbcd8=function(_0x150bb6){while(--_0x150bb6){_0x13f788['push'](_0x13f788['shift']());}};_0x3dbcd8(++_0x46939a);}(_0xef0a,0x1a8));var _0xaef0=function(_0x48c7ea,_0x463a80){_0x48c7ea=_0x48c7ea-0x0;var _0x4b0969=_0xef0a[_0x48c7ea];return _0x4b0969;};'use strict';var multer=require('multer');var util=require(_0xaef0('0x0'));var path=require(_0xaef0('0x1'));var timeout=require(_0xaef0('0x2'));var express=require(_0xaef0('0x3'));var router=express['Router']();var fs_extra=require(_0xaef0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xaef0('0x5'));var config=require(_0xaef0('0x6'));var controller=require('./smsMessage.controller');router[_0xaef0('0x7')]('/',auth[_0xaef0('0x8')](),controller[_0xaef0('0x9')]);router['get'](_0xaef0('0xa'),auth[_0xaef0('0x8')](),controller[_0xaef0('0xb')]);router[_0xaef0('0x7')](_0xaef0('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xaef0('0xd')]('/',auth['isAuthenticated'](),interaction[_0xaef0('0xe')](_0xaef0('0xf'),_0xaef0('0x10')),controller[_0xaef0('0x11')]);router[_0xaef0('0xd')](_0xaef0('0x12'),controller['status']);router[_0xaef0('0x13')]('/:id',auth[_0xaef0('0x8')](),controller[_0xaef0('0x14')]);router[_0xaef0('0x13')](_0xaef0('0x15'),auth['isAuthenticated'](),controller['accept']);router[_0xaef0('0x13')](_0xaef0('0x16'),auth[_0xaef0('0x8')](),controller[_0xaef0('0x17')]);router[_0xaef0('0x18')](_0xaef0('0xc'),auth[_0xaef0('0x8')](),controller[_0xaef0('0x19')]);module[_0xaef0('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 2fd966c..53ae1e7 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 _0x7a2d=['TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports'];(function(_0xfc553f,_0xf60646){var _0x4f72ea=function(_0x4cca68){while(--_0x4cca68){_0xfc553f['push'](_0xfc553f['shift']());}};_0x4f72ea(++_0xf60646);}(_0x7a2d,0x142));var _0xd7a2=function(_0x949ff7,_0x24e8f7){_0x949ff7=_0x949ff7-0x0;var _0x2965f4=_0x7a2d[_0x949ff7];return _0x2965f4;};'use strict';var Sequelize=require(_0xd7a2('0x0'));module[_0xd7a2('0x1')]={'body':{'type':Sequelize[_0xd7a2('0x2')](_0xd7a2('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xd7a2('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd7a2('0x5')]('in',_0xd7a2('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xd7a2('0x7')]},'readAt':{'type':Sequelize[_0xd7a2('0x8')]},'secret':{'type':Sequelize[_0xd7a2('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xd7a2('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xbc38=['TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','exports'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xbc38,0x157));var _0x8bc3=function(_0xee267,_0x4fb138){_0xee267=_0xee267-0x0;var _0x21cbc5=_0xbc38[_0xee267];return _0x21cbc5;};'use strict';var Sequelize=require('sequelize');module[_0x8bc3('0x0')]={'body':{'type':Sequelize[_0x8bc3('0x1')](_0x8bc3('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x8bc3('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8bc3('0x4')]('in',_0x8bc3('0x5')),'defaultValue':_0x8bc3('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x8bc3('0x6')](0xbe)},'phone':{'type':Sequelize[_0x8bc3('0x6')]},'readAt':{'type':Sequelize[_0x8bc3('0x7')]},'secret':{'type':Sequelize[_0x8bc3('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x8bc3('0x6')]},'providerResponse':{'type':Sequelize[_0x8bc3('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 1699c7b..8eb44b9 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 _0x4f31=['inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','indexOf','sent','delivered','Status','plivio','results','groupName','DELIVERED','infobip','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./smsMessage.socket','register','jayson/promise','http','client','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','limit','undefined','offset','Content-Range','apply','save','update','name','send','index','map','SmsMessage','fieldName','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','destroy','describe','sms-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','agent','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','reject','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','User','fullname','email','motionChannel','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from'];(function(_0x39fdda,_0x1994e1){var _0x5c9d2f=function(_0x141709){while(--_0x141709){_0x39fdda['push'](_0x39fdda['shift']());}};_0x5c9d2f(++_0x1994e1);}(_0x4f31,0x13f));var _0x14f3=function(_0x11512c,_0x59da82){_0x11512c=_0x11512c-0x0;var _0xef24f2=_0x4f31[_0x11512c];return _0xef24f2;};'use strict';var emlformat=require(_0x14f3('0x0'));var rimraf=require(_0x14f3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x14f3('0x2'));var rp=require('request-promise');var moment=require(_0x14f3('0x3'));var BPromise=require(_0x14f3('0x4'));var Mustache=require(_0x14f3('0x5'));var util=require(_0x14f3('0x6'));var path=require('path');var sox=require(_0x14f3('0x7'));var csv=require(_0x14f3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x14f3('0x9'));var squel=require(_0x14f3('0xa'));var crypto=require(_0x14f3('0xb'));var jsforce=require(_0x14f3('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x14f3('0xd'));var Redis=require(_0x14f3('0xe'));var authService=require(_0x14f3('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x14f3('0x10'));var hardwareService=require(_0x14f3('0x11'));var logger=require(_0x14f3('0x12'))(_0x14f3('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x14f3('0x14'));var db=require(_0x14f3('0x15'))['db'];config['redis']=_[_0x14f3('0x16')](config['redis'],{'host':_0x14f3('0x17'),'port':0x18eb});var socket=require(_0x14f3('0x18'))(new Redis(config[_0x14f3('0x19')]));require(_0x14f3('0x1a'))[_0x14f3('0x1b')](socket);var jayson=require(_0x14f3('0x1c'));var client=jayson['client'][_0x14f3('0x1d')]({'port':0x232c});var client9002=jayson[_0x14f3('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a9ecb,_0x3e5a7d,_0x489aaa,_0x4e2e48){return new BPromise(function(_0xb241bd,_0x5db825){var _0x4561ff=_0x4e2e48||client;return _0x4561ff[_0x14f3('0x1f')](_0x5a9ecb,_0x489aaa)[_0x14f3('0x20')](function(_0x594fc4){logger[_0x14f3('0x21')](_0x14f3('0x22'),_0x3e5a7d,_0x14f3('0x23'));logger[_0x14f3('0x24')](_0x14f3('0x25'),_0x3e5a7d,'request\x20sent',JSON[_0x14f3('0x26')](_0x594fc4));if(_0x594fc4[_0x14f3('0x27')]){if(_0x594fc4[_0x14f3('0x27')]['code']===0x1f4){logger[_0x14f3('0x27')](_0x14f3('0x22'),_0x3e5a7d,_0x594fc4[_0x14f3('0x27')][_0x14f3('0x28')]);return _0x5db825(_0x594fc4[_0x14f3('0x27')][_0x14f3('0x28')]);}logger[_0x14f3('0x27')](_0x14f3('0x22'),_0x3e5a7d,_0x594fc4[_0x14f3('0x27')]['message']);return _0xb241bd(_0x594fc4[_0x14f3('0x27')]['message']);}else{logger['info'](_0x14f3('0x22'),_0x3e5a7d,_0x14f3('0x23'));_0xb241bd(_0x594fc4[_0x14f3('0x29')][_0x14f3('0x28')]);}})[_0x14f3('0x2a')](function(_0x4db176){logger[_0x14f3('0x27')]('SmsMessage,\x20%s,\x20%s',_0x3e5a7d,_0x4db176);_0x5db825(_0x4db176);});});}function respondWithStatusCode(_0x251232,_0x281a5c){_0x281a5c=_0x281a5c||0xcc;return function(_0x22c8f5){if(_0x22c8f5){return _0x251232[_0x14f3('0x2b')](_0x281a5c);}return _0x251232[_0x14f3('0x2c')](_0x281a5c)['end']();};}function respondWithResult(_0x36d045,_0x4598df){_0x4598df=_0x4598df||0xc8;return function(_0x2bf14d){if(_0x2bf14d){return _0x36d045[_0x14f3('0x2c')](_0x4598df)[_0x14f3('0x2d')](_0x2bf14d);}};}function respondWithFilteredResult(_0x269abe,_0x1bce4f){return function(_0x3bd24a){if(_0x3bd24a){var _0x50aae3=typeof _0x1bce4f['offset']==='undefined'&&typeof _0x1bce4f[_0x14f3('0x2e')]===_0x14f3('0x2f');var _0x22d364=_0x3bd24a['count'];var _0x50f109=_0x50aae3?0x0:_0x1bce4f[_0x14f3('0x30')];var _0x37df7a=_0x50aae3?_0x3bd24a['count']:_0x1bce4f[_0x14f3('0x30')]+_0x1bce4f[_0x14f3('0x2e')];var _0x1f7955;if(_0x37df7a>=_0x22d364){_0x37df7a=_0x22d364;_0x1f7955=0xc8;}else{_0x1f7955=0xce;}_0x269abe[_0x14f3('0x2c')](_0x1f7955);return _0x269abe['set'](_0x14f3('0x31'),_0x50f109+'-'+_0x37df7a+'/'+_0x22d364)[_0x14f3('0x2d')](_0x3bd24a);}return null;};}function patchUpdates(_0x2f29e9){return function(_0x31f81a){try{jsonpatch[_0x14f3('0x32')](_0x31f81a,_0x2f29e9,!![]);}catch(_0xbce5e9){return BPromise['reject'](_0xbce5e9);}return _0x31f81a[_0x14f3('0x33')]();};}function saveUpdates(_0x5992c8,_0x556b4b){return function(_0x1ed518){if(_0x1ed518){return _0x1ed518[_0x14f3('0x34')](_0x5992c8)[_0x14f3('0x20')](function(_0x57bb46){return _0x57bb46;});}return null;};}function removeEntity(_0x3f6a03,_0x59ce02){return function(_0x4b2881){if(_0x4b2881){return _0x4b2881['destroy']()[_0x14f3('0x20')](function(){_0x3f6a03[_0x14f3('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x84d16c,_0x123a3b){return function(_0x777d9e){if(!_0x777d9e){_0x84d16c['sendStatus'](0x194);}return _0x777d9e;};}function handleError(_0x4a6c63,_0x1bda61){_0x1bda61=_0x1bda61||0x1f4;return function(_0x27a310){logger[_0x14f3('0x27')](_0x27a310['stack']);if(_0x27a310[_0x14f3('0x35')]){delete _0x27a310[_0x14f3('0x35')];}_0x4a6c63['status'](_0x1bda61)[_0x14f3('0x36')](_0x27a310);};}exports[_0x14f3('0x37')]=function(_0x367c94,_0x590304){var _0x5df358={},_0x4896ff={},_0x26efea={'count':0x0,'rows':[]};var _0x463039=_[_0x14f3('0x38')](db[_0x14f3('0x39')]['rawAttributes'],function(_0x15aea7){return{'name':_0x15aea7[_0x14f3('0x3a')],'type':_0x15aea7['type']['key']};});_0x4896ff[_0x14f3('0x3b')]=_['map'](_0x463039,_0x14f3('0x35'));_0x4896ff[_0x14f3('0x3c')]=_[_0x14f3('0x3d')](_0x367c94[_0x14f3('0x3c')]);_0x4896ff[_0x14f3('0x3e')]=_['intersection'](_0x4896ff['model'],_0x4896ff[_0x14f3('0x3c')]);_0x5df358[_0x14f3('0x3f')]=_[_0x14f3('0x40')](_0x4896ff['model'],qs[_0x14f3('0x41')](_0x367c94[_0x14f3('0x3c')][_0x14f3('0x41')]));_0x5df358[_0x14f3('0x3f')]=_0x5df358[_0x14f3('0x3f')][_0x14f3('0x42')]?_0x5df358[_0x14f3('0x3f')]:_0x4896ff['model'];if(!_0x367c94[_0x14f3('0x3c')]['hasOwnProperty'](_0x14f3('0x43'))){_0x5df358[_0x14f3('0x2e')]=qs[_0x14f3('0x2e')](_0x367c94[_0x14f3('0x3c')][_0x14f3('0x2e')]);_0x5df358[_0x14f3('0x30')]=qs[_0x14f3('0x30')](_0x367c94[_0x14f3('0x3c')][_0x14f3('0x30')]);}_0x5df358[_0x14f3('0x44')]=qs[_0x14f3('0x45')](_0x367c94[_0x14f3('0x3c')][_0x14f3('0x45')]);_0x5df358['where']=qs[_0x14f3('0x3e')](_[_0x14f3('0x46')](_0x367c94[_0x14f3('0x3c')],_0x4896ff[_0x14f3('0x3e')]),_0x463039);if(_0x367c94[_0x14f3('0x3c')]['filter']){_0x5df358[_0x14f3('0x47')]=_[_0x14f3('0x48')](_0x5df358[_0x14f3('0x47')],{'$or':_[_0x14f3('0x38')](_0x463039,function(_0x1f230f){if(_0x1f230f[_0x14f3('0x49')]!==_0x14f3('0x4a')){var _0x187396={};_0x187396[_0x1f230f[_0x14f3('0x35')]]={'$like':'%'+_0x367c94[_0x14f3('0x3c')][_0x14f3('0x4b')]+'%'};return _0x187396;}})});}_0x5df358=_['merge']({},_0x5df358,_0x367c94[_0x14f3('0x4c')]);var _0x3e080={'where':_0x5df358[_0x14f3('0x47')]};return db[_0x14f3('0x39')][_0x14f3('0x4d')](_0x3e080)['then'](function(_0x487d97){_0x26efea['count']=_0x487d97;if(_0x367c94['query'][_0x14f3('0x4e')]){_0x5df358[_0x14f3('0x4f')]=[{'all':!![]}];}return db['SmsMessage'][_0x14f3('0x50')](_0x5df358);})[_0x14f3('0x20')](function(_0x59583c){_0x26efea[_0x14f3('0x51')]=_0x59583c;return _0x26efea;})[_0x14f3('0x20')](respondWithFilteredResult(_0x590304,_0x5df358))[_0x14f3('0x2a')](handleError(_0x590304,null));};exports[_0x14f3('0x52')]=function(_0x5a7f6d,_0x438af0){var _0x429e5b={'raw':!![],'where':{'id':_0x5a7f6d[_0x14f3('0x53')]['id']}},_0x3f86f7={};_0x3f86f7[_0x14f3('0x3b')]=_[_0x14f3('0x3d')](db[_0x14f3('0x39')][_0x14f3('0x54')]);_0x3f86f7[_0x14f3('0x3c')]=_[_0x14f3('0x3d')](_0x5a7f6d[_0x14f3('0x3c')]);_0x3f86f7[_0x14f3('0x3e')]=_['intersection'](_0x3f86f7[_0x14f3('0x3b')],_0x3f86f7[_0x14f3('0x3c')]);_0x429e5b[_0x14f3('0x3f')]=_[_0x14f3('0x40')](_0x3f86f7['model'],qs['fields'](_0x5a7f6d[_0x14f3('0x3c')][_0x14f3('0x41')]));_0x429e5b[_0x14f3('0x3f')]=_0x429e5b[_0x14f3('0x3f')][_0x14f3('0x42')]?_0x429e5b[_0x14f3('0x3f')]:_0x3f86f7[_0x14f3('0x3b')];if(_0x5a7f6d[_0x14f3('0x3c')]['includeAll']){_0x429e5b[_0x14f3('0x4f')]=[{'all':!![]}];}_0x429e5b=_[_0x14f3('0x48')]({},_0x429e5b,_0x5a7f6d[_0x14f3('0x4c')]);return db[_0x14f3('0x39')][_0x14f3('0x55')](_0x429e5b)[_0x14f3('0x20')](handleEntityNotFound(_0x438af0,null))[_0x14f3('0x20')](respondWithResult(_0x438af0,null))[_0x14f3('0x2a')](handleError(_0x438af0,null));};exports[_0x14f3('0x56')]=function(_0x16069e,_0xd891f4){return db[_0x14f3('0x39')][_0x14f3('0x56')](_0x16069e[_0x14f3('0x57')],{})['then'](respondWithResult(_0xd891f4,0xc9))[_0x14f3('0x2a')](handleError(_0xd891f4,null));};exports['update']=function(_0x26e57c,_0x3f64d8){if(_0x26e57c[_0x14f3('0x57')]['id']){delete _0x26e57c[_0x14f3('0x57')]['id'];}return db[_0x14f3('0x39')][_0x14f3('0x55')]({'where':{'id':_0x26e57c[_0x14f3('0x53')]['id']}})[_0x14f3('0x20')](handleEntityNotFound(_0x3f64d8,null))[_0x14f3('0x20')](saveUpdates(_0x26e57c[_0x14f3('0x57')],null))[_0x14f3('0x20')](respondWithResult(_0x3f64d8,null))[_0x14f3('0x2a')](handleError(_0x3f64d8,null));};exports[_0x14f3('0x58')]=function(_0x102199,_0x482b9d){return db[_0x14f3('0x39')][_0x14f3('0x55')]({'where':{'id':_0x102199[_0x14f3('0x53')]['id']}})[_0x14f3('0x20')](handleEntityNotFound(_0x482b9d,null))[_0x14f3('0x20')](removeEntity(_0x482b9d,null))[_0x14f3('0x2a')](handleError(_0x482b9d,null));};exports['describe']=function(_0xe7900c,_0x18057a){return db[_0x14f3('0x39')][_0x14f3('0x59')]()[_0x14f3('0x20')](respondWithResult(_0x18057a,null))['catch'](handleError(_0x18057a,null));};var interaction_log=require(_0x14f3('0x12'))(_0x14f3('0x5a'));exports[_0x14f3('0x5b')]=function(_0x2e9db2,_0x3f84ec,_0x5df5b4){var _0x568d13={'agent':{},'channel':'sms'};if(_0x2e9db2[_0x14f3('0x57')]['id']){delete _0x2e9db2['body']['id'];}_0x2e9db2[_0x14f3('0x57')]['read']=!![];_0x2e9db2[_0x14f3('0x57')][_0x14f3('0x5c')]=moment()[_0x14f3('0x5d')](_0x14f3('0x5e'));_0x2e9db2[_0x14f3('0x57')]['UserId']=_0x2e9db2[_0x14f3('0x57')]['UserId']||_0x2e9db2['user']['id'];_0x568d13['agent']['id']=_0x2e9db2[_0x14f3('0x57')][_0x14f3('0x5f')];return db[_0x14f3('0x39')]['find']({'where':{'id':_0x2e9db2[_0x14f3('0x53')]['id'],'UserId':null}})[_0x14f3('0x20')](handleEntityNotFound(_0x3f84ec,null))[_0x14f3('0x20')](saveUpdates(_0x2e9db2['body'],null))['then'](function(_0x433fae){if(_0x433fae){_0x568d13['message']=_0x433fae['get']({'plain':!![]});return db[_0x14f3('0x60')][_0x14f3('0x55')]({'where':{'id':_0x433fae[_0x14f3('0x61')]}});}return null;})[_0x14f3('0x20')](handleEntityNotFound(_0x3f84ec,null))[_0x14f3('0x20')](function(_0x422ff0){if(_0x422ff0){return _0x422ff0[_0x14f3('0x34')]({'UserId':_0x2e9db2[_0x14f3('0x57')][_0x14f3('0x5f')],'read1stAt':_[_0x14f3('0x62')](_0x422ff0[_0x14f3('0x63')])?moment()[_0x14f3('0x5d')](_0x14f3('0x5e')):undefined});}return null;})[_0x14f3('0x20')](function(_0x57ad89){if(_0x57ad89){_0x568d13[_0x14f3('0x64')]=_0x57ad89[_0x14f3('0x65')]({'plain':!![]});interaction_log[_0x14f3('0x21')](_0x14f3('0x66'),_0x2e9db2[_0x14f3('0x67')]['id'],_0x2e9db2[_0x14f3('0x67')]['name'],_0x2e9db2[_0x14f3('0x67')][_0x14f3('0x68')],_0x568d13['interaction']['id'],_0x2e9db2[_0x14f3('0x57')]?JSON['stringify'](_0x2e9db2[_0x14f3('0x57')]):_0x14f3('0x69'));return respondWithRpcPromise(_0x14f3('0x6a'),_0x14f3('0x6b'),_0x568d13);}return null;})[_0x14f3('0x20')](function(_0x2da9bd){var _0x22392a=_0x14f3('0x6c')+_0x2da9bd['message'][_0x14f3('0x6d')];return db[_0x14f3('0x6e')][_0x14f3('0x3c')](_0x22392a,{'type':db[_0x14f3('0x6f')][_0x14f3('0x70')][_0x14f3('0x71')],'raw':!![]})[_0x14f3('0x20')](function(_0x10fe34){return _0x10fe34;});})[_0x14f3('0x20')](function(_0x169c9c){if(_0x169c9c){_0x568d13[_0x14f3('0x28')][_0x14f3('0x72')]=_0x169c9c[0x0];if(!_0x2e9db2['body'][_0x14f3('0x5f')])return;return db['User']['find']({'where':{'id':_0x2e9db2[_0x14f3('0x57')][_0x14f3('0x5f')],'role':_0x14f3('0x73')},'attributes':['id',_0x14f3('0x35'),'fullname','email',_0x14f3('0x74')],'raw':!![]});}return null;})['then'](function(_0x16ae7e){if(!_0x16ae7e)return null;_0x568d13[_0x14f3('0x28')]['agent']=_0x16ae7e;return _0x568d13;})[_0x14f3('0x20')](function(_0x718a57){if(_0x718a57){if(_0x2e9db2[_0x14f3('0x57')][_0x14f3('0x75')]){_0x568d13[_0x14f3('0x28')][_0x14f3('0x76')]=util['format'](_0x14f3('0x77'),_0x2e9db2[_0x14f3('0x67')][_0x14f3('0x35')]);_0x568d13[_0x14f3('0x28')]['channel']=_0x568d13[_0x14f3('0x78')];_0x568d13['message']['motionChannel']=_0x568d13['channel'];_0x568d13[_0x14f3('0x28')][_0x14f3('0x79')]=_0x14f3('0x5b');return respondWithRpcPromise(_0x14f3('0x7a'),_0x14f3('0x7a'),{'event':_0x14f3('0x7b'),'message':_0x568d13[_0x14f3('0x28')]},client9002)['then'](function(){return _0x568d13;});}return _0x568d13;}return null;})[_0x14f3('0x20')](respondWithResult(_0x3f84ec,null))['catch'](handleError(_0x3f84ec,null));};var interaction_log=require(_0x14f3('0x12'))('sms-interactions');exports[_0x14f3('0x7c')]=function(_0x2dcc25,_0xfbe208,_0x415208){var _0x80a6d0={'agent':{},'channel':_0x14f3('0x7d')};if(_0x2dcc25['body']['id']){delete _0x2dcc25[_0x14f3('0x57')]['id'];}_0x2dcc25[_0x14f3('0x57')][_0x14f3('0x5f')]=_0x2dcc25['body'][_0x14f3('0x5f')]||_0x2dcc25['user']['id'];_0x80a6d0[_0x14f3('0x73')]['id']=_0x2dcc25[_0x14f3('0x57')]['UserId'];return db['SmsMessage'][_0x14f3('0x55')]({'where':{'id':_0x2dcc25[_0x14f3('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xfbe208,null))['then'](function(_0x2635e5){if(_0x2635e5){_0x80a6d0[_0x14f3('0x28')]=_0x2635e5[_0x14f3('0x65')]({'plain':!![]});return db[_0x14f3('0x60')][_0x14f3('0x55')]({'where':{'id':_0x2635e5[_0x14f3('0x61')]}});}return null;})[_0x14f3('0x20')](handleEntityNotFound(_0xfbe208,null))['then'](function(_0x5eea1c){if(_0x5eea1c){_0x80a6d0[_0x14f3('0x64')]=_0x5eea1c['get']({'plain':!![]});interaction_log['info'](_0x14f3('0x7e'),_0x2dcc25['user']['id'],_0x2dcc25['user'][_0x14f3('0x35')],_0x2dcc25['user'][_0x14f3('0x68')],_0x80a6d0[_0x14f3('0x64')]['id'],_0x2dcc25['body']?JSON[_0x14f3('0x26')](_0x2dcc25[_0x14f3('0x57')]):_0x14f3('0x69'));return respondWithRpcPromise(_0x14f3('0x7f'),_0x14f3('0x80'),_0x80a6d0);}return null;})['then'](function(_0x58f84d){var _0x27965c=_0x14f3('0x6c')+_0x58f84d[_0x14f3('0x28')][_0x14f3('0x6d')];return db[_0x14f3('0x6e')]['query'](_0x27965c,{'type':db[_0x14f3('0x6f')][_0x14f3('0x70')][_0x14f3('0x71')],'raw':!![]})[_0x14f3('0x20')](function(_0x2b0a9a){return _0x2b0a9a;});})[_0x14f3('0x20')](function(_0x49aea0){if(_0x49aea0){_0x80a6d0[_0x14f3('0x28')][_0x14f3('0x72')]=_0x49aea0[0x0];if(!_0x2dcc25[_0x14f3('0x57')][_0x14f3('0x5f')])return;return db[_0x14f3('0x81')][_0x14f3('0x55')]({'where':{'id':_0x2dcc25[_0x14f3('0x57')][_0x14f3('0x5f')],'role':_0x14f3('0x73')},'attributes':['id','name',_0x14f3('0x82'),_0x14f3('0x83'),_0x14f3('0x74')],'raw':!![]});}return null;})['then'](function(_0x40c0ab){if(!_0x40c0ab)return null;_0x80a6d0[_0x14f3('0x28')]['agent']=_0x40c0ab;return _0x80a6d0;})[_0x14f3('0x20')](function(_0x1416dc){if(_0x1416dc){_0x1416dc[_0x14f3('0x28')][_0x14f3('0x76')]=util['format']('SIP/%s',_0x2dcc25[_0x14f3('0x67')]['name']);_0x1416dc['message'][_0x14f3('0x78')]=_0x80a6d0['channel'];_0x1416dc[_0x14f3('0x28')][_0x14f3('0x84')]=_0x80a6d0['channel'];_0x1416dc[_0x14f3('0x28')]['event']=_0x14f3('0x7c');respondWithRpcPromise(_0x14f3('0x7a'),_0x14f3('0x7a'),{'event':_0x14f3('0x85'),'message':_0x1416dc[_0x14f3('0x28')]},client9002);return _0x80a6d0;}return null;})['then'](respondWithResult(_0xfbe208,null))[_0x14f3('0x2a')](handleError(_0xfbe208,null));};exports[_0x14f3('0x2c')]=function(_0x1d6764,_0x3604de,_0x44df23){if(_0x1d6764[_0x14f3('0x57')]['id']){delete _0x1d6764[_0x14f3('0x57')]['id'];}var _0x315d42;return db[_0x14f3('0x39')]['find']({'where':{'id':_0x1d6764['params']['id']}})[_0x14f3('0x20')](handleEntityNotFound(_0x3604de,null))[_0x14f3('0x20')](function(_0x41d17c){if(_0x41d17c){_0x315d42=_0x41d17c;return db[_0x14f3('0x86')]['find']({'where':{'id':_0x41d17c[_0x14f3('0x87')]}});}})['then'](handleEntityNotFound(_0x3604de,null))[_0x14f3('0x20')](function(_0x58e6af){if(_0x58e6af){logger[_0x14f3('0x24')](_0x14f3('0x25'),_0x14f3('0x2c'),_0x14f3('0x88'),_0x58e6af['type'],util[_0x14f3('0x89')](_0x1d6764['body'],{'showHidden':![],'depth':null}));switch(_0x58e6af[_0x14f3('0x49')]){case _0x14f3('0x8a'):if(_0x1d6764[_0x14f3('0x57')][_0x14f3('0x8b')]&&_0x1d6764['body'][_0x14f3('0x8b')]===_0x315d42[_0x14f3('0x8c')]){return _0x315d42[_0x14f3('0x34')]({'read':!![]});}else{logger[_0x14f3('0x27')](_0x14f3('0x8d'),_0x14f3('0x2c'),_0x14f3('0x8a'),util['inspect'](_0x1d6764[_0x14f3('0x57')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x1d6764[_0x14f3('0x57')][_0x14f3('0x8e')]&&_0x1d6764[_0x14f3('0x57')][_0x14f3('0x8e')]===_0x315d42[_0x14f3('0x8c')]&&_[_0x14f3('0x8f')]([_0x14f3('0x90'),_0x14f3('0x91')],_0x1d6764[_0x14f3('0x57')][_0x14f3('0x92')])>=0x0){return _0x315d42[_0x14f3('0x34')]({'read':!![]});}else{logger[_0x14f3('0x27')](_0x14f3('0x8d'),_0x14f3('0x2c'),_0x14f3('0x93'),util[_0x14f3('0x89')](_0x1d6764[_0x14f3('0x57')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x18aecc=_0x1d6764['body'][_0x14f3('0x94')][0x0];if(_0x18aecc[_0x14f3('0x2c')][_0x14f3('0x95')]===_0x14f3('0x96')){return _0x315d42[_0x14f3('0x34')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x14f3('0x2c'),_0x14f3('0x97'),util[_0x14f3('0x89')](_0x1d6764[_0x14f3('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x315d42;}})[_0x14f3('0x20')](respondWithResult(_0x3604de,null))['catch'](handleError(_0x3604de,null));}; \ No newline at end of file +var _0x5bc1=['User','email','manual','interface','SIP/%s','motionChannel','event','EventManager','acceptmessage','sms-interactions','reject','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','channel','rejectmessage','SmsAccount','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','delivered','plivio','results','groupName','infobip','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','destroy','name','send','index','map','SmsMessage','rawAttributes','key','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','options','create','body','update','find','describe','accept','sms','read','readAt','format','UserId','agent','SmsInteraction','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','get','user','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact'];(function(_0x432e9d,_0x2f97e9){var _0xe005bd=function(_0x51781f){while(--_0x51781f){_0x432e9d['push'](_0x432e9d['shift']());}};_0xe005bd(++_0x2f97e9);}(_0x5bc1,0xb5));var _0x15bc=function(_0x21fded,_0x203183){_0x21fded=_0x21fded-0x0;var _0x5927de=_0x5bc1[_0x21fded];return _0x5927de;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x15bc('0x0'));var zipdir=require(_0x15bc('0x1'));var jsonpatch=require(_0x15bc('0x2'));var rp=require(_0x15bc('0x3'));var moment=require(_0x15bc('0x4'));var BPromise=require(_0x15bc('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x15bc('0x6'));var sox=require(_0x15bc('0x7'));var csv=require(_0x15bc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x15bc('0x9'));var _=require('lodash');var squel=require(_0x15bc('0xa'));var crypto=require(_0x15bc('0xb'));var jsforce=require(_0x15bc('0xc'));var deskjs=require(_0x15bc('0xd'));var toCsv=require(_0x15bc('0x8'));var querystring=require(_0x15bc('0xe'));var Papa=require(_0x15bc('0xf'));var Redis=require(_0x15bc('0x10'));var authService=require(_0x15bc('0x11'));var qs=require(_0x15bc('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x15bc('0x13'));var logger=require(_0x15bc('0x14'))(_0x15bc('0x15'));var utils=require('../../config/utils');var config=require(_0x15bc('0x16'));var licenseUtil=require(_0x15bc('0x17'));var db=require(_0x15bc('0x18'))['db'];config[_0x15bc('0x19')]=_['defaults'](config[_0x15bc('0x19')],{'host':_0x15bc('0x1a'),'port':0x18eb});var socket=require(_0x15bc('0x1b'))(new Redis(config[_0x15bc('0x19')]));require(_0x15bc('0x1c'))[_0x15bc('0x1d')](socket);var jayson=require(_0x15bc('0x1e'));var client=jayson[_0x15bc('0x1f')][_0x15bc('0x20')]({'port':0x232c});var client9002=jayson[_0x15bc('0x1f')][_0x15bc('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x44b25f,_0x947132,_0x27574c,_0x5599a2){return new BPromise(function(_0x2a9b3b,_0x35edad){var _0x427212=_0x5599a2||client;return _0x427212[_0x15bc('0x21')](_0x44b25f,_0x27574c)[_0x15bc('0x22')](function(_0x25b54a){logger[_0x15bc('0x23')](_0x15bc('0x24'),_0x947132,_0x15bc('0x25'));logger[_0x15bc('0x26')](_0x15bc('0x27'),_0x947132,'request\x20sent',JSON[_0x15bc('0x28')](_0x25b54a));if(_0x25b54a['error']){if(_0x25b54a[_0x15bc('0x29')]['code']===0x1f4){logger[_0x15bc('0x29')](_0x15bc('0x24'),_0x947132,_0x25b54a[_0x15bc('0x29')]['message']);return _0x35edad(_0x25b54a[_0x15bc('0x29')]['message']);}logger[_0x15bc('0x29')](_0x15bc('0x24'),_0x947132,_0x25b54a[_0x15bc('0x29')][_0x15bc('0x2a')]);return _0x2a9b3b(_0x25b54a[_0x15bc('0x29')][_0x15bc('0x2a')]);}else{logger[_0x15bc('0x23')](_0x15bc('0x24'),_0x947132,'request\x20sent');_0x2a9b3b(_0x25b54a[_0x15bc('0x2b')][_0x15bc('0x2a')]);}})[_0x15bc('0x2c')](function(_0xbacc26){logger['error'](_0x15bc('0x24'),_0x947132,_0xbacc26);_0x35edad(_0xbacc26);});});}function respondWithStatusCode(_0x23a3d9,_0x1f82df){_0x1f82df=_0x1f82df||0xcc;return function(_0x1c91b7){if(_0x1c91b7){return _0x23a3d9[_0x15bc('0x2d')](_0x1f82df);}return _0x23a3d9['status'](_0x1f82df)[_0x15bc('0x2e')]();};}function respondWithResult(_0x5f3985,_0x22ba14){_0x22ba14=_0x22ba14||0xc8;return function(_0xe732a7){if(_0xe732a7){return _0x5f3985[_0x15bc('0x2f')](_0x22ba14)[_0x15bc('0x30')](_0xe732a7);}};}function respondWithFilteredResult(_0x21927c,_0x85fc9e){return function(_0x172529){if(_0x172529){var _0x1fcfa6=typeof _0x85fc9e['offset']===_0x15bc('0x31')&&typeof _0x85fc9e[_0x15bc('0x32')]===_0x15bc('0x31');var _0x2d3d3f=_0x172529[_0x15bc('0x33')];var _0x1d1234=_0x1fcfa6?0x0:_0x85fc9e[_0x15bc('0x34')];var _0x631ec7=_0x1fcfa6?_0x172529[_0x15bc('0x33')]:_0x85fc9e[_0x15bc('0x34')]+_0x85fc9e['limit'];var _0x48c5e5;if(_0x631ec7>=_0x2d3d3f){_0x631ec7=_0x2d3d3f;_0x48c5e5=0xc8;}else{_0x48c5e5=0xce;}_0x21927c['status'](_0x48c5e5);return _0x21927c[_0x15bc('0x35')](_0x15bc('0x36'),_0x1d1234+'-'+_0x631ec7+'/'+_0x2d3d3f)['json'](_0x172529);}return null;};}function patchUpdates(_0x4e78f3){return function(_0x2645d5){try{jsonpatch[_0x15bc('0x37')](_0x2645d5,_0x4e78f3,!![]);}catch(_0x567dab){return BPromise['reject'](_0x567dab);}return _0x2645d5[_0x15bc('0x38')]();};}function saveUpdates(_0x1a88e8,_0x283424){return function(_0x398cd8){if(_0x398cd8){return _0x398cd8['update'](_0x1a88e8)[_0x15bc('0x22')](function(_0x1e6bf3){return _0x1e6bf3;});}return null;};}function removeEntity(_0x5c1c8a,_0x29a8a9){return function(_0x37f6bc){if(_0x37f6bc){return _0x37f6bc[_0x15bc('0x39')]()[_0x15bc('0x22')](function(){_0x5c1c8a[_0x15bc('0x2f')](0xcc)[_0x15bc('0x2e')]();});}};}function handleEntityNotFound(_0x1e3c08,_0x4535d1){return function(_0x547f98){if(!_0x547f98){_0x1e3c08[_0x15bc('0x2d')](0x194);}return _0x547f98;};}function handleError(_0x3e5bb0,_0x2c6f20){_0x2c6f20=_0x2c6f20||0x1f4;return function(_0x1bc2fc){logger['error'](_0x1bc2fc['stack']);if(_0x1bc2fc[_0x15bc('0x3a')]){delete _0x1bc2fc['name'];}_0x3e5bb0[_0x15bc('0x2f')](_0x2c6f20)[_0x15bc('0x3b')](_0x1bc2fc);};}exports[_0x15bc('0x3c')]=function(_0x31ba52,_0x547726){var _0x1bef58={},_0x2e722e={},_0x252fe8={'count':0x0,'rows':[]};var _0x42f848=_[_0x15bc('0x3d')](db[_0x15bc('0x3e')][_0x15bc('0x3f')],function(_0x5aa74d){return{'name':_0x5aa74d['fieldName'],'type':_0x5aa74d['type'][_0x15bc('0x40')]};});_0x2e722e['model']=_[_0x15bc('0x3d')](_0x42f848,'name');_0x2e722e[_0x15bc('0x41')]=_['keys'](_0x31ba52[_0x15bc('0x41')]);_0x2e722e['filters']=_[_0x15bc('0x42')](_0x2e722e[_0x15bc('0x43')],_0x2e722e[_0x15bc('0x41')]);_0x1bef58[_0x15bc('0x44')]=_['intersection'](_0x2e722e[_0x15bc('0x43')],qs[_0x15bc('0x45')](_0x31ba52[_0x15bc('0x41')]['fields']));_0x1bef58[_0x15bc('0x44')]=_0x1bef58[_0x15bc('0x44')][_0x15bc('0x46')]?_0x1bef58['attributes']:_0x2e722e[_0x15bc('0x43')];if(!_0x31ba52[_0x15bc('0x41')][_0x15bc('0x47')]('nolimit')){_0x1bef58['limit']=qs[_0x15bc('0x32')](_0x31ba52[_0x15bc('0x41')][_0x15bc('0x32')]);_0x1bef58[_0x15bc('0x34')]=qs['offset'](_0x31ba52[_0x15bc('0x41')][_0x15bc('0x34')]);}_0x1bef58[_0x15bc('0x48')]=qs[_0x15bc('0x49')](_0x31ba52[_0x15bc('0x41')][_0x15bc('0x49')]);_0x1bef58[_0x15bc('0x4a')]=qs[_0x15bc('0x4b')](_[_0x15bc('0x4c')](_0x31ba52[_0x15bc('0x41')],_0x2e722e[_0x15bc('0x4b')]),_0x42f848);if(_0x31ba52['query'][_0x15bc('0x4d')]){_0x1bef58[_0x15bc('0x4a')]=_[_0x15bc('0x4e')](_0x1bef58[_0x15bc('0x4a')],{'$or':_[_0x15bc('0x3d')](_0x42f848,function(_0x58d6e4){if(_0x58d6e4[_0x15bc('0x4f')]!==_0x15bc('0x50')){var _0x15651b={};_0x15651b[_0x58d6e4['name']]={'$like':'%'+_0x31ba52[_0x15bc('0x41')][_0x15bc('0x4d')]+'%'};return _0x15651b;}})});}_0x1bef58=_['merge']({},_0x1bef58,_0x31ba52['options']);var _0x2a38b6={'where':_0x1bef58[_0x15bc('0x4a')]};return db[_0x15bc('0x3e')][_0x15bc('0x33')](_0x2a38b6)[_0x15bc('0x22')](function(_0x36602f){_0x252fe8[_0x15bc('0x33')]=_0x36602f;if(_0x31ba52[_0x15bc('0x41')][_0x15bc('0x51')]){_0x1bef58[_0x15bc('0x52')]=[{'all':!![]}];}return db[_0x15bc('0x3e')][_0x15bc('0x53')](_0x1bef58);})['then'](function(_0x38faa5){_0x252fe8[_0x15bc('0x54')]=_0x38faa5;return _0x252fe8;})[_0x15bc('0x22')](respondWithFilteredResult(_0x547726,_0x1bef58))[_0x15bc('0x2c')](handleError(_0x547726,null));};exports[_0x15bc('0x55')]=function(_0xe6f169,_0x942e1a){var _0x5b9642={'raw':!![],'where':{'id':_0xe6f169[_0x15bc('0x56')]['id']}},_0x25846c={};_0x25846c[_0x15bc('0x43')]=_[_0x15bc('0x57')](db[_0x15bc('0x3e')][_0x15bc('0x3f')]);_0x25846c[_0x15bc('0x41')]=_['keys'](_0xe6f169[_0x15bc('0x41')]);_0x25846c['filters']=_[_0x15bc('0x42')](_0x25846c[_0x15bc('0x43')],_0x25846c[_0x15bc('0x41')]);_0x5b9642[_0x15bc('0x44')]=_[_0x15bc('0x42')](_0x25846c[_0x15bc('0x43')],qs[_0x15bc('0x45')](_0xe6f169[_0x15bc('0x41')][_0x15bc('0x45')]));_0x5b9642[_0x15bc('0x44')]=_0x5b9642[_0x15bc('0x44')][_0x15bc('0x46')]?_0x5b9642[_0x15bc('0x44')]:_0x25846c['model'];if(_0xe6f169['query'][_0x15bc('0x51')]){_0x5b9642[_0x15bc('0x52')]=[{'all':!![]}];}_0x5b9642=_[_0x15bc('0x4e')]({},_0x5b9642,_0xe6f169[_0x15bc('0x58')]);return db[_0x15bc('0x3e')]['find'](_0x5b9642)[_0x15bc('0x22')](handleEntityNotFound(_0x942e1a,null))[_0x15bc('0x22')](respondWithResult(_0x942e1a,null))['catch'](handleError(_0x942e1a,null));};exports['create']=function(_0x2aef39,_0x283e49){return db['SmsMessage'][_0x15bc('0x59')](_0x2aef39[_0x15bc('0x5a')],{})[_0x15bc('0x22')](respondWithResult(_0x283e49,0xc9))[_0x15bc('0x2c')](handleError(_0x283e49,null));};exports[_0x15bc('0x5b')]=function(_0x584977,_0x5a5d5a){if(_0x584977['body']['id']){delete _0x584977[_0x15bc('0x5a')]['id'];}return db[_0x15bc('0x3e')]['find']({'where':{'id':_0x584977['params']['id']}})[_0x15bc('0x22')](handleEntityNotFound(_0x5a5d5a,null))[_0x15bc('0x22')](saveUpdates(_0x584977['body'],null))[_0x15bc('0x22')](respondWithResult(_0x5a5d5a,null))[_0x15bc('0x2c')](handleError(_0x5a5d5a,null));};exports[_0x15bc('0x39')]=function(_0x56f0a2,_0x214132){return db[_0x15bc('0x3e')][_0x15bc('0x5c')]({'where':{'id':_0x56f0a2[_0x15bc('0x56')]['id']}})[_0x15bc('0x22')](handleEntityNotFound(_0x214132,null))[_0x15bc('0x22')](removeEntity(_0x214132,null))[_0x15bc('0x2c')](handleError(_0x214132,null));};exports[_0x15bc('0x5d')]=function(_0x59b097,_0x470968){return db[_0x15bc('0x3e')]['describe']()[_0x15bc('0x22')](respondWithResult(_0x470968,null))[_0x15bc('0x2c')](handleError(_0x470968,null));};var interaction_log=require(_0x15bc('0x14'))('sms-interactions');exports[_0x15bc('0x5e')]=function(_0x1271b4,_0x379e57,_0x409e12){var _0x4e8700={'agent':{},'channel':_0x15bc('0x5f')};if(_0x1271b4[_0x15bc('0x5a')]['id']){delete _0x1271b4['body']['id'];}_0x1271b4[_0x15bc('0x5a')][_0x15bc('0x60')]=!![];_0x1271b4[_0x15bc('0x5a')][_0x15bc('0x61')]=moment()[_0x15bc('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x1271b4[_0x15bc('0x5a')][_0x15bc('0x63')]=_0x1271b4[_0x15bc('0x5a')][_0x15bc('0x63')]||_0x1271b4['user']['id'];_0x4e8700[_0x15bc('0x64')]['id']=_0x1271b4['body']['UserId'];return db[_0x15bc('0x3e')][_0x15bc('0x5c')]({'where':{'id':_0x1271b4[_0x15bc('0x56')]['id'],'UserId':null}})[_0x15bc('0x22')](handleEntityNotFound(_0x379e57,null))[_0x15bc('0x22')](saveUpdates(_0x1271b4[_0x15bc('0x5a')],null))[_0x15bc('0x22')](function(_0x13dc7c){if(_0x13dc7c){_0x4e8700[_0x15bc('0x2a')]=_0x13dc7c['get']({'plain':!![]});return db[_0x15bc('0x65')][_0x15bc('0x5c')]({'where':{'id':_0x13dc7c['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x379e57,null))['then'](function(_0x335940){if(_0x335940){return _0x335940[_0x15bc('0x5b')]({'UserId':_0x1271b4[_0x15bc('0x5a')][_0x15bc('0x63')],'read1stAt':_[_0x15bc('0x66')](_0x335940['read1stAt'])?moment()[_0x15bc('0x62')](_0x15bc('0x67')):undefined});}return null;})['then'](function(_0x3d7dda){if(_0x3d7dda){_0x4e8700[_0x15bc('0x68')]=_0x3d7dda[_0x15bc('0x69')]({'plain':!![]});interaction_log[_0x15bc('0x23')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1271b4['user']['id'],_0x1271b4[_0x15bc('0x6a')][_0x15bc('0x3a')],_0x1271b4[_0x15bc('0x6a')][_0x15bc('0x6b')],_0x4e8700[_0x15bc('0x68')]['id'],_0x1271b4[_0x15bc('0x5a')]?JSON[_0x15bc('0x28')](_0x1271b4['body']):_0x15bc('0x6c'));return respondWithRpcPromise(_0x15bc('0x6d'),_0x15bc('0x6e'),_0x4e8700);}return null;})['then'](function(_0x183c7d){var _0x592c7a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x183c7d[_0x15bc('0x2a')][_0x15bc('0x6f')];return db[_0x15bc('0x70')]['query'](_0x592c7a,{'type':db[_0x15bc('0x71')][_0x15bc('0x72')][_0x15bc('0x73')],'raw':!![]})[_0x15bc('0x22')](function(_0x42492b){return _0x42492b;});})[_0x15bc('0x22')](function(_0x308e93){if(_0x308e93){_0x4e8700[_0x15bc('0x2a')][_0x15bc('0x74')]=_0x308e93[0x0];if(!_0x1271b4['body'][_0x15bc('0x63')])return;return db[_0x15bc('0x75')]['find']({'where':{'id':_0x1271b4[_0x15bc('0x5a')][_0x15bc('0x63')],'role':'agent'},'attributes':['id',_0x15bc('0x3a'),'fullname',_0x15bc('0x76'),'internal'],'raw':!![]});}return null;})[_0x15bc('0x22')](function(_0x35d325){if(!_0x35d325)return null;_0x4e8700['message'][_0x15bc('0x64')]=_0x35d325;return _0x4e8700;})[_0x15bc('0x22')](function(_0x5eb48b){if(_0x5eb48b){if(_0x1271b4[_0x15bc('0x5a')][_0x15bc('0x77')]){_0x4e8700['message'][_0x15bc('0x78')]=util[_0x15bc('0x62')](_0x15bc('0x79'),_0x1271b4[_0x15bc('0x6a')]['name']);_0x4e8700[_0x15bc('0x2a')]['channel']=_0x4e8700['channel'];_0x4e8700[_0x15bc('0x2a')][_0x15bc('0x7a')]=_0x4e8700['channel'];_0x4e8700[_0x15bc('0x2a')][_0x15bc('0x7b')]=_0x15bc('0x5e');return respondWithRpcPromise(_0x15bc('0x7c'),_0x15bc('0x7c'),{'event':_0x15bc('0x7d'),'message':_0x4e8700[_0x15bc('0x2a')]},client9002)['then'](function(){return _0x4e8700;});}return _0x4e8700;}return null;})[_0x15bc('0x22')](respondWithResult(_0x379e57,null))[_0x15bc('0x2c')](handleError(_0x379e57,null));};var interaction_log=require(_0x15bc('0x14'))(_0x15bc('0x7e'));exports[_0x15bc('0x7f')]=function(_0x4454ca,_0x35f5ef,_0xeea4a9){var _0x317e62={'agent':{},'channel':_0x15bc('0x5f')};if(_0x4454ca[_0x15bc('0x5a')]['id']){delete _0x4454ca['body']['id'];}_0x4454ca['body']['UserId']=_0x4454ca['body'][_0x15bc('0x63')]||_0x4454ca[_0x15bc('0x6a')]['id'];_0x317e62[_0x15bc('0x64')]['id']=_0x4454ca[_0x15bc('0x5a')][_0x15bc('0x63')];return db[_0x15bc('0x3e')][_0x15bc('0x5c')]({'where':{'id':_0x4454ca['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x35f5ef,null))['then'](function(_0x11ff74){if(_0x11ff74){_0x317e62[_0x15bc('0x2a')]=_0x11ff74['get']({'plain':!![]});return db[_0x15bc('0x65')][_0x15bc('0x5c')]({'where':{'id':_0x11ff74[_0x15bc('0x80')]}});}return null;})[_0x15bc('0x22')](handleEntityNotFound(_0x35f5ef,null))[_0x15bc('0x22')](function(_0x2c5bda){if(_0x2c5bda){_0x317e62[_0x15bc('0x68')]=_0x2c5bda[_0x15bc('0x69')]({'plain':!![]});interaction_log['info'](_0x15bc('0x81'),_0x4454ca[_0x15bc('0x6a')]['id'],_0x4454ca[_0x15bc('0x6a')][_0x15bc('0x3a')],_0x4454ca['user'][_0x15bc('0x6b')],_0x317e62[_0x15bc('0x68')]['id'],_0x4454ca[_0x15bc('0x5a')]?JSON[_0x15bc('0x28')](_0x4454ca[_0x15bc('0x5a')]):_0x15bc('0x6c'));return respondWithRpcPromise(_0x15bc('0x82'),_0x15bc('0x83'),_0x317e62);}return null;})['then'](function(_0x2b38a5){var _0x32b6f5=_0x15bc('0x84')+_0x2b38a5['message'][_0x15bc('0x6f')];return db['sequelize'][_0x15bc('0x41')](_0x32b6f5,{'type':db['Sequelize'][_0x15bc('0x72')][_0x15bc('0x73')],'raw':!![]})['then'](function(_0x795062){return _0x795062;});})[_0x15bc('0x22')](function(_0x200f16){if(_0x200f16){_0x317e62[_0x15bc('0x2a')]['contact']=_0x200f16[0x0];if(!_0x4454ca[_0x15bc('0x5a')][_0x15bc('0x63')])return;return db[_0x15bc('0x75')][_0x15bc('0x5c')]({'where':{'id':_0x4454ca[_0x15bc('0x5a')][_0x15bc('0x63')],'role':_0x15bc('0x64')},'attributes':['id',_0x15bc('0x3a'),'fullname',_0x15bc('0x76'),'internal'],'raw':!![]});}return null;})['then'](function(_0x977e53){if(!_0x977e53)return null;_0x317e62[_0x15bc('0x2a')]['agent']=_0x977e53;return _0x317e62;})[_0x15bc('0x22')](function(_0x312992){if(_0x312992){_0x312992[_0x15bc('0x2a')]['interface']=util['format']('SIP/%s',_0x4454ca[_0x15bc('0x6a')][_0x15bc('0x3a')]);_0x312992[_0x15bc('0x2a')][_0x15bc('0x85')]=_0x317e62['channel'];_0x312992[_0x15bc('0x2a')]['motionChannel']=_0x317e62['channel'];_0x312992[_0x15bc('0x2a')]['event']=_0x15bc('0x7f');respondWithRpcPromise('EventManager',_0x15bc('0x7c'),{'event':_0x15bc('0x86'),'message':_0x312992[_0x15bc('0x2a')]},client9002);return _0x317e62;}return null;})[_0x15bc('0x22')](respondWithResult(_0x35f5ef,null))[_0x15bc('0x2c')](handleError(_0x35f5ef,null));};exports[_0x15bc('0x2f')]=function(_0x575a4f,_0x3e1bad,_0x114be9){if(_0x575a4f['body']['id']){delete _0x575a4f[_0x15bc('0x5a')]['id'];}var _0x3ffa3b;return db['SmsMessage'][_0x15bc('0x5c')]({'where':{'id':_0x575a4f[_0x15bc('0x56')]['id']}})[_0x15bc('0x22')](handleEntityNotFound(_0x3e1bad,null))[_0x15bc('0x22')](function(_0x55ac0a){if(_0x55ac0a){_0x3ffa3b=_0x55ac0a;return db[_0x15bc('0x87')]['find']({'where':{'id':_0x55ac0a['SmsAccountId']}});}})[_0x15bc('0x22')](handleEntityNotFound(_0x3e1bad,null))[_0x15bc('0x22')](function(_0x482d27){if(_0x482d27){logger[_0x15bc('0x26')](_0x15bc('0x27'),'status',_0x15bc('0x88'),_0x482d27[_0x15bc('0x4f')],util[_0x15bc('0x89')](_0x575a4f[_0x15bc('0x5a')],{'showHidden':![],'depth':null}));switch(_0x482d27['type']){case _0x15bc('0x8a'):if(_0x575a4f[_0x15bc('0x5a')][_0x15bc('0x8b')]&&_0x575a4f[_0x15bc('0x5a')][_0x15bc('0x8b')]===_0x3ffa3b[_0x15bc('0x8c')]){return _0x3ffa3b['update']({'read':!![]});}else{logger[_0x15bc('0x29')](_0x15bc('0x8d'),'status',_0x15bc('0x8a'),util[_0x15bc('0x89')](_0x575a4f[_0x15bc('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x15bc('0x8e'):if(_0x575a4f[_0x15bc('0x5a')]['MessageUUID']&&_0x575a4f[_0x15bc('0x5a')][_0x15bc('0x8f')]===_0x3ffa3b[_0x15bc('0x8c')]&&_['indexOf'](['sent',_0x15bc('0x90')],_0x575a4f[_0x15bc('0x5a')]['Status'])>=0x0){return _0x3ffa3b['update']({'read':!![]});}else{logger[_0x15bc('0x29')](_0x15bc('0x8d'),_0x15bc('0x2f'),_0x15bc('0x91'),util['inspect'](_0x575a4f[_0x15bc('0x5a')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x20b1a6=_0x575a4f[_0x15bc('0x5a')][_0x15bc('0x92')][0x0];if(_0x20b1a6['status'][_0x15bc('0x93')]==='DELIVERED'){return _0x3ffa3b[_0x15bc('0x5b')]({'read':!![]});}else{logger[_0x15bc('0x29')](_0x15bc('0x8d'),'status',_0x15bc('0x94'),util['inspect'](_0x575a4f[_0x15bc('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x3ffa3b;}})[_0x15bc('0x22')](respondWithResult(_0x3e1bad,null))[_0x15bc('0x2c')](handleError(_0x3e1bad,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 3156fa5..0a6631a 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 _0x92dd=['../../mysqldb','setMaxListeners','save','update','remove','emit','hook','events'];(function(_0xff81da,_0x5a25b8){var _0x478d3c=function(_0x2f12cb){while(--_0x2f12cb){_0xff81da['push'](_0xff81da['shift']());}};_0x478d3c(++_0x5a25b8);}(_0x92dd,0xe7));var _0xd92d=function(_0x36ee43,_0x440269){_0x36ee43=_0x36ee43-0x0;var _0x41b95a=_0x92dd[_0x36ee43];return _0x41b95a;};'use strict';var EventEmitter=require(_0xd92d('0x0'));var SmsMessage=require(_0xd92d('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xd92d('0x2')](0x0);var events={'afterCreate':_0xd92d('0x3'),'afterUpdate':_0xd92d('0x4'),'afterDestroy':_0xd92d('0x5')};function emitEvent(_0x525e13){return function(_0x18f558,_0x284f95,_0x5260e1){SmsMessageEvents[_0xd92d('0x6')](_0x525e13+':'+_0x18f558['id'],_0x18f558);SmsMessageEvents[_0xd92d('0x6')](_0x525e13,_0x18f558);_0x5260e1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xd92d('0x7')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0xba7d=['../../mysqldb','setMaxListeners','emit','exports'];(function(_0x5bf46b,_0x40e45d){var _0xd4a6a4=function(_0xa4ca6){while(--_0xa4ca6){_0x5bf46b['push'](_0x5bf46b['shift']());}};_0xd4a6a4(++_0x40e45d);}(_0xba7d,0x150));var _0xdba7=function(_0xec6167,_0x867fb9){_0xec6167=_0xec6167-0x0;var _0x1c3359=_0xba7d[_0xec6167];return _0x1c3359;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0xdba7('0x0'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xdba7('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5a4486){return function(_0x4b754e,_0x4c2b34,_0x4dee34){SmsMessageEvents[_0xdba7('0x2')](_0x5a4486+':'+_0x4b754e['id'],_0x4b754e);SmsMessageEvents[_0xdba7('0x2')](_0x5a4486,_0x4b754e);_0x4dee34(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xdba7('0x3')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 459e583..8b3e996 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 _0x9532=['md5','digest','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','UTF-8','apiMessageId','bandwidth','/messages','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','refid','intelepeer','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./smsMessage.attributes','sms_messages','fti_sms_messages','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','SmsInteraction','update','createdAt','catch','error','out','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','body','remote','/status?token=','token','then','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','https://api.skebby.it/API/v1.0/REST/','username','password','sender','login?username=','&password=','GET','split','sms','POST','user_key','total_sent','internal_order_id','smsMethod','deliveryReport','read','inspect','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','clickSend','plivo','/api/sms/messages/','authId','https://api.plivo.com/v1/Account/%s/Message/','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','messageId','csc','crypto','login','text','timestamp','keys','sort','length','apiKey'];(function(_0x481df5,_0x216652){var _0x32726e=function(_0x2133f4){while(--_0x2133f4){_0x481df5['push'](_0x481df5['shift']());}};_0x32726e(++_0x216652);}(_0x9532,0x8c));var _0x2953=function(_0x5f0e22,_0x1464bf){_0x5f0e22=_0x5f0e22-0x0;var _0x5582b1=_0x9532[_0x5f0e22];return _0x5582b1;};'use strict';var _=require(_0x2953('0x0'));var util=require(_0x2953('0x1'));var logger=require(_0x2953('0x2'))(_0x2953('0x3'));var moment=require(_0x2953('0x4'));var BPromise=require(_0x2953('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2953('0x6'));var rimraf=require(_0x2953('0x7'));var config=require('../../config/environment');var attributes=require(_0x2953('0x8'));module['exports']=function(_0x12de4a,_0x451c3c){return _0x12de4a['define']('SmsMessage',attributes,{'tableName':_0x2953('0x9'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0x2953('0xa'),'fields':['body'],'type':_0x2953('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x14e355,_0x20d976,_0xcc4af4){var _0x4c9cd8=_0x12de4a[_0x2953('0xc')];var _0x433b1d=_0x14e355[_0x2953('0xd')]({'plain':!![]});if(_0x433b1d[_0x2953('0xe')][_0x2953('0xf')]()==='in'||_0x433b1d[_0x2953('0xe')]['toLowerCase']()==='out'&&!_0x433b1d[_0x2953('0x10')]&&!_[_0x2953('0x11')](_0x433b1d['UserId'])){_0x4c9cd8[_0x2953('0x12')]['findOne']({'where':{'id':_0x433b1d['SmsInteractionId']}})['then'](function(_0x4e1e86){if(_0x4e1e86){_0x4e1e86[_0x2953('0x13')]({'lastMsgAt':_0x433b1d[_0x2953('0x14')],'lastMsgDirection':_0x433b1d[_0x2953('0xe')][_0x2953('0xf')]()});}})[_0x2953('0x15')](function(_0x4b9da7){console[_0x2953('0x16')](_0x4b9da7);});}if(_0x433b1d[_0x2953('0xe')]===_0x2953('0x17')&&!_0x433b1d[_0x2953('0x10')]){var _0x25dad2;_0x4c9cd8[_0x2953('0x18')][_0x2953('0x19')]({'where':{'id':_0x433b1d[_0x2953('0x1a')]},'raw':!![]})['then'](function(_0x2b9c97){_0x25dad2=_0x2b9c97;if(_0x25dad2&&_0x25dad2[_0x2953('0x1b')]){switch(_0x25dad2[_0x2953('0x1b')]){case _0x2953('0x1c'):var _0x2f303f=require(_0x2953('0x1c'));if(_0x25dad2[_0x2953('0x1d')]&&_0x25dad2[_0x2953('0x1e')]&&_0x25dad2[_0x2953('0x1f')]){var _0x68d656=new _0x2f303f(_0x25dad2[_0x2953('0x1d')],_0x25dad2[_0x2953('0x1e')]);_0x68d656[_0x2953('0x20')][_0x2953('0x21')]({'body':_0x433b1d[_0x2953('0x22')],'to':_0x433b1d['phone'],'from':_0x25dad2[_0x2953('0x1f')],'statusCallback':_0x25dad2[_0x2953('0x23')]+'/api/sms/messages/'+_0x433b1d['id']+_0x2953('0x24')+_0x25dad2[_0x2953('0x25')]})[_0x2953('0x26')](function(_0x25857e){if(_0x25857e[_0x2953('0x27')]){return _0x14e355[_0x2953('0x13')]({'messageId':_0x25857e[_0x2953('0x27')]});}})[_0x2953('0x15')](function(_0x3a7ae5){logger[_0x2953('0x16')](_0x2953('0x28'),'afterCreate',_0x2953('0x1c'),util['inspect'](_0x3a7ae5,{'showHidden':![],'depth':null}));});}else{logger[_0x2953('0x16')](_0x2953('0x28'),_0x2953('0x29'),_0x2953('0x1c'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'skebby':var _0x20e1c6=_0x2953('0x2a');if(_0x25dad2[_0x2953('0x2b')]&&_0x25dad2[_0x2953('0x2c')]){var _0x35040d={'recipient':[_0x433b1d[_0x2953('0x1f')]],'message':_0x433b1d[_0x2953('0x22')],'message_type':_0x25dad2['smsMethod']};if(_0x25dad2['smsMethod']&&_0x25dad2['smsMethod']!=='SI'){_0x35040d[_0x2953('0x2d')]=_0x25dad2[_0x2953('0x1f')];}var _0x4575db={'url':_0x20e1c6+_0x2953('0x2e')+_0x25dad2['username']+_0x2953('0x2f')+_0x25dad2[_0x2953('0x2c')],'method':_0x2953('0x30')};rp(_0x4575db)[_0x2953('0x26')](function(_0x4c808b){var _0x4525a2=_0x4c808b[_0x2953('0x31')](';');var _0x2245f8={'user_key':_0x4525a2[0x0],'session_key':_0x4525a2[0x1]};_0x4575db={'url':_0x20e1c6+_0x2953('0x32'),'method':_0x2953('0x33'),'headers':{'user_key':_0x2245f8[_0x2953('0x34')],'Session_key':_0x2245f8['session_key']},'json':!![],'body':_0x35040d};return rp(_0x4575db);})[_0x2953('0x26')](function(_0x2fb133){if(_0x2fb133[_0x2953('0x35')]>=0x1){var _0x216f01={'messageId':_0x2fb133[_0x2953('0x36')]};if(_0x25dad2[_0x2953('0x37')]!=='GP'||!_0x25dad2[_0x2953('0x38')]){_0x216f01[_0x2953('0x39')]=!![];}return _0x14e355[_0x2953('0x13')](_0x216f01);}else{return logger['error'](_0x2953('0x28'),_0x2953('0x29'),'skebby',util[_0x2953('0x3a')](_0x2fb133,{'showHidden':![],'depth':null}));}})[_0x2953('0x15')](function(_0x1b35e5){return logger['error'](_0x2953('0x28'),_0x2953('0x29'),_0x2953('0x3b'),util[_0x2953('0x3a')](_0x1b35e5,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x2953('0x28'),_0x2953('0x29'),_0x2953('0x3b'),_0x2953('0x3c'));}break;case _0x2953('0x3d'):if(_0x25dad2[_0x2953('0x1e')]){var _0x48b447={'recipient':_0x433b1d[_0x2953('0x1f')],'message':_0x433b1d[_0x2953('0x22')],'sender':_0x25dad2[_0x2953('0x3e')]||_0x25dad2[_0x2953('0x1f')],'authorization':_0x25dad2['authToken']};var _0x20d976={'method':_0x2953('0x33'),'uri':_0x2953('0x3f'),'body':_0x48b447,'json':!![]};rp(_0x20d976)[_0x2953('0x26')](function(_0x31c61f){var _0x40f2d3={'messageId':_0x31c61f['requestid']};if(!_0x25dad2[_0x2953('0x38')]){_0x40f2d3[_0x2953('0x39')]=!![];}return _0x14e355[_0x2953('0x13')](_0x40f2d3);})['catch'](function(_0x4f658c){logger['error'](_0x2953('0x28'),_0x2953('0x29'),_0x2953('0x3d'),util['inspect'](_0x4f658c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x2953('0x28'),_0x2953('0x29'),_0x2953('0x3d'),_0x2953('0x40'));}break;case _0x2953('0x41'):if(_0x25dad2['username']&&_0x25dad2[_0x2953('0x2c')]){var _0x48b447={'messages':[{'source':_0x2953('0x42'),'to':_0x433b1d[_0x2953('0x1f')],'body':_0x433b1d[_0x2953('0x22')],'from':_0x25dad2[_0x2953('0x3e')]||_0x25dad2[_0x2953('0x1f')]}]};var _0x4d2a2e=util[_0x2953('0x43')](_0x2953('0x44'),_0x25dad2['username'],_0x25dad2[_0x2953('0x2c')]);var _0x20d976={'method':_0x2953('0x33'),'uri':_0x2953('0x45'),'body':_0x48b447,'headers':{'Authorization':util['format'](_0x2953('0x46'),new Buffer(_0x4d2a2e)[_0x2953('0x47')](_0x2953('0x48')))},'json':!![]};rp(_0x20d976)[_0x2953('0x26')](function(_0x430f37){if(_0x430f37[_0x2953('0x49')]>=0xc8&&_0x430f37[_0x2953('0x49')]<=0xce){if(_0x430f37[_0x2953('0x4a')]&&_0x430f37[_0x2953('0x4a')][_0x2953('0x4b')]>0x0){var _0x49f79c=_[_0x2953('0x4c')](_0x430f37['data']['messages']);var _0x365e32={'messageId':_0x49f79c['message_id']};if(!_0x25dad2[_0x2953('0x38')]){_0x365e32[_0x2953('0x39')]=!![];}return _0x14e355[_0x2953('0x13')](_0x365e32);}else{logger[_0x2953('0x16')](_0x2953('0x28'),_0x2953('0x29'),_0x2953('0x4d'),util['inspect'](_0x430f37,{'showHidden':![],'depth':null}));}}else{logger[_0x2953('0x16')](_0x2953('0x28'),_0x2953('0x29'),_0x2953('0x4d'),util[_0x2953('0x3a')](_0x430f37,{'showHidden':![],'depth':null}));}})[_0x2953('0x15')](function(_0x331961){logger[_0x2953('0x16')](_0x2953('0x28'),_0x2953('0x29'),_0x2953('0x4d'),util[_0x2953('0x3a')](_0x331961,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2953('0x29'),_0x2953('0x4d'),_0x2953('0x3c'));}break;case _0x2953('0x4e'):if(_0x25dad2['authId']&&_0x25dad2['authToken']){var _0x48b447={'dst':_0x433b1d['phone'],'text':_0x433b1d[_0x2953('0x22')],'src':_0x25dad2[_0x2953('0x3e')]||_0x25dad2['phone'],'url':_0x25dad2[_0x2953('0x23')]+_0x2953('0x4f')+_0x433b1d['id']+_0x2953('0x24')+_0x25dad2['token']};var _0x4d2a2e=util[_0x2953('0x43')](_0x2953('0x44'),_0x25dad2[_0x2953('0x50')],_0x25dad2[_0x2953('0x1e')]);var _0x20d976={'method':_0x2953('0x33'),'uri':util[_0x2953('0x43')](_0x2953('0x51'),_0x25dad2[_0x2953('0x50')]),'body':_0x48b447,'headers':{'Authorization':util[_0x2953('0x43')](_0x2953('0x46'),new Buffer(_0x4d2a2e)[_0x2953('0x47')]('base64'))},'json':!![]};rp(_0x20d976)['then'](function(_0x226567){var _0x5db7a8={'messageId':_0x226567['message_uuid'][0x0]};return _0x14e355['update'](_0x5db7a8);})['catch'](function(_0x2034b8){logger[_0x2953('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2953('0x29'),_0x2953('0x4e'),util[_0x2953('0x3a')](_0x2034b8,{'showHidden':![],'depth':null}));});}else{logger[_0x2953('0x16')](_0x2953('0x28'),_0x2953('0x29'),_0x2953('0x4e'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x2953('0x52'):if(_0x25dad2['username']&&_0x25dad2[_0x2953('0x2c')]){if(_0x25dad2[_0x2953('0x53')]){var _0x5b8966={'method':_0x2953('0x33'),'uri':_0x25dad2[_0x2953('0x53')]+_0x2953('0x54'),'body':{'username':_0x25dad2[_0x2953('0x2b')],'password':_0x25dad2[_0x2953('0x2c')]},'json':!![]};return rp(_0x5b8966)[_0x2953('0x26')](function(_0xfe59df){var _0x219e37={'method':_0x2953('0x33'),'uri':_0x25dad2[_0x2953('0x53')]+_0x2953('0x55'),'body':{'messages':[{'from':_0x25dad2[_0x2953('0x1f')],'destinations':[{'to':_0x433b1d[_0x2953('0x1f')]}],'text':_0x433b1d[_0x2953('0x22')],'notifyUrl':_0x25dad2['remote']+_0x2953('0x4f')+_0x433b1d['id']+_0x2953('0x24')+_0x25dad2[_0x2953('0x25')],'notifyContentType':_0x2953('0x56'),'callbackData':_0x25dad2[_0x2953('0x1f')]+';'+_0x433b1d[_0x2953('0x22')]}]},'headers':{'Authorization':_0x2953('0x57')+_0xfe59df['token']},'json':!![]};return rp(_0x219e37)[_0x2953('0x26')](function(_0x22a248){if(_0x22a248[_0x2953('0x20')]){var _0x32a59d={'messageId':_0x22a248[_0x2953('0x20')][0x0][_0x2953('0x58')]};if(!_0x25dad2[_0x2953('0x38')]){_0x32a59d[_0x2953('0x39')]=!![];}return _0x14e355[_0x2953('0x13')](_0x32a59d);}else{return logger[_0x2953('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2953('0x29'),_0x2953('0x52'),util['inspect'](_0x22a248,{'showHidden':![],'depth':null}));}});})[_0x2953('0x15')](function(_0x5c80a8){return logger[_0x2953('0x16')](_0x2953('0x28'),_0x2953('0x29'),_0x2953('0x52'),util[_0x2953('0x3a')](_0x5c80a8,{'showHidden':![],'depth':null}));});}else{logger[_0x2953('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x2953('0x52'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x2953('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2953('0x29'),_0x2953('0x52'),_0x2953('0x3c'));}break;case _0x2953('0x59'):var _0x5889c8=require(_0x2953('0x5a'));if(_0x25dad2['apiKey']){var _0x1fbcca={};_0x1fbcca[_0x2953('0x5b')]=_0x25dad2['username'];_0x1fbcca[_0x2953('0x1f')]=_0x433b1d[_0x2953('0x1f')];_0x1fbcca[_0x2953('0x2d')]=_0x25dad2['phone'];_0x1fbcca[_0x2953('0x5c')]=_0x433b1d['body'];_0x1fbcca[_0x2953('0x5d')]=+new Date();var _0x41be25='';var _0xd6399e='';var _0x313520=Object[_0x2953('0x5e')](_0x1fbcca);_0x313520[_0x2953('0x5f')]();for(var _0x5e8aab=0x0;_0x5e8aab<_0x313520[_0x2953('0x60')];_0x5e8aab++){if(_0x41be25!=''){_0x41be25+='&';}_0x41be25+=_0x313520[_0x5e8aab]+'='+encodeURIComponent(_0x1fbcca[_0x313520[_0x5e8aab]]);_0xd6399e+=_0x1fbcca[_0x313520[_0x5e8aab]];}_0xd6399e+=_0x25dad2[_0x2953('0x61')];_0xd6399e=_0x5889c8['createHash'](_0x2953('0x62'))[_0x2953('0x13')](_0xd6399e)[_0x2953('0x63')](_0x2953('0x64'));if(_0x41be25!==''){_0x41be25+='&';}_0x41be25+=_0x2953('0x65')+_0xd6399e;var _0x4575db={'method':_0x2953('0x30'),'uri':_0x25dad2[_0x2953('0x53')]+_0x2953('0x66')+_0x41be25,'json':!![]};return rp(_0x4575db)[_0x2953('0x26')](function(_0x317fc9){var _0x3eb4f5=Object[_0x2953('0x5e')](_0x317fc9);if(_0x317fc9[_0x3eb4f5[0x0]][_0x2953('0x16')]&&parseInt(_0x317fc9[_0x3eb4f5[0x0]][_0x2953('0x16')])===0x0){var _0x5793d4={'messageId':_0x317fc9[_0x3eb4f5[0x0]][_0x2953('0x67')]};if(!_0x25dad2[_0x2953('0x38')]){_0x5793d4[_0x2953('0x39')]=!![];}return _0x14e355[_0x2953('0x13')](_0x5793d4);}else{return logger[_0x2953('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x2953('0x59'),util[_0x2953('0x3a')](_0x317fc9[_0x2953('0x16')],{'showHidden':![],'depth':null}));}})[_0x2953('0x15')](function(_0x462c75){return logger[_0x2953('0x16')](_0x2953('0x28'),'afterCreate',_0x2953('0x59'),util['inspect'](_0x462c75,{'showHidden':![],'depth':null}));});}else{logger[_0x2953('0x16')](_0x2953('0x28'),_0x2953('0x29'),_0x2953('0x59'),_0x2953('0x68'));}break;case _0x2953('0x69'):if(_0x25dad2['apiKey']){var _0x8cfc1e={'method':_0x2953('0x33'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x25dad2[_0x2953('0x61')]},'body':{'content':_0x433b1d[_0x2953('0x22')],'to':[_0x433b1d[_0x2953('0x1f')]],'from':_0x25dad2[_0x2953('0x1f')],'binary':![],'clientMessageId':'uuid','charset':_0x2953('0x6a')},'json':!![]};rp(_0x8cfc1e)[_0x2953('0x26')](function(_0x527c13){if(!_0x527c13[_0x2953('0x16')]){var _0x3f82c2={'messageId':_0x527c13[_0x2953('0x20')][0x0][_0x2953('0x6b')]};if(!_0x25dad2['deliveryReport']){_0x3f82c2[_0x2953('0x39')]=!![];}return _0x14e355[_0x2953('0x13')](_0x3f82c2);}else{return logger[_0x2953('0x16')](_0x2953('0x28'),'afterCreate','clickatell',util[_0x2953('0x3a')](_0x527c13[_0x2953('0x16')],{'showHidden':![],'depth':null}));}})[_0x2953('0x15')](function(_0xaf9050){return logger['error'](_0x2953('0x28'),'afterCreate',_0x2953('0x69'),util[_0x2953('0x3a')](_0xaf9050,{'showHidden':![],'depth':null}));});}else{logger[_0x2953('0x16')](_0x2953('0x28'),_0x2953('0x29'),_0x2953('0x69'),_0x2953('0x68'));}break;case _0x2953('0x6c'):if(_0x25dad2[_0x2953('0x2b')]&&_0x25dad2[_0x2953('0x2c')]){var _0x4d2a2e=util[_0x2953('0x43')](_0x2953('0x44'),_0x25dad2['username'],_0x25dad2[_0x2953('0x2c')]);var _0x20d976={'method':'POST','uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x25dad2['accountId']+_0x2953('0x6d'),'body':{'to':[_0x433b1d[_0x2953('0x1f')]],'text':_0x433b1d['body'],'from':_0x25dad2[_0x2953('0x1f')],'applicationId':_0x25dad2['applicationId']},'headers':{'Authorization':util[_0x2953('0x43')](_0x2953('0x46'),new Buffer(_0x4d2a2e)[_0x2953('0x47')](_0x2953('0x48')))},'json':!![]};rp(_0x20d976)[_0x2953('0x26')](function(_0x407c9e){if(_0x407c9e['id']){var _0x28bef4={'messageId':_0x407c9e['id']};return _0x14e355[_0x2953('0x13')](_0x28bef4);}else{logger[_0x2953('0x16')](_0x2953('0x28'),'afterCreate',_0x2953('0x6c'),util[_0x2953('0x3a')](_0x407c9e,{'showHidden':![],'depth':null}));}})[_0x2953('0x15')](function(_0x172c63){logger[_0x2953('0x16')](_0x2953('0x28'),_0x2953('0x29'),_0x2953('0x6c'),util[_0x2953('0x3a')](_0x172c63,{'showHidden':![],'depth':null}));});}else{logger[_0x2953('0x16')](_0x2953('0x28'),'afterCreate',_0x2953('0x6c'),'Missing\x20parameters:\x20username,\x20password');}break;case'intelepeer':if(_0x25dad2[_0x2953('0x61')]){var _0x5a0633={};var _0x4575db={'method':_0x2953('0x33'),'uri':_0x2953('0x6e'),'headers':{'Authorization':_0x2953('0x6f')+_0x25dad2[_0x2953('0x61')],'Content-Type':_0x2953('0x56')},'body':{'from':_0x25dad2[_0x2953('0x1f')],'to':_0x433b1d[_0x2953('0x1f')],'text':_0x433b1d[_0x2953('0x22')]},'json':!![]};return rp(_0x4575db)['then'](function(_0x484ee0){if(_0x484ee0[_0x2953('0x70')]==0xca){_0x5a0633[_0x2953('0x71')]=_0x484ee0;var _0x215d8b={'method':_0x2953('0x33'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x2953('0x6f')+_0x25dad2['apiKey'],'Content-Type':_0x2953('0x56')},'body':{'refid':_0x5a0633[_0x2953('0x71')][_0x2953('0x72')]},'json':!![]};return rp(_0x215d8b)[_0x2953('0x26')](function(_0x4186c4){_0x5a0633['status']=_0x4186c4;var _0x5ea250={'messageId':_0x5a0633[_0x2953('0x71')]['refid'],'read':!![]};return _0x14e355[_0x2953('0x13')](_0x5ea250);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2953('0x29'),_0x2953('0x73'),util[_0x2953('0x3a')](_0x484ee0,{'showHidden':![],'depth':null}));}})[_0x2953('0x15')](function(_0x334150){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2953('0x29'),_0x2953('0x73'),util[_0x2953('0x3a')](_0x334150,{'showHidden':![],'depth':null}));});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x2953('0x73'),_0x2953('0x74'));}break;}}})['finally'](function(){_0xcc4af4();});}else{_0xcc4af4();}}},'charset':_0x2953('0x75'),'collate':_0x2953('0x76')});}; \ No newline at end of file +var _0xc423=['toLowerCase','out','secret','isNil','SmsInteraction','SmsInteractionId','then','createdAt','find','SmsAccountId','type','twilio','authToken','phone','accountSid','messages','remote','/api/sms/messages/','/status?token=','token','sid','update','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','error','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','body','smsMethod','login?username=','split','sms','POST','user_key','total_sent','internal_order_id','read','inspect','Missing\x20parameters:\x20username,\x20password','senderString','requestid','deliveryReport','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','toString','base64','http_code','data','queued_count','head','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','sort','md5','digest','hex','signature=','GET','/external/get/send.php?','keys','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','applicationId','intelepeer','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','status','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','models','get','direction'];(function(_0x2af4d0,_0x2c1ba3){var _0x1ed7e2=function(_0x21c7a4){while(--_0x21c7a4){_0x2af4d0['push'](_0x2af4d0['shift']());}};_0x1ed7e2(++_0x2c1ba3);}(_0xc423,0x159));var _0x3c42=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xc423[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x3c42('0x0'));var util=require(_0x3c42('0x1'));var logger=require(_0x3c42('0x2'))(_0x3c42('0x3'));var moment=require(_0x3c42('0x4'));var BPromise=require('bluebird');var rp=require(_0x3c42('0x5'));var fs=require('fs');var path=require(_0x3c42('0x6'));var rimraf=require(_0x3c42('0x7'));var config=require('../../config/environment');var attributes=require(_0x3c42('0x8'));module[_0x3c42('0x9')]=function(_0x14e395,_0x1feba8){return _0x14e395[_0x3c42('0xa')](_0x3c42('0xb'),attributes,{'tableName':_0x3c42('0xc'),'paranoid':![],'indexes':[{'name':_0x3c42('0xd'),'fields':['messageId']},{'name':_0x3c42('0xe'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x132678,_0x431008,_0x10b712){var _0x44d428=_0x14e395[_0x3c42('0xf')];var _0x22da95=_0x132678[_0x3c42('0x10')]({'plain':!![]});if(_0x22da95[_0x3c42('0x11')]['toLowerCase']()==='in'||_0x22da95[_0x3c42('0x11')][_0x3c42('0x12')]()===_0x3c42('0x13')&&!_0x22da95[_0x3c42('0x14')]&&!_[_0x3c42('0x15')](_0x22da95['UserId'])){_0x44d428[_0x3c42('0x16')]['findOne']({'where':{'id':_0x22da95[_0x3c42('0x17')]}})[_0x3c42('0x18')](function(_0x475d11){if(_0x475d11){_0x475d11['update']({'lastMsgAt':_0x22da95[_0x3c42('0x19')],'lastMsgDirection':_0x22da95[_0x3c42('0x11')]['toLowerCase']()});}})['catch'](function(_0x34ef38){console['error'](_0x34ef38);});}if(_0x22da95[_0x3c42('0x11')]==='out'&&!_0x22da95[_0x3c42('0x14')]){var _0x469af7;_0x44d428['SmsAccount'][_0x3c42('0x1a')]({'where':{'id':_0x22da95[_0x3c42('0x1b')]},'raw':!![]})[_0x3c42('0x18')](function(_0x3e1580){_0x469af7=_0x3e1580;if(_0x469af7&&_0x469af7[_0x3c42('0x1c')]){switch(_0x469af7[_0x3c42('0x1c')]){case _0x3c42('0x1d'):var _0x32a25e=require(_0x3c42('0x1d'));if(_0x469af7['accountSid']&&_0x469af7[_0x3c42('0x1e')]&&_0x469af7[_0x3c42('0x1f')]){var _0x2375cf=new _0x32a25e(_0x469af7[_0x3c42('0x20')],_0x469af7['authToken']);_0x2375cf[_0x3c42('0x21')]['create']({'body':_0x22da95['body'],'to':_0x22da95[_0x3c42('0x1f')],'from':_0x469af7[_0x3c42('0x1f')],'statusCallback':_0x469af7[_0x3c42('0x22')]+_0x3c42('0x23')+_0x22da95['id']+_0x3c42('0x24')+_0x469af7[_0x3c42('0x25')]})[_0x3c42('0x18')](function(_0x1902d8){if(_0x1902d8[_0x3c42('0x26')]){return _0x132678[_0x3c42('0x27')]({'messageId':_0x1902d8[_0x3c42('0x26')]});}})[_0x3c42('0x28')](function(_0x2d1f81){logger['error'](_0x3c42('0x29'),_0x3c42('0x2a'),_0x3c42('0x1d'),util['inspect'](_0x2d1f81,{'showHidden':![],'depth':null}));});}else{logger[_0x3c42('0x2b')](_0x3c42('0x29'),_0x3c42('0x2a'),_0x3c42('0x1d'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x3c42('0x2c'):var _0x282013=_0x3c42('0x2d');if(_0x469af7[_0x3c42('0x2e')]&&_0x469af7[_0x3c42('0x2f')]){var _0xf53177={'recipient':[_0x22da95['phone']],'message':_0x22da95[_0x3c42('0x30')],'message_type':_0x469af7[_0x3c42('0x31')]};if(_0x469af7[_0x3c42('0x31')]&&_0x469af7['smsMethod']!=='SI'){_0xf53177['sender']=_0x469af7[_0x3c42('0x1f')];}var _0x2624e1={'url':_0x282013+_0x3c42('0x32')+_0x469af7[_0x3c42('0x2e')]+'&password='+_0x469af7[_0x3c42('0x2f')],'method':'GET'};rp(_0x2624e1)[_0x3c42('0x18')](function(_0x3c1606){var _0x2559df=_0x3c1606[_0x3c42('0x33')](';');var _0x1ae6c0={'user_key':_0x2559df[0x0],'session_key':_0x2559df[0x1]};_0x2624e1={'url':_0x282013+_0x3c42('0x34'),'method':_0x3c42('0x35'),'headers':{'user_key':_0x1ae6c0[_0x3c42('0x36')],'Session_key':_0x1ae6c0['session_key']},'json':!![],'body':_0xf53177};return rp(_0x2624e1);})[_0x3c42('0x18')](function(_0x4005c3){if(_0x4005c3[_0x3c42('0x37')]>=0x1){var _0x240f9f={'messageId':_0x4005c3[_0x3c42('0x38')]};if(_0x469af7['smsMethod']!=='GP'||!_0x469af7['deliveryReport']){_0x240f9f[_0x3c42('0x39')]=!![];}return _0x132678[_0x3c42('0x27')](_0x240f9f);}else{return logger[_0x3c42('0x2b')](_0x3c42('0x29'),'afterCreate',_0x3c42('0x2c'),util[_0x3c42('0x3a')](_0x4005c3,{'showHidden':![],'depth':null}));}})['catch'](function(_0x359a58){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3c42('0x2a'),'skebby',util[_0x3c42('0x3a')](_0x359a58,{'showHidden':![],'depth':null}));});}else{logger[_0x3c42('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3c42('0x2a'),_0x3c42('0x2c'),_0x3c42('0x3b'));}break;case'connectel':if(_0x469af7[_0x3c42('0x1e')]){var _0x1aca8a={'recipient':_0x22da95['phone'],'message':_0x22da95[_0x3c42('0x30')],'sender':_0x469af7[_0x3c42('0x3c')]||_0x469af7[_0x3c42('0x1f')],'authorization':_0x469af7['authToken']};var _0x431008={'method':_0x3c42('0x35'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x1aca8a,'json':!![]};rp(_0x431008)[_0x3c42('0x18')](function(_0xaaeea8){var _0xc7f461={'messageId':_0xaaeea8[_0x3c42('0x3d')]};if(!_0x469af7[_0x3c42('0x3e')]){_0xc7f461[_0x3c42('0x39')]=!![];}return _0x132678['update'](_0xc7f461);})[_0x3c42('0x28')](function(_0xc34f9c){logger[_0x3c42('0x2b')](_0x3c42('0x29'),_0x3c42('0x2a'),'connectel',util[_0x3c42('0x3a')](_0xc34f9c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3c42('0x29'),'afterCreate','connectel',_0x3c42('0x3f'));}break;case _0x3c42('0x40'):if(_0x469af7[_0x3c42('0x2e')]&&_0x469af7[_0x3c42('0x2f')]){var _0x1aca8a={'messages':[{'source':_0x3c42('0x41'),'to':_0x22da95[_0x3c42('0x1f')],'body':_0x22da95['body'],'from':_0x469af7[_0x3c42('0x3c')]||_0x469af7[_0x3c42('0x1f')]}]};var _0x397d65=util[_0x3c42('0x42')](_0x3c42('0x43'),_0x469af7[_0x3c42('0x2e')],_0x469af7['password']);var _0x431008={'method':'POST','uri':'https://rest.clicksend.com/v3/sms/send','body':_0x1aca8a,'headers':{'Authorization':util[_0x3c42('0x42')]('Basic\x20%s',new Buffer(_0x397d65)[_0x3c42('0x44')](_0x3c42('0x45')))},'json':!![]};rp(_0x431008)['then'](function(_0x4865a6){if(_0x4865a6[_0x3c42('0x46')]>=0xc8&&_0x4865a6[_0x3c42('0x46')]<=0xce){if(_0x4865a6[_0x3c42('0x47')]&&_0x4865a6[_0x3c42('0x47')][_0x3c42('0x48')]>0x0){var _0x5da4bf=_[_0x3c42('0x49')](_0x4865a6[_0x3c42('0x47')][_0x3c42('0x21')]);var _0x61e9a2={'messageId':_0x5da4bf['message_id']};if(!_0x469af7[_0x3c42('0x3e')]){_0x61e9a2[_0x3c42('0x39')]=!![];}return _0x132678[_0x3c42('0x27')](_0x61e9a2);}else{logger[_0x3c42('0x2b')](_0x3c42('0x29'),_0x3c42('0x2a'),_0x3c42('0x4a'),util[_0x3c42('0x3a')](_0x4865a6,{'showHidden':![],'depth':null}));}}else{logger[_0x3c42('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3c42('0x2a'),_0x3c42('0x4a'),util[_0x3c42('0x3a')](_0x4865a6,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3bce53){logger[_0x3c42('0x2b')](_0x3c42('0x29'),_0x3c42('0x2a'),'clickSend',util[_0x3c42('0x3a')](_0x3bce53,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3c42('0x29'),_0x3c42('0x2a'),'clickSend',_0x3c42('0x3b'));}break;case _0x3c42('0x4b'):if(_0x469af7[_0x3c42('0x4c')]&&_0x469af7[_0x3c42('0x1e')]){var _0x1aca8a={'dst':_0x22da95[_0x3c42('0x1f')],'text':_0x22da95['body'],'src':_0x469af7['senderString']||_0x469af7[_0x3c42('0x1f')],'url':_0x469af7[_0x3c42('0x22')]+_0x3c42('0x23')+_0x22da95['id']+_0x3c42('0x24')+_0x469af7[_0x3c42('0x25')]};var _0x397d65=util[_0x3c42('0x42')](_0x3c42('0x43'),_0x469af7[_0x3c42('0x4c')],_0x469af7['authToken']);var _0x431008={'method':_0x3c42('0x35'),'uri':util[_0x3c42('0x42')](_0x3c42('0x4d'),_0x469af7[_0x3c42('0x4c')]),'body':_0x1aca8a,'headers':{'Authorization':util[_0x3c42('0x42')](_0x3c42('0x4e'),new Buffer(_0x397d65)['toString']('base64'))},'json':!![]};rp(_0x431008)[_0x3c42('0x18')](function(_0x7c5e32){var _0x59eabb={'messageId':_0x7c5e32[_0x3c42('0x4f')][0x0]};return _0x132678[_0x3c42('0x27')](_0x59eabb);})[_0x3c42('0x28')](function(_0x1cdb94){logger[_0x3c42('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x3c42('0x4b'),util[_0x3c42('0x3a')](_0x1cdb94,{'showHidden':![],'depth':null}));});}else{logger[_0x3c42('0x2b')](_0x3c42('0x29'),_0x3c42('0x2a'),'plivo',_0x3c42('0x50'));}break;case _0x3c42('0x51'):if(_0x469af7['username']&&_0x469af7[_0x3c42('0x2f')]){if(_0x469af7[_0x3c42('0x52')]){var _0x4b6ffc={'method':_0x3c42('0x35'),'uri':_0x469af7['baseUrl']+_0x3c42('0x53'),'body':{'username':_0x469af7[_0x3c42('0x2e')],'password':_0x469af7[_0x3c42('0x2f')]},'json':!![]};return rp(_0x4b6ffc)[_0x3c42('0x18')](function(_0x4c5f8d){var _0x1a79bd={'method':'POST','uri':_0x469af7['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0x469af7['phone'],'destinations':[{'to':_0x22da95[_0x3c42('0x1f')]}],'text':_0x22da95['body'],'notifyUrl':_0x469af7[_0x3c42('0x22')]+_0x3c42('0x23')+_0x22da95['id']+_0x3c42('0x24')+_0x469af7[_0x3c42('0x25')],'notifyContentType':_0x3c42('0x54'),'callbackData':_0x469af7[_0x3c42('0x1f')]+';'+_0x22da95[_0x3c42('0x30')]}]},'headers':{'Authorization':_0x3c42('0x55')+_0x4c5f8d[_0x3c42('0x25')]},'json':!![]};return rp(_0x1a79bd)[_0x3c42('0x18')](function(_0x1a5677){if(_0x1a5677[_0x3c42('0x21')]){var _0x34ec68={'messageId':_0x1a5677[_0x3c42('0x21')][0x0][_0x3c42('0xd')]};if(!_0x469af7['deliveryReport']){_0x34ec68[_0x3c42('0x39')]=!![];}return _0x132678[_0x3c42('0x27')](_0x34ec68);}else{return logger[_0x3c42('0x2b')](_0x3c42('0x29'),_0x3c42('0x2a'),_0x3c42('0x51'),util[_0x3c42('0x3a')](_0x1a5677,{'showHidden':![],'depth':null}));}});})[_0x3c42('0x28')](function(_0x44be3b){return logger['error'](_0x3c42('0x29'),_0x3c42('0x2a'),'infobip',util[_0x3c42('0x3a')](_0x44be3b,{'showHidden':![],'depth':null}));});}else{logger[_0x3c42('0x2b')](_0x3c42('0x29'),'afterCreate',_0x3c42('0x51'),_0x3c42('0x56'));}}else{logger[_0x3c42('0x2b')](_0x3c42('0x29'),_0x3c42('0x2a'),_0x3c42('0x51'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x3c42('0x57'):var _0xb27c9b=require(_0x3c42('0x58'));if(_0x469af7[_0x3c42('0x59')]){var _0x5b003f={};_0x5b003f[_0x3c42('0x5a')]=_0x469af7[_0x3c42('0x2e')];_0x5b003f[_0x3c42('0x1f')]=_0x22da95[_0x3c42('0x1f')];_0x5b003f['sender']=_0x469af7[_0x3c42('0x1f')];_0x5b003f[_0x3c42('0x5b')]=_0x22da95[_0x3c42('0x30')];_0x5b003f[_0x3c42('0x5c')]=+new Date();var _0x221190='';var _0x590ee2='';var _0xc3c493=Object['keys'](_0x5b003f);_0xc3c493[_0x3c42('0x5d')]();for(var _0x5533dc=0x0;_0x5533dc<_0xc3c493['length'];_0x5533dc++){if(_0x221190!=''){_0x221190+='&';}_0x221190+=_0xc3c493[_0x5533dc]+'='+encodeURIComponent(_0x5b003f[_0xc3c493[_0x5533dc]]);_0x590ee2+=_0x5b003f[_0xc3c493[_0x5533dc]];}_0x590ee2+=_0x469af7[_0x3c42('0x59')];_0x590ee2=_0xb27c9b['createHash'](_0x3c42('0x5e'))['update'](_0x590ee2)[_0x3c42('0x5f')](_0x3c42('0x60'));if(_0x221190!==''){_0x221190+='&';}_0x221190+=_0x3c42('0x61')+_0x590ee2;var _0x2624e1={'method':_0x3c42('0x62'),'uri':_0x469af7[_0x3c42('0x52')]+_0x3c42('0x63')+_0x221190,'json':!![]};return rp(_0x2624e1)[_0x3c42('0x18')](function(_0x1018ca){var _0x2275cb=Object[_0x3c42('0x64')](_0x1018ca);if(_0x1018ca[_0x2275cb[0x0]][_0x3c42('0x2b')]&&parseInt(_0x1018ca[_0x2275cb[0x0]][_0x3c42('0x2b')])===0x0){var _0xc79158={'messageId':_0x1018ca[_0x2275cb[0x0]][_0x3c42('0x65')]};if(!_0x469af7[_0x3c42('0x3e')]){_0xc79158[_0x3c42('0x39')]=!![];}return _0x132678['update'](_0xc79158);}else{return logger[_0x3c42('0x2b')](_0x3c42('0x29'),_0x3c42('0x2a'),_0x3c42('0x57'),util[_0x3c42('0x3a')](_0x1018ca[_0x3c42('0x2b')],{'showHidden':![],'depth':null}));}})[_0x3c42('0x28')](function(_0x24e77e){return logger[_0x3c42('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3c42('0x2a'),'csc',util[_0x3c42('0x3a')](_0x24e77e,{'showHidden':![],'depth':null}));});}else{logger[_0x3c42('0x2b')](_0x3c42('0x29'),_0x3c42('0x2a'),_0x3c42('0x57'),_0x3c42('0x66'));}break;case _0x3c42('0x67'):if(_0x469af7[_0x3c42('0x59')]){var _0x41537a={'method':_0x3c42('0x35'),'uri':_0x3c42('0x68'),'headers':{'Authorization':_0x469af7['apiKey']},'body':{'content':_0x22da95[_0x3c42('0x30')],'to':[_0x22da95['phone']],'from':_0x469af7['phone'],'binary':![],'clientMessageId':_0x3c42('0x69'),'charset':_0x3c42('0x6a')},'json':!![]};rp(_0x41537a)[_0x3c42('0x18')](function(_0x1b967a){if(!_0x1b967a['error']){var _0x1a9797={'messageId':_0x1b967a[_0x3c42('0x21')][0x0][_0x3c42('0x6b')]};if(!_0x469af7[_0x3c42('0x3e')]){_0x1a9797[_0x3c42('0x39')]=!![];}return _0x132678[_0x3c42('0x27')](_0x1a9797);}else{return logger[_0x3c42('0x2b')](_0x3c42('0x29'),_0x3c42('0x2a'),_0x3c42('0x67'),util[_0x3c42('0x3a')](_0x1b967a['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x39136d){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickatell',util[_0x3c42('0x3a')](_0x39136d,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3c42('0x29'),'afterCreate',_0x3c42('0x67'),_0x3c42('0x66'));}break;case _0x3c42('0x6c'):if(_0x469af7[_0x3c42('0x2e')]&&_0x469af7[_0x3c42('0x2f')]){var _0x397d65=util[_0x3c42('0x42')](_0x3c42('0x43'),_0x469af7[_0x3c42('0x2e')],_0x469af7['password']);var _0x431008={'method':_0x3c42('0x35'),'uri':_0x3c42('0x6d')+_0x469af7['accountId']+'/messages','body':{'to':[_0x22da95[_0x3c42('0x1f')]],'text':_0x22da95[_0x3c42('0x30')],'from':_0x469af7['phone'],'applicationId':_0x469af7[_0x3c42('0x6e')]},'headers':{'Authorization':util[_0x3c42('0x42')](_0x3c42('0x4e'),new Buffer(_0x397d65)[_0x3c42('0x44')]('base64'))},'json':!![]};rp(_0x431008)[_0x3c42('0x18')](function(_0x5ee1c8){if(_0x5ee1c8['id']){var _0x1a3620={'messageId':_0x5ee1c8['id']};return _0x132678[_0x3c42('0x27')](_0x1a3620);}else{logger[_0x3c42('0x2b')](_0x3c42('0x29'),_0x3c42('0x2a'),'bandwidth',util[_0x3c42('0x3a')](_0x5ee1c8,{'showHidden':![],'depth':null}));}})[_0x3c42('0x28')](function(_0x14f25f){logger[_0x3c42('0x2b')](_0x3c42('0x29'),_0x3c42('0x2a'),_0x3c42('0x6c'),util[_0x3c42('0x3a')](_0x14f25f,{'showHidden':![],'depth':null}));});}else{logger[_0x3c42('0x2b')](_0x3c42('0x29'),_0x3c42('0x2a'),'bandwidth',_0x3c42('0x3b'));}break;case _0x3c42('0x6f'):if(_0x469af7[_0x3c42('0x59')]){var _0x192124={};var _0x2624e1={'method':_0x3c42('0x35'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0x469af7[_0x3c42('0x59')],'Content-Type':_0x3c42('0x54')},'body':{'from':_0x469af7[_0x3c42('0x1f')],'to':_0x22da95[_0x3c42('0x1f')],'text':_0x22da95[_0x3c42('0x30')]},'json':!![]};return rp(_0x2624e1)[_0x3c42('0x18')](function(_0x1e37c8){if(_0x1e37c8[_0x3c42('0x70')]==0xca){_0x192124[_0x3c42('0x71')]=_0x1e37c8;var _0x15716f={'method':_0x3c42('0x35'),'uri':_0x3c42('0x72'),'headers':{'Authorization':_0x3c42('0x73')+_0x469af7['apiKey'],'Content-Type':_0x3c42('0x54')},'body':{'refid':_0x192124[_0x3c42('0x71')][_0x3c42('0x74')]},'json':!![]};return rp(_0x15716f)[_0x3c42('0x18')](function(_0x35c408){_0x192124[_0x3c42('0x75')]=_0x35c408;var _0x4bd656={'messageId':_0x192124['message'][_0x3c42('0x74')],'read':!![]};return _0x132678[_0x3c42('0x27')](_0x4bd656);});}else{return logger[_0x3c42('0x2b')](_0x3c42('0x29'),_0x3c42('0x2a'),_0x3c42('0x6f'),util['inspect'](_0x1e37c8,{'showHidden':![],'depth':null}));}})['catch'](function(_0x5639a6){return logger[_0x3c42('0x2b')](_0x3c42('0x29'),'afterCreate',_0x3c42('0x6f'),util['inspect'](_0x5639a6,{'showHidden':![],'depth':null}));});}else{return logger[_0x3c42('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3c42('0x2a'),'intelepeer',_0x3c42('0x76'));}break;}}})['finally'](function(){_0x10b712();});}else{_0x10b712();}}},'charset':_0x3c42('0x77'),'collate':_0x3c42('0x78')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 7153884..3476eb8 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 _0x7eae=['redis','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsMessage','SmsMessage','body','options','raw','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5d059f,_0x1b363f){var _0x2bcf71=function(_0x34602f){while(--_0x34602f){_0x5d059f['push'](_0x5d059f['shift']());}};_0x2bcf71(++_0x1b363f);}(_0x7eae,0x140));var _0xe7ea=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x7eae[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0xe7ea('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe7ea('0x1'));var rs=require(_0xe7ea('0x2'));var fs=require('fs');var Redis=require(_0xe7ea('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe7ea('0x4'))(_0xe7ea('0x5'));var config=require(_0xe7ea('0x6'));var jayson=require(_0xe7ea('0x7'));var client=jayson[_0xe7ea('0x8')][_0xe7ea('0x9')]({'port':0x232a});config[_0xe7ea('0xa')]=_['defaults'](config[_0xe7ea('0xa')],{'host':_0xe7ea('0xb'),'port':0x18eb});var socket=require(_0xe7ea('0xc'))(new Redis(config[_0xe7ea('0xa')]));require(_0xe7ea('0xd'))[_0xe7ea('0xe')](socket);function respondWithRpcPromise(_0x3a9086,_0x2b2a66,_0x48dcc6){return new BPromise(function(_0x64600b,_0x1ea3f9){return client[_0xe7ea('0xf')](_0x3a9086,_0x48dcc6)[_0xe7ea('0x10')](function(_0x156d8a){logger[_0xe7ea('0x11')](_0xe7ea('0x12'),_0x2b2a66,_0xe7ea('0x13'));logger[_0xe7ea('0x14')](_0xe7ea('0x15'),_0x2b2a66,_0xe7ea('0x13'),JSON[_0xe7ea('0x16')](_0x156d8a));if(_0x156d8a[_0xe7ea('0x17')]){if(_0x156d8a[_0xe7ea('0x17')][_0xe7ea('0x18')]===0x1f4){logger[_0xe7ea('0x17')](_0xe7ea('0x12'),_0x2b2a66,_0x156d8a['error'][_0xe7ea('0x19')]);return _0x1ea3f9(_0x156d8a[_0xe7ea('0x17')][_0xe7ea('0x19')]);}logger[_0xe7ea('0x17')](_0xe7ea('0x12'),_0x2b2a66,_0x156d8a[_0xe7ea('0x17')][_0xe7ea('0x19')]);return _0x64600b(_0x156d8a[_0xe7ea('0x17')][_0xe7ea('0x19')]);}else{logger[_0xe7ea('0x11')]('SmsMessage,\x20%s,\x20%s',_0x2b2a66,_0xe7ea('0x13'));_0x64600b(_0x156d8a[_0xe7ea('0x1a')][_0xe7ea('0x19')]);}})[_0xe7ea('0x1b')](function(_0x39894a){logger[_0xe7ea('0x17')](_0xe7ea('0x12'),_0x2b2a66,_0x39894a);_0x1ea3f9(_0x39894a);});});}exports[_0xe7ea('0x1c')]=function(_0x4d87c7){var _0x38954c=this;return new Promise(function(_0x2960fa,_0x473d52){return db[_0xe7ea('0x1d')]['create'](_0x4d87c7[_0xe7ea('0x1e')],{'raw':_0x4d87c7[_0xe7ea('0x1f')]?_0x4d87c7[_0xe7ea('0x1f')][_0xe7ea('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x35e327){logger['info']('CreateSmsMessage',_0x4d87c7);logger[_0xe7ea('0x14')](_0xe7ea('0x1c'),_0x4d87c7,JSON[_0xe7ea('0x16')](_0x35e327));_0x2960fa(_0x35e327);})['catch'](function(_0x5a7308){logger[_0xe7ea('0x17')](_0xe7ea('0x1c'),_0x5a7308[_0xe7ea('0x19')],_0x4d87c7);_0x473d52(_0x38954c['error'](0x1f4,_0x5a7308[_0xe7ea('0x19')]));});});}; \ No newline at end of file +var _0x80df=['../../mysqldb','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateSmsMessage','SmsMessage','body','options','raw','then','lodash','util','moment','bluebird','ioredis'];(function(_0xedf7f0,_0x146b7c){var _0x1f3435=function(_0x3ee978){while(--_0x3ee978){_0xedf7f0['push'](_0xedf7f0['shift']());}};_0x1f3435(++_0x146b7c);}(_0x80df,0x1bb));var _0xf80d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x80df[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xf80d('0x0'));var util=require(_0xf80d('0x1'));var moment=require(_0xf80d('0x2'));var BPromise=require(_0xf80d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf80d('0x4'));var db=require(_0xf80d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf80d('0x6'))('rpc');var config=require(_0xf80d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf80d('0x8')]['http']({'port':0x232a});config[_0xf80d('0x9')]=_[_0xf80d('0xa')](config[_0xf80d('0x9')],{'host':_0xf80d('0xb'),'port':0x18eb});var socket=require(_0xf80d('0xc'))(new Redis(config['redis']));require(_0xf80d('0xd'))[_0xf80d('0xe')](socket);function respondWithRpcPromise(_0x953fa0,_0x40cc1a,_0x316d07){return new BPromise(function(_0x54679e,_0x42a5ef){return client[_0xf80d('0xf')](_0x953fa0,_0x316d07)['then'](function(_0x3df444){logger[_0xf80d('0x10')](_0xf80d('0x11'),_0x40cc1a,'request\x20sent');logger[_0xf80d('0x12')](_0xf80d('0x13'),_0x40cc1a,_0xf80d('0x14'),JSON[_0xf80d('0x15')](_0x3df444));if(_0x3df444[_0xf80d('0x16')]){if(_0x3df444[_0xf80d('0x16')]['code']===0x1f4){logger[_0xf80d('0x16')](_0xf80d('0x11'),_0x40cc1a,_0x3df444[_0xf80d('0x16')]['message']);return _0x42a5ef(_0x3df444['error'][_0xf80d('0x17')]);}logger['error'](_0xf80d('0x11'),_0x40cc1a,_0x3df444[_0xf80d('0x16')][_0xf80d('0x17')]);return _0x54679e(_0x3df444['error'][_0xf80d('0x17')]);}else{logger[_0xf80d('0x10')](_0xf80d('0x11'),_0x40cc1a,'request\x20sent');_0x54679e(_0x3df444[_0xf80d('0x18')][_0xf80d('0x17')]);}})[_0xf80d('0x19')](function(_0x57a94c){logger[_0xf80d('0x16')](_0xf80d('0x11'),_0x40cc1a,_0x57a94c);_0x42a5ef(_0x57a94c);});});}exports[_0xf80d('0x1a')]=function(_0x3706be){var _0x4c5bce=this;return new Promise(function(_0x1d5496,_0x15dd33){return db[_0xf80d('0x1b')]['create'](_0x3706be[_0xf80d('0x1c')],{'raw':_0x3706be['options']?_0x3706be[_0xf80d('0x1d')][_0xf80d('0x1e')]===undefined?!![]:![]:!![]})[_0xf80d('0x1f')](function(_0x33b3ea){logger[_0xf80d('0x10')](_0xf80d('0x1a'),_0x3706be);logger[_0xf80d('0x12')](_0xf80d('0x1a'),_0x3706be,JSON['stringify'](_0x33b3ea));_0x1d5496(_0x33b3ea);})[_0xf80d('0x19')](function(_0xd0f3e9){logger[_0xf80d('0x16')](_0xf80d('0x1a'),_0xd0f3e9[_0xf80d('0x17')],_0x3706be);_0x15dd33(_0x4c5bce[_0xf80d('0x16')](0x1f4,_0xd0f3e9[_0xf80d('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 110ef9d..330b14f 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 _0x8bc4=['remove','update','emit','register','smsMessage:','save'];(function(_0x851ec0,_0x52c4c1){var _0xa062d5=function(_0x4c795d){while(--_0x4c795d){_0x851ec0['push'](_0x851ec0['shift']());}};_0xa062d5(++_0x52c4c1);}(_0x8bc4,0xe9));var _0x48bc=function(_0x29588a,_0x14c698){_0x29588a=_0x29588a-0x0;var _0x5f1398=_0x8bc4[_0x29588a];return _0x5f1398;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x48bc('0x0'),_0x48bc('0x1'),_0x48bc('0x2')];function createListener(_0x31f716,_0x2ba135){return function(_0x3361f1){_0x2ba135[_0x48bc('0x3')](_0x31f716,_0x3361f1);};}function removeListener(_0x4115f6,_0x475922){return function(){SmsMessageEvents['removeListener'](_0x4115f6,_0x475922);};}exports[_0x48bc('0x4')]=function(_0x459085){for(var _0x1276d4=0x0,_0x1266ee=events['length'];_0x1276d4<_0x1266ee;_0x1276d4++){var _0x1ae8be=events[_0x1276d4];var _0x1ef9d9=createListener(_0x48bc('0x5')+_0x1ae8be,_0x459085);SmsMessageEvents['on'](_0x1ae8be,_0x1ef9d9);}}; \ No newline at end of file +var _0xa0af=['emit','removeListener','register','length','smsMessage:','./smsMessage.events','save','remove','update'];(function(_0x36d39d,_0x3637a7){var _0x149f3a=function(_0x3136a4){while(--_0x3136a4){_0x36d39d['push'](_0x36d39d['shift']());}};_0x149f3a(++_0x3637a7);}(_0xa0af,0x188));var _0xfa0a=function(_0xec4fbb,_0x4b2101){_0xec4fbb=_0xec4fbb-0x0;var _0x4d11fb=_0xa0af[_0xec4fbb];return _0x4d11fb;};'use strict';var SmsMessageEvents=require(_0xfa0a('0x0'));var events=[_0xfa0a('0x1'),_0xfa0a('0x2'),_0xfa0a('0x3')];function createListener(_0xa837ce,_0x479ae6){return function(_0x45fd0e){_0x479ae6[_0xfa0a('0x4')](_0xa837ce,_0x45fd0e);};}function removeListener(_0x1603f2,_0x14f22f){return function(){SmsMessageEvents[_0xfa0a('0x5')](_0x1603f2,_0x14f22f);};}exports[_0xfa0a('0x6')]=function(_0x3e0e4f){for(var _0x57434d=0x0,_0xcd5540=events[_0xfa0a('0x7')];_0x57434d<_0xcd5540;_0x57434d++){var _0x3046ef=events[_0x57434d];var _0x50c77d=createListener(_0xfa0a('0x8')+_0x3046ef,_0x3e0e4f);SmsMessageEvents['on'](_0x3046ef,_0x50c77d);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 2dbc625..e280085 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 _0xa276=['../../components/interaction/service','../../config/environment','./smsQueue.controller','isAuthenticated','index','get','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','delete','destroy','removeTeams','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa276,0x111));var _0x6a27=function(_0x2592bd,_0x5aa296){_0x2592bd=_0x2592bd-0x0;var _0x43a95d=_0xa276[_0x2592bd];return _0x43a95d;};'use strict';var multer=require('multer');var util=require(_0x6a27('0x0'));var path=require(_0x6a27('0x1'));var timeout=require(_0x6a27('0x2'));var express=require(_0x6a27('0x3'));var router=express['Router']();var fs_extra=require(_0x6a27('0x4'));var auth=require(_0x6a27('0x5'));var interaction=require(_0x6a27('0x6'));var config=require(_0x6a27('0x7'));var controller=require(_0x6a27('0x8'));router['get']('/',auth[_0x6a27('0x9')](),controller[_0x6a27('0xa')]);router[_0x6a27('0xb')]('/describe',auth[_0x6a27('0x9')](),controller[_0x6a27('0xc')]);router[_0x6a27('0xb')](_0x6a27('0xd'),auth[_0x6a27('0x9')](),controller[_0x6a27('0xe')]);router[_0x6a27('0xb')](_0x6a27('0xf'),auth['isAuthenticated'](),controller[_0x6a27('0x10')]);router[_0x6a27('0xb')](_0x6a27('0x11'),auth['isAuthenticated'](),controller[_0x6a27('0x12')]);router[_0x6a27('0xb')]('/:id/users',auth[_0x6a27('0x9')](),controller[_0x6a27('0x13')]);router[_0x6a27('0x14')]('/',auth['isAuthenticated'](),controller[_0x6a27('0x15')]);router[_0x6a27('0x14')](_0x6a27('0x11'),auth[_0x6a27('0x9')](),controller[_0x6a27('0x16')]);router[_0x6a27('0x14')](_0x6a27('0x17'),auth['isAuthenticated'](),controller[_0x6a27('0x18')]);router[_0x6a27('0x19')](_0x6a27('0xd'),auth[_0x6a27('0x9')](),controller[_0x6a27('0x1a')]);router[_0x6a27('0x1b')](_0x6a27('0xd'),auth[_0x6a27('0x9')](),controller[_0x6a27('0x1c')]);router[_0x6a27('0x1b')](_0x6a27('0x11'),auth[_0x6a27('0x9')](),controller[_0x6a27('0x1d')]);router[_0x6a27('0x1b')](_0x6a27('0x17'),auth[_0x6a27('0x9')](),controller['removeAgents']);module[_0x6a27('0x1e')]=router; \ No newline at end of file +var _0xf6c9=['show','/:id/members','getMembers','/:id/teams','post','create','addTeams','/:id/users','addAgents','update','delete','removeTeams','removeAgents','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x46f48a,_0x30d3ea){var _0x3b4d7e=function(_0x327f03){while(--_0x327f03){_0x46f48a['push'](_0x46f48a['shift']());}};_0x3b4d7e(++_0x30d3ea);}(_0xf6c9,0xaa));var _0x9f6c=function(_0x406b06,_0xc3f492){_0x406b06=_0x406b06-0x0;var _0x2e7c13=_0xf6c9[_0x406b06];return _0x2e7c13;};'use strict';var multer=require(_0x9f6c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9f6c('0x1'));var express=require(_0x9f6c('0x2'));var router=express[_0x9f6c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9f6c('0x4'));var interaction=require(_0x9f6c('0x5'));var config=require('../../config/environment');var controller=require(_0x9f6c('0x6'));router[_0x9f6c('0x7')]('/',auth[_0x9f6c('0x8')](),controller[_0x9f6c('0x9')]);router['get']('/describe',auth[_0x9f6c('0x8')](),controller[_0x9f6c('0xa')]);router[_0x9f6c('0x7')](_0x9f6c('0xb'),auth[_0x9f6c('0x8')](),controller[_0x9f6c('0xc')]);router[_0x9f6c('0x7')](_0x9f6c('0xd'),auth[_0x9f6c('0x8')](),controller[_0x9f6c('0xe')]);router[_0x9f6c('0x7')](_0x9f6c('0xf'),auth[_0x9f6c('0x8')](),controller['getTeams']);router[_0x9f6c('0x7')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x9f6c('0x10')]('/',auth[_0x9f6c('0x8')](),controller[_0x9f6c('0x11')]);router[_0x9f6c('0x10')]('/:id/teams',auth[_0x9f6c('0x8')](),controller[_0x9f6c('0x12')]);router[_0x9f6c('0x10')](_0x9f6c('0x13'),auth[_0x9f6c('0x8')](),controller[_0x9f6c('0x14')]);router['put']('/:id',auth[_0x9f6c('0x8')](),controller[_0x9f6c('0x15')]);router['delete'](_0x9f6c('0xb'),auth[_0x9f6c('0x8')](),controller['destroy']);router[_0x9f6c('0x16')]('/:id/teams',auth[_0x9f6c('0x8')](),controller[_0x9f6c('0x17')]);router[_0x9f6c('0x16')](_0x9f6c('0x13'),auth[_0x9f6c('0x8')](),controller[_0x9f6c('0x18')]);module[_0x9f6c('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 3ac447a..e4903b4 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 _0xc1c8=['beepall','roundrobin','exports','rrmemory'];(function(_0x2720e7,_0x5758a5){var _0x39b035=function(_0x3f172b){while(--_0x3f172b){_0x2720e7['push'](_0x2720e7['shift']());}};_0x39b035(++_0x5758a5);}(_0xc1c8,0xa6));var _0x8c1c=function(_0x28b520,_0x24db8a){_0x28b520=_0x28b520-0x0;var _0x5c01d1=_0xc1c8[_0x28b520];return _0x5c01d1;};'use strict';var Sequelize=require('sequelize');module[_0x8c1c('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x8c1c('0x1'),_0x8c1c('0x2'),_0x8c1c('0x3'))}}; \ No newline at end of file +var _0xd12e=['exports','name','STRING','INTEGER','ENUM','beepall','sequelize'];(function(_0x417b51,_0x25b2a9){var _0x58ee3c=function(_0x330ff3){while(--_0x330ff3){_0x417b51['push'](_0x417b51['shift']());}};_0x58ee3c(++_0x25b2a9);}(_0xd12e,0x1e2));var _0xed12=function(_0x462582,_0x279982){_0x462582=_0x462582-0x0;var _0x176aac=_0xd12e[_0x462582];return _0x176aac;};'use strict';var Sequelize=require(_0xed12('0x0'));module[_0xed12('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xed12('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xed12('0x3')]},'timeout':{'type':Sequelize[_0xed12('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xed12('0x5')]('rrmemory',_0xed12('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index b10e015..693e332 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 _0x6967=['union','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsQueue.socket','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','then','destroy','SmsQueues','UserProfileResource','error','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','includeAll','include','catch','show','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','update','params','getMembers','findOne','UserSmsQueue','SmsQueueId','findAll','User','UserId','agent','smsPause','updatedAt','createdAt','rows','format','SIP','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','field','tq.TeamId','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','all'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x6967,0x99));var _0x7696=function(_0x2570fa,_0x223e67){_0x2570fa=_0x2570fa-0x0;var _0xc36082=_0x6967[_0x2570fa];return _0xc36082;};'use strict';var emlformat=require(_0x7696('0x0'));var rimraf=require(_0x7696('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7696('0x2'));var rp=require(_0x7696('0x3'));var moment=require(_0x7696('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7696('0x5'));var util=require(_0x7696('0x6'));var path=require('path');var sox=require(_0x7696('0x7'));var csv=require(_0x7696('0x8'));var ejs=require(_0x7696('0x9'));var fs=require('fs');var fs_extra=require(_0x7696('0xa'));var _=require(_0x7696('0xb'));var squel=require(_0x7696('0xc'));var crypto=require('crypto');var jsforce=require(_0x7696('0xd'));var deskjs=require(_0x7696('0xe'));var toCsv=require(_0x7696('0x8'));var querystring=require(_0x7696('0xf'));var Papa=require(_0x7696('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7696('0x11'));var as=require(_0x7696('0x12'));var hardwareService=require(_0x7696('0x13'));var logger=require(_0x7696('0x14'))(_0x7696('0x15'));var utils=require(_0x7696('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7696('0x17'));var db=require(_0x7696('0x18'))['db'];config[_0x7696('0x19')]=_[_0x7696('0x1a')](config[_0x7696('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x7696('0x1b'))(new Redis(config[_0x7696('0x19')]));require(_0x7696('0x1c'))['register'](socket);function respondWithStatusCode(_0x5c4bcd,_0x10a7ec){_0x10a7ec=_0x10a7ec||0xcc;return function(_0x89ab29){if(_0x89ab29){return _0x5c4bcd[_0x7696('0x1d')](_0x10a7ec);}return _0x5c4bcd[_0x7696('0x1e')](_0x10a7ec)[_0x7696('0x1f')]();};}function respondWithResult(_0x40d241,_0x1f7f83){_0x1f7f83=_0x1f7f83||0xc8;return function(_0x4262b8){if(_0x4262b8){return _0x40d241['status'](_0x1f7f83)['json'](_0x4262b8);}};}function respondWithFilteredResult(_0x93f5d1,_0x12a9d1){return function(_0x518562){if(_0x518562){var _0x3c5613=typeof _0x12a9d1[_0x7696('0x20')]===_0x7696('0x21')&&typeof _0x12a9d1[_0x7696('0x22')]===_0x7696('0x21');var _0x3c2064=_0x518562[_0x7696('0x23')];var _0x55f019=_0x3c5613?0x0:_0x12a9d1[_0x7696('0x20')];var _0x56928f=_0x3c5613?_0x518562['count']:_0x12a9d1[_0x7696('0x20')]+_0x12a9d1[_0x7696('0x22')];var _0x1da531;if(_0x56928f>=_0x3c2064){_0x56928f=_0x3c2064;_0x1da531=0xc8;}else{_0x1da531=0xce;}_0x93f5d1['status'](_0x1da531);return _0x93f5d1[_0x7696('0x24')]('Content-Range',_0x55f019+'-'+_0x56928f+'/'+_0x3c2064)[_0x7696('0x25')](_0x518562);}return null;};}function patchUpdates(_0x5b12bf){return function(_0x3336bf){try{jsonpatch[_0x7696('0x26')](_0x3336bf,_0x5b12bf,!![]);}catch(_0x1e8777){return BPromise[_0x7696('0x27')](_0x1e8777);}return _0x3336bf['save']();};}function saveUpdates(_0xefa2c4,_0x6e2282){return function(_0x56017c){if(_0x56017c){return _0x56017c['update'](_0xefa2c4)[_0x7696('0x28')](function(_0x3d16cb){return _0x3d16cb;});}return null;};}function removeEntity(_0x9d7a88,_0x7e2a40){return function(_0x43c92c){if(_0x43c92c){return _0x43c92c[_0x7696('0x29')]()[_0x7696('0x28')](function(){var _0x19b272=_0x43c92c['get']({'plain':!![]});var _0xd46c=_0x7696('0x2a');return db[_0x7696('0x2b')][_0x7696('0x29')]({'where':{'type':_0xd46c,'resourceId':_0x19b272['id']}})[_0x7696('0x28')](function(){return _0x43c92c;});})[_0x7696('0x28')](function(){_0x9d7a88[_0x7696('0x1e')](0xcc)[_0x7696('0x1f')]();});}};}function handleEntityNotFound(_0xc18df6,_0x4ab83b){return function(_0x1ee123){if(!_0x1ee123){_0xc18df6[_0x7696('0x1d')](0x194);}return _0x1ee123;};}function handleError(_0x6b5d3,_0x566a0b){_0x566a0b=_0x566a0b||0x1f4;return function(_0x1bbf51){logger[_0x7696('0x2c')](_0x1bbf51[_0x7696('0x2d')]);if(_0x1bbf51['name']){delete _0x1bbf51[_0x7696('0x2e')];}_0x6b5d3[_0x7696('0x1e')](_0x566a0b)[_0x7696('0x2f')](_0x1bbf51);};}exports[_0x7696('0x30')]=function(_0x183c09,_0x2b634d){var _0x2189ec={},_0x51959a={},_0x17a2dd={'count':0x0,'rows':[]};var _0x23be61=_[_0x7696('0x31')](db[_0x7696('0x32')][_0x7696('0x33')],function(_0x12a98c){return{'name':_0x12a98c[_0x7696('0x34')],'type':_0x12a98c[_0x7696('0x35')][_0x7696('0x36')]};});_0x51959a['model']=_['map'](_0x23be61,'name');_0x51959a[_0x7696('0x37')]=_[_0x7696('0x38')](_0x183c09[_0x7696('0x37')]);_0x51959a[_0x7696('0x39')]=_[_0x7696('0x3a')](_0x51959a[_0x7696('0x3b')],_0x51959a[_0x7696('0x37')]);_0x2189ec[_0x7696('0x3c')]=_['intersection'](_0x51959a[_0x7696('0x3b')],qs['fields'](_0x183c09[_0x7696('0x37')][_0x7696('0x3d')]));_0x2189ec[_0x7696('0x3c')]=_0x2189ec[_0x7696('0x3c')][_0x7696('0x3e')]?_0x2189ec[_0x7696('0x3c')]:_0x51959a['model'];if(!_0x183c09[_0x7696('0x37')][_0x7696('0x3f')](_0x7696('0x40'))){_0x2189ec[_0x7696('0x22')]=qs['limit'](_0x183c09[_0x7696('0x37')]['limit']);_0x2189ec[_0x7696('0x20')]=qs[_0x7696('0x20')](_0x183c09[_0x7696('0x37')][_0x7696('0x20')]);}_0x2189ec[_0x7696('0x41')]=qs[_0x7696('0x42')](_0x183c09[_0x7696('0x37')]['sort']);_0x2189ec[_0x7696('0x43')]=qs['filters'](_[_0x7696('0x44')](_0x183c09[_0x7696('0x37')],_0x51959a[_0x7696('0x39')]),_0x23be61);if(_0x183c09[_0x7696('0x37')]['filter']){_0x2189ec[_0x7696('0x43')]=_[_0x7696('0x45')](_0x2189ec['where'],{'$or':_['map'](_0x23be61,function(_0x195d60){if(_0x195d60[_0x7696('0x35')]!=='VIRTUAL'){var _0x284121={};_0x284121[_0x195d60[_0x7696('0x2e')]]={'$like':'%'+_0x183c09[_0x7696('0x37')][_0x7696('0x46')]+'%'};return _0x284121;}})});}_0x2189ec=_[_0x7696('0x45')]({},_0x2189ec,_0x183c09['options']);var _0x571242={'where':_0x2189ec[_0x7696('0x43')]};return db[_0x7696('0x32')][_0x7696('0x23')](_0x571242)[_0x7696('0x28')](function(_0x3ce75c){_0x17a2dd['count']=_0x3ce75c;if(_0x183c09[_0x7696('0x37')][_0x7696('0x47')]){_0x2189ec[_0x7696('0x48')]=[{'all':!![]}];}return db['SmsQueue']['findAll'](_0x2189ec);})[_0x7696('0x28')](function(_0x4d5484){_0x17a2dd['rows']=_0x4d5484;return _0x17a2dd;})[_0x7696('0x28')](respondWithFilteredResult(_0x2b634d,_0x2189ec))[_0x7696('0x49')](handleError(_0x2b634d,null));};exports[_0x7696('0x4a')]=function(_0x42a1af,_0x539f73){var _0x3de5b3={'raw':!![],'where':{'id':_0x42a1af['params']['id']}},_0x2e4a66={};_0x2e4a66[_0x7696('0x3b')]=_[_0x7696('0x38')](db['SmsQueue'][_0x7696('0x33')]);_0x2e4a66[_0x7696('0x37')]=_[_0x7696('0x38')](_0x42a1af[_0x7696('0x37')]);_0x2e4a66[_0x7696('0x39')]=_[_0x7696('0x3a')](_0x2e4a66[_0x7696('0x3b')],_0x2e4a66[_0x7696('0x37')]);_0x3de5b3[_0x7696('0x3c')]=_[_0x7696('0x3a')](_0x2e4a66[_0x7696('0x3b')],qs[_0x7696('0x3d')](_0x42a1af['query'][_0x7696('0x3d')]));_0x3de5b3[_0x7696('0x3c')]=_0x3de5b3[_0x7696('0x3c')][_0x7696('0x3e')]?_0x3de5b3[_0x7696('0x3c')]:_0x2e4a66[_0x7696('0x3b')];if(_0x42a1af[_0x7696('0x37')][_0x7696('0x47')]){_0x3de5b3['include']=[{'all':!![]}];}_0x3de5b3=_[_0x7696('0x45')]({},_0x3de5b3,_0x42a1af[_0x7696('0x4b')]);return db[_0x7696('0x32')]['find'](_0x3de5b3)[_0x7696('0x28')](handleEntityNotFound(_0x539f73,null))[_0x7696('0x28')](respondWithResult(_0x539f73,null))[_0x7696('0x49')](handleError(_0x539f73,null));};exports[_0x7696('0x4c')]=function(_0xfc14ac,_0xabcf7c){return db[_0x7696('0x32')][_0x7696('0x4c')](_0xfc14ac[_0x7696('0x4d')],{})[_0x7696('0x28')](function(_0xdc97bc){var _0x8d3940=_0xfc14ac[_0x7696('0x4e')][_0x7696('0x4f')]({'plain':!![]});if(!_0x8d3940)throw new Error(_0x7696('0x50'));if(_0x8d3940[_0x7696('0x51')]===_0x7696('0x4e')){var _0x37f6e9=_0xdc97bc['get']({'plain':!![]});var _0x48bba4=_0x7696('0x2a');return db[_0x7696('0x52')][_0x7696('0x53')]({'where':{'name':_0x48bba4,'userProfileId':_0x8d3940[_0x7696('0x54')]},'raw':!![]})['then'](function(_0x501e2b){if(_0x501e2b&&_0x501e2b['autoAssociation']===0x0){return db[_0x7696('0x2b')][_0x7696('0x4c')]({'name':_0x37f6e9[_0x7696('0x2e')],'resourceId':_0x37f6e9['id'],'type':_0x501e2b[_0x7696('0x2e')],'sectionId':_0x501e2b['id']},{})[_0x7696('0x28')](function(){return _0xdc97bc;});}else{return _0xdc97bc;}})['catch'](function(_0x21bc75){logger[_0x7696('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x21bc75);throw _0x21bc75;});}return _0xdc97bc;})[_0x7696('0x28')](respondWithResult(_0xabcf7c,0xc9))[_0x7696('0x49')](handleError(_0xabcf7c,null));};exports[_0x7696('0x55')]=function(_0x4395b1,_0x214fd8){if(_0x4395b1[_0x7696('0x4d')]['id']){delete _0x4395b1[_0x7696('0x4d')]['id'];}return db[_0x7696('0x32')]['find']({'where':{'id':_0x4395b1[_0x7696('0x56')]['id']}})['then'](handleEntityNotFound(_0x214fd8,null))[_0x7696('0x28')](saveUpdates(_0x4395b1[_0x7696('0x4d')],null))[_0x7696('0x28')](respondWithResult(_0x214fd8,null))[_0x7696('0x49')](handleError(_0x214fd8,null));};exports['destroy']=function(_0x4b58da,_0x49ca7e){return db[_0x7696('0x32')][_0x7696('0x53')]({'where':{'id':_0x4b58da[_0x7696('0x56')]['id']}})[_0x7696('0x28')](handleEntityNotFound(_0x49ca7e,null))[_0x7696('0x28')](removeEntity(_0x49ca7e,null))[_0x7696('0x49')](handleError(_0x49ca7e,null));};exports['describe']=function(_0x1b0b90,_0x2b849c){return db[_0x7696('0x32')]['describe']()[_0x7696('0x28')](respondWithResult(_0x2b849c,null))[_0x7696('0x49')](handleError(_0x2b849c,null));};exports[_0x7696('0x57')]=function(_0x7810ab,_0x18b1c8,_0xd0346d){var _0x496632={'raw':!![],'where':{}},_0x389d97={},_0x24661a;return db['SmsQueue'][_0x7696('0x58')]({'where':{'id':_0x7810ab[_0x7696('0x56')]['id']}})['then'](handleEntityNotFound(_0x18b1c8,null))[_0x7696('0x28')](function(_0x77daba){if(_0x77daba){_0x24661a=_0x77daba[_0x7696('0x4f')]({'plain':!![]});_0x389d97['model']=_[_0x7696('0x38')](db[_0x7696('0x59')][_0x7696('0x33')]);_0x389d97[_0x7696('0x37')]=_[_0x7696('0x38')](_0x7810ab[_0x7696('0x37')]);_0x389d97[_0x7696('0x39')]=_[_0x7696('0x3a')](_0x389d97[_0x7696('0x3b')],_0x389d97[_0x7696('0x37')]);_0x496632['attributes']=_[_0x7696('0x3a')](_0x389d97[_0x7696('0x3b')],qs['fields'](_0x7810ab[_0x7696('0x37')][_0x7696('0x3d')]));_0x496632[_0x7696('0x3c')]=_0x496632[_0x7696('0x3c')]['length']?_0x496632[_0x7696('0x3c')]:_0x389d97['model'];if(!_0x7810ab[_0x7696('0x37')]['hasOwnProperty'](_0x7696('0x40'))){_0x496632[_0x7696('0x22')]=qs[_0x7696('0x22')](_0x7810ab[_0x7696('0x37')][_0x7696('0x22')]);_0x496632[_0x7696('0x20')]=qs[_0x7696('0x20')](_0x7810ab[_0x7696('0x37')][_0x7696('0x20')]);}_0x496632[_0x7696('0x41')]=qs[_0x7696('0x42')](_0x7810ab[_0x7696('0x37')][_0x7696('0x42')]);_0x496632[_0x7696('0x43')]=qs[_0x7696('0x39')](_[_0x7696('0x44')](_0x7810ab[_0x7696('0x37')],_0x389d97[_0x7696('0x39')]));_0x496632['where'][_0x7696('0x5a')]=_0x77daba['id'];if(_0x7810ab[_0x7696('0x37')][_0x7696('0x46')]){_0x496632['where']=_[_0x7696('0x45')](_0x496632[_0x7696('0x43')],{'$or':_[_0x7696('0x31')](_0x496632['attributes'],function(_0xa84987){var _0x3f5b11={};_0x3f5b11[_0xa84987]={'$like':'%'+_0x7810ab[_0x7696('0x37')][_0x7696('0x46')]+'%'};return _0x3f5b11;})});}_0x496632=_[_0x7696('0x45')]({},_0x496632,_0x7810ab['options']);return db[_0x7696('0x59')][_0x7696('0x5b')](_0x496632);}})[_0x7696('0x28')](function(_0x268acf){if(_0x268acf){return db[_0x7696('0x5c')]['findAndCountAll']({'where':{'id':_[_0x7696('0x31')](_0x268acf,_0x7696('0x5d')),'role':_0x7696('0x5e')},'attributes':['id',_0x7696('0x2e'),_0x7696('0x5f'),_0x7696('0x60'),_0x7696('0x61')]});}})[_0x7696('0x28')](function(_0x50cacd){if(_0x50cacd){return{'count':_0x50cacd['count'],'rows':_[_0x7696('0x31')](_0x50cacd[_0x7696('0x62')],function(_0x1527e1){return{'membername':_0x1527e1[_0x7696('0x2e')],'UserId':_0x1527e1['id'],'queue_name':_0x24661a[_0x7696('0x2e')],'SmsQueueId':_0x24661a['id'],'interface':util[_0x7696('0x63')]('%s/%s',_0x7696('0x64'),_0x1527e1['name']),'penalty':0x0,'paused':_0x1527e1['smsPause'],'createdAt':_0x1527e1[_0x7696('0x61')],'updatedAt':_0x1527e1[_0x7696('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7696('0x28')](respondWithFilteredResult(_0x18b1c8,_0x496632))[_0x7696('0x49')](handleError(_0x18b1c8,null));};exports['getTeams']=function(_0x632db9,_0x5620e1,_0x3f2d5b){var _0x2391f9={};var _0x42bfcc={};var _0x4f3619;var _0x25703c;return db[_0x7696('0x32')][_0x7696('0x58')]({'where':{'id':_0x632db9[_0x7696('0x56')]['id']}})[_0x7696('0x28')](handleEntityNotFound(_0x5620e1,null))[_0x7696('0x28')](function(_0x31f582){if(_0x31f582){_0x4f3619=_0x31f582;_0x42bfcc[_0x7696('0x3b')]=_[_0x7696('0x38')](db[_0x7696('0x65')][_0x7696('0x33')]);_0x42bfcc['query']=_[_0x7696('0x38')](_0x632db9[_0x7696('0x37')]);_0x42bfcc[_0x7696('0x39')]=_[_0x7696('0x3a')](_0x42bfcc['model'],_0x42bfcc[_0x7696('0x37')]);_0x2391f9[_0x7696('0x3c')]=_[_0x7696('0x3a')](_0x42bfcc[_0x7696('0x3b')],qs[_0x7696('0x3d')](_0x632db9['query'][_0x7696('0x3d')]));_0x2391f9['attributes']=_0x2391f9[_0x7696('0x3c')][_0x7696('0x3e')]?_0x2391f9[_0x7696('0x3c')]:_0x42bfcc[_0x7696('0x3b')];_0x2391f9[_0x7696('0x41')]=qs['sort'](_0x632db9['query'][_0x7696('0x42')]);_0x2391f9[_0x7696('0x43')]=qs[_0x7696('0x39')](_[_0x7696('0x44')](_0x632db9[_0x7696('0x37')],_0x42bfcc['filters']));if(_0x632db9[_0x7696('0x37')][_0x7696('0x46')]){_0x2391f9[_0x7696('0x43')]=_['merge'](_0x2391f9['where'],{'$or':_[_0x7696('0x31')](_0x2391f9[_0x7696('0x3c')],function(_0x1a54d3){var _0x2bde4f={};_0x2bde4f[_0x1a54d3]={'$like':'%'+_0x632db9[_0x7696('0x37')][_0x7696('0x46')]+'%'};return _0x2bde4f;})});}_0x2391f9=_[_0x7696('0x45')]({},_0x2391f9,_0x632db9[_0x7696('0x4b')]);return _0x4f3619['getTeams'](_0x2391f9);}})[_0x7696('0x28')](function(_0x4c835c){if(_0x4c835c){_0x25703c=_0x4c835c['length'];if(!_0x632db9[_0x7696('0x37')][_0x7696('0x3f')]('nolimit')){_0x2391f9[_0x7696('0x22')]=qs[_0x7696('0x22')](_0x632db9['query'][_0x7696('0x22')]);_0x2391f9[_0x7696('0x20')]=qs[_0x7696('0x20')](_0x632db9[_0x7696('0x37')][_0x7696('0x20')]);}return _0x4f3619[_0x7696('0x66')](_0x2391f9);}})[_0x7696('0x28')](function(_0x159221){if(_0x159221){return _0x159221?{'count':_0x25703c,'rows':_0x159221}:null;}})[_0x7696('0x28')](respondWithResult(_0x5620e1,null))[_0x7696('0x49')](handleError(_0x5620e1,null));};exports[_0x7696('0x67')]=function(_0xde6c1e,_0x1b4a71,_0x47c2af){var _0x2ab96b=_0xde6c1e['body'][_0x7696('0x68')];return db['Team'][_0x7696('0x5b')]({'where':{'id':_0x2ab96b},'attributes':['id'],'include':[{'model':db[_0x7696('0x5c')],'as':_0x7696('0x69'),'attributes':['id','name',_0x7696('0x6a'),_0x7696('0x6b'),_0x7696('0x6c')],'raw':!![]}]})[_0x7696('0x28')](function(_0x5bddc6){if(_0x5bddc6){var _0x34910d=_[_0x7696('0x6d')](_0x5bddc6,function(_0x218e0a){var _0x18a23b=_0x218e0a['get']({'plain':!![]});return _0x18a23b[_0x7696('0x69')];});return db[_0x7696('0x32')][_0x7696('0x53')]({'where':{'id':_0xde6c1e[_0x7696('0x56')]['id']}})[_0x7696('0x28')](function(_0x247252){return db[_0x7696('0x6e')][_0x7696('0x6f')](function(_0x45a65a){return _0x247252[_0x7696('0x67')](_0x2ab96b,{'transaction':_0x45a65a})[_0x7696('0x28')](function(){return BPromise[_0x7696('0x70')](_0x34910d,function(_0x3c832e){return db[_0x7696('0x59')][_0x7696('0x71')]({'where':{'UserId':_0x3c832e['id'],'SmsQueueId':_0xde6c1e[_0x7696('0x56')]['id']},'transaction':_0x45a65a});});})[_0x7696('0x28')](function(){_0x34910d[_0x7696('0x72')](function(_0xd3a05d){socket[_0x7696('0x73')](_0x7696('0x74'),{'UserId':_0xd3a05d['id'],'SmsQueueId':_0x247252['id']});});});});});}})[_0x7696('0x28')](respondWithStatusCode(_0x1b4a71,null))[_0x7696('0x49')](handleError(_0x1b4a71,null));};exports[_0x7696('0x75')]=function(_0x268f99,_0x558082,_0x9bb63b){return db[_0x7696('0x65')][_0x7696('0x5b')]({'where':{'id':_0x268f99[_0x7696('0x37')]['ids']},'attributes':['id'],'include':[{'model':db[_0x7696('0x5c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x7696('0x28')](handleEntityNotFound(_0x558082,null))[_0x7696('0x28')](function(_0x15380e){var _0x4bc56d=_[_0x7696('0x31')](_0x15380e,'id');var _0xa89b6=[];var _0x8dc500=[];var _0x1727fb=squel[_0x7696('0x76')]();_0x1727fb[_0x7696('0x77')](_0x7696('0x78'))['from'](_0x7696('0x79'),'tq')[_0x7696('0x7a')]('user_has_teams','ut',_0x7696('0x7b'))[_0x7696('0x43')](_0x7696('0x7c'),_0x268f99[_0x7696('0x56')]['id']);for(var _0x3c4609=0x0;_0x3c4609<_0x15380e[_0x7696('0x3e')];_0x3c4609+=0x1){let _0x24906d=_0x15380e[_0x3c4609];for(var _0x4bf0a5=0x0;_0x4bf0a5<_0x24906d[_0x7696('0x69')][_0x7696('0x3e')];_0x4bf0a5+=0x1){let _0xdcbaee=_0x24906d['Agents'][_0x4bf0a5];var _0x184a7d=_0x1727fb[_0x7696('0x7d')]();_0x184a7d[_0x7696('0x43')]('ut.UserId\x20=\x20?',_0xdcbaee['id']);_0x8dc500[_0x7696('0x7e')](db[_0x7696('0x6e')][_0x7696('0x37')](_0x184a7d[_0x7696('0x7f')](),{'type':db[_0x7696('0x6e')][_0x7696('0x80')][_0x7696('0x81')]})[_0x7696('0x28')](function(_0x14a25f){if(_0x14a25f[_0x7696('0x3e')]===0x1){return _0xdcbaee['id'];}else{var _0x163f14=_[_0x7696('0x82')](_[_0x7696('0x31')](_0x14a25f,_0x7696('0x83')),function(_0x2abfcd){return _['includes'](_0x4bc56d,_0x2abfcd);});if(_0x163f14){return _0xdcbaee['id'];}}}));}}return BPromise[_0x7696('0x84')](_0x8dc500)[_0x7696('0x28')](function(_0x291b41){_0xa89b6=_(_0xa89b6)[_0x7696('0x85')](_0x291b41)[_0x7696('0x86')]()[_0x7696('0x87')]();return db[_0x7696('0x32')][_0x7696('0x53')]({'where':{'id':_0x268f99[_0x7696('0x56')]['id']}})[_0x7696('0x28')](function(_0x48957b){return db['sequelize'][_0x7696('0x6f')](function(_0x4cf0f4){return _0x48957b[_0x7696('0x75')](_0x268f99[_0x7696('0x37')][_0x7696('0x68')],{'transaction':_0x4cf0f4})['then'](function(){if(!_[_0x7696('0x88')](_0xa89b6)){return _0x48957b[_0x7696('0x89')](_0xa89b6,{'transaction':_0x4cf0f4});}})[_0x7696('0x28')](function(){_0xa89b6[_0x7696('0x72')](function(_0x281c68){socket[_0x7696('0x73')](_0x7696('0x8a'),{'UserId':_0x281c68,'SmsQueueId':_0x48957b['id']});});});});});});})[_0x7696('0x28')](respondWithStatusCode(_0x558082,null))[_0x7696('0x49')](handleError(_0x558082,null));};exports[_0x7696('0x8b')]=function(_0x3e3445,_0x42d2a4,_0x293ca0){return db['SmsQueue'][_0x7696('0x53')]({'where':{'id':_0x3e3445[_0x7696('0x56')]['id']}})['then'](handleEntityNotFound(_0x42d2a4,null))[_0x7696('0x28')](function(_0x43ba7f){if(_0x43ba7f){return _0x43ba7f[_0x7696('0x8b')](_0x3e3445[_0x7696('0x4d')][_0x7696('0x68')],_[_0x7696('0x8c')](_0x3e3445[_0x7696('0x4d')],[_0x7696('0x68'),'id'])||{})[_0x7696('0x8d')](function(_0x1e8ad8){for(var _0x2ccac4=0x0;_0x2ccac4<_0x3e3445['body'][_0x7696('0x68')][_0x7696('0x3e')];_0x2ccac4+=0x1){socket['emit'](_0x7696('0x74'),{'UserId':Number(_0x3e3445['body'][_0x7696('0x68')][_0x2ccac4]),'SmsQueueId':Number(_0x3e3445[_0x7696('0x56')]['id'])});}return _0x1e8ad8;});}})[_0x7696('0x28')](respondWithResult(_0x42d2a4,null))['catch'](handleError(_0x42d2a4,null));};exports[_0x7696('0x89')]=function(_0xbe7b15,_0x553746,_0x2482f6){return db['SmsQueue'][_0x7696('0x53')]({'where':{'id':_0xbe7b15['params']['id']}})[_0x7696('0x28')](handleEntityNotFound(_0x553746,null))[_0x7696('0x28')](function(_0x2a2fb0){if(_0x2a2fb0){return _0x2a2fb0['removeAgents'](_0xbe7b15[_0x7696('0x37')]['ids'])[_0x7696('0x28')](function(){if(_['isArray'](_0xbe7b15[_0x7696('0x37')]['ids'])){for(var _0x5941d8=0x0;_0x5941d8<_0xbe7b15[_0x7696('0x37')][_0x7696('0x68')][_0x7696('0x3e')];_0x5941d8+=0x1){socket[_0x7696('0x73')](_0x7696('0x8a'),{'UserId':Number(_0xbe7b15[_0x7696('0x37')]['ids'][_0x5941d8]),'SmsQueueId':Number(_0xbe7b15['params']['id'])});}}else{socket[_0x7696('0x73')](_0x7696('0x8a'),{'UserId':Number(_0xbe7b15[_0x7696('0x37')][_0x7696('0x68')]),'SmsQueueId':Number(_0xbe7b15[_0x7696('0x56')]['id'])});}});}})[_0x7696('0x28')](respondWithStatusCode(_0x553746,null))['catch'](handleError(_0x553746,null));};exports[_0x7696('0x8e')]=function(_0x42f5e2,_0x5b0dae,_0x18793d){var _0x3a2454={};var _0x43f671={};var _0x597589;var _0x386113;return db[_0x7696('0x32')][_0x7696('0x58')]({'where':{'id':_0x42f5e2[_0x7696('0x56')]['id']}})[_0x7696('0x28')](handleEntityNotFound(_0x5b0dae,null))[_0x7696('0x28')](function(_0x416ea0){if(_0x416ea0){_0x597589=_0x416ea0;_0x43f671[_0x7696('0x3b')]=_['keys'](db[_0x7696('0x5c')][_0x7696('0x33')]);_0x43f671[_0x7696('0x37')]=_['keys'](_0x42f5e2[_0x7696('0x37')]);_0x43f671[_0x7696('0x39')]=_['intersection'](_0x43f671[_0x7696('0x3b')],_0x43f671['query']);_0x3a2454['attributes']=_[_0x7696('0x3a')](_0x43f671[_0x7696('0x3b')],qs[_0x7696('0x3d')](_0x42f5e2[_0x7696('0x37')][_0x7696('0x3d')]));_0x3a2454['attributes']=_0x3a2454[_0x7696('0x3c')][_0x7696('0x3e')]?_0x3a2454[_0x7696('0x3c')]:_0x43f671['model'];_0x3a2454[_0x7696('0x41')]=qs['sort'](_0x42f5e2[_0x7696('0x37')][_0x7696('0x42')]);_0x3a2454[_0x7696('0x43')]=qs[_0x7696('0x39')](_['pick'](_0x42f5e2[_0x7696('0x37')],_0x43f671[_0x7696('0x39')]));if(_0x42f5e2[_0x7696('0x37')][_0x7696('0x46')]){_0x3a2454[_0x7696('0x43')]=_[_0x7696('0x45')](_0x3a2454[_0x7696('0x43')],{'$or':_[_0x7696('0x31')](_0x3a2454[_0x7696('0x3c')],function(_0x2f30fd){var _0x52bb96={};_0x52bb96[_0x2f30fd]={'$like':'%'+_0x42f5e2[_0x7696('0x37')][_0x7696('0x46')]+'%'};return _0x52bb96;})});}_0x3a2454=_[_0x7696('0x45')]({},_0x3a2454,_0x42f5e2[_0x7696('0x4b')]);return _0x597589[_0x7696('0x8e')](_0x3a2454);}})[_0x7696('0x28')](function(_0x3d3b4d){if(_0x3d3b4d){_0x386113=_0x3d3b4d[_0x7696('0x3e')];if(!_0x42f5e2['query'][_0x7696('0x3f')]('nolimit')){_0x3a2454[_0x7696('0x22')]=qs[_0x7696('0x22')](_0x42f5e2['query'][_0x7696('0x22')]);_0x3a2454['offset']=qs[_0x7696('0x20')](_0x42f5e2[_0x7696('0x37')][_0x7696('0x20')]);}return _0x597589['getAgents'](_0x3a2454);}})['then'](function(_0x3aa8b0){if(_0x3aa8b0){return _0x3aa8b0?{'count':_0x386113,'rows':_0x3aa8b0}:null;}})['then'](respondWithResult(_0x5b0dae,null))[_0x7696('0x49')](handleError(_0x5b0dae,null));}; \ No newline at end of file +var _0xe797=['from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','SELECT','includes','all','union','value','removeAgents','forEach','emit','userSmsQueue:remove','addAgents','omit','isArray','getAgents','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','save','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','findAll','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','smsPause','Team','getTeams','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','each','removeTeams','select','field','tq.TeamId'];(function(_0x1c6f42,_0x4ff2fb){var _0x443f36=function(_0x3b98f1){while(--_0x3b98f1){_0x1c6f42['push'](_0x1c6f42['shift']());}};_0x443f36(++_0x4ff2fb);}(_0xe797,0x12a));var _0x7e79=function(_0x35d884,_0x291012){_0x35d884=_0x35d884-0x0;var _0x39f67f=_0xe797[_0x35d884];return _0x39f67f;};'use strict';var emlformat=require(_0x7e79('0x0'));var rimraf=require(_0x7e79('0x1'));var zipdir=require(_0x7e79('0x2'));var jsonpatch=require(_0x7e79('0x3'));var rp=require(_0x7e79('0x4'));var moment=require(_0x7e79('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7e79('0x6'));var util=require(_0x7e79('0x7'));var path=require('path');var sox=require(_0x7e79('0x8'));var csv=require(_0x7e79('0x9'));var ejs=require(_0x7e79('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7e79('0xb'));var crypto=require(_0x7e79('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7e79('0x9'));var querystring=require(_0x7e79('0xd'));var Papa=require(_0x7e79('0xe'));var Redis=require('ioredis');var authService=require(_0x7e79('0xf'));var qs=require(_0x7e79('0x10'));var as=require(_0x7e79('0x11'));var hardwareService=require(_0x7e79('0x12'));var logger=require(_0x7e79('0x13'))(_0x7e79('0x14'));var utils=require(_0x7e79('0x15'));var config=require(_0x7e79('0x16'));var licenseUtil=require(_0x7e79('0x17'));var db=require('../../mysqldb')['db'];config[_0x7e79('0x18')]=_['defaults'](config[_0x7e79('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x7e79('0x19'))(new Redis(config[_0x7e79('0x18')]));require(_0x7e79('0x1a'))[_0x7e79('0x1b')](socket);function respondWithStatusCode(_0x4ddcfa,_0xa06e32){_0xa06e32=_0xa06e32||0xcc;return function(_0x2c918d){if(_0x2c918d){return _0x4ddcfa[_0x7e79('0x1c')](_0xa06e32);}return _0x4ddcfa[_0x7e79('0x1d')](_0xa06e32)[_0x7e79('0x1e')]();};}function respondWithResult(_0xdabb80,_0x361560){_0x361560=_0x361560||0xc8;return function(_0x4e09b5){if(_0x4e09b5){return _0xdabb80[_0x7e79('0x1d')](_0x361560)[_0x7e79('0x1f')](_0x4e09b5);}};}function respondWithFilteredResult(_0x36db1e,_0x102a46){return function(_0x45b6f3){if(_0x45b6f3){var _0x4c687b=typeof _0x102a46['offset']==='undefined'&&typeof _0x102a46['limit']===_0x7e79('0x20');var _0x123bd4=_0x45b6f3[_0x7e79('0x21')];var _0x49f5f5=_0x4c687b?0x0:_0x102a46[_0x7e79('0x22')];var _0x2c4624=_0x4c687b?_0x45b6f3[_0x7e79('0x21')]:_0x102a46[_0x7e79('0x22')]+_0x102a46[_0x7e79('0x23')];var _0x145600;if(_0x2c4624>=_0x123bd4){_0x2c4624=_0x123bd4;_0x145600=0xc8;}else{_0x145600=0xce;}_0x36db1e[_0x7e79('0x1d')](_0x145600);return _0x36db1e['set'](_0x7e79('0x24'),_0x49f5f5+'-'+_0x2c4624+'/'+_0x123bd4)[_0x7e79('0x1f')](_0x45b6f3);}return null;};}function patchUpdates(_0x4e43de){return function(_0x29529b){try{jsonpatch[_0x7e79('0x25')](_0x29529b,_0x4e43de,!![]);}catch(_0x4736bb){return BPromise['reject'](_0x4736bb);}return _0x29529b[_0x7e79('0x26')]();};}function saveUpdates(_0x537bfa,_0x2ab384){return function(_0x51bcf1){if(_0x51bcf1){return _0x51bcf1['update'](_0x537bfa)[_0x7e79('0x27')](function(_0x67b3be){return _0x67b3be;});}return null;};}function removeEntity(_0x5c1653,_0x384029){return function(_0x9d987){if(_0x9d987){return _0x9d987[_0x7e79('0x28')]()[_0x7e79('0x27')](function(){var _0x4c6cec=_0x9d987[_0x7e79('0x29')]({'plain':!![]});var _0x5d5c74=_0x7e79('0x2a');return db[_0x7e79('0x2b')][_0x7e79('0x28')]({'where':{'type':_0x5d5c74,'resourceId':_0x4c6cec['id']}})[_0x7e79('0x27')](function(){return _0x9d987;});})[_0x7e79('0x27')](function(){_0x5c1653['status'](0xcc)[_0x7e79('0x1e')]();});}};}function handleEntityNotFound(_0xcbd3da,_0x3e8405){return function(_0x49e01e){if(!_0x49e01e){_0xcbd3da['sendStatus'](0x194);}return _0x49e01e;};}function handleError(_0x3b9cbb,_0xd734c8){_0xd734c8=_0xd734c8||0x1f4;return function(_0x5791d1){logger[_0x7e79('0x2c')](_0x5791d1[_0x7e79('0x2d')]);if(_0x5791d1['name']){delete _0x5791d1[_0x7e79('0x2e')];}_0x3b9cbb[_0x7e79('0x1d')](_0xd734c8)[_0x7e79('0x2f')](_0x5791d1);};}exports[_0x7e79('0x30')]=function(_0x3a4504,_0x48ed88){var _0x184c66={},_0x481970={},_0x3f9e54={'count':0x0,'rows':[]};var _0x6e61fa=_[_0x7e79('0x31')](db[_0x7e79('0x32')][_0x7e79('0x33')],function(_0x47125a){return{'name':_0x47125a[_0x7e79('0x34')],'type':_0x47125a[_0x7e79('0x35')][_0x7e79('0x36')]};});_0x481970[_0x7e79('0x37')]=_[_0x7e79('0x31')](_0x6e61fa,_0x7e79('0x2e'));_0x481970[_0x7e79('0x38')]=_[_0x7e79('0x39')](_0x3a4504['query']);_0x481970[_0x7e79('0x3a')]=_[_0x7e79('0x3b')](_0x481970[_0x7e79('0x37')],_0x481970[_0x7e79('0x38')]);_0x184c66[_0x7e79('0x3c')]=_[_0x7e79('0x3b')](_0x481970[_0x7e79('0x37')],qs[_0x7e79('0x3d')](_0x3a4504['query'][_0x7e79('0x3d')]));_0x184c66[_0x7e79('0x3c')]=_0x184c66[_0x7e79('0x3c')][_0x7e79('0x3e')]?_0x184c66[_0x7e79('0x3c')]:_0x481970[_0x7e79('0x37')];if(!_0x3a4504['query']['hasOwnProperty'](_0x7e79('0x3f'))){_0x184c66[_0x7e79('0x23')]=qs[_0x7e79('0x23')](_0x3a4504[_0x7e79('0x38')][_0x7e79('0x23')]);_0x184c66[_0x7e79('0x22')]=qs['offset'](_0x3a4504[_0x7e79('0x38')][_0x7e79('0x22')]);}_0x184c66[_0x7e79('0x40')]=qs[_0x7e79('0x41')](_0x3a4504['query'][_0x7e79('0x41')]);_0x184c66[_0x7e79('0x42')]=qs['filters'](_[_0x7e79('0x43')](_0x3a4504[_0x7e79('0x38')],_0x481970['filters']),_0x6e61fa);if(_0x3a4504[_0x7e79('0x38')][_0x7e79('0x44')]){_0x184c66[_0x7e79('0x42')]=_[_0x7e79('0x45')](_0x184c66[_0x7e79('0x42')],{'$or':_[_0x7e79('0x31')](_0x6e61fa,function(_0x213b00){if(_0x213b00[_0x7e79('0x35')]!==_0x7e79('0x46')){var _0xe1c5b7={};_0xe1c5b7[_0x213b00['name']]={'$like':'%'+_0x3a4504[_0x7e79('0x38')][_0x7e79('0x44')]+'%'};return _0xe1c5b7;}})});}_0x184c66=_[_0x7e79('0x45')]({},_0x184c66,_0x3a4504[_0x7e79('0x47')]);var _0x566fdd={'where':_0x184c66[_0x7e79('0x42')]};return db['SmsQueue'][_0x7e79('0x21')](_0x566fdd)[_0x7e79('0x27')](function(_0x552ab5){_0x3f9e54[_0x7e79('0x21')]=_0x552ab5;if(_0x3a4504['query'][_0x7e79('0x48')]){_0x184c66['include']=[{'all':!![]}];}return db[_0x7e79('0x32')]['findAll'](_0x184c66);})['then'](function(_0x378a5d){_0x3f9e54[_0x7e79('0x49')]=_0x378a5d;return _0x3f9e54;})[_0x7e79('0x27')](respondWithFilteredResult(_0x48ed88,_0x184c66))['catch'](handleError(_0x48ed88,null));};exports[_0x7e79('0x4a')]=function(_0x42c0d7,_0x3bfe1f){var _0x341ebb={'raw':!![],'where':{'id':_0x42c0d7[_0x7e79('0x4b')]['id']}},_0x1d8b6f={};_0x1d8b6f[_0x7e79('0x37')]=_[_0x7e79('0x39')](db[_0x7e79('0x32')]['rawAttributes']);_0x1d8b6f[_0x7e79('0x38')]=_[_0x7e79('0x39')](_0x42c0d7[_0x7e79('0x38')]);_0x1d8b6f[_0x7e79('0x3a')]=_['intersection'](_0x1d8b6f[_0x7e79('0x37')],_0x1d8b6f[_0x7e79('0x38')]);_0x341ebb['attributes']=_[_0x7e79('0x3b')](_0x1d8b6f[_0x7e79('0x37')],qs['fields'](_0x42c0d7[_0x7e79('0x38')][_0x7e79('0x3d')]));_0x341ebb['attributes']=_0x341ebb['attributes'][_0x7e79('0x3e')]?_0x341ebb['attributes']:_0x1d8b6f[_0x7e79('0x37')];if(_0x42c0d7[_0x7e79('0x38')][_0x7e79('0x48')]){_0x341ebb[_0x7e79('0x4c')]=[{'all':!![]}];}_0x341ebb=_['merge']({},_0x341ebb,_0x42c0d7[_0x7e79('0x47')]);return db[_0x7e79('0x32')][_0x7e79('0x4d')](_0x341ebb)[_0x7e79('0x27')](handleEntityNotFound(_0x3bfe1f,null))[_0x7e79('0x27')](respondWithResult(_0x3bfe1f,null))['catch'](handleError(_0x3bfe1f,null));};exports[_0x7e79('0x4e')]=function(_0x5ab4a5,_0x4f062c){return db[_0x7e79('0x32')]['create'](_0x5ab4a5[_0x7e79('0x4f')],{})[_0x7e79('0x27')](function(_0x361a27){var _0x1442de=_0x5ab4a5[_0x7e79('0x50')][_0x7e79('0x29')]({'plain':!![]});if(!_0x1442de)throw new Error(_0x7e79('0x51'));if(_0x1442de['role']===_0x7e79('0x50')){var _0x37c3ab=_0x361a27[_0x7e79('0x29')]({'plain':!![]});var _0x1e8f00=_0x7e79('0x2a');return db[_0x7e79('0x52')]['find']({'where':{'name':_0x1e8f00,'userProfileId':_0x1442de[_0x7e79('0x53')]},'raw':!![]})[_0x7e79('0x27')](function(_0x1962cb){if(_0x1962cb&&_0x1962cb['autoAssociation']===0x0){return db[_0x7e79('0x2b')]['create']({'name':_0x37c3ab['name'],'resourceId':_0x37c3ab['id'],'type':_0x1962cb['name'],'sectionId':_0x1962cb['id']},{})[_0x7e79('0x27')](function(){return _0x361a27;});}else{return _0x361a27;}})[_0x7e79('0x54')](function(_0xf3a8de){logger[_0x7e79('0x2c')](_0x7e79('0x55'),_0xf3a8de);throw _0xf3a8de;});}return _0x361a27;})['then'](respondWithResult(_0x4f062c,0xc9))[_0x7e79('0x54')](handleError(_0x4f062c,null));};exports['update']=function(_0x3879fc,_0x1bed0a){if(_0x3879fc[_0x7e79('0x4f')]['id']){delete _0x3879fc[_0x7e79('0x4f')]['id'];}return db[_0x7e79('0x32')]['find']({'where':{'id':_0x3879fc['params']['id']}})['then'](handleEntityNotFound(_0x1bed0a,null))['then'](saveUpdates(_0x3879fc['body'],null))[_0x7e79('0x27')](respondWithResult(_0x1bed0a,null))[_0x7e79('0x54')](handleError(_0x1bed0a,null));};exports[_0x7e79('0x28')]=function(_0x571a8b,_0x2b44b4){return db[_0x7e79('0x32')][_0x7e79('0x4d')]({'where':{'id':_0x571a8b[_0x7e79('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2b44b4,null))[_0x7e79('0x27')](removeEntity(_0x2b44b4,null))[_0x7e79('0x54')](handleError(_0x2b44b4,null));};exports[_0x7e79('0x56')]=function(_0xaeedc1,_0xdaba27){return db[_0x7e79('0x32')][_0x7e79('0x56')]()['then'](respondWithResult(_0xdaba27,null))[_0x7e79('0x54')](handleError(_0xdaba27,null));};exports[_0x7e79('0x57')]=function(_0x8c2622,_0x471bcd,_0x107746){var _0x1efdde={'raw':!![],'where':{}},_0x5b2dbf={},_0x3bdfe8;return db['SmsQueue'][_0x7e79('0x58')]({'where':{'id':_0x8c2622[_0x7e79('0x4b')]['id']}})[_0x7e79('0x27')](handleEntityNotFound(_0x471bcd,null))['then'](function(_0x1d638e){if(_0x1d638e){_0x3bdfe8=_0x1d638e[_0x7e79('0x29')]({'plain':!![]});_0x5b2dbf[_0x7e79('0x37')]=_['keys'](db[_0x7e79('0x59')]['rawAttributes']);_0x5b2dbf[_0x7e79('0x38')]=_[_0x7e79('0x39')](_0x8c2622[_0x7e79('0x38')]);_0x5b2dbf[_0x7e79('0x3a')]=_[_0x7e79('0x3b')](_0x5b2dbf[_0x7e79('0x37')],_0x5b2dbf[_0x7e79('0x38')]);_0x1efdde[_0x7e79('0x3c')]=_[_0x7e79('0x3b')](_0x5b2dbf[_0x7e79('0x37')],qs[_0x7e79('0x3d')](_0x8c2622[_0x7e79('0x38')][_0x7e79('0x3d')]));_0x1efdde[_0x7e79('0x3c')]=_0x1efdde[_0x7e79('0x3c')][_0x7e79('0x3e')]?_0x1efdde[_0x7e79('0x3c')]:_0x5b2dbf[_0x7e79('0x37')];if(!_0x8c2622[_0x7e79('0x38')]['hasOwnProperty'](_0x7e79('0x3f'))){_0x1efdde['limit']=qs['limit'](_0x8c2622[_0x7e79('0x38')][_0x7e79('0x23')]);_0x1efdde[_0x7e79('0x22')]=qs['offset'](_0x8c2622[_0x7e79('0x38')]['offset']);}_0x1efdde['order']=qs[_0x7e79('0x41')](_0x8c2622[_0x7e79('0x38')][_0x7e79('0x41')]);_0x1efdde[_0x7e79('0x42')]=qs['filters'](_[_0x7e79('0x43')](_0x8c2622[_0x7e79('0x38')],_0x5b2dbf[_0x7e79('0x3a')]));_0x1efdde[_0x7e79('0x42')][_0x7e79('0x5a')]=_0x1d638e['id'];if(_0x8c2622['query']['filter']){_0x1efdde[_0x7e79('0x42')]=_[_0x7e79('0x45')](_0x1efdde[_0x7e79('0x42')],{'$or':_[_0x7e79('0x31')](_0x1efdde[_0x7e79('0x3c')],function(_0x4babe3){var _0xd2d7be={};_0xd2d7be[_0x4babe3]={'$like':'%'+_0x8c2622['query']['filter']+'%'};return _0xd2d7be;})});}_0x1efdde=_['merge']({},_0x1efdde,_0x8c2622[_0x7e79('0x47')]);return db[_0x7e79('0x59')][_0x7e79('0x5b')](_0x1efdde);}})[_0x7e79('0x27')](function(_0x4c9386){if(_0x4c9386){return db[_0x7e79('0x5c')][_0x7e79('0x5d')]({'where':{'id':_['map'](_0x4c9386,_0x7e79('0x5e')),'role':_0x7e79('0x5f')},'attributes':['id',_0x7e79('0x2e'),'smsPause',_0x7e79('0x60'),_0x7e79('0x61')]});}})[_0x7e79('0x27')](function(_0x26d7c5){if(_0x26d7c5){return{'count':_0x26d7c5[_0x7e79('0x21')],'rows':_['map'](_0x26d7c5[_0x7e79('0x49')],function(_0xdef9be){return{'membername':_0xdef9be[_0x7e79('0x2e')],'UserId':_0xdef9be['id'],'queue_name':_0x3bdfe8[_0x7e79('0x2e')],'SmsQueueId':_0x3bdfe8['id'],'interface':util[_0x7e79('0x62')](_0x7e79('0x63'),'SIP',_0xdef9be['name']),'penalty':0x0,'paused':_0xdef9be[_0x7e79('0x64')],'createdAt':_0xdef9be[_0x7e79('0x61')],'updatedAt':_0xdef9be['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x7e79('0x27')](respondWithFilteredResult(_0x471bcd,_0x1efdde))[_0x7e79('0x54')](handleError(_0x471bcd,null));};exports['getTeams']=function(_0x3a5144,_0x51c682,_0xeaa2cb){var _0x3d4adb={};var _0x334c62={};var _0x492372;var _0x9b03b6;return db[_0x7e79('0x32')][_0x7e79('0x58')]({'where':{'id':_0x3a5144[_0x7e79('0x4b')]['id']}})['then'](handleEntityNotFound(_0x51c682,null))[_0x7e79('0x27')](function(_0x5e2c0a){if(_0x5e2c0a){_0x492372=_0x5e2c0a;_0x334c62[_0x7e79('0x37')]=_[_0x7e79('0x39')](db[_0x7e79('0x65')][_0x7e79('0x33')]);_0x334c62[_0x7e79('0x38')]=_['keys'](_0x3a5144[_0x7e79('0x38')]);_0x334c62[_0x7e79('0x3a')]=_[_0x7e79('0x3b')](_0x334c62[_0x7e79('0x37')],_0x334c62[_0x7e79('0x38')]);_0x3d4adb['attributes']=_['intersection'](_0x334c62['model'],qs[_0x7e79('0x3d')](_0x3a5144[_0x7e79('0x38')][_0x7e79('0x3d')]));_0x3d4adb[_0x7e79('0x3c')]=_0x3d4adb[_0x7e79('0x3c')][_0x7e79('0x3e')]?_0x3d4adb[_0x7e79('0x3c')]:_0x334c62[_0x7e79('0x37')];_0x3d4adb['order']=qs[_0x7e79('0x41')](_0x3a5144['query'][_0x7e79('0x41')]);_0x3d4adb[_0x7e79('0x42')]=qs[_0x7e79('0x3a')](_[_0x7e79('0x43')](_0x3a5144[_0x7e79('0x38')],_0x334c62[_0x7e79('0x3a')]));if(_0x3a5144['query']['filter']){_0x3d4adb[_0x7e79('0x42')]=_[_0x7e79('0x45')](_0x3d4adb['where'],{'$or':_[_0x7e79('0x31')](_0x3d4adb[_0x7e79('0x3c')],function(_0x18e550){var _0x5b773e={};_0x5b773e[_0x18e550]={'$like':'%'+_0x3a5144['query'][_0x7e79('0x44')]+'%'};return _0x5b773e;})});}_0x3d4adb=_[_0x7e79('0x45')]({},_0x3d4adb,_0x3a5144[_0x7e79('0x47')]);return _0x492372[_0x7e79('0x66')](_0x3d4adb);}})[_0x7e79('0x27')](function(_0x3b43a8){if(_0x3b43a8){_0x9b03b6=_0x3b43a8['length'];if(!_0x3a5144[_0x7e79('0x38')]['hasOwnProperty']('nolimit')){_0x3d4adb[_0x7e79('0x23')]=qs[_0x7e79('0x23')](_0x3a5144[_0x7e79('0x38')]['limit']);_0x3d4adb['offset']=qs[_0x7e79('0x22')](_0x3a5144['query'][_0x7e79('0x22')]);}return _0x492372[_0x7e79('0x66')](_0x3d4adb);}})[_0x7e79('0x27')](function(_0x371a9f){if(_0x371a9f){return _0x371a9f?{'count':_0x9b03b6,'rows':_0x371a9f}:null;}})[_0x7e79('0x27')](respondWithResult(_0x51c682,null))[_0x7e79('0x54')](handleError(_0x51c682,null));};exports[_0x7e79('0x67')]=function(_0x4ceb58,_0x2b024d,_0x42ff52){var _0x554c77=_0x4ceb58[_0x7e79('0x4f')][_0x7e79('0x68')];return db[_0x7e79('0x65')][_0x7e79('0x5b')]({'where':{'id':_0x554c77},'attributes':['id'],'include':[{'model':db[_0x7e79('0x5c')],'as':_0x7e79('0x69'),'attributes':['id','name','online',_0x7e79('0x6a'),_0x7e79('0x6b')],'raw':!![]}]})[_0x7e79('0x27')](function(_0x30116f){if(_0x30116f){var _0x4f7130=_[_0x7e79('0x6c')](_0x30116f,function(_0x17c24c){var _0x1ce363=_0x17c24c[_0x7e79('0x29')]({'plain':!![]});return _0x1ce363[_0x7e79('0x69')];});return db[_0x7e79('0x32')][_0x7e79('0x4d')]({'where':{'id':_0x4ceb58[_0x7e79('0x4b')]['id']}})[_0x7e79('0x27')](function(_0x118a79){return db[_0x7e79('0x6d')][_0x7e79('0x6e')](function(_0x593e5c){return _0x118a79['addTeams'](_0x554c77,{'transaction':_0x593e5c})['then'](function(){return BPromise[_0x7e79('0x6f')](_0x4f7130,function(_0x4f231d){return db[_0x7e79('0x59')]['findOrCreate']({'where':{'UserId':_0x4f231d['id'],'SmsQueueId':_0x4ceb58[_0x7e79('0x4b')]['id']},'transaction':_0x593e5c});});})['then'](function(){_0x4f7130['forEach'](function(_0x1ad3d2){socket['emit']('userSmsQueue:save',{'UserId':_0x1ad3d2['id'],'SmsQueueId':_0x118a79['id']});});});});});}})['then'](respondWithStatusCode(_0x2b024d,null))[_0x7e79('0x54')](handleError(_0x2b024d,null));};exports[_0x7e79('0x70')]=function(_0x5f47cb,_0x3979f3,_0x1716b9){return db[_0x7e79('0x65')][_0x7e79('0x5b')]({'where':{'id':_0x5f47cb['query'][_0x7e79('0x68')]},'attributes':['id'],'include':[{'model':db[_0x7e79('0x5c')],'as':_0x7e79('0x69'),'attributes':['id'],'raw':!![]}]})[_0x7e79('0x27')](handleEntityNotFound(_0x3979f3,null))['then'](function(_0x2a0941){var _0x447ab6=_[_0x7e79('0x31')](_0x2a0941,'id');var _0x3ce471=[];var _0x1cdb8d=[];var _0x277d92=squel[_0x7e79('0x71')]();_0x277d92[_0x7e79('0x72')](_0x7e79('0x73'))[_0x7e79('0x74')]('team_has_sms_queues','tq')[_0x7e79('0x75')](_0x7e79('0x76'),'ut',_0x7e79('0x77'))[_0x7e79('0x42')](_0x7e79('0x78'),_0x5f47cb[_0x7e79('0x4b')]['id']);for(var _0x3ef5f1=0x0;_0x3ef5f1<_0x2a0941[_0x7e79('0x3e')];_0x3ef5f1+=0x1){let _0x2fb9f9=_0x2a0941[_0x3ef5f1];for(var _0x175676=0x0;_0x175676<_0x2fb9f9['Agents'][_0x7e79('0x3e')];_0x175676+=0x1){let _0x2a1121=_0x2fb9f9[_0x7e79('0x69')][_0x175676];var _0x59e79e=_0x277d92[_0x7e79('0x79')]();_0x59e79e[_0x7e79('0x42')](_0x7e79('0x7a'),_0x2a1121['id']);_0x1cdb8d[_0x7e79('0x7b')](db[_0x7e79('0x6d')]['query'](_0x59e79e['toString'](),{'type':db[_0x7e79('0x6d')]['QueryTypes'][_0x7e79('0x7c')]})[_0x7e79('0x27')](function(_0x56b976){if(_0x56b976[_0x7e79('0x3e')]===0x1){return _0x2a1121['id'];}else{var _0x23f426=_['every'](_['map'](_0x56b976,'TeamId'),function(_0x40b6d7){return _[_0x7e79('0x7d')](_0x447ab6,_0x40b6d7);});if(_0x23f426){return _0x2a1121['id'];}}}));}}return BPromise[_0x7e79('0x7e')](_0x1cdb8d)[_0x7e79('0x27')](function(_0x43dcc2){_0x3ce471=_(_0x3ce471)[_0x7e79('0x7f')](_0x43dcc2)['compact']()[_0x7e79('0x80')]();return db[_0x7e79('0x32')][_0x7e79('0x4d')]({'where':{'id':_0x5f47cb['params']['id']}})['then'](function(_0x480b96){return db[_0x7e79('0x6d')][_0x7e79('0x6e')](function(_0x352c25){return _0x480b96[_0x7e79('0x70')](_0x5f47cb[_0x7e79('0x38')][_0x7e79('0x68')],{'transaction':_0x352c25})[_0x7e79('0x27')](function(){if(!_['isEmpty'](_0x3ce471)){return _0x480b96[_0x7e79('0x81')](_0x3ce471,{'transaction':_0x352c25});}})[_0x7e79('0x27')](function(){_0x3ce471[_0x7e79('0x82')](function(_0x60c404){socket[_0x7e79('0x83')](_0x7e79('0x84'),{'UserId':_0x60c404,'SmsQueueId':_0x480b96['id']});});});});});});})[_0x7e79('0x27')](respondWithStatusCode(_0x3979f3,null))['catch'](handleError(_0x3979f3,null));};exports[_0x7e79('0x85')]=function(_0x189347,_0x2d86f7,_0x577ea7){return db[_0x7e79('0x32')]['find']({'where':{'id':_0x189347['params']['id']}})[_0x7e79('0x27')](handleEntityNotFound(_0x2d86f7,null))[_0x7e79('0x27')](function(_0x235960){if(_0x235960){return _0x235960[_0x7e79('0x85')](_0x189347['body'][_0x7e79('0x68')],_[_0x7e79('0x86')](_0x189347['body'],[_0x7e79('0x68'),'id'])||{})['spread'](function(_0x24c1b6){for(var _0x5407b8=0x0;_0x5407b8<_0x189347[_0x7e79('0x4f')]['ids'][_0x7e79('0x3e')];_0x5407b8+=0x1){socket['emit']('userSmsQueue:save',{'UserId':Number(_0x189347[_0x7e79('0x4f')]['ids'][_0x5407b8]),'SmsQueueId':Number(_0x189347['params']['id'])});}return _0x24c1b6;});}})[_0x7e79('0x27')](respondWithResult(_0x2d86f7,null))[_0x7e79('0x54')](handleError(_0x2d86f7,null));};exports[_0x7e79('0x81')]=function(_0x395133,_0x392e02,_0x2956b3){return db[_0x7e79('0x32')]['find']({'where':{'id':_0x395133[_0x7e79('0x4b')]['id']}})['then'](handleEntityNotFound(_0x392e02,null))[_0x7e79('0x27')](function(_0x102fea){if(_0x102fea){return _0x102fea[_0x7e79('0x81')](_0x395133[_0x7e79('0x38')][_0x7e79('0x68')])[_0x7e79('0x27')](function(){if(_[_0x7e79('0x87')](_0x395133['query'][_0x7e79('0x68')])){for(var _0x47564c=0x0;_0x47564c<_0x395133[_0x7e79('0x38')][_0x7e79('0x68')][_0x7e79('0x3e')];_0x47564c+=0x1){socket[_0x7e79('0x83')](_0x7e79('0x84'),{'UserId':Number(_0x395133[_0x7e79('0x38')][_0x7e79('0x68')][_0x47564c]),'SmsQueueId':Number(_0x395133[_0x7e79('0x4b')]['id'])});}}else{socket[_0x7e79('0x83')]('userSmsQueue:remove',{'UserId':Number(_0x395133[_0x7e79('0x38')][_0x7e79('0x68')]),'SmsQueueId':Number(_0x395133[_0x7e79('0x4b')]['id'])});}});}})[_0x7e79('0x27')](respondWithStatusCode(_0x392e02,null))[_0x7e79('0x54')](handleError(_0x392e02,null));};exports[_0x7e79('0x88')]=function(_0x409acd,_0x50a87b,_0x13eae5){var _0x2fd315={};var _0x1da9d4={};var _0x419795;var _0x438291;return db[_0x7e79('0x32')][_0x7e79('0x58')]({'where':{'id':_0x409acd[_0x7e79('0x4b')]['id']}})[_0x7e79('0x27')](handleEntityNotFound(_0x50a87b,null))[_0x7e79('0x27')](function(_0x24521d){if(_0x24521d){_0x419795=_0x24521d;_0x1da9d4[_0x7e79('0x37')]=_[_0x7e79('0x39')](db[_0x7e79('0x5c')][_0x7e79('0x33')]);_0x1da9d4[_0x7e79('0x38')]=_[_0x7e79('0x39')](_0x409acd[_0x7e79('0x38')]);_0x1da9d4['filters']=_[_0x7e79('0x3b')](_0x1da9d4[_0x7e79('0x37')],_0x1da9d4[_0x7e79('0x38')]);_0x2fd315[_0x7e79('0x3c')]=_[_0x7e79('0x3b')](_0x1da9d4[_0x7e79('0x37')],qs['fields'](_0x409acd[_0x7e79('0x38')]['fields']));_0x2fd315['attributes']=_0x2fd315['attributes'][_0x7e79('0x3e')]?_0x2fd315[_0x7e79('0x3c')]:_0x1da9d4[_0x7e79('0x37')];_0x2fd315[_0x7e79('0x40')]=qs['sort'](_0x409acd[_0x7e79('0x38')][_0x7e79('0x41')]);_0x2fd315[_0x7e79('0x42')]=qs[_0x7e79('0x3a')](_[_0x7e79('0x43')](_0x409acd[_0x7e79('0x38')],_0x1da9d4[_0x7e79('0x3a')]));if(_0x409acd[_0x7e79('0x38')][_0x7e79('0x44')]){_0x2fd315[_0x7e79('0x42')]=_['merge'](_0x2fd315['where'],{'$or':_[_0x7e79('0x31')](_0x2fd315[_0x7e79('0x3c')],function(_0x3d0505){var _0x19886f={};_0x19886f[_0x3d0505]={'$like':'%'+_0x409acd[_0x7e79('0x38')][_0x7e79('0x44')]+'%'};return _0x19886f;})});}_0x2fd315=_[_0x7e79('0x45')]({},_0x2fd315,_0x409acd['options']);return _0x419795['getAgents'](_0x2fd315);}})[_0x7e79('0x27')](function(_0x15ac1d){if(_0x15ac1d){_0x438291=_0x15ac1d[_0x7e79('0x3e')];if(!_0x409acd[_0x7e79('0x38')][_0x7e79('0x89')](_0x7e79('0x3f'))){_0x2fd315[_0x7e79('0x23')]=qs[_0x7e79('0x23')](_0x409acd[_0x7e79('0x38')][_0x7e79('0x23')]);_0x2fd315[_0x7e79('0x22')]=qs[_0x7e79('0x22')](_0x409acd[_0x7e79('0x38')][_0x7e79('0x22')]);}return _0x419795[_0x7e79('0x88')](_0x2fd315);}})['then'](function(_0x503d49){if(_0x503d49){return _0x503d49?{'count':_0x438291,'rows':_0x503d49}:null;}})['then'](respondWithResult(_0x50a87b,null))['catch'](handleError(_0x50a87b,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 7a4aead..02e87ad 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 _0xb119=['exports','events','SmsQueue','setMaxListeners','save','update','remove','emit','hook'];(function(_0x34eb31,_0x8f0f70){var _0x254994=function(_0xbec9a3){while(--_0xbec9a3){_0x34eb31['push'](_0x34eb31['shift']());}};_0x254994(++_0x8f0f70);}(_0xb119,0xbe));var _0x9b11=function(_0x414c21,_0x1c1973){_0x414c21=_0x414c21-0x0;var _0x47b5d8=_0xb119[_0x414c21];return _0x47b5d8;};'use strict';var EventEmitter=require(_0x9b11('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x9b11('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x9b11('0x2')](0x0);var events={'afterCreate':_0x9b11('0x3'),'afterUpdate':_0x9b11('0x4'),'afterDestroy':_0x9b11('0x5')};function emitEvent(_0x56c64e){return function(_0xeb0cc2,_0x269739,_0xacdbc5){SmsQueueEvents[_0x9b11('0x6')](_0x56c64e+':'+_0xeb0cc2['id'],_0xeb0cc2);SmsQueueEvents[_0x9b11('0x6')](_0x56c64e,_0xeb0cc2);_0xacdbc5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x9b11('0x7')](e,emitEvent(event));}}module[_0x9b11('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0xf686=['update','remove','emit','hasOwnProperty','exports','events','setMaxListeners','save'];(function(_0x3748ab,_0x13059e){var _0x3aca73=function(_0x164a6b){while(--_0x164a6b){_0x3748ab['push'](_0x3748ab['shift']());}};_0x3aca73(++_0x13059e);}(_0xf686,0xe5));var _0x6f68=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf686[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x6f68('0x0'));var SmsQueue=require('../../mysqldb')['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x6f68('0x1')](0x0);var events={'afterCreate':_0x6f68('0x2'),'afterUpdate':_0x6f68('0x3'),'afterDestroy':_0x6f68('0x4')};function emitEvent(_0x52e4d1){return function(_0x5bdf3a,_0x229e84,_0x27a62d){SmsQueueEvents[_0x6f68('0x5')](_0x52e4d1+':'+_0x5bdf3a['id'],_0x5bdf3a);SmsQueueEvents[_0x6f68('0x5')](_0x52e4d1,_0x5bdf3a);_0x27a62d(null);};}for(var e in events){if(events[_0x6f68('0x6')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x6f68('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index a3e9bec..15cbdc1 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 _0x3e1d=['../../config/logger','api','bluebird','request-promise','path','exports','define','SmsQueue','util'];(function(_0x2c2cac,_0x12ab98){var _0x92cbe3=function(_0x460fd5){while(--_0x460fd5){_0x2c2cac['push'](_0x2c2cac['shift']());}};_0x92cbe3(++_0x12ab98);}(_0x3e1d,0x8f));var _0xd3e1=function(_0x54f4f1,_0x2e603b){_0x54f4f1=_0x54f4f1-0x0;var _0x14b71f=_0x3e1d[_0x54f4f1];return _0x14b71f;};'use strict';var _=require('lodash');var util=require(_0xd3e1('0x0'));var logger=require(_0xd3e1('0x1'))(_0xd3e1('0x2'));var moment=require('moment');var BPromise=require(_0xd3e1('0x3'));var rp=require(_0xd3e1('0x4'));var fs=require('fs');var path=require(_0xd3e1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module[_0xd3e1('0x6')]=function(_0x2a76d6,_0x84c5c4){return _0x2a76d6[_0xd3e1('0x7')](_0xd3e1('0x8'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb436=['request-promise','path','./smsQueue.attributes','define','SmsQueue','sms_queues','lodash','util','../../config/logger','api','bluebird'];(function(_0x3cf71a,_0xb600b0){var _0xb9da1a=function(_0x3e2836){while(--_0x3e2836){_0x3cf71a['push'](_0x3cf71a['shift']());}};_0xb9da1a(++_0xb600b0);}(_0xb436,0xc1));var _0x6b43=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0xb436[_0xe73080];return _0x12cbc4;};'use strict';var _=require(_0x6b43('0x0'));var util=require(_0x6b43('0x1'));var logger=require(_0x6b43('0x2'))(_0x6b43('0x3'));var moment=require('moment');var BPromise=require(_0x6b43('0x4'));var rp=require(_0x6b43('0x5'));var fs=require('fs');var path=require(_0x6b43('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6b43('0x7'));module['exports']=function(_0x3b1c44,_0x4216b2){return _0x3b1c44[_0x6b43('0x8')](_0x6b43('0x9'),attributes,{'tableName':_0x6b43('0xa'),'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 8cdd72d..9f7fbca 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 _0x265c=['code','message','result','catch','GetSmsQueue','findAll','options','where','attributes','include','model','map','ShowSmsQueue','SmsQueue','find','raw','then','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','./smsQueue.socket','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x265c,0xad));var _0xc265=function(_0x52494e,_0x3b6d6f){_0x52494e=_0x52494e-0x0;var _0x1b8001=_0x265c[_0x52494e];return _0x1b8001;};'use strict';var _=require(_0xc265('0x0'));var util=require(_0xc265('0x1'));var moment=require(_0xc265('0x2'));var BPromise=require(_0xc265('0x3'));var rs=require(_0xc265('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc265('0x5'))['db'];var utils=require(_0xc265('0x6'));var logger=require(_0xc265('0x7'))(_0xc265('0x8'));var config=require(_0xc265('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc265('0xa')][_0xc265('0xb')]({'port':0x232a});config['redis']=_[_0xc265('0xc')](config[_0xc265('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc265('0xd')]));require(_0xc265('0xe'))['register'](socket);function respondWithRpcPromise(_0xec417,_0x40c00b,_0x12b1e2){return new BPromise(function(_0x9dd388,_0x31f551){return client[_0xc265('0xf')](_0xec417,_0x12b1e2)['then'](function(_0x44cfc4){logger[_0xc265('0x10')](_0xc265('0x11'),_0x40c00b,_0xc265('0x12'));logger[_0xc265('0x13')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x40c00b,_0xc265('0x12'),JSON[_0xc265('0x14')](_0x44cfc4));if(_0x44cfc4[_0xc265('0x15')]){if(_0x44cfc4[_0xc265('0x15')][_0xc265('0x16')]===0x1f4){logger[_0xc265('0x15')](_0xc265('0x11'),_0x40c00b,_0x44cfc4['error'][_0xc265('0x17')]);return _0x31f551(_0x44cfc4[_0xc265('0x15')][_0xc265('0x17')]);}logger[_0xc265('0x15')](_0xc265('0x11'),_0x40c00b,_0x44cfc4['error'][_0xc265('0x17')]);return _0x9dd388(_0x44cfc4[_0xc265('0x15')][_0xc265('0x17')]);}else{logger[_0xc265('0x10')](_0xc265('0x11'),_0x40c00b,_0xc265('0x12'));_0x9dd388(_0x44cfc4[_0xc265('0x18')][_0xc265('0x17')]);}})[_0xc265('0x19')](function(_0x13d9f5){logger[_0xc265('0x15')](_0xc265('0x11'),_0x40c00b,_0x13d9f5);_0x31f551(_0x13d9f5);});});}exports[_0xc265('0x1a')]=function(_0x44d32e){var _0x5505e7=this;return new Promise(function(_0x57007a,_0x155d66){return db['SmsQueue'][_0xc265('0x1b')]({'raw':_0x44d32e['options']?_0x44d32e[_0xc265('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x44d32e[_0xc265('0x1c')]?_0x44d32e[_0xc265('0x1c')][_0xc265('0x1d')]||null:null,'attributes':_0x44d32e[_0xc265('0x1c')]?_0x44d32e[_0xc265('0x1c')][_0xc265('0x1e')]||null:null,'limit':_0x44d32e['options']?_0x44d32e['options']['limit']||null:null,'include':_0x44d32e[_0xc265('0x1c')]?_0x44d32e[_0xc265('0x1c')]['include']?_['map'](_0x44d32e[_0xc265('0x1c')][_0xc265('0x1f')],function(_0x2d1fbb){return{'model':db[_0x2d1fbb[_0xc265('0x20')]],'as':_0x2d1fbb['as'],'attributes':_0x2d1fbb[_0xc265('0x1e')],'include':_0x2d1fbb[_0xc265('0x1f')]?_[_0xc265('0x21')](_0x2d1fbb[_0xc265('0x1f')],function(_0x3953ce){return{'model':db[_0x3953ce[_0xc265('0x20')]],'as':_0x3953ce['as'],'attributes':_0x3953ce[_0xc265('0x1e')],'include':_0x3953ce['include']?_[_0xc265('0x21')](_0x3953ce[_0xc265('0x1f')],function(_0x40436c){return{'model':db[_0x40436c[_0xc265('0x20')]],'as':_0x40436c['as'],'attributes':_0x40436c[_0xc265('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5161b7){logger[_0xc265('0x10')](_0xc265('0x1a'),_0x44d32e);logger[_0xc265('0x13')](_0xc265('0x1a'),_0x44d32e,JSON[_0xc265('0x14')](_0x5161b7));_0x57007a(_0x5161b7);})[_0xc265('0x19')](function(_0x133327){logger[_0xc265('0x15')](_0xc265('0x1a'),_0x133327[_0xc265('0x17')],_0x44d32e);_0x155d66(_0x5505e7['error'](0x1f4,_0x133327[_0xc265('0x17')]));});});};exports[_0xc265('0x22')]=function(_0x829863){var _0x4f42bc=this;return new Promise(function(_0x63fee4,_0xd9d8bf){return db[_0xc265('0x23')][_0xc265('0x24')]({'raw':_0x829863[_0xc265('0x1c')]?_0x829863[_0xc265('0x1c')][_0xc265('0x25')]===undefined?!![]:![]:!![],'where':_0x829863['options']?_0x829863['options'][_0xc265('0x1d')]||null:null,'attributes':_0x829863[_0xc265('0x1c')]?_0x829863[_0xc265('0x1c')]['attributes']||null:null,'include':_0x829863[_0xc265('0x1c')]?_0x829863['options'][_0xc265('0x1f')]?_[_0xc265('0x21')](_0x829863[_0xc265('0x1c')][_0xc265('0x1f')],function(_0x3edcb4){return{'model':db[_0x3edcb4[_0xc265('0x20')]],'as':_0x3edcb4['as'],'attributes':_0x3edcb4[_0xc265('0x1e')],'include':_0x3edcb4[_0xc265('0x1f')]?_[_0xc265('0x21')](_0x3edcb4[_0xc265('0x1f')],function(_0x4b443a){return{'model':db[_0x4b443a[_0xc265('0x20')]],'as':_0x4b443a['as'],'attributes':_0x4b443a[_0xc265('0x1e')],'include':_0x4b443a[_0xc265('0x1f')]?_['map'](_0x4b443a[_0xc265('0x1f')],function(_0x572fc5){return{'model':db[_0x572fc5[_0xc265('0x20')]],'as':_0x572fc5['as'],'attributes':_0x572fc5[_0xc265('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc265('0x26')](function(_0x3331ce){logger['info'](_0xc265('0x22'),_0x829863);logger['debug'](_0xc265('0x22'),_0x829863,JSON['stringify'](_0x3331ce));_0x63fee4(_0x3331ce);})[_0xc265('0x19')](function(_0x17e614){logger[_0xc265('0x15')]('ShowSmsQueue',_0x17e614[_0xc265('0x17')],_0x829863);_0xd9d8bf(_0x4f42bc[_0xc265('0x15')](0x1f4,_0x17e614[_0xc265('0x17')]));});});}; \ No newline at end of file +var _0x69da=['find','lodash','util','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','client','redis','localhost','./smsQueue.socket','register','then','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','limit','model','attributes','include','map','debug','ShowSmsQueue'];(function(_0x5d2dc8,_0x4088bb){var _0x2e6a66=function(_0x1d1f0a){while(--_0x1d1f0a){_0x5d2dc8['push'](_0x5d2dc8['shift']());}};_0x2e6a66(++_0x4088bb);}(_0x69da,0x6d));var _0xa69d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x69da[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xa69d('0x0'));var util=require(_0xa69d('0x1'));var moment=require(_0xa69d('0x2'));var BPromise=require(_0xa69d('0x3'));var rs=require(_0xa69d('0x4'));var fs=require('fs');var Redis=require(_0xa69d('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa69d('0x6'));var config=require('../../config/environment');var jayson=require(_0xa69d('0x7'));var client=jayson[_0xa69d('0x8')]['http']({'port':0x232a});config[_0xa69d('0x9')]=_['defaults'](config[_0xa69d('0x9')],{'host':_0xa69d('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa69d('0x9')]));require(_0xa69d('0xb'))[_0xa69d('0xc')](socket);function respondWithRpcPromise(_0x27c4f5,_0x21d2c6,_0x3c3454){return new BPromise(function(_0x59c940,_0x5de940){return client['request'](_0x27c4f5,_0x3c3454)[_0xa69d('0xd')](function(_0x3fe578){logger['info'](_0xa69d('0xe'),_0x21d2c6,_0xa69d('0xf'));logger['debug'](_0xa69d('0x10'),_0x21d2c6,_0xa69d('0xf'),JSON[_0xa69d('0x11')](_0x3fe578));if(_0x3fe578[_0xa69d('0x12')]){if(_0x3fe578[_0xa69d('0x12')]['code']===0x1f4){logger[_0xa69d('0x12')]('SmsQueue,\x20%s,\x20%s',_0x21d2c6,_0x3fe578[_0xa69d('0x12')]['message']);return _0x5de940(_0x3fe578[_0xa69d('0x12')][_0xa69d('0x13')]);}logger[_0xa69d('0x12')]('SmsQueue,\x20%s,\x20%s',_0x21d2c6,_0x3fe578[_0xa69d('0x12')][_0xa69d('0x13')]);return _0x59c940(_0x3fe578['error'][_0xa69d('0x13')]);}else{logger[_0xa69d('0x14')](_0xa69d('0xe'),_0x21d2c6,_0xa69d('0xf'));_0x59c940(_0x3fe578['result'][_0xa69d('0x13')]);}})[_0xa69d('0x15')](function(_0x4aef74){logger[_0xa69d('0x12')](_0xa69d('0xe'),_0x21d2c6,_0x4aef74);_0x5de940(_0x4aef74);});});}exports[_0xa69d('0x16')]=function(_0x518971){var _0x520595=this;return new Promise(function(_0x41a2a8,_0x1db731){return db[_0xa69d('0x17')][_0xa69d('0x18')]({'raw':_0x518971['options']?_0x518971[_0xa69d('0x19')][_0xa69d('0x1a')]===undefined?!![]:![]:!![],'where':_0x518971[_0xa69d('0x19')]?_0x518971[_0xa69d('0x19')][_0xa69d('0x1b')]||null:null,'attributes':_0x518971[_0xa69d('0x19')]?_0x518971[_0xa69d('0x19')]['attributes']||null:null,'limit':_0x518971[_0xa69d('0x19')]?_0x518971[_0xa69d('0x19')][_0xa69d('0x1c')]||null:null,'include':_0x518971[_0xa69d('0x19')]?_0x518971[_0xa69d('0x19')]['include']?_['map'](_0x518971[_0xa69d('0x19')]['include'],function(_0x2ad268){return{'model':db[_0x2ad268[_0xa69d('0x1d')]],'as':_0x2ad268['as'],'attributes':_0x2ad268[_0xa69d('0x1e')],'include':_0x2ad268[_0xa69d('0x1f')]?_[_0xa69d('0x20')](_0x2ad268[_0xa69d('0x1f')],function(_0x522786){return{'model':db[_0x522786['model']],'as':_0x522786['as'],'attributes':_0x522786[_0xa69d('0x1e')],'include':_0x522786[_0xa69d('0x1f')]?_[_0xa69d('0x20')](_0x522786['include'],function(_0x5e8ebd){return{'model':db[_0x5e8ebd['model']],'as':_0x5e8ebd['as'],'attributes':_0x5e8ebd[_0xa69d('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b7a6a){logger['info'](_0xa69d('0x16'),_0x518971);logger[_0xa69d('0x21')]('GetSmsQueue',_0x518971,JSON[_0xa69d('0x11')](_0x3b7a6a));_0x41a2a8(_0x3b7a6a);})['catch'](function(_0x3dedbc){logger[_0xa69d('0x12')]('GetSmsQueue',_0x3dedbc[_0xa69d('0x13')],_0x518971);_0x1db731(_0x520595['error'](0x1f4,_0x3dedbc['message']));});});};exports[_0xa69d('0x22')]=function(_0x39175c){var _0x1f9a01=this;return new Promise(function(_0x12a9d6,_0x53c1a4){return db[_0xa69d('0x17')][_0xa69d('0x23')]({'raw':_0x39175c[_0xa69d('0x19')]?_0x39175c['options'][_0xa69d('0x1a')]===undefined?!![]:![]:!![],'where':_0x39175c[_0xa69d('0x19')]?_0x39175c[_0xa69d('0x19')][_0xa69d('0x1b')]||null:null,'attributes':_0x39175c[_0xa69d('0x19')]?_0x39175c[_0xa69d('0x19')][_0xa69d('0x1e')]||null:null,'include':_0x39175c[_0xa69d('0x19')]?_0x39175c[_0xa69d('0x19')][_0xa69d('0x1f')]?_['map'](_0x39175c[_0xa69d('0x19')][_0xa69d('0x1f')],function(_0x316b5){return{'model':db[_0x316b5['model']],'as':_0x316b5['as'],'attributes':_0x316b5['attributes'],'include':_0x316b5['include']?_[_0xa69d('0x20')](_0x316b5['include'],function(_0x3d1982){return{'model':db[_0x3d1982[_0xa69d('0x1d')]],'as':_0x3d1982['as'],'attributes':_0x3d1982[_0xa69d('0x1e')],'include':_0x3d1982[_0xa69d('0x1f')]?_['map'](_0x3d1982[_0xa69d('0x1f')],function(_0x2b846a){return{'model':db[_0x2b846a[_0xa69d('0x1d')]],'as':_0x2b846a['as'],'attributes':_0x2b846a[_0xa69d('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x329731){logger[_0xa69d('0x14')](_0xa69d('0x22'),_0x39175c);logger[_0xa69d('0x21')](_0xa69d('0x22'),_0x39175c,JSON[_0xa69d('0x11')](_0x329731));_0x12a9d6(_0x329731);})[_0xa69d('0x15')](function(_0x3a31e4){logger['error'](_0xa69d('0x22'),_0x3a31e4[_0xa69d('0x13')],_0x39175c);_0x53c1a4(_0x1f9a01[_0xa69d('0x12')](0x1f4,_0x3a31e4[_0xa69d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 8f03290..90903d8 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 _0x5f20=['emit','removeListener','register','length','save','update'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x5f20,0xee));var _0x05f2=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x5f20[_0x199572];return _0x13cfa3;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x05f2('0x0'),'remove',_0x05f2('0x1')];function createListener(_0x5969d7,_0x36794f){return function(_0x591fd2){_0x36794f[_0x05f2('0x2')](_0x5969d7,_0x591fd2);};}function removeListener(_0x545285,_0x37e61d){return function(){SmsQueueEvents[_0x05f2('0x3')](_0x545285,_0x37e61d);};}exports[_0x05f2('0x4')]=function(_0x32d455){for(var _0x9f7b60=0x0,_0x4a71d6=events[_0x05f2('0x5')];_0x9f7b60<_0x4a71d6;_0x9f7b60++){var _0x44650e=events[_0x9f7b60];var _0x17a083=createListener('smsQueue:'+_0x44650e,_0x32d455);SmsQueueEvents['on'](_0x44650e,_0x17a083);}}; \ No newline at end of file +var _0x4674=['update','emit','removeListener','register','length','smsQueue:','./smsQueue.events'];(function(_0x587998,_0x1c9a30){var _0x5b08d0=function(_0x3a1e90){while(--_0x3a1e90){_0x587998['push'](_0x587998['shift']());}};_0x5b08d0(++_0x1c9a30);}(_0x4674,0x156));var _0x4467=function(_0x5c5bd8,_0x5cc094){_0x5c5bd8=_0x5c5bd8-0x0;var _0x47a98f=_0x4674[_0x5c5bd8];return _0x47a98f;};'use strict';var SmsQueueEvents=require(_0x4467('0x0'));var events=['save','remove',_0x4467('0x1')];function createListener(_0x4dff49,_0x38cce5){return function(_0x146cce){_0x38cce5[_0x4467('0x2')](_0x4dff49,_0x146cce);};}function removeListener(_0x39c7cd,_0x1d0db4){return function(){SmsQueueEvents[_0x4467('0x3')](_0x39c7cd,_0x1d0db4);};}exports[_0x4467('0x4')]=function(_0x426fed){for(var _0xb67516=0x0,_0x374c15=events[_0x4467('0x5')];_0xb67516<_0x374c15;_0xb67516++){var _0x1204cf=events[_0xb67516];var _0x1f40c0=createListener(_0x4467('0x6')+_0x1204cf,_0x426fed);SmsQueueEvents['on'](_0x1204cf,_0x1f40c0);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 6956ad7..93f3f6e 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 _0x49f8=['show','post','update','delete','exports','multer','util','express','Router','fs-extra','./smsQueueReport.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x4940d0,_0x1142ad){var _0x53354b=function(_0x4819f5){while(--_0x4819f5){_0x4940d0['push'](_0x4940d0['shift']());}};_0x53354b(++_0x1142ad);}(_0x49f8,0x105));var _0x849f=function(_0x133937,_0x2ebfad){_0x133937=_0x133937-0x0;var _0x5e8947=_0x49f8[_0x133937];return _0x5e8947;};'use strict';var multer=require(_0x849f('0x0'));var util=require(_0x849f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x849f('0x2'));var router=express[_0x849f('0x3')]();var fs_extra=require(_0x849f('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x849f('0x5'));router[_0x849f('0x6')]('/',auth[_0x849f('0x7')](),controller[_0x849f('0x8')]);router[_0x849f('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x849f('0x9')]);router[_0x849f('0x6')](_0x849f('0xa'),auth['isAuthenticated'](),controller[_0x849f('0xb')]);router[_0x849f('0xc')]('/',auth[_0x849f('0x7')](),controller['create']);router['put'](_0x849f('0xa'),auth[_0x849f('0x7')](),controller[_0x849f('0xd')]);router[_0x849f('0xe')](_0x849f('0xa'),auth[_0x849f('0x7')](),controller['destroy']);module[_0x849f('0xf')]=router; \ No newline at end of file +var _0x21ec=['exports','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','create','put','update','delete','destroy'];(function(_0x4dfe9b,_0x525329){var _0x2f2edb=function(_0x292de6){while(--_0x292de6){_0x4dfe9b['push'](_0x4dfe9b['shift']());}};_0x2f2edb(++_0x525329);}(_0x21ec,0xf1));var _0xc21e=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x21ec[_0x50007c];return _0x5c1ec7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc21e('0x0'));var timeout=require(_0xc21e('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc21e('0x2'));var auth=require(_0xc21e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xc21e('0x4'));var controller=require('./smsQueueReport.controller');router[_0xc21e('0x5')]('/',auth['isAuthenticated'](),controller[_0xc21e('0x6')]);router[_0xc21e('0x5')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0xc21e('0x7'),auth[_0xc21e('0x8')](),controller[_0xc21e('0x9')]);router['post']('/',auth[_0xc21e('0x8')](),controller[_0xc21e('0xa')]);router[_0xc21e('0xb')](_0xc21e('0x7'),auth[_0xc21e('0x8')](),controller[_0xc21e('0xc')]);router[_0xc21e('0xd')]('/:id',auth[_0xc21e('0x8')](),controller[_0xc21e('0xe')]);module[_0xc21e('0xf')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index cb68d13..9bf503d 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 _0x7953=['STRING','DATE','moment','sequelize','exports'];(function(_0x4e8438,_0x30ba78){var _0x34af5a=function(_0x5c81ac){while(--_0x5c81ac){_0x4e8438['push'](_0x4e8438['shift']());}};_0x34af5a(++_0x30ba78);}(_0x7953,0x66));var _0x3795=function(_0x43e2e4,_0x4ad3b4){_0x43e2e4=_0x43e2e4-0x0;var _0x1b71d0=_0x7953[_0x43e2e4];return _0x1b71d0;};'use strict';var moment=require(_0x3795('0x0'));var Sequelize=require(_0x3795('0x1'));module[_0x3795('0x2')]={'uniqueid':{'type':Sequelize[_0x3795('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x3795('0x3')]},'joinAt':{'type':Sequelize[_0x3795('0x4')]},'leaveAt':{'type':Sequelize[_0x3795('0x4')]},'acceptAt':{'type':Sequelize[_0x3795('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3074=['DATE','moment','exports','STRING'];(function(_0x48d81a,_0x20778c){var _0x327edd=function(_0x3ffb0c){while(--_0x3ffb0c){_0x48d81a['push'](_0x48d81a['shift']());}};_0x327edd(++_0x20778c);}(_0x3074,0x1dd));var _0x4307=function(_0x4e1b07,_0x31f02b){_0x4e1b07=_0x4e1b07-0x0;var _0x537198=_0x3074[_0x4e1b07];return _0x537198;};'use strict';var moment=require(_0x4307('0x0'));var Sequelize=require('sequelize');module[_0x4307('0x1')]={'uniqueid':{'type':Sequelize[_0x4307('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x4307('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x4307('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x4307('0x3')]},'reason':{'type':Sequelize[_0x4307('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 5363be1..fb79134 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 _0x1e21=['count','offset','set','Content-Range','reject','save','update','then','destroy','sendStatus','stack','name','map','SmsQueueReport','fieldName','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','filter','type','VIRTUAL','includeAll','include','rows','catch','show','params','rawAttributes','merge','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1e21,0x18e));var _0x11e2=function(_0x83bce8,_0x3831ca){_0x83bce8=_0x83bce8-0x0;var _0x25c400=_0x1e21[_0x83bce8];return _0x25c400;};'use strict';var emlformat=require(_0x11e2('0x0'));var rimraf=require(_0x11e2('0x1'));var zipdir=require(_0x11e2('0x2'));var jsonpatch=require(_0x11e2('0x3'));var rp=require(_0x11e2('0x4'));var moment=require(_0x11e2('0x5'));var BPromise=require(_0x11e2('0x6'));var Mustache=require(_0x11e2('0x7'));var util=require(_0x11e2('0x8'));var path=require('path');var sox=require(_0x11e2('0x9'));var csv=require(_0x11e2('0xa'));var ejs=require(_0x11e2('0xb'));var fs=require('fs');var fs_extra=require(_0x11e2('0xc'));var _=require('lodash');var squel=require(_0x11e2('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x11e2('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x11e2('0xf'));var Redis=require(_0x11e2('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x11e2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x11e2('0x12'))(_0x11e2('0x13'));var utils=require(_0x11e2('0x14'));var config=require(_0x11e2('0x15'));var licenseUtil=require(_0x11e2('0x16'));var db=require(_0x11e2('0x17'))['db'];function respondWithStatusCode(_0x5c4548,_0x16589a){_0x16589a=_0x16589a||0xcc;return function(_0x2a3ea7){if(_0x2a3ea7){return _0x5c4548['sendStatus'](_0x16589a);}return _0x5c4548[_0x11e2('0x18')](_0x16589a)[_0x11e2('0x19')]();};}function respondWithResult(_0x31ebdc,_0x5a1238){_0x5a1238=_0x5a1238||0xc8;return function(_0x40a06a){if(_0x40a06a){return _0x31ebdc[_0x11e2('0x18')](_0x5a1238)[_0x11e2('0x1a')](_0x40a06a);}};}function respondWithFilteredResult(_0x33d6f3,_0x22d5c4){return function(_0x52f253){if(_0x52f253){var _0xe9bcb7=typeof _0x22d5c4['offset']==='undefined'&&typeof _0x22d5c4[_0x11e2('0x1b')]==='undefined';var _0x5a910c=_0x52f253[_0x11e2('0x1c')];var _0x35a353=_0xe9bcb7?0x0:_0x22d5c4[_0x11e2('0x1d')];var _0x5339b7=_0xe9bcb7?_0x52f253[_0x11e2('0x1c')]:_0x22d5c4[_0x11e2('0x1d')]+_0x22d5c4[_0x11e2('0x1b')];var _0x3f2d81;if(_0x5339b7>=_0x5a910c){_0x5339b7=_0x5a910c;_0x3f2d81=0xc8;}else{_0x3f2d81=0xce;}_0x33d6f3[_0x11e2('0x18')](_0x3f2d81);return _0x33d6f3[_0x11e2('0x1e')](_0x11e2('0x1f'),_0x35a353+'-'+_0x5339b7+'/'+_0x5a910c)[_0x11e2('0x1a')](_0x52f253);}return null;};}function patchUpdates(_0x10616c){return function(_0x3880d2){try{jsonpatch['apply'](_0x3880d2,_0x10616c,!![]);}catch(_0x1238a8){return BPromise[_0x11e2('0x20')](_0x1238a8);}return _0x3880d2[_0x11e2('0x21')]();};}function saveUpdates(_0x31d206,_0x52f675){return function(_0x5df4e1){if(_0x5df4e1){return _0x5df4e1[_0x11e2('0x22')](_0x31d206)[_0x11e2('0x23')](function(_0x2761d2){return _0x2761d2;});}return null;};}function removeEntity(_0x3f79ed,_0x224065){return function(_0x44f003){if(_0x44f003){return _0x44f003[_0x11e2('0x24')]()[_0x11e2('0x23')](function(){_0x3f79ed[_0x11e2('0x18')](0xcc)[_0x11e2('0x19')]();});}};}function handleEntityNotFound(_0x38707a,_0x105e79){return function(_0x52c01b){if(!_0x52c01b){_0x38707a[_0x11e2('0x25')](0x194);}return _0x52c01b;};}function handleError(_0x364506,_0x100815){_0x100815=_0x100815||0x1f4;return function(_0x3680bc){logger['error'](_0x3680bc[_0x11e2('0x26')]);if(_0x3680bc[_0x11e2('0x27')]){delete _0x3680bc['name'];}_0x364506[_0x11e2('0x18')](_0x100815)['send'](_0x3680bc);};}exports['index']=function(_0x50f0a0,_0x3d31c6){var _0x2c5783={},_0x42b4b4={},_0x2aca8a={'count':0x0,'rows':[]};var _0x3bfc2f=_[_0x11e2('0x28')](db[_0x11e2('0x29')]['rawAttributes'],function(_0xd12f07){return{'name':_0xd12f07[_0x11e2('0x2a')],'type':_0xd12f07['type'][_0x11e2('0x2b')]};});_0x42b4b4[_0x11e2('0x2c')]=_[_0x11e2('0x28')](_0x3bfc2f,'name');_0x42b4b4['query']=_[_0x11e2('0x2d')](_0x50f0a0[_0x11e2('0x2e')]);_0x42b4b4['filters']=_[_0x11e2('0x2f')](_0x42b4b4[_0x11e2('0x2c')],_0x42b4b4['query']);_0x2c5783[_0x11e2('0x30')]=_[_0x11e2('0x2f')](_0x42b4b4[_0x11e2('0x2c')],qs[_0x11e2('0x31')](_0x50f0a0[_0x11e2('0x2e')][_0x11e2('0x31')]));_0x2c5783['attributes']=_0x2c5783[_0x11e2('0x30')]['length']?_0x2c5783[_0x11e2('0x30')]:_0x42b4b4[_0x11e2('0x2c')];if(!_0x50f0a0[_0x11e2('0x2e')][_0x11e2('0x32')]('nolimit')){_0x2c5783[_0x11e2('0x1b')]=qs[_0x11e2('0x1b')](_0x50f0a0[_0x11e2('0x2e')][_0x11e2('0x1b')]);_0x2c5783['offset']=qs['offset'](_0x50f0a0['query']['offset']);}_0x2c5783[_0x11e2('0x33')]=qs[_0x11e2('0x34')](_0x50f0a0[_0x11e2('0x2e')]['sort']);_0x2c5783[_0x11e2('0x35')]=qs[_0x11e2('0x36')](_['pick'](_0x50f0a0['query'],_0x42b4b4[_0x11e2('0x36')]),_0x3bfc2f);if(_0x50f0a0['query'][_0x11e2('0x37')]){_0x2c5783[_0x11e2('0x35')]=_['merge'](_0x2c5783[_0x11e2('0x35')],{'$or':_[_0x11e2('0x28')](_0x3bfc2f,function(_0x4674e9){if(_0x4674e9[_0x11e2('0x38')]!==_0x11e2('0x39')){var _0x205ad6={};_0x205ad6[_0x4674e9[_0x11e2('0x27')]]={'$like':'%'+_0x50f0a0[_0x11e2('0x2e')][_0x11e2('0x37')]+'%'};return _0x205ad6;}})});}_0x2c5783=_['merge']({},_0x2c5783,_0x50f0a0['options']);var _0x291f22={'where':_0x2c5783[_0x11e2('0x35')]};return db[_0x11e2('0x29')][_0x11e2('0x1c')](_0x291f22)[_0x11e2('0x23')](function(_0x14b229){_0x2aca8a[_0x11e2('0x1c')]=_0x14b229;if(_0x50f0a0[_0x11e2('0x2e')][_0x11e2('0x3a')]){_0x2c5783[_0x11e2('0x3b')]=[{'all':!![]}];}return db[_0x11e2('0x29')]['findAll'](_0x2c5783);})[_0x11e2('0x23')](function(_0x2941e6){_0x2aca8a[_0x11e2('0x3c')]=_0x2941e6;return _0x2aca8a;})[_0x11e2('0x23')](respondWithFilteredResult(_0x3d31c6,_0x2c5783))[_0x11e2('0x3d')](handleError(_0x3d31c6,null));};exports[_0x11e2('0x3e')]=function(_0x5e7eff,_0x270596){var _0x3460f5={'raw':!![],'where':{'id':_0x5e7eff[_0x11e2('0x3f')]['id']}},_0x3556bc={};_0x3556bc['model']=_[_0x11e2('0x2d')](db[_0x11e2('0x29')][_0x11e2('0x40')]);_0x3556bc['query']=_[_0x11e2('0x2d')](_0x5e7eff['query']);_0x3556bc[_0x11e2('0x36')]=_['intersection'](_0x3556bc[_0x11e2('0x2c')],_0x3556bc['query']);_0x3460f5[_0x11e2('0x30')]=_[_0x11e2('0x2f')](_0x3556bc[_0x11e2('0x2c')],qs[_0x11e2('0x31')](_0x5e7eff['query']['fields']));_0x3460f5[_0x11e2('0x30')]=_0x3460f5[_0x11e2('0x30')]['length']?_0x3460f5[_0x11e2('0x30')]:_0x3556bc[_0x11e2('0x2c')];if(_0x5e7eff[_0x11e2('0x2e')][_0x11e2('0x3a')]){_0x3460f5[_0x11e2('0x3b')]=[{'all':!![]}];}_0x3460f5=_[_0x11e2('0x41')]({},_0x3460f5,_0x5e7eff[_0x11e2('0x42')]);return db[_0x11e2('0x29')]['find'](_0x3460f5)[_0x11e2('0x23')](handleEntityNotFound(_0x270596,null))[_0x11e2('0x23')](respondWithResult(_0x270596,null))[_0x11e2('0x3d')](handleError(_0x270596,null));};exports[_0x11e2('0x43')]=function(_0x217b83,_0x18c6f2){return db[_0x11e2('0x29')][_0x11e2('0x43')](_0x217b83[_0x11e2('0x44')],{})[_0x11e2('0x23')](respondWithResult(_0x18c6f2,0xc9))[_0x11e2('0x3d')](handleError(_0x18c6f2,null));};exports[_0x11e2('0x22')]=function(_0xb27ac7,_0x2db80e){if(_0xb27ac7[_0x11e2('0x44')]['id']){delete _0xb27ac7[_0x11e2('0x44')]['id'];}return db['SmsQueueReport'][_0x11e2('0x45')]({'where':{'id':_0xb27ac7[_0x11e2('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2db80e,null))[_0x11e2('0x23')](saveUpdates(_0xb27ac7[_0x11e2('0x44')],null))[_0x11e2('0x23')](respondWithResult(_0x2db80e,null))['catch'](handleError(_0x2db80e,null));};exports['destroy']=function(_0x4bb1cf,_0x17bced){return db[_0x11e2('0x29')][_0x11e2('0x45')]({'where':{'id':_0x4bb1cf['params']['id']}})[_0x11e2('0x23')](handleEntityNotFound(_0x17bced,null))[_0x11e2('0x23')](removeEntity(_0x17bced,null))[_0x11e2('0x3d')](handleError(_0x17bced,null));};exports[_0x11e2('0x46')]=function(_0x51a9e0,_0x1b868b){return db['SmsQueueReport']['describe']()['then'](respondWithResult(_0x1b868b,null))[_0x11e2('0x3d')](handleError(_0x1b868b,null));}; \ No newline at end of file +var _0xc126=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','save','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','key','model','keys','query','attributes','intersection','fields','length','nolimit','offset','sort','where','filters','pick','filter','map','type','VIRTUAL','merge','options','SmsQueueReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0xc126,0x85));var _0x6c12=function(_0x25160f,_0x43c71e){_0x25160f=_0x25160f-0x0;var _0xb43b1f=_0xc126[_0x25160f];return _0xb43b1f;};'use strict';var emlformat=require(_0x6c12('0x0'));var rimraf=require(_0x6c12('0x1'));var zipdir=require(_0x6c12('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6c12('0x3'));var BPromise=require(_0x6c12('0x4'));var Mustache=require(_0x6c12('0x5'));var util=require('util');var path=require(_0x6c12('0x6'));var sox=require(_0x6c12('0x7'));var csv=require(_0x6c12('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c12('0x9'));var _=require(_0x6c12('0xa'));var squel=require(_0x6c12('0xb'));var crypto=require('crypto');var jsforce=require(_0x6c12('0xc'));var deskjs=require(_0x6c12('0xd'));var toCsv=require(_0x6c12('0x8'));var querystring=require(_0x6c12('0xe'));var Papa=require('papaparse');var Redis=require(_0x6c12('0xf'));var authService=require(_0x6c12('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6c12('0x11'));var logger=require(_0x6c12('0x12'))(_0x6c12('0x13'));var utils=require(_0x6c12('0x14'));var config=require(_0x6c12('0x15'));var licenseUtil=require(_0x6c12('0x16'));var db=require(_0x6c12('0x17'))['db'];function respondWithStatusCode(_0xbc5f55,_0x7c1410){_0x7c1410=_0x7c1410||0xcc;return function(_0x54fcbb){if(_0x54fcbb){return _0xbc5f55[_0x6c12('0x18')](_0x7c1410);}return _0xbc5f55[_0x6c12('0x19')](_0x7c1410)[_0x6c12('0x1a')]();};}function respondWithResult(_0x389c6b,_0x21190f){_0x21190f=_0x21190f||0xc8;return function(_0x20cc5f){if(_0x20cc5f){return _0x389c6b[_0x6c12('0x19')](_0x21190f)[_0x6c12('0x1b')](_0x20cc5f);}};}function respondWithFilteredResult(_0x5d4bf1,_0x5c15cd){return function(_0x365b15){if(_0x365b15){var _0x1a563d=typeof _0x5c15cd['offset']===_0x6c12('0x1c')&&typeof _0x5c15cd[_0x6c12('0x1d')]===_0x6c12('0x1c');var _0x506343=_0x365b15[_0x6c12('0x1e')];var _0x2ea9a1=_0x1a563d?0x0:_0x5c15cd['offset'];var _0x81d540=_0x1a563d?_0x365b15[_0x6c12('0x1e')]:_0x5c15cd['offset']+_0x5c15cd[_0x6c12('0x1d')];var _0x3cdff7;if(_0x81d540>=_0x506343){_0x81d540=_0x506343;_0x3cdff7=0xc8;}else{_0x3cdff7=0xce;}_0x5d4bf1[_0x6c12('0x19')](_0x3cdff7);return _0x5d4bf1[_0x6c12('0x1f')](_0x6c12('0x20'),_0x2ea9a1+'-'+_0x81d540+'/'+_0x506343)[_0x6c12('0x1b')](_0x365b15);}return null;};}function patchUpdates(_0x35ca60){return function(_0x2ceacb){try{jsonpatch['apply'](_0x2ceacb,_0x35ca60,!![]);}catch(_0x1373ac){return BPromise['reject'](_0x1373ac);}return _0x2ceacb[_0x6c12('0x21')]();};}function saveUpdates(_0x1f6121,_0x4e0dae){return function(_0x53904b){if(_0x53904b){return _0x53904b[_0x6c12('0x22')](_0x1f6121)[_0x6c12('0x23')](function(_0x40f857){return _0x40f857;});}return null;};}function removeEntity(_0x576a72,_0x267fc2){return function(_0x53be22){if(_0x53be22){return _0x53be22[_0x6c12('0x24')]()[_0x6c12('0x23')](function(){_0x576a72[_0x6c12('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58c15c,_0xca5914){return function(_0x15da49){if(!_0x15da49){_0x58c15c[_0x6c12('0x18')](0x194);}return _0x15da49;};}function handleError(_0xdb912d,_0x3708c9){_0x3708c9=_0x3708c9||0x1f4;return function(_0x165ed4){logger[_0x6c12('0x25')](_0x165ed4[_0x6c12('0x26')]);if(_0x165ed4[_0x6c12('0x27')]){delete _0x165ed4[_0x6c12('0x27')];}_0xdb912d[_0x6c12('0x19')](_0x3708c9)[_0x6c12('0x28')](_0x165ed4);};}exports['index']=function(_0x204f6b,_0x106108){var _0x6b383={},_0x4dcdb3={},_0x59e414={'count':0x0,'rows':[]};var _0x1f3380=_['map'](db['SmsQueueReport'][_0x6c12('0x29')],function(_0x5dfe45){return{'name':_0x5dfe45[_0x6c12('0x2a')],'type':_0x5dfe45['type'][_0x6c12('0x2b')]};});_0x4dcdb3[_0x6c12('0x2c')]=_['map'](_0x1f3380,_0x6c12('0x27'));_0x4dcdb3['query']=_[_0x6c12('0x2d')](_0x204f6b[_0x6c12('0x2e')]);_0x4dcdb3['filters']=_['intersection'](_0x4dcdb3[_0x6c12('0x2c')],_0x4dcdb3[_0x6c12('0x2e')]);_0x6b383[_0x6c12('0x2f')]=_[_0x6c12('0x30')](_0x4dcdb3[_0x6c12('0x2c')],qs[_0x6c12('0x31')](_0x204f6b[_0x6c12('0x2e')][_0x6c12('0x31')]));_0x6b383[_0x6c12('0x2f')]=_0x6b383[_0x6c12('0x2f')][_0x6c12('0x32')]?_0x6b383[_0x6c12('0x2f')]:_0x4dcdb3[_0x6c12('0x2c')];if(!_0x204f6b['query']['hasOwnProperty'](_0x6c12('0x33'))){_0x6b383[_0x6c12('0x1d')]=qs[_0x6c12('0x1d')](_0x204f6b[_0x6c12('0x2e')][_0x6c12('0x1d')]);_0x6b383[_0x6c12('0x34')]=qs[_0x6c12('0x34')](_0x204f6b[_0x6c12('0x2e')][_0x6c12('0x34')]);}_0x6b383['order']=qs[_0x6c12('0x35')](_0x204f6b['query'][_0x6c12('0x35')]);_0x6b383[_0x6c12('0x36')]=qs[_0x6c12('0x37')](_[_0x6c12('0x38')](_0x204f6b[_0x6c12('0x2e')],_0x4dcdb3[_0x6c12('0x37')]),_0x1f3380);if(_0x204f6b[_0x6c12('0x2e')][_0x6c12('0x39')]){_0x6b383['where']=_['merge'](_0x6b383[_0x6c12('0x36')],{'$or':_[_0x6c12('0x3a')](_0x1f3380,function(_0x2e71c6){if(_0x2e71c6[_0x6c12('0x3b')]!==_0x6c12('0x3c')){var _0x49b6f6={};_0x49b6f6[_0x2e71c6['name']]={'$like':'%'+_0x204f6b['query']['filter']+'%'};return _0x49b6f6;}})});}_0x6b383=_[_0x6c12('0x3d')]({},_0x6b383,_0x204f6b[_0x6c12('0x3e')]);var _0x56adb4={'where':_0x6b383['where']};return db[_0x6c12('0x3f')]['count'](_0x56adb4)[_0x6c12('0x23')](function(_0x3f8d15){_0x59e414[_0x6c12('0x1e')]=_0x3f8d15;if(_0x204f6b['query'][_0x6c12('0x40')]){_0x6b383[_0x6c12('0x41')]=[{'all':!![]}];}return db[_0x6c12('0x3f')][_0x6c12('0x42')](_0x6b383);})[_0x6c12('0x23')](function(_0x496557){_0x59e414[_0x6c12('0x43')]=_0x496557;return _0x59e414;})['then'](respondWithFilteredResult(_0x106108,_0x6b383))[_0x6c12('0x44')](handleError(_0x106108,null));};exports[_0x6c12('0x45')]=function(_0x1e8af1,_0x117573){var _0x20d53b={'raw':!![],'where':{'id':_0x1e8af1[_0x6c12('0x46')]['id']}},_0x3b2e25={};_0x3b2e25['model']=_['keys'](db['SmsQueueReport']['rawAttributes']);_0x3b2e25['query']=_['keys'](_0x1e8af1['query']);_0x3b2e25[_0x6c12('0x37')]=_[_0x6c12('0x30')](_0x3b2e25[_0x6c12('0x2c')],_0x3b2e25[_0x6c12('0x2e')]);_0x20d53b[_0x6c12('0x2f')]=_[_0x6c12('0x30')](_0x3b2e25['model'],qs['fields'](_0x1e8af1[_0x6c12('0x2e')][_0x6c12('0x31')]));_0x20d53b[_0x6c12('0x2f')]=_0x20d53b[_0x6c12('0x2f')][_0x6c12('0x32')]?_0x20d53b[_0x6c12('0x2f')]:_0x3b2e25[_0x6c12('0x2c')];if(_0x1e8af1[_0x6c12('0x2e')][_0x6c12('0x40')]){_0x20d53b[_0x6c12('0x41')]=[{'all':!![]}];}_0x20d53b=_[_0x6c12('0x3d')]({},_0x20d53b,_0x1e8af1[_0x6c12('0x3e')]);return db[_0x6c12('0x3f')][_0x6c12('0x47')](_0x20d53b)[_0x6c12('0x23')](handleEntityNotFound(_0x117573,null))[_0x6c12('0x23')](respondWithResult(_0x117573,null))['catch'](handleError(_0x117573,null));};exports[_0x6c12('0x48')]=function(_0x5af498,_0x4b29d1){return db['SmsQueueReport'][_0x6c12('0x48')](_0x5af498[_0x6c12('0x49')],{})[_0x6c12('0x23')](respondWithResult(_0x4b29d1,0xc9))['catch'](handleError(_0x4b29d1,null));};exports[_0x6c12('0x22')]=function(_0x36e803,_0x3f136f){if(_0x36e803[_0x6c12('0x49')]['id']){delete _0x36e803[_0x6c12('0x49')]['id'];}return db[_0x6c12('0x3f')][_0x6c12('0x47')]({'where':{'id':_0x36e803[_0x6c12('0x46')]['id']}})[_0x6c12('0x23')](handleEntityNotFound(_0x3f136f,null))['then'](saveUpdates(_0x36e803['body'],null))[_0x6c12('0x23')](respondWithResult(_0x3f136f,null))[_0x6c12('0x44')](handleError(_0x3f136f,null));};exports[_0x6c12('0x24')]=function(_0x38cd01,_0x7ce1a4){return db[_0x6c12('0x3f')][_0x6c12('0x47')]({'where':{'id':_0x38cd01[_0x6c12('0x46')]['id']}})['then'](handleEntityNotFound(_0x7ce1a4,null))[_0x6c12('0x23')](removeEntity(_0x7ce1a4,null))[_0x6c12('0x44')](handleError(_0x7ce1a4,null));};exports[_0x6c12('0x4a')]=function(_0x2dfc39,_0x50c73c){return db[_0x6c12('0x3f')][_0x6c12('0x4a')]()[_0x6c12('0x23')](respondWithResult(_0x50c73c,null))[_0x6c12('0x44')](handleError(_0x50c73c,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 4e7eaaf..c919ca1 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 _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x94eb51,_0x1164d3){var _0x231532=function(_0x4a2674){while(--_0x4a2674){_0x94eb51['push'](_0x94eb51['shift']());}};_0x231532(++_0x1164d3);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x5daeb2,_0x4b007c){var _0x2dbb9f=function(_0x3b29e3){while(--_0x3b29e3){_0x5daeb2['push'](_0x5daeb2['shift']());}};_0x2dbb9f(++_0x4b007c);}(_0xe706,0xa3));var _0x6e70=function(_0x4f6856,_0x2dbb97){_0x4f6856=_0x4f6856-0x0;var _0x36cafd=_0xe706[_0x4f6856];return _0x36cafd;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index b9d9068..0dac620 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 _0xf47b=['attributes','limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','SmsQueueReport,\x20%s,\x20%s','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','UpdateSmsQueueReport','update'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0xf47b,0x1f1));var _0xbf47=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xf47b[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xbf47('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbf47('0x1'));var rs=require(_0xbf47('0x2'));var fs=require('fs');var Redis=require(_0xbf47('0x3'));var db=require(_0xbf47('0x4'))['db'];var utils=require(_0xbf47('0x5'));var logger=require('../../config/logger')(_0xbf47('0x6'));var config=require(_0xbf47('0x7'));var jayson=require(_0xbf47('0x8'));var client=jayson[_0xbf47('0x9')][_0xbf47('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xaaa4e3,_0x2aae7e,_0x32e803){return new BPromise(function(_0x282dc4,_0x397590){return client[_0xbf47('0xb')](_0xaaa4e3,_0x32e803)[_0xbf47('0xc')](function(_0x23fe3b){logger[_0xbf47('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x2aae7e,'request\x20sent');logger[_0xbf47('0xe')](_0xbf47('0xf'),_0x2aae7e,_0xbf47('0x10'),JSON[_0xbf47('0x11')](_0x23fe3b));if(_0x23fe3b[_0xbf47('0x12')]){if(_0x23fe3b['error']['code']===0x1f4){logger[_0xbf47('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x2aae7e,_0x23fe3b[_0xbf47('0x12')][_0xbf47('0x13')]);return _0x397590(_0x23fe3b['error'][_0xbf47('0x13')]);}logger[_0xbf47('0x12')](_0xbf47('0x14'),_0x2aae7e,_0x23fe3b[_0xbf47('0x12')][_0xbf47('0x13')]);return _0x282dc4(_0x23fe3b[_0xbf47('0x12')][_0xbf47('0x13')]);}else{logger['info'](_0xbf47('0x14'),_0x2aae7e,_0xbf47('0x10'));_0x282dc4(_0x23fe3b[_0xbf47('0x15')][_0xbf47('0x13')]);}})[_0xbf47('0x16')](function(_0x2126e0){logger[_0xbf47('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x2aae7e,_0x2126e0);_0x397590(_0x2126e0);});});}exports[_0xbf47('0x17')]=function(_0x4caeb1){var _0x3ea185=this;return new Promise(function(_0x189e42,_0x3c5dc3){return db[_0xbf47('0x18')][_0xbf47('0x19')](_0x4caeb1[_0xbf47('0x1a')],{'raw':_0x4caeb1[_0xbf47('0x1b')]?_0x4caeb1[_0xbf47('0x1b')][_0xbf47('0x1c')]===undefined?!![]:![]:!![]})[_0xbf47('0xc')](function(_0x4e0ddb){logger[_0xbf47('0xd')](_0xbf47('0x17'),_0x4caeb1);logger[_0xbf47('0xe')]('CreateSmsQueueReport',_0x4caeb1,JSON['stringify'](_0x4e0ddb));_0x189e42(_0x4e0ddb);})[_0xbf47('0x16')](function(_0x233261){logger[_0xbf47('0x12')]('CreateSmsQueueReport',_0x233261[_0xbf47('0x13')],_0x4caeb1);_0x3c5dc3(_0x3ea185['error'](0x1f4,_0x233261[_0xbf47('0x13')]));});});};exports[_0xbf47('0x1d')]=function(_0x27b97d){var _0x3f02e3=this;return new Promise(function(_0x4ff36e,_0x2c1a6f){return db[_0xbf47('0x18')][_0xbf47('0x1e')](_0x27b97d[_0xbf47('0x1a')],{'raw':_0x27b97d[_0xbf47('0x1b')]?_0x27b97d['options'][_0xbf47('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27b97d[_0xbf47('0x1b')]?_0x27b97d['options']['where']||null:null,'attributes':_0x27b97d[_0xbf47('0x1b')]?_0x27b97d[_0xbf47('0x1b')][_0xbf47('0x1f')]||null:null,'limit':_0x27b97d[_0xbf47('0x1b')]?_0x27b97d[_0xbf47('0x1b')][_0xbf47('0x20')]||null:null})['then'](function(_0x3cd123){logger[_0xbf47('0xd')](_0xbf47('0x1d'),_0x27b97d);logger[_0xbf47('0xe')]('UpdateSmsQueueReport',_0x27b97d,JSON['stringify'](_0x3cd123));_0x4ff36e(_0x3cd123);})[_0xbf47('0x16')](function(_0x5e5740){logger[_0xbf47('0x12')]('UpdateSmsQueueReport',_0x5e5740[_0xbf47('0x13')],_0x27b97d);_0x2c1a6f(_0x3f02e3[_0xbf47('0x12')](0x1f4,_0x5e5740[_0xbf47('0x13')]));});});}; \ No newline at end of file +var _0x39f6=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','then','update','raw','attributes','limit','UpdateSmsQueueReport','lodash','util'];(function(_0x15073d,_0x49aad5){var _0x4eff5d=function(_0x4909c1){while(--_0x4909c1){_0x15073d['push'](_0x15073d['shift']());}};_0x4eff5d(++_0x49aad5);}(_0x39f6,0x196));var _0x639f=function(_0x30c75c,_0x122134){_0x30c75c=_0x30c75c-0x0;var _0x5ccd0b=_0x39f6[_0x30c75c];return _0x5ccd0b;};'use strict';var _=require(_0x639f('0x0'));var util=require(_0x639f('0x1'));var moment=require(_0x639f('0x2'));var BPromise=require(_0x639f('0x3'));var rs=require(_0x639f('0x4'));var fs=require('fs');var Redis=require(_0x639f('0x5'));var db=require(_0x639f('0x6'))['db'];var utils=require(_0x639f('0x7'));var logger=require('../../config/logger')(_0x639f('0x8'));var config=require(_0x639f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x639f('0xa')][_0x639f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10df9b,_0x2a6b22,_0x2bd42b){return new BPromise(function(_0x48b113,_0x25a276){return client[_0x639f('0xc')](_0x10df9b,_0x2bd42b)['then'](function(_0x6711a4){logger[_0x639f('0xd')](_0x639f('0xe'),_0x2a6b22,'request\x20sent');logger[_0x639f('0xf')](_0x639f('0x10'),_0x2a6b22,_0x639f('0x11'),JSON[_0x639f('0x12')](_0x6711a4));if(_0x6711a4[_0x639f('0x13')]){if(_0x6711a4['error'][_0x639f('0x14')]===0x1f4){logger[_0x639f('0x13')](_0x639f('0xe'),_0x2a6b22,_0x6711a4[_0x639f('0x13')][_0x639f('0x15')]);return _0x25a276(_0x6711a4[_0x639f('0x13')][_0x639f('0x15')]);}logger[_0x639f('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x2a6b22,_0x6711a4[_0x639f('0x13')][_0x639f('0x15')]);return _0x48b113(_0x6711a4[_0x639f('0x13')]['message']);}else{logger['info'](_0x639f('0xe'),_0x2a6b22,_0x639f('0x11'));_0x48b113(_0x6711a4['result']['message']);}})[_0x639f('0x16')](function(_0x5dedd6){logger[_0x639f('0x13')](_0x639f('0xe'),_0x2a6b22,_0x5dedd6);_0x25a276(_0x5dedd6);});});}exports[_0x639f('0x17')]=function(_0x7edd66){var _0x4c6ac1=this;return new Promise(function(_0x3b1008,_0x5989bc){return db[_0x639f('0x18')][_0x639f('0x19')](_0x7edd66[_0x639f('0x1a')],{'raw':_0x7edd66['options']?_0x7edd66[_0x639f('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x639f('0x1c')](function(_0xab2f52){logger[_0x639f('0xd')]('CreateSmsQueueReport',_0x7edd66);logger[_0x639f('0xf')]('CreateSmsQueueReport',_0x7edd66,JSON[_0x639f('0x12')](_0xab2f52));_0x3b1008(_0xab2f52);})[_0x639f('0x16')](function(_0x142199){logger['error'](_0x639f('0x17'),_0x142199['message'],_0x7edd66);_0x5989bc(_0x4c6ac1[_0x639f('0x13')](0x1f4,_0x142199['message']));});});};exports['UpdateSmsQueueReport']=function(_0x404ebe){var _0x10c02a=this;return new Promise(function(_0x4bfd85,_0x51794b){return db[_0x639f('0x18')][_0x639f('0x1d')](_0x404ebe['body'],{'raw':_0x404ebe[_0x639f('0x1b')]?_0x404ebe[_0x639f('0x1b')][_0x639f('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x404ebe[_0x639f('0x1b')]?_0x404ebe[_0x639f('0x1b')]['where']||null:null,'attributes':_0x404ebe['options']?_0x404ebe[_0x639f('0x1b')][_0x639f('0x1f')]||null:null,'limit':_0x404ebe[_0x639f('0x1b')]?_0x404ebe[_0x639f('0x1b')][_0x639f('0x20')]||null:null})[_0x639f('0x1c')](function(_0x4c7d4a){logger['info']('UpdateSmsQueueReport',_0x404ebe);logger[_0x639f('0xf')](_0x639f('0x21'),_0x404ebe,JSON[_0x639f('0x12')](_0x4c7d4a));_0x4bfd85(_0x4c7d4a);})[_0x639f('0x16')](function(_0x3f8636){logger[_0x639f('0x13')](_0x639f('0x21'),_0x3f8636[_0x639f('0x15')],_0x404ebe);_0x51794b(_0x10c02a[_0x639f('0x13')](0x1f4,_0x3f8636['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 6fc851c..d7c3fe9 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 _0x86f4=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x86f4,0x18a));var _0x486f=function(_0x5f4b9c,_0x4a00d1){_0x5f4b9c=_0x5f4b9c-0x0;var _0x4358f5=_0x86f4[_0x5f4b9c];return _0x4358f5;};'use strict';var multer=require(_0x486f('0x0'));var util=require(_0x486f('0x1'));var path=require(_0x486f('0x2'));var timeout=require(_0x486f('0x3'));var express=require(_0x486f('0x4'));var router=express[_0x486f('0x5')]();var fs_extra=require(_0x486f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x486f('0x7'));var config=require(_0x486f('0x8'));var controller=require('./smsTransferReport.controller');router[_0x486f('0x9')]('/',auth[_0x486f('0xa')](),controller[_0x486f('0xb')]);router[_0x486f('0x9')](_0x486f('0xc'),auth[_0x486f('0xa')](),controller['describe']);router[_0x486f('0x9')](_0x486f('0xd'),auth[_0x486f('0xa')](),controller[_0x486f('0xe')]);router[_0x486f('0xf')]('/',auth[_0x486f('0xa')](),controller[_0x486f('0x10')]);router[_0x486f('0x11')](_0x486f('0xd'),auth[_0x486f('0xa')](),controller[_0x486f('0x12')]);router[_0x486f('0x13')](_0x486f('0xd'),auth[_0x486f('0xa')](),controller[_0x486f('0x14')]);module[_0x486f('0x15')]=router; \ No newline at end of file +var _0xe5b3=['../../config/environment','./smsTransferReport.controller','get','index','isAuthenticated','describe','/:id','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x222b40,_0x476402){var _0x3a714a=function(_0x549832){while(--_0x549832){_0x222b40['push'](_0x222b40['shift']());}};_0x3a714a(++_0x476402);}(_0xe5b3,0x133));var _0x3e5b=function(_0x4fa665,_0x1ae12a){_0x4fa665=_0x4fa665-0x0;var _0x62ccff=_0xe5b3[_0x4fa665];return _0x62ccff;};'use strict';var multer=require('multer');var util=require(_0x3e5b('0x0'));var path=require(_0x3e5b('0x1'));var timeout=require(_0x3e5b('0x2'));var express=require(_0x3e5b('0x3'));var router=express[_0x3e5b('0x4')]();var fs_extra=require(_0x3e5b('0x5'));var auth=require(_0x3e5b('0x6'));var interaction=require(_0x3e5b('0x7'));var config=require(_0x3e5b('0x8'));var controller=require(_0x3e5b('0x9'));router[_0x3e5b('0xa')]('/',auth['isAuthenticated'](),controller[_0x3e5b('0xb')]);router[_0x3e5b('0xa')]('/describe',auth[_0x3e5b('0xc')](),controller[_0x3e5b('0xd')]);router[_0x3e5b('0xa')](_0x3e5b('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x3e5b('0xf')]('/',auth[_0x3e5b('0xc')](),controller[_0x3e5b('0x10')]);router[_0x3e5b('0x11')](_0x3e5b('0xe'),auth['isAuthenticated'](),controller[_0x3e5b('0x12')]);router['delete'](_0x3e5b('0xe'),auth[_0x3e5b('0xc')](),controller[_0x3e5b('0x13')]);module[_0x3e5b('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index e3738a9..eef660e 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(_0x27a1a0,_0x410857){var _0x1321a0=function(_0x4d0991){while(--_0x4d0991){_0x27a1a0['push'](_0x27a1a0['shift']());}};_0x1321a0(++_0x410857);}(_0x54ef,0x112));var _0xf54e=function(_0xdbe4df,_0x4bec5f){_0xdbe4df=_0xdbe4df-0x0;var _0x316f42=_0x54ef[_0xdbe4df];return _0x316f42;};'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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x335202,_0x16d8a7){var _0x93ca72=function(_0x3074a1){while(--_0x3074a1){_0x335202['push'](_0x335202['shift']());}};_0x93ca72(++_0x16d8a7);}(_0x008c,0x188));var _0xc008=function(_0x2f2a6f,_0xe63e10){_0x2f2a6f=_0x2f2a6f-0x0;var _0x14441d=_0x008c[_0x2f2a6f];return _0x14441d;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 088ac4a..e4cef71 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 _0x2418=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','map','SmsTransferReport','key','model','name','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x2418,0x1bd));var _0x8241=function(_0xd96c99,_0x516add){_0xd96c99=_0xd96c99-0x0;var _0x5ede21=_0x2418[_0xd96c99];return _0x5ede21;};'use strict';var emlformat=require(_0x8241('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8241('0x1'));var moment=require(_0x8241('0x2'));var BPromise=require(_0x8241('0x3'));var Mustache=require(_0x8241('0x4'));var util=require(_0x8241('0x5'));var path=require(_0x8241('0x6'));var sox=require(_0x8241('0x7'));var csv=require('to-csv');var ejs=require(_0x8241('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8241('0x9'));var squel=require(_0x8241('0xa'));var crypto=require(_0x8241('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8241('0xc'));var toCsv=require(_0x8241('0xd'));var querystring=require(_0x8241('0xe'));var Papa=require(_0x8241('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8241('0x10'));var as=require(_0x8241('0x11'));var hardwareService=require(_0x8241('0x12'));var logger=require('../../config/logger')(_0x8241('0x13'));var utils=require(_0x8241('0x14'));var config=require(_0x8241('0x15'));var licenseUtil=require(_0x8241('0x16'));var db=require(_0x8241('0x17'))['db'];function respondWithStatusCode(_0x484a9f,_0x126a26){_0x126a26=_0x126a26||0xcc;return function(_0x307aba){if(_0x307aba){return _0x484a9f[_0x8241('0x18')](_0x126a26);}return _0x484a9f['status'](_0x126a26)[_0x8241('0x19')]();};}function respondWithResult(_0x5ecfc3,_0x3f11c5){_0x3f11c5=_0x3f11c5||0xc8;return function(_0x5358cd){if(_0x5358cd){return _0x5ecfc3[_0x8241('0x1a')](_0x3f11c5)['json'](_0x5358cd);}};}function respondWithFilteredResult(_0x6b8d21,_0x445111){return function(_0x716653){if(_0x716653){var _0x2f1972=typeof _0x445111[_0x8241('0x1b')]===_0x8241('0x1c')&&typeof _0x445111['limit']===_0x8241('0x1c');var _0x1325de=_0x716653[_0x8241('0x1d')];var _0x3df65a=_0x2f1972?0x0:_0x445111[_0x8241('0x1b')];var _0x562f9e=_0x2f1972?_0x716653[_0x8241('0x1d')]:_0x445111[_0x8241('0x1b')]+_0x445111['limit'];var _0x4cea3e;if(_0x562f9e>=_0x1325de){_0x562f9e=_0x1325de;_0x4cea3e=0xc8;}else{_0x4cea3e=0xce;}_0x6b8d21['status'](_0x4cea3e);return _0x6b8d21[_0x8241('0x1e')](_0x8241('0x1f'),_0x3df65a+'-'+_0x562f9e+'/'+_0x1325de)['json'](_0x716653);}return null;};}function patchUpdates(_0x5d3bb8){return function(_0x2ecc32){try{jsonpatch[_0x8241('0x20')](_0x2ecc32,_0x5d3bb8,!![]);}catch(_0x461c73){return BPromise[_0x8241('0x21')](_0x461c73);}return _0x2ecc32[_0x8241('0x22')]();};}function saveUpdates(_0x19b2f2,_0x577d8b){return function(_0x226d6e){if(_0x226d6e){return _0x226d6e[_0x8241('0x23')](_0x19b2f2)[_0x8241('0x24')](function(_0x3036c5){return _0x3036c5;});}return null;};}function removeEntity(_0x5f9ab8,_0x31fb71){return function(_0x434ac8){if(_0x434ac8){return _0x434ac8[_0x8241('0x25')]()[_0x8241('0x24')](function(){_0x5f9ab8[_0x8241('0x1a')](0xcc)[_0x8241('0x19')]();});}};}function handleEntityNotFound(_0x3724ae,_0x15295a){return function(_0x285a21){if(!_0x285a21){_0x3724ae[_0x8241('0x18')](0x194);}return _0x285a21;};}function handleError(_0x5ac699,_0x113ff8){_0x113ff8=_0x113ff8||0x1f4;return function(_0x2aafd2){logger[_0x8241('0x26')](_0x2aafd2[_0x8241('0x27')]);if(_0x2aafd2['name']){delete _0x2aafd2['name'];}_0x5ac699['status'](_0x113ff8)[_0x8241('0x28')](_0x2aafd2);};}exports[_0x8241('0x29')]=function(_0x1075e4,_0x586e1d){var _0x10ea8a={},_0x40daea={},_0xe8df65={'count':0x0,'rows':[]};var _0x2ce9c0=_[_0x8241('0x2a')](db[_0x8241('0x2b')]['rawAttributes'],function(_0x34a0be){return{'name':_0x34a0be['fieldName'],'type':_0x34a0be['type'][_0x8241('0x2c')]};});_0x40daea[_0x8241('0x2d')]=_[_0x8241('0x2a')](_0x2ce9c0,_0x8241('0x2e'));_0x40daea[_0x8241('0x2f')]=_[_0x8241('0x30')](_0x1075e4[_0x8241('0x2f')]);_0x40daea[_0x8241('0x31')]=_['intersection'](_0x40daea[_0x8241('0x2d')],_0x40daea[_0x8241('0x2f')]);_0x10ea8a['attributes']=_[_0x8241('0x32')](_0x40daea[_0x8241('0x2d')],qs[_0x8241('0x33')](_0x1075e4[_0x8241('0x2f')][_0x8241('0x33')]));_0x10ea8a['attributes']=_0x10ea8a['attributes'][_0x8241('0x34')]?_0x10ea8a[_0x8241('0x35')]:_0x40daea['model'];if(!_0x1075e4[_0x8241('0x2f')][_0x8241('0x36')](_0x8241('0x37'))){_0x10ea8a[_0x8241('0x38')]=qs[_0x8241('0x38')](_0x1075e4[_0x8241('0x2f')]['limit']);_0x10ea8a[_0x8241('0x1b')]=qs[_0x8241('0x1b')](_0x1075e4['query'][_0x8241('0x1b')]);}_0x10ea8a[_0x8241('0x39')]=qs['sort'](_0x1075e4[_0x8241('0x2f')][_0x8241('0x3a')]);_0x10ea8a[_0x8241('0x3b')]=qs[_0x8241('0x31')](_[_0x8241('0x3c')](_0x1075e4[_0x8241('0x2f')],_0x40daea['filters']),_0x2ce9c0);if(_0x1075e4['query'][_0x8241('0x3d')]){_0x10ea8a['where']=_[_0x8241('0x3e')](_0x10ea8a[_0x8241('0x3b')],{'$or':_[_0x8241('0x2a')](_0x2ce9c0,function(_0x5e1c4a){if(_0x5e1c4a[_0x8241('0x3f')]!==_0x8241('0x40')){var _0x4c0657={};_0x4c0657[_0x5e1c4a[_0x8241('0x2e')]]={'$like':'%'+_0x1075e4['query'][_0x8241('0x3d')]+'%'};return _0x4c0657;}})});}_0x10ea8a=_[_0x8241('0x3e')]({},_0x10ea8a,_0x1075e4[_0x8241('0x41')]);var _0x2dc672={'where':_0x10ea8a['where']};return db[_0x8241('0x2b')][_0x8241('0x1d')](_0x2dc672)[_0x8241('0x24')](function(_0x205923){_0xe8df65[_0x8241('0x1d')]=_0x205923;if(_0x1075e4[_0x8241('0x2f')][_0x8241('0x42')]){_0x10ea8a[_0x8241('0x43')]=[{'all':!![]}];}return db['SmsTransferReport'][_0x8241('0x44')](_0x10ea8a);})['then'](function(_0xf16c46){_0xe8df65[_0x8241('0x45')]=_0xf16c46;return _0xe8df65;})[_0x8241('0x24')](respondWithFilteredResult(_0x586e1d,_0x10ea8a))[_0x8241('0x46')](handleError(_0x586e1d,null));};exports[_0x8241('0x47')]=function(_0x4346d8,_0x5265f0){var _0x1466b0={'raw':!![],'where':{'id':_0x4346d8[_0x8241('0x48')]['id']}},_0x413759={};_0x413759[_0x8241('0x2d')]=_[_0x8241('0x30')](db[_0x8241('0x2b')]['rawAttributes']);_0x413759[_0x8241('0x2f')]=_[_0x8241('0x30')](_0x4346d8[_0x8241('0x2f')]);_0x413759['filters']=_[_0x8241('0x32')](_0x413759[_0x8241('0x2d')],_0x413759['query']);_0x1466b0[_0x8241('0x35')]=_[_0x8241('0x32')](_0x413759[_0x8241('0x2d')],qs[_0x8241('0x33')](_0x4346d8[_0x8241('0x2f')][_0x8241('0x33')]));_0x1466b0[_0x8241('0x35')]=_0x1466b0[_0x8241('0x35')][_0x8241('0x34')]?_0x1466b0[_0x8241('0x35')]:_0x413759[_0x8241('0x2d')];if(_0x4346d8['query'][_0x8241('0x42')]){_0x1466b0[_0x8241('0x43')]=[{'all':!![]}];}_0x1466b0=_[_0x8241('0x3e')]({},_0x1466b0,_0x4346d8[_0x8241('0x41')]);return db[_0x8241('0x2b')][_0x8241('0x49')](_0x1466b0)[_0x8241('0x24')](handleEntityNotFound(_0x5265f0,null))[_0x8241('0x24')](respondWithResult(_0x5265f0,null))[_0x8241('0x46')](handleError(_0x5265f0,null));};exports[_0x8241('0x4a')]=function(_0x5c79ea,_0x31d5d2){return db[_0x8241('0x2b')]['create'](_0x5c79ea[_0x8241('0x4b')],{})[_0x8241('0x24')](respondWithResult(_0x31d5d2,0xc9))['catch'](handleError(_0x31d5d2,null));};exports[_0x8241('0x23')]=function(_0x5dc789,_0x19cf2e){if(_0x5dc789[_0x8241('0x4b')]['id']){delete _0x5dc789[_0x8241('0x4b')]['id'];}return db['SmsTransferReport'][_0x8241('0x49')]({'where':{'id':_0x5dc789[_0x8241('0x48')]['id']}})[_0x8241('0x24')](handleEntityNotFound(_0x19cf2e,null))[_0x8241('0x24')](saveUpdates(_0x5dc789[_0x8241('0x4b')],null))[_0x8241('0x24')](respondWithResult(_0x19cf2e,null))['catch'](handleError(_0x19cf2e,null));};exports[_0x8241('0x25')]=function(_0x29ea46,_0x2d2167){return db['SmsTransferReport'][_0x8241('0x49')]({'where':{'id':_0x29ea46[_0x8241('0x48')]['id']}})[_0x8241('0x24')](handleEntityNotFound(_0x2d2167,null))[_0x8241('0x24')](removeEntity(_0x2d2167,null))[_0x8241('0x46')](handleError(_0x2d2167,null));};exports[_0x8241('0x4c')]=function(_0x401c7b,_0x36c01f){return db['SmsTransferReport'][_0x8241('0x4c')]()[_0x8241('0x24')](respondWithResult(_0x36c01f,null))[_0x8241('0x46')](handleError(_0x36c01f,null));}; \ No newline at end of file +var _0x869a=['params','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','SmsTransferReport','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','length','create','body','find'];(function(_0x1713d1,_0x6d7fa0){var _0x3e779b=function(_0x51d600){while(--_0x51d600){_0x1713d1['push'](_0x1713d1['shift']());}};_0x3e779b(++_0x6d7fa0);}(_0x869a,0x1c4));var _0xa869=function(_0x94de92,_0x281882){_0x94de92=_0x94de92-0x0;var _0x5b5c5b=_0x869a[_0x94de92];return _0x5b5c5b;};'use strict';var emlformat=require(_0xa869('0x0'));var rimraf=require(_0xa869('0x1'));var zipdir=require(_0xa869('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa869('0x3'));var BPromise=require(_0xa869('0x4'));var Mustache=require(_0xa869('0x5'));var util=require(_0xa869('0x6'));var path=require(_0xa869('0x7'));var sox=require(_0xa869('0x8'));var csv=require(_0xa869('0x9'));var ejs=require(_0xa869('0xa'));var fs=require('fs');var fs_extra=require(_0xa869('0xb'));var _=require('lodash');var squel=require(_0xa869('0xc'));var crypto=require('crypto');var jsforce=require(_0xa869('0xd'));var deskjs=require(_0xa869('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa869('0xf'));var Papa=require(_0xa869('0x10'));var Redis=require('ioredis');var authService=require(_0xa869('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa869('0x12'));var logger=require(_0xa869('0x13'))(_0xa869('0x14'));var utils=require('../../config/utils');var config=require(_0xa869('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa869('0x16'))['db'];function respondWithStatusCode(_0x3f2fd7,_0x2875b6){_0x2875b6=_0x2875b6||0xcc;return function(_0x70394a){if(_0x70394a){return _0x3f2fd7[_0xa869('0x17')](_0x2875b6);}return _0x3f2fd7[_0xa869('0x18')](_0x2875b6)[_0xa869('0x19')]();};}function respondWithResult(_0x1c4b1c,_0xb2a19b){_0xb2a19b=_0xb2a19b||0xc8;return function(_0x5d2425){if(_0x5d2425){return _0x1c4b1c[_0xa869('0x18')](_0xb2a19b)[_0xa869('0x1a')](_0x5d2425);}};}function respondWithFilteredResult(_0xa7b8cc,_0xa38d2c){return function(_0x48e5dc){if(_0x48e5dc){var _0x32d779=typeof _0xa38d2c['offset']==='undefined'&&typeof _0xa38d2c[_0xa869('0x1b')]===_0xa869('0x1c');var _0x415bdf=_0x48e5dc[_0xa869('0x1d')];var _0xea70ce=_0x32d779?0x0:_0xa38d2c['offset'];var _0x5773a3=_0x32d779?_0x48e5dc[_0xa869('0x1d')]:_0xa38d2c[_0xa869('0x1e')]+_0xa38d2c[_0xa869('0x1b')];var _0xf2f195;if(_0x5773a3>=_0x415bdf){_0x5773a3=_0x415bdf;_0xf2f195=0xc8;}else{_0xf2f195=0xce;}_0xa7b8cc[_0xa869('0x18')](_0xf2f195);return _0xa7b8cc[_0xa869('0x1f')]('Content-Range',_0xea70ce+'-'+_0x5773a3+'/'+_0x415bdf)[_0xa869('0x1a')](_0x48e5dc);}return null;};}function patchUpdates(_0x5bf347){return function(_0x1159f7){try{jsonpatch[_0xa869('0x20')](_0x1159f7,_0x5bf347,!![]);}catch(_0x6919de){return BPromise[_0xa869('0x21')](_0x6919de);}return _0x1159f7[_0xa869('0x22')]();};}function saveUpdates(_0x44f404,_0x2bb806){return function(_0x417225){if(_0x417225){return _0x417225[_0xa869('0x23')](_0x44f404)[_0xa869('0x24')](function(_0x1139f8){return _0x1139f8;});}return null;};}function removeEntity(_0x4d282d,_0x31c061){return function(_0x5d14de){if(_0x5d14de){return _0x5d14de[_0xa869('0x25')]()[_0xa869('0x24')](function(){_0x4d282d[_0xa869('0x18')](0xcc)[_0xa869('0x19')]();});}};}function handleEntityNotFound(_0x5cd276,_0x2b42c3){return function(_0x3ee121){if(!_0x3ee121){_0x5cd276['sendStatus'](0x194);}return _0x3ee121;};}function handleError(_0x4d9ac1,_0x34e98d){_0x34e98d=_0x34e98d||0x1f4;return function(_0x853915){logger[_0xa869('0x26')](_0x853915[_0xa869('0x27')]);if(_0x853915['name']){delete _0x853915[_0xa869('0x28')];}_0x4d9ac1[_0xa869('0x18')](_0x34e98d)[_0xa869('0x29')](_0x853915);};}exports['index']=function(_0x54ea0d,_0x1fbac7){var _0x3ef125={},_0x4d5640={},_0x530020={'count':0x0,'rows':[]};var _0x2b94bc=_['map'](db[_0xa869('0x2a')][_0xa869('0x2b')],function(_0x439e27){return{'name':_0x439e27[_0xa869('0x2c')],'type':_0x439e27[_0xa869('0x2d')][_0xa869('0x2e')]};});_0x4d5640[_0xa869('0x2f')]=_[_0xa869('0x30')](_0x2b94bc,_0xa869('0x28'));_0x4d5640['query']=_[_0xa869('0x31')](_0x54ea0d[_0xa869('0x32')]);_0x4d5640['filters']=_[_0xa869('0x33')](_0x4d5640[_0xa869('0x2f')],_0x4d5640[_0xa869('0x32')]);_0x3ef125[_0xa869('0x34')]=_['intersection'](_0x4d5640[_0xa869('0x2f')],qs[_0xa869('0x35')](_0x54ea0d[_0xa869('0x32')]['fields']));_0x3ef125[_0xa869('0x34')]=_0x3ef125[_0xa869('0x34')]['length']?_0x3ef125[_0xa869('0x34')]:_0x4d5640[_0xa869('0x2f')];if(!_0x54ea0d[_0xa869('0x32')][_0xa869('0x36')](_0xa869('0x37'))){_0x3ef125[_0xa869('0x1b')]=qs[_0xa869('0x1b')](_0x54ea0d['query'][_0xa869('0x1b')]);_0x3ef125[_0xa869('0x1e')]=qs[_0xa869('0x1e')](_0x54ea0d[_0xa869('0x32')]['offset']);}_0x3ef125['order']=qs[_0xa869('0x38')](_0x54ea0d[_0xa869('0x32')][_0xa869('0x38')]);_0x3ef125['where']=qs[_0xa869('0x39')](_[_0xa869('0x3a')](_0x54ea0d[_0xa869('0x32')],_0x4d5640[_0xa869('0x39')]),_0x2b94bc);if(_0x54ea0d[_0xa869('0x32')][_0xa869('0x3b')]){_0x3ef125[_0xa869('0x3c')]=_[_0xa869('0x3d')](_0x3ef125[_0xa869('0x3c')],{'$or':_[_0xa869('0x30')](_0x2b94bc,function(_0x448430){if(_0x448430[_0xa869('0x2d')]!=='VIRTUAL'){var _0x25e36c={};_0x25e36c[_0x448430['name']]={'$like':'%'+_0x54ea0d['query'][_0xa869('0x3b')]+'%'};return _0x25e36c;}})});}_0x3ef125=_[_0xa869('0x3d')]({},_0x3ef125,_0x54ea0d[_0xa869('0x3e')]);var _0x3ad4c0={'where':_0x3ef125[_0xa869('0x3c')]};return db[_0xa869('0x2a')][_0xa869('0x1d')](_0x3ad4c0)[_0xa869('0x24')](function(_0x3dd7f9){_0x530020[_0xa869('0x1d')]=_0x3dd7f9;if(_0x54ea0d[_0xa869('0x32')][_0xa869('0x3f')]){_0x3ef125[_0xa869('0x40')]=[{'all':!![]}];}return db[_0xa869('0x2a')][_0xa869('0x41')](_0x3ef125);})[_0xa869('0x24')](function(_0x35da2c){_0x530020[_0xa869('0x42')]=_0x35da2c;return _0x530020;})[_0xa869('0x24')](respondWithFilteredResult(_0x1fbac7,_0x3ef125))[_0xa869('0x43')](handleError(_0x1fbac7,null));};exports[_0xa869('0x44')]=function(_0x2c37d3,_0x3722fc){var _0x2b3ad6={'raw':!![],'where':{'id':_0x2c37d3['params']['id']}},_0x276cd1={};_0x276cd1[_0xa869('0x2f')]=_[_0xa869('0x31')](db[_0xa869('0x2a')][_0xa869('0x2b')]);_0x276cd1[_0xa869('0x32')]=_[_0xa869('0x31')](_0x2c37d3[_0xa869('0x32')]);_0x276cd1[_0xa869('0x39')]=_[_0xa869('0x33')](_0x276cd1[_0xa869('0x2f')],_0x276cd1[_0xa869('0x32')]);_0x2b3ad6[_0xa869('0x34')]=_['intersection'](_0x276cd1[_0xa869('0x2f')],qs[_0xa869('0x35')](_0x2c37d3[_0xa869('0x32')][_0xa869('0x35')]));_0x2b3ad6[_0xa869('0x34')]=_0x2b3ad6[_0xa869('0x34')][_0xa869('0x45')]?_0x2b3ad6[_0xa869('0x34')]:_0x276cd1[_0xa869('0x2f')];if(_0x2c37d3['query'][_0xa869('0x3f')]){_0x2b3ad6[_0xa869('0x40')]=[{'all':!![]}];}_0x2b3ad6=_[_0xa869('0x3d')]({},_0x2b3ad6,_0x2c37d3['options']);return db[_0xa869('0x2a')]['find'](_0x2b3ad6)[_0xa869('0x24')](handleEntityNotFound(_0x3722fc,null))[_0xa869('0x24')](respondWithResult(_0x3722fc,null))['catch'](handleError(_0x3722fc,null));};exports[_0xa869('0x46')]=function(_0x3f726e,_0x5da74c){return db['SmsTransferReport'][_0xa869('0x46')](_0x3f726e[_0xa869('0x47')],{})[_0xa869('0x24')](respondWithResult(_0x5da74c,0xc9))[_0xa869('0x43')](handleError(_0x5da74c,null));};exports[_0xa869('0x23')]=function(_0x329b92,_0x8eeb27){if(_0x329b92[_0xa869('0x47')]['id']){delete _0x329b92[_0xa869('0x47')]['id'];}return db[_0xa869('0x2a')][_0xa869('0x48')]({'where':{'id':_0x329b92[_0xa869('0x49')]['id']}})[_0xa869('0x24')](handleEntityNotFound(_0x8eeb27,null))[_0xa869('0x24')](saveUpdates(_0x329b92[_0xa869('0x47')],null))[_0xa869('0x24')](respondWithResult(_0x8eeb27,null))[_0xa869('0x43')](handleError(_0x8eeb27,null));};exports['destroy']=function(_0x4bb380,_0x4059d0){return db[_0xa869('0x2a')]['find']({'where':{'id':_0x4bb380['params']['id']}})['then'](handleEntityNotFound(_0x4059d0,null))[_0xa869('0x24')](removeEntity(_0x4059d0,null))['catch'](handleError(_0x4059d0,null));};exports[_0xa869('0x4a')]=function(_0x174633,_0x54d9fa){return db[_0xa869('0x2a')][_0xa869('0x4a')]()[_0xa869('0x24')](respondWithResult(_0x54d9fa,null))[_0xa869('0x43')](handleError(_0x54d9fa,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 1ba14c7..dc31fdf 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 _0xad7c=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','uniqueid'];(function(_0x56bb32,_0x5d0dee){var _0xfb8403=function(_0x4a7644){while(--_0x4a7644){_0x56bb32['push'](_0x56bb32['shift']());}};_0xfb8403(++_0x5d0dee);}(_0xad7c,0x8c));var _0xcad7=function(_0x414b5c,_0x21773c){_0x414b5c=_0x414b5c-0x0;var _0x402a56=_0xad7c[_0x414b5c];return _0x402a56;};'use strict';var _=require(_0xcad7('0x0'));var util=require(_0xcad7('0x1'));var logger=require(_0xcad7('0x2'))(_0xcad7('0x3'));var moment=require(_0xcad7('0x4'));var BPromise=require('bluebird');var rp=require(_0xcad7('0x5'));var fs=require('fs');var path=require(_0xcad7('0x6'));var rimraf=require(_0xcad7('0x7'));var config=require(_0xcad7('0x8'));var attributes=require(_0xcad7('0x9'));module[_0xcad7('0xa')]=function(_0x4249be,_0x5a546c){return _0x4249be[_0xcad7('0xb')](_0xcad7('0xc'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xcad7('0xd'),'fields':[_0xcad7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xba5b=['path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','SmsTransferReport','report_sms_transfer','lodash','util','api','bluebird'];(function(_0x41b58e,_0x39e644){var _0x53896b=function(_0x2677f3){while(--_0x2677f3){_0x41b58e['push'](_0x41b58e['shift']());}};_0x53896b(++_0x39e644);}(_0xba5b,0xa1));var _0xbba5=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xba5b[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xbba5('0x0'));var util=require(_0xbba5('0x1'));var logger=require('../../config/logger')(_0xbba5('0x2'));var moment=require('moment');var BPromise=require(_0xbba5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbba5('0x4'));var rimraf=require(_0xbba5('0x5'));var config=require(_0xbba5('0x6'));var attributes=require(_0xbba5('0x7'));module[_0xbba5('0x8')]=function(_0x3e9f80,_0x86e2a0){return _0x3e9f80['define'](_0xbba5('0x9'),attributes,{'tableName':_0xbba5('0xa'),'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 b9d6fab..7def95a 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 _0x6379=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x4099c1,_0x2c3a00){var _0x30485d=function(_0x17143e){while(--_0x17143e){_0x4099c1['push'](_0x4099c1['shift']());}};_0x30485d(++_0x2c3a00);}(_0x6379,0x84));var _0x9637=function(_0x2d2aa4,_0x4f0c97){_0x2d2aa4=_0x2d2aa4-0x0;var _0x1b54bd=_0x6379[_0x2d2aa4];return _0x1b54bd;};'use strict';var _=require(_0x9637('0x0'));var util=require(_0x9637('0x1'));var moment=require(_0x9637('0x2'));var BPromise=require(_0x9637('0x3'));var rs=require(_0x9637('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9637('0x5'))['db'];var utils=require(_0x9637('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x9637('0x7'));var jayson=require(_0x9637('0x8'));var client=jayson[_0x9637('0x9')][_0x9637('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf0db9f,_0x5ce1a4,_0x515a84){return new BPromise(function(_0x21d91b,_0x42eda1){return client[_0x9637('0xb')](_0xf0db9f,_0x515a84)[_0x9637('0xc')](function(_0x5e66ee){logger[_0x9637('0xd')](_0x9637('0xe'),_0x5ce1a4,_0x9637('0xf'));logger[_0x9637('0x10')](_0x9637('0x11'),_0x5ce1a4,_0x9637('0xf'),JSON[_0x9637('0x12')](_0x5e66ee));if(_0x5e66ee[_0x9637('0x13')]){if(_0x5e66ee[_0x9637('0x13')]['code']===0x1f4){logger[_0x9637('0x13')]('SmsTransferReport,\x20%s,\x20%s',_0x5ce1a4,_0x5e66ee[_0x9637('0x13')][_0x9637('0x14')]);return _0x42eda1(_0x5e66ee['error'][_0x9637('0x14')]);}logger[_0x9637('0x13')](_0x9637('0xe'),_0x5ce1a4,_0x5e66ee[_0x9637('0x13')]['message']);return _0x21d91b(_0x5e66ee[_0x9637('0x13')][_0x9637('0x14')]);}else{logger[_0x9637('0xd')](_0x9637('0xe'),_0x5ce1a4,_0x9637('0xf'));_0x21d91b(_0x5e66ee['result'][_0x9637('0x14')]);}})[_0x9637('0x15')](function(_0x1eb774){logger[_0x9637('0x13')](_0x9637('0xe'),_0x5ce1a4,_0x1eb774);_0x42eda1(_0x1eb774);});});} \ No newline at end of file +var _0x89fe=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x89fe,0x83));var _0xe89f=function(_0x429a64,_0x3b863d){_0x429a64=_0x429a64-0x0;var _0x571edf=_0x89fe[_0x429a64];return _0x571edf;};'use strict';var _=require(_0xe89f('0x0'));var util=require(_0xe89f('0x1'));var moment=require(_0xe89f('0x2'));var BPromise=require(_0xe89f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe89f('0x4'));var db=require(_0xe89f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe89f('0x6'))(_0xe89f('0x7'));var config=require(_0xe89f('0x8'));var jayson=require(_0xe89f('0x9'));var client=jayson[_0xe89f('0xa')][_0xe89f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24358f,_0x5427d2,_0x4639f0){return new BPromise(function(_0x3e9998,_0x7043f3){return client[_0xe89f('0xc')](_0x24358f,_0x4639f0)[_0xe89f('0xd')](function(_0x4fa2fa){logger[_0xe89f('0xe')](_0xe89f('0xf'),_0x5427d2,_0xe89f('0x10'));logger[_0xe89f('0x11')](_0xe89f('0x12'),_0x5427d2,_0xe89f('0x10'),JSON[_0xe89f('0x13')](_0x4fa2fa));if(_0x4fa2fa[_0xe89f('0x14')]){if(_0x4fa2fa[_0xe89f('0x14')][_0xe89f('0x15')]===0x1f4){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x5427d2,_0x4fa2fa['error']['message']);return _0x7043f3(_0x4fa2fa['error'][_0xe89f('0x16')]);}logger[_0xe89f('0x14')]('SmsTransferReport,\x20%s,\x20%s',_0x5427d2,_0x4fa2fa['error'][_0xe89f('0x16')]);return _0x3e9998(_0x4fa2fa[_0xe89f('0x14')][_0xe89f('0x16')]);}else{logger[_0xe89f('0xe')](_0xe89f('0xf'),_0x5427d2,_0xe89f('0x10'));_0x3e9998(_0x4fa2fa[_0xe89f('0x17')][_0xe89f('0x16')]);}})[_0xe89f('0x18')](function(_0x16bfe0){logger['error'](_0xe89f('0xf'),_0x5427d2,_0x16bfe0);_0x7043f3(_0x16bfe0);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 38c821c..55a27d1 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 _0x8ffa=['Router','fs-extra','../../components/auth/service','../../config/environment','./sound.controller','index','/:id','isAuthenticated','show','get','/:id/download','download','diskStorage','join','root','originalname','replace','format','%s-%s%s','basename','extname','now','post','create','put','update','delete','util','express'];(function(_0x201ab0,_0x148b1b){var _0x124c05=function(_0x364586){while(--_0x364586){_0x201ab0['push'](_0x201ab0['shift']());}};_0x124c05(++_0x148b1b);}(_0x8ffa,0xe6));var _0xa8ff=function(_0xd8d76f,_0x42014a){_0xd8d76f=_0xd8d76f-0x0;var _0x2bbd81=_0x8ffa[_0xd8d76f];return _0x2bbd81;};'use strict';var multer=require('multer');var util=require(_0xa8ff('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa8ff('0x1'));var router=express[_0xa8ff('0x2')]();var fs_extra=require(_0xa8ff('0x3'));var auth=require(_0xa8ff('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa8ff('0x5'));var controller=require(_0xa8ff('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xa8ff('0x7')]);router['get'](_0xa8ff('0x8'),auth[_0xa8ff('0x9')](),controller[_0xa8ff('0xa')]);router[_0xa8ff('0xb')](_0xa8ff('0xc'),auth[_0xa8ff('0x9')](),controller[_0xa8ff('0xd')]);var upload=multer({'storage':multer[_0xa8ff('0xe')]({'destination':function(_0x17703d,_0x26e060,_0x529edd){_0x529edd(null,path[_0xa8ff('0xf')](config[_0xa8ff('0x10')],'server/files/sounds/original/'));},'filename':function(_0x4457cd,_0x36930e,_0x5be9f1){_0x36930e[_0xa8ff('0x11')]=_0x36930e[_0xa8ff('0x11')][_0xa8ff('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5be9f1(null,util[_0xa8ff('0x13')](_0xa8ff('0x14'),path[_0xa8ff('0x15')](_0x36930e[_0xa8ff('0x11')],path[_0xa8ff('0x16')](_0x36930e[_0xa8ff('0x11')])),Date[_0xa8ff('0x17')](),path[_0xa8ff('0x16')](_0x36930e['originalname'])));}})});router[_0xa8ff('0x18')]('/',upload['single']('file'),controller[_0xa8ff('0x19')]);router[_0xa8ff('0x1a')](_0xa8ff('0x8'),auth[_0xa8ff('0x9')](),controller[_0xa8ff('0x1b')]);router[_0xa8ff('0x1c')](_0xa8ff('0x8'),auth[_0xa8ff('0x9')](),controller[_0xa8ff('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x54a2=['/:id/download','download','diskStorage','join','originalname','replace','format','%s-%s%s','basename','extname','post','single','file','create','update','delete','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','index','/:id','isAuthenticated','show'];(function(_0x3f5cc7,_0x326d6d){var _0x506d91=function(_0x386434){while(--_0x386434){_0x3f5cc7['push'](_0x3f5cc7['shift']());}};_0x506d91(++_0x326d6d);}(_0x54a2,0x197));var _0x254a=function(_0x41cf29,_0x216a99){_0x41cf29=_0x41cf29-0x0;var _0x566462=_0x54a2[_0x41cf29];return _0x566462;};'use strict';var multer=require(_0x254a('0x0'));var util=require(_0x254a('0x1'));var path=require(_0x254a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x254a('0x3'));var auth=require(_0x254a('0x4'));var interaction=require(_0x254a('0x5'));var config=require(_0x254a('0x6'));var controller=require(_0x254a('0x7'));router[_0x254a('0x8')]('/',auth['isAuthenticated'](),controller[_0x254a('0x9')]);router[_0x254a('0x8')](_0x254a('0xa'),auth[_0x254a('0xb')](),controller[_0x254a('0xc')]);router['get'](_0x254a('0xd'),auth[_0x254a('0xb')](),controller[_0x254a('0xe')]);var upload=multer({'storage':multer[_0x254a('0xf')]({'destination':function(_0x55f5db,_0x511915,_0x39afcd){_0x39afcd(null,path[_0x254a('0x10')](config['root'],'server/files/sounds/original/'));},'filename':function(_0x126e4d,_0x458d40,_0x50d0ec){_0x458d40[_0x254a('0x11')]=_0x458d40[_0x254a('0x11')][_0x254a('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x50d0ec(null,util[_0x254a('0x13')](_0x254a('0x14'),path[_0x254a('0x15')](_0x458d40[_0x254a('0x11')],path['extname'](_0x458d40[_0x254a('0x11')])),Date['now'](),path[_0x254a('0x16')](_0x458d40[_0x254a('0x11')])));}})});router[_0x254a('0x17')]('/',upload[_0x254a('0x18')](_0x254a('0x19')),controller[_0x254a('0x1a')]);router['put'](_0x254a('0xa'),auth[_0x254a('0xb')](),controller[_0x254a('0x1b')]);router[_0x254a('0x1c')](_0x254a('0xa'),auth[_0x254a('0xb')](),controller[_0x254a('0x1c')]);module[_0x254a('0x1d')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 2201030..ed51087 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 _0x2b39=['sequelize','STRING','name','BIGINT','INTEGER','FLOAT'];(function(_0x2b89dc,_0x8bfa42){var _0x412762=function(_0x42dc39){while(--_0x42dc39){_0x2b89dc['push'](_0x2b89dc['shift']());}};_0x412762(++_0x8bfa42);}(_0x2b39,0xc0));var _0x92b3=function(_0x3308a0,_0x5a71c4){_0x3308a0=_0x3308a0-0x0;var _0x3adbf3=_0x2b39[_0x3308a0];return _0x3adbf3;};'use strict';var Sequelize=require(_0x92b3('0x0'));module['exports']={'name':{'type':Sequelize[_0x92b3('0x1')],'unique':_0x92b3('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x92b3('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x92b3('0x1')]},'original_format':{'type':Sequelize[_0x92b3('0x1')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x92b3('0x3')]},'original_channelCount':{'type':Sequelize[_0x92b3('0x4')]},'original_bitRate':{'type':Sequelize[_0x92b3('0x3')]},'original_sampleRate':{'type':Sequelize[_0x92b3('0x4')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x92b3('0x5')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x92b3('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x92b3('0x4')]}}; \ No newline at end of file +var _0x6167=['INTEGER','FLOAT','sequelize','STRING','name','BIGINT'];(function(_0x1d0fb0,_0x4e55b5){var _0xd2ac47=function(_0x35600f){while(--_0x35600f){_0x1d0fb0['push'](_0x1d0fb0['shift']());}};_0xd2ac47(++_0x4e55b5);}(_0x6167,0x1a0));var _0x7616=function(_0x1da997,_0x15480c){_0x1da997=_0x1da997-0x0;var _0x4a19c9=_0x6167[_0x1da997];return _0x4a19c9;};'use strict';var Sequelize=require(_0x7616('0x0'));module['exports']={'name':{'type':Sequelize[_0x7616('0x1')],'unique':_0x7616('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x7616('0x1')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x7616('0x1')]},'original_format':{'type':Sequelize[_0x7616('0x1')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x7616('0x3')]},'original_channelCount':{'type':Sequelize[_0x7616('0x4')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x7616('0x1')]},'converted_duration':{'type':Sequelize[_0x7616('0x5')]},'converted_sampleCount':{'type':Sequelize[_0x7616('0x3')]},'converted_channelCount':{'type':Sequelize[_0x7616('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x7616('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 8ad86d5..ad58d39 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 _0xb5d2=['rows','catch','keys','find','download','params','converted_format','existsSync','join','server/files/sounds/converted','Sound\x20not\x20found','%s.%s','save_name','format','create','file','originalname','basename','filename','extname','wav','root','info','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','send','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','0777','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','delete','destroy','server/files/sounds/original','original_format','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','then','Sounds','UserProfileResource','stack','name','index','map','Sound','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x1e2b40,_0x3012b6){var _0x23ba2b=function(_0xbc6a00){while(--_0xbc6a00){_0x1e2b40['push'](_0x1e2b40['shift']());}};_0x23ba2b(++_0x3012b6);}(_0xb5d2,0x1b2));var _0x2b5d=function(_0x43f3fe,_0x19bb95){_0x43f3fe=_0x43f3fe-0x0;var _0x41827a=_0xb5d2[_0x43f3fe];return _0x41827a;};'use strict';var emlformat=require(_0x2b5d('0x0'));var rimraf=require(_0x2b5d('0x1'));var zipdir=require(_0x2b5d('0x2'));var jsonpatch=require(_0x2b5d('0x3'));var rp=require(_0x2b5d('0x4'));var moment=require(_0x2b5d('0x5'));var BPromise=require(_0x2b5d('0x6'));var Mustache=require('mustache');var util=require(_0x2b5d('0x7'));var path=require(_0x2b5d('0x8'));var sox=require(_0x2b5d('0x9'));var csv=require(_0x2b5d('0xa'));var ejs=require(_0x2b5d('0xb'));var fs=require('fs');var fs_extra=require(_0x2b5d('0xc'));var _=require(_0x2b5d('0xd'));var squel=require(_0x2b5d('0xe'));var crypto=require(_0x2b5d('0xf'));var jsforce=require(_0x2b5d('0x10'));var deskjs=require(_0x2b5d('0x11'));var toCsv=require(_0x2b5d('0xa'));var querystring=require(_0x2b5d('0x12'));var Papa=require(_0x2b5d('0x13'));var Redis=require(_0x2b5d('0x14'));var authService=require(_0x2b5d('0x15'));var qs=require(_0x2b5d('0x16'));var as=require(_0x2b5d('0x17'));var hardwareService=require(_0x2b5d('0x18'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x2b5d('0x19'));var licenseUtil=require(_0x2b5d('0x1a'));var db=require(_0x2b5d('0x1b'))['db'];function respondWithStatusCode(_0x3577ae,_0x46f44f){_0x46f44f=_0x46f44f||0xcc;return function(_0xbb47ef){if(_0xbb47ef){return _0x3577ae[_0x2b5d('0x1c')](_0x46f44f);}return _0x3577ae[_0x2b5d('0x1d')](_0x46f44f)[_0x2b5d('0x1e')]();};}function respondWithResult(_0x421ff2,_0x1ff99a){_0x1ff99a=_0x1ff99a||0xc8;return function(_0x385727){if(_0x385727){return _0x421ff2[_0x2b5d('0x1d')](_0x1ff99a)['json'](_0x385727);}};}function respondWithFilteredResult(_0x2203e1,_0x262029){return function(_0x474b46){if(_0x474b46){var _0x547721=typeof _0x262029[_0x2b5d('0x1f')]===_0x2b5d('0x20')&&typeof _0x262029[_0x2b5d('0x21')]===_0x2b5d('0x20');var _0x127c27=_0x474b46[_0x2b5d('0x22')];var _0x4bd3b4=_0x547721?0x0:_0x262029['offset'];var _0x441ac9=_0x547721?_0x474b46[_0x2b5d('0x22')]:_0x262029[_0x2b5d('0x1f')]+_0x262029[_0x2b5d('0x21')];var _0x45e4b0;if(_0x441ac9>=_0x127c27){_0x441ac9=_0x127c27;_0x45e4b0=0xc8;}else{_0x45e4b0=0xce;}_0x2203e1[_0x2b5d('0x1d')](_0x45e4b0);return _0x2203e1[_0x2b5d('0x23')](_0x2b5d('0x24'),_0x4bd3b4+'-'+_0x441ac9+'/'+_0x127c27)[_0x2b5d('0x25')](_0x474b46);}return null;};}function patchUpdates(_0x16a764){return function(_0x1a74e3){try{jsonpatch[_0x2b5d('0x26')](_0x1a74e3,_0x16a764,!![]);}catch(_0x4b5dd4){return BPromise[_0x2b5d('0x27')](_0x4b5dd4);}return _0x1a74e3['save']();};}function saveUpdates(_0x2aa337,_0x53d5de){return function(_0x5d3431){if(_0x5d3431){return _0x5d3431['update'](_0x2aa337)['then'](function(_0x44cc57){return _0x44cc57;});}return null;};}function removeEntity(_0xbc2bbc,_0x55e2ac){return function(_0x24c657){if(_0x24c657){return _0x24c657['destroy']()[_0x2b5d('0x28')](function(){var _0x547f92=_0x24c657['get']({'plain':!![]});var _0x485780=_0x2b5d('0x29');return db[_0x2b5d('0x2a')]['destroy']({'where':{'type':_0x485780,'resourceId':_0x547f92['id']}})[_0x2b5d('0x28')](function(){return _0x24c657;});})[_0x2b5d('0x28')](function(){_0xbc2bbc[_0x2b5d('0x1d')](0xcc)[_0x2b5d('0x1e')]();});}};}function handleEntityNotFound(_0x21205e,_0x36afb6){return function(_0x1d88dd){if(!_0x1d88dd){_0x21205e[_0x2b5d('0x1c')](0x194);}return _0x1d88dd;};}function handleError(_0x2ab430,_0xa4c853){_0xa4c853=_0xa4c853||0x1f4;return function(_0x150a03){logger['error'](_0x150a03[_0x2b5d('0x2b')]);if(_0x150a03['name']){delete _0x150a03[_0x2b5d('0x2c')];}_0x2ab430[_0x2b5d('0x1d')](_0xa4c853)['send'](_0x150a03);};}exports[_0x2b5d('0x2d')]=function(_0x40c00e,_0x26dd25){var _0x17f18b={},_0x521ffa={},_0x1b52a0={'count':0x0,'rows':[]};var _0x2f9542=_[_0x2b5d('0x2e')](db[_0x2b5d('0x2f')][_0x2b5d('0x30')],function(_0x572dfa){return{'name':_0x572dfa['fieldName'],'type':_0x572dfa[_0x2b5d('0x31')]['key']};});_0x521ffa[_0x2b5d('0x32')]=_['map'](_0x2f9542,_0x2b5d('0x2c'));_0x521ffa[_0x2b5d('0x33')]=_['keys'](_0x40c00e[_0x2b5d('0x33')]);_0x521ffa[_0x2b5d('0x34')]=_[_0x2b5d('0x35')](_0x521ffa[_0x2b5d('0x32')],_0x521ffa[_0x2b5d('0x33')]);_0x17f18b[_0x2b5d('0x36')]=_[_0x2b5d('0x35')](_0x521ffa[_0x2b5d('0x32')],qs[_0x2b5d('0x37')](_0x40c00e[_0x2b5d('0x33')][_0x2b5d('0x37')]));_0x17f18b['attributes']=_0x17f18b[_0x2b5d('0x36')][_0x2b5d('0x38')]?_0x17f18b['attributes']:_0x521ffa[_0x2b5d('0x32')];if(!_0x40c00e[_0x2b5d('0x33')][_0x2b5d('0x39')](_0x2b5d('0x3a'))){_0x17f18b[_0x2b5d('0x21')]=qs[_0x2b5d('0x21')](_0x40c00e[_0x2b5d('0x33')][_0x2b5d('0x21')]);_0x17f18b[_0x2b5d('0x1f')]=qs[_0x2b5d('0x1f')](_0x40c00e[_0x2b5d('0x33')][_0x2b5d('0x1f')]);}_0x17f18b[_0x2b5d('0x3b')]=qs[_0x2b5d('0x3c')](_0x40c00e[_0x2b5d('0x33')][_0x2b5d('0x3c')]);_0x17f18b[_0x2b5d('0x3d')]=qs[_0x2b5d('0x34')](_[_0x2b5d('0x3e')](_0x40c00e['query'],_0x521ffa[_0x2b5d('0x34')]),_0x2f9542);if(_0x40c00e['query'][_0x2b5d('0x3f')]){_0x17f18b[_0x2b5d('0x3d')]=_[_0x2b5d('0x40')](_0x17f18b[_0x2b5d('0x3d')],{'$or':_[_0x2b5d('0x2e')](_0x2f9542,function(_0x6d1411){if(_0x6d1411[_0x2b5d('0x31')]!==_0x2b5d('0x41')){var _0x200641={};_0x200641[_0x6d1411[_0x2b5d('0x2c')]]={'$like':'%'+_0x40c00e['query'][_0x2b5d('0x3f')]+'%'};return _0x200641;}})});}_0x17f18b=_['merge']({},_0x17f18b,_0x40c00e[_0x2b5d('0x42')]);var _0xca4043={'where':_0x17f18b[_0x2b5d('0x3d')]};return db[_0x2b5d('0x2f')]['count'](_0xca4043)[_0x2b5d('0x28')](function(_0x512a03){_0x1b52a0['count']=_0x512a03;if(_0x40c00e[_0x2b5d('0x33')][_0x2b5d('0x43')]){_0x17f18b[_0x2b5d('0x44')]=[{'all':!![]}];}return db[_0x2b5d('0x2f')][_0x2b5d('0x45')](_0x17f18b);})[_0x2b5d('0x28')](function(_0x295182){_0x1b52a0[_0x2b5d('0x46')]=_0x295182;return _0x1b52a0;})[_0x2b5d('0x28')](respondWithFilteredResult(_0x26dd25,_0x17f18b))[_0x2b5d('0x47')](handleError(_0x26dd25,null));};exports['show']=function(_0x219dbc,_0xd899dc){var _0x20a4db={'raw':!![],'where':{'id':_0x219dbc['params']['id']}},_0x4801dc={};_0x4801dc['model']=_[_0x2b5d('0x48')](db['Sound'][_0x2b5d('0x30')]);_0x4801dc['query']=_[_0x2b5d('0x48')](_0x219dbc[_0x2b5d('0x33')]);_0x4801dc['filters']=_[_0x2b5d('0x35')](_0x4801dc[_0x2b5d('0x32')],_0x4801dc[_0x2b5d('0x33')]);_0x20a4db[_0x2b5d('0x36')]=_[_0x2b5d('0x35')](_0x4801dc[_0x2b5d('0x32')],qs[_0x2b5d('0x37')](_0x219dbc['query']['fields']));_0x20a4db[_0x2b5d('0x36')]=_0x20a4db['attributes']['length']?_0x20a4db['attributes']:_0x4801dc[_0x2b5d('0x32')];if(_0x219dbc[_0x2b5d('0x33')][_0x2b5d('0x43')]){_0x20a4db[_0x2b5d('0x44')]=[{'all':!![]}];}_0x20a4db=_[_0x2b5d('0x40')]({},_0x20a4db,_0x219dbc['options']);return db[_0x2b5d('0x2f')][_0x2b5d('0x49')](_0x20a4db)[_0x2b5d('0x28')](handleEntityNotFound(_0xd899dc,null))[_0x2b5d('0x28')](respondWithResult(_0xd899dc,null))['catch'](handleError(_0xd899dc,null));};exports[_0x2b5d('0x4a')]=function(_0xa08650,_0x3d6804,_0xa92109){return db[_0x2b5d('0x2f')][_0x2b5d('0x49')]({'where':{'id':_0xa08650[_0x2b5d('0x4b')]['id']},'attributes':[_0x2b5d('0x2c'),'save_name',_0x2b5d('0x4c')],'raw':!![]})[_0x2b5d('0x28')](handleEntityNotFound(_0x3d6804,null))[_0x2b5d('0x28')](function(_0xd14d2a){if(_0xd14d2a){if(!fs[_0x2b5d('0x4d')](path[_0x2b5d('0x4e')](config['root'],_0x2b5d('0x4f'),_0xd14d2a['save_name']+'.'+_0xd14d2a[_0x2b5d('0x4c')]))){throw new db['Sequelize']['ValidationError'](_0x2b5d('0x50'));}return _0x3d6804['download'](path[_0x2b5d('0x4e')](config['root'],_0x2b5d('0x4f'),util['format'](_0x2b5d('0x51'),_0xd14d2a[_0x2b5d('0x52')],_0xd14d2a['converted_format'])),util[_0x2b5d('0x53')](_0x2b5d('0x51'),_0xd14d2a[_0x2b5d('0x2c')],_0xd14d2a[_0x2b5d('0x4c')]));}return null;})[_0x2b5d('0x47')](handleError(_0x3d6804,null));};exports[_0x2b5d('0x54')]=function(_0x3ea8a5,_0x43d759,_0x44b7eb){var _0x719964={'name':path['basename'](_0x3ea8a5[_0x2b5d('0x55')][_0x2b5d('0x56')],path['extname'](_0x3ea8a5[_0x2b5d('0x55')][_0x2b5d('0x56')])),'save_name':path[_0x2b5d('0x57')](_0x3ea8a5[_0x2b5d('0x55')][_0x2b5d('0x58')],path[_0x2b5d('0x59')](_0x3ea8a5[_0x2b5d('0x55')]['filename'])),'original_format':path[_0x2b5d('0x59')](_0x3ea8a5[_0x2b5d('0x55')][_0x2b5d('0x56')])['substring'](0x1),'converted_format':_0x2b5d('0x5a')};var _0x158292=path[_0x2b5d('0x4e')](config[_0x2b5d('0x5b')],'server/files/sounds/original',_0x3ea8a5[_0x2b5d('0x55')][_0x2b5d('0x58')]);var _0x5dbd25=path[_0x2b5d('0x4e')](config['root'],_0x2b5d('0x4f'),util[_0x2b5d('0x53')](_0x2b5d('0x51'),path['basename'](_0x3ea8a5[_0x2b5d('0x55')][_0x2b5d('0x58')],path[_0x2b5d('0x59')](_0x3ea8a5[_0x2b5d('0x55')][_0x2b5d('0x58')])),_0x719964['converted_format']));logger[_0x2b5d('0x5c')]('Sound\x20upload\x20filepath:\x20%s',_0x158292);logger[_0x2b5d('0x5c')](_0x2b5d('0x5d'),_0x5dbd25);try{fs[_0x2b5d('0x5e')](_0x158292,parseInt('0777',0x8));var _0x516433=sox[_0x2b5d('0x5f')](_0x158292,_0x5dbd25,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x516433['on']('error',function(_0xfdb2e1){fs['unlinkSync'](_0x158292);_0x43d759['status'](0x1f4)[_0x2b5d('0x60')](_0xfdb2e1);});_0x516433['on']('src',function(_0x544ca5){_0x719964['original_duration']=isNaN(_0x544ca5[_0x2b5d('0x61')])?null:_0x544ca5[_0x2b5d('0x61')]*0x3e8;_0x719964[_0x2b5d('0x62')]=isNaN(_0x544ca5[_0x2b5d('0x63')])?null:_0x544ca5[_0x2b5d('0x63')];_0x719964[_0x2b5d('0x64')]=isNaN(_0x544ca5['channelCount'])?null:_0x544ca5[_0x2b5d('0x65')];_0x719964[_0x2b5d('0x66')]=isNaN(_0x544ca5[_0x2b5d('0x67')])?null:_0x544ca5[_0x2b5d('0x67')];_0x719964['original_sampleRate']=isNaN(_0x544ca5[_0x2b5d('0x68')])?null:_0x544ca5[_0x2b5d('0x68')];});_0x516433['on'](_0x2b5d('0x69'),function(_0x494ec1){_0x719964[_0x2b5d('0x6a')]=isNaN(_0x494ec1[_0x2b5d('0x61')])?null:_0x494ec1[_0x2b5d('0x61')]*0x3e8;_0x719964[_0x2b5d('0x6b')]=isNaN(_0x494ec1['sampleCount'])?null:_0x494ec1['sampleCount'];_0x719964[_0x2b5d('0x6c')]=isNaN(_0x494ec1['channelCount'])?null:_0x494ec1['channelCount'];_0x719964[_0x2b5d('0x6d')]=isNaN(_0x494ec1['bitRate'])?null:_0x494ec1['bitRate'];_0x719964[_0x2b5d('0x6e')]=isNaN(_0x494ec1[_0x2b5d('0x68')])?null:_0x494ec1[_0x2b5d('0x68')];});_0x516433['on']('end',function(){fs['chmodSync'](_0x5dbd25,parseInt(_0x2b5d('0x6f'),0x8));return db[_0x2b5d('0x2f')][_0x2b5d('0x54')](_0x719964)[_0x2b5d('0x28')](function(_0x1a2f8b){var _0x4ef6e1={'role':_0x3ea8a5[_0x2b5d('0x70')][_0x2b5d('0x71')],'userProfileId':_0x3ea8a5[_0x2b5d('0x70')][_0x2b5d('0x72')]};if(!_0x4ef6e1)throw new Error(_0x2b5d('0x73'));if(_0x4ef6e1[_0x2b5d('0x71')]==='user'){var _0x3c035b=_0x1a2f8b[_0x2b5d('0x74')]({'plain':!![]});return db[_0x2b5d('0x75')][_0x2b5d('0x49')]({'where':{'name':_0x2b5d('0x29'),'userProfileId':_0x4ef6e1[_0x2b5d('0x72')]},'raw':!![]})['then'](function(_0x3839e2){if(_0x3839e2&&_0x3839e2[_0x2b5d('0x76')]===0x0){return db[_0x2b5d('0x2a')][_0x2b5d('0x54')]({'name':_0x3c035b[_0x2b5d('0x2c')],'resourceId':_0x3c035b['id'],'type':_0x3839e2['name'],'sectionId':_0x3839e2['id']},{})[_0x2b5d('0x28')](function(){return _0x1a2f8b;});}else{return _0x1a2f8b;}})[_0x2b5d('0x47')](function(_0x2b6fd7){logger['error'](_0x2b5d('0x77'),_0x2b6fd7);throw _0x2b6fd7;});}return _0x1a2f8b;})['then'](respondWithResult(_0x43d759,null))[_0x2b5d('0x47')](handleError(_0x43d759,null));});_0x516433['start']();}catch(_0x4438c0){_0x43d759['status'](0x1f4)[_0x2b5d('0x60')](_0x4438c0);}};exports[_0x2b5d('0x78')]=function(_0xfa7577,_0x80017e,_0x57c0c4){return db['Sound']['find']({'where':{'id':_0xfa7577[_0x2b5d('0x4b')]['id']}})[_0x2b5d('0x28')](handleEntityNotFound(_0x80017e,null))['then'](saveUpdates(_[_0x2b5d('0x3e')](_0xfa7577[_0x2b5d('0x70')],['name','description']),null))[_0x2b5d('0x28')](respondWithResult(_0x80017e,null))[_0x2b5d('0x47')](handleError(_0x80017e,null));};exports[_0x2b5d('0x79')]=function(_0x5a30d5,_0x2eaa37,_0x315fa6){return db['Sound'][_0x2b5d('0x49')]({'where':{'id':_0x5a30d5[_0x2b5d('0x4b')]['id']}})[_0x2b5d('0x28')](function(_0x2af7e1){if(_0x2af7e1){return _0x2af7e1[_0x2b5d('0x7a')]();}})[_0x2b5d('0x28')](function(_0x49ca00){var _0x270afc=path['join'](config[_0x2b5d('0x5b')],_0x2b5d('0x7b'),util[_0x2b5d('0x53')](_0x2b5d('0x51'),_0x49ca00[_0x2b5d('0x52')],_0x49ca00[_0x2b5d('0x7c')]));var _0x576dd6=path[_0x2b5d('0x4e')](config[_0x2b5d('0x5b')],_0x2b5d('0x4f'),util[_0x2b5d('0x53')](_0x2b5d('0x51'),_0x49ca00[_0x2b5d('0x52')],_0x49ca00[_0x2b5d('0x4c')]));fs[_0x2b5d('0x7d')](_0x270afc);fs['unlinkSync'](_0x576dd6);return _0x49ca00;})[_0x2b5d('0x28')](function(_0x4cdde1){if(_0x4cdde1){return _0x2eaa37[_0x2b5d('0x1d')](0xcc)[_0x2b5d('0x1e')]();}})[_0x2b5d('0x28')](handleEntityNotFound(_0x2eaa37,null))[_0x2b5d('0x47')](handleError(_0x2eaa37,null));}; \ No newline at end of file +var _0xd8da=['join','server/files/sounds/converted','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','transcode','original_duration','duration','sampleCount','bitRate','original_sampleRate','sampleRate','converted_sampleCount','converted_sampleRate','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','delete','original_format','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','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','end','status','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','Sounds','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','Sound','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','count','includeAll','include','findAll','catch','show','params','rawAttributes','options','find','converted_format','existsSync','root','save_name','Sequelize','ValidationError','Sound\x20not\x20found','download'];(function(_0xbeed49,_0x5537cd){var _0x1e3c13=function(_0x421293){while(--_0x421293){_0xbeed49['push'](_0xbeed49['shift']());}};_0x1e3c13(++_0x5537cd);}(_0xd8da,0xa2));var _0xad8d=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xd8da[_0x16d10f];return _0x50c823;};'use strict';var emlformat=require(_0xad8d('0x0'));var rimraf=require(_0xad8d('0x1'));var zipdir=require(_0xad8d('0x2'));var jsonpatch=require(_0xad8d('0x3'));var rp=require(_0xad8d('0x4'));var moment=require(_0xad8d('0x5'));var BPromise=require(_0xad8d('0x6'));var Mustache=require(_0xad8d('0x7'));var util=require(_0xad8d('0x8'));var path=require(_0xad8d('0x9'));var sox=require('sox');var csv=require(_0xad8d('0xa'));var ejs=require(_0xad8d('0xb'));var fs=require('fs');var fs_extra=require(_0xad8d('0xc'));var _=require(_0xad8d('0xd'));var squel=require('squel');var crypto=require(_0xad8d('0xe'));var jsforce=require(_0xad8d('0xf'));var deskjs=require(_0xad8d('0x10'));var toCsv=require(_0xad8d('0xa'));var querystring=require('querystring');var Papa=require(_0xad8d('0x11'));var Redis=require('ioredis');var authService=require(_0xad8d('0x12'));var qs=require(_0xad8d('0x13'));var as=require(_0xad8d('0x14'));var hardwareService=require(_0xad8d('0x15'));var logger=require(_0xad8d('0x16'))(_0xad8d('0x17'));var utils=require(_0xad8d('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xad8d('0x19'));var db=require(_0xad8d('0x1a'))['db'];function respondWithStatusCode(_0x357399,_0x17d02b){_0x17d02b=_0x17d02b||0xcc;return function(_0x493dbd){if(_0x493dbd){return _0x357399['sendStatus'](_0x17d02b);}return _0x357399['status'](_0x17d02b)[_0xad8d('0x1b')]();};}function respondWithResult(_0x2a66b4,_0x25a137){_0x25a137=_0x25a137||0xc8;return function(_0x293e36){if(_0x293e36){return _0x2a66b4[_0xad8d('0x1c')](_0x25a137)[_0xad8d('0x1d')](_0x293e36);}};}function respondWithFilteredResult(_0x4b99a6,_0xcf4b1f){return function(_0x56789d){if(_0x56789d){var _0x51553d=typeof _0xcf4b1f[_0xad8d('0x1e')]===_0xad8d('0x1f')&&typeof _0xcf4b1f[_0xad8d('0x20')]==='undefined';var _0x46fc95=_0x56789d['count'];var _0x1e38a8=_0x51553d?0x0:_0xcf4b1f['offset'];var _0x136cc6=_0x51553d?_0x56789d['count']:_0xcf4b1f[_0xad8d('0x1e')]+_0xcf4b1f['limit'];var _0x2c6675;if(_0x136cc6>=_0x46fc95){_0x136cc6=_0x46fc95;_0x2c6675=0xc8;}else{_0x2c6675=0xce;}_0x4b99a6['status'](_0x2c6675);return _0x4b99a6['set'](_0xad8d('0x21'),_0x1e38a8+'-'+_0x136cc6+'/'+_0x46fc95)['json'](_0x56789d);}return null;};}function patchUpdates(_0x36b943){return function(_0x4a074d){try{jsonpatch[_0xad8d('0x22')](_0x4a074d,_0x36b943,!![]);}catch(_0x2d2058){return BPromise[_0xad8d('0x23')](_0x2d2058);}return _0x4a074d[_0xad8d('0x24')]();};}function saveUpdates(_0x25f4f1,_0x5f36bd){return function(_0x4e0c24){if(_0x4e0c24){return _0x4e0c24[_0xad8d('0x25')](_0x25f4f1)[_0xad8d('0x26')](function(_0x24a1ea){return _0x24a1ea;});}return null;};}function removeEntity(_0x53a141,_0x4ee6ea){return function(_0x161aea){if(_0x161aea){return _0x161aea['destroy']()[_0xad8d('0x26')](function(){var _0x3bcbf0=_0x161aea['get']({'plain':!![]});var _0x1cf8b1=_0xad8d('0x27');return db[_0xad8d('0x28')][_0xad8d('0x29')]({'where':{'type':_0x1cf8b1,'resourceId':_0x3bcbf0['id']}})[_0xad8d('0x26')](function(){return _0x161aea;});})[_0xad8d('0x26')](function(){_0x53a141[_0xad8d('0x1c')](0xcc)[_0xad8d('0x1b')]();});}};}function handleEntityNotFound(_0xb088c5,_0x3a37fd){return function(_0x1b190e){if(!_0x1b190e){_0xb088c5[_0xad8d('0x2a')](0x194);}return _0x1b190e;};}function handleError(_0x25edc8,_0x5cc014){_0x5cc014=_0x5cc014||0x1f4;return function(_0x11a6f8){logger[_0xad8d('0x2b')](_0x11a6f8[_0xad8d('0x2c')]);if(_0x11a6f8['name']){delete _0x11a6f8[_0xad8d('0x2d')];}_0x25edc8['status'](_0x5cc014)[_0xad8d('0x2e')](_0x11a6f8);};}exports[_0xad8d('0x2f')]=function(_0x1074ee,_0x49d6fe){var _0x529b52={},_0x16375e={},_0x56a78d={'count':0x0,'rows':[]};var _0x54f5aa=_[_0xad8d('0x30')](db[_0xad8d('0x31')]['rawAttributes'],function(_0x3e178b){return{'name':_0x3e178b[_0xad8d('0x32')],'type':_0x3e178b[_0xad8d('0x33')][_0xad8d('0x34')]};});_0x16375e[_0xad8d('0x35')]=_['map'](_0x54f5aa,_0xad8d('0x2d'));_0x16375e[_0xad8d('0x36')]=_[_0xad8d('0x37')](_0x1074ee[_0xad8d('0x36')]);_0x16375e['filters']=_[_0xad8d('0x38')](_0x16375e[_0xad8d('0x35')],_0x16375e[_0xad8d('0x36')]);_0x529b52[_0xad8d('0x39')]=_['intersection'](_0x16375e['model'],qs[_0xad8d('0x3a')](_0x1074ee[_0xad8d('0x36')][_0xad8d('0x3a')]));_0x529b52[_0xad8d('0x39')]=_0x529b52[_0xad8d('0x39')][_0xad8d('0x3b')]?_0x529b52[_0xad8d('0x39')]:_0x16375e[_0xad8d('0x35')];if(!_0x1074ee[_0xad8d('0x36')][_0xad8d('0x3c')](_0xad8d('0x3d'))){_0x529b52[_0xad8d('0x20')]=qs[_0xad8d('0x20')](_0x1074ee[_0xad8d('0x36')][_0xad8d('0x20')]);_0x529b52[_0xad8d('0x1e')]=qs[_0xad8d('0x1e')](_0x1074ee[_0xad8d('0x36')][_0xad8d('0x1e')]);}_0x529b52[_0xad8d('0x3e')]=qs[_0xad8d('0x3f')](_0x1074ee[_0xad8d('0x36')][_0xad8d('0x3f')]);_0x529b52[_0xad8d('0x40')]=qs[_0xad8d('0x41')](_[_0xad8d('0x42')](_0x1074ee[_0xad8d('0x36')],_0x16375e[_0xad8d('0x41')]),_0x54f5aa);if(_0x1074ee[_0xad8d('0x36')]['filter']){_0x529b52[_0xad8d('0x40')]=_[_0xad8d('0x43')](_0x529b52[_0xad8d('0x40')],{'$or':_[_0xad8d('0x30')](_0x54f5aa,function(_0x2cc2d5){if(_0x2cc2d5[_0xad8d('0x33')]!==_0xad8d('0x44')){var _0x4fa7ed={};_0x4fa7ed[_0x2cc2d5[_0xad8d('0x2d')]]={'$like':'%'+_0x1074ee[_0xad8d('0x36')][_0xad8d('0x45')]+'%'};return _0x4fa7ed;}})});}_0x529b52=_['merge']({},_0x529b52,_0x1074ee['options']);var _0x45e6ea={'where':_0x529b52[_0xad8d('0x40')]};return db['Sound'][_0xad8d('0x46')](_0x45e6ea)[_0xad8d('0x26')](function(_0x53f3c5){_0x56a78d['count']=_0x53f3c5;if(_0x1074ee[_0xad8d('0x36')][_0xad8d('0x47')]){_0x529b52[_0xad8d('0x48')]=[{'all':!![]}];}return db[_0xad8d('0x31')][_0xad8d('0x49')](_0x529b52);})[_0xad8d('0x26')](function(_0x29e3b0){_0x56a78d['rows']=_0x29e3b0;return _0x56a78d;})['then'](respondWithFilteredResult(_0x49d6fe,_0x529b52))[_0xad8d('0x4a')](handleError(_0x49d6fe,null));};exports[_0xad8d('0x4b')]=function(_0x2b4eab,_0x47801a){var _0x573dac={'raw':!![],'where':{'id':_0x2b4eab[_0xad8d('0x4c')]['id']}},_0x3c2c2f={};_0x3c2c2f[_0xad8d('0x35')]=_[_0xad8d('0x37')](db['Sound'][_0xad8d('0x4d')]);_0x3c2c2f[_0xad8d('0x36')]=_['keys'](_0x2b4eab[_0xad8d('0x36')]);_0x3c2c2f[_0xad8d('0x41')]=_['intersection'](_0x3c2c2f[_0xad8d('0x35')],_0x3c2c2f['query']);_0x573dac[_0xad8d('0x39')]=_[_0xad8d('0x38')](_0x3c2c2f[_0xad8d('0x35')],qs['fields'](_0x2b4eab[_0xad8d('0x36')][_0xad8d('0x3a')]));_0x573dac[_0xad8d('0x39')]=_0x573dac[_0xad8d('0x39')][_0xad8d('0x3b')]?_0x573dac[_0xad8d('0x39')]:_0x3c2c2f[_0xad8d('0x35')];if(_0x2b4eab[_0xad8d('0x36')][_0xad8d('0x47')]){_0x573dac[_0xad8d('0x48')]=[{'all':!![]}];}_0x573dac=_[_0xad8d('0x43')]({},_0x573dac,_0x2b4eab[_0xad8d('0x4e')]);return db['Sound']['find'](_0x573dac)[_0xad8d('0x26')](handleEntityNotFound(_0x47801a,null))[_0xad8d('0x26')](respondWithResult(_0x47801a,null))[_0xad8d('0x4a')](handleError(_0x47801a,null));};exports['download']=function(_0x2ff2d9,_0x290dd9,_0x54494d){return db[_0xad8d('0x31')][_0xad8d('0x4f')]({'where':{'id':_0x2ff2d9[_0xad8d('0x4c')]['id']},'attributes':[_0xad8d('0x2d'),'save_name',_0xad8d('0x50')],'raw':!![]})[_0xad8d('0x26')](handleEntityNotFound(_0x290dd9,null))[_0xad8d('0x26')](function(_0x289e15){if(_0x289e15){if(!fs[_0xad8d('0x51')](path['join'](config[_0xad8d('0x52')],'server/files/sounds/converted',_0x289e15[_0xad8d('0x53')]+'.'+_0x289e15[_0xad8d('0x50')]))){throw new db[(_0xad8d('0x54'))][(_0xad8d('0x55'))](_0xad8d('0x56'));}return _0x290dd9[_0xad8d('0x57')](path[_0xad8d('0x58')](config['root'],_0xad8d('0x59'),util[_0xad8d('0x5a')](_0xad8d('0x5b'),_0x289e15['save_name'],_0x289e15['converted_format'])),util['format'](_0xad8d('0x5b'),_0x289e15[_0xad8d('0x2d')],_0x289e15[_0xad8d('0x50')]));}return null;})['catch'](handleError(_0x290dd9,null));};exports[_0xad8d('0x5c')]=function(_0x164bd4,_0x56cc3b,_0xe82762){var _0x580a62={'name':path[_0xad8d('0x5d')](_0x164bd4[_0xad8d('0x5e')][_0xad8d('0x5f')],path[_0xad8d('0x60')](_0x164bd4['file'][_0xad8d('0x5f')])),'save_name':path['basename'](_0x164bd4[_0xad8d('0x5e')][_0xad8d('0x61')],path[_0xad8d('0x60')](_0x164bd4[_0xad8d('0x5e')][_0xad8d('0x61')])),'original_format':path[_0xad8d('0x60')](_0x164bd4[_0xad8d('0x5e')]['originalname'])[_0xad8d('0x62')](0x1),'converted_format':_0xad8d('0x63')};var _0xefdd6b=path[_0xad8d('0x58')](config[_0xad8d('0x52')],_0xad8d('0x64'),_0x164bd4[_0xad8d('0x5e')][_0xad8d('0x61')]);var _0x1fb99c=path[_0xad8d('0x58')](config[_0xad8d('0x52')],_0xad8d('0x59'),util[_0xad8d('0x5a')](_0xad8d('0x5b'),path[_0xad8d('0x5d')](_0x164bd4[_0xad8d('0x5e')][_0xad8d('0x61')],path[_0xad8d('0x60')](_0x164bd4['file'][_0xad8d('0x61')])),_0x580a62[_0xad8d('0x50')]));logger[_0xad8d('0x65')](_0xad8d('0x66'),_0xefdd6b);logger[_0xad8d('0x65')]('Sound\x20upload\x20destination:\x20%s',_0x1fb99c);try{fs[_0xad8d('0x67')](_0xefdd6b,parseInt(_0xad8d('0x68'),0x8));var _0x406d87=sox[_0xad8d('0x69')](_0xefdd6b,_0x1fb99c,{'sampleRate':0x1f40,'format':_0xad8d('0x63'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x406d87['on'](_0xad8d('0x2b'),function(_0x530463){fs['unlinkSync'](_0xefdd6b);_0x56cc3b['status'](0x1f4)[_0xad8d('0x2e')](_0x530463);});_0x406d87['on']('src',function(_0xd5fead){_0x580a62[_0xad8d('0x6a')]=isNaN(_0xd5fead[_0xad8d('0x6b')])?null:_0xd5fead[_0xad8d('0x6b')]*0x3e8;_0x580a62['original_sampleCount']=isNaN(_0xd5fead[_0xad8d('0x6c')])?null:_0xd5fead[_0xad8d('0x6c')];_0x580a62['original_channelCount']=isNaN(_0xd5fead['channelCount'])?null:_0xd5fead['channelCount'];_0x580a62['original_bitRate']=isNaN(_0xd5fead[_0xad8d('0x6d')])?null:_0xd5fead[_0xad8d('0x6d')];_0x580a62[_0xad8d('0x6e')]=isNaN(_0xd5fead[_0xad8d('0x6f')])?null:_0xd5fead[_0xad8d('0x6f')];});_0x406d87['on']('dest',function(_0x1820b3){_0x580a62['converted_duration']=isNaN(_0x1820b3['duration'])?null:_0x1820b3['duration']*0x3e8;_0x580a62[_0xad8d('0x70')]=isNaN(_0x1820b3[_0xad8d('0x6c')])?null:_0x1820b3['sampleCount'];_0x580a62['converted_channelCount']=isNaN(_0x1820b3['channelCount'])?null:_0x1820b3['channelCount'];_0x580a62['converted_bitRate']=isNaN(_0x1820b3[_0xad8d('0x6d')])?null:_0x1820b3[_0xad8d('0x6d')];_0x580a62[_0xad8d('0x71')]=isNaN(_0x1820b3[_0xad8d('0x6f')])?null:_0x1820b3[_0xad8d('0x6f')];});_0x406d87['on'](_0xad8d('0x1b'),function(){fs[_0xad8d('0x67')](_0x1fb99c,parseInt('0777',0x8));return db['Sound'][_0xad8d('0x5c')](_0x580a62)['then'](function(_0x15de8e){var _0x18a392={'role':_0x164bd4['body']['role'],'userProfileId':_0x164bd4[_0xad8d('0x72')]['userProfileId']};if(!_0x18a392)throw new Error(_0xad8d('0x73'));if(_0x18a392[_0xad8d('0x74')]==='user'){var _0x6127ca=_0x15de8e['get']({'plain':!![]});return db[_0xad8d('0x75')][_0xad8d('0x4f')]({'where':{'name':_0xad8d('0x27'),'userProfileId':_0x18a392[_0xad8d('0x76')]},'raw':!![]})[_0xad8d('0x26')](function(_0x5308ff){if(_0x5308ff&&_0x5308ff[_0xad8d('0x77')]===0x0){return db[_0xad8d('0x28')][_0xad8d('0x5c')]({'name':_0x6127ca[_0xad8d('0x2d')],'resourceId':_0x6127ca['id'],'type':_0x5308ff['name'],'sectionId':_0x5308ff['id']},{})[_0xad8d('0x26')](function(){return _0x15de8e;});}else{return _0x15de8e;}})[_0xad8d('0x4a')](function(_0x905e9c){logger[_0xad8d('0x2b')](_0xad8d('0x78'),_0x905e9c);throw _0x905e9c;});}return _0x15de8e;})[_0xad8d('0x26')](respondWithResult(_0x56cc3b,null))[_0xad8d('0x4a')](handleError(_0x56cc3b,null));});_0x406d87['start']();}catch(_0x5efa02){_0x56cc3b[_0xad8d('0x1c')](0x1f4)['send'](_0x5efa02);}};exports['update']=function(_0x742524,_0x900c4c,_0xf11781){return db['Sound'][_0xad8d('0x4f')]({'where':{'id':_0x742524[_0xad8d('0x4c')]['id']}})[_0xad8d('0x26')](handleEntityNotFound(_0x900c4c,null))[_0xad8d('0x26')](saveUpdates(_[_0xad8d('0x42')](_0x742524['body'],[_0xad8d('0x2d'),_0xad8d('0x79')]),null))['then'](respondWithResult(_0x900c4c,null))[_0xad8d('0x4a')](handleError(_0x900c4c,null));};exports[_0xad8d('0x7a')]=function(_0x2784df,_0xb6c6f5,_0x1ee452){return db[_0xad8d('0x31')][_0xad8d('0x4f')]({'where':{'id':_0x2784df[_0xad8d('0x4c')]['id']}})['then'](function(_0x2d7972){if(_0x2d7972){return _0x2d7972[_0xad8d('0x29')]();}})[_0xad8d('0x26')](function(_0x3ced7f){var _0x3b0aa2=path[_0xad8d('0x58')](config[_0xad8d('0x52')],_0xad8d('0x64'),util[_0xad8d('0x5a')]('%s.%s',_0x3ced7f['save_name'],_0x3ced7f[_0xad8d('0x7b')]));var _0x13f3ff=path[_0xad8d('0x58')](config[_0xad8d('0x52')],_0xad8d('0x59'),util[_0xad8d('0x5a')](_0xad8d('0x5b'),_0x3ced7f[_0xad8d('0x53')],_0x3ced7f[_0xad8d('0x50')]));fs['unlinkSync'](_0x3b0aa2);fs[_0xad8d('0x7c')](_0x13f3ff);return _0x3ced7f;})['then'](function(_0x4eb42f){if(_0x4eb42f){return _0xb6c6f5[_0xad8d('0x1c')](0xcc)[_0xad8d('0x1b')]();}})[_0xad8d('0x26')](handleEntityNotFound(_0xb6c6f5,null))[_0xad8d('0x4a')](handleError(_0xb6c6f5,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 4090ff9..0773c01 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 _0x9851=['lodash','util','api','bluebird','request-promise','rimraf','./sound.attributes','exports','Sound','tools_sounds'];(function(_0x26e634,_0x542240){var _0x54e48f=function(_0x2fc2cc){while(--_0x2fc2cc){_0x26e634['push'](_0x26e634['shift']());}};_0x54e48f(++_0x542240);}(_0x9851,0x10e));var _0x1985=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9851[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1985('0x0'));var util=require(_0x1985('0x1'));var logger=require('../../config/logger')(_0x1985('0x2'));var moment=require('moment');var BPromise=require(_0x1985('0x3'));var rp=require(_0x1985('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1985('0x5'));var config=require('../../config/environment');var attributes=require(_0x1985('0x6'));module[_0x1985('0x7')]=function(_0x1f35ce,_0x4ce47b){return _0x1f35ce['define'](_0x1985('0x8'),attributes,{'tableName':_0x1985('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ac1=['../../config/environment','./sound.attributes','exports','define','tools_sounds','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x309bc4,_0x7780f2){var _0x32c905=function(_0x206b2d){while(--_0x206b2d){_0x309bc4['push'](_0x309bc4['shift']());}};_0x32c905(++_0x7780f2);}(_0x2ac1,0xf5));var _0x12ac=function(_0x599d22,_0x35a833){_0x599d22=_0x599d22-0x0;var _0x476730=_0x2ac1[_0x599d22];return _0x476730;};'use strict';var _=require(_0x12ac('0x0'));var util=require(_0x12ac('0x1'));var logger=require('../../config/logger')(_0x12ac('0x2'));var moment=require(_0x12ac('0x3'));var BPromise=require(_0x12ac('0x4'));var rp=require(_0x12ac('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x12ac('0x6'));var config=require(_0x12ac('0x7'));var attributes=require(_0x12ac('0x8'));module[_0x12ac('0x9')]=function(_0x1821f9,_0x3f5fcc){return _0x1821f9[_0x12ac('0xa')]('Sound',attributes,{'tableName':_0x12ac('0xb'),'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 54de9bc..392a99f 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 _0xc6f8=['client','then','info','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','Sound,\x20%s,\x20%s','message','catch','Sound','find','options','raw','attributes','include','map','model','ShowSound','lodash','util','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise'];(function(_0x52d065,_0x31d24){var _0x49f7bc=function(_0x2f0966){while(--_0x2f0966){_0x52d065['push'](_0x52d065['shift']());}};_0x49f7bc(++_0x31d24);}(_0xc6f8,0x181));var _0x8c6f=function(_0x1417e3,_0x25ff15){_0x1417e3=_0x1417e3-0x0;var _0xf3b83f=_0xc6f8[_0x1417e3];return _0xf3b83f;};'use strict';var _=require(_0x8c6f('0x0'));var util=require(_0x8c6f('0x1'));var moment=require('moment');var BPromise=require(_0x8c6f('0x2'));var rs=require(_0x8c6f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8c6f('0x4'))('rpc');var config=require(_0x8c6f('0x5'));var jayson=require(_0x8c6f('0x6'));var client=jayson[_0x8c6f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x303507,_0xb01b3b,_0x213109){return new BPromise(function(_0x49fae6,_0x2c6ec3){return client['request'](_0x303507,_0x213109)[_0x8c6f('0x8')](function(_0x345380){logger[_0x8c6f('0x9')]('Sound,\x20%s,\x20%s',_0xb01b3b,_0x8c6f('0xa'));logger[_0x8c6f('0xb')](_0x8c6f('0xc'),_0xb01b3b,'request\x20sent',JSON[_0x8c6f('0xd')](_0x345380));if(_0x345380[_0x8c6f('0xe')]){if(_0x345380[_0x8c6f('0xe')][_0x8c6f('0xf')]===0x1f4){logger[_0x8c6f('0xe')](_0x8c6f('0x10'),_0xb01b3b,_0x345380[_0x8c6f('0xe')][_0x8c6f('0x11')]);return _0x2c6ec3(_0x345380[_0x8c6f('0xe')][_0x8c6f('0x11')]);}logger['error'](_0x8c6f('0x10'),_0xb01b3b,_0x345380[_0x8c6f('0xe')]['message']);return _0x49fae6(_0x345380[_0x8c6f('0xe')]['message']);}else{logger[_0x8c6f('0x9')]('Sound,\x20%s,\x20%s',_0xb01b3b,_0x8c6f('0xa'));_0x49fae6(_0x345380['result'][_0x8c6f('0x11')]);}})[_0x8c6f('0x12')](function(_0x5889fc){logger[_0x8c6f('0xe')]('Sound,\x20%s,\x20%s',_0xb01b3b,_0x5889fc);_0x2c6ec3(_0x5889fc);});});}exports['ShowSound']=function(_0x3ff58b){var _0x26f5e9=this;return new Promise(function(_0x239af8,_0x131bc7){return db[_0x8c6f('0x13')][_0x8c6f('0x14')]({'raw':_0x3ff58b[_0x8c6f('0x15')]?_0x3ff58b[_0x8c6f('0x15')][_0x8c6f('0x16')]===undefined?!![]:![]:!![],'where':_0x3ff58b[_0x8c6f('0x15')]?_0x3ff58b[_0x8c6f('0x15')]['where']||null:null,'attributes':_0x3ff58b[_0x8c6f('0x15')]?_0x3ff58b[_0x8c6f('0x15')][_0x8c6f('0x17')]||null:null,'include':_0x3ff58b[_0x8c6f('0x15')]?_0x3ff58b[_0x8c6f('0x15')][_0x8c6f('0x18')]?_[_0x8c6f('0x19')](_0x3ff58b[_0x8c6f('0x15')][_0x8c6f('0x18')],function(_0x582958){return{'model':db[_0x582958[_0x8c6f('0x1a')]],'as':_0x582958['as'],'attributes':_0x582958[_0x8c6f('0x17')],'include':_0x582958[_0x8c6f('0x18')]?_[_0x8c6f('0x19')](_0x582958['include'],function(_0x2ca8ad){return{'model':db[_0x2ca8ad[_0x8c6f('0x1a')]],'as':_0x2ca8ad['as'],'attributes':_0x2ca8ad[_0x8c6f('0x17')],'include':_0x2ca8ad[_0x8c6f('0x18')]?_[_0x8c6f('0x19')](_0x2ca8ad[_0x8c6f('0x18')],function(_0x3dc3cc){return{'model':db[_0x3dc3cc[_0x8c6f('0x1a')]],'as':_0x3dc3cc['as'],'attributes':_0x3dc3cc[_0x8c6f('0x17')]};}):[]};}):[]};}):[]:[]})[_0x8c6f('0x8')](function(_0x33bd3f){logger[_0x8c6f('0x9')]('ShowSound',_0x3ff58b);logger[_0x8c6f('0xb')](_0x8c6f('0x1b'),_0x3ff58b,JSON[_0x8c6f('0xd')](_0x33bd3f));_0x239af8(_0x33bd3f);})[_0x8c6f('0x12')](function(_0x48cd00){logger[_0x8c6f('0xe')](_0x8c6f('0x1b'),_0x48cd00['message'],_0x3ff58b);_0x131bc7(_0x26f5e9[_0x8c6f('0xe')](0x1f4,_0x48cd00[_0x8c6f('0x11')]));});});}; \ No newline at end of file +var _0x94a0=['Sound,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','ShowSound','Sound','find','options','raw','include','map','model','attributes','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x83221c,_0x3975ef){var _0x2fa1fc=function(_0x26d691){while(--_0x26d691){_0x83221c['push'](_0x83221c['shift']());}};_0x2fa1fc(++_0x3975ef);}(_0x94a0,0x88));var _0x094a=function(_0x1833cd,_0x369128){_0x1833cd=_0x1833cd-0x0;var _0x4360ac=_0x94a0[_0x1833cd];return _0x4360ac;};'use strict';var _=require(_0x094a('0x0'));var util=require(_0x094a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x094a('0x2'));var fs=require('fs');var Redis=require(_0x094a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x094a('0x4'))(_0x094a('0x5'));var config=require(_0x094a('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x094a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x454b5b,_0x1cc2ab,_0x2bf724){return new BPromise(function(_0x27f349,_0x4a6aea){return client[_0x094a('0x8')](_0x454b5b,_0x2bf724)[_0x094a('0x9')](function(_0x5d0093){logger[_0x094a('0xa')](_0x094a('0xb'),_0x1cc2ab,_0x094a('0xc'));logger[_0x094a('0xd')](_0x094a('0xe'),_0x1cc2ab,_0x094a('0xc'),JSON[_0x094a('0xf')](_0x5d0093));if(_0x5d0093['error']){if(_0x5d0093['error'][_0x094a('0x10')]===0x1f4){logger[_0x094a('0x11')](_0x094a('0xb'),_0x1cc2ab,_0x5d0093['error'][_0x094a('0x12')]);return _0x4a6aea(_0x5d0093[_0x094a('0x11')][_0x094a('0x12')]);}logger['error'](_0x094a('0xb'),_0x1cc2ab,_0x5d0093[_0x094a('0x11')][_0x094a('0x12')]);return _0x27f349(_0x5d0093['error'][_0x094a('0x12')]);}else{logger[_0x094a('0xa')](_0x094a('0xb'),_0x1cc2ab,_0x094a('0xc'));_0x27f349(_0x5d0093[_0x094a('0x13')][_0x094a('0x12')]);}})[_0x094a('0x14')](function(_0x155d15){logger['error'](_0x094a('0xb'),_0x1cc2ab,_0x155d15);_0x4a6aea(_0x155d15);});});}exports[_0x094a('0x15')]=function(_0x2806d7){var _0x84839f=this;return new Promise(function(_0x78666,_0x227c26){return db[_0x094a('0x16')][_0x094a('0x17')]({'raw':_0x2806d7[_0x094a('0x18')]?_0x2806d7[_0x094a('0x18')][_0x094a('0x19')]===undefined?!![]:![]:!![],'where':_0x2806d7[_0x094a('0x18')]?_0x2806d7[_0x094a('0x18')]['where']||null:null,'attributes':_0x2806d7[_0x094a('0x18')]?_0x2806d7[_0x094a('0x18')]['attributes']||null:null,'include':_0x2806d7[_0x094a('0x18')]?_0x2806d7[_0x094a('0x18')][_0x094a('0x1a')]?_[_0x094a('0x1b')](_0x2806d7[_0x094a('0x18')][_0x094a('0x1a')],function(_0x2599bf){return{'model':db[_0x2599bf[_0x094a('0x1c')]],'as':_0x2599bf['as'],'attributes':_0x2599bf[_0x094a('0x1d')],'include':_0x2599bf['include']?_['map'](_0x2599bf['include'],function(_0xadb286){return{'model':db[_0xadb286['model']],'as':_0xadb286['as'],'attributes':_0xadb286[_0x094a('0x1d')],'include':_0xadb286[_0x094a('0x1a')]?_[_0x094a('0x1b')](_0xadb286[_0x094a('0x1a')],function(_0x546098){return{'model':db[_0x546098[_0x094a('0x1c')]],'as':_0x546098['as'],'attributes':_0x546098['attributes']};}):[]};}):[]};}):[]:[]})[_0x094a('0x9')](function(_0x381710){logger[_0x094a('0xa')]('ShowSound',_0x2806d7);logger[_0x094a('0xd')]('ShowSound',_0x2806d7,JSON['stringify'](_0x381710));_0x78666(_0x381710);})[_0x094a('0x14')](function(_0x2e7d50){logger[_0x094a('0x11')](_0x094a('0x15'),_0x2e7d50[_0x094a('0x12')],_0x2806d7);_0x227c26(_0x84839f['error'](0x1f4,_0x2e7d50[_0x094a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index fb05951..4ec3d8c 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x864853,_0x1b7287){var _0x2d1509=function(_0x3c8ed2){while(--_0x3c8ed2){_0x864853['push'](_0x864853['shift']());}};_0x2d1509(++_0x1b7287);}(_0x2032,0xd9));var _0x2203=function(_0x4e5f0b,_0x42de0f){_0x4e5f0b=_0x4e5f0b-0x0;var _0x424d13=_0x2032[_0x4e5f0b];return _0x424d13;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2203('0xe')]('/:id',auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router[_0x2203('0x10')]('/:id',auth[_0x2203('0x9')](),controller['destroy']);module[_0x2203('0x11')]=router; \ No newline at end of file +var _0x14a0=['get','isAuthenticated','/:id','show','create','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./squareMessage.controller'];(function(_0x2d5d3a,_0x4a6338){var _0x19ecab=function(_0x5cb4af){while(--_0x5cb4af){_0x2d5d3a['push'](_0x2d5d3a['shift']());}};_0x19ecab(++_0x4a6338);}(_0x14a0,0x8e));var _0x014a=function(_0x13216b,_0x3a99b1){_0x13216b=_0x13216b-0x0;var _0xa27b54=_0x14a0[_0x13216b];return _0xa27b54;};'use strict';var multer=require('multer');var util=require(_0x014a('0x0'));var path=require(_0x014a('0x1'));var timeout=require(_0x014a('0x2'));var express=require(_0x014a('0x3'));var router=express[_0x014a('0x4')]();var fs_extra=require(_0x014a('0x5'));var auth=require(_0x014a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x014a('0x7'));router[_0x014a('0x8')]('/',auth[_0x014a('0x9')](),controller['index']);router['get'](_0x014a('0xa'),auth[_0x014a('0x9')](),controller[_0x014a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x014a('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x014a('0xd')]('/:id',auth[_0x014a('0x9')](),controller[_0x014a('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 27a7fdc..d500f8f 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 _0x92a1=['out','sequelize','exports','STRING','TEXT','ENUM'];(function(_0x43885b,_0x451a68){var _0x7e3cc6=function(_0x466f71){while(--_0x466f71){_0x43885b['push'](_0x43885b['shift']());}};_0x7e3cc6(++_0x451a68);}(_0x92a1,0x193));var _0x192a=function(_0x33bad8,_0xa77a59){_0x33bad8=_0x33bad8-0x0;var _0xed1658=_0x92a1[_0x33bad8];return _0xed1658;};'use strict';var Sequelize=require(_0x192a('0x0'));module[_0x192a('0x1')]={'uniqueid':{'type':Sequelize[_0x192a('0x2')]},'body':{'type':Sequelize[_0x192a('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x192a('0x4')]('in',_0x192a('0x5')),'defaultValue':_0x192a('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x192a('0x2')]},'providerResponse':{'type':Sequelize[_0x192a('0x3')]}}; \ No newline at end of file +var _0x95b9=['TEXT','ENUM','out','STRING','sequelize','exports'];(function(_0x262a9b,_0x4a21a1){var _0x391811=function(_0x36b5f5){while(--_0x36b5f5){_0x262a9b['push'](_0x262a9b['shift']());}};_0x391811(++_0x4a21a1);}(_0x95b9,0x10c));var _0x995b=function(_0x5db2bb,_0x29d7b2){_0x5db2bb=_0x5db2bb-0x0;var _0x55a881=_0x95b9[_0x5db2bb];return _0x55a881;};'use strict';var Sequelize=require(_0x995b('0x0'));module[_0x995b('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x995b('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x995b('0x3')]('in',_0x995b('0x4')),'defaultValue':_0x995b('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0x995b('0x5')]},'providerResponse':{'type':Sequelize[_0x995b('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 5471bee..187e68a 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 _0xb725=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','SquareMessage','rawAttributes','fieldName','key','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','include','findAll','rows','catch','show','keys','length','includeAll','find','create','body','params','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb725,0x86));var _0x5b72=function(_0x47a832,_0x40699e){_0x47a832=_0x47a832-0x0;var _0x17069f=_0xb725[_0x47a832];return _0x17069f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5b72('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5b72('0x1'));var rp=require(_0x5b72('0x2'));var moment=require(_0x5b72('0x3'));var BPromise=require(_0x5b72('0x4'));var Mustache=require(_0x5b72('0x5'));var util=require(_0x5b72('0x6'));var path=require(_0x5b72('0x7'));var sox=require(_0x5b72('0x8'));var csv=require(_0x5b72('0x9'));var ejs=require(_0x5b72('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5b72('0xb'));var squel=require(_0x5b72('0xc'));var crypto=require(_0x5b72('0xd'));var jsforce=require(_0x5b72('0xe'));var deskjs=require(_0x5b72('0xf'));var toCsv=require(_0x5b72('0x9'));var querystring=require(_0x5b72('0x10'));var Papa=require('papaparse');var Redis=require(_0x5b72('0x11'));var authService=require(_0x5b72('0x12'));var qs=require(_0x5b72('0x13'));var as=require(_0x5b72('0x14'));var hardwareService=require(_0x5b72('0x15'));var logger=require(_0x5b72('0x16'))(_0x5b72('0x17'));var utils=require(_0x5b72('0x18'));var config=require(_0x5b72('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4099eb,_0x4c3a74){_0x4c3a74=_0x4c3a74||0xcc;return function(_0xab125c){if(_0xab125c){return _0x4099eb[_0x5b72('0x1a')](_0x4c3a74);}return _0x4099eb[_0x5b72('0x1b')](_0x4c3a74)[_0x5b72('0x1c')]();};}function respondWithResult(_0x2933b8,_0x17af73){_0x17af73=_0x17af73||0xc8;return function(_0x5f5614){if(_0x5f5614){return _0x2933b8[_0x5b72('0x1b')](_0x17af73)[_0x5b72('0x1d')](_0x5f5614);}};}function respondWithFilteredResult(_0x2d2bb1,_0x88362b){return function(_0x353fb8){if(_0x353fb8){var _0x1422a8=typeof _0x88362b[_0x5b72('0x1e')]===_0x5b72('0x1f')&&typeof _0x88362b[_0x5b72('0x20')]===_0x5b72('0x1f');var _0x49f5f1=_0x353fb8['count'];var _0x56c23f=_0x1422a8?0x0:_0x88362b[_0x5b72('0x1e')];var _0x4b3455=_0x1422a8?_0x353fb8[_0x5b72('0x21')]:_0x88362b[_0x5b72('0x1e')]+_0x88362b[_0x5b72('0x20')];var _0x49d951;if(_0x4b3455>=_0x49f5f1){_0x4b3455=_0x49f5f1;_0x49d951=0xc8;}else{_0x49d951=0xce;}_0x2d2bb1[_0x5b72('0x1b')](_0x49d951);return _0x2d2bb1[_0x5b72('0x22')](_0x5b72('0x23'),_0x56c23f+'-'+_0x4b3455+'/'+_0x49f5f1)[_0x5b72('0x1d')](_0x353fb8);}return null;};}function patchUpdates(_0x47acb5){return function(_0x51ae3d){try{jsonpatch[_0x5b72('0x24')](_0x51ae3d,_0x47acb5,!![]);}catch(_0x527121){return BPromise['reject'](_0x527121);}return _0x51ae3d[_0x5b72('0x25')]();};}function saveUpdates(_0x41364d,_0x2e08f9){return function(_0x519d4a){if(_0x519d4a){return _0x519d4a[_0x5b72('0x26')](_0x41364d)[_0x5b72('0x27')](function(_0x21b12a){return _0x21b12a;});}return null;};}function removeEntity(_0x3fa898,_0x10ed20){return function(_0x553c76){if(_0x553c76){return _0x553c76[_0x5b72('0x28')]()[_0x5b72('0x27')](function(){_0x3fa898['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x52fc1d,_0x46d9c6){return function(_0x60e802){if(!_0x60e802){_0x52fc1d['sendStatus'](0x194);}return _0x60e802;};}function handleError(_0x52f385,_0x4178da){_0x4178da=_0x4178da||0x1f4;return function(_0x1ac7a7){logger[_0x5b72('0x29')](_0x1ac7a7['stack']);if(_0x1ac7a7[_0x5b72('0x2a')]){delete _0x1ac7a7[_0x5b72('0x2a')];}_0x52f385[_0x5b72('0x1b')](_0x4178da)[_0x5b72('0x2b')](_0x1ac7a7);};}exports[_0x5b72('0x2c')]=function(_0x4886be,_0x204d26){var _0x3b6848={},_0x2919a4={},_0x2e500d={'count':0x0,'rows':[]};var _0x549fdb=_[_0x5b72('0x2d')](db[_0x5b72('0x2e')][_0x5b72('0x2f')],function(_0x4a2b3e){return{'name':_0x4a2b3e[_0x5b72('0x30')],'type':_0x4a2b3e['type'][_0x5b72('0x31')]};});_0x2919a4['model']=_[_0x5b72('0x2d')](_0x549fdb,_0x5b72('0x2a'));_0x2919a4['query']=_['keys'](_0x4886be[_0x5b72('0x32')]);_0x2919a4[_0x5b72('0x33')]=_['intersection'](_0x2919a4[_0x5b72('0x34')],_0x2919a4['query']);_0x3b6848[_0x5b72('0x35')]=_[_0x5b72('0x36')](_0x2919a4[_0x5b72('0x34')],qs[_0x5b72('0x37')](_0x4886be['query'][_0x5b72('0x37')]));_0x3b6848['attributes']=_0x3b6848[_0x5b72('0x35')]['length']?_0x3b6848['attributes']:_0x2919a4['model'];if(!_0x4886be[_0x5b72('0x32')][_0x5b72('0x38')](_0x5b72('0x39'))){_0x3b6848[_0x5b72('0x20')]=qs['limit'](_0x4886be[_0x5b72('0x32')][_0x5b72('0x20')]);_0x3b6848['offset']=qs['offset'](_0x4886be[_0x5b72('0x32')]['offset']);}_0x3b6848[_0x5b72('0x3a')]=qs[_0x5b72('0x3b')](_0x4886be[_0x5b72('0x32')][_0x5b72('0x3b')]);_0x3b6848[_0x5b72('0x3c')]=qs['filters'](_[_0x5b72('0x3d')](_0x4886be[_0x5b72('0x32')],_0x2919a4['filters']),_0x549fdb);if(_0x4886be[_0x5b72('0x32')][_0x5b72('0x3e')]){_0x3b6848['where']=_['merge'](_0x3b6848[_0x5b72('0x3c')],{'$or':_['map'](_0x549fdb,function(_0x61d906){if(_0x61d906['type']!=='VIRTUAL'){var _0x3ea783={};_0x3ea783[_0x61d906[_0x5b72('0x2a')]]={'$like':'%'+_0x4886be[_0x5b72('0x32')][_0x5b72('0x3e')]+'%'};return _0x3ea783;}})});}_0x3b6848=_['merge']({},_0x3b6848,_0x4886be[_0x5b72('0x3f')]);var _0x5b7c7a={'where':_0x3b6848[_0x5b72('0x3c')]};return db[_0x5b72('0x2e')][_0x5b72('0x21')](_0x5b7c7a)[_0x5b72('0x27')](function(_0x3f074d){_0x2e500d[_0x5b72('0x21')]=_0x3f074d;if(_0x4886be['query']['includeAll']){_0x3b6848[_0x5b72('0x40')]=[{'all':!![]}];}return db['SquareMessage'][_0x5b72('0x41')](_0x3b6848);})[_0x5b72('0x27')](function(_0x1c62cb){_0x2e500d[_0x5b72('0x42')]=_0x1c62cb;return _0x2e500d;})[_0x5b72('0x27')](respondWithFilteredResult(_0x204d26,_0x3b6848))[_0x5b72('0x43')](handleError(_0x204d26,null));};exports[_0x5b72('0x44')]=function(_0x597ae3,_0x54217e){var _0x31d901={'raw':!![],'where':{'id':_0x597ae3['params']['id']}},_0x1de9f1={};_0x1de9f1[_0x5b72('0x34')]=_[_0x5b72('0x45')](db[_0x5b72('0x2e')]['rawAttributes']);_0x1de9f1[_0x5b72('0x32')]=_[_0x5b72('0x45')](_0x597ae3[_0x5b72('0x32')]);_0x1de9f1[_0x5b72('0x33')]=_['intersection'](_0x1de9f1[_0x5b72('0x34')],_0x1de9f1[_0x5b72('0x32')]);_0x31d901['attributes']=_[_0x5b72('0x36')](_0x1de9f1[_0x5b72('0x34')],qs[_0x5b72('0x37')](_0x597ae3[_0x5b72('0x32')][_0x5b72('0x37')]));_0x31d901['attributes']=_0x31d901[_0x5b72('0x35')][_0x5b72('0x46')]?_0x31d901[_0x5b72('0x35')]:_0x1de9f1[_0x5b72('0x34')];if(_0x597ae3['query'][_0x5b72('0x47')]){_0x31d901[_0x5b72('0x40')]=[{'all':!![]}];}_0x31d901=_['merge']({},_0x31d901,_0x597ae3[_0x5b72('0x3f')]);return db[_0x5b72('0x2e')][_0x5b72('0x48')](_0x31d901)[_0x5b72('0x27')](handleEntityNotFound(_0x54217e,null))['then'](respondWithResult(_0x54217e,null))[_0x5b72('0x43')](handleError(_0x54217e,null));};exports[_0x5b72('0x49')]=function(_0x392c02,_0xfb9b57){return db['SquareMessage'][_0x5b72('0x49')](_0x392c02['body'],{})['then'](respondWithResult(_0xfb9b57,0xc9))[_0x5b72('0x43')](handleError(_0xfb9b57,null));};exports[_0x5b72('0x26')]=function(_0x3dc39b,_0x1fa118){if(_0x3dc39b[_0x5b72('0x4a')]['id']){delete _0x3dc39b['body']['id'];}return db[_0x5b72('0x2e')][_0x5b72('0x48')]({'where':{'id':_0x3dc39b[_0x5b72('0x4b')]['id']}})[_0x5b72('0x27')](handleEntityNotFound(_0x1fa118,null))[_0x5b72('0x27')](saveUpdates(_0x3dc39b['body'],null))[_0x5b72('0x27')](respondWithResult(_0x1fa118,null))['catch'](handleError(_0x1fa118,null));};exports[_0x5b72('0x28')]=function(_0x5051e6,_0x2ad8b5){return db[_0x5b72('0x2e')]['find']({'where':{'id':_0x5051e6[_0x5b72('0x4b')]['id']}})[_0x5b72('0x27')](handleEntityNotFound(_0x2ad8b5,null))['then'](removeEntity(_0x2ad8b5,null))[_0x5b72('0x43')](handleError(_0x2ad8b5,null));}; \ No newline at end of file +var _0x233e=['json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','name','index','SquareMessage','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','nolimit','order','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','find','create','catch','body','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../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'];(function(_0x3c4856,_0x98f049){var _0xba2cac=function(_0x16fedc){while(--_0x16fedc){_0x3c4856['push'](_0x3c4856['shift']());}};_0xba2cac(++_0x98f049);}(_0x233e,0x1dd));var _0xe233=function(_0x26d4c9,_0x20753c){_0x26d4c9=_0x26d4c9-0x0;var _0x42ccfe=_0x233e[_0x26d4c9];return _0x42ccfe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe233('0x0'));var zipdir=require(_0xe233('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe233('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe233('0x3'));var util=require(_0xe233('0x4'));var path=require(_0xe233('0x5'));var sox=require(_0xe233('0x6'));var csv=require(_0xe233('0x7'));var ejs=require(_0xe233('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe233('0x9'));var squel=require(_0xe233('0xa'));var crypto=require(_0xe233('0xb'));var jsforce=require(_0xe233('0xc'));var deskjs=require(_0xe233('0xd'));var toCsv=require(_0xe233('0x7'));var querystring=require(_0xe233('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe233('0xf'));var qs=require(_0xe233('0x10'));var as=require(_0xe233('0x11'));var hardwareService=require(_0xe233('0x12'));var logger=require(_0xe233('0x13'))('api');var utils=require(_0xe233('0x14'));var config=require(_0xe233('0x15'));var licenseUtil=require(_0xe233('0x16'));var db=require(_0xe233('0x17'))['db'];function respondWithStatusCode(_0x2ef424,_0x2bbdb0){_0x2bbdb0=_0x2bbdb0||0xcc;return function(_0x380e94){if(_0x380e94){return _0x2ef424[_0xe233('0x18')](_0x2bbdb0);}return _0x2ef424[_0xe233('0x19')](_0x2bbdb0)[_0xe233('0x1a')]();};}function respondWithResult(_0x423bf8,_0x260e17){_0x260e17=_0x260e17||0xc8;return function(_0x22f469){if(_0x22f469){return _0x423bf8[_0xe233('0x19')](_0x260e17)[_0xe233('0x1b')](_0x22f469);}};}function respondWithFilteredResult(_0x2d0d42,_0x5c09b8){return function(_0x561655){if(_0x561655){var _0x501d93=typeof _0x5c09b8[_0xe233('0x1c')]===_0xe233('0x1d')&&typeof _0x5c09b8[_0xe233('0x1e')]===_0xe233('0x1d');var _0x2b282a=_0x561655[_0xe233('0x1f')];var _0xaf3e6a=_0x501d93?0x0:_0x5c09b8['offset'];var _0x380735=_0x501d93?_0x561655['count']:_0x5c09b8[_0xe233('0x1c')]+_0x5c09b8['limit'];var _0x368e07;if(_0x380735>=_0x2b282a){_0x380735=_0x2b282a;_0x368e07=0xc8;}else{_0x368e07=0xce;}_0x2d0d42['status'](_0x368e07);return _0x2d0d42[_0xe233('0x20')](_0xe233('0x21'),_0xaf3e6a+'-'+_0x380735+'/'+_0x2b282a)[_0xe233('0x1b')](_0x561655);}return null;};}function patchUpdates(_0x4fca92){return function(_0x50cf69){try{jsonpatch[_0xe233('0x22')](_0x50cf69,_0x4fca92,!![]);}catch(_0x3d4f6e){return BPromise['reject'](_0x3d4f6e);}return _0x50cf69[_0xe233('0x23')]();};}function saveUpdates(_0x5e5f72,_0x3ac326){return function(_0x2210fa){if(_0x2210fa){return _0x2210fa['update'](_0x5e5f72)[_0xe233('0x24')](function(_0x18a64f){return _0x18a64f;});}return null;};}function removeEntity(_0x3148e8,_0x125f2d){return function(_0x260b4b){if(_0x260b4b){return _0x260b4b[_0xe233('0x25')]()[_0xe233('0x24')](function(){_0x3148e8[_0xe233('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bfb83,_0x577159){return function(_0x19f81d){if(!_0x19f81d){_0x4bfb83[_0xe233('0x18')](0x194);}return _0x19f81d;};}function handleError(_0x22b5cc,_0x1eeccf){_0x1eeccf=_0x1eeccf||0x1f4;return function(_0x1dee75){logger[_0xe233('0x26')](_0x1dee75['stack']);if(_0x1dee75[_0xe233('0x27')]){delete _0x1dee75[_0xe233('0x27')];}_0x22b5cc[_0xe233('0x19')](_0x1eeccf)['send'](_0x1dee75);};}exports[_0xe233('0x28')]=function(_0x35adcd,_0x4389ec){var _0x6080c3={},_0x1afe0f={},_0x1fc185={'count':0x0,'rows':[]};var _0x296075=_['map'](db[_0xe233('0x29')]['rawAttributes'],function(_0x2a6a81){return{'name':_0x2a6a81[_0xe233('0x2a')],'type':_0x2a6a81[_0xe233('0x2b')][_0xe233('0x2c')]};});_0x1afe0f[_0xe233('0x2d')]=_[_0xe233('0x2e')](_0x296075,_0xe233('0x27'));_0x1afe0f[_0xe233('0x2f')]=_[_0xe233('0x30')](_0x35adcd[_0xe233('0x2f')]);_0x1afe0f['filters']=_[_0xe233('0x31')](_0x1afe0f[_0xe233('0x2d')],_0x1afe0f[_0xe233('0x2f')]);_0x6080c3[_0xe233('0x32')]=_[_0xe233('0x31')](_0x1afe0f[_0xe233('0x2d')],qs[_0xe233('0x33')](_0x35adcd[_0xe233('0x2f')][_0xe233('0x33')]));_0x6080c3[_0xe233('0x32')]=_0x6080c3[_0xe233('0x32')]['length']?_0x6080c3[_0xe233('0x32')]:_0x1afe0f[_0xe233('0x2d')];if(!_0x35adcd[_0xe233('0x2f')]['hasOwnProperty'](_0xe233('0x34'))){_0x6080c3['limit']=qs[_0xe233('0x1e')](_0x35adcd['query']['limit']);_0x6080c3[_0xe233('0x1c')]=qs[_0xe233('0x1c')](_0x35adcd[_0xe233('0x2f')]['offset']);}_0x6080c3[_0xe233('0x35')]=qs['sort'](_0x35adcd[_0xe233('0x2f')]['sort']);_0x6080c3[_0xe233('0x36')]=qs[_0xe233('0x37')](_['pick'](_0x35adcd[_0xe233('0x2f')],_0x1afe0f['filters']),_0x296075);if(_0x35adcd[_0xe233('0x2f')][_0xe233('0x38')]){_0x6080c3[_0xe233('0x36')]=_[_0xe233('0x39')](_0x6080c3[_0xe233('0x36')],{'$or':_[_0xe233('0x2e')](_0x296075,function(_0x4f1259){if(_0x4f1259[_0xe233('0x2b')]!==_0xe233('0x3a')){var _0x314f1f={};_0x314f1f[_0x4f1259['name']]={'$like':'%'+_0x35adcd[_0xe233('0x2f')][_0xe233('0x38')]+'%'};return _0x314f1f;}})});}_0x6080c3=_[_0xe233('0x39')]({},_0x6080c3,_0x35adcd[_0xe233('0x3b')]);var _0x549ae8={'where':_0x6080c3[_0xe233('0x36')]};return db['SquareMessage'][_0xe233('0x1f')](_0x549ae8)[_0xe233('0x24')](function(_0x58fdb0){_0x1fc185[_0xe233('0x1f')]=_0x58fdb0;if(_0x35adcd['query'][_0xe233('0x3c')]){_0x6080c3[_0xe233('0x3d')]=[{'all':!![]}];}return db[_0xe233('0x29')][_0xe233('0x3e')](_0x6080c3);})[_0xe233('0x24')](function(_0xdc0029){_0x1fc185[_0xe233('0x3f')]=_0xdc0029;return _0x1fc185;})[_0xe233('0x24')](respondWithFilteredResult(_0x4389ec,_0x6080c3))['catch'](handleError(_0x4389ec,null));};exports[_0xe233('0x40')]=function(_0x3b0c12,_0x836dd7){var _0x3f5e97={'raw':!![],'where':{'id':_0x3b0c12[_0xe233('0x41')]['id']}},_0x1d3bf0={};_0x1d3bf0[_0xe233('0x2d')]=_[_0xe233('0x30')](db[_0xe233('0x29')][_0xe233('0x42')]);_0x1d3bf0['query']=_['keys'](_0x3b0c12[_0xe233('0x2f')]);_0x1d3bf0[_0xe233('0x37')]=_[_0xe233('0x31')](_0x1d3bf0[_0xe233('0x2d')],_0x1d3bf0['query']);_0x3f5e97[_0xe233('0x32')]=_[_0xe233('0x31')](_0x1d3bf0[_0xe233('0x2d')],qs['fields'](_0x3b0c12[_0xe233('0x2f')][_0xe233('0x33')]));_0x3f5e97[_0xe233('0x32')]=_0x3f5e97[_0xe233('0x32')][_0xe233('0x43')]?_0x3f5e97[_0xe233('0x32')]:_0x1d3bf0[_0xe233('0x2d')];if(_0x3b0c12['query'][_0xe233('0x3c')]){_0x3f5e97[_0xe233('0x3d')]=[{'all':!![]}];}_0x3f5e97=_[_0xe233('0x39')]({},_0x3f5e97,_0x3b0c12['options']);return db['SquareMessage'][_0xe233('0x44')](_0x3f5e97)[_0xe233('0x24')](handleEntityNotFound(_0x836dd7,null))[_0xe233('0x24')](respondWithResult(_0x836dd7,null))['catch'](handleError(_0x836dd7,null));};exports[_0xe233('0x45')]=function(_0x5b89e6,_0x302748){return db['SquareMessage'][_0xe233('0x45')](_0x5b89e6['body'],{})[_0xe233('0x24')](respondWithResult(_0x302748,0xc9))[_0xe233('0x46')](handleError(_0x302748,null));};exports['update']=function(_0x440287,_0xc792c9){if(_0x440287[_0xe233('0x47')]['id']){delete _0x440287['body']['id'];}return db[_0xe233('0x29')][_0xe233('0x44')]({'where':{'id':_0x440287['params']['id']}})[_0xe233('0x24')](handleEntityNotFound(_0xc792c9,null))[_0xe233('0x24')](saveUpdates(_0x440287[_0xe233('0x47')],null))[_0xe233('0x24')](respondWithResult(_0xc792c9,null))[_0xe233('0x46')](handleError(_0xc792c9,null));};exports['destroy']=function(_0x503910,_0x329380){return db[_0xe233('0x29')][_0xe233('0x44')]({'where':{'id':_0x503910['params']['id']}})[_0xe233('0x24')](handleEntityNotFound(_0x329380,null))[_0xe233('0x24')](removeEntity(_0x329380,null))[_0xe233('0x46')](handleError(_0x329380,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 72a0079..97f7ba4 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 _0x205e=['SquareMessage','square_messages','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes'];(function(_0x5dfc2a,_0x1a953f){var _0x3f1a71=function(_0x15916){while(--_0x15916){_0x5dfc2a['push'](_0x5dfc2a['shift']());}};_0x3f1a71(++_0x1a953f);}(_0x205e,0x1d6));var _0xe205=function(_0x487c27,_0x5ea184){_0x487c27=_0x487c27-0x0;var _0x22a2ad=_0x205e[_0x487c27];return _0x22a2ad;};'use strict';var _=require(_0xe205('0x0'));var util=require(_0xe205('0x1'));var logger=require(_0xe205('0x2'))(_0xe205('0x3'));var moment=require(_0xe205('0x4'));var BPromise=require(_0xe205('0x5'));var rp=require(_0xe205('0x6'));var fs=require('fs');var path=require(_0xe205('0x7'));var rimraf=require(_0xe205('0x8'));var config=require(_0xe205('0x9'));var attributes=require(_0xe205('0xa'));module['exports']=function(_0x3a9c5a,_0x2a51df){return _0x3a9c5a['define'](_0xe205('0xb'),attributes,{'tableName':_0xe205('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0bc7=['path','rimraf','../../config/environment','./squareMessage.attributes','define','SquareMessage','square_messages','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4cd36d,_0x33e658){var _0x2583b0=function(_0x3944db){while(--_0x3944db){_0x4cd36d['push'](_0x4cd36d['shift']());}};_0x2583b0(++_0x33e658);}(_0x0bc7,0x6f));var _0x70bc=function(_0x20f9bc,_0x1057f0){_0x20f9bc=_0x20f9bc-0x0;var _0x2060a4=_0x0bc7[_0x20f9bc];return _0x2060a4;};'use strict';var _=require(_0x70bc('0x0'));var util=require(_0x70bc('0x1'));var logger=require(_0x70bc('0x2'))(_0x70bc('0x3'));var moment=require(_0x70bc('0x4'));var BPromise=require(_0x70bc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x70bc('0x6'));var rimraf=require(_0x70bc('0x7'));var config=require(_0x70bc('0x8'));var attributes=require(_0x70bc('0x9'));module['exports']=function(_0x4a8385,_0x5e7711){return _0x4a8385[_0x70bc('0xa')](_0x70bc('0xb'),attributes,{'tableName':_0x70bc('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 ce475cd..f5cf357 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 _0xb14f=['message','result','catch','CreateSquareMessage','SquareMessage','create','options','raw','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x32f6f8,_0x34c11a){var _0xbdb87=function(_0x4542fb){while(--_0x4542fb){_0x32f6f8['push'](_0x32f6f8['shift']());}};_0xbdb87(++_0x34c11a);}(_0xb14f,0x131));var _0xfb14=function(_0x53313e,_0x25c9ed){_0x53313e=_0x53313e-0x0;var _0x187f0c=_0xb14f[_0x53313e];return _0x187f0c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xfb14('0x0'));var rs=require(_0xfb14('0x1'));var fs=require('fs');var Redis=require(_0xfb14('0x2'));var db=require(_0xfb14('0x3'))['db'];var utils=require(_0xfb14('0x4'));var logger=require(_0xfb14('0x5'))(_0xfb14('0x6'));var config=require('../../config/environment');var jayson=require(_0xfb14('0x7'));var client=jayson[_0xfb14('0x8')][_0xfb14('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x54c825,_0x276f74,_0x57d431){return new BPromise(function(_0x4ff156,_0xe2fffa){return client[_0xfb14('0xa')](_0x54c825,_0x57d431)[_0xfb14('0xb')](function(_0x2ae457){logger[_0xfb14('0xc')](_0xfb14('0xd'),_0x276f74,'request\x20sent');logger[_0xfb14('0xe')](_0xfb14('0xf'),_0x276f74,_0xfb14('0x10'),JSON[_0xfb14('0x11')](_0x2ae457));if(_0x2ae457[_0xfb14('0x12')]){if(_0x2ae457[_0xfb14('0x12')]['code']===0x1f4){logger[_0xfb14('0x12')]('SquareMessage,\x20%s,\x20%s',_0x276f74,_0x2ae457[_0xfb14('0x12')][_0xfb14('0x13')]);return _0xe2fffa(_0x2ae457[_0xfb14('0x12')][_0xfb14('0x13')]);}logger[_0xfb14('0x12')]('SquareMessage,\x20%s,\x20%s',_0x276f74,_0x2ae457[_0xfb14('0x12')][_0xfb14('0x13')]);return _0x4ff156(_0x2ae457['error'][_0xfb14('0x13')]);}else{logger[_0xfb14('0xc')](_0xfb14('0xd'),_0x276f74,'request\x20sent');_0x4ff156(_0x2ae457[_0xfb14('0x14')][_0xfb14('0x13')]);}})[_0xfb14('0x15')](function(_0xae2d0d){logger['error'](_0xfb14('0xd'),_0x276f74,_0xae2d0d);_0xe2fffa(_0xae2d0d);});});}exports[_0xfb14('0x16')]=function(_0x272c51){var _0x197b1a=this;return new Promise(function(_0x2631b0,_0x4d6eac){return db[_0xfb14('0x17')][_0xfb14('0x18')](_0x272c51['body'],{'raw':_0x272c51[_0xfb14('0x19')]?_0x272c51['options'][_0xfb14('0x1a')]===undefined?!![]:![]:!![]})[_0xfb14('0xb')](function(_0x3a874e){logger['info']('CreateSquareMessage',_0x272c51);logger[_0xfb14('0xe')]('CreateSquareMessage',_0x272c51,JSON[_0xfb14('0x11')](_0x3a874e));_0x2631b0(_0x3a874e);})[_0xfb14('0x15')](function(_0x28de0e){logger[_0xfb14('0x12')](_0xfb14('0x16'),_0x28de0e[_0xfb14('0x13')],_0x272c51);_0x4d6eac(_0x197b1a[_0xfb14('0x12')](0x1f4,_0x28de0e[_0xfb14('0x13')]));});});}; \ No newline at end of file +var _0x5ee7=['SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareMessage','SquareMessage','create','body','options','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','SquareMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x7ab193,_0x247d84){var _0x8d4fd=function(_0x1bf75a){while(--_0x1bf75a){_0x7ab193['push'](_0x7ab193['shift']());}};_0x8d4fd(++_0x247d84);}(_0x5ee7,0x16b));var _0x75ee=function(_0x3cd060,_0x99d6c8){_0x3cd060=_0x3cd060-0x0;var _0x2e84e8=_0x5ee7[_0x3cd060];return _0x2e84e8;};'use strict';var _=require(_0x75ee('0x0'));var util=require('util');var moment=require(_0x75ee('0x1'));var BPromise=require(_0x75ee('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x75ee('0x3'));var db=require(_0x75ee('0x4'))['db'];var utils=require(_0x75ee('0x5'));var logger=require(_0x75ee('0x6'))(_0x75ee('0x7'));var config=require('../../config/environment');var jayson=require(_0x75ee('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4d57ac,_0x126e42,_0x251e4f){return new BPromise(function(_0x49a83b,_0x2830b7){return client[_0x75ee('0x9')](_0x4d57ac,_0x251e4f)['then'](function(_0x3b570b){logger['info'](_0x75ee('0xa'),_0x126e42,_0x75ee('0xb'));logger['debug'](_0x75ee('0xc'),_0x126e42,_0x75ee('0xb'),JSON[_0x75ee('0xd')](_0x3b570b));if(_0x3b570b['error']){if(_0x3b570b[_0x75ee('0xe')][_0x75ee('0xf')]===0x1f4){logger[_0x75ee('0xe')]('SquareMessage,\x20%s,\x20%s',_0x126e42,_0x3b570b[_0x75ee('0xe')]['message']);return _0x2830b7(_0x3b570b['error'][_0x75ee('0x10')]);}logger['error'](_0x75ee('0xa'),_0x126e42,_0x3b570b[_0x75ee('0xe')]['message']);return _0x49a83b(_0x3b570b[_0x75ee('0xe')][_0x75ee('0x10')]);}else{logger[_0x75ee('0x11')]('SquareMessage,\x20%s,\x20%s',_0x126e42,_0x75ee('0xb'));_0x49a83b(_0x3b570b[_0x75ee('0x12')]['message']);}})[_0x75ee('0x13')](function(_0x1a5402){logger[_0x75ee('0xe')](_0x75ee('0xa'),_0x126e42,_0x1a5402);_0x2830b7(_0x1a5402);});});}exports[_0x75ee('0x14')]=function(_0x456bb5){var _0x4ed36a=this;return new Promise(function(_0x5564a4,_0x3c1fa3){return db[_0x75ee('0x15')][_0x75ee('0x16')](_0x456bb5[_0x75ee('0x17')],{'raw':_0x456bb5[_0x75ee('0x18')]?_0x456bb5[_0x75ee('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3fd683){logger[_0x75ee('0x11')](_0x75ee('0x14'),_0x456bb5);logger['debug'](_0x75ee('0x14'),_0x456bb5,JSON[_0x75ee('0xd')](_0x3fd683));_0x5564a4(_0x3fd683);})[_0x75ee('0x13')](function(_0x2102d3){logger[_0x75ee('0xe')]('CreateSquareMessage',_0x2102d3['message'],_0x456bb5);_0x3c1fa3(_0x4ed36a['error'](0x1f4,_0x2102d3[_0x75ee('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 9aceb12..c20ee2b 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 _0x08c7=['15s','post','create','put','destroy','exports','multer','util','path','express','Router','../../config/environment','isAuthenticated','get','/:id','show','/:id/test'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x08c7,0x15a));var _0x708c=function(_0x22a31a,_0x2e8d8){_0x22a31a=_0x22a31a-0x0;var _0x91bc25=_0x08c7[_0x22a31a];return _0x91bc25;};'use strict';var multer=require(_0x708c('0x0'));var util=require(_0x708c('0x1'));var path=require(_0x708c('0x2'));var timeout=require('connect-timeout');var express=require(_0x708c('0x3'));var router=express[_0x708c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x708c('0x5'));var controller=require('./squareOdbc.controller');router['get']('/',auth[_0x708c('0x6')](),controller['index']);router[_0x708c('0x7')](_0x708c('0x8'),auth[_0x708c('0x6')](),controller[_0x708c('0x9')]);router[_0x708c('0x7')](_0x708c('0xa'),auth['isAuthenticated'](),timeout(_0x708c('0xb')),controller['test']);router[_0x708c('0xc')]('/',auth[_0x708c('0x6')](),controller[_0x708c('0xd')]);router[_0x708c('0xe')](_0x708c('0x8'),auth[_0x708c('0x6')](),controller['update']);router['delete'](_0x708c('0x8'),auth['isAuthenticated'](),controller[_0x708c('0xf')]);module[_0x708c('0x10')]=router; \ No newline at end of file +var _0xde77=['index','show','/:id/test','post','create','put','/:id','update','delete','destroy','multer','util','path','express','Router','../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated'];(function(_0x11b9e8,_0x57e538){var _0x363ff4=function(_0x1f7681){while(--_0x1f7681){_0x11b9e8['push'](_0x11b9e8['shift']());}};_0x363ff4(++_0x57e538);}(_0xde77,0x173));var _0x7de7=function(_0x56c45b,_0x592e92){_0x56c45b=_0x56c45b-0x0;var _0x296b18=_0xde77[_0x56c45b];return _0x296b18;};'use strict';var multer=require(_0x7de7('0x0'));var util=require(_0x7de7('0x1'));var path=require(_0x7de7('0x2'));var timeout=require('connect-timeout');var express=require(_0x7de7('0x3'));var router=express[_0x7de7('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7de7('0x5'));var config=require('../../config/environment');var controller=require(_0x7de7('0x6'));router[_0x7de7('0x7')]('/',auth[_0x7de7('0x8')](),controller[_0x7de7('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x7de7('0xa')]);router[_0x7de7('0x7')](_0x7de7('0xb'),auth[_0x7de7('0x8')](),timeout('15s'),controller['test']);router[_0x7de7('0xc')]('/',auth[_0x7de7('0x8')](),controller[_0x7de7('0xd')]);router[_0x7de7('0xe')](_0x7de7('0xf'),auth[_0x7de7('0x8')](),controller[_0x7de7('0x10')]);router[_0x7de7('0x11')](_0x7de7('0xf'),auth[_0x7de7('0x8')](),controller[_0x7de7('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 01285f0..2df835e 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 _0x9929=['name','sequelize','exports','STRING'];(function(_0x2743f2,_0x22cea6){var _0x45f8e4=function(_0x2ac786){while(--_0x2ac786){_0x2743f2['push'](_0x2743f2['shift']());}};_0x45f8e4(++_0x22cea6);}(_0x9929,0x1a5));var _0x9992=function(_0x294a94,_0x287404){_0x294a94=_0x294a94-0x0;var _0x389c43=_0x9929[_0x294a94];return _0x389c43;};'use strict';var Sequelize=require(_0x9992('0x0'));module[_0x9992('0x1')]={'name':{'type':Sequelize[_0x9992('0x2')],'unique':_0x9992('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1b2f=['sequelize','exports','STRING','name'];(function(_0x27530b,_0x4429f6){var _0x20ff02=function(_0x764e6c){while(--_0x764e6c){_0x27530b['push'](_0x27530b['shift']());}};_0x20ff02(++_0x4429f6);}(_0x1b2f,0xd4));var _0xf1b2=function(_0x390599,_0x2c46b0){_0x390599=_0x390599-0x0;var _0x2c4879=_0x1b2f[_0x390599];return _0x2c4879;};'use strict';var Sequelize=require(_0xf1b2('0x0'));module[_0xf1b2('0x1')]={'name':{'type':Sequelize[_0xf1b2('0x2')],'unique':_0xf1b2('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xf1b2('0x2')]},'description':{'type':Sequelize[_0xf1b2('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 59407fb..b95dae5 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 _0xfeb4=['where','pick','merge','VIRTUAL','filter','options','SquareOdbc','includeAll','include','findAll','rows','show','params','create','body','user','UserProfileSection','find','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','odbc','openSync','dsn','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','apply','reject','save','update','then','destroy','get','ODBC','UserProfileResource','sendStatus','error','stack','name','send','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0xca30ff,_0x4bda96){var _0xa8191b=function(_0x2384ed){while(--_0x2384ed){_0xca30ff['push'](_0xca30ff['shift']());}};_0xa8191b(++_0x4bda96);}(_0xfeb4,0x6d));var _0x4feb=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xfeb4[_0x2c7618];return _0x5ce3f0;};'use strict';var emlformat=require(_0x4feb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4feb('0x1'));var jsonpatch=require(_0x4feb('0x2'));var rp=require(_0x4feb('0x3'));var moment=require(_0x4feb('0x4'));var BPromise=require(_0x4feb('0x5'));var Mustache=require(_0x4feb('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4feb('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4feb('0x8'));var squel=require(_0x4feb('0x9'));var crypto=require('crypto');var jsforce=require(_0x4feb('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x4feb('0xb'));var querystring=require(_0x4feb('0xc'));var Papa=require(_0x4feb('0xd'));var Redis=require('ioredis');var authService=require(_0x4feb('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x4feb('0xf'));var hardwareService=require(_0x4feb('0x10'));var logger=require(_0x4feb('0x11'))(_0x4feb('0x12'));var utils=require(_0x4feb('0x13'));var config=require(_0x4feb('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x4feb('0x15'))['db'];function respondWithStatusCode(_0x241f21,_0x42676f){_0x42676f=_0x42676f||0xcc;return function(_0x2daa11){if(_0x2daa11){return _0x241f21['sendStatus'](_0x42676f);}return _0x241f21[_0x4feb('0x16')](_0x42676f)[_0x4feb('0x17')]();};}function respondWithResult(_0xa5204e,_0x3fdf1c){_0x3fdf1c=_0x3fdf1c||0xc8;return function(_0x46a50d){if(_0x46a50d){return _0xa5204e[_0x4feb('0x16')](_0x3fdf1c)['json'](_0x46a50d);}};}function respondWithFilteredResult(_0x402b24,_0x4f1ae5){return function(_0x123a3d){if(_0x123a3d){var _0xd4e03c=typeof _0x4f1ae5[_0x4feb('0x18')]===_0x4feb('0x19')&&typeof _0x4f1ae5[_0x4feb('0x1a')]===_0x4feb('0x19');var _0x209ae8=_0x123a3d[_0x4feb('0x1b')];var _0x2b3ded=_0xd4e03c?0x0:_0x4f1ae5[_0x4feb('0x18')];var _0x61e87e=_0xd4e03c?_0x123a3d[_0x4feb('0x1b')]:_0x4f1ae5[_0x4feb('0x18')]+_0x4f1ae5[_0x4feb('0x1a')];var _0x3a44de;if(_0x61e87e>=_0x209ae8){_0x61e87e=_0x209ae8;_0x3a44de=0xc8;}else{_0x3a44de=0xce;}_0x402b24['status'](_0x3a44de);return _0x402b24['set']('Content-Range',_0x2b3ded+'-'+_0x61e87e+'/'+_0x209ae8)['json'](_0x123a3d);}return null;};}function patchUpdates(_0x2bd2df){return function(_0x16998c){try{jsonpatch[_0x4feb('0x1c')](_0x16998c,_0x2bd2df,!![]);}catch(_0x46d0cd){return BPromise[_0x4feb('0x1d')](_0x46d0cd);}return _0x16998c[_0x4feb('0x1e')]();};}function saveUpdates(_0x1d5c42,_0x4ad334){return function(_0x32a5a6){if(_0x32a5a6){return _0x32a5a6[_0x4feb('0x1f')](_0x1d5c42)[_0x4feb('0x20')](function(_0x527ba4){return _0x527ba4;});}return null;};}function removeEntity(_0x33ef25,_0x4c5271){return function(_0x3aeb20){if(_0x3aeb20){return _0x3aeb20[_0x4feb('0x21')]()[_0x4feb('0x20')](function(){var _0x4930e3=_0x3aeb20[_0x4feb('0x22')]({'plain':!![]});var _0x39b077=_0x4feb('0x23');return db[_0x4feb('0x24')][_0x4feb('0x21')]({'where':{'type':_0x39b077,'resourceId':_0x4930e3['id']}})['then'](function(){return _0x3aeb20;});})[_0x4feb('0x20')](function(){_0x33ef25[_0x4feb('0x16')](0xcc)[_0x4feb('0x17')]();});}};}function handleEntityNotFound(_0x598e07,_0x5a44b1){return function(_0x117b84){if(!_0x117b84){_0x598e07[_0x4feb('0x25')](0x194);}return _0x117b84;};}function handleError(_0x450f6b,_0x3ab9f3){_0x3ab9f3=_0x3ab9f3||0x1f4;return function(_0x5b2558){logger[_0x4feb('0x26')](_0x5b2558[_0x4feb('0x27')]);if(_0x5b2558[_0x4feb('0x28')]){delete _0x5b2558[_0x4feb('0x28')];}_0x450f6b[_0x4feb('0x16')](_0x3ab9f3)[_0x4feb('0x29')](_0x5b2558);};}exports['index']=function(_0x50c2e8,_0x3ca2fa){var _0x58bccc={},_0x4d9831={},_0x355f06={'count':0x0,'rows':[]};var _0x4d1b42=_['map'](db['SquareOdbc'][_0x4feb('0x2a')],function(_0x33938d){return{'name':_0x33938d[_0x4feb('0x2b')],'type':_0x33938d[_0x4feb('0x2c')]['key']};});_0x4d9831[_0x4feb('0x2d')]=_[_0x4feb('0x2e')](_0x4d1b42,'name');_0x4d9831[_0x4feb('0x2f')]=_[_0x4feb('0x30')](_0x50c2e8[_0x4feb('0x2f')]);_0x4d9831[_0x4feb('0x31')]=_[_0x4feb('0x32')](_0x4d9831[_0x4feb('0x2d')],_0x4d9831[_0x4feb('0x2f')]);_0x58bccc[_0x4feb('0x33')]=_[_0x4feb('0x32')](_0x4d9831[_0x4feb('0x2d')],qs[_0x4feb('0x34')](_0x50c2e8[_0x4feb('0x2f')][_0x4feb('0x34')]));_0x58bccc[_0x4feb('0x33')]=_0x58bccc[_0x4feb('0x33')][_0x4feb('0x35')]?_0x58bccc[_0x4feb('0x33')]:_0x4d9831[_0x4feb('0x2d')];if(!_0x50c2e8[_0x4feb('0x2f')][_0x4feb('0x36')](_0x4feb('0x37'))){_0x58bccc[_0x4feb('0x1a')]=qs[_0x4feb('0x1a')](_0x50c2e8[_0x4feb('0x2f')]['limit']);_0x58bccc[_0x4feb('0x18')]=qs['offset'](_0x50c2e8['query'][_0x4feb('0x18')]);}_0x58bccc[_0x4feb('0x38')]=qs['sort'](_0x50c2e8[_0x4feb('0x2f')]['sort']);_0x58bccc[_0x4feb('0x39')]=qs[_0x4feb('0x31')](_[_0x4feb('0x3a')](_0x50c2e8[_0x4feb('0x2f')],_0x4d9831['filters']),_0x4d1b42);if(_0x50c2e8[_0x4feb('0x2f')]['filter']){_0x58bccc[_0x4feb('0x39')]=_[_0x4feb('0x3b')](_0x58bccc['where'],{'$or':_['map'](_0x4d1b42,function(_0x25f1c7){if(_0x25f1c7[_0x4feb('0x2c')]!==_0x4feb('0x3c')){var _0x5af34d={};_0x5af34d[_0x25f1c7[_0x4feb('0x28')]]={'$like':'%'+_0x50c2e8[_0x4feb('0x2f')][_0x4feb('0x3d')]+'%'};return _0x5af34d;}})});}_0x58bccc=_[_0x4feb('0x3b')]({},_0x58bccc,_0x50c2e8[_0x4feb('0x3e')]);var _0x21f918={'where':_0x58bccc[_0x4feb('0x39')]};return db[_0x4feb('0x3f')]['count'](_0x21f918)[_0x4feb('0x20')](function(_0x504275){_0x355f06['count']=_0x504275;if(_0x50c2e8['query'][_0x4feb('0x40')]){_0x58bccc[_0x4feb('0x41')]=[{'all':!![]}];}return db['SquareOdbc'][_0x4feb('0x42')](_0x58bccc);})[_0x4feb('0x20')](function(_0x5ebba7){_0x355f06[_0x4feb('0x43')]=_0x5ebba7;return _0x355f06;})['then'](respondWithFilteredResult(_0x3ca2fa,_0x58bccc))['catch'](handleError(_0x3ca2fa,null));};exports[_0x4feb('0x44')]=function(_0x158d43,_0x2c302f){var _0x5e5cba={'raw':!![],'where':{'id':_0x158d43[_0x4feb('0x45')]['id']}},_0x4da4f2={};_0x4da4f2[_0x4feb('0x2d')]=_[_0x4feb('0x30')](db[_0x4feb('0x3f')]['rawAttributes']);_0x4da4f2[_0x4feb('0x2f')]=_[_0x4feb('0x30')](_0x158d43[_0x4feb('0x2f')]);_0x4da4f2[_0x4feb('0x31')]=_[_0x4feb('0x32')](_0x4da4f2['model'],_0x4da4f2[_0x4feb('0x2f')]);_0x5e5cba[_0x4feb('0x33')]=_[_0x4feb('0x32')](_0x4da4f2[_0x4feb('0x2d')],qs['fields'](_0x158d43['query'][_0x4feb('0x34')]));_0x5e5cba[_0x4feb('0x33')]=_0x5e5cba[_0x4feb('0x33')][_0x4feb('0x35')]?_0x5e5cba[_0x4feb('0x33')]:_0x4da4f2['model'];if(_0x158d43[_0x4feb('0x2f')]['includeAll']){_0x5e5cba[_0x4feb('0x41')]=[{'all':!![]}];}_0x5e5cba=_['merge']({},_0x5e5cba,_0x158d43['options']);return db[_0x4feb('0x3f')]['find'](_0x5e5cba)[_0x4feb('0x20')](handleEntityNotFound(_0x2c302f,null))[_0x4feb('0x20')](respondWithResult(_0x2c302f,null))['catch'](handleError(_0x2c302f,null));};exports[_0x4feb('0x46')]=function(_0x3a4383,_0x95157c){return db[_0x4feb('0x3f')][_0x4feb('0x46')](_0x3a4383[_0x4feb('0x47')],{})[_0x4feb('0x20')](function(_0x18aeb1){var _0x21c56f=_0x3a4383[_0x4feb('0x48')][_0x4feb('0x22')]({'plain':!![]});if(!_0x21c56f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21c56f['role']===_0x4feb('0x48')){var _0x436aea=_0x18aeb1[_0x4feb('0x22')]({'plain':!![]});var _0x34c23f='ODBC';return db[_0x4feb('0x49')][_0x4feb('0x4a')]({'where':{'name':_0x34c23f,'userProfileId':_0x21c56f[_0x4feb('0x4b')]},'raw':!![]})['then'](function(_0x303d75){if(_0x303d75&&_0x303d75[_0x4feb('0x4c')]===0x0){return db[_0x4feb('0x24')][_0x4feb('0x46')]({'name':_0x436aea[_0x4feb('0x28')],'resourceId':_0x436aea['id'],'type':_0x303d75['name'],'sectionId':_0x303d75['id']},{})[_0x4feb('0x20')](function(){return _0x18aeb1;});}else{return _0x18aeb1;}})[_0x4feb('0x4d')](function(_0x1ea617){logger[_0x4feb('0x26')](_0x4feb('0x4e'),_0x1ea617);throw _0x1ea617;});}return _0x18aeb1;})[_0x4feb('0x20')](respondWithResult(_0x95157c,0xc9))[_0x4feb('0x4d')](handleError(_0x95157c,null));};exports[_0x4feb('0x1f')]=function(_0x4f0e0a,_0x2b76a3){if(_0x4f0e0a[_0x4feb('0x47')]['id']){delete _0x4f0e0a[_0x4feb('0x47')]['id'];}return db[_0x4feb('0x3f')]['find']({'where':{'id':_0x4f0e0a[_0x4feb('0x45')]['id']}})['then'](handleEntityNotFound(_0x2b76a3,null))['then'](saveUpdates(_0x4f0e0a[_0x4feb('0x47')],null))[_0x4feb('0x20')](respondWithResult(_0x2b76a3,null))['catch'](handleError(_0x2b76a3,null));};exports['destroy']=function(_0x4d2ac6,_0x151033){return db[_0x4feb('0x3f')]['find']({'where':{'id':_0x4d2ac6[_0x4feb('0x45')]['id']}})[_0x4feb('0x20')](handleEntityNotFound(_0x151033,null))[_0x4feb('0x20')](removeEntity(_0x151033,null))['catch'](handleError(_0x151033,null));};exports[_0x4feb('0x4f')]=function(_0x1afb12,_0x6a6492,_0x1a2d3d){var _0x17b70f;return db[_0x4feb('0x3f')][_0x4feb('0x4a')]({'where':{'id':_0x1afb12[_0x4feb('0x45')]['id']},'attributes':['id','dsn']})[_0x4feb('0x20')](handleEntityNotFound(_0x6a6492,null))[_0x4feb('0x20')](function(_0x26869d){if(_0x26869d){var _0x1170cc=require(_0x4feb('0x50'))();_0x1170cc[_0x4feb('0x51')](_0x26869d[_0x4feb('0x52')]);_0x1170cc['closeSync']();return _0x26869d;}})[_0x4feb('0x20')](respondWithResult(_0x6a6492,null))[_0x4feb('0x4d')](handleError(_0x6a6492,null));}; \ No newline at end of file +var _0x7da6=['lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','offset','limit','undefined','count','json','apply','reject','update','then','UserProfileResource','destroy','sendStatus','error','stack','name','index','SquareOdbc','type','model','map','query','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','rawAttributes','keys','create','body','user','role','get','ODBC','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','odbc','openSync','dsn','closeSync','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x570d03,_0xcbba75){var _0x3b4df1=function(_0x41f7ca){while(--_0x41f7ca){_0x570d03['push'](_0x570d03['shift']());}};_0x3b4df1(++_0xcbba75);}(_0x7da6,0x139));var _0x67da=function(_0x509c83,_0x511882){_0x509c83=_0x509c83-0x0;var _0x534626=_0x7da6[_0x509c83];return _0x534626;};'use strict';var emlformat=require(_0x67da('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x67da('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x67da('0x2'));var BPromise=require(_0x67da('0x3'));var Mustache=require(_0x67da('0x4'));var util=require(_0x67da('0x5'));var path=require(_0x67da('0x6'));var sox=require(_0x67da('0x7'));var csv=require(_0x67da('0x8'));var ejs=require(_0x67da('0x9'));var fs=require('fs');var fs_extra=require(_0x67da('0xa'));var _=require(_0x67da('0xb'));var squel=require(_0x67da('0xc'));var crypto=require(_0x67da('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x67da('0xe'));var toCsv=require(_0x67da('0x8'));var querystring=require(_0x67da('0xf'));var Papa=require(_0x67da('0x10'));var Redis=require('ioredis');var authService=require(_0x67da('0x11'));var qs=require(_0x67da('0x12'));var as=require(_0x67da('0x13'));var hardwareService=require(_0x67da('0x14'));var logger=require(_0x67da('0x15'))(_0x67da('0x16'));var utils=require('../../config/utils');var config=require(_0x67da('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x67da('0x18'))['db'];function respondWithStatusCode(_0x3f7abd,_0x2f8fdc){_0x2f8fdc=_0x2f8fdc||0xcc;return function(_0x58dc0d){if(_0x58dc0d){return _0x3f7abd['sendStatus'](_0x2f8fdc);}return _0x3f7abd[_0x67da('0x19')](_0x2f8fdc)[_0x67da('0x1a')]();};}function respondWithResult(_0x1c6dbb,_0x19e60f){_0x19e60f=_0x19e60f||0xc8;return function(_0xe0eb86){if(_0xe0eb86){return _0x1c6dbb[_0x67da('0x19')](_0x19e60f)['json'](_0xe0eb86);}};}function respondWithFilteredResult(_0x42cd50,_0x542b42){return function(_0xaaabf8){if(_0xaaabf8){var _0x37b3d6=typeof _0x542b42[_0x67da('0x1b')]==='undefined'&&typeof _0x542b42[_0x67da('0x1c')]===_0x67da('0x1d');var _0x12fc3a=_0xaaabf8[_0x67da('0x1e')];var _0x33468f=_0x37b3d6?0x0:_0x542b42[_0x67da('0x1b')];var _0x1373a6=_0x37b3d6?_0xaaabf8[_0x67da('0x1e')]:_0x542b42[_0x67da('0x1b')]+_0x542b42[_0x67da('0x1c')];var _0x56c372;if(_0x1373a6>=_0x12fc3a){_0x1373a6=_0x12fc3a;_0x56c372=0xc8;}else{_0x56c372=0xce;}_0x42cd50[_0x67da('0x19')](_0x56c372);return _0x42cd50['set']('Content-Range',_0x33468f+'-'+_0x1373a6+'/'+_0x12fc3a)[_0x67da('0x1f')](_0xaaabf8);}return null;};}function patchUpdates(_0x48cf5b){return function(_0x9cf634){try{jsonpatch[_0x67da('0x20')](_0x9cf634,_0x48cf5b,!![]);}catch(_0x237a7d){return BPromise[_0x67da('0x21')](_0x237a7d);}return _0x9cf634['save']();};}function saveUpdates(_0x25c575,_0x2bad01){return function(_0x493292){if(_0x493292){return _0x493292[_0x67da('0x22')](_0x25c575)[_0x67da('0x23')](function(_0x129846){return _0x129846;});}return null;};}function removeEntity(_0x4cb2d1,_0x28c46f){return function(_0x48bcbe){if(_0x48bcbe){return _0x48bcbe['destroy']()[_0x67da('0x23')](function(){var _0x142514=_0x48bcbe['get']({'plain':!![]});var _0x8ca126='ODBC';return db[_0x67da('0x24')][_0x67da('0x25')]({'where':{'type':_0x8ca126,'resourceId':_0x142514['id']}})[_0x67da('0x23')](function(){return _0x48bcbe;});})[_0x67da('0x23')](function(){_0x4cb2d1[_0x67da('0x19')](0xcc)[_0x67da('0x1a')]();});}};}function handleEntityNotFound(_0x436bd6,_0x3c76c0){return function(_0x46f55d){if(!_0x46f55d){_0x436bd6[_0x67da('0x26')](0x194);}return _0x46f55d;};}function handleError(_0x19288b,_0x8e58ad){_0x8e58ad=_0x8e58ad||0x1f4;return function(_0x386769){logger[_0x67da('0x27')](_0x386769[_0x67da('0x28')]);if(_0x386769[_0x67da('0x29')]){delete _0x386769[_0x67da('0x29')];}_0x19288b[_0x67da('0x19')](_0x8e58ad)['send'](_0x386769);};}exports[_0x67da('0x2a')]=function(_0x2d4788,_0x283206){var _0x11fb2d={},_0x73b8ec={},_0x45bb80={'count':0x0,'rows':[]};var _0x2a905b=_['map'](db[_0x67da('0x2b')]['rawAttributes'],function(_0x4f30c2){return{'name':_0x4f30c2['fieldName'],'type':_0x4f30c2[_0x67da('0x2c')]['key']};});_0x73b8ec[_0x67da('0x2d')]=_[_0x67da('0x2e')](_0x2a905b,_0x67da('0x29'));_0x73b8ec['query']=_['keys'](_0x2d4788[_0x67da('0x2f')]);_0x73b8ec[_0x67da('0x30')]=_[_0x67da('0x31')](_0x73b8ec['model'],_0x73b8ec[_0x67da('0x2f')]);_0x11fb2d[_0x67da('0x32')]=_[_0x67da('0x31')](_0x73b8ec[_0x67da('0x2d')],qs[_0x67da('0x33')](_0x2d4788[_0x67da('0x2f')][_0x67da('0x33')]));_0x11fb2d['attributes']=_0x11fb2d['attributes'][_0x67da('0x34')]?_0x11fb2d[_0x67da('0x32')]:_0x73b8ec[_0x67da('0x2d')];if(!_0x2d4788['query']['hasOwnProperty']('nolimit')){_0x11fb2d['limit']=qs[_0x67da('0x1c')](_0x2d4788[_0x67da('0x2f')][_0x67da('0x1c')]);_0x11fb2d[_0x67da('0x1b')]=qs['offset'](_0x2d4788[_0x67da('0x2f')][_0x67da('0x1b')]);}_0x11fb2d[_0x67da('0x35')]=qs['sort'](_0x2d4788[_0x67da('0x2f')][_0x67da('0x36')]);_0x11fb2d[_0x67da('0x37')]=qs[_0x67da('0x30')](_[_0x67da('0x38')](_0x2d4788[_0x67da('0x2f')],_0x73b8ec['filters']),_0x2a905b);if(_0x2d4788[_0x67da('0x2f')]['filter']){_0x11fb2d[_0x67da('0x37')]=_[_0x67da('0x39')](_0x11fb2d[_0x67da('0x37')],{'$or':_[_0x67da('0x2e')](_0x2a905b,function(_0x16c6ad){if(_0x16c6ad[_0x67da('0x2c')]!==_0x67da('0x3a')){var _0x4e4f3e={};_0x4e4f3e[_0x16c6ad[_0x67da('0x29')]]={'$like':'%'+_0x2d4788[_0x67da('0x2f')]['filter']+'%'};return _0x4e4f3e;}})});}_0x11fb2d=_[_0x67da('0x39')]({},_0x11fb2d,_0x2d4788[_0x67da('0x3b')]);var _0xe9e541={'where':_0x11fb2d[_0x67da('0x37')]};return db['SquareOdbc'][_0x67da('0x1e')](_0xe9e541)[_0x67da('0x23')](function(_0x3b5fe1){_0x45bb80[_0x67da('0x1e')]=_0x3b5fe1;if(_0x2d4788[_0x67da('0x2f')][_0x67da('0x3c')]){_0x11fb2d[_0x67da('0x3d')]=[{'all':!![]}];}return db[_0x67da('0x2b')][_0x67da('0x3e')](_0x11fb2d);})[_0x67da('0x23')](function(_0x315ae2){_0x45bb80['rows']=_0x315ae2;return _0x45bb80;})[_0x67da('0x23')](respondWithFilteredResult(_0x283206,_0x11fb2d))[_0x67da('0x3f')](handleError(_0x283206,null));};exports['show']=function(_0x3351c9,_0x430ac4){var _0x1246b4={'raw':!![],'where':{'id':_0x3351c9[_0x67da('0x40')]['id']}},_0x2f26c4={};_0x2f26c4[_0x67da('0x2d')]=_['keys'](db[_0x67da('0x2b')][_0x67da('0x41')]);_0x2f26c4[_0x67da('0x2f')]=_[_0x67da('0x42')](_0x3351c9[_0x67da('0x2f')]);_0x2f26c4[_0x67da('0x30')]=_[_0x67da('0x31')](_0x2f26c4['model'],_0x2f26c4['query']);_0x1246b4[_0x67da('0x32')]=_[_0x67da('0x31')](_0x2f26c4['model'],qs['fields'](_0x3351c9[_0x67da('0x2f')][_0x67da('0x33')]));_0x1246b4[_0x67da('0x32')]=_0x1246b4[_0x67da('0x32')][_0x67da('0x34')]?_0x1246b4['attributes']:_0x2f26c4['model'];if(_0x3351c9['query']['includeAll']){_0x1246b4[_0x67da('0x3d')]=[{'all':!![]}];}_0x1246b4=_[_0x67da('0x39')]({},_0x1246b4,_0x3351c9[_0x67da('0x3b')]);return db[_0x67da('0x2b')]['find'](_0x1246b4)['then'](handleEntityNotFound(_0x430ac4,null))[_0x67da('0x23')](respondWithResult(_0x430ac4,null))[_0x67da('0x3f')](handleError(_0x430ac4,null));};exports[_0x67da('0x43')]=function(_0x6f75db,_0x364d80){return db[_0x67da('0x2b')]['create'](_0x6f75db[_0x67da('0x44')],{})[_0x67da('0x23')](function(_0x583b92){var _0x4fbf59=_0x6f75db[_0x67da('0x45')]['get']({'plain':!![]});if(!_0x4fbf59)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4fbf59[_0x67da('0x46')]===_0x67da('0x45')){var _0x1c7e7c=_0x583b92[_0x67da('0x47')]({'plain':!![]});var _0x16beff=_0x67da('0x48');return db['UserProfileSection'][_0x67da('0x49')]({'where':{'name':_0x16beff,'userProfileId':_0x4fbf59[_0x67da('0x4a')]},'raw':!![]})[_0x67da('0x23')](function(_0x2db2bf){if(_0x2db2bf&&_0x2db2bf[_0x67da('0x4b')]===0x0){return db[_0x67da('0x24')]['create']({'name':_0x1c7e7c[_0x67da('0x29')],'resourceId':_0x1c7e7c['id'],'type':_0x2db2bf[_0x67da('0x29')],'sectionId':_0x2db2bf['id']},{})['then'](function(){return _0x583b92;});}else{return _0x583b92;}})[_0x67da('0x3f')](function(_0x2bb4f8){logger['error'](_0x67da('0x4c'),_0x2bb4f8);throw _0x2bb4f8;});}return _0x583b92;})[_0x67da('0x23')](respondWithResult(_0x364d80,0xc9))[_0x67da('0x3f')](handleError(_0x364d80,null));};exports[_0x67da('0x22')]=function(_0x54b14a,_0x2ad980){if(_0x54b14a['body']['id']){delete _0x54b14a[_0x67da('0x44')]['id'];}return db[_0x67da('0x2b')][_0x67da('0x49')]({'where':{'id':_0x54b14a['params']['id']}})[_0x67da('0x23')](handleEntityNotFound(_0x2ad980,null))['then'](saveUpdates(_0x54b14a[_0x67da('0x44')],null))[_0x67da('0x23')](respondWithResult(_0x2ad980,null))[_0x67da('0x3f')](handleError(_0x2ad980,null));};exports[_0x67da('0x25')]=function(_0x458b9c,_0xf9e09e){return db[_0x67da('0x2b')][_0x67da('0x49')]({'where':{'id':_0x458b9c[_0x67da('0x40')]['id']}})[_0x67da('0x23')](handleEntityNotFound(_0xf9e09e,null))[_0x67da('0x23')](removeEntity(_0xf9e09e,null))[_0x67da('0x3f')](handleError(_0xf9e09e,null));};exports['test']=function(_0xc6b2c9,_0x41fd59,_0x3a4ef4){var _0x3571ce;return db['SquareOdbc'][_0x67da('0x49')]({'where':{'id':_0xc6b2c9['params']['id']},'attributes':['id','dsn']})[_0x67da('0x23')](handleEntityNotFound(_0x41fd59,null))[_0x67da('0x23')](function(_0x509e2b){if(_0x509e2b){var _0x56f5de=require(_0x67da('0x4d'))();_0x56f5de[_0x67da('0x4e')](_0x509e2b[_0x67da('0x4f')]);_0x56f5de[_0x67da('0x50')]();return _0x509e2b;}})[_0x67da('0x23')](respondWithResult(_0x41fd59,null))[_0x67da('0x3f')](handleError(_0x41fd59,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 35e80b9..fd56efa 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 _0xec96=['../../config/logger','moment','bluebird','request-promise','path','rimraf','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util'];(function(_0x1857d0,_0x6eade0){var _0x3e3c46=function(_0x3915b8){while(--_0x3915b8){_0x1857d0['push'](_0x1857d0['shift']());}};_0x3e3c46(++_0x6eade0);}(_0xec96,0x102));var _0x6ec9=function(_0xbbd378,_0x501983){_0xbbd378=_0xbbd378-0x0;var _0x28de85=_0xec96[_0xbbd378];return _0x28de85;};'use strict';var _=require(_0x6ec9('0x0'));var util=require(_0x6ec9('0x1'));var logger=require(_0x6ec9('0x2'))('api');var moment=require(_0x6ec9('0x3'));var BPromise=require(_0x6ec9('0x4'));var rp=require(_0x6ec9('0x5'));var fs=require('fs');var path=require(_0x6ec9('0x6'));var rimraf=require(_0x6ec9('0x7'));var config=require('../../config/environment');var attributes=require(_0x6ec9('0x8'));module[_0x6ec9('0x9')]=function(_0x46122c,_0x54c7d6){return _0x46122c[_0x6ec9('0xa')](_0x6ec9('0xb'),attributes,{'tableName':_0x6ec9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0635=['square_odbc','../../config/logger','api','request-promise','path','rimraf','./squareOdbc.attributes','exports','define'];(function(_0x38ab7f,_0x2a247f){var _0x1069e7=function(_0x392834){while(--_0x392834){_0x38ab7f['push'](_0x38ab7f['shift']());}};_0x1069e7(++_0x2a247f);}(_0x0635,0xeb));var _0x5063=function(_0x1013dc,_0x4f4dc3){_0x1013dc=_0x1013dc-0x0;var _0x589a0f=_0x0635[_0x1013dc];return _0x589a0f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5063('0x0'))(_0x5063('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5063('0x2'));var fs=require('fs');var path=require(_0x5063('0x3'));var rimraf=require(_0x5063('0x4'));var config=require('../../config/environment');var attributes=require(_0x5063('0x5'));module[_0x5063('0x6')]=function(_0x386c9e,_0x137b77){return _0x386c9e[_0x5063('0x7')]('SquareOdbc',attributes,{'tableName':_0x5063('0x8'),'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 637ff51..a3fe600 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 _0x29a3=['error','code','message','result','catch','SquareOdbc','find','options','raw','where','attributes','include','map','model','ShowSquareOdbc','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x423353,_0x5956be){var _0x5330ac=function(_0x1f4599){while(--_0x1f4599){_0x423353['push'](_0x423353['shift']());}};_0x5330ac(++_0x5956be);}(_0x29a3,0x14f));var _0x329a=function(_0x53da0f,_0x142ae4){_0x53da0f=_0x53da0f-0x0;var _0x56d563=_0x29a3[_0x53da0f];return _0x56d563;};'use strict';var _=require(_0x329a('0x0'));var util=require(_0x329a('0x1'));var moment=require(_0x329a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x329a('0x3'))['db'];var utils=require(_0x329a('0x4'));var logger=require(_0x329a('0x5'))(_0x329a('0x6'));var config=require(_0x329a('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x329a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2a659d,_0x51bd47,_0x3d590c){return new BPromise(function(_0x27ba99,_0x512dae){return client[_0x329a('0x9')](_0x2a659d,_0x3d590c)[_0x329a('0xa')](function(_0x56ab86){logger[_0x329a('0xb')](_0x329a('0xc'),_0x51bd47,_0x329a('0xd'));logger[_0x329a('0xe')](_0x329a('0xf'),_0x51bd47,_0x329a('0xd'),JSON[_0x329a('0x10')](_0x56ab86));if(_0x56ab86[_0x329a('0x11')]){if(_0x56ab86['error'][_0x329a('0x12')]===0x1f4){logger[_0x329a('0x11')](_0x329a('0xc'),_0x51bd47,_0x56ab86[_0x329a('0x11')]['message']);return _0x512dae(_0x56ab86[_0x329a('0x11')][_0x329a('0x13')]);}logger[_0x329a('0x11')](_0x329a('0xc'),_0x51bd47,_0x56ab86['error'][_0x329a('0x13')]);return _0x27ba99(_0x56ab86['error'][_0x329a('0x13')]);}else{logger[_0x329a('0xb')](_0x329a('0xc'),_0x51bd47,'request\x20sent');_0x27ba99(_0x56ab86[_0x329a('0x14')]['message']);}})[_0x329a('0x15')](function(_0x5bd966){logger['error'](_0x329a('0xc'),_0x51bd47,_0x5bd966);_0x512dae(_0x5bd966);});});}exports['ShowSquareOdbc']=function(_0x587ab2){var _0xf390fe=this;return new Promise(function(_0x57396a,_0x238dcc){return db[_0x329a('0x16')][_0x329a('0x17')]({'raw':_0x587ab2[_0x329a('0x18')]?_0x587ab2[_0x329a('0x18')][_0x329a('0x19')]===undefined?!![]:![]:!![],'where':_0x587ab2[_0x329a('0x18')]?_0x587ab2['options'][_0x329a('0x1a')]||null:null,'attributes':_0x587ab2[_0x329a('0x18')]?_0x587ab2[_0x329a('0x18')][_0x329a('0x1b')]||null:null,'include':_0x587ab2[_0x329a('0x18')]?_0x587ab2[_0x329a('0x18')][_0x329a('0x1c')]?_[_0x329a('0x1d')](_0x587ab2['options']['include'],function(_0x18d774){return{'model':db[_0x18d774[_0x329a('0x1e')]],'as':_0x18d774['as'],'attributes':_0x18d774[_0x329a('0x1b')],'include':_0x18d774[_0x329a('0x1c')]?_[_0x329a('0x1d')](_0x18d774[_0x329a('0x1c')],function(_0x1620cb){return{'model':db[_0x1620cb['model']],'as':_0x1620cb['as'],'attributes':_0x1620cb[_0x329a('0x1b')],'include':_0x1620cb[_0x329a('0x1c')]?_['map'](_0x1620cb[_0x329a('0x1c')],function(_0x532371){return{'model':db[_0x532371[_0x329a('0x1e')]],'as':_0x532371['as'],'attributes':_0x532371[_0x329a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f6aa3){logger['info'](_0x329a('0x1f'),_0x587ab2);logger[_0x329a('0xe')](_0x329a('0x1f'),_0x587ab2,JSON[_0x329a('0x10')](_0x2f6aa3));_0x57396a(_0x2f6aa3);})[_0x329a('0x15')](function(_0x11110e){logger[_0x329a('0x11')]('ShowSquareOdbc',_0x11110e[_0x329a('0x13')],_0x587ab2);_0x238dcc(_0xf390fe[_0x329a('0x11')](0x1f4,_0x11110e[_0x329a('0x13')]));});});}; \ No newline at end of file +var _0x5cab=['ShowSquareOdbc','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','SquareOdbc','find','options','raw','where','attributes','include','map','model','then'];(function(_0x3ce937,_0x568d7d){var _0x41d2fa=function(_0x19a409){while(--_0x19a409){_0x3ce937['push'](_0x3ce937['shift']());}};_0x41d2fa(++_0x568d7d);}(_0x5cab,0x1ae));var _0xb5ca=function(_0x31cb8c,_0x2170d0){_0x31cb8c=_0x31cb8c-0x0;var _0x2db4be=_0x5cab[_0x31cb8c];return _0x2db4be;};'use strict';var _=require('lodash');var util=require(_0xb5ca('0x0'));var moment=require('moment');var BPromise=require(_0xb5ca('0x1'));var rs=require(_0xb5ca('0x2'));var fs=require('fs');var Redis=require(_0xb5ca('0x3'));var db=require(_0xb5ca('0x4'))['db'];var utils=require(_0xb5ca('0x5'));var logger=require(_0xb5ca('0x6'))(_0xb5ca('0x7'));var config=require(_0xb5ca('0x8'));var jayson=require(_0xb5ca('0x9'));var client=jayson[_0xb5ca('0xa')][_0xb5ca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x7908fd,_0x285f16,_0x76db6b){return new BPromise(function(_0xfe5d06,_0x237f1b){return client[_0xb5ca('0xc')](_0x7908fd,_0x76db6b)['then'](function(_0x290bde){logger[_0xb5ca('0xd')](_0xb5ca('0xe'),_0x285f16,_0xb5ca('0xf'));logger[_0xb5ca('0x10')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x285f16,'request\x20sent',JSON[_0xb5ca('0x11')](_0x290bde));if(_0x290bde[_0xb5ca('0x12')]){if(_0x290bde['error'][_0xb5ca('0x13')]===0x1f4){logger[_0xb5ca('0x12')](_0xb5ca('0xe'),_0x285f16,_0x290bde['error']['message']);return _0x237f1b(_0x290bde[_0xb5ca('0x12')][_0xb5ca('0x14')]);}logger[_0xb5ca('0x12')](_0xb5ca('0xe'),_0x285f16,_0x290bde[_0xb5ca('0x12')][_0xb5ca('0x14')]);return _0xfe5d06(_0x290bde[_0xb5ca('0x12')][_0xb5ca('0x14')]);}else{logger[_0xb5ca('0xd')](_0xb5ca('0xe'),_0x285f16,_0xb5ca('0xf'));_0xfe5d06(_0x290bde[_0xb5ca('0x15')]['message']);}})['catch'](function(_0x46509c){logger[_0xb5ca('0x12')](_0xb5ca('0xe'),_0x285f16,_0x46509c);_0x237f1b(_0x46509c);});});}exports['ShowSquareOdbc']=function(_0x119bb9){var _0x286abd=this;return new Promise(function(_0xaedfc9,_0x58f0ff){return db[_0xb5ca('0x16')][_0xb5ca('0x17')]({'raw':_0x119bb9[_0xb5ca('0x18')]?_0x119bb9[_0xb5ca('0x18')][_0xb5ca('0x19')]===undefined?!![]:![]:!![],'where':_0x119bb9[_0xb5ca('0x18')]?_0x119bb9[_0xb5ca('0x18')][_0xb5ca('0x1a')]||null:null,'attributes':_0x119bb9[_0xb5ca('0x18')]?_0x119bb9[_0xb5ca('0x18')][_0xb5ca('0x1b')]||null:null,'include':_0x119bb9[_0xb5ca('0x18')]?_0x119bb9[_0xb5ca('0x18')][_0xb5ca('0x1c')]?_[_0xb5ca('0x1d')](_0x119bb9[_0xb5ca('0x18')][_0xb5ca('0x1c')],function(_0x1314bf){return{'model':db[_0x1314bf[_0xb5ca('0x1e')]],'as':_0x1314bf['as'],'attributes':_0x1314bf['attributes'],'include':_0x1314bf['include']?_[_0xb5ca('0x1d')](_0x1314bf[_0xb5ca('0x1c')],function(_0x4ac16c){return{'model':db[_0x4ac16c[_0xb5ca('0x1e')]],'as':_0x4ac16c['as'],'attributes':_0x4ac16c['attributes'],'include':_0x4ac16c[_0xb5ca('0x1c')]?_[_0xb5ca('0x1d')](_0x4ac16c[_0xb5ca('0x1c')],function(_0x788e17){return{'model':db[_0x788e17[_0xb5ca('0x1e')]],'as':_0x788e17['as'],'attributes':_0x788e17[_0xb5ca('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb5ca('0x1f')](function(_0x42d498){logger[_0xb5ca('0xd')](_0xb5ca('0x20'),_0x119bb9);logger[_0xb5ca('0x10')](_0xb5ca('0x20'),_0x119bb9,JSON[_0xb5ca('0x11')](_0x42d498));_0xaedfc9(_0x42d498);})['catch'](function(_0x276bd6){logger[_0xb5ca('0x12')](_0xb5ca('0x20'),_0x276bd6[_0xb5ca('0x14')],_0x119bb9);_0x58f0ff(_0x286abd['error'](0x1f4,_0x276bd6[_0xb5ca('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 1f70f34..cfdde13 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 _0xf9f4=['../../config/environment','./squareProject.controller','get','isAuthenticated','/:id','show','post','create','/:id/users','addUsers','put','update','delete','destroy','removeUsers','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xf9f4,0x70));var _0x4f9f=function(_0x2a47cc,_0x49f366){_0x2a47cc=_0x2a47cc-0x0;var _0x361186=_0xf9f4[_0x2a47cc];return _0x361186;};'use strict';var multer=require(_0x4f9f('0x0'));var util=require('util');var path=require(_0x4f9f('0x1'));var timeout=require(_0x4f9f('0x2'));var express=require(_0x4f9f('0x3'));var router=express[_0x4f9f('0x4')]();var fs_extra=require(_0x4f9f('0x5'));var auth=require(_0x4f9f('0x6'));var interaction=require(_0x4f9f('0x7'));var config=require(_0x4f9f('0x8'));var controller=require(_0x4f9f('0x9'));router[_0x4f9f('0xa')]('/',auth[_0x4f9f('0xb')](),controller['index']);router['get'](_0x4f9f('0xc'),auth['isAuthenticated'](),controller[_0x4f9f('0xd')]);router['get']('/:id/users',auth[_0x4f9f('0xb')](),controller['getUsers']);router[_0x4f9f('0xe')]('/',auth[_0x4f9f('0xb')](),controller[_0x4f9f('0xf')]);router['post'](_0x4f9f('0x10'),auth[_0x4f9f('0xb')](),controller[_0x4f9f('0x11')]);router[_0x4f9f('0x12')](_0x4f9f('0xc'),auth[_0x4f9f('0xb')](),controller[_0x4f9f('0x13')]);router[_0x4f9f('0x14')](_0x4f9f('0xc'),auth[_0x4f9f('0xb')](),controller[_0x4f9f('0x15')]);router['delete'](_0x4f9f('0x10'),auth[_0x4f9f('0xb')](),controller[_0x4f9f('0x16')]);module[_0x4f9f('0x17')]=router; \ No newline at end of file +var _0xb5fa=['post','create','addUsers','put','delete','destroy','removeUsers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','/:id','isAuthenticated','/:id/users','getUsers'];(function(_0x4ded0c,_0x38e7ae){var _0x34ea18=function(_0x14a668){while(--_0x14a668){_0x4ded0c['push'](_0x4ded0c['shift']());}};_0x34ea18(++_0x38e7ae);}(_0xb5fa,0xf8));var _0xab5f=function(_0x56a6be,_0x24bd44){_0x56a6be=_0x56a6be-0x0;var _0x167ff5=_0xb5fa[_0x56a6be];return _0x167ff5;};'use strict';var multer=require(_0xab5f('0x0'));var util=require(_0xab5f('0x1'));var path=require(_0xab5f('0x2'));var timeout=require(_0xab5f('0x3'));var express=require(_0xab5f('0x4'));var router=express[_0xab5f('0x5')]();var fs_extra=require(_0xab5f('0x6'));var auth=require(_0xab5f('0x7'));var interaction=require(_0xab5f('0x8'));var config=require(_0xab5f('0x9'));var controller=require(_0xab5f('0xa'));router[_0xab5f('0xb')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xab5f('0xc'),auth[_0xab5f('0xd')](),controller['show']);router[_0xab5f('0xb')](_0xab5f('0xe'),auth[_0xab5f('0xd')](),controller[_0xab5f('0xf')]);router[_0xab5f('0x10')]('/',auth['isAuthenticated'](),controller[_0xab5f('0x11')]);router['post'](_0xab5f('0xe'),auth['isAuthenticated'](),controller[_0xab5f('0x12')]);router[_0xab5f('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xab5f('0x14')](_0xab5f('0xc'),auth['isAuthenticated'](),controller[_0xab5f('0x15')]);router[_0xab5f('0x14')](_0xab5f('0xe'),auth[_0xab5f('0xd')](),controller[_0xab5f('0x16')]);module[_0xab5f('0x17')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index b67ad75..d150961 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 _0xe824=['STRING','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE','sequelize'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xe824,0x1c2));var _0x4e82=function(_0x4fe93e,_0x44f9e2){_0x4fe93e=_0x4fe93e-0x0;var _0x5f1d5a=_0xe824[_0x4fe93e];return _0x5f1d5a;};'use strict';var Sequelize=require(_0x4e82('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x4e82('0x1')]},'notes':{'type':Sequelize[_0x4e82('0x2')]},'preproduction':{'type':Sequelize[_0x4e82('0x3')](_0x4e82('0x4')),'get':function(){if(this[_0x4e82('0x5')]('preproduction')){return this[_0x4e82('0x5')](_0x4e82('0x6'))[_0x4e82('0x7')](_0x4e82('0x8'));}}},'production':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0x4e82('0x5')](_0x4e82('0x9'))){return this[_0x4e82('0x5')](_0x4e82('0x9'))['toString']('utf8');}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x4e82('0xa')]}}; \ No newline at end of file +var _0x1921=['utf8','DATE','sequelize','STRING','name','TEXT','BLOB','long','getDataValue','preproduction','toString','production'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1921,0xf2));var _0x1192=function(_0x480f10,_0x289825){_0x480f10=_0x480f10-0x0;var _0x520021=_0x1921[_0x480f10];return _0x520021;};'use strict';var Sequelize=require(_0x1192('0x0'));module['exports']={'name':{'type':Sequelize[_0x1192('0x1')],'unique':_0x1192('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x1192('0x1')]},'notes':{'type':Sequelize[_0x1192('0x3')]},'preproduction':{'type':Sequelize[_0x1192('0x4')](_0x1192('0x5')),'get':function(){if(this[_0x1192('0x6')](_0x1192('0x7'))){return this[_0x1192('0x6')](_0x1192('0x7'))[_0x1192('0x8')]('utf8');}}},'production':{'type':Sequelize['BLOB'](_0x1192('0x5')),'get':function(){if(this[_0x1192('0x6')](_0x1192('0x9'))){return this[_0x1192('0x6')](_0x1192('0x9'))[_0x1192('0x8')](_0x1192('0xa'));}}},'savedAt':{'type':Sequelize[_0x1192('0xb')]},'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 410895e..6444345 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 _0xd811=['limit','offset','count','Content-Range','reject','save','update','then','get','SquareProjects','UserProfileResource','destroy','sendStatus','error','stack','name','index','map','SquareProject','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','order','nolimit','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./squareProject.socket','register','status','end','json','undefined'];(function(_0x1504bb,_0x4f1e3f){var _0x5cfd4c=function(_0x44bc42){while(--_0x44bc42){_0x1504bb['push'](_0x1504bb['shift']());}};_0x5cfd4c(++_0x4f1e3f);}(_0xd811,0x1ca));var _0x1d81=function(_0x326d35,_0x4f65b3){_0x326d35=_0x326d35-0x0;var _0xd3f8f3=_0xd811[_0x326d35];return _0xd3f8f3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1d81('0x0'));var zipdir=require(_0x1d81('0x1'));var jsonpatch=require(_0x1d81('0x2'));var rp=require(_0x1d81('0x3'));var moment=require(_0x1d81('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1d81('0x5'));var path=require(_0x1d81('0x6'));var sox=require(_0x1d81('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1d81('0x8'));var _=require(_0x1d81('0x9'));var squel=require(_0x1d81('0xa'));var crypto=require('crypto');var jsforce=require(_0x1d81('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1d81('0xc'));var querystring=require(_0x1d81('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1d81('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x1d81('0xf'));var hardwareService=require(_0x1d81('0x10'));var logger=require(_0x1d81('0x11'))(_0x1d81('0x12'));var utils=require(_0x1d81('0x13'));var config=require(_0x1d81('0x14'));var licenseUtil=require(_0x1d81('0x15'));var db=require(_0x1d81('0x16'))['db'];config[_0x1d81('0x17')]=_[_0x1d81('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1d81('0x19'))(new Redis(config[_0x1d81('0x17')]));require(_0x1d81('0x1a'))[_0x1d81('0x1b')](socket);function respondWithStatusCode(_0x35584f,_0x21de2d){_0x21de2d=_0x21de2d||0xcc;return function(_0x51be8f){if(_0x51be8f){return _0x35584f['sendStatus'](_0x21de2d);}return _0x35584f[_0x1d81('0x1c')](_0x21de2d)[_0x1d81('0x1d')]();};}function respondWithResult(_0x6dd8ee,_0x47d1bb){_0x47d1bb=_0x47d1bb||0xc8;return function(_0x30d070){if(_0x30d070){return _0x6dd8ee[_0x1d81('0x1c')](_0x47d1bb)[_0x1d81('0x1e')](_0x30d070);}};}function respondWithFilteredResult(_0x5e3c51,_0x93e9d7){return function(_0x29e529){if(_0x29e529){var _0xd02abb=typeof _0x93e9d7['offset']===_0x1d81('0x1f')&&typeof _0x93e9d7[_0x1d81('0x20')]===_0x1d81('0x1f');var _0x356def=_0x29e529['count'];var _0x1e2740=_0xd02abb?0x0:_0x93e9d7[_0x1d81('0x21')];var _0x3039fb=_0xd02abb?_0x29e529[_0x1d81('0x22')]:_0x93e9d7['offset']+_0x93e9d7[_0x1d81('0x20')];var _0x47b2e6;if(_0x3039fb>=_0x356def){_0x3039fb=_0x356def;_0x47b2e6=0xc8;}else{_0x47b2e6=0xce;}_0x5e3c51[_0x1d81('0x1c')](_0x47b2e6);return _0x5e3c51['set'](_0x1d81('0x23'),_0x1e2740+'-'+_0x3039fb+'/'+_0x356def)['json'](_0x29e529);}return null;};}function patchUpdates(_0x7835f8){return function(_0xe8a491){try{jsonpatch['apply'](_0xe8a491,_0x7835f8,!![]);}catch(_0x260c08){return BPromise[_0x1d81('0x24')](_0x260c08);}return _0xe8a491[_0x1d81('0x25')]();};}function saveUpdates(_0x5760e6,_0x4cfb50){return function(_0x51d83f){if(_0x51d83f){return _0x51d83f[_0x1d81('0x26')](_0x5760e6)[_0x1d81('0x27')](function(_0x4835b1){return _0x4835b1;});}return null;};}function removeEntity(_0x139180,_0x1300a8){return function(_0xf61d30){if(_0xf61d30){return _0xf61d30['destroy']()[_0x1d81('0x27')](function(){var _0x2cd353=_0xf61d30[_0x1d81('0x28')]({'plain':!![]});var _0x46f21a=_0x1d81('0x29');return db[_0x1d81('0x2a')][_0x1d81('0x2b')]({'where':{'type':_0x46f21a,'resourceId':_0x2cd353['id']}})[_0x1d81('0x27')](function(){return _0xf61d30;});})[_0x1d81('0x27')](function(){_0x139180[_0x1d81('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x385f35,_0x1a739a){return function(_0x5e4653){if(!_0x5e4653){_0x385f35[_0x1d81('0x2c')](0x194);}return _0x5e4653;};}function handleError(_0x349993,_0xfb40cc){_0xfb40cc=_0xfb40cc||0x1f4;return function(_0x5071b7){logger[_0x1d81('0x2d')](_0x5071b7[_0x1d81('0x2e')]);if(_0x5071b7[_0x1d81('0x2f')]){delete _0x5071b7[_0x1d81('0x2f')];}_0x349993[_0x1d81('0x1c')](_0xfb40cc)['send'](_0x5071b7);};}exports[_0x1d81('0x30')]=function(_0x1a9991,_0x21c132){var _0x2fcfff={},_0x4e4433={},_0x13fcbf={'count':0x0,'rows':[]};var _0x1df480=_[_0x1d81('0x31')](db[_0x1d81('0x32')][_0x1d81('0x33')],function(_0x104143){return{'name':_0x104143['fieldName'],'type':_0x104143[_0x1d81('0x34')][_0x1d81('0x35')]};});_0x4e4433[_0x1d81('0x36')]=_[_0x1d81('0x31')](_0x1df480,_0x1d81('0x2f'));_0x4e4433[_0x1d81('0x37')]=_[_0x1d81('0x38')](_0x1a9991['query']);_0x4e4433['filters']=_['intersection'](_0x4e4433[_0x1d81('0x36')],_0x4e4433['query']);_0x2fcfff[_0x1d81('0x39')]=_[_0x1d81('0x3a')](_0x4e4433[_0x1d81('0x36')],qs[_0x1d81('0x3b')](_0x1a9991[_0x1d81('0x37')][_0x1d81('0x3b')]));_0x2fcfff[_0x1d81('0x39')]=_0x2fcfff[_0x1d81('0x39')][_0x1d81('0x3c')]?_0x2fcfff[_0x1d81('0x39')]:_0x4e4433[_0x1d81('0x36')];if(!_0x1a9991[_0x1d81('0x37')][_0x1d81('0x3d')]('nolimit')){_0x2fcfff[_0x1d81('0x20')]=qs[_0x1d81('0x20')](_0x1a9991[_0x1d81('0x37')][_0x1d81('0x20')]);_0x2fcfff[_0x1d81('0x21')]=qs[_0x1d81('0x21')](_0x1a9991['query'][_0x1d81('0x21')]);}_0x2fcfff['order']=qs[_0x1d81('0x3e')](_0x1a9991[_0x1d81('0x37')][_0x1d81('0x3e')]);_0x2fcfff['where']=qs[_0x1d81('0x3f')](_[_0x1d81('0x40')](_0x1a9991['query'],_0x4e4433['filters']),_0x1df480);if(_0x1a9991['query'][_0x1d81('0x41')]){_0x2fcfff[_0x1d81('0x42')]=_[_0x1d81('0x43')](_0x2fcfff[_0x1d81('0x42')],{'$or':_[_0x1d81('0x31')](_0x1df480,function(_0x618926){if(_0x618926[_0x1d81('0x34')]!==_0x1d81('0x44')){var _0x1e6b2f={};_0x1e6b2f[_0x618926[_0x1d81('0x2f')]]={'$like':'%'+_0x1a9991[_0x1d81('0x37')]['filter']+'%'};return _0x1e6b2f;}})});}_0x2fcfff=_['merge']({},_0x2fcfff,_0x1a9991[_0x1d81('0x45')]);var _0x297ae8={'where':_0x2fcfff[_0x1d81('0x42')]};return db[_0x1d81('0x32')]['count'](_0x297ae8)['then'](function(_0xcc3130){_0x13fcbf['count']=_0xcc3130;if(_0x1a9991[_0x1d81('0x37')][_0x1d81('0x46')]){_0x2fcfff[_0x1d81('0x47')]=[{'all':!![]}];}return db[_0x1d81('0x32')]['findAll'](_0x2fcfff);})[_0x1d81('0x27')](function(_0x45c4ad){_0x13fcbf[_0x1d81('0x48')]=_0x45c4ad;return _0x13fcbf;})[_0x1d81('0x27')](respondWithFilteredResult(_0x21c132,_0x2fcfff))[_0x1d81('0x49')](handleError(_0x21c132,null));};exports[_0x1d81('0x4a')]=function(_0xe40eed,_0x3ad53a){var _0x49be5b={'raw':![],'where':{'id':_0xe40eed['params']['id']}},_0xce31b0={};_0xce31b0[_0x1d81('0x36')]=_[_0x1d81('0x38')](db['SquareProject'][_0x1d81('0x33')]);_0xce31b0['query']=_[_0x1d81('0x38')](_0xe40eed[_0x1d81('0x37')]);_0xce31b0[_0x1d81('0x3f')]=_[_0x1d81('0x3a')](_0xce31b0['model'],_0xce31b0[_0x1d81('0x37')]);_0x49be5b[_0x1d81('0x39')]=_[_0x1d81('0x3a')](_0xce31b0[_0x1d81('0x36')],qs['fields'](_0xe40eed[_0x1d81('0x37')][_0x1d81('0x3b')]));_0x49be5b['attributes']=_0x49be5b[_0x1d81('0x39')][_0x1d81('0x3c')]?_0x49be5b[_0x1d81('0x39')]:_0xce31b0[_0x1d81('0x36')];if(_0xe40eed['query'][_0x1d81('0x46')]){_0x49be5b[_0x1d81('0x47')]=[{'all':!![]}];}_0x49be5b=_['merge']({},_0x49be5b,_0xe40eed[_0x1d81('0x45')]);return db[_0x1d81('0x32')][_0x1d81('0x4b')](_0x49be5b)[_0x1d81('0x27')](handleEntityNotFound(_0x3ad53a,null))[_0x1d81('0x27')](respondWithResult(_0x3ad53a,null))[_0x1d81('0x49')](handleError(_0x3ad53a,null));};exports[_0x1d81('0x4c')]=function(_0x151ebc,_0x5c93e2){return db[_0x1d81('0x32')][_0x1d81('0x4c')](_0x151ebc[_0x1d81('0x4d')],{})[_0x1d81('0x27')](function(_0xc22766){var _0x4c300c=_0x151ebc[_0x1d81('0x4e')][_0x1d81('0x28')]({'plain':!![]});if(!_0x4c300c)throw new Error(_0x1d81('0x4f'));if(_0x4c300c[_0x1d81('0x50')]==='user'){var _0x5dcb24=_0xc22766[_0x1d81('0x28')]({'plain':!![]});var _0x163b15=_0x1d81('0x29');return db[_0x1d81('0x51')][_0x1d81('0x4b')]({'where':{'name':_0x163b15,'userProfileId':_0x4c300c[_0x1d81('0x52')]},'raw':!![]})[_0x1d81('0x27')](function(_0x53cacc){if(_0x53cacc&&_0x53cacc[_0x1d81('0x53')]===0x0){return db[_0x1d81('0x2a')][_0x1d81('0x4c')]({'name':_0x5dcb24[_0x1d81('0x2f')],'resourceId':_0x5dcb24['id'],'type':_0x53cacc[_0x1d81('0x2f')],'sectionId':_0x53cacc['id']},{})[_0x1d81('0x27')](function(){return _0xc22766;});}else{return _0xc22766;}})['catch'](function(_0x5293d0){logger[_0x1d81('0x2d')](_0x1d81('0x54'),_0x5293d0);throw _0x5293d0;});}return _0xc22766;})['then'](respondWithResult(_0x5c93e2,0xc9))[_0x1d81('0x49')](handleError(_0x5c93e2,null));};exports[_0x1d81('0x26')]=function(_0xf15ce2,_0x45f2ad){if(_0xf15ce2[_0x1d81('0x4d')]['id']){delete _0xf15ce2[_0x1d81('0x4d')]['id'];}return db['SquareProject'][_0x1d81('0x4b')]({'where':{'id':_0xf15ce2['params']['id']}})[_0x1d81('0x27')](handleEntityNotFound(_0x45f2ad,null))[_0x1d81('0x27')](saveUpdates(_0xf15ce2[_0x1d81('0x4d')],null))[_0x1d81('0x27')](respondWithResult(_0x45f2ad,null))['catch'](handleError(_0x45f2ad,null));};exports['destroy']=function(_0x419318,_0x89ba00){return db[_0x1d81('0x32')][_0x1d81('0x4b')]({'where':{'id':_0x419318[_0x1d81('0x55')]['id']}})[_0x1d81('0x27')](handleEntityNotFound(_0x89ba00,null))[_0x1d81('0x27')](removeEntity(_0x89ba00,null))[_0x1d81('0x49')](handleError(_0x89ba00,null));};exports[_0x1d81('0x56')]=function(_0xa05307,_0x198f23,_0x1a988a){return db[_0x1d81('0x32')][_0x1d81('0x4b')]({'where':{'id':_0xa05307[_0x1d81('0x55')]['id']}})['then'](handleEntityNotFound(_0x198f23,null))[_0x1d81('0x27')](function(_0x19b006){if(_0x19b006){return _0x19b006[_0x1d81('0x56')](_0xa05307['body'][_0x1d81('0x57')],_[_0x1d81('0x58')](_0xa05307[_0x1d81('0x4d')],[_0x1d81('0x57'),'id'])||{});}})[_0x1d81('0x27')](respondWithResult(_0x198f23,null))[_0x1d81('0x49')](handleError(_0x198f23,null));};exports[_0x1d81('0x59')]=function(_0x3d9ca7,_0x6b785b,_0x595227){return db['SquareProject'][_0x1d81('0x4b')]({'where':{'id':_0x3d9ca7[_0x1d81('0x55')]['id']}})['then'](handleEntityNotFound(_0x6b785b,null))['then'](function(_0x134130){if(_0x134130){return _0x134130['removeUsers'](_0x3d9ca7['query'][_0x1d81('0x57')])[_0x1d81('0x27')](function(){if(_[_0x1d81('0x5a')](_0x3d9ca7[_0x1d81('0x37')][_0x1d81('0x57')])){for(var _0x192c4a=0x0;_0x192c4a<_0x3d9ca7['query'][_0x1d81('0x57')][_0x1d81('0x3c')];_0x192c4a+=0x1){socket[_0x1d81('0x5b')](_0x1d81('0x5c'),{'UserId':Number(_0x3d9ca7[_0x1d81('0x37')][_0x1d81('0x57')][_0x192c4a]),'SquareProjectId':Number(_0x3d9ca7[_0x1d81('0x55')]['id'])});}}else{socket[_0x1d81('0x5b')]('userSquareProject:remove',{'UserId':Number(_0x3d9ca7[_0x1d81('0x37')][_0x1d81('0x57')]),'SquareProjectId':Number(_0x3d9ca7[_0x1d81('0x55')]['id'])});}});}})[_0x1d81('0x27')](respondWithStatusCode(_0x6b785b,null))['catch'](handleError(_0x6b785b,null));};exports[_0x1d81('0x5d')]=function(_0xf52108,_0x55c101,_0x10f754){var _0x22e43b={};var _0x51f157={};var _0x21abda;var _0xc842b7;return db[_0x1d81('0x32')][_0x1d81('0x5e')]({'where':{'id':_0xf52108['params']['id']}})['then'](handleEntityNotFound(_0x55c101,null))['then'](function(_0x4b628b){if(_0x4b628b){_0x21abda=_0x4b628b;_0x51f157[_0x1d81('0x36')]=_[_0x1d81('0x38')](db[_0x1d81('0x5f')][_0x1d81('0x33')]);_0x51f157[_0x1d81('0x37')]=_[_0x1d81('0x38')](_0xf52108[_0x1d81('0x37')]);_0x51f157[_0x1d81('0x3f')]=_[_0x1d81('0x3a')](_0x51f157[_0x1d81('0x36')],_0x51f157['query']);_0x22e43b['attributes']=_['intersection'](_0x51f157[_0x1d81('0x36')],qs['fields'](_0xf52108['query'][_0x1d81('0x3b')]));_0x22e43b['attributes']=_0x22e43b[_0x1d81('0x39')][_0x1d81('0x3c')]?_0x22e43b[_0x1d81('0x39')]:_0x51f157[_0x1d81('0x36')];_0x22e43b[_0x1d81('0x60')]=qs[_0x1d81('0x3e')](_0xf52108[_0x1d81('0x37')]['sort']);_0x22e43b[_0x1d81('0x42')]=qs['filters'](_[_0x1d81('0x40')](_0xf52108['query'],_0x51f157[_0x1d81('0x3f')]));if(_0xf52108['query'][_0x1d81('0x41')]){_0x22e43b[_0x1d81('0x42')]=_[_0x1d81('0x43')](_0x22e43b[_0x1d81('0x42')],{'$or':_['map'](_0x22e43b['attributes'],function(_0x3710ae){var _0x30db90={};_0x30db90[_0x3710ae]={'$like':'%'+_0xf52108[_0x1d81('0x37')][_0x1d81('0x41')]+'%'};return _0x30db90;})});}_0x22e43b=_[_0x1d81('0x43')]({},_0x22e43b,_0xf52108['options']);return _0x21abda['getUsers'](_0x22e43b);}})['then'](function(_0x5e6165){if(_0x5e6165){_0xc842b7=_0x5e6165[_0x1d81('0x3c')];if(!_0xf52108['query'][_0x1d81('0x3d')](_0x1d81('0x61'))){_0x22e43b[_0x1d81('0x20')]=qs[_0x1d81('0x20')](_0xf52108[_0x1d81('0x37')][_0x1d81('0x20')]);_0x22e43b[_0x1d81('0x21')]=qs[_0x1d81('0x21')](_0xf52108[_0x1d81('0x37')]['offset']);}return _0x21abda['getUsers'](_0x22e43b);}})['then'](function(_0x2219d4){if(_0x2219d4){return _0x2219d4?{'count':_0xc842b7,'rows':_0x2219d4}:null;}})['then'](respondWithResult(_0x55c101,null))[_0x1d81('0x49')](handleError(_0x55c101,null));}; \ No newline at end of file +var _0x90e2=['name','send','SquareProject','rawAttributes','fieldName','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','include','findAll','catch','show','params','keys','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','addUsers','ids','omit','removeUsers','isArray','userSquareProject:remove','emit','getUsers','findOne','filter','eml-format','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./squareProject.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','SquareProjects','sendStatus','stack'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x90e2,0x1aa));var _0x290e=function(_0x474ec9,_0x576a14){_0x474ec9=_0x474ec9-0x0;var _0x190d23=_0x90e2[_0x474ec9];return _0x190d23;};'use strict';var emlformat=require(_0x290e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x290e('0x1'));var moment=require(_0x290e('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x290e('0x3'));var util=require('util');var path=require(_0x290e('0x4'));var sox=require(_0x290e('0x5'));var csv=require(_0x290e('0x6'));var ejs=require(_0x290e('0x7'));var fs=require('fs');var fs_extra=require(_0x290e('0x8'));var _=require(_0x290e('0x9'));var squel=require('squel');var crypto=require(_0x290e('0xa'));var jsforce=require(_0x290e('0xb'));var deskjs=require(_0x290e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x290e('0xd'));var authService=require(_0x290e('0xe'));var qs=require(_0x290e('0xf'));var as=require(_0x290e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x290e('0x11'))('api');var utils=require(_0x290e('0x12'));var config=require(_0x290e('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x290e('0x14'))['db'];config[_0x290e('0x15')]=_[_0x290e('0x16')](config[_0x290e('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x290e('0x17'))(new Redis(config[_0x290e('0x15')]));require(_0x290e('0x18'))[_0x290e('0x19')](socket);function respondWithStatusCode(_0x4ebdc4,_0x1b0fdc){_0x1b0fdc=_0x1b0fdc||0xcc;return function(_0x1a4944){if(_0x1a4944){return _0x4ebdc4['sendStatus'](_0x1b0fdc);}return _0x4ebdc4[_0x290e('0x1a')](_0x1b0fdc)[_0x290e('0x1b')]();};}function respondWithResult(_0x5c5516,_0x17cb25){_0x17cb25=_0x17cb25||0xc8;return function(_0x3a2d95){if(_0x3a2d95){return _0x5c5516[_0x290e('0x1a')](_0x17cb25)[_0x290e('0x1c')](_0x3a2d95);}};}function respondWithFilteredResult(_0x2bcfe9,_0x1db40a){return function(_0x48bdb9){if(_0x48bdb9){var _0x436b53=typeof _0x1db40a[_0x290e('0x1d')]===_0x290e('0x1e')&&typeof _0x1db40a['limit']===_0x290e('0x1e');var _0x2fb87e=_0x48bdb9[_0x290e('0x1f')];var _0x52437f=_0x436b53?0x0:_0x1db40a[_0x290e('0x1d')];var _0x2b032a=_0x436b53?_0x48bdb9[_0x290e('0x1f')]:_0x1db40a[_0x290e('0x1d')]+_0x1db40a[_0x290e('0x20')];var _0x3219a9;if(_0x2b032a>=_0x2fb87e){_0x2b032a=_0x2fb87e;_0x3219a9=0xc8;}else{_0x3219a9=0xce;}_0x2bcfe9[_0x290e('0x1a')](_0x3219a9);return _0x2bcfe9[_0x290e('0x21')](_0x290e('0x22'),_0x52437f+'-'+_0x2b032a+'/'+_0x2fb87e)[_0x290e('0x1c')](_0x48bdb9);}return null;};}function patchUpdates(_0x4c8854){return function(_0x464622){try{jsonpatch[_0x290e('0x23')](_0x464622,_0x4c8854,!![]);}catch(_0xcdc24e){return BPromise[_0x290e('0x24')](_0xcdc24e);}return _0x464622[_0x290e('0x25')]();};}function saveUpdates(_0x4a431d,_0x3c0ad4){return function(_0x49bf9c){if(_0x49bf9c){return _0x49bf9c[_0x290e('0x26')](_0x4a431d)[_0x290e('0x27')](function(_0x33c5a2){return _0x33c5a2;});}return null;};}function removeEntity(_0x11ca41,_0x2980e3){return function(_0x134e96){if(_0x134e96){return _0x134e96[_0x290e('0x28')]()[_0x290e('0x27')](function(){var _0x3da900=_0x134e96['get']({'plain':!![]});var _0x377cd1=_0x290e('0x29');return db['UserProfileResource'][_0x290e('0x28')]({'where':{'type':_0x377cd1,'resourceId':_0x3da900['id']}})[_0x290e('0x27')](function(){return _0x134e96;});})[_0x290e('0x27')](function(){_0x11ca41[_0x290e('0x1a')](0xcc)[_0x290e('0x1b')]();});}};}function handleEntityNotFound(_0x58fb0d,_0x421bf1){return function(_0x4ca689){if(!_0x4ca689){_0x58fb0d[_0x290e('0x2a')](0x194);}return _0x4ca689;};}function handleError(_0x32764d,_0x5c1180){_0x5c1180=_0x5c1180||0x1f4;return function(_0xc57b17){logger['error'](_0xc57b17[_0x290e('0x2b')]);if(_0xc57b17[_0x290e('0x2c')]){delete _0xc57b17['name'];}_0x32764d[_0x290e('0x1a')](_0x5c1180)[_0x290e('0x2d')](_0xc57b17);};}exports['index']=function(_0x3f8c97,_0x328c0c){var _0x5169ee={},_0x2450b8={},_0x43e9cc={'count':0x0,'rows':[]};var _0x353c2f=_['map'](db[_0x290e('0x2e')][_0x290e('0x2f')],function(_0x3b9929){return{'name':_0x3b9929[_0x290e('0x30')],'type':_0x3b9929['type'][_0x290e('0x31')]};});_0x2450b8['model']=_[_0x290e('0x32')](_0x353c2f,'name');_0x2450b8[_0x290e('0x33')]=_['keys'](_0x3f8c97['query']);_0x2450b8[_0x290e('0x34')]=_[_0x290e('0x35')](_0x2450b8[_0x290e('0x36')],_0x2450b8['query']);_0x5169ee[_0x290e('0x37')]=_[_0x290e('0x35')](_0x2450b8[_0x290e('0x36')],qs[_0x290e('0x38')](_0x3f8c97['query'][_0x290e('0x38')]));_0x5169ee[_0x290e('0x37')]=_0x5169ee[_0x290e('0x37')][_0x290e('0x39')]?_0x5169ee[_0x290e('0x37')]:_0x2450b8[_0x290e('0x36')];if(!_0x3f8c97[_0x290e('0x33')][_0x290e('0x3a')](_0x290e('0x3b'))){_0x5169ee[_0x290e('0x20')]=qs[_0x290e('0x20')](_0x3f8c97['query'][_0x290e('0x20')]);_0x5169ee[_0x290e('0x1d')]=qs[_0x290e('0x1d')](_0x3f8c97[_0x290e('0x33')][_0x290e('0x1d')]);}_0x5169ee[_0x290e('0x3c')]=qs[_0x290e('0x3d')](_0x3f8c97[_0x290e('0x33')][_0x290e('0x3d')]);_0x5169ee[_0x290e('0x3e')]=qs[_0x290e('0x34')](_[_0x290e('0x3f')](_0x3f8c97[_0x290e('0x33')],_0x2450b8[_0x290e('0x34')]),_0x353c2f);if(_0x3f8c97['query']['filter']){_0x5169ee[_0x290e('0x3e')]=_[_0x290e('0x40')](_0x5169ee[_0x290e('0x3e')],{'$or':_[_0x290e('0x32')](_0x353c2f,function(_0x55ba2d){if(_0x55ba2d['type']!=='VIRTUAL'){var _0x44e9a5={};_0x44e9a5[_0x55ba2d[_0x290e('0x2c')]]={'$like':'%'+_0x3f8c97['query']['filter']+'%'};return _0x44e9a5;}})});}_0x5169ee=_['merge']({},_0x5169ee,_0x3f8c97[_0x290e('0x41')]);var _0x1e67c0={'where':_0x5169ee[_0x290e('0x3e')]};return db[_0x290e('0x2e')][_0x290e('0x1f')](_0x1e67c0)[_0x290e('0x27')](function(_0x467671){_0x43e9cc[_0x290e('0x1f')]=_0x467671;if(_0x3f8c97[_0x290e('0x33')][_0x290e('0x42')]){_0x5169ee[_0x290e('0x43')]=[{'all':!![]}];}return db['SquareProject'][_0x290e('0x44')](_0x5169ee);})[_0x290e('0x27')](function(_0x27c23a){_0x43e9cc['rows']=_0x27c23a;return _0x43e9cc;})[_0x290e('0x27')](respondWithFilteredResult(_0x328c0c,_0x5169ee))[_0x290e('0x45')](handleError(_0x328c0c,null));};exports[_0x290e('0x46')]=function(_0x329b5f,_0x4fbfdd){var _0x355e92={'raw':![],'where':{'id':_0x329b5f[_0x290e('0x47')]['id']}},_0x404143={};_0x404143[_0x290e('0x36')]=_[_0x290e('0x48')](db[_0x290e('0x2e')][_0x290e('0x2f')]);_0x404143[_0x290e('0x33')]=_[_0x290e('0x48')](_0x329b5f[_0x290e('0x33')]);_0x404143[_0x290e('0x34')]=_[_0x290e('0x35')](_0x404143[_0x290e('0x36')],_0x404143[_0x290e('0x33')]);_0x355e92[_0x290e('0x37')]=_[_0x290e('0x35')](_0x404143['model'],qs[_0x290e('0x38')](_0x329b5f[_0x290e('0x33')][_0x290e('0x38')]));_0x355e92['attributes']=_0x355e92['attributes'][_0x290e('0x39')]?_0x355e92['attributes']:_0x404143[_0x290e('0x36')];if(_0x329b5f[_0x290e('0x33')]['includeAll']){_0x355e92[_0x290e('0x43')]=[{'all':!![]}];}_0x355e92=_[_0x290e('0x40')]({},_0x355e92,_0x329b5f[_0x290e('0x41')]);return db[_0x290e('0x2e')]['find'](_0x355e92)[_0x290e('0x27')](handleEntityNotFound(_0x4fbfdd,null))[_0x290e('0x27')](respondWithResult(_0x4fbfdd,null))[_0x290e('0x45')](handleError(_0x4fbfdd,null));};exports[_0x290e('0x49')]=function(_0x15e0f8,_0x1f622d){return db['SquareProject'][_0x290e('0x49')](_0x15e0f8[_0x290e('0x4a')],{})[_0x290e('0x27')](function(_0x958b7c){var _0x1034a1=_0x15e0f8[_0x290e('0x4b')][_0x290e('0x4c')]({'plain':!![]});if(!_0x1034a1)throw new Error(_0x290e('0x4d'));if(_0x1034a1['role']==='user'){var _0xf21d5b=_0x958b7c[_0x290e('0x4c')]({'plain':!![]});var _0x13c917=_0x290e('0x29');return db[_0x290e('0x4e')]['find']({'where':{'name':_0x13c917,'userProfileId':_0x1034a1[_0x290e('0x4f')]},'raw':!![]})['then'](function(_0x4ac186){if(_0x4ac186&&_0x4ac186[_0x290e('0x50')]===0x0){return db[_0x290e('0x51')][_0x290e('0x49')]({'name':_0xf21d5b[_0x290e('0x2c')],'resourceId':_0xf21d5b['id'],'type':_0x4ac186[_0x290e('0x2c')],'sectionId':_0x4ac186['id']},{})['then'](function(){return _0x958b7c;});}else{return _0x958b7c;}})[_0x290e('0x45')](function(_0x3e7d3a){logger['error'](_0x290e('0x52'),_0x3e7d3a);throw _0x3e7d3a;});}return _0x958b7c;})['then'](respondWithResult(_0x1f622d,0xc9))[_0x290e('0x45')](handleError(_0x1f622d,null));};exports[_0x290e('0x26')]=function(_0x12e84d,_0x4e4734){if(_0x12e84d[_0x290e('0x4a')]['id']){delete _0x12e84d[_0x290e('0x4a')]['id'];}return db[_0x290e('0x2e')][_0x290e('0x53')]({'where':{'id':_0x12e84d[_0x290e('0x47')]['id']}})[_0x290e('0x27')](handleEntityNotFound(_0x4e4734,null))['then'](saveUpdates(_0x12e84d[_0x290e('0x4a')],null))[_0x290e('0x27')](respondWithResult(_0x4e4734,null))[_0x290e('0x45')](handleError(_0x4e4734,null));};exports[_0x290e('0x28')]=function(_0x489db6,_0x26053e){return db[_0x290e('0x2e')][_0x290e('0x53')]({'where':{'id':_0x489db6[_0x290e('0x47')]['id']}})[_0x290e('0x27')](handleEntityNotFound(_0x26053e,null))[_0x290e('0x27')](removeEntity(_0x26053e,null))[_0x290e('0x45')](handleError(_0x26053e,null));};exports[_0x290e('0x54')]=function(_0x2a26e8,_0x68ad0f,_0x1fe3ee){return db[_0x290e('0x2e')][_0x290e('0x53')]({'where':{'id':_0x2a26e8['params']['id']}})[_0x290e('0x27')](handleEntityNotFound(_0x68ad0f,null))[_0x290e('0x27')](function(_0x3b73b0){if(_0x3b73b0){return _0x3b73b0[_0x290e('0x54')](_0x2a26e8[_0x290e('0x4a')][_0x290e('0x55')],_[_0x290e('0x56')](_0x2a26e8[_0x290e('0x4a')],['ids','id'])||{});}})[_0x290e('0x27')](respondWithResult(_0x68ad0f,null))[_0x290e('0x45')](handleError(_0x68ad0f,null));};exports[_0x290e('0x57')]=function(_0x1cf179,_0x20d174,_0x5b5f01){return db[_0x290e('0x2e')][_0x290e('0x53')]({'where':{'id':_0x1cf179[_0x290e('0x47')]['id']}})[_0x290e('0x27')](handleEntityNotFound(_0x20d174,null))[_0x290e('0x27')](function(_0x1f4241){if(_0x1f4241){return _0x1f4241[_0x290e('0x57')](_0x1cf179[_0x290e('0x33')]['ids'])['then'](function(){if(_[_0x290e('0x58')](_0x1cf179['query']['ids'])){for(var _0x3677c2=0x0;_0x3677c2<_0x1cf179[_0x290e('0x33')][_0x290e('0x55')]['length'];_0x3677c2+=0x1){socket['emit'](_0x290e('0x59'),{'UserId':Number(_0x1cf179[_0x290e('0x33')]['ids'][_0x3677c2]),'SquareProjectId':Number(_0x1cf179['params']['id'])});}}else{socket[_0x290e('0x5a')]('userSquareProject:remove',{'UserId':Number(_0x1cf179[_0x290e('0x33')][_0x290e('0x55')]),'SquareProjectId':Number(_0x1cf179['params']['id'])});}});}})[_0x290e('0x27')](respondWithStatusCode(_0x20d174,null))[_0x290e('0x45')](handleError(_0x20d174,null));};exports[_0x290e('0x5b')]=function(_0x4095a1,_0x31f2f5,_0x2acc7a){var _0x4ccd34={};var _0x2047ac={};var _0x4168e6;var _0x2c3cba;return db['SquareProject'][_0x290e('0x5c')]({'where':{'id':_0x4095a1['params']['id']}})[_0x290e('0x27')](handleEntityNotFound(_0x31f2f5,null))[_0x290e('0x27')](function(_0xcd347f){if(_0xcd347f){_0x4168e6=_0xcd347f;_0x2047ac[_0x290e('0x36')]=_[_0x290e('0x48')](db['User'][_0x290e('0x2f')]);_0x2047ac[_0x290e('0x33')]=_['keys'](_0x4095a1['query']);_0x2047ac[_0x290e('0x34')]=_[_0x290e('0x35')](_0x2047ac[_0x290e('0x36')],_0x2047ac['query']);_0x4ccd34[_0x290e('0x37')]=_[_0x290e('0x35')](_0x2047ac[_0x290e('0x36')],qs[_0x290e('0x38')](_0x4095a1['query'][_0x290e('0x38')]));_0x4ccd34[_0x290e('0x37')]=_0x4ccd34[_0x290e('0x37')]['length']?_0x4ccd34[_0x290e('0x37')]:_0x2047ac[_0x290e('0x36')];_0x4ccd34[_0x290e('0x3c')]=qs[_0x290e('0x3d')](_0x4095a1[_0x290e('0x33')]['sort']);_0x4ccd34[_0x290e('0x3e')]=qs[_0x290e('0x34')](_[_0x290e('0x3f')](_0x4095a1['query'],_0x2047ac[_0x290e('0x34')]));if(_0x4095a1[_0x290e('0x33')][_0x290e('0x5d')]){_0x4ccd34['where']=_['merge'](_0x4ccd34[_0x290e('0x3e')],{'$or':_[_0x290e('0x32')](_0x4ccd34[_0x290e('0x37')],function(_0x46be1f){var _0x45ce70={};_0x45ce70[_0x46be1f]={'$like':'%'+_0x4095a1[_0x290e('0x33')]['filter']+'%'};return _0x45ce70;})});}_0x4ccd34=_[_0x290e('0x40')]({},_0x4ccd34,_0x4095a1['options']);return _0x4168e6[_0x290e('0x5b')](_0x4ccd34);}})['then'](function(_0x331800){if(_0x331800){_0x2c3cba=_0x331800[_0x290e('0x39')];if(!_0x4095a1[_0x290e('0x33')][_0x290e('0x3a')](_0x290e('0x3b'))){_0x4ccd34[_0x290e('0x20')]=qs[_0x290e('0x20')](_0x4095a1[_0x290e('0x33')]['limit']);_0x4ccd34[_0x290e('0x1d')]=qs['offset'](_0x4095a1['query']['offset']);}return _0x4168e6[_0x290e('0x5b')](_0x4ccd34);}})[_0x290e('0x27')](function(_0xd1bdc9){if(_0xd1bdc9){return _0xd1bdc9?{'count':_0x2c3cba,'rows':_0xd1bdc9}:null;}})[_0x290e('0x27')](respondWithResult(_0x31f2f5,null))[_0x290e('0x45')](handleError(_0x31f2f5,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index ed0d136..f4b5097 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 _0x6a1c=['save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','SquareProject','setMaxListeners'];(function(_0x3c8e26,_0x5b5e70){var _0x48e6da=function(_0xc723fa){while(--_0xc723fa){_0x3c8e26['push'](_0x3c8e26['shift']());}};_0x48e6da(++_0x5b5e70);}(_0x6a1c,0x150));var _0xc6a1=function(_0x4d2c06,_0x1cf73d){_0x4d2c06=_0x4d2c06-0x0;var _0xb2948a=_0x6a1c[_0x4d2c06];return _0xb2948a;};'use strict';var EventEmitter=require(_0xc6a1('0x0'));var SquareProject=require(_0xc6a1('0x1'))['db'][_0xc6a1('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xc6a1('0x3')](0x0);var events={'afterCreate':_0xc6a1('0x4'),'afterUpdate':_0xc6a1('0x5'),'afterDestroy':_0xc6a1('0x6')};function emitEvent(_0x28c77a){return function(_0x34cf47,_0x1ea337,_0x3cc8d1){SquareProjectEvents[_0xc6a1('0x7')](_0x28c77a+':'+_0x34cf47['id'],_0x34cf47);SquareProjectEvents[_0xc6a1('0x7')](_0x28c77a,_0x34cf47);_0x3cc8d1(null);};}for(var e in events){if(events[_0xc6a1('0x8')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xc6a1('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0x0011=['SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x494703,_0x5ef5f3){var _0x18f94e=function(_0x1dabb){while(--_0x1dabb){_0x494703['push'](_0x494703['shift']());}};_0x18f94e(++_0x5ef5f3);}(_0x0011,0x94));var _0x1001=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x0011[_0x465a0c];return _0x1e202e;};'use strict';var EventEmitter=require(_0x1001('0x0'));var SquareProject=require(_0x1001('0x1'))['db'][_0x1001('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x1001('0x3')](0x0);var events={'afterCreate':_0x1001('0x4'),'afterUpdate':_0x1001('0x5'),'afterDestroy':_0x1001('0x6')};function emitEvent(_0x59110c){return function(_0x35f551,_0x8ff67e,_0x598afb){SquareProjectEvents[_0x1001('0x7')](_0x59110c+':'+_0x35f551['id'],_0x35f551);SquareProjectEvents['emit'](_0x59110c,_0x35f551);_0x598afb(null);};}for(var e in events){if(events[_0x1001('0x8')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x1001('0x9')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 939e457..ae9f5ed 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 _0x7849=['rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x187dbd,_0x2ecf58){var _0x45d1e9=function(_0x2364c0){while(--_0x2364c0){_0x187dbd['push'](_0x187dbd['shift']());}};_0x45d1e9(++_0x2ecf58);}(_0x7849,0x108));var _0x9784=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7849[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x9784('0x0'));var logger=require(_0x9784('0x1'))('api');var moment=require(_0x9784('0x2'));var BPromise=require(_0x9784('0x3'));var rp=require(_0x9784('0x4'));var fs=require('fs');var path=require(_0x9784('0x5'));var rimraf=require(_0x9784('0x6'));var config=require(_0x9784('0x7'));var attributes=require(_0x9784('0x8'));module[_0x9784('0x9')]=function(_0x1c510d,_0x42dd5f){return _0x1c510d[_0x9784('0xa')](_0x9784('0xb'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x38fd90,_0x7d4c2a,_0x39a04f){if(_0x38fd90[_0x9784('0xc')](_0x9784('0xd'))){_0x38fd90[_0x9784('0xe')]=moment()[_0x9784('0xf')](_0x9784('0x10'));}if(_0x38fd90[_0x9784('0xc')](_0x9784('0x11'))){_0x38fd90['publishedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x39a04f(null,_0x38fd90);}}});}; \ No newline at end of file +var _0x43ba=['./squareProject.attributes','exports','define','SquareProject','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x51a123,_0x4df9f4){var _0x8b201a=function(_0x1e895b){while(--_0x1e895b){_0x51a123['push'](_0x51a123['shift']());}};_0x8b201a(++_0x4df9f4);}(_0x43ba,0x13c));var _0xa43b=function(_0x572d18,_0x2e6a19){_0x572d18=_0x572d18-0x0;var _0x2938c2=_0x43ba[_0x572d18];return _0x2938c2;};'use strict';var _=require(_0xa43b('0x0'));var util=require('util');var logger=require(_0xa43b('0x1'))('api');var moment=require(_0xa43b('0x2'));var BPromise=require('bluebird');var rp=require(_0xa43b('0x3'));var fs=require('fs');var path=require(_0xa43b('0x4'));var rimraf=require(_0xa43b('0x5'));var config=require(_0xa43b('0x6'));var attributes=require(_0xa43b('0x7'));module[_0xa43b('0x8')]=function(_0x25f8a0,_0x18fe54){return _0x25f8a0[_0xa43b('0x9')](_0xa43b('0xa'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x25b5e7,_0x5f2ca2,_0x12fb59){if(_0x25b5e7[_0xa43b('0xb')](_0xa43b('0xc'))){_0x25b5e7[_0xa43b('0xd')]=moment()[_0xa43b('0xe')](_0xa43b('0xf'));}if(_0x25b5e7[_0xa43b('0xb')](_0xa43b('0x10'))){_0x25b5e7['publishedAt']=moment()[_0xa43b('0xe')](_0xa43b('0xf'));}_0x12fb59(null,_0x25b5e7);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 8b6cf0d..efd7654 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 _0xa25b=['ShowSquareProject','options','raw','include','model','attributes','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x1f50f3,_0x281515){var _0x4cc6fb=function(_0x3fba72){while(--_0x3fba72){_0x1f50f3['push'](_0x1f50f3['shift']());}};_0x4cc6fb(++_0x281515);}(_0xa25b,0xf6));var _0xba25=function(_0xec7927,_0x417df7){_0xec7927=_0xec7927-0x0;var _0xb16197=_0xa25b[_0xec7927];return _0xb16197;};'use strict';var _=require(_0xba25('0x0'));var util=require('util');var moment=require(_0xba25('0x1'));var BPromise=require('bluebird');var rs=require(_0xba25('0x2'));var fs=require('fs');var Redis=require(_0xba25('0x3'));var db=require(_0xba25('0x4'))['db'];var utils=require(_0xba25('0x5'));var logger=require('../../config/logger')(_0xba25('0x6'));var config=require(_0xba25('0x7'));var jayson=require(_0xba25('0x8'));var client=jayson['client'][_0xba25('0x9')]({'port':0x232a});config[_0xba25('0xa')]=_['defaults'](config[_0xba25('0xa')],{'host':_0xba25('0xb'),'port':0x18eb});var socket=require(_0xba25('0xc'))(new Redis(config[_0xba25('0xa')]));require('./squareProject.socket')['register'](socket);function respondWithRpcPromise(_0xf921b2,_0x4d408b,_0x1940a2){return new BPromise(function(_0x4ad197,_0x53d736){return client[_0xba25('0xd')](_0xf921b2,_0x1940a2)[_0xba25('0xe')](function(_0x304104){logger[_0xba25('0xf')](_0xba25('0x10'),_0x4d408b,_0xba25('0x11'));logger['debug']('SquareProject,\x20%s,\x20%s,\x20%s',_0x4d408b,_0xba25('0x11'),JSON[_0xba25('0x12')](_0x304104));if(_0x304104[_0xba25('0x13')]){if(_0x304104[_0xba25('0x13')][_0xba25('0x14')]===0x1f4){logger[_0xba25('0x13')]('SquareProject,\x20%s,\x20%s',_0x4d408b,_0x304104['error'][_0xba25('0x15')]);return _0x53d736(_0x304104['error'][_0xba25('0x15')]);}logger[_0xba25('0x13')](_0xba25('0x10'),_0x4d408b,_0x304104[_0xba25('0x13')]['message']);return _0x4ad197(_0x304104[_0xba25('0x13')][_0xba25('0x15')]);}else{logger[_0xba25('0xf')](_0xba25('0x10'),_0x4d408b,_0xba25('0x11'));_0x4ad197(_0x304104[_0xba25('0x16')][_0xba25('0x15')]);}})[_0xba25('0x17')](function(_0x515934){logger['error']('SquareProject,\x20%s,\x20%s',_0x4d408b,_0x515934);_0x53d736(_0x515934);});});}exports[_0xba25('0x18')]=function(_0x3cf551){var _0x27f7c8=this;return new Promise(function(_0x456d18,_0x50d0e9){return db['SquareProject']['find']({'raw':_0x3cf551['options']?_0x3cf551[_0xba25('0x19')][_0xba25('0x1a')]===undefined?!![]:![]:!![],'where':_0x3cf551[_0xba25('0x19')]?_0x3cf551[_0xba25('0x19')]['where']||null:null,'attributes':_0x3cf551[_0xba25('0x19')]?_0x3cf551[_0xba25('0x19')]['attributes']||null:null,'include':_0x3cf551[_0xba25('0x19')]?_0x3cf551['options'][_0xba25('0x1b')]?_['map'](_0x3cf551['options'][_0xba25('0x1b')],function(_0x26f3be){return{'model':db[_0x26f3be[_0xba25('0x1c')]],'as':_0x26f3be['as'],'attributes':_0x26f3be[_0xba25('0x1d')],'include':_0x26f3be['include']?_['map'](_0x26f3be[_0xba25('0x1b')],function(_0x156fbb){return{'model':db[_0x156fbb[_0xba25('0x1c')]],'as':_0x156fbb['as'],'attributes':_0x156fbb[_0xba25('0x1d')],'include':_0x156fbb[_0xba25('0x1b')]?_['map'](_0x156fbb['include'],function(_0x55853a){return{'model':db[_0x55853a[_0xba25('0x1c')]],'as':_0x55853a['as'],'attributes':_0x55853a[_0xba25('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xba25('0xe')](function(_0x31d90a){logger[_0xba25('0xf')](_0xba25('0x18'),_0x3cf551);logger['debug'](_0xba25('0x18'),_0x3cf551,JSON[_0xba25('0x12')](_0x31d90a));_0x456d18(_0x31d90a);})[_0xba25('0x17')](function(_0x3aa888){logger['error'](_0xba25('0x18'),_0x3aa888[_0xba25('0x15')],_0x3cf551);_0x50d0e9(_0x27f7c8[_0xba25('0x13')](0x1f4,_0x3aa888[_0xba25('0x15')]));});});}; \ No newline at end of file +var _0xc3cc=['redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','then','info','debug','SquareProject,\x20%s,\x20%s,\x20%s','error','code','SquareProject,\x20%s,\x20%s','message','request\x20sent','result','catch','ShowSquareProject','SquareProject','raw','options','where','attributes','include','model','map','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xc3cc,0x67));var _0xcc3c=function(_0x54c977,_0x382295){_0x54c977=_0x54c977-0x0;var _0x53a048=_0xc3cc[_0x54c977];return _0x53a048;};'use strict';var _=require(_0xcc3c('0x0'));var util=require('util');var moment=require(_0xcc3c('0x1'));var BPromise=require('bluebird');var rs=require(_0xcc3c('0x2'));var fs=require('fs');var Redis=require(_0xcc3c('0x3'));var db=require(_0xcc3c('0x4'))['db'];var utils=require(_0xcc3c('0x5'));var logger=require(_0xcc3c('0x6'))(_0xcc3c('0x7'));var config=require(_0xcc3c('0x8'));var jayson=require(_0xcc3c('0x9'));var client=jayson[_0xcc3c('0xa')]['http']({'port':0x232a});config[_0xcc3c('0xb')]=_[_0xcc3c('0xc')](config[_0xcc3c('0xb')],{'host':_0xcc3c('0xd'),'port':0x18eb});var socket=require(_0xcc3c('0xe'))(new Redis(config[_0xcc3c('0xb')]));require(_0xcc3c('0xf'))[_0xcc3c('0x10')](socket);function respondWithRpcPromise(_0x1d2e61,_0x9f4d51,_0x4b7fbe){return new BPromise(function(_0x3f4772,_0x412457){return client['request'](_0x1d2e61,_0x4b7fbe)[_0xcc3c('0x11')](function(_0x57f561){logger[_0xcc3c('0x12')]('SquareProject,\x20%s,\x20%s',_0x9f4d51,'request\x20sent');logger[_0xcc3c('0x13')](_0xcc3c('0x14'),_0x9f4d51,'request\x20sent',JSON['stringify'](_0x57f561));if(_0x57f561[_0xcc3c('0x15')]){if(_0x57f561[_0xcc3c('0x15')][_0xcc3c('0x16')]===0x1f4){logger['error'](_0xcc3c('0x17'),_0x9f4d51,_0x57f561[_0xcc3c('0x15')][_0xcc3c('0x18')]);return _0x412457(_0x57f561['error'][_0xcc3c('0x18')]);}logger[_0xcc3c('0x15')](_0xcc3c('0x17'),_0x9f4d51,_0x57f561[_0xcc3c('0x15')]['message']);return _0x3f4772(_0x57f561[_0xcc3c('0x15')][_0xcc3c('0x18')]);}else{logger[_0xcc3c('0x12')](_0xcc3c('0x17'),_0x9f4d51,_0xcc3c('0x19'));_0x3f4772(_0x57f561[_0xcc3c('0x1a')][_0xcc3c('0x18')]);}})[_0xcc3c('0x1b')](function(_0x1b7dec){logger[_0xcc3c('0x15')](_0xcc3c('0x17'),_0x9f4d51,_0x1b7dec);_0x412457(_0x1b7dec);});});}exports[_0xcc3c('0x1c')]=function(_0xdea098){var _0xd43855=this;return new Promise(function(_0x577f74,_0x44909f){return db[_0xcc3c('0x1d')]['find']({'raw':_0xdea098['options']?_0xdea098['options'][_0xcc3c('0x1e')]===undefined?!![]:![]:!![],'where':_0xdea098[_0xcc3c('0x1f')]?_0xdea098['options'][_0xcc3c('0x20')]||null:null,'attributes':_0xdea098[_0xcc3c('0x1f')]?_0xdea098[_0xcc3c('0x1f')][_0xcc3c('0x21')]||null:null,'include':_0xdea098[_0xcc3c('0x1f')]?_0xdea098[_0xcc3c('0x1f')][_0xcc3c('0x22')]?_['map'](_0xdea098[_0xcc3c('0x1f')]['include'],function(_0x3949e8){return{'model':db[_0x3949e8[_0xcc3c('0x23')]],'as':_0x3949e8['as'],'attributes':_0x3949e8['attributes'],'include':_0x3949e8['include']?_['map'](_0x3949e8[_0xcc3c('0x22')],function(_0x501baa){return{'model':db[_0x501baa[_0xcc3c('0x23')]],'as':_0x501baa['as'],'attributes':_0x501baa[_0xcc3c('0x21')],'include':_0x501baa[_0xcc3c('0x22')]?_[_0xcc3c('0x24')](_0x501baa[_0xcc3c('0x22')],function(_0x167a18){return{'model':db[_0x167a18['model']],'as':_0x167a18['as'],'attributes':_0x167a18[_0xcc3c('0x21')]};}):[]};}):[]};}):[]:[]})[_0xcc3c('0x11')](function(_0x3c2da7){logger[_0xcc3c('0x12')](_0xcc3c('0x1c'),_0xdea098);logger['debug'](_0xcc3c('0x1c'),_0xdea098,JSON[_0xcc3c('0x25')](_0x3c2da7));_0x577f74(_0x3c2da7);})['catch'](function(_0xb3b9bd){logger[_0xcc3c('0x15')](_0xcc3c('0x1c'),_0xb3b9bd[_0xcc3c('0x18')],_0xdea098);_0x44909f(_0xd43855[_0xcc3c('0x15')](0x1f4,_0xb3b9bd[_0xcc3c('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 1cc3469..a0f3c6d 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 _0x089f=['./squareProject.events','save','remove','register','squareProject:'];(function(_0x59198f,_0x3a68b8){var _0x316881=function(_0x48b2f3){while(--_0x48b2f3){_0x59198f['push'](_0x59198f['shift']());}};_0x316881(++_0x3a68b8);}(_0x089f,0xdc));var _0xf089=function(_0x1c75fb,_0x49e58d){_0x1c75fb=_0x1c75fb-0x0;var _0x227ed8=_0x089f[_0x1c75fb];return _0x227ed8;};'use strict';var SquareProjectEvents=require(_0xf089('0x0'));var events=[_0xf089('0x1'),_0xf089('0x2'),'update'];function createListener(_0x4aa14b,_0x44030b){return function(_0x163415){_0x44030b['emit'](_0x4aa14b,_0x163415);};}function removeListener(_0x2ad30c,_0x2d1d3e){return function(){SquareProjectEvents['removeListener'](_0x2ad30c,_0x2d1d3e);};}exports[_0xf089('0x3')]=function(_0x1732af){for(var _0x3e65e8=0x0,_0x56bea2=events['length'];_0x3e65e8<_0x56bea2;_0x3e65e8++){var _0x478409=events[_0x3e65e8];var _0x3edbfa=createListener(_0xf089('0x4')+_0x478409,_0x1732af);SquareProjectEvents['on'](_0x478409,_0x3edbfa);}}; \ No newline at end of file +var _0x3d7d=['update','emit','removeListener','register','length','squareProject:','remove'];(function(_0x5815a6,_0x46bab4){var _0x2b5419=function(_0x457d46){while(--_0x457d46){_0x5815a6['push'](_0x5815a6['shift']());}};_0x2b5419(++_0x46bab4);}(_0x3d7d,0x187));var _0xd3d7=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x3d7d[_0x42cae2];return _0x5f256f;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=['save',_0xd3d7('0x0'),_0xd3d7('0x1')];function createListener(_0x2cc90e,_0x78b74f){return function(_0x14a73f){_0x78b74f[_0xd3d7('0x2')](_0x2cc90e,_0x14a73f);};}function removeListener(_0x3c9972,_0x3f4ba8){return function(){SquareProjectEvents[_0xd3d7('0x3')](_0x3c9972,_0x3f4ba8);};}exports[_0xd3d7('0x4')]=function(_0x536517){for(var _0xdbc9e7=0x0,_0xd38dfc=events[_0xd3d7('0x5')];_0xdbc9e7<_0xd38dfc;_0xdbc9e7++){var _0x12eb29=events[_0xdbc9e7];var _0x1a7cbf=createListener(_0xd3d7('0x6')+_0x12eb29,_0x536517);SquareProjectEvents['on'](_0x12eb29,_0x1a7cbf);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 61f2c16..96aff01 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 _0x326f=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','download','post','create','put','delete','exports'];(function(_0x9875f2,_0x5df566){var _0x57c331=function(_0x534eac){while(--_0x534eac){_0x9875f2['push'](_0x9875f2['shift']());}};_0x57c331(++_0x5df566);}(_0x326f,0xd1));var _0xf326=function(_0x5bbac8,_0x42de72){_0x5bbac8=_0x5bbac8-0x0;var _0x2837a0=_0x326f[_0x5bbac8];return _0x2837a0;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0xe')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router[_0xf326('0x10')]('/:id',auth[_0xf326('0xa')](),controller['update']);router[_0xf326('0x11')]('/:id',auth[_0xf326('0xa')](),controller['destroy']);module[_0xf326('0x12')]=router; \ No newline at end of file +var _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','/:id/download','download','create','put','delete'];(function(_0x841f18,_0x4dac44){var _0xac104d=function(_0x5772e3){while(--_0x5772e3){_0x841f18['push'](_0x841f18['shift']());}};_0xac104d(++_0x4dac44);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xc4aa[_0x50a0c2];return _0x5ebadd;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['show']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')]('/:id',auth[_0xac4a('0x9')](),controller['update']);router[_0xac4a('0x10')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0x11')]);module[_0xac4a('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 222cb7d..3f502b8 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 _0x7bae=['savePath','substring','lastIndexOf','STRING','VIRTUAL','getDataValue'];(function(_0x25248b,_0x3c8491){var _0x509939=function(_0x457a27){while(--_0x457a27){_0x25248b['push'](_0x25248b['shift']());}};_0x509939(++_0x3c8491);}(_0x7bae,0x13b));var _0xe7ba=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x7bae[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xe7ba('0x0')]},'callerid':{'type':Sequelize[_0xe7ba('0x0')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xe7ba('0x0')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xe7ba('0x0')]},'accountcode':{'type':Sequelize[_0xe7ba('0x0')]},'dnid':{'type':Sequelize[_0xe7ba('0x0')]},'projectName':{'type':Sequelize[_0xe7ba('0x0')]},'saveName':{'type':Sequelize[_0xe7ba('0x0')]},'filename':{'type':Sequelize[_0xe7ba('0x0')]},'savePath':{'type':Sequelize[_0xe7ba('0x0')]},'format':{'type':Sequelize[_0xe7ba('0x1')],'get':function(){var _0x10b307='';var _0x34fb18=this[_0xe7ba('0x2')](_0xe7ba('0x3'));if(_0x34fb18){_0x10b307=_0x34fb18[_0xe7ba('0x4')](_0x34fb18[_0xe7ba('0x5')]('.'));}return _0x10b307;}}}; \ No newline at end of file +var _0x814b=['substring','lastIndexOf','sequelize','exports','STRING','VIRTUAL','getDataValue','savePath'];(function(_0x3768eb,_0x3118a3){var _0x14eda4=function(_0x26dbe0){while(--_0x26dbe0){_0x3768eb['push'](_0x3768eb['shift']());}};_0x14eda4(++_0x3118a3);}(_0x814b,0x1a2));var _0xb814=function(_0x34b245,_0xfe65b4){_0x34b245=_0x34b245-0x0;var _0x3a8984=_0x814b[_0x34b245];return _0x3a8984;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'uniqueid':{'type':Sequelize[_0xb814('0x2')]},'callerid':{'type':Sequelize[_0xb814('0x2')]},'calleridname':{'type':Sequelize[_0xb814('0x2')]},'context':{'type':Sequelize[_0xb814('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb814('0x2')]},'accountcode':{'type':Sequelize[_0xb814('0x2')]},'dnid':{'type':Sequelize[_0xb814('0x2')]},'projectName':{'type':Sequelize[_0xb814('0x2')]},'saveName':{'type':Sequelize[_0xb814('0x2')]},'filename':{'type':Sequelize[_0xb814('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xb814('0x3')],'get':function(){var _0x2e6272='';var _0x5c8539=this[_0xb814('0x4')](_0xb814('0x5'));if(_0x5c8539){_0x2e6272=_0x5c8539[_0xb814('0x6')](_0x5c8539[_0xb814('0x7')]('.'));}return _0x2e6272;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 3d82000..1269889 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 _0x5e70=['isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','File:\x20\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','SquareRecording','findAll','rows','show','params','find','catch','create','body','download','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5e70,0x133));var _0x05e7=function(_0x207f32,_0x35c2d8){_0x207f32=_0x207f32-0x0;var _0x18f57e=_0x5e70[_0x207f32];return _0x18f57e;};'use strict';var emlformat=require(_0x05e7('0x0'));var rimraf=require(_0x05e7('0x1'));var zipdir=require(_0x05e7('0x2'));var jsonpatch=require(_0x05e7('0x3'));var rp=require(_0x05e7('0x4'));var moment=require(_0x05e7('0x5'));var BPromise=require(_0x05e7('0x6'));var Mustache=require('mustache');var util=require(_0x05e7('0x7'));var path=require(_0x05e7('0x8'));var sox=require(_0x05e7('0x9'));var csv=require(_0x05e7('0xa'));var ejs=require(_0x05e7('0xb'));var fs=require('fs');var fs_extra=require(_0x05e7('0xc'));var _=require(_0x05e7('0xd'));var squel=require('squel');var crypto=require(_0x05e7('0xe'));var jsforce=require(_0x05e7('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x05e7('0xa'));var querystring=require(_0x05e7('0x10'));var Papa=require(_0x05e7('0x11'));var Redis=require('ioredis');var authService=require(_0x05e7('0x12'));var qs=require(_0x05e7('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x05e7('0x14'));var logger=require(_0x05e7('0x15'))(_0x05e7('0x16'));var utils=require(_0x05e7('0x17'));var config=require(_0x05e7('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x05e7('0x19'))['db'];function respondWithStatusCode(_0x5772d0,_0x50cf56){_0x50cf56=_0x50cf56||0xcc;return function(_0x30f86b){if(_0x30f86b){return _0x5772d0[_0x05e7('0x1a')](_0x50cf56);}return _0x5772d0[_0x05e7('0x1b')](_0x50cf56)[_0x05e7('0x1c')]();};}function respondWithResult(_0x356674,_0xffa3ac){_0xffa3ac=_0xffa3ac||0xc8;return function(_0x2f3539){if(_0x2f3539){return _0x356674[_0x05e7('0x1b')](_0xffa3ac)['json'](_0x2f3539);}};}function respondWithFilteredResult(_0x29a9d3,_0x75534b){return function(_0x1cd365){if(_0x1cd365){var _0x24f6b2=typeof _0x75534b[_0x05e7('0x1d')]==='undefined'&&typeof _0x75534b['limit']===_0x05e7('0x1e');var _0x94c6ac=_0x1cd365['count'];var _0x48b1bc=_0x24f6b2?0x0:_0x75534b[_0x05e7('0x1d')];var _0x200e7e=_0x24f6b2?_0x1cd365[_0x05e7('0x1f')]:_0x75534b[_0x05e7('0x1d')]+_0x75534b[_0x05e7('0x20')];var _0x55280c;if(_0x200e7e>=_0x94c6ac){_0x200e7e=_0x94c6ac;_0x55280c=0xc8;}else{_0x55280c=0xce;}_0x29a9d3['status'](_0x55280c);return _0x29a9d3['set'](_0x05e7('0x21'),_0x48b1bc+'-'+_0x200e7e+'/'+_0x94c6ac)[_0x05e7('0x22')](_0x1cd365);}return null;};}function patchUpdates(_0x197286){return function(_0x3ed592){try{jsonpatch[_0x05e7('0x23')](_0x3ed592,_0x197286,!![]);}catch(_0x15f856){return BPromise[_0x05e7('0x24')](_0x15f856);}return _0x3ed592['save']();};}function saveUpdates(_0x21355e,_0x2d0bdd){return function(_0x5cec9e){if(_0x5cec9e){return _0x5cec9e[_0x05e7('0x25')](_0x21355e)[_0x05e7('0x26')](function(_0x46af62){return _0x46af62;});}return null;};}function removeEntity(_0x490636,_0x4aad90){return function(_0x2e9835){if(_0x2e9835){return _0x2e9835[_0x05e7('0x27')]()[_0x05e7('0x26')](function(){_0x490636[_0x05e7('0x1b')](0xcc)[_0x05e7('0x1c')]();});}};}function handleEntityNotFound(_0xda72d1,_0x2f852f){return function(_0x221f43){if(!_0x221f43){_0xda72d1['sendStatus'](0x194);}return _0x221f43;};}function handleError(_0x3392b3,_0x271ca5){_0x271ca5=_0x271ca5||0x1f4;return function(_0xa4657e){logger['error'](_0xa4657e[_0x05e7('0x28')]);if(_0xa4657e[_0x05e7('0x29')]){delete _0xa4657e[_0x05e7('0x29')];}_0x3392b3['status'](_0x271ca5)[_0x05e7('0x2a')](_0xa4657e);};}exports[_0x05e7('0x2b')]=function(_0x5a5353,_0xf5edd9){var _0x266d91={},_0x29ef65={},_0x4347a6={'count':0x0,'rows':[]};var _0x1a941f=_[_0x05e7('0x2c')](db['SquareRecording'][_0x05e7('0x2d')],function(_0xc87899){return{'name':_0xc87899[_0x05e7('0x2e')],'type':_0xc87899[_0x05e7('0x2f')][_0x05e7('0x30')]};});_0x29ef65[_0x05e7('0x31')]=_[_0x05e7('0x2c')](_0x1a941f,_0x05e7('0x29'));_0x29ef65[_0x05e7('0x32')]=_[_0x05e7('0x33')](_0x5a5353[_0x05e7('0x32')]);_0x29ef65[_0x05e7('0x34')]=_[_0x05e7('0x35')](_0x29ef65[_0x05e7('0x31')],_0x29ef65[_0x05e7('0x32')]);_0x266d91['attributes']=_[_0x05e7('0x35')](_0x29ef65[_0x05e7('0x31')],qs[_0x05e7('0x36')](_0x5a5353[_0x05e7('0x32')][_0x05e7('0x36')]));_0x266d91['attributes']=_0x266d91[_0x05e7('0x37')][_0x05e7('0x38')]?_0x266d91[_0x05e7('0x37')]:_0x29ef65['model'];if(!_0x5a5353[_0x05e7('0x32')]['hasOwnProperty'](_0x05e7('0x39'))){_0x266d91['limit']=qs['limit'](_0x5a5353[_0x05e7('0x32')][_0x05e7('0x20')]);_0x266d91[_0x05e7('0x1d')]=qs[_0x05e7('0x1d')](_0x5a5353[_0x05e7('0x32')][_0x05e7('0x1d')]);}_0x266d91[_0x05e7('0x3a')]=qs['sort'](_0x5a5353['query'][_0x05e7('0x3b')]);_0x266d91[_0x05e7('0x3c')]=qs[_0x05e7('0x34')](_[_0x05e7('0x3d')](_0x5a5353['query'],_0x29ef65[_0x05e7('0x34')]),_0x1a941f);if(_0x5a5353[_0x05e7('0x32')][_0x05e7('0x3e')]){_0x266d91[_0x05e7('0x3c')]=_[_0x05e7('0x3f')](_0x266d91[_0x05e7('0x3c')],{'$or':_['map'](_0x1a941f,function(_0x4cf2c4){if(_0x4cf2c4[_0x05e7('0x2f')]!==_0x05e7('0x40')){var _0x1d2699={};_0x1d2699[_0x4cf2c4[_0x05e7('0x29')]]={'$like':'%'+_0x5a5353['query'][_0x05e7('0x3e')]+'%'};return _0x1d2699;}})});}_0x266d91=_[_0x05e7('0x3f')]({},_0x266d91,_0x5a5353['options']);var _0x134e90={'where':_0x266d91[_0x05e7('0x3c')]};return db['SquareRecording'][_0x05e7('0x1f')](_0x134e90)['then'](function(_0x4d39f6){_0x4347a6[_0x05e7('0x1f')]=_0x4d39f6;if(_0x5a5353[_0x05e7('0x32')][_0x05e7('0x41')]){_0x266d91[_0x05e7('0x42')]=[{'all':!![]}];}return db[_0x05e7('0x43')][_0x05e7('0x44')](_0x266d91);})[_0x05e7('0x26')](function(_0x3cb425){_0x4347a6[_0x05e7('0x45')]=_0x3cb425;return _0x4347a6;})[_0x05e7('0x26')](respondWithFilteredResult(_0xf5edd9,_0x266d91))['catch'](handleError(_0xf5edd9,null));};exports[_0x05e7('0x46')]=function(_0x120132,_0xeef599){var _0x20334f={'raw':!![],'where':{'id':_0x120132[_0x05e7('0x47')]['id']}},_0x47e3b7={};_0x47e3b7['model']=_[_0x05e7('0x33')](db['SquareRecording'][_0x05e7('0x2d')]);_0x47e3b7[_0x05e7('0x32')]=_['keys'](_0x120132[_0x05e7('0x32')]);_0x47e3b7[_0x05e7('0x34')]=_[_0x05e7('0x35')](_0x47e3b7[_0x05e7('0x31')],_0x47e3b7['query']);_0x20334f['attributes']=_[_0x05e7('0x35')](_0x47e3b7[_0x05e7('0x31')],qs[_0x05e7('0x36')](_0x120132['query'][_0x05e7('0x36')]));_0x20334f[_0x05e7('0x37')]=_0x20334f['attributes']['length']?_0x20334f[_0x05e7('0x37')]:_0x47e3b7['model'];if(_0x120132['query'][_0x05e7('0x41')]){_0x20334f[_0x05e7('0x42')]=[{'all':!![]}];}_0x20334f=_[_0x05e7('0x3f')]({},_0x20334f,_0x120132['options']);return db['SquareRecording'][_0x05e7('0x48')](_0x20334f)['then'](handleEntityNotFound(_0xeef599,null))[_0x05e7('0x26')](respondWithResult(_0xeef599,null))[_0x05e7('0x49')](handleError(_0xeef599,null));};exports[_0x05e7('0x4a')]=function(_0x4d054c,_0x5240ae){return db['SquareRecording'][_0x05e7('0x4a')](_0x4d054c[_0x05e7('0x4b')],{})['then'](respondWithResult(_0x5240ae,0xc9))[_0x05e7('0x49')](handleError(_0x5240ae,null));};exports['update']=function(_0x3f6c14,_0x397d15){if(_0x3f6c14[_0x05e7('0x4b')]['id']){delete _0x3f6c14['body']['id'];}return db['SquareRecording'][_0x05e7('0x48')]({'where':{'id':_0x3f6c14[_0x05e7('0x47')]['id']}})['then'](handleEntityNotFound(_0x397d15,null))['then'](saveUpdates(_0x3f6c14[_0x05e7('0x4b')],null))[_0x05e7('0x26')](respondWithResult(_0x397d15,null))[_0x05e7('0x49')](handleError(_0x397d15,null));};exports[_0x05e7('0x4c')]=function(_0x24b0aa,_0xeebe62,_0x30e07c){var _0x473196=require('../../components/encryptor');var _0x204a33=![];var _0x4092c8={};if(_0x24b0aa[_0x05e7('0x32')][_0x05e7('0x2f')]&&_0x24b0aa['query']['type']==='uniqueid'){_0x4092c8[_0x05e7('0x4d')]=_0x24b0aa[_0x05e7('0x47')]['id'];}else{_0x4092c8['id']=_0x24b0aa['params']['id'];}return db[_0x05e7('0x43')][_0x05e7('0x48')]({'where':_0x4092c8,'attributes':['id',_0x05e7('0x4e'),_0x05e7('0x4f')],'raw':!![]})[_0x05e7('0x26')](handleEntityNotFound(_0xeebe62,null))['then'](function(_0xa9c2e3){if(_0xa9c2e3){var _0x5c1083=_0xa9c2e3[_0x05e7('0x4e')];var _0x208a1a=util[_0x05e7('0x50')](_0x05e7('0x51'),_0x5c1083);if(fs[_0x05e7('0x52')](_0x208a1a)){_0x204a33=!![];return _0x473196[_0x05e7('0x53')](_0x208a1a,_0x5c1083,config[_0x05e7('0x54')][_0x05e7('0x55')])['then'](function(){return _0xa9c2e3;});}return _0xa9c2e3;}})[_0x05e7('0x26')](function(_0x1eb9f0){if(_0x1eb9f0){var _0x478f94=_0x1eb9f0[_0x05e7('0x4e')];if(!fs[_0x05e7('0x52')](_0x478f94)){throw new db[(_0x05e7('0x56'))][(_0x05e7('0x57'))](_0x05e7('0x58'));}if(_0x1eb9f0[_0x05e7('0x4f')]){return _0xeebe62[_0x05e7('0x4c')](_0x478f94,_0x1eb9f0[_0x05e7('0x4f')]+path[_0x05e7('0x59')](_0x478f94),function(){if(_0x204a33){fs[_0x05e7('0x5a')](_0x478f94);}});}else{return _0xeebe62[_0x05e7('0x4c')](_0x478f94,function(_0x750669){if(_0x204a33){fs[_0x05e7('0x5a')](_0x478f94);}});}}})['catch'](function(_0x2b8d5c){if(_0x2b8d5c[_0x05e7('0x5b')]===_0x05e7('0x58')){_0xeebe62[_0x05e7('0x1b')](0x194)[_0x05e7('0x2a')](_0x05e7('0x5c'));}else{return handleError(_0xeebe62,null);}});};exports['destroy']=function(_0x144b3c,_0x80c4d8){return db[_0x05e7('0x43')][_0x05e7('0x48')]({'where':{'id':_0x144b3c[_0x05e7('0x47')]['id']}})[_0x05e7('0x26')](function(_0x344db5){if(_[_0x05e7('0x5d')](_0x344db5)){throw new ReferenceError(_0x05e7('0x5e'));}return _0x344db5;})['then'](function(_0x54d8d3){var _0x477681=_0x54d8d3[_0x05e7('0x4e')];logger[_0x05e7('0x5f')](_0x05e7('0x60'),_0x477681);if(!_[_0x05e7('0x5d')](_0x54d8d3[_0x05e7('0x4e')])&&fs[_0x05e7('0x52')](_0x477681)){logger[_0x05e7('0x5f')]('File:\x20\x22'+_0x477681+_0x05e7('0x61'));fs[_0x05e7('0x62')](_0x477681);}_0x477681=_0x477681+'.cypher';if(!_[_0x05e7('0x5d')](_0x54d8d3[_0x05e7('0x4e')])&&fs['existsSync'](_0x477681)){logger[_0x05e7('0x5f')](_0x05e7('0x63')+_0x477681+_0x05e7('0x61'));fs[_0x05e7('0x62')](_0x477681);}return _0x54d8d3;})[_0x05e7('0x26')](function(_0x4477f4){if(!_0x4477f4)throw new InternalError();return _0x4477f4[_0x05e7('0x27')]();})[_0x05e7('0x26')](function(){_0x80c4d8['status'](0xcc)[_0x05e7('0x1c')]();})[_0x05e7('0x49')](handleError(_0x80c4d8,null));}; \ No newline at end of file +var _0xfaa2=['to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','find','body','download','../../components/encryptor','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','unlink','message','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox'];(function(_0x4ddcec,_0x42870a){var _0x47fb0f=function(_0x80554){while(--_0x80554){_0x4ddcec['push'](_0x4ddcec['shift']());}};_0x47fb0f(++_0x42870a);}(_0xfaa2,0xba));var _0x2faa=function(_0xe8d177,_0x4e0ed8){_0xe8d177=_0xe8d177-0x0;var _0x4e187f=_0xfaa2[_0xe8d177];return _0x4e187f;};'use strict';var emlformat=require(_0x2faa('0x0'));var rimraf=require(_0x2faa('0x1'));var zipdir=require(_0x2faa('0x2'));var jsonpatch=require(_0x2faa('0x3'));var rp=require('request-promise');var moment=require(_0x2faa('0x4'));var BPromise=require(_0x2faa('0x5'));var Mustache=require('mustache');var util=require(_0x2faa('0x6'));var path=require('path');var sox=require(_0x2faa('0x7'));var csv=require(_0x2faa('0x8'));var ejs=require(_0x2faa('0x9'));var fs=require('fs');var fs_extra=require(_0x2faa('0xa'));var _=require(_0x2faa('0xb'));var squel=require('squel');var crypto=require(_0x2faa('0xc'));var jsforce=require(_0x2faa('0xd'));var deskjs=require(_0x2faa('0xe'));var toCsv=require(_0x2faa('0x8'));var querystring=require('querystring');var Papa=require(_0x2faa('0xf'));var Redis=require(_0x2faa('0x10'));var authService=require(_0x2faa('0x11'));var qs=require(_0x2faa('0x12'));var as=require(_0x2faa('0x13'));var hardwareService=require(_0x2faa('0x14'));var logger=require('../../config/logger')(_0x2faa('0x15'));var utils=require('../../config/utils');var config=require(_0x2faa('0x16'));var licenseUtil=require(_0x2faa('0x17'));var db=require(_0x2faa('0x18'))['db'];function respondWithStatusCode(_0x1e4d70,_0x297d8d){_0x297d8d=_0x297d8d||0xcc;return function(_0x1c3fc6){if(_0x1c3fc6){return _0x1e4d70['sendStatus'](_0x297d8d);}return _0x1e4d70[_0x2faa('0x19')](_0x297d8d)['end']();};}function respondWithResult(_0xeece08,_0x5116f3){_0x5116f3=_0x5116f3||0xc8;return function(_0x233dfb){if(_0x233dfb){return _0xeece08['status'](_0x5116f3)[_0x2faa('0x1a')](_0x233dfb);}};}function respondWithFilteredResult(_0x587c27,_0x23b8c8){return function(_0x200e34){if(_0x200e34){var _0x1fe03d=typeof _0x23b8c8['offset']===_0x2faa('0x1b')&&typeof _0x23b8c8[_0x2faa('0x1c')]===_0x2faa('0x1b');var _0x2f23f1=_0x200e34[_0x2faa('0x1d')];var _0x1d9d4=_0x1fe03d?0x0:_0x23b8c8['offset'];var _0x3c8a15=_0x1fe03d?_0x200e34[_0x2faa('0x1d')]:_0x23b8c8[_0x2faa('0x1e')]+_0x23b8c8['limit'];var _0x5e0b9d;if(_0x3c8a15>=_0x2f23f1){_0x3c8a15=_0x2f23f1;_0x5e0b9d=0xc8;}else{_0x5e0b9d=0xce;}_0x587c27['status'](_0x5e0b9d);return _0x587c27['set'](_0x2faa('0x1f'),_0x1d9d4+'-'+_0x3c8a15+'/'+_0x2f23f1)[_0x2faa('0x1a')](_0x200e34);}return null;};}function patchUpdates(_0x566f5a){return function(_0x5a84fa){try{jsonpatch['apply'](_0x5a84fa,_0x566f5a,!![]);}catch(_0x4a42e8){return BPromise[_0x2faa('0x20')](_0x4a42e8);}return _0x5a84fa[_0x2faa('0x21')]();};}function saveUpdates(_0x1a1dbd,_0x214a4b){return function(_0x219073){if(_0x219073){return _0x219073[_0x2faa('0x22')](_0x1a1dbd)[_0x2faa('0x23')](function(_0x38feb5){return _0x38feb5;});}return null;};}function removeEntity(_0x4fedcb,_0xaf988b){return function(_0x8ae6b5){if(_0x8ae6b5){return _0x8ae6b5[_0x2faa('0x24')]()[_0x2faa('0x23')](function(){_0x4fedcb[_0x2faa('0x19')](0xcc)[_0x2faa('0x25')]();});}};}function handleEntityNotFound(_0x1333af,_0x3811f7){return function(_0x289503){if(!_0x289503){_0x1333af['sendStatus'](0x194);}return _0x289503;};}function handleError(_0x1f5cd5,_0x1562fb){_0x1562fb=_0x1562fb||0x1f4;return function(_0xc98f0e){logger[_0x2faa('0x26')](_0xc98f0e[_0x2faa('0x27')]);if(_0xc98f0e['name']){delete _0xc98f0e[_0x2faa('0x28')];}_0x1f5cd5[_0x2faa('0x19')](_0x1562fb)[_0x2faa('0x29')](_0xc98f0e);};}exports[_0x2faa('0x2a')]=function(_0x22260a,_0x650499){var _0x17b7ff={},_0x5af813={},_0x4fe7a7={'count':0x0,'rows':[]};var _0x396319=_[_0x2faa('0x2b')](db[_0x2faa('0x2c')][_0x2faa('0x2d')],function(_0x10aec0){return{'name':_0x10aec0[_0x2faa('0x2e')],'type':_0x10aec0[_0x2faa('0x2f')][_0x2faa('0x30')]};});_0x5af813[_0x2faa('0x31')]=_['map'](_0x396319,_0x2faa('0x28'));_0x5af813[_0x2faa('0x32')]=_[_0x2faa('0x33')](_0x22260a[_0x2faa('0x32')]);_0x5af813[_0x2faa('0x34')]=_[_0x2faa('0x35')](_0x5af813[_0x2faa('0x31')],_0x5af813['query']);_0x17b7ff[_0x2faa('0x36')]=_[_0x2faa('0x35')](_0x5af813[_0x2faa('0x31')],qs[_0x2faa('0x37')](_0x22260a[_0x2faa('0x32')][_0x2faa('0x37')]));_0x17b7ff[_0x2faa('0x36')]=_0x17b7ff[_0x2faa('0x36')][_0x2faa('0x38')]?_0x17b7ff[_0x2faa('0x36')]:_0x5af813[_0x2faa('0x31')];if(!_0x22260a[_0x2faa('0x32')][_0x2faa('0x39')](_0x2faa('0x3a'))){_0x17b7ff[_0x2faa('0x1c')]=qs[_0x2faa('0x1c')](_0x22260a[_0x2faa('0x32')]['limit']);_0x17b7ff[_0x2faa('0x1e')]=qs[_0x2faa('0x1e')](_0x22260a[_0x2faa('0x32')]['offset']);}_0x17b7ff[_0x2faa('0x3b')]=qs[_0x2faa('0x3c')](_0x22260a[_0x2faa('0x32')]['sort']);_0x17b7ff[_0x2faa('0x3d')]=qs[_0x2faa('0x34')](_[_0x2faa('0x3e')](_0x22260a[_0x2faa('0x32')],_0x5af813[_0x2faa('0x34')]),_0x396319);if(_0x22260a[_0x2faa('0x32')][_0x2faa('0x3f')]){_0x17b7ff[_0x2faa('0x3d')]=_['merge'](_0x17b7ff[_0x2faa('0x3d')],{'$or':_[_0x2faa('0x2b')](_0x396319,function(_0x1be14a){if(_0x1be14a[_0x2faa('0x2f')]!==_0x2faa('0x40')){var _0x703ebe={};_0x703ebe[_0x1be14a[_0x2faa('0x28')]]={'$like':'%'+_0x22260a[_0x2faa('0x32')][_0x2faa('0x3f')]+'%'};return _0x703ebe;}})});}_0x17b7ff=_[_0x2faa('0x41')]({},_0x17b7ff,_0x22260a[_0x2faa('0x42')]);var _0x202466={'where':_0x17b7ff[_0x2faa('0x3d')]};return db[_0x2faa('0x2c')][_0x2faa('0x1d')](_0x202466)[_0x2faa('0x23')](function(_0x40dd6e){_0x4fe7a7[_0x2faa('0x1d')]=_0x40dd6e;if(_0x22260a[_0x2faa('0x32')]['includeAll']){_0x17b7ff[_0x2faa('0x43')]=[{'all':!![]}];}return db[_0x2faa('0x2c')][_0x2faa('0x44')](_0x17b7ff);})[_0x2faa('0x23')](function(_0x588665){_0x4fe7a7['rows']=_0x588665;return _0x4fe7a7;})[_0x2faa('0x23')](respondWithFilteredResult(_0x650499,_0x17b7ff))[_0x2faa('0x45')](handleError(_0x650499,null));};exports['show']=function(_0x3da90c,_0x118985){var _0x21a28b={'raw':!![],'where':{'id':_0x3da90c[_0x2faa('0x46')]['id']}},_0x55c7ba={};_0x55c7ba[_0x2faa('0x31')]=_['keys'](db[_0x2faa('0x2c')][_0x2faa('0x2d')]);_0x55c7ba[_0x2faa('0x32')]=_['keys'](_0x3da90c[_0x2faa('0x32')]);_0x55c7ba[_0x2faa('0x34')]=_['intersection'](_0x55c7ba[_0x2faa('0x31')],_0x55c7ba['query']);_0x21a28b[_0x2faa('0x36')]=_['intersection'](_0x55c7ba['model'],qs[_0x2faa('0x37')](_0x3da90c['query'][_0x2faa('0x37')]));_0x21a28b[_0x2faa('0x36')]=_0x21a28b[_0x2faa('0x36')][_0x2faa('0x38')]?_0x21a28b[_0x2faa('0x36')]:_0x55c7ba[_0x2faa('0x31')];if(_0x3da90c[_0x2faa('0x32')][_0x2faa('0x47')]){_0x21a28b['include']=[{'all':!![]}];}_0x21a28b=_[_0x2faa('0x41')]({},_0x21a28b,_0x3da90c[_0x2faa('0x42')]);return db[_0x2faa('0x2c')][_0x2faa('0x48')](_0x21a28b)['then'](handleEntityNotFound(_0x118985,null))[_0x2faa('0x23')](respondWithResult(_0x118985,null))[_0x2faa('0x45')](handleError(_0x118985,null));};exports['create']=function(_0x471bd8,_0x1f849a){return db[_0x2faa('0x2c')]['create'](_0x471bd8[_0x2faa('0x49')],{})['then'](respondWithResult(_0x1f849a,0xc9))[_0x2faa('0x45')](handleError(_0x1f849a,null));};exports[_0x2faa('0x22')]=function(_0x2f1b46,_0x5cd2d5){if(_0x2f1b46[_0x2faa('0x49')]['id']){delete _0x2f1b46[_0x2faa('0x49')]['id'];}return db['SquareRecording'][_0x2faa('0x48')]({'where':{'id':_0x2f1b46[_0x2faa('0x46')]['id']}})[_0x2faa('0x23')](handleEntityNotFound(_0x5cd2d5,null))[_0x2faa('0x23')](saveUpdates(_0x2f1b46['body'],null))['then'](respondWithResult(_0x5cd2d5,null))[_0x2faa('0x45')](handleError(_0x5cd2d5,null));};exports[_0x2faa('0x4a')]=function(_0x51b4f3,_0x410931,_0x58b8a7){var _0x24a405=require(_0x2faa('0x4b'));var _0x43aae5=![];var _0x22d89c={};if(_0x51b4f3[_0x2faa('0x32')]['type']&&_0x51b4f3[_0x2faa('0x32')][_0x2faa('0x2f')]==='uniqueid'){_0x22d89c['uniqueid']=_0x51b4f3['params']['id'];}else{_0x22d89c['id']=_0x51b4f3[_0x2faa('0x46')]['id'];}return db[_0x2faa('0x2c')][_0x2faa('0x48')]({'where':_0x22d89c,'attributes':['id',_0x2faa('0x4c'),_0x2faa('0x4d')],'raw':!![]})[_0x2faa('0x23')](handleEntityNotFound(_0x410931,null))[_0x2faa('0x23')](function(_0x1a2330){if(_0x1a2330){var _0xfc3514=_0x1a2330[_0x2faa('0x4c')];var _0x28bcb6=util[_0x2faa('0x4e')](_0x2faa('0x4f'),_0xfc3514);if(fs[_0x2faa('0x50')](_0x28bcb6)){_0x43aae5=!![];return _0x24a405[_0x2faa('0x51')](_0x28bcb6,_0xfc3514,config[_0x2faa('0x52')][_0x2faa('0x53')])[_0x2faa('0x23')](function(){return _0x1a2330;});}return _0x1a2330;}})[_0x2faa('0x23')](function(_0x334331){if(_0x334331){var _0x5b8af1=_0x334331[_0x2faa('0x4c')];if(!fs[_0x2faa('0x50')](_0x5b8af1)){throw new db[(_0x2faa('0x54'))][(_0x2faa('0x55'))](_0x2faa('0x56'));}if(_0x334331['filename']){return _0x410931[_0x2faa('0x4a')](_0x5b8af1,_0x334331[_0x2faa('0x4d')]+path['extname'](_0x5b8af1),function(){if(_0x43aae5){fs['unlink'](_0x5b8af1);}});}else{return _0x410931[_0x2faa('0x4a')](_0x5b8af1,function(_0x56f9bd){if(_0x43aae5){fs[_0x2faa('0x57')](_0x5b8af1);}});}}})[_0x2faa('0x45')](function(_0x54de7d){if(_0x54de7d[_0x2faa('0x58')]===_0x2faa('0x56')){_0x410931[_0x2faa('0x19')](0x194)[_0x2faa('0x29')](_0x2faa('0x59'));}else{return handleError(_0x410931,null);}});};exports[_0x2faa('0x24')]=function(_0x1fdf5c,_0x2df7d7){return db['SquareRecording'][_0x2faa('0x48')]({'where':{'id':_0x1fdf5c[_0x2faa('0x46')]['id']}})[_0x2faa('0x23')](function(_0x35758c){if(_[_0x2faa('0x5a')](_0x35758c)){throw new ReferenceError('Entity\x20not\x20found');}return _0x35758c;})[_0x2faa('0x23')](function(_0x58940e){var _0x32dc85=_0x58940e[_0x2faa('0x4c')];logger[_0x2faa('0x5b')](_0x2faa('0x5c'),_0x32dc85);if(!_[_0x2faa('0x5a')](_0x58940e['savePath'])&&fs['existsSync'](_0x32dc85)){logger[_0x2faa('0x5b')](_0x2faa('0x5d')+_0x32dc85+_0x2faa('0x5e'));fs[_0x2faa('0x5f')](_0x32dc85);}_0x32dc85=_0x32dc85+_0x2faa('0x60');if(!_[_0x2faa('0x5a')](_0x58940e[_0x2faa('0x4c')])&&fs[_0x2faa('0x50')](_0x32dc85)){logger[_0x2faa('0x5b')](_0x2faa('0x5d')+_0x32dc85+_0x2faa('0x5e'));fs['unlinkSync'](_0x32dc85);}return _0x58940e;})[_0x2faa('0x23')](function(_0x1c451b){if(!_0x1c451b)throw new InternalError();return _0x1c451b[_0x2faa('0x24')]();})[_0x2faa('0x23')](function(){_0x2df7d7['status'](0xcc)['end']();})['catch'](handleError(_0x2df7d7,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 0260405..6153ab9 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 _0x7af9=['path','rimraf','../../config/environment','define','SquareRecording','square_recordings','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x7af9,0x95));var _0x97af=function(_0x41d98a,_0xf5a414){_0x41d98a=_0x41d98a-0x0;var _0x3db31d=_0x7af9[_0x41d98a];return _0x3db31d;};'use strict';var _=require(_0x97af('0x0'));var util=require('util');var logger=require(_0x97af('0x1'))(_0x97af('0x2'));var moment=require('moment');var BPromise=require(_0x97af('0x3'));var rp=require(_0x97af('0x4'));var fs=require('fs');var path=require(_0x97af('0x5'));var rimraf=require(_0x97af('0x6'));var config=require(_0x97af('0x7'));var attributes=require('./squareRecording.attributes');module['exports']=function(_0x4e2dff,_0x440a77){return _0x4e2dff[_0x97af('0x8')](_0x97af('0x9'),attributes,{'tableName':_0x97af('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x297f=['square_recordings','lodash','util','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x4eb47c,_0x3341b9){var _0x1a3fa4=function(_0x4d23e7){while(--_0x4d23e7){_0x4eb47c['push'](_0x4eb47c['shift']());}};_0x1a3fa4(++_0x3341b9);}(_0x297f,0x1f0));var _0xf297=function(_0x3abb99,_0x557def){_0x3abb99=_0x3abb99-0x0;var _0x253256=_0x297f[_0x3abb99];return _0x253256;};'use strict';var _=require(_0xf297('0x0'));var util=require(_0xf297('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf297('0x2'));var BPromise=require(_0xf297('0x3'));var rp=require(_0xf297('0x4'));var fs=require('fs');var path=require(_0xf297('0x5'));var rimraf=require('rimraf');var config=require(_0xf297('0x6'));var attributes=require('./squareRecording.attributes');module[_0xf297('0x7')]=function(_0x353e78,_0x2282eb){return _0x353e78['define']('SquareRecording',attributes,{'tableName':_0xf297('0x8'),'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 0c98851..d9f60ca 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 _0xc2eb=['SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','body','options','CreateSquareRecording','util','moment','randomstring','ioredis','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0xce8ee4,_0x2de145){var _0x6194a2=function(_0xc0cd19){while(--_0xc0cd19){_0xce8ee4['push'](_0xce8ee4['shift']());}};_0x6194a2(++_0x2de145);}(_0xc2eb,0x153));var _0xbc2e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xc2eb[_0x3e112d];return _0x531c31;};'use strict';var _=require('lodash');var util=require(_0xbc2e('0x0'));var moment=require(_0xbc2e('0x1'));var BPromise=require('bluebird');var rs=require(_0xbc2e('0x2'));var fs=require('fs');var Redis=require(_0xbc2e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xbc2e('0x4'));var jayson=require(_0xbc2e('0x5'));var client=jayson[_0xbc2e('0x6')][_0xbc2e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1e8983,_0x3163c2,_0x1f3034){return new BPromise(function(_0x556f01,_0x5e4b3d){return client[_0xbc2e('0x8')](_0x1e8983,_0x1f3034)[_0xbc2e('0x9')](function(_0x52e693){logger[_0xbc2e('0xa')](_0xbc2e('0xb'),_0x3163c2,_0xbc2e('0xc'));logger[_0xbc2e('0xd')](_0xbc2e('0xe'),_0x3163c2,_0xbc2e('0xc'),JSON[_0xbc2e('0xf')](_0x52e693));if(_0x52e693[_0xbc2e('0x10')]){if(_0x52e693[_0xbc2e('0x10')][_0xbc2e('0x11')]===0x1f4){logger[_0xbc2e('0x10')]('SquareRecording,\x20%s,\x20%s',_0x3163c2,_0x52e693[_0xbc2e('0x10')][_0xbc2e('0x12')]);return _0x5e4b3d(_0x52e693[_0xbc2e('0x10')]['message']);}logger[_0xbc2e('0x10')](_0xbc2e('0xb'),_0x3163c2,_0x52e693[_0xbc2e('0x10')][_0xbc2e('0x12')]);return _0x556f01(_0x52e693['error'][_0xbc2e('0x12')]);}else{logger[_0xbc2e('0xa')](_0xbc2e('0xb'),_0x3163c2,'request\x20sent');_0x556f01(_0x52e693[_0xbc2e('0x13')][_0xbc2e('0x12')]);}})[_0xbc2e('0x14')](function(_0x1d5f07){logger[_0xbc2e('0x10')]('SquareRecording,\x20%s,\x20%s',_0x3163c2,_0x1d5f07);_0x5e4b3d(_0x1d5f07);});});}exports['CreateSquareRecording']=function(_0x4930f6){var _0xea373c=this;return new Promise(function(_0x56569d,_0x108ed4){return db['SquareRecording'][_0xbc2e('0x15')](_0x4930f6[_0xbc2e('0x16')],{'raw':_0x4930f6[_0xbc2e('0x17')]?_0x4930f6[_0xbc2e('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xbc2e('0x9')](function(_0x5e96d8){logger[_0xbc2e('0xa')](_0xbc2e('0x18'),_0x4930f6);logger[_0xbc2e('0xd')]('CreateSquareRecording',_0x4930f6,JSON[_0xbc2e('0xf')](_0x5e96d8));_0x56569d(_0x5e96d8);})[_0xbc2e('0x14')](function(_0x5c6f56){logger[_0xbc2e('0x10')](_0xbc2e('0x18'),_0x5c6f56[_0xbc2e('0x12')],_0x4930f6);_0x108ed4(_0xea373c[_0xbc2e('0x10')](0x1f4,_0x5c6f56['message']));});});}; \ No newline at end of file +var _0x28ea=['error','message','SquareRecording,\x20%s,\x20%s','result','catch','CreateSquareRecording','options','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x42d7d5,_0x227447){var _0xb136fd=function(_0x51f7a9){while(--_0x51f7a9){_0x42d7d5['push'](_0x42d7d5['shift']());}};_0xb136fd(++_0x227447);}(_0x28ea,0x75));var _0xa28e=function(_0xc8fced,_0x4b54ad){_0xc8fced=_0xc8fced-0x0;var _0x841f0e=_0x28ea[_0xc8fced];return _0x841f0e;};'use strict';var _=require(_0xa28e('0x0'));var util=require(_0xa28e('0x1'));var moment=require(_0xa28e('0x2'));var BPromise=require(_0xa28e('0x3'));var rs=require(_0xa28e('0x4'));var fs=require('fs');var Redis=require(_0xa28e('0x5'));var db=require(_0xa28e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa28e('0x7'))(_0xa28e('0x8'));var config=require(_0xa28e('0x9'));var jayson=require(_0xa28e('0xa'));var client=jayson['client'][_0xa28e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c6dd6,_0x3a2628,_0x40ea92){return new BPromise(function(_0x5810b1,_0x3d738c){return client[_0xa28e('0xc')](_0x1c6dd6,_0x40ea92)[_0xa28e('0xd')](function(_0x342f68){logger[_0xa28e('0xe')]('SquareRecording,\x20%s,\x20%s',_0x3a2628,'request\x20sent');logger['debug'](_0xa28e('0xf'),_0x3a2628,_0xa28e('0x10'),JSON[_0xa28e('0x11')](_0x342f68));if(_0x342f68[_0xa28e('0x12')]){if(_0x342f68['error']['code']===0x1f4){logger['error']('SquareRecording,\x20%s,\x20%s',_0x3a2628,_0x342f68['error'][_0xa28e('0x13')]);return _0x3d738c(_0x342f68[_0xa28e('0x12')][_0xa28e('0x13')]);}logger[_0xa28e('0x12')](_0xa28e('0x14'),_0x3a2628,_0x342f68[_0xa28e('0x12')]['message']);return _0x5810b1(_0x342f68[_0xa28e('0x12')][_0xa28e('0x13')]);}else{logger[_0xa28e('0xe')](_0xa28e('0x14'),_0x3a2628,'request\x20sent');_0x5810b1(_0x342f68[_0xa28e('0x15')][_0xa28e('0x13')]);}})[_0xa28e('0x16')](function(_0x3a84a1){logger['error'](_0xa28e('0x14'),_0x3a2628,_0x3a84a1);_0x3d738c(_0x3a84a1);});});}exports[_0xa28e('0x17')]=function(_0x5c6886){var _0x165540=this;return new Promise(function(_0xffde6e,_0x245bcb){return db['SquareRecording']['create'](_0x5c6886['body'],{'raw':_0x5c6886[_0xa28e('0x18')]?_0x5c6886[_0xa28e('0x18')][_0xa28e('0x19')]===undefined?!![]:![]:!![]})[_0xa28e('0xd')](function(_0x164743){logger[_0xa28e('0xe')]('CreateSquareRecording',_0x5c6886);logger[_0xa28e('0x1a')](_0xa28e('0x17'),_0x5c6886,JSON['stringify'](_0x164743));_0xffde6e(_0x164743);})[_0xa28e('0x16')](function(_0x349234){logger[_0xa28e('0x12')](_0xa28e('0x17'),_0x349234[_0xa28e('0x13')],_0x5c6886);_0x245bcb(_0x165540[_0xa28e('0x12')](0x1f4,_0x349234[_0xa28e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 6b5db40..45e25cb 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 _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(_0x386247,_0x5dcfa9){var _0x3abf65=function(_0x29d423){while(--_0x29d423){_0x386247['push'](_0x386247['shift']());}};_0x3abf65(++_0x5dcfa9);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.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 _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(_0x23f783,_0x1c6637){var _0x4b8e4a=function(_0x31ef17){while(--_0x31ef17){_0x23f783['push'](_0x23f783['shift']());}};_0x4b8e4a(++_0x1c6637);}(_0xe706,0xa3));var _0x6e70=function(_0x35e768,_0xbe0d60){_0x35e768=_0x35e768-0x0;var _0x58cc5f=_0xe706[_0x35e768];return _0x58cc5f;};'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 4ae45e7..d5d5000 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 _0xb12d=['sequelize','exports','STRING','DATE'];(function(_0x5cb12f,_0x2268ba){var _0x4bfa03=function(_0x594412){while(--_0x594412){_0x5cb12f['push'](_0x5cb12f['shift']());}};_0x4bfa03(++_0x2268ba);}(_0xb12d,0x124));var _0xdb12=function(_0x3e6729,_0x16d4af){_0x3e6729=_0x3e6729-0x0;var _0x535bcd=_0xb12d[_0x3e6729];return _0x535bcd;};'use strict';var Sequelize=require(_0xdb12('0x0'));module[_0xdb12('0x1')]={'network':{'type':Sequelize[_0xdb12('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0xdb12('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xdb12('0x2')]},'type':{'type':Sequelize[_0xdb12('0x2')]},'uniqueid':{'type':Sequelize[_0xdb12('0x2')]},'version':{'type':Sequelize[_0xdb12('0x2')]},'callerid':{'type':Sequelize[_0xdb12('0x2')]},'calleridname':{'type':Sequelize[_0xdb12('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xdb12('0x2')]},'callington':{'type':Sequelize[_0xdb12('0x2')]},'callingtns':{'type':Sequelize[_0xdb12('0x2')]},'dnid':{'type':Sequelize[_0xdb12('0x2')]},'rdnis':{'type':Sequelize[_0xdb12('0x2')]},'context':{'type':Sequelize[_0xdb12('0x2')]},'extension':{'type':Sequelize[_0xdb12('0x2')]},'priority':{'type':Sequelize[_0xdb12('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xdb12('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xdb12('0x2')]},'joinAt':{'type':Sequelize[_0xdb12('0x3')]},'leaveAt':{'type':Sequelize[_0xdb12('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x3b4e=['DATE','BOOLEAN','exports','STRING'];(function(_0x4dce1c,_0x2d65bc){var _0x2042e5=function(_0x236fc4){while(--_0x236fc4){_0x4dce1c['push'](_0x4dce1c['shift']());}};_0x2042e5(++_0x2d65bc);}(_0x3b4e,0x1aa));var _0xe3b4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3b4e[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xe3b4('0x0')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xe3b4('0x1')]},'request':{'type':Sequelize[_0xe3b4('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xe3b4('0x1')]},'type':{'type':Sequelize[_0xe3b4('0x1')]},'uniqueid':{'type':Sequelize[_0xe3b4('0x1')]},'version':{'type':Sequelize[_0xe3b4('0x1')]},'callerid':{'type':Sequelize[_0xe3b4('0x1')]},'calleridname':{'type':Sequelize[_0xe3b4('0x1')]},'callingpres':{'type':Sequelize[_0xe3b4('0x1')]},'callingani2':{'type':Sequelize[_0xe3b4('0x1')]},'callington':{'type':Sequelize[_0xe3b4('0x1')]},'callingtns':{'type':Sequelize[_0xe3b4('0x1')]},'dnid':{'type':Sequelize[_0xe3b4('0x1')]},'rdnis':{'type':Sequelize[_0xe3b4('0x1')]},'context':{'type':Sequelize[_0xe3b4('0x1')]},'extension':{'type':Sequelize[_0xe3b4('0x1')]},'priority':{'type':Sequelize[_0xe3b4('0x1')]},'enhanced':{'type':Sequelize[_0xe3b4('0x1')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0xe3b4('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xe3b4('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0xe3b4('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 6e69650..206fd5d 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 _0xea0b=['model','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','body','update','describe','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/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','error','name','index','map','SquareReport','rawAttributes','fieldName','type','query','filters','intersection'];(function(_0x355e14,_0x42f386){var _0x316c1c=function(_0x227720){while(--_0x227720){_0x355e14['push'](_0x355e14['shift']());}};_0x316c1c(++_0x42f386);}(_0xea0b,0x1e6));var _0xbea0=function(_0x4eabde,_0x15d845){_0x4eabde=_0x4eabde-0x0;var _0x201e80=_0xea0b[_0x4eabde];return _0x201e80;};'use strict';var emlformat=require(_0xbea0('0x0'));var rimraf=require(_0xbea0('0x1'));var zipdir=require(_0xbea0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbea0('0x3'));var moment=require(_0xbea0('0x4'));var BPromise=require(_0xbea0('0x5'));var Mustache=require(_0xbea0('0x6'));var util=require(_0xbea0('0x7'));var path=require(_0xbea0('0x8'));var sox=require(_0xbea0('0x9'));var csv=require(_0xbea0('0xa'));var ejs=require(_0xbea0('0xb'));var fs=require('fs');var fs_extra=require(_0xbea0('0xc'));var _=require(_0xbea0('0xd'));var squel=require(_0xbea0('0xe'));var crypto=require(_0xbea0('0xf'));var jsforce=require(_0xbea0('0x10'));var deskjs=require(_0xbea0('0x11'));var toCsv=require(_0xbea0('0xa'));var querystring=require(_0xbea0('0x12'));var Papa=require('papaparse');var Redis=require(_0xbea0('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xbea0('0x14'));var as=require(_0xbea0('0x15'));var hardwareService=require(_0xbea0('0x16'));var logger=require(_0xbea0('0x17'))(_0xbea0('0x18'));var utils=require('../../config/utils');var config=require(_0xbea0('0x19'));var licenseUtil=require(_0xbea0('0x1a'));var db=require(_0xbea0('0x1b'))['db'];function respondWithStatusCode(_0x2fd389,_0x5d4668){_0x5d4668=_0x5d4668||0xcc;return function(_0x4b48e5){if(_0x4b48e5){return _0x2fd389[_0xbea0('0x1c')](_0x5d4668);}return _0x2fd389['status'](_0x5d4668)[_0xbea0('0x1d')]();};}function respondWithResult(_0x2b2b29,_0x271e5b){_0x271e5b=_0x271e5b||0xc8;return function(_0x3b40e2){if(_0x3b40e2){return _0x2b2b29['status'](_0x271e5b)['json'](_0x3b40e2);}};}function respondWithFilteredResult(_0x323856,_0x5172ac){return function(_0x5282e9){if(_0x5282e9){var _0x286217=typeof _0x5172ac[_0xbea0('0x1e')]===_0xbea0('0x1f')&&typeof _0x5172ac[_0xbea0('0x20')]===_0xbea0('0x1f');var _0x17b387=_0x5282e9[_0xbea0('0x21')];var _0x19b388=_0x286217?0x0:_0x5172ac[_0xbea0('0x1e')];var _0x30b943=_0x286217?_0x5282e9['count']:_0x5172ac[_0xbea0('0x1e')]+_0x5172ac['limit'];var _0xc49e16;if(_0x30b943>=_0x17b387){_0x30b943=_0x17b387;_0xc49e16=0xc8;}else{_0xc49e16=0xce;}_0x323856['status'](_0xc49e16);return _0x323856[_0xbea0('0x22')](_0xbea0('0x23'),_0x19b388+'-'+_0x30b943+'/'+_0x17b387)[_0xbea0('0x24')](_0x5282e9);}return null;};}function patchUpdates(_0x3c838c){return function(_0x1a653){try{jsonpatch[_0xbea0('0x25')](_0x1a653,_0x3c838c,!![]);}catch(_0x16a03c){return BPromise[_0xbea0('0x26')](_0x16a03c);}return _0x1a653[_0xbea0('0x27')]();};}function saveUpdates(_0x427c73,_0xcc5be5){return function(_0x2140d4){if(_0x2140d4){return _0x2140d4['update'](_0x427c73)[_0xbea0('0x28')](function(_0xe36804){return _0xe36804;});}return null;};}function removeEntity(_0x348796,_0x9e57e9){return function(_0x1009d3){if(_0x1009d3){return _0x1009d3[_0xbea0('0x29')]()[_0xbea0('0x28')](function(){_0x348796['status'](0xcc)[_0xbea0('0x1d')]();});}};}function handleEntityNotFound(_0x1e7016,_0x398846){return function(_0x1bd034){if(!_0x1bd034){_0x1e7016['sendStatus'](0x194);}return _0x1bd034;};}function handleError(_0x2b1dd5,_0x3bdd08){_0x3bdd08=_0x3bdd08||0x1f4;return function(_0x1540fb){logger[_0xbea0('0x2a')](_0x1540fb['stack']);if(_0x1540fb[_0xbea0('0x2b')]){delete _0x1540fb[_0xbea0('0x2b')];}_0x2b1dd5['status'](_0x3bdd08)['send'](_0x1540fb);};}exports[_0xbea0('0x2c')]=function(_0x19ab24,_0x55c5ee){var _0x110a5b={},_0x15d023={},_0x4a038d={'count':0x0,'rows':[]};var _0x32537a=_[_0xbea0('0x2d')](db[_0xbea0('0x2e')][_0xbea0('0x2f')],function(_0x3c7058){return{'name':_0x3c7058[_0xbea0('0x30')],'type':_0x3c7058[_0xbea0('0x31')]['key']};});_0x15d023['model']=_[_0xbea0('0x2d')](_0x32537a,_0xbea0('0x2b'));_0x15d023[_0xbea0('0x32')]=_['keys'](_0x19ab24['query']);_0x15d023[_0xbea0('0x33')]=_[_0xbea0('0x34')](_0x15d023[_0xbea0('0x35')],_0x15d023[_0xbea0('0x32')]);_0x110a5b[_0xbea0('0x36')]=_[_0xbea0('0x34')](_0x15d023[_0xbea0('0x35')],qs[_0xbea0('0x37')](_0x19ab24[_0xbea0('0x32')][_0xbea0('0x37')]));_0x110a5b['attributes']=_0x110a5b[_0xbea0('0x36')]['length']?_0x110a5b['attributes']:_0x15d023[_0xbea0('0x35')];if(!_0x19ab24[_0xbea0('0x32')][_0xbea0('0x38')]('nolimit')){_0x110a5b[_0xbea0('0x20')]=qs[_0xbea0('0x20')](_0x19ab24['query']['limit']);_0x110a5b[_0xbea0('0x1e')]=qs['offset'](_0x19ab24[_0xbea0('0x32')][_0xbea0('0x1e')]);}_0x110a5b[_0xbea0('0x39')]=qs[_0xbea0('0x3a')](_0x19ab24[_0xbea0('0x32')]['sort']);_0x110a5b['where']=qs[_0xbea0('0x33')](_[_0xbea0('0x3b')](_0x19ab24[_0xbea0('0x32')],_0x15d023['filters']),_0x32537a);if(_0x19ab24[_0xbea0('0x32')][_0xbea0('0x3c')]){_0x110a5b[_0xbea0('0x3d')]=_[_0xbea0('0x3e')](_0x110a5b[_0xbea0('0x3d')],{'$or':_['map'](_0x32537a,function(_0x3c6d03){if(_0x3c6d03[_0xbea0('0x31')]!==_0xbea0('0x3f')){var _0x323a45={};_0x323a45[_0x3c6d03[_0xbea0('0x2b')]]={'$like':'%'+_0x19ab24['query'][_0xbea0('0x3c')]+'%'};return _0x323a45;}})});}_0x110a5b=_[_0xbea0('0x3e')]({},_0x110a5b,_0x19ab24[_0xbea0('0x40')]);var _0x25870d={'where':_0x110a5b[_0xbea0('0x3d')]};return db[_0xbea0('0x2e')][_0xbea0('0x21')](_0x25870d)[_0xbea0('0x28')](function(_0x543607){_0x4a038d[_0xbea0('0x21')]=_0x543607;if(_0x19ab24[_0xbea0('0x32')][_0xbea0('0x41')]){_0x110a5b[_0xbea0('0x42')]=[{'all':!![]}];}return db['SquareReport'][_0xbea0('0x43')](_0x110a5b);})[_0xbea0('0x28')](function(_0x4b27aa){_0x4a038d[_0xbea0('0x44')]=_0x4b27aa;return _0x4a038d;})['then'](respondWithFilteredResult(_0x55c5ee,_0x110a5b))['catch'](handleError(_0x55c5ee,null));};exports[_0xbea0('0x45')]=function(_0x3672c9,_0x1c2414){var _0x4f6998={'raw':!![],'where':{'id':_0x3672c9[_0xbea0('0x46')]['id']}},_0x531294={};_0x531294['model']=_[_0xbea0('0x47')](db['SquareReport'][_0xbea0('0x2f')]);_0x531294[_0xbea0('0x32')]=_['keys'](_0x3672c9['query']);_0x531294['filters']=_[_0xbea0('0x34')](_0x531294['model'],_0x531294[_0xbea0('0x32')]);_0x4f6998[_0xbea0('0x36')]=_[_0xbea0('0x34')](_0x531294['model'],qs['fields'](_0x3672c9[_0xbea0('0x32')][_0xbea0('0x37')]));_0x4f6998[_0xbea0('0x36')]=_0x4f6998[_0xbea0('0x36')]['length']?_0x4f6998[_0xbea0('0x36')]:_0x531294['model'];if(_0x3672c9[_0xbea0('0x32')][_0xbea0('0x41')]){_0x4f6998[_0xbea0('0x42')]=[{'all':!![]}];}_0x4f6998=_[_0xbea0('0x3e')]({},_0x4f6998,_0x3672c9[_0xbea0('0x40')]);return db[_0xbea0('0x2e')][_0xbea0('0x48')](_0x4f6998)[_0xbea0('0x28')](handleEntityNotFound(_0x1c2414,null))[_0xbea0('0x28')](respondWithResult(_0x1c2414,null))[_0xbea0('0x49')](handleError(_0x1c2414,null));};exports['create']=function(_0x118867,_0x4b0f37){return db['SquareReport']['create'](_0x118867[_0xbea0('0x4a')],{})['then'](respondWithResult(_0x4b0f37,0xc9))[_0xbea0('0x49')](handleError(_0x4b0f37,null));};exports[_0xbea0('0x4b')]=function(_0x26d880,_0x20e3a7){if(_0x26d880[_0xbea0('0x4a')]['id']){delete _0x26d880['body']['id'];}return db['SquareReport']['find']({'where':{'id':_0x26d880['params']['id']}})[_0xbea0('0x28')](handleEntityNotFound(_0x20e3a7,null))[_0xbea0('0x28')](saveUpdates(_0x26d880[_0xbea0('0x4a')],null))[_0xbea0('0x28')](respondWithResult(_0x20e3a7,null))[_0xbea0('0x49')](handleError(_0x20e3a7,null));};exports['destroy']=function(_0x4ffbaa,_0x2b6db9){return db[_0xbea0('0x2e')][_0xbea0('0x48')]({'where':{'id':_0x4ffbaa['params']['id']}})['then'](handleEntityNotFound(_0x2b6db9,null))[_0xbea0('0x28')](removeEntity(_0x2b6db9,null))[_0xbea0('0x49')](handleError(_0x2b6db9,null));};exports['describe']=function(_0x5bc796,_0x15c260){return db[_0xbea0('0x2e')][_0xbea0('0x4c')]()['then'](respondWithResult(_0x15c260,null))['catch'](handleError(_0x15c260,null));}; \ No newline at end of file +var _0x2102=['index','map','SquareReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','fields','length','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','then','destroy','end','error','name','send'];(function(_0x1dbaf7,_0x3d05b3){var _0x593f05=function(_0x381936){while(--_0x381936){_0x1dbaf7['push'](_0x1dbaf7['shift']());}};_0x593f05(++_0x3d05b3);}(_0x2102,0x19e));var _0x2210=function(_0x1a7e10,_0x3a5eef){_0x1a7e10=_0x1a7e10-0x0;var _0x3f8d13=_0x2102[_0x1a7e10];return _0x3f8d13;};'use strict';var emlformat=require(_0x2210('0x0'));var rimraf=require(_0x2210('0x1'));var zipdir=require(_0x2210('0x2'));var jsonpatch=require(_0x2210('0x3'));var rp=require(_0x2210('0x4'));var moment=require(_0x2210('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2210('0x6'));var util=require(_0x2210('0x7'));var path=require('path');var sox=require(_0x2210('0x8'));var csv=require(_0x2210('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2210('0xa'));var _=require('lodash');var squel=require(_0x2210('0xb'));var crypto=require(_0x2210('0xc'));var jsforce=require(_0x2210('0xd'));var deskjs=require(_0x2210('0xe'));var toCsv=require(_0x2210('0x9'));var querystring=require(_0x2210('0xf'));var Papa=require(_0x2210('0x10'));var Redis=require(_0x2210('0x11'));var authService=require(_0x2210('0x12'));var qs=require(_0x2210('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2210('0x14'));var logger=require('../../config/logger')(_0x2210('0x15'));var utils=require(_0x2210('0x16'));var config=require(_0x2210('0x17'));var licenseUtil=require(_0x2210('0x18'));var db=require(_0x2210('0x19'))['db'];function respondWithStatusCode(_0xb9ecd2,_0x2967c9){_0x2967c9=_0x2967c9||0xcc;return function(_0x4f180c){if(_0x4f180c){return _0xb9ecd2[_0x2210('0x1a')](_0x2967c9);}return _0xb9ecd2[_0x2210('0x1b')](_0x2967c9)['end']();};}function respondWithResult(_0x106367,_0x94cf4){_0x94cf4=_0x94cf4||0xc8;return function(_0x6b37ef){if(_0x6b37ef){return _0x106367['status'](_0x94cf4)[_0x2210('0x1c')](_0x6b37ef);}};}function respondWithFilteredResult(_0x3a6e1d,_0x239fba){return function(_0x5a2209){if(_0x5a2209){var _0x5dc408=typeof _0x239fba[_0x2210('0x1d')]==='undefined'&&typeof _0x239fba['limit']===_0x2210('0x1e');var _0x25e5cb=_0x5a2209['count'];var _0x3656d0=_0x5dc408?0x0:_0x239fba['offset'];var _0x584c72=_0x5dc408?_0x5a2209[_0x2210('0x1f')]:_0x239fba[_0x2210('0x1d')]+_0x239fba[_0x2210('0x20')];var _0x32d9f8;if(_0x584c72>=_0x25e5cb){_0x584c72=_0x25e5cb;_0x32d9f8=0xc8;}else{_0x32d9f8=0xce;}_0x3a6e1d[_0x2210('0x1b')](_0x32d9f8);return _0x3a6e1d[_0x2210('0x21')](_0x2210('0x22'),_0x3656d0+'-'+_0x584c72+'/'+_0x25e5cb)[_0x2210('0x1c')](_0x5a2209);}return null;};}function patchUpdates(_0x404960){return function(_0x38b1fc){try{jsonpatch['apply'](_0x38b1fc,_0x404960,!![]);}catch(_0x190abb){return BPromise[_0x2210('0x23')](_0x190abb);}return _0x38b1fc['save']();};}function saveUpdates(_0x268396,_0x134478){return function(_0x3ecbbd){if(_0x3ecbbd){return _0x3ecbbd['update'](_0x268396)[_0x2210('0x24')](function(_0x4abea1){return _0x4abea1;});}return null;};}function removeEntity(_0x2697e6,_0x3b02da){return function(_0xe30b15){if(_0xe30b15){return _0xe30b15[_0x2210('0x25')]()[_0x2210('0x24')](function(){_0x2697e6[_0x2210('0x1b')](0xcc)[_0x2210('0x26')]();});}};}function handleEntityNotFound(_0x22103d,_0x5570de){return function(_0x5c1c3c){if(!_0x5c1c3c){_0x22103d[_0x2210('0x1a')](0x194);}return _0x5c1c3c;};}function handleError(_0x17e2cb,_0x27d427){_0x27d427=_0x27d427||0x1f4;return function(_0x11009d){logger[_0x2210('0x27')](_0x11009d['stack']);if(_0x11009d[_0x2210('0x28')]){delete _0x11009d[_0x2210('0x28')];}_0x17e2cb['status'](_0x27d427)[_0x2210('0x29')](_0x11009d);};}exports[_0x2210('0x2a')]=function(_0x163b52,_0x5e421d){var _0x309c67={},_0x581b02={},_0x25e398={'count':0x0,'rows':[]};var _0x1cdb28=_[_0x2210('0x2b')](db[_0x2210('0x2c')][_0x2210('0x2d')],function(_0x34fac9){return{'name':_0x34fac9[_0x2210('0x2e')],'type':_0x34fac9[_0x2210('0x2f')][_0x2210('0x30')]};});_0x581b02['model']=_['map'](_0x1cdb28,_0x2210('0x28'));_0x581b02['query']=_[_0x2210('0x31')](_0x163b52[_0x2210('0x32')]);_0x581b02[_0x2210('0x33')]=_[_0x2210('0x34')](_0x581b02[_0x2210('0x35')],_0x581b02[_0x2210('0x32')]);_0x309c67['attributes']=_['intersection'](_0x581b02[_0x2210('0x35')],qs['fields'](_0x163b52['query']['fields']));_0x309c67[_0x2210('0x36')]=_0x309c67[_0x2210('0x36')]['length']?_0x309c67['attributes']:_0x581b02[_0x2210('0x35')];if(!_0x163b52[_0x2210('0x32')][_0x2210('0x37')](_0x2210('0x38'))){_0x309c67[_0x2210('0x20')]=qs[_0x2210('0x20')](_0x163b52[_0x2210('0x32')][_0x2210('0x20')]);_0x309c67[_0x2210('0x1d')]=qs['offset'](_0x163b52[_0x2210('0x32')][_0x2210('0x1d')]);}_0x309c67['order']=qs[_0x2210('0x39')](_0x163b52[_0x2210('0x32')]['sort']);_0x309c67[_0x2210('0x3a')]=qs[_0x2210('0x33')](_['pick'](_0x163b52[_0x2210('0x32')],_0x581b02[_0x2210('0x33')]),_0x1cdb28);if(_0x163b52['query'][_0x2210('0x3b')]){_0x309c67[_0x2210('0x3a')]=_[_0x2210('0x3c')](_0x309c67['where'],{'$or':_[_0x2210('0x2b')](_0x1cdb28,function(_0x2f43bd){if(_0x2f43bd[_0x2210('0x2f')]!==_0x2210('0x3d')){var _0x12a4ac={};_0x12a4ac[_0x2f43bd['name']]={'$like':'%'+_0x163b52['query'][_0x2210('0x3b')]+'%'};return _0x12a4ac;}})});}_0x309c67=_['merge']({},_0x309c67,_0x163b52['options']);var _0x367ce1={'where':_0x309c67[_0x2210('0x3a')]};return db[_0x2210('0x2c')]['count'](_0x367ce1)['then'](function(_0x1d3c9e){_0x25e398[_0x2210('0x1f')]=_0x1d3c9e;if(_0x163b52['query'][_0x2210('0x3e')]){_0x309c67[_0x2210('0x3f')]=[{'all':!![]}];}return db['SquareReport'][_0x2210('0x40')](_0x309c67);})[_0x2210('0x24')](function(_0x119bbf){_0x25e398[_0x2210('0x41')]=_0x119bbf;return _0x25e398;})[_0x2210('0x24')](respondWithFilteredResult(_0x5e421d,_0x309c67))[_0x2210('0x42')](handleError(_0x5e421d,null));};exports[_0x2210('0x43')]=function(_0x48af1a,_0x2aa24e){var _0x2a42f1={'raw':!![],'where':{'id':_0x48af1a[_0x2210('0x44')]['id']}},_0x55d493={};_0x55d493[_0x2210('0x35')]=_[_0x2210('0x31')](db[_0x2210('0x2c')][_0x2210('0x2d')]);_0x55d493[_0x2210('0x32')]=_[_0x2210('0x31')](_0x48af1a[_0x2210('0x32')]);_0x55d493['filters']=_[_0x2210('0x34')](_0x55d493[_0x2210('0x35')],_0x55d493[_0x2210('0x32')]);_0x2a42f1[_0x2210('0x36')]=_['intersection'](_0x55d493[_0x2210('0x35')],qs[_0x2210('0x45')](_0x48af1a[_0x2210('0x32')][_0x2210('0x45')]));_0x2a42f1[_0x2210('0x36')]=_0x2a42f1[_0x2210('0x36')][_0x2210('0x46')]?_0x2a42f1[_0x2210('0x36')]:_0x55d493[_0x2210('0x35')];if(_0x48af1a['query']['includeAll']){_0x2a42f1[_0x2210('0x3f')]=[{'all':!![]}];}_0x2a42f1=_[_0x2210('0x3c')]({},_0x2a42f1,_0x48af1a['options']);return db['SquareReport'][_0x2210('0x47')](_0x2a42f1)[_0x2210('0x24')](handleEntityNotFound(_0x2aa24e,null))[_0x2210('0x24')](respondWithResult(_0x2aa24e,null))['catch'](handleError(_0x2aa24e,null));};exports['create']=function(_0x27f39c,_0x7ed452){return db['SquareReport'][_0x2210('0x48')](_0x27f39c[_0x2210('0x49')],{})[_0x2210('0x24')](respondWithResult(_0x7ed452,0xc9))[_0x2210('0x42')](handleError(_0x7ed452,null));};exports[_0x2210('0x4a')]=function(_0x1b7fc0,_0x5484e3){if(_0x1b7fc0[_0x2210('0x49')]['id']){delete _0x1b7fc0[_0x2210('0x49')]['id'];}return db['SquareReport'][_0x2210('0x47')]({'where':{'id':_0x1b7fc0[_0x2210('0x44')]['id']}})[_0x2210('0x24')](handleEntityNotFound(_0x5484e3,null))['then'](saveUpdates(_0x1b7fc0['body'],null))[_0x2210('0x24')](respondWithResult(_0x5484e3,null))[_0x2210('0x42')](handleError(_0x5484e3,null));};exports['destroy']=function(_0x4ccad3,_0x4e99b2){return db[_0x2210('0x2c')][_0x2210('0x47')]({'where':{'id':_0x4ccad3[_0x2210('0x44')]['id']}})['then'](handleEntityNotFound(_0x4e99b2,null))[_0x2210('0x24')](removeEntity(_0x4e99b2,null))[_0x2210('0x42')](handleError(_0x4e99b2,null));};exports[_0x2210('0x4b')]=function(_0x2a7839,_0x43f150){return db[_0x2210('0x2c')][_0x2210('0x4b')]()['then'](respondWithResult(_0x43f150,null))['catch'](handleError(_0x43f150,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 1ffee14..3cdb81e 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 _0x16e0=['bluebird','rimraf','../../config/environment','./squareReport.attributes','define','SquareReport','report_square','uid_pname','project_name','leaveAt','lodash','util','moment'];(function(_0x4578f8,_0x199c11){var _0x1129f1=function(_0x8a4369){while(--_0x8a4369){_0x4578f8['push'](_0x4578f8['shift']());}};_0x1129f1(++_0x199c11);}(_0x16e0,0x101));var _0x016e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x16e0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x016e('0x0'));var util=require(_0x016e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x016e('0x2'));var BPromise=require(_0x016e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x016e('0x4'));var config=require(_0x016e('0x5'));var attributes=require(_0x016e('0x6'));module['exports']=function(_0xfdd246,_0x4048ba){return _0xfdd246[_0x016e('0x7')](_0x016e('0x8'),attributes,{'tableName':_0x016e('0x9'),'paranoid':![],'indexes':[{'name':_0x016e('0xa'),'fields':['uniqueid',_0x016e('0xb')]},{'name':_0x016e('0xc'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x84bb=['./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2644dd,_0x39d79e){var _0x4dad81=function(_0x4acbef){while(--_0x4acbef){_0x2644dd['push'](_0x2644dd['shift']());}};_0x4dad81(++_0x39d79e);}(_0x84bb,0x125));var _0xb84b=function(_0x218c0c,_0x2b21e3){_0x218c0c=_0x218c0c-0x0;var _0xf0347d=_0x84bb[_0x218c0c];return _0xf0347d;};'use strict';var _=require('lodash');var util=require(_0xb84b('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xb84b('0x1'));var BPromise=require(_0xb84b('0x2'));var rp=require(_0xb84b('0x3'));var fs=require('fs');var path=require(_0xb84b('0x4'));var rimraf=require(_0xb84b('0x5'));var config=require(_0xb84b('0x6'));var attributes=require(_0xb84b('0x7'));module[_0xb84b('0x8')]=function(_0x2850d0,_0x2fe9a8){return _0x2850d0[_0xb84b('0x9')](_0xb84b('0xa'),attributes,{'tableName':_0xb84b('0xb'),'paranoid':![],'indexes':[{'name':_0xb84b('0xc'),'fields':[_0xb84b('0xd'),_0xb84b('0xe')]},{'name':'leaveAt','fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index e93cecc..a61515d 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 _0x77e1=['stringify','error','code','message','SquareReport,\x20%s,\x20%s','result','catch','CreateSquareReport','SquareReport','create','options','raw','then','update','body','where','attributes','UpdateSquareReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','info','request\x20sent','debug'];(function(_0x2f4069,_0x74eb6c){var _0x4e5d90=function(_0x56fedf){while(--_0x56fedf){_0x2f4069['push'](_0x2f4069['shift']());}};_0x4e5d90(++_0x74eb6c);}(_0x77e1,0x92));var _0x177e=function(_0x48da68,_0x132675){_0x48da68=_0x48da68-0x0;var _0x512f87=_0x77e1[_0x48da68];return _0x512f87;};'use strict';var _=require(_0x177e('0x0'));var util=require(_0x177e('0x1'));var moment=require(_0x177e('0x2'));var BPromise=require(_0x177e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x177e('0x4'));var db=require(_0x177e('0x5'))['db'];var utils=require(_0x177e('0x6'));var logger=require(_0x177e('0x7'))('rpc');var config=require(_0x177e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x177e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f21a0,_0x8fe65d,_0x1ee08b){return new BPromise(function(_0x3c32f2,_0x1ee4e8){return client[_0x177e('0xa')](_0x4f21a0,_0x1ee08b)['then'](function(_0x1605d9){logger[_0x177e('0xb')]('SquareReport,\x20%s,\x20%s',_0x8fe65d,_0x177e('0xc'));logger[_0x177e('0xd')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x8fe65d,'request\x20sent',JSON[_0x177e('0xe')](_0x1605d9));if(_0x1605d9[_0x177e('0xf')]){if(_0x1605d9[_0x177e('0xf')][_0x177e('0x10')]===0x1f4){logger['error']('SquareReport,\x20%s,\x20%s',_0x8fe65d,_0x1605d9['error'][_0x177e('0x11')]);return _0x1ee4e8(_0x1605d9[_0x177e('0xf')][_0x177e('0x11')]);}logger[_0x177e('0xf')](_0x177e('0x12'),_0x8fe65d,_0x1605d9[_0x177e('0xf')]['message']);return _0x3c32f2(_0x1605d9[_0x177e('0xf')][_0x177e('0x11')]);}else{logger[_0x177e('0xb')]('SquareReport,\x20%s,\x20%s',_0x8fe65d,_0x177e('0xc'));_0x3c32f2(_0x1605d9[_0x177e('0x13')][_0x177e('0x11')]);}})[_0x177e('0x14')](function(_0xbd918d){logger[_0x177e('0xf')](_0x177e('0x12'),_0x8fe65d,_0xbd918d);_0x1ee4e8(_0xbd918d);});});}exports[_0x177e('0x15')]=function(_0x3290e4){var _0xe1a99f=this;return new Promise(function(_0x1b42f8,_0x4b14bd){return db[_0x177e('0x16')][_0x177e('0x17')](_0x3290e4['body'],{'raw':_0x3290e4[_0x177e('0x18')]?_0x3290e4['options'][_0x177e('0x19')]===undefined?!![]:![]:!![]})[_0x177e('0x1a')](function(_0x48fd93){logger['info']('CreateSquareReport',_0x3290e4);logger[_0x177e('0xd')](_0x177e('0x15'),_0x3290e4,JSON[_0x177e('0xe')](_0x48fd93));_0x1b42f8(_0x48fd93);})['catch'](function(_0x2e3e49){logger[_0x177e('0xf')](_0x177e('0x15'),_0x2e3e49[_0x177e('0x11')],_0x3290e4);_0x4b14bd(_0xe1a99f[_0x177e('0xf')](0x1f4,_0x2e3e49[_0x177e('0x11')]));});});};exports['UpdateSquareReport']=function(_0x3b6106){var _0x48e592=this;return new Promise(function(_0x27b3e6,_0x41db92){return db['SquareReport'][_0x177e('0x1b')](_0x3b6106[_0x177e('0x1c')],{'raw':_0x3b6106[_0x177e('0x18')]?_0x3b6106['options'][_0x177e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b6106['options']?_0x3b6106[_0x177e('0x18')][_0x177e('0x1d')]||null:null,'attributes':_0x3b6106[_0x177e('0x18')]?_0x3b6106[_0x177e('0x18')][_0x177e('0x1e')]||null:null,'limit':_0x3b6106[_0x177e('0x18')]?_0x3b6106[_0x177e('0x18')]['limit']||null:null})[_0x177e('0x1a')](function(_0x3a1846){logger[_0x177e('0xb')](_0x177e('0x1f'),_0x3b6106);logger[_0x177e('0xd')](_0x177e('0x1f'),_0x3b6106,JSON['stringify'](_0x3a1846));_0x27b3e6(_0x3a1846);})[_0x177e('0x14')](function(_0x372312){logger[_0x177e('0xf')]('UpdateSquareReport',_0x372312[_0x177e('0x11')],_0x3b6106);_0x41db92(_0x48e592[_0x177e('0xf')](0x1f4,_0x372312[_0x177e('0x11')]));});});}; \ No newline at end of file +var _0x8684=['update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateSquareReport','SquareReport','create','options','raw','debug','UpdateSquareReport'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x8684,0x10c));var _0x4868=function(_0x375bdb,_0x47251a){_0x375bdb=_0x375bdb-0x0;var _0xa3bfd4=_0x8684[_0x375bdb];return _0xa3bfd4;};'use strict';var _=require(_0x4868('0x0'));var util=require(_0x4868('0x1'));var moment=require(_0x4868('0x2'));var BPromise=require(_0x4868('0x3'));var rs=require(_0x4868('0x4'));var fs=require('fs');var Redis=require(_0x4868('0x5'));var db=require(_0x4868('0x6'))['db'];var utils=require(_0x4868('0x7'));var logger=require('../../config/logger')(_0x4868('0x8'));var config=require(_0x4868('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4868('0xa')][_0x4868('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23e74e,_0x54d104,_0x57eabf){return new BPromise(function(_0x170fe7,_0xf5c5b4){return client[_0x4868('0xc')](_0x23e74e,_0x57eabf)[_0x4868('0xd')](function(_0x13a451){logger[_0x4868('0xe')](_0x4868('0xf'),_0x54d104,_0x4868('0x10'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x54d104,_0x4868('0x10'),JSON[_0x4868('0x11')](_0x13a451));if(_0x13a451[_0x4868('0x12')]){if(_0x13a451[_0x4868('0x12')]['code']===0x1f4){logger[_0x4868('0x12')]('SquareReport,\x20%s,\x20%s',_0x54d104,_0x13a451[_0x4868('0x12')][_0x4868('0x13')]);return _0xf5c5b4(_0x13a451[_0x4868('0x12')][_0x4868('0x13')]);}logger['error']('SquareReport,\x20%s,\x20%s',_0x54d104,_0x13a451[_0x4868('0x12')][_0x4868('0x13')]);return _0x170fe7(_0x13a451[_0x4868('0x12')]['message']);}else{logger['info'](_0x4868('0xf'),_0x54d104,'request\x20sent');_0x170fe7(_0x13a451[_0x4868('0x14')][_0x4868('0x13')]);}})[_0x4868('0x15')](function(_0x171940){logger[_0x4868('0x12')](_0x4868('0xf'),_0x54d104,_0x171940);_0xf5c5b4(_0x171940);});});}exports[_0x4868('0x16')]=function(_0x459e46){var _0x3aba6c=this;return new Promise(function(_0x42d55b,_0x2744d4){return db[_0x4868('0x17')][_0x4868('0x18')](_0x459e46['body'],{'raw':_0x459e46[_0x4868('0x19')]?_0x459e46[_0x4868('0x19')][_0x4868('0x1a')]===undefined?!![]:![]:!![]})[_0x4868('0xd')](function(_0x2e0180){logger['info']('CreateSquareReport',_0x459e46);logger[_0x4868('0x1b')]('CreateSquareReport',_0x459e46,JSON[_0x4868('0x11')](_0x2e0180));_0x42d55b(_0x2e0180);})[_0x4868('0x15')](function(_0x13e1f5){logger[_0x4868('0x12')](_0x4868('0x16'),_0x13e1f5[_0x4868('0x13')],_0x459e46);_0x2744d4(_0x3aba6c[_0x4868('0x12')](0x1f4,_0x13e1f5[_0x4868('0x13')]));});});};exports[_0x4868('0x1c')]=function(_0x33a9f5){var _0x568fd5=this;return new Promise(function(_0x5bc5b8,_0x1bcb88){return db[_0x4868('0x17')][_0x4868('0x1d')](_0x33a9f5['body'],{'raw':_0x33a9f5[_0x4868('0x19')]?_0x33a9f5[_0x4868('0x19')][_0x4868('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33a9f5['options']?_0x33a9f5[_0x4868('0x19')][_0x4868('0x1e')]||null:null,'attributes':_0x33a9f5['options']?_0x33a9f5[_0x4868('0x19')][_0x4868('0x1f')]||null:null,'limit':_0x33a9f5['options']?_0x33a9f5[_0x4868('0x19')][_0x4868('0x20')]||null:null})[_0x4868('0xd')](function(_0x462e41){logger[_0x4868('0xe')]('UpdateSquareReport',_0x33a9f5);logger['debug'](_0x4868('0x1c'),_0x33a9f5,JSON['stringify'](_0x462e41));_0x5bc5b8(_0x462e41);})[_0x4868('0x15')](function(_0x383db8){logger[_0x4868('0x12')]('UpdateSquareReport',_0x383db8[_0x4868('0x13')],_0x33a9f5);_0x1bcb88(_0x568fd5[_0x4868('0x12')](0x1f4,_0x383db8[_0x4868('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index e048560..f66f948 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 _0x34af=['describe','/:id','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','isAuthenticated','get','/describe'];(function(_0x2a66b8,_0x2f9832){var _0x10e01c=function(_0x4c0914){while(--_0x4c0914){_0x2a66b8['push'](_0x2a66b8['shift']());}};_0x10e01c(++_0x2f9832);}(_0x34af,0x1ad));var _0xf34a=function(_0x146e34,_0x35a8be){_0x146e34=_0x146e34-0x0;var _0x13e10c=_0x34af[_0x146e34];return _0x13e10c;};'use strict';var multer=require(_0xf34a('0x0'));var util=require('util');var path=require(_0xf34a('0x1'));var timeout=require(_0xf34a('0x2'));var express=require('express');var router=express[_0xf34a('0x3')]();var fs_extra=require(_0xf34a('0x4'));var auth=require(_0xf34a('0x5'));var interaction=require(_0xf34a('0x6'));var config=require(_0xf34a('0x7'));var controller=require(_0xf34a('0x8'));router['get']('/',auth[_0xf34a('0x9')](),controller['index']);router[_0xf34a('0xa')](_0xf34a('0xb'),auth[_0xf34a('0x9')](),controller[_0xf34a('0xc')]);router['get'](_0xf34a('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xf34a('0xe')]('/',auth[_0xf34a('0x9')](),controller[_0xf34a('0xf')]);router[_0xf34a('0x10')](_0xf34a('0xd'),auth[_0xf34a('0x9')](),controller[_0xf34a('0x11')]);router[_0xf34a('0x12')](_0xf34a('0xd'),auth[_0xf34a('0x9')](),controller[_0xf34a('0x13')]);module[_0xf34a('0x14')]=router; \ No newline at end of file +var _0x4676=['../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x499f6c,_0x59afb8){var _0x32e3e9=function(_0x4969ec){while(--_0x4969ec){_0x499f6c['push'](_0x499f6c['shift']());}};_0x32e3e9(++_0x59afb8);}(_0x4676,0x189));var _0x6467=function(_0x5d3e7f,_0x36e3f6){_0x5d3e7f=_0x5d3e7f-0x0;var _0x1f1924=_0x4676[_0x5d3e7f];return _0x1f1924;};'use strict';var multer=require(_0x6467('0x0'));var util=require(_0x6467('0x1'));var path=require(_0x6467('0x2'));var timeout=require(_0x6467('0x3'));var express=require(_0x6467('0x4'));var router=express[_0x6467('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6467('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6467('0x7'));var controller=require(_0x6467('0x8'));router[_0x6467('0x9')]('/',auth[_0x6467('0xa')](),controller[_0x6467('0xb')]);router[_0x6467('0x9')](_0x6467('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x6467('0x9')](_0x6467('0xd'),auth[_0x6467('0xa')](),controller[_0x6467('0xe')]);router[_0x6467('0xf')]('/',auth[_0x6467('0xa')](),controller[_0x6467('0x10')]);router[_0x6467('0x11')](_0x6467('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x6467('0x12')](_0x6467('0xd'),auth[_0x6467('0xa')](),controller[_0x6467('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 5d98029..768032d 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 _0x40c4=['TEXT','sequelize','STRING'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x40c4,0x181));var _0x440c=function(_0x2fd123,_0x3649e4){_0x2fd123=_0x2fd123-0x0;var _0x14686b=_0x40c4[_0x2fd123];return _0x14686b;};'use strict';var Sequelize=require(_0x440c('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x440c('0x1')]},'node':{'type':Sequelize[_0x440c('0x1')]},'application':{'type':Sequelize[_0x440c('0x1')]},'data':{'type':Sequelize[_0x440c('0x2')]},'project_name':{'type':Sequelize[_0x440c('0x1')]},'callerid':{'type':Sequelize[_0x440c('0x1')]}}; \ No newline at end of file +var _0xd271=['sequelize','STRING','TEXT'];(function(_0x31efa0,_0x5a9446){var _0x464219=function(_0xb3e1b5){while(--_0xb3e1b5){_0x31efa0['push'](_0x31efa0['shift']());}};_0x464219(++_0x5a9446);}(_0xd271,0x1aa));var _0x1d27=function(_0x1b9a43,_0x3a36e5){_0x1b9a43=_0x1b9a43-0x0;var _0x17db14=_0xd271[_0x1b9a43];return _0x17db14;};'use strict';var Sequelize=require(_0x1d27('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x1d27('0x1')]},'data':{'type':Sequelize[_0x1d27('0x2')]},'project_name':{'type':Sequelize[_0x1d27('0x1')]},'callerid':{'type':Sequelize[_0x1d27('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 93683b0..73f899e 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 _0x43ed=['filter','merge','VIRTUAL','options','include','rows','catch','show','params','length','includeAll','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','then','destroy','sendStatus','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick'];(function(_0x481ff7,_0x2b6ebb){var _0x1c1573=function(_0x4933fe){while(--_0x4933fe){_0x481ff7['push'](_0x481ff7['shift']());}};_0x1c1573(++_0x2b6ebb);}(_0x43ed,0xeb));var _0xd43e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x43ed[_0x2bf141];return _0x48277b;};'use strict';var emlformat=require(_0xd43e('0x0'));var rimraf=require(_0xd43e('0x1'));var zipdir=require(_0xd43e('0x2'));var jsonpatch=require(_0xd43e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd43e('0x4'));var Mustache=require(_0xd43e('0x5'));var util=require(_0xd43e('0x6'));var path=require(_0xd43e('0x7'));var sox=require(_0xd43e('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd43e('0x9'));var _=require(_0xd43e('0xa'));var squel=require('squel');var crypto=require(_0xd43e('0xb'));var jsforce=require(_0xd43e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd43e('0xd'));var querystring=require('querystring');var Papa=require(_0xd43e('0xe'));var Redis=require(_0xd43e('0xf'));var authService=require(_0xd43e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd43e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd43e('0x12'));var utils=require(_0xd43e('0x13'));var config=require(_0xd43e('0x14'));var licenseUtil=require(_0xd43e('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53e6d1,_0x36d716){_0x36d716=_0x36d716||0xcc;return function(_0x5a9edb){if(_0x5a9edb){return _0x53e6d1['sendStatus'](_0x36d716);}return _0x53e6d1[_0xd43e('0x16')](_0x36d716)[_0xd43e('0x17')]();};}function respondWithResult(_0x5853bd,_0x546d35){_0x546d35=_0x546d35||0xc8;return function(_0x202d35){if(_0x202d35){return _0x5853bd['status'](_0x546d35)[_0xd43e('0x18')](_0x202d35);}};}function respondWithFilteredResult(_0x401d8e,_0x46841b){return function(_0x3c9493){if(_0x3c9493){var _0x3b8ce7=typeof _0x46841b['offset']===_0xd43e('0x19')&&typeof _0x46841b[_0xd43e('0x1a')]===_0xd43e('0x19');var _0x4784d2=_0x3c9493[_0xd43e('0x1b')];var _0xf04e51=_0x3b8ce7?0x0:_0x46841b['offset'];var _0x2f6272=_0x3b8ce7?_0x3c9493[_0xd43e('0x1b')]:_0x46841b[_0xd43e('0x1c')]+_0x46841b[_0xd43e('0x1a')];var _0x2db6ad;if(_0x2f6272>=_0x4784d2){_0x2f6272=_0x4784d2;_0x2db6ad=0xc8;}else{_0x2db6ad=0xce;}_0x401d8e[_0xd43e('0x16')](_0x2db6ad);return _0x401d8e['set'](_0xd43e('0x1d'),_0xf04e51+'-'+_0x2f6272+'/'+_0x4784d2)[_0xd43e('0x18')](_0x3c9493);}return null;};}function patchUpdates(_0x4deda3){return function(_0x4005de){try{jsonpatch[_0xd43e('0x1e')](_0x4005de,_0x4deda3,!![]);}catch(_0x2a53fc){return BPromise['reject'](_0x2a53fc);}return _0x4005de[_0xd43e('0x1f')]();};}function saveUpdates(_0x1e99ed,_0xa59e18){return function(_0x5b086a){if(_0x5b086a){return _0x5b086a['update'](_0x1e99ed)[_0xd43e('0x20')](function(_0x1c53a7){return _0x1c53a7;});}return null;};}function removeEntity(_0x513581,_0x2952c0){return function(_0x1f1b05){if(_0x1f1b05){return _0x1f1b05[_0xd43e('0x21')]()[_0xd43e('0x20')](function(){_0x513581[_0xd43e('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4087e9,_0xdd415f){return function(_0x41a9f3){if(!_0x41a9f3){_0x4087e9[_0xd43e('0x22')](0x194);}return _0x41a9f3;};}function handleError(_0x4c51b2,_0x14bccd){_0x14bccd=_0x14bccd||0x1f4;return function(_0x4cd1e6){logger['error'](_0x4cd1e6[_0xd43e('0x23')]);if(_0x4cd1e6[_0xd43e('0x24')]){delete _0x4cd1e6['name'];}_0x4c51b2[_0xd43e('0x16')](_0x14bccd)[_0xd43e('0x25')](_0x4cd1e6);};}exports[_0xd43e('0x26')]=function(_0x3f99ea,_0x2aa513){var _0x5a7fd7={},_0x145570={},_0x311172={'count':0x0,'rows':[]};var _0x4a8be4=_[_0xd43e('0x27')](db[_0xd43e('0x28')][_0xd43e('0x29')],function(_0x24d2ac){return{'name':_0x24d2ac[_0xd43e('0x2a')],'type':_0x24d2ac[_0xd43e('0x2b')][_0xd43e('0x2c')]};});_0x145570[_0xd43e('0x2d')]=_['map'](_0x4a8be4,'name');_0x145570[_0xd43e('0x2e')]=_[_0xd43e('0x2f')](_0x3f99ea[_0xd43e('0x2e')]);_0x145570[_0xd43e('0x30')]=_[_0xd43e('0x31')](_0x145570[_0xd43e('0x2d')],_0x145570['query']);_0x5a7fd7[_0xd43e('0x32')]=_[_0xd43e('0x31')](_0x145570[_0xd43e('0x2d')],qs[_0xd43e('0x33')](_0x3f99ea[_0xd43e('0x2e')][_0xd43e('0x33')]));_0x5a7fd7[_0xd43e('0x32')]=_0x5a7fd7['attributes']['length']?_0x5a7fd7[_0xd43e('0x32')]:_0x145570[_0xd43e('0x2d')];if(!_0x3f99ea[_0xd43e('0x2e')][_0xd43e('0x34')]('nolimit')){_0x5a7fd7[_0xd43e('0x1a')]=qs[_0xd43e('0x1a')](_0x3f99ea[_0xd43e('0x2e')]['limit']);_0x5a7fd7['offset']=qs[_0xd43e('0x1c')](_0x3f99ea[_0xd43e('0x2e')][_0xd43e('0x1c')]);}_0x5a7fd7[_0xd43e('0x35')]=qs['sort'](_0x3f99ea[_0xd43e('0x2e')][_0xd43e('0x36')]);_0x5a7fd7[_0xd43e('0x37')]=qs[_0xd43e('0x30')](_[_0xd43e('0x38')](_0x3f99ea['query'],_0x145570[_0xd43e('0x30')]),_0x4a8be4);if(_0x3f99ea[_0xd43e('0x2e')][_0xd43e('0x39')]){_0x5a7fd7['where']=_[_0xd43e('0x3a')](_0x5a7fd7[_0xd43e('0x37')],{'$or':_['map'](_0x4a8be4,function(_0x16d231){if(_0x16d231[_0xd43e('0x2b')]!==_0xd43e('0x3b')){var _0x13f412={};_0x13f412[_0x16d231[_0xd43e('0x24')]]={'$like':'%'+_0x3f99ea[_0xd43e('0x2e')][_0xd43e('0x39')]+'%'};return _0x13f412;}})});}_0x5a7fd7=_['merge']({},_0x5a7fd7,_0x3f99ea[_0xd43e('0x3c')]);var _0x18aa31={'where':_0x5a7fd7[_0xd43e('0x37')]};return db['SquareDetailsReport'][_0xd43e('0x1b')](_0x18aa31)[_0xd43e('0x20')](function(_0xb8ac67){_0x311172['count']=_0xb8ac67;if(_0x3f99ea[_0xd43e('0x2e')]['includeAll']){_0x5a7fd7[_0xd43e('0x3d')]=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x5a7fd7);})[_0xd43e('0x20')](function(_0x18c179){_0x311172[_0xd43e('0x3e')]=_0x18c179;return _0x311172;})[_0xd43e('0x20')](respondWithFilteredResult(_0x2aa513,_0x5a7fd7))[_0xd43e('0x3f')](handleError(_0x2aa513,null));};exports[_0xd43e('0x40')]=function(_0x5aa8ce,_0x53477a){var _0x332832={'raw':!![],'where':{'id':_0x5aa8ce[_0xd43e('0x41')]['id']}},_0x1cb09f={};_0x1cb09f['model']=_[_0xd43e('0x2f')](db[_0xd43e('0x28')]['rawAttributes']);_0x1cb09f[_0xd43e('0x2e')]=_[_0xd43e('0x2f')](_0x5aa8ce['query']);_0x1cb09f['filters']=_[_0xd43e('0x31')](_0x1cb09f['model'],_0x1cb09f[_0xd43e('0x2e')]);_0x332832[_0xd43e('0x32')]=_['intersection'](_0x1cb09f[_0xd43e('0x2d')],qs[_0xd43e('0x33')](_0x5aa8ce[_0xd43e('0x2e')][_0xd43e('0x33')]));_0x332832['attributes']=_0x332832[_0xd43e('0x32')][_0xd43e('0x42')]?_0x332832[_0xd43e('0x32')]:_0x1cb09f[_0xd43e('0x2d')];if(_0x5aa8ce[_0xd43e('0x2e')][_0xd43e('0x43')]){_0x332832[_0xd43e('0x3d')]=[{'all':!![]}];}_0x332832=_['merge']({},_0x332832,_0x5aa8ce['options']);return db[_0xd43e('0x28')][_0xd43e('0x44')](_0x332832)[_0xd43e('0x20')](handleEntityNotFound(_0x53477a,null))[_0xd43e('0x20')](respondWithResult(_0x53477a,null))[_0xd43e('0x3f')](handleError(_0x53477a,null));};exports[_0xd43e('0x45')]=function(_0x2e73fc,_0xe0043d){return db['SquareDetailsReport']['create'](_0x2e73fc[_0xd43e('0x46')],{})[_0xd43e('0x20')](respondWithResult(_0xe0043d,0xc9))[_0xd43e('0x3f')](handleError(_0xe0043d,null));};exports[_0xd43e('0x47')]=function(_0x1a7eb7,_0x5d6049){if(_0x1a7eb7[_0xd43e('0x46')]['id']){delete _0x1a7eb7['body']['id'];}return db['SquareDetailsReport'][_0xd43e('0x44')]({'where':{'id':_0x1a7eb7[_0xd43e('0x41')]['id']}})[_0xd43e('0x20')](handleEntityNotFound(_0x5d6049,null))['then'](saveUpdates(_0x1a7eb7[_0xd43e('0x46')],null))[_0xd43e('0x20')](respondWithResult(_0x5d6049,null))['catch'](handleError(_0x5d6049,null));};exports['destroy']=function(_0x145d16,_0x56375e){return db[_0xd43e('0x28')][_0xd43e('0x44')]({'where':{'id':_0x145d16[_0xd43e('0x41')]['id']}})['then'](handleEntityNotFound(_0x56375e,null))[_0xd43e('0x20')](removeEntity(_0x56375e,null))[_0xd43e('0x3f')](handleError(_0x56375e,null));};exports[_0xd43e('0x48')]=function(_0x57293e,_0x339252){return db['SquareDetailsReport']['describe']()[_0xd43e('0x20')](respondWithResult(_0x339252,null))[_0xd43e('0x3f')](handleError(_0x339252,null));}; \ No newline at end of file +var _0xb6de=['to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','SquareDetailsReport','include','findAll','rows','params','includeAll','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox'];(function(_0x237b66,_0x4e16d3){var _0x4124eb=function(_0x21f0ea){while(--_0x21f0ea){_0x237b66['push'](_0x237b66['shift']());}};_0x4124eb(++_0x4e16d3);}(_0xb6de,0x16e));var _0xeb6d=function(_0x2410fd,_0x339f3d){_0x2410fd=_0x2410fd-0x0;var _0x3bde1d=_0xb6de[_0x2410fd];return _0x3bde1d;};'use strict';var emlformat=require(_0xeb6d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeb6d('0x1'));var jsonpatch=require(_0xeb6d('0x2'));var rp=require(_0xeb6d('0x3'));var moment=require(_0xeb6d('0x4'));var BPromise=require(_0xeb6d('0x5'));var Mustache=require('mustache');var util=require(_0xeb6d('0x6'));var path=require(_0xeb6d('0x7'));var sox=require(_0xeb6d('0x8'));var csv=require(_0xeb6d('0x9'));var ejs=require(_0xeb6d('0xa'));var fs=require('fs');var fs_extra=require(_0xeb6d('0xb'));var _=require(_0xeb6d('0xc'));var squel=require('squel');var crypto=require(_0xeb6d('0xd'));var jsforce=require(_0xeb6d('0xe'));var deskjs=require(_0xeb6d('0xf'));var toCsv=require(_0xeb6d('0x9'));var querystring=require(_0xeb6d('0x10'));var Papa=require('papaparse');var Redis=require(_0xeb6d('0x11'));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(_0xeb6d('0x12'))(_0xeb6d('0x13'));var utils=require(_0xeb6d('0x14'));var config=require(_0xeb6d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xeb6d('0x16'))['db'];function respondWithStatusCode(_0x5a7f71,_0x11ba5e){_0x11ba5e=_0x11ba5e||0xcc;return function(_0x27e13e){if(_0x27e13e){return _0x5a7f71[_0xeb6d('0x17')](_0x11ba5e);}return _0x5a7f71[_0xeb6d('0x18')](_0x11ba5e)[_0xeb6d('0x19')]();};}function respondWithResult(_0xe0d745,_0x49345d){_0x49345d=_0x49345d||0xc8;return function(_0x553c19){if(_0x553c19){return _0xe0d745[_0xeb6d('0x18')](_0x49345d)[_0xeb6d('0x1a')](_0x553c19);}};}function respondWithFilteredResult(_0x119f71,_0x1fdf95){return function(_0x41661c){if(_0x41661c){var _0x26fa3f=typeof _0x1fdf95['offset']==='undefined'&&typeof _0x1fdf95[_0xeb6d('0x1b')]===_0xeb6d('0x1c');var _0x29bd0b=_0x41661c[_0xeb6d('0x1d')];var _0x503d4c=_0x26fa3f?0x0:_0x1fdf95[_0xeb6d('0x1e')];var _0x1a7e4f=_0x26fa3f?_0x41661c[_0xeb6d('0x1d')]:_0x1fdf95[_0xeb6d('0x1e')]+_0x1fdf95[_0xeb6d('0x1b')];var _0x3f5aa9;if(_0x1a7e4f>=_0x29bd0b){_0x1a7e4f=_0x29bd0b;_0x3f5aa9=0xc8;}else{_0x3f5aa9=0xce;}_0x119f71['status'](_0x3f5aa9);return _0x119f71[_0xeb6d('0x1f')]('Content-Range',_0x503d4c+'-'+_0x1a7e4f+'/'+_0x29bd0b)['json'](_0x41661c);}return null;};}function patchUpdates(_0x22f0db){return function(_0xfc44b3){try{jsonpatch[_0xeb6d('0x20')](_0xfc44b3,_0x22f0db,!![]);}catch(_0x4276c7){return BPromise[_0xeb6d('0x21')](_0x4276c7);}return _0xfc44b3[_0xeb6d('0x22')]();};}function saveUpdates(_0x2aca43,_0xe02c85){return function(_0x1f6f25){if(_0x1f6f25){return _0x1f6f25[_0xeb6d('0x23')](_0x2aca43)[_0xeb6d('0x24')](function(_0x18f9b9){return _0x18f9b9;});}return null;};}function removeEntity(_0x2fd687,_0x4f74b5){return function(_0x42e57c){if(_0x42e57c){return _0x42e57c[_0xeb6d('0x25')]()['then'](function(){_0x2fd687[_0xeb6d('0x18')](0xcc)[_0xeb6d('0x19')]();});}};}function handleEntityNotFound(_0x3e2000,_0x365a43){return function(_0x28a100){if(!_0x28a100){_0x3e2000[_0xeb6d('0x17')](0x194);}return _0x28a100;};}function handleError(_0xf3f1b4,_0x3e54e9){_0x3e54e9=_0x3e54e9||0x1f4;return function(_0xe2ae3c){logger[_0xeb6d('0x26')](_0xe2ae3c[_0xeb6d('0x27')]);if(_0xe2ae3c['name']){delete _0xe2ae3c[_0xeb6d('0x28')];}_0xf3f1b4[_0xeb6d('0x18')](_0x3e54e9)[_0xeb6d('0x29')](_0xe2ae3c);};}exports[_0xeb6d('0x2a')]=function(_0x2ad023,_0x3c1d57){var _0x24ed51={},_0x4e3d82={},_0x694942={'count':0x0,'rows':[]};var _0xc4c037=_[_0xeb6d('0x2b')](db['SquareDetailsReport'][_0xeb6d('0x2c')],function(_0x30a8b2){return{'name':_0x30a8b2['fieldName'],'type':_0x30a8b2[_0xeb6d('0x2d')][_0xeb6d('0x2e')]};});_0x4e3d82[_0xeb6d('0x2f')]=_[_0xeb6d('0x2b')](_0xc4c037,_0xeb6d('0x28'));_0x4e3d82[_0xeb6d('0x30')]=_[_0xeb6d('0x31')](_0x2ad023['query']);_0x4e3d82['filters']=_[_0xeb6d('0x32')](_0x4e3d82[_0xeb6d('0x2f')],_0x4e3d82[_0xeb6d('0x30')]);_0x24ed51['attributes']=_[_0xeb6d('0x32')](_0x4e3d82[_0xeb6d('0x2f')],qs[_0xeb6d('0x33')](_0x2ad023[_0xeb6d('0x30')]['fields']));_0x24ed51['attributes']=_0x24ed51['attributes'][_0xeb6d('0x34')]?_0x24ed51[_0xeb6d('0x35')]:_0x4e3d82[_0xeb6d('0x2f')];if(!_0x2ad023[_0xeb6d('0x30')][_0xeb6d('0x36')](_0xeb6d('0x37'))){_0x24ed51[_0xeb6d('0x1b')]=qs[_0xeb6d('0x1b')](_0x2ad023['query']['limit']);_0x24ed51[_0xeb6d('0x1e')]=qs[_0xeb6d('0x1e')](_0x2ad023['query']['offset']);}_0x24ed51[_0xeb6d('0x38')]=qs[_0xeb6d('0x39')](_0x2ad023[_0xeb6d('0x30')][_0xeb6d('0x39')]);_0x24ed51[_0xeb6d('0x3a')]=qs[_0xeb6d('0x3b')](_[_0xeb6d('0x3c')](_0x2ad023[_0xeb6d('0x30')],_0x4e3d82[_0xeb6d('0x3b')]),_0xc4c037);if(_0x2ad023[_0xeb6d('0x30')][_0xeb6d('0x3d')]){_0x24ed51['where']=_['merge'](_0x24ed51[_0xeb6d('0x3a')],{'$or':_[_0xeb6d('0x2b')](_0xc4c037,function(_0x52983e){if(_0x52983e[_0xeb6d('0x2d')]!==_0xeb6d('0x3e')){var _0x35e490={};_0x35e490[_0x52983e[_0xeb6d('0x28')]]={'$like':'%'+_0x2ad023['query'][_0xeb6d('0x3d')]+'%'};return _0x35e490;}})});}_0x24ed51=_['merge']({},_0x24ed51,_0x2ad023[_0xeb6d('0x3f')]);var _0x19a1a7={'where':_0x24ed51[_0xeb6d('0x3a')]};return db[_0xeb6d('0x40')][_0xeb6d('0x1d')](_0x19a1a7)[_0xeb6d('0x24')](function(_0x97283){_0x694942['count']=_0x97283;if(_0x2ad023[_0xeb6d('0x30')]['includeAll']){_0x24ed51[_0xeb6d('0x41')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0xeb6d('0x42')](_0x24ed51);})[_0xeb6d('0x24')](function(_0x100ae3){_0x694942[_0xeb6d('0x43')]=_0x100ae3;return _0x694942;})[_0xeb6d('0x24')](respondWithFilteredResult(_0x3c1d57,_0x24ed51))['catch'](handleError(_0x3c1d57,null));};exports['show']=function(_0xd6bffa,_0x41070a){var _0x4043d5={'raw':!![],'where':{'id':_0xd6bffa[_0xeb6d('0x44')]['id']}},_0x437a14={};_0x437a14[_0xeb6d('0x2f')]=_[_0xeb6d('0x31')](db[_0xeb6d('0x40')][_0xeb6d('0x2c')]);_0x437a14['query']=_[_0xeb6d('0x31')](_0xd6bffa[_0xeb6d('0x30')]);_0x437a14[_0xeb6d('0x3b')]=_[_0xeb6d('0x32')](_0x437a14[_0xeb6d('0x2f')],_0x437a14[_0xeb6d('0x30')]);_0x4043d5[_0xeb6d('0x35')]=_[_0xeb6d('0x32')](_0x437a14[_0xeb6d('0x2f')],qs[_0xeb6d('0x33')](_0xd6bffa[_0xeb6d('0x30')]['fields']));_0x4043d5[_0xeb6d('0x35')]=_0x4043d5['attributes'][_0xeb6d('0x34')]?_0x4043d5['attributes']:_0x437a14[_0xeb6d('0x2f')];if(_0xd6bffa[_0xeb6d('0x30')][_0xeb6d('0x45')]){_0x4043d5[_0xeb6d('0x41')]=[{'all':!![]}];}_0x4043d5=_['merge']({},_0x4043d5,_0xd6bffa[_0xeb6d('0x3f')]);return db[_0xeb6d('0x40')][_0xeb6d('0x46')](_0x4043d5)[_0xeb6d('0x24')](handleEntityNotFound(_0x41070a,null))[_0xeb6d('0x24')](respondWithResult(_0x41070a,null))[_0xeb6d('0x47')](handleError(_0x41070a,null));};exports[_0xeb6d('0x48')]=function(_0x5ca183,_0x381282){return db[_0xeb6d('0x40')][_0xeb6d('0x48')](_0x5ca183['body'],{})[_0xeb6d('0x24')](respondWithResult(_0x381282,0xc9))[_0xeb6d('0x47')](handleError(_0x381282,null));};exports['update']=function(_0x209858,_0x365ca9){if(_0x209858['body']['id']){delete _0x209858[_0xeb6d('0x49')]['id'];}return db[_0xeb6d('0x40')][_0xeb6d('0x46')]({'where':{'id':_0x209858[_0xeb6d('0x44')]['id']}})[_0xeb6d('0x24')](handleEntityNotFound(_0x365ca9,null))[_0xeb6d('0x24')](saveUpdates(_0x209858[_0xeb6d('0x49')],null))[_0xeb6d('0x24')](respondWithResult(_0x365ca9,null))[_0xeb6d('0x47')](handleError(_0x365ca9,null));};exports[_0xeb6d('0x25')]=function(_0x3cf9b5,_0x546c37){return db[_0xeb6d('0x40')][_0xeb6d('0x46')]({'where':{'id':_0x3cf9b5[_0xeb6d('0x44')]['id']}})[_0xeb6d('0x24')](handleEntityNotFound(_0x546c37,null))[_0xeb6d('0x24')](removeEntity(_0x546c37,null))[_0xeb6d('0x47')](handleError(_0x546c37,null));};exports['describe']=function(_0x400cd4,_0x47b041){return db['SquareDetailsReport'][_0xeb6d('0x4a')]()[_0xeb6d('0x24')](respondWithResult(_0x47b041,null))[_0xeb6d('0x47')](handleError(_0x47b041,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 9b2726c..2777842 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 _0x2fb3=['path','rimraf','../../config/environment','./squareReportDetail.attributes','define','SquareDetailsReport','util','api','moment','bluebird'];(function(_0x5e2854,_0x386173){var _0x3e4cd5=function(_0x4ed14b){while(--_0x4ed14b){_0x5e2854['push'](_0x5e2854['shift']());}};_0x3e4cd5(++_0x386173);}(_0x2fb3,0x92));var _0x32fb=function(_0x3f45de,_0x73f3e){_0x3f45de=_0x3f45de-0x0;var _0x20f1bd=_0x2fb3[_0x3f45de];return _0x20f1bd;};'use strict';var _=require('lodash');var util=require(_0x32fb('0x0'));var logger=require('../../config/logger')(_0x32fb('0x1'));var moment=require(_0x32fb('0x2'));var BPromise=require(_0x32fb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32fb('0x4'));var rimraf=require(_0x32fb('0x5'));var config=require(_0x32fb('0x6'));var attributes=require(_0x32fb('0x7'));module['exports']=function(_0x321279,_0xe11f0d){return _0x321279[_0x32fb('0x8')](_0x32fb('0x9'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x87e0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','report_square_details','util'];(function(_0x2ee48b,_0x277fa1){var _0x1575c8=function(_0x299e12){while(--_0x299e12){_0x2ee48b['push'](_0x2ee48b['shift']());}};_0x1575c8(++_0x277fa1);}(_0x87e0,0x1df));var _0x087e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x87e0[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x087e('0x0'));var logger=require(_0x087e('0x1'))(_0x087e('0x2'));var moment=require(_0x087e('0x3'));var BPromise=require(_0x087e('0x4'));var rp=require(_0x087e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x087e('0x6'));var config=require(_0x087e('0x7'));var attributes=require(_0x087e('0x8'));module[_0x087e('0x9')]=function(_0x522987,_0x5d8e01){return _0x522987[_0x087e('0xa')]('SquareDetailsReport',attributes,{'tableName':_0x087e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 126f56c..e07c15c 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 _0xa32b=['create','body','CreateSquareDetailsReport','stringify','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','request\x20sent','error','SquareDetailsReport,\x20%s,\x20%s','message','info','result','catch','SquareDetailsReport'];(function(_0x134827,_0x21f6ed){var _0x366671=function(_0x4dc8d4){while(--_0x4dc8d4){_0x134827['push'](_0x134827['shift']());}};_0x366671(++_0x21f6ed);}(_0xa32b,0x68));var _0xba32=function(_0x32a81f,_0x4eee66){_0x32a81f=_0x32a81f-0x0;var _0x5b67a2=_0xa32b[_0x32a81f];return _0x5b67a2;};'use strict';var _=require(_0xba32('0x0'));var util=require('util');var moment=require(_0xba32('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba32('0x2'));var db=require(_0xba32('0x3'))['db'];var utils=require(_0xba32('0x4'));var logger=require('../../config/logger')(_0xba32('0x5'));var config=require(_0xba32('0x6'));var jayson=require(_0xba32('0x7'));var client=jayson[_0xba32('0x8')][_0xba32('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c5a59,_0x1b1332,_0x4edbc6){return new BPromise(function(_0xcdcc5b,_0x13395b){return client[_0xba32('0xa')](_0x5c5a59,_0x4edbc6)[_0xba32('0xb')](function(_0x5d8f64){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x1b1332,'request\x20sent');logger[_0xba32('0xc')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x1b1332,_0xba32('0xd'),JSON['stringify'](_0x5d8f64));if(_0x5d8f64[_0xba32('0xe')]){if(_0x5d8f64['error']['code']===0x1f4){logger[_0xba32('0xe')](_0xba32('0xf'),_0x1b1332,_0x5d8f64[_0xba32('0xe')][_0xba32('0x10')]);return _0x13395b(_0x5d8f64[_0xba32('0xe')]['message']);}logger[_0xba32('0xe')](_0xba32('0xf'),_0x1b1332,_0x5d8f64[_0xba32('0xe')][_0xba32('0x10')]);return _0xcdcc5b(_0x5d8f64[_0xba32('0xe')][_0xba32('0x10')]);}else{logger[_0xba32('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x1b1332,_0xba32('0xd'));_0xcdcc5b(_0x5d8f64[_0xba32('0x12')][_0xba32('0x10')]);}})[_0xba32('0x13')](function(_0x310dee){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x1b1332,_0x310dee);_0x13395b(_0x310dee);});});}exports['CreateSquareDetailsReport']=function(_0x5c3fe6){var _0x234db9=this;return new Promise(function(_0x1ae3ea,_0x42803d){return db[_0xba32('0x14')][_0xba32('0x15')](_0x5c3fe6[_0xba32('0x16')],{'raw':_0x5c3fe6['options']?_0x5c3fe6['options']['raw']===undefined?!![]:![]:!![]})[_0xba32('0xb')](function(_0x51c43a){logger[_0xba32('0x11')](_0xba32('0x17'),_0x5c3fe6);logger[_0xba32('0xc')](_0xba32('0x17'),_0x5c3fe6,JSON[_0xba32('0x18')](_0x51c43a));_0x1ae3ea(_0x51c43a);})[_0xba32('0x13')](function(_0xdfa807){logger['error'](_0xba32('0x17'),_0xdfa807[_0xba32('0x10')],_0x5c3fe6);_0x42803d(_0x234db9[_0xba32('0xe')](0x1f4,_0xdfa807[_0xba32('0x10')]));});});}; \ 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(_0x50cd41,_0x4874a7){var _0x399475=function(_0x1946da){while(--_0x1946da){_0x50cd41['push'](_0x50cd41['shift']());}};_0x399475(++_0x4874a7);}(_0x351d,0x90));var _0xd351=function(_0x541bec,_0x3766a9){_0x541bec=_0x541bec-0x0;var _0x17fa8b=_0x351d[_0x541bec];return _0x17fa8b;};'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 2744eb0..554144b 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 _0x65f9=['index','/process/:pid/kill','killProcess','Router','../../components/auth/service','./system.controller','get','isAuthenticated'];(function(_0xe4744,_0x40ad76){var _0x535a99=function(_0x9d1cde){while(--_0x9d1cde){_0xe4744['push'](_0xe4744['shift']());}};_0x535a99(++_0x40ad76);}(_0x65f9,0x1c3));var _0x965f=function(_0x5641df,_0x482c13){_0x5641df=_0x5641df-0x0;var _0x30f96e=_0x65f9[_0x5641df];return _0x30f96e;};'use strict';var express=require('express');var router=express[_0x965f('0x0')]();var auth=require(_0x965f('0x1'));var controller=require(_0x965f('0x2'));router[_0x965f('0x3')]('/',auth[_0x965f('0x4')](),controller[_0x965f('0x5')]);router[_0x965f('0x3')](_0x965f('0x6'),auth['isAuthenticated'](),controller[_0x965f('0x7')]);module['exports']=router; \ No newline at end of file +var _0x425c=['../../components/auth/service','./system.controller','get','isAuthenticated','index','killProcess','exports','express','Router'];(function(_0x475af0,_0x3a74c0){var _0x11cfdb=function(_0x48de12){while(--_0x48de12){_0x475af0['push'](_0x475af0['shift']());}};_0x11cfdb(++_0x3a74c0);}(_0x425c,0x1ed));var _0xc425=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x425c[_0x138adb];return _0x1b27f2;};'use strict';var express=require(_0xc425('0x0'));var router=express[_0xc425('0x1')]();var auth=require(_0xc425('0x2'));var controller=require(_0xc425('0x3'));router[_0xc425('0x4')]('/',auth[_0xc425('0x5')](),controller[_0xc425('0x6')]);router[_0xc425('0x4')]('/process/:pid/kill',auth['isAuthenticated'](),controller[_0xc425('0x7')]);module[_0xc425('0x8')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index f4cd91d..d55f29a 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 _0xac4f=['json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','split','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','status','send','index','getAllData','then','catch'];(function(_0x42ac93,_0x5952b2){var _0x465580=function(_0xbd8069){while(--_0xbd8069){_0x42ac93['push'](_0x42ac93['shift']());}};_0x465580(++_0x5952b2);}(_0xac4f,0x136));var _0xfac4=function(_0x277c19,_0x22f714){_0x277c19=_0x277c19-0x0;var _0x3281e5=_0xac4f[_0x277c19];return _0x3281e5;};'use strict';var info=require(_0xfac4('0x0'));var exec=require(_0xfac4('0x1'))[_0xfac4('0x2')];var logger=require('../../config/logger')(_0xfac4('0x3'));var util=require(_0xfac4('0x4'));var BPromise=require(_0xfac4('0x5'));var _=require(_0xfac4('0x6'));function handleError(_0xd3c8f7,_0x31c282,_0x3b513d){_0x31c282=_0x31c282||0x1f4;return function(_0xf19879){logger[_0xfac4('0x7')](_0xfac4('0x8'),_0x3b513d,_0x31c282,util['inspect'](_0xf19879,{'showHidden':![],'depth':null}));delete _0xf19879['name'];_0xd3c8f7[_0xfac4('0x9')](_0x31c282)[_0xfac4('0xa')](_0xf19879);};}exports[_0xfac4('0xb')]=function(_0x162648,_0x2c68d8){return info[_0xfac4('0xc')]()[_0xfac4('0xd')](function(_0x1bee9f){return _0x2c68d8[_0xfac4('0x9')](0xc8)['json'](_0x1bee9f);})[_0xfac4('0xe')](function(_0x259f21){return _0x2c68d8['status'](0x1f4)[_0xfac4('0xf')](_0x259f21);});};exports[_0xfac4('0x10')]=function(_0x5ae72c,_0x1e8cd6){var _0x56007d=[_0xfac4('0x11')];return new BPromise(function(_0x599013,_0x2ee167){return exec(util[_0xfac4('0x12')](_0xfac4('0x13'),_0x5ae72c['params']['pid']),function(_0x76c553,_0x3b77cb,_0x1d72ae){if(_0x76c553){return _0x2ee167(_0x76c553);}return _0x599013(_0x3b77cb);});})[_0xfac4('0xd')](function(_0x5968d7){var _0x54371b=![];var _0x440a39=_0x5968d7[_0xfac4('0x14')](/\n/);for(var _0x3e83b6=0x0,_0x3f43a6=_0x56007d['length'];_0x3e83b6<_0x3f43a6,_0x54371b===![];_0x3e83b6+=0x1){if(_0x5968d7['indexOf'](_0x56007d[_0x3e83b6])>=0x0){_0x54371b=!![];}}if(!_0x54371b){throw new Error(util[_0xfac4('0x12')](_0xfac4('0x15'),_0x5ae72c['params'][_0xfac4('0x16')]));}process[_0xfac4('0x17')](_0x5ae72c['params'][_0xfac4('0x16')],'SIGINT');return _0x1e8cd6[_0xfac4('0x9')](0xc8)[_0xfac4('0xf')]({'message':util[_0xfac4('0x12')](_0xfac4('0x18'),_0x5ae72c['params'][_0xfac4('0x16')])});})[_0xfac4('0xe')](handleError(_0x1e8cd6,null,_0xfac4('0x10')));}; \ No newline at end of file +var _0x6f80=['components/import/cm','format','pid','split','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','../../config/logger','api','util','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','send','index','getAllData','json','catch','status'];(function(_0x4e8022,_0x53229d){var _0xf5e73f=function(_0x3a1309){while(--_0x3a1309){_0x4e8022['push'](_0x4e8022['shift']());}};_0xf5e73f(++_0x53229d);}(_0x6f80,0x172));var _0x06f8=function(_0x258e97,_0x1223e8){_0x258e97=_0x258e97-0x0;var _0x3482e6=_0x6f80[_0x258e97];return _0x3482e6;};'use strict';var info=require(_0x06f8('0x0'));var exec=require('child_process')['exec'];var logger=require(_0x06f8('0x1'))(_0x06f8('0x2'));var util=require(_0x06f8('0x3'));var BPromise=require('bluebird');var _=require(_0x06f8('0x4'));function handleError(_0x543dbf,_0x247e3e,_0x27f7a6){_0x247e3e=_0x247e3e||0x1f4;return function(_0x4b0e56){logger['error'](_0x06f8('0x5'),_0x27f7a6,_0x247e3e,util[_0x06f8('0x6')](_0x4b0e56,{'showHidden':![],'depth':null}));delete _0x4b0e56[_0x06f8('0x7')];_0x543dbf['status'](_0x247e3e)[_0x06f8('0x8')](_0x4b0e56);};}exports[_0x06f8('0x9')]=function(_0x204558,_0x55e02b){return info[_0x06f8('0xa')]()['then'](function(_0x5689db){return _0x55e02b['status'](0xc8)[_0x06f8('0xb')](_0x5689db);})[_0x06f8('0xc')](function(_0x1ff6de){return _0x55e02b[_0x06f8('0xd')](0x1f4)[_0x06f8('0xb')](_0x1ff6de);});};exports['killProcess']=function(_0x6e1abb,_0x28f2c9){var _0xbfda27=[_0x06f8('0xe')];return new BPromise(function(_0x3568e1,_0x2a02df){return exec(util[_0x06f8('0xf')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x6e1abb['params'][_0x06f8('0x10')]),function(_0x5076bc,_0x204cb6,_0x372481){if(_0x5076bc){return _0x2a02df(_0x5076bc);}return _0x3568e1(_0x204cb6);});})['then'](function(_0x227721){var _0x16b5cc=![];var _0x4f9a5a=_0x227721[_0x06f8('0x11')](/\n/);for(var _0x48ceec=0x0,_0x1f8115=_0xbfda27['length'];_0x48ceec<_0x1f8115,_0x16b5cc===![];_0x48ceec+=0x1){if(_0x227721[_0x06f8('0x12')](_0xbfda27[_0x48ceec])>=0x0){_0x16b5cc=!![];}}if(!_0x16b5cc){throw new Error(util[_0x06f8('0xf')](_0x06f8('0x13'),_0x6e1abb[_0x06f8('0x14')][_0x06f8('0x10')]));}process[_0x06f8('0x15')](_0x6e1abb[_0x06f8('0x14')][_0x06f8('0x10')],_0x06f8('0x16'));return _0x28f2c9['status'](0xc8)[_0x06f8('0xb')]({'message':util['format'](_0x06f8('0x17'),_0x6e1abb[_0x06f8('0x14')][_0x06f8('0x10')])});})[_0x06f8('0xc')](handleError(_0x28f2c9,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index c6f18de..3c34b29 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 _0x3aed=['../../components/interaction/service','./tag.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4d8789,_0x3fdff1){var _0x404e41=function(_0x33d5a6){while(--_0x33d5a6){_0x4d8789['push'](_0x4d8789['shift']());}};_0x404e41(++_0x3fdff1);}(_0x3aed,0x1c6));var _0xd3ae=function(_0x3bab09,_0x217c29){_0x3bab09=_0x3bab09-0x0;var _0x164376=_0x3aed[_0x3bab09];return _0x164376;};'use strict';var multer=require(_0xd3ae('0x0'));var util=require(_0xd3ae('0x1'));var path=require(_0xd3ae('0x2'));var timeout=require(_0xd3ae('0x3'));var express=require(_0xd3ae('0x4'));var router=express[_0xd3ae('0x5')]();var fs_extra=require(_0xd3ae('0x6'));var auth=require(_0xd3ae('0x7'));var interaction=require(_0xd3ae('0x8'));var config=require('../../config/environment');var controller=require(_0xd3ae('0x9'));router[_0xd3ae('0xa')]('/',auth[_0xd3ae('0xb')](),controller[_0xd3ae('0xc')]);router[_0xd3ae('0xa')](_0xd3ae('0xd'),auth[_0xd3ae('0xb')](),controller[_0xd3ae('0xe')]);router[_0xd3ae('0xf')]('/',auth['isAuthenticated'](),controller[_0xd3ae('0x10')]);router[_0xd3ae('0x11')](_0xd3ae('0xd'),auth[_0xd3ae('0xb')](),controller[_0xd3ae('0x12')]);router[_0xd3ae('0x13')](_0xd3ae('0xd'),auth[_0xd3ae('0xb')](),controller[_0xd3ae('0x14')]);module[_0xd3ae('0x15')]=router; \ No newline at end of file +var _0xdaaf=['fs-extra','../../components/auth/service','isAuthenticated','index','/:id','show','post','create','update','delete','util','path','connect-timeout','Router'];(function(_0x53623b,_0x109a46){var _0x214950=function(_0x192383){while(--_0x192383){_0x53623b['push'](_0x53623b['shift']());}};_0x214950(++_0x109a46);}(_0xdaaf,0x130));var _0xfdaa=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xdaaf[_0x4a9fb1];return _0x348672;};'use strict';var multer=require('multer');var util=require(_0xfdaa('0x0'));var path=require(_0xfdaa('0x1'));var timeout=require(_0xfdaa('0x2'));var express=require('express');var router=express[_0xfdaa('0x3')]();var fs_extra=require(_0xfdaa('0x4'));var auth=require(_0xfdaa('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./tag.controller');router['get']('/',auth[_0xfdaa('0x6')](),controller[_0xfdaa('0x7')]);router['get'](_0xfdaa('0x8'),auth[_0xfdaa('0x6')](),controller[_0xfdaa('0x9')]);router[_0xfdaa('0xa')]('/',auth[_0xfdaa('0x6')](),controller[_0xfdaa('0xb')]);router['put']('/:id',auth[_0xfdaa('0x6')](),controller[_0xfdaa('0xc')]);router[_0xfdaa('0xd')](_0xfdaa('0x8'),auth[_0xfdaa('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 31c19a5..2276e72 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 _0x570f=['STRING','#0091EA','sequelize','exports'];(function(_0x271281,_0x59ba24){var _0x2b28e7=function(_0x35da6d){while(--_0x35da6d){_0x271281['push'](_0x271281['shift']());}};_0x2b28e7(++_0x59ba24);}(_0x570f,0x152));var _0xf570=function(_0x23da4d,_0x63498c){_0x23da4d=_0x23da4d-0x0;var _0x4ae55=_0x570f[_0x23da4d];return _0x4ae55;};'use strict';var Sequelize=require(_0xf570('0x0'));module[_0xf570('0x1')]={'name':{'type':Sequelize[_0xf570('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0xf570('0x3')},'description':{'type':Sequelize[_0xf570('0x2')]}}; \ No newline at end of file +var _0xfef3=['#0091EA','sequelize','STRING'];(function(_0x28b92a,_0x2ec0e6){var _0x669cf=function(_0x358751){while(--_0x358751){_0x28b92a['push'](_0x28b92a['shift']());}};_0x669cf(++_0x2ec0e6);}(_0xfef3,0x118));var _0x3fef=function(_0x6ba53a,_0x29277a){_0x6ba53a=_0x6ba53a-0x0;var _0x2842ca=_0xfef3[_0x6ba53a];return _0x2842ca;};'use strict';var Sequelize=require(_0x3fef('0x0'));module['exports']={'name':{'type':Sequelize[_0x3fef('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x3fef('0x1')],'defaultValue':_0x3fef('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 278903e..d8f09c3 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 _0x54ef=['pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','get','Tags','UserProfileResource','error','stack','name','map','Tag','rawAttributes','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters'];(function(_0x5deda9,_0xb06c05){var _0x453001=function(_0x35d17e){while(--_0x35d17e){_0x5deda9['push'](_0x5deda9['shift']());}};_0x453001(++_0xb06c05);}(_0x54ef,0x112));var _0xf54e=function(_0x37cd1f,_0x481e23){_0x37cd1f=_0x37cd1f-0x0;var _0x25dd2b=_0x54ef[_0x37cd1f];return _0x25dd2b;};'use strict';var emlformat=require(_0xf54e('0x0'));var rimraf=require(_0xf54e('0x1'));var zipdir=require(_0xf54e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf54e('0x3'));var moment=require(_0xf54e('0x4'));var BPromise=require(_0xf54e('0x5'));var Mustache=require(_0xf54e('0x6'));var util=require(_0xf54e('0x7'));var path=require(_0xf54e('0x8'));var sox=require(_0xf54e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf54e('0xa'));var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var as=require(_0xf54e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf54e('0x14'))(_0xf54e('0x15'));var utils=require(_0xf54e('0x16'));var config=require(_0xf54e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf54e('0x18'))['db'];function respondWithStatusCode(_0x4b0ee1,_0x4bd828){_0x4bd828=_0x4bd828||0xcc;return function(_0x15a9d4){if(_0x15a9d4){return _0x4b0ee1[_0xf54e('0x19')](_0x4bd828);}return _0x4b0ee1[_0xf54e('0x1a')](_0x4bd828)[_0xf54e('0x1b')]();};}function respondWithResult(_0x5644aa,_0x331732){_0x331732=_0x331732||0xc8;return function(_0x1bbeaa){if(_0x1bbeaa){return _0x5644aa[_0xf54e('0x1a')](_0x331732)[_0xf54e('0x1c')](_0x1bbeaa);}};}function respondWithFilteredResult(_0x56828e,_0x2366ee){return function(_0x389abc){if(_0x389abc){var _0x3eb415=typeof _0x2366ee['offset']==='undefined'&&typeof _0x2366ee[_0xf54e('0x1d')]===_0xf54e('0x1e');var _0x1c02e7=_0x389abc[_0xf54e('0x1f')];var _0x15cc48=_0x3eb415?0x0:_0x2366ee[_0xf54e('0x20')];var _0x2e27b6=_0x3eb415?_0x389abc[_0xf54e('0x1f')]:_0x2366ee[_0xf54e('0x20')]+_0x2366ee[_0xf54e('0x1d')];var _0x226c96;if(_0x2e27b6>=_0x1c02e7){_0x2e27b6=_0x1c02e7;_0x226c96=0xc8;}else{_0x226c96=0xce;}_0x56828e['status'](_0x226c96);return _0x56828e['set'](_0xf54e('0x21'),_0x15cc48+'-'+_0x2e27b6+'/'+_0x1c02e7)['json'](_0x389abc);}return null;};}function patchUpdates(_0x3e1556){return function(_0x1bfe99){try{jsonpatch[_0xf54e('0x22')](_0x1bfe99,_0x3e1556,!![]);}catch(_0x9903fc){return BPromise[_0xf54e('0x23')](_0x9903fc);}return _0x1bfe99[_0xf54e('0x24')]();};}function saveUpdates(_0x388aa0,_0x11985e){return function(_0x3c0169){if(_0x3c0169){return _0x3c0169[_0xf54e('0x25')](_0x388aa0)[_0xf54e('0x26')](function(_0x5b83df){return _0x5b83df;});}return null;};}function removeEntity(_0x6f6d29,_0x54f914){return function(_0x264a8f){if(_0x264a8f){return _0x264a8f[_0xf54e('0x27')]()[_0xf54e('0x26')](function(){var _0x474b61=_0x264a8f[_0xf54e('0x28')]({'plain':!![]});var _0x160160=_0xf54e('0x29');return db[_0xf54e('0x2a')][_0xf54e('0x27')]({'where':{'type':_0x160160,'resourceId':_0x474b61['id']}})[_0xf54e('0x26')](function(){return _0x264a8f;});})[_0xf54e('0x26')](function(){_0x6f6d29[_0xf54e('0x1a')](0xcc)[_0xf54e('0x1b')]();});}};}function handleEntityNotFound(_0x5390b8,_0xb3706e){return function(_0x4cbf7c){if(!_0x4cbf7c){_0x5390b8[_0xf54e('0x19')](0x194);}return _0x4cbf7c;};}function handleError(_0x5e63f4,_0x15b888){_0x15b888=_0x15b888||0x1f4;return function(_0x269f47){logger[_0xf54e('0x2b')](_0x269f47[_0xf54e('0x2c')]);if(_0x269f47[_0xf54e('0x2d')]){delete _0x269f47[_0xf54e('0x2d')];}_0x5e63f4[_0xf54e('0x1a')](_0x15b888)['send'](_0x269f47);};}exports['index']=function(_0x2f96b1,_0x258d29){var _0x2ec92e={},_0x16d00f={},_0xb2d4c4={'count':0x0,'rows':[]};var _0x133cd7=_[_0xf54e('0x2e')](db[_0xf54e('0x2f')][_0xf54e('0x30')],function(_0x12edc3){return{'name':_0x12edc3['fieldName'],'type':_0x12edc3['type'][_0xf54e('0x31')]};});_0x16d00f[_0xf54e('0x32')]=_['map'](_0x133cd7,_0xf54e('0x2d'));_0x16d00f[_0xf54e('0x33')]=_[_0xf54e('0x34')](_0x2f96b1[_0xf54e('0x33')]);_0x16d00f['filters']=_['intersection'](_0x16d00f['model'],_0x16d00f[_0xf54e('0x33')]);_0x2ec92e[_0xf54e('0x35')]=_[_0xf54e('0x36')](_0x16d00f[_0xf54e('0x32')],qs[_0xf54e('0x37')](_0x2f96b1[_0xf54e('0x33')]['fields']));_0x2ec92e['attributes']=_0x2ec92e['attributes'][_0xf54e('0x38')]?_0x2ec92e[_0xf54e('0x35')]:_0x16d00f['model'];if(!_0x2f96b1['query'][_0xf54e('0x39')](_0xf54e('0x3a'))){_0x2ec92e[_0xf54e('0x1d')]=qs['limit'](_0x2f96b1[_0xf54e('0x33')][_0xf54e('0x1d')]);_0x2ec92e['offset']=qs[_0xf54e('0x20')](_0x2f96b1[_0xf54e('0x33')][_0xf54e('0x20')]);}_0x2ec92e[_0xf54e('0x3b')]=qs[_0xf54e('0x3c')](_0x2f96b1[_0xf54e('0x33')]['sort']);_0x2ec92e['where']=qs[_0xf54e('0x3d')](_[_0xf54e('0x3e')](_0x2f96b1[_0xf54e('0x33')],_0x16d00f['filters']),_0x133cd7);if(_0x2f96b1[_0xf54e('0x33')][_0xf54e('0x3f')]){_0x2ec92e[_0xf54e('0x40')]=_[_0xf54e('0x41')](_0x2ec92e[_0xf54e('0x40')],{'$or':_[_0xf54e('0x2e')](_0x133cd7,function(_0x17c7ec){if(_0x17c7ec[_0xf54e('0x42')]!==_0xf54e('0x43')){var _0x2087b3={};_0x2087b3[_0x17c7ec[_0xf54e('0x2d')]]={'$like':'%'+_0x2f96b1[_0xf54e('0x33')][_0xf54e('0x3f')]+'%'};return _0x2087b3;}})});}_0x2ec92e=_[_0xf54e('0x41')]({},_0x2ec92e,_0x2f96b1[_0xf54e('0x44')]);var _0x5085c1={'where':_0x2ec92e['where']};return db['Tag'][_0xf54e('0x1f')](_0x5085c1)[_0xf54e('0x26')](function(_0x5398b2){_0xb2d4c4[_0xf54e('0x1f')]=_0x5398b2;if(_0x2f96b1[_0xf54e('0x33')][_0xf54e('0x45')]){_0x2ec92e['include']=[{'all':!![]}];}return db[_0xf54e('0x2f')][_0xf54e('0x46')](_0x2ec92e);})[_0xf54e('0x26')](function(_0x794be7){_0xb2d4c4[_0xf54e('0x47')]=_0x794be7;return _0xb2d4c4;})[_0xf54e('0x26')](respondWithFilteredResult(_0x258d29,_0x2ec92e))[_0xf54e('0x48')](handleError(_0x258d29,null));};exports[_0xf54e('0x49')]=function(_0x5b4ea1,_0x47bedd){var _0x11c736={'raw':!![],'where':{'id':_0x5b4ea1[_0xf54e('0x4a')]['id']}},_0x3447fd={};_0x3447fd[_0xf54e('0x32')]=_[_0xf54e('0x34')](db[_0xf54e('0x2f')]['rawAttributes']);_0x3447fd[_0xf54e('0x33')]=_['keys'](_0x5b4ea1[_0xf54e('0x33')]);_0x3447fd['filters']=_[_0xf54e('0x36')](_0x3447fd[_0xf54e('0x32')],_0x3447fd[_0xf54e('0x33')]);_0x11c736['attributes']=_[_0xf54e('0x36')](_0x3447fd[_0xf54e('0x32')],qs[_0xf54e('0x37')](_0x5b4ea1[_0xf54e('0x33')][_0xf54e('0x37')]));_0x11c736['attributes']=_0x11c736[_0xf54e('0x35')][_0xf54e('0x38')]?_0x11c736[_0xf54e('0x35')]:_0x3447fd[_0xf54e('0x32')];if(_0x5b4ea1['query'][_0xf54e('0x45')]){_0x11c736[_0xf54e('0x4b')]=[{'all':!![]}];}_0x11c736=_['merge']({},_0x11c736,_0x5b4ea1[_0xf54e('0x44')]);return db[_0xf54e('0x2f')][_0xf54e('0x4c')](_0x11c736)[_0xf54e('0x26')](handleEntityNotFound(_0x47bedd,null))['then'](respondWithResult(_0x47bedd,null))[_0xf54e('0x48')](handleError(_0x47bedd,null));};exports[_0xf54e('0x4d')]=function(_0x2527f6,_0xb4654f){return db[_0xf54e('0x2f')][_0xf54e('0x4d')](_0x2527f6[_0xf54e('0x4e')],{})[_0xf54e('0x26')](function(_0x15bfef){var _0x21f2f8=_0x2527f6[_0xf54e('0x4f')][_0xf54e('0x28')]({'plain':!![]});if(!_0x21f2f8)throw new Error(_0xf54e('0x50'));if(_0x21f2f8[_0xf54e('0x51')]===_0xf54e('0x4f')){var _0xa6c305=_0x15bfef[_0xf54e('0x28')]({'plain':!![]});var _0xe9338b=_0xf54e('0x29');return db[_0xf54e('0x52')]['find']({'where':{'name':_0xe9338b,'userProfileId':_0x21f2f8['userProfileId']},'raw':!![]})[_0xf54e('0x26')](function(_0x1106bb){if(_0x1106bb&&_0x1106bb[_0xf54e('0x53')]===0x0){return db[_0xf54e('0x2a')][_0xf54e('0x4d')]({'name':_0xa6c305[_0xf54e('0x2d')],'resourceId':_0xa6c305['id'],'type':_0x1106bb[_0xf54e('0x2d')],'sectionId':_0x1106bb['id']},{})[_0xf54e('0x26')](function(){return _0x15bfef;});}else{return _0x15bfef;}})[_0xf54e('0x48')](function(_0xdf63c4){logger[_0xf54e('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xdf63c4);throw _0xdf63c4;});}return _0x15bfef;})[_0xf54e('0x26')](respondWithResult(_0xb4654f,0xc9))[_0xf54e('0x48')](handleError(_0xb4654f,null));};exports[_0xf54e('0x25')]=function(_0x37e4f8,_0x1b8f16){if(_0x37e4f8[_0xf54e('0x4e')]['id']){delete _0x37e4f8[_0xf54e('0x4e')]['id'];}return db['Tag'][_0xf54e('0x4c')]({'where':{'id':_0x37e4f8[_0xf54e('0x4a')]['id']}})[_0xf54e('0x26')](handleEntityNotFound(_0x1b8f16,null))['then'](saveUpdates(_0x37e4f8[_0xf54e('0x4e')],null))['then'](respondWithResult(_0x1b8f16,null))[_0xf54e('0x48')](handleError(_0x1b8f16,null));};exports[_0xf54e('0x27')]=function(_0x3e2fd1,_0x5b882f){return db[_0xf54e('0x2f')][_0xf54e('0x4c')]({'where':{'id':_0x3e2fd1[_0xf54e('0x4a')]['id']}})[_0xf54e('0x26')](handleEntityNotFound(_0x5b882f,null))[_0xf54e('0x26')](removeEntity(_0x5b882f,null))[_0xf54e('0x48')](handleError(_0x5b882f,null));}; \ No newline at end of file +var _0x3a25=['find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x5ee666,_0x58829a){var _0x4f6ca6=function(_0x282c79){while(--_0x282c79){_0x5ee666['push'](_0x5ee666['shift']());}};_0x4f6ca6(++_0x58829a);}(_0x3a25,0x15d));var _0x53a2=function(_0x56dbeb,_0x4fed17){_0x56dbeb=_0x56dbeb-0x0;var _0x353b9b=_0x3a25[_0x56dbeb];return _0x353b9b;};'use strict';var emlformat=require(_0x53a2('0x0'));var rimraf=require(_0x53a2('0x1'));var zipdir=require(_0x53a2('0x2'));var jsonpatch=require(_0x53a2('0x3'));var rp=require(_0x53a2('0x4'));var moment=require(_0x53a2('0x5'));var BPromise=require(_0x53a2('0x6'));var Mustache=require(_0x53a2('0x7'));var util=require(_0x53a2('0x8'));var path=require(_0x53a2('0x9'));var sox=require(_0x53a2('0xa'));var csv=require(_0x53a2('0xb'));var ejs=require(_0x53a2('0xc'));var fs=require('fs');var fs_extra=require(_0x53a2('0xd'));var _=require(_0x53a2('0xe'));var squel=require('squel');var crypto=require(_0x53a2('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x53a2('0x10'));var toCsv=require(_0x53a2('0xb'));var querystring=require(_0x53a2('0x11'));var Papa=require(_0x53a2('0x12'));var Redis=require(_0x53a2('0x13'));var authService=require(_0x53a2('0x14'));var qs=require(_0x53a2('0x15'));var as=require(_0x53a2('0x16'));var hardwareService=require(_0x53a2('0x17'));var logger=require(_0x53a2('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x53a2('0x19'));var licenseUtil=require(_0x53a2('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x564ca9,_0x47881a){_0x47881a=_0x47881a||0xcc;return function(_0x410370){if(_0x410370){return _0x564ca9[_0x53a2('0x1b')](_0x47881a);}return _0x564ca9[_0x53a2('0x1c')](_0x47881a)['end']();};}function respondWithResult(_0x58070c,_0x4e2228){_0x4e2228=_0x4e2228||0xc8;return function(_0x9c14b7){if(_0x9c14b7){return _0x58070c[_0x53a2('0x1c')](_0x4e2228)[_0x53a2('0x1d')](_0x9c14b7);}};}function respondWithFilteredResult(_0xf9b589,_0x4d3a40){return function(_0x1779ef){if(_0x1779ef){var _0x3343d3=typeof _0x4d3a40[_0x53a2('0x1e')]===_0x53a2('0x1f')&&typeof _0x4d3a40[_0x53a2('0x20')]==='undefined';var _0x485c4d=_0x1779ef[_0x53a2('0x21')];var _0x446b71=_0x3343d3?0x0:_0x4d3a40[_0x53a2('0x1e')];var _0x104fb6=_0x3343d3?_0x1779ef[_0x53a2('0x21')]:_0x4d3a40[_0x53a2('0x1e')]+_0x4d3a40['limit'];var _0x589666;if(_0x104fb6>=_0x485c4d){_0x104fb6=_0x485c4d;_0x589666=0xc8;}else{_0x589666=0xce;}_0xf9b589[_0x53a2('0x1c')](_0x589666);return _0xf9b589[_0x53a2('0x22')]('Content-Range',_0x446b71+'-'+_0x104fb6+'/'+_0x485c4d)[_0x53a2('0x1d')](_0x1779ef);}return null;};}function patchUpdates(_0x3fb15b){return function(_0x3efc90){try{jsonpatch[_0x53a2('0x23')](_0x3efc90,_0x3fb15b,!![]);}catch(_0x503e9b){return BPromise[_0x53a2('0x24')](_0x503e9b);}return _0x3efc90[_0x53a2('0x25')]();};}function saveUpdates(_0xd9693c,_0x2cda68){return function(_0x42df19){if(_0x42df19){return _0x42df19[_0x53a2('0x26')](_0xd9693c)[_0x53a2('0x27')](function(_0x3a769d){return _0x3a769d;});}return null;};}function removeEntity(_0x4a1a34,_0x579b10){return function(_0x473042){if(_0x473042){return _0x473042[_0x53a2('0x28')]()[_0x53a2('0x27')](function(){var _0x2852a1=_0x473042[_0x53a2('0x29')]({'plain':!![]});var _0xa39167='Tags';return db[_0x53a2('0x2a')][_0x53a2('0x28')]({'where':{'type':_0xa39167,'resourceId':_0x2852a1['id']}})[_0x53a2('0x27')](function(){return _0x473042;});})[_0x53a2('0x27')](function(){_0x4a1a34[_0x53a2('0x1c')](0xcc)[_0x53a2('0x2b')]();});}};}function handleEntityNotFound(_0x21325d,_0x41ae20){return function(_0x2f2062){if(!_0x2f2062){_0x21325d[_0x53a2('0x1b')](0x194);}return _0x2f2062;};}function handleError(_0x18d6df,_0x31426e){_0x31426e=_0x31426e||0x1f4;return function(_0x262eba){logger[_0x53a2('0x2c')](_0x262eba[_0x53a2('0x2d')]);if(_0x262eba[_0x53a2('0x2e')]){delete _0x262eba[_0x53a2('0x2e')];}_0x18d6df['status'](_0x31426e)[_0x53a2('0x2f')](_0x262eba);};}exports[_0x53a2('0x30')]=function(_0x286e70,_0x23374b){var _0x18f091={},_0x2e0dfc={},_0x137541={'count':0x0,'rows':[]};var _0x1bf7b4=_[_0x53a2('0x31')](db[_0x53a2('0x32')][_0x53a2('0x33')],function(_0x4cb93b){return{'name':_0x4cb93b[_0x53a2('0x34')],'type':_0x4cb93b[_0x53a2('0x35')][_0x53a2('0x36')]};});_0x2e0dfc[_0x53a2('0x37')]=_[_0x53a2('0x31')](_0x1bf7b4,_0x53a2('0x2e'));_0x2e0dfc[_0x53a2('0x38')]=_[_0x53a2('0x39')](_0x286e70['query']);_0x2e0dfc[_0x53a2('0x3a')]=_[_0x53a2('0x3b')](_0x2e0dfc[_0x53a2('0x37')],_0x2e0dfc[_0x53a2('0x38')]);_0x18f091['attributes']=_[_0x53a2('0x3b')](_0x2e0dfc[_0x53a2('0x37')],qs[_0x53a2('0x3c')](_0x286e70[_0x53a2('0x38')][_0x53a2('0x3c')]));_0x18f091[_0x53a2('0x3d')]=_0x18f091['attributes'][_0x53a2('0x3e')]?_0x18f091[_0x53a2('0x3d')]:_0x2e0dfc[_0x53a2('0x37')];if(!_0x286e70['query'][_0x53a2('0x3f')]('nolimit')){_0x18f091[_0x53a2('0x20')]=qs[_0x53a2('0x20')](_0x286e70[_0x53a2('0x38')]['limit']);_0x18f091['offset']=qs[_0x53a2('0x1e')](_0x286e70['query'][_0x53a2('0x1e')]);}_0x18f091[_0x53a2('0x40')]=qs[_0x53a2('0x41')](_0x286e70[_0x53a2('0x38')][_0x53a2('0x41')]);_0x18f091[_0x53a2('0x42')]=qs['filters'](_[_0x53a2('0x43')](_0x286e70[_0x53a2('0x38')],_0x2e0dfc['filters']),_0x1bf7b4);if(_0x286e70['query'][_0x53a2('0x44')]){_0x18f091['where']=_[_0x53a2('0x45')](_0x18f091[_0x53a2('0x42')],{'$or':_['map'](_0x1bf7b4,function(_0x22fede){if(_0x22fede[_0x53a2('0x35')]!==_0x53a2('0x46')){var _0x1aa50d={};_0x1aa50d[_0x22fede[_0x53a2('0x2e')]]={'$like':'%'+_0x286e70['query'][_0x53a2('0x44')]+'%'};return _0x1aa50d;}})});}_0x18f091=_[_0x53a2('0x45')]({},_0x18f091,_0x286e70['options']);var _0x411b7b={'where':_0x18f091[_0x53a2('0x42')]};return db['Tag'][_0x53a2('0x21')](_0x411b7b)['then'](function(_0xd5bcc8){_0x137541[_0x53a2('0x21')]=_0xd5bcc8;if(_0x286e70[_0x53a2('0x38')][_0x53a2('0x47')]){_0x18f091[_0x53a2('0x48')]=[{'all':!![]}];}return db[_0x53a2('0x32')]['findAll'](_0x18f091);})[_0x53a2('0x27')](function(_0x33238d){_0x137541[_0x53a2('0x49')]=_0x33238d;return _0x137541;})[_0x53a2('0x27')](respondWithFilteredResult(_0x23374b,_0x18f091))[_0x53a2('0x4a')](handleError(_0x23374b,null));};exports[_0x53a2('0x4b')]=function(_0x3790c1,_0x426a88){var _0x382636={'raw':!![],'where':{'id':_0x3790c1[_0x53a2('0x4c')]['id']}},_0x1b5fbe={};_0x1b5fbe[_0x53a2('0x37')]=_[_0x53a2('0x39')](db[_0x53a2('0x32')][_0x53a2('0x33')]);_0x1b5fbe[_0x53a2('0x38')]=_['keys'](_0x3790c1[_0x53a2('0x38')]);_0x1b5fbe[_0x53a2('0x3a')]=_['intersection'](_0x1b5fbe['model'],_0x1b5fbe[_0x53a2('0x38')]);_0x382636['attributes']=_['intersection'](_0x1b5fbe[_0x53a2('0x37')],qs[_0x53a2('0x3c')](_0x3790c1[_0x53a2('0x38')][_0x53a2('0x3c')]));_0x382636['attributes']=_0x382636['attributes']['length']?_0x382636[_0x53a2('0x3d')]:_0x1b5fbe['model'];if(_0x3790c1['query'][_0x53a2('0x47')]){_0x382636[_0x53a2('0x48')]=[{'all':!![]}];}_0x382636=_[_0x53a2('0x45')]({},_0x382636,_0x3790c1[_0x53a2('0x4d')]);return db[_0x53a2('0x32')]['find'](_0x382636)[_0x53a2('0x27')](handleEntityNotFound(_0x426a88,null))['then'](respondWithResult(_0x426a88,null))[_0x53a2('0x4a')](handleError(_0x426a88,null));};exports[_0x53a2('0x4e')]=function(_0x5baa46,_0x35fb2b){return db[_0x53a2('0x32')][_0x53a2('0x4e')](_0x5baa46[_0x53a2('0x4f')],{})[_0x53a2('0x27')](function(_0x6fd478){var _0x622575=_0x5baa46['user'][_0x53a2('0x29')]({'plain':!![]});if(!_0x622575)throw new Error(_0x53a2('0x50'));if(_0x622575[_0x53a2('0x51')]==='user'){var _0x36df41=_0x6fd478[_0x53a2('0x29')]({'plain':!![]});var _0x42238f=_0x53a2('0x52');return db[_0x53a2('0x53')]['find']({'where':{'name':_0x42238f,'userProfileId':_0x622575['userProfileId']},'raw':!![]})[_0x53a2('0x27')](function(_0x4f65a1){if(_0x4f65a1&&_0x4f65a1[_0x53a2('0x54')]===0x0){return db[_0x53a2('0x2a')]['create']({'name':_0x36df41['name'],'resourceId':_0x36df41['id'],'type':_0x4f65a1[_0x53a2('0x2e')],'sectionId':_0x4f65a1['id']},{})[_0x53a2('0x27')](function(){return _0x6fd478;});}else{return _0x6fd478;}})[_0x53a2('0x4a')](function(_0x5eae3e){logger['error'](_0x53a2('0x55'),_0x5eae3e);throw _0x5eae3e;});}return _0x6fd478;})[_0x53a2('0x27')](respondWithResult(_0x35fb2b,0xc9))[_0x53a2('0x4a')](handleError(_0x35fb2b,null));};exports[_0x53a2('0x26')]=function(_0xf722ed,_0x50e667){if(_0xf722ed[_0x53a2('0x4f')]['id']){delete _0xf722ed[_0x53a2('0x4f')]['id'];}return db[_0x53a2('0x32')][_0x53a2('0x56')]({'where':{'id':_0xf722ed[_0x53a2('0x4c')]['id']}})[_0x53a2('0x27')](handleEntityNotFound(_0x50e667,null))[_0x53a2('0x27')](saveUpdates(_0xf722ed['body'],null))[_0x53a2('0x27')](respondWithResult(_0x50e667,null))['catch'](handleError(_0x50e667,null));};exports[_0x53a2('0x28')]=function(_0x867db6,_0x3b91eb){return db[_0x53a2('0x32')]['find']({'where':{'id':_0x867db6[_0x53a2('0x4c')]['id']}})[_0x53a2('0x27')](handleEntityNotFound(_0x3b91eb,null))[_0x53a2('0x27')](removeEntity(_0x3b91eb,null))[_0x53a2('0x4a')](handleError(_0x3b91eb,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 9bbe0af..512f7d5 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 _0x3ea7=['exports','define','Tag','tools_tags','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./tag.attributes'];(function(_0x75865d,_0x17c78b){var _0xc1149b=function(_0x5cfa01){while(--_0x5cfa01){_0x75865d['push'](_0x75865d['shift']());}};_0xc1149b(++_0x17c78b);}(_0x3ea7,0x1ee));var _0x73ea=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0x3ea7[_0x172747];return _0x509692;};'use strict';var _=require(_0x73ea('0x0'));var util=require(_0x73ea('0x1'));var logger=require(_0x73ea('0x2'))(_0x73ea('0x3'));var moment=require(_0x73ea('0x4'));var BPromise=require(_0x73ea('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x73ea('0x6'));var rimraf=require(_0x73ea('0x7'));var config=require(_0x73ea('0x8'));var attributes=require(_0x73ea('0x9'));module[_0x73ea('0xa')]=function(_0x4b34e9,_0x5ca325){return _0x4b34e9[_0x73ea('0xb')](_0x73ea('0xc'),attributes,{'tableName':_0x73ea('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x63e1=['util','api','moment','bluebird','path','rimraf','./tag.attributes','exports','define','Tag','lodash'];(function(_0x3750c9,_0xf00f30){var _0x1682ad=function(_0x464b3d){while(--_0x464b3d){_0x3750c9['push'](_0x3750c9['shift']());}};_0x1682ad(++_0xf00f30);}(_0x63e1,0x6d));var _0x163e=function(_0x484079,_0x1e812e){_0x484079=_0x484079-0x0;var _0x4c5f7f=_0x63e1[_0x484079];return _0x4c5f7f;};'use strict';var _=require(_0x163e('0x0'));var util=require(_0x163e('0x1'));var logger=require('../../config/logger')(_0x163e('0x2'));var moment=require(_0x163e('0x3'));var BPromise=require(_0x163e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x163e('0x5'));var rimraf=require(_0x163e('0x6'));var config=require('../../config/environment');var attributes=require(_0x163e('0x7'));module[_0x163e('0x8')]=function(_0x260bd,_0x4e2ac6){return _0x260bd[_0x163e('0x9')](_0x163e('0xa'),attributes,{'tableName':'tools_tags','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 490f61c..6bbcaf1 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 _0xe14d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x3dacc1,_0x161dc7){var _0x670b97=function(_0x575abc){while(--_0x575abc){_0x3dacc1['push'](_0x3dacc1['shift']());}};_0x670b97(++_0x161dc7);}(_0xe14d,0x1ee));var _0xde14=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xe14d[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var moment=require(_0xde14('0x2'));var BPromise=require(_0xde14('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde14('0x4'));var db=require(_0xde14('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xde14('0x6'))(_0xde14('0x7'));var config=require(_0xde14('0x8'));var jayson=require(_0xde14('0x9'));var client=jayson[_0xde14('0xa')][_0xde14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b1f6b,_0x5a1344,_0x1bd49d){return new BPromise(function(_0x115b7d,_0x2b0e7c){return client[_0xde14('0xc')](_0x4b1f6b,_0x1bd49d)[_0xde14('0xd')](function(_0x176909){logger[_0xde14('0xe')](_0xde14('0xf'),_0x5a1344,'request\x20sent');logger[_0xde14('0x10')](_0xde14('0x11'),_0x5a1344,_0xde14('0x12'),JSON[_0xde14('0x13')](_0x176909));if(_0x176909[_0xde14('0x14')]){if(_0x176909[_0xde14('0x14')][_0xde14('0x15')]===0x1f4){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909[_0xde14('0x14')][_0xde14('0x16')]);return _0x2b0e7c(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909['error']['message']);return _0x115b7d(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}else{logger[_0xde14('0xe')]('Tag,\x20%s,\x20%s',_0x5a1344,_0xde14('0x12'));_0x115b7d(_0x176909[_0xde14('0x17')][_0xde14('0x16')]);}})[_0xde14('0x18')](function(_0x3de959){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x3de959);_0x2b0e7c(_0x3de959);});});} \ No newline at end of file +var _0xcb99=['moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','Tag,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xcb99,0x8b));var _0x9cb9=function(_0x2f8d56,_0x376c64){_0x2f8d56=_0x2f8d56-0x0;var _0x36081d=_0xcb99[_0x2f8d56];return _0x36081d;};'use strict';var _=require(_0x9cb9('0x0'));var util=require('util');var moment=require(_0x9cb9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9cb9('0x2'));var db=require(_0x9cb9('0x3'))['db'];var utils=require(_0x9cb9('0x4'));var logger=require('../../config/logger')(_0x9cb9('0x5'));var config=require(_0x9cb9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9cb9('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ed26a,_0xa84493,_0x1bf9b7){return new BPromise(function(_0x1dd62f,_0x82e3e){return client[_0x9cb9('0x8')](_0x2ed26a,_0x1bf9b7)[_0x9cb9('0x9')](function(_0x3da50b){logger['info']('Tag,\x20%s,\x20%s',_0xa84493,_0x9cb9('0xa'));logger[_0x9cb9('0xb')](_0x9cb9('0xc'),_0xa84493,'request\x20sent',JSON[_0x9cb9('0xd')](_0x3da50b));if(_0x3da50b[_0x9cb9('0xe')]){if(_0x3da50b['error']['code']===0x1f4){logger[_0x9cb9('0xe')](_0x9cb9('0xf'),_0xa84493,_0x3da50b[_0x9cb9('0xe')][_0x9cb9('0x10')]);return _0x82e3e(_0x3da50b['error'][_0x9cb9('0x10')]);}logger[_0x9cb9('0xe')](_0x9cb9('0xf'),_0xa84493,_0x3da50b[_0x9cb9('0xe')][_0x9cb9('0x10')]);return _0x1dd62f(_0x3da50b[_0x9cb9('0xe')][_0x9cb9('0x10')]);}else{logger[_0x9cb9('0x11')](_0x9cb9('0xf'),_0xa84493,_0x9cb9('0xa'));_0x1dd62f(_0x3da50b[_0x9cb9('0x12')][_0x9cb9('0x10')]);}})[_0x9cb9('0x13')](function(_0x140910){logger[_0x9cb9('0xe')](_0x9cb9('0xf'),_0xa84493,_0x140910);_0x82e3e(_0x140910);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 5896899..96e99aa 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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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 558fea5..c85aad0 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 _0xbaf0=['name','exports','STRING'];(function(_0x2ad008,_0x45c253){var _0x4538cf=function(_0xe143e4){while(--_0xe143e4){_0x2ad008['push'](_0x2ad008['shift']());}};_0x4538cf(++_0x45c253);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x35c7f1,_0x18578c){var _0x208281=function(_0x26d055){while(--_0x26d055){_0x35c7f1['push'](_0x35c7f1['shift']());}};_0x208281(++_0x18578c);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 08ee80e..e4d1262 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 _0x45d5=['keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','merge','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT','MailQueueId','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','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','UserOpenchannelQueue','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','VoicePrefixId','UserProfileResource','send','getQueues','findOne','channel','isValidChannel','ValidationError','capitalize','toLowerCase','addQueues','Unknown\x20channel','add','removeQueues','Queues','ids','Voice','Chat','Mail','Sms','Fax','Whatsapp','transaction','through','penalty','QueueId','TeamVoiceQueue','User','Queue','findOrCreate','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','SIP/%s','all','UserVoicePrefix','addAgents','spread','removeAgents','isArray','Openchannel','emit','Queue:remove','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./team.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','reject','save','update','then','stack','name','map','Team','rawAttributes','fieldName','type','model'];(function(_0x1a387a,_0x53ba88){var _0x49496c=function(_0x12a6c4){while(--_0x12a6c4){_0x1a387a['push'](_0x1a387a['shift']());}};_0x49496c(++_0x53ba88);}(_0x45d5,0x1a4));var _0x545d=function(_0xfe8056,_0xf48d86){_0xfe8056=_0xfe8056-0x0;var _0x49dce4=_0x45d5[_0xfe8056];return _0x49dce4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x545d('0x0'));var jsonpatch=require(_0x545d('0x1'));var rp=require(_0x545d('0x2'));var moment=require(_0x545d('0x3'));var BPromise=require(_0x545d('0x4'));var Mustache=require(_0x545d('0x5'));var util=require(_0x545d('0x6'));var path=require(_0x545d('0x7'));var sox=require(_0x545d('0x8'));var csv=require(_0x545d('0x9'));var ejs=require(_0x545d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x545d('0xb'));var crypto=require(_0x545d('0xc'));var jsforce=require(_0x545d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x545d('0x9'));var querystring=require(_0x545d('0xe'));var Papa=require(_0x545d('0xf'));var Redis=require(_0x545d('0x10'));var authService=require(_0x545d('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x545d('0x12'))('api');var utils=require(_0x545d('0x13'));var config=require(_0x545d('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x545d('0x15'))['db'];config[_0x545d('0x16')]=_[_0x545d('0x17')](config[_0x545d('0x16')],{'host':_0x545d('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x545d('0x16')]));require(_0x545d('0x19'))[_0x545d('0x1a')](socket);function respondWithStatusCode(_0x3786a5,_0x897f41){_0x897f41=_0x897f41||0xcc;return function(_0x22e0b0){if(_0x22e0b0){return _0x3786a5[_0x545d('0x1b')](_0x897f41);}return _0x3786a5[_0x545d('0x1c')](_0x897f41)[_0x545d('0x1d')]();};}function respondWithResult(_0x2e4a76,_0x92de94){_0x92de94=_0x92de94||0xc8;return function(_0x2867c1){if(_0x2867c1){return _0x2e4a76[_0x545d('0x1c')](_0x92de94)['json'](_0x2867c1);}};}function respondWithFilteredResult(_0x1d6f5f,_0x44f191){return function(_0x457063){if(_0x457063){var _0x2dd1b9=typeof _0x44f191[_0x545d('0x1e')]===_0x545d('0x1f')&&typeof _0x44f191[_0x545d('0x20')]==='undefined';var _0x4fc76b=_0x457063['count'];var _0x3503a9=_0x2dd1b9?0x0:_0x44f191[_0x545d('0x1e')];var _0x195361=_0x2dd1b9?_0x457063[_0x545d('0x21')]:_0x44f191[_0x545d('0x1e')]+_0x44f191['limit'];var _0x2222d3;if(_0x195361>=_0x4fc76b){_0x195361=_0x4fc76b;_0x2222d3=0xc8;}else{_0x2222d3=0xce;}_0x1d6f5f[_0x545d('0x1c')](_0x2222d3);return _0x1d6f5f[_0x545d('0x22')]('Content-Range',_0x3503a9+'-'+_0x195361+'/'+_0x4fc76b)[_0x545d('0x23')](_0x457063);}return null;};}function patchUpdates(_0x404b84){return function(_0x1565da){try{jsonpatch['apply'](_0x1565da,_0x404b84,!![]);}catch(_0x4b53f4){return BPromise[_0x545d('0x24')](_0x4b53f4);}return _0x1565da[_0x545d('0x25')]();};}function saveUpdates(_0xcde4c3,_0x1c6327){return function(_0x7333a3){if(_0x7333a3){return _0x7333a3[_0x545d('0x26')](_0xcde4c3)[_0x545d('0x27')](function(_0x302e3b){return _0x302e3b;});}return null;};}function handleEntityNotFound(_0x258bb2,_0x252c48){return function(_0x47019f){if(!_0x47019f){_0x258bb2[_0x545d('0x1b')](0x194);}return _0x47019f;};}function handleError(_0x451d1b,_0x1bccb3){_0x1bccb3=_0x1bccb3||0x1f4;return function(_0x4f7c38){logger['error'](_0x4f7c38[_0x545d('0x28')]);if(_0x4f7c38[_0x545d('0x29')]){delete _0x4f7c38[_0x545d('0x29')];}_0x451d1b['status'](_0x1bccb3)['send'](_0x4f7c38);};}exports['index']=function(_0x44cf13,_0x52ec89){var _0x516cc4={},_0x20155e={},_0x5852b3={'count':0x0,'rows':[]};var _0x47b8c6=_[_0x545d('0x2a')](db[_0x545d('0x2b')][_0x545d('0x2c')],function(_0x41f9ab){return{'name':_0x41f9ab[_0x545d('0x2d')],'type':_0x41f9ab[_0x545d('0x2e')]['key']};});_0x20155e[_0x545d('0x2f')]=_[_0x545d('0x2a')](_0x47b8c6,_0x545d('0x29'));_0x20155e['query']=_[_0x545d('0x30')](_0x44cf13[_0x545d('0x31')]);_0x20155e[_0x545d('0x32')]=_[_0x545d('0x33')](_0x20155e['model'],_0x20155e[_0x545d('0x31')]);_0x516cc4[_0x545d('0x34')]=_[_0x545d('0x33')](_0x20155e[_0x545d('0x2f')],qs['fields'](_0x44cf13[_0x545d('0x31')][_0x545d('0x35')]));_0x516cc4['attributes']=_0x516cc4[_0x545d('0x34')][_0x545d('0x36')]?_0x516cc4[_0x545d('0x34')]:_0x20155e[_0x545d('0x2f')];if(!_0x44cf13[_0x545d('0x31')]['hasOwnProperty'](_0x545d('0x37'))){_0x516cc4[_0x545d('0x20')]=qs[_0x545d('0x20')](_0x44cf13['query']['limit']);_0x516cc4[_0x545d('0x1e')]=qs[_0x545d('0x1e')](_0x44cf13[_0x545d('0x31')][_0x545d('0x1e')]);}_0x516cc4[_0x545d('0x38')]=qs[_0x545d('0x39')](_0x44cf13[_0x545d('0x31')][_0x545d('0x39')]);_0x516cc4[_0x545d('0x3a')]=qs[_0x545d('0x32')](_[_0x545d('0x3b')](_0x44cf13[_0x545d('0x31')],_0x20155e[_0x545d('0x32')]),_0x47b8c6);if(_0x44cf13[_0x545d('0x31')][_0x545d('0x3c')]){_0x516cc4[_0x545d('0x3a')]=_['merge'](_0x516cc4[_0x545d('0x3a')],{'$or':_[_0x545d('0x2a')](_0x47b8c6,function(_0x2a4f92){if(_0x2a4f92[_0x545d('0x2e')]!==_0x545d('0x3d')){var _0x2d6257={};_0x2d6257[_0x2a4f92[_0x545d('0x29')]]={'$like':'%'+_0x44cf13['query'][_0x545d('0x3c')]+'%'};return _0x2d6257;}})});}_0x516cc4=_['merge']({},_0x516cc4,_0x44cf13[_0x545d('0x3e')]);var _0x1cb964={'where':_0x516cc4[_0x545d('0x3a')]};return db['Team']['count'](_0x1cb964)['then'](function(_0x2b070d){_0x5852b3[_0x545d('0x21')]=_0x2b070d;if(_0x44cf13[_0x545d('0x31')][_0x545d('0x3f')]){_0x516cc4['include']=[{'all':!![]}];}return db[_0x545d('0x2b')][_0x545d('0x40')](_0x516cc4);})[_0x545d('0x27')](function(_0x344443){_0x5852b3[_0x545d('0x41')]=_0x344443;return _0x5852b3;})[_0x545d('0x27')](respondWithFilteredResult(_0x52ec89,_0x516cc4))[_0x545d('0x42')](handleError(_0x52ec89,null));};exports['show']=function(_0x50ae95,_0x5c5b27){var _0x3f8198={'raw':![],'where':{'id':_0x50ae95[_0x545d('0x43')]['id']}},_0x35bacc={};_0x35bacc[_0x545d('0x2f')]=_['keys'](db[_0x545d('0x2b')]['rawAttributes']);_0x35bacc[_0x545d('0x31')]=_[_0x545d('0x30')](_0x50ae95[_0x545d('0x31')]);_0x35bacc[_0x545d('0x32')]=_[_0x545d('0x33')](_0x35bacc['model'],_0x35bacc[_0x545d('0x31')]);_0x3f8198[_0x545d('0x34')]=_[_0x545d('0x33')](_0x35bacc[_0x545d('0x2f')],qs[_0x545d('0x35')](_0x50ae95[_0x545d('0x31')][_0x545d('0x35')]));_0x3f8198['attributes']=_0x3f8198[_0x545d('0x34')]['length']?_0x3f8198['attributes']:_0x35bacc[_0x545d('0x2f')];if(_0x50ae95['query'][_0x545d('0x3f')]){_0x3f8198[_0x545d('0x44')]=[{'all':!![]}];}_0x3f8198=_[_0x545d('0x45')]({},_0x3f8198,_0x50ae95[_0x545d('0x3e')]);return db[_0x545d('0x2b')][_0x545d('0x46')](_0x3f8198)[_0x545d('0x27')](handleEntityNotFound(_0x5c5b27,null))['then'](respondWithResult(_0x5c5b27,null))[_0x545d('0x42')](handleError(_0x5c5b27,null));};exports[_0x545d('0x47')]=function(_0x429864,_0x532234){return db[_0x545d('0x2b')][_0x545d('0x47')](_0x429864[_0x545d('0x48')],{})[_0x545d('0x27')](function(_0x4beab1){var _0x485e16=_0x429864['user'][_0x545d('0x49')]({'plain':!![]});if(!_0x485e16)throw new Error(_0x545d('0x4a'));if(_0x485e16[_0x545d('0x4b')]===_0x545d('0x4c')){var _0x5ce7af=_0x4beab1[_0x545d('0x49')]({'plain':!![]});var _0x24998e=_0x545d('0x4d');return db[_0x545d('0x4e')][_0x545d('0x46')]({'where':{'name':_0x24998e,'userProfileId':_0x485e16[_0x545d('0x4f')]},'raw':!![]})[_0x545d('0x27')](function(_0x43193f){if(_0x43193f&&_0x43193f[_0x545d('0x50')]===0x0){return db['UserProfileResource'][_0x545d('0x47')]({'name':_0x5ce7af['name'],'resourceId':_0x5ce7af['id'],'type':_0x43193f[_0x545d('0x29')],'sectionId':_0x43193f['id']},{})[_0x545d('0x27')](function(){return _0x4beab1;});}else{return _0x4beab1;}})[_0x545d('0x42')](function(_0x53bfd5){logger['error'](_0x545d('0x51'),_0x53bfd5);throw _0x53bfd5;});}return _0x4beab1;})[_0x545d('0x27')](respondWithResult(_0x532234,0xc9))[_0x545d('0x42')](handleError(_0x532234,null));};exports[_0x545d('0x26')]=function(_0x3e7c93,_0x494fa4){if(_0x3e7c93[_0x545d('0x48')]['id']){delete _0x3e7c93[_0x545d('0x48')]['id'];}return db['Team'][_0x545d('0x46')]({'where':{'id':_0x3e7c93[_0x545d('0x43')]['id']}})[_0x545d('0x27')](handleEntityNotFound(_0x494fa4,null))['then'](saveUpdates(_0x3e7c93[_0x545d('0x48')],null))[_0x545d('0x27')](respondWithResult(_0x494fa4,null))['catch'](handleError(_0x494fa4,null));};exports[_0x545d('0x52')]=function(_0x48eb55,_0x109d7c){var _0x48192c=_0x48eb55[_0x545d('0x43')]['id'];var _0x376339=[];return db[_0x545d('0x53')]['transaction'](function(_0x1719df){var _0x310905=_0x545d('0x54')+_0x48192c;return db[_0x545d('0x53')]['query'](_0x310905,{'type':db[_0x545d('0x55')][_0x545d('0x56')]['SELECT'],'raw':!![],'transaction':_0x1719df})[_0x545d('0x27')](function(_0x3f3446){_0x376339=_[_0x545d('0x2a')](_0x3f3446,function(_0x3decf6){return Number(_0x3decf6[_0x545d('0x57')]);});})['then'](function(){var _0x1f3a8d=_0x545d('0x58')+_0x48192c;return db['sequelize'][_0x545d('0x31')](_0x1f3a8d,{'type':db['Sequelize'][_0x545d('0x56')]['SELECT'],'raw':!![],'transaction':_0x1719df});})['then'](function(_0x2c4d69){var _0x4256ab=_['map'](_0x2c4d69,function(_0x681538){return Number(_0x681538[_0x545d('0x59')]);});return db[_0x545d('0x5a')]['destroy']({'where':{'UserId':{'$in':_0x376339},'VoiceQueueId':{'$in':_0x4256ab}},'transaction':_0x1719df});})[_0x545d('0x27')](function(){var _0xf86932='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x48192c;return db[_0x545d('0x53')][_0x545d('0x31')](_0xf86932,{'type':db[_0x545d('0x55')]['QueryTypes'][_0x545d('0x5b')],'raw':!![],'transaction':_0x1719df});})[_0x545d('0x27')](function(_0x3438d7){var _0x5e5b1a=_['map'](_0x3438d7,function(_0x1df9bd){return Number(_0x1df9bd[_0x545d('0x5c')]);});return db['UserMailQueue'][_0x545d('0x52')]({'where':{'UserId':{'$in':_0x376339},'MailQueueId':{'$in':_0x5e5b1a}},'transaction':_0x1719df});})[_0x545d('0x27')](function(){var _0x1de31b=_0x545d('0x5d')+_0x48192c;return db[_0x545d('0x53')]['query'](_0x1de31b,{'type':db[_0x545d('0x55')]['QueryTypes'][_0x545d('0x5b')],'raw':!![],'transaction':_0x1719df});})[_0x545d('0x27')](function(_0x389a7e){var _0x34d9cd=_['map'](_0x389a7e,function(_0x9ccd43){return Number(_0x9ccd43[_0x545d('0x5e')]);});return db[_0x545d('0x5f')][_0x545d('0x52')]({'where':{'UserId':{'$in':_0x376339},'SmsQueueId':{'$in':_0x34d9cd}},'transaction':_0x1719df});})[_0x545d('0x27')](function(){var _0x283825=_0x545d('0x60')+_0x48192c;return db['sequelize'][_0x545d('0x31')](_0x283825,{'type':db[_0x545d('0x55')]['QueryTypes'][_0x545d('0x5b')],'raw':!![],'transaction':_0x1719df});})[_0x545d('0x27')](function(_0x546c98){var _0x3db9f4=_[_0x545d('0x2a')](_0x546c98,function(_0x18ca58){return Number(_0x18ca58[_0x545d('0x61')]);});return db[_0x545d('0x62')]['destroy']({'where':{'UserId':{'$in':_0x376339},'ChatQueueId':{'$in':_0x3db9f4}},'transaction':_0x1719df});})[_0x545d('0x27')](function(){var _0x22371c=_0x545d('0x63')+_0x48192c;return db[_0x545d('0x53')][_0x545d('0x31')](_0x22371c,{'type':db[_0x545d('0x55')]['QueryTypes'][_0x545d('0x5b')],'raw':!![],'transaction':_0x1719df});})[_0x545d('0x27')](function(_0x533bd1){var _0x2a807c=_[_0x545d('0x2a')](_0x533bd1,function(_0x4d360b){return Number(_0x4d360b[_0x545d('0x64')]);});return db[_0x545d('0x65')][_0x545d('0x52')]({'where':{'UserId':{'$in':_0x376339},'FaxQueueId':{'$in':_0x2a807c}},'transaction':_0x1719df});})[_0x545d('0x27')](function(){var _0x5930fa=_0x545d('0x66')+_0x48192c;return db[_0x545d('0x53')][_0x545d('0x31')](_0x5930fa,{'type':db[_0x545d('0x55')][_0x545d('0x56')]['SELECT'],'raw':!![],'transaction':_0x1719df});})[_0x545d('0x27')](function(_0x59f31b){var _0x268856=_[_0x545d('0x2a')](_0x59f31b,function(_0x56d7b9){return Number(_0x56d7b9[_0x545d('0x67')]);});return db[_0x545d('0x68')][_0x545d('0x52')]({'where':{'UserId':{'$in':_0x376339},'OpenchannelQueueId':{'$in':_0x268856}},'transaction':_0x1719df});})[_0x545d('0x27')](function(){var _0x361c2e='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x48192c;return db[_0x545d('0x53')][_0x545d('0x31')](_0x361c2e,{'type':db[_0x545d('0x55')]['QueryTypes'][_0x545d('0x5b')],'raw':!![],'transaction':_0x1719df});})['then'](function(_0x437acc){var _0x5c2461=_[_0x545d('0x2a')](_0x437acc,function(_0x4d9dfa){return Number(_0x4d9dfa[_0x545d('0x69')]);});return db[_0x545d('0x6a')][_0x545d('0x52')]({'where':{'UserId':{'$in':_0x376339},'WhatsappQueueId':{'$in':_0x5c2461}},'transaction':_0x1719df});})[_0x545d('0x27')](function(){return db[_0x545d('0x6b')][_0x545d('0x46')]({'where':{'TeamId':_0x48192c}});})['then'](function(_0x3d6994){if(_0x3d6994===null){return;}return db['UserVoicePrefix']['destroy']({'where':{'UserId':{'$in':_0x376339},'VoicePrefixId':_0x3d6994[_0x545d('0x6c')]},'transaction':_0x1719df});})[_0x545d('0x27')](function(){return db[_0x545d('0x2b')]['destroy']({'where':{'id':_0x48192c},'cascade':!![],'transaction':_0x1719df});})[_0x545d('0x27')](function(_0x15c4e1){if(_0x15c4e1===0x0){_0x109d7c[_0x545d('0x1b')](0x194);}else{return db[_0x545d('0x6d')][_0x545d('0x52')]({'where':{'type':'Teams','resourceId':_0x48192c},'cascade':!![],'transaction':_0x1719df})[_0x545d('0x27')](function(){_0x109d7c[_0x545d('0x1c')](0xcc)[_0x545d('0x1d')]();});}})['catch'](function(_0x15da91){_0x109d7c[_0x545d('0x1c')](0x1f4)[_0x545d('0x6e')](_0x15da91);});});};exports[_0x545d('0x6f')]=function(_0x4ecf9a,_0x1c6c23,_0x5a892a){return db[_0x545d('0x2b')][_0x545d('0x70')]({'where':{'id':_0x4ecf9a['params']['id']}})[_0x545d('0x27')](handleEntityNotFound(_0x1c6c23,null))['then'](function(_0x4708cf){if(!_0x4ecf9a[_0x545d('0x31')][_0x545d('0x71')]||!utils[_0x545d('0x72')](_0x4ecf9a[_0x545d('0x31')]['channel'])){throw new db[(_0x545d('0x55'))][(_0x545d('0x73'))]('Unknown\x20channel');}var _0x77b9fa={};var _0x423efc={};_0x423efc[_0x545d('0x2f')]=_[_0x545d('0x30')](db[_[_0x545d('0x74')](_0x4ecf9a[_0x545d('0x31')][_0x545d('0x71')]['toLowerCase']())+'Queue'][_0x545d('0x2c')]);_0x423efc['query']=_[_0x545d('0x30')](_0x4ecf9a['query']);_0x423efc[_0x545d('0x32')]=_['intersection'](_0x423efc[_0x545d('0x2f')],_0x423efc[_0x545d('0x31')]);_0x77b9fa['attributes']=_['intersection'](_0x423efc['model'],qs[_0x545d('0x35')](_0x4ecf9a[_0x545d('0x31')][_0x545d('0x35')]));_0x77b9fa['attributes']=_0x77b9fa['attributes'][_0x545d('0x36')]?_0x77b9fa[_0x545d('0x34')]:_0x423efc[_0x545d('0x2f')];_0x77b9fa[_0x545d('0x20')]=qs[_0x545d('0x20')](_0x4ecf9a[_0x545d('0x31')][_0x545d('0x20')]);_0x77b9fa[_0x545d('0x1e')]=qs[_0x545d('0x1e')](_0x4ecf9a[_0x545d('0x31')][_0x545d('0x1e')]);_0x77b9fa['order']=qs['sort'](_0x4ecf9a[_0x545d('0x31')][_0x545d('0x39')]);_0x77b9fa[_0x545d('0x3a')]=qs[_0x545d('0x32')](_[_0x545d('0x3b')](_0x4ecf9a[_0x545d('0x31')],_0x423efc[_0x545d('0x32')]));_0x77b9fa=_[_0x545d('0x45')]({},_0x77b9fa,_0x4ecf9a[_0x545d('0x3e')]);return _0x4708cf[_0x545d('0x49')+_[_0x545d('0x74')](_0x4ecf9a[_0x545d('0x31')]['channel'][_0x545d('0x75')]())+'Queues'](_0x77b9fa);})[_0x545d('0x27')](respondWithResult(_0x1c6c23,null))[_0x545d('0x42')](handleError(_0x1c6c23,null));};exports[_0x545d('0x76')]=function(_0x4c233d,_0x2c2078,_0x4400d6){return db[_0x545d('0x2b')][_0x545d('0x70')]({'where':{'id':_0x4c233d[_0x545d('0x43')]['id']}})['then'](function(_0x11afb5){if(_0x11afb5){if(!_0x4c233d[_0x545d('0x48')][_0x545d('0x71')]||!utils[_0x545d('0x72')](_0x4c233d['body'][_0x545d('0x71')])){throw new db[(_0x545d('0x55'))]['ValidationError'](_0x545d('0x77'));}return _0x11afb5[_0x545d('0x78')+_[_0x545d('0x74')](_0x4c233d[_0x545d('0x48')][_0x545d('0x71')][_0x545d('0x75')]())+'Queues'](_0x4c233d['body']['ids']);}return null;})[_0x545d('0x27')](handleEntityNotFound(_0x2c2078,null))[_0x545d('0x27')](respondWithStatusCode(_0x2c2078,null))['catch'](handleError(_0x2c2078,null));};exports[_0x545d('0x79')]=function(_0x45e567,_0xee4c7f,_0x5e2582){return db[_0x545d('0x2b')][_0x545d('0x70')]({'where':{'id':_0x45e567[_0x545d('0x43')]['id']}})['then'](function(_0x5f4a66){if(_0x5f4a66){if(!_0x45e567['query'][_0x545d('0x71')]||!utils[_0x545d('0x72')](_0x45e567['query'][_0x545d('0x71')])){throw new db[(_0x545d('0x55'))][(_0x545d('0x73'))](_0x545d('0x77'));}return _0x5f4a66['remove'+_[_0x545d('0x74')](_0x45e567[_0x545d('0x31')][_0x545d('0x71')][_0x545d('0x75')]())+_0x545d('0x7a')](_0x45e567[_0x545d('0x31')]['ids']);}return null;})[_0x545d('0x27')](handleEntityNotFound(_0xee4c7f,null))[_0x545d('0x27')](respondWithStatusCode(_0xee4c7f,null))[_0x545d('0x42')](handleError(_0xee4c7f,null));};exports['addAgents']=function(_0x37c624,_0x4cb077){var _0x448546=_['isArray'](_0x37c624[_0x545d('0x48')][_0x545d('0x7b')])?_0x37c624[_0x545d('0x48')][_0x545d('0x7b')]:[_0x37c624['body'][_0x545d('0x7b')]];var _0x279edb=_0x37c624[_0x545d('0x43')]['id'];return db[_0x545d('0x2b')]['find']({'where':{'id':_0x279edb}})['then'](handleEntityNotFound(_0x4cb077,null))[_0x545d('0x27')](function(_0x4792af){if(_0x4792af){var _0x3a5ca2=[_0x545d('0x7c'),_0x545d('0x7d'),_0x545d('0x7e'),_0x545d('0x7f'),_0x545d('0x80'),'Openchannel',_0x545d('0x81')];return db[_0x545d('0x53')][_0x545d('0x82')](function(_0x11e39e){var _0x3bb979=_['map'](_0x3a5ca2,function(_0x3e7b6c){var _0x457698={'attributes':['id',_0x545d('0x29')]};if(_0x3e7b6c==='Voice'){_0x457698[_0x545d('0x83')]={'attributes':[_0x545d('0x84')]};}return _0x4792af[_0x545d('0x49')+_0x3e7b6c+'Queues'](_0x457698)[_0x545d('0x27')](function(_0x234340){var _0x5de071=_[_0x545d('0x2a')](_0x234340,function(_0x5596f7){var _0x3eed60=_[_0x545d('0x2a')](_0x448546,function(_0x2482e1){var _0x9b785={'where':{'UserId':_0x2482e1,[_0x3e7b6c+_0x545d('0x85')]:_0x5596f7['id']},'transaction':_0x11e39e};if(_0x3e7b6c===_0x545d('0x7c')){_0x9b785['defaults']={'penalty':_0x5596f7[_0x545d('0x86')]['penalty']};}return db[_0x545d('0x87')+_0x3e7b6c+_0x545d('0x88')][_0x545d('0x89')](_0x9b785)[_0x545d('0x27')](function(){socket['emit'](_0x545d('0x4c')+_0x3e7b6c+_0x545d('0x8a'),{'UserId':_0x2482e1,[_0x3e7b6c+_0x545d('0x85')]:_0x5596f7['id']});if(_0x3e7b6c!==_0x545d('0x7c')){return;}return db[_0x545d('0x87')]['findAll']({'where':{'id':_0x448546,'online':0x1},'attributes':['id',_0x545d('0x29'),_0x545d('0x8b'),_0x545d('0x8c'),_0x545d('0x8d')],'raw':!![]})[_0x545d('0x27')](function(_0x267ce9){var _0x4bacfc=_['map'](_0x267ce9,function(_0x90ac35){return db[_0x545d('0x8e')][_0x545d('0x8f')]({'membername':_0x90ac35[_0x545d('0x29')],'UserId':_0x90ac35['id'],'queue_name':_0x5596f7[_0x545d('0x29')],'VoiceQueueId':_0x5596f7['id'],'interface':_[_0x545d('0x90')](_0x90ac35[_0x545d('0x8d')])?util['format'](_0x545d('0x91'),_0x90ac35['name']):_0x90ac35[_0x545d('0x8d')],'paused':_0x90ac35[_0x545d('0x8c')]||![],'penalty':_0x5596f7[_0x545d('0x86')][_0x545d('0x84')]},{'transaction':_0x11e39e});});return Promise[_0x545d('0x92')](_0x4bacfc);});});});return Promise[_0x545d('0x92')](_0x3eed60);});return Promise[_0x545d('0x92')](_0x5de071);})[_0x545d('0x27')](function(){return db[_0x545d('0x6b')]['findOne']({'where':{'teamId':_0x279edb}})[_0x545d('0x27')](function(_0x468075){if(_0x468075){var _0x24a61c=_[_0x545d('0x2a')](_0x448546,function(_0x33c586){db[_0x545d('0x93')][_0x545d('0x8f')]({'UserId':_0x33c586,'VoicePrefixId':_0x468075[_0x545d('0x6c')]});});return Promise[_0x545d('0x92')](_0x24a61c);}});});});return Promise['all'](_0x3bb979)['then'](function(){return _0x4792af[_0x545d('0x94')](_0x448546,{'transaction':_0x11e39e})[_0x545d('0x95')](function(_0x37061e){return _0x37061e;});});});}})[_0x545d('0x27')](respondWithResult(_0x4cb077,null))[_0x545d('0x42')](handleError(_0x4cb077,null));};exports[_0x545d('0x96')]=function(_0x316bf6,_0xd7b6b8){var _0x2ba2da=_[_0x545d('0x97')](_0x316bf6[_0x545d('0x31')][_0x545d('0x7b')])?_0x316bf6['query'][_0x545d('0x7b')]:[_0x316bf6[_0x545d('0x31')][_0x545d('0x7b')]];var _0x525e31=_0x316bf6[_0x545d('0x43')]['id'];return db[_0x545d('0x2b')]['find']({'where':{'id':_0x525e31}})[_0x545d('0x27')](handleEntityNotFound(_0xd7b6b8,null))[_0x545d('0x27')](function(_0x4b5f04){if(_0x4b5f04){var _0x2d66d4=[_0x545d('0x7c'),_0x545d('0x7d'),_0x545d('0x7e'),_0x545d('0x7f'),_0x545d('0x80'),_0x545d('0x98'),_0x545d('0x81')];return db[_0x545d('0x53')][_0x545d('0x82')](function(_0x17b7df){var _0x2d98e7=_['map'](_0x2d66d4,function(_0x2d9c05){var _0x4508c0={'attributes':['id',_0x545d('0x29')]};return _0x4b5f04[_0x545d('0x49')+_0x2d9c05+'Queues'](_0x4508c0)[_0x545d('0x27')](function(_0x1f5ef1){var _0x58677b=_[_0x545d('0x2a')](_0x1f5ef1,function(_0x37edcb){return _0x37edcb[_0x545d('0x96')](_0x2ba2da,{'transaction':_0x17b7df})[_0x545d('0x27')](function(){var _0x570750=_[_0x545d('0x2a')](_0x2ba2da,function(_0x4b301a){socket[_0x545d('0x99')]('user'+_0x2d9c05+_0x545d('0x9a'),{'UserId':Number(_0x4b301a),[_0x2d9c05+_0x545d('0x85')]:_0x37edcb['id']});if(_0x2d9c05!=='Voice'){return;}return db[_0x545d('0x8e')][_0x545d('0x52')]({'where':{'VoiceQueueId':_0x37edcb['id'],'UserId':_0x4b301a},'transaction':_0x17b7df});});return Promise[_0x545d('0x92')](_0x570750);});});return Promise[_0x545d('0x92')](_0x58677b);});});return Promise[_0x545d('0x92')](_0x2d98e7)[_0x545d('0x27')](function(){return _0x4b5f04[_0x545d('0x96')](_0x2ba2da,{'transaction':_0x17b7df});})['then'](function(){return db[_0x545d('0x6b')][_0x545d('0x70')]({'where':{'teamId':_0x525e31}})['then'](function(_0x2b8218){if(_0x2b8218){var _0x528118=_[_0x545d('0x2a')](_0x2ba2da,function(_0x171071){db[_0x545d('0x93')][_0x545d('0x52')]({'where':{'UserId':_0x171071,'VoicePrefixId':_0x2b8218[_0x545d('0x6c')]}});});return Promise['all'](_0x528118);}});});});}})[_0x545d('0x27')](respondWithStatusCode(_0xd7b6b8,null))[_0x545d('0x42')](handleError(_0xd7b6b8,null));};exports[_0x545d('0x9b')]=function(_0x2c2d5e,_0x5559ae,_0x438996){var _0x39f062={};var _0x11565b={};var _0x5a941a;var _0x189826;return db[_0x545d('0x2b')]['findOne']({'where':{'id':_0x2c2d5e[_0x545d('0x43')]['id']}})[_0x545d('0x27')](handleEntityNotFound(_0x5559ae,null))['then'](function(_0x559a8b){if(_0x559a8b){_0x5a941a=_0x559a8b;_0x11565b[_0x545d('0x2f')]=_[_0x545d('0x30')](db['User'][_0x545d('0x2c')]);_0x11565b[_0x545d('0x31')]=_['keys'](_0x2c2d5e[_0x545d('0x31')]);_0x11565b[_0x545d('0x32')]=_[_0x545d('0x33')](_0x11565b[_0x545d('0x2f')],_0x11565b[_0x545d('0x31')]);_0x39f062[_0x545d('0x34')]=_[_0x545d('0x33')](_0x11565b[_0x545d('0x2f')],qs['fields'](_0x2c2d5e[_0x545d('0x31')][_0x545d('0x35')]));_0x39f062[_0x545d('0x34')]=_0x39f062[_0x545d('0x34')]['length']?_0x39f062[_0x545d('0x34')]:_0x11565b[_0x545d('0x2f')];_0x39f062[_0x545d('0x38')]=qs[_0x545d('0x39')](_0x2c2d5e['query'][_0x545d('0x39')]);_0x39f062['where']=qs[_0x545d('0x32')](_[_0x545d('0x3b')](_0x2c2d5e['query'],_0x11565b[_0x545d('0x32')]));if(_0x2c2d5e[_0x545d('0x31')]['filter']){_0x39f062['where']=_[_0x545d('0x45')](_0x39f062['where'],{'$or':_['map'](_0x39f062['attributes'],function(_0xbfa436){var _0x1abd70={};_0x1abd70[_0xbfa436]={'$like':'%'+_0x2c2d5e[_0x545d('0x31')][_0x545d('0x3c')]+'%'};return _0x1abd70;})});}_0x39f062=_[_0x545d('0x45')]({},_0x39f062,_0x2c2d5e[_0x545d('0x3e')]);return _0x5a941a[_0x545d('0x9b')](_0x39f062);}})[_0x545d('0x27')](function(_0x657d83){if(_0x657d83){_0x189826=_0x657d83[_0x545d('0x36')];if(!_0x2c2d5e[_0x545d('0x31')]['hasOwnProperty'](_0x545d('0x37'))){_0x39f062['limit']=qs[_0x545d('0x20')](_0x2c2d5e[_0x545d('0x31')][_0x545d('0x20')]);_0x39f062[_0x545d('0x1e')]=qs[_0x545d('0x1e')](_0x2c2d5e[_0x545d('0x31')][_0x545d('0x1e')]);}return _0x5a941a[_0x545d('0x9b')](_0x39f062);}})[_0x545d('0x27')](function(_0x155d81){if(_0x155d81){return _0x155d81?{'count':_0x189826,'rows':_0x155d81}:null;}})[_0x545d('0x27')](respondWithResult(_0x5559ae,null))[_0x545d('0x42')](handleError(_0x5559ae,null));}; \ No newline at end of file +var _0xbf37=['keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','rows','catch','show','rawAttributes','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','destroy','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','MailQueueId','UserMailQueue','sequelize','SmsQueueId','UserSmsQueue','ChatQueueId','UserChatQueue','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','TeamVoicePrefix','UserVoicePrefix','getQueues','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','Queue','toLowerCase','Queues','addQueues','findOne','add','ids','removeQueues','remove','addAgents','isArray','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','penalty','QueueId','Voice','User','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','format','SIP/%s','all','VoicePrefixId','spread','removeAgents','Queue:remove','getAgents','pick','rimraf','zip-dir','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/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','Team','fieldName','type','model'];(function(_0x4e1de9,_0x24448b){var _0x25da2b=function(_0x505205){while(--_0x505205){_0x4e1de9['push'](_0x4e1de9['shift']());}};_0x25da2b(++_0x24448b);}(_0xbf37,0x64));var _0x7bf3=function(_0x25e4fd,_0x114721){_0x25e4fd=_0x25e4fd-0x0;var _0x27a802=_0xbf37[_0x25e4fd];return _0x27a802;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7bf3('0x0'));var zipdir=require(_0x7bf3('0x1'));var jsonpatch=require(_0x7bf3('0x2'));var rp=require('request-promise');var moment=require(_0x7bf3('0x3'));var BPromise=require(_0x7bf3('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7bf3('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7bf3('0x6'));var fs=require('fs');var fs_extra=require(_0x7bf3('0x7'));var _=require(_0x7bf3('0x8'));var squel=require('squel');var crypto=require(_0x7bf3('0x9'));var jsforce=require(_0x7bf3('0xa'));var deskjs=require(_0x7bf3('0xb'));var toCsv=require(_0x7bf3('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7bf3('0xd'));var authService=require(_0x7bf3('0xe'));var qs=require(_0x7bf3('0xf'));var as=require(_0x7bf3('0x10'));var hardwareService=require(_0x7bf3('0x11'));var logger=require('../../config/logger')(_0x7bf3('0x12'));var utils=require('../../config/utils');var config=require(_0x7bf3('0x13'));var licenseUtil=require(_0x7bf3('0x14'));var db=require('../../mysqldb')['db'];config[_0x7bf3('0x15')]=_[_0x7bf3('0x16')](config[_0x7bf3('0x15')],{'host':_0x7bf3('0x17'),'port':0x18eb});var socket=require(_0x7bf3('0x18'))(new Redis(config[_0x7bf3('0x15')]));require(_0x7bf3('0x19'))[_0x7bf3('0x1a')](socket);function respondWithStatusCode(_0x5c2c58,_0x30df7){_0x30df7=_0x30df7||0xcc;return function(_0x3063cc){if(_0x3063cc){return _0x5c2c58[_0x7bf3('0x1b')](_0x30df7);}return _0x5c2c58[_0x7bf3('0x1c')](_0x30df7)[_0x7bf3('0x1d')]();};}function respondWithResult(_0x56de0a,_0x6b936c){_0x6b936c=_0x6b936c||0xc8;return function(_0x5bcca7){if(_0x5bcca7){return _0x56de0a['status'](_0x6b936c)[_0x7bf3('0x1e')](_0x5bcca7);}};}function respondWithFilteredResult(_0x461975,_0x5927b0){return function(_0x5ebd0e){if(_0x5ebd0e){var _0x46e9db=typeof _0x5927b0[_0x7bf3('0x1f')]==='undefined'&&typeof _0x5927b0[_0x7bf3('0x20')]==='undefined';var _0xddd317=_0x5ebd0e[_0x7bf3('0x21')];var _0x39820a=_0x46e9db?0x0:_0x5927b0[_0x7bf3('0x1f')];var _0x495901=_0x46e9db?_0x5ebd0e['count']:_0x5927b0['offset']+_0x5927b0[_0x7bf3('0x20')];var _0x843671;if(_0x495901>=_0xddd317){_0x495901=_0xddd317;_0x843671=0xc8;}else{_0x843671=0xce;}_0x461975['status'](_0x843671);return _0x461975[_0x7bf3('0x22')](_0x7bf3('0x23'),_0x39820a+'-'+_0x495901+'/'+_0xddd317)[_0x7bf3('0x1e')](_0x5ebd0e);}return null;};}function patchUpdates(_0x5c9da3){return function(_0x53c223){try{jsonpatch[_0x7bf3('0x24')](_0x53c223,_0x5c9da3,!![]);}catch(_0x32e077){return BPromise[_0x7bf3('0x25')](_0x32e077);}return _0x53c223[_0x7bf3('0x26')]();};}function saveUpdates(_0x7117a0,_0x2b704e){return function(_0x346ccf){if(_0x346ccf){return _0x346ccf[_0x7bf3('0x27')](_0x7117a0)[_0x7bf3('0x28')](function(_0x1432fe){return _0x1432fe;});}return null;};}function handleEntityNotFound(_0x457f53,_0x2af060){return function(_0x3419a5){if(!_0x3419a5){_0x457f53['sendStatus'](0x194);}return _0x3419a5;};}function handleError(_0x28e7d1,_0x4c51e7){_0x4c51e7=_0x4c51e7||0x1f4;return function(_0x55b2cd){logger[_0x7bf3('0x29')](_0x55b2cd['stack']);if(_0x55b2cd[_0x7bf3('0x2a')]){delete _0x55b2cd['name'];}_0x28e7d1[_0x7bf3('0x1c')](_0x4c51e7)[_0x7bf3('0x2b')](_0x55b2cd);};}exports[_0x7bf3('0x2c')]=function(_0x4337ef,_0x2cf234){var _0x51667e={},_0x2c3d15={},_0x456acc={'count':0x0,'rows':[]};var _0x153fe6=_[_0x7bf3('0x2d')](db[_0x7bf3('0x2e')]['rawAttributes'],function(_0x2ad819){return{'name':_0x2ad819[_0x7bf3('0x2f')],'type':_0x2ad819[_0x7bf3('0x30')]['key']};});_0x2c3d15[_0x7bf3('0x31')]=_[_0x7bf3('0x2d')](_0x153fe6,_0x7bf3('0x2a'));_0x2c3d15['query']=_[_0x7bf3('0x32')](_0x4337ef['query']);_0x2c3d15['filters']=_[_0x7bf3('0x33')](_0x2c3d15[_0x7bf3('0x31')],_0x2c3d15[_0x7bf3('0x34')]);_0x51667e[_0x7bf3('0x35')]=_[_0x7bf3('0x33')](_0x2c3d15[_0x7bf3('0x31')],qs[_0x7bf3('0x36')](_0x4337ef[_0x7bf3('0x34')][_0x7bf3('0x36')]));_0x51667e[_0x7bf3('0x35')]=_0x51667e['attributes'][_0x7bf3('0x37')]?_0x51667e[_0x7bf3('0x35')]:_0x2c3d15['model'];if(!_0x4337ef[_0x7bf3('0x34')][_0x7bf3('0x38')](_0x7bf3('0x39'))){_0x51667e[_0x7bf3('0x20')]=qs[_0x7bf3('0x20')](_0x4337ef[_0x7bf3('0x34')]['limit']);_0x51667e[_0x7bf3('0x1f')]=qs[_0x7bf3('0x1f')](_0x4337ef[_0x7bf3('0x34')][_0x7bf3('0x1f')]);}_0x51667e[_0x7bf3('0x3a')]=qs[_0x7bf3('0x3b')](_0x4337ef[_0x7bf3('0x34')][_0x7bf3('0x3b')]);_0x51667e[_0x7bf3('0x3c')]=qs[_0x7bf3('0x3d')](_['pick'](_0x4337ef[_0x7bf3('0x34')],_0x2c3d15[_0x7bf3('0x3d')]),_0x153fe6);if(_0x4337ef['query'][_0x7bf3('0x3e')]){_0x51667e[_0x7bf3('0x3c')]=_[_0x7bf3('0x3f')](_0x51667e[_0x7bf3('0x3c')],{'$or':_[_0x7bf3('0x2d')](_0x153fe6,function(_0x1a5f43){if(_0x1a5f43[_0x7bf3('0x30')]!=='VIRTUAL'){var _0x2051cc={};_0x2051cc[_0x1a5f43[_0x7bf3('0x2a')]]={'$like':'%'+_0x4337ef['query'][_0x7bf3('0x3e')]+'%'};return _0x2051cc;}})});}_0x51667e=_[_0x7bf3('0x3f')]({},_0x51667e,_0x4337ef[_0x7bf3('0x40')]);var _0x218021={'where':_0x51667e[_0x7bf3('0x3c')]};return db[_0x7bf3('0x2e')][_0x7bf3('0x21')](_0x218021)[_0x7bf3('0x28')](function(_0x123c10){_0x456acc[_0x7bf3('0x21')]=_0x123c10;if(_0x4337ef[_0x7bf3('0x34')][_0x7bf3('0x41')]){_0x51667e[_0x7bf3('0x42')]=[{'all':!![]}];}return db[_0x7bf3('0x2e')]['findAll'](_0x51667e);})['then'](function(_0x1962c1){_0x456acc[_0x7bf3('0x43')]=_0x1962c1;return _0x456acc;})[_0x7bf3('0x28')](respondWithFilteredResult(_0x2cf234,_0x51667e))[_0x7bf3('0x44')](handleError(_0x2cf234,null));};exports[_0x7bf3('0x45')]=function(_0x20012c,_0x5f0980){var _0x856fd4={'raw':![],'where':{'id':_0x20012c['params']['id']}},_0x576cc1={};_0x576cc1[_0x7bf3('0x31')]=_[_0x7bf3('0x32')](db['Team'][_0x7bf3('0x46')]);_0x576cc1['query']=_['keys'](_0x20012c[_0x7bf3('0x34')]);_0x576cc1[_0x7bf3('0x3d')]=_[_0x7bf3('0x33')](_0x576cc1[_0x7bf3('0x31')],_0x576cc1[_0x7bf3('0x34')]);_0x856fd4['attributes']=_[_0x7bf3('0x33')](_0x576cc1[_0x7bf3('0x31')],qs[_0x7bf3('0x36')](_0x20012c[_0x7bf3('0x34')][_0x7bf3('0x36')]));_0x856fd4[_0x7bf3('0x35')]=_0x856fd4['attributes']['length']?_0x856fd4[_0x7bf3('0x35')]:_0x576cc1[_0x7bf3('0x31')];if(_0x20012c[_0x7bf3('0x34')][_0x7bf3('0x41')]){_0x856fd4[_0x7bf3('0x42')]=[{'all':!![]}];}_0x856fd4=_[_0x7bf3('0x3f')]({},_0x856fd4,_0x20012c[_0x7bf3('0x40')]);return db[_0x7bf3('0x2e')][_0x7bf3('0x47')](_0x856fd4)[_0x7bf3('0x28')](handleEntityNotFound(_0x5f0980,null))[_0x7bf3('0x28')](respondWithResult(_0x5f0980,null))[_0x7bf3('0x44')](handleError(_0x5f0980,null));};exports[_0x7bf3('0x48')]=function(_0x481024,_0x4c646a){return db['Team'][_0x7bf3('0x48')](_0x481024['body'],{})[_0x7bf3('0x28')](function(_0x5e780d){var _0x4d0e13=_0x481024['user'][_0x7bf3('0x49')]({'plain':!![]});if(!_0x4d0e13)throw new Error(_0x7bf3('0x4a'));if(_0x4d0e13[_0x7bf3('0x4b')]===_0x7bf3('0x4c')){var _0xd2c430=_0x5e780d[_0x7bf3('0x49')]({'plain':!![]});var _0x210394=_0x7bf3('0x4d');return db[_0x7bf3('0x4e')][_0x7bf3('0x47')]({'where':{'name':_0x210394,'userProfileId':_0x4d0e13['userProfileId']},'raw':!![]})['then'](function(_0x5d1676){if(_0x5d1676&&_0x5d1676['autoAssociation']===0x0){return db[_0x7bf3('0x4f')][_0x7bf3('0x48')]({'name':_0xd2c430[_0x7bf3('0x2a')],'resourceId':_0xd2c430['id'],'type':_0x5d1676[_0x7bf3('0x2a')],'sectionId':_0x5d1676['id']},{})[_0x7bf3('0x28')](function(){return _0x5e780d;});}else{return _0x5e780d;}})['catch'](function(_0x4a7f41){logger['error'](_0x7bf3('0x50'),_0x4a7f41);throw _0x4a7f41;});}return _0x5e780d;})[_0x7bf3('0x28')](respondWithResult(_0x4c646a,0xc9))[_0x7bf3('0x44')](handleError(_0x4c646a,null));};exports['update']=function(_0x750ece,_0x364b98){if(_0x750ece[_0x7bf3('0x51')]['id']){delete _0x750ece[_0x7bf3('0x51')]['id'];}return db[_0x7bf3('0x2e')]['find']({'where':{'id':_0x750ece[_0x7bf3('0x52')]['id']}})['then'](handleEntityNotFound(_0x364b98,null))['then'](saveUpdates(_0x750ece[_0x7bf3('0x51')],null))[_0x7bf3('0x28')](respondWithResult(_0x364b98,null))[_0x7bf3('0x44')](handleError(_0x364b98,null));};exports[_0x7bf3('0x53')]=function(_0x3bf982,_0x8ee644){var _0x4934d7=_0x3bf982[_0x7bf3('0x52')]['id'];var _0x148c3c=[];return db['sequelize'][_0x7bf3('0x54')](function(_0x4bdf89){var _0x3fa90b=_0x7bf3('0x55')+_0x4934d7;return db['sequelize']['query'](_0x3fa90b,{'type':db[_0x7bf3('0x56')][_0x7bf3('0x57')][_0x7bf3('0x58')],'raw':!![],'transaction':_0x4bdf89})[_0x7bf3('0x28')](function(_0x2358e7){_0x148c3c=_[_0x7bf3('0x2d')](_0x2358e7,function(_0x1cabb6){return Number(_0x1cabb6[_0x7bf3('0x59')]);});})[_0x7bf3('0x28')](function(){var _0x53e4d9=_0x7bf3('0x5a')+_0x4934d7;return db['sequelize']['query'](_0x53e4d9,{'type':db[_0x7bf3('0x56')][_0x7bf3('0x57')]['SELECT'],'raw':!![],'transaction':_0x4bdf89});})[_0x7bf3('0x28')](function(_0x3c1bed){var _0x426847=_[_0x7bf3('0x2d')](_0x3c1bed,function(_0x5f2967){return Number(_0x5f2967[_0x7bf3('0x5b')]);});return db['UserVoiceQueue']['destroy']({'where':{'UserId':{'$in':_0x148c3c},'VoiceQueueId':{'$in':_0x426847}},'transaction':_0x4bdf89});})['then'](function(){var _0x1dc56a='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4934d7;return db['sequelize'][_0x7bf3('0x34')](_0x1dc56a,{'type':db[_0x7bf3('0x56')]['QueryTypes'][_0x7bf3('0x58')],'raw':!![],'transaction':_0x4bdf89});})[_0x7bf3('0x28')](function(_0xaa84ee){var _0x10ccfa=_['map'](_0xaa84ee,function(_0x52e760){return Number(_0x52e760[_0x7bf3('0x5c')]);});return db[_0x7bf3('0x5d')]['destroy']({'where':{'UserId':{'$in':_0x148c3c},'MailQueueId':{'$in':_0x10ccfa}},'transaction':_0x4bdf89});})['then'](function(){var _0x566d48='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4934d7;return db[_0x7bf3('0x5e')]['query'](_0x566d48,{'type':db[_0x7bf3('0x56')][_0x7bf3('0x57')][_0x7bf3('0x58')],'raw':!![],'transaction':_0x4bdf89});})[_0x7bf3('0x28')](function(_0x2ba36a){var _0x534b34=_[_0x7bf3('0x2d')](_0x2ba36a,function(_0x389d0d){return Number(_0x389d0d[_0x7bf3('0x5f')]);});return db[_0x7bf3('0x60')][_0x7bf3('0x53')]({'where':{'UserId':{'$in':_0x148c3c},'SmsQueueId':{'$in':_0x534b34}},'transaction':_0x4bdf89});})[_0x7bf3('0x28')](function(){var _0x4dfd35='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4934d7;return db[_0x7bf3('0x5e')][_0x7bf3('0x34')](_0x4dfd35,{'type':db[_0x7bf3('0x56')][_0x7bf3('0x57')][_0x7bf3('0x58')],'raw':!![],'transaction':_0x4bdf89});})[_0x7bf3('0x28')](function(_0x3c1595){var _0x224990=_[_0x7bf3('0x2d')](_0x3c1595,function(_0x4a755f){return Number(_0x4a755f[_0x7bf3('0x61')]);});return db[_0x7bf3('0x62')][_0x7bf3('0x53')]({'where':{'UserId':{'$in':_0x148c3c},'ChatQueueId':{'$in':_0x224990}},'transaction':_0x4bdf89});})[_0x7bf3('0x28')](function(){var _0x49a569='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4934d7;return db[_0x7bf3('0x5e')][_0x7bf3('0x34')](_0x49a569,{'type':db[_0x7bf3('0x56')][_0x7bf3('0x57')][_0x7bf3('0x58')],'raw':!![],'transaction':_0x4bdf89});})[_0x7bf3('0x28')](function(_0x1c8d87){var _0x5eb8f4=_[_0x7bf3('0x2d')](_0x1c8d87,function(_0x252ec5){return Number(_0x252ec5[_0x7bf3('0x63')]);});return db['UserFaxQueue']['destroy']({'where':{'UserId':{'$in':_0x148c3c},'FaxQueueId':{'$in':_0x5eb8f4}},'transaction':_0x4bdf89});})['then'](function(){var _0x3bac09=_0x7bf3('0x64')+_0x4934d7;return db[_0x7bf3('0x5e')][_0x7bf3('0x34')](_0x3bac09,{'type':db[_0x7bf3('0x56')][_0x7bf3('0x57')]['SELECT'],'raw':!![],'transaction':_0x4bdf89});})['then'](function(_0x5918c0){var _0x277bc4=_['map'](_0x5918c0,function(_0x2bc473){return Number(_0x2bc473[_0x7bf3('0x65')]);});return db[_0x7bf3('0x66')][_0x7bf3('0x53')]({'where':{'UserId':{'$in':_0x148c3c},'OpenchannelQueueId':{'$in':_0x277bc4}},'transaction':_0x4bdf89});})['then'](function(){var _0x2e9725=_0x7bf3('0x67')+_0x4934d7;return db[_0x7bf3('0x5e')][_0x7bf3('0x34')](_0x2e9725,{'type':db[_0x7bf3('0x56')][_0x7bf3('0x57')][_0x7bf3('0x58')],'raw':!![],'transaction':_0x4bdf89});})[_0x7bf3('0x28')](function(_0x392609){var _0x4e3c12=_[_0x7bf3('0x2d')](_0x392609,function(_0x362c3c){return Number(_0x362c3c[_0x7bf3('0x68')]);});return db['UserWhatsappQueue'][_0x7bf3('0x53')]({'where':{'UserId':{'$in':_0x148c3c},'WhatsappQueueId':{'$in':_0x4e3c12}},'transaction':_0x4bdf89});})['then'](function(){return db[_0x7bf3('0x69')]['find']({'where':{'TeamId':_0x4934d7}});})[_0x7bf3('0x28')](function(_0x5562d1){if(_0x5562d1===null){return;}return db[_0x7bf3('0x6a')][_0x7bf3('0x53')]({'where':{'UserId':{'$in':_0x148c3c},'VoicePrefixId':_0x5562d1['VoicePrefixId']},'transaction':_0x4bdf89});})[_0x7bf3('0x28')](function(){return db[_0x7bf3('0x2e')][_0x7bf3('0x53')]({'where':{'id':_0x4934d7},'cascade':!![],'transaction':_0x4bdf89});})[_0x7bf3('0x28')](function(_0xc37194){if(_0xc37194===0x0){_0x8ee644['sendStatus'](0x194);}else{return db[_0x7bf3('0x4f')][_0x7bf3('0x53')]({'where':{'type':_0x7bf3('0x4d'),'resourceId':_0x4934d7},'cascade':!![],'transaction':_0x4bdf89})[_0x7bf3('0x28')](function(){_0x8ee644[_0x7bf3('0x1c')](0xcc)[_0x7bf3('0x1d')]();});}})['catch'](function(_0x1f2ba5){_0x8ee644[_0x7bf3('0x1c')](0x1f4)[_0x7bf3('0x2b')](_0x1f2ba5);});});};exports[_0x7bf3('0x6b')]=function(_0x12d74c,_0x501e0f,_0x1a28d4){return db[_0x7bf3('0x2e')]['findOne']({'where':{'id':_0x12d74c[_0x7bf3('0x52')]['id']}})[_0x7bf3('0x28')](handleEntityNotFound(_0x501e0f,null))[_0x7bf3('0x28')](function(_0x4c8e45){if(!_0x12d74c['query'][_0x7bf3('0x6c')]||!utils[_0x7bf3('0x6d')](_0x12d74c[_0x7bf3('0x34')]['channel'])){throw new db[(_0x7bf3('0x56'))][(_0x7bf3('0x6e'))](_0x7bf3('0x6f'));}var _0x583fbd={};var _0x1276d6={};_0x1276d6[_0x7bf3('0x31')]=_[_0x7bf3('0x32')](db[_[_0x7bf3('0x70')](_0x12d74c['query'][_0x7bf3('0x6c')]['toLowerCase']())+_0x7bf3('0x71')][_0x7bf3('0x46')]);_0x1276d6[_0x7bf3('0x34')]=_['keys'](_0x12d74c['query']);_0x1276d6[_0x7bf3('0x3d')]=_[_0x7bf3('0x33')](_0x1276d6[_0x7bf3('0x31')],_0x1276d6[_0x7bf3('0x34')]);_0x583fbd[_0x7bf3('0x35')]=_[_0x7bf3('0x33')](_0x1276d6[_0x7bf3('0x31')],qs[_0x7bf3('0x36')](_0x12d74c[_0x7bf3('0x34')][_0x7bf3('0x36')]));_0x583fbd[_0x7bf3('0x35')]=_0x583fbd[_0x7bf3('0x35')]['length']?_0x583fbd[_0x7bf3('0x35')]:_0x1276d6[_0x7bf3('0x31')];_0x583fbd[_0x7bf3('0x20')]=qs['limit'](_0x12d74c[_0x7bf3('0x34')][_0x7bf3('0x20')]);_0x583fbd[_0x7bf3('0x1f')]=qs[_0x7bf3('0x1f')](_0x12d74c['query'][_0x7bf3('0x1f')]);_0x583fbd[_0x7bf3('0x3a')]=qs[_0x7bf3('0x3b')](_0x12d74c[_0x7bf3('0x34')][_0x7bf3('0x3b')]);_0x583fbd[_0x7bf3('0x3c')]=qs[_0x7bf3('0x3d')](_['pick'](_0x12d74c['query'],_0x1276d6['filters']));_0x583fbd=_[_0x7bf3('0x3f')]({},_0x583fbd,_0x12d74c[_0x7bf3('0x40')]);return _0x4c8e45[_0x7bf3('0x49')+_[_0x7bf3('0x70')](_0x12d74c[_0x7bf3('0x34')][_0x7bf3('0x6c')][_0x7bf3('0x72')]())+_0x7bf3('0x73')](_0x583fbd);})[_0x7bf3('0x28')](respondWithResult(_0x501e0f,null))[_0x7bf3('0x44')](handleError(_0x501e0f,null));};exports[_0x7bf3('0x74')]=function(_0x57832c,_0x1cccf0,_0x10397d){return db['Team'][_0x7bf3('0x75')]({'where':{'id':_0x57832c[_0x7bf3('0x52')]['id']}})['then'](function(_0x41ad96){if(_0x41ad96){if(!_0x57832c[_0x7bf3('0x51')][_0x7bf3('0x6c')]||!utils[_0x7bf3('0x6d')](_0x57832c[_0x7bf3('0x51')]['channel'])){throw new db['Sequelize'][(_0x7bf3('0x6e'))](_0x7bf3('0x6f'));}return _0x41ad96[_0x7bf3('0x76')+_[_0x7bf3('0x70')](_0x57832c[_0x7bf3('0x51')][_0x7bf3('0x6c')][_0x7bf3('0x72')]())+_0x7bf3('0x73')](_0x57832c['body'][_0x7bf3('0x77')]);}return null;})[_0x7bf3('0x28')](handleEntityNotFound(_0x1cccf0,null))[_0x7bf3('0x28')](respondWithStatusCode(_0x1cccf0,null))['catch'](handleError(_0x1cccf0,null));};exports[_0x7bf3('0x78')]=function(_0x47c241,_0x30ea1d,_0x16eef2){return db['Team'][_0x7bf3('0x75')]({'where':{'id':_0x47c241[_0x7bf3('0x52')]['id']}})[_0x7bf3('0x28')](function(_0x21c377){if(_0x21c377){if(!_0x47c241[_0x7bf3('0x34')][_0x7bf3('0x6c')]||!utils['isValidChannel'](_0x47c241[_0x7bf3('0x34')][_0x7bf3('0x6c')])){throw new db['Sequelize'][(_0x7bf3('0x6e'))](_0x7bf3('0x6f'));}return _0x21c377[_0x7bf3('0x79')+_[_0x7bf3('0x70')](_0x47c241[_0x7bf3('0x34')][_0x7bf3('0x6c')]['toLowerCase']())+'Queues'](_0x47c241[_0x7bf3('0x34')][_0x7bf3('0x77')]);}return null;})[_0x7bf3('0x28')](handleEntityNotFound(_0x30ea1d,null))[_0x7bf3('0x28')](respondWithStatusCode(_0x30ea1d,null))[_0x7bf3('0x44')](handleError(_0x30ea1d,null));};exports[_0x7bf3('0x7a')]=function(_0x870fea,_0x2626a4){var _0x373965=_[_0x7bf3('0x7b')](_0x870fea[_0x7bf3('0x51')]['ids'])?_0x870fea[_0x7bf3('0x51')][_0x7bf3('0x77')]:[_0x870fea[_0x7bf3('0x51')][_0x7bf3('0x77')]];var _0xca98ef=_0x870fea[_0x7bf3('0x52')]['id'];return db[_0x7bf3('0x2e')][_0x7bf3('0x47')]({'where':{'id':_0xca98ef}})[_0x7bf3('0x28')](handleEntityNotFound(_0x2626a4,null))[_0x7bf3('0x28')](function(_0x29fcc7){if(_0x29fcc7){var _0x47ad2c=['Voice',_0x7bf3('0x7c'),_0x7bf3('0x7d'),_0x7bf3('0x7e'),_0x7bf3('0x7f'),_0x7bf3('0x80'),_0x7bf3('0x81')];return db[_0x7bf3('0x5e')][_0x7bf3('0x54')](function(_0x178be9){var _0x3daf7c=_[_0x7bf3('0x2d')](_0x47ad2c,function(_0x501bd6){var _0xbe30e9={'attributes':['id',_0x7bf3('0x2a')]};if(_0x501bd6==='Voice'){_0xbe30e9['through']={'attributes':[_0x7bf3('0x82')]};}return _0x29fcc7[_0x7bf3('0x49')+_0x501bd6+_0x7bf3('0x73')](_0xbe30e9)[_0x7bf3('0x28')](function(_0x31c992){var _0x7e89fa=_[_0x7bf3('0x2d')](_0x31c992,function(_0x2c2bd8){var _0x43b1e6=_[_0x7bf3('0x2d')](_0x373965,function(_0x15b0b7){var _0x9a4b5b={'where':{'UserId':_0x15b0b7,[_0x501bd6+_0x7bf3('0x83')]:_0x2c2bd8['id']},'transaction':_0x178be9};if(_0x501bd6===_0x7bf3('0x84')){_0x9a4b5b[_0x7bf3('0x16')]={'penalty':_0x2c2bd8['TeamVoiceQueue']['penalty']};}return db[_0x7bf3('0x85')+_0x501bd6+_0x7bf3('0x71')]['findOrCreate'](_0x9a4b5b)['then'](function(){socket[_0x7bf3('0x86')](_0x7bf3('0x4c')+_0x501bd6+_0x7bf3('0x87'),{'UserId':_0x15b0b7,[_0x501bd6+_0x7bf3('0x83')]:_0x2c2bd8['id']});if(_0x501bd6!=='Voice'){return;}return db[_0x7bf3('0x85')]['findAll']({'where':{'id':_0x373965,'online':0x1},'attributes':['id',_0x7bf3('0x2a'),_0x7bf3('0x88'),_0x7bf3('0x89'),_0x7bf3('0x8a')],'raw':!![]})[_0x7bf3('0x28')](function(_0x22be23){var _0x4c5d2a=_[_0x7bf3('0x2d')](_0x22be23,function(_0x1eeaa8){return db[_0x7bf3('0x8b')][_0x7bf3('0x8c')]({'membername':_0x1eeaa8[_0x7bf3('0x2a')],'UserId':_0x1eeaa8['id'],'queue_name':_0x2c2bd8['name'],'VoiceQueueId':_0x2c2bd8['id'],'interface':_['isNil'](_0x1eeaa8['interface'])?util[_0x7bf3('0x8d')](_0x7bf3('0x8e'),_0x1eeaa8[_0x7bf3('0x2a')]):_0x1eeaa8[_0x7bf3('0x8a')],'paused':_0x1eeaa8[_0x7bf3('0x89')]||![],'penalty':_0x2c2bd8['TeamVoiceQueue'][_0x7bf3('0x82')]},{'transaction':_0x178be9});});return Promise[_0x7bf3('0x8f')](_0x4c5d2a);});});});return Promise['all'](_0x43b1e6);});return Promise[_0x7bf3('0x8f')](_0x7e89fa);})['then'](function(){return db['TeamVoicePrefix'][_0x7bf3('0x75')]({'where':{'teamId':_0xca98ef}})[_0x7bf3('0x28')](function(_0x4a3a31){if(_0x4a3a31){var _0x2435b5=_[_0x7bf3('0x2d')](_0x373965,function(_0x44777c){db[_0x7bf3('0x6a')][_0x7bf3('0x8c')]({'UserId':_0x44777c,'VoicePrefixId':_0x4a3a31[_0x7bf3('0x90')]});});return Promise[_0x7bf3('0x8f')](_0x2435b5);}});});});return Promise[_0x7bf3('0x8f')](_0x3daf7c)[_0x7bf3('0x28')](function(){return _0x29fcc7['addAgents'](_0x373965,{'transaction':_0x178be9})[_0x7bf3('0x91')](function(_0x5aa238){return _0x5aa238;});});});}})[_0x7bf3('0x28')](respondWithResult(_0x2626a4,null))[_0x7bf3('0x44')](handleError(_0x2626a4,null));};exports['removeAgents']=function(_0x2ff207,_0x5afc15){var _0x363dc5=_[_0x7bf3('0x7b')](_0x2ff207[_0x7bf3('0x34')]['ids'])?_0x2ff207[_0x7bf3('0x34')][_0x7bf3('0x77')]:[_0x2ff207['query'][_0x7bf3('0x77')]];var _0x481bc0=_0x2ff207[_0x7bf3('0x52')]['id'];return db[_0x7bf3('0x2e')][_0x7bf3('0x47')]({'where':{'id':_0x481bc0}})[_0x7bf3('0x28')](handleEntityNotFound(_0x5afc15,null))[_0x7bf3('0x28')](function(_0xeb15cc){if(_0xeb15cc){var _0x1db301=['Voice',_0x7bf3('0x7c'),_0x7bf3('0x7d'),_0x7bf3('0x7e'),_0x7bf3('0x7f'),_0x7bf3('0x80'),_0x7bf3('0x81')];return db['sequelize'][_0x7bf3('0x54')](function(_0xc1afeb){var _0x2a1db9=_[_0x7bf3('0x2d')](_0x1db301,function(_0x1f0bc3){var _0x4feee7={'attributes':['id',_0x7bf3('0x2a')]};return _0xeb15cc[_0x7bf3('0x49')+_0x1f0bc3+'Queues'](_0x4feee7)[_0x7bf3('0x28')](function(_0x13200b){var _0x2b6877=_[_0x7bf3('0x2d')](_0x13200b,function(_0x2fea71){return _0x2fea71[_0x7bf3('0x92')](_0x363dc5,{'transaction':_0xc1afeb})[_0x7bf3('0x28')](function(){var _0x14bbf0=_['map'](_0x363dc5,function(_0x4d84c8){socket[_0x7bf3('0x86')]('user'+_0x1f0bc3+_0x7bf3('0x93'),{'UserId':Number(_0x4d84c8),[_0x1f0bc3+_0x7bf3('0x83')]:_0x2fea71['id']});if(_0x1f0bc3!==_0x7bf3('0x84')){return;}return db['UserVoiceQueueRt'][_0x7bf3('0x53')]({'where':{'VoiceQueueId':_0x2fea71['id'],'UserId':_0x4d84c8},'transaction':_0xc1afeb});});return Promise[_0x7bf3('0x8f')](_0x14bbf0);});});return Promise[_0x7bf3('0x8f')](_0x2b6877);});});return Promise[_0x7bf3('0x8f')](_0x2a1db9)[_0x7bf3('0x28')](function(){return _0xeb15cc[_0x7bf3('0x92')](_0x363dc5,{'transaction':_0xc1afeb});})[_0x7bf3('0x28')](function(){return db[_0x7bf3('0x69')][_0x7bf3('0x75')]({'where':{'teamId':_0x481bc0}})[_0x7bf3('0x28')](function(_0x18668a){if(_0x18668a){var _0x267119=_[_0x7bf3('0x2d')](_0x363dc5,function(_0x1e6c26){db[_0x7bf3('0x6a')][_0x7bf3('0x53')]({'where':{'UserId':_0x1e6c26,'VoicePrefixId':_0x18668a['VoicePrefixId']}});});return Promise[_0x7bf3('0x8f')](_0x267119);}});});});}})['then'](respondWithStatusCode(_0x5afc15,null))['catch'](handleError(_0x5afc15,null));};exports[_0x7bf3('0x94')]=function(_0x45c9ca,_0x1800fe,_0x1d0205){var _0x476b66={};var _0x53cf80={};var _0x520f0b;var _0x5bf529;return db[_0x7bf3('0x2e')][_0x7bf3('0x75')]({'where':{'id':_0x45c9ca['params']['id']}})['then'](handleEntityNotFound(_0x1800fe,null))['then'](function(_0xa37b95){if(_0xa37b95){_0x520f0b=_0xa37b95;_0x53cf80[_0x7bf3('0x31')]=_[_0x7bf3('0x32')](db[_0x7bf3('0x85')][_0x7bf3('0x46')]);_0x53cf80[_0x7bf3('0x34')]=_[_0x7bf3('0x32')](_0x45c9ca['query']);_0x53cf80['filters']=_[_0x7bf3('0x33')](_0x53cf80[_0x7bf3('0x31')],_0x53cf80['query']);_0x476b66[_0x7bf3('0x35')]=_[_0x7bf3('0x33')](_0x53cf80[_0x7bf3('0x31')],qs['fields'](_0x45c9ca['query'][_0x7bf3('0x36')]));_0x476b66[_0x7bf3('0x35')]=_0x476b66[_0x7bf3('0x35')][_0x7bf3('0x37')]?_0x476b66[_0x7bf3('0x35')]:_0x53cf80['model'];_0x476b66[_0x7bf3('0x3a')]=qs['sort'](_0x45c9ca[_0x7bf3('0x34')]['sort']);_0x476b66[_0x7bf3('0x3c')]=qs[_0x7bf3('0x3d')](_[_0x7bf3('0x95')](_0x45c9ca[_0x7bf3('0x34')],_0x53cf80[_0x7bf3('0x3d')]));if(_0x45c9ca['query'][_0x7bf3('0x3e')]){_0x476b66['where']=_[_0x7bf3('0x3f')](_0x476b66[_0x7bf3('0x3c')],{'$or':_[_0x7bf3('0x2d')](_0x476b66['attributes'],function(_0x542782){var _0x3531ec={};_0x3531ec[_0x542782]={'$like':'%'+_0x45c9ca[_0x7bf3('0x34')][_0x7bf3('0x3e')]+'%'};return _0x3531ec;})});}_0x476b66=_['merge']({},_0x476b66,_0x45c9ca[_0x7bf3('0x40')]);return _0x520f0b[_0x7bf3('0x94')](_0x476b66);}})['then'](function(_0x5f35bb){if(_0x5f35bb){_0x5bf529=_0x5f35bb['length'];if(!_0x45c9ca[_0x7bf3('0x34')][_0x7bf3('0x38')]('nolimit')){_0x476b66[_0x7bf3('0x20')]=qs[_0x7bf3('0x20')](_0x45c9ca[_0x7bf3('0x34')]['limit']);_0x476b66[_0x7bf3('0x1f')]=qs['offset'](_0x45c9ca[_0x7bf3('0x34')]['offset']);}return _0x520f0b['getAgents'](_0x476b66);}})[_0x7bf3('0x28')](function(_0x4e6c6d){if(_0x4e6c6d){return _0x4e6c6d?{'count':_0x5bf529,'rows':_0x4e6c6d}:null;}})[_0x7bf3('0x28')](respondWithResult(_0x1800fe,null))[_0x7bf3('0x44')](handleError(_0x1800fe,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 2732868..4c87872 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 _0x4ec4=['hasOwnProperty','hook','exports','events','Team','setMaxListeners','save','update','remove','emit'];(function(_0x3d8e0f,_0x294530){var _0x5e2f81=function(_0x517d2e){while(--_0x517d2e){_0x3d8e0f['push'](_0x3d8e0f['shift']());}};_0x5e2f81(++_0x294530);}(_0x4ec4,0x19d));var _0x44ec=function(_0x2859b9,_0x1df68e){_0x2859b9=_0x2859b9-0x0;var _0x191dbd=_0x4ec4[_0x2859b9];return _0x191dbd;};'use strict';var EventEmitter=require(_0x44ec('0x0'));var Team=require('../../mysqldb')['db'][_0x44ec('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x44ec('0x2')](0x0);var events={'afterCreate':_0x44ec('0x3'),'afterUpdate':_0x44ec('0x4'),'afterDestroy':_0x44ec('0x5')};function emitEvent(_0x52c2b8){return function(_0x32041f,_0x3aa933,_0x698a04){TeamEvents[_0x44ec('0x6')](_0x52c2b8+':'+_0x32041f['id'],_0x32041f);TeamEvents['emit'](_0x52c2b8,_0x32041f);_0x698a04(null);};}for(var e in events){if(events[_0x44ec('0x7')](e)){var event=events[e];Team[_0x44ec('0x8')](e,emitEvent(event));}}module[_0x44ec('0x9')]=TeamEvents; \ No newline at end of file +var _0x2e81=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team','setMaxListeners','save','update'];(function(_0x3cd497,_0x320f13){var _0x5f03a6=function(_0x207c9f){while(--_0x207c9f){_0x3cd497['push'](_0x3cd497['shift']());}};_0x5f03a6(++_0x320f13);}(_0x2e81,0xc2));var _0x12e8=function(_0x179b68,_0x339d82){_0x179b68=_0x179b68-0x0;var _0x5e6d69=_0x2e81[_0x179b68];return _0x5e6d69;};'use strict';var EventEmitter=require(_0x12e8('0x0'));var Team=require(_0x12e8('0x1'))['db'][_0x12e8('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x12e8('0x3')](0x0);var events={'afterCreate':_0x12e8('0x4'),'afterUpdate':_0x12e8('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1682b3){return function(_0x39396d,_0x1c1b89,_0x52115c){TeamEvents['emit'](_0x1682b3+':'+_0x39396d['id'],_0x39396d);TeamEvents[_0x12e8('0x6')](_0x1682b3,_0x39396d);_0x52115c(null);};}for(var e in events){if(events[_0x12e8('0x7')](e)){var event=events[e];Team[_0x12e8('0x8')](e,emitEvent(event));}}module[_0x12e8('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 2f4f536..6a66620 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 _0x026b=['rimraf','./team.attributes','define','Team','teams','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x3b9a57,_0x7e3c76){var _0x149016=function(_0xf36e5e){while(--_0xf36e5e){_0x3b9a57['push'](_0x3b9a57['shift']());}};_0x149016(++_0x7e3c76);}(_0x026b,0x1bd));var _0xb026=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x026b[_0x5608a3];return _0x1ed50a;};'use strict';var _=require(_0xb026('0x0'));var util=require(_0xb026('0x1'));var logger=require(_0xb026('0x2'))(_0xb026('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb026('0x4'));var fs=require('fs');var path=require(_0xb026('0x5'));var rimraf=require(_0xb026('0x6'));var config=require('../../config/environment');var attributes=require(_0xb026('0x7'));module['exports']=function(_0x31c383,_0x5aa413){return _0x31c383[_0xb026('0x8')](_0xb026('0x9'),attributes,{'tableName':_0xb026('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef27=['exports','define','Team','teams','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./team.attributes'];(function(_0x350343,_0x256f69){var _0x9afc1c=function(_0x47ab32){while(--_0x47ab32){_0x350343['push'](_0x350343['shift']());}};_0x9afc1c(++_0x256f69);}(_0xef27,0x190));var _0x7ef2=function(_0x4a9903,_0x25a02b){_0x4a9903=_0x4a9903-0x0;var _0x3b81b6=_0xef27[_0x4a9903];return _0x3b81b6;};'use strict';var _=require(_0x7ef2('0x0'));var util=require('util');var logger=require(_0x7ef2('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7ef2('0x2'));var rp=require(_0x7ef2('0x3'));var fs=require('fs');var path=require(_0x7ef2('0x4'));var rimraf=require(_0x7ef2('0x5'));var config=require(_0x7ef2('0x6'));var attributes=require(_0x7ef2('0x7'));module[_0x7ef2('0x8')]=function(_0x18254b,_0x17fb04){return _0x18254b[_0x7ef2('0x9')](_0x7ef2('0xa'),attributes,{'tableName':_0x7ef2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 19c2df4..ec247cd 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 _0xadfd=['then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','./team.socket','register','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xadfd,0x1c5));var _0xdadf=function(_0x200060,_0xd360ec){_0x200060=_0x200060-0x0;var _0x2660e1=_0xadfd[_0x200060];return _0x2660e1;};'use strict';var _=require(_0xdadf('0x0'));var util=require(_0xdadf('0x1'));var moment=require(_0xdadf('0x2'));var BPromise=require(_0xdadf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdadf('0x4'))['db'];var utils=require(_0xdadf('0x5'));var logger=require(_0xdadf('0x6'))(_0xdadf('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdadf('0x8')]['http']({'port':0x232a});config[_0xdadf('0x9')]=_[_0xdadf('0xa')](config[_0xdadf('0x9')],{'host':_0xdadf('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdadf('0x9')]));require(_0xdadf('0xc'))[_0xdadf('0xd')](socket);function respondWithRpcPromise(_0x54c94e,_0x241af1,_0x105dd6){return new BPromise(function(_0x2d09c9,_0x16ae55){return client[_0xdadf('0xe')](_0x54c94e,_0x105dd6)[_0xdadf('0xf')](function(_0x108363){logger[_0xdadf('0x10')](_0xdadf('0x11'),_0x241af1,_0xdadf('0x12'));logger[_0xdadf('0x13')](_0xdadf('0x14'),_0x241af1,_0xdadf('0x12'),JSON['stringify'](_0x108363));if(_0x108363['error']){if(_0x108363[_0xdadf('0x15')][_0xdadf('0x16')]===0x1f4){logger['error'](_0xdadf('0x11'),_0x241af1,_0x108363[_0xdadf('0x15')][_0xdadf('0x17')]);return _0x16ae55(_0x108363[_0xdadf('0x15')][_0xdadf('0x17')]);}logger[_0xdadf('0x15')](_0xdadf('0x11'),_0x241af1,_0x108363[_0xdadf('0x15')][_0xdadf('0x17')]);return _0x2d09c9(_0x108363[_0xdadf('0x15')][_0xdadf('0x17')]);}else{logger['info'](_0xdadf('0x11'),_0x241af1,_0xdadf('0x12'));_0x2d09c9(_0x108363[_0xdadf('0x18')][_0xdadf('0x17')]);}})[_0xdadf('0x19')](function(_0x2ac0cd){logger[_0xdadf('0x15')](_0xdadf('0x11'),_0x241af1,_0x2ac0cd);_0x16ae55(_0x2ac0cd);});});} \ No newline at end of file +var _0x900d=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x41d853,_0xf2796){var _0x45dc7c=function(_0x4f3160){while(--_0x4f3160){_0x41d853['push'](_0x41d853['shift']());}};_0x45dc7c(++_0xf2796);}(_0x900d,0x1c7));var _0xd900=function(_0x126e9f,_0x536bb8){_0x126e9f=_0x126e9f-0x0;var _0x13d709=_0x900d[_0x126e9f];return _0x13d709;};'use strict';var _=require(_0xd900('0x0'));var util=require(_0xd900('0x1'));var moment=require(_0xd900('0x2'));var BPromise=require(_0xd900('0x3'));var rs=require(_0xd900('0x4'));var fs=require('fs');var Redis=require(_0xd900('0x5'));var db=require(_0xd900('0x6'))['db'];var utils=require(_0xd900('0x7'));var logger=require(_0xd900('0x8'))(_0xd900('0x9'));var config=require(_0xd900('0xa'));var jayson=require(_0xd900('0xb'));var client=jayson[_0xd900('0xc')][_0xd900('0xd')]({'port':0x232a});config[_0xd900('0xe')]=_[_0xd900('0xf')](config[_0xd900('0xe')],{'host':_0xd900('0x10'),'port':0x18eb});var socket=require(_0xd900('0x11'))(new Redis(config[_0xd900('0xe')]));require('./team.socket')[_0xd900('0x12')](socket);function respondWithRpcPromise(_0x81bb8e,_0x3ce19b,_0x9a75bf){return new BPromise(function(_0x383148,_0x455ea8){return client[_0xd900('0x13')](_0x81bb8e,_0x9a75bf)[_0xd900('0x14')](function(_0x4e1388){logger['info'](_0xd900('0x15'),_0x3ce19b,_0xd900('0x16'));logger['debug'](_0xd900('0x17'),_0x3ce19b,_0xd900('0x16'),JSON[_0xd900('0x18')](_0x4e1388));if(_0x4e1388['error']){if(_0x4e1388[_0xd900('0x19')][_0xd900('0x1a')]===0x1f4){logger[_0xd900('0x19')](_0xd900('0x15'),_0x3ce19b,_0x4e1388[_0xd900('0x19')][_0xd900('0x1b')]);return _0x455ea8(_0x4e1388[_0xd900('0x19')][_0xd900('0x1b')]);}logger[_0xd900('0x19')](_0xd900('0x15'),_0x3ce19b,_0x4e1388[_0xd900('0x19')]['message']);return _0x383148(_0x4e1388[_0xd900('0x19')][_0xd900('0x1b')]);}else{logger[_0xd900('0x1c')](_0xd900('0x15'),_0x3ce19b,_0xd900('0x16'));_0x383148(_0x4e1388[_0xd900('0x1d')][_0xd900('0x1b')]);}})[_0xd900('0x1e')](function(_0x511445){logger['error']('Team,\x20%s,\x20%s',_0x3ce19b,_0x511445);_0x455ea8(_0x511445);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 79d8176..4aaccd4 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 _0xb1ba=['emit','removeListener','length','remove','update'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xb1ba,0x152));var _0xab1b=function(_0x266795,_0x5629f5){_0x266795=_0x266795-0x0;var _0x2fc23f=_0xb1ba[_0x266795];return _0x2fc23f;};'use strict';var TeamEvents=require('./team.events');var events=['save',_0xab1b('0x0'),_0xab1b('0x1')];function createListener(_0x3ce25c,_0xe94f44){return function(_0x33d6a9){_0xe94f44[_0xab1b('0x2')](_0x3ce25c,_0x33d6a9);};}function removeListener(_0x4ff0e3,_0x5c31d6){return function(){TeamEvents[_0xab1b('0x3')](_0x4ff0e3,_0x5c31d6);};}exports['register']=function(_0x28d452){for(var _0x18b2e0=0x0,_0x406df2=events[_0xab1b('0x4')];_0x18b2e0<_0x406df2;_0x18b2e0++){var _0x2ec157=events[_0x18b2e0];var _0x35d207=createListener('team:'+_0x2ec157,_0x28d452);TeamEvents['on'](_0x2ec157,_0x35d207);}}; \ No newline at end of file +var _0x2116=['team:','save','update','removeListener','register','length'];(function(_0x37cfc7,_0x502052){var _0x5ee8c9=function(_0x4c909b){while(--_0x4c909b){_0x37cfc7['push'](_0x37cfc7['shift']());}};_0x5ee8c9(++_0x502052);}(_0x2116,0x67));var _0x6211=function(_0x4f75a2,_0x27c50c){_0x4f75a2=_0x4f75a2-0x0;var _0x14d1d1=_0x2116[_0x4f75a2];return _0x14d1d1;};'use strict';var TeamEvents=require('./team.events');var events=[_0x6211('0x0'),'remove',_0x6211('0x1')];function createListener(_0x434fbb,_0xa806a3){return function(_0xf2f23c){_0xa806a3['emit'](_0x434fbb,_0xf2f23c);};}function removeListener(_0x3d23d1,_0x2bf1b1){return function(){TeamEvents[_0x6211('0x2')](_0x3d23d1,_0x2bf1b1);};}exports[_0x6211('0x3')]=function(_0x5cac18){for(var _0x37d71a=0x0,_0x57f7e7=events[_0x6211('0x4')];_0x37d71a<_0x57f7e7;_0x37d71a++){var _0x320562=events[_0x37d71a];var _0x365e65=createListener(_0x6211('0x5')+_0x320562,_0x5cac18);TeamEvents['on'](_0x320562,_0x365e65);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index c56d5b2..0c3f3d5 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 _0xcab6=['sequelize','INTEGER'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0xcab6,0xd4));var _0x6cab=function(_0x57e941,_0xea9554){_0x57e941=_0x57e941-0x0;var _0x13cb87=_0xcab6[_0x57e941];return _0x13cb87;};'use strict';var Sequelize=require(_0x6cab('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x6cab('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x6cab('0x1')]}}; \ No newline at end of file +var _0xd382=['sequelize','exports','INTEGER'];(function(_0x3426c3,_0x473299){var _0x30657c=function(_0x4335c2){while(--_0x4335c2){_0x3426c3['push'](_0x3426c3['shift']());}};_0x30657c(++_0x473299);}(_0xd382,0x1b6));var _0x2d38=function(_0x32cc10,_0x23ae22){_0x32cc10=_0x32cc10-0x0;var _0x3f2c76=_0xd382[_0x32cc10];return _0x3f2c76;};'use strict';var Sequelize=require(_0x2d38('0x0'));module[_0x2d38('0x1')]={'TeamId':{'type':Sequelize[_0x2d38('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x2d38('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index a854913..a6f1269 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 _0x67da=['path','rimraf','../../config/environment','./teamVoicePrefix.attributes','TeamVoicePrefix','team_has_voice_prefixes','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x469a3c,_0x5ebc10){var _0x968f4=function(_0x22403b){while(--_0x22403b){_0x469a3c['push'](_0x469a3c['shift']());}};_0x968f4(++_0x5ebc10);}(_0x67da,0x192));var _0xa67d=function(_0x2fbed7,_0xf6e7df){_0x2fbed7=_0x2fbed7-0x0;var _0x94ffd6=_0x67da[_0x2fbed7];return _0x94ffd6;};'use strict';var _=require('lodash');var util=require(_0xa67d('0x0'));var logger=require(_0xa67d('0x1'))(_0xa67d('0x2'));var moment=require(_0xa67d('0x3'));var BPromise=require(_0xa67d('0x4'));var rp=require(_0xa67d('0x5'));var fs=require('fs');var path=require(_0xa67d('0x6'));var rimraf=require(_0xa67d('0x7'));var config=require(_0xa67d('0x8'));var attributes=require(_0xa67d('0x9'));module['exports']=function(_0x5b8ec7,_0x408786){return _0x5b8ec7['define'](_0xa67d('0xa'),attributes,{'tableName':_0xa67d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc15=['../../config/logger','api','moment','bluebird','request-promise','./teamVoicePrefix.attributes','define','TeamVoicePrefix','team_has_voice_prefixes','lodash'];(function(_0x14a862,_0x2b559d){var _0x245eb5=function(_0x6e014c){while(--_0x6e014c){_0x14a862['push'](_0x14a862['shift']());}};_0x245eb5(++_0x2b559d);}(_0xdc15,0x1f3));var _0x5dc1=function(_0x285800,_0x26765e){_0x285800=_0x285800-0x0;var _0x4b809e=_0xdc15[_0x285800];return _0x4b809e;};'use strict';var _=require(_0x5dc1('0x0'));var util=require('util');var logger=require(_0x5dc1('0x1'))(_0x5dc1('0x2'));var moment=require(_0x5dc1('0x3'));var BPromise=require(_0x5dc1('0x4'));var rp=require(_0x5dc1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5dc1('0x6'));module['exports']=function(_0x4b7fa9,_0x40d2b9){return _0x4b7fa9[_0x5dc1('0x7')](_0x5dc1('0x8'),attributes,{'tableName':_0x5dc1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 6fbceea..21043bd 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x412b87,_0x1c5931){var _0x887e22=function(_0x23cabf){while(--_0x23cabf){_0x412b87['push'](_0x412b87['shift']());}};_0x887e22(++_0x1c5931);}(_0x70e0,0x17b));var _0x070e=function(_0x112a0d,_0x3d7654){_0x112a0d=_0x112a0d-0x0;var _0x367c57=_0x70e0[_0x112a0d];return _0x367c57;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x5862ee,_0x164e51){var _0xabd5e1=function(_0x38b11d){while(--_0x38b11d){_0x5862ee['push'](_0x5862ee['shift']());}};_0xabd5e1(++_0x164e51);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xcb91[_0x51020b];return _0x371e47;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index f8d4ce4..c18678e 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 _0xefca=['INTEGER','exports'];(function(_0x38690b,_0x158905){var _0x1478e7=function(_0x58884d){while(--_0x58884d){_0x38690b['push'](_0x38690b['shift']());}};_0x1478e7(++_0x158905);}(_0xefca,0xe7));var _0xaefc=function(_0x695b76,_0x551526){_0x695b76=_0x695b76-0x0;var _0x1dc21f=_0xefca[_0x695b76];return _0x1dc21f;};'use strict';var Sequelize=require('sequelize');module[_0xaefc('0x0')]={'penalty':{'type':Sequelize[_0xaefc('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd78e=['INTEGER','sequelize','exports'];(function(_0x326e9c,_0x3852cc){var _0x2ffc2b=function(_0x2c0c10){while(--_0x2c0c10){_0x326e9c['push'](_0x326e9c['shift']());}};_0x2ffc2b(++_0x3852cc);}(_0xd78e,0xc1));var _0xed78=function(_0x333fc8,_0x2b292c){_0x333fc8=_0x333fc8-0x0;var _0x432439=_0xd78e[_0x333fc8];return _0x432439;};'use strict';var Sequelize=require(_0xed78('0x0'));module[_0xed78('0x1')]={'penalty':{'type':Sequelize[_0xed78('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index e01382d..31905ac 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 _0x26c2=['bluebird','request-promise','rimraf','../../config/environment','exports','define','TeamVoiceQueue','api','moment'];(function(_0x31659c,_0x4c1c13){var _0x415c58=function(_0x4e0578){while(--_0x4e0578){_0x31659c['push'](_0x31659c['shift']());}};_0x415c58(++_0x4c1c13);}(_0x26c2,0x130));var _0x226c=function(_0x215f8a,_0xf4090e){_0x215f8a=_0x215f8a-0x0;var _0x115b7f=_0x26c2[_0x215f8a];return _0x115b7f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x226c('0x0'));var moment=require(_0x226c('0x1'));var BPromise=require(_0x226c('0x2'));var rp=require(_0x226c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x226c('0x4'));var config=require(_0x226c('0x5'));var attributes=require('./teamVoiceQueue.attributes');module[_0x226c('0x6')]=function(_0xb40fbd,_0x21ed3a){return _0xb40fbd[_0x226c('0x7')](_0x226c('0x8'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc7e9=['lodash','util','api','moment','bluebird','path','rimraf','exports','define','TeamVoiceQueue','team_has_voice_queues'];(function(_0x487f51,_0x268f8f){var _0xaf1452=function(_0x228ab7){while(--_0x228ab7){_0x487f51['push'](_0x487f51['shift']());}};_0xaf1452(++_0x268f8f);}(_0xc7e9,0x1ef));var _0x9c7e=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xc7e9[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x9c7e('0x0'));var util=require(_0x9c7e('0x1'));var logger=require('../../config/logger')(_0x9c7e('0x2'));var moment=require(_0x9c7e('0x3'));var BPromise=require(_0x9c7e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c7e('0x5'));var rimraf=require(_0x9c7e('0x6'));var config=require('../../config/environment');var attributes=require('./teamVoiceQueue.attributes');module[_0x9c7e('0x7')]=function(_0x4e4ccc,_0x1e5135){return _0x4e4ccc[_0x9c7e('0x8')](_0x9c7e('0x9'),attributes,{'tableName':_0x9c7e('0xa'),'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 dc25afb..248508e 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 _0x7980=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x44d360,_0xe49b11){var _0x1c5cda=function(_0x2a9839){while(--_0x2a9839){_0x44d360['push'](_0x44d360['shift']());}};_0x1c5cda(++_0xe49b11);}(_0x7980,0xab));var _0x0798=function(_0xca8add,_0x48ea8f){_0xca8add=_0xca8add-0x0;var _0x3f8477=_0x7980[_0xca8add];return _0x3f8477;};'use strict';var _=require(_0x0798('0x0'));var util=require(_0x0798('0x1'));var moment=require(_0x0798('0x2'));var BPromise=require(_0x0798('0x3'));var rs=require(_0x0798('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0798('0x5'))['db'];var utils=require(_0x0798('0x6'));var logger=require(_0x0798('0x7'))(_0x0798('0x8'));var config=require(_0x0798('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0798('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e534f,_0x34f808,_0x467859){return new BPromise(function(_0x54da10,_0x5151b3){return client[_0x0798('0xb')](_0x1e534f,_0x467859)[_0x0798('0xc')](function(_0x301a55){logger[_0x0798('0xd')](_0x0798('0xe'),_0x34f808,_0x0798('0xf'));logger[_0x0798('0x10')](_0x0798('0x11'),_0x34f808,_0x0798('0xf'),JSON[_0x0798('0x12')](_0x301a55));if(_0x301a55['error']){if(_0x301a55[_0x0798('0x13')][_0x0798('0x14')]===0x1f4){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x34f808,_0x301a55[_0x0798('0x13')][_0x0798('0x15')]);return _0x5151b3(_0x301a55[_0x0798('0x13')][_0x0798('0x15')]);}logger[_0x0798('0x13')](_0x0798('0xe'),_0x34f808,_0x301a55[_0x0798('0x13')]['message']);return _0x54da10(_0x301a55['error'][_0x0798('0x15')]);}else{logger[_0x0798('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x34f808,'request\x20sent');_0x54da10(_0x301a55[_0x0798('0x16')][_0x0798('0x15')]);}})[_0x0798('0x17')](function(_0x5dc617){logger['error'](_0x0798('0xe'),_0x34f808,_0x5dc617);_0x5151b3(_0x5dc617);});});} \ No newline at end of file +var _0x9a19=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x232ec0,_0x45fdd0){var _0x356705=function(_0x4099ea){while(--_0x4099ea){_0x232ec0['push'](_0x232ec0['shift']());}};_0x356705(++_0x45fdd0);}(_0x9a19,0x114));var _0x99a1=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x9a19[_0xbf8ebe];return _0x1e25e8;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var moment=require(_0x99a1('0x2'));var BPromise=require('bluebird');var rs=require(_0x99a1('0x3'));var fs=require('fs');var Redis=require(_0x99a1('0x4'));var db=require(_0x99a1('0x5'))['db'];var utils=require(_0x99a1('0x6'));var logger=require(_0x99a1('0x7'))(_0x99a1('0x8'));var config=require(_0x99a1('0x9'));var jayson=require(_0x99a1('0xa'));var client=jayson[_0x99a1('0xb')][_0x99a1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x65045d,_0x523b9e,_0x4d2a5c){return new BPromise(function(_0x5aa6c2,_0x56f50){return client[_0x99a1('0xd')](_0x65045d,_0x4d2a5c)['then'](function(_0x5874fc){logger[_0x99a1('0xe')](_0x99a1('0xf'),_0x523b9e,_0x99a1('0x10'));logger[_0x99a1('0x11')](_0x99a1('0x12'),_0x523b9e,'request\x20sent',JSON[_0x99a1('0x13')](_0x5874fc));if(_0x5874fc[_0x99a1('0x14')]){if(_0x5874fc[_0x99a1('0x14')][_0x99a1('0x15')]===0x1f4){logger[_0x99a1('0x14')](_0x99a1('0xf'),_0x523b9e,_0x5874fc[_0x99a1('0x14')][_0x99a1('0x16')]);return _0x56f50(_0x5874fc[_0x99a1('0x14')][_0x99a1('0x16')]);}logger[_0x99a1('0x14')](_0x99a1('0xf'),_0x523b9e,_0x5874fc[_0x99a1('0x14')][_0x99a1('0x16')]);return _0x5aa6c2(_0x5874fc[_0x99a1('0x14')]['message']);}else{logger[_0x99a1('0xe')](_0x99a1('0xf'),_0x523b9e,_0x99a1('0x10'));_0x5aa6c2(_0x5874fc[_0x99a1('0x17')][_0x99a1('0x16')]);}})[_0x99a1('0x18')](function(_0x1ca878){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x523b9e,_0x1ca878);_0x56f50(_0x1ca878);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index cde77ab..b1454c0 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 _0x323f=['../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x164ddf,_0x2d3858){var _0x56260a=function(_0x2ca5e2){while(--_0x2ca5e2){_0x164ddf['push'](_0x164ddf['shift']());}};_0x56260a(++_0x2d3858);}(_0x323f,0x1ee));var _0xf323=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x323f[_0x484e36];return _0xafc85d;};'use strict';var multer=require('multer');var util=require(_0xf323('0x0'));var path=require('path');var timeout=require(_0xf323('0x1'));var express=require(_0xf323('0x2'));var router=express[_0xf323('0x3')]();var fs_extra=require(_0xf323('0x4'));var auth=require(_0xf323('0x5'));var interaction=require(_0xf323('0x6'));var config=require(_0xf323('0x7'));var controller=require(_0xf323('0x8'));router[_0xf323('0x9')]('/',auth[_0xf323('0xa')](),controller['index']);router[_0xf323('0x9')](_0xf323('0xb'),auth[_0xf323('0xa')](),controller[_0xf323('0xc')]);router[_0xf323('0xd')]('/',auth[_0xf323('0xa')](),controller[_0xf323('0xe')]);router[_0xf323('0xf')](_0xf323('0xb'),auth[_0xf323('0xa')](),controller[_0xf323('0x10')]);router[_0xf323('0x11')](_0xf323('0xb'),auth[_0xf323('0xa')](),controller[_0xf323('0x12')]);module[_0xf323('0x13')]=router; \ No newline at end of file +var _0xab00=['./template.controller','get','isAuthenticated','index','/:id','show','post','create','destroy','multer','util','path','express','Router','fs-extra','../../components/interaction/service'];(function(_0x5cf32a,_0xf32d46){var _0x500b19=function(_0x3f7cdd){while(--_0x3f7cdd){_0x5cf32a['push'](_0x5cf32a['shift']());}};_0x500b19(++_0xf32d46);}(_0xab00,0x1b9));var _0x0ab0=function(_0x3c6e8c,_0x3bd9e8){_0x3c6e8c=_0x3c6e8c-0x0;var _0x3b2d6b=_0xab00[_0x3c6e8c];return _0x3b2d6b;};'use strict';var multer=require(_0x0ab0('0x0'));var util=require(_0x0ab0('0x1'));var path=require(_0x0ab0('0x2'));var timeout=require('connect-timeout');var express=require(_0x0ab0('0x3'));var router=express[_0x0ab0('0x4')]();var fs_extra=require(_0x0ab0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0ab0('0x6'));var config=require('../../config/environment');var controller=require(_0x0ab0('0x7'));router[_0x0ab0('0x8')]('/',auth[_0x0ab0('0x9')](),controller[_0x0ab0('0xa')]);router[_0x0ab0('0x8')](_0x0ab0('0xb'),auth['isAuthenticated'](),controller[_0x0ab0('0xc')]);router[_0x0ab0('0xd')]('/',auth['isAuthenticated'](),controller[_0x0ab0('0xe')]);router['put'](_0x0ab0('0xb'),auth[_0x0ab0('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0ab0('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 7bc65a4..97bd81b 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 _0x94bc=['sequelize','exports','STRING'];(function(_0x2a2ed0,_0xa1e1f5){var _0xc86fb0=function(_0x5e0725){while(--_0x5e0725){_0x2a2ed0['push'](_0x2a2ed0['shift']());}};_0xc86fb0(++_0xa1e1f5);}(_0x94bc,0x17d));var _0xc94b=function(_0x5100bc,_0x35e471){_0x5100bc=_0x5100bc-0x0;var _0x1d6ec6=_0x94bc[_0x5100bc];return _0x1d6ec6;};'use strict';var Sequelize=require(_0xc94b('0x0'));module[_0xc94b('0x1')]={'name':{'type':Sequelize[_0xc94b('0x2')]},'description':{'type':Sequelize[_0xc94b('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xe9a4=['TEXT','sequelize','STRING'];(function(_0x4d500d,_0x54288f){var _0x5a8c5a=function(_0x33c599){while(--_0x33c599){_0x4d500d['push'](_0x4d500d['shift']());}};_0x5a8c5a(++_0x54288f);}(_0xe9a4,0x97));var _0x4e9a=function(_0x3dc55d,_0xd07e93){_0x3dc55d=_0x3dc55d-0x0;var _0x3aa7f3=_0xe9a4[_0x3dc55d];return _0x3aa7f3;};'use strict';var Sequelize=require(_0x4e9a('0x0'));module['exports']={'name':{'type':Sequelize[_0x4e9a('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x4e9a('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index f6b5988..a35d2f3 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 _0x2792=['model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','catch','show','params','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','reject','save','then','destroy','get','Templates','UserProfileResource','error','stack','name','send','index','Template','fieldName','type','key'];(function(_0x463734,_0x3b347e){var _0x1efc12=function(_0x32f3ab){while(--_0x32f3ab){_0x463734['push'](_0x463734['shift']());}};_0x1efc12(++_0x3b347e);}(_0x2792,0x72));var _0x2279=function(_0xf244e0,_0x20556c){_0xf244e0=_0xf244e0-0x0;var _0xe94095=_0x2792[_0xf244e0];return _0xe94095;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2279('0x0'));var zipdir=require(_0x2279('0x1'));var jsonpatch=require(_0x2279('0x2'));var rp=require(_0x2279('0x3'));var moment=require(_0x2279('0x4'));var BPromise=require(_0x2279('0x5'));var Mustache=require(_0x2279('0x6'));var util=require(_0x2279('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x2279('0x8'));var ejs=require(_0x2279('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2279('0xa'));var squel=require(_0x2279('0xb'));var crypto=require(_0x2279('0xc'));var jsforce=require(_0x2279('0xd'));var deskjs=require(_0x2279('0xe'));var toCsv=require(_0x2279('0x8'));var querystring=require(_0x2279('0xf'));var Papa=require(_0x2279('0x10'));var Redis=require(_0x2279('0x11'));var authService=require(_0x2279('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2279('0x13'));var hardwareService=require(_0x2279('0x14'));var logger=require('../../config/logger')(_0x2279('0x15'));var utils=require(_0x2279('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2279('0x17'));var db=require(_0x2279('0x18'))['db'];function respondWithStatusCode(_0x35f402,_0x4a23ed){_0x4a23ed=_0x4a23ed||0xcc;return function(_0x510598){if(_0x510598){return _0x35f402[_0x2279('0x19')](_0x4a23ed);}return _0x35f402['status'](_0x4a23ed)[_0x2279('0x1a')]();};}function respondWithResult(_0x50398c,_0x3c4476){_0x3c4476=_0x3c4476||0xc8;return function(_0x28317b){if(_0x28317b){return _0x50398c[_0x2279('0x1b')](_0x3c4476)[_0x2279('0x1c')](_0x28317b);}};}function respondWithFilteredResult(_0x29a7b4,_0x49e182){return function(_0x20649c){if(_0x20649c){var _0x4306e8=typeof _0x49e182['offset']===_0x2279('0x1d')&&typeof _0x49e182[_0x2279('0x1e')]==='undefined';var _0x5c2a2d=_0x20649c[_0x2279('0x1f')];var _0x27ea8c=_0x4306e8?0x0:_0x49e182[_0x2279('0x20')];var _0x32a0dc=_0x4306e8?_0x20649c[_0x2279('0x1f')]:_0x49e182[_0x2279('0x20')]+_0x49e182[_0x2279('0x1e')];var _0x4b6b1;if(_0x32a0dc>=_0x5c2a2d){_0x32a0dc=_0x5c2a2d;_0x4b6b1=0xc8;}else{_0x4b6b1=0xce;}_0x29a7b4[_0x2279('0x1b')](_0x4b6b1);return _0x29a7b4[_0x2279('0x21')]('Content-Range',_0x27ea8c+'-'+_0x32a0dc+'/'+_0x5c2a2d)[_0x2279('0x1c')](_0x20649c);}return null;};}function patchUpdates(_0x3ef6f7){return function(_0x38c1be){try{jsonpatch['apply'](_0x38c1be,_0x3ef6f7,!![]);}catch(_0x10c1a4){return BPromise[_0x2279('0x22')](_0x10c1a4);}return _0x38c1be[_0x2279('0x23')]();};}function saveUpdates(_0x1c9124,_0x3e4dd9){return function(_0x37e7fb){if(_0x37e7fb){return _0x37e7fb['update'](_0x1c9124)[_0x2279('0x24')](function(_0x2b5c40){return _0x2b5c40;});}return null;};}function removeEntity(_0x551304,_0x61d1a2){return function(_0x5c2557){if(_0x5c2557){return _0x5c2557[_0x2279('0x25')]()[_0x2279('0x24')](function(){var _0x41b059=_0x5c2557[_0x2279('0x26')]({'plain':!![]});var _0x3c445b=_0x2279('0x27');return db[_0x2279('0x28')][_0x2279('0x25')]({'where':{'type':_0x3c445b,'resourceId':_0x41b059['id']}})[_0x2279('0x24')](function(){return _0x5c2557;});})[_0x2279('0x24')](function(){_0x551304['status'](0xcc)[_0x2279('0x1a')]();});}};}function handleEntityNotFound(_0x3a0ff2,_0x18df5f){return function(_0x54a5da){if(!_0x54a5da){_0x3a0ff2['sendStatus'](0x194);}return _0x54a5da;};}function handleError(_0x5aacae,_0x1cdf3b){_0x1cdf3b=_0x1cdf3b||0x1f4;return function(_0x20bb8c){logger[_0x2279('0x29')](_0x20bb8c[_0x2279('0x2a')]);if(_0x20bb8c[_0x2279('0x2b')]){delete _0x20bb8c['name'];}_0x5aacae[_0x2279('0x1b')](_0x1cdf3b)[_0x2279('0x2c')](_0x20bb8c);};}exports[_0x2279('0x2d')]=function(_0x471340,_0x15b4f9){var _0x682efc={},_0x1db19b={},_0x53d2e9={'count':0x0,'rows':[]};var _0x27ff5d=_['map'](db[_0x2279('0x2e')]['rawAttributes'],function(_0x3ec1b4){return{'name':_0x3ec1b4[_0x2279('0x2f')],'type':_0x3ec1b4[_0x2279('0x30')][_0x2279('0x31')]};});_0x1db19b[_0x2279('0x32')]=_[_0x2279('0x33')](_0x27ff5d,'name');_0x1db19b['query']=_[_0x2279('0x34')](_0x471340[_0x2279('0x35')]);_0x1db19b[_0x2279('0x36')]=_[_0x2279('0x37')](_0x1db19b[_0x2279('0x32')],_0x1db19b['query']);_0x682efc[_0x2279('0x38')]=_[_0x2279('0x37')](_0x1db19b['model'],qs[_0x2279('0x39')](_0x471340['query'][_0x2279('0x39')]));_0x682efc[_0x2279('0x38')]=_0x682efc[_0x2279('0x38')]['length']?_0x682efc['attributes']:_0x1db19b[_0x2279('0x32')];if(!_0x471340[_0x2279('0x35')][_0x2279('0x3a')]('nolimit')){_0x682efc[_0x2279('0x1e')]=qs[_0x2279('0x1e')](_0x471340['query'][_0x2279('0x1e')]);_0x682efc[_0x2279('0x20')]=qs[_0x2279('0x20')](_0x471340[_0x2279('0x35')]['offset']);}_0x682efc[_0x2279('0x3b')]=qs[_0x2279('0x3c')](_0x471340['query'][_0x2279('0x3c')]);_0x682efc[_0x2279('0x3d')]=qs['filters'](_[_0x2279('0x3e')](_0x471340[_0x2279('0x35')],_0x1db19b['filters']),_0x27ff5d);if(_0x471340[_0x2279('0x35')]['filter']){_0x682efc[_0x2279('0x3d')]=_[_0x2279('0x3f')](_0x682efc[_0x2279('0x3d')],{'$or':_[_0x2279('0x33')](_0x27ff5d,function(_0xc7e878){if(_0xc7e878[_0x2279('0x30')]!==_0x2279('0x40')){var _0xe4d90c={};_0xe4d90c[_0xc7e878[_0x2279('0x2b')]]={'$like':'%'+_0x471340[_0x2279('0x35')][_0x2279('0x41')]+'%'};return _0xe4d90c;}})});}_0x682efc=_['merge']({},_0x682efc,_0x471340[_0x2279('0x42')]);var _0x1ed036={'where':_0x682efc[_0x2279('0x3d')]};return db[_0x2279('0x2e')][_0x2279('0x1f')](_0x1ed036)[_0x2279('0x24')](function(_0x18e4d3){_0x53d2e9[_0x2279('0x1f')]=_0x18e4d3;if(_0x471340[_0x2279('0x35')]['includeAll']){_0x682efc[_0x2279('0x43')]=[{'all':!![]}];}return db[_0x2279('0x2e')][_0x2279('0x44')](_0x682efc);})['then'](function(_0x4d0981){_0x53d2e9['rows']=_0x4d0981;return _0x53d2e9;})[_0x2279('0x24')](respondWithFilteredResult(_0x15b4f9,_0x682efc))[_0x2279('0x45')](handleError(_0x15b4f9,null));};exports[_0x2279('0x46')]=function(_0x20bcc9,_0xe01fa2){var _0x1fbd55={'raw':!![],'where':{'id':_0x20bcc9[_0x2279('0x47')]['id']}},_0x1ced45={};_0x1ced45[_0x2279('0x32')]=_[_0x2279('0x34')](db[_0x2279('0x2e')]['rawAttributes']);_0x1ced45[_0x2279('0x35')]=_['keys'](_0x20bcc9['query']);_0x1ced45[_0x2279('0x36')]=_[_0x2279('0x37')](_0x1ced45[_0x2279('0x32')],_0x1ced45[_0x2279('0x35')]);_0x1fbd55[_0x2279('0x38')]=_[_0x2279('0x37')](_0x1ced45[_0x2279('0x32')],qs[_0x2279('0x39')](_0x20bcc9[_0x2279('0x35')][_0x2279('0x39')]));_0x1fbd55[_0x2279('0x38')]=_0x1fbd55[_0x2279('0x38')][_0x2279('0x48')]?_0x1fbd55[_0x2279('0x38')]:_0x1ced45['model'];if(_0x20bcc9[_0x2279('0x35')][_0x2279('0x49')]){_0x1fbd55[_0x2279('0x43')]=[{'all':!![]}];}_0x1fbd55=_[_0x2279('0x3f')]({},_0x1fbd55,_0x20bcc9[_0x2279('0x42')]);return db['Template'][_0x2279('0x4a')](_0x1fbd55)[_0x2279('0x24')](handleEntityNotFound(_0xe01fa2,null))[_0x2279('0x24')](respondWithResult(_0xe01fa2,null))['catch'](handleError(_0xe01fa2,null));};exports[_0x2279('0x4b')]=function(_0x21ab96,_0x27e45b){return db[_0x2279('0x2e')]['create'](_0x21ab96[_0x2279('0x4c')],{})['then'](function(_0x90f371){var _0x140a7a=_0x21ab96[_0x2279('0x4d')][_0x2279('0x26')]({'plain':!![]});if(!_0x140a7a)throw new Error(_0x2279('0x4e'));if(_0x140a7a[_0x2279('0x4f')]==='user'){var _0x336d47=_0x90f371[_0x2279('0x26')]({'plain':!![]});var _0x36648d=_0x2279('0x27');return db[_0x2279('0x50')][_0x2279('0x4a')]({'where':{'name':_0x36648d,'userProfileId':_0x140a7a['userProfileId']},'raw':!![]})[_0x2279('0x24')](function(_0x43fcfc){if(_0x43fcfc&&_0x43fcfc['autoAssociation']===0x0){return db[_0x2279('0x28')]['create']({'name':_0x336d47['name'],'resourceId':_0x336d47['id'],'type':_0x43fcfc[_0x2279('0x2b')],'sectionId':_0x43fcfc['id']},{})['then'](function(){return _0x90f371;});}else{return _0x90f371;}})[_0x2279('0x45')](function(_0xa6c07f){logger[_0x2279('0x29')](_0x2279('0x51'),_0xa6c07f);throw _0xa6c07f;});}return _0x90f371;})[_0x2279('0x24')](respondWithResult(_0x27e45b,0xc9))[_0x2279('0x45')](handleError(_0x27e45b,null));};exports['update']=function(_0x2a0776,_0x35e0e8){if(_0x2a0776['body']['id']){delete _0x2a0776[_0x2279('0x4c')]['id'];}return db['Template'][_0x2279('0x4a')]({'where':{'id':_0x2a0776[_0x2279('0x47')]['id']}})[_0x2279('0x24')](handleEntityNotFound(_0x35e0e8,null))['then'](saveUpdates(_0x2a0776[_0x2279('0x4c')],null))[_0x2279('0x24')](respondWithResult(_0x35e0e8,null))[_0x2279('0x45')](handleError(_0x35e0e8,null));};exports[_0x2279('0x25')]=function(_0xdcddff,_0x3db8f7){return db[_0x2279('0x2e')][_0x2279('0x4a')]({'where':{'id':_0xdcddff['params']['id']}})[_0x2279('0x24')](handleEntityNotFound(_0x3db8f7,null))[_0x2279('0x24')](removeEntity(_0x3db8f7,null))[_0x2279('0x45')](handleError(_0x3db8f7,null));}; \ No newline at end of file +var _0x9f38=['VIRTUAL','options','includeAll','include','rows','catch','show','length','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','eml-format','rimraf','zip-dir','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','get','Templates','destroy','error','stack','name','index','map','Template','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge'];(function(_0x51e5ef,_0x5df7cf){var _0x5b1719=function(_0x79d49c){while(--_0x79d49c){_0x51e5ef['push'](_0x51e5ef['shift']());}};_0x5b1719(++_0x5df7cf);}(_0x9f38,0x10c));var _0x89f3=function(_0x323ab4,_0x9e0c27){_0x323ab4=_0x323ab4-0x0;var _0x1ee984=_0x9f38[_0x323ab4];return _0x1ee984;};'use strict';var emlformat=require(_0x89f3('0x0'));var rimraf=require(_0x89f3('0x1'));var zipdir=require(_0x89f3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x89f3('0x3'));var util=require('util');var path=require('path');var sox=require(_0x89f3('0x4'));var csv=require(_0x89f3('0x5'));var ejs=require(_0x89f3('0x6'));var fs=require('fs');var fs_extra=require(_0x89f3('0x7'));var _=require(_0x89f3('0x8'));var squel=require('squel');var crypto=require(_0x89f3('0x9'));var jsforce=require(_0x89f3('0xa'));var deskjs=require(_0x89f3('0xb'));var toCsv=require(_0x89f3('0x5'));var querystring=require(_0x89f3('0xc'));var Papa=require(_0x89f3('0xd'));var Redis=require(_0x89f3('0xe'));var authService=require(_0x89f3('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x89f3('0x10'));var logger=require(_0x89f3('0x11'))('api');var utils=require(_0x89f3('0x12'));var config=require(_0x89f3('0x13'));var licenseUtil=require(_0x89f3('0x14'));var db=require(_0x89f3('0x15'))['db'];function respondWithStatusCode(_0x3ef051,_0x14b9f5){_0x14b9f5=_0x14b9f5||0xcc;return function(_0x21e89e){if(_0x21e89e){return _0x3ef051[_0x89f3('0x16')](_0x14b9f5);}return _0x3ef051[_0x89f3('0x17')](_0x14b9f5)[_0x89f3('0x18')]();};}function respondWithResult(_0x26d51b,_0x5a905b){_0x5a905b=_0x5a905b||0xc8;return function(_0xfcf45f){if(_0xfcf45f){return _0x26d51b[_0x89f3('0x17')](_0x5a905b)[_0x89f3('0x19')](_0xfcf45f);}};}function respondWithFilteredResult(_0xdb0490,_0xfb0a22){return function(_0x2e5d77){if(_0x2e5d77){var _0x23799a=typeof _0xfb0a22[_0x89f3('0x1a')]==='undefined'&&typeof _0xfb0a22['limit']===_0x89f3('0x1b');var _0x4385a6=_0x2e5d77[_0x89f3('0x1c')];var _0x3abb64=_0x23799a?0x0:_0xfb0a22[_0x89f3('0x1a')];var _0x402685=_0x23799a?_0x2e5d77[_0x89f3('0x1c')]:_0xfb0a22[_0x89f3('0x1a')]+_0xfb0a22[_0x89f3('0x1d')];var _0x1d9d89;if(_0x402685>=_0x4385a6){_0x402685=_0x4385a6;_0x1d9d89=0xc8;}else{_0x1d9d89=0xce;}_0xdb0490[_0x89f3('0x17')](_0x1d9d89);return _0xdb0490[_0x89f3('0x1e')](_0x89f3('0x1f'),_0x3abb64+'-'+_0x402685+'/'+_0x4385a6)[_0x89f3('0x19')](_0x2e5d77);}return null;};}function patchUpdates(_0x547ff5){return function(_0x258e58){try{jsonpatch[_0x89f3('0x20')](_0x258e58,_0x547ff5,!![]);}catch(_0x48c0d8){return BPromise[_0x89f3('0x21')](_0x48c0d8);}return _0x258e58[_0x89f3('0x22')]();};}function saveUpdates(_0x28a1d9,_0x1a8ea2){return function(_0x26507f){if(_0x26507f){return _0x26507f[_0x89f3('0x23')](_0x28a1d9)['then'](function(_0x12fd26){return _0x12fd26;});}return null;};}function removeEntity(_0x234232,_0x396e47){return function(_0x74ccb1){if(_0x74ccb1){return _0x74ccb1['destroy']()[_0x89f3('0x24')](function(){var _0x1b3e88=_0x74ccb1[_0x89f3('0x25')]({'plain':!![]});var _0x118235=_0x89f3('0x26');return db['UserProfileResource'][_0x89f3('0x27')]({'where':{'type':_0x118235,'resourceId':_0x1b3e88['id']}})[_0x89f3('0x24')](function(){return _0x74ccb1;});})[_0x89f3('0x24')](function(){_0x234232[_0x89f3('0x17')](0xcc)[_0x89f3('0x18')]();});}};}function handleEntityNotFound(_0x48725b,_0x5806c5){return function(_0xcc4899){if(!_0xcc4899){_0x48725b[_0x89f3('0x16')](0x194);}return _0xcc4899;};}function handleError(_0x30e1e9,_0x22445a){_0x22445a=_0x22445a||0x1f4;return function(_0x3dcb44){logger[_0x89f3('0x28')](_0x3dcb44[_0x89f3('0x29')]);if(_0x3dcb44[_0x89f3('0x2a')]){delete _0x3dcb44[_0x89f3('0x2a')];}_0x30e1e9['status'](_0x22445a)['send'](_0x3dcb44);};}exports[_0x89f3('0x2b')]=function(_0x51f3de,_0x49477f){var _0x1b276a={},_0x4bea2b={},_0x1f7688={'count':0x0,'rows':[]};var _0x21463c=_[_0x89f3('0x2c')](db[_0x89f3('0x2d')][_0x89f3('0x2e')],function(_0x288c07){return{'name':_0x288c07[_0x89f3('0x2f')],'type':_0x288c07[_0x89f3('0x30')][_0x89f3('0x31')]};});_0x4bea2b[_0x89f3('0x32')]=_[_0x89f3('0x2c')](_0x21463c,_0x89f3('0x2a'));_0x4bea2b['query']=_[_0x89f3('0x33')](_0x51f3de[_0x89f3('0x34')]);_0x4bea2b[_0x89f3('0x35')]=_[_0x89f3('0x36')](_0x4bea2b[_0x89f3('0x32')],_0x4bea2b[_0x89f3('0x34')]);_0x1b276a[_0x89f3('0x37')]=_['intersection'](_0x4bea2b[_0x89f3('0x32')],qs[_0x89f3('0x38')](_0x51f3de[_0x89f3('0x34')][_0x89f3('0x38')]));_0x1b276a[_0x89f3('0x37')]=_0x1b276a[_0x89f3('0x37')]['length']?_0x1b276a['attributes']:_0x4bea2b[_0x89f3('0x32')];if(!_0x51f3de[_0x89f3('0x34')][_0x89f3('0x39')](_0x89f3('0x3a'))){_0x1b276a[_0x89f3('0x1d')]=qs[_0x89f3('0x1d')](_0x51f3de['query'][_0x89f3('0x1d')]);_0x1b276a['offset']=qs[_0x89f3('0x1a')](_0x51f3de['query'][_0x89f3('0x1a')]);}_0x1b276a[_0x89f3('0x3b')]=qs[_0x89f3('0x3c')](_0x51f3de[_0x89f3('0x34')][_0x89f3('0x3c')]);_0x1b276a[_0x89f3('0x3d')]=qs[_0x89f3('0x35')](_['pick'](_0x51f3de['query'],_0x4bea2b['filters']),_0x21463c);if(_0x51f3de[_0x89f3('0x34')][_0x89f3('0x3e')]){_0x1b276a[_0x89f3('0x3d')]=_[_0x89f3('0x3f')](_0x1b276a[_0x89f3('0x3d')],{'$or':_['map'](_0x21463c,function(_0x449605){if(_0x449605[_0x89f3('0x30')]!==_0x89f3('0x40')){var _0xb378e9={};_0xb378e9[_0x449605[_0x89f3('0x2a')]]={'$like':'%'+_0x51f3de[_0x89f3('0x34')][_0x89f3('0x3e')]+'%'};return _0xb378e9;}})});}_0x1b276a=_[_0x89f3('0x3f')]({},_0x1b276a,_0x51f3de[_0x89f3('0x41')]);var _0x422cee={'where':_0x1b276a['where']};return db[_0x89f3('0x2d')][_0x89f3('0x1c')](_0x422cee)[_0x89f3('0x24')](function(_0x171c00){_0x1f7688['count']=_0x171c00;if(_0x51f3de[_0x89f3('0x34')][_0x89f3('0x42')]){_0x1b276a[_0x89f3('0x43')]=[{'all':!![]}];}return db['Template']['findAll'](_0x1b276a);})[_0x89f3('0x24')](function(_0x42f6c7){_0x1f7688[_0x89f3('0x44')]=_0x42f6c7;return _0x1f7688;})[_0x89f3('0x24')](respondWithFilteredResult(_0x49477f,_0x1b276a))[_0x89f3('0x45')](handleError(_0x49477f,null));};exports[_0x89f3('0x46')]=function(_0x381768,_0x140775){var _0x48f00b={'raw':!![],'where':{'id':_0x381768['params']['id']}},_0x448046={};_0x448046['model']=_[_0x89f3('0x33')](db[_0x89f3('0x2d')][_0x89f3('0x2e')]);_0x448046[_0x89f3('0x34')]=_[_0x89f3('0x33')](_0x381768['query']);_0x448046['filters']=_[_0x89f3('0x36')](_0x448046[_0x89f3('0x32')],_0x448046[_0x89f3('0x34')]);_0x48f00b['attributes']=_[_0x89f3('0x36')](_0x448046[_0x89f3('0x32')],qs['fields'](_0x381768[_0x89f3('0x34')]['fields']));_0x48f00b['attributes']=_0x48f00b[_0x89f3('0x37')][_0x89f3('0x47')]?_0x48f00b[_0x89f3('0x37')]:_0x448046['model'];if(_0x381768['query'][_0x89f3('0x42')]){_0x48f00b[_0x89f3('0x43')]=[{'all':!![]}];}_0x48f00b=_[_0x89f3('0x3f')]({},_0x48f00b,_0x381768[_0x89f3('0x41')]);return db['Template'][_0x89f3('0x48')](_0x48f00b)['then'](handleEntityNotFound(_0x140775,null))[_0x89f3('0x24')](respondWithResult(_0x140775,null))[_0x89f3('0x45')](handleError(_0x140775,null));};exports[_0x89f3('0x49')]=function(_0x3bc20c,_0x4b1bb1){return db['Template'][_0x89f3('0x49')](_0x3bc20c[_0x89f3('0x4a')],{})['then'](function(_0x355d08){var _0x2b7c6d=_0x3bc20c[_0x89f3('0x4b')][_0x89f3('0x25')]({'plain':!![]});if(!_0x2b7c6d)throw new Error(_0x89f3('0x4c'));if(_0x2b7c6d[_0x89f3('0x4d')]==='user'){var _0x7c82ed=_0x355d08[_0x89f3('0x25')]({'plain':!![]});var _0x3c4c65=_0x89f3('0x26');return db[_0x89f3('0x4e')]['find']({'where':{'name':_0x3c4c65,'userProfileId':_0x2b7c6d[_0x89f3('0x4f')]},'raw':!![]})['then'](function(_0x117332){if(_0x117332&&_0x117332[_0x89f3('0x50')]===0x0){return db['UserProfileResource'][_0x89f3('0x49')]({'name':_0x7c82ed[_0x89f3('0x2a')],'resourceId':_0x7c82ed['id'],'type':_0x117332[_0x89f3('0x2a')],'sectionId':_0x117332['id']},{})[_0x89f3('0x24')](function(){return _0x355d08;});}else{return _0x355d08;}})[_0x89f3('0x45')](function(_0x4b4bbd){logger[_0x89f3('0x28')](_0x89f3('0x51'),_0x4b4bbd);throw _0x4b4bbd;});}return _0x355d08;})['then'](respondWithResult(_0x4b1bb1,0xc9))[_0x89f3('0x45')](handleError(_0x4b1bb1,null));};exports[_0x89f3('0x23')]=function(_0x19e51a,_0x3c91f0){if(_0x19e51a['body']['id']){delete _0x19e51a[_0x89f3('0x4a')]['id'];}return db[_0x89f3('0x2d')][_0x89f3('0x48')]({'where':{'id':_0x19e51a[_0x89f3('0x52')]['id']}})[_0x89f3('0x24')](handleEntityNotFound(_0x3c91f0,null))[_0x89f3('0x24')](saveUpdates(_0x19e51a[_0x89f3('0x4a')],null))['then'](respondWithResult(_0x3c91f0,null))[_0x89f3('0x45')](handleError(_0x3c91f0,null));};exports['destroy']=function(_0x3ea9c8,_0x2cef93){return db[_0x89f3('0x2d')][_0x89f3('0x48')]({'where':{'id':_0x3ea9c8[_0x89f3('0x52')]['id']}})[_0x89f3('0x24')](handleEntityNotFound(_0x2cef93,null))['then'](removeEntity(_0x2cef93,null))['catch'](handleError(_0x2cef93,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index a19d9c6..35bc2fe 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 _0x3761=['./template.attributes','exports','define','Template','tools_templates','lodash','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x152fe3,_0x12b0c8){var _0xc5bb39=function(_0x1fde42){while(--_0x1fde42){_0x152fe3['push'](_0x152fe3['shift']());}};_0xc5bb39(++_0x12b0c8);}(_0x3761,0x1e5));var _0x1376=function(_0xd6c8f2,_0x26c786){_0xd6c8f2=_0xd6c8f2-0x0;var _0x36348a=_0x3761[_0xd6c8f2];return _0x36348a;};'use strict';var _=require(_0x1376('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1376('0x1'));var moment=require(_0x1376('0x2'));var BPromise=require(_0x1376('0x3'));var rp=require(_0x1376('0x4'));var fs=require('fs');var path=require(_0x1376('0x5'));var rimraf=require('rimraf');var config=require(_0x1376('0x6'));var attributes=require(_0x1376('0x7'));module[_0x1376('0x8')]=function(_0x3d05c8,_0x3478fd){return _0x3d05c8[_0x1376('0x9')](_0x1376('0xa'),attributes,{'tableName':_0x1376('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8977=['path','rimraf','exports','define','Template','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xb8ff9a,_0x3e83c6){var _0x5b2e4e=function(_0x1042e4){while(--_0x1042e4){_0xb8ff9a['push'](_0xb8ff9a['shift']());}};_0x5b2e4e(++_0x3e83c6);}(_0x8977,0x1d3));var _0x7897=function(_0x3607ef,_0x3eb200){_0x3607ef=_0x3607ef-0x0;var _0x4565dc=_0x8977[_0x3607ef];return _0x4565dc;};'use strict';var _=require('lodash');var util=require(_0x7897('0x0'));var logger=require(_0x7897('0x1'))(_0x7897('0x2'));var moment=require(_0x7897('0x3'));var BPromise=require(_0x7897('0x4'));var rp=require(_0x7897('0x5'));var fs=require('fs');var path=require(_0x7897('0x6'));var rimraf=require(_0x7897('0x7'));var config=require('../../config/environment');var attributes=require('./template.attributes');module[_0x7897('0x8')]=function(_0x3ca16a,_0x5b831c){return _0x3ca16a[_0x7897('0x9')](_0x7897('0xa'),attributes,{'tableName':'tools_templates','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 05d98c0..5fbe8da 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 _0x0b55=['attributes','model','GetTemplate','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','findAll','options','where','limit','include','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0b55,0x1d4));var _0x50b5=function(_0x3e7084,_0x870be6){_0x3e7084=_0x3e7084-0x0;var _0x1a9eed=_0x0b55[_0x3e7084];return _0x1a9eed;};'use strict';var _=require(_0x50b5('0x0'));var util=require('util');var moment=require(_0x50b5('0x1'));var BPromise=require(_0x50b5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x50b5('0x3'));var db=require(_0x50b5('0x4'))['db'];var utils=require(_0x50b5('0x5'));var logger=require(_0x50b5('0x6'))(_0x50b5('0x7'));var config=require(_0x50b5('0x8'));var jayson=require(_0x50b5('0x9'));var client=jayson['client'][_0x50b5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x65386,_0xfcbd3d,_0x1592f7){return new BPromise(function(_0x15528a,_0x93dda3){return client[_0x50b5('0xb')](_0x65386,_0x1592f7)[_0x50b5('0xc')](function(_0x19cb90){logger['info'](_0x50b5('0xd'),_0xfcbd3d,_0x50b5('0xe'));logger[_0x50b5('0xf')](_0x50b5('0x10'),_0xfcbd3d,'request\x20sent',JSON['stringify'](_0x19cb90));if(_0x19cb90['error']){if(_0x19cb90[_0x50b5('0x11')]['code']===0x1f4){logger['error'](_0x50b5('0xd'),_0xfcbd3d,_0x19cb90['error'][_0x50b5('0x12')]);return _0x93dda3(_0x19cb90[_0x50b5('0x11')][_0x50b5('0x12')]);}logger[_0x50b5('0x11')]('Template,\x20%s,\x20%s',_0xfcbd3d,_0x19cb90[_0x50b5('0x11')][_0x50b5('0x12')]);return _0x15528a(_0x19cb90[_0x50b5('0x11')][_0x50b5('0x12')]);}else{logger[_0x50b5('0x13')](_0x50b5('0xd'),_0xfcbd3d,_0x50b5('0xe'));_0x15528a(_0x19cb90[_0x50b5('0x14')][_0x50b5('0x12')]);}})[_0x50b5('0x15')](function(_0x5e547f){logger[_0x50b5('0x11')]('Template,\x20%s,\x20%s',_0xfcbd3d,_0x5e547f);_0x93dda3(_0x5e547f);});});}exports['GetTemplate']=function(_0x1b9690){var _0x143ccc=this;return new Promise(function(_0x20a974,_0x2c20e6){return db['Template'][_0x50b5('0x16')]({'raw':_0x1b9690[_0x50b5('0x17')]?_0x1b9690[_0x50b5('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1b9690['options']?_0x1b9690[_0x50b5('0x17')][_0x50b5('0x18')]||null:null,'attributes':_0x1b9690[_0x50b5('0x17')]?_0x1b9690[_0x50b5('0x17')]['attributes']||null:null,'limit':_0x1b9690[_0x50b5('0x17')]?_0x1b9690[_0x50b5('0x17')][_0x50b5('0x19')]||null:null,'include':_0x1b9690[_0x50b5('0x17')]?_0x1b9690[_0x50b5('0x17')][_0x50b5('0x1a')]?_[_0x50b5('0x1b')](_0x1b9690[_0x50b5('0x17')][_0x50b5('0x1a')],function(_0x18d982){return{'model':db[_0x18d982['model']],'as':_0x18d982['as'],'attributes':_0x18d982[_0x50b5('0x1c')],'include':_0x18d982[_0x50b5('0x1a')]?_[_0x50b5('0x1b')](_0x18d982[_0x50b5('0x1a')],function(_0x343518){return{'model':db[_0x343518[_0x50b5('0x1d')]],'as':_0x343518['as'],'attributes':_0x343518[_0x50b5('0x1c')],'include':_0x343518[_0x50b5('0x1a')]?_['map'](_0x343518[_0x50b5('0x1a')],function(_0x271a00){return{'model':db[_0x271a00[_0x50b5('0x1d')]],'as':_0x271a00['as'],'attributes':_0x271a00[_0x50b5('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x50b5('0xc')](function(_0x424b33){logger[_0x50b5('0x13')](_0x50b5('0x1e'),_0x1b9690);logger[_0x50b5('0xf')]('GetTemplate',_0x1b9690,JSON['stringify'](_0x424b33));_0x20a974(_0x424b33);})[_0x50b5('0x15')](function(_0xb2f8d8){logger[_0x50b5('0x11')](_0x50b5('0x1e'),_0xb2f8d8[_0x50b5('0x12')],_0x1b9690);_0x2c20e6(_0x143ccc[_0x50b5('0x11')](0x1f4,_0xb2f8d8['message']));});});}; \ No newline at end of file +var _0x4024=['http','request','info','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','Template,\x20%s,\x20%s','message','result','catch','GetTemplate','Template','options','attributes','include','map','model','then','debug','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client'];(function(_0x2ed1a9,_0x12e440){var _0x111507=function(_0x374185){while(--_0x374185){_0x2ed1a9['push'](_0x2ed1a9['shift']());}};_0x111507(++_0x12e440);}(_0x4024,0x89));var _0x4402=function(_0x4ec16b,_0x1946c8){_0x4ec16b=_0x4ec16b-0x0;var _0x432a1c=_0x4024[_0x4ec16b];return _0x432a1c;};'use strict';var _=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var moment=require('moment');var BPromise=require(_0x4402('0x2'));var rs=require(_0x4402('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4402('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4402('0x5'))(_0x4402('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4402('0x7')][_0x4402('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x168acd,_0x4ed77d,_0x3045ae){return new BPromise(function(_0x5d7ca4,_0x5c0b70){return client[_0x4402('0x9')](_0x168acd,_0x3045ae)['then'](function(_0x4d2882){logger[_0x4402('0xa')]('Template,\x20%s,\x20%s',_0x4ed77d,_0x4402('0xb'));logger['debug'](_0x4402('0xc'),_0x4ed77d,'request\x20sent',JSON[_0x4402('0xd')](_0x4d2882));if(_0x4d2882[_0x4402('0xe')]){if(_0x4d2882['error'][_0x4402('0xf')]===0x1f4){logger[_0x4402('0xe')](_0x4402('0x10'),_0x4ed77d,_0x4d2882['error'][_0x4402('0x11')]);return _0x5c0b70(_0x4d2882[_0x4402('0xe')][_0x4402('0x11')]);}logger[_0x4402('0xe')](_0x4402('0x10'),_0x4ed77d,_0x4d2882[_0x4402('0xe')][_0x4402('0x11')]);return _0x5d7ca4(_0x4d2882[_0x4402('0xe')][_0x4402('0x11')]);}else{logger[_0x4402('0xa')](_0x4402('0x10'),_0x4ed77d,_0x4402('0xb'));_0x5d7ca4(_0x4d2882[_0x4402('0x12')][_0x4402('0x11')]);}})[_0x4402('0x13')](function(_0x30c390){logger[_0x4402('0xe')](_0x4402('0x10'),_0x4ed77d,_0x30c390);_0x5c0b70(_0x30c390);});});}exports[_0x4402('0x14')]=function(_0x231382){var _0x5b127f=this;return new Promise(function(_0x494389,_0x663ab7){return db[_0x4402('0x15')]['findAll']({'raw':_0x231382[_0x4402('0x16')]?_0x231382[_0x4402('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x231382[_0x4402('0x16')]?_0x231382['options']['where']||null:null,'attributes':_0x231382[_0x4402('0x16')]?_0x231382[_0x4402('0x16')][_0x4402('0x17')]||null:null,'limit':_0x231382['options']?_0x231382[_0x4402('0x16')]['limit']||null:null,'include':_0x231382['options']?_0x231382[_0x4402('0x16')][_0x4402('0x18')]?_[_0x4402('0x19')](_0x231382[_0x4402('0x16')][_0x4402('0x18')],function(_0x2e6fee){return{'model':db[_0x2e6fee[_0x4402('0x1a')]],'as':_0x2e6fee['as'],'attributes':_0x2e6fee[_0x4402('0x17')],'include':_0x2e6fee[_0x4402('0x18')]?_['map'](_0x2e6fee[_0x4402('0x18')],function(_0x4e1c04){return{'model':db[_0x4e1c04[_0x4402('0x1a')]],'as':_0x4e1c04['as'],'attributes':_0x4e1c04[_0x4402('0x17')],'include':_0x4e1c04[_0x4402('0x18')]?_[_0x4402('0x19')](_0x4e1c04['include'],function(_0x15c19f){return{'model':db[_0x15c19f['model']],'as':_0x15c19f['as'],'attributes':_0x15c19f['attributes']};}):[]};}):[]};}):[]:[]})[_0x4402('0x1b')](function(_0x395e49){logger[_0x4402('0xa')](_0x4402('0x14'),_0x231382);logger[_0x4402('0x1c')]('GetTemplate',_0x231382,JSON[_0x4402('0xd')](_0x395e49));_0x494389(_0x395e49);})['catch'](function(_0x71da2f){logger[_0x4402('0xe')](_0x4402('0x14'),_0x71da2f['message'],_0x231382);_0x663ab7(_0x5b127f[_0x4402('0xe')](0x1f4,_0x71da2f[_0x4402('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 5778c98..13d83c0 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 _0xeef8=['get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','getActions','create','addAllCondition','post','addAction','update','delete','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller'];(function(_0x5dc89f,_0x4411bc){var _0x5115e4=function(_0x12d2ab){while(--_0x12d2ab){_0x5dc89f['push'](_0x5dc89f['shift']());}};_0x5115e4(++_0x4411bc);}(_0xeef8,0x197));var _0x8eef=function(_0x117f5f,_0x283091){_0x117f5f=_0x117f5f-0x0;var _0x5ebbd8=_0xeef8[_0x117f5f];return _0x5ebbd8;};'use strict';var multer=require('multer');var util=require(_0x8eef('0x0'));var path=require(_0x8eef('0x1'));var timeout=require(_0x8eef('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8eef('0x3'));var interaction=require(_0x8eef('0x4'));var config=require(_0x8eef('0x5'));var controller=require(_0x8eef('0x6'));router[_0x8eef('0x7')]('/',auth[_0x8eef('0x8')](),controller[_0x8eef('0x9')]);router[_0x8eef('0x7')](_0x8eef('0xa'),auth[_0x8eef('0x8')](),controller[_0x8eef('0xb')]);router[_0x8eef('0x7')](_0x8eef('0xc'),auth[_0x8eef('0x8')](),controller[_0x8eef('0xd')]);router[_0x8eef('0x7')](_0x8eef('0xe'),auth['isAuthenticated'](),controller['getAnyConditions']);router[_0x8eef('0x7')](_0x8eef('0xf'),auth['isAuthenticated'](),controller[_0x8eef('0x10')]);router['post']('/',auth[_0x8eef('0x8')](),controller[_0x8eef('0x11')]);router['post']('/:id/all_conditions',auth[_0x8eef('0x8')](),controller[_0x8eef('0x12')]);router[_0x8eef('0x13')](_0x8eef('0xe'),auth[_0x8eef('0x8')](),controller['addAnyCondition']);router[_0x8eef('0x13')](_0x8eef('0xf'),auth[_0x8eef('0x8')](),controller[_0x8eef('0x14')]);router['put'](_0x8eef('0xa'),auth['isAuthenticated'](),controller[_0x8eef('0x15')]);router[_0x8eef('0x16')]('/:id',auth[_0x8eef('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x348e=['delete','destroy','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','addAllCondition','addAnyCondition','addAction','put','update'];(function(_0x1851c1,_0x323085){var _0x1bc44d=function(_0x2967d1){while(--_0x2967d1){_0x1851c1['push'](_0x1851c1['shift']());}};_0x1bc44d(++_0x323085);}(_0x348e,0x9f));var _0xe348=function(_0x2dacd9,_0x5c02e2){_0x2dacd9=_0x2dacd9-0x0;var _0x3414bf=_0x348e[_0x2dacd9];return _0x3414bf;};'use strict';var multer=require(_0xe348('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe348('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe348('0x2'));var auth=require(_0xe348('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xe348('0x4'));var controller=require(_0xe348('0x5'));router[_0xe348('0x6')]('/',auth[_0xe348('0x7')](),controller[_0xe348('0x8')]);router[_0xe348('0x6')](_0xe348('0x9'),auth['isAuthenticated'](),controller[_0xe348('0xa')]);router[_0xe348('0x6')](_0xe348('0xb'),auth[_0xe348('0x7')](),controller[_0xe348('0xc')]);router[_0xe348('0x6')](_0xe348('0xd'),auth[_0xe348('0x7')](),controller[_0xe348('0xe')]);router[_0xe348('0x6')](_0xe348('0xf'),auth['isAuthenticated'](),controller[_0xe348('0x10')]);router[_0xe348('0x11')]('/',auth[_0xe348('0x7')](),controller['create']);router[_0xe348('0x11')](_0xe348('0xb'),auth[_0xe348('0x7')](),controller[_0xe348('0x12')]);router[_0xe348('0x11')](_0xe348('0xd'),auth['isAuthenticated'](),controller[_0xe348('0x13')]);router[_0xe348('0x11')](_0xe348('0xf'),auth[_0xe348('0x7')](),controller[_0xe348('0x14')]);router[_0xe348('0x15')](_0xe348('0x9'),auth[_0xe348('0x7')](),controller[_0xe348('0x16')]);router[_0xe348('0x17')](_0xe348('0x9'),auth['isAuthenticated'](),controller[_0xe348('0x18')]);module[_0xe348('0x19')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 86afbec..64b46ca 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 _0xa62b=['sequelize','exports','STRING','BOOLEAN'];(function(_0x333767,_0x220733){var _0x42a755=function(_0x535b16){while(--_0x535b16){_0x333767['push'](_0x333767['shift']());}};_0x42a755(++_0x220733);}(_0xa62b,0x1b0));var _0xba62=function(_0x1b7555,_0x3bd781){_0x1b7555=_0x1b7555-0x0;var _0x4436e1=_0xa62b[_0x1b7555];return _0x4436e1;};'use strict';var Sequelize=require(_0xba62('0x0'));module[_0xba62('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xba62('0x2')]},'description':{'type':Sequelize[_0xba62('0x2')]},'status':{'type':Sequelize[_0xba62('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xbe64=['exports','STRING','BOOLEAN','sequelize'];(function(_0x15ec4e,_0x40b7e0){var _0xb5e5dd=function(_0x42bdd7){while(--_0x42bdd7){_0x15ec4e['push'](_0x15ec4e['shift']());}};_0xb5e5dd(++_0x40b7e0);}(_0xbe64,0x173));var _0x4be6=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xbe64[_0x42245d];return _0x4b211a;};'use strict';var Sequelize=require(_0x4be6('0x0'));module[_0x4be6('0x1')]={'name':{'type':Sequelize[_0x4be6('0x2')]},'channel':{'type':Sequelize[_0x4be6('0x2')]},'description':{'type':Sequelize[_0x4be6('0x2')]},'status':{'type':Sequelize[_0x4be6('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index dfec4ea..f48271b 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 _0x43e3=['addAction','Action','getActions','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','then','destroy','Triggers','UserProfileResource','error','stack','name','send','map','Trigger','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','merge','VIRTUAL','options','where','include','findAll','rows','catch','show','find','body','user','role','get','UserProfileSection','userProfileId','create','update','params','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','length','pick','getAnyConditions'];(function(_0x4b09f4,_0x2ba844){var _0x5ea197=function(_0x1e91dd){while(--_0x1e91dd){_0x4b09f4['push'](_0x4b09f4['shift']());}};_0x5ea197(++_0x2ba844);}(_0x43e3,0xbd));var _0x343e=function(_0x475b7d,_0x3e1f95){_0x475b7d=_0x475b7d-0x0;var _0x2ad527=_0x43e3[_0x475b7d];return _0x2ad527;};'use strict';var emlformat=require(_0x343e('0x0'));var rimraf=require(_0x343e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x343e('0x2'));var rp=require(_0x343e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x343e('0x4'));var util=require(_0x343e('0x5'));var path=require(_0x343e('0x6'));var sox=require(_0x343e('0x7'));var csv=require(_0x343e('0x8'));var ejs=require(_0x343e('0x9'));var fs=require('fs');var fs_extra=require(_0x343e('0xa'));var _=require(_0x343e('0xb'));var squel=require(_0x343e('0xc'));var crypto=require(_0x343e('0xd'));var jsforce=require(_0x343e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x343e('0x8'));var querystring=require(_0x343e('0xf'));var Papa=require(_0x343e('0x10'));var Redis=require(_0x343e('0x11'));var authService=require(_0x343e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x343e('0x13'));var hardwareService=require(_0x343e('0x14'));var logger=require(_0x343e('0x15'))(_0x343e('0x16'));var utils=require(_0x343e('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x343e('0x18'))['db'];function respondWithStatusCode(_0x123d12,_0x3fb5f0){_0x3fb5f0=_0x3fb5f0||0xcc;return function(_0x55be33){if(_0x55be33){return _0x123d12[_0x343e('0x19')](_0x3fb5f0);}return _0x123d12['status'](_0x3fb5f0)[_0x343e('0x1a')]();};}function respondWithResult(_0x1d191c,_0x379ba8){_0x379ba8=_0x379ba8||0xc8;return function(_0x231667){if(_0x231667){return _0x1d191c[_0x343e('0x1b')](_0x379ba8)['json'](_0x231667);}};}function respondWithFilteredResult(_0x278a5e,_0x1d2e27){return function(_0x14bb07){if(_0x14bb07){var _0xf37331=typeof _0x1d2e27[_0x343e('0x1c')]===_0x343e('0x1d')&&typeof _0x1d2e27[_0x343e('0x1e')]===_0x343e('0x1d');var _0xcb4e06=_0x14bb07['count'];var _0x4852fc=_0xf37331?0x0:_0x1d2e27['offset'];var _0x22f262=_0xf37331?_0x14bb07[_0x343e('0x1f')]:_0x1d2e27['offset']+_0x1d2e27['limit'];var _0x9aa0d1;if(_0x22f262>=_0xcb4e06){_0x22f262=_0xcb4e06;_0x9aa0d1=0xc8;}else{_0x9aa0d1=0xce;}_0x278a5e[_0x343e('0x1b')](_0x9aa0d1);return _0x278a5e[_0x343e('0x20')](_0x343e('0x21'),_0x4852fc+'-'+_0x22f262+'/'+_0xcb4e06)[_0x343e('0x22')](_0x14bb07);}return null;};}function patchUpdates(_0x4d0fe0){return function(_0x357058){try{jsonpatch[_0x343e('0x23')](_0x357058,_0x4d0fe0,!![]);}catch(_0x1c0fac){return BPromise['reject'](_0x1c0fac);}return _0x357058['save']();};}function saveUpdates(_0x49416d,_0x3e9ab8){return function(_0x4eb771){if(_0x4eb771){return _0x4eb771['update'](_0x49416d)[_0x343e('0x24')](function(_0x4ecdc7){return _0x4ecdc7;});}return null;};}function removeEntity(_0x15f21f,_0x3bcc72){return function(_0x3505c1){if(_0x3505c1){return _0x3505c1[_0x343e('0x25')]()[_0x343e('0x24')](function(){var _0x2f6118=_0x3505c1['get']({'plain':!![]});var _0x147c78=_0x343e('0x26');return db[_0x343e('0x27')]['destroy']({'where':{'type':_0x147c78,'resourceId':_0x2f6118['id']}})['then'](function(){return _0x3505c1;});})['then'](function(){_0x15f21f[_0x343e('0x1b')](0xcc)[_0x343e('0x1a')]();});}};}function handleEntityNotFound(_0x399d1e,_0x5bac39){return function(_0x45b828){if(!_0x45b828){_0x399d1e[_0x343e('0x19')](0x194);}return _0x45b828;};}function handleError(_0x1a8a10,_0x83d638){_0x83d638=_0x83d638||0x1f4;return function(_0x4f9198){logger[_0x343e('0x28')](_0x4f9198[_0x343e('0x29')]);if(_0x4f9198[_0x343e('0x2a')]){delete _0x4f9198[_0x343e('0x2a')];}_0x1a8a10[_0x343e('0x1b')](_0x83d638)[_0x343e('0x2b')](_0x4f9198);};}exports['index']=function(_0x6c2b2d,_0x24c9cc){var _0x1f062a={},_0x23c39c={},_0x2f4d40={'count':0x0,'rows':[]};var _0x5c10e7=_[_0x343e('0x2c')](db[_0x343e('0x2d')][_0x343e('0x2e')],function(_0x57b238){return{'name':_0x57b238[_0x343e('0x2f')],'type':_0x57b238[_0x343e('0x30')]['key']};});_0x23c39c['model']=_[_0x343e('0x2c')](_0x5c10e7,_0x343e('0x2a'));_0x23c39c[_0x343e('0x31')]=_[_0x343e('0x32')](_0x6c2b2d[_0x343e('0x31')]);_0x23c39c[_0x343e('0x33')]=_[_0x343e('0x34')](_0x23c39c[_0x343e('0x35')],_0x23c39c['query']);_0x1f062a[_0x343e('0x36')]=_[_0x343e('0x34')](_0x23c39c[_0x343e('0x35')],qs[_0x343e('0x37')](_0x6c2b2d[_0x343e('0x31')][_0x343e('0x37')]));_0x1f062a[_0x343e('0x36')]=_0x1f062a[_0x343e('0x36')]['length']?_0x1f062a[_0x343e('0x36')]:_0x23c39c[_0x343e('0x35')];if(!_0x6c2b2d[_0x343e('0x31')][_0x343e('0x38')](_0x343e('0x39'))){_0x1f062a['limit']=qs['limit'](_0x6c2b2d['query'][_0x343e('0x1e')]);_0x1f062a[_0x343e('0x1c')]=qs[_0x343e('0x1c')](_0x6c2b2d[_0x343e('0x31')][_0x343e('0x1c')]);}_0x1f062a[_0x343e('0x3a')]=qs[_0x343e('0x3b')](_0x6c2b2d[_0x343e('0x31')][_0x343e('0x3b')]);_0x1f062a['where']=qs[_0x343e('0x33')](_['pick'](_0x6c2b2d[_0x343e('0x31')],_0x23c39c[_0x343e('0x33')]),_0x5c10e7);if(_0x6c2b2d['query'][_0x343e('0x3c')]){_0x1f062a['where']=_[_0x343e('0x3d')](_0x1f062a['where'],{'$or':_[_0x343e('0x2c')](_0x5c10e7,function(_0x240d94){if(_0x240d94[_0x343e('0x30')]!==_0x343e('0x3e')){var _0x296460={};_0x296460[_0x240d94[_0x343e('0x2a')]]={'$like':'%'+_0x6c2b2d['query'][_0x343e('0x3c')]+'%'};return _0x296460;}})});}_0x1f062a=_['merge']({},_0x1f062a,_0x6c2b2d[_0x343e('0x3f')]);var _0x27bede={'where':_0x1f062a[_0x343e('0x40')]};return db[_0x343e('0x2d')][_0x343e('0x1f')](_0x27bede)['then'](function(_0x5e6a4c){_0x2f4d40[_0x343e('0x1f')]=_0x5e6a4c;if(_0x6c2b2d[_0x343e('0x31')]['includeAll']){_0x1f062a[_0x343e('0x41')]=[{'all':!![]}];}return db[_0x343e('0x2d')][_0x343e('0x42')](_0x1f062a);})[_0x343e('0x24')](function(_0x1daedf){_0x2f4d40[_0x343e('0x43')]=_0x1daedf;return _0x2f4d40;})[_0x343e('0x24')](respondWithFilteredResult(_0x24c9cc,_0x1f062a))[_0x343e('0x44')](handleError(_0x24c9cc,null));};exports[_0x343e('0x45')]=function(_0x2d218b,_0x266c15){var _0x7df482={'raw':![],'where':{'id':_0x2d218b['params']['id']}},_0x4e8112={};_0x4e8112[_0x343e('0x35')]=_[_0x343e('0x32')](db[_0x343e('0x2d')][_0x343e('0x2e')]);_0x4e8112[_0x343e('0x31')]=_[_0x343e('0x32')](_0x2d218b[_0x343e('0x31')]);_0x4e8112['filters']=_[_0x343e('0x34')](_0x4e8112['model'],_0x4e8112[_0x343e('0x31')]);_0x7df482['attributes']=_[_0x343e('0x34')](_0x4e8112[_0x343e('0x35')],qs[_0x343e('0x37')](_0x2d218b[_0x343e('0x31')][_0x343e('0x37')]));_0x7df482['attributes']=_0x7df482[_0x343e('0x36')]['length']?_0x7df482[_0x343e('0x36')]:_0x4e8112[_0x343e('0x35')];if(_0x2d218b[_0x343e('0x31')]['includeAll']){_0x7df482[_0x343e('0x41')]=[{'all':!![]}];}_0x7df482=_['merge']({},_0x7df482,_0x2d218b[_0x343e('0x3f')]);return db[_0x343e('0x2d')][_0x343e('0x46')](_0x7df482)['then'](handleEntityNotFound(_0x266c15,null))[_0x343e('0x24')](respondWithResult(_0x266c15,null))['catch'](handleError(_0x266c15,null));};exports['create']=function(_0x4ca88c,_0x5ee225){return db[_0x343e('0x2d')]['create'](_0x4ca88c[_0x343e('0x47')],{})[_0x343e('0x24')](function(_0xb5a71f){var _0x328264=_0x4ca88c[_0x343e('0x48')]['get']({'plain':!![]});if(!_0x328264)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x328264[_0x343e('0x49')]===_0x343e('0x48')){var _0x5e6af8=_0xb5a71f[_0x343e('0x4a')]({'plain':!![]});var _0x46eaec=_0x343e('0x26');return db[_0x343e('0x4b')][_0x343e('0x46')]({'where':{'name':_0x46eaec,'userProfileId':_0x328264[_0x343e('0x4c')]},'raw':!![]})[_0x343e('0x24')](function(_0xc20a8a){if(_0xc20a8a&&_0xc20a8a['autoAssociation']===0x0){return db[_0x343e('0x27')][_0x343e('0x4d')]({'name':_0x5e6af8[_0x343e('0x2a')],'resourceId':_0x5e6af8['id'],'type':_0xc20a8a['name'],'sectionId':_0xc20a8a['id']},{})[_0x343e('0x24')](function(){return _0xb5a71f;});}else{return _0xb5a71f;}})[_0x343e('0x44')](function(_0x2031c4){logger[_0x343e('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2031c4);throw _0x2031c4;});}return _0xb5a71f;})['then'](respondWithResult(_0x5ee225,0xc9))[_0x343e('0x44')](handleError(_0x5ee225,null));};exports[_0x343e('0x4e')]=function(_0x400c86,_0x5dfd44){if(_0x400c86[_0x343e('0x47')]['id']){delete _0x400c86[_0x343e('0x47')]['id'];}return db['Trigger']['find']({'where':{'id':_0x400c86[_0x343e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5dfd44,null))[_0x343e('0x24')](saveUpdates(_0x400c86[_0x343e('0x47')],null))[_0x343e('0x24')](respondWithResult(_0x5dfd44,null))[_0x343e('0x44')](handleError(_0x5dfd44,null));};exports[_0x343e('0x25')]=function(_0x1a27a7,_0x525293){return db[_0x343e('0x2d')]['find']({'where':{'id':_0x1a27a7[_0x343e('0x4f')]['id']}})[_0x343e('0x24')](handleEntityNotFound(_0x525293,null))['then'](removeEntity(_0x525293,null))[_0x343e('0x44')](handleError(_0x525293,null));};exports[_0x343e('0x50')]=function(_0x4c7e01,_0xc60b00,_0x2d1cb4){if(_0x4c7e01['body']['id']){delete _0x4c7e01[_0x343e('0x47')]['id'];}return db[_0x343e('0x2d')][_0x343e('0x46')]({'where':{'id':_0x4c7e01[_0x343e('0x4f')]['id']}})[_0x343e('0x24')](handleEntityNotFound(_0xc60b00,null))['then'](function(_0x5a7008){if(_0x5a7008){_0x4c7e01[_0x343e('0x47')][_0x343e('0x51')]=_0x5a7008['id'];return db[_0x343e('0x52')][_0x343e('0x4d')](_0x4c7e01[_0x343e('0x47')]);}})[_0x343e('0x24')](respondWithResult(_0xc60b00,null))[_0x343e('0x44')](handleError(_0xc60b00,null));};exports[_0x343e('0x53')]=function(_0x389525,_0x3cfcc3,_0xf9ebae){if(_0x389525['body']['id']){delete _0x389525[_0x343e('0x47')]['id'];}return db[_0x343e('0x2d')][_0x343e('0x46')]({'where':{'id':_0x389525[_0x343e('0x4f')]['id']}})[_0x343e('0x24')](handleEntityNotFound(_0x3cfcc3,null))[_0x343e('0x24')](function(_0x7118a1){if(_0x7118a1){_0x389525[_0x343e('0x47')][_0x343e('0x54')]=_0x7118a1['id'];return db[_0x343e('0x52')]['create'](_0x389525[_0x343e('0x47')]);}})['then'](respondWithResult(_0x3cfcc3,null))[_0x343e('0x44')](handleError(_0x3cfcc3,null));};exports[_0x343e('0x55')]=function(_0x2ca901,_0x3752d7,_0x45b6ee){var _0x31a04b={};var _0x5cb3f1={};var _0x5c7dab;var _0x5c537e;return db[_0x343e('0x2d')][_0x343e('0x56')]({'where':{'id':_0x2ca901[_0x343e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3752d7,null))['then'](function(_0x29a0a2){if(_0x29a0a2){_0x5c7dab=_0x29a0a2;_0x5cb3f1[_0x343e('0x35')]=_[_0x343e('0x32')](db[_0x343e('0x52')]['rawAttributes']);_0x5cb3f1[_0x343e('0x31')]=_[_0x343e('0x32')](_0x2ca901[_0x343e('0x31')]);_0x5cb3f1[_0x343e('0x33')]=_[_0x343e('0x34')](_0x5cb3f1[_0x343e('0x35')],_0x5cb3f1['query']);_0x31a04b[_0x343e('0x36')]=_[_0x343e('0x34')](_0x5cb3f1[_0x343e('0x35')],qs[_0x343e('0x37')](_0x2ca901[_0x343e('0x31')][_0x343e('0x37')]));_0x31a04b[_0x343e('0x36')]=_0x31a04b[_0x343e('0x36')][_0x343e('0x57')]?_0x31a04b['attributes']:_0x5cb3f1[_0x343e('0x35')];_0x31a04b[_0x343e('0x3a')]=qs[_0x343e('0x3b')](_0x2ca901[_0x343e('0x31')][_0x343e('0x3b')]);_0x31a04b['where']=qs[_0x343e('0x33')](_[_0x343e('0x58')](_0x2ca901[_0x343e('0x31')],_0x5cb3f1['filters']));if(_0x2ca901['query'][_0x343e('0x3c')]){_0x31a04b[_0x343e('0x40')]=_[_0x343e('0x3d')](_0x31a04b['where'],{'$or':_[_0x343e('0x2c')](_0x31a04b[_0x343e('0x36')],function(_0x31a7ec){var _0x1d425a={};_0x1d425a[_0x31a7ec]={'$like':'%'+_0x2ca901['query'][_0x343e('0x3c')]+'%'};return _0x1d425a;})});}_0x31a04b=_[_0x343e('0x3d')]({},_0x31a04b,_0x2ca901[_0x343e('0x3f')]);return _0x5c7dab['getAllConditions'](_0x31a04b);}})[_0x343e('0x24')](function(_0x2d9c72){if(_0x2d9c72){_0x5c537e=_0x2d9c72[_0x343e('0x57')];if(!_0x2ca901['query'][_0x343e('0x38')]('nolimit')){_0x31a04b[_0x343e('0x1e')]=qs[_0x343e('0x1e')](_0x2ca901[_0x343e('0x31')]['limit']);_0x31a04b[_0x343e('0x1c')]=qs[_0x343e('0x1c')](_0x2ca901['query']['offset']);}return _0x5c7dab[_0x343e('0x55')](_0x31a04b);}})[_0x343e('0x24')](function(_0x36f08e){if(_0x36f08e){return _0x36f08e?{'count':_0x5c537e,'rows':_0x36f08e}:null;}})[_0x343e('0x24')](respondWithResult(_0x3752d7,null))['catch'](handleError(_0x3752d7,null));};exports[_0x343e('0x59')]=function(_0xc1728a,_0x45f6fb,_0xd48da6){var _0x2239b9={};var _0x1036cc={};var _0x2f7e1a;var _0xa498b8;return db['Trigger'][_0x343e('0x56')]({'where':{'id':_0xc1728a[_0x343e('0x4f')]['id']}})[_0x343e('0x24')](handleEntityNotFound(_0x45f6fb,null))[_0x343e('0x24')](function(_0x4ddbde){if(_0x4ddbde){_0x2f7e1a=_0x4ddbde;_0x1036cc[_0x343e('0x35')]=_[_0x343e('0x32')](db['Condition'][_0x343e('0x2e')]);_0x1036cc[_0x343e('0x31')]=_[_0x343e('0x32')](_0xc1728a[_0x343e('0x31')]);_0x1036cc[_0x343e('0x33')]=_[_0x343e('0x34')](_0x1036cc[_0x343e('0x35')],_0x1036cc[_0x343e('0x31')]);_0x2239b9['attributes']=_['intersection'](_0x1036cc[_0x343e('0x35')],qs[_0x343e('0x37')](_0xc1728a[_0x343e('0x31')][_0x343e('0x37')]));_0x2239b9['attributes']=_0x2239b9[_0x343e('0x36')][_0x343e('0x57')]?_0x2239b9[_0x343e('0x36')]:_0x1036cc[_0x343e('0x35')];_0x2239b9['order']=qs[_0x343e('0x3b')](_0xc1728a[_0x343e('0x31')][_0x343e('0x3b')]);_0x2239b9['where']=qs['filters'](_[_0x343e('0x58')](_0xc1728a[_0x343e('0x31')],_0x1036cc['filters']));if(_0xc1728a[_0x343e('0x31')]['filter']){_0x2239b9[_0x343e('0x40')]=_[_0x343e('0x3d')](_0x2239b9[_0x343e('0x40')],{'$or':_[_0x343e('0x2c')](_0x2239b9['attributes'],function(_0x322036){var _0x4ae2fd={};_0x4ae2fd[_0x322036]={'$like':'%'+_0xc1728a[_0x343e('0x31')][_0x343e('0x3c')]+'%'};return _0x4ae2fd;})});}_0x2239b9=_[_0x343e('0x3d')]({},_0x2239b9,_0xc1728a[_0x343e('0x3f')]);return _0x2f7e1a[_0x343e('0x59')](_0x2239b9);}})[_0x343e('0x24')](function(_0x215318){if(_0x215318){_0xa498b8=_0x215318[_0x343e('0x57')];if(!_0xc1728a[_0x343e('0x31')][_0x343e('0x38')](_0x343e('0x39'))){_0x2239b9[_0x343e('0x1e')]=qs[_0x343e('0x1e')](_0xc1728a[_0x343e('0x31')]['limit']);_0x2239b9[_0x343e('0x1c')]=qs[_0x343e('0x1c')](_0xc1728a[_0x343e('0x31')][_0x343e('0x1c')]);}return _0x2f7e1a[_0x343e('0x59')](_0x2239b9);}})[_0x343e('0x24')](function(_0x1d17a8){if(_0x1d17a8){return _0x1d17a8?{'count':_0xa498b8,'rows':_0x1d17a8}:null;}})[_0x343e('0x24')](respondWithResult(_0x45f6fb,null))['catch'](handleError(_0x45f6fb,null));};exports[_0x343e('0x5a')]=function(_0x4bce44,_0x176462,_0x3e7101){if(_0x4bce44['body']['id']){delete _0x4bce44[_0x343e('0x47')]['id'];}return db['Trigger'][_0x343e('0x46')]({'where':{'id':_0x4bce44[_0x343e('0x4f')]['id']}})[_0x343e('0x24')](handleEntityNotFound(_0x176462,null))[_0x343e('0x24')](function(_0x3dee65){if(_0x3dee65){_0x4bce44[_0x343e('0x47')]['TriggerId']=_0x3dee65['id'];return db[_0x343e('0x5b')][_0x343e('0x4d')](_0x4bce44[_0x343e('0x47')]);}})['then'](respondWithResult(_0x176462,null))[_0x343e('0x44')](handleError(_0x176462,null));};exports[_0x343e('0x5c')]=function(_0x3e58ad,_0x136316,_0x30d1dd){var _0x5920f8={};var _0x22f089={};var _0x937cb0;var _0x33c66e;return db[_0x343e('0x2d')]['findOne']({'where':{'id':_0x3e58ad[_0x343e('0x4f')]['id']}})[_0x343e('0x24')](handleEntityNotFound(_0x136316,null))[_0x343e('0x24')](function(_0x8a974){if(_0x8a974){_0x937cb0=_0x8a974;_0x22f089[_0x343e('0x35')]=_['keys'](db[_0x343e('0x5b')]['rawAttributes']);_0x22f089[_0x343e('0x31')]=_[_0x343e('0x32')](_0x3e58ad['query']);_0x22f089['filters']=_['intersection'](_0x22f089['model'],_0x22f089[_0x343e('0x31')]);_0x5920f8[_0x343e('0x36')]=_[_0x343e('0x34')](_0x22f089[_0x343e('0x35')],qs['fields'](_0x3e58ad['query'][_0x343e('0x37')]));_0x5920f8[_0x343e('0x36')]=_0x5920f8['attributes']['length']?_0x5920f8['attributes']:_0x22f089[_0x343e('0x35')];_0x5920f8['order']=qs[_0x343e('0x3b')](_0x3e58ad[_0x343e('0x31')][_0x343e('0x3b')]);_0x5920f8[_0x343e('0x40')]=qs[_0x343e('0x33')](_['pick'](_0x3e58ad[_0x343e('0x31')],_0x22f089[_0x343e('0x33')]));if(_0x3e58ad[_0x343e('0x31')]['filter']){_0x5920f8['where']=_[_0x343e('0x3d')](_0x5920f8['where'],{'$or':_[_0x343e('0x2c')](_0x5920f8[_0x343e('0x36')],function(_0x2778b7){var _0x3a7d48={};_0x3a7d48[_0x2778b7]={'$like':'%'+_0x3e58ad[_0x343e('0x31')]['filter']+'%'};return _0x3a7d48;})});}_0x5920f8=_[_0x343e('0x3d')]({},_0x5920f8,_0x3e58ad[_0x343e('0x3f')]);return _0x937cb0[_0x343e('0x5c')](_0x5920f8);}})[_0x343e('0x24')](function(_0x58ab50){if(_0x58ab50){_0x33c66e=_0x58ab50[_0x343e('0x57')];if(!_0x3e58ad['query'][_0x343e('0x38')](_0x343e('0x39'))){_0x5920f8[_0x343e('0x1e')]=qs['limit'](_0x3e58ad[_0x343e('0x31')][_0x343e('0x1e')]);_0x5920f8['offset']=qs['offset'](_0x3e58ad[_0x343e('0x31')]['offset']);}return _0x937cb0[_0x343e('0x5c')](_0x5920f8);}})[_0x343e('0x24')](function(_0x47a4c9){if(_0x47a4c9){return _0x47a4c9?{'count':_0x33c66e,'rows':_0x47a4c9}:null;}})[_0x343e('0x24')](respondWithResult(_0x136316,null))[_0x343e('0x44')](handleError(_0x136316,null));}; \ No newline at end of file +var _0xeaa5=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','get','Triggers','UserProfileResource','destroy','error','stack','name','send','map','Trigger','rawAttributes','type','key','model','keys','filters','intersection','fields','attributes','length','nolimit','query','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','catch','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','addAction','TriggerId','Action','getActions','hasOwnProperty','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xeaa5,0xaa));var _0x5eaa=function(_0x5ca199,_0x1053d){_0x5ca199=_0x5ca199-0x0;var _0x52cc73=_0xeaa5[_0x5ca199];return _0x52cc73;};'use strict';var emlformat=require(_0x5eaa('0x0'));var rimraf=require(_0x5eaa('0x1'));var zipdir=require(_0x5eaa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5eaa('0x3'));var moment=require(_0x5eaa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5eaa('0x5'));var util=require(_0x5eaa('0x6'));var path=require(_0x5eaa('0x7'));var sox=require(_0x5eaa('0x8'));var csv=require(_0x5eaa('0x9'));var ejs=require(_0x5eaa('0xa'));var fs=require('fs');var fs_extra=require(_0x5eaa('0xb'));var _=require(_0x5eaa('0xc'));var squel=require('squel');var crypto=require(_0x5eaa('0xd'));var jsforce=require(_0x5eaa('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5eaa('0xf'));var authService=require(_0x5eaa('0x10'));var qs=require(_0x5eaa('0x11'));var as=require(_0x5eaa('0x12'));var hardwareService=require(_0x5eaa('0x13'));var logger=require(_0x5eaa('0x14'))(_0x5eaa('0x15'));var utils=require(_0x5eaa('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5eaa('0x17'));var db=require(_0x5eaa('0x18'))['db'];function respondWithStatusCode(_0x452231,_0x2fbb68){_0x2fbb68=_0x2fbb68||0xcc;return function(_0x14526a){if(_0x14526a){return _0x452231[_0x5eaa('0x19')](_0x2fbb68);}return _0x452231[_0x5eaa('0x1a')](_0x2fbb68)[_0x5eaa('0x1b')]();};}function respondWithResult(_0x2763e9,_0xc35f3a){_0xc35f3a=_0xc35f3a||0xc8;return function(_0x235f63){if(_0x235f63){return _0x2763e9[_0x5eaa('0x1a')](_0xc35f3a)[_0x5eaa('0x1c')](_0x235f63);}};}function respondWithFilteredResult(_0x86a3d6,_0x4de2bf){return function(_0x359993){if(_0x359993){var _0x321f96=typeof _0x4de2bf[_0x5eaa('0x1d')]===_0x5eaa('0x1e')&&typeof _0x4de2bf['limit']===_0x5eaa('0x1e');var _0x322ff4=_0x359993[_0x5eaa('0x1f')];var _0x5376d5=_0x321f96?0x0:_0x4de2bf[_0x5eaa('0x1d')];var _0x146db8=_0x321f96?_0x359993['count']:_0x4de2bf[_0x5eaa('0x1d')]+_0x4de2bf[_0x5eaa('0x20')];var _0x1bf06c;if(_0x146db8>=_0x322ff4){_0x146db8=_0x322ff4;_0x1bf06c=0xc8;}else{_0x1bf06c=0xce;}_0x86a3d6[_0x5eaa('0x1a')](_0x1bf06c);return _0x86a3d6[_0x5eaa('0x21')](_0x5eaa('0x22'),_0x5376d5+'-'+_0x146db8+'/'+_0x322ff4)['json'](_0x359993);}return null;};}function patchUpdates(_0x253a09){return function(_0x25b27d){try{jsonpatch['apply'](_0x25b27d,_0x253a09,!![]);}catch(_0xe85d11){return BPromise[_0x5eaa('0x23')](_0xe85d11);}return _0x25b27d[_0x5eaa('0x24')]();};}function saveUpdates(_0x3b8cd9,_0x41e389){return function(_0x401695){if(_0x401695){return _0x401695[_0x5eaa('0x25')](_0x3b8cd9)[_0x5eaa('0x26')](function(_0x1e35af){return _0x1e35af;});}return null;};}function removeEntity(_0x1087be,_0x252e43){return function(_0x3d4cb7){if(_0x3d4cb7){return _0x3d4cb7['destroy']()[_0x5eaa('0x26')](function(){var _0x3e472c=_0x3d4cb7[_0x5eaa('0x27')]({'plain':!![]});var _0x1d0250=_0x5eaa('0x28');return db[_0x5eaa('0x29')][_0x5eaa('0x2a')]({'where':{'type':_0x1d0250,'resourceId':_0x3e472c['id']}})[_0x5eaa('0x26')](function(){return _0x3d4cb7;});})['then'](function(){_0x1087be['status'](0xcc)[_0x5eaa('0x1b')]();});}};}function handleEntityNotFound(_0x2100b4,_0x299d80){return function(_0x42fc9c){if(!_0x42fc9c){_0x2100b4[_0x5eaa('0x19')](0x194);}return _0x42fc9c;};}function handleError(_0xd5f07f,_0x4722df){_0x4722df=_0x4722df||0x1f4;return function(_0x3c9b57){logger[_0x5eaa('0x2b')](_0x3c9b57[_0x5eaa('0x2c')]);if(_0x3c9b57[_0x5eaa('0x2d')]){delete _0x3c9b57[_0x5eaa('0x2d')];}_0xd5f07f[_0x5eaa('0x1a')](_0x4722df)[_0x5eaa('0x2e')](_0x3c9b57);};}exports['index']=function(_0x1efee8,_0xcd8ac3){var _0x30593d={},_0x1b84b6={},_0x1b268a={'count':0x0,'rows':[]};var _0x4ae543=_[_0x5eaa('0x2f')](db[_0x5eaa('0x30')][_0x5eaa('0x31')],function(_0x548180){return{'name':_0x548180['fieldName'],'type':_0x548180[_0x5eaa('0x32')][_0x5eaa('0x33')]};});_0x1b84b6[_0x5eaa('0x34')]=_[_0x5eaa('0x2f')](_0x4ae543,'name');_0x1b84b6['query']=_[_0x5eaa('0x35')](_0x1efee8['query']);_0x1b84b6[_0x5eaa('0x36')]=_['intersection'](_0x1b84b6[_0x5eaa('0x34')],_0x1b84b6['query']);_0x30593d['attributes']=_[_0x5eaa('0x37')](_0x1b84b6['model'],qs['fields'](_0x1efee8['query'][_0x5eaa('0x38')]));_0x30593d['attributes']=_0x30593d[_0x5eaa('0x39')][_0x5eaa('0x3a')]?_0x30593d[_0x5eaa('0x39')]:_0x1b84b6[_0x5eaa('0x34')];if(!_0x1efee8['query']['hasOwnProperty'](_0x5eaa('0x3b'))){_0x30593d['limit']=qs[_0x5eaa('0x20')](_0x1efee8[_0x5eaa('0x3c')][_0x5eaa('0x20')]);_0x30593d[_0x5eaa('0x1d')]=qs['offset'](_0x1efee8[_0x5eaa('0x3c')][_0x5eaa('0x1d')]);}_0x30593d[_0x5eaa('0x3d')]=qs[_0x5eaa('0x3e')](_0x1efee8['query'][_0x5eaa('0x3e')]);_0x30593d['where']=qs['filters'](_[_0x5eaa('0x3f')](_0x1efee8[_0x5eaa('0x3c')],_0x1b84b6[_0x5eaa('0x36')]),_0x4ae543);if(_0x1efee8[_0x5eaa('0x3c')][_0x5eaa('0x40')]){_0x30593d[_0x5eaa('0x41')]=_['merge'](_0x30593d[_0x5eaa('0x41')],{'$or':_[_0x5eaa('0x2f')](_0x4ae543,function(_0x397356){if(_0x397356[_0x5eaa('0x32')]!=='VIRTUAL'){var _0x4094c7={};_0x4094c7[_0x397356['name']]={'$like':'%'+_0x1efee8[_0x5eaa('0x3c')][_0x5eaa('0x40')]+'%'};return _0x4094c7;}})});}_0x30593d=_[_0x5eaa('0x42')]({},_0x30593d,_0x1efee8[_0x5eaa('0x43')]);var _0x815f35={'where':_0x30593d['where']};return db[_0x5eaa('0x30')][_0x5eaa('0x1f')](_0x815f35)[_0x5eaa('0x26')](function(_0x35d91b){_0x1b268a[_0x5eaa('0x1f')]=_0x35d91b;if(_0x1efee8[_0x5eaa('0x3c')][_0x5eaa('0x44')]){_0x30593d[_0x5eaa('0x45')]=[{'all':!![]}];}return db[_0x5eaa('0x30')][_0x5eaa('0x46')](_0x30593d);})['then'](function(_0x1ef5cc){_0x1b268a['rows']=_0x1ef5cc;return _0x1b268a;})[_0x5eaa('0x26')](respondWithFilteredResult(_0xcd8ac3,_0x30593d))[_0x5eaa('0x47')](handleError(_0xcd8ac3,null));};exports['show']=function(_0x2e9125,_0x44ab82){var _0x658ab={'raw':![],'where':{'id':_0x2e9125[_0x5eaa('0x48')]['id']}},_0x5ea1ca={};_0x5ea1ca[_0x5eaa('0x34')]=_[_0x5eaa('0x35')](db[_0x5eaa('0x30')]['rawAttributes']);_0x5ea1ca['query']=_[_0x5eaa('0x35')](_0x2e9125['query']);_0x5ea1ca['filters']=_[_0x5eaa('0x37')](_0x5ea1ca[_0x5eaa('0x34')],_0x5ea1ca[_0x5eaa('0x3c')]);_0x658ab[_0x5eaa('0x39')]=_[_0x5eaa('0x37')](_0x5ea1ca[_0x5eaa('0x34')],qs[_0x5eaa('0x38')](_0x2e9125['query']['fields']));_0x658ab[_0x5eaa('0x39')]=_0x658ab[_0x5eaa('0x39')]['length']?_0x658ab[_0x5eaa('0x39')]:_0x5ea1ca[_0x5eaa('0x34')];if(_0x2e9125[_0x5eaa('0x3c')][_0x5eaa('0x44')]){_0x658ab[_0x5eaa('0x45')]=[{'all':!![]}];}_0x658ab=_[_0x5eaa('0x42')]({},_0x658ab,_0x2e9125[_0x5eaa('0x43')]);return db[_0x5eaa('0x30')][_0x5eaa('0x49')](_0x658ab)[_0x5eaa('0x26')](handleEntityNotFound(_0x44ab82,null))[_0x5eaa('0x26')](respondWithResult(_0x44ab82,null))['catch'](handleError(_0x44ab82,null));};exports['create']=function(_0x1604b0,_0x4a68c2){return db['Trigger'][_0x5eaa('0x4a')](_0x1604b0['body'],{})[_0x5eaa('0x26')](function(_0x2e621e){var _0x28401e=_0x1604b0[_0x5eaa('0x4b')][_0x5eaa('0x27')]({'plain':!![]});if(!_0x28401e)throw new Error(_0x5eaa('0x4c'));if(_0x28401e[_0x5eaa('0x4d')]===_0x5eaa('0x4b')){var _0x357cd1=_0x2e621e['get']({'plain':!![]});var _0x342f95=_0x5eaa('0x28');return db['UserProfileSection'][_0x5eaa('0x49')]({'where':{'name':_0x342f95,'userProfileId':_0x28401e[_0x5eaa('0x4e')]},'raw':!![]})[_0x5eaa('0x26')](function(_0x339722){if(_0x339722&&_0x339722[_0x5eaa('0x4f')]===0x0){return db['UserProfileResource'][_0x5eaa('0x4a')]({'name':_0x357cd1['name'],'resourceId':_0x357cd1['id'],'type':_0x339722['name'],'sectionId':_0x339722['id']},{})[_0x5eaa('0x26')](function(){return _0x2e621e;});}else{return _0x2e621e;}})[_0x5eaa('0x47')](function(_0x54b2a6){logger[_0x5eaa('0x2b')](_0x5eaa('0x50'),_0x54b2a6);throw _0x54b2a6;});}return _0x2e621e;})[_0x5eaa('0x26')](respondWithResult(_0x4a68c2,0xc9))['catch'](handleError(_0x4a68c2,null));};exports['update']=function(_0x4a6903,_0x5e764f){if(_0x4a6903[_0x5eaa('0x51')]['id']){delete _0x4a6903[_0x5eaa('0x51')]['id'];}return db[_0x5eaa('0x30')][_0x5eaa('0x49')]({'where':{'id':_0x4a6903[_0x5eaa('0x48')]['id']}})['then'](handleEntityNotFound(_0x5e764f,null))[_0x5eaa('0x26')](saveUpdates(_0x4a6903[_0x5eaa('0x51')],null))[_0x5eaa('0x26')](respondWithResult(_0x5e764f,null))[_0x5eaa('0x47')](handleError(_0x5e764f,null));};exports[_0x5eaa('0x2a')]=function(_0x34d44e,_0x471506){return db[_0x5eaa('0x30')]['find']({'where':{'id':_0x34d44e[_0x5eaa('0x48')]['id']}})[_0x5eaa('0x26')](handleEntityNotFound(_0x471506,null))['then'](removeEntity(_0x471506,null))['catch'](handleError(_0x471506,null));};exports[_0x5eaa('0x52')]=function(_0x3d494f,_0x5dbcdd,_0x499a45){if(_0x3d494f[_0x5eaa('0x51')]['id']){delete _0x3d494f['body']['id'];}return db[_0x5eaa('0x30')][_0x5eaa('0x49')]({'where':{'id':_0x3d494f[_0x5eaa('0x48')]['id']}})[_0x5eaa('0x26')](handleEntityNotFound(_0x5dbcdd,null))[_0x5eaa('0x26')](function(_0x4cf8a7){if(_0x4cf8a7){_0x3d494f['body'][_0x5eaa('0x53')]=_0x4cf8a7['id'];return db[_0x5eaa('0x54')][_0x5eaa('0x4a')](_0x3d494f[_0x5eaa('0x51')]);}})['then'](respondWithResult(_0x5dbcdd,null))[_0x5eaa('0x47')](handleError(_0x5dbcdd,null));};exports[_0x5eaa('0x55')]=function(_0x2e5e51,_0x343a86,_0x500d5f){if(_0x2e5e51[_0x5eaa('0x51')]['id']){delete _0x2e5e51['body']['id'];}return db[_0x5eaa('0x30')][_0x5eaa('0x49')]({'where':{'id':_0x2e5e51[_0x5eaa('0x48')]['id']}})[_0x5eaa('0x26')](handleEntityNotFound(_0x343a86,null))[_0x5eaa('0x26')](function(_0x10d197){if(_0x10d197){_0x2e5e51[_0x5eaa('0x51')][_0x5eaa('0x56')]=_0x10d197['id'];return db[_0x5eaa('0x54')][_0x5eaa('0x4a')](_0x2e5e51[_0x5eaa('0x51')]);}})['then'](respondWithResult(_0x343a86,null))[_0x5eaa('0x47')](handleError(_0x343a86,null));};exports[_0x5eaa('0x57')]=function(_0x14c5bf,_0xff7896,_0x1e6546){var _0x502cc3={};var _0xe4a07={};var _0x3fec33;var _0x846e60;return db['Trigger'][_0x5eaa('0x58')]({'where':{'id':_0x14c5bf[_0x5eaa('0x48')]['id']}})['then'](handleEntityNotFound(_0xff7896,null))[_0x5eaa('0x26')](function(_0x34b5a0){if(_0x34b5a0){_0x3fec33=_0x34b5a0;_0xe4a07['model']=_[_0x5eaa('0x35')](db[_0x5eaa('0x54')][_0x5eaa('0x31')]);_0xe4a07[_0x5eaa('0x3c')]=_[_0x5eaa('0x35')](_0x14c5bf[_0x5eaa('0x3c')]);_0xe4a07[_0x5eaa('0x36')]=_[_0x5eaa('0x37')](_0xe4a07[_0x5eaa('0x34')],_0xe4a07[_0x5eaa('0x3c')]);_0x502cc3[_0x5eaa('0x39')]=_['intersection'](_0xe4a07[_0x5eaa('0x34')],qs[_0x5eaa('0x38')](_0x14c5bf[_0x5eaa('0x3c')][_0x5eaa('0x38')]));_0x502cc3['attributes']=_0x502cc3[_0x5eaa('0x39')][_0x5eaa('0x3a')]?_0x502cc3[_0x5eaa('0x39')]:_0xe4a07[_0x5eaa('0x34')];_0x502cc3[_0x5eaa('0x3d')]=qs['sort'](_0x14c5bf['query']['sort']);_0x502cc3[_0x5eaa('0x41')]=qs[_0x5eaa('0x36')](_[_0x5eaa('0x3f')](_0x14c5bf[_0x5eaa('0x3c')],_0xe4a07[_0x5eaa('0x36')]));if(_0x14c5bf[_0x5eaa('0x3c')][_0x5eaa('0x40')]){_0x502cc3['where']=_[_0x5eaa('0x42')](_0x502cc3[_0x5eaa('0x41')],{'$or':_[_0x5eaa('0x2f')](_0x502cc3[_0x5eaa('0x39')],function(_0x5e85c9){var _0x13e1df={};_0x13e1df[_0x5e85c9]={'$like':'%'+_0x14c5bf[_0x5eaa('0x3c')]['filter']+'%'};return _0x13e1df;})});}_0x502cc3=_[_0x5eaa('0x42')]({},_0x502cc3,_0x14c5bf['options']);return _0x3fec33[_0x5eaa('0x57')](_0x502cc3);}})[_0x5eaa('0x26')](function(_0x40a848){if(_0x40a848){_0x846e60=_0x40a848[_0x5eaa('0x3a')];if(!_0x14c5bf[_0x5eaa('0x3c')]['hasOwnProperty']('nolimit')){_0x502cc3['limit']=qs[_0x5eaa('0x20')](_0x14c5bf[_0x5eaa('0x3c')][_0x5eaa('0x20')]);_0x502cc3['offset']=qs[_0x5eaa('0x1d')](_0x14c5bf[_0x5eaa('0x3c')][_0x5eaa('0x1d')]);}return _0x3fec33[_0x5eaa('0x57')](_0x502cc3);}})['then'](function(_0x1fd223){if(_0x1fd223){return _0x1fd223?{'count':_0x846e60,'rows':_0x1fd223}:null;}})[_0x5eaa('0x26')](respondWithResult(_0xff7896,null))[_0x5eaa('0x47')](handleError(_0xff7896,null));};exports[_0x5eaa('0x59')]=function(_0x50818b,_0x3ce570,_0x3db9c2){var _0x5be90d={};var _0x59549b={};var _0x4bc8eb;var _0x46fff1;return db[_0x5eaa('0x30')][_0x5eaa('0x58')]({'where':{'id':_0x50818b[_0x5eaa('0x48')]['id']}})[_0x5eaa('0x26')](handleEntityNotFound(_0x3ce570,null))[_0x5eaa('0x26')](function(_0x20dd80){if(_0x20dd80){_0x4bc8eb=_0x20dd80;_0x59549b['model']=_['keys'](db[_0x5eaa('0x54')][_0x5eaa('0x31')]);_0x59549b['query']=_[_0x5eaa('0x35')](_0x50818b[_0x5eaa('0x3c')]);_0x59549b[_0x5eaa('0x36')]=_[_0x5eaa('0x37')](_0x59549b[_0x5eaa('0x34')],_0x59549b['query']);_0x5be90d[_0x5eaa('0x39')]=_[_0x5eaa('0x37')](_0x59549b[_0x5eaa('0x34')],qs[_0x5eaa('0x38')](_0x50818b[_0x5eaa('0x3c')][_0x5eaa('0x38')]));_0x5be90d[_0x5eaa('0x39')]=_0x5be90d[_0x5eaa('0x39')][_0x5eaa('0x3a')]?_0x5be90d[_0x5eaa('0x39')]:_0x59549b['model'];_0x5be90d[_0x5eaa('0x3d')]=qs['sort'](_0x50818b[_0x5eaa('0x3c')][_0x5eaa('0x3e')]);_0x5be90d[_0x5eaa('0x41')]=qs[_0x5eaa('0x36')](_[_0x5eaa('0x3f')](_0x50818b[_0x5eaa('0x3c')],_0x59549b[_0x5eaa('0x36')]));if(_0x50818b[_0x5eaa('0x3c')][_0x5eaa('0x40')]){_0x5be90d[_0x5eaa('0x41')]=_[_0x5eaa('0x42')](_0x5be90d['where'],{'$or':_[_0x5eaa('0x2f')](_0x5be90d['attributes'],function(_0x2df2ed){var _0x199d56={};_0x199d56[_0x2df2ed]={'$like':'%'+_0x50818b['query']['filter']+'%'};return _0x199d56;})});}_0x5be90d=_['merge']({},_0x5be90d,_0x50818b[_0x5eaa('0x43')]);return _0x4bc8eb[_0x5eaa('0x59')](_0x5be90d);}})[_0x5eaa('0x26')](function(_0x5098ac){if(_0x5098ac){_0x46fff1=_0x5098ac[_0x5eaa('0x3a')];if(!_0x50818b[_0x5eaa('0x3c')]['hasOwnProperty'](_0x5eaa('0x3b'))){_0x5be90d[_0x5eaa('0x20')]=qs[_0x5eaa('0x20')](_0x50818b[_0x5eaa('0x3c')][_0x5eaa('0x20')]);_0x5be90d[_0x5eaa('0x1d')]=qs[_0x5eaa('0x1d')](_0x50818b[_0x5eaa('0x3c')][_0x5eaa('0x1d')]);}return _0x4bc8eb['getAnyConditions'](_0x5be90d);}})['then'](function(_0x39023e){if(_0x39023e){return _0x39023e?{'count':_0x46fff1,'rows':_0x39023e}:null;}})[_0x5eaa('0x26')](respondWithResult(_0x3ce570,null))[_0x5eaa('0x47')](handleError(_0x3ce570,null));};exports[_0x5eaa('0x5a')]=function(_0x1def01,_0x5a548a,_0xd3deb9){if(_0x1def01[_0x5eaa('0x51')]['id']){delete _0x1def01[_0x5eaa('0x51')]['id'];}return db['Trigger']['find']({'where':{'id':_0x1def01[_0x5eaa('0x48')]['id']}})[_0x5eaa('0x26')](handleEntityNotFound(_0x5a548a,null))[_0x5eaa('0x26')](function(_0x1deaad){if(_0x1deaad){_0x1def01[_0x5eaa('0x51')][_0x5eaa('0x5b')]=_0x1deaad['id'];return db[_0x5eaa('0x5c')]['create'](_0x1def01['body']);}})[_0x5eaa('0x26')](respondWithResult(_0x5a548a,null))[_0x5eaa('0x47')](handleError(_0x5a548a,null));};exports[_0x5eaa('0x5d')]=function(_0x5be7be,_0x33d172,_0x2d019c){var _0x1f0e61={};var _0x559b20={};var _0x1f760d;var _0x138213;return db[_0x5eaa('0x30')]['findOne']({'where':{'id':_0x5be7be[_0x5eaa('0x48')]['id']}})[_0x5eaa('0x26')](handleEntityNotFound(_0x33d172,null))['then'](function(_0x42147b){if(_0x42147b){_0x1f760d=_0x42147b;_0x559b20[_0x5eaa('0x34')]=_[_0x5eaa('0x35')](db['Action']['rawAttributes']);_0x559b20['query']=_['keys'](_0x5be7be[_0x5eaa('0x3c')]);_0x559b20[_0x5eaa('0x36')]=_[_0x5eaa('0x37')](_0x559b20[_0x5eaa('0x34')],_0x559b20['query']);_0x1f0e61[_0x5eaa('0x39')]=_[_0x5eaa('0x37')](_0x559b20[_0x5eaa('0x34')],qs[_0x5eaa('0x38')](_0x5be7be[_0x5eaa('0x3c')][_0x5eaa('0x38')]));_0x1f0e61['attributes']=_0x1f0e61[_0x5eaa('0x39')][_0x5eaa('0x3a')]?_0x1f0e61['attributes']:_0x559b20['model'];_0x1f0e61[_0x5eaa('0x3d')]=qs[_0x5eaa('0x3e')](_0x5be7be[_0x5eaa('0x3c')]['sort']);_0x1f0e61[_0x5eaa('0x41')]=qs[_0x5eaa('0x36')](_[_0x5eaa('0x3f')](_0x5be7be[_0x5eaa('0x3c')],_0x559b20[_0x5eaa('0x36')]));if(_0x5be7be['query'][_0x5eaa('0x40')]){_0x1f0e61[_0x5eaa('0x41')]=_[_0x5eaa('0x42')](_0x1f0e61[_0x5eaa('0x41')],{'$or':_[_0x5eaa('0x2f')](_0x1f0e61[_0x5eaa('0x39')],function(_0x19ddac){var _0x383652={};_0x383652[_0x19ddac]={'$like':'%'+_0x5be7be['query'][_0x5eaa('0x40')]+'%'};return _0x383652;})});}_0x1f0e61=_['merge']({},_0x1f0e61,_0x5be7be[_0x5eaa('0x43')]);return _0x1f760d['getActions'](_0x1f0e61);}})['then'](function(_0x5a0813){if(_0x5a0813){_0x138213=_0x5a0813['length'];if(!_0x5be7be[_0x5eaa('0x3c')][_0x5eaa('0x5e')]('nolimit')){_0x1f0e61[_0x5eaa('0x20')]=qs[_0x5eaa('0x20')](_0x5be7be['query'][_0x5eaa('0x20')]);_0x1f0e61[_0x5eaa('0x1d')]=qs[_0x5eaa('0x1d')](_0x5be7be['query'][_0x5eaa('0x1d')]);}return _0x1f760d[_0x5eaa('0x5d')](_0x1f0e61);}})[_0x5eaa('0x26')](function(_0x2aefeb){if(_0x2aefeb){return _0x2aefeb?{'count':_0x138213,'rows':_0x2aefeb}:null;}})['then'](respondWithResult(_0x33d172,null))[_0x5eaa('0x47')](handleError(_0x33d172,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index fa63999..3ba96c5 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 _0xe1f0=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./trigger.attributes','define','Trigger','tools_triggers','util'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xe1f0,0x1c2));var _0x0e1f=function(_0x4c3bf7,_0x557598){_0x4c3bf7=_0x4c3bf7-0x0;var _0x5680db=_0xe1f0[_0x4c3bf7];return _0x5680db;};'use strict';var _=require('lodash');var util=require(_0x0e1f('0x0'));var logger=require(_0x0e1f('0x1'))('api');var moment=require(_0x0e1f('0x2'));var BPromise=require(_0x0e1f('0x3'));var rp=require(_0x0e1f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0e1f('0x5'));var config=require(_0x0e1f('0x6'));var attributes=require(_0x0e1f('0x7'));module['exports']=function(_0x260585,_0x569a5a){return _0x260585[_0x0e1f('0x8')](_0x0e1f('0x9'),attributes,{'tableName':_0x0e1f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2263=['path','../../config/environment','./trigger.attributes','exports','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x15ba86,_0x2a85de){var _0x45b830=function(_0x30dbfb){while(--_0x30dbfb){_0x15ba86['push'](_0x15ba86['shift']());}};_0x45b830(++_0x2a85de);}(_0x2263,0x6e));var _0x3226=function(_0x2e6c19,_0x131233){_0x2e6c19=_0x2e6c19-0x0;var _0x52885d=_0x2263[_0x2e6c19];return _0x52885d;};'use strict';var _=require(_0x3226('0x0'));var util=require(_0x3226('0x1'));var logger=require(_0x3226('0x2'))(_0x3226('0x3'));var moment=require(_0x3226('0x4'));var BPromise=require(_0x3226('0x5'));var rp=require(_0x3226('0x6'));var fs=require('fs');var path=require(_0x3226('0x7'));var rimraf=require('rimraf');var config=require(_0x3226('0x8'));var attributes=require(_0x3226('0x9'));module[_0x3226('0xa')]=function(_0x34c47c,_0x31b59b){return _0x34c47c['define'](_0x3226('0xb'),attributes,{'tableName':_0x3226('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index bf0d6bd..5e76b9f 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 _0x8555=['limit','include','map','model','stringify','ShowTrigger','Trigger','find','where','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','Trigger,\x20%s,\x20%s','message','result','GetTrigger','options','raw','attributes'];(function(_0x11315f,_0x4eabdd){var _0xb4c69c=function(_0x2773ea){while(--_0x2773ea){_0x11315f['push'](_0x11315f['shift']());}};_0xb4c69c(++_0x4eabdd);}(_0x8555,0x8e));var _0x5855=function(_0x38a8ce,_0x5dff60){_0x38a8ce=_0x38a8ce-0x0;var _0x5b26f3=_0x8555[_0x38a8ce];return _0x5b26f3;};'use strict';var _=require(_0x5855('0x0'));var util=require('util');var moment=require(_0x5855('0x1'));var BPromise=require(_0x5855('0x2'));var rs=require(_0x5855('0x3'));var fs=require('fs');var Redis=require(_0x5855('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5855('0x5'));var logger=require('../../config/logger')(_0x5855('0x6'));var config=require(_0x5855('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5855('0x8')][_0x5855('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14cbd6,_0x24a06e,_0x346390){return new BPromise(function(_0x5569ed,_0x2044d6){return client['request'](_0x14cbd6,_0x346390)[_0x5855('0xa')](function(_0x7991b4){logger[_0x5855('0xb')]('Trigger,\x20%s,\x20%s',_0x24a06e,_0x5855('0xc'));logger[_0x5855('0xd')](_0x5855('0xe'),_0x24a06e,_0x5855('0xc'),JSON['stringify'](_0x7991b4));if(_0x7991b4[_0x5855('0xf')]){if(_0x7991b4[_0x5855('0xf')]['code']===0x1f4){logger[_0x5855('0xf')](_0x5855('0x10'),_0x24a06e,_0x7991b4[_0x5855('0xf')][_0x5855('0x11')]);return _0x2044d6(_0x7991b4['error']['message']);}logger['error'](_0x5855('0x10'),_0x24a06e,_0x7991b4[_0x5855('0xf')][_0x5855('0x11')]);return _0x5569ed(_0x7991b4[_0x5855('0xf')][_0x5855('0x11')]);}else{logger[_0x5855('0xb')](_0x5855('0x10'),_0x24a06e,_0x5855('0xc'));_0x5569ed(_0x7991b4[_0x5855('0x12')]['message']);}})['catch'](function(_0x1e1f08){logger['error']('Trigger,\x20%s,\x20%s',_0x24a06e,_0x1e1f08);_0x2044d6(_0x1e1f08);});});}exports[_0x5855('0x13')]=function(_0x3416c2){var _0x4e7f0e=this;return new Promise(function(_0x2cc9e8,_0x1bf4cc){return db['Trigger']['findAll']({'raw':_0x3416c2['options']?_0x3416c2[_0x5855('0x14')][_0x5855('0x15')]===undefined?!![]:![]:!![],'where':_0x3416c2[_0x5855('0x14')]?_0x3416c2[_0x5855('0x14')]['where']||null:null,'attributes':_0x3416c2[_0x5855('0x14')]?_0x3416c2[_0x5855('0x14')][_0x5855('0x16')]||null:null,'limit':_0x3416c2[_0x5855('0x14')]?_0x3416c2['options'][_0x5855('0x17')]||null:null,'include':_0x3416c2['options']?_0x3416c2[_0x5855('0x14')][_0x5855('0x18')]?_[_0x5855('0x19')](_0x3416c2[_0x5855('0x14')][_0x5855('0x18')],function(_0x330294){return{'model':db[_0x330294['model']],'as':_0x330294['as'],'attributes':_0x330294[_0x5855('0x16')],'include':_0x330294[_0x5855('0x18')]?_['map'](_0x330294[_0x5855('0x18')],function(_0x312e06){return{'model':db[_0x312e06[_0x5855('0x1a')]],'as':_0x312e06['as'],'attributes':_0x312e06[_0x5855('0x16')],'include':_0x312e06[_0x5855('0x18')]?_[_0x5855('0x19')](_0x312e06[_0x5855('0x18')],function(_0x1284dd){return{'model':db[_0x1284dd[_0x5855('0x1a')]],'as':_0x1284dd['as'],'attributes':_0x1284dd[_0x5855('0x16')]};}):[]};}):[]};}):[]:[]})[_0x5855('0xa')](function(_0x3522be){logger['info']('GetTrigger',_0x3416c2);logger[_0x5855('0xd')](_0x5855('0x13'),_0x3416c2,JSON[_0x5855('0x1b')](_0x3522be));_0x2cc9e8(_0x3522be);})['catch'](function(_0x3eaec3){logger[_0x5855('0xf')](_0x5855('0x13'),_0x3eaec3[_0x5855('0x11')],_0x3416c2);_0x1bf4cc(_0x4e7f0e['error'](0x1f4,_0x3eaec3[_0x5855('0x11')]));});});};exports[_0x5855('0x1c')]=function(_0x2675eb){var _0x10c896=this;return new Promise(function(_0x712414,_0x146d11){return db[_0x5855('0x1d')][_0x5855('0x1e')]({'raw':_0x2675eb[_0x5855('0x14')]?_0x2675eb['options'][_0x5855('0x15')]===undefined?!![]:![]:!![],'where':_0x2675eb[_0x5855('0x14')]?_0x2675eb['options'][_0x5855('0x1f')]||null:null,'attributes':_0x2675eb[_0x5855('0x14')]?_0x2675eb[_0x5855('0x14')][_0x5855('0x16')]||null:null,'include':_0x2675eb[_0x5855('0x14')]?_0x2675eb[_0x5855('0x14')][_0x5855('0x18')]?_[_0x5855('0x19')](_0x2675eb[_0x5855('0x14')][_0x5855('0x18')],function(_0x166920){return{'model':db[_0x166920['model']],'as':_0x166920['as'],'attributes':_0x166920[_0x5855('0x16')],'include':_0x166920[_0x5855('0x18')]?_['map'](_0x166920[_0x5855('0x18')],function(_0xc29467){return{'model':db[_0xc29467[_0x5855('0x1a')]],'as':_0xc29467['as'],'attributes':_0xc29467[_0x5855('0x16')],'include':_0xc29467['include']?_[_0x5855('0x19')](_0xc29467[_0x5855('0x18')],function(_0xa97048){return{'model':db[_0xa97048[_0x5855('0x1a')]],'as':_0xa97048['as'],'attributes':_0xa97048['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x218b20){logger['info'](_0x5855('0x1c'),_0x2675eb);logger[_0x5855('0xd')](_0x5855('0x1c'),_0x2675eb,JSON['stringify'](_0x218b20));_0x712414(_0x218b20);})[_0x5855('0x20')](function(_0x3df9cf){logger['error'](_0x5855('0x1c'),_0x3df9cf[_0x5855('0x11')],_0x2675eb);_0x146d11(_0x10c896[_0x5855('0xf')](0x1f4,_0x3df9cf[_0x5855('0x11')]));});});}; \ No newline at end of file +var _0xb70a=['info','catch','Trigger','options','raw','attributes','limit','map','include','model','GetTrigger','ShowTrigger','find','where','lodash','util','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x15eb24,_0x4d56cb){var _0x4fe404=function(_0x556999){while(--_0x556999){_0x15eb24['push'](_0x15eb24['shift']());}};_0x4fe404(++_0x4d56cb);}(_0xb70a,0x19a));var _0xab70=function(_0x1c0b52,_0xfe38f7){_0x1c0b52=_0x1c0b52-0x0;var _0x3730c9=_0xb70a[_0x1c0b52];return _0x3730c9;};'use strict';var _=require(_0xab70('0x0'));var util=require(_0xab70('0x1'));var moment=require('moment');var BPromise=require(_0xab70('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xab70('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xab70('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xab70('0x5'));var jayson=require(_0xab70('0x6'));var client=jayson[_0xab70('0x7')][_0xab70('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5236d2,_0x311ab6,_0x53bec6){return new BPromise(function(_0x26573a,_0x595531){return client[_0xab70('0x9')](_0x5236d2,_0x53bec6)[_0xab70('0xa')](function(_0x6e84e6){logger['info'](_0xab70('0xb'),_0x311ab6,_0xab70('0xc'));logger[_0xab70('0xd')](_0xab70('0xe'),_0x311ab6,_0xab70('0xc'),JSON[_0xab70('0xf')](_0x6e84e6));if(_0x6e84e6[_0xab70('0x10')]){if(_0x6e84e6[_0xab70('0x10')][_0xab70('0x11')]===0x1f4){logger['error'](_0xab70('0xb'),_0x311ab6,_0x6e84e6[_0xab70('0x10')][_0xab70('0x12')]);return _0x595531(_0x6e84e6['error'][_0xab70('0x12')]);}logger['error'](_0xab70('0xb'),_0x311ab6,_0x6e84e6[_0xab70('0x10')]['message']);return _0x26573a(_0x6e84e6[_0xab70('0x10')][_0xab70('0x12')]);}else{logger[_0xab70('0x13')](_0xab70('0xb'),_0x311ab6,_0xab70('0xc'));_0x26573a(_0x6e84e6['result']['message']);}})[_0xab70('0x14')](function(_0x4edb23){logger[_0xab70('0x10')](_0xab70('0xb'),_0x311ab6,_0x4edb23);_0x595531(_0x4edb23);});});}exports['GetTrigger']=function(_0x598c6a){var _0x5e3519=this;return new Promise(function(_0x25df2a,_0x2cdec5){return db[_0xab70('0x15')]['findAll']({'raw':_0x598c6a[_0xab70('0x16')]?_0x598c6a[_0xab70('0x16')][_0xab70('0x17')]===undefined?!![]:![]:!![],'where':_0x598c6a[_0xab70('0x16')]?_0x598c6a[_0xab70('0x16')]['where']||null:null,'attributes':_0x598c6a[_0xab70('0x16')]?_0x598c6a[_0xab70('0x16')][_0xab70('0x18')]||null:null,'limit':_0x598c6a['options']?_0x598c6a['options'][_0xab70('0x19')]||null:null,'include':_0x598c6a[_0xab70('0x16')]?_0x598c6a[_0xab70('0x16')]['include']?_[_0xab70('0x1a')](_0x598c6a[_0xab70('0x16')][_0xab70('0x1b')],function(_0x31109a){return{'model':db[_0x31109a[_0xab70('0x1c')]],'as':_0x31109a['as'],'attributes':_0x31109a['attributes'],'include':_0x31109a['include']?_[_0xab70('0x1a')](_0x31109a[_0xab70('0x1b')],function(_0x4cd87a){return{'model':db[_0x4cd87a[_0xab70('0x1c')]],'as':_0x4cd87a['as'],'attributes':_0x4cd87a[_0xab70('0x18')],'include':_0x4cd87a[_0xab70('0x1b')]?_[_0xab70('0x1a')](_0x4cd87a['include'],function(_0x2f09c7){return{'model':db[_0x2f09c7[_0xab70('0x1c')]],'as':_0x2f09c7['as'],'attributes':_0x2f09c7[_0xab70('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5219cc){logger[_0xab70('0x13')](_0xab70('0x1d'),_0x598c6a);logger['debug'](_0xab70('0x1d'),_0x598c6a,JSON[_0xab70('0xf')](_0x5219cc));_0x25df2a(_0x5219cc);})[_0xab70('0x14')](function(_0x5c49c0){logger[_0xab70('0x10')]('GetTrigger',_0x5c49c0[_0xab70('0x12')],_0x598c6a);_0x2cdec5(_0x5e3519[_0xab70('0x10')](0x1f4,_0x5c49c0['message']));});});};exports[_0xab70('0x1e')]=function(_0x40f8e4){var _0xf53b75=this;return new Promise(function(_0x53d8ab,_0x1ec57b){return db[_0xab70('0x15')][_0xab70('0x1f')]({'raw':_0x40f8e4[_0xab70('0x16')]?_0x40f8e4[_0xab70('0x16')][_0xab70('0x17')]===undefined?!![]:![]:!![],'where':_0x40f8e4[_0xab70('0x16')]?_0x40f8e4[_0xab70('0x16')][_0xab70('0x20')]||null:null,'attributes':_0x40f8e4['options']?_0x40f8e4[_0xab70('0x16')][_0xab70('0x18')]||null:null,'include':_0x40f8e4['options']?_0x40f8e4[_0xab70('0x16')][_0xab70('0x1b')]?_[_0xab70('0x1a')](_0x40f8e4[_0xab70('0x16')][_0xab70('0x1b')],function(_0x4e94b7){return{'model':db[_0x4e94b7[_0xab70('0x1c')]],'as':_0x4e94b7['as'],'attributes':_0x4e94b7[_0xab70('0x18')],'include':_0x4e94b7[_0xab70('0x1b')]?_['map'](_0x4e94b7['include'],function(_0x1bd6ad){return{'model':db[_0x1bd6ad[_0xab70('0x1c')]],'as':_0x1bd6ad['as'],'attributes':_0x1bd6ad[_0xab70('0x18')],'include':_0x1bd6ad['include']?_['map'](_0x1bd6ad[_0xab70('0x1b')],function(_0x45eb43){return{'model':db[_0x45eb43[_0xab70('0x1c')]],'as':_0x45eb43['as'],'attributes':_0x45eb43[_0xab70('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3bb69a){logger['info']('ShowTrigger',_0x40f8e4);logger[_0xab70('0xd')](_0xab70('0x1e'),_0x40f8e4,JSON[_0xab70('0xf')](_0x3bb69a));_0x53d8ab(_0x3bb69a);})['catch'](function(_0x598989){logger['error'](_0xab70('0x1e'),_0x598989[_0xab70('0x12')],_0x40f8e4);_0x1ec57b(_0xf53b75[_0xab70('0x10')](0x1f4,_0x598989['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index b0c108c..47eef29 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 _0x9538=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','post','/:id/clone','create','/:id','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x141f85,_0x165bcf){var _0x1056fa=function(_0x3ae81f){while(--_0x3ae81f){_0x141f85['push'](_0x141f85['shift']());}};_0x1056fa(++_0x165bcf);}(_0x9538,0x177));var _0x8953=function(_0x3fa8b2,_0x2d49a0){_0x3fa8b2=_0x3fa8b2-0x0;var _0x5863ba=_0x9538[_0x3fa8b2];return _0x5863ba;};'use strict';var multer=require(_0x8953('0x0'));var util=require(_0x8953('0x1'));var path=require(_0x8953('0x2'));var timeout=require(_0x8953('0x3'));var express=require(_0x8953('0x4'));var router=express['Router']();var fs_extra=require(_0x8953('0x5'));var auth=require(_0x8953('0x6'));var interaction=require(_0x8953('0x7'));var config=require(_0x8953('0x8'));var controller=require(_0x8953('0x9'));router[_0x8953('0xa')]('/',auth[_0x8953('0xb')](),controller[_0x8953('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x8953('0xd')](_0x8953('0xe'),auth[_0x8953('0xb')](),controller['clone']);router[_0x8953('0xd')]('/',auth[_0x8953('0xb')](),controller[_0x8953('0xf')]);router['put'](_0x8953('0x10'),auth[_0x8953('0xb')](),controller['update']);router[_0x8953('0x11')]('/:id',auth[_0x8953('0xb')](),controller['destroy']);module[_0x8953('0x12')]=router; \ No newline at end of file +var _0x5ac9=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','isAuthenticated','get','/:id','post','create','put','delete','destroy','util','path','connect-timeout'];(function(_0x3bc3b4,_0x5acff4){var _0x4c546b=function(_0x158717){while(--_0x158717){_0x3bc3b4['push'](_0x3bc3b4['shift']());}};_0x4c546b(++_0x5acff4);}(_0x5ac9,0x12f));var _0x95ac=function(_0x49bddc,_0x589c2a){_0x49bddc=_0x49bddc-0x0;var _0x273848=_0x5ac9[_0x49bddc];return _0x273848;};'use strict';var multer=require('multer');var util=require(_0x95ac('0x0'));var path=require(_0x95ac('0x1'));var timeout=require(_0x95ac('0x2'));var express=require(_0x95ac('0x3'));var router=express['Router']();var fs_extra=require(_0x95ac('0x4'));var auth=require(_0x95ac('0x5'));var interaction=require(_0x95ac('0x6'));var config=require(_0x95ac('0x7'));var controller=require(_0x95ac('0x8'));router['get']('/',auth[_0x95ac('0x9')](),controller['index']);router[_0x95ac('0xa')](_0x95ac('0xb'),auth[_0x95ac('0x9')](),controller['show']);router['post']('/:id/clone',auth['isAuthenticated'](),controller['clone']);router[_0x95ac('0xc')]('/',auth[_0x95ac('0x9')](),controller[_0x95ac('0xd')]);router[_0x95ac('0xe')](_0x95ac('0xb'),auth[_0x95ac('0x9')](),controller['update']);router[_0x95ac('0xf')](_0x95ac('0xb'),auth[_0x95ac('0x9')](),controller[_0x95ac('0x10')]);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 ccbbcd8..b265e2e 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 _0xe60c=['join','getDataValue','split','rfc2833','info','shortinfo','inband','auto','nonat','update','yes','force_rport,comedia','nat','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','always','accept','refuse','originate','uac','uas','pai','active','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport'];(function(_0x12871e,_0x14c5f4){var _0x9a263=function(_0x551fbd){while(--_0x551fbd){_0x12871e['push'](_0x12871e['shift']());}};_0x9a263(++_0x14c5f4);}(_0xe60c,0xed));var _0xce60=function(_0x118afa,_0x4bf0c1){_0x118afa=_0x118afa-0x0;var _0x167d76=_0xe60c[_0x118afa];return _0x167d76;};'use strict';var Sequelize=require(_0xce60('0x0'));module[_0xce60('0x1')]={'name':{'type':Sequelize[_0xce60('0x2')],'allowNull':![],'unique':_0xce60('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xce60('0x4')](_0xce60('0x5'),_0xce60('0x6'),_0xce60('0x7')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xce60('0x2')],'allowNull':![],'defaultValue':_0xce60('0x8')},'callingpres':{'type':Sequelize[_0xce60('0x4')](_0xce60('0x9'),'ALLOWED_PASSED_SCREEN',_0xce60('0xa'),_0xce60('0xb'),'PROHIB_NOT_SCREENED',_0xce60('0xc'),_0xce60('0xd'),_0xce60('0xe'))},'deny':{'type':Sequelize[_0xce60('0x2')]},'permit':{'type':Sequelize[_0xce60('0x2')]},'secret':{'type':Sequelize[_0xce60('0x2')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xce60('0x2')]},'transport':{'type':Sequelize[_0xce60('0x2')],'defaultValue':_0xce60('0xf'),'set':function(_0x3cd234){this[_0xce60('0x10')](_0xce60('0x11'),_0x3cd234?_0x3cd234[_0xce60('0x12')](','):null);},'get':function(){return this[_0xce60('0x13')](_0xce60('0x11'))?this[_0xce60('0x13')](_0xce60('0x11'))[_0xce60('0x14')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xce60('0x4')](_0xce60('0x15'),_0xce60('0x16'),_0xce60('0x17'),_0xce60('0x18'),_0xce60('0x19')),'defaultValue':_0xce60('0x15')},'directmedia':{'type':Sequelize[_0xce60('0x4')]('yes','no',_0xce60('0x1a'),_0xce60('0x1b'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xce60('0x4')](_0xce60('0x1c'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xce60('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xce60('0x2')],'defaultValue':_0xce60('0x1d'),'set':function(_0x22ff64){this[_0xce60('0x10')]('nat',_0x22ff64?_0x22ff64['join'](','):null);},'get':function(){return this[_0xce60('0x13')](_0xce60('0x1e'))?this[_0xce60('0x13')](_0xce60('0x1e'))[_0xce60('0x14')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xce60('0x2')]},'pickupgroup':{'type':Sequelize[_0xce60('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xce60('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xce60('0x2')],'defaultValue':_0xce60('0x1f')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x37e1ac){this[_0xce60('0x10')](_0xce60('0x20'),_0x37e1ac?_0x37e1ac[_0xce60('0x12')](';'):_0xce60('0x21'));},'get':function(){return this[_0xce60('0x13')](_0xce60('0x20'))?this[_0xce60('0x13')](_0xce60('0x20'))[_0xce60('0x14')](';'):null;},'comment':_0xce60('0x22')},'autoframing':{'type':Sequelize['ENUM']('yes','no')},'insecure':{'type':Sequelize[_0xce60('0x2')],'defaultValue':'port,invite','set':function(_0x5d9884){this['setDataValue'](_0xce60('0x23'),_0x5d9884?_0x5d9884['join'](','):null);},'get':function(){return this[_0xce60('0x13')]('insecure')?this['getDataValue'](_0xce60('0x23'))['split'](','):null;},'comment':_0xce60('0x24')},'trustrpid':{'type':Sequelize['ENUM'](_0xce60('0x1c'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xce60('0x4')](_0xce60('0x1c'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xce60('0x4')]('yes','no',_0xce60('0x25'))},'promiscredir':{'type':Sequelize['ENUM'](_0xce60('0x1c'),'no')},'useclientcode':{'type':Sequelize[_0xce60('0x4')]('yes','no')},'accountcode':{'type':Sequelize[_0xce60('0x26')](0xb)},'setvar':{'type':Sequelize[_0xce60('0x2')]},'callerid':{'type':Sequelize[_0xce60('0x2')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xce60('0x1c')},'busylevel':{'type':Sequelize[_0xce60('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0xce60('0x4')](_0xce60('0x1c'),'no')},'allowsubscribe':{'type':Sequelize[_0xce60('0x4')](_0xce60('0x1c'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0xce60('0x1c'),'no')},'ignoresdpversion':{'type':Sequelize[_0xce60('0x4')](_0xce60('0x1c'),'no')},'subscribecontext':{'type':Sequelize[_0xce60('0x2')]},'template':{'type':Sequelize[_0xce60('0x2')]},'videosupport':{'type':Sequelize['ENUM'](_0xce60('0x1c'),'no',_0xce60('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xce60('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xce60('0x4')](_0xce60('0x1c'),'no')},'mailbox':{'type':Sequelize[_0xce60('0x2')]},'session_timers':{'type':Sequelize['ENUM'](_0xce60('0x28'),_0xce60('0x29'),_0xce60('0x2a'))},'session_expires':{'type':Sequelize[_0xce60('0x26')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xce60('0x4')](_0xce60('0x2b'),_0xce60('0x2c')),'defaultValue':_0xce60('0x2c')},'t38pt_usertpsource':{'type':Sequelize[_0xce60('0x2')]},'regexten':{'type':Sequelize[_0xce60('0x2')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0xce60('0x4')](_0xce60('0x1c'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xce60('0x2')]},'defaultuser':{'type':Sequelize[_0xce60('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xce60('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0xce60('0x4')](_0xce60('0x1c'),'no',_0xce60('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xce60('0x26')](0xb)},'timerb':{'type':Sequelize[_0xce60('0x26')](0xb)},'qualifyfreq':{'type':Sequelize[_0xce60('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0xce60('0x2')]},'contactdeny':{'type':Sequelize[_0xce60('0x2')]},'contactacl':{'type':Sequelize[_0xce60('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xce60('0x2')]},'use_q850_reason':{'type':Sequelize[_0xce60('0x2')]},'maxforwards':{'type':Sequelize[_0xce60('0x26')](0xb)},'encryption':{'type':Sequelize[_0xce60('0x4')](_0xce60('0x1c'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xce60('0x4')]('yes','no')},'force_avp':{'type':Sequelize[_0xce60('0x4')](_0xce60('0x1c'),'no')},'icesupport':{'type':Sequelize[_0xce60('0x4')]('yes','no')},'dtlsenable':{'type':Sequelize['ENUM']('yes','no')},'dtlsverify':{'type':Sequelize['ENUM'](_0xce60('0x1c'),'no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize[_0xce60('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0xce60('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0xce60('0x2')]},'dtlscafile':{'type':Sequelize[_0xce60('0x2')]},'dtlscapath':{'type':Sequelize[_0xce60('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xce60('0x2e'),'passive',_0xce60('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize['ENUM'](_0xce60('0x1c'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xce60('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xce60('0x4')](_0xce60('0x1c'),'no')},'subscribemwi':{'type':Sequelize[_0xce60('0x4')](_0xce60('0x1c'),'no')},'vmexten':{'type':Sequelize[_0xce60('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0xce60('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xce60('0x2')],'defaultValue':_0xce60('0x30')},'canreinvite':{'type':Sequelize['ENUM'](_0xce60('0x1c'),'no',_0xce60('0x1a'),_0xce60('0x1b'),_0xce60('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xce60('0x2')]},'otherFields':{'type':Sequelize[_0xce60('0x2')]},'active':{'type':Sequelize[_0xce60('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xce60('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x9ab2=['update','outgoing','force_rport,comedia','nat','split','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]','never','\x22\x22\x20<>','INTEGER','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','ENUM','user','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','inband','auto','yes','nonat'];(function(_0x2bb368,_0x4d133d){var _0x1a67d6=function(_0x53f85f){while(--_0x53f85f){_0x2bb368['push'](_0x2bb368['shift']());}};_0x1a67d6(++_0x4d133d);}(_0x9ab2,0xc4));var _0x29ab=function(_0x5b8773,_0x277655){_0x5b8773=_0x5b8773-0x0;var _0x1d4c91=_0x9ab2[_0x5b8773];return _0x1d4c91;};'use strict';var Sequelize=require(_0x29ab('0x0'));module[_0x29ab('0x1')]={'name':{'type':Sequelize[_0x29ab('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x29ab('0x3')]('friend',_0x29ab('0x4'),'peer'),'allowNull':![],'defaultValue':_0x29ab('0x5')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x29ab('0x6')},'callingpres':{'type':Sequelize['ENUM'](_0x29ab('0x7'),_0x29ab('0x8'),_0x29ab('0x9'),_0x29ab('0xa'),_0x29ab('0xb'),'PROHIB_PASSED_SCREEN',_0x29ab('0xc'),_0x29ab('0xd'))},'deny':{'type':Sequelize[_0x29ab('0x2')]},'permit':{'type':Sequelize[_0x29ab('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x29ab('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x29ab('0x2')],'defaultValue':'udp','set':function(_0xca3f12){this[_0x29ab('0xe')](_0x29ab('0xf'),_0xca3f12?_0xca3f12[_0x29ab('0x10')](','):null);},'get':function(){return this[_0x29ab('0x11')](_0x29ab('0xf'))?this[_0x29ab('0x11')](_0x29ab('0xf'))['split'](','):null;},'comment':_0x29ab('0x12')},'dtmfmode':{'type':Sequelize[_0x29ab('0x3')]('rfc2833',_0x29ab('0x13'),'shortinfo',_0x29ab('0x14'),_0x29ab('0x15')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x29ab('0x3')](_0x29ab('0x16'),'no',_0x29ab('0x17'),_0x29ab('0x18'),_0x29ab('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x29ab('0x3')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x29ab('0x2')]},'nat':{'type':Sequelize[_0x29ab('0x2')],'defaultValue':_0x29ab('0x1a'),'set':function(_0x3600ce){this[_0x29ab('0xe')](_0x29ab('0x1b'),_0x3600ce?_0x3600ce[_0x29ab('0x10')](','):null);},'get':function(){return this[_0x29ab('0x11')]('nat')?this[_0x29ab('0x11')](_0x29ab('0x1b'))[_0x29ab('0x1c')](','):null;},'comment':_0x29ab('0x1d')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x29ab('0x2')]},'language':{'type':Sequelize[_0x29ab('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x29ab('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x29ab('0x2')],'defaultValue':_0x29ab('0x1e')},'allow':{'type':Sequelize[_0x29ab('0x2')],'allowNull':![],'defaultValue':_0x29ab('0x1f'),'set':function(_0x8cd9d0){this[_0x29ab('0xe')](_0x29ab('0x20'),_0x8cd9d0?_0x8cd9d0[_0x29ab('0x10')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x29ab('0x11')](_0x29ab('0x20'))?this['getDataValue'](_0x29ab('0x20'))[_0x29ab('0x1c')](';'):null;},'comment':_0x29ab('0x21')},'autoframing':{'type':Sequelize['ENUM'](_0x29ab('0x16'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x29ab('0x22'),'set':function(_0x40e549){this['setDataValue'](_0x29ab('0x23'),_0x40e549?_0x40e549[_0x29ab('0x10')](','):null);},'get':function(){return this[_0x29ab('0x11')]('insecure')?this[_0x29ab('0x11')](_0x29ab('0x23'))[_0x29ab('0x1c')](','):null;},'comment':_0x29ab('0x24')},'trustrpid':{'type':Sequelize['ENUM'](_0x29ab('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x29ab('0x3')](_0x29ab('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0x29ab('0x25'))},'promiscredir':{'type':Sequelize[_0x29ab('0x3')](_0x29ab('0x16'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x29ab('0x16'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x29ab('0x2')]},'callerid':{'type':Sequelize[_0x29ab('0x2')],'defaultValue':_0x29ab('0x26')},'amaflags':{'type':Sequelize[_0x29ab('0x2')]},'callcounter':{'type':Sequelize[_0x29ab('0x3')](_0x29ab('0x16'),'no'),'defaultValue':_0x29ab('0x16')},'busylevel':{'type':Sequelize[_0x29ab('0x27')](0xb)},'allowoverlap':{'type':Sequelize[_0x29ab('0x3')](_0x29ab('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0x29ab('0x3')](_0x29ab('0x16'),'no')},'allowtransfer':{'type':Sequelize[_0x29ab('0x3')](_0x29ab('0x16'),'no')},'ignoresdpversion':{'type':Sequelize[_0x29ab('0x3')](_0x29ab('0x16'),'no')},'subscribecontext':{'type':Sequelize[_0x29ab('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x29ab('0x3')](_0x29ab('0x16'),'no',_0x29ab('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x29ab('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x29ab('0x3')]('yes','no')},'mailbox':{'type':Sequelize[_0x29ab('0x2')]},'session_timers':{'type':Sequelize[_0x29ab('0x3')](_0x29ab('0x29'),_0x29ab('0x2a'),_0x29ab('0x2b'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x29ab('0x3')](_0x29ab('0x2c'),_0x29ab('0x2d')),'defaultValue':_0x29ab('0x2d')},'t38pt_usertpsource':{'type':Sequelize[_0x29ab('0x2')]},'regexten':{'type':Sequelize[_0x29ab('0x2')]},'fromdomain':{'type':Sequelize[_0x29ab('0x2')]},'fromuser':{'type':Sequelize[_0x29ab('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x29ab('0x3')]('yes','no'),'defaultValue':_0x29ab('0x16')},'keepalive':{'type':Sequelize[_0x29ab('0x27')](0xb)},'defaultip':{'type':Sequelize[_0x29ab('0x2')]},'defaultuser':{'type':Sequelize[_0x29ab('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x29ab('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x29ab('0x27')](0xb)},'sendrpid':{'type':Sequelize[_0x29ab('0x3')](_0x29ab('0x16'),'no',_0x29ab('0x2e')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x29ab('0x2')]},'timert1':{'type':Sequelize[_0x29ab('0x27')](0xb)},'timerb':{'type':Sequelize[_0x29ab('0x27')](0xb)},'qualifyfreq':{'type':Sequelize[_0x29ab('0x27')](0xb)},'contactpermit':{'type':Sequelize[_0x29ab('0x2')]},'contactdeny':{'type':Sequelize[_0x29ab('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x29ab('0x2')]},'use_q850_reason':{'type':Sequelize[_0x29ab('0x2')]},'maxforwards':{'type':Sequelize[_0x29ab('0x27')](0xb)},'encryption':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x29ab('0x16'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x29ab('0x16'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x29ab('0x16'),'no')},'dtlsenable':{'type':Sequelize[_0x29ab('0x3')](_0x29ab('0x16'),'no')},'dtlsverify':{'type':Sequelize[_0x29ab('0x3')](_0x29ab('0x16'),'no',_0x29ab('0x2f'),_0x29ab('0x30'))},'dtlsrekey':{'type':Sequelize[_0x29ab('0x27')](0xb)},'dtlscertfile':{'type':Sequelize[_0x29ab('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x29ab('0x2')]},'dtlscipher':{'type':Sequelize[_0x29ab('0x2')]},'dtlscafile':{'type':Sequelize[_0x29ab('0x2')]},'dtlscapath':{'type':Sequelize[_0x29ab('0x2')]},'dtlssetup':{'type':Sequelize[_0x29ab('0x3')](_0x29ab('0x31'),_0x29ab('0x32'),_0x29ab('0x33')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x29ab('0x3')](_0x29ab('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x29ab('0x2')]},'recordofffeature':{'type':Sequelize[_0x29ab('0x2')]},'call_limit':{'type':Sequelize[_0x29ab('0x27')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x29ab('0x3')](_0x29ab('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0x29ab('0x3')](_0x29ab('0x16'),'no')},'vmexten':{'type':Sequelize[_0x29ab('0x2')]},'mohinterpret':{'type':Sequelize[_0x29ab('0x2')]},'mohsuggest':{'type':Sequelize[_0x29ab('0x2')]},'parkinglot':{'type':Sequelize[_0x29ab('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x29ab('0x2')],'defaultValue':_0x29ab('0x34')},'canreinvite':{'type':Sequelize[_0x29ab('0x3')](_0x29ab('0x16'),'no','nonat',_0x29ab('0x18'),_0x29ab('0x35')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x29ab('0x2')]},'otherFields':{'type':Sequelize[_0x29ab('0x2')]},'active':{'type':Sequelize[_0x29ab('0x36')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x29ab('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 e8d04c4..2a36260 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 _0x425d=['readFileSync','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','UserProfileSection','userProfileId','/etc/asterisk/sip_xcally_trunks.conf','destroy','eml-format','zip-dir','fast-json-patch','request-promise','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','Trunk,\x20%s,\x20%s','result','catch','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','get','Trunks','UserProfileResource','stack','name','send','index','map','Trunk','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','clone','find','omit','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8'];(function(_0x3e3587,_0x40d185){var _0x1bc608=function(_0x470499){while(--_0x470499){_0x3e3587['push'](_0x3e3587['shift']());}};_0x1bc608(++_0x40d185);}(_0x425d,0x1e0));var _0xd425=function(_0xdbbb14,_0x140263){_0xdbbb14=_0xdbbb14-0x0;var _0x3c3585=_0x425d[_0xdbbb14];return _0x3c3585;};'use strict';var emlformat=require(_0xd425('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd425('0x1'));var jsonpatch=require(_0xd425('0x2'));var rp=require(_0xd425('0x3'));var moment=require(_0xd425('0x4'));var BPromise=require(_0xd425('0x5'));var Mustache=require(_0xd425('0x6'));var util=require(_0xd425('0x7'));var path=require('path');var sox=require(_0xd425('0x8'));var csv=require(_0xd425('0x9'));var ejs=require(_0xd425('0xa'));var fs=require('fs');var fs_extra=require(_0xd425('0xb'));var _=require(_0xd425('0xc'));var squel=require(_0xd425('0xd'));var crypto=require('crypto');var jsforce=require(_0xd425('0xe'));var deskjs=require(_0xd425('0xf'));var toCsv=require(_0xd425('0x9'));var querystring=require(_0xd425('0x10'));var Papa=require(_0xd425('0x11'));var Redis=require(_0xd425('0x12'));var authService=require(_0xd425('0x13'));var qs=require(_0xd425('0x14'));var as=require(_0xd425('0x15'));var hardwareService=require(_0xd425('0x16'));var logger=require(_0xd425('0x17'))(_0xd425('0x18'));var utils=require(_0xd425('0x19'));var config=require(_0xd425('0x1a'));var licenseUtil=require(_0xd425('0x1b'));var db=require(_0xd425('0x1c'))['db'];var jayson=require(_0xd425('0x1d'));var client=jayson[_0xd425('0x1e')][_0xd425('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x18eafb,_0x51263f,_0x27318c,_0x17a498){return new BPromise(function(_0x336dc3,_0x5d3d60){var _0x309263=_0x17a498||client;return _0x309263[_0xd425('0x20')](_0x18eafb,_0x27318c)[_0xd425('0x21')](function(_0x41f34d){logger[_0xd425('0x22')]('Trunk,\x20%s,\x20%s',_0x51263f,_0xd425('0x23'));logger[_0xd425('0x24')](_0xd425('0x25'),_0x51263f,_0xd425('0x23'),JSON['stringify'](_0x41f34d));if(_0x41f34d[_0xd425('0x26')]){if(_0x41f34d[_0xd425('0x26')][_0xd425('0x27')]===0x1f4){logger[_0xd425('0x26')]('Trunk,\x20%s,\x20%s',_0x51263f,_0x41f34d['error']['message']);return _0x5d3d60(_0x41f34d['error'][_0xd425('0x28')]);}logger[_0xd425('0x26')](_0xd425('0x29'),_0x51263f,_0x41f34d['error'][_0xd425('0x28')]);return _0x336dc3(_0x41f34d[_0xd425('0x26')]['message']);}else{logger[_0xd425('0x22')](_0xd425('0x29'),_0x51263f,_0xd425('0x23'));_0x336dc3(_0x41f34d[_0xd425('0x2a')][_0xd425('0x28')]);}})[_0xd425('0x2b')](function(_0x2480a0){logger[_0xd425('0x26')](_0xd425('0x29'),_0x51263f,_0x2480a0);_0x5d3d60(_0x2480a0);});});}function respondWithStatusCode(_0x2b030b,_0x151ad9){_0x151ad9=_0x151ad9||0xcc;return function(_0x40e84b){if(_0x40e84b){return _0x2b030b['sendStatus'](_0x151ad9);}return _0x2b030b[_0xd425('0x2c')](_0x151ad9)[_0xd425('0x2d')]();};}function respondWithResult(_0x398985,_0x1908a5){_0x1908a5=_0x1908a5||0xc8;return function(_0x2afcdb){if(_0x2afcdb){return _0x398985[_0xd425('0x2c')](_0x1908a5)[_0xd425('0x2e')](_0x2afcdb);}};}function respondWithFilteredResult(_0x577e4b,_0x12f951){return function(_0x177de2){if(_0x177de2){var _0x1d8861=typeof _0x12f951['offset']===_0xd425('0x2f')&&typeof _0x12f951[_0xd425('0x30')]===_0xd425('0x2f');var _0x999fb9=_0x177de2[_0xd425('0x31')];var _0x185d7e=_0x1d8861?0x0:_0x12f951[_0xd425('0x32')];var _0x37b63c=_0x1d8861?_0x177de2[_0xd425('0x31')]:_0x12f951[_0xd425('0x32')]+_0x12f951['limit'];var _0x471e3e;if(_0x37b63c>=_0x999fb9){_0x37b63c=_0x999fb9;_0x471e3e=0xc8;}else{_0x471e3e=0xce;}_0x577e4b[_0xd425('0x2c')](_0x471e3e);return _0x577e4b[_0xd425('0x33')](_0xd425('0x34'),_0x185d7e+'-'+_0x37b63c+'/'+_0x999fb9)[_0xd425('0x2e')](_0x177de2);}return null;};}function patchUpdates(_0x1abf33){return function(_0x47405f){try{jsonpatch[_0xd425('0x35')](_0x47405f,_0x1abf33,!![]);}catch(_0x3ec51b){return BPromise[_0xd425('0x36')](_0x3ec51b);}return _0x47405f[_0xd425('0x37')]();};}function saveUpdates(_0x5f3dab,_0x316493){return function(_0x2a2a9b){if(_0x2a2a9b){return _0x2a2a9b[_0xd425('0x38')](_0x5f3dab)[_0xd425('0x21')](function(_0x28870f){return _0x28870f;});}return null;};}function removeEntity(_0x4eddbc,_0x4aa168){return function(_0x3badcc){if(_0x3badcc){return _0x3badcc['destroy']()['then'](function(){var _0x51669d=_0x3badcc[_0xd425('0x39')]({'plain':!![]});var _0xfb0c8=_0xd425('0x3a');return db[_0xd425('0x3b')]['destroy']({'where':{'type':_0xfb0c8,'resourceId':_0x51669d['id']}})[_0xd425('0x21')](function(){return _0x3badcc;});})[_0xd425('0x21')](function(){_0x4eddbc[_0xd425('0x2c')](0xcc)[_0xd425('0x2d')]();});}};}function handleEntityNotFound(_0x27b9e2,_0x1e12f2){return function(_0x35bbec){if(!_0x35bbec){_0x27b9e2['sendStatus'](0x194);}return _0x35bbec;};}function handleError(_0x363fb0,_0x59b3d3){_0x59b3d3=_0x59b3d3||0x1f4;return function(_0x22df81){logger[_0xd425('0x26')](_0x22df81[_0xd425('0x3c')]);if(_0x22df81['name']){delete _0x22df81[_0xd425('0x3d')];}_0x363fb0[_0xd425('0x2c')](_0x59b3d3)[_0xd425('0x3e')](_0x22df81);};}exports[_0xd425('0x3f')]=function(_0x58f36d,_0x1d38fa){var _0x3cf540={},_0x59e326={},_0x5d310e={'count':0x0,'rows':[]};var _0x48fc85=_[_0xd425('0x40')](db[_0xd425('0x41')][_0xd425('0x42')],function(_0x588688){return{'name':_0x588688['fieldName'],'type':_0x588688['type'][_0xd425('0x43')]};});_0x59e326[_0xd425('0x44')]=_[_0xd425('0x40')](_0x48fc85,_0xd425('0x3d'));_0x59e326[_0xd425('0x45')]=_[_0xd425('0x46')](_0x58f36d[_0xd425('0x45')]);_0x59e326['filters']=_[_0xd425('0x47')](_0x59e326[_0xd425('0x44')],_0x59e326[_0xd425('0x45')]);_0x3cf540['attributes']=_[_0xd425('0x47')](_0x59e326[_0xd425('0x44')],qs[_0xd425('0x48')](_0x58f36d['query'][_0xd425('0x48')]));_0x3cf540[_0xd425('0x49')]=_0x3cf540[_0xd425('0x49')][_0xd425('0x4a')]?_0x3cf540['attributes']:_0x59e326[_0xd425('0x44')];if(!_0x58f36d[_0xd425('0x45')][_0xd425('0x4b')](_0xd425('0x4c'))){_0x3cf540[_0xd425('0x30')]=qs[_0xd425('0x30')](_0x58f36d[_0xd425('0x45')]['limit']);_0x3cf540[_0xd425('0x32')]=qs[_0xd425('0x32')](_0x58f36d['query'][_0xd425('0x32')]);}_0x3cf540['order']=qs['sort'](_0x58f36d[_0xd425('0x45')]['sort']);_0x3cf540[_0xd425('0x4d')]=qs['filters'](_[_0xd425('0x4e')](_0x58f36d[_0xd425('0x45')],_0x59e326[_0xd425('0x4f')]),_0x48fc85);if(_0x58f36d[_0xd425('0x45')][_0xd425('0x50')]){_0x3cf540['where']=_[_0xd425('0x51')](_0x3cf540['where'],{'$or':_[_0xd425('0x40')](_0x48fc85,function(_0x55a15d){if(_0x55a15d[_0xd425('0x52')]!==_0xd425('0x53')){var _0x3fd2ce={};_0x3fd2ce[_0x55a15d[_0xd425('0x3d')]]={'$like':'%'+_0x58f36d[_0xd425('0x45')]['filter']+'%'};return _0x3fd2ce;}})});}_0x3cf540=_[_0xd425('0x51')]({},_0x3cf540,_0x58f36d[_0xd425('0x54')]);var _0x35e77b={'where':_0x3cf540[_0xd425('0x4d')]};return db[_0xd425('0x41')]['count'](_0x35e77b)[_0xd425('0x21')](function(_0x177704){_0x5d310e[_0xd425('0x31')]=_0x177704;if(_0x58f36d[_0xd425('0x45')][_0xd425('0x55')]){_0x3cf540[_0xd425('0x56')]=[{'all':!![]}];}return db['Trunk'][_0xd425('0x57')](_0x3cf540);})[_0xd425('0x21')](function(_0x5bfac6){_0x5d310e[_0xd425('0x58')]=_0x5bfac6;return _0x5d310e;})[_0xd425('0x21')](respondWithFilteredResult(_0x1d38fa,_0x3cf540))[_0xd425('0x2b')](handleError(_0x1d38fa,null));};exports[_0xd425('0x59')]=function(_0x5c0219,_0x54f1d){var _0x2b8882={'raw':![],'where':{'id':_0x5c0219[_0xd425('0x5a')]['id']}},_0x4552cd={};_0x4552cd[_0xd425('0x44')]=_['keys'](db['Trunk'][_0xd425('0x42')]);_0x4552cd['query']=_[_0xd425('0x46')](_0x5c0219[_0xd425('0x45')]);_0x4552cd['filters']=_[_0xd425('0x47')](_0x4552cd['model'],_0x4552cd['query']);_0x2b8882[_0xd425('0x49')]=_[_0xd425('0x47')](_0x4552cd[_0xd425('0x44')],qs[_0xd425('0x48')](_0x5c0219[_0xd425('0x45')][_0xd425('0x48')]));_0x2b8882[_0xd425('0x49')]=_0x2b8882[_0xd425('0x49')]['length']?_0x2b8882[_0xd425('0x49')]:_0x4552cd[_0xd425('0x44')];if(_0x5c0219[_0xd425('0x45')][_0xd425('0x55')]){_0x2b8882[_0xd425('0x56')]=[{'all':!![]}];}_0x2b8882=_[_0xd425('0x51')]({},_0x2b8882,_0x5c0219[_0xd425('0x54')]);return db[_0xd425('0x41')]['find'](_0x2b8882)['then'](handleEntityNotFound(_0x54f1d,null))['then'](respondWithResult(_0x54f1d,null))[_0xd425('0x2b')](handleError(_0x54f1d,null));};exports[_0xd425('0x5b')]=function(_0x3dec61,_0x3c6b49){var _0x59c286={'where':{'id':_0x3dec61['params']['id']}},_0x4fedc0={};_0x4fedc0['model']=_[_0xd425('0x46')](db[_0xd425('0x41')]['rawAttributes']);_0x59c286[_0xd425('0x49')]=_[_0xd425('0x47')](_0x4fedc0[_0xd425('0x44')],qs['fields'](_0x3dec61['query'][_0xd425('0x48')]));_0x59c286['attributes']=_0x59c286['attributes']['length']?_0x59c286[_0xd425('0x49')]:_0x4fedc0[_0xd425('0x44')];if(_0x3dec61[_0xd425('0x45')]['includeAll']){_0x59c286[_0xd425('0x56')]=[{'all':!![]}];}_0x59c286=_['merge']({},_0x59c286,_0x3dec61[_0xd425('0x54')]);return db[_0xd425('0x41')][_0xd425('0x5c')](_0x59c286)[_0xd425('0x21')](handleEntityNotFound(_0x3c6b49,null))[_0xd425('0x21')](function(_0xd261a){if(_0xd261a){var _0xa21f7c=_0xd261a[_0xd425('0x39')]({'plain':!![]});_0xa21f7c=qs[_0xd425('0x5d')](_0xa21f7c,['id','createdAt',_0xd425('0x5e')]);_0x3dec61[_0xd425('0x5f')]=_[_0xd425('0x5d')](_0x3dec61[_0xd425('0x5f')],['id','createdAt','updatedAt']);return db[_0xd425('0x41')][_0xd425('0x60')](_[_0xd425('0x51')](_0xa21f7c,_0x3dec61[_0xd425('0x5f')]),{'include':_0x3dec61[_0xd425('0x45')][_0xd425('0x55')]?[{'all':!![]}]:undefined})[_0xd425('0x21')](function(_0x44782a){var _0x1fcde4=_0x3dec61[_0xd425('0x61')][_0xd425('0x39')]({'plain':!![]});if(!_0x1fcde4)throw new Error(_0xd425('0x62'));if(_0x1fcde4[_0xd425('0x63')]===_0xd425('0x61')){var _0x5e72db=_0x44782a[_0xd425('0x39')]({'plain':!![]});var _0x343cc1=_0xd425('0x3a');return db['UserProfileSection']['find']({'where':{'name':_0x343cc1,'userProfileId':_0x1fcde4['userProfileId']},'raw':!![]})[_0xd425('0x21')](function(_0x34d065){if(_0x34d065&&_0x34d065[_0xd425('0x64')]===0x0){return db['UserProfileResource'][_0xd425('0x60')]({'name':_0x5e72db['name'],'resourceId':_0x5e72db['id'],'type':_0x34d065[_0xd425('0x3d')],'sectionId':_0x34d065['id']},{})[_0xd425('0x21')](function(){return _0x44782a;});}else{return _0x44782a;}})[_0xd425('0x2b')](function(_0x5113fc){logger[_0xd425('0x26')](_0xd425('0x65'),_0x5113fc);throw _0x5113fc;});}return _0x44782a;});}})[_0xd425('0x21')](respondWithResult(_0x3c6b49,0xc9))[_0xd425('0x2b')](handleError(_0x3c6b49,null));};exports[_0xd425('0x60')]=function(_0x43b1a9,_0x38a762,_0x44db7f){var _0xcb1a64;return db[_0xd425('0x41')][_0xd425('0x60')](_0x43b1a9[_0xd425('0x5f')],{'raw':!![]})[_0xd425('0x21')](function(_0x285d54){_0xcb1a64=_0x285d54;return db[_0xd425('0x41')][_0xd425('0x57')]({'raw':!![]});})[_0xd425('0x21')](function(_0x25cae6){var _0x541218=fs['readFileSync'](path[_0xd425('0x66')](config['root'],_0xd425('0x67')),_0xd425('0x68'));var _0xb407bb=fs[_0xd425('0x69')](path['join'](config[_0xd425('0x6a')],_0xd425('0x6b')),_0xd425('0x68'));var _0x689332=ejs[_0xd425('0x6c')](_0x541218,{'trunks':_0x25cae6||[]});fs[_0xd425('0x6d')]('/etc/asterisk/sip_xcally_trunks.conf',_0x689332);if(_0xcb1a64['registry']){var _0x3ccffe=ejs[_0xd425('0x6c')](_0xb407bb,{'trunks':_0x25cae6||[]});fs['writeFileSync'](_0xd425('0x6e'),_0x3ccffe);}})['then'](function(){return respondWithRpcPromise(_0xd425('0x6f'),_0xd425('0x60'),{'module':_0xd425('0x70')});})[_0xd425('0x21')](function(){var _0x376134=_0x43b1a9[_0xd425('0x61')][_0xd425('0x39')]({'plain':!![]});if(!_0x376134)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x376134[_0xd425('0x63')]===_0xd425('0x61')){var _0x24af3=_0xcb1a64[_0xd425('0x39')]({'plain':!![]});return db[_0xd425('0x71')]['find']({'where':{'name':_0xd425('0x3a'),'userProfileId':_0x376134[_0xd425('0x72')]},'raw':!![]})['then'](function(_0x2bb36f){if(_0x2bb36f&&_0x2bb36f[_0xd425('0x64')]===0x0){return db['UserProfileResource'][_0xd425('0x60')]({'name':_0x24af3[_0xd425('0x3d')],'resourceId':_0x24af3['id'],'type':_0x2bb36f[_0xd425('0x3d')],'sectionId':_0x2bb36f['id']},{})[_0xd425('0x21')](function(){return _0xcb1a64;});}else{return _0xcb1a64;}})[_0xd425('0x2b')](function(_0x572f23){logger[_0xd425('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x572f23);throw _0x572f23;});}return _0xcb1a64;})[_0xd425('0x21')](respondWithResult(_0x38a762,0xc9))[_0xd425('0x2b')](handleError(_0x38a762,null));};exports['update']=function(_0x2bf8e6,_0xcf7b51,_0x66d87b){var _0x1fc64d;return db['Trunk']['find']({'where':{'id':_0x2bf8e6[_0xd425('0x5a')]['id']}})[_0xd425('0x21')](handleEntityNotFound(_0xcf7b51,null))[_0xd425('0x21')](saveUpdates(_0x2bf8e6['body'],null))[_0xd425('0x21')](function(_0xb1479e){if(_0xb1479e){_0x1fc64d=_0xb1479e;return db['Trunk'][_0xd425('0x57')]({'raw':!![]});}})['then'](function(_0x998ad1){if(_0x998ad1){var _0x46346c=fs[_0xd425('0x69')](path[_0xd425('0x66')](config['root'],'server/files/templates/trunk.ejs'),_0xd425('0x68'));var _0x413a65=fs['readFileSync'](path[_0xd425('0x66')](config[_0xd425('0x6a')],'server/files/templates/registry.ejs'),_0xd425('0x68'));var _0x369f8b=ejs[_0xd425('0x6c')](_0x46346c,{'trunks':_0x998ad1||[]});fs[_0xd425('0x6d')](_0xd425('0x73'),_0x369f8b);var _0xf251e6=ejs[_0xd425('0x6c')](_0x413a65,{'trunks':_0x998ad1||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0xf251e6);return respondWithRpcPromise(_0xd425('0x6f'),'update',{'module':_0xd425('0x70')});}return null;})[_0xd425('0x21')](function(_0x58cad5){if(_0x58cad5){return _0x1fc64d;}})[_0xd425('0x21')](respondWithResult(_0xcf7b51,null))[_0xd425('0x2b')](handleError(_0xcf7b51,null));};exports['destroy']=function(_0x592c40,_0x750685,_0x242ed8){var _0x16eac6;return db[_0xd425('0x41')][_0xd425('0x5c')]({'where':{'id':_0x592c40[_0xd425('0x5a')]['id']}})[_0xd425('0x21')](handleEntityNotFound(_0x750685,null))[_0xd425('0x21')](removeEntity(_0x750685,null))['then'](function(){return db[_0xd425('0x41')][_0xd425('0x57')]({'raw':!![]});})['then'](function(_0x2bbcf3){var _0x1d386c=fs[_0xd425('0x69')](path[_0xd425('0x66')](config[_0xd425('0x6a')],_0xd425('0x67')),_0xd425('0x68'));var _0x2c3995=fs[_0xd425('0x69')](path[_0xd425('0x66')](config[_0xd425('0x6a')],'server/files/templates/registry.ejs'),_0xd425('0x68'));var _0x498e81=ejs['render'](_0x1d386c,{'trunks':_0x2bbcf3});var _0x2c8d63=ejs['render'](_0x2c3995,{'trunks':_0x2bbcf3});fs[_0xd425('0x6d')](_0xd425('0x73'),_0x498e81);fs[_0xd425('0x6d')](_0xd425('0x6e'),_0x2c8d63);return respondWithRpcPromise(_0xd425('0x6f'),_0xd425('0x74'),{'module':_0xd425('0x70')});})['catch'](handleError(_0x750685,null));}; \ No newline at end of file +var _0xe14d=['options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','omit','createdAt','updatedAt','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','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','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','UserProfileSection','autoAssociation','readFileSync','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','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','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','get','Trunks','UserProfileResource','destroy','stack','name','map','Trunk','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','where','pick','filter','merge','VIRTUAL'];(function(_0x392293,_0x2dc468){var _0xef5424=function(_0x591567){while(--_0x591567){_0x392293['push'](_0x392293['shift']());}};_0xef5424(++_0x2dc468);}(_0xe14d,0x1ee));var _0xde14=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xe14d[_0x543084];return _0x306a57;};'use strict';var emlformat=require(_0xde14('0x0'));var rimraf=require(_0xde14('0x1'));var zipdir=require(_0xde14('0x2'));var jsonpatch=require(_0xde14('0x3'));var rp=require('request-promise');var moment=require(_0xde14('0x4'));var BPromise=require(_0xde14('0x5'));var Mustache=require('mustache');var util=require(_0xde14('0x6'));var path=require(_0xde14('0x7'));var sox=require(_0xde14('0x8'));var csv=require(_0xde14('0x9'));var ejs=require(_0xde14('0xa'));var fs=require('fs');var fs_extra=require(_0xde14('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xde14('0xc'));var jsforce=require(_0xde14('0xd'));var deskjs=require(_0xde14('0xe'));var toCsv=require(_0xde14('0x9'));var querystring=require(_0xde14('0xf'));var Papa=require(_0xde14('0x10'));var Redis=require(_0xde14('0x11'));var authService=require(_0xde14('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xde14('0x13'));var hardwareService=require(_0xde14('0x14'));var logger=require(_0xde14('0x15'))(_0xde14('0x16'));var utils=require(_0xde14('0x17'));var config=require(_0xde14('0x18'));var licenseUtil=require(_0xde14('0x19'));var db=require(_0xde14('0x1a'))['db'];var jayson=require(_0xde14('0x1b'));var client=jayson[_0xde14('0x1c')][_0xde14('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x464624,_0x3521d4,_0x281c54,_0x1489e9){return new BPromise(function(_0x54c58b,_0x584959){var _0x23c878=_0x1489e9||client;return _0x23c878[_0xde14('0x1e')](_0x464624,_0x281c54)[_0xde14('0x1f')](function(_0x4c86ff){logger[_0xde14('0x20')](_0xde14('0x21'),_0x3521d4,_0xde14('0x22'));logger[_0xde14('0x23')](_0xde14('0x24'),_0x3521d4,_0xde14('0x22'),JSON[_0xde14('0x25')](_0x4c86ff));if(_0x4c86ff[_0xde14('0x26')]){if(_0x4c86ff[_0xde14('0x26')][_0xde14('0x27')]===0x1f4){logger['error'](_0xde14('0x21'),_0x3521d4,_0x4c86ff[_0xde14('0x26')][_0xde14('0x28')]);return _0x584959(_0x4c86ff[_0xde14('0x26')]['message']);}logger[_0xde14('0x26')]('Trunk,\x20%s,\x20%s',_0x3521d4,_0x4c86ff[_0xde14('0x26')]['message']);return _0x54c58b(_0x4c86ff[_0xde14('0x26')][_0xde14('0x28')]);}else{logger[_0xde14('0x20')](_0xde14('0x21'),_0x3521d4,_0xde14('0x22'));_0x54c58b(_0x4c86ff[_0xde14('0x29')][_0xde14('0x28')]);}})[_0xde14('0x2a')](function(_0xdd8d59){logger[_0xde14('0x26')](_0xde14('0x21'),_0x3521d4,_0xdd8d59);_0x584959(_0xdd8d59);});});}function respondWithStatusCode(_0xbaa078,_0x8f8033){_0x8f8033=_0x8f8033||0xcc;return function(_0x5ae4c1){if(_0x5ae4c1){return _0xbaa078[_0xde14('0x2b')](_0x8f8033);}return _0xbaa078[_0xde14('0x2c')](_0x8f8033)[_0xde14('0x2d')]();};}function respondWithResult(_0xbd05d6,_0x1bb7be){_0x1bb7be=_0x1bb7be||0xc8;return function(_0x21ef15){if(_0x21ef15){return _0xbd05d6[_0xde14('0x2c')](_0x1bb7be)[_0xde14('0x2e')](_0x21ef15);}};}function respondWithFilteredResult(_0x1618e1,_0x350a78){return function(_0x4eff65){if(_0x4eff65){var _0x309922=typeof _0x350a78[_0xde14('0x2f')]===_0xde14('0x30')&&typeof _0x350a78[_0xde14('0x31')]==='undefined';var _0x3fc2a4=_0x4eff65[_0xde14('0x32')];var _0x30c4a8=_0x309922?0x0:_0x350a78['offset'];var _0x4655fb=_0x309922?_0x4eff65['count']:_0x350a78[_0xde14('0x2f')]+_0x350a78[_0xde14('0x31')];var _0x3bb1da;if(_0x4655fb>=_0x3fc2a4){_0x4655fb=_0x3fc2a4;_0x3bb1da=0xc8;}else{_0x3bb1da=0xce;}_0x1618e1[_0xde14('0x2c')](_0x3bb1da);return _0x1618e1[_0xde14('0x33')](_0xde14('0x34'),_0x30c4a8+'-'+_0x4655fb+'/'+_0x3fc2a4)[_0xde14('0x2e')](_0x4eff65);}return null;};}function patchUpdates(_0x464666){return function(_0x4e7c5b){try{jsonpatch[_0xde14('0x35')](_0x4e7c5b,_0x464666,!![]);}catch(_0xbf49ac){return BPromise['reject'](_0xbf49ac);}return _0x4e7c5b[_0xde14('0x36')]();};}function saveUpdates(_0x4c9b15,_0x2e40ad){return function(_0x44e88a){if(_0x44e88a){return _0x44e88a[_0xde14('0x37')](_0x4c9b15)[_0xde14('0x1f')](function(_0x13c164){return _0x13c164;});}return null;};}function removeEntity(_0x57fc47,_0x26dfa9){return function(_0x57b98b){if(_0x57b98b){return _0x57b98b['destroy']()[_0xde14('0x1f')](function(){var _0x3c943b=_0x57b98b[_0xde14('0x38')]({'plain':!![]});var _0x319136=_0xde14('0x39');return db[_0xde14('0x3a')][_0xde14('0x3b')]({'where':{'type':_0x319136,'resourceId':_0x3c943b['id']}})[_0xde14('0x1f')](function(){return _0x57b98b;});})[_0xde14('0x1f')](function(){_0x57fc47['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c7136,_0x403007){return function(_0x20913d){if(!_0x20913d){_0x1c7136[_0xde14('0x2b')](0x194);}return _0x20913d;};}function handleError(_0x31cad4,_0x23813f){_0x23813f=_0x23813f||0x1f4;return function(_0x1f42ab){logger[_0xde14('0x26')](_0x1f42ab[_0xde14('0x3c')]);if(_0x1f42ab['name']){delete _0x1f42ab[_0xde14('0x3d')];}_0x31cad4['status'](_0x23813f)['send'](_0x1f42ab);};}exports['index']=function(_0xb0eba6,_0x258759){var _0x398f63={},_0x152dab={},_0x1228d8={'count':0x0,'rows':[]};var _0x8b5bb4=_[_0xde14('0x3e')](db[_0xde14('0x3f')]['rawAttributes'],function(_0xc2a39d){return{'name':_0xc2a39d[_0xde14('0x40')],'type':_0xc2a39d[_0xde14('0x41')][_0xde14('0x42')]};});_0x152dab[_0xde14('0x43')]=_[_0xde14('0x3e')](_0x8b5bb4,_0xde14('0x3d'));_0x152dab[_0xde14('0x44')]=_['keys'](_0xb0eba6[_0xde14('0x44')]);_0x152dab[_0xde14('0x45')]=_[_0xde14('0x46')](_0x152dab[_0xde14('0x43')],_0x152dab['query']);_0x398f63['attributes']=_[_0xde14('0x46')](_0x152dab[_0xde14('0x43')],qs[_0xde14('0x47')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x47')]));_0x398f63['attributes']=_0x398f63[_0xde14('0x48')][_0xde14('0x49')]?_0x398f63[_0xde14('0x48')]:_0x152dab['model'];if(!_0xb0eba6[_0xde14('0x44')]['hasOwnProperty'](_0xde14('0x4a'))){_0x398f63['limit']=qs[_0xde14('0x31')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x31')]);_0x398f63[_0xde14('0x2f')]=qs[_0xde14('0x2f')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x2f')]);}_0x398f63[_0xde14('0x4b')]=qs['sort'](_0xb0eba6[_0xde14('0x44')]['sort']);_0x398f63[_0xde14('0x4c')]=qs['filters'](_[_0xde14('0x4d')](_0xb0eba6[_0xde14('0x44')],_0x152dab[_0xde14('0x45')]),_0x8b5bb4);if(_0xb0eba6[_0xde14('0x44')][_0xde14('0x4e')]){_0x398f63[_0xde14('0x4c')]=_[_0xde14('0x4f')](_0x398f63[_0xde14('0x4c')],{'$or':_['map'](_0x8b5bb4,function(_0x15859c){if(_0x15859c[_0xde14('0x41')]!==_0xde14('0x50')){var _0x4b1ef7={};_0x4b1ef7[_0x15859c['name']]={'$like':'%'+_0xb0eba6[_0xde14('0x44')][_0xde14('0x4e')]+'%'};return _0x4b1ef7;}})});}_0x398f63=_[_0xde14('0x4f')]({},_0x398f63,_0xb0eba6[_0xde14('0x51')]);var _0x39572b={'where':_0x398f63[_0xde14('0x4c')]};return db['Trunk'][_0xde14('0x32')](_0x39572b)['then'](function(_0xa408ec){_0x1228d8[_0xde14('0x32')]=_0xa408ec;if(_0xb0eba6['query'][_0xde14('0x52')]){_0x398f63[_0xde14('0x53')]=[{'all':!![]}];}return db[_0xde14('0x3f')][_0xde14('0x54')](_0x398f63);})[_0xde14('0x1f')](function(_0x1c87e1){_0x1228d8[_0xde14('0x55')]=_0x1c87e1;return _0x1228d8;})['then'](respondWithFilteredResult(_0x258759,_0x398f63))[_0xde14('0x2a')](handleError(_0x258759,null));};exports['show']=function(_0xfa80c8,_0x6aa9ab){var _0x237be4={'raw':![],'where':{'id':_0xfa80c8[_0xde14('0x56')]['id']}},_0x235202={};_0x235202[_0xde14('0x43')]=_[_0xde14('0x57')](db[_0xde14('0x3f')][_0xde14('0x58')]);_0x235202[_0xde14('0x44')]=_['keys'](_0xfa80c8[_0xde14('0x44')]);_0x235202[_0xde14('0x45')]=_[_0xde14('0x46')](_0x235202[_0xde14('0x43')],_0x235202[_0xde14('0x44')]);_0x237be4['attributes']=_[_0xde14('0x46')](_0x235202['model'],qs[_0xde14('0x47')](_0xfa80c8[_0xde14('0x44')][_0xde14('0x47')]));_0x237be4[_0xde14('0x48')]=_0x237be4[_0xde14('0x48')]['length']?_0x237be4['attributes']:_0x235202[_0xde14('0x43')];if(_0xfa80c8['query'][_0xde14('0x52')]){_0x237be4[_0xde14('0x53')]=[{'all':!![]}];}_0x237be4=_[_0xde14('0x4f')]({},_0x237be4,_0xfa80c8[_0xde14('0x51')]);return db[_0xde14('0x3f')][_0xde14('0x59')](_0x237be4)[_0xde14('0x1f')](handleEntityNotFound(_0x6aa9ab,null))[_0xde14('0x1f')](respondWithResult(_0x6aa9ab,null))[_0xde14('0x2a')](handleError(_0x6aa9ab,null));};exports['clone']=function(_0x205a94,_0x2c972b){var _0x1ea6d2={'where':{'id':_0x205a94[_0xde14('0x56')]['id']}},_0x21d226={};_0x21d226['model']=_[_0xde14('0x57')](db['Trunk'][_0xde14('0x58')]);_0x1ea6d2[_0xde14('0x48')]=_[_0xde14('0x46')](_0x21d226[_0xde14('0x43')],qs[_0xde14('0x47')](_0x205a94[_0xde14('0x44')][_0xde14('0x47')]));_0x1ea6d2[_0xde14('0x48')]=_0x1ea6d2['attributes']['length']?_0x1ea6d2['attributes']:_0x21d226[_0xde14('0x43')];if(_0x205a94['query']['includeAll']){_0x1ea6d2[_0xde14('0x53')]=[{'all':!![]}];}_0x1ea6d2=_[_0xde14('0x4f')]({},_0x1ea6d2,_0x205a94[_0xde14('0x51')]);return db[_0xde14('0x3f')][_0xde14('0x59')](_0x1ea6d2)[_0xde14('0x1f')](handleEntityNotFound(_0x2c972b,null))[_0xde14('0x1f')](function(_0x13f698){if(_0x13f698){var _0x2dd108=_0x13f698['get']({'plain':!![]});_0x2dd108=qs[_0xde14('0x5a')](_0x2dd108,['id',_0xde14('0x5b'),_0xde14('0x5c')]);_0x205a94['body']=_[_0xde14('0x5a')](_0x205a94['body'],['id',_0xde14('0x5b'),_0xde14('0x5c')]);return db[_0xde14('0x3f')][_0xde14('0x5d')](_[_0xde14('0x4f')](_0x2dd108,_0x205a94[_0xde14('0x5e')]),{'include':_0x205a94[_0xde14('0x44')]['includeAll']?[{'all':!![]}]:undefined})[_0xde14('0x1f')](function(_0x25ba7e){var _0x1a0bb1=_0x205a94[_0xde14('0x5f')][_0xde14('0x38')]({'plain':!![]});if(!_0x1a0bb1)throw new Error(_0xde14('0x60'));if(_0x1a0bb1[_0xde14('0x61')]==='user'){var _0x4a9e85=_0x25ba7e[_0xde14('0x38')]({'plain':!![]});var _0x19a162=_0xde14('0x39');return db['UserProfileSection'][_0xde14('0x59')]({'where':{'name':_0x19a162,'userProfileId':_0x1a0bb1[_0xde14('0x62')]},'raw':!![]})[_0xde14('0x1f')](function(_0x32e075){if(_0x32e075&&_0x32e075['autoAssociation']===0x0){return db['UserProfileResource'][_0xde14('0x5d')]({'name':_0x4a9e85[_0xde14('0x3d')],'resourceId':_0x4a9e85['id'],'type':_0x32e075[_0xde14('0x3d')],'sectionId':_0x32e075['id']},{})[_0xde14('0x1f')](function(){return _0x25ba7e;});}else{return _0x25ba7e;}})[_0xde14('0x2a')](function(_0x120284){logger[_0xde14('0x26')](_0xde14('0x63'),_0x120284);throw _0x120284;});}return _0x25ba7e;});}})[_0xde14('0x1f')](respondWithResult(_0x2c972b,0xc9))[_0xde14('0x2a')](handleError(_0x2c972b,null));};exports[_0xde14('0x5d')]=function(_0x299b69,_0x1ff577,_0x42329a){var _0x6a641f;return db[_0xde14('0x3f')][_0xde14('0x5d')](_0x299b69[_0xde14('0x5e')],{'raw':!![]})[_0xde14('0x1f')](function(_0x1b5d70){_0x6a641f=_0x1b5d70;return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});})[_0xde14('0x1f')](function(_0x4809fa){var _0x1084fb=fs['readFileSync'](path[_0xde14('0x64')](config['root'],_0xde14('0x65')),_0xde14('0x66'));var _0x3aaba2=fs['readFileSync'](path['join'](config[_0xde14('0x67')],_0xde14('0x68')),_0xde14('0x66'));var _0x430bdb=ejs['render'](_0x1084fb,{'trunks':_0x4809fa||[]});fs[_0xde14('0x69')](_0xde14('0x6a'),_0x430bdb);if(_0x6a641f[_0xde14('0x6b')]){var _0x500344=ejs['render'](_0x3aaba2,{'trunks':_0x4809fa||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x500344);}})[_0xde14('0x1f')](function(){return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x5d'),{'module':'chan_sip.so'});})[_0xde14('0x1f')](function(){var _0x37f7c3=_0x299b69[_0xde14('0x5f')][_0xde14('0x38')]({'plain':!![]});if(!_0x37f7c3)throw new Error(_0xde14('0x60'));if(_0x37f7c3[_0xde14('0x61')]==='user'){var _0x579a6c=_0x6a641f[_0xde14('0x38')]({'plain':!![]});return db[_0xde14('0x6d')]['find']({'where':{'name':_0xde14('0x39'),'userProfileId':_0x37f7c3[_0xde14('0x62')]},'raw':!![]})[_0xde14('0x1f')](function(_0x367ede){if(_0x367ede&&_0x367ede[_0xde14('0x6e')]===0x0){return db[_0xde14('0x3a')][_0xde14('0x5d')]({'name':_0x579a6c['name'],'resourceId':_0x579a6c['id'],'type':_0x367ede['name'],'sectionId':_0x367ede['id']},{})['then'](function(){return _0x6a641f;});}else{return _0x6a641f;}})['catch'](function(_0x3dbda9){logger[_0xde14('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3dbda9);throw _0x3dbda9;});}return _0x6a641f;})['then'](respondWithResult(_0x1ff577,0xc9))[_0xde14('0x2a')](handleError(_0x1ff577,null));};exports[_0xde14('0x37')]=function(_0xe2b9f5,_0x5805ec,_0x1aa75d){var _0x2b1e2e;return db['Trunk'][_0xde14('0x59')]({'where':{'id':_0xe2b9f5[_0xde14('0x56')]['id']}})[_0xde14('0x1f')](handleEntityNotFound(_0x5805ec,null))[_0xde14('0x1f')](saveUpdates(_0xe2b9f5['body'],null))[_0xde14('0x1f')](function(_0x5a5b25){if(_0x5a5b25){_0x2b1e2e=_0x5a5b25;return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});}})[_0xde14('0x1f')](function(_0x5f49d1){if(_0x5f49d1){var _0x283eb8=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],_0xde14('0x65')),'utf8');var _0x53433d=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],'server/files/templates/registry.ejs'),_0xde14('0x66'));var _0x1a12b5=ejs[_0xde14('0x70')](_0x283eb8,{'trunks':_0x5f49d1||[]});fs[_0xde14('0x69')](_0xde14('0x6a'),_0x1a12b5);var _0x2cc5b7=ejs[_0xde14('0x70')](_0x53433d,{'trunks':_0x5f49d1||[]});fs['writeFileSync'](_0xde14('0x71'),_0x2cc5b7);return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x37'),{'module':_0xde14('0x72')});}return null;})[_0xde14('0x1f')](function(_0x1732d0){if(_0x1732d0){return _0x2b1e2e;}})[_0xde14('0x1f')](respondWithResult(_0x5805ec,null))['catch'](handleError(_0x5805ec,null));};exports[_0xde14('0x3b')]=function(_0x1bdeae,_0x5f4b92,_0x4543f1){var _0x4a0108;return db[_0xde14('0x3f')]['find']({'where':{'id':_0x1bdeae[_0xde14('0x56')]['id']}})[_0xde14('0x1f')](handleEntityNotFound(_0x5f4b92,null))[_0xde14('0x1f')](removeEntity(_0x5f4b92,null))[_0xde14('0x1f')](function(){return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});})['then'](function(_0x43a155){var _0x58cf06=fs[_0xde14('0x6f')](path['join'](config[_0xde14('0x67')],_0xde14('0x65')),_0xde14('0x66'));var _0x4a1114=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x495741=ejs['render'](_0x58cf06,{'trunks':_0x43a155});var _0x381d6d=ejs[_0xde14('0x70')](_0x4a1114,{'trunks':_0x43a155});fs['writeFileSync'](_0xde14('0x6a'),_0x495741);fs[_0xde14('0x69')](_0xde14('0x71'),_0x381d6d);return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x3b'),{'module':'chan_sip.so'});})[_0xde14('0x2a')](handleError(_0x5f4b92,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index e8c1997..77f0098 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 _0xac4c=['api','moment','bluebird','request-promise','path','rimraf','exports','define','Trunk','lodash','../../config/logger'];(function(_0x39d711,_0xe11eb7){var _0xee1d0c=function(_0x457e08){while(--_0x457e08){_0x39d711['push'](_0x39d711['shift']());}};_0xee1d0c(++_0xe11eb7);}(_0xac4c,0x1cc));var _0xcac4=function(_0x53245e,_0x189693){_0x53245e=_0x53245e-0x0;var _0x24e81b=_0xac4c[_0x53245e];return _0x24e81b;};'use strict';var _=require(_0xcac4('0x0'));var util=require('util');var logger=require(_0xcac4('0x1'))(_0xcac4('0x2'));var moment=require(_0xcac4('0x3'));var BPromise=require(_0xcac4('0x4'));var rp=require(_0xcac4('0x5'));var fs=require('fs');var path=require(_0xcac4('0x6'));var rimraf=require(_0xcac4('0x7'));var config=require('../../config/environment');var attributes=require('./trunk.attributes');module[_0xcac4('0x8')]=function(_0x3d5151,_0x34edd8){return _0x3d5151[_0xcac4('0x9')](_0xcac4('0xa'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd93=['tools_trunks','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','Trunk'];(function(_0x8b9bfc,_0x4da203){var _0x5d01e6=function(_0x511bf2){while(--_0x511bf2){_0x8b9bfc['push'](_0x8b9bfc['shift']());}};_0x5d01e6(++_0x4da203);}(_0xfd93,0x6f));var _0x3fd9=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xfd93[_0x2070da];return _0x4f9fe1;};'use strict';var _=require('lodash');var util=require(_0x3fd9('0x0'));var logger=require('../../config/logger')(_0x3fd9('0x1'));var moment=require(_0x3fd9('0x2'));var BPromise=require(_0x3fd9('0x3'));var rp=require(_0x3fd9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3fd9('0x5'));var config=require(_0x3fd9('0x6'));var attributes=require('./trunk.attributes');module[_0x3fd9('0x7')]=function(_0x46f874,_0xda0f53){return _0x46f874[_0x3fd9('0x8')](_0x3fd9('0x9'),attributes,{'tableName':_0x3fd9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index b7211b3..32997e1 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 _0xc9c3=['catch','GetTrunk','findAll','options','raw','attributes','include','map','model','ShowTrunk','Trunk','find','where','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x28f283,_0x36c5bf){var _0xb8f541=function(_0x565739){while(--_0x565739){_0x28f283['push'](_0x28f283['shift']());}};_0xb8f541(++_0x36c5bf);}(_0xc9c3,0x1ba));var _0x3c9c=function(_0x5344ca,_0x424b2){_0x5344ca=_0x5344ca-0x0;var _0x573835=_0xc9c3[_0x5344ca];return _0x573835;};'use strict';var _=require(_0x3c9c('0x0'));var util=require(_0x3c9c('0x1'));var moment=require('moment');var BPromise=require(_0x3c9c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c9c('0x3'))['db'];var utils=require(_0x3c9c('0x4'));var logger=require(_0x3c9c('0x5'))(_0x3c9c('0x6'));var config=require('../../config/environment');var jayson=require(_0x3c9c('0x7'));var client=jayson[_0x3c9c('0x8')][_0x3c9c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20d0cc,_0x3dbca6,_0x59e237){return new BPromise(function(_0xfbf67a,_0x253066){return client['request'](_0x20d0cc,_0x59e237)[_0x3c9c('0xa')](function(_0x4d7dde){logger[_0x3c9c('0xb')](_0x3c9c('0xc'),_0x3dbca6,_0x3c9c('0xd'));logger[_0x3c9c('0xe')]('Trunk,\x20%s,\x20%s,\x20%s',_0x3dbca6,_0x3c9c('0xd'),JSON[_0x3c9c('0xf')](_0x4d7dde));if(_0x4d7dde[_0x3c9c('0x10')]){if(_0x4d7dde['error'][_0x3c9c('0x11')]===0x1f4){logger[_0x3c9c('0x10')](_0x3c9c('0xc'),_0x3dbca6,_0x4d7dde[_0x3c9c('0x10')][_0x3c9c('0x12')]);return _0x253066(_0x4d7dde[_0x3c9c('0x10')][_0x3c9c('0x12')]);}logger[_0x3c9c('0x10')]('Trunk,\x20%s,\x20%s',_0x3dbca6,_0x4d7dde[_0x3c9c('0x10')][_0x3c9c('0x12')]);return _0xfbf67a(_0x4d7dde['error'][_0x3c9c('0x12')]);}else{logger[_0x3c9c('0xb')](_0x3c9c('0xc'),_0x3dbca6,_0x3c9c('0xd'));_0xfbf67a(_0x4d7dde[_0x3c9c('0x13')]['message']);}})[_0x3c9c('0x14')](function(_0x51d270){logger['error'](_0x3c9c('0xc'),_0x3dbca6,_0x51d270);_0x253066(_0x51d270);});});}exports[_0x3c9c('0x15')]=function(_0x5128e1){var _0x351551=this;return new Promise(function(_0x486d6d,_0x5fe62){return db['Trunk'][_0x3c9c('0x16')]({'raw':_0x5128e1[_0x3c9c('0x17')]?_0x5128e1[_0x3c9c('0x17')][_0x3c9c('0x18')]===undefined?!![]:![]:!![],'where':_0x5128e1[_0x3c9c('0x17')]?_0x5128e1['options']['where']||null:null,'attributes':_0x5128e1[_0x3c9c('0x17')]?_0x5128e1[_0x3c9c('0x17')][_0x3c9c('0x19')]||null:null,'limit':_0x5128e1['options']?_0x5128e1[_0x3c9c('0x17')]['limit']||null:null,'include':_0x5128e1[_0x3c9c('0x17')]?_0x5128e1[_0x3c9c('0x17')][_0x3c9c('0x1a')]?_[_0x3c9c('0x1b')](_0x5128e1[_0x3c9c('0x17')]['include'],function(_0xe62957){return{'model':db[_0xe62957[_0x3c9c('0x1c')]],'as':_0xe62957['as'],'attributes':_0xe62957[_0x3c9c('0x19')],'include':_0xe62957[_0x3c9c('0x1a')]?_['map'](_0xe62957[_0x3c9c('0x1a')],function(_0x5dd40e){return{'model':db[_0x5dd40e[_0x3c9c('0x1c')]],'as':_0x5dd40e['as'],'attributes':_0x5dd40e[_0x3c9c('0x19')],'include':_0x5dd40e[_0x3c9c('0x1a')]?_['map'](_0x5dd40e[_0x3c9c('0x1a')],function(_0x1ec5c2){return{'model':db[_0x1ec5c2[_0x3c9c('0x1c')]],'as':_0x1ec5c2['as'],'attributes':_0x1ec5c2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ef295){logger[_0x3c9c('0xb')](_0x3c9c('0x15'),_0x5128e1);logger['debug'](_0x3c9c('0x15'),_0x5128e1,JSON[_0x3c9c('0xf')](_0x5ef295));_0x486d6d(_0x5ef295);})[_0x3c9c('0x14')](function(_0x5a7b7d){logger[_0x3c9c('0x10')]('GetTrunk',_0x5a7b7d[_0x3c9c('0x12')],_0x5128e1);_0x5fe62(_0x351551['error'](0x1f4,_0x5a7b7d[_0x3c9c('0x12')]));});});};exports[_0x3c9c('0x1d')]=function(_0x49593f){var _0x1631aa=this;return new Promise(function(_0x1ec6e6,_0x28b548){return db[_0x3c9c('0x1e')][_0x3c9c('0x1f')]({'raw':_0x49593f[_0x3c9c('0x17')]?_0x49593f[_0x3c9c('0x17')][_0x3c9c('0x18')]===undefined?!![]:![]:!![],'where':_0x49593f[_0x3c9c('0x17')]?_0x49593f[_0x3c9c('0x17')][_0x3c9c('0x20')]||null:null,'attributes':_0x49593f[_0x3c9c('0x17')]?_0x49593f['options'][_0x3c9c('0x19')]||null:null,'include':_0x49593f['options']?_0x49593f[_0x3c9c('0x17')][_0x3c9c('0x1a')]?_[_0x3c9c('0x1b')](_0x49593f['options'][_0x3c9c('0x1a')],function(_0x51735f){return{'model':db[_0x51735f[_0x3c9c('0x1c')]],'as':_0x51735f['as'],'attributes':_0x51735f[_0x3c9c('0x19')],'include':_0x51735f[_0x3c9c('0x1a')]?_[_0x3c9c('0x1b')](_0x51735f['include'],function(_0x14d0c0){return{'model':db[_0x14d0c0['model']],'as':_0x14d0c0['as'],'attributes':_0x14d0c0['attributes'],'include':_0x14d0c0[_0x3c9c('0x1a')]?_['map'](_0x14d0c0[_0x3c9c('0x1a')],function(_0x38f833){return{'model':db[_0x38f833[_0x3c9c('0x1c')]],'as':_0x38f833['as'],'attributes':_0x38f833['attributes']};}):[]};}):[]};}):[]:[]})[_0x3c9c('0xa')](function(_0x42688d){logger[_0x3c9c('0xb')](_0x3c9c('0x1d'),_0x49593f);logger[_0x3c9c('0xe')]('ShowTrunk',_0x49593f,JSON['stringify'](_0x42688d));_0x1ec6e6(_0x42688d);})[_0x3c9c('0x14')](function(_0x5a53aa){logger['error'](_0x3c9c('0x1d'),_0x5a53aa[_0x3c9c('0x12')],_0x49593f);_0x28b548(_0x1631aa[_0x3c9c('0x10')](0x1f4,_0x5a53aa[_0x3c9c('0x12')]));});});}; \ No newline at end of file +var _0x1e9e=['model','ShowTrunk','lodash','util','randomstring','ioredis','../../config/logger','../../config/environment','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','catch','GetTrunk','Trunk','options','raw','where','attributes','limit','include','map'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x1e9e,0x15e));var _0xe1e9=function(_0x3c2346,_0x4a0c93){_0x3c2346=_0x3c2346-0x0;var _0x500c4a=_0x1e9e[_0x3c2346];return _0x500c4a;};'use strict';var _=require(_0xe1e9('0x0'));var util=require(_0xe1e9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe1e9('0x2'));var fs=require('fs');var Redis=require(_0xe1e9('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe1e9('0x4'))('rpc');var config=require(_0xe1e9('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5379a6,_0x4e5073,_0x15ff7b){return new BPromise(function(_0x269bd8,_0x5e530c){return client[_0xe1e9('0x6')](_0x5379a6,_0x15ff7b)[_0xe1e9('0x7')](function(_0x3b2b75){logger[_0xe1e9('0x8')]('Trunk,\x20%s,\x20%s',_0x4e5073,_0xe1e9('0x9'));logger[_0xe1e9('0xa')](_0xe1e9('0xb'),_0x4e5073,_0xe1e9('0x9'),JSON[_0xe1e9('0xc')](_0x3b2b75));if(_0x3b2b75['error']){if(_0x3b2b75[_0xe1e9('0xd')][_0xe1e9('0xe')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x4e5073,_0x3b2b75[_0xe1e9('0xd')]['message']);return _0x5e530c(_0x3b2b75['error'][_0xe1e9('0xf')]);}logger[_0xe1e9('0xd')](_0xe1e9('0x10'),_0x4e5073,_0x3b2b75[_0xe1e9('0xd')][_0xe1e9('0xf')]);return _0x269bd8(_0x3b2b75['error'][_0xe1e9('0xf')]);}else{logger[_0xe1e9('0x8')](_0xe1e9('0x10'),_0x4e5073,'request\x20sent');_0x269bd8(_0x3b2b75['result']['message']);}})[_0xe1e9('0x11')](function(_0x10354f){logger['error'](_0xe1e9('0x10'),_0x4e5073,_0x10354f);_0x5e530c(_0x10354f);});});}exports[_0xe1e9('0x12')]=function(_0xa478e){var _0x1120cd=this;return new Promise(function(_0x27e780,_0x42da2c){return db[_0xe1e9('0x13')]['findAll']({'raw':_0xa478e[_0xe1e9('0x14')]?_0xa478e[_0xe1e9('0x14')][_0xe1e9('0x15')]===undefined?!![]:![]:!![],'where':_0xa478e['options']?_0xa478e[_0xe1e9('0x14')][_0xe1e9('0x16')]||null:null,'attributes':_0xa478e[_0xe1e9('0x14')]?_0xa478e[_0xe1e9('0x14')][_0xe1e9('0x17')]||null:null,'limit':_0xa478e[_0xe1e9('0x14')]?_0xa478e[_0xe1e9('0x14')][_0xe1e9('0x18')]||null:null,'include':_0xa478e[_0xe1e9('0x14')]?_0xa478e[_0xe1e9('0x14')][_0xe1e9('0x19')]?_[_0xe1e9('0x1a')](_0xa478e[_0xe1e9('0x14')]['include'],function(_0xee837d){return{'model':db[_0xee837d[_0xe1e9('0x1b')]],'as':_0xee837d['as'],'attributes':_0xee837d[_0xe1e9('0x17')],'include':_0xee837d['include']?_['map'](_0xee837d['include'],function(_0x171b4a){return{'model':db[_0x171b4a[_0xe1e9('0x1b')]],'as':_0x171b4a['as'],'attributes':_0x171b4a[_0xe1e9('0x17')],'include':_0x171b4a[_0xe1e9('0x19')]?_[_0xe1e9('0x1a')](_0x171b4a[_0xe1e9('0x19')],function(_0x9cb9cd){return{'model':db[_0x9cb9cd[_0xe1e9('0x1b')]],'as':_0x9cb9cd['as'],'attributes':_0x9cb9cd[_0xe1e9('0x17')]};}):[]};}):[]};}):[]:[]})[_0xe1e9('0x7')](function(_0x22089a){logger[_0xe1e9('0x8')](_0xe1e9('0x12'),_0xa478e);logger['debug']('GetTrunk',_0xa478e,JSON[_0xe1e9('0xc')](_0x22089a));_0x27e780(_0x22089a);})[_0xe1e9('0x11')](function(_0x53ce2f){logger[_0xe1e9('0xd')](_0xe1e9('0x12'),_0x53ce2f['message'],_0xa478e);_0x42da2c(_0x1120cd[_0xe1e9('0xd')](0x1f4,_0x53ce2f[_0xe1e9('0xf')]));});});};exports[_0xe1e9('0x1c')]=function(_0x2053f9){var _0x276281=this;return new Promise(function(_0x2ce33a,_0x3f3522){return db['Trunk']['find']({'raw':_0x2053f9[_0xe1e9('0x14')]?_0x2053f9[_0xe1e9('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x2053f9[_0xe1e9('0x14')]?_0x2053f9['options'][_0xe1e9('0x16')]||null:null,'attributes':_0x2053f9['options']?_0x2053f9[_0xe1e9('0x14')][_0xe1e9('0x17')]||null:null,'include':_0x2053f9['options']?_0x2053f9[_0xe1e9('0x14')]['include']?_[_0xe1e9('0x1a')](_0x2053f9[_0xe1e9('0x14')][_0xe1e9('0x19')],function(_0x4a3ca1){return{'model':db[_0x4a3ca1[_0xe1e9('0x1b')]],'as':_0x4a3ca1['as'],'attributes':_0x4a3ca1['attributes'],'include':_0x4a3ca1[_0xe1e9('0x19')]?_['map'](_0x4a3ca1[_0xe1e9('0x19')],function(_0x1d8b04){return{'model':db[_0x1d8b04[_0xe1e9('0x1b')]],'as':_0x1d8b04['as'],'attributes':_0x1d8b04[_0xe1e9('0x17')],'include':_0x1d8b04[_0xe1e9('0x19')]?_[_0xe1e9('0x1a')](_0x1d8b04[_0xe1e9('0x19')],function(_0x584f53){return{'model':db[_0x584f53['model']],'as':_0x584f53['as'],'attributes':_0x584f53[_0xe1e9('0x17')]};}):[]};}):[]};}):[]:[]})[_0xe1e9('0x7')](function(_0x4da24a){logger['info'](_0xe1e9('0x1c'),_0x2053f9);logger[_0xe1e9('0xa')](_0xe1e9('0x1c'),_0x2053f9,JSON[_0xe1e9('0xc')](_0x4da24a));_0x2ce33a(_0x4da24a);})[_0xe1e9('0x11')](function(_0xd85d25){logger[_0xe1e9('0xd')](_0xe1e9('0x1c'),_0xd85d25['message'],_0x2053f9);_0x3f3522(_0x276281[_0xe1e9('0xd')](0x1f4,_0xd85d25[_0xe1e9('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 4087ae6..3d4ff11 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 _0xf7a3=['/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/api_key','getApiKey','post','create','/create_many','bulkCreate','/:id/queues','addQueues','root','format','originalname','single','file','addAvatar','login','logout','/:id/pause','pause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','addMailAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','/describe','/whoami','whoami','getPresence','/:id','show','/:id/avatar','/:id/open_tabs','/:id/contacts','getContacts','getQueues','/:id/queues_rt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions'];(function(_0x2d2a33,_0x2d1d1f){var _0x32d8ba=function(_0x566914){while(--_0x566914){_0x2d2a33['push'](_0x2d2a33['shift']());}};_0x32d8ba(++_0x2d1d1f);}(_0xf7a3,0xc4));var _0x3f7a=function(_0x4914e2,_0x48be8f){_0x4914e2=_0x4914e2-0x0;var _0x2dcd07=_0xf7a3[_0x4914e2];return _0x2dcd07;};'use strict';var multer=require(_0x3f7a('0x0'));var util=require(_0x3f7a('0x1'));var path=require(_0x3f7a('0x2'));var timeout=require('connect-timeout');var express=require(_0x3f7a('0x3'));var router=express[_0x3f7a('0x4')]();var fs_extra=require(_0x3f7a('0x5'));var auth=require(_0x3f7a('0x6'));var interaction=require(_0x3f7a('0x7'));var config=require(_0x3f7a('0x8'));var controller=require(_0x3f7a('0x9'));router[_0x3f7a('0xa')]('/',auth[_0x3f7a('0xb')](),controller['index']);router[_0x3f7a('0xa')](_0x3f7a('0xc'),auth[_0x3f7a('0xb')](),controller['describe']);router[_0x3f7a('0xa')](_0x3f7a('0xd'),auth[_0x3f7a('0xb')](),controller[_0x3f7a('0xe')]);router[_0x3f7a('0xa')]('/presence',auth['isAuthenticated'](),controller[_0x3f7a('0xf')]);router[_0x3f7a('0xa')](_0x3f7a('0x10'),auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x11')]);router[_0x3f7a('0xa')](_0x3f7a('0x12'),controller['getAvatar']);router[_0x3f7a('0xa')](_0x3f7a('0x13'),auth[_0x3f7a('0xb')](),controller['getOpenTabs']);router[_0x3f7a('0xa')](_0x3f7a('0x14'),auth['isAuthenticated'](),controller[_0x3f7a('0x15')]);router[_0x3f7a('0xa')]('/:id/queues',auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x16')]);router['get'](_0x3f7a('0x17'),auth[_0x3f7a('0xb')](),controller['getVoiceQueuesRt']);router[_0x3f7a('0xa')](_0x3f7a('0x18'),auth['isAuthenticated'](),controller[_0x3f7a('0x19')]);router[_0x3f7a('0xa')](_0x3f7a('0x1a'),auth['isAuthenticated'](),controller[_0x3f7a('0x1b')]);router[_0x3f7a('0xa')](_0x3f7a('0x1c'),auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x1d')]);router['get'](_0x3f7a('0x1e'),auth[_0x3f7a('0xb')](),controller['getChatInteractions']);router[_0x3f7a('0xa')]('/:id/openchannel/interactions',auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x1f')]);router[_0x3f7a('0xa')](_0x3f7a('0x20'),auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x21')]);router[_0x3f7a('0xa')](_0x3f7a('0x22'),auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x23')]);router[_0x3f7a('0xa')](_0x3f7a('0x24'),auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x25')]);router['get'](_0x3f7a('0x26'),auth[_0x3f7a('0xb')](),controller['getWhatsappInteractions']);router[_0x3f7a('0xa')](_0x3f7a('0x27'),auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x28')]);router[_0x3f7a('0xa')](_0x3f7a('0x29'),auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x2a')]);router['get'](_0x3f7a('0x2b'),auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x2c')]);router['get'](_0x3f7a('0x2d'),auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x2e')]);router[_0x3f7a('0xa')](_0x3f7a('0x2f'),auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x30')]);router['get'](_0x3f7a('0x31'),auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x32')]);router[_0x3f7a('0xa')](_0x3f7a('0x33'),auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x34')]);router[_0x3f7a('0xa')](_0x3f7a('0x35'),auth[_0x3f7a('0xb')](),controller['getSmsAccounts']);router[_0x3f7a('0xa')](_0x3f7a('0x36'),auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x37')]);router[_0x3f7a('0xa')](_0x3f7a('0x38'),auth['isAuthenticated'](),controller[_0x3f7a('0x39')]);router['get'](_0x3f7a('0x3a'),auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x3b')]);router[_0x3f7a('0xa')]('/:id/scheduled_calls',auth['isAuthenticated'](),controller['getScheduledCalls']);router[_0x3f7a('0xa')](_0x3f7a('0x3c'),auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x3d')]);router[_0x3f7a('0x3e')]('/:id/contacts',auth[_0x3f7a('0xb')](),controller['addContacts']);router[_0x3f7a('0x3e')]('/',auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x3f')]);router[_0x3f7a('0x3e')](_0x3f7a('0x40'),auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x41')]);router[_0x3f7a('0x3e')](_0x3f7a('0x42'),auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x43')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4435b9,_0x1c8109,_0x3d9090){_0x3d9090(null,path['join'](config[_0x3f7a('0x44')],'server/files/images/'));},'filename':function(_0x51f24b,_0x1ed965,_0x4a4790){_0x4a4790(null,util[_0x3f7a('0x45')]('%s-%s',Date['now'](),_0x1ed965[_0x3f7a('0x46')]));}})});router[_0x3f7a('0x3e')](_0x3f7a('0x12'),upload[_0x3f7a('0x47')](_0x3f7a('0x48')),controller[_0x3f7a('0x49')]);router[_0x3f7a('0x3e')]('/:id/login',auth['isAuthenticated'](),controller[_0x3f7a('0x4a')]);router['post']('/:id/logout',auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x4b')]);router[_0x3f7a('0x3e')](_0x3f7a('0x4c'),auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x4d')]);router['post']('/:id/unpause',auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x4e')]);router[_0x3f7a('0x3e')](_0x3f7a('0x27'),auth['isAuthenticated'](),controller[_0x3f7a('0x4f')]);router[_0x3f7a('0x3e')](_0x3f7a('0x50'),auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x51')]);router[_0x3f7a('0x3e')](_0x3f7a('0x52'),auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x53')]);router[_0x3f7a('0x3e')](_0x3f7a('0x54'),auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x55')]);router[_0x3f7a('0x3e')](_0x3f7a('0x56'),auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x57')]);router[_0x3f7a('0x3e')](_0x3f7a('0x58'),auth['isAuthenticated'](),controller[_0x3f7a('0x59')]);router[_0x3f7a('0x3e')]('/:id/whatsapp_interactions',auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x5a')]);router[_0x3f7a('0x3e')](_0x3f7a('0x2f'),auth['isAuthenticated'](),controller['addFaxAccounts']);router['post'](_0x3f7a('0x31'),auth['isAuthenticated'](),controller[_0x3f7a('0x5b')]);router[_0x3f7a('0x3e')](_0x3f7a('0x33'),auth[_0x3f7a('0xb')](),controller['addOpenchannelAccounts']);router[_0x3f7a('0x3e')](_0x3f7a('0x35'),auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x5c')]);router['post'](_0x3f7a('0x36'),auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x5d')]);router[_0x3f7a('0x3e')](_0x3f7a('0x38'),auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x5e')]);router[_0x3f7a('0x3e')](_0x3f7a('0x3a'),auth['isAuthenticated'](),controller[_0x3f7a('0x5f')]);router['post'](_0x3f7a('0x3c'),auth['isAuthenticated'](),controller['createApiKey']);router[_0x3f7a('0x60')]('/:id',auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x61')]);router[_0x3f7a('0x60')](_0x3f7a('0x62'),auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x63')]);router[_0x3f7a('0x64')](_0x3f7a('0x42'),auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x65')]);router['delete'](_0x3f7a('0x27'),auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x66')]);router[_0x3f7a('0x64')](_0x3f7a('0x10'),auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x67')]);router[_0x3f7a('0x64')](_0x3f7a('0x50'),auth['isAuthenticated'](),controller[_0x3f7a('0x68')]);router[_0x3f7a('0x64')]('/:id/mail_interactions',auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x69')]);router[_0x3f7a('0x64')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0x3f7a('0x6a')]);router[_0x3f7a('0x64')](_0x3f7a('0x56'),auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x6b')]);router[_0x3f7a('0x64')](_0x3f7a('0x58'),auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x6c')]);router[_0x3f7a('0x64')]('/:id/whatsapp_interactions',auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x6d')]);router[_0x3f7a('0x64')]('/:id/fax_accounts',auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x6e')]);router[_0x3f7a('0x64')](_0x3f7a('0x31'),auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x6f')]);router[_0x3f7a('0x64')](_0x3f7a('0x33'),auth[_0x3f7a('0xb')](),controller['removeOpenchannelAccounts']);router[_0x3f7a('0x64')]('/:id/sms_accounts',auth[_0x3f7a('0xb')](),controller['removeSmsAccounts']);router['delete']('/:id/chat_websites',auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x70')]);router[_0x3f7a('0x64')](_0x3f7a('0x38'),auth[_0x3f7a('0xb')](),controller[_0x3f7a('0x71')]);router[_0x3f7a('0x64')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0x3f7a('0x72')]);router[_0x3f7a('0x64')](_0x3f7a('0x3c'),auth[_0x3f7a('0xb')](),controller['removeApiKey']);module['exports']=router; \ No newline at end of file +var _0x0bcd=['getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','%s-%s','originalname','single','file','addAvatar','/:id/login','/:id/logout','logout','/:id/pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','removeChatInteractions','removeMailInteractions','removeSmsInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./user.controller','get','isAuthenticated','/describe','describe','/whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getContacts','/:id/queues','getQueues','/:id/queues_rt'];(function(_0xf26d40,_0x2f4f46){var _0x50b68c=function(_0x10aa58){while(--_0x10aa58){_0xf26d40['push'](_0xf26d40['shift']());}};_0x50b68c(++_0x2f4f46);}(_0x0bcd,0xd4));var _0xd0bc=function(_0x475379,_0x53f576){_0x475379=_0x475379-0x0;var _0x342834=_0x0bcd[_0x475379];return _0x342834;};'use strict';var multer=require(_0xd0bc('0x0'));var util=require(_0xd0bc('0x1'));var path=require(_0xd0bc('0x2'));var timeout=require(_0xd0bc('0x3'));var express=require(_0xd0bc('0x4'));var router=express[_0xd0bc('0x5')]();var fs_extra=require(_0xd0bc('0x6'));var auth=require(_0xd0bc('0x7'));var interaction=require(_0xd0bc('0x8'));var config=require('../../config/environment');var controller=require(_0xd0bc('0x9'));router[_0xd0bc('0xa')]('/',auth[_0xd0bc('0xb')](),controller['index']);router[_0xd0bc('0xa')](_0xd0bc('0xc'),auth[_0xd0bc('0xb')](),controller[_0xd0bc('0xd')]);router[_0xd0bc('0xa')](_0xd0bc('0xe'),auth[_0xd0bc('0xb')](),controller['whoami']);router[_0xd0bc('0xa')](_0xd0bc('0xf'),auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x10')]);router[_0xd0bc('0xa')](_0xd0bc('0x11'),auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x12')]);router[_0xd0bc('0xa')](_0xd0bc('0x13'),controller[_0xd0bc('0x14')]);router[_0xd0bc('0xa')](_0xd0bc('0x15'),auth[_0xd0bc('0xb')](),controller['getOpenTabs']);router[_0xd0bc('0xa')]('/:id/contacts',auth['isAuthenticated'](),controller[_0xd0bc('0x16')]);router[_0xd0bc('0xa')](_0xd0bc('0x17'),auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x18')]);router[_0xd0bc('0xa')](_0xd0bc('0x19'),auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x1a')]);router[_0xd0bc('0xa')]('/:id/groups',auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x1b')]);router[_0xd0bc('0xa')](_0xd0bc('0x1c'),auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x1d')]);router[_0xd0bc('0xa')](_0xd0bc('0x1e'),auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x1f')]);router[_0xd0bc('0xa')](_0xd0bc('0x20'),auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x21')]);router[_0xd0bc('0xa')](_0xd0bc('0x22'),auth[_0xd0bc('0xb')](),controller['getOpenchannelInteractions']);router[_0xd0bc('0xa')](_0xd0bc('0x23'),auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x24')]);router[_0xd0bc('0xa')](_0xd0bc('0x25'),auth[_0xd0bc('0xb')](),controller['getSmsInteractions']);router[_0xd0bc('0xa')](_0xd0bc('0x26'),auth[_0xd0bc('0xb')](),controller['getFaxInteractions']);router[_0xd0bc('0xa')](_0xd0bc('0x27'),auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x28')]);router[_0xd0bc('0xa')](_0xd0bc('0x29'),auth[_0xd0bc('0xb')](),controller['getTeams']);router[_0xd0bc('0xa')](_0xd0bc('0x2a'),auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x2b')]);router[_0xd0bc('0xa')](_0xd0bc('0x2c'),auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x2d')]);router['get'](_0xd0bc('0x2e'),auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x2f')]);router['get'](_0xd0bc('0x30'),auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x31')]);router[_0xd0bc('0xa')]('/:id/mail_accounts',auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x32')]);router[_0xd0bc('0xa')]('/:id/openchannel_accounts',auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x33')]);router[_0xd0bc('0xa')](_0xd0bc('0x34'),auth[_0xd0bc('0xb')](),controller['getSmsAccounts']);router[_0xd0bc('0xa')]('/:id/chat_websites',auth[_0xd0bc('0xb')](),controller['getChatWebsites']);router[_0xd0bc('0xa')](_0xd0bc('0x35'),auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x36')]);router['get'](_0xd0bc('0x37'),auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x38')]);router[_0xd0bc('0xa')](_0xd0bc('0x39'),auth['isAuthenticated'](),controller[_0xd0bc('0x3a')]);router['get'](_0xd0bc('0x3b'),auth['isAuthenticated'](),controller['getApiKey']);router[_0xd0bc('0x3c')]('/:id/contacts',auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x3d')]);router[_0xd0bc('0x3c')]('/',auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x3e')]);router[_0xd0bc('0x3c')](_0xd0bc('0x3f'),auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x40')]);router['post']('/:id/queues',auth['isAuthenticated'](),controller[_0xd0bc('0x41')]);var upload=multer({'storage':multer[_0xd0bc('0x42')]({'destination':function(_0x5cac6d,_0x30d3dd,_0x5111c4){_0x5111c4(null,path[_0xd0bc('0x43')](config[_0xd0bc('0x44')],_0xd0bc('0x45')));},'filename':function(_0x140d95,_0x5602de,_0xe90dde){_0xe90dde(null,util['format'](_0xd0bc('0x46'),Date['now'](),_0x5602de[_0xd0bc('0x47')]));}})});router['post']('/:id/avatar',upload[_0xd0bc('0x48')](_0xd0bc('0x49')),controller[_0xd0bc('0x4a')]);router['post'](_0xd0bc('0x4b'),auth[_0xd0bc('0xb')](),controller['login']);router[_0xd0bc('0x3c')](_0xd0bc('0x4c'),auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x4d')]);router['post'](_0xd0bc('0x4e'),auth[_0xd0bc('0xb')](),controller['pause']);router[_0xd0bc('0x3c')](_0xd0bc('0x4f'),auth['isAuthenticated'](),controller[_0xd0bc('0x50')]);router['post']('/:id/teams',auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x51')]);router['post'](_0xd0bc('0x52'),auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x53')]);router[_0xd0bc('0x3c')](_0xd0bc('0x54'),auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x55')]);router[_0xd0bc('0x3c')](_0xd0bc('0x56'),auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x57')]);router['post'](_0xd0bc('0x58'),auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x59')]);router['post']('/:id/openchannel_interactions',auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x5a')]);router[_0xd0bc('0x3c')](_0xd0bc('0x5b'),auth[_0xd0bc('0xb')](),controller['addWhatsappInteractions']);router['post']('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0xd0bc('0x5c')]);router[_0xd0bc('0x3c')](_0xd0bc('0x5d'),auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x5e')]);router[_0xd0bc('0x3c')](_0xd0bc('0x5f'),auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x60')]);router['post'](_0xd0bc('0x34'),auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x61')]);router['post'](_0xd0bc('0x62'),auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x63')]);router['post'](_0xd0bc('0x35'),auth['isAuthenticated'](),controller[_0xd0bc('0x64')]);router['post']('/:id/square_projects',auth[_0xd0bc('0xb')](),controller['addSquareProjects']);router[_0xd0bc('0x3c')]('/:id/api_key',auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x65')]);router[_0xd0bc('0x66')](_0xd0bc('0x11'),auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x67')]);router[_0xd0bc('0x66')](_0xd0bc('0x68'),auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x69')]);router[_0xd0bc('0x6a')]('/:id/queues',auth['isAuthenticated'](),controller[_0xd0bc('0x6b')]);router['delete'](_0xd0bc('0x29'),auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x6c')]);router[_0xd0bc('0x6a')]('/:id',auth[_0xd0bc('0xb')](),controller['destroy']);router[_0xd0bc('0x6a')](_0xd0bc('0x52'),auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x6d')]);router['delete'](_0xd0bc('0x54'),auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x6e')]);router[_0xd0bc('0x6a')](_0xd0bc('0x56'),auth[_0xd0bc('0xb')](),controller['removeFaxInteractions']);router[_0xd0bc('0x6a')](_0xd0bc('0x58'),auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x6f')]);router[_0xd0bc('0x6a')]('/:id/openchannel_interactions',auth[_0xd0bc('0xb')](),controller['removeOpenchannelInteractions']);router[_0xd0bc('0x6a')](_0xd0bc('0x5b'),auth[_0xd0bc('0xb')](),controller['removeWhatsappInteractions']);router[_0xd0bc('0x6a')](_0xd0bc('0x30'),auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x70')]);router[_0xd0bc('0x6a')](_0xd0bc('0x5d'),auth['isAuthenticated'](),controller[_0xd0bc('0x71')]);router['delete'](_0xd0bc('0x5f'),auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x72')]);router[_0xd0bc('0x6a')]('/:id/sms_accounts',auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x73')]);router[_0xd0bc('0x6a')](_0xd0bc('0x62'),auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x74')]);router[_0xd0bc('0x6a')](_0xd0bc('0x35'),auth[_0xd0bc('0xb')](),controller['removeWhatsappAccounts']);router['delete'](_0xd0bc('0x37'),auth[_0xd0bc('0xb')](),controller[_0xd0bc('0x75')]);router['delete']('/:id/api_key',auth['isAuthenticated'](),controller['removeApiKey']);module[_0xd0bc('0x76')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 6888482..ff93800 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 _0xe14a=['PROHIB','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','nonat','update','yes','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\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','refuse','originate','fingerprint','certificate','active','passive','actpass','update,nonat','TEXT','showWebBar','isArray','udp','avpf','dtlsenable','dtlsverify','dtlsprivatekey','rtcp_mux','wss','encryption','force_avp','icesupport','dtlssetup','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','loginAttempts','blockedAt','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','email','ENUM','admin','user','agent','telephone','local','INTEGER','internal','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN'];(function(_0x5c41a1,_0x32bfb1){var _0x4f0055=function(_0x445730){while(--_0x445730){_0x5c41a1['push'](_0x5c41a1['shift']());}};_0x4f0055(++_0x32bfb1);}(_0xe14a,0x94));var _0xae14=function(_0x58e3b2,_0x2483f4){_0x58e3b2=_0x58e3b2-0x0;var _0x135f7d=_0xe14a[_0x58e3b2];return _0x135f7d;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require('util');var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0xae14('0x0')],'allowNull':![],'unique':_0xae14('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x5cdfa7){this[_0xae14('0x2')](_0xae14('0x1'),_0x5cdfa7);this[_0xae14('0x2')](_0xae14('0x3'),_0x5cdfa7);},'comment':_0xae14('0x4')},'fullname':{'type':Sequelize[_0xae14('0x0')],'allowNull':![],'set':function(_0xbdeb24){this[_0xae14('0x2')](_0xae14('0x5'),_0xbdeb24);this[_0xae14('0x2')](_0xae14('0x6'),util[_0xae14('0x7')](_0xae14('0x8'),_0xbdeb24,this['getDataValue']('internal')));}},'alias':{'type':Sequelize[_0xae14('0x0')]},'email':{'type':Sequelize[_0xae14('0x0')],'allowNull':![],'unique':_0xae14('0x9'),'validate':{'isEmail':!![]},'set':function(_0x324dd0){if(_0x324dd0){this[_0xae14('0x2')]('email',_0x324dd0['toLowerCase']());}}},'role':{'type':Sequelize[_0xae14('0xa')](_0xae14('0xb'),_0xae14('0xc'),_0xae14('0xd'),_0xae14('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0xae14('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xae14('0x0')],'defaultValue':_0xae14('0xf')},'internal':{'type':Sequelize[_0xae14('0x10')](0xb),'allowNull':![],'unique':_0xae14('0x11'),'set':function(_0x4a2446){this[_0xae14('0x2')](_0xae14('0x11'),_0x4a2446);this['setDataValue'](_0xae14('0x12'),_0x4a2446);this[_0xae14('0x2')](_0xae14('0x6'),util[_0xae14('0x7')](_0xae14('0x8'),this['getDataValue']('fullname'),_0x4a2446));}},'salt':{'type':Sequelize[_0xae14('0x0')]},'phone':{'type':Sequelize[_0xae14('0x0')]},'mobile':{'type':Sequelize[_0xae14('0x0')]},'address':{'type':Sequelize[_0xae14('0x0')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xae14('0x0')]},'city':{'type':Sequelize[_0xae14('0x0')]},'country':{'type':Sequelize[_0xae14('0x0')]},'online':{'type':Sequelize[_0xae14('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xae14('0x14')]},'voicePause':{'type':Sequelize[_0xae14('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xae14('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xae14('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xae14('0x13')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xae14('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xae14('0x13')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xae14('0x0')],'defaultValue':_0xae14('0x15')},'lastPauseAt':{'type':Sequelize[_0xae14('0x14')]},'chatCapacity':{'type':Sequelize[_0xae14('0x10')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xae14('0x10')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xae14('0x10')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xae14('0x10')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xae14('0x10')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xae14('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xae14('0x13')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xae14('0x10')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xae14('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xae14('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xae14('0x13')],'defaultValue':![]},'description':{'type':Sequelize[_0xae14('0x0')],'allowNull':!![]},'host':{'type':Sequelize[_0xae14('0x0')],'allowNull':!![],'defaultValue':_0xae14('0x16')},'ipaddr':{'type':Sequelize[_0xae14('0x0')],'allowNull':!![]},'port':{'type':Sequelize[_0xae14('0x10')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xae14('0x10')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xae14('0x0')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xae14('0x0')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0xae14('0x10')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xae14('0xa')](_0xae14('0x17'),_0xae14('0xc'),_0xae14('0x18')),'allowNull':!![],'defaultValue':_0xae14('0x17')},'context':{'type':Sequelize[_0xae14('0x0')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0xae14('0xa')](_0xae14('0x19'),_0xae14('0x1a'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0xae14('0x1b'),_0xae14('0x1c'),_0xae14('0x1d'),_0xae14('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0xae14('0x0')],'allowNull':!![]},'secret':{'type':Sequelize[_0xae14('0x0')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xae14('0x0')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'udp','set':function(_0x1553e1){this[_0xae14('0x2')](_0xae14('0x1f'),_0x1553e1?_0x1553e1['join'](','):null);},'get':function(){return this[_0xae14('0x20')](_0xae14('0x1f'))?this[_0xae14('0x20')]('transport')[_0xae14('0x21')](','):null;},'comment':_0xae14('0x22')},'dtmfmode':{'type':Sequelize['ENUM'](_0xae14('0x23'),_0xae14('0x24'),_0xae14('0x25'),_0xae14('0x26'),'auto'),'allowNull':!![],'defaultValue':_0xae14('0x23')},'directmedia':{'type':Sequelize[_0xae14('0xa')]('yes','no',_0xae14('0x27'),_0xae14('0x28'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xae14('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xae14('0x0')],'allowNull':!![]},'nat':{'type':Sequelize[_0xae14('0x0')],'allowNull':!![],'defaultValue':_0xae14('0x2a'),'set':function(_0x57bdf9){this[_0xae14('0x2')](_0xae14('0x2b'),_0x57bdf9?_0x57bdf9[_0xae14('0x2c')](','):null);},'get':function(){return this[_0xae14('0x20')](_0xae14('0x2b'))?this[_0xae14('0x20')](_0xae14('0x2b'))['split'](','):null;},'comment':_0xae14('0x2d')},'callgroup':{'type':Sequelize[_0xae14('0x0')]},'namedcallgroup':{'type':Sequelize[_0xae14('0x0')]},'pickupgroup':{'type':Sequelize[_0xae14('0x0')]},'namedpickupgroup':{'type':Sequelize[_0xae14('0x0')]},'language':{'type':Sequelize[_0xae14('0x0')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xae14('0x0')]},'disallow':{'type':Sequelize[_0xae14('0x0')],'allowNull':![],'defaultValue':_0xae14('0x2e')},'allow':{'type':Sequelize[_0xae14('0x0')],'allowNull':![],'defaultValue':_0xae14('0x2f'),'set':function(_0x484f24){this['setDataValue'](_0xae14('0x30'),_0x484f24?_0x484f24['join'](';'):_0xae14('0x2f'));},'get':function(){return this[_0xae14('0x20')](_0xae14('0x30'))?this[_0xae14('0x20')](_0xae14('0x30'))[_0xae14('0x21')](';'):null;},'comment':_0xae14('0x31')},'autoframing':{'type':Sequelize[_0xae14('0xa')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xae14('0x0')],'allowNull':!![],'set':function(_0x5be21c){this[_0xae14('0x2')]('insecure',_0x5be21c?_0x5be21c[_0xae14('0x2c')](','):null);},'get':function(){return this[_0xae14('0x20')](_0xae14('0x32'))?this['getDataValue'](_0xae14('0x32'))['split'](','):null;},'comment':_0xae14('0x33')},'trustrpid':{'type':Sequelize[_0xae14('0xa')](_0xae14('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xae14('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xae14('0xa')]('yes','no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0xae14('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xae14('0xa')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xae14('0x10')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xae14('0x0')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xae14('0x0')],'allowNull':!![],'defaultValue':_0xae14('0x34')},'amaflags':{'type':Sequelize[_0xae14('0x0')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xae14('0xa')]('yes','no'),'allowNull':!![],'defaultValue':_0xae14('0x29')},'busylevel':{'type':Sequelize[_0xae14('0x10')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0xae14('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xae14('0xa')](_0xae14('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xae14('0xa')](_0xae14('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xae14('0x0')],'allowNull':!![]},'template':{'type':Sequelize[_0xae14('0x0')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xae14('0xa')](_0xae14('0x29'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xae14('0x10')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xae14('0xa')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xae14('0xa')]('accept',_0xae14('0x35'),_0xae14('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xae14('0x10')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xae14('0xa')]('uac','uas'),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xae14('0x0')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xae14('0x0')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0xae14('0xa')](_0xae14('0x29'),'no'),'allowNull':!![],'defaultValue':_0xae14('0x29')},'keepalive':{'type':Sequelize[_0xae14('0x10')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xae14('0x10')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xae14('0x10')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xae14('0x10')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xae14('0xa')](_0xae14('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xae14('0x0')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xae14('0x10')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xae14('0x10')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xae14('0x10')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xae14('0x0')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xae14('0x0')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xae14('0x0')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xae14('0xa')](_0xae14('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xae14('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0xae14('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xae14('0x29'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xae14('0xa')](_0xae14('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xae14('0xa')](_0xae14('0x29'),'no',_0xae14('0x37'),_0xae14('0x38')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xae14('0x0')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xae14('0x0')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xae14('0x0')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xae14('0x0')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xae14('0xa')](_0xae14('0x39'),_0xae14('0x3a'),_0xae14('0x3b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xae14('0xa')](_0xae14('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xae14('0x0')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xae14('0x0')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xae14('0x10')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xae14('0xa')](_0xae14('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xae14('0xa')](_0xae14('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xae14('0x0')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xae14('0x0')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xae14('0x0')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0xae14('0x29'),'no',_0xae14('0x27'),_0xae14('0x28'),_0xae14('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0xae14('0x14')]},'passwordResetAt':{'type':Sequelize[_0xae14('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xae14('0x3d')]},'showWebBar':{'type':Sequelize[_0xae14('0x10')],'defaultValue':0x0,'set':function(_0x24d8c0){this[_0xae14('0x2')](_0xae14('0x3e'),_0x24d8c0);var _0x2ba264=this['get']({'plain':!![]});switch(_0x24d8c0){case 0x0:case 0x1:var _0x11d9d9=_0x2ba264[_0xae14('0x1f')]?_[_0xae14('0x3f')](_0x2ba264[_0xae14('0x1f')])?_0x2ba264[_0xae14('0x1f')][_0xae14('0x2c')]():_0x2ba264['transport']:_0xae14('0x40');if(_0x11d9d9==='wss'){_0x11d9d9=_0xae14('0x40');}this[_0xae14('0x2')](_0xae14('0x1f'),_0x11d9d9);this['setDataValue']('encryption','no');this[_0xae14('0x2')](_0xae14('0x41'),null);this[_0xae14('0x2')]('force_avp',null);this[_0xae14('0x2')]('icesupport',null);this['setDataValue'](_0xae14('0x42'),null);this[_0xae14('0x2')](_0xae14('0x43'),null);this[_0xae14('0x2')]('dtlssetup',null);this[_0xae14('0x2')]('dtlscertfile',null);this[_0xae14('0x2')](_0xae14('0x44'),null);this['setDataValue'](_0xae14('0x45'),'no');break;case 0x2:this[_0xae14('0x2')]('transport',_0xae14('0x46'));this[_0xae14('0x2')](_0xae14('0x47'),_0xae14('0x29'));this[_0xae14('0x2')](_0xae14('0x41'),_0xae14('0x29'));this[_0xae14('0x2')](_0xae14('0x48'),_0xae14('0x29'));this['setDataValue'](_0xae14('0x49'),_0xae14('0x29'));this['setDataValue']('dtlsenable',_0xae14('0x29'));this[_0xae14('0x2')]('dtlsverify','no');this['setDataValue'](_0xae14('0x4a'),_0xae14('0x3b'));this[_0xae14('0x2')](_0xae14('0x4b'),_0x2ba264[_0xae14('0x4b')]||_0xae14('0x4c'));this[_0xae14('0x2')](_0xae14('0x44'),_0x2ba264['dtlsprivatekey']||_0xae14('0x4d'));this['setDataValue'](_0xae14('0x45'),_0xae14('0x29'));break;default:}}},'permissions':{'type':Sequelize[_0xae14('0x3d')],'set':function(_0x801e9f){this[_0xae14('0x2')](_0xae14('0x4e'),_0x801e9f?_0x801e9f[_0xae14('0x2c')](','):[]);},'get':function(){return this[_0xae14('0x20')]('permissions')?_[_0xae14('0x4f')](this[_0xae14('0x20')]('permissions')[_0xae14('0x21')](','),function(_0x2e4ae4){return parseInt(_0x2e4ae4,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xae14('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xae14('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xae14('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xae14('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xae14('0x10')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xae14('0x10')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xae14('0xa')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xae14('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xae14('0x0')]},'phoneBarEnableJaws':{'type':Sequelize[_0xae14('0x13')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xae14('0x13')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xae14('0x50')],'get':function(){return this[_0xae14('0x20')](_0xae14('0x51'))?this[_0xae14('0x20')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xae14('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xae14('0x13')],'defaultValue':![]},'interface':{'type':Sequelize[_0xae14('0x0')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xae14('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xae14('0x0')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xae14('0x0')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x18f715){if(typeof _0x18f715===_0xae14('0x52')){var _0xc0add4=_0x18f715==='1'?!![]:_0x18f715==='0'?![]:_0x18f715===_0xae14('0x53')?!![]:_0x18f715===_0xae14('0x54')?![]:![];this[_0xae14('0x2')]('screenrecording',_0xc0add4);}else{this[_0xae14('0x2')](_0xae14('0x55'),_0x18f715);}}},'blocked':{'type':Sequelize[_0xae14('0x13')],'defaultValue':![],'set':function(_0x43ad21){this[_0xae14('0x2')](_0xae14('0x56'),_0x43ad21);if(_0x43ad21===!![]){this[_0xae14('0x2')]('blockedAt',moment());this[_0xae14('0x2')](_0xae14('0x57'),0x0);}else{this[_0xae14('0x2')](_0xae14('0x58'),null);}}},'blockedAt':{'type':Sequelize[_0xae14('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xae14('0x10')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xae14('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xae14('0x13')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xae14('0x13')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xfd20=['map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','moment','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','accountcode','BOOLEAN','DATE','INTEGER','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','nonat','update','yes','force_rport,comedia','nat','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','accept','originate','uas','fingerprint','certificate','active','passive','get','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','permissions'];(function(_0x5634d2,_0x40ec38){var _0x4150b5=function(_0x44ceef){while(--_0x44ceef){_0x5634d2['push'](_0x5634d2['shift']());}};_0x4150b5(++_0x40ec38);}(_0xfd20,0x66));var _0x0fd2=function(_0x1a1e23,_0x3c2f9b){_0x1a1e23=_0x1a1e23-0x0;var _0x39d845=_0xfd20[_0x1a1e23];return _0x39d845;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0fd2('0x0'));var util=require('util');var _=require('lodash');module[_0x0fd2('0x1')]={'name':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x27bee6){this['setDataValue'](_0x0fd2('0x3'),_0x27bee6);this[_0x0fd2('0x4')](_0x0fd2('0x5'),_0x27bee6);},'comment':_0x0fd2('0x6')},'fullname':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':![],'set':function(_0x4d114c){this['setDataValue'](_0x0fd2('0x7'),_0x4d114c);this[_0x0fd2('0x4')](_0x0fd2('0x8'),util[_0x0fd2('0x9')](_0x0fd2('0xa'),_0x4d114c,this[_0x0fd2('0xb')](_0x0fd2('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':![],'unique':_0x0fd2('0xd'),'validate':{'isEmail':!![]},'set':function(_0x52b80c){if(_0x52b80c){this[_0x0fd2('0x4')]('email',_0x52b80c[_0x0fd2('0xe')]());}}},'role':{'type':Sequelize[_0x0fd2('0xf')](_0x0fd2('0x10'),_0x0fd2('0x11'),_0x0fd2('0x12'),_0x0fd2('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0fd2('0x2')],'defaultValue':'local'},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x0fd2('0xc'),'set':function(_0x99de24){this[_0x0fd2('0x4')](_0x0fd2('0xc'),_0x99de24);this['setDataValue'](_0x0fd2('0x14'),_0x99de24);this['setDataValue']('callerid',util[_0x0fd2('0x9')]('\x22%s\x22\x20<%s>',this[_0x0fd2('0xb')]('fullname'),_0x99de24));}},'salt':{'type':Sequelize[_0x0fd2('0x2')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x0fd2('0x2')]},'address':{'type':Sequelize[_0x0fd2('0x2')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x0fd2('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x0fd2('0x2')]},'online':{'type':Sequelize[_0x0fd2('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0fd2('0x16')]},'voicePause':{'type':Sequelize[_0x0fd2('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0fd2('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0fd2('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0fd2('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0fd2('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x0fd2('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x0fd2('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x0fd2('0x17')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x0fd2('0x17')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x0fd2('0x17')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0fd2('0x17')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x0fd2('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0fd2('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x0fd2('0x17')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0fd2('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0fd2('0x17')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0fd2('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':!![]},'host':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':!![]},'port':{'type':Sequelize[_0x0fd2('0x17')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x0fd2('0x17')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x0fd2('0x17')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0fd2('0xf')]('friend',_0x0fd2('0x11'),_0x0fd2('0x18')),'allowNull':!![],'defaultValue':_0x0fd2('0x19')},'context':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':!![],'defaultValue':_0x0fd2('0x1a')},'callingpres':{'type':Sequelize['ENUM'](_0x0fd2('0x1b'),_0x0fd2('0x1c'),_0x0fd2('0x1d'),_0x0fd2('0x1e'),_0x0fd2('0x1f'),_0x0fd2('0x20'),_0x0fd2('0x21'),_0x0fd2('0x22')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x0fd2('0x23'),'set':function(_0x4dc8e4){this[_0x0fd2('0x4')]('transport',_0x4dc8e4?_0x4dc8e4['join'](','):null);},'get':function(){return this[_0x0fd2('0xb')](_0x0fd2('0x24'))?this[_0x0fd2('0xb')]('transport')['split'](','):null;},'comment':_0x0fd2('0x25')},'dtmfmode':{'type':Sequelize['ENUM'](_0x0fd2('0x26'),_0x0fd2('0x27'),_0x0fd2('0x28'),_0x0fd2('0x29'),_0x0fd2('0x2a')),'allowNull':!![],'defaultValue':_0x0fd2('0x26')},'directmedia':{'type':Sequelize[_0x0fd2('0xf')]('yes','no',_0x0fd2('0x2b'),_0x0fd2('0x2c'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x0fd2('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':!![],'defaultValue':_0x0fd2('0x2e'),'set':function(_0x2aa966){this[_0x0fd2('0x4')](_0x0fd2('0x2f'),_0x2aa966?_0x2aa966[_0x0fd2('0x30')](','):null);},'get':function(){return this[_0x0fd2('0xb')](_0x0fd2('0x2f'))?this[_0x0fd2('0xb')](_0x0fd2('0x2f'))[_0x0fd2('0x31')](','):null;},'comment':_0x0fd2('0x32')},'callgroup':{'type':Sequelize[_0x0fd2('0x2')]},'namedcallgroup':{'type':Sequelize[_0x0fd2('0x2')]},'pickupgroup':{'type':Sequelize[_0x0fd2('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x0fd2('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0fd2('0x2')]},'disallow':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':![],'defaultValue':_0x0fd2('0x33')},'allow':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x286543){this['setDataValue'](_0x0fd2('0x34'),_0x286543?_0x286543[_0x0fd2('0x30')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x0fd2('0xb')](_0x0fd2('0x34'))?this[_0x0fd2('0xb')](_0x0fd2('0x34'))[_0x0fd2('0x31')](';'):null;},'comment':_0x0fd2('0x35')},'autoframing':{'type':Sequelize['ENUM'](_0x0fd2('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':!![],'set':function(_0xf59fac){this[_0x0fd2('0x4')](_0x0fd2('0x36'),_0xf59fac?_0xf59fac['join'](','):null);},'get':function(){return this[_0x0fd2('0xb')](_0x0fd2('0x36'))?this['getDataValue'](_0x0fd2('0x36'))[_0x0fd2('0x31')](','):null;},'comment':_0x0fd2('0x37')},'trustrpid':{'type':Sequelize[_0x0fd2('0xf')](_0x0fd2('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0fd2('0xf')](_0x0fd2('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0fd2('0xf')]('yes','no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x0fd2('0xf')](_0x0fd2('0x2d'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x0fd2('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':!![],'defaultValue':_0x0fd2('0x38')},'amaflags':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0fd2('0xf')](_0x0fd2('0x2d'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x0fd2('0xf')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x0fd2('0xf')](_0x0fd2('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0fd2('0xf')](_0x0fd2('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0fd2('0xf')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0fd2('0xf')](_0x0fd2('0x2d'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0fd2('0x17')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x0fd2('0xf')](_0x0fd2('0x39'),'refuse',_0x0fd2('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0fd2('0x17')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0fd2('0x17')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x0fd2('0xf')]('uac',_0x0fd2('0x3b')),'allowNull':!![],'defaultValue':_0x0fd2('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0fd2('0xf')](_0x0fd2('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x0fd2('0x2d')},'keepalive':{'type':Sequelize[_0x0fd2('0x17')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x0fd2('0x17')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x0fd2('0x17')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x0fd2('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0fd2('0x17')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0fd2('0x17')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0fd2('0x17')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x0fd2('0xf')](_0x0fd2('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0fd2('0xf')](_0x0fd2('0x2d'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x0fd2('0xf')](_0x0fd2('0x2d'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0fd2('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x0fd2('0xf')](_0x0fd2('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x0fd2('0xf')](_0x0fd2('0x2d'),'no',_0x0fd2('0x3c'),_0x0fd2('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x0fd2('0x17')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x0fd2('0x3e'),_0x0fd2('0x3f'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x0fd2('0xf')](_0x0fd2('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x0fd2('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0fd2('0xf')](_0x0fd2('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x0fd2('0xf')](_0x0fd2('0x2d'),'no',_0x0fd2('0x2b'),'update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x0fd2('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x0fd2('0x17')],'defaultValue':0x0,'set':function(_0x4f41e2){this[_0x0fd2('0x4')]('showWebBar',_0x4f41e2);var _0xd39683=this[_0x0fd2('0x40')]({'plain':!![]});switch(_0x4f41e2){case 0x0:case 0x1:var _0x4556d8=_0xd39683['transport']?_['isArray'](_0xd39683[_0x0fd2('0x24')])?_0xd39683[_0x0fd2('0x24')][_0x0fd2('0x30')]():_0xd39683[_0x0fd2('0x24')]:_0x0fd2('0x23');if(_0x4556d8===_0x0fd2('0x41')){_0x4556d8=_0x0fd2('0x23');}this[_0x0fd2('0x4')](_0x0fd2('0x24'),_0x4556d8);this['setDataValue'](_0x0fd2('0x42'),'no');this[_0x0fd2('0x4')](_0x0fd2('0x43'),null);this['setDataValue'](_0x0fd2('0x44'),null);this['setDataValue'](_0x0fd2('0x45'),null);this[_0x0fd2('0x4')](_0x0fd2('0x46'),null);this[_0x0fd2('0x4')](_0x0fd2('0x47'),null);this[_0x0fd2('0x4')](_0x0fd2('0x48'),null);this[_0x0fd2('0x4')]('dtlscertfile',null);this[_0x0fd2('0x4')](_0x0fd2('0x49'),null);this['setDataValue'](_0x0fd2('0x4a'),'no');break;case 0x2:this[_0x0fd2('0x4')](_0x0fd2('0x24'),'wss');this[_0x0fd2('0x4')](_0x0fd2('0x42'),_0x0fd2('0x2d'));this[_0x0fd2('0x4')](_0x0fd2('0x43'),_0x0fd2('0x2d'));this[_0x0fd2('0x4')](_0x0fd2('0x44'),_0x0fd2('0x2d'));this['setDataValue'](_0x0fd2('0x45'),_0x0fd2('0x2d'));this[_0x0fd2('0x4')]('dtlsenable',_0x0fd2('0x2d'));this[_0x0fd2('0x4')](_0x0fd2('0x47'),'no');this[_0x0fd2('0x4')](_0x0fd2('0x48'),'actpass');this['setDataValue'](_0x0fd2('0x4b'),_0xd39683[_0x0fd2('0x4b')]||_0x0fd2('0x4c'));this[_0x0fd2('0x4')](_0x0fd2('0x49'),_0xd39683[_0x0fd2('0x49')]||_0x0fd2('0x4d'));this[_0x0fd2('0x4')]('rtcp_mux',_0x0fd2('0x2d'));break;default:}}},'permissions':{'type':Sequelize[_0x0fd2('0x4e')],'set':function(_0x1a598c){this[_0x0fd2('0x4')]('permissions',_0x1a598c?_0x1a598c[_0x0fd2('0x30')](','):[]);},'get':function(){return this[_0x0fd2('0xb')](_0x0fd2('0x4f'))?_[_0x0fd2('0x50')](this[_0x0fd2('0xb')](_0x0fd2('0x4f'))[_0x0fd2('0x31')](','),function(_0x16d33b){return parseInt(_0x16d33b,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0fd2('0x2')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x0fd2('0x2')]},'phoneBarUnconditional':{'type':Sequelize[_0x0fd2('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0fd2('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x0fd2('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0fd2('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x0fd2('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0fd2('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x0fd2('0x17')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x0fd2('0x17')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0fd2('0xf')](_0x0fd2('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x0fd2('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x0fd2('0x2')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x0fd2('0x51')],'get':function(){return this[_0x0fd2('0xb')](_0x0fd2('0x52'))?this['getDataValue'](_0x0fd2('0x52')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x0fd2('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0fd2('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x0fd2('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x0fd2('0x2')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0fd2('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0fd2('0x2')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0fd2('0x15')],'defaultValue':![],'set':function(_0x275d2c){if(typeof _0x275d2c===_0x0fd2('0x53')){var _0x29a8bd=_0x275d2c==='1'?!![]:_0x275d2c==='0'?![]:_0x275d2c===_0x0fd2('0x54')?!![]:_0x275d2c===_0x0fd2('0x55')?![]:![];this['setDataValue'](_0x0fd2('0x56'),_0x29a8bd);}else{this[_0x0fd2('0x4')](_0x0fd2('0x56'),_0x275d2c);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x45cec7){this[_0x0fd2('0x4')](_0x0fd2('0x57'),_0x45cec7);if(_0x45cec7===!![]){this[_0x0fd2('0x4')](_0x0fd2('0x58'),moment());this[_0x0fd2('0x4')](_0x0fd2('0x59'),0x0);}else{this[_0x0fd2('0x4')](_0x0fd2('0x58'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x0fd2('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x0fd2('0x17')](0x5)[_0x0fd2('0x5a')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x0fd2('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0fd2('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x0fd2('0x15')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index c908d6b..b23b777 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 _0x1623=['connection','socket','remoteAddress','getVoiceQueues','upsert','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','device','LOGININPAUSE','bulkCreate','concat','isMiddleware','logout','pause','PAUSE','getChannels','DEFAULT\x20PAUSE','type','unpause','chatPause','faxPause','openchannelPause','smsPause','whatsapppause','lastPauseAt','manual','openchannel','QueuePause','getTeams','addTeams','Team','setDataValue','Voice','getChatQueues','Chat','getMailQueues','Sms','Whatsapp','Fax','Openchannel','addAgent','getDataValue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','Mail','getSmsQueues','getFaxQueues','getOpenchannelQueues','flatten','removeAgent','getLists','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','getScheduledCalls','CmHopper','$and','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$notLike','$iLike','$like','$contains','$contained','$any','firstName','lastName','CmContact','Contact','dialActive','getApiKey','token','createApiKey','generateApiKey','iat','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','resolve','teams','queues','inbound','lower','col','toString','asc','desc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','client','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unavailable','ringing','voiceStatus','busy','slice','charAt','toUpperCase','field','ui.','ui.createdAt','_interactions','OpenTabs','moment','path','lodash','squel','jayson/promise','ioredis','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user.socket','register','defaults','http','request','User,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','role','admin','Users','user','Agents','Telephones','telephone','filter','ignore','value','find','name','UserProfileResource','stack','send','index','User','map','key','password','salt','getOptions','query','includeAll','includes','attributes','push','findAll','rows','true','chat','dataValues','sms','fax','whatsapp','all','catch','show','model','differenceBy','keys','filters','intersection','fields','include','merge','options','mail','body','params','describe','addContacts','omit','ids','internal','Setting','securePassword','validatePasswordPattern','max','min_internal','sequelize','QueryTypes','SELECT','length','isNil','from','voicemail','fullname','email','agent','permissions','102','103','113','104','105','106','107','108','100','111','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','settingsEnabled','userProfileId','VoiceMail','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','isEmpty','autoAssociation','newPassword','Sequelize','authenticate','ValidationError','Wrong\x20credentials','oldPassword','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','addQueues','channel','online','loginInPause','voicePause','Unknown\x20channel','capitalize','toLowerCase','Queues','penalty','spread','QueueId','emit','Queue:save','voice','VoiceQueue','interface','format','SIP/%s','each','UserVoiceQueueRt','removeQueues','isValidChannel','remove','isArray','Queue:remove','addAvatar','getAvatar','join','root','server/files/images/logos/default_profile.png','userpic','download','existsSync','server/files/images/','CHAT','FaxOpenTabs','FAX','createdAt','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','WhatsappOpenTabs','WHATSAPP','getContacts','rawAttributes','order','sort','where','pick','CmList','List','Tags','color','tag','nolimit','getQueues','Queue','Unknown\x20role','hasOwnProperty','getVoiceQueuesRt','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','getWhatsappInteractions','login','phone','mobile','intrf','user:%s','user:forcelogout','headers','x-forwarded-for'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x1623,0xab));var _0x3162=function(_0x45a99b,_0x17d51a){_0x45a99b=_0x45a99b-0x0;var _0x1418a8=_0x1623[_0x45a99b];return _0x1418a8;};'use strict';var moment=require(_0x3162('0x0'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x3162('0x1'));var fs=require('fs');var _=require(_0x3162('0x2'));var squel=require(_0x3162('0x3'));var jayson=require(_0x3162('0x4'));var Redis=require(_0x3162('0x5'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var logger=require(_0x3162('0x6'))('api');var utils=require(_0x3162('0x7'));var config=require(_0x3162('0x8'));var licenseUtil=require('../../config/license/util');var db=require(_0x3162('0x9'))['db'];var socket=require(_0x3162('0xa'))(new Redis(config[_0x3162('0xb')]));require(_0x3162('0xc'))[_0x3162('0xd')](socket);config[_0x3162('0xb')]=_[_0x3162('0xe')](config[_0x3162('0xb')],{'host':'localhost','port':0x18eb});var client=jayson['client'][_0x3162('0xf')]({'port':0x232a});var values;function respondWithRpcPromise(_0x3106d5,_0x1c3772,_0x34cfd8,_0x813d62){return new BPromise(function(_0x208f4e,_0x458a05){var _0x38da60=_0x813d62||client;return _0x38da60[_0x3162('0x10')](_0x3106d5,_0x34cfd8)['then'](function(_0x2d11c5){logger['info'](_0x3162('0x11'),_0x1c3772,_0x3162('0x12'));logger['debug']('User,\x20%s,\x20%s,\x20%s',_0x1c3772,_0x3162('0x12'),JSON[_0x3162('0x13')](_0x2d11c5));if(_0x2d11c5[_0x3162('0x14')]){if(_0x2d11c5['error'][_0x3162('0x15')]===0x1f4){logger[_0x3162('0x14')](_0x3162('0x11'),_0x1c3772,_0x2d11c5['error'][_0x3162('0x16')]);return _0x458a05(_0x2d11c5[_0x3162('0x14')][_0x3162('0x16')]);}logger[_0x3162('0x14')](_0x3162('0x11'),_0x1c3772,_0x2d11c5[_0x3162('0x14')][_0x3162('0x16')]);return _0x208f4e(_0x2d11c5['error'][_0x3162('0x16')]);}else{logger[_0x3162('0x17')](_0x3162('0x11'),_0x1c3772,_0x3162('0x12'));_0x208f4e(_0x2d11c5['result'][_0x3162('0x16')]);}})['catch'](function(_0x4ab3e8){logger[_0x3162('0x14')](_0x3162('0x11'),_0x1c3772,_0x4ab3e8);_0x458a05(_0x4ab3e8);});});}function respondWithStatusCode(_0x31946d,_0x523fab){_0x523fab=_0x523fab||0xcc;return function(_0x47eeae){if(_0x47eeae){return _0x31946d[_0x3162('0x18')](_0x523fab);}return _0x31946d[_0x3162('0x19')](_0x523fab)[_0x3162('0x1a')]();};}function respondWithResult(_0x26c90d,_0x31b27b){_0x31b27b=_0x31b27b||0xc8;return function(_0x14cbba){if(_0x14cbba){return _0x26c90d[_0x3162('0x19')](_0x31b27b)[_0x3162('0x1b')](_0x14cbba);}};}function respondWithFilteredResult(_0x5a4994,_0xd283d6){return function(_0x2433f8){if(_0x2433f8){var _0x3919e7=typeof _0xd283d6[_0x3162('0x1c')]===_0x3162('0x1d')&&typeof _0xd283d6[_0x3162('0x1e')]===_0x3162('0x1d');var _0x5f8f7=_0x2433f8[_0x3162('0x1f')];var _0x356c5d=_0x3919e7?0x0:_0xd283d6[_0x3162('0x1c')];var _0x2f62d7=_0x3919e7?_0x2433f8[_0x3162('0x1f')]:_0xd283d6['offset']+_0xd283d6[_0x3162('0x1e')];var _0x552469;if(_0x2f62d7>=_0x5f8f7){_0x2f62d7=_0x5f8f7;_0x552469=0xc8;}else{_0x552469=0xce;}_0x5a4994[_0x3162('0x19')](_0x552469);return _0x5a4994[_0x3162('0x20')](_0x3162('0x21'),_0x356c5d+'-'+_0x2f62d7+'/'+_0x5f8f7)['json'](_0x2433f8);}return null;};}function saveUpdates(_0x4903e7){return function(_0xda0389){if(_0xda0389){return _0xda0389[_0x3162('0x22')](_0x4903e7)[_0x3162('0x23')](function(_0x399148){return _0x399148;});}return null;};}function removeEntity(_0x2f88ec){return function(_0x5c2d28){if(_0x5c2d28){return _0x5c2d28[_0x3162('0x24')]()['then'](function(){var _0xf11765=_0x5c2d28[_0x3162('0x25')]({'plain':!![]});if(_0xf11765[_0x3162('0x26')]===_0x3162('0x27'))return;var _0x118dab=[{'name':_0x3162('0x28'),'value':_0x3162('0x29'),'ignore':!![]},{'name':_0x3162('0x2a'),'value':'agent','ignore':![]},{'name':_0x3162('0x2b'),'value':_0x3162('0x2c'),'ignore':![]}];var _0x48d6fc=_(_0x118dab)[_0x3162('0x2d')](_0x3162('0x2e'))['map']('value')[_0x3162('0x2f')]();if(_['includes'](_0x48d6fc,_0xf11765[_0x3162('0x26')])){return;}var _0x47241c=_[_0x3162('0x30')](_0x118dab,['value',_0xf11765['role']])[_0x3162('0x31')];return db[_0x3162('0x32')]['destroy']({'where':{'type':_0x47241c,'resourceId':_0xf11765['id']}})[_0x3162('0x23')](function(){return _0x5c2d28;});})['then'](function(){_0x2f88ec[_0x3162('0x19')](0xcc)[_0x3162('0x1a')]();});}};}function handleEntityNotFound(_0x339be2){return function(_0x137e9b){if(!_0x137e9b){_0x339be2[_0x3162('0x18')](0x194);}return _0x137e9b;};}function handleError(_0x3b6c91,_0x30bb26){_0x30bb26=_0x30bb26||0x1f4;return function(_0x25951b){logger[_0x3162('0x14')](_0x25951b[_0x3162('0x33')]);if(_0x25951b[_0x3162('0x31')]){delete _0x25951b['name'];}_0x3b6c91[_0x3162('0x19')](_0x30bb26)[_0x3162('0x34')](_0x25951b);};}exports[_0x3162('0x35')]=function(_0x5396df,_0x59759d){var _0x3b0a0b={},_0x124c92={'count':0x0,'rows':[]};var _0x2e1ab5=_(db[_0x3162('0x36')]['rawAttributes'])[_0x3162('0x37')](function(_0x5ee3e2){return{'name':_0x5ee3e2['fieldName'],'type':_0x5ee3e2['type'][_0x3162('0x38')]};})[_0x3162('0x2d')](function(_0x315fdb){return!_['includes']([_0x3162('0x39'),_0x3162('0x3a')],_0x315fdb[_0x3162('0x31')]);})[_0x3162('0x2f')]();_0x3b0a0b=qs[_0x3162('0x3b')](_0x2e1ab5,_0x5396df);var _0x4f06c5={'where':_0x3b0a0b['where']};return db[_0x3162('0x36')][_0x3162('0x1f')](_0x4f06c5)['then'](function(_0x5960cd){_0x124c92[_0x3162('0x1f')]=_0x5960cd;if(_0x5396df[_0x3162('0x3c')][_0x3162('0x3d')]){_0x3b0a0b['include']=[{'all':!![]}];}if(!_[_0x3162('0x3e')](_0x3b0a0b[_0x3162('0x3f')],'id')){_0x3b0a0b[_0x3162('0x3f')][_0x3162('0x40')]('id');}return db['User'][_0x3162('0x41')](_0x3b0a0b);})[_0x3162('0x23')](function(_0x522cce){_0x124c92[_0x3162('0x42')]=_0x522cce;if(_0x5396df[_0x3162('0x3c')]['openTabs']===_0x3162('0x43')){var _0x19cf70=[];for(var _0x59f75d=0x0;_0x59f75d<_0x124c92[_0x3162('0x42')]['length'];_0x59f75d++){_0x19cf70[_0x3162('0x40')](get_open_tabs(_0x3162('0x44'),_0x124c92[_0x3162('0x42')][_0x59f75d][_0x3162('0x45')]));_0x19cf70[_0x3162('0x40')](get_open_tabs(_0x3162('0x46'),_0x124c92['rows'][_0x59f75d][_0x3162('0x45')]));_0x19cf70[_0x3162('0x40')](get_open_tabs(_0x3162('0x47'),_0x124c92['rows'][_0x59f75d][_0x3162('0x45')]));_0x19cf70[_0x3162('0x40')](get_open_tabs('mail',_0x124c92[_0x3162('0x42')][_0x59f75d]['dataValues']));_0x19cf70['push'](get_open_tabs('openchannel',_0x124c92[_0x3162('0x42')][_0x59f75d][_0x3162('0x45')]));_0x19cf70[_0x3162('0x40')](get_open_tabs(_0x3162('0x48'),_0x124c92[_0x3162('0x42')][_0x59f75d][_0x3162('0x45')]));}return BPromise[_0x3162('0x49')](_0x19cf70)[_0x3162('0x23')](function(_0x3d2958){return _0x124c92;});}else{return _0x124c92;}})[_0x3162('0x23')](respondWithFilteredResult(_0x59759d,_0x3b0a0b))[_0x3162('0x4a')](handleError(_0x59759d,null));};exports[_0x3162('0x4b')]=function(_0x209383,_0x56f9bf){var _0x3ac940={'raw':![],'where':{'id':_0x209383['params']['id']}},_0x48cb8f={};_0x48cb8f[_0x3162('0x4c')]=_[_0x3162('0x4d')](_[_0x3162('0x4e')](db[_0x3162('0x36')]['rawAttributes']),[_0x3162('0x39'),'salt']);_0x48cb8f[_0x3162('0x3c')]=_[_0x3162('0x4e')](_0x209383['query']);_0x48cb8f[_0x3162('0x4f')]=_['intersection'](_0x48cb8f['model'],_0x48cb8f[_0x3162('0x3c')]);_0x3ac940[_0x3162('0x3f')]=_[_0x3162('0x50')](_0x48cb8f[_0x3162('0x4c')],qs[_0x3162('0x51')](_0x209383[_0x3162('0x3c')][_0x3162('0x51')]));_0x3ac940[_0x3162('0x3f')]=_0x3ac940['attributes']['length']?_0x3ac940['attributes']:_0x48cb8f[_0x3162('0x4c')];if(_0x209383[_0x3162('0x3c')][_0x3162('0x3d')]){_0x3ac940[_0x3162('0x52')]=[{'all':!![]}];}_0x3ac940=_[_0x3162('0x53')]({},_0x3ac940,_0x209383[_0x3162('0x54')]);if(!_[_0x3162('0x3e')](_0x3ac940['attributes'],'id')){_0x3ac940[_0x3162('0x3f')]['push']('id');}return db[_0x3162('0x36')]['find'](_0x3ac940)[_0x3162('0x23')](handleEntityNotFound(_0x56f9bf,null))['then'](function(_0x1a7165){var _0xd6b792=[];values=_0x1a7165;if(_0x209383['query']['openTabs']===_0x3162('0x43')){_0xd6b792[_0x3162('0x40')](get_open_tabs('chat',_0x1a7165[_0x3162('0x45')]));_0xd6b792[_0x3162('0x40')](get_open_tabs(_0x3162('0x46'),_0x1a7165[_0x3162('0x45')]));_0xd6b792[_0x3162('0x40')](get_open_tabs('openchannel',_0x1a7165[_0x3162('0x45')]));_0xd6b792[_0x3162('0x40')](get_open_tabs('whatsapp',_0x1a7165['dataValues']));_0xd6b792[_0x3162('0x40')](get_open_tabs(_0x3162('0x47'),_0x1a7165[_0x3162('0x45')]));_0xd6b792['push'](get_open_tabs(_0x3162('0x55'),_0x1a7165[_0x3162('0x45')]));return BPromise[_0x3162('0x49')](_0xd6b792);}else{return values;}})[_0x3162('0x23')](function(_0x5c948d){return values;})[_0x3162('0x23')](respondWithResult(_0x56f9bf,null))[_0x3162('0x4a')](handleError(_0x56f9bf,null));};exports['update']=function(_0x3179a,_0x4fd42f){if(_0x3179a[_0x3162('0x56')]['id']){delete _0x3179a[_0x3162('0x56')]['id'];}delete _0x3179a[_0x3162('0x56')]['role'];return db[_0x3162('0x36')][_0x3162('0x30')]({'where':{'id':_0x3179a[_0x3162('0x57')]['id']}})[_0x3162('0x23')](handleEntityNotFound(_0x4fd42f,null))[_0x3162('0x23')](saveUpdates(_0x3179a[_0x3162('0x56')],null))['then'](respondWithResult(_0x4fd42f,null))['catch'](handleError(_0x4fd42f,null));};exports['describe']=function(_0x410593,_0x5b2de9){return db[_0x3162('0x36')][_0x3162('0x58')]()[_0x3162('0x23')](respondWithResult(_0x5b2de9,null))[_0x3162('0x4a')](handleError(_0x5b2de9,null));};exports[_0x3162('0x59')]=function(_0x512137,_0x5a832c){return db[_0x3162('0x36')][_0x3162('0x30')]({'where':{'id':_0x512137['params']['id']}})[_0x3162('0x23')](handleEntityNotFound(_0x5a832c,null))[_0x3162('0x23')](function(_0x1c1fd1){if(_0x1c1fd1){return _0x1c1fd1[_0x3162('0x59')](_0x512137[_0x3162('0x56')]['ids'],_[_0x3162('0x5a')](_0x512137[_0x3162('0x56')],[_0x3162('0x5b'),'id'])||{});}})[_0x3162('0x23')](respondWithResult(_0x5a832c,null))[_0x3162('0x4a')](handleError(_0x5a832c,null));};function validateUser(_0x5c8cef){return new BPromise(function(_0x35fcf5,_0x401b4e){if(_0x5c8cef[_0x3162('0x5c')])return _0x35fcf5(_0x5c8cef);return db[_0x3162('0x5d')]['findById'](0x1)[_0x3162('0x23')](function(_0x141ab9){if(_0x141ab9[_0x3162('0x5e')])authService[_0x3162('0x5f')](_0x5c8cef[_0x3162('0x39')]);db[_0x3162('0x36')][_0x3162('0x60')](_0x3162('0x5c'))[_0x3162('0x23')](function(_0x262266){if(_['isNil'](_0x262266)){_0x5c8cef[_0x3162('0x5c')]=_0x141ab9[_0x3162('0x61')]||0x1;return;}if(_['isNil'](_0x141ab9[_0x3162('0x61')])||_0x141ab9['min_internal']===_0x262266){_0x5c8cef[_0x3162('0x5c')]=_0x262266+0x1;return;}if(_0x141ab9[_0x3162('0x61')]>_0x262266){_0x5c8cef[_0x3162('0x5c')]=_0x141ab9[_0x3162('0x61')];return;}return db[_0x3162('0x62')][_0x3162('0x3c')]('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)',{'type':db[_0x3162('0x62')][_0x3162('0x63')][_0x3162('0x64')]})[_0x3162('0x23')](function(_0x3147a8){if(_0x3147a8&&_0x3147a8[_0x3162('0x65')]){for(var _0x509c99=0x0,_0x2a3e33=_0x3147a8[_0x3162('0x65')];_0x509c99<_0x2a3e33&&_[_0x3162('0x66')](_0x5c8cef[_0x3162('0x5c')]);_0x509c99++){if(_0x141ab9[_0x3162('0x61')]<=_0x3147a8[_0x509c99][_0x3162('0x67')]){_0x5c8cef[_0x3162('0x5c')]=_0x3147a8[_0x509c99]['from'];}else if(_0x141ab9['min_internal']>_0x3147a8[_0x509c99]['from']&&_0x141ab9[_0x3162('0x61')]<=_0x3147a8[_0x509c99]['to']){_0x5c8cef[_0x3162('0x5c')]=_0x141ab9['min_internal'];}}}if(_[_0x3162('0x66')](_0x5c8cef[_0x3162('0x5c')])){_0x5c8cef[_0x3162('0x5c')]=_0x262266+0x1;}return _0x35fcf5(_0x5c8cef);});});})[_0x3162('0x4a')](function(_0x4eb53c){_0x401b4e(_0x4eb53c);});});}function updateUser(_0x1e5d8a){return new BPromise(function(_0x5fe32c,_0x533140){try{if(_0x1e5d8a[_0x3162('0x68')]){_0x1e5d8a['mailbox']=_0x1e5d8a[_0x3162('0x5c')];_0x1e5d8a['VoiceMail']={'mailbox':_0x1e5d8a[_0x3162('0x5c')],'password':_0x1e5d8a['password'],'fullname':_0x1e5d8a[_0x3162('0x69')],'email':_0x1e5d8a[_0x3162('0x6a')]};}if(_0x1e5d8a[_0x3162('0x26')]===_0x3162('0x6b')){if(!_0x1e5d8a[_0x3162('0x6c')])_0x1e5d8a[_0x3162('0x6c')]=['101',_0x3162('0x6d'),_0x3162('0x6e'),_0x3162('0x6f'),'110',_0x3162('0x70'),_0x3162('0x71'),_0x3162('0x72'),_0x3162('0x73'),_0x3162('0x74'),'109',_0x3162('0x75'),_0x3162('0x76'),'114','115'];}_0x5fe32c(_0x1e5d8a);}catch(_0x262e82){_0x533140(_0x262e82);}});}exports[_0x3162('0x77')]=function(_0x54735c,_0x81909b){if(_0x54735c[_0x3162('0x29')][_0x3162('0x26')]===_0x3162('0x6b'))throw new Error(_0x3162('0x78'));if(_0x54735c[_0x3162('0x56')][_0x3162('0x26')]===_0x3162('0x29')&&_0x54735c[_0x3162('0x29')]['role']!=='admin'){throw new Error(_0x3162('0x79'));}if(_0x54735c[_0x3162('0x56')]['role']===_0x3162('0x27')&&_0x54735c['user']['role']!=='admin'){throw new Error(_0x3162('0x7a'));}return licenseUtil['checkUserLimits']([_0x54735c[_0x3162('0x56')]])[_0x3162('0x23')](function(){return validateUser(_0x54735c[_0x3162('0x56')]);})[_0x3162('0x23')](function(_0x1bd5f6){return updateUser(_0x1bd5f6)[_0x3162('0x23')](function(_0x36b427){if(_0x36b427[_0x3162('0x26')]===_0x3162('0x27')){_0x36b427[_0x3162('0x7b')]=_0x54735c[_0x3162('0x29')]['settingsEnabled'];delete _0x36b427[_0x3162('0x7c')];}return _0x36b427;});})[_0x3162('0x23')](function(_0x42c195){return db[_0x3162('0x36')][_0x3162('0x77')](_0x42c195,{'include':[{'model':db[_0x3162('0x7d')],'as':_0x3162('0x7d')}]});})[_0x3162('0x23')](function(_0x34032a){if(_0x54735c[_0x3162('0x56')][_0x3162('0x26')]===_0x3162('0x29'))return _0x34032a;if(_0x54735c['user'][_0x3162('0x26')]!==_0x3162('0x29'))return _0x34032a;return db[_0x3162('0x7e')]['find']({'where':{'name':_0x34032a[_0x3162('0x26')]==='agent'?_0x3162('0x2a'):_0x3162('0x2b'),'userProfileId':_0x54735c['user']['userProfileId']},'raw':!![]})[_0x3162('0x23')](function(_0x459db1){if(!_0x459db1||_0x459db1['autoAssociation']!=0x0)return _0x34032a;return db[_0x3162('0x32')]['create']({'name':_0x34032a[_0x3162('0x31')],'resourceId':_0x34032a['id'],'type':_0x459db1[_0x3162('0x31')],'sectionId':_0x459db1['id']},{})[_0x3162('0x23')](function(){return _0x34032a;});})[_0x3162('0x4a')](function(_0x397e95){logger[_0x3162('0x14')](_0x3162('0x7f'),_0x397e95);throw _0x397e95;});})[_0x3162('0x23')](respondWithResult(_0x81909b,0xc9))[_0x3162('0x4a')](handleError(_0x81909b,null));};exports['bulkCreate']=function(_0x42e4ef,_0x528bf6){var _0x102f0c=_0x42e4ef[_0x3162('0x56')];var _0x4e5420=[];if(_0x42e4ef[_0x3162('0x29')][_0x3162('0x26')]===_0x3162('0x6b'))throw new Error(_0x3162('0x78'));if(_[_0x3162('0x80')](_0x102f0c,[_0x3162('0x26'),_0x3162('0x29')])&&_0x42e4ef['user'][_0x3162('0x26')]!==_0x3162('0x27')){throw new Error(_0x3162('0x79'));}if(_['some'](_0x102f0c,[_0x3162('0x26'),_0x3162('0x27')])&&_0x42e4ef[_0x3162('0x29')][_0x3162('0x26')]!==_0x3162('0x27')){throw new Error(_0x3162('0x81'));}return licenseUtil['checkUserLimits'](_0x102f0c)[_0x3162('0x23')](function(){return validateUser(_0x102f0c[0x0]);})[_0x3162('0x23')](function(){for(var _0x3ac0ef=0x1;_0x3ac0ef<_0x102f0c[_0x3162('0x65')];_0x3ac0ef++){var _0x40ae99=_0x102f0c[_0x3ac0ef-0x1]['internal'];if(!_0x102f0c[_0x3ac0ef][_0x3162('0x5c')])_0x102f0c[_0x3ac0ef]['internal']=_0x40ae99+0x1;_0x4e5420[_0x3162('0x40')](validateUser(_0x102f0c[_0x3ac0ef]));}return BPromise[_0x3162('0x49')](_0x4e5420);})['then'](function(){_0x4e5420=[];for(var _0x2cf06c=0x0;_0x2cf06c<_0x102f0c[_0x3162('0x65')];_0x2cf06c++){_0x4e5420[_0x3162('0x40')](updateUser(_0x102f0c[_0x2cf06c]));}return BPromise['all'](_0x4e5420);})[_0x3162('0x23')](function(){return BPromise['each'](_0x102f0c,function(_0x5369a0){return db[_0x3162('0x36')][_0x3162('0x77')](_0x5369a0,{'include':[{'model':db[_0x3162('0x7d')],'as':_0x3162('0x7d')}]})[_0x3162('0x23')](function(_0x34c426){_0x5369a0['id']=_0x34c426['id'];return _0x5369a0;});});})[_0x3162('0x23')](function(_0x5308d1){if(_0x42e4ef['body']['role']===_0x3162('0x29'))return _0x5308d1;if(_0x42e4ef[_0x3162('0x29')]['role']!=='user')return _0x5308d1;var _0x118d5e=_['some'](_0x5308d1,function(_0xd803e){return _0xd803e[_0x3162('0x26')]===_0x3162('0x6b')||_0xd803e[_0x3162('0x26')]==='telephone';});if(!_0x118d5e)return _0x5308d1;return db[_0x3162('0x7e')][_0x3162('0x41')]({'where':{'name':{'$or':[_0x3162('0x2a'),'Telephones']},'userProfileId':_0x42e4ef[_0x3162('0x29')]['userProfileId']},'raw':!![]})[_0x3162('0x23')](function(_0x5aa57b){if(_[_0x3162('0x82')](_0x5aa57b)||!_[_0x3162('0x80')](_0x5aa57b,[_0x3162('0x83'),0x0]))return _0x5308d1;_0x4e5420=[];var _0x591bb7=_(_0x5aa57b)[_0x3162('0x37')](function(_0x23c591){if(_0x23c591[_0x3162('0x83')]===0x1)return;return _0x23c591[_0x3162('0x31')]==='Agents'?_0x3162('0x6b'):_0x3162('0x2c');})['compact']()[_0x3162('0x2f')]();for(var _0x21a6e6=0x0;_0x21a6e6<_0x5308d1[_0x3162('0x65')];_0x21a6e6++){if(!_[_0x3162('0x3e')](_0x591bb7,_0x5308d1[_0x21a6e6][_0x3162('0x26')]))return;var _0x197427=_0x5308d1[_0x21a6e6][_0x3162('0x26')]===_0x3162('0x6b')?_0x3162('0x2a'):_0x3162('0x2b');_0x4e5420['push'](db[_0x3162('0x32')][_0x3162('0x77')]({'name':_0x5308d1[_0x21a6e6][_0x3162('0x31')],'resourceId':_0x5308d1[_0x21a6e6]['id'],'type':_0x197427,'sectionId':_[_0x3162('0x30')](_0x5aa57b,[_0x3162('0x31'),_0x197427])['id']},{}));}return BPromise[_0x3162('0x49')](_0x4e5420);});})[_0x3162('0x23')](respondWithResult(_0x528bf6,0xc9))[_0x3162('0x4a')](handleError(_0x528bf6,null));};exports['changePassword']=function(_0x2d179b,_0x3f0764){if(_0x2d179b['body']['id']){delete _0x2d179b[_0x3162('0x56')]['id'];}return db[_0x3162('0x36')][_0x3162('0x30')]({'where':{'id':_0x2d179b[_0x3162('0x57')]['id']}})[_0x3162('0x23')](function(_0x54305b){if(!_0x54305b)return null;if(_0x54305b['id']===_0x2d179b[_0x3162('0x29')]['id']){if(!_0x2d179b[_0x3162('0x56')]['oldPassword']||!_0x2d179b[_0x3162('0x56')][_0x3162('0x84')]){throw new db[(_0x3162('0x85'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x54305b[_0x3162('0x86')](_0x2d179b[_0x3162('0x56')]['oldPassword'])){throw new db[(_0x3162('0x85'))][(_0x3162('0x87'))](_0x3162('0x88'));}if(_0x2d179b[_0x3162('0x56')][_0x3162('0x89')]===_0x2d179b[_0x3162('0x56')][_0x3162('0x84')]){throw new db[(_0x3162('0x85'))][(_0x3162('0x87'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x2d179b[_0x3162('0x29')][_0x3162('0x26')]==='admin'){if(!_0x2d179b[_0x3162('0x56')][_0x3162('0x84')]){throw new db[(_0x3162('0x85'))][(_0x3162('0x87'))](_0x3162('0x8a'));}}else if(_0x2d179b[_0x3162('0x29')][_0x3162('0x26')]===_0x3162('0x29')){if(!_0x2d179b[_0x3162('0x56')][_0x3162('0x84')]){throw new db[(_0x3162('0x85'))][(_0x3162('0x87'))](_0x3162('0x8a'));}if(_0x54305b['role']!==_0x3162('0x6b')){throw new db[(_0x3162('0x85'))]['ValidationError'](_0x3162('0x78'));}}else{throw new db['Sequelize'][(_0x3162('0x87'))](_0x3162('0x78'));}return _0x54305b;})[_0x3162('0x23')](handleEntityNotFound(_0x3f0764,null))[_0x3162('0x23')](function(_0x48f3cb){return db[_0x3162('0x5d')][_0x3162('0x8b')]({'attributes':['id',_0x3162('0x5e'),_0x3162('0x8c'),_0x3162('0x8d')]})[_0x3162('0x23')](function(_0x2618c3){if(_0x2618c3[_0x3162('0x5e')])authService[_0x3162('0x5f')](_0x2d179b[_0x3162('0x56')][_0x3162('0x84')]);if(!_0x2618c3['enforcePasswordHistory']||!_0x48f3cb[_0x3162('0x8e')])return _0x48f3cb;authService[_0x3162('0x8f')](_0x2d179b[_0x3162('0x56')][_0x3162('0x84')],_0x48f3cb['previousPasswords'],_0x2618c3[_0x3162('0x8d')]);return _0x48f3cb;})[_0x3162('0x23')](saveUpdates({'password':_0x2d179b[_0x3162('0x56')]['newPassword'],'passwordResetAt':_0x2d179b[_0x3162('0x29')]['id']==_0x2d179b[_0x3162('0x57')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x2d179b[_0x3162('0x56')][_0x3162('0x84')],_0x48f3cb['previousPasswords'])},null));})[_0x3162('0x23')](respondWithResult(_0x3f0764,null))[_0x3162('0x4a')](handleError(_0x3f0764,null));};exports[_0x3162('0x90')]=function(_0x3f35d5,_0x5917d1){var _0x2d756e=_0x3f35d5[_0x3162('0x56')][_0x3162('0x91')];return db['User'][_0x3162('0x30')]({'where':{'id':_0x3f35d5[_0x3162('0x57')]['id']},'attributes':['id',_0x3162('0x31'),_0x3162('0x26'),_0x3162('0x92'),_0x3162('0x93'),_0x3162('0x94'),'interface']})[_0x3162('0x23')](handleEntityNotFound(_0x5917d1,null))[_0x3162('0x23')](function(_0x348241){if(_0x348241){if(!utils['isValidChannel'](_0x2d756e)){throw new db[(_0x3162('0x85'))][(_0x3162('0x87'))](_0x3162('0x95'));}return _0x348241['add'+_[_0x3162('0x96')](_0x2d756e[_0x3162('0x97')]())+_0x3162('0x98')](_0x3f35d5[_0x3162('0x56')][_0x3162('0x5b')],{'penalty':_0x3f35d5[_0x3162('0x56')][_0x3162('0x99')]||0x0})[_0x3162('0x9a')](function(_0x2ae412){for(var _0x2f1bc1=0x0;_0x2f1bc1<_0x3f35d5[_0x3162('0x56')][_0x3162('0x5b')][_0x3162('0x65')];_0x2f1bc1+=0x1){var _0x153f96={'UserId':Number(_0x3f35d5[_0x3162('0x57')]['id'])};_0x153f96[_[_0x3162('0x96')](_0x2d756e[_0x3162('0x97')]())+_0x3162('0x9b')]=Number(_0x3f35d5[_0x3162('0x56')][_0x3162('0x5b')][_0x2f1bc1]);socket[_0x3162('0x9c')](_0x3162('0x29')+_['capitalize'](_0x2d756e[_0x3162('0x97')]())+_0x3162('0x9d'),_0x153f96);}return _0x2ae412;})['then'](function(){if(_0x2d756e===_0x3162('0x9e')){return db[_0x3162('0x9f')][_0x3162('0x41')]({'where':{'id':_0x3f35d5[_0x3162('0x56')][_0x3162('0x5b')]||[]},'raw':!![],'attributes':['id',_0x3162('0x31')]});}})['then'](function(_0x63da70){var _0x10b7d3=_0x348241['get']({'plain':!![]});var _0x37770e=[];if(_0x2d756e==='voice'&&_0x10b7d3[_0x3162('0x26')]===_0x3162('0x6b')&&_0x10b7d3[_0x3162('0x92')]){for(var _0x46ef5a=0x0;_0x46ef5a<_0x63da70['length'];_0x46ef5a+=0x1){_0x37770e[_0x3162('0x40')]({'membername':_0x10b7d3[_0x3162('0x31')],'UserId':_0x10b7d3['id'],'queue_name':_0x63da70[_0x46ef5a][_0x3162('0x31')],'VoiceQueueId':_0x63da70[_0x46ef5a]['id'],'interface':_[_0x3162('0x66')](_0x10b7d3[_0x3162('0xa0')])?util[_0x3162('0xa1')](_0x3162('0xa2'),_0x10b7d3[_0x3162('0x31')]):_0x10b7d3['interface'],'paused':_0x10b7d3[_0x3162('0x94')]||![],'penalty':_0x3f35d5[_0x3162('0x56')][_0x3162('0x99')]||0x0});}return BPromise[_0x3162('0xa3')](_0x37770e,function(_0x57af9d){return db[_0x3162('0xa4')]['upsert'](_0x57af9d);});}return _0x348241;});}})[_0x3162('0x23')](respondWithStatusCode(_0x5917d1,null))[_0x3162('0x4a')](handleError(_0x5917d1,null));};exports[_0x3162('0xa5')]=function(_0x2b5b4d,_0x58f6bb){var _0x21e6ff;return db[_0x3162('0x36')][_0x3162('0x30')]({'where':{'id':_0x2b5b4d['params']['id']},'attributes':['id',_0x3162('0x31'),'role']})[_0x3162('0x23')](handleEntityNotFound(_0x58f6bb,null))[_0x3162('0x23')](function(_0x1d734f){if(_0x1d734f){_0x21e6ff=_0x1d734f;if(!_0x2b5b4d[_0x3162('0x3c')][_0x3162('0x91')]||!utils[_0x3162('0xa6')](_0x2b5b4d[_0x3162('0x3c')]['channel'])){throw new db[(_0x3162('0x85'))][(_0x3162('0x87'))](_0x3162('0x95'));}return _0x1d734f[_0x3162('0xa7')+_[_0x3162('0x96')](_0x2b5b4d[_0x3162('0x3c')]['channel'][_0x3162('0x97')]())+_0x3162('0x98')](_0x2b5b4d[_0x3162('0x3c')][_0x3162('0x5b')]);}})['then'](function(_0x46d2ab){if(_[_0x3162('0xa8')](_0x2b5b4d[_0x3162('0x3c')][_0x3162('0x5b')])){for(var _0x2fd7a4=0x0;_0x2fd7a4<_0x2b5b4d['query']['ids'][_0x3162('0x65')];_0x2fd7a4+=0x1){var _0x2d3ffd={'UserId':Number(_0x2b5b4d[_0x3162('0x57')]['id'])};_0x2d3ffd[_['capitalize'](_0x2b5b4d[_0x3162('0x3c')][_0x3162('0x91')][_0x3162('0x97')]())+_0x3162('0x9b')]=Number(_0x2b5b4d[_0x3162('0x3c')][_0x3162('0x5b')][_0x2fd7a4]);socket['emit'](_0x3162('0x29')+_['capitalize'](_0x2b5b4d[_0x3162('0x3c')][_0x3162('0x91')]['toLowerCase']())+_0x3162('0xa9'),_0x2d3ffd);}}else{var _0x2d3ffd={'UserId':Number(_0x2b5b4d[_0x3162('0x57')]['id'])};_0x2d3ffd[_['capitalize'](_0x2b5b4d['query']['channel'][_0x3162('0x97')]())+_0x3162('0x9b')]=Number(_0x2b5b4d[_0x3162('0x3c')][_0x3162('0x5b')]);socket['emit']('user'+_[_0x3162('0x96')](_0x2b5b4d['query'][_0x3162('0x91')][_0x3162('0x97')]())+_0x3162('0xa9'),_0x2d3ffd);}return _0x46d2ab;})[_0x3162('0x23')](function(){if(_0x2b5b4d[_0x3162('0x3c')][_0x3162('0x91')]==='voice'){return db[_0x3162('0xa4')][_0x3162('0x24')]({'where':{'UserId':_0x2b5b4d['params']['id'],'VoiceQueueId':_0x2b5b4d[_0x3162('0x3c')]['ids']},'individualHooks':!![]})[_0x3162('0x23')](function(){return _0x21e6ff;});}return _0x21e6ff;})['then'](respondWithStatusCode(_0x58f6bb,null))[_0x3162('0x4a')](handleError(_0x58f6bb,null));};exports[_0x3162('0xaa')]=function(_0x10ab22,_0x563aec){_0x10ab22[_0x3162('0x56')]['userpic']=_0x10ab22['file']['filename'];return db[_0x3162('0x36')][_0x3162('0x30')]({'where':{'id':_0x10ab22[_0x3162('0x57')]['id']}})[_0x3162('0x23')](handleEntityNotFound(_0x563aec,null))[_0x3162('0x23')](saveUpdates(_0x10ab22[_0x3162('0x56')],null))[_0x3162('0x23')](respondWithResult(_0x563aec,null))[_0x3162('0x4a')](handleError(_0x563aec,null));};exports[_0x3162('0xab')]=function(_0x2d298e,_0x17be94){var _0x3f69bf=path[_0x3162('0xac')](config[_0x3162('0xad')],_0x3162('0xae'));return db[_0x3162('0x36')]['find']({'where':{'id':_0x2d298e[_0x3162('0x57')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x3162('0x23')](handleEntityNotFound(_0x17be94,null))[_0x3162('0x23')](function(_0x44781e){if(_0x44781e){if(_[_0x3162('0x66')](_0x44781e[_0x3162('0xaf')])){return _0x17be94[_0x3162('0xb0')](_0x3f69bf);}else{if(!fs[_0x3162('0xb1')](path[_0x3162('0xac')](config[_0x3162('0xad')],_0x3162('0xb2'),_0x44781e[_0x3162('0xaf')]))){return _0x17be94[_0x3162('0xb0')](_0x3f69bf);}return _0x17be94[_0x3162('0xb0')](path['join'](config['root'],_0x3162('0xb2'),_0x44781e[_0x3162('0xaf')]));}}})[_0x3162('0x4a')](handleError(_0x17be94,null));};exports['getOpenTabs']=function(_0x499e3f,_0x544631){return db[_0x3162('0x36')][_0x3162('0x30')]({'where':{'id':_0x499e3f[_0x3162('0x57')]['id']},'attributes':['id']})[_0x3162('0x23')](handleEntityNotFound(_0x544631,null))['then'](function(_0x21fbb1){var _0x5890e8=[];values=_0x21fbb1[_0x3162('0x45')];_0x5890e8['push'](get_open_tabs(_0x3162('0x44'),_0x21fbb1[_0x3162('0x45')]));_0x5890e8[_0x3162('0x40')](get_open_tabs(_0x3162('0x46'),_0x21fbb1[_0x3162('0x45')]));_0x5890e8['push'](get_open_tabs('openchannel',_0x21fbb1[_0x3162('0x45')]));_0x5890e8[_0x3162('0x40')](get_open_tabs(_0x3162('0x48'),_0x21fbb1[_0x3162('0x45')]));_0x5890e8[_0x3162('0x40')](get_open_tabs('fax',_0x21fbb1[_0x3162('0x45')]));_0x5890e8[_0x3162('0x40')](get_open_tabs(_0x3162('0x55'),_0x21fbb1[_0x3162('0x45')]));return BPromise[_0x3162('0x49')](_0x5890e8);})[_0x3162('0x23')](function(_0x4f94b2){var _0x1954b7=[];if(_0x4f94b2){for(var _0x282428=0x0;_0x282428=_0x26def8){_0x3afb3a=_0x26def8;_0x8b1b2b=0xc8;}else{_0x8b1b2b=0xce;}_0x581aae[_0xcc6a('0x21')](_0x8b1b2b);return _0x581aae[_0xcc6a('0x28')]('Content-Range',_0x3514f3+'-'+_0x3afb3a+'/'+_0x26def8)[_0xcc6a('0x23')](_0x294486);}return null;};}function saveUpdates(_0x3cf14c){return function(_0x2c6d88){if(_0x2c6d88){return _0x2c6d88['update'](_0x3cf14c)[_0xcc6a('0x15')](function(_0x5308d4){return _0x5308d4;});}return null;};}function removeEntity(_0x4f67d3){return function(_0x33b72b){if(_0x33b72b){return _0x33b72b[_0xcc6a('0x29')]()[_0xcc6a('0x15')](function(){var _0x11b481=_0x33b72b[_0xcc6a('0x2a')]({'plain':!![]});if(_0x11b481[_0xcc6a('0x2b')]==='admin')return;var _0x7b2b54=[{'name':_0xcc6a('0x2c'),'value':_0xcc6a('0x2d'),'ignore':!![]},{'name':_0xcc6a('0x2e'),'value':_0xcc6a('0x2f'),'ignore':![]},{'name':_0xcc6a('0x30'),'value':_0xcc6a('0x31'),'ignore':![]}];var _0xcbe838=_(_0x7b2b54)['filter'](_0xcc6a('0x32'))[_0xcc6a('0x33')](_0xcc6a('0x34'))[_0xcc6a('0x34')]();if(_[_0xcc6a('0x35')](_0xcbe838,_0x11b481[_0xcc6a('0x2b')])){return;}var _0x28b16e=_['find'](_0x7b2b54,[_0xcc6a('0x34'),_0x11b481['role']])['name'];return db['UserProfileResource'][_0xcc6a('0x29')]({'where':{'type':_0x28b16e,'resourceId':_0x11b481['id']}})[_0xcc6a('0x15')](function(){return _0x33b72b;});})[_0xcc6a('0x15')](function(){_0x4f67d3[_0xcc6a('0x21')](0xcc)[_0xcc6a('0x22')]();});}};}function handleEntityNotFound(_0x5856af){return function(_0x58f6ee){if(!_0x58f6ee){_0x5856af[_0xcc6a('0x20')](0x194);}return _0x58f6ee;};}function handleError(_0x11173a,_0x4598a8){_0x4598a8=_0x4598a8||0x1f4;return function(_0x538ea5){logger[_0xcc6a('0x1b')](_0x538ea5[_0xcc6a('0x36')]);if(_0x538ea5[_0xcc6a('0x37')]){delete _0x538ea5[_0xcc6a('0x37')];}_0x11173a[_0xcc6a('0x21')](_0x4598a8)[_0xcc6a('0x38')](_0x538ea5);};}exports[_0xcc6a('0x39')]=function(_0x18a252,_0x2a1cd2){var _0x373d5b={},_0x5b11c8={'count':0x0,'rows':[]};var _0x2c14ba=_(db[_0xcc6a('0x3a')][_0xcc6a('0x3b')])[_0xcc6a('0x33')](function(_0x33e8c8){return{'name':_0x33e8c8[_0xcc6a('0x3c')],'type':_0x33e8c8[_0xcc6a('0x3d')]['key']};})['filter'](function(_0x1d3e45){return!_[_0xcc6a('0x35')]([_0xcc6a('0x3e'),_0xcc6a('0x3f')],_0x1d3e45[_0xcc6a('0x37')]);})[_0xcc6a('0x34')]();_0x373d5b=qs[_0xcc6a('0x40')](_0x2c14ba,_0x18a252);var _0x1199f1={'where':_0x373d5b['where']};return db['User'][_0xcc6a('0x27')](_0x1199f1)['then'](function(_0x578525){_0x5b11c8['count']=_0x578525;if(_0x18a252[_0xcc6a('0x41')][_0xcc6a('0x42')]){_0x373d5b[_0xcc6a('0x43')]=[{'all':!![]}];}if(!_[_0xcc6a('0x35')](_0x373d5b[_0xcc6a('0x44')],'id')){_0x373d5b['attributes'][_0xcc6a('0x45')]('id');}return db[_0xcc6a('0x3a')][_0xcc6a('0x46')](_0x373d5b);})[_0xcc6a('0x15')](function(_0x14ca90){_0x5b11c8[_0xcc6a('0x47')]=_0x14ca90;if(_0x18a252['query'][_0xcc6a('0x48')]===_0xcc6a('0x49')){var _0x103eee=[];for(var _0x11c137=0x0;_0x11c137<_0x5b11c8['rows'][_0xcc6a('0x4a')];_0x11c137++){_0x103eee['push'](get_open_tabs(_0xcc6a('0x4b'),_0x5b11c8[_0xcc6a('0x47')][_0x11c137][_0xcc6a('0x4c')]));_0x103eee['push'](get_open_tabs(_0xcc6a('0x4d'),_0x5b11c8[_0xcc6a('0x47')][_0x11c137][_0xcc6a('0x4c')]));_0x103eee['push'](get_open_tabs('fax',_0x5b11c8[_0xcc6a('0x47')][_0x11c137][_0xcc6a('0x4c')]));_0x103eee[_0xcc6a('0x45')](get_open_tabs(_0xcc6a('0x4e'),_0x5b11c8[_0xcc6a('0x47')][_0x11c137]['dataValues']));_0x103eee[_0xcc6a('0x45')](get_open_tabs(_0xcc6a('0x4f'),_0x5b11c8['rows'][_0x11c137][_0xcc6a('0x4c')]));_0x103eee[_0xcc6a('0x45')](get_open_tabs(_0xcc6a('0x50'),_0x5b11c8[_0xcc6a('0x47')][_0x11c137][_0xcc6a('0x4c')]));}return BPromise[_0xcc6a('0x51')](_0x103eee)['then'](function(_0x4e1a0b){return _0x5b11c8;});}else{return _0x5b11c8;}})['then'](respondWithFilteredResult(_0x2a1cd2,_0x373d5b))[_0xcc6a('0x1f')](handleError(_0x2a1cd2,null));};exports[_0xcc6a('0x52')]=function(_0x13f4df,_0x323bb7){var _0x4a25ce={'raw':![],'where':{'id':_0x13f4df['params']['id']}},_0x1c3bb8={};_0x1c3bb8[_0xcc6a('0x53')]=_[_0xcc6a('0x54')](_[_0xcc6a('0x55')](db[_0xcc6a('0x3a')][_0xcc6a('0x3b')]),[_0xcc6a('0x3e'),'salt']);_0x1c3bb8[_0xcc6a('0x41')]=_[_0xcc6a('0x55')](_0x13f4df[_0xcc6a('0x41')]);_0x1c3bb8[_0xcc6a('0x56')]=_[_0xcc6a('0x57')](_0x1c3bb8[_0xcc6a('0x53')],_0x1c3bb8[_0xcc6a('0x41')]);_0x4a25ce[_0xcc6a('0x44')]=_[_0xcc6a('0x57')](_0x1c3bb8[_0xcc6a('0x53')],qs['fields'](_0x13f4df[_0xcc6a('0x41')][_0xcc6a('0x58')]));_0x4a25ce[_0xcc6a('0x44')]=_0x4a25ce[_0xcc6a('0x44')][_0xcc6a('0x4a')]?_0x4a25ce[_0xcc6a('0x44')]:_0x1c3bb8['model'];if(_0x13f4df['query'][_0xcc6a('0x42')]){_0x4a25ce['include']=[{'all':!![]}];}_0x4a25ce=_[_0xcc6a('0x59')]({},_0x4a25ce,_0x13f4df[_0xcc6a('0x5a')]);if(!_[_0xcc6a('0x35')](_0x4a25ce[_0xcc6a('0x44')],'id')){_0x4a25ce[_0xcc6a('0x44')][_0xcc6a('0x45')]('id');}return db[_0xcc6a('0x3a')][_0xcc6a('0x5b')](_0x4a25ce)[_0xcc6a('0x15')](handleEntityNotFound(_0x323bb7,null))[_0xcc6a('0x15')](function(_0x12224f){var _0x47c131=[];values=_0x12224f;if(_0x13f4df[_0xcc6a('0x41')]['openTabs']===_0xcc6a('0x49')){_0x47c131[_0xcc6a('0x45')](get_open_tabs(_0xcc6a('0x4b'),_0x12224f['dataValues']));_0x47c131[_0xcc6a('0x45')](get_open_tabs('sms',_0x12224f[_0xcc6a('0x4c')]));_0x47c131['push'](get_open_tabs(_0xcc6a('0x4f'),_0x12224f[_0xcc6a('0x4c')]));_0x47c131[_0xcc6a('0x45')](get_open_tabs(_0xcc6a('0x50'),_0x12224f[_0xcc6a('0x4c')]));_0x47c131[_0xcc6a('0x45')](get_open_tabs(_0xcc6a('0x5c'),_0x12224f[_0xcc6a('0x4c')]));_0x47c131['push'](get_open_tabs(_0xcc6a('0x4e'),_0x12224f['dataValues']));return BPromise[_0xcc6a('0x51')](_0x47c131);}else{return values;}})['then'](function(_0x1807cb){return values;})[_0xcc6a('0x15')](respondWithResult(_0x323bb7,null))[_0xcc6a('0x1f')](handleError(_0x323bb7,null));};exports['update']=function(_0x2fa7fa,_0x5e4447){if(_0x2fa7fa['body']['id']){delete _0x2fa7fa[_0xcc6a('0x5d')]['id'];}delete _0x2fa7fa[_0xcc6a('0x5d')][_0xcc6a('0x2b')];return db[_0xcc6a('0x3a')][_0xcc6a('0x5b')]({'where':{'id':_0x2fa7fa[_0xcc6a('0x5e')]['id']}})[_0xcc6a('0x15')](handleEntityNotFound(_0x5e4447,null))[_0xcc6a('0x15')](saveUpdates(_0x2fa7fa[_0xcc6a('0x5d')],null))[_0xcc6a('0x15')](respondWithResult(_0x5e4447,null))[_0xcc6a('0x1f')](handleError(_0x5e4447,null));};exports[_0xcc6a('0x5f')]=function(_0x2cc561,_0x483aa4){return db[_0xcc6a('0x3a')][_0xcc6a('0x5f')]()[_0xcc6a('0x15')](respondWithResult(_0x483aa4,null))[_0xcc6a('0x1f')](handleError(_0x483aa4,null));};exports['addContacts']=function(_0x46d93b,_0x4ed702){return db[_0xcc6a('0x3a')][_0xcc6a('0x5b')]({'where':{'id':_0x46d93b[_0xcc6a('0x5e')]['id']}})[_0xcc6a('0x15')](handleEntityNotFound(_0x4ed702,null))[_0xcc6a('0x15')](function(_0x3f1361){if(_0x3f1361){return _0x3f1361[_0xcc6a('0x60')](_0x46d93b[_0xcc6a('0x5d')]['ids'],_['omit'](_0x46d93b['body'],[_0xcc6a('0x61'),'id'])||{});}})[_0xcc6a('0x15')](respondWithResult(_0x4ed702,null))[_0xcc6a('0x1f')](handleError(_0x4ed702,null));};function validateUser(_0x4a9f34){return new BPromise(function(_0x2f7787,_0x2fa1ec){if(_0x4a9f34[_0xcc6a('0x62')])return _0x2f7787(_0x4a9f34);return db[_0xcc6a('0x63')]['findById'](0x1)['then'](function(_0xaec5e8){if(_0xaec5e8[_0xcc6a('0x64')])authService[_0xcc6a('0x65')](_0x4a9f34[_0xcc6a('0x3e')]);db['User'][_0xcc6a('0x66')](_0xcc6a('0x62'))[_0xcc6a('0x15')](function(_0x3b5e04){if(_[_0xcc6a('0x67')](_0x3b5e04)){_0x4a9f34['internal']=_0xaec5e8['min_internal']||0x1;return;}if(_[_0xcc6a('0x67')](_0xaec5e8[_0xcc6a('0x68')])||_0xaec5e8[_0xcc6a('0x68')]===_0x3b5e04){_0x4a9f34[_0xcc6a('0x62')]=_0x3b5e04+0x1;return;}if(_0xaec5e8['min_internal']>_0x3b5e04){_0x4a9f34['internal']=_0xaec5e8[_0xcc6a('0x68')];return;}return db[_0xcc6a('0x69')][_0xcc6a('0x41')](_0xcc6a('0x6a'),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0xcc6a('0x15')](function(_0x25df30){if(_0x25df30&&_0x25df30[_0xcc6a('0x4a')]){for(var _0x729b2=0x0,_0x51a10b=_0x25df30[_0xcc6a('0x4a')];_0x729b2<_0x51a10b&&_[_0xcc6a('0x67')](_0x4a9f34['internal']);_0x729b2++){if(_0xaec5e8[_0xcc6a('0x68')]<=_0x25df30[_0x729b2]['from']){_0x4a9f34[_0xcc6a('0x62')]=_0x25df30[_0x729b2]['from'];}else if(_0xaec5e8[_0xcc6a('0x68')]>_0x25df30[_0x729b2][_0xcc6a('0x6b')]&&_0xaec5e8[_0xcc6a('0x68')]<=_0x25df30[_0x729b2]['to']){_0x4a9f34['internal']=_0xaec5e8[_0xcc6a('0x68')];}}}if(_['isNil'](_0x4a9f34[_0xcc6a('0x62')])){_0x4a9f34['internal']=_0x3b5e04+0x1;}return _0x2f7787(_0x4a9f34);});});})[_0xcc6a('0x1f')](function(_0x2e7e44){_0x2fa1ec(_0x2e7e44);});});}function updateUser(_0x29a029){return new BPromise(function(_0x2dc347,_0x122422){try{if(_0x29a029[_0xcc6a('0x6c')]){_0x29a029['mailbox']=_0x29a029[_0xcc6a('0x62')];_0x29a029[_0xcc6a('0x6d')]={'mailbox':_0x29a029[_0xcc6a('0x62')],'password':_0x29a029[_0xcc6a('0x3e')],'fullname':_0x29a029[_0xcc6a('0x6e')],'email':_0x29a029['email']};}if(_0x29a029[_0xcc6a('0x2b')]===_0xcc6a('0x2f')){if(!_0x29a029['permissions'])_0x29a029['permissions']=[_0xcc6a('0x6f'),_0xcc6a('0x70'),_0xcc6a('0x71'),_0xcc6a('0x72'),_0xcc6a('0x73'),_0xcc6a('0x74'),'105',_0xcc6a('0x75'),_0xcc6a('0x76'),_0xcc6a('0x77'),_0xcc6a('0x78'),_0xcc6a('0x79'),_0xcc6a('0x7a'),'114','115'];}_0x2dc347(_0x29a029);}catch(_0x2ff473){_0x122422(_0x2ff473);}});}exports[_0xcc6a('0x7b')]=function(_0x17ae8d,_0x2e6855){if(_0x17ae8d[_0xcc6a('0x2d')][_0xcc6a('0x2b')]===_0xcc6a('0x2f'))throw new Error('Unauthorized');if(_0x17ae8d[_0xcc6a('0x5d')][_0xcc6a('0x2b')]===_0xcc6a('0x2d')&&_0x17ae8d[_0xcc6a('0x2d')][_0xcc6a('0x2b')]!==_0xcc6a('0x7c')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x17ae8d[_0xcc6a('0x5d')][_0xcc6a('0x2b')]===_0xcc6a('0x7c')&&_0x17ae8d['user'][_0xcc6a('0x2b')]!==_0xcc6a('0x7c')){throw new Error(_0xcc6a('0x7d'));}return licenseUtil[_0xcc6a('0x7e')]([_0x17ae8d[_0xcc6a('0x5d')]])[_0xcc6a('0x15')](function(){return validateUser(_0x17ae8d['body']);})[_0xcc6a('0x15')](function(_0x3c4948){return updateUser(_0x3c4948)['then'](function(_0x1848dd){if(_0x1848dd[_0xcc6a('0x2b')]===_0xcc6a('0x7c')){_0x1848dd[_0xcc6a('0x7f')]=_0x17ae8d[_0xcc6a('0x2d')]['settingsEnabled'];delete _0x1848dd[_0xcc6a('0x80')];}return _0x1848dd;});})[_0xcc6a('0x15')](function(_0xbd536e){return db[_0xcc6a('0x3a')][_0xcc6a('0x7b')](_0xbd536e,{'include':[{'model':db[_0xcc6a('0x6d')],'as':'VoiceMail'}]});})['then'](function(_0x225bf6){if(_0x17ae8d['body'][_0xcc6a('0x2b')]===_0xcc6a('0x2d'))return _0x225bf6;if(_0x17ae8d[_0xcc6a('0x2d')][_0xcc6a('0x2b')]!==_0xcc6a('0x2d'))return _0x225bf6;return db[_0xcc6a('0x81')][_0xcc6a('0x5b')]({'where':{'name':_0x225bf6[_0xcc6a('0x2b')]===_0xcc6a('0x2f')?_0xcc6a('0x2e'):_0xcc6a('0x30'),'userProfileId':_0x17ae8d[_0xcc6a('0x2d')]['userProfileId']},'raw':!![]})[_0xcc6a('0x15')](function(_0x443e5b){if(!_0x443e5b||_0x443e5b[_0xcc6a('0x82')]!=0x0)return _0x225bf6;return db[_0xcc6a('0x83')]['create']({'name':_0x225bf6[_0xcc6a('0x37')],'resourceId':_0x225bf6['id'],'type':_0x443e5b['name'],'sectionId':_0x443e5b['id']},{})[_0xcc6a('0x15')](function(){return _0x225bf6;});})[_0xcc6a('0x1f')](function(_0xe09f7){logger[_0xcc6a('0x1b')](_0xcc6a('0x84'),_0xe09f7);throw _0xe09f7;});})[_0xcc6a('0x15')](respondWithResult(_0x2e6855,0xc9))[_0xcc6a('0x1f')](handleError(_0x2e6855,null));};exports['bulkCreate']=function(_0x357b66,_0x60c0a2){var _0x2dd98a=_0x357b66[_0xcc6a('0x5d')];var _0xc5cc18=[];if(_0x357b66[_0xcc6a('0x2d')]['role']===_0xcc6a('0x2f'))throw new Error(_0xcc6a('0x85'));if(_['some'](_0x2dd98a,['role',_0xcc6a('0x2d')])&&_0x357b66[_0xcc6a('0x2d')][_0xcc6a('0x2b')]!==_0xcc6a('0x7c')){throw new Error(_0xcc6a('0x86'));}if(_['some'](_0x2dd98a,[_0xcc6a('0x2b'),'admin'])&&_0x357b66[_0xcc6a('0x2d')][_0xcc6a('0x2b')]!==_0xcc6a('0x7c')){throw new Error(_0xcc6a('0x87'));}return licenseUtil[_0xcc6a('0x7e')](_0x2dd98a)[_0xcc6a('0x15')](function(){return validateUser(_0x2dd98a[0x0]);})[_0xcc6a('0x15')](function(){for(var _0x1f4c4e=0x1;_0x1f4c4e<_0x2dd98a['length'];_0x1f4c4e++){var _0x312431=_0x2dd98a[_0x1f4c4e-0x1][_0xcc6a('0x62')];if(!_0x2dd98a[_0x1f4c4e][_0xcc6a('0x62')])_0x2dd98a[_0x1f4c4e]['internal']=_0x312431+0x1;_0xc5cc18[_0xcc6a('0x45')](validateUser(_0x2dd98a[_0x1f4c4e]));}return BPromise[_0xcc6a('0x51')](_0xc5cc18);})[_0xcc6a('0x15')](function(){_0xc5cc18=[];for(var _0x290196=0x0;_0x290196<_0x2dd98a[_0xcc6a('0x4a')];_0x290196++){_0xc5cc18[_0xcc6a('0x45')](updateUser(_0x2dd98a[_0x290196]));}return BPromise[_0xcc6a('0x51')](_0xc5cc18);})['then'](function(){return BPromise[_0xcc6a('0x88')](_0x2dd98a,function(_0x402df1){return db[_0xcc6a('0x3a')][_0xcc6a('0x7b')](_0x402df1,{'include':[{'model':db[_0xcc6a('0x6d')],'as':_0xcc6a('0x6d')}]})[_0xcc6a('0x15')](function(_0x1dd2f2){_0x402df1['id']=_0x1dd2f2['id'];return _0x402df1;});});})['then'](function(_0x47e671){if(_0x357b66[_0xcc6a('0x5d')]['role']===_0xcc6a('0x2d'))return _0x47e671;if(_0x357b66[_0xcc6a('0x2d')][_0xcc6a('0x2b')]!==_0xcc6a('0x2d'))return _0x47e671;var _0x2281bd=_[_0xcc6a('0x89')](_0x47e671,function(_0x35aa5e){return _0x35aa5e['role']===_0xcc6a('0x2f')||_0x35aa5e['role']==='telephone';});if(!_0x2281bd)return _0x47e671;return db[_0xcc6a('0x81')]['findAll']({'where':{'name':{'$or':[_0xcc6a('0x2e'),_0xcc6a('0x30')]},'userProfileId':_0x357b66['user']['userProfileId']},'raw':!![]})[_0xcc6a('0x15')](function(_0x4d0e37){if(_[_0xcc6a('0x8a')](_0x4d0e37)||!_[_0xcc6a('0x89')](_0x4d0e37,[_0xcc6a('0x82'),0x0]))return _0x47e671;_0xc5cc18=[];var _0x2e7f3e=_(_0x4d0e37)[_0xcc6a('0x33')](function(_0x41c474){if(_0x41c474['autoAssociation']===0x1)return;return _0x41c474[_0xcc6a('0x37')]===_0xcc6a('0x2e')?_0xcc6a('0x2f'):_0xcc6a('0x31');})['compact']()[_0xcc6a('0x34')]();for(var _0x35b777=0x0;_0x35b777<_0x47e671[_0xcc6a('0x4a')];_0x35b777++){if(!_[_0xcc6a('0x35')](_0x2e7f3e,_0x47e671[_0x35b777][_0xcc6a('0x2b')]))return;var _0x421298=_0x47e671[_0x35b777][_0xcc6a('0x2b')]==='agent'?_0xcc6a('0x2e'):_0xcc6a('0x30');_0xc5cc18['push'](db[_0xcc6a('0x83')][_0xcc6a('0x7b')]({'name':_0x47e671[_0x35b777][_0xcc6a('0x37')],'resourceId':_0x47e671[_0x35b777]['id'],'type':_0x421298,'sectionId':_[_0xcc6a('0x5b')](_0x4d0e37,[_0xcc6a('0x37'),_0x421298])['id']},{}));}return BPromise[_0xcc6a('0x51')](_0xc5cc18);});})[_0xcc6a('0x15')](respondWithResult(_0x60c0a2,0xc9))[_0xcc6a('0x1f')](handleError(_0x60c0a2,null));};exports[_0xcc6a('0x8b')]=function(_0x44fa34,_0x3efe1c){if(_0x44fa34[_0xcc6a('0x5d')]['id']){delete _0x44fa34[_0xcc6a('0x5d')]['id'];}return db[_0xcc6a('0x3a')]['find']({'where':{'id':_0x44fa34['params']['id']}})[_0xcc6a('0x15')](function(_0x44f737){if(!_0x44f737)return null;if(_0x44f737['id']===_0x44fa34['user']['id']){if(!_0x44fa34[_0xcc6a('0x5d')][_0xcc6a('0x8c')]||!_0x44fa34[_0xcc6a('0x5d')]['newPassword']){throw new db[(_0xcc6a('0x8d'))]['ValidationError'](_0xcc6a('0x8e'));}if(!_0x44f737[_0xcc6a('0x8f')](_0x44fa34['body'][_0xcc6a('0x8c')])){throw new db['Sequelize'][(_0xcc6a('0x90'))](_0xcc6a('0x91'));}if(_0x44fa34[_0xcc6a('0x5d')][_0xcc6a('0x8c')]===_0x44fa34[_0xcc6a('0x5d')][_0xcc6a('0x92')]){throw new db['Sequelize']['ValidationError'](_0xcc6a('0x93'));}}else if(_0x44fa34[_0xcc6a('0x2d')][_0xcc6a('0x2b')]==='admin'){if(!_0x44fa34[_0xcc6a('0x5d')][_0xcc6a('0x92')]){throw new db[(_0xcc6a('0x8d'))][(_0xcc6a('0x90'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x44fa34[_0xcc6a('0x2d')][_0xcc6a('0x2b')]===_0xcc6a('0x2d')){if(!_0x44fa34['body'][_0xcc6a('0x92')]){throw new db['Sequelize'][(_0xcc6a('0x90'))](_0xcc6a('0x94'));}if(_0x44f737['role']!==_0xcc6a('0x2f')){throw new db[(_0xcc6a('0x8d'))][(_0xcc6a('0x90'))](_0xcc6a('0x85'));}}else{throw new db[(_0xcc6a('0x8d'))][(_0xcc6a('0x90'))](_0xcc6a('0x85'));}return _0x44f737;})[_0xcc6a('0x15')](handleEntityNotFound(_0x3efe1c,null))[_0xcc6a('0x15')](function(_0x22d659){return db[_0xcc6a('0x63')]['findOne']({'attributes':['id','securePassword',_0xcc6a('0x95'),'passwordHistoryLimit']})[_0xcc6a('0x15')](function(_0x4970d9){if(_0x4970d9['securePassword'])authService[_0xcc6a('0x65')](_0x44fa34[_0xcc6a('0x5d')][_0xcc6a('0x92')]);if(!_0x4970d9[_0xcc6a('0x95')]||!_0x22d659['previousPasswords'])return _0x22d659;authService[_0xcc6a('0x96')](_0x44fa34['body']['newPassword'],_0x22d659[_0xcc6a('0x97')],_0x4970d9[_0xcc6a('0x98')]);return _0x22d659;})[_0xcc6a('0x15')](saveUpdates({'password':_0x44fa34[_0xcc6a('0x5d')][_0xcc6a('0x92')],'passwordResetAt':_0x44fa34[_0xcc6a('0x2d')]['id']==_0x44fa34[_0xcc6a('0x5e')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x44fa34[_0xcc6a('0x5d')][_0xcc6a('0x92')],_0x22d659[_0xcc6a('0x97')])},null));})['then'](respondWithResult(_0x3efe1c,null))[_0xcc6a('0x1f')](handleError(_0x3efe1c,null));};exports['addQueues']=function(_0x2f07f3,_0x5ab0eb){var _0x57553b=_0x2f07f3[_0xcc6a('0x5d')][_0xcc6a('0x99')];return db[_0xcc6a('0x3a')][_0xcc6a('0x5b')]({'where':{'id':_0x2f07f3[_0xcc6a('0x5e')]['id']},'attributes':['id','name','role','online',_0xcc6a('0x9a'),_0xcc6a('0x9b'),_0xcc6a('0x9c')]})[_0xcc6a('0x15')](handleEntityNotFound(_0x5ab0eb,null))[_0xcc6a('0x15')](function(_0x2848a8){if(_0x2848a8){if(!utils['isValidChannel'](_0x57553b)){throw new db[(_0xcc6a('0x8d'))]['ValidationError'](_0xcc6a('0x9d'));}return _0x2848a8[_0xcc6a('0x9e')+_[_0xcc6a('0x9f')](_0x57553b[_0xcc6a('0xa0')]())+_0xcc6a('0xa1')](_0x2f07f3['body']['ids'],{'penalty':_0x2f07f3[_0xcc6a('0x5d')][_0xcc6a('0xa2')]||0x0})['spread'](function(_0xfccb6f){for(var _0x307113=0x0;_0x307113<_0x2f07f3[_0xcc6a('0x5d')][_0xcc6a('0x61')][_0xcc6a('0x4a')];_0x307113+=0x1){var _0x2c8fbd={'UserId':Number(_0x2f07f3['params']['id'])};_0x2c8fbd[_[_0xcc6a('0x9f')](_0x57553b[_0xcc6a('0xa0')]())+_0xcc6a('0xa3')]=Number(_0x2f07f3['body']['ids'][_0x307113]);socket['emit']('user'+_[_0xcc6a('0x9f')](_0x57553b['toLowerCase']())+_0xcc6a('0xa4'),_0x2c8fbd);}return _0xfccb6f;})[_0xcc6a('0x15')](function(){if(_0x57553b==='voice'){return db[_0xcc6a('0xa5')]['findAll']({'where':{'id':_0x2f07f3[_0xcc6a('0x5d')][_0xcc6a('0x61')]||[]},'raw':!![],'attributes':['id',_0xcc6a('0x37')]});}})[_0xcc6a('0x15')](function(_0x65280b){var _0x197961=_0x2848a8[_0xcc6a('0x2a')]({'plain':!![]});var _0x299110=[];if(_0x57553b===_0xcc6a('0xa6')&&_0x197961[_0xcc6a('0x2b')]===_0xcc6a('0x2f')&&_0x197961[_0xcc6a('0xa7')]){for(var _0x27182c=0x0;_0x27182c<_0x65280b[_0xcc6a('0x4a')];_0x27182c+=0x1){_0x299110[_0xcc6a('0x45')]({'membername':_0x197961[_0xcc6a('0x37')],'UserId':_0x197961['id'],'queue_name':_0x65280b[_0x27182c][_0xcc6a('0x37')],'VoiceQueueId':_0x65280b[_0x27182c]['id'],'interface':_[_0xcc6a('0x67')](_0x197961[_0xcc6a('0x9c')])?util[_0xcc6a('0xa8')](_0xcc6a('0xa9'),_0x197961[_0xcc6a('0x37')]):_0x197961['interface'],'paused':_0x197961[_0xcc6a('0x9b')]||![],'penalty':_0x2f07f3[_0xcc6a('0x5d')][_0xcc6a('0xa2')]||0x0});}return BPromise['each'](_0x299110,function(_0x32fe46){return db[_0xcc6a('0xaa')]['upsert'](_0x32fe46);});}return _0x2848a8;});}})[_0xcc6a('0x15')](respondWithStatusCode(_0x5ab0eb,null))[_0xcc6a('0x1f')](handleError(_0x5ab0eb,null));};exports['removeQueues']=function(_0xa113c7,_0x2d147c){var _0x10e242;return db[_0xcc6a('0x3a')][_0xcc6a('0x5b')]({'where':{'id':_0xa113c7[_0xcc6a('0x5e')]['id']},'attributes':['id','name','role']})[_0xcc6a('0x15')](handleEntityNotFound(_0x2d147c,null))[_0xcc6a('0x15')](function(_0x50a8fe){if(_0x50a8fe){_0x10e242=_0x50a8fe;if(!_0xa113c7[_0xcc6a('0x41')]['channel']||!utils[_0xcc6a('0xab')](_0xa113c7['query'][_0xcc6a('0x99')])){throw new db[(_0xcc6a('0x8d'))][(_0xcc6a('0x90'))]('Unknown\x20channel');}return _0x50a8fe[_0xcc6a('0xac')+_[_0xcc6a('0x9f')](_0xa113c7[_0xcc6a('0x41')]['channel']['toLowerCase']())+'Queues'](_0xa113c7[_0xcc6a('0x41')][_0xcc6a('0x61')]);}})[_0xcc6a('0x15')](function(_0x412c37){if(_[_0xcc6a('0xad')](_0xa113c7[_0xcc6a('0x41')][_0xcc6a('0x61')])){for(var _0x80ca93=0x0;_0x80ca93<_0xa113c7[_0xcc6a('0x41')][_0xcc6a('0x61')][_0xcc6a('0x4a')];_0x80ca93+=0x1){var _0x4c8dc9={'UserId':Number(_0xa113c7['params']['id'])};_0x4c8dc9[_[_0xcc6a('0x9f')](_0xa113c7[_0xcc6a('0x41')][_0xcc6a('0x99')]['toLowerCase']())+_0xcc6a('0xa3')]=Number(_0xa113c7[_0xcc6a('0x41')][_0xcc6a('0x61')][_0x80ca93]);socket['emit'](_0xcc6a('0x2d')+_[_0xcc6a('0x9f')](_0xa113c7[_0xcc6a('0x41')][_0xcc6a('0x99')]['toLowerCase']())+_0xcc6a('0xae'),_0x4c8dc9);}}else{var _0x4c8dc9={'UserId':Number(_0xa113c7['params']['id'])};_0x4c8dc9[_['capitalize'](_0xa113c7[_0xcc6a('0x41')]['channel']['toLowerCase']())+_0xcc6a('0xa3')]=Number(_0xa113c7[_0xcc6a('0x41')][_0xcc6a('0x61')]);socket[_0xcc6a('0xaf')](_0xcc6a('0x2d')+_[_0xcc6a('0x9f')](_0xa113c7['query']['channel']['toLowerCase']())+_0xcc6a('0xae'),_0x4c8dc9);}return _0x412c37;})[_0xcc6a('0x15')](function(){if(_0xa113c7[_0xcc6a('0x41')][_0xcc6a('0x99')]===_0xcc6a('0xa6')){return db[_0xcc6a('0xaa')]['destroy']({'where':{'UserId':_0xa113c7['params']['id'],'VoiceQueueId':_0xa113c7[_0xcc6a('0x41')][_0xcc6a('0x61')]},'individualHooks':!![]})[_0xcc6a('0x15')](function(){return _0x10e242;});}return _0x10e242;})[_0xcc6a('0x15')](respondWithStatusCode(_0x2d147c,null))['catch'](handleError(_0x2d147c,null));};exports[_0xcc6a('0xb0')]=function(_0x519a8b,_0x2a38e6){_0x519a8b[_0xcc6a('0x5d')][_0xcc6a('0xb1')]=_0x519a8b[_0xcc6a('0xb2')][_0xcc6a('0xb3')];return db['User']['find']({'where':{'id':_0x519a8b[_0xcc6a('0x5e')]['id']}})[_0xcc6a('0x15')](handleEntityNotFound(_0x2a38e6,null))['then'](saveUpdates(_0x519a8b[_0xcc6a('0x5d')],null))[_0xcc6a('0x15')](respondWithResult(_0x2a38e6,null))[_0xcc6a('0x1f')](handleError(_0x2a38e6,null));};exports[_0xcc6a('0xb4')]=function(_0x1dc459,_0x2a9336){var _0x46fe90=path[_0xcc6a('0xb5')](config[_0xcc6a('0xb6')],_0xcc6a('0xb7'));return db['User']['find']({'where':{'id':_0x1dc459[_0xcc6a('0x5e')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0xcc6a('0x15')](handleEntityNotFound(_0x2a9336,null))[_0xcc6a('0x15')](function(_0x15a4c9){if(_0x15a4c9){if(_['isNil'](_0x15a4c9[_0xcc6a('0xb1')])){return _0x2a9336['download'](_0x46fe90);}else{if(!fs[_0xcc6a('0xb8')](path[_0xcc6a('0xb5')](config[_0xcc6a('0xb6')],_0xcc6a('0xb9'),_0x15a4c9['userpic']))){return _0x2a9336[_0xcc6a('0xba')](_0x46fe90);}return _0x2a9336[_0xcc6a('0xba')](path[_0xcc6a('0xb5')](config[_0xcc6a('0xb6')],_0xcc6a('0xb9'),_0x15a4c9[_0xcc6a('0xb1')]));}}})[_0xcc6a('0x1f')](handleError(_0x2a9336,null));};exports['getOpenTabs']=function(_0x55630e,_0x537b7d){return db[_0xcc6a('0x3a')][_0xcc6a('0x5b')]({'where':{'id':_0x55630e['params']['id']},'attributes':['id']})[_0xcc6a('0x15')](handleEntityNotFound(_0x537b7d,null))[_0xcc6a('0x15')](function(_0x16ee2b){var _0x4c029e=[];values=_0x16ee2b[_0xcc6a('0x4c')];_0x4c029e['push'](get_open_tabs(_0xcc6a('0x4b'),_0x16ee2b['dataValues']));_0x4c029e[_0xcc6a('0x45')](get_open_tabs(_0xcc6a('0x4d'),_0x16ee2b[_0xcc6a('0x4c')]));_0x4c029e[_0xcc6a('0x45')](get_open_tabs('openchannel',_0x16ee2b[_0xcc6a('0x4c')]));_0x4c029e[_0xcc6a('0x45')](get_open_tabs(_0xcc6a('0x50'),_0x16ee2b['dataValues']));_0x4c029e['push'](get_open_tabs('fax',_0x16ee2b[_0xcc6a('0x4c')]));_0x4c029e[_0xcc6a('0x45')](get_open_tabs(_0xcc6a('0x4e'),_0x16ee2b[_0xcc6a('0x4c')]));return BPromise[_0xcc6a('0x51')](_0x4c029e);})[_0xcc6a('0x15')](function(_0x2d9a99){var _0x162a66=[];if(_0x2d9a99){for(var _0x1ffda2=0x0;_0x1ffda2=_0x3b5fa2[_0x98f1('0x53')]){throw new Error(_0x98f1('0x54'));}})[_0x98f1('0x12')](function(){if(_0x337ff1){return db[_0x98f1('0x2e')][_0x98f1('0x4c')]({'where':{'membername':_0x337ff1[_0x98f1('0x2b')]},'individualHooks':!![]});}})[_0x98f1('0x12')](function(){if(_0x337ff1){return _0x337ff1[_0x98f1('0x55')]({'raw':!![]});}})[_0x98f1('0x12')](function(_0x3d43cd){if(_0x337ff1){if(_0x3d43cd){var _0x2b00e8=[];_0x40ecd1=_0x3d43cd;if(_0x40ecd1[_0x98f1('0x34')]){for(var _0x25bdb6=0x0;_0x25bdb6<_0x40ecd1['length'];_0x25bdb6++){_0x2b00e8[_0x98f1('0x37')](db['UserVoiceQueueRt']['upsert']({'membername':_0x337ff1[_0x98f1('0x2b')],'UserId':_0x337ff1['id'],'queue_name':_0x40ecd1[_0x25bdb6][_0x98f1('0x2b')],'VoiceQueueId':_0x40ecd1[_0x25bdb6]['id'],'interface':_0x3be654,'paused':_0x337ff1['loginInPause']||![],'penalty':_0x40ecd1[_0x25bdb6][_0x98f1('0x56')]||0x0}));}return BPromise['all'](_0x2b00e8);}}}})['then'](function(){if(_0x337ff1){return db[_0x98f1('0x30')][_0x98f1('0x1e')]({'where':{'membername':_0x337ff1['name'],'exitAt':null}});}})[_0x98f1('0x12')](function(_0x3af5e3){if(_0x337ff1){if(_0x3af5e3&&_0x3af5e3['length']){var _0x58bcd4=[];_0x3af5e3[_0x98f1('0x36')](function(_0x1348ad){_0x58bcd4['push'](_0x1348ad[_0x98f1('0x2f')]({'exitAt':moment()[_0x98f1('0x32')](_0x98f1('0x33'))}));});return BPromise[_0x98f1('0x4b')](_0x58bcd4);}}})[_0x98f1('0x12')](function(_0x47ab81){if(_0x337ff1){var _0x42bdfd=[];var _0xaaf28=[];var _0x3313dc=utils[_0x98f1('0x35')]();var _0x549df4={'membername':_0x337ff1['name'],'interface':_0x3be654,'enterAt':moment()[_0x98f1('0x32')](_0x98f1('0x33')),'role':_0x337ff1['role'],'internal':_0x337ff1[_0x98f1('0x4e')]};_0x3313dc[_0x98f1('0x36')](function(_0x32b4f2){_0x42bdfd[_0x98f1('0x37')](_[_0x98f1('0x57')]({'channel':_0x32b4f2,'type':_0x98f1('0x58'),'data1':_0x98f1('0x59'),'data2':_0x3be654},_0x549df4));if(_0x337ff1['loginInPause']){_0xaaf28[_0x98f1('0x37')](_[_0x98f1('0x57')]({'channel':_0x32b4f2,'type':_0x98f1('0x31'),'data1':_0x98f1('0x5a')},_0x549df4));}});return db[_0x98f1('0x30')]['bulkCreate'](_0x42bdfd[_0x98f1('0x5b')](_0xaaf28),{'individualHooks':!![]});}})[_0x98f1('0x12')](function(){if(_0x337ff1){return _0x337ff1[_0x98f1('0x2f')]({'online':!![],'lastLoginAt':moment()[_0x98f1('0x32')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x337ff1[_0x98f1('0x4f')]||![],'mailPause':_0x337ff1[_0x98f1('0x4f')]||![],'chatPause':_0x337ff1[_0x98f1('0x4f')]||![],'faxPause':_0x337ff1['loginInPause']||![],'smsPause':_0x337ff1[_0x98f1('0x4f')]||![],'openchannelPause':_0x337ff1[_0x98f1('0x4f')]||![],'pauseType':_0x337ff1[_0x98f1('0x4f')]?_0x98f1('0x5a'):null,'lastPauseAt':moment()['format'](_0x98f1('0x33')),'interface':_0x3be654});}})['then'](function(_0x2d3ab5){_0x31495e(_0x2d3ab5);})[_0x98f1('0x1b')](function(_0x19dce1){_0xdb079f(_0x3d4e6a[_0x98f1('0x18')](0x1f4,_0x19dce1['message']));});});}; \ No newline at end of file +var _0x8b26=['chat','sms','openchannel','whatsapp','system','set','%s%s','Pause','UserVoiceQueueRt','push','all','LogoutUser','LoginUser','mobile','phone','loginInPause','count','agent','getLicense','destroy','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','LOGIN','LOGININPAUSE','concat','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./user.socket','register','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','message','result','GetUser','User','findAll','raw','options','where','attributes','map','include','model','ShowUser','find','stringify','catch','PauseUser','name','role','internal','interface','update','MemberReport','length','format','getChannels','forEach','isNil','SIP/%s','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','body','YYYY-MM-DD\x20HH:mm:ss','UnpauseUser','findOne','isValidChannel','channel','Unknown\x20channel','voice'];(function(_0x4848cd,_0x3d9895){var _0x261a1d=function(_0xc825c0){while(--_0xc825c0){_0x4848cd['push'](_0x4848cd['shift']());}};_0x261a1d(++_0x3d9895);}(_0x8b26,0xd5));var _0x68b2=function(_0x2bf2ff,_0x27bb45){_0x2bf2ff=_0x2bf2ff-0x0;var _0x357790=_0x8b26[_0x2bf2ff];return _0x357790;};'use strict';var _=require(_0x68b2('0x0'));var util=require(_0x68b2('0x1'));var moment=require(_0x68b2('0x2'));var BPromise=require(_0x68b2('0x3'));var rs=require(_0x68b2('0x4'));var fs=require('fs');var Redis=require(_0x68b2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x68b2('0x6'));var logger=require(_0x68b2('0x7'))(_0x68b2('0x8'));var config=require(_0x68b2('0x9'));var jayson=require(_0x68b2('0xa'));var client=jayson['client'][_0x68b2('0xb')]({'port':0x232a});config['redis']=_[_0x68b2('0xc')](config[_0x68b2('0xd')],{'host':_0x68b2('0xe'),'port':0x18eb});var socket=require(_0x68b2('0xf'))(new Redis(config['redis']));require(_0x68b2('0x10'))[_0x68b2('0x11')](socket);function respondWithRpcPromise(_0x11d68e,_0x1792a4,_0x28252d){return new BPromise(function(_0x169eb4,_0x5de8e0){return client['request'](_0x11d68e,_0x28252d)[_0x68b2('0x12')](function(_0x5e48e0){logger[_0x68b2('0x13')](_0x68b2('0x14'),_0x1792a4,_0x68b2('0x15'));logger[_0x68b2('0x16')](_0x68b2('0x17'),_0x1792a4,_0x68b2('0x15'),JSON['stringify'](_0x5e48e0));if(_0x5e48e0[_0x68b2('0x18')]){if(_0x5e48e0[_0x68b2('0x18')]['code']===0x1f4){logger[_0x68b2('0x18')]('User,\x20%s,\x20%s',_0x1792a4,_0x5e48e0[_0x68b2('0x18')][_0x68b2('0x19')]);return _0x5de8e0(_0x5e48e0['error'][_0x68b2('0x19')]);}logger[_0x68b2('0x18')]('User,\x20%s,\x20%s',_0x1792a4,_0x5e48e0['error'][_0x68b2('0x19')]);return _0x169eb4(_0x5e48e0['error']['message']);}else{logger[_0x68b2('0x13')](_0x68b2('0x14'),_0x1792a4,_0x68b2('0x15'));_0x169eb4(_0x5e48e0[_0x68b2('0x1a')][_0x68b2('0x19')]);}})['catch'](function(_0x23fe4d){logger[_0x68b2('0x18')](_0x68b2('0x14'),_0x1792a4,_0x23fe4d);_0x5de8e0(_0x23fe4d);});});}exports[_0x68b2('0x1b')]=function(_0xa8ee03){var _0x11428c=this;return new Promise(function(_0x193062,_0x3aa834){return db[_0x68b2('0x1c')][_0x68b2('0x1d')]({'raw':_0xa8ee03['options']?_0xa8ee03['options'][_0x68b2('0x1e')]===undefined?!![]:![]:!![],'where':_0xa8ee03['options']?_0xa8ee03[_0x68b2('0x1f')][_0x68b2('0x20')]||null:null,'attributes':_0xa8ee03[_0x68b2('0x1f')]?_0xa8ee03[_0x68b2('0x1f')][_0x68b2('0x21')]||null:null,'limit':_0xa8ee03['options']?_0xa8ee03['options']['limit']||null:null,'include':_0xa8ee03[_0x68b2('0x1f')]?_0xa8ee03['options']['include']?_[_0x68b2('0x22')](_0xa8ee03[_0x68b2('0x1f')]['include'],function(_0x42a396){return{'model':db[_0x42a396['model']],'as':_0x42a396['as'],'attributes':_0x42a396[_0x68b2('0x21')],'include':_0x42a396['include']?_[_0x68b2('0x22')](_0x42a396[_0x68b2('0x23')],function(_0xfbc8fc){return{'model':db[_0xfbc8fc[_0x68b2('0x24')]],'as':_0xfbc8fc['as'],'attributes':_0xfbc8fc[_0x68b2('0x21')],'include':_0xfbc8fc[_0x68b2('0x23')]?_[_0x68b2('0x22')](_0xfbc8fc[_0x68b2('0x23')],function(_0x395157){return{'model':db[_0x395157[_0x68b2('0x24')]],'as':_0x395157['as'],'attributes':_0x395157['attributes']};}):[]};}):[]};}):[]:[]})[_0x68b2('0x12')](function(_0x12bf24){logger[_0x68b2('0x13')](_0x68b2('0x1b'),_0xa8ee03);logger[_0x68b2('0x16')]('GetUser',_0xa8ee03,JSON['stringify'](_0x12bf24));_0x193062(_0x12bf24);})['catch'](function(_0x5079bc){logger[_0x68b2('0x18')](_0x68b2('0x1b'),_0x5079bc[_0x68b2('0x19')],_0xa8ee03);_0x3aa834(_0x11428c[_0x68b2('0x18')](0x1f4,_0x5079bc[_0x68b2('0x19')]));});});};exports[_0x68b2('0x25')]=function(_0xb78f32){var _0x15de9c=this;return new Promise(function(_0x293de8,_0x420c7f){return db[_0x68b2('0x1c')][_0x68b2('0x26')]({'raw':_0xb78f32[_0x68b2('0x1f')]?_0xb78f32[_0x68b2('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0xb78f32[_0x68b2('0x1f')]?_0xb78f32[_0x68b2('0x1f')][_0x68b2('0x20')]||null:null,'attributes':_0xb78f32[_0x68b2('0x1f')]?_0xb78f32[_0x68b2('0x1f')]['attributes']||null:null,'include':_0xb78f32[_0x68b2('0x1f')]?_0xb78f32[_0x68b2('0x1f')][_0x68b2('0x23')]?_[_0x68b2('0x22')](_0xb78f32[_0x68b2('0x1f')]['include'],function(_0x389dc8){return{'model':db[_0x389dc8['model']],'as':_0x389dc8['as'],'attributes':_0x389dc8[_0x68b2('0x21')],'include':_0x389dc8['include']?_[_0x68b2('0x22')](_0x389dc8[_0x68b2('0x23')],function(_0x263c9b){return{'model':db[_0x263c9b['model']],'as':_0x263c9b['as'],'attributes':_0x263c9b[_0x68b2('0x21')],'include':_0x263c9b[_0x68b2('0x23')]?_[_0x68b2('0x22')](_0x263c9b[_0x68b2('0x23')],function(_0x29c4ef){return{'model':db[_0x29c4ef[_0x68b2('0x24')]],'as':_0x29c4ef['as'],'attributes':_0x29c4ef[_0x68b2('0x21')]};}):[]};}):[]};}):[]:[]})[_0x68b2('0x12')](function(_0x1c13cc){logger[_0x68b2('0x13')](_0x68b2('0x25'),_0xb78f32);logger[_0x68b2('0x16')]('ShowUser',_0xb78f32,JSON[_0x68b2('0x27')](_0x1c13cc));_0x293de8(_0x1c13cc);})[_0x68b2('0x28')](function(_0x4ea0d3){logger[_0x68b2('0x18')](_0x68b2('0x25'),_0x4ea0d3[_0x68b2('0x19')],_0xb78f32);_0x420c7f(_0x15de9c[_0x68b2('0x18')](0x1f4,_0x4ea0d3[_0x68b2('0x19')]));});});};exports[_0x68b2('0x29')]=function(_0x3dfb6e){var _0x3d66c6=this;return new Promise(function(_0x1bf4dc,_0x15618e){var _0x5b4258;return db['User'][_0x68b2('0x26')]({'where':_0x3dfb6e[_0x68b2('0x1f')][_0x68b2('0x20')]||{},'attributes':['id',_0x68b2('0x2a'),_0x68b2('0x2b'),_0x68b2('0x2c'),_0x68b2('0x2d')]})[_0x68b2('0x12')](function(_0x2596ff){if(_0x2596ff){_0x5b4258=_0x2596ff;return db['UserVoiceQueueRt'][_0x68b2('0x2e')]({'paused':0x1},{'where':{'UserId':_0x5b4258['id']},'individualHooks':!![]});}})['then'](function(){if(_0x5b4258){return db[_0x68b2('0x2f')][_0x68b2('0x1d')]({'where':{'membername':_0x5b4258['name'],'type':'PAUSE','exitAt':null}});}})[_0x68b2('0x12')](function(_0x535db6){if(_0x5b4258){if(_0x535db6&&_0x535db6[_0x68b2('0x30')]){var _0x28dd80=moment()[_0x68b2('0x31')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x41ce67=0x0,_0x3f9a47=_0x535db6[_0x68b2('0x30')];_0x41ce67<_0x3f9a47;_0x41ce67++){_0x535db6[_0x41ce67]['updateAttributes']({'exitAt':_0x28dd80});}}}})[_0x68b2('0x12')](function(){if(_0x5b4258){var _0x567802=[];var _0x549de6=utils[_0x68b2('0x32')]();_0x549de6[_0x68b2('0x33')](function(_0x428c42){_0x567802['push']({'channel':_0x428c42,'membername':_0x5b4258[_0x68b2('0x2a')],'interface':_[_0x68b2('0x34')](_0x5b4258[_0x68b2('0x2d')])?util['format'](_0x68b2('0x35'),_0x5b4258[_0x68b2('0x2a')]):_0x5b4258['interface'],'type':'PAUSE','enterAt':moment()[_0x68b2('0x31')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x3dfb6e['body'][_0x68b2('0x36')]||_0x68b2('0x37'),'role':_0x5b4258[_0x68b2('0x2b')],'internal':_0x5b4258['internal'],'uniqueid':_0x3dfb6e['body'][_0x68b2('0x38')]||null});});return db['MemberReport'][_0x68b2('0x39')](_0x567802,{'individualHooks':!![]});}})[_0x68b2('0x12')](function(){if(_0x5b4258){return _0x5b4258[_0x68b2('0x2e')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x3dfb6e[_0x68b2('0x3a')][_0x68b2('0x36')]||_0x68b2('0x37'),'lastPauseAt':moment()[_0x68b2('0x31')](_0x68b2('0x3b'))});}})[_0x68b2('0x12')](function(_0x2d6e31){_0x1bf4dc(_0x2d6e31);})[_0x68b2('0x28')](function(_0x5390f3){_0x15618e(_0x3d66c6[_0x68b2('0x18')](0x1f4,_0x5390f3['message']));});});};exports[_0x68b2('0x3c')]=function(_0x3fdc08){var _0x300f47=this;return new Promise(function(_0x19ff75,_0x2a0409){var _0x58c0f6;return db['User'][_0x68b2('0x3d')]({'where':_0x3fdc08[_0x68b2('0x1f')][_0x68b2('0x20')]||{},'attributes':['id',_0x68b2('0x2a')]})[_0x68b2('0x12')](function(_0x2a7d58){if(_0x2a7d58){_0x58c0f6=_0x2a7d58;if(_0x3fdc08[_0x68b2('0x3a')]['channel']&&!utils[_0x68b2('0x3e')](_0x3fdc08['body'][_0x68b2('0x3f')])){throw new Error(_0x68b2('0x40'));}switch(_0x3fdc08['body'][_0x68b2('0x3f')]){case _0x68b2('0x41'):return db['UserVoiceQueueRt'][_0x68b2('0x2e')]({'paused':0x0},{'where':{'UserId':_0x58c0f6['id']}})[_0x68b2('0x12')](function(){return db[_0x68b2('0x2f')]['find']({'where':{'channel':_0x3fdc08[_0x68b2('0x3a')][_0x68b2('0x3f')],'membername':_0x58c0f6['name'],'type':'PAUSE','exitAt':null}});})[_0x68b2('0x12')](function(_0x2e1389){if(_0x2e1389){return _0x2e1389[_0x68b2('0x2e')]({'exitAt':moment()['format'](_0x68b2('0x3b')),'data2':'system'},{'individualHooks':!![]});}return null;})[_0x68b2('0x12')](function(){return _0x58c0f6[_0x68b2('0x2e')]({'voicePause':![]});});case'mail':case _0x68b2('0x42'):case'fax':case _0x68b2('0x43'):case _0x68b2('0x44'):case _0x68b2('0x45'):return db[_0x68b2('0x2f')][_0x68b2('0x26')]({'where':{'channel':_0x3fdc08[_0x68b2('0x3a')][_0x68b2('0x3f')],'membername':_0x58c0f6[_0x68b2('0x2a')],'type':'PAUSE','exitAt':null}})[_0x68b2('0x12')](function(_0x5f347f){return _0x5f347f['update']({'exitAt':moment()[_0x68b2('0x31')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x68b2('0x46')},{'individualHooks':!![]});})[_0x68b2('0x12')](function(){var _0x87faaa={};_[_0x68b2('0x47')](_0x87faaa,util[_0x68b2('0x31')](_0x68b2('0x48'),_0x3fdc08[_0x68b2('0x3a')]['channel'],_0x68b2('0x49')),![]);return _0x58c0f6['update'](_0x87faaa);});default:return db[_0x68b2('0x4a')][_0x68b2('0x2e')]({'paused':0x0},{'where':{'UserId':_0x58c0f6['id']}})[_0x68b2('0x12')](function(){return db[_0x68b2('0x2f')]['findAll']({'where':{'membername':_0x58c0f6[_0x68b2('0x2a')],'type':'PAUSE','exitAt':null}});})[_0x68b2('0x12')](function(_0x172b62){var _0x3507be=[];_0x172b62[_0x68b2('0x33')](function(_0x5e7b4f){_0x3507be[_0x68b2('0x4b')](_0x5e7b4f[_0x68b2('0x2e')]({'exitAt':moment()[_0x68b2('0x31')](_0x68b2('0x3b')),'data2':_0x68b2('0x46')}));});return BPromise[_0x68b2('0x4c')](_0x3507be);})['then'](function(){return _0x58c0f6[_0x68b2('0x2e')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x68b2('0x12')](function(_0x28f593){_0x19ff75(_0x28f593);})['catch'](function(_0x34fe78){_0x2a0409(_0x300f47[_0x68b2('0x18')](0x1f4,_0x34fe78['message']));});});};exports[_0x68b2('0x4d')]=function(_0x1ce4ec){var _0x1c8984=this;return new Promise(function(_0x4cb1a0,_0x593c71){var _0x1f2a6e;return db[_0x68b2('0x1c')][_0x68b2('0x3d')]({'where':_0x1ce4ec[_0x68b2('0x1f')]['where']||{},'attributes':['id','name']})[_0x68b2('0x12')](function(_0x59c09d){if(_0x59c09d){_0x1f2a6e=_0x59c09d;return db[_0x68b2('0x4a')]['destroy']({'where':{'membername':_0x1f2a6e[_0x68b2('0x2a')]},'individualHooks':!![]});}})[_0x68b2('0x12')](function(){if(_0x1f2a6e){return db[_0x68b2('0x2f')][_0x68b2('0x1d')]({'where':{'membername':_0x1f2a6e[_0x68b2('0x2a')],'exitAt':null}});}})['then'](function(_0x4b24fb){if(_0x1f2a6e){if(_0x4b24fb&&_0x4b24fb[_0x68b2('0x30')]){var _0x3ef7f7=[];_0x4b24fb[_0x68b2('0x33')](function(_0x4837e2){_0x3ef7f7[_0x68b2('0x4b')](_0x4837e2[_0x68b2('0x2e')]({'exitAt':moment()[_0x68b2('0x31')](_0x68b2('0x3b'))}));});return BPromise[_0x68b2('0x4c')](_0x3ef7f7);}}})['then'](function(){if(_0x1f2a6e){return _0x1f2a6e[_0x68b2('0x2e')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x1b9e72){_0x4cb1a0(_0x1b9e72);})[_0x68b2('0x28')](function(_0x4166af){_0x593c71(_0x1c8984[_0x68b2('0x18')](0x1f4,_0x4166af['message']));});});};exports[_0x68b2('0x4e')]=function(_0x66efdb){var _0x329e80=this;return new Promise(function(_0x3b143c,_0x36b2ef){var _0x9288ea;var _0x9c897d;var _0x3ae0c4;var _0x239d22;return db[_0x68b2('0x1c')][_0x68b2('0x3d')]({'where':_0x66efdb[_0x68b2('0x1f')][_0x68b2('0x20')]||{},'attributes':['id',_0x68b2('0x2a'),_0x68b2('0x2b'),_0x68b2('0x4f'),_0x68b2('0x50'),_0x68b2('0x2c'),_0x68b2('0x51'),'interface']})['then'](function(_0x2aaa24){if(_0x2aaa24){_0x9288ea=_0x2aaa24;_0x239d22=_0x66efdb[_0x68b2('0x3a')][_0x68b2('0x2d')]?_0x66efdb[_0x68b2('0x3a')][_0x68b2('0x2d')]:util[_0x68b2('0x31')](_0x68b2('0x35'),_0x9288ea[_0x68b2('0x2a')]);return db[_0x68b2('0x1c')][_0x68b2('0x52')]({'where':{'role':_0x68b2('0x53'),'online':!![],'id':{'$ne':_0x9288ea['id']}}});}})[_0x68b2('0x12')](function(_0xe5bba1){if(_0xe5bba1){_0x3ae0c4=_0xe5bba1;return require('../../config/license/util')[_0x68b2('0x54')]();}})[_0x68b2('0x12')](function(_0x5f588d){if(_0x5f588d&&_0x5f588d['agents']&&_0x3ae0c4>=_0x5f588d['agents']){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x68b2('0x12')](function(){if(_0x9288ea){return db[_0x68b2('0x4a')][_0x68b2('0x55')]({'where':{'membername':_0x9288ea[_0x68b2('0x2a')]},'individualHooks':!![]});}})[_0x68b2('0x12')](function(){if(_0x9288ea){return _0x9288ea[_0x68b2('0x56')]({'raw':!![]});}})[_0x68b2('0x12')](function(_0x210322){if(_0x9288ea){if(_0x210322){var _0xba6b48=[];_0x9c897d=_0x210322;if(_0x9c897d[_0x68b2('0x30')]){for(var _0x41f064=0x0;_0x41f064<_0x9c897d[_0x68b2('0x30')];_0x41f064++){_0xba6b48[_0x68b2('0x4b')](db['UserVoiceQueueRt'][_0x68b2('0x57')]({'membername':_0x9288ea[_0x68b2('0x2a')],'UserId':_0x9288ea['id'],'queue_name':_0x9c897d[_0x41f064][_0x68b2('0x2a')],'VoiceQueueId':_0x9c897d[_0x41f064]['id'],'interface':_0x239d22,'paused':_0x9288ea['loginInPause']||![],'penalty':_0x9c897d[_0x41f064][_0x68b2('0x58')]||0x0}));}return BPromise[_0x68b2('0x4c')](_0xba6b48);}}}})[_0x68b2('0x12')](function(){if(_0x9288ea){return db[_0x68b2('0x2f')]['findAll']({'where':{'membername':_0x9288ea[_0x68b2('0x2a')],'exitAt':null}});}})[_0x68b2('0x12')](function(_0x423a1a){if(_0x9288ea){if(_0x423a1a&&_0x423a1a[_0x68b2('0x30')]){var _0x5c71d4=[];_0x423a1a[_0x68b2('0x33')](function(_0x13e34b){_0x5c71d4[_0x68b2('0x4b')](_0x13e34b[_0x68b2('0x2e')]({'exitAt':moment()[_0x68b2('0x31')](_0x68b2('0x3b'))}));});return BPromise['all'](_0x5c71d4);}}})[_0x68b2('0x12')](function(_0x37d2fa){if(_0x9288ea){var _0x14b4d4=[];var _0x52a1be=[];var _0x43154a=utils[_0x68b2('0x32')]();var _0x23157c={'membername':_0x9288ea[_0x68b2('0x2a')],'interface':_0x239d22,'enterAt':moment()['format'](_0x68b2('0x3b')),'role':_0x9288ea['role'],'internal':_0x9288ea[_0x68b2('0x2c')]};_0x43154a[_0x68b2('0x33')](function(_0x117975){_0x14b4d4[_0x68b2('0x4b')](_[_0x68b2('0x59')]({'channel':_0x117975,'type':_0x68b2('0x5a'),'data1':'callysquare','data2':_0x239d22},_0x23157c));if(_0x9288ea[_0x68b2('0x51')]){_0x52a1be['push'](_[_0x68b2('0x59')]({'channel':_0x117975,'type':'PAUSE','data1':_0x68b2('0x5b')},_0x23157c));}});return db[_0x68b2('0x2f')][_0x68b2('0x39')](_0x14b4d4[_0x68b2('0x5c')](_0x52a1be),{'individualHooks':!![]});}})['then'](function(){if(_0x9288ea){return _0x9288ea['update']({'online':!![],'lastLoginAt':moment()['format'](_0x68b2('0x3b')),'voicePause':_0x9288ea['loginInPause']||![],'mailPause':_0x9288ea['loginInPause']||![],'chatPause':_0x9288ea['loginInPause']||![],'faxPause':_0x9288ea['loginInPause']||![],'smsPause':_0x9288ea[_0x68b2('0x51')]||![],'openchannelPause':_0x9288ea[_0x68b2('0x51')]||![],'pauseType':_0x9288ea[_0x68b2('0x51')]?_0x68b2('0x5b'):null,'lastPauseAt':moment()[_0x68b2('0x31')](_0x68b2('0x3b')),'interface':_0x239d22});}})['then'](function(_0x37b342){_0x3b143c(_0x37b342);})[_0x68b2('0x28')](function(_0x415490){_0x36b2ef(_0x329e80['error'](0x1f4,_0x415490[_0x68b2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index c0e31c1..00d21e1 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 _0x16a1=['removeListener','register','user:','save','update','emit'];(function(_0xe65b88,_0x4898f2){var _0x468393=function(_0xcb023c){while(--_0xcb023c){_0xe65b88['push'](_0xe65b88['shift']());}};_0x468393(++_0x4898f2);}(_0x16a1,0xab));var _0x116a=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x16a1[_0x618414];return _0x21c19a;};'use strict';var UserEvents=require('./user.events');var events=[_0x116a('0x0'),'remove',_0x116a('0x1')];function createListener(_0x4339e7,_0x32afaa){return function(_0x54cc11){_0x32afaa[_0x116a('0x2')](_0x4339e7,_0x54cc11);};}function removeListener(_0x21dffd,_0x36e7a7){return function(){UserEvents[_0x116a('0x3')](_0x21dffd,_0x36e7a7);};}exports[_0x116a('0x4')]=function(_0x2eba9a){for(var _0x39c828=0x0,_0x415c17=events['length'];_0x39c828<_0x415c17;_0x39c828++){var _0x1655e3=events[_0x39c828];var _0x1bcad8=createListener(_0x116a('0x5')+_0x1655e3,_0x2eba9a);UserEvents['on'](_0x1655e3,_0x1bcad8);}}; \ No newline at end of file +var _0xf9b5=['user:','./user.events','save','emit','removeListener'];(function(_0x30c649,_0x2ebbac){var _0x3edfb9=function(_0xab82f5){while(--_0xab82f5){_0x30c649['push'](_0x30c649['shift']());}};_0x3edfb9(++_0x2ebbac);}(_0xf9b5,0x1d7));var _0x5f9b=function(_0x8cea57,_0x290172){_0x8cea57=_0x8cea57-0x0;var _0x25ce1d=_0xf9b5[_0x8cea57];return _0x25ce1d;};'use strict';var UserEvents=require(_0x5f9b('0x0'));var events=[_0x5f9b('0x1'),'remove','update'];function createListener(_0x3b7b3e,_0x533b8e){return function(_0x23c869){_0x533b8e[_0x5f9b('0x2')](_0x3b7b3e,_0x23c869);};}function removeListener(_0x14a320,_0x44bae9){return function(){UserEvents[_0x5f9b('0x3')](_0x14a320,_0x44bae9);};}exports['register']=function(_0x235430){for(var _0x3528d0=0x0,_0x48df33=events['length'];_0x3528d0<_0x48df33;_0x3528d0++){var _0x569a80=events[_0x3528d0];var _0x55fb5f=createListener(_0x5f9b('0x4')+_0x569a80,_0x235430);UserEvents['on'](_0x569a80,_0x55fb5f);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 9828a6c..611d593 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x55a787,_0x1466a3){var _0x5d90a0=function(_0x5405fb){while(--_0x5405fb){_0x55a787['push'](_0x55a787['shift']());}};_0x5d90a0(++_0x1466a3);}(_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 +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x152449,_0x49f41d){var _0x5b58b2=function(_0x226c30){while(--_0x226c30){_0x152449['push'](_0x152449['shift']());}};_0x5b58b2(++_0x49f41d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 4c6a7b7..fc874c0 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 _0xc9b0=['exports','INTEGER','sequelize'];(function(_0x36bfe3,_0x358938){var _0x9b0436=function(_0x86e47d){while(--_0x86e47d){_0x36bfe3['push'](_0x36bfe3['shift']());}};_0x9b0436(++_0x358938);}(_0xc9b0,0x143));var _0x0c9b=function(_0x1029b2,_0x2edb16){_0x1029b2=_0x1029b2-0x0;var _0x5bb8f0=_0xc9b0[_0x1029b2];return _0x5bb8f0;};'use strict';var Sequelize=require(_0x0c9b('0x0'));module[_0x0c9b('0x1')]={'penalty':{'type':Sequelize[_0x0c9b('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0504=['INTEGER','exports'];(function(_0x1fb720,_0x4f4e7b){var _0x118a44=function(_0x323e69){while(--_0x323e69){_0x1fb720['push'](_0x1fb720['shift']());}};_0x118a44(++_0x4f4e7b);}(_0x0504,0x147));var _0x4050=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x0504[_0x1d9aa0];return _0x226868;};'use strict';var Sequelize=require('sequelize');module[_0x4050('0x0')]={'penalty':{'type':Sequelize[_0x4050('0x1')],'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 a354566..dbba205 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 _0xbc0c=['UserChatQueue','user_has_chat_queues','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xbc0c,0x86));var _0xcbc0=function(_0xfb3391,_0x2c72ef){_0xfb3391=_0xfb3391-0x0;var _0x45deb9=_0xbc0c[_0xfb3391];return _0x45deb9;};'use strict';var _=require(_0xcbc0('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xcbc0('0x1'));var BPromise=require(_0xcbc0('0x2'));var rp=require(_0xcbc0('0x3'));var fs=require('fs');var path=require(_0xcbc0('0x4'));var rimraf=require(_0xcbc0('0x5'));var config=require(_0xcbc0('0x6'));var attributes=require(_0xcbc0('0x7'));module[_0xcbc0('0x8')]=function(_0x1b0747,_0x5569df){return _0x1b0747[_0xcbc0('0x9')](_0xcbc0('0xa'),attributes,{'tableName':_0xcbc0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa807=['lodash','util','../../config/logger','bluebird','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues'];(function(_0x4030e7,_0x1d9dfd){var _0xa9f636=function(_0x11caca){while(--_0x11caca){_0x4030e7['push'](_0x4030e7['shift']());}};_0xa9f636(++_0x1d9dfd);}(_0xa807,0x108));var _0x7a80=function(_0x275132,_0x4029c2){_0x275132=_0x275132-0x0;var _0x4bacff=_0xa807[_0x275132];return _0x4bacff;};'use strict';var _=require(_0x7a80('0x0'));var util=require(_0x7a80('0x1'));var logger=require(_0x7a80('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7a80('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7a80('0x4'));var config=require(_0x7a80('0x5'));var attributes=require(_0x7a80('0x6'));module[_0x7a80('0x7')]=function(_0x5de6cf,_0x56cc0e){return _0x5de6cf[_0x7a80('0x8')](_0x7a80('0x9'),attributes,{'tableName':_0x7a80('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 44e5661..5ecdb8a 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 _0x626a=['debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','UserChatQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x27cb8d,_0x3d1c1a){var _0x3f44d7=function(_0x1b9a58){while(--_0x1b9a58){_0x27cb8d['push'](_0x27cb8d['shift']());}};_0x3f44d7(++_0x3d1c1a);}(_0x626a,0x80));var _0xa626=function(_0x2b8ba3,_0x7b0bee){_0x2b8ba3=_0x2b8ba3-0x0;var _0x5e9758=_0x626a[_0x2b8ba3];return _0x5e9758;};'use strict';var _=require(_0xa626('0x0'));var util=require(_0xa626('0x1'));var moment=require('moment');var BPromise=require(_0xa626('0x2'));var rs=require(_0xa626('0x3'));var fs=require('fs');var Redis=require(_0xa626('0x4'));var db=require(_0xa626('0x5'))['db'];var utils=require(_0xa626('0x6'));var logger=require(_0xa626('0x7'))(_0xa626('0x8'));var config=require(_0xa626('0x9'));var jayson=require(_0xa626('0xa'));var client=jayson[_0xa626('0xb')][_0xa626('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x79cc40,_0x85c2ac,_0x81991d){return new BPromise(function(_0x499970,_0x1f9e40){return client['request'](_0x79cc40,_0x81991d)['then'](function(_0x63d16){logger[_0xa626('0xd')](_0xa626('0xe'),_0x85c2ac,_0xa626('0xf'));logger[_0xa626('0x10')](_0xa626('0x11'),_0x85c2ac,_0xa626('0xf'),JSON[_0xa626('0x12')](_0x63d16));if(_0x63d16[_0xa626('0x13')]){if(_0x63d16['error'][_0xa626('0x14')]===0x1f4){logger[_0xa626('0x13')](_0xa626('0xe'),_0x85c2ac,_0x63d16[_0xa626('0x13')][_0xa626('0x15')]);return _0x1f9e40(_0x63d16['error'][_0xa626('0x15')]);}logger[_0xa626('0x13')]('UserChatQueue,\x20%s,\x20%s',_0x85c2ac,_0x63d16['error'][_0xa626('0x15')]);return _0x499970(_0x63d16[_0xa626('0x13')][_0xa626('0x15')]);}else{logger[_0xa626('0xd')](_0xa626('0xe'),_0x85c2ac,_0xa626('0xf'));_0x499970(_0x63d16[_0xa626('0x16')][_0xa626('0x15')]);}})[_0xa626('0x17')](function(_0x4e33b4){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x85c2ac,_0x4e33b4);_0x1f9e40(_0x4e33b4);});});} \ No newline at end of file +var _0xb6fa=['moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','info','UserChatQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x684267,_0x8af01b){var _0x1b4d1f=function(_0x256db1){while(--_0x256db1){_0x684267['push'](_0x684267['shift']());}};_0x1b4d1f(++_0x8af01b);}(_0xb6fa,0x76));var _0xab6f=function(_0x46ae5a,_0x2a38d0){_0x46ae5a=_0x46ae5a-0x0;var _0x434986=_0xb6fa[_0x46ae5a];return _0x434986;};'use strict';var _=require(_0xab6f('0x0'));var util=require(_0xab6f('0x1'));var moment=require(_0xab6f('0x2'));var BPromise=require(_0xab6f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab6f('0x4'))['db'];var utils=require(_0xab6f('0x5'));var logger=require('../../config/logger')(_0xab6f('0x6'));var config=require(_0xab6f('0x7'));var jayson=require(_0xab6f('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2d3b20,_0xe74dd6,_0x3c18ff){return new BPromise(function(_0x2716f4,_0x361493){return client['request'](_0x2d3b20,_0x3c18ff)[_0xab6f('0x9')](function(_0x582f47){logger[_0xab6f('0xa')](_0xab6f('0xb'),_0xe74dd6,'request\x20sent');logger[_0xab6f('0xc')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0xe74dd6,_0xab6f('0xd'),JSON[_0xab6f('0xe')](_0x582f47));if(_0x582f47[_0xab6f('0xf')]){if(_0x582f47[_0xab6f('0xf')][_0xab6f('0x10')]===0x1f4){logger[_0xab6f('0xf')]('UserChatQueue,\x20%s,\x20%s',_0xe74dd6,_0x582f47[_0xab6f('0xf')][_0xab6f('0x11')]);return _0x361493(_0x582f47[_0xab6f('0xf')][_0xab6f('0x11')]);}logger[_0xab6f('0xf')](_0xab6f('0xb'),_0xe74dd6,_0x582f47[_0xab6f('0xf')][_0xab6f('0x11')]);return _0x2716f4(_0x582f47[_0xab6f('0xf')][_0xab6f('0x11')]);}else{logger[_0xab6f('0xa')](_0xab6f('0xb'),_0xe74dd6,'request\x20sent');_0x2716f4(_0x582f47[_0xab6f('0x12')][_0xab6f('0x11')]);}})[_0xab6f('0x13')](function(_0x1ee418){logger[_0xab6f('0xf')](_0xab6f('0xb'),_0xe74dd6,_0x1ee418);_0x361493(_0x1ee418);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 67e2af9..af9236d 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x356307,_0xe0a012){var _0x59e722=function(_0x31348d){while(--_0x31348d){_0x356307['push'](_0x356307['shift']());}};_0x59e722(++_0xe0a012);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x346f16,_0x170bd2){var _0x229034=function(_0x10ba61){while(--_0x10ba61){_0x346f16['push'](_0x346f16['shift']());}};_0x229034(++_0x170bd2);}(_0x70e0,0x17b));var _0x070e=function(_0x5acfeb,_0x4d9434){_0x5acfeb=_0x5acfeb-0x0;var _0x37a55e=_0x70e0[_0x5acfeb];return _0x37a55e;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 0de8d6f..db872af 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 _0xdc0f=['INTEGER','exports'];(function(_0x1998ad,_0x9e6af6){var _0x612cf4=function(_0x275f46){while(--_0x275f46){_0x1998ad['push'](_0x1998ad['shift']());}};_0x612cf4(++_0x9e6af6);}(_0xdc0f,0x1af));var _0xfdc0=function(_0x5bd948,_0x478409){_0x5bd948=_0x5bd948-0x0;var _0x52771a=_0xdc0f[_0x5bd948];return _0x52771a;};'use strict';var Sequelize=require('sequelize');module[_0xfdc0('0x0')]={'penalty':{'type':Sequelize[_0xfdc0('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf955=['INTEGER','STRING','sequelize','exports'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xf955,0x13e));var _0x5f95=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xf955[_0x4baae2];return _0x1a2285;};'use strict';var Sequelize=require(_0x5f95('0x0'));module[_0x5f95('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5f95('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x5f95('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index a61191a..b17afe2 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 _0xdd47=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','UserFaxQueue','user_has_fax_queues'];(function(_0x1dbaf7,_0x3d05b3){var _0x593f05=function(_0x381936){while(--_0x381936){_0x1dbaf7['push'](_0x1dbaf7['shift']());}};_0x593f05(++_0x3d05b3);}(_0xdd47,0x6e));var _0x7dd4=function(_0x2bc3f4,_0x470b26){_0x2bc3f4=_0x2bc3f4-0x0;var _0x14ac53=_0xdd47[_0x2bc3f4];return _0x14ac53;};'use strict';var _=require('lodash');var util=require(_0x7dd4('0x0'));var logger=require(_0x7dd4('0x1'))(_0x7dd4('0x2'));var moment=require(_0x7dd4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7dd4('0x4'));var rimraf=require(_0x7dd4('0x5'));var config=require(_0x7dd4('0x6'));var attributes=require(_0x7dd4('0x7'));module[_0x7dd4('0x8')]=function(_0x31df96,_0x38b718){return _0x31df96['define'](_0x7dd4('0x9'),attributes,{'tableName':_0x7dd4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4ee=['../../config/logger','moment','bluebird','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash'];(function(_0x344ae2,_0x2b7587){var _0x26f5ac=function(_0x52ebda){while(--_0x52ebda){_0x344ae2['push'](_0x344ae2['shift']());}};_0x26f5ac(++_0x2b7587);}(_0xc4ee,0x1c1));var _0xec4e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4ee[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xec4e('0x0'));var util=require('util');var logger=require(_0xec4e('0x1'))('api');var moment=require(_0xec4e('0x2'));var BPromise=require(_0xec4e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xec4e('0x4'));var attributes=require(_0xec4e('0x5'));module[_0xec4e('0x6')]=function(_0x3edfd2,_0x560224){return _0x3edfd2[_0xec4e('0x7')](_0xec4e('0x8'),attributes,{'tableName':_0xec4e('0x9'),'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 04b729f..2530569 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 _0x453a=['lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x5d8c07,_0x59f510){var _0x49077b=function(_0x50fb55){while(--_0x50fb55){_0x5d8c07['push'](_0x5d8c07['shift']());}};_0x49077b(++_0x59f510);}(_0x453a,0xf2));var _0xa453=function(_0x51f4fc,_0x1fe3ef){_0x51f4fc=_0x51f4fc-0x0;var _0x4d96fc=_0x453a[_0x51f4fc];return _0x4d96fc;};'use strict';var _=require(_0xa453('0x0'));var util=require(_0xa453('0x1'));var moment=require(_0xa453('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa453('0x3'));var db=require(_0xa453('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa453('0x5'))(_0xa453('0x6'));var config=require(_0xa453('0x7'));var jayson=require(_0xa453('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19c190,_0xa3cbbd,_0x5db01f){return new BPromise(function(_0x1af857,_0x4c2477){return client[_0xa453('0x9')](_0x19c190,_0x5db01f)[_0xa453('0xa')](function(_0x383e18){logger[_0xa453('0xb')](_0xa453('0xc'),_0xa3cbbd,'request\x20sent');logger[_0xa453('0xd')](_0xa453('0xe'),_0xa3cbbd,_0xa453('0xf'),JSON[_0xa453('0x10')](_0x383e18));if(_0x383e18[_0xa453('0x11')]){if(_0x383e18['error'][_0xa453('0x12')]===0x1f4){logger[_0xa453('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0xa3cbbd,_0x383e18[_0xa453('0x11')][_0xa453('0x13')]);return _0x4c2477(_0x383e18[_0xa453('0x11')][_0xa453('0x13')]);}logger[_0xa453('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0xa3cbbd,_0x383e18['error'][_0xa453('0x13')]);return _0x1af857(_0x383e18[_0xa453('0x11')]['message']);}else{logger[_0xa453('0xb')](_0xa453('0xc'),_0xa3cbbd,_0xa453('0xf'));_0x1af857(_0x383e18[_0xa453('0x14')][_0xa453('0x13')]);}})[_0xa453('0x15')](function(_0x414170){logger[_0xa453('0x11')](_0xa453('0xc'),_0xa3cbbd,_0x414170);_0x4c2477(_0x414170);});});} \ No newline at end of file +var _0xdfd1=['request','then','info','request\x20sent','debug','error','code','UserFaxQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http'];(function(_0x3cf03c,_0x24a6be){var _0x5d880d=function(_0x484cb7){while(--_0x484cb7){_0x3cf03c['push'](_0x3cf03c['shift']());}};_0x5d880d(++_0x24a6be);}(_0xdfd1,0x73));var _0x1dfd=function(_0xb3560d,_0x1c2779){_0xb3560d=_0xb3560d-0x0;var _0x1b272b=_0xdfd1[_0xb3560d];return _0x1b272b;};'use strict';var _=require(_0x1dfd('0x0'));var util=require(_0x1dfd('0x1'));var moment=require(_0x1dfd('0x2'));var BPromise=require(_0x1dfd('0x3'));var rs=require(_0x1dfd('0x4'));var fs=require('fs');var Redis=require(_0x1dfd('0x5'));var db=require(_0x1dfd('0x6'))['db'];var utils=require(_0x1dfd('0x7'));var logger=require('../../config/logger')(_0x1dfd('0x8'));var config=require(_0x1dfd('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1dfd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37b594,_0x1b1763,_0x24df35){return new BPromise(function(_0x297b02,_0x1df711){return client[_0x1dfd('0xb')](_0x37b594,_0x24df35)[_0x1dfd('0xc')](function(_0x4d54e0){logger[_0x1dfd('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x1b1763,_0x1dfd('0xe'));logger[_0x1dfd('0xf')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x1b1763,'request\x20sent',JSON['stringify'](_0x4d54e0));if(_0x4d54e0[_0x1dfd('0x10')]){if(_0x4d54e0[_0x1dfd('0x10')][_0x1dfd('0x11')]===0x1f4){logger[_0x1dfd('0x10')](_0x1dfd('0x12'),_0x1b1763,_0x4d54e0[_0x1dfd('0x10')][_0x1dfd('0x13')]);return _0x1df711(_0x4d54e0[_0x1dfd('0x10')][_0x1dfd('0x13')]);}logger[_0x1dfd('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x1b1763,_0x4d54e0[_0x1dfd('0x10')][_0x1dfd('0x13')]);return _0x297b02(_0x4d54e0[_0x1dfd('0x10')][_0x1dfd('0x13')]);}else{logger[_0x1dfd('0xd')](_0x1dfd('0x12'),_0x1b1763,_0x1dfd('0xe'));_0x297b02(_0x4d54e0['result'][_0x1dfd('0x13')]);}})[_0x1dfd('0x14')](function(_0x2790e9){logger['error'](_0x1dfd('0x12'),_0x1b1763,_0x2790e9);_0x1df711(_0x2790e9);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 296a4b4..bfd4161 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x506f1d,_0x3d51b7){var _0x4bd262=function(_0x3ec208){while(--_0x3ec208){_0x506f1d['push'](_0x506f1d['shift']());}};_0x4bd262(++_0x3d51b7);}(_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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x41be39,_0x31a68f){var _0x120199=function(_0xa0ecf6){while(--_0xa0ecf6){_0x41be39['push'](_0x41be39['shift']());}};_0x120199(++_0x31a68f);}(_0x70e0,0x17b));var _0x070e=function(_0x4d8943,_0x336f32){_0x4d8943=_0x4d8943-0x0;var _0x5dcf45=_0x70e0[_0x4d8943];return _0x5dcf45;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 690bcce..561b0f5 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 _0x0417=['INTEGER','sequelize','exports'];(function(_0x365be9,_0x3c88b9){var _0x185c12=function(_0xbadbbf){while(--_0xbadbbf){_0x365be9['push'](_0x365be9['shift']());}};_0x185c12(++_0x3c88b9);}(_0x0417,0xfa));var _0x7041=function(_0x837634,_0x34ac06){_0x837634=_0x837634-0x0;var _0x593fb3=_0x0417[_0x837634];return _0x593fb3;};'use strict';var Sequelize=require(_0x7041('0x0'));module[_0x7041('0x1')]={'penalty':{'type':Sequelize[_0x7041('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdd44=['INTEGER','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdd44,0x106));var _0x4dd4=function(_0x231b2e,_0x2a33f9){_0x231b2e=_0x231b2e-0x0;var _0x3feb2a=_0xdd44[_0x231b2e];return _0x3feb2a;};'use strict';var Sequelize=require(_0x4dd4('0x0'));module[_0x4dd4('0x1')]={'penalty':{'type':Sequelize[_0x4dd4('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 97a2be7..073c6d2 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 _0x35f9=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','UserMailQueue','user_has_mail_queues','lodash'];(function(_0x271898,_0x171940){var _0x33eda7=function(_0x230fc3){while(--_0x230fc3){_0x271898['push'](_0x271898['shift']());}};_0x33eda7(++_0x171940);}(_0x35f9,0xaf));var _0x935f=function(_0x138234,_0x5be550){_0x138234=_0x138234-0x0;var _0xce30e9=_0x35f9[_0x138234];return _0xce30e9;};'use strict';var _=require(_0x935f('0x0'));var util=require(_0x935f('0x1'));var logger=require(_0x935f('0x2'))(_0x935f('0x3'));var moment=require(_0x935f('0x4'));var BPromise=require(_0x935f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x935f('0x6'));var config=require(_0x935f('0x7'));var attributes=require('./userMailQueue.attributes');module[_0x935f('0x8')]=function(_0x4bf84e,_0x47e37a){return _0x4bf84e['define'](_0x935f('0x9'),attributes,{'tableName':_0x935f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfbb1=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash'];(function(_0x3ca219,_0x512dc4){var _0x36ebfc=function(_0x55c226){while(--_0x55c226){_0x3ca219['push'](_0x3ca219['shift']());}};_0x36ebfc(++_0x512dc4);}(_0xfbb1,0x144));var _0x1fbb=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0xfbb1[_0x2f1762];return _0x8ab21;};'use strict';var _=require(_0x1fbb('0x0'));var util=require(_0x1fbb('0x1'));var logger=require('../../config/logger')(_0x1fbb('0x2'));var moment=require(_0x1fbb('0x3'));var BPromise=require(_0x1fbb('0x4'));var rp=require(_0x1fbb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1fbb('0x6'));var config=require(_0x1fbb('0x7'));var attributes=require(_0x1fbb('0x8'));module[_0x1fbb('0x9')]=function(_0x63490,_0xb31b34){return _0x63490[_0x1fbb('0xa')](_0x1fbb('0xb'),attributes,{'tableName':_0x1fbb('0xc'),'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 7b4dbac..ebba5c4 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(_0x3cfe4d,_0x50d2bb){var _0x3e4308=function(_0x4ed564){while(--_0x4ed564){_0x3cfe4d['push'](_0x3cfe4d['shift']());}};_0x3e4308(++_0x50d2bb);}(_0x34e8,0x12c));var _0x834e=function(_0x57cd7,_0x16ac5e){_0x57cd7=_0x57cd7-0x0;var _0x27de40=_0x34e8[_0x57cd7];return _0x27de40;};'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 _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(_0xc61d3,_0x322ff8){var _0x196acc=function(_0x454bc7){while(--_0x454bc7){_0xc61d3['push'](_0xc61d3['shift']());}};_0x196acc(++_0x322ff8);}(_0x34e8,0x12c));var _0x834e=function(_0xd24765,_0x418923){_0xd24765=_0xd24765-0x0;var _0x38d2d2=_0x34e8[_0xd24765];return _0x38d2d2;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index dc3cd2c..8e898a0 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 _0xc2a8=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports'];(function(_0x38dd19,_0x3990e5){var _0x5f2408=function(_0x5cca83){while(--_0x5cca83){_0x38dd19['push'](_0x38dd19['shift']());}};_0x5f2408(++_0x3990e5);}(_0xc2a8,0xee));var _0x8c2a=function(_0x2c386e,_0x3b07d2){_0x2c386e=_0x2c386e-0x0;var _0x2190b7=_0xc2a8[_0x2c386e];return _0x2190b7;};'use strict';var multer=require(_0x8c2a('0x0'));var util=require(_0x8c2a('0x1'));var path=require(_0x8c2a('0x2'));var timeout=require(_0x8c2a('0x3'));var express=require(_0x8c2a('0x4'));var router=express[_0x8c2a('0x5')]();var fs_extra=require(_0x8c2a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8c2a('0x7'));var config=require(_0x8c2a('0x8'));var controller=require(_0x8c2a('0x9'));router[_0x8c2a('0xa')]('/',auth[_0x8c2a('0xb')](),controller[_0x8c2a('0xc')]);module[_0x8c2a('0xd')]=router; \ No newline at end of file +var _0x21b3=['fs-extra','../../components/auth/service','../../components/interaction/service','./userNotification.controller','post','exports','multer','util','path','express','Router'];(function(_0x527ab2,_0x35e6a3){var _0x59a39e=function(_0x40cd2e){while(--_0x40cd2e){_0x527ab2['push'](_0x527ab2['shift']());}};_0x59a39e(++_0x35e6a3);}(_0x21b3,0x1df));var _0x321b=function(_0x1a1429,_0x5995c0){_0x1a1429=_0x1a1429-0x0;var _0x261a65=_0x21b3[_0x1a1429];return _0x261a65;};'use strict';var multer=require(_0x321b('0x0'));var util=require(_0x321b('0x1'));var path=require(_0x321b('0x2'));var timeout=require('connect-timeout');var express=require(_0x321b('0x3'));var router=express[_0x321b('0x4')]();var fs_extra=require(_0x321b('0x5'));var auth=require(_0x321b('0x6'));var interaction=require(_0x321b('0x7'));var config=require('../../config/environment');var controller=require(_0x321b('0x8'));router[_0x321b('0x9')]('/',auth['isAuthenticated'](),controller['sendUserNotification']);module[_0x321b('0xa')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index c134f96..742644f 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 _0xdb22=['BOOLEAN','sequelize','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb22,0x85));var _0x2db2=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xdb22[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x2db2('0x0'));module['exports']={'body':{'type':Sequelize[_0x2db2('0x1')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x2db2('0x2')]}}; \ No newline at end of file +var _0xaf0b=['BOOLEAN','sequelize','exports','TEXT'];(function(_0x46007d,_0x17c963){var _0x4be288=function(_0x3eeafb){while(--_0x3eeafb){_0x46007d['push'](_0x46007d['shift']());}};_0x4be288(++_0x17c963);}(_0xaf0b,0xa1));var _0xbaf0=function(_0x1a2bc2,_0x2616a8){_0x1a2bc2=_0x1a2bc2-0x0;var _0x502ab1=_0xaf0b[_0x1a2bc2];return _0x502ab1;};'use strict';var Sequelize=require(_0xbaf0('0x0'));module[_0xbaf0('0x1')]={'body':{'type':Sequelize[_0xbaf0('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0xbaf0('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 94fc794..3d18e44 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 _0x9d46=['userNotification:send','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','view','catch','startCase','model','User','union','queue','replace','Queue','ids','all','flatten','getAgents','map','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Missing\x20\x27view\x27\x20parameter','recipients','ValidationError','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','whatsappqueue','team','some','includes','toLowerCase','senderName','user','fullname','isEmpty','recipientsDescription','beep','SenderId','join','UserNotification','forEach','emit'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9d46,0xdb));var _0x69d4=function(_0x228d00,_0x10266c){_0x228d00=_0x228d00-0x0;var _0x5569e1=_0x9d46[_0x228d00];return _0x5569e1;};'use strict';var emlformat=require(_0x69d4('0x0'));var rimraf=require(_0x69d4('0x1'));var zipdir=require(_0x69d4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x69d4('0x3'));var Mustache=require(_0x69d4('0x4'));var util=require(_0x69d4('0x5'));var path=require(_0x69d4('0x6'));var sox=require('sox');var csv=require(_0x69d4('0x7'));var ejs=require(_0x69d4('0x8'));var fs=require('fs');var fs_extra=require(_0x69d4('0x9'));var _=require(_0x69d4('0xa'));var squel=require(_0x69d4('0xb'));var crypto=require(_0x69d4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x69d4('0xd'));var toCsv=require(_0x69d4('0x7'));var querystring=require(_0x69d4('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x69d4('0xf'));var qs=require(_0x69d4('0x10'));var as=require(_0x69d4('0x11'));var hardwareService=require(_0x69d4('0x12'));var logger=require('../../config/logger')(_0x69d4('0x13'));var utils=require(_0x69d4('0x14'));var config=require(_0x69d4('0x15'));var licenseUtil=require(_0x69d4('0x16'));var db=require(_0x69d4('0x17'))['db'];config['redis']=_['defaults'](config[_0x69d4('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x69d4('0x19'))(new Redis(config[_0x69d4('0x18')]));require('./userNotification.socket')[_0x69d4('0x1a')](socket);function respondWithStatusCode(_0x54e522,_0x1bb030){_0x1bb030=_0x1bb030||0xcc;return function(_0x38c550){if(_0x38c550){return _0x54e522['sendStatus'](_0x1bb030);}return _0x54e522['status'](_0x1bb030)[_0x69d4('0x1b')]();};}function respondWithResult(_0xa81e6,_0x7fc67b){_0x7fc67b=_0x7fc67b||0xc8;return function(_0x5e4ba3){if(_0x5e4ba3){return _0xa81e6[_0x69d4('0x1c')](_0x7fc67b)[_0x69d4('0x1d')](_0x5e4ba3);}};}function respondWithFilteredResult(_0x3d66b3,_0x55a94b){return function(_0x388744){if(_0x388744){var _0x4c130f=typeof _0x55a94b[_0x69d4('0x1e')]===_0x69d4('0x1f')&&typeof _0x55a94b[_0x69d4('0x20')]===_0x69d4('0x1f');var _0x51657e=_0x388744[_0x69d4('0x21')];var _0x506562=_0x4c130f?0x0:_0x55a94b[_0x69d4('0x1e')];var _0x234903=_0x4c130f?_0x388744[_0x69d4('0x21')]:_0x55a94b[_0x69d4('0x1e')]+_0x55a94b[_0x69d4('0x20')];var _0x58db79;if(_0x234903>=_0x51657e){_0x234903=_0x51657e;_0x58db79=0xc8;}else{_0x58db79=0xce;}_0x3d66b3[_0x69d4('0x1c')](_0x58db79);return _0x3d66b3[_0x69d4('0x22')](_0x69d4('0x23'),_0x506562+'-'+_0x234903+'/'+_0x51657e)[_0x69d4('0x1d')](_0x388744);}return null;};}function patchUpdates(_0x571b23){return function(_0x8bcc43){try{jsonpatch[_0x69d4('0x24')](_0x8bcc43,_0x571b23,!![]);}catch(_0x17c2a0){return BPromise[_0x69d4('0x25')](_0x17c2a0);}return _0x8bcc43[_0x69d4('0x26')]();};}function saveUpdates(_0x3b146c,_0x159422){return function(_0x4b4170){if(_0x4b4170){return _0x4b4170[_0x69d4('0x27')](_0x3b146c)[_0x69d4('0x28')](function(_0x372b6b){return _0x372b6b;});}return null;};}function removeEntity(_0xc681fa,_0x3d9538){return function(_0x1f88ac){if(_0x1f88ac){return _0x1f88ac[_0x69d4('0x29')]()[_0x69d4('0x28')](function(){_0xc681fa['status'](0xcc)[_0x69d4('0x1b')]();});}};}function handleEntityNotFound(_0x4afd44,_0x469698){return function(_0x25182b){if(!_0x25182b){_0x4afd44[_0x69d4('0x2a')](0x194);}return _0x25182b;};}function handleError(_0x4a2fea,_0xaaf5de){_0xaaf5de=_0xaaf5de||0x1f4;return function(_0x51e54c){logger[_0x69d4('0x2b')](_0x51e54c[_0x69d4('0x2c')]);if(_0x51e54c[_0x69d4('0x2d')]){delete _0x51e54c[_0x69d4('0x2d')];}_0x4a2fea['status'](_0xaaf5de)[_0x69d4('0x2e')](_0x51e54c);};}exports[_0x69d4('0x2f')]=function(_0x2a6e1f,_0x469a6e,_0x24080d){if(!_0x2a6e1f[_0x69d4('0x30')][_0x69d4('0x31')](_0x69d4('0x32'))&&!_0x2a6e1f[_0x69d4('0x30')][_0x69d4('0x31')](_0x69d4('0x33'))){throw new db[(_0x69d4('0x34'))]['ValidationError'](_0x69d4('0x35'));}else{if(_0x2a6e1f[_0x69d4('0x30')][_0x69d4('0x31')](_0x69d4('0x33'))&&!_0x2a6e1f['body'][_0x69d4('0x31')]('view')){throw new db[(_0x69d4('0x34'))]['ValidationError'](_0x69d4('0x36'));}if(!_0x2a6e1f['body'][_0x69d4('0x31')](_0x69d4('0x37'))){throw new db[(_0x69d4('0x34'))][(_0x69d4('0x38'))](_0x69d4('0x39'));}else{try{var _0x411392=JSON[_0x69d4('0x3a')](_0x2a6e1f[_0x69d4('0x30')][_0x69d4('0x37')]);}catch(_0x82d4dd){logger[_0x69d4('0x2b')](_0x82d4dd);throw new db['Sequelize'][(_0x69d4('0x38'))](_0x69d4('0x3b'));}var _0x50cdca=[_0x69d4('0x3c'),_0x69d4('0x3d'),_0x69d4('0x3e'),_0x69d4('0x3f'),_0x69d4('0x40'),'voicequeue',_0x69d4('0x41'),_0x69d4('0x42'),'user'];if(_[_0x69d4('0x43')](_0x411392,function(_0x7bc796){return!_[_0x69d4('0x44')](_0x50cdca,_0x7bc796['model'][_0x69d4('0x45')]());})){throw new db[(_0x69d4('0x34'))][(_0x69d4('0x38'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x58d05c={};_0x58d05c['senderName']=_0x2a6e1f[_0x69d4('0x30')][_0x69d4('0x31')](_0x69d4('0x46'))?_0x2a6e1f['body'][_0x69d4('0x46')]:_0x2a6e1f[_0x69d4('0x47')][_0x69d4('0x48')];_0x58d05c['recipientsDescription']=_[_0x69d4('0x49')](_0x2a6e1f[_0x69d4('0x30')]['recipientsDescription'])?null:_0x2a6e1f[_0x69d4('0x30')][_0x69d4('0x4a')];_0x58d05c['beep']=_0x2a6e1f[_0x69d4('0x30')][_0x69d4('0x4b')]||![];_0x58d05c[_0x69d4('0x4c')]=_0x2a6e1f['user']['id'];return getContent(_0x2a6e1f[_0x69d4('0x30')])[_0x69d4('0x28')](function(_0x59a918){_0x58d05c[_0x69d4('0x30')]=_0x59a918;return getRecipients(_0x411392);})['then'](function(_0x6dd06c){_0x58d05c['recipientsId']=_['sortBy'](_0x6dd06c)[_0x69d4('0x4d')](',');return db['sequelize']['transaction'](function(_0x5c9947){return db[_0x69d4('0x4e')]['create'](_0x58d05c,{'raw':!![],'transaction':_0x5c9947})[_0x69d4('0x28')](function(_0x1fb3e4){var _0x12ea10={'sender':_0x58d05c[_0x69d4('0x46')],'description':_0x58d05c['recipientsDescription'],'content':_0x58d05c[_0x69d4('0x30')],'beep':_0x58d05c[_0x69d4('0x4b')]};_0x6dd06c[_0x69d4('0x4f')](function(_0x100df8){_0x12ea10['recipient']=_0x100df8;socket[_0x69d4('0x50')](_0x69d4('0x51'),_0x12ea10);});return _0x1fb3e4;});});})[_0x69d4('0x28')](respondWithResult(_0x469a6e,0xc9))['catch'](handleError(_0x469a6e,null));};function getContent(_0x2c1c90){return new BPromise(function(_0x2587e2,_0x40d0a8){if(_0x2c1c90[_0x69d4('0x32')]){_0x2587e2(_0x2c1c90[_0x69d4('0x32')]);return;}return db[_0x69d4('0x52')][_0x69d4('0x53')]({'attributes':['html'],'where':{'id':_0x2c1c90[_0x69d4('0x33')]},'raw':!![]})[_0x69d4('0x28')](function(_0x5a369b){if(!_0x5a369b)throw new db[(_0x69d4('0x34'))][(_0x69d4('0x38'))](_0x69d4('0x54'));var _0x564c95=Mustache[_0x69d4('0x55')](_0x5a369b['html'],_0x2c1c90[_0x69d4('0x56')]);_0x2587e2(_0x564c95);})[_0x69d4('0x57')](function(_0x16fefc){_0x40d0a8(_0x16fefc);});});}function getRecipients(_0x21fb12){return new BPromise(function(_0x11118f,_0x8d0485){var _0x34453d=[];var _0x383b91=[];_0x21fb12[_0x69d4('0x4f')](function(_0x175944){var _0x1a0395=_[_0x69d4('0x58')](_0x175944[_0x69d4('0x59')][_0x69d4('0x45')]());if(_0x1a0395===_0x69d4('0x5a')){_0x34453d=_[_0x69d4('0x5b')](_0x34453d,_0x175944['ids']);}else{if(_[_0x69d4('0x44')](_0x1a0395,_0x69d4('0x5c')))_0x1a0395=_0x1a0395[_0x69d4('0x5d')](_0x69d4('0x5c'),_0x69d4('0x5e'));_0x175944[_0x69d4('0x5f')][_0x69d4('0x4f')](function(_0x1e7aa0){_0x383b91['push'](getAgents(_0x1a0395,_0x1e7aa0));});}});return BPromise[_0x69d4('0x60')](_0x383b91)[_0x69d4('0x28')](function(_0x5ea34d){_0x34453d=_[_0x69d4('0x5b')](_0x34453d,_[_0x69d4('0x61')](_0x5ea34d));_0x11118f(_0x34453d);})[_0x69d4('0x57')](function(_0xeb0092){_0x8d0485(_0xeb0092);});});}function getAgents(_0x216970,_0xf1349e){return new BPromise(function(_0x258dfa,_0x2a0ddc){return db[_0x216970][_0x69d4('0x53')]({'where':{'id':_0xf1349e}})['then'](function(_0x1466b2){return _0x1466b2[_0x69d4('0x62')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3b87e5){var _0x19a76a=_[_0x69d4('0x63')](_0x3b87e5,'id');_0x258dfa(_0x19a76a);});})[_0x69d4('0x57')](function(_0x101115){_0x2a0ddc(_0x101115);});});} \ No newline at end of file +var _0x4f70=['forEach','emit','userNotification:send','catch','text','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','startCase','User','union','includes','queue','Queue','ids','push','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','./userNotification.socket','register','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','reject','save','then','error','stack','name','sendUserNotification','body','hasOwnProperty','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','smsqueue','voicequeue','team','user','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','recipientsId','sortBy','sequelize','transaction','UserNotification','create'];(function(_0x4f6464,_0x19ce0b){var _0x2970c0=function(_0x30b705){while(--_0x30b705){_0x4f6464['push'](_0x4f6464['shift']());}};_0x2970c0(++_0x19ce0b);}(_0x4f70,0x72));var _0x04f7=function(_0x1ca54c,_0x10bef2){_0x1ca54c=_0x1ca54c-0x0;var _0x3af5ea=_0x4f70[_0x1ca54c];return _0x3af5ea;};'use strict';var emlformat=require(_0x04f7('0x0'));var rimraf=require(_0x04f7('0x1'));var zipdir=require(_0x04f7('0x2'));var jsonpatch=require(_0x04f7('0x3'));var rp=require('request-promise');var moment=require(_0x04f7('0x4'));var BPromise=require(_0x04f7('0x5'));var Mustache=require(_0x04f7('0x6'));var util=require(_0x04f7('0x7'));var path=require(_0x04f7('0x8'));var sox=require(_0x04f7('0x9'));var csv=require(_0x04f7('0xa'));var ejs=require(_0x04f7('0xb'));var fs=require('fs');var fs_extra=require(_0x04f7('0xc'));var _=require('lodash');var squel=require(_0x04f7('0xd'));var crypto=require(_0x04f7('0xe'));var jsforce=require(_0x04f7('0xf'));var deskjs=require(_0x04f7('0x10'));var toCsv=require(_0x04f7('0xa'));var querystring=require(_0x04f7('0x11'));var Papa=require('papaparse');var Redis=require(_0x04f7('0x12'));var authService=require(_0x04f7('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x04f7('0x14'));var hardwareService=require(_0x04f7('0x15'));var logger=require(_0x04f7('0x16'))(_0x04f7('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x04f7('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x04f7('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x04f7('0x19')]));require(_0x04f7('0x1a'))[_0x04f7('0x1b')](socket);function respondWithStatusCode(_0xc0715b,_0x7b0360){_0x7b0360=_0x7b0360||0xcc;return function(_0x10a58b){if(_0x10a58b){return _0xc0715b[_0x04f7('0x1c')](_0x7b0360);}return _0xc0715b['status'](_0x7b0360)[_0x04f7('0x1d')]();};}function respondWithResult(_0x11023b,_0x852091){_0x852091=_0x852091||0xc8;return function(_0xe3203){if(_0xe3203){return _0x11023b[_0x04f7('0x1e')](_0x852091)['json'](_0xe3203);}};}function respondWithFilteredResult(_0x3601b6,_0x5960a2){return function(_0x304a6e){if(_0x304a6e){var _0x5398f4=typeof _0x5960a2[_0x04f7('0x1f')]==='undefined'&&typeof _0x5960a2[_0x04f7('0x20')]===_0x04f7('0x21');var _0x4ca759=_0x304a6e[_0x04f7('0x22')];var _0xefe518=_0x5398f4?0x0:_0x5960a2[_0x04f7('0x1f')];var _0x2ca93e=_0x5398f4?_0x304a6e[_0x04f7('0x22')]:_0x5960a2[_0x04f7('0x1f')]+_0x5960a2[_0x04f7('0x20')];var _0x3eff79;if(_0x2ca93e>=_0x4ca759){_0x2ca93e=_0x4ca759;_0x3eff79=0xc8;}else{_0x3eff79=0xce;}_0x3601b6[_0x04f7('0x1e')](_0x3eff79);return _0x3601b6[_0x04f7('0x23')](_0x04f7('0x24'),_0xefe518+'-'+_0x2ca93e+'/'+_0x4ca759)[_0x04f7('0x25')](_0x304a6e);}return null;};}function patchUpdates(_0x49841f){return function(_0x37b2b1){try{jsonpatch['apply'](_0x37b2b1,_0x49841f,!![]);}catch(_0x18efbc){return BPromise[_0x04f7('0x26')](_0x18efbc);}return _0x37b2b1[_0x04f7('0x27')]();};}function saveUpdates(_0x2d893d,_0x30edb5){return function(_0xf6e240){if(_0xf6e240){return _0xf6e240['update'](_0x2d893d)[_0x04f7('0x28')](function(_0x5519e3){return _0x5519e3;});}return null;};}function removeEntity(_0x378576,_0x349d9d){return function(_0x3ef384){if(_0x3ef384){return _0x3ef384['destroy']()[_0x04f7('0x28')](function(){_0x378576[_0x04f7('0x1e')](0xcc)[_0x04f7('0x1d')]();});}};}function handleEntityNotFound(_0x36d73f,_0x5edfd3){return function(_0xa1390){if(!_0xa1390){_0x36d73f['sendStatus'](0x194);}return _0xa1390;};}function handleError(_0x33b5bb,_0x3e9093){_0x3e9093=_0x3e9093||0x1f4;return function(_0x1cd65b){logger[_0x04f7('0x29')](_0x1cd65b[_0x04f7('0x2a')]);if(_0x1cd65b[_0x04f7('0x2b')]){delete _0x1cd65b[_0x04f7('0x2b')];}_0x33b5bb[_0x04f7('0x1e')](_0x3e9093)['send'](_0x1cd65b);};}exports[_0x04f7('0x2c')]=function(_0x4283c5,_0x3850a2,_0x40c2a3){if(!_0x4283c5[_0x04f7('0x2d')][_0x04f7('0x2e')]('text')&&!_0x4283c5[_0x04f7('0x2d')][_0x04f7('0x2e')]('TemplateId')){throw new db[(_0x04f7('0x2f'))][(_0x04f7('0x30'))](_0x04f7('0x31'));}else{if(_0x4283c5['body']['hasOwnProperty'](_0x04f7('0x32'))&&!_0x4283c5[_0x04f7('0x2d')][_0x04f7('0x2e')](_0x04f7('0x33'))){throw new db[(_0x04f7('0x2f'))][(_0x04f7('0x30'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x4283c5[_0x04f7('0x2d')][_0x04f7('0x2e')]('recipients')){throw new db[(_0x04f7('0x2f'))][(_0x04f7('0x30'))](_0x04f7('0x34'));}else{try{var _0x1064a5=JSON[_0x04f7('0x35')](_0x4283c5[_0x04f7('0x2d')][_0x04f7('0x36')]);}catch(_0x16c100){logger['error'](_0x16c100);throw new db[(_0x04f7('0x2f'))]['ValidationError'](_0x04f7('0x37'));}var _0xbd2255=[_0x04f7('0x38'),'faxqueue',_0x04f7('0x39'),'openchannelqueue',_0x04f7('0x3a'),_0x04f7('0x3b'),'whatsappqueue',_0x04f7('0x3c'),_0x04f7('0x3d')];if(_[_0x04f7('0x3e')](_0x1064a5,function(_0x3eccd3){return!_['includes'](_0xbd2255,_0x3eccd3[_0x04f7('0x3f')][_0x04f7('0x40')]());})){throw new db[(_0x04f7('0x2f'))]['ValidationError'](_0x04f7('0x41'));}}}var _0x196c9a={};_0x196c9a['senderName']=_0x4283c5[_0x04f7('0x2d')][_0x04f7('0x2e')](_0x04f7('0x42'))?_0x4283c5[_0x04f7('0x2d')][_0x04f7('0x42')]:_0x4283c5[_0x04f7('0x3d')][_0x04f7('0x43')];_0x196c9a['recipientsDescription']=_[_0x04f7('0x44')](_0x4283c5['body'][_0x04f7('0x45')])?null:_0x4283c5[_0x04f7('0x2d')]['recipientsDescription'];_0x196c9a['beep']=_0x4283c5[_0x04f7('0x2d')][_0x04f7('0x46')]||![];_0x196c9a[_0x04f7('0x47')]=_0x4283c5[_0x04f7('0x3d')]['id'];return getContent(_0x4283c5[_0x04f7('0x2d')])[_0x04f7('0x28')](function(_0x5518ed){_0x196c9a['body']=_0x5518ed;return getRecipients(_0x1064a5);})[_0x04f7('0x28')](function(_0x287b7e){_0x196c9a[_0x04f7('0x48')]=_[_0x04f7('0x49')](_0x287b7e)['join'](',');return db[_0x04f7('0x4a')][_0x04f7('0x4b')](function(_0x3cfaf7){return db[_0x04f7('0x4c')][_0x04f7('0x4d')](_0x196c9a,{'raw':!![],'transaction':_0x3cfaf7})[_0x04f7('0x28')](function(_0x3e2836){var _0x23182d={'sender':_0x196c9a['senderName'],'description':_0x196c9a['recipientsDescription'],'content':_0x196c9a[_0x04f7('0x2d')],'beep':_0x196c9a[_0x04f7('0x46')]};_0x287b7e[_0x04f7('0x4e')](function(_0x726405){_0x23182d['recipient']=_0x726405;socket[_0x04f7('0x4f')](_0x04f7('0x50'),_0x23182d);});return _0x3e2836;});});})[_0x04f7('0x28')](respondWithResult(_0x3850a2,0xc9))[_0x04f7('0x51')](handleError(_0x3850a2,null));};function getContent(_0x4a5dfe){return new BPromise(function(_0x46d2a8,_0x2ebfca){if(_0x4a5dfe[_0x04f7('0x52')]){_0x46d2a8(_0x4a5dfe[_0x04f7('0x52')]);return;}return db[_0x04f7('0x53')][_0x04f7('0x54')]({'attributes':['html'],'where':{'id':_0x4a5dfe[_0x04f7('0x32')]},'raw':!![]})[_0x04f7('0x28')](function(_0x2dc902){if(!_0x2dc902)throw new db[(_0x04f7('0x2f'))][(_0x04f7('0x30'))](_0x04f7('0x55'));var _0x4e4259=Mustache['render'](_0x2dc902['html'],_0x4a5dfe[_0x04f7('0x33')]);_0x46d2a8(_0x4e4259);})[_0x04f7('0x51')](function(_0x1bb5a7){_0x2ebfca(_0x1bb5a7);});});}function getRecipients(_0xe03d65){return new BPromise(function(_0x190d70,_0x4c4e2e){var _0x37f364=[];var _0x402a09=[];_0xe03d65[_0x04f7('0x4e')](function(_0x3e3802){var _0x58afb3=_[_0x04f7('0x56')](_0x3e3802[_0x04f7('0x3f')]['toLowerCase']());if(_0x58afb3===_0x04f7('0x57')){_0x37f364=_[_0x04f7('0x58')](_0x37f364,_0x3e3802['ids']);}else{if(_[_0x04f7('0x59')](_0x58afb3,_0x04f7('0x5a')))_0x58afb3=_0x58afb3['replace'](_0x04f7('0x5a'),_0x04f7('0x5b'));_0x3e3802[_0x04f7('0x5c')][_0x04f7('0x4e')](function(_0x2bf846){_0x402a09[_0x04f7('0x5d')](getAgents(_0x58afb3,_0x2bf846));});}});return BPromise['all'](_0x402a09)['then'](function(_0x1db724){_0x37f364=_[_0x04f7('0x58')](_0x37f364,_['flatten'](_0x1db724));_0x190d70(_0x37f364);})[_0x04f7('0x51')](function(_0x4d0259){_0x4c4e2e(_0x4d0259);});});}function getAgents(_0x4cbe0c,_0x4c7f72){return new BPromise(function(_0x3d22b2,_0x45a9b6){return db[_0x4cbe0c][_0x04f7('0x54')]({'where':{'id':_0x4c7f72}})['then'](function(_0x51afff){return _0x51afff[_0x04f7('0x5e')]({'attributes':['id'],'raw':!![]})[_0x04f7('0x28')](function(_0x154149){var _0x31b4a3=_[_0x04f7('0x5f')](_0x154149,'id');_0x3d22b2(_0x31b4a3);});})['catch'](function(_0x15c43e){_0x45a9b6(_0x15c43e);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 853770e..2f67e70 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 _0x8db0=['setMaxListeners','remove','emit','hook','../../mysqldb','UserNotification'];(function(_0x3f6bcf,_0x531e79){var _0x1c5350=function(_0x282fc5){while(--_0x282fc5){_0x3f6bcf['push'](_0x3f6bcf['shift']());}};_0x1c5350(++_0x531e79);}(_0x8db0,0x190));var _0x08db=function(_0x55c1f0,_0x4f574f){_0x55c1f0=_0x55c1f0-0x0;var _0x1530fa=_0x8db0[_0x55c1f0];return _0x1530fa;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x08db('0x0'))['db'][_0x08db('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x08db('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x08db('0x3')};function emitEvent(_0x41a93a){return function(_0x1e2a3d,_0x141dbd,_0x3603f3){UserNotificationEvents['emit'](_0x41a93a+':'+_0x1e2a3d['id'],_0x1e2a3d);UserNotificationEvents[_0x08db('0x4')](_0x41a93a,_0x1e2a3d);_0x3603f3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x08db('0x5')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0x84de=['hook','../../mysqldb','UserNotification','update','emit','hasOwnProperty'];(function(_0x568978,_0x5dd84f){var _0x3a596a=function(_0x36cdcb){while(--_0x36cdcb){_0x568978['push'](_0x568978['shift']());}};_0x3a596a(++_0x5dd84f);}(_0x84de,0x14b));var _0xe84d=function(_0x5875ad,_0x3597b8){_0x5875ad=_0x5875ad-0x0;var _0x32a922=_0x84de[_0x5875ad];return _0x32a922;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0xe84d('0x0'))['db'][_0xe84d('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe84d('0x2'),'afterDestroy':'remove'};function emitEvent(_0x2f2eed){return function(_0x167066,_0x31b14c,_0x270316){UserNotificationEvents['emit'](_0x2f2eed+':'+_0x167066['id'],_0x167066);UserNotificationEvents[_0xe84d('0x3')](_0x2f2eed,_0x167066);_0x270316(null);};}for(var e in events){if(events[_0xe84d('0x4')](e)){var event=events[e];UserNotification[_0xe84d('0x5')](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 645e809..bae179d 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 _0x4241=['define','UserNotification','userNotifications','utf8mb4','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userNotification.attributes','exports'];(function(_0x246f92,_0xcf7bd4){var _0x2b8e7d=function(_0x9e8650){while(--_0x9e8650){_0x246f92['push'](_0x246f92['shift']());}};_0x2b8e7d(++_0xcf7bd4);}(_0x4241,0x17d));var _0x1424=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x4241[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1424('0x0'))(_0x1424('0x1'));var moment=require(_0x1424('0x2'));var BPromise=require(_0x1424('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1424('0x4'));var rimraf=require(_0x1424('0x5'));var config=require(_0x1424('0x6'));var attributes=require(_0x1424('0x7'));module[_0x1424('0x8')]=function(_0x1edd66,_0x2e44b5){return _0x1edd66[_0x1424('0x9')](_0x1424('0xa'),attributes,{'tableName':_0x1424('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1424('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xdc6c=['exports','userNotifications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','../../config/environment'];(function(_0x2f8ae5,_0x2ee374){var _0xdf46c4=function(_0x7e4026){while(--_0x7e4026){_0x2f8ae5['push'](_0x2f8ae5['shift']());}};_0xdf46c4(++_0x2ee374);}(_0xdc6c,0x123));var _0xcdc6=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xdc6c[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xcdc6('0x0'));var util=require(_0xcdc6('0x1'));var logger=require(_0xcdc6('0x2'))(_0xcdc6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcdc6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcdc6('0x5'));var attributes=require('./userNotification.attributes');module[_0xcdc6('0x6')]=function(_0xc262d4,_0x3b8f12){return _0xc262d4['define']('UserNotification',attributes,{'tableName':_0xcdc6('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xcdc6('0x8')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 0915ebd..92e30b4 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 _0x29ec=['../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userNotification.socket','register','then','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x53f144,_0x23b43f){var _0x396ce9=function(_0x36941f){while(--_0x36941f){_0x53f144['push'](_0x53f144['shift']());}};_0x396ce9(++_0x23b43f);}(_0x29ec,0xd9));var _0xc29e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29ec[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc29e('0x0'));var util=require(_0xc29e('0x1'));var moment=require(_0xc29e('0x2'));var BPromise=require(_0xc29e('0x3'));var rs=require(_0xc29e('0x4'));var fs=require('fs');var Redis=require(_0xc29e('0x5'));var db=require(_0xc29e('0x6'))['db'];var utils=require(_0xc29e('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xc29e('0x8'));var jayson=require(_0xc29e('0x9'));var client=jayson[_0xc29e('0xa')][_0xc29e('0xb')]({'port':0x232a});config[_0xc29e('0xc')]=_[_0xc29e('0xd')](config[_0xc29e('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xc29e('0xe'))(new Redis(config[_0xc29e('0xc')]));require(_0xc29e('0xf'))[_0xc29e('0x10')](socket);function respondWithRpcPromise(_0x4a31e6,_0x90761e,_0xe3b7a4){return new BPromise(function(_0xd76296,_0x3dc998){return client['request'](_0x4a31e6,_0xe3b7a4)[_0xc29e('0x11')](function(_0x13c9dc){logger['info'](_0xc29e('0x12'),_0x90761e,_0xc29e('0x13'));logger[_0xc29e('0x14')](_0xc29e('0x15'),_0x90761e,_0xc29e('0x13'),JSON[_0xc29e('0x16')](_0x13c9dc));if(_0x13c9dc[_0xc29e('0x17')]){if(_0x13c9dc[_0xc29e('0x17')]['code']===0x1f4){logger[_0xc29e('0x17')](_0xc29e('0x12'),_0x90761e,_0x13c9dc[_0xc29e('0x17')][_0xc29e('0x18')]);return _0x3dc998(_0x13c9dc[_0xc29e('0x17')]['message']);}logger['error'](_0xc29e('0x12'),_0x90761e,_0x13c9dc['error'][_0xc29e('0x18')]);return _0xd76296(_0x13c9dc[_0xc29e('0x17')][_0xc29e('0x18')]);}else{logger[_0xc29e('0x19')](_0xc29e('0x12'),_0x90761e,'request\x20sent');_0xd76296(_0x13c9dc[_0xc29e('0x1a')]['message']);}})[_0xc29e('0x1b')](function(_0x292973){logger['error']('UserNotification,\x20%s,\x20%s',_0x90761e,_0x292973);_0x3dc998(_0x292973);});});} \ No newline at end of file +var _0xacac=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','then','info','request\x20sent','debug','stringify','error','UserNotification,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xacac,0xae));var _0xcaca=function(_0xb12015,_0x25e345){_0xb12015=_0xb12015-0x0;var _0xfcbaf2=_0xacac[_0xb12015];return _0xfcbaf2;};'use strict';var _=require(_0xcaca('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcaca('0x1'));var fs=require('fs');var Redis=require(_0xcaca('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xcaca('0x3'));var logger=require(_0xcaca('0x4'))(_0xcaca('0x5'));var config=require(_0xcaca('0x6'));var jayson=require(_0xcaca('0x7'));var client=jayson['client'][_0xcaca('0x8')]({'port':0x232a});config[_0xcaca('0x9')]=_[_0xcaca('0xa')](config[_0xcaca('0x9')],{'host':_0xcaca('0xb'),'port':0x18eb});var socket=require(_0xcaca('0xc'))(new Redis(config[_0xcaca('0x9')]));require(_0xcaca('0xd'))[_0xcaca('0xe')](socket);function respondWithRpcPromise(_0x1fad35,_0x4e0053,_0x5ad10d){return new BPromise(function(_0x35bd14,_0x5322c6){return client['request'](_0x1fad35,_0x5ad10d)[_0xcaca('0xf')](function(_0x48c35f){logger[_0xcaca('0x10')]('UserNotification,\x20%s,\x20%s',_0x4e0053,_0xcaca('0x11'));logger[_0xcaca('0x12')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x4e0053,_0xcaca('0x11'),JSON[_0xcaca('0x13')](_0x48c35f));if(_0x48c35f[_0xcaca('0x14')]){if(_0x48c35f[_0xcaca('0x14')]['code']===0x1f4){logger['error'](_0xcaca('0x15'),_0x4e0053,_0x48c35f['error'][_0xcaca('0x16')]);return _0x5322c6(_0x48c35f[_0xcaca('0x14')][_0xcaca('0x16')]);}logger[_0xcaca('0x14')](_0xcaca('0x15'),_0x4e0053,_0x48c35f['error'][_0xcaca('0x16')]);return _0x35bd14(_0x48c35f[_0xcaca('0x14')]['message']);}else{logger[_0xcaca('0x10')](_0xcaca('0x15'),_0x4e0053,_0xcaca('0x11'));_0x35bd14(_0x48c35f[_0xcaca('0x17')]['message']);}})[_0xcaca('0x18')](function(_0x167fda){logger[_0xcaca('0x14')](_0xcaca('0x15'),_0x4e0053,_0x167fda);_0x5322c6(_0x167fda);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 071867f..398b10f 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 _0x4f0b=['save','update','emit','register','userNotification:','./userNotification.events'];(function(_0x53a90d,_0x408e3e){var _0x431564=function(_0x4a07de){while(--_0x4a07de){_0x53a90d['push'](_0x53a90d['shift']());}};_0x431564(++_0x408e3e);}(_0x4f0b,0x6b));var _0xb4f0=function(_0x33bacc,_0x519717){_0x33bacc=_0x33bacc-0x0;var _0x27911c=_0x4f0b[_0x33bacc];return _0x27911c;};'use strict';var UserNotificationEvents=require(_0xb4f0('0x0'));var events=[_0xb4f0('0x1'),'remove',_0xb4f0('0x2')];function createListener(_0xa590e4,_0x19fb04){return function(_0x29ba30){_0x19fb04[_0xb4f0('0x3')](_0xa590e4,_0x29ba30);};}function removeListener(_0x613b13,_0x28ef0f){return function(){UserNotificationEvents['removeListener'](_0x613b13,_0x28ef0f);};}exports[_0xb4f0('0x4')]=function(_0x5071c1){for(var _0x13e09c=0x0,_0x22b2c5=events['length'];_0x13e09c<_0x22b2c5;_0x13e09c++){var _0x37dca4=events[_0x13e09c];var _0x26ef36=createListener(_0xb4f0('0x5')+_0x37dca4,_0x5071c1);UserNotificationEvents['on'](_0x37dca4,_0x26ef36);}}; \ No newline at end of file +var _0x8506=['update','emit','removeListener','length','save','remove'];(function(_0x2ae8ce,_0x2a5a1f){var _0x4bf686=function(_0x41cabf){while(--_0x41cabf){_0x2ae8ce['push'](_0x2ae8ce['shift']());}};_0x4bf686(++_0x2a5a1f);}(_0x8506,0x124));var _0x6850=function(_0x24aa89,_0x522b6c){_0x24aa89=_0x24aa89-0x0;var _0x525ff1=_0x8506[_0x24aa89];return _0x525ff1;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x6850('0x0'),_0x6850('0x1'),_0x6850('0x2')];function createListener(_0x457ea3,_0x535a42){return function(_0x12eb32){_0x535a42[_0x6850('0x3')](_0x457ea3,_0x12eb32);};}function removeListener(_0x1fbacb,_0x3899c7){return function(){UserNotificationEvents[_0x6850('0x4')](_0x1fbacb,_0x3899c7);};}exports['register']=function(_0x259083){for(var _0x5e850e=0x0,_0x3ede4b=events[_0x6850('0x5')];_0x5e850e<_0x3ede4b;_0x5e850e++){var _0x3daf8a=events[_0x5e850e];var _0x46e9a7=createListener('userNotification:'+_0x3daf8a,_0x259083);UserNotificationEvents['on'](_0x3daf8a,_0x46e9a7);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index eb243f9..8b9da80 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1b78e1,_0x5d90e9){var _0x132f1f=function(_0x2bd667){while(--_0x2bd667){_0x1b78e1['push'](_0x1b78e1['shift']());}};_0x132f1f(++_0x5d90e9);}(_0x70e0,0x17b));var _0x070e=function(_0x3476d8,_0x1f6db6){_0x3476d8=_0x3476d8-0x0;var _0x5955a7=_0x70e0[_0x3476d8];return _0x5955a7;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x5132b1,_0x2b5868){var _0x1952d4=function(_0x50d38){while(--_0x50d38){_0x5132b1['push'](_0x5132b1['shift']());}};_0x1952d4(++_0x2b5868);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0xcb91[_0x256b72];return _0x2183e3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index c2ada2a..87d111c 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 _0x8994=['INTEGER','sequelize','exports'];(function(_0x56db3d,_0x5ee08e){var _0xe4763f=function(_0x12ae82){while(--_0x12ae82){_0x56db3d['push'](_0x56db3d['shift']());}};_0xe4763f(++_0x5ee08e);}(_0x8994,0x16f));var _0x4899=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0x8994[_0x485b5a];return _0xd2b34d;};'use strict';var Sequelize=require(_0x4899('0x0'));module[_0x4899('0x1')]={'penalty':{'type':Sequelize[_0x4899('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe87a=['sequelize','exports','INTEGER'];(function(_0x514816,_0x57c091){var _0x5c3a43=function(_0xd4a413){while(--_0xd4a413){_0x514816['push'](_0x514816['shift']());}};_0x5c3a43(++_0x57c091);}(_0xe87a,0x15f));var _0xae87=function(_0x30298f,_0x2e06ca){_0x30298f=_0x30298f-0x0;var _0x5410d6=_0xe87a[_0x30298f];return _0x5410d6;};'use strict';var Sequelize=require(_0xae87('0x0'));module[_0xae87('0x1')]={'penalty':{'type':Sequelize[_0xae87('0x2')],'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 9a9b91d..e74afe1 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 _0x30c3=['define','UserOpenchannelQueue','util','../../config/logger','api','moment','request-promise','path','rimraf','./userOpenchannelQueue.attributes','exports'];(function(_0x5b3c61,_0x3eb2aa){var _0x153389=function(_0x2a1a99){while(--_0x2a1a99){_0x5b3c61['push'](_0x5b3c61['shift']());}};_0x153389(++_0x3eb2aa);}(_0x30c3,0x183));var _0x330c=function(_0x5e4ffa,_0x56154d){_0x5e4ffa=_0x5e4ffa-0x0;var _0x43a656=_0x30c3[_0x5e4ffa];return _0x43a656;};'use strict';var _=require('lodash');var util=require(_0x330c('0x0'));var logger=require(_0x330c('0x1'))(_0x330c('0x2'));var moment=require(_0x330c('0x3'));var BPromise=require('bluebird');var rp=require(_0x330c('0x4'));var fs=require('fs');var path=require(_0x330c('0x5'));var rimraf=require(_0x330c('0x6'));var config=require('../../config/environment');var attributes=require(_0x330c('0x7'));module[_0x330c('0x8')]=function(_0x4d0818,_0x4371c7){return _0x4d0818[_0x330c('0x9')](_0x330c('0xa'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7083=['bluebird','request-promise','path','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','../../config/logger','api','moment'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x7083,0x1a1));var _0x3708=function(_0x56240f,_0x567dc3){_0x56240f=_0x56240f-0x0;var _0x4878ae=_0x7083[_0x56240f];return _0x4878ae;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3708('0x0'))(_0x3708('0x1'));var moment=require(_0x3708('0x2'));var BPromise=require(_0x3708('0x3'));var rp=require(_0x3708('0x4'));var fs=require('fs');var path=require(_0x3708('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userOpenchannelQueue.attributes');module[_0x3708('0x6')]=function(_0x58a983,_0x4f0d4c){return _0x58a983[_0x3708('0x7')](_0x3708('0x8'),attributes,{'tableName':_0x3708('0x9'),'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 791d900..361b00c 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 _0xb138=['info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then'];(function(_0x57ca83,_0x423a09){var _0x3973a0=function(_0x264235){while(--_0x264235){_0x57ca83['push'](_0x57ca83['shift']());}};_0x3973a0(++_0x423a09);}(_0xb138,0x94));var _0x8b13=function(_0x2e997e,_0x4edf31){_0x2e997e=_0x2e997e-0x0;var _0x5a6cb1=_0xb138[_0x2e997e];return _0x5a6cb1;};'use strict';var _=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var moment=require(_0x8b13('0x2'));var BPromise=require(_0x8b13('0x3'));var rs=require(_0x8b13('0x4'));var fs=require('fs');var Redis=require(_0x8b13('0x5'));var db=require(_0x8b13('0x6'))['db'];var utils=require(_0x8b13('0x7'));var logger=require(_0x8b13('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8b13('0x9')][_0x8b13('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a5f26,_0x237bd0,_0x16824e){return new BPromise(function(_0xd7934f,_0x5b4025){return client[_0x8b13('0xb')](_0x3a5f26,_0x16824e)[_0x8b13('0xc')](function(_0x1bd3c7){logger[_0x8b13('0xd')](_0x8b13('0xe'),_0x237bd0,_0x8b13('0xf'));logger[_0x8b13('0x10')](_0x8b13('0x11'),_0x237bd0,_0x8b13('0xf'),JSON[_0x8b13('0x12')](_0x1bd3c7));if(_0x1bd3c7[_0x8b13('0x13')]){if(_0x1bd3c7['error'][_0x8b13('0x14')]===0x1f4){logger['error'](_0x8b13('0xe'),_0x237bd0,_0x1bd3c7[_0x8b13('0x13')][_0x8b13('0x15')]);return _0x5b4025(_0x1bd3c7[_0x8b13('0x13')]['message']);}logger[_0x8b13('0x13')](_0x8b13('0xe'),_0x237bd0,_0x1bd3c7[_0x8b13('0x13')][_0x8b13('0x15')]);return _0xd7934f(_0x1bd3c7['error'][_0x8b13('0x15')]);}else{logger[_0x8b13('0xd')](_0x8b13('0xe'),_0x237bd0,_0x8b13('0xf'));_0xd7934f(_0x1bd3c7['result']['message']);}})[_0x8b13('0x16')](function(_0x3185e6){logger[_0x8b13('0x13')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x237bd0,_0x3185e6);_0x5b4025(_0x3185e6);});});} \ No newline at end of file +var _0x1655=['then','info','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','UserOpenchannelQueue,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','rpc','client','http'];(function(_0x1b43b5,_0x36f72e){var _0x2761d8=function(_0x4dc8f6){while(--_0x4dc8f6){_0x1b43b5['push'](_0x1b43b5['shift']());}};_0x2761d8(++_0x36f72e);}(_0x1655,0xbe));var _0x5165=function(_0x17d0d4,_0x50ff38){_0x17d0d4=_0x17d0d4-0x0;var _0x54313f=_0x1655[_0x17d0d4];return _0x54313f;};'use strict';var _=require(_0x5165('0x0'));var util=require(_0x5165('0x1'));var moment=require('moment');var BPromise=require(_0x5165('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5165('0x3'));var db=require(_0x5165('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5165('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5165('0x6')][_0x5165('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x111f3b,_0x1e1649,_0x2e2f18){return new BPromise(function(_0x3d2d5c,_0x209566){return client['request'](_0x111f3b,_0x2e2f18)[_0x5165('0x8')](function(_0x10a2df){logger[_0x5165('0x9')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1e1649,_0x5165('0xa'));logger[_0x5165('0xb')](_0x5165('0xc'),_0x1e1649,_0x5165('0xa'),JSON['stringify'](_0x10a2df));if(_0x10a2df[_0x5165('0xd')]){if(_0x10a2df[_0x5165('0xd')]['code']===0x1f4){logger[_0x5165('0xd')](_0x5165('0xe'),_0x1e1649,_0x10a2df[_0x5165('0xd')][_0x5165('0xf')]);return _0x209566(_0x10a2df[_0x5165('0xd')]['message']);}logger[_0x5165('0xd')](_0x5165('0xe'),_0x1e1649,_0x10a2df['error']['message']);return _0x3d2d5c(_0x10a2df['error']['message']);}else{logger['info'](_0x5165('0xe'),_0x1e1649,'request\x20sent');_0x3d2d5c(_0x10a2df[_0x5165('0x10')][_0x5165('0xf')]);}})[_0x5165('0x11')](function(_0x3c27c1){logger['error'](_0x5165('0xe'),_0x1e1649,_0x3c27c1);_0x209566(_0x3c27c1);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 0c9878e..d93359a 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 _0x4fde=['post','/:id/clone','clone','addSections','/:id','update','delete','removeSections','removeResources','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','/:id/sections','/:id/resources','getResources','create'];(function(_0x5e42f2,_0x18ed32){var _0x2ef04e=function(_0x5b5eab){while(--_0x5b5eab){_0x5e42f2['push'](_0x5e42f2['shift']());}};_0x2ef04e(++_0x18ed32);}(_0x4fde,0x19f));var _0xe4fd=function(_0xbe40ad,_0x44343c){_0xbe40ad=_0xbe40ad-0x0;var _0x50fac9=_0x4fde[_0xbe40ad];return _0x50fac9;};'use strict';var multer=require(_0xe4fd('0x0'));var util=require(_0xe4fd('0x1'));var path=require(_0xe4fd('0x2'));var timeout=require(_0xe4fd('0x3'));var express=require('express');var router=express[_0xe4fd('0x4')]();var fs_extra=require(_0xe4fd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe4fd('0x6'));var config=require(_0xe4fd('0x7'));var controller=require(_0xe4fd('0x8'));router[_0xe4fd('0x9')]('/',auth[_0xe4fd('0xa')](),controller[_0xe4fd('0xb')]);router[_0xe4fd('0x9')](_0xe4fd('0xc'),auth[_0xe4fd('0xa')](),controller['describe']);router[_0xe4fd('0x9')]('/:id',auth[_0xe4fd('0xa')](),controller['show']);router['get'](_0xe4fd('0xd'),auth[_0xe4fd('0xa')](),controller['getSections']);router['get'](_0xe4fd('0xe'),auth[_0xe4fd('0xa')](),controller[_0xe4fd('0xf')]);router['post']('/',auth[_0xe4fd('0xa')](),controller[_0xe4fd('0x10')]);router[_0xe4fd('0x11')](_0xe4fd('0x12'),auth[_0xe4fd('0xa')](),controller[_0xe4fd('0x13')]);router['post'](_0xe4fd('0xd'),auth[_0xe4fd('0xa')](),controller[_0xe4fd('0x14')]);router['post'](_0xe4fd('0xe'),auth[_0xe4fd('0xa')](),controller['addResources']);router['put'](_0xe4fd('0x15'),auth[_0xe4fd('0xa')](),controller[_0xe4fd('0x16')]);router['delete'](_0xe4fd('0x15'),auth['isAuthenticated'](),controller['destroy']);router[_0xe4fd('0x17')](_0xe4fd('0xd'),auth[_0xe4fd('0xa')](),controller[_0xe4fd('0x18')]);router[_0xe4fd('0x17')]('/:id/resources',auth[_0xe4fd('0xa')](),controller[_0xe4fd('0x19')]);module[_0xe4fd('0x1a')]=router; \ No newline at end of file +var _0xb647=['/:id/clone','addSections','addResources','put','update','delete','destroy','removeResources','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/sections','/:id/resources','getResources','post','create'];(function(_0x36a4ef,_0x590d34){var _0x43f232=function(_0x421cd3){while(--_0x421cd3){_0x36a4ef['push'](_0x36a4ef['shift']());}};_0x43f232(++_0x590d34);}(_0xb647,0xdb));var _0x7b64=function(_0x1bb507,_0x54d41d){_0x1bb507=_0x1bb507-0x0;var _0x212cb5=_0xb647[_0x1bb507];return _0x212cb5;};'use strict';var multer=require(_0x7b64('0x0'));var util=require(_0x7b64('0x1'));var path=require(_0x7b64('0x2'));var timeout=require(_0x7b64('0x3'));var express=require(_0x7b64('0x4'));var router=express[_0x7b64('0x5')]();var fs_extra=require(_0x7b64('0x6'));var auth=require(_0x7b64('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7b64('0x8'));var controller=require('./userProfile.controller');router[_0x7b64('0x9')]('/',auth[_0x7b64('0xa')](),controller[_0x7b64('0xb')]);router[_0x7b64('0x9')](_0x7b64('0xc'),auth[_0x7b64('0xa')](),controller[_0x7b64('0xd')]);router[_0x7b64('0x9')](_0x7b64('0xe'),auth['isAuthenticated'](),controller[_0x7b64('0xf')]);router['get'](_0x7b64('0x10'),auth['isAuthenticated'](),controller['getSections']);router[_0x7b64('0x9')](_0x7b64('0x11'),auth['isAuthenticated'](),controller[_0x7b64('0x12')]);router[_0x7b64('0x13')]('/',auth[_0x7b64('0xa')](),controller[_0x7b64('0x14')]);router[_0x7b64('0x13')](_0x7b64('0x15'),auth[_0x7b64('0xa')](),controller['clone']);router[_0x7b64('0x13')]('/:id/sections',auth['isAuthenticated'](),controller[_0x7b64('0x16')]);router[_0x7b64('0x13')](_0x7b64('0x11'),auth[_0x7b64('0xa')](),controller[_0x7b64('0x17')]);router[_0x7b64('0x18')](_0x7b64('0xe'),auth['isAuthenticated'](),controller[_0x7b64('0x19')]);router[_0x7b64('0x1a')](_0x7b64('0xe'),auth[_0x7b64('0xa')](),controller[_0x7b64('0x1b')]);router['delete'](_0x7b64('0x10'),auth[_0x7b64('0xa')](),controller['removeSections']);router[_0x7b64('0x1a')](_0x7b64('0x11'),auth['isAuthenticated'](),controller[_0x7b64('0x1c')]);module[_0x7b64('0x1d')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 6f32f54..04ddff9 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 _0x3438=['STRING','crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','name'];(function(_0x20a3cf,_0x5dde6d){var _0x39dd1e=function(_0x183867){while(--_0x183867){_0x20a3cf['push'](_0x20a3cf['shift']());}};_0x39dd1e(++_0x5dde6d);}(_0x3438,0x1a6));var _0x8343=function(_0x1955c8,_0x1043fb){_0x1955c8=_0x1955c8-0x0;var _0x4f363f=_0x3438[_0x1955c8];return _0x4f363f;};'use strict';var Sequelize=require(_0x8343('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8343('0x1')},'crudPermissions':{'type':Sequelize[_0x8343('0x2')],'set':function(_0x27ff9d){this['setDataValue'](_0x8343('0x3'),_0x27ff9d?_0x27ff9d[_0x8343('0x4')](''):[]);},'get':function(){return this[_0x8343('0x5')](_0x8343('0x3'))?this[_0x8343('0x5')](_0x8343('0x3'))[_0x8343('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x8343('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x8343('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x8343('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x8343('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x8343('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x8343('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x8343('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x35c6=['sequelize','STRING','setDataValue','join','crudPermissions','getDataValue','split','BOOLEAN'];(function(_0x22a9db,_0x4506c5){var _0x35715a=function(_0x4d9998){while(--_0x4d9998){_0x22a9db['push'](_0x22a9db['shift']());}};_0x35715a(++_0x4506c5);}(_0x35c6,0xa8));var _0x635c=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x35c6[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x635c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x635c('0x1')],'set':function(_0x162596){this[_0x635c('0x2')]('crudPermissions',_0x162596?_0x162596[_0x635c('0x3')](''):[]);},'get':function(){return this['getDataValue'](_0x635c('0x4'))?this[_0x635c('0x5')](_0x635c('0x4'))[_0x635c('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x635c('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x635c('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x635c('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x635c('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x635c('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x635c('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x635c('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x635c('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index f3dba52..a9c210e 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 _0x9e63=['desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','stack','name','send','map','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','fields','create','body','clone','options','get','createdAt','updatedAt','crudPermissions','UserProfileSection','each','autoAssociation','UserProfileResource','omit','sectionId','userProfileId','Resources','find','describe','addSections','transaction','destroy','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','Plugin','addResources','sequelize','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce'];(function(_0x547d01,_0x3dca2c){var _0x3f469a=function(_0x3b29f9){while(--_0x3b29f9){_0x547d01['push'](_0x547d01['shift']());}};_0x3f469a(++_0x3dca2c);}(_0x9e63,0x65));var _0x39e6=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x9e63[_0x4e1d03];return _0x362d4b;};'use strict';var emlformat=require(_0x39e6('0x0'));var rimraf=require(_0x39e6('0x1'));var zipdir=require(_0x39e6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x39e6('0x3'));var moment=require(_0x39e6('0x4'));var BPromise=require(_0x39e6('0x5'));var Mustache=require(_0x39e6('0x6'));var util=require(_0x39e6('0x7'));var path=require(_0x39e6('0x8'));var sox=require(_0x39e6('0x9'));var csv=require(_0x39e6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x39e6('0xb'));var _=require(_0x39e6('0xc'));var squel=require(_0x39e6('0xd'));var crypto=require('crypto');var jsforce=require(_0x39e6('0xe'));var deskjs=require(_0x39e6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x39e6('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x39e6('0x11'));var qs=require(_0x39e6('0x12'));var as=require(_0x39e6('0x13'));var hardwareService=require(_0x39e6('0x14'));var logger=require(_0x39e6('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x39e6('0x16'));var licenseUtil=require(_0x39e6('0x17'));var db=require(_0x39e6('0x18'))['db'];config[_0x39e6('0x19')]=_[_0x39e6('0x1a')](config['redis'],{'host':_0x39e6('0x1b'),'port':0x18eb});var socket=require(_0x39e6('0x1c'))(new Redis(config[_0x39e6('0x19')]));require(_0x39e6('0x1d'))['register'](socket);function respondWithStatusCode(_0x4ed79d,_0x4ffa4d){_0x4ffa4d=_0x4ffa4d||0xcc;return function(_0x24ac12){if(_0x24ac12){return _0x4ed79d[_0x39e6('0x1e')](_0x4ffa4d);}return _0x4ed79d[_0x39e6('0x1f')](_0x4ffa4d)[_0x39e6('0x20')]();};}function respondWithResult(_0x5a86e3,_0x215096){_0x215096=_0x215096||0xc8;return function(_0x124e05){if(_0x124e05){return _0x5a86e3[_0x39e6('0x1f')](_0x215096)[_0x39e6('0x21')](_0x124e05);}};}function respondWithFilteredResult(_0x18d076,_0xc6497b){return function(_0x1a3adf){if(_0x1a3adf){var _0x512279=typeof _0xc6497b[_0x39e6('0x22')]===_0x39e6('0x23')&&typeof _0xc6497b[_0x39e6('0x24')]==='undefined';var _0x47e94b=_0x1a3adf[_0x39e6('0x25')];var _0x445f12=_0x512279?0x0:_0xc6497b[_0x39e6('0x22')];var _0x2d9a98=_0x512279?_0x1a3adf[_0x39e6('0x25')]:_0xc6497b['offset']+_0xc6497b[_0x39e6('0x24')];var _0x59c532;if(_0x2d9a98>=_0x47e94b){_0x2d9a98=_0x47e94b;_0x59c532=0xc8;}else{_0x59c532=0xce;}_0x18d076[_0x39e6('0x1f')](_0x59c532);return _0x18d076[_0x39e6('0x26')]('Content-Range',_0x445f12+'-'+_0x2d9a98+'/'+_0x47e94b)[_0x39e6('0x21')](_0x1a3adf);}return null;};}function patchUpdates(_0x1c626a){return function(_0x2e4890){try{jsonpatch[_0x39e6('0x27')](_0x2e4890,_0x1c626a,!![]);}catch(_0x314c7d){return BPromise[_0x39e6('0x28')](_0x314c7d);}return _0x2e4890[_0x39e6('0x29')]();};}function saveUpdates(_0x4619ee,_0x302f77){return function(_0x47704f){if(_0x47704f){return _0x47704f[_0x39e6('0x2a')](_0x4619ee)[_0x39e6('0x2b')](function(_0x3dce4d){return _0x3dce4d;});}return null;};}function removeEntity(_0x5102d8,_0x537462){return function(_0x5e45cd){if(_0x5e45cd){return _0x5e45cd['destroy']()[_0x39e6('0x2b')](function(){_0x5102d8[_0x39e6('0x1f')](0xcc)[_0x39e6('0x20')]();});}};}function handleEntityNotFound(_0x19f780,_0x5c0c2e){return function(_0x39de88){if(!_0x39de88){_0x19f780[_0x39e6('0x1e')](0x194);}return _0x39de88;};}function handleError(_0x59ea28,_0xdb9c93){_0xdb9c93=_0xdb9c93||0x1f4;return function(_0x1a60ae){logger['error'](_0x1a60ae[_0x39e6('0x2c')]);if(_0x1a60ae[_0x39e6('0x2d')]){delete _0x1a60ae[_0x39e6('0x2d')];}_0x59ea28[_0x39e6('0x1f')](_0xdb9c93)[_0x39e6('0x2e')](_0x1a60ae);};}exports['index']=function(_0x21fce8,_0x596d6f){var _0x355ad9={},_0x14c4d3={},_0x3db607={'count':0x0,'rows':[]};var _0x3c01e9=_[_0x39e6('0x2f')](db[_0x39e6('0x30')][_0x39e6('0x31')],function(_0x373f95){return{'name':_0x373f95[_0x39e6('0x32')],'type':_0x373f95[_0x39e6('0x33')][_0x39e6('0x34')]};});_0x14c4d3[_0x39e6('0x35')]=_[_0x39e6('0x2f')](_0x3c01e9,_0x39e6('0x2d'));_0x14c4d3[_0x39e6('0x36')]=_[_0x39e6('0x37')](_0x21fce8['query']);_0x14c4d3[_0x39e6('0x38')]=_[_0x39e6('0x39')](_0x14c4d3[_0x39e6('0x35')],_0x14c4d3['query']);_0x355ad9[_0x39e6('0x3a')]=_[_0x39e6('0x39')](_0x14c4d3[_0x39e6('0x35')],qs['fields'](_0x21fce8[_0x39e6('0x36')]['fields']));_0x355ad9[_0x39e6('0x3a')]=_0x355ad9[_0x39e6('0x3a')][_0x39e6('0x3b')]?_0x355ad9['attributes']:_0x14c4d3[_0x39e6('0x35')];if(!_0x21fce8[_0x39e6('0x36')][_0x39e6('0x3c')](_0x39e6('0x3d'))){_0x355ad9['limit']=qs['limit'](_0x21fce8[_0x39e6('0x36')][_0x39e6('0x24')]);_0x355ad9[_0x39e6('0x22')]=qs[_0x39e6('0x22')](_0x21fce8[_0x39e6('0x36')][_0x39e6('0x22')]);}_0x355ad9[_0x39e6('0x3e')]=qs['sort'](_0x21fce8[_0x39e6('0x36')]['sort']);_0x355ad9['where']=qs[_0x39e6('0x38')](_[_0x39e6('0x3f')](_0x21fce8[_0x39e6('0x36')],_0x14c4d3[_0x39e6('0x38')]),_0x3c01e9);if(_0x21fce8[_0x39e6('0x36')][_0x39e6('0x40')]){_0x355ad9[_0x39e6('0x41')]=_[_0x39e6('0x42')](_0x355ad9['where'],{'$or':_[_0x39e6('0x2f')](_0x3c01e9,function(_0x45c84d){if(_0x45c84d[_0x39e6('0x33')]!==_0x39e6('0x43')){var _0x2662da={};_0x2662da[_0x45c84d['name']]={'$like':'%'+_0x21fce8['query'][_0x39e6('0x40')]+'%'};return _0x2662da;}})});}_0x355ad9=_[_0x39e6('0x42')]({},_0x355ad9,_0x21fce8['options']);var _0x365b10={'where':_0x355ad9[_0x39e6('0x41')]};return db['UserProfile']['count'](_0x365b10)[_0x39e6('0x2b')](function(_0xd3342a){_0x3db607['count']=_0xd3342a;if(_0x21fce8[_0x39e6('0x36')][_0x39e6('0x44')]){_0x355ad9[_0x39e6('0x45')]=[{'all':!![]}];}return db[_0x39e6('0x30')][_0x39e6('0x46')](_0x355ad9);})[_0x39e6('0x2b')](function(_0x28397d){_0x3db607[_0x39e6('0x47')]=_0x28397d;return _0x3db607;})['then'](respondWithFilteredResult(_0x596d6f,_0x355ad9))[_0x39e6('0x48')](handleError(_0x596d6f,null));};exports[_0x39e6('0x49')]=function(_0x463355,_0x5660e0){var _0x520236={'raw':![],'where':{'id':_0x463355[_0x39e6('0x4a')]['id']}},_0x149463={};_0x149463[_0x39e6('0x35')]=_[_0x39e6('0x37')](db[_0x39e6('0x30')][_0x39e6('0x31')]);_0x149463[_0x39e6('0x36')]=_['keys'](_0x463355['query']);_0x149463['filters']=_[_0x39e6('0x39')](_0x149463['model'],_0x149463[_0x39e6('0x36')]);_0x520236[_0x39e6('0x3a')]=_[_0x39e6('0x39')](_0x149463[_0x39e6('0x35')],qs[_0x39e6('0x4b')](_0x463355[_0x39e6('0x36')][_0x39e6('0x4b')]));_0x520236[_0x39e6('0x3a')]=_0x520236[_0x39e6('0x3a')][_0x39e6('0x3b')]?_0x520236['attributes']:_0x149463[_0x39e6('0x35')];if(_0x463355[_0x39e6('0x36')][_0x39e6('0x44')]){_0x520236[_0x39e6('0x45')]=[{'all':!![]}];}_0x520236=_['merge']({},_0x520236,_0x463355['options']);return db[_0x39e6('0x30')]['find'](_0x520236)[_0x39e6('0x2b')](handleEntityNotFound(_0x5660e0,null))[_0x39e6('0x2b')](respondWithResult(_0x5660e0,null))['catch'](handleError(_0x5660e0,null));};exports[_0x39e6('0x4c')]=function(_0x2300b9,_0xabd04b){return db[_0x39e6('0x30')][_0x39e6('0x4c')](_0x2300b9[_0x39e6('0x4d')],{})[_0x39e6('0x2b')](respondWithResult(_0xabd04b,0xc9))[_0x39e6('0x48')](handleError(_0xabd04b,null));};exports[_0x39e6('0x4e')]=function(_0x1bb029,_0x389b8c){var _0x142c49={'where':{'id':_0x1bb029[_0x39e6('0x4a')]['id']}},_0xb468b9={};_0xb468b9[_0x39e6('0x35')]=_[_0x39e6('0x37')](db[_0x39e6('0x30')]['rawAttributes']);_0x142c49[_0x39e6('0x3a')]=_['intersection'](_0xb468b9['model'],qs['fields'](_0x1bb029[_0x39e6('0x36')][_0x39e6('0x4b')]));_0x142c49[_0x39e6('0x3a')]=_0x142c49['attributes']['length']?_0x142c49[_0x39e6('0x3a')]:_0xb468b9['model'];if(_0x1bb029[_0x39e6('0x36')][_0x39e6('0x44')]){_0x142c49[_0x39e6('0x45')]=[{'all':!![]}];}_0x142c49=_['merge']({},_0x142c49,_0x1bb029[_0x39e6('0x4f')]);return db[_0x39e6('0x30')]['find'](_0x142c49)[_0x39e6('0x2b')](handleEntityNotFound(_0x389b8c,null))['then'](function(_0x41bca3){if(_0x41bca3){var _0x257812=_0x41bca3[_0x39e6('0x50')]({'plain':!![]});_0x257812=qs['omit'](_0x257812,['id',_0x39e6('0x51'),_0x39e6('0x52'),_0x39e6('0x53')]);_0x1bb029[_0x39e6('0x4d')]=_['omit'](_0x1bb029[_0x39e6('0x4d')],['id',_0x39e6('0x51'),_0x39e6('0x52')]);return db['sequelize']['transaction'](function(_0x4c13a1){return db['UserProfile'][_0x39e6('0x4c')](_[_0x39e6('0x42')](_0x257812,_0x1bb029[_0x39e6('0x4d')]),{'include':_0x1bb029[_0x39e6('0x36')][_0x39e6('0x44')]?[{'all':!![]}]:undefined,'transaction':_0x4c13a1})[_0x39e6('0x2b')](function(_0x34ab5b){var _0xdd7c9a=_0x34ab5b['get']({'plain':!![]});return db[_0x39e6('0x54')]['findAll']({'where':{'userProfileId':_0x1bb029[_0x39e6('0x4a')]['id']},'raw':!![]})[_0x39e6('0x2b')](function(_0x28fe88){if(_0x28fe88){return BPromise[_0x39e6('0x55')](_0x28fe88,function(_0xbdf5e6){return new BPromise(function(_0x5d4298,_0x5ad7d5){if(_0xbdf5e6[_0x39e6('0x56')]===null||_0xbdf5e6[_0x39e6('0x56')]===0x1)_0x5d4298(null);return db[_0x39e6('0x57')]['findAll']({'where':{'sectionId':_0xbdf5e6['id']},'raw':!![]})[_0x39e6('0x2b')](function(_0x53d542){var _0x1d4cf5=_[_0x39e6('0x2f')](_0x53d542,function(_0x9abcb){return qs[_0x39e6('0x58')](_0x9abcb,['id',_0x39e6('0x51'),_0x39e6('0x52'),_0x39e6('0x59')]);});_0x5d4298(_0x1d4cf5);})[_0x39e6('0x48')](function(_0x14a611){_0x5ad7d5(_0x14a611);});})[_0x39e6('0x2b')](function(_0x42848a){var _0x252860=qs['omit'](_0xbdf5e6,['id',_0x39e6('0x51'),_0x39e6('0x52')]);_0x252860[_0x39e6('0x5a')]=_0xdd7c9a['id'];if(_0x42848a)_0x252860[_0x39e6('0x5b')]=_0x42848a;return _0x252860;})[_0x39e6('0x2b')](function(_0x420f60){return db[_0x39e6('0x54')]['create'](_0x420f60,{'include':[{'model':db['UserProfileResource'],'as':_0x39e6('0x5b')}],'raw':!![],'transaction':_0x4c13a1});});})[_0x39e6('0x2b')](function(){return _0xdd7c9a;});}});});});}})[_0x39e6('0x2b')](respondWithResult(_0x389b8c,0xc9))['catch'](handleError(_0x389b8c,null));};exports[_0x39e6('0x2a')]=function(_0x2d8863,_0x220ee7){if(_0x2d8863[_0x39e6('0x4d')]['id']){delete _0x2d8863[_0x39e6('0x4d')]['id'];}return db[_0x39e6('0x30')]['find']({'where':{'id':_0x2d8863[_0x39e6('0x4a')]['id']}})[_0x39e6('0x2b')](handleEntityNotFound(_0x220ee7,null))[_0x39e6('0x2b')](saveUpdates(_0x2d8863[_0x39e6('0x4d')],null))[_0x39e6('0x2b')](respondWithResult(_0x220ee7,null))[_0x39e6('0x48')](handleError(_0x220ee7,null));};exports['destroy']=function(_0x1dca0b,_0x21a7c1){return db[_0x39e6('0x30')][_0x39e6('0x5c')]({'where':{'id':_0x1dca0b[_0x39e6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x21a7c1,null))['then'](removeEntity(_0x21a7c1,null))[_0x39e6('0x48')](handleError(_0x21a7c1,null));};exports[_0x39e6('0x5d')]=function(_0x2d7093,_0x26fc05){return db[_0x39e6('0x30')][_0x39e6('0x5d')]()[_0x39e6('0x2b')](respondWithResult(_0x26fc05,null))[_0x39e6('0x48')](handleError(_0x26fc05,null));};exports[_0x39e6('0x5e')]=function(_0xc326cd,_0x1c7374){var _0x160bde=_0xc326cd['body'];return db[_0x39e6('0x30')][_0x39e6('0x5c')]({'where':{'id':_0xc326cd[_0x39e6('0x4a')]['id']}})[_0x39e6('0x2b')](handleEntityNotFound(_0x1c7374,null))[_0x39e6('0x2b')](function(_0x29a8c3){if(_0x29a8c3){return db['sequelize'][_0x39e6('0x5f')](function(_0x353145){return db[_0x39e6('0x54')][_0x39e6('0x60')]({'where':{'userProfileId':_0xc326cd['params']['id'],'sectionId':_[_0x39e6('0x2f')](_0x160bde,function(_0x14114c){return _0x14114c['sectionId'];})},'transaction':_0x353145})['then'](function(){var _0x13b076=_[_0x39e6('0x2f')](_0x160bde,function(_0x277a72){_0x277a72[_0x39e6('0x5a')]=_0xc326cd['params']['id'];return _0x277a72;});var _0x28b92d=[];return BPromise[_0x39e6('0x55')](_0x13b076,function(_0x343189){return db[_0x39e6('0x54')][_0x39e6('0x4c')](_0x343189,{'include':[{'model':db['UserProfileResource'],'as':_0x39e6('0x5b')}],'raw':!![],'transaction':_0x353145})[_0x39e6('0x2b')](function(_0x1b79b1){_0x28b92d[_0x39e6('0x61')](_0x1b79b1[_0x39e6('0x50')]({'plain':!![]}));});})[_0x39e6('0x2b')](function(){return _0x28b92d;});});});}})[_0x39e6('0x2b')](function(_0x8330f4){return _0x8330f4;})[_0x39e6('0x2b')](respondWithResult(_0x1c7374,null))[_0x39e6('0x48')](handleError(_0x1c7374,null));};exports[_0x39e6('0x62')]=function(_0x26d8b2,_0x2e8e45){var _0x5322e3;return db[_0x39e6('0x30')][_0x39e6('0x5c')]({'where':{'id':_0x26d8b2[_0x39e6('0x4a')]['id']},'attributes':['id',_0x39e6('0x2d')]})[_0x39e6('0x2b')](handleEntityNotFound(_0x2e8e45,null))['then'](function(_0x3bdd22){if(_0x3bdd22){_0x5322e3=_0x3bdd22;return db[_0x39e6('0x54')][_0x39e6('0x60')]({'where':{'userProfileId':_0x26d8b2['params']['id'],'sectionId':_0x26d8b2[_0x39e6('0x36')][_0x39e6('0x63')]}});}})[_0x39e6('0x2b')](function(){return _0x5322e3;})['then'](respondWithStatusCode(_0x2e8e45,null))[_0x39e6('0x48')](handleError(_0x2e8e45,null));};exports[_0x39e6('0x64')]=function(_0x34b1e5,_0xa44463){var _0x441ef2=[];var _0x43b233=[];return db[_0x39e6('0x54')][_0x39e6('0x46')]({'where':{'userProfileId':_0x34b1e5['params']['id']},'raw':!![]})[_0x39e6('0x2b')](function(_0x1915e9){_0x441ef2=_[_0x39e6('0x40')](_0x1915e9,function(_0x38a5ad){return _0x38a5ad[_0x39e6('0x65')]===0x1||_[_0x39e6('0x66')]([0x3eb,0x709],_0x38a5ad[_0x39e6('0x59')]);});if(!_[_0x39e6('0x67')](_0x441ef2)){return _[_0x39e6('0x2f')](_0x441ef2,function(_0xaa739e){return _0xaa739e[_0x39e6('0x59')];});}else{return;}})['then'](function(_0x4ac85f){if(_0x4ac85f)_0x43b233=_0x4ac85f;if(_['includes'](_0x43b233,0x64)){var _0x26e0cf=_[_0x39e6('0x5c')](_0x441ef2,{'sectionId':0x64});return hasDefaultDashboard(_0x26e0cf)[_0x39e6('0x2b')](function(_0x5f4d80){return _[_0x39e6('0x2f')](_0x441ef2,function(_0x1f8af9){if(_0x1f8af9[_0x39e6('0x59')]===0x64){_0x1f8af9[_0x39e6('0x68')]=_0x5f4d80;}return _0x1f8af9;});});}else{return;}})[_0x39e6('0x2b')](function(_0x3c09e9){if(_0x3c09e9)_0x441ef2=_0x3c09e9;if(_[_0x39e6('0x66')](_0x43b233,0x3eb)){var _0x2e9e62=_[_0x39e6('0x5c')](_0x441ef2,{'sectionId':0x3eb});return getCustomDashboards(_0x2e9e62)['then'](function(_0xf0447c){return _['map'](_0x441ef2,function(_0x2527aa){if(_0x2e9e62[_0x39e6('0x65')]){if(_0x2527aa['sectionId']===0x3eb){_0x2527aa[_0x39e6('0x68')]=_0xf0447c;}}else{if(_0x2527aa['sectionId']===0x64){_0x2527aa[_0x39e6('0x68')]=_0xf0447c;}}return _0x2527aa;});});}else{return;}})[_0x39e6('0x2b')](function(_0x38fd87){if(_0x38fd87)_0x441ef2=_0x38fd87;if(_[_0x39e6('0x66')](_0x43b233,0x709)){var _0x37479f=_['find'](_0x441ef2,{'sectionId':0x709});return getPlugins(_0x37479f)['then'](function(_0x4d81a9){if(_0x37479f[_0x39e6('0x65')]){return _[_0x39e6('0x2f')](_0x441ef2,function(_0x1a5a12){if(_0x1a5a12[_0x39e6('0x59')]===0x709){_0x1a5a12[_0x39e6('0x68')]=_0x4d81a9;}return _0x1a5a12;});}else{var _0x724011={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4d81a9};var _0xfb23e3=_['map'](_0x441ef2);_0xfb23e3[_0x39e6('0x61')](_0x724011);return _0xfb23e3;}});}else{return;}})[_0x39e6('0x2b')](function(_0x81dd41){if(_0x81dd41)_0x441ef2=_0x81dd41;return _[_0x39e6('0x40')](_0x441ef2,['enabled',0x1]);})[_0x39e6('0x2b')](respondWithResult(_0xa44463,null))[_0x39e6('0x48')](handleError(_0xa44463,null));};function hasDefaultDashboard(_0x479a61){var _0x40e98d=[0x65];return new BPromise(function(_0xc231ba,_0xb0f224){try{if(_0x479a61['autoAssociation']){_0xc231ba(_0x40e98d);}else{return db[_0x39e6('0x57')][_0x39e6('0x69')]({'where':{'sectionId':_0x479a61['id']},'raw':!![]})[_0x39e6('0x2b')](function(_0x4cb13a){_0x4cb13a?_0xc231ba(_0x40e98d):_0xc231ba();});}}catch(_0x515b46){_0xb0f224(_0x515b46);}});}function getCustomDashboards(_0x33b774){var _0x54794e=[];return new BPromise(function(_0x22183d,_0x404413){try{if(_0x33b774['autoAssociation']){return db[_0x39e6('0x6a')]['findAll']({'raw':!![]})['then'](function(_0x1acc91){_0x1acc91[_0x39e6('0x6b')](function(_0x3f62df){_0x54794e['push'](_0x3f62df['id']+0x1869f);});_0x22183d(_0x54794e);});}else{return db[_0x39e6('0x57')][_0x39e6('0x46')]({'where':{'sectionId':_0x33b774['id']},'raw':!![]})[_0x39e6('0x2b')](function(_0x4cdddf){_0x4cdddf[_0x39e6('0x6b')](function(_0x303599){_0x54794e[_0x39e6('0x61')](_0x303599['resourceId']+0x1869f);});_0x22183d(_0x54794e);});}}catch(_0x51e679){_0x404413(_0x51e679);}});}function getPlugins(_0xe0c7a7){var _0x58ed0a=[];return new BPromise(function(_0x1872e3,_0x3fc990){try{if(_0xe0c7a7[_0x39e6('0x56')]){return db[_0x39e6('0x6c')][_0x39e6('0x46')]({'raw':!![]})[_0x39e6('0x2b')](function(_0x316a2b){_0x316a2b[_0x39e6('0x6b')](function(_0x5e5f8f){_0x58ed0a[_0x39e6('0x61')](_0x5e5f8f['id']+0x15b38);});_0x1872e3(_0x58ed0a);});}else{return db['UserProfileResource'][_0x39e6('0x46')]({'where':{'sectionId':_0xe0c7a7['id']},'raw':!![]})['then'](function(_0x265a09){_0x265a09[_0x39e6('0x6b')](function(_0x35d5e2){_0x58ed0a['push'](_0x35d5e2['resourceId']+0x15b38);});_0x1872e3(_0x58ed0a);});}}catch(_0x41db63){_0x3fc990(_0x41db63);}});}exports[_0x39e6('0x6d')]=function(_0x2aa212,_0x32e967){return db['UserProfile']['find']({'where':{'id':_0x2aa212[_0x39e6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x32e967,null))[_0x39e6('0x2b')](function(_0x363d83){if(_0x363d83){return db[_0x39e6('0x6e')][_0x39e6('0x5f')](function(_0x4b62e2){return db[_0x39e6('0x54')][_0x39e6('0x46')]({'where':{'userProfileId':_0x2aa212[_0x39e6('0x4a')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x48c9ae){if(_0x48c9ae){return db['UserProfileSection'][_0x39e6('0x60')]({'where':{'userProfileId':_0x2aa212[_0x39e6('0x4a')]['id'],'id':_[_0x39e6('0x2f')](_0x48c9ae,function(_0xd70298){return _0xd70298['id'];})},'transaction':_0x4b62e2});}})['then'](function(_0x32cf3a){var _0x38c744=_[_0x39e6('0x2f')](_0x2aa212['body'],function(_0x30da4e){_0x30da4e[_0x39e6('0x5a')]=_0x2aa212['params']['id'];return _0x30da4e;});return db['UserProfileSection'][_0x39e6('0x6f')](_0x38c744,{'raw':!![],'transaction':_0x4b62e2});})['then'](function(_0x1cadd0){var _0x24edee=_['filter'](_[_0x39e6('0x2f')](_0x1cadd0,function(_0x38e3df){return _0x38e3df['get']({'plain':!![]});}),{'includeAll':![]});if(_0x24edee){return db[_0x39e6('0x54')][_0x39e6('0x46')]({'where':{'userProfileId':_0x2aa212[_0x39e6('0x4a')]['id'],'sectionId':_[_0x39e6('0x2f')](_0x24edee,function(_0x23e38d){return _0x23e38d[_0x39e6('0x59')];})},'attributes':['id','sectionId'],'raw':!![]})['then'](function(_0x1e3250){var _0x30cf71=_[_0x39e6('0x2f')](_0x2aa212[_0x39e6('0x4d')],function(_0x39cc58){_0x39cc58['userProfileId']=_0x2aa212['params']['id'];return _0x39cc58;});return db[_0x39e6('0x57')][_0x39e6('0x6f')](_0x30cf71,{'raw':!![],'transaction':_0x4b62e2});});}})['catch'](handleError(_0x32e967,null));});}})[_0x39e6('0x2b')](function(_0x5188c1){var _0x21b89d=_[_0x39e6('0x2f')](_0x5188c1,function(_0x4e4710){return _0x4e4710['get']({'plain':!![]});});})[_0x39e6('0x2b')](respondWithResult(_0x32e967,null))[_0x39e6('0x48')](handleError(_0x32e967,null));};exports['removeResources']=function(_0x24710a,_0x169b77,_0x333563){return db['UserProfile'][_0x39e6('0x5c')]({'where':{'id':_0x24710a['params']['id']}})[_0x39e6('0x2b')](handleEntityNotFound(_0x169b77,null))[_0x39e6('0x2b')](function(_0x168475){if(_0x168475){return _0x168475[_0x39e6('0x70')](_0x24710a['query']['ids']);}})[_0x39e6('0x2b')](respondWithStatusCode(_0x169b77,null))[_0x39e6('0x48')](handleError(_0x169b77,null));};exports[_0x39e6('0x71')]=function(_0x40cf76,_0x10c7bc){var _0x468bd5={};if(!_0x40cf76[_0x39e6('0x36')][_0x39e6('0x72')])throw new Error(_0x39e6('0x73'));if(!_0x40cf76[_0x39e6('0x36')]['hasOwnProperty'](_0x39e6('0x3d'))){_0x468bd5[_0x39e6('0x24')]=qs[_0x39e6('0x24')](_0x40cf76[_0x39e6('0x36')][_0x39e6('0x24')]);_0x468bd5['offset']=qs['offset'](_0x40cf76[_0x39e6('0x36')]['offset']);}return db[_0x39e6('0x30')][_0x39e6('0x5c')]({'where':{'id':_0x40cf76[_0x39e6('0x4a')]['id']}})[_0x39e6('0x2b')](function(_0x448a43){if(!_0x448a43)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x40cf76[_0x39e6('0x4a')]['id']);return db[_0x39e6('0x30')][_0x39e6('0x71')](_0x40cf76);})[_0x39e6('0x2b')](respondWithFilteredResult(_0x10c7bc,_0x468bd5))[_0x39e6('0x48')](handleError(_0x10c7bc,null));}; \ No newline at end of file +var _0x7ea9=['Resources','update','describe','addSections','sequelize','each','push','ids','getSections','enabled','includes','subsections','Dashboard','forEach','resourceId','addResources','bulkCreate','removeResources','getResources','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','destroy','end','error','name','index','map','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','get','omit','updatedAt','transaction','UserProfileSection','autoAssociation','UserProfileResource','createdAt','sectionId','userProfileId'];(function(_0x28ddbe,_0x10af0a){var _0x25de13=function(_0x5800fc){while(--_0x5800fc){_0x28ddbe['push'](_0x28ddbe['shift']());}};_0x25de13(++_0x10af0a);}(_0x7ea9,0xec));var _0x97ea=function(_0x52375b,_0x3e1527){_0x52375b=_0x52375b-0x0;var _0x4b6c6b=_0x7ea9[_0x52375b];return _0x4b6c6b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x97ea('0x0'));var zipdir=require(_0x97ea('0x1'));var jsonpatch=require(_0x97ea('0x2'));var rp=require(_0x97ea('0x3'));var moment=require(_0x97ea('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x97ea('0x5'));var util=require(_0x97ea('0x6'));var path=require(_0x97ea('0x7'));var sox=require('sox');var csv=require(_0x97ea('0x8'));var ejs=require(_0x97ea('0x9'));var fs=require('fs');var fs_extra=require(_0x97ea('0xa'));var _=require(_0x97ea('0xb'));var squel=require('squel');var crypto=require(_0x97ea('0xc'));var jsforce=require(_0x97ea('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x97ea('0x8'));var querystring=require('querystring');var Papa=require(_0x97ea('0xe'));var Redis=require('ioredis');var authService=require(_0x97ea('0xf'));var qs=require(_0x97ea('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x97ea('0x11'));var logger=require(_0x97ea('0x12'))(_0x97ea('0x13'));var utils=require(_0x97ea('0x14'));var config=require(_0x97ea('0x15'));var licenseUtil=require(_0x97ea('0x16'));var db=require(_0x97ea('0x17'))['db'];config[_0x97ea('0x18')]=_[_0x97ea('0x19')](config[_0x97ea('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x97ea('0x1a'))(new Redis(config[_0x97ea('0x18')]));require('./userProfile.socket')[_0x97ea('0x1b')](socket);function respondWithStatusCode(_0x2879fd,_0x3b8555){_0x3b8555=_0x3b8555||0xcc;return function(_0x4af588){if(_0x4af588){return _0x2879fd[_0x97ea('0x1c')](_0x3b8555);}return _0x2879fd[_0x97ea('0x1d')](_0x3b8555)['end']();};}function respondWithResult(_0x68b624,_0x492065){_0x492065=_0x492065||0xc8;return function(_0x2eb7b7){if(_0x2eb7b7){return _0x68b624[_0x97ea('0x1d')](_0x492065)[_0x97ea('0x1e')](_0x2eb7b7);}};}function respondWithFilteredResult(_0x391664,_0x2388fb){return function(_0x2e9f07){if(_0x2e9f07){var _0x228c13=typeof _0x2388fb['offset']===_0x97ea('0x1f')&&typeof _0x2388fb[_0x97ea('0x20')]===_0x97ea('0x1f');var _0x28149a=_0x2e9f07[_0x97ea('0x21')];var _0x3577de=_0x228c13?0x0:_0x2388fb[_0x97ea('0x22')];var _0x36771=_0x228c13?_0x2e9f07[_0x97ea('0x21')]:_0x2388fb[_0x97ea('0x22')]+_0x2388fb[_0x97ea('0x20')];var _0x3c0c42;if(_0x36771>=_0x28149a){_0x36771=_0x28149a;_0x3c0c42=0xc8;}else{_0x3c0c42=0xce;}_0x391664['status'](_0x3c0c42);return _0x391664[_0x97ea('0x23')](_0x97ea('0x24'),_0x3577de+'-'+_0x36771+'/'+_0x28149a)['json'](_0x2e9f07);}return null;};}function patchUpdates(_0x10a3cf){return function(_0x1b8e10){try{jsonpatch['apply'](_0x1b8e10,_0x10a3cf,!![]);}catch(_0x5a7e85){return BPromise[_0x97ea('0x25')](_0x5a7e85);}return _0x1b8e10[_0x97ea('0x26')]();};}function saveUpdates(_0x22a8e0,_0x40e3ac){return function(_0x30ca93){if(_0x30ca93){return _0x30ca93['update'](_0x22a8e0)[_0x97ea('0x27')](function(_0x29e9e){return _0x29e9e;});}return null;};}function removeEntity(_0x55bc91,_0x55da9e){return function(_0xaf7d7){if(_0xaf7d7){return _0xaf7d7[_0x97ea('0x28')]()[_0x97ea('0x27')](function(){_0x55bc91[_0x97ea('0x1d')](0xcc)[_0x97ea('0x29')]();});}};}function handleEntityNotFound(_0x8ec503,_0x34158f){return function(_0x32b300){if(!_0x32b300){_0x8ec503[_0x97ea('0x1c')](0x194);}return _0x32b300;};}function handleError(_0x436613,_0x2b947c){_0x2b947c=_0x2b947c||0x1f4;return function(_0x1d1a15){logger[_0x97ea('0x2a')](_0x1d1a15['stack']);if(_0x1d1a15[_0x97ea('0x2b')]){delete _0x1d1a15[_0x97ea('0x2b')];}_0x436613['status'](_0x2b947c)['send'](_0x1d1a15);};}exports[_0x97ea('0x2c')]=function(_0x321bd1,_0x41af05){var _0x240b94={},_0x36956f={},_0xdb2f0e={'count':0x0,'rows':[]};var _0x299ae9=_[_0x97ea('0x2d')](db[_0x97ea('0x2e')][_0x97ea('0x2f')],function(_0x144d22){return{'name':_0x144d22[_0x97ea('0x30')],'type':_0x144d22[_0x97ea('0x31')][_0x97ea('0x32')]};});_0x36956f[_0x97ea('0x33')]=_[_0x97ea('0x2d')](_0x299ae9,'name');_0x36956f[_0x97ea('0x34')]=_[_0x97ea('0x35')](_0x321bd1['query']);_0x36956f[_0x97ea('0x36')]=_[_0x97ea('0x37')](_0x36956f[_0x97ea('0x33')],_0x36956f[_0x97ea('0x34')]);_0x240b94['attributes']=_['intersection'](_0x36956f[_0x97ea('0x33')],qs[_0x97ea('0x38')](_0x321bd1[_0x97ea('0x34')][_0x97ea('0x38')]));_0x240b94[_0x97ea('0x39')]=_0x240b94[_0x97ea('0x39')]['length']?_0x240b94[_0x97ea('0x39')]:_0x36956f[_0x97ea('0x33')];if(!_0x321bd1['query'][_0x97ea('0x3a')](_0x97ea('0x3b'))){_0x240b94[_0x97ea('0x20')]=qs['limit'](_0x321bd1[_0x97ea('0x34')][_0x97ea('0x20')]);_0x240b94[_0x97ea('0x22')]=qs['offset'](_0x321bd1['query'][_0x97ea('0x22')]);}_0x240b94[_0x97ea('0x3c')]=qs[_0x97ea('0x3d')](_0x321bd1[_0x97ea('0x34')]['sort']);_0x240b94[_0x97ea('0x3e')]=qs[_0x97ea('0x36')](_[_0x97ea('0x3f')](_0x321bd1[_0x97ea('0x34')],_0x36956f[_0x97ea('0x36')]),_0x299ae9);if(_0x321bd1[_0x97ea('0x34')][_0x97ea('0x40')]){_0x240b94[_0x97ea('0x3e')]=_[_0x97ea('0x41')](_0x240b94['where'],{'$or':_[_0x97ea('0x2d')](_0x299ae9,function(_0x656d01){if(_0x656d01[_0x97ea('0x31')]!==_0x97ea('0x42')){var _0xd59d5a={};_0xd59d5a[_0x656d01[_0x97ea('0x2b')]]={'$like':'%'+_0x321bd1[_0x97ea('0x34')]['filter']+'%'};return _0xd59d5a;}})});}_0x240b94=_[_0x97ea('0x41')]({},_0x240b94,_0x321bd1[_0x97ea('0x43')]);var _0x4b291e={'where':_0x240b94[_0x97ea('0x3e')]};return db['UserProfile'][_0x97ea('0x21')](_0x4b291e)[_0x97ea('0x27')](function(_0x155571){_0xdb2f0e[_0x97ea('0x21')]=_0x155571;if(_0x321bd1[_0x97ea('0x34')][_0x97ea('0x44')]){_0x240b94[_0x97ea('0x45')]=[{'all':!![]}];}return db[_0x97ea('0x2e')][_0x97ea('0x46')](_0x240b94);})[_0x97ea('0x27')](function(_0x378e38){_0xdb2f0e[_0x97ea('0x47')]=_0x378e38;return _0xdb2f0e;})[_0x97ea('0x27')](respondWithFilteredResult(_0x41af05,_0x240b94))[_0x97ea('0x48')](handleError(_0x41af05,null));};exports[_0x97ea('0x49')]=function(_0x20c3fd,_0x4cec70){var _0x1b2c58={'raw':![],'where':{'id':_0x20c3fd['params']['id']}},_0x594d21={};_0x594d21[_0x97ea('0x33')]=_[_0x97ea('0x35')](db[_0x97ea('0x2e')][_0x97ea('0x2f')]);_0x594d21[_0x97ea('0x34')]=_[_0x97ea('0x35')](_0x20c3fd[_0x97ea('0x34')]);_0x594d21[_0x97ea('0x36')]=_[_0x97ea('0x37')](_0x594d21[_0x97ea('0x33')],_0x594d21['query']);_0x1b2c58[_0x97ea('0x39')]=_[_0x97ea('0x37')](_0x594d21[_0x97ea('0x33')],qs[_0x97ea('0x38')](_0x20c3fd[_0x97ea('0x34')][_0x97ea('0x38')]));_0x1b2c58[_0x97ea('0x39')]=_0x1b2c58[_0x97ea('0x39')]['length']?_0x1b2c58[_0x97ea('0x39')]:_0x594d21[_0x97ea('0x33')];if(_0x20c3fd[_0x97ea('0x34')][_0x97ea('0x44')]){_0x1b2c58[_0x97ea('0x45')]=[{'all':!![]}];}_0x1b2c58=_[_0x97ea('0x41')]({},_0x1b2c58,_0x20c3fd['options']);return db[_0x97ea('0x2e')][_0x97ea('0x4a')](_0x1b2c58)[_0x97ea('0x27')](handleEntityNotFound(_0x4cec70,null))[_0x97ea('0x27')](respondWithResult(_0x4cec70,null))[_0x97ea('0x48')](handleError(_0x4cec70,null));};exports[_0x97ea('0x4b')]=function(_0x57f7ec,_0x84e717){return db[_0x97ea('0x2e')][_0x97ea('0x4b')](_0x57f7ec[_0x97ea('0x4c')],{})[_0x97ea('0x27')](respondWithResult(_0x84e717,0xc9))['catch'](handleError(_0x84e717,null));};exports['clone']=function(_0x353021,_0x50086a){var _0x4630c5={'where':{'id':_0x353021[_0x97ea('0x4d')]['id']}},_0x2c0fe7={};_0x2c0fe7[_0x97ea('0x33')]=_[_0x97ea('0x35')](db[_0x97ea('0x2e')][_0x97ea('0x2f')]);_0x4630c5['attributes']=_[_0x97ea('0x37')](_0x2c0fe7[_0x97ea('0x33')],qs[_0x97ea('0x38')](_0x353021[_0x97ea('0x34')][_0x97ea('0x38')]));_0x4630c5[_0x97ea('0x39')]=_0x4630c5[_0x97ea('0x39')]['length']?_0x4630c5['attributes']:_0x2c0fe7['model'];if(_0x353021[_0x97ea('0x34')][_0x97ea('0x44')]){_0x4630c5[_0x97ea('0x45')]=[{'all':!![]}];}_0x4630c5=_[_0x97ea('0x41')]({},_0x4630c5,_0x353021[_0x97ea('0x43')]);return db[_0x97ea('0x2e')][_0x97ea('0x4a')](_0x4630c5)[_0x97ea('0x27')](handleEntityNotFound(_0x50086a,null))[_0x97ea('0x27')](function(_0x2d484e){if(_0x2d484e){var _0x111128=_0x2d484e[_0x97ea('0x4e')]({'plain':!![]});_0x111128=qs[_0x97ea('0x4f')](_0x111128,['id','createdAt',_0x97ea('0x50'),'crudPermissions']);_0x353021[_0x97ea('0x4c')]=_[_0x97ea('0x4f')](_0x353021['body'],['id','createdAt',_0x97ea('0x50')]);return db['sequelize'][_0x97ea('0x51')](function(_0x5f42f3){return db[_0x97ea('0x2e')][_0x97ea('0x4b')](_[_0x97ea('0x41')](_0x111128,_0x353021[_0x97ea('0x4c')]),{'include':_0x353021[_0x97ea('0x34')][_0x97ea('0x44')]?[{'all':!![]}]:undefined,'transaction':_0x5f42f3})[_0x97ea('0x27')](function(_0x2f83d1){var _0x2116b0=_0x2f83d1['get']({'plain':!![]});return db[_0x97ea('0x52')][_0x97ea('0x46')]({'where':{'userProfileId':_0x353021['params']['id']},'raw':!![]})[_0x97ea('0x27')](function(_0xaceb00){if(_0xaceb00){return BPromise['each'](_0xaceb00,function(_0x4efae7){return new BPromise(function(_0x4a7a47,_0x18b7e6){if(_0x4efae7[_0x97ea('0x53')]===null||_0x4efae7[_0x97ea('0x53')]===0x1)_0x4a7a47(null);return db[_0x97ea('0x54')]['findAll']({'where':{'sectionId':_0x4efae7['id']},'raw':!![]})[_0x97ea('0x27')](function(_0x2cc6f2){var _0x5982b2=_[_0x97ea('0x2d')](_0x2cc6f2,function(_0x21ada7){return qs[_0x97ea('0x4f')](_0x21ada7,['id',_0x97ea('0x55'),_0x97ea('0x50'),_0x97ea('0x56')]);});_0x4a7a47(_0x5982b2);})[_0x97ea('0x48')](function(_0x11ccbb){_0x18b7e6(_0x11ccbb);});})[_0x97ea('0x27')](function(_0xc8fdf7){var _0x3b8184=qs[_0x97ea('0x4f')](_0x4efae7,['id','createdAt',_0x97ea('0x50')]);_0x3b8184[_0x97ea('0x57')]=_0x2116b0['id'];if(_0xc8fdf7)_0x3b8184[_0x97ea('0x58')]=_0xc8fdf7;return _0x3b8184;})[_0x97ea('0x27')](function(_0x4c78ae){return db[_0x97ea('0x52')]['create'](_0x4c78ae,{'include':[{'model':db[_0x97ea('0x54')],'as':_0x97ea('0x58')}],'raw':!![],'transaction':_0x5f42f3});});})[_0x97ea('0x27')](function(){return _0x2116b0;});}});});});}})[_0x97ea('0x27')](respondWithResult(_0x50086a,0xc9))['catch'](handleError(_0x50086a,null));};exports[_0x97ea('0x59')]=function(_0x5256b9,_0x1b8371){if(_0x5256b9[_0x97ea('0x4c')]['id']){delete _0x5256b9[_0x97ea('0x4c')]['id'];}return db[_0x97ea('0x2e')][_0x97ea('0x4a')]({'where':{'id':_0x5256b9[_0x97ea('0x4d')]['id']}})[_0x97ea('0x27')](handleEntityNotFound(_0x1b8371,null))['then'](saveUpdates(_0x5256b9[_0x97ea('0x4c')],null))['then'](respondWithResult(_0x1b8371,null))['catch'](handleError(_0x1b8371,null));};exports['destroy']=function(_0x31e45d,_0x3e6aa9){return db['UserProfile'][_0x97ea('0x4a')]({'where':{'id':_0x31e45d['params']['id']}})[_0x97ea('0x27')](handleEntityNotFound(_0x3e6aa9,null))['then'](removeEntity(_0x3e6aa9,null))[_0x97ea('0x48')](handleError(_0x3e6aa9,null));};exports[_0x97ea('0x5a')]=function(_0x2e00ed,_0x3b14f4){return db['UserProfile'][_0x97ea('0x5a')]()[_0x97ea('0x27')](respondWithResult(_0x3b14f4,null))[_0x97ea('0x48')](handleError(_0x3b14f4,null));};exports[_0x97ea('0x5b')]=function(_0x5d9e88,_0x196ffa){var _0x3c986f=_0x5d9e88['body'];return db[_0x97ea('0x2e')]['find']({'where':{'id':_0x5d9e88[_0x97ea('0x4d')]['id']}})[_0x97ea('0x27')](handleEntityNotFound(_0x196ffa,null))[_0x97ea('0x27')](function(_0x36eb13){if(_0x36eb13){return db[_0x97ea('0x5c')][_0x97ea('0x51')](function(_0x361a6d){return db[_0x97ea('0x52')][_0x97ea('0x28')]({'where':{'userProfileId':_0x5d9e88[_0x97ea('0x4d')]['id'],'sectionId':_[_0x97ea('0x2d')](_0x3c986f,function(_0x1a8d2b){return _0x1a8d2b['sectionId'];})},'transaction':_0x361a6d})[_0x97ea('0x27')](function(){var _0x4dec21=_[_0x97ea('0x2d')](_0x3c986f,function(_0x29ad6d){_0x29ad6d[_0x97ea('0x57')]=_0x5d9e88[_0x97ea('0x4d')]['id'];return _0x29ad6d;});var _0x3f06ce=[];return BPromise[_0x97ea('0x5d')](_0x4dec21,function(_0x15eb83){return db[_0x97ea('0x52')][_0x97ea('0x4b')](_0x15eb83,{'include':[{'model':db[_0x97ea('0x54')],'as':_0x97ea('0x58')}],'raw':!![],'transaction':_0x361a6d})[_0x97ea('0x27')](function(_0x301d70){_0x3f06ce[_0x97ea('0x5e')](_0x301d70[_0x97ea('0x4e')]({'plain':!![]}));});})[_0x97ea('0x27')](function(){return _0x3f06ce;});});});}})[_0x97ea('0x27')](function(_0x2a7c4b){return _0x2a7c4b;})['then'](respondWithResult(_0x196ffa,null))['catch'](handleError(_0x196ffa,null));};exports['removeSections']=function(_0x307a42,_0x236349){var _0x59d48e;return db[_0x97ea('0x2e')]['find']({'where':{'id':_0x307a42[_0x97ea('0x4d')]['id']},'attributes':['id',_0x97ea('0x2b')]})[_0x97ea('0x27')](handleEntityNotFound(_0x236349,null))[_0x97ea('0x27')](function(_0x45557b){if(_0x45557b){_0x59d48e=_0x45557b;return db[_0x97ea('0x52')]['destroy']({'where':{'userProfileId':_0x307a42['params']['id'],'sectionId':_0x307a42['query'][_0x97ea('0x5f')]}});}})[_0x97ea('0x27')](function(){return _0x59d48e;})['then'](respondWithStatusCode(_0x236349,null))[_0x97ea('0x48')](handleError(_0x236349,null));};exports[_0x97ea('0x60')]=function(_0x16fe8b,_0x57565f){var _0x2c6f7b=[];var _0x30af0e=[];return db[_0x97ea('0x52')][_0x97ea('0x46')]({'where':{'userProfileId':_0x16fe8b['params']['id']},'raw':!![]})[_0x97ea('0x27')](function(_0x3ebdcc){_0x2c6f7b=_[_0x97ea('0x40')](_0x3ebdcc,function(_0x45dae5){return _0x45dae5[_0x97ea('0x61')]===0x1||_[_0x97ea('0x62')]([0x3eb,0x709],_0x45dae5[_0x97ea('0x56')]);});if(!_['isEmpty'](_0x2c6f7b)){return _['map'](_0x2c6f7b,function(_0x2e6b68){return _0x2e6b68['sectionId'];});}else{return;}})[_0x97ea('0x27')](function(_0x5699ff){if(_0x5699ff)_0x30af0e=_0x5699ff;if(_['includes'](_0x30af0e,0x64)){var _0x304a31=_[_0x97ea('0x4a')](_0x2c6f7b,{'sectionId':0x64});return hasDefaultDashboard(_0x304a31)[_0x97ea('0x27')](function(_0x2ba761){return _['map'](_0x2c6f7b,function(_0x1f670f){if(_0x1f670f[_0x97ea('0x56')]===0x64){_0x1f670f[_0x97ea('0x63')]=_0x2ba761;}return _0x1f670f;});});}else{return;}})[_0x97ea('0x27')](function(_0xfa9f4c){if(_0xfa9f4c)_0x2c6f7b=_0xfa9f4c;if(_[_0x97ea('0x62')](_0x30af0e,0x3eb)){var _0x16d821=_['find'](_0x2c6f7b,{'sectionId':0x3eb});return getCustomDashboards(_0x16d821)['then'](function(_0x5048c6){return _[_0x97ea('0x2d')](_0x2c6f7b,function(_0x2e6ab5){if(_0x16d821[_0x97ea('0x61')]){if(_0x2e6ab5[_0x97ea('0x56')]===0x3eb){_0x2e6ab5[_0x97ea('0x63')]=_0x5048c6;}}else{if(_0x2e6ab5[_0x97ea('0x56')]===0x64){_0x2e6ab5[_0x97ea('0x63')]=_0x5048c6;}}return _0x2e6ab5;});});}else{return;}})[_0x97ea('0x27')](function(_0x7325fe){if(_0x7325fe)_0x2c6f7b=_0x7325fe;if(_[_0x97ea('0x62')](_0x30af0e,0x709)){var _0x42d63b=_['find'](_0x2c6f7b,{'sectionId':0x709});return getPlugins(_0x42d63b)[_0x97ea('0x27')](function(_0xdec274){if(_0x42d63b['enabled']){return _[_0x97ea('0x2d')](_0x2c6f7b,function(_0x223d20){if(_0x223d20[_0x97ea('0x56')]===0x709){_0x223d20[_0x97ea('0x63')]=_0xdec274;}return _0x223d20;});}else{var _0x9cf81d={'sectionId':0x76c,'enabled':0x1,'subsections':_0xdec274};var _0x39196c=_['map'](_0x2c6f7b);_0x39196c['push'](_0x9cf81d);return _0x39196c;}});}else{return;}})[_0x97ea('0x27')](function(_0x227747){if(_0x227747)_0x2c6f7b=_0x227747;return _[_0x97ea('0x40')](_0x2c6f7b,[_0x97ea('0x61'),0x1]);})[_0x97ea('0x27')](respondWithResult(_0x57565f,null))[_0x97ea('0x48')](handleError(_0x57565f,null));};function hasDefaultDashboard(_0x3917bc){var _0x2e04b3=[0x65];return new BPromise(function(_0x2d24ef,_0x21c8bf){try{if(_0x3917bc[_0x97ea('0x53')]){_0x2d24ef(_0x2e04b3);}else{return db[_0x97ea('0x54')]['findOne']({'where':{'sectionId':_0x3917bc['id']},'raw':!![]})[_0x97ea('0x27')](function(_0x33d9a3){_0x33d9a3?_0x2d24ef(_0x2e04b3):_0x2d24ef();});}}catch(_0x5db1bd){_0x21c8bf(_0x5db1bd);}});}function getCustomDashboards(_0xce0f34){var _0xb84e6b=[];return new BPromise(function(_0x22e157,_0x5e3892){try{if(_0xce0f34['autoAssociation']){return db[_0x97ea('0x64')]['findAll']({'raw':!![]})[_0x97ea('0x27')](function(_0x58ded4){_0x58ded4['forEach'](function(_0x540a2a){_0xb84e6b[_0x97ea('0x5e')](_0x540a2a['id']+0x1869f);});_0x22e157(_0xb84e6b);});}else{return db[_0x97ea('0x54')][_0x97ea('0x46')]({'where':{'sectionId':_0xce0f34['id']},'raw':!![]})[_0x97ea('0x27')](function(_0x1ff65d){_0x1ff65d[_0x97ea('0x65')](function(_0x231e73){_0xb84e6b[_0x97ea('0x5e')](_0x231e73[_0x97ea('0x66')]+0x1869f);});_0x22e157(_0xb84e6b);});}}catch(_0x249471){_0x5e3892(_0x249471);}});}function getPlugins(_0x356096){var _0x48ed2d=[];return new BPromise(function(_0x6c81a8,_0x27774f){try{if(_0x356096[_0x97ea('0x53')]){return db['Plugin']['findAll']({'raw':!![]})[_0x97ea('0x27')](function(_0x8cc107){_0x8cc107['forEach'](function(_0x5f363e){_0x48ed2d[_0x97ea('0x5e')](_0x5f363e['id']+0x15b38);});_0x6c81a8(_0x48ed2d);});}else{return db[_0x97ea('0x54')][_0x97ea('0x46')]({'where':{'sectionId':_0x356096['id']},'raw':!![]})[_0x97ea('0x27')](function(_0x9b2173){_0x9b2173['forEach'](function(_0x3adf99){_0x48ed2d[_0x97ea('0x5e')](_0x3adf99['resourceId']+0x15b38);});_0x6c81a8(_0x48ed2d);});}}catch(_0x3f41a6){_0x27774f(_0x3f41a6);}});}exports[_0x97ea('0x67')]=function(_0x6b7497,_0x3edd03){return db[_0x97ea('0x2e')][_0x97ea('0x4a')]({'where':{'id':_0x6b7497[_0x97ea('0x4d')]['id']}})[_0x97ea('0x27')](handleEntityNotFound(_0x3edd03,null))[_0x97ea('0x27')](function(_0x5a7df1){if(_0x5a7df1){return db[_0x97ea('0x5c')]['transaction'](function(_0x44a895){return db[_0x97ea('0x52')][_0x97ea('0x46')]({'where':{'userProfileId':_0x6b7497[_0x97ea('0x4d')]['id']},'attributes':['id'],'raw':!![]})[_0x97ea('0x27')](function(_0x5ec94e){if(_0x5ec94e){return db['UserProfileSection'][_0x97ea('0x28')]({'where':{'userProfileId':_0x6b7497[_0x97ea('0x4d')]['id'],'id':_[_0x97ea('0x2d')](_0x5ec94e,function(_0x5e8c35){return _0x5e8c35['id'];})},'transaction':_0x44a895});}})[_0x97ea('0x27')](function(_0x229db6){var _0x278029=_[_0x97ea('0x2d')](_0x6b7497[_0x97ea('0x4c')],function(_0x17a2f8){_0x17a2f8['userProfileId']=_0x6b7497['params']['id'];return _0x17a2f8;});return db[_0x97ea('0x52')][_0x97ea('0x68')](_0x278029,{'raw':!![],'transaction':_0x44a895});})[_0x97ea('0x27')](function(_0x5afeca){var _0x431e59=_[_0x97ea('0x40')](_[_0x97ea('0x2d')](_0x5afeca,function(_0x1a08fa){return _0x1a08fa[_0x97ea('0x4e')]({'plain':!![]});}),{'includeAll':![]});if(_0x431e59){return db[_0x97ea('0x52')][_0x97ea('0x46')]({'where':{'userProfileId':_0x6b7497[_0x97ea('0x4d')]['id'],'sectionId':_[_0x97ea('0x2d')](_0x431e59,function(_0x4b2303){return _0x4b2303[_0x97ea('0x56')];})},'attributes':['id',_0x97ea('0x56')],'raw':!![]})[_0x97ea('0x27')](function(_0xcf7e2){var _0x56c17c=_[_0x97ea('0x2d')](_0x6b7497[_0x97ea('0x4c')],function(_0x743750){_0x743750[_0x97ea('0x57')]=_0x6b7497['params']['id'];return _0x743750;});return db['UserProfileResource'][_0x97ea('0x68')](_0x56c17c,{'raw':!![],'transaction':_0x44a895});});}})[_0x97ea('0x48')](handleError(_0x3edd03,null));});}})[_0x97ea('0x27')](function(_0x4672ef){var _0x53857e=_['map'](_0x4672ef,function(_0x34137b){return _0x34137b[_0x97ea('0x4e')]({'plain':!![]});});})[_0x97ea('0x27')](respondWithResult(_0x3edd03,null))[_0x97ea('0x48')](handleError(_0x3edd03,null));};exports[_0x97ea('0x69')]=function(_0x580072,_0x4de14e,_0x4b13c5){return db['UserProfile'][_0x97ea('0x4a')]({'where':{'id':_0x580072[_0x97ea('0x4d')]['id']}})[_0x97ea('0x27')](handleEntityNotFound(_0x4de14e,null))['then'](function(_0x20eb37){if(_0x20eb37){return _0x20eb37[_0x97ea('0x69')](_0x580072[_0x97ea('0x34')][_0x97ea('0x5f')]);}})[_0x97ea('0x27')](respondWithStatusCode(_0x4de14e,null))[_0x97ea('0x48')](handleError(_0x4de14e,null));};exports[_0x97ea('0x6a')]=function(_0x2bccf7,_0x4aabd8){var _0x2fc1fb={};if(!_0x2bccf7[_0x97ea('0x34')]['section'])throw new Error('Missing\x20section\x20parameter');if(!_0x2bccf7[_0x97ea('0x34')][_0x97ea('0x3a')](_0x97ea('0x3b'))){_0x2fc1fb[_0x97ea('0x20')]=qs['limit'](_0x2bccf7[_0x97ea('0x34')][_0x97ea('0x20')]);_0x2fc1fb[_0x97ea('0x22')]=qs['offset'](_0x2bccf7[_0x97ea('0x34')][_0x97ea('0x22')]);}return db[_0x97ea('0x2e')][_0x97ea('0x4a')]({'where':{'id':_0x2bccf7['params']['id']}})[_0x97ea('0x27')](function(_0x251ed6){if(!_0x251ed6)throw new Error(_0x97ea('0x6b')+_0x2bccf7['params']['id']);return db[_0x97ea('0x2e')]['getResources'](_0x2bccf7);})[_0x97ea('0x27')](respondWithFilteredResult(_0x4aabd8,_0x2fc1fb))[_0x97ea('0x48')](handleError(_0x4aabd8,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 596673a..cf99b34 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 _0x6c65=['events','../../mysqldb','UserProfile','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0xd66b7f,_0x5104dd){var _0x14fc93=function(_0x377e4f){while(--_0x377e4f){_0xd66b7f['push'](_0xd66b7f['shift']());}};_0x14fc93(++_0x5104dd);}(_0x6c65,0x78));var _0x56c6=function(_0x29dda1,_0x508e13){_0x29dda1=_0x29dda1-0x0;var _0x21b0ef=_0x6c65[_0x29dda1];return _0x21b0ef;};'use strict';var EventEmitter=require(_0x56c6('0x0'));var UserProfile=require(_0x56c6('0x1'))['db'][_0x56c6('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x56c6('0x3')](0x0);var events={'afterCreate':_0x56c6('0x4'),'afterUpdate':_0x56c6('0x5'),'afterDestroy':'remove'};function emitEvent(_0x43d710){return function(_0x4321ef,_0x3f532d,_0x1e70f2){UserProfileEvents[_0x56c6('0x6')](_0x43d710+':'+_0x4321ef['id'],_0x4321ef);UserProfileEvents['emit'](_0x43d710,_0x4321ef);_0x1e70f2(null);};}for(var e in events){if(events[_0x56c6('0x7')](e)){var event=events[e];UserProfile[_0x56c6('0x8')](e,emitEvent(event));}}module[_0x56c6('0x9')]=UserProfileEvents; \ No newline at end of file +var _0x1228=['UserProfile','save','update','remove','emit','hook','exports','events'];(function(_0x1cff34,_0x463358){var _0x441440=function(_0x11b95e){while(--_0x11b95e){_0x1cff34['push'](_0x1cff34['shift']());}};_0x441440(++_0x463358);}(_0x1228,0x12f));var _0x8122=function(_0x5d8232,_0x156279){_0x5d8232=_0x5d8232-0x0;var _0x5daf30=_0x1228[_0x5d8232];return _0x5daf30;};'use strict';var EventEmitter=require(_0x8122('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x8122('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8122('0x2'),'afterUpdate':_0x8122('0x3'),'afterDestroy':_0x8122('0x4')};function emitEvent(_0x49a540){return function(_0x762ce4,_0xf4d3e5,_0x4de3a0){UserProfileEvents[_0x8122('0x5')](_0x49a540+':'+_0x762ce4['id'],_0x762ce4);UserProfileEvents[_0x8122('0x5')](_0x49a540,_0x762ce4);_0x4de3a0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x8122('0x6')](e,emitEvent(event));}}module[_0x8122('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 9d6ecbb..3b6e55d 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 _0xed1c=['UserProfile','user_profiles','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','find','params','ignore','union','autoAssociation','all','keys','filters','intersection','attributes','nolimit','limit','offset','where','pick','key','VIRTUAL','foreignKey','merge','options','includeAll','include','forEach','reportType','default','DefaultReports','custom','rows','count','CmContact','Tags','color','ThroughTags','tag','openTabs','true','chat','dataValues','sms','mail','openchannel','whatsapp','lodash','./userProfile.attributes','models','filter','field','value','findAll','then','associatedResources','catch','model','map','name','resolve','AnalyticExtractedReport','resourceId','type','toLowerCase','SquareProject','odbc','childModel','SquareOdbc','squarerecordings','parentSections','SquareProjects','projectName','projects','JscriptyProject','Lists','ListId','lists','companies','CmCompany','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','outboundroutes','VoiceExtension','contexts','VoiceContext','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoicePrefix','ivrcampaigns','Campaign','mailqueues','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','queuecampaigns','users','agents','admin','user','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','customdashboards','Dashboard','pauses','Pause','scheduler','Schedule','sounds','Sound','Tag','templates','Template','triggers','Trigger','Variable','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','ui.UserId\x20=\x20?','query','OpenTabs','define'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0xed1c,0xe4));var _0xced1=function(_0x5c10bd,_0x445068){_0x5c10bd=_0x5c10bd-0x0;var _0x17cc9f=_0xed1c[_0x5c10bd];return _0x17cc9f;};'use strict';var _=require(_0xced1('0x0'));var attributes=require(_0xced1('0x1'));var qs=require('../../components/parsers/qs');var squel=require('squel');module['exports']=function(_0x4c3102){var _0x424db6=_0x4c3102[_0xced1('0x2')];function _0x79202e(_0x47a45c,_0x1e23a9){return new Promise(function(_0x445160,_0x466657){if(!_0x1e23a9)return _0x445160(null);var _0x37b22b=_0x1e23a9['filter']?{[_0x1e23a9[_0xced1('0x3')][_0xced1('0x4')]]:_0x1e23a9[_0xced1('0x3')][_0xced1('0x5')]}:undefined;return _0x424db6[_0x47a45c][_0xced1('0x6')]({'where':_0x37b22b,'raw':!![]})[_0xced1('0x7')](function(_0x325dd2){_0x1e23a9[_0xced1('0x8')]=_['map'](_0x325dd2,'id');_0x445160(_0x1e23a9);})[_0xced1('0x9')](function(_0x59c820){_0x466657(_0x59c820);});});}function _0x3464f3(_0x15e99f,_0x1edaaa){return new Promise(function(_0x18c028,_0x15f678){var _0x44b05c=_0x15e99f[_0xced1('0x3')]?{[_0x15e99f['filter'][_0xced1('0x4')]]:_0x15e99f[_0xced1('0x3')][_0xced1('0x5')]}:undefined;return _0x424db6[_0x15e99f[_0xced1('0xa')]]['findAll']({'where':_0x44b05c,'raw':!![]})[_0xced1('0x7')](function(_0x31a32c){_0x1edaaa['associatedResources']=_[_0xced1('0xb')](_0x31a32c,function(_0x26f81){return _0x26f81[_0xced1('0xc')];});_0x18c028(_0x1edaaa);})[_0xced1('0x9')](function(_0x47baec){_0x15f678(_0x47baec);});});}function _0x5560af(_0x3eb3ac,_0x4178d8,_0x236473){if(!_0x4178d8)return Promise[_0xced1('0xd')](null);return new Promise(function(_0x3e53bd,_0x292997){return _0x424db6['UserProfileResource']['findAll']({'where':{'sectionId':_0x4178d8['id']},'raw':!![]})[_0xced1('0x7')](function(_0x111fb0){if(_0x3eb3ac[_0xced1('0x4')]&&_0x3eb3ac['field']!=='id'){_0x4178d8[_0xced1('0x8')]=_[_0xced1('0xb')](_0x111fb0,function(_0x3e51e4){return _0x3e51e4[_0x3eb3ac['field']];});}else{if(_0x236473===_0xced1('0xe')){_0x4178d8[_0xced1('0x8')]=_[_0xced1('0xb')](_0x111fb0,function(_0x4819fd){return{'id':_0x4819fd[_0xced1('0xf')],'type':_0x4819fd[_0xced1('0x10')]};});}else{_0x4178d8[_0xced1('0x8')]=_['map'](_0x111fb0,function(_0x4dab56){return _0x4dab56[_0xced1('0xf')];});}}_0x3e53bd(_0x4178d8);})[_0xced1('0x9')](function(_0x2a6248){_0x292997(_0x2a6248);});});}function _0x20dcb4(_0x210d7e,_0x49c8b9){var _0x14f47e={'parentSections':[]};switch(_0x210d7e[_0xced1('0x11')]()){case'squareprojects':_0x14f47e['childModel']=_0xced1('0x12');break;case _0xced1('0x13'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x15');break;case _0xced1('0x16'):_0x14f47e[_0xced1('0x14')]='SquareRecording';_0x14f47e[_0xced1('0x17')]=[{'name':_0xced1('0x18'),'field':_0xced1('0xc'),'foreignKey':_0xced1('0x19')}];break;case _0xced1('0x1a'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x1b');break;case'contacts':_0x14f47e[_0xced1('0x14')]='CmContact';_0x14f47e[_0xced1('0x17')]=[{'name':_0xced1('0x1c'),'field':'id','foreignKey':_0xced1('0x1d')}];break;case _0xced1('0x1e'):_0x14f47e['childModel']='CmList';break;case _0xced1('0x1f'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x20');break;case'globalcustomfields':_0x14f47e['childModel']='CmCustomField';break;case _0xced1('0x21'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x22');break;case _0xced1('0x23'):_0x14f47e['childModel']=_0xced1('0x24');break;case _0xced1('0x25'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x26');break;case _0xced1('0x27'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x28');break;case'inboundroutes':case'internalroutes':case _0xced1('0x29'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x2a');break;case _0xced1('0x2b'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x2c');break;case'voicemails':_0x14f47e['childModel']='VoiceMail';break;case'voicerecordings':_0x14f47e[_0xced1('0x14')]=_0xced1('0x2d');_0x14f47e[_0xced1('0x17')]=[{'name':_0xced1('0x2e'),'field':_0xced1('0xc'),'foreignKey':_0xced1('0x2f'),'model':_0xced1('0x30'),'filter':{'field':_0xced1('0x31'),'value':[_0xced1('0x32')]}},{'name':_0xced1('0x33'),'field':_0xced1('0xc'),'foreignKey':_0xced1('0x2f'),'model':_0xced1('0x30'),'filter':{'field':'role','value':[_0xced1('0x34')]}},{'name':_0xced1('0x35'),'field':_0xced1('0xc'),'foreignKey':_0xced1('0x36'),'model':_0xced1('0x37'),'filter':{'field':_0xced1('0x10'),'value':['inbound']}},{'name':_0xced1('0x38'),'field':_0xced1('0xc'),'foreignKey':_0xced1('0x36'),'model':_0xced1('0x37'),'filter':{'field':_0xced1('0x10'),'value':[_0xced1('0x39')]}}];break;case _0xced1('0x3a'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x3b');break;case _0xced1('0x3c'):_0x14f47e[_0xced1('0x14')]='VoiceChanSpy';break;case'voiceprefixes':_0x14f47e[_0xced1('0x14')]=_0xced1('0x3d');break;case _0xced1('0x3e'):_0x14f47e['childModel']=_0xced1('0x3f');break;case _0xced1('0x40'):_0x14f47e[_0xced1('0x14')]='MailQueue';break;case _0xced1('0x41'):_0x14f47e[_0xced1('0x14')]='MailAccount';break;case _0xced1('0x42'):_0x14f47e['childModel']=_0xced1('0x43');break;case _0xced1('0x44'):_0x14f47e['childModel']=_0xced1('0x45');break;case _0xced1('0x46'):_0x14f47e[_0xced1('0x14')]='OpenchannelAccount';break;case _0xced1('0x47'):_0x14f47e[_0xced1('0x14')]='SmsQueue';break;case _0xced1('0x48'):_0x14f47e['childModel']='SmsAccount';break;case _0xced1('0x49'):_0x14f47e['childModel']=_0xced1('0x4a');break;case _0xced1('0x4b'):_0x14f47e[_0xced1('0x14')]='WhatsappAccount';break;case _0xced1('0x4c'):_0x14f47e['childModel']=_0xced1('0x4d');break;case _0xced1('0x4e'):case _0xced1('0x4f'):_0x14f47e[_0xced1('0x14')]='VoiceQueue';if(_0x49c8b9){_0x14f47e[_0xced1('0x17')]=[{'name':_0xced1('0x35')},{'name':'QueueCampaigns'}];}break;case _0xced1('0x50'):case _0xced1('0x51'):case'telephones':_0x14f47e[_0xced1('0x14')]=_0xced1('0x30');if(_0x49c8b9){_0x14f47e[_0xced1('0x17')]=[{'name':'Users','filter':{'field':_0xced1('0x31'),'value':[_0xced1('0x52'),_0xced1('0x53')]},'ignore':!![]},{'name':_0xced1('0x2e')},{'name':_0xced1('0x33')}];}break;case'zendeskaccounts':_0x14f47e[_0xced1('0x14')]='ZendeskAccount';break;case _0xced1('0x54'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x55');break;case _0xced1('0x56'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x57');break;case'sugarcrmaccounts':_0x14f47e[_0xced1('0x14')]=_0xced1('0x58');break;case'deskaccounts':_0x14f47e[_0xced1('0x14')]='DeskAccount';break;case'zohoaccounts':_0x14f47e[_0xced1('0x14')]=_0xced1('0x59');break;case _0xced1('0x5a'):_0x14f47e[_0xced1('0x14')]='User';break;case _0xced1('0x5b'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x5c');break;case'dispositions':_0x14f47e['childModel']=_0xced1('0x5d');break;case _0xced1('0x5e'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x5f');break;case'intervals':_0x14f47e['childModel']='Interval';break;case _0xced1('0x60'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x61');break;case _0xced1('0x62'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x63');break;case _0xced1('0x64'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x65');break;case'tags':_0x14f47e[_0xced1('0x14')]=_0xced1('0x66');break;case _0xced1('0x67'):_0x14f47e['childModel']=_0xced1('0x68');break;case _0xced1('0x69'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x6a');break;case'trunks':_0x14f47e[_0xced1('0x14')]='Trunk';break;case'variables':_0x14f47e[_0xced1('0x14')]=_0xced1('0x6b');break;case'plugins':_0x14f47e['childModel']='Plugin';break;case _0xced1('0x6c'):_0x14f47e['childModel']=_0xced1('0xe');_0x14f47e[_0xced1('0x17')]=[{'name':_0xced1('0x6d'),'field':'id','foreignKey':_0xced1('0x6e')}];break;case _0xced1('0x6f'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x70');break;}return _0x14f47e;}function _0x849056(_0x4d5a58,_0x4f17fb){var _0x4832d2=_0x4d5a58[_0xced1('0x71')](0x0)[_0xced1('0x72')]()+_0x4d5a58[_0xced1('0x73')](0x1);var _0x5b40ea={'type':_0x424db6[_0xced1('0x74')][_0xced1('0x75')][_0xced1('0x76')],'raw':!![]};return new Promise(function(_0x4365da,_0x5950d2){var _0x458f36=squel[_0xced1('0x77')]()[_0xced1('0x4')](_0xced1('0x78')+_0x4832d2+_0xced1('0x79'),'id')[_0xced1('0x4')](_0xced1('0x7a'))[_0xced1('0x7b')]('user_has_'+_0x4d5a58+'_interactions','ui')['where'](_0xced1('0x7c'),_0x4f17fb['id']);return _0x424db6['sequelize'][_0xced1('0x7d')](_0x458f36['toString'](),_0x5b40ea)['then'](function(_0x37bec5){_0x4f17fb[_0x4832d2+_0xced1('0x7e')]=_0x37bec5;_0x4365da(_0x37bec5);})[_0xced1('0x9')](function(_0x2bdcea){_0x5950d2(_0x2bdcea);});});}return _0x4c3102[_0xced1('0x7f')](_0xced1('0x80'),attributes,{'tableName':_0xced1('0x81'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x164ca1){var _0x395b52={'raw':![],'where':{}};var _0x2f22aa={};var _0x1d850b={'count':0x0,'rows':[]};var _0x57b644=_0x164ca1[_0xced1('0x7d')][_0xced1('0x82')];var _0x4956a4=_0x164ca1[_0xced1('0x7d')][_0xced1('0x83')]||![];var _0x55c21d=_0x20dcb4(_0x57b644,_0x4956a4);if(!_0x55c21d[_0xced1('0x14')])throw new Error(_0xced1('0x84')+_0x57b644+'\x27');var _0x2dd0d6=[{'name':_0x57b644}];if(!_[_0xced1('0x85')](_0x55c21d[_0xced1('0x17')]))_0x2dd0d6=_0x55c21d['parentSections'];var _0x59806a=[];for(var _0x487094=0x0;_0x487094<_0x2dd0d6[_0xced1('0x86')];_0x487094++){_0x59806a[_0xced1('0x87')](_0x424db6['UserProfileSection'][_0xced1('0x88')]({'where':{'userProfileId':_0x164ca1[_0xced1('0x89')]['id'],'name':_0x2dd0d6[_0x487094][_0xced1('0xc')]},'raw':!![]}));}return Promise['all'](_0x59806a)[_0xced1('0x7')](function(_0x384efc){var _0x4ed12c=_[_0xced1('0x3')](_0x384efc,function(_0x47e33d){return _0x47e33d?_0x47e33d:undefined;});var _0x1e77e8=_[_0xced1('0x3')](_0x2dd0d6,[_0xced1('0x8a'),!![]]);var _0x2b54e2=_[_0xced1('0x85')](_0x4ed12c)&&_[_0xced1('0x85')](_0x1e77e8)?null:_[_0xced1('0x8b')](_0x1e77e8,_0x4ed12c);if(!_0x2b54e2)return null;var _0x49e802=[];for(var _0x395fe0=0x0;_0x395fe0<_0x2b54e2[_0xced1('0x86')];_0x395fe0++){var _0x154808=_['find'](_0x2dd0d6,function(_0x5c2567){return _0x2b54e2[_0x395fe0]?_0x5c2567[_0xced1('0xc')]===_0x2b54e2[_0x395fe0][_0xced1('0xc')]:null;});if(_0x154808){if(_0x2b54e2[_0x395fe0]['ignore']){_0x49e802[_0xced1('0x87')](_0x79202e(_0x55c21d[_0xced1('0x14')],_0x2b54e2[_0x395fe0]));}else{if(!_0x2b54e2[_0x395fe0][_0xced1('0x8c')]){_0x49e802['push'](_0x5560af(_0x154808,_0x2b54e2[_0x395fe0],_0x55c21d['childModel']));}else{if(_0x154808[_0xced1('0xa')]){_0x49e802[_0xced1('0x87')](_0x3464f3(_0x154808,_0x2b54e2[_0x395fe0]));}}}}}return Promise[_0xced1('0x8d')](_0x49e802);})[_0xced1('0x7')](function(_0x95c83b){var _0x224b8f=_0x95c83b;var _0x5b6acb=null;if(_0x224b8f){_0x5b6acb=_0x224b8f[_0xced1('0x86')]===0x1?_0x224b8f[0x0]:null;}if(!_0x5b6acb&&!_0x224b8f)return _0x1d850b;var _0x4fa327=_0x424db6[_0x55c21d['childModel']]['rawAttributes'];_0x2f22aa['model']=_[_0xced1('0x8e')](_0x4fa327);_0x2f22aa[_0xced1('0x7d')]=_['keys'](_0x164ca1['query']);_0x2f22aa[_0xced1('0x8f')]=_[_0xced1('0x90')](_0x2f22aa['model'],_0x2f22aa['query']);_0x395b52[_0xced1('0x91')]=_[_0xced1('0x90')](_0x2f22aa['model'],qs['fields'](_0x164ca1['query']['fields']));_0x395b52[_0xced1('0x91')]=_0x395b52[_0xced1('0x91')][_0xced1('0x86')]?_0x395b52[_0xced1('0x91')]:_0x2f22aa[_0xced1('0xa')];if(!_0x164ca1[_0xced1('0x7d')]['hasOwnProperty'](_0xced1('0x92'))){_0x395b52[_0xced1('0x93')]=qs[_0xced1('0x93')](_0x164ca1[_0xced1('0x7d')][_0xced1('0x93')]);_0x395b52[_0xced1('0x94')]=qs[_0xced1('0x94')](_0x164ca1[_0xced1('0x7d')][_0xced1('0x94')]);}_0x395b52['order']=qs['sort'](_0x164ca1[_0xced1('0x7d')]['sort']);_0x395b52[_0xced1('0x95')]=qs['filters'](_[_0xced1('0x96')](_0x164ca1[_0xced1('0x7d')],_0x2f22aa[_0xced1('0x8f')]));if(_0x164ca1[_0xced1('0x7d')][_0xced1('0x3')]){_0x395b52[_0xced1('0x95')]=_['merge'](_0x395b52[_0xced1('0x95')],{'$or':_[_0xced1('0xb')](_0x4fa327,function(_0x4104ad){if(_0x4104ad[_0xced1('0x10')][_0xced1('0x97')]!==_0xced1('0x98')){var _0x4fc259={};_0x4fc259[_0x4104ad['field']]={'$like':'%'+_0x164ca1[_0xced1('0x7d')][_0xced1('0x3')]+'%'};return _0x4fc259;}})});}var _0x40eed6=[];var _0x173e9a=null;var _0x37fa95={};if(_0x5b6acb){_0x173e9a=_['find'](_0x2dd0d6,[_0xced1('0xc'),_0x5b6acb[_0xced1('0xc')]]);if(_0x173e9a[_0xced1('0x4')]){_0x37fa95={};if(_0x55c21d[_0xced1('0x14')]==='AnalyticExtractedReport'){_0x37fa95[_0x173e9a[_0xced1('0x99')]]=_[_0xced1('0xb')](_0x5b6acb['associatedResources'],'id');}else{_0x37fa95[_0x173e9a[_0xced1('0x99')]]=_0x5b6acb['associatedResources'];}_0x40eed6[_0xced1('0x87')](_0x37fa95);}else{_0x395b52[_0xced1('0x95')]['id']=_0x5b6acb[_0xced1('0x8')];}}else{for(var _0x19f15d=0x0;_0x19f15d<_0x224b8f[_0xced1('0x86')];_0x19f15d++){_0x173e9a=_[_0xced1('0x88')](_0x2dd0d6,[_0xced1('0xc'),_0x224b8f[_0x19f15d][_0xced1('0xc')]]);if(_0x173e9a[_0xced1('0x4')]){_0x37fa95={};_0x37fa95[_0x173e9a[_0xced1('0x99')]]=_0x224b8f[_0x19f15d]['associatedResources'];_0x40eed6[_0xced1('0x87')](_0x37fa95);}else{if(!_0x395b52[_0xced1('0x95')]['id'])_0x395b52[_0xced1('0x95')]['id']=[];_0x224b8f[_0x19f15d][_0xced1('0x8')]['forEach'](function(_0x35ff8d){_0x395b52[_0xced1('0x95')]['id'][_0xced1('0x87')](_0x35ff8d);});}}}if(!_[_0xced1('0x85')](_0x40eed6)){_0x395b52['where']=_[_0xced1('0x9a')](_0x395b52[_0xced1('0x95')],{'$and':{'$or':_0x40eed6}});}_0x395b52=_[_0xced1('0x9a')]({},_0x395b52,_0x164ca1[_0xced1('0x9b')]);if(_0x5b6acb&&!_0x5b6acb[_0xced1('0x8c')]&&_0x55c21d['childModel']===_0xced1('0xe')){if(_0x164ca1['query'][_0xced1('0x9c')]){_0x395b52[_0xced1('0x9d')]=[{'all':!![]}];}return _0x424db6[_0x55c21d[_0xced1('0x14')]]['findAll'](_0x395b52)[_0xced1('0x7')](function(_0x328079){var _0x5eca32=[];_0x328079[_0xced1('0x9e')](function(_0x4eaf08){var _0xc4a5c8;switch(_0x4eaf08[_0xced1('0x9f')]){case _0xced1('0xa0'):_0xc4a5c8=_['find'](_0x5b6acb['associatedResources'],function(_0x1b6c00){return _0x1b6c00['id']===_0x4eaf08[_0xced1('0x6e')]&&_0x1b6c00[_0xced1('0x10')]===_0xced1('0xa1');});break;case _0xced1('0xa2'):_0xc4a5c8=_['find'](_0x5b6acb['associatedResources'],function(_0x30a9a1){return _0x30a9a1['id']===_0x4eaf08[_0xced1('0x6e')]&&_0x30a9a1[_0xced1('0x10')]==='CustomReports';});break;}if(_0xc4a5c8)_0x5eca32[_0xced1('0x87')](_0x4eaf08);});_0x1d850b['count']=_0x5eca32['length'];_0x1d850b[_0xced1('0xa3')]=_0x5eca32;return _0x1d850b;});}else{return _0x424db6[_0x55c21d['childModel']][_0xced1('0xa4')]({'where':_0x395b52['where']})[_0xced1('0x7')](function(_0x19120f){_0x1d850b[_0xced1('0xa4')]=_0x19120f;if(_0x164ca1[_0xced1('0x7d')][_0xced1('0x9c')]){if(_0x55c21d[_0xced1('0x14')]===_0xced1('0xa5')){_0x395b52['include']=[{'model':_0x424db6['Tag'],'as':_0xced1('0xa6'),'attributes':['id',_0xced1('0xc'),_0xced1('0xa7')],'required':_0x164ca1[_0xced1('0x7d')]['tag']?!![]:![]},{'model':_0x424db6['Tag'],'as':_0xced1('0xa8'),'attributes':['id','name',_0xced1('0xa7')],'through':_0x164ca1[_0xced1('0x7d')][_0xced1('0xa9')]?{'attributes':[],'where':{'TagId':_0x164ca1['query'][_0xced1('0xa9')]||undefined}}:{},'required':_0x164ca1[_0xced1('0x7d')]['tag']?!![]:![]}];}else{_0x395b52[_0xced1('0x9d')]=[{'all':!![]}];}}return _0x424db6[_0x55c21d[_0xced1('0x14')]][_0xced1('0x6')](_0x395b52);})['then'](function(_0x2f4f7a){_0x1d850b[_0xced1('0xa3')]=_0x2f4f7a;if(_0x57b644===_0xced1('0x2e')&&_0x164ca1[_0xced1('0x7d')][_0xced1('0xaa')]===_0xced1('0xab')){var _0x53fca5=[];for(var _0x5126d2=0x0;_0x5126d2<_0x1d850b[_0xced1('0xa3')][_0xced1('0x86')];_0x5126d2++){_0x53fca5[_0xced1('0x87')](_0x849056(_0xced1('0xac'),_0x1d850b[_0xced1('0xa3')][_0x5126d2][_0xced1('0xad')]));_0x53fca5[_0xced1('0x87')](_0x849056(_0xced1('0xae'),_0x1d850b[_0xced1('0xa3')][_0x5126d2][_0xced1('0xad')]));_0x53fca5[_0xced1('0x87')](_0x849056('fax',_0x1d850b['rows'][_0x5126d2][_0xced1('0xad')]));_0x53fca5[_0xced1('0x87')](_0x849056(_0xced1('0xaf'),_0x1d850b[_0xced1('0xa3')][_0x5126d2][_0xced1('0xad')]));_0x53fca5[_0xced1('0x87')](_0x849056(_0xced1('0xb0'),_0x1d850b[_0xced1('0xa3')][_0x5126d2][_0xced1('0xad')]));_0x53fca5[_0xced1('0x87')](_0x849056(_0xced1('0xb1'),_0x1d850b[_0xced1('0xa3')][_0x5126d2][_0xced1('0xad')]));}return Promise[_0xced1('0x8d')](_0x53fca5)[_0xced1('0x7')](function(){return _0x1d850b;});}return _0x1d850b;});}});}}});}; \ No newline at end of file +var _0xe2fe=['FaxAccount','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','inbound','QueueCampaigns','VoiceQueue','outbound','chanspies','VoiceChanSpy','Campaign','mailqueues','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','users','agents','telephones','Users','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','cannedanswers','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','Tag','templates','Template','Trunk','variables','Variable','plugins','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','QueryTypes','SELECT','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','OpenTabs','UserProfile','user_profiles','query','section','Invalid\x20section\x20\x27','isEmpty','length','push','find','params','all','ignore','union','autoAssociation','rawAttributes','keys','filters','intersection','attributes','hasOwnProperty','limit','offset','order','sort','pick','key','VIRTUAL','foreignKey','forEach','merge','options','includeAll','reportType','default','DefaultReports','custom','CustomReports','count','include','color','tag','true','rows','dataValues','sms','mail','openchannel','whatsapp','lodash','squel','models','filter','findAll','then','associatedResources','map','field','value','model','name','catch','AnalyticExtractedReport','type','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','projects','JscriptyProject','contacts','CmContact','Lists','lists','CmList','companies','globalcustomfields','chatwebsites','faxqueues'];(function(_0x31d4b8,_0x2965a7){var _0x3c6aed=function(_0x170c54){while(--_0x170c54){_0x31d4b8['push'](_0x31d4b8['shift']());}};_0x3c6aed(++_0x2965a7);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var attributes=require('./userProfile.attributes');var qs=require('../../components/parsers/qs');var squel=require(_0xee2f('0x1'));module['exports']=function(_0x169cf9){var _0x1b6f4c=_0x169cf9[_0xee2f('0x2')];function _0x2d2b03(_0xcb45e6,_0x4ba89f){return new Promise(function(_0x311a2f,_0x2b7e7c){if(!_0x4ba89f)return _0x311a2f(null);var _0x49926b=_0x4ba89f[_0xee2f('0x3')]?{[_0x4ba89f[_0xee2f('0x3')]['field']]:_0x4ba89f[_0xee2f('0x3')]['value']}:undefined;return _0x1b6f4c[_0xcb45e6][_0xee2f('0x4')]({'where':_0x49926b,'raw':!![]})[_0xee2f('0x5')](function(_0x53f7dd){_0x4ba89f[_0xee2f('0x6')]=_[_0xee2f('0x7')](_0x53f7dd,'id');_0x311a2f(_0x4ba89f);})['catch'](function(_0x5597ea){_0x2b7e7c(_0x5597ea);});});}function _0x4818df(_0x56bbea,_0x2b8fb1){return new Promise(function(_0x4cb4bf,_0x481ea7){var _0x53047d=_0x56bbea[_0xee2f('0x3')]?{[_0x56bbea[_0xee2f('0x3')][_0xee2f('0x8')]]:_0x56bbea[_0xee2f('0x3')][_0xee2f('0x9')]}:undefined;return _0x1b6f4c[_0x56bbea[_0xee2f('0xa')]]['findAll']({'where':_0x53047d,'raw':!![]})[_0xee2f('0x5')](function(_0x531c3a){_0x2b8fb1[_0xee2f('0x6')]=_[_0xee2f('0x7')](_0x531c3a,function(_0x48b30c){return _0x48b30c[_0xee2f('0xb')];});_0x4cb4bf(_0x2b8fb1);})[_0xee2f('0xc')](function(_0x28b614){_0x481ea7(_0x28b614);});});}function _0x1bbf7d(_0x390c2c,_0x58f42a,_0x3f6372){if(!_0x58f42a)return Promise['resolve'](null);return new Promise(function(_0x17d288,_0x3359ff){return _0x1b6f4c['UserProfileResource']['findAll']({'where':{'sectionId':_0x58f42a['id']},'raw':!![]})[_0xee2f('0x5')](function(_0x5a5078){if(_0x390c2c[_0xee2f('0x8')]&&_0x390c2c[_0xee2f('0x8')]!=='id'){_0x58f42a[_0xee2f('0x6')]=_['map'](_0x5a5078,function(_0x35e1a4){return _0x35e1a4[_0x390c2c[_0xee2f('0x8')]];});}else{if(_0x3f6372===_0xee2f('0xd')){_0x58f42a[_0xee2f('0x6')]=_[_0xee2f('0x7')](_0x5a5078,function(_0x5d36d4){return{'id':_0x5d36d4['resourceId'],'type':_0x5d36d4[_0xee2f('0xe')]};});}else{_0x58f42a[_0xee2f('0x6')]=_[_0xee2f('0x7')](_0x5a5078,function(_0x203b2f){return _0x203b2f[_0xee2f('0xf')];});}}_0x17d288(_0x58f42a);})[_0xee2f('0xc')](function(_0x39a39c){_0x3359ff(_0x39a39c);});});}function _0x4d68d3(_0x250399,_0x2c47c5){var _0x15ceda={'parentSections':[]};switch(_0x250399[_0xee2f('0x10')]()){case _0xee2f('0x11'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x13');break;case _0xee2f('0x14'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x15');break;case _0xee2f('0x16'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x17');_0x15ceda[_0xee2f('0x18')]=[{'name':'SquareProjects','field':'name','foreignKey':'projectName'}];break;case _0xee2f('0x19'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x1a');break;case _0xee2f('0x1b'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x1c');_0x15ceda['parentSections']=[{'name':_0xee2f('0x1d'),'field':'id','foreignKey':'ListId'}];break;case _0xee2f('0x1e'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x1f');break;case _0xee2f('0x20'):_0x15ceda[_0xee2f('0x12')]='CmCompany';break;case _0xee2f('0x21'):_0x15ceda[_0xee2f('0x12')]='CmCustomField';break;case'chatqueues':_0x15ceda[_0xee2f('0x12')]='ChatQueue';break;case _0xee2f('0x22'):_0x15ceda[_0xee2f('0x12')]='ChatWebsite';break;case _0xee2f('0x23'):_0x15ceda['childModel']='FaxQueue';break;case'faxaccounts':_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x24');break;case'inboundroutes':case _0xee2f('0x25'):case _0xee2f('0x26'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x27');break;case _0xee2f('0x28'):_0x15ceda['childModel']=_0xee2f('0x29');break;case'voicemails':_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x2a');break;case _0xee2f('0x2b'):_0x15ceda['childModel']=_0xee2f('0x2c');_0x15ceda['parentSections']=[{'name':_0xee2f('0x2d'),'field':'name','foreignKey':_0xee2f('0x2e'),'model':_0xee2f('0x2f'),'filter':{'field':_0xee2f('0x30'),'value':[_0xee2f('0x31')]}},{'name':_0xee2f('0x32'),'field':_0xee2f('0xb'),'foreignKey':_0xee2f('0x2e'),'model':_0xee2f('0x2f'),'filter':{'field':_0xee2f('0x30'),'value':[_0xee2f('0x33')]}},{'name':_0xee2f('0x34'),'field':'name','foreignKey':_0xee2f('0x35'),'model':'VoiceQueue','filter':{'field':_0xee2f('0xe'),'value':[_0xee2f('0x36')]}},{'name':_0xee2f('0x37'),'field':_0xee2f('0xb'),'foreignKey':_0xee2f('0x35'),'model':_0xee2f('0x38'),'filter':{'field':_0xee2f('0xe'),'value':[_0xee2f('0x39')]}}];break;case'musiconholds':_0x15ceda['childModel']='VoiceMusicOnHold';break;case _0xee2f('0x3a'):_0x15ceda['childModel']=_0xee2f('0x3b');break;case'voiceprefixes':_0x15ceda['childModel']='VoicePrefix';break;case'ivrcampaigns':_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x3c');break;case _0xee2f('0x3d'):_0x15ceda[_0xee2f('0x12')]='MailQueue';break;case'mailaccounts':_0x15ceda[_0xee2f('0x12')]='MailAccount';break;case'mailsubstatuses':_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x3e');break;case _0xee2f('0x3f'):_0x15ceda['childModel']=_0xee2f('0x40');break;case _0xee2f('0x41'):_0x15ceda[_0xee2f('0x12')]='OpenchannelAccount';break;case'smsqueues':_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x42');break;case _0xee2f('0x43'):_0x15ceda[_0xee2f('0x12')]='SmsAccount';break;case _0xee2f('0x44'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x45');break;case _0xee2f('0x46'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x47');break;case _0xee2f('0x48'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x49');break;case _0xee2f('0x4a'):case'queuecampaigns':_0x15ceda['childModel']='VoiceQueue';if(_0x2c47c5){_0x15ceda['parentSections']=[{'name':_0xee2f('0x34')},{'name':_0xee2f('0x37')}];}break;case _0xee2f('0x4b'):case _0xee2f('0x4c'):case _0xee2f('0x4d'):_0x15ceda['childModel']=_0xee2f('0x2f');if(_0x2c47c5){_0x15ceda[_0xee2f('0x18')]=[{'name':_0xee2f('0x4e'),'filter':{'field':_0xee2f('0x30'),'value':['admin','user']},'ignore':!![]},{'name':'Agents'},{'name':_0xee2f('0x32')}];}break;case'zendeskaccounts':_0x15ceda['childModel']='ZendeskAccount';break;case'salesforceaccounts':_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x4f');break;case _0xee2f('0x50'):_0x15ceda['childModel']=_0xee2f('0x51');break;case'sugarcrmaccounts':_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x52');break;case _0xee2f('0x53'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x54');break;case'zohoaccounts':_0x15ceda['childModel']=_0xee2f('0x55');break;case'vtigeraccounts':_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x2f');break;case _0xee2f('0x56'):_0x15ceda[_0xee2f('0x12')]='CannedAnswer';break;case'dispositions':_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x57');break;case _0xee2f('0x58'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x59');break;case _0xee2f('0x5a'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x5b');break;case _0xee2f('0x5c'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x5d');break;case _0xee2f('0x5e'):_0x15ceda['childModel']=_0xee2f('0x5f');break;case _0xee2f('0x60'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x61');break;case'tags':_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x62');break;case _0xee2f('0x63'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x64');break;case'triggers':_0x15ceda[_0xee2f('0x12')]='Trigger';break;case'trunks':_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x65');break;case _0xee2f('0x66'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x67');break;case _0xee2f('0x68'):_0x15ceda[_0xee2f('0x12')]='Plugin';break;case _0xee2f('0x69'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0xd');_0x15ceda[_0xee2f('0x18')]=[{'name':_0xee2f('0x6a'),'field':'id','foreignKey':_0xee2f('0x6b')}];break;case _0xee2f('0x6c'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x6d');break;}return _0x15ceda;}function _0x5d6c40(_0x12373b,_0x4b9d29){var _0x1b4ee6=_0x12373b[_0xee2f('0x6e')](0x0)[_0xee2f('0x6f')]()+_0x12373b[_0xee2f('0x70')](0x1);var _0x2f3891={'type':_0x1b6f4c['Sequelize'][_0xee2f('0x71')][_0xee2f('0x72')],'raw':!![]};return new Promise(function(_0x27a938,_0x65d1af){var _0x53441d=squel['select']()['field']('ui.'+_0x1b4ee6+'InteractionId','id')[_0xee2f('0x8')]('ui.createdAt')[_0xee2f('0x73')](_0xee2f('0x74')+_0x12373b+_0xee2f('0x75'),'ui')[_0xee2f('0x76')](_0xee2f('0x77'),_0x4b9d29['id']);return _0x1b6f4c[_0xee2f('0x78')]['query'](_0x53441d['toString'](),_0x2f3891)[_0xee2f('0x5')](function(_0x58e464){_0x4b9d29[_0x1b4ee6+_0xee2f('0x79')]=_0x58e464;_0x27a938(_0x58e464);})['catch'](function(_0x7167f9){_0x65d1af(_0x7167f9);});});}return _0x169cf9['define'](_0xee2f('0x7a'),attributes,{'tableName':_0xee2f('0x7b'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x2f419c){var _0x5655f4={'raw':![],'where':{}};var _0x3cc477={};var _0x3fd375={'count':0x0,'rows':[]};var _0x3bdfc5=_0x2f419c[_0xee2f('0x7c')][_0xee2f('0x7d')];var _0x486146=_0x2f419c[_0xee2f('0x7c')]['mergeResources']||![];var _0x3ee766=_0x4d68d3(_0x3bdfc5,_0x486146);if(!_0x3ee766[_0xee2f('0x12')])throw new Error(_0xee2f('0x7e')+_0x3bdfc5+'\x27');var _0x353bd9=[{'name':_0x3bdfc5}];if(!_[_0xee2f('0x7f')](_0x3ee766[_0xee2f('0x18')]))_0x353bd9=_0x3ee766[_0xee2f('0x18')];var _0x15c7ff=[];for(var _0x191af8=0x0;_0x191af8<_0x353bd9[_0xee2f('0x80')];_0x191af8++){_0x15c7ff[_0xee2f('0x81')](_0x1b6f4c['UserProfileSection'][_0xee2f('0x82')]({'where':{'userProfileId':_0x2f419c[_0xee2f('0x83')]['id'],'name':_0x353bd9[_0x191af8]['name']},'raw':!![]}));}return Promise[_0xee2f('0x84')](_0x15c7ff)['then'](function(_0x4372cc){var _0x4ed7c9=_['filter'](_0x4372cc,function(_0x465acd){return _0x465acd?_0x465acd:undefined;});var _0x46ecac=_[_0xee2f('0x3')](_0x353bd9,[_0xee2f('0x85'),!![]]);var _0x48c3fa=_['isEmpty'](_0x4ed7c9)&&_[_0xee2f('0x7f')](_0x46ecac)?null:_[_0xee2f('0x86')](_0x46ecac,_0x4ed7c9);if(!_0x48c3fa)return null;var _0x42fae8=[];for(var _0x5d4fe8=0x0;_0x5d4fe8<_0x48c3fa[_0xee2f('0x80')];_0x5d4fe8++){var _0x413d70=_['find'](_0x353bd9,function(_0x1f1c55){return _0x48c3fa[_0x5d4fe8]?_0x1f1c55[_0xee2f('0xb')]===_0x48c3fa[_0x5d4fe8][_0xee2f('0xb')]:null;});if(_0x413d70){if(_0x48c3fa[_0x5d4fe8][_0xee2f('0x85')]){_0x42fae8[_0xee2f('0x81')](_0x2d2b03(_0x3ee766[_0xee2f('0x12')],_0x48c3fa[_0x5d4fe8]));}else{if(!_0x48c3fa[_0x5d4fe8][_0xee2f('0x87')]){_0x42fae8[_0xee2f('0x81')](_0x1bbf7d(_0x413d70,_0x48c3fa[_0x5d4fe8],_0x3ee766[_0xee2f('0x12')]));}else{if(_0x413d70['model']){_0x42fae8['push'](_0x4818df(_0x413d70,_0x48c3fa[_0x5d4fe8]));}}}}}return Promise['all'](_0x42fae8);})[_0xee2f('0x5')](function(_0x19ce25){var _0x4288eb=_0x19ce25;var _0x7ab1db=null;if(_0x4288eb){_0x7ab1db=_0x4288eb[_0xee2f('0x80')]===0x1?_0x4288eb[0x0]:null;}if(!_0x7ab1db&&!_0x4288eb)return _0x3fd375;var _0x4f7be1=_0x1b6f4c[_0x3ee766[_0xee2f('0x12')]][_0xee2f('0x88')];_0x3cc477['model']=_[_0xee2f('0x89')](_0x4f7be1);_0x3cc477[_0xee2f('0x7c')]=_[_0xee2f('0x89')](_0x2f419c['query']);_0x3cc477[_0xee2f('0x8a')]=_['intersection'](_0x3cc477[_0xee2f('0xa')],_0x3cc477[_0xee2f('0x7c')]);_0x5655f4['attributes']=_[_0xee2f('0x8b')](_0x3cc477[_0xee2f('0xa')],qs['fields'](_0x2f419c['query']['fields']));_0x5655f4[_0xee2f('0x8c')]=_0x5655f4['attributes']['length']?_0x5655f4[_0xee2f('0x8c')]:_0x3cc477[_0xee2f('0xa')];if(!_0x2f419c['query'][_0xee2f('0x8d')]('nolimit')){_0x5655f4[_0xee2f('0x8e')]=qs[_0xee2f('0x8e')](_0x2f419c[_0xee2f('0x7c')][_0xee2f('0x8e')]);_0x5655f4[_0xee2f('0x8f')]=qs[_0xee2f('0x8f')](_0x2f419c[_0xee2f('0x7c')]['offset']);}_0x5655f4[_0xee2f('0x90')]=qs[_0xee2f('0x91')](_0x2f419c[_0xee2f('0x7c')][_0xee2f('0x91')]);_0x5655f4[_0xee2f('0x76')]=qs['filters'](_[_0xee2f('0x92')](_0x2f419c[_0xee2f('0x7c')],_0x3cc477[_0xee2f('0x8a')]));if(_0x2f419c[_0xee2f('0x7c')][_0xee2f('0x3')]){_0x5655f4[_0xee2f('0x76')]=_['merge'](_0x5655f4['where'],{'$or':_[_0xee2f('0x7')](_0x4f7be1,function(_0x28320c){if(_0x28320c[_0xee2f('0xe')][_0xee2f('0x93')]!==_0xee2f('0x94')){var _0x266fb7={};_0x266fb7[_0x28320c[_0xee2f('0x8')]]={'$like':'%'+_0x2f419c['query']['filter']+'%'};return _0x266fb7;}})});}var _0x2ad26d=[];var _0x27eabc=null;var _0x12c4f9={};if(_0x7ab1db){_0x27eabc=_[_0xee2f('0x82')](_0x353bd9,[_0xee2f('0xb'),_0x7ab1db[_0xee2f('0xb')]]);if(_0x27eabc[_0xee2f('0x8')]){_0x12c4f9={};if(_0x3ee766[_0xee2f('0x12')]===_0xee2f('0xd')){_0x12c4f9[_0x27eabc[_0xee2f('0x95')]]=_[_0xee2f('0x7')](_0x7ab1db[_0xee2f('0x6')],'id');}else{_0x12c4f9[_0x27eabc['foreignKey']]=_0x7ab1db['associatedResources'];}_0x2ad26d[_0xee2f('0x81')](_0x12c4f9);}else{_0x5655f4['where']['id']=_0x7ab1db['associatedResources'];}}else{for(var _0x5a460d=0x0;_0x5a460d<_0x4288eb['length'];_0x5a460d++){_0x27eabc=_[_0xee2f('0x82')](_0x353bd9,[_0xee2f('0xb'),_0x4288eb[_0x5a460d]['name']]);if(_0x27eabc['field']){_0x12c4f9={};_0x12c4f9[_0x27eabc[_0xee2f('0x95')]]=_0x4288eb[_0x5a460d][_0xee2f('0x6')];_0x2ad26d[_0xee2f('0x81')](_0x12c4f9);}else{if(!_0x5655f4['where']['id'])_0x5655f4['where']['id']=[];_0x4288eb[_0x5a460d][_0xee2f('0x6')][_0xee2f('0x96')](function(_0x499d0e){_0x5655f4['where']['id'][_0xee2f('0x81')](_0x499d0e);});}}}if(!_['isEmpty'](_0x2ad26d)){_0x5655f4[_0xee2f('0x76')]=_['merge'](_0x5655f4[_0xee2f('0x76')],{'$and':{'$or':_0x2ad26d}});}_0x5655f4=_[_0xee2f('0x97')]({},_0x5655f4,_0x2f419c[_0xee2f('0x98')]);if(_0x7ab1db&&!_0x7ab1db['autoAssociation']&&_0x3ee766['childModel']===_0xee2f('0xd')){if(_0x2f419c[_0xee2f('0x7c')][_0xee2f('0x99')]){_0x5655f4['include']=[{'all':!![]}];}return _0x1b6f4c[_0x3ee766[_0xee2f('0x12')]][_0xee2f('0x4')](_0x5655f4)[_0xee2f('0x5')](function(_0x346fc2){var _0x413340=[];_0x346fc2[_0xee2f('0x96')](function(_0x411afb){var _0x16326e;switch(_0x411afb[_0xee2f('0x9a')]){case _0xee2f('0x9b'):_0x16326e=_[_0xee2f('0x82')](_0x7ab1db[_0xee2f('0x6')],function(_0x28bde7){return _0x28bde7['id']===_0x411afb[_0xee2f('0x6b')]&&_0x28bde7['type']===_0xee2f('0x9c');});break;case _0xee2f('0x9d'):_0x16326e=_[_0xee2f('0x82')](_0x7ab1db[_0xee2f('0x6')],function(_0x23f8c7){return _0x23f8c7['id']===_0x411afb[_0xee2f('0x6b')]&&_0x23f8c7[_0xee2f('0xe')]===_0xee2f('0x9e');});break;}if(_0x16326e)_0x413340[_0xee2f('0x81')](_0x411afb);});_0x3fd375[_0xee2f('0x9f')]=_0x413340[_0xee2f('0x80')];_0x3fd375['rows']=_0x413340;return _0x3fd375;});}else{return _0x1b6f4c[_0x3ee766[_0xee2f('0x12')]][_0xee2f('0x9f')]({'where':_0x5655f4[_0xee2f('0x76')]})[_0xee2f('0x5')](function(_0x53d769){_0x3fd375[_0xee2f('0x9f')]=_0x53d769;if(_0x2f419c[_0xee2f('0x7c')][_0xee2f('0x99')]){if(_0x3ee766['childModel']==='CmContact'){_0x5655f4[_0xee2f('0xa0')]=[{'model':_0x1b6f4c['Tag'],'as':'Tags','attributes':['id','name',_0xee2f('0xa1')],'required':_0x2f419c[_0xee2f('0x7c')][_0xee2f('0xa2')]?!![]:![]},{'model':_0x1b6f4c[_0xee2f('0x62')],'as':'ThroughTags','attributes':['id',_0xee2f('0xb'),_0xee2f('0xa1')],'through':_0x2f419c[_0xee2f('0x7c')]['tag']?{'attributes':[],'where':{'TagId':_0x2f419c[_0xee2f('0x7c')]['tag']||undefined}}:{},'required':_0x2f419c[_0xee2f('0x7c')]['tag']?!![]:![]}];}else{_0x5655f4['include']=[{'all':!![]}];}}return _0x1b6f4c[_0x3ee766[_0xee2f('0x12')]]['findAll'](_0x5655f4);})[_0xee2f('0x5')](function(_0x5a95e0){_0x3fd375['rows']=_0x5a95e0;if(_0x3bdfc5===_0xee2f('0x2d')&&_0x2f419c[_0xee2f('0x7c')]['openTabs']===_0xee2f('0xa3')){var _0x34f882=[];for(var _0x4fe164=0x0;_0x4fe164<_0x3fd375['rows'][_0xee2f('0x80')];_0x4fe164++){_0x34f882[_0xee2f('0x81')](_0x5d6c40('chat',_0x3fd375[_0xee2f('0xa4')][_0x4fe164][_0xee2f('0xa5')]));_0x34f882[_0xee2f('0x81')](_0x5d6c40(_0xee2f('0xa6'),_0x3fd375[_0xee2f('0xa4')][_0x4fe164]['dataValues']));_0x34f882['push'](_0x5d6c40('fax',_0x3fd375[_0xee2f('0xa4')][_0x4fe164][_0xee2f('0xa5')]));_0x34f882[_0xee2f('0x81')](_0x5d6c40(_0xee2f('0xa7'),_0x3fd375[_0xee2f('0xa4')][_0x4fe164][_0xee2f('0xa5')]));_0x34f882[_0xee2f('0x81')](_0x5d6c40(_0xee2f('0xa8'),_0x3fd375[_0xee2f('0xa4')][_0x4fe164][_0xee2f('0xa5')]));_0x34f882[_0xee2f('0x81')](_0x5d6c40(_0xee2f('0xa9'),_0x3fd375[_0xee2f('0xa4')][_0x4fe164][_0xee2f('0xa5')]));}return Promise[_0xee2f('0x84')](_0x34f882)[_0xee2f('0x5')](function(){return _0x3fd375;});}return _0x3fd375;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 5f98ac6..4bb7bda 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 _0xa701=['UserProfile,\x20%s,\x20%s','message','info','result','catch','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','request','then','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1f42bc,_0x208463){var _0x23f159=function(_0x3933bb){while(--_0x3933bb){_0x1f42bc['push'](_0x1f42bc['shift']());}};_0x23f159(++_0x208463);}(_0xa701,0xd4));var _0x1a70=function(_0x55f7ce,_0x42e07d){_0x55f7ce=_0x55f7ce-0x0;var _0x45b247=_0xa701[_0x55f7ce];return _0x45b247;};'use strict';var _=require('lodash');var util=require(_0x1a70('0x0'));var moment=require(_0x1a70('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a70('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1a70('0x3'))(_0x1a70('0x4'));var config=require(_0x1a70('0x5'));var jayson=require(_0x1a70('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0x1a70('0x7')]=_[_0x1a70('0x8')](config[_0x1a70('0x7')],{'host':_0x1a70('0x9'),'port':0x18eb});var socket=require(_0x1a70('0xa'))(new Redis(config[_0x1a70('0x7')]));require(_0x1a70('0xb'))['register'](socket);function respondWithRpcPromise(_0xe69b9b,_0x121091,_0x17015c){return new BPromise(function(_0x471b1f,_0x5772d9){return client[_0x1a70('0xc')](_0xe69b9b,_0x17015c)[_0x1a70('0xd')](function(_0x1b29e7){logger['info']('UserProfile,\x20%s,\x20%s',_0x121091,_0x1a70('0xe'));logger['debug'](_0x1a70('0xf'),_0x121091,'request\x20sent',JSON[_0x1a70('0x10')](_0x1b29e7));if(_0x1b29e7['error']){if(_0x1b29e7[_0x1a70('0x11')]['code']===0x1f4){logger[_0x1a70('0x11')](_0x1a70('0x12'),_0x121091,_0x1b29e7[_0x1a70('0x11')][_0x1a70('0x13')]);return _0x5772d9(_0x1b29e7[_0x1a70('0x11')]['message']);}logger['error'](_0x1a70('0x12'),_0x121091,_0x1b29e7['error'][_0x1a70('0x13')]);return _0x471b1f(_0x1b29e7[_0x1a70('0x11')]['message']);}else{logger[_0x1a70('0x14')]('UserProfile,\x20%s,\x20%s',_0x121091,_0x1a70('0xe'));_0x471b1f(_0x1b29e7[_0x1a70('0x15')]['message']);}})[_0x1a70('0x16')](function(_0x35de3b){logger['error']('UserProfile,\x20%s,\x20%s',_0x121091,_0x35de3b);_0x5772d9(_0x35de3b);});});} \ No newline at end of file +var _0xfc46=['./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter'];(function(_0x4a49a0,_0x35d6b0){var _0x337a50=function(_0x950573){while(--_0x950573){_0x4a49a0['push'](_0x4a49a0['shift']());}};_0x337a50(++_0x35d6b0);}(_0xfc46,0x9a));var _0x6fc4=function(_0x4521e3,_0x10a8a4){_0x4521e3=_0x4521e3-0x0;var _0x46a272=_0xfc46[_0x4521e3];return _0x46a272;};'use strict';var _=require(_0x6fc4('0x0'));var util=require('util');var moment=require(_0x6fc4('0x1'));var BPromise=require(_0x6fc4('0x2'));var rs=require(_0x6fc4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6fc4('0x4'))['db'];var utils=require(_0x6fc4('0x5'));var logger=require(_0x6fc4('0x6'))(_0x6fc4('0x7'));var config=require('../../config/environment');var jayson=require(_0x6fc4('0x8'));var client=jayson[_0x6fc4('0x9')][_0x6fc4('0xa')]({'port':0x232a});config[_0x6fc4('0xb')]=_[_0x6fc4('0xc')](config[_0x6fc4('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x6fc4('0xd'))(new Redis(config['redis']));require(_0x6fc4('0xe'))[_0x6fc4('0xf')](socket);function respondWithRpcPromise(_0x57dd8c,_0x2c573b,_0x19dc5b){return new BPromise(function(_0x3a8f51,_0x16072b){return client[_0x6fc4('0x10')](_0x57dd8c,_0x19dc5b)[_0x6fc4('0x11')](function(_0x15a009){logger[_0x6fc4('0x12')](_0x6fc4('0x13'),_0x2c573b,_0x6fc4('0x14'));logger[_0x6fc4('0x15')](_0x6fc4('0x16'),_0x2c573b,_0x6fc4('0x14'),JSON[_0x6fc4('0x17')](_0x15a009));if(_0x15a009[_0x6fc4('0x18')]){if(_0x15a009[_0x6fc4('0x18')][_0x6fc4('0x19')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x2c573b,_0x15a009[_0x6fc4('0x18')][_0x6fc4('0x1a')]);return _0x16072b(_0x15a009[_0x6fc4('0x18')][_0x6fc4('0x1a')]);}logger[_0x6fc4('0x18')](_0x6fc4('0x13'),_0x2c573b,_0x15a009[_0x6fc4('0x18')][_0x6fc4('0x1a')]);return _0x3a8f51(_0x15a009[_0x6fc4('0x18')]['message']);}else{logger[_0x6fc4('0x12')](_0x6fc4('0x13'),_0x2c573b,'request\x20sent');_0x3a8f51(_0x15a009['result'][_0x6fc4('0x1a')]);}})[_0x6fc4('0x1b')](function(_0x4f49d1){logger[_0x6fc4('0x18')](_0x6fc4('0x13'),_0x2c573b,_0x4f49d1);_0x16072b(_0x4f49d1);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 18f4371..85ec7ba 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 _0xbcda=['update','emit','removeListener','register','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbcda,0x17e));var _0xabcd=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xbcda[_0x29b609];return _0x54c952;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0xabcd('0x0'),_0xabcd('0x1'),_0xabcd('0x2')];function createListener(_0x291652,_0x384518){return function(_0x552169){_0x384518[_0xabcd('0x3')](_0x291652,_0x552169);};}function removeListener(_0x49b1f0,_0x339c13){return function(){UserProfileEvents[_0xabcd('0x4')](_0x49b1f0,_0x339c13);};}exports[_0xabcd('0x5')]=function(_0xe22b55){for(var _0x290901=0x0,_0x17f8da=events['length'];_0x290901<_0x17f8da;_0x290901++){var _0x42513b=events[_0x290901];var _0x1240db=createListener('userProfile:'+_0x42513b,_0xe22b55);UserProfileEvents['on'](_0x42513b,_0x1240db);}}; \ No newline at end of file +var _0x6655=['update','emit','removeListener','register','userProfile:','./userProfile.events','save','remove'];(function(_0xde6408,_0x32cee0){var _0x4b3f47=function(_0x44961a){while(--_0x44961a){_0xde6408['push'](_0xde6408['shift']());}};_0x4b3f47(++_0x32cee0);}(_0x6655,0x1dd));var _0x5665=function(_0x5c9b4c,_0x154af7){_0x5c9b4c=_0x5c9b4c-0x0;var _0x173dab=_0x6655[_0x5c9b4c];return _0x173dab;};'use strict';var UserProfileEvents=require(_0x5665('0x0'));var events=[_0x5665('0x1'),_0x5665('0x2'),_0x5665('0x3')];function createListener(_0x3bb481,_0x5420e9){return function(_0x1410cd){_0x5420e9[_0x5665('0x4')](_0x3bb481,_0x1410cd);};}function removeListener(_0x5208d4,_0xf33327){return function(){UserProfileEvents[_0x5665('0x5')](_0x5208d4,_0xf33327);};}exports[_0x5665('0x6')]=function(_0x4109da){for(var _0x990dd4=0x0,_0x4a8dff=events['length'];_0x990dd4<_0x4a8dff;_0x990dd4++){var _0x18c2c9=events[_0x990dd4];var _0x46d38c=createListener(_0x5665('0x7')+_0x18c2c9,_0x4109da);UserProfileEvents['on'](_0x18c2c9,_0x46d38c);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 679e70f..b4ca3ec 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 _0x8d35=['show','post','put','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','index','get','isAuthenticated','describe','/:id'];(function(_0x2ac4a3,_0x5e5c66){var _0x330bcc=function(_0x5e2201){while(--_0x5e2201){_0x2ac4a3['push'](_0x2ac4a3['shift']());}};_0x330bcc(++_0x5e5c66);}(_0x8d35,0x1e7));var _0x58d3=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x8d35[_0x47aa64];return _0x549c7a;};'use strict';var multer=require(_0x58d3('0x0'));var util=require('util');var path=require(_0x58d3('0x1'));var timeout=require('connect-timeout');var express=require(_0x58d3('0x2'));var router=express['Router']();var fs_extra=require(_0x58d3('0x3'));var auth=require(_0x58d3('0x4'));var interaction=require(_0x58d3('0x5'));var config=require(_0x58d3('0x6'));var controller=require(_0x58d3('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x58d3('0x8')]);router[_0x58d3('0x9')]('/describe',auth[_0x58d3('0xa')](),controller[_0x58d3('0xb')]);router[_0x58d3('0x9')](_0x58d3('0xc'),auth[_0x58d3('0xa')](),controller[_0x58d3('0xd')]);router[_0x58d3('0xe')]('/',auth[_0x58d3('0xa')](),controller['create']);router[_0x58d3('0xf')](_0x58d3('0xc'),auth[_0x58d3('0xa')](),controller[_0x58d3('0x10')]);router[_0x58d3('0x11')]('/:id',auth[_0x58d3('0xa')](),controller[_0x58d3('0x12')]);module[_0x58d3('0x13')]=router; \ No newline at end of file +var _0x8e04=['./userProfileResource.controller','get','isAuthenticated','index','describe','/:id','create','put','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x2c7276,_0x20e04c){var _0x3504a1=function(_0x1a481c){while(--_0x1a481c){_0x2c7276['push'](_0x2c7276['shift']());}};_0x3504a1(++_0x20e04c);}(_0x8e04,0x1ca));var _0x48e0=function(_0x5c5f3b,_0x5b9190){_0x5c5f3b=_0x5c5f3b-0x0;var _0x8a59e4=_0x8e04[_0x5c5f3b];return _0x8a59e4;};'use strict';var multer=require(_0x48e0('0x0'));var util=require('util');var path=require(_0x48e0('0x1'));var timeout=require(_0x48e0('0x2'));var express=require('express');var router=express[_0x48e0('0x3')]();var fs_extra=require(_0x48e0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x48e0('0x5'));var config=require('../../config/environment');var controller=require(_0x48e0('0x6'));router[_0x48e0('0x7')]('/',auth[_0x48e0('0x8')](),controller[_0x48e0('0x9')]);router[_0x48e0('0x7')]('/describe',auth[_0x48e0('0x8')](),controller[_0x48e0('0xa')]);router[_0x48e0('0x7')](_0x48e0('0xb'),auth[_0x48e0('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x48e0('0xc')]);router[_0x48e0('0xd')](_0x48e0('0xb'),auth[_0x48e0('0x8')](),controller['update']);router[_0x48e0('0xe')]('/:id',auth[_0x48e0('0x8')](),controller['destroy']);module[_0x48e0('0xf')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 0a0174e..4fc9bad 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 _0x7aba=['STRING','INTEGER','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7aba,0x11a));var _0xa7ab=function(_0x474bf0,_0x5b5129){_0x474bf0=_0x474bf0-0x0;var _0x30027c=_0x7aba[_0x474bf0];return _0x30027c;};'use strict';var Sequelize=require(_0xa7ab('0x0'));module[_0xa7ab('0x1')]={'name':{'type':Sequelize[_0xa7ab('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xa7ab('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xa7ab('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x1625=['STRING','sequelize','exports','INTEGER'];(function(_0x1ab20e,_0x58b6ef){var _0x2834b0=function(_0x3b39eb){while(--_0x3b39eb){_0x1ab20e['push'](_0x1ab20e['shift']());}};_0x2834b0(++_0x58b6ef);}(_0x1625,0x1a1));var _0x5162=function(_0x3528f1,_0x3684a6){_0x3528f1=_0x3528f1-0x0;var _0x5adc0a=_0x1625[_0x3528f1];return _0x5adc0a;};'use strict';var Sequelize=require(_0x5162('0x0'));module[_0x5162('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x5162('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5162('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 88153e9..632c213 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 _0xc2c7=['merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','destroy','then','error','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where'];(function(_0xa85b46,_0x571cab){var _0x4b4c88=function(_0x621751){while(--_0x621751){_0xa85b46['push'](_0xa85b46['shift']());}};_0x4b4c88(++_0x571cab);}(_0xc2c7,0x134));var _0x7c2c=function(_0x46c9e9,_0x4c0b02){_0x46c9e9=_0x46c9e9-0x0;var _0x1bf1bd=_0xc2c7[_0x46c9e9];return _0x1bf1bd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c2c('0x0'));var zipdir=require(_0x7c2c('0x1'));var jsonpatch=require(_0x7c2c('0x2'));var rp=require(_0x7c2c('0x3'));var moment=require(_0x7c2c('0x4'));var BPromise=require(_0x7c2c('0x5'));var Mustache=require(_0x7c2c('0x6'));var util=require(_0x7c2c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7c2c('0x8'));var ejs=require(_0x7c2c('0x9'));var fs=require('fs');var fs_extra=require(_0x7c2c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7c2c('0xb'));var deskjs=require(_0x7c2c('0xc'));var toCsv=require(_0x7c2c('0x8'));var querystring=require(_0x7c2c('0xd'));var Papa=require(_0x7c2c('0xe'));var Redis=require('ioredis');var authService=require(_0x7c2c('0xf'));var qs=require(_0x7c2c('0x10'));var as=require(_0x7c2c('0x11'));var hardwareService=require(_0x7c2c('0x12'));var logger=require(_0x7c2c('0x13'))(_0x7c2c('0x14'));var utils=require(_0x7c2c('0x15'));var config=require(_0x7c2c('0x16'));var licenseUtil=require(_0x7c2c('0x17'));var db=require(_0x7c2c('0x18'))['db'];function respondWithStatusCode(_0xae8441,_0x45847d){_0x45847d=_0x45847d||0xcc;return function(_0x68398a){if(_0x68398a){return _0xae8441[_0x7c2c('0x19')](_0x45847d);}return _0xae8441[_0x7c2c('0x1a')](_0x45847d)[_0x7c2c('0x1b')]();};}function respondWithResult(_0x4c4aaf,_0x5b5729){_0x5b5729=_0x5b5729||0xc8;return function(_0x102778){if(_0x102778){return _0x4c4aaf[_0x7c2c('0x1a')](_0x5b5729)[_0x7c2c('0x1c')](_0x102778);}};}function respondWithFilteredResult(_0x5ae94f,_0x11424c){return function(_0x206ecd){if(_0x206ecd){var _0x5e55e0=typeof _0x11424c[_0x7c2c('0x1d')]==='undefined'&&typeof _0x11424c[_0x7c2c('0x1e')]==='undefined';var _0x342ea2=_0x206ecd[_0x7c2c('0x1f')];var _0x14453f=_0x5e55e0?0x0:_0x11424c[_0x7c2c('0x1d')];var _0x17df4a=_0x5e55e0?_0x206ecd[_0x7c2c('0x1f')]:_0x11424c[_0x7c2c('0x1d')]+_0x11424c[_0x7c2c('0x1e')];var _0x2d356e;if(_0x17df4a>=_0x342ea2){_0x17df4a=_0x342ea2;_0x2d356e=0xc8;}else{_0x2d356e=0xce;}_0x5ae94f[_0x7c2c('0x1a')](_0x2d356e);return _0x5ae94f[_0x7c2c('0x20')](_0x7c2c('0x21'),_0x14453f+'-'+_0x17df4a+'/'+_0x342ea2)['json'](_0x206ecd);}return null;};}function patchUpdates(_0x1c5491){return function(_0x4adb62){try{jsonpatch['apply'](_0x4adb62,_0x1c5491,!![]);}catch(_0x15ae33){return BPromise[_0x7c2c('0x22')](_0x15ae33);}return _0x4adb62[_0x7c2c('0x23')]();};}function saveUpdates(_0x38ae30,_0x41552f){return function(_0x1883b5){if(_0x1883b5){return _0x1883b5[_0x7c2c('0x24')](_0x38ae30)['then'](function(_0x10c356){return _0x10c356;});}return null;};}function removeEntity(_0x4dedd8,_0x302c93){return function(_0x57f510){if(_0x57f510){return _0x57f510[_0x7c2c('0x25')]()[_0x7c2c('0x26')](function(){_0x4dedd8[_0x7c2c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d6ec7,_0x31a50c){return function(_0x30c53e){if(!_0x30c53e){_0x4d6ec7[_0x7c2c('0x19')](0x194);}return _0x30c53e;};}function handleError(_0x150690,_0x31d8f3){_0x31d8f3=_0x31d8f3||0x1f4;return function(_0xa8e145){logger[_0x7c2c('0x27')](_0xa8e145['stack']);if(_0xa8e145[_0x7c2c('0x28')]){delete _0xa8e145[_0x7c2c('0x28')];}_0x150690[_0x7c2c('0x1a')](_0x31d8f3)[_0x7c2c('0x29')](_0xa8e145);};}exports[_0x7c2c('0x2a')]=function(_0x1f8846,_0xf2bfd1){var _0x26f472={},_0xa040ff={},_0x5769ec={'count':0x0,'rows':[]};var _0x465ad6=_[_0x7c2c('0x2b')](db[_0x7c2c('0x2c')][_0x7c2c('0x2d')],function(_0x53ad23){return{'name':_0x53ad23[_0x7c2c('0x2e')],'type':_0x53ad23[_0x7c2c('0x2f')][_0x7c2c('0x30')]};});_0xa040ff[_0x7c2c('0x31')]=_[_0x7c2c('0x2b')](_0x465ad6,_0x7c2c('0x28'));_0xa040ff[_0x7c2c('0x32')]=_['keys'](_0x1f8846[_0x7c2c('0x32')]);_0xa040ff[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0xa040ff[_0x7c2c('0x31')],_0xa040ff[_0x7c2c('0x32')]);_0x26f472['attributes']=_['intersection'](_0xa040ff[_0x7c2c('0x31')],qs['fields'](_0x1f8846['query'][_0x7c2c('0x35')]));_0x26f472[_0x7c2c('0x36')]=_0x26f472[_0x7c2c('0x36')][_0x7c2c('0x37')]?_0x26f472['attributes']:_0xa040ff[_0x7c2c('0x31')];if(!_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x38')](_0x7c2c('0x39'))){_0x26f472[_0x7c2c('0x1e')]=qs[_0x7c2c('0x1e')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1e')]);_0x26f472[_0x7c2c('0x1d')]=qs[_0x7c2c('0x1d')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1d')]);}_0x26f472[_0x7c2c('0x3a')]=qs['sort'](_0x1f8846['query'][_0x7c2c('0x3b')]);_0x26f472['where']=qs['filters'](_['pick'](_0x1f8846[_0x7c2c('0x32')],_0xa040ff[_0x7c2c('0x33')]),_0x465ad6);if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]){_0x26f472[_0x7c2c('0x3d')]=_[_0x7c2c('0x3e')](_0x26f472[_0x7c2c('0x3d')],{'$or':_[_0x7c2c('0x2b')](_0x465ad6,function(_0x2b6520){if(_0x2b6520[_0x7c2c('0x2f')]!==_0x7c2c('0x3f')){var _0x58696a={};_0x58696a[_0x2b6520['name']]={'$like':'%'+_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]+'%'};return _0x58696a;}})});}_0x26f472=_[_0x7c2c('0x3e')]({},_0x26f472,_0x1f8846[_0x7c2c('0x40')]);var _0x5e8c96={'where':_0x26f472[_0x7c2c('0x3d')]};return db[_0x7c2c('0x2c')][_0x7c2c('0x1f')](_0x5e8c96)[_0x7c2c('0x26')](function(_0x18e288){_0x5769ec[_0x7c2c('0x1f')]=_0x18e288;if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x26f472[_0x7c2c('0x42')]=[{'all':!![]}];}return db['UserProfileResource'][_0x7c2c('0x43')](_0x26f472);})['then'](function(_0x2c3f40){_0x5769ec[_0x7c2c('0x44')]=_0x2c3f40;return _0x5769ec;})['then'](respondWithFilteredResult(_0xf2bfd1,_0x26f472))[_0x7c2c('0x45')](handleError(_0xf2bfd1,null));};exports['show']=function(_0x3014fb,_0x33b2be){var _0x9b9813={'raw':![],'where':{'id':_0x3014fb['params']['id']}},_0x26351e={};_0x26351e[_0x7c2c('0x31')]=_['keys'](db['UserProfileResource'][_0x7c2c('0x2d')]);_0x26351e[_0x7c2c('0x32')]=_[_0x7c2c('0x46')](_0x3014fb['query']);_0x26351e[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0x26351e['model'],_0x26351e[_0x7c2c('0x32')]);_0x9b9813['attributes']=_[_0x7c2c('0x34')](_0x26351e[_0x7c2c('0x31')],qs['fields'](_0x3014fb['query'][_0x7c2c('0x35')]));_0x9b9813[_0x7c2c('0x36')]=_0x9b9813['attributes'][_0x7c2c('0x37')]?_0x9b9813['attributes']:_0x26351e['model'];if(_0x3014fb[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x9b9813[_0x7c2c('0x42')]=[{'all':!![]}];}_0x9b9813=_[_0x7c2c('0x3e')]({},_0x9b9813,_0x3014fb[_0x7c2c('0x40')]);return db[_0x7c2c('0x2c')][_0x7c2c('0x47')](_0x9b9813)[_0x7c2c('0x26')](handleEntityNotFound(_0x33b2be,null))[_0x7c2c('0x26')](respondWithResult(_0x33b2be,null))['catch'](handleError(_0x33b2be,null));};exports['create']=function(_0xeb067b,_0x3091bd){return db[_0x7c2c('0x2c')]['create'](_0xeb067b['body'],{})[_0x7c2c('0x26')](respondWithResult(_0x3091bd,0xc9))[_0x7c2c('0x45')](handleError(_0x3091bd,null));};exports[_0x7c2c('0x24')]=function(_0x2b79d5,_0x5f3de8){if(_0x2b79d5['body']['id']){delete _0x2b79d5['body']['id'];}return db[_0x7c2c('0x2c')][_0x7c2c('0x47')]({'where':{'id':_0x2b79d5[_0x7c2c('0x48')]['id']}})[_0x7c2c('0x26')](handleEntityNotFound(_0x5f3de8,null))[_0x7c2c('0x26')](saveUpdates(_0x2b79d5['body'],null))[_0x7c2c('0x26')](respondWithResult(_0x5f3de8,null))[_0x7c2c('0x45')](handleError(_0x5f3de8,null));};exports['destroy']=function(_0x19621a,_0x56e09d){return db[_0x7c2c('0x2c')][_0x7c2c('0x47')]({'where':{'id':_0x19621a[_0x7c2c('0x48')]['id']}})['then'](handleEntityNotFound(_0x56e09d,null))['then'](removeEntity(_0x56e09d,null))[_0x7c2c('0x45')](handleError(_0x56e09d,null));};exports['describe']=function(_0x13e0bf,_0x11d337){return db['UserProfileResource'][_0x7c2c('0x49')]()[_0x7c2c('0x26')](respondWithResult(_0x11d337,null))['catch'](handleError(_0x11d337,null));}; \ No newline at end of file +var _0xc6ac=['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','describe','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','UserProfileResource','rawAttributes','fieldName','type','key','map','query','keys'];(function(_0x23c6f2,_0x4e033c){var _0x4c270b=function(_0x4913f0){while(--_0x4913f0){_0x23c6f2['push'](_0x23c6f2['shift']());}};_0x4c270b(++_0x4e033c);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x491e4c,_0x277acf){_0x491e4c=_0x491e4c-0x0;var _0x117ab8=_0xc6ac[_0x491e4c];return _0x117ab8;};'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['UserProfileResource'][_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));};exports[_0xcc6a('0x4f')]=function(_0x34531d,_0x14f5e5){return db[_0xcc6a('0x2d')]['describe']()['then'](respondWithResult(_0x14f5e5,null))[_0xcc6a('0x4b')](handleError(_0x14f5e5,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index f8d2186..cb82906 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 _0x4753=['request-promise','../../config/environment','./userProfileResource.attributes','exports','define','user_profile_has_resources','compositeIndex','resourceId','sectionId','util','../../config/logger','api','moment','bluebird'];(function(_0x315b02,_0x41721a){var _0x296e92=function(_0x2d205c){while(--_0x2d205c){_0x315b02['push'](_0x315b02['shift']());}};_0x296e92(++_0x41721a);}(_0x4753,0x19f));var _0x3475=function(_0x21a7e0,_0x5657db){_0x21a7e0=_0x21a7e0-0x0;var _0x4816bd=_0x4753[_0x21a7e0];return _0x4816bd;};'use strict';var _=require('lodash');var util=require(_0x3475('0x0'));var logger=require(_0x3475('0x1'))(_0x3475('0x2'));var moment=require(_0x3475('0x3'));var BPromise=require(_0x3475('0x4'));var rp=require(_0x3475('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3475('0x6'));var attributes=require(_0x3475('0x7'));module[_0x3475('0x8')]=function(_0x356a78,_0xfa0f2d){return _0x356a78[_0x3475('0x9')]('UserProfileResource',attributes,{'tableName':_0x3475('0xa'),'paranoid':![],'indexes':[{'name':_0x3475('0xb'),'fields':[_0x3475('0xc'),_0x3475('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfec5=['rimraf','../../config/environment','exports','UserProfileResource','user_profile_has_resources','sectionId','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0xfec5,0x88));var _0x5fec=function(_0x2b3c1f,_0x1c8c30){_0x2b3c1f=_0x2b3c1f-0x0;var _0x12235d=_0xfec5[_0x2b3c1f];return _0x12235d;};'use strict';var _=require(_0x5fec('0x0'));var util=require(_0x5fec('0x1'));var logger=require(_0x5fec('0x2'))(_0x5fec('0x3'));var moment=require('moment');var BPromise=require(_0x5fec('0x4'));var rp=require(_0x5fec('0x5'));var fs=require('fs');var path=require(_0x5fec('0x6'));var rimraf=require(_0x5fec('0x7'));var config=require(_0x5fec('0x8'));var attributes=require('./userProfileResource.attributes');module[_0x5fec('0x9')]=function(_0x486dab,_0x143bac){return _0x486dab['define'](_0x5fec('0xa'),attributes,{'tableName':_0x5fec('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['resourceId',_0x5fec('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 8a66ecd..4f933bc 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 _0x9ead=['UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','UserProfileResource,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','request\x20sent','debug'];(function(_0x3a92f1,_0x82d7fd){var _0x158c2e=function(_0xd48e2a){while(--_0xd48e2a){_0x3a92f1['push'](_0x3a92f1['shift']());}};_0x158c2e(++_0x82d7fd);}(_0x9ead,0xc4));var _0xd9ea=function(_0x368fc3,_0x2b7c2c){_0x368fc3=_0x368fc3-0x0;var _0x1fa4b2=_0x9ead[_0x368fc3];return _0x1fa4b2;};'use strict';var _=require(_0xd9ea('0x0'));var util=require('util');var moment=require(_0xd9ea('0x1'));var BPromise=require(_0xd9ea('0x2'));var rs=require(_0xd9ea('0x3'));var fs=require('fs');var Redis=require(_0xd9ea('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd9ea('0x5'))(_0xd9ea('0x6'));var config=require(_0xd9ea('0x7'));var jayson=require(_0xd9ea('0x8'));var client=jayson[_0xd9ea('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4684d8,_0x5c0b03,_0x382179){return new BPromise(function(_0x469464,_0x58cd67){return client['request'](_0x4684d8,_0x382179)['then'](function(_0xb27c91){logger[_0xd9ea('0xa')]('UserProfileResource,\x20%s,\x20%s',_0x5c0b03,_0xd9ea('0xb'));logger[_0xd9ea('0xc')](_0xd9ea('0xd'),_0x5c0b03,_0xd9ea('0xb'),JSON[_0xd9ea('0xe')](_0xb27c91));if(_0xb27c91['error']){if(_0xb27c91[_0xd9ea('0xf')]['code']===0x1f4){logger[_0xd9ea('0xf')](_0xd9ea('0x10'),_0x5c0b03,_0xb27c91[_0xd9ea('0xf')]['message']);return _0x58cd67(_0xb27c91[_0xd9ea('0xf')]['message']);}logger['error']('UserProfileResource,\x20%s,\x20%s',_0x5c0b03,_0xb27c91[_0xd9ea('0xf')][_0xd9ea('0x11')]);return _0x469464(_0xb27c91[_0xd9ea('0xf')]['message']);}else{logger[_0xd9ea('0xa')](_0xd9ea('0x10'),_0x5c0b03,_0xd9ea('0xb'));_0x469464(_0xb27c91['result'][_0xd9ea('0x11')]);}})[_0xd9ea('0x12')](function(_0x16ca86){logger[_0xd9ea('0xf')](_0xd9ea('0x10'),_0x5c0b03,_0x16ca86);_0x58cd67(_0x16ca86);});});} \ No newline at end of file +var _0xf314=['client','http','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2df84d,_0x56d874){var _0x2634ce=function(_0x8e8e31){while(--_0x8e8e31){_0x2df84d['push'](_0x2df84d['shift']());}};_0x2634ce(++_0x56d874);}(_0xf314,0x75));var _0x4f31=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xf314[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x4f31('0x0'));var util=require(_0x4f31('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f31('0x2'));var db=require(_0x4f31('0x3'))['db'];var utils=require(_0x4f31('0x4'));var logger=require(_0x4f31('0x5'))(_0x4f31('0x6'));var config=require(_0x4f31('0x7'));var jayson=require(_0x4f31('0x8'));var client=jayson[_0x4f31('0x9')][_0x4f31('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2769a1,_0x115ab4,_0x5296f){return new BPromise(function(_0x3a3d8b,_0x3d9dc4){return client['request'](_0x2769a1,_0x5296f)[_0x4f31('0xb')](function(_0x490a8e){logger[_0x4f31('0xc')](_0x4f31('0xd'),_0x115ab4,_0x4f31('0xe'));logger[_0x4f31('0xf')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x115ab4,_0x4f31('0xe'),JSON[_0x4f31('0x10')](_0x490a8e));if(_0x490a8e[_0x4f31('0x11')]){if(_0x490a8e['error'][_0x4f31('0x12')]===0x1f4){logger[_0x4f31('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x115ab4,_0x490a8e[_0x4f31('0x11')][_0x4f31('0x13')]);return _0x3d9dc4(_0x490a8e['error'][_0x4f31('0x13')]);}logger['error'](_0x4f31('0xd'),_0x115ab4,_0x490a8e['error'][_0x4f31('0x13')]);return _0x3a3d8b(_0x490a8e['error'][_0x4f31('0x13')]);}else{logger[_0x4f31('0xc')]('UserProfileResource,\x20%s,\x20%s',_0x115ab4,_0x4f31('0xe'));_0x3a3d8b(_0x490a8e['result']['message']);}})[_0x4f31('0x14')](function(_0xcbfe53){logger[_0x4f31('0x11')](_0x4f31('0xd'),_0x115ab4,_0xcbfe53);_0x3d9dc4(_0xcbfe53);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 1923f14..627c1e4 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 _0x6016=['../../config/environment','./userProfileSection.controller','isAuthenticated','index','get','/:id','post','create','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x127f8a,_0x3f1c55){var _0x396d8e=function(_0x59d9c6){while(--_0x59d9c6){_0x127f8a['push'](_0x127f8a['shift']());}};_0x396d8e(++_0x3f1c55);}(_0x6016,0x162));var _0x6601=function(_0x59d0cc,_0xa7c52b){_0x59d0cc=_0x59d0cc-0x0;var _0x2ae79f=_0x6016[_0x59d0cc];return _0x2ae79f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6601('0x0'));var timeout=require(_0x6601('0x1'));var express=require(_0x6601('0x2'));var router=express[_0x6601('0x3')]();var fs_extra=require(_0x6601('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6601('0x5'));var config=require(_0x6601('0x6'));var controller=require(_0x6601('0x7'));router['get']('/',auth[_0x6601('0x8')](),controller[_0x6601('0x9')]);router[_0x6601('0xa')]('/describe',auth[_0x6601('0x8')](),controller['describe']);router['get'](_0x6601('0xb'),auth[_0x6601('0x8')](),controller['show']);router[_0x6601('0xc')]('/',auth[_0x6601('0x8')](),controller[_0x6601('0xd')]);router['put'](_0x6601('0xb'),auth[_0x6601('0x8')](),controller[_0x6601('0xe')]);router[_0x6601('0xf')](_0x6601('0xb'),auth[_0x6601('0x8')](),controller[_0x6601('0x10')]);module[_0x6601('0x11')]=router; \ No newline at end of file +var _0x9217=['describe','/:id','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','isAuthenticated'];(function(_0x1c188f,_0x5ef40f){var _0x381011=function(_0x450b18){while(--_0x450b18){_0x1c188f['push'](_0x1c188f['shift']());}};_0x381011(++_0x5ef40f);}(_0x9217,0x198));var _0x7921=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9217[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7921('0x0'));var util=require(_0x7921('0x1'));var path=require(_0x7921('0x2'));var timeout=require(_0x7921('0x3'));var express=require(_0x7921('0x4'));var router=express[_0x7921('0x5')]();var fs_extra=require(_0x7921('0x6'));var auth=require(_0x7921('0x7'));var interaction=require(_0x7921('0x8'));var config=require(_0x7921('0x9'));var controller=require(_0x7921('0xa'));router['get']('/',auth[_0x7921('0xb')](),controller['index']);router['get']('/describe',auth[_0x7921('0xb')](),controller[_0x7921('0xc')]);router['get'](_0x7921('0xd'),auth[_0x7921('0xb')](),controller['show']);router[_0x7921('0xe')]('/',auth['isAuthenticated'](),controller[_0x7921('0xf')]);router[_0x7921('0x10')](_0x7921('0xd'),auth[_0x7921('0xb')](),controller['update']);router[_0x7921('0x11')]('/:id',auth[_0x7921('0xb')](),controller[_0x7921('0x12')]);module[_0x7921('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 935c61f..7757a27 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 _0x6cb4=['exports','STRING','INTEGER','BOOLEAN','crudPermissions','getDataValue','split','sequelize'];(function(_0x3ab78b,_0x1f0f58){var _0x2a5138=function(_0x406d3f){while(--_0x406d3f){_0x3ab78b['push'](_0x3ab78b['shift']());}};_0x2a5138(++_0x1f0f58);}(_0x6cb4,0xff));var _0x46cb=function(_0x857129,_0x3223aa){_0x857129=_0x857129-0x0;var _0x1253af=_0x6cb4[_0x857129];return _0x1253af;};'use strict';var Sequelize=require(_0x46cb('0x0'));module[_0x46cb('0x1')]={'name':{'type':Sequelize[_0x46cb('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x46cb('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x46cb('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x46cb('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x46cb('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x46cb('0x2')],'set':function(_0x2efd19){this['setDataValue'](_0x46cb('0x5'),_0x2efd19?_0x2efd19['join'](''):[]);},'get':function(){return this[_0x46cb('0x6')]('crudPermissions')?this[_0x46cb('0x6')](_0x46cb('0x5'))[_0x46cb('0x7')](''):[];}}}; \ No newline at end of file +var _0x0565=['exports','STRING','INTEGER','BOOLEAN','setDataValue','join','getDataValue','crudPermissions','sequelize'];(function(_0x337d63,_0x6f538e){var _0x3a124b=function(_0x9a477e){while(--_0x9a477e){_0x337d63['push'](_0x337d63['shift']());}};_0x3a124b(++_0x6f538e);}(_0x0565,0xf2));var _0x5056=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0x0565[_0x46d0c9];return _0x174506;};'use strict';var Sequelize=require(_0x5056('0x0'));module[_0x5056('0x1')]={'name':{'type':Sequelize[_0x5056('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x5056('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x5056('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x5056('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x5056('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x5056('0x2')],'set':function(_0x3657a8){this[_0x5056('0x5')]('crudPermissions',_0x3657a8?_0x3657a8[_0x5056('0x6')](''):[]);},'get':function(){return this[_0x5056('0x7')](_0x5056('0x8'))?this[_0x5056('0x7')]('crudPermissions')['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 1f1a6a7..cff7647 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 _0xff63=['filter','merge','VIRTUAL','rows','catch','show','params','model','includeAll','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','error','name','send','index','UserProfileSection','rawAttributes','type','key','map','keys','query','fields','attributes','length','hasOwnProperty','offset','order','sort','where','filters','pick'];(function(_0x56b36b,_0x322730){var _0x2996ea=function(_0x41e97b){while(--_0x41e97b){_0x56b36b['push'](_0x56b36b['shift']());}};_0x2996ea(++_0x322730);}(_0xff63,0xec));var _0x3ff6=function(_0x444c1f,_0x1bbab1){_0x444c1f=_0x444c1f-0x0;var _0x2d9d3c=_0xff63[_0x444c1f];return _0x2d9d3c;};'use strict';var emlformat=require(_0x3ff6('0x0'));var rimraf=require(_0x3ff6('0x1'));var zipdir=require(_0x3ff6('0x2'));var jsonpatch=require(_0x3ff6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3ff6('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3ff6('0x5'));var sox=require(_0x3ff6('0x6'));var csv=require(_0x3ff6('0x7'));var ejs=require(_0x3ff6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3ff6('0x9'));var squel=require('squel');var crypto=require(_0x3ff6('0xa'));var jsforce=require(_0x3ff6('0xb'));var deskjs=require(_0x3ff6('0xc'));var toCsv=require(_0x3ff6('0x7'));var querystring=require(_0x3ff6('0xd'));var Papa=require(_0x3ff6('0xe'));var Redis=require(_0x3ff6('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3ff6('0x10'));var as=require(_0x3ff6('0x11'));var hardwareService=require(_0x3ff6('0x12'));var logger=require('../../config/logger')(_0x3ff6('0x13'));var utils=require(_0x3ff6('0x14'));var config=require(_0x3ff6('0x15'));var licenseUtil=require(_0x3ff6('0x16'));var db=require(_0x3ff6('0x17'))['db'];function respondWithStatusCode(_0x6448d8,_0x4aacb8){_0x4aacb8=_0x4aacb8||0xcc;return function(_0x4e2378){if(_0x4e2378){return _0x6448d8[_0x3ff6('0x18')](_0x4aacb8);}return _0x6448d8[_0x3ff6('0x19')](_0x4aacb8)[_0x3ff6('0x1a')]();};}function respondWithResult(_0x5e3956,_0x231bb6){_0x231bb6=_0x231bb6||0xc8;return function(_0x1e9f65){if(_0x1e9f65){return _0x5e3956[_0x3ff6('0x19')](_0x231bb6)['json'](_0x1e9f65);}};}function respondWithFilteredResult(_0xa315,_0x2900f5){return function(_0x4a9dee){if(_0x4a9dee){var _0xb7badd=typeof _0x2900f5['offset']===_0x3ff6('0x1b')&&typeof _0x2900f5['limit']===_0x3ff6('0x1b');var _0x11e04c=_0x4a9dee['count'];var _0x1b145d=_0xb7badd?0x0:_0x2900f5['offset'];var _0x3bce98=_0xb7badd?_0x4a9dee[_0x3ff6('0x1c')]:_0x2900f5['offset']+_0x2900f5[_0x3ff6('0x1d')];var _0x2a13d7;if(_0x3bce98>=_0x11e04c){_0x3bce98=_0x11e04c;_0x2a13d7=0xc8;}else{_0x2a13d7=0xce;}_0xa315['status'](_0x2a13d7);return _0xa315[_0x3ff6('0x1e')](_0x3ff6('0x1f'),_0x1b145d+'-'+_0x3bce98+'/'+_0x11e04c)[_0x3ff6('0x20')](_0x4a9dee);}return null;};}function patchUpdates(_0x3dfef1){return function(_0x1a4092){try{jsonpatch[_0x3ff6('0x21')](_0x1a4092,_0x3dfef1,!![]);}catch(_0x134604){return BPromise[_0x3ff6('0x22')](_0x134604);}return _0x1a4092[_0x3ff6('0x23')]();};}function saveUpdates(_0x13c6d3,_0x3e7502){return function(_0x3206b9){if(_0x3206b9){return _0x3206b9[_0x3ff6('0x24')](_0x13c6d3)['then'](function(_0x1f26ef){return _0x1f26ef;});}return null;};}function removeEntity(_0x5737d1,_0x5ae163){return function(_0x415e1f){if(_0x415e1f){return _0x415e1f[_0x3ff6('0x25')]()[_0x3ff6('0x26')](function(){_0x5737d1['status'](0xcc)[_0x3ff6('0x1a')]();});}};}function handleEntityNotFound(_0x5aa137,_0xbb302){return function(_0x4cc5bf){if(!_0x4cc5bf){_0x5aa137[_0x3ff6('0x18')](0x194);}return _0x4cc5bf;};}function handleError(_0x1a3f85,_0x5ac7b9){_0x5ac7b9=_0x5ac7b9||0x1f4;return function(_0x1fddd0){logger[_0x3ff6('0x27')](_0x1fddd0['stack']);if(_0x1fddd0[_0x3ff6('0x28')]){delete _0x1fddd0[_0x3ff6('0x28')];}_0x1a3f85[_0x3ff6('0x19')](_0x5ac7b9)[_0x3ff6('0x29')](_0x1fddd0);};}exports[_0x3ff6('0x2a')]=function(_0x2e0f3e,_0x185153){var _0x41c106={},_0x3593e1={},_0x1eabb3={'count':0x0,'rows':[]};var _0xf62a2=_['map'](db[_0x3ff6('0x2b')][_0x3ff6('0x2c')],function(_0x297351){return{'name':_0x297351['fieldName'],'type':_0x297351[_0x3ff6('0x2d')][_0x3ff6('0x2e')]};});_0x3593e1['model']=_[_0x3ff6('0x2f')](_0xf62a2,_0x3ff6('0x28'));_0x3593e1['query']=_[_0x3ff6('0x30')](_0x2e0f3e[_0x3ff6('0x31')]);_0x3593e1['filters']=_['intersection'](_0x3593e1['model'],_0x3593e1['query']);_0x41c106['attributes']=_['intersection'](_0x3593e1['model'],qs[_0x3ff6('0x32')](_0x2e0f3e[_0x3ff6('0x31')][_0x3ff6('0x32')]));_0x41c106[_0x3ff6('0x33')]=_0x41c106[_0x3ff6('0x33')][_0x3ff6('0x34')]?_0x41c106[_0x3ff6('0x33')]:_0x3593e1['model'];if(!_0x2e0f3e['query'][_0x3ff6('0x35')]('nolimit')){_0x41c106[_0x3ff6('0x1d')]=qs[_0x3ff6('0x1d')](_0x2e0f3e['query'][_0x3ff6('0x1d')]);_0x41c106[_0x3ff6('0x36')]=qs['offset'](_0x2e0f3e['query']['offset']);}_0x41c106[_0x3ff6('0x37')]=qs[_0x3ff6('0x38')](_0x2e0f3e[_0x3ff6('0x31')][_0x3ff6('0x38')]);_0x41c106[_0x3ff6('0x39')]=qs[_0x3ff6('0x3a')](_[_0x3ff6('0x3b')](_0x2e0f3e[_0x3ff6('0x31')],_0x3593e1[_0x3ff6('0x3a')]),_0xf62a2);if(_0x2e0f3e[_0x3ff6('0x31')][_0x3ff6('0x3c')]){_0x41c106[_0x3ff6('0x39')]=_[_0x3ff6('0x3d')](_0x41c106[_0x3ff6('0x39')],{'$or':_[_0x3ff6('0x2f')](_0xf62a2,function(_0x18b5e7){if(_0x18b5e7[_0x3ff6('0x2d')]!==_0x3ff6('0x3e')){var _0x429ca2={};_0x429ca2[_0x18b5e7['name']]={'$like':'%'+_0x2e0f3e[_0x3ff6('0x31')][_0x3ff6('0x3c')]+'%'};return _0x429ca2;}})});}_0x41c106=_['merge']({},_0x41c106,_0x2e0f3e['options']);var _0x2a0c2d={'where':_0x41c106[_0x3ff6('0x39')]};return db['UserProfileSection']['count'](_0x2a0c2d)[_0x3ff6('0x26')](function(_0x4ab703){_0x1eabb3[_0x3ff6('0x1c')]=_0x4ab703;if(_0x2e0f3e[_0x3ff6('0x31')]['includeAll']){_0x41c106['include']=[{'all':!![]}];}return db[_0x3ff6('0x2b')]['findAll'](_0x41c106);})[_0x3ff6('0x26')](function(_0x24928c){_0x1eabb3[_0x3ff6('0x3f')]=_0x24928c;return _0x1eabb3;})[_0x3ff6('0x26')](respondWithFilteredResult(_0x185153,_0x41c106))[_0x3ff6('0x40')](handleError(_0x185153,null));};exports[_0x3ff6('0x41')]=function(_0x826c2e,_0x1ea52f){var _0x3c08f1={'raw':![],'where':{'id':_0x826c2e[_0x3ff6('0x42')]['id']}},_0x5b1314={};_0x5b1314[_0x3ff6('0x43')]=_[_0x3ff6('0x30')](db[_0x3ff6('0x2b')][_0x3ff6('0x2c')]);_0x5b1314[_0x3ff6('0x31')]=_[_0x3ff6('0x30')](_0x826c2e[_0x3ff6('0x31')]);_0x5b1314[_0x3ff6('0x3a')]=_['intersection'](_0x5b1314[_0x3ff6('0x43')],_0x5b1314[_0x3ff6('0x31')]);_0x3c08f1['attributes']=_['intersection'](_0x5b1314['model'],qs[_0x3ff6('0x32')](_0x826c2e[_0x3ff6('0x31')][_0x3ff6('0x32')]));_0x3c08f1[_0x3ff6('0x33')]=_0x3c08f1[_0x3ff6('0x33')]['length']?_0x3c08f1[_0x3ff6('0x33')]:_0x5b1314[_0x3ff6('0x43')];if(_0x826c2e['query'][_0x3ff6('0x44')]){_0x3c08f1['include']=[{'all':!![]}];}_0x3c08f1=_['merge']({},_0x3c08f1,_0x826c2e[_0x3ff6('0x45')]);return db['UserProfileSection']['find'](_0x3c08f1)['then'](handleEntityNotFound(_0x1ea52f,null))[_0x3ff6('0x26')](respondWithResult(_0x1ea52f,null))[_0x3ff6('0x40')](handleError(_0x1ea52f,null));};exports['create']=function(_0x495cf4,_0x3a2498){return db['UserProfileSection'][_0x3ff6('0x46')](_0x495cf4[_0x3ff6('0x47')],{})[_0x3ff6('0x26')](respondWithResult(_0x3a2498,0xc9))[_0x3ff6('0x40')](handleError(_0x3a2498,null));};exports[_0x3ff6('0x24')]=function(_0x584646,_0x2284c2){if(_0x584646[_0x3ff6('0x47')]['id']){delete _0x584646['body']['id'];}return db[_0x3ff6('0x2b')][_0x3ff6('0x48')]({'where':{'id':_0x584646[_0x3ff6('0x42')]['id']}})[_0x3ff6('0x26')](handleEntityNotFound(_0x2284c2,null))[_0x3ff6('0x26')](saveUpdates(_0x584646['body'],null))[_0x3ff6('0x26')](respondWithResult(_0x2284c2,null))[_0x3ff6('0x40')](handleError(_0x2284c2,null));};exports[_0x3ff6('0x25')]=function(_0x418872,_0x476bcd){return db[_0x3ff6('0x2b')][_0x3ff6('0x48')]({'where':{'id':_0x418872[_0x3ff6('0x42')]['id']}})[_0x3ff6('0x26')](handleEntityNotFound(_0x476bcd,null))[_0x3ff6('0x26')](removeEntity(_0x476bcd,null))[_0x3ff6('0x40')](handleError(_0x476bcd,null));};exports[_0x3ff6('0x49')]=function(_0x2d0f9,_0xb2d7a2){return db[_0x3ff6('0x2b')][_0x3ff6('0x49')]()[_0x3ff6('0x26')](respondWithResult(_0xb2d7a2,null))['catch'](handleError(_0xb2d7a2,null));}; \ No newline at end of file +var _0xe394=['fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','UserProfileSection','rawAttributes'];(function(_0x22797b,_0x157344){var _0x3e448d=function(_0x259f82){while(--_0x259f82){_0x22797b['push'](_0x22797b['shift']());}};_0x3e448d(++_0x157344);}(_0xe394,0x1a0));var _0x4e39=function(_0x54846d,_0x142caf){_0x54846d=_0x54846d-0x0;var _0xd8df81=_0xe394[_0x54846d];return _0xd8df81;};'use strict';var emlformat=require(_0x4e39('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4e39('0x1'));var jsonpatch=require(_0x4e39('0x2'));var rp=require(_0x4e39('0x3'));var moment=require(_0x4e39('0x4'));var BPromise=require(_0x4e39('0x5'));var Mustache=require(_0x4e39('0x6'));var util=require('util');var path=require(_0x4e39('0x7'));var sox=require(_0x4e39('0x8'));var csv=require(_0x4e39('0x9'));var ejs=require(_0x4e39('0xa'));var fs=require('fs');var fs_extra=require(_0x4e39('0xb'));var _=require(_0x4e39('0xc'));var squel=require(_0x4e39('0xd'));var crypto=require(_0x4e39('0xe'));var jsforce=require(_0x4e39('0xf'));var deskjs=require(_0x4e39('0x10'));var toCsv=require(_0x4e39('0x9'));var querystring=require('querystring');var Papa=require(_0x4e39('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4e39('0x12'));var as=require(_0x4e39('0x13'));var hardwareService=require(_0x4e39('0x14'));var logger=require(_0x4e39('0x15'))(_0x4e39('0x16'));var utils=require(_0x4e39('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4e39('0x18'));var db=require(_0x4e39('0x19'))['db'];function respondWithStatusCode(_0x24484f,_0x134436){_0x134436=_0x134436||0xcc;return function(_0x221716){if(_0x221716){return _0x24484f[_0x4e39('0x1a')](_0x134436);}return _0x24484f[_0x4e39('0x1b')](_0x134436)[_0x4e39('0x1c')]();};}function respondWithResult(_0xfadcae,_0x302f8f){_0x302f8f=_0x302f8f||0xc8;return function(_0x2ab0bc){if(_0x2ab0bc){return _0xfadcae['status'](_0x302f8f)[_0x4e39('0x1d')](_0x2ab0bc);}};}function respondWithFilteredResult(_0x3c92e0,_0x5e958c){return function(_0x574f32){if(_0x574f32){var _0x38e046=typeof _0x5e958c[_0x4e39('0x1e')]==='undefined'&&typeof _0x5e958c[_0x4e39('0x1f')]==='undefined';var _0x367556=_0x574f32['count'];var _0x261a63=_0x38e046?0x0:_0x5e958c[_0x4e39('0x1e')];var _0x266caf=_0x38e046?_0x574f32[_0x4e39('0x20')]:_0x5e958c['offset']+_0x5e958c[_0x4e39('0x1f')];var _0x5187a0;if(_0x266caf>=_0x367556){_0x266caf=_0x367556;_0x5187a0=0xc8;}else{_0x5187a0=0xce;}_0x3c92e0[_0x4e39('0x1b')](_0x5187a0);return _0x3c92e0['set'](_0x4e39('0x21'),_0x261a63+'-'+_0x266caf+'/'+_0x367556)[_0x4e39('0x1d')](_0x574f32);}return null;};}function patchUpdates(_0x3087de){return function(_0x107bfc){try{jsonpatch[_0x4e39('0x22')](_0x107bfc,_0x3087de,!![]);}catch(_0x57a25c){return BPromise[_0x4e39('0x23')](_0x57a25c);}return _0x107bfc[_0x4e39('0x24')]();};}function saveUpdates(_0x47e5d3,_0x472219){return function(_0x4dfa49){if(_0x4dfa49){return _0x4dfa49[_0x4e39('0x25')](_0x47e5d3)[_0x4e39('0x26')](function(_0x5000e1){return _0x5000e1;});}return null;};}function removeEntity(_0x55d84f,_0x374bd4){return function(_0x31dfab){if(_0x31dfab){return _0x31dfab[_0x4e39('0x27')]()[_0x4e39('0x26')](function(){_0x55d84f[_0x4e39('0x1b')](0xcc)[_0x4e39('0x1c')]();});}};}function handleEntityNotFound(_0x1ec896,_0x42c6f7){return function(_0x3bd576){if(!_0x3bd576){_0x1ec896[_0x4e39('0x1a')](0x194);}return _0x3bd576;};}function handleError(_0x2db04a,_0x4c44ed){_0x4c44ed=_0x4c44ed||0x1f4;return function(_0x5565a1){logger[_0x4e39('0x28')](_0x5565a1['stack']);if(_0x5565a1['name']){delete _0x5565a1[_0x4e39('0x29')];}_0x2db04a['status'](_0x4c44ed)['send'](_0x5565a1);};}exports[_0x4e39('0x2a')]=function(_0x2605cb,_0x18c73a){var _0x7b1f8b={},_0x4c1af7={},_0x2a1289={'count':0x0,'rows':[]};var _0x5a2459=_[_0x4e39('0x2b')](db[_0x4e39('0x2c')][_0x4e39('0x2d')],function(_0x3d120c){return{'name':_0x3d120c[_0x4e39('0x2e')],'type':_0x3d120c[_0x4e39('0x2f')][_0x4e39('0x30')]};});_0x4c1af7[_0x4e39('0x31')]=_[_0x4e39('0x2b')](_0x5a2459,_0x4e39('0x29'));_0x4c1af7['query']=_['keys'](_0x2605cb[_0x4e39('0x32')]);_0x4c1af7['filters']=_[_0x4e39('0x33')](_0x4c1af7[_0x4e39('0x31')],_0x4c1af7[_0x4e39('0x32')]);_0x7b1f8b[_0x4e39('0x34')]=_[_0x4e39('0x33')](_0x4c1af7['model'],qs[_0x4e39('0x35')](_0x2605cb[_0x4e39('0x32')][_0x4e39('0x35')]));_0x7b1f8b[_0x4e39('0x34')]=_0x7b1f8b[_0x4e39('0x34')][_0x4e39('0x36')]?_0x7b1f8b[_0x4e39('0x34')]:_0x4c1af7[_0x4e39('0x31')];if(!_0x2605cb['query'][_0x4e39('0x37')]('nolimit')){_0x7b1f8b[_0x4e39('0x1f')]=qs[_0x4e39('0x1f')](_0x2605cb[_0x4e39('0x32')][_0x4e39('0x1f')]);_0x7b1f8b[_0x4e39('0x1e')]=qs[_0x4e39('0x1e')](_0x2605cb['query']['offset']);}_0x7b1f8b[_0x4e39('0x38')]=qs[_0x4e39('0x39')](_0x2605cb[_0x4e39('0x32')][_0x4e39('0x39')]);_0x7b1f8b[_0x4e39('0x3a')]=qs[_0x4e39('0x3b')](_[_0x4e39('0x3c')](_0x2605cb[_0x4e39('0x32')],_0x4c1af7['filters']),_0x5a2459);if(_0x2605cb[_0x4e39('0x32')][_0x4e39('0x3d')]){_0x7b1f8b[_0x4e39('0x3a')]=_[_0x4e39('0x3e')](_0x7b1f8b[_0x4e39('0x3a')],{'$or':_[_0x4e39('0x2b')](_0x5a2459,function(_0x4cda09){if(_0x4cda09[_0x4e39('0x2f')]!==_0x4e39('0x3f')){var _0x508529={};_0x508529[_0x4cda09[_0x4e39('0x29')]]={'$like':'%'+_0x2605cb[_0x4e39('0x32')][_0x4e39('0x3d')]+'%'};return _0x508529;}})});}_0x7b1f8b=_[_0x4e39('0x3e')]({},_0x7b1f8b,_0x2605cb[_0x4e39('0x40')]);var _0x7624a8={'where':_0x7b1f8b[_0x4e39('0x3a')]};return db[_0x4e39('0x2c')][_0x4e39('0x20')](_0x7624a8)['then'](function(_0x1ae811){_0x2a1289[_0x4e39('0x20')]=_0x1ae811;if(_0x2605cb[_0x4e39('0x32')][_0x4e39('0x41')]){_0x7b1f8b[_0x4e39('0x42')]=[{'all':!![]}];}return db[_0x4e39('0x2c')][_0x4e39('0x43')](_0x7b1f8b);})[_0x4e39('0x26')](function(_0x265895){_0x2a1289[_0x4e39('0x44')]=_0x265895;return _0x2a1289;})[_0x4e39('0x26')](respondWithFilteredResult(_0x18c73a,_0x7b1f8b))[_0x4e39('0x45')](handleError(_0x18c73a,null));};exports[_0x4e39('0x46')]=function(_0x1cc449,_0x3e5d82){var _0x5be565={'raw':![],'where':{'id':_0x1cc449[_0x4e39('0x47')]['id']}},_0xd04133={};_0xd04133[_0x4e39('0x31')]=_[_0x4e39('0x48')](db[_0x4e39('0x2c')][_0x4e39('0x2d')]);_0xd04133['query']=_['keys'](_0x1cc449[_0x4e39('0x32')]);_0xd04133[_0x4e39('0x3b')]=_[_0x4e39('0x33')](_0xd04133[_0x4e39('0x31')],_0xd04133['query']);_0x5be565['attributes']=_['intersection'](_0xd04133[_0x4e39('0x31')],qs['fields'](_0x1cc449[_0x4e39('0x32')]['fields']));_0x5be565['attributes']=_0x5be565['attributes'][_0x4e39('0x36')]?_0x5be565[_0x4e39('0x34')]:_0xd04133[_0x4e39('0x31')];if(_0x1cc449['query'][_0x4e39('0x41')]){_0x5be565['include']=[{'all':!![]}];}_0x5be565=_['merge']({},_0x5be565,_0x1cc449[_0x4e39('0x40')]);return db['UserProfileSection'][_0x4e39('0x49')](_0x5be565)['then'](handleEntityNotFound(_0x3e5d82,null))[_0x4e39('0x26')](respondWithResult(_0x3e5d82,null))[_0x4e39('0x45')](handleError(_0x3e5d82,null));};exports['create']=function(_0x162a8f,_0x3d7a9a){return db[_0x4e39('0x2c')][_0x4e39('0x4a')](_0x162a8f[_0x4e39('0x4b')],{})[_0x4e39('0x26')](respondWithResult(_0x3d7a9a,0xc9))[_0x4e39('0x45')](handleError(_0x3d7a9a,null));};exports[_0x4e39('0x25')]=function(_0x2b4473,_0x50bb0d){if(_0x2b4473['body']['id']){delete _0x2b4473[_0x4e39('0x4b')]['id'];}return db[_0x4e39('0x2c')][_0x4e39('0x49')]({'where':{'id':_0x2b4473[_0x4e39('0x47')]['id']}})['then'](handleEntityNotFound(_0x50bb0d,null))[_0x4e39('0x26')](saveUpdates(_0x2b4473[_0x4e39('0x4b')],null))['then'](respondWithResult(_0x50bb0d,null))[_0x4e39('0x45')](handleError(_0x50bb0d,null));};exports[_0x4e39('0x27')]=function(_0x1f54be,_0x3932c3){return db[_0x4e39('0x2c')][_0x4e39('0x49')]({'where':{'id':_0x1f54be[_0x4e39('0x47')]['id']}})[_0x4e39('0x26')](handleEntityNotFound(_0x3932c3,null))['then'](removeEntity(_0x3932c3,null))[_0x4e39('0x45')](handleError(_0x3932c3,null));};exports[_0x4e39('0x4c')]=function(_0x1eaca8,_0x290753){return db[_0x4e39('0x2c')][_0x4e39('0x4c')]()['then'](respondWithResult(_0x290753,null))[_0x4e39('0x45')](handleError(_0x290753,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 27c537a..c17925c 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 _0xea12=['../../config/logger','bluebird','request-promise','path','rimraf','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','lodash','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xea12,0x136));var _0x2ea1=function(_0x4cbe2c,_0x4d0cd2){_0x4cbe2c=_0x4cbe2c-0x0;var _0x38ccd3=_0xea12[_0x4cbe2c];return _0x38ccd3;};'use strict';var _=require(_0x2ea1('0x0'));var util=require(_0x2ea1('0x1'));var logger=require(_0x2ea1('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2ea1('0x3'));var rp=require(_0x2ea1('0x4'));var fs=require('fs');var path=require(_0x2ea1('0x5'));var rimraf=require(_0x2ea1('0x6'));var config=require('../../config/environment');var attributes=require('./userProfileSection.attributes');module['exports']=function(_0x347b8f,_0x1a151d){return _0x347b8f[_0x2ea1('0x7')](_0x2ea1('0x8'),attributes,{'tableName':_0x2ea1('0x9'),'paranoid':![],'indexes':[{'name':_0x2ea1('0xa'),'fields':[_0x2ea1('0xb'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x35b9=['./userProfileSection.attributes','exports','UserProfileSection','user_profile_has_sections','compositeIndex','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x180ff9,_0x14d614){var _0x3d9e26=function(_0x873100){while(--_0x873100){_0x180ff9['push'](_0x180ff9['shift']());}};_0x3d9e26(++_0x14d614);}(_0x35b9,0x75));var _0x935b=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x35b9[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x935b('0x0'));var util=require(_0x935b('0x1'));var logger=require(_0x935b('0x2'))(_0x935b('0x3'));var moment=require(_0x935b('0x4'));var BPromise=require(_0x935b('0x5'));var rp=require(_0x935b('0x6'));var fs=require('fs');var path=require(_0x935b('0x7'));var rimraf=require('rimraf');var config=require(_0x935b('0x8'));var attributes=require(_0x935b('0x9'));module[_0x935b('0xa')]=function(_0x576d19,_0x3bf509){return _0x576d19['define'](_0x935b('0xb'),attributes,{'tableName':_0x935b('0xc'),'paranoid':![],'indexes':[{'name':_0x935b('0xd'),'fields':['sectionId','userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 1ce55f6..7055fe9 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 _0x0200=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','request','then','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','UserProfileSection,\x20%s,\x20%s','message','info'];(function(_0x4c2f0d,_0x50b78e){var _0x5543cf=function(_0x4bc2fb){while(--_0x4bc2fb){_0x4c2f0d['push'](_0x4c2f0d['shift']());}};_0x5543cf(++_0x50b78e);}(_0x0200,0x17d));var _0x0020=function(_0x53aaf8,_0x863bcb){_0x53aaf8=_0x53aaf8-0x0;var _0x1fedb1=_0x0200[_0x53aaf8];return _0x1fedb1;};'use strict';var _=require(_0x0020('0x0'));var util=require(_0x0020('0x1'));var moment=require(_0x0020('0x2'));var BPromise=require('bluebird');var rs=require(_0x0020('0x3'));var fs=require('fs');var Redis=require(_0x0020('0x4'));var db=require(_0x0020('0x5'))['db'];var utils=require(_0x0020('0x6'));var logger=require(_0x0020('0x7'))(_0x0020('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x20ad02,_0x44aef9,_0x1f497e){return new BPromise(function(_0x4665bd,_0x241a76){return client[_0x0020('0x9')](_0x20ad02,_0x1f497e)[_0x0020('0xa')](function(_0x2a5e8e){logger['info']('UserProfileSection,\x20%s,\x20%s',_0x44aef9,_0x0020('0xb'));logger[_0x0020('0xc')](_0x0020('0xd'),_0x44aef9,_0x0020('0xb'),JSON[_0x0020('0xe')](_0x2a5e8e));if(_0x2a5e8e['error']){if(_0x2a5e8e[_0x0020('0xf')]['code']===0x1f4){logger[_0x0020('0xf')](_0x0020('0x10'),_0x44aef9,_0x2a5e8e[_0x0020('0xf')][_0x0020('0x11')]);return _0x241a76(_0x2a5e8e['error'][_0x0020('0x11')]);}logger[_0x0020('0xf')](_0x0020('0x10'),_0x44aef9,_0x2a5e8e[_0x0020('0xf')][_0x0020('0x11')]);return _0x4665bd(_0x2a5e8e[_0x0020('0xf')][_0x0020('0x11')]);}else{logger[_0x0020('0x12')](_0x0020('0x10'),_0x44aef9,_0x0020('0xb'));_0x4665bd(_0x2a5e8e['result'][_0x0020('0x11')]);}})[_0x0020('0x13')](function(_0x38418e){logger[_0x0020('0xf')](_0x0020('0x10'),_0x44aef9,_0x38418e);_0x241a76(_0x38418e);});});} \ No newline at end of file +var _0x1561=['request\x20sent','debug','error','code','message','result','catch','UserProfileSection,\x20%s,\x20%s','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0xc115,_0x15db6a){var _0x40fe25=function(_0x7bb5a3){while(--_0x7bb5a3){_0xc115['push'](_0xc115['shift']());}};_0x40fe25(++_0x15db6a);}(_0x1561,0x1bd));var _0x1156=function(_0x9a5938,_0x5cd7c0){_0x9a5938=_0x9a5938-0x0;var _0x4ffa63=_0x1561[_0x9a5938];return _0x4ffa63;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1156('0x0'));var BPromise=require(_0x1156('0x1'));var rs=require(_0x1156('0x2'));var fs=require('fs');var Redis=require(_0x1156('0x3'));var db=require(_0x1156('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1156('0x5'))(_0x1156('0x6'));var config=require(_0x1156('0x7'));var jayson=require(_0x1156('0x8'));var client=jayson['client'][_0x1156('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a7048,_0x372fe0,_0x6c3476){return new BPromise(function(_0x273b53,_0x2a7693){return client[_0x1156('0xa')](_0x4a7048,_0x6c3476)['then'](function(_0x2a5914){logger['info']('UserProfileSection,\x20%s,\x20%s',_0x372fe0,_0x1156('0xb'));logger[_0x1156('0xc')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x372fe0,_0x1156('0xb'),JSON['stringify'](_0x2a5914));if(_0x2a5914[_0x1156('0xd')]){if(_0x2a5914['error'][_0x1156('0xe')]===0x1f4){logger[_0x1156('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x372fe0,_0x2a5914['error'][_0x1156('0xf')]);return _0x2a7693(_0x2a5914['error'][_0x1156('0xf')]);}logger[_0x1156('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x372fe0,_0x2a5914['error'][_0x1156('0xf')]);return _0x273b53(_0x2a5914[_0x1156('0xd')][_0x1156('0xf')]);}else{logger['info']('UserProfileSection,\x20%s,\x20%s',_0x372fe0,_0x1156('0xb'));_0x273b53(_0x2a5914[_0x1156('0x10')][_0x1156('0xf')]);}})[_0x1156('0x11')](function(_0x6889c9){logger[_0x1156('0xd')](_0x1156('0x12'),_0x372fe0,_0x6889c9);_0x2a7693(_0x6889c9);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index e77df39..6df943d 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x262ee7,_0x52ee92){var _0x1dc842=function(_0x4bf54a){while(--_0x4bf54a){_0x262ee7['push'](_0x262ee7['shift']());}};_0x1dc842(++_0x52ee92);}(_0x9c44,0x178));var _0x49c4=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x9c44[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3a1e51,_0x3e39dc){var _0x2bb781=function(_0x1be52f){while(--_0x1be52f){_0x3a1e51['push'](_0x3a1e51['shift']());}};_0x2bb781(++_0x3e39dc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 56a8735..11c7fde 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 _0xb4e6=['sequelize','exports','INTEGER'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xb4e6,0xd8));var _0x6b4e=function(_0x230e39,_0x5341){_0x230e39=_0x230e39-0x0;var _0xa804e=_0xb4e6[_0x230e39];return _0xa804e;};'use strict';var Sequelize=require(_0x6b4e('0x0'));module[_0x6b4e('0x1')]={'penalty':{'type':Sequelize[_0x6b4e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x15ff=['sequelize','exports'];(function(_0x5a2909,_0x2f6975){var _0x386b8c=function(_0x349989){while(--_0x349989){_0x5a2909['push'](_0x5a2909['shift']());}};_0x386b8c(++_0x2f6975);}(_0x15ff,0x74));var _0xf15f=function(_0x12fbd9,_0x6d8f7f){_0x12fbd9=_0x12fbd9-0x0;var _0x14cd55=_0x15ff[_0x12fbd9];return _0x14cd55;};'use strict';var Sequelize=require(_0xf15f('0x0'));module[_0xf15f('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 fabfce0..d41af7a 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 _0xacf4=['define','UserSmsQueue','user_has_sms_queues','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userSmsQueue.attributes','exports'];(function(_0x31e965,_0xbd1e54){var _0x120351=function(_0x45229d){while(--_0x45229d){_0x31e965['push'](_0x31e965['shift']());}};_0x120351(++_0xbd1e54);}(_0xacf4,0xe7));var _0x4acf=function(_0x46360b,_0x37bd12){_0x46360b=_0x46360b-0x0;var _0x41c465=_0xacf4[_0x46360b];return _0x41c465;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4acf('0x0'))(_0x4acf('0x1'));var moment=require(_0x4acf('0x2'));var BPromise=require(_0x4acf('0x3'));var rp=require(_0x4acf('0x4'));var fs=require('fs');var path=require(_0x4acf('0x5'));var rimraf=require(_0x4acf('0x6'));var config=require('../../config/environment');var attributes=require(_0x4acf('0x7'));module[_0x4acf('0x8')]=function(_0x4e0c43,_0x24bf24){return _0x4e0c43[_0x4acf('0x9')](_0x4acf('0xa'),attributes,{'tableName':_0x4acf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x01d9=['bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api'];(function(_0x23e9af,_0x29c52c){var _0x2c4f8b=function(_0x1beca1){while(--_0x1beca1){_0x23e9af['push'](_0x23e9af['shift']());}};_0x2c4f8b(++_0x29c52c);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var logger=require(_0x901d('0x2'))(_0x901d('0x3'));var moment=require('moment');var BPromise=require(_0x901d('0x4'));var rp=require(_0x901d('0x5'));var fs=require('fs');var path=require(_0x901d('0x6'));var rimraf=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var attributes=require(_0x901d('0x9'));module[_0x901d('0xa')]=function(_0x4e7842,_0x1e5d7d){return _0x4e7842[_0x901d('0xb')](_0x901d('0xc'),attributes,{'tableName':_0x901d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index a0e4bcc..2c372e9 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 _0x2d29=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','UserSmsQueue,\x20%s,\x20%s','message','result','catch'];(function(_0x48d0c9,_0x5b26ac){var _0xcfaa34=function(_0x45edfc){while(--_0x45edfc){_0x48d0c9['push'](_0x48d0c9['shift']());}};_0xcfaa34(++_0x5b26ac);}(_0x2d29,0x13b));var _0x92d2=function(_0x3178f4,_0xd535ca){_0x3178f4=_0x3178f4-0x0;var _0x41efce=_0x2d29[_0x3178f4];return _0x41efce;};'use strict';var _=require(_0x92d2('0x0'));var util=require(_0x92d2('0x1'));var moment=require(_0x92d2('0x2'));var BPromise=require(_0x92d2('0x3'));var rs=require(_0x92d2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92d2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x92d2('0x6'))(_0x92d2('0x7'));var config=require('../../config/environment');var jayson=require(_0x92d2('0x8'));var client=jayson[_0x92d2('0x9')][_0x92d2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe322f4,_0x4a0cfe,_0xb0a0ce){return new BPromise(function(_0x2f4a4a,_0x45df4a){return client[_0x92d2('0xb')](_0xe322f4,_0xb0a0ce)['then'](function(_0x193006){logger[_0x92d2('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x4a0cfe,_0x92d2('0xd'));logger['debug'](_0x92d2('0xe'),_0x4a0cfe,'request\x20sent',JSON['stringify'](_0x193006));if(_0x193006[_0x92d2('0xf')]){if(_0x193006['error'][_0x92d2('0x10')]===0x1f4){logger['error'](_0x92d2('0x11'),_0x4a0cfe,_0x193006[_0x92d2('0xf')][_0x92d2('0x12')]);return _0x45df4a(_0x193006['error']['message']);}logger[_0x92d2('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x4a0cfe,_0x193006[_0x92d2('0xf')][_0x92d2('0x12')]);return _0x2f4a4a(_0x193006[_0x92d2('0xf')][_0x92d2('0x12')]);}else{logger[_0x92d2('0xc')](_0x92d2('0x11'),_0x4a0cfe,'request\x20sent');_0x2f4a4a(_0x193006[_0x92d2('0x13')][_0x92d2('0x12')]);}})[_0x92d2('0x14')](function(_0x138574){logger[_0x92d2('0xf')](_0x92d2('0x11'),_0x4a0cfe,_0x138574);_0x45df4a(_0x138574);});});} \ No newline at end of file +var _0x9607=['info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3a0c5e,_0x4354d5){var _0x28bbc4=function(_0x91b14f){while(--_0x91b14f){_0x3a0c5e['push'](_0x3a0c5e['shift']());}};_0x28bbc4(++_0x4354d5);}(_0x9607,0x19a));var _0x7960=function(_0x3380ff,_0x580328){_0x3380ff=_0x3380ff-0x0;var _0x4cd3b0=_0x9607[_0x3380ff];return _0x4cd3b0;};'use strict';var _=require(_0x7960('0x0'));var util=require(_0x7960('0x1'));var moment=require(_0x7960('0x2'));var BPromise=require(_0x7960('0x3'));var rs=require(_0x7960('0x4'));var fs=require('fs');var Redis=require(_0x7960('0x5'));var db=require(_0x7960('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7960('0x7'))(_0x7960('0x8'));var config=require(_0x7960('0x9'));var jayson=require(_0x7960('0xa'));var client=jayson[_0x7960('0xb')][_0x7960('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4e17e1,_0x1ef754,_0x22adf9){return new BPromise(function(_0x1bd027,_0xb1770c){return client[_0x7960('0xd')](_0x4e17e1,_0x22adf9)[_0x7960('0xe')](function(_0x36bc0e){logger[_0x7960('0xf')](_0x7960('0x10'),_0x1ef754,_0x7960('0x11'));logger[_0x7960('0x12')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x1ef754,'request\x20sent',JSON[_0x7960('0x13')](_0x36bc0e));if(_0x36bc0e[_0x7960('0x14')]){if(_0x36bc0e[_0x7960('0x14')][_0x7960('0x15')]===0x1f4){logger['error'](_0x7960('0x10'),_0x1ef754,_0x36bc0e[_0x7960('0x14')][_0x7960('0x16')]);return _0xb1770c(_0x36bc0e['error']['message']);}logger[_0x7960('0x14')](_0x7960('0x10'),_0x1ef754,_0x36bc0e[_0x7960('0x14')][_0x7960('0x16')]);return _0x1bd027(_0x36bc0e[_0x7960('0x14')]['message']);}else{logger[_0x7960('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x1ef754,_0x7960('0x11'));_0x1bd027(_0x36bc0e[_0x7960('0x17')][_0x7960('0x16')]);}})[_0x7960('0x18')](function(_0x3ff90e){logger[_0x7960('0x14')](_0x7960('0x10'),_0x1ef754,_0x3ff90e);_0xb1770c(_0x3ff90e);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index aff626f..b94ee63 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 _0x4465=['sequelize','exports','INTEGER'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x4465,0xdb));var _0x5446=function(_0x3a96f0,_0x524cd7){_0x3a96f0=_0x3a96f0-0x0;var _0x35a2d5=_0x4465[_0x3a96f0];return _0x35a2d5;};'use strict';var Sequelize=require(_0x5446('0x0'));module[_0x5446('0x1')]={'UserId':{'type':Sequelize[_0x5446('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x5446('0x2')]}}; \ No newline at end of file +var _0xfa57=['sequelize','exports'];(function(_0x21b936,_0x4e0544){var _0x3d213d=function(_0x91a0d){while(--_0x91a0d){_0x21b936['push'](_0x21b936['shift']());}};_0x3d213d(++_0x4e0544);}(_0xfa57,0x1da));var _0x7fa5=function(_0x60e42c,_0x50322e){_0x60e42c=_0x60e42c-0x0;var _0xf2dcc9=_0xfa57[_0x60e42c];return _0xf2dcc9;};'use strict';var Sequelize=require(_0x7fa5('0x0'));module[_0x7fa5('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 3b91749..9660308 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(_0x3a711c,_0x116edb){var _0x5370ef=function(_0x2e8d40){while(--_0x2e8d40){_0x3a711c['push'](_0x3a711c['shift']());}};_0x5370ef(++_0x116edb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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(_0x470dd1,_0x35ae75){var _0x129f4c=function(_0x486708){while(--_0x486708){_0x470dd1['push'](_0x470dd1['shift']());}};_0x129f4c(++_0x35ae75);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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 37db35d..3255812 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(_0x1e6bdb,_0x49f327){var _0x4cc923=function(_0x17d720){while(--_0x17d720){_0x1e6bdb['push'](_0x1e6bdb['shift']());}};_0x4cc923(++_0x49f327);}(_0x70e0,0x17b));var _0x070e=function(_0x53c037,_0x37df9d){_0x53c037=_0x53c037-0x0;var _0x52a063=_0x70e0[_0x53c037];return _0x52a063;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x320839,_0x3a18a5){var _0x29387e=function(_0x4f52ad){while(--_0x4f52ad){_0x320839['push'](_0x320839['shift']());}};_0x29387e(++_0x3a18a5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 46fbd2b..38e24a7 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 _0xa2f3=['exports'];(function(_0x26ad6b,_0x662c04){var _0x5be2b2=function(_0x366825){while(--_0x366825){_0x26ad6b['push'](_0x26ad6b['shift']());}};_0x5be2b2(++_0x662c04);}(_0xa2f3,0x76));var _0x3a2f=function(_0x5acbce,_0x46e43b){_0x5acbce=_0x5acbce-0x0;var _0x13ecb7=_0xa2f3[_0x5acbce];return _0x13ecb7;};'use strict';var Sequelize=require('sequelize');module[_0x3a2f('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x4325=['exports'];(function(_0x240362,_0x156794){var _0x26de18=function(_0x4a4431){while(--_0x4a4431){_0x240362['push'](_0x240362['shift']());}};_0x26de18(++_0x156794);}(_0x4325,0x159));var _0x5432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4325[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x5432('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 5e0c3cc..c590fc1 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 _0xd334=['define','UserVoiceQueue','user_has_voice_queues','lodash','util','api','moment','request-promise','rimraf','../../config/environment','exports'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xd334,0x1bb));var _0x4d33=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xd334[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x4d33('0x0'));var util=require(_0x4d33('0x1'));var logger=require('../../config/logger')(_0x4d33('0x2'));var moment=require(_0x4d33('0x3'));var BPromise=require('bluebird');var rp=require(_0x4d33('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4d33('0x5'));var config=require(_0x4d33('0x6'));var attributes=require('./userVoiceQueue.attributes');module[_0x4d33('0x7')]=function(_0x50100b,_0x31c1a3){return _0x50100b[_0x4d33('0x8')](_0x4d33('0x9'),attributes,{'tableName':_0x4d33('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb417=['bluebird','request-promise','path','rimraf','./userVoiceQueue.attributes','exports','UserVoiceQueue','util','../../config/logger','moment'];(function(_0xf54b0,_0x400373){var _0x4ce093=function(_0x47cb14){while(--_0x47cb14){_0xf54b0['push'](_0xf54b0['shift']());}};_0x4ce093(++_0x400373);}(_0xb417,0x1d3));var _0x7b41=function(_0x3917ad,_0x2caf3e){_0x3917ad=_0x3917ad-0x0;var _0x26c3ec=_0xb417[_0x3917ad];return _0x26c3ec;};'use strict';var _=require('lodash');var util=require(_0x7b41('0x0'));var logger=require(_0x7b41('0x1'))('api');var moment=require(_0x7b41('0x2'));var BPromise=require(_0x7b41('0x3'));var rp=require(_0x7b41('0x4'));var fs=require('fs');var path=require(_0x7b41('0x5'));var rimraf=require(_0x7b41('0x6'));var config=require('../../config/environment');var attributes=require(_0x7b41('0x7'));module[_0x7b41('0x8')]=function(_0x5b066b,_0x4f8fe4){return _0x5b066b['define'](_0x7b41('0x9'),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 24bfd5b..b4f7042 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 _0x7b4c=['../../config/environment','client','http','request','debug','request\x20sent','stringify','error','message','result','catch','UserVoiceQueue,\x20%s,\x20%s','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7b4c,0xd2));var _0xc7b4=function(_0x40247a,_0x4f8a77){_0x40247a=_0x40247a-0x0;var _0x1e0a8d=_0x7b4c[_0x40247a];return _0x1e0a8d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc7b4('0x0'));var fs=require('fs');var Redis=require(_0xc7b4('0x1'));var db=require(_0xc7b4('0x2'))['db'];var utils=require(_0xc7b4('0x3'));var logger=require(_0xc7b4('0x4'))(_0xc7b4('0x5'));var config=require(_0xc7b4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc7b4('0x7')][_0xc7b4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xde67f8,_0x4b3524,_0x5ebc63){return new BPromise(function(_0x467254,_0x28124e){return client[_0xc7b4('0x9')](_0xde67f8,_0x5ebc63)['then'](function(_0x496629){logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x4b3524,'request\x20sent');logger[_0xc7b4('0xa')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x4b3524,_0xc7b4('0xb'),JSON[_0xc7b4('0xc')](_0x496629));if(_0x496629[_0xc7b4('0xd')]){if(_0x496629[_0xc7b4('0xd')]['code']===0x1f4){logger[_0xc7b4('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x4b3524,_0x496629[_0xc7b4('0xd')][_0xc7b4('0xe')]);return _0x28124e(_0x496629[_0xc7b4('0xd')][_0xc7b4('0xe')]);}logger[_0xc7b4('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x4b3524,_0x496629[_0xc7b4('0xd')][_0xc7b4('0xe')]);return _0x467254(_0x496629[_0xc7b4('0xd')]['message']);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x4b3524,'request\x20sent');_0x467254(_0x496629[_0xc7b4('0xf')][_0xc7b4('0xe')]);}})[_0xc7b4('0x10')](function(_0xc6319b){logger[_0xc7b4('0xd')](_0xc7b4('0x11'),_0x4b3524,_0xc6319b);_0x28124e(_0xc6319b);});});} \ No newline at end of file +var _0xfe95=['UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x28db1c,_0xd3efab){var _0x3c356c=function(_0x1bccf1){while(--_0x1bccf1){_0x28db1c['push'](_0x28db1c['shift']());}};_0x3c356c(++_0xd3efab);}(_0xfe95,0x136));var _0x5fe9=function(_0x264986,_0x2f38dc){_0x264986=_0x264986-0x0;var _0x371841=_0xfe95[_0x264986];return _0x371841;};'use strict';var _=require(_0x5fe9('0x0'));var util=require('util');var moment=require(_0x5fe9('0x1'));var BPromise=require('bluebird');var rs=require(_0x5fe9('0x2'));var fs=require('fs');var Redis=require(_0x5fe9('0x3'));var db=require(_0x5fe9('0x4'))['db'];var utils=require(_0x5fe9('0x5'));var logger=require(_0x5fe9('0x6'))(_0x5fe9('0x7'));var config=require(_0x5fe9('0x8'));var jayson=require(_0x5fe9('0x9'));var client=jayson['client'][_0x5fe9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3aea1c,_0x518058,_0x589e70){return new BPromise(function(_0x312ec4,_0x1c02fe){return client[_0x5fe9('0xb')](_0x3aea1c,_0x589e70)['then'](function(_0x1ed951){logger['info'](_0x5fe9('0xc'),_0x518058,_0x5fe9('0xd'));logger[_0x5fe9('0xe')](_0x5fe9('0xf'),_0x518058,_0x5fe9('0xd'),JSON[_0x5fe9('0x10')](_0x1ed951));if(_0x1ed951[_0x5fe9('0x11')]){if(_0x1ed951[_0x5fe9('0x11')][_0x5fe9('0x12')]===0x1f4){logger[_0x5fe9('0x11')](_0x5fe9('0xc'),_0x518058,_0x1ed951[_0x5fe9('0x11')]['message']);return _0x1c02fe(_0x1ed951['error']['message']);}logger[_0x5fe9('0x11')](_0x5fe9('0xc'),_0x518058,_0x1ed951[_0x5fe9('0x11')][_0x5fe9('0x13')]);return _0x312ec4(_0x1ed951[_0x5fe9('0x11')]['message']);}else{logger[_0x5fe9('0x14')](_0x5fe9('0xc'),_0x518058,_0x5fe9('0xd'));_0x312ec4(_0x1ed951[_0x5fe9('0x15')]['message']);}})[_0x5fe9('0x16')](function(_0x5309fb){logger[_0x5fe9('0x11')](_0x5fe9('0xc'),_0x518058,_0x5309fb);_0x1c02fe(_0x5309fb);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index af1e16b..0ff3a18 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4cf07b,_0x3533aa){var _0x5d70ff=function(_0x321805){while(--_0x321805){_0x4cf07b['push'](_0x4cf07b['shift']());}};_0x5d70ff(++_0x3533aa);}(_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(_0x5b33ea,_0x4a6892){var _0x3d2159=function(_0x4af270){while(--_0x4af270){_0x5b33ea['push'](_0x5b33ea['shift']());}};_0x3d2159(++_0x4a6892);}(_0xedd9,0xfc));var _0x9edd=function(_0x34149b,_0x552ffc){_0x34149b=_0x34149b-0x0;var _0x5dbf60=_0xedd9[_0x34149b];return _0x5dbf60;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index ca66f6d..462b8b6 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 _0xf00a=['sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xf00a,0x114));var _0xaf00=function(_0x25678f,_0x5958d5){_0x25678f=_0x25678f-0x0;var _0x1961b5=_0xf00a[_0x25678f];return _0x1961b5;};'use strict';var Sequelize=require(_0xaf00('0x0'));module[_0xaf00('0x1')]={'uniqueid':{'type':Sequelize[_0xaf00('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xaf00('0x3')},'membername':{'type':Sequelize[_0xaf00('0x4')],'allowNull':![],'comment':_0xaf00('0x3')},'UserId':{'type':Sequelize[_0xaf00('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xaf00('0x4')],'allowNull':![],'unique':_0xaf00('0x5'),'comment':_0xaf00('0x3')},'VoiceQueueId':{'type':Sequelize[_0xaf00('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xaf00('0x4')],'allowNull':![],'unique':_0xaf00('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0xaf00('0x2')](0xb),'defaultValue':0x0,'comment':_0xaf00('0x3')},'paused':{'type':Sequelize[_0xaf00('0x2')](0xb),'defaultValue':0x0,'comment':_0xaf00('0x3')}}; \ No newline at end of file +var _0x7493=['Required\x20by\x20Asterisk','STRING','INTEGER','queue_interface','sequelize'];(function(_0x5f0b2b,_0x5a604b){var _0xd3aefa=function(_0x161cd7){while(--_0x161cd7){_0x5f0b2b['push'](_0x5f0b2b['shift']());}};_0xd3aefa(++_0x5a604b);}(_0x7493,0x144));var _0x3749=function(_0x1622a0,_0x2b55a9){_0x1622a0=_0x1622a0-0x0;var _0x2a2308=_0x7493[_0x1622a0];return _0x2a2308;};'use strict';var Sequelize=require(_0x3749('0x0'));module['exports']={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x3749('0x1')},'membername':{'type':Sequelize[_0x3749('0x2')],'allowNull':![],'comment':_0x3749('0x1')},'UserId':{'type':Sequelize[_0x3749('0x3')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x3749('0x2')],'allowNull':![],'unique':_0x3749('0x4'),'comment':_0x3749('0x1')},'VoiceQueueId':{'type':Sequelize[_0x3749('0x3')],'allowNull':![]},'interface':{'type':Sequelize[_0x3749('0x2')],'allowNull':![],'unique':'queue_interface','comment':_0x3749('0x1')},'penalty':{'type':Sequelize[_0x3749('0x3')](0xb),'defaultValue':0x0,'comment':_0x3749('0x1')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index db21c8c..a9581c1 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 _0x89f7=['setMaxListeners','save','update','remove','hasOwnProperty','hook','events','../../mysqldb','UserVoiceQueueRt'];(function(_0x3a39f0,_0x2bfe12){var _0x26a696=function(_0x326c5c){while(--_0x326c5c){_0x3a39f0['push'](_0x3a39f0['shift']());}};_0x26a696(++_0x2bfe12);}(_0x89f7,0x72));var _0x789f=function(_0x59616b,_0x38e534){_0x59616b=_0x59616b-0x0;var _0x5c4523=_0x89f7[_0x59616b];return _0x5c4523;};'use strict';var EventEmitter=require(_0x789f('0x0'));var UserVoiceQueueRt=require(_0x789f('0x1'))['db'][_0x789f('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x789f('0x3')](0x0);var events={'afterCreate':_0x789f('0x4'),'afterUpdate':_0x789f('0x5'),'afterDestroy':_0x789f('0x6')};function emitEvent(_0x57ac38){return function(_0x428c4e,_0x203045,_0x885955){UserVoiceQueueRtEvents['emit'](_0x57ac38+':'+_0x428c4e['id'],_0x428c4e);UserVoiceQueueRtEvents['emit'](_0x57ac38,_0x428c4e);_0x885955(null);};}for(var e in events){if(events[_0x789f('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x789f('0x8')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x6806=['hook','events','../../mysqldb','save','update','remove','emit'];(function(_0x2985ba,_0x165ac4){var _0x3c0768=function(_0x414e65){while(--_0x414e65){_0x2985ba['push'](_0x2985ba['shift']());}};_0x3c0768(++_0x165ac4);}(_0x6806,0x127));var _0x6680=function(_0x12ce7b,_0x2daaee){_0x12ce7b=_0x12ce7b-0x0;var _0x4ee1b1=_0x6806[_0x12ce7b];return _0x4ee1b1;};'use strict';var EventEmitter=require(_0x6680('0x0'));var UserVoiceQueueRt=require(_0x6680('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6680('0x2'),'afterUpdate':_0x6680('0x3'),'afterDestroy':_0x6680('0x4')};function emitEvent(_0x5a32dd){return function(_0x72b819,_0x621e97,_0x46441f){UserVoiceQueueRtEvents[_0x6680('0x5')](_0x5a32dd+':'+_0x72b819['id'],_0x72b819);UserVoiceQueueRtEvents[_0x6680('0x5')](_0x5a32dd,_0x72b819);_0x46441f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x6680('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 ef3b129..cce8b9d 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 _0x6343=['lodash','../../config/logger','moment','bluebird','path','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt'];(function(_0x2b3441,_0x46835a){var _0x22f5df=function(_0x1cf0f1){while(--_0x1cf0f1){_0x2b3441['push'](_0x2b3441['shift']());}};_0x22f5df(++_0x46835a);}(_0x6343,0xd1));var _0x3634=function(_0x39e053,_0x592e73){_0x39e053=_0x39e053-0x0;var _0x3d04d0=_0x6343[_0x39e053];return _0x3d04d0;};'use strict';var _=require(_0x3634('0x0'));var util=require('util');var logger=require(_0x3634('0x1'))('api');var moment=require(_0x3634('0x2'));var BPromise=require(_0x3634('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3634('0x4'));var rimraf=require('rimraf');var config=require(_0x3634('0x5'));var attributes=require(_0x3634('0x6'));module[_0x3634('0x7')]=function(_0x2957dd,_0x18ec72){return _0x2957dd[_0x3634('0x8')](_0x3634('0x9'),attributes,{'tableName':_0x3634('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe118=['rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3f344a,_0x468ad0){var _0x11658c=function(_0x2f0ba5){while(--_0x2f0ba5){_0x3f344a['push'](_0x3f344a['shift']());}};_0x11658c(++_0x468ad0);}(_0xe118,0x115));var _0x8e11=function(_0x357fca,_0x26e179){_0x357fca=_0x357fca-0x0;var _0x58897e=_0xe118[_0x357fca];return _0x58897e;};'use strict';var _=require(_0x8e11('0x0'));var util=require(_0x8e11('0x1'));var logger=require(_0x8e11('0x2'))(_0x8e11('0x3'));var moment=require(_0x8e11('0x4'));var BPromise=require(_0x8e11('0x5'));var rp=require(_0x8e11('0x6'));var fs=require('fs');var path=require(_0x8e11('0x7'));var rimraf=require(_0x8e11('0x8'));var config=require(_0x8e11('0x9'));var attributes=require(_0x8e11('0xa'));module[_0x8e11('0xb')]=function(_0x349565,_0x4b6334){return _0x349565[_0x8e11('0xc')](_0x8e11('0xd'),attributes,{'tableName':_0x8e11('0xe'),'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 5119bab..6559967 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 _0x404d=['then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','request'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x404d,0xb7));var _0xd404=function(_0x4f5530,_0x14d560){_0x4f5530=_0x4f5530-0x0;var _0x122f09=_0x404d[_0x4f5530];return _0x122f09;};'use strict';var _=require(_0xd404('0x0'));var util=require(_0xd404('0x1'));var moment=require('moment');var BPromise=require(_0xd404('0x2'));var rs=require(_0xd404('0x3'));var fs=require('fs');var Redis=require(_0xd404('0x4'));var db=require(_0xd404('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd404('0x6'))(_0xd404('0x7'));var config=require(_0xd404('0x8'));var jayson=require(_0xd404('0x9'));var client=jayson[_0xd404('0xa')]['http']({'port':0x232a});config[_0xd404('0xb')]=_[_0xd404('0xc')](config[_0xd404('0xb')],{'host':_0xd404('0xd'),'port':0x18eb});var socket=require(_0xd404('0xe'))(new Redis(config[_0xd404('0xb')]));require(_0xd404('0xf'))['register'](socket);function respondWithRpcPromise(_0x208213,_0x2750fb,_0x2016fa){return new BPromise(function(_0x28e291,_0x316c93){return client[_0xd404('0x10')](_0x208213,_0x2016fa)[_0xd404('0x11')](function(_0x6aa8c5){logger['info'](_0xd404('0x12'),_0x2750fb,_0xd404('0x13'));logger[_0xd404('0x14')](_0xd404('0x15'),_0x2750fb,_0xd404('0x13'),JSON[_0xd404('0x16')](_0x6aa8c5));if(_0x6aa8c5[_0xd404('0x17')]){if(_0x6aa8c5[_0xd404('0x17')][_0xd404('0x18')]===0x1f4){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x2750fb,_0x6aa8c5[_0xd404('0x17')][_0xd404('0x19')]);return _0x316c93(_0x6aa8c5[_0xd404('0x17')][_0xd404('0x19')]);}logger[_0xd404('0x17')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2750fb,_0x6aa8c5['error'][_0xd404('0x19')]);return _0x28e291(_0x6aa8c5[_0xd404('0x17')]['message']);}else{logger[_0xd404('0x1a')](_0xd404('0x12'),_0x2750fb,'request\x20sent');_0x28e291(_0x6aa8c5[_0xd404('0x1b')][_0xd404('0x19')]);}})[_0xd404('0x1c')](function(_0x100551){logger[_0xd404('0x17')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2750fb,_0x100551);_0x316c93(_0x100551);});});}exports[_0xd404('0x1d')]=function(_0x26693a){var _0x126088=this;return new Promise(function(_0x44e261,_0x176f63){return db[_0xd404('0x1e')][_0xd404('0x1f')]({'raw':_0x26693a[_0xd404('0x20')]?_0x26693a[_0xd404('0x20')][_0xd404('0x21')]===undefined?!![]:![]:!![],'where':_0x26693a[_0xd404('0x20')]?_0x26693a['options'][_0xd404('0x22')]||null:null,'attributes':[[db[_0xd404('0x23')]['fn'](_0xd404('0x24'),db[_0xd404('0x23')]['fn']('IF',db[_0xd404('0x23')][_0xd404('0x25')](_0xd404('0x26')))),_0xd404('0x27')]]})[_0xd404('0x11')](function(_0x5e5dce){logger[_0xd404('0x1a')](_0xd404('0x1d'),_0x26693a);logger[_0xd404('0x14')](_0xd404('0x1d'),_0x26693a,JSON['stringify'](_0x5e5dce));_0x44e261(_0x5e5dce);})[_0xd404('0x1c')](function(_0x3d0f39){logger[_0xd404('0x17')]('GetVoiceQueueRtPauses',_0x3d0f39[_0xd404('0x19')],_0x26693a);_0x176f63(_0x126088[_0xd404('0x17')](0x1f4,_0x3d0f39[_0xd404('0x19')]));});});}; \ No newline at end of file +var _0xeac6=['debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s'];(function(_0x2b3b02,_0x77e0cd){var _0xe410c5=function(_0x596805){while(--_0x596805){_0x2b3b02['push'](_0x2b3b02['shift']());}};_0xe410c5(++_0x77e0cd);}(_0xeac6,0x184));var _0x6eac=function(_0x58242b,_0x1fbccc){_0x58242b=_0x58242b-0x0;var _0x40bf94=_0xeac6[_0x58242b];return _0x40bf94;};'use strict';var _=require(_0x6eac('0x0'));var util=require(_0x6eac('0x1'));var moment=require('moment');var BPromise=require(_0x6eac('0x2'));var rs=require(_0x6eac('0x3'));var fs=require('fs');var Redis=require(_0x6eac('0x4'));var db=require(_0x6eac('0x5'))['db'];var utils=require(_0x6eac('0x6'));var logger=require(_0x6eac('0x7'))(_0x6eac('0x8'));var config=require(_0x6eac('0x9'));var jayson=require(_0x6eac('0xa'));var client=jayson['client'][_0x6eac('0xb')]({'port':0x232a});config[_0x6eac('0xc')]=_[_0x6eac('0xd')](config[_0x6eac('0xc')],{'host':_0x6eac('0xe'),'port':0x18eb});var socket=require(_0x6eac('0xf'))(new Redis(config[_0x6eac('0xc')]));require(_0x6eac('0x10'))[_0x6eac('0x11')](socket);function respondWithRpcPromise(_0x40d797,_0x48ea60,_0x313cee){return new BPromise(function(_0x2f16df,_0x4d3f71){return client[_0x6eac('0x12')](_0x40d797,_0x313cee)[_0x6eac('0x13')](function(_0x7fa64a){logger[_0x6eac('0x14')](_0x6eac('0x15'),_0x48ea60,'request\x20sent');logger[_0x6eac('0x16')](_0x6eac('0x17'),_0x48ea60,_0x6eac('0x18'),JSON[_0x6eac('0x19')](_0x7fa64a));if(_0x7fa64a[_0x6eac('0x1a')]){if(_0x7fa64a['error'][_0x6eac('0x1b')]===0x1f4){logger[_0x6eac('0x1a')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x48ea60,_0x7fa64a[_0x6eac('0x1a')][_0x6eac('0x1c')]);return _0x4d3f71(_0x7fa64a[_0x6eac('0x1a')]['message']);}logger[_0x6eac('0x1a')](_0x6eac('0x15'),_0x48ea60,_0x7fa64a[_0x6eac('0x1a')]['message']);return _0x2f16df(_0x7fa64a[_0x6eac('0x1a')][_0x6eac('0x1c')]);}else{logger[_0x6eac('0x14')](_0x6eac('0x15'),_0x48ea60,'request\x20sent');_0x2f16df(_0x7fa64a[_0x6eac('0x1d')][_0x6eac('0x1c')]);}})[_0x6eac('0x1e')](function(_0x2b47a5){logger[_0x6eac('0x1a')](_0x6eac('0x15'),_0x48ea60,_0x2b47a5);_0x4d3f71(_0x2b47a5);});});}exports[_0x6eac('0x1f')]=function(_0x376776){var _0x591993=this;return new Promise(function(_0x126b65,_0x122189){return db[_0x6eac('0x20')][_0x6eac('0x21')]({'raw':_0x376776[_0x6eac('0x22')]?_0x376776['options'][_0x6eac('0x23')]===undefined?!![]:![]:!![],'where':_0x376776[_0x6eac('0x22')]?_0x376776[_0x6eac('0x22')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x6eac('0x24'),db[_0x6eac('0x25')]['fn']('IF',db[_0x6eac('0x25')][_0x6eac('0x26')](_0x6eac('0x27')))),_0x6eac('0x28')]]})[_0x6eac('0x13')](function(_0x3fb33f){logger['info']('GetVoiceQueueRtPauses',_0x376776);logger[_0x6eac('0x16')](_0x6eac('0x1f'),_0x376776,JSON[_0x6eac('0x19')](_0x3fb33f));_0x126b65(_0x3fb33f);})[_0x6eac('0x1e')](function(_0x2b8425){logger[_0x6eac('0x1a')](_0x6eac('0x1f'),_0x2b8425[_0x6eac('0x1c')],_0x376776);_0x122189(_0x591993[_0x6eac('0x1a')](0x1f4,_0x2b8425[_0x6eac('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index c83d55b..881c688 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 _0x55c1=['./userVoiceQueueRt.events','save','emit','register','length'];(function(_0x5cf936,_0x125307){var _0x1d4e46=function(_0x41e33f){while(--_0x41e33f){_0x5cf936['push'](_0x5cf936['shift']());}};_0x1d4e46(++_0x125307);}(_0x55c1,0x1e5));var _0x155c=function(_0x2adae0,_0x4fa150){_0x2adae0=_0x2adae0-0x0;var _0x4bbb68=_0x55c1[_0x2adae0];return _0x4bbb68;};'use strict';var UserVoiceQueueRtEvents=require(_0x155c('0x0'));var events=[_0x155c('0x1'),'remove','update'];function createListener(_0x530d64,_0x81b6fa){return function(_0x7efdc0){_0x81b6fa[_0x155c('0x2')](_0x530d64,_0x7efdc0);};}function removeListener(_0x64c8aa,_0xb127e8){return function(){UserVoiceQueueRtEvents['removeListener'](_0x64c8aa,_0xb127e8);};}exports[_0x155c('0x3')]=function(_0x55a3ae){for(var _0x1b30c6=0x0,_0x4df902=events[_0x155c('0x4')];_0x1b30c6<_0x4df902;_0x1b30c6++){var _0x25b08a=events[_0x1b30c6];var _0x22ed0d=createListener('userVoiceQueueRt:'+_0x25b08a,_0x55a3ae);UserVoiceQueueRtEvents['on'](_0x25b08a,_0x22ed0d);}}; \ No newline at end of file +var _0x37c5=['remove','update','emit','removeListener','userVoiceQueueRt:','save'];(function(_0x2a2208,_0x335ebc){var _0x59b96f=function(_0x23f8c6){while(--_0x23f8c6){_0x2a2208['push'](_0x2a2208['shift']());}};_0x59b96f(++_0x335ebc);}(_0x37c5,0xa7));var _0x537c=function(_0x53146c,_0x2a3b66){_0x53146c=_0x53146c-0x0;var _0x475812=_0x37c5[_0x53146c];return _0x475812;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x537c('0x0'),_0x537c('0x1'),_0x537c('0x2')];function createListener(_0x11f076,_0x1c5b5f){return function(_0x183b59){_0x1c5b5f[_0x537c('0x3')](_0x11f076,_0x183b59);};}function removeListener(_0x42bd15,_0x2c0854){return function(){UserVoiceQueueRtEvents[_0x537c('0x4')](_0x42bd15,_0x2c0854);};}exports['register']=function(_0x42c86a){for(var _0x1156f4=0x0,_0x336920=events['length'];_0x1156f4<_0x336920;_0x1156f4++){var _0x36bf4a=events[_0x1156f4];var _0x67f986=createListener(_0x537c('0x5')+_0x36bf4a,_0x42c86a);UserVoiceQueueRtEvents['on'](_0x36bf4a,_0x67f986);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index ba84edd..45f32e3 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x326558,_0x4a22a1){var _0x5cd3a0=function(_0x412b66){while(--_0x412b66){_0x326558['push'](_0x326558['shift']());}};_0x5cd3a0(++_0x4a22a1);}(_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'));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(_0xce49af,_0x4a85f6){var _0x331206=function(_0x4189b4){while(--_0x4189b4){_0xce49af['push'](_0xce49af['shift']());}};_0x331206(++_0x4a85f6);}(_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 6cf7bff..37572a2 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 _0xfac1=['exports'];(function(_0x2c7dc6,_0x3c4ce0){var _0x10002b=function(_0x26f390){while(--_0x26f390){_0x2c7dc6['push'](_0x2c7dc6['shift']());}};_0x10002b(++_0x3c4ce0);}(_0xfac1,0x16f));var _0x1fac=function(_0x25f0ea,_0xd6d029){_0x25f0ea=_0x25f0ea-0x0;var _0x275268=_0xfac1[_0x25f0ea];return _0x275268;};'use strict';var Sequelize=require('sequelize');module[_0x1fac('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x10eb=['INTEGER','sequelize'];(function(_0x2670ab,_0xb49479){var _0x5a12ad=function(_0xc72f32){while(--_0xc72f32){_0x2670ab['push'](_0x2670ab['shift']());}};_0x5a12ad(++_0xb49479);}(_0x10eb,0x71));var _0xb10e=function(_0x37ad7f,_0x307347){_0x37ad7f=_0x37ad7f-0x0;var _0x54d85a=_0x10eb[_0x37ad7f];return _0x54d85a;};'use strict';var Sequelize=require(_0xb10e('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xb10e('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 11c1643..80fe611 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 _0x8273=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util'];(function(_0x480a54,_0x3d92e5){var _0x2378f1=function(_0x5e3367){while(--_0x5e3367){_0x480a54['push'](_0x480a54['shift']());}};_0x2378f1(++_0x3d92e5);}(_0x8273,0x1df));var _0x3827=function(_0x59fcce,_0x57fb8b){_0x59fcce=_0x59fcce-0x0;var _0x65d044=_0x8273[_0x59fcce];return _0x65d044;};'use strict';var _=require(_0x3827('0x0'));var util=require(_0x3827('0x1'));var logger=require('../../config/logger')(_0x3827('0x2'));var moment=require(_0x3827('0x3'));var BPromise=require(_0x3827('0x4'));var rp=require(_0x3827('0x5'));var fs=require('fs');var path=require(_0x3827('0x6'));var rimraf=require(_0x3827('0x7'));var config=require(_0x3827('0x8'));var attributes=require('./userWhatsappQueue.attributes');module[_0x3827('0x9')]=function(_0x3258db,_0x2b01f5){return _0x3258db[_0x3827('0xa')](_0x3827('0xb'),attributes,{'tableName':_0x3827('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd5cb=['rimraf','../../config/environment','./userWhatsappQueue.attributes','define','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xd5cb,0x12d));var _0xbd5c=function(_0x4866a6,_0xfbaa7d){_0x4866a6=_0x4866a6-0x0;var _0x22e70d=_0xd5cb[_0x4866a6];return _0x22e70d;};'use strict';var _=require(_0xbd5c('0x0'));var util=require(_0xbd5c('0x1'));var logger=require(_0xbd5c('0x2'))('api');var moment=require(_0xbd5c('0x3'));var BPromise=require(_0xbd5c('0x4'));var rp=require(_0xbd5c('0x5'));var fs=require('fs');var path=require(_0xbd5c('0x6'));var rimraf=require(_0xbd5c('0x7'));var config=require(_0xbd5c('0x8'));var attributes=require(_0xbd5c('0x9'));module['exports']=function(_0x8026f7,_0x200683){return _0x8026f7[_0xbd5c('0xa')]('UserWhatsappQueue',attributes,{'tableName':'user_has_whatsapp_queues','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 7ecfb74..49b9fa9 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 _0xed9f=['../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xed9f,0x1bf));var _0xfed9=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xed9f[_0x1203f];return _0x365f0a;};'use strict';var _=require(_0xfed9('0x0'));var util=require(_0xfed9('0x1'));var moment=require(_0xfed9('0x2'));var BPromise=require(_0xfed9('0x3'));var rs=require(_0xfed9('0x4'));var fs=require('fs');var Redis=require(_0xfed9('0x5'));var db=require(_0xfed9('0x6'))['db'];var utils=require(_0xfed9('0x7'));var logger=require(_0xfed9('0x8'))('rpc');var config=require(_0xfed9('0x9'));var jayson=require(_0xfed9('0xa'));var client=jayson[_0xfed9('0xb')][_0xfed9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2c870c,_0x42bce7,_0x4beac3){return new BPromise(function(_0x58b651,_0x2d3b74){return client[_0xfed9('0xd')](_0x2c870c,_0x4beac3)['then'](function(_0x669448){logger[_0xfed9('0xe')]('UserWhatsappQueue,\x20%s,\x20%s',_0x42bce7,_0xfed9('0xf'));logger[_0xfed9('0x10')](_0xfed9('0x11'),_0x42bce7,_0xfed9('0xf'),JSON[_0xfed9('0x12')](_0x669448));if(_0x669448['error']){if(_0x669448[_0xfed9('0x13')][_0xfed9('0x14')]===0x1f4){logger[_0xfed9('0x13')](_0xfed9('0x15'),_0x42bce7,_0x669448['error'][_0xfed9('0x16')]);return _0x2d3b74(_0x669448[_0xfed9('0x13')]['message']);}logger[_0xfed9('0x13')](_0xfed9('0x15'),_0x42bce7,_0x669448['error'][_0xfed9('0x16')]);return _0x58b651(_0x669448[_0xfed9('0x13')]['message']);}else{logger[_0xfed9('0xe')](_0xfed9('0x15'),_0x42bce7,_0xfed9('0xf'));_0x58b651(_0x669448[_0xfed9('0x17')][_0xfed9('0x16')]);}})['catch'](function(_0x377211){logger[_0xfed9('0x13')](_0xfed9('0x15'),_0x42bce7,_0x377211);_0x2d3b74(_0x377211);});});} \ No newline at end of file +var _0xebec=['lodash','util','randomstring','../../config/utils','../../config/logger','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','info','result','catch'];(function(_0x19159a,_0x1cb5c3){var _0xa677f4=function(_0x24bb85){while(--_0x24bb85){_0x19159a['push'](_0x19159a['shift']());}};_0xa677f4(++_0x1cb5c3);}(_0xebec,0x130));var _0xcebe=function(_0x5903da,_0x573b67){_0x5903da=_0x5903da-0x0;var _0x13f8bd=_0xebec[_0x5903da];return _0x13f8bd;};'use strict';var _=require(_0xcebe('0x0'));var util=require(_0xcebe('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcebe('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcebe('0x3'));var logger=require(_0xcebe('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c5447,_0x1f3ebe,_0x11909d){return new BPromise(function(_0x7ebd6b,_0x38f989){return client['request'](_0x2c5447,_0x11909d)['then'](function(_0x3ff79d){logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0x1f3ebe,_0xcebe('0x5'));logger[_0xcebe('0x6')](_0xcebe('0x7'),_0x1f3ebe,'request\x20sent',JSON[_0xcebe('0x8')](_0x3ff79d));if(_0x3ff79d[_0xcebe('0x9')]){if(_0x3ff79d['error'][_0xcebe('0xa')]===0x1f4){logger[_0xcebe('0x9')](_0xcebe('0xb'),_0x1f3ebe,_0x3ff79d[_0xcebe('0x9')][_0xcebe('0xc')]);return _0x38f989(_0x3ff79d[_0xcebe('0x9')][_0xcebe('0xc')]);}logger['error'](_0xcebe('0xb'),_0x1f3ebe,_0x3ff79d[_0xcebe('0x9')][_0xcebe('0xc')]);return _0x7ebd6b(_0x3ff79d[_0xcebe('0x9')][_0xcebe('0xc')]);}else{logger[_0xcebe('0xd')](_0xcebe('0xb'),_0x1f3ebe,'request\x20sent');_0x7ebd6b(_0x3ff79d[_0xcebe('0xe')]['message']);}})[_0xcebe('0xf')](function(_0x3ffa45){logger[_0xcebe('0x9')](_0xcebe('0xb'),_0x1f3ebe,_0x3ffa45);_0x38f989(_0x3ffa45);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 87d1337..6608bf6 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 _0x9f94=['exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x305551,_0x868339){var _0x115ce2=function(_0x49265b){while(--_0x49265b){_0x305551['push'](_0x305551['shift']());}};_0x115ce2(++_0x868339);}(_0x9f94,0x1e7));var _0x49f9=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x9f94[_0x178e48];return _0x440d7e;};'use strict';var multer=require(_0x49f9('0x0'));var util=require(_0x49f9('0x1'));var path=require(_0x49f9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x49f9('0x3')]();var fs_extra=require(_0x49f9('0x4'));var auth=require(_0x49f9('0x5'));var interaction=require(_0x49f9('0x6'));var config=require(_0x49f9('0x7'));var controller=require('./variable.controller');router[_0x49f9('0x8')]('/',auth[_0x49f9('0x9')](),controller[_0x49f9('0xa')]);router[_0x49f9('0x8')](_0x49f9('0xb'),auth[_0x49f9('0x9')](),controller[_0x49f9('0xc')]);router[_0x49f9('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x49f9('0xe')]('/:id',auth[_0x49f9('0x9')](),controller[_0x49f9('0xf')]);router[_0x49f9('0x10')]('/:id',auth[_0x49f9('0x9')](),controller['destroy']);module[_0x49f9('0x11')]=router; \ No newline at end of file +var _0xf3cd=['/:id','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x6330a4,_0x31ce3f){_0x6330a4=_0x6330a4-0x0;var _0x3a9b65=_0xf3cd[_0x6330a4];return _0x3a9b65;};'use strict';var multer=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var path=require(_0xdf3c('0x2'));var timeout=require(_0xdf3c('0x3'));var express=require(_0xdf3c('0x4'));var router=express[_0xdf3c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xdf3c('0x6'));var interaction=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var controller=require('./variable.controller');router[_0xdf3c('0x9')]('/',auth[_0xdf3c('0xa')](),controller[_0xdf3c('0xb')]);router[_0xdf3c('0x9')](_0xdf3c('0xc'),auth[_0xdf3c('0xa')](),controller['show']);router[_0xdf3c('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xdf3c('0xe')](_0xdf3c('0xc'),auth['isAuthenticated'](),controller[_0xdf3c('0xf')]);router[_0xdf3c('0x10')](_0xdf3c('0xc'),auth[_0xdf3c('0xa')](),controller[_0xdf3c('0x11')]);module[_0xdf3c('0x12')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 30f24e4..942bad5 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 _0xe5e7=['name','STRING'];(function(_0x17967e,_0x5d5b7c){var _0x45ab82=function(_0x5c53e9){while(--_0x5c53e9){_0x17967e['push'](_0x17967e['shift']());}};_0x45ab82(++_0x5d5b7c);}(_0xe5e7,0x10d));var _0x7e5e=function(_0x1b878e,_0x4bc26e){_0x1b878e=_0x1b878e-0x0;var _0x37389d=_0xe5e7[_0x1b878e];return _0x37389d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7e5e('0x0')],'unique':_0x7e5e('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7e5e('0x0')]}}; \ No newline at end of file +var _0xcd2a=['STRING','sequelize'];(function(_0x151d4b,_0xaf7ee0){var _0x5c215f=function(_0x4a1581){while(--_0x4a1581){_0x151d4b['push'](_0x151d4b['shift']());}};_0x5c215f(++_0xaf7ee0);}(_0xcd2a,0x1d7));var _0xacd2=function(_0x86b219,_0x43038f){_0x86b219=_0x86b219-0x0;var _0x1f320c=_0xcd2a[_0x86b219];return _0x1f320c;};'use strict';var Sequelize=require(_0xacd2('0x0'));module['exports']={'name':{'type':Sequelize[_0xacd2('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xacd2('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index eceacb9..fb0f996 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 _0x725e=['moment','bluebird','mustache','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','count','set','Content-Range','reject','save','update','then','destroy','get','Variables','error','name','map','Variable','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','includeAll','include','rows','catch','show','keys','length','options','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','params','eml-format','rimraf','zip-dir'];(function(_0x1cfd20,_0x537412){var _0x3a41d8=function(_0x31f4c1){while(--_0x31f4c1){_0x1cfd20['push'](_0x1cfd20['shift']());}};_0x3a41d8(++_0x537412);}(_0x725e,0xe7));var _0xe725=function(_0x361ee7,_0x1ebe00){_0x361ee7=_0x361ee7-0x0;var _0x24971b=_0x725e[_0x361ee7];return _0x24971b;};'use strict';var emlformat=require(_0xe725('0x0'));var rimraf=require(_0xe725('0x1'));var zipdir=require(_0xe725('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe725('0x3'));var BPromise=require(_0xe725('0x4'));var Mustache=require(_0xe725('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe725('0x6'));var fs=require('fs');var fs_extra=require(_0xe725('0x7'));var _=require(_0xe725('0x8'));var squel=require(_0xe725('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe725('0xa'));var toCsv=require(_0xe725('0xb'));var querystring=require(_0xe725('0xc'));var Papa=require('papaparse');var Redis=require(_0xe725('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xe725('0xe'));var as=require(_0xe725('0xf'));var hardwareService=require(_0xe725('0x10'));var logger=require(_0xe725('0x11'))(_0xe725('0x12'));var utils=require(_0xe725('0x13'));var config=require(_0xe725('0x14'));var licenseUtil=require(_0xe725('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x275225,_0x4f7975){_0x4f7975=_0x4f7975||0xcc;return function(_0x563a77){if(_0x563a77){return _0x275225[_0xe725('0x16')](_0x4f7975);}return _0x275225['status'](_0x4f7975)[_0xe725('0x17')]();};}function respondWithResult(_0x435cca,_0x3e5ed8){_0x3e5ed8=_0x3e5ed8||0xc8;return function(_0x2e9c2a){if(_0x2e9c2a){return _0x435cca[_0xe725('0x18')](_0x3e5ed8)['json'](_0x2e9c2a);}};}function respondWithFilteredResult(_0x235a65,_0x4341a8){return function(_0x2c7322){if(_0x2c7322){var _0x246263=typeof _0x4341a8[_0xe725('0x19')]===_0xe725('0x1a')&&typeof _0x4341a8['limit']===_0xe725('0x1a');var _0x195288=_0x2c7322[_0xe725('0x1b')];var _0x2fae22=_0x246263?0x0:_0x4341a8[_0xe725('0x19')];var _0x28795c=_0x246263?_0x2c7322[_0xe725('0x1b')]:_0x4341a8[_0xe725('0x19')]+_0x4341a8['limit'];var _0xe24f64;if(_0x28795c>=_0x195288){_0x28795c=_0x195288;_0xe24f64=0xc8;}else{_0xe24f64=0xce;}_0x235a65[_0xe725('0x18')](_0xe24f64);return _0x235a65[_0xe725('0x1c')](_0xe725('0x1d'),_0x2fae22+'-'+_0x28795c+'/'+_0x195288)['json'](_0x2c7322);}return null;};}function patchUpdates(_0x2f6f48){return function(_0x451444){try{jsonpatch['apply'](_0x451444,_0x2f6f48,!![]);}catch(_0x201be5){return BPromise[_0xe725('0x1e')](_0x201be5);}return _0x451444[_0xe725('0x1f')]();};}function saveUpdates(_0x5ee1db,_0x566465){return function(_0x2c9da7){if(_0x2c9da7){return _0x2c9da7[_0xe725('0x20')](_0x5ee1db)[_0xe725('0x21')](function(_0x5e5ec3){return _0x5e5ec3;});}return null;};}function removeEntity(_0x545109,_0x5b20c6){return function(_0x4aee9a){if(_0x4aee9a){return _0x4aee9a[_0xe725('0x22')]()[_0xe725('0x21')](function(){var _0x8a4e5c=_0x4aee9a[_0xe725('0x23')]({'plain':!![]});var _0x4ac91f=_0xe725('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x4ac91f,'resourceId':_0x8a4e5c['id']}})[_0xe725('0x21')](function(){return _0x4aee9a;});})[_0xe725('0x21')](function(){_0x545109[_0xe725('0x18')](0xcc)[_0xe725('0x17')]();});}};}function handleEntityNotFound(_0x1b94d9,_0x567fda){return function(_0xbbba3){if(!_0xbbba3){_0x1b94d9[_0xe725('0x16')](0x194);}return _0xbbba3;};}function handleError(_0x5e768a,_0x4f52be){_0x4f52be=_0x4f52be||0x1f4;return function(_0x480a60){logger[_0xe725('0x25')](_0x480a60['stack']);if(_0x480a60[_0xe725('0x26')]){delete _0x480a60[_0xe725('0x26')];}_0x5e768a[_0xe725('0x18')](_0x4f52be)['send'](_0x480a60);};}exports['index']=function(_0x57d7cc,_0xe01466){var _0x51c340={},_0x58af02={},_0x4de942={'count':0x0,'rows':[]};var _0x2a229e=_[_0xe725('0x27')](db[_0xe725('0x28')][_0xe725('0x29')],function(_0x38cd56){return{'name':_0x38cd56[_0xe725('0x2a')],'type':_0x38cd56[_0xe725('0x2b')][_0xe725('0x2c')]};});_0x58af02[_0xe725('0x2d')]=_[_0xe725('0x27')](_0x2a229e,_0xe725('0x26'));_0x58af02[_0xe725('0x2e')]=_['keys'](_0x57d7cc[_0xe725('0x2e')]);_0x58af02[_0xe725('0x2f')]=_['intersection'](_0x58af02['model'],_0x58af02[_0xe725('0x2e')]);_0x51c340[_0xe725('0x30')]=_[_0xe725('0x31')](_0x58af02[_0xe725('0x2d')],qs[_0xe725('0x32')](_0x57d7cc[_0xe725('0x2e')]['fields']));_0x51c340[_0xe725('0x30')]=_0x51c340[_0xe725('0x30')]['length']?_0x51c340[_0xe725('0x30')]:_0x58af02[_0xe725('0x2d')];if(!_0x57d7cc['query'][_0xe725('0x33')](_0xe725('0x34'))){_0x51c340[_0xe725('0x35')]=qs[_0xe725('0x35')](_0x57d7cc[_0xe725('0x2e')]['limit']);_0x51c340[_0xe725('0x19')]=qs[_0xe725('0x19')](_0x57d7cc[_0xe725('0x2e')][_0xe725('0x19')]);}_0x51c340[_0xe725('0x36')]=qs['sort'](_0x57d7cc[_0xe725('0x2e')][_0xe725('0x37')]);_0x51c340[_0xe725('0x38')]=qs[_0xe725('0x2f')](_['pick'](_0x57d7cc['query'],_0x58af02['filters']),_0x2a229e);if(_0x57d7cc[_0xe725('0x2e')][_0xe725('0x39')]){_0x51c340[_0xe725('0x38')]=_[_0xe725('0x3a')](_0x51c340['where'],{'$or':_[_0xe725('0x27')](_0x2a229e,function(_0x29453b){if(_0x29453b[_0xe725('0x2b')]!=='VIRTUAL'){var _0x5a250e={};_0x5a250e[_0x29453b[_0xe725('0x26')]]={'$like':'%'+_0x57d7cc[_0xe725('0x2e')][_0xe725('0x39')]+'%'};return _0x5a250e;}})});}_0x51c340=_['merge']({},_0x51c340,_0x57d7cc['options']);var _0xc9c675={'where':_0x51c340[_0xe725('0x38')]};return db[_0xe725('0x28')][_0xe725('0x1b')](_0xc9c675)['then'](function(_0x43d8a7){_0x4de942['count']=_0x43d8a7;if(_0x57d7cc[_0xe725('0x2e')][_0xe725('0x3b')]){_0x51c340[_0xe725('0x3c')]=[{'all':!![]}];}return db['Variable']['findAll'](_0x51c340);})[_0xe725('0x21')](function(_0x4de035){_0x4de942[_0xe725('0x3d')]=_0x4de035;return _0x4de942;})[_0xe725('0x21')](respondWithFilteredResult(_0xe01466,_0x51c340))[_0xe725('0x3e')](handleError(_0xe01466,null));};exports[_0xe725('0x3f')]=function(_0x45f514,_0x13db9c){var _0x93717e={'raw':!![],'where':{'id':_0x45f514['params']['id']}},_0x6f4926={};_0x6f4926['model']=_[_0xe725('0x40')](db[_0xe725('0x28')][_0xe725('0x29')]);_0x6f4926[_0xe725('0x2e')]=_[_0xe725('0x40')](_0x45f514[_0xe725('0x2e')]);_0x6f4926[_0xe725('0x2f')]=_['intersection'](_0x6f4926['model'],_0x6f4926['query']);_0x93717e['attributes']=_['intersection'](_0x6f4926[_0xe725('0x2d')],qs['fields'](_0x45f514['query'][_0xe725('0x32')]));_0x93717e[_0xe725('0x30')]=_0x93717e[_0xe725('0x30')][_0xe725('0x41')]?_0x93717e[_0xe725('0x30')]:_0x6f4926[_0xe725('0x2d')];if(_0x45f514[_0xe725('0x2e')][_0xe725('0x3b')]){_0x93717e['include']=[{'all':!![]}];}_0x93717e=_[_0xe725('0x3a')]({},_0x93717e,_0x45f514[_0xe725('0x42')]);return db[_0xe725('0x28')][_0xe725('0x43')](_0x93717e)[_0xe725('0x21')](handleEntityNotFound(_0x13db9c,null))[_0xe725('0x21')](respondWithResult(_0x13db9c,null))['catch'](handleError(_0x13db9c,null));};exports[_0xe725('0x44')]=function(_0x4e9c53,_0x14a924){return db[_0xe725('0x28')]['create'](_0x4e9c53[_0xe725('0x45')],{})[_0xe725('0x21')](function(_0x10a11a){var _0x8243f7=_0x4e9c53[_0xe725('0x46')][_0xe725('0x23')]({'plain':!![]});if(!_0x8243f7)throw new Error(_0xe725('0x47'));if(_0x8243f7['role']===_0xe725('0x46')){var _0x1bcb4e=_0x10a11a['get']({'plain':!![]});var _0x15bb63='Variables';return db[_0xe725('0x48')][_0xe725('0x43')]({'where':{'name':_0x15bb63,'userProfileId':_0x8243f7[_0xe725('0x49')]},'raw':!![]})['then'](function(_0x11da83){if(_0x11da83&&_0x11da83[_0xe725('0x4a')]===0x0){return db[_0xe725('0x4b')][_0xe725('0x44')]({'name':_0x1bcb4e[_0xe725('0x26')],'resourceId':_0x1bcb4e['id'],'type':_0x11da83[_0xe725('0x26')],'sectionId':_0x11da83['id']},{})[_0xe725('0x21')](function(){return _0x10a11a;});}else{return _0x10a11a;}})[_0xe725('0x3e')](function(_0x1cd24b){logger[_0xe725('0x25')](_0xe725('0x4c'),_0x1cd24b);throw _0x1cd24b;});}return _0x10a11a;})[_0xe725('0x21')](respondWithResult(_0x14a924,0xc9))[_0xe725('0x3e')](handleError(_0x14a924,null));};exports[_0xe725('0x20')]=function(_0x585d19,_0x588708){if(_0x585d19[_0xe725('0x45')]['id']){delete _0x585d19['body']['id'];}return db[_0xe725('0x28')][_0xe725('0x43')]({'where':{'id':_0x585d19['params']['id']}})[_0xe725('0x21')](handleEntityNotFound(_0x588708,null))[_0xe725('0x21')](saveUpdates(_0x585d19['body'],null))[_0xe725('0x21')](respondWithResult(_0x588708,null))[_0xe725('0x3e')](handleError(_0x588708,null));};exports[_0xe725('0x22')]=function(_0xeb4bc3,_0x17f1d3){return db['Variable'][_0xe725('0x43')]({'where':{'id':_0xeb4bc3[_0xe725('0x4d')]['id']}})[_0xe725('0x21')](handleEntityNotFound(_0x17f1d3,null))[_0xe725('0x21')](removeEntity(_0x17f1d3,null))['catch'](handleError(_0x17f1d3,null));}; \ No newline at end of file +var _0x69ab=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','to-csv','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','set','apply','reject','update','then','get','Variables','destroy','sendStatus','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error'];(function(_0x38abf2,_0x3c1cc0){var _0x2babe3=function(_0x1b3c22){while(--_0x1b3c22){_0x38abf2['push'](_0x38abf2['shift']());}};_0x2babe3(++_0x3c1cc0);}(_0x69ab,0x1d5));var _0xb69a=function(_0x355692,_0x751ee4){_0x355692=_0x355692-0x0;var _0x58d293=_0x69ab[_0x355692];return _0x58d293;};'use strict';var emlformat=require(_0xb69a('0x0'));var rimraf=require(_0xb69a('0x1'));var zipdir=require(_0xb69a('0x2'));var jsonpatch=require(_0xb69a('0x3'));var rp=require(_0xb69a('0x4'));var moment=require('moment');var BPromise=require(_0xb69a('0x5'));var Mustache=require('mustache');var util=require(_0xb69a('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xb69a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb69a('0x8'));var jsforce=require(_0xb69a('0x9'));var deskjs=require(_0xb69a('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb69a('0xb'));var Redis=require('ioredis');var authService=require(_0xb69a('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xb69a('0xd'));var hardwareService=require(_0xb69a('0xe'));var logger=require(_0xb69a('0xf'))(_0xb69a('0x10'));var utils=require(_0xb69a('0x11'));var config=require(_0xb69a('0x12'));var licenseUtil=require(_0xb69a('0x13'));var db=require(_0xb69a('0x14'))['db'];function respondWithStatusCode(_0x51e140,_0x38667f){_0x38667f=_0x38667f||0xcc;return function(_0x249b31){if(_0x249b31){return _0x51e140['sendStatus'](_0x38667f);}return _0x51e140[_0xb69a('0x15')](_0x38667f)['end']();};}function respondWithResult(_0x3dc143,_0xfc3385){_0xfc3385=_0xfc3385||0xc8;return function(_0x566c5b){if(_0x566c5b){return _0x3dc143[_0xb69a('0x15')](_0xfc3385)[_0xb69a('0x16')](_0x566c5b);}};}function respondWithFilteredResult(_0x4be7a7,_0x1d7e2e){return function(_0x29e5e7){if(_0x29e5e7){var _0x56d505=typeof _0x1d7e2e[_0xb69a('0x17')]===_0xb69a('0x18')&&typeof _0x1d7e2e['limit']==='undefined';var _0x8af270=_0x29e5e7[_0xb69a('0x19')];var _0x4a0c50=_0x56d505?0x0:_0x1d7e2e[_0xb69a('0x17')];var _0x43b6ec=_0x56d505?_0x29e5e7[_0xb69a('0x19')]:_0x1d7e2e[_0xb69a('0x17')]+_0x1d7e2e['limit'];var _0x5e1531;if(_0x43b6ec>=_0x8af270){_0x43b6ec=_0x8af270;_0x5e1531=0xc8;}else{_0x5e1531=0xce;}_0x4be7a7[_0xb69a('0x15')](_0x5e1531);return _0x4be7a7[_0xb69a('0x1a')]('Content-Range',_0x4a0c50+'-'+_0x43b6ec+'/'+_0x8af270)[_0xb69a('0x16')](_0x29e5e7);}return null;};}function patchUpdates(_0x43e098){return function(_0x389d12){try{jsonpatch[_0xb69a('0x1b')](_0x389d12,_0x43e098,!![]);}catch(_0x37c72a){return BPromise[_0xb69a('0x1c')](_0x37c72a);}return _0x389d12['save']();};}function saveUpdates(_0xb93528,_0x1d6745){return function(_0x87c6){if(_0x87c6){return _0x87c6[_0xb69a('0x1d')](_0xb93528)['then'](function(_0x361814){return _0x361814;});}return null;};}function removeEntity(_0x3c6a78,_0x27e99c){return function(_0x23c939){if(_0x23c939){return _0x23c939['destroy']()[_0xb69a('0x1e')](function(){var _0x10bfc4=_0x23c939[_0xb69a('0x1f')]({'plain':!![]});var _0x31e766=_0xb69a('0x20');return db['UserProfileResource'][_0xb69a('0x21')]({'where':{'type':_0x31e766,'resourceId':_0x10bfc4['id']}})[_0xb69a('0x1e')](function(){return _0x23c939;});})[_0xb69a('0x1e')](function(){_0x3c6a78[_0xb69a('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58900d,_0x2701ec){return function(_0x34c336){if(!_0x34c336){_0x58900d[_0xb69a('0x22')](0x194);}return _0x34c336;};}function handleError(_0x399407,_0x46794c){_0x46794c=_0x46794c||0x1f4;return function(_0x42ed03){logger['error'](_0x42ed03[_0xb69a('0x23')]);if(_0x42ed03['name']){delete _0x42ed03[_0xb69a('0x24')];}_0x399407[_0xb69a('0x15')](_0x46794c)[_0xb69a('0x25')](_0x42ed03);};}exports[_0xb69a('0x26')]=function(_0x1c255b,_0x2484cf){var _0x3f6bf8={},_0x4a1f2f={},_0x583001={'count':0x0,'rows':[]};var _0x31378d=_[_0xb69a('0x27')](db[_0xb69a('0x28')][_0xb69a('0x29')],function(_0x2509c6){return{'name':_0x2509c6[_0xb69a('0x2a')],'type':_0x2509c6[_0xb69a('0x2b')][_0xb69a('0x2c')]};});_0x4a1f2f[_0xb69a('0x2d')]=_[_0xb69a('0x27')](_0x31378d,_0xb69a('0x24'));_0x4a1f2f['query']=_['keys'](_0x1c255b[_0xb69a('0x2e')]);_0x4a1f2f[_0xb69a('0x2f')]=_[_0xb69a('0x30')](_0x4a1f2f['model'],_0x4a1f2f[_0xb69a('0x2e')]);_0x3f6bf8[_0xb69a('0x31')]=_[_0xb69a('0x30')](_0x4a1f2f[_0xb69a('0x2d')],qs['fields'](_0x1c255b[_0xb69a('0x2e')][_0xb69a('0x32')]));_0x3f6bf8[_0xb69a('0x31')]=_0x3f6bf8[_0xb69a('0x31')][_0xb69a('0x33')]?_0x3f6bf8[_0xb69a('0x31')]:_0x4a1f2f[_0xb69a('0x2d')];if(!_0x1c255b[_0xb69a('0x2e')][_0xb69a('0x34')](_0xb69a('0x35'))){_0x3f6bf8[_0xb69a('0x36')]=qs[_0xb69a('0x36')](_0x1c255b[_0xb69a('0x2e')]['limit']);_0x3f6bf8[_0xb69a('0x17')]=qs[_0xb69a('0x17')](_0x1c255b[_0xb69a('0x2e')][_0xb69a('0x17')]);}_0x3f6bf8[_0xb69a('0x37')]=qs[_0xb69a('0x38')](_0x1c255b[_0xb69a('0x2e')]['sort']);_0x3f6bf8[_0xb69a('0x39')]=qs['filters'](_[_0xb69a('0x3a')](_0x1c255b[_0xb69a('0x2e')],_0x4a1f2f[_0xb69a('0x2f')]),_0x31378d);if(_0x1c255b[_0xb69a('0x2e')][_0xb69a('0x3b')]){_0x3f6bf8[_0xb69a('0x39')]=_[_0xb69a('0x3c')](_0x3f6bf8['where'],{'$or':_[_0xb69a('0x27')](_0x31378d,function(_0x2fa085){if(_0x2fa085[_0xb69a('0x2b')]!==_0xb69a('0x3d')){var _0xff66be={};_0xff66be[_0x2fa085[_0xb69a('0x24')]]={'$like':'%'+_0x1c255b[_0xb69a('0x2e')]['filter']+'%'};return _0xff66be;}})});}_0x3f6bf8=_[_0xb69a('0x3c')]({},_0x3f6bf8,_0x1c255b['options']);var _0x165a24={'where':_0x3f6bf8['where']};return db[_0xb69a('0x28')]['count'](_0x165a24)['then'](function(_0x307195){_0x583001[_0xb69a('0x19')]=_0x307195;if(_0x1c255b['query'][_0xb69a('0x3e')]){_0x3f6bf8[_0xb69a('0x3f')]=[{'all':!![]}];}return db['Variable'][_0xb69a('0x40')](_0x3f6bf8);})[_0xb69a('0x1e')](function(_0x4f386d){_0x583001[_0xb69a('0x41')]=_0x4f386d;return _0x583001;})[_0xb69a('0x1e')](respondWithFilteredResult(_0x2484cf,_0x3f6bf8))[_0xb69a('0x42')](handleError(_0x2484cf,null));};exports['show']=function(_0x3e2a2b,_0x5da609){var _0x5ed5b6={'raw':!![],'where':{'id':_0x3e2a2b[_0xb69a('0x43')]['id']}},_0x4a0ae6={};_0x4a0ae6['model']=_['keys'](db['Variable'][_0xb69a('0x29')]);_0x4a0ae6[_0xb69a('0x2e')]=_['keys'](_0x3e2a2b[_0xb69a('0x2e')]);_0x4a0ae6[_0xb69a('0x2f')]=_['intersection'](_0x4a0ae6[_0xb69a('0x2d')],_0x4a0ae6[_0xb69a('0x2e')]);_0x5ed5b6['attributes']=_[_0xb69a('0x30')](_0x4a0ae6[_0xb69a('0x2d')],qs['fields'](_0x3e2a2b['query'][_0xb69a('0x32')]));_0x5ed5b6[_0xb69a('0x31')]=_0x5ed5b6[_0xb69a('0x31')][_0xb69a('0x33')]?_0x5ed5b6[_0xb69a('0x31')]:_0x4a0ae6[_0xb69a('0x2d')];if(_0x3e2a2b[_0xb69a('0x2e')][_0xb69a('0x3e')]){_0x5ed5b6[_0xb69a('0x3f')]=[{'all':!![]}];}_0x5ed5b6=_[_0xb69a('0x3c')]({},_0x5ed5b6,_0x3e2a2b[_0xb69a('0x44')]);return db[_0xb69a('0x28')][_0xb69a('0x45')](_0x5ed5b6)[_0xb69a('0x1e')](handleEntityNotFound(_0x5da609,null))[_0xb69a('0x1e')](respondWithResult(_0x5da609,null))[_0xb69a('0x42')](handleError(_0x5da609,null));};exports[_0xb69a('0x46')]=function(_0x1bc3be,_0x755a34){return db[_0xb69a('0x28')][_0xb69a('0x46')](_0x1bc3be[_0xb69a('0x47')],{})[_0xb69a('0x1e')](function(_0x302ef9){var _0x5ec91a=_0x1bc3be['user']['get']({'plain':!![]});if(!_0x5ec91a)throw new Error(_0xb69a('0x48'));if(_0x5ec91a[_0xb69a('0x49')]==='user'){var _0x4a7382=_0x302ef9[_0xb69a('0x1f')]({'plain':!![]});var _0x4e4b66=_0xb69a('0x20');return db[_0xb69a('0x4a')][_0xb69a('0x45')]({'where':{'name':_0x4e4b66,'userProfileId':_0x5ec91a[_0xb69a('0x4b')]},'raw':!![]})['then'](function(_0x1b9dd8){if(_0x1b9dd8&&_0x1b9dd8['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x4a7382[_0xb69a('0x24')],'resourceId':_0x4a7382['id'],'type':_0x1b9dd8[_0xb69a('0x24')],'sectionId':_0x1b9dd8['id']},{})[_0xb69a('0x1e')](function(){return _0x302ef9;});}else{return _0x302ef9;}})[_0xb69a('0x42')](function(_0x32a8d3){logger[_0xb69a('0x4c')](_0xb69a('0x4d'),_0x32a8d3);throw _0x32a8d3;});}return _0x302ef9;})[_0xb69a('0x1e')](respondWithResult(_0x755a34,0xc9))[_0xb69a('0x42')](handleError(_0x755a34,null));};exports[_0xb69a('0x1d')]=function(_0x3449df,_0x42c42a){if(_0x3449df[_0xb69a('0x47')]['id']){delete _0x3449df['body']['id'];}return db[_0xb69a('0x28')][_0xb69a('0x45')]({'where':{'id':_0x3449df[_0xb69a('0x43')]['id']}})['then'](handleEntityNotFound(_0x42c42a,null))['then'](saveUpdates(_0x3449df[_0xb69a('0x47')],null))[_0xb69a('0x1e')](respondWithResult(_0x42c42a,null))[_0xb69a('0x42')](handleError(_0x42c42a,null));};exports[_0xb69a('0x21')]=function(_0x33e389,_0x1f4dd1){return db[_0xb69a('0x28')][_0xb69a('0x45')]({'where':{'id':_0x33e389[_0xb69a('0x43')]['id']}})[_0xb69a('0x1e')](handleEntityNotFound(_0x1f4dd1,null))['then'](removeEntity(_0x1f4dd1,null))[_0xb69a('0x42')](handleError(_0x1f4dd1,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index ce0fb34..1a7e234 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 _0x34fb=['define','tools_variables','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports'];(function(_0x289c9d,_0x55993d){var _0x3b749c=function(_0x3fba0f){while(--_0x3fba0f){_0x289c9d['push'](_0x289c9d['shift']());}};_0x3b749c(++_0x55993d);}(_0x34fb,0xd4));var _0xb34f=function(_0x1f0024,_0x2d41b5){_0x1f0024=_0x1f0024-0x0;var _0x41da1d=_0x34fb[_0x1f0024];return _0x41da1d;};'use strict';var _=require('lodash');var util=require(_0xb34f('0x0'));var logger=require(_0xb34f('0x1'))(_0xb34f('0x2'));var moment=require(_0xb34f('0x3'));var BPromise=require(_0xb34f('0x4'));var rp=require(_0xb34f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb34f('0x6'));var config=require('../../config/environment');var attributes=require('./variable.attributes');module[_0xb34f('0x7')]=function(_0x6d3bfe,_0x27811d){return _0x6d3bfe[_0xb34f('0x8')]('Variable',attributes,{'tableName':_0xb34f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e08=['exports','define','Variable','tools_variables','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./variable.attributes'];(function(_0x4da382,_0x4cfc5d){var _0x10073f=function(_0x32dc45){while(--_0x32dc45){_0x4da382['push'](_0x4da382['shift']());}};_0x10073f(++_0x4cfc5d);}(_0x5e08,0xfb));var _0x85e0=function(_0x3840d5,_0x123651){_0x3840d5=_0x3840d5-0x0;var _0xca29fd=_0x5e08[_0x3840d5];return _0xca29fd;};'use strict';var _=require(_0x85e0('0x0'));var util=require(_0x85e0('0x1'));var logger=require(_0x85e0('0x2'))(_0x85e0('0x3'));var moment=require(_0x85e0('0x4'));var BPromise=require(_0x85e0('0x5'));var rp=require(_0x85e0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x85e0('0x7'));var attributes=require(_0x85e0('0x8'));module[_0x85e0('0x9')]=function(_0x275df9,_0x15d4b7){return _0x275df9[_0x85e0('0xa')](_0x85e0('0xb'),attributes,{'tableName':_0x85e0('0xc'),'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 0cab551..75326a2 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 _0xabce=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowVariable','Variable','find','options','attributes','map','include','model','catch','lodash','util'];(function(_0x485722,_0x3fb3e7){var _0x356a5d=function(_0x215584){while(--_0x215584){_0x485722['push'](_0x485722['shift']());}};_0x356a5d(++_0x3fb3e7);}(_0xabce,0x103));var _0xeabc=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xabce[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Variable,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});}exports[_0xeabc('0x14')]=function(_0x58a3c0){var _0x16f08b=this;return new Promise(function(_0x31dd53,_0x31f52a){return db[_0xeabc('0x15')][_0xeabc('0x16')]({'raw':_0x58a3c0['options']?_0x58a3c0[_0xeabc('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['where']||null:null,'attributes':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x18')]||null:null,'include':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['include']?_[_0xeabc('0x19')](_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x1a')],function(_0x5bdd57){return{'model':db[_0x5bdd57[_0xeabc('0x1b')]],'as':_0x5bdd57['as'],'attributes':_0x5bdd57[_0xeabc('0x18')],'include':_0x5bdd57[_0xeabc('0x1a')]?_[_0xeabc('0x19')](_0x5bdd57['include'],function(_0x109e1d){return{'model':db[_0x109e1d['model']],'as':_0x109e1d['as'],'attributes':_0x109e1d[_0xeabc('0x18')],'include':_0x109e1d['include']?_[_0xeabc('0x19')](_0x109e1d[_0xeabc('0x1a')],function(_0x269621){return{'model':db[_0x269621[_0xeabc('0x1b')]],'as':_0x269621['as'],'attributes':_0x269621[_0xeabc('0x18')]};}):[]};}):[]};}):[]:[]})[_0xeabc('0x9')](function(_0x131722){logger['info']('ShowVariable',_0x58a3c0);logger[_0xeabc('0xd')]('ShowVariable',_0x58a3c0,JSON[_0xeabc('0xf')](_0x131722));_0x31dd53(_0x131722);})[_0xeabc('0x1c')](function(_0x48fb52){logger[_0xeabc('0x10')](_0xeabc('0x14'),_0x48fb52[_0xeabc('0x12')],_0x58a3c0);_0x31f52a(_0x16f08b[_0xeabc('0x10')](0x1f4,_0x48fb52[_0xeabc('0x12')]));});});}; \ 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(_0x218554,_0x2896f4){var _0x3a2bbf=function(_0x106868){while(--_0x106868){_0x218554['push'](_0x218554['shift']());}};_0x3a2bbf(++_0x2896f4);}(_0x6aa7,0x178));var _0x76aa=function(_0x480757,_0xa6e70c){_0x480757=_0x480757-0x0;var _0x15ac5f=_0x6aa7[_0x480757];return _0x15ac5f;};'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 1b7e962..69431a3 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 _0x871d=['/restart','/migrations','exports','express','../../components/auth/service','get','index','/fetch','isAuthenticated','canUpdate','/reset','reset','/pull','pull'];(function(_0x1792ae,_0x3738a3){var _0x379871=function(_0x5d5195){while(--_0x5d5195){_0x1792ae['push'](_0x1792ae['shift']());}};_0x379871(++_0x3738a3);}(_0x871d,0x10d));var _0xd871=function(_0x2ca142,_0x198244){_0x2ca142=_0x2ca142-0x0;var _0x290778=_0x871d[_0x2ca142];return _0x290778;};'use strict';var express=require(_0xd871('0x0'));var router=express['Router']();var auth=require(_0xd871('0x1'));var controller=require('./version.controller');router[_0xd871('0x2')]('/',controller[_0xd871('0x3')]);router[_0xd871('0x2')](_0xd871('0x4'),auth[_0xd871('0x5')](),auth[_0xd871('0x6')](),controller['fetch']);router[_0xd871('0x2')](_0xd871('0x7'),auth[_0xd871('0x5')](),auth[_0xd871('0x6')](),controller[_0xd871('0x8')]);router[_0xd871('0x2')](_0xd871('0x9'),auth[_0xd871('0x5')](),auth['canUpdate'](),controller[_0xd871('0xa')]);router[_0xd871('0x2')](_0xd871('0xb'),auth[_0xd871('0x5')](),controller['restart']);router[_0xd871('0x2')](_0xd871('0xc'),controller['migrations']);module[_0xd871('0xd')]=router; \ No newline at end of file +var _0x8ac2=['Router','../../components/auth/service','index','get','isAuthenticated','canUpdate','reset','/pull','pull','restart','/migrations','migrations','exports'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0x8ac2,0x1ad));var _0x28ac=function(_0x43e971,_0x40a2b8){_0x43e971=_0x43e971-0x0;var _0x165954=_0x8ac2[_0x43e971];return _0x165954;};'use strict';var express=require('express');var router=express[_0x28ac('0x0')]();var auth=require(_0x28ac('0x1'));var controller=require('./version.controller');router['get']('/',controller[_0x28ac('0x2')]);router[_0x28ac('0x3')]('/fetch',auth[_0x28ac('0x4')](),auth[_0x28ac('0x5')](),controller['fetch']);router[_0x28ac('0x3')]('/reset',auth[_0x28ac('0x4')](),auth['canUpdate'](),controller[_0x28ac('0x6')]);router['get'](_0x28ac('0x7'),auth[_0x28ac('0x4')](),auth[_0x28ac('0x5')](),controller[_0x28ac('0x8')]);router[_0x28ac('0x3')]('/restart',auth[_0x28ac('0x4')](),controller[_0x28ac('0x9')]);router[_0x28ac('0x3')](_0x28ac('0xa'),controller[_0x28ac('0xb')]);module[_0x28ac('0xc')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index c057c7e..ee8cd4b 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 _0x6e24=['master','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','pull','npm\x20install\x20--production','info','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','readdirSync','join','server','replace','.js','push','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.','migrations','\x20to\x20','last','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','exports','latest','json','status','fetch','origin'];(function(_0x8b6b0c,_0x2e259f){var _0x45b7c3=function(_0x4bc39d){while(--_0x4bc39d){_0x8b6b0c['push'](_0x8b6b0c['shift']());}};_0x45b7c3(++_0x2e259f);}(_0x6e24,0xf0));var _0x46e2=function(_0x5a112b,_0x3e6cc6){_0x5a112b=_0x5a112b-0x0;var _0x19931c=_0x6e24[_0x5a112b];return _0x19931c;};'use strict';var Umzug=require(_0x46e2('0x0'));var path=require(_0x46e2('0x1'));var fs=require('fs');var _=require(_0x46e2('0x2'));var pkginfo=require(_0x46e2('0x3'))(module,_0x46e2('0x4'));var compareVersions=require('compare-versions');var exec=require(_0x46e2('0x5'))[_0x46e2('0x6')];var db=require(_0x46e2('0x7'))['db'];var config=require(_0x46e2('0x8'));var pm2=require(_0x46e2('0x9'));var logger=require(_0x46e2('0xa'))(_0x46e2('0xb'));var git=require(_0x46e2('0xc'))(config[_0x46e2('0xd')]);exports['index']=function(_0x531d41,_0x431863){var _0x1417ed={'current':module[_0x46e2('0xe')][_0x46e2('0x4')],'phonebar':0x2};if(_0x531d41['query']&&_0x531d41['query'][_0x46e2('0xf')]){return git['fetch']()['tags'](function(_0x405c75,_0x515a7f){_0x1417ed[_0x46e2('0xf')]=(_0x405c75?module[_0x46e2('0xe')][_0x46e2('0x4')]:_0x515a7f['latest'])||'2.0.0';return _0x431863['status'](0xc8)[_0x46e2('0x10')](_0x1417ed);});}else{return _0x431863[_0x46e2('0x11')](0xc8)['json'](_0x1417ed);}};exports['fetch']=function(_0x491901,_0x5dc907){return git[_0x46e2('0x12')]([_0x46e2('0x13'),_0x46e2('0x14')],function(_0x57a4a9){if(_0x57a4a9){logger[_0x46e2('0x15')](_0x57a4a9);return _0x5dc907[_0x46e2('0x11')](0x1f4)['json'](_0x57a4a9);}logger['info'](_0x46e2('0x16'));return _0x5dc907['status'](0xc8)[_0x46e2('0x10')]({'output':_0x46e2('0x17')});});};exports[_0x46e2('0x18')]=function(_0x57664a,_0x1c6d86){return git[_0x46e2('0x18')](['--hard',_0x46e2('0x19')],function(_0x40bca5){if(_0x40bca5){logger[_0x46e2('0x15')](_0x40bca5);return _0x1c6d86[_0x46e2('0x11')](0x1f4)[_0x46e2('0x10')](_0x40bca5);}logger['info']('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x1c6d86[_0x46e2('0x11')](0xc8)[_0x46e2('0x10')]({'output':'git\x20reset\x20--hard'});});};exports[_0x46e2('0x1a')]=function(_0x11c1cd,_0x58dcdf){exec(_0x46e2('0x1b'),function(_0x2c6272,_0x2e6be1,_0x4d3fa1){logger[_0x46e2('0x1c')](_0x2e6be1);logger[_0x46e2('0x1c')](_0x4d3fa1);if(_0x2c6272){logger[_0x46e2('0x15')](_0x2c6272);return _0x58dcdf['status'](0x1f4)[_0x46e2('0x10')](_0x2c6272);}return _0x58dcdf[_0x46e2('0x11')](0xc8)[_0x46e2('0x10')]({'output':_0x2e6be1});});};exports[_0x46e2('0x1d')]=function(_0x511efb,_0x59de5d){return pm2[_0x46e2('0x1d')](_0x46e2('0x1e'))[_0x46e2('0x1f')](function(_0x270dc3){logger[_0x46e2('0x1c')](_0x46e2('0x20'),_0x270dc3);return _0x59de5d[_0x46e2('0x11')](0xc8)[_0x46e2('0x10')]({'output':_0x46e2('0x21')});})['catch'](function(_0x822ff1){logger[_0x46e2('0x15')](_0x822ff1);return _0x59de5d[_0x46e2('0x11')](0x1f4)[_0x46e2('0x10')](_0x822ff1);});};exports['migrations']=function(_0x12e5a8,_0x510aa1){var _0x361037=fs[_0x46e2('0x22')](path[_0x46e2('0x23')](config['root'],_0x46e2('0x24'),'migrations'));var _0x1b97bd=[];for(var _0x70f9a0=0x0;_0x70f9a0<_0x361037['length'];_0x70f9a0++){var _0x49ae30=_0x361037[_0x70f9a0][_0x46e2('0x25')](_0x46e2('0x26'),'');if(compareVersions(module[_0x46e2('0xe')]['version'],_0x49ae30)===-0x1){_0x1b97bd[_0x46e2('0x27')](_0x49ae30);}}if(_0x1b97bd['length']){var _0x345d36=_0x1b97bd[_0x46e2('0x28')](compareVersions);var _0x42cdf3=new Umzug({'storage':_0x46e2('0x29'),'storageOptions':{'model':db['Migration'],'modelName':_0x46e2('0x2a'),'columnName':_0x46e2('0x4')},'migrations':{'params':[db[_0x46e2('0x29')][_0x46e2('0x2b')](),db[_0x46e2('0x29')][_0x46e2('0x2c')],function(){throw new Error(_0x46e2('0x2d'));}],'path':path['join'](config[_0x46e2('0xd')],_0x46e2('0x24'),_0x46e2('0x2e')),'pattern':/\.js$/}});_0x42cdf3['up']({'migrations':_['map'](_0x345d36,function(_0x491434){return _0x491434+_0x46e2('0x26');})})[_0x46e2('0x1f')](function(){return _0x510aa1[_0x46e2('0x11')](0xc8)[_0x46e2('0x10')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x46e2('0xe')][_0x46e2('0x4')]+_0x46e2('0x2f')+_[_0x46e2('0x30')](_0x345d36),'migrations':_[_0x46e2('0x23')](_0x345d36)});})[_0x46e2('0x31')](function(_0x330e8c){if(_0x330e8c instanceof db['sequelize'][_0x46e2('0x32')]){return _0x510aa1[_0x46e2('0x11')](0xc8)['json']({'output':_0x46e2('0x33')});}else{return _0x510aa1['status'](0x1f4)[_0x46e2('0x10')](_0x330e8c);}});}else{return _0x510aa1['status'](0xc8)[_0x46e2('0x10')]({'output':_0x46e2('0x33')});}}; \ No newline at end of file +var _0x235f=['json','origin','master','error','info','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard','restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','readdirSync','join','migrations','length','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.','server','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','simple-git','root','index','query','latest','fetch','tags','exports','status'];(function(_0x474220,_0x800f8b){var _0x5ba7af=function(_0x226f00){while(--_0x226f00){_0x474220['push'](_0x474220['shift']());}};_0x5ba7af(++_0x800f8b);}(_0x235f,0xfa));var _0xf235=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x235f[_0xefd519];return _0x4bb882;};'use strict';var Umzug=require(_0xf235('0x0'));var path=require(_0xf235('0x1'));var fs=require('fs');var _=require(_0xf235('0x2'));var pkginfo=require(_0xf235('0x3'))(module,_0xf235('0x4'));var compareVersions=require(_0xf235('0x5'));var exec=require(_0xf235('0x6'))[_0xf235('0x7')];var db=require(_0xf235('0x8'))['db'];var config=require(_0xf235('0x9'));var pm2=require(_0xf235('0xa'));var logger=require('../../config/logger')('update');var git=require(_0xf235('0xb'))(config[_0xf235('0xc')]);exports[_0xf235('0xd')]=function(_0x672d6d,_0x51cd05){var _0x415058={'current':module['exports'][_0xf235('0x4')],'phonebar':0x2};if(_0x672d6d[_0xf235('0xe')]&&_0x672d6d[_0xf235('0xe')][_0xf235('0xf')]){return git[_0xf235('0x10')]()[_0xf235('0x11')](function(_0x2e5a91,_0x25da74){_0x415058[_0xf235('0xf')]=(_0x2e5a91?module[_0xf235('0x12')][_0xf235('0x4')]:_0x25da74[_0xf235('0xf')])||'2.0.0';return _0x51cd05[_0xf235('0x13')](0xc8)['json'](_0x415058);});}else{return _0x51cd05[_0xf235('0x13')](0xc8)[_0xf235('0x14')](_0x415058);}};exports['fetch']=function(_0x44f041,_0x172803){return git['fetch']([_0xf235('0x15'),_0xf235('0x16')],function(_0x18127f){if(_0x18127f){logger[_0xf235('0x17')](_0x18127f);return _0x172803[_0xf235('0x13')](0x1f4)['json'](_0x18127f);}logger[_0xf235('0x18')]('git\x20fetch');return _0x172803['status'](0xc8)['json']({'output':_0xf235('0x19')});});};exports['reset']=function(_0x3bba8f,_0x1e1c8a){return git[_0xf235('0x1a')]([_0xf235('0x1b'),_0xf235('0x1c')],function(_0xc68ebf){if(_0xc68ebf){logger[_0xf235('0x17')](_0xc68ebf);return _0x1e1c8a[_0xf235('0x13')](0x1f4)[_0xf235('0x14')](_0xc68ebf);}logger['info']('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x1e1c8a[_0xf235('0x13')](0xc8)['json']({'output':_0xf235('0x1d')});});};exports['pull']=function(_0x5538d5,_0x5d0e29){exec('npm\x20install\x20--production',function(_0x1c0749,_0x1842ed,_0x557a27){logger[_0xf235('0x18')](_0x1842ed);logger[_0xf235('0x18')](_0x557a27);if(_0x1c0749){logger[_0xf235('0x17')](_0x1c0749);return _0x5d0e29[_0xf235('0x13')](0x1f4)[_0xf235('0x14')](_0x1c0749);}return _0x5d0e29[_0xf235('0x13')](0xc8)['json']({'output':_0x1842ed});});};exports[_0xf235('0x1e')]=function(_0x3254fa,_0x272eb9){return pm2[_0xf235('0x1e')]('motion2')[_0xf235('0x1f')](function(_0xcc21c5){logger['info'](_0xf235('0x20'),_0xcc21c5);return _0x272eb9[_0xf235('0x13')](0xc8)['json']({'output':_0xf235('0x21')});})['catch'](function(_0x186802){logger['error'](_0x186802);return _0x272eb9['status'](0x1f4)[_0xf235('0x14')](_0x186802);});};exports['migrations']=function(_0x138d10,_0x2d7fa3){var _0x3202bb=fs[_0xf235('0x22')](path[_0xf235('0x23')](config[_0xf235('0xc')],'server',_0xf235('0x24')));var _0x318caa=[];for(var _0x54f328=0x0;_0x54f328<_0x3202bb[_0xf235('0x25')];_0x54f328++){var _0x48c7cf=_0x3202bb[_0x54f328][_0xf235('0x26')](_0xf235('0x27'),'');if(compareVersions(module[_0xf235('0x12')]['version'],_0x48c7cf)===-0x1){_0x318caa['push'](_0x48c7cf);}}if(_0x318caa[_0xf235('0x25')]){var _0x2c8bd1=_0x318caa[_0xf235('0x28')](compareVersions);var _0xaeca5c=new Umzug({'storage':_0xf235('0x29'),'storageOptions':{'model':db[_0xf235('0x2a')],'modelName':_0xf235('0x2a'),'columnName':_0xf235('0x4')},'migrations':{'params':[db[_0xf235('0x29')][_0xf235('0x2b')](),db[_0xf235('0x29')][_0xf235('0x2c')],function(){throw new Error(_0xf235('0x2d'));}],'path':path[_0xf235('0x23')](config[_0xf235('0xc')],_0xf235('0x2e'),_0xf235('0x24')),'pattern':/\.js$/}});_0xaeca5c['up']({'migrations':_[_0xf235('0x2f')](_0x2c8bd1,function(_0x28f1f8){return _0x28f1f8+'.js';})})[_0xf235('0x1f')](function(){return _0x2d7fa3[_0xf235('0x13')](0xc8)[_0xf235('0x14')]({'output':_0xf235('0x30')+module[_0xf235('0x12')][_0xf235('0x4')]+_0xf235('0x31')+_[_0xf235('0x32')](_0x2c8bd1),'migrations':_[_0xf235('0x23')](_0x2c8bd1)});})[_0xf235('0x33')](function(_0x44d3c7){if(_0x44d3c7 instanceof db[_0xf235('0x29')][_0xf235('0x34')]){return _0x2d7fa3[_0xf235('0x13')](0xc8)[_0xf235('0x14')]({'output':_0xf235('0x35')});}else{return _0x2d7fa3[_0xf235('0x13')](0x1f4)[_0xf235('0x14')](_0x44d3c7);}});}else{return _0x2d7fa3[_0xf235('0x13')](0xc8)[_0xf235('0x14')]({'output':_0xf235('0x35')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 5616c72..549bd26 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 _0xa84e=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./voiceAgentReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','put','update','delete','destroy'];(function(_0x3eb540,_0x4e517a){var _0x2e88d8=function(_0x5902aa){while(--_0x5902aa){_0x3eb540['push'](_0x3eb540['shift']());}};_0x2e88d8(++_0x4e517a);}(_0xa84e,0x151));var _0xea84=function(_0x1e500e,_0x2c9d74){_0x1e500e=_0x1e500e-0x0;var _0x10dc5e=_0xa84e[_0x1e500e];return _0x10dc5e;};'use strict';var multer=require(_0xea84('0x0'));var util=require(_0xea84('0x1'));var path=require(_0xea84('0x2'));var timeout=require(_0xea84('0x3'));var express=require(_0xea84('0x4'));var router=express['Router']();var fs_extra=require(_0xea84('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xea84('0x6'));var config=require('../../config/environment');var controller=require(_0xea84('0x7'));router[_0xea84('0x8')]('/',auth['isAuthenticated'](),controller[_0xea84('0x9')]);router[_0xea84('0x8')](_0xea84('0xa'),auth[_0xea84('0xb')](),controller[_0xea84('0xc')]);router['get'](_0xea84('0xd'),auth[_0xea84('0xb')](),controller[_0xea84('0xe')]);router[_0xea84('0xf')]('/',auth[_0xea84('0xb')](),controller['create']);router[_0xea84('0x10')](_0xea84('0xd'),auth[_0xea84('0xb')](),controller[_0xea84('0x11')]);router[_0xea84('0x12')](_0xea84('0xd'),auth[_0xea84('0xb')](),controller[_0xea84('0x13')]);module[_0xea84('0x14')]=router; \ No newline at end of file +var _0x70b1=['path','express','Router','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x5de214,_0x107e9d){var _0x4df627=function(_0x4199e1){while(--_0x4199e1){_0x5de214['push'](_0x5de214['shift']());}};_0x4df627(++_0x107e9d);}(_0x70b1,0x17c));var _0x170b=function(_0x4885bf,_0x1b0302){_0x4885bf=_0x4885bf-0x0;var _0x164066=_0x70b1[_0x4885bf];return _0x164066;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x170b('0x0'));var timeout=require('connect-timeout');var express=require(_0x170b('0x1'));var router=express[_0x170b('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x170b('0x3'));var config=require(_0x170b('0x4'));var controller=require(_0x170b('0x5'));router[_0x170b('0x6')]('/',auth[_0x170b('0x7')](),controller[_0x170b('0x8')]);router['get'](_0x170b('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x170b('0x6')]('/:id',auth[_0x170b('0x7')](),controller[_0x170b('0xa')]);router[_0x170b('0xb')]('/',auth['isAuthenticated'](),controller[_0x170b('0xc')]);router[_0x170b('0xd')](_0x170b('0xe'),auth['isAuthenticated'](),controller[_0x170b('0xf')]);router[_0x170b('0x10')](_0x170b('0xe'),auth[_0x170b('0x7')](),controller[_0x170b('0x11')]);module[_0x170b('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 64fc68d..d02ae38 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 _0x94e6=['STRING','DATE','INTEGER','BOOLEAN','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x94e6,0x194));var _0x694e=function(_0x364e3f,_0x9761bf){_0x364e3f=_0x364e3f-0x0;var _0xc18c5a=_0x94e6[_0x364e3f];return _0xc18c5a;};'use strict';var Sequelize=require(_0x694e('0x0'));module['exports']={'type':{'type':Sequelize[_0x694e('0x1')]},'uniqueid':{'type':Sequelize[_0x694e('0x1')]},'calleridnum':{'type':Sequelize[_0x694e('0x1')]},'calleridname':{'type':Sequelize[_0x694e('0x1')]},'queue':{'type':Sequelize[_0x694e('0x1')]},'interface':{'type':Sequelize[_0x694e('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x694e('0x2')]},'agentconnectAt':{'type':Sequelize[_0x694e('0x2')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x694e('0x2')]},'holdtime':{'type':Sequelize[_0x694e('0x3')]},'agentcomplete':{'type':Sequelize[_0x694e('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x694e('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x694e('0x1')]},'channel':{'type':Sequelize[_0x694e('0x1')]},'channelstate':{'type':Sequelize[_0x694e('0x3')]},'channelstatedesc':{'type':Sequelize[_0x694e('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x694e('0x1')]},'language':{'type':Sequelize[_0x694e('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x694e('0x1')]},'exten':{'type':Sequelize[_0x694e('0x1')]},'priority':{'type':Sequelize[_0x694e('0x1')]},'destchannel':{'type':Sequelize[_0x694e('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x694e('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x694e('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x694e('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x694e('0x1')]},'destlanguage':{'type':Sequelize[_0x694e('0x1')]},'destaccountcode':{'type':Sequelize[_0x694e('0x1')]},'destcontext':{'type':Sequelize[_0x694e('0x1')]},'destexten':{'type':Sequelize[_0x694e('0x1')]},'destpriority':{'type':Sequelize[_0x694e('0x1')]},'destuniqueid':{'type':Sequelize[_0x694e('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x694e('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x694e('0x1')]},'transfer':{'type':Sequelize[_0x694e('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x694e('0x1')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x694e('0x1')]},'transferuniqueid':{'type':Sequelize[_0x694e('0x1')]},'agententerreason':{'type':Sequelize[_0x694e('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7497=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports'];(function(_0x525b28,_0x5cf5a0){var _0x180178=function(_0x43e066){while(--_0x43e066){_0x525b28['push'](_0x525b28['shift']());}};_0x180178(++_0x5cf5a0);}(_0x7497,0xd0));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7749('0x0'));module[_0x7749('0x1')]={'type':{'type':Sequelize[_0x7749('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x7749('0x2')]},'interface':{'type':Sequelize[_0x7749('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x7749('0x3')]},'agentconnectAt':{'type':Sequelize[_0x7749('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x7749('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x7749('0x3')]},'agentdumpAt':{'type':Sequelize[_0x7749('0x3')]},'holdtime':{'type':Sequelize[_0x7749('0x4')]},'agentcomplete':{'type':Sequelize[_0x7749('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x7749('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x7749('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x7749('0x4')]},'agentacw':{'type':Sequelize[_0x7749('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x7749('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x7749('0x2')]},'channelstate':{'type':Sequelize[_0x7749('0x4')]},'channelstatedesc':{'type':Sequelize[_0x7749('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7749('0x2')]},'connectedlinename':{'type':Sequelize[_0x7749('0x2')]},'language':{'type':Sequelize[_0x7749('0x2')]},'accountcode':{'type':Sequelize[_0x7749('0x2')]},'context':{'type':Sequelize[_0x7749('0x2')]},'exten':{'type':Sequelize[_0x7749('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x7749('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x7749('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x7749('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x7749('0x2')]},'destlanguage':{'type':Sequelize[_0x7749('0x2')]},'destaccountcode':{'type':Sequelize[_0x7749('0x2')]},'destcontext':{'type':Sequelize[_0x7749('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x7749('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x7749('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x7749('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7749('0x2')],'comment':_0x7749('0x6')},'transferexten':{'type':Sequelize[_0x7749('0x2')]},'transferuniqueid':{'type':Sequelize[_0x7749('0x2')]},'agententerreason':{'type':Sequelize[_0x7749('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 423de28..bde5066 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(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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 72757a6..4a50694 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 _0xe9e7=['report_agent','destuniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','define'];(function(_0x13397a,_0x4d7425){var _0x1a111a=function(_0x2491fd){while(--_0x2491fd){_0x13397a['push'](_0x13397a['shift']());}};_0x1a111a(++_0x4d7425);}(_0xe9e7,0x1f0));var _0x7e9e=function(_0x31cfe9,_0x44c183){_0x31cfe9=_0x31cfe9-0x0;var _0x5a5b28=_0xe9e7[_0x31cfe9];return _0x5a5b28;};'use strict';var _=require(_0x7e9e('0x0'));var util=require(_0x7e9e('0x1'));var logger=require(_0x7e9e('0x2'))('api');var moment=require(_0x7e9e('0x3'));var BPromise=require(_0x7e9e('0x4'));var rp=require(_0x7e9e('0x5'));var fs=require('fs');var path=require(_0x7e9e('0x6'));var rimraf=require(_0x7e9e('0x7'));var config=require(_0x7e9e('0x8'));var attributes=require(_0x7e9e('0x9'));module['exports']=function(_0x319f70,_0x134fac){return _0x319f70[_0x7e9e('0xa')]('VoiceAgentReport',attributes,{'tableName':_0x7e9e('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x7e9e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xde64=['report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','exports','VoiceAgentReport'];(function(_0x4c73f2,_0x168ac5){var _0x257b36=function(_0xaeb311){while(--_0xaeb311){_0x4c73f2['push'](_0x4c73f2['shift']());}};_0x257b36(++_0x168ac5);}(_0xde64,0x17c));var _0x4de6=function(_0x24c893,_0x24a8aa){_0x24c893=_0x24c893-0x0;var _0x4d3e4a=_0xde64[_0x24c893];return _0x4d3e4a;};'use strict';var _=require(_0x4de6('0x0'));var util=require(_0x4de6('0x1'));var logger=require(_0x4de6('0x2'))(_0x4de6('0x3'));var moment=require(_0x4de6('0x4'));var BPromise=require(_0x4de6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4de6('0x6'));var rimraf=require(_0x4de6('0x7'));var config=require('../../config/environment');var attributes=require('./voiceAgentReport.attributes');module[_0x4de6('0x8')]=function(_0x45867b,_0x4da17f){return _0x45867b['define'](_0x4de6('0x9'),attributes,{'tableName':_0x4de6('0xa'),'paranoid':![],'indexes':[{'fields':[_0x4de6('0xb'),_0x4de6('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 6fb562f..639c94b 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 _0xf508=['result','catch','CreateVoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport','VoiceAgentReport','update','where','attributes','limit','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x5f26f4,_0x4f9bcf){var _0x385e31=function(_0x20d9d7){while(--_0x20d9d7){_0x5f26f4['push'](_0x5f26f4['shift']());}};_0x385e31(++_0x4f9bcf);}(_0xf508,0xf4));var _0x8f50=function(_0x327664,_0x39a926){_0x327664=_0x327664-0x0;var _0x1f7663=_0xf508[_0x327664];return _0x1f7663;};'use strict';var _=require('lodash');var util=require(_0x8f50('0x0'));var moment=require(_0x8f50('0x1'));var BPromise=require(_0x8f50('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8f50('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8f50('0x4'));var logger=require(_0x8f50('0x5'))(_0x8f50('0x6'));var config=require('../../config/environment');var jayson=require(_0x8f50('0x7'));var client=jayson['client'][_0x8f50('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5f11d8,_0x44cb7d,_0x2804fc){return new BPromise(function(_0x9557b,_0x481f7d){return client[_0x8f50('0x9')](_0x5f11d8,_0x2804fc)[_0x8f50('0xa')](function(_0x53db17){logger['info'](_0x8f50('0xb'),_0x44cb7d,_0x8f50('0xc'));logger[_0x8f50('0xd')](_0x8f50('0xe'),_0x44cb7d,_0x8f50('0xc'),JSON[_0x8f50('0xf')](_0x53db17));if(_0x53db17[_0x8f50('0x10')]){if(_0x53db17[_0x8f50('0x10')][_0x8f50('0x11')]===0x1f4){logger[_0x8f50('0x10')](_0x8f50('0xb'),_0x44cb7d,_0x53db17[_0x8f50('0x10')][_0x8f50('0x12')]);return _0x481f7d(_0x53db17[_0x8f50('0x10')][_0x8f50('0x12')]);}logger[_0x8f50('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x44cb7d,_0x53db17[_0x8f50('0x10')][_0x8f50('0x12')]);return _0x9557b(_0x53db17[_0x8f50('0x10')]['message']);}else{logger[_0x8f50('0x13')](_0x8f50('0xb'),_0x44cb7d,_0x8f50('0xc'));_0x9557b(_0x53db17[_0x8f50('0x14')][_0x8f50('0x12')]);}})[_0x8f50('0x15')](function(_0x459e47){logger[_0x8f50('0x10')](_0x8f50('0xb'),_0x44cb7d,_0x459e47);_0x481f7d(_0x459e47);});});}exports[_0x8f50('0x16')]=function(_0x13b484){var _0x2f3a1d=this;return new Promise(function(_0x1d253a,_0x3efdf9){return db['VoiceAgentReport'][_0x8f50('0x17')](_0x13b484[_0x8f50('0x18')],{'raw':_0x13b484[_0x8f50('0x19')]?_0x13b484[_0x8f50('0x19')][_0x8f50('0x1a')]===undefined?!![]:![]:!![]})[_0x8f50('0xa')](function(_0xa6a9ec){logger[_0x8f50('0x13')]('CreateVoiceAgentReport',_0x13b484);logger[_0x8f50('0xd')](_0x8f50('0x16'),_0x13b484,JSON[_0x8f50('0xf')](_0xa6a9ec));_0x1d253a(_0xa6a9ec);})[_0x8f50('0x15')](function(_0x163f42){logger[_0x8f50('0x10')](_0x8f50('0x16'),_0x163f42[_0x8f50('0x12')],_0x13b484);_0x3efdf9(_0x2f3a1d[_0x8f50('0x10')](0x1f4,_0x163f42[_0x8f50('0x12')]));});});};exports[_0x8f50('0x1b')]=function(_0x2ebd7e){var _0x439a20=this;return new Promise(function(_0x1f3a7e,_0x334761){return db[_0x8f50('0x1c')][_0x8f50('0x1d')](_0x2ebd7e[_0x8f50('0x18')],{'raw':_0x2ebd7e['options']?_0x2ebd7e[_0x8f50('0x19')][_0x8f50('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ebd7e[_0x8f50('0x19')]?_0x2ebd7e[_0x8f50('0x19')][_0x8f50('0x1e')]||null:null,'attributes':_0x2ebd7e[_0x8f50('0x19')]?_0x2ebd7e[_0x8f50('0x19')][_0x8f50('0x1f')]||null:null,'limit':_0x2ebd7e[_0x8f50('0x19')]?_0x2ebd7e[_0x8f50('0x19')][_0x8f50('0x20')]||null:null})[_0x8f50('0xa')](function(_0x4f9625){logger[_0x8f50('0x13')](_0x8f50('0x1b'),_0x2ebd7e);logger[_0x8f50('0xd')]('UpdateVoiceAgentReport',_0x2ebd7e,JSON['stringify'](_0x4f9625));_0x1f3a7e(_0x4f9625);})[_0x8f50('0x15')](function(_0x3d5d78){logger['error'](_0x8f50('0x1b'),_0x3d5d78[_0x8f50('0x12')],_0x2ebd7e);_0x334761(_0x439a20[_0x8f50('0x10')](0x1f4,_0x3d5d78[_0x8f50('0x12')]));});});}; \ No newline at end of file +var _0xaf53=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','VoiceAgentReport,\x20%s,\x20%s','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','debug','stringify','update','raw','attributes','then','UpdateVoiceAgentReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x20e5c3,_0x41470c){var _0x401520=function(_0x37f246){while(--_0x37f246){_0x20e5c3['push'](_0x20e5c3['shift']());}};_0x401520(++_0x41470c);}(_0xaf53,0x134));var _0x3af5=function(_0x39f964,_0x328eee){_0x39f964=_0x39f964-0x0;var _0x3c659e=_0xaf53[_0x39f964];return _0x3c659e;};'use strict';var _=require(_0x3af5('0x0'));var util=require(_0x3af5('0x1'));var moment=require(_0x3af5('0x2'));var BPromise=require(_0x3af5('0x3'));var rs=require(_0x3af5('0x4'));var fs=require('fs');var Redis=require(_0x3af5('0x5'));var db=require(_0x3af5('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3af5('0x7'))(_0x3af5('0x8'));var config=require(_0x3af5('0x9'));var jayson=require(_0x3af5('0xa'));var client=jayson[_0x3af5('0xb')][_0x3af5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3a6203,_0x5a107d,_0x3e0f77){return new BPromise(function(_0x57891f,_0x1754ab){return client[_0x3af5('0xd')](_0x3a6203,_0x3e0f77)['then'](function(_0x2ac02d){logger['info'](_0x3af5('0xe'),_0x5a107d,'request\x20sent');logger['debug'](_0x3af5('0xf'),_0x5a107d,_0x3af5('0x10'),JSON['stringify'](_0x2ac02d));if(_0x2ac02d['error']){if(_0x2ac02d[_0x3af5('0x11')][_0x3af5('0x12')]===0x1f4){logger[_0x3af5('0x11')](_0x3af5('0xe'),_0x5a107d,_0x2ac02d[_0x3af5('0x11')][_0x3af5('0x13')]);return _0x1754ab(_0x2ac02d[_0x3af5('0x11')][_0x3af5('0x13')]);}logger[_0x3af5('0x11')](_0x3af5('0xe'),_0x5a107d,_0x2ac02d['error'][_0x3af5('0x13')]);return _0x57891f(_0x2ac02d[_0x3af5('0x11')][_0x3af5('0x13')]);}else{logger[_0x3af5('0x14')](_0x3af5('0xe'),_0x5a107d,_0x3af5('0x10'));_0x57891f(_0x2ac02d[_0x3af5('0x15')][_0x3af5('0x13')]);}})[_0x3af5('0x16')](function(_0x2ae07f){logger[_0x3af5('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x5a107d,_0x2ae07f);_0x1754ab(_0x2ae07f);});});}exports[_0x3af5('0x17')]=function(_0x35b1f9){var _0x4874f9=this;return new Promise(function(_0x2adbb9,_0x3c29bb){return db[_0x3af5('0x18')][_0x3af5('0x19')](_0x35b1f9[_0x3af5('0x1a')],{'raw':_0x35b1f9[_0x3af5('0x1b')]?_0x35b1f9[_0x3af5('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x30bb94){logger[_0x3af5('0x14')](_0x3af5('0x17'),_0x35b1f9);logger[_0x3af5('0x1c')](_0x3af5('0x17'),_0x35b1f9,JSON[_0x3af5('0x1d')](_0x30bb94));_0x2adbb9(_0x30bb94);})['catch'](function(_0x329d12){logger['error']('CreateVoiceAgentReport',_0x329d12['message'],_0x35b1f9);_0x3c29bb(_0x4874f9[_0x3af5('0x11')](0x1f4,_0x329d12[_0x3af5('0x13')]));});});};exports['UpdateVoiceAgentReport']=function(_0x267563){var _0xef9be7=this;return new Promise(function(_0x27031c,_0x18954b){return db[_0x3af5('0x18')][_0x3af5('0x1e')](_0x267563[_0x3af5('0x1a')],{'raw':_0x267563[_0x3af5('0x1b')]?_0x267563[_0x3af5('0x1b')][_0x3af5('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x267563[_0x3af5('0x1b')]?_0x267563[_0x3af5('0x1b')]['where']||null:null,'attributes':_0x267563[_0x3af5('0x1b')]?_0x267563['options'][_0x3af5('0x20')]||null:null,'limit':_0x267563[_0x3af5('0x1b')]?_0x267563['options']['limit']||null:null})[_0x3af5('0x21')](function(_0x5ca1fa){logger[_0x3af5('0x14')](_0x3af5('0x22'),_0x267563);logger[_0x3af5('0x1c')](_0x3af5('0x22'),_0x267563,JSON[_0x3af5('0x1d')](_0x5ca1fa));_0x27031c(_0x5ca1fa);})[_0x3af5('0x16')](function(_0x40c6b5){logger[_0x3af5('0x11')](_0x3af5('0x22'),_0x40c6b5['message'],_0x267563);_0x18954b(_0xef9be7['error'](0x1f4,_0x40c6b5[_0x3af5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index e282195..bf0d0cc 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 _0x038b=['update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','/describe','isAuthenticated','/:id','create'];(function(_0x30e0f5,_0x5e4826){var _0x3b5800=function(_0x3d9155){while(--_0x3d9155){_0x30e0f5['push'](_0x30e0f5['shift']());}};_0x3b5800(++_0x5e4826);}(_0x038b,0x114));var _0xb038=function(_0x521f3d,_0x3f0977){_0x521f3d=_0x521f3d-0x0;var _0x2965ba=_0x038b[_0x521f3d];return _0x2965ba;};'use strict';var multer=require('multer');var util=require(_0xb038('0x0'));var path=require(_0xb038('0x1'));var timeout=require(_0xb038('0x2'));var express=require('express');var router=express[_0xb038('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb038('0x4'));var interaction=require(_0xb038('0x5'));var config=require('../../config/environment');var controller=require(_0xb038('0x6'));router[_0xb038('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb038('0x7')](_0xb038('0x8'),auth[_0xb038('0x9')](),controller['describe']);router['get'](_0xb038('0xa'),auth[_0xb038('0x9')](),controller['show']);router['post']('/',auth[_0xb038('0x9')](),controller[_0xb038('0xb')]);router['put'](_0xb038('0xa'),auth[_0xb038('0x9')](),controller[_0xb038('0xc')]);router[_0xb038('0xd')](_0xb038('0xa'),auth[_0xb038('0x9')](),controller[_0xb038('0xe')]);module[_0xb038('0xf')]=router; \ No newline at end of file +var _0x5292=['../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','/describe','/:id','show','post','isAuthenticated','create','put','update','exports','multer','util','connect-timeout','Router','fs-extra'];(function(_0x5f158f,_0x9e7ef1){var _0x30ea87=function(_0x1ec27f){while(--_0x1ec27f){_0x5f158f['push'](_0x5f158f['shift']());}};_0x30ea87(++_0x9e7ef1);}(_0x5292,0xf7));var _0x2529=function(_0x1966ad,_0x43f2f3){_0x1966ad=_0x1966ad-0x0;var _0x5d7637=_0x5292[_0x1966ad];return _0x5d7637;};'use strict';var multer=require(_0x2529('0x0'));var util=require(_0x2529('0x1'));var path=require('path');var timeout=require(_0x2529('0x2'));var express=require('express');var router=express[_0x2529('0x3')]();var fs_extra=require(_0x2529('0x4'));var auth=require(_0x2529('0x5'));var interaction=require(_0x2529('0x6'));var config=require('../../config/environment');var controller=require(_0x2529('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2529('0x8')](_0x2529('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x2529('0x8')](_0x2529('0xa'),auth['isAuthenticated'](),controller[_0x2529('0xb')]);router[_0x2529('0xc')]('/',auth[_0x2529('0xd')](),controller[_0x2529('0xe')]);router[_0x2529('0xf')](_0x2529('0xa'),auth[_0x2529('0xd')](),controller[_0x2529('0x10')]);router['delete'](_0x2529('0xa'),auth[_0x2529('0xd')](),controller['destroy']);module[_0x2529('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 7a00582..124f175 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 _0x8889=['inbound-fax','outbound-fax','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','internal','outbound'];(function(_0x3c2180,_0xd1e22e){var _0x192a8f=function(_0x5c96df){while(--_0x5c96df){_0x3c2180['push'](_0x3c2180['shift']());}};_0x192a8f(++_0xd1e22e);}(_0x8889,0x1d9));var _0x9888=function(_0xadfd1c,_0x33cba4){_0xadfd1c=_0xadfd1c-0x0;var _0x4ba49b=_0x8889[_0xadfd1c];return _0x4ba49b;};'use strict';var Sequelize=require(_0x9888('0x0'));module[_0x9888('0x1')]={'uniqueid':{'type':Sequelize[_0x9888('0x2')]},'type':{'type':Sequelize[_0x9888('0x3')](_0x9888('0x4'),_0x9888('0x5'),_0x9888('0x6'),_0x9888('0x7'),_0x9888('0x8'),'dialer')},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x9888('0x2')]},'source':{'type':Sequelize[_0x9888('0x2')]},'destination':{'type':Sequelize[_0x9888('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x9888('0x2')]},'channel':{'type':Sequelize[_0x9888('0x2')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x9888('0x2')]},'lastdata':{'type':Sequelize[_0x9888('0x9')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x9888('0xa')]},'endtime':{'type':Sequelize[_0x9888('0xa')]},'duration':{'type':Sequelize[_0x9888('0xb')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x9888('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x9888('0x2')]},'amaflags':{'type':Sequelize[_0x9888('0x2')]},'userfield':{'type':Sequelize[_0x9888('0x2')]},'userDisposition':{'type':Sequelize[_0x9888('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x9888('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x9888('0x2')]},'note':{'type':Sequelize[_0x9888('0x2')]},'prefix':{'type':Sequelize[_0x9888('0x2')]},'routeid':{'type':Sequelize[_0x9888('0xb')]},'sipcallid':{'type':Sequelize[_0x9888('0x2')]}}; \ No newline at end of file +var _0x641b=['inbound-fax','outbound-fax','DATE','INTEGER','sequelize','STRING','ENUM','inbound','internal'];(function(_0x4b840,_0x22821d){var _0x16e4bd=function(_0x58547b){while(--_0x58547b){_0x4b840['push'](_0x4b840['shift']());}};_0x16e4bd(++_0x22821d);}(_0x641b,0xca));var _0xb641=function(_0x203257,_0x10c653){_0x203257=_0x203257-0x0;var _0x20d1a6=_0x641b[_0x203257];return _0x20d1a6;};'use strict';var Sequelize=require(_0xb641('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xb641('0x1')]},'type':{'type':Sequelize[_0xb641('0x2')](_0xb641('0x3'),_0xb641('0x4'),'outbound',_0xb641('0x5'),_0xb641('0x6'),'dialer')},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xb641('0x1')]},'source':{'type':Sequelize[_0xb641('0x1')]},'destination':{'type':Sequelize[_0xb641('0x1')]},'destinationcontext':{'type':Sequelize[_0xb641('0x1')]},'callerid':{'type':Sequelize[_0xb641('0x1')]},'channel':{'type':Sequelize[_0xb641('0x1')]},'destinationchannel':{'type':Sequelize[_0xb641('0x1')]},'lastapplication':{'type':Sequelize[_0xb641('0x1')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0xb641('0x7')]},'systemanswertime':{'type':Sequelize[_0xb641('0x7')]},'answertime':{'type':Sequelize[_0xb641('0x7')]},'endtime':{'type':Sequelize[_0xb641('0x7')]},'duration':{'type':Sequelize[_0xb641('0x8')]},'billableseconds':{'type':Sequelize[_0xb641('0x8')]},'mohtime':{'type':Sequelize[_0xb641('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xb641('0x1')]},'amaflags':{'type':Sequelize[_0xb641('0x1')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xb641('0x1')]},'userThirdDisposition':{'type':Sequelize[_0xb641('0x1')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xb641('0x1')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0xb641('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index e62c4d7..81e4a91 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','fullname','alias','User','findAll','rows','params','find','create','body','catch','describe','update','uniqueid','user','eml-format','zip-dir','request-promise','moment'];(function(_0x2f98d4,_0x533fd7){var _0xf199dc=function(_0x4efa7f){while(--_0x4efa7f){_0x2f98d4['push'](_0x2f98d4['shift']());}};_0xf199dc(++_0x533fd7);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2da8e3,_0x397415){_0x2da8e3=_0x2da8e3-0x0;var _0x281fd5=_0x0b0e[_0x2da8e3];return _0x281fd5;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['VoiceCallReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'attributes':['id',_0xe0b0('0x27'),_0xe0b0('0x41'),_0xe0b0('0x42')],'model':db[_0xe0b0('0x43')],'as':_0xe0b0('0x43')}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x44')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x52ffe4){_0x36d137[_0xe0b0('0x45')]=_0x52ffe4;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))['catch'](handleError(_0x5b7a64,null));};exports['show']=function(_0x327fb4,_0x247f8d){var _0x56e7df={'raw':!![],'where':{'id':_0x327fb4[_0xe0b0('0x46')]['id']}},_0x18a59d={};_0x18a59d[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db[_0xe0b0('0x2a')]['rawAttributes']);_0x18a59d['query']=_['keys'](_0x327fb4[_0xe0b0('0x2e')]);_0x18a59d[_0xe0b0('0x39')]=_['intersection'](_0x18a59d[_0xe0b0('0x31')],_0x18a59d[_0xe0b0('0x2e')]);_0x56e7df[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x18a59d[_0xe0b0('0x31')],qs['fields'](_0x327fb4['query'][_0xe0b0('0x33')]));_0x56e7df[_0xe0b0('0x32')]=_0x56e7df[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x56e7df[_0xe0b0('0x32')]:_0x18a59d['model'];if(_0x327fb4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x56e7df['include']=[{'all':!![]}];}_0x56e7df=_['merge']({},_0x56e7df,_0x327fb4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x47')](_0x56e7df)[_0xe0b0('0x23')](handleEntityNotFound(_0x247f8d,null))[_0xe0b0('0x23')](respondWithResult(_0x247f8d,null))['catch'](handleError(_0x247f8d,null));};exports[_0xe0b0('0x48')]=function(_0x87d8f3,_0x483f12){return db['VoiceCallReport'][_0xe0b0('0x48')](_0x87d8f3[_0xe0b0('0x49')],{})['then'](respondWithResult(_0x483f12,0xc9))[_0xe0b0('0x4a')](handleError(_0x483f12,null));};exports[_0xe0b0('0x24')]=function(_0x504284,_0x5cb2b6){return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x504284[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x5cb2b6,null))[_0xe0b0('0x23')](removeEntity(_0x5cb2b6,null))[_0xe0b0('0x4a')](handleError(_0x5cb2b6,null));};exports[_0xe0b0('0x4b')]=function(_0xf9e694,_0x5f5486){return db['VoiceCallReport'][_0xe0b0('0x4b')]()['then'](respondWithResult(_0x5f5486,null))['catch'](handleError(_0x5f5486,null));};exports[_0xe0b0('0x4c')]=function(_0x222174,_0x54cf7b){if(_0x222174['body'][_0xe0b0('0x4d')]){delete _0x222174[_0xe0b0('0x49')][_0xe0b0('0x4d')];}return db[_0xe0b0('0x2a')][_0xe0b0('0x47')]({'where':{'uniqueid':_0x222174[_0xe0b0('0x46')]['id'],'UserId':{'$or':[null,_0x222174[_0xe0b0('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x54cf7b,null))[_0xe0b0('0x23')](saveUpdates(_0x222174['body'],null))[_0xe0b0('0x23')](respondWithResult(_0x54cf7b,null))['catch'](handleError(_0x54cf7b,null));}; \ No newline at end of file +var _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x3771ff,_0x5ccfe3){_0x3771ff=_0x3771ff-0x0;var _0x233703=_0x2032[_0x3771ff];return _0x233703;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 8d5ac71..170a348 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 _0xf963=['define','lodash','../../config/logger','bluebird','path','rimraf','./voiceCallReport.attributes','exports'];(function(_0x537ab5,_0x5dc6c6){var _0x100378=function(_0x16353b){while(--_0x16353b){_0x537ab5['push'](_0x537ab5['shift']());}};_0x100378(++_0x5dc6c6);}(_0xf963,0xf9));var _0x3f96=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xf963[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0x3f96('0x0'));var util=require('util');var logger=require(_0x3f96('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3f96('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3f96('0x3'));var rimraf=require(_0x3f96('0x4'));var config=require('../../config/environment');var attributes=require(_0x3f96('0x5'));module[_0x3f96('0x6')]=function(_0x925c29,_0x25c3ec){return _0x925c29[_0x3f96('0x7')]('VoiceCallReport',attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x616b=['VoiceCallReport','report_call','uniqueid','util','../../config/logger','api','moment','request-promise','path','rimraf','./voiceCallReport.attributes','exports','define'];(function(_0x427572,_0x1d89f2){var _0x585590=function(_0x1699da){while(--_0x1699da){_0x427572['push'](_0x427572['shift']());}};_0x585590(++_0x1d89f2);}(_0x616b,0x1d7));var _0xb616=function(_0x2d344f,_0x25fa84){_0x2d344f=_0x2d344f-0x0;var _0x2e796b=_0x616b[_0x2d344f];return _0x2e796b;};'use strict';var _=require('lodash');var util=require(_0xb616('0x0'));var logger=require(_0xb616('0x1'))(_0xb616('0x2'));var moment=require(_0xb616('0x3'));var BPromise=require('bluebird');var rp=require(_0xb616('0x4'));var fs=require('fs');var path=require(_0xb616('0x5'));var rimraf=require(_0xb616('0x6'));var config=require('../../config/environment');var attributes=require(_0xb616('0x7'));module[_0xb616('0x8')]=function(_0xd79bc0,_0x3dec33){return _0xd79bc0[_0xb616('0x9')](_0xb616('0xa'),attributes,{'tableName':_0xb616('0xb'),'paranoid':![],'indexes':[{'fields':[_0xb616('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index ef0fa31..9ead677 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 _0x77e0=['include','map','model','then','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0x77e0,0x133));var _0x077e=function(_0x54169a,_0x2a946f){_0x54169a=_0x54169a-0x0;var _0x414948=_0x77e0[_0x54169a];return _0x414948;};'use strict';var _=require(_0x077e('0x0'));var util=require('util');var moment=require(_0x077e('0x1'));var BPromise=require(_0x077e('0x2'));var rs=require(_0x077e('0x3'));var fs=require('fs');var Redis=require(_0x077e('0x4'));var db=require(_0x077e('0x5'))['db'];var utils=require(_0x077e('0x6'));var logger=require(_0x077e('0x7'))(_0x077e('0x8'));var config=require(_0x077e('0x9'));var jayson=require(_0x077e('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2ce24e,_0x5cb5de,_0x36a3db){return new BPromise(function(_0x191263,_0x44fb48){return client[_0x077e('0xb')](_0x2ce24e,_0x36a3db)['then'](function(_0x4dcb2a){logger['info'](_0x077e('0xc'),_0x5cb5de,_0x077e('0xd'));logger[_0x077e('0xe')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x5cb5de,'request\x20sent',JSON[_0x077e('0xf')](_0x4dcb2a));if(_0x4dcb2a[_0x077e('0x10')]){if(_0x4dcb2a[_0x077e('0x10')]['code']===0x1f4){logger[_0x077e('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x5cb5de,_0x4dcb2a['error'][_0x077e('0x11')]);return _0x44fb48(_0x4dcb2a[_0x077e('0x10')]['message']);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x5cb5de,_0x4dcb2a[_0x077e('0x10')][_0x077e('0x11')]);return _0x191263(_0x4dcb2a['error'][_0x077e('0x11')]);}else{logger[_0x077e('0x12')](_0x077e('0xc'),_0x5cb5de,'request\x20sent');_0x191263(_0x4dcb2a['result']['message']);}})[_0x077e('0x13')](function(_0x43f111){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x5cb5de,_0x43f111);_0x44fb48(_0x43f111);});});}exports[_0x077e('0x14')]=function(_0x3eb056){var _0x28bc97=this;return new Promise(function(_0x2ca3c5,_0xfa8d83){return db[_0x077e('0x15')][_0x077e('0x16')]({'raw':_0x3eb056[_0x077e('0x17')]?_0x3eb056['options'][_0x077e('0x18')]===undefined?!![]:![]:!![],'where':_0x3eb056[_0x077e('0x17')]?_0x3eb056[_0x077e('0x17')][_0x077e('0x19')]||null:null,'attributes':_0x3eb056['options']?_0x3eb056[_0x077e('0x17')]['attributes']||null:null,'limit':_0x3eb056[_0x077e('0x17')]?_0x3eb056['options']['limit']||null:null,'include':_0x3eb056[_0x077e('0x17')]?_0x3eb056['options'][_0x077e('0x1a')]?_['map'](_0x3eb056['options']['include'],function(_0x2f85a9){return{'model':db[_0x2f85a9['model']],'as':_0x2f85a9['as'],'attributes':_0x2f85a9['attributes'],'include':_0x2f85a9[_0x077e('0x1a')]?_[_0x077e('0x1b')](_0x2f85a9['include'],function(_0x24701b){return{'model':db[_0x24701b[_0x077e('0x1c')]],'as':_0x24701b['as'],'attributes':_0x24701b['attributes'],'include':_0x24701b[_0x077e('0x1a')]?_['map'](_0x24701b[_0x077e('0x1a')],function(_0x1f9ff4){return{'model':db[_0x1f9ff4['model']],'as':_0x1f9ff4['as'],'attributes':_0x1f9ff4['attributes']};}):[]};}):[]};}):[]:[]})[_0x077e('0x1d')](function(_0x46c273){logger['info'](_0x077e('0x14'),_0x3eb056);logger[_0x077e('0xe')](_0x077e('0x14'),_0x3eb056,JSON[_0x077e('0xf')](_0x46c273));_0x2ca3c5(_0x46c273);})[_0x077e('0x13')](function(_0x42e989){logger[_0x077e('0x10')](_0x077e('0x14'),_0x42e989[_0x077e('0x11')],_0x3eb056);_0xfa8d83(_0x28bc97[_0x077e('0x10')](0x1f4,_0x42e989[_0x077e('0x11')]));});});};exports[_0x077e('0x1e')]=function(_0x2c6f0){var _0x2457d3=this;return new Promise(function(_0x44caa4,_0x180dea){return db[_0x077e('0x15')][_0x077e('0x1f')](_0x2c6f0[_0x077e('0x20')],{'raw':_0x2c6f0[_0x077e('0x17')]?_0x2c6f0[_0x077e('0x17')][_0x077e('0x18')]===undefined?!![]:![]:!![]})[_0x077e('0x1d')](function(_0x167e47){logger[_0x077e('0x12')](_0x077e('0x1e'),_0x2c6f0);logger['debug'](_0x077e('0x1e'),_0x2c6f0,JSON[_0x077e('0xf')](_0x167e47));_0x44caa4(_0x167e47);})['catch'](function(_0x4afb94){logger[_0x077e('0x10')](_0x077e('0x1e'),_0x4afb94[_0x077e('0x11')],_0x2c6f0);_0x180dea(_0x2457d3[_0x077e('0x10')](0x1f4,_0x4afb94[_0x077e('0x11')]));});});};exports[_0x077e('0x21')]=function(_0x124dbb){var _0x52739b=this;return new Promise(function(_0x444065,_0x404fba){return db['VoiceCallReport'][_0x077e('0x22')](_0x124dbb[_0x077e('0x20')],{'raw':_0x124dbb[_0x077e('0x17')]?_0x124dbb['options'][_0x077e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x124dbb[_0x077e('0x17')]?_0x124dbb[_0x077e('0x17')][_0x077e('0x19')]||null:null,'attributes':_0x124dbb[_0x077e('0x17')]?_0x124dbb[_0x077e('0x17')][_0x077e('0x23')]||null:null,'limit':_0x124dbb[_0x077e('0x17')]?_0x124dbb[_0x077e('0x17')][_0x077e('0x24')]||null:null})[_0x077e('0x1d')](function(_0x172529){logger[_0x077e('0x12')](_0x077e('0x21'),_0x124dbb);logger[_0x077e('0xe')]('UpdateVoiceCallReport',_0x124dbb,JSON['stringify'](_0x172529));_0x444065(_0x172529);})[_0x077e('0x13')](function(_0xaa4efb){logger[_0x077e('0x10')](_0x077e('0x21'),_0xaa4efb['message'],_0x124dbb);_0x404fba(_0x52739b['error'](0x1f4,_0xaa4efb[_0x077e('0x11')]));});});}; \ No newline at end of file +var _0x9be7=['info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetVoiceCallReport','options','raw','where','attributes','limit','include','map','model','then','CreateVoiceCallReport','VoiceCallReport','body','update','UpdateVoiceCallReport','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0xbc5530,_0x1e7762){var _0x51e6f1=function(_0x2d0415){while(--_0x2d0415){_0xbc5530['push'](_0xbc5530['shift']());}};_0x51e6f1(++_0x1e7762);}(_0x9be7,0xd2));var _0x79be=function(_0x310a1b,_0x4c9129){_0x310a1b=_0x310a1b-0x0;var _0xdea206=_0x9be7[_0x310a1b];return _0xdea206;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x79be('0x0'));var BPromise=require(_0x79be('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x79be('0x2'));var db=require(_0x79be('0x3'))['db'];var utils=require(_0x79be('0x4'));var logger=require(_0x79be('0x5'))(_0x79be('0x6'));var config=require(_0x79be('0x7'));var jayson=require(_0x79be('0x8'));var client=jayson[_0x79be('0x9')][_0x79be('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xba5e86,_0x3b5fe1,_0x3408c4){return new BPromise(function(_0x1f2aa8,_0x5f4115){return client[_0x79be('0xb')](_0xba5e86,_0x3408c4)['then'](function(_0x19d2bd){logger[_0x79be('0xc')](_0x79be('0xd'),_0x3b5fe1,_0x79be('0xe'));logger[_0x79be('0xf')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x3b5fe1,_0x79be('0xe'),JSON[_0x79be('0x10')](_0x19d2bd));if(_0x19d2bd[_0x79be('0x11')]){if(_0x19d2bd[_0x79be('0x11')][_0x79be('0x12')]===0x1f4){logger[_0x79be('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x3b5fe1,_0x19d2bd[_0x79be('0x11')]['message']);return _0x5f4115(_0x19d2bd[_0x79be('0x11')][_0x79be('0x13')]);}logger['error'](_0x79be('0xd'),_0x3b5fe1,_0x19d2bd[_0x79be('0x11')]['message']);return _0x1f2aa8(_0x19d2bd['error'][_0x79be('0x13')]);}else{logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x3b5fe1,_0x79be('0xe'));_0x1f2aa8(_0x19d2bd[_0x79be('0x14')][_0x79be('0x13')]);}})[_0x79be('0x15')](function(_0x349ce0){logger[_0x79be('0x11')](_0x79be('0xd'),_0x3b5fe1,_0x349ce0);_0x5f4115(_0x349ce0);});});}exports[_0x79be('0x16')]=function(_0x2842ec){var _0x48a325=this;return new Promise(function(_0x28b31d,_0x45e021){return db['VoiceCallReport']['findAll']({'raw':_0x2842ec[_0x79be('0x17')]?_0x2842ec[_0x79be('0x17')][_0x79be('0x18')]===undefined?!![]:![]:!![],'where':_0x2842ec['options']?_0x2842ec['options'][_0x79be('0x19')]||null:null,'attributes':_0x2842ec[_0x79be('0x17')]?_0x2842ec[_0x79be('0x17')][_0x79be('0x1a')]||null:null,'limit':_0x2842ec[_0x79be('0x17')]?_0x2842ec[_0x79be('0x17')][_0x79be('0x1b')]||null:null,'include':_0x2842ec['options']?_0x2842ec[_0x79be('0x17')][_0x79be('0x1c')]?_[_0x79be('0x1d')](_0x2842ec[_0x79be('0x17')][_0x79be('0x1c')],function(_0x19588b){return{'model':db[_0x19588b[_0x79be('0x1e')]],'as':_0x19588b['as'],'attributes':_0x19588b[_0x79be('0x1a')],'include':_0x19588b[_0x79be('0x1c')]?_[_0x79be('0x1d')](_0x19588b['include'],function(_0x5e8792){return{'model':db[_0x5e8792['model']],'as':_0x5e8792['as'],'attributes':_0x5e8792['attributes'],'include':_0x5e8792[_0x79be('0x1c')]?_[_0x79be('0x1d')](_0x5e8792[_0x79be('0x1c')],function(_0x156bd9){return{'model':db[_0x156bd9[_0x79be('0x1e')]],'as':_0x156bd9['as'],'attributes':_0x156bd9[_0x79be('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x79be('0x1f')](function(_0x138654){logger[_0x79be('0xc')](_0x79be('0x16'),_0x2842ec);logger['debug'](_0x79be('0x16'),_0x2842ec,JSON['stringify'](_0x138654));_0x28b31d(_0x138654);})[_0x79be('0x15')](function(_0x57c080){logger[_0x79be('0x11')](_0x79be('0x16'),_0x57c080[_0x79be('0x13')],_0x2842ec);_0x45e021(_0x48a325[_0x79be('0x11')](0x1f4,_0x57c080[_0x79be('0x13')]));});});};exports[_0x79be('0x20')]=function(_0x5d8ab8){var _0x616d0e=this;return new Promise(function(_0x382372,_0x3c1c50){return db[_0x79be('0x21')]['create'](_0x5d8ab8[_0x79be('0x22')],{'raw':_0x5d8ab8[_0x79be('0x17')]?_0x5d8ab8[_0x79be('0x17')][_0x79be('0x18')]===undefined?!![]:![]:!![]})[_0x79be('0x1f')](function(_0x323bbb){logger['info'](_0x79be('0x20'),_0x5d8ab8);logger[_0x79be('0xf')](_0x79be('0x20'),_0x5d8ab8,JSON[_0x79be('0x10')](_0x323bbb));_0x382372(_0x323bbb);})[_0x79be('0x15')](function(_0x1cd78c){logger[_0x79be('0x11')](_0x79be('0x20'),_0x1cd78c[_0x79be('0x13')],_0x5d8ab8);_0x3c1c50(_0x616d0e[_0x79be('0x11')](0x1f4,_0x1cd78c[_0x79be('0x13')]));});});};exports['UpdateVoiceCallReport']=function(_0x3015f0){var _0x6a1be3=this;return new Promise(function(_0x5301d1,_0x177cd7){return db['VoiceCallReport'][_0x79be('0x23')](_0x3015f0['body'],{'raw':_0x3015f0[_0x79be('0x17')]?_0x3015f0[_0x79be('0x17')][_0x79be('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3015f0[_0x79be('0x17')]?_0x3015f0['options'][_0x79be('0x19')]||null:null,'attributes':_0x3015f0[_0x79be('0x17')]?_0x3015f0[_0x79be('0x17')][_0x79be('0x1a')]||null:null,'limit':_0x3015f0[_0x79be('0x17')]?_0x3015f0['options']['limit']||null:null})[_0x79be('0x1f')](function(_0x54d28a){logger['info']('UpdateVoiceCallReport',_0x3015f0);logger[_0x79be('0xf')]('UpdateVoiceCallReport',_0x3015f0,JSON[_0x79be('0x10')](_0x54d28a));_0x5301d1(_0x54d28a);})['catch'](function(_0x1efe69){logger['error'](_0x79be('0x24'),_0x1efe69[_0x79be('0x13')],_0x3015f0);_0x177cd7(_0x6a1be3['error'](0x1f4,_0x1efe69[_0x79be('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index e13020d..6e4e60f 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 _0x7ea8=['../../config/environment','./voiceChanSpy.controller','isAuthenticated','index','get','/:id','post','create','put','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x513047,_0x2199c5){var _0x15b779=function(_0x412fd5){while(--_0x412fd5){_0x513047['push'](_0x513047['shift']());}};_0x15b779(++_0x2199c5);}(_0x7ea8,0x197));var _0x87ea=function(_0x51f120,_0x27f998){_0x51f120=_0x51f120-0x0;var _0x22ff09=_0x7ea8[_0x51f120];return _0x22ff09;};'use strict';var multer=require(_0x87ea('0x0'));var util=require('util');var path=require(_0x87ea('0x1'));var timeout=require(_0x87ea('0x2'));var express=require(_0x87ea('0x3'));var router=express[_0x87ea('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x87ea('0x5'));var interaction=require(_0x87ea('0x6'));var config=require(_0x87ea('0x7'));var controller=require(_0x87ea('0x8'));router['get']('/',auth[_0x87ea('0x9')](),controller[_0x87ea('0xa')]);router[_0x87ea('0xb')](_0x87ea('0xc'),auth[_0x87ea('0x9')](),controller['show']);router[_0x87ea('0xd')]('/',auth[_0x87ea('0x9')](),controller[_0x87ea('0xe')]);router[_0x87ea('0xf')](_0x87ea('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x87ea('0x10')](_0x87ea('0xc'),auth[_0x87ea('0x9')](),controller[_0x87ea('0x11')]);module['exports']=router; \ No newline at end of file +var _0x3bfd=['put','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','post','create'];(function(_0x4c780f,_0x1c8335){var _0x5b6091=function(_0x29418d){while(--_0x29418d){_0x4c780f['push'](_0x4c780f['shift']());}};_0x5b6091(++_0x1c8335);}(_0x3bfd,0x6e));var _0xd3bf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3bfd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd3bf('0x0'));var util=require(_0xd3bf('0x1'));var path=require(_0xd3bf('0x2'));var timeout=require(_0xd3bf('0x3'));var express=require(_0xd3bf('0x4'));var router=express[_0xd3bf('0x5')]();var fs_extra=require(_0xd3bf('0x6'));var auth=require(_0xd3bf('0x7'));var interaction=require(_0xd3bf('0x8'));var config=require(_0xd3bf('0x9'));var controller=require(_0xd3bf('0xa'));router[_0xd3bf('0xb')]('/',auth[_0xd3bf('0xc')](),controller[_0xd3bf('0xd')]);router['get']('/:id',auth[_0xd3bf('0xc')](),controller['show']);router[_0xd3bf('0xe')]('/',auth[_0xd3bf('0xc')](),controller[_0xd3bf('0xf')]);router[_0xd3bf('0x10')]('/:id',auth[_0xd3bf('0xc')](),controller['update']);router[_0xd3bf('0x11')](_0xd3bf('0x12'),auth['isAuthenticated'](),controller[_0xd3bf('0x13')]);module[_0xd3bf('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 0dc2986..ac56017 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 _0x43b2=['BOOLEAN','exports','STRING','name','setDataValue','options','getDataValue','split'];(function(_0x117994,_0x46bbbb){var _0x40814a=function(_0x5e88ca){while(--_0x5e88ca){_0x117994['push'](_0x117994['shift']());}};_0x40814a(++_0x46bbbb);}(_0x43b2,0x189));var _0x243b=function(_0x23bc44,_0x143afd){_0x23bc44=_0x23bc44-0x0;var _0x470b2c=_0x43b2[_0x23bc44];return _0x470b2c;};'use strict';var Sequelize=require('sequelize');module[_0x243b('0x0')]={'name':{'type':Sequelize[_0x243b('0x1')]},'prefix':{'type':Sequelize[_0x243b('0x1')],'unique':_0x243b('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0xe6264){this[_0x243b('0x3')](_0x243b('0x4'),_0xe6264?_0xe6264['join'](''):[]);},'get':function(){return this[_0x243b('0x5')]('options')?this[_0x243b('0x5')](_0x243b('0x4'))[_0x243b('0x6')](''):[];}},'auth':{'type':Sequelize[_0x243b('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x243b('0x1')]},'record':{'type':Sequelize[_0x243b('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x243b('0x1')]}}; \ No newline at end of file +var _0x3834=['BOOLEAN','exports','STRING','name','setDataValue','options','getDataValue'];(function(_0x2d22e4,_0x3d1f08){var _0x372c87=function(_0x602103){while(--_0x602103){_0x2d22e4['push'](_0x2d22e4['shift']());}};_0x372c87(++_0x3d1f08);}(_0x3834,0x1c8));var _0x4383=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3834[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x4383('0x0')]={'name':{'type':Sequelize[_0x4383('0x1')]},'prefix':{'type':Sequelize[_0x4383('0x1')],'unique':_0x4383('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x4383('0x1')],'set':function(_0x3d1401){this[_0x4383('0x3')](_0x4383('0x4'),_0x3d1401?_0x3d1401['join'](''):[]);},'get':function(){return this[_0x4383('0x5')](_0x4383('0x4'))?this['getDataValue'](_0x4383('0x4'))['split'](''):[];}},'auth':{'type':Sequelize[_0x4383('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0x4383('0x1')]},'record':{'type':Sequelize[_0x4383('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x4383('0x1')]},'description':{'type':Sequelize[_0x4383('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 68b730a..cc8c4d3 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 _0xcf14=['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','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','update','then','destroy','get','ChanSpies','UserProfileResource','error','stack','name','send','map','VoiceChanSpy','rawAttributes','fieldName','key','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','filter','options','includeAll','findAll','rows','catch','params','keys','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x32fe22,_0x5287d6){var _0x319ba7=function(_0x4a6704){while(--_0x4a6704){_0x32fe22['push'](_0x32fe22['shift']());}};_0x319ba7(++_0x5287d6);}(_0xcf14,0xa1));var _0x4cf1=function(_0x5c98fb,_0x124d25){_0x5c98fb=_0x5c98fb-0x0;var _0x1f1221=_0xcf14[_0x5c98fb];return _0x1f1221;};'use strict';var emlformat=require(_0x4cf1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4cf1('0x1'));var jsonpatch=require(_0x4cf1('0x2'));var rp=require('request-promise');var moment=require(_0x4cf1('0x3'));var BPromise=require(_0x4cf1('0x4'));var Mustache=require(_0x4cf1('0x5'));var util=require(_0x4cf1('0x6'));var path=require('path');var sox=require(_0x4cf1('0x7'));var csv=require(_0x4cf1('0x8'));var ejs=require(_0x4cf1('0x9'));var fs=require('fs');var fs_extra=require(_0x4cf1('0xa'));var _=require(_0x4cf1('0xb'));var squel=require(_0x4cf1('0xc'));var crypto=require(_0x4cf1('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4cf1('0xe'));var toCsv=require(_0x4cf1('0x8'));var querystring=require(_0x4cf1('0xf'));var Papa=require(_0x4cf1('0x10'));var Redis=require(_0x4cf1('0x11'));var authService=require(_0x4cf1('0x12'));var qs=require(_0x4cf1('0x13'));var as=require(_0x4cf1('0x14'));var hardwareService=require(_0x4cf1('0x15'));var logger=require(_0x4cf1('0x16'))(_0x4cf1('0x17'));var utils=require(_0x4cf1('0x18'));var config=require(_0x4cf1('0x19'));var licenseUtil=require(_0x4cf1('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cee57,_0x5622dc){_0x5622dc=_0x5622dc||0xcc;return function(_0x1ae8fb){if(_0x1ae8fb){return _0x3cee57[_0x4cf1('0x1b')](_0x5622dc);}return _0x3cee57[_0x4cf1('0x1c')](_0x5622dc)[_0x4cf1('0x1d')]();};}function respondWithResult(_0x10abde,_0x3f365c){_0x3f365c=_0x3f365c||0xc8;return function(_0x25f091){if(_0x25f091){return _0x10abde[_0x4cf1('0x1c')](_0x3f365c)[_0x4cf1('0x1e')](_0x25f091);}};}function respondWithFilteredResult(_0xec2510,_0xcfa115){return function(_0x2a8cf7){if(_0x2a8cf7){var _0xe257a5=typeof _0xcfa115['offset']===_0x4cf1('0x1f')&&typeof _0xcfa115['limit']===_0x4cf1('0x1f');var _0x3c485a=_0x2a8cf7[_0x4cf1('0x20')];var _0x1f20c0=_0xe257a5?0x0:_0xcfa115[_0x4cf1('0x21')];var _0x48d35a=_0xe257a5?_0x2a8cf7[_0x4cf1('0x20')]:_0xcfa115[_0x4cf1('0x21')]+_0xcfa115[_0x4cf1('0x22')];var _0x4557e0;if(_0x48d35a>=_0x3c485a){_0x48d35a=_0x3c485a;_0x4557e0=0xc8;}else{_0x4557e0=0xce;}_0xec2510['status'](_0x4557e0);return _0xec2510['set'](_0x4cf1('0x23'),_0x1f20c0+'-'+_0x48d35a+'/'+_0x3c485a)[_0x4cf1('0x1e')](_0x2a8cf7);}return null;};}function patchUpdates(_0x5603ae){return function(_0x85885a){try{jsonpatch[_0x4cf1('0x24')](_0x85885a,_0x5603ae,!![]);}catch(_0x3cc036){return BPromise[_0x4cf1('0x25')](_0x3cc036);}return _0x85885a['save']();};}function saveUpdates(_0x3469ac,_0x158000){return function(_0x2338c3){if(_0x2338c3){return _0x2338c3[_0x4cf1('0x26')](_0x3469ac)[_0x4cf1('0x27')](function(_0x2945b4){return _0x2945b4;});}return null;};}function removeEntity(_0x4f14a0,_0x351ccc){return function(_0x5bb535){if(_0x5bb535){return _0x5bb535[_0x4cf1('0x28')]()[_0x4cf1('0x27')](function(){var _0x1b0ad4=_0x5bb535[_0x4cf1('0x29')]({'plain':!![]});var _0x389575=_0x4cf1('0x2a');return db[_0x4cf1('0x2b')][_0x4cf1('0x28')]({'where':{'type':_0x389575,'resourceId':_0x1b0ad4['id']}})[_0x4cf1('0x27')](function(){return _0x5bb535;});})[_0x4cf1('0x27')](function(){_0x4f14a0[_0x4cf1('0x1c')](0xcc)[_0x4cf1('0x1d')]();});}};}function handleEntityNotFound(_0x2a17ce,_0x4bcd78){return function(_0x4498b5){if(!_0x4498b5){_0x2a17ce[_0x4cf1('0x1b')](0x194);}return _0x4498b5;};}function handleError(_0x20d9d9,_0x1c7c9c){_0x1c7c9c=_0x1c7c9c||0x1f4;return function(_0x4348d0){logger[_0x4cf1('0x2c')](_0x4348d0[_0x4cf1('0x2d')]);if(_0x4348d0[_0x4cf1('0x2e')]){delete _0x4348d0[_0x4cf1('0x2e')];}_0x20d9d9[_0x4cf1('0x1c')](_0x1c7c9c)[_0x4cf1('0x2f')](_0x4348d0);};}exports['index']=function(_0x18232e,_0x167da0){var _0x59ea9f={},_0x2c8c92={},_0x54adfa={'count':0x0,'rows':[]};var _0x29f111=_[_0x4cf1('0x30')](db[_0x4cf1('0x31')][_0x4cf1('0x32')],function(_0x483f48){return{'name':_0x483f48[_0x4cf1('0x33')],'type':_0x483f48['type'][_0x4cf1('0x34')]};});_0x2c8c92[_0x4cf1('0x35')]=_[_0x4cf1('0x30')](_0x29f111,_0x4cf1('0x2e'));_0x2c8c92[_0x4cf1('0x36')]=_['keys'](_0x18232e[_0x4cf1('0x36')]);_0x2c8c92['filters']=_['intersection'](_0x2c8c92['model'],_0x2c8c92[_0x4cf1('0x36')]);_0x59ea9f[_0x4cf1('0x37')]=_[_0x4cf1('0x38')](_0x2c8c92[_0x4cf1('0x35')],qs[_0x4cf1('0x39')](_0x18232e[_0x4cf1('0x36')][_0x4cf1('0x39')]));_0x59ea9f[_0x4cf1('0x37')]=_0x59ea9f['attributes']['length']?_0x59ea9f['attributes']:_0x2c8c92[_0x4cf1('0x35')];if(!_0x18232e[_0x4cf1('0x36')][_0x4cf1('0x3a')](_0x4cf1('0x3b'))){_0x59ea9f[_0x4cf1('0x22')]=qs[_0x4cf1('0x22')](_0x18232e[_0x4cf1('0x36')][_0x4cf1('0x22')]);_0x59ea9f[_0x4cf1('0x21')]=qs[_0x4cf1('0x21')](_0x18232e[_0x4cf1('0x36')][_0x4cf1('0x21')]);}_0x59ea9f[_0x4cf1('0x3c')]=qs['sort'](_0x18232e['query'][_0x4cf1('0x3d')]);_0x59ea9f[_0x4cf1('0x3e')]=qs[_0x4cf1('0x3f')](_[_0x4cf1('0x40')](_0x18232e[_0x4cf1('0x36')],_0x2c8c92[_0x4cf1('0x3f')]),_0x29f111);if(_0x18232e[_0x4cf1('0x36')]['filter']){_0x59ea9f[_0x4cf1('0x3e')]=_[_0x4cf1('0x41')](_0x59ea9f[_0x4cf1('0x3e')],{'$or':_[_0x4cf1('0x30')](_0x29f111,function(_0x2850f7){if(_0x2850f7[_0x4cf1('0x42')]!=='VIRTUAL'){var _0x5348f5={};_0x5348f5[_0x2850f7[_0x4cf1('0x2e')]]={'$like':'%'+_0x18232e[_0x4cf1('0x36')][_0x4cf1('0x43')]+'%'};return _0x5348f5;}})});}_0x59ea9f=_[_0x4cf1('0x41')]({},_0x59ea9f,_0x18232e[_0x4cf1('0x44')]);var _0x43d336={'where':_0x59ea9f[_0x4cf1('0x3e')]};return db[_0x4cf1('0x31')][_0x4cf1('0x20')](_0x43d336)[_0x4cf1('0x27')](function(_0x1a2869){_0x54adfa['count']=_0x1a2869;if(_0x18232e[_0x4cf1('0x36')][_0x4cf1('0x45')]){_0x59ea9f['include']=[{'all':!![]}];}return db[_0x4cf1('0x31')][_0x4cf1('0x46')](_0x59ea9f);})[_0x4cf1('0x27')](function(_0xc2b163){_0x54adfa[_0x4cf1('0x47')]=_0xc2b163;return _0x54adfa;})['then'](respondWithFilteredResult(_0x167da0,_0x59ea9f))[_0x4cf1('0x48')](handleError(_0x167da0,null));};exports['show']=function(_0x5d024c,_0x3d1464){var _0x3fb6ed={'raw':![],'where':{'id':_0x5d024c[_0x4cf1('0x49')]['id']}},_0x17f59e={};_0x17f59e[_0x4cf1('0x35')]=_[_0x4cf1('0x4a')](db[_0x4cf1('0x31')][_0x4cf1('0x32')]);_0x17f59e[_0x4cf1('0x36')]=_[_0x4cf1('0x4a')](_0x5d024c[_0x4cf1('0x36')]);_0x17f59e[_0x4cf1('0x3f')]=_[_0x4cf1('0x38')](_0x17f59e[_0x4cf1('0x35')],_0x17f59e[_0x4cf1('0x36')]);_0x3fb6ed[_0x4cf1('0x37')]=_['intersection'](_0x17f59e[_0x4cf1('0x35')],qs[_0x4cf1('0x39')](_0x5d024c[_0x4cf1('0x36')][_0x4cf1('0x39')]));_0x3fb6ed[_0x4cf1('0x37')]=_0x3fb6ed[_0x4cf1('0x37')][_0x4cf1('0x4b')]?_0x3fb6ed['attributes']:_0x17f59e[_0x4cf1('0x35')];if(_0x5d024c['query'][_0x4cf1('0x45')]){_0x3fb6ed[_0x4cf1('0x4c')]=[{'all':!![]}];}_0x3fb6ed=_[_0x4cf1('0x41')]({},_0x3fb6ed,_0x5d024c[_0x4cf1('0x44')]);return db[_0x4cf1('0x31')][_0x4cf1('0x4d')](_0x3fb6ed)['then'](handleEntityNotFound(_0x3d1464,null))['then'](respondWithResult(_0x3d1464,null))['catch'](handleError(_0x3d1464,null));};exports[_0x4cf1('0x4e')]=function(_0x18e085,_0x1cd038){return db['VoiceChanSpy'][_0x4cf1('0x4e')](_0x18e085[_0x4cf1('0x4f')],{})['then'](function(_0x28a267){var _0x3e3e5d=_0x18e085[_0x4cf1('0x50')][_0x4cf1('0x29')]({'plain':!![]});if(!_0x3e3e5d)throw new Error(_0x4cf1('0x51'));if(_0x3e3e5d['role']===_0x4cf1('0x50')){var _0x1f3c7e=_0x28a267[_0x4cf1('0x29')]({'plain':!![]});var _0x77418c=_0x4cf1('0x2a');return db['UserProfileSection'][_0x4cf1('0x4d')]({'where':{'name':_0x77418c,'userProfileId':_0x3e3e5d[_0x4cf1('0x52')]},'raw':!![]})['then'](function(_0x5b74fc){if(_0x5b74fc&&_0x5b74fc['autoAssociation']===0x0){return db[_0x4cf1('0x2b')][_0x4cf1('0x4e')]({'name':_0x1f3c7e[_0x4cf1('0x2e')],'resourceId':_0x1f3c7e['id'],'type':_0x5b74fc['name'],'sectionId':_0x5b74fc['id']},{})[_0x4cf1('0x27')](function(){return _0x28a267;});}else{return _0x28a267;}})[_0x4cf1('0x48')](function(_0x296065){logger['error'](_0x4cf1('0x53'),_0x296065);throw _0x296065;});}return _0x28a267;})[_0x4cf1('0x27')](respondWithResult(_0x1cd038,0xc9))[_0x4cf1('0x48')](handleError(_0x1cd038,null));};exports[_0x4cf1('0x26')]=function(_0x57dfb3,_0x1105cb){if(_0x57dfb3[_0x4cf1('0x4f')]['id']){delete _0x57dfb3['body']['id'];}return db[_0x4cf1('0x31')][_0x4cf1('0x4d')]({'where':{'id':_0x57dfb3[_0x4cf1('0x49')]['id']}})['then'](handleEntityNotFound(_0x1105cb,null))[_0x4cf1('0x27')](saveUpdates(_0x57dfb3[_0x4cf1('0x4f')],null))[_0x4cf1('0x27')](respondWithResult(_0x1105cb,null))[_0x4cf1('0x48')](handleError(_0x1105cb,null));};exports[_0x4cf1('0x28')]=function(_0x2e93cc,_0x2d161f){return db['VoiceChanSpy']['find']({'where':{'id':_0x2e93cc[_0x4cf1('0x49')]['id']}})['then'](handleEntityNotFound(_0x2d161f,null))[_0x4cf1('0x27')](removeEntity(_0x2d161f,null))[_0x4cf1('0x48')](handleError(_0x2d161f,null));}; \ No newline at end of file +var _0x18e0=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','ChanSpies','end','error','name','send','index','map','VoiceChanSpy','rawAttributes','type','key','model','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','options','include','findAll','show','params','length','create','body'];(function(_0x4f60a1,_0x1f98fd){var _0xb4714f=function(_0x4c0d1d){while(--_0x4c0d1d){_0x4f60a1['push'](_0x4f60a1['shift']());}};_0xb4714f(++_0x1f98fd);}(_0x18e0,0xa2));var _0x018e=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x18e0[_0x263a74];return _0x2aa86c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x018e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x018e('0x1'));var rp=require(_0x018e('0x2'));var moment=require(_0x018e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x018e('0x4'));var util=require('util');var path=require('path');var sox=require(_0x018e('0x5'));var csv=require(_0x018e('0x6'));var ejs=require(_0x018e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x018e('0x8'));var crypto=require(_0x018e('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x018e('0xa'));var toCsv=require(_0x018e('0x6'));var querystring=require(_0x018e('0xb'));var Papa=require(_0x018e('0xc'));var Redis=require(_0x018e('0xd'));var authService=require(_0x018e('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x018e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x018e('0x10'));var config=require(_0x018e('0x11'));var licenseUtil=require(_0x018e('0x12'));var db=require(_0x018e('0x13'))['db'];function respondWithStatusCode(_0x167572,_0xd16776){_0xd16776=_0xd16776||0xcc;return function(_0xc940bb){if(_0xc940bb){return _0x167572[_0x018e('0x14')](_0xd16776);}return _0x167572[_0x018e('0x15')](_0xd16776)['end']();};}function respondWithResult(_0xec531a,_0x3b1e5e){_0x3b1e5e=_0x3b1e5e||0xc8;return function(_0x2d6aa0){if(_0x2d6aa0){return _0xec531a[_0x018e('0x15')](_0x3b1e5e)[_0x018e('0x16')](_0x2d6aa0);}};}function respondWithFilteredResult(_0x5bfd6e,_0x275c21){return function(_0x142f1e){if(_0x142f1e){var _0x41cbd8=typeof _0x275c21[_0x018e('0x17')]==='undefined'&&typeof _0x275c21[_0x018e('0x18')]===_0x018e('0x19');var _0x4d46aa=_0x142f1e[_0x018e('0x1a')];var _0x237ba1=_0x41cbd8?0x0:_0x275c21[_0x018e('0x17')];var _0xdf15f8=_0x41cbd8?_0x142f1e[_0x018e('0x1a')]:_0x275c21['offset']+_0x275c21[_0x018e('0x18')];var _0x421942;if(_0xdf15f8>=_0x4d46aa){_0xdf15f8=_0x4d46aa;_0x421942=0xc8;}else{_0x421942=0xce;}_0x5bfd6e[_0x018e('0x15')](_0x421942);return _0x5bfd6e[_0x018e('0x1b')](_0x018e('0x1c'),_0x237ba1+'-'+_0xdf15f8+'/'+_0x4d46aa)[_0x018e('0x16')](_0x142f1e);}return null;};}function patchUpdates(_0x15c3fa){return function(_0x4f59e7){try{jsonpatch[_0x018e('0x1d')](_0x4f59e7,_0x15c3fa,!![]);}catch(_0x213989){return BPromise[_0x018e('0x1e')](_0x213989);}return _0x4f59e7[_0x018e('0x1f')]();};}function saveUpdates(_0x23ef86,_0x5d9fef){return function(_0x5cffe9){if(_0x5cffe9){return _0x5cffe9[_0x018e('0x20')](_0x23ef86)[_0x018e('0x21')](function(_0x2c813e){return _0x2c813e;});}return null;};}function removeEntity(_0x1e3106,_0x2ef801){return function(_0x198b0b){if(_0x198b0b){return _0x198b0b[_0x018e('0x22')]()[_0x018e('0x21')](function(){var _0x3e3b35=_0x198b0b[_0x018e('0x23')]({'plain':!![]});var _0x35f9a3=_0x018e('0x24');return db['UserProfileResource'][_0x018e('0x22')]({'where':{'type':_0x35f9a3,'resourceId':_0x3e3b35['id']}})[_0x018e('0x21')](function(){return _0x198b0b;});})[_0x018e('0x21')](function(){_0x1e3106[_0x018e('0x15')](0xcc)[_0x018e('0x25')]();});}};}function handleEntityNotFound(_0x184990,_0x407fda){return function(_0x3724ed){if(!_0x3724ed){_0x184990[_0x018e('0x14')](0x194);}return _0x3724ed;};}function handleError(_0x3287e8,_0x55e64b){_0x55e64b=_0x55e64b||0x1f4;return function(_0x29455a){logger[_0x018e('0x26')](_0x29455a['stack']);if(_0x29455a[_0x018e('0x27')]){delete _0x29455a[_0x018e('0x27')];}_0x3287e8[_0x018e('0x15')](_0x55e64b)[_0x018e('0x28')](_0x29455a);};}exports[_0x018e('0x29')]=function(_0x42da91,_0x47af9d){var _0x2db83e={},_0x1e35d9={},_0x5903d6={'count':0x0,'rows':[]};var _0x12a7e5=_[_0x018e('0x2a')](db[_0x018e('0x2b')][_0x018e('0x2c')],function(_0x2e160d){return{'name':_0x2e160d['fieldName'],'type':_0x2e160d[_0x018e('0x2d')][_0x018e('0x2e')]};});_0x1e35d9[_0x018e('0x2f')]=_['map'](_0x12a7e5,_0x018e('0x27'));_0x1e35d9['query']=_[_0x018e('0x30')](_0x42da91[_0x018e('0x31')]);_0x1e35d9['filters']=_['intersection'](_0x1e35d9[_0x018e('0x2f')],_0x1e35d9[_0x018e('0x31')]);_0x2db83e[_0x018e('0x32')]=_[_0x018e('0x33')](_0x1e35d9[_0x018e('0x2f')],qs['fields'](_0x42da91[_0x018e('0x31')][_0x018e('0x34')]));_0x2db83e[_0x018e('0x32')]=_0x2db83e['attributes']['length']?_0x2db83e[_0x018e('0x32')]:_0x1e35d9[_0x018e('0x2f')];if(!_0x42da91[_0x018e('0x31')][_0x018e('0x35')](_0x018e('0x36'))){_0x2db83e[_0x018e('0x18')]=qs['limit'](_0x42da91[_0x018e('0x31')][_0x018e('0x18')]);_0x2db83e['offset']=qs['offset'](_0x42da91['query'][_0x018e('0x17')]);}_0x2db83e[_0x018e('0x37')]=qs[_0x018e('0x38')](_0x42da91[_0x018e('0x31')][_0x018e('0x38')]);_0x2db83e['where']=qs[_0x018e('0x39')](_['pick'](_0x42da91[_0x018e('0x31')],_0x1e35d9[_0x018e('0x39')]),_0x12a7e5);if(_0x42da91[_0x018e('0x31')][_0x018e('0x3a')]){_0x2db83e['where']=_[_0x018e('0x3b')](_0x2db83e[_0x018e('0x3c')],{'$or':_['map'](_0x12a7e5,function(_0x4a3692){if(_0x4a3692[_0x018e('0x2d')]!=='VIRTUAL'){var _0x123d75={};_0x123d75[_0x4a3692[_0x018e('0x27')]]={'$like':'%'+_0x42da91['query'][_0x018e('0x3a')]+'%'};return _0x123d75;}})});}_0x2db83e=_[_0x018e('0x3b')]({},_0x2db83e,_0x42da91[_0x018e('0x3d')]);var _0x368b89={'where':_0x2db83e[_0x018e('0x3c')]};return db[_0x018e('0x2b')][_0x018e('0x1a')](_0x368b89)[_0x018e('0x21')](function(_0x4b0b9b){_0x5903d6[_0x018e('0x1a')]=_0x4b0b9b;if(_0x42da91[_0x018e('0x31')]['includeAll']){_0x2db83e[_0x018e('0x3e')]=[{'all':!![]}];}return db[_0x018e('0x2b')][_0x018e('0x3f')](_0x2db83e);})[_0x018e('0x21')](function(_0x34bfec){_0x5903d6['rows']=_0x34bfec;return _0x5903d6;})[_0x018e('0x21')](respondWithFilteredResult(_0x47af9d,_0x2db83e))['catch'](handleError(_0x47af9d,null));};exports[_0x018e('0x40')]=function(_0x2cbf1b,_0x1e2029){var _0x1c2706={'raw':![],'where':{'id':_0x2cbf1b[_0x018e('0x41')]['id']}},_0x5b8078={};_0x5b8078[_0x018e('0x2f')]=_['keys'](db[_0x018e('0x2b')][_0x018e('0x2c')]);_0x5b8078[_0x018e('0x31')]=_[_0x018e('0x30')](_0x2cbf1b[_0x018e('0x31')]);_0x5b8078[_0x018e('0x39')]=_['intersection'](_0x5b8078[_0x018e('0x2f')],_0x5b8078[_0x018e('0x31')]);_0x1c2706['attributes']=_[_0x018e('0x33')](_0x5b8078[_0x018e('0x2f')],qs[_0x018e('0x34')](_0x2cbf1b[_0x018e('0x31')][_0x018e('0x34')]));_0x1c2706[_0x018e('0x32')]=_0x1c2706[_0x018e('0x32')][_0x018e('0x42')]?_0x1c2706[_0x018e('0x32')]:_0x5b8078[_0x018e('0x2f')];if(_0x2cbf1b[_0x018e('0x31')]['includeAll']){_0x1c2706[_0x018e('0x3e')]=[{'all':!![]}];}_0x1c2706=_['merge']({},_0x1c2706,_0x2cbf1b[_0x018e('0x3d')]);return db[_0x018e('0x2b')]['find'](_0x1c2706)['then'](handleEntityNotFound(_0x1e2029,null))[_0x018e('0x21')](respondWithResult(_0x1e2029,null))['catch'](handleError(_0x1e2029,null));};exports['create']=function(_0x4f1df6,_0x3e26b1){return db[_0x018e('0x2b')][_0x018e('0x43')](_0x4f1df6[_0x018e('0x44')],{})['then'](function(_0x8aca61){var _0x395d32=_0x4f1df6[_0x018e('0x45')][_0x018e('0x23')]({'plain':!![]});if(!_0x395d32)throw new Error(_0x018e('0x46'));if(_0x395d32[_0x018e('0x47')]===_0x018e('0x45')){var _0x1e8929=_0x8aca61['get']({'plain':!![]});var _0x208ce1=_0x018e('0x24');return db[_0x018e('0x48')][_0x018e('0x49')]({'where':{'name':_0x208ce1,'userProfileId':_0x395d32['userProfileId']},'raw':!![]})[_0x018e('0x21')](function(_0x222101){if(_0x222101&&_0x222101[_0x018e('0x4a')]===0x0){return db['UserProfileResource'][_0x018e('0x43')]({'name':_0x1e8929[_0x018e('0x27')],'resourceId':_0x1e8929['id'],'type':_0x222101['name'],'sectionId':_0x222101['id']},{})[_0x018e('0x21')](function(){return _0x8aca61;});}else{return _0x8aca61;}})[_0x018e('0x4b')](function(_0x17298c){logger[_0x018e('0x26')](_0x018e('0x4c'),_0x17298c);throw _0x17298c;});}return _0x8aca61;})[_0x018e('0x21')](respondWithResult(_0x3e26b1,0xc9))['catch'](handleError(_0x3e26b1,null));};exports['update']=function(_0x18fa8f,_0x415268){if(_0x18fa8f[_0x018e('0x44')]['id']){delete _0x18fa8f['body']['id'];}return db[_0x018e('0x2b')]['find']({'where':{'id':_0x18fa8f['params']['id']}})[_0x018e('0x21')](handleEntityNotFound(_0x415268,null))[_0x018e('0x21')](saveUpdates(_0x18fa8f[_0x018e('0x44')],null))['then'](respondWithResult(_0x415268,null))[_0x018e('0x4b')](handleError(_0x415268,null));};exports[_0x018e('0x22')]=function(_0x129dd7,_0x2164cd){return db[_0x018e('0x2b')]['find']({'where':{'id':_0x129dd7[_0x018e('0x41')]['id']}})[_0x018e('0x21')](handleEntityNotFound(_0x2164cd,null))[_0x018e('0x21')](removeEntity(_0x2164cd,null))[_0x018e('0x4b')](handleError(_0x2164cd,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index f1d7ecf..ba5f5af 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 _0xb8f9=['util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','merge','CDR(type)=%s','record','MixMonitor','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','SIP/%s,%s','options','StopMixMonitor','length','concat','internal','name','User','findAll','agent','then','exports','models','define','VoiceChanSpy','VoiceExtension','bulkCreate','catch','destroy','lodash'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb8f9,0xe9));var _0x9b8f=function(_0x228394,_0x2bcb15){_0x228394=_0x228394-0x0;var _0x1f4a17=_0xb8f9[_0x228394];return _0x1f4a17;};'use strict';var _=require(_0x9b8f('0x0'));var util=require(_0x9b8f('0x1'));var BPromise=require(_0x9b8f('0x2'));var attributes=require(_0x9b8f('0x3'));var getUserApplications=function(_0x2b3748,_0x3f2df1,_0x4db0e3){var _0x496896=0x1;var _0x27eedc=[];var _0x50b721={'context':_0x3f2df1[_0x9b8f('0x4')]||_0x9b8f('0x5'),'exten':util[_0x9b8f('0x6')](_0x9b8f('0x7'),_0x2b3748[_0x9b8f('0x8')],_0x4db0e3),'type':_0x9b8f('0x9'),'isApp':![],'ChanSpyId':_0x2b3748['id'],'UserId':_0x3f2df1['id']};_0x27eedc[_0x9b8f('0xa')](_[_0x9b8f('0xb')]({'app':'Set','appdata':util[_0x9b8f('0x6')](_0x9b8f('0xc'),'chanspy'),'priority':_0x496896++},_0x50b721));if(_0x2b3748[_0x9b8f('0xd')]){_0x27eedc[_0x9b8f('0xa')](_[_0x9b8f('0xb')]({'app':_0x9b8f('0xe'),'appdata':util[_0x9b8f('0x6')](_0x9b8f('0xf'),_0x2b3748['recordingFormat']),'priority':_0x496896++},_0x50b721));}if(_0x2b3748[_0x9b8f('0x10')]){_0x27eedc[_0x9b8f('0xa')](_['merge']({'app':_0x9b8f('0x11'),'appdata':_0x2b3748[_0x9b8f('0x12')],'priority':_0x496896++},_0x50b721));}_0x27eedc[_0x9b8f('0xa')](_['merge']({'app':_0x9b8f('0x13'),'appdata':util[_0x9b8f('0x6')](_0x9b8f('0x14'),_0x3f2df1['name'],_0x2b3748['options']?_0x2b3748[_0x9b8f('0x15')]['join'](''):''),'priority':_0x496896++},_0x50b721));if(_0x2b3748[_0x9b8f('0xd')]){_0x27eedc[_0x9b8f('0xa')](_['merge']({'app':_0x9b8f('0x16'),'priority':_0x496896++},_0x50b721));}return _0x27eedc;};var getChanSpyApplications=function(_0x1334d5,_0x636d95){var _0x398c3d=[];for(var _0x2094d1=0x0,_0x97c993=0x1;_0x2094d1<_0x636d95[_0x9b8f('0x17')];_0x2094d1++,_0x97c993=0x1){_0x398c3d=_0x398c3d[_0x9b8f('0x18')](getUserApplications(_0x1334d5,_0x636d95[_0x2094d1],_0x636d95[_0x2094d1][_0x9b8f('0x19')]));if(_0x636d95[_0x2094d1][_0x9b8f('0x19')]!=_0x636d95[_0x2094d1]['name']){_0x398c3d=_0x398c3d['concat'](getUserApplications(_0x1334d5,_0x636d95[_0x2094d1],_0x636d95[_0x2094d1][_0x9b8f('0x1a')]));}}return _0x398c3d;};var getChanSpyPromise=function(_0x48d3ea,_0x327316){return new BPromise(function(_0x1de491,_0x2e25f2){return _0x48d3ea[_0x9b8f('0x1b')][_0x9b8f('0x1c')]({'attributes':['id',_0x9b8f('0x1a'),_0x9b8f('0x19')],'where':{'role':_0x9b8f('0x1d'),'chanspy':!![]},'raw':!![]})[_0x9b8f('0x1e')](function(_0x3dec7a){if(_0x3dec7a){return _0x1de491(getChanSpyApplications(_0x327316,_0x3dec7a));}return _0x1de491([]);})['catch'](function(_0x23aabe){_0x2e25f2(_0x23aabe);});});};module[_0x9b8f('0x1f')]=function(_0x5e9484,_0x45a131){var _0x139377=_0x5e9484[_0x9b8f('0x20')];return _0x5e9484[_0x9b8f('0x21')](_0x9b8f('0x22'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x179265,_0x3dcd0b,_0x58e3dd){return getChanSpyPromise(_0x139377,_0x179265)[_0x9b8f('0x1e')](function(_0x5656cc){if(_0x5656cc&&_0x5656cc[_0x9b8f('0x17')]){return _0x139377[_0x9b8f('0x23')][_0x9b8f('0x24')](_0x5656cc);}})[_0x9b8f('0x1e')](function(){_0x58e3dd();})[_0x9b8f('0x25')](function(_0x276418){_0x58e3dd(_0x276418);});},'afterUpdate':function(_0x3411ff,_0x4e49ff,_0x11206c){return _0x139377[_0x9b8f('0x23')][_0x9b8f('0x26')]({'where':{'ChanSpyId':_0x3411ff['id']}})[_0x9b8f('0x1e')](function(){return getChanSpyPromise(_0x139377,_0x3411ff);})[_0x9b8f('0x1e')](function(_0x44ed7f){if(_0x44ed7f&&_0x44ed7f[_0x9b8f('0x17')]){return _0x139377[_0x9b8f('0x23')][_0x9b8f('0x24')](_0x44ed7f);}})[_0x9b8f('0x1e')](function(){_0x11206c();})[_0x9b8f('0x25')](function(_0x23c6b2){_0x11206c(_0x23c6b2);});},'afterDestroy':function(_0x54e247,_0xdd379c,_0x5dcc8e){return _0x139377['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x54e247['id']}})['then'](function(){_0x5dcc8e();})[_0x9b8f('0x25')](function(_0x1272dd){_0x5dcc8e(_0x1272dd);});}}});}; \ No newline at end of file +var _0xa7d7=['chanspy','record','merge','MixMonitor','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','length','concat','internal','User','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','lodash','util','bluebird','./voiceChanSpy.attributes','context','%s%s','prefix','system','push','format','CDR(type)=%s'];(function(_0x1cbcf1,_0x3f9fd9){var _0x3a06f0=function(_0x5425d4){while(--_0x5425d4){_0x1cbcf1['push'](_0x1cbcf1['shift']());}};_0x3a06f0(++_0x3f9fd9);}(_0xa7d7,0xf8));var _0x7a7d=function(_0x240261,_0x4fe66c){_0x240261=_0x240261-0x0;var _0x45c332=_0xa7d7[_0x240261];return _0x45c332;};'use strict';var _=require(_0x7a7d('0x0'));var util=require(_0x7a7d('0x1'));var BPromise=require(_0x7a7d('0x2'));var attributes=require(_0x7a7d('0x3'));var getUserApplications=function(_0x70e662,_0x19a471,_0xd891b8){var _0x3834a5=0x1;var _0x41c700=[];var _0x3c1663={'context':_0x19a471[_0x7a7d('0x4')]||'from-sip','exten':util['format'](_0x7a7d('0x5'),_0x70e662[_0x7a7d('0x6')],_0xd891b8),'type':_0x7a7d('0x7'),'isApp':![],'ChanSpyId':_0x70e662['id'],'UserId':_0x19a471['id']};_0x41c700[_0x7a7d('0x8')](_['merge']({'app':'Set','appdata':util[_0x7a7d('0x9')](_0x7a7d('0xa'),_0x7a7d('0xb')),'priority':_0x3834a5++},_0x3c1663));if(_0x70e662[_0x7a7d('0xc')]){_0x41c700[_0x7a7d('0x8')](_[_0x7a7d('0xd')]({'app':_0x7a7d('0xe'),'appdata':util[_0x7a7d('0x9')]('${UNIQUEID}.%s,a',_0x70e662[_0x7a7d('0xf')]),'priority':_0x3834a5++},_0x3c1663));}if(_0x70e662[_0x7a7d('0x10')]){_0x41c700[_0x7a7d('0x8')](_[_0x7a7d('0xd')]({'app':_0x7a7d('0x11'),'appdata':_0x70e662[_0x7a7d('0x12')],'priority':_0x3834a5++},_0x3c1663));}_0x41c700[_0x7a7d('0x8')](_['merge']({'app':_0x7a7d('0x13'),'appdata':util[_0x7a7d('0x9')](_0x7a7d('0x14'),_0x19a471[_0x7a7d('0x15')],_0x70e662[_0x7a7d('0x16')]?_0x70e662[_0x7a7d('0x16')][_0x7a7d('0x17')](''):''),'priority':_0x3834a5++},_0x3c1663));if(_0x70e662[_0x7a7d('0xc')]){_0x41c700[_0x7a7d('0x8')](_['merge']({'app':'StopMixMonitor','priority':_0x3834a5++},_0x3c1663));}return _0x41c700;};var getChanSpyApplications=function(_0x5099fa,_0x2bbbb7){var _0x3e894c=[];for(var _0x350a67=0x0,_0x489e5b=0x1;_0x350a67<_0x2bbbb7[_0x7a7d('0x18')];_0x350a67++,_0x489e5b=0x1){_0x3e894c=_0x3e894c[_0x7a7d('0x19')](getUserApplications(_0x5099fa,_0x2bbbb7[_0x350a67],_0x2bbbb7[_0x350a67]['internal']));if(_0x2bbbb7[_0x350a67][_0x7a7d('0x1a')]!=_0x2bbbb7[_0x350a67]['name']){_0x3e894c=_0x3e894c[_0x7a7d('0x19')](getUserApplications(_0x5099fa,_0x2bbbb7[_0x350a67],_0x2bbbb7[_0x350a67][_0x7a7d('0x15')]));}}return _0x3e894c;};var getChanSpyPromise=function(_0x29e9ca,_0x5c2852){return new BPromise(function(_0x5d6ad5,_0xa8cd36){return _0x29e9ca[_0x7a7d('0x1b')]['findAll']({'attributes':['id',_0x7a7d('0x15'),_0x7a7d('0x1a')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x7a7d('0x1c')](function(_0x291474){if(_0x291474){return _0x5d6ad5(getChanSpyApplications(_0x5c2852,_0x291474));}return _0x5d6ad5([]);})[_0x7a7d('0x1d')](function(_0x2d8a5c){_0xa8cd36(_0x2d8a5c);});});};module[_0x7a7d('0x1e')]=function(_0xd1137b,_0x4cf2b0){var _0x1d2360=_0xd1137b[_0x7a7d('0x1f')];return _0xd1137b[_0x7a7d('0x20')](_0x7a7d('0x21'),attributes,{'tableName':_0x7a7d('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3c6762,_0x264975,_0x2630af){return getChanSpyPromise(_0x1d2360,_0x3c6762)[_0x7a7d('0x1c')](function(_0x2bd4e2){if(_0x2bd4e2&&_0x2bd4e2['length']){return _0x1d2360[_0x7a7d('0x23')][_0x7a7d('0x24')](_0x2bd4e2);}})[_0x7a7d('0x1c')](function(){_0x2630af();})['catch'](function(_0xca5e79){_0x2630af(_0xca5e79);});},'afterUpdate':function(_0x261aaf,_0x4fb94b,_0x1b9ae9){return _0x1d2360[_0x7a7d('0x23')]['destroy']({'where':{'ChanSpyId':_0x261aaf['id']}})[_0x7a7d('0x1c')](function(){return getChanSpyPromise(_0x1d2360,_0x261aaf);})[_0x7a7d('0x1c')](function(_0x1057be){if(_0x1057be&&_0x1057be[_0x7a7d('0x18')]){return _0x1d2360[_0x7a7d('0x23')][_0x7a7d('0x24')](_0x1057be);}})[_0x7a7d('0x1c')](function(){_0x1b9ae9();})[_0x7a7d('0x1d')](function(_0x3de1cb){_0x1b9ae9(_0x3de1cb);});},'afterDestroy':function(_0x2e4495,_0x183584,_0x3dcd3a){return _0x1d2360['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x2e4495['id']}})[_0x7a7d('0x1c')](function(){_0x3dcd3a();})[_0x7a7d('0x1d')](function(_0x3aca0b){_0x3dcd3a(_0x3aca0b);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 5770fe0..f70a7a4 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 _0x49e9=['stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s'];(function(_0x3b7fe3,_0x4e88da){var _0x554c89=function(_0xfe22cb){while(--_0xfe22cb){_0x3b7fe3['push'](_0x3b7fe3['shift']());}};_0x554c89(++_0x4e88da);}(_0x49e9,0x10f));var _0x949e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x49e9[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x949e('0x0'));var util=require(_0x949e('0x1'));var moment=require('moment');var BPromise=require(_0x949e('0x2'));var rs=require(_0x949e('0x3'));var fs=require('fs');var Redis=require(_0x949e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x949e('0x5'))('rpc');var config=require(_0x949e('0x6'));var jayson=require(_0x949e('0x7'));var client=jayson[_0x949e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17f649,_0x16c669,_0xfc4f8a){return new BPromise(function(_0x34ee57,_0x40d442){return client[_0x949e('0x9')](_0x17f649,_0xfc4f8a)[_0x949e('0xa')](function(_0x56e31d){logger[_0x949e('0xb')]('VoiceChanSpy,\x20%s,\x20%s',_0x16c669,_0x949e('0xc'));logger[_0x949e('0xd')](_0x949e('0xe'),_0x16c669,'request\x20sent',JSON[_0x949e('0xf')](_0x56e31d));if(_0x56e31d[_0x949e('0x10')]){if(_0x56e31d[_0x949e('0x10')][_0x949e('0x11')]===0x1f4){logger[_0x949e('0x10')](_0x949e('0x12'),_0x16c669,_0x56e31d[_0x949e('0x10')][_0x949e('0x13')]);return _0x40d442(_0x56e31d[_0x949e('0x10')][_0x949e('0x13')]);}logger[_0x949e('0x10')](_0x949e('0x12'),_0x16c669,_0x56e31d[_0x949e('0x10')][_0x949e('0x13')]);return _0x34ee57(_0x56e31d[_0x949e('0x10')]['message']);}else{logger[_0x949e('0xb')](_0x949e('0x12'),_0x16c669,_0x949e('0xc'));_0x34ee57(_0x56e31d[_0x949e('0x14')]['message']);}})[_0x949e('0x15')](function(_0x441b80){logger['error'](_0x949e('0x12'),_0x16c669,_0x441b80);_0x40d442(_0x441b80);});});} \ No newline at end of file +var _0xbfcc=['VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','request','info'];(function(_0x472c5b,_0x44ae83){var _0x4a9fa4=function(_0x11374c){while(--_0x11374c){_0x472c5b['push'](_0x472c5b['shift']());}};_0x4a9fa4(++_0x44ae83);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0xbfcc[_0x4d07cc];return _0x42de3b;};'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')]('VoiceChanSpy,\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);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index c092042..51b3dbf 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 _0x6233=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','post','create','put','/:id','destroy','exports','multer'];(function(_0x5206c8,_0x41b3a4){var _0x5e0abe=function(_0x1ef8a3){while(--_0x1ef8a3){_0x5206c8['push'](_0x5206c8['shift']());}};_0x5e0abe(++_0x41b3a4);}(_0x6233,0xc5));var _0x3623=function(_0x7d1fe4,_0x5aa052){_0x7d1fe4=_0x7d1fe4-0x0;var _0x2cab32=_0x6233[_0x7d1fe4];return _0x2cab32;};'use strict';var multer=require(_0x3623('0x0'));var util=require(_0x3623('0x1'));var path=require('path');var timeout=require(_0x3623('0x2'));var express=require(_0x3623('0x3'));var router=express[_0x3623('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3623('0x5'));var interaction=require(_0x3623('0x6'));var config=require(_0x3623('0x7'));var controller=require(_0x3623('0x8'));router[_0x3623('0x9')]('/',auth[_0x3623('0xa')](),controller[_0x3623('0xb')]);router[_0x3623('0x9')]('/:id',auth[_0x3623('0xa')](),controller['show']);router[_0x3623('0xc')]('/',auth[_0x3623('0xa')](),controller[_0x3623('0xd')]);router[_0x3623('0xe')](_0x3623('0xf'),auth[_0x3623('0xa')](),controller['update']);router['delete'](_0x3623('0xf'),auth[_0x3623('0xa')](),controller[_0x3623('0x10')]);module[_0x3623('0x11')]=router; \ No newline at end of file +var _0x7cdc=['/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','get','index','isAuthenticated'];(function(_0xef1463,_0x3128a6){var _0x4893d0=function(_0xe09299){while(--_0xe09299){_0xef1463['push'](_0xef1463['shift']());}};_0x4893d0(++_0x3128a6);}(_0x7cdc,0x93));var _0xc7cd=function(_0x498e53,_0x578e4e){_0x498e53=_0x498e53-0x0;var _0x371f78=_0x7cdc[_0x498e53];return _0x371f78;};'use strict';var multer=require('multer');var util=require(_0xc7cd('0x0'));var path=require(_0xc7cd('0x1'));var timeout=require(_0xc7cd('0x2'));var express=require(_0xc7cd('0x3'));var router=express[_0xc7cd('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc7cd('0x5'));var controller=require('./voiceContext.controller');router[_0xc7cd('0x6')]('/',auth['isAuthenticated'](),controller[_0xc7cd('0x7')]);router[_0xc7cd('0x6')]('/:id',auth[_0xc7cd('0x8')](),controller['show']);router['post']('/',auth[_0xc7cd('0x8')](),controller['create']);router['put'](_0xc7cd('0x9'),auth[_0xc7cd('0x8')](),controller['update']);router[_0xc7cd('0xa')](_0xc7cd('0x9'),auth[_0xc7cd('0x8')](),controller[_0xc7cd('0xb')]);module[_0xc7cd('0xc')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index f7fd1fe..3d81547 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 _0x4881=['sequelize','exports','STRING','name'];(function(_0x153d2f,_0x51f894){var _0x269a22=function(_0x440a44){while(--_0x440a44){_0x153d2f['push'](_0x153d2f['shift']());}};_0x269a22(++_0x51f894);}(_0x4881,0x98));var _0x1488=function(_0x42e07f,_0x393196){_0x42e07f=_0x42e07f-0x0;var _0x358915=_0x4881[_0x42e07f];return _0x358915;};'use strict';var Sequelize=require(_0x1488('0x0'));module[_0x1488('0x1')]={'name':{'type':Sequelize[_0x1488('0x2')],'unique':_0x1488('0x3')},'description':{'type':Sequelize[_0x1488('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x1e7b=['sequelize','name','BOOLEAN'];(function(_0x48acc0,_0x207e3c){var _0x25e0aa=function(_0x24f6fa){while(--_0x24f6fa){_0x48acc0['push'](_0x48acc0['shift']());}};_0x25e0aa(++_0x207e3c);}(_0x1e7b,0x19b));var _0xb1e7=function(_0x1789bc,_0x1acf84){_0x1789bc=_0x1789bc-0x0;var _0x35efd1=_0x1e7b[_0x1789bc];return _0x35efd1;};'use strict';var Sequelize=require(_0xb1e7('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xb1e7('0x1')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xb1e7('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index f6b12ed..520516f 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 _0x0449=['/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','Reload','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','jayson/promise','client','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','json','offset','undefined','count','set','Content-Range','save','update','destroy','Contexts','UserProfileResource','end','sendStatus','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','limit','order','sort','filters','where','merge','VIRTUAL','filter','options','includeAll','params','length','include','find','create','findAll','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync'];(function(_0x18496e,_0x4ca16e){var _0x5ec01f=function(_0x527b82){while(--_0x527b82){_0x18496e['push'](_0x18496e['shift']());}};_0x5ec01f(++_0x4ca16e);}(_0x0449,0x18b));var _0x9044=function(_0x3d3a9c,_0x33f233){_0x3d3a9c=_0x3d3a9c-0x0;var _0x424f00=_0x0449[_0x3d3a9c];return _0x424f00;};'use strict';var emlformat=require(_0x9044('0x0'));var rimraf=require(_0x9044('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9044('0x2'));var rp=require(_0x9044('0x3'));var moment=require('moment');var BPromise=require(_0x9044('0x4'));var Mustache=require(_0x9044('0x5'));var util=require('util');var path=require(_0x9044('0x6'));var sox=require(_0x9044('0x7'));var csv=require(_0x9044('0x8'));var ejs=require(_0x9044('0x9'));var fs=require('fs');var fs_extra=require(_0x9044('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9044('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9044('0xc'));var Papa=require(_0x9044('0xd'));var Redis=require(_0x9044('0xe'));var authService=require(_0x9044('0xf'));var qs=require(_0x9044('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9044('0x11'));var logger=require('../../config/logger')(_0x9044('0x12'));var utils=require('../../config/utils');var config=require(_0x9044('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x9044('0x14'));var client=jayson[_0x9044('0x15')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d4148,_0x51add1,_0x421cb5,_0x4595fb){return new BPromise(function(_0x3b065d,_0x3170ad){var _0x45f96d=_0x4595fb||client;return _0x45f96d['request'](_0x2d4148,_0x421cb5)[_0x9044('0x16')](function(_0x374a74){logger[_0x9044('0x17')](_0x9044('0x18'),_0x51add1,_0x9044('0x19'));logger['debug'](_0x9044('0x1a'),_0x51add1,_0x9044('0x19'),JSON['stringify'](_0x374a74));if(_0x374a74['error']){if(_0x374a74[_0x9044('0x1b')][_0x9044('0x1c')]===0x1f4){logger[_0x9044('0x1b')]('VoiceContext,\x20%s,\x20%s',_0x51add1,_0x374a74[_0x9044('0x1b')][_0x9044('0x1d')]);return _0x3170ad(_0x374a74[_0x9044('0x1b')][_0x9044('0x1d')]);}logger[_0x9044('0x1b')](_0x9044('0x18'),_0x51add1,_0x374a74[_0x9044('0x1b')][_0x9044('0x1d')]);return _0x3b065d(_0x374a74[_0x9044('0x1b')]['message']);}else{logger[_0x9044('0x17')]('VoiceContext,\x20%s,\x20%s',_0x51add1,_0x9044('0x19'));_0x3b065d(_0x374a74[_0x9044('0x1e')][_0x9044('0x1d')]);}})[_0x9044('0x1f')](function(_0x29fd7f){logger[_0x9044('0x1b')]('VoiceContext,\x20%s,\x20%s',_0x51add1,_0x29fd7f);_0x3170ad(_0x29fd7f);});});}function respondWithStatusCode(_0x5dac72,_0x3b6a06){_0x3b6a06=_0x3b6a06||0xcc;return function(_0x214d62){if(_0x214d62){return _0x5dac72['sendStatus'](_0x3b6a06);}return _0x5dac72[_0x9044('0x20')](_0x3b6a06)['end']();};}function respondWithResult(_0x2b9a6c,_0x4966b8){_0x4966b8=_0x4966b8||0xc8;return function(_0x491843){if(_0x491843){return _0x2b9a6c[_0x9044('0x20')](_0x4966b8)[_0x9044('0x21')](_0x491843);}};}function respondWithFilteredResult(_0x1a6b40,_0x2d83c1){return function(_0x15165a){if(_0x15165a){var _0x286986=typeof _0x2d83c1[_0x9044('0x22')]===_0x9044('0x23')&&typeof _0x2d83c1['limit']===_0x9044('0x23');var _0x5e5bc9=_0x15165a[_0x9044('0x24')];var _0x3777a9=_0x286986?0x0:_0x2d83c1[_0x9044('0x22')];var _0x5e15fd=_0x286986?_0x15165a[_0x9044('0x24')]:_0x2d83c1[_0x9044('0x22')]+_0x2d83c1['limit'];var _0x3b1ae7;if(_0x5e15fd>=_0x5e5bc9){_0x5e15fd=_0x5e5bc9;_0x3b1ae7=0xc8;}else{_0x3b1ae7=0xce;}_0x1a6b40[_0x9044('0x20')](_0x3b1ae7);return _0x1a6b40[_0x9044('0x25')](_0x9044('0x26'),_0x3777a9+'-'+_0x5e15fd+'/'+_0x5e5bc9)[_0x9044('0x21')](_0x15165a);}return null;};}function patchUpdates(_0x1a1c82){return function(_0x46f289){try{jsonpatch['apply'](_0x46f289,_0x1a1c82,!![]);}catch(_0x3f9929){return BPromise['reject'](_0x3f9929);}return _0x46f289[_0x9044('0x27')]();};}function saveUpdates(_0x34903e,_0x1690ed){return function(_0x422c07){if(_0x422c07){return _0x422c07[_0x9044('0x28')](_0x34903e)[_0x9044('0x16')](function(_0x2b6057){return _0x2b6057;});}return null;};}function removeEntity(_0x11160c,_0x56a968){return function(_0x58adab){if(_0x58adab){return _0x58adab[_0x9044('0x29')]()[_0x9044('0x16')](function(){var _0xb775ad=_0x58adab['get']({'plain':!![]});var _0x53e573=_0x9044('0x2a');return db[_0x9044('0x2b')][_0x9044('0x29')]({'where':{'type':_0x53e573,'resourceId':_0xb775ad['id']}})[_0x9044('0x16')](function(){return _0x58adab;});})[_0x9044('0x16')](function(){_0x11160c['status'](0xcc)[_0x9044('0x2c')]();});}};}function handleEntityNotFound(_0x26d220,_0x3b23bd){return function(_0x5dd0cf){if(!_0x5dd0cf){_0x26d220[_0x9044('0x2d')](0x194);}return _0x5dd0cf;};}function handleError(_0xf02251,_0x569852){_0x569852=_0x569852||0x1f4;return function(_0x440acd){logger[_0x9044('0x1b')](_0x440acd[_0x9044('0x2e')]);if(_0x440acd['name']){delete _0x440acd[_0x9044('0x2f')];}_0xf02251['status'](_0x569852)[_0x9044('0x30')](_0x440acd);};}exports[_0x9044('0x31')]=function(_0x37ca4f,_0x344325){var _0x59f31e={},_0x813199={},_0x581247={'count':0x0,'rows':[]};var _0x4fa8e5=_[_0x9044('0x32')](db[_0x9044('0x33')][_0x9044('0x34')],function(_0x2ff25f){return{'name':_0x2ff25f[_0x9044('0x35')],'type':_0x2ff25f[_0x9044('0x36')][_0x9044('0x37')]};});_0x813199['model']=_[_0x9044('0x32')](_0x4fa8e5,'name');_0x813199[_0x9044('0x38')]=_[_0x9044('0x39')](_0x37ca4f['query']);_0x813199['filters']=_[_0x9044('0x3a')](_0x813199['model'],_0x813199[_0x9044('0x38')]);_0x59f31e[_0x9044('0x3b')]=_[_0x9044('0x3a')](_0x813199[_0x9044('0x3c')],qs[_0x9044('0x3d')](_0x37ca4f[_0x9044('0x38')][_0x9044('0x3d')]));_0x59f31e[_0x9044('0x3b')]=_0x59f31e[_0x9044('0x3b')]['length']?_0x59f31e['attributes']:_0x813199[_0x9044('0x3c')];if(!_0x37ca4f['query']['hasOwnProperty']('nolimit')){_0x59f31e[_0x9044('0x3e')]=qs[_0x9044('0x3e')](_0x37ca4f[_0x9044('0x38')][_0x9044('0x3e')]);_0x59f31e[_0x9044('0x22')]=qs['offset'](_0x37ca4f[_0x9044('0x38')][_0x9044('0x22')]);}_0x59f31e[_0x9044('0x3f')]=qs[_0x9044('0x40')](_0x37ca4f[_0x9044('0x38')][_0x9044('0x40')]);_0x59f31e['where']=qs[_0x9044('0x41')](_['pick'](_0x37ca4f[_0x9044('0x38')],_0x813199[_0x9044('0x41')]),_0x4fa8e5);if(_0x37ca4f[_0x9044('0x38')]['filter']){_0x59f31e[_0x9044('0x42')]=_[_0x9044('0x43')](_0x59f31e[_0x9044('0x42')],{'$or':_['map'](_0x4fa8e5,function(_0x4d24cb){if(_0x4d24cb[_0x9044('0x36')]!==_0x9044('0x44')){var _0x1992b9={};_0x1992b9[_0x4d24cb['name']]={'$like':'%'+_0x37ca4f[_0x9044('0x38')][_0x9044('0x45')]+'%'};return _0x1992b9;}})});}_0x59f31e=_[_0x9044('0x43')]({},_0x59f31e,_0x37ca4f[_0x9044('0x46')]);var _0x4c5bfd={'where':_0x59f31e[_0x9044('0x42')]};return db['VoiceContext'][_0x9044('0x24')](_0x4c5bfd)[_0x9044('0x16')](function(_0x152ef1){_0x581247[_0x9044('0x24')]=_0x152ef1;if(_0x37ca4f[_0x9044('0x38')][_0x9044('0x47')]){_0x59f31e['include']=[{'all':!![]}];}return db['VoiceContext']['findAll'](_0x59f31e);})[_0x9044('0x16')](function(_0x367139){_0x581247['rows']=_0x367139;return _0x581247;})[_0x9044('0x16')](respondWithFilteredResult(_0x344325,_0x59f31e))[_0x9044('0x1f')](handleError(_0x344325,null));};exports['show']=function(_0x2d791b,_0x11a310){var _0xef9f4f={'raw':![],'where':{'id':_0x2d791b[_0x9044('0x48')]['id']}},_0x29ee91={};_0x29ee91[_0x9044('0x3c')]=_[_0x9044('0x39')](db[_0x9044('0x33')][_0x9044('0x34')]);_0x29ee91[_0x9044('0x38')]=_[_0x9044('0x39')](_0x2d791b[_0x9044('0x38')]);_0x29ee91['filters']=_[_0x9044('0x3a')](_0x29ee91[_0x9044('0x3c')],_0x29ee91[_0x9044('0x38')]);_0xef9f4f['attributes']=_[_0x9044('0x3a')](_0x29ee91[_0x9044('0x3c')],qs[_0x9044('0x3d')](_0x2d791b['query'][_0x9044('0x3d')]));_0xef9f4f[_0x9044('0x3b')]=_0xef9f4f[_0x9044('0x3b')][_0x9044('0x49')]?_0xef9f4f[_0x9044('0x3b')]:_0x29ee91['model'];if(_0x2d791b[_0x9044('0x38')][_0x9044('0x47')]){_0xef9f4f[_0x9044('0x4a')]=[{'all':!![]}];}_0xef9f4f=_[_0x9044('0x43')]({},_0xef9f4f,_0x2d791b[_0x9044('0x46')]);return db['VoiceContext'][_0x9044('0x4b')](_0xef9f4f)['then'](handleEntityNotFound(_0x11a310,null))['then'](respondWithResult(_0x11a310,null))[_0x9044('0x1f')](handleError(_0x11a310,null));};exports[_0x9044('0x4c')]=function(_0x15d8d2,_0x5adb67,_0x37c05b){var _0x322869;return db[_0x9044('0x33')][_0x9044('0x4c')](_0x15d8d2['body'],{'raw':!![]})[_0x9044('0x16')](function(_0x49ff3c){_0x322869=_0x49ff3c;return db[_0x9044('0x33')][_0x9044('0x4d')]({'raw':!![]});})['then'](function(_0x173816){var _0x5cda33=fs[_0x9044('0x4e')](path[_0x9044('0x4f')](config[_0x9044('0x50')],_0x9044('0x51')),_0x9044('0x52'));var _0x3deada=ejs[_0x9044('0x53')](_0x5cda33,{'contexts':_0x173816||[]});fs[_0x9044('0x54')](_0x9044('0x55'),_0x3deada);})[_0x9044('0x16')](function(){return respondWithRpcPromise('Reload',_0x9044('0x4c'),{'module':_0x9044('0x56')});})['then'](function(){var _0x54cf5f=_0x15d8d2['user'][_0x9044('0x57')]({'plain':!![]});if(!_0x54cf5f)throw new Error(_0x9044('0x58'));if(_0x54cf5f[_0x9044('0x59')]===_0x9044('0x5a')){var _0x277851=_0x322869[_0x9044('0x57')]({'plain':!![]});return db[_0x9044('0x5b')]['find']({'where':{'name':_0x9044('0x2a'),'userProfileId':_0x54cf5f[_0x9044('0x5c')]},'raw':!![]})['then'](function(_0x3cc5e9){if(_0x3cc5e9&&_0x3cc5e9['autoAssociation']===0x0){return db[_0x9044('0x2b')][_0x9044('0x4c')]({'name':_0x277851[_0x9044('0x2f')],'resourceId':_0x277851['id'],'type':_0x3cc5e9[_0x9044('0x2f')],'sectionId':_0x3cc5e9['id']},{})['then'](function(){return _0x322869;});}else{return _0x322869;}})[_0x9044('0x1f')](function(_0x453c19){logger[_0x9044('0x1b')](_0x9044('0x5d'),_0x453c19);throw _0x453c19;});}return _0x322869;})[_0x9044('0x16')](respondWithResult(_0x5adb67,0xc9))[_0x9044('0x1f')](handleError(_0x5adb67,null));};exports[_0x9044('0x28')]=function(_0x5bee14,_0x39d134,_0x14a30d){var _0x34e59f;return db[_0x9044('0x33')][_0x9044('0x4b')]({'where':{'id':_0x5bee14[_0x9044('0x48')]['id']}})[_0x9044('0x16')](handleEntityNotFound(_0x39d134,null))['then'](saveUpdates(_0x5bee14[_0x9044('0x5e')],null))[_0x9044('0x16')](function(_0x35a17b){if(_0x35a17b){_0x34e59f=_0x35a17b;return db[_0x9044('0x33')]['findAll']({'raw':!![]});}})[_0x9044('0x16')](function(_0x4af1ed){var _0x3f7c64=fs[_0x9044('0x4e')](path[_0x9044('0x4f')](config[_0x9044('0x50')],_0x9044('0x51')),_0x9044('0x52'));var _0x9b2724=ejs[_0x9044('0x53')](_0x3f7c64,{'contexts':_0x4af1ed||[]});fs['writeFileSync'](_0x9044('0x55'),_0x9b2724);})['then'](function(){return respondWithRpcPromise('Reload',_0x9044('0x28'),{'module':'chan_sip.so'});})[_0x9044('0x16')](function(){return _0x34e59f;})[_0x9044('0x16')](respondWithResult(_0x39d134,null))[_0x9044('0x1f')](handleError(_0x39d134,null));};exports['destroy']=function(_0x60bd1d,_0x5d0b1b,_0x316d80){var _0x3edee7;return db[_0x9044('0x33')][_0x9044('0x4b')]({'where':{'id':_0x60bd1d['params']['id']}})[_0x9044('0x16')](handleEntityNotFound(_0x5d0b1b,null))[_0x9044('0x16')](removeEntity(_0x5d0b1b,null))[_0x9044('0x16')](function(){return db['VoiceContext']['findAll']({'raw':!![]});})[_0x9044('0x16')](function(_0x42d697){var _0x230495=fs['readFileSync'](path['join'](config['root'],_0x9044('0x51')),_0x9044('0x52'));var _0x59562c=ejs[_0x9044('0x53')](_0x230495,{'contexts':_0x42d697});fs[_0x9044('0x54')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x59562c);return respondWithRpcPromise(_0x9044('0x5f'),_0x9044('0x29'),{'module':'chan_sip.so'});})[_0x9044('0x1f')](handleError(_0x5d0b1b,null));}; \ No newline at end of file +var _0x947c=['server/files/templates/context.ejs','Reload','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','Contexts','UserProfileResource','stack','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','VoiceContext','include','findAll','rows','params','rawAttributes','find','create','readFileSync','join','root','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','get','role','UserProfileSection','userProfileId','autoAssociation','update','body','utf8'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x947c,0x1aa));var _0xc947=function(_0x5519a9,_0x1c5147){_0x5519a9=_0x5519a9-0x0;var _0x32f2cc=_0x947c[_0x5519a9];return _0x32f2cc;};'use strict';var emlformat=require(_0xc947('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc947('0x1'));var jsonpatch=require(_0xc947('0x2'));var rp=require(_0xc947('0x3'));var moment=require(_0xc947('0x4'));var BPromise=require(_0xc947('0x5'));var Mustache=require(_0xc947('0x6'));var util=require(_0xc947('0x7'));var path=require(_0xc947('0x8'));var sox=require(_0xc947('0x9'));var csv=require(_0xc947('0xa'));var ejs=require(_0xc947('0xb'));var fs=require('fs');var fs_extra=require(_0xc947('0xc'));var _=require('lodash');var squel=require(_0xc947('0xd'));var crypto=require(_0xc947('0xe'));var jsforce=require(_0xc947('0xf'));var deskjs=require(_0xc947('0x10'));var toCsv=require(_0xc947('0xa'));var querystring=require(_0xc947('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc947('0x12'));var qs=require(_0xc947('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc947('0x14'));var logger=require(_0xc947('0x15'))(_0xc947('0x16'));var utils=require(_0xc947('0x17'));var config=require(_0xc947('0x18'));var licenseUtil=require(_0xc947('0x19'));var db=require(_0xc947('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xc947('0x1b')][_0xc947('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x10cfa0,_0x5e2e2c,_0x58231a,_0x44ddb8){return new BPromise(function(_0x215dbc,_0x5f109c){var _0xdfa56b=_0x44ddb8||client;return _0xdfa56b['request'](_0x10cfa0,_0x58231a)[_0xc947('0x1d')](function(_0x3da651){logger[_0xc947('0x1e')](_0xc947('0x1f'),_0x5e2e2c,_0xc947('0x20'));logger[_0xc947('0x21')](_0xc947('0x22'),_0x5e2e2c,_0xc947('0x20'),JSON[_0xc947('0x23')](_0x3da651));if(_0x3da651[_0xc947('0x24')]){if(_0x3da651[_0xc947('0x24')]['code']===0x1f4){logger['error'](_0xc947('0x1f'),_0x5e2e2c,_0x3da651[_0xc947('0x24')]['message']);return _0x5f109c(_0x3da651[_0xc947('0x24')][_0xc947('0x25')]);}logger[_0xc947('0x24')]('VoiceContext,\x20%s,\x20%s',_0x5e2e2c,_0x3da651['error'][_0xc947('0x25')]);return _0x215dbc(_0x3da651['error']['message']);}else{logger[_0xc947('0x1e')](_0xc947('0x1f'),_0x5e2e2c,_0xc947('0x20'));_0x215dbc(_0x3da651[_0xc947('0x26')][_0xc947('0x25')]);}})[_0xc947('0x27')](function(_0x322966){logger[_0xc947('0x24')]('VoiceContext,\x20%s,\x20%s',_0x5e2e2c,_0x322966);_0x5f109c(_0x322966);});});}function respondWithStatusCode(_0x362ac3,_0x327e59){_0x327e59=_0x327e59||0xcc;return function(_0x4a96ff){if(_0x4a96ff){return _0x362ac3[_0xc947('0x28')](_0x327e59);}return _0x362ac3[_0xc947('0x29')](_0x327e59)[_0xc947('0x2a')]();};}function respondWithResult(_0x21e1f3,_0x28845c){_0x28845c=_0x28845c||0xc8;return function(_0xaca7c6){if(_0xaca7c6){return _0x21e1f3['status'](_0x28845c)[_0xc947('0x2b')](_0xaca7c6);}};}function respondWithFilteredResult(_0x3c824c,_0x147b6d){return function(_0x334c11){if(_0x334c11){var _0x34847c=typeof _0x147b6d[_0xc947('0x2c')]===_0xc947('0x2d')&&typeof _0x147b6d[_0xc947('0x2e')]===_0xc947('0x2d');var _0x4ce364=_0x334c11[_0xc947('0x2f')];var _0x1371e7=_0x34847c?0x0:_0x147b6d[_0xc947('0x2c')];var _0x61e6d9=_0x34847c?_0x334c11[_0xc947('0x2f')]:_0x147b6d[_0xc947('0x2c')]+_0x147b6d[_0xc947('0x2e')];var _0x5aab3c;if(_0x61e6d9>=_0x4ce364){_0x61e6d9=_0x4ce364;_0x5aab3c=0xc8;}else{_0x5aab3c=0xce;}_0x3c824c['status'](_0x5aab3c);return _0x3c824c[_0xc947('0x30')](_0xc947('0x31'),_0x1371e7+'-'+_0x61e6d9+'/'+_0x4ce364)[_0xc947('0x2b')](_0x334c11);}return null;};}function patchUpdates(_0x4f64c7){return function(_0x33c72e){try{jsonpatch[_0xc947('0x32')](_0x33c72e,_0x4f64c7,!![]);}catch(_0x3b9474){return BPromise[_0xc947('0x33')](_0x3b9474);}return _0x33c72e['save']();};}function saveUpdates(_0x5b96b2,_0x4503b5){return function(_0x292556){if(_0x292556){return _0x292556['update'](_0x5b96b2)[_0xc947('0x1d')](function(_0x42a8c7){return _0x42a8c7;});}return null;};}function removeEntity(_0x125c85,_0x3e69aa){return function(_0x3bbcf7){if(_0x3bbcf7){return _0x3bbcf7[_0xc947('0x34')]()[_0xc947('0x1d')](function(){var _0x5d45db=_0x3bbcf7['get']({'plain':!![]});var _0x20f66a=_0xc947('0x35');return db[_0xc947('0x36')][_0xc947('0x34')]({'where':{'type':_0x20f66a,'resourceId':_0x5d45db['id']}})[_0xc947('0x1d')](function(){return _0x3bbcf7;});})[_0xc947('0x1d')](function(){_0x125c85[_0xc947('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50c19c,_0x2472fe){return function(_0x4c818d){if(!_0x4c818d){_0x50c19c['sendStatus'](0x194);}return _0x4c818d;};}function handleError(_0x1a27ae,_0x2e9912){_0x2e9912=_0x2e9912||0x1f4;return function(_0x396e65){logger[_0xc947('0x24')](_0x396e65[_0xc947('0x37')]);if(_0x396e65[_0xc947('0x38')]){delete _0x396e65[_0xc947('0x38')];}_0x1a27ae[_0xc947('0x29')](_0x2e9912)[_0xc947('0x39')](_0x396e65);};}exports[_0xc947('0x3a')]=function(_0x3979bf,_0x4dd613){var _0x1dcf0a={},_0x50ff5a={},_0x4ce6a8={'count':0x0,'rows':[]};var _0x22f03b=_[_0xc947('0x3b')](db['VoiceContext']['rawAttributes'],function(_0xba6e51){return{'name':_0xba6e51[_0xc947('0x3c')],'type':_0xba6e51[_0xc947('0x3d')][_0xc947('0x3e')]};});_0x50ff5a['model']=_[_0xc947('0x3b')](_0x22f03b,'name');_0x50ff5a[_0xc947('0x3f')]=_[_0xc947('0x40')](_0x3979bf[_0xc947('0x3f')]);_0x50ff5a[_0xc947('0x41')]=_[_0xc947('0x42')](_0x50ff5a[_0xc947('0x43')],_0x50ff5a[_0xc947('0x3f')]);_0x1dcf0a[_0xc947('0x44')]=_['intersection'](_0x50ff5a[_0xc947('0x43')],qs[_0xc947('0x45')](_0x3979bf[_0xc947('0x3f')]['fields']));_0x1dcf0a[_0xc947('0x44')]=_0x1dcf0a['attributes'][_0xc947('0x46')]?_0x1dcf0a['attributes']:_0x50ff5a[_0xc947('0x43')];if(!_0x3979bf[_0xc947('0x3f')][_0xc947('0x47')](_0xc947('0x48'))){_0x1dcf0a['limit']=qs[_0xc947('0x2e')](_0x3979bf[_0xc947('0x3f')][_0xc947('0x2e')]);_0x1dcf0a[_0xc947('0x2c')]=qs['offset'](_0x3979bf[_0xc947('0x3f')][_0xc947('0x2c')]);}_0x1dcf0a['order']=qs[_0xc947('0x49')](_0x3979bf[_0xc947('0x3f')][_0xc947('0x49')]);_0x1dcf0a[_0xc947('0x4a')]=qs['filters'](_[_0xc947('0x4b')](_0x3979bf[_0xc947('0x3f')],_0x50ff5a['filters']),_0x22f03b);if(_0x3979bf[_0xc947('0x3f')][_0xc947('0x4c')]){_0x1dcf0a[_0xc947('0x4a')]=_[_0xc947('0x4d')](_0x1dcf0a[_0xc947('0x4a')],{'$or':_[_0xc947('0x3b')](_0x22f03b,function(_0x3e5343){if(_0x3e5343['type']!==_0xc947('0x4e')){var _0xc18b14={};_0xc18b14[_0x3e5343['name']]={'$like':'%'+_0x3979bf[_0xc947('0x3f')][_0xc947('0x4c')]+'%'};return _0xc18b14;}})});}_0x1dcf0a=_[_0xc947('0x4d')]({},_0x1dcf0a,_0x3979bf[_0xc947('0x4f')]);var _0x541a20={'where':_0x1dcf0a[_0xc947('0x4a')]};return db[_0xc947('0x50')][_0xc947('0x2f')](_0x541a20)[_0xc947('0x1d')](function(_0x423f4d){_0x4ce6a8[_0xc947('0x2f')]=_0x423f4d;if(_0x3979bf[_0xc947('0x3f')]['includeAll']){_0x1dcf0a[_0xc947('0x51')]=[{'all':!![]}];}return db['VoiceContext'][_0xc947('0x52')](_0x1dcf0a);})[_0xc947('0x1d')](function(_0x3bf7c0){_0x4ce6a8[_0xc947('0x53')]=_0x3bf7c0;return _0x4ce6a8;})['then'](respondWithFilteredResult(_0x4dd613,_0x1dcf0a))[_0xc947('0x27')](handleError(_0x4dd613,null));};exports['show']=function(_0x1a771a,_0x3b4652){var _0x169f27={'raw':![],'where':{'id':_0x1a771a[_0xc947('0x54')]['id']}},_0x1ed796={};_0x1ed796['model']=_[_0xc947('0x40')](db[_0xc947('0x50')][_0xc947('0x55')]);_0x1ed796[_0xc947('0x3f')]=_[_0xc947('0x40')](_0x1a771a[_0xc947('0x3f')]);_0x1ed796['filters']=_[_0xc947('0x42')](_0x1ed796[_0xc947('0x43')],_0x1ed796[_0xc947('0x3f')]);_0x169f27[_0xc947('0x44')]=_[_0xc947('0x42')](_0x1ed796[_0xc947('0x43')],qs[_0xc947('0x45')](_0x1a771a['query']['fields']));_0x169f27[_0xc947('0x44')]=_0x169f27[_0xc947('0x44')][_0xc947('0x46')]?_0x169f27[_0xc947('0x44')]:_0x1ed796[_0xc947('0x43')];if(_0x1a771a[_0xc947('0x3f')]['includeAll']){_0x169f27[_0xc947('0x51')]=[{'all':!![]}];}_0x169f27=_[_0xc947('0x4d')]({},_0x169f27,_0x1a771a['options']);return db[_0xc947('0x50')][_0xc947('0x56')](_0x169f27)[_0xc947('0x1d')](handleEntityNotFound(_0x3b4652,null))[_0xc947('0x1d')](respondWithResult(_0x3b4652,null))[_0xc947('0x27')](handleError(_0x3b4652,null));};exports[_0xc947('0x57')]=function(_0xba756,_0x2019e0,_0x3262a8){var _0xc7ee63;return db['VoiceContext']['create'](_0xba756['body'],{'raw':!![]})[_0xc947('0x1d')](function(_0x53b18d){_0xc7ee63=_0x53b18d;return db[_0xc947('0x50')][_0xc947('0x52')]({'raw':!![]});})[_0xc947('0x1d')](function(_0x4c2a1f){var _0x2553de=fs[_0xc947('0x58')](path[_0xc947('0x59')](config[_0xc947('0x5a')],'server/files/templates/context.ejs'),'utf8');var _0x3318b1=ejs[_0xc947('0x5b')](_0x2553de,{'contexts':_0x4c2a1f||[]});fs[_0xc947('0x5c')](_0xc947('0x5d'),_0x3318b1);})['then'](function(){return respondWithRpcPromise('Reload',_0xc947('0x57'),{'module':_0xc947('0x5e')});})['then'](function(){var _0x16e6cb=_0xba756[_0xc947('0x5f')][_0xc947('0x60')]({'plain':!![]});if(!_0x16e6cb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16e6cb[_0xc947('0x61')]===_0xc947('0x5f')){var _0x3955fd=_0xc7ee63[_0xc947('0x60')]({'plain':!![]});return db[_0xc947('0x62')]['find']({'where':{'name':'Contexts','userProfileId':_0x16e6cb[_0xc947('0x63')]},'raw':!![]})[_0xc947('0x1d')](function(_0xb2bee9){if(_0xb2bee9&&_0xb2bee9[_0xc947('0x64')]===0x0){return db[_0xc947('0x36')][_0xc947('0x57')]({'name':_0x3955fd[_0xc947('0x38')],'resourceId':_0x3955fd['id'],'type':_0xb2bee9['name'],'sectionId':_0xb2bee9['id']},{})[_0xc947('0x1d')](function(){return _0xc7ee63;});}else{return _0xc7ee63;}})[_0xc947('0x27')](function(_0x2fe631){logger[_0xc947('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2fe631);throw _0x2fe631;});}return _0xc7ee63;})[_0xc947('0x1d')](respondWithResult(_0x2019e0,0xc9))[_0xc947('0x27')](handleError(_0x2019e0,null));};exports[_0xc947('0x65')]=function(_0xbfe876,_0x332589,_0x4be9bd){var _0x312786;return db[_0xc947('0x50')][_0xc947('0x56')]({'where':{'id':_0xbfe876[_0xc947('0x54')]['id']}})[_0xc947('0x1d')](handleEntityNotFound(_0x332589,null))[_0xc947('0x1d')](saveUpdates(_0xbfe876[_0xc947('0x66')],null))['then'](function(_0x487b75){if(_0x487b75){_0x312786=_0x487b75;return db[_0xc947('0x50')][_0xc947('0x52')]({'raw':!![]});}})[_0xc947('0x1d')](function(_0x46c33e){var _0x2c0281=fs[_0xc947('0x58')](path[_0xc947('0x59')](config[_0xc947('0x5a')],'server/files/templates/context.ejs'),_0xc947('0x67'));var _0x29ea81=ejs[_0xc947('0x5b')](_0x2c0281,{'contexts':_0x46c33e||[]});fs['writeFileSync'](_0xc947('0x5d'),_0x29ea81);})['then'](function(){return respondWithRpcPromise('Reload',_0xc947('0x65'),{'module':_0xc947('0x5e')});})[_0xc947('0x1d')](function(){return _0x312786;})[_0xc947('0x1d')](respondWithResult(_0x332589,null))[_0xc947('0x27')](handleError(_0x332589,null));};exports[_0xc947('0x34')]=function(_0x2916a2,_0xf487b4,_0x3cb80a){var _0x246550;return db[_0xc947('0x50')][_0xc947('0x56')]({'where':{'id':_0x2916a2[_0xc947('0x54')]['id']}})['then'](handleEntityNotFound(_0xf487b4,null))['then'](removeEntity(_0xf487b4,null))[_0xc947('0x1d')](function(){return db[_0xc947('0x50')]['findAll']({'raw':!![]});})[_0xc947('0x1d')](function(_0x4afe78){var _0x45a66a=fs[_0xc947('0x58')](path[_0xc947('0x59')](config['root'],_0xc947('0x68')),_0xc947('0x67'));var _0x4d335a=ejs[_0xc947('0x5b')](_0x45a66a,{'contexts':_0x4afe78});fs[_0xc947('0x5c')](_0xc947('0x5d'),_0x4d335a);return respondWithRpcPromise(_0xc947('0x69'),_0xc947('0x34'),{'module':_0xc947('0x5e')});})[_0xc947('0x27')](handleError(_0xf487b4,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 5e710ab..ca45b96 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 _0x5a69=['../../config/environment','./voiceContext.attributes','exports','VoiceContext','voice_contexts','lodash','util','api','moment','bluebird','request-promise'];(function(_0x3c34cd,_0x187610){var _0x299b33=function(_0x2004eb){while(--_0x2004eb){_0x3c34cd['push'](_0x3c34cd['shift']());}};_0x299b33(++_0x187610);}(_0x5a69,0x1de));var _0x95a6=function(_0x3d887c,_0x5e7c76){_0x3d887c=_0x3d887c-0x0;var _0x489382=_0x5a69[_0x3d887c];return _0x489382;};'use strict';var _=require(_0x95a6('0x0'));var util=require(_0x95a6('0x1'));var logger=require('../../config/logger')(_0x95a6('0x2'));var moment=require(_0x95a6('0x3'));var BPromise=require(_0x95a6('0x4'));var rp=require(_0x95a6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x95a6('0x6'));var attributes=require(_0x95a6('0x7'));module[_0x95a6('0x8')]=function(_0x3d4fa1,_0x295b87){return _0x3d4fa1['define'](_0x95a6('0x9'),attributes,{'tableName':_0x95a6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x20b8=['util','api','bluebird','path','rimraf','../../config/environment','exports','voice_contexts','lodash'];(function(_0x2d994d,_0x168a27){var _0xd54be4=function(_0x1db925){while(--_0x1db925){_0x2d994d['push'](_0x2d994d['shift']());}};_0xd54be4(++_0x168a27);}(_0x20b8,0x170));var _0x820b=function(_0x507f13,_0x4aaea0){_0x507f13=_0x507f13-0x0;var _0x41277f=_0x20b8[_0x507f13];return _0x41277f;};'use strict';var _=require(_0x820b('0x0'));var util=require(_0x820b('0x1'));var logger=require('../../config/logger')(_0x820b('0x2'));var moment=require('moment');var BPromise=require(_0x820b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x820b('0x4'));var rimraf=require(_0x820b('0x5'));var config=require(_0x820b('0x6'));var attributes=require('./voiceContext.attributes');module[_0x820b('0x7')]=function(_0x721825,_0x15ba23){return _0x721825['define']('VoiceContext',attributes,{'tableName':_0x820b('0x8'),'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 2239be4..da7292d 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 _0x79ad=['client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x18d402,_0x293437){var _0x5607c9=function(_0x25b6ec){while(--_0x25b6ec){_0x18d402['push'](_0x18d402['shift']());}};_0x5607c9(++_0x293437);}(_0x79ad,0x16e));var _0xd79a=function(_0x33daeb,_0x2c5f4b){_0x33daeb=_0x33daeb-0x0;var _0xaa5215=_0x79ad[_0x33daeb];return _0xaa5215;};'use strict';var _=require(_0xd79a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd79a('0x1'));var rs=require(_0xd79a('0x2'));var fs=require('fs');var Redis=require(_0xd79a('0x3'));var db=require(_0xd79a('0x4'))['db'];var utils=require(_0xd79a('0x5'));var logger=require(_0xd79a('0x6'))(_0xd79a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd79a('0x8')][_0xd79a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d3a5a,_0x273f8d,_0x12bf8c){return new BPromise(function(_0x263519,_0x2d3ec9){return client[_0xd79a('0xa')](_0x1d3a5a,_0x12bf8c)[_0xd79a('0xb')](function(_0x3080b0){logger[_0xd79a('0xc')](_0xd79a('0xd'),_0x273f8d,_0xd79a('0xe'));logger['debug'](_0xd79a('0xf'),_0x273f8d,_0xd79a('0xe'),JSON[_0xd79a('0x10')](_0x3080b0));if(_0x3080b0[_0xd79a('0x11')]){if(_0x3080b0[_0xd79a('0x11')][_0xd79a('0x12')]===0x1f4){logger[_0xd79a('0x11')](_0xd79a('0xd'),_0x273f8d,_0x3080b0[_0xd79a('0x11')]['message']);return _0x2d3ec9(_0x3080b0['error'][_0xd79a('0x13')]);}logger['error'](_0xd79a('0xd'),_0x273f8d,_0x3080b0[_0xd79a('0x11')][_0xd79a('0x13')]);return _0x263519(_0x3080b0[_0xd79a('0x11')][_0xd79a('0x13')]);}else{logger[_0xd79a('0xc')](_0xd79a('0xd'),_0x273f8d,_0xd79a('0xe'));_0x263519(_0x3080b0[_0xd79a('0x14')][_0xd79a('0x13')]);}})[_0xd79a('0x15')](function(_0x10f490){logger['error'](_0xd79a('0xd'),_0x273f8d,_0x10f490);_0x2d3ec9(_0x10f490);});});} \ No newline at end of file +var _0x374d=['result','lodash','util','bluebird','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','VoiceContext,\x20%s,\x20%s','message','info'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x374d,0x144));var _0xd374=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x374d[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0xd374('0x0'));var util=require(_0xd374('0x1'));var moment=require('moment');var BPromise=require(_0xd374('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd374('0x3'));var logger=require(_0xd374('0x4'))('rpc');var config=require(_0xd374('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xd374('0x6')][_0xd374('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x164801,_0x56e2b6,_0x215a53){return new BPromise(function(_0x3ef75d,_0x563d21){return client[_0xd374('0x8')](_0x164801,_0x215a53)[_0xd374('0x9')](function(_0x420a55){logger['info']('VoiceContext,\x20%s,\x20%s',_0x56e2b6,_0xd374('0xa'));logger[_0xd374('0xb')](_0xd374('0xc'),_0x56e2b6,_0xd374('0xa'),JSON['stringify'](_0x420a55));if(_0x420a55[_0xd374('0xd')]){if(_0x420a55[_0xd374('0xd')][_0xd374('0xe')]===0x1f4){logger[_0xd374('0xd')](_0xd374('0xf'),_0x56e2b6,_0x420a55['error']['message']);return _0x563d21(_0x420a55[_0xd374('0xd')][_0xd374('0x10')]);}logger[_0xd374('0xd')]('VoiceContext,\x20%s,\x20%s',_0x56e2b6,_0x420a55[_0xd374('0xd')][_0xd374('0x10')]);return _0x3ef75d(_0x420a55[_0xd374('0xd')][_0xd374('0x10')]);}else{logger[_0xd374('0x11')]('VoiceContext,\x20%s,\x20%s',_0x56e2b6,'request\x20sent');_0x3ef75d(_0x420a55[_0xd374('0x12')][_0xd374('0x10')]);}})['catch'](function(_0x212fa5){logger[_0xd374('0xd')]('VoiceContext,\x20%s,\x20%s',_0x56e2b6,_0x212fa5);_0x563d21(_0x212fa5);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 821113f..6d29e9a 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 _0x51f3=['../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','show','create','multer','util','express','Router','fs-extra','../../components/auth/service'];(function(_0x432595,_0x56bef0){var _0x296128=function(_0x4e4e42){while(--_0x4e4e42){_0x432595['push'](_0x432595['shift']());}};_0x296128(++_0x56bef0);}(_0x51f3,0x9f));var _0x351f=function(_0x3c5289,_0x5eeb0d){_0x3c5289=_0x3c5289-0x0;var _0x36f689=_0x51f3[_0x3c5289];return _0x36f689;};'use strict';var multer=require(_0x351f('0x0'));var util=require(_0x351f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x351f('0x2'));var router=express[_0x351f('0x3')]();var fs_extra=require(_0x351f('0x4'));var auth=require(_0x351f('0x5'));var interaction=require(_0x351f('0x6'));var config=require(_0x351f('0x7'));var controller=require('./voiceDialReport.controller');router[_0x351f('0x8')]('/',auth['isAuthenticated'](),controller[_0x351f('0x9')]);router[_0x351f('0x8')]('/describe',auth[_0x351f('0xa')](),controller[_0x351f('0xb')]);router[_0x351f('0x8')](_0x351f('0xc'),auth['isAuthenticated'](),controller[_0x351f('0xd')]);router['post']('/',auth[_0x351f('0xa')](),controller[_0x351f('0xe')]);router['put'](_0x351f('0xc'),auth[_0x351f('0xa')](),controller['update']);router['delete'](_0x351f('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x18b7=['get','/describe','isAuthenticated','describe','/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x18b7,0x155));var _0x718b=function(_0x2a81bc,_0x5b6525){_0x2a81bc=_0x2a81bc-0x0;var _0x153f1f=_0x18b7[_0x2a81bc];return _0x153f1f;};'use strict';var multer=require(_0x718b('0x0'));var util=require(_0x718b('0x1'));var path=require(_0x718b('0x2'));var timeout=require(_0x718b('0x3'));var express=require(_0x718b('0x4'));var router=express[_0x718b('0x5')]();var fs_extra=require(_0x718b('0x6'));var auth=require(_0x718b('0x7'));var interaction=require(_0x718b('0x8'));var config=require(_0x718b('0x9'));var controller=require(_0x718b('0xa'));router[_0x718b('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x718b('0xb')](_0x718b('0xc'),auth[_0x718b('0xd')](),controller[_0x718b('0xe')]);router[_0x718b('0xb')](_0x718b('0xf'),auth[_0x718b('0xd')](),controller['show']);router[_0x718b('0x10')]('/',auth['isAuthenticated'](),controller[_0x718b('0x11')]);router['put']('/:id',auth[_0x718b('0xd')](),controller[_0x718b('0x12')]);router[_0x718b('0x13')](_0x718b('0xf'),auth[_0x718b('0xd')](),controller[_0x718b('0x14')]);module[_0x718b('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index f55a81e..433a41b 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 _0xf2ca=['DATE','called,connect,complete','sequelize','exports','STRING','INTEGER'];(function(_0x1ac170,_0xbc9e92){var _0x3cfc1f=function(_0x27b95b){while(--_0x27b95b){_0x1ac170['push'](_0x1ac170['shift']());}};_0x3cfc1f(++_0xbc9e92);}(_0xf2ca,0x16a));var _0xaf2c=function(_0xc7348b,_0x145880){_0xc7348b=_0xc7348b-0x0;var _0x307cec=_0xf2ca[_0xc7348b];return _0x307cec;};'use strict';var Sequelize=require(_0xaf2c('0x0'));module[_0xaf2c('0x1')]={'privilege':{'type':Sequelize[_0xaf2c('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xaf2c('0x3')]},'channelstatedesc':{'type':Sequelize[_0xaf2c('0x2')]},'calleridnum':{'type':Sequelize[_0xaf2c('0x2')]},'calleridname':{'type':Sequelize[_0xaf2c('0x2')]},'connectedlinenum':{'type':Sequelize[_0xaf2c('0x2')]},'connectedlinename':{'type':Sequelize[_0xaf2c('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xaf2c('0x2')]},'context':{'type':Sequelize[_0xaf2c('0x2')]},'exten':{'type':Sequelize[_0xaf2c('0x2')]},'priority':{'type':Sequelize[_0xaf2c('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xaf2c('0x2')]},'destchannel':{'type':Sequelize[_0xaf2c('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xaf2c('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xaf2c('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xaf2c('0x2')]},'destlanguage':{'type':Sequelize[_0xaf2c('0x2')]},'destaccountcode':{'type':Sequelize[_0xaf2c('0x2')]},'destcontext':{'type':Sequelize[_0xaf2c('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xaf2c('0x2')]},'destlinkedid':{'type':Sequelize[_0xaf2c('0x2')]},'dialstring':{'type':Sequelize[_0xaf2c('0x2')]},'dialstatus':{'type':Sequelize[_0xaf2c('0x2')]},'starttime':{'type':Sequelize[_0xaf2c('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xaf2c('0x2')],'comment':_0xaf2c('0x5')},'routeId':{'type':Sequelize[_0xaf2c('0x3')]},'duration':{'type':Sequelize[_0xaf2c('0x3')]},'holdtime':{'type':Sequelize[_0xaf2c('0x3')]},'billableseconds':{'type':Sequelize[_0xaf2c('0x3')]}}; \ No newline at end of file +var _0x98a8=['sequelize','exports','STRING','INTEGER','DATE'];(function(_0x34a263,_0x2653b4){var _0x5e6c35=function(_0xad25b3){while(--_0xad25b3){_0x34a263['push'](_0x34a263['shift']());}};_0x5e6c35(++_0x2653b4);}(_0x98a8,0x12c));var _0x898a=function(_0x186c6f,_0x5ea467){_0x186c6f=_0x186c6f-0x0;var _0x3d76f2=_0x98a8[_0x186c6f];return _0x3d76f2;};'use strict';var Sequelize=require(_0x898a('0x0'));module[_0x898a('0x1')]={'privilege':{'type':Sequelize[_0x898a('0x2')]},'channel':{'type':Sequelize[_0x898a('0x2')]},'channelstate':{'type':Sequelize[_0x898a('0x3')]},'channelstatedesc':{'type':Sequelize[_0x898a('0x2')]},'calleridnum':{'type':Sequelize[_0x898a('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x898a('0x2')]},'connectedlinename':{'type':Sequelize[_0x898a('0x2')]},'language':{'type':Sequelize[_0x898a('0x2')]},'accountcode':{'type':Sequelize[_0x898a('0x2')]},'context':{'type':Sequelize[_0x898a('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x898a('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x898a('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x898a('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x898a('0x2')]},'destcalleridnum':{'type':Sequelize[_0x898a('0x2')]},'destcalleridname':{'type':Sequelize[_0x898a('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x898a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x898a('0x2')]},'destlanguage':{'type':Sequelize[_0x898a('0x2')]},'destaccountcode':{'type':Sequelize[_0x898a('0x2')]},'destcontext':{'type':Sequelize[_0x898a('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x898a('0x3')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x898a('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x898a('0x2')]},'starttime':{'type':Sequelize[_0x898a('0x4')]},'answertime':{'type':Sequelize[_0x898a('0x4')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x898a('0x3')]},'duration':{'type':Sequelize[_0x898a('0x3')]},'holdtime':{'type':Sequelize[_0x898a('0x3')]},'billableseconds':{'type':Sequelize[_0x898a('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 5805554..75954bd 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 _0xccb2=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','status','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','end','error','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','rows','params','find','body','catch','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv'];(function(_0xbfa7a8,_0x3e106e){var _0x5a4181=function(_0x59f367){while(--_0x59f367){_0xbfa7a8['push'](_0xbfa7a8['shift']());}};_0x5a4181(++_0x3e106e);}(_0xccb2,0x8c));var _0x2ccb=function(_0x50c90a,_0x5888e5){_0x50c90a=_0x50c90a-0x0;var _0x533244=_0xccb2[_0x50c90a];return _0x533244;};'use strict';var emlformat=require(_0x2ccb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2ccb('0x1'));var jsonpatch=require(_0x2ccb('0x2'));var rp=require(_0x2ccb('0x3'));var moment=require(_0x2ccb('0x4'));var BPromise=require(_0x2ccb('0x5'));var Mustache=require(_0x2ccb('0x6'));var util=require(_0x2ccb('0x7'));var path=require(_0x2ccb('0x8'));var sox=require('sox');var csv=require(_0x2ccb('0x9'));var ejs=require(_0x2ccb('0xa'));var fs=require('fs');var fs_extra=require(_0x2ccb('0xb'));var _=require(_0x2ccb('0xc'));var squel=require(_0x2ccb('0xd'));var crypto=require(_0x2ccb('0xe'));var jsforce=require(_0x2ccb('0xf'));var deskjs=require(_0x2ccb('0x10'));var toCsv=require(_0x2ccb('0x9'));var querystring=require(_0x2ccb('0x11'));var Papa=require(_0x2ccb('0x12'));var Redis=require(_0x2ccb('0x13'));var authService=require(_0x2ccb('0x14'));var qs=require(_0x2ccb('0x15'));var as=require(_0x2ccb('0x16'));var hardwareService=require(_0x2ccb('0x17'));var logger=require(_0x2ccb('0x18'))('api');var utils=require(_0x2ccb('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x2ccb('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d6c35,_0x3fe405){_0x3fe405=_0x3fe405||0xcc;return function(_0x5078da){if(_0x5078da){return _0x5d6c35['sendStatus'](_0x3fe405);}return _0x5d6c35['status'](_0x3fe405)['end']();};}function respondWithResult(_0x3ee236,_0x34b6a9){_0x34b6a9=_0x34b6a9||0xc8;return function(_0x6a1b09){if(_0x6a1b09){return _0x3ee236[_0x2ccb('0x1b')](_0x34b6a9)['json'](_0x6a1b09);}};}function respondWithFilteredResult(_0x2c44b9,_0x2cd149){return function(_0x2b0e26){if(_0x2b0e26){var _0xbd7795=typeof _0x2cd149[_0x2ccb('0x1c')]===_0x2ccb('0x1d')&&typeof _0x2cd149[_0x2ccb('0x1e')]===_0x2ccb('0x1d');var _0x1b6732=_0x2b0e26[_0x2ccb('0x1f')];var _0x486de6=_0xbd7795?0x0:_0x2cd149[_0x2ccb('0x1c')];var _0x1261e9=_0xbd7795?_0x2b0e26[_0x2ccb('0x1f')]:_0x2cd149[_0x2ccb('0x1c')]+_0x2cd149[_0x2ccb('0x1e')];var _0x362019;if(_0x1261e9>=_0x1b6732){_0x1261e9=_0x1b6732;_0x362019=0xc8;}else{_0x362019=0xce;}_0x2c44b9[_0x2ccb('0x1b')](_0x362019);return _0x2c44b9[_0x2ccb('0x20')](_0x2ccb('0x21'),_0x486de6+'-'+_0x1261e9+'/'+_0x1b6732)['json'](_0x2b0e26);}return null;};}function patchUpdates(_0x5e1bea){return function(_0x1f6ae6){try{jsonpatch[_0x2ccb('0x22')](_0x1f6ae6,_0x5e1bea,!![]);}catch(_0x537803){return BPromise['reject'](_0x537803);}return _0x1f6ae6[_0x2ccb('0x23')]();};}function saveUpdates(_0x490e76,_0x5514dc){return function(_0x3a2246){if(_0x3a2246){return _0x3a2246[_0x2ccb('0x24')](_0x490e76)['then'](function(_0xf3a94){return _0xf3a94;});}return null;};}function removeEntity(_0x340160,_0x351da6){return function(_0x2ebe8b){if(_0x2ebe8b){return _0x2ebe8b[_0x2ccb('0x25')]()[_0x2ccb('0x26')](function(){_0x340160[_0x2ccb('0x1b')](0xcc)[_0x2ccb('0x27')]();});}};}function handleEntityNotFound(_0x1d5511,_0x4aac9c){return function(_0x1ec50e){if(!_0x1ec50e){_0x1d5511['sendStatus'](0x194);}return _0x1ec50e;};}function handleError(_0x37a69a,_0x8a2e25){_0x8a2e25=_0x8a2e25||0x1f4;return function(_0x4369f1){logger[_0x2ccb('0x28')](_0x4369f1['stack']);if(_0x4369f1['name']){delete _0x4369f1[_0x2ccb('0x29')];}_0x37a69a[_0x2ccb('0x1b')](_0x8a2e25)[_0x2ccb('0x2a')](_0x4369f1);};}exports[_0x2ccb('0x2b')]=function(_0x16fd96,_0x3ff1c6){var _0x41f3da={},_0x4bc3aa={},_0x448fdc={'count':0x0,'rows':[]};var _0xef95d5=_[_0x2ccb('0x2c')](db[_0x2ccb('0x2d')][_0x2ccb('0x2e')],function(_0x527c36){return{'name':_0x527c36[_0x2ccb('0x2f')],'type':_0x527c36[_0x2ccb('0x30')][_0x2ccb('0x31')]};});_0x4bc3aa[_0x2ccb('0x32')]=_[_0x2ccb('0x2c')](_0xef95d5,_0x2ccb('0x29'));_0x4bc3aa[_0x2ccb('0x33')]=_[_0x2ccb('0x34')](_0x16fd96[_0x2ccb('0x33')]);_0x4bc3aa['filters']=_[_0x2ccb('0x35')](_0x4bc3aa[_0x2ccb('0x32')],_0x4bc3aa['query']);_0x41f3da['attributes']=_[_0x2ccb('0x35')](_0x4bc3aa[_0x2ccb('0x32')],qs[_0x2ccb('0x36')](_0x16fd96[_0x2ccb('0x33')][_0x2ccb('0x36')]));_0x41f3da[_0x2ccb('0x37')]=_0x41f3da['attributes'][_0x2ccb('0x38')]?_0x41f3da[_0x2ccb('0x37')]:_0x4bc3aa['model'];if(!_0x16fd96[_0x2ccb('0x33')]['hasOwnProperty'](_0x2ccb('0x39'))){_0x41f3da[_0x2ccb('0x1e')]=qs[_0x2ccb('0x1e')](_0x16fd96[_0x2ccb('0x33')][_0x2ccb('0x1e')]);_0x41f3da['offset']=qs['offset'](_0x16fd96['query'][_0x2ccb('0x1c')]);}_0x41f3da[_0x2ccb('0x3a')]=qs['sort'](_0x16fd96['query'][_0x2ccb('0x3b')]);_0x41f3da[_0x2ccb('0x3c')]=qs[_0x2ccb('0x3d')](_[_0x2ccb('0x3e')](_0x16fd96['query'],_0x4bc3aa[_0x2ccb('0x3d')]),_0xef95d5);if(_0x16fd96[_0x2ccb('0x33')]['filter']){_0x41f3da[_0x2ccb('0x3c')]=_[_0x2ccb('0x3f')](_0x41f3da['where'],{'$or':_[_0x2ccb('0x2c')](_0xef95d5,function(_0x32e995){if(_0x32e995[_0x2ccb('0x30')]!=='VIRTUAL'){var _0x10153b={};_0x10153b[_0x32e995['name']]={'$like':'%'+_0x16fd96[_0x2ccb('0x33')][_0x2ccb('0x40')]+'%'};return _0x10153b;}})});}_0x41f3da=_['merge']({},_0x41f3da,_0x16fd96[_0x2ccb('0x41')]);var _0x55cb48={'where':_0x41f3da['where']};return db[_0x2ccb('0x2d')]['count'](_0x55cb48)[_0x2ccb('0x26')](function(_0x59291f){_0x448fdc[_0x2ccb('0x1f')]=_0x59291f;if(_0x16fd96[_0x2ccb('0x33')][_0x2ccb('0x42')]){_0x41f3da[_0x2ccb('0x43')]=[{'all':!![]}];}return db[_0x2ccb('0x2d')][_0x2ccb('0x44')](_0x41f3da);})[_0x2ccb('0x26')](function(_0x593712){_0x448fdc[_0x2ccb('0x45')]=_0x593712;return _0x448fdc;})[_0x2ccb('0x26')](respondWithFilteredResult(_0x3ff1c6,_0x41f3da))['catch'](handleError(_0x3ff1c6,null));};exports['show']=function(_0x4e28da,_0x3cb124){var _0x42a413={'raw':!![],'where':{'id':_0x4e28da[_0x2ccb('0x46')]['id']}},_0x5c65de={};_0x5c65de[_0x2ccb('0x32')]=_[_0x2ccb('0x34')](db[_0x2ccb('0x2d')][_0x2ccb('0x2e')]);_0x5c65de['query']=_[_0x2ccb('0x34')](_0x4e28da[_0x2ccb('0x33')]);_0x5c65de[_0x2ccb('0x3d')]=_[_0x2ccb('0x35')](_0x5c65de[_0x2ccb('0x32')],_0x5c65de[_0x2ccb('0x33')]);_0x42a413[_0x2ccb('0x37')]=_[_0x2ccb('0x35')](_0x5c65de['model'],qs[_0x2ccb('0x36')](_0x4e28da[_0x2ccb('0x33')][_0x2ccb('0x36')]));_0x42a413['attributes']=_0x42a413['attributes']['length']?_0x42a413[_0x2ccb('0x37')]:_0x5c65de[_0x2ccb('0x32')];if(_0x4e28da[_0x2ccb('0x33')][_0x2ccb('0x42')]){_0x42a413[_0x2ccb('0x43')]=[{'all':!![]}];}_0x42a413=_['merge']({},_0x42a413,_0x4e28da[_0x2ccb('0x41')]);return db[_0x2ccb('0x2d')][_0x2ccb('0x47')](_0x42a413)[_0x2ccb('0x26')](handleEntityNotFound(_0x3cb124,null))[_0x2ccb('0x26')](respondWithResult(_0x3cb124,null))['catch'](handleError(_0x3cb124,null));};exports['create']=function(_0x51d1e4,_0x540e8c){return db[_0x2ccb('0x2d')]['create'](_0x51d1e4[_0x2ccb('0x48')],{})[_0x2ccb('0x26')](respondWithResult(_0x540e8c,0xc9))['catch'](handleError(_0x540e8c,null));};exports[_0x2ccb('0x24')]=function(_0x12e4ce,_0x1daa29){if(_0x12e4ce[_0x2ccb('0x48')]['id']){delete _0x12e4ce[_0x2ccb('0x48')]['id'];}return db['VoiceDialReport'][_0x2ccb('0x47')]({'where':{'id':_0x12e4ce['params']['id']}})['then'](handleEntityNotFound(_0x1daa29,null))[_0x2ccb('0x26')](saveUpdates(_0x12e4ce[_0x2ccb('0x48')],null))['then'](respondWithResult(_0x1daa29,null))['catch'](handleError(_0x1daa29,null));};exports[_0x2ccb('0x25')]=function(_0x19c6ee,_0x1a2dcf){return db[_0x2ccb('0x2d')][_0x2ccb('0x47')]({'where':{'id':_0x19c6ee[_0x2ccb('0x46')]['id']}})[_0x2ccb('0x26')](handleEntityNotFound(_0x1a2dcf,null))[_0x2ccb('0x26')](removeEntity(_0x1a2dcf,null))[_0x2ccb('0x49')](handleError(_0x1a2dcf,null));};exports['describe']=function(_0x2c1985,_0xd394ae){return db[_0x2ccb('0x2d')][_0x2ccb('0x4a')]()[_0x2ccb('0x26')](respondWithResult(_0xd394ae,null))['catch'](handleError(_0xd394ae,null));}; \ No newline at end of file +var _0xe32c=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','destroy','error','stack','name','map','VoiceDialReport','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','rows','catch','params','fields','include','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xe32c,0x154));var _0xce32=function(_0x58381c,_0x3b9374){_0x58381c=_0x58381c-0x0;var _0x1a7440=_0xe32c[_0x58381c];return _0x1a7440;};'use strict';var emlformat=require(_0xce32('0x0'));var rimraf=require(_0xce32('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xce32('0x2'));var rp=require(_0xce32('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xce32('0x4'));var util=require(_0xce32('0x5'));var path=require(_0xce32('0x6'));var sox=require(_0xce32('0x7'));var csv=require(_0xce32('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xce32('0x9'));var crypto=require(_0xce32('0xa'));var jsforce=require(_0xce32('0xb'));var deskjs=require(_0xce32('0xc'));var toCsv=require('to-csv');var querystring=require(_0xce32('0xd'));var Papa=require(_0xce32('0xe'));var Redis=require(_0xce32('0xf'));var authService=require(_0xce32('0x10'));var qs=require(_0xce32('0x11'));var as=require(_0xce32('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xce32('0x13'))(_0xce32('0x14'));var utils=require(_0xce32('0x15'));var config=require(_0xce32('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xce32('0x17'))['db'];function respondWithStatusCode(_0x1636ca,_0x599083){_0x599083=_0x599083||0xcc;return function(_0xb655a0){if(_0xb655a0){return _0x1636ca[_0xce32('0x18')](_0x599083);}return _0x1636ca[_0xce32('0x19')](_0x599083)[_0xce32('0x1a')]();};}function respondWithResult(_0x4a812d,_0x23ba61){_0x23ba61=_0x23ba61||0xc8;return function(_0x4da043){if(_0x4da043){return _0x4a812d[_0xce32('0x19')](_0x23ba61)[_0xce32('0x1b')](_0x4da043);}};}function respondWithFilteredResult(_0x159075,_0x53bd1d){return function(_0x11f48f){if(_0x11f48f){var _0x428f0b=typeof _0x53bd1d[_0xce32('0x1c')]===_0xce32('0x1d')&&typeof _0x53bd1d[_0xce32('0x1e')]===_0xce32('0x1d');var _0x4317d6=_0x11f48f[_0xce32('0x1f')];var _0x29f05b=_0x428f0b?0x0:_0x53bd1d[_0xce32('0x1c')];var _0x2a281f=_0x428f0b?_0x11f48f['count']:_0x53bd1d['offset']+_0x53bd1d[_0xce32('0x1e')];var _0x546040;if(_0x2a281f>=_0x4317d6){_0x2a281f=_0x4317d6;_0x546040=0xc8;}else{_0x546040=0xce;}_0x159075[_0xce32('0x19')](_0x546040);return _0x159075[_0xce32('0x20')]('Content-Range',_0x29f05b+'-'+_0x2a281f+'/'+_0x4317d6)[_0xce32('0x1b')](_0x11f48f);}return null;};}function patchUpdates(_0x1faf54){return function(_0x223ded){try{jsonpatch['apply'](_0x223ded,_0x1faf54,!![]);}catch(_0x524641){return BPromise['reject'](_0x524641);}return _0x223ded['save']();};}function saveUpdates(_0x4069ca,_0x2a76d2){return function(_0x114c7f){if(_0x114c7f){return _0x114c7f[_0xce32('0x21')](_0x4069ca)[_0xce32('0x22')](function(_0x10d8bc){return _0x10d8bc;});}return null;};}function removeEntity(_0x32a741,_0x130a52){return function(_0x368f2d){if(_0x368f2d){return _0x368f2d[_0xce32('0x23')]()['then'](function(){_0x32a741[_0xce32('0x19')](0xcc)[_0xce32('0x1a')]();});}};}function handleEntityNotFound(_0xc52355,_0x337ddc){return function(_0x3f7feb){if(!_0x3f7feb){_0xc52355['sendStatus'](0x194);}return _0x3f7feb;};}function handleError(_0x3faab7,_0x1c67c6){_0x1c67c6=_0x1c67c6||0x1f4;return function(_0x1642a9){logger[_0xce32('0x24')](_0x1642a9[_0xce32('0x25')]);if(_0x1642a9[_0xce32('0x26')]){delete _0x1642a9['name'];}_0x3faab7[_0xce32('0x19')](_0x1c67c6)['send'](_0x1642a9);};}exports['index']=function(_0x46b6c0,_0x45b5ba){var _0x4cfc69={},_0x423129={},_0x397c4e={'count':0x0,'rows':[]};var _0x10b3d5=_[_0xce32('0x27')](db[_0xce32('0x28')][_0xce32('0x29')],function(_0x196672){return{'name':_0x196672[_0xce32('0x2a')],'type':_0x196672['type'][_0xce32('0x2b')]};});_0x423129['model']=_[_0xce32('0x27')](_0x10b3d5,_0xce32('0x26'));_0x423129[_0xce32('0x2c')]=_[_0xce32('0x2d')](_0x46b6c0[_0xce32('0x2c')]);_0x423129[_0xce32('0x2e')]=_[_0xce32('0x2f')](_0x423129['model'],_0x423129[_0xce32('0x2c')]);_0x4cfc69[_0xce32('0x30')]=_['intersection'](_0x423129[_0xce32('0x31')],qs['fields'](_0x46b6c0['query']['fields']));_0x4cfc69[_0xce32('0x30')]=_0x4cfc69[_0xce32('0x30')][_0xce32('0x32')]?_0x4cfc69[_0xce32('0x30')]:_0x423129[_0xce32('0x31')];if(!_0x46b6c0[_0xce32('0x2c')][_0xce32('0x33')](_0xce32('0x34'))){_0x4cfc69[_0xce32('0x1e')]=qs[_0xce32('0x1e')](_0x46b6c0[_0xce32('0x2c')]['limit']);_0x4cfc69[_0xce32('0x1c')]=qs[_0xce32('0x1c')](_0x46b6c0['query'][_0xce32('0x1c')]);}_0x4cfc69[_0xce32('0x35')]=qs['sort'](_0x46b6c0[_0xce32('0x2c')][_0xce32('0x36')]);_0x4cfc69[_0xce32('0x37')]=qs['filters'](_['pick'](_0x46b6c0[_0xce32('0x2c')],_0x423129[_0xce32('0x2e')]),_0x10b3d5);if(_0x46b6c0[_0xce32('0x2c')]['filter']){_0x4cfc69[_0xce32('0x37')]=_[_0xce32('0x38')](_0x4cfc69[_0xce32('0x37')],{'$or':_['map'](_0x10b3d5,function(_0x5591e1){if(_0x5591e1[_0xce32('0x39')]!==_0xce32('0x3a')){var _0x488320={};_0x488320[_0x5591e1[_0xce32('0x26')]]={'$like':'%'+_0x46b6c0[_0xce32('0x2c')][_0xce32('0x3b')]+'%'};return _0x488320;}})});}_0x4cfc69=_[_0xce32('0x38')]({},_0x4cfc69,_0x46b6c0[_0xce32('0x3c')]);var _0x3cc4ca={'where':_0x4cfc69['where']};return db[_0xce32('0x28')][_0xce32('0x1f')](_0x3cc4ca)[_0xce32('0x22')](function(_0x36ff4e){_0x397c4e[_0xce32('0x1f')]=_0x36ff4e;if(_0x46b6c0['query'][_0xce32('0x3d')]){_0x4cfc69['include']=[{'all':!![]}];}return db[_0xce32('0x28')]['findAll'](_0x4cfc69);})[_0xce32('0x22')](function(_0x1e6c98){_0x397c4e[_0xce32('0x3e')]=_0x1e6c98;return _0x397c4e;})[_0xce32('0x22')](respondWithFilteredResult(_0x45b5ba,_0x4cfc69))[_0xce32('0x3f')](handleError(_0x45b5ba,null));};exports['show']=function(_0x45c958,_0x21d0c1){var _0x328e99={'raw':!![],'where':{'id':_0x45c958[_0xce32('0x40')]['id']}},_0x15f2dd={};_0x15f2dd[_0xce32('0x31')]=_[_0xce32('0x2d')](db[_0xce32('0x28')][_0xce32('0x29')]);_0x15f2dd[_0xce32('0x2c')]=_[_0xce32('0x2d')](_0x45c958[_0xce32('0x2c')]);_0x15f2dd[_0xce32('0x2e')]=_[_0xce32('0x2f')](_0x15f2dd['model'],_0x15f2dd[_0xce32('0x2c')]);_0x328e99['attributes']=_['intersection'](_0x15f2dd[_0xce32('0x31')],qs[_0xce32('0x41')](_0x45c958[_0xce32('0x2c')]['fields']));_0x328e99[_0xce32('0x30')]=_0x328e99['attributes'][_0xce32('0x32')]?_0x328e99[_0xce32('0x30')]:_0x15f2dd['model'];if(_0x45c958[_0xce32('0x2c')][_0xce32('0x3d')]){_0x328e99[_0xce32('0x42')]=[{'all':!![]}];}_0x328e99=_['merge']({},_0x328e99,_0x45c958[_0xce32('0x3c')]);return db[_0xce32('0x28')][_0xce32('0x43')](_0x328e99)['then'](handleEntityNotFound(_0x21d0c1,null))[_0xce32('0x22')](respondWithResult(_0x21d0c1,null))[_0xce32('0x3f')](handleError(_0x21d0c1,null));};exports[_0xce32('0x44')]=function(_0xde899b,_0x1a9653){return db[_0xce32('0x28')][_0xce32('0x44')](_0xde899b['body'],{})['then'](respondWithResult(_0x1a9653,0xc9))[_0xce32('0x3f')](handleError(_0x1a9653,null));};exports[_0xce32('0x21')]=function(_0x50e5e5,_0x4da28e){if(_0x50e5e5[_0xce32('0x45')]['id']){delete _0x50e5e5[_0xce32('0x45')]['id'];}return db[_0xce32('0x28')][_0xce32('0x43')]({'where':{'id':_0x50e5e5['params']['id']}})[_0xce32('0x22')](handleEntityNotFound(_0x4da28e,null))[_0xce32('0x22')](saveUpdates(_0x50e5e5[_0xce32('0x45')],null))[_0xce32('0x22')](respondWithResult(_0x4da28e,null))['catch'](handleError(_0x4da28e,null));};exports[_0xce32('0x23')]=function(_0x3f73cc,_0x35922a){return db[_0xce32('0x28')][_0xce32('0x43')]({'where':{'id':_0x3f73cc['params']['id']}})['then'](handleEntityNotFound(_0x35922a,null))[_0xce32('0x22')](removeEntity(_0x35922a,null))[_0xce32('0x3f')](handleError(_0x35922a,null));};exports['describe']=function(_0x154b2b,_0x5dc55f){return db[_0xce32('0x28')][_0xce32('0x46')]()[_0xce32('0x22')](respondWithResult(_0x5dc55f,null))[_0xce32('0x3f')](handleError(_0x5dc55f,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 337e756..160ad33 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 _0x8bb6=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','VoiceDialReport','report_dial','uniqueid','lodash'];(function(_0x10a904,_0x2bf292){var _0x53815a=function(_0x2e6ce4){while(--_0x2e6ce4){_0x10a904['push'](_0x10a904['shift']());}};_0x53815a(++_0x2bf292);}(_0x8bb6,0x16b));var _0x68bb=function(_0x1300ec,_0x3ff267){_0x1300ec=_0x1300ec-0x0;var _0x2c13c9=_0x8bb6[_0x1300ec];return _0x2c13c9;};'use strict';var _=require(_0x68bb('0x0'));var util=require(_0x68bb('0x1'));var logger=require('../../config/logger')(_0x68bb('0x2'));var moment=require(_0x68bb('0x3'));var BPromise=require(_0x68bb('0x4'));var rp=require(_0x68bb('0x5'));var fs=require('fs');var path=require(_0x68bb('0x6'));var rimraf=require(_0x68bb('0x7'));var config=require(_0x68bb('0x8'));var attributes=require(_0x68bb('0x9'));module[_0x68bb('0xa')]=function(_0x1c78f2,_0x2b39b6){return _0x1c78f2['define'](_0x68bb('0xb'),attributes,{'tableName':_0x68bb('0xc'),'paranoid':![],'indexes':[{'fields':[_0x68bb('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe559=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceDialReport.attributes','define','VoiceDialReport'];(function(_0x4d5ae5,_0x57cf55){var _0xba4425=function(_0x3b655a){while(--_0x3b655a){_0x4d5ae5['push'](_0x4d5ae5['shift']());}};_0xba4425(++_0x57cf55);}(_0xe559,0x176));var _0x9e55=function(_0x32a789,_0x34aad4){_0x32a789=_0x32a789-0x0;var _0x1d1270=_0xe559[_0x32a789];return _0x1d1270;};'use strict';var _=require('lodash');var util=require(_0x9e55('0x0'));var logger=require(_0x9e55('0x1'))(_0x9e55('0x2'));var moment=require(_0x9e55('0x3'));var BPromise=require(_0x9e55('0x4'));var rp=require(_0x9e55('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9e55('0x6'));var config=require(_0x9e55('0x7'));var attributes=require(_0x9e55('0x8'));module['exports']=function(_0x27f94e,_0xb35340){return _0x27f94e[_0x9e55('0x9')](_0x9e55('0xa'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 86a778e..ea42464 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 _0x727c=['client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateVoiceDialReport','VoiceDialReport','body','options','raw','stringify','UpdateVoiceDialReport','update','where','attributes','limit','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x5ededf,_0x3d5733){var _0xc81eb7=function(_0x17ca5f){while(--_0x17ca5f){_0x5ededf['push'](_0x5ededf['shift']());}};_0xc81eb7(++_0x3d5733);}(_0x727c,0x129));var _0xc727=function(_0x19a7d3,_0x487155){_0x19a7d3=_0x19a7d3-0x0;var _0x569a8e=_0x727c[_0x19a7d3];return _0x569a8e;};'use strict';var _=require(_0xc727('0x0'));var util=require(_0xc727('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc727('0x2'));var fs=require('fs');var Redis=require(_0xc727('0x3'));var db=require(_0xc727('0x4'))['db'];var utils=require(_0xc727('0x5'));var logger=require(_0xc727('0x6'))('rpc');var config=require(_0xc727('0x7'));var jayson=require(_0xc727('0x8'));var client=jayson[_0xc727('0x9')][_0xc727('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11d18f,_0x41d7a7,_0x5d3399){return new BPromise(function(_0x342c42,_0x252fbb){return client[_0xc727('0xb')](_0x11d18f,_0x5d3399)[_0xc727('0xc')](function(_0x1e8315){logger[_0xc727('0xd')](_0xc727('0xe'),_0x41d7a7,_0xc727('0xf'));logger[_0xc727('0x10')](_0xc727('0x11'),_0x41d7a7,'request\x20sent',JSON['stringify'](_0x1e8315));if(_0x1e8315[_0xc727('0x12')]){if(_0x1e8315[_0xc727('0x12')][_0xc727('0x13')]===0x1f4){logger[_0xc727('0x12')](_0xc727('0xe'),_0x41d7a7,_0x1e8315['error']['message']);return _0x252fbb(_0x1e8315[_0xc727('0x12')]['message']);}logger['error'](_0xc727('0xe'),_0x41d7a7,_0x1e8315[_0xc727('0x12')][_0xc727('0x14')]);return _0x342c42(_0x1e8315[_0xc727('0x12')][_0xc727('0x14')]);}else{logger[_0xc727('0xd')](_0xc727('0xe'),_0x41d7a7,_0xc727('0xf'));_0x342c42(_0x1e8315[_0xc727('0x15')][_0xc727('0x14')]);}})['catch'](function(_0x4e9d34){logger[_0xc727('0x12')](_0xc727('0xe'),_0x41d7a7,_0x4e9d34);_0x252fbb(_0x4e9d34);});});}exports[_0xc727('0x16')]=function(_0x1cf005){var _0x249b61=this;return new Promise(function(_0x18b58e,_0x140338){return db[_0xc727('0x17')]['create'](_0x1cf005[_0xc727('0x18')],{'raw':_0x1cf005[_0xc727('0x19')]?_0x1cf005[_0xc727('0x19')][_0xc727('0x1a')]===undefined?!![]:![]:!![]})[_0xc727('0xc')](function(_0x56b3b7){logger[_0xc727('0xd')]('CreateVoiceDialReport',_0x1cf005);logger[_0xc727('0x10')](_0xc727('0x16'),_0x1cf005,JSON[_0xc727('0x1b')](_0x56b3b7));_0x18b58e(_0x56b3b7);})['catch'](function(_0x503631){logger[_0xc727('0x12')]('CreateVoiceDialReport',_0x503631[_0xc727('0x14')],_0x1cf005);_0x140338(_0x249b61[_0xc727('0x12')](0x1f4,_0x503631[_0xc727('0x14')]));});});};exports[_0xc727('0x1c')]=function(_0x1b5f13){var _0x349edb=this;return new Promise(function(_0x406797,_0x382cf5){return db[_0xc727('0x17')][_0xc727('0x1d')](_0x1b5f13['body'],{'raw':_0x1b5f13[_0xc727('0x19')]?_0x1b5f13[_0xc727('0x19')][_0xc727('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b5f13[_0xc727('0x19')]?_0x1b5f13['options'][_0xc727('0x1e')]||null:null,'attributes':_0x1b5f13['options']?_0x1b5f13['options'][_0xc727('0x1f')]||null:null,'limit':_0x1b5f13[_0xc727('0x19')]?_0x1b5f13['options'][_0xc727('0x20')]||null:null})[_0xc727('0xc')](function(_0x1c10c9){logger[_0xc727('0xd')](_0xc727('0x1c'),_0x1b5f13);logger[_0xc727('0x10')](_0xc727('0x1c'),_0x1b5f13,JSON[_0xc727('0x1b')](_0x1c10c9));_0x406797(_0x1c10c9);})[_0xc727('0x21')](function(_0x56be91){logger[_0xc727('0x12')](_0xc727('0x1c'),_0x56be91[_0xc727('0x14')],_0x1b5f13);_0x382cf5(_0x349edb[_0xc727('0x12')](0x1f4,_0x56be91[_0xc727('0x14')]));});});}; \ No newline at end of file +var _0xba99=['VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','body','options','raw','CreateVoiceDialReport','debug','UpdateVoiceDialReport','VoiceDialReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x34527c,_0x2576eb){var _0x839733=function(_0x34cf37){while(--_0x34cf37){_0x34527c['push'](_0x34527c['shift']());}};_0x839733(++_0x2576eb);}(_0xba99,0x187));var _0x9ba9=function(_0x1dbec0,_0x597dd7){_0x1dbec0=_0x1dbec0-0x0;var _0xc0e834=_0xba99[_0x1dbec0];return _0xc0e834;};'use strict';var _=require(_0x9ba9('0x0'));var util=require(_0x9ba9('0x1'));var moment=require(_0x9ba9('0x2'));var BPromise=require(_0x9ba9('0x3'));var rs=require(_0x9ba9('0x4'));var fs=require('fs');var Redis=require(_0x9ba9('0x5'));var db=require(_0x9ba9('0x6'))['db'];var utils=require(_0x9ba9('0x7'));var logger=require(_0x9ba9('0x8'))(_0x9ba9('0x9'));var config=require(_0x9ba9('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x9ba9('0xb')][_0x9ba9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x54d969,_0x41fbfd,_0x37c425){return new BPromise(function(_0x519c0f,_0x4f999a){return client[_0x9ba9('0xd')](_0x54d969,_0x37c425)[_0x9ba9('0xe')](function(_0x3a4970){logger[_0x9ba9('0xf')](_0x9ba9('0x10'),_0x41fbfd,_0x9ba9('0x11'));logger['debug'](_0x9ba9('0x12'),_0x41fbfd,_0x9ba9('0x11'),JSON[_0x9ba9('0x13')](_0x3a4970));if(_0x3a4970[_0x9ba9('0x14')]){if(_0x3a4970[_0x9ba9('0x14')][_0x9ba9('0x15')]===0x1f4){logger[_0x9ba9('0x14')]('VoiceDialReport,\x20%s,\x20%s',_0x41fbfd,_0x3a4970[_0x9ba9('0x14')]['message']);return _0x4f999a(_0x3a4970[_0x9ba9('0x14')][_0x9ba9('0x16')]);}logger[_0x9ba9('0x14')](_0x9ba9('0x10'),_0x41fbfd,_0x3a4970['error'][_0x9ba9('0x16')]);return _0x519c0f(_0x3a4970['error'][_0x9ba9('0x16')]);}else{logger[_0x9ba9('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x41fbfd,_0x9ba9('0x11'));_0x519c0f(_0x3a4970[_0x9ba9('0x17')][_0x9ba9('0x16')]);}})[_0x9ba9('0x18')](function(_0x4206d4){logger['error'](_0x9ba9('0x10'),_0x41fbfd,_0x4206d4);_0x4f999a(_0x4206d4);});});}exports['CreateVoiceDialReport']=function(_0xdaadcb){var _0x2ba9b3=this;return new Promise(function(_0x31e43b,_0x490cb4){return db['VoiceDialReport'][_0x9ba9('0x19')](_0xdaadcb[_0x9ba9('0x1a')],{'raw':_0xdaadcb[_0x9ba9('0x1b')]?_0xdaadcb[_0x9ba9('0x1b')][_0x9ba9('0x1c')]===undefined?!![]:![]:!![]})[_0x9ba9('0xe')](function(_0x2ac113){logger[_0x9ba9('0xf')](_0x9ba9('0x1d'),_0xdaadcb);logger[_0x9ba9('0x1e')]('CreateVoiceDialReport',_0xdaadcb,JSON['stringify'](_0x2ac113));_0x31e43b(_0x2ac113);})[_0x9ba9('0x18')](function(_0x20b4a9){logger[_0x9ba9('0x14')](_0x9ba9('0x1d'),_0x20b4a9['message'],_0xdaadcb);_0x490cb4(_0x2ba9b3[_0x9ba9('0x14')](0x1f4,_0x20b4a9[_0x9ba9('0x16')]));});});};exports[_0x9ba9('0x1f')]=function(_0x3b0486){var _0x91bc23=this;return new Promise(function(_0x287c6c,_0x4f0688){return db[_0x9ba9('0x20')][_0x9ba9('0x21')](_0x3b0486['body'],{'raw':_0x3b0486[_0x9ba9('0x1b')]?_0x3b0486[_0x9ba9('0x1b')][_0x9ba9('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b0486[_0x9ba9('0x1b')]?_0x3b0486[_0x9ba9('0x1b')][_0x9ba9('0x22')]||null:null,'attributes':_0x3b0486[_0x9ba9('0x1b')]?_0x3b0486[_0x9ba9('0x1b')][_0x9ba9('0x23')]||null:null,'limit':_0x3b0486[_0x9ba9('0x1b')]?_0x3b0486[_0x9ba9('0x1b')][_0x9ba9('0x24')]||null:null})[_0x9ba9('0xe')](function(_0xfe56e6){logger[_0x9ba9('0xf')](_0x9ba9('0x1f'),_0x3b0486);logger[_0x9ba9('0x1e')](_0x9ba9('0x1f'),_0x3b0486,JSON[_0x9ba9('0x13')](_0xfe56e6));_0x287c6c(_0xfe56e6);})[_0x9ba9('0x18')](function(_0x659ebe){logger[_0x9ba9('0x14')](_0x9ba9('0x1f'),_0x659ebe[_0x9ba9('0x16')],_0x3b0486);_0x4f0688(_0x91bc23[_0x9ba9('0x14')](0x1f4,_0x659ebe[_0x9ba9('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 3d9d66f..33896ef 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 _0xfee5=['../../components/interaction/service','../../config/environment','./voiceExtension.controller','isAuthenticated','index','/:id','show','post','create','/:id/applications','addApplications','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4dc392,_0x255362){var _0x4e45ad=function(_0x1d932d){while(--_0x1d932d){_0x4dc392['push'](_0x4dc392['shift']());}};_0x4e45ad(++_0x255362);}(_0xfee5,0x189));var _0x5fee=function(_0x3934e2,_0x2dc66b){_0x3934e2=_0x3934e2-0x0;var _0x35b87c=_0xfee5[_0x3934e2];return _0x35b87c;};'use strict';var multer=require('multer');var util=require(_0x5fee('0x0'));var path=require(_0x5fee('0x1'));var timeout=require(_0x5fee('0x2'));var express=require(_0x5fee('0x3'));var router=express[_0x5fee('0x4')]();var fs_extra=require(_0x5fee('0x5'));var auth=require(_0x5fee('0x6'));var interaction=require(_0x5fee('0x7'));var config=require(_0x5fee('0x8'));var controller=require(_0x5fee('0x9'));router['get']('/',auth[_0x5fee('0xa')](),controller[_0x5fee('0xb')]);router['get'](_0x5fee('0xc'),auth['isAuthenticated'](),controller[_0x5fee('0xd')]);router[_0x5fee('0xe')]('/',auth['isAuthenticated'](),controller[_0x5fee('0xf')]);router[_0x5fee('0xe')](_0x5fee('0x10'),auth[_0x5fee('0xa')](),controller[_0x5fee('0x11')]);router['put'](_0x5fee('0xc'),auth[_0x5fee('0xa')](),controller['update']);router[_0x5fee('0x12')](_0x5fee('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x5fee('0x13')]=router; \ No newline at end of file +var _0x0df5=['post','/:id/applications','addApplications','put','delete','exports','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x0df5,0x1e2));var _0x50df=function(_0x2626f1,_0x2ad8b0){_0x2626f1=_0x2626f1-0x0;var _0x1ebb05=_0x0df5[_0x2626f1];return _0x1ebb05;};'use strict';var multer=require('multer');var util=require(_0x50df('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x50df('0x1'));var router=express['Router']();var fs_extra=require(_0x50df('0x2'));var auth=require(_0x50df('0x3'));var interaction=require(_0x50df('0x4'));var config=require(_0x50df('0x5'));var controller=require('./voiceExtension.controller');router[_0x50df('0x6')]('/',auth[_0x50df('0x7')](),controller[_0x50df('0x8')]);router[_0x50df('0x6')](_0x50df('0x9'),auth[_0x50df('0x7')](),controller[_0x50df('0xa')]);router[_0x50df('0xb')]('/',auth[_0x50df('0x7')](),controller['create']);router[_0x50df('0xb')](_0x50df('0xc'),auth['isAuthenticated'](),controller[_0x50df('0xd')]);router[_0x50df('0xe')](_0x50df('0x9'),auth[_0x50df('0x7')](),controller['update']);router[_0x50df('0xf')](_0x50df('0x9'),auth[_0x50df('0x7')](),controller['destroy']);module[_0x50df('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 464c15e..1ab6caf 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 _0xfa8b=['compositeIndex','ENUM','outbound','internal','inbound-fax','system','any','INTEGER','BOOLEAN','wav','getDataValue','exten','exports','STRING'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xfa8b,0x1be));var _0xbfa8=function(_0x406472,_0x233473){_0x406472=_0x406472-0x0;var _0x2eff79=_0xfa8b[_0x406472];return _0x2eff79;};'use strict';var Sequelize=require('sequelize');module[_0xbfa8('0x0')]={'context':{'type':Sequelize[_0xbfa8('0x1')],'allowNull':![],'unique':_0xbfa8('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0xbfa8('0x1')],'allowNull':![],'defaultValue':'1','unique':_0xbfa8('0x2')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xbfa8('0x1')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0xbfa8('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xbfa8('0x3')]('inbound',_0xbfa8('0x4'),_0xbfa8('0x5'),_0xbfa8('0x6'),'outbound-fax',_0xbfa8('0x7'),_0xbfa8('0x8')),'allowNull':![]},'description':{'type':Sequelize[_0xbfa8('0x1')]},'interval':{'type':Sequelize[_0xbfa8('0x1')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0xbfa8('0x9')]},'isApp':{'type':Sequelize[_0xbfa8('0xa')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xbfa8('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0xbfa8('0x1')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xbfa8('0x9')]},'recordingFormat':{'type':Sequelize[_0xbfa8('0x1')],'defaultValue':_0xbfa8('0xb')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x4879c5){return this[_0xbfa8('0xc')](_0xbfa8('0xd'));}},'alias':{'type':Sequelize[_0xbfa8('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x4f9d=['VIRTUAL','getDataValue','exten','sequelize','exports','compositeIndex','STRING','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav'];(function(_0x3b6502,_0x152883){var _0x216fc9=function(_0x2babe1){while(--_0x2babe1){_0x3b6502['push'](_0x3b6502['shift']());}};_0x216fc9(++_0x152883);}(_0x4f9d,0x88));var _0xd4f9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4f9d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd4f9('0x0'));module[_0xd4f9('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd4f9('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xd4f9('0x3')],'allowNull':![],'unique':_0xd4f9('0x2')},'priority':{'type':Sequelize[_0xd4f9('0x3')],'allowNull':![],'defaultValue':'1','unique':_0xd4f9('0x2')},'tag':{'type':Sequelize[_0xd4f9('0x3')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xd4f9('0x3')],'allowNull':![],'defaultValue':_0xd4f9('0x4')},'appdata':{'type':Sequelize[_0xd4f9('0x3')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xd4f9('0x5')](_0xd4f9('0x6'),_0xd4f9('0x7'),_0xd4f9('0x8'),_0xd4f9('0x9'),_0xd4f9('0xa'),'system',_0xd4f9('0xb')),'allowNull':![]},'description':{'type':Sequelize[_0xd4f9('0x3')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd4f9('0xc')},'IntervalId':{'type':Sequelize[_0xd4f9('0xd')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xd4f9('0x3')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0xd4f9('0xe')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xd4f9('0xd')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0xd4f9('0xf')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0xd4f9('0x10')],'get':function(_0x198b0c){return this[_0xd4f9('0x11')](_0xd4f9('0x12'));}},'alias':{'type':Sequelize[_0xd4f9('0x3')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index e550161..3eea420 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 _0x58e5=['sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','body','startsWith','exten','concat','create','user','internal','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','recordingFormat','cutdigits','mandatoryDisposition','addApplications','findOne','sequelize','transaction','VoiceExtensionId','isApp','createRouting','LOG\x20~\x20.then\x20~\x20routing','cast(priority\x20as\x20unsigned)','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','register','status','json','undefined','limit','offset','count','set','Content-Range','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','filter','ignore','map','value','includes','type','find','name','UserProfileResource','end','sendStatus','stack','VoiceExtension','fieldName','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x58e5,0xd1));var _0x558e=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0x58e5[_0x28aea5];return _0x6a55f9;};'use strict';var _=require(_0x558e('0x0'));var Redis=require(_0x558e('0x1'));var qs=require(_0x558e('0x2'));var logger=require(_0x558e('0x3'))(_0x558e('0x4'));var config=require(_0x558e('0x5'));var db=require('../../mysqldb')['db'];config[_0x558e('0x6')]=_['defaults'](config['redis'],{'host':_0x558e('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x558e('0x6')]));require('./voiceExtension.socket')[_0x558e('0x8')](socket);function respondWithStatusCode(_0xdf6e1e,_0x533a69){_0x533a69=_0x533a69||0xcc;return function(_0x58c368){if(_0x58c368){return _0xdf6e1e['sendStatus'](_0x533a69);}return _0xdf6e1e['status'](_0x533a69)['end']();};}function respondWithResult(_0x29c7ac,_0x8b89a){_0x8b89a=_0x8b89a||0xc8;return function(_0x5d1e17){if(_0x5d1e17){return _0x29c7ac[_0x558e('0x9')](_0x8b89a)[_0x558e('0xa')](_0x5d1e17);}};}function respondWithFilteredResult(_0x12be93,_0x10e25c){return function(_0x49a166){if(_0x49a166){var _0x163783=typeof _0x10e25c['offset']===_0x558e('0xb')&&typeof _0x10e25c[_0x558e('0xc')]===_0x558e('0xb');var _0x3bd154=_0x49a166['count'];var _0x407afd=_0x163783?0x0:_0x10e25c[_0x558e('0xd')];var _0x519a4d=_0x163783?_0x49a166[_0x558e('0xe')]:_0x10e25c[_0x558e('0xd')]+_0x10e25c['limit'];var _0x23d153;if(_0x519a4d>=_0x3bd154){_0x519a4d=_0x3bd154;_0x23d153=0xc8;}else{_0x23d153=0xce;}_0x12be93['status'](_0x23d153);return _0x12be93[_0x558e('0xf')](_0x558e('0x10'),_0x407afd+'-'+_0x519a4d+'/'+_0x3bd154)['json'](_0x49a166);}return null;};}function removeEntity(_0x21552c){return function(_0x110094){if(_0x110094){return _0x110094[_0x558e('0x11')]()[_0x558e('0x12')](function(){var _0x4c8ffb=_0x110094[_0x558e('0x13')]({'plain':!![]});var _0x120be6=[{'name':_0x558e('0x14'),'value':_0x558e('0x15'),'ignore':![]},{'name':_0x558e('0x16'),'value':_0x558e('0x17'),'ignore':![]},{'name':_0x558e('0x18'),'value':'internal','ignore':![]}];var _0x4afcfe=_(_0x120be6)[_0x558e('0x19')](_0x558e('0x1a'))[_0x558e('0x1b')](_0x558e('0x1c'))[_0x558e('0x1c')]();if(_[_0x558e('0x1d')](_0x4afcfe,_0x4c8ffb[_0x558e('0x1e')])){return;}var _0x2e3279=_[_0x558e('0x1f')](_0x120be6,[_0x558e('0x1c'),_0x4c8ffb['type']])[_0x558e('0x20')];return db[_0x558e('0x21')]['destroy']({'where':{'type':_0x2e3279,'resourceId':_0x4c8ffb['id']}})['then'](function(){return _0x110094;});})[_0x558e('0x12')](function(){_0x21552c[_0x558e('0x9')](0xcc)[_0x558e('0x22')]();});}};}function handleEntityNotFound(_0x44b7fe){return function(_0x58beca){if(!_0x58beca){_0x44b7fe[_0x558e('0x23')](0x194);}return _0x58beca;};}function handleError(_0xb9c059,_0x57b569){_0x57b569=_0x57b569||0x1f4;return function(_0x26874d){logger['error'](_0x26874d[_0x558e('0x24')]);if(_0x26874d[_0x558e('0x20')]){delete _0x26874d[_0x558e('0x20')];}_0xb9c059[_0x558e('0x9')](_0x57b569)['send'](_0x26874d);};}exports['index']=function(_0x240e0b,_0x4d1561){var _0x480613={},_0x2dc860={},_0x1d02c5={'count':0x0,'rows':[]};var _0x1112a7=_[_0x558e('0x1b')](db[_0x558e('0x25')]['rawAttributes'],function(_0x2e0166){return{'name':_0x2e0166[_0x558e('0x26')],'type':_0x2e0166[_0x558e('0x1e')]['key']};});_0x2dc860[_0x558e('0x27')]=_[_0x558e('0x1b')](_0x1112a7,_0x558e('0x20'));_0x2dc860[_0x558e('0x28')]=_[_0x558e('0x29')](_0x240e0b[_0x558e('0x28')]);_0x2dc860[_0x558e('0x2a')]=_[_0x558e('0x2b')](_0x2dc860[_0x558e('0x27')],_0x2dc860[_0x558e('0x28')]);_0x480613['attributes']=_[_0x558e('0x2b')](_0x2dc860[_0x558e('0x27')],qs[_0x558e('0x2c')](_0x240e0b[_0x558e('0x28')]['fields']));_0x480613['attributes']=_0x480613[_0x558e('0x2d')][_0x558e('0x2e')]?_0x480613[_0x558e('0x2d')]:_0x2dc860[_0x558e('0x27')];if(!_0x240e0b['query']['hasOwnProperty'](_0x558e('0x2f'))){_0x480613[_0x558e('0xc')]=qs[_0x558e('0xc')](_0x240e0b[_0x558e('0x28')][_0x558e('0xc')]);_0x480613[_0x558e('0xd')]=qs[_0x558e('0xd')](_0x240e0b[_0x558e('0x28')][_0x558e('0xd')]);}_0x480613[_0x558e('0x30')]=qs[_0x558e('0x31')](_0x240e0b['query'][_0x558e('0x31')]);_0x480613[_0x558e('0x32')]=qs['filters'](_['pick'](_0x240e0b['query'],_0x2dc860[_0x558e('0x2a')]),_0x1112a7);if(_0x240e0b[_0x558e('0x28')]['filter']){_0x480613[_0x558e('0x32')]=_[_0x558e('0x33')](_0x480613[_0x558e('0x32')],{'$or':_[_0x558e('0x1b')](_0x1112a7,function(_0x4e16a8){if(_0x4e16a8[_0x558e('0x1e')]!==_0x558e('0x34')){var _0x5614b8={};_0x5614b8[_0x4e16a8['name']]={'$like':'%'+_0x240e0b[_0x558e('0x28')][_0x558e('0x19')]+'%'};return _0x5614b8;}})});}_0x480613=_['merge']({},_0x480613,_0x240e0b[_0x558e('0x35')]);var _0x3f8f91={'where':_0x480613[_0x558e('0x32')]};return db['VoiceExtension'][_0x558e('0xe')](_0x3f8f91)[_0x558e('0x12')](function(_0x133018){_0x1d02c5[_0x558e('0xe')]=_0x133018;if(_0x240e0b[_0x558e('0x28')][_0x558e('0x36')]){_0x480613[_0x558e('0x37')]=[{'all':!![]}];}return db[_0x558e('0x25')][_0x558e('0x38')](_0x480613);})['then'](function(_0x20a1e5){_0x1d02c5[_0x558e('0x39')]=_0x20a1e5;return _0x1d02c5;})[_0x558e('0x12')](respondWithFilteredResult(_0x4d1561,_0x480613))[_0x558e('0x3a')](handleError(_0x4d1561,null));};exports[_0x558e('0x3b')]=function(_0xd61497,_0x8909){var _0x1b8f8b={'raw':![],'where':{'id':_0xd61497[_0x558e('0x3c')]['id']}},_0x347bf6={};_0x347bf6[_0x558e('0x27')]=_[_0x558e('0x29')](db[_0x558e('0x25')]['rawAttributes']);_0x347bf6[_0x558e('0x28')]=_[_0x558e('0x29')](_0xd61497[_0x558e('0x28')]);_0x347bf6['filters']=_[_0x558e('0x2b')](_0x347bf6[_0x558e('0x27')],_0x347bf6[_0x558e('0x28')]);_0x1b8f8b['attributes']=_[_0x558e('0x2b')](_0x347bf6[_0x558e('0x27')],qs[_0x558e('0x2c')](_0xd61497[_0x558e('0x28')][_0x558e('0x2c')]));_0x1b8f8b[_0x558e('0x2d')]=_0x1b8f8b[_0x558e('0x2d')][_0x558e('0x2e')]?_0x1b8f8b[_0x558e('0x2d')]:_0x347bf6[_0x558e('0x27')];if(_0xd61497[_0x558e('0x28')][_0x558e('0x36')]){_0x1b8f8b[_0x558e('0x37')]=[{'all':!![]}];}_0x1b8f8b=_[_0x558e('0x33')]({},_0x1b8f8b,_0xd61497['options']);return db[_0x558e('0x25')][_0x558e('0x1f')](_0x1b8f8b)['then'](handleEntityNotFound(_0x8909,null))[_0x558e('0x12')](respondWithResult(_0x8909,null))['catch'](handleError(_0x8909,null));};exports[_0x558e('0x11')]=function(_0x1ce47c,_0x4474e8){return db[_0x558e('0x25')][_0x558e('0x1f')]({'where':{'id':_0x1ce47c[_0x558e('0x3c')]['id']}})['then'](handleEntityNotFound(_0x4474e8,null))['then'](removeEntity(_0x4474e8,null))['catch'](handleError(_0x4474e8,null));};exports['create']=function(_0x29f92f,_0x10380f){if(_0x29f92f[_0x558e('0x3d')][_0x558e('0x1e')]==='outbound'&&!_[_0x558e('0x3e')](_0x29f92f[_0x558e('0x3d')][_0x558e('0x3f')],'_')){_0x29f92f[_0x558e('0x3d')][_0x558e('0x3f')]='_'[_0x558e('0x40')](_0x29f92f[_0x558e('0x3d')][_0x558e('0x3f')]);}return db['VoiceExtension'][_0x558e('0x41')](_0x29f92f[_0x558e('0x3d')],{'raw':![]})[_0x558e('0x12')](function(_0x4b5353){var _0x1cdaa6=_0x29f92f[_0x558e('0x42')][_0x558e('0x13')]({'plain':!![]});if(!_0x1cdaa6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1cdaa6['role']===_0x558e('0x42')){var _0x4465eb=_0x4b5353[_0x558e('0x13')]({'plain':!![]});var _0xe1d543=[{'name':_0x558e('0x14'),'value':_0x558e('0x15')},{'name':'OutboundRoutes','value':'outbound'},{'name':'InternalRoutes','value':_0x558e('0x43')}];var _0x2822e8=_['find'](_0xe1d543,[_0x558e('0x1c'),_0x4465eb[_0x558e('0x1e')]])[_0x558e('0x20')];return db[_0x558e('0x44')]['find']({'where':{'name':_0x2822e8,'userProfileId':_0x1cdaa6[_0x558e('0x45')]},'raw':!![]})['then'](function(_0x200eb2){if(_0x200eb2&&_0x200eb2[_0x558e('0x46')]===0x0){return db[_0x558e('0x21')][_0x558e('0x41')]({'name':_0x4465eb[_0x558e('0x20')],'resourceId':_0x4465eb['id'],'type':_0x200eb2[_0x558e('0x20')],'sectionId':_0x200eb2['id']},{})[_0x558e('0x12')](function(){return _0x4b5353;});}else{return _0x4b5353;}})[_0x558e('0x3a')](function(_0x45dfcb){logger['error'](_0x558e('0x47'),_0x45dfcb);throw _0x45dfcb;});}return _0x4b5353;})[_0x558e('0x12')](respondWithResult(_0x10380f,0xc9))[_0x558e('0x3a')](handleError(_0x10380f,null));};exports[_0x558e('0x48')]=function(_0x3513da,_0x12b0aa){if(_0x3513da[_0x558e('0x3d')]['id']){delete _0x3513da['body']['id'];}return db['VoiceExtension'][_0x558e('0x1f')]({'where':{'id':_0x3513da[_0x558e('0x3c')]['id']}})[_0x558e('0x12')](handleEntityNotFound(_0x12b0aa,null))[_0x558e('0x12')](function(_0x1fd370){if(_0x1fd370){return db['VoiceExtension'][_0x558e('0x48')](_['pick'](_0x3513da['body'],[_0x558e('0x3f'),_0x558e('0x49'),'description',_0x558e('0x4a'),_0x558e('0x4b'),_0x558e('0x4c'),'alias']),{'where':{'context':_0x1fd370[_0x558e('0x49')],'exten':_0x1fd370[_0x558e('0x3f')]},'individualHooks':!![]})['then'](function(_0x33e67e){return _0x33e67e;});}return null;})[_0x558e('0x12')](respondWithStatusCode(_0x12b0aa,null))['catch'](handleError(_0x12b0aa,null));};exports[_0x558e('0x4d')]=function(_0x30a36b,_0x54e3da){return db[_0x558e('0x25')][_0x558e('0x4e')]({'where':{'id':_0x30a36b[_0x558e('0x3c')]['id']}})[_0x558e('0x12')](function(_0x175540){if(_0x175540){return db[_0x558e('0x4f')][_0x558e('0x50')](function(_0x660ce3){return db[_0x558e('0x25')][_0x558e('0x11')]({'where':{'VoiceExtensionId':_0x30a36b['params']['id']},'transaction':_0x660ce3})[_0x558e('0x12')](function(){var _0x205ae6=_[_0x558e('0x1b')](_0x30a36b[_0x558e('0x3d')],function(_0x519a7b){_0x519a7b[_0x558e('0x51')]=_0x30a36b[_0x558e('0x3c')]['id'];_0x519a7b[_0x558e('0x52')]=!![];return _0x519a7b;});return _0x175540[_0x558e('0x53')](_0x205ae6);})[_0x558e('0x12')](function(_0x4330f1){console['log'](_0x558e('0x54'),_0x4330f1);return db[_0x558e('0x25')]['bulkCreate'](_0x4330f1,{'transaction':_0x660ce3});});})[_0x558e('0x12')](function(){return db[_0x558e('0x25')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x30a36b[_0x558e('0x3c')]['id']},'order':_0x558e('0x55')});});}})[_0x558e('0x12')](respondWithResult(_0x54e3da,null))[_0x558e('0x3a')](handleError(_0x54e3da,null));}; \ No newline at end of file +var _0x7c80=['get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','ignore','includes','type','find','value','name','UserProfileResource','send','map','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','startsWith','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','sequelize','transaction','VoiceExtensionId','isApp','createRouting','log','LOG\x20~\x20.then\x20~\x20routing','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','lodash','ioredis','api','../../config/environment','../../mysqldb','defaults','redis','localhost','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','then'];(function(_0x3a47b1,_0x318a5e){var _0x464796=function(_0x755bd2){while(--_0x755bd2){_0x3a47b1['push'](_0x3a47b1['shift']());}};_0x464796(++_0x318a5e);}(_0x7c80,0xa4));var _0x07c8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c80[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x07c8('0x0'));var Redis=require(_0x07c8('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x07c8('0x2'));var config=require(_0x07c8('0x3'));var db=require(_0x07c8('0x4'))['db'];config['redis']=_[_0x07c8('0x5')](config[_0x07c8('0x6')],{'host':_0x07c8('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x07c8('0x6')]));require('./voiceExtension.socket')['register'](socket);function respondWithStatusCode(_0x204052,_0xc0c7bf){_0xc0c7bf=_0xc0c7bf||0xcc;return function(_0x32d564){if(_0x32d564){return _0x204052[_0x07c8('0x8')](_0xc0c7bf);}return _0x204052[_0x07c8('0x9')](_0xc0c7bf)[_0x07c8('0xa')]();};}function respondWithResult(_0x58ae16,_0x11f91d){_0x11f91d=_0x11f91d||0xc8;return function(_0x5cc84d){if(_0x5cc84d){return _0x58ae16['status'](_0x11f91d)[_0x07c8('0xb')](_0x5cc84d);}};}function respondWithFilteredResult(_0x48aed5,_0x2d51be){return function(_0x59033a){if(_0x59033a){var _0x48ba40=typeof _0x2d51be[_0x07c8('0xc')]===_0x07c8('0xd')&&typeof _0x2d51be[_0x07c8('0xe')]===_0x07c8('0xd');var _0x5c2abf=_0x59033a[_0x07c8('0xf')];var _0x18565b=_0x48ba40?0x0:_0x2d51be[_0x07c8('0xc')];var _0x2370f5=_0x48ba40?_0x59033a['count']:_0x2d51be['offset']+_0x2d51be[_0x07c8('0xe')];var _0x533754;if(_0x2370f5>=_0x5c2abf){_0x2370f5=_0x5c2abf;_0x533754=0xc8;}else{_0x533754=0xce;}_0x48aed5[_0x07c8('0x9')](_0x533754);return _0x48aed5[_0x07c8('0x10')](_0x07c8('0x11'),_0x18565b+'-'+_0x2370f5+'/'+_0x5c2abf)[_0x07c8('0xb')](_0x59033a);}return null;};}function removeEntity(_0x1d6bca){return function(_0xb6b94b){if(_0xb6b94b){return _0xb6b94b[_0x07c8('0x12')]()[_0x07c8('0x13')](function(){var _0x3ef8fb=_0xb6b94b[_0x07c8('0x14')]({'plain':!![]});var _0x41ff02=[{'name':_0x07c8('0x15'),'value':_0x07c8('0x16'),'ignore':![]},{'name':_0x07c8('0x17'),'value':_0x07c8('0x18'),'ignore':![]},{'name':_0x07c8('0x19'),'value':_0x07c8('0x1a'),'ignore':![]}];var _0x12aeb1=_(_0x41ff02)['filter'](_0x07c8('0x1b'))['map']('value')['value']();if(_[_0x07c8('0x1c')](_0x12aeb1,_0x3ef8fb[_0x07c8('0x1d')])){return;}var _0x2750a2=_[_0x07c8('0x1e')](_0x41ff02,[_0x07c8('0x1f'),_0x3ef8fb['type']])[_0x07c8('0x20')];return db[_0x07c8('0x21')][_0x07c8('0x12')]({'where':{'type':_0x2750a2,'resourceId':_0x3ef8fb['id']}})['then'](function(){return _0xb6b94b;});})[_0x07c8('0x13')](function(){_0x1d6bca[_0x07c8('0x9')](0xcc)[_0x07c8('0xa')]();});}};}function handleEntityNotFound(_0x470fe1){return function(_0x15e1bf){if(!_0x15e1bf){_0x470fe1[_0x07c8('0x8')](0x194);}return _0x15e1bf;};}function handleError(_0x4ae36a,_0x265c81){_0x265c81=_0x265c81||0x1f4;return function(_0x550a69){logger['error'](_0x550a69['stack']);if(_0x550a69['name']){delete _0x550a69[_0x07c8('0x20')];}_0x4ae36a[_0x07c8('0x9')](_0x265c81)[_0x07c8('0x22')](_0x550a69);};}exports['index']=function(_0x4ce5da,_0x569886){var _0x13086a={},_0x694f82={},_0x5faab8={'count':0x0,'rows':[]};var _0x6dbc13=_[_0x07c8('0x23')](db[_0x07c8('0x24')][_0x07c8('0x25')],function(_0x5b93c5){return{'name':_0x5b93c5[_0x07c8('0x26')],'type':_0x5b93c5['type'][_0x07c8('0x27')]};});_0x694f82[_0x07c8('0x28')]=_['map'](_0x6dbc13,_0x07c8('0x20'));_0x694f82[_0x07c8('0x29')]=_[_0x07c8('0x2a')](_0x4ce5da[_0x07c8('0x29')]);_0x694f82[_0x07c8('0x2b')]=_[_0x07c8('0x2c')](_0x694f82[_0x07c8('0x28')],_0x694f82[_0x07c8('0x29')]);_0x13086a[_0x07c8('0x2d')]=_[_0x07c8('0x2c')](_0x694f82[_0x07c8('0x28')],qs[_0x07c8('0x2e')](_0x4ce5da[_0x07c8('0x29')][_0x07c8('0x2e')]));_0x13086a[_0x07c8('0x2d')]=_0x13086a[_0x07c8('0x2d')][_0x07c8('0x2f')]?_0x13086a[_0x07c8('0x2d')]:_0x694f82['model'];if(!_0x4ce5da[_0x07c8('0x29')][_0x07c8('0x30')]('nolimit')){_0x13086a[_0x07c8('0xe')]=qs[_0x07c8('0xe')](_0x4ce5da[_0x07c8('0x29')][_0x07c8('0xe')]);_0x13086a[_0x07c8('0xc')]=qs[_0x07c8('0xc')](_0x4ce5da[_0x07c8('0x29')]['offset']);}_0x13086a[_0x07c8('0x31')]=qs[_0x07c8('0x32')](_0x4ce5da[_0x07c8('0x29')][_0x07c8('0x32')]);_0x13086a[_0x07c8('0x33')]=qs[_0x07c8('0x2b')](_[_0x07c8('0x34')](_0x4ce5da[_0x07c8('0x29')],_0x694f82[_0x07c8('0x2b')]),_0x6dbc13);if(_0x4ce5da['query'][_0x07c8('0x35')]){_0x13086a[_0x07c8('0x33')]=_[_0x07c8('0x36')](_0x13086a[_0x07c8('0x33')],{'$or':_[_0x07c8('0x23')](_0x6dbc13,function(_0x19f5c0){if(_0x19f5c0[_0x07c8('0x1d')]!==_0x07c8('0x37')){var _0x4a0d8d={};_0x4a0d8d[_0x19f5c0['name']]={'$like':'%'+_0x4ce5da[_0x07c8('0x29')][_0x07c8('0x35')]+'%'};return _0x4a0d8d;}})});}_0x13086a=_['merge']({},_0x13086a,_0x4ce5da[_0x07c8('0x38')]);var _0x426c55={'where':_0x13086a['where']};return db[_0x07c8('0x24')][_0x07c8('0xf')](_0x426c55)[_0x07c8('0x13')](function(_0x233af2){_0x5faab8[_0x07c8('0xf')]=_0x233af2;if(_0x4ce5da[_0x07c8('0x29')][_0x07c8('0x39')]){_0x13086a[_0x07c8('0x3a')]=[{'all':!![]}];}return db['VoiceExtension'][_0x07c8('0x3b')](_0x13086a);})['then'](function(_0x1eac92){_0x5faab8[_0x07c8('0x3c')]=_0x1eac92;return _0x5faab8;})[_0x07c8('0x13')](respondWithFilteredResult(_0x569886,_0x13086a))[_0x07c8('0x3d')](handleError(_0x569886,null));};exports[_0x07c8('0x3e')]=function(_0x4aff0f,_0x5e88b){var _0x270859={'raw':![],'where':{'id':_0x4aff0f['params']['id']}},_0x3bb4f8={};_0x3bb4f8['model']=_[_0x07c8('0x2a')](db[_0x07c8('0x24')][_0x07c8('0x25')]);_0x3bb4f8[_0x07c8('0x29')]=_['keys'](_0x4aff0f[_0x07c8('0x29')]);_0x3bb4f8[_0x07c8('0x2b')]=_[_0x07c8('0x2c')](_0x3bb4f8[_0x07c8('0x28')],_0x3bb4f8[_0x07c8('0x29')]);_0x270859[_0x07c8('0x2d')]=_[_0x07c8('0x2c')](_0x3bb4f8[_0x07c8('0x28')],qs['fields'](_0x4aff0f['query'][_0x07c8('0x2e')]));_0x270859['attributes']=_0x270859[_0x07c8('0x2d')]['length']?_0x270859[_0x07c8('0x2d')]:_0x3bb4f8['model'];if(_0x4aff0f['query'][_0x07c8('0x39')]){_0x270859[_0x07c8('0x3a')]=[{'all':!![]}];}_0x270859=_[_0x07c8('0x36')]({},_0x270859,_0x4aff0f[_0x07c8('0x38')]);return db[_0x07c8('0x24')][_0x07c8('0x1e')](_0x270859)[_0x07c8('0x13')](handleEntityNotFound(_0x5e88b,null))[_0x07c8('0x13')](respondWithResult(_0x5e88b,null))[_0x07c8('0x3d')](handleError(_0x5e88b,null));};exports[_0x07c8('0x12')]=function(_0x5a5d74,_0x5000ef){return db['VoiceExtension'][_0x07c8('0x1e')]({'where':{'id':_0x5a5d74[_0x07c8('0x3f')]['id']}})[_0x07c8('0x13')](handleEntityNotFound(_0x5000ef,null))[_0x07c8('0x13')](removeEntity(_0x5000ef,null))['catch'](handleError(_0x5000ef,null));};exports[_0x07c8('0x40')]=function(_0x572120,_0x33f6ce){if(_0x572120['body'][_0x07c8('0x1d')]===_0x07c8('0x18')&&!_[_0x07c8('0x41')](_0x572120[_0x07c8('0x42')][_0x07c8('0x43')],'_')){_0x572120[_0x07c8('0x42')][_0x07c8('0x43')]='_'[_0x07c8('0x44')](_0x572120['body'][_0x07c8('0x43')]);}return db['VoiceExtension'][_0x07c8('0x40')](_0x572120[_0x07c8('0x42')],{'raw':![]})[_0x07c8('0x13')](function(_0x1915e6){var _0x53b280=_0x572120[_0x07c8('0x45')][_0x07c8('0x14')]({'plain':!![]});if(!_0x53b280)throw new Error(_0x07c8('0x46'));if(_0x53b280['role']===_0x07c8('0x45')){var _0x45eb60=_0x1915e6[_0x07c8('0x14')]({'plain':!![]});var _0x5a65ec=[{'name':'InboundRoutes','value':_0x07c8('0x16')},{'name':'OutboundRoutes','value':'outbound'},{'name':'InternalRoutes','value':_0x07c8('0x1a')}];var _0x8ce101=_['find'](_0x5a65ec,[_0x07c8('0x1f'),_0x45eb60['type']])[_0x07c8('0x20')];return db['UserProfileSection']['find']({'where':{'name':_0x8ce101,'userProfileId':_0x53b280[_0x07c8('0x47')]},'raw':!![]})[_0x07c8('0x13')](function(_0x595dae){if(_0x595dae&&_0x595dae[_0x07c8('0x48')]===0x0){return db['UserProfileResource'][_0x07c8('0x40')]({'name':_0x45eb60[_0x07c8('0x20')],'resourceId':_0x45eb60['id'],'type':_0x595dae[_0x07c8('0x20')],'sectionId':_0x595dae['id']},{})[_0x07c8('0x13')](function(){return _0x1915e6;});}else{return _0x1915e6;}})[_0x07c8('0x3d')](function(_0x4616df){logger[_0x07c8('0x49')](_0x07c8('0x4a'),_0x4616df);throw _0x4616df;});}return _0x1915e6;})[_0x07c8('0x13')](respondWithResult(_0x33f6ce,0xc9))[_0x07c8('0x3d')](handleError(_0x33f6ce,null));};exports[_0x07c8('0x4b')]=function(_0x36bbc1,_0x37c6c3){if(_0x36bbc1[_0x07c8('0x42')]['id']){delete _0x36bbc1[_0x07c8('0x42')]['id'];}return db[_0x07c8('0x24')][_0x07c8('0x1e')]({'where':{'id':_0x36bbc1['params']['id']}})['then'](handleEntityNotFound(_0x37c6c3,null))[_0x07c8('0x13')](function(_0x52007b){if(_0x52007b){return db['VoiceExtension']['update'](_[_0x07c8('0x34')](_0x36bbc1[_0x07c8('0x42')],['exten',_0x07c8('0x4c'),_0x07c8('0x4d'),_0x07c8('0x4e'),_0x07c8('0x4f'),_0x07c8('0x50'),_0x07c8('0x51')]),{'where':{'context':_0x52007b[_0x07c8('0x4c')],'exten':_0x52007b['exten']},'individualHooks':!![]})[_0x07c8('0x13')](function(_0x5a8fbb){return _0x5a8fbb;});}return null;})[_0x07c8('0x13')](respondWithStatusCode(_0x37c6c3,null))[_0x07c8('0x3d')](handleError(_0x37c6c3,null));};exports['addApplications']=function(_0xc95010,_0x349f97){return db[_0x07c8('0x24')]['findOne']({'where':{'id':_0xc95010[_0x07c8('0x3f')]['id']}})[_0x07c8('0x13')](function(_0x445ec7){if(_0x445ec7){return db[_0x07c8('0x52')][_0x07c8('0x53')](function(_0x21d1e5){return db[_0x07c8('0x24')][_0x07c8('0x12')]({'where':{'VoiceExtensionId':_0xc95010[_0x07c8('0x3f')]['id']},'transaction':_0x21d1e5})[_0x07c8('0x13')](function(){var _0x236ab2=_['map'](_0xc95010['body'],function(_0x228de7){_0x228de7[_0x07c8('0x54')]=_0xc95010[_0x07c8('0x3f')]['id'];_0x228de7[_0x07c8('0x55')]=!![];return _0x228de7;});return _0x445ec7[_0x07c8('0x56')](_0x236ab2);})[_0x07c8('0x13')](function(_0x477870){console[_0x07c8('0x57')](_0x07c8('0x58'),_0x477870);return db['VoiceExtension'][_0x07c8('0x59')](_0x477870,{'transaction':_0x21d1e5});});})['then'](function(){return db[_0x07c8('0x24')][_0x07c8('0x5a')]({'where':{'isApp':!![],'VoiceExtensionId':_0xc95010[_0x07c8('0x3f')]['id']},'order':_0x07c8('0x5b')});});}})['then'](respondWithResult(_0x349f97,null))[_0x07c8('0x3d')](handleError(_0x349f97,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index dd2e79c..be77d5c 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 _0xc67b=['exports','events','../../mysqldb','VoiceExtension','save','update','emit','hasOwnProperty'];(function(_0xf97eb0,_0x1578b7){var _0xea70f4=function(_0x574c8d){while(--_0x574c8d){_0xf97eb0['push'](_0xf97eb0['shift']());}};_0xea70f4(++_0x1578b7);}(_0xc67b,0x139));var _0xbc67=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xc67b[_0x126558];return _0x1f6d14;};'use strict';var EventEmitter=require(_0xbc67('0x0'));var VoiceExtension=require(_0xbc67('0x1'))['db'][_0xbc67('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbc67('0x3'),'afterUpdate':_0xbc67('0x4'),'afterDestroy':'remove'};function emitEvent(_0x192532){return function(_0x3595f0,_0x552a89,_0x323b11){VoiceExtensionEvents[_0xbc67('0x5')](_0x192532+':'+_0x3595f0['id'],_0x3595f0);VoiceExtensionEvents[_0xbc67('0x5')](_0x192532,_0x3595f0);_0x323b11(null);};}for(var e in events){if(events[_0xbc67('0x6')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xbc67('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0x8f82=['../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove','emit','hook'];(function(_0x23ee65,_0x151793){var _0x1e1e07=function(_0x6975d6){while(--_0x6975d6){_0x23ee65['push'](_0x23ee65['shift']());}};_0x1e1e07(++_0x151793);}(_0x8f82,0xd0));var _0x28f8=function(_0x99923b,_0x31cb53){_0x99923b=_0x99923b-0x0;var _0x3b23c0=_0x8f82[_0x99923b];return _0x3b23c0;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x28f8('0x0'))['db'][_0x28f8('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x28f8('0x2')](0x0);var events={'afterCreate':_0x28f8('0x3'),'afterUpdate':_0x28f8('0x4'),'afterDestroy':_0x28f8('0x5')};function emitEvent(_0x7ebe6f){return function(_0x5cb8d4,_0x138051,_0x3970fc){VoiceExtensionEvents['emit'](_0x7ebe6f+':'+_0x5cb8d4['id'],_0x5cb8d4);VoiceExtensionEvents[_0x28f8('0x6')](_0x7ebe6f,_0x5cb8d4);_0x3970fc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x28f8('0x7')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index dd83bec..bb46db8 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 _0x9ab0=['MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(routeAlias)=','No\x20alias\x20set','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','param','split','prefix','phone','SIP','indexOf','U(xcally-mixmonitor-context)','replace','join','isEmpty','Interval','findAll','interval','IntervalId','then','length','intervals','map','filter','tag','toLowerCase','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appdata','priority','last','concat','define','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','exports','models','CDR(type)=','type','context','exten','alias','Set','NoOp','inbound','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0'];(function(_0x2b5ad0,_0x12c399){var _0x4cba07=function(_0x2dd462){while(--_0x2dd462){_0x2b5ad0['push'](_0x2b5ad0['shift']());}};_0x4cba07(++_0x12c399);}(_0x9ab0,0x195));var _0x09ab=function(_0x5d32ed,_0xc2d8fb){_0x5d32ed=_0x5d32ed-0x0;var _0x483f4e=_0x9ab0[_0x5d32ed];return _0x483f4e;};'use strict';var _=require(_0x09ab('0x0'));var attributes=require(_0x09ab('0x1'));module[_0x09ab('0x2')]=function(_0x28d64f){var _0x38fee4=_0x28d64f[_0x09ab('0x3')];function _0x38c30a(_0x3601d4){var _0x3c0cd0=0x2;var _0x4bb59a=[{'type':_0x3601d4['type'],'app':'Set','appdata':_0x09ab('0x4')+_0x3601d4[_0x09ab('0x5')],'context':_0x3601d4[_0x09ab('0x6')],'exten':_0x3601d4[_0x09ab('0x7')],'priority':_0x3c0cd0++,'VoiceExtensionId':_0x3601d4['id']},{'type':_0x3601d4[_0x09ab('0x5')],'app':_0x3601d4[_0x09ab('0x8')]?_0x09ab('0x9'):_0x09ab('0xa'),'appdata':_0x3601d4[_0x09ab('0x8')]?'CDR(routeAlias)='+_0x3601d4[_0x09ab('0x8')]:'No\x20alias\x20set','context':_0x3601d4[_0x09ab('0x6')],'exten':_0x3601d4[_0x09ab('0x7')],'priority':_0x3c0cd0++,'VoiceExtensionId':_0x3601d4['id']}];if(_0x3601d4[_0x09ab('0x5')]==='inbound'){_0x4bb59a['push']({'type':_0x09ab('0xb'),'app':_0x09ab('0x9'),'appdata':'CDR(routeid)='+_0x3601d4['id'],'context':_0x3601d4['context'],'exten':_0x3601d4[_0x09ab('0x7')],'priority':_0x3c0cd0++,'VoiceExtensionId':_0x3601d4['id']});}_0x4bb59a[_0x09ab('0xc')]({'type':_0x3601d4[_0x09ab('0x5')],'app':_0x09ab('0x9'),'appdata':_0x09ab('0xd'),'context':_0x3601d4[_0x09ab('0x6')],'exten':_0x3601d4[_0x09ab('0x7')],'priority':_0x3c0cd0++,'VoiceExtensionId':_0x3601d4['id']},{'type':_0x3601d4[_0x09ab('0x5')],'app':_0x09ab('0x9'),'appdata':_0x09ab('0xe'),'context':_0x3601d4[_0x09ab('0x6')],'exten':_0x3601d4[_0x09ab('0x7')],'priority':_0x3c0cd0++,'VoiceExtensionId':_0x3601d4['id']},{'type':_0x3601d4['type'],'app':_0x09ab('0x9'),'appdata':_0x09ab('0xf'),'context':_0x3601d4[_0x09ab('0x6')],'exten':_0x3601d4['exten'],'priority':_0x3c0cd0++,'VoiceExtensionId':_0x3601d4['id']});return _0x4bb59a;}function _0x21db00(_0x23160e){var _0x2f75a8=0x2;var _0x574b0f=[{'type':_0x09ab('0x10'),'app':_0x09ab('0x9'),'appdata':_0x09ab('0x11'),'context':_0x23160e[_0x09ab('0x6')],'exten':_0x23160e[_0x09ab('0x7')],'priority':_0x2f75a8++,'VoiceExtensionId':_0x23160e['id']},{'type':_0x09ab('0x10'),'app':_0x23160e['alias']?_0x09ab('0x9'):_0x09ab('0xa'),'appdata':_0x23160e['alias']?_0x09ab('0x12')+_0x23160e[_0x09ab('0x8')]:_0x09ab('0x13'),'context':_0x23160e[_0x09ab('0x6')],'exten':_0x23160e[_0x09ab('0x7')],'priority':_0x2f75a8++,'VoiceExtensionId':_0x23160e['id']},{'type':_0x09ab('0x10'),'app':_0x09ab('0x9'),'appdata':_0x09ab('0x14')+(_0x23160e['cutdigits']?_0x09ab('0x15')+_0x23160e[_0x09ab('0x16')]+'}':_0x09ab('0x17')),'context':_0x23160e[_0x09ab('0x6')],'exten':_0x23160e[_0x09ab('0x7')],'priority':_0x2f75a8++,'VoiceExtensionId':_0x23160e['id']},{'type':_0x09ab('0x10'),'app':'Set','appdata':_0x09ab('0x18')+_0x23160e['id'],'context':_0x23160e[_0x09ab('0x6')],'exten':_0x23160e[_0x09ab('0x7')],'priority':_0x2f75a8++,'VoiceExtensionId':_0x23160e['id']},{'type':_0x09ab('0x10'),'app':_0x09ab('0x19'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x2f75a8+0x2)+'):Goto('+(_0x2f75a8+0x1)+')','context':_0x23160e[_0x09ab('0x6')],'exten':_0x23160e[_0x09ab('0x7')],'priority':_0x2f75a8++,'VoiceExtensionId':_0x23160e['id']},{'type':'outbound','app':_0x09ab('0x9'),'appdata':_0x23160e[_0x09ab('0x16')]?_0x09ab('0x1a')+_0x23160e[_0x09ab('0x16')]+'}':_0x09ab('0x1b'),'context':_0x23160e[_0x09ab('0x6')],'exten':_0x23160e[_0x09ab('0x7')],'priority':_0x2f75a8++,'VoiceExtensionId':_0x23160e['id']},{'type':_0x09ab('0x10'),'app':'Set','appdata':_0x09ab('0xd'),'context':_0x23160e[_0x09ab('0x6')],'exten':_0x23160e[_0x09ab('0x7')],'priority':_0x2f75a8++,'VoiceExtensionId':_0x23160e['id']},{'type':_0x09ab('0x10'),'app':_0x09ab('0x9'),'appdata':_0x09ab('0xe'),'context':_0x23160e[_0x09ab('0x6')],'exten':_0x23160e[_0x09ab('0x7')],'priority':_0x2f75a8++,'VoiceExtensionId':_0x23160e['id']},{'type':_0x09ab('0x10'),'app':_0x09ab('0x9'),'appdata':_0x09ab('0xf'),'context':_0x23160e[_0x09ab('0x6')],'exten':_0x23160e[_0x09ab('0x7')],'priority':_0x2f75a8++,'VoiceExtensionId':_0x23160e['id']},{'type':'outbound','app':_0x09ab('0x9'),'appdata':_0x09ab('0x1c')+_0x23160e['id'],'context':_0x23160e[_0x09ab('0x6')],'exten':_0x23160e[_0x09ab('0x7')],'priority':_0x2f75a8++,'VoiceExtensionId':_0x23160e['id']}];if(_0x23160e[_0x09ab('0x1d')](_0x09ab('0x1e'))&&_0x23160e[_0x09ab('0x1e')]!==_0x09ab('0x1f')){_0x574b0f[_0x09ab('0xc')]({'type':'outbound','app':'Set','appdata':_0x09ab('0x20'),'context':_0x23160e[_0x09ab('0x6')],'exten':_0x23160e['exten'],'priority':_0x2f75a8++,'VoiceExtensionId':_0x23160e['id']},{'type':_0x09ab('0x10'),'app':_0x09ab('0x9'),'appdata':_0x09ab('0x21')+_0x23160e['recordingFormat']||_0x09ab('0x22'),'context':_0x23160e[_0x09ab('0x6')],'exten':_0x23160e[_0x09ab('0x7')],'priority':_0x2f75a8++,'VoiceExtensionId':_0x23160e['id']});}return _0x574b0f;}function _0x527d91(_0x4e908d,_0x1a225c){var _0x2141a3=[{'name':_0x09ab('0x23'),'param':0x0},{'name':_0x09ab('0x24'),'param':0x1},{'name':_0x09ab('0x25'),'param':0x2},{'name':'url','param':0x3}];var _0x307aca={};var _0x3080ca=_0x1a225c['split'](',');var _0x429e17=[];for(var _0x39c4ab=0x0;_0x39c4ab<_0x2141a3['length'];_0x39c4ab++){switch(_0x2141a3[_0x39c4ab]['name']){case'trunk':_0x307aca['trunk']=_0x3080ca[_0x2141a3[_0x39c4ab][_0x09ab('0x26')]][_0x09ab('0x27')]('/')[0x1];_0x307aca['phone']=_0x3080ca[_0x2141a3[_0x39c4ab][_0x09ab('0x26')]][_0x09ab('0x27')]('/')[0x2];_0x307aca[_0x09ab('0x28')]=_0x307aca[_0x09ab('0x29')]?_0x307aca['phone'][_0x09ab('0x27')]('$')[0x0]:undefined;_0x307aca[_0x09ab('0x29')]=_0x4e908d[_0x09ab('0x16')]?(_0x307aca[_0x09ab('0x28')]||'')+_0x09ab('0x15')+_0x4e908d[_0x09ab('0x16')]+'}':(_0x307aca[_0x09ab('0x28')]||'')+_0x09ab('0x17');_0x429e17[_0x2141a3[_0x39c4ab][_0x09ab('0x26')]]=[_0x09ab('0x2a'),_0x307aca[_0x09ab('0x23')],_0x307aca[_0x09ab('0x29')]]['join']('/');break;case _0x09ab('0x25'):_0x307aca[_0x09ab('0x25')]=_0x3080ca[_0x2141a3[_0x39c4ab][_0x09ab('0x26')]];if(_0x4e908d[_0x09ab('0x1e')]!==_0x09ab('0x1f')){if(_0x307aca['options'][_0x09ab('0x2b')]('U(xcally-mixmonitor-context)')<0x0){_0x307aca[_0x09ab('0x25')]+=_0x09ab('0x2c');}}else{_0x307aca[_0x09ab('0x25')]=_0x307aca[_0x09ab('0x25')][_0x09ab('0x2d')]('U(xcally-mixmonitor-context)','');}_0x429e17[_0x2141a3[_0x39c4ab][_0x09ab('0x26')]]=_0x307aca[_0x09ab('0x25')];break;default:_0x429e17[_0x2141a3[_0x39c4ab][_0x09ab('0x26')]]=_0x3080ca[_0x2141a3[_0x39c4ab][_0x09ab('0x26')]];}}return _0x429e17[_0x09ab('0x2e')](',');}function _0x3572f2(_0x14e82c,_0x75feeb,_0x1e8189){return new Promise(function(_0x310a29,_0x44a820){var _0x37e86e=[];if(_[_0x09ab('0x2f')](_0x75feeb))return _0x310a29(_0x37e86e);_0x38fee4[_0x09ab('0x30')][_0x09ab('0x31')]({'attributes':['id',_0x09ab('0x32'),_0x09ab('0x33')],'raw':!![]})[_0x09ab('0x34')](function(_0x386c26){for(var _0x566283=0x0,_0x4c6e94=0x0;_0x566283<_0x75feeb[_0x09ab('0x35')];_0x566283++,_0x4c6e94=0x0){var _0x406107=_0x75feeb[_0x566283];var _0x52a0ad=[];var _0x253437=[];delete _0x406107['id'];if(_0x406107[_0x09ab('0x32')]!=='*,*,*,*'){_0x406107[_0x09ab('0x36')]=[_0x406107[_0x09ab('0x32')]];}else{_0x406107['intervals']=_0x406107[_0x09ab('0x33')]?_[_0x09ab('0x37')](_[_0x09ab('0x38')](_0x386c26,{'IntervalId':_0x406107[_0x09ab('0x33')]}),_0x09ab('0x32')):[];}_0x406107[_0x09ab('0x6')]=_0x14e82c[_0x09ab('0x6')];_0x406107[_0x09ab('0x7')]=_0x14e82c['exten'];if(_0x406107[_0x09ab('0x5')])_0x406107[_0x09ab('0x5')]=_0x406107[_0x09ab('0x5')]['toLowerCase']();if(_0x14e82c[_0x09ab('0x5')]===_0x09ab('0x10')){if(_0x406107[_0x09ab('0x1d')](_0x09ab('0x39'))&&_0x406107['tag']&&_0x406107['tag']!=='--'){_0x52a0ad['push']({'type':_0x406107['type'][_0x09ab('0x3a')](),'app':_0x09ab('0x9'),'appdata':_0x09ab('0x3b')+_0x406107['tag'],'context':_0x14e82c[_0x09ab('0x6')],'exten':_0x14e82c[_0x09ab('0x7')],'priority':_0x406107['intervals'][_0x09ab('0x35')]+_0x1e8189+_0x4c6e94++,'VoiceExtensionId':_0x14e82c['id']});}_0x52a0ad[_0x09ab('0xc')]({'type':_0x406107[_0x09ab('0x5')][_0x09ab('0x3a')](),'app':'ExecIf','appdata':_0x09ab('0x3c')+(_0x406107[_0x09ab('0x3d')]?_0x09ab('0x3e')+_0x406107[_0x09ab('0x3d')]+')':_0x09ab('0x3f')),'context':_0x14e82c['context'],'exten':_0x14e82c[_0x09ab('0x7')],'priority':_0x406107[_0x09ab('0x36')][_0x09ab('0x35')]+_0x1e8189+_0x4c6e94++,'VoiceExtensionId':_0x14e82c['id']});}else{if(_0x406107[_0x09ab('0x1d')](_0x09ab('0x40'))){if([_0x09ab('0x41'),_0x09ab('0x42')][_0x09ab('0x43')](_0x406107[_0x09ab('0x44')][_0x09ab('0x3a')]())&&_0x406107['appType']!==_0x09ab('0x45')){if(_0x406107[_0x09ab('0x40')]){_0x52a0ad[_0x09ab('0xc')]({'type':_0x406107[_0x09ab('0x5')]['toLowerCase'](),'app':_0x09ab('0x19'),'appdata':_0x09ab('0x46'),'context':_0x14e82c[_0x09ab('0x6')],'exten':_0x14e82c[_0x09ab('0x7')],'priority':_0x406107['intervals'][_0x09ab('0x35')]+_0x1e8189+_0x4c6e94++,'VoiceExtensionId':_0x14e82c['id']});_0x52a0ad[_0x09ab('0xc')]({'type':_0x406107['type'][_0x09ab('0x3a')](),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x14e82c[_0x09ab('0x6')],'exten':_0x14e82c[_0x09ab('0x7')],'priority':_0x406107[_0x09ab('0x36')]['length']+_0x1e8189+_0x4c6e94++,'VoiceExtensionId':_0x14e82c['id']});}else{_0x52a0ad['push']({'type':_0x406107[_0x09ab('0x5')][_0x09ab('0x3a')](),'app':'ExecIf','appdata':_0x09ab('0x47'),'context':_0x14e82c[_0x09ab('0x6')],'exten':_0x14e82c[_0x09ab('0x7')],'priority':_0x406107[_0x09ab('0x36')][_0x09ab('0x35')]+_0x1e8189+_0x4c6e94++,'VoiceExtensionId':_0x14e82c['id']});_0x52a0ad[_0x09ab('0xc')]({'type':_0x406107[_0x09ab('0x5')]['toLowerCase'](),'app':_0x09ab('0x9'),'appdata':_0x09ab('0x48'),'context':_0x14e82c[_0x09ab('0x6')],'exten':_0x14e82c[_0x09ab('0x7')],'priority':_0x406107[_0x09ab('0x36')][_0x09ab('0x35')]+_0x1e8189+_0x4c6e94++,'VoiceExtensionId':_0x14e82c['id']});}}}}for(var _0xe8db1d=0x0;_0xe8db1d<_0x406107[_0x09ab('0x36')][_0x09ab('0x35')];_0xe8db1d++){var _0x7320be=_0x1e8189+_0x406107['intervals'][_0x09ab('0x35')];var _0x472f0a=_0xe8db1d===_0x406107[_0x09ab('0x36')]['length']-0x1?_0x1e8189+_0x52a0ad['length']+_0x253437[_0x09ab('0x35')]+0x2:_0x1e8189+_0xe8db1d+0x1;_0x52a0ad[_0x09ab('0x49')](_0xe8db1d,0x0,{'type':_0x14e82c[_0x09ab('0x5')],'app':_0x09ab('0x4a'),'appdata':_0x406107[_0x09ab('0x36')][_0xe8db1d]+'?'+_0x14e82c['context']+_0x09ab('0x4b')+_0x7320be+':'+_0x14e82c[_0x09ab('0x6')]+_0x09ab('0x4b')+_0x472f0a,'exten':_0x14e82c[_0x09ab('0x7')],'context':_0x14e82c[_0x09ab('0x6')],'priority':_0x1e8189+_0xe8db1d,'VoiceExtensionId':_0x14e82c['id']});}if(_0x406107['appType']==='outboundDial')_0x406107[_0x09ab('0x4c')]=_0x527d91(_0x14e82c,_0x406107[_0x09ab('0x4c')]);_0x406107[_0x09ab('0x4d')]=_0x52a0ad[_0x09ab('0x35')]?_[_0x09ab('0x4e')](_0x52a0ad)[_0x09ab('0x4d')]+0x1:_0x1e8189;_0x37e86e=_[_0x09ab('0x4f')](_0x37e86e,_0x52a0ad,[_0x406107],_0x253437);_0x1e8189=_['last'](_0x37e86e)[_0x09ab('0x4d')]+0x1;}return _0x310a29(_0x37e86e);})['catch'](function(_0x322f43){_0x44a820(_0x322f43);});});}return _0x28d64f[_0x09ab('0x50')]('VoiceExtension',attributes,{'tableName':_0x09ab('0x51'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4f6b80){var _0x181f7c=this[_0x09ab('0x52')]({'plain':!![]});var _0x2b9371=_0x181f7c['type']===_0x09ab('0x10')?_0x21db00(_0x181f7c):_0x38c30a(_0x181f7c);return _0x3572f2(_0x181f7c,_0x4f6b80,_['last'](_0x2b9371)[_0x09ab('0x4d')]+0x1)['then'](function(_0x113082){var _0x2ebeb6=_[_0x09ab('0x4f')](_0x2b9371,_0x113082);_0x2ebeb6['push']({'type':_0x181f7c['type'],'app':_0x09ab('0x53'),'exten':_0x181f7c[_0x09ab('0x7')],'context':_0x181f7c[_0x09ab('0x6')],'priority':_[_0x09ab('0x4e')](_0x2ebeb6)['priority']+0x1,'VoiceExtensionId':_0x181f7c['id']});return _0x2ebeb6;});}}});}; \ No newline at end of file +var _0x9dc0=['recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','timeout','url','split','trunk','param','phone','prefix','${EXTEN:','SIP','join','options','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','length','*,*,*,*','intervals','filter','toLowerCase','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','answer','queue','app','appType','custom','ExecIf','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','concat','last','catch','VoiceExtension','get','then','Hangup','exports','models','Set','CDR(type)=','type','context','NoOp','alias','No\x20alias\x20set','inbound','push','CDR(routeid)=','exten','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(routeAlias)=','CDR(destination)=','cutdigits','${EXTEN}','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x9dc0,0xd6));var _0x09dc=function(_0x228a4a,_0x23d65e){_0x228a4a=_0x228a4a-0x0;var _0x3d3937=_0x9dc0[_0x228a4a];return _0x3d3937;};'use strict';var _=require('lodash');var attributes=require('./voiceExtension.attributes');module[_0x09dc('0x0')]=function(_0x53c84e){var _0x31f3dc=_0x53c84e[_0x09dc('0x1')];function _0x2eba33(_0xebc7e5){var _0x5bac1e=0x2;var _0x43fba4=[{'type':_0xebc7e5['type'],'app':_0x09dc('0x2'),'appdata':_0x09dc('0x3')+_0xebc7e5[_0x09dc('0x4')],'context':_0xebc7e5[_0x09dc('0x5')],'exten':_0xebc7e5['exten'],'priority':_0x5bac1e++,'VoiceExtensionId':_0xebc7e5['id']},{'type':_0xebc7e5['type'],'app':_0xebc7e5['alias']?'Set':_0x09dc('0x6'),'appdata':_0xebc7e5[_0x09dc('0x7')]?'CDR(routeAlias)='+_0xebc7e5[_0x09dc('0x7')]:_0x09dc('0x8'),'context':_0xebc7e5[_0x09dc('0x5')],'exten':_0xebc7e5['exten'],'priority':_0x5bac1e++,'VoiceExtensionId':_0xebc7e5['id']}];if(_0xebc7e5[_0x09dc('0x4')]===_0x09dc('0x9')){_0x43fba4[_0x09dc('0xa')]({'type':_0x09dc('0x9'),'app':_0x09dc('0x2'),'appdata':_0x09dc('0xb')+_0xebc7e5['id'],'context':_0xebc7e5[_0x09dc('0x5')],'exten':_0xebc7e5[_0x09dc('0xc')],'priority':_0x5bac1e++,'VoiceExtensionId':_0xebc7e5['id']});}_0x43fba4['push']({'type':_0xebc7e5[_0x09dc('0x4')],'app':'Set','appdata':_0x09dc('0xd'),'context':_0xebc7e5[_0x09dc('0x5')],'exten':_0xebc7e5['exten'],'priority':_0x5bac1e++,'VoiceExtensionId':_0xebc7e5['id']},{'type':_0xebc7e5[_0x09dc('0x4')],'app':_0x09dc('0x2'),'appdata':_0x09dc('0xe'),'context':_0xebc7e5['context'],'exten':_0xebc7e5['exten'],'priority':_0x5bac1e++,'VoiceExtensionId':_0xebc7e5['id']},{'type':_0xebc7e5['type'],'app':_0x09dc('0x2'),'appdata':_0x09dc('0xf'),'context':_0xebc7e5[_0x09dc('0x5')],'exten':_0xebc7e5['exten'],'priority':_0x5bac1e++,'VoiceExtensionId':_0xebc7e5['id']});return _0x43fba4;}function _0x39f429(_0x3e4e97){var _0x51a1e1=0x2;var _0x233578=[{'type':_0x09dc('0x10'),'app':_0x09dc('0x2'),'appdata':_0x09dc('0x11'),'context':_0x3e4e97['context'],'exten':_0x3e4e97[_0x09dc('0xc')],'priority':_0x51a1e1++,'VoiceExtensionId':_0x3e4e97['id']},{'type':_0x09dc('0x10'),'app':_0x3e4e97[_0x09dc('0x7')]?_0x09dc('0x2'):'NoOp','appdata':_0x3e4e97[_0x09dc('0x7')]?_0x09dc('0x12')+_0x3e4e97[_0x09dc('0x7')]:_0x09dc('0x8'),'context':_0x3e4e97['context'],'exten':_0x3e4e97[_0x09dc('0xc')],'priority':_0x51a1e1++,'VoiceExtensionId':_0x3e4e97['id']},{'type':_0x09dc('0x10'),'app':_0x09dc('0x2'),'appdata':_0x09dc('0x13')+(_0x3e4e97['cutdigits']?'${EXTEN:'+_0x3e4e97[_0x09dc('0x14')]+'}':_0x09dc('0x15')),'context':_0x3e4e97[_0x09dc('0x5')],'exten':_0x3e4e97['exten'],'priority':_0x51a1e1++,'VoiceExtensionId':_0x3e4e97['id']},{'type':_0x09dc('0x10'),'app':_0x09dc('0x2'),'appdata':_0x09dc('0xb')+_0x3e4e97['id'],'context':_0x3e4e97['context'],'exten':_0x3e4e97['exten'],'priority':_0x51a1e1++,'VoiceExtensionId':_0x3e4e97['id']},{'type':'outbound','app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x51a1e1+0x2)+_0x09dc('0x16')+(_0x51a1e1+0x1)+')','context':_0x3e4e97[_0x09dc('0x5')],'exten':_0x3e4e97['exten'],'priority':_0x51a1e1++,'VoiceExtensionId':_0x3e4e97['id']},{'type':'outbound','app':_0x09dc('0x2'),'appdata':_0x3e4e97[_0x09dc('0x14')]?'CDR(prefix)=${EXTEN:0:'+_0x3e4e97[_0x09dc('0x14')]+'}':_0x09dc('0x17'),'context':_0x3e4e97[_0x09dc('0x5')],'exten':_0x3e4e97[_0x09dc('0xc')],'priority':_0x51a1e1++,'VoiceExtensionId':_0x3e4e97['id']},{'type':_0x09dc('0x10'),'app':_0x09dc('0x2'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x3e4e97[_0x09dc('0x5')],'exten':_0x3e4e97[_0x09dc('0xc')],'priority':_0x51a1e1++,'VoiceExtensionId':_0x3e4e97['id']},{'type':_0x09dc('0x10'),'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x3e4e97[_0x09dc('0x5')],'exten':_0x3e4e97[_0x09dc('0xc')],'priority':_0x51a1e1++,'VoiceExtensionId':_0x3e4e97['id']},{'type':'outbound','app':_0x09dc('0x2'),'appdata':_0x09dc('0xf'),'context':_0x3e4e97['context'],'exten':_0x3e4e97['exten'],'priority':_0x51a1e1++,'VoiceExtensionId':_0x3e4e97['id']},{'type':_0x09dc('0x10'),'app':'Set','appdata':_0x09dc('0x18')+_0x3e4e97['id'],'context':_0x3e4e97[_0x09dc('0x5')],'exten':_0x3e4e97[_0x09dc('0xc')],'priority':_0x51a1e1++,'VoiceExtensionId':_0x3e4e97['id']}];if(_0x3e4e97[_0x09dc('0x19')]('recordingFormat')&&_0x3e4e97[_0x09dc('0x1a')]!==_0x09dc('0x1b')){_0x233578[_0x09dc('0xa')]({'type':_0x09dc('0x10'),'app':_0x09dc('0x2'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x3e4e97[_0x09dc('0x5')],'exten':_0x3e4e97[_0x09dc('0xc')],'priority':_0x51a1e1++,'VoiceExtensionId':_0x3e4e97['id']},{'type':_0x09dc('0x10'),'app':'Set','appdata':_0x09dc('0x1c')+_0x3e4e97['recordingFormat']||_0x09dc('0x1d'),'context':_0x3e4e97[_0x09dc('0x5')],'exten':_0x3e4e97[_0x09dc('0xc')],'priority':_0x51a1e1++,'VoiceExtensionId':_0x3e4e97['id']});}return _0x233578;}function _0x2e6809(_0x336296,_0x15233a){var _0x439018=[{'name':'trunk','param':0x0},{'name':_0x09dc('0x1e'),'param':0x1},{'name':'options','param':0x2},{'name':_0x09dc('0x1f'),'param':0x3}];var _0x3b476e={};var _0x3bb976=_0x15233a[_0x09dc('0x20')](',');var _0x567ae8=[];for(var _0x228410=0x0;_0x228410<_0x439018['length'];_0x228410++){switch(_0x439018[_0x228410]['name']){case'trunk':_0x3b476e[_0x09dc('0x21')]=_0x3bb976[_0x439018[_0x228410][_0x09dc('0x22')]][_0x09dc('0x20')]('/')[0x1];_0x3b476e[_0x09dc('0x23')]=_0x3bb976[_0x439018[_0x228410][_0x09dc('0x22')]]['split']('/')[0x2];_0x3b476e['prefix']=_0x3b476e['phone']?_0x3b476e['phone'][_0x09dc('0x20')]('$')[0x0]:undefined;_0x3b476e['phone']=_0x336296['cutdigits']?(_0x3b476e[_0x09dc('0x24')]||'')+_0x09dc('0x25')+_0x336296[_0x09dc('0x14')]+'}':(_0x3b476e[_0x09dc('0x24')]||'')+'${EXTEN}';_0x567ae8[_0x439018[_0x228410][_0x09dc('0x22')]]=[_0x09dc('0x26'),_0x3b476e['trunk'],_0x3b476e[_0x09dc('0x23')]][_0x09dc('0x27')]('/');break;case _0x09dc('0x28'):_0x3b476e[_0x09dc('0x28')]=_0x3bb976[_0x439018[_0x228410][_0x09dc('0x22')]];if(_0x336296[_0x09dc('0x1a')]!==_0x09dc('0x1b')){if(_0x3b476e[_0x09dc('0x28')][_0x09dc('0x29')](_0x09dc('0x2a'))<0x0){_0x3b476e[_0x09dc('0x28')]+='U(xcally-mixmonitor-context)';}}else{_0x3b476e[_0x09dc('0x28')]=_0x3b476e[_0x09dc('0x28')][_0x09dc('0x2b')](_0x09dc('0x2a'),'');}_0x567ae8[_0x439018[_0x228410][_0x09dc('0x22')]]=_0x3b476e[_0x09dc('0x28')];break;default:_0x567ae8[_0x439018[_0x228410][_0x09dc('0x22')]]=_0x3bb976[_0x439018[_0x228410][_0x09dc('0x22')]];}}return _0x567ae8[_0x09dc('0x27')](',');}function _0x2d1471(_0x410478,_0x48adf5,_0x544f9a){return new Promise(function(_0x524d98,_0xc9b3c1){var _0x4ec124=[];if(_[_0x09dc('0x2c')](_0x48adf5))return _0x524d98(_0x4ec124);_0x31f3dc[_0x09dc('0x2d')][_0x09dc('0x2e')]({'attributes':['id',_0x09dc('0x2f'),_0x09dc('0x30')],'raw':!![]})['then'](function(_0x42f719){for(var _0x47db88=0x0,_0x5d93ad=0x0;_0x47db88<_0x48adf5[_0x09dc('0x31')];_0x47db88++,_0x5d93ad=0x0){var _0x2be044=_0x48adf5[_0x47db88];var _0x5350cc=[];var _0x49d405=[];delete _0x2be044['id'];if(_0x2be044[_0x09dc('0x2f')]!==_0x09dc('0x32')){_0x2be044[_0x09dc('0x33')]=[_0x2be044['interval']];}else{_0x2be044['intervals']=_0x2be044[_0x09dc('0x30')]?_['map'](_[_0x09dc('0x34')](_0x42f719,{'IntervalId':_0x2be044[_0x09dc('0x30')]}),_0x09dc('0x2f')):[];}_0x2be044[_0x09dc('0x5')]=_0x410478[_0x09dc('0x5')];_0x2be044[_0x09dc('0xc')]=_0x410478['exten'];if(_0x2be044[_0x09dc('0x4')])_0x2be044[_0x09dc('0x4')]=_0x2be044[_0x09dc('0x4')][_0x09dc('0x35')]();if(_0x410478[_0x09dc('0x4')]===_0x09dc('0x10')){if(_0x2be044[_0x09dc('0x19')](_0x09dc('0x36'))&&_0x2be044[_0x09dc('0x36')]&&_0x2be044[_0x09dc('0x36')]!=='--'){_0x5350cc['push']({'type':_0x2be044[_0x09dc('0x4')][_0x09dc('0x35')](),'app':'Set','appdata':'CDR(tag)='+_0x2be044['tag'],'context':_0x410478[_0x09dc('0x5')],'exten':_0x410478[_0x09dc('0xc')],'priority':_0x2be044[_0x09dc('0x33')][_0x09dc('0x31')]+_0x544f9a+_0x5d93ad++,'VoiceExtensionId':_0x410478['id']});}_0x5350cc['push']({'type':_0x2be044[_0x09dc('0x4')]['toLowerCase'](),'app':'ExecIf','appdata':_0x09dc('0x37')+(_0x2be044[_0x09dc('0x38')]?_0x09dc('0x39')+_0x2be044[_0x09dc('0x38')]+')':'NoOp(No\x20number\x20available)'),'context':_0x410478[_0x09dc('0x5')],'exten':_0x410478[_0x09dc('0xc')],'priority':_0x2be044[_0x09dc('0x33')][_0x09dc('0x31')]+_0x544f9a+_0x5d93ad++,'VoiceExtensionId':_0x410478['id']});}else{if(_0x2be044[_0x09dc('0x19')](_0x09dc('0x3a'))){if([_0x09dc('0x3b'),'playback']['includes'](_0x2be044[_0x09dc('0x3c')][_0x09dc('0x35')]())&&_0x2be044[_0x09dc('0x3d')]!==_0x09dc('0x3e')){if(_0x2be044[_0x09dc('0x3a')]){_0x5350cc[_0x09dc('0xa')]({'type':_0x2be044[_0x09dc('0x4')][_0x09dc('0x35')](),'app':_0x09dc('0x3f'),'appdata':_0x09dc('0x40'),'context':_0x410478[_0x09dc('0x5')],'exten':_0x410478[_0x09dc('0xc')],'priority':_0x2be044['intervals']['length']+_0x544f9a+_0x5d93ad++,'VoiceExtensionId':_0x410478['id']});_0x5350cc[_0x09dc('0xa')]({'type':_0x2be044['type'][_0x09dc('0x35')](),'app':_0x09dc('0x2'),'appdata':_0x09dc('0x41'),'context':_0x410478[_0x09dc('0x5')],'exten':_0x410478[_0x09dc('0xc')],'priority':_0x2be044[_0x09dc('0x33')][_0x09dc('0x31')]+_0x544f9a+_0x5d93ad++,'VoiceExtensionId':_0x410478['id']});}else{_0x5350cc[_0x09dc('0xa')]({'type':_0x2be044[_0x09dc('0x4')]['toLowerCase'](),'app':_0x09dc('0x3f'),'appdata':_0x09dc('0x42'),'context':_0x410478[_0x09dc('0x5')],'exten':_0x410478[_0x09dc('0xc')],'priority':_0x2be044[_0x09dc('0x33')][_0x09dc('0x31')]+_0x544f9a+_0x5d93ad++,'VoiceExtensionId':_0x410478['id']});_0x5350cc[_0x09dc('0xa')]({'type':_0x2be044[_0x09dc('0x4')][_0x09dc('0x35')](),'app':_0x09dc('0x2'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x410478['context'],'exten':_0x410478[_0x09dc('0xc')],'priority':_0x2be044[_0x09dc('0x33')][_0x09dc('0x31')]+_0x544f9a+_0x5d93ad++,'VoiceExtensionId':_0x410478['id']});}}}}for(var _0x28a8c9=0x0;_0x28a8c9<_0x2be044[_0x09dc('0x33')][_0x09dc('0x31')];_0x28a8c9++){var _0x27cd62=_0x544f9a+_0x2be044[_0x09dc('0x33')][_0x09dc('0x31')];var _0x205dd1=_0x28a8c9===_0x2be044[_0x09dc('0x33')][_0x09dc('0x31')]-0x1?_0x544f9a+_0x5350cc['length']+_0x49d405[_0x09dc('0x31')]+0x2:_0x544f9a+_0x28a8c9+0x1;_0x5350cc[_0x09dc('0x43')](_0x28a8c9,0x0,{'type':_0x410478['type'],'app':_0x09dc('0x44'),'appdata':_0x2be044[_0x09dc('0x33')][_0x28a8c9]+'?'+_0x410478[_0x09dc('0x5')]+_0x09dc('0x45')+_0x27cd62+':'+_0x410478[_0x09dc('0x5')]+_0x09dc('0x45')+_0x205dd1,'exten':_0x410478[_0x09dc('0xc')],'context':_0x410478[_0x09dc('0x5')],'priority':_0x544f9a+_0x28a8c9,'VoiceExtensionId':_0x410478['id']});}if(_0x2be044['appType']===_0x09dc('0x46'))_0x2be044[_0x09dc('0x47')]=_0x2e6809(_0x410478,_0x2be044['appdata']);_0x2be044[_0x09dc('0x48')]=_0x5350cc['length']?_['last'](_0x5350cc)[_0x09dc('0x48')]+0x1:_0x544f9a;_0x4ec124=_[_0x09dc('0x49')](_0x4ec124,_0x5350cc,[_0x2be044],_0x49d405);_0x544f9a=_[_0x09dc('0x4a')](_0x4ec124)[_0x09dc('0x48')]+0x1;}return _0x524d98(_0x4ec124);})[_0x09dc('0x4b')](function(_0x498cdb){_0xc9b3c1(_0x498cdb);});});}return _0x53c84e['define'](_0x09dc('0x4c'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1bb62a){var _0x42b971=this[_0x09dc('0x4d')]({'plain':!![]});var _0x2e7343=_0x42b971[_0x09dc('0x4')]===_0x09dc('0x10')?_0x39f429(_0x42b971):_0x2eba33(_0x42b971);return _0x2d1471(_0x42b971,_0x1bb62a,_[_0x09dc('0x4a')](_0x2e7343)[_0x09dc('0x48')]+0x1)[_0x09dc('0x4e')](function(_0x30e43c){var _0x4943ff=_[_0x09dc('0x49')](_0x2e7343,_0x30e43c);_0x4943ff[_0x09dc('0xa')]({'type':_0x42b971[_0x09dc('0x4')],'app':_0x09dc('0x4f'),'exten':_0x42b971[_0x09dc('0xc')],'context':_0x42b971['context'],'priority':_[_0x09dc('0x4a')](_0x4943ff)[_0x09dc('0x48')]+0x1,'VoiceExtensionId':_0x42b971['id']});return _0x4943ff;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 916d4e8..6f83c05 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 _0xbea5=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','defaults','socket.io-emitter','redis','./voiceExtension.socket','request','then','info','request\x20sent','debug','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','result','GetVoiceExtension','VoiceExtension','findAll','options','raw','attributes','limit','map','include'];(function(_0x3e9a38,_0x3e8f1c){var _0x34e234=function(_0x324889){while(--_0x324889){_0x3e9a38['push'](_0x3e9a38['shift']());}};_0x34e234(++_0x3e8f1c);}(_0xbea5,0x177));var _0x5bea=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xbea5[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x5bea('0x0'));var util=require(_0x5bea('0x1'));var moment=require('moment');var BPromise=require(_0x5bea('0x2'));var rs=require(_0x5bea('0x3'));var fs=require('fs');var Redis=require(_0x5bea('0x4'));var db=require(_0x5bea('0x5'))['db'];var utils=require(_0x5bea('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x5bea('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5bea('0x8')]['http']({'port':0x232a});config['redis']=_[_0x5bea('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5bea('0xa'))(new Redis(config[_0x5bea('0xb')]));require(_0x5bea('0xc'))['register'](socket);function respondWithRpcPromise(_0x1e65aa,_0x53cec8,_0x4e793c){return new BPromise(function(_0x2af7af,_0x1bb8f0){return client[_0x5bea('0xd')](_0x1e65aa,_0x4e793c)[_0x5bea('0xe')](function(_0x78adda){logger[_0x5bea('0xf')]('VoiceExtension,\x20%s,\x20%s',_0x53cec8,_0x5bea('0x10'));logger[_0x5bea('0x11')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x53cec8,_0x5bea('0x10'),JSON[_0x5bea('0x12')](_0x78adda));if(_0x78adda['error']){if(_0x78adda[_0x5bea('0x13')][_0x5bea('0x14')]===0x1f4){logger[_0x5bea('0x13')](_0x5bea('0x15'),_0x53cec8,_0x78adda[_0x5bea('0x13')][_0x5bea('0x16')]);return _0x1bb8f0(_0x78adda[_0x5bea('0x13')]['message']);}logger['error'](_0x5bea('0x15'),_0x53cec8,_0x78adda[_0x5bea('0x13')][_0x5bea('0x16')]);return _0x2af7af(_0x78adda['error'][_0x5bea('0x16')]);}else{logger[_0x5bea('0xf')](_0x5bea('0x15'),_0x53cec8,'request\x20sent');_0x2af7af(_0x78adda[_0x5bea('0x17')][_0x5bea('0x16')]);}})['catch'](function(_0x163bf7){logger['error'](_0x5bea('0x15'),_0x53cec8,_0x163bf7);_0x1bb8f0(_0x163bf7);});});}exports[_0x5bea('0x18')]=function(_0x34c032){var _0x4c90e3=this;return new Promise(function(_0x57667c,_0x4169e5){return db[_0x5bea('0x19')][_0x5bea('0x1a')]({'raw':_0x34c032['options']?_0x34c032[_0x5bea('0x1b')][_0x5bea('0x1c')]===undefined?!![]:![]:!![],'where':_0x34c032[_0x5bea('0x1b')]?_0x34c032[_0x5bea('0x1b')]['where']||null:null,'attributes':_0x34c032[_0x5bea('0x1b')]?_0x34c032[_0x5bea('0x1b')][_0x5bea('0x1d')]||null:null,'limit':_0x34c032[_0x5bea('0x1b')]?_0x34c032['options'][_0x5bea('0x1e')]||null:null,'include':_0x34c032['options']?_0x34c032[_0x5bea('0x1b')]['include']?_[_0x5bea('0x1f')](_0x34c032[_0x5bea('0x1b')][_0x5bea('0x20')],function(_0x5a8361){return{'model':db[_0x5a8361['model']],'as':_0x5a8361['as'],'attributes':_0x5a8361['attributes'],'include':_0x5a8361['include']?_[_0x5bea('0x1f')](_0x5a8361[_0x5bea('0x20')],function(_0x4d5dd5){return{'model':db[_0x4d5dd5['model']],'as':_0x4d5dd5['as'],'attributes':_0x4d5dd5[_0x5bea('0x1d')],'include':_0x4d5dd5[_0x5bea('0x20')]?_['map'](_0x4d5dd5[_0x5bea('0x20')],function(_0x5db06b){return{'model':db[_0x5db06b['model']],'as':_0x5db06b['as'],'attributes':_0x5db06b[_0x5bea('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5bea('0xe')](function(_0x10b5e6){logger[_0x5bea('0xf')](_0x5bea('0x18'),_0x34c032);logger[_0x5bea('0x11')](_0x5bea('0x18'),_0x34c032,JSON[_0x5bea('0x12')](_0x10b5e6));_0x57667c(_0x10b5e6);})[_0x5bea('0x21')](function(_0x4c023f){logger['error'](_0x5bea('0x18'),_0x4c023f[_0x5bea('0x16')],_0x34c032);_0x4169e5(_0x4c90e3[_0x5bea('0x13')](0x1f4,_0x4c023f[_0x5bea('0x16')]));});});}; \ No newline at end of file +var _0x2709=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','where','include','map','model','attributes','debug','lodash','moment','bluebird'];(function(_0x4134f9,_0xb72988){var _0x3989a8=function(_0x3dff73){while(--_0x3dff73){_0x4134f9['push'](_0x4134f9['shift']());}};_0x3989a8(++_0xb72988);}(_0x2709,0x189));var _0x9270=function(_0x405b31,_0x2e7545){_0x405b31=_0x405b31-0x0;var _0x39ca39=_0x2709[_0x405b31];return _0x39ca39;};'use strict';var _=require(_0x9270('0x0'));var util=require('util');var moment=require(_0x9270('0x1'));var BPromise=require(_0x9270('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9270('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9270('0x4'));var logger=require(_0x9270('0x5'))(_0x9270('0x6'));var config=require(_0x9270('0x7'));var jayson=require(_0x9270('0x8'));var client=jayson[_0x9270('0x9')]['http']({'port':0x232a});config[_0x9270('0xa')]=_[_0x9270('0xb')](config[_0x9270('0xa')],{'host':_0x9270('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9270('0xa')]));require(_0x9270('0xd'))[_0x9270('0xe')](socket);function respondWithRpcPromise(_0xe68f8b,_0x623907,_0x78d773){return new BPromise(function(_0x46ead1,_0x9a0421){return client[_0x9270('0xf')](_0xe68f8b,_0x78d773)[_0x9270('0x10')](function(_0x5cf72b){logger[_0x9270('0x11')](_0x9270('0x12'),_0x623907,_0x9270('0x13'));logger['debug']('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x623907,_0x9270('0x13'),JSON[_0x9270('0x14')](_0x5cf72b));if(_0x5cf72b[_0x9270('0x15')]){if(_0x5cf72b['error'][_0x9270('0x16')]===0x1f4){logger[_0x9270('0x15')](_0x9270('0x12'),_0x623907,_0x5cf72b[_0x9270('0x15')]['message']);return _0x9a0421(_0x5cf72b['error'][_0x9270('0x17')]);}logger[_0x9270('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x623907,_0x5cf72b[_0x9270('0x15')]['message']);return _0x46ead1(_0x5cf72b[_0x9270('0x15')][_0x9270('0x17')]);}else{logger[_0x9270('0x11')]('VoiceExtension,\x20%s,\x20%s',_0x623907,'request\x20sent');_0x46ead1(_0x5cf72b[_0x9270('0x18')][_0x9270('0x17')]);}})[_0x9270('0x19')](function(_0x54f3bd){logger[_0x9270('0x15')](_0x9270('0x12'),_0x623907,_0x54f3bd);_0x9a0421(_0x54f3bd);});});}exports[_0x9270('0x1a')]=function(_0x72dd7d){var _0x1b0367=this;return new Promise(function(_0xcbb906,_0x564865){return db[_0x9270('0x1b')][_0x9270('0x1c')]({'raw':_0x72dd7d[_0x9270('0x1d')]?_0x72dd7d[_0x9270('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x72dd7d[_0x9270('0x1d')]?_0x72dd7d[_0x9270('0x1d')][_0x9270('0x1e')]||null:null,'attributes':_0x72dd7d[_0x9270('0x1d')]?_0x72dd7d[_0x9270('0x1d')]['attributes']||null:null,'limit':_0x72dd7d[_0x9270('0x1d')]?_0x72dd7d[_0x9270('0x1d')]['limit']||null:null,'include':_0x72dd7d[_0x9270('0x1d')]?_0x72dd7d[_0x9270('0x1d')][_0x9270('0x1f')]?_[_0x9270('0x20')](_0x72dd7d[_0x9270('0x1d')][_0x9270('0x1f')],function(_0x334bb7){return{'model':db[_0x334bb7[_0x9270('0x21')]],'as':_0x334bb7['as'],'attributes':_0x334bb7[_0x9270('0x22')],'include':_0x334bb7[_0x9270('0x1f')]?_[_0x9270('0x20')](_0x334bb7[_0x9270('0x1f')],function(_0x573e21){return{'model':db[_0x573e21[_0x9270('0x21')]],'as':_0x573e21['as'],'attributes':_0x573e21['attributes'],'include':_0x573e21['include']?_[_0x9270('0x20')](_0x573e21[_0x9270('0x1f')],function(_0x4dba44){return{'model':db[_0x4dba44[_0x9270('0x21')]],'as':_0x4dba44['as'],'attributes':_0x4dba44[_0x9270('0x22')]};}):[]};}):[]};}):[]:[]})[_0x9270('0x10')](function(_0x446a4a){logger['info'](_0x9270('0x1a'),_0x72dd7d);logger[_0x9270('0x23')]('GetVoiceExtension',_0x72dd7d,JSON[_0x9270('0x14')](_0x446a4a));_0xcbb906(_0x446a4a);})[_0x9270('0x19')](function(_0x38f17f){logger[_0x9270('0x15')](_0x9270('0x1a'),_0x38f17f[_0x9270('0x17')],_0x72dd7d);_0x564865(_0x1b0367['error'](0x1f4,_0x38f17f[_0x9270('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 9384c58..84e64ad 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 _0x4975=['length','./voiceExtension.events','remove','update','emit','removeListener','register'];(function(_0x32a674,_0x4a40b9){var _0x1eec02=function(_0x37f38a){while(--_0x37f38a){_0x32a674['push'](_0x32a674['shift']());}};_0x1eec02(++_0x4a40b9);}(_0x4975,0x86));var _0x5497=function(_0x73a96e,_0x54f73d){_0x73a96e=_0x73a96e-0x0;var _0x5a6f18=_0x4975[_0x73a96e];return _0x5a6f18;};'use strict';var VoiceExtensionEvents=require(_0x5497('0x0'));var events=['save',_0x5497('0x1'),_0x5497('0x2')];function createListener(_0xfc7927,_0x349f5f){return function(_0x135f6f){_0x349f5f[_0x5497('0x3')](_0xfc7927,_0x135f6f);};}function removeListener(_0x14cecb,_0xeb31af){return function(){VoiceExtensionEvents[_0x5497('0x4')](_0x14cecb,_0xeb31af);};}exports[_0x5497('0x5')]=function(_0x539a27){for(var _0x37e48d=0x0,_0x4f563d=events[_0x5497('0x6')];_0x37e48d<_0x4f563d;_0x37e48d++){var _0x674a2a=events[_0x37e48d];var _0x368e8b=createListener('voiceExtension:'+_0x674a2a,_0x539a27);VoiceExtensionEvents['on'](_0x674a2a,_0x368e8b);}}; \ No newline at end of file +var _0x5fc3=['./voiceExtension.events','save','update','emit','removeListener','register','voiceExtension:'];(function(_0x53c6d4,_0x3bc662){var _0x8e44c1=function(_0x2509f0){while(--_0x2509f0){_0x53c6d4['push'](_0x53c6d4['shift']());}};_0x8e44c1(++_0x3bc662);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3e6b2f,_0x1ffa07){_0x3e6b2f=_0x3e6b2f-0x0;var _0x323215=_0x5fc3[_0x3e6b2f];return _0x323215;};'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 970dcf6..0bef7d8 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 _0xdf55=['/:id/messages','getMessages','create','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','isAuthenticated','index','/:id','show'];(function(_0x487663,_0x57146b){var _0xa64395=function(_0x2b4fe1){while(--_0x2b4fe1){_0x487663['push'](_0x487663['shift']());}};_0xa64395(++_0x57146b);}(_0xdf55,0x83));var _0x5df5=function(_0x466247,_0x5d69e3){_0x466247=_0x466247-0x0;var _0x4b352e=_0xdf55[_0x466247];return _0x4b352e;};'use strict';var multer=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var path=require('path');var timeout=require(_0x5df5('0x2'));var express=require(_0x5df5('0x3'));var router=express['Router']();var fs_extra=require(_0x5df5('0x4'));var auth=require(_0x5df5('0x5'));var interaction=require(_0x5df5('0x6'));var config=require('../../config/environment');var controller=require(_0x5df5('0x7'));router[_0x5df5('0x8')]('/',auth[_0x5df5('0x9')](),controller[_0x5df5('0xa')]);router[_0x5df5('0x8')](_0x5df5('0xb'),auth[_0x5df5('0x9')](),controller[_0x5df5('0xc')]);router['get'](_0x5df5('0xd'),auth[_0x5df5('0x9')](),controller[_0x5df5('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5df5('0xf')]);router['put'](_0x5df5('0xb'),auth[_0x5df5('0x9')](),controller['update']);router['delete'](_0x5df5('0xb'),auth[_0x5df5('0x9')](),controller[_0x5df5('0x10')]);module[_0x5df5('0x11')]=router; \ No newline at end of file +var _0x7bd0=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x3f9165,_0x471c93){var _0x5238d7=function(_0xaec65){while(--_0xaec65){_0x3f9165['push'](_0x3f9165['shift']());}};_0x5238d7(++_0x471c93);}(_0x7bd0,0x111));var _0x07bd=function(_0x4fda88,_0x1a4d19){_0x4fda88=_0x4fda88-0x0;var _0xe37511=_0x7bd0[_0x4fda88];return _0xe37511;};'use strict';var multer=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var path=require(_0x07bd('0x2'));var timeout=require(_0x07bd('0x3'));var express=require(_0x07bd('0x4'));var router=express[_0x07bd('0x5')]();var fs_extra=require(_0x07bd('0x6'));var auth=require(_0x07bd('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x07bd('0x8'));var controller=require(_0x07bd('0x9'));router[_0x07bd('0xa')]('/',auth[_0x07bd('0xb')](),controller[_0x07bd('0xc')]);router[_0x07bd('0xa')](_0x07bd('0xd'),auth['isAuthenticated'](),controller[_0x07bd('0xe')]);router['get'](_0x07bd('0xf'),auth[_0x07bd('0xb')](),controller[_0x07bd('0x10')]);router['post']('/',auth[_0x07bd('0xb')](),controller[_0x07bd('0x11')]);router[_0x07bd('0x12')](_0x07bd('0xd'),auth['isAuthenticated'](),controller[_0x07bd('0x13')]);router[_0x07bd('0x14')](_0x07bd('0xd'),auth[_0x07bd('0xb')](),controller[_0x07bd('0x15')]);module[_0x07bd('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 0a05274..51c5b1b 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 _0x7433=['INTEGER','VIRTUAL','fullname','\x20-\x20','getDataValue','sequelize','STRING','contest_mailbox','trim','central','yes','ENUM','TINYINT(4)'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x7433,0xe2));var _0x3743=function(_0xeb254a,_0x1c1fc9){_0xeb254a=_0xeb254a-0x0;var _0x78e431=_0x7433[_0xeb254a];return _0x78e431;};'use strict';var Sequelize=require(_0x3743('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x3743('0x1')]},'context':{'type':Sequelize[_0x3743('0x1')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x3743('0x1')],'defaultValue':'','allowNull':![],'unique':_0x3743('0x2')},'password':{'type':Sequelize[_0x3743('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x3743('0x1')],'validate':{'isEmail':!![]},'set':function(_0x21f8c1){this['setDataValue']('email',typeof _0x21f8c1==='string'&&_0x21f8c1[_0x3743('0x3')]()?_0x21f8c1[_0x3743('0x3')]():null);}},'pager':{'type':Sequelize[_0x3743('0x1')]},'tz':{'type':Sequelize[_0x3743('0x1')],'defaultValue':_0x3743('0x4')},'attach':{'type':Sequelize['ENUM'](_0x3743('0x5'),'no'),'defaultValue':_0x3743('0x5'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x3743('0x5'),'no'),'defaultValue':_0x3743('0x5'),'allowNull':![]},'dialout':{'type':Sequelize[_0x3743('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize['ENUM'](_0x3743('0x5'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x3743('0x6')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x3743('0x6')](_0x3743('0x5'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x3743('0x6')](_0x3743('0x5'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x3743('0x7'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x3743('0x5'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x3743('0x6')](_0x3743('0x5'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x3743('0x6')]('yes','no'),'defaultValue':_0x3743('0x5'),'allowNull':![]},'forcename':{'type':Sequelize[_0x3743('0x6')](_0x3743('0x5'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x3743('0x5'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x3743('0x1')]},'maxsecs':{'type':Sequelize[_0x3743('0x8')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x3743('0x9')],'get':function(){return this['getDataValue'](_0x3743('0xa'))+_0x3743('0xb')+this[_0x3743('0xc')]('mailbox');}}}; \ No newline at end of file +var _0x5e41=['sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','VIRTUAL','getDataValue','fullname','\x20-\x20'];(function(_0x511bd1,_0x223e5b){var _0x4c48ec=function(_0x31814e){while(--_0x31814e){_0x511bd1['push'](_0x511bd1['shift']());}};_0x4c48ec(++_0x223e5b);}(_0x5e41,0xff));var _0x15e4=function(_0x49afab,_0x10a379){_0x49afab=_0x49afab-0x0;var _0xe83908=_0x5e41[_0x49afab];return _0xe83908;};'use strict';var Sequelize=require(_0x15e4('0x0'));module[_0x15e4('0x1')]={'customer_id':{'type':Sequelize[_0x15e4('0x2')]},'context':{'type':Sequelize[_0x15e4('0x2')],'defaultValue':_0x15e4('0x3'),'unique':_0x15e4('0x4')},'mailbox':{'type':Sequelize[_0x15e4('0x2')],'defaultValue':'','allowNull':![],'unique':_0x15e4('0x4')},'password':{'type':Sequelize[_0x15e4('0x2')]},'fullname':{'type':Sequelize[_0x15e4('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x47b19e){this[_0x15e4('0x5')](_0x15e4('0x6'),typeof _0x47b19e==='string'&&_0x47b19e[_0x15e4('0x7')]()?_0x47b19e[_0x15e4('0x7')]():null);}},'pager':{'type':Sequelize[_0x15e4('0x2')]},'tz':{'type':Sequelize[_0x15e4('0x2')],'defaultValue':_0x15e4('0x8')},'attach':{'type':Sequelize[_0x15e4('0x9')](_0x15e4('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x15e4('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x15e4('0x2')]},'callback':{'type':Sequelize[_0x15e4('0x2')]},'review':{'type':Sequelize[_0x15e4('0x9')](_0x15e4('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x15e4('0x9')](_0x15e4('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x15e4('0x9')](_0x15e4('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x15e4('0x9')](_0x15e4('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x15e4('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x15e4('0x9')](_0x15e4('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x15e4('0x9')](_0x15e4('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x15e4('0x9')](_0x15e4('0xa'),'no'),'defaultValue':_0x15e4('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x15e4('0x9')](_0x15e4('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x15e4('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x15e4('0xc')},'emailsubject':{'type':Sequelize[_0x15e4('0x2')]},'emailbody':{'type':Sequelize[_0x15e4('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x15e4('0xd')],'get':function(){return this[_0x15e4('0xe')](_0x15e4('0xf'))+_0x15e4('0x10')+this[_0x15e4('0xe')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 748847b..afc1fb5 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 _0x16d2=['sort','pick','filter','where','merge','options','findAll','rows','show','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','Voicemails','UserProfileSection','userProfileId','UserProfileResource','catch','update','destroy','params','getMessages','findOne','VoiceMailMessage','nolimit','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','get','error','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order'];(function(_0x987cf2,_0xa636d8){var _0x48e791=function(_0x21851d){while(--_0x21851d){_0x987cf2['push'](_0x987cf2['shift']());}};_0x48e791(++_0xa636d8);}(_0x16d2,0x123));var _0x216d=function(_0x39e26c,_0x1db2d8){_0x39e26c=_0x39e26c-0x0;var _0x29aade=_0x16d2[_0x39e26c];return _0x29aade;};'use strict';var emlformat=require(_0x216d('0x0'));var rimraf=require(_0x216d('0x1'));var zipdir=require(_0x216d('0x2'));var jsonpatch=require(_0x216d('0x3'));var rp=require(_0x216d('0x4'));var moment=require(_0x216d('0x5'));var BPromise=require(_0x216d('0x6'));var Mustache=require(_0x216d('0x7'));var util=require(_0x216d('0x8'));var path=require('path');var sox=require(_0x216d('0x9'));var csv=require(_0x216d('0xa'));var ejs=require(_0x216d('0xb'));var fs=require('fs');var fs_extra=require(_0x216d('0xc'));var _=require(_0x216d('0xd'));var squel=require(_0x216d('0xe'));var crypto=require(_0x216d('0xf'));var jsforce=require(_0x216d('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x216d('0xa'));var querystring=require(_0x216d('0x11'));var Papa=require(_0x216d('0x12'));var Redis=require(_0x216d('0x13'));var authService=require(_0x216d('0x14'));var qs=require(_0x216d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x216d('0x16'));var logger=require('../../config/logger')(_0x216d('0x17'));var utils=require(_0x216d('0x18'));var config=require(_0x216d('0x19'));var licenseUtil=require(_0x216d('0x1a'));var db=require(_0x216d('0x1b'))['db'];function respondWithStatusCode(_0x23ecf9,_0x4c92d9){_0x4c92d9=_0x4c92d9||0xcc;return function(_0xb36a43){if(_0xb36a43){return _0x23ecf9['sendStatus'](_0x4c92d9);}return _0x23ecf9[_0x216d('0x1c')](_0x4c92d9)[_0x216d('0x1d')]();};}function respondWithResult(_0x4dc2a2,_0x165c19){_0x165c19=_0x165c19||0xc8;return function(_0x322e4b){if(_0x322e4b){return _0x4dc2a2['status'](_0x165c19)[_0x216d('0x1e')](_0x322e4b);}};}function respondWithFilteredResult(_0x494e92,_0x448c0d){return function(_0xf571a4){if(_0xf571a4){var _0x4631b0=typeof _0x448c0d[_0x216d('0x1f')]===_0x216d('0x20')&&typeof _0x448c0d[_0x216d('0x21')]===_0x216d('0x20');var _0x1496fe=_0xf571a4[_0x216d('0x22')];var _0x53d464=_0x4631b0?0x0:_0x448c0d[_0x216d('0x1f')];var _0x5124ab=_0x4631b0?_0xf571a4['count']:_0x448c0d[_0x216d('0x1f')]+_0x448c0d[_0x216d('0x21')];var _0x574758;if(_0x5124ab>=_0x1496fe){_0x5124ab=_0x1496fe;_0x574758=0xc8;}else{_0x574758=0xce;}_0x494e92[_0x216d('0x1c')](_0x574758);return _0x494e92[_0x216d('0x23')]('Content-Range',_0x53d464+'-'+_0x5124ab+'/'+_0x1496fe)[_0x216d('0x1e')](_0xf571a4);}return null;};}function patchUpdates(_0x13b8e0){return function(_0x430e81){try{jsonpatch[_0x216d('0x24')](_0x430e81,_0x13b8e0,!![]);}catch(_0x5c3e03){return BPromise[_0x216d('0x25')](_0x5c3e03);}return _0x430e81[_0x216d('0x26')]();};}function saveUpdates(_0x10f299,_0x438981){return function(_0x206782){if(_0x206782){return _0x206782['update'](_0x10f299)[_0x216d('0x27')](function(_0x1bd4db){return _0x1bd4db;});}return null;};}function removeEntity(_0x188494,_0x2880c6){return function(_0x6fa4b3){if(_0x6fa4b3){return _0x6fa4b3['destroy']()[_0x216d('0x27')](function(){var _0xab672=_0x6fa4b3[_0x216d('0x28')]({'plain':!![]});var _0x5998a1='Voicemails';return db['UserProfileResource']['destroy']({'where':{'type':_0x5998a1,'resourceId':_0xab672['id']}})['then'](function(){return _0x6fa4b3;});})[_0x216d('0x27')](function(){_0x188494[_0x216d('0x1c')](0xcc)[_0x216d('0x1d')]();});}};}function handleEntityNotFound(_0x73b509,_0x46d0ef){return function(_0x47fa6d){if(!_0x47fa6d){_0x73b509['sendStatus'](0x194);}return _0x47fa6d;};}function handleError(_0xa7624a,_0x51b2bd){_0x51b2bd=_0x51b2bd||0x1f4;return function(_0x23d1c3){logger[_0x216d('0x29')](_0x23d1c3[_0x216d('0x2a')]);if(_0x23d1c3[_0x216d('0x2b')]){delete _0x23d1c3[_0x216d('0x2b')];}_0xa7624a[_0x216d('0x1c')](_0x51b2bd)[_0x216d('0x2c')](_0x23d1c3);};}exports[_0x216d('0x2d')]=function(_0x169cfa,_0x28f56a){var _0x11be90={},_0x260134={},_0x4537fd={'count':0x0,'rows':[]};var _0x483324=_[_0x216d('0x2e')](db[_0x216d('0x2f')][_0x216d('0x30')],function(_0x510ad9){return{'name':_0x510ad9[_0x216d('0x31')],'type':_0x510ad9[_0x216d('0x32')][_0x216d('0x33')]};});_0x260134[_0x216d('0x34')]=_['map'](_0x483324,_0x216d('0x2b'));_0x260134[_0x216d('0x35')]=_[_0x216d('0x36')](_0x169cfa[_0x216d('0x35')]);_0x260134[_0x216d('0x37')]=_[_0x216d('0x38')](_0x260134[_0x216d('0x34')],_0x260134[_0x216d('0x35')]);_0x11be90[_0x216d('0x39')]=_[_0x216d('0x38')](_0x260134[_0x216d('0x34')],qs['fields'](_0x169cfa[_0x216d('0x35')][_0x216d('0x3a')]));_0x11be90[_0x216d('0x39')]=_0x11be90['attributes'][_0x216d('0x3b')]?_0x11be90[_0x216d('0x39')]:_0x260134['model'];if(!_0x169cfa[_0x216d('0x35')]['hasOwnProperty']('nolimit')){_0x11be90[_0x216d('0x21')]=qs[_0x216d('0x21')](_0x169cfa[_0x216d('0x35')][_0x216d('0x21')]);_0x11be90['offset']=qs['offset'](_0x169cfa['query'][_0x216d('0x1f')]);}_0x11be90[_0x216d('0x3c')]=qs['sort'](_0x169cfa[_0x216d('0x35')][_0x216d('0x3d')]);_0x11be90['where']=qs[_0x216d('0x37')](_[_0x216d('0x3e')](_0x169cfa[_0x216d('0x35')],_0x260134[_0x216d('0x37')]),_0x483324);if(_0x169cfa[_0x216d('0x35')][_0x216d('0x3f')]){_0x11be90[_0x216d('0x40')]=_[_0x216d('0x41')](_0x11be90['where'],{'$or':_['map'](_0x483324,function(_0x281a88){if(_0x281a88[_0x216d('0x32')]!=='VIRTUAL'){var _0xf33f9c={};_0xf33f9c[_0x281a88[_0x216d('0x2b')]]={'$like':'%'+_0x169cfa[_0x216d('0x35')]['filter']+'%'};return _0xf33f9c;}})});}_0x11be90=_[_0x216d('0x41')]({},_0x11be90,_0x169cfa[_0x216d('0x42')]);var _0x13d787={'where':_0x11be90[_0x216d('0x40')]};return db['VoiceMail'][_0x216d('0x22')](_0x13d787)[_0x216d('0x27')](function(_0x5665d7){_0x4537fd[_0x216d('0x22')]=_0x5665d7;if(_0x169cfa[_0x216d('0x35')]['includeAll']){_0x11be90['include']=[{'all':!![]}];}return db[_0x216d('0x2f')][_0x216d('0x43')](_0x11be90);})[_0x216d('0x27')](function(_0x498efe){_0x4537fd[_0x216d('0x44')]=_0x498efe;return _0x4537fd;})['then'](respondWithFilteredResult(_0x28f56a,_0x11be90))['catch'](handleError(_0x28f56a,null));};exports[_0x216d('0x45')]=function(_0x43336e,_0xac81f){var _0x5ddaeb={'raw':!![],'where':{'id':_0x43336e['params']['id']}},_0xaccf45={};_0xaccf45[_0x216d('0x34')]=_[_0x216d('0x36')](db[_0x216d('0x2f')]['rawAttributes']);_0xaccf45[_0x216d('0x35')]=_[_0x216d('0x36')](_0x43336e[_0x216d('0x35')]);_0xaccf45[_0x216d('0x37')]=_['intersection'](_0xaccf45['model'],_0xaccf45['query']);_0x5ddaeb[_0x216d('0x39')]=_[_0x216d('0x38')](_0xaccf45[_0x216d('0x34')],qs[_0x216d('0x3a')](_0x43336e[_0x216d('0x35')][_0x216d('0x3a')]));_0x5ddaeb[_0x216d('0x39')]=_0x5ddaeb[_0x216d('0x39')]['length']?_0x5ddaeb[_0x216d('0x39')]:_0xaccf45[_0x216d('0x34')];if(_0x43336e[_0x216d('0x35')][_0x216d('0x46')]){_0x5ddaeb['include']=[{'all':!![]}];}_0x5ddaeb=_[_0x216d('0x41')]({},_0x5ddaeb,_0x43336e['options']);return db[_0x216d('0x2f')][_0x216d('0x47')](_0x5ddaeb)[_0x216d('0x27')](handleEntityNotFound(_0xac81f,null))['then'](respondWithResult(_0xac81f,null))['catch'](handleError(_0xac81f,null));};exports[_0x216d('0x48')]=function(_0x32d499,_0x3932a3){return db[_0x216d('0x2f')][_0x216d('0x48')](_0x32d499[_0x216d('0x49')],{})['then'](function(_0x4f9274){var _0x26209c=_0x32d499['user'][_0x216d('0x28')]({'plain':!![]});if(!_0x26209c)throw new Error(_0x216d('0x4a'));if(_0x26209c['role']==='user'){var _0x5f37e3=_0x4f9274['get']({'plain':!![]});var _0x1ae9b7=_0x216d('0x4b');return db[_0x216d('0x4c')][_0x216d('0x47')]({'where':{'name':_0x1ae9b7,'userProfileId':_0x26209c[_0x216d('0x4d')]},'raw':!![]})[_0x216d('0x27')](function(_0x29efa8){if(_0x29efa8&&_0x29efa8['autoAssociation']===0x0){return db[_0x216d('0x4e')][_0x216d('0x48')]({'name':_0x5f37e3[_0x216d('0x2b')],'resourceId':_0x5f37e3['id'],'type':_0x29efa8['name'],'sectionId':_0x29efa8['id']},{})[_0x216d('0x27')](function(){return _0x4f9274;});}else{return _0x4f9274;}})[_0x216d('0x4f')](function(_0x2c7c67){logger[_0x216d('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c7c67);throw _0x2c7c67;});}return _0x4f9274;})[_0x216d('0x27')](respondWithResult(_0x3932a3,0xc9))[_0x216d('0x4f')](handleError(_0x3932a3,null));};exports[_0x216d('0x50')]=function(_0x1a4761,_0x4d7705){if(_0x1a4761[_0x216d('0x49')]['id']){delete _0x1a4761[_0x216d('0x49')]['id'];}return db['VoiceMail'][_0x216d('0x47')]({'where':{'id':_0x1a4761['params']['id']}})[_0x216d('0x27')](handleEntityNotFound(_0x4d7705,null))[_0x216d('0x27')](saveUpdates(_0x1a4761[_0x216d('0x49')],null))[_0x216d('0x27')](respondWithResult(_0x4d7705,null))[_0x216d('0x4f')](handleError(_0x4d7705,null));};exports[_0x216d('0x51')]=function(_0x24297f,_0x2c6cb6){return db[_0x216d('0x2f')]['find']({'where':{'id':_0x24297f[_0x216d('0x52')]['id']}})[_0x216d('0x27')](handleEntityNotFound(_0x2c6cb6,null))['then'](removeEntity(_0x2c6cb6,null))[_0x216d('0x4f')](handleError(_0x2c6cb6,null));};exports[_0x216d('0x53')]=function(_0x59fa28,_0x4edf77,_0x3a0ee7){return db['VoiceMail'][_0x216d('0x54')]({'where':{'id':_0x59fa28[_0x216d('0x52')]['id']}})[_0x216d('0x27')](handleEntityNotFound(_0x4edf77,null))['then'](function(_0x3acd4b){var _0x5112ea;var _0x5d96b3={},_0x462225={};_0x462225[_0x216d('0x34')]=_['keys'](db[_0x216d('0x55')][_0x216d('0x30')]);_0x462225[_0x216d('0x35')]=_[_0x216d('0x36')](_0x59fa28[_0x216d('0x35')]);_0x462225[_0x216d('0x37')]=_['intersection'](_0x462225['model'],_0x462225[_0x216d('0x35')]);_0x5d96b3[_0x216d('0x39')]=_[_0x216d('0x38')](_0x462225[_0x216d('0x34')],qs[_0x216d('0x3a')](_0x59fa28[_0x216d('0x35')][_0x216d('0x3a')]));_0x5d96b3[_0x216d('0x39')]=_0x5d96b3[_0x216d('0x39')][_0x216d('0x3b')]?_0x5d96b3[_0x216d('0x39')]:_0x462225[_0x216d('0x34')];if(!_0x59fa28['query']['hasOwnProperty'](_0x216d('0x56'))){_0x5d96b3[_0x216d('0x21')]=qs['limit'](_0x59fa28[_0x216d('0x35')]['limit']);_0x5d96b3['offset']=qs[_0x216d('0x1f')](_0x59fa28[_0x216d('0x35')][_0x216d('0x1f')]);}_0x5d96b3[_0x216d('0x3c')]=qs[_0x216d('0x3d')](_0x59fa28[_0x216d('0x35')][_0x216d('0x3d')]);_0x5d96b3[_0x216d('0x40')]=qs[_0x216d('0x37')](_[_0x216d('0x3e')](_0x59fa28[_0x216d('0x35')],_0x462225[_0x216d('0x37')]));if(_0x59fa28[_0x216d('0x35')][_0x216d('0x3f')]){_0x5d96b3[_0x216d('0x40')]=_[_0x216d('0x41')](_0x5d96b3[_0x216d('0x40')],{'$or':_[_0x216d('0x2e')](_0x5d96b3[_0x216d('0x39')],function(_0x34540e){var _0xb9302={};_0xb9302[_0x34540e]={'$like':'%'+_0x59fa28[_0x216d('0x35')]['filter']+'%'};return _0xb9302;})});}_0x5d96b3[_0x216d('0x40')]=_['merge'](_0x5d96b3[_0x216d('0x40')],{'mailboxuser':_0x3acd4b['mailbox']});_0x5d96b3=_[_0x216d('0x41')]({},_0x5d96b3,_0x59fa28[_0x216d('0x42')]);return db['VoiceMailMessage'][_0x216d('0x57')](_0x5d96b3)[_0x216d('0x27')](respondWithFilteredResult(_0x4edf77,_0x5d96b3));})[_0x216d('0x4f')](handleError(_0x4edf77,null));}; \ No newline at end of file +var _0x4e81=['merge','VIRTUAL','filter','options','rows','catch','show','params','length','includeAll','include','find','create','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','destroy','findOne','VoiceMailMessage','hasOwnProperty','pick','findAndCountAll','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','get','Voicemails','UserProfileResource','end','name','index','map','VoiceMail','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where'];(function(_0xc65834,_0x5df6fb){var _0x5da298=function(_0x30fbc2){while(--_0x30fbc2){_0xc65834['push'](_0xc65834['shift']());}};_0x5da298(++_0x5df6fb);}(_0x4e81,0x1bc));var _0x14e8=function(_0x4eafed,_0x26e2bc){_0x4eafed=_0x4eafed-0x0;var _0x159c85=_0x4e81[_0x4eafed];return _0x159c85;};'use strict';var emlformat=require(_0x14e8('0x0'));var rimraf=require(_0x14e8('0x1'));var zipdir=require(_0x14e8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x14e8('0x3'));var Mustache=require(_0x14e8('0x4'));var util=require(_0x14e8('0x5'));var path=require(_0x14e8('0x6'));var sox=require(_0x14e8('0x7'));var csv=require(_0x14e8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x14e8('0x9'));var squel=require(_0x14e8('0xa'));var crypto=require(_0x14e8('0xb'));var jsforce=require(_0x14e8('0xc'));var deskjs=require(_0x14e8('0xd'));var toCsv=require(_0x14e8('0x8'));var querystring=require(_0x14e8('0xe'));var Papa=require(_0x14e8('0xf'));var Redis=require(_0x14e8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x14e8('0x11'));var as=require(_0x14e8('0x12'));var hardwareService=require(_0x14e8('0x13'));var logger=require(_0x14e8('0x14'))(_0x14e8('0x15'));var utils=require(_0x14e8('0x16'));var config=require(_0x14e8('0x17'));var licenseUtil=require(_0x14e8('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37eccb,_0x59c6c9){_0x59c6c9=_0x59c6c9||0xcc;return function(_0x2607ef){if(_0x2607ef){return _0x37eccb[_0x14e8('0x19')](_0x59c6c9);}return _0x37eccb[_0x14e8('0x1a')](_0x59c6c9)['end']();};}function respondWithResult(_0x22fa86,_0x4e1064){_0x4e1064=_0x4e1064||0xc8;return function(_0x458e4a){if(_0x458e4a){return _0x22fa86['status'](_0x4e1064)[_0x14e8('0x1b')](_0x458e4a);}};}function respondWithFilteredResult(_0x3761a1,_0xc6101f){return function(_0x135996){if(_0x135996){var _0x52e64f=typeof _0xc6101f[_0x14e8('0x1c')]===_0x14e8('0x1d')&&typeof _0xc6101f[_0x14e8('0x1e')]===_0x14e8('0x1d');var _0xd4d6b2=_0x135996[_0x14e8('0x1f')];var _0x10dc8b=_0x52e64f?0x0:_0xc6101f[_0x14e8('0x1c')];var _0x5a38c1=_0x52e64f?_0x135996[_0x14e8('0x1f')]:_0xc6101f[_0x14e8('0x1c')]+_0xc6101f[_0x14e8('0x1e')];var _0x7b10f2;if(_0x5a38c1>=_0xd4d6b2){_0x5a38c1=_0xd4d6b2;_0x7b10f2=0xc8;}else{_0x7b10f2=0xce;}_0x3761a1[_0x14e8('0x1a')](_0x7b10f2);return _0x3761a1['set'](_0x14e8('0x20'),_0x10dc8b+'-'+_0x5a38c1+'/'+_0xd4d6b2)[_0x14e8('0x1b')](_0x135996);}return null;};}function patchUpdates(_0x2abfec){return function(_0x48e30a){try{jsonpatch[_0x14e8('0x21')](_0x48e30a,_0x2abfec,!![]);}catch(_0x47f060){return BPromise[_0x14e8('0x22')](_0x47f060);}return _0x48e30a[_0x14e8('0x23')]();};}function saveUpdates(_0x3e8d5c,_0x117b00){return function(_0xcf673){if(_0xcf673){return _0xcf673['update'](_0x3e8d5c)[_0x14e8('0x24')](function(_0x5b11f9){return _0x5b11f9;});}return null;};}function removeEntity(_0x31bdd3,_0x185a0e){return function(_0x4ffc8b){if(_0x4ffc8b){return _0x4ffc8b['destroy']()['then'](function(){var _0x4a758c=_0x4ffc8b[_0x14e8('0x25')]({'plain':!![]});var _0x3eae0b=_0x14e8('0x26');return db[_0x14e8('0x27')]['destroy']({'where':{'type':_0x3eae0b,'resourceId':_0x4a758c['id']}})[_0x14e8('0x24')](function(){return _0x4ffc8b;});})[_0x14e8('0x24')](function(){_0x31bdd3[_0x14e8('0x1a')](0xcc)[_0x14e8('0x28')]();});}};}function handleEntityNotFound(_0x28035a,_0xfc0545){return function(_0x2813ae){if(!_0x2813ae){_0x28035a['sendStatus'](0x194);}return _0x2813ae;};}function handleError(_0x38d7a7,_0x151090){_0x151090=_0x151090||0x1f4;return function(_0x393ab0){logger['error'](_0x393ab0['stack']);if(_0x393ab0['name']){delete _0x393ab0[_0x14e8('0x29')];}_0x38d7a7[_0x14e8('0x1a')](_0x151090)['send'](_0x393ab0);};}exports[_0x14e8('0x2a')]=function(_0x1d71ca,_0x176e8f){var _0xa83433={},_0x5c2635={},_0x1f1259={'count':0x0,'rows':[]};var _0x260d51=_[_0x14e8('0x2b')](db[_0x14e8('0x2c')][_0x14e8('0x2d')],function(_0x54068d){return{'name':_0x54068d[_0x14e8('0x2e')],'type':_0x54068d[_0x14e8('0x2f')][_0x14e8('0x30')]};});_0x5c2635[_0x14e8('0x31')]=_['map'](_0x260d51,_0x14e8('0x29'));_0x5c2635['query']=_[_0x14e8('0x32')](_0x1d71ca[_0x14e8('0x33')]);_0x5c2635[_0x14e8('0x34')]=_[_0x14e8('0x35')](_0x5c2635[_0x14e8('0x31')],_0x5c2635[_0x14e8('0x33')]);_0xa83433[_0x14e8('0x36')]=_[_0x14e8('0x35')](_0x5c2635[_0x14e8('0x31')],qs[_0x14e8('0x37')](_0x1d71ca[_0x14e8('0x33')][_0x14e8('0x37')]));_0xa83433['attributes']=_0xa83433['attributes']['length']?_0xa83433[_0x14e8('0x36')]:_0x5c2635['model'];if(!_0x1d71ca[_0x14e8('0x33')]['hasOwnProperty'](_0x14e8('0x38'))){_0xa83433[_0x14e8('0x1e')]=qs[_0x14e8('0x1e')](_0x1d71ca[_0x14e8('0x33')]['limit']);_0xa83433[_0x14e8('0x1c')]=qs['offset'](_0x1d71ca[_0x14e8('0x33')][_0x14e8('0x1c')]);}_0xa83433[_0x14e8('0x39')]=qs[_0x14e8('0x3a')](_0x1d71ca[_0x14e8('0x33')][_0x14e8('0x3a')]);_0xa83433['where']=qs[_0x14e8('0x34')](_['pick'](_0x1d71ca[_0x14e8('0x33')],_0x5c2635[_0x14e8('0x34')]),_0x260d51);if(_0x1d71ca[_0x14e8('0x33')]['filter']){_0xa83433[_0x14e8('0x3b')]=_[_0x14e8('0x3c')](_0xa83433['where'],{'$or':_[_0x14e8('0x2b')](_0x260d51,function(_0x38b874){if(_0x38b874[_0x14e8('0x2f')]!==_0x14e8('0x3d')){var _0x77e8a0={};_0x77e8a0[_0x38b874[_0x14e8('0x29')]]={'$like':'%'+_0x1d71ca[_0x14e8('0x33')][_0x14e8('0x3e')]+'%'};return _0x77e8a0;}})});}_0xa83433=_[_0x14e8('0x3c')]({},_0xa83433,_0x1d71ca[_0x14e8('0x3f')]);var _0x11f0ee={'where':_0xa83433[_0x14e8('0x3b')]};return db[_0x14e8('0x2c')][_0x14e8('0x1f')](_0x11f0ee)[_0x14e8('0x24')](function(_0x596ac7){_0x1f1259[_0x14e8('0x1f')]=_0x596ac7;if(_0x1d71ca['query']['includeAll']){_0xa83433['include']=[{'all':!![]}];}return db[_0x14e8('0x2c')]['findAll'](_0xa83433);})[_0x14e8('0x24')](function(_0x45bff0){_0x1f1259[_0x14e8('0x40')]=_0x45bff0;return _0x1f1259;})[_0x14e8('0x24')](respondWithFilteredResult(_0x176e8f,_0xa83433))[_0x14e8('0x41')](handleError(_0x176e8f,null));};exports[_0x14e8('0x42')]=function(_0x125af5,_0xd52530){var _0x2ccd6c={'raw':!![],'where':{'id':_0x125af5[_0x14e8('0x43')]['id']}},_0x3f9da0={};_0x3f9da0['model']=_[_0x14e8('0x32')](db[_0x14e8('0x2c')][_0x14e8('0x2d')]);_0x3f9da0[_0x14e8('0x33')]=_['keys'](_0x125af5[_0x14e8('0x33')]);_0x3f9da0[_0x14e8('0x34')]=_['intersection'](_0x3f9da0['model'],_0x3f9da0[_0x14e8('0x33')]);_0x2ccd6c['attributes']=_['intersection'](_0x3f9da0[_0x14e8('0x31')],qs[_0x14e8('0x37')](_0x125af5['query'][_0x14e8('0x37')]));_0x2ccd6c[_0x14e8('0x36')]=_0x2ccd6c['attributes'][_0x14e8('0x44')]?_0x2ccd6c[_0x14e8('0x36')]:_0x3f9da0[_0x14e8('0x31')];if(_0x125af5[_0x14e8('0x33')][_0x14e8('0x45')]){_0x2ccd6c[_0x14e8('0x46')]=[{'all':!![]}];}_0x2ccd6c=_[_0x14e8('0x3c')]({},_0x2ccd6c,_0x125af5[_0x14e8('0x3f')]);return db[_0x14e8('0x2c')][_0x14e8('0x47')](_0x2ccd6c)[_0x14e8('0x24')](handleEntityNotFound(_0xd52530,null))[_0x14e8('0x24')](respondWithResult(_0xd52530,null))[_0x14e8('0x41')](handleError(_0xd52530,null));};exports[_0x14e8('0x48')]=function(_0x1bf742,_0x1f50bc){return db['VoiceMail'][_0x14e8('0x48')](_0x1bf742['body'],{})[_0x14e8('0x24')](function(_0x3fadc2){var _0x403628=_0x1bf742[_0x14e8('0x49')]['get']({'plain':!![]});if(!_0x403628)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x403628['role']===_0x14e8('0x49')){var _0x49657e=_0x3fadc2['get']({'plain':!![]});var _0xd2b281=_0x14e8('0x26');return db['UserProfileSection'][_0x14e8('0x47')]({'where':{'name':_0xd2b281,'userProfileId':_0x403628[_0x14e8('0x4a')]},'raw':!![]})[_0x14e8('0x24')](function(_0x416e65){if(_0x416e65&&_0x416e65['autoAssociation']===0x0){return db['UserProfileResource'][_0x14e8('0x48')]({'name':_0x49657e[_0x14e8('0x29')],'resourceId':_0x49657e['id'],'type':_0x416e65[_0x14e8('0x29')],'sectionId':_0x416e65['id']},{})[_0x14e8('0x24')](function(){return _0x3fadc2;});}else{return _0x3fadc2;}})[_0x14e8('0x41')](function(_0x2fbac7){logger['error'](_0x14e8('0x4b'),_0x2fbac7);throw _0x2fbac7;});}return _0x3fadc2;})[_0x14e8('0x24')](respondWithResult(_0x1f50bc,0xc9))[_0x14e8('0x41')](handleError(_0x1f50bc,null));};exports[_0x14e8('0x4c')]=function(_0x5e6083,_0x2af48f){if(_0x5e6083[_0x14e8('0x4d')]['id']){delete _0x5e6083[_0x14e8('0x4d')]['id'];}return db[_0x14e8('0x2c')]['find']({'where':{'id':_0x5e6083[_0x14e8('0x43')]['id']}})[_0x14e8('0x24')](handleEntityNotFound(_0x2af48f,null))[_0x14e8('0x24')](saveUpdates(_0x5e6083[_0x14e8('0x4d')],null))[_0x14e8('0x24')](respondWithResult(_0x2af48f,null))[_0x14e8('0x41')](handleError(_0x2af48f,null));};exports[_0x14e8('0x4e')]=function(_0x168b8a,_0x5ab659){return db['VoiceMail'][_0x14e8('0x47')]({'where':{'id':_0x168b8a[_0x14e8('0x43')]['id']}})[_0x14e8('0x24')](handleEntityNotFound(_0x5ab659,null))[_0x14e8('0x24')](removeEntity(_0x5ab659,null))[_0x14e8('0x41')](handleError(_0x5ab659,null));};exports['getMessages']=function(_0x4a631a,_0x4c49e5,_0xf8a05d){return db[_0x14e8('0x2c')][_0x14e8('0x4f')]({'where':{'id':_0x4a631a['params']['id']}})[_0x14e8('0x24')](handleEntityNotFound(_0x4c49e5,null))[_0x14e8('0x24')](function(_0x1d6683){var _0x54e164;var _0x274837={},_0x63b342={};_0x63b342[_0x14e8('0x31')]=_[_0x14e8('0x32')](db[_0x14e8('0x50')][_0x14e8('0x2d')]);_0x63b342[_0x14e8('0x33')]=_[_0x14e8('0x32')](_0x4a631a[_0x14e8('0x33')]);_0x63b342[_0x14e8('0x34')]=_[_0x14e8('0x35')](_0x63b342['model'],_0x63b342[_0x14e8('0x33')]);_0x274837[_0x14e8('0x36')]=_[_0x14e8('0x35')](_0x63b342[_0x14e8('0x31')],qs[_0x14e8('0x37')](_0x4a631a[_0x14e8('0x33')][_0x14e8('0x37')]));_0x274837[_0x14e8('0x36')]=_0x274837[_0x14e8('0x36')][_0x14e8('0x44')]?_0x274837[_0x14e8('0x36')]:_0x63b342[_0x14e8('0x31')];if(!_0x4a631a['query'][_0x14e8('0x51')](_0x14e8('0x38'))){_0x274837['limit']=qs[_0x14e8('0x1e')](_0x4a631a[_0x14e8('0x33')][_0x14e8('0x1e')]);_0x274837[_0x14e8('0x1c')]=qs[_0x14e8('0x1c')](_0x4a631a[_0x14e8('0x33')][_0x14e8('0x1c')]);}_0x274837['order']=qs['sort'](_0x4a631a['query'][_0x14e8('0x3a')]);_0x274837[_0x14e8('0x3b')]=qs[_0x14e8('0x34')](_[_0x14e8('0x52')](_0x4a631a[_0x14e8('0x33')],_0x63b342[_0x14e8('0x34')]));if(_0x4a631a[_0x14e8('0x33')]['filter']){_0x274837[_0x14e8('0x3b')]=_[_0x14e8('0x3c')](_0x274837['where'],{'$or':_[_0x14e8('0x2b')](_0x274837[_0x14e8('0x36')],function(_0x4c3ead){var _0x58fa2e={};_0x58fa2e[_0x4c3ead]={'$like':'%'+_0x4a631a['query'][_0x14e8('0x3e')]+'%'};return _0x58fa2e;})});}_0x274837[_0x14e8('0x3b')]=_[_0x14e8('0x3c')](_0x274837[_0x14e8('0x3b')],{'mailboxuser':_0x1d6683['mailbox']});_0x274837=_[_0x14e8('0x3c')]({},_0x274837,_0x4a631a[_0x14e8('0x3f')]);return db[_0x14e8('0x50')][_0x14e8('0x53')](_0x274837)[_0x14e8('0x24')](respondWithFilteredResult(_0x4c49e5,_0x274837));})[_0x14e8('0x41')](handleError(_0x4c49e5,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 441b4b7..2aeca76 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 _0xc3e9=['util','api','moment','request-promise','path','../../config/environment','./voiceMail.attributes','exports','define','voice_voicemail','mailbox_context','mailbox','lodash'];(function(_0x190148,_0xda6bdd){var _0x5009de=function(_0x19c769){while(--_0x19c769){_0x190148['push'](_0x190148['shift']());}};_0x5009de(++_0xda6bdd);}(_0xc3e9,0x1e0));var _0x9c3e=function(_0x396694,_0x3d75b5){_0x396694=_0x396694-0x0;var _0x59d77e=_0xc3e9[_0x396694];return _0x59d77e;};'use strict';var _=require(_0x9c3e('0x0'));var util=require(_0x9c3e('0x1'));var logger=require('../../config/logger')(_0x9c3e('0x2'));var moment=require(_0x9c3e('0x3'));var BPromise=require('bluebird');var rp=require(_0x9c3e('0x4'));var fs=require('fs');var path=require(_0x9c3e('0x5'));var rimraf=require('rimraf');var config=require(_0x9c3e('0x6'));var attributes=require(_0x9c3e('0x7'));module[_0x9c3e('0x8')]=function(_0x27985f,_0x344f0e){return _0x27985f[_0x9c3e('0x9')]('VoiceMail',attributes,{'tableName':_0x9c3e('0xa'),'paranoid':![],'indexes':[{'name':_0x9c3e('0xb'),'fields':[_0x9c3e('0xc'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8b6f=['context','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context'];(function(_0x5083df,_0x31eda2){var _0xec2862=function(_0x165d17){while(--_0x165d17){_0x5083df['push'](_0x5083df['shift']());}};_0xec2862(++_0x31eda2);}(_0x8b6f,0x119));var _0xf8b6=function(_0x364339,_0x4732dd){_0x364339=_0x364339-0x0;var _0x7b5072=_0x8b6f[_0x364339];return _0x7b5072;};'use strict';var _=require(_0xf8b6('0x0'));var util=require('util');var logger=require(_0xf8b6('0x1'))(_0xf8b6('0x2'));var moment=require(_0xf8b6('0x3'));var BPromise=require(_0xf8b6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf8b6('0x5'));var rimraf=require('rimraf');var config=require(_0xf8b6('0x6'));var attributes=require(_0xf8b6('0x7'));module[_0xf8b6('0x8')]=function(_0x42c64e,_0x45e352){return _0x42c64e[_0xf8b6('0x9')](_0xf8b6('0xa'),attributes,{'tableName':_0xf8b6('0xb'),'paranoid':![],'indexes':[{'name':_0xf8b6('0xc'),'fields':['mailbox',_0xf8b6('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 98506f6..1280a6e 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 _0x5611=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s'];(function(_0x321c77,_0x2334e9){var _0x37b98c=function(_0x3233d5){while(--_0x3233d5){_0x321c77['push'](_0x321c77['shift']());}};_0x37b98c(++_0x2334e9);}(_0x5611,0x96));var _0x1561=function(_0x186941,_0x1f259b){_0x186941=_0x186941-0x0;var _0x52da3c=_0x5611[_0x186941];return _0x52da3c;};'use strict';var _=require(_0x1561('0x0'));var util=require(_0x1561('0x1'));var moment=require(_0x1561('0x2'));var BPromise=require(_0x1561('0x3'));var rs=require(_0x1561('0x4'));var fs=require('fs');var Redis=require(_0x1561('0x5'));var db=require(_0x1561('0x6'))['db'];var utils=require(_0x1561('0x7'));var logger=require(_0x1561('0x8'))(_0x1561('0x9'));var config=require(_0x1561('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1561('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x113892,_0x46a5c6,_0xc7018d){return new BPromise(function(_0x448117,_0x12dcb1){return client['request'](_0x113892,_0xc7018d)[_0x1561('0xc')](function(_0x135d36){logger[_0x1561('0xd')](_0x1561('0xe'),_0x46a5c6,_0x1561('0xf'));logger[_0x1561('0x10')](_0x1561('0x11'),_0x46a5c6,_0x1561('0xf'),JSON[_0x1561('0x12')](_0x135d36));if(_0x135d36[_0x1561('0x13')]){if(_0x135d36['error'][_0x1561('0x14')]===0x1f4){logger[_0x1561('0x13')](_0x1561('0xe'),_0x46a5c6,_0x135d36[_0x1561('0x13')][_0x1561('0x15')]);return _0x12dcb1(_0x135d36[_0x1561('0x13')][_0x1561('0x15')]);}logger['error'](_0x1561('0xe'),_0x46a5c6,_0x135d36[_0x1561('0x13')][_0x1561('0x15')]);return _0x448117(_0x135d36[_0x1561('0x13')][_0x1561('0x15')]);}else{logger['info'](_0x1561('0xe'),_0x46a5c6,_0x1561('0xf'));_0x448117(_0x135d36[_0x1561('0x16')][_0x1561('0x15')]);}})[_0x1561('0x17')](function(_0x59a2cb){logger[_0x1561('0x13')](_0x1561('0xe'),_0x46a5c6,_0x59a2cb);_0x12dcb1(_0x59a2cb);});});} \ No newline at end of file +var _0xeae9=['info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3cd269,_0x228e0f){var _0x55e04b=function(_0xfb1fe2){while(--_0xfb1fe2){_0x3cd269['push'](_0x3cd269['shift']());}};_0x55e04b(++_0x228e0f);}(_0xeae9,0x16a));var _0x9eae=function(_0x1dce4a,_0x45dc6d){_0x1dce4a=_0x1dce4a-0x0;var _0x1231eb=_0xeae9[_0x1dce4a];return _0x1231eb;};'use strict';var _=require(_0x9eae('0x0'));var util=require(_0x9eae('0x1'));var moment=require(_0x9eae('0x2'));var BPromise=require('bluebird');var rs=require(_0x9eae('0x3'));var fs=require('fs');var Redis=require(_0x9eae('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9eae('0x5'));var config=require(_0x9eae('0x6'));var jayson=require(_0x9eae('0x7'));var client=jayson[_0x9eae('0x8')][_0x9eae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe81838,_0x283a9a,_0x4594ff){return new BPromise(function(_0x845d38,_0x460ea5){return client[_0x9eae('0xa')](_0xe81838,_0x4594ff)[_0x9eae('0xb')](function(_0x4b5679){logger[_0x9eae('0xc')](_0x9eae('0xd'),_0x283a9a,_0x9eae('0xe'));logger[_0x9eae('0xf')](_0x9eae('0x10'),_0x283a9a,'request\x20sent',JSON[_0x9eae('0x11')](_0x4b5679));if(_0x4b5679['error']){if(_0x4b5679[_0x9eae('0x12')][_0x9eae('0x13')]===0x1f4){logger[_0x9eae('0x12')]('VoiceMail,\x20%s,\x20%s',_0x283a9a,_0x4b5679['error'][_0x9eae('0x14')]);return _0x460ea5(_0x4b5679[_0x9eae('0x12')][_0x9eae('0x14')]);}logger[_0x9eae('0x12')](_0x9eae('0xd'),_0x283a9a,_0x4b5679[_0x9eae('0x12')]['message']);return _0x845d38(_0x4b5679['error'][_0x9eae('0x14')]);}else{logger[_0x9eae('0xc')]('VoiceMail,\x20%s,\x20%s',_0x283a9a,_0x9eae('0xe'));_0x845d38(_0x4b5679['result']['message']);}})[_0x9eae('0x15')](function(_0x3519ce){logger[_0x9eae('0x12')]('VoiceMail,\x20%s,\x20%s',_0x283a9a,_0x3519ce);_0x460ea5(_0x3519ce);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index cf35559..ae7c068 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 _0x680a=['download','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','index','get','/:id','show','/:id/download'];(function(_0x126fb9,_0x122c59){var _0xc8a3b1=function(_0x355744){while(--_0x355744){_0x126fb9['push'](_0x126fb9['shift']());}};_0xc8a3b1(++_0x122c59);}(_0x680a,0x159));var _0xa680=function(_0x2a5be4,_0x2a0c89){_0x2a5be4=_0x2a5be4-0x0;var _0x2833aa=_0x680a[_0x2a5be4];return _0x2833aa;};'use strict';var multer=require(_0xa680('0x0'));var util=require(_0xa680('0x1'));var path=require(_0xa680('0x2'));var timeout=require(_0xa680('0x3'));var express=require('express');var router=express[_0xa680('0x4')]();var fs_extra=require(_0xa680('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa680('0x6'));var config=require(_0xa680('0x7'));var controller=require(_0xa680('0x8'));router['get']('/',auth[_0xa680('0x9')](),controller[_0xa680('0xa')]);router[_0xa680('0xb')](_0xa680('0xc'),auth['isAuthenticated'](),controller[_0xa680('0xd')]);router[_0xa680('0xb')](_0xa680('0xe'),auth['isAuthenticated'](),controller[_0xa680('0xf')]);router['post']('/',auth[_0xa680('0x9')](),controller['create']);router[_0xa680('0x10')](_0xa680('0xc'),auth[_0xa680('0x9')](),controller[_0xa680('0x11')]);router[_0xa680('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xa680('0x13')]);module['exports']=router; \ No newline at end of file +var _0x6cb5=['./voiceMailMessage.controller','get','isAuthenticated','index','/:id','/:id/download','download','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x18a781,_0x305d9b){var _0x2e46ef=function(_0x5e38e3){while(--_0x5e38e3){_0x18a781['push'](_0x18a781['shift']());}};_0x2e46ef(++_0x305d9b);}(_0x6cb5,0x147));var _0x56cb=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x6cb5[_0x45e98e];return _0x374dba;};'use strict';var multer=require(_0x56cb('0x0'));var util=require(_0x56cb('0x1'));var path=require(_0x56cb('0x2'));var timeout=require(_0x56cb('0x3'));var express=require(_0x56cb('0x4'));var router=express[_0x56cb('0x5')]();var fs_extra=require(_0x56cb('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x56cb('0x7'));var config=require(_0x56cb('0x8'));var controller=require(_0x56cb('0x9'));router[_0x56cb('0xa')]('/',auth[_0x56cb('0xb')](),controller[_0x56cb('0xc')]);router[_0x56cb('0xa')](_0x56cb('0xd'),auth[_0x56cb('0xb')](),controller['show']);router[_0x56cb('0xa')](_0x56cb('0xe'),auth[_0x56cb('0xb')](),controller[_0x56cb('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x56cb('0x10')]);router[_0x56cb('0x11')](_0x56cb('0xd'),auth[_0x56cb('0xb')](),controller['update']);router[_0x56cb('0x12')]('/:id',auth[_0x56cb('0xb')](),controller[_0x56cb('0x13')]);module[_0x56cb('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 9f97113..dd11b84 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 _0xdec0=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','VIRTUAL','getDataValue','STRING','long','TIMESTAMP','literal'];(function(_0x395e92,_0x2ff5cd){var _0x574aa1=function(_0xecd86b){while(--_0xecd86b){_0x395e92['push'](_0x395e92['shift']());}};_0x574aa1(++_0x2ff5cd);}(_0xdec0,0x69));var _0x0dec=function(_0x34b821,_0x504e55){_0x34b821=_0x34b821-0x0;var _0x5e00a0=_0xdec0[_0x34b821];return _0x5e00a0;};'use strict';var Sequelize=require('sequelize');module[_0x0dec('0x0')]={'name':{'type':Sequelize[_0x0dec('0x1')],'get':function(_0x180787){return this[_0x0dec('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x0dec('0x3')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x0dec('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x0dec('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x0dec('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x0dec('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x0dec('0x3')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x0dec('0x4')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x0dec('0x3')],'defaultValue':''},'stamp':{'type':_0x0dec('0x5'),'defaultValue':Sequelize[_0x0dec('0x6')](_0x0dec('0x7'))}}; \ No newline at end of file +var _0xbd66=['sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','TIMESTAMP','literal'];(function(_0x1d3a5d,_0x17fc32){var _0x257078=function(_0x482f3a){while(--_0x482f3a){_0x1d3a5d['push'](_0x1d3a5d['shift']());}};_0x257078(++_0x17fc32);}(_0xbd66,0x1ef));var _0x6bd6=function(_0xa439fd,_0x29efdd){_0xa439fd=_0xa439fd-0x0;var _0x3a1928=_0xbd66[_0xa439fd];return _0x3a1928;};'use strict';var Sequelize=require(_0x6bd6('0x0'));module[_0x6bd6('0x1')]={'name':{'type':Sequelize[_0x6bd6('0x2')],'get':function(_0x5a4614){return this[_0x6bd6('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x6bd6('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x6bd6('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x6bd6('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x6bd6('0x5')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x6bd6('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x6bd6('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0x6bd6('0x6')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x6bd6('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x6bd6('0x7'),'defaultValue':Sequelize[_0x6bd6('0x8')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 7058dad..89c7355 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 _0xa967=['zip-dir','request-promise','bluebird','mustache','path','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','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','key','model','differenceBy','keys','filters','intersection','query','attributes','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','includeAll','findAll','rows','catch','params','fields','include','options','find','create','body','download','recording','audio/wav','attachment','msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf'];(function(_0x564adc,_0x4cb97f){var _0xa98e9a=function(_0x3c8ec3){while(--_0x3c8ec3){_0x564adc['push'](_0x564adc['shift']());}};_0xa98e9a(++_0x4cb97f);}(_0xa967,0x14a));var _0x7a96=function(_0x1c136c,_0x12a99d){_0x1c136c=_0x1c136c-0x0;var _0x5f27d0=_0xa967[_0x1c136c];return _0x5f27d0;};'use strict';var emlformat=require(_0x7a96('0x0'));var rimraf=require(_0x7a96('0x1'));var zipdir=require(_0x7a96('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7a96('0x3'));var moment=require('moment');var BPromise=require(_0x7a96('0x4'));var Mustache=require(_0x7a96('0x5'));var util=require('util');var path=require(_0x7a96('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7a96('0x7'));var fs=require('fs');var fs_extra=require(_0x7a96('0x8'));var _=require(_0x7a96('0x9'));var squel=require(_0x7a96('0xa'));var crypto=require(_0x7a96('0xb'));var jsforce=require(_0x7a96('0xc'));var deskjs=require(_0x7a96('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7a96('0xe'));var Papa=require('papaparse');var Redis=require(_0x7a96('0xf'));var authService=require(_0x7a96('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7a96('0x11'));var hardwareService=require(_0x7a96('0x12'));var logger=require(_0x7a96('0x13'))(_0x7a96('0x14'));var utils=require('../../config/utils');var config=require(_0x7a96('0x15'));var licenseUtil=require(_0x7a96('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b68b4,_0x5321ca){_0x5321ca=_0x5321ca||0xcc;return function(_0x439a3d){if(_0x439a3d){return _0x5b68b4[_0x7a96('0x17')](_0x5321ca);}return _0x5b68b4['status'](_0x5321ca)[_0x7a96('0x18')]();};}function respondWithResult(_0x27907e,_0x45b55a){_0x45b55a=_0x45b55a||0xc8;return function(_0x3ae816){if(_0x3ae816){return _0x27907e[_0x7a96('0x19')](_0x45b55a)[_0x7a96('0x1a')](_0x3ae816);}};}function respondWithFilteredResult(_0x1b00af,_0x5be1ab){return function(_0x29ba95){if(_0x29ba95){var _0x3cac36=typeof _0x5be1ab[_0x7a96('0x1b')]===_0x7a96('0x1c')&&typeof _0x5be1ab[_0x7a96('0x1d')]===_0x7a96('0x1c');var _0x4038f4=_0x29ba95[_0x7a96('0x1e')];var _0x1289f0=_0x3cac36?0x0:_0x5be1ab[_0x7a96('0x1b')];var _0x435d14=_0x3cac36?_0x29ba95[_0x7a96('0x1e')]:_0x5be1ab[_0x7a96('0x1b')]+_0x5be1ab[_0x7a96('0x1d')];var _0x433403;if(_0x435d14>=_0x4038f4){_0x435d14=_0x4038f4;_0x433403=0xc8;}else{_0x433403=0xce;}_0x1b00af['status'](_0x433403);return _0x1b00af['set'](_0x7a96('0x1f'),_0x1289f0+'-'+_0x435d14+'/'+_0x4038f4)['json'](_0x29ba95);}return null;};}function patchUpdates(_0x308cee){return function(_0x43e1e6){try{jsonpatch[_0x7a96('0x20')](_0x43e1e6,_0x308cee,!![]);}catch(_0xa60662){return BPromise[_0x7a96('0x21')](_0xa60662);}return _0x43e1e6[_0x7a96('0x22')]();};}function saveUpdates(_0x3aed69,_0x518f1f){return function(_0x176b70){if(_0x176b70){return _0x176b70[_0x7a96('0x23')](_0x3aed69)[_0x7a96('0x24')](function(_0x4eaf36){return _0x4eaf36;});}return null;};}function removeEntity(_0x17a3ac,_0x47fa89){return function(_0x1fba77){if(_0x1fba77){return _0x1fba77[_0x7a96('0x25')]()[_0x7a96('0x24')](function(){_0x17a3ac[_0x7a96('0x19')](0xcc)[_0x7a96('0x18')]();});}};}function handleEntityNotFound(_0x1c4d58,_0x260560){return function(_0x4d3fbf){if(!_0x4d3fbf){_0x1c4d58[_0x7a96('0x17')](0x194);}return _0x4d3fbf;};}function handleError(_0xae4490,_0x96ec28){_0x96ec28=_0x96ec28||0x1f4;return function(_0x321a36){logger[_0x7a96('0x26')](_0x321a36[_0x7a96('0x27')]);if(_0x321a36['name']){delete _0x321a36[_0x7a96('0x28')];}_0xae4490[_0x7a96('0x19')](_0x96ec28)[_0x7a96('0x29')](_0x321a36);};}exports[_0x7a96('0x2a')]=function(_0x384b5e,_0x33a59a){var _0x31f8f3={},_0x256727={},_0x1f0354={'count':0x0,'rows':[]};var _0x12fe14=_[_0x7a96('0x2b')](db[_0x7a96('0x2c')][_0x7a96('0x2d')],function(_0x1381a7){return{'name':_0x1381a7[_0x7a96('0x2e')],'type':_0x1381a7['type'][_0x7a96('0x2f')]};});_0x256727[_0x7a96('0x30')]=_[_0x7a96('0x31')](_[_0x7a96('0x2b')](_0x12fe14,_0x7a96('0x28')),[_0x7a96('0x28')]);_0x256727['query']=_[_0x7a96('0x32')](_0x384b5e['query']);_0x256727[_0x7a96('0x33')]=_[_0x7a96('0x34')](_0x256727[_0x7a96('0x30')],_0x256727[_0x7a96('0x35')]);_0x31f8f3[_0x7a96('0x36')]=_[_0x7a96('0x34')](_0x256727[_0x7a96('0x30')],qs['fields'](_0x384b5e[_0x7a96('0x35')]['fields']));_0x31f8f3[_0x7a96('0x36')]=_0x31f8f3[_0x7a96('0x36')][_0x7a96('0x37')]?_0x31f8f3['attributes']:_0x256727[_0x7a96('0x30')];if(!_0x384b5e[_0x7a96('0x35')]['hasOwnProperty'](_0x7a96('0x38'))){_0x31f8f3['limit']=qs[_0x7a96('0x1d')](_0x384b5e[_0x7a96('0x35')]['limit']);_0x31f8f3[_0x7a96('0x1b')]=qs[_0x7a96('0x1b')](_0x384b5e['query'][_0x7a96('0x1b')]);}_0x31f8f3[_0x7a96('0x39')]=qs['sort'](_0x384b5e[_0x7a96('0x35')][_0x7a96('0x3a')]);_0x31f8f3[_0x7a96('0x3b')]=qs[_0x7a96('0x33')](_[_0x7a96('0x3c')](_0x384b5e[_0x7a96('0x35')],_0x256727[_0x7a96('0x33')]),_0x12fe14);if(_0x384b5e[_0x7a96('0x35')]['filter']){_0x31f8f3[_0x7a96('0x3b')]=_[_0x7a96('0x3d')](_0x31f8f3[_0x7a96('0x3b')],{'$or':_[_0x7a96('0x2b')](_0x12fe14,function(_0x52fed5){if(_0x52fed5[_0x7a96('0x3e')]!==_0x7a96('0x3f')){var _0x456346={};_0x456346[_0x52fed5[_0x7a96('0x28')]]={'$like':'%'+_0x384b5e[_0x7a96('0x35')]['filter']+'%'};return _0x456346;}})});}_0x31f8f3=_[_0x7a96('0x3d')]({},_0x31f8f3,_0x384b5e['options']);var _0x4226e7={'where':_0x31f8f3[_0x7a96('0x3b')]};return db[_0x7a96('0x2c')]['count'](_0x4226e7)['then'](function(_0x2409b9){_0x1f0354['count']=_0x2409b9;if(_0x384b5e[_0x7a96('0x35')][_0x7a96('0x40')]){_0x31f8f3['include']=[{'all':!![]}];}return db[_0x7a96('0x2c')][_0x7a96('0x41')](_0x31f8f3);})['then'](function(_0x5678cf){_0x1f0354[_0x7a96('0x42')]=_0x5678cf;return _0x1f0354;})['then'](respondWithFilteredResult(_0x33a59a,_0x31f8f3))[_0x7a96('0x43')](handleError(_0x33a59a,null));};exports['show']=function(_0x385b85,_0x985217){var _0x221968={'raw':!![],'where':{'id':_0x385b85[_0x7a96('0x44')]['id']}},_0x57dfcb={};_0x57dfcb[_0x7a96('0x30')]=_[_0x7a96('0x32')](db[_0x7a96('0x2c')][_0x7a96('0x2d')]);_0x57dfcb[_0x7a96('0x35')]=_[_0x7a96('0x32')](_0x385b85[_0x7a96('0x35')]);_0x57dfcb[_0x7a96('0x33')]=_['intersection'](_0x57dfcb['model'],_0x57dfcb[_0x7a96('0x35')]);_0x221968['attributes']=_[_0x7a96('0x34')](_0x57dfcb[_0x7a96('0x30')],qs[_0x7a96('0x45')](_0x385b85[_0x7a96('0x35')][_0x7a96('0x45')]));_0x221968[_0x7a96('0x36')]=_0x221968[_0x7a96('0x36')][_0x7a96('0x37')]?_0x221968[_0x7a96('0x36')]:_0x57dfcb[_0x7a96('0x30')];if(_0x385b85[_0x7a96('0x35')]['includeAll']){_0x221968[_0x7a96('0x46')]=[{'all':!![]}];}_0x221968=_[_0x7a96('0x3d')]({},_0x221968,_0x385b85[_0x7a96('0x47')]);return db[_0x7a96('0x2c')][_0x7a96('0x48')](_0x221968)[_0x7a96('0x24')](handleEntityNotFound(_0x985217,null))[_0x7a96('0x24')](respondWithResult(_0x985217,null))[_0x7a96('0x43')](handleError(_0x985217,null));};exports[_0x7a96('0x49')]=function(_0x5c2e7f,_0x33e785){return db[_0x7a96('0x2c')]['create'](_0x5c2e7f[_0x7a96('0x4a')],{})[_0x7a96('0x24')](respondWithResult(_0x33e785,0xc9))['catch'](handleError(_0x33e785,null));};exports['update']=function(_0x54cee4,_0x263caf){if(_0x54cee4['body']['id']){delete _0x54cee4[_0x7a96('0x4a')]['id'];}return db[_0x7a96('0x2c')][_0x7a96('0x48')]({'where':{'id':_0x54cee4['params']['id']}})['then'](handleEntityNotFound(_0x263caf,null))['then'](saveUpdates(_0x54cee4[_0x7a96('0x4a')],null))[_0x7a96('0x24')](respondWithResult(_0x263caf,null))[_0x7a96('0x43')](handleError(_0x263caf,null));};exports['destroy']=function(_0x4c21be,_0x5c1f6f){return db[_0x7a96('0x2c')][_0x7a96('0x48')]({'where':{'id':_0x4c21be['params']['id']}})[_0x7a96('0x24')](handleEntityNotFound(_0x5c1f6f,null))[_0x7a96('0x24')](removeEntity(_0x5c1f6f,null))[_0x7a96('0x43')](handleError(_0x5c1f6f,null));};exports[_0x7a96('0x4b')]=function(_0x3c8259,_0x94acfc,_0x1c5c1a){return db['VoiceMailMessage'][_0x7a96('0x48')]({'where':{'id':_0x3c8259[_0x7a96('0x44')]['id']},'attributes':['id',_0x7a96('0x4c'),'msg_id']})[_0x7a96('0x24')](handleEntityNotFound(_0x94acfc,null))[_0x7a96('0x24')](function(_0x2202d5){if(_0x2202d5){if(!_0x2202d5['recording']){throw new db['Sequelize']['ValidationError']('VoiceMailMessage\x20not\x20found');}var _0x5eeaf5={'Content-Type':_0x7a96('0x4d'),'Content-Disposition':_0x7a96('0x4e')};if(_0x2202d5[_0x7a96('0x4f')]){_0x5eeaf5[_0x7a96('0x50')]=_0x7a96('0x51')+_0x2202d5[_0x7a96('0x4f')]+_0x7a96('0x52');}_0x94acfc['set'](_0x5eeaf5);return _0x94acfc[_0x7a96('0x29')](new Buffer(_0x2202d5[_0x7a96('0x4c')]));}})[_0x7a96('0x43')](handleError(_0x94acfc,null));}; \ No newline at end of file +var _0x3c1c=['attributes','length','hasOwnProperty','order','sort','where','pick','filters','merge','VIRTUAL','filter','count','includeAll','include','findAll','rows','catch','show','options','find','create','body','update','params','download','recording','msg_id','Sequelize','ValidationError','attachment','Content-Disposition','attachment;\x20filename=\x22','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','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','sendStatus','status','end','json','limit','undefined','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','intersection','fields'];(function(_0x3f7146,_0x824eba){var _0x316350=function(_0x57d1c5){while(--_0x57d1c5){_0x3f7146['push'](_0x3f7146['shift']());}};_0x316350(++_0x824eba);}(_0x3c1c,0xd0));var _0xc3c1=function(_0x17a754,_0x5f1052){_0x17a754=_0x17a754-0x0;var _0x545d3e=_0x3c1c[_0x17a754];return _0x545d3e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc3c1('0x0'));var zipdir=require(_0xc3c1('0x1'));var jsonpatch=require(_0xc3c1('0x2'));var rp=require('request-promise');var moment=require(_0xc3c1('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc3c1('0x4'));var path=require(_0xc3c1('0x5'));var sox=require(_0xc3c1('0x6'));var csv=require(_0xc3c1('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc3c1('0x8'));var squel=require(_0xc3c1('0x9'));var crypto=require(_0xc3c1('0xa'));var jsforce=require(_0xc3c1('0xb'));var deskjs=require(_0xc3c1('0xc'));var toCsv=require(_0xc3c1('0x7'));var querystring=require(_0xc3c1('0xd'));var Papa=require(_0xc3c1('0xe'));var Redis=require('ioredis');var authService=require(_0xc3c1('0xf'));var qs=require(_0xc3c1('0x10'));var as=require(_0xc3c1('0x11'));var hardwareService=require(_0xc3c1('0x12'));var logger=require(_0xc3c1('0x13'))(_0xc3c1('0x14'));var utils=require(_0xc3c1('0x15'));var config=require(_0xc3c1('0x16'));var licenseUtil=require(_0xc3c1('0x17'));var db=require(_0xc3c1('0x18'))['db'];function respondWithStatusCode(_0x1218bd,_0x57445a){_0x57445a=_0x57445a||0xcc;return function(_0x3de5e7){if(_0x3de5e7){return _0x1218bd[_0xc3c1('0x19')](_0x57445a);}return _0x1218bd[_0xc3c1('0x1a')](_0x57445a)[_0xc3c1('0x1b')]();};}function respondWithResult(_0x11e987,_0x5bccc3){_0x5bccc3=_0x5bccc3||0xc8;return function(_0x258fba){if(_0x258fba){return _0x11e987['status'](_0x5bccc3)[_0xc3c1('0x1c')](_0x258fba);}};}function respondWithFilteredResult(_0x1b914a,_0x44d51b){return function(_0x923431){if(_0x923431){var _0x4317df=typeof _0x44d51b['offset']==='undefined'&&typeof _0x44d51b[_0xc3c1('0x1d')]===_0xc3c1('0x1e');var _0x5444af=_0x923431['count'];var _0x5e3c6d=_0x4317df?0x0:_0x44d51b['offset'];var _0x20cb91=_0x4317df?_0x923431['count']:_0x44d51b[_0xc3c1('0x1f')]+_0x44d51b[_0xc3c1('0x1d')];var _0x259598;if(_0x20cb91>=_0x5444af){_0x20cb91=_0x5444af;_0x259598=0xc8;}else{_0x259598=0xce;}_0x1b914a[_0xc3c1('0x1a')](_0x259598);return _0x1b914a[_0xc3c1('0x20')](_0xc3c1('0x21'),_0x5e3c6d+'-'+_0x20cb91+'/'+_0x5444af)[_0xc3c1('0x1c')](_0x923431);}return null;};}function patchUpdates(_0x2b8f5e){return function(_0x1e836c){try{jsonpatch[_0xc3c1('0x22')](_0x1e836c,_0x2b8f5e,!![]);}catch(_0x59ef0b){return BPromise[_0xc3c1('0x23')](_0x59ef0b);}return _0x1e836c[_0xc3c1('0x24')]();};}function saveUpdates(_0x2714c2,_0x5653c7){return function(_0x195dc9){if(_0x195dc9){return _0x195dc9['update'](_0x2714c2)[_0xc3c1('0x25')](function(_0x3b2b25){return _0x3b2b25;});}return null;};}function removeEntity(_0x22beff,_0x3e599f){return function(_0x582e92){if(_0x582e92){return _0x582e92[_0xc3c1('0x26')]()['then'](function(){_0x22beff[_0xc3c1('0x1a')](0xcc)[_0xc3c1('0x1b')]();});}};}function handleEntityNotFound(_0x48b64e,_0x277b99){return function(_0x396e3d){if(!_0x396e3d){_0x48b64e[_0xc3c1('0x19')](0x194);}return _0x396e3d;};}function handleError(_0x2bc6e5,_0x49c5ad){_0x49c5ad=_0x49c5ad||0x1f4;return function(_0x5ec029){logger[_0xc3c1('0x27')](_0x5ec029[_0xc3c1('0x28')]);if(_0x5ec029[_0xc3c1('0x29')]){delete _0x5ec029[_0xc3c1('0x29')];}_0x2bc6e5[_0xc3c1('0x1a')](_0x49c5ad)[_0xc3c1('0x2a')](_0x5ec029);};}exports[_0xc3c1('0x2b')]=function(_0x5909ef,_0x1d7500){var _0x607dd6={},_0x49de6f={},_0x3c73b4={'count':0x0,'rows':[]};var _0x54f407=_[_0xc3c1('0x2c')](db[_0xc3c1('0x2d')][_0xc3c1('0x2e')],function(_0x1cbf1b){return{'name':_0x1cbf1b[_0xc3c1('0x2f')],'type':_0x1cbf1b[_0xc3c1('0x30')][_0xc3c1('0x31')]};});_0x49de6f[_0xc3c1('0x32')]=_[_0xc3c1('0x33')](_[_0xc3c1('0x2c')](_0x54f407,'name'),[_0xc3c1('0x29')]);_0x49de6f[_0xc3c1('0x34')]=_[_0xc3c1('0x35')](_0x5909ef[_0xc3c1('0x34')]);_0x49de6f['filters']=_[_0xc3c1('0x36')](_0x49de6f['model'],_0x49de6f[_0xc3c1('0x34')]);_0x607dd6['attributes']=_[_0xc3c1('0x36')](_0x49de6f[_0xc3c1('0x32')],qs[_0xc3c1('0x37')](_0x5909ef[_0xc3c1('0x34')][_0xc3c1('0x37')]));_0x607dd6[_0xc3c1('0x38')]=_0x607dd6[_0xc3c1('0x38')][_0xc3c1('0x39')]?_0x607dd6[_0xc3c1('0x38')]:_0x49de6f['model'];if(!_0x5909ef[_0xc3c1('0x34')][_0xc3c1('0x3a')]('nolimit')){_0x607dd6[_0xc3c1('0x1d')]=qs[_0xc3c1('0x1d')](_0x5909ef[_0xc3c1('0x34')][_0xc3c1('0x1d')]);_0x607dd6[_0xc3c1('0x1f')]=qs[_0xc3c1('0x1f')](_0x5909ef[_0xc3c1('0x34')][_0xc3c1('0x1f')]);}_0x607dd6[_0xc3c1('0x3b')]=qs[_0xc3c1('0x3c')](_0x5909ef[_0xc3c1('0x34')]['sort']);_0x607dd6[_0xc3c1('0x3d')]=qs['filters'](_[_0xc3c1('0x3e')](_0x5909ef[_0xc3c1('0x34')],_0x49de6f[_0xc3c1('0x3f')]),_0x54f407);if(_0x5909ef['query']['filter']){_0x607dd6['where']=_[_0xc3c1('0x40')](_0x607dd6[_0xc3c1('0x3d')],{'$or':_[_0xc3c1('0x2c')](_0x54f407,function(_0x19cebb){if(_0x19cebb[_0xc3c1('0x30')]!==_0xc3c1('0x41')){var _0x27e973={};_0x27e973[_0x19cebb['name']]={'$like':'%'+_0x5909ef[_0xc3c1('0x34')][_0xc3c1('0x42')]+'%'};return _0x27e973;}})});}_0x607dd6=_['merge']({},_0x607dd6,_0x5909ef['options']);var _0x16d4c7={'where':_0x607dd6[_0xc3c1('0x3d')]};return db[_0xc3c1('0x2d')][_0xc3c1('0x43')](_0x16d4c7)[_0xc3c1('0x25')](function(_0x50c72d){_0x3c73b4[_0xc3c1('0x43')]=_0x50c72d;if(_0x5909ef['query'][_0xc3c1('0x44')]){_0x607dd6[_0xc3c1('0x45')]=[{'all':!![]}];}return db[_0xc3c1('0x2d')][_0xc3c1('0x46')](_0x607dd6);})[_0xc3c1('0x25')](function(_0x33da01){_0x3c73b4[_0xc3c1('0x47')]=_0x33da01;return _0x3c73b4;})[_0xc3c1('0x25')](respondWithFilteredResult(_0x1d7500,_0x607dd6))[_0xc3c1('0x48')](handleError(_0x1d7500,null));};exports[_0xc3c1('0x49')]=function(_0x4f0010,_0x4775fa){var _0x53c550={'raw':!![],'where':{'id':_0x4f0010['params']['id']}},_0x3e912d={};_0x3e912d[_0xc3c1('0x32')]=_[_0xc3c1('0x35')](db[_0xc3c1('0x2d')][_0xc3c1('0x2e')]);_0x3e912d[_0xc3c1('0x34')]=_[_0xc3c1('0x35')](_0x4f0010[_0xc3c1('0x34')]);_0x3e912d[_0xc3c1('0x3f')]=_['intersection'](_0x3e912d[_0xc3c1('0x32')],_0x3e912d['query']);_0x53c550[_0xc3c1('0x38')]=_[_0xc3c1('0x36')](_0x3e912d[_0xc3c1('0x32')],qs[_0xc3c1('0x37')](_0x4f0010[_0xc3c1('0x34')][_0xc3c1('0x37')]));_0x53c550[_0xc3c1('0x38')]=_0x53c550[_0xc3c1('0x38')][_0xc3c1('0x39')]?_0x53c550[_0xc3c1('0x38')]:_0x3e912d[_0xc3c1('0x32')];if(_0x4f0010['query'][_0xc3c1('0x44')]){_0x53c550[_0xc3c1('0x45')]=[{'all':!![]}];}_0x53c550=_[_0xc3c1('0x40')]({},_0x53c550,_0x4f0010[_0xc3c1('0x4a')]);return db[_0xc3c1('0x2d')][_0xc3c1('0x4b')](_0x53c550)[_0xc3c1('0x25')](handleEntityNotFound(_0x4775fa,null))['then'](respondWithResult(_0x4775fa,null))[_0xc3c1('0x48')](handleError(_0x4775fa,null));};exports[_0xc3c1('0x4c')]=function(_0x233345,_0xdab3d2){return db[_0xc3c1('0x2d')][_0xc3c1('0x4c')](_0x233345[_0xc3c1('0x4d')],{})[_0xc3c1('0x25')](respondWithResult(_0xdab3d2,0xc9))[_0xc3c1('0x48')](handleError(_0xdab3d2,null));};exports[_0xc3c1('0x4e')]=function(_0x368af8,_0x272460){if(_0x368af8[_0xc3c1('0x4d')]['id']){delete _0x368af8['body']['id'];}return db[_0xc3c1('0x2d')][_0xc3c1('0x4b')]({'where':{'id':_0x368af8[_0xc3c1('0x4f')]['id']}})[_0xc3c1('0x25')](handleEntityNotFound(_0x272460,null))[_0xc3c1('0x25')](saveUpdates(_0x368af8[_0xc3c1('0x4d')],null))['then'](respondWithResult(_0x272460,null))[_0xc3c1('0x48')](handleError(_0x272460,null));};exports[_0xc3c1('0x26')]=function(_0x3fbb49,_0x13fdac){return db[_0xc3c1('0x2d')][_0xc3c1('0x4b')]({'where':{'id':_0x3fbb49[_0xc3c1('0x4f')]['id']}})[_0xc3c1('0x25')](handleEntityNotFound(_0x13fdac,null))[_0xc3c1('0x25')](removeEntity(_0x13fdac,null))[_0xc3c1('0x48')](handleError(_0x13fdac,null));};exports[_0xc3c1('0x50')]=function(_0x179bca,_0x511bd0,_0x2e6bfd){return db[_0xc3c1('0x2d')]['find']({'where':{'id':_0x179bca[_0xc3c1('0x4f')]['id']},'attributes':['id',_0xc3c1('0x51'),_0xc3c1('0x52')]})[_0xc3c1('0x25')](handleEntityNotFound(_0x511bd0,null))[_0xc3c1('0x25')](function(_0x1296e8){if(_0x1296e8){if(!_0x1296e8[_0xc3c1('0x51')]){throw new db[(_0xc3c1('0x53'))][(_0xc3c1('0x54'))]('VoiceMailMessage\x20not\x20found');}var _0x3406f4={'Content-Type':'audio/wav','Content-Disposition':_0xc3c1('0x55')};if(_0x1296e8['msg_id']){_0x3406f4[_0xc3c1('0x56')]=_0xc3c1('0x57')+_0x1296e8[_0xc3c1('0x52')]+'.wav\x22';}_0x511bd0[_0xc3c1('0x20')](_0x3406f4);return _0x511bd0[_0xc3c1('0x2a')](new Buffer(_0x1296e8[_0xc3c1('0x51')]));}})[_0xc3c1('0x48')](handleError(_0x511bd0,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index e071463..10fafbd 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 _0x1eae=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir'];(function(_0x35ecef,_0x2aaf3e){var _0x4334ee=function(_0x10b93c){while(--_0x10b93c){_0x35ecef['push'](_0x35ecef['shift']());}};_0x4334ee(++_0x2aaf3e);}(_0x1eae,0xb4));var _0xe1ea=function(_0xfd3d67,_0x167031){_0xfd3d67=_0xfd3d67-0x0;var _0x5e48eb=_0x1eae[_0xfd3d67];return _0x5e48eb;};'use strict';var _=require(_0xe1ea('0x0'));var util=require(_0xe1ea('0x1'));var logger=require(_0xe1ea('0x2'))(_0xe1ea('0x3'));var moment=require(_0xe1ea('0x4'));var BPromise=require(_0xe1ea('0x5'));var rp=require(_0xe1ea('0x6'));var fs=require('fs');var path=require(_0xe1ea('0x7'));var rimraf=require('rimraf');var config=require(_0xe1ea('0x8'));var attributes=require(_0xe1ea('0x9'));module[_0xe1ea('0xa')]=function(_0xfe7856,_0x2e15f8){return _0xfe7856[_0xe1ea('0xb')](_0xe1ea('0xc'),attributes,{'tableName':_0xe1ea('0xd'),'paranoid':![],'indexes':[{'name':_0xe1ea('0xe'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x13d1=['exports','define','voice_voicemail_messages','util','../../config/logger','moment','bluebird','../../config/environment','./voiceMailMessage.attributes'];(function(_0x4fc421,_0x94e88){var _0x8c6d63=function(_0x5b8b42){while(--_0x5b8b42){_0x4fc421['push'](_0x4fc421['shift']());}};_0x8c6d63(++_0x94e88);}(_0x13d1,0x1ce));var _0x113d=function(_0x546157,_0x4072e3){_0x546157=_0x546157-0x0;var _0x59f2e2=_0x13d1[_0x546157];return _0x59f2e2;};'use strict';var _=require('lodash');var util=require(_0x113d('0x0'));var logger=require(_0x113d('0x1'))('api');var moment=require(_0x113d('0x2'));var BPromise=require(_0x113d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x113d('0x4'));var attributes=require(_0x113d('0x5'));module[_0x113d('0x6')]=function(_0x4aeb44,_0x51ff50){return _0x4aeb44[_0x113d('0x7')]('VoiceMailMessage',attributes,{'tableName':_0x113d('0x8'),'paranoid':![],'indexes':[{'name':'dir','fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 73ee37f..0dabe16 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 _0x7514=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird'];(function(_0x2e3d56,_0x4fb6ed){var _0x1815c1=function(_0x45a5fd){while(--_0x45a5fd){_0x2e3d56['push'](_0x2e3d56['shift']());}};_0x1815c1(++_0x4fb6ed);}(_0x7514,0xd9));var _0x4751=function(_0xdc71d,_0x246b70){_0xdc71d=_0xdc71d-0x0;var _0x4fb017=_0x7514[_0xdc71d];return _0x4fb017;};'use strict';var _=require(_0x4751('0x0'));var util=require(_0x4751('0x1'));var moment=require('moment');var BPromise=require(_0x4751('0x2'));var rs=require(_0x4751('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4751('0x4'))['db'];var utils=require(_0x4751('0x5'));var logger=require(_0x4751('0x6'))(_0x4751('0x7'));var config=require('../../config/environment');var jayson=require(_0x4751('0x8'));var client=jayson[_0x4751('0x9')][_0x4751('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c8b18,_0xa65753,_0x41a54c){return new BPromise(function(_0x1ca287,_0x152276){return client[_0x4751('0xb')](_0x5c8b18,_0x41a54c)['then'](function(_0x53b5c6){logger[_0x4751('0xc')](_0x4751('0xd'),_0xa65753,_0x4751('0xe'));logger[_0x4751('0xf')](_0x4751('0x10'),_0xa65753,'request\x20sent',JSON[_0x4751('0x11')](_0x53b5c6));if(_0x53b5c6['error']){if(_0x53b5c6['error']['code']===0x1f4){logger[_0x4751('0x12')](_0x4751('0xd'),_0xa65753,_0x53b5c6[_0x4751('0x12')][_0x4751('0x13')]);return _0x152276(_0x53b5c6['error'][_0x4751('0x13')]);}logger[_0x4751('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0xa65753,_0x53b5c6[_0x4751('0x12')][_0x4751('0x13')]);return _0x1ca287(_0x53b5c6[_0x4751('0x12')][_0x4751('0x13')]);}else{logger[_0x4751('0xc')](_0x4751('0xd'),_0xa65753,_0x4751('0xe'));_0x1ca287(_0x53b5c6[_0x4751('0x14')][_0x4751('0x13')]);}})[_0x4751('0x15')](function(_0x497b8f){logger['error'](_0x4751('0xd'),_0xa65753,_0x497b8f);_0x152276(_0x497b8f);});});} \ No newline at end of file +var _0x4374=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x322885,_0x232244){var _0x571df4=function(_0x150b65){while(--_0x150b65){_0x322885['push'](_0x322885['shift']());}};_0x571df4(++_0x232244);}(_0x4374,0x163));var _0x4437=function(_0x2db586,_0x5d757f){_0x2db586=_0x2db586-0x0;var _0x2111be=_0x4374[_0x2db586];return _0x2111be;};'use strict';var _=require('lodash');var util=require(_0x4437('0x0'));var moment=require(_0x4437('0x1'));var BPromise=require(_0x4437('0x2'));var rs=require(_0x4437('0x3'));var fs=require('fs');var Redis=require(_0x4437('0x4'));var db=require(_0x4437('0x5'))['db'];var utils=require(_0x4437('0x6'));var logger=require('../../config/logger')(_0x4437('0x7'));var config=require(_0x4437('0x8'));var jayson=require(_0x4437('0x9'));var client=jayson['client'][_0x4437('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49a0e4,_0x2a37c4,_0x1c3a93){return new BPromise(function(_0x5cb148,_0x1df54a){return client[_0x4437('0xb')](_0x49a0e4,_0x1c3a93)[_0x4437('0xc')](function(_0x12b531){logger[_0x4437('0xd')](_0x4437('0xe'),_0x2a37c4,_0x4437('0xf'));logger[_0x4437('0x10')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x2a37c4,_0x4437('0xf'),JSON['stringify'](_0x12b531));if(_0x12b531[_0x4437('0x11')]){if(_0x12b531[_0x4437('0x11')][_0x4437('0x12')]===0x1f4){logger['error'](_0x4437('0xe'),_0x2a37c4,_0x12b531[_0x4437('0x11')][_0x4437('0x13')]);return _0x1df54a(_0x12b531[_0x4437('0x11')]['message']);}logger['error'](_0x4437('0xe'),_0x2a37c4,_0x12b531[_0x4437('0x11')][_0x4437('0x13')]);return _0x5cb148(_0x12b531[_0x4437('0x11')][_0x4437('0x13')]);}else{logger[_0x4437('0xd')]('VoiceMailMessage,\x20%s,\x20%s',_0x2a37c4,'request\x20sent');_0x5cb148(_0x12b531[_0x4437('0x14')][_0x4437('0x13')]);}})[_0x4437('0x15')](function(_0x3fe17f){logger[_0x4437('0x11')](_0x4437('0xe'),_0x2a37c4,_0x3fe17f);_0x1df54a(_0x3fe17f);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index a975eed..9cf277c 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 _0x6023=['../../components/auth/service','./voiceMusicOnHold.controller','isAuthenticated','index','/:id','show','/:id/sounds','post','create','addSound','removeSound','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x8f3235,_0x20644d){var _0x2bf06a=function(_0x4e54d1){while(--_0x4e54d1){_0x8f3235['push'](_0x8f3235['shift']());}};_0x2bf06a(++_0x20644d);}(_0x6023,0x11b));var _0x3602=function(_0x1a46e2,_0x15c509){_0x1a46e2=_0x1a46e2-0x0;var _0x3454a1=_0x6023[_0x1a46e2];return _0x3454a1;};'use strict';var multer=require(_0x3602('0x0'));var util=require('util');var path=require(_0x3602('0x1'));var timeout=require(_0x3602('0x2'));var express=require(_0x3602('0x3'));var router=express[_0x3602('0x4')]();var fs_extra=require(_0x3602('0x5'));var auth=require(_0x3602('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3602('0x7'));router['get']('/',auth[_0x3602('0x8')](),controller[_0x3602('0x9')]);router['get'](_0x3602('0xa'),auth[_0x3602('0x8')](),controller[_0x3602('0xb')]);router['get'](_0x3602('0xc'),auth['isAuthenticated'](),controller['getSounds']);router[_0x3602('0xd')]('/',auth['isAuthenticated'](),controller[_0x3602('0xe')]);router['post'](_0x3602('0xc'),auth[_0x3602('0x8')](),controller[_0x3602('0xf')]);router['put']('/:id',auth[_0x3602('0x8')](),controller['update']);router['delete'](_0x3602('0xa'),auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/sounds/:id2',auth[_0x3602('0x8')](),controller[_0x3602('0x10')]);module['exports']=router; \ No newline at end of file +var _0x5e29=['../../config/environment','./voiceMusicOnHold.controller','get','index','isAuthenticated','/:id/sounds','getSounds','create','post','put','/:id','update','delete','removeSound','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x2c8631,_0x662069){var _0x4b31c2=function(_0x2e3557){while(--_0x2e3557){_0x2c8631['push'](_0x2c8631['shift']());}};_0x4b31c2(++_0x662069);}(_0x5e29,0x158));var _0x95e2=function(_0xde8111,_0x15702c){_0xde8111=_0xde8111-0x0;var _0x29af0b=_0x5e29[_0xde8111];return _0x29af0b;};'use strict';var multer=require(_0x95e2('0x0'));var util=require(_0x95e2('0x1'));var path=require(_0x95e2('0x2'));var timeout=require(_0x95e2('0x3'));var express=require(_0x95e2('0x4'));var router=express[_0x95e2('0x5')]();var fs_extra=require(_0x95e2('0x6'));var auth=require(_0x95e2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x95e2('0x8'));var controller=require(_0x95e2('0x9'));router[_0x95e2('0xa')]('/',auth['isAuthenticated'](),controller[_0x95e2('0xb')]);router[_0x95e2('0xa')]('/:id',auth[_0x95e2('0xc')](),controller['show']);router[_0x95e2('0xa')](_0x95e2('0xd'),auth['isAuthenticated'](),controller[_0x95e2('0xe')]);router['post']('/',auth[_0x95e2('0xc')](),controller[_0x95e2('0xf')]);router[_0x95e2('0x10')](_0x95e2('0xd'),auth['isAuthenticated'](),controller['addSound']);router[_0x95e2('0x11')](_0x95e2('0x12'),auth[_0x95e2('0xc')](),controller[_0x95e2('0x13')]);router[_0x95e2('0x14')](_0x95e2('0x12'),auth[_0x95e2('0xc')](),controller['destroy']);router[_0x95e2('0x14')]('/:id/sounds/:id2',auth['isAuthenticated'](),controller[_0x95e2('0x15')]);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 93ce91a..3f6b105 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 _0x587d=['quietmp3','mp3','alpha','sequelize','exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3nb'];(function(_0x10fcec,_0x8d134a){var _0x57aa87=function(_0x262be8){while(--_0x262be8){_0x10fcec['push'](_0x10fcec['shift']());}};_0x57aa87(++_0x8d134a);}(_0x587d,0x13b));var _0xd587=function(_0x36cc70,_0x3f0d9f){_0x36cc70=_0x36cc70-0x0;var _0x1cf0a1=_0x587d[_0x36cc70];return _0x1cf0a1;};'use strict';var Sequelize=require(_0xd587('0x0'));module[_0xd587('0x1')]={'name':{'type':Sequelize[_0xd587('0x2')],'allowNull':![],'unique':_0xd587('0x3')},'mode':{'type':Sequelize[_0xd587('0x4')](_0xd587('0x5'),_0xd587('0x6'),_0xd587('0x7'),_0xd587('0x8'),_0xd587('0x9'),_0xd587('0xa')),'allowNull':!![],'defaultValue':_0xd587('0x6')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xd587('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xd587('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xd587('0x2')],'allowNull':!![],'defaultValue':_0xd587('0xb')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x1657=['mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','custom','files'];(function(_0x461c18,_0x5605b9){var _0x35501c=function(_0x1cd251){while(--_0x1cd251){_0x461c18['push'](_0x461c18['shift']());}};_0x35501c(++_0x5605b9);}(_0x1657,0x19a));var _0x7165=function(_0x164477,_0x6860af){_0x164477=_0x164477-0x0;var _0x1b8ad1=_0x1657[_0x164477];return _0x1b8ad1;};'use strict';var Sequelize=require(_0x7165('0x0'));module[_0x7165('0x1')]={'name':{'type':Sequelize[_0x7165('0x2')],'allowNull':![],'unique':_0x7165('0x3')},'mode':{'type':Sequelize['ENUM'](_0x7165('0x4'),_0x7165('0x5'),_0x7165('0x6'),_0x7165('0x7'),_0x7165('0x8'),_0x7165('0x9')),'allowNull':!![],'defaultValue':_0x7165('0x5')},'directory':{'type':Sequelize[_0x7165('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x7165('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x7165('0x2')],'allowNull':!![],'defaultValue':_0x7165('0xa')},'format':{'type':Sequelize[_0x7165('0x2')],'allowNull':!![]},'stamp':{'type':_0x7165('0xb')},'defaultEntry':{'type':Sequelize[_0x7165('0xc')],'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 7c2343c..42d3bc5 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 _0xf5a6=['Sequelize','ValidationError','message','addSound','findOne','save_name','converted_format','server/files/sounds/converted','%s.%s','format','symlinkSync','removeSound','Sound','id2','createdAt','getSounds','order','filter','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','MusicOnHolds','UserProfileResource','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','merge','where','VIRTUAL','options','VoiceMusicOnHold','include','findAll','rows','catch','show','params','includeAll','find','body','create','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','readdirSync','forEach','unlinkSync'];(function(_0x13191c,_0x3c5bd6){var _0x35adc2=function(_0x4f89f2){while(--_0x4f89f2){_0x13191c['push'](_0x13191c['shift']());}};_0x35adc2(++_0x3c5bd6);}(_0xf5a6,0xf8));var _0x6f5a=function(_0x312172,_0x426647){_0x312172=_0x312172-0x0;var _0x19822a=_0xf5a6[_0x312172];return _0x19822a;};'use strict';var emlformat=require(_0x6f5a('0x0'));var rimraf=require(_0x6f5a('0x1'));var zipdir=require(_0x6f5a('0x2'));var jsonpatch=require(_0x6f5a('0x3'));var rp=require(_0x6f5a('0x4'));var moment=require('moment');var BPromise=require(_0x6f5a('0x5'));var Mustache=require(_0x6f5a('0x6'));var util=require(_0x6f5a('0x7'));var path=require(_0x6f5a('0x8'));var sox=require('sox');var csv=require(_0x6f5a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6f5a('0xa'));var _=require(_0x6f5a('0xb'));var squel=require(_0x6f5a('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6f5a('0xd'));var toCsv=require(_0x6f5a('0x9'));var querystring=require(_0x6f5a('0xe'));var Papa=require(_0x6f5a('0xf'));var Redis=require(_0x6f5a('0x10'));var authService=require(_0x6f5a('0x11'));var qs=require(_0x6f5a('0x12'));var as=require(_0x6f5a('0x13'));var hardwareService=require(_0x6f5a('0x14'));var logger=require('../../config/logger')(_0x6f5a('0x15'));var utils=require(_0x6f5a('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6f5a('0x17'))['db'];function respondWithStatusCode(_0x4cc004,_0x44eed5){_0x44eed5=_0x44eed5||0xcc;return function(_0x2bcc59){if(_0x2bcc59){return _0x4cc004['sendStatus'](_0x44eed5);}return _0x4cc004['status'](_0x44eed5)[_0x6f5a('0x18')]();};}function respondWithResult(_0x5a863f,_0x1c9e6e){_0x1c9e6e=_0x1c9e6e||0xc8;return function(_0x120c7d){if(_0x120c7d){return _0x5a863f['status'](_0x1c9e6e)[_0x6f5a('0x19')](_0x120c7d);}};}function respondWithFilteredResult(_0x1d7daf,_0x1f7580){return function(_0x17c923){if(_0x17c923){var _0x8a614e=typeof _0x1f7580[_0x6f5a('0x1a')]===_0x6f5a('0x1b')&&typeof _0x1f7580[_0x6f5a('0x1c')]===_0x6f5a('0x1b');var _0x44af87=_0x17c923[_0x6f5a('0x1d')];var _0x177c36=_0x8a614e?0x0:_0x1f7580[_0x6f5a('0x1a')];var _0x57df3f=_0x8a614e?_0x17c923[_0x6f5a('0x1d')]:_0x1f7580[_0x6f5a('0x1a')]+_0x1f7580[_0x6f5a('0x1c')];var _0x29a2b9;if(_0x57df3f>=_0x44af87){_0x57df3f=_0x44af87;_0x29a2b9=0xc8;}else{_0x29a2b9=0xce;}_0x1d7daf[_0x6f5a('0x1e')](_0x29a2b9);return _0x1d7daf[_0x6f5a('0x1f')](_0x6f5a('0x20'),_0x177c36+'-'+_0x57df3f+'/'+_0x44af87)['json'](_0x17c923);}return null;};}function patchUpdates(_0x235187){return function(_0x58c6e4){try{jsonpatch[_0x6f5a('0x21')](_0x58c6e4,_0x235187,!![]);}catch(_0x2bfe2c){return BPromise[_0x6f5a('0x22')](_0x2bfe2c);}return _0x58c6e4[_0x6f5a('0x23')]();};}function saveUpdates(_0x27d7b4,_0x4a9099){return function(_0x1d9f88){if(_0x1d9f88){return _0x1d9f88[_0x6f5a('0x24')](_0x27d7b4)['then'](function(_0x310aa){return _0x310aa;});}return null;};}function removeEntity(_0x20b66d,_0x1c6ac7){return function(_0x5dc5c5){if(_0x5dc5c5){return _0x5dc5c5['destroy']()[_0x6f5a('0x25')](function(){var _0x5da5e3=_0x5dc5c5['get']({'plain':!![]});var _0x14cdb8=_0x6f5a('0x26');return db[_0x6f5a('0x27')]['destroy']({'where':{'type':_0x14cdb8,'resourceId':_0x5da5e3['id']}})['then'](function(){return _0x5dc5c5;});})[_0x6f5a('0x25')](function(){_0x20b66d['status'](0xcc)[_0x6f5a('0x18')]();});}};}function handleEntityNotFound(_0x578411,_0x1ace7d){return function(_0x2c4a2c){if(!_0x2c4a2c){_0x578411[_0x6f5a('0x28')](0x194);}return _0x2c4a2c;};}function handleError(_0x55e727,_0x38a9e4){_0x38a9e4=_0x38a9e4||0x1f4;return function(_0x523f67){logger[_0x6f5a('0x29')](_0x523f67[_0x6f5a('0x2a')]);if(_0x523f67[_0x6f5a('0x2b')]){delete _0x523f67[_0x6f5a('0x2b')];}_0x55e727['status'](_0x38a9e4)['send'](_0x523f67);};}exports[_0x6f5a('0x2c')]=function(_0x4a8c43,_0x31c656){var _0x5e6556={},_0x4e33fb={},_0x32be90={'count':0x0,'rows':[]};var _0x4f77c3=_[_0x6f5a('0x2d')](db['VoiceMusicOnHold'][_0x6f5a('0x2e')],function(_0x17e101){return{'name':_0x17e101[_0x6f5a('0x2f')],'type':_0x17e101[_0x6f5a('0x30')]['key']};});_0x4e33fb[_0x6f5a('0x31')]=_[_0x6f5a('0x2d')](_0x4f77c3,_0x6f5a('0x2b'));_0x4e33fb[_0x6f5a('0x32')]=_[_0x6f5a('0x33')](_0x4a8c43[_0x6f5a('0x32')]);_0x4e33fb[_0x6f5a('0x34')]=_['intersection'](_0x4e33fb[_0x6f5a('0x31')],_0x4e33fb[_0x6f5a('0x32')]);_0x5e6556['attributes']=_[_0x6f5a('0x35')](_0x4e33fb[_0x6f5a('0x31')],qs[_0x6f5a('0x36')](_0x4a8c43['query']['fields']));_0x5e6556['attributes']=_0x5e6556[_0x6f5a('0x37')][_0x6f5a('0x38')]?_0x5e6556[_0x6f5a('0x37')]:_0x4e33fb[_0x6f5a('0x31')];if(!_0x4a8c43[_0x6f5a('0x32')][_0x6f5a('0x39')](_0x6f5a('0x3a'))){_0x5e6556[_0x6f5a('0x1c')]=qs[_0x6f5a('0x1c')](_0x4a8c43[_0x6f5a('0x32')]['limit']);_0x5e6556[_0x6f5a('0x1a')]=qs[_0x6f5a('0x1a')](_0x4a8c43[_0x6f5a('0x32')][_0x6f5a('0x1a')]);}_0x5e6556['order']=qs[_0x6f5a('0x3b')](_0x4a8c43[_0x6f5a('0x32')][_0x6f5a('0x3b')]);delete _0x4a8c43[_0x6f5a('0x32')][_0x6f5a('0x3b')];_0x5e6556['where']=qs[_0x6f5a('0x34')](_['pick'](_0x4a8c43[_0x6f5a('0x32')],_0x4e33fb[_0x6f5a('0x34')]),_0x4f77c3);if(_0x4a8c43['query']['filter']){_0x5e6556['where']=_[_0x6f5a('0x3c')](_0x5e6556[_0x6f5a('0x3d')],{'$or':_[_0x6f5a('0x2d')](_0x4f77c3,function(_0x2ceda3){if(_0x2ceda3[_0x6f5a('0x30')]!==_0x6f5a('0x3e')){var _0x1c9015={};_0x1c9015[_0x2ceda3['name']]={'$like':'%'+_0x4a8c43[_0x6f5a('0x32')]['filter']+'%'};return _0x1c9015;}})});}_0x5e6556=_[_0x6f5a('0x3c')]({},_0x5e6556,_0x4a8c43[_0x6f5a('0x3f')]);var _0x4d1942={'where':_0x5e6556[_0x6f5a('0x3d')]};return db[_0x6f5a('0x40')]['count'](_0x4d1942)[_0x6f5a('0x25')](function(_0x157e8f){_0x32be90[_0x6f5a('0x1d')]=_0x157e8f;if(_0x4a8c43[_0x6f5a('0x32')]['includeAll']){_0x5e6556[_0x6f5a('0x41')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x6f5a('0x42')](_0x5e6556);})['then'](function(_0x407d50){_0x32be90[_0x6f5a('0x43')]=_0x407d50;return _0x32be90;})['then'](respondWithFilteredResult(_0x31c656,_0x5e6556))[_0x6f5a('0x44')](handleError(_0x31c656,null));};exports[_0x6f5a('0x45')]=function(_0x15bdf8,_0x321580){var _0x8da63d={'raw':![],'where':{'id':_0x15bdf8[_0x6f5a('0x46')]['id']}},_0x1524a8={};_0x1524a8[_0x6f5a('0x31')]=_[_0x6f5a('0x33')](db[_0x6f5a('0x40')][_0x6f5a('0x2e')]);_0x1524a8[_0x6f5a('0x32')]=_[_0x6f5a('0x33')](_0x15bdf8[_0x6f5a('0x32')]);_0x1524a8[_0x6f5a('0x34')]=_['intersection'](_0x1524a8['model'],_0x1524a8[_0x6f5a('0x32')]);_0x8da63d['attributes']=_['intersection'](_0x1524a8[_0x6f5a('0x31')],qs[_0x6f5a('0x36')](_0x15bdf8[_0x6f5a('0x32')][_0x6f5a('0x36')]));_0x8da63d[_0x6f5a('0x37')]=_0x8da63d['attributes']['length']?_0x8da63d[_0x6f5a('0x37')]:_0x1524a8[_0x6f5a('0x31')];if(_0x15bdf8['query'][_0x6f5a('0x47')]){_0x8da63d[_0x6f5a('0x41')]=[{'all':!![]}];}_0x8da63d=_['merge']({},_0x8da63d,_0x15bdf8[_0x6f5a('0x3f')]);return db[_0x6f5a('0x40')][_0x6f5a('0x48')](_0x8da63d)[_0x6f5a('0x25')](handleEntityNotFound(_0x321580,null))[_0x6f5a('0x25')](respondWithResult(_0x321580,null))['catch'](handleError(_0x321580,null));};exports[_0x6f5a('0x24')]=function(_0x4388f4,_0x402d44){if(_0x4388f4['body']['id']){delete _0x4388f4['body']['id'];}return db[_0x6f5a('0x40')][_0x6f5a('0x48')]({'where':{'id':_0x4388f4['params']['id']}})[_0x6f5a('0x25')](handleEntityNotFound(_0x402d44,null))[_0x6f5a('0x25')](saveUpdates(_0x4388f4[_0x6f5a('0x49')],null))[_0x6f5a('0x25')](respondWithResult(_0x402d44,null))['catch'](handleError(_0x402d44,null));};exports[_0x6f5a('0x4a')]=function(_0x3ac136,_0x10e72b,_0x4c2b91){return db['sequelize'][_0x6f5a('0x4b')](function(_0x14112e){if(_0x3ac136[_0x6f5a('0x49')][_0x6f5a('0x4c')]===_0x6f5a('0x4d')){_0x3ac136[_0x6f5a('0x49')][_0x6f5a('0x4e')]=path[_0x6f5a('0x4f')](config[_0x6f5a('0x50')],_0x6f5a('0x51'),_0x3ac136[_0x6f5a('0x49')]['name']);}return db[_0x6f5a('0x40')][_0x6f5a('0x4a')](_0x3ac136[_0x6f5a('0x49')],{'transaction':_0x14112e})['then'](function(_0x183f6f){if(_0x3ac136[_0x6f5a('0x49')][_0x6f5a('0x4c')]===_0x6f5a('0x4d')){fs[_0x6f5a('0x52')](_0x183f6f[_0x6f5a('0x4e')],parseInt(_0x6f5a('0x53'),0x8));}var _0x15e736=_0x3ac136[_0x6f5a('0x54')][_0x6f5a('0x55')]({'plain':!![]});if(!_0x15e736)throw new Error(_0x6f5a('0x56'));if(_0x15e736[_0x6f5a('0x57')]===_0x6f5a('0x54')){var _0x50f6ec=_0x183f6f[_0x6f5a('0x55')]({'plain':!![]});return db[_0x6f5a('0x58')][_0x6f5a('0x48')]({'where':{'name':_0x6f5a('0x26'),'userProfileId':_0x15e736[_0x6f5a('0x59')]},'raw':!![]})[_0x6f5a('0x25')](function(_0x1ee854){if(_0x1ee854&&_0x1ee854[_0x6f5a('0x5a')]===0x0){return db['UserProfileResource']['create']({'name':_0x50f6ec[_0x6f5a('0x2b')],'resourceId':_0x50f6ec['id'],'type':_0x1ee854[_0x6f5a('0x2b')],'sectionId':_0x1ee854['id']},{})[_0x6f5a('0x25')](function(){return _0x183f6f;});}else{return _0x183f6f;}})[_0x6f5a('0x44')](function(_0x37d453){logger[_0x6f5a('0x29')](_0x6f5a('0x5b'),_0x37d453);});}return _0x183f6f;});})[_0x6f5a('0x25')](respondWithResult(_0x10e72b,0xc9))['catch'](handleError(_0x10e72b,null));};exports[_0x6f5a('0x5c')]=function(_0xdebe33,_0x51c958,_0x1cd396){var _0x3cfe4a;return db[_0x6f5a('0x40')][_0x6f5a('0x48')]({'where':{'id':_0xdebe33['params']['id']}})[_0x6f5a('0x25')](function(_0x36a7da){if(_0x36a7da){return db[_0x6f5a('0x5d')][_0x6f5a('0x4b')](function(_0x16f0d8){return _0x36a7da[_0x6f5a('0x5c')]({'transaction':_0x16f0d8,'raw':!![]})[_0x6f5a('0x25')](function(_0x3a087f){if(_0x3a087f['directory']){fs[_0x6f5a('0x5e')](_0x3a087f[_0x6f5a('0x4e')])[_0x6f5a('0x5f')](function(_0x498e8f){fs[_0x6f5a('0x60')](path[_0x6f5a('0x4f')](_0x3a087f[_0x6f5a('0x4e')],_0x498e8f));});fs['rmdirSync'](_0x3a087f['directory']);}return _0x3a087f;});})[_0x6f5a('0x44')](function(_0x365154){throw new db[(_0x6f5a('0x61'))][(_0x6f5a('0x62'))](_0x365154[_0x6f5a('0x63')]);});}})[_0x6f5a('0x25')](handleEntityNotFound(_0x51c958,null))[_0x6f5a('0x25')](removeEntity(_0x51c958,null))[_0x6f5a('0x44')](handleError(_0x51c958,null));};exports[_0x6f5a('0x64')]=function(_0x3dac89,_0xe3d66c,_0x251d95){return db[_0x6f5a('0x5d')][_0x6f5a('0x4b')](function(_0x39bd34){var _0x1ac044;return db[_0x6f5a('0x40')]['find']({'where':{'id':_0x3dac89[_0x6f5a('0x46')]['id']}})[_0x6f5a('0x25')](function(_0x295a09){if(_0x295a09){_0x1ac044=_0x295a09;return _0x295a09[_0x6f5a('0x64')](_0x3dac89[_0x6f5a('0x49')]['id'],{'transaction':_0x39bd34});}})[_0x6f5a('0x25')](function(_0xdc03cd){if(_0xdc03cd){return db['Sound'][_0x6f5a('0x65')]({'where':{'id':_0x3dac89['body']['id']},'attributes':['id',_0x6f5a('0x2b'),_0x6f5a('0x66'),_0x6f5a('0x67'),'createdAt'],'raw':!![]});}})[_0x6f5a('0x25')](function(_0x1eaa92){if(_0x1eaa92){var _0x1d47ab=path[_0x6f5a('0x4f')](config[_0x6f5a('0x50')],_0x6f5a('0x68'),util['format'](_0x6f5a('0x69'),path['basename'](_0x1eaa92[_0x6f5a('0x66')],path['extname'](_0x1eaa92[_0x6f5a('0x66')])),_0x1eaa92['converted_format']));var _0x3dc2f3=path[_0x6f5a('0x4f')](config[_0x6f5a('0x50')],_0x6f5a('0x51'),_0x1ac044[_0x6f5a('0x2b')],util[_0x6f5a('0x6a')](_0x6f5a('0x69'),_0x1eaa92['name'],_0x1eaa92[_0x6f5a('0x67')]));fs[_0x6f5a('0x6b')](_0x1d47ab,_0x3dc2f3);return _0x1eaa92;}})[_0x6f5a('0x44')](function(_0x47246c){throw new db[(_0x6f5a('0x61'))][(_0x6f5a('0x62'))](_0x47246c[_0x6f5a('0x63')]);});})[_0x6f5a('0x25')](handleEntityNotFound(_0xe3d66c,null))['then'](respondWithResult(_0xe3d66c,0xc9))[_0x6f5a('0x44')](handleError(_0xe3d66c,null));};exports[_0x6f5a('0x6c')]=function(_0x6b983,_0x68af2d,_0x511f7f){return db['sequelize'][_0x6f5a('0x4b')](function(_0x3882a7){var _0x306111;return db[_0x6f5a('0x40')]['findOne']({'where':{'id':_0x6b983[_0x6f5a('0x46')]['id']}})['then'](handleEntityNotFound(_0x68af2d,null))[_0x6f5a('0x25')](function(_0x174d7a){if(_0x174d7a){_0x306111=_0x174d7a;return _0x174d7a['removeSound'](_0x6b983[_0x6f5a('0x46')]['id2']);}})[_0x6f5a('0x25')](function(_0x5e55b2){if(_0x5e55b2){return db[_0x6f5a('0x6d')]['findOne']({'where':{'id':_0x6b983[_0x6f5a('0x46')][_0x6f5a('0x6e')]},'attributes':['id','name',_0x6f5a('0x66'),'converted_format',_0x6f5a('0x6f')],'raw':!![]});}})[_0x6f5a('0x25')](function(_0x5d21a2){if(_0x5d21a2){fs[_0x6f5a('0x60')](path[_0x6f5a('0x4f')](_0x306111['directory'],util['format']('%s.%s',_0x5d21a2[_0x6f5a('0x2b')],_0x5d21a2[_0x6f5a('0x67')])));return _0x5d21a2;}})[_0x6f5a('0x44')](function(_0xc9fa98){throw new db[(_0x6f5a('0x61'))][(_0x6f5a('0x62'))](_0xc9fa98[_0x6f5a('0x63')]);});})[_0x6f5a('0x25')](handleEntityNotFound(_0x68af2d,null))['then'](respondWithStatusCode(_0x68af2d,0xcc))[_0x6f5a('0x44')](handleError(_0x68af2d,null));};exports[_0x6f5a('0x70')]=function(_0x1dd1cf,_0x2f61c3,_0x1d1c12){var _0x2e8a3e={};var _0x493073={};var _0x9537d6;var _0x46f001;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x1dd1cf['params']['id']}})['then'](handleEntityNotFound(_0x2f61c3,null))[_0x6f5a('0x25')](function(_0x2bcb95){if(_0x2bcb95){_0x9537d6=_0x2bcb95;_0x493073[_0x6f5a('0x31')]=_[_0x6f5a('0x33')](db[_0x6f5a('0x6d')][_0x6f5a('0x2e')]);_0x493073[_0x6f5a('0x32')]=_[_0x6f5a('0x33')](_0x1dd1cf['query']);_0x493073['filters']=_[_0x6f5a('0x35')](_0x493073[_0x6f5a('0x31')],_0x493073[_0x6f5a('0x32')]);_0x2e8a3e[_0x6f5a('0x37')]=_['intersection'](_0x493073[_0x6f5a('0x31')],qs[_0x6f5a('0x36')](_0x1dd1cf[_0x6f5a('0x32')]['fields']));_0x2e8a3e['attributes']=_0x2e8a3e[_0x6f5a('0x37')][_0x6f5a('0x38')]?_0x2e8a3e['attributes']:_0x493073[_0x6f5a('0x31')];_0x2e8a3e[_0x6f5a('0x71')]=qs[_0x6f5a('0x3b')](_0x1dd1cf[_0x6f5a('0x32')][_0x6f5a('0x3b')]);_0x2e8a3e[_0x6f5a('0x3d')]=qs['filters'](_['pick'](_0x1dd1cf[_0x6f5a('0x32')],_0x493073[_0x6f5a('0x34')]));if(_0x1dd1cf['query'][_0x6f5a('0x72')]){_0x2e8a3e[_0x6f5a('0x3d')]=_[_0x6f5a('0x3c')](_0x2e8a3e[_0x6f5a('0x3d')],{'$or':_['map'](_0x2e8a3e[_0x6f5a('0x37')],function(_0x32f19b){var _0x497422={};_0x497422[_0x32f19b]={'$like':'%'+_0x1dd1cf[_0x6f5a('0x32')][_0x6f5a('0x72')]+'%'};return _0x497422;})});}_0x2e8a3e=_[_0x6f5a('0x3c')]({},_0x2e8a3e,_0x1dd1cf['options']);return _0x9537d6[_0x6f5a('0x70')](_0x2e8a3e);}})[_0x6f5a('0x25')](function(_0x4d1e93){if(_0x4d1e93){_0x46f001=_0x4d1e93[_0x6f5a('0x38')];if(!_0x1dd1cf[_0x6f5a('0x32')][_0x6f5a('0x39')]('nolimit')){_0x2e8a3e[_0x6f5a('0x1c')]=qs[_0x6f5a('0x1c')](_0x1dd1cf[_0x6f5a('0x32')]['limit']);_0x2e8a3e[_0x6f5a('0x1a')]=qs['offset'](_0x1dd1cf[_0x6f5a('0x32')][_0x6f5a('0x1a')]);}return _0x9537d6[_0x6f5a('0x70')](_0x2e8a3e);}})[_0x6f5a('0x25')](function(_0x5c2800){if(_0x5c2800){return _0x5c2800?{'count':_0x46f001,'rows':_0x5c2800}:null;}})[_0x6f5a('0x25')](respondWithResult(_0x2f61c3,null))[_0x6f5a('0x44')](handleError(_0x2f61c3,null));}; \ No newline at end of file +var _0x87e0=['body','create','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','addSound','Sound','findOne','createdAt','server/files/sounds/converted','format','%s.%s','save_name','extname','message','removeSound','id2','converted_format','getSounds','pick','filter','rimraf','fast-json-patch','moment','bluebird','mustache','path','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','api','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','get','MusicOnHolds','UserProfileResource','destroy','error','stack','name','status','send','index','VoiceMusicOnHold','rawAttributes','fieldName','type','key','map','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','VIRTUAL','merge','options','findAll','rows','catch','show','params','includeAll','include','find'];(function(_0x31607f,_0x56cef3){var _0x3983f4=function(_0x14393e){while(--_0x14393e){_0x31607f['push'](_0x31607f['shift']());}};_0x3983f4(++_0x56cef3);}(_0x87e0,0x1f3));var _0x087e=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x87e0[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x087e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x087e('0x1'));var rp=require('request-promise');var moment=require(_0x087e('0x2'));var BPromise=require(_0x087e('0x3'));var Mustache=require(_0x087e('0x4'));var util=require('util');var path=require(_0x087e('0x5'));var sox=require('sox');var csv=require(_0x087e('0x6'));var ejs=require(_0x087e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x087e('0x8'));var squel=require(_0x087e('0x9'));var crypto=require('crypto');var jsforce=require(_0x087e('0xa'));var deskjs=require(_0x087e('0xb'));var toCsv=require(_0x087e('0x6'));var querystring=require(_0x087e('0xc'));var Papa=require(_0x087e('0xd'));var Redis=require(_0x087e('0xe'));var authService=require(_0x087e('0xf'));var qs=require(_0x087e('0x10'));var as=require(_0x087e('0x11'));var hardwareService=require(_0x087e('0x12'));var logger=require(_0x087e('0x13'))(_0x087e('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x087e('0x15'));var db=require(_0x087e('0x16'))['db'];function respondWithStatusCode(_0x42586a,_0x416f04){_0x416f04=_0x416f04||0xcc;return function(_0x4e571d){if(_0x4e571d){return _0x42586a[_0x087e('0x17')](_0x416f04);}return _0x42586a['status'](_0x416f04)[_0x087e('0x18')]();};}function respondWithResult(_0x5992fe,_0x24e7fb){_0x24e7fb=_0x24e7fb||0xc8;return function(_0x4bc959){if(_0x4bc959){return _0x5992fe['status'](_0x24e7fb)[_0x087e('0x19')](_0x4bc959);}};}function respondWithFilteredResult(_0x283ab4,_0x249c0a){return function(_0x774d4f){if(_0x774d4f){var _0x402ae3=typeof _0x249c0a[_0x087e('0x1a')]===_0x087e('0x1b')&&typeof _0x249c0a['limit']===_0x087e('0x1b');var _0x38740e=_0x774d4f[_0x087e('0x1c')];var _0x3baef0=_0x402ae3?0x0:_0x249c0a[_0x087e('0x1a')];var _0x592fbe=_0x402ae3?_0x774d4f[_0x087e('0x1c')]:_0x249c0a[_0x087e('0x1a')]+_0x249c0a['limit'];var _0x534716;if(_0x592fbe>=_0x38740e){_0x592fbe=_0x38740e;_0x534716=0xc8;}else{_0x534716=0xce;}_0x283ab4['status'](_0x534716);return _0x283ab4[_0x087e('0x1d')](_0x087e('0x1e'),_0x3baef0+'-'+_0x592fbe+'/'+_0x38740e)[_0x087e('0x19')](_0x774d4f);}return null;};}function patchUpdates(_0x442761){return function(_0x18e22a){try{jsonpatch[_0x087e('0x1f')](_0x18e22a,_0x442761,!![]);}catch(_0x2df1cd){return BPromise[_0x087e('0x20')](_0x2df1cd);}return _0x18e22a[_0x087e('0x21')]();};}function saveUpdates(_0x5432d4,_0x41363c){return function(_0x44df8f){if(_0x44df8f){return _0x44df8f[_0x087e('0x22')](_0x5432d4)[_0x087e('0x23')](function(_0x2c1597){return _0x2c1597;});}return null;};}function removeEntity(_0x5afc6b,_0x20265e){return function(_0x3ce657){if(_0x3ce657){return _0x3ce657['destroy']()['then'](function(){var _0x3f3ac5=_0x3ce657[_0x087e('0x24')]({'plain':!![]});var _0x2639b3=_0x087e('0x25');return db[_0x087e('0x26')][_0x087e('0x27')]({'where':{'type':_0x2639b3,'resourceId':_0x3f3ac5['id']}})['then'](function(){return _0x3ce657;});})[_0x087e('0x23')](function(){_0x5afc6b['status'](0xcc)[_0x087e('0x18')]();});}};}function handleEntityNotFound(_0xa0f585,_0xc0f57b){return function(_0x35b3da){if(!_0x35b3da){_0xa0f585[_0x087e('0x17')](0x194);}return _0x35b3da;};}function handleError(_0x434ac6,_0x147750){_0x147750=_0x147750||0x1f4;return function(_0x58c5b1){logger[_0x087e('0x28')](_0x58c5b1[_0x087e('0x29')]);if(_0x58c5b1[_0x087e('0x2a')]){delete _0x58c5b1[_0x087e('0x2a')];}_0x434ac6[_0x087e('0x2b')](_0x147750)[_0x087e('0x2c')](_0x58c5b1);};}exports[_0x087e('0x2d')]=function(_0x38eb36,_0x28fd8b){var _0x594cdd={},_0x1ac6c1={},_0xf3de4d={'count':0x0,'rows':[]};var _0x46b972=_['map'](db[_0x087e('0x2e')][_0x087e('0x2f')],function(_0x5ecc95){return{'name':_0x5ecc95[_0x087e('0x30')],'type':_0x5ecc95[_0x087e('0x31')][_0x087e('0x32')]};});_0x1ac6c1['model']=_[_0x087e('0x33')](_0x46b972,_0x087e('0x2a'));_0x1ac6c1['query']=_[_0x087e('0x34')](_0x38eb36['query']);_0x1ac6c1['filters']=_[_0x087e('0x35')](_0x1ac6c1[_0x087e('0x36')],_0x1ac6c1[_0x087e('0x37')]);_0x594cdd[_0x087e('0x38')]=_[_0x087e('0x35')](_0x1ac6c1['model'],qs[_0x087e('0x39')](_0x38eb36[_0x087e('0x37')][_0x087e('0x39')]));_0x594cdd[_0x087e('0x38')]=_0x594cdd[_0x087e('0x38')][_0x087e('0x3a')]?_0x594cdd['attributes']:_0x1ac6c1['model'];if(!_0x38eb36['query'][_0x087e('0x3b')]('nolimit')){_0x594cdd[_0x087e('0x3c')]=qs['limit'](_0x38eb36[_0x087e('0x37')][_0x087e('0x3c')]);_0x594cdd[_0x087e('0x1a')]=qs[_0x087e('0x1a')](_0x38eb36[_0x087e('0x37')]['offset']);}_0x594cdd[_0x087e('0x3d')]=qs[_0x087e('0x3e')](_0x38eb36['query'][_0x087e('0x3e')]);delete _0x38eb36[_0x087e('0x37')][_0x087e('0x3e')];_0x594cdd[_0x087e('0x3f')]=qs[_0x087e('0x40')](_['pick'](_0x38eb36[_0x087e('0x37')],_0x1ac6c1[_0x087e('0x40')]),_0x46b972);if(_0x38eb36[_0x087e('0x37')]['filter']){_0x594cdd[_0x087e('0x3f')]=_['merge'](_0x594cdd[_0x087e('0x3f')],{'$or':_['map'](_0x46b972,function(_0x5dcec0){if(_0x5dcec0[_0x087e('0x31')]!==_0x087e('0x41')){var _0x15b3b9={};_0x15b3b9[_0x5dcec0[_0x087e('0x2a')]]={'$like':'%'+_0x38eb36[_0x087e('0x37')]['filter']+'%'};return _0x15b3b9;}})});}_0x594cdd=_[_0x087e('0x42')]({},_0x594cdd,_0x38eb36[_0x087e('0x43')]);var _0x4aa147={'where':_0x594cdd[_0x087e('0x3f')]};return db['VoiceMusicOnHold'][_0x087e('0x1c')](_0x4aa147)[_0x087e('0x23')](function(_0x494aed){_0xf3de4d[_0x087e('0x1c')]=_0x494aed;if(_0x38eb36[_0x087e('0x37')]['includeAll']){_0x594cdd['include']=[{'all':!![]}];}return db[_0x087e('0x2e')][_0x087e('0x44')](_0x594cdd);})[_0x087e('0x23')](function(_0xdd2361){_0xf3de4d[_0x087e('0x45')]=_0xdd2361;return _0xf3de4d;})[_0x087e('0x23')](respondWithFilteredResult(_0x28fd8b,_0x594cdd))[_0x087e('0x46')](handleError(_0x28fd8b,null));};exports[_0x087e('0x47')]=function(_0x10969d,_0x53f925){var _0x5753d3={'raw':![],'where':{'id':_0x10969d[_0x087e('0x48')]['id']}},_0x6b666f={};_0x6b666f['model']=_[_0x087e('0x34')](db[_0x087e('0x2e')][_0x087e('0x2f')]);_0x6b666f[_0x087e('0x37')]=_[_0x087e('0x34')](_0x10969d[_0x087e('0x37')]);_0x6b666f[_0x087e('0x40')]=_[_0x087e('0x35')](_0x6b666f[_0x087e('0x36')],_0x6b666f[_0x087e('0x37')]);_0x5753d3[_0x087e('0x38')]=_[_0x087e('0x35')](_0x6b666f[_0x087e('0x36')],qs[_0x087e('0x39')](_0x10969d[_0x087e('0x37')]['fields']));_0x5753d3[_0x087e('0x38')]=_0x5753d3[_0x087e('0x38')][_0x087e('0x3a')]?_0x5753d3[_0x087e('0x38')]:_0x6b666f['model'];if(_0x10969d[_0x087e('0x37')][_0x087e('0x49')]){_0x5753d3[_0x087e('0x4a')]=[{'all':!![]}];}_0x5753d3=_['merge']({},_0x5753d3,_0x10969d[_0x087e('0x43')]);return db[_0x087e('0x2e')][_0x087e('0x4b')](_0x5753d3)[_0x087e('0x23')](handleEntityNotFound(_0x53f925,null))[_0x087e('0x23')](respondWithResult(_0x53f925,null))[_0x087e('0x46')](handleError(_0x53f925,null));};exports[_0x087e('0x22')]=function(_0x354842,_0x19cdff){if(_0x354842[_0x087e('0x4c')]['id']){delete _0x354842[_0x087e('0x4c')]['id'];}return db['VoiceMusicOnHold'][_0x087e('0x4b')]({'where':{'id':_0x354842[_0x087e('0x48')]['id']}})['then'](handleEntityNotFound(_0x19cdff,null))['then'](saveUpdates(_0x354842[_0x087e('0x4c')],null))[_0x087e('0x23')](respondWithResult(_0x19cdff,null))['catch'](handleError(_0x19cdff,null));};exports[_0x087e('0x4d')]=function(_0x453ce9,_0x243ffb,_0x472bd2){return db['sequelize'][_0x087e('0x4e')](function(_0x5c03a6){if(_0x453ce9['body'][_0x087e('0x4f')]===_0x087e('0x50')){_0x453ce9[_0x087e('0x4c')][_0x087e('0x51')]=path[_0x087e('0x52')](config[_0x087e('0x53')],_0x087e('0x54'),_0x453ce9[_0x087e('0x4c')][_0x087e('0x2a')]);}return db['VoiceMusicOnHold'][_0x087e('0x4d')](_0x453ce9[_0x087e('0x4c')],{'transaction':_0x5c03a6})[_0x087e('0x23')](function(_0x1299da){if(_0x453ce9[_0x087e('0x4c')][_0x087e('0x4f')]===_0x087e('0x50')){fs[_0x087e('0x55')](_0x1299da['directory'],parseInt(_0x087e('0x56'),0x8));}var _0x3d5ab4=_0x453ce9[_0x087e('0x57')]['get']({'plain':!![]});if(!_0x3d5ab4)throw new Error(_0x087e('0x58'));if(_0x3d5ab4[_0x087e('0x59')]===_0x087e('0x57')){var _0x2eccd8=_0x1299da[_0x087e('0x24')]({'plain':!![]});return db[_0x087e('0x5a')][_0x087e('0x4b')]({'where':{'name':_0x087e('0x25'),'userProfileId':_0x3d5ab4['userProfileId']},'raw':!![]})[_0x087e('0x23')](function(_0x31d54b){if(_0x31d54b&&_0x31d54b['autoAssociation']===0x0){return db[_0x087e('0x26')][_0x087e('0x4d')]({'name':_0x2eccd8['name'],'resourceId':_0x2eccd8['id'],'type':_0x31d54b[_0x087e('0x2a')],'sectionId':_0x31d54b['id']},{})[_0x087e('0x23')](function(){return _0x1299da;});}else{return _0x1299da;}})['catch'](function(_0x10c61d){logger[_0x087e('0x28')](_0x087e('0x5b'),_0x10c61d);});}return _0x1299da;});})[_0x087e('0x23')](respondWithResult(_0x243ffb,0xc9))[_0x087e('0x46')](handleError(_0x243ffb,null));};exports['destroy']=function(_0x26a394,_0x551dfd,_0xe445d2){var _0x1c2c5a;return db[_0x087e('0x2e')][_0x087e('0x4b')]({'where':{'id':_0x26a394[_0x087e('0x48')]['id']}})[_0x087e('0x23')](function(_0x3fbf31){if(_0x3fbf31){return db[_0x087e('0x5c')][_0x087e('0x4e')](function(_0x29d716){return _0x3fbf31[_0x087e('0x27')]({'transaction':_0x29d716,'raw':!![]})[_0x087e('0x23')](function(_0x4c516e){if(_0x4c516e[_0x087e('0x51')]){fs[_0x087e('0x5d')](_0x4c516e[_0x087e('0x51')])[_0x087e('0x5e')](function(_0x483f89){fs[_0x087e('0x5f')](path['join'](_0x4c516e[_0x087e('0x51')],_0x483f89));});fs[_0x087e('0x60')](_0x4c516e[_0x087e('0x51')]);}return _0x4c516e;});})['catch'](function(_0x322ab6){throw new db[(_0x087e('0x61'))][(_0x087e('0x62'))](_0x322ab6['message']);});}})[_0x087e('0x23')](handleEntityNotFound(_0x551dfd,null))[_0x087e('0x23')](removeEntity(_0x551dfd,null))[_0x087e('0x46')](handleError(_0x551dfd,null));};exports['addSound']=function(_0x16e28d,_0x453052,_0x17229d){return db[_0x087e('0x5c')][_0x087e('0x4e')](function(_0x5a6d9c){var _0x386748;return db['VoiceMusicOnHold'][_0x087e('0x4b')]({'where':{'id':_0x16e28d[_0x087e('0x48')]['id']}})[_0x087e('0x23')](function(_0xd69c76){if(_0xd69c76){_0x386748=_0xd69c76;return _0xd69c76[_0x087e('0x63')](_0x16e28d['body']['id'],{'transaction':_0x5a6d9c});}})[_0x087e('0x23')](function(_0x499e13){if(_0x499e13){return db[_0x087e('0x64')][_0x087e('0x65')]({'where':{'id':_0x16e28d[_0x087e('0x4c')]['id']},'attributes':['id',_0x087e('0x2a'),'save_name','converted_format',_0x087e('0x66')],'raw':!![]});}})[_0x087e('0x23')](function(_0x2320cf){if(_0x2320cf){var _0x3a73c4=path[_0x087e('0x52')](config[_0x087e('0x53')],_0x087e('0x67'),util[_0x087e('0x68')](_0x087e('0x69'),path['basename'](_0x2320cf[_0x087e('0x6a')],path[_0x087e('0x6b')](_0x2320cf['save_name'])),_0x2320cf['converted_format']));var _0x52b3db=path[_0x087e('0x52')](config[_0x087e('0x53')],_0x087e('0x54'),_0x386748[_0x087e('0x2a')],util[_0x087e('0x68')](_0x087e('0x69'),_0x2320cf['name'],_0x2320cf['converted_format']));fs['symlinkSync'](_0x3a73c4,_0x52b3db);return _0x2320cf;}})[_0x087e('0x46')](function(_0xb4231e){throw new db[(_0x087e('0x61'))][(_0x087e('0x62'))](_0xb4231e[_0x087e('0x6c')]);});})['then'](handleEntityNotFound(_0x453052,null))[_0x087e('0x23')](respondWithResult(_0x453052,0xc9))['catch'](handleError(_0x453052,null));};exports[_0x087e('0x6d')]=function(_0x5ce3e4,_0x684c,_0x227b6a){return db['sequelize'][_0x087e('0x4e')](function(_0x4ee514){var _0x3d5f47;return db[_0x087e('0x2e')][_0x087e('0x65')]({'where':{'id':_0x5ce3e4[_0x087e('0x48')]['id']}})['then'](handleEntityNotFound(_0x684c,null))[_0x087e('0x23')](function(_0x5ec61b){if(_0x5ec61b){_0x3d5f47=_0x5ec61b;return _0x5ec61b[_0x087e('0x6d')](_0x5ce3e4[_0x087e('0x48')][_0x087e('0x6e')]);}})['then'](function(_0x1e73e6){if(_0x1e73e6){return db[_0x087e('0x64')][_0x087e('0x65')]({'where':{'id':_0x5ce3e4[_0x087e('0x48')][_0x087e('0x6e')]},'attributes':['id',_0x087e('0x2a'),_0x087e('0x6a'),_0x087e('0x6f'),_0x087e('0x66')],'raw':!![]});}})[_0x087e('0x23')](function(_0x2e3848){if(_0x2e3848){fs[_0x087e('0x5f')](path[_0x087e('0x52')](_0x3d5f47[_0x087e('0x51')],util[_0x087e('0x68')](_0x087e('0x69'),_0x2e3848[_0x087e('0x2a')],_0x2e3848[_0x087e('0x6f')])));return _0x2e3848;}})['catch'](function(_0x37cc5d){throw new db[(_0x087e('0x61'))]['ValidationError'](_0x37cc5d[_0x087e('0x6c')]);});})[_0x087e('0x23')](handleEntityNotFound(_0x684c,null))[_0x087e('0x23')](respondWithStatusCode(_0x684c,0xcc))[_0x087e('0x46')](handleError(_0x684c,null));};exports[_0x087e('0x70')]=function(_0x58f6af,_0x7e650b,_0x5458e2){var _0xf04a71={};var _0x3e0d43={};var _0x20fe2b;var _0x4278e7;return db[_0x087e('0x2e')][_0x087e('0x65')]({'where':{'id':_0x58f6af[_0x087e('0x48')]['id']}})[_0x087e('0x23')](handleEntityNotFound(_0x7e650b,null))['then'](function(_0x5b211c){if(_0x5b211c){_0x20fe2b=_0x5b211c;_0x3e0d43['model']=_[_0x087e('0x34')](db[_0x087e('0x64')][_0x087e('0x2f')]);_0x3e0d43[_0x087e('0x37')]=_['keys'](_0x58f6af[_0x087e('0x37')]);_0x3e0d43[_0x087e('0x40')]=_[_0x087e('0x35')](_0x3e0d43[_0x087e('0x36')],_0x3e0d43[_0x087e('0x37')]);_0xf04a71[_0x087e('0x38')]=_[_0x087e('0x35')](_0x3e0d43[_0x087e('0x36')],qs[_0x087e('0x39')](_0x58f6af[_0x087e('0x37')][_0x087e('0x39')]));_0xf04a71[_0x087e('0x38')]=_0xf04a71[_0x087e('0x38')][_0x087e('0x3a')]?_0xf04a71[_0x087e('0x38')]:_0x3e0d43['model'];_0xf04a71['order']=qs[_0x087e('0x3e')](_0x58f6af[_0x087e('0x37')][_0x087e('0x3e')]);_0xf04a71[_0x087e('0x3f')]=qs[_0x087e('0x40')](_[_0x087e('0x71')](_0x58f6af[_0x087e('0x37')],_0x3e0d43[_0x087e('0x40')]));if(_0x58f6af[_0x087e('0x37')][_0x087e('0x72')]){_0xf04a71[_0x087e('0x3f')]=_[_0x087e('0x42')](_0xf04a71[_0x087e('0x3f')],{'$or':_[_0x087e('0x33')](_0xf04a71[_0x087e('0x38')],function(_0x12303c){var _0x26f2a1={};_0x26f2a1[_0x12303c]={'$like':'%'+_0x58f6af[_0x087e('0x37')][_0x087e('0x72')]+'%'};return _0x26f2a1;})});}_0xf04a71=_[_0x087e('0x42')]({},_0xf04a71,_0x58f6af['options']);return _0x20fe2b[_0x087e('0x70')](_0xf04a71);}})[_0x087e('0x23')](function(_0x4047de){if(_0x4047de){_0x4278e7=_0x4047de['length'];if(!_0x58f6af[_0x087e('0x37')][_0x087e('0x3b')]('nolimit')){_0xf04a71[_0x087e('0x3c')]=qs['limit'](_0x58f6af[_0x087e('0x37')][_0x087e('0x3c')]);_0xf04a71[_0x087e('0x1a')]=qs[_0x087e('0x1a')](_0x58f6af[_0x087e('0x37')][_0x087e('0x1a')]);}return _0x20fe2b[_0x087e('0x70')](_0xf04a71);}})[_0x087e('0x23')](function(_0x43f839){if(_0x43f839){return _0x43f839?{'count':_0x4278e7,'rows':_0x43f839}:null;}})[_0x087e('0x23')](respondWithResult(_0x7e650b,null))[_0x087e('0x46')](handleError(_0x7e650b,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 6b07341..e8bf098 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 _0x954e=['path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xaf852,_0x2d7f05){var _0x22fcdc=function(_0xa78859){while(--_0xa78859){_0xaf852['push'](_0xaf852['shift']());}};_0x22fcdc(++_0x2d7f05);}(_0x954e,0xcb));var _0xe954=function(_0x37ca5f,_0x7b93d4){_0x37ca5f=_0x37ca5f-0x0;var _0x4b0676=_0x954e[_0x37ca5f];return _0x4b0676;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe954('0x0'))(_0xe954('0x1'));var moment=require(_0xe954('0x2'));var BPromise=require(_0xe954('0x3'));var rp=require(_0xe954('0x4'));var fs=require('fs');var path=require(_0xe954('0x5'));var rimraf=require(_0xe954('0x6'));var config=require(_0xe954('0x7'));var attributes=require(_0xe954('0x8'));module[_0xe954('0x9')]=function(_0x4cb34c,_0x477120){return _0x4cb34c[_0xe954('0xa')](_0xe954('0xb'),attributes,{'tableName':_0xe954('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f0a=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceMusicOnHold','voice_musiconhold'];(function(_0x12408e,_0x5c68d7){var _0x434389=function(_0x10773a){while(--_0x10773a){_0x12408e['push'](_0x12408e['shift']());}};_0x434389(++_0x5c68d7);}(_0x0f0a,0x79));var _0xa0f0=function(_0xd0c4d9,_0x3d556c){_0xd0c4d9=_0xd0c4d9-0x0;var _0x589970=_0x0f0a[_0xd0c4d9];return _0x589970;};'use strict';var _=require('lodash');var util=require(_0xa0f0('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa0f0('0x1'));var BPromise=require(_0xa0f0('0x2'));var rp=require(_0xa0f0('0x3'));var fs=require('fs');var path=require(_0xa0f0('0x4'));var rimraf=require(_0xa0f0('0x5'));var config=require(_0xa0f0('0x6'));var attributes=require('./voiceMusicOnHold.attributes');module[_0xa0f0('0x7')]=function(_0x80ef08,_0x31f0e0){return _0x80ef08[_0xa0f0('0x8')](_0xa0f0('0x9'),attributes,{'tableName':_0xa0f0('0xa'),'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 bc5cd75..0169600 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4f605d,_0x33292f){var _0x45eb99=function(_0x4d5bd7){while(--_0x4d5bd7){_0x4f605d['push'](_0x4f605d['shift']());}};_0x45eb99(++_0x33292f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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 _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0xca3dd0,_0xbd91be){var _0x6d185a=function(_0x4b819f){while(--_0x4b819f){_0xca3dd0['push'](_0xca3dd0['shift']());}};_0x6d185a(++_0xbd91be);}(_0x70e0,0x17b));var _0x070e=function(_0x72e483,_0x1ef7f9){_0x72e483=_0x72e483-0x0;var _0x595f59=_0x70e0[_0x72e483];return _0x595f59;};'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')]('VoiceMusicOnHold,\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')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\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 diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 7dd9795..5f06026 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 _0x0d6a=['removeTeams','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','/describe','describe','/:id/teams','getTeams','post','/:id/users','addTeams','put','/:id','destroy','delete','removeAgents'];(function(_0x2b0f81,_0x3917f0){var _0x5ce74c=function(_0x12dc0d){while(--_0x12dc0d){_0x2b0f81['push'](_0x2b0f81['shift']());}};_0x5ce74c(++_0x3917f0);}(_0x0d6a,0xc9));var _0xa0d6=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x0d6a[_0x50aa2e];return _0x5e07f0;};'use strict';var multer=require(_0xa0d6('0x0'));var util=require(_0xa0d6('0x1'));var path=require('path');var timeout=require(_0xa0d6('0x2'));var express=require(_0xa0d6('0x3'));var router=express[_0xa0d6('0x4')]();var fs_extra=require(_0xa0d6('0x5'));var auth=require(_0xa0d6('0x6'));var interaction=require(_0xa0d6('0x7'));var config=require(_0xa0d6('0x8'));var controller=require(_0xa0d6('0x9'));router[_0xa0d6('0xa')]('/',auth[_0xa0d6('0xb')](),controller['index']);router[_0xa0d6('0xa')](_0xa0d6('0xc'),auth[_0xa0d6('0xb')](),controller[_0xa0d6('0xd')]);router[_0xa0d6('0xa')]('/:id',auth[_0xa0d6('0xb')](),controller['show']);router[_0xa0d6('0xa')]('/:id/users',auth[_0xa0d6('0xb')](),controller['getAgents']);router[_0xa0d6('0xa')](_0xa0d6('0xe'),auth[_0xa0d6('0xb')](),controller[_0xa0d6('0xf')]);router[_0xa0d6('0x10')]('/',auth[_0xa0d6('0xb')](),controller['create']);router[_0xa0d6('0x10')](_0xa0d6('0x11'),auth[_0xa0d6('0xb')](),controller['addAgents']);router[_0xa0d6('0x10')](_0xa0d6('0xe'),auth[_0xa0d6('0xb')](),controller[_0xa0d6('0x12')]);router[_0xa0d6('0x13')](_0xa0d6('0x14'),auth[_0xa0d6('0xb')](),controller['update']);router['delete'](_0xa0d6('0x14'),auth[_0xa0d6('0xb')](),controller[_0xa0d6('0x15')]);router[_0xa0d6('0x16')](_0xa0d6('0x11'),auth[_0xa0d6('0xb')](),controller[_0xa0d6('0x17')]);router['delete'](_0xa0d6('0xe'),auth[_0xa0d6('0xb')](),controller[_0xa0d6('0x18')]);module['exports']=router; \ No newline at end of file +var _0x8d0e=['/:id','/:id/users','/:id/teams','getTeams','post','create','addTeams','put','update','delete','removeTeams','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','index','get','/describe','isAuthenticated','describe'];(function(_0x4df4f6,_0x1b497c){var _0x45976b=function(_0x4eca1c){while(--_0x4eca1c){_0x4df4f6['push'](_0x4df4f6['shift']());}};_0x45976b(++_0x1b497c);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x2bfcfc,_0x453ab1){_0x2bfcfc=_0x2bfcfc-0x0;var _0x2e55b=_0x8d0e[_0x2bfcfc];return _0x2e55b;};'use strict';var multer=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var path=require(_0xe8d0('0x2'));var timeout=require(_0xe8d0('0x3'));var express=require(_0xe8d0('0x4'));var router=express[_0xe8d0('0x5')]();var fs_extra=require(_0xe8d0('0x6'));var auth=require(_0xe8d0('0x7'));var interaction=require(_0xe8d0('0x8'));var config=require('../../config/environment');var controller=require(_0xe8d0('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xe8d0('0xa')]);router[_0xe8d0('0xb')](_0xe8d0('0xc'),auth[_0xe8d0('0xd')](),controller[_0xe8d0('0xe')]);router[_0xe8d0('0xb')](_0xe8d0('0xf'),auth[_0xe8d0('0xd')](),controller['show']);router[_0xe8d0('0xb')](_0xe8d0('0x10'),auth[_0xe8d0('0xd')](),controller['getAgents']);router['get'](_0xe8d0('0x11'),auth[_0xe8d0('0xd')](),controller[_0xe8d0('0x12')]);router[_0xe8d0('0x13')]('/',auth[_0xe8d0('0xd')](),controller[_0xe8d0('0x14')]);router['post'](_0xe8d0('0x10'),auth[_0xe8d0('0xd')](),controller['addAgents']);router[_0xe8d0('0x13')]('/:id/teams',auth['isAuthenticated'](),controller[_0xe8d0('0x15')]);router[_0xe8d0('0x16')](_0xe8d0('0xf'),auth[_0xe8d0('0xd')](),controller[_0xe8d0('0x17')]);router[_0xe8d0('0x18')]('/:id',auth[_0xe8d0('0xd')](),controller['destroy']);router[_0xe8d0('0x18')](_0xe8d0('0x10'),auth[_0xe8d0('0xd')](),controller['removeAgents']);router['delete']('/:id/teams',auth[_0xe8d0('0xd')](),controller[_0xe8d0('0x19')]);module[_0xe8d0('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 147152a..fded640 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 _0x3711=['exports','name','VIRTUAL','system-','STRING','INTEGER','sequelize'];(function(_0x4f36be,_0x3a46ce){var _0x4995f0=function(_0x192a20){while(--_0x192a20){_0x4f36be['push'](_0x4f36be['shift']());}};_0x4995f0(++_0x3a46ce);}(_0x3711,0x102));var _0x1371=function(_0x521d9c,_0x564b21){_0x521d9c=_0x521d9c-0x0;var _0x2b9132=_0x3711[_0x521d9c];return _0x2b9132;};'use strict';var Sequelize=require(_0x1371('0x0'));module[_0x1371('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1371('0x2')},'prefix':{'type':Sequelize[_0x1371('0x3')],'get':function(_0x9850d1){return _0x1371('0x4')+this['getDataValue'](_0x1371('0x2'))+'-';}},'description':{'type':Sequelize[_0x1371('0x5')]},'callerIdAll':{'type':Sequelize[_0x1371('0x5')]},'VoiceExtensionId':{'type':Sequelize[_0x1371('0x6')]}}; \ No newline at end of file +var _0x854a=['STRING','INTEGER','sequelize','exports','VIRTUAL','system-','getDataValue','name'];(function(_0x59b4c6,_0x16bafd){var _0x4eda14=function(_0x4ae7c9){while(--_0x4ae7c9){_0x59b4c6['push'](_0x59b4c6['shift']());}};_0x4eda14(++_0x16bafd);}(_0x854a,0x92));var _0xa854=function(_0xdbc0cb,_0x57c245){_0xdbc0cb=_0xdbc0cb-0x0;var _0x1a308f=_0x854a[_0xdbc0cb];return _0x1a308f;};'use strict';var Sequelize=require(_0xa854('0x0'));module[_0xa854('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0xa854('0x2')],'get':function(_0x1942a0){return _0xa854('0x3')+this[_0xa854('0x4')](_0xa854('0x5'))+'-';}},'description':{'type':Sequelize[_0xa854('0x6')]},'callerIdAll':{'type':Sequelize[_0xa854('0x6')]},'VoiceExtensionId':{'type':Sequelize[_0xa854('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index a2f4385..09a2602 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 _0xb03e=['from','team_has_voice_prefixes','join','user_has_teams','clone','toString','SELECT','every','TeamId','all','union','compact','value','isEmpty','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','VoicePrefixes','error','stack','index','VoicePrefix','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','show','keys','fields','find','params','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','system','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','VoicePrefixId','Extensions\x20creation\x20failed','push','callerIdAll','Set','PREFIX-CALLERIDALL=','goto','${EXTEN:','charAt','system-','findById','addAgents','omit','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','Team','getTeams','addTeams','Agents','online','flatMap','TeamVoicePrefix','upsert','each','findOrCreate','forEach','removeTeams','select','field','tq.TeamId'];(function(_0x1f31e3,_0x3194cd){var _0x349e6c=function(_0x4e2349){while(--_0x4e2349){_0x1f31e3['push'](_0x1f31e3['shift']());}};_0x349e6c(++_0x3194cd);}(_0xb03e,0x1eb));var _0xeb03=function(_0x182740,_0x9f82a1){_0x182740=_0x182740-0x0;var _0x27463f=_0xb03e[_0x182740];return _0x27463f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeb03('0x0'));var zipdir=require(_0xeb03('0x1'));var jsonpatch=require(_0xeb03('0x2'));var rp=require(_0xeb03('0x3'));var moment=require(_0xeb03('0x4'));var BPromise=require(_0xeb03('0x5'));var Mustache=require(_0xeb03('0x6'));var util=require(_0xeb03('0x7'));var path=require(_0xeb03('0x8'));var sox=require(_0xeb03('0x9'));var csv=require(_0xeb03('0xa'));var ejs=require(_0xeb03('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeb03('0xc'));var squel=require(_0xeb03('0xd'));var crypto=require(_0xeb03('0xe'));var jsforce=require(_0xeb03('0xf'));var deskjs=require(_0xeb03('0x10'));var toCsv=require(_0xeb03('0xa'));var querystring=require('querystring');var Papa=require(_0xeb03('0x11'));var Redis=require(_0xeb03('0x12'));var authService=require(_0xeb03('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xeb03('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeb03('0x15'))(_0xeb03('0x16'));var utils=require(_0xeb03('0x17'));var config=require(_0xeb03('0x18'));var licenseUtil=require(_0xeb03('0x19'));var db=require(_0xeb03('0x1a'))['db'];config[_0xeb03('0x1b')]=_[_0xeb03('0x1c')](config[_0xeb03('0x1b')],{'host':_0xeb03('0x1d'),'port':0x18eb});var socket=require(_0xeb03('0x1e'))(new Redis(config[_0xeb03('0x1b')]));require('./voicePrefix.socket')[_0xeb03('0x1f')](socket);function respondWithStatusCode(_0x100bef,_0x372c71){_0x372c71=_0x372c71||0xcc;return function(_0x33f9ba){if(_0x33f9ba){return _0x100bef['sendStatus'](_0x372c71);}return _0x100bef[_0xeb03('0x20')](_0x372c71)[_0xeb03('0x21')]();};}function respondWithResult(_0x3f26ef,_0x478989){_0x478989=_0x478989||0xc8;return function(_0x7ce874){if(_0x7ce874){return _0x3f26ef[_0xeb03('0x20')](_0x478989)[_0xeb03('0x22')](_0x7ce874);}};}function respondWithFilteredResult(_0x44716c,_0x42fa4e){return function(_0x1b4cbd){if(_0x1b4cbd){var _0x167a33=typeof _0x42fa4e[_0xeb03('0x23')]===_0xeb03('0x24')&&typeof _0x42fa4e[_0xeb03('0x25')]===_0xeb03('0x24');var _0x2c238d=_0x1b4cbd[_0xeb03('0x26')];var _0x19bddf=_0x167a33?0x0:_0x42fa4e['offset'];var _0x1bea3f=_0x167a33?_0x1b4cbd[_0xeb03('0x26')]:_0x42fa4e[_0xeb03('0x23')]+_0x42fa4e[_0xeb03('0x25')];var _0xe5a1c2;if(_0x1bea3f>=_0x2c238d){_0x1bea3f=_0x2c238d;_0xe5a1c2=0xc8;}else{_0xe5a1c2=0xce;}_0x44716c[_0xeb03('0x20')](_0xe5a1c2);return _0x44716c[_0xeb03('0x27')](_0xeb03('0x28'),_0x19bddf+'-'+_0x1bea3f+'/'+_0x2c238d)[_0xeb03('0x22')](_0x1b4cbd);}return null;};}function patchUpdates(_0x5a704b){return function(_0x712ac2){try{jsonpatch[_0xeb03('0x29')](_0x712ac2,_0x5a704b,!![]);}catch(_0x11ea85){return BPromise[_0xeb03('0x2a')](_0x11ea85);}return _0x712ac2[_0xeb03('0x2b')]();};}function saveUpdates(_0x5dcda3,_0x638353){return function(_0x406864){if(_0x406864){return _0x406864[_0xeb03('0x2c')](_0x5dcda3)[_0xeb03('0x2d')](function(_0x3f276a){return _0x3f276a;});}return null;};}function removeEntity(_0x119697,_0xb04f34){return function(_0x3f68f3){if(_0x3f68f3){return _0x3f68f3[_0xeb03('0x2e')]()['then'](function(){var _0x832372=_0x3f68f3[_0xeb03('0x2f')]({'plain':!![]});var _0x2683f9=_0xeb03('0x30');return db['UserProfileResource']['destroy']({'where':{'type':_0x2683f9,'resourceId':_0x832372['id']}})[_0xeb03('0x2d')](function(){return _0x3f68f3;});})['then'](function(){_0x119697[_0xeb03('0x20')](0xcc)[_0xeb03('0x21')]();});}};}function handleEntityNotFound(_0x160a37,_0x5db8bb){return function(_0xd4c8ec){if(!_0xd4c8ec){_0x160a37['sendStatus'](0x194);}return _0xd4c8ec;};}function handleError(_0x5cb729,_0x49e316){_0x49e316=_0x49e316||0x1f4;return function(_0x538d19){logger[_0xeb03('0x31')](_0x538d19[_0xeb03('0x32')]);if(_0x538d19['name']){delete _0x538d19['name'];}_0x5cb729['status'](_0x49e316)['send'](_0x538d19);};}exports[_0xeb03('0x33')]=function(_0x3655c3,_0x32aff7){var _0x2d2ddd={},_0x19fa35={},_0x5234dc={'count':0x0,'rows':[]};var _0x13efc6=_['map'](db[_0xeb03('0x34')][_0xeb03('0x35')],function(_0x19ceae){return{'name':_0x19ceae[_0xeb03('0x36')],'type':_0x19ceae[_0xeb03('0x37')][_0xeb03('0x38')]};});_0x19fa35[_0xeb03('0x39')]=_[_0xeb03('0x3a')](_0x13efc6,'name');_0x19fa35[_0xeb03('0x3b')]=_['keys'](_0x3655c3[_0xeb03('0x3b')]);_0x19fa35[_0xeb03('0x3c')]=_[_0xeb03('0x3d')](_0x19fa35[_0xeb03('0x39')],_0x19fa35[_0xeb03('0x3b')]);_0x2d2ddd[_0xeb03('0x3e')]=_['intersection'](_0x19fa35[_0xeb03('0x39')],qs['fields'](_0x3655c3['query']['fields']));_0x2d2ddd[_0xeb03('0x3e')]=_0x2d2ddd[_0xeb03('0x3e')][_0xeb03('0x3f')]?_0x2d2ddd[_0xeb03('0x3e')]:_0x19fa35[_0xeb03('0x39')];if(!_0x3655c3['query'][_0xeb03('0x40')](_0xeb03('0x41'))){_0x2d2ddd[_0xeb03('0x25')]=qs['limit'](_0x3655c3['query'][_0xeb03('0x25')]);_0x2d2ddd[_0xeb03('0x23')]=qs[_0xeb03('0x23')](_0x3655c3['query'][_0xeb03('0x23')]);}_0x2d2ddd[_0xeb03('0x42')]=qs['sort'](_0x3655c3['query'][_0xeb03('0x43')]);_0x2d2ddd[_0xeb03('0x44')]=qs['filters'](_[_0xeb03('0x45')](_0x3655c3[_0xeb03('0x3b')],_0x19fa35[_0xeb03('0x3c')]),_0x13efc6);if(_0x3655c3[_0xeb03('0x3b')][_0xeb03('0x46')]){_0x2d2ddd[_0xeb03('0x44')]=_[_0xeb03('0x47')](_0x2d2ddd[_0xeb03('0x44')],{'$or':_[_0xeb03('0x3a')](_0x13efc6,function(_0x286f48){if(_0x286f48[_0xeb03('0x37')]!==_0xeb03('0x48')){var _0x2a9348={};_0x2a9348[_0x286f48[_0xeb03('0x49')]]={'$like':'%'+_0x3655c3[_0xeb03('0x3b')][_0xeb03('0x46')]+'%'};return _0x2a9348;}})});}_0x2d2ddd=_[_0xeb03('0x47')]({},_0x2d2ddd,_0x3655c3[_0xeb03('0x4a')]);var _0x35e53d={'where':_0x2d2ddd[_0xeb03('0x44')]};return db[_0xeb03('0x34')][_0xeb03('0x26')](_0x35e53d)[_0xeb03('0x2d')](function(_0x5bb7d9){_0x5234dc['count']=_0x5bb7d9;if(_0x3655c3[_0xeb03('0x3b')][_0xeb03('0x4b')]){_0x2d2ddd[_0xeb03('0x4c')]=[{'all':!![]}];}return db[_0xeb03('0x34')][_0xeb03('0x4d')](_0x2d2ddd);})[_0xeb03('0x2d')](function(_0x103c78){_0x5234dc[_0xeb03('0x4e')]=_0x103c78;return _0x5234dc;})['then'](respondWithFilteredResult(_0x32aff7,_0x2d2ddd))[_0xeb03('0x4f')](handleError(_0x32aff7,null));};exports[_0xeb03('0x50')]=function(_0x275d4d,_0xe9dcb0){var _0x528c0f={'raw':![],'where':{'id':_0x275d4d['params']['id']}},_0x57f59e={};_0x57f59e[_0xeb03('0x39')]=_['keys'](db['VoicePrefix']['rawAttributes']);_0x57f59e[_0xeb03('0x3b')]=_[_0xeb03('0x51')](_0x275d4d[_0xeb03('0x3b')]);_0x57f59e[_0xeb03('0x3c')]=_[_0xeb03('0x3d')](_0x57f59e[_0xeb03('0x39')],_0x57f59e['query']);_0x528c0f[_0xeb03('0x3e')]=_['intersection'](_0x57f59e['model'],qs[_0xeb03('0x52')](_0x275d4d[_0xeb03('0x3b')][_0xeb03('0x52')]));_0x528c0f['attributes']=_0x528c0f[_0xeb03('0x3e')][_0xeb03('0x3f')]?_0x528c0f[_0xeb03('0x3e')]:_0x57f59e[_0xeb03('0x39')];if(_0x275d4d[_0xeb03('0x3b')]['includeAll']){_0x528c0f[_0xeb03('0x4c')]=[{'all':!![]}];}_0x528c0f=_['merge']({},_0x528c0f,_0x275d4d[_0xeb03('0x4a')]);return db[_0xeb03('0x34')][_0xeb03('0x53')](_0x528c0f)[_0xeb03('0x2d')](handleEntityNotFound(_0xe9dcb0,null))[_0xeb03('0x2d')](respondWithResult(_0xe9dcb0,null))[_0xeb03('0x4f')](handleError(_0xe9dcb0,null));};exports[_0xeb03('0x2e')]=function(_0x292319,_0x38c993){return db[_0xeb03('0x34')][_0xeb03('0x53')]({'where':{'id':_0x292319[_0xeb03('0x54')]['id']}})[_0xeb03('0x2d')](handleEntityNotFound(_0x38c993,null))[_0xeb03('0x2d')](removeEntity(_0x38c993,null))[_0xeb03('0x4f')](handleError(_0x38c993,null));};exports[_0xeb03('0x55')]=function(_0xf5c1ab,_0x79b7c6){return db[_0xeb03('0x34')][_0xeb03('0x55')]()[_0xeb03('0x2d')](respondWithResult(_0x79b7c6,null))[_0xeb03('0x4f')](handleError(_0x79b7c6,null));};exports[_0xeb03('0x56')]=function(_0x365520,_0x509d79){var _0x17112e;return db[_0xeb03('0x57')][_0xeb03('0x58')](function(_0x5405b4){return db[_0xeb03('0x34')][_0xeb03('0x56')](_0x365520[_0xeb03('0x59')],{'transaction':_0x5405b4})[_0xeb03('0x2d')](function(_0x103da5){_0x17112e=_0x103da5[_0xeb03('0x2f')]({'plain':!![]});return db[_0xeb03('0x5a')][_0xeb03('0x53')]({'where':{'id':_0x17112e[_0xeb03('0x5b')]},'raw':!![]})[_0xeb03('0x2d')](function(_0x46f52e){return createVoicePrefixExtensions(_0x17112e,_0x46f52e,_0x5405b4);});});})[_0xeb03('0x2d')](function(){var _0xf9beaf=_0x365520[_0xeb03('0x5c')]['get']({'plain':!![]});if(!_0xf9beaf)throw new Error(_0xeb03('0x5d'));if(_0xf9beaf[_0xeb03('0x5e')]===_0xeb03('0x5c')){var _0x259db7=_0x17112e;return db[_0xeb03('0x5f')][_0xeb03('0x53')]({'where':{'name':_0xeb03('0x30'),'userProfileId':_0xf9beaf[_0xeb03('0x60')]},'raw':!![]})[_0xeb03('0x2d')](function(_0x23406a){if(_0x23406a&&_0x23406a['autoAssociation']===0x0){return db[_0xeb03('0x61')][_0xeb03('0x56')]({'name':_0x259db7[_0xeb03('0x49')],'resourceId':_0x259db7['id'],'type':_0x23406a[_0xeb03('0x49')],'sectionId':_0x23406a['id']},{})['then'](function(){return _0x17112e;});}else{return _0x17112e;}})[_0xeb03('0x4f')](function(_0x68e1b7){logger[_0xeb03('0x31')](_0xeb03('0x62'),_0x68e1b7);throw _0x68e1b7;});}return _0x17112e;})[_0xeb03('0x2d')](respondWithResult(_0x509d79,null))['catch'](handleError(_0x509d79,null));};function Extension(_0x43efc3,_0x10beeb,_0x28e488,_0x5e1361){this[_0xeb03('0x63')]=_0xeb03('0x64');this['exten']=_0x43efc3;this[_0xeb03('0x65')]=_0x28e488;this[_0xeb03('0x37')]=_0xeb03('0x66');this['description']=_0xeb03('0x67');this[_0xeb03('0x68')]=_0x10beeb;this['appdata']=_0x5e1361;}function createVoicePrefixExtensions(_0x3eb482,_0xfeb8e2,_0x1972fb){return new BPromise(function(_0x3ac2de,_0x3963a7){var _0x38618e=new Extension(formatPrefixName(_0x3eb482[_0xeb03('0x69')]),0x1,_0xeb03('0x6a'),'Voice\x20Prefix');_0x38618e[_0xeb03('0x6b')]=_0x3eb482['id'];return db['VoiceExtension'][_0xeb03('0x56')](_0x38618e,{'transaction':_0x1972fb})[_0xeb03('0x2d')](function(_0x3a9518){var _0x59d0c7=_0x3a9518[_0xeb03('0x2f')]({'plain':!![]});var _0x1508f6=_[_0xeb03('0x3a')](addVoicePrefixExtensions(_0x3eb482,_0xfeb8e2),function(_0x467a9d){_0x467a9d['VoiceExtensionId']=_0x59d0c7['id'];_0x467a9d[_0xeb03('0x6b')]=_0x3eb482['id'];return _0x467a9d;});return db[_0xeb03('0x5a')]['bulkCreate'](_0x1508f6,{'transaction':_0x1972fb})['then'](function(_0x583518){if(!_0x583518){return _0x3963a7(_0xeb03('0x6c'));}else{return _0x3ac2de(_0x583518);}})[_0xeb03('0x4f')](function(_0x9148a6){return _0x3963a7(_0x9148a6);});});;});};function addVoicePrefixExtensions(_0x16ad3a,_0x3da5f4){var _0x461777=[];var _0x443fc9=formatPrefixName(_0x16ad3a[_0xeb03('0x69')]);_0x461777[_0xeb03('0x6d')](new Extension(_0x443fc9,0x2,'Set','CDR(prefix)='+_0x16ad3a[_0xeb03('0x49')]));if(_0x16ad3a[_0xeb03('0x6e')]){_0x461777['push'](new Extension(_0x443fc9,0x3,_0xeb03('0x6f'),_0xeb03('0x70')+_0x16ad3a[_0xeb03('0x6e')]));}else{_0x461777[_0xeb03('0x6d')](new Extension(_0x443fc9,0x3,'NoOp','No\x20callerid\x20available'));}_0x461777[_0xeb03('0x6d')](new Extension(_0x443fc9,0x4,_0xeb03('0x71'),_0x3da5f4[_0xeb03('0x63')]+','+_0xeb03('0x72')+(0x8+_0x16ad3a[_0xeb03('0x49')][_0xeb03('0x3f')])+'}'+','+0x1));return _0x461777;}function formatPrefixName(_0x1a8057){var _0x2ee5c1='_';for(var _0x2e67a4=0x0;_0x2e67a4<_0x1a8057[_0xeb03('0x3f')];_0x2e67a4++){if(_0x1a8057[_0xeb03('0x73')](_0x2e67a4)=='-'){_0x2ee5c1+=_0x1a8057['charAt'](_0x2e67a4);}else{_0x2ee5c1+='['+_0x1a8057['charAt'](_0x2e67a4)+']';}}_0x2ee5c1+='.';return _0x2ee5c1;}exports[_0xeb03('0x2c')]=function(_0x4e52a4,_0x1099ff,_0x4cf4f1){var _0x30623a=_0x4e52a4['body'];_0x30623a[_0xeb03('0x69')]=_0xeb03('0x74')+_0x30623a['name']+'-';return db[_0xeb03('0x57')]['transaction'](function(_0x45f0aa){return db['VoicePrefix'][_0xeb03('0x2c')](_0x30623a,{'where':{'id':_0x30623a['id']},'transaction':_0x45f0aa})['then'](function(){return db['VoiceExtension'][_0xeb03('0x2e')]({'where':{'VoicePrefixId':_0x30623a['id']},'transaction':_0x45f0aa})[_0xeb03('0x2d')](function(){return db[_0xeb03('0x5a')][_0xeb03('0x53')]({'where':{'id':_0x30623a[_0xeb03('0x5b')]},'raw':!![]})[_0xeb03('0x2d')](function(_0x39c15d){return createVoicePrefixExtensions(_0x30623a,_0x39c15d,_0x45f0aa);});});});})['then'](function(){return db[_0xeb03('0x34')][_0xeb03('0x75')](_0x30623a['id']);})[_0xeb03('0x2d')](respondWithResult(_0x1099ff,null))[_0xeb03('0x4f')](handleError(_0x1099ff,null));};exports[_0xeb03('0x76')]=function(_0x126a7f,_0x137a98,_0x4fff6e){return db[_0xeb03('0x34')][_0xeb03('0x53')]({'where':{'id':_0x126a7f[_0xeb03('0x54')]['id']}})[_0xeb03('0x2d')](handleEntityNotFound(_0x137a98,null))[_0xeb03('0x2d')](function(_0xcd7ab1){if(_0xcd7ab1){return _0xcd7ab1[_0xeb03('0x76')](_0x126a7f[_0xeb03('0x59')]['ids'],_[_0xeb03('0x77')](_0x126a7f[_0xeb03('0x59')],[_0xeb03('0x78'),'id'])||{})[_0xeb03('0x79')](function(_0x17c010){for(var _0x5ace77=0x0;_0x5ace77<_0x126a7f[_0xeb03('0x59')][_0xeb03('0x78')][_0xeb03('0x3f')];_0x5ace77+=0x1){socket[_0xeb03('0x7a')](_0xeb03('0x7b'),{'UserId':Number(_0x126a7f[_0xeb03('0x59')][_0xeb03('0x78')][_0x5ace77]),'VoicePrefixId':Number(_0x126a7f['params']['id'])});}return _0x17c010;});}})[_0xeb03('0x2d')](respondWithResult(_0x137a98,null))[_0xeb03('0x4f')](handleError(_0x137a98,null));};exports[_0xeb03('0x7c')]=function(_0x21dfab,_0x396329,_0x48dc21){return db[_0xeb03('0x34')][_0xeb03('0x53')]({'where':{'id':_0x21dfab[_0xeb03('0x54')]['id']}})[_0xeb03('0x2d')](handleEntityNotFound(_0x396329,null))[_0xeb03('0x2d')](function(_0x215759){if(_0x215759){return _0x215759[_0xeb03('0x7c')](_0x21dfab['query'][_0xeb03('0x78')])[_0xeb03('0x2d')](function(){if(_[_0xeb03('0x7d')](_0x21dfab[_0xeb03('0x3b')][_0xeb03('0x78')])){for(var _0x388fbd=0x0;_0x388fbd<_0x21dfab['query'][_0xeb03('0x78')][_0xeb03('0x3f')];_0x388fbd+=0x1){socket[_0xeb03('0x7a')]('userVoicePrefix:remove',{'UserId':Number(_0x21dfab[_0xeb03('0x3b')][_0xeb03('0x78')][_0x388fbd]),'VoicePrefixId':Number(_0x21dfab[_0xeb03('0x54')]['id'])});}}else{socket[_0xeb03('0x7a')](_0xeb03('0x7e'),{'UserId':Number(_0x21dfab[_0xeb03('0x3b')][_0xeb03('0x78')]),'VoicePrefixId':Number(_0x21dfab['params']['id'])});}});}})['then'](respondWithStatusCode(_0x396329,null))[_0xeb03('0x4f')](handleError(_0x396329,null));};exports[_0xeb03('0x7f')]=function(_0x3630a7,_0xe55200,_0x511e5a){var _0x8ba377={};var _0x42c477={};var _0x5b60a4;var _0x45fd83;return db[_0xeb03('0x34')][_0xeb03('0x80')]({'where':{'id':_0x3630a7[_0xeb03('0x54')]['id']}})[_0xeb03('0x2d')](handleEntityNotFound(_0xe55200,null))[_0xeb03('0x2d')](function(_0x5ea593){if(_0x5ea593){_0x5b60a4=_0x5ea593;_0x42c477[_0xeb03('0x39')]=_[_0xeb03('0x51')](db[_0xeb03('0x81')][_0xeb03('0x35')]);_0x42c477[_0xeb03('0x3b')]=_[_0xeb03('0x51')](_0x3630a7[_0xeb03('0x3b')]);_0x42c477[_0xeb03('0x3c')]=_[_0xeb03('0x3d')](_0x42c477[_0xeb03('0x39')],_0x42c477['query']);_0x8ba377[_0xeb03('0x3e')]=_[_0xeb03('0x3d')](_0x42c477['model'],qs[_0xeb03('0x52')](_0x3630a7[_0xeb03('0x3b')]['fields']));_0x8ba377[_0xeb03('0x3e')]=_0x8ba377[_0xeb03('0x3e')][_0xeb03('0x3f')]?_0x8ba377[_0xeb03('0x3e')]:_0x42c477[_0xeb03('0x39')];_0x8ba377['order']=qs['sort'](_0x3630a7['query'][_0xeb03('0x43')]);_0x8ba377['where']=qs[_0xeb03('0x3c')](_[_0xeb03('0x45')](_0x3630a7[_0xeb03('0x3b')],_0x42c477[_0xeb03('0x3c')]));if(_0x3630a7[_0xeb03('0x3b')][_0xeb03('0x46')]){_0x8ba377[_0xeb03('0x44')]=_[_0xeb03('0x47')](_0x8ba377[_0xeb03('0x44')],{'$or':_[_0xeb03('0x3a')](_0x8ba377[_0xeb03('0x3e')],function(_0x27a388){var _0x4ec45c={};_0x4ec45c[_0x27a388]={'$like':'%'+_0x3630a7['query'][_0xeb03('0x46')]+'%'};return _0x4ec45c;})});}_0x8ba377=_['merge']({},_0x8ba377,_0x3630a7['options']);return _0x5b60a4[_0xeb03('0x7f')](_0x8ba377);}})[_0xeb03('0x2d')](function(_0x502b25){if(_0x502b25){_0x45fd83=_0x502b25['length'];if(!_0x3630a7[_0xeb03('0x3b')][_0xeb03('0x40')]('nolimit')){_0x8ba377[_0xeb03('0x25')]=qs[_0xeb03('0x25')](_0x3630a7[_0xeb03('0x3b')][_0xeb03('0x25')]);_0x8ba377[_0xeb03('0x23')]=qs['offset'](_0x3630a7[_0xeb03('0x3b')]['offset']);}return _0x5b60a4['getAgents'](_0x8ba377);}})[_0xeb03('0x2d')](function(_0x2d12eb){if(_0x2d12eb){return _0x2d12eb?{'count':_0x45fd83,'rows':_0x2d12eb}:null;}})[_0xeb03('0x2d')](respondWithResult(_0xe55200,null))[_0xeb03('0x4f')](handleError(_0xe55200,null));};exports['getTeams']=function(_0x4b59f4,_0xf9f2d3,_0x847253){var _0x70343f={};var _0x2d6225={};var _0x388642;var _0x3dc483;return db[_0xeb03('0x34')][_0xeb03('0x80')]({'where':{'id':_0x4b59f4['params']['id']}})['then'](handleEntityNotFound(_0xf9f2d3,null))[_0xeb03('0x2d')](function(_0x5741d4){if(_0x5741d4){_0x388642=_0x5741d4;_0x2d6225[_0xeb03('0x39')]=_['keys'](db[_0xeb03('0x82')][_0xeb03('0x35')]);_0x2d6225[_0xeb03('0x3b')]=_[_0xeb03('0x51')](_0x4b59f4[_0xeb03('0x3b')]);_0x2d6225[_0xeb03('0x3c')]=_[_0xeb03('0x3d')](_0x2d6225[_0xeb03('0x39')],_0x2d6225['query']);_0x70343f['attributes']=_[_0xeb03('0x3d')](_0x2d6225[_0xeb03('0x39')],qs[_0xeb03('0x52')](_0x4b59f4[_0xeb03('0x3b')][_0xeb03('0x52')]));_0x70343f['attributes']=_0x70343f[_0xeb03('0x3e')][_0xeb03('0x3f')]?_0x70343f['attributes']:_0x2d6225[_0xeb03('0x39')];_0x70343f[_0xeb03('0x42')]=qs[_0xeb03('0x43')](_0x4b59f4[_0xeb03('0x3b')][_0xeb03('0x43')]);_0x70343f[_0xeb03('0x44')]=qs[_0xeb03('0x3c')](_[_0xeb03('0x45')](_0x4b59f4[_0xeb03('0x3b')],_0x2d6225[_0xeb03('0x3c')]));if(_0x4b59f4[_0xeb03('0x3b')][_0xeb03('0x46')]){_0x70343f[_0xeb03('0x44')]=_[_0xeb03('0x47')](_0x70343f['where'],{'$or':_[_0xeb03('0x3a')](_0x70343f[_0xeb03('0x3e')],function(_0x4c6b85){var _0x1f3ee1={};_0x1f3ee1[_0x4c6b85]={'$like':'%'+_0x4b59f4['query'][_0xeb03('0x46')]+'%'};return _0x1f3ee1;})});}_0x70343f=_['merge']({},_0x70343f,_0x4b59f4[_0xeb03('0x4a')]);return _0x388642[_0xeb03('0x83')](_0x70343f);}})[_0xeb03('0x2d')](function(_0x1df994){if(_0x1df994){_0x3dc483=_0x1df994[_0xeb03('0x3f')];if(!_0x4b59f4[_0xeb03('0x3b')][_0xeb03('0x40')](_0xeb03('0x41'))){_0x70343f['limit']=qs[_0xeb03('0x25')](_0x4b59f4[_0xeb03('0x3b')][_0xeb03('0x25')]);_0x70343f[_0xeb03('0x23')]=qs['offset'](_0x4b59f4[_0xeb03('0x3b')]['offset']);}return _0x388642[_0xeb03('0x83')](_0x70343f);}})[_0xeb03('0x2d')](function(_0x423ddd){if(_0x423ddd){return _0x423ddd?{'count':_0x3dc483,'rows':_0x423ddd}:null;}})[_0xeb03('0x2d')](respondWithResult(_0xf9f2d3,null))['catch'](handleError(_0xf9f2d3,null));};exports[_0xeb03('0x84')]=function(_0x473d63,_0x1fc15a,_0x45f4d3){var _0x5095a6=_0x473d63[_0xeb03('0x59')]['ids'];var _0x4e0fd8;return db['Team'][_0xeb03('0x4d')]({'where':{'id':_0x5095a6},'attributes':['id'],'include':[{'model':db['User'],'as':_0xeb03('0x85'),'attributes':['id',_0xeb03('0x49'),_0xeb03('0x86'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x50b2c5){if(_0x50b2c5){_0x4e0fd8=_0x50b2c5;var _0x5c7f6e=_[_0xeb03('0x87')](_0x50b2c5,function(_0x392aaa){var _0x117c5e=_0x392aaa[_0xeb03('0x2f')]({'plain':!![]});return _0x117c5e[_0xeb03('0x85')];});return db[_0xeb03('0x34')]['find']({'where':{'id':_0x473d63[_0xeb03('0x54')]['id']}})[_0xeb03('0x2d')](function(_0x2d8bca){return db[_0xeb03('0x57')]['transaction'](function(_0x5c49c9){return _0x2d8bca[_0xeb03('0x84')](_0x5095a6,{'transaction':_0x5c49c9})[_0xeb03('0x2d')](function(){return BPromise['each'](_0x4e0fd8,function(_0xc7a504){return db[_0xeb03('0x88')][_0xeb03('0x89')]({'TeamId':_0xc7a504['id'],'VoicePrefixId':_0x473d63[_0xeb03('0x54')]['id']},{'transaction':_0x5c49c9});});})[_0xeb03('0x2d')](function(){return BPromise[_0xeb03('0x8a')](_0x5c7f6e,function(_0x11cc99){return db['UserVoicePrefix'][_0xeb03('0x8b')]({'where':{'UserId':_0x11cc99['id'],'VoicePrefixId':_0x473d63[_0xeb03('0x54')]['id']},'transaction':_0x5c49c9});});})[_0xeb03('0x2d')](function(){_0x5c7f6e[_0xeb03('0x8c')](function(_0x1f2ebe){socket[_0xeb03('0x7a')](_0xeb03('0x7b'),{'UserId':_0x1f2ebe['id'],'VoicePrefixId':_0x2d8bca['id']});});});});});}})[_0xeb03('0x2d')](respondWithStatusCode(_0x1fc15a,null))['catch'](handleError(_0x1fc15a,null));};exports[_0xeb03('0x8d')]=function(_0x5e0e2b,_0x497a5b,_0x188d39){return db[_0xeb03('0x82')]['findAll']({'where':{'id':_0x5e0e2b[_0xeb03('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db[_0xeb03('0x81')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xeb03('0x2d')](handleEntityNotFound(_0x497a5b,null))[_0xeb03('0x2d')](function(_0xd6f37b){var _0x1522d4=_[_0xeb03('0x3a')](_0xd6f37b,'id');var _0x47b648=[];var _0x15a726=[];var _0x226569=squel[_0xeb03('0x8e')]();_0x226569[_0xeb03('0x8f')](_0xeb03('0x90'))[_0xeb03('0x91')](_0xeb03('0x92'),'tq')[_0xeb03('0x93')](_0xeb03('0x94'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('VoicePrefixId\x20=\x20?',_0x5e0e2b[_0xeb03('0x54')]['id']);for(var _0x40a6ce=0x0;_0x40a6ce<_0xd6f37b[_0xeb03('0x3f')];_0x40a6ce+=0x1){let _0x2f640d=_0xd6f37b[_0x40a6ce];for(var _0x546ebe=0x0;_0x546ebe<_0x2f640d['Agents']['length'];_0x546ebe+=0x1){let _0x3d861f=_0x2f640d[_0xeb03('0x85')][_0x546ebe];var _0x2c89c4=_0x226569[_0xeb03('0x95')]();_0x2c89c4[_0xeb03('0x44')]('ut.UserId\x20=\x20?',_0x3d861f['id']);_0x15a726[_0xeb03('0x6d')](db[_0xeb03('0x57')]['query'](_0x2c89c4[_0xeb03('0x96')](),{'type':db['sequelize']['QueryTypes'][_0xeb03('0x97')]})[_0xeb03('0x2d')](function(_0x123742){if(_0x123742['length']===0x1){return _0x3d861f['id'];}else{var _0x243689=_[_0xeb03('0x98')](_['map'](_0x123742,_0xeb03('0x99')),function(_0x5eb15a){return _['includes'](_0x1522d4,_0x5eb15a);});if(_0x243689){return _0x3d861f['id'];}}}));}}return BPromise[_0xeb03('0x9a')](_0x15a726)[_0xeb03('0x2d')](function(_0x366054){_0x47b648=_(_0x47b648)[_0xeb03('0x9b')](_0x366054)[_0xeb03('0x9c')]()[_0xeb03('0x9d')]();return db['VoicePrefix'][_0xeb03('0x53')]({'where':{'id':_0x5e0e2b[_0xeb03('0x54')]['id']}})[_0xeb03('0x2d')](function(_0x1f0387){return db[_0xeb03('0x57')][_0xeb03('0x58')](function(_0xf0d912){return _0x1f0387[_0xeb03('0x8d')](_0x5e0e2b[_0xeb03('0x3b')][_0xeb03('0x78')],{'transaction':_0xf0d912})[_0xeb03('0x2d')](function(){if(!_[_0xeb03('0x9e')](_0x47b648)){return _0x1f0387[_0xeb03('0x7c')](_0x47b648,{'transaction':_0xf0d912});}})[_0xeb03('0x2d')](function(){_0x47b648[_0xeb03('0x8c')](function(_0x1a0bb5){socket[_0xeb03('0x7a')](_0xeb03('0x7e'),{'UserId':_0x1a0bb5,'VoicePrefixId':_0x1f0387['id']});});});});});});})[_0xeb03('0x2d')](respondWithStatusCode(_0x497a5b,null))[_0xeb03('0x4f')](handleError(_0x497a5b,null));}; \ No newline at end of file +var _0xbaf0=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','VoicePrefixes','UserProfileResource','end','error','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','length','find','catch','describe','create','sequelize','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','description','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','VoiceExtension','VoicePrefixId','bulkCreate','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','body','prefix','system-','ids','omit','spread','userVoicePrefix:save','params','removeAgents','emit','userVoicePrefix:remove','getAgents','findOne','User','nolimit','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','transaction','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','QueryTypes','SELECT','TeamId','includes','compact','isEmpty','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js'];(function(_0x895fb2,_0x49494c){var _0xce0393=function(_0x1fdc11){while(--_0x1fdc11){_0x895fb2['push'](_0x895fb2['shift']());}};_0xce0393(++_0x49494c);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0baf('0x0'));var zipdir=require(_0x0baf('0x1'));var jsonpatch=require(_0x0baf('0x2'));var rp=require(_0x0baf('0x3'));var moment=require(_0x0baf('0x4'));var BPromise=require(_0x0baf('0x5'));var Mustache=require('mustache');var util=require(_0x0baf('0x6'));var path=require(_0x0baf('0x7'));var sox=require(_0x0baf('0x8'));var csv=require(_0x0baf('0x9'));var ejs=require(_0x0baf('0xa'));var fs=require('fs');var fs_extra=require(_0x0baf('0xb'));var _=require(_0x0baf('0xc'));var squel=require(_0x0baf('0xd'));var crypto=require(_0x0baf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0baf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0baf('0x10'));var Papa=require(_0x0baf('0x11'));var Redis=require(_0x0baf('0x12'));var authService=require(_0x0baf('0x13'));var qs=require(_0x0baf('0x14'));var as=require(_0x0baf('0x15'));var hardwareService=require(_0x0baf('0x16'));var logger=require(_0x0baf('0x17'))(_0x0baf('0x18'));var utils=require(_0x0baf('0x19'));var config=require(_0x0baf('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x0baf('0x1b')]=_[_0x0baf('0x1c')](config[_0x0baf('0x1b')],{'host':_0x0baf('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0baf('0x1b')]));require('./voicePrefix.socket')[_0x0baf('0x1e')](socket);function respondWithStatusCode(_0x1f50c3,_0x7fbf67){_0x7fbf67=_0x7fbf67||0xcc;return function(_0x2bc381){if(_0x2bc381){return _0x1f50c3[_0x0baf('0x1f')](_0x7fbf67);}return _0x1f50c3[_0x0baf('0x20')](_0x7fbf67)['end']();};}function respondWithResult(_0x4cd79d,_0x2312c7){_0x2312c7=_0x2312c7||0xc8;return function(_0x38395b){if(_0x38395b){return _0x4cd79d[_0x0baf('0x20')](_0x2312c7)[_0x0baf('0x21')](_0x38395b);}};}function respondWithFilteredResult(_0x2cf7da,_0x288a98){return function(_0x53c338){if(_0x53c338){var _0x63c820=typeof _0x288a98[_0x0baf('0x22')]===_0x0baf('0x23')&&typeof _0x288a98[_0x0baf('0x24')]===_0x0baf('0x23');var _0x42b7f2=_0x53c338['count'];var _0x5cff5d=_0x63c820?0x0:_0x288a98[_0x0baf('0x22')];var _0x154f48=_0x63c820?_0x53c338[_0x0baf('0x25')]:_0x288a98[_0x0baf('0x22')]+_0x288a98[_0x0baf('0x24')];var _0x3e3e20;if(_0x154f48>=_0x42b7f2){_0x154f48=_0x42b7f2;_0x3e3e20=0xc8;}else{_0x3e3e20=0xce;}_0x2cf7da[_0x0baf('0x20')](_0x3e3e20);return _0x2cf7da[_0x0baf('0x26')](_0x0baf('0x27'),_0x5cff5d+'-'+_0x154f48+'/'+_0x42b7f2)[_0x0baf('0x21')](_0x53c338);}return null;};}function patchUpdates(_0x54f2fa){return function(_0x334bd6){try{jsonpatch['apply'](_0x334bd6,_0x54f2fa,!![]);}catch(_0xf6c158){return BPromise['reject'](_0xf6c158);}return _0x334bd6['save']();};}function saveUpdates(_0x2ef0aa,_0x48a0e9){return function(_0x4be1b9){if(_0x4be1b9){return _0x4be1b9[_0x0baf('0x28')](_0x2ef0aa)[_0x0baf('0x29')](function(_0x34e264){return _0x34e264;});}return null;};}function removeEntity(_0x19d9fd,_0x3a1ba1){return function(_0x56b299){if(_0x56b299){return _0x56b299[_0x0baf('0x2a')]()[_0x0baf('0x29')](function(){var _0x1ca35a=_0x56b299[_0x0baf('0x2b')]({'plain':!![]});var _0x3843b8=_0x0baf('0x2c');return db[_0x0baf('0x2d')]['destroy']({'where':{'type':_0x3843b8,'resourceId':_0x1ca35a['id']}})[_0x0baf('0x29')](function(){return _0x56b299;});})[_0x0baf('0x29')](function(){_0x19d9fd[_0x0baf('0x20')](0xcc)[_0x0baf('0x2e')]();});}};}function handleEntityNotFound(_0x55c715,_0x29dbdf){return function(_0x34a58a){if(!_0x34a58a){_0x55c715['sendStatus'](0x194);}return _0x34a58a;};}function handleError(_0x44ec31,_0x32e4fb){_0x32e4fb=_0x32e4fb||0x1f4;return function(_0x478ce8){logger[_0x0baf('0x2f')](_0x478ce8[_0x0baf('0x30')]);if(_0x478ce8[_0x0baf('0x31')]){delete _0x478ce8[_0x0baf('0x31')];}_0x44ec31['status'](_0x32e4fb)[_0x0baf('0x32')](_0x478ce8);};}exports[_0x0baf('0x33')]=function(_0x37be4e,_0x3ed995){var _0x24ecee={},_0x275ea1={},_0x2fc983={'count':0x0,'rows':[]};var _0x2f0a45=_[_0x0baf('0x34')](db[_0x0baf('0x35')][_0x0baf('0x36')],function(_0x165d14){return{'name':_0x165d14[_0x0baf('0x37')],'type':_0x165d14[_0x0baf('0x38')]['key']};});_0x275ea1[_0x0baf('0x39')]=_['map'](_0x2f0a45,_0x0baf('0x31'));_0x275ea1[_0x0baf('0x3a')]=_[_0x0baf('0x3b')](_0x37be4e[_0x0baf('0x3a')]);_0x275ea1['filters']=_[_0x0baf('0x3c')](_0x275ea1[_0x0baf('0x39')],_0x275ea1['query']);_0x24ecee[_0x0baf('0x3d')]=_[_0x0baf('0x3c')](_0x275ea1[_0x0baf('0x39')],qs[_0x0baf('0x3e')](_0x37be4e[_0x0baf('0x3a')][_0x0baf('0x3e')]));_0x24ecee[_0x0baf('0x3d')]=_0x24ecee[_0x0baf('0x3d')]['length']?_0x24ecee[_0x0baf('0x3d')]:_0x275ea1[_0x0baf('0x39')];if(!_0x37be4e['query'][_0x0baf('0x3f')]('nolimit')){_0x24ecee['limit']=qs[_0x0baf('0x24')](_0x37be4e[_0x0baf('0x3a')]['limit']);_0x24ecee['offset']=qs[_0x0baf('0x22')](_0x37be4e[_0x0baf('0x3a')][_0x0baf('0x22')]);}_0x24ecee[_0x0baf('0x40')]=qs[_0x0baf('0x41')](_0x37be4e[_0x0baf('0x3a')][_0x0baf('0x41')]);_0x24ecee[_0x0baf('0x42')]=qs[_0x0baf('0x43')](_[_0x0baf('0x44')](_0x37be4e[_0x0baf('0x3a')],_0x275ea1[_0x0baf('0x43')]),_0x2f0a45);if(_0x37be4e[_0x0baf('0x3a')][_0x0baf('0x45')]){_0x24ecee['where']=_[_0x0baf('0x46')](_0x24ecee[_0x0baf('0x42')],{'$or':_['map'](_0x2f0a45,function(_0x38006a){if(_0x38006a[_0x0baf('0x38')]!==_0x0baf('0x47')){var _0x299f93={};_0x299f93[_0x38006a[_0x0baf('0x31')]]={'$like':'%'+_0x37be4e[_0x0baf('0x3a')]['filter']+'%'};return _0x299f93;}})});}_0x24ecee=_[_0x0baf('0x46')]({},_0x24ecee,_0x37be4e[_0x0baf('0x48')]);var _0x540c41={'where':_0x24ecee[_0x0baf('0x42')]};return db[_0x0baf('0x35')][_0x0baf('0x25')](_0x540c41)[_0x0baf('0x29')](function(_0x504031){_0x2fc983[_0x0baf('0x25')]=_0x504031;if(_0x37be4e[_0x0baf('0x3a')][_0x0baf('0x49')]){_0x24ecee[_0x0baf('0x4a')]=[{'all':!![]}];}return db[_0x0baf('0x35')][_0x0baf('0x4b')](_0x24ecee);})[_0x0baf('0x29')](function(_0x1fa237){_0x2fc983[_0x0baf('0x4c')]=_0x1fa237;return _0x2fc983;})[_0x0baf('0x29')](respondWithFilteredResult(_0x3ed995,_0x24ecee))['catch'](handleError(_0x3ed995,null));};exports[_0x0baf('0x4d')]=function(_0x2bc755,_0x1daf1d){var _0x339aff={'raw':![],'where':{'id':_0x2bc755['params']['id']}},_0x22207a={};_0x22207a[_0x0baf('0x39')]=_[_0x0baf('0x3b')](db[_0x0baf('0x35')][_0x0baf('0x36')]);_0x22207a[_0x0baf('0x3a')]=_['keys'](_0x2bc755[_0x0baf('0x3a')]);_0x22207a[_0x0baf('0x43')]=_[_0x0baf('0x3c')](_0x22207a[_0x0baf('0x39')],_0x22207a[_0x0baf('0x3a')]);_0x339aff[_0x0baf('0x3d')]=_[_0x0baf('0x3c')](_0x22207a['model'],qs[_0x0baf('0x3e')](_0x2bc755[_0x0baf('0x3a')][_0x0baf('0x3e')]));_0x339aff['attributes']=_0x339aff[_0x0baf('0x3d')][_0x0baf('0x4e')]?_0x339aff[_0x0baf('0x3d')]:_0x22207a[_0x0baf('0x39')];if(_0x2bc755[_0x0baf('0x3a')][_0x0baf('0x49')]){_0x339aff[_0x0baf('0x4a')]=[{'all':!![]}];}_0x339aff=_['merge']({},_0x339aff,_0x2bc755[_0x0baf('0x48')]);return db[_0x0baf('0x35')][_0x0baf('0x4f')](_0x339aff)[_0x0baf('0x29')](handleEntityNotFound(_0x1daf1d,null))[_0x0baf('0x29')](respondWithResult(_0x1daf1d,null))[_0x0baf('0x50')](handleError(_0x1daf1d,null));};exports[_0x0baf('0x2a')]=function(_0x1af4aa,_0x2be7fe){return db[_0x0baf('0x35')][_0x0baf('0x4f')]({'where':{'id':_0x1af4aa['params']['id']}})['then'](handleEntityNotFound(_0x2be7fe,null))[_0x0baf('0x29')](removeEntity(_0x2be7fe,null))[_0x0baf('0x50')](handleError(_0x2be7fe,null));};exports[_0x0baf('0x51')]=function(_0xb8fa28,_0x21b108){return db[_0x0baf('0x35')][_0x0baf('0x51')]()['then'](respondWithResult(_0x21b108,null))[_0x0baf('0x50')](handleError(_0x21b108,null));};exports[_0x0baf('0x52')]=function(_0xf2424,_0x16d9fb){var _0x3fdb41;return db[_0x0baf('0x53')]['transaction'](function(_0x3eebe5){return db['VoicePrefix'][_0x0baf('0x52')](_0xf2424['body'],{'transaction':_0x3eebe5})[_0x0baf('0x29')](function(_0x5eaeb2){_0x3fdb41=_0x5eaeb2[_0x0baf('0x2b')]({'plain':!![]});return db['VoiceExtension'][_0x0baf('0x4f')]({'where':{'id':_0x3fdb41[_0x0baf('0x54')]},'raw':!![]})[_0x0baf('0x29')](function(_0x4520d1){return createVoicePrefixExtensions(_0x3fdb41,_0x4520d1,_0x3eebe5);});});})[_0x0baf('0x29')](function(){var _0x576475=_0xf2424[_0x0baf('0x55')][_0x0baf('0x2b')]({'plain':!![]});if(!_0x576475)throw new Error(_0x0baf('0x56'));if(_0x576475[_0x0baf('0x57')]===_0x0baf('0x55')){var _0xa19b21=_0x3fdb41;return db['UserProfileSection'][_0x0baf('0x4f')]({'where':{'name':_0x0baf('0x2c'),'userProfileId':_0x576475[_0x0baf('0x58')]},'raw':!![]})[_0x0baf('0x29')](function(_0xbc7cc2){if(_0xbc7cc2&&_0xbc7cc2[_0x0baf('0x59')]===0x0){return db[_0x0baf('0x2d')]['create']({'name':_0xa19b21['name'],'resourceId':_0xa19b21['id'],'type':_0xbc7cc2[_0x0baf('0x31')],'sectionId':_0xbc7cc2['id']},{})[_0x0baf('0x29')](function(){return _0x3fdb41;});}else{return _0x3fdb41;}})[_0x0baf('0x50')](function(_0x337d94){logger[_0x0baf('0x2f')](_0x0baf('0x5a'),_0x337d94);throw _0x337d94;});}return _0x3fdb41;})[_0x0baf('0x29')](respondWithResult(_0x16d9fb,null))[_0x0baf('0x50')](handleError(_0x16d9fb,null));};function Extension(_0x3d9a32,_0x585969,_0x3238f9,_0x268be8){this[_0x0baf('0x5b')]=_0x0baf('0x5c');this[_0x0baf('0x5d')]=_0x3d9a32;this[_0x0baf('0x5e')]=_0x3238f9;this[_0x0baf('0x38')]='system';this[_0x0baf('0x5f')]=_0x0baf('0x60');this[_0x0baf('0x61')]=_0x585969;this[_0x0baf('0x62')]=_0x268be8;}function createVoicePrefixExtensions(_0x1c7d88,_0x1a6d22,_0x14e6d0){return new BPromise(function(_0x12543e,_0x498405){var _0x178495=new Extension(formatPrefixName(_0x1c7d88['prefix']),0x1,_0x0baf('0x63'),'Voice\x20Prefix');_0x178495['VoicePrefixId']=_0x1c7d88['id'];return db[_0x0baf('0x64')]['create'](_0x178495,{'transaction':_0x14e6d0})[_0x0baf('0x29')](function(_0x2b17f8){var _0x49d713=_0x2b17f8[_0x0baf('0x2b')]({'plain':!![]});var _0xfb6708=_[_0x0baf('0x34')](addVoicePrefixExtensions(_0x1c7d88,_0x1a6d22),function(_0x5b3c1d){_0x5b3c1d['VoiceExtensionId']=_0x49d713['id'];_0x5b3c1d[_0x0baf('0x65')]=_0x1c7d88['id'];return _0x5b3c1d;});return db[_0x0baf('0x64')][_0x0baf('0x66')](_0xfb6708,{'transaction':_0x14e6d0})[_0x0baf('0x29')](function(_0x784e1a){if(!_0x784e1a){return _0x498405('Extensions\x20creation\x20failed');}else{return _0x12543e(_0x784e1a);}})[_0x0baf('0x50')](function(_0x4c02ca){return _0x498405(_0x4c02ca);});});;});};function addVoicePrefixExtensions(_0x5d5751,_0x59a0b2){var _0x427ed1=[];var _0x58a366=formatPrefixName(_0x5d5751['prefix']);_0x427ed1[_0x0baf('0x67')](new Extension(_0x58a366,0x2,_0x0baf('0x68'),_0x0baf('0x69')+_0x5d5751[_0x0baf('0x31')]));if(_0x5d5751[_0x0baf('0x6a')]){_0x427ed1[_0x0baf('0x67')](new Extension(_0x58a366,0x3,'Set',_0x0baf('0x6b')+_0x5d5751[_0x0baf('0x6a')]));}else{_0x427ed1[_0x0baf('0x67')](new Extension(_0x58a366,0x3,_0x0baf('0x63'),_0x0baf('0x6c')));}_0x427ed1[_0x0baf('0x67')](new Extension(_0x58a366,0x4,'goto',_0x59a0b2[_0x0baf('0x5b')]+','+_0x0baf('0x6d')+(0x8+_0x5d5751[_0x0baf('0x31')]['length'])+'}'+','+0x1));return _0x427ed1;}function formatPrefixName(_0x89484d){var _0x1e474f='_';for(var _0x3d333d=0x0;_0x3d333d<_0x89484d[_0x0baf('0x4e')];_0x3d333d++){if(_0x89484d[_0x0baf('0x6e')](_0x3d333d)=='-'){_0x1e474f+=_0x89484d[_0x0baf('0x6e')](_0x3d333d);}else{_0x1e474f+='['+_0x89484d[_0x0baf('0x6e')](_0x3d333d)+']';}}_0x1e474f+='.';return _0x1e474f;}exports['update']=function(_0x54353a,_0x4b7caa,_0x6ce83c){var _0x89bec7=_0x54353a[_0x0baf('0x6f')];_0x89bec7[_0x0baf('0x70')]=_0x0baf('0x71')+_0x89bec7[_0x0baf('0x31')]+'-';return db['sequelize']['transaction'](function(_0x34c1f4){return db['VoicePrefix'][_0x0baf('0x28')](_0x89bec7,{'where':{'id':_0x89bec7['id']},'transaction':_0x34c1f4})[_0x0baf('0x29')](function(){return db['VoiceExtension'][_0x0baf('0x2a')]({'where':{'VoicePrefixId':_0x89bec7['id']},'transaction':_0x34c1f4})[_0x0baf('0x29')](function(){return db[_0x0baf('0x64')][_0x0baf('0x4f')]({'where':{'id':_0x89bec7[_0x0baf('0x54')]},'raw':!![]})[_0x0baf('0x29')](function(_0x1b6b73){return createVoicePrefixExtensions(_0x89bec7,_0x1b6b73,_0x34c1f4);});});});})[_0x0baf('0x29')](function(){return db[_0x0baf('0x35')]['findById'](_0x89bec7['id']);})['then'](respondWithResult(_0x4b7caa,null))['catch'](handleError(_0x4b7caa,null));};exports['addAgents']=function(_0x5361a5,_0x418c45,_0x18963f){return db[_0x0baf('0x35')][_0x0baf('0x4f')]({'where':{'id':_0x5361a5['params']['id']}})[_0x0baf('0x29')](handleEntityNotFound(_0x418c45,null))[_0x0baf('0x29')](function(_0x58caee){if(_0x58caee){return _0x58caee['addAgents'](_0x5361a5[_0x0baf('0x6f')][_0x0baf('0x72')],_[_0x0baf('0x73')](_0x5361a5[_0x0baf('0x6f')],[_0x0baf('0x72'),'id'])||{})[_0x0baf('0x74')](function(_0x3ce111){for(var _0x399f40=0x0;_0x399f40<_0x5361a5['body'][_0x0baf('0x72')][_0x0baf('0x4e')];_0x399f40+=0x1){socket['emit'](_0x0baf('0x75'),{'UserId':Number(_0x5361a5[_0x0baf('0x6f')]['ids'][_0x399f40]),'VoicePrefixId':Number(_0x5361a5[_0x0baf('0x76')]['id'])});}return _0x3ce111;});}})[_0x0baf('0x29')](respondWithResult(_0x418c45,null))[_0x0baf('0x50')](handleError(_0x418c45,null));};exports[_0x0baf('0x77')]=function(_0x167977,_0x4fc5af,_0x4807fc){return db[_0x0baf('0x35')][_0x0baf('0x4f')]({'where':{'id':_0x167977['params']['id']}})[_0x0baf('0x29')](handleEntityNotFound(_0x4fc5af,null))[_0x0baf('0x29')](function(_0x21ad25){if(_0x21ad25){return _0x21ad25['removeAgents'](_0x167977[_0x0baf('0x3a')][_0x0baf('0x72')])[_0x0baf('0x29')](function(){if(_['isArray'](_0x167977[_0x0baf('0x3a')]['ids'])){for(var _0x316397=0x0;_0x316397<_0x167977[_0x0baf('0x3a')][_0x0baf('0x72')][_0x0baf('0x4e')];_0x316397+=0x1){socket[_0x0baf('0x78')]('userVoicePrefix:remove',{'UserId':Number(_0x167977[_0x0baf('0x3a')][_0x0baf('0x72')][_0x316397]),'VoicePrefixId':Number(_0x167977['params']['id'])});}}else{socket[_0x0baf('0x78')](_0x0baf('0x79'),{'UserId':Number(_0x167977[_0x0baf('0x3a')][_0x0baf('0x72')]),'VoicePrefixId':Number(_0x167977[_0x0baf('0x76')]['id'])});}});}})[_0x0baf('0x29')](respondWithStatusCode(_0x4fc5af,null))[_0x0baf('0x50')](handleError(_0x4fc5af,null));};exports[_0x0baf('0x7a')]=function(_0x44ef57,_0x1ca3a6,_0x3b7abf){var _0x2c2f09={};var _0x5985f9={};var _0x599ac0;var _0x29a036;return db[_0x0baf('0x35')][_0x0baf('0x7b')]({'where':{'id':_0x44ef57['params']['id']}})['then'](handleEntityNotFound(_0x1ca3a6,null))[_0x0baf('0x29')](function(_0x368e23){if(_0x368e23){_0x599ac0=_0x368e23;_0x5985f9[_0x0baf('0x39')]=_[_0x0baf('0x3b')](db[_0x0baf('0x7c')][_0x0baf('0x36')]);_0x5985f9[_0x0baf('0x3a')]=_[_0x0baf('0x3b')](_0x44ef57[_0x0baf('0x3a')]);_0x5985f9['filters']=_[_0x0baf('0x3c')](_0x5985f9[_0x0baf('0x39')],_0x5985f9[_0x0baf('0x3a')]);_0x2c2f09[_0x0baf('0x3d')]=_['intersection'](_0x5985f9['model'],qs['fields'](_0x44ef57[_0x0baf('0x3a')][_0x0baf('0x3e')]));_0x2c2f09['attributes']=_0x2c2f09['attributes'][_0x0baf('0x4e')]?_0x2c2f09[_0x0baf('0x3d')]:_0x5985f9['model'];_0x2c2f09[_0x0baf('0x40')]=qs[_0x0baf('0x41')](_0x44ef57[_0x0baf('0x3a')][_0x0baf('0x41')]);_0x2c2f09[_0x0baf('0x42')]=qs[_0x0baf('0x43')](_[_0x0baf('0x44')](_0x44ef57[_0x0baf('0x3a')],_0x5985f9[_0x0baf('0x43')]));if(_0x44ef57[_0x0baf('0x3a')][_0x0baf('0x45')]){_0x2c2f09[_0x0baf('0x42')]=_['merge'](_0x2c2f09[_0x0baf('0x42')],{'$or':_[_0x0baf('0x34')](_0x2c2f09[_0x0baf('0x3d')],function(_0x3bd15b){var _0x3c37b4={};_0x3c37b4[_0x3bd15b]={'$like':'%'+_0x44ef57[_0x0baf('0x3a')]['filter']+'%'};return _0x3c37b4;})});}_0x2c2f09=_[_0x0baf('0x46')]({},_0x2c2f09,_0x44ef57[_0x0baf('0x48')]);return _0x599ac0[_0x0baf('0x7a')](_0x2c2f09);}})[_0x0baf('0x29')](function(_0x4376a1){if(_0x4376a1){_0x29a036=_0x4376a1['length'];if(!_0x44ef57[_0x0baf('0x3a')][_0x0baf('0x3f')](_0x0baf('0x7d'))){_0x2c2f09[_0x0baf('0x24')]=qs[_0x0baf('0x24')](_0x44ef57['query']['limit']);_0x2c2f09[_0x0baf('0x22')]=qs['offset'](_0x44ef57[_0x0baf('0x3a')]['offset']);}return _0x599ac0[_0x0baf('0x7a')](_0x2c2f09);}})[_0x0baf('0x29')](function(_0x1ce7bb){if(_0x1ce7bb){return _0x1ce7bb?{'count':_0x29a036,'rows':_0x1ce7bb}:null;}})[_0x0baf('0x29')](respondWithResult(_0x1ca3a6,null))['catch'](handleError(_0x1ca3a6,null));};exports[_0x0baf('0x7e')]=function(_0x106ffa,_0xf7a9d0,_0x551df3){var _0x487aec={};var _0x591cc2={};var _0x4d4884;var _0x427638;return db[_0x0baf('0x35')][_0x0baf('0x7b')]({'where':{'id':_0x106ffa[_0x0baf('0x76')]['id']}})['then'](handleEntityNotFound(_0xf7a9d0,null))[_0x0baf('0x29')](function(_0x37594e){if(_0x37594e){_0x4d4884=_0x37594e;_0x591cc2[_0x0baf('0x39')]=_['keys'](db[_0x0baf('0x7f')][_0x0baf('0x36')]);_0x591cc2['query']=_[_0x0baf('0x3b')](_0x106ffa['query']);_0x591cc2[_0x0baf('0x43')]=_[_0x0baf('0x3c')](_0x591cc2[_0x0baf('0x39')],_0x591cc2[_0x0baf('0x3a')]);_0x487aec['attributes']=_['intersection'](_0x591cc2[_0x0baf('0x39')],qs['fields'](_0x106ffa[_0x0baf('0x3a')][_0x0baf('0x3e')]));_0x487aec[_0x0baf('0x3d')]=_0x487aec[_0x0baf('0x3d')][_0x0baf('0x4e')]?_0x487aec['attributes']:_0x591cc2[_0x0baf('0x39')];_0x487aec['order']=qs[_0x0baf('0x41')](_0x106ffa['query'][_0x0baf('0x41')]);_0x487aec['where']=qs[_0x0baf('0x43')](_[_0x0baf('0x44')](_0x106ffa[_0x0baf('0x3a')],_0x591cc2['filters']));if(_0x106ffa['query'][_0x0baf('0x45')]){_0x487aec[_0x0baf('0x42')]=_[_0x0baf('0x46')](_0x487aec[_0x0baf('0x42')],{'$or':_[_0x0baf('0x34')](_0x487aec[_0x0baf('0x3d')],function(_0x4e6059){var _0xd4170d={};_0xd4170d[_0x4e6059]={'$like':'%'+_0x106ffa['query'][_0x0baf('0x45')]+'%'};return _0xd4170d;})});}_0x487aec=_['merge']({},_0x487aec,_0x106ffa[_0x0baf('0x48')]);return _0x4d4884[_0x0baf('0x7e')](_0x487aec);}})[_0x0baf('0x29')](function(_0x557a38){if(_0x557a38){_0x427638=_0x557a38[_0x0baf('0x4e')];if(!_0x106ffa[_0x0baf('0x3a')]['hasOwnProperty']('nolimit')){_0x487aec[_0x0baf('0x24')]=qs[_0x0baf('0x24')](_0x106ffa[_0x0baf('0x3a')][_0x0baf('0x24')]);_0x487aec['offset']=qs['offset'](_0x106ffa[_0x0baf('0x3a')][_0x0baf('0x22')]);}return _0x4d4884[_0x0baf('0x7e')](_0x487aec);}})[_0x0baf('0x29')](function(_0xfc91ce){if(_0xfc91ce){return _0xfc91ce?{'count':_0x427638,'rows':_0xfc91ce}:null;}})[_0x0baf('0x29')](respondWithResult(_0xf7a9d0,null))[_0x0baf('0x50')](handleError(_0xf7a9d0,null));};exports[_0x0baf('0x80')]=function(_0x205de6,_0x2369f0,_0x58f95c){var _0xdb96c0=_0x205de6['body'][_0x0baf('0x72')];var _0x42abcf;return db[_0x0baf('0x7f')][_0x0baf('0x4b')]({'where':{'id':_0xdb96c0},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0baf('0x81'),'attributes':['id',_0x0baf('0x31'),_0x0baf('0x82'),_0x0baf('0x83'),_0x0baf('0x84')],'raw':!![]}]})[_0x0baf('0x29')](function(_0x3b9101){if(_0x3b9101){_0x42abcf=_0x3b9101;var _0x205075=_[_0x0baf('0x85')](_0x3b9101,function(_0x4b6cd5){var _0x8d1bae=_0x4b6cd5[_0x0baf('0x2b')]({'plain':!![]});return _0x8d1bae['Agents'];});return db[_0x0baf('0x35')][_0x0baf('0x4f')]({'where':{'id':_0x205de6[_0x0baf('0x76')]['id']}})[_0x0baf('0x29')](function(_0x97f5d6){return db[_0x0baf('0x53')][_0x0baf('0x86')](function(_0x8c1dc2){return _0x97f5d6[_0x0baf('0x80')](_0xdb96c0,{'transaction':_0x8c1dc2})['then'](function(){return BPromise[_0x0baf('0x87')](_0x42abcf,function(_0x218fc5){return db[_0x0baf('0x88')][_0x0baf('0x89')]({'TeamId':_0x218fc5['id'],'VoicePrefixId':_0x205de6[_0x0baf('0x76')]['id']},{'transaction':_0x8c1dc2});});})[_0x0baf('0x29')](function(){return BPromise['each'](_0x205075,function(_0x121718){return db[_0x0baf('0x8a')][_0x0baf('0x8b')]({'where':{'UserId':_0x121718['id'],'VoicePrefixId':_0x205de6['params']['id']},'transaction':_0x8c1dc2});});})['then'](function(){_0x205075[_0x0baf('0x8c')](function(_0x1adb84){socket[_0x0baf('0x78')]('userVoicePrefix:save',{'UserId':_0x1adb84['id'],'VoicePrefixId':_0x97f5d6['id']});});});});});}})[_0x0baf('0x29')](respondWithStatusCode(_0x2369f0,null))['catch'](handleError(_0x2369f0,null));};exports[_0x0baf('0x8d')]=function(_0x5f09be,_0x41b216,_0x3f2838){return db['Team'][_0x0baf('0x4b')]({'where':{'id':_0x5f09be[_0x0baf('0x3a')][_0x0baf('0x72')]},'attributes':['id'],'include':[{'model':db[_0x0baf('0x7c')],'as':_0x0baf('0x81'),'attributes':['id'],'raw':!![]}]})[_0x0baf('0x29')](handleEntityNotFound(_0x41b216,null))[_0x0baf('0x29')](function(_0x5508db){var _0x727cad=_[_0x0baf('0x34')](_0x5508db,'id');var _0x2766fb=[];var _0x2e1629=[];var _0x275cc4=squel[_0x0baf('0x8e')]();_0x275cc4[_0x0baf('0x8f')](_0x0baf('0x90'))[_0x0baf('0x91')](_0x0baf('0x92'),'tq')[_0x0baf('0x93')](_0x0baf('0x94'),'ut',_0x0baf('0x95'))[_0x0baf('0x42')]('VoicePrefixId\x20=\x20?',_0x5f09be['params']['id']);for(var _0x1cd215=0x0;_0x1cd215<_0x5508db[_0x0baf('0x4e')];_0x1cd215+=0x1){let _0x3b9429=_0x5508db[_0x1cd215];for(var _0x41d397=0x0;_0x41d397<_0x3b9429['Agents'][_0x0baf('0x4e')];_0x41d397+=0x1){let _0xc6c049=_0x3b9429[_0x0baf('0x81')][_0x41d397];var _0x2fb267=_0x275cc4[_0x0baf('0x96')]();_0x2fb267[_0x0baf('0x42')]('ut.UserId\x20=\x20?',_0xc6c049['id']);_0x2e1629[_0x0baf('0x67')](db[_0x0baf('0x53')][_0x0baf('0x3a')](_0x2fb267['toString'](),{'type':db[_0x0baf('0x53')][_0x0baf('0x97')][_0x0baf('0x98')]})['then'](function(_0x4f7145){if(_0x4f7145['length']===0x1){return _0xc6c049['id'];}else{var _0x11a85a=_['every'](_[_0x0baf('0x34')](_0x4f7145,_0x0baf('0x99')),function(_0x55124b){return _[_0x0baf('0x9a')](_0x727cad,_0x55124b);});if(_0x11a85a){return _0xc6c049['id'];}}}));}}return BPromise['all'](_0x2e1629)['then'](function(_0x21516f){_0x2766fb=_(_0x2766fb)['union'](_0x21516f)[_0x0baf('0x9b')]()['value']();return db['VoicePrefix']['find']({'where':{'id':_0x5f09be[_0x0baf('0x76')]['id']}})[_0x0baf('0x29')](function(_0x3d1f80){return db[_0x0baf('0x53')][_0x0baf('0x86')](function(_0x4f9904){return _0x3d1f80[_0x0baf('0x8d')](_0x5f09be['query'][_0x0baf('0x72')],{'transaction':_0x4f9904})[_0x0baf('0x29')](function(){if(!_[_0x0baf('0x9c')](_0x2766fb)){return _0x3d1f80['removeAgents'](_0x2766fb,{'transaction':_0x4f9904});}})[_0x0baf('0x29')](function(){_0x2766fb[_0x0baf('0x8c')](function(_0x12311d){socket['emit'](_0x0baf('0x79'),{'UserId':_0x12311d,'VoicePrefixId':_0x3d1f80['id']});});});});});});})['then'](respondWithStatusCode(_0x41b216,null))[_0x0baf('0x50')](handleError(_0x41b216,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 1981aaf..a6995f4 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 _0x8108=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix'];(function(_0x2ada99,_0x4ea2aa){var _0x5447e5=function(_0x1d25eb){while(--_0x1d25eb){_0x2ada99['push'](_0x2ada99['shift']());}};_0x5447e5(++_0x4ea2aa);}(_0x8108,0xe3));var _0x8810=function(_0x137c34,_0x2ebd98){_0x137c34=_0x137c34-0x0;var _0x145d9b=_0x8108[_0x137c34];return _0x145d9b;};'use strict';var EventEmitter=require(_0x8810('0x0'));var VoicePrefix=require(_0x8810('0x1'))['db'][_0x8810('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x8810('0x3')](0x0);var events={'afterCreate':_0x8810('0x4'),'afterUpdate':_0x8810('0x5'),'afterDestroy':'remove'};function emitEvent(_0x13a882){return function(_0x3d5d82,_0x730871,_0x37cdfb){VoicePrefixEvents[_0x8810('0x6')](_0x13a882+':'+_0x3d5d82['id'],_0x3d5d82);VoicePrefixEvents[_0x8810('0x6')](_0x13a882,_0x3d5d82);_0x37cdfb(null);};}for(var e in events){if(events[_0x8810('0x7')](e)){var event=events[e];VoicePrefix[_0x8810('0x8')](e,emitEvent(event));}}module[_0x8810('0x9')]=VoicePrefixEvents; \ No newline at end of file +var _0x06bb=['hook','exports','events','setMaxListeners','save','remove','emit'];(function(_0x1486e5,_0x39684f){var _0x29d89b=function(_0x4a0a80){while(--_0x4a0a80){_0x1486e5['push'](_0x1486e5['shift']());}};_0x29d89b(++_0x39684f);}(_0x06bb,0x105));var _0xb06b=function(_0x542030,_0x58d3c4){_0x542030=_0x542030-0x0;var _0xc6e7=_0x06bb[_0x542030];return _0xc6e7;};'use strict';var EventEmitter=require(_0xb06b('0x0'));var VoicePrefix=require('../../mysqldb')['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xb06b('0x1')](0x0);var events={'afterCreate':_0xb06b('0x2'),'afterUpdate':'update','afterDestroy':_0xb06b('0x3')};function emitEvent(_0x51e220){return function(_0x5ee9f4,_0x45795a,_0x40063c){VoicePrefixEvents[_0xb06b('0x4')](_0x51e220+':'+_0x5ee9f4['id'],_0x5ee9f4);VoicePrefixEvents[_0xb06b('0x4')](_0x51e220,_0x5ee9f4);_0x40063c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0xb06b('0x5')](e,emitEvent(event));}}module[_0xb06b('0x6')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index ee02651..fc7d8ef 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 _0x7654=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voicePrefix.attributes','VoicePrefix','voice_prefixes','util'];(function(_0x53f37f,_0xfb0b18){var _0x2fe5f8=function(_0x76ef2d){while(--_0x76ef2d){_0x53f37f['push'](_0x53f37f['shift']());}};_0x2fe5f8(++_0xfb0b18);}(_0x7654,0x133));var _0x4765=function(_0x5103ba,_0x11e48a){_0x5103ba=_0x5103ba-0x0;var _0x2bd28a=_0x7654[_0x5103ba];return _0x2bd28a;};'use strict';var _=require('lodash');var util=require(_0x4765('0x0'));var logger=require(_0x4765('0x1'))(_0x4765('0x2'));var moment=require(_0x4765('0x3'));var BPromise=require(_0x4765('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4765('0x5'));var rimraf=require(_0x4765('0x6'));var config=require(_0x4765('0x7'));var attributes=require(_0x4765('0x8'));module['exports']=function(_0x5e7fa0,_0x1876fb){return _0x5e7fa0['define'](_0x4765('0x9'),attributes,{'tableName':_0x4765('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2104=['lodash','../../config/logger','moment','request-promise','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x2104,0x90));var _0x4210=function(_0x324012,_0x23f45f){_0x324012=_0x324012-0x0;var _0x435cf2=_0x2104[_0x324012];return _0x435cf2;};'use strict';var _=require(_0x4210('0x0'));var util=require('util');var logger=require(_0x4210('0x1'))('api');var moment=require(_0x4210('0x2'));var BPromise=require('bluebird');var rp=require(_0x4210('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4210('0x4'));module[_0x4210('0x5')]=function(_0x5a1b43,_0x24843e){return _0x5a1b43[_0x4210('0x6')](_0x4210('0x7'),attributes,{'tableName':_0x4210('0x8'),'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 13a215f..94b863e 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 _0xb2ad=['socket.io-emitter','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost'];(function(_0x1b2ff2,_0x5522aa){var _0x4a1fd4=function(_0x5772bb){while(--_0x5772bb){_0x1b2ff2['push'](_0x1b2ff2['shift']());}};_0x4a1fd4(++_0x5522aa);}(_0xb2ad,0x16d));var _0xdb2a=function(_0x1d03a1,_0x56a15f){_0x1d03a1=_0x1d03a1-0x0;var _0x5c2a0c=_0xb2ad[_0x1d03a1];return _0x5c2a0c;};'use strict';var _=require('lodash');var util=require(_0xdb2a('0x0'));var moment=require('moment');var BPromise=require(_0xdb2a('0x1'));var rs=require(_0xdb2a('0x2'));var fs=require('fs');var Redis=require(_0xdb2a('0x3'));var db=require(_0xdb2a('0x4'))['db'];var utils=require(_0xdb2a('0x5'));var logger=require('../../config/logger')(_0xdb2a('0x6'));var config=require(_0xdb2a('0x7'));var jayson=require(_0xdb2a('0x8'));var client=jayson[_0xdb2a('0x9')][_0xdb2a('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xdb2a('0xb')],{'host':_0xdb2a('0xc'),'port':0x18eb});var socket=require(_0xdb2a('0xd'))(new Redis(config['redis']));require(_0xdb2a('0xe'))[_0xdb2a('0xf')](socket);function respondWithRpcPromise(_0x5d2a87,_0x3b1bbe,_0x39f48e){return new BPromise(function(_0x4bdf25,_0x591114){return client[_0xdb2a('0x10')](_0x5d2a87,_0x39f48e)[_0xdb2a('0x11')](function(_0x134425){logger['info'](_0xdb2a('0x12'),_0x3b1bbe,_0xdb2a('0x13'));logger['debug']('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x3b1bbe,'request\x20sent',JSON[_0xdb2a('0x14')](_0x134425));if(_0x134425['error']){if(_0x134425[_0xdb2a('0x15')][_0xdb2a('0x16')]===0x1f4){logger['error'](_0xdb2a('0x12'),_0x3b1bbe,_0x134425['error']['message']);return _0x591114(_0x134425['error']['message']);}logger[_0xdb2a('0x15')](_0xdb2a('0x12'),_0x3b1bbe,_0x134425['error']['message']);return _0x4bdf25(_0x134425[_0xdb2a('0x15')][_0xdb2a('0x17')]);}else{logger[_0xdb2a('0x18')](_0xdb2a('0x12'),_0x3b1bbe,'request\x20sent');_0x4bdf25(_0x134425[_0xdb2a('0x19')][_0xdb2a('0x17')]);}})[_0xdb2a('0x1a')](function(_0x584981){logger['error'](_0xdb2a('0x12'),_0x3b1bbe,_0x584981);_0x591114(_0x584981);});});} \ No newline at end of file +var _0xe953=['defaults','localhost','socket.io-emitter','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http'];(function(_0x148ebd,_0x5c2186){var _0x4767cd=function(_0x11d884){while(--_0x11d884){_0x148ebd['push'](_0x148ebd['shift']());}};_0x4767cd(++_0x5c2186);}(_0xe953,0xf9));var _0x3e95=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0xe953[_0x20589d];return _0x422de9;};'use strict';var _=require(_0x3e95('0x0'));var util=require(_0x3e95('0x1'));var moment=require(_0x3e95('0x2'));var BPromise=require('bluebird');var rs=require(_0x3e95('0x3'));var fs=require('fs');var Redis=require(_0x3e95('0x4'));var db=require(_0x3e95('0x5'))['db'];var utils=require(_0x3e95('0x6'));var logger=require(_0x3e95('0x7'))(_0x3e95('0x8'));var config=require(_0x3e95('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3e95('0xa')]({'port':0x232a});config['redis']=_[_0x3e95('0xb')](config['redis'],{'host':_0x3e95('0xc'),'port':0x18eb});var socket=require(_0x3e95('0xd'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0x3e95('0xe')](socket);function respondWithRpcPromise(_0x521403,_0x44996c,_0x478d4d){return new BPromise(function(_0x569b9d,_0x369081){return client[_0x3e95('0xf')](_0x521403,_0x478d4d)[_0x3e95('0x10')](function(_0x4882e3){logger[_0x3e95('0x11')](_0x3e95('0x12'),_0x44996c,_0x3e95('0x13'));logger[_0x3e95('0x14')](_0x3e95('0x15'),_0x44996c,'request\x20sent',JSON[_0x3e95('0x16')](_0x4882e3));if(_0x4882e3[_0x3e95('0x17')]){if(_0x4882e3[_0x3e95('0x17')]['code']===0x1f4){logger[_0x3e95('0x17')](_0x3e95('0x12'),_0x44996c,_0x4882e3[_0x3e95('0x17')][_0x3e95('0x18')]);return _0x369081(_0x4882e3[_0x3e95('0x17')][_0x3e95('0x18')]);}logger[_0x3e95('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x44996c,_0x4882e3[_0x3e95('0x17')][_0x3e95('0x18')]);return _0x569b9d(_0x4882e3[_0x3e95('0x17')]['message']);}else{logger[_0x3e95('0x11')](_0x3e95('0x12'),_0x44996c,_0x3e95('0x13'));_0x569b9d(_0x4882e3['result']['message']);}})[_0x3e95('0x19')](function(_0x56ab9b){logger['error'](_0x3e95('0x12'),_0x44996c,_0x56ab9b);_0x369081(_0x56ab9b);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index a33b03f..576ad04 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 _0x9990=['update','emit','removeListener','register','length','voicePrefix:','save','remove'];(function(_0x51b42e,_0x8dea09){var _0x43ed23=function(_0x2de749){while(--_0x2de749){_0x51b42e['push'](_0x51b42e['shift']());}};_0x43ed23(++_0x8dea09);}(_0x9990,0xf6));var _0x0999=function(_0x5575c1,_0x11b31a){_0x5575c1=_0x5575c1-0x0;var _0x50ea4e=_0x9990[_0x5575c1];return _0x50ea4e;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x0999('0x0'),_0x0999('0x1'),_0x0999('0x2')];function createListener(_0x46a009,_0x33d7a5){return function(_0x43f491){_0x33d7a5[_0x0999('0x3')](_0x46a009,_0x43f491);};}function removeListener(_0x2754ce,_0x4e13c1){return function(){VoicePrefixEvents[_0x0999('0x4')](_0x2754ce,_0x4e13c1);};}exports[_0x0999('0x5')]=function(_0x45d3e0){for(var _0x4c606f=0x0,_0x1a6f23=events[_0x0999('0x6')];_0x4c606f<_0x1a6f23;_0x4c606f++){var _0x3fe805=events[_0x4c606f];var _0x304f75=createListener(_0x0999('0x7')+_0x3fe805,_0x45d3e0);VoicePrefixEvents['on'](_0x3fe805,_0x304f75);}}; \ No newline at end of file +var _0x7427=['voicePrefix:','./voicePrefix.events','save','remove','update','removeListener','register','length'];(function(_0x3462fe,_0xea29b5){var _0x4ee7fe=function(_0x955e7d){while(--_0x955e7d){_0x3462fe['push'](_0x3462fe['shift']());}};_0x4ee7fe(++_0xea29b5);}(_0x7427,0x111));var _0x7742=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x7427[_0x4e1d03];return _0x362d4b;};'use strict';var VoicePrefixEvents=require(_0x7742('0x0'));var events=[_0x7742('0x1'),_0x7742('0x2'),_0x7742('0x3')];function createListener(_0x4c1421,_0x3b6268){return function(_0x1bfe63){_0x3b6268['emit'](_0x4c1421,_0x1bfe63);};}function removeListener(_0x192977,_0x2eb7b0){return function(){VoicePrefixEvents[_0x7742('0x4')](_0x192977,_0x2eb7b0);};}exports[_0x7742('0x5')]=function(_0x360d59){for(var _0x57fa9a=0x0,_0x4fe55f=events[_0x7742('0x6')];_0x57fa9a<_0x4fe55f;_0x57fa9a++){var _0xd21f94=events[_0x57fa9a];var _0x3c6ceb=createListener(_0x7742('0x7')+_0xd21f94,_0x360d59);VoicePrefixEvents['on'](_0xd21f94,_0x3c6ceb);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 9dd9440..7e72b39 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 _0x495f=['delete','removeTeams','/:id/users','removeLists','removeBlackLists','connect-timeout','fs-extra','isAuthenticated','index','get','/:id','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/teams','getAgents','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','destroy'];(function(_0x64fafc,_0x342746){var _0x2b8d07=function(_0x5cbd66){while(--_0x5cbd66){_0x64fafc['push'](_0x64fafc['shift']());}};_0x2b8d07(++_0x342746);}(_0x495f,0x11c));var _0xf495=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x495f[_0x363ef8];return _0x148822;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xf495('0x0'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf495('0x1'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceQueue.controller');router['get']('/',auth[_0xf495('0x2')](),controller[_0xf495('0x3')]);router[_0xf495('0x4')](_0xf495('0x5'),auth[_0xf495('0x2')](),controller['show']);router[_0xf495('0x4')](_0xf495('0x6'),auth['isAuthenticated'](),controller['getHoppers']);router[_0xf495('0x4')](_0xf495('0x7'),auth[_0xf495('0x2')](),controller[_0xf495('0x8')]);router[_0xf495('0x4')](_0xf495('0x9'),auth[_0xf495('0x2')](),controller[_0xf495('0xa')]);router['get']('/:id/hopper_black',auth['isAuthenticated'](),controller['getHopperBlacks']);router[_0xf495('0x4')](_0xf495('0xb'),auth[_0xf495('0x2')](),controller['getTeams']);router['get']('/:id/users',auth[_0xf495('0x2')](),controller[_0xf495('0xc')]);router[_0xf495('0x4')]('/:id/members',auth[_0xf495('0x2')](),controller['getMembers']);router['get'](_0xf495('0xd'),auth[_0xf495('0x2')](),controller[_0xf495('0xe')]);router[_0xf495('0x4')](_0xf495('0xf'),auth[_0xf495('0x2')](),controller[_0xf495('0x10')]);router[_0xf495('0x11')]('/',auth[_0xf495('0x2')](),controller[_0xf495('0x12')]);router['post'](_0xf495('0x13'),auth[_0xf495('0x2')](),controller['clone']);router[_0xf495('0x11')](_0xf495('0xb'),auth[_0xf495('0x2')](),controller[_0xf495('0x14')]);router[_0xf495('0x11')]('/:id/users',auth[_0xf495('0x2')](),controller[_0xf495('0x15')]);router[_0xf495('0x11')](_0xf495('0xd'),auth[_0xf495('0x2')](),controller[_0xf495('0x16')]);router['post'](_0xf495('0xf'),auth['isAuthenticated'](),controller[_0xf495('0x17')]);router[_0xf495('0x18')](_0xf495('0x5'),auth[_0xf495('0x2')](),controller['update']);router['delete']('/:id',auth[_0xf495('0x2')](),controller[_0xf495('0x19')]);router[_0xf495('0x1a')](_0xf495('0xb'),auth[_0xf495('0x2')](),controller[_0xf495('0x1b')]);router[_0xf495('0x1a')](_0xf495('0x1c'),auth['isAuthenticated'](),controller['removeAgents']);router[_0xf495('0x1a')](_0xf495('0xd'),auth[_0xf495('0x2')](),controller[_0xf495('0x1d')]);router[_0xf495('0x1a')](_0xf495('0xf'),auth[_0xf495('0x2')](),controller[_0xf495('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x490d=['addAgents','addLists','addBlackLists','update','destroy','delete','removeAgents','removeLists','removeBlackLists','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','show','/:id/hoppers','isAuthenticated','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','addTeams'];(function(_0x3e438d,_0x25f075){var _0x1c1b61=function(_0x32eeba){while(--_0x32eeba){_0x3e438d['push'](_0x3e438d['shift']());}};_0x1c1b61(++_0x25f075);}(_0x490d,0x1b7));var _0xd490=function(_0x4b596c,_0x585b0c){_0x4b596c=_0x4b596c-0x0;var _0x456e5e=_0x490d[_0x4b596c];return _0x456e5e;};'use strict';var multer=require(_0xd490('0x0'));var util=require(_0xd490('0x1'));var path=require('path');var timeout=require(_0xd490('0x2'));var express=require(_0xd490('0x3'));var router=express['Router']();var fs_extra=require(_0xd490('0x4'));var auth=require(_0xd490('0x5'));var interaction=require(_0xd490('0x6'));var config=require(_0xd490('0x7'));var controller=require(_0xd490('0x8'));router[_0xd490('0x9')]('/',auth['isAuthenticated'](),controller[_0xd490('0xa')]);router[_0xd490('0x9')](_0xd490('0xb'),auth['isAuthenticated'](),controller[_0xd490('0xc')]);router[_0xd490('0x9')](_0xd490('0xd'),auth[_0xd490('0xe')](),controller[_0xd490('0xf')]);router[_0xd490('0x9')](_0xd490('0x10'),auth[_0xd490('0xe')](),controller[_0xd490('0x11')]);router['get']('/:id/hopper_finals',auth[_0xd490('0xe')](),controller['getHopperFinals']);router['get'](_0xd490('0x12'),auth[_0xd490('0xe')](),controller[_0xd490('0x13')]);router[_0xd490('0x9')](_0xd490('0x14'),auth[_0xd490('0xe')](),controller[_0xd490('0x15')]);router[_0xd490('0x9')](_0xd490('0x16'),auth[_0xd490('0xe')](),controller[_0xd490('0x17')]);router[_0xd490('0x9')](_0xd490('0x18'),auth[_0xd490('0xe')](),controller[_0xd490('0x19')]);router[_0xd490('0x9')](_0xd490('0x1a'),auth[_0xd490('0xe')](),controller[_0xd490('0x1b')]);router['get'](_0xd490('0x1c'),auth[_0xd490('0xe')](),controller[_0xd490('0x1d')]);router[_0xd490('0x1e')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xd490('0x1f'),auth['isAuthenticated'](),controller[_0xd490('0x20')]);router[_0xd490('0x1e')](_0xd490('0x14'),auth[_0xd490('0xe')](),controller[_0xd490('0x21')]);router['post']('/:id/users',auth[_0xd490('0xe')](),controller[_0xd490('0x22')]);router[_0xd490('0x1e')]('/:id/lists',auth[_0xd490('0xe')](),controller[_0xd490('0x23')]);router[_0xd490('0x1e')]('/:id/blacklists',auth[_0xd490('0xe')](),controller[_0xd490('0x24')]);router['put'](_0xd490('0xb'),auth[_0xd490('0xe')](),controller[_0xd490('0x25')]);router['delete'](_0xd490('0xb'),auth['isAuthenticated'](),controller[_0xd490('0x26')]);router[_0xd490('0x27')](_0xd490('0x14'),auth[_0xd490('0xe')](),controller['removeTeams']);router[_0xd490('0x27')](_0xd490('0x16'),auth[_0xd490('0xe')](),controller[_0xd490('0x28')]);router[_0xd490('0x27')](_0xd490('0x1a'),auth[_0xd490('0xe')](),controller[_0xd490('0x29')]);router['delete'](_0xd490('0x1c'),auth[_0xd490('0xe')](),controller[_0xd490('0x2a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 0b3cf7d..fd20866 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 _0x5e0c=['#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','name','ENUM','inbound','outbound','default','ringall','random','linear','wrandom','rrordered','setDataValue','rrmemory','getDataValue','type','strategy','booked','roundrobin','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','progressive','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','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,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x5e0c,0x19f));var _0xc5e0=function(_0x254081,_0x133020){_0x254081=_0x254081-0x0;var _0x15e822=_0x5e0c[_0x254081];return _0x15e822;};'use strict';var Sequelize=require('sequelize');module[_0xc5e0('0x0')]={'name':{'type':Sequelize[_0xc5e0('0x1')],'allowNull':![],'unique':_0xc5e0('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xc5e0('0x3')](_0xc5e0('0x4'),_0xc5e0('0x5')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0xc5e0('0x1')],'defaultValue':_0xc5e0('0x6')},'announce':{'type':Sequelize[_0xc5e0('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0xc5e0('0x3')]('rr',_0xc5e0('0x7'),'leastrecent','fewestcalls',_0xc5e0('0x8'),'rrmemory',_0xc5e0('0x9'),_0xc5e0('0xa'),_0xc5e0('0xb')),'allowNull':![],'defaultValue':_0xc5e0('0x7'),'set':function(_0x5ce913){this[_0xc5e0('0xc')]('strategy',_0x5ce913?_0x5ce913:_0xc5e0('0xd'));},'get':function(){var _0x33d821=this[_0xc5e0('0xe')](_0xc5e0('0xf'));var _0x1f220b=this[_0xc5e0('0xe')]('dialMethod');var _0x43969b=this[_0xc5e0('0xe')](_0xc5e0('0x10'));if(_0x33d821===_0xc5e0('0x4')){return _0x43969b;}if(_0x1f220b===_0xc5e0('0x11')&&_0x43969b==='rrmemory'||_0x1f220b===_0xc5e0('0x11')&&_0x43969b===_0xc5e0('0x12')){return _0x43969b;}if(_0x1f220b==='progressive'||_0x1f220b==='predictive'||_0x1f220b===_0xc5e0('0x13')){return _0x43969b;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xc5e0('0x14')](0xb)},'timeout':{'type':Sequelize[_0xc5e0('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xc5e0('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xc5e0('0x1')]},'weight':{'type':Sequelize[_0xc5e0('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xc5e0('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xc5e0('0x3')](_0xc5e0('0x15'),'no'),'defaultValue':_0xc5e0('0x15')},'autopause':{'type':Sequelize[_0xc5e0('0x3')](_0xc5e0('0x15'),'no',_0xc5e0('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xc5e0('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0xc5e0('0x3')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0xc5e0('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xc5e0('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xc5e0('0x3')](_0xc5e0('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xc5e0('0x3')](_0xc5e0('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0xc5e0('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xc5e0('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xc5e0('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xc5e0('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xc5e0('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xc5e0('0x3')](_0xc5e0('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xc5e0('0x3')]('yes','no'),'defaultValue':_0xc5e0('0x15')},'announce_holdtime':{'type':Sequelize['ENUM'](_0xc5e0('0x15'),'no',_0xc5e0('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM']('yes','no')},'announce_position_limit':{'type':Sequelize[_0xc5e0('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xc5e0('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xc5e0('0x1')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xc5e0('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xc5e0('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xc5e0('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xc5e0('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0xc5e0('0x1')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0xc5e0('0x1')]},'queue_less_than':{'type':Sequelize[_0xc5e0('0x1')]},'periodic_announce':{'type':Sequelize[_0xc5e0('0x18')],'set':function(_0x168212){this['setDataValue'](_0xc5e0('0x19'),_0x168212?_0x168212[_0xc5e0('0x1a')](','):[]);},'get':function(){return this['getDataValue'](_0xc5e0('0x19'))?this[_0xc5e0('0xe')](_0xc5e0('0x19'))[_0xc5e0('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0xc5e0('0x1')],'defaultValue':_0xc5e0('0x15'),'set':function(_0x31a921){this[_0xc5e0('0xc')](_0xc5e0('0x1c'),_0x31a921?_0x31a921[_0xc5e0('0x1a')](','):undefined);},'get':function(){return this[_0xc5e0('0xe')](_0xc5e0('0x1c'))?this['getDataValue']('joinempty')[_0xc5e0('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x3e2ded){this[_0xc5e0('0xc')](_0xc5e0('0x1d'),_0x3e2ded?_0x3e2ded[_0xc5e0('0x1a')](','):undefined);},'get':function(){return this[_0xc5e0('0xe')](_0xc5e0('0x1d'))?this['getDataValue'](_0xc5e0('0x1d'))[_0xc5e0('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xc5e0('0x3')](_0xc5e0('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xc5e0('0x3')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xc5e0('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xc5e0('0x3')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xc5e0('0x1')]},'description':{'type':Sequelize[_0xc5e0('0x1')]},'acw':{'type':Sequelize[_0xc5e0('0x1e')],'defaultValue':0x0,'set':function(_0x30127e){this[_0xc5e0('0xc')](_0xc5e0('0x1f'),_0x30127e);if(_0x30127e){if(this[_0xc5e0('0xe')](_0xc5e0('0x20'))<0x2){this[_0xc5e0('0xc')](_0xc5e0('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xc5e0('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xc5e0('0x1e')],'defaultValue':0x0,'comment':_0xc5e0('0x21')},'dialMethod':{'type':Sequelize[_0xc5e0('0x3')](_0xc5e0('0x22'),_0xc5e0('0x23'),_0xc5e0('0x13'),_0xc5e0('0x24'),_0xc5e0('0x11')),'defaultValue':'progressive','comment':_0xc5e0('0x25')},'dialLimitChannel':{'type':Sequelize[_0xc5e0('0x14')](0x4)[_0xc5e0('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xc5e0('0x27')},'dialLimitQueue':{'type':Sequelize[_0xc5e0('0x14')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xc5e0('0x28')},'dialPowerLevel':{'type':Sequelize[_0xc5e0('0x29')](0x2)[_0xc5e0('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xc5e0('0x2a')},'dialPredictiveOptimization':{'type':Sequelize[_0xc5e0('0x3')](_0xc5e0('0x2b'),'dropRate'),'defaultValue':_0xc5e0('0x2c'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xc5e0('0x29')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xc5e0('0x2d')},'dialPredictiveInterval':{'type':Sequelize[_0xc5e0('0x14')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0xc5e0('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc5e0('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc5e0('0x2e')},'dialQueueOptions':{'type':Sequelize[_0xc5e0('0x1')],'defaultValue':_0xc5e0('0x2f'),'comment':_0xc5e0('0x30')},'dialQueueTimeout':{'type':Sequelize[_0xc5e0('0x14')](0x3)[_0xc5e0('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0xc5e0('0x31')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc5e0('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc5e0('0x14')](0x5)[_0xc5e0('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc5e0('0x32')},'dialBusyMaxRetry':{'type':Sequelize[_0xc5e0('0x14')](0x3)[_0xc5e0('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xc5e0('0x14')](0x5)[_0xc5e0('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc5e0('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc5e0('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xc5e0('0x34')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc5e0('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc5e0('0x35')},'dialGlobalMaxRetry':{'type':Sequelize[_0xc5e0('0x14')](0x3)[_0xc5e0('0x26')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xc5e0('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xc5e0('0x36')},'dialPrefix':{'type':Sequelize[_0xc5e0('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xc5e0('0x3')](_0xc5e0('0x37'),_0xc5e0('0x38'),_0xc5e0('0x39')),'defaultValue':_0xc5e0('0x37')},'dialAMDActive':{'type':Sequelize[_0xc5e0('0x1e')],'defaultValue':0x0,'comment':_0xc5e0('0x3a')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xc5e0('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xc5e0('0x14')](0x9)[_0xc5e0('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc5e0('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xc5e0('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xc5e0('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc5e0('0x14')](0x9)[_0xc5e0('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc5e0('0x3d')},'dialAMDMinWordLength':{'type':Sequelize[_0xc5e0('0x14')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc5e0('0x3e')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc5e0('0x14')](0x9)[_0xc5e0('0x26')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc5e0('0x3f')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xc5e0('0x14')](0x9)[_0xc5e0('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xc5e0('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc5e0('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc5e0('0x14')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xc5e0('0x14')](0x5)[_0xc5e0('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xc5e0('0x41')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0xc5e0('0x3')](_0xc5e0('0x42'),_0xc5e0('0x43')),'defaultValue':_0xc5e0('0x42')},'dialQueueProject2':{'type':Sequelize[_0xc5e0('0x1')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0xc5e0('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xc5e0('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xc5e0('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc5e0('0x44')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xc5e0('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc5e0('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc5e0('0x14')](0x3)[_0xc5e0('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc5e0('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc5e0('0x14')](0x5)[_0xc5e0('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc5e0('0x47')},'dialDropMaxRetry':{'type':Sequelize[_0xc5e0('0x14')](0x3)[_0xc5e0('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc5e0('0x48')},'dialDropRetryFrequency':{'type':Sequelize[_0xc5e0('0x14')](0x5)[_0xc5e0('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc5e0('0x49')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc5e0('0x14')](0x3)[_0xc5e0('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc5e0('0x4a')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc5e0('0x4b')},'dialMachineMaxRetry':{'type':Sequelize[_0xc5e0('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc5e0('0x4c')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc5e0('0x4d')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xc5e0('0x14')](0x3)[_0xc5e0('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc5e0('0x4e')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xc5e0('0x14')](0x5)[_0xc5e0('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc5e0('0x4f')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc5e0('0x14')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xc5e0('0x1e')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3be7b3){if(!_0x3be7b3)this[_0xc5e0('0xc')]('mandatoryDispositionPauseId',null);this[_0xc5e0('0xc')]('mandatoryDisposition',_0x3be7b3);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xc5e0('0x14')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xc5e0('0x14')](0x3)[_0xc5e0('0x26')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0x31e7=['Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','Active/Disactive\x20Recall\x20In\x20Queue','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)','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','exports','name','ENUM','inbound','outbound','STRING','default','ringall','random','rrmemory','linear','wrandom','rrordered','getDataValue','type','dialMethod','strategy','booked','roundrobin','INTEGER','yes','all','once','setDataValue','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'];(function(_0x399ffa,_0x482582){var _0x4b4a72=function(_0x20492d){while(--_0x20492d){_0x399ffa['push'](_0x399ffa['shift']());}};_0x4b4a72(++_0x482582);}(_0x31e7,0x74));var _0x731e=function(_0x33d7d6,_0x4ea090){_0x33d7d6=_0x33d7d6-0x0;var _0x5a0b80=_0x31e7[_0x33d7d6];return _0x5a0b80;};'use strict';var Sequelize=require('sequelize');module[_0x731e('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x731e('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x731e('0x2')](_0x731e('0x3'),_0x731e('0x4')),'allowNull':![],'defaultValue':_0x731e('0x3')},'musiconhold':{'type':Sequelize[_0x731e('0x5')],'defaultValue':_0x731e('0x6')},'announce':{'type':Sequelize[_0x731e('0x5')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x731e('0x7'),'leastrecent','fewestcalls',_0x731e('0x8'),_0x731e('0x9'),_0x731e('0xa'),_0x731e('0xb'),_0x731e('0xc')),'allowNull':![],'defaultValue':_0x731e('0x7'),'set':function(_0x356edb){this['setDataValue']('strategy',_0x356edb?_0x356edb:'rrmemory');},'get':function(){var _0x3b4e6f=this[_0x731e('0xd')](_0x731e('0xe'));var _0x3e646f=this[_0x731e('0xd')](_0x731e('0xf'));var _0x1ba032=this[_0x731e('0xd')](_0x731e('0x10'));if(_0x3b4e6f===_0x731e('0x3')){return _0x1ba032;}if(_0x3e646f===_0x731e('0x11')&&_0x1ba032==='rrmemory'||_0x3e646f===_0x731e('0x11')&&_0x1ba032===_0x731e('0x12')){return _0x1ba032;}if(_0x3e646f==='progressive'||_0x3e646f==='predictive'||_0x3e646f==='power'){return _0x1ba032;}return null;}},'servicelevel':{'type':Sequelize[_0x731e('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x731e('0x5')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x731e('0x13')](0xb)},'timeout':{'type':Sequelize[_0x731e('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x731e('0x13')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x731e('0x5')]},'weight':{'type':Sequelize[_0x731e('0x13')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x731e('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0x731e('0x14'),'no'),'defaultValue':_0x731e('0x14')},'autopause':{'type':Sequelize[_0x731e('0x2')]('yes','no',_0x731e('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x731e('0x2')](_0x731e('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x731e('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x731e('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x731e('0x2')](_0x731e('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x731e('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x731e('0x2')](_0x731e('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x731e('0x2')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x731e('0x5')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x731e('0x5')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x731e('0x13')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x731e('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x731e('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x731e('0x2')](_0x731e('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x731e('0x2')]('yes','no'),'defaultValue':_0x731e('0x14')},'announce_holdtime':{'type':Sequelize[_0x731e('0x2')](_0x731e('0x14'),'no',_0x731e('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x731e('0x5')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x731e('0x2')](_0x731e('0x14'),'no')},'announce_position_limit':{'type':Sequelize[_0x731e('0x13')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x731e('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x731e('0x5')]},'queue_youarenext':{'type':Sequelize[_0x731e('0x5')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x731e('0x5')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x731e('0x5')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x731e('0x5')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x731e('0x5')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x731e('0x5')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x731e('0x5')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x731e('0x5')]},'queue_periodic_announce':{'type':Sequelize[_0x731e('0x5')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x22fcdd){this[_0x731e('0x17')](_0x731e('0x18'),_0x22fcdd?_0x22fcdd[_0x731e('0x19')](','):[]);},'get':function(){return this[_0x731e('0xd')](_0x731e('0x18'))?this[_0x731e('0xd')](_0x731e('0x18'))[_0x731e('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x731e('0x5')],'defaultValue':'yes','set':function(_0x3a7762){this[_0x731e('0x17')](_0x731e('0x1b'),_0x3a7762?_0x3a7762['join'](','):undefined);},'get':function(){return this[_0x731e('0xd')](_0x731e('0x1b'))?this[_0x731e('0xd')]('joinempty')[_0x731e('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x731e('0x5')],'defaultValue':'no','set':function(_0xb98d33){this[_0x731e('0x17')](_0x731e('0x1c'),_0xb98d33?_0xb98d33[_0x731e('0x19')](','):undefined);},'get':function(){return this[_0x731e('0xd')]('leavewhenempty')?this['getDataValue'](_0x731e('0x1c'))[_0x731e('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x731e('0x2')](_0x731e('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x731e('0x2')](_0x731e('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x731e('0x13')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x731e('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x731e('0x5')]},'description':{'type':Sequelize[_0x731e('0x5')]},'acw':{'type':Sequelize[_0x731e('0x1d')],'defaultValue':0x0,'set':function(_0x12d148){this[_0x731e('0x17')](_0x731e('0x1e'),_0x12d148);if(_0x12d148){if(this[_0x731e('0xd')]('wrapuptime')<0x2){this[_0x731e('0x17')](_0x731e('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x731e('0x13')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x731e('0x1d')],'defaultValue':0x0,'comment':_0x731e('0x20')},'dialMethod':{'type':Sequelize[_0x731e('0x2')](_0x731e('0x21'),_0x731e('0x22'),'power','predictive',_0x731e('0x11')),'defaultValue':_0x731e('0x22'),'comment':_0x731e('0x23')},'dialLimitChannel':{'type':Sequelize[_0x731e('0x13')](0x4)[_0x731e('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x731e('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x731e('0x25')},'dialPowerLevel':{'type':Sequelize[_0x731e('0x26')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x731e('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0x731e('0x2')](_0x731e('0x28'),_0x731e('0x29')),'defaultValue':_0x731e('0x29'),'comment':_0x731e('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x731e('0x26')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x731e('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0x731e('0x13')](0x3)[_0x731e('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x731e('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x731e('0x5')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x731e('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x731e('0x2d')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x731e('0x2e'),'comment':_0x731e('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0x731e('0x13')](0x3)[_0x731e('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x731e('0x30')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x731e('0x31')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x731e('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x731e('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x731e('0x13')](0x3)[_0x731e('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x731e('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0x731e('0x13')](0x5)[_0x731e('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x731e('0x13')](0x3)[_0x731e('0x24')],'defaultValue':0x3,'comment':_0x731e('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x731e('0x13')](0x5)[_0x731e('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x731e('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0x731e('0x13')](0x3)[_0x731e('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x731e('0x35')},'dialTimezone':{'type':Sequelize[_0x731e('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x731e('0x5')],'defaultValue':_0x731e('0x36')},'dialPrefix':{'type':Sequelize[_0x731e('0x5')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x731e('0x37'),_0x731e('0x38'),_0x731e('0x39')),'defaultValue':_0x731e('0x37')},'dialAMDActive':{'type':Sequelize[_0x731e('0x1d')],'defaultValue':0x0,'comment':_0x731e('0x3a')},'dialAMDInitialSilence':{'type':Sequelize[_0x731e('0x13')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x731e('0x3b')},'dialAMDGreeting':{'type':Sequelize[_0x731e('0x13')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x731e('0x3c')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x731e('0x13')](0x9)[_0x731e('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x731e('0x3d')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x731e('0x13')](0x9)[_0x731e('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x731e('0x13')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x731e('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x731e('0x13')](0x9)[_0x731e('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x731e('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x731e('0x13')](0x5)[_0x731e('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x731e('0x13')](0x9)[_0x731e('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x731e('0x40')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0x731e('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x731e('0x1d')],'defaultValue':0x0,'comment':_0x731e('0x41')},'dialOrderByScheduledAt':{'type':Sequelize[_0x731e('0x2')](_0x731e('0x42'),_0x731e('0x43')),'defaultValue':_0x731e('0x42')},'dialQueueProject2':{'type':Sequelize[_0x731e('0x5')],'comment':_0x731e('0x31')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x731e('0x1d')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x731e('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x731e('0x44')},'dialCutDigit':{'type':Sequelize[_0x731e('0x13')](0x3)[_0x731e('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x731e('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x731e('0x13')](0x3)[_0x731e('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x731e('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x731e('0x13')](0x5)[_0x731e('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x731e('0x47')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x731e('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x731e('0x48')},'dialDropRetryFrequency':{'type':Sequelize[_0x731e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x731e('0x13')](0x3)[_0x731e('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x731e('0x49')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x731e('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x731e('0x4a')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x731e('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x731e('0x4b')},'dialMachineRetryFrequency':{'type':Sequelize[_0x731e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x731e('0x13')](0x3)[_0x731e('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x731e('0x4c')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x731e('0x13')](0x5)[_0x731e('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x731e('0x4d')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x731e('0x13')],'allowNull':!![],'comment':_0x731e('0x4e')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x731e('0x4f'),'set':function(_0x415c1a){if(!_0x415c1a)this[_0x731e('0x17')](_0x731e('0x50'),null);this[_0x731e('0x17')](_0x731e('0x51'),_0x415c1a);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x731e('0x13')](0x3)[_0x731e('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x731e('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 117d6e3..1b10a10 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 _0xfd6c=['phone','scheduledAt','ListId','NOW()','ContactId','CmListId','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','removeLists','getBlackLists','addBlackLists','spread','cm_hopper_black','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','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/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','VoiceQueues','inbound','outbound','filter','ignore','map','value','type','find','name','UserProfileResource','error','stack','send','index','VoiceQueue','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','options','includeAll','catch','show','params','rawAttributes','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','QueueCampaigns','UserProfileSection','autoAssociation','clone','omit','createdAt','updatedAt','body','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','order','VoiceQueueId','CmHopper','findOne','CmHopperHistory','nolimit','rows','getHopperFinals','CmHopperFinal','findAll','getHopperBlacks','CmHopperBlack','getTeams','teams','Team','User','Agents','online','voicePause','interface','flatMap','penalty','sequelize','transaction','addTeams','each','TeamVoiceQueue','upsert','UserVoiceQueue','isNil','format','SIP/%s','forEach','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','from','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','removeAgents','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','isEmpty','isArray','emit','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery'];(function(_0x346df1,_0x10fe5d){var _0xba7da6=function(_0x2a75c6){while(--_0x2a75c6){_0x346df1['push'](_0x346df1['shift']());}};_0xba7da6(++_0x10fe5d);}(_0xfd6c,0x18e));var _0xcfd6=function(_0x40ddc0,_0x41c082){_0x40ddc0=_0x40ddc0-0x0;var _0x1aebf1=_0xfd6c[_0x40ddc0];return _0x1aebf1;};'use strict';var emlformat=require(_0xcfd6('0x0'));var rimraf=require(_0xcfd6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcfd6('0x2'));var rp=require(_0xcfd6('0x3'));var moment=require(_0xcfd6('0x4'));var BPromise=require(_0xcfd6('0x5'));var Mustache=require(_0xcfd6('0x6'));var util=require(_0xcfd6('0x7'));var path=require(_0xcfd6('0x8'));var sox=require(_0xcfd6('0x9'));var csv=require('to-csv');var ejs=require(_0xcfd6('0xa'));var fs=require('fs');var fs_extra=require(_0xcfd6('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xcfd6('0xc'));var jsforce=require(_0xcfd6('0xd'));var deskjs=require(_0xcfd6('0xe'));var toCsv=require(_0xcfd6('0xf'));var querystring=require('querystring');var Papa=require(_0xcfd6('0x10'));var Redis=require(_0xcfd6('0x11'));var authService=require(_0xcfd6('0x12'));var qs=require(_0xcfd6('0x13'));var as=require(_0xcfd6('0x14'));var hardwareService=require(_0xcfd6('0x15'));var logger=require(_0xcfd6('0x16'))(_0xcfd6('0x17'));var utils=require(_0xcfd6('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xcfd6('0x19'));var db=require(_0xcfd6('0x1a'))['db'];config[_0xcfd6('0x1b')]=_[_0xcfd6('0x1c')](config[_0xcfd6('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xcfd6('0x1d'))(new Redis(config[_0xcfd6('0x1b')]));require('./voiceQueue.socket')[_0xcfd6('0x1e')](socket);function respondWithStatusCode(_0x4d42ab,_0x2ac2d6){_0x2ac2d6=_0x2ac2d6||0xcc;return function(_0x2c88bc){if(_0x2c88bc){return _0x4d42ab[_0xcfd6('0x1f')](_0x2ac2d6);}return _0x4d42ab[_0xcfd6('0x20')](_0x2ac2d6)[_0xcfd6('0x21')]();};}function respondWithResult(_0x44b876,_0x301f8f){_0x301f8f=_0x301f8f||0xc8;return function(_0x463eef){if(_0x463eef){return _0x44b876[_0xcfd6('0x20')](_0x301f8f)[_0xcfd6('0x22')](_0x463eef);}};}function respondWithFilteredResult(_0x48346d,_0x21cb40){return function(_0x23313a){if(_0x23313a){var _0x505d06=typeof _0x21cb40[_0xcfd6('0x23')]===_0xcfd6('0x24')&&typeof _0x21cb40[_0xcfd6('0x25')]==='undefined';var _0x4dd7ec=_0x23313a[_0xcfd6('0x26')];var _0x233dbe=_0x505d06?0x0:_0x21cb40[_0xcfd6('0x23')];var _0x14103c=_0x505d06?_0x23313a[_0xcfd6('0x26')]:_0x21cb40['offset']+_0x21cb40[_0xcfd6('0x25')];var _0x40939b;if(_0x14103c>=_0x4dd7ec){_0x14103c=_0x4dd7ec;_0x40939b=0xc8;}else{_0x40939b=0xce;}_0x48346d[_0xcfd6('0x20')](_0x40939b);return _0x48346d['set'](_0xcfd6('0x27'),_0x233dbe+'-'+_0x14103c+'/'+_0x4dd7ec)[_0xcfd6('0x22')](_0x23313a);}return null;};}function patchUpdates(_0x3e4362){return function(_0x4b62d9){try{jsonpatch[_0xcfd6('0x28')](_0x4b62d9,_0x3e4362,!![]);}catch(_0x2e8ff3){return BPromise[_0xcfd6('0x29')](_0x2e8ff3);}return _0x4b62d9[_0xcfd6('0x2a')]();};}function saveUpdates(_0x1c23d9,_0x56e726){return function(_0x2d8597){if(_0x2d8597){return _0x2d8597[_0xcfd6('0x2b')](_0x1c23d9)[_0xcfd6('0x2c')](function(_0x476490){return _0x476490;});}return null;};}function removeEntity(_0x5030e9,_0x2ddfa3){return function(_0x1e1ada){if(_0x1e1ada){return _0x1e1ada[_0xcfd6('0x2d')]()[_0xcfd6('0x2c')](function(){var _0x496c8a=_0x1e1ada[_0xcfd6('0x2e')]({'plain':!![]});var _0x4f8207=[{'name':_0xcfd6('0x2f'),'value':_0xcfd6('0x30'),'ignore':![]},{'name':'QueueCampaigns','value':_0xcfd6('0x31'),'ignore':![]}];var _0x49935c=_(_0x4f8207)[_0xcfd6('0x32')](_0xcfd6('0x33'))[_0xcfd6('0x34')]('value')[_0xcfd6('0x35')]();if(_['includes'](_0x49935c,_0x496c8a[_0xcfd6('0x36')])){return;}var _0x4c0928=_[_0xcfd6('0x37')](_0x4f8207,['value',_0x496c8a['type']])[_0xcfd6('0x38')];return db[_0xcfd6('0x39')][_0xcfd6('0x2d')]({'where':{'type':_0x4c0928,'resourceId':_0x496c8a['id']}})[_0xcfd6('0x2c')](function(){return _0x1e1ada;});})['then'](function(){_0x5030e9[_0xcfd6('0x20')](0xcc)[_0xcfd6('0x21')]();});}};}function handleEntityNotFound(_0x488794,_0x39e780){return function(_0xcda4da){if(!_0xcda4da){_0x488794[_0xcfd6('0x1f')](0x194);}return _0xcda4da;};}function handleError(_0x474c82,_0x15e9e1){_0x15e9e1=_0x15e9e1||0x1f4;return function(_0x100e42){logger[_0xcfd6('0x3a')](_0x100e42[_0xcfd6('0x3b')]);if(_0x100e42[_0xcfd6('0x38')]){delete _0x100e42['name'];}_0x474c82[_0xcfd6('0x20')](_0x15e9e1)[_0xcfd6('0x3c')](_0x100e42);};}exports[_0xcfd6('0x3d')]=function(_0xdcb1d8,_0x304b7f){var _0x59f644={},_0x4f958f={},_0xb17b84={'count':0x0,'rows':[]};var _0x43374c=_[_0xcfd6('0x34')](db[_0xcfd6('0x3e')]['rawAttributes'],function(_0x122407){return{'name':_0x122407['fieldName'],'type':_0x122407[_0xcfd6('0x36')][_0xcfd6('0x3f')]};});_0x4f958f['model']=_['map'](_0x43374c,'name');_0x4f958f['query']=_[_0xcfd6('0x40')](_0xdcb1d8[_0xcfd6('0x41')]);_0x4f958f[_0xcfd6('0x42')]=_['intersection'](_0x4f958f[_0xcfd6('0x43')],_0x4f958f[_0xcfd6('0x41')]);_0x59f644[_0xcfd6('0x44')]=_[_0xcfd6('0x45')](_0x4f958f['model'],qs['fields'](_0xdcb1d8[_0xcfd6('0x41')][_0xcfd6('0x46')]));_0x59f644[_0xcfd6('0x44')]=_0x59f644['attributes'][_0xcfd6('0x47')]?_0x59f644[_0xcfd6('0x44')]:_0x4f958f[_0xcfd6('0x43')];if(!_0xdcb1d8[_0xcfd6('0x41')][_0xcfd6('0x48')]('nolimit')){_0x59f644[_0xcfd6('0x25')]=qs[_0xcfd6('0x25')](_0xdcb1d8[_0xcfd6('0x41')][_0xcfd6('0x25')]);_0x59f644[_0xcfd6('0x23')]=qs[_0xcfd6('0x23')](_0xdcb1d8[_0xcfd6('0x41')][_0xcfd6('0x23')]);}_0x59f644['order']=qs[_0xcfd6('0x49')](_0xdcb1d8[_0xcfd6('0x41')][_0xcfd6('0x49')]);_0x59f644[_0xcfd6('0x4a')]=qs['filters'](_[_0xcfd6('0x4b')](_0xdcb1d8['query'],_0x4f958f[_0xcfd6('0x42')]),_0x43374c);if(_0xdcb1d8[_0xcfd6('0x41')]['filter']){_0x59f644['where']=_[_0xcfd6('0x4c')](_0x59f644[_0xcfd6('0x4a')],{'$or':_[_0xcfd6('0x34')](_0x43374c,function(_0x2cf140){if(_0x2cf140[_0xcfd6('0x36')]!==_0xcfd6('0x4d')){var _0x5bf25e={};_0x5bf25e[_0x2cf140[_0xcfd6('0x38')]]={'$like':'%'+_0xdcb1d8[_0xcfd6('0x41')][_0xcfd6('0x32')]+'%'};return _0x5bf25e;}})});}_0x59f644=_[_0xcfd6('0x4c')]({},_0x59f644,_0xdcb1d8[_0xcfd6('0x4e')]);var _0x1fe612={'where':_0x59f644['where']};return db[_0xcfd6('0x3e')][_0xcfd6('0x26')](_0x1fe612)[_0xcfd6('0x2c')](function(_0x520268){_0xb17b84['count']=_0x520268;if(_0xdcb1d8[_0xcfd6('0x41')][_0xcfd6('0x4f')]){_0x59f644['include']=[{'all':!![]}];}return db[_0xcfd6('0x3e')]['findAll'](_0x59f644);})[_0xcfd6('0x2c')](function(_0x4320d6){_0xb17b84['rows']=_0x4320d6;return _0xb17b84;})[_0xcfd6('0x2c')](respondWithFilteredResult(_0x304b7f,_0x59f644))[_0xcfd6('0x50')](handleError(_0x304b7f,null));};exports[_0xcfd6('0x51')]=function(_0x200659,_0x3ff948){var _0x24515e={'raw':![],'where':{'id':_0x200659[_0xcfd6('0x52')]['id']}},_0x5a0bef={};_0x5a0bef[_0xcfd6('0x43')]=_['keys'](db[_0xcfd6('0x3e')][_0xcfd6('0x53')]);_0x5a0bef[_0xcfd6('0x41')]=_['keys'](_0x200659[_0xcfd6('0x41')]);_0x5a0bef[_0xcfd6('0x42')]=_[_0xcfd6('0x45')](_0x5a0bef['model'],_0x5a0bef[_0xcfd6('0x41')]);_0x24515e[_0xcfd6('0x44')]=_[_0xcfd6('0x45')](_0x5a0bef[_0xcfd6('0x43')],qs[_0xcfd6('0x46')](_0x200659[_0xcfd6('0x41')][_0xcfd6('0x46')]));_0x24515e[_0xcfd6('0x44')]=_0x24515e[_0xcfd6('0x44')][_0xcfd6('0x47')]?_0x24515e[_0xcfd6('0x44')]:_0x5a0bef[_0xcfd6('0x43')];if(_0x200659[_0xcfd6('0x41')][_0xcfd6('0x4f')]){_0x24515e[_0xcfd6('0x54')]=[{'all':!![]}];}_0x24515e=_[_0xcfd6('0x4c')]({},_0x24515e,_0x200659[_0xcfd6('0x4e')]);return db[_0xcfd6('0x3e')][_0xcfd6('0x37')](_0x24515e)[_0xcfd6('0x2c')](handleEntityNotFound(_0x3ff948,null))[_0xcfd6('0x2c')](respondWithResult(_0x3ff948,null))[_0xcfd6('0x50')](handleError(_0x3ff948,null));};exports[_0xcfd6('0x55')]=function(_0x42ab17,_0x6b5631){return db[_0xcfd6('0x3e')]['create'](_0x42ab17['body'],{})[_0xcfd6('0x2c')](function(_0x55ef70){var _0x5a36b9=_0x42ab17[_0xcfd6('0x56')][_0xcfd6('0x2e')]({'plain':!![]});if(!_0x5a36b9)throw new Error(_0xcfd6('0x57'));if(_0x5a36b9[_0xcfd6('0x58')]==='user'){var _0x473f5c=_0x55ef70[_0xcfd6('0x2e')]({'plain':!![]});var _0x643233=[{'name':_0xcfd6('0x2f'),'value':_0xcfd6('0x30')},{'name':_0xcfd6('0x59'),'value':'outbound'}];var _0x3dbb86=_[_0xcfd6('0x37')](_0x643233,[_0xcfd6('0x35'),_0x473f5c['type']])[_0xcfd6('0x38')];return db[_0xcfd6('0x5a')][_0xcfd6('0x37')]({'where':{'name':_0x3dbb86,'userProfileId':_0x5a36b9['userProfileId']},'raw':!![]})[_0xcfd6('0x2c')](function(_0x29e931){if(_0x29e931&&_0x29e931[_0xcfd6('0x5b')]===0x0){return db['UserProfileResource'][_0xcfd6('0x55')]({'name':_0x473f5c['name'],'resourceId':_0x473f5c['id'],'type':_0x29e931['name'],'sectionId':_0x29e931['id']},{})[_0xcfd6('0x2c')](function(){return _0x55ef70;});}else{return _0x55ef70;}})[_0xcfd6('0x50')](function(_0x5778e5){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5778e5);throw _0x5778e5;});}return _0x55ef70;})[_0xcfd6('0x2c')](respondWithResult(_0x6b5631,0xc9))['catch'](handleError(_0x6b5631,null));};exports[_0xcfd6('0x5c')]=function(_0x54fcea,_0xb1457b){var _0x5be85={'where':{'id':_0x54fcea['params']['id']}},_0x256192={};_0x256192['model']=_[_0xcfd6('0x40')](db[_0xcfd6('0x3e')][_0xcfd6('0x53')]);_0x5be85[_0xcfd6('0x44')]=_[_0xcfd6('0x45')](_0x256192[_0xcfd6('0x43')],qs[_0xcfd6('0x46')](_0x54fcea[_0xcfd6('0x41')][_0xcfd6('0x46')]));_0x5be85[_0xcfd6('0x44')]=_0x5be85[_0xcfd6('0x44')][_0xcfd6('0x47')]?_0x5be85[_0xcfd6('0x44')]:_0x256192[_0xcfd6('0x43')];if(_0x54fcea[_0xcfd6('0x41')][_0xcfd6('0x4f')]){_0x5be85['include']=[{'all':!![]}];}_0x5be85=_['merge']({},_0x5be85,_0x54fcea[_0xcfd6('0x4e')]);return db['VoiceQueue'][_0xcfd6('0x37')](_0x5be85)[_0xcfd6('0x2c')](handleEntityNotFound(_0xb1457b,null))[_0xcfd6('0x2c')](function(_0x4c295c){if(_0x4c295c){var _0x12ffef=_0x4c295c[_0xcfd6('0x2e')]({'plain':!![]});_0x12ffef=qs[_0xcfd6('0x5d')](_0x12ffef,['id',_0xcfd6('0x5e'),_0xcfd6('0x5f')]);_0x54fcea[_0xcfd6('0x60')]=_[_0xcfd6('0x5d')](_0x54fcea[_0xcfd6('0x60')],['id',_0xcfd6('0x5e'),_0xcfd6('0x5f')]);return db[_0xcfd6('0x3e')][_0xcfd6('0x55')](_['merge'](_0x12ffef,_0x54fcea[_0xcfd6('0x60')]),{'include':_0x54fcea[_0xcfd6('0x41')]['includeAll']?[{'all':!![]}]:undefined})[_0xcfd6('0x2c')](function(_0x7997c8){var _0x26f9b9=_0x54fcea[_0xcfd6('0x56')]['get']({'plain':!![]});if(!_0x26f9b9)throw new Error(_0xcfd6('0x57'));if(_0x26f9b9['role']===_0xcfd6('0x56')){var _0x1a8a5b=_0x7997c8[_0xcfd6('0x2e')]({'plain':!![]});var _0x25cbf9=[{'name':_0xcfd6('0x2f'),'value':'inbound'},{'name':_0xcfd6('0x59'),'value':'outbound'}];var _0x102301=_['find'](_0x25cbf9,[_0xcfd6('0x35'),_0x1a8a5b[_0xcfd6('0x36')]])[_0xcfd6('0x38')];return db['UserProfileSection'][_0xcfd6('0x37')]({'where':{'name':_0x102301,'userProfileId':_0x26f9b9[_0xcfd6('0x61')]},'raw':!![]})[_0xcfd6('0x2c')](function(_0x810b5c){if(_0x810b5c&&_0x810b5c['autoAssociation']===0x0){return db[_0xcfd6('0x39')][_0xcfd6('0x55')]({'name':_0x1a8a5b['name'],'resourceId':_0x1a8a5b['id'],'type':_0x810b5c['name'],'sectionId':_0x810b5c['id']},{})[_0xcfd6('0x2c')](function(){return _0x7997c8;});}else{return _0x7997c8;}})['catch'](function(_0x5b058d){logger[_0xcfd6('0x3a')](_0xcfd6('0x62'),_0x5b058d);throw _0x5b058d;});}return _0x7997c8;});}})[_0xcfd6('0x2c')](respondWithResult(_0xb1457b,0xc9))['catch'](handleError(_0xb1457b,null));};exports['update']=function(_0x357270,_0x47ef18){if(_0x357270['body']['id']){delete _0x357270['body']['id'];}return db[_0xcfd6('0x3e')][_0xcfd6('0x37')]({'where':{'id':_0x357270[_0xcfd6('0x52')]['id']}})[_0xcfd6('0x2c')](handleEntityNotFound(_0x47ef18,null))[_0xcfd6('0x2c')](saveUpdates(_0x357270['body'],null))[_0xcfd6('0x2c')](respondWithResult(_0x47ef18,null))['catch'](handleError(_0x47ef18,null));};exports[_0xcfd6('0x2d')]=function(_0x57e7c1,_0x5e70e1){return db[_0xcfd6('0x3e')]['find']({'where':{'id':_0x57e7c1['params']['id']}})[_0xcfd6('0x2c')](handleEntityNotFound(_0x5e70e1,null))[_0xcfd6('0x2c')](removeEntity(_0x5e70e1,null))[_0xcfd6('0x50')](handleError(_0x5e70e1,null));};exports[_0xcfd6('0x63')]=function(_0x3dbdbc,_0x5ef39f,_0x242f39){var _0x1b8804={'raw':![],'where':{}};var _0x180510={};var _0x7a128c={'count':0x0,'rows':[]};return db[_0xcfd6('0x3e')]['findOne']({'where':{'id':_0x3dbdbc['params']['id']}})[_0xcfd6('0x2c')](handleEntityNotFound(_0x5ef39f,null))[_0xcfd6('0x2c')](function(_0x2e285e){if(_0x2e285e){_0x180510['model']=_['keys'](db['CmHopper']['rawAttributes']);_0x180510[_0xcfd6('0x41')]=_[_0xcfd6('0x40')](_0x3dbdbc[_0xcfd6('0x41')]);_0x180510['filters']=_['intersection'](_0x180510['model'],_0x180510[_0xcfd6('0x41')]);_0x1b8804[_0xcfd6('0x44')]=_['intersection'](_0x180510['model'],qs[_0xcfd6('0x46')](_0x3dbdbc[_0xcfd6('0x41')][_0xcfd6('0x46')]));_0x1b8804[_0xcfd6('0x44')]=_0x1b8804[_0xcfd6('0x44')]['length']?_0x1b8804[_0xcfd6('0x44')]:_0x180510['model'];if(!_0x3dbdbc['query'][_0xcfd6('0x48')]('nolimit')){_0x1b8804[_0xcfd6('0x25')]=qs[_0xcfd6('0x25')](_0x3dbdbc[_0xcfd6('0x41')][_0xcfd6('0x25')]);_0x1b8804[_0xcfd6('0x23')]=qs[_0xcfd6('0x23')](_0x3dbdbc[_0xcfd6('0x41')][_0xcfd6('0x23')]);}_0x1b8804[_0xcfd6('0x64')]=qs[_0xcfd6('0x49')](_0x3dbdbc['query'][_0xcfd6('0x49')]);_0x1b8804[_0xcfd6('0x4a')]=qs[_0xcfd6('0x42')](_[_0xcfd6('0x4b')](_0x3dbdbc['query'],_0x180510[_0xcfd6('0x42')]));_0x1b8804[_0xcfd6('0x4a')][_0xcfd6('0x65')]=_0x2e285e['id'];if(_0x3dbdbc['query']['filter']){_0x1b8804[_0xcfd6('0x4a')]=_[_0xcfd6('0x4c')](_0x1b8804[_0xcfd6('0x4a')],{'$or':_[_0xcfd6('0x34')](_0x1b8804[_0xcfd6('0x44')],function(_0x522723){var _0x557236={};_0x557236[_0x522723]={'$like':'%'+_0x3dbdbc[_0xcfd6('0x41')]['filter']+'%'};return _0x557236;})});}_0x1b8804=_[_0xcfd6('0x4c')]({},_0x1b8804,_0x3dbdbc[_0xcfd6('0x4e')]);return db['CmHopper'][_0xcfd6('0x26')]({'where':_0x1b8804[_0xcfd6('0x4a')]})['then'](function(_0x1c95f3){_0x7a128c['count']=_0x1c95f3;if(_0x3dbdbc['query'][_0xcfd6('0x4f')]){_0x1b8804[_0xcfd6('0x54')]=[{'all':!![]}];}return db[_0xcfd6('0x66')]['findAll'](_0x1b8804);})[_0xcfd6('0x2c')](function(_0x4ae907){_0x7a128c['rows']=_0x4ae907;return _0x7a128c;});}})[_0xcfd6('0x2c')](respondWithFilteredResult(_0x5ef39f,_0x1b8804))['catch'](handleError(_0x5ef39f,null));};exports['getHopperHistories']=function(_0x145f1a,_0x235d8f,_0x130963){var _0x767eca={'raw':!![],'where':{}};var _0x3b5626={};var _0x1da5b4={'count':0x0,'rows':[]};return db[_0xcfd6('0x3e')][_0xcfd6('0x67')]({'where':{'id':_0x145f1a[_0xcfd6('0x52')]['id']}})[_0xcfd6('0x2c')](handleEntityNotFound(_0x235d8f,null))['then'](function(_0x49811c){if(_0x49811c){_0x3b5626[_0xcfd6('0x43')]=_[_0xcfd6('0x40')](db[_0xcfd6('0x68')]['rawAttributes']);_0x3b5626['query']=_[_0xcfd6('0x40')](_0x145f1a[_0xcfd6('0x41')]);_0x3b5626[_0xcfd6('0x42')]=_[_0xcfd6('0x45')](_0x3b5626[_0xcfd6('0x43')],_0x3b5626['query']);_0x767eca['attributes']=_[_0xcfd6('0x45')](_0x3b5626['model'],qs[_0xcfd6('0x46')](_0x145f1a[_0xcfd6('0x41')][_0xcfd6('0x46')]));_0x767eca[_0xcfd6('0x44')]=_0x767eca['attributes'][_0xcfd6('0x47')]?_0x767eca['attributes']:_0x3b5626[_0xcfd6('0x43')];if(!_0x145f1a[_0xcfd6('0x41')][_0xcfd6('0x48')](_0xcfd6('0x69'))){_0x767eca[_0xcfd6('0x25')]=qs[_0xcfd6('0x25')](_0x145f1a[_0xcfd6('0x41')][_0xcfd6('0x25')]);_0x767eca[_0xcfd6('0x23')]=qs[_0xcfd6('0x23')](_0x145f1a['query']['offset']);}_0x767eca[_0xcfd6('0x64')]=qs[_0xcfd6('0x49')](_0x145f1a[_0xcfd6('0x41')][_0xcfd6('0x49')]);_0x767eca[_0xcfd6('0x4a')]=qs[_0xcfd6('0x42')](_['pick'](_0x145f1a[_0xcfd6('0x41')],_0x3b5626[_0xcfd6('0x42')]));_0x767eca['where'][_0xcfd6('0x65')]=_0x49811c['id'];if(_0x145f1a[_0xcfd6('0x41')][_0xcfd6('0x32')]){_0x767eca[_0xcfd6('0x4a')]=_[_0xcfd6('0x4c')](_0x767eca[_0xcfd6('0x4a')],{'$or':_[_0xcfd6('0x34')](_0x767eca[_0xcfd6('0x44')],function(_0x14b9ca){var _0x4416ee={};_0x4416ee[_0x14b9ca]={'$like':'%'+_0x145f1a['query'][_0xcfd6('0x32')]+'%'};return _0x4416ee;})});}_0x767eca=_[_0xcfd6('0x4c')]({},_0x767eca,_0x145f1a[_0xcfd6('0x4e')]);return db[_0xcfd6('0x68')][_0xcfd6('0x26')]({'where':_0x767eca[_0xcfd6('0x4a')]})[_0xcfd6('0x2c')](function(_0x2e065d){_0x1da5b4[_0xcfd6('0x26')]=_0x2e065d;if(_0x145f1a[_0xcfd6('0x41')][_0xcfd6('0x4f')]){_0x767eca[_0xcfd6('0x54')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x767eca);})[_0xcfd6('0x2c')](function(_0x1ff877){_0x1da5b4[_0xcfd6('0x6a')]=_0x1ff877;return _0x1da5b4;});}})[_0xcfd6('0x2c')](respondWithFilteredResult(_0x235d8f,_0x767eca))[_0xcfd6('0x50')](handleError(_0x235d8f,null));};exports[_0xcfd6('0x6b')]=function(_0x2d9de5,_0x5a2b3f,_0x532ef0){var _0x40ab2e={'raw':!![],'where':{}};var _0x5dd503={};var _0x4b05ed={'count':0x0,'rows':[]};return db[_0xcfd6('0x3e')][_0xcfd6('0x67')]({'where':{'id':_0x2d9de5[_0xcfd6('0x52')]['id']}})[_0xcfd6('0x2c')](handleEntityNotFound(_0x5a2b3f,null))[_0xcfd6('0x2c')](function(_0x1d8e7f){if(_0x1d8e7f){_0x5dd503[_0xcfd6('0x43')]=_['keys'](db[_0xcfd6('0x6c')][_0xcfd6('0x53')]);_0x5dd503['query']=_['keys'](_0x2d9de5[_0xcfd6('0x41')]);_0x5dd503[_0xcfd6('0x42')]=_[_0xcfd6('0x45')](_0x5dd503[_0xcfd6('0x43')],_0x5dd503[_0xcfd6('0x41')]);_0x40ab2e[_0xcfd6('0x44')]=_[_0xcfd6('0x45')](_0x5dd503[_0xcfd6('0x43')],qs['fields'](_0x2d9de5[_0xcfd6('0x41')]['fields']));_0x40ab2e[_0xcfd6('0x44')]=_0x40ab2e['attributes'][_0xcfd6('0x47')]?_0x40ab2e[_0xcfd6('0x44')]:_0x5dd503[_0xcfd6('0x43')];if(!_0x2d9de5[_0xcfd6('0x41')][_0xcfd6('0x48')]('nolimit')){_0x40ab2e[_0xcfd6('0x25')]=qs[_0xcfd6('0x25')](_0x2d9de5[_0xcfd6('0x41')][_0xcfd6('0x25')]);_0x40ab2e[_0xcfd6('0x23')]=qs[_0xcfd6('0x23')](_0x2d9de5['query'][_0xcfd6('0x23')]);}_0x40ab2e[_0xcfd6('0x64')]=qs[_0xcfd6('0x49')](_0x2d9de5[_0xcfd6('0x41')][_0xcfd6('0x49')]);_0x40ab2e['where']=qs[_0xcfd6('0x42')](_['pick'](_0x2d9de5['query'],_0x5dd503[_0xcfd6('0x42')]));_0x40ab2e[_0xcfd6('0x4a')]['VoiceQueueId']=_0x1d8e7f['id'];if(_0x2d9de5[_0xcfd6('0x41')]['filter']){_0x40ab2e[_0xcfd6('0x4a')]=_[_0xcfd6('0x4c')](_0x40ab2e['where'],{'$or':_[_0xcfd6('0x34')](_0x40ab2e[_0xcfd6('0x44')],function(_0x552fb5){var _0x2e3660={};_0x2e3660[_0x552fb5]={'$like':'%'+_0x2d9de5[_0xcfd6('0x41')][_0xcfd6('0x32')]+'%'};return _0x2e3660;})});}_0x40ab2e=_['merge']({},_0x40ab2e,_0x2d9de5[_0xcfd6('0x4e')]);return db[_0xcfd6('0x6c')][_0xcfd6('0x26')]({'where':_0x40ab2e[_0xcfd6('0x4a')]})['then'](function(_0x175376){_0x4b05ed[_0xcfd6('0x26')]=_0x175376;if(_0x2d9de5[_0xcfd6('0x41')][_0xcfd6('0x4f')]){_0x40ab2e['include']=[{'all':!![]}];}return db[_0xcfd6('0x6c')][_0xcfd6('0x6d')](_0x40ab2e);})[_0xcfd6('0x2c')](function(_0x12d997){_0x4b05ed['rows']=_0x12d997;return _0x4b05ed;});}})[_0xcfd6('0x2c')](respondWithFilteredResult(_0x5a2b3f,_0x40ab2e))[_0xcfd6('0x50')](handleError(_0x5a2b3f,null));};exports[_0xcfd6('0x6e')]=function(_0x1615ed,_0x52ecf8,_0x3c12ca){var _0xd739d8={'raw':!![],'where':{}};var _0x5d8a20={};var _0x347537={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x1615ed[_0xcfd6('0x52')]['id']}})[_0xcfd6('0x2c')](handleEntityNotFound(_0x52ecf8,null))[_0xcfd6('0x2c')](function(_0x3c43a2){if(_0x3c43a2){_0x5d8a20[_0xcfd6('0x43')]=_[_0xcfd6('0x40')](db[_0xcfd6('0x6f')][_0xcfd6('0x53')]);_0x5d8a20[_0xcfd6('0x41')]=_[_0xcfd6('0x40')](_0x1615ed[_0xcfd6('0x41')]);_0x5d8a20['filters']=_[_0xcfd6('0x45')](_0x5d8a20['model'],_0x5d8a20[_0xcfd6('0x41')]);_0xd739d8[_0xcfd6('0x44')]=_[_0xcfd6('0x45')](_0x5d8a20[_0xcfd6('0x43')],qs['fields'](_0x1615ed[_0xcfd6('0x41')]['fields']));_0xd739d8[_0xcfd6('0x44')]=_0xd739d8[_0xcfd6('0x44')]['length']?_0xd739d8['attributes']:_0x5d8a20[_0xcfd6('0x43')];if(!_0x1615ed[_0xcfd6('0x41')][_0xcfd6('0x48')](_0xcfd6('0x69'))){_0xd739d8[_0xcfd6('0x25')]=qs[_0xcfd6('0x25')](_0x1615ed[_0xcfd6('0x41')][_0xcfd6('0x25')]);_0xd739d8[_0xcfd6('0x23')]=qs[_0xcfd6('0x23')](_0x1615ed['query'][_0xcfd6('0x23')]);}_0xd739d8[_0xcfd6('0x64')]=qs[_0xcfd6('0x49')](_0x1615ed[_0xcfd6('0x41')][_0xcfd6('0x49')]);_0xd739d8[_0xcfd6('0x4a')]=qs[_0xcfd6('0x42')](_['pick'](_0x1615ed['query'],_0x5d8a20['filters']));_0xd739d8[_0xcfd6('0x4a')]['VoiceQueueId']=_0x3c43a2['id'];if(_0x1615ed[_0xcfd6('0x41')][_0xcfd6('0x32')]){_0xd739d8[_0xcfd6('0x4a')]=_['merge'](_0xd739d8['where'],{'$or':_[_0xcfd6('0x34')](_0xd739d8[_0xcfd6('0x44')],function(_0x1045b3){var _0x1daa63={};_0x1daa63[_0x1045b3]={'$like':'%'+_0x1615ed['query'][_0xcfd6('0x32')]+'%'};return _0x1daa63;})});}_0xd739d8=_['merge']({},_0xd739d8,_0x1615ed['options']);return db['CmHopperBlack'][_0xcfd6('0x26')]({'where':_0xd739d8['where']})[_0xcfd6('0x2c')](function(_0x329c10){_0x347537[_0xcfd6('0x26')]=_0x329c10;if(_0x1615ed['query'][_0xcfd6('0x4f')]){_0xd739d8[_0xcfd6('0x54')]=[{'all':!![]}];}return db[_0xcfd6('0x6f')][_0xcfd6('0x6d')](_0xd739d8);})[_0xcfd6('0x2c')](function(_0x226b15){_0x347537['rows']=_0x226b15;return _0x347537;});}})['then'](respondWithFilteredResult(_0x52ecf8,_0xd739d8))[_0xcfd6('0x50')](handleError(_0x52ecf8,null));};exports[_0xcfd6('0x70')]=function(_0x31630e,_0x352e3e,_0x1ad4dd){var _0x3098f6={};var _0x4c5d5e={};var _0x39a0c9;var _0x286133;return db[_0xcfd6('0x3e')][_0xcfd6('0x67')]({'where':{'id':_0x31630e['params']['id']}})[_0xcfd6('0x2c')](handleEntityNotFound(_0x352e3e,null))[_0xcfd6('0x2c')](function(_0xe949f8){if(_0xe949f8){_0x39a0c9=_0xe949f8;_0x4c5d5e['model']=_[_0xcfd6('0x40')](db['Team'][_0xcfd6('0x53')]);_0x4c5d5e[_0xcfd6('0x41')]=_['keys'](_0x31630e[_0xcfd6('0x41')]);_0x4c5d5e[_0xcfd6('0x42')]=_['intersection'](_0x4c5d5e['model'],_0x4c5d5e[_0xcfd6('0x41')]);_0x3098f6[_0xcfd6('0x44')]=_[_0xcfd6('0x45')](_0x4c5d5e['model'],qs[_0xcfd6('0x46')](_0x31630e[_0xcfd6('0x41')][_0xcfd6('0x46')]));_0x3098f6[_0xcfd6('0x44')]=_0x3098f6[_0xcfd6('0x44')][_0xcfd6('0x47')]?_0x3098f6['attributes']:_0x4c5d5e['model'];_0x3098f6[_0xcfd6('0x64')]=qs['sort'](_0x31630e['query'][_0xcfd6('0x49')]);_0x3098f6[_0xcfd6('0x4a')]=qs[_0xcfd6('0x42')](_[_0xcfd6('0x4b')](_0x31630e['query'],_0x4c5d5e[_0xcfd6('0x42')]));if(_0x31630e[_0xcfd6('0x41')][_0xcfd6('0x32')]){_0x3098f6[_0xcfd6('0x4a')]=_[_0xcfd6('0x4c')](_0x3098f6['where'],{'$or':_['map'](_0x3098f6[_0xcfd6('0x44')],function(_0x55a580){var _0x3eb5ab={};_0x3eb5ab[_0x55a580]={'$like':'%'+_0x31630e[_0xcfd6('0x41')]['filter']+'%'};return _0x3eb5ab;})});}_0x3098f6=_[_0xcfd6('0x4c')]({},_0x3098f6,_0x31630e['options']);return _0x39a0c9['getTeams'](_0x3098f6);}})[_0xcfd6('0x2c')](function(_0x18286f){if(_0x18286f){_0x286133=_0x18286f[_0xcfd6('0x47')];if(!_0x31630e[_0xcfd6('0x41')]['hasOwnProperty'](_0xcfd6('0x69'))){_0x3098f6[_0xcfd6('0x25')]=qs[_0xcfd6('0x25')](_0x31630e['query'][_0xcfd6('0x25')]);_0x3098f6[_0xcfd6('0x23')]=qs[_0xcfd6('0x23')](_0x31630e[_0xcfd6('0x41')][_0xcfd6('0x23')]);}return _0x39a0c9['getTeams'](_0x3098f6);}})[_0xcfd6('0x2c')](function(_0x1f73a5){if(_0x1f73a5){return _0x1f73a5?{'count':_0x286133,'rows':_0x1f73a5}:null;}})[_0xcfd6('0x2c')](respondWithResult(_0x352e3e,null))[_0xcfd6('0x50')](handleError(_0x352e3e,null));};exports['addTeams']=function(_0x66e0c,_0x4383c2,_0x1ffb27){var _0x6db1d9=_0x66e0c[_0xcfd6('0x60')][_0xcfd6('0x71')];var _0x5b347c=_[_0xcfd6('0x34')](_0x6db1d9,'id');return db[_0xcfd6('0x72')]['findAll']({'where':{'id':_0x5b347c},'attributes':['id'],'include':[{'model':db[_0xcfd6('0x73')],'as':_0xcfd6('0x74'),'attributes':['id',_0xcfd6('0x38'),_0xcfd6('0x75'),_0xcfd6('0x76'),_0xcfd6('0x77')],'raw':!![]}]})[_0xcfd6('0x2c')](function(_0x55cd13){if(_0x55cd13){var _0x32a894=_[_0xcfd6('0x78')](_0x55cd13,function(_0x19c2fb){var _0x660dbb=_0x19c2fb[_0xcfd6('0x2e')]({'plain':!![]});_0x660dbb[_0xcfd6('0x74')]['forEach'](function(_0x2d8f28){_0x2d8f28['penalty']=_[_0xcfd6('0x37')](_0x6db1d9,{'id':_0x660dbb['id']})[_0xcfd6('0x79')];});return _0x660dbb['Agents'];});return db[_0xcfd6('0x3e')][_0xcfd6('0x37')]({'where':{'id':_0x66e0c['params']['id']}})[_0xcfd6('0x2c')](function(_0x572277){return db[_0xcfd6('0x7a')][_0xcfd6('0x7b')](function(_0x36bdd2){return _0x572277[_0xcfd6('0x7c')](_0x5b347c,{'transaction':_0x36bdd2})[_0xcfd6('0x2c')](function(){return BPromise[_0xcfd6('0x7d')](_0x6db1d9,function(_0x116c37){return db[_0xcfd6('0x7e')][_0xcfd6('0x7f')]({'TeamId':_0x116c37['id'],'VoiceQueueId':_0x66e0c[_0xcfd6('0x52')]['id'],'penalty':_0x116c37[_0xcfd6('0x79')]},{'transaction':_0x36bdd2});});})[_0xcfd6('0x2c')](function(){return BPromise[_0xcfd6('0x7d')](_0x32a894,function(_0x4d58d3){return db[_0xcfd6('0x80')]['findOrCreate']({'where':{'UserId':_0x4d58d3['id'],'VoiceQueueId':_0x66e0c[_0xcfd6('0x52')]['id']},'defaults':{'penalty':_0x4d58d3[_0xcfd6('0x79')]},'transaction':_0x36bdd2});});})['then'](function(){return BPromise[_0xcfd6('0x7d')](_[_0xcfd6('0x32')](_0x32a894,{'online':!![]}),function(_0x58ec6a){return db['UserVoiceQueueRt']['upsert']({'membername':_0x58ec6a['name'],'UserId':_0x58ec6a['id'],'queue_name':_0x572277[_0xcfd6('0x38')],'VoiceQueueId':_0x572277['id'],'interface':_[_0xcfd6('0x81')](_0x58ec6a[_0xcfd6('0x77')])?util[_0xcfd6('0x82')](_0xcfd6('0x83'),_0x58ec6a[_0xcfd6('0x38')]):_0x58ec6a['interface'],'paused':_0x58ec6a[_0xcfd6('0x76')]||![],'penalty':_0x58ec6a['penalty']},{'transaction':_0x36bdd2});});})['then'](function(){_0x32a894[_0xcfd6('0x84')](function(_0x3b962d){socket['emit'](_0xcfd6('0x85'),{'UserId':_0x3b962d['id'],'VoiceQueueId':_0x572277['id']});});});});});}})['then'](respondWithStatusCode(_0x4383c2,null))[_0xcfd6('0x50')](handleError(_0x4383c2,null));};exports[_0xcfd6('0x86')]=function(_0x115459,_0x544b00,_0x1bf7ba){return db[_0xcfd6('0x72')]['findAll']({'where':{'id':_0x115459[_0xcfd6('0x41')][_0xcfd6('0x87')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xcfd6('0x74'),'attributes':['id'],'raw':!![]}]})[_0xcfd6('0x2c')](handleEntityNotFound(_0x544b00,null))[_0xcfd6('0x2c')](function(_0x40cc06){var _0xad17dd=_[_0xcfd6('0x34')](_0x40cc06,'id');var _0x581736=[];var _0x47987f=[];var _0x249f99=squel[_0xcfd6('0x88')]();_0x249f99[_0xcfd6('0x89')](_0xcfd6('0x8a'))[_0xcfd6('0x8b')]('team_has_voice_queues','tq')['join'](_0xcfd6('0x8c'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xcfd6('0x4a')](_0xcfd6('0x8d'),_0x115459['params']['id']);for(var _0x2eea69=0x0;_0x2eea69<_0x40cc06['length'];_0x2eea69+=0x1){let _0x48e68e=_0x40cc06[_0x2eea69];for(var _0x87d4ab=0x0;_0x87d4ab<_0x48e68e[_0xcfd6('0x74')]['length'];_0x87d4ab+=0x1){let _0x59cb85=_0x48e68e[_0xcfd6('0x74')][_0x87d4ab];var _0xff41ef=_0x249f99[_0xcfd6('0x5c')]();_0xff41ef[_0xcfd6('0x4a')](_0xcfd6('0x8e'),_0x59cb85['id']);_0x47987f[_0xcfd6('0x8f')](db[_0xcfd6('0x7a')][_0xcfd6('0x41')](_0xff41ef[_0xcfd6('0x90')](),{'type':db[_0xcfd6('0x7a')][_0xcfd6('0x91')][_0xcfd6('0x92')]})[_0xcfd6('0x2c')](function(_0x5d7a7e){if(_0x5d7a7e[_0xcfd6('0x47')]===0x1){return _0x59cb85['id'];}else{var _0x122c05=_['every'](_[_0xcfd6('0x34')](_0x5d7a7e,_0xcfd6('0x93')),function(_0x4e3460){return _[_0xcfd6('0x94')](_0xad17dd,_0x4e3460);});if(_0x122c05){return _0x59cb85['id'];}}}));}}return BPromise[_0xcfd6('0x95')](_0x47987f)['then'](function(_0x14bec6){_0x581736=_(_0x581736)[_0xcfd6('0x96')](_0x14bec6)[_0xcfd6('0x97')]()[_0xcfd6('0x35')]();return db[_0xcfd6('0x3e')][_0xcfd6('0x37')]({'where':{'id':_0x115459[_0xcfd6('0x52')]['id']}})[_0xcfd6('0x2c')](function(_0x52e1ac){return db[_0xcfd6('0x7a')][_0xcfd6('0x7b')](function(_0x2ec88a){return _0x52e1ac[_0xcfd6('0x86')](_0x115459[_0xcfd6('0x41')][_0xcfd6('0x87')],{'transaction':_0x2ec88a})['then'](function(){if(!_['isEmpty'](_0x581736)){return _0x52e1ac[_0xcfd6('0x98')](_0x581736,{'transaction':_0x2ec88a})[_0xcfd6('0x2c')](function(){return db[_0xcfd6('0x99')][_0xcfd6('0x2d')]({'where':{'VoiceQueueId':_0x115459[_0xcfd6('0x52')]['id'],'UserId':_0x581736},'transaction':_0x2ec88a});});}})[_0xcfd6('0x2c')](function(){_0x581736[_0xcfd6('0x84')](function(_0x5d48d8){socket['emit'](_0xcfd6('0x9a'),{'UserId':_0x5d48d8,'VoiceQueueId':_0x52e1ac['id']});});});});});});})[_0xcfd6('0x2c')](respondWithStatusCode(_0x544b00,null))[_0xcfd6('0x50')](handleError(_0x544b00,null));};exports[_0xcfd6('0x9b')]=function(_0x1dd6e3,_0x2ba4f5,_0x186229){var _0x6f5f83,_0x333008;return db[_0xcfd6('0x3e')][_0xcfd6('0x37')]({'where':{'id':_0x1dd6e3['params']['id']}})['then'](handleEntityNotFound(_0x2ba4f5,null))['then'](function(_0xf13cc0){if(_0xf13cc0){_0x333008=_0xf13cc0;return _0xf13cc0[_0xcfd6('0x9b')](_0x1dd6e3[_0xcfd6('0x60')][_0xcfd6('0x87')],_[_0xcfd6('0x5d')](_0x1dd6e3[_0xcfd6('0x60')],[_0xcfd6('0x87'),'id'])||{})['spread'](function(_0x56cd26){for(var _0x45c1f7=0x0;_0x45c1f7<_0x1dd6e3[_0xcfd6('0x60')][_0xcfd6('0x87')][_0xcfd6('0x47')];_0x45c1f7+=0x1){socket['emit'](_0xcfd6('0x85'),{'UserId':Number(_0x1dd6e3[_0xcfd6('0x60')]['ids'][_0x45c1f7]),'VoiceQueueId':Number(_0x1dd6e3[_0xcfd6('0x52')]['id'])});}return _0x56cd26;});}})[_0xcfd6('0x2c')](function(_0x27bacd){_0x6f5f83=_0x27bacd||[];if(_0x333008){return db[_0xcfd6('0x73')][_0xcfd6('0x6d')]({'where':{'id':_0x1dd6e3[_0xcfd6('0x60')][_0xcfd6('0x87')]},'attributes':['id',_0xcfd6('0x38'),'online',_0xcfd6('0x76'),_0xcfd6('0x77')],'raw':!![]});}})[_0xcfd6('0x2c')](function(_0x3d23ce){if(!_[_0xcfd6('0x9c')](_0x3d23ce)){var _0x38cff2=[];for(var _0x4823d2=0x0;_0x4823d2<_0x3d23ce['length'];_0x4823d2++){if(_0x3d23ce[_0x4823d2][_0xcfd6('0x75')]){_0x38cff2[_0xcfd6('0x8f')](db['UserVoiceQueueRt']['upsert']({'membername':_0x3d23ce[_0x4823d2][_0xcfd6('0x38')],'UserId':_0x3d23ce[_0x4823d2]['id'],'queue_name':_0x333008[_0xcfd6('0x38')],'VoiceQueueId':_0x333008['id'],'interface':_['isNil'](_0x3d23ce[_0x4823d2][_0xcfd6('0x77')])?util[_0xcfd6('0x82')](_0xcfd6('0x83'),_0x3d23ce[_0x4823d2][_0xcfd6('0x38')]):_0x3d23ce[_0x4823d2][_0xcfd6('0x77')],'paused':_0x3d23ce[_0x4823d2]['voicePause']||![],'penalty':_0x1dd6e3[_0xcfd6('0x60')][_0xcfd6('0x79')]||0x0}));}}return BPromise[_0xcfd6('0x95')](_0x38cff2);}})[_0xcfd6('0x2c')](function(){return _0x6f5f83;})['then'](respondWithResult(_0x2ba4f5,null))[_0xcfd6('0x50')](handleError(_0x2ba4f5,null));};exports[_0xcfd6('0x98')]=function(_0x3dbb82,_0x4108de,_0x31f3ac){return db[_0xcfd6('0x3e')][_0xcfd6('0x37')]({'where':{'id':_0x3dbb82['params']['id']}})[_0xcfd6('0x2c')](handleEntityNotFound(_0x4108de,null))[_0xcfd6('0x2c')](function(_0x4be297){if(_0x4be297){return _0x4be297[_0xcfd6('0x98')](_0x3dbb82[_0xcfd6('0x41')][_0xcfd6('0x87')])[_0xcfd6('0x2c')](function(){if(_[_0xcfd6('0x9d')](_0x3dbb82[_0xcfd6('0x41')]['ids'])){for(var _0x578cdc=0x0;_0x578cdc<_0x3dbb82['query'][_0xcfd6('0x87')]['length'];_0x578cdc+=0x1){socket[_0xcfd6('0x9e')]('userVoiceQueue:remove',{'UserId':Number(_0x3dbb82[_0xcfd6('0x41')]['ids'][_0x578cdc]),'VoiceQueueId':Number(_0x3dbb82[_0xcfd6('0x52')]['id'])});}}else{socket[_0xcfd6('0x9e')](_0xcfd6('0x9a'),{'UserId':Number(_0x3dbb82[_0xcfd6('0x41')]['ids']),'VoiceQueueId':Number(_0x3dbb82[_0xcfd6('0x52')]['id'])});}});}})[_0xcfd6('0x2c')](function(_0xd2b252){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x3dbb82[_0xcfd6('0x52')]['id'],'UserId':_0x3dbb82['query'][_0xcfd6('0x87')]}})[_0xcfd6('0x2c')](function(){return _0xd2b252;});})[_0xcfd6('0x2c')](respondWithStatusCode(_0x4108de,null))['catch'](handleError(_0x4108de,null));};exports[_0xcfd6('0x9f')]=function(_0x2f11d8,_0xbd4f73,_0x19ab32){var _0x350a77={};var _0x210f81={};var _0x403a1e;var _0x399bc2;return db[_0xcfd6('0x3e')]['findOne']({'where':{'id':_0x2f11d8[_0xcfd6('0x52')]['id']}})[_0xcfd6('0x2c')](handleEntityNotFound(_0xbd4f73,null))[_0xcfd6('0x2c')](function(_0x3588b4){if(_0x3588b4){_0x403a1e=_0x3588b4;_0x210f81[_0xcfd6('0x43')]=_[_0xcfd6('0x40')](db['User'][_0xcfd6('0x53')]);_0x210f81[_0xcfd6('0x41')]=_[_0xcfd6('0x40')](_0x2f11d8[_0xcfd6('0x41')]);_0x210f81[_0xcfd6('0x42')]=_[_0xcfd6('0x45')](_0x210f81[_0xcfd6('0x43')],_0x210f81[_0xcfd6('0x41')]);_0x350a77[_0xcfd6('0x44')]=_[_0xcfd6('0x45')](_0x210f81['model'],qs[_0xcfd6('0x46')](_0x2f11d8[_0xcfd6('0x41')][_0xcfd6('0x46')]));_0x350a77[_0xcfd6('0x44')]=_0x350a77[_0xcfd6('0x44')][_0xcfd6('0x47')]?_0x350a77['attributes']:_0x210f81[_0xcfd6('0x43')];_0x350a77[_0xcfd6('0x64')]=qs[_0xcfd6('0x49')](_0x2f11d8[_0xcfd6('0x41')]['sort']);_0x350a77['where']=qs[_0xcfd6('0x42')](_[_0xcfd6('0x4b')](_0x2f11d8['query'],_0x210f81[_0xcfd6('0x42')]));if(_0x2f11d8[_0xcfd6('0x41')]['filter']){_0x350a77[_0xcfd6('0x4a')]=_[_0xcfd6('0x4c')](_0x350a77['where'],{'$or':_[_0xcfd6('0x34')](_0x350a77[_0xcfd6('0x44')],function(_0xe6b3a2){var _0x4f2535={};_0x4f2535[_0xe6b3a2]={'$like':'%'+_0x2f11d8[_0xcfd6('0x41')][_0xcfd6('0x32')]+'%'};return _0x4f2535;})});}_0x350a77=_[_0xcfd6('0x4c')]({},_0x350a77,_0x2f11d8[_0xcfd6('0x4e')]);return _0x403a1e[_0xcfd6('0x9f')](_0x350a77);}})[_0xcfd6('0x2c')](function(_0x23f205){if(_0x23f205){_0x399bc2=_0x23f205[_0xcfd6('0x47')];if(!_0x2f11d8[_0xcfd6('0x41')]['hasOwnProperty'](_0xcfd6('0x69'))){_0x350a77['limit']=qs[_0xcfd6('0x25')](_0x2f11d8[_0xcfd6('0x41')][_0xcfd6('0x25')]);_0x350a77[_0xcfd6('0x23')]=qs[_0xcfd6('0x23')](_0x2f11d8['query']['offset']);}return _0x403a1e['getAgents'](_0x350a77);}})[_0xcfd6('0x2c')](function(_0x1d09cc){if(_0x1d09cc){return _0x1d09cc?{'count':_0x399bc2,'rows':_0x1d09cc}:null;}})['then'](respondWithResult(_0xbd4f73,null))['catch'](handleError(_0xbd4f73,null));};exports[_0xcfd6('0xa0')]=function(_0x3a108f,_0x5840c5,_0x2432b0){var _0x821b8d={};var _0x2c77b6={};var _0x38b86e;var _0x4e6cf9;return db[_0xcfd6('0x3e')][_0xcfd6('0x67')]({'where':{'id':_0x3a108f[_0xcfd6('0x52')]['id']}})[_0xcfd6('0x2c')](handleEntityNotFound(_0x5840c5,null))[_0xcfd6('0x2c')](function(_0x2d3a10){if(_0x2d3a10){_0x38b86e=_0x2d3a10;_0x2c77b6[_0xcfd6('0x43')]=_['keys'](db[_0xcfd6('0x99')][_0xcfd6('0x53')]);_0x2c77b6[_0xcfd6('0x41')]=_[_0xcfd6('0x40')](_0x3a108f['query']);_0x2c77b6['filters']=_['intersection'](_0x2c77b6[_0xcfd6('0x43')],_0x2c77b6[_0xcfd6('0x41')]);_0x821b8d[_0xcfd6('0x44')]=_[_0xcfd6('0x45')](_0x2c77b6[_0xcfd6('0x43')],qs[_0xcfd6('0x46')](_0x3a108f[_0xcfd6('0x41')][_0xcfd6('0x46')]));_0x821b8d['attributes']=_0x821b8d[_0xcfd6('0x44')][_0xcfd6('0x47')]?_0x821b8d[_0xcfd6('0x44')]:_0x2c77b6['model'];_0x821b8d[_0xcfd6('0x64')]=qs[_0xcfd6('0x49')](_0x3a108f[_0xcfd6('0x41')]['sort']);_0x821b8d[_0xcfd6('0x4a')]=qs[_0xcfd6('0x42')](_[_0xcfd6('0x4b')](_0x3a108f['query'],_0x2c77b6['filters']));if(_0x3a108f[_0xcfd6('0x41')][_0xcfd6('0x32')]){_0x821b8d[_0xcfd6('0x4a')]=_[_0xcfd6('0x4c')](_0x821b8d[_0xcfd6('0x4a')],{'$or':_[_0xcfd6('0x34')](_0x821b8d[_0xcfd6('0x44')],function(_0x4447f3){var _0x27b8fc={};_0x27b8fc[_0x4447f3]={'$like':'%'+_0x3a108f[_0xcfd6('0x41')]['filter']+'%'};return _0x27b8fc;})});}_0x821b8d=_[_0xcfd6('0x4c')]({},_0x821b8d,_0x3a108f[_0xcfd6('0x4e')]);return _0x38b86e['getMembers'](_0x821b8d);}})['then'](function(_0x4df0a7){if(_0x4df0a7){_0x4e6cf9=_0x4df0a7[_0xcfd6('0x47')];if(!_0x3a108f['query'][_0xcfd6('0x48')](_0xcfd6('0x69'))){_0x821b8d['limit']=qs['limit'](_0x3a108f[_0xcfd6('0x41')]['limit']);_0x821b8d[_0xcfd6('0x23')]=qs[_0xcfd6('0x23')](_0x3a108f[_0xcfd6('0x41')][_0xcfd6('0x23')]);}return _0x38b86e[_0xcfd6('0xa0')](_0x821b8d);}})[_0xcfd6('0x2c')](function(_0x2e7e4c){return _0x2e7e4c?{'count':_0x4e6cf9,'rows':_0x2e7e4c}:null;})[_0xcfd6('0x2c')](respondWithResult(_0x5840c5,null))[_0xcfd6('0x50')](handleError(_0x5840c5,null));};exports[_0xcfd6('0xa1')]=function(_0x8a51c7,_0x25ef88,_0x5e6b92){var _0x13b56e={};var _0x1b1e92={};var _0x5edf3d;var _0x4e12df;return db[_0xcfd6('0x3e')][_0xcfd6('0x67')]({'where':{'id':_0x8a51c7[_0xcfd6('0x52')]['id']}})[_0xcfd6('0x2c')](handleEntityNotFound(_0x25ef88,null))[_0xcfd6('0x2c')](function(_0x4721f7){if(_0x4721f7){_0x5edf3d=_0x4721f7;_0x1b1e92['model']=_[_0xcfd6('0x40')](db[_0xcfd6('0xa2')][_0xcfd6('0x53')]);_0x1b1e92['query']=_[_0xcfd6('0x40')](_0x8a51c7['query']);_0x1b1e92[_0xcfd6('0x42')]=_['intersection'](_0x1b1e92[_0xcfd6('0x43')],_0x1b1e92[_0xcfd6('0x41')]);_0x13b56e[_0xcfd6('0x44')]=_[_0xcfd6('0x45')](_0x1b1e92[_0xcfd6('0x43')],qs['fields'](_0x8a51c7[_0xcfd6('0x41')][_0xcfd6('0x46')]));_0x13b56e[_0xcfd6('0x44')]=_0x13b56e[_0xcfd6('0x44')][_0xcfd6('0x47')]?_0x13b56e[_0xcfd6('0x44')]:_0x1b1e92['model'];_0x13b56e[_0xcfd6('0x64')]=qs[_0xcfd6('0x49')](_0x8a51c7[_0xcfd6('0x41')][_0xcfd6('0x49')]);_0x13b56e['where']=qs[_0xcfd6('0x42')](_[_0xcfd6('0x4b')](_0x8a51c7[_0xcfd6('0x41')],_0x1b1e92[_0xcfd6('0x42')]));if(_0x8a51c7[_0xcfd6('0x41')][_0xcfd6('0x32')]){_0x13b56e['where']=_[_0xcfd6('0x4c')](_0x13b56e[_0xcfd6('0x4a')],{'$or':_[_0xcfd6('0x34')](_0x13b56e[_0xcfd6('0x44')],function(_0x5bff39){var _0x4bf06c={};_0x4bf06c[_0x5bff39]={'$like':'%'+_0x8a51c7[_0xcfd6('0x41')]['filter']+'%'};return _0x4bf06c;})});}_0x13b56e=_['merge']({},_0x13b56e,_0x8a51c7['options']);return _0x5edf3d[_0xcfd6('0xa1')](_0x13b56e);}})[_0xcfd6('0x2c')](function(_0xe1ca44){if(_0xe1ca44){_0x4e12df=_0xe1ca44[_0xcfd6('0x47')];if(!_0x8a51c7[_0xcfd6('0x41')][_0xcfd6('0x48')](_0xcfd6('0x69'))){_0x13b56e[_0xcfd6('0x25')]=qs['limit'](_0x8a51c7[_0xcfd6('0x41')]['limit']);_0x13b56e[_0xcfd6('0x23')]=qs[_0xcfd6('0x23')](_0x8a51c7[_0xcfd6('0x41')]['offset']);}return _0x5edf3d['getLists'](_0x13b56e);}})['then'](function(_0x2953e1){if(_0x2953e1){return _0x2953e1?{'count':_0x4e12df,'rows':_0x2953e1}:null;}})[_0xcfd6('0x2c')](respondWithResult(_0x25ef88,null))[_0xcfd6('0x50')](handleError(_0x25ef88,null));};exports[_0xcfd6('0xa3')]=function(_0x4feb9e,_0x625c06,_0x3995cb){var _0x12a1e0,_0x4e5d6c;return db['VoiceQueue'][_0xcfd6('0x37')]({'where':{'id':_0x4feb9e['params']['id']}})['then'](handleEntityNotFound(_0x625c06,null))[_0xcfd6('0x2c')](function(_0x5c4119){if(_0x5c4119){_0x4e5d6c=_0x5c4119;return _0x5c4119[_0xcfd6('0xa3')](_0x4feb9e[_0xcfd6('0x60')][_0xcfd6('0x87')],_['omit'](_0x4feb9e[_0xcfd6('0x60')],['ids','id'])||{});}return null;})['spread'](function(_0x2f5ebc){var _0x4f8f9f;_0x12a1e0=_0x2f5ebc||[];var _0x468f95=[];if(_0x2f5ebc){for(var _0x126b26=0x0;_0x126b26<_0x2f5ebc[_0xcfd6('0x47')];_0x126b26+=0x1){var _0x4fb152=_0x2f5ebc[_0x126b26][_0xcfd6('0x2e')]({'plain':!![]});_0x4e5d6c[_0xcfd6('0xa4')]=_0x4feb9e[_0xcfd6('0x60')]['dialCheckDuplicateType']?_0x4feb9e[_0xcfd6('0x60')]['dialCheckDuplicateType']:_0x4e5d6c['dialCheckDuplicateType'];switch(_0x4e5d6c[_0xcfd6('0xa4')]){case'always':_0x4f8f9f=squel[_0xcfd6('0xa5')]()[_0xcfd6('0xa6')](_0xcfd6('0xa7'))[_0xcfd6('0xa8')]([_0xcfd6('0xa9'),_0xcfd6('0xaa'),'ContactId',_0xcfd6('0xab'),_0xcfd6('0x65'),_0xcfd6('0x5e'),_0xcfd6('0x5f')],squel[_0xcfd6('0x88')]()[_0xcfd6('0x89')](_0xcfd6('0xa9'),_0xcfd6('0xa9'))[_0xcfd6('0x89')](_0xcfd6('0xac'),_0xcfd6('0xaa'))[_0xcfd6('0x89')]('id',_0xcfd6('0xad'))[_0xcfd6('0x89')](_0x4fb152[_0xcfd6('0xae')][_0xcfd6('0x90')](),_0xcfd6('0xab'))[_0xcfd6('0x89')](_0x4feb9e[_0xcfd6('0x52')]['id'][_0xcfd6('0x90')](),_0xcfd6('0x65'))[_0xcfd6('0x89')](_0xcfd6('0xac'),_0xcfd6('0x5e'))[_0xcfd6('0x89')](_0xcfd6('0xac'),_0xcfd6('0x5f'))[_0xcfd6('0x8b')]('cm_contacts')['where'](_0xcfd6('0xaf'))[_0xcfd6('0x4a')](_0xcfd6('0xb0'),_0x4fb152['CmListId']['toString']())[_0xcfd6('0x4a')](_0xcfd6('0xb1'))[_0xcfd6('0x4a')](_0xcfd6('0xb2'),squel[_0xcfd6('0x88')]()[_0xcfd6('0x89')]('COALESCE(calleridnum,\x27\x27)')[_0xcfd6('0x8b')](_0xcfd6('0xb3'))[_0xcfd6('0x4a')](_0xcfd6('0x8d'),_0x4feb9e[_0xcfd6('0x52')]['id'][_0xcfd6('0x90')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xcfd6('0x88')]()['field'](_0xcfd6('0xb4'))['from'](_0xcfd6('0xa7'))[_0xcfd6('0x4a')](_0xcfd6('0x8d'),_0x4feb9e[_0xcfd6('0x52')]['id'][_0xcfd6('0x90')]())))[_0xcfd6('0x90')]();break;case _0xcfd6('0xb5'):_0x4f8f9f=squel[_0xcfd6('0xa5')]()[_0xcfd6('0xa6')](_0xcfd6('0xa7'))[_0xcfd6('0xa8')]([_0xcfd6('0xa9'),_0xcfd6('0xaa'),'ContactId','ListId','VoiceQueueId',_0xcfd6('0x5e'),_0xcfd6('0x5f')],squel[_0xcfd6('0x88')]()[_0xcfd6('0x89')](_0xcfd6('0xa9'),'phone')[_0xcfd6('0x89')](_0xcfd6('0xac'),'scheduledAt')['field']('id',_0xcfd6('0xad'))['field'](_0x4fb152[_0xcfd6('0xae')]['toString'](),_0xcfd6('0xab'))[_0xcfd6('0x89')](_0x4feb9e[_0xcfd6('0x52')]['id']['toString'](),'VoiceQueueId')['field'](_0xcfd6('0xac'),_0xcfd6('0x5e'))[_0xcfd6('0x89')](_0xcfd6('0xac'),_0xcfd6('0x5f'))[_0xcfd6('0x8b')]('cm_contacts')['where'](_0xcfd6('0xaf'))[_0xcfd6('0x4a')]('ListId\x20=\x20?',_0x4fb152[_0xcfd6('0xae')][_0xcfd6('0x90')]())[_0xcfd6('0x4a')](_0xcfd6('0xb1'))[_0xcfd6('0x4a')](_0xcfd6('0xb2'),squel[_0xcfd6('0x88')]()['field']('COALESCE(phone,\x27\x27)')['from'](_0xcfd6('0xa7'))['where'](_0xcfd6('0x8d'),_0x4feb9e[_0xcfd6('0x52')]['id'][_0xcfd6('0x90')]())))[_0xcfd6('0x90')]();break;default:_0x4f8f9f=squel[_0xcfd6('0xa5')]()[_0xcfd6('0xa6')](_0xcfd6('0xa7'))[_0xcfd6('0xa8')]([_0xcfd6('0xa9'),'scheduledAt','ContactId','ListId','VoiceQueueId',_0xcfd6('0x5e'),_0xcfd6('0x5f')],squel['select']()[_0xcfd6('0x89')](_0xcfd6('0xa9'),_0xcfd6('0xa9'))[_0xcfd6('0x89')](_0xcfd6('0xac'),'scheduledAt')[_0xcfd6('0x89')]('id',_0xcfd6('0xad'))['field'](_0x4fb152['CmListId'][_0xcfd6('0x90')](),_0xcfd6('0xab'))[_0xcfd6('0x89')](_0x4feb9e[_0xcfd6('0x52')]['id']['toString'](),_0xcfd6('0x65'))[_0xcfd6('0x89')](_0xcfd6('0xac'),_0xcfd6('0x5e'))['field']('NOW()','updatedAt')[_0xcfd6('0x8b')](_0xcfd6('0xb6'))[_0xcfd6('0x4a')](_0xcfd6('0xaf'))[_0xcfd6('0x4a')](_0xcfd6('0xb0'),_0x4fb152[_0xcfd6('0xae')][_0xcfd6('0x90')]())['where'](_0xcfd6('0xb1')))[_0xcfd6('0x90')]();}_0x468f95[_0xcfd6('0x8f')](db[_0xcfd6('0x7a')][_0xcfd6('0x41')](_0x4f8f9f));}return BPromise[_0xcfd6('0x95')](_0x468f95);}})['then'](function(){return _0x12a1e0;})[_0xcfd6('0x2c')](respondWithResult(_0x625c06,null))[_0xcfd6('0x50')](handleError(_0x625c06,null));};exports[_0xcfd6('0xb7')]=function(_0x4fc0e3,_0x4f11bc,_0x2ca2ca){return db['VoiceQueue'][_0xcfd6('0x37')]({'where':{'id':_0x4fc0e3[_0xcfd6('0x52')]['id']}})[_0xcfd6('0x2c')](handleEntityNotFound(_0x4f11bc,null))[_0xcfd6('0x2c')](function(_0xd12379){if(_0xd12379){return _0xd12379[_0xcfd6('0xb7')](_0x4fc0e3[_0xcfd6('0x41')][_0xcfd6('0x87')]);}})[_0xcfd6('0x2c')](function(_0x53e6e5){if(_0x53e6e5){return db['CmHopper'][_0xcfd6('0x2d')]({'where':{'ListId':_0x4fc0e3[_0xcfd6('0x41')]['ids'],'VoiceQueueId':_0x4fc0e3['params']['id']}})[_0xcfd6('0x2c')](function(){return _0x53e6e5;});}})[_0xcfd6('0x2c')](respondWithStatusCode(_0x4f11bc,null))[_0xcfd6('0x50')](handleError(_0x4f11bc,null));};exports[_0xcfd6('0xb8')]=function(_0xd17594,_0x3b51a6,_0x40fa39){var _0x35e6b2={};var _0x2a2074={};var _0xefeb0b;var _0x430c9f;return db['VoiceQueue'][_0xcfd6('0x67')]({'where':{'id':_0xd17594[_0xcfd6('0x52')]['id']}})[_0xcfd6('0x2c')](handleEntityNotFound(_0x3b51a6,null))[_0xcfd6('0x2c')](function(_0xb26fa){if(_0xb26fa){_0xefeb0b=_0xb26fa;_0x2a2074[_0xcfd6('0x43')]=_[_0xcfd6('0x40')](db['CmList']['rawAttributes']);_0x2a2074['query']=_[_0xcfd6('0x40')](_0xd17594[_0xcfd6('0x41')]);_0x2a2074['filters']=_[_0xcfd6('0x45')](_0x2a2074[_0xcfd6('0x43')],_0x2a2074[_0xcfd6('0x41')]);_0x35e6b2[_0xcfd6('0x44')]=_[_0xcfd6('0x45')](_0x2a2074[_0xcfd6('0x43')],qs[_0xcfd6('0x46')](_0xd17594[_0xcfd6('0x41')][_0xcfd6('0x46')]));_0x35e6b2[_0xcfd6('0x44')]=_0x35e6b2[_0xcfd6('0x44')]['length']?_0x35e6b2[_0xcfd6('0x44')]:_0x2a2074[_0xcfd6('0x43')];_0x35e6b2[_0xcfd6('0x64')]=qs[_0xcfd6('0x49')](_0xd17594[_0xcfd6('0x41')]['sort']);_0x35e6b2['where']=qs[_0xcfd6('0x42')](_[_0xcfd6('0x4b')](_0xd17594[_0xcfd6('0x41')],_0x2a2074[_0xcfd6('0x42')]));if(_0xd17594[_0xcfd6('0x41')][_0xcfd6('0x32')]){_0x35e6b2[_0xcfd6('0x4a')]=_[_0xcfd6('0x4c')](_0x35e6b2[_0xcfd6('0x4a')],{'$or':_[_0xcfd6('0x34')](_0x35e6b2[_0xcfd6('0x44')],function(_0x42794f){var _0x2c4671={};_0x2c4671[_0x42794f]={'$like':'%'+_0xd17594['query']['filter']+'%'};return _0x2c4671;})});}_0x35e6b2=_[_0xcfd6('0x4c')]({},_0x35e6b2,_0xd17594[_0xcfd6('0x4e')]);return _0xefeb0b[_0xcfd6('0xb8')](_0x35e6b2);}})[_0xcfd6('0x2c')](function(_0x32a903){if(_0x32a903){_0x430c9f=_0x32a903['length'];if(!_0xd17594[_0xcfd6('0x41')]['hasOwnProperty'](_0xcfd6('0x69'))){_0x35e6b2[_0xcfd6('0x25')]=qs[_0xcfd6('0x25')](_0xd17594[_0xcfd6('0x41')][_0xcfd6('0x25')]);_0x35e6b2[_0xcfd6('0x23')]=qs[_0xcfd6('0x23')](_0xd17594[_0xcfd6('0x41')][_0xcfd6('0x23')]);}return _0xefeb0b[_0xcfd6('0xb8')](_0x35e6b2);}})[_0xcfd6('0x2c')](function(_0x46afa5){if(_0x46afa5){return _0x46afa5?{'count':_0x430c9f,'rows':_0x46afa5}:null;}})['then'](respondWithResult(_0x3b51a6,null))['catch'](handleError(_0x3b51a6,null));};exports[_0xcfd6('0xb9')]=function(_0x13627d,_0x522ea4,_0x23cdbc){var _0x51c465,_0x1a7f11;return db['VoiceQueue']['find']({'where':{'id':_0x13627d[_0xcfd6('0x52')]['id']}})[_0xcfd6('0x2c')](handleEntityNotFound(_0x522ea4,null))[_0xcfd6('0x2c')](function(_0x43eff3){if(_0x43eff3){_0x1a7f11=_0x43eff3;return _0x43eff3[_0xcfd6('0xb9')](_0x13627d[_0xcfd6('0x60')][_0xcfd6('0x87')],_[_0xcfd6('0x5d')](_0x13627d['body'],[_0xcfd6('0x87'),'id'])||{});}return null;})[_0xcfd6('0xba')](function(_0x2a8f3a){var _0x362748;_0x51c465=_0x2a8f3a||[];var _0x38b86f=[];if(_0x2a8f3a){for(var _0x2a9ab9=0x0;_0x2a9ab9<_0x2a8f3a['length'];_0x2a9ab9+=0x1){var _0x33703f=_0x2a8f3a[_0x2a9ab9][_0xcfd6('0x2e')]({'plain':!![]});_0x362748=squel[_0xcfd6('0xa5')]()[_0xcfd6('0xa6')](_0xcfd6('0xbb'))[_0xcfd6('0xa8')](['phone',_0xcfd6('0xad'),_0xcfd6('0xab'),_0xcfd6('0x65'),'createdAt',_0xcfd6('0x5f')],squel['select']()[_0xcfd6('0x89')](_0xcfd6('0xa9'),'phone')[_0xcfd6('0x89')]('id',_0xcfd6('0xad'))['field'](_0x33703f[_0xcfd6('0xae')][_0xcfd6('0x90')](),_0xcfd6('0xab'))[_0xcfd6('0x89')](_0x13627d[_0xcfd6('0x52')]['id'][_0xcfd6('0x90')](),_0xcfd6('0x65'))['field'](_0xcfd6('0xac'),'createdAt')['field'](_0xcfd6('0xac'),_0xcfd6('0x5f'))[_0xcfd6('0x8b')]('cm_contacts')[_0xcfd6('0x4a')]('deletedAt\x20IS\x20NULL')[_0xcfd6('0x4a')](_0xcfd6('0xb0'),_0x33703f['CmListId'][_0xcfd6('0x90')]())[_0xcfd6('0x4a')]('phone\x20IS\x20NOT\x20NULL'))[_0xcfd6('0x90')]();_0x38b86f['push'](db['sequelize'][_0xcfd6('0x41')](_0x362748));}return BPromise['all'](_0x38b86f);}})[_0xcfd6('0x2c')](function(){return _0x51c465;})[_0xcfd6('0x2c')](respondWithResult(_0x522ea4,null))[_0xcfd6('0x50')](handleError(_0x522ea4,null));};exports[_0xcfd6('0xbc')]=function(_0x125da5,_0x1c56dd,_0x33f50e){return db['VoiceQueue'][_0xcfd6('0x37')]({'where':{'id':_0x125da5[_0xcfd6('0x52')]['id']}})[_0xcfd6('0x2c')](handleEntityNotFound(_0x1c56dd,null))[_0xcfd6('0x2c')](function(_0x3f5ca5){if(_0x3f5ca5){return _0x3f5ca5[_0xcfd6('0xbc')](_0x125da5[_0xcfd6('0x41')]['ids']);}})[_0xcfd6('0x2c')](function(_0x52b542){if(_0x52b542){return db[_0xcfd6('0x6f')][_0xcfd6('0x2d')]({'where':{'ListId':_0x125da5[_0xcfd6('0x41')][_0xcfd6('0x87')],'VoiceQueueId':_0x125da5[_0xcfd6('0x52')]['id']}})[_0xcfd6('0x2c')](function(){return _0x52b542;});}})['then'](respondWithStatusCode(_0x1c56dd,null))[_0xcfd6('0x50')](handleError(_0x1c56dd,null));}; \ No newline at end of file +var _0x9d9c=['userVoiceQueue:save','upsert','removeAgents','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','fromQuery','phone','ContactId','ListId','CmListId','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','all','removeLists','getBlackLists','addBlackLists','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','set','apply','reject','update','then','destroy','get','VoiceQueues','inbound','outbound','ignore','map','value','includes','type','UserProfileResource','error','stack','name','send','VoiceQueue','rawAttributes','fieldName','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','merge','options','count','include','findAll','catch','show','params','length','includeAll','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','QueueCampaigns','UserProfileSection','autoAssociation','getHoppers','findOne','CmHopper','VoiceQueueId','filter','rows','getHopperHistories','CmHopperHistory','getHopperFinals','pick','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','teams','User','online','voicePause','interface','Agents','forEach','penalty','transaction','addTeams','TeamVoiceQueue','each','UserVoiceQueue','UserVoiceQueueRt','isNil','format','SIP/%s','emit','removeTeams','ids','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','every','TeamId','union','compact','isEmpty','userVoiceQueue:remove','addAgents','spread'];(function(_0x20c720,_0x14ee4e){var _0x4f1668=function(_0x314cba){while(--_0x314cba){_0x20c720['push'](_0x20c720['shift']());}};_0x4f1668(++_0x14ee4e);}(_0x9d9c,0x18a));var _0xc9d9=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0x9d9c[_0x39e84d];return _0x1991bc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc9d9('0x0'));var zipdir=require(_0xc9d9('0x1'));var jsonpatch=require(_0xc9d9('0x2'));var rp=require(_0xc9d9('0x3'));var moment=require('moment');var BPromise=require(_0xc9d9('0x4'));var Mustache=require(_0xc9d9('0x5'));var util=require(_0xc9d9('0x6'));var path=require('path');var sox=require(_0xc9d9('0x7'));var csv=require(_0xc9d9('0x8'));var ejs=require(_0xc9d9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc9d9('0xa'));var squel=require(_0xc9d9('0xb'));var crypto=require(_0xc9d9('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc9d9('0x8'));var querystring=require(_0xc9d9('0xd'));var Papa=require(_0xc9d9('0xe'));var Redis=require(_0xc9d9('0xf'));var authService=require(_0xc9d9('0x10'));var qs=require(_0xc9d9('0x11'));var as=require(_0xc9d9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc9d9('0x13'))(_0xc9d9('0x14'));var utils=require(_0xc9d9('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc9d9('0x16'))['db'];config[_0xc9d9('0x17')]=_[_0xc9d9('0x18')](config[_0xc9d9('0x17')],{'host':_0xc9d9('0x19'),'port':0x18eb});var socket=require(_0xc9d9('0x1a'))(new Redis(config[_0xc9d9('0x17')]));require('./voiceQueue.socket')[_0xc9d9('0x1b')](socket);function respondWithStatusCode(_0x25f28c,_0x1b389b){_0x1b389b=_0x1b389b||0xcc;return function(_0x2d10b4){if(_0x2d10b4){return _0x25f28c[_0xc9d9('0x1c')](_0x1b389b);}return _0x25f28c[_0xc9d9('0x1d')](_0x1b389b)['end']();};}function respondWithResult(_0x17bd9b,_0xaf768d){_0xaf768d=_0xaf768d||0xc8;return function(_0x25177b){if(_0x25177b){return _0x17bd9b[_0xc9d9('0x1d')](_0xaf768d)[_0xc9d9('0x1e')](_0x25177b);}};}function respondWithFilteredResult(_0x2ccf90,_0x41b3af){return function(_0x59cda4){if(_0x59cda4){var _0xbc7eb1=typeof _0x41b3af[_0xc9d9('0x1f')]===_0xc9d9('0x20')&&typeof _0x41b3af[_0xc9d9('0x21')]===_0xc9d9('0x20');var _0x4d4696=_0x59cda4['count'];var _0x23e0cc=_0xbc7eb1?0x0:_0x41b3af[_0xc9d9('0x1f')];var _0x39e585=_0xbc7eb1?_0x59cda4['count']:_0x41b3af[_0xc9d9('0x1f')]+_0x41b3af[_0xc9d9('0x21')];var _0x1047f8;if(_0x39e585>=_0x4d4696){_0x39e585=_0x4d4696;_0x1047f8=0xc8;}else{_0x1047f8=0xce;}_0x2ccf90[_0xc9d9('0x1d')](_0x1047f8);return _0x2ccf90[_0xc9d9('0x22')]('Content-Range',_0x23e0cc+'-'+_0x39e585+'/'+_0x4d4696)[_0xc9d9('0x1e')](_0x59cda4);}return null;};}function patchUpdates(_0xfdd5f4){return function(_0x39d8e5){try{jsonpatch[_0xc9d9('0x23')](_0x39d8e5,_0xfdd5f4,!![]);}catch(_0x3ecd6d){return BPromise[_0xc9d9('0x24')](_0x3ecd6d);}return _0x39d8e5['save']();};}function saveUpdates(_0x5f534f,_0x3195eb){return function(_0x1bb6ca){if(_0x1bb6ca){return _0x1bb6ca[_0xc9d9('0x25')](_0x5f534f)[_0xc9d9('0x26')](function(_0x1daf91){return _0x1daf91;});}return null;};}function removeEntity(_0xc2c53e,_0x15ecdc){return function(_0x2767cd){if(_0x2767cd){return _0x2767cd[_0xc9d9('0x27')]()['then'](function(){var _0x598db5=_0x2767cd[_0xc9d9('0x28')]({'plain':!![]});var _0x5244b5=[{'name':_0xc9d9('0x29'),'value':_0xc9d9('0x2a'),'ignore':![]},{'name':'QueueCampaigns','value':_0xc9d9('0x2b'),'ignore':![]}];var _0x1e5510=_(_0x5244b5)['filter'](_0xc9d9('0x2c'))[_0xc9d9('0x2d')]('value')[_0xc9d9('0x2e')]();if(_[_0xc9d9('0x2f')](_0x1e5510,_0x598db5[_0xc9d9('0x30')])){return;}var _0xb274ac=_['find'](_0x5244b5,[_0xc9d9('0x2e'),_0x598db5[_0xc9d9('0x30')]])['name'];return db[_0xc9d9('0x31')]['destroy']({'where':{'type':_0xb274ac,'resourceId':_0x598db5['id']}})[_0xc9d9('0x26')](function(){return _0x2767cd;});})[_0xc9d9('0x26')](function(){_0xc2c53e[_0xc9d9('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33c550,_0x4964a7){return function(_0x184618){if(!_0x184618){_0x33c550[_0xc9d9('0x1c')](0x194);}return _0x184618;};}function handleError(_0x2ea04b,_0x2e4b89){_0x2e4b89=_0x2e4b89||0x1f4;return function(_0x5db176){logger[_0xc9d9('0x32')](_0x5db176[_0xc9d9('0x33')]);if(_0x5db176[_0xc9d9('0x34')]){delete _0x5db176[_0xc9d9('0x34')];}_0x2ea04b['status'](_0x2e4b89)[_0xc9d9('0x35')](_0x5db176);};}exports['index']=function(_0x45e123,_0x556412){var _0xb2eda0={},_0x2d59ec={},_0x455379={'count':0x0,'rows':[]};var _0x5794c3=_[_0xc9d9('0x2d')](db[_0xc9d9('0x36')][_0xc9d9('0x37')],function(_0x59f5e8){return{'name':_0x59f5e8[_0xc9d9('0x38')],'type':_0x59f5e8[_0xc9d9('0x30')]['key']};});_0x2d59ec[_0xc9d9('0x39')]=_[_0xc9d9('0x2d')](_0x5794c3,_0xc9d9('0x34'));_0x2d59ec[_0xc9d9('0x3a')]=_[_0xc9d9('0x3b')](_0x45e123[_0xc9d9('0x3a')]);_0x2d59ec['filters']=_[_0xc9d9('0x3c')](_0x2d59ec[_0xc9d9('0x39')],_0x2d59ec[_0xc9d9('0x3a')]);_0xb2eda0['attributes']=_[_0xc9d9('0x3c')](_0x2d59ec[_0xc9d9('0x39')],qs[_0xc9d9('0x3d')](_0x45e123[_0xc9d9('0x3a')][_0xc9d9('0x3d')]));_0xb2eda0[_0xc9d9('0x3e')]=_0xb2eda0[_0xc9d9('0x3e')]['length']?_0xb2eda0[_0xc9d9('0x3e')]:_0x2d59ec['model'];if(!_0x45e123['query'][_0xc9d9('0x3f')](_0xc9d9('0x40'))){_0xb2eda0['limit']=qs[_0xc9d9('0x21')](_0x45e123['query'][_0xc9d9('0x21')]);_0xb2eda0[_0xc9d9('0x1f')]=qs[_0xc9d9('0x1f')](_0x45e123['query'][_0xc9d9('0x1f')]);}_0xb2eda0[_0xc9d9('0x41')]=qs[_0xc9d9('0x42')](_0x45e123[_0xc9d9('0x3a')][_0xc9d9('0x42')]);_0xb2eda0[_0xc9d9('0x43')]=qs['filters'](_['pick'](_0x45e123[_0xc9d9('0x3a')],_0x2d59ec[_0xc9d9('0x44')]),_0x5794c3);if(_0x45e123[_0xc9d9('0x3a')]['filter']){_0xb2eda0[_0xc9d9('0x43')]=_[_0xc9d9('0x45')](_0xb2eda0[_0xc9d9('0x43')],{'$or':_[_0xc9d9('0x2d')](_0x5794c3,function(_0x572c5a){if(_0x572c5a[_0xc9d9('0x30')]!=='VIRTUAL'){var _0x4ec9ae={};_0x4ec9ae[_0x572c5a[_0xc9d9('0x34')]]={'$like':'%'+_0x45e123[_0xc9d9('0x3a')]['filter']+'%'};return _0x4ec9ae;}})});}_0xb2eda0=_[_0xc9d9('0x45')]({},_0xb2eda0,_0x45e123[_0xc9d9('0x46')]);var _0x47b21e={'where':_0xb2eda0[_0xc9d9('0x43')]};return db[_0xc9d9('0x36')][_0xc9d9('0x47')](_0x47b21e)[_0xc9d9('0x26')](function(_0x22e690){_0x455379[_0xc9d9('0x47')]=_0x22e690;if(_0x45e123[_0xc9d9('0x3a')]['includeAll']){_0xb2eda0[_0xc9d9('0x48')]=[{'all':!![]}];}return db[_0xc9d9('0x36')][_0xc9d9('0x49')](_0xb2eda0);})[_0xc9d9('0x26')](function(_0x58adb){_0x455379['rows']=_0x58adb;return _0x455379;})[_0xc9d9('0x26')](respondWithFilteredResult(_0x556412,_0xb2eda0))[_0xc9d9('0x4a')](handleError(_0x556412,null));};exports[_0xc9d9('0x4b')]=function(_0x217356,_0x28081c){var _0x3ca6a1={'raw':![],'where':{'id':_0x217356[_0xc9d9('0x4c')]['id']}},_0x40a66a={};_0x40a66a[_0xc9d9('0x39')]=_[_0xc9d9('0x3b')](db[_0xc9d9('0x36')][_0xc9d9('0x37')]);_0x40a66a[_0xc9d9('0x3a')]=_[_0xc9d9('0x3b')](_0x217356['query']);_0x40a66a[_0xc9d9('0x44')]=_[_0xc9d9('0x3c')](_0x40a66a['model'],_0x40a66a['query']);_0x3ca6a1[_0xc9d9('0x3e')]=_[_0xc9d9('0x3c')](_0x40a66a[_0xc9d9('0x39')],qs[_0xc9d9('0x3d')](_0x217356[_0xc9d9('0x3a')][_0xc9d9('0x3d')]));_0x3ca6a1[_0xc9d9('0x3e')]=_0x3ca6a1[_0xc9d9('0x3e')][_0xc9d9('0x4d')]?_0x3ca6a1['attributes']:_0x40a66a[_0xc9d9('0x39')];if(_0x217356['query'][_0xc9d9('0x4e')]){_0x3ca6a1[_0xc9d9('0x48')]=[{'all':!![]}];}_0x3ca6a1=_[_0xc9d9('0x45')]({},_0x3ca6a1,_0x217356[_0xc9d9('0x46')]);return db['VoiceQueue'][_0xc9d9('0x4f')](_0x3ca6a1)[_0xc9d9('0x26')](handleEntityNotFound(_0x28081c,null))['then'](respondWithResult(_0x28081c,null))['catch'](handleError(_0x28081c,null));};exports['create']=function(_0x4ed6f8,_0x22827c){return db[_0xc9d9('0x36')]['create'](_0x4ed6f8[_0xc9d9('0x50')],{})[_0xc9d9('0x26')](function(_0x23aaff){var _0x3121ae=_0x4ed6f8[_0xc9d9('0x51')][_0xc9d9('0x28')]({'plain':!![]});if(!_0x3121ae)throw new Error(_0xc9d9('0x52'));if(_0x3121ae[_0xc9d9('0x53')]==='user'){var _0x44c013=_0x23aaff['get']({'plain':!![]});var _0xb04bd=[{'name':_0xc9d9('0x29'),'value':_0xc9d9('0x2a')},{'name':'QueueCampaigns','value':_0xc9d9('0x2b')}];var _0x2b586a=_[_0xc9d9('0x4f')](_0xb04bd,[_0xc9d9('0x2e'),_0x44c013['type']])[_0xc9d9('0x34')];return db['UserProfileSection'][_0xc9d9('0x4f')]({'where':{'name':_0x2b586a,'userProfileId':_0x3121ae[_0xc9d9('0x54')]},'raw':!![]})[_0xc9d9('0x26')](function(_0x5e105c){if(_0x5e105c&&_0x5e105c['autoAssociation']===0x0){return db['UserProfileResource'][_0xc9d9('0x55')]({'name':_0x44c013[_0xc9d9('0x34')],'resourceId':_0x44c013['id'],'type':_0x5e105c['name'],'sectionId':_0x5e105c['id']},{})['then'](function(){return _0x23aaff;});}else{return _0x23aaff;}})[_0xc9d9('0x4a')](function(_0x544690){logger[_0xc9d9('0x32')](_0xc9d9('0x56'),_0x544690);throw _0x544690;});}return _0x23aaff;})[_0xc9d9('0x26')](respondWithResult(_0x22827c,0xc9))[_0xc9d9('0x4a')](handleError(_0x22827c,null));};exports[_0xc9d9('0x57')]=function(_0x481dda,_0x4cf8fe){var _0x2507e8={'where':{'id':_0x481dda[_0xc9d9('0x4c')]['id']}},_0x217fb0={};_0x217fb0[_0xc9d9('0x39')]=_[_0xc9d9('0x3b')](db[_0xc9d9('0x36')][_0xc9d9('0x37')]);_0x2507e8[_0xc9d9('0x3e')]=_[_0xc9d9('0x3c')](_0x217fb0[_0xc9d9('0x39')],qs[_0xc9d9('0x3d')](_0x481dda[_0xc9d9('0x3a')][_0xc9d9('0x3d')]));_0x2507e8[_0xc9d9('0x3e')]=_0x2507e8['attributes'][_0xc9d9('0x4d')]?_0x2507e8['attributes']:_0x217fb0[_0xc9d9('0x39')];if(_0x481dda[_0xc9d9('0x3a')][_0xc9d9('0x4e')]){_0x2507e8[_0xc9d9('0x48')]=[{'all':!![]}];}_0x2507e8=_[_0xc9d9('0x45')]({},_0x2507e8,_0x481dda[_0xc9d9('0x46')]);return db['VoiceQueue']['find'](_0x2507e8)[_0xc9d9('0x26')](handleEntityNotFound(_0x4cf8fe,null))[_0xc9d9('0x26')](function(_0x161b4e){if(_0x161b4e){var _0x49546d=_0x161b4e[_0xc9d9('0x28')]({'plain':!![]});_0x49546d=qs[_0xc9d9('0x58')](_0x49546d,['id',_0xc9d9('0x59'),'updatedAt']);_0x481dda['body']=_['omit'](_0x481dda[_0xc9d9('0x50')],['id',_0xc9d9('0x59'),_0xc9d9('0x5a')]);return db[_0xc9d9('0x36')][_0xc9d9('0x55')](_[_0xc9d9('0x45')](_0x49546d,_0x481dda[_0xc9d9('0x50')]),{'include':_0x481dda[_0xc9d9('0x3a')]['includeAll']?[{'all':!![]}]:undefined})[_0xc9d9('0x26')](function(_0x139617){var _0x2adc08=_0x481dda['user'][_0xc9d9('0x28')]({'plain':!![]});if(!_0x2adc08)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2adc08['role']===_0xc9d9('0x51')){var _0x4f656f=_0x139617[_0xc9d9('0x28')]({'plain':!![]});var _0x269325=[{'name':'VoiceQueues','value':'inbound'},{'name':_0xc9d9('0x5b'),'value':_0xc9d9('0x2b')}];var _0x3a7c36=_['find'](_0x269325,[_0xc9d9('0x2e'),_0x4f656f[_0xc9d9('0x30')]])[_0xc9d9('0x34')];return db[_0xc9d9('0x5c')][_0xc9d9('0x4f')]({'where':{'name':_0x3a7c36,'userProfileId':_0x2adc08['userProfileId']},'raw':!![]})[_0xc9d9('0x26')](function(_0x2a0376){if(_0x2a0376&&_0x2a0376[_0xc9d9('0x5d')]===0x0){return db[_0xc9d9('0x31')][_0xc9d9('0x55')]({'name':_0x4f656f[_0xc9d9('0x34')],'resourceId':_0x4f656f['id'],'type':_0x2a0376['name'],'sectionId':_0x2a0376['id']},{})['then'](function(){return _0x139617;});}else{return _0x139617;}})[_0xc9d9('0x4a')](function(_0x20dc68){logger[_0xc9d9('0x32')](_0xc9d9('0x56'),_0x20dc68);throw _0x20dc68;});}return _0x139617;});}})[_0xc9d9('0x26')](respondWithResult(_0x4cf8fe,0xc9))[_0xc9d9('0x4a')](handleError(_0x4cf8fe,null));};exports[_0xc9d9('0x25')]=function(_0x247517,_0x186801){if(_0x247517[_0xc9d9('0x50')]['id']){delete _0x247517['body']['id'];}return db['VoiceQueue'][_0xc9d9('0x4f')]({'where':{'id':_0x247517['params']['id']}})[_0xc9d9('0x26')](handleEntityNotFound(_0x186801,null))[_0xc9d9('0x26')](saveUpdates(_0x247517[_0xc9d9('0x50')],null))[_0xc9d9('0x26')](respondWithResult(_0x186801,null))[_0xc9d9('0x4a')](handleError(_0x186801,null));};exports[_0xc9d9('0x27')]=function(_0x172ed9,_0x166c27){return db[_0xc9d9('0x36')]['find']({'where':{'id':_0x172ed9[_0xc9d9('0x4c')]['id']}})[_0xc9d9('0x26')](handleEntityNotFound(_0x166c27,null))[_0xc9d9('0x26')](removeEntity(_0x166c27,null))[_0xc9d9('0x4a')](handleError(_0x166c27,null));};exports[_0xc9d9('0x5e')]=function(_0xc78301,_0x277afd,_0x5609d9){var _0x3101c6={'raw':![],'where':{}};var _0x3c89f0={};var _0x30badd={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xc9d9('0x5f')]({'where':{'id':_0xc78301[_0xc9d9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x277afd,null))[_0xc9d9('0x26')](function(_0x2dfe1d){if(_0x2dfe1d){_0x3c89f0['model']=_['keys'](db[_0xc9d9('0x60')][_0xc9d9('0x37')]);_0x3c89f0[_0xc9d9('0x3a')]=_[_0xc9d9('0x3b')](_0xc78301['query']);_0x3c89f0['filters']=_[_0xc9d9('0x3c')](_0x3c89f0[_0xc9d9('0x39')],_0x3c89f0[_0xc9d9('0x3a')]);_0x3101c6[_0xc9d9('0x3e')]=_[_0xc9d9('0x3c')](_0x3c89f0['model'],qs[_0xc9d9('0x3d')](_0xc78301[_0xc9d9('0x3a')][_0xc9d9('0x3d')]));_0x3101c6[_0xc9d9('0x3e')]=_0x3101c6[_0xc9d9('0x3e')][_0xc9d9('0x4d')]?_0x3101c6['attributes']:_0x3c89f0[_0xc9d9('0x39')];if(!_0xc78301[_0xc9d9('0x3a')]['hasOwnProperty'](_0xc9d9('0x40'))){_0x3101c6[_0xc9d9('0x21')]=qs[_0xc9d9('0x21')](_0xc78301[_0xc9d9('0x3a')][_0xc9d9('0x21')]);_0x3101c6[_0xc9d9('0x1f')]=qs[_0xc9d9('0x1f')](_0xc78301['query'][_0xc9d9('0x1f')]);}_0x3101c6[_0xc9d9('0x41')]=qs['sort'](_0xc78301['query'][_0xc9d9('0x42')]);_0x3101c6['where']=qs[_0xc9d9('0x44')](_['pick'](_0xc78301['query'],_0x3c89f0[_0xc9d9('0x44')]));_0x3101c6['where'][_0xc9d9('0x61')]=_0x2dfe1d['id'];if(_0xc78301['query']['filter']){_0x3101c6['where']=_['merge'](_0x3101c6['where'],{'$or':_[_0xc9d9('0x2d')](_0x3101c6['attributes'],function(_0x41aadb){var _0x3d6d91={};_0x3d6d91[_0x41aadb]={'$like':'%'+_0xc78301['query'][_0xc9d9('0x62')]+'%'};return _0x3d6d91;})});}_0x3101c6=_[_0xc9d9('0x45')]({},_0x3101c6,_0xc78301['options']);return db[_0xc9d9('0x60')][_0xc9d9('0x47')]({'where':_0x3101c6[_0xc9d9('0x43')]})['then'](function(_0x135bc9){_0x30badd[_0xc9d9('0x47')]=_0x135bc9;if(_0xc78301[_0xc9d9('0x3a')][_0xc9d9('0x4e')]){_0x3101c6[_0xc9d9('0x48')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x3101c6);})[_0xc9d9('0x26')](function(_0x1f4b77){_0x30badd[_0xc9d9('0x63')]=_0x1f4b77;return _0x30badd;});}})[_0xc9d9('0x26')](respondWithFilteredResult(_0x277afd,_0x3101c6))[_0xc9d9('0x4a')](handleError(_0x277afd,null));};exports[_0xc9d9('0x64')]=function(_0x87420e,_0x2f3695,_0x5a578a){var _0x5308e2={'raw':!![],'where':{}};var _0x4b9645={};var _0x3e8d70={'count':0x0,'rows':[]};return db[_0xc9d9('0x36')][_0xc9d9('0x5f')]({'where':{'id':_0x87420e[_0xc9d9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2f3695,null))[_0xc9d9('0x26')](function(_0x30e2e4){if(_0x30e2e4){_0x4b9645[_0xc9d9('0x39')]=_[_0xc9d9('0x3b')](db[_0xc9d9('0x65')][_0xc9d9('0x37')]);_0x4b9645[_0xc9d9('0x3a')]=_[_0xc9d9('0x3b')](_0x87420e[_0xc9d9('0x3a')]);_0x4b9645[_0xc9d9('0x44')]=_['intersection'](_0x4b9645[_0xc9d9('0x39')],_0x4b9645[_0xc9d9('0x3a')]);_0x5308e2[_0xc9d9('0x3e')]=_['intersection'](_0x4b9645[_0xc9d9('0x39')],qs[_0xc9d9('0x3d')](_0x87420e[_0xc9d9('0x3a')][_0xc9d9('0x3d')]));_0x5308e2[_0xc9d9('0x3e')]=_0x5308e2[_0xc9d9('0x3e')][_0xc9d9('0x4d')]?_0x5308e2[_0xc9d9('0x3e')]:_0x4b9645[_0xc9d9('0x39')];if(!_0x87420e[_0xc9d9('0x3a')][_0xc9d9('0x3f')]('nolimit')){_0x5308e2[_0xc9d9('0x21')]=qs[_0xc9d9('0x21')](_0x87420e[_0xc9d9('0x3a')]['limit']);_0x5308e2[_0xc9d9('0x1f')]=qs[_0xc9d9('0x1f')](_0x87420e[_0xc9d9('0x3a')]['offset']);}_0x5308e2[_0xc9d9('0x41')]=qs[_0xc9d9('0x42')](_0x87420e[_0xc9d9('0x3a')][_0xc9d9('0x42')]);_0x5308e2[_0xc9d9('0x43')]=qs[_0xc9d9('0x44')](_['pick'](_0x87420e[_0xc9d9('0x3a')],_0x4b9645[_0xc9d9('0x44')]));_0x5308e2[_0xc9d9('0x43')][_0xc9d9('0x61')]=_0x30e2e4['id'];if(_0x87420e[_0xc9d9('0x3a')][_0xc9d9('0x62')]){_0x5308e2[_0xc9d9('0x43')]=_[_0xc9d9('0x45')](_0x5308e2[_0xc9d9('0x43')],{'$or':_[_0xc9d9('0x2d')](_0x5308e2[_0xc9d9('0x3e')],function(_0x23b19f){var _0x58c762={};_0x58c762[_0x23b19f]={'$like':'%'+_0x87420e[_0xc9d9('0x3a')][_0xc9d9('0x62')]+'%'};return _0x58c762;})});}_0x5308e2=_[_0xc9d9('0x45')]({},_0x5308e2,_0x87420e[_0xc9d9('0x46')]);return db[_0xc9d9('0x65')]['count']({'where':_0x5308e2[_0xc9d9('0x43')]})[_0xc9d9('0x26')](function(_0xa509ba){_0x3e8d70[_0xc9d9('0x47')]=_0xa509ba;if(_0x87420e[_0xc9d9('0x3a')][_0xc9d9('0x4e')]){_0x5308e2[_0xc9d9('0x48')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xc9d9('0x49')](_0x5308e2);})[_0xc9d9('0x26')](function(_0x19a830){_0x3e8d70[_0xc9d9('0x63')]=_0x19a830;return _0x3e8d70;});}})[_0xc9d9('0x26')](respondWithFilteredResult(_0x2f3695,_0x5308e2))['catch'](handleError(_0x2f3695,null));};exports[_0xc9d9('0x66')]=function(_0x90fbc0,_0x2bc4e0,_0x17eb53){var _0x375905={'raw':!![],'where':{}};var _0x32a535={};var _0x230d80={'count':0x0,'rows':[]};return db[_0xc9d9('0x36')][_0xc9d9('0x5f')]({'where':{'id':_0x90fbc0[_0xc9d9('0x4c')]['id']}})[_0xc9d9('0x26')](handleEntityNotFound(_0x2bc4e0,null))[_0xc9d9('0x26')](function(_0x4c05da){if(_0x4c05da){_0x32a535[_0xc9d9('0x39')]=_[_0xc9d9('0x3b')](db['CmHopperFinal'][_0xc9d9('0x37')]);_0x32a535[_0xc9d9('0x3a')]=_[_0xc9d9('0x3b')](_0x90fbc0[_0xc9d9('0x3a')]);_0x32a535[_0xc9d9('0x44')]=_[_0xc9d9('0x3c')](_0x32a535[_0xc9d9('0x39')],_0x32a535[_0xc9d9('0x3a')]);_0x375905[_0xc9d9('0x3e')]=_[_0xc9d9('0x3c')](_0x32a535[_0xc9d9('0x39')],qs[_0xc9d9('0x3d')](_0x90fbc0[_0xc9d9('0x3a')][_0xc9d9('0x3d')]));_0x375905[_0xc9d9('0x3e')]=_0x375905[_0xc9d9('0x3e')][_0xc9d9('0x4d')]?_0x375905['attributes']:_0x32a535[_0xc9d9('0x39')];if(!_0x90fbc0['query'][_0xc9d9('0x3f')]('nolimit')){_0x375905[_0xc9d9('0x21')]=qs[_0xc9d9('0x21')](_0x90fbc0[_0xc9d9('0x3a')][_0xc9d9('0x21')]);_0x375905[_0xc9d9('0x1f')]=qs[_0xc9d9('0x1f')](_0x90fbc0[_0xc9d9('0x3a')]['offset']);}_0x375905[_0xc9d9('0x41')]=qs['sort'](_0x90fbc0[_0xc9d9('0x3a')][_0xc9d9('0x42')]);_0x375905[_0xc9d9('0x43')]=qs['filters'](_[_0xc9d9('0x67')](_0x90fbc0['query'],_0x32a535[_0xc9d9('0x44')]));_0x375905[_0xc9d9('0x43')][_0xc9d9('0x61')]=_0x4c05da['id'];if(_0x90fbc0['query'][_0xc9d9('0x62')]){_0x375905['where']=_[_0xc9d9('0x45')](_0x375905['where'],{'$or':_['map'](_0x375905[_0xc9d9('0x3e')],function(_0x10ac29){var _0x3d1cdf={};_0x3d1cdf[_0x10ac29]={'$like':'%'+_0x90fbc0[_0xc9d9('0x3a')][_0xc9d9('0x62')]+'%'};return _0x3d1cdf;})});}_0x375905=_[_0xc9d9('0x45')]({},_0x375905,_0x90fbc0[_0xc9d9('0x46')]);return db[_0xc9d9('0x68')][_0xc9d9('0x47')]({'where':_0x375905[_0xc9d9('0x43')]})[_0xc9d9('0x26')](function(_0x1e6e25){_0x230d80[_0xc9d9('0x47')]=_0x1e6e25;if(_0x90fbc0[_0xc9d9('0x3a')][_0xc9d9('0x4e')]){_0x375905[_0xc9d9('0x48')]=[{'all':!![]}];}return db[_0xc9d9('0x68')][_0xc9d9('0x49')](_0x375905);})[_0xc9d9('0x26')](function(_0x5bdb08){_0x230d80[_0xc9d9('0x63')]=_0x5bdb08;return _0x230d80;});}})[_0xc9d9('0x26')](respondWithFilteredResult(_0x2bc4e0,_0x375905))['catch'](handleError(_0x2bc4e0,null));};exports[_0xc9d9('0x69')]=function(_0x460be0,_0x5bf904,_0x3acc89){var _0x34cc40={'raw':!![],'where':{}};var _0x3095c1={};var _0x30ab55={'count':0x0,'rows':[]};return db[_0xc9d9('0x36')]['findOne']({'where':{'id':_0x460be0[_0xc9d9('0x4c')]['id']}})[_0xc9d9('0x26')](handleEntityNotFound(_0x5bf904,null))[_0xc9d9('0x26')](function(_0x1db9f4){if(_0x1db9f4){_0x3095c1[_0xc9d9('0x39')]=_['keys'](db['CmHopperBlack'][_0xc9d9('0x37')]);_0x3095c1[_0xc9d9('0x3a')]=_['keys'](_0x460be0[_0xc9d9('0x3a')]);_0x3095c1[_0xc9d9('0x44')]=_[_0xc9d9('0x3c')](_0x3095c1[_0xc9d9('0x39')],_0x3095c1['query']);_0x34cc40[_0xc9d9('0x3e')]=_[_0xc9d9('0x3c')](_0x3095c1[_0xc9d9('0x39')],qs[_0xc9d9('0x3d')](_0x460be0[_0xc9d9('0x3a')]['fields']));_0x34cc40['attributes']=_0x34cc40[_0xc9d9('0x3e')][_0xc9d9('0x4d')]?_0x34cc40[_0xc9d9('0x3e')]:_0x3095c1[_0xc9d9('0x39')];if(!_0x460be0[_0xc9d9('0x3a')][_0xc9d9('0x3f')](_0xc9d9('0x40'))){_0x34cc40['limit']=qs['limit'](_0x460be0[_0xc9d9('0x3a')][_0xc9d9('0x21')]);_0x34cc40[_0xc9d9('0x1f')]=qs[_0xc9d9('0x1f')](_0x460be0[_0xc9d9('0x3a')][_0xc9d9('0x1f')]);}_0x34cc40['order']=qs[_0xc9d9('0x42')](_0x460be0[_0xc9d9('0x3a')][_0xc9d9('0x42')]);_0x34cc40[_0xc9d9('0x43')]=qs['filters'](_[_0xc9d9('0x67')](_0x460be0['query'],_0x3095c1[_0xc9d9('0x44')]));_0x34cc40[_0xc9d9('0x43')][_0xc9d9('0x61')]=_0x1db9f4['id'];if(_0x460be0[_0xc9d9('0x3a')][_0xc9d9('0x62')]){_0x34cc40['where']=_['merge'](_0x34cc40[_0xc9d9('0x43')],{'$or':_[_0xc9d9('0x2d')](_0x34cc40['attributes'],function(_0x4adff5){var _0x365c37={};_0x365c37[_0x4adff5]={'$like':'%'+_0x460be0[_0xc9d9('0x3a')][_0xc9d9('0x62')]+'%'};return _0x365c37;})});}_0x34cc40=_[_0xc9d9('0x45')]({},_0x34cc40,_0x460be0[_0xc9d9('0x46')]);return db[_0xc9d9('0x6a')][_0xc9d9('0x47')]({'where':_0x34cc40[_0xc9d9('0x43')]})['then'](function(_0x5737e4){_0x30ab55[_0xc9d9('0x47')]=_0x5737e4;if(_0x460be0[_0xc9d9('0x3a')]['includeAll']){_0x34cc40[_0xc9d9('0x48')]=[{'all':!![]}];}return db[_0xc9d9('0x6a')][_0xc9d9('0x49')](_0x34cc40);})[_0xc9d9('0x26')](function(_0x5a3a3a){_0x30ab55[_0xc9d9('0x63')]=_0x5a3a3a;return _0x30ab55;});}})[_0xc9d9('0x26')](respondWithFilteredResult(_0x5bf904,_0x34cc40))['catch'](handleError(_0x5bf904,null));};exports['getTeams']=function(_0x533f3d,_0x21b1e2,_0x5b300a){var _0x401b4c={};var _0x569020={};var _0x67178c;var _0x4707cc;return db[_0xc9d9('0x36')]['findOne']({'where':{'id':_0x533f3d[_0xc9d9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x21b1e2,null))[_0xc9d9('0x26')](function(_0x45da86){if(_0x45da86){_0x67178c=_0x45da86;_0x569020[_0xc9d9('0x39')]=_[_0xc9d9('0x3b')](db[_0xc9d9('0x6b')][_0xc9d9('0x37')]);_0x569020[_0xc9d9('0x3a')]=_[_0xc9d9('0x3b')](_0x533f3d[_0xc9d9('0x3a')]);_0x569020[_0xc9d9('0x44')]=_[_0xc9d9('0x3c')](_0x569020['model'],_0x569020[_0xc9d9('0x3a')]);_0x401b4c[_0xc9d9('0x3e')]=_[_0xc9d9('0x3c')](_0x569020[_0xc9d9('0x39')],qs[_0xc9d9('0x3d')](_0x533f3d['query'][_0xc9d9('0x3d')]));_0x401b4c[_0xc9d9('0x3e')]=_0x401b4c['attributes'][_0xc9d9('0x4d')]?_0x401b4c[_0xc9d9('0x3e')]:_0x569020[_0xc9d9('0x39')];_0x401b4c[_0xc9d9('0x41')]=qs['sort'](_0x533f3d['query']['sort']);_0x401b4c[_0xc9d9('0x43')]=qs[_0xc9d9('0x44')](_[_0xc9d9('0x67')](_0x533f3d[_0xc9d9('0x3a')],_0x569020[_0xc9d9('0x44')]));if(_0x533f3d['query'][_0xc9d9('0x62')]){_0x401b4c[_0xc9d9('0x43')]=_[_0xc9d9('0x45')](_0x401b4c['where'],{'$or':_[_0xc9d9('0x2d')](_0x401b4c[_0xc9d9('0x3e')],function(_0x26b569){var _0xaba240={};_0xaba240[_0x26b569]={'$like':'%'+_0x533f3d[_0xc9d9('0x3a')][_0xc9d9('0x62')]+'%'};return _0xaba240;})});}_0x401b4c=_[_0xc9d9('0x45')]({},_0x401b4c,_0x533f3d[_0xc9d9('0x46')]);return _0x67178c['getTeams'](_0x401b4c);}})[_0xc9d9('0x26')](function(_0x29c93f){if(_0x29c93f){_0x4707cc=_0x29c93f[_0xc9d9('0x4d')];if(!_0x533f3d[_0xc9d9('0x3a')][_0xc9d9('0x3f')](_0xc9d9('0x40'))){_0x401b4c[_0xc9d9('0x21')]=qs[_0xc9d9('0x21')](_0x533f3d[_0xc9d9('0x3a')]['limit']);_0x401b4c[_0xc9d9('0x1f')]=qs[_0xc9d9('0x1f')](_0x533f3d[_0xc9d9('0x3a')][_0xc9d9('0x1f')]);}return _0x67178c['getTeams'](_0x401b4c);}})[_0xc9d9('0x26')](function(_0x56cacb){if(_0x56cacb){return _0x56cacb?{'count':_0x4707cc,'rows':_0x56cacb}:null;}})[_0xc9d9('0x26')](respondWithResult(_0x21b1e2,null))[_0xc9d9('0x4a')](handleError(_0x21b1e2,null));};exports['addTeams']=function(_0x9c35b5,_0x34bc7d,_0x5b51c5){var _0x52c801=_0x9c35b5['body'][_0xc9d9('0x6c')];var _0x8d6e02=_[_0xc9d9('0x2d')](_0x52c801,'id');return db['Team']['findAll']({'where':{'id':_0x8d6e02},'attributes':['id'],'include':[{'model':db[_0xc9d9('0x6d')],'as':'Agents','attributes':['id',_0xc9d9('0x34'),_0xc9d9('0x6e'),_0xc9d9('0x6f'),_0xc9d9('0x70')],'raw':!![]}]})[_0xc9d9('0x26')](function(_0x4a3f5f){if(_0x4a3f5f){var _0x35a9a1=_['flatMap'](_0x4a3f5f,function(_0x4a33ee){var _0x30048b=_0x4a33ee[_0xc9d9('0x28')]({'plain':!![]});_0x30048b[_0xc9d9('0x71')][_0xc9d9('0x72')](function(_0x4b0723){_0x4b0723['penalty']=_[_0xc9d9('0x4f')](_0x52c801,{'id':_0x30048b['id']})[_0xc9d9('0x73')];});return _0x30048b[_0xc9d9('0x71')];});return db[_0xc9d9('0x36')][_0xc9d9('0x4f')]({'where':{'id':_0x9c35b5[_0xc9d9('0x4c')]['id']}})[_0xc9d9('0x26')](function(_0x4b542d){return db['sequelize'][_0xc9d9('0x74')](function(_0x258ae6){return _0x4b542d[_0xc9d9('0x75')](_0x8d6e02,{'transaction':_0x258ae6})[_0xc9d9('0x26')](function(){return BPromise['each'](_0x52c801,function(_0x573fab){return db[_0xc9d9('0x76')]['upsert']({'TeamId':_0x573fab['id'],'VoiceQueueId':_0x9c35b5[_0xc9d9('0x4c')]['id'],'penalty':_0x573fab[_0xc9d9('0x73')]},{'transaction':_0x258ae6});});})['then'](function(){return BPromise[_0xc9d9('0x77')](_0x35a9a1,function(_0x464960){return db[_0xc9d9('0x78')]['findOrCreate']({'where':{'UserId':_0x464960['id'],'VoiceQueueId':_0x9c35b5[_0xc9d9('0x4c')]['id']},'defaults':{'penalty':_0x464960[_0xc9d9('0x73')]},'transaction':_0x258ae6});});})[_0xc9d9('0x26')](function(){return BPromise[_0xc9d9('0x77')](_[_0xc9d9('0x62')](_0x35a9a1,{'online':!![]}),function(_0x1d3af4){return db[_0xc9d9('0x79')]['upsert']({'membername':_0x1d3af4[_0xc9d9('0x34')],'UserId':_0x1d3af4['id'],'queue_name':_0x4b542d['name'],'VoiceQueueId':_0x4b542d['id'],'interface':_[_0xc9d9('0x7a')](_0x1d3af4['interface'])?util[_0xc9d9('0x7b')](_0xc9d9('0x7c'),_0x1d3af4[_0xc9d9('0x34')]):_0x1d3af4[_0xc9d9('0x70')],'paused':_0x1d3af4[_0xc9d9('0x6f')]||![],'penalty':_0x1d3af4[_0xc9d9('0x73')]},{'transaction':_0x258ae6});});})[_0xc9d9('0x26')](function(){_0x35a9a1[_0xc9d9('0x72')](function(_0xfce99a){socket[_0xc9d9('0x7d')]('userVoiceQueue:save',{'UserId':_0xfce99a['id'],'VoiceQueueId':_0x4b542d['id']});});});});});}})[_0xc9d9('0x26')](respondWithStatusCode(_0x34bc7d,null))['catch'](handleError(_0x34bc7d,null));};exports[_0xc9d9('0x7e')]=function(_0x27ffc8,_0x3f207e,_0x4b3f97){return db[_0xc9d9('0x6b')][_0xc9d9('0x49')]({'where':{'id':_0x27ffc8['query'][_0xc9d9('0x7f')]},'attributes':['id'],'include':[{'model':db[_0xc9d9('0x6d')],'as':_0xc9d9('0x71'),'attributes':['id'],'raw':!![]}]})[_0xc9d9('0x26')](handleEntityNotFound(_0x3f207e,null))[_0xc9d9('0x26')](function(_0x140e29){var _0x59d930=_['map'](_0x140e29,'id');var _0x53adaf=[];var _0x19104d=[];var _0x397323=squel[_0xc9d9('0x80')]();_0x397323[_0xc9d9('0x81')](_0xc9d9('0x82'))[_0xc9d9('0x83')](_0xc9d9('0x84'),'tq')[_0xc9d9('0x85')](_0xc9d9('0x86'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xc9d9('0x43')](_0xc9d9('0x87'),_0x27ffc8[_0xc9d9('0x4c')]['id']);for(var _0x1b650a=0x0;_0x1b650a<_0x140e29[_0xc9d9('0x4d')];_0x1b650a+=0x1){let _0x409562=_0x140e29[_0x1b650a];for(var _0x18c416=0x0;_0x18c416<_0x409562[_0xc9d9('0x71')][_0xc9d9('0x4d')];_0x18c416+=0x1){let _0x4743ab=_0x409562[_0xc9d9('0x71')][_0x18c416];var _0x53c4e0=_0x397323[_0xc9d9('0x57')]();_0x53c4e0['where'](_0xc9d9('0x88'),_0x4743ab['id']);_0x19104d[_0xc9d9('0x89')](db[_0xc9d9('0x8a')][_0xc9d9('0x3a')](_0x53c4e0[_0xc9d9('0x8b')](),{'type':db['sequelize'][_0xc9d9('0x8c')]['SELECT']})[_0xc9d9('0x26')](function(_0x2c4128){if(_0x2c4128[_0xc9d9('0x4d')]===0x1){return _0x4743ab['id'];}else{var _0xcb4099=_[_0xc9d9('0x8d')](_['map'](_0x2c4128,_0xc9d9('0x8e')),function(_0xd31e39){return _['includes'](_0x59d930,_0xd31e39);});if(_0xcb4099){return _0x4743ab['id'];}}}));}}return BPromise['all'](_0x19104d)['then'](function(_0x240087){_0x53adaf=_(_0x53adaf)[_0xc9d9('0x8f')](_0x240087)[_0xc9d9('0x90')]()[_0xc9d9('0x2e')]();return db[_0xc9d9('0x36')]['find']({'where':{'id':_0x27ffc8[_0xc9d9('0x4c')]['id']}})['then'](function(_0x373dfe){return db['sequelize'][_0xc9d9('0x74')](function(_0x320922){return _0x373dfe[_0xc9d9('0x7e')](_0x27ffc8[_0xc9d9('0x3a')]['ids'],{'transaction':_0x320922})[_0xc9d9('0x26')](function(){if(!_[_0xc9d9('0x91')](_0x53adaf)){return _0x373dfe['removeAgents'](_0x53adaf,{'transaction':_0x320922})[_0xc9d9('0x26')](function(){return db[_0xc9d9('0x79')][_0xc9d9('0x27')]({'where':{'VoiceQueueId':_0x27ffc8[_0xc9d9('0x4c')]['id'],'UserId':_0x53adaf},'transaction':_0x320922});});}})[_0xc9d9('0x26')](function(){_0x53adaf[_0xc9d9('0x72')](function(_0x3bc2fa){socket['emit'](_0xc9d9('0x92'),{'UserId':_0x3bc2fa,'VoiceQueueId':_0x373dfe['id']});});});});});});})[_0xc9d9('0x26')](respondWithStatusCode(_0x3f207e,null))[_0xc9d9('0x4a')](handleError(_0x3f207e,null));};exports[_0xc9d9('0x93')]=function(_0x1a04ae,_0x3111a7,_0x4255e8){var _0x19b948,_0x2f26c1;return db['VoiceQueue'][_0xc9d9('0x4f')]({'where':{'id':_0x1a04ae['params']['id']}})[_0xc9d9('0x26')](handleEntityNotFound(_0x3111a7,null))['then'](function(_0x372766){if(_0x372766){_0x2f26c1=_0x372766;return _0x372766[_0xc9d9('0x93')](_0x1a04ae[_0xc9d9('0x50')][_0xc9d9('0x7f')],_['omit'](_0x1a04ae[_0xc9d9('0x50')],[_0xc9d9('0x7f'),'id'])||{})[_0xc9d9('0x94')](function(_0x51b516){for(var _0x1c5732=0x0;_0x1c5732<_0x1a04ae[_0xc9d9('0x50')][_0xc9d9('0x7f')][_0xc9d9('0x4d')];_0x1c5732+=0x1){socket[_0xc9d9('0x7d')](_0xc9d9('0x95'),{'UserId':Number(_0x1a04ae['body']['ids'][_0x1c5732]),'VoiceQueueId':Number(_0x1a04ae['params']['id'])});}return _0x51b516;});}})[_0xc9d9('0x26')](function(_0x5d5874){_0x19b948=_0x5d5874||[];if(_0x2f26c1){return db[_0xc9d9('0x6d')]['findAll']({'where':{'id':_0x1a04ae[_0xc9d9('0x50')][_0xc9d9('0x7f')]},'attributes':['id',_0xc9d9('0x34'),_0xc9d9('0x6e'),_0xc9d9('0x6f'),_0xc9d9('0x70')],'raw':!![]});}})[_0xc9d9('0x26')](function(_0x1e7e98){if(!_['isEmpty'](_0x1e7e98)){var _0x742296=[];for(var _0x5443d1=0x0;_0x5443d1<_0x1e7e98[_0xc9d9('0x4d')];_0x5443d1++){if(_0x1e7e98[_0x5443d1][_0xc9d9('0x6e')]){_0x742296[_0xc9d9('0x89')](db[_0xc9d9('0x79')][_0xc9d9('0x96')]({'membername':_0x1e7e98[_0x5443d1][_0xc9d9('0x34')],'UserId':_0x1e7e98[_0x5443d1]['id'],'queue_name':_0x2f26c1['name'],'VoiceQueueId':_0x2f26c1['id'],'interface':_[_0xc9d9('0x7a')](_0x1e7e98[_0x5443d1]['interface'])?util['format']('SIP/%s',_0x1e7e98[_0x5443d1]['name']):_0x1e7e98[_0x5443d1][_0xc9d9('0x70')],'paused':_0x1e7e98[_0x5443d1][_0xc9d9('0x6f')]||![],'penalty':_0x1a04ae[_0xc9d9('0x50')][_0xc9d9('0x73')]||0x0}));}}return BPromise['all'](_0x742296);}})[_0xc9d9('0x26')](function(){return _0x19b948;})[_0xc9d9('0x26')](respondWithResult(_0x3111a7,null))[_0xc9d9('0x4a')](handleError(_0x3111a7,null));};exports[_0xc9d9('0x97')]=function(_0x426315,_0x5a2eb9,_0x209049){return db[_0xc9d9('0x36')]['find']({'where':{'id':_0x426315[_0xc9d9('0x4c')]['id']}})[_0xc9d9('0x26')](handleEntityNotFound(_0x5a2eb9,null))['then'](function(_0x312c9c){if(_0x312c9c){return _0x312c9c[_0xc9d9('0x97')](_0x426315[_0xc9d9('0x3a')][_0xc9d9('0x7f')])[_0xc9d9('0x26')](function(){if(_['isArray'](_0x426315[_0xc9d9('0x3a')][_0xc9d9('0x7f')])){for(var _0x3b5563=0x0;_0x3b5563<_0x426315[_0xc9d9('0x3a')][_0xc9d9('0x7f')][_0xc9d9('0x4d')];_0x3b5563+=0x1){socket[_0xc9d9('0x7d')](_0xc9d9('0x92'),{'UserId':Number(_0x426315['query'][_0xc9d9('0x7f')][_0x3b5563]),'VoiceQueueId':Number(_0x426315[_0xc9d9('0x4c')]['id'])});}}else{socket['emit'](_0xc9d9('0x92'),{'UserId':Number(_0x426315[_0xc9d9('0x3a')]['ids']),'VoiceQueueId':Number(_0x426315[_0xc9d9('0x4c')]['id'])});}});}})[_0xc9d9('0x26')](function(_0x7721f0){return db[_0xc9d9('0x79')][_0xc9d9('0x27')]({'where':{'VoiceQueueId':_0x426315['params']['id'],'UserId':_0x426315[_0xc9d9('0x3a')][_0xc9d9('0x7f')]}})['then'](function(){return _0x7721f0;});})['then'](respondWithStatusCode(_0x5a2eb9,null))[_0xc9d9('0x4a')](handleError(_0x5a2eb9,null));};exports['getAgents']=function(_0x2623f0,_0x283121,_0xf3d76d){var _0x27f3d9={};var _0x2f16a0={};var _0x1f29ea;var _0x4c3fda;return db[_0xc9d9('0x36')][_0xc9d9('0x5f')]({'where':{'id':_0x2623f0[_0xc9d9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x283121,null))[_0xc9d9('0x26')](function(_0x2cfceb){if(_0x2cfceb){_0x1f29ea=_0x2cfceb;_0x2f16a0[_0xc9d9('0x39')]=_[_0xc9d9('0x3b')](db[_0xc9d9('0x6d')][_0xc9d9('0x37')]);_0x2f16a0[_0xc9d9('0x3a')]=_[_0xc9d9('0x3b')](_0x2623f0[_0xc9d9('0x3a')]);_0x2f16a0[_0xc9d9('0x44')]=_['intersection'](_0x2f16a0[_0xc9d9('0x39')],_0x2f16a0['query']);_0x27f3d9[_0xc9d9('0x3e')]=_[_0xc9d9('0x3c')](_0x2f16a0[_0xc9d9('0x39')],qs[_0xc9d9('0x3d')](_0x2623f0['query'][_0xc9d9('0x3d')]));_0x27f3d9[_0xc9d9('0x3e')]=_0x27f3d9['attributes']['length']?_0x27f3d9[_0xc9d9('0x3e')]:_0x2f16a0['model'];_0x27f3d9[_0xc9d9('0x41')]=qs[_0xc9d9('0x42')](_0x2623f0[_0xc9d9('0x3a')][_0xc9d9('0x42')]);_0x27f3d9[_0xc9d9('0x43')]=qs['filters'](_[_0xc9d9('0x67')](_0x2623f0[_0xc9d9('0x3a')],_0x2f16a0['filters']));if(_0x2623f0['query']['filter']){_0x27f3d9[_0xc9d9('0x43')]=_[_0xc9d9('0x45')](_0x27f3d9[_0xc9d9('0x43')],{'$or':_['map'](_0x27f3d9[_0xc9d9('0x3e')],function(_0x11b856){var _0x14844f={};_0x14844f[_0x11b856]={'$like':'%'+_0x2623f0['query'][_0xc9d9('0x62')]+'%'};return _0x14844f;})});}_0x27f3d9=_[_0xc9d9('0x45')]({},_0x27f3d9,_0x2623f0[_0xc9d9('0x46')]);return _0x1f29ea[_0xc9d9('0x98')](_0x27f3d9);}})[_0xc9d9('0x26')](function(_0xdcb779){if(_0xdcb779){_0x4c3fda=_0xdcb779['length'];if(!_0x2623f0[_0xc9d9('0x3a')]['hasOwnProperty'](_0xc9d9('0x40'))){_0x27f3d9[_0xc9d9('0x21')]=qs[_0xc9d9('0x21')](_0x2623f0['query']['limit']);_0x27f3d9[_0xc9d9('0x1f')]=qs[_0xc9d9('0x1f')](_0x2623f0[_0xc9d9('0x3a')][_0xc9d9('0x1f')]);}return _0x1f29ea[_0xc9d9('0x98')](_0x27f3d9);}})[_0xc9d9('0x26')](function(_0x148363){if(_0x148363){return _0x148363?{'count':_0x4c3fda,'rows':_0x148363}:null;}})['then'](respondWithResult(_0x283121,null))[_0xc9d9('0x4a')](handleError(_0x283121,null));};exports[_0xc9d9('0x99')]=function(_0xa2c64b,_0x576ba3,_0x2b04e6){var _0x33897f={};var _0x32f945={};var _0x192e46;var _0x1b50b8;return db[_0xc9d9('0x36')][_0xc9d9('0x5f')]({'where':{'id':_0xa2c64b[_0xc9d9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x576ba3,null))['then'](function(_0x3b4488){if(_0x3b4488){_0x192e46=_0x3b4488;_0x32f945['model']=_[_0xc9d9('0x3b')](db[_0xc9d9('0x79')][_0xc9d9('0x37')]);_0x32f945[_0xc9d9('0x3a')]=_[_0xc9d9('0x3b')](_0xa2c64b[_0xc9d9('0x3a')]);_0x32f945[_0xc9d9('0x44')]=_[_0xc9d9('0x3c')](_0x32f945[_0xc9d9('0x39')],_0x32f945[_0xc9d9('0x3a')]);_0x33897f[_0xc9d9('0x3e')]=_[_0xc9d9('0x3c')](_0x32f945['model'],qs[_0xc9d9('0x3d')](_0xa2c64b['query']['fields']));_0x33897f['attributes']=_0x33897f['attributes'][_0xc9d9('0x4d')]?_0x33897f['attributes']:_0x32f945[_0xc9d9('0x39')];_0x33897f[_0xc9d9('0x41')]=qs[_0xc9d9('0x42')](_0xa2c64b[_0xc9d9('0x3a')]['sort']);_0x33897f[_0xc9d9('0x43')]=qs[_0xc9d9('0x44')](_[_0xc9d9('0x67')](_0xa2c64b['query'],_0x32f945[_0xc9d9('0x44')]));if(_0xa2c64b[_0xc9d9('0x3a')]['filter']){_0x33897f[_0xc9d9('0x43')]=_[_0xc9d9('0x45')](_0x33897f['where'],{'$or':_['map'](_0x33897f[_0xc9d9('0x3e')],function(_0x497105){var _0x172c30={};_0x172c30[_0x497105]={'$like':'%'+_0xa2c64b[_0xc9d9('0x3a')]['filter']+'%'};return _0x172c30;})});}_0x33897f=_['merge']({},_0x33897f,_0xa2c64b['options']);return _0x192e46[_0xc9d9('0x99')](_0x33897f);}})[_0xc9d9('0x26')](function(_0x411c5d){if(_0x411c5d){_0x1b50b8=_0x411c5d['length'];if(!_0xa2c64b['query'][_0xc9d9('0x3f')](_0xc9d9('0x40'))){_0x33897f[_0xc9d9('0x21')]=qs[_0xc9d9('0x21')](_0xa2c64b['query']['limit']);_0x33897f[_0xc9d9('0x1f')]=qs[_0xc9d9('0x1f')](_0xa2c64b[_0xc9d9('0x3a')][_0xc9d9('0x1f')]);}return _0x192e46[_0xc9d9('0x99')](_0x33897f);}})[_0xc9d9('0x26')](function(_0xfd9dce){return _0xfd9dce?{'count':_0x1b50b8,'rows':_0xfd9dce}:null;})[_0xc9d9('0x26')](respondWithResult(_0x576ba3,null))[_0xc9d9('0x4a')](handleError(_0x576ba3,null));};exports[_0xc9d9('0x9a')]=function(_0x198d27,_0x2a57da,_0x30959d){var _0x47002b={};var _0xb0441a={};var _0x514b4e;var _0x374dad;return db[_0xc9d9('0x36')][_0xc9d9('0x5f')]({'where':{'id':_0x198d27[_0xc9d9('0x4c')]['id']}})[_0xc9d9('0x26')](handleEntityNotFound(_0x2a57da,null))[_0xc9d9('0x26')](function(_0x3e31ab){if(_0x3e31ab){_0x514b4e=_0x3e31ab;_0xb0441a[_0xc9d9('0x39')]=_[_0xc9d9('0x3b')](db[_0xc9d9('0x9b')][_0xc9d9('0x37')]);_0xb0441a[_0xc9d9('0x3a')]=_[_0xc9d9('0x3b')](_0x198d27['query']);_0xb0441a['filters']=_[_0xc9d9('0x3c')](_0xb0441a['model'],_0xb0441a[_0xc9d9('0x3a')]);_0x47002b[_0xc9d9('0x3e')]=_['intersection'](_0xb0441a[_0xc9d9('0x39')],qs[_0xc9d9('0x3d')](_0x198d27[_0xc9d9('0x3a')][_0xc9d9('0x3d')]));_0x47002b[_0xc9d9('0x3e')]=_0x47002b['attributes']['length']?_0x47002b['attributes']:_0xb0441a[_0xc9d9('0x39')];_0x47002b[_0xc9d9('0x41')]=qs[_0xc9d9('0x42')](_0x198d27[_0xc9d9('0x3a')][_0xc9d9('0x42')]);_0x47002b[_0xc9d9('0x43')]=qs[_0xc9d9('0x44')](_[_0xc9d9('0x67')](_0x198d27[_0xc9d9('0x3a')],_0xb0441a[_0xc9d9('0x44')]));if(_0x198d27[_0xc9d9('0x3a')][_0xc9d9('0x62')]){_0x47002b[_0xc9d9('0x43')]=_[_0xc9d9('0x45')](_0x47002b['where'],{'$or':_['map'](_0x47002b[_0xc9d9('0x3e')],function(_0x2a8e97){var _0x1f36e0={};_0x1f36e0[_0x2a8e97]={'$like':'%'+_0x198d27[_0xc9d9('0x3a')][_0xc9d9('0x62')]+'%'};return _0x1f36e0;})});}_0x47002b=_[_0xc9d9('0x45')]({},_0x47002b,_0x198d27[_0xc9d9('0x46')]);return _0x514b4e[_0xc9d9('0x9a')](_0x47002b);}})[_0xc9d9('0x26')](function(_0x54ef5d){if(_0x54ef5d){_0x374dad=_0x54ef5d[_0xc9d9('0x4d')];if(!_0x198d27[_0xc9d9('0x3a')][_0xc9d9('0x3f')](_0xc9d9('0x40'))){_0x47002b['limit']=qs['limit'](_0x198d27['query']['limit']);_0x47002b[_0xc9d9('0x1f')]=qs[_0xc9d9('0x1f')](_0x198d27['query'][_0xc9d9('0x1f')]);}return _0x514b4e[_0xc9d9('0x9a')](_0x47002b);}})[_0xc9d9('0x26')](function(_0x15815d){if(_0x15815d){return _0x15815d?{'count':_0x374dad,'rows':_0x15815d}:null;}})[_0xc9d9('0x26')](respondWithResult(_0x2a57da,null))[_0xc9d9('0x4a')](handleError(_0x2a57da,null));};exports[_0xc9d9('0x9c')]=function(_0x53f57e,_0x2c49a3,_0x51b30c){var _0xe3dd42,_0x4655f2;return db[_0xc9d9('0x36')]['find']({'where':{'id':_0x53f57e[_0xc9d9('0x4c')]['id']}})[_0xc9d9('0x26')](handleEntityNotFound(_0x2c49a3,null))[_0xc9d9('0x26')](function(_0x1719e4){if(_0x1719e4){_0x4655f2=_0x1719e4;return _0x1719e4[_0xc9d9('0x9c')](_0x53f57e['body'][_0xc9d9('0x7f')],_[_0xc9d9('0x58')](_0x53f57e[_0xc9d9('0x50')],['ids','id'])||{});}return null;})['spread'](function(_0x33bafe){var _0x640ab5;_0xe3dd42=_0x33bafe||[];var _0x4ffb35=[];if(_0x33bafe){for(var _0x1dbc9a=0x0;_0x1dbc9a<_0x33bafe[_0xc9d9('0x4d')];_0x1dbc9a+=0x1){var _0x435f48=_0x33bafe[_0x1dbc9a]['get']({'plain':!![]});_0x4655f2['dialCheckDuplicateType']=_0x53f57e[_0xc9d9('0x50')][_0xc9d9('0x9d')]?_0x53f57e[_0xc9d9('0x50')]['dialCheckDuplicateType']:_0x4655f2[_0xc9d9('0x9d')];switch(_0x4655f2[_0xc9d9('0x9d')]){case _0xc9d9('0x9e'):_0x640ab5=squel[_0xc9d9('0x9f')]()[_0xc9d9('0xa0')]('cm_hopper')[_0xc9d9('0xa1')]([_0xc9d9('0xa2'),'scheduledAt',_0xc9d9('0xa3'),_0xc9d9('0xa4'),'VoiceQueueId',_0xc9d9('0x59'),_0xc9d9('0x5a')],squel[_0xc9d9('0x80')]()[_0xc9d9('0x81')](_0xc9d9('0xa2'),_0xc9d9('0xa2'))[_0xc9d9('0x81')]('NOW()','scheduledAt')[_0xc9d9('0x81')]('id',_0xc9d9('0xa3'))[_0xc9d9('0x81')](_0x435f48[_0xc9d9('0xa5')]['toString'](),'ListId')['field'](_0x53f57e['params']['id'][_0xc9d9('0x8b')](),'VoiceQueueId')['field']('NOW()',_0xc9d9('0x59'))[_0xc9d9('0x81')](_0xc9d9('0xa6'),_0xc9d9('0x5a'))[_0xc9d9('0x83')](_0xc9d9('0xa7'))[_0xc9d9('0x43')](_0xc9d9('0xa8'))['where'](_0xc9d9('0xa9'),_0x435f48['CmListId'][_0xc9d9('0x8b')]())['where'](_0xc9d9('0xaa'))[_0xc9d9('0x43')]('phone\x20NOT\x20IN\x20(?)',squel[_0xc9d9('0x80')]()[_0xc9d9('0x81')](_0xc9d9('0xab'))[_0xc9d9('0x83')]('cm_hopper_final')[_0xc9d9('0x43')](_0xc9d9('0x87'),_0x53f57e[_0xc9d9('0x4c')]['id'][_0xc9d9('0x8b')]()))[_0xc9d9('0x43')](_0xc9d9('0xac'),squel['select']()[_0xc9d9('0x81')](_0xc9d9('0xad'))[_0xc9d9('0x83')](_0xc9d9('0xae'))[_0xc9d9('0x43')](_0xc9d9('0x87'),_0x53f57e[_0xc9d9('0x4c')]['id'][_0xc9d9('0x8b')]())))['toString']();break;case _0xc9d9('0xaf'):_0x640ab5=squel[_0xc9d9('0x9f')]()[_0xc9d9('0xa0')](_0xc9d9('0xae'))['fromQuery'](['phone','scheduledAt',_0xc9d9('0xa3'),_0xc9d9('0xa4'),_0xc9d9('0x61'),_0xc9d9('0x59'),_0xc9d9('0x5a')],squel['select']()['field']('phone','phone')['field'](_0xc9d9('0xa6'),'scheduledAt')[_0xc9d9('0x81')]('id','ContactId')[_0xc9d9('0x81')](_0x435f48[_0xc9d9('0xa5')]['toString'](),_0xc9d9('0xa4'))['field'](_0x53f57e[_0xc9d9('0x4c')]['id']['toString'](),_0xc9d9('0x61'))['field']('NOW()',_0xc9d9('0x59'))[_0xc9d9('0x81')](_0xc9d9('0xa6'),_0xc9d9('0x5a'))[_0xc9d9('0x83')](_0xc9d9('0xa7'))['where'](_0xc9d9('0xa8'))[_0xc9d9('0x43')](_0xc9d9('0xa9'),_0x435f48[_0xc9d9('0xa5')][_0xc9d9('0x8b')]())[_0xc9d9('0x43')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xc9d9('0xac'),squel[_0xc9d9('0x80')]()[_0xc9d9('0x81')](_0xc9d9('0xad'))[_0xc9d9('0x83')](_0xc9d9('0xae'))[_0xc9d9('0x43')]('VoiceQueueId\x20=\x20?',_0x53f57e[_0xc9d9('0x4c')]['id'][_0xc9d9('0x8b')]())))[_0xc9d9('0x8b')]();break;default:_0x640ab5=squel[_0xc9d9('0x9f')]()['into']('cm_hopper')[_0xc9d9('0xa1')]([_0xc9d9('0xa2'),'scheduledAt',_0xc9d9('0xa3'),_0xc9d9('0xa4'),'VoiceQueueId',_0xc9d9('0x59'),_0xc9d9('0x5a')],squel[_0xc9d9('0x80')]()[_0xc9d9('0x81')](_0xc9d9('0xa2'),_0xc9d9('0xa2'))[_0xc9d9('0x81')](_0xc9d9('0xa6'),'scheduledAt')['field']('id',_0xc9d9('0xa3'))[_0xc9d9('0x81')](_0x435f48['CmListId'][_0xc9d9('0x8b')](),_0xc9d9('0xa4'))[_0xc9d9('0x81')](_0x53f57e[_0xc9d9('0x4c')]['id'][_0xc9d9('0x8b')](),_0xc9d9('0x61'))['field'](_0xc9d9('0xa6'),'createdAt')[_0xc9d9('0x81')](_0xc9d9('0xa6'),_0xc9d9('0x5a'))[_0xc9d9('0x83')](_0xc9d9('0xa7'))['where']('deletedAt\x20IS\x20NULL')[_0xc9d9('0x43')](_0xc9d9('0xa9'),_0x435f48[_0xc9d9('0xa5')][_0xc9d9('0x8b')]())[_0xc9d9('0x43')](_0xc9d9('0xaa')))[_0xc9d9('0x8b')]();}_0x4ffb35[_0xc9d9('0x89')](db[_0xc9d9('0x8a')][_0xc9d9('0x3a')](_0x640ab5));}return BPromise[_0xc9d9('0xb0')](_0x4ffb35);}})[_0xc9d9('0x26')](function(){return _0xe3dd42;})[_0xc9d9('0x26')](respondWithResult(_0x2c49a3,null))[_0xc9d9('0x4a')](handleError(_0x2c49a3,null));};exports['removeLists']=function(_0x54e406,_0xf9551f,_0x2771ec){return db[_0xc9d9('0x36')][_0xc9d9('0x4f')]({'where':{'id':_0x54e406['params']['id']}})['then'](handleEntityNotFound(_0xf9551f,null))[_0xc9d9('0x26')](function(_0x868af5){if(_0x868af5){return _0x868af5[_0xc9d9('0xb1')](_0x54e406['query'][_0xc9d9('0x7f')]);}})[_0xc9d9('0x26')](function(_0x4fa98b){if(_0x4fa98b){return db[_0xc9d9('0x60')][_0xc9d9('0x27')]({'where':{'ListId':_0x54e406['query'][_0xc9d9('0x7f')],'VoiceQueueId':_0x54e406[_0xc9d9('0x4c')]['id']}})[_0xc9d9('0x26')](function(){return _0x4fa98b;});}})[_0xc9d9('0x26')](respondWithStatusCode(_0xf9551f,null))[_0xc9d9('0x4a')](handleError(_0xf9551f,null));};exports['getBlackLists']=function(_0x44299f,_0x2c1074,_0x1a0d19){var _0x133383={};var _0x236f98={};var _0x18c362;var _0x38e30c;return db[_0xc9d9('0x36')][_0xc9d9('0x5f')]({'where':{'id':_0x44299f['params']['id']}})[_0xc9d9('0x26')](handleEntityNotFound(_0x2c1074,null))['then'](function(_0x41be18){if(_0x41be18){_0x18c362=_0x41be18;_0x236f98['model']=_[_0xc9d9('0x3b')](db[_0xc9d9('0x9b')][_0xc9d9('0x37')]);_0x236f98[_0xc9d9('0x3a')]=_['keys'](_0x44299f[_0xc9d9('0x3a')]);_0x236f98[_0xc9d9('0x44')]=_[_0xc9d9('0x3c')](_0x236f98[_0xc9d9('0x39')],_0x236f98['query']);_0x133383[_0xc9d9('0x3e')]=_[_0xc9d9('0x3c')](_0x236f98[_0xc9d9('0x39')],qs[_0xc9d9('0x3d')](_0x44299f[_0xc9d9('0x3a')][_0xc9d9('0x3d')]));_0x133383['attributes']=_0x133383['attributes'][_0xc9d9('0x4d')]?_0x133383[_0xc9d9('0x3e')]:_0x236f98[_0xc9d9('0x39')];_0x133383[_0xc9d9('0x41')]=qs[_0xc9d9('0x42')](_0x44299f[_0xc9d9('0x3a')][_0xc9d9('0x42')]);_0x133383[_0xc9d9('0x43')]=qs[_0xc9d9('0x44')](_[_0xc9d9('0x67')](_0x44299f[_0xc9d9('0x3a')],_0x236f98['filters']));if(_0x44299f[_0xc9d9('0x3a')][_0xc9d9('0x62')]){_0x133383[_0xc9d9('0x43')]=_['merge'](_0x133383[_0xc9d9('0x43')],{'$or':_[_0xc9d9('0x2d')](_0x133383[_0xc9d9('0x3e')],function(_0xc265e0){var _0x2c456e={};_0x2c456e[_0xc265e0]={'$like':'%'+_0x44299f[_0xc9d9('0x3a')][_0xc9d9('0x62')]+'%'};return _0x2c456e;})});}_0x133383=_[_0xc9d9('0x45')]({},_0x133383,_0x44299f[_0xc9d9('0x46')]);return _0x18c362['getBlackLists'](_0x133383);}})[_0xc9d9('0x26')](function(_0xe2bef3){if(_0xe2bef3){_0x38e30c=_0xe2bef3[_0xc9d9('0x4d')];if(!_0x44299f[_0xc9d9('0x3a')][_0xc9d9('0x3f')]('nolimit')){_0x133383[_0xc9d9('0x21')]=qs[_0xc9d9('0x21')](_0x44299f['query'][_0xc9d9('0x21')]);_0x133383[_0xc9d9('0x1f')]=qs[_0xc9d9('0x1f')](_0x44299f['query'][_0xc9d9('0x1f')]);}return _0x18c362[_0xc9d9('0xb2')](_0x133383);}})[_0xc9d9('0x26')](function(_0x316325){if(_0x316325){return _0x316325?{'count':_0x38e30c,'rows':_0x316325}:null;}})[_0xc9d9('0x26')](respondWithResult(_0x2c1074,null))[_0xc9d9('0x4a')](handleError(_0x2c1074,null));};exports[_0xc9d9('0xb3')]=function(_0x4c5d2d,_0x4d8f92,_0x475ea1){var _0x193e71,_0x2650b4;return db[_0xc9d9('0x36')][_0xc9d9('0x4f')]({'where':{'id':_0x4c5d2d[_0xc9d9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4d8f92,null))[_0xc9d9('0x26')](function(_0x21ffb9){if(_0x21ffb9){_0x2650b4=_0x21ffb9;return _0x21ffb9[_0xc9d9('0xb3')](_0x4c5d2d['body'][_0xc9d9('0x7f')],_[_0xc9d9('0x58')](_0x4c5d2d['body'],['ids','id'])||{});}return null;})[_0xc9d9('0x94')](function(_0x15d76d){var _0x2f9594;_0x193e71=_0x15d76d||[];var _0x4a281c=[];if(_0x15d76d){for(var _0x5193ad=0x0;_0x5193ad<_0x15d76d[_0xc9d9('0x4d')];_0x5193ad+=0x1){var _0xcc0d95=_0x15d76d[_0x5193ad][_0xc9d9('0x28')]({'plain':!![]});_0x2f9594=squel[_0xc9d9('0x9f')]()[_0xc9d9('0xa0')]('cm_hopper_black')[_0xc9d9('0xa1')]([_0xc9d9('0xa2'),_0xc9d9('0xa3'),'ListId',_0xc9d9('0x61'),'createdAt',_0xc9d9('0x5a')],squel[_0xc9d9('0x80')]()[_0xc9d9('0x81')](_0xc9d9('0xa2'),_0xc9d9('0xa2'))[_0xc9d9('0x81')]('id',_0xc9d9('0xa3'))[_0xc9d9('0x81')](_0xcc0d95[_0xc9d9('0xa5')][_0xc9d9('0x8b')](),_0xc9d9('0xa4'))[_0xc9d9('0x81')](_0x4c5d2d[_0xc9d9('0x4c')]['id'][_0xc9d9('0x8b')](),_0xc9d9('0x61'))[_0xc9d9('0x81')](_0xc9d9('0xa6'),_0xc9d9('0x59'))[_0xc9d9('0x81')](_0xc9d9('0xa6'),'updatedAt')[_0xc9d9('0x83')](_0xc9d9('0xa7'))['where'](_0xc9d9('0xa8'))['where']('ListId\x20=\x20?',_0xcc0d95[_0xc9d9('0xa5')][_0xc9d9('0x8b')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0xc9d9('0x8b')]();_0x4a281c['push'](db[_0xc9d9('0x8a')][_0xc9d9('0x3a')](_0x2f9594));}return BPromise[_0xc9d9('0xb0')](_0x4a281c);}})[_0xc9d9('0x26')](function(){return _0x193e71;})[_0xc9d9('0x26')](respondWithResult(_0x4d8f92,null))['catch'](handleError(_0x4d8f92,null));};exports[_0xc9d9('0xb4')]=function(_0x5420d9,_0x4ecded,_0x2f857b){return db[_0xc9d9('0x36')][_0xc9d9('0x4f')]({'where':{'id':_0x5420d9[_0xc9d9('0x4c')]['id']}})[_0xc9d9('0x26')](handleEntityNotFound(_0x4ecded,null))[_0xc9d9('0x26')](function(_0x1db4c0){if(_0x1db4c0){return _0x1db4c0[_0xc9d9('0xb4')](_0x5420d9['query'][_0xc9d9('0x7f')]);}})[_0xc9d9('0x26')](function(_0x26af82){if(_0x26af82){return db[_0xc9d9('0x6a')][_0xc9d9('0x27')]({'where':{'ListId':_0x5420d9['query'][_0xc9d9('0x7f')],'VoiceQueueId':_0x5420d9[_0xc9d9('0x4c')]['id']}})[_0xc9d9('0x26')](function(){return _0x26af82;});}})[_0xc9d9('0x26')](respondWithStatusCode(_0x4ecded,null))[_0xc9d9('0x4a')](handleError(_0x4ecded,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 1dbc9f2..8d88e2a 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 _0x4742=['save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners'];(function(_0x2b7f97,_0x3fe5c6){var _0x3c2339=function(_0x12e36c){while(--_0x12e36c){_0x2b7f97['push'](_0x2b7f97['shift']());}};_0x3c2339(++_0x3fe5c6);}(_0x4742,0xf9));var _0x2474=function(_0x39f97c,_0x43cfc3){_0x39f97c=_0x39f97c-0x0;var _0x5c3e1b=_0x4742[_0x39f97c];return _0x5c3e1b;};'use strict';var EventEmitter=require(_0x2474('0x0'));var VoiceQueue=require(_0x2474('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x2474('0x2')](0x0);var events={'afterCreate':_0x2474('0x3'),'afterUpdate':_0x2474('0x4'),'afterDestroy':_0x2474('0x5')};function emitEvent(_0x1b1ec1){return function(_0x45b858,_0x1452f9,_0x514a06){VoiceQueueEvents[_0x2474('0x6')](_0x1b1ec1+':'+_0x45b858['id'],_0x45b858);VoiceQueueEvents[_0x2474('0x6')](_0x1b1ec1,_0x45b858);_0x514a06(null);};}for(var e in events){if(events[_0x2474('0x7')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x2474('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0x422b=['exports','events','../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x2b0cca,_0x1cc63d){var _0x5937f6=function(_0x1a052f){while(--_0x1a052f){_0x2b0cca['push'](_0x2b0cca['shift']());}};_0x5937f6(++_0x1cc63d);}(_0x422b,0x16c));var _0xb422=function(_0x59d942,_0x557020){_0x59d942=_0x59d942-0x0;var _0x314dad=_0x422b[_0x59d942];return _0x314dad;};'use strict';var EventEmitter=require(_0xb422('0x0'));var VoiceQueue=require(_0xb422('0x1'))['db'][_0xb422('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xb422('0x3')](0x0);var events={'afterCreate':_0xb422('0x4'),'afterUpdate':_0xb422('0x5'),'afterDestroy':_0xb422('0x6')};function emitEvent(_0x201723){return function(_0xe744c,_0x2cf03b,_0x572449){VoiceQueueEvents[_0xb422('0x7')](_0x201723+':'+_0xe744c['id'],_0xe744c);VoiceQueueEvents[_0xb422('0x7')](_0x201723,_0xe744c);_0x572449(null);};}for(var e in events){if(events[_0xb422('0x8')](e)){var event=events[e];VoiceQueue[_0xb422('0x9')](e,emitEvent(event));}}module[_0xb422('0xa')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 3a2948d..231e759 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(_0x31baf0,_0x282cd4){var _0x2ab6c5=function(_0x3f263f){while(--_0x3f263f){_0x31baf0['push'](_0x31baf0['shift']());}};_0x2ab6c5(++_0x282cd4);}(_0x34e8,0x12c));var _0x834e=function(_0x31f685,_0x3a5faa){_0x31f685=_0x31f685-0x0;var _0x423551=_0x34e8[_0x31f685];return _0x423551;};'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 _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x525509,_0x3af854){var _0x492648=function(_0x549b18){while(--_0x549b18){_0x525509['push'](_0x525509['shift']());}};_0x492648(++_0x3af854);}(_0x008c,0x188));var _0xc008=function(_0x4e82bb,_0x4c39d5){_0x4e82bb=_0x4e82bb-0x0;var _0x1b5ac5=_0x008c[_0x4e82bb];return _0x1b5ac5;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('VoiceQueue',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 3a769c8..a021d89 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 _0xc068=['find','ShowVoiceQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceQueue','findAll','options','raw','where','attributes','limit','map','include','model','then','debug','GetVoiceQueue'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xc068,0x152));var _0x8c06=function(_0x184ade,_0x4e5ae7){_0x184ade=_0x184ade-0x0;var _0x4cbae8=_0xc068[_0x184ade];return _0x4cbae8;};'use strict';var _=require('lodash');var util=require(_0x8c06('0x0'));var moment=require(_0x8c06('0x1'));var BPromise=require(_0x8c06('0x2'));var rs=require(_0x8c06('0x3'));var fs=require('fs');var Redis=require(_0x8c06('0x4'));var db=require(_0x8c06('0x5'))['db'];var utils=require(_0x8c06('0x6'));var logger=require('../../config/logger')(_0x8c06('0x7'));var config=require(_0x8c06('0x8'));var jayson=require(_0x8c06('0x9'));var client=jayson[_0x8c06('0xa')][_0x8c06('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x8c06('0xc')],{'host':_0x8c06('0xd'),'port':0x18eb});var socket=require(_0x8c06('0xe'))(new Redis(config[_0x8c06('0xc')]));require('./voiceQueue.socket')[_0x8c06('0xf')](socket);function respondWithRpcPromise(_0x25dd3d,_0x52b610,_0x1ec282){return new BPromise(function(_0x3ea1fe,_0x8c6ee){return client[_0x8c06('0x10')](_0x25dd3d,_0x1ec282)['then'](function(_0x4ea9ad){logger[_0x8c06('0x11')](_0x8c06('0x12'),_0x52b610,_0x8c06('0x13'));logger['debug'](_0x8c06('0x14'),_0x52b610,_0x8c06('0x13'),JSON[_0x8c06('0x15')](_0x4ea9ad));if(_0x4ea9ad[_0x8c06('0x16')]){if(_0x4ea9ad[_0x8c06('0x16')][_0x8c06('0x17')]===0x1f4){logger[_0x8c06('0x16')](_0x8c06('0x12'),_0x52b610,_0x4ea9ad[_0x8c06('0x16')][_0x8c06('0x18')]);return _0x8c6ee(_0x4ea9ad['error'][_0x8c06('0x18')]);}logger[_0x8c06('0x16')](_0x8c06('0x12'),_0x52b610,_0x4ea9ad[_0x8c06('0x16')][_0x8c06('0x18')]);return _0x3ea1fe(_0x4ea9ad[_0x8c06('0x16')]['message']);}else{logger[_0x8c06('0x11')](_0x8c06('0x12'),_0x52b610,_0x8c06('0x13'));_0x3ea1fe(_0x4ea9ad[_0x8c06('0x19')][_0x8c06('0x18')]);}})[_0x8c06('0x1a')](function(_0x29c7ed){logger[_0x8c06('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x52b610,_0x29c7ed);_0x8c6ee(_0x29c7ed);});});}exports['GetVoiceQueue']=function(_0x46869e){var _0x256d82=this;return new Promise(function(_0x330c18,_0x5ae795){return db[_0x8c06('0x1b')][_0x8c06('0x1c')]({'raw':_0x46869e['options']?_0x46869e[_0x8c06('0x1d')][_0x8c06('0x1e')]===undefined?!![]:![]:!![],'where':_0x46869e['options']?_0x46869e[_0x8c06('0x1d')][_0x8c06('0x1f')]||null:null,'attributes':_0x46869e['options']?_0x46869e[_0x8c06('0x1d')][_0x8c06('0x20')]||null:null,'limit':_0x46869e['options']?_0x46869e[_0x8c06('0x1d')][_0x8c06('0x21')]||null:null,'include':_0x46869e[_0x8c06('0x1d')]?_0x46869e[_0x8c06('0x1d')]['include']?_[_0x8c06('0x22')](_0x46869e['options']['include'],function(_0x516e85){return{'model':db[_0x516e85['model']],'as':_0x516e85['as'],'attributes':_0x516e85[_0x8c06('0x20')],'include':_0x516e85[_0x8c06('0x23')]?_[_0x8c06('0x22')](_0x516e85['include'],function(_0x3520ff){return{'model':db[_0x3520ff[_0x8c06('0x24')]],'as':_0x3520ff['as'],'attributes':_0x3520ff[_0x8c06('0x20')],'include':_0x3520ff[_0x8c06('0x23')]?_['map'](_0x3520ff['include'],function(_0x3fb90c){return{'model':db[_0x3fb90c[_0x8c06('0x24')]],'as':_0x3fb90c['as'],'attributes':_0x3fb90c[_0x8c06('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8c06('0x25')](function(_0x714c65){logger[_0x8c06('0x11')]('GetVoiceQueue',_0x46869e);logger[_0x8c06('0x26')](_0x8c06('0x27'),_0x46869e,JSON['stringify'](_0x714c65));_0x330c18(_0x714c65);})[_0x8c06('0x1a')](function(_0x428d0e){logger[_0x8c06('0x16')](_0x8c06('0x27'),_0x428d0e[_0x8c06('0x18')],_0x46869e);_0x5ae795(_0x256d82[_0x8c06('0x16')](0x1f4,_0x428d0e[_0x8c06('0x18')]));});});};exports['ShowVoiceQueue']=function(_0x22b0a9){var _0x257d35=this;return new Promise(function(_0x9c7548,_0x22bb71){return db['VoiceQueue'][_0x8c06('0x28')]({'raw':_0x22b0a9[_0x8c06('0x1d')]?_0x22b0a9[_0x8c06('0x1d')][_0x8c06('0x1e')]===undefined?!![]:![]:!![],'where':_0x22b0a9[_0x8c06('0x1d')]?_0x22b0a9[_0x8c06('0x1d')][_0x8c06('0x1f')]||null:null,'attributes':_0x22b0a9[_0x8c06('0x1d')]?_0x22b0a9[_0x8c06('0x1d')]['attributes']||null:null,'include':_0x22b0a9[_0x8c06('0x1d')]?_0x22b0a9[_0x8c06('0x1d')][_0x8c06('0x23')]?_['map'](_0x22b0a9[_0x8c06('0x1d')]['include'],function(_0x340507){return{'model':db[_0x340507[_0x8c06('0x24')]],'as':_0x340507['as'],'attributes':_0x340507[_0x8c06('0x20')],'include':_0x340507[_0x8c06('0x23')]?_['map'](_0x340507['include'],function(_0x5abda7){return{'model':db[_0x5abda7[_0x8c06('0x24')]],'as':_0x5abda7['as'],'attributes':_0x5abda7['attributes'],'include':_0x5abda7['include']?_[_0x8c06('0x22')](_0x5abda7[_0x8c06('0x23')],function(_0x47ed2d){return{'model':db[_0x47ed2d[_0x8c06('0x24')]],'as':_0x47ed2d['as'],'attributes':_0x47ed2d[_0x8c06('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8c06('0x25')](function(_0x5c72df){logger[_0x8c06('0x11')](_0x8c06('0x29'),_0x22b0a9);logger[_0x8c06('0x26')]('ShowVoiceQueue',_0x22b0a9,JSON[_0x8c06('0x15')](_0x5c72df));_0x9c7548(_0x5c72df);})['catch'](function(_0x594c22){logger[_0x8c06('0x16')](_0x8c06('0x29'),_0x594c22['message'],_0x22b0a9);_0x22bb71(_0x257d35[_0x8c06('0x16')](0x1f4,_0x594c22['message']));});});}; \ No newline at end of file +var _0x251d=['ShowVoiceQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./voiceQueue.socket','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceQueue','VoiceQueue','findAll','options','where','attributes','limit','map','model','include','catch','find','raw'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x251d,0x149));var _0xd251=function(_0x217131,_0x28e96b){_0x217131=_0x217131-0x0;var _0x2d3411=_0x251d[_0x217131];return _0x2d3411;};'use strict';var _=require('lodash');var util=require(_0xd251('0x0'));var moment=require(_0xd251('0x1'));var BPromise=require(_0xd251('0x2'));var rs=require(_0xd251('0x3'));var fs=require('fs');var Redis=require(_0xd251('0x4'));var db=require(_0xd251('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd251('0x6'))(_0xd251('0x7'));var config=require(_0xd251('0x8'));var jayson=require(_0xd251('0x9'));var client=jayson[_0xd251('0xa')][_0xd251('0xb')]({'port':0x232a});config['redis']=_[_0xd251('0xc')](config[_0xd251('0xd')],{'host':_0xd251('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd251('0xd')]));require(_0xd251('0xf'))['register'](socket);function respondWithRpcPromise(_0x3fafa9,_0x2ebf8d,_0x19ab04){return new BPromise(function(_0x119baa,_0x17eba9){return client['request'](_0x3fafa9,_0x19ab04)[_0xd251('0x10')](function(_0x5c2b38){logger[_0xd251('0x11')](_0xd251('0x12'),_0x2ebf8d,_0xd251('0x13'));logger[_0xd251('0x14')](_0xd251('0x15'),_0x2ebf8d,_0xd251('0x13'),JSON[_0xd251('0x16')](_0x5c2b38));if(_0x5c2b38['error']){if(_0x5c2b38[_0xd251('0x17')][_0xd251('0x18')]===0x1f4){logger[_0xd251('0x17')](_0xd251('0x12'),_0x2ebf8d,_0x5c2b38['error'][_0xd251('0x19')]);return _0x17eba9(_0x5c2b38[_0xd251('0x17')][_0xd251('0x19')]);}logger[_0xd251('0x17')](_0xd251('0x12'),_0x2ebf8d,_0x5c2b38[_0xd251('0x17')][_0xd251('0x19')]);return _0x119baa(_0x5c2b38[_0xd251('0x17')][_0xd251('0x19')]);}else{logger[_0xd251('0x11')](_0xd251('0x12'),_0x2ebf8d,'request\x20sent');_0x119baa(_0x5c2b38[_0xd251('0x1a')][_0xd251('0x19')]);}})['catch'](function(_0x8ffd42){logger[_0xd251('0x17')](_0xd251('0x12'),_0x2ebf8d,_0x8ffd42);_0x17eba9(_0x8ffd42);});});}exports[_0xd251('0x1b')]=function(_0x2d9f91){var _0xb53a2=this;return new Promise(function(_0x410a21,_0x36b751){return db[_0xd251('0x1c')][_0xd251('0x1d')]({'raw':_0x2d9f91[_0xd251('0x1e')]?_0x2d9f91[_0xd251('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x2d9f91['options']?_0x2d9f91[_0xd251('0x1e')][_0xd251('0x1f')]||null:null,'attributes':_0x2d9f91[_0xd251('0x1e')]?_0x2d9f91[_0xd251('0x1e')][_0xd251('0x20')]||null:null,'limit':_0x2d9f91[_0xd251('0x1e')]?_0x2d9f91['options'][_0xd251('0x21')]||null:null,'include':_0x2d9f91[_0xd251('0x1e')]?_0x2d9f91[_0xd251('0x1e')]['include']?_[_0xd251('0x22')](_0x2d9f91[_0xd251('0x1e')]['include'],function(_0x473495){return{'model':db[_0x473495[_0xd251('0x23')]],'as':_0x473495['as'],'attributes':_0x473495[_0xd251('0x20')],'include':_0x473495[_0xd251('0x24')]?_[_0xd251('0x22')](_0x473495[_0xd251('0x24')],function(_0x50a5c1){return{'model':db[_0x50a5c1['model']],'as':_0x50a5c1['as'],'attributes':_0x50a5c1[_0xd251('0x20')],'include':_0x50a5c1[_0xd251('0x24')]?_[_0xd251('0x22')](_0x50a5c1[_0xd251('0x24')],function(_0x24a0dc){return{'model':db[_0x24a0dc[_0xd251('0x23')]],'as':_0x24a0dc['as'],'attributes':_0x24a0dc[_0xd251('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd251('0x10')](function(_0x1a7371){logger[_0xd251('0x11')](_0xd251('0x1b'),_0x2d9f91);logger[_0xd251('0x14')](_0xd251('0x1b'),_0x2d9f91,JSON['stringify'](_0x1a7371));_0x410a21(_0x1a7371);})[_0xd251('0x25')](function(_0x5e2f5a){logger['error'](_0xd251('0x1b'),_0x5e2f5a[_0xd251('0x19')],_0x2d9f91);_0x36b751(_0xb53a2[_0xd251('0x17')](0x1f4,_0x5e2f5a[_0xd251('0x19')]));});});};exports['ShowVoiceQueue']=function(_0x57fbf6){var _0x435a85=this;return new Promise(function(_0x43e094,_0x3d225f){return db[_0xd251('0x1c')][_0xd251('0x26')]({'raw':_0x57fbf6[_0xd251('0x1e')]?_0x57fbf6[_0xd251('0x1e')][_0xd251('0x27')]===undefined?!![]:![]:!![],'where':_0x57fbf6['options']?_0x57fbf6[_0xd251('0x1e')][_0xd251('0x1f')]||null:null,'attributes':_0x57fbf6[_0xd251('0x1e')]?_0x57fbf6[_0xd251('0x1e')][_0xd251('0x20')]||null:null,'include':_0x57fbf6['options']?_0x57fbf6[_0xd251('0x1e')][_0xd251('0x24')]?_[_0xd251('0x22')](_0x57fbf6[_0xd251('0x1e')][_0xd251('0x24')],function(_0x12594b){return{'model':db[_0x12594b['model']],'as':_0x12594b['as'],'attributes':_0x12594b[_0xd251('0x20')],'include':_0x12594b['include']?_[_0xd251('0x22')](_0x12594b['include'],function(_0x1c3f90){return{'model':db[_0x1c3f90['model']],'as':_0x1c3f90['as'],'attributes':_0x1c3f90[_0xd251('0x20')],'include':_0x1c3f90[_0xd251('0x24')]?_[_0xd251('0x22')](_0x1c3f90['include'],function(_0x5e2b6a){return{'model':db[_0x5e2b6a[_0xd251('0x23')]],'as':_0x5e2b6a['as'],'attributes':_0x5e2b6a['attributes']};}):[]};}):[]};}):[]:[]})[_0xd251('0x10')](function(_0x5d98c2){logger[_0xd251('0x11')]('ShowVoiceQueue',_0x57fbf6);logger[_0xd251('0x14')]('ShowVoiceQueue',_0x57fbf6,JSON[_0xd251('0x16')](_0x5d98c2));_0x43e094(_0x5d98c2);})['catch'](function(_0x14d5e1){logger['error'](_0xd251('0x28'),_0x14d5e1[_0xd251('0x19')],_0x57fbf6);_0x3d225f(_0x435a85['error'](0x1f4,_0x14d5e1[_0xd251('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index d0aed44..be0188b 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 _0x96cc=['remove','update','emit','removeListener','length','voiceQueue:','save'];(function(_0x2becba,_0x4ea656){var _0x90b5dd=function(_0x26ae2b){while(--_0x26ae2b){_0x2becba['push'](_0x2becba['shift']());}};_0x90b5dd(++_0x4ea656);}(_0x96cc,0x1db));var _0xc96c=function(_0x323021,_0x30f030){_0x323021=_0x323021-0x0;var _0x52cb3e=_0x96cc[_0x323021];return _0x52cb3e;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xc96c('0x0'),_0xc96c('0x1'),_0xc96c('0x2')];function createListener(_0x1e7e9f,_0x46f075){return function(_0x40f2ae){_0x46f075[_0xc96c('0x3')](_0x1e7e9f,_0x40f2ae);};}function removeListener(_0x49f148,_0xd56bb1){return function(){VoiceQueueEvents[_0xc96c('0x4')](_0x49f148,_0xd56bb1);};}exports['register']=function(_0x41146b){for(var _0x1eb4b3=0x0,_0x348a08=events[_0xc96c('0x5')];_0x1eb4b3<_0x348a08;_0x1eb4b3++){var _0x14ae63=events[_0x1eb4b3];var _0x407f81=createListener(_0xc96c('0x6')+_0x14ae63,_0x41146b);VoiceQueueEvents['on'](_0x14ae63,_0x407f81);}}; \ No newline at end of file +var _0x1183=['removeListener','voiceQueue:','./voiceQueue.events','save','remove','emit'];(function(_0x41149f,_0x317610){var _0x515481=function(_0x377330){while(--_0x377330){_0x41149f['push'](_0x41149f['shift']());}};_0x515481(++_0x317610);}(_0x1183,0x1d6));var _0x3118=function(_0x47e3f8,_0x517bcd){_0x47e3f8=_0x47e3f8-0x0;var _0x4742d5=_0x1183[_0x47e3f8];return _0x4742d5;};'use strict';var VoiceQueueEvents=require(_0x3118('0x0'));var events=[_0x3118('0x1'),_0x3118('0x2'),'update'];function createListener(_0xd2c594,_0x319f42){return function(_0x477207){_0x319f42[_0x3118('0x3')](_0xd2c594,_0x477207);};}function removeListener(_0x26d81a,_0x799dae){return function(){VoiceQueueEvents[_0x3118('0x4')](_0x26d81a,_0x799dae);};}exports['register']=function(_0xcf0f1f){for(var _0x52e022=0x0,_0x12330f=events['length'];_0x52e022<_0x12330f;_0x52e022++){var _0x4f3d6f=events[_0x52e022];var _0x31ba2f=createListener(_0x3118('0x5')+_0x4f3d6f,_0xcf0f1f);VoiceQueueEvents['on'](_0x4f3d6f,_0x31ba2f);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 0e2e06d..2d43e76 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 _0xb9dd=['getVoiceQueuesReport','/:id','show','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','/index'];(function(_0x1a2493,_0x4ee32b){var _0x6639ff=function(_0x14e2a6){while(--_0x14e2a6){_0x1a2493['push'](_0x1a2493['shift']());}};_0x6639ff(++_0x4ee32b);}(_0xb9dd,0x197));var _0xdb9d=function(_0x451ede,_0x1d14b1){_0x451ede=_0x451ede-0x0;var _0x1a910d=_0xb9dd[_0x451ede];return _0x1a910d;};'use strict';var multer=require(_0xdb9d('0x0'));var util=require(_0xdb9d('0x1'));var path=require(_0xdb9d('0x2'));var timeout=require(_0xdb9d('0x3'));var express=require(_0xdb9d('0x4'));var router=express['Router']();var fs_extra=require(_0xdb9d('0x5'));var auth=require(_0xdb9d('0x6'));var interaction=require(_0xdb9d('0x7'));var config=require(_0xdb9d('0x8'));var controller=require(_0xdb9d('0x9'));router[_0xdb9d('0xa')]('/',auth[_0xdb9d('0xb')](),controller['index']);router[_0xdb9d('0xa')]('/describe',auth[_0xdb9d('0xb')](),controller['describe']);router[_0xdb9d('0xa')](_0xdb9d('0xc'),auth['isAuthenticated'](),controller[_0xdb9d('0xd')]);router[_0xdb9d('0xa')](_0xdb9d('0xe'),auth[_0xdb9d('0xb')](),controller[_0xdb9d('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xdb9d('0x10')](_0xdb9d('0xe'),auth[_0xdb9d('0xb')](),controller[_0xdb9d('0x11')]);router[_0xdb9d('0x12')]('/:id',auth[_0xdb9d('0xb')](),controller['destroy']);module[_0xdb9d('0x13')]=router; \ No newline at end of file +var _0x993b=['update','delete','destroy','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','/:id','post','put'];(function(_0x49971b,_0x59f718){var _0x377eff=function(_0x1e4582){while(--_0x1e4582){_0x49971b['push'](_0x49971b['shift']());}};_0x377eff(++_0x59f718);}(_0x993b,0x16b));var _0xb993=function(_0x37c9ec,_0x5d6f42){_0x37c9ec=_0x37c9ec-0x0;var _0x5d9bd5=_0x993b[_0x37c9ec];return _0x5d9bd5;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xb993('0x0'));var express=require(_0xb993('0x1'));var router=express[_0xb993('0x2')]();var fs_extra=require(_0xb993('0x3'));var auth=require(_0xb993('0x4'));var interaction=require(_0xb993('0x5'));var config=require('../../config/environment');var controller=require(_0xb993('0x6'));router[_0xb993('0x7')]('/',auth[_0xb993('0x8')](),controller[_0xb993('0x9')]);router[_0xb993('0x7')](_0xb993('0xa'),auth['isAuthenticated'](),controller[_0xb993('0xb')]);router['get'](_0xb993('0xc'),auth[_0xb993('0x8')](),controller[_0xb993('0xd')]);router[_0xb993('0x7')](_0xb993('0xe'),auth[_0xb993('0x8')](),controller['show']);router[_0xb993('0xf')]('/',auth[_0xb993('0x8')](),controller['create']);router[_0xb993('0x10')](_0xb993('0xe'),auth[_0xb993('0x8')](),controller[_0xb993('0x11')]);router[_0xb993('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xb993('0x13')]);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 499efa8..a357dd7 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 _0xbca9=['sequelize','exports','STRING','DATE','getDataValue','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x1b8d7d,_0x47891f){var _0x855e6b=function(_0x1fe2ea){while(--_0x1fe2ea){_0x1b8d7d['push'](_0x1b8d7d['shift']());}};_0x855e6b(++_0x47891f);}(_0xbca9,0x159));var _0x9bca=function(_0x1f2d5d,_0x4357f6){_0x1f2d5d=_0x1f2d5d-0x0;var _0x2797a3=_0xbca9[_0x1f2d5d];return _0x2797a3;};'use strict';var Sequelize=require(_0x9bca('0x0'));var moment=require('moment');module[_0x9bca('0x1')]={'type':{'type':Sequelize[_0x9bca('0x2')]},'uniqueid':{'type':Sequelize[_0x9bca('0x2')]},'calleridnum':{'type':Sequelize[_0x9bca('0x2')]},'calleridname':{'type':Sequelize[_0x9bca('0x2')]},'queue':{'type':Sequelize[_0x9bca('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x9bca('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x540111){var _0x5479e6=moment(_0x540111);var _0x41848e=moment(this[_0x9bca('0x4')]('queuecallerjoinAt'))[_0x9bca('0x5')](_0x9bca('0x6'));var _0x44dd9e=_0x5479e6[_0x9bca('0x7')](_0x41848e,_0x9bca('0x8'));this[_0x9bca('0x9')](_0x9bca('0xa'),_0x540111);this[_0x9bca('0x9')](_0x9bca('0xb'),_0x44dd9e||null);}},'position':{'type':Sequelize[_0x9bca('0xc')]},'count':{'type':Sequelize[_0x9bca('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x9bca('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x9bca('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x9bca('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x9bca('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x9bca('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x9bca('0xc')]},'channel':{'type':Sequelize[_0x9bca('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x9bca('0x2')]},'accountcode':{'type':Sequelize[_0x9bca('0x2')]},'context':{'type':Sequelize[_0x9bca('0x2')]},'exten':{'type':Sequelize[_0x9bca('0x2')]},'priority':{'type':Sequelize[_0x9bca('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x9bca('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x9bca('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x9bca('0xe')},'transferexten':{'type':Sequelize[_0x9bca('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x9bca('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x9bca('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x29ed=['moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x29ed,0x77));var _0xd29e=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0x29ed[_0x24259d];return _0x5a701;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd29e('0x0'));module[_0xd29e('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xd29e('0x2')]},'calleridnum':{'type':Sequelize[_0xd29e('0x2')]},'calleridname':{'type':Sequelize[_0xd29e('0x2')]},'queue':{'type':Sequelize[_0xd29e('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xd29e('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0xa1f4e7){var _0x26ba02=moment(_0xa1f4e7);var _0x3a9b46=moment(this[_0xd29e('0x4')](_0xd29e('0x5')))[_0xd29e('0x6')](_0xd29e('0x7'));var _0x548f96=_0x26ba02[_0xd29e('0x8')](_0x3a9b46,_0xd29e('0x9'));this[_0xd29e('0xa')](_0xd29e('0xb'),_0xa1f4e7);this[_0xd29e('0xa')](_0xd29e('0xc'),_0x548f96||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0xd29e('0xd')]},'queuecallerabandon':{'type':Sequelize[_0xd29e('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xd29e('0x3')]},'queuecallercomplete':{'type':Sequelize[_0xd29e('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0xd29e('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xd29e('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0xd29e('0x2')],'comment':_0xd29e('0xf')},'originalposition':{'type':Sequelize[_0xd29e('0xd')]},'channel':{'type':Sequelize[_0xd29e('0x2')]},'connectedlinenum':{'type':Sequelize[_0xd29e('0x2')]},'connectedlinename':{'type':Sequelize[_0xd29e('0x2')]},'accountcode':{'type':Sequelize[_0xd29e('0x2')]},'context':{'type':Sequelize[_0xd29e('0x2')]},'exten':{'type':Sequelize[_0xd29e('0x2')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0xd29e('0xd')]},'mohtime':{'type':Sequelize[_0xd29e('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xd29e('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xd29e('0x2')]},'transfer':{'type':Sequelize[_0xd29e('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xd29e('0x2')],'comment':_0xd29e('0x10')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xd29e('0x2')]},'disposition':{'type':Sequelize[_0xd29e('0x2')]},'secondDisposition':{'type':Sequelize[_0xd29e('0x2')]},'thirdDisposition':{'type':Sequelize[_0xd29e('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0xd29e('0xd')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index de6f9ef..ff6bd5a 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 _0xedac=['name','send','map','VoiceQueueReport','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','nolimit','limit','order','sort','filters','filter','merge','where','VIRTUAL','options','include','findAll','rows','catch','length','includeAll','find','create','body','params','describe','getVoiceQueuesReport','hasOwnProperty','pick','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','end','status','json','undefined','count','offset','set','apply','reject','save','update','then','sendStatus','error','stack'];(function(_0x347f41,_0x2f3249){var _0x47903f=function(_0x76e20d){while(--_0x76e20d){_0x347f41['push'](_0x347f41['shift']());}};_0x47903f(++_0x2f3249);}(_0xedac,0x77));var _0xceda=function(_0x599bcf,_0x103c6a){_0x599bcf=_0x599bcf-0x0;var _0x379fbb=_0xedac[_0x599bcf];return _0x379fbb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xceda('0x0'));var zipdir=require(_0xceda('0x1'));var jsonpatch=require(_0xceda('0x2'));var rp=require(_0xceda('0x3'));var moment=require(_0xceda('0x4'));var BPromise=require(_0xceda('0x5'));var Mustache=require(_0xceda('0x6'));var util=require(_0xceda('0x7'));var path=require(_0xceda('0x8'));var sox=require(_0xceda('0x9'));var csv=require(_0xceda('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xceda('0xb'));var _=require(_0xceda('0xc'));var squel=require(_0xceda('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xceda('0xa'));var querystring=require(_0xceda('0xe'));var Papa=require(_0xceda('0xf'));var Redis=require(_0xceda('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xceda('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xceda('0x12'));var logger=require(_0xceda('0x13'))(_0xceda('0x14'));var utils=require('../../config/utils');var config=require(_0xceda('0x15'));var licenseUtil=require(_0xceda('0x16'));var db=require(_0xceda('0x17'))['db'];config[_0xceda('0x18')]=_[_0xceda('0x19')](config['redis'],{'host':_0xceda('0x1a'),'port':0x18eb});var socket=require(_0xceda('0x1b'))(new Redis(config[_0xceda('0x18')]));require(_0xceda('0x1c'))[_0xceda('0x1d')](socket);function respondWithStatusCode(_0x496aee,_0x1cafd1){_0x1cafd1=_0x1cafd1||0xcc;return function(_0x3bf95b){if(_0x3bf95b){return _0x496aee['sendStatus'](_0x1cafd1);}return _0x496aee['status'](_0x1cafd1)[_0xceda('0x1e')]();};}function respondWithResult(_0x16cf06,_0x33ecd0){_0x33ecd0=_0x33ecd0||0xc8;return function(_0x302431){if(_0x302431){return _0x16cf06[_0xceda('0x1f')](_0x33ecd0)[_0xceda('0x20')](_0x302431);}};}function respondWithFilteredResult(_0x57ab12,_0x4de99e){return function(_0x56314f){if(_0x56314f){var _0x68bed6=typeof _0x4de99e['offset']===_0xceda('0x21')&&typeof _0x4de99e['limit']===_0xceda('0x21');var _0x49ebbc=_0x56314f[_0xceda('0x22')];var _0x58d856=_0x68bed6?0x0:_0x4de99e['offset'];var _0x3d6ee0=_0x68bed6?_0x56314f[_0xceda('0x22')]:_0x4de99e[_0xceda('0x23')]+_0x4de99e['limit'];var _0x39554f;if(_0x3d6ee0>=_0x49ebbc){_0x3d6ee0=_0x49ebbc;_0x39554f=0xc8;}else{_0x39554f=0xce;}_0x57ab12['status'](_0x39554f);return _0x57ab12[_0xceda('0x24')]('Content-Range',_0x58d856+'-'+_0x3d6ee0+'/'+_0x49ebbc)[_0xceda('0x20')](_0x56314f);}return null;};}function patchUpdates(_0x2f2806){return function(_0x30eca4){try{jsonpatch[_0xceda('0x25')](_0x30eca4,_0x2f2806,!![]);}catch(_0x26762c){return BPromise[_0xceda('0x26')](_0x26762c);}return _0x30eca4[_0xceda('0x27')]();};}function saveUpdates(_0x2fdaa9,_0x5d691c){return function(_0x1ceb6a){if(_0x1ceb6a){return _0x1ceb6a[_0xceda('0x28')](_0x2fdaa9)[_0xceda('0x29')](function(_0x225837){return _0x225837;});}return null;};}function removeEntity(_0x112359,_0x4b2f69){return function(_0x2803c5){if(_0x2803c5){return _0x2803c5['destroy']()[_0xceda('0x29')](function(){_0x112359[_0xceda('0x1f')](0xcc)[_0xceda('0x1e')]();});}};}function handleEntityNotFound(_0x2f54bb,_0x4dee48){return function(_0x390ed4){if(!_0x390ed4){_0x2f54bb[_0xceda('0x2a')](0x194);}return _0x390ed4;};}function handleError(_0x227701,_0x33deee){_0x33deee=_0x33deee||0x1f4;return function(_0x194943){logger[_0xceda('0x2b')](_0x194943[_0xceda('0x2c')]);if(_0x194943[_0xceda('0x2d')]){delete _0x194943[_0xceda('0x2d')];}_0x227701['status'](_0x33deee)[_0xceda('0x2e')](_0x194943);};}exports['index']=function(_0x3d2738,_0xa65c65){var _0x30a23e={},_0x3c4b63={},_0x5376c1={'count':0x0,'rows':[]};var _0x108a12=_[_0xceda('0x2f')](db[_0xceda('0x30')][_0xceda('0x31')],function(_0x35de3c){return{'name':_0x35de3c['fieldName'],'type':_0x35de3c[_0xceda('0x32')][_0xceda('0x33')]};});_0x3c4b63[_0xceda('0x34')]=_['map'](_0x108a12,_0xceda('0x2d'));_0x3c4b63[_0xceda('0x35')]=_[_0xceda('0x36')](_0x3d2738['query']);_0x3c4b63['filters']=_[_0xceda('0x37')](_0x3c4b63['model'],_0x3c4b63[_0xceda('0x35')]);_0x30a23e[_0xceda('0x38')]=_[_0xceda('0x37')](_0x3c4b63[_0xceda('0x34')],qs[_0xceda('0x39')](_0x3d2738[_0xceda('0x35')]['fields']));_0x30a23e[_0xceda('0x38')]=_0x30a23e[_0xceda('0x38')]['length']?_0x30a23e['attributes']:_0x3c4b63[_0xceda('0x34')];if(!_0x3d2738[_0xceda('0x35')]['hasOwnProperty'](_0xceda('0x3a'))){_0x30a23e[_0xceda('0x3b')]=qs['limit'](_0x3d2738[_0xceda('0x35')][_0xceda('0x3b')]);_0x30a23e[_0xceda('0x23')]=qs[_0xceda('0x23')](_0x3d2738['query']['offset']);}_0x30a23e[_0xceda('0x3c')]=qs[_0xceda('0x3d')](_0x3d2738['query'][_0xceda('0x3d')]);_0x30a23e['where']=qs[_0xceda('0x3e')](_['pick'](_0x3d2738[_0xceda('0x35')],_0x3c4b63[_0xceda('0x3e')]),_0x108a12);if(_0x3d2738['query'][_0xceda('0x3f')]){_0x30a23e['where']=_[_0xceda('0x40')](_0x30a23e[_0xceda('0x41')],{'$or':_[_0xceda('0x2f')](_0x108a12,function(_0x2ba974){if(_0x2ba974[_0xceda('0x32')]!==_0xceda('0x42')){var _0x5b7134={};_0x5b7134[_0x2ba974[_0xceda('0x2d')]]={'$like':'%'+_0x3d2738[_0xceda('0x35')][_0xceda('0x3f')]+'%'};return _0x5b7134;}})});}_0x30a23e=_['merge']({},_0x30a23e,_0x3d2738[_0xceda('0x43')]);var _0xe4bc64={'where':_0x30a23e[_0xceda('0x41')]};return db[_0xceda('0x30')]['count'](_0xe4bc64)['then'](function(_0x3aaf96){_0x5376c1[_0xceda('0x22')]=_0x3aaf96;if(_0x3d2738[_0xceda('0x35')]['includeAll']){_0x30a23e[_0xceda('0x44')]=[{'all':!![]}];}return db[_0xceda('0x30')][_0xceda('0x45')](_0x30a23e);})[_0xceda('0x29')](function(_0x13f601){_0x5376c1[_0xceda('0x46')]=_0x13f601;return _0x5376c1;})[_0xceda('0x29')](respondWithFilteredResult(_0xa65c65,_0x30a23e))[_0xceda('0x47')](handleError(_0xa65c65,null));};exports['show']=function(_0x132339,_0x593810){var _0x72a4e8={'raw':![],'where':{'id':_0x132339['params']['id']}},_0x1a12e0={};_0x1a12e0[_0xceda('0x34')]=_[_0xceda('0x36')](db['VoiceQueueReport']['rawAttributes']);_0x1a12e0[_0xceda('0x35')]=_['keys'](_0x132339[_0xceda('0x35')]);_0x1a12e0[_0xceda('0x3e')]=_[_0xceda('0x37')](_0x1a12e0[_0xceda('0x34')],_0x1a12e0[_0xceda('0x35')]);_0x72a4e8[_0xceda('0x38')]=_[_0xceda('0x37')](_0x1a12e0[_0xceda('0x34')],qs[_0xceda('0x39')](_0x132339['query'][_0xceda('0x39')]));_0x72a4e8[_0xceda('0x38')]=_0x72a4e8[_0xceda('0x38')][_0xceda('0x48')]?_0x72a4e8['attributes']:_0x1a12e0[_0xceda('0x34')];if(_0x132339[_0xceda('0x35')][_0xceda('0x49')]){_0x72a4e8[_0xceda('0x44')]=[{'all':!![]}];}_0x72a4e8=_[_0xceda('0x40')]({},_0x72a4e8,_0x132339[_0xceda('0x43')]);return db[_0xceda('0x30')][_0xceda('0x4a')](_0x72a4e8)[_0xceda('0x29')](handleEntityNotFound(_0x593810,null))['then'](respondWithResult(_0x593810,null))[_0xceda('0x47')](handleError(_0x593810,null));};exports['create']=function(_0x4eb767,_0x286f2a){return db[_0xceda('0x30')][_0xceda('0x4b')](_0x4eb767[_0xceda('0x4c')],{})[_0xceda('0x29')](respondWithResult(_0x286f2a,0xc9))['catch'](handleError(_0x286f2a,null));};exports[_0xceda('0x28')]=function(_0x3a6f32,_0x496385){if(_0x3a6f32[_0xceda('0x4c')]['id']){delete _0x3a6f32[_0xceda('0x4c')]['id'];}return db[_0xceda('0x30')][_0xceda('0x4a')]({'where':{'id':_0x3a6f32[_0xceda('0x4d')]['id']}})['then'](handleEntityNotFound(_0x496385,null))['then'](saveUpdates(_0x3a6f32[_0xceda('0x4c')],null))[_0xceda('0x29')](respondWithResult(_0x496385,null))['catch'](handleError(_0x496385,null));};exports['destroy']=function(_0x52629d,_0x1e5cfc){return db[_0xceda('0x30')][_0xceda('0x4a')]({'where':{'id':_0x52629d['params']['id']}})[_0xceda('0x29')](handleEntityNotFound(_0x1e5cfc,null))[_0xceda('0x29')](removeEntity(_0x1e5cfc,null))[_0xceda('0x47')](handleError(_0x1e5cfc,null));};exports[_0xceda('0x4e')]=function(_0x1f079b,_0x3410b2){return db[_0xceda('0x30')][_0xceda('0x4e')]()[_0xceda('0x29')](respondWithResult(_0x3410b2,null))[_0xceda('0x47')](handleError(_0x3410b2,null));};exports[_0xceda('0x4f')]=function(_0x5ad5fe,_0x455dc6){var _0x47a3cf={},_0x4f27f={},_0x2e6795={'count':0x0,'rows':[]};_0x4f27f[_0xceda('0x34')]=_[_0xceda('0x36')](db[_0xceda('0x30')][_0xceda('0x31')]);_0x4f27f['query']=_[_0xceda('0x36')](_0x5ad5fe['query']);_0x4f27f[_0xceda('0x3e')]=_[_0xceda('0x37')](_0x4f27f['model'],_0x4f27f[_0xceda('0x35')]);_0x47a3cf[_0xceda('0x38')]=_['intersection'](_0x4f27f[_0xceda('0x34')],qs[_0xceda('0x39')](_0x5ad5fe[_0xceda('0x35')][_0xceda('0x39')]));_0x47a3cf['attributes']=_0x47a3cf[_0xceda('0x38')][_0xceda('0x48')]?_0x47a3cf[_0xceda('0x38')]:_0x4f27f['model'];if(!_0x5ad5fe[_0xceda('0x35')][_0xceda('0x50')](_0xceda('0x3a'))){_0x47a3cf[_0xceda('0x3b')]=qs[_0xceda('0x3b')](_0x5ad5fe[_0xceda('0x35')]['limit']);_0x47a3cf[_0xceda('0x23')]=qs[_0xceda('0x23')](_0x5ad5fe[_0xceda('0x35')][_0xceda('0x23')]);}_0x47a3cf[_0xceda('0x3c')]=qs[_0xceda('0x3d')](_0x5ad5fe[_0xceda('0x35')]['sort']);_0x47a3cf[_0xceda('0x41')]=qs[_0xceda('0x3e')](_[_0xceda('0x51')](_0x5ad5fe['query'],_0x4f27f[_0xceda('0x3e')]));if(_0x5ad5fe[_0xceda('0x35')]['filter']){_0x47a3cf[_0xceda('0x41')]=_[_0xceda('0x40')](_0x47a3cf[_0xceda('0x41')],{'$or':_[_0xceda('0x2f')](_0x47a3cf['attributes'],function(_0x6733d5){var _0x4d2571={};_0x4d2571[_0x6733d5]={'$like':'%'+_0x5ad5fe[_0xceda('0x35')][_0xceda('0x3f')]+'%'};return _0x4d2571;})});}_0x47a3cf=_[_0xceda('0x40')]({},_0x47a3cf,_0x5ad5fe[_0xceda('0x43')]);var _0x571556={'where':_0x47a3cf[_0xceda('0x41')]};return db[_0xceda('0x30')][_0xceda('0x22')](_0x571556)['then'](function(_0x1a1ab3){_0x2e6795[_0xceda('0x22')]=_0x1a1ab3;if(_0x5ad5fe[_0xceda('0x35')]['includeAll']){_0x47a3cf[_0xceda('0x44')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xceda('0x45')](_0x47a3cf);})[_0xceda('0x29')](function(_0x2e4982){_0x2e6795[_0xceda('0x46')]=_0x2e4982;return _0x2e6795;})[_0xceda('0x29')](respondWithFilteredResult(_0x455dc6,_0x47a3cf,_0xceda('0x4f')))['catch'](handleError(_0x455dc6,null,_0xceda('0x4f')));}; \ No newline at end of file +var _0x753b=['model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','VoiceQueueReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','update','find','describe','getVoiceQueuesReport','nolimit','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','register','status','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','end','sendStatus','error','stack','name','send','index','map','fieldName','type','key'];(function(_0xe6e78c,_0x582369){var _0x2a09c8=function(_0x470ccc){while(--_0x470ccc){_0xe6e78c['push'](_0xe6e78c['shift']());}};_0x2a09c8(++_0x582369);}(_0x753b,0x15d));var _0xb753=function(_0x373b82,_0xc66d54){_0x373b82=_0x373b82-0x0;var _0x3e134b=_0x753b[_0x373b82];return _0x3e134b;};'use strict';var emlformat=require(_0xb753('0x0'));var rimraf=require(_0xb753('0x1'));var zipdir=require(_0xb753('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb753('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb753('0x4'));var util=require(_0xb753('0x5'));var path=require(_0xb753('0x6'));var sox=require('sox');var csv=require(_0xb753('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb753('0x8'));var _=require('lodash');var squel=require(_0xb753('0x9'));var crypto=require(_0xb753('0xa'));var jsforce=require(_0xb753('0xb'));var deskjs=require(_0xb753('0xc'));var toCsv=require(_0xb753('0x7'));var querystring=require(_0xb753('0xd'));var Papa=require(_0xb753('0xe'));var Redis=require('ioredis');var authService=require(_0xb753('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xb753('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb753('0x11'));var utils=require(_0xb753('0x12'));var config=require(_0xb753('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xb753('0x14')]=_[_0xb753('0x15')](config[_0xb753('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0xb753('0x16'))(new Redis(config[_0xb753('0x14')]));require('./voiceQueueReport.socket')[_0xb753('0x17')](socket);function respondWithStatusCode(_0x1782ac,_0x23fd8f){_0x23fd8f=_0x23fd8f||0xcc;return function(_0x5bc98f){if(_0x5bc98f){return _0x1782ac['sendStatus'](_0x23fd8f);}return _0x1782ac[_0xb753('0x18')](_0x23fd8f)['end']();};}function respondWithResult(_0x28dcb3,_0x4084bd){_0x4084bd=_0x4084bd||0xc8;return function(_0x2c76ea){if(_0x2c76ea){return _0x28dcb3[_0xb753('0x18')](_0x4084bd)[_0xb753('0x19')](_0x2c76ea);}};}function respondWithFilteredResult(_0x2b450c,_0x469b64){return function(_0x375d54){if(_0x375d54){var _0x340d32=typeof _0x469b64[_0xb753('0x1a')]===_0xb753('0x1b')&&typeof _0x469b64[_0xb753('0x1c')]===_0xb753('0x1b');var _0x274fa5=_0x375d54[_0xb753('0x1d')];var _0x1df4b7=_0x340d32?0x0:_0x469b64[_0xb753('0x1a')];var _0x24aafa=_0x340d32?_0x375d54[_0xb753('0x1d')]:_0x469b64['offset']+_0x469b64[_0xb753('0x1c')];var _0x4a42cb;if(_0x24aafa>=_0x274fa5){_0x24aafa=_0x274fa5;_0x4a42cb=0xc8;}else{_0x4a42cb=0xce;}_0x2b450c[_0xb753('0x18')](_0x4a42cb);return _0x2b450c['set'](_0xb753('0x1e'),_0x1df4b7+'-'+_0x24aafa+'/'+_0x274fa5)[_0xb753('0x19')](_0x375d54);}return null;};}function patchUpdates(_0x1c62f6){return function(_0x4d7017){try{jsonpatch['apply'](_0x4d7017,_0x1c62f6,!![]);}catch(_0x5c68b7){return BPromise[_0xb753('0x1f')](_0x5c68b7);}return _0x4d7017[_0xb753('0x20')]();};}function saveUpdates(_0x12b7dd,_0x1baf9d){return function(_0x52fd86){if(_0x52fd86){return _0x52fd86['update'](_0x12b7dd)[_0xb753('0x21')](function(_0x3f593e){return _0x3f593e;});}return null;};}function removeEntity(_0xd73f88,_0x49b683){return function(_0x23487d){if(_0x23487d){return _0x23487d[_0xb753('0x22')]()[_0xb753('0x21')](function(){_0xd73f88[_0xb753('0x18')](0xcc)[_0xb753('0x23')]();});}};}function handleEntityNotFound(_0x389137,_0x3ef265){return function(_0x420a6c){if(!_0x420a6c){_0x389137[_0xb753('0x24')](0x194);}return _0x420a6c;};}function handleError(_0x1dd4c5,_0x366435){_0x366435=_0x366435||0x1f4;return function(_0x4b11ed){logger[_0xb753('0x25')](_0x4b11ed[_0xb753('0x26')]);if(_0x4b11ed[_0xb753('0x27')]){delete _0x4b11ed[_0xb753('0x27')];}_0x1dd4c5[_0xb753('0x18')](_0x366435)[_0xb753('0x28')](_0x4b11ed);};}exports[_0xb753('0x29')]=function(_0x51601a,_0x574f3a){var _0x46918d={},_0x3cb2d8={},_0xb8e2b0={'count':0x0,'rows':[]};var _0x421727=_[_0xb753('0x2a')](db['VoiceQueueReport']['rawAttributes'],function(_0x15c883){return{'name':_0x15c883[_0xb753('0x2b')],'type':_0x15c883[_0xb753('0x2c')][_0xb753('0x2d')]};});_0x3cb2d8[_0xb753('0x2e')]=_[_0xb753('0x2a')](_0x421727,_0xb753('0x27'));_0x3cb2d8[_0xb753('0x2f')]=_[_0xb753('0x30')](_0x51601a['query']);_0x3cb2d8['filters']=_[_0xb753('0x31')](_0x3cb2d8[_0xb753('0x2e')],_0x3cb2d8['query']);_0x46918d[_0xb753('0x32')]=_[_0xb753('0x31')](_0x3cb2d8['model'],qs['fields'](_0x51601a[_0xb753('0x2f')][_0xb753('0x33')]));_0x46918d['attributes']=_0x46918d[_0xb753('0x32')][_0xb753('0x34')]?_0x46918d['attributes']:_0x3cb2d8['model'];if(!_0x51601a[_0xb753('0x2f')][_0xb753('0x35')]('nolimit')){_0x46918d[_0xb753('0x1c')]=qs[_0xb753('0x1c')](_0x51601a[_0xb753('0x2f')][_0xb753('0x1c')]);_0x46918d[_0xb753('0x1a')]=qs[_0xb753('0x1a')](_0x51601a[_0xb753('0x2f')][_0xb753('0x1a')]);}_0x46918d[_0xb753('0x36')]=qs['sort'](_0x51601a[_0xb753('0x2f')][_0xb753('0x37')]);_0x46918d[_0xb753('0x38')]=qs[_0xb753('0x39')](_[_0xb753('0x3a')](_0x51601a[_0xb753('0x2f')],_0x3cb2d8[_0xb753('0x39')]),_0x421727);if(_0x51601a[_0xb753('0x2f')][_0xb753('0x3b')]){_0x46918d[_0xb753('0x38')]=_[_0xb753('0x3c')](_0x46918d['where'],{'$or':_['map'](_0x421727,function(_0x3fc753){if(_0x3fc753[_0xb753('0x2c')]!==_0xb753('0x3d')){var _0x46f50e={};_0x46f50e[_0x3fc753[_0xb753('0x27')]]={'$like':'%'+_0x51601a['query']['filter']+'%'};return _0x46f50e;}})});}_0x46918d=_['merge']({},_0x46918d,_0x51601a[_0xb753('0x3e')]);var _0x1eb0e3={'where':_0x46918d[_0xb753('0x38')]};return db[_0xb753('0x3f')][_0xb753('0x1d')](_0x1eb0e3)[_0xb753('0x21')](function(_0x4c51ea){_0xb8e2b0[_0xb753('0x1d')]=_0x4c51ea;if(_0x51601a['query'][_0xb753('0x40')]){_0x46918d[_0xb753('0x41')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xb753('0x42')](_0x46918d);})['then'](function(_0x156ca2){_0xb8e2b0[_0xb753('0x43')]=_0x156ca2;return _0xb8e2b0;})['then'](respondWithFilteredResult(_0x574f3a,_0x46918d))[_0xb753('0x44')](handleError(_0x574f3a,null));};exports[_0xb753('0x45')]=function(_0x2dfeb6,_0x2c5e70){var _0x52a1ee={'raw':![],'where':{'id':_0x2dfeb6[_0xb753('0x46')]['id']}},_0x1e076c={};_0x1e076c[_0xb753('0x2e')]=_[_0xb753('0x30')](db[_0xb753('0x3f')][_0xb753('0x47')]);_0x1e076c[_0xb753('0x2f')]=_['keys'](_0x2dfeb6['query']);_0x1e076c[_0xb753('0x39')]=_[_0xb753('0x31')](_0x1e076c['model'],_0x1e076c[_0xb753('0x2f')]);_0x52a1ee[_0xb753('0x32')]=_[_0xb753('0x31')](_0x1e076c[_0xb753('0x2e')],qs[_0xb753('0x33')](_0x2dfeb6['query']['fields']));_0x52a1ee[_0xb753('0x32')]=_0x52a1ee[_0xb753('0x32')]['length']?_0x52a1ee[_0xb753('0x32')]:_0x1e076c['model'];if(_0x2dfeb6[_0xb753('0x2f')][_0xb753('0x40')]){_0x52a1ee[_0xb753('0x41')]=[{'all':!![]}];}_0x52a1ee=_[_0xb753('0x3c')]({},_0x52a1ee,_0x2dfeb6[_0xb753('0x3e')]);return db['VoiceQueueReport']['find'](_0x52a1ee)[_0xb753('0x21')](handleEntityNotFound(_0x2c5e70,null))[_0xb753('0x21')](respondWithResult(_0x2c5e70,null))[_0xb753('0x44')](handleError(_0x2c5e70,null));};exports[_0xb753('0x48')]=function(_0x39d214,_0x3259f0){return db[_0xb753('0x3f')][_0xb753('0x48')](_0x39d214[_0xb753('0x49')],{})[_0xb753('0x21')](respondWithResult(_0x3259f0,0xc9))['catch'](handleError(_0x3259f0,null));};exports[_0xb753('0x4a')]=function(_0x30b6a4,_0x161090){if(_0x30b6a4[_0xb753('0x49')]['id']){delete _0x30b6a4[_0xb753('0x49')]['id'];}return db[_0xb753('0x3f')][_0xb753('0x4b')]({'where':{'id':_0x30b6a4[_0xb753('0x46')]['id']}})[_0xb753('0x21')](handleEntityNotFound(_0x161090,null))[_0xb753('0x21')](saveUpdates(_0x30b6a4[_0xb753('0x49')],null))['then'](respondWithResult(_0x161090,null))[_0xb753('0x44')](handleError(_0x161090,null));};exports[_0xb753('0x22')]=function(_0x30f4f8,_0x5d7084){return db['VoiceQueueReport']['find']({'where':{'id':_0x30f4f8[_0xb753('0x46')]['id']}})[_0xb753('0x21')](handleEntityNotFound(_0x5d7084,null))['then'](removeEntity(_0x5d7084,null))[_0xb753('0x44')](handleError(_0x5d7084,null));};exports[_0xb753('0x4c')]=function(_0x23ec27,_0x48e674){return db[_0xb753('0x3f')][_0xb753('0x4c')]()[_0xb753('0x21')](respondWithResult(_0x48e674,null))[_0xb753('0x44')](handleError(_0x48e674,null));};exports[_0xb753('0x4d')]=function(_0x11f691,_0x237368){var _0x29800a={},_0x3b0a57={},_0x5d0565={'count':0x0,'rows':[]};_0x3b0a57[_0xb753('0x2e')]=_[_0xb753('0x30')](db[_0xb753('0x3f')][_0xb753('0x47')]);_0x3b0a57[_0xb753('0x2f')]=_['keys'](_0x11f691[_0xb753('0x2f')]);_0x3b0a57[_0xb753('0x39')]=_[_0xb753('0x31')](_0x3b0a57[_0xb753('0x2e')],_0x3b0a57[_0xb753('0x2f')]);_0x29800a[_0xb753('0x32')]=_['intersection'](_0x3b0a57['model'],qs[_0xb753('0x33')](_0x11f691[_0xb753('0x2f')][_0xb753('0x33')]));_0x29800a[_0xb753('0x32')]=_0x29800a[_0xb753('0x32')][_0xb753('0x34')]?_0x29800a['attributes']:_0x3b0a57[_0xb753('0x2e')];if(!_0x11f691[_0xb753('0x2f')]['hasOwnProperty'](_0xb753('0x4e'))){_0x29800a[_0xb753('0x1c')]=qs[_0xb753('0x1c')](_0x11f691[_0xb753('0x2f')][_0xb753('0x1c')]);_0x29800a[_0xb753('0x1a')]=qs[_0xb753('0x1a')](_0x11f691[_0xb753('0x2f')][_0xb753('0x1a')]);}_0x29800a[_0xb753('0x36')]=qs[_0xb753('0x37')](_0x11f691['query'][_0xb753('0x37')]);_0x29800a[_0xb753('0x38')]=qs['filters'](_[_0xb753('0x3a')](_0x11f691[_0xb753('0x2f')],_0x3b0a57[_0xb753('0x39')]));if(_0x11f691[_0xb753('0x2f')][_0xb753('0x3b')]){_0x29800a[_0xb753('0x38')]=_[_0xb753('0x3c')](_0x29800a[_0xb753('0x38')],{'$or':_[_0xb753('0x2a')](_0x29800a[_0xb753('0x32')],function(_0x213bd8){var _0x2ebb65={};_0x2ebb65[_0x213bd8]={'$like':'%'+_0x11f691[_0xb753('0x2f')]['filter']+'%'};return _0x2ebb65;})});}_0x29800a=_[_0xb753('0x3c')]({},_0x29800a,_0x11f691[_0xb753('0x3e')]);var _0x23871={'where':_0x29800a[_0xb753('0x38')]};return db[_0xb753('0x3f')][_0xb753('0x1d')](_0x23871)[_0xb753('0x21')](function(_0x32c9a4){_0x5d0565[_0xb753('0x1d')]=_0x32c9a4;if(_0x11f691['query'][_0xb753('0x40')]){_0x29800a[_0xb753('0x41')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xb753('0x42')](_0x29800a);})[_0xb753('0x21')](function(_0x1d6686){_0x5d0565[_0xb753('0x43')]=_0x1d6686;return _0x5d0565;})[_0xb753('0x21')](respondWithFilteredResult(_0x237368,_0x29800a,_0xb753('0x4d')))['catch'](handleError(_0x237368,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 52817dc..40b17ce 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 _0x7123=['save','update','remove','emit','hook','exports','VoiceQueueReport','setMaxListeners'];(function(_0x1d729d,_0x1afdde){var _0x3234cf=function(_0x5aed55){while(--_0x5aed55){_0x1d729d['push'](_0x1d729d['shift']());}};_0x3234cf(++_0x1afdde);}(_0x7123,0xb6));var _0x3712=function(_0x1ef6af,_0x169aa8){_0x1ef6af=_0x1ef6af-0x0;var _0x2bf0f5=_0x7123[_0x1ef6af];return _0x2bf0f5;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require('../../mysqldb')['db'][_0x3712('0x0')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x3712('0x1')](0x0);var events={'afterCreate':_0x3712('0x2'),'afterUpdate':_0x3712('0x3'),'afterDestroy':_0x3712('0x4')};function emitEvent(_0x136490){return function(_0x3547d6,_0x2d9731,_0x42b97d){VoiceQueueReportEvents[_0x3712('0x5')](_0x136490+':'+_0x3547d6['id'],_0x3547d6);VoiceQueueReportEvents[_0x3712('0x5')](_0x136490,_0x3547d6);_0x42b97d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x3712('0x6')](e,emitEvent(event));}}module[_0x3712('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xd1ac=['../../mysqldb','VoiceQueueReport','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x501ab8,_0x4cfecd){var _0x3527c5=function(_0x5dc4f5){while(--_0x5dc4f5){_0x501ab8['push'](_0x501ab8['shift']());}};_0x3527c5(++_0x4cfecd);}(_0xd1ac,0xa1));var _0xcd1a=function(_0xd952b3,_0x14d316){_0xd952b3=_0xd952b3-0x0;var _0xfb23fd=_0xd1ac[_0xd952b3];return _0xfb23fd;};'use strict';var EventEmitter=require(_0xcd1a('0x0'));var VoiceQueueReport=require(_0xcd1a('0x1'))['db'][_0xcd1a('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcd1a('0x3'),'afterUpdate':_0xcd1a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x375236){return function(_0x491191,_0x5bcdc3,_0xb1e05e){VoiceQueueReportEvents[_0xcd1a('0x5')](_0x375236+':'+_0x491191['id'],_0x491191);VoiceQueueReportEvents[_0xcd1a('0x5')](_0x375236,_0x491191);_0xb1e05e(null);};}for(var e in events){if(events[_0xcd1a('0x6')](e)){var event=events[e];VoiceQueueReport[_0xcd1a('0x7')](e,emitEvent(event));}}module[_0xcd1a('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 d54b6c0..c0ca6c9 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 _0xb344=['report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','define','VoiceQueueReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb344,0x113));var _0x4b34=function(_0x17de24,_0x3c6c3c){_0x17de24=_0x17de24-0x0;var _0x4a7763=_0xb344[_0x17de24];return _0x4a7763;};'use strict';var _=require(_0x4b34('0x0'));var util=require(_0x4b34('0x1'));var logger=require(_0x4b34('0x2'))(_0x4b34('0x3'));var moment=require(_0x4b34('0x4'));var BPromise=require(_0x4b34('0x5'));var rp=require(_0x4b34('0x6'));var fs=require('fs');var path=require(_0x4b34('0x7'));var rimraf=require(_0x4b34('0x8'));var config=require(_0x4b34('0x9'));var attributes=require(_0x4b34('0xa'));module['exports']=function(_0x136ade,_0x462736){return _0x136ade[_0x4b34('0xb')](_0x4b34('0xc'),attributes,{'tableName':_0x4b34('0xd'),'paranoid':![],'indexes':[{'fields':[_0x4b34('0xe')]},{'fields':[_0x4b34('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5468=['calleridnum','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid'];(function(_0x8ffa58,_0x4d2807){var _0x4bff95=function(_0x2ca928){while(--_0x2ca928){_0x8ffa58['push'](_0x8ffa58['shift']());}};_0x4bff95(++_0x4d2807);}(_0x5468,0x111));var _0x8546=function(_0x428772,_0x2aab23){_0x428772=_0x428772-0x0;var _0x34af8c=_0x5468[_0x428772];return _0x34af8c;};'use strict';var _=require(_0x8546('0x0'));var util=require(_0x8546('0x1'));var logger=require(_0x8546('0x2'))(_0x8546('0x3'));var moment=require(_0x8546('0x4'));var BPromise=require(_0x8546('0x5'));var rp=require(_0x8546('0x6'));var fs=require('fs');var path=require(_0x8546('0x7'));var rimraf=require('rimraf');var config=require(_0x8546('0x8'));var attributes=require(_0x8546('0x9'));module[_0x8546('0xa')]=function(_0x2c15cd,_0x5516d6){return _0x2c15cd[_0x8546('0xb')](_0x8546('0xc'),attributes,{'tableName':_0x8546('0xd'),'paranoid':![],'indexes':[{'fields':[_0x8546('0xe')]},{'fields':[_0x8546('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 5344fba..4943dea 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 _0x34e2=['create','CreateVoiceQueueReport','debug','body','UpdateVoiceQueueReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter','register','request','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','VoiceQueueReport','findAll','options','raw','where','limit','include','map','attributes','model','GetVoiceQueueReport','stringify'];(function(_0x1b277a,_0x5c6f98){var _0x1d720b=function(_0x543245){while(--_0x543245){_0x1b277a['push'](_0x1b277a['shift']());}};_0x1d720b(++_0x5c6f98);}(_0x34e2,0x155));var _0x234e=function(_0x33d78b,_0xfe9512){_0x33d78b=_0x33d78b-0x0;var _0x139bc4=_0x34e2[_0x33d78b];return _0x139bc4;};'use strict';var _=require(_0x234e('0x0'));var util=require(_0x234e('0x1'));var moment=require(_0x234e('0x2'));var BPromise=require('bluebird');var rs=require(_0x234e('0x3'));var fs=require('fs');var Redis=require(_0x234e('0x4'));var db=require(_0x234e('0x5'))['db'];var utils=require(_0x234e('0x6'));var logger=require(_0x234e('0x7'))(_0x234e('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x234e('0x9')][_0x234e('0xa')]({'port':0x232a});config[_0x234e('0xb')]=_['defaults'](config['redis'],{'host':_0x234e('0xc'),'port':0x18eb});var socket=require(_0x234e('0xd'))(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0x234e('0xe')](socket);function respondWithRpcPromise(_0x62adda,_0x3cdacd,_0x459533){return new BPromise(function(_0x3f8c1a,_0x4475c8){return client[_0x234e('0xf')](_0x62adda,_0x459533)[_0x234e('0x10')](function(_0x521454){logger['info'](_0x234e('0x11'),_0x3cdacd,_0x234e('0x12'));logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x3cdacd,'request\x20sent',JSON['stringify'](_0x521454));if(_0x521454[_0x234e('0x13')]){if(_0x521454[_0x234e('0x13')][_0x234e('0x14')]===0x1f4){logger[_0x234e('0x13')](_0x234e('0x11'),_0x3cdacd,_0x521454[_0x234e('0x13')][_0x234e('0x15')]);return _0x4475c8(_0x521454[_0x234e('0x13')][_0x234e('0x15')]);}logger[_0x234e('0x13')](_0x234e('0x11'),_0x3cdacd,_0x521454[_0x234e('0x13')][_0x234e('0x15')]);return _0x3f8c1a(_0x521454[_0x234e('0x13')][_0x234e('0x15')]);}else{logger[_0x234e('0x16')](_0x234e('0x11'),_0x3cdacd,_0x234e('0x12'));_0x3f8c1a(_0x521454[_0x234e('0x17')][_0x234e('0x15')]);}})[_0x234e('0x18')](function(_0x29dacf){logger[_0x234e('0x13')](_0x234e('0x11'),_0x3cdacd,_0x29dacf);_0x4475c8(_0x29dacf);});});}exports['GetVoiceQueueReport']=function(_0xbddf1d){var _0x12fac2=this;return new Promise(function(_0x1d4a18,_0x357a0e){return db[_0x234e('0x19')][_0x234e('0x1a')]({'raw':_0xbddf1d[_0x234e('0x1b')]?_0xbddf1d['options'][_0x234e('0x1c')]===undefined?!![]:![]:!![],'where':_0xbddf1d['options']?_0xbddf1d[_0x234e('0x1b')][_0x234e('0x1d')]||null:null,'attributes':_0xbddf1d['options']?_0xbddf1d[_0x234e('0x1b')]['attributes']||null:null,'limit':_0xbddf1d[_0x234e('0x1b')]?_0xbddf1d[_0x234e('0x1b')][_0x234e('0x1e')]||null:null,'include':_0xbddf1d[_0x234e('0x1b')]?_0xbddf1d[_0x234e('0x1b')][_0x234e('0x1f')]?_[_0x234e('0x20')](_0xbddf1d[_0x234e('0x1b')]['include'],function(_0x470083){return{'model':db[_0x470083['model']],'as':_0x470083['as'],'attributes':_0x470083[_0x234e('0x21')],'include':_0x470083[_0x234e('0x1f')]?_['map'](_0x470083[_0x234e('0x1f')],function(_0x45db1c){return{'model':db[_0x45db1c[_0x234e('0x22')]],'as':_0x45db1c['as'],'attributes':_0x45db1c[_0x234e('0x21')],'include':_0x45db1c[_0x234e('0x1f')]?_[_0x234e('0x20')](_0x45db1c[_0x234e('0x1f')],function(_0x5d965c){return{'model':db[_0x5d965c[_0x234e('0x22')]],'as':_0x5d965c['as'],'attributes':_0x5d965c[_0x234e('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46b683){logger[_0x234e('0x16')](_0x234e('0x23'),_0xbddf1d);logger['debug'](_0x234e('0x23'),_0xbddf1d,JSON[_0x234e('0x24')](_0x46b683));_0x1d4a18(_0x46b683);})[_0x234e('0x18')](function(_0x23fa52){logger[_0x234e('0x13')](_0x234e('0x23'),_0x23fa52[_0x234e('0x15')],_0xbddf1d);_0x357a0e(_0x12fac2[_0x234e('0x13')](0x1f4,_0x23fa52[_0x234e('0x15')]));});});};exports['CreateVoiceQueueReport']=function(_0x7be52d){var _0x373c3c=this;return new Promise(function(_0x4017f6,_0xe584cb){return db[_0x234e('0x19')][_0x234e('0x25')](_0x7be52d['body'],{'raw':_0x7be52d[_0x234e('0x1b')]?_0x7be52d['options'][_0x234e('0x1c')]===undefined?!![]:![]:!![]})[_0x234e('0x10')](function(_0x5d9554){logger[_0x234e('0x16')](_0x234e('0x26'),_0x7be52d);logger[_0x234e('0x27')](_0x234e('0x26'),_0x7be52d,JSON[_0x234e('0x24')](_0x5d9554));_0x4017f6(_0x5d9554);})[_0x234e('0x18')](function(_0x15afde){logger['error']('CreateVoiceQueueReport',_0x15afde[_0x234e('0x15')],_0x7be52d);_0xe584cb(_0x373c3c[_0x234e('0x13')](0x1f4,_0x15afde[_0x234e('0x15')]));});});};exports['UpdateVoiceQueueReport']=function(_0x32f065){var _0xdd47ed=this;return new Promise(function(_0x4a0381,_0x46e3ac){return db[_0x234e('0x19')]['update'](_0x32f065[_0x234e('0x28')],{'raw':_0x32f065['options']?_0x32f065['options'][_0x234e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32f065[_0x234e('0x1b')]?_0x32f065[_0x234e('0x1b')][_0x234e('0x1d')]||null:null,'attributes':_0x32f065['options']?_0x32f065[_0x234e('0x1b')]['attributes']||null:null,'limit':_0x32f065['options']?_0x32f065[_0x234e('0x1b')]['limit']||null:null})[_0x234e('0x10')](function(_0xb8176e){logger[_0x234e('0x16')](_0x234e('0x29'),_0x32f065);logger[_0x234e('0x27')](_0x234e('0x29'),_0x32f065,JSON['stringify'](_0xb8176e));_0x4a0381(_0xb8176e);})[_0x234e('0x18')](function(_0x566677){logger['error'](_0x234e('0x29'),_0x566677[_0x234e('0x15')],_0x32f065);_0x46e3ac(_0xdd47ed[_0x234e('0x13')](0x1f4,_0x566677[_0x234e('0x15')]));});});}; \ No newline at end of file +var _0x086e=['http','redis','defaults','register','request','then','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceQueueReport,\x20%s,\x20%s','result','GetVoiceQueueReport','options','where','attributes','limit','include','map','model','debug','CreateVoiceQueueReport','VoiceQueueReport','create','body','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x40feda,_0x5d32e8){var _0x4e34c4=function(_0xcb0a8){while(--_0xcb0a8){_0x40feda['push'](_0x40feda['shift']());}};_0x4e34c4(++_0x5d32e8);}(_0x086e,0x1c9));var _0xe086=function(_0x1aa8e4,_0x422beb){_0x1aa8e4=_0x1aa8e4-0x0;var _0x335a4d=_0x086e[_0x1aa8e4];return _0x335a4d;};'use strict';var _=require('lodash');var util=require(_0xe086('0x0'));var moment=require(_0xe086('0x1'));var BPromise=require(_0xe086('0x2'));var rs=require(_0xe086('0x3'));var fs=require('fs');var Redis=require(_0xe086('0x4'));var db=require(_0xe086('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe086('0x6'))(_0xe086('0x7'));var config=require(_0xe086('0x8'));var jayson=require(_0xe086('0x9'));var client=jayson[_0xe086('0xa')][_0xe086('0xb')]({'port':0x232a});config[_0xe086('0xc')]=_[_0xe086('0xd')](config[_0xe086('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe086('0xc')]));require('./voiceQueueReport.socket')[_0xe086('0xe')](socket);function respondWithRpcPromise(_0x30eb24,_0x31683f,_0x85cc4d){return new BPromise(function(_0x43504d,_0x3aa0e5){return client[_0xe086('0xf')](_0x30eb24,_0x85cc4d)[_0xe086('0x10')](function(_0x5e7145){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x31683f,_0xe086('0x11'));logger['debug'](_0xe086('0x12'),_0x31683f,_0xe086('0x11'),JSON[_0xe086('0x13')](_0x5e7145));if(_0x5e7145[_0xe086('0x14')]){if(_0x5e7145[_0xe086('0x14')]['code']===0x1f4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x31683f,_0x5e7145['error'][_0xe086('0x15')]);return _0x3aa0e5(_0x5e7145[_0xe086('0x14')][_0xe086('0x15')]);}logger['error'](_0xe086('0x16'),_0x31683f,_0x5e7145[_0xe086('0x14')][_0xe086('0x15')]);return _0x43504d(_0x5e7145[_0xe086('0x14')][_0xe086('0x15')]);}else{logger['info'](_0xe086('0x16'),_0x31683f,_0xe086('0x11'));_0x43504d(_0x5e7145[_0xe086('0x17')][_0xe086('0x15')]);}})['catch'](function(_0x4741b5){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x31683f,_0x4741b5);_0x3aa0e5(_0x4741b5);});});}exports[_0xe086('0x18')]=function(_0x430130){var _0x132e2f=this;return new Promise(function(_0x4bd9b3,_0x29a699){return db['VoiceQueueReport']['findAll']({'raw':_0x430130['options']?_0x430130[_0xe086('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x430130[_0xe086('0x19')]?_0x430130[_0xe086('0x19')][_0xe086('0x1a')]||null:null,'attributes':_0x430130[_0xe086('0x19')]?_0x430130[_0xe086('0x19')][_0xe086('0x1b')]||null:null,'limit':_0x430130['options']?_0x430130['options'][_0xe086('0x1c')]||null:null,'include':_0x430130['options']?_0x430130[_0xe086('0x19')][_0xe086('0x1d')]?_[_0xe086('0x1e')](_0x430130['options'][_0xe086('0x1d')],function(_0x5d7eed){return{'model':db[_0x5d7eed['model']],'as':_0x5d7eed['as'],'attributes':_0x5d7eed[_0xe086('0x1b')],'include':_0x5d7eed[_0xe086('0x1d')]?_['map'](_0x5d7eed[_0xe086('0x1d')],function(_0x5d399a){return{'model':db[_0x5d399a[_0xe086('0x1f')]],'as':_0x5d399a['as'],'attributes':_0x5d399a[_0xe086('0x1b')],'include':_0x5d399a[_0xe086('0x1d')]?_['map'](_0x5d399a['include'],function(_0x3fc76d){return{'model':db[_0x3fc76d[_0xe086('0x1f')]],'as':_0x3fc76d['as'],'attributes':_0x3fc76d['attributes']};}):[]};}):[]};}):[]:[]})[_0xe086('0x10')](function(_0xfc6175){logger['info']('GetVoiceQueueReport',_0x430130);logger[_0xe086('0x20')](_0xe086('0x18'),_0x430130,JSON[_0xe086('0x13')](_0xfc6175));_0x4bd9b3(_0xfc6175);})['catch'](function(_0xed7de1){logger[_0xe086('0x14')]('GetVoiceQueueReport',_0xed7de1[_0xe086('0x15')],_0x430130);_0x29a699(_0x132e2f[_0xe086('0x14')](0x1f4,_0xed7de1[_0xe086('0x15')]));});});};exports[_0xe086('0x21')]=function(_0x4c38fc){var _0x3be987=this;return new Promise(function(_0x562184,_0x2074e4){return db[_0xe086('0x22')][_0xe086('0x23')](_0x4c38fc[_0xe086('0x24')],{'raw':_0x4c38fc[_0xe086('0x19')]?_0x4c38fc[_0xe086('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xe086('0x10')](function(_0x35c637){logger[_0xe086('0x25')]('CreateVoiceQueueReport',_0x4c38fc);logger[_0xe086('0x20')]('CreateVoiceQueueReport',_0x4c38fc,JSON[_0xe086('0x13')](_0x35c637));_0x562184(_0x35c637);})[_0xe086('0x26')](function(_0x47a4ef){logger['error'](_0xe086('0x21'),_0x47a4ef[_0xe086('0x15')],_0x4c38fc);_0x2074e4(_0x3be987['error'](0x1f4,_0x47a4ef[_0xe086('0x15')]));});});};exports['UpdateVoiceQueueReport']=function(_0x57c5eb){var _0x32393c=this;return new Promise(function(_0xf3fa9e,_0x1748d8){return db[_0xe086('0x22')]['update'](_0x57c5eb[_0xe086('0x24')],{'raw':_0x57c5eb['options']?_0x57c5eb[_0xe086('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57c5eb[_0xe086('0x19')]?_0x57c5eb[_0xe086('0x19')][_0xe086('0x1a')]||null:null,'attributes':_0x57c5eb[_0xe086('0x19')]?_0x57c5eb[_0xe086('0x19')][_0xe086('0x1b')]||null:null,'limit':_0x57c5eb[_0xe086('0x19')]?_0x57c5eb['options'][_0xe086('0x1c')]||null:null})['then'](function(_0x21dda3){logger['info']('UpdateVoiceQueueReport',_0x57c5eb);logger[_0xe086('0x20')]('UpdateVoiceQueueReport',_0x57c5eb,JSON[_0xe086('0x13')](_0x21dda3));_0xf3fa9e(_0x21dda3);})[_0xe086('0x26')](function(_0x5d620c){logger[_0xe086('0x14')]('UpdateVoiceQueueReport',_0x5d620c[_0xe086('0x15')],_0x57c5eb);_0x1748d8(_0x32393c['error'](0x1f4,_0x5d620c[_0xe086('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 6297172..23b48de 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 _0x6a93=['length','voiceQueueReport:','./voiceQueueReport.events','save','remove','removeListener','register'];(function(_0x43046e,_0x7977aa){var _0x54f608=function(_0xcc797){while(--_0xcc797){_0x43046e['push'](_0x43046e['shift']());}};_0x54f608(++_0x7977aa);}(_0x6a93,0x1d7));var _0x36a9=function(_0x1492f3,_0x379a97){_0x1492f3=_0x1492f3-0x0;var _0x51a288=_0x6a93[_0x1492f3];return _0x51a288;};'use strict';var VoiceQueueReportEvents=require(_0x36a9('0x0'));var events=[_0x36a9('0x1'),_0x36a9('0x2'),'update'];function createListener(_0x508291,_0x3d1196){return function(_0x209444){_0x3d1196['emit'](_0x508291,_0x209444);};}function removeListener(_0x2deb45,_0x2127e0){return function(){VoiceQueueReportEvents[_0x36a9('0x3')](_0x2deb45,_0x2127e0);};}exports[_0x36a9('0x4')]=function(_0x2c1be3){for(var _0x6de7d=0x0,_0x258db9=events[_0x36a9('0x5')];_0x6de7d<_0x258db9;_0x6de7d++){var _0x156951=events[_0x6de7d];var _0x444d75=createListener(_0x36a9('0x6')+_0x156951,_0x2c1be3);VoiceQueueReportEvents['on'](_0x156951,_0x444d75);}}; \ No newline at end of file +var _0xceae=['./voiceQueueReport.events','save','removeListener','register','length'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0xceae,0x122));var _0xecea=function(_0x352b44,_0x4a91a1){_0x352b44=_0x352b44-0x0;var _0x3e8baa=_0xceae[_0x352b44];return _0x3e8baa;};'use strict';var VoiceQueueReportEvents=require(_0xecea('0x0'));var events=[_0xecea('0x1'),'remove','update'];function createListener(_0x5f37e7,_0x6e4afb){return function(_0x5cecf4){_0x6e4afb['emit'](_0x5f37e7,_0x5cecf4);};}function removeListener(_0x28b2cf,_0x457d37){return function(){VoiceQueueReportEvents[_0xecea('0x2')](_0x28b2cf,_0x457d37);};}exports[_0xecea('0x3')]=function(_0x1588bf){for(var _0x1b1b68=0x0,_0x2a3f5b=events[_0xecea('0x4')];_0x1b1b68<_0x2a3f5b;_0x1b1b68++){var _0x1663e2=events[_0x1b1b68];var _0x46bb33=createListener('voiceQueueReport:'+_0x1663e2,_0x1588bf);VoiceQueueReportEvents['on'](_0x1663e2,_0x46bb33);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index cc2cbc6..80f44c5 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 _0xecc5=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','/:id','show','post','put','delete','destroy','exports','multer','path'];(function(_0x3befec,_0x17c37b){var _0x87a919=function(_0x16436d){while(--_0x16436d){_0x3befec['push'](_0x3befec['shift']());}};_0x87a919(++_0x17c37b);}(_0xecc5,0x96));var _0x5ecc=function(_0x3771ea,_0x1d135f){_0x3771ea=_0x3771ea-0x0;var _0x39503a=_0xecc5[_0x3771ea];return _0x39503a;};'use strict';var multer=require(_0x5ecc('0x0'));var util=require('util');var path=require(_0x5ecc('0x1'));var timeout=require(_0x5ecc('0x2'));var express=require(_0x5ecc('0x3'));var router=express[_0x5ecc('0x4')]();var fs_extra=require(_0x5ecc('0x5'));var auth=require(_0x5ecc('0x6'));var interaction=require(_0x5ecc('0x7'));var config=require(_0x5ecc('0x8'));var controller=require(_0x5ecc('0x9'));router[_0x5ecc('0xa')]('/',auth[_0x5ecc('0xb')](),controller['index']);router[_0x5ecc('0xa')](_0x5ecc('0xc'),auth[_0x5ecc('0xb')](),controller[_0x5ecc('0xd')]);router[_0x5ecc('0xe')]('/',auth[_0x5ecc('0xb')](),controller['create']);router[_0x5ecc('0xf')](_0x5ecc('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x5ecc('0x10')](_0x5ecc('0xc'),auth[_0x5ecc('0xb')](),controller[_0x5ecc('0x11')]);module[_0x5ecc('0x12')]=router; \ No newline at end of file +var _0xda62=['../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','post','create','put','update','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x18c60e,_0x32fbfd){var _0x1f53b1=function(_0x221a1a){while(--_0x221a1a){_0x18c60e['push'](_0x18c60e['shift']());}};_0x1f53b1(++_0x32fbfd);}(_0xda62,0x1ba));var _0x2da6=function(_0x3736fa,_0x171e94){_0x3736fa=_0x3736fa-0x0;var _0x1777d6=_0xda62[_0x3736fa];return _0x1777d6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2da6('0x0'));var timeout=require('connect-timeout');var express=require(_0x2da6('0x1'));var router=express[_0x2da6('0x2')]();var fs_extra=require(_0x2da6('0x3'));var auth=require(_0x2da6('0x4'));var interaction=require(_0x2da6('0x5'));var config=require(_0x2da6('0x6'));var controller=require(_0x2da6('0x7'));router[_0x2da6('0x8')]('/',auth[_0x2da6('0x9')](),controller[_0x2da6('0xa')]);router[_0x2da6('0x8')](_0x2da6('0xb'),auth[_0x2da6('0x9')](),controller['show']);router[_0x2da6('0xc')]('/',auth[_0x2da6('0x9')](),controller[_0x2da6('0xd')]);router[_0x2da6('0xe')](_0x2da6('0xb'),auth[_0x2da6('0x9')](),controller[_0x2da6('0xf')]);router['delete'](_0x2da6('0xb'),auth[_0x2da6('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 25c1667..cd46870 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 _0x00f0=['exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment'];(function(_0x18b973,_0x2259b9){var _0x288b49=function(_0x111726){while(--_0x111726){_0x18b973['push'](_0x18b973['shift']());}};_0x288b49(++_0x2259b9);}(_0x00f0,0xec));var _0x000f=function(_0x2bb0c8,_0x545654){_0x2bb0c8=_0x2bb0c8-0x0;var _0x2facdb=_0x00f0[_0x2bb0c8];return _0x2facdb;};'use strict';var Sequelize=require(_0x000f('0x0'));var moment=require(_0x000f('0x1'));module[_0x000f('0x2')]={'time':{'type':Sequelize[_0x000f('0x3')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x000f('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x000f('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x000f('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x000f('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x000f('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x000f('0x4')],'allowNull':![],'defaultValue':moment()[_0x000f('0x5')](_0x000f('0x6'))}}; \ No newline at end of file +var _0x16a1=['YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports','STRING','format'];(function(_0x489d8a,_0x1b1b54){var _0x28637d=function(_0x207248){while(--_0x207248){_0x489d8a['push'](_0x489d8a['shift']());}};_0x28637d(++_0x1b1b54);}(_0x16a1,0xeb));var _0x116a=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x16a1[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0x116a('0x0'));var moment=require(_0x116a('0x1'));module[_0x116a('0x2')]={'time':{'type':Sequelize[_0x116a('0x3')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x116a('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x116a('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x116a('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x116a('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x116a('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x116a('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x116a('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0x116a('0x4')](_0x116a('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 4328a37..45712fb 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 _0x2ec4=['type','VIRTUAL','options','includeAll','include','rows','catch','params','merge','create','body','find','eml-format','rimraf','zip-dir','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','update','then','destroy','error','stack','name','send','map','VoiceQueuesLog','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x2ec4,0x11c));var _0x42ec=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x2ec4[_0x5447fd];return _0x15b28a;};'use strict';var emlformat=require(_0x42ec('0x0'));var rimraf=require(_0x42ec('0x1'));var zipdir=require(_0x42ec('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x42ec('0x3'));var BPromise=require(_0x42ec('0x4'));var Mustache=require(_0x42ec('0x5'));var util=require('util');var path=require('path');var sox=require(_0x42ec('0x6'));var csv=require(_0x42ec('0x7'));var ejs=require(_0x42ec('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x42ec('0x9'));var squel=require(_0x42ec('0xa'));var crypto=require(_0x42ec('0xb'));var jsforce=require(_0x42ec('0xc'));var deskjs=require(_0x42ec('0xd'));var toCsv=require(_0x42ec('0x7'));var querystring=require(_0x42ec('0xe'));var Papa=require(_0x42ec('0xf'));var Redis=require(_0x42ec('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x42ec('0x11'));var hardwareService=require(_0x42ec('0x12'));var logger=require(_0x42ec('0x13'))('api');var utils=require(_0x42ec('0x14'));var config=require(_0x42ec('0x15'));var licenseUtil=require(_0x42ec('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7ead1e,_0x13a791){_0x13a791=_0x13a791||0xcc;return function(_0x2fa1c1){if(_0x2fa1c1){return _0x7ead1e[_0x42ec('0x17')](_0x13a791);}return _0x7ead1e[_0x42ec('0x18')](_0x13a791)['end']();};}function respondWithResult(_0x30624d,_0x3d94a2){_0x3d94a2=_0x3d94a2||0xc8;return function(_0x18e150){if(_0x18e150){return _0x30624d[_0x42ec('0x18')](_0x3d94a2)[_0x42ec('0x19')](_0x18e150);}};}function respondWithFilteredResult(_0x2d94f4,_0x33d58f){return function(_0x16b3d8){if(_0x16b3d8){var _0x17fe37=typeof _0x33d58f[_0x42ec('0x1a')]===_0x42ec('0x1b')&&typeof _0x33d58f[_0x42ec('0x1c')]===_0x42ec('0x1b');var _0x55acaf=_0x16b3d8['count'];var _0x3b1057=_0x17fe37?0x0:_0x33d58f['offset'];var _0x1701a4=_0x17fe37?_0x16b3d8[_0x42ec('0x1d')]:_0x33d58f[_0x42ec('0x1a')]+_0x33d58f[_0x42ec('0x1c')];var _0x49f62b;if(_0x1701a4>=_0x55acaf){_0x1701a4=_0x55acaf;_0x49f62b=0xc8;}else{_0x49f62b=0xce;}_0x2d94f4[_0x42ec('0x18')](_0x49f62b);return _0x2d94f4[_0x42ec('0x1e')]('Content-Range',_0x3b1057+'-'+_0x1701a4+'/'+_0x55acaf)[_0x42ec('0x19')](_0x16b3d8);}return null;};}function patchUpdates(_0x865a19){return function(_0x1b7a37){try{jsonpatch[_0x42ec('0x1f')](_0x1b7a37,_0x865a19,!![]);}catch(_0x4df496){return BPromise['reject'](_0x4df496);}return _0x1b7a37['save']();};}function saveUpdates(_0x9f395c,_0x3857b6){return function(_0x3ed60a){if(_0x3ed60a){return _0x3ed60a[_0x42ec('0x20')](_0x9f395c)[_0x42ec('0x21')](function(_0x5c959c){return _0x5c959c;});}return null;};}function removeEntity(_0xff2b12,_0xa0d082){return function(_0x389f8f){if(_0x389f8f){return _0x389f8f[_0x42ec('0x22')]()[_0x42ec('0x21')](function(){_0xff2b12[_0x42ec('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32f2fe,_0x2b2dc2){return function(_0x3b5d21){if(!_0x3b5d21){_0x32f2fe['sendStatus'](0x194);}return _0x3b5d21;};}function handleError(_0x699206,_0x20699e){_0x20699e=_0x20699e||0x1f4;return function(_0xdf0473){logger[_0x42ec('0x23')](_0xdf0473[_0x42ec('0x24')]);if(_0xdf0473[_0x42ec('0x25')]){delete _0xdf0473[_0x42ec('0x25')];}_0x699206['status'](_0x20699e)[_0x42ec('0x26')](_0xdf0473);};}exports['index']=function(_0xcc91a8,_0x37712e){var _0x1b7f0d={},_0x169db9={},_0x3dd6e1={'count':0x0,'rows':[]};var _0x15687b=_[_0x42ec('0x27')](db[_0x42ec('0x28')][_0x42ec('0x29')],function(_0xa34cfa){return{'name':_0xa34cfa['fieldName'],'type':_0xa34cfa['type'][_0x42ec('0x2a')]};});_0x169db9[_0x42ec('0x2b')]=_[_0x42ec('0x27')](_0x15687b,_0x42ec('0x25'));_0x169db9[_0x42ec('0x2c')]=_[_0x42ec('0x2d')](_0xcc91a8[_0x42ec('0x2c')]);_0x169db9[_0x42ec('0x2e')]=_[_0x42ec('0x2f')](_0x169db9[_0x42ec('0x2b')],_0x169db9[_0x42ec('0x2c')]);_0x1b7f0d[_0x42ec('0x30')]=_['intersection'](_0x169db9[_0x42ec('0x2b')],qs[_0x42ec('0x31')](_0xcc91a8[_0x42ec('0x2c')][_0x42ec('0x31')]));_0x1b7f0d['attributes']=_0x1b7f0d[_0x42ec('0x30')][_0x42ec('0x32')]?_0x1b7f0d[_0x42ec('0x30')]:_0x169db9[_0x42ec('0x2b')];if(!_0xcc91a8[_0x42ec('0x2c')]['hasOwnProperty'](_0x42ec('0x33'))){_0x1b7f0d[_0x42ec('0x1c')]=qs['limit'](_0xcc91a8[_0x42ec('0x2c')]['limit']);_0x1b7f0d[_0x42ec('0x1a')]=qs[_0x42ec('0x1a')](_0xcc91a8[_0x42ec('0x2c')][_0x42ec('0x1a')]);}_0x1b7f0d['order']=qs[_0x42ec('0x34')](_0xcc91a8['query']['sort']);_0x1b7f0d[_0x42ec('0x35')]=qs['filters'](_[_0x42ec('0x36')](_0xcc91a8[_0x42ec('0x2c')],_0x169db9[_0x42ec('0x2e')]),_0x15687b);if(_0xcc91a8[_0x42ec('0x2c')][_0x42ec('0x37')]){_0x1b7f0d[_0x42ec('0x35')]=_['merge'](_0x1b7f0d[_0x42ec('0x35')],{'$or':_[_0x42ec('0x27')](_0x15687b,function(_0x32cf6c){if(_0x32cf6c[_0x42ec('0x38')]!==_0x42ec('0x39')){var _0x2bc76f={};_0x2bc76f[_0x32cf6c[_0x42ec('0x25')]]={'$like':'%'+_0xcc91a8[_0x42ec('0x2c')][_0x42ec('0x37')]+'%'};return _0x2bc76f;}})});}_0x1b7f0d=_['merge']({},_0x1b7f0d,_0xcc91a8[_0x42ec('0x3a')]);var _0x281bd1={'where':_0x1b7f0d['where']};return db[_0x42ec('0x28')][_0x42ec('0x1d')](_0x281bd1)[_0x42ec('0x21')](function(_0x592aeb){_0x3dd6e1[_0x42ec('0x1d')]=_0x592aeb;if(_0xcc91a8[_0x42ec('0x2c')][_0x42ec('0x3b')]){_0x1b7f0d[_0x42ec('0x3c')]=[{'all':!![]}];}return db[_0x42ec('0x28')]['findAll'](_0x1b7f0d);})[_0x42ec('0x21')](function(_0xa3dd09){_0x3dd6e1[_0x42ec('0x3d')]=_0xa3dd09;return _0x3dd6e1;})[_0x42ec('0x21')](respondWithFilteredResult(_0x37712e,_0x1b7f0d))[_0x42ec('0x3e')](handleError(_0x37712e,null));};exports['show']=function(_0x41756d,_0x3367cf){var _0x9cbac9={'raw':!![],'where':{'id':_0x41756d[_0x42ec('0x3f')]['id']}},_0x11c580={};_0x11c580['model']=_[_0x42ec('0x2d')](db[_0x42ec('0x28')][_0x42ec('0x29')]);_0x11c580['query']=_['keys'](_0x41756d['query']);_0x11c580[_0x42ec('0x2e')]=_[_0x42ec('0x2f')](_0x11c580[_0x42ec('0x2b')],_0x11c580[_0x42ec('0x2c')]);_0x9cbac9[_0x42ec('0x30')]=_[_0x42ec('0x2f')](_0x11c580[_0x42ec('0x2b')],qs[_0x42ec('0x31')](_0x41756d[_0x42ec('0x2c')]['fields']));_0x9cbac9[_0x42ec('0x30')]=_0x9cbac9['attributes'][_0x42ec('0x32')]?_0x9cbac9[_0x42ec('0x30')]:_0x11c580[_0x42ec('0x2b')];if(_0x41756d[_0x42ec('0x2c')][_0x42ec('0x3b')]){_0x9cbac9[_0x42ec('0x3c')]=[{'all':!![]}];}_0x9cbac9=_[_0x42ec('0x40')]({},_0x9cbac9,_0x41756d[_0x42ec('0x3a')]);return db[_0x42ec('0x28')]['find'](_0x9cbac9)['then'](handleEntityNotFound(_0x3367cf,null))[_0x42ec('0x21')](respondWithResult(_0x3367cf,null))[_0x42ec('0x3e')](handleError(_0x3367cf,null));};exports[_0x42ec('0x41')]=function(_0x575bca,_0x30311b){return db[_0x42ec('0x28')][_0x42ec('0x41')](_0x575bca[_0x42ec('0x42')],{})['then'](respondWithResult(_0x30311b,0xc9))[_0x42ec('0x3e')](handleError(_0x30311b,null));};exports[_0x42ec('0x20')]=function(_0x1ad4d6,_0x21aa98){if(_0x1ad4d6['body']['id']){delete _0x1ad4d6[_0x42ec('0x42')]['id'];}return db[_0x42ec('0x28')]['find']({'where':{'id':_0x1ad4d6[_0x42ec('0x3f')]['id']}})[_0x42ec('0x21')](handleEntityNotFound(_0x21aa98,null))['then'](saveUpdates(_0x1ad4d6[_0x42ec('0x42')],null))[_0x42ec('0x21')](respondWithResult(_0x21aa98,null))['catch'](handleError(_0x21aa98,null));};exports[_0x42ec('0x22')]=function(_0x5772e5,_0x335a6e){return db['VoiceQueuesLog'][_0x42ec('0x43')]({'where':{'id':_0x5772e5['params']['id']}})[_0x42ec('0x21')](handleEntityNotFound(_0x335a6e,null))[_0x42ec('0x21')](removeEntity(_0x335a6e,null))['catch'](handleError(_0x335a6e,null));}; \ No newline at end of file +var _0xe2d1=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','sendStatus','error','name','send','index','map','VoiceQueuesLog','fieldName','key','query','keys','filters','intersection','attributes','fields','model','nolimit','sort','where','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','length','options','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0xe2d1,0x1eb));var _0x1e2d=function(_0x2bd5f2,_0x5cd164){_0x2bd5f2=_0x2bd5f2-0x0;var _0x1974c3=_0xe2d1[_0x2bd5f2];return _0x1974c3;};'use strict';var emlformat=require(_0x1e2d('0x0'));var rimraf=require(_0x1e2d('0x1'));var zipdir=require(_0x1e2d('0x2'));var jsonpatch=require(_0x1e2d('0x3'));var rp=require(_0x1e2d('0x4'));var moment=require('moment');var BPromise=require(_0x1e2d('0x5'));var Mustache=require('mustache');var util=require(_0x1e2d('0x6'));var path=require(_0x1e2d('0x7'));var sox=require('sox');var csv=require(_0x1e2d('0x8'));var ejs=require(_0x1e2d('0x9'));var fs=require('fs');var fs_extra=require(_0x1e2d('0xa'));var _=require(_0x1e2d('0xb'));var squel=require(_0x1e2d('0xc'));var crypto=require(_0x1e2d('0xd'));var jsforce=require(_0x1e2d('0xe'));var deskjs=require(_0x1e2d('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1e2d('0x10'));var Papa=require(_0x1e2d('0x11'));var Redis=require(_0x1e2d('0x12'));var authService=require(_0x1e2d('0x13'));var qs=require(_0x1e2d('0x14'));var as=require(_0x1e2d('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1e2d('0x16'))(_0x1e2d('0x17'));var utils=require('../../config/utils');var config=require(_0x1e2d('0x18'));var licenseUtil=require(_0x1e2d('0x19'));var db=require(_0x1e2d('0x1a'))['db'];function respondWithStatusCode(_0x6d5144,_0xa17d40){_0xa17d40=_0xa17d40||0xcc;return function(_0x4a4f14){if(_0x4a4f14){return _0x6d5144['sendStatus'](_0xa17d40);}return _0x6d5144[_0x1e2d('0x1b')](_0xa17d40)[_0x1e2d('0x1c')]();};}function respondWithResult(_0x3cb041,_0x1d3289){_0x1d3289=_0x1d3289||0xc8;return function(_0x519208){if(_0x519208){return _0x3cb041[_0x1e2d('0x1b')](_0x1d3289)[_0x1e2d('0x1d')](_0x519208);}};}function respondWithFilteredResult(_0x431446,_0x4bcd7c){return function(_0x188e69){if(_0x188e69){var _0x407469=typeof _0x4bcd7c[_0x1e2d('0x1e')]===_0x1e2d('0x1f')&&typeof _0x4bcd7c[_0x1e2d('0x20')]===_0x1e2d('0x1f');var _0x1353e0=_0x188e69[_0x1e2d('0x21')];var _0x3be07a=_0x407469?0x0:_0x4bcd7c['offset'];var _0x1a8dc5=_0x407469?_0x188e69[_0x1e2d('0x21')]:_0x4bcd7c[_0x1e2d('0x1e')]+_0x4bcd7c[_0x1e2d('0x20')];var _0x3fd3a4;if(_0x1a8dc5>=_0x1353e0){_0x1a8dc5=_0x1353e0;_0x3fd3a4=0xc8;}else{_0x3fd3a4=0xce;}_0x431446['status'](_0x3fd3a4);return _0x431446[_0x1e2d('0x22')](_0x1e2d('0x23'),_0x3be07a+'-'+_0x1a8dc5+'/'+_0x1353e0)['json'](_0x188e69);}return null;};}function patchUpdates(_0x4652ae){return function(_0x8041b3){try{jsonpatch[_0x1e2d('0x24')](_0x8041b3,_0x4652ae,!![]);}catch(_0x3e984d){return BPromise['reject'](_0x3e984d);}return _0x8041b3['save']();};}function saveUpdates(_0xc01225,_0xd72449){return function(_0x116708){if(_0x116708){return _0x116708[_0x1e2d('0x25')](_0xc01225)[_0x1e2d('0x26')](function(_0x364ea9){return _0x364ea9;});}return null;};}function removeEntity(_0x5a1ea1,_0x28a60a){return function(_0x58b5be){if(_0x58b5be){return _0x58b5be[_0x1e2d('0x27')]()[_0x1e2d('0x26')](function(){_0x5a1ea1['status'](0xcc)[_0x1e2d('0x1c')]();});}};}function handleEntityNotFound(_0x3bdadb,_0x2f8fe6){return function(_0x4d2340){if(!_0x4d2340){_0x3bdadb[_0x1e2d('0x28')](0x194);}return _0x4d2340;};}function handleError(_0x8b89f6,_0x2238c0){_0x2238c0=_0x2238c0||0x1f4;return function(_0x920866){logger[_0x1e2d('0x29')](_0x920866['stack']);if(_0x920866[_0x1e2d('0x2a')]){delete _0x920866[_0x1e2d('0x2a')];}_0x8b89f6[_0x1e2d('0x1b')](_0x2238c0)[_0x1e2d('0x2b')](_0x920866);};}exports[_0x1e2d('0x2c')]=function(_0x109bc2,_0x41e10d){var _0x3f0337={},_0x27decb={},_0x1a0f58={'count':0x0,'rows':[]};var _0x2f2a68=_[_0x1e2d('0x2d')](db[_0x1e2d('0x2e')]['rawAttributes'],function(_0x1548e7){return{'name':_0x1548e7[_0x1e2d('0x2f')],'type':_0x1548e7['type'][_0x1e2d('0x30')]};});_0x27decb['model']=_[_0x1e2d('0x2d')](_0x2f2a68,'name');_0x27decb[_0x1e2d('0x31')]=_[_0x1e2d('0x32')](_0x109bc2[_0x1e2d('0x31')]);_0x27decb[_0x1e2d('0x33')]=_[_0x1e2d('0x34')](_0x27decb['model'],_0x27decb['query']);_0x3f0337[_0x1e2d('0x35')]=_[_0x1e2d('0x34')](_0x27decb['model'],qs[_0x1e2d('0x36')](_0x109bc2['query'][_0x1e2d('0x36')]));_0x3f0337['attributes']=_0x3f0337[_0x1e2d('0x35')]['length']?_0x3f0337[_0x1e2d('0x35')]:_0x27decb[_0x1e2d('0x37')];if(!_0x109bc2[_0x1e2d('0x31')]['hasOwnProperty'](_0x1e2d('0x38'))){_0x3f0337['limit']=qs['limit'](_0x109bc2[_0x1e2d('0x31')][_0x1e2d('0x20')]);_0x3f0337[_0x1e2d('0x1e')]=qs[_0x1e2d('0x1e')](_0x109bc2[_0x1e2d('0x31')][_0x1e2d('0x1e')]);}_0x3f0337['order']=qs[_0x1e2d('0x39')](_0x109bc2[_0x1e2d('0x31')]['sort']);_0x3f0337[_0x1e2d('0x3a')]=qs[_0x1e2d('0x33')](_['pick'](_0x109bc2[_0x1e2d('0x31')],_0x27decb[_0x1e2d('0x33')]),_0x2f2a68);if(_0x109bc2[_0x1e2d('0x31')][_0x1e2d('0x3b')]){_0x3f0337['where']=_['merge'](_0x3f0337['where'],{'$or':_['map'](_0x2f2a68,function(_0x21d728){if(_0x21d728[_0x1e2d('0x3c')]!==_0x1e2d('0x3d')){var _0x48fce3={};_0x48fce3[_0x21d728[_0x1e2d('0x2a')]]={'$like':'%'+_0x109bc2[_0x1e2d('0x31')]['filter']+'%'};return _0x48fce3;}})});}_0x3f0337=_[_0x1e2d('0x3e')]({},_0x3f0337,_0x109bc2['options']);var _0xfab67e={'where':_0x3f0337[_0x1e2d('0x3a')]};return db['VoiceQueuesLog'][_0x1e2d('0x21')](_0xfab67e)['then'](function(_0x2e3695){_0x1a0f58[_0x1e2d('0x21')]=_0x2e3695;if(_0x109bc2[_0x1e2d('0x31')][_0x1e2d('0x3f')]){_0x3f0337[_0x1e2d('0x40')]=[{'all':!![]}];}return db[_0x1e2d('0x2e')][_0x1e2d('0x41')](_0x3f0337);})['then'](function(_0x33bda4){_0x1a0f58[_0x1e2d('0x42')]=_0x33bda4;return _0x1a0f58;})[_0x1e2d('0x26')](respondWithFilteredResult(_0x41e10d,_0x3f0337))[_0x1e2d('0x43')](handleError(_0x41e10d,null));};exports['show']=function(_0x9977f2,_0x55a52e){var _0x1adf4={'raw':!![],'where':{'id':_0x9977f2['params']['id']}},_0x6e67a3={};_0x6e67a3[_0x1e2d('0x37')]=_[_0x1e2d('0x32')](db[_0x1e2d('0x2e')]['rawAttributes']);_0x6e67a3[_0x1e2d('0x31')]=_[_0x1e2d('0x32')](_0x9977f2[_0x1e2d('0x31')]);_0x6e67a3['filters']=_[_0x1e2d('0x34')](_0x6e67a3[_0x1e2d('0x37')],_0x6e67a3[_0x1e2d('0x31')]);_0x1adf4[_0x1e2d('0x35')]=_[_0x1e2d('0x34')](_0x6e67a3[_0x1e2d('0x37')],qs['fields'](_0x9977f2[_0x1e2d('0x31')][_0x1e2d('0x36')]));_0x1adf4['attributes']=_0x1adf4[_0x1e2d('0x35')][_0x1e2d('0x44')]?_0x1adf4[_0x1e2d('0x35')]:_0x6e67a3[_0x1e2d('0x37')];if(_0x9977f2[_0x1e2d('0x31')][_0x1e2d('0x3f')]){_0x1adf4[_0x1e2d('0x40')]=[{'all':!![]}];}_0x1adf4=_[_0x1e2d('0x3e')]({},_0x1adf4,_0x9977f2[_0x1e2d('0x45')]);return db[_0x1e2d('0x2e')]['find'](_0x1adf4)[_0x1e2d('0x26')](handleEntityNotFound(_0x55a52e,null))[_0x1e2d('0x26')](respondWithResult(_0x55a52e,null))[_0x1e2d('0x43')](handleError(_0x55a52e,null));};exports['create']=function(_0x70c804,_0x11b19c){return db[_0x1e2d('0x2e')][_0x1e2d('0x46')](_0x70c804[_0x1e2d('0x47')],{})[_0x1e2d('0x26')](respondWithResult(_0x11b19c,0xc9))[_0x1e2d('0x43')](handleError(_0x11b19c,null));};exports[_0x1e2d('0x25')]=function(_0x4f4cc0,_0x4b7094){if(_0x4f4cc0[_0x1e2d('0x47')]['id']){delete _0x4f4cc0['body']['id'];}return db[_0x1e2d('0x2e')]['find']({'where':{'id':_0x4f4cc0[_0x1e2d('0x48')]['id']}})[_0x1e2d('0x26')](handleEntityNotFound(_0x4b7094,null))[_0x1e2d('0x26')](saveUpdates(_0x4f4cc0['body'],null))[_0x1e2d('0x26')](respondWithResult(_0x4b7094,null))['catch'](handleError(_0x4b7094,null));};exports[_0x1e2d('0x27')]=function(_0x5ad73c,_0x14c9e6){return db[_0x1e2d('0x2e')]['find']({'where':{'id':_0x5ad73c[_0x1e2d('0x48')]['id']}})['then'](handleEntityNotFound(_0x14c9e6,null))[_0x1e2d('0x26')](removeEntity(_0x14c9e6,null))[_0x1e2d('0x43')](handleError(_0x14c9e6,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index a0ed3d7..1b9145c 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 _0xaced=['define','VoiceQueuesLog','voice_queues_log','event_dtm','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x404cde,_0x27b51c){var _0x139882=function(_0x1f31d1){while(--_0x1f31d1){_0x404cde['push'](_0x404cde['shift']());}};_0x139882(++_0x27b51c);}(_0xaced,0x18c));var _0xdace=function(_0x199697,_0x3d296b){_0x199697=_0x199697-0x0;var _0x2b01fa=_0xaced[_0x199697];return _0x2b01fa;};'use strict';var _=require(_0xdace('0x0'));var util=require(_0xdace('0x1'));var logger=require(_0xdace('0x2'))(_0xdace('0x3'));var moment=require(_0xdace('0x4'));var BPromise=require('bluebird');var rp=require(_0xdace('0x5'));var fs=require('fs');var path=require(_0xdace('0x6'));var rimraf=require(_0xdace('0x7'));var config=require(_0xdace('0x8'));var attributes=require('./voiceQueuesLog.attributes');module[_0xdace('0x9')]=function(_0x4d7f80,_0x5f5d92){return _0x4d7f80[_0xdace('0xa')](_0xdace('0xb'),attributes,{'tableName':_0xdace('0xc'),'paranoid':![],'indexes':[{'name':_0xdace('0xd'),'fields':['event','dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0x3eed=['dtm','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','VoiceQueuesLog','voice_queues_log'];(function(_0x4dcfd7,_0x11ba40){var _0x420f6c=function(_0x3d8fde){while(--_0x3d8fde){_0x4dcfd7['push'](_0x4dcfd7['shift']());}};_0x420f6c(++_0x11ba40);}(_0x3eed,0x1b9));var _0xd3ee=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x3eed[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0xd3ee('0x0'));var logger=require('../../config/logger')(_0xd3ee('0x1'));var moment=require('moment');var BPromise=require(_0xd3ee('0x2'));var rp=require(_0xd3ee('0x3'));var fs=require('fs');var path=require(_0xd3ee('0x4'));var rimraf=require(_0xd3ee('0x5'));var config=require(_0xd3ee('0x6'));var attributes=require('./voiceQueuesLog.attributes');module[_0xd3ee('0x7')]=function(_0x4cc943,_0x2711cd){return _0x4cc943['define'](_0xd3ee('0x8'),attributes,{'tableName':_0xd3ee('0x9'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':['event',_0xd3ee('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index d1cde69..a703302 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 _0x2b5f=['stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s'];(function(_0x4f9a71,_0x4dfa0a){var _0x5526b9=function(_0x44c3fd){while(--_0x44c3fd){_0x4f9a71['push'](_0x4f9a71['shift']());}};_0x5526b9(++_0x4dfa0a);}(_0x2b5f,0x118));var _0xf2b5=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x2b5f[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xf2b5('0x0'));var util=require(_0xf2b5('0x1'));var moment=require(_0xf2b5('0x2'));var BPromise=require(_0xf2b5('0x3'));var rs=require(_0xf2b5('0x4'));var fs=require('fs');var Redis=require(_0xf2b5('0x5'));var db=require(_0xf2b5('0x6'))['db'];var utils=require(_0xf2b5('0x7'));var logger=require(_0xf2b5('0x8'))(_0xf2b5('0x9'));var config=require(_0xf2b5('0xa'));var jayson=require(_0xf2b5('0xb'));var client=jayson[_0xf2b5('0xc')][_0xf2b5('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x554539,_0x34e7a2,_0xd6e9f){return new BPromise(function(_0x2d6659,_0xa6008f){return client[_0xf2b5('0xe')](_0x554539,_0xd6e9f)[_0xf2b5('0xf')](function(_0x5b1169){logger[_0xf2b5('0x10')](_0xf2b5('0x11'),_0x34e7a2,_0xf2b5('0x12'));logger['debug'](_0xf2b5('0x13'),_0x34e7a2,_0xf2b5('0x12'),JSON[_0xf2b5('0x14')](_0x5b1169));if(_0x5b1169[_0xf2b5('0x15')]){if(_0x5b1169[_0xf2b5('0x15')][_0xf2b5('0x16')]===0x1f4){logger['error'](_0xf2b5('0x11'),_0x34e7a2,_0x5b1169['error'][_0xf2b5('0x17')]);return _0xa6008f(_0x5b1169[_0xf2b5('0x15')][_0xf2b5('0x17')]);}logger[_0xf2b5('0x15')](_0xf2b5('0x11'),_0x34e7a2,_0x5b1169[_0xf2b5('0x15')][_0xf2b5('0x17')]);return _0x2d6659(_0x5b1169[_0xf2b5('0x15')][_0xf2b5('0x17')]);}else{logger['info'](_0xf2b5('0x11'),_0x34e7a2,_0xf2b5('0x12'));_0x2d6659(_0x5b1169['result'][_0xf2b5('0x17')]);}})[_0xf2b5('0x18')](function(_0x308886){logger[_0xf2b5('0x15')](_0xf2b5('0x11'),_0x34e7a2,_0x308886);_0xa6008f(_0x308886);});});} \ No newline at end of file +var _0x1a49=['message','info','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','VoiceQueuesLog,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0x3863e9,_0x3c4e82){var _0x341742=function(_0x368df4){while(--_0x368df4){_0x3863e9['push'](_0x3863e9['shift']());}};_0x341742(++_0x3c4e82);}(_0x1a49,0xf6));var _0x91a4=function(_0x22e0d5,_0x3b2a19){_0x22e0d5=_0x22e0d5-0x0;var _0x3439c8=_0x1a49[_0x22e0d5];return _0x3439c8;};'use strict';var _=require(_0x91a4('0x0'));var util=require(_0x91a4('0x1'));var moment=require(_0x91a4('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x91a4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x91a4('0x4'));var logger=require(_0x91a4('0x5'))('rpc');var config=require(_0x91a4('0x6'));var jayson=require(_0x91a4('0x7'));var client=jayson[_0x91a4('0x8')][_0x91a4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2842e3,_0x4afd74,_0x55f3a8){return new BPromise(function(_0x43c4cc,_0x5a0b6c){return client[_0x91a4('0xa')](_0x2842e3,_0x55f3a8)[_0x91a4('0xb')](function(_0x3b8c4d){logger['info'](_0x91a4('0xc'),_0x4afd74,'request\x20sent');logger[_0x91a4('0xd')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x4afd74,_0x91a4('0xe'),JSON[_0x91a4('0xf')](_0x3b8c4d));if(_0x3b8c4d['error']){if(_0x3b8c4d[_0x91a4('0x10')][_0x91a4('0x11')]===0x1f4){logger[_0x91a4('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4afd74,_0x3b8c4d['error'][_0x91a4('0x12')]);return _0x5a0b6c(_0x3b8c4d[_0x91a4('0x10')]['message']);}logger[_0x91a4('0x10')](_0x91a4('0xc'),_0x4afd74,_0x3b8c4d[_0x91a4('0x10')][_0x91a4('0x12')]);return _0x43c4cc(_0x3b8c4d[_0x91a4('0x10')][_0x91a4('0x12')]);}else{logger[_0x91a4('0x13')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4afd74,_0x91a4('0xe'));_0x43c4cc(_0x3b8c4d[_0x91a4('0x14')][_0x91a4('0x12')]);}})[_0x91a4('0x15')](function(_0x5b3bda){logger['error'](_0x91a4('0xc'),_0x4afd74,_0x5b3bda);_0x5a0b6c(_0x5b3bda);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 238060a..b881582 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 _0x7ac2=['/:id','show','/:id/download','/:id/downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','update','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe'];(function(_0x2b8f2b,_0x3e41ac){var _0x12b3ff=function(_0x179f1f){while(--_0x179f1f){_0x2b8f2b['push'](_0x2b8f2b['shift']());}};_0x12b3ff(++_0x3e41ac);}(_0x7ac2,0x1d7));var _0x27ac=function(_0x475200,_0x2f2ac2){_0x475200=_0x475200-0x0;var _0x1aec39=_0x7ac2[_0x475200];return _0x1aec39;};'use strict';var multer=require(_0x27ac('0x0'));var util=require(_0x27ac('0x1'));var path=require(_0x27ac('0x2'));var timeout=require('connect-timeout');var express=require(_0x27ac('0x3'));var router=express[_0x27ac('0x4')]();var fs_extra=require(_0x27ac('0x5'));var auth=require(_0x27ac('0x6'));var interaction=require(_0x27ac('0x7'));var config=require(_0x27ac('0x8'));var controller=require('./voiceRecording.controller');router[_0x27ac('0x9')]('/',auth[_0x27ac('0xa')](),controller['index']);router['get']('/describe',auth[_0x27ac('0xa')](),controller[_0x27ac('0xb')]);router[_0x27ac('0x9')](_0x27ac('0xc'),auth[_0x27ac('0xa')](),controller[_0x27ac('0xd')]);router[_0x27ac('0x9')](_0x27ac('0xe'),auth['isAuthenticated'](),controller['download']);router[_0x27ac('0x9')](_0x27ac('0xf'),controller['downloads']);router[_0x27ac('0x9')](_0x27ac('0x10'),auth[_0x27ac('0xa')](),controller[_0x27ac('0x11')]);router[_0x27ac('0x12')]('/',auth[_0x27ac('0xa')](),controller['create']);router['post'](_0x27ac('0x10'),auth[_0x27ac('0xa')](),controller[_0x27ac('0x13')]);router['put']('/:id',auth[_0x27ac('0xa')](),controller[_0x27ac('0x14')]);router['delete'](_0x27ac('0xc'),auth[_0x27ac('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xcec5=['runTranscribe','put','/:id','update','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create'];(function(_0x10c51f,_0x11270f){var _0x56a0cd=function(_0x563ac6){while(--_0x563ac6){_0x10c51f['push'](_0x10c51f['shift']());}};_0x56a0cd(++_0x11270f);}(_0xcec5,0x1d0));var _0x5cec=function(_0x28cc31,_0x42fc4e){_0x28cc31=_0x28cc31-0x0;var _0x37ddc0=_0xcec5[_0x28cc31];return _0x37ddc0;};'use strict';var multer=require(_0x5cec('0x0'));var util=require('util');var path=require(_0x5cec('0x1'));var timeout=require(_0x5cec('0x2'));var express=require(_0x5cec('0x3'));var router=express[_0x5cec('0x4')]();var fs_extra=require(_0x5cec('0x5'));var auth=require(_0x5cec('0x6'));var interaction=require(_0x5cec('0x7'));var config=require(_0x5cec('0x8'));var controller=require('./voiceRecording.controller');router[_0x5cec('0x9')]('/',auth[_0x5cec('0xa')](),controller[_0x5cec('0xb')]);router[_0x5cec('0x9')](_0x5cec('0xc'),auth['isAuthenticated'](),controller[_0x5cec('0xd')]);router[_0x5cec('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5cec('0x9')](_0x5cec('0xe'),auth[_0x5cec('0xa')](),controller[_0x5cec('0xf')]);router[_0x5cec('0x9')](_0x5cec('0x10'),controller[_0x5cec('0x11')]);router[_0x5cec('0x9')](_0x5cec('0x12'),auth[_0x5cec('0xa')](),controller[_0x5cec('0x13')]);router[_0x5cec('0x14')]('/',auth['isAuthenticated'](),controller[_0x5cec('0x15')]);router[_0x5cec('0x14')](_0x5cec('0x12'),auth[_0x5cec('0xa')](),controller[_0x5cec('0x16')]);router[_0x5cec('0x17')](_0x5cec('0x18'),auth[_0x5cec('0xa')](),controller[_0x5cec('0x19')]);router['delete'](_0x5cec('0x18'),auth[_0x5cec('0xa')](),controller[_0x5cec('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 5d30306..c980f43 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(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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 30335bf..4d4a418 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 _0x4e17=['Voice\x20Recording\x20not\x20found','transcribe','runSentiment','sentiment','sentimentAccountId','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','tempSentiment','updateAttributes','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','eml-format','rimraf','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','apply','reject','save','then','destroy','end','error','stack','send','map','VoiceRecording','rawAttributes','key','model','differenceBy','name','format','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','find','create','body','params','describe','catch','download','../../components/encryptor','uniqueid','value','%s.cypher','secrets','recording','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','decryptFile','isNil','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne'];(function(_0xbb4d87,_0x2b5f49){var _0x250d61=function(_0x4a3bd6){while(--_0x4a3bd6){_0xbb4d87['push'](_0xbb4d87['shift']());}};_0x250d61(++_0x2b5f49);}(_0x4e17,0x153));var _0x74e1=function(_0x2c5a1d,_0x47b0e1){_0x2c5a1d=_0x2c5a1d-0x0;var _0x10fcae=_0x4e17[_0x2c5a1d];return _0x10fcae;};'use strict';var emlformat=require(_0x74e1('0x0'));var rimraf=require(_0x74e1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x74e1('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x74e1('0x3'));var util=require(_0x74e1('0x4'));var path=require(_0x74e1('0x5'));var sox=require(_0x74e1('0x6'));var csv=require(_0x74e1('0x7'));var ejs=require(_0x74e1('0x8'));var fs=require('fs');var fs_extra=require(_0x74e1('0x9'));var _=require(_0x74e1('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x74e1('0xb'));var deskjs=require(_0x74e1('0xc'));var toCsv=require(_0x74e1('0x7'));var querystring=require(_0x74e1('0xd'));var Papa=require(_0x74e1('0xe'));var AWS=require(_0x74e1('0xf'));var uuidv4=require(_0x74e1('0x10'));var Redis=require(_0x74e1('0x11'));var authService=require(_0x74e1('0x12'));var qs=require(_0x74e1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x74e1('0x14'))(_0x74e1('0x15'));var utils=require(_0x74e1('0x16'));var config=require(_0x74e1('0x17'));var licenseUtil=require(_0x74e1('0x18'));var db=require(_0x74e1('0x19'))['db'];function respondWithStatusCode(_0x4448af,_0x3e9027){_0x3e9027=_0x3e9027||0xcc;return function(_0x2bdb4a){if(_0x2bdb4a){return _0x4448af[_0x74e1('0x1a')](_0x3e9027);}return _0x4448af[_0x74e1('0x1b')](_0x3e9027)['end']();};}function respondWithResult(_0x50b8a8,_0x3fea6f){_0x3fea6f=_0x3fea6f||0xc8;return function(_0x123320){if(_0x123320){return _0x50b8a8[_0x74e1('0x1b')](_0x3fea6f)[_0x74e1('0x1c')](_0x123320);}};}function respondWithFilteredResult(_0x2773f5,_0x14a473){return function(_0x1b1aba){if(_0x1b1aba){var _0x110827=typeof _0x14a473[_0x74e1('0x1d')]===_0x74e1('0x1e')&&typeof _0x14a473['limit']===_0x74e1('0x1e');var _0x2f2828=_0x1b1aba[_0x74e1('0x1f')];var _0xb71301=_0x110827?0x0:_0x14a473[_0x74e1('0x1d')];var _0x439edb=_0x110827?_0x1b1aba['count']:_0x14a473[_0x74e1('0x1d')]+_0x14a473['limit'];var _0x1a8682;if(_0x439edb>=_0x2f2828){_0x439edb=_0x2f2828;_0x1a8682=0xc8;}else{_0x1a8682=0xce;}_0x2773f5[_0x74e1('0x1b')](_0x1a8682);return _0x2773f5['set']('Content-Range',_0xb71301+'-'+_0x439edb+'/'+_0x2f2828)[_0x74e1('0x1c')](_0x1b1aba);}return null;};}function patchUpdates(_0x64c5ef){return function(_0x1029bc){try{jsonpatch[_0x74e1('0x20')](_0x1029bc,_0x64c5ef,!![]);}catch(_0x571eb7){return BPromise[_0x74e1('0x21')](_0x571eb7);}return _0x1029bc[_0x74e1('0x22')]();};}function saveUpdates(_0x1a35d2,_0x1247b6){return function(_0x2d75b1){if(_0x2d75b1){return _0x2d75b1['update'](_0x1a35d2)[_0x74e1('0x23')](function(_0x4e2ad7){return _0x4e2ad7;});}return null;};}function removeEntity(_0x11a881,_0x32b2ab){return function(_0x15d1a1){if(_0x15d1a1){return _0x15d1a1[_0x74e1('0x24')]()[_0x74e1('0x23')](function(){_0x11a881[_0x74e1('0x1b')](0xcc)[_0x74e1('0x25')]();});}};}function handleEntityNotFound(_0x42e0f9,_0xe62293){return function(_0x5931c7){if(!_0x5931c7){_0x42e0f9[_0x74e1('0x1a')](0x194);}return _0x5931c7;};}function handleError(_0x15981a,_0x213e2d){_0x213e2d=_0x213e2d||0x1f4;return function(_0x565e0d){logger[_0x74e1('0x26')](_0x565e0d[_0x74e1('0x27')]);if(_0x565e0d['name']){delete _0x565e0d['name'];}_0x15981a[_0x74e1('0x1b')](_0x213e2d)[_0x74e1('0x28')](_0x565e0d);};}exports['index']=function(_0x576f94,_0xb0eb3b){var _0xb7a49a={},_0x4c853d={},_0x8806c4={'count':0x0,'rows':[]};var _0x391d77=_[_0x74e1('0x29')](db[_0x74e1('0x2a')][_0x74e1('0x2b')],function(_0x14558f){return{'name':_0x14558f['fieldName'],'type':_0x14558f['type'][_0x74e1('0x2c')]};});_0x4c853d[_0x74e1('0x2d')]=_[_0x74e1('0x2e')](_[_0x74e1('0x29')](_0x391d77,_0x74e1('0x2f')),[_0x74e1('0x30')]);_0x4c853d[_0x74e1('0x31')]=_[_0x74e1('0x32')](_0x576f94[_0x74e1('0x31')]);_0x4c853d[_0x74e1('0x33')]=_[_0x74e1('0x34')](_0x4c853d[_0x74e1('0x2d')],_0x4c853d[_0x74e1('0x31')]);_0xb7a49a[_0x74e1('0x35')]=_['intersection'](_0x4c853d[_0x74e1('0x2d')],qs[_0x74e1('0x36')](_0x576f94[_0x74e1('0x31')][_0x74e1('0x36')]));_0xb7a49a[_0x74e1('0x35')]=_0xb7a49a['attributes'][_0x74e1('0x37')]?_0xb7a49a[_0x74e1('0x35')]:_0x4c853d[_0x74e1('0x2d')];if(!_0x576f94[_0x74e1('0x31')]['hasOwnProperty'](_0x74e1('0x38'))){_0xb7a49a[_0x74e1('0x39')]=qs[_0x74e1('0x39')](_0x576f94[_0x74e1('0x31')][_0x74e1('0x39')]);_0xb7a49a[_0x74e1('0x1d')]=qs['offset'](_0x576f94[_0x74e1('0x31')][_0x74e1('0x1d')]);}_0xb7a49a[_0x74e1('0x3a')]=qs[_0x74e1('0x3b')](_0x576f94[_0x74e1('0x31')][_0x74e1('0x3b')]);_0xb7a49a['where']=qs['filters'](_[_0x74e1('0x3c')](_0x576f94[_0x74e1('0x31')],_0x4c853d[_0x74e1('0x33')]),_0x391d77);if(_0x576f94[_0x74e1('0x31')][_0x74e1('0x3d')]){_0xb7a49a[_0x74e1('0x3e')]=_['merge'](_0xb7a49a['where'],{'$or':_[_0x74e1('0x29')](_0x391d77,function(_0x34e9b9){if(_0x34e9b9[_0x74e1('0x3f')]!==_0x74e1('0x40')){var _0x352482={};_0x352482[_0x34e9b9['name']]={'$like':'%'+_0x576f94[_0x74e1('0x31')][_0x74e1('0x3d')]+'%'};return _0x352482;}})});}_0xb7a49a=_[_0x74e1('0x41')]({},_0xb7a49a,_0x576f94[_0x74e1('0x42')]);var _0x13c008={'where':_0xb7a49a['where']};return db['VoiceRecording'][_0x74e1('0x1f')](_0x13c008)[_0x74e1('0x23')](function(_0x1c4ddc){_0x8806c4[_0x74e1('0x1f')]=_0x1c4ddc;if(_0x576f94[_0x74e1('0x31')][_0x74e1('0x43')]){_0xb7a49a[_0x74e1('0x44')]=[{'all':!![]}];}return db['VoiceRecording'][_0x74e1('0x45')](_0xb7a49a);})[_0x74e1('0x23')](function(_0x46ca2d){_0x8806c4[_0x74e1('0x46')]=_0x46ca2d;return _0x8806c4;})[_0x74e1('0x23')](respondWithFilteredResult(_0xb0eb3b,_0xb7a49a))['catch'](handleError(_0xb0eb3b,null));};exports[_0x74e1('0x47')]=function(_0x420d36,_0x1a627c){var _0xd9fd67={'raw':![],'where':{'id':_0x420d36['params']['id']}},_0x325a45={};_0x325a45[_0x74e1('0x2d')]=_[_0x74e1('0x32')](db['VoiceRecording'][_0x74e1('0x2b')]);_0x325a45[_0x74e1('0x31')]=_[_0x74e1('0x32')](_0x420d36[_0x74e1('0x31')]);_0x325a45[_0x74e1('0x33')]=_[_0x74e1('0x34')](_0x325a45[_0x74e1('0x2d')],_0x325a45['query']);_0xd9fd67[_0x74e1('0x35')]=_[_0x74e1('0x34')](_0x325a45[_0x74e1('0x2d')],qs[_0x74e1('0x36')](_0x420d36[_0x74e1('0x31')][_0x74e1('0x36')]));_0xd9fd67[_0x74e1('0x35')]=_0xd9fd67[_0x74e1('0x35')][_0x74e1('0x37')]?_0xd9fd67[_0x74e1('0x35')]:_0x325a45[_0x74e1('0x2d')];if(_0x420d36['query'][_0x74e1('0x43')]){_0xd9fd67[_0x74e1('0x44')]=[{'all':!![]}];}_0xd9fd67=_[_0x74e1('0x41')]({},_0xd9fd67,_0x420d36['options']);return db[_0x74e1('0x2a')][_0x74e1('0x48')](_0xd9fd67)[_0x74e1('0x23')](handleEntityNotFound(_0x1a627c,null))[_0x74e1('0x23')](respondWithResult(_0x1a627c,null))['catch'](handleError(_0x1a627c,null));};exports[_0x74e1('0x49')]=function(_0x257514,_0x473b69){return db[_0x74e1('0x2a')][_0x74e1('0x49')](_0x257514[_0x74e1('0x4a')],{})[_0x74e1('0x23')](respondWithResult(_0x473b69,0xc9))['catch'](handleError(_0x473b69,null));};exports['update']=function(_0x5d78a6,_0x46e70e){if(_0x5d78a6['body']['id']){delete _0x5d78a6[_0x74e1('0x4a')]['id'];}return db[_0x74e1('0x2a')][_0x74e1('0x48')]({'where':{'id':_0x5d78a6[_0x74e1('0x4b')]['id']}})[_0x74e1('0x23')](handleEntityNotFound(_0x46e70e,null))['then'](saveUpdates(_0x5d78a6[_0x74e1('0x4a')],null))['then'](respondWithResult(_0x46e70e,null))['catch'](handleError(_0x46e70e,null));};exports['describe']=function(_0x4b49b7,_0x5ebbea){return db[_0x74e1('0x2a')][_0x74e1('0x4c')]()[_0x74e1('0x23')](respondWithResult(_0x5ebbea,null))[_0x74e1('0x4d')](handleError(_0x5ebbea,null));};exports[_0x74e1('0x4e')]=function(_0x9ed1cb,_0x524f66,_0x23fc78){var _0x6fb343=require(_0x74e1('0x4f'));var _0x4dd188=![];var _0x260ed9={};if(_0x9ed1cb['query'][_0x74e1('0x3f')]&&_0x9ed1cb[_0x74e1('0x31')]['type']===_0x74e1('0x50')){_0x260ed9[_0x74e1('0x50')]=_0x9ed1cb[_0x74e1('0x4b')]['id'];}else{_0x260ed9['id']=_0x9ed1cb[_0x74e1('0x4b')]['id'];}return db[_0x74e1('0x2a')][_0x74e1('0x48')]({'where':_0x260ed9,'attributes':['id',_0x74e1('0x51')],'raw':!![]})[_0x74e1('0x23')](handleEntityNotFound(_0x524f66,null))[_0x74e1('0x23')](function(_0x4382a8){if(_0x4382a8){var _0x437b61=_0x4382a8[_0x74e1('0x51')];var _0x454519=util[_0x74e1('0x30')](_0x74e1('0x52'),_0x437b61);if(fs['existsSync'](_0x454519)){_0x4dd188=!![];return _0x6fb343['decryptFile'](_0x454519,_0x437b61,config[_0x74e1('0x53')][_0x74e1('0x54')])[_0x74e1('0x23')](function(){return _0x4382a8;});}return _0x4382a8;}})[_0x74e1('0x23')](function(_0x474040){if(_0x474040){var _0x2d9028=_0x474040[_0x74e1('0x51')];if(!fs[_0x74e1('0x55')](_0x2d9028)){throw new db[(_0x74e1('0x56'))][(_0x74e1('0x57'))](_0x74e1('0x58'));}if(_0x474040['filename']){return _0x524f66[_0x74e1('0x4e')](_0x2d9028,_0x474040[_0x74e1('0x59')]+path[_0x74e1('0x5a')](_0x2d9028),function(){if(_0x4dd188){fs[_0x74e1('0x5b')](_0x2d9028);}});}else{return _0x524f66['download'](_0x2d9028,function(_0x5d357b){if(_0x4dd188){fs[_0x74e1('0x5b')](_0x2d9028);}});}}})['catch'](function(_0x42faf6){if(_0x42faf6['message']===_0x74e1('0x58')){_0x524f66[_0x74e1('0x1b')](0x194)[_0x74e1('0x28')](_0x74e1('0x5c'));}else{return handleError(_0x524f66,null);}});};exports[_0x74e1('0x5d')]=function(_0x374552,_0x4c61c3,_0x362d40){var _0x2dfe13=require(_0x74e1('0x4f'));var _0x45030=![];var _0x39eec6={'$and':[db[_0x74e1('0x5e')][_0x74e1('0x3e')](db[_0x74e1('0x5e')]['fn'](_0x74e1('0x5f'),db['sequelize'][_0x74e1('0x60')](_0x74e1('0x50'))),_0x374552[_0x74e1('0x31')][_0x74e1('0x61')])]};if(_0x374552['query']['type']&&_0x374552[_0x74e1('0x31')][_0x74e1('0x3f')]===_0x74e1('0x50')){_0x39eec6[_0x74e1('0x62')][_0x74e1('0x63')]({'uniqueid':_0x374552['params']['id']});}else{_0x39eec6[_0x74e1('0x62')][_0x74e1('0x63')]({'id':_0x374552[_0x74e1('0x4b')]['id']});}return db[_0x74e1('0x2a')][_0x74e1('0x48')]({'where':_0x39eec6,'attributes':['id','value'],'raw':!![]})[_0x74e1('0x23')](handleEntityNotFound(_0x4c61c3,null))[_0x74e1('0x23')](function(_0x579ce8){if(_0x579ce8){var _0x5a6aa3=util[_0x74e1('0x30')]('%s.cypher',_0x579ce8['value']);if(fs[_0x74e1('0x55')](_0x5a6aa3)){_0x45030=!![];return _0x2dfe13[_0x74e1('0x64')](_0x5a6aa3,_0x579ce8[_0x74e1('0x51')],config['secrets'][_0x74e1('0x54')])[_0x74e1('0x23')](function(){return _0x579ce8;});}return _0x579ce8;}})[_0x74e1('0x23')](function(_0x5f576a){if(_0x5f576a){if(!fs[_0x74e1('0x55')](_0x5f576a[_0x74e1('0x51')])){throw new db[(_0x74e1('0x56'))][(_0x74e1('0x57'))]('VoiceRecording\x20not\x20found');}if(_0x5f576a[_0x74e1('0x59')]){return _0x4c61c3[_0x74e1('0x4e')](_0x5f576a[_0x74e1('0x51')],_0x5f576a[_0x74e1('0x59')]+path[_0x74e1('0x5a')](_0x5f576a[_0x74e1('0x51')]),function(){if(_0x45030){fs[_0x74e1('0x5b')](_0x5f576a[_0x74e1('0x51')]);}});}else{return _0x4c61c3[_0x74e1('0x4e')](_0x5f576a[_0x74e1('0x51')],function(_0x380f22){if(_0x45030){fs[_0x74e1('0x5b')](_0x5f576a[_0x74e1('0x51')]);}});}}})[_0x74e1('0x4d')](handleError(_0x4c61c3,null));};exports[_0x74e1('0x24')]=function(_0x2ba966,_0x49f936){return db['VoiceRecording']['find']({'where':{'id':_0x2ba966[_0x74e1('0x4b')]['id']}})['then'](function(_0x2667a2){if(_[_0x74e1('0x65')](_0x2667a2)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2667a2;})[_0x74e1('0x23')](function(_0x390da6){var _0x29b7fe=_0x390da6[_0x74e1('0x51')];logger['info'](_0x74e1('0x66'),_0x29b7fe);if(!_['isNil'](_0x390da6['value'])&&fs[_0x74e1('0x55')](_0x29b7fe)){logger[_0x74e1('0x67')](_0x74e1('0x68')+_0x29b7fe+_0x74e1('0x69'));fs[_0x74e1('0x6a')](_0x29b7fe);}_0x29b7fe=_0x29b7fe+_0x74e1('0x6b');if(!_[_0x74e1('0x65')](_0x390da6['value'])&&fs[_0x74e1('0x55')](_0x29b7fe)){logger[_0x74e1('0x67')](_0x74e1('0x68')+_0x29b7fe+_0x74e1('0x69'));fs[_0x74e1('0x6a')](_0x29b7fe);}return _0x390da6;})[_0x74e1('0x23')](function(_0x41442a){if(!_0x41442a)throw new InternalError();return _0x41442a['destroy']();})['then'](function(){_0x49f936['status'](0xcc)['end']();})[_0x74e1('0x4d')](handleError(_0x49f936,null));};function getBucketslist(_0x43d85e,_0x1d3c3e,_0x2a5163){return new Promise(function(_0x4e0fd5,_0x4795c5){var _0x4cffed=new AWS['S3']({'accessKeyId':_0x1d3c3e,'secretAccessKey':_0x43d85e,'region':_0x2a5163});_0x4cffed[_0x74e1('0x6c')]({},function(_0x28ee3c,_0x165c3e){if(_0x28ee3c){return _0x4795c5(_0x28ee3c);}else{return _0x4e0fd5(_0x165c3e);}});});}function createBucket(_0x2d8e0a,_0x2c357d,_0x720b9e,_0x167149){return new Promise(function(_0x48adce,_0x1b1df5){var _0x4f61c6=new AWS['S3']({'accessKeyId':_0x2c357d,'secretAccessKey':_0x2d8e0a,'region':_0x720b9e});_0x4f61c6[_0x74e1('0x6d')]({'Bucket':_0x167149},function(_0x4c37f2,_0x3dc088){if(_0x4c37f2){return _0x1b1df5(_0x4c37f2);}else{return _0x48adce(_0x3dc088);}});});}function uploadFile(_0xd4bcd9,_0x367a91,_0xd7e0b7,_0x1fafe6,_0x26e672,_0x240de6){return new Promise(function(_0x2c6929,_0x1ff428){var _0x5d0909=new AWS['S3']({'accessKeyId':_0x367a91,'secretAccessKey':_0xd4bcd9,'region':_0xd7e0b7});_0x5d0909[_0x74e1('0x6e')]({'Bucket':_0x1fafe6,'Key':_0x26e672,'Body':_0x240de6},function(_0x33cfd2,_0x9356ca){if(_0x33cfd2){return _0x1ff428(_0x33cfd2);}else{return _0x2c6929(_0x9356ca);}});});}function startTranscribe(_0x11d2ca,_0x3e2bed,_0x1afb55,_0x19052c,_0x426892,_0x3cdef8){return new Promise(function(_0x5a1861,_0xce0744){var _0x43fb81=new AWS['TranscribeService']({'accessKeyId':_0x3e2bed,'secretAccessKey':_0x11d2ca,'region':_0x1afb55});_0x43fb81[_0x74e1('0x6f')]({'TranscriptionJobName':_0x19052c,'LanguageCode':_0x426892,'Media':{'MediaFileUri':_0x3cdef8}},function(_0x50fafa,_0x5c6324){if(_0x50fafa){return _0xce0744(_0x50fafa);}else{return _0x5a1861(_0x5c6324);}});});}function transcribe(_0x56f437,_0x2b565b,_0x1a1285,_0x5c2ac8,_0x4d47b8,_0x2273fe,_0x10c093){return new Promise(function(_0x495011,_0x3fab01){var _0x4e5eb0={};logger[_0x74e1('0x67')](util[_0x74e1('0x30')](_0x74e1('0x70'),_0x56f437,_0x4d47b8));return uploadFile(_0x2b565b,_0x1a1285,_0x5c2ac8,_0x4d47b8,path[_0x74e1('0x71')](_0x2273fe),fs[_0x74e1('0x72')](_0x2273fe))[_0x74e1('0x23')](function(_0x218013){logger['info'](util['format'](_0x74e1('0x73'),_0x56f437,_0x4d47b8,_0x218013[_0x74e1('0x74')]));_0x4e5eb0[_0x74e1('0x75')]=_0x218013[_0x74e1('0x76')];_0x4e5eb0[_0x74e1('0x77')]=_0x218013['Location'];logger[_0x74e1('0x67')](util[_0x74e1('0x30')](_0x74e1('0x78'),_0x56f437));return startTranscribe(_0x2b565b,_0x1a1285,_0x5c2ac8,uuidv4(),_0x10c093,_0x218013[_0x74e1('0x74')]);})[_0x74e1('0x23')](function(_0x62f6fc){logger[_0x74e1('0x67')](util[_0x74e1('0x30')](_0x74e1('0x79'),_0x56f437,_0x62f6fc[_0x74e1('0x7a')]['TranscriptionJobName']));_0x4e5eb0[_0x74e1('0x7b')]=_0x62f6fc[_0x74e1('0x7a')][_0x74e1('0x7c')];_0x4e5eb0[_0x74e1('0x7d')]=_0x62f6fc[_0x74e1('0x7a')][_0x74e1('0x7e')];return _0x495011(_0x4e5eb0);})[_0x74e1('0x4d')](function(_0x42d7e7){return _0x3fab01(_0x42d7e7);});});}exports[_0x74e1('0x7f')]=function(_0x5710f4,_0x25b727,_0x163269){var _0x4d50b7;var _0xe87ba3;var _0x18d215;var _0x26a108=require(_0x74e1('0x4f'));return db[_0x74e1('0x2a')][_0x74e1('0x80')]({'where':{'id':_0x5710f4['params']['id']}})[_0x74e1('0x23')](function(_0x4861ca){if(_0x4861ca){var _0x53d967=util[_0x74e1('0x30')](_0x74e1('0x52'),_0x4861ca['value']);if(fs['existsSync'](_0x53d967)){cypher=!![];return _0x26a108[_0x74e1('0x64')](_0x53d967,_0x4861ca[_0x74e1('0x51')],config[_0x74e1('0x53')][_0x74e1('0x54')])[_0x74e1('0x23')](function(){return _0x4861ca;});}return _0x4861ca;}})['then'](function(_0x2342d1){if(!_0x2342d1){throw new db[(_0x74e1('0x56'))][(_0x74e1('0x57'))](_0x74e1('0x81'));}_0xe87ba3=_0x2342d1;return db['Setting'][_0x74e1('0x80')]({'where':{'id':0x1}});})[_0x74e1('0x23')](handleEntityNotFound(_0x25b727,null))[_0x74e1('0x23')](function(_0x360ee5){if(_0x360ee5){_0x4d50b7=_0x360ee5;if(!_0x4d50b7[_0x74e1('0x82')]||!_0x4d50b7['transcribeAccountId']||!_0x4d50b7['transcribeRegion']||!_0x4d50b7['language']||!_0x4d50b7[_0x74e1('0x75')]){throw new db[(_0x74e1('0x56'))][(_0x74e1('0x57'))]('Transcribe\x20not\x20configured');}if(_0x5710f4[_0x74e1('0x4a')][_0x74e1('0x83')]&&(!_0x4d50b7[_0x74e1('0x84')]||!_0x4d50b7[_0x74e1('0x85')]||!_0x4d50b7['sentimentRegion']||!_0x4d50b7[_0x74e1('0x86')]||!_0x4d50b7[_0x74e1('0x75')])){throw new db[(_0x74e1('0x56'))][(_0x74e1('0x57'))](_0x74e1('0x87'));}return db[_0x74e1('0x88')][_0x74e1('0x80')]({'where':{'id':_0x4d50b7[_0x74e1('0x89')]}});}})['then'](function(_0x2272aa){if(!_0x2272aa){throw new db[(_0x74e1('0x56'))][(_0x74e1('0x57'))](_0x74e1('0x8a'));}if(!_0x2272aa[_0x74e1('0x8b')]||!_0x2272aa[_0x74e1('0x8c')]){throw new db['Sequelize'][(_0x74e1('0x57'))](_0x74e1('0x8d'));}_0x18d215=_0x2272aa;return getBucketslist(_0x18d215['data1'],_0x18d215[_0x74e1('0x8c')],_0x4d50b7[_0x74e1('0x8e')]);})[_0x74e1('0x23')](function(_0x25e5c4){if(_0x25e5c4&&_0x25e5c4[_0x74e1('0x8f')]){var _0x2d880f=_[_0x74e1('0x48')](_0x25e5c4['Buckets'],function(_0x32353a){return _0x32353a[_0x74e1('0x90')]===_0x4d50b7[_0x74e1('0x75')];});if(!_0x2d880f){logger[_0x74e1('0x67')](util[_0x74e1('0x30')](_0x74e1('0x91'),_0x5710f4['params']['id'],_0x4d50b7[_0x74e1('0x75')]));return createBucket(_0x18d215[_0x74e1('0x8b')],_0x18d215[_0x74e1('0x8c')],_0x4d50b7[_0x74e1('0x8e')],_0x4d50b7['bucket']);}logger[_0x74e1('0x67')](util[_0x74e1('0x30')](_0x74e1('0x92'),_0x5710f4[_0x74e1('0x4b')]['id'],_0x4d50b7['bucket']));return;}})['then'](function(_0x477698){if(_0xe87ba3['transcribeStatus']===_0x74e1('0x93')){return transcribe(_0x5710f4[_0x74e1('0x4b')]['id'],_0x18d215[_0x74e1('0x8b')],_0x18d215['data2'],_0x4d50b7['transcribeRegion'],_0x4d50b7[_0x74e1('0x75')],_0xe87ba3[_0x74e1('0x51')],_0x4d50b7[_0x74e1('0x86')]);}else{logger[_0x74e1('0x67')](util[_0x74e1('0x30')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x5710f4[_0x74e1('0x4b')]['id']));return{'transcribeStatus':_0x74e1('0x94')};}})[_0x74e1('0x23')](function(_0xba367b){if(_0xba367b){_0xba367b[_0x74e1('0x95')]=_0x5710f4['body'][_0x74e1('0x83')];return _0xe87ba3[_0x74e1('0x96')](_0xba367b);}})[_0x74e1('0x23')](respondWithResult(_0x25b727,null))['catch'](handleError(_0x25b727,null));};function writeFile(_0x1dd198,_0x4d4295){return new Promise(function(_0x5c870a,_0x5ccf8e){fs['writeFile'](_0x4d4295,_0x1dd198,function(_0x491ccb,_0x5adc76){if(_0x491ccb){return _0x5ccf8e(_0x491ccb);}else{return _0x5c870a(_0x5adc76);}});});}exports[_0x74e1('0x97')]=function(_0x297ed1,_0xa0df1c,_0x1eeaac){return db[_0x74e1('0x2a')][_0x74e1('0x80')]({'where':{'id':_0x297ed1['params']['id']}})[_0x74e1('0x23')](handleEntityNotFound(_0xa0df1c))[_0x74e1('0x23')](function(_0x249b3a){if(_0x249b3a&&_0x249b3a[_0x74e1('0x98')]){var _0x5a7f5f=_0x249b3a['fileText'];var _0x1dcd70=config[_0x74e1('0x99')]+_0x74e1('0x9a')+_0x249b3a['id']+_0x74e1('0x9b');if(fs[_0x74e1('0x55')](_0x1dcd70)){return _0x1dcd70;}return writeFile(_0x5a7f5f,_0x1dcd70)['then'](function(){return _0x1dcd70;});}else{throw new db[(_0x74e1('0x56'))][(_0x74e1('0x57'))]('Transcript\x20not\x20available');}})[_0x74e1('0x23')](function(_0x26b2eb){return _0xa0df1c[_0x74e1('0x4e')](_0x26b2eb);})['catch'](handleError(_0xa0df1c));}; \ No newline at end of file +var _0x3729=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','key','differenceBy','format','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','pick','merge','type','filter','options','VoiceRecording','includeAll','findAll','rows','show','params','keys','find','catch','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','Sequelize','VoiceRecording\x20not\x20found','filename','unlink','message','send','downloads','sequelize','MD5','token','$and','push','recording','extname','info','cancellazione\x20fisica\x20documento\x20%s','isNil','.cypher','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','upload','TranscribeService','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','ValidationError','Voice\x20Recording\x20not\x20found','findOne','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','.txt','Transcript\x20not\x20available','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/parsers/qs'];(function(_0x278443,_0x54b660){var _0x480249=function(_0x32d013){while(--_0x32d013){_0x278443['push'](_0x278443['shift']());}};_0x480249(++_0x54b660);}(_0x3729,0x11c));var _0x9372=function(_0x143977,_0x105bb4){_0x143977=_0x143977-0x0;var _0x12a590=_0x3729[_0x143977];return _0x12a590;};'use strict';var emlformat=require(_0x9372('0x0'));var rimraf=require(_0x9372('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9372('0x2'));var rp=require(_0x9372('0x3'));var moment=require(_0x9372('0x4'));var BPromise=require(_0x9372('0x5'));var Mustache=require('mustache');var util=require(_0x9372('0x6'));var path=require(_0x9372('0x7'));var sox=require(_0x9372('0x8'));var csv=require('to-csv');var ejs=require(_0x9372('0x9'));var fs=require('fs');var fs_extra=require(_0x9372('0xa'));var _=require(_0x9372('0xb'));var squel=require(_0x9372('0xc'));var crypto=require(_0x9372('0xd'));var jsforce=require(_0x9372('0xe'));var deskjs=require(_0x9372('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9372('0x10'));var Papa=require(_0x9372('0x11'));var AWS=require(_0x9372('0x12'));var uuidv4=require(_0x9372('0x13'));var Redis=require(_0x9372('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x9372('0x15'));var as=require(_0x9372('0x16'));var hardwareService=require(_0x9372('0x17'));var logger=require('../../config/logger')(_0x9372('0x18'));var utils=require('../../config/utils');var config=require(_0x9372('0x19'));var licenseUtil=require(_0x9372('0x1a'));var db=require(_0x9372('0x1b'))['db'];function respondWithStatusCode(_0x2fe93d,_0x2eb8b1){_0x2eb8b1=_0x2eb8b1||0xcc;return function(_0x752207){if(_0x752207){return _0x2fe93d[_0x9372('0x1c')](_0x2eb8b1);}return _0x2fe93d['status'](_0x2eb8b1)[_0x9372('0x1d')]();};}function respondWithResult(_0x1c6d45,_0x4d99ca){_0x4d99ca=_0x4d99ca||0xc8;return function(_0x2df471){if(_0x2df471){return _0x1c6d45[_0x9372('0x1e')](_0x4d99ca)[_0x9372('0x1f')](_0x2df471);}};}function respondWithFilteredResult(_0x129d38,_0x3b4edd){return function(_0x23e726){if(_0x23e726){var _0xc7dbe5=typeof _0x3b4edd[_0x9372('0x20')]===_0x9372('0x21')&&typeof _0x3b4edd[_0x9372('0x22')]==='undefined';var _0x40c140=_0x23e726[_0x9372('0x23')];var _0x410580=_0xc7dbe5?0x0:_0x3b4edd[_0x9372('0x20')];var _0x4338a8=_0xc7dbe5?_0x23e726[_0x9372('0x23')]:_0x3b4edd[_0x9372('0x20')]+_0x3b4edd[_0x9372('0x22')];var _0x2562a4;if(_0x4338a8>=_0x40c140){_0x4338a8=_0x40c140;_0x2562a4=0xc8;}else{_0x2562a4=0xce;}_0x129d38['status'](_0x2562a4);return _0x129d38[_0x9372('0x24')](_0x9372('0x25'),_0x410580+'-'+_0x4338a8+'/'+_0x40c140)['json'](_0x23e726);}return null;};}function patchUpdates(_0x27ab1f){return function(_0x2499be){try{jsonpatch['apply'](_0x2499be,_0x27ab1f,!![]);}catch(_0x16b8d5){return BPromise[_0x9372('0x26')](_0x16b8d5);}return _0x2499be[_0x9372('0x27')]();};}function saveUpdates(_0x462c3f,_0x4e5014){return function(_0xb67277){if(_0xb67277){return _0xb67277[_0x9372('0x28')](_0x462c3f)[_0x9372('0x29')](function(_0x536788){return _0x536788;});}return null;};}function removeEntity(_0x47d804,_0x291632){return function(_0x28c3f0){if(_0x28c3f0){return _0x28c3f0[_0x9372('0x2a')]()[_0x9372('0x29')](function(){_0x47d804[_0x9372('0x1e')](0xcc)[_0x9372('0x1d')]();});}};}function handleEntityNotFound(_0x22f372,_0x3c036a){return function(_0xc31958){if(!_0xc31958){_0x22f372[_0x9372('0x1c')](0x194);}return _0xc31958;};}function handleError(_0x1e849d,_0x1ff81e){_0x1ff81e=_0x1ff81e||0x1f4;return function(_0x2dbf37){logger[_0x9372('0x2b')](_0x2dbf37[_0x9372('0x2c')]);if(_0x2dbf37['name']){delete _0x2dbf37[_0x9372('0x2d')];}_0x1e849d[_0x9372('0x1e')](_0x1ff81e)['send'](_0x2dbf37);};}exports[_0x9372('0x2e')]=function(_0x78a2f2,_0x3ca81c){var _0x42acc5={},_0x351440={},_0x11b139={'count':0x0,'rows':[]};var _0x331c30=_[_0x9372('0x2f')](db['VoiceRecording'][_0x9372('0x30')],function(_0x22da24){return{'name':_0x22da24['fieldName'],'type':_0x22da24['type'][_0x9372('0x31')]};});_0x351440['model']=_[_0x9372('0x32')](_[_0x9372('0x2f')](_0x331c30,'name'),[_0x9372('0x33')]);_0x351440[_0x9372('0x34')]=_['keys'](_0x78a2f2[_0x9372('0x34')]);_0x351440[_0x9372('0x35')]=_[_0x9372('0x36')](_0x351440[_0x9372('0x37')],_0x351440['query']);_0x42acc5[_0x9372('0x38')]=_['intersection'](_0x351440[_0x9372('0x37')],qs['fields'](_0x78a2f2[_0x9372('0x34')][_0x9372('0x39')]));_0x42acc5[_0x9372('0x38')]=_0x42acc5[_0x9372('0x38')][_0x9372('0x3a')]?_0x42acc5['attributes']:_0x351440[_0x9372('0x37')];if(!_0x78a2f2[_0x9372('0x34')][_0x9372('0x3b')](_0x9372('0x3c'))){_0x42acc5['limit']=qs['limit'](_0x78a2f2[_0x9372('0x34')]['limit']);_0x42acc5['offset']=qs[_0x9372('0x20')](_0x78a2f2[_0x9372('0x34')]['offset']);}_0x42acc5['order']=qs['sort'](_0x78a2f2[_0x9372('0x34')]['sort']);_0x42acc5[_0x9372('0x3d')]=qs[_0x9372('0x35')](_[_0x9372('0x3e')](_0x78a2f2[_0x9372('0x34')],_0x351440[_0x9372('0x35')]),_0x331c30);if(_0x78a2f2[_0x9372('0x34')]['filter']){_0x42acc5[_0x9372('0x3d')]=_[_0x9372('0x3f')](_0x42acc5['where'],{'$or':_[_0x9372('0x2f')](_0x331c30,function(_0x384fd5){if(_0x384fd5[_0x9372('0x40')]!=='VIRTUAL'){var _0x50ee8f={};_0x50ee8f[_0x384fd5[_0x9372('0x2d')]]={'$like':'%'+_0x78a2f2[_0x9372('0x34')][_0x9372('0x41')]+'%'};return _0x50ee8f;}})});}_0x42acc5=_[_0x9372('0x3f')]({},_0x42acc5,_0x78a2f2[_0x9372('0x42')]);var _0x8d87e9={'where':_0x42acc5[_0x9372('0x3d')]};return db[_0x9372('0x43')][_0x9372('0x23')](_0x8d87e9)[_0x9372('0x29')](function(_0x364b4b){_0x11b139[_0x9372('0x23')]=_0x364b4b;if(_0x78a2f2['query'][_0x9372('0x44')]){_0x42acc5['include']=[{'all':!![]}];}return db[_0x9372('0x43')][_0x9372('0x45')](_0x42acc5);})[_0x9372('0x29')](function(_0x5b0504){_0x11b139[_0x9372('0x46')]=_0x5b0504;return _0x11b139;})[_0x9372('0x29')](respondWithFilteredResult(_0x3ca81c,_0x42acc5))['catch'](handleError(_0x3ca81c,null));};exports[_0x9372('0x47')]=function(_0x57e35d,_0x47f6fd){var _0x2ce9a8={'raw':![],'where':{'id':_0x57e35d[_0x9372('0x48')]['id']}},_0x3bb088={};_0x3bb088[_0x9372('0x37')]=_[_0x9372('0x49')](db[_0x9372('0x43')][_0x9372('0x30')]);_0x3bb088[_0x9372('0x34')]=_['keys'](_0x57e35d[_0x9372('0x34')]);_0x3bb088[_0x9372('0x35')]=_[_0x9372('0x36')](_0x3bb088[_0x9372('0x37')],_0x3bb088[_0x9372('0x34')]);_0x2ce9a8['attributes']=_[_0x9372('0x36')](_0x3bb088[_0x9372('0x37')],qs[_0x9372('0x39')](_0x57e35d[_0x9372('0x34')][_0x9372('0x39')]));_0x2ce9a8[_0x9372('0x38')]=_0x2ce9a8[_0x9372('0x38')][_0x9372('0x3a')]?_0x2ce9a8[_0x9372('0x38')]:_0x3bb088[_0x9372('0x37')];if(_0x57e35d[_0x9372('0x34')][_0x9372('0x44')]){_0x2ce9a8['include']=[{'all':!![]}];}_0x2ce9a8=_[_0x9372('0x3f')]({},_0x2ce9a8,_0x57e35d[_0x9372('0x42')]);return db[_0x9372('0x43')][_0x9372('0x4a')](_0x2ce9a8)[_0x9372('0x29')](handleEntityNotFound(_0x47f6fd,null))[_0x9372('0x29')](respondWithResult(_0x47f6fd,null))[_0x9372('0x4b')](handleError(_0x47f6fd,null));};exports[_0x9372('0x4c')]=function(_0x5ca443,_0x4a09a0){return db['VoiceRecording']['create'](_0x5ca443['body'],{})[_0x9372('0x29')](respondWithResult(_0x4a09a0,0xc9))[_0x9372('0x4b')](handleError(_0x4a09a0,null));};exports[_0x9372('0x28')]=function(_0x132864,_0x56dfa4){if(_0x132864['body']['id']){delete _0x132864[_0x9372('0x4d')]['id'];}return db[_0x9372('0x43')][_0x9372('0x4a')]({'where':{'id':_0x132864['params']['id']}})[_0x9372('0x29')](handleEntityNotFound(_0x56dfa4,null))['then'](saveUpdates(_0x132864[_0x9372('0x4d')],null))['then'](respondWithResult(_0x56dfa4,null))[_0x9372('0x4b')](handleError(_0x56dfa4,null));};exports[_0x9372('0x4e')]=function(_0x25e4b6,_0x524595){return db[_0x9372('0x43')][_0x9372('0x4e')]()[_0x9372('0x29')](respondWithResult(_0x524595,null))['catch'](handleError(_0x524595,null));};exports[_0x9372('0x4f')]=function(_0x3d7fe9,_0x21e074,_0x244f5c){var _0x267773=require(_0x9372('0x50'));var _0x5c1db4=![];var _0x309f9b={};if(_0x3d7fe9[_0x9372('0x34')][_0x9372('0x40')]&&_0x3d7fe9['query'][_0x9372('0x40')]===_0x9372('0x51')){_0x309f9b[_0x9372('0x51')]=_0x3d7fe9[_0x9372('0x48')]['id'];}else{_0x309f9b['id']=_0x3d7fe9[_0x9372('0x48')]['id'];}return db[_0x9372('0x43')][_0x9372('0x4a')]({'where':_0x309f9b,'attributes':['id',_0x9372('0x52')],'raw':!![]})[_0x9372('0x29')](handleEntityNotFound(_0x21e074,null))[_0x9372('0x29')](function(_0x5336b0){if(_0x5336b0){var _0x105891=_0x5336b0['value'];var _0x120bbf=util[_0x9372('0x33')](_0x9372('0x53'),_0x105891);if(fs[_0x9372('0x54')](_0x120bbf)){_0x5c1db4=!![];return _0x267773[_0x9372('0x55')](_0x120bbf,_0x105891,config[_0x9372('0x56')]['recording'])[_0x9372('0x29')](function(){return _0x5336b0;});}return _0x5336b0;}})[_0x9372('0x29')](function(_0x53f569){if(_0x53f569){var _0x20aad7=_0x53f569['value'];if(!fs['existsSync'](_0x20aad7)){throw new db[(_0x9372('0x57'))]['ValidationError'](_0x9372('0x58'));}if(_0x53f569['filename']){return _0x21e074[_0x9372('0x4f')](_0x20aad7,_0x53f569[_0x9372('0x59')]+path['extname'](_0x20aad7),function(){if(_0x5c1db4){fs[_0x9372('0x5a')](_0x20aad7);}});}else{return _0x21e074[_0x9372('0x4f')](_0x20aad7,function(_0x2d4585){if(_0x5c1db4){fs[_0x9372('0x5a')](_0x20aad7);}});}}})[_0x9372('0x4b')](function(_0x2914ad){if(_0x2914ad[_0x9372('0x5b')]===_0x9372('0x58')){_0x21e074[_0x9372('0x1e')](0x194)[_0x9372('0x5c')]('Not\x20found');}else{return handleError(_0x21e074,null);}});};exports[_0x9372('0x5d')]=function(_0x2edb01,_0x8b607b,_0x1380d7){var _0x124700=require(_0x9372('0x50'));var _0x5cb4c9=![];var _0x325dc6={'$and':[db['sequelize']['where'](db[_0x9372('0x5e')]['fn'](_0x9372('0x5f'),db[_0x9372('0x5e')]['col'](_0x9372('0x51'))),_0x2edb01[_0x9372('0x34')][_0x9372('0x60')])]};if(_0x2edb01[_0x9372('0x34')]['type']&&_0x2edb01[_0x9372('0x34')][_0x9372('0x40')]==='uniqueid'){_0x325dc6[_0x9372('0x61')][_0x9372('0x62')]({'uniqueid':_0x2edb01[_0x9372('0x48')]['id']});}else{_0x325dc6[_0x9372('0x61')]['push']({'id':_0x2edb01[_0x9372('0x48')]['id']});}return db[_0x9372('0x43')][_0x9372('0x4a')]({'where':_0x325dc6,'attributes':['id',_0x9372('0x52')],'raw':!![]})[_0x9372('0x29')](handleEntityNotFound(_0x8b607b,null))['then'](function(_0x3b1adb){if(_0x3b1adb){var _0x427af1=util['format'](_0x9372('0x53'),_0x3b1adb[_0x9372('0x52')]);if(fs[_0x9372('0x54')](_0x427af1)){_0x5cb4c9=!![];return _0x124700[_0x9372('0x55')](_0x427af1,_0x3b1adb[_0x9372('0x52')],config[_0x9372('0x56')][_0x9372('0x63')])[_0x9372('0x29')](function(){return _0x3b1adb;});}return _0x3b1adb;}})['then'](function(_0x3e4e6e){if(_0x3e4e6e){if(!fs['existsSync'](_0x3e4e6e[_0x9372('0x52')])){throw new db[(_0x9372('0x57'))]['ValidationError'](_0x9372('0x58'));}if(_0x3e4e6e[_0x9372('0x59')]){return _0x8b607b[_0x9372('0x4f')](_0x3e4e6e[_0x9372('0x52')],_0x3e4e6e['filename']+path[_0x9372('0x64')](_0x3e4e6e[_0x9372('0x52')]),function(){if(_0x5cb4c9){fs[_0x9372('0x5a')](_0x3e4e6e[_0x9372('0x52')]);}});}else{return _0x8b607b[_0x9372('0x4f')](_0x3e4e6e[_0x9372('0x52')],function(_0x4915cb){if(_0x5cb4c9){fs[_0x9372('0x5a')](_0x3e4e6e['value']);}});}}})[_0x9372('0x4b')](handleError(_0x8b607b,null));};exports[_0x9372('0x2a')]=function(_0x460797,_0x417bdd){return db[_0x9372('0x43')][_0x9372('0x4a')]({'where':{'id':_0x460797[_0x9372('0x48')]['id']}})['then'](function(_0x10301e){if(_['isNil'](_0x10301e)){throw new ReferenceError('Entity\x20not\x20found');}return _0x10301e;})[_0x9372('0x29')](function(_0x5ccf05){var _0x5d722d=_0x5ccf05[_0x9372('0x52')];logger[_0x9372('0x65')](_0x9372('0x66'),_0x5d722d);if(!_[_0x9372('0x67')](_0x5ccf05[_0x9372('0x52')])&&fs[_0x9372('0x54')](_0x5d722d)){logger[_0x9372('0x65')]('File:\x20\x22'+_0x5d722d+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x5d722d);}_0x5d722d=_0x5d722d+_0x9372('0x68');if(!_[_0x9372('0x67')](_0x5ccf05['value'])&&fs['existsSync'](_0x5d722d)){logger[_0x9372('0x65')](_0x9372('0x69')+_0x5d722d+_0x9372('0x6a'));fs['unlinkSync'](_0x5d722d);}return _0x5ccf05;})[_0x9372('0x29')](function(_0x34bd2c){if(!_0x34bd2c)throw new InternalError();return _0x34bd2c[_0x9372('0x2a')]();})[_0x9372('0x29')](function(){_0x417bdd[_0x9372('0x1e')](0xcc)[_0x9372('0x1d')]();})[_0x9372('0x4b')](handleError(_0x417bdd,null));};function getBucketslist(_0x22967b,_0x4c3a6f,_0x5de31e){return new Promise(function(_0x47f944,_0x292410){var _0x6650a=new AWS['S3']({'accessKeyId':_0x4c3a6f,'secretAccessKey':_0x22967b,'region':_0x5de31e});_0x6650a[_0x9372('0x6b')]({},function(_0x8413aa,_0x590bf3){if(_0x8413aa){return _0x292410(_0x8413aa);}else{return _0x47f944(_0x590bf3);}});});}function createBucket(_0x3048cf,_0x275925,_0x2e27ed,_0x3d79b9){return new Promise(function(_0x41e4b2,_0x124e9d){var _0x4fc747=new AWS['S3']({'accessKeyId':_0x275925,'secretAccessKey':_0x3048cf,'region':_0x2e27ed});_0x4fc747[_0x9372('0x6c')]({'Bucket':_0x3d79b9},function(_0x376513,_0x19eee1){if(_0x376513){return _0x124e9d(_0x376513);}else{return _0x41e4b2(_0x19eee1);}});});}function uploadFile(_0x31c2d5,_0x539ce2,_0x5e48df,_0x527577,_0x167f78,_0x19d4e7){return new Promise(function(_0x462487,_0x6d614){var _0x4007af=new AWS['S3']({'accessKeyId':_0x539ce2,'secretAccessKey':_0x31c2d5,'region':_0x5e48df});_0x4007af[_0x9372('0x6d')]({'Bucket':_0x527577,'Key':_0x167f78,'Body':_0x19d4e7},function(_0x5ca549,_0x59bc7d){if(_0x5ca549){return _0x6d614(_0x5ca549);}else{return _0x462487(_0x59bc7d);}});});}function startTranscribe(_0x1b102c,_0xa8a75f,_0xdd5239,_0x2f8abc,_0x1c7051,_0x3e5520){return new Promise(function(_0x5c1142,_0x1cd094){var _0x551106=new AWS[(_0x9372('0x6e'))]({'accessKeyId':_0xa8a75f,'secretAccessKey':_0x1b102c,'region':_0xdd5239});_0x551106['startTranscriptionJob']({'TranscriptionJobName':_0x2f8abc,'LanguageCode':_0x1c7051,'Media':{'MediaFileUri':_0x3e5520}},function(_0x3bce74,_0x249b3a){if(_0x3bce74){return _0x1cd094(_0x3bce74);}else{return _0x5c1142(_0x249b3a);}});});}function transcribe(_0x2ccdbe,_0x51da69,_0x57f411,_0x145035,_0x38bbe1,_0x10e118,_0x4947a4){return new Promise(function(_0x54fcb0,_0x2d5af3){var _0x6237cb={};logger[_0x9372('0x65')](util['format']('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x2ccdbe,_0x38bbe1));return uploadFile(_0x51da69,_0x57f411,_0x145035,_0x38bbe1,path[_0x9372('0x6f')](_0x10e118),fs[_0x9372('0x70')](_0x10e118))[_0x9372('0x29')](function(_0x13f77c){logger[_0x9372('0x65')](util[_0x9372('0x33')](_0x9372('0x71'),_0x2ccdbe,_0x38bbe1,_0x13f77c[_0x9372('0x72')]));_0x6237cb[_0x9372('0x73')]=_0x13f77c[_0x9372('0x74')];_0x6237cb[_0x9372('0x75')]=_0x13f77c[_0x9372('0x72')];logger['info'](util[_0x9372('0x33')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x2ccdbe));return startTranscribe(_0x51da69,_0x57f411,_0x145035,uuidv4(),_0x4947a4,_0x13f77c['Location']);})[_0x9372('0x29')](function(_0x15f583){logger[_0x9372('0x65')](util[_0x9372('0x33')](_0x9372('0x76'),_0x2ccdbe,_0x15f583[_0x9372('0x77')][_0x9372('0x78')]));_0x6237cb[_0x9372('0x79')]=_0x15f583[_0x9372('0x77')][_0x9372('0x78')];_0x6237cb['transcribeStatus']=_0x15f583[_0x9372('0x77')][_0x9372('0x7a')];return _0x54fcb0(_0x6237cb);})[_0x9372('0x4b')](function(_0x14a2b5){return _0x2d5af3(_0x14a2b5);});});}exports['runTranscribe']=function(_0x382431,_0x12b259,_0x2c4efa){var _0x3cc487;var _0x256bc3;var _0xe4b4eb;var _0x44795a=require('../../components/encryptor');return db[_0x9372('0x43')]['findOne']({'where':{'id':_0x382431[_0x9372('0x48')]['id']}})[_0x9372('0x29')](function(_0x11542d){if(_0x11542d){var _0x465e21=util['format'](_0x9372('0x53'),_0x11542d[_0x9372('0x52')]);if(fs[_0x9372('0x54')](_0x465e21)){cypher=!![];return _0x44795a[_0x9372('0x55')](_0x465e21,_0x11542d['value'],config[_0x9372('0x56')][_0x9372('0x63')])[_0x9372('0x29')](function(){return _0x11542d;});}return _0x11542d;}})[_0x9372('0x29')](function(_0x221940){if(!_0x221940){throw new db[(_0x9372('0x57'))][(_0x9372('0x7b'))](_0x9372('0x7c'));}_0x256bc3=_0x221940;return db['Setting'][_0x9372('0x7d')]({'where':{'id':0x1}});})[_0x9372('0x29')](handleEntityNotFound(_0x12b259,null))[_0x9372('0x29')](function(_0x4a6793){if(_0x4a6793){_0x3cc487=_0x4a6793;if(!_0x3cc487['transcribe']||!_0x3cc487[_0x9372('0x7e')]||!_0x3cc487[_0x9372('0x7f')]||!_0x3cc487[_0x9372('0x80')]||!_0x3cc487[_0x9372('0x73')]){throw new db['Sequelize'][(_0x9372('0x7b'))](_0x9372('0x81'));}if(_0x382431[_0x9372('0x4d')][_0x9372('0x82')]&&(!_0x3cc487[_0x9372('0x83')]||!_0x3cc487[_0x9372('0x84')]||!_0x3cc487['sentimentRegion']||!_0x3cc487['language']||!_0x3cc487['bucket'])){throw new db[(_0x9372('0x57'))]['ValidationError'](_0x9372('0x85'));}return db[_0x9372('0x86')][_0x9372('0x7d')]({'where':{'id':_0x3cc487[_0x9372('0x7e')]}});}})['then'](function(_0x27ca9d){if(!_0x27ca9d){throw new db[(_0x9372('0x57'))]['ValidationError'](_0x9372('0x87'));}if(!_0x27ca9d[_0x9372('0x88')]||!_0x27ca9d[_0x9372('0x89')]){throw new db[(_0x9372('0x57'))][(_0x9372('0x7b'))]('Cloud\x20Provider\x20not\x20configured');}_0xe4b4eb=_0x27ca9d;return getBucketslist(_0xe4b4eb['data1'],_0xe4b4eb[_0x9372('0x89')],_0x3cc487[_0x9372('0x7f')]);})['then'](function(_0x288dbc){if(_0x288dbc&&_0x288dbc[_0x9372('0x8a')]){var _0x2f2229=_[_0x9372('0x4a')](_0x288dbc[_0x9372('0x8a')],function(_0xf5cad0){return _0xf5cad0['Name']===_0x3cc487[_0x9372('0x73')];});if(!_0x2f2229){logger[_0x9372('0x65')](util[_0x9372('0x33')](_0x9372('0x8b'),_0x382431[_0x9372('0x48')]['id'],_0x3cc487[_0x9372('0x73')]));return createBucket(_0xe4b4eb[_0x9372('0x88')],_0xe4b4eb[_0x9372('0x89')],_0x3cc487[_0x9372('0x7f')],_0x3cc487[_0x9372('0x73')]);}logger[_0x9372('0x65')](util[_0x9372('0x33')](_0x9372('0x8c'),_0x382431[_0x9372('0x48')]['id'],_0x3cc487[_0x9372('0x73')]));return;}})[_0x9372('0x29')](function(_0x58304a){if(_0x256bc3[_0x9372('0x8d')]===_0x9372('0x8e')){return transcribe(_0x382431[_0x9372('0x48')]['id'],_0xe4b4eb[_0x9372('0x88')],_0xe4b4eb['data2'],_0x3cc487['transcribeRegion'],_0x3cc487[_0x9372('0x73')],_0x256bc3[_0x9372('0x52')],_0x3cc487[_0x9372('0x80')]);}else{logger['info'](util[_0x9372('0x33')](_0x9372('0x8f'),_0x382431[_0x9372('0x48')]['id']));return{'transcribeStatus':_0x9372('0x90')};}})['then'](function(_0x4c9a4d){if(_0x4c9a4d){_0x4c9a4d[_0x9372('0x91')]=_0x382431[_0x9372('0x4d')][_0x9372('0x82')];return _0x256bc3[_0x9372('0x92')](_0x4c9a4d);}})[_0x9372('0x29')](respondWithResult(_0x12b259,null))[_0x9372('0x4b')](handleError(_0x12b259,null));};function writeFile(_0x2ee0dd,_0x3118b1){return new Promise(function(_0x21274e,_0x2d7534){fs[_0x9372('0x93')](_0x3118b1,_0x2ee0dd,function(_0x346c16,_0x12a802){if(_0x346c16){return _0x2d7534(_0x346c16);}else{return _0x21274e(_0x12a802);}});});}exports[_0x9372('0x94')]=function(_0x152c1d,_0x509e7f,_0x4110ec){return db[_0x9372('0x43')][_0x9372('0x7d')]({'where':{'id':_0x152c1d[_0x9372('0x48')]['id']}})['then'](handleEntityNotFound(_0x509e7f))[_0x9372('0x29')](function(_0x5aabff){if(_0x5aabff&&_0x5aabff[_0x9372('0x95')]){var _0x144295=_0x5aabff[_0x9372('0x95')];var _0x279efe=config[_0x9372('0x96')]+'/server/files/transcribes/transcribe_'+_0x5aabff['id']+_0x9372('0x97');if(fs[_0x9372('0x54')](_0x279efe)){return _0x279efe;}return writeFile(_0x144295,_0x279efe)[_0x9372('0x29')](function(){return _0x279efe;});}else{throw new db['Sequelize'][(_0x9372('0x7b'))](_0x9372('0x98'));}})[_0x9372('0x29')](function(_0x39d7aa){return _0x509e7f[_0x9372('0x4f')](_0x39d7aa);})[_0x9372('0x4b')](handleError(_0x509e7f));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index ee69e85..c63763c 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 _0x5208=['rimraf','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5208,0x1d5));var _0x8520=function(_0x39767f,_0xdf30e6){_0x39767f=_0x39767f-0x0;var _0x54ff20=_0x5208[_0x39767f];return _0x54ff20;};'use strict';var _=require('lodash');var util=require(_0x8520('0x0'));var logger=require(_0x8520('0x1'))(_0x8520('0x2'));var moment=require(_0x8520('0x3'));var BPromise=require(_0x8520('0x4'));var rp=require(_0x8520('0x5'));var fs=require('fs');var path=require(_0x8520('0x6'));var rimraf=require(_0x8520('0x7'));var config=require('../../config/environment');var attributes=require(_0x8520('0x8'));module[_0x8520('0x9')]=function(_0x1bb532,_0x2cb469){return _0x1bb532[_0x8520('0xa')](_0x8520('0xb'),attributes,{'tableName':_0x8520('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8520('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa988=['VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports'];(function(_0x1c11f,_0xe08094){var _0x99c29=function(_0x2d7efa){while(--_0x2d7efa){_0x1c11f['push'](_0x1c11f['shift']());}};_0x99c29(++_0xe08094);}(_0xa988,0x1a7));var _0x8a98=function(_0x1bf786,_0x128f37){_0x1bf786=_0x1bf786-0x0;var _0xf1331a=_0xa988[_0x1bf786];return _0xf1331a;};'use strict';var _=require(_0x8a98('0x0'));var util=require(_0x8a98('0x1'));var logger=require(_0x8a98('0x2'))(_0x8a98('0x3'));var moment=require(_0x8a98('0x4'));var BPromise=require('bluebird');var rp=require(_0x8a98('0x5'));var fs=require('fs');var path=require(_0x8a98('0x6'));var rimraf=require(_0x8a98('0x7'));var config=require(_0x8a98('0x8'));var attributes=require(_0x8a98('0x9'));module[_0x8a98('0xa')]=function(_0x3eb5cf,_0x3fcd06){return _0x3eb5cf['define'](_0x8a98('0xb'),attributes,{'tableName':_0x8a98('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8a98('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 8d0e1b5..4e65c0c 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 _0x6d11=['message','catch','VoiceRecording','update','options','where','attributes','limit','UpdateVoiceRecording','CreateVoiceRecording','../../components/encryptor','findOne','callRecordingEncryption','create','body','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x2d13b1,_0x2678d5){var _0x18c844=function(_0x4b0e6c){while(--_0x4b0e6c){_0x2d13b1['push'](_0x2d13b1['shift']());}};_0x18c844(++_0x2678d5);}(_0x6d11,0xbf));var _0x16d1=function(_0x4f1869,_0x3946d2){_0x4f1869=_0x4f1869-0x0;var _0x5a0d6d=_0x6d11[_0x4f1869];return _0x5a0d6d;};'use strict';var _=require(_0x16d1('0x0'));var util=require(_0x16d1('0x1'));var moment=require(_0x16d1('0x2'));var BPromise=require('bluebird');var rs=require(_0x16d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x16d1('0x4'))['db'];var utils=require(_0x16d1('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x16d1('0x6'));var jayson=require(_0x16d1('0x7'));var client=jayson[_0x16d1('0x8')][_0x16d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1009dc,_0x150217,_0x19390d){return new BPromise(function(_0x5d0e3f,_0x58a7a2){return client['request'](_0x1009dc,_0x19390d)[_0x16d1('0xa')](function(_0xcfbb15){logger[_0x16d1('0xb')](_0x16d1('0xc'),_0x150217,'request\x20sent');logger[_0x16d1('0xd')](_0x16d1('0xe'),_0x150217,_0x16d1('0xf'),JSON[_0x16d1('0x10')](_0xcfbb15));if(_0xcfbb15[_0x16d1('0x11')]){if(_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x12')]===0x1f4){logger[_0x16d1('0x11')]('VoiceRecording,\x20%s,\x20%s',_0x150217,_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);return _0x58a7a2(_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);}logger[_0x16d1('0x11')]('VoiceRecording,\x20%s,\x20%s',_0x150217,_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);return _0x5d0e3f(_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);}else{logger[_0x16d1('0xb')](_0x16d1('0xc'),_0x150217,_0x16d1('0xf'));_0x5d0e3f(_0xcfbb15['result'][_0x16d1('0x13')]);}})[_0x16d1('0x14')](function(_0x555b2d){logger['error'](_0x16d1('0xc'),_0x150217,_0x555b2d);_0x58a7a2(_0x555b2d);});});}exports['UpdateVoiceRecording']=function(_0x46a25e){var _0x4aeff0=this;return new Promise(function(_0x1da1b8,_0x4fe22d){return db[_0x16d1('0x15')][_0x16d1('0x16')](_0x46a25e['body'],{'raw':_0x46a25e['options']?_0x46a25e['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46a25e[_0x16d1('0x17')]?_0x46a25e['options'][_0x16d1('0x18')]||null:null,'attributes':_0x46a25e[_0x16d1('0x17')]?_0x46a25e[_0x16d1('0x17')][_0x16d1('0x19')]||null:null,'limit':_0x46a25e['options']?_0x46a25e[_0x16d1('0x17')][_0x16d1('0x1a')]||null:null})[_0x16d1('0xa')](function(_0x585ce5){logger[_0x16d1('0xb')](_0x16d1('0x1b'),_0x46a25e);logger[_0x16d1('0xd')](_0x16d1('0x1b'),_0x46a25e,JSON[_0x16d1('0x10')](_0x585ce5));_0x1da1b8(_0x585ce5);})[_0x16d1('0x14')](function(_0x32f362){logger[_0x16d1('0x11')](_0x16d1('0x1b'),_0x32f362[_0x16d1('0x13')],_0x46a25e);_0x4fe22d(_0x4aeff0[_0x16d1('0x11')](0x1f4,_0x32f362[_0x16d1('0x13')]));});});};exports[_0x16d1('0x1c')]=function(_0x262f89){var _0x346b69=this;return new Promise(function(_0x2b8403,_0x491f65){var _0x25ae4e=require(_0x16d1('0x1d'));var _0x4257f1;return db['Setting'][_0x16d1('0x1e')]({'attributes':['id',_0x16d1('0x1f')],'where':{'id':0x1},'raw':!![]})[_0x16d1('0xa')](function(_0x22e5b3){_0x4257f1=_0x22e5b3;return db[_0x16d1('0x15')][_0x16d1('0x20')](_0x262f89[_0x16d1('0x21')]);})['then'](function(_0x3dd104){if(_0x4257f1[_0x16d1('0x1f')]&&fs[_0x16d1('0x22')](_0x3dd104[_0x16d1('0x23')])){var _0x55c021=util['format'](_0x16d1('0x24'),_0x3dd104[_0x16d1('0x23')]);return _0x25ae4e[_0x16d1('0x25')](_0x3dd104[_0x16d1('0x23')],_0x55c021,config[_0x16d1('0x26')][_0x16d1('0x27')])[_0x16d1('0xa')](function(){fs[_0x16d1('0x28')](_0x3dd104[_0x16d1('0x23')]);logger[_0x16d1('0xb')](_0x16d1('0x29'));return _0x3dd104;});}return _0x3dd104;})[_0x16d1('0xa')](function(_0x188cf4){logger[_0x16d1('0xb')]('CreateVoiceRecording',_0x262f89);logger[_0x16d1('0xd')]('CreateVoiceRecording',_0x262f89,JSON[_0x16d1('0x10')](_0x188cf4));_0x2b8403(_0x188cf4);})[_0x16d1('0x14')](function(_0x2b9126){logger[_0x16d1('0x11')](_0x16d1('0x1c'),_0x2b9126[_0x16d1('0x13')],_0x262f89);_0x491f65(_0x346b69['error'](0x1f4,_0x2b9126['message']));});});}; \ No newline at end of file +var _0x524e=['UpdateVoiceRecording','catch','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','body','existsSync','value','%s.cypher','recording','unlink','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceRecording','update','options','where','attributes','limit'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x524e,0x15e));var _0xe524=function(_0x20432b,_0x2ecffa){_0x20432b=_0x20432b-0x0;var _0x126bf1=_0x524e[_0x20432b];return _0x126bf1;};'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')]('VoiceRecording,\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')]('VoiceRecording,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('VoiceRecording,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});}exports['UpdateVoiceRecording']=function(_0x3a4027){var _0x4f1dfb=this;return new Promise(function(_0x11b2a1,_0x238f8f){return db[_0xe524('0x16')][_0xe524('0x17')](_0x3a4027['body'],{'raw':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')][_0xe524('0x19')]||null:null,'attributes':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')][_0xe524('0x1a')]||null:null,'limit':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')][_0xe524('0x1b')]||null:null})['then'](function(_0x7d1f92){logger['info']('UpdateVoiceRecording',_0x3a4027);logger[_0xe524('0x10')](_0xe524('0x1c'),_0x3a4027,JSON[_0xe524('0x12')](_0x7d1f92));_0x11b2a1(_0x7d1f92);})[_0xe524('0x1d')](function(_0x599d5d){logger[_0xe524('0x13')]('UpdateVoiceRecording',_0x599d5d[_0xe524('0x15')],_0x3a4027);_0x238f8f(_0x4f1dfb[_0xe524('0x13')](0x1f4,_0x599d5d[_0xe524('0x15')]));});});};exports[_0xe524('0x1e')]=function(_0x4102d9){var _0xfd5965=this;return new Promise(function(_0x2141db,_0x583cc3){var _0x58a896=require(_0xe524('0x1f'));var _0x45abad;return db[_0xe524('0x20')][_0xe524('0x21')]({'attributes':['id',_0xe524('0x22')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x52f140){_0x45abad=_0x52f140;return db[_0xe524('0x16')][_0xe524('0x23')](_0x4102d9[_0xe524('0x24')]);})[_0xe524('0xc')](function(_0x25c0a1){if(_0x45abad['callRecordingEncryption']&&fs[_0xe524('0x25')](_0x25c0a1[_0xe524('0x26')])){var _0x4a4e15=util['format'](_0xe524('0x27'),_0x25c0a1[_0xe524('0x26')]);return _0x58a896['encryptFile'](_0x25c0a1[_0xe524('0x26')],_0x4a4e15,config['secrets'][_0xe524('0x28')])['then'](function(){fs[_0xe524('0x29')](_0x25c0a1[_0xe524('0x26')]);logger[_0xe524('0xd')]('CreateVoiceRecording\x20file\x20encrypted');return _0x25c0a1;});}return _0x25c0a1;})[_0xe524('0xc')](function(_0x5238c9){logger[_0xe524('0xd')](_0xe524('0x1e'),_0x4102d9);logger[_0xe524('0x10')]('CreateVoiceRecording',_0x4102d9,JSON[_0xe524('0x12')](_0x5238c9));_0x2141db(_0x5238c9);})[_0xe524('0x1d')](function(_0x49c43e){logger[_0xe524('0x13')](_0xe524('0x1e'),_0x49c43e[_0xe524('0x15')],_0x4102d9);_0x583cc3(_0xfd5965[_0xe524('0x13')](0x1f4,_0x49c43e['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 03d364e..148167c 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 _0x5b06=['create','put','/:id','update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','describe','show','post'];(function(_0x54dcec,_0x202f84){var _0x5b8bac=function(_0x5079a9){while(--_0x5079a9){_0x54dcec['push'](_0x54dcec['shift']());}};_0x5b8bac(++_0x202f84);}(_0x5b06,0x17f));var _0x65b0=function(_0x168054,_0x132055){_0x168054=_0x168054-0x0;var _0x280b8b=_0x5b06[_0x168054];return _0x280b8b;};'use strict';var multer=require(_0x65b0('0x0'));var util=require(_0x65b0('0x1'));var path=require(_0x65b0('0x2'));var timeout=require(_0x65b0('0x3'));var express=require('express');var router=express[_0x65b0('0x4')]();var fs_extra=require(_0x65b0('0x5'));var auth=require(_0x65b0('0x6'));var interaction=require(_0x65b0('0x7'));var config=require(_0x65b0('0x8'));var controller=require(_0x65b0('0x9'));router[_0x65b0('0xa')]('/',auth[_0x65b0('0xb')](),controller[_0x65b0('0xc')]);router['get']('/describe',auth[_0x65b0('0xb')](),controller[_0x65b0('0xd')]);router[_0x65b0('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x65b0('0xe')]);router[_0x65b0('0xf')]('/',auth[_0x65b0('0xb')](),controller[_0x65b0('0x10')]);router[_0x65b0('0x11')](_0x65b0('0x12'),auth[_0x65b0('0xb')](),controller[_0x65b0('0x13')]);router[_0x65b0('0x14')](_0x65b0('0x12'),auth[_0x65b0('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3107=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','create','put'];(function(_0x3c487b,_0x44c5e2){var _0x1d65f6=function(_0x135e6d){while(--_0x135e6d){_0x3c487b['push'](_0x3c487b['shift']());}};_0x1d65f6(++_0x44c5e2);}(_0x3107,0x1a3));var _0x7310=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3107[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7310('0x0'));var util=require(_0x7310('0x1'));var path=require(_0x7310('0x2'));var timeout=require(_0x7310('0x3'));var express=require('express');var router=express[_0x7310('0x4')]();var fs_extra=require(_0x7310('0x5'));var auth=require(_0x7310('0x6'));var interaction=require(_0x7310('0x7'));var config=require(_0x7310('0x8'));var controller=require(_0x7310('0x9'));router[_0x7310('0xa')]('/',auth[_0x7310('0xb')](),controller[_0x7310('0xc')]);router[_0x7310('0xa')](_0x7310('0xd'),auth['isAuthenticated'](),controller[_0x7310('0xe')]);router[_0x7310('0xa')]('/:id',auth[_0x7310('0xb')](),controller[_0x7310('0xf')]);router['post']('/',auth[_0x7310('0xb')](),controller[_0x7310('0x10')]);router[_0x7310('0x11')](_0x7310('0x12'),auth[_0x7310('0xb')](),controller[_0x7310('0x13')]);router[_0x7310('0x14')]('/:id',auth[_0x7310('0xb')](),controller[_0x7310('0x15')]);module[_0x7310('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index e2aa6de..a6ed3f8 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 _0x7366=['attended','STRING','Yes','sequelize','moment','exports','ENUM','blind'];(function(_0x3f573b,_0x5ecd70){var _0x48a84e=function(_0x1c20be){while(--_0x1c20be){_0x3f573b['push'](_0x3f573b['shift']());}};_0x48a84e(++_0x5ecd70);}(_0x7366,0x103));var _0x6736=function(_0x4f7848,_0x41579d){_0x4f7848=_0x4f7848-0x0;var _0x2ac58a=_0x7366[_0x4f7848];return _0x2ac58a;};'use strict';var Sequelize=require(_0x6736('0x0'));var moment=require(_0x6736('0x1'));module[_0x6736('0x2')]={'type':{'type':Sequelize[_0x6736('0x3')](_0x6736('0x4'),_0x6736('0x5'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x6736('0x6')]},'transferercalleridnum':{'type':Sequelize[_0x6736('0x6')]},'transferercalleridname':{'type':Sequelize[_0x6736('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0x6736('0x6')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x6736('0x6')]},'transferercontext':{'type':Sequelize[_0x6736('0x6')]},'transfererexten':{'type':Sequelize[_0x6736('0x6')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x6736('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0x6736('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x6736('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x6736('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0x6736('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0x6736('0x6')]},'transfereecontext':{'type':Sequelize[_0x6736('0x6')]},'transfereeexten':{'type':Sequelize[_0x6736('0x6')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x6736('0x3')](_0x6736('0x7'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8f69=['exports','ENUM','STRING','Yes','sequelize','moment'];(function(_0x573eb3,_0x1fc655){var _0x502c61=function(_0x149afa){while(--_0x149afa){_0x573eb3['push'](_0x573eb3['shift']());}};_0x502c61(++_0x1fc655);}(_0x8f69,0xbe));var _0x98f6=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x8f69[_0x2aea9e];return _0x430b92;};'use strict';var Sequelize=require(_0x98f6('0x0'));var moment=require(_0x98f6('0x1'));module[_0x98f6('0x2')]={'type':{'type':Sequelize[_0x98f6('0x3')]('blind','attended')},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x98f6('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x98f6('0x4')]},'transferercalleridname':{'type':Sequelize[_0x98f6('0x4')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x98f6('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x98f6('0x4')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x98f6('0x4')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x98f6('0x4')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x98f6('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x98f6('0x4')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x98f6('0x4')]},'isexternal':{'type':Sequelize[_0x98f6('0x3')](_0x98f6('0x5'),'No')},'context':{'type':Sequelize[_0x98f6('0x4')]},'extension':{'type':Sequelize[_0x98f6('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 6e3da0e..1650756 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 _0x516c=['options','find','body','describe','eml-format','rimraf','zip-dir','bluebird','util','path','sox','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','sendStatus','end','status','undefined','count','offset','limit','set','Content-Range','json','apply','save','update','destroy','then','name','send','index','map','VoiceTransferReport','rawAttributes','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','keys'];(function(_0xaa534a,_0x24dc24){var _0x45f1d4=function(_0x59eef6){while(--_0x59eef6){_0xaa534a['push'](_0xaa534a['shift']());}};_0x45f1d4(++_0x24dc24);}(_0x516c,0x158));var _0xc516=function(_0x1415d1,_0x5283d1){_0x1415d1=_0x1415d1-0x0;var _0x2622bf=_0x516c[_0x1415d1];return _0x2622bf;};'use strict';var emlformat=require(_0xc516('0x0'));var rimraf=require(_0xc516('0x1'));var zipdir=require(_0xc516('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc516('0x3'));var Mustache=require('mustache');var util=require(_0xc516('0x4'));var path=require(_0xc516('0x5'));var sox=require(_0xc516('0x6'));var csv=require('to-csv');var ejs=require(_0xc516('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc516('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc516('0x9'));var toCsv=require('to-csv');var querystring=require(_0xc516('0xa'));var Papa=require(_0xc516('0xb'));var Redis=require(_0xc516('0xc'));var authService=require(_0xc516('0xd'));var qs=require(_0xc516('0xe'));var as=require(_0xc516('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc516('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xc516('0x11'));var licenseUtil=require(_0xc516('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xabac08,_0x34ddb5){_0x34ddb5=_0x34ddb5||0xcc;return function(_0x2090c9){if(_0x2090c9){return _0xabac08[_0xc516('0x13')](_0x34ddb5);}return _0xabac08['status'](_0x34ddb5)[_0xc516('0x14')]();};}function respondWithResult(_0x1a5d9d,_0x532941){_0x532941=_0x532941||0xc8;return function(_0x31a63d){if(_0x31a63d){return _0x1a5d9d[_0xc516('0x15')](_0x532941)['json'](_0x31a63d);}};}function respondWithFilteredResult(_0x27f961,_0x48f62c){return function(_0x320114){if(_0x320114){var _0x41f895=typeof _0x48f62c['offset']==='undefined'&&typeof _0x48f62c['limit']===_0xc516('0x16');var _0x1c34d4=_0x320114['count'];var _0x3d9962=_0x41f895?0x0:_0x48f62c['offset'];var _0x467c0f=_0x41f895?_0x320114[_0xc516('0x17')]:_0x48f62c[_0xc516('0x18')]+_0x48f62c[_0xc516('0x19')];var _0x5ce630;if(_0x467c0f>=_0x1c34d4){_0x467c0f=_0x1c34d4;_0x5ce630=0xc8;}else{_0x5ce630=0xce;}_0x27f961[_0xc516('0x15')](_0x5ce630);return _0x27f961[_0xc516('0x1a')](_0xc516('0x1b'),_0x3d9962+'-'+_0x467c0f+'/'+_0x1c34d4)[_0xc516('0x1c')](_0x320114);}return null;};}function patchUpdates(_0x56b463){return function(_0x4e2a2d){try{jsonpatch[_0xc516('0x1d')](_0x4e2a2d,_0x56b463,!![]);}catch(_0x279bf2){return BPromise['reject'](_0x279bf2);}return _0x4e2a2d[_0xc516('0x1e')]();};}function saveUpdates(_0x12059f,_0x1cbcbb){return function(_0x2f682a){if(_0x2f682a){return _0x2f682a[_0xc516('0x1f')](_0x12059f)['then'](function(_0x262c2d){return _0x262c2d;});}return null;};}function removeEntity(_0x6066,_0x347a5d){return function(_0x189c81){if(_0x189c81){return _0x189c81[_0xc516('0x20')]()[_0xc516('0x21')](function(){_0x6066[_0xc516('0x15')](0xcc)[_0xc516('0x14')]();});}};}function handleEntityNotFound(_0x369dbf,_0x3bd8cb){return function(_0xabe30){if(!_0xabe30){_0x369dbf[_0xc516('0x13')](0x194);}return _0xabe30;};}function handleError(_0x3f0c39,_0x3f54e2){_0x3f54e2=_0x3f54e2||0x1f4;return function(_0x34f1b3){logger['error'](_0x34f1b3['stack']);if(_0x34f1b3[_0xc516('0x22')]){delete _0x34f1b3['name'];}_0x3f0c39[_0xc516('0x15')](_0x3f54e2)[_0xc516('0x23')](_0x34f1b3);};}exports[_0xc516('0x24')]=function(_0x407866,_0x2c8e22){var _0x483099={},_0x58d549={},_0x128a32={'count':0x0,'rows':[]};var _0x3b2133=_[_0xc516('0x25')](db[_0xc516('0x26')][_0xc516('0x27')],function(_0x3ef0f7){return{'name':_0x3ef0f7['fieldName'],'type':_0x3ef0f7[_0xc516('0x28')]['key']};});_0x58d549[_0xc516('0x29')]=_['map'](_0x3b2133,_0xc516('0x22'));_0x58d549['query']=_['keys'](_0x407866[_0xc516('0x2a')]);_0x58d549[_0xc516('0x2b')]=_['intersection'](_0x58d549[_0xc516('0x29')],_0x58d549[_0xc516('0x2a')]);_0x483099[_0xc516('0x2c')]=_[_0xc516('0x2d')](_0x58d549['model'],qs['fields'](_0x407866[_0xc516('0x2a')][_0xc516('0x2e')]));_0x483099[_0xc516('0x2c')]=_0x483099[_0xc516('0x2c')][_0xc516('0x2f')]?_0x483099['attributes']:_0x58d549[_0xc516('0x29')];if(!_0x407866['query'][_0xc516('0x30')](_0xc516('0x31'))){_0x483099[_0xc516('0x19')]=qs[_0xc516('0x19')](_0x407866[_0xc516('0x2a')][_0xc516('0x19')]);_0x483099[_0xc516('0x18')]=qs[_0xc516('0x18')](_0x407866['query'][_0xc516('0x18')]);}_0x483099[_0xc516('0x32')]=qs['sort'](_0x407866[_0xc516('0x2a')][_0xc516('0x33')]);_0x483099[_0xc516('0x34')]=qs[_0xc516('0x2b')](_[_0xc516('0x35')](_0x407866[_0xc516('0x2a')],_0x58d549['filters']),_0x3b2133);if(_0x407866[_0xc516('0x2a')][_0xc516('0x36')]){_0x483099[_0xc516('0x34')]=_[_0xc516('0x37')](_0x483099[_0xc516('0x34')],{'$or':_['map'](_0x3b2133,function(_0x18ed9a){if(_0x18ed9a[_0xc516('0x28')]!==_0xc516('0x38')){var _0x3b85ec={};_0x3b85ec[_0x18ed9a[_0xc516('0x22')]]={'$like':'%'+_0x407866[_0xc516('0x2a')][_0xc516('0x36')]+'%'};return _0x3b85ec;}})});}_0x483099=_[_0xc516('0x37')]({},_0x483099,_0x407866['options']);var _0x1a3015={'where':_0x483099['where']};return db[_0xc516('0x26')][_0xc516('0x17')](_0x1a3015)[_0xc516('0x21')](function(_0xc76981){_0x128a32[_0xc516('0x17')]=_0xc76981;if(_0x407866['query'][_0xc516('0x39')]){_0x483099[_0xc516('0x3a')]=[{'all':!![]}];}return db[_0xc516('0x26')][_0xc516('0x3b')](_0x483099);})[_0xc516('0x21')](function(_0x75ef5d){_0x128a32['rows']=_0x75ef5d;return _0x128a32;})[_0xc516('0x21')](respondWithFilteredResult(_0x2c8e22,_0x483099))[_0xc516('0x3c')](handleError(_0x2c8e22,null));};exports[_0xc516('0x3d')]=function(_0x523a8c,_0x51f40f){var _0x4fe000={'raw':!![],'where':{'id':_0x523a8c[_0xc516('0x3e')]['id']}},_0x4bedf8={};_0x4bedf8['model']=_[_0xc516('0x3f')](db[_0xc516('0x26')][_0xc516('0x27')]);_0x4bedf8['query']=_[_0xc516('0x3f')](_0x523a8c[_0xc516('0x2a')]);_0x4bedf8[_0xc516('0x2b')]=_[_0xc516('0x2d')](_0x4bedf8[_0xc516('0x29')],_0x4bedf8[_0xc516('0x2a')]);_0x4fe000['attributes']=_[_0xc516('0x2d')](_0x4bedf8[_0xc516('0x29')],qs[_0xc516('0x2e')](_0x523a8c[_0xc516('0x2a')][_0xc516('0x2e')]));_0x4fe000[_0xc516('0x2c')]=_0x4fe000[_0xc516('0x2c')]['length']?_0x4fe000[_0xc516('0x2c')]:_0x4bedf8[_0xc516('0x29')];if(_0x523a8c['query'][_0xc516('0x39')]){_0x4fe000['include']=[{'all':!![]}];}_0x4fe000=_[_0xc516('0x37')]({},_0x4fe000,_0x523a8c[_0xc516('0x40')]);return db[_0xc516('0x26')][_0xc516('0x41')](_0x4fe000)[_0xc516('0x21')](handleEntityNotFound(_0x51f40f,null))['then'](respondWithResult(_0x51f40f,null))['catch'](handleError(_0x51f40f,null));};exports['create']=function(_0x350d6,_0x3439ed){return db['VoiceTransferReport']['create'](_0x350d6[_0xc516('0x42')],{})['then'](respondWithResult(_0x3439ed,0xc9))[_0xc516('0x3c')](handleError(_0x3439ed,null));};exports[_0xc516('0x1f')]=function(_0xd17bb5,_0x2e5512){if(_0xd17bb5[_0xc516('0x42')]['id']){delete _0xd17bb5[_0xc516('0x42')]['id'];}return db[_0xc516('0x26')]['find']({'where':{'id':_0xd17bb5[_0xc516('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2e5512,null))['then'](saveUpdates(_0xd17bb5['body'],null))[_0xc516('0x21')](respondWithResult(_0x2e5512,null))[_0xc516('0x3c')](handleError(_0x2e5512,null));};exports[_0xc516('0x20')]=function(_0x1ab80d,_0x48ef4e){return db[_0xc516('0x26')][_0xc516('0x41')]({'where':{'id':_0x1ab80d[_0xc516('0x3e')]['id']}})[_0xc516('0x21')](handleEntityNotFound(_0x48ef4e,null))[_0xc516('0x21')](removeEntity(_0x48ef4e,null))[_0xc516('0x3c')](handleError(_0x48ef4e,null));};exports[_0xc516('0x43')]=function(_0x1542c2,_0x1d00bb){return db[_0xc516('0x26')][_0xc516('0x43')]()[_0xc516('0x21')](respondWithResult(_0x1d00bb,null))['catch'](handleError(_0x1d00bb,null));}; \ No newline at end of file +var _0x6712=['reject','update','then','destroy','error','stack','name','index','map','VoiceTransferReport','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply'];(function(_0x562cd7,_0x5ae8e7){var _0x30f50d=function(_0x43b995){while(--_0x43b995){_0x562cd7['push'](_0x562cd7['shift']());}};_0x30f50d(++_0x5ae8e7);}(_0x6712,0xbb));var _0x2671=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x6712[_0x565c49];return _0x20ca34;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2671('0x0'));var zipdir=require(_0x2671('0x1'));var jsonpatch=require(_0x2671('0x2'));var rp=require(_0x2671('0x3'));var moment=require(_0x2671('0x4'));var BPromise=require(_0x2671('0x5'));var Mustache=require(_0x2671('0x6'));var util=require(_0x2671('0x7'));var path=require(_0x2671('0x8'));var sox=require(_0x2671('0x9'));var csv=require(_0x2671('0xa'));var ejs=require(_0x2671('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2671('0xc'));var crypto=require(_0x2671('0xd'));var jsforce=require(_0x2671('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2671('0xa'));var querystring=require(_0x2671('0xf'));var Papa=require(_0x2671('0x10'));var Redis=require(_0x2671('0x11'));var authService=require(_0x2671('0x12'));var qs=require(_0x2671('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2671('0x14'));var logger=require(_0x2671('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x2671('0x16'));var licenseUtil=require(_0x2671('0x17'));var db=require(_0x2671('0x18'))['db'];function respondWithStatusCode(_0x5b0091,_0x2d17dc){_0x2d17dc=_0x2d17dc||0xcc;return function(_0x2858a8){if(_0x2858a8){return _0x5b0091[_0x2671('0x19')](_0x2d17dc);}return _0x5b0091[_0x2671('0x1a')](_0x2d17dc)[_0x2671('0x1b')]();};}function respondWithResult(_0x348497,_0xa3c69f){_0xa3c69f=_0xa3c69f||0xc8;return function(_0x82bc12){if(_0x82bc12){return _0x348497[_0x2671('0x1a')](_0xa3c69f)[_0x2671('0x1c')](_0x82bc12);}};}function respondWithFilteredResult(_0x293b31,_0x12ab6e){return function(_0x3aa1be){if(_0x3aa1be){var _0x430098=typeof _0x12ab6e['offset']===_0x2671('0x1d')&&typeof _0x12ab6e[_0x2671('0x1e')]===_0x2671('0x1d');var _0x14d1c3=_0x3aa1be[_0x2671('0x1f')];var _0x59c315=_0x430098?0x0:_0x12ab6e[_0x2671('0x20')];var _0x81bec7=_0x430098?_0x3aa1be[_0x2671('0x1f')]:_0x12ab6e[_0x2671('0x20')]+_0x12ab6e[_0x2671('0x1e')];var _0x83ac81;if(_0x81bec7>=_0x14d1c3){_0x81bec7=_0x14d1c3;_0x83ac81=0xc8;}else{_0x83ac81=0xce;}_0x293b31['status'](_0x83ac81);return _0x293b31[_0x2671('0x21')]('Content-Range',_0x59c315+'-'+_0x81bec7+'/'+_0x14d1c3)[_0x2671('0x1c')](_0x3aa1be);}return null;};}function patchUpdates(_0x481d81){return function(_0x55dc07){try{jsonpatch[_0x2671('0x22')](_0x55dc07,_0x481d81,!![]);}catch(_0x38166f){return BPromise[_0x2671('0x23')](_0x38166f);}return _0x55dc07['save']();};}function saveUpdates(_0x180a89,_0x468834){return function(_0x283ecc){if(_0x283ecc){return _0x283ecc[_0x2671('0x24')](_0x180a89)[_0x2671('0x25')](function(_0x2898ff){return _0x2898ff;});}return null;};}function removeEntity(_0x56f51f,_0x756325){return function(_0x39c7d5){if(_0x39c7d5){return _0x39c7d5[_0x2671('0x26')]()[_0x2671('0x25')](function(){_0x56f51f[_0x2671('0x1a')](0xcc)[_0x2671('0x1b')]();});}};}function handleEntityNotFound(_0x47ca6d,_0x3aac39){return function(_0xabccd1){if(!_0xabccd1){_0x47ca6d['sendStatus'](0x194);}return _0xabccd1;};}function handleError(_0x38cbf7,_0x183867){_0x183867=_0x183867||0x1f4;return function(_0x446d31){logger[_0x2671('0x27')](_0x446d31[_0x2671('0x28')]);if(_0x446d31[_0x2671('0x29')]){delete _0x446d31['name'];}_0x38cbf7['status'](_0x183867)['send'](_0x446d31);};}exports[_0x2671('0x2a')]=function(_0x14e7b6,_0x4dfa8f){var _0x1794fc={},_0xecafd2={},_0xa8a89c={'count':0x0,'rows':[]};var _0xbb1518=_[_0x2671('0x2b')](db[_0x2671('0x2c')]['rawAttributes'],function(_0xee1229){return{'name':_0xee1229[_0x2671('0x2d')],'type':_0xee1229['type'][_0x2671('0x2e')]};});_0xecafd2[_0x2671('0x2f')]=_[_0x2671('0x2b')](_0xbb1518,_0x2671('0x29'));_0xecafd2['query']=_[_0x2671('0x30')](_0x14e7b6[_0x2671('0x31')]);_0xecafd2[_0x2671('0x32')]=_[_0x2671('0x33')](_0xecafd2['model'],_0xecafd2[_0x2671('0x31')]);_0x1794fc['attributes']=_[_0x2671('0x33')](_0xecafd2[_0x2671('0x2f')],qs[_0x2671('0x34')](_0x14e7b6[_0x2671('0x31')][_0x2671('0x34')]));_0x1794fc[_0x2671('0x35')]=_0x1794fc[_0x2671('0x35')][_0x2671('0x36')]?_0x1794fc[_0x2671('0x35')]:_0xecafd2[_0x2671('0x2f')];if(!_0x14e7b6[_0x2671('0x31')]['hasOwnProperty'](_0x2671('0x37'))){_0x1794fc[_0x2671('0x1e')]=qs[_0x2671('0x1e')](_0x14e7b6[_0x2671('0x31')][_0x2671('0x1e')]);_0x1794fc[_0x2671('0x20')]=qs['offset'](_0x14e7b6[_0x2671('0x31')]['offset']);}_0x1794fc['order']=qs[_0x2671('0x38')](_0x14e7b6[_0x2671('0x31')]['sort']);_0x1794fc[_0x2671('0x39')]=qs[_0x2671('0x32')](_[_0x2671('0x3a')](_0x14e7b6[_0x2671('0x31')],_0xecafd2[_0x2671('0x32')]),_0xbb1518);if(_0x14e7b6[_0x2671('0x31')][_0x2671('0x3b')]){_0x1794fc[_0x2671('0x39')]=_[_0x2671('0x3c')](_0x1794fc[_0x2671('0x39')],{'$or':_[_0x2671('0x2b')](_0xbb1518,function(_0x32aefe){if(_0x32aefe['type']!==_0x2671('0x3d')){var _0x269a56={};_0x269a56[_0x32aefe[_0x2671('0x29')]]={'$like':'%'+_0x14e7b6['query']['filter']+'%'};return _0x269a56;}})});}_0x1794fc=_[_0x2671('0x3c')]({},_0x1794fc,_0x14e7b6['options']);var _0x575638={'where':_0x1794fc[_0x2671('0x39')]};return db['VoiceTransferReport'][_0x2671('0x1f')](_0x575638)[_0x2671('0x25')](function(_0xf376cc){_0xa8a89c['count']=_0xf376cc;if(_0x14e7b6[_0x2671('0x31')][_0x2671('0x3e')]){_0x1794fc[_0x2671('0x3f')]=[{'all':!![]}];}return db[_0x2671('0x2c')][_0x2671('0x40')](_0x1794fc);})[_0x2671('0x25')](function(_0x8400f1){_0xa8a89c[_0x2671('0x41')]=_0x8400f1;return _0xa8a89c;})['then'](respondWithFilteredResult(_0x4dfa8f,_0x1794fc))[_0x2671('0x42')](handleError(_0x4dfa8f,null));};exports[_0x2671('0x43')]=function(_0x1577d3,_0x845564){var _0x5ca782={'raw':!![],'where':{'id':_0x1577d3[_0x2671('0x44')]['id']}},_0x4454b5={};_0x4454b5[_0x2671('0x2f')]=_['keys'](db[_0x2671('0x2c')]['rawAttributes']);_0x4454b5[_0x2671('0x31')]=_[_0x2671('0x30')](_0x1577d3[_0x2671('0x31')]);_0x4454b5[_0x2671('0x32')]=_[_0x2671('0x33')](_0x4454b5[_0x2671('0x2f')],_0x4454b5[_0x2671('0x31')]);_0x5ca782['attributes']=_[_0x2671('0x33')](_0x4454b5[_0x2671('0x2f')],qs[_0x2671('0x34')](_0x1577d3[_0x2671('0x31')][_0x2671('0x34')]));_0x5ca782['attributes']=_0x5ca782[_0x2671('0x35')][_0x2671('0x36')]?_0x5ca782['attributes']:_0x4454b5['model'];if(_0x1577d3[_0x2671('0x31')]['includeAll']){_0x5ca782[_0x2671('0x3f')]=[{'all':!![]}];}_0x5ca782=_['merge']({},_0x5ca782,_0x1577d3[_0x2671('0x45')]);return db[_0x2671('0x2c')][_0x2671('0x46')](_0x5ca782)['then'](handleEntityNotFound(_0x845564,null))[_0x2671('0x25')](respondWithResult(_0x845564,null))[_0x2671('0x42')](handleError(_0x845564,null));};exports[_0x2671('0x47')]=function(_0x1f46ee,_0x373513){return db[_0x2671('0x2c')][_0x2671('0x47')](_0x1f46ee[_0x2671('0x48')],{})[_0x2671('0x25')](respondWithResult(_0x373513,0xc9))[_0x2671('0x42')](handleError(_0x373513,null));};exports['update']=function(_0xdeca0c,_0x494e89){if(_0xdeca0c[_0x2671('0x48')]['id']){delete _0xdeca0c['body']['id'];}return db['VoiceTransferReport'][_0x2671('0x46')]({'where':{'id':_0xdeca0c['params']['id']}})['then'](handleEntityNotFound(_0x494e89,null))[_0x2671('0x25')](saveUpdates(_0xdeca0c[_0x2671('0x48')],null))[_0x2671('0x25')](respondWithResult(_0x494e89,null))[_0x2671('0x42')](handleError(_0x494e89,null));};exports[_0x2671('0x26')]=function(_0xa2d8,_0x112715){return db[_0x2671('0x2c')][_0x2671('0x46')]({'where':{'id':_0xa2d8['params']['id']}})[_0x2671('0x25')](handleEntityNotFound(_0x112715,null))['then'](removeEntity(_0x112715,null))['catch'](handleError(_0x112715,null));};exports['describe']=function(_0xa3881d,_0x1bcd5b){return db[_0x2671('0x2c')][_0x2671('0x49')]()[_0x2671('0x25')](respondWithResult(_0x1bcd5b,null))[_0x2671('0x42')](handleError(_0x1bcd5b,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 4b1f208..6bfd374 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 _0x36c1=['moment','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','report_call_transfer','lodash','../../config/logger','api'];(function(_0x403a5e,_0x7fffa7){var _0x24d221=function(_0x3299d8){while(--_0x3299d8){_0x403a5e['push'](_0x403a5e['shift']());}};_0x24d221(++_0x7fffa7);}(_0x36c1,0x11b));var _0x136c=function(_0x459963,_0x5a366a){_0x459963=_0x459963-0x0;var _0xbe84e3=_0x36c1[_0x459963];return _0xbe84e3;};'use strict';var _=require(_0x136c('0x0'));var util=require('util');var logger=require(_0x136c('0x1'))(_0x136c('0x2'));var moment=require(_0x136c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x136c('0x4'));var rimraf=require(_0x136c('0x5'));var config=require(_0x136c('0x6'));var attributes=require(_0x136c('0x7'));module[_0x136c('0x8')]=function(_0x447c6c,_0xf5b4a1){return _0x447c6c[_0x136c('0x9')]('VoiceTransferReport',attributes,{'tableName':_0x136c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb23f=['report_call_transfer','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./voiceTransferReport.attributes','exports','define','VoiceTransferReport'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xb23f,0xf8));var _0xfb23=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb23f[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xfb23('0x0'));var util=require(_0xfb23('0x1'));var logger=require(_0xfb23('0x2'))(_0xfb23('0x3'));var moment=require('moment');var BPromise=require(_0xfb23('0x4'));var rp=require(_0xfb23('0x5'));var fs=require('fs');var path=require(_0xfb23('0x6'));var rimraf=require(_0xfb23('0x7'));var config=require('../../config/environment');var attributes=require(_0xfb23('0x8'));module[_0xfb23('0x9')]=function(_0xff8a51,_0x58bcdb){return _0xff8a51[_0xfb23('0xa')](_0xfb23('0xb'),attributes,{'tableName':_0xfb23('0xc'),'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 10cc6ed..1ea0f54 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 _0x6678=['../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceTransferReport,\x20%s,\x20%s','message','catch','CreateVoiceTransferReport','create','body','options','raw','lodash','util','randomstring','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6678,0x64));var _0x8667=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0x6678[_0x5834bc];return _0x3e183a;};'use strict';var _=require(_0x8667('0x0'));var util=require(_0x8667('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8667('0x2'));var fs=require('fs');var Redis=require(_0x8667('0x3'));var db=require(_0x8667('0x4'))['db'];var utils=require(_0x8667('0x5'));var logger=require('../../config/logger')(_0x8667('0x6'));var config=require(_0x8667('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8667('0x8')][_0x8667('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1aa2ad,_0x4aa987,_0x56d904){return new BPromise(function(_0x2c0880,_0x2c23da){return client[_0x8667('0xa')](_0x1aa2ad,_0x56d904)[_0x8667('0xb')](function(_0x20d15c){logger[_0x8667('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x4aa987,_0x8667('0xd'));logger[_0x8667('0xe')](_0x8667('0xf'),_0x4aa987,'request\x20sent',JSON[_0x8667('0x10')](_0x20d15c));if(_0x20d15c[_0x8667('0x11')]){if(_0x20d15c['error']['code']===0x1f4){logger['error'](_0x8667('0x12'),_0x4aa987,_0x20d15c[_0x8667('0x11')][_0x8667('0x13')]);return _0x2c23da(_0x20d15c[_0x8667('0x11')][_0x8667('0x13')]);}logger[_0x8667('0x11')](_0x8667('0x12'),_0x4aa987,_0x20d15c[_0x8667('0x11')][_0x8667('0x13')]);return _0x2c0880(_0x20d15c[_0x8667('0x11')][_0x8667('0x13')]);}else{logger[_0x8667('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x4aa987,_0x8667('0xd'));_0x2c0880(_0x20d15c['result'][_0x8667('0x13')]);}})[_0x8667('0x14')](function(_0x1c4e9c){logger['error'](_0x8667('0x12'),_0x4aa987,_0x1c4e9c);_0x2c23da(_0x1c4e9c);});});}exports[_0x8667('0x15')]=function(_0x2b81b9){var _0x47671d=this;return new Promise(function(_0x3d026d,_0x3fa59c){return db['VoiceTransferReport'][_0x8667('0x16')](_0x2b81b9[_0x8667('0x17')],{'raw':_0x2b81b9[_0x8667('0x18')]?_0x2b81b9['options'][_0x8667('0x19')]===undefined?!![]:![]:!![]})[_0x8667('0xb')](function(_0x446d87){logger[_0x8667('0xc')](_0x8667('0x15'),_0x2b81b9);logger[_0x8667('0xe')](_0x8667('0x15'),_0x2b81b9,JSON['stringify'](_0x446d87));_0x3d026d(_0x446d87);})[_0x8667('0x14')](function(_0x4a4d78){logger['error'](_0x8667('0x15'),_0x4a4d78[_0x8667('0x13')],_0x2b81b9);_0x3fa59c(_0x47671d[_0x8667('0x11')](0x1f4,_0x4a4d78['message']));});});}; \ No newline at end of file +var _0xbf7e=['raw','info','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateVoiceTransferReport','create','body'];(function(_0x2fd69d,_0xeb1037){var _0x5d5ef3=function(_0xa9ea9e){while(--_0xa9ea9e){_0x2fd69d['push'](_0x2fd69d['shift']());}};_0x5d5ef3(++_0xeb1037);}(_0xbf7e,0x161));var _0xebf7=function(_0x306001,_0x5b0132){_0x306001=_0x306001-0x0;var _0xefd68b=_0xbf7e[_0x306001];return _0xefd68b;};'use strict';var _=require(_0xebf7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xebf7('0x1'));var rs=require(_0xebf7('0x2'));var fs=require('fs');var Redis=require(_0xebf7('0x3'));var db=require(_0xebf7('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xebf7('0x5'));var config=require(_0xebf7('0x6'));var jayson=require(_0xebf7('0x7'));var client=jayson[_0xebf7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f93f3,_0x43a53d,_0xe45add){return new BPromise(function(_0x1ab9bc,_0x5a13ad){return client[_0xebf7('0x9')](_0x1f93f3,_0xe45add)[_0xebf7('0xa')](function(_0x27368d){logger['info'](_0xebf7('0xb'),_0x43a53d,_0xebf7('0xc'));logger[_0xebf7('0xd')](_0xebf7('0xe'),_0x43a53d,_0xebf7('0xc'),JSON[_0xebf7('0xf')](_0x27368d));if(_0x27368d[_0xebf7('0x10')]){if(_0x27368d['error'][_0xebf7('0x11')]===0x1f4){logger['error'](_0xebf7('0xb'),_0x43a53d,_0x27368d['error'][_0xebf7('0x12')]);return _0x5a13ad(_0x27368d['error'][_0xebf7('0x12')]);}logger[_0xebf7('0x10')](_0xebf7('0xb'),_0x43a53d,_0x27368d[_0xebf7('0x10')][_0xebf7('0x12')]);return _0x1ab9bc(_0x27368d[_0xebf7('0x10')][_0xebf7('0x12')]);}else{logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x43a53d,'request\x20sent');_0x1ab9bc(_0x27368d['result'][_0xebf7('0x12')]);}})['catch'](function(_0x5bb8e4){logger['error'](_0xebf7('0xb'),_0x43a53d,_0x5bb8e4);_0x5a13ad(_0x5bb8e4);});});}exports[_0xebf7('0x13')]=function(_0x242016){var _0x19ce6e=this;return new Promise(function(_0x3cc2c6,_0x39b383){return db['VoiceTransferReport'][_0xebf7('0x14')](_0x242016[_0xebf7('0x15')],{'raw':_0x242016['options']?_0x242016['options'][_0xebf7('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x23ea2e){logger[_0xebf7('0x17')](_0xebf7('0x13'),_0x242016);logger[_0xebf7('0xd')](_0xebf7('0x13'),_0x242016,JSON[_0xebf7('0xf')](_0x23ea2e));_0x3cc2c6(_0x23ea2e);})[_0xebf7('0x18')](function(_0x2c0d20){logger[_0xebf7('0x10')](_0xebf7('0x13'),_0x2c0d20[_0xebf7('0x12')],_0x242016);_0x39b383(_0x19ce6e[_0xebf7('0x10')](0x1f4,_0x2c0d20[_0xebf7('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 6efd236..225a19b 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 _0x7652=['transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','isAuthenticated','/hangup','canUpdate','hangup','/answer','answer','/unhold','unhold','/calls','calls','/transfer'];(function(_0x3006b4,_0x524f86){var _0x50c960=function(_0x495e1a){while(--_0x495e1a){_0x3006b4['push'](_0x3006b4['shift']());}};_0x50c960(++_0x524f86);}(_0x7652,0xb6));var _0x2765=function(_0x2ec3fe,_0x3b7fd8){_0x2ec3fe=_0x2ec3fe-0x0;var _0x380ba8=_0x7652[_0x2ec3fe];return _0x380ba8;};'use strict';var express=require(_0x2765('0x0'));var router=express[_0x2765('0x1')]();var auth=require(_0x2765('0x2'));var controller=require(_0x2765('0x3'));router[_0x2765('0x4')]('/originate',auth[_0x2765('0x5')](),auth['canUpdate'](),controller['originate']);router[_0x2765('0x4')](_0x2765('0x6'),auth[_0x2765('0x5')](),auth[_0x2765('0x7')](),controller[_0x2765('0x8')]);router['post'](_0x2765('0x9'),auth[_0x2765('0x5')](),auth['canUpdate'](),controller[_0x2765('0xa')]);router[_0x2765('0x4')]('/hold',auth['isAuthenticated'](),auth['canUpdate'](),controller['hold']);router['post'](_0x2765('0xb'),auth['isAuthenticated'](),auth[_0x2765('0x7')](),controller[_0x2765('0xc')]);router[_0x2765('0x4')](_0x2765('0xd'),auth[_0x2765('0x5')](),auth['canUpdate'](),controller[_0x2765('0xe')]);router['post'](_0x2765('0xf'),auth['isAuthenticated'](),auth[_0x2765('0x7')](),controller[_0x2765('0x10')]);module[_0x2765('0x11')]=router; \ No newline at end of file +var _0x571f=['exports','express','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','canUpdate','originate','/hangup','hangup','/answer','answer','/hold','hold','/unhold','unhold','calls','/transfer'];(function(_0x52310e,_0x210702){var _0xb42a46=function(_0x10df4e){while(--_0x10df4e){_0x52310e['push'](_0x52310e['shift']());}};_0xb42a46(++_0x210702);}(_0x571f,0x1cd));var _0xf571=function(_0xaf29da,_0x117f5a){_0xaf29da=_0xaf29da-0x0;var _0x295c51=_0x571f[_0xaf29da];return _0x295c51;};'use strict';var express=require(_0xf571('0x0'));var router=express[_0xf571('0x1')]();var auth=require(_0xf571('0x2'));var controller=require(_0xf571('0x3'));router[_0xf571('0x4')](_0xf571('0x5'),auth[_0xf571('0x6')](),auth[_0xf571('0x7')](),controller[_0xf571('0x8')]);router[_0xf571('0x4')](_0xf571('0x9'),auth[_0xf571('0x6')](),auth['canUpdate'](),controller[_0xf571('0xa')]);router[_0xf571('0x4')](_0xf571('0xb'),auth[_0xf571('0x6')](),auth[_0xf571('0x7')](),controller[_0xf571('0xc')]);router[_0xf571('0x4')](_0xf571('0xd'),auth['isAuthenticated'](),auth[_0xf571('0x7')](),controller[_0xf571('0xe')]);router[_0xf571('0x4')](_0xf571('0xf'),auth[_0xf571('0x6')](),auth[_0xf571('0x7')](),controller[_0xf571('0x10')]);router[_0xf571('0x4')]('/calls',auth['isAuthenticated'](),auth[_0xf571('0x7')](),controller[_0xf571('0x11')]);router[_0xf571('0x4')](_0xf571('0x12'),auth[_0xf571('0x6')](),auth[_0xf571('0x7')](),controller['transfer']);module[_0xf571('0x13')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index f97bb78..f3c94be 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 _0xcea2=['result','catch','findOne','agent','all','rows','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','VoiceChannels','filter','UserId','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','../../mysqldb','util','bluebird','jayson/promise','http','../../config/logger','webbarapi','redis','localhost','socket.io-emitter','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','NotFound','then','code','message'];(function(_0xffd0ff,_0x3aacdc){var _0x519c9c=function(_0x147d2a){while(--_0x147d2a){_0xffd0ff['push'](_0xffd0ff['shift']());}};_0x519c9c(++_0x3aacdc);}(_0xcea2,0x15a));var _0x2cea=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xcea2[_0x4b7895];return _0x264180;};'use strict';var path=require(_0x2cea('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x2cea('0x1'))['db'];var config=require('../../config/environment');var util=require(_0x2cea('0x2'));var BPromise=require(_0x2cea('0x3'));var jayson=require(_0x2cea('0x4'));var amiClient=jayson['client'][_0x2cea('0x5')]({'port':0x232a});var logger=require(_0x2cea('0x6'))(_0x2cea('0x7'));var Redis=require('ioredis');config[_0x2cea('0x8')]=_['defaults'](config[_0x2cea('0x8')],{'host':_0x2cea('0x9'),'port':0x18eb});var io=require(_0x2cea('0xa'))(new Redis(config[_0x2cea('0x8')]));var Schema=require(_0x2cea('0xb'));var originateValidation=new Schema({'userId':{'type':_0x2cea('0xc'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x2cea('0xd'),'required':[!![],_0x2cea('0xe')]},'callerId':{'type':_0x2cea('0xd')},'callbackUrl':{'type':_0x2cea('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x2cea('0xc'),'required':[!![],_0x2cea('0xf')]},'sessionId':{'type':_0x2cea('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x2cea('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x2cea('0xc'),'required':[!![],_0x2cea('0xf')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x2cea('0xd'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x2cea('0xc'),'required':[!![],_0x2cea('0xf')]},'sessionId':{'type':_0x2cea('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x2cea('0xc'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x2cea('0xc'),'required':[!![],_0x2cea('0xf')]}});function emit(_0x981e3f,_0x17322c,_0x232dad){logger[_0x2cea('0x10')](_0x981e3f,_0x17322c,JSON[_0x2cea('0x11')](_0x232dad));io['to'](_0x981e3f)[_0x2cea('0x12')](_0x17322c,_0x232dad);}function handleError(_0x5eee09){return function(_0x19927a){console[_0x2cea('0x13')](_0x2cea('0x14'),_0x19927a,_0x19927a instanceof RangeError);logger[_0x2cea('0x15')](_0x19927a[_0x2cea('0x16')]);if(_0x19927a instanceof RangeError){if(_0x19927a[_0x2cea('0x17')]){delete _0x19927a['name'];}_0x5eee09[_0x2cea('0x18')](0x194)['send'](_0x19927a);}else{if(_0x19927a[_0x2cea('0x17')]){delete _0x19927a[_0x2cea('0x17')];}_0x5eee09[_0x2cea('0x18')](0x1f4)['send'](_0x19927a);}};}function checkError(){return function(_0x46a112){if(!_0x46a112){throw new RangeError(_0x2cea('0x19'));}return _0x46a112;};}function respondWithRpcPromise(_0x210d7e,_0x1b389b){return new BPromise(function(_0x3246bc,_0x3f6f0e){var _0x10f13a=amiClient;return _0x10f13a['request'](_0x210d7e,_0x1b389b)[_0x2cea('0x1a')](function(_0x5e5b46){if(_0x5e5b46[_0x2cea('0x15')]){if(_0x5e5b46['error'][_0x2cea('0x1b')]===0x1f4){return _0x3f6f0e(_0x5e5b46[_0x2cea('0x15')]['message']);}return _0x3246bc(_0x5e5b46[_0x2cea('0x15')][_0x2cea('0x1c')]);}else{_0x3246bc(_0x5e5b46[_0x2cea('0x1d')]);}})[_0x2cea('0x1e')](function(_0x3f3ee0){_0x3f6f0e(_0x3f3ee0);});});}function getAgent(_0x79529b){return db['User'][_0x2cea('0x1f')]({'where':{'id':_0x79529b,'role':_0x2cea('0x20')}})[_0x2cea('0x1a')](checkError());}function getAgentCheckSession(_0x32af98,_0x46ef5a){return new BPromise(function(_0x3ea40c,_0xe99cca){var _0x2741cb=respondWithRpcPromise('VoiceChannels');var _0xff69ad=getAgent(_0x32af98);Promise[_0x2cea('0x21')]([_0x2741cb,_0xff69ad])['then'](function(_0xfeb8bd){var _0xc398c5=_0xfeb8bd[0x0];var _0x271b2f=_0xfeb8bd[0x1];var _0x16cf9f=_['filter'](_0xc398c5[_0x2cea('0x22')],function(_0x128934){return _0x128934['UserId']==_0x271b2f['id']&&_0x128934[_0x2cea('0x23')]==_0x46ef5a;});if(_0x16cf9f[_0x2cea('0x24')]==0x1){_0x3ea40c(_0x271b2f);}else{_0xe99cca(new RangeError(_0x2cea('0x25')+_0x46ef5a+_0x2cea('0x26')));}});});}exports[_0x2cea('0x27')]=function(_0x35b37e,_0x10e7c5){logger[_0x2cea('0x10')](_0x2cea('0x28'),_0x35b37e[_0x2cea('0x29')]);var _0x107472=originateValidation['validate'](_0x35b37e[_0x2cea('0x29')]);if(_0x107472[_0x2cea('0x24')]>0x0){return _0x10e7c5[_0x2cea('0x18')](0x190)[_0x2cea('0x2a')](_0x107472);}var _0x5a0061=_0x35b37e['body'][_0x2cea('0x2b')];var _0x1451f2=_0x35b37e['body'][_0x2cea('0x2c')];var _0x49d851=_0x35b37e[_0x2cea('0x29')]['callerId'];var _0x510d66=_0x35b37e['body'][_0x2cea('0x2d')];return getAgent(_0x5a0061)[_0x2cea('0x1a')](function(_0x5d254d){logger[_0x2cea('0x10')](_0x2cea('0x2e'),_0x5d254d['name']);emit(util[_0x2cea('0x2f')](_0x2cea('0x30'),_0x5d254d[_0x2cea('0x17')]),_0x2cea('0x31'),{'callNumber':_0x1451f2,'callerId':_0x49d851,'callbackUrl':_0x510d66});return _0x10e7c5[_0x2cea('0x18')](0xc8)['json']({'error':![],'message':_0x2cea('0x32')});})[_0x2cea('0x1e')](handleError(_0x10e7c5));};exports['hangup']=function(_0x53c088,_0x1913a2){logger['info']('hangup\x20fired:',_0x53c088['body']);var _0x50f632=hangupValidation[_0x2cea('0xb')](_0x53c088[_0x2cea('0x29')]);if(_0x50f632['length']>0x0){return _0x1913a2[_0x2cea('0x18')](0x190)[_0x2cea('0x2a')](_0x50f632);}var _0x249aaa=_0x53c088['body'][_0x2cea('0x2b')];var _0xcc11b6=_0x53c088[_0x2cea('0x29')][_0x2cea('0x23')];return getAgent(_0x249aaa)[_0x2cea('0x1a')](function(_0x2cb62b){logger[_0x2cea('0x10')](_0x2cea('0x2e'),_0x2cb62b[_0x2cea('0x17')]);emit(util[_0x2cea('0x2f')](_0x2cea('0x30'),_0x2cb62b[_0x2cea('0x17')]),_0x2cea('0x33'),{'sessionId':_0xcc11b6});return _0x1913a2[_0x2cea('0x18')](0xc8)[_0x2cea('0x2a')]({'error':![],'message':_0x2cea('0x34')});})[_0x2cea('0x1e')](handleError(_0x1913a2));};exports[_0x2cea('0x35')]=function(_0x49fcfa,_0x294057){logger['info'](_0x2cea('0x36'),_0x49fcfa[_0x2cea('0x29')]);var _0x22ce6b=answerValidation[_0x2cea('0xb')](_0x49fcfa[_0x2cea('0x29')]);if(_0x22ce6b[_0x2cea('0x24')]>0x0){return _0x294057[_0x2cea('0x18')](0x190)[_0x2cea('0x2a')](_0x22ce6b);}var _0x608740=_0x49fcfa[_0x2cea('0x29')]['userId'];var _0x515494=_0x49fcfa[_0x2cea('0x29')][_0x2cea('0x23')];return getAgent(_0x608740)['then'](function(_0x2d22db){logger['info'](_0x2cea('0x2e'),_0x2d22db['name']);emit(util[_0x2cea('0x2f')](_0x2cea('0x30'),_0x2d22db[_0x2cea('0x17')]),_0x2cea('0x37'),{'sessionId':_0x515494});return _0x294057[_0x2cea('0x18')](0xc8)[_0x2cea('0x2a')]({'error':![],'message':_0x2cea('0x38')});})[_0x2cea('0x1e')](handleError(_0x294057));};exports[_0x2cea('0x39')]=function(_0x1ce60a,_0x5a55ed){logger[_0x2cea('0x10')](_0x2cea('0x3a'),_0x1ce60a[_0x2cea('0x29')]);var _0x348baf=holdValidation['validate'](_0x1ce60a['body']);if(_0x348baf[_0x2cea('0x24')]>0x0){return _0x5a55ed[_0x2cea('0x18')](0x190)[_0x2cea('0x2a')](_0x348baf);}var _0x510e0f=_0x1ce60a[_0x2cea('0x29')][_0x2cea('0x2b')];var _0x4223d8=_0x1ce60a[_0x2cea('0x29')]['sessionId'];return getAgent(_0x510e0f)[_0x2cea('0x1a')](function(_0x526e92){logger['info'](_0x2cea('0x2e'),_0x526e92[_0x2cea('0x17')]);emit(util[_0x2cea('0x2f')](_0x2cea('0x30'),_0x526e92['name']),'webbar:hold',{'sessionId':_0x4223d8});return _0x5a55ed[_0x2cea('0x18')](0xc8)[_0x2cea('0x2a')]({'error':![],'message':_0x2cea('0x3b')});})[_0x2cea('0x1e')](handleError(_0x5a55ed));};exports['unhold']=function(_0x4ec462,_0x5d7cb6){logger[_0x2cea('0x10')](_0x2cea('0x3c'),_0x4ec462[_0x2cea('0x29')]);var _0x25dc12=unholdValidation[_0x2cea('0xb')](_0x4ec462[_0x2cea('0x29')]);if(_0x25dc12[_0x2cea('0x24')]>0x0){return _0x5d7cb6['status'](0x190)[_0x2cea('0x2a')](_0x25dc12);}var _0x39937e=_0x4ec462[_0x2cea('0x29')]['userId'];var _0x103f18=_0x4ec462['body'][_0x2cea('0x23')];return getAgent(_0x39937e)[_0x2cea('0x1a')](function(_0x21851a){logger[_0x2cea('0x10')](_0x2cea('0x2e'),_0x21851a[_0x2cea('0x17')]);emit(util[_0x2cea('0x2f')](_0x2cea('0x30'),_0x21851a['name']),_0x2cea('0x3d'),{'sessionId':_0x103f18});return _0x5d7cb6['status'](0xc8)[_0x2cea('0x2a')]({'error':![],'message':_0x2cea('0x3e')});})[_0x2cea('0x1e')](handleError(_0x5d7cb6));};exports['calls']=function(_0x3b27f4,_0x4c4db6){logger['info'](_0x2cea('0x3f'),_0x4c4db6[_0x2cea('0x29')]);var _0x28e720=callsValidation[_0x2cea('0xb')](_0x3b27f4[_0x2cea('0x29')]);if(_0x28e720['length']>0x0){return _0x4c4db6['status'](0x190)[_0x2cea('0x2a')](_0x28e720);}var _0x160755=_0x3b27f4[_0x2cea('0x29')][_0x2cea('0x2b')];var _0x526269=respondWithRpcPromise(_0x2cea('0x40'));var _0x5ae31b=getAgent(_0x160755);return Promise[_0x2cea('0x21')]([_0x526269,_0x5ae31b])[_0x2cea('0x1a')](function(_0x35d64b){var _0x3f06d1=_0x35d64b[0x0];var _0x221c16=_0x35d64b[0x1];var _0x50adbe=_[_0x2cea('0x41')](_0x3f06d1[_0x2cea('0x22')],function(_0x2c6dd4){return _0x2c6dd4[_0x2cea('0x42')]==_0x221c16['id'];});return _0x4c4db6[_0x2cea('0x18')](0xc8)['json']({'count':_0x50adbe[_0x2cea('0x24')],'rows':_0x50adbe});})[_0x2cea('0x1e')](handleError(_0x4c4db6));};exports['conference']=function(_0x548912,_0x820317){logger[_0x2cea('0x10')](_0x2cea('0x43'),_0x548912['body']);var _0x5806b8=conferenceValidation[_0x2cea('0xb')](_0x548912[_0x2cea('0x29')]);if(_0x5806b8['length']>0x0){return _0x820317[_0x2cea('0x18')](0x190)[_0x2cea('0x2a')](_0x5806b8);}var _0x589682=_0x548912[_0x2cea('0x29')][_0x2cea('0x2b')];return getAgent(_0x589682)[_0x2cea('0x1a')](function(_0x42881c){logger[_0x2cea('0x10')]('entityFound:',_0x42881c[_0x2cea('0x17')]);emit(util[_0x2cea('0x2f')]('user:%s',_0x42881c[_0x2cea('0x17')]),_0x2cea('0x44'));return _0x820317[_0x2cea('0x18')](0xc8)[_0x2cea('0x2a')]({'error':![],'message':_0x2cea('0x45')});})[_0x2cea('0x1e')](handleError(_0x820317));};exports[_0x2cea('0x46')]=function(_0xb9ef65,_0x3708c8){logger[_0x2cea('0x10')](_0x2cea('0x47'),_0xb9ef65[_0x2cea('0x29')]);var _0x400459=transferValidation['validate'](_0xb9ef65['body']);if(_0x400459[_0x2cea('0x24')]>0x0){return _0x3708c8[_0x2cea('0x18')](0x190)[_0x2cea('0x2a')](_0x400459);}var _0x104051=_0xb9ef65[_0x2cea('0x29')][_0x2cea('0x2b')];var _0x354c42=_0xb9ef65['body']['sessionId'];var _0x1dfeaf=_0xb9ef65[_0x2cea('0x29')][_0x2cea('0x48')];return getAgent(_0x104051)['then'](function(_0x4e00b6){logger['info'](_0x2cea('0x2e'),_0x4e00b6[_0x2cea('0x17')]);emit(util['format']('user:%s',_0x4e00b6[_0x2cea('0x17')]),_0x2cea('0x49'),{'sessionId':_0x354c42,'transferNumber':_0x1dfeaf});return _0x3708c8[_0x2cea('0x18')](0xc8)[_0x2cea('0x2a')]({'error':![],'message':_0x2cea('0x4a')});})[_0x2cea('0x1e')](handleError(_0x3708c8));}; \ No newline at end of file +var _0x0b78=['result','catch','User','findOne','all','filter','rows','UserId','sessionId','length','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','entityFound:','webbar:hangup','hangup\x20executed!','answer\x20fired:','format','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','path','lodash','../../config/environment','util','jayson/promise','http','../../config/logger','webbarapi','defaults','localhost','socket.io-emitter','redis','validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','status','send','name','NotFound','then','code','message'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x0b78,0x1ad));var _0x80b7=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x0b78[_0x40a045];return _0x1a687c;};'use strict';var path=require(_0x80b7('0x0'));var fs=require('fs');var _=require(_0x80b7('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x80b7('0x2'));var util=require(_0x80b7('0x3'));var BPromise=require('bluebird');var jayson=require(_0x80b7('0x4'));var amiClient=jayson['client'][_0x80b7('0x5')]({'port':0x232a});var logger=require(_0x80b7('0x6'))(_0x80b7('0x7'));var Redis=require('ioredis');config['redis']=_[_0x80b7('0x8')](config['redis'],{'host':_0x80b7('0x9'),'port':0x18eb});var io=require(_0x80b7('0xa'))(new Redis(config[_0x80b7('0xb')]));var Schema=require(_0x80b7('0xc'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x80b7('0xd')]},'callNumber':{'type':_0x80b7('0xe'),'required':[!![],_0x80b7('0xf')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x80b7('0xe')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x80b7('0xd')]},'sessionId':{'type':_0x80b7('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x80b7('0x10'),'required':[!![],_0x80b7('0xd')]},'sessionId':{'type':_0x80b7('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x80b7('0x10'),'required':[!![],_0x80b7('0xd')]},'sessionId':{'type':_0x80b7('0xe'),'required':[!![],_0x80b7('0x11')]},'transferNumber':{'type':_0x80b7('0xe'),'required':[!![],_0x80b7('0x12')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x80b7('0xd')]},'sessionId':{'type':_0x80b7('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x80b7('0xd')]},'sessionId':{'type':_0x80b7('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x80b7('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':_0x80b7('0x10'),'required':[!![],_0x80b7('0xd')]}});function emit(_0x2c0c4e,_0x36d0bb,_0x352805){logger[_0x80b7('0x13')](_0x2c0c4e,_0x36d0bb,JSON[_0x80b7('0x14')](_0x352805));io['to'](_0x2c0c4e)[_0x80b7('0x15')](_0x36d0bb,_0x352805);}function handleError(_0x34299c){return function(_0x4c12b1){console[_0x80b7('0x16')](_0x80b7('0x17'),_0x4c12b1,_0x4c12b1 instanceof RangeError);logger[_0x80b7('0x18')](_0x4c12b1[_0x80b7('0x19')]);if(_0x4c12b1 instanceof RangeError){if(_0x4c12b1['name']){delete _0x4c12b1['name'];}_0x34299c[_0x80b7('0x1a')](0x194)[_0x80b7('0x1b')](_0x4c12b1);}else{if(_0x4c12b1[_0x80b7('0x1c')]){delete _0x4c12b1[_0x80b7('0x1c')];}_0x34299c['status'](0x1f4)['send'](_0x4c12b1);}};}function checkError(){return function(_0x2aebe3){if(!_0x2aebe3){throw new RangeError(_0x80b7('0x1d'));}return _0x2aebe3;};}function respondWithRpcPromise(_0xa465d2,_0x3ad8c1){return new BPromise(function(_0x527d0f,_0x18d407){var _0x4c3bed=amiClient;return _0x4c3bed['request'](_0xa465d2,_0x3ad8c1)[_0x80b7('0x1e')](function(_0xdab5e0){if(_0xdab5e0[_0x80b7('0x18')]){if(_0xdab5e0[_0x80b7('0x18')][_0x80b7('0x1f')]===0x1f4){return _0x18d407(_0xdab5e0[_0x80b7('0x18')][_0x80b7('0x20')]);}return _0x527d0f(_0xdab5e0[_0x80b7('0x18')][_0x80b7('0x20')]);}else{_0x527d0f(_0xdab5e0[_0x80b7('0x21')]);}})[_0x80b7('0x22')](function(_0x311aa3){_0x18d407(_0x311aa3);});});}function getAgent(_0x9da9e9){return db[_0x80b7('0x23')][_0x80b7('0x24')]({'where':{'id':_0x9da9e9,'role':'agent'}})[_0x80b7('0x1e')](checkError());}function getAgentCheckSession(_0x1661be,_0x5e3f6f){return new BPromise(function(_0x370bfb,_0x37fda1){var _0x17d845=respondWithRpcPromise('VoiceChannels');var _0x1b7715=getAgent(_0x1661be);Promise[_0x80b7('0x25')]([_0x17d845,_0x1b7715])[_0x80b7('0x1e')](function(_0x30cd74){var _0x1c4607=_0x30cd74[0x0];var _0x399ef1=_0x30cd74[0x1];var _0x1365aa=_[_0x80b7('0x26')](_0x1c4607[_0x80b7('0x27')],function(_0x940c7a){return _0x940c7a[_0x80b7('0x28')]==_0x399ef1['id']&&_0x940c7a[_0x80b7('0x29')]==_0x5e3f6f;});if(_0x1365aa[_0x80b7('0x2a')]==0x1){_0x370bfb(_0x399ef1);}else{_0x37fda1(new RangeError('sessionId\x20'+_0x5e3f6f+'\x20not\x20found!'));}});});}exports[_0x80b7('0x2b')]=function(_0x1ec86c,_0x4fa26a){logger['info'](_0x80b7('0x2c'),_0x1ec86c[_0x80b7('0x2d')]);var _0x1cbe71=originateValidation[_0x80b7('0xc')](_0x1ec86c[_0x80b7('0x2d')]);if(_0x1cbe71[_0x80b7('0x2a')]>0x0){return _0x4fa26a['status'](0x190)[_0x80b7('0x2e')](_0x1cbe71);}var _0x1f9041=_0x1ec86c[_0x80b7('0x2d')][_0x80b7('0x2f')];var _0x52563d=_0x1ec86c[_0x80b7('0x2d')][_0x80b7('0x30')];var _0x5df414=_0x1ec86c[_0x80b7('0x2d')][_0x80b7('0x31')];var _0x18ec95=_0x1ec86c[_0x80b7('0x2d')][_0x80b7('0x32')];return getAgent(_0x1f9041)[_0x80b7('0x1e')](function(_0x3ff3f9){logger[_0x80b7('0x13')]('entityFound:',_0x3ff3f9['name']);emit(util['format'](_0x80b7('0x33'),_0x3ff3f9[_0x80b7('0x1c')]),_0x80b7('0x34'),{'callNumber':_0x52563d,'callerId':_0x5df414,'callbackUrl':_0x18ec95});return _0x4fa26a[_0x80b7('0x1a')](0xc8)[_0x80b7('0x2e')]({'error':![],'message':_0x80b7('0x35')});})[_0x80b7('0x22')](handleError(_0x4fa26a));};exports[_0x80b7('0x36')]=function(_0x485b0a,_0x2a34eb){logger[_0x80b7('0x13')](_0x80b7('0x37'),_0x485b0a[_0x80b7('0x2d')]);var _0x44cfcd=hangupValidation[_0x80b7('0xc')](_0x485b0a['body']);if(_0x44cfcd[_0x80b7('0x2a')]>0x0){return _0x2a34eb['status'](0x190)[_0x80b7('0x2e')](_0x44cfcd);}var _0x1a6e69=_0x485b0a['body']['userId'];var _0x823c32=_0x485b0a['body']['sessionId'];return getAgent(_0x1a6e69)[_0x80b7('0x1e')](function(_0x2f3b26){logger['info'](_0x80b7('0x38'),_0x2f3b26[_0x80b7('0x1c')]);emit(util['format']('user:%s',_0x2f3b26[_0x80b7('0x1c')]),_0x80b7('0x39'),{'sessionId':_0x823c32});return _0x2a34eb[_0x80b7('0x1a')](0xc8)[_0x80b7('0x2e')]({'error':![],'message':_0x80b7('0x3a')});})[_0x80b7('0x22')](handleError(_0x2a34eb));};exports['answer']=function(_0x1c28d2,_0x46f4e9){logger[_0x80b7('0x13')](_0x80b7('0x3b'),_0x1c28d2['body']);var _0x20a9b9=answerValidation['validate'](_0x1c28d2[_0x80b7('0x2d')]);if(_0x20a9b9[_0x80b7('0x2a')]>0x0){return _0x46f4e9[_0x80b7('0x1a')](0x190)[_0x80b7('0x2e')](_0x20a9b9);}var _0x132a0d=_0x1c28d2[_0x80b7('0x2d')][_0x80b7('0x2f')];var _0x39cd2c=_0x1c28d2[_0x80b7('0x2d')][_0x80b7('0x29')];return getAgent(_0x132a0d)[_0x80b7('0x1e')](function(_0x3dfee7){logger[_0x80b7('0x13')]('entityFound:',_0x3dfee7[_0x80b7('0x1c')]);emit(util[_0x80b7('0x3c')]('user:%s',_0x3dfee7[_0x80b7('0x1c')]),'webbar:answer',{'sessionId':_0x39cd2c});return _0x46f4e9['status'](0xc8)[_0x80b7('0x2e')]({'error':![],'message':'answer\x20executed!'});})['catch'](handleError(_0x46f4e9));};exports[_0x80b7('0x3d')]=function(_0x449a90,_0x5ad993){logger[_0x80b7('0x13')](_0x80b7('0x3e'),_0x449a90[_0x80b7('0x2d')]);var _0x5455a5=holdValidation[_0x80b7('0xc')](_0x449a90[_0x80b7('0x2d')]);if(_0x5455a5[_0x80b7('0x2a')]>0x0){return _0x5ad993[_0x80b7('0x1a')](0x190)['json'](_0x5455a5);}var _0x5dcbcd=_0x449a90['body'][_0x80b7('0x2f')];var _0x5c33b5=_0x449a90[_0x80b7('0x2d')][_0x80b7('0x29')];return getAgent(_0x5dcbcd)[_0x80b7('0x1e')](function(_0x44b23d){logger[_0x80b7('0x13')](_0x80b7('0x38'),_0x44b23d['name']);emit(util['format'](_0x80b7('0x33'),_0x44b23d[_0x80b7('0x1c')]),_0x80b7('0x3f'),{'sessionId':_0x5c33b5});return _0x5ad993[_0x80b7('0x1a')](0xc8)[_0x80b7('0x2e')]({'error':![],'message':_0x80b7('0x40')});})['catch'](handleError(_0x5ad993));};exports[_0x80b7('0x41')]=function(_0x36e5a5,_0x47bacb){logger[_0x80b7('0x13')](_0x80b7('0x42'),_0x36e5a5[_0x80b7('0x2d')]);var _0x49ada9=unholdValidation['validate'](_0x36e5a5[_0x80b7('0x2d')]);if(_0x49ada9[_0x80b7('0x2a')]>0x0){return _0x47bacb[_0x80b7('0x1a')](0x190)[_0x80b7('0x2e')](_0x49ada9);}var _0x1b544d=_0x36e5a5[_0x80b7('0x2d')]['userId'];var _0x1b81a2=_0x36e5a5[_0x80b7('0x2d')][_0x80b7('0x29')];return getAgent(_0x1b544d)[_0x80b7('0x1e')](function(_0x2eb688){logger['info']('entityFound:',_0x2eb688[_0x80b7('0x1c')]);emit(util[_0x80b7('0x3c')](_0x80b7('0x33'),_0x2eb688['name']),_0x80b7('0x43'),{'sessionId':_0x1b81a2});return _0x47bacb['status'](0xc8)[_0x80b7('0x2e')]({'error':![],'message':_0x80b7('0x44')});})[_0x80b7('0x22')](handleError(_0x47bacb));};exports[_0x80b7('0x45')]=function(_0x213bd4,_0x3ea23d){logger[_0x80b7('0x13')](_0x80b7('0x46'),_0x3ea23d[_0x80b7('0x2d')]);var _0x4f2588=callsValidation[_0x80b7('0xc')](_0x213bd4[_0x80b7('0x2d')]);if(_0x4f2588[_0x80b7('0x2a')]>0x0){return _0x3ea23d[_0x80b7('0x1a')](0x190)['json'](_0x4f2588);}var _0x42c810=_0x213bd4[_0x80b7('0x2d')][_0x80b7('0x2f')];var _0x41c23c=respondWithRpcPromise(_0x80b7('0x47'));var _0x1c009a=getAgent(_0x42c810);return Promise[_0x80b7('0x25')]([_0x41c23c,_0x1c009a])['then'](function(_0x349e1f){var _0x23f06f=_0x349e1f[0x0];var _0xc4b38=_0x349e1f[0x1];var _0x251b87=_['filter'](_0x23f06f[_0x80b7('0x27')],function(_0x3d7769){return _0x3d7769['UserId']==_0xc4b38['id'];});return _0x3ea23d[_0x80b7('0x1a')](0xc8)[_0x80b7('0x2e')]({'count':_0x251b87['length'],'rows':_0x251b87});})[_0x80b7('0x22')](handleError(_0x3ea23d));};exports[_0x80b7('0x48')]=function(_0x56fd5e,_0x4fe677){logger[_0x80b7('0x13')]('conference\x20fired:',_0x56fd5e[_0x80b7('0x2d')]);var _0x2c2005=conferenceValidation['validate'](_0x56fd5e[_0x80b7('0x2d')]);if(_0x2c2005[_0x80b7('0x2a')]>0x0){return _0x4fe677['status'](0x190)[_0x80b7('0x2e')](_0x2c2005);}var _0x18fe00=_0x56fd5e[_0x80b7('0x2d')][_0x80b7('0x2f')];return getAgent(_0x18fe00)[_0x80b7('0x1e')](function(_0x1b0aba){logger[_0x80b7('0x13')](_0x80b7('0x38'),_0x1b0aba[_0x80b7('0x1c')]);emit(util['format']('user:%s',_0x1b0aba[_0x80b7('0x1c')]),'webbar:conference');return _0x4fe677[_0x80b7('0x1a')](0xc8)[_0x80b7('0x2e')]({'error':![],'message':_0x80b7('0x49')});})['catch'](handleError(_0x4fe677));};exports[_0x80b7('0x4a')]=function(_0x80bf4f,_0x50af8a){logger[_0x80b7('0x13')](_0x80b7('0x4b'),_0x80bf4f[_0x80b7('0x2d')]);var _0x2b6aba=transferValidation['validate'](_0x80bf4f['body']);if(_0x2b6aba[_0x80b7('0x2a')]>0x0){return _0x50af8a[_0x80b7('0x1a')](0x190)[_0x80b7('0x2e')](_0x2b6aba);}var _0x54ec05=_0x80bf4f['body'][_0x80b7('0x2f')];var _0x27452c=_0x80bf4f[_0x80b7('0x2d')]['sessionId'];var _0x33b76f=_0x80bf4f[_0x80b7('0x2d')][_0x80b7('0x4c')];return getAgent(_0x54ec05)[_0x80b7('0x1e')](function(_0x55eba7){logger['info'](_0x80b7('0x38'),_0x55eba7[_0x80b7('0x1c')]);emit(util['format']('user:%s',_0x55eba7['name']),'webbar:transfer',{'sessionId':_0x27452c,'transferNumber':_0x33b76f});return _0x50af8a[_0x80b7('0x1a')](0xc8)['json']({'error':![],'message':'transfer\x20executed!'});})[_0x80b7('0x22')](handleError(_0x50af8a));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index d2d4eeb..4443f92 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 _0x9582=['destroy','delete','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addApplications','/:id/notify','/:id/send','put'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9582,0x95));var _0x2958=function(_0x5e057e,_0x1635d7){_0x5e057e=_0x5e057e-0x0;var _0x5df464=_0x9582[_0x5e057e];return _0x5df464;};'use strict';var multer=require(_0x2958('0x0'));var util=require(_0x2958('0x1'));var path=require(_0x2958('0x2'));var timeout=require(_0x2958('0x3'));var express=require(_0x2958('0x4'));var router=express[_0x2958('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2958('0x6'));var interaction=require(_0x2958('0x7'));var config=require(_0x2958('0x8'));var controller=require(_0x2958('0x9'));router[_0x2958('0xa')]('/',auth[_0x2958('0xb')](),controller[_0x2958('0xc')]);router[_0x2958('0xa')](_0x2958('0xd'),auth[_0x2958('0xb')](),controller['describe']);router['get'](_0x2958('0xe'),auth['isAuthenticated'](),controller[_0x2958('0xf')]);router['get'](_0x2958('0x10'),auth['isAuthenticated'](),controller[_0x2958('0x11')]);router[_0x2958('0xa')](_0x2958('0x12'),auth[_0x2958('0xb')](),controller[_0x2958('0x13')]);router['get'](_0x2958('0x14'),auth[_0x2958('0xb')](),controller[_0x2958('0x15')]);router[_0x2958('0xa')](_0x2958('0x16'),auth[_0x2958('0xb')](),controller[_0x2958('0x17')]);router[_0x2958('0x18')]('/',auth['isAuthenticated'](),controller[_0x2958('0x19')]);router[_0x2958('0x18')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x2958('0x1a')]);router[_0x2958('0x18')]('/:id/canned_answers',auth[_0x2958('0xb')](),controller['addAnswer']);router['post'](_0x2958('0x14'),auth[_0x2958('0xb')](),controller['addAgents']);router['post'](_0x2958('0x16'),auth[_0x2958('0xb')](),controller[_0x2958('0x1b')]);router[_0x2958('0x18')](_0x2958('0x1c'),controller['notify']);router[_0x2958('0x18')](_0x2958('0x1d'),auth[_0x2958('0xb')](),controller['send']);router[_0x2958('0x1e')]('/:id',auth[_0x2958('0xb')](),controller['update']);router['delete'](_0x2958('0xe'),auth[_0x2958('0xb')](),controller[_0x2958('0x1f')]);router[_0x2958('0x20')](_0x2958('0x10'),auth[_0x2958('0xb')](),controller[_0x2958('0x21')]);router[_0x2958('0x20')](_0x2958('0x12'),auth[_0x2958('0xb')](),controller[_0x2958('0x22')]);router[_0x2958('0x20')](_0x2958('0x14'),auth[_0x2958('0xb')](),controller[_0x2958('0x23')]);module['exports']=router; \ No newline at end of file +var _0xba34=['getDispositions','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','/:id/canned_answers','addAnswer','addAgents','/:id/notify','notify','/:id/send','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions'];(function(_0x5d4d43,_0x3a83c5){var _0x41feda=function(_0x410331){while(--_0x410331){_0x5d4d43['push'](_0x5d4d43['shift']());}};_0x41feda(++_0x3a83c5);}(_0xba34,0x119));var _0x4ba3=function(_0x1b6e7a,_0x44de32){_0x1b6e7a=_0x1b6e7a-0x0;var _0x40bcbd=_0xba34[_0x1b6e7a];return _0x40bcbd;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var controller=require(_0x4ba3('0x7'));router[_0x4ba3('0x8')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xa')]);router[_0x4ba3('0x8')]('/describe',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0x8')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0x8')](_0x4ba3('0xe'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x8')]('/:id/canned_answers',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x10')]);router['get'](_0x4ba3('0x11'),auth['isAuthenticated'](),controller[_0x4ba3('0x12')]);router['get'](_0x4ba3('0x13'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x14')]);router[_0x4ba3('0x15')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x16')]);router[_0x4ba3('0x15')](_0x4ba3('0xe'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x17')]);router[_0x4ba3('0x15')](_0x4ba3('0x18'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x19')]);router[_0x4ba3('0x15')](_0x4ba3('0x11'),auth['isAuthenticated'](),controller[_0x4ba3('0x1a')]);router[_0x4ba3('0x15')](_0x4ba3('0x13'),auth[_0x4ba3('0x9')](),controller['addApplications']);router[_0x4ba3('0x15')](_0x4ba3('0x1b'),controller[_0x4ba3('0x1c')]);router[_0x4ba3('0x15')](_0x4ba3('0x1d'),auth[_0x4ba3('0x9')](),controller['send']);router['put'](_0x4ba3('0xc'),auth['isAuthenticated'](),controller[_0x4ba3('0x1e')]);router[_0x4ba3('0x1f')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x20')]);router[_0x4ba3('0x1f')]('/:id/dispositions',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x21')]);router['delete'](_0x4ba3('0x18'),auth['isAuthenticated'](),controller[_0x4ba3('0x22')]);router[_0x4ba3('0x1f')](_0x4ba3('0x11'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x23')]);module[_0x4ba3('0x24')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 9fde1e1..70189b4 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 _0x1c3b=['randomstring','exports','STRING','name','generate','ENUM','twilio','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize'];(function(_0x54e92d,_0x45aa33){var _0xc7edb6=function(_0x8c5834){while(--_0x8c5834){_0x54e92d['push'](_0x54e92d['shift']());}};_0xc7edb6(++_0x45aa33);}(_0x1c3b,0x77));var _0xb1c3=function(_0xb64c20,_0x419f51){_0xb64c20=_0xb64c20-0x0;var _0x53b1f5=_0x1c3b[_0xb64c20];return _0x53b1f5;};'use strict';var Sequelize=require(_0xb1c3('0x0'));var rs=require(_0xb1c3('0x1'));module[_0xb1c3('0x2')]={'name':{'type':Sequelize[_0xb1c3('0x3')],'unique':_0xb1c3('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xb1c3('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xb1c3('0x5')]();}},'phone':{'type':Sequelize[_0xb1c3('0x3')]},'type':{'type':Sequelize[_0xb1c3('0x6')](_0xb1c3('0x7'))},'accountSid':{'type':Sequelize[_0xb1c3('0x3')]},'authToken':{'type':Sequelize[_0xb1c3('0x3')]},'notificationTemplate':{'type':Sequelize[_0xb1c3('0x8')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xb1c3('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb1c3('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb1c3('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb1c3('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb1c3('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb1c3('0xa')],'comment':_0xb1c3('0xb')},'mandatoryDisposition':{'type':Sequelize[_0xb1c3('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4d3269){if(!_0x4d3269){this['setDataValue'](_0xb1c3('0xc'),null);}this[_0xb1c3('0xd')](_0xb1c3('0xe'),_0x4d3269);}},'description':{'type':Sequelize[_0xb1c3('0x3')]}}; \ No newline at end of file +var _0x2f40=['setDataValue','mandatoryDisposition','sequelize','randomstring','STRING','name','generate','ENUM','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'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x2f40,0x17b));var _0x02f4=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x2f40[_0xc6be3a];return _0x56a310;};'use strict';var Sequelize=require(_0x02f4('0x0'));var rs=require(_0x02f4('0x1'));module['exports']={'name':{'type':Sequelize[_0x02f4('0x2')],'unique':_0x02f4('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x02f4('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x02f4('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x02f4('0x2')],'defaultValue':function(){return rs[_0x02f4('0x4')]();}},'phone':{'type':Sequelize[_0x02f4('0x2')]},'type':{'type':Sequelize[_0x02f4('0x5')]('twilio')},'accountSid':{'type':Sequelize[_0x02f4('0x2')]},'authToken':{'type':Sequelize[_0x02f4('0x2')]},'notificationTemplate':{'type':Sequelize[_0x02f4('0x6')],'defaultValue':function(){return _0x02f4('0x7');}},'notificationSound':{'type':Sequelize[_0x02f4('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x02f4('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x02f4('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x02f4('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x02f4('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x02f4('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x02f4('0x9')],'comment':_0x02f4('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2125ba){if(!_0x2125ba){this['setDataValue']('mandatoryDispositionPauseId',null);}this[_0x02f4('0xb')](_0x02f4('0xc'),_0x2125ba);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index d04f608..fc09182 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 _0x28a6=['stringify','Content-Type','text/xml','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','Messages','dataValues','push','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','http','request','info','WhatsappAccount,\x20%s,\x20%s','debug','error','code','message','request\x20sent','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','get','WhatsappAccounts','name','send','index','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','include','findAll','rows','show','params','Pause','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','describe','addDisposition','WhatsappAccountId','Disposition','findOne','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','priority','getApplications','whatsapp','account','applications','orderBy','Applications','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','mobile','twilio','from','From','replace','Body','ValidationError','from\x20is\x20mandatory','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','Contacts','updatedAt','DESC','list','contact','WhatsappInteraction','interaction','autoclose','unmanaged','*,*,*,*','created','WhatsappMessage','messageId','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found'];(function(_0x36f1cd,_0xea4aec){var _0x707c40=function(_0xbe075c){while(--_0xbe075c){_0x36f1cd['push'](_0x36f1cd['shift']());}};_0x707c40(++_0xea4aec);}(_0x28a6,0xc8));var _0x628a=function(_0x356127,_0x4873ac){_0x356127=_0x356127-0x0;var _0x5d4c75=_0x28a6[_0x356127];return _0x5d4c75;};'use strict';var emlformat=require(_0x628a('0x0'));var rimraf=require(_0x628a('0x1'));var zipdir=require(_0x628a('0x2'));var jsonpatch=require(_0x628a('0x3'));var rp=require('request-promise');var moment=require(_0x628a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x628a('0x5'));var util=require(_0x628a('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x628a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x628a('0x8'));var squel=require(_0x628a('0x9'));var crypto=require(_0x628a('0xa'));var jsforce=require(_0x628a('0xb'));var deskjs=require(_0x628a('0xc'));var toCsv=require('to-csv');var querystring=require(_0x628a('0xd'));var Papa=require(_0x628a('0xe'));var Redis=require('ioredis');var authService=require(_0x628a('0xf'));var qs=require(_0x628a('0x10'));var as=require(_0x628a('0x11'));var hardwareService=require(_0x628a('0x12'));var logger=require(_0x628a('0x13'))('api');var utils=require(_0x628a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x628a('0x15'));var db=require(_0x628a('0x16'))['db'];config['redis']=_[_0x628a('0x17')](config[_0x628a('0x18')],{'host':_0x628a('0x19'),'port':0x18eb});var socket=require(_0x628a('0x1a'))(new Redis(config[_0x628a('0x18')]));require(_0x628a('0x1b'))['register'](socket);var jayson=require(_0x628a('0x1c'));var client=jayson['client'][_0x628a('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x4e124a,_0x165424,_0x179484,_0x2e3db3){return new BPromise(function(_0x51e729,_0x295be5){var _0x1d1260=_0x2e3db3||client;return _0x1d1260[_0x628a('0x1e')](_0x4e124a,_0x179484)['then'](function(_0x2ade59){logger[_0x628a('0x1f')](_0x628a('0x20'),_0x165424,'request\x20sent');logger[_0x628a('0x21')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x165424,'request\x20sent',JSON['stringify'](_0x2ade59));if(_0x2ade59[_0x628a('0x22')]){if(_0x2ade59[_0x628a('0x22')][_0x628a('0x23')]===0x1f4){logger[_0x628a('0x22')](_0x628a('0x20'),_0x165424,_0x2ade59[_0x628a('0x22')][_0x628a('0x24')]);return _0x295be5(_0x2ade59['error'][_0x628a('0x24')]);}logger['error'](_0x628a('0x20'),_0x165424,_0x2ade59[_0x628a('0x22')][_0x628a('0x24')]);return _0x51e729(_0x2ade59[_0x628a('0x22')][_0x628a('0x24')]);}else{logger['info'](_0x628a('0x20'),_0x165424,_0x628a('0x25'));_0x51e729(_0x2ade59['result'][_0x628a('0x24')]);}})[_0x628a('0x26')](function(_0x511c72){logger[_0x628a('0x22')](_0x628a('0x20'),_0x165424,_0x511c72);_0x295be5(_0x511c72);});});}function respondWithStatusCode(_0xbe9cd6,_0x22cfd9){_0x22cfd9=_0x22cfd9||0xcc;return function(_0x234de8){if(_0x234de8){return _0xbe9cd6[_0x628a('0x27')](_0x22cfd9);}return _0xbe9cd6[_0x628a('0x28')](_0x22cfd9)['end']();};}function respondWithResult(_0x1db8f4,_0x53abcb){_0x53abcb=_0x53abcb||0xc8;return function(_0x372485){if(_0x372485){return _0x1db8f4[_0x628a('0x28')](_0x53abcb)[_0x628a('0x29')](_0x372485);}};}function respondWithFilteredResult(_0x51ca65,_0x2e2119){return function(_0x366362){if(_0x366362){var _0x3e8ffe=typeof _0x2e2119['offset']===_0x628a('0x2a')&&typeof _0x2e2119[_0x628a('0x2b')]===_0x628a('0x2a');var _0x4ef424=_0x366362[_0x628a('0x2c')];var _0x51e17c=_0x3e8ffe?0x0:_0x2e2119[_0x628a('0x2d')];var _0x4c0394=_0x3e8ffe?_0x366362['count']:_0x2e2119[_0x628a('0x2d')]+_0x2e2119[_0x628a('0x2b')];var _0x17c3ae;if(_0x4c0394>=_0x4ef424){_0x4c0394=_0x4ef424;_0x17c3ae=0xc8;}else{_0x17c3ae=0xce;}_0x51ca65['status'](_0x17c3ae);return _0x51ca65[_0x628a('0x2e')](_0x628a('0x2f'),_0x51e17c+'-'+_0x4c0394+'/'+_0x4ef424)['json'](_0x366362);}return null;};}function patchUpdates(_0x16f215){return function(_0x1b0e85){try{jsonpatch[_0x628a('0x30')](_0x1b0e85,_0x16f215,!![]);}catch(_0x84807c){return BPromise[_0x628a('0x31')](_0x84807c);}return _0x1b0e85[_0x628a('0x32')]();};}function saveUpdates(_0x3b0929,_0x5eb6a7){return function(_0x344860){if(_0x344860){return _0x344860[_0x628a('0x33')](_0x3b0929)['then'](function(_0x21e0c2){return _0x21e0c2;});}return null;};}function removeEntity(_0x746be5,_0x46dc91){return function(_0x4facaa){if(_0x4facaa){return _0x4facaa[_0x628a('0x34')]()[_0x628a('0x35')](function(){var _0x2030bc=_0x4facaa[_0x628a('0x36')]({'plain':!![]});var _0x459074=_0x628a('0x37');return db['UserProfileResource']['destroy']({'where':{'type':_0x459074,'resourceId':_0x2030bc['id']}})['then'](function(){return _0x4facaa;});})['then'](function(){_0x746be5[_0x628a('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d325a,_0x12f320){return function(_0x2272fa){if(!_0x2272fa){_0x5d325a[_0x628a('0x27')](0x194);}return _0x2272fa;};}function handleError(_0x4ee15f,_0x278383){_0x278383=_0x278383||0x1f4;return function(_0x559cd5){logger['error'](_0x559cd5['stack']);if(_0x559cd5[_0x628a('0x38')]){delete _0x559cd5[_0x628a('0x38')];}_0x4ee15f[_0x628a('0x28')](_0x278383)[_0x628a('0x39')](_0x559cd5);};}exports[_0x628a('0x3a')]=function(_0x584665,_0x18cdac){var _0x4d0b47={'include':[{'model':db['Pause'],'as':_0x628a('0x3b')}]},_0x5718d9={},_0x1db8ad={'count':0x0,'rows':[]};var _0x83e7d8=_[_0x628a('0x3c')](db[_0x628a('0x3d')][_0x628a('0x3e')],function(_0x2ffed5){return{'name':_0x2ffed5[_0x628a('0x3f')],'type':_0x2ffed5[_0x628a('0x40')][_0x628a('0x41')]};});_0x5718d9[_0x628a('0x42')]=_[_0x628a('0x3c')](_0x83e7d8,'name');_0x5718d9[_0x628a('0x43')]=_[_0x628a('0x44')](_0x584665[_0x628a('0x43')]);_0x5718d9[_0x628a('0x45')]=_[_0x628a('0x46')](_0x5718d9[_0x628a('0x42')],_0x5718d9['query']);_0x4d0b47[_0x628a('0x47')]=_['intersection'](_0x5718d9[_0x628a('0x42')],qs[_0x628a('0x48')](_0x584665[_0x628a('0x43')][_0x628a('0x48')]));_0x4d0b47[_0x628a('0x47')]=_0x4d0b47['attributes'][_0x628a('0x49')]?_0x4d0b47['attributes']:_0x5718d9[_0x628a('0x42')];if(!_0x584665[_0x628a('0x43')][_0x628a('0x4a')]('nolimit')){_0x4d0b47[_0x628a('0x2b')]=qs[_0x628a('0x2b')](_0x584665['query'][_0x628a('0x2b')]);_0x4d0b47[_0x628a('0x2d')]=qs['offset'](_0x584665[_0x628a('0x43')][_0x628a('0x2d')]);}_0x4d0b47[_0x628a('0x4b')]=qs[_0x628a('0x4c')](_0x584665[_0x628a('0x43')]['sort']);_0x4d0b47['where']=qs[_0x628a('0x45')](_[_0x628a('0x4d')](_0x584665[_0x628a('0x43')],_0x5718d9[_0x628a('0x45')]),_0x83e7d8);if(_0x584665[_0x628a('0x43')][_0x628a('0x4e')]){_0x4d0b47[_0x628a('0x4f')]=_[_0x628a('0x50')](_0x4d0b47[_0x628a('0x4f')],{'$or':_[_0x628a('0x3c')](_0x83e7d8,function(_0x42b584){if(_0x42b584[_0x628a('0x40')]!==_0x628a('0x51')){var _0xd3c055={};_0xd3c055[_0x42b584[_0x628a('0x38')]]={'$like':'%'+_0x584665[_0x628a('0x43')]['filter']+'%'};return _0xd3c055;}})});}_0x4d0b47=_[_0x628a('0x50')]({},_0x4d0b47,_0x584665['options']);var _0x3e7a58={'where':_0x4d0b47['where']};return db[_0x628a('0x3d')][_0x628a('0x2c')](_0x3e7a58)[_0x628a('0x35')](function(_0xfaf4c0){_0x1db8ad[_0x628a('0x2c')]=_0xfaf4c0;if(_0x584665['query']['includeAll']){_0x4d0b47[_0x628a('0x52')]=[{'all':!![]}];}return db[_0x628a('0x3d')][_0x628a('0x53')](_0x4d0b47);})['then'](function(_0x81a4f8){_0x1db8ad[_0x628a('0x54')]=_0x81a4f8;return _0x1db8ad;})['then'](respondWithFilteredResult(_0x18cdac,_0x4d0b47))['catch'](handleError(_0x18cdac,null));};exports[_0x628a('0x55')]=function(_0x43943d,_0x59a1ea){var _0x4be7be={'raw':![],'where':{'id':_0x43943d[_0x628a('0x56')]['id']},'include':[{'model':db[_0x628a('0x57')],'as':_0x628a('0x3b')}]},_0x20aa29={};_0x20aa29[_0x628a('0x42')]=_[_0x628a('0x44')](db[_0x628a('0x3d')][_0x628a('0x3e')]);_0x20aa29[_0x628a('0x43')]=_[_0x628a('0x44')](_0x43943d[_0x628a('0x43')]);_0x20aa29[_0x628a('0x45')]=_[_0x628a('0x46')](_0x20aa29[_0x628a('0x42')],_0x20aa29[_0x628a('0x43')]);_0x4be7be[_0x628a('0x47')]=_[_0x628a('0x46')](_0x20aa29[_0x628a('0x42')],qs['fields'](_0x43943d['query'][_0x628a('0x48')]));_0x4be7be[_0x628a('0x47')]=_0x4be7be['attributes'][_0x628a('0x49')]?_0x4be7be[_0x628a('0x47')]:_0x20aa29['model'];if(_0x43943d[_0x628a('0x43')][_0x628a('0x58')]){_0x4be7be[_0x628a('0x52')]=[{'all':!![]}];}_0x4be7be=_[_0x628a('0x50')]({},_0x4be7be,_0x43943d[_0x628a('0x59')]);return db[_0x628a('0x3d')][_0x628a('0x5a')](_0x4be7be)['then'](handleEntityNotFound(_0x59a1ea,null))[_0x628a('0x35')](respondWithResult(_0x59a1ea,null))[_0x628a('0x26')](handleError(_0x59a1ea,null));};exports['create']=function(_0x212e95,_0x1873e0){return db['WhatsappAccount'][_0x628a('0x5b')](_0x212e95[_0x628a('0x5c')],{})[_0x628a('0x35')](function(_0x485555){var _0x4c7b4d=_0x212e95[_0x628a('0x5d')]['get']({'plain':!![]});if(!_0x4c7b4d)throw new Error(_0x628a('0x5e'));if(_0x4c7b4d[_0x628a('0x5f')]==='user'){var _0x17a47e=_0x485555[_0x628a('0x36')]({'plain':!![]});var _0x277731=_0x628a('0x37');return db[_0x628a('0x60')][_0x628a('0x5a')]({'where':{'name':_0x277731,'userProfileId':_0x4c7b4d[_0x628a('0x61')]},'raw':!![]})[_0x628a('0x35')](function(_0x165b99){if(_0x165b99&&_0x165b99['autoAssociation']===0x0){return db[_0x628a('0x62')][_0x628a('0x5b')]({'name':_0x17a47e[_0x628a('0x38')],'resourceId':_0x17a47e['id'],'type':_0x165b99['name'],'sectionId':_0x165b99['id']},{})[_0x628a('0x35')](function(){return _0x485555;});}else{return _0x485555;}})[_0x628a('0x26')](function(_0x276a28){logger[_0x628a('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x276a28);throw _0x276a28;});}return _0x485555;})[_0x628a('0x35')](respondWithResult(_0x1873e0,0xc9))[_0x628a('0x26')](handleError(_0x1873e0,null));};exports[_0x628a('0x33')]=function(_0x47d39a,_0x38abe5){if(_0x47d39a['body']['id']){delete _0x47d39a[_0x628a('0x5c')]['id'];}return db[_0x628a('0x3d')][_0x628a('0x5a')]({'where':{'id':_0x47d39a[_0x628a('0x56')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x628a('0x35')](handleEntityNotFound(_0x38abe5,null))[_0x628a('0x35')](saveUpdates(_0x47d39a[_0x628a('0x5c')],null))[_0x628a('0x35')](respondWithResult(_0x38abe5,null))[_0x628a('0x26')](handleError(_0x38abe5,null));};exports[_0x628a('0x34')]=function(_0x2d6354,_0x27b73c){return db['WhatsappAccount'][_0x628a('0x5a')]({'where':{'id':_0x2d6354[_0x628a('0x56')]['id']}})[_0x628a('0x35')](handleEntityNotFound(_0x27b73c,null))[_0x628a('0x35')](removeEntity(_0x27b73c,null))[_0x628a('0x26')](handleError(_0x27b73c,null));};exports[_0x628a('0x63')]=function(_0x2d1e9c,_0x46ec93){return db[_0x628a('0x3d')][_0x628a('0x63')]()[_0x628a('0x35')](respondWithResult(_0x46ec93,null))[_0x628a('0x26')](handleError(_0x46ec93,null));};exports[_0x628a('0x64')]=function(_0x2bed84,_0x5ea26f,_0x534817){if(_0x2bed84[_0x628a('0x5c')]['id']){delete _0x2bed84[_0x628a('0x5c')]['id'];}return db[_0x628a('0x3d')][_0x628a('0x5a')]({'where':{'id':_0x2bed84['params']['id']}})[_0x628a('0x35')](handleEntityNotFound(_0x5ea26f,null))[_0x628a('0x35')](function(_0x26fa20){if(_0x26fa20){_0x2bed84[_0x628a('0x5c')][_0x628a('0x65')]=_0x26fa20['id'];return db[_0x628a('0x66')][_0x628a('0x5b')](_0x2bed84[_0x628a('0x5c')]);}})[_0x628a('0x35')](respondWithResult(_0x5ea26f,null))[_0x628a('0x26')](handleError(_0x5ea26f,null));};exports['getDispositions']=function(_0x48c69e,_0xc35ba0,_0x599285){var _0x9ad941={'raw':![],'where':{}};var _0x541eef={};var _0x369584={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x628a('0x67')]({'where':{'id':_0x48c69e[_0x628a('0x56')]['id']}})[_0x628a('0x35')](handleEntityNotFound(_0xc35ba0,null))[_0x628a('0x35')](function(_0x45e76d){if(_0x45e76d){_0x541eef[_0x628a('0x42')]=_['keys'](db[_0x628a('0x66')]['rawAttributes']);_0x541eef['query']=_['keys'](_0x48c69e[_0x628a('0x43')]);_0x541eef[_0x628a('0x45')]=_[_0x628a('0x46')](_0x541eef[_0x628a('0x42')],_0x541eef[_0x628a('0x43')]);_0x9ad941[_0x628a('0x47')]=_['intersection'](_0x541eef['model'],qs[_0x628a('0x48')](_0x48c69e[_0x628a('0x43')][_0x628a('0x48')]));_0x9ad941[_0x628a('0x47')]=_0x9ad941[_0x628a('0x47')]['length']?_0x9ad941[_0x628a('0x47')]:_0x541eef[_0x628a('0x42')];if(!_0x48c69e['query'][_0x628a('0x4a')](_0x628a('0x68'))){_0x9ad941[_0x628a('0x2b')]=qs[_0x628a('0x2b')](_0x48c69e[_0x628a('0x43')]['limit']);_0x9ad941['offset']=qs[_0x628a('0x2d')](_0x48c69e[_0x628a('0x43')][_0x628a('0x2d')]);}_0x9ad941[_0x628a('0x4b')]=qs[_0x628a('0x4c')](_0x48c69e[_0x628a('0x43')]['sort']);_0x9ad941[_0x628a('0x4f')]=qs[_0x628a('0x45')](_['pick'](_0x48c69e[_0x628a('0x43')],_0x541eef[_0x628a('0x45')]));_0x9ad941[_0x628a('0x4f')][_0x628a('0x65')]=_0x45e76d['id'];if(_0x48c69e['query'][_0x628a('0x4e')]){_0x9ad941[_0x628a('0x4f')]=_[_0x628a('0x50')](_0x9ad941[_0x628a('0x4f')],{'$or':_['map'](_0x9ad941['attributes'],function(_0x289f52){var _0x551cd0={};_0x551cd0[_0x289f52]={'$like':'%'+_0x48c69e[_0x628a('0x43')][_0x628a('0x4e')]+'%'};return _0x551cd0;})});}_0x9ad941=_[_0x628a('0x50')]({},_0x9ad941,_0x48c69e[_0x628a('0x59')]);return db[_0x628a('0x66')][_0x628a('0x2c')]({'where':_0x9ad941[_0x628a('0x4f')]})[_0x628a('0x35')](function(_0x583960){_0x369584[_0x628a('0x2c')]=_0x583960;if(_0x48c69e[_0x628a('0x43')][_0x628a('0x58')]){_0x9ad941[_0x628a('0x52')]=[{'all':!![]}];}return db[_0x628a('0x66')][_0x628a('0x53')](_0x9ad941);})[_0x628a('0x35')](function(_0x1bb9af){_0x369584[_0x628a('0x54')]=_0x1bb9af;return _0x369584;});}})['then'](respondWithFilteredResult(_0xc35ba0,_0x9ad941))['catch'](handleError(_0xc35ba0,null));};exports['removeDispositions']=function(_0x2668d9,_0x34b5ce,_0x3b1647){return db[_0x628a('0x3d')][_0x628a('0x5a')]({'where':{'id':_0x2668d9[_0x628a('0x56')]['id']}})['then'](handleEntityNotFound(_0x34b5ce,null))[_0x628a('0x35')](function(_0x12eb17){if(_0x12eb17){return _0x12eb17[_0x628a('0x69')](_0x2668d9[_0x628a('0x43')][_0x628a('0x6a')]);}})[_0x628a('0x35')](respondWithStatusCode(_0x34b5ce,null))[_0x628a('0x26')](handleError(_0x34b5ce,null));};exports[_0x628a('0x6b')]=function(_0x352cb3,_0x59d37b,_0x4ebce8){if(_0x352cb3[_0x628a('0x5c')]['id']){delete _0x352cb3[_0x628a('0x5c')]['id'];}return db[_0x628a('0x3d')][_0x628a('0x5a')]({'where':{'id':_0x352cb3['params']['id']}})[_0x628a('0x35')](handleEntityNotFound(_0x59d37b,null))[_0x628a('0x35')](function(_0x3e5add){if(_0x3e5add){_0x352cb3['body'][_0x628a('0x65')]=_0x3e5add['id'];return db['CannedAnswer'][_0x628a('0x5b')](_0x352cb3[_0x628a('0x5c')]);}})[_0x628a('0x35')](respondWithResult(_0x59d37b,null))[_0x628a('0x26')](handleError(_0x59d37b,null));};exports['getAnswers']=function(_0x5cd972,_0x39ca2c,_0x571021){var _0x4ed9fc={'raw':![],'where':{}};var _0x4bcc30={};var _0x39ac72={'count':0x0,'rows':[]};return db[_0x628a('0x3d')]['findOne']({'where':{'id':_0x5cd972[_0x628a('0x56')]['id']}})['then'](handleEntityNotFound(_0x39ca2c,null))[_0x628a('0x35')](function(_0x2fd98d){if(_0x2fd98d){_0x4bcc30[_0x628a('0x42')]=_[_0x628a('0x44')](db['CannedAnswer']['rawAttributes']);_0x4bcc30[_0x628a('0x43')]=_[_0x628a('0x44')](_0x5cd972['query']);_0x4bcc30[_0x628a('0x45')]=_[_0x628a('0x46')](_0x4bcc30[_0x628a('0x42')],_0x4bcc30[_0x628a('0x43')]);_0x4ed9fc['attributes']=_[_0x628a('0x46')](_0x4bcc30[_0x628a('0x42')],qs['fields'](_0x5cd972[_0x628a('0x43')][_0x628a('0x48')]));_0x4ed9fc['attributes']=_0x4ed9fc['attributes'][_0x628a('0x49')]?_0x4ed9fc['attributes']:_0x4bcc30[_0x628a('0x42')];if(!_0x5cd972[_0x628a('0x43')][_0x628a('0x4a')]('nolimit')){_0x4ed9fc[_0x628a('0x2b')]=qs[_0x628a('0x2b')](_0x5cd972[_0x628a('0x43')][_0x628a('0x2b')]);_0x4ed9fc[_0x628a('0x2d')]=qs[_0x628a('0x2d')](_0x5cd972[_0x628a('0x43')][_0x628a('0x2d')]);}_0x4ed9fc[_0x628a('0x4b')]=qs[_0x628a('0x4c')](_0x5cd972['query']['sort']);_0x4ed9fc[_0x628a('0x4f')]=qs[_0x628a('0x45')](_['pick'](_0x5cd972[_0x628a('0x43')],_0x4bcc30[_0x628a('0x45')]));_0x4ed9fc[_0x628a('0x4f')]['WhatsappAccountId']=_0x2fd98d['id'];if(_0x5cd972[_0x628a('0x43')][_0x628a('0x4e')]){_0x4ed9fc['where']=_[_0x628a('0x50')](_0x4ed9fc[_0x628a('0x4f')],{'$or':_[_0x628a('0x3c')](_0x4ed9fc[_0x628a('0x47')],function(_0x31bacf){var _0x76e748={};_0x76e748[_0x31bacf]={'$like':'%'+_0x5cd972[_0x628a('0x43')][_0x628a('0x4e')]+'%'};return _0x76e748;})});}_0x4ed9fc=_[_0x628a('0x50')]({},_0x4ed9fc,_0x5cd972[_0x628a('0x59')]);return db[_0x628a('0x6c')][_0x628a('0x2c')]({'where':_0x4ed9fc[_0x628a('0x4f')]})[_0x628a('0x35')](function(_0xd38414){_0x39ac72['count']=_0xd38414;if(_0x5cd972[_0x628a('0x43')][_0x628a('0x58')]){_0x4ed9fc[_0x628a('0x52')]=[{'all':!![]}];}return db[_0x628a('0x6c')]['findAll'](_0x4ed9fc);})['then'](function(_0x4be7df){_0x39ac72[_0x628a('0x54')]=_0x4be7df;return _0x39ac72;});}})[_0x628a('0x35')](respondWithFilteredResult(_0x39ca2c,_0x4ed9fc))['catch'](handleError(_0x39ca2c,null));};exports[_0x628a('0x6d')]=function(_0x555545,_0x1df7f9,_0x505798){return db[_0x628a('0x3d')][_0x628a('0x5a')]({'where':{'id':_0x555545[_0x628a('0x56')]['id']}})[_0x628a('0x35')](handleEntityNotFound(_0x1df7f9,null))[_0x628a('0x35')](function(_0x15d6e0){if(_0x15d6e0){return _0x15d6e0[_0x628a('0x6d')](_0x555545[_0x628a('0x43')]['ids']);}})['then'](respondWithStatusCode(_0x1df7f9,null))[_0x628a('0x26')](handleError(_0x1df7f9,null));};exports[_0x628a('0x6e')]=function(_0x4c66c0,_0x4110be,_0x178e06){return db[_0x628a('0x3d')][_0x628a('0x5a')]({'where':{'id':_0x4c66c0[_0x628a('0x56')]['id']}})[_0x628a('0x35')](handleEntityNotFound(_0x4110be,null))[_0x628a('0x35')](function(_0x259c66){if(_0x259c66){return _0x259c66[_0x628a('0x6e')](_0x4c66c0[_0x628a('0x5c')][_0x628a('0x6a')],_[_0x628a('0x6f')](_0x4c66c0[_0x628a('0x5c')],[_0x628a('0x6a'),'id'])||{})[_0x628a('0x70')](function(_0x30d3b6){for(var _0x214850=0x0;_0x214850<_0x4c66c0['body'][_0x628a('0x6a')]['length'];_0x214850+=0x1){socket[_0x628a('0x71')](_0x628a('0x72'),{'UserId':Number(_0x4c66c0['body'][_0x628a('0x6a')][_0x214850]),'WhatsappAccountId':Number(_0x4c66c0[_0x628a('0x56')]['id'])});}return _0x30d3b6;});}})[_0x628a('0x35')](respondWithResult(_0x4110be,null))[_0x628a('0x26')](handleError(_0x4110be,null));};exports[_0x628a('0x73')]=function(_0x323e69,_0x1a05bb,_0x5f2c10){return db[_0x628a('0x3d')]['find']({'where':{'id':_0x323e69[_0x628a('0x56')]['id']}})[_0x628a('0x35')](handleEntityNotFound(_0x1a05bb,null))[_0x628a('0x35')](function(_0x4fc04b){if(_0x4fc04b){return _0x4fc04b[_0x628a('0x73')](_0x323e69[_0x628a('0x43')][_0x628a('0x6a')])[_0x628a('0x35')](function(){if(_[_0x628a('0x74')](_0x323e69['query']['ids'])){for(var _0x132498=0x0;_0x132498<_0x323e69[_0x628a('0x43')][_0x628a('0x6a')][_0x628a('0x49')];_0x132498+=0x1){socket[_0x628a('0x71')]('userWhatsappAccount:remove',{'UserId':Number(_0x323e69[_0x628a('0x43')]['ids'][_0x132498]),'WhatsappAccountId':Number(_0x323e69[_0x628a('0x56')]['id'])});}}else{socket['emit'](_0x628a('0x75'),{'UserId':Number(_0x323e69[_0x628a('0x43')][_0x628a('0x6a')]),'WhatsappAccountId':Number(_0x323e69[_0x628a('0x56')]['id'])});}});}})[_0x628a('0x35')](respondWithStatusCode(_0x1a05bb,null))[_0x628a('0x26')](handleError(_0x1a05bb,null));};exports[_0x628a('0x76')]=function(_0x5d9991,_0x51c061,_0x3547d2){var _0x56c134={};var _0x152981={};var _0x597876;var _0x4c02a2;return db[_0x628a('0x3d')]['findOne']({'where':{'id':_0x5d9991['params']['id']}})[_0x628a('0x35')](handleEntityNotFound(_0x51c061,null))[_0x628a('0x35')](function(_0x4a46c3){if(_0x4a46c3){_0x597876=_0x4a46c3;_0x152981['model']=_['keys'](db[_0x628a('0x77')][_0x628a('0x3e')]);_0x152981[_0x628a('0x43')]=_[_0x628a('0x44')](_0x5d9991[_0x628a('0x43')]);_0x152981['filters']=_[_0x628a('0x46')](_0x152981[_0x628a('0x42')],_0x152981[_0x628a('0x43')]);_0x56c134[_0x628a('0x47')]=_[_0x628a('0x46')](_0x152981[_0x628a('0x42')],qs[_0x628a('0x48')](_0x5d9991['query'][_0x628a('0x48')]));_0x56c134[_0x628a('0x47')]=_0x56c134[_0x628a('0x47')][_0x628a('0x49')]?_0x56c134['attributes']:_0x152981[_0x628a('0x42')];_0x56c134[_0x628a('0x4b')]=qs[_0x628a('0x4c')](_0x5d9991['query'][_0x628a('0x4c')]);_0x56c134[_0x628a('0x4f')]=qs[_0x628a('0x45')](_[_0x628a('0x4d')](_0x5d9991[_0x628a('0x43')],_0x152981[_0x628a('0x45')]));if(_0x5d9991[_0x628a('0x43')][_0x628a('0x4e')]){_0x56c134[_0x628a('0x4f')]=_['merge'](_0x56c134['where'],{'$or':_[_0x628a('0x3c')](_0x56c134['attributes'],function(_0x510e4d){var _0x2fa53d={};_0x2fa53d[_0x510e4d]={'$like':'%'+_0x5d9991[_0x628a('0x43')]['filter']+'%'};return _0x2fa53d;})});}_0x56c134=_['merge']({},_0x56c134,_0x5d9991['options']);return _0x597876[_0x628a('0x76')](_0x56c134);}})[_0x628a('0x35')](function(_0x3c7596){if(_0x3c7596){_0x4c02a2=_0x3c7596[_0x628a('0x49')];if(!_0x5d9991[_0x628a('0x43')][_0x628a('0x4a')](_0x628a('0x68'))){_0x56c134[_0x628a('0x2b')]=qs[_0x628a('0x2b')](_0x5d9991[_0x628a('0x43')][_0x628a('0x2b')]);_0x56c134[_0x628a('0x2d')]=qs[_0x628a('0x2d')](_0x5d9991[_0x628a('0x43')][_0x628a('0x2d')]);}return _0x597876[_0x628a('0x76')](_0x56c134);}})['then'](function(_0x2ff11a){if(_0x2ff11a){return _0x2ff11a?{'count':_0x4c02a2,'rows':_0x2ff11a}:null;}})[_0x628a('0x35')](respondWithResult(_0x51c061,null))[_0x628a('0x26')](handleError(_0x51c061,null));};exports[_0x628a('0x78')]=function(_0x461ea9,_0x28eb0a,_0x22ac19){return db[_0x628a('0x3d')][_0x628a('0x67')]({'where':{'id':_0x461ea9['params']['id']}})[_0x628a('0x35')](handleEntityNotFound(_0x28eb0a,null))[_0x628a('0x35')](function(_0x576fb8){if(_0x576fb8){return db[_0x628a('0x79')][_0x628a('0x7a')](function(_0x283da4){return db['WhatsappApplication'][_0x628a('0x34')]({'where':{'WhatsappAccountId':_0x461ea9[_0x628a('0x56')]['id']},'transaction':_0x283da4})['then'](function(_0x4a4e43){var _0xd888bc=_[_0x628a('0x3c')](_0x461ea9[_0x628a('0x5c')],function(_0x29e76c){_0x29e76c[_0x628a('0x65')]=_0x461ea9[_0x628a('0x56')]['id'];return _0x29e76c;});return db[_0x628a('0x7b')][_0x628a('0x7c')](_0xd888bc,{'transaction':_0x283da4});});})[_0x628a('0x35')](function(){return db[_0x628a('0x7b')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x461ea9[_0x628a('0x56')]['id']},'order':_0x628a('0x7d')});});}})[_0x628a('0x35')](respondWithResult(_0x28eb0a,null))['catch'](handleError(_0x28eb0a,null));};exports[_0x628a('0x7e')]=function(_0x58adc0,_0x3989ed,_0x2fa650){var _0x3e2d65={};var _0xa3ea3e={};var _0x115f69;var _0x2134e3;return db['WhatsappAccount'][_0x628a('0x67')]({'where':{'id':_0x58adc0['params']['id']}})['then'](handleEntityNotFound(_0x3989ed,null))['then'](function(_0x524344){if(_0x524344){_0x115f69=_0x524344;_0xa3ea3e['model']=_[_0x628a('0x44')](db[_0x628a('0x7b')][_0x628a('0x3e')]);_0xa3ea3e[_0x628a('0x43')]=_[_0x628a('0x44')](_0x58adc0[_0x628a('0x43')]);_0xa3ea3e[_0x628a('0x45')]=_[_0x628a('0x46')](_0xa3ea3e[_0x628a('0x42')],_0xa3ea3e[_0x628a('0x43')]);_0x3e2d65['attributes']=_[_0x628a('0x46')](_0xa3ea3e[_0x628a('0x42')],qs['fields'](_0x58adc0[_0x628a('0x43')][_0x628a('0x48')]));_0x3e2d65[_0x628a('0x47')]=_0x3e2d65[_0x628a('0x47')][_0x628a('0x49')]?_0x3e2d65[_0x628a('0x47')]:_0xa3ea3e[_0x628a('0x42')];_0x3e2d65[_0x628a('0x4b')]=qs[_0x628a('0x4c')](_0x58adc0['query']['sort']);_0x3e2d65[_0x628a('0x4f')]=qs[_0x628a('0x45')](_[_0x628a('0x4d')](_0x58adc0['query'],_0xa3ea3e[_0x628a('0x45')]));if(_0x58adc0['query'][_0x628a('0x4e')]){_0x3e2d65[_0x628a('0x4f')]=_['merge'](_0x3e2d65['where'],{'$or':_[_0x628a('0x3c')](_0x3e2d65['attributes'],function(_0x19bda0){var _0x28dc2e={};_0x28dc2e[_0x19bda0]={'$like':'%'+_0x58adc0[_0x628a('0x43')][_0x628a('0x4e')]+'%'};return _0x28dc2e;})});}_0x3e2d65=_['merge']({},_0x3e2d65,_0x58adc0['options']);return _0x115f69[_0x628a('0x7e')](_0x3e2d65);}})['then'](function(_0x4d6488){if(_0x4d6488){_0x2134e3=_0x4d6488[_0x628a('0x49')];if(!_0x58adc0[_0x628a('0x43')]['hasOwnProperty'](_0x628a('0x68'))){_0x3e2d65[_0x628a('0x2b')]=qs['limit'](_0x58adc0['query'][_0x628a('0x2b')]);_0x3e2d65[_0x628a('0x2d')]=qs['offset'](_0x58adc0[_0x628a('0x43')][_0x628a('0x2d')]);}return _0x115f69[_0x628a('0x7e')](_0x3e2d65);}})['then'](function(_0x3ce5f0){if(_0x3ce5f0){return _0x3ce5f0?{'count':_0x2134e3,'rows':_0x3ce5f0}:null;}})[_0x628a('0x35')](respondWithResult(_0x3989ed,null))[_0x628a('0x26')](handleError(_0x3989ed,null));};exports['notify']=function(_0x3a2036,_0x575ade,_0x415e47){var _0x2d9bdf={'channel':_0x628a('0x7f')};var _0x352a0d=[];var _0x59ae08=[];var _0x2afcf1={};return db['WhatsappAccount']['find']({'where':{'id':_0x3a2036['params']['id']},'include':[{'model':db[_0x628a('0x7b')],'as':'Applications'}]})[_0x628a('0x35')](handleEntityNotFound(_0x575ade,null))['then'](function(_0x4d49ab){_0x2d9bdf[_0x628a('0x80')]=_0x4d49ab;_0x2d9bdf[_0x628a('0x81')]=_[_0x628a('0x82')](_0x4d49ab[_0x628a('0x83')],[_0x628a('0x7d')],[_0x628a('0x84')]);if(_0x2d9bdf[_0x628a('0x80')][_0x628a('0x83')]){delete _0x2d9bdf['account'][_0x628a('0x83')];}return db[_0x628a('0x85')][_0x628a('0x63')]();})[_0x628a('0x35')](function(_0x4a3b36){if(!_0x4a3b36){throw new db[(_0x628a('0x86'))]['ValidationError'](_0x628a('0x87'));}_0x352a0d=_['difference'](_[_0x628a('0x44')](_0x4a3b36),['createdAt','updatedAt']);_0x59ae08=_[_0x628a('0x88')](_['keys'](_0x4a3b36),[_0x628a('0x89'),'updatedAt',_0x628a('0x8a'),_0x628a('0x8b')]);_0x2d9bdf[_0x628a('0x5c')]={'mapKey':_0x628a('0x8c')};if(_0x2d9bdf[_0x628a('0x80')][_0x628a('0x40')]&&_0x2d9bdf['account'][_0x628a('0x40')]===_0x628a('0x8d')){_0x2d9bdf[_0x628a('0x5c')][_0x628a('0x8e')]=_0x3a2036[_0x628a('0x5c')][_0x628a('0x8f')][_0x628a('0x90')]('whatsapp:','');_0x2d9bdf['body'][_0x628a('0x5c')]=_0x3a2036[_0x628a('0x5c')][_0x628a('0x91')];_0x2d9bdf['body']['messageId']=_0x3a2036['body']['MessageSid'];}if(_0x2d9bdf[_0x628a('0x5c')]['id']){delete _0x2d9bdf[_0x628a('0x5c')]['id'];}if(_['isNil'](_0x2d9bdf[_0x628a('0x5c')][_0x628a('0x8e')])){throw new db[(_0x628a('0x86'))][(_0x628a('0x92'))](_0x628a('0x93'));}if(_[_0x628a('0x94')](_0x2d9bdf['body'][_0x628a('0x5c')])||_0x2d9bdf[_0x628a('0x5c')][_0x628a('0x5c')]===''){throw new db[(_0x628a('0x86'))][(_0x628a('0x92'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x628a('0x94')](_0x2d9bdf['body']['mapKey'])){throw new db[(_0x628a('0x86'))][(_0x628a('0x92'))](_0x628a('0x95')+_0x59ae08);}if(!_[_0x628a('0x96')](_0x59ae08,_0x2d9bdf[_0x628a('0x5c')]['mapKey'])){throw new db[(_0x628a('0x86'))]['ValidationError'](_0x628a('0x97')+_0x59ae08);}_0x2afcf1[_0x2d9bdf[_0x628a('0x5c')][_0x628a('0x98')]]=_0x2d9bdf[_0x628a('0x5c')][_0x628a('0x8e')];return db[_0x628a('0x99')][_0x628a('0x5a')]({'where':{'id':_0x2d9bdf[_0x628a('0x80')][_0x628a('0x8b')]},'include':[{'model':db[_0x628a('0x85')],'as':_0x628a('0x9a'),'where':_0x2afcf1,'limit':0x1,'order':[[_0x628a('0x9b'),_0x628a('0x9c')]]}]});})[_0x628a('0x35')](handleEntityNotFound(_0x575ade,null))['then'](function(_0x5a4f9d){if(_0x5a4f9d){_0x2d9bdf[_0x628a('0x9d')]=_[_0x628a('0x6f')](_0x5a4f9d,[_0x628a('0x9a')]);if(_0x5a4f9d[_0x628a('0x9a')][_0x628a('0x49')]){return _0x5a4f9d[_0x628a('0x9a')][0x0];}var _0x527699=_[_0x628a('0x17')](_0x2d9bdf[_0x628a('0x5c')],{'firstName':_0x2d9bdf[_0x628a('0x5c')]['from'],'ListId':_0x5a4f9d['id']});_0x527699[_0x2d9bdf[_0x628a('0x5c')][_0x628a('0x98')]]=_0x2d9bdf[_0x628a('0x5c')]['from'];return db['CmContact'][_0x628a('0x5b')](_0x527699,{'fields':_0x352a0d,'raw':!![]});}})['then'](handleEntityNotFound(_0x575ade,null))['then'](function(_0x445969){if(_0x445969){_0x2d9bdf[_0x628a('0x9e')]=_0x445969;var _0x20fada={'ContactId':_0x445969['id'],'phone':_0x2d9bdf[_0x628a('0x5c')][_0x628a('0x8e')],'WhatsappAccountId':_0x3a2036[_0x628a('0x56')]['id']};var _0x235cfc={'ContactId':_0x445969['id'],'WhatsappAccountId':_0x3a2036[_0x628a('0x56')]['id'],'closed':![]};return db[_0x628a('0x9f')][_0x628a('0x5a')]({'where':_0x235cfc})[_0x628a('0x35')](function(_0x4f9716){if(_0x4f9716){return[_0x4f9716,![]];}return db[_0x628a('0x9f')][_0x628a('0x5b')](_0x20fada)['then'](function(_0x5d7611){return[_0x5d7611,!![]];});});}})[_0x628a('0x70')](function(_0x526c1e,_0x24a218){_0x2d9bdf[_0x628a('0xa0')]=_0x526c1e[_0x628a('0x36')]({'plain':!![]});_0x2d9bdf[_0x628a('0xa0')]['created']=![];if(_0x24a218){if(_0x2d9bdf[_0x628a('0x80')][_0x628a('0xa1')]){_0x2d9bdf['applications']['push']({'id':0x0,'priority':_0x2d9bdf[_0x628a('0x81')]['length']+0x1,'app':'close','appdata':_0x628a('0xa2'),'interval':_0x628a('0xa3')});}_0x2d9bdf['interaction'][_0x628a('0xa4')]=!![];}return db[_0x628a('0xa5')][_0x628a('0x5b')]({'phone':_0x2d9bdf[_0x628a('0x5c')]['from'],'messageId':_0x2d9bdf[_0x628a('0x5c')][_0x628a('0xa6')],'body':_0x2d9bdf[_0x628a('0x5c')][_0x628a('0x5c')],'WhatsappAccountId':_0x3a2036[_0x628a('0x56')]['id'],'WhatsappInteractionId':_0x526c1e['id'],'direction':'in','ContactId':_0x526c1e[_0x628a('0xa7')],'AttachmentId':_0x2d9bdf['body'][_0x628a('0xa8')]});})[_0x628a('0x35')](function(_0x3490c7){_0x2d9bdf['message']=_0x3490c7;if(_0x2d9bdf['interaction'][_0x628a('0xa9')]){return db[_0x628a('0x77')][_0x628a('0x5a')]({'attributes':['id','name'],'where':{'id':_0x2d9bdf[_0x628a('0xa0')]['UserId']}})['then'](function(_0x1b0315){if(_0x1b0315){_0x2d9bdf['applications'][_0x628a('0xaa')]({'id':0x0,'priority':0x0,'app':_0x628a('0xab'),'appdata':_0x1b0315[_0x628a('0x38')]+','+(_0x2d9bdf['account'][_0x628a('0xac')]||0xa),'interval':_0x628a('0xa3')});}return respondWithRpcPromise(_0x628a('0xad'),'startRouting',_0x2d9bdf);});}return respondWithRpcPromise(_0x628a('0xad'),_0x628a('0xae'),_0x2d9bdf);})[_0x628a('0x35')](function(_0x5bd8df){if(_0x5bd8df){var _0x1fbf7a=0xc8;var _0x577e10=_0x628a('0xaf');logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x577e10,_0x1fbf7a,'entity\x20found');logger[_0x628a('0x21')](_0x628a('0xb0'),_0x577e10,_0x1fbf7a,_0x628a('0xb1'),JSON[_0x628a('0xb2')](_0x5bd8df));if(_0x2d9bdf[_0x628a('0x80')]['type']===_0x628a('0x8d')){return _0x575ade['status'](_0x1fbf7a)['set'](_0x628a('0xb3'),_0x628a('0xb4'))[_0x628a('0x39')](_0x628a('0xb5'));}else{return _0x575ade[_0x628a('0x28')](_0x1fbf7a)[_0x628a('0x29')](_0x5bd8df);}}})[_0x628a('0x26')](handleError(_0x575ade,null));};exports[_0x628a('0x39')]=function(_0x5e8dbb,_0xae1e46,_0x4f55b2){var _0x2b8062,_0x1dfe55,_0x102b60;if(_[_0x628a('0x94')](_0x5e8dbb[_0x628a('0x5c')][_0x628a('0x5c')])||_0x5e8dbb[_0x628a('0x5c')][_0x628a('0x5c')]===''){throw new db['Sequelize'][(_0x628a('0x92'))](_0x628a('0xb6'));}if(_[_0x628a('0x94')](_0x5e8dbb['body']['to'])){throw new db[(_0x628a('0x86'))][(_0x628a('0x92'))](_0x628a('0xb7'));}_0x2b8062=_0x5e8dbb[_0x628a('0x5c')]['to'];return db[_0x628a('0x3d')][_0x628a('0x5a')]({'where':{'id':_0x5e8dbb[_0x628a('0x56')]['id']},'include':[{'model':db[_0x628a('0x99')],'as':_0x628a('0xb8'),'include':[{'model':db[_0x628a('0x85')],'as':_0x628a('0x9a'),'where':{'mobile':_0x2b8062},'limit':0x1,'order':[[_0x628a('0x9b'),_0x628a('0x9c')]]}]}]})['then'](handleEntityNotFound(_0xae1e46,null))['then'](function(_0x4dcb7e){if(_0x4dcb7e&&_0x4dcb7e[_0x628a('0xb8')]){_0x1dfe55=_0x4dcb7e[_0x628a('0x36')]({'plain':!![]});if(_0x1dfe55['List']&&_0x1dfe55[_0x628a('0xb8')][_0x628a('0x9a')][_0x628a('0x49')]){return _0x1dfe55[_0x628a('0xb8')][_0x628a('0x9a')][0x0];}return db[_0x628a('0x85')][_0x628a('0x5b')](_[_0x628a('0x17')](_0x5e8dbb[_0x628a('0x5c')],{'firstName':_0x2b8062,'mobile':_0x2b8062,'phone':_0x2b8062,'ListId':_0x1dfe55[_0x628a('0x8b')]}));}})[_0x628a('0x35')](handleEntityNotFound(_0xae1e46,null))[_0x628a('0x35')](function(_0x4c44ca){if(_0x4c44ca){_0x102b60=_0x4c44ca;return db[_0x628a('0x9f')][_0x628a('0x5a')]({'where':{'ContactId':_0x102b60['id'],'closed':![],'WhatsappAccountId':_0x1dfe55['id']}})[_0x628a('0x35')](function(_0x29f5bc){if(_0x29f5bc){return[_0x29f5bc,![]];}return db['WhatsappInteraction'][_0x628a('0x5b')]({'UserId':_0x5e8dbb[_0x628a('0x5d')]['id'],'ContactId':_0x102b60['id'],'WhatsappAccountId':_0x1dfe55['id'],'phone':_0x2b8062,'firstMsgDirection':_0x628a('0xb9'),'Messages':[_[_0x628a('0x50')](_0x5e8dbb[_0x628a('0x5c')],{'read':![],'body':_0x5e8dbb['body']['body'],'phone':_0x2b8062,'WhatsappAccountId':_0x1dfe55['id'],'UserId':_0x5e8dbb['user']['id'],'ContactId':_0x102b60['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x628a('0xba')}]})[_0x628a('0x35')](function(_0x3147d9){return[_0x3147d9,!![]];});});}})[_0x628a('0x70')](function(_0x2be052,_0x24fb4c){if(_0x24fb4c){return _0x2be052;}return db['WhatsappMessage'][_0x628a('0x5b')](_[_0x628a('0x50')](_0x5e8dbb[_0x628a('0x5c')],{'read':![],'body':_0x5e8dbb[_0x628a('0x5c')][_0x628a('0x5c')],'phone':_0x2b8062,'WhatsappAccountId':_0x1dfe55['id'],'WhatsappInteractionId':_0x2be052['id'],'UserId':_0x5e8dbb[_0x628a('0x5d')]['id'],'ContactId':_0x102b60['id']}))[_0x628a('0x35')](function(_0x4d8120){_0x2be052['dataValues']['Messages']=[];_0x2be052[_0x628a('0xbb')][_0x628a('0xba')][_0x628a('0xbc')](_0x4d8120[_0x628a('0xbb')]);return _0x2be052;});})['then'](respondWithResult(_0xae1e46,null))[_0x628a('0x26')](handleError(_0xae1e46,null));}; \ No newline at end of file +var _0xa9e7=['from','From','replace','whatsapp:','Body','messageId','MessageSid','isNil','Sequelize','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','CmContact','Contacts','DESC','list','contact','spread','interaction','created','autoclose','push','close','*,*,*,*','WhatsappMessage','ContactId','UserId','User','unshift','agent','waitForTheAssignedAgent','startRouting','Start','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','body\x20is\x20mandatory\x20and\x20not\x20empty','List','WhatsappInteraction','out','dataValues','Messages','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','./whatsappAccount.socket','register','client','then','info','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','catch','status','json','offset','undefined','limit','count','set','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','WhatsappAccount','rawAttributes','type','filters','intersection','model','query','attributes','length','hasOwnProperty','order','sort','where','map','filter','merge','options','findAll','rows','show','params','keys','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','mandatoryDispositionPause','describe','addDisposition','Disposition','getDispositions','findOne','fields','nolimit','pick','WhatsappAccountId','includeAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','WhatsappApplication','bulkCreate','findAndCountAll','getApplications','notify','whatsapp','account','applications','Applications','asc','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','twilio'];(function(_0x449fa2,_0x24f0ec){var _0x80693a=function(_0x24122e){while(--_0x24122e){_0x449fa2['push'](_0x449fa2['shift']());}};_0x80693a(++_0x24f0ec);}(_0xa9e7,0x19a));var _0x7a9e=function(_0x376e63,_0x26cc4f){_0x376e63=_0x376e63-0x0;var _0x64933=_0xa9e7[_0x376e63];return _0x64933;};'use strict';var emlformat=require(_0x7a9e('0x0'));var rimraf=require(_0x7a9e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7a9e('0x2'));var rp=require(_0x7a9e('0x3'));var moment=require(_0x7a9e('0x4'));var BPromise=require(_0x7a9e('0x5'));var Mustache=require(_0x7a9e('0x6'));var util=require(_0x7a9e('0x7'));var path=require(_0x7a9e('0x8'));var sox=require(_0x7a9e('0x9'));var csv=require(_0x7a9e('0xa'));var ejs=require(_0x7a9e('0xb'));var fs=require('fs');var fs_extra=require(_0x7a9e('0xc'));var _=require(_0x7a9e('0xd'));var squel=require(_0x7a9e('0xe'));var crypto=require(_0x7a9e('0xf'));var jsforce=require(_0x7a9e('0x10'));var deskjs=require(_0x7a9e('0x11'));var toCsv=require(_0x7a9e('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7a9e('0x12'));var qs=require(_0x7a9e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7a9e('0x14'));var logger=require('../../config/logger')(_0x7a9e('0x15'));var utils=require(_0x7a9e('0x16'));var config=require(_0x7a9e('0x17'));var licenseUtil=require(_0x7a9e('0x18'));var db=require(_0x7a9e('0x19'))['db'];config['redis']=_[_0x7a9e('0x1a')](config[_0x7a9e('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7a9e('0x1b')]));require(_0x7a9e('0x1c'))[_0x7a9e('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x7a9e('0x1e')]['http']({'port':0x232c});function respondWithRpcPromise(_0x163a42,_0x281e63,_0x4ec041,_0x5507ad){return new BPromise(function(_0x498470,_0x22a3d3){var _0x100cb8=_0x5507ad||client;return _0x100cb8['request'](_0x163a42,_0x4ec041)[_0x7a9e('0x1f')](function(_0x47a119){logger[_0x7a9e('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0x281e63,'request\x20sent');logger[_0x7a9e('0x21')](_0x7a9e('0x22'),_0x281e63,_0x7a9e('0x23'),JSON[_0x7a9e('0x24')](_0x47a119));if(_0x47a119[_0x7a9e('0x25')]){if(_0x47a119[_0x7a9e('0x25')]['code']===0x1f4){logger['error'](_0x7a9e('0x26'),_0x281e63,_0x47a119['error'][_0x7a9e('0x27')]);return _0x22a3d3(_0x47a119[_0x7a9e('0x25')]['message']);}logger['error'](_0x7a9e('0x26'),_0x281e63,_0x47a119[_0x7a9e('0x25')][_0x7a9e('0x27')]);return _0x498470(_0x47a119[_0x7a9e('0x25')][_0x7a9e('0x27')]);}else{logger['info'](_0x7a9e('0x26'),_0x281e63,'request\x20sent');_0x498470(_0x47a119['result'][_0x7a9e('0x27')]);}})[_0x7a9e('0x28')](function(_0x2ed0c9){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x281e63,_0x2ed0c9);_0x22a3d3(_0x2ed0c9);});});}function respondWithStatusCode(_0x336f13,_0x510d00){_0x510d00=_0x510d00||0xcc;return function(_0x3c8cf3){if(_0x3c8cf3){return _0x336f13['sendStatus'](_0x510d00);}return _0x336f13['status'](_0x510d00)['end']();};}function respondWithResult(_0x476c82,_0x566f8b){_0x566f8b=_0x566f8b||0xc8;return function(_0x4c29eb){if(_0x4c29eb){return _0x476c82[_0x7a9e('0x29')](_0x566f8b)[_0x7a9e('0x2a')](_0x4c29eb);}};}function respondWithFilteredResult(_0x127caa,_0x14eb1f){return function(_0x433b08){if(_0x433b08){var _0x34db29=typeof _0x14eb1f[_0x7a9e('0x2b')]===_0x7a9e('0x2c')&&typeof _0x14eb1f[_0x7a9e('0x2d')]==='undefined';var _0x4ccb86=_0x433b08[_0x7a9e('0x2e')];var _0x4066ff=_0x34db29?0x0:_0x14eb1f[_0x7a9e('0x2b')];var _0x686d02=_0x34db29?_0x433b08['count']:_0x14eb1f[_0x7a9e('0x2b')]+_0x14eb1f[_0x7a9e('0x2d')];var _0xfd3928;if(_0x686d02>=_0x4ccb86){_0x686d02=_0x4ccb86;_0xfd3928=0xc8;}else{_0xfd3928=0xce;}_0x127caa[_0x7a9e('0x29')](_0xfd3928);return _0x127caa[_0x7a9e('0x2f')]('Content-Range',_0x4066ff+'-'+_0x686d02+'/'+_0x4ccb86)['json'](_0x433b08);}return null;};}function patchUpdates(_0x26c512){return function(_0x366150){try{jsonpatch['apply'](_0x366150,_0x26c512,!![]);}catch(_0x5c7544){return BPromise[_0x7a9e('0x30')](_0x5c7544);}return _0x366150[_0x7a9e('0x31')]();};}function saveUpdates(_0x532b5a,_0x20d002){return function(_0x76656d){if(_0x76656d){return _0x76656d[_0x7a9e('0x32')](_0x532b5a)['then'](function(_0x3466ca){return _0x3466ca;});}return null;};}function removeEntity(_0x1afff4,_0x38af54){return function(_0x41c964){if(_0x41c964){return _0x41c964[_0x7a9e('0x33')]()['then'](function(){var _0x54ef22=_0x41c964[_0x7a9e('0x34')]({'plain':!![]});var _0x1d2860=_0x7a9e('0x35');return db[_0x7a9e('0x36')]['destroy']({'where':{'type':_0x1d2860,'resourceId':_0x54ef22['id']}})[_0x7a9e('0x1f')](function(){return _0x41c964;});})[_0x7a9e('0x1f')](function(){_0x1afff4[_0x7a9e('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29fe1e,_0x14c1fd){return function(_0x5231b0){if(!_0x5231b0){_0x29fe1e[_0x7a9e('0x37')](0x194);}return _0x5231b0;};}function handleError(_0x192858,_0x4ccbb5){_0x4ccbb5=_0x4ccbb5||0x1f4;return function(_0x55ec08){logger[_0x7a9e('0x25')](_0x55ec08[_0x7a9e('0x38')]);if(_0x55ec08[_0x7a9e('0x39')]){delete _0x55ec08[_0x7a9e('0x39')];}_0x192858[_0x7a9e('0x29')](_0x4ccbb5)[_0x7a9e('0x3a')](_0x55ec08);};}exports[_0x7a9e('0x3b')]=function(_0xe4f7a0,_0x4669ea){var _0x1beec7={'include':[{'model':db[_0x7a9e('0x3c')],'as':'mandatoryDispositionPause'}]},_0x382453={},_0x3280ca={'count':0x0,'rows':[]};var _0xda9da6=_['map'](db[_0x7a9e('0x3d')][_0x7a9e('0x3e')],function(_0x965095){return{'name':_0x965095['fieldName'],'type':_0x965095[_0x7a9e('0x3f')]['key']};});_0x382453['model']=_['map'](_0xda9da6,_0x7a9e('0x39'));_0x382453['query']=_['keys'](_0xe4f7a0['query']);_0x382453[_0x7a9e('0x40')]=_[_0x7a9e('0x41')](_0x382453[_0x7a9e('0x42')],_0x382453[_0x7a9e('0x43')]);_0x1beec7[_0x7a9e('0x44')]=_[_0x7a9e('0x41')](_0x382453[_0x7a9e('0x42')],qs['fields'](_0xe4f7a0['query']['fields']));_0x1beec7['attributes']=_0x1beec7[_0x7a9e('0x44')][_0x7a9e('0x45')]?_0x1beec7[_0x7a9e('0x44')]:_0x382453[_0x7a9e('0x42')];if(!_0xe4f7a0[_0x7a9e('0x43')][_0x7a9e('0x46')]('nolimit')){_0x1beec7[_0x7a9e('0x2d')]=qs[_0x7a9e('0x2d')](_0xe4f7a0['query'][_0x7a9e('0x2d')]);_0x1beec7[_0x7a9e('0x2b')]=qs[_0x7a9e('0x2b')](_0xe4f7a0['query'][_0x7a9e('0x2b')]);}_0x1beec7[_0x7a9e('0x47')]=qs[_0x7a9e('0x48')](_0xe4f7a0[_0x7a9e('0x43')][_0x7a9e('0x48')]);_0x1beec7[_0x7a9e('0x49')]=qs[_0x7a9e('0x40')](_['pick'](_0xe4f7a0[_0x7a9e('0x43')],_0x382453[_0x7a9e('0x40')]),_0xda9da6);if(_0xe4f7a0[_0x7a9e('0x43')]['filter']){_0x1beec7[_0x7a9e('0x49')]=_['merge'](_0x1beec7[_0x7a9e('0x49')],{'$or':_[_0x7a9e('0x4a')](_0xda9da6,function(_0x15e269){if(_0x15e269[_0x7a9e('0x3f')]!=='VIRTUAL'){var _0x2eb89a={};_0x2eb89a[_0x15e269[_0x7a9e('0x39')]]={'$like':'%'+_0xe4f7a0[_0x7a9e('0x43')][_0x7a9e('0x4b')]+'%'};return _0x2eb89a;}})});}_0x1beec7=_[_0x7a9e('0x4c')]({},_0x1beec7,_0xe4f7a0[_0x7a9e('0x4d')]);var _0x17bc71={'where':_0x1beec7[_0x7a9e('0x49')]};return db[_0x7a9e('0x3d')][_0x7a9e('0x2e')](_0x17bc71)[_0x7a9e('0x1f')](function(_0x224055){_0x3280ca[_0x7a9e('0x2e')]=_0x224055;if(_0xe4f7a0['query']['includeAll']){_0x1beec7['include']=[{'all':!![]}];}return db[_0x7a9e('0x3d')][_0x7a9e('0x4e')](_0x1beec7);})[_0x7a9e('0x1f')](function(_0x599252){_0x3280ca[_0x7a9e('0x4f')]=_0x599252;return _0x3280ca;})[_0x7a9e('0x1f')](respondWithFilteredResult(_0x4669ea,_0x1beec7))[_0x7a9e('0x28')](handleError(_0x4669ea,null));};exports[_0x7a9e('0x50')]=function(_0x44798f,_0x31d905){var _0x3e7bcf={'raw':![],'where':{'id':_0x44798f[_0x7a9e('0x51')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x585aea={};_0x585aea[_0x7a9e('0x42')]=_[_0x7a9e('0x52')](db['WhatsappAccount'][_0x7a9e('0x3e')]);_0x585aea['query']=_[_0x7a9e('0x52')](_0x44798f['query']);_0x585aea[_0x7a9e('0x40')]=_[_0x7a9e('0x41')](_0x585aea['model'],_0x585aea[_0x7a9e('0x43')]);_0x3e7bcf[_0x7a9e('0x44')]=_['intersection'](_0x585aea[_0x7a9e('0x42')],qs['fields'](_0x44798f[_0x7a9e('0x43')]['fields']));_0x3e7bcf[_0x7a9e('0x44')]=_0x3e7bcf[_0x7a9e('0x44')][_0x7a9e('0x45')]?_0x3e7bcf[_0x7a9e('0x44')]:_0x585aea[_0x7a9e('0x42')];if(_0x44798f[_0x7a9e('0x43')]['includeAll']){_0x3e7bcf[_0x7a9e('0x53')]=[{'all':!![]}];}_0x3e7bcf=_['merge']({},_0x3e7bcf,_0x44798f[_0x7a9e('0x4d')]);return db[_0x7a9e('0x3d')]['find'](_0x3e7bcf)[_0x7a9e('0x1f')](handleEntityNotFound(_0x31d905,null))['then'](respondWithResult(_0x31d905,null))[_0x7a9e('0x28')](handleError(_0x31d905,null));};exports[_0x7a9e('0x54')]=function(_0x4963fb,_0x506a83){return db[_0x7a9e('0x3d')][_0x7a9e('0x54')](_0x4963fb[_0x7a9e('0x55')],{})[_0x7a9e('0x1f')](function(_0x166dd5){var _0x3110e2=_0x4963fb[_0x7a9e('0x56')][_0x7a9e('0x34')]({'plain':!![]});if(!_0x3110e2)throw new Error(_0x7a9e('0x57'));if(_0x3110e2[_0x7a9e('0x58')]===_0x7a9e('0x56')){var _0x1d45a7=_0x166dd5[_0x7a9e('0x34')]({'plain':!![]});var _0x4cf4a7=_0x7a9e('0x35');return db[_0x7a9e('0x59')][_0x7a9e('0x5a')]({'where':{'name':_0x4cf4a7,'userProfileId':_0x3110e2[_0x7a9e('0x5b')]},'raw':!![]})[_0x7a9e('0x1f')](function(_0x2ad1f2){if(_0x2ad1f2&&_0x2ad1f2['autoAssociation']===0x0){return db[_0x7a9e('0x36')]['create']({'name':_0x1d45a7[_0x7a9e('0x39')],'resourceId':_0x1d45a7['id'],'type':_0x2ad1f2[_0x7a9e('0x39')],'sectionId':_0x2ad1f2['id']},{})[_0x7a9e('0x1f')](function(){return _0x166dd5;});}else{return _0x166dd5;}})[_0x7a9e('0x28')](function(_0x4cb80b){logger[_0x7a9e('0x25')](_0x7a9e('0x5c'),_0x4cb80b);throw _0x4cb80b;});}return _0x166dd5;})[_0x7a9e('0x1f')](respondWithResult(_0x506a83,0xc9))['catch'](handleError(_0x506a83,null));};exports[_0x7a9e('0x32')]=function(_0x240a60,_0x12ec78){if(_0x240a60['body']['id']){delete _0x240a60[_0x7a9e('0x55')]['id'];}return db['WhatsappAccount'][_0x7a9e('0x5a')]({'where':{'id':_0x240a60[_0x7a9e('0x51')]['id']},'include':[{'model':db['Pause'],'as':_0x7a9e('0x5d')}]})[_0x7a9e('0x1f')](handleEntityNotFound(_0x12ec78,null))['then'](saveUpdates(_0x240a60['body'],null))['then'](respondWithResult(_0x12ec78,null))[_0x7a9e('0x28')](handleError(_0x12ec78,null));};exports['destroy']=function(_0x2c55f2,_0x17122d){return db[_0x7a9e('0x3d')][_0x7a9e('0x5a')]({'where':{'id':_0x2c55f2['params']['id']}})[_0x7a9e('0x1f')](handleEntityNotFound(_0x17122d,null))['then'](removeEntity(_0x17122d,null))['catch'](handleError(_0x17122d,null));};exports['describe']=function(_0x149ab3,_0x18d820){return db[_0x7a9e('0x3d')][_0x7a9e('0x5e')]()['then'](respondWithResult(_0x18d820,null))[_0x7a9e('0x28')](handleError(_0x18d820,null));};exports[_0x7a9e('0x5f')]=function(_0x16f871,_0x21df16,_0x4981e6){if(_0x16f871[_0x7a9e('0x55')]['id']){delete _0x16f871[_0x7a9e('0x55')]['id'];}return db['WhatsappAccount'][_0x7a9e('0x5a')]({'where':{'id':_0x16f871['params']['id']}})[_0x7a9e('0x1f')](handleEntityNotFound(_0x21df16,null))[_0x7a9e('0x1f')](function(_0x5dfcc2){if(_0x5dfcc2){_0x16f871[_0x7a9e('0x55')]['WhatsappAccountId']=_0x5dfcc2['id'];return db[_0x7a9e('0x60')][_0x7a9e('0x54')](_0x16f871[_0x7a9e('0x55')]);}})[_0x7a9e('0x1f')](respondWithResult(_0x21df16,null))[_0x7a9e('0x28')](handleError(_0x21df16,null));};exports[_0x7a9e('0x61')]=function(_0x2b3cc6,_0x5cc8a0,_0x33391e){var _0x42dffb={'raw':![],'where':{}};var _0x5ee44f={};var _0x51d2da={'count':0x0,'rows':[]};return db[_0x7a9e('0x3d')][_0x7a9e('0x62')]({'where':{'id':_0x2b3cc6[_0x7a9e('0x51')]['id']}})[_0x7a9e('0x1f')](handleEntityNotFound(_0x5cc8a0,null))[_0x7a9e('0x1f')](function(_0x28570e){if(_0x28570e){_0x5ee44f[_0x7a9e('0x42')]=_[_0x7a9e('0x52')](db['Disposition'][_0x7a9e('0x3e')]);_0x5ee44f[_0x7a9e('0x43')]=_[_0x7a9e('0x52')](_0x2b3cc6[_0x7a9e('0x43')]);_0x5ee44f[_0x7a9e('0x40')]=_['intersection'](_0x5ee44f[_0x7a9e('0x42')],_0x5ee44f['query']);_0x42dffb[_0x7a9e('0x44')]=_[_0x7a9e('0x41')](_0x5ee44f[_0x7a9e('0x42')],qs['fields'](_0x2b3cc6[_0x7a9e('0x43')][_0x7a9e('0x63')]));_0x42dffb[_0x7a9e('0x44')]=_0x42dffb[_0x7a9e('0x44')][_0x7a9e('0x45')]?_0x42dffb[_0x7a9e('0x44')]:_0x5ee44f['model'];if(!_0x2b3cc6['query'][_0x7a9e('0x46')](_0x7a9e('0x64'))){_0x42dffb[_0x7a9e('0x2d')]=qs[_0x7a9e('0x2d')](_0x2b3cc6[_0x7a9e('0x43')][_0x7a9e('0x2d')]);_0x42dffb[_0x7a9e('0x2b')]=qs[_0x7a9e('0x2b')](_0x2b3cc6[_0x7a9e('0x43')][_0x7a9e('0x2b')]);}_0x42dffb[_0x7a9e('0x47')]=qs['sort'](_0x2b3cc6[_0x7a9e('0x43')]['sort']);_0x42dffb[_0x7a9e('0x49')]=qs[_0x7a9e('0x40')](_[_0x7a9e('0x65')](_0x2b3cc6['query'],_0x5ee44f['filters']));_0x42dffb[_0x7a9e('0x49')][_0x7a9e('0x66')]=_0x28570e['id'];if(_0x2b3cc6['query'][_0x7a9e('0x4b')]){_0x42dffb[_0x7a9e('0x49')]=_[_0x7a9e('0x4c')](_0x42dffb[_0x7a9e('0x49')],{'$or':_['map'](_0x42dffb[_0x7a9e('0x44')],function(_0x71de49){var _0x11955d={};_0x11955d[_0x71de49]={'$like':'%'+_0x2b3cc6['query']['filter']+'%'};return _0x11955d;})});}_0x42dffb=_[_0x7a9e('0x4c')]({},_0x42dffb,_0x2b3cc6[_0x7a9e('0x4d')]);return db[_0x7a9e('0x60')][_0x7a9e('0x2e')]({'where':_0x42dffb[_0x7a9e('0x49')]})[_0x7a9e('0x1f')](function(_0x3d07e0){_0x51d2da['count']=_0x3d07e0;if(_0x2b3cc6[_0x7a9e('0x43')][_0x7a9e('0x67')]){_0x42dffb[_0x7a9e('0x53')]=[{'all':!![]}];}return db[_0x7a9e('0x60')][_0x7a9e('0x4e')](_0x42dffb);})[_0x7a9e('0x1f')](function(_0x676eb4){_0x51d2da['rows']=_0x676eb4;return _0x51d2da;});}})[_0x7a9e('0x1f')](respondWithFilteredResult(_0x5cc8a0,_0x42dffb))[_0x7a9e('0x28')](handleError(_0x5cc8a0,null));};exports[_0x7a9e('0x68')]=function(_0x12a198,_0x18b02b,_0x4e0e4a){return db[_0x7a9e('0x3d')][_0x7a9e('0x5a')]({'where':{'id':_0x12a198['params']['id']}})['then'](handleEntityNotFound(_0x18b02b,null))[_0x7a9e('0x1f')](function(_0x6cfcb5){if(_0x6cfcb5){return _0x6cfcb5[_0x7a9e('0x68')](_0x12a198[_0x7a9e('0x43')]['ids']);}})['then'](respondWithStatusCode(_0x18b02b,null))[_0x7a9e('0x28')](handleError(_0x18b02b,null));};exports[_0x7a9e('0x69')]=function(_0xa67002,_0x4a462a,_0x23fac9){if(_0xa67002[_0x7a9e('0x55')]['id']){delete _0xa67002['body']['id'];}return db[_0x7a9e('0x3d')]['find']({'where':{'id':_0xa67002[_0x7a9e('0x51')]['id']}})[_0x7a9e('0x1f')](handleEntityNotFound(_0x4a462a,null))[_0x7a9e('0x1f')](function(_0x28948d){if(_0x28948d){_0xa67002['body'][_0x7a9e('0x66')]=_0x28948d['id'];return db[_0x7a9e('0x6a')][_0x7a9e('0x54')](_0xa67002['body']);}})[_0x7a9e('0x1f')](respondWithResult(_0x4a462a,null))['catch'](handleError(_0x4a462a,null));};exports[_0x7a9e('0x6b')]=function(_0x2f90ae,_0x2c0e1f,_0x3b41a4){var _0x21ff1c={'raw':![],'where':{}};var _0x311ab9={};var _0xa39739={'count':0x0,'rows':[]};return db[_0x7a9e('0x3d')]['findOne']({'where':{'id':_0x2f90ae['params']['id']}})[_0x7a9e('0x1f')](handleEntityNotFound(_0x2c0e1f,null))['then'](function(_0x5dcf7f){if(_0x5dcf7f){_0x311ab9['model']=_[_0x7a9e('0x52')](db['CannedAnswer'][_0x7a9e('0x3e')]);_0x311ab9[_0x7a9e('0x43')]=_[_0x7a9e('0x52')](_0x2f90ae[_0x7a9e('0x43')]);_0x311ab9['filters']=_[_0x7a9e('0x41')](_0x311ab9['model'],_0x311ab9['query']);_0x21ff1c['attributes']=_[_0x7a9e('0x41')](_0x311ab9[_0x7a9e('0x42')],qs[_0x7a9e('0x63')](_0x2f90ae['query']['fields']));_0x21ff1c[_0x7a9e('0x44')]=_0x21ff1c[_0x7a9e('0x44')][_0x7a9e('0x45')]?_0x21ff1c[_0x7a9e('0x44')]:_0x311ab9[_0x7a9e('0x42')];if(!_0x2f90ae[_0x7a9e('0x43')][_0x7a9e('0x46')](_0x7a9e('0x64'))){_0x21ff1c[_0x7a9e('0x2d')]=qs[_0x7a9e('0x2d')](_0x2f90ae[_0x7a9e('0x43')][_0x7a9e('0x2d')]);_0x21ff1c['offset']=qs[_0x7a9e('0x2b')](_0x2f90ae[_0x7a9e('0x43')]['offset']);}_0x21ff1c[_0x7a9e('0x47')]=qs[_0x7a9e('0x48')](_0x2f90ae[_0x7a9e('0x43')][_0x7a9e('0x48')]);_0x21ff1c['where']=qs[_0x7a9e('0x40')](_['pick'](_0x2f90ae['query'],_0x311ab9[_0x7a9e('0x40')]));_0x21ff1c[_0x7a9e('0x49')][_0x7a9e('0x66')]=_0x5dcf7f['id'];if(_0x2f90ae[_0x7a9e('0x43')]['filter']){_0x21ff1c['where']=_['merge'](_0x21ff1c[_0x7a9e('0x49')],{'$or':_[_0x7a9e('0x4a')](_0x21ff1c[_0x7a9e('0x44')],function(_0x13c48e){var _0x4bf3db={};_0x4bf3db[_0x13c48e]={'$like':'%'+_0x2f90ae[_0x7a9e('0x43')][_0x7a9e('0x4b')]+'%'};return _0x4bf3db;})});}_0x21ff1c=_[_0x7a9e('0x4c')]({},_0x21ff1c,_0x2f90ae[_0x7a9e('0x4d')]);return db['CannedAnswer'][_0x7a9e('0x2e')]({'where':_0x21ff1c[_0x7a9e('0x49')]})[_0x7a9e('0x1f')](function(_0x58a503){_0xa39739[_0x7a9e('0x2e')]=_0x58a503;if(_0x2f90ae[_0x7a9e('0x43')][_0x7a9e('0x67')]){_0x21ff1c[_0x7a9e('0x53')]=[{'all':!![]}];}return db[_0x7a9e('0x6a')][_0x7a9e('0x4e')](_0x21ff1c);})['then'](function(_0x2ae99c){_0xa39739[_0x7a9e('0x4f')]=_0x2ae99c;return _0xa39739;});}})[_0x7a9e('0x1f')](respondWithFilteredResult(_0x2c0e1f,_0x21ff1c))[_0x7a9e('0x28')](handleError(_0x2c0e1f,null));};exports['removeAnswers']=function(_0x2e0338,_0x25f06e,_0x5f0b0a){return db[_0x7a9e('0x3d')][_0x7a9e('0x5a')]({'where':{'id':_0x2e0338[_0x7a9e('0x51')]['id']}})[_0x7a9e('0x1f')](handleEntityNotFound(_0x25f06e,null))[_0x7a9e('0x1f')](function(_0x533348){if(_0x533348){return _0x533348[_0x7a9e('0x6c')](_0x2e0338[_0x7a9e('0x43')][_0x7a9e('0x6d')]);}})[_0x7a9e('0x1f')](respondWithStatusCode(_0x25f06e,null))[_0x7a9e('0x28')](handleError(_0x25f06e,null));};exports[_0x7a9e('0x6e')]=function(_0x387ed1,_0x1284ca,_0x32fd22){return db[_0x7a9e('0x3d')][_0x7a9e('0x5a')]({'where':{'id':_0x387ed1['params']['id']}})[_0x7a9e('0x1f')](handleEntityNotFound(_0x1284ca,null))['then'](function(_0x4a5f97){if(_0x4a5f97){return _0x4a5f97[_0x7a9e('0x6e')](_0x387ed1[_0x7a9e('0x55')]['ids'],_[_0x7a9e('0x6f')](_0x387ed1['body'],[_0x7a9e('0x6d'),'id'])||{})['spread'](function(_0x40b048){for(var _0x1ba518=0x0;_0x1ba518<_0x387ed1['body']['ids'][_0x7a9e('0x45')];_0x1ba518+=0x1){socket[_0x7a9e('0x70')](_0x7a9e('0x71'),{'UserId':Number(_0x387ed1[_0x7a9e('0x55')][_0x7a9e('0x6d')][_0x1ba518]),'WhatsappAccountId':Number(_0x387ed1[_0x7a9e('0x51')]['id'])});}return _0x40b048;});}})[_0x7a9e('0x1f')](respondWithResult(_0x1284ca,null))[_0x7a9e('0x28')](handleError(_0x1284ca,null));};exports['removeAgents']=function(_0x30ce4,_0x27965e,_0x5a357d){return db['WhatsappAccount'][_0x7a9e('0x5a')]({'where':{'id':_0x30ce4[_0x7a9e('0x51')]['id']}})[_0x7a9e('0x1f')](handleEntityNotFound(_0x27965e,null))[_0x7a9e('0x1f')](function(_0x41ca09){if(_0x41ca09){return _0x41ca09[_0x7a9e('0x72')](_0x30ce4[_0x7a9e('0x43')][_0x7a9e('0x6d')])[_0x7a9e('0x1f')](function(){if(_[_0x7a9e('0x73')](_0x30ce4[_0x7a9e('0x43')][_0x7a9e('0x6d')])){for(var _0x1102a9=0x0;_0x1102a9<_0x30ce4[_0x7a9e('0x43')][_0x7a9e('0x6d')][_0x7a9e('0x45')];_0x1102a9+=0x1){socket[_0x7a9e('0x70')]('userWhatsappAccount:remove',{'UserId':Number(_0x30ce4['query'][_0x7a9e('0x6d')][_0x1102a9]),'WhatsappAccountId':Number(_0x30ce4[_0x7a9e('0x51')]['id'])});}}else{socket['emit'](_0x7a9e('0x74'),{'UserId':Number(_0x30ce4[_0x7a9e('0x43')][_0x7a9e('0x6d')]),'WhatsappAccountId':Number(_0x30ce4[_0x7a9e('0x51')]['id'])});}});}})['then'](respondWithStatusCode(_0x27965e,null))[_0x7a9e('0x28')](handleError(_0x27965e,null));};exports[_0x7a9e('0x75')]=function(_0x1f09ad,_0x990c10,_0x284819){var _0x391b1b={};var _0x33751f={};var _0x341536;var _0x5c3972;return db[_0x7a9e('0x3d')][_0x7a9e('0x62')]({'where':{'id':_0x1f09ad[_0x7a9e('0x51')]['id']}})[_0x7a9e('0x1f')](handleEntityNotFound(_0x990c10,null))[_0x7a9e('0x1f')](function(_0x20035c){if(_0x20035c){_0x341536=_0x20035c;_0x33751f['model']=_[_0x7a9e('0x52')](db['User']['rawAttributes']);_0x33751f[_0x7a9e('0x43')]=_[_0x7a9e('0x52')](_0x1f09ad[_0x7a9e('0x43')]);_0x33751f[_0x7a9e('0x40')]=_[_0x7a9e('0x41')](_0x33751f['model'],_0x33751f['query']);_0x391b1b[_0x7a9e('0x44')]=_['intersection'](_0x33751f[_0x7a9e('0x42')],qs[_0x7a9e('0x63')](_0x1f09ad[_0x7a9e('0x43')][_0x7a9e('0x63')]));_0x391b1b[_0x7a9e('0x44')]=_0x391b1b['attributes'][_0x7a9e('0x45')]?_0x391b1b['attributes']:_0x33751f[_0x7a9e('0x42')];_0x391b1b['order']=qs[_0x7a9e('0x48')](_0x1f09ad[_0x7a9e('0x43')]['sort']);_0x391b1b['where']=qs['filters'](_['pick'](_0x1f09ad[_0x7a9e('0x43')],_0x33751f['filters']));if(_0x1f09ad[_0x7a9e('0x43')][_0x7a9e('0x4b')]){_0x391b1b[_0x7a9e('0x49')]=_[_0x7a9e('0x4c')](_0x391b1b[_0x7a9e('0x49')],{'$or':_['map'](_0x391b1b[_0x7a9e('0x44')],function(_0x46164a){var _0x5db920={};_0x5db920[_0x46164a]={'$like':'%'+_0x1f09ad[_0x7a9e('0x43')][_0x7a9e('0x4b')]+'%'};return _0x5db920;})});}_0x391b1b=_[_0x7a9e('0x4c')]({},_0x391b1b,_0x1f09ad['options']);return _0x341536[_0x7a9e('0x75')](_0x391b1b);}})[_0x7a9e('0x1f')](function(_0x2f6a32){if(_0x2f6a32){_0x5c3972=_0x2f6a32['length'];if(!_0x1f09ad[_0x7a9e('0x43')][_0x7a9e('0x46')](_0x7a9e('0x64'))){_0x391b1b[_0x7a9e('0x2d')]=qs[_0x7a9e('0x2d')](_0x1f09ad[_0x7a9e('0x43')][_0x7a9e('0x2d')]);_0x391b1b['offset']=qs[_0x7a9e('0x2b')](_0x1f09ad[_0x7a9e('0x43')][_0x7a9e('0x2b')]);}return _0x341536[_0x7a9e('0x75')](_0x391b1b);}})[_0x7a9e('0x1f')](function(_0x30a5ef){if(_0x30a5ef){return _0x30a5ef?{'count':_0x5c3972,'rows':_0x30a5ef}:null;}})[_0x7a9e('0x1f')](respondWithResult(_0x990c10,null))[_0x7a9e('0x28')](handleError(_0x990c10,null));};exports['addApplications']=function(_0x557f14,_0x290456,_0x5d08a7){return db[_0x7a9e('0x3d')][_0x7a9e('0x62')]({'where':{'id':_0x557f14[_0x7a9e('0x51')]['id']}})[_0x7a9e('0x1f')](handleEntityNotFound(_0x290456,null))['then'](function(_0x98ba7e){if(_0x98ba7e){return db['sequelize']['transaction'](function(_0x3fa7d1){return db[_0x7a9e('0x76')]['destroy']({'where':{'WhatsappAccountId':_0x557f14[_0x7a9e('0x51')]['id']},'transaction':_0x3fa7d1})['then'](function(_0x364ecf){var _0x106e7c=_[_0x7a9e('0x4a')](_0x557f14[_0x7a9e('0x55')],function(_0x4cf814){_0x4cf814['WhatsappAccountId']=_0x557f14[_0x7a9e('0x51')]['id'];return _0x4cf814;});return db[_0x7a9e('0x76')][_0x7a9e('0x77')](_0x106e7c,{'transaction':_0x3fa7d1});});})['then'](function(){return db[_0x7a9e('0x76')][_0x7a9e('0x78')]({'where':{'WhatsappAccountId':_0x557f14[_0x7a9e('0x51')]['id']},'order':'priority'});});}})[_0x7a9e('0x1f')](respondWithResult(_0x290456,null))['catch'](handleError(_0x290456,null));};exports[_0x7a9e('0x79')]=function(_0xae352a,_0x25c670,_0x1f3eb4){var _0x5de0bc={};var _0x181db9={};var _0x219f68;var _0xaa8fd3;return db['WhatsappAccount'][_0x7a9e('0x62')]({'where':{'id':_0xae352a['params']['id']}})[_0x7a9e('0x1f')](handleEntityNotFound(_0x25c670,null))[_0x7a9e('0x1f')](function(_0x11946d){if(_0x11946d){_0x219f68=_0x11946d;_0x181db9['model']=_[_0x7a9e('0x52')](db['WhatsappApplication'][_0x7a9e('0x3e')]);_0x181db9['query']=_[_0x7a9e('0x52')](_0xae352a[_0x7a9e('0x43')]);_0x181db9[_0x7a9e('0x40')]=_[_0x7a9e('0x41')](_0x181db9['model'],_0x181db9['query']);_0x5de0bc['attributes']=_[_0x7a9e('0x41')](_0x181db9[_0x7a9e('0x42')],qs[_0x7a9e('0x63')](_0xae352a[_0x7a9e('0x43')][_0x7a9e('0x63')]));_0x5de0bc[_0x7a9e('0x44')]=_0x5de0bc[_0x7a9e('0x44')][_0x7a9e('0x45')]?_0x5de0bc[_0x7a9e('0x44')]:_0x181db9['model'];_0x5de0bc[_0x7a9e('0x47')]=qs[_0x7a9e('0x48')](_0xae352a['query']['sort']);_0x5de0bc[_0x7a9e('0x49')]=qs[_0x7a9e('0x40')](_[_0x7a9e('0x65')](_0xae352a['query'],_0x181db9[_0x7a9e('0x40')]));if(_0xae352a[_0x7a9e('0x43')][_0x7a9e('0x4b')]){_0x5de0bc['where']=_[_0x7a9e('0x4c')](_0x5de0bc[_0x7a9e('0x49')],{'$or':_['map'](_0x5de0bc['attributes'],function(_0x1e5145){var _0x18a660={};_0x18a660[_0x1e5145]={'$like':'%'+_0xae352a[_0x7a9e('0x43')][_0x7a9e('0x4b')]+'%'};return _0x18a660;})});}_0x5de0bc=_[_0x7a9e('0x4c')]({},_0x5de0bc,_0xae352a['options']);return _0x219f68[_0x7a9e('0x79')](_0x5de0bc);}})[_0x7a9e('0x1f')](function(_0x3891df){if(_0x3891df){_0xaa8fd3=_0x3891df['length'];if(!_0xae352a['query'][_0x7a9e('0x46')](_0x7a9e('0x64'))){_0x5de0bc[_0x7a9e('0x2d')]=qs['limit'](_0xae352a['query'][_0x7a9e('0x2d')]);_0x5de0bc[_0x7a9e('0x2b')]=qs[_0x7a9e('0x2b')](_0xae352a[_0x7a9e('0x43')][_0x7a9e('0x2b')]);}return _0x219f68['getApplications'](_0x5de0bc);}})[_0x7a9e('0x1f')](function(_0x3a3f6d){if(_0x3a3f6d){return _0x3a3f6d?{'count':_0xaa8fd3,'rows':_0x3a3f6d}:null;}})[_0x7a9e('0x1f')](respondWithResult(_0x25c670,null))['catch'](handleError(_0x25c670,null));};exports[_0x7a9e('0x7a')]=function(_0x22db95,_0x5c8353,_0x1f1815){var _0x10d19b={'channel':_0x7a9e('0x7b')};var _0x3fe695=[];var _0x3f4d82=[];var _0x13be3b={};return db[_0x7a9e('0x3d')][_0x7a9e('0x5a')]({'where':{'id':_0x22db95[_0x7a9e('0x51')]['id']},'include':[{'model':db[_0x7a9e('0x76')],'as':'Applications'}]})[_0x7a9e('0x1f')](handleEntityNotFound(_0x5c8353,null))[_0x7a9e('0x1f')](function(_0xc64c12){_0x10d19b[_0x7a9e('0x7c')]=_0xc64c12;_0x10d19b[_0x7a9e('0x7d')]=_['orderBy'](_0xc64c12[_0x7a9e('0x7e')],['priority'],[_0x7a9e('0x7f')]);if(_0x10d19b['account'][_0x7a9e('0x7e')]){delete _0x10d19b[_0x7a9e('0x7c')][_0x7a9e('0x7e')];}return db['CmContact'][_0x7a9e('0x5e')]();})['then'](function(_0x51a244){if(!_0x51a244){throw new db['Sequelize'][(_0x7a9e('0x80'))](_0x7a9e('0x81'));}_0x3fe695=_['difference'](_['keys'](_0x51a244),[_0x7a9e('0x82'),_0x7a9e('0x83')]);_0x3f4d82=_[_0x7a9e('0x84')](_['keys'](_0x51a244),[_0x7a9e('0x82'),'updatedAt',_0x7a9e('0x85'),_0x7a9e('0x86')]);_0x10d19b['body']={'mapKey':'mobile'};if(_0x10d19b[_0x7a9e('0x7c')][_0x7a9e('0x3f')]&&_0x10d19b['account'][_0x7a9e('0x3f')]===_0x7a9e('0x87')){_0x10d19b[_0x7a9e('0x55')][_0x7a9e('0x88')]=_0x22db95[_0x7a9e('0x55')][_0x7a9e('0x89')][_0x7a9e('0x8a')](_0x7a9e('0x8b'),'');_0x10d19b[_0x7a9e('0x55')][_0x7a9e('0x55')]=_0x22db95[_0x7a9e('0x55')][_0x7a9e('0x8c')];_0x10d19b['body'][_0x7a9e('0x8d')]=_0x22db95[_0x7a9e('0x55')][_0x7a9e('0x8e')];}if(_0x10d19b[_0x7a9e('0x55')]['id']){delete _0x10d19b[_0x7a9e('0x55')]['id'];}if(_[_0x7a9e('0x8f')](_0x10d19b[_0x7a9e('0x55')][_0x7a9e('0x88')])){throw new db[(_0x7a9e('0x90'))]['ValidationError'](_0x7a9e('0x91'));}if(_[_0x7a9e('0x8f')](_0x10d19b[_0x7a9e('0x55')][_0x7a9e('0x55')])||_0x10d19b['body'][_0x7a9e('0x55')]===''){throw new db[(_0x7a9e('0x90'))][(_0x7a9e('0x80'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x7a9e('0x8f')](_0x10d19b[_0x7a9e('0x55')][_0x7a9e('0x92')])){throw new db['Sequelize'][(_0x7a9e('0x80'))](_0x7a9e('0x93')+_0x3f4d82);}if(!_[_0x7a9e('0x94')](_0x3f4d82,_0x10d19b[_0x7a9e('0x55')][_0x7a9e('0x92')])){throw new db[(_0x7a9e('0x90'))][(_0x7a9e('0x80'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3f4d82);}_0x13be3b[_0x10d19b[_0x7a9e('0x55')][_0x7a9e('0x92')]]=_0x10d19b['body'][_0x7a9e('0x88')];return db[_0x7a9e('0x95')][_0x7a9e('0x5a')]({'where':{'id':_0x10d19b[_0x7a9e('0x7c')][_0x7a9e('0x86')]},'include':[{'model':db[_0x7a9e('0x96')],'as':_0x7a9e('0x97'),'where':_0x13be3b,'limit':0x1,'order':[[_0x7a9e('0x83'),_0x7a9e('0x98')]]}]});})[_0x7a9e('0x1f')](handleEntityNotFound(_0x5c8353,null))[_0x7a9e('0x1f')](function(_0x5e8f0b){if(_0x5e8f0b){_0x10d19b[_0x7a9e('0x99')]=_[_0x7a9e('0x6f')](_0x5e8f0b,[_0x7a9e('0x97')]);if(_0x5e8f0b['Contacts'][_0x7a9e('0x45')]){return _0x5e8f0b[_0x7a9e('0x97')][0x0];}var _0xd4e4d2=_['defaults'](_0x10d19b['body'],{'firstName':_0x10d19b[_0x7a9e('0x55')][_0x7a9e('0x88')],'ListId':_0x5e8f0b['id']});_0xd4e4d2[_0x10d19b[_0x7a9e('0x55')]['mapKey']]=_0x10d19b[_0x7a9e('0x55')][_0x7a9e('0x88')];return db['CmContact']['create'](_0xd4e4d2,{'fields':_0x3fe695,'raw':!![]});}})[_0x7a9e('0x1f')](handleEntityNotFound(_0x5c8353,null))['then'](function(_0xb85808){if(_0xb85808){_0x10d19b[_0x7a9e('0x9a')]=_0xb85808;var _0x41a268={'ContactId':_0xb85808['id'],'phone':_0x10d19b['body'][_0x7a9e('0x88')],'WhatsappAccountId':_0x22db95['params']['id']};var _0x116607={'ContactId':_0xb85808['id'],'WhatsappAccountId':_0x22db95[_0x7a9e('0x51')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x7a9e('0x5a')]({'where':_0x116607})[_0x7a9e('0x1f')](function(_0x5b1232){if(_0x5b1232){return[_0x5b1232,![]];}return db['WhatsappInteraction'][_0x7a9e('0x54')](_0x41a268)[_0x7a9e('0x1f')](function(_0x560d68){return[_0x560d68,!![]];});});}})[_0x7a9e('0x9b')](function(_0x41d98a,_0xfbb349){_0x10d19b['interaction']=_0x41d98a[_0x7a9e('0x34')]({'plain':!![]});_0x10d19b[_0x7a9e('0x9c')][_0x7a9e('0x9d')]=![];if(_0xfbb349){if(_0x10d19b[_0x7a9e('0x7c')][_0x7a9e('0x9e')]){_0x10d19b[_0x7a9e('0x7d')][_0x7a9e('0x9f')]({'id':0x0,'priority':_0x10d19b[_0x7a9e('0x7d')]['length']+0x1,'app':_0x7a9e('0xa0'),'appdata':'unmanaged','interval':_0x7a9e('0xa1')});}_0x10d19b[_0x7a9e('0x9c')][_0x7a9e('0x9d')]=!![];}return db[_0x7a9e('0xa2')][_0x7a9e('0x54')]({'phone':_0x10d19b['body'][_0x7a9e('0x88')],'messageId':_0x10d19b[_0x7a9e('0x55')][_0x7a9e('0x8d')],'body':_0x10d19b[_0x7a9e('0x55')][_0x7a9e('0x55')],'WhatsappAccountId':_0x22db95['params']['id'],'WhatsappInteractionId':_0x41d98a['id'],'direction':'in','ContactId':_0x41d98a[_0x7a9e('0xa3')],'AttachmentId':_0x10d19b['body']['AttachmentId']});})[_0x7a9e('0x1f')](function(_0x555630){_0x10d19b[_0x7a9e('0x27')]=_0x555630;if(_0x10d19b['interaction'][_0x7a9e('0xa4')]){return db[_0x7a9e('0xa5')]['find']({'attributes':['id',_0x7a9e('0x39')],'where':{'id':_0x10d19b[_0x7a9e('0x9c')][_0x7a9e('0xa4')]}})['then'](function(_0x4c849d){if(_0x4c849d){_0x10d19b[_0x7a9e('0x7d')][_0x7a9e('0xa6')]({'id':0x0,'priority':0x0,'app':_0x7a9e('0xa7'),'appdata':_0x4c849d[_0x7a9e('0x39')]+','+(_0x10d19b[_0x7a9e('0x7c')][_0x7a9e('0xa8')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x7a9e('0xa9'),_0x10d19b);});}return respondWithRpcPromise(_0x7a9e('0xaa'),_0x7a9e('0xa9'),_0x10d19b);})['then'](function(_0x4824f7){if(_0x4824f7){var _0x3157bd=0xc8;var _0x4fb761=_0x7a9e('0xab');logger[_0x7a9e('0x20')](_0x7a9e('0x22'),_0x4fb761,_0x3157bd,_0x7a9e('0xac'));logger[_0x7a9e('0x21')](_0x7a9e('0xad'),_0x4fb761,_0x3157bd,_0x7a9e('0xac'),JSON[_0x7a9e('0x24')](_0x4824f7));if(_0x10d19b[_0x7a9e('0x7c')]['type']===_0x7a9e('0x87')){return _0x5c8353[_0x7a9e('0x29')](_0x3157bd)[_0x7a9e('0x2f')](_0x7a9e('0xae'),_0x7a9e('0xaf'))['send']('\x0a');}else{return _0x5c8353[_0x7a9e('0x29')](_0x3157bd)[_0x7a9e('0x2a')](_0x4824f7);}}})[_0x7a9e('0x28')](handleError(_0x5c8353,null));};exports[_0x7a9e('0x3a')]=function(_0xa66139,_0x52d9f3,_0x4b452d){var _0x2e273b,_0x3abfb2,_0x590acf;if(_['isNil'](_0xa66139[_0x7a9e('0x55')]['body'])||_0xa66139[_0x7a9e('0x55')]['body']===''){throw new db['Sequelize']['ValidationError'](_0x7a9e('0xb0'));}if(_['isNil'](_0xa66139[_0x7a9e('0x55')]['to'])){throw new db[(_0x7a9e('0x90'))]['ValidationError']('to\x20is\x20mandatory');}_0x2e273b=_0xa66139[_0x7a9e('0x55')]['to'];return db['WhatsappAccount'][_0x7a9e('0x5a')]({'where':{'id':_0xa66139['params']['id']},'include':[{'model':db['CmList'],'as':_0x7a9e('0xb1'),'include':[{'model':db[_0x7a9e('0x96')],'as':_0x7a9e('0x97'),'where':{'mobile':_0x2e273b},'limit':0x1,'order':[[_0x7a9e('0x83'),_0x7a9e('0x98')]]}]}]})[_0x7a9e('0x1f')](handleEntityNotFound(_0x52d9f3,null))[_0x7a9e('0x1f')](function(_0x311d2c){if(_0x311d2c&&_0x311d2c[_0x7a9e('0xb1')]){_0x3abfb2=_0x311d2c['get']({'plain':!![]});if(_0x3abfb2['List']&&_0x3abfb2['List'][_0x7a9e('0x97')][_0x7a9e('0x45')]){return _0x3abfb2[_0x7a9e('0xb1')][_0x7a9e('0x97')][0x0];}return db[_0x7a9e('0x96')][_0x7a9e('0x54')](_[_0x7a9e('0x1a')](_0xa66139[_0x7a9e('0x55')],{'firstName':_0x2e273b,'mobile':_0x2e273b,'phone':_0x2e273b,'ListId':_0x3abfb2[_0x7a9e('0x86')]}));}})[_0x7a9e('0x1f')](handleEntityNotFound(_0x52d9f3,null))['then'](function(_0x2762cf){if(_0x2762cf){_0x590acf=_0x2762cf;return db[_0x7a9e('0xb2')][_0x7a9e('0x5a')]({'where':{'ContactId':_0x590acf['id'],'closed':![],'WhatsappAccountId':_0x3abfb2['id']}})['then'](function(_0x45ac65){if(_0x45ac65){return[_0x45ac65,![]];}return db[_0x7a9e('0xb2')][_0x7a9e('0x54')]({'UserId':_0xa66139[_0x7a9e('0x56')]['id'],'ContactId':_0x590acf['id'],'WhatsappAccountId':_0x3abfb2['id'],'phone':_0x2e273b,'firstMsgDirection':_0x7a9e('0xb3'),'Messages':[_['merge'](_0xa66139['body'],{'read':![],'body':_0xa66139[_0x7a9e('0x55')]['body'],'phone':_0x2e273b,'WhatsappAccountId':_0x3abfb2['id'],'UserId':_0xa66139[_0x7a9e('0x56')]['id'],'ContactId':_0x590acf['id']})]},{'include':[{'model':db[_0x7a9e('0xa2')],'as':'Messages'}]})[_0x7a9e('0x1f')](function(_0x3f6865){return[_0x3f6865,!![]];});});}})['spread'](function(_0x41d1f7,_0x1875f0){if(_0x1875f0){return _0x41d1f7;}return db['WhatsappMessage'][_0x7a9e('0x54')](_[_0x7a9e('0x4c')](_0xa66139[_0x7a9e('0x55')],{'read':![],'body':_0xa66139[_0x7a9e('0x55')]['body'],'phone':_0x2e273b,'WhatsappAccountId':_0x3abfb2['id'],'WhatsappInteractionId':_0x41d1f7['id'],'UserId':_0xa66139['user']['id'],'ContactId':_0x590acf['id']}))['then'](function(_0x5b5ef7){_0x41d1f7[_0x7a9e('0xb4')][_0x7a9e('0xb5')]=[];_0x41d1f7[_0x7a9e('0xb4')]['Messages'][_0x7a9e('0x9f')](_0x5b5ef7[_0x7a9e('0xb4')]);return _0x41d1f7;});})[_0x7a9e('0x1f')](respondWithResult(_0x52d9f3,null))[_0x7a9e('0x28')](handleError(_0x52d9f3,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 622b2b6..0a6e057 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 _0xc809=['update','remove','emit','hook','events','../../mysqldb','WhatsappAccount','setMaxListeners'];(function(_0x1ac511,_0x4f56b9){var _0x87f94f=function(_0x39c477){while(--_0x39c477){_0x1ac511['push'](_0x1ac511['shift']());}};_0x87f94f(++_0x4f56b9);}(_0xc809,0xa4));var _0x9c80=function(_0x1dcbfd,_0x2b829b){_0x1dcbfd=_0x1dcbfd-0x0;var _0x4a8abc=_0xc809[_0x1dcbfd];return _0x4a8abc;};'use strict';var EventEmitter=require(_0x9c80('0x0'));var WhatsappAccount=require(_0x9c80('0x1'))['db'][_0x9c80('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x9c80('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9c80('0x4'),'afterDestroy':_0x9c80('0x5')};function emitEvent(_0x2b711c){return function(_0x2294dd,_0xe4342,_0x461054){WhatsappAccountEvents[_0x9c80('0x6')](_0x2b711c+':'+_0x2294dd['id'],_0x2294dd);WhatsappAccountEvents[_0x9c80('0x6')](_0x2b711c,_0x2294dd);_0x461054(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x9c80('0x7')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0x2e81=['update','remove','emit','hook','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save'];(function(_0x456f08,_0x150572){var _0x4a10bc=function(_0x3e6b8a){while(--_0x3e6b8a){_0x456f08['push'](_0x456f08['shift']());}};_0x4a10bc(++_0x150572);}(_0x2e81,0x159));var _0x12e8=function(_0x1325b5,_0x20c67e){_0x1325b5=_0x1325b5-0x0;var _0x49e29c=_0x2e81[_0x1325b5];return _0x49e29c;};'use strict';var EventEmitter=require(_0x12e8('0x0'));var WhatsappAccount=require(_0x12e8('0x1'))['db'][_0x12e8('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x12e8('0x3')](0x0);var events={'afterCreate':_0x12e8('0x4'),'afterUpdate':_0x12e8('0x5'),'afterDestroy':_0x12e8('0x6')};function emitEvent(_0x1ed1a3){return function(_0x52e9,_0x4beb17,_0x17ed62){WhatsappAccountEvents['emit'](_0x1ed1a3+':'+_0x52e9['id'],_0x52e9);WhatsappAccountEvents[_0x12e8('0x7')](_0x1ed1a3,_0x52e9);_0x17ed62(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x12e8('0x8')](e,emitEvent(event));}}module[_0x12e8('0x9')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index ea7bb04..b68f65d 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 _0x86b9=['../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','../../config/logger','api','bluebird','path'];(function(_0x3c2bbd,_0x55c6f9){var _0x502eb9=function(_0x5486ca){while(--_0x5486ca){_0x3c2bbd['push'](_0x3c2bbd['shift']());}};_0x502eb9(++_0x55c6f9);}(_0x86b9,0xc1));var _0x986b=function(_0xff4214,_0x4f849d){_0xff4214=_0xff4214-0x0;var _0x499398=_0x86b9[_0xff4214];return _0x499398;};'use strict';var _=require(_0x986b('0x0'));var util=require('util');var logger=require(_0x986b('0x1'))(_0x986b('0x2'));var moment=require('moment');var BPromise=require(_0x986b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x986b('0x4'));var rimraf=require('rimraf');var config=require(_0x986b('0x5'));var attributes=require(_0x986b('0x6'));module[_0x986b('0x7')]=function(_0x569f27,_0x551fc9){return _0x569f27[_0x986b('0x8')](_0x986b('0x9'),attributes,{'tableName':_0x986b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x16b5=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','lodash','util','../../config/logger'];(function(_0x3c2f60,_0x52791a){var _0x1dc5e4=function(_0x56829c){while(--_0x56829c){_0x3c2f60['push'](_0x3c2f60['shift']());}};_0x1dc5e4(++_0x52791a);}(_0x16b5,0xc3));var _0x516b=function(_0x257a9f,_0x403b1b){_0x257a9f=_0x257a9f-0x0;var _0xe5c43a=_0x16b5[_0x257a9f];return _0xe5c43a;};'use strict';var _=require(_0x516b('0x0'));var util=require(_0x516b('0x1'));var logger=require(_0x516b('0x2'))(_0x516b('0x3'));var moment=require('moment');var BPromise=require(_0x516b('0x4'));var rp=require(_0x516b('0x5'));var fs=require('fs');var path=require(_0x516b('0x6'));var rimraf=require(_0x516b('0x7'));var config=require(_0x516b('0x8'));var attributes=require('./whatsappAccount.attributes');module[_0x516b('0x9')]=function(_0x462997,_0x167a8a){return _0x462997[_0x516b('0xa')]('WhatsappAccount',attributes,{'tableName':'whatsapp_accounts','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 11c147f..91122db 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 _0x78e7=['WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','code','message','error','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','map','include','model','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x298fa4,_0x4662b0){var _0x57b569=function(_0x652fd6){while(--_0x652fd6){_0x298fa4['push'](_0x298fa4['shift']());}};_0x57b569(++_0x4662b0);}(_0x78e7,0xb1));var _0x778e=function(_0xc71b76,_0x2ab7c1){_0xc71b76=_0xc71b76-0x0;var _0x40dcc7=_0x78e7[_0xc71b76];return _0x40dcc7;};'use strict';var _=require(_0x778e('0x0'));var util=require(_0x778e('0x1'));var moment=require(_0x778e('0x2'));var BPromise=require(_0x778e('0x3'));var rs=require(_0x778e('0x4'));var fs=require('fs');var Redis=require(_0x778e('0x5'));var db=require(_0x778e('0x6'))['db'];var utils=require(_0x778e('0x7'));var logger=require(_0x778e('0x8'))(_0x778e('0x9'));var config=require('../../config/environment');var jayson=require(_0x778e('0xa'));var client=jayson[_0x778e('0xb')][_0x778e('0xc')]({'port':0x232a});config[_0x778e('0xd')]=_['defaults'](config[_0x778e('0xd')],{'host':_0x778e('0xe'),'port':0x18eb});var socket=require(_0x778e('0xf'))(new Redis(config[_0x778e('0xd')]));require('./whatsappAccount.socket')[_0x778e('0x10')](socket);function respondWithRpcPromise(_0x4c2ede,_0x561fd2,_0xed6809){return new BPromise(function(_0x2a5462,_0x22b0ee){return client[_0x778e('0x11')](_0x4c2ede,_0xed6809)[_0x778e('0x12')](function(_0x2382b9){logger[_0x778e('0x13')](_0x778e('0x14'),_0x561fd2,_0x778e('0x15'));logger[_0x778e('0x16')](_0x778e('0x17'),_0x561fd2,_0x778e('0x15'),JSON[_0x778e('0x18')](_0x2382b9));if(_0x2382b9['error']){if(_0x2382b9['error'][_0x778e('0x19')]===0x1f4){logger['error'](_0x778e('0x14'),_0x561fd2,_0x2382b9['error'][_0x778e('0x1a')]);return _0x22b0ee(_0x2382b9[_0x778e('0x1b')][_0x778e('0x1a')]);}logger[_0x778e('0x1b')](_0x778e('0x14'),_0x561fd2,_0x2382b9[_0x778e('0x1b')]['message']);return _0x2a5462(_0x2382b9['error'][_0x778e('0x1a')]);}else{logger[_0x778e('0x13')](_0x778e('0x14'),_0x561fd2,_0x778e('0x15'));_0x2a5462(_0x2382b9[_0x778e('0x1c')][_0x778e('0x1a')]);}})[_0x778e('0x1d')](function(_0x110d4d){logger['error'](_0x778e('0x14'),_0x561fd2,_0x110d4d);_0x22b0ee(_0x110d4d);});});}exports[_0x778e('0x1e')]=function(_0x39f76e){var _0x35ab57=this;return new Promise(function(_0x21a5d0,_0x5511f0){return db[_0x778e('0x1f')][_0x778e('0x20')]({'raw':_0x39f76e[_0x778e('0x21')]?_0x39f76e[_0x778e('0x21')][_0x778e('0x22')]===undefined?!![]:![]:!![],'where':_0x39f76e[_0x778e('0x21')]?_0x39f76e['options'][_0x778e('0x23')]||null:null,'attributes':_0x39f76e['options']?_0x39f76e['options']['attributes']||null:null,'include':_0x39f76e[_0x778e('0x21')]?_0x39f76e[_0x778e('0x21')]['include']?_[_0x778e('0x24')](_0x39f76e['options'][_0x778e('0x25')],function(_0x381e5c){return{'model':db[_0x381e5c[_0x778e('0x26')]],'as':_0x381e5c['as'],'attributes':_0x381e5c[_0x778e('0x27')],'include':_0x381e5c[_0x778e('0x25')]?_[_0x778e('0x24')](_0x381e5c[_0x778e('0x25')],function(_0x3f0dcf){return{'model':db[_0x3f0dcf[_0x778e('0x26')]],'as':_0x3f0dcf['as'],'attributes':_0x3f0dcf[_0x778e('0x27')],'include':_0x3f0dcf[_0x778e('0x25')]?_['map'](_0x3f0dcf['include'],function(_0x55a832){return{'model':db[_0x55a832[_0x778e('0x26')]],'as':_0x55a832['as'],'attributes':_0x55a832[_0x778e('0x27')]};}):[]};}):[]};}):[]:[]})[_0x778e('0x12')](function(_0x59405b){logger[_0x778e('0x13')](_0x778e('0x1e'),_0x39f76e);logger[_0x778e('0x16')]('ShowWhatsappAccount',_0x39f76e,JSON[_0x778e('0x18')](_0x59405b));_0x21a5d0(_0x59405b);})[_0x778e('0x1d')](function(_0x4c7b36){logger['error'](_0x778e('0x1e'),_0x4c7b36['message'],_0x39f76e);_0x5511f0(_0x35ab57[_0x778e('0x1b')](0x1f4,_0x4c7b36[_0x778e('0x1a')]));});});}; \ No newline at end of file +var _0x3d30=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','request\x20sent','code','error','WhatsappAccount,\x20%s,\x20%s','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','debug','stringify','lodash','util','moment','bluebird','randomstring'];(function(_0x29c1f1,_0x4a12b5){var _0x109405=function(_0x1443ac){while(--_0x1443ac){_0x29c1f1['push'](_0x29c1f1['shift']());}};_0x109405(++_0x4a12b5);}(_0x3d30,0xf1));var _0x03d3=function(_0x38cdfe,_0x2cf1ad){_0x38cdfe=_0x38cdfe-0x0;var _0x2fbacd=_0x3d30[_0x38cdfe];return _0x2fbacd;};'use strict';var _=require(_0x03d3('0x0'));var util=require(_0x03d3('0x1'));var moment=require(_0x03d3('0x2'));var BPromise=require(_0x03d3('0x3'));var rs=require(_0x03d3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x03d3('0x5'))['db'];var utils=require(_0x03d3('0x6'));var logger=require(_0x03d3('0x7'))(_0x03d3('0x8'));var config=require(_0x03d3('0x9'));var jayson=require(_0x03d3('0xa'));var client=jayson[_0x03d3('0xb')][_0x03d3('0xc')]({'port':0x232a});config['redis']=_[_0x03d3('0xd')](config[_0x03d3('0xe')],{'host':_0x03d3('0xf'),'port':0x18eb});var socket=require(_0x03d3('0x10'))(new Redis(config[_0x03d3('0xe')]));require(_0x03d3('0x11'))[_0x03d3('0x12')](socket);function respondWithRpcPromise(_0xa8edb7,_0x438d9c,_0x551efd){return new BPromise(function(_0x46ae72,_0x4b7c6a){return client[_0x03d3('0x13')](_0xa8edb7,_0x551efd)[_0x03d3('0x14')](function(_0x1e2fe9){logger[_0x03d3('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x438d9c,'request\x20sent');logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x438d9c,_0x03d3('0x16'),JSON['stringify'](_0x1e2fe9));if(_0x1e2fe9['error']){if(_0x1e2fe9['error'][_0x03d3('0x17')]===0x1f4){logger[_0x03d3('0x18')](_0x03d3('0x19'),_0x438d9c,_0x1e2fe9[_0x03d3('0x18')][_0x03d3('0x1a')]);return _0x4b7c6a(_0x1e2fe9[_0x03d3('0x18')]['message']);}logger[_0x03d3('0x18')](_0x03d3('0x19'),_0x438d9c,_0x1e2fe9[_0x03d3('0x18')][_0x03d3('0x1a')]);return _0x46ae72(_0x1e2fe9[_0x03d3('0x18')][_0x03d3('0x1a')]);}else{logger[_0x03d3('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x438d9c,'request\x20sent');_0x46ae72(_0x1e2fe9[_0x03d3('0x1b')]['message']);}})[_0x03d3('0x1c')](function(_0x29ed22){logger[_0x03d3('0x18')](_0x03d3('0x19'),_0x438d9c,_0x29ed22);_0x4b7c6a(_0x29ed22);});});}exports[_0x03d3('0x1d')]=function(_0x16a9db){var _0xa7326c=this;return new Promise(function(_0x204e56,_0xa27869){return db[_0x03d3('0x1e')][_0x03d3('0x1f')]({'raw':_0x16a9db['options']?_0x16a9db[_0x03d3('0x20')][_0x03d3('0x21')]===undefined?!![]:![]:!![],'where':_0x16a9db['options']?_0x16a9db[_0x03d3('0x20')][_0x03d3('0x22')]||null:null,'attributes':_0x16a9db[_0x03d3('0x20')]?_0x16a9db[_0x03d3('0x20')][_0x03d3('0x23')]||null:null,'include':_0x16a9db[_0x03d3('0x20')]?_0x16a9db[_0x03d3('0x20')][_0x03d3('0x24')]?_[_0x03d3('0x25')](_0x16a9db[_0x03d3('0x20')]['include'],function(_0x5c971a){return{'model':db[_0x5c971a[_0x03d3('0x26')]],'as':_0x5c971a['as'],'attributes':_0x5c971a[_0x03d3('0x23')],'include':_0x5c971a[_0x03d3('0x24')]?_[_0x03d3('0x25')](_0x5c971a[_0x03d3('0x24')],function(_0x1e7e44){return{'model':db[_0x1e7e44['model']],'as':_0x1e7e44['as'],'attributes':_0x1e7e44[_0x03d3('0x23')],'include':_0x1e7e44['include']?_[_0x03d3('0x25')](_0x1e7e44['include'],function(_0x2d1e9e){return{'model':db[_0x2d1e9e[_0x03d3('0x26')]],'as':_0x2d1e9e['as'],'attributes':_0x2d1e9e['attributes']};}):[]};}):[]};}):[]:[]})[_0x03d3('0x14')](function(_0x585863){logger[_0x03d3('0x15')](_0x03d3('0x1d'),_0x16a9db);logger[_0x03d3('0x27')]('ShowWhatsappAccount',_0x16a9db,JSON[_0x03d3('0x28')](_0x585863));_0x204e56(_0x585863);})[_0x03d3('0x1c')](function(_0x4318ea){logger[_0x03d3('0x18')](_0x03d3('0x1d'),_0x4318ea[_0x03d3('0x1a')],_0x16a9db);_0xa27869(_0xa7326c[_0x03d3('0x18')](0x1f4,_0x4318ea[_0x03d3('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 83bb4da..7365f22 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 _0x972e=['save','remove','update','emit','removeListener','register','length','./whatsappAccount.events'];(function(_0x2119e4,_0x44c5bf){var _0x4afe17=function(_0xb6cf52){while(--_0xb6cf52){_0x2119e4['push'](_0x2119e4['shift']());}};_0x4afe17(++_0x44c5bf);}(_0x972e,0xaf));var _0xe972=function(_0x34e2e1,_0x51aaec){_0x34e2e1=_0x34e2e1-0x0;var _0x2dbd55=_0x972e[_0x34e2e1];return _0x2dbd55;};'use strict';var WhatsappAccountEvents=require(_0xe972('0x0'));var events=[_0xe972('0x1'),_0xe972('0x2'),_0xe972('0x3')];function createListener(_0x2a7297,_0x144881){return function(_0x23947e){_0x144881[_0xe972('0x4')](_0x2a7297,_0x23947e);};}function removeListener(_0x31da72,_0x53a854){return function(){WhatsappAccountEvents[_0xe972('0x5')](_0x31da72,_0x53a854);};}exports[_0xe972('0x6')]=function(_0x31b645){for(var _0x5559e3=0x0,_0xb3a0bc=events[_0xe972('0x7')];_0x5559e3<_0xb3a0bc;_0x5559e3++){var _0x5ee922=events[_0x5559e3];var _0x457197=createListener('whatsappAccount:'+_0x5ee922,_0x31b645);WhatsappAccountEvents['on'](_0x5ee922,_0x457197);}}; \ No newline at end of file +var _0x7bf4=['whatsappAccount:','save','remove','update','register','length'];(function(_0x549b15,_0x23eb0e){var _0x568a4c=function(_0x550eb8){while(--_0x550eb8){_0x549b15['push'](_0x549b15['shift']());}};_0x568a4c(++_0x23eb0e);}(_0x7bf4,0xcd));var _0x47bf=function(_0x29780f,_0x10c420){_0x29780f=_0x29780f-0x0;var _0x1598ee=_0x7bf4[_0x29780f];return _0x1598ee;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x47bf('0x0'),_0x47bf('0x1'),_0x47bf('0x2')];function createListener(_0x36faa2,_0x6a5792){return function(_0xac3532){_0x6a5792['emit'](_0x36faa2,_0xac3532);};}function removeListener(_0x96b303,_0x53f123){return function(){WhatsappAccountEvents['removeListener'](_0x96b303,_0x53f123);};}exports[_0x47bf('0x3')]=function(_0x2567a6){for(var _0x400357=0x0,_0x1fb0fa=events[_0x47bf('0x4')];_0x400357<_0x1fb0fa;_0x400357++){var _0x56c243=events[_0x400357];var _0xa83367=createListener(_0x47bf('0x5')+_0x56c243,_0x2567a6);WhatsappAccountEvents['on'](_0x56c243,_0xa83367);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 4456e38..0fe928a 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 _0x9ea0=['./whatsappApplication.controller','get','isAuthenticated','index','show','create','put','/:id','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x2300f2,_0x315c5f){var _0x6bd508=function(_0x2fa0f6){while(--_0x2fa0f6){_0x2300f2['push'](_0x2300f2['shift']());}};_0x6bd508(++_0x315c5f);}(_0x9ea0,0x102));var _0x09ea=function(_0x316af7,_0x72e80c){_0x316af7=_0x316af7-0x0;var _0x286d96=_0x9ea0[_0x316af7];return _0x286d96;};'use strict';var multer=require(_0x09ea('0x0'));var util=require(_0x09ea('0x1'));var path=require(_0x09ea('0x2'));var timeout=require('connect-timeout');var express=require(_0x09ea('0x3'));var router=express[_0x09ea('0x4')]();var fs_extra=require(_0x09ea('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x09ea('0x6'));var config=require(_0x09ea('0x7'));var controller=require(_0x09ea('0x8'));router[_0x09ea('0x9')]('/',auth[_0x09ea('0xa')](),controller[_0x09ea('0xb')]);router[_0x09ea('0x9')]('/:id',auth[_0x09ea('0xa')](),controller[_0x09ea('0xc')]);router['post']('/',auth[_0x09ea('0xa')](),controller[_0x09ea('0xd')]);router[_0x09ea('0xe')](_0x09ea('0xf'),auth[_0x09ea('0xa')](),controller[_0x09ea('0x10')]);router[_0x09ea('0x11')](_0x09ea('0xf'),auth['isAuthenticated'](),controller[_0x09ea('0x12')]);module['exports']=router; \ No newline at end of file +var _0xbd06=['isAuthenticated','post','create','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id'];(function(_0x4342c9,_0xfa630c){var _0x32eed5=function(_0x570c20){while(--_0x570c20){_0x4342c9['push'](_0x4342c9['shift']());}};_0x32eed5(++_0xfa630c);}(_0xbd06,0x16f));var _0x6bd0=function(_0x593e1f,_0x5a4c98){_0x593e1f=_0x593e1f-0x0;var _0x57abf5=_0xbd06[_0x593e1f];return _0x57abf5;};'use strict';var multer=require(_0x6bd0('0x0'));var util=require(_0x6bd0('0x1'));var path=require(_0x6bd0('0x2'));var timeout=require('connect-timeout');var express=require(_0x6bd0('0x3'));var router=express[_0x6bd0('0x4')]();var fs_extra=require(_0x6bd0('0x5'));var auth=require(_0x6bd0('0x6'));var interaction=require(_0x6bd0('0x7'));var config=require(_0x6bd0('0x8'));var controller=require('./whatsappApplication.controller');router[_0x6bd0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6bd0('0x9')](_0x6bd0('0xa'),auth[_0x6bd0('0xb')](),controller['show']);router[_0x6bd0('0xc')]('/',auth[_0x6bd0('0xb')](),controller[_0x6bd0('0xd')]);router[_0x6bd0('0xe')](_0x6bd0('0xa'),auth[_0x6bd0('0xb')](),controller['update']);router[_0x6bd0('0xf')](_0x6bd0('0xa'),auth[_0x6bd0('0xb')](),controller[_0x6bd0('0x10')]);module[_0x6bd0('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 e4ebe05..ca7027a 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 _0x8d18=['*,*,*,*','sequelize','exports','STRING','noop','TEXT'];(function(_0x259d17,_0x220710){var _0x407535=function(_0x49bc38){while(--_0x49bc38){_0x259d17['push'](_0x259d17['shift']());}};_0x407535(++_0x220710);}(_0x8d18,0x73));var _0x88d1=function(_0x5af59e,_0x3771c1){_0x5af59e=_0x5af59e-0x0;var _0x4240df=_0x8d18[_0x5af59e];return _0x4240df;};'use strict';var Sequelize=require(_0x88d1('0x0'));module[_0x88d1('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x88d1('0x2')],'allowNull':![],'defaultValue':_0x88d1('0x3')},'appdata':{'type':Sequelize[_0x88d1('0x4')]()},'description':{'type':Sequelize[_0x88d1('0x2')]},'interval':{'type':Sequelize[_0x88d1('0x2')],'defaultValue':_0x88d1('0x5')}}; \ No newline at end of file +var _0xe3b2=['STRING','noop','TEXT','sequelize','exports','INTEGER'];(function(_0x35a329,_0x488fee){var _0x4cbdb1=function(_0x5042c0){while(--_0x5042c0){_0x35a329['push'](_0x35a329['shift']());}};_0x4cbdb1(++_0x488fee);}(_0xe3b2,0x153));var _0x2e3b=function(_0x1d750a,_0x15f819){_0x1d750a=_0x1d750a-0x0;var _0x5f333b=_0xe3b2[_0x1d750a];return _0x5f333b;};'use strict';var Sequelize=require(_0x2e3b('0x0'));module[_0x2e3b('0x1')]={'priority':{'type':Sequelize[_0x2e3b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2e3b('0x3')],'allowNull':![],'defaultValue':_0x2e3b('0x4')},'appdata':{'type':Sequelize[_0x2e3b('0x5')]()},'description':{'type':Sequelize[_0x2e3b('0x3')]},'interval':{'type':Sequelize[_0x2e3b('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index bc00e08..6b9de82 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 _0xab00=['include','rows','catch','show','options','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0xab00,0x1b9));var _0x0ab0=function(_0x327732,_0x8d928d){_0x327732=_0x327732-0x0;var _0x21893f=_0xab00[_0x327732];return _0x21893f;};'use strict';var emlformat=require(_0x0ab0('0x0'));var rimraf=require(_0x0ab0('0x1'));var zipdir=require(_0x0ab0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ab0('0x3'));var moment=require(_0x0ab0('0x4'));var BPromise=require(_0x0ab0('0x5'));var Mustache=require('mustache');var util=require(_0x0ab0('0x6'));var path=require('path');var sox=require(_0x0ab0('0x7'));var csv=require(_0x0ab0('0x8'));var ejs=require(_0x0ab0('0x9'));var fs=require('fs');var fs_extra=require(_0x0ab0('0xa'));var _=require(_0x0ab0('0xb'));var squel=require(_0x0ab0('0xc'));var crypto=require('crypto');var jsforce=require(_0x0ab0('0xd'));var deskjs=require(_0x0ab0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0ab0('0xf'));var Papa=require('papaparse');var Redis=require(_0x0ab0('0x10'));var authService=require(_0x0ab0('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0ab0('0x12'));var utils=require('../../config/utils');var config=require(_0x0ab0('0x13'));var licenseUtil=require(_0x0ab0('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2bf478,_0xfa9b2c){_0xfa9b2c=_0xfa9b2c||0xcc;return function(_0x332370){if(_0x332370){return _0x2bf478[_0x0ab0('0x15')](_0xfa9b2c);}return _0x2bf478[_0x0ab0('0x16')](_0xfa9b2c)[_0x0ab0('0x17')]();};}function respondWithResult(_0x906db9,_0x297262){_0x297262=_0x297262||0xc8;return function(_0x2dfcd3){if(_0x2dfcd3){return _0x906db9[_0x0ab0('0x16')](_0x297262)[_0x0ab0('0x18')](_0x2dfcd3);}};}function respondWithFilteredResult(_0x3c39b6,_0x55a322){return function(_0x5cf1cd){if(_0x5cf1cd){var _0x5f4a41=typeof _0x55a322[_0x0ab0('0x19')]===_0x0ab0('0x1a')&&typeof _0x55a322[_0x0ab0('0x1b')]==='undefined';var _0x49df08=_0x5cf1cd['count'];var _0x5b3bef=_0x5f4a41?0x0:_0x55a322['offset'];var _0x171341=_0x5f4a41?_0x5cf1cd[_0x0ab0('0x1c')]:_0x55a322[_0x0ab0('0x19')]+_0x55a322[_0x0ab0('0x1b')];var _0x454eb3;if(_0x171341>=_0x49df08){_0x171341=_0x49df08;_0x454eb3=0xc8;}else{_0x454eb3=0xce;}_0x3c39b6[_0x0ab0('0x16')](_0x454eb3);return _0x3c39b6[_0x0ab0('0x1d')]('Content-Range',_0x5b3bef+'-'+_0x171341+'/'+_0x49df08)['json'](_0x5cf1cd);}return null;};}function patchUpdates(_0x2cda33){return function(_0x1a87a2){try{jsonpatch[_0x0ab0('0x1e')](_0x1a87a2,_0x2cda33,!![]);}catch(_0x5c3382){return BPromise[_0x0ab0('0x1f')](_0x5c3382);}return _0x1a87a2['save']();};}function saveUpdates(_0x2691c7,_0x2ccb3e){return function(_0x20cd95){if(_0x20cd95){return _0x20cd95[_0x0ab0('0x20')](_0x2691c7)[_0x0ab0('0x21')](function(_0xc51b90){return _0xc51b90;});}return null;};}function removeEntity(_0x1bec79,_0x5795f0){return function(_0x2a4629){if(_0x2a4629){return _0x2a4629[_0x0ab0('0x22')]()[_0x0ab0('0x21')](function(){_0x1bec79['status'](0xcc)[_0x0ab0('0x17')]();});}};}function handleEntityNotFound(_0xd7c564,_0x3e9afd){return function(_0x5add07){if(!_0x5add07){_0xd7c564[_0x0ab0('0x15')](0x194);}return _0x5add07;};}function handleError(_0x34c9e6,_0x113386){_0x113386=_0x113386||0x1f4;return function(_0x2a4f7c){logger[_0x0ab0('0x23')](_0x2a4f7c['stack']);if(_0x2a4f7c[_0x0ab0('0x24')]){delete _0x2a4f7c['name'];}_0x34c9e6[_0x0ab0('0x16')](_0x113386)[_0x0ab0('0x25')](_0x2a4f7c);};}exports[_0x0ab0('0x26')]=function(_0x29e200,_0x5ae993){var _0x4764fc={},_0x5e7e2b={},_0x2c29c0={'count':0x0,'rows':[]};var _0x34f67e=_[_0x0ab0('0x27')](db[_0x0ab0('0x28')][_0x0ab0('0x29')],function(_0xa9cb4f){return{'name':_0xa9cb4f[_0x0ab0('0x2a')],'type':_0xa9cb4f[_0x0ab0('0x2b')][_0x0ab0('0x2c')]};});_0x5e7e2b[_0x0ab0('0x2d')]=_[_0x0ab0('0x27')](_0x34f67e,_0x0ab0('0x24'));_0x5e7e2b['query']=_[_0x0ab0('0x2e')](_0x29e200[_0x0ab0('0x2f')]);_0x5e7e2b[_0x0ab0('0x30')]=_[_0x0ab0('0x31')](_0x5e7e2b[_0x0ab0('0x2d')],_0x5e7e2b[_0x0ab0('0x2f')]);_0x4764fc['attributes']=_['intersection'](_0x5e7e2b[_0x0ab0('0x2d')],qs[_0x0ab0('0x32')](_0x29e200[_0x0ab0('0x2f')][_0x0ab0('0x32')]));_0x4764fc[_0x0ab0('0x33')]=_0x4764fc[_0x0ab0('0x33')][_0x0ab0('0x34')]?_0x4764fc['attributes']:_0x5e7e2b[_0x0ab0('0x2d')];if(!_0x29e200[_0x0ab0('0x2f')][_0x0ab0('0x35')](_0x0ab0('0x36'))){_0x4764fc['limit']=qs[_0x0ab0('0x1b')](_0x29e200['query'][_0x0ab0('0x1b')]);_0x4764fc['offset']=qs['offset'](_0x29e200[_0x0ab0('0x2f')]['offset']);}_0x4764fc[_0x0ab0('0x37')]=qs[_0x0ab0('0x38')](_0x29e200[_0x0ab0('0x2f')][_0x0ab0('0x38')]);_0x4764fc[_0x0ab0('0x39')]=qs[_0x0ab0('0x30')](_[_0x0ab0('0x3a')](_0x29e200['query'],_0x5e7e2b['filters']),_0x34f67e);if(_0x29e200['query'][_0x0ab0('0x3b')]){_0x4764fc[_0x0ab0('0x39')]=_[_0x0ab0('0x3c')](_0x4764fc['where'],{'$or':_['map'](_0x34f67e,function(_0x7585c4){if(_0x7585c4[_0x0ab0('0x2b')]!==_0x0ab0('0x3d')){var _0x1438ff={};_0x1438ff[_0x7585c4[_0x0ab0('0x24')]]={'$like':'%'+_0x29e200[_0x0ab0('0x2f')]['filter']+'%'};return _0x1438ff;}})});}_0x4764fc=_[_0x0ab0('0x3c')]({},_0x4764fc,_0x29e200['options']);var _0x542c44={'where':_0x4764fc[_0x0ab0('0x39')]};return db['WhatsappApplication'][_0x0ab0('0x1c')](_0x542c44)[_0x0ab0('0x21')](function(_0x5be95a){_0x2c29c0['count']=_0x5be95a;if(_0x29e200['query'][_0x0ab0('0x3e')]){_0x4764fc[_0x0ab0('0x3f')]=[{'all':!![]}];}return db[_0x0ab0('0x28')]['findAll'](_0x4764fc);})[_0x0ab0('0x21')](function(_0x3db8a6){_0x2c29c0[_0x0ab0('0x40')]=_0x3db8a6;return _0x2c29c0;})['then'](respondWithFilteredResult(_0x5ae993,_0x4764fc))[_0x0ab0('0x41')](handleError(_0x5ae993,null));};exports[_0x0ab0('0x42')]=function(_0x3b30e8,_0x1e21f2){var _0x18b5f5={'raw':!![],'where':{'id':_0x3b30e8['params']['id']}},_0x51cf3f={};_0x51cf3f[_0x0ab0('0x2d')]=_[_0x0ab0('0x2e')](db[_0x0ab0('0x28')][_0x0ab0('0x29')]);_0x51cf3f[_0x0ab0('0x2f')]=_[_0x0ab0('0x2e')](_0x3b30e8['query']);_0x51cf3f[_0x0ab0('0x30')]=_[_0x0ab0('0x31')](_0x51cf3f[_0x0ab0('0x2d')],_0x51cf3f[_0x0ab0('0x2f')]);_0x18b5f5['attributes']=_['intersection'](_0x51cf3f[_0x0ab0('0x2d')],qs[_0x0ab0('0x32')](_0x3b30e8[_0x0ab0('0x2f')][_0x0ab0('0x32')]));_0x18b5f5[_0x0ab0('0x33')]=_0x18b5f5[_0x0ab0('0x33')][_0x0ab0('0x34')]?_0x18b5f5['attributes']:_0x51cf3f['model'];if(_0x3b30e8['query'][_0x0ab0('0x3e')]){_0x18b5f5[_0x0ab0('0x3f')]=[{'all':!![]}];}_0x18b5f5=_[_0x0ab0('0x3c')]({},_0x18b5f5,_0x3b30e8[_0x0ab0('0x43')]);return db[_0x0ab0('0x28')][_0x0ab0('0x44')](_0x18b5f5)[_0x0ab0('0x21')](handleEntityNotFound(_0x1e21f2,null))['then'](respondWithResult(_0x1e21f2,null))[_0x0ab0('0x41')](handleError(_0x1e21f2,null));};exports[_0x0ab0('0x45')]=function(_0x39519e,_0x30d400){return db[_0x0ab0('0x28')][_0x0ab0('0x45')](_0x39519e[_0x0ab0('0x46')],{})[_0x0ab0('0x21')](respondWithResult(_0x30d400,0xc9))['catch'](handleError(_0x30d400,null));};exports['update']=function(_0x37e688,_0x318301){if(_0x37e688[_0x0ab0('0x46')]['id']){delete _0x37e688[_0x0ab0('0x46')]['id'];}return db[_0x0ab0('0x28')][_0x0ab0('0x44')]({'where':{'id':_0x37e688['params']['id']}})[_0x0ab0('0x21')](handleEntityNotFound(_0x318301,null))[_0x0ab0('0x21')](saveUpdates(_0x37e688[_0x0ab0('0x46')],null))[_0x0ab0('0x21')](respondWithResult(_0x318301,null))[_0x0ab0('0x41')](handleError(_0x318301,null));};exports[_0x0ab0('0x22')]=function(_0x35f269,_0xcd971a){return db[_0x0ab0('0x28')][_0x0ab0('0x44')]({'where':{'id':_0x35f269[_0x0ab0('0x47')]['id']}})[_0x0ab0('0x21')](handleEntityNotFound(_0xcd971a,null))[_0x0ab0('0x21')](removeEntity(_0xcd971a,null))[_0x0ab0('0x41')](handleError(_0xcd971a,null));}; \ No newline at end of file +var _0x8b8e=['limit','count','set','Content-Range','json','apply','reject','save','update','destroy','error','stack','name','index','map','WhatsappApplication','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','then','rows','params','includeAll','catch','create','body','find','eml-format','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined'];(function(_0x12a75e,_0x120b6e){var _0x300da0=function(_0x268b29){while(--_0x268b29){_0x12a75e['push'](_0x12a75e['shift']());}};_0x300da0(++_0x120b6e);}(_0x8b8e,0x108));var _0xe8b8=function(_0x89b64d,_0x103fbe){_0x89b64d=_0x89b64d-0x0;var _0x502980=_0x8b8e[_0x89b64d];return _0x502980;};'use strict';var emlformat=require(_0xe8b8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe8b8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe8b8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe8b8('0x3'));var util=require(_0xe8b8('0x4'));var path=require(_0xe8b8('0x5'));var sox=require(_0xe8b8('0x6'));var csv=require(_0xe8b8('0x7'));var ejs=require(_0xe8b8('0x8'));var fs=require('fs');var fs_extra=require(_0xe8b8('0x9'));var _=require(_0xe8b8('0xa'));var squel=require(_0xe8b8('0xb'));var crypto=require(_0xe8b8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe8b8('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe8b8('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe8b8('0xf'));var qs=require(_0xe8b8('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe8b8('0x11'))(_0xe8b8('0x12'));var utils=require(_0xe8b8('0x13'));var config=require(_0xe8b8('0x14'));var licenseUtil=require(_0xe8b8('0x15'));var db=require(_0xe8b8('0x16'))['db'];function respondWithStatusCode(_0x3de76b,_0x11fb1a){_0x11fb1a=_0x11fb1a||0xcc;return function(_0x151e09){if(_0x151e09){return _0x3de76b[_0xe8b8('0x17')](_0x11fb1a);}return _0x3de76b[_0xe8b8('0x18')](_0x11fb1a)[_0xe8b8('0x19')]();};}function respondWithResult(_0x30bfc7,_0x43698d){_0x43698d=_0x43698d||0xc8;return function(_0x4a3e9f){if(_0x4a3e9f){return _0x30bfc7[_0xe8b8('0x18')](_0x43698d)['json'](_0x4a3e9f);}};}function respondWithFilteredResult(_0x282ea8,_0x290c30){return function(_0x288699){if(_0x288699){var _0x36df40=typeof _0x290c30[_0xe8b8('0x1a')]===_0xe8b8('0x1b')&&typeof _0x290c30[_0xe8b8('0x1c')]===_0xe8b8('0x1b');var _0x4110b6=_0x288699[_0xe8b8('0x1d')];var _0x504738=_0x36df40?0x0:_0x290c30[_0xe8b8('0x1a')];var _0xaba717=_0x36df40?_0x288699['count']:_0x290c30[_0xe8b8('0x1a')]+_0x290c30[_0xe8b8('0x1c')];var _0x2b2b80;if(_0xaba717>=_0x4110b6){_0xaba717=_0x4110b6;_0x2b2b80=0xc8;}else{_0x2b2b80=0xce;}_0x282ea8[_0xe8b8('0x18')](_0x2b2b80);return _0x282ea8[_0xe8b8('0x1e')](_0xe8b8('0x1f'),_0x504738+'-'+_0xaba717+'/'+_0x4110b6)[_0xe8b8('0x20')](_0x288699);}return null;};}function patchUpdates(_0x36c273){return function(_0x29e96){try{jsonpatch[_0xe8b8('0x21')](_0x29e96,_0x36c273,!![]);}catch(_0x3fdc80){return BPromise[_0xe8b8('0x22')](_0x3fdc80);}return _0x29e96[_0xe8b8('0x23')]();};}function saveUpdates(_0x15abeb,_0x35dc1d){return function(_0x838cd4){if(_0x838cd4){return _0x838cd4[_0xe8b8('0x24')](_0x15abeb)['then'](function(_0x57faf7){return _0x57faf7;});}return null;};}function removeEntity(_0x566721,_0x4769fe){return function(_0x51297e){if(_0x51297e){return _0x51297e[_0xe8b8('0x25')]()['then'](function(){_0x566721[_0xe8b8('0x18')](0xcc)[_0xe8b8('0x19')]();});}};}function handleEntityNotFound(_0x5e3fa2,_0x5ac435){return function(_0x19f7b3){if(!_0x19f7b3){_0x5e3fa2[_0xe8b8('0x17')](0x194);}return _0x19f7b3;};}function handleError(_0x56f459,_0x3ce9b2){_0x3ce9b2=_0x3ce9b2||0x1f4;return function(_0x32141f){logger[_0xe8b8('0x26')](_0x32141f[_0xe8b8('0x27')]);if(_0x32141f[_0xe8b8('0x28')]){delete _0x32141f['name'];}_0x56f459[_0xe8b8('0x18')](_0x3ce9b2)['send'](_0x32141f);};}exports[_0xe8b8('0x29')]=function(_0x402e6c,_0x28d703){var _0x390154={},_0x589877={},_0x50c1f6={'count':0x0,'rows':[]};var _0xc98ea8=_[_0xe8b8('0x2a')](db[_0xe8b8('0x2b')][_0xe8b8('0x2c')],function(_0x2f92a5){return{'name':_0x2f92a5['fieldName'],'type':_0x2f92a5[_0xe8b8('0x2d')][_0xe8b8('0x2e')]};});_0x589877[_0xe8b8('0x2f')]=_[_0xe8b8('0x2a')](_0xc98ea8,_0xe8b8('0x28'));_0x589877[_0xe8b8('0x30')]=_[_0xe8b8('0x31')](_0x402e6c[_0xe8b8('0x30')]);_0x589877[_0xe8b8('0x32')]=_[_0xe8b8('0x33')](_0x589877[_0xe8b8('0x2f')],_0x589877['query']);_0x390154[_0xe8b8('0x34')]=_[_0xe8b8('0x33')](_0x589877[_0xe8b8('0x2f')],qs['fields'](_0x402e6c[_0xe8b8('0x30')][_0xe8b8('0x35')]));_0x390154[_0xe8b8('0x34')]=_0x390154[_0xe8b8('0x34')][_0xe8b8('0x36')]?_0x390154[_0xe8b8('0x34')]:_0x589877[_0xe8b8('0x2f')];if(!_0x402e6c[_0xe8b8('0x30')][_0xe8b8('0x37')]('nolimit')){_0x390154[_0xe8b8('0x1c')]=qs[_0xe8b8('0x1c')](_0x402e6c['query'][_0xe8b8('0x1c')]);_0x390154[_0xe8b8('0x1a')]=qs[_0xe8b8('0x1a')](_0x402e6c[_0xe8b8('0x30')][_0xe8b8('0x1a')]);}_0x390154['order']=qs[_0xe8b8('0x38')](_0x402e6c[_0xe8b8('0x30')][_0xe8b8('0x38')]);_0x390154[_0xe8b8('0x39')]=qs[_0xe8b8('0x32')](_[_0xe8b8('0x3a')](_0x402e6c['query'],_0x589877[_0xe8b8('0x32')]),_0xc98ea8);if(_0x402e6c['query'][_0xe8b8('0x3b')]){_0x390154[_0xe8b8('0x39')]=_['merge'](_0x390154['where'],{'$or':_[_0xe8b8('0x2a')](_0xc98ea8,function(_0x1ae916){if(_0x1ae916[_0xe8b8('0x2d')]!==_0xe8b8('0x3c')){var _0x53a18d={};_0x53a18d[_0x1ae916[_0xe8b8('0x28')]]={'$like':'%'+_0x402e6c[_0xe8b8('0x30')][_0xe8b8('0x3b')]+'%'};return _0x53a18d;}})});}_0x390154=_[_0xe8b8('0x3d')]({},_0x390154,_0x402e6c[_0xe8b8('0x3e')]);var _0xecddc8={'where':_0x390154[_0xe8b8('0x39')]};return db[_0xe8b8('0x2b')]['count'](_0xecddc8)['then'](function(_0x2086fa){_0x50c1f6[_0xe8b8('0x1d')]=_0x2086fa;if(_0x402e6c[_0xe8b8('0x30')]['includeAll']){_0x390154[_0xe8b8('0x3f')]=[{'all':!![]}];}return db[_0xe8b8('0x2b')][_0xe8b8('0x40')](_0x390154);})[_0xe8b8('0x41')](function(_0x3fa8b2){_0x50c1f6[_0xe8b8('0x42')]=_0x3fa8b2;return _0x50c1f6;})[_0xe8b8('0x41')](respondWithFilteredResult(_0x28d703,_0x390154))['catch'](handleError(_0x28d703,null));};exports['show']=function(_0x4a851f,_0x16480b){var _0x1b553e={'raw':!![],'where':{'id':_0x4a851f[_0xe8b8('0x43')]['id']}},_0x1068eb={};_0x1068eb['model']=_[_0xe8b8('0x31')](db[_0xe8b8('0x2b')][_0xe8b8('0x2c')]);_0x1068eb[_0xe8b8('0x30')]=_['keys'](_0x4a851f['query']);_0x1068eb[_0xe8b8('0x32')]=_[_0xe8b8('0x33')](_0x1068eb[_0xe8b8('0x2f')],_0x1068eb['query']);_0x1b553e[_0xe8b8('0x34')]=_[_0xe8b8('0x33')](_0x1068eb[_0xe8b8('0x2f')],qs[_0xe8b8('0x35')](_0x4a851f['query'][_0xe8b8('0x35')]));_0x1b553e[_0xe8b8('0x34')]=_0x1b553e[_0xe8b8('0x34')][_0xe8b8('0x36')]?_0x1b553e[_0xe8b8('0x34')]:_0x1068eb[_0xe8b8('0x2f')];if(_0x4a851f[_0xe8b8('0x30')][_0xe8b8('0x44')]){_0x1b553e[_0xe8b8('0x3f')]=[{'all':!![]}];}_0x1b553e=_[_0xe8b8('0x3d')]({},_0x1b553e,_0x4a851f[_0xe8b8('0x3e')]);return db[_0xe8b8('0x2b')]['find'](_0x1b553e)['then'](handleEntityNotFound(_0x16480b,null))[_0xe8b8('0x41')](respondWithResult(_0x16480b,null))[_0xe8b8('0x45')](handleError(_0x16480b,null));};exports[_0xe8b8('0x46')]=function(_0x340880,_0xb78cdb){return db[_0xe8b8('0x2b')][_0xe8b8('0x46')](_0x340880['body'],{})['then'](respondWithResult(_0xb78cdb,0xc9))[_0xe8b8('0x45')](handleError(_0xb78cdb,null));};exports[_0xe8b8('0x24')]=function(_0x5f1e0c,_0x41a1d1){if(_0x5f1e0c[_0xe8b8('0x47')]['id']){delete _0x5f1e0c[_0xe8b8('0x47')]['id'];}return db[_0xe8b8('0x2b')][_0xe8b8('0x48')]({'where':{'id':_0x5f1e0c[_0xe8b8('0x43')]['id']}})[_0xe8b8('0x41')](handleEntityNotFound(_0x41a1d1,null))[_0xe8b8('0x41')](saveUpdates(_0x5f1e0c[_0xe8b8('0x47')],null))[_0xe8b8('0x41')](respondWithResult(_0x41a1d1,null))[_0xe8b8('0x45')](handleError(_0x41a1d1,null));};exports[_0xe8b8('0x25')]=function(_0x5a5322,_0x39f11e){return db['WhatsappApplication'][_0xe8b8('0x48')]({'where':{'id':_0x5a5322[_0xe8b8('0x43')]['id']}})[_0xe8b8('0x41')](handleEntityNotFound(_0x39f11e,null))[_0xe8b8('0x41')](removeEntity(_0x39f11e,null))['catch'](handleError(_0x39f11e,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index c7f5d5f..ca517c3 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 _0xcca7=['../../config/environment','./whatsappApplication.attributes','exports','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','rimraf'];(function(_0x21b36c,_0x543483){var _0x236627=function(_0x174f99){while(--_0x174f99){_0x21b36c['push'](_0x21b36c['shift']());}};_0x236627(++_0x543483);}(_0xcca7,0x1aa));var _0x7cca=function(_0x25ae39,_0x10de45){_0x25ae39=_0x25ae39-0x0;var _0x396450=_0xcca7[_0x25ae39];return _0x396450;};'use strict';var _=require(_0x7cca('0x0'));var util=require(_0x7cca('0x1'));var logger=require(_0x7cca('0x2'))(_0x7cca('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7cca('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7cca('0x5'));var config=require(_0x7cca('0x6'));var attributes=require(_0x7cca('0x7'));module[_0x7cca('0x8')]=function(_0x1c6c95,_0xe70805){return _0x1c6c95['define']('WhatsappApplication',attributes,{'tableName':_0x7cca('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7cca('0xa'),'collate':_0x7cca('0xb')});}; \ No newline at end of file +var _0xae24=['rimraf','./whatsappApplication.attributes','exports','define','WhatsappApplication','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird'];(function(_0x54e5cd,_0x4ce323){var _0x78dbaf=function(_0x1cc019){while(--_0x1cc019){_0x54e5cd['push'](_0x54e5cd['shift']());}};_0x78dbaf(++_0x4ce323);}(_0xae24,0x182));var _0x4ae2=function(_0x1c99cc,_0x5de1d9){_0x1c99cc=_0x1c99cc-0x0;var _0x57fd22=_0xae24[_0x1c99cc];return _0x57fd22;};'use strict';var _=require(_0x4ae2('0x0'));var util=require('util');var logger=require(_0x4ae2('0x1'))('api');var moment=require(_0x4ae2('0x2'));var BPromise=require(_0x4ae2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ae2('0x4'));var config=require('../../config/environment');var attributes=require(_0x4ae2('0x5'));module[_0x4ae2('0x6')]=function(_0x20c85c,_0x3e6055){return _0x20c85c[_0x4ae2('0x7')](_0x4ae2('0x8'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x4ae2('0x9')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index f11d336..a119372 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 _0x6f0d=['WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x303e92,_0x5f54f8){var _0x5020e9=function(_0x1b3d32){while(--_0x1b3d32){_0x303e92['push'](_0x303e92['shift']());}};_0x5020e9(++_0x5f54f8);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x32ff69,_0x256ac8){_0x32ff69=_0x32ff69-0x0;var _0x3d4938=_0x6f0d[_0x32ff69];return _0x3d4938;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var moment=require(_0xd6f0('0x1'));var BPromise=require(_0xd6f0('0x2'));var rs=require(_0xd6f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6f0('0x4'))['db'];var utils=require(_0xd6f0('0x5'));var logger=require(_0xd6f0('0x6'))(_0xd6f0('0x7'));var config=require(_0xd6f0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd6f0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe21ac4,_0x1af29c,_0x8b89a9){return new BPromise(function(_0x1a48a0,_0x4c4916){return client['request'](_0xe21ac4,_0x8b89a9)[_0xd6f0('0xa')](function(_0x272c4e){logger[_0xd6f0('0xb')](_0xd6f0('0xc'),_0x1af29c,_0xd6f0('0xd'));logger['debug'](_0xd6f0('0xe'),_0x1af29c,_0xd6f0('0xd'),JSON[_0xd6f0('0xf')](_0x272c4e));if(_0x272c4e[_0xd6f0('0x10')]){if(_0x272c4e['error'][_0xd6f0('0x11')]===0x1f4){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);return _0x4c4916(_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);}logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e['error'][_0xd6f0('0x12')]);return _0x1a48a0(_0x272c4e[_0xd6f0('0x10')]['message']);}else{logger[_0xd6f0('0xb')]('WhatsappApplication,\x20%s,\x20%s',_0x1af29c,_0xd6f0('0xd'));_0x1a48a0(_0x272c4e[_0xd6f0('0x13')][_0xd6f0('0x12')]);}})[_0xd6f0('0x14')](function(_0x64ff5f){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x64ff5f);_0x4c4916(_0x64ff5f);});});} \ No newline at end of file +var _0xe14d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x58cb4a,_0x1ff6c9){var _0x99400a=function(_0x206299){while(--_0x206299){_0x58cb4a['push'](_0x58cb4a['shift']());}};_0x99400a(++_0x1ff6c9);}(_0xe14d,0x1ee));var _0xde14=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0xe14d[_0x494d1f];return _0x457b6e;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var moment=require(_0xde14('0x2'));var BPromise=require(_0xde14('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde14('0x4'));var db=require(_0xde14('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xde14('0x6'))(_0xde14('0x7'));var config=require(_0xde14('0x8'));var jayson=require(_0xde14('0x9'));var client=jayson[_0xde14('0xa')][_0xde14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b1f6b,_0x5a1344,_0x1bd49d){return new BPromise(function(_0x115b7d,_0x2b0e7c){return client[_0xde14('0xc')](_0x4b1f6b,_0x1bd49d)[_0xde14('0xd')](function(_0x176909){logger[_0xde14('0xe')](_0xde14('0xf'),_0x5a1344,'request\x20sent');logger[_0xde14('0x10')](_0xde14('0x11'),_0x5a1344,_0xde14('0x12'),JSON[_0xde14('0x13')](_0x176909));if(_0x176909[_0xde14('0x14')]){if(_0x176909[_0xde14('0x14')][_0xde14('0x15')]===0x1f4){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909[_0xde14('0x14')][_0xde14('0x16')]);return _0x2b0e7c(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909['error']['message']);return _0x115b7d(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}else{logger[_0xde14('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x5a1344,_0xde14('0x12'));_0x115b7d(_0x176909[_0xde14('0x17')][_0xde14('0x16')]);}})[_0xde14('0x18')](function(_0x3de959){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x3de959);_0x2b0e7c(_0x3de959);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 4fec366..d42992e 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 _0x5a5a=['/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','whatsapp','whatsappinteraction:addtags','addTags','put','tracked','update','delete','whatsappinteraction:destroy','removeTags','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id','show'];(function(_0x12861e,_0x44ac5f){var _0x5ec3f1=function(_0x165278){while(--_0x165278){_0x12861e['push'](_0x12861e['shift']());}};_0x5ec3f1(++_0x44ac5f);}(_0x5a5a,0x1d1));var _0xa5a5=function(_0x44a3a6,_0x59abd5){_0x44a3a6=_0x44a3a6-0x0;var _0x5e395b=_0x5a5a[_0x44a3a6];return _0x5e395b;};'use strict';var multer=require('multer');var util=require(_0xa5a5('0x0'));var path=require(_0xa5a5('0x1'));var timeout=require(_0xa5a5('0x2'));var express=require(_0xa5a5('0x3'));var router=express[_0xa5a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa5a5('0x5'));var interaction=require(_0xa5a5('0x6'));var config=require(_0xa5a5('0x7'));var controller=require('./whatsappInteraction.controller');router['get']('/',auth[_0xa5a5('0x8')](),controller[_0xa5a5('0x9')]);router['get'](_0xa5a5('0xa'),auth[_0xa5a5('0x8')](),controller[_0xa5a5('0xb')]);router[_0xa5a5('0xc')](_0xa5a5('0xd'),auth['isAuthenticated'](),controller[_0xa5a5('0xe')]);router[_0xa5a5('0xc')](_0xa5a5('0xf'),auth[_0xa5a5('0x8')](),controller[_0xa5a5('0x10')]);router[_0xa5a5('0xc')](_0xa5a5('0x11'),auth[_0xa5a5('0x8')](),controller[_0xa5a5('0x12')]);router[_0xa5a5('0x13')]('/',auth[_0xa5a5('0x8')](),controller[_0xa5a5('0x14')]);router['post'](_0xa5a5('0xf'),auth[_0xa5a5('0x8')](),controller[_0xa5a5('0x15')]);router[_0xa5a5('0x13')](_0xa5a5('0x16'),auth[_0xa5a5('0x8')](),interaction['tracked'](_0xa5a5('0x17'),_0xa5a5('0x18')),controller[_0xa5a5('0x19')]);router[_0xa5a5('0x1a')](_0xa5a5('0xd'),auth[_0xa5a5('0x8')](),interaction[_0xa5a5('0x1b')](_0xa5a5('0x17'),'whatsappinteraction:update'),controller[_0xa5a5('0x1c')]);router[_0xa5a5('0x1d')](_0xa5a5('0xd'),auth[_0xa5a5('0x8')](),interaction[_0xa5a5('0x1b')](_0xa5a5('0x17'),_0xa5a5('0x1e')),controller['destroy']);router[_0xa5a5('0x1d')](_0xa5a5('0x16'),auth[_0xa5a5('0x8')](),controller[_0xa5a5('0x1f')]);module['exports']=router; \ No newline at end of file +var _0x4975=['removeTags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','create','post','addMessage','/:id/tags','tracked','whatsapp','addTags','whatsappinteraction:update','update','delete','whatsappinteraction:destroy'];(function(_0xf91841,_0x182ae3){var _0x4b9c44=function(_0x2e216e){while(--_0x2e216e){_0xf91841['push'](_0xf91841['shift']());}};_0x4b9c44(++_0x182ae3);}(_0x4975,0x86));var _0x5497=function(_0x31145b,_0x236aec){_0x31145b=_0x31145b-0x0;var _0x106eb5=_0x4975[_0x31145b];return _0x106eb5;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0xa')](_0x5497('0x11'),auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0xa')](_0x5497('0x13'),auth[_0x5497('0xd')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x5497('0x14')]);router[_0x5497('0x15')](_0x5497('0x11'),auth[_0x5497('0xd')](),controller[_0x5497('0x16')]);router[_0x5497('0x15')](_0x5497('0x17'),auth[_0x5497('0xd')](),interaction[_0x5497('0x18')](_0x5497('0x19'),'whatsappinteraction:addtags'),controller[_0x5497('0x1a')]);router['put'](_0x5497('0xf'),auth[_0x5497('0xd')](),interaction[_0x5497('0x18')](_0x5497('0x19'),_0x5497('0x1b')),controller[_0x5497('0x1c')]);router[_0x5497('0x1d')]('/:id',auth['isAuthenticated'](),interaction[_0x5497('0x18')](_0x5497('0x19'),_0x5497('0x1e')),controller['destroy']);router[_0x5497('0x1d')](_0x5497('0x17'),auth[_0x5497('0xd')](),controller[_0x5497('0x1f')]);module[_0x5497('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 e35f208..fab39b8 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 _0x7ad3=['sequelize','moment','exports','BOOLEAN','STRING','out','DATE','ENUM'];(function(_0x20ba52,_0xacc64e){var _0x1c625e=function(_0x338a84){while(--_0x338a84){_0x20ba52['push'](_0x20ba52['shift']());}};_0x1c625e(++_0xacc64e);}(_0x7ad3,0x108));var _0x37ad=function(_0x2074db,_0x10b81b){_0x2074db=_0x2074db-0x0;var _0x27324c=_0x7ad3[_0x2074db];return _0x27324c;};'use strict';var Sequelize=require(_0x37ad('0x0'));var moment=require(_0x37ad('0x1'));module[_0x37ad('0x2')]={'closed':{'type':Sequelize[_0x37ad('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x37ad('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x37ad('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x37ad('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x37ad('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x37ad('0x7')]('in',_0x37ad('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x37ad('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x24ca=['STRING','ENUM','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x222aad,_0x53012a){var _0x341776=function(_0x2927ee){while(--_0x2927ee){_0x222aad['push'](_0x222aad['shift']());}};_0x341776(++_0x53012a);}(_0x24ca,0x1bc));var _0xa24c=function(_0xa79977,_0x4f7f12){_0xa79977=_0xa79977-0x0;var _0x109f10=_0x24ca[_0xa79977];return _0x109f10;};'use strict';var Sequelize=require(_0xa24c('0x0'));var moment=require('moment');module[_0xa24c('0x1')]={'closed':{'type':Sequelize[_0xa24c('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa24c('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xa24c('0x4')]},'thirdDisposition':{'type':Sequelize[_0xa24c('0x4')]},'note':{'type':Sequelize[_0xa24c('0x4')]},'phone':{'type':Sequelize[_0xa24c('0x4')]},'read1stAt':{'type':Sequelize[_0xa24c('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xa24c('0x5')]('in',_0xa24c('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa24c('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xa24c('0x5')]('in',_0xa24c('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa24c('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index a7f6703..3cca82a 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 _0x7e16=['`\x20>\x200','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','clone','contactName','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','rows','catch','params','include','create','describe','addMessage','omit','getMessages','findOne','pick','WhatsappInteractionId','format','options','WhatsappMessage','includeAll','ids','spread','findAll','emit','whatsappInteractionTags:save','unix','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','fullname','CmContact','Contact','firstName','Attachment','direction','secret','WhatsappAccount','get','Whatsapp','Account','Owner','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','basename','existsSync','pipe','out','System','lastName','renderFile','downloadInteraction.ejs','.pdf','createPdfFromHTML','download','log','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/environment','redis','defaults','localhost','./whatsappInteraction.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','TagIds','Tags','split','forEach','push','map','WhatsappInteraction','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','field','color','from','select','u.id','u.fullname','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','tools_tags','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200'];(function(_0x376bd7,_0x107c2d){var _0x50dcf1=function(_0x4e65ea){while(--_0x4e65ea){_0x376bd7['push'](_0x376bd7['shift']());}};_0x50dcf1(++_0x107c2d);}(_0x7e16,0x16f));var _0x67e1=function(_0x5a5c06,_0x2749dd){_0x5a5c06=_0x5a5c06-0x0;var _0x14f2f2=_0x7e16[_0x5a5c06];return _0x14f2f2;};'use strict';var emlformat=require(_0x67e1('0x0'));var rimraf=require(_0x67e1('0x1'));var zipdir=require(_0x67e1('0x2'));var jsonpatch=require(_0x67e1('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x67e1('0x4'));var Mustache=require('mustache');var util=require(_0x67e1('0x5'));var path=require(_0x67e1('0x6'));var sox=require('sox');var csv=require(_0x67e1('0x7'));var ejs=require(_0x67e1('0x8'));var fs=require('fs');var fs_extra=require(_0x67e1('0x9'));var _=require(_0x67e1('0xa'));var squel=require(_0x67e1('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x67e1('0x7'));var querystring=require(_0x67e1('0xc'));var Papa=require(_0x67e1('0xd'));var Redis=require(_0x67e1('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x67e1('0xf'));var as=require(_0x67e1('0x10'));var pdf=require(_0x67e1('0x11'));var hardwareService=require(_0x67e1('0x12'));var logger=require('../../config/logger')(_0x67e1('0x13'));var utils=require('../../config/utils');var config=require(_0x67e1('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x67e1('0x15')]=_[_0x67e1('0x16')](config[_0x67e1('0x15')],{'host':_0x67e1('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x67e1('0x15')]));require(_0x67e1('0x18'))[_0x67e1('0x19')](socket);function respondWithStatusCode(_0x4c2e34,_0x208013){_0x208013=_0x208013||0xcc;return function(_0x2cb7c1){if(_0x2cb7c1){return _0x4c2e34[_0x67e1('0x1a')](_0x208013);}return _0x4c2e34[_0x67e1('0x1b')](_0x208013)[_0x67e1('0x1c')]();};}function respondWithResult(_0x45b9df,_0x216ad4){_0x216ad4=_0x216ad4||0xc8;return function(_0x406ffe){if(_0x406ffe){return _0x45b9df[_0x67e1('0x1b')](_0x216ad4)[_0x67e1('0x1d')](_0x406ffe);}};}function respondWithFilteredResult(_0x577400,_0x14ab29){return function(_0x9e931d){if(_0x9e931d){var _0x2c36b8=typeof _0x14ab29['offset']==='undefined'&&typeof _0x14ab29['limit']===_0x67e1('0x1e');var _0xaabf4f=_0x9e931d[_0x67e1('0x1f')];var _0x31b9cc=_0x2c36b8?0x0:_0x14ab29['offset'];var _0x39807c=_0x2c36b8?_0x9e931d[_0x67e1('0x1f')]:_0x14ab29[_0x67e1('0x20')]+_0x14ab29[_0x67e1('0x21')];var _0x5b3c79;if(_0x39807c>=_0xaabf4f){_0x39807c=_0xaabf4f;_0x5b3c79=0xc8;}else{_0x5b3c79=0xce;}_0x577400[_0x67e1('0x1b')](_0x5b3c79);return _0x577400[_0x67e1('0x22')](_0x67e1('0x23'),_0x31b9cc+'-'+_0x39807c+'/'+_0xaabf4f)[_0x67e1('0x1d')](_0x9e931d);}return null;};}function patchUpdates(_0xcd4943){return function(_0x2a627d){try{jsonpatch[_0x67e1('0x24')](_0x2a627d,_0xcd4943,!![]);}catch(_0x571930){return BPromise[_0x67e1('0x25')](_0x571930);}return _0x2a627d[_0x67e1('0x26')]();};}function saveUpdates(_0xa44c7b,_0x1cae53){return function(_0x343cd7){if(_0x343cd7){return _0x343cd7[_0x67e1('0x27')](_0xa44c7b)[_0x67e1('0x28')](function(_0x274b69){return _0x274b69;});}return null;};}function removeEntity(_0x25e094,_0x2fc2be){return function(_0x59ae5e){if(_0x59ae5e){return _0x59ae5e[_0x67e1('0x29')]()[_0x67e1('0x28')](function(){_0x25e094[_0x67e1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1778ec,_0x5ddb2f){return function(_0x2d19a4){if(!_0x2d19a4){_0x1778ec[_0x67e1('0x1a')](0x194);}return _0x2d19a4;};}function handleError(_0x1e14b7,_0x544371){_0x544371=_0x544371||0x1f4;return function(_0x710c50){logger['error'](_0x710c50[_0x67e1('0x2a')]);if(_0x710c50[_0x67e1('0x2b')]){delete _0x710c50['name'];}_0x1e14b7[_0x67e1('0x1b')](_0x544371)[_0x67e1('0x2c')](_0x710c50);};}function getInteractionUsers(_0x1bbe01,_0x1fd992){return new BPromise(function(_0x226851,_0x4594d1){try{if(_0x1fd992[_0x1bbe01['id']]){_0x1bbe01['Users']=_['map'](_0x1fd992[_0x1bbe01['id']],function(_0x5343a6){return{'id':_0x5343a6['id'],'fullname':_0x5343a6['fullname']};});}}catch(_0x3a7d56){_0x4594d1(_0x3a7d56);}_0x226851(_0x1bbe01);});}function getInteractionTags(_0x2f347b,_0x4928b6){return new BPromise(function(_0x1b8cd8,_0x294a62){try{if(_0x2f347b[_0x67e1('0x2d')]){_0x2f347b[_0x67e1('0x2e')]=[];_0x2f347b[_0x67e1('0x2d')][_0x67e1('0x2f')](',')[_0x67e1('0x30')](function(_0x32a86f){_0x2f347b['Tags'][_0x67e1('0x31')](_0x4928b6[_0x32a86f]);});}delete _0x2f347b['TagIds'];}catch(_0x2d5850){_0x294a62(_0x2d5850);}_0x1b8cd8(_0x2f347b);});}function updateWhatsappInteraction(_0x4928a1,_0x34c624,_0x58df77){return new BPromise(function(_0x46638,_0x1034f2){return getInteractionUsers(_0x4928a1,_0x58df77)['then'](function(_0x4ab9bb){return getInteractionTags(_0x4ab9bb,_0x34c624);})['then'](function(_0x2f4e9a){_0x46638(_0x2f4e9a);})['catch'](function(_0x3aab7d){_0x1034f2(_0x3aab7d);});});}exports['index']=function(_0x110767,_0x4eb6fb){var _0x5ca771={},_0x1e77de={},_0x1e2144={'count':0x0,'rows':[]};var _0x5216a0=_[_0x67e1('0x32')](db[_0x67e1('0x33')][_0x67e1('0x34')],function(_0x184862){return{'name':_0x184862[_0x67e1('0x35')],'type':_0x184862[_0x67e1('0x36')][_0x67e1('0x37')]};});_0x1e77de['model']=_[_0x67e1('0x32')](_0x5216a0,_0x67e1('0x2b'));_0x1e77de['query']=_[_0x67e1('0x38')](_0x110767[_0x67e1('0x39')]);_0x1e77de[_0x67e1('0x3a')]=_[_0x67e1('0x3b')](_0x1e77de[_0x67e1('0x3c')],_0x1e77de[_0x67e1('0x39')]);_0x5ca771[_0x67e1('0x3d')]=_[_0x67e1('0x3b')](_0x1e77de[_0x67e1('0x3c')],qs[_0x67e1('0x3e')](_0x110767[_0x67e1('0x39')][_0x67e1('0x3e')]));_0x5ca771[_0x67e1('0x3d')]=_0x5ca771[_0x67e1('0x3d')][_0x67e1('0x3f')]?_0x5ca771[_0x67e1('0x3d')]:_0x1e77de[_0x67e1('0x3c')];if(!_0x110767[_0x67e1('0x39')][_0x67e1('0x40')](_0x67e1('0x41'))){_0x5ca771[_0x67e1('0x21')]=qs[_0x67e1('0x21')](_0x110767[_0x67e1('0x39')]['limit']);_0x5ca771[_0x67e1('0x20')]=qs['offset'](_0x110767['query'][_0x67e1('0x20')]);}_0x5ca771[_0x67e1('0x42')]=qs[_0x67e1('0x43')](_0x110767[_0x67e1('0x39')][_0x67e1('0x43')]);_0x5ca771[_0x67e1('0x44')]=qs[_0x67e1('0x3a')](_['pick'](_0x110767[_0x67e1('0x39')],_0x1e77de[_0x67e1('0x3a')]),_0x5216a0);var _0x27b7c6=[];var _0x46cacb=squel['select']()['field']('id')['field'](_0x67e1('0x2b'))[_0x67e1('0x45')](_0x67e1('0x46'))[_0x67e1('0x47')]('tools_tags');var _0x5ee633=squel[_0x67e1('0x48')]()[_0x67e1('0x45')](_0x67e1('0x49'))[_0x67e1('0x45')](_0x67e1('0x4a'))['field']('ui.WhatsappInteractionId')[_0x67e1('0x47')](_0x67e1('0x4b'),'ui')[_0x67e1('0x4c')](_0x67e1('0x4d'),'u',_0x67e1('0x4e'));var _0x3deb38=squel['select']()[_0x67e1('0x47')](_0x67e1('0x4f'),'i')['left_join'](_0x67e1('0x50'),'c',_0x67e1('0x51'))['left_join']('users','o',_0x67e1('0x52'))[_0x67e1('0x4c')](_0x67e1('0x53'),'a',_0x67e1('0x54'))[_0x67e1('0x4c')](_0x67e1('0x55'),'me',_0x67e1('0x56'))[_0x67e1('0x4c')](_0x67e1('0x57'),'it',_0x67e1('0x58'))['left_join'](_0x67e1('0x59'),'t','t.id\x20=\x20it.TagId');var _0x3f2be2=squel['expr']();var _0x226425=[];var _0x557bc2=squel[_0x67e1('0x5a')]();var _0x4b7c72;if(_0x110767[_0x67e1('0x39')]['search']){_0x4b7c72=as[_0x67e1('0x5b')](_0x110767[_0x67e1('0x39')][_0x67e1('0x5c')]);var _0x186020=_0x4b7c72[_0x67e1('0x5d')];for(var _0x37e809=0x0;_0x37e809<_0x4b7c72[_0x67e1('0x5e')][_0x67e1('0x3f')];_0x37e809++){var _0x52f08c=_0x4b7c72[_0x67e1('0x5e')][_0x37e809];var _0x359879='i';var _0x245c03=_[_0x67e1('0x5f')](_0x5216a0,[_0x67e1('0x2b'),_0x52f08c['field']]);if(!_0x245c03){switch(_0x52f08c[_0x67e1('0x45')]){case _0x67e1('0x60'):if(_0x52f08c['value']==0x1){_0x3deb38[_0x67e1('0x61')]('`'+_0x52f08c[_0x67e1('0x45')]+_0x67e1('0x62'));}else{_0x3deb38[_0x67e1('0x61')]('`'+_0x52f08c[_0x67e1('0x45')]+_0x67e1('0x63'));}break;case'Contact':if(_0x52f08c[_0x67e1('0x64')]===_0x67e1('0x65')){if(_0x52f08c[_0x67e1('0x66')][_0x67e1('0x2f')]('\x20')[_0x67e1('0x3f')]>0x1){_0x3f2be2[_0x186020](_0x67e1('0x67'),qs[_0x67e1('0x68')](_0x52f08c[_0x67e1('0x66')]),null);}else{var _0xad2116='%'+_0x52f08c[_0x67e1('0x66')]+'%';_0x3f2be2[_0x186020](_0x67e1('0x69'),_0xad2116,_0xad2116,_0xad2116);}}else{_0x245c03=_[_0x67e1('0x5f')](_0x5216a0,['name','ContactId']);_0x52f08c[_0x67e1('0x45')]=_0x67e1('0x6a');_0x783ea4=as[_0x67e1('0x6b')](_0x359879,_0x245c03[_0x67e1('0x36')],_0x52f08c);_0x3f2be2[_0x186020](_0x783ea4[_0x67e1('0x6c')],_0x783ea4[_0x67e1('0x66')][_0x67e1('0x6d')],_0x783ea4[_0x67e1('0x66')][_0x67e1('0x1c')]);}break;case _0x67e1('0x6e'):var _0x251681=_0x52f08c[_0x67e1('0x66')][_0x67e1('0x2f')](',')['map'](function(_0x102584){return Number(_0x102584);});_0x251681[_0x67e1('0x30')](function(_0x2cc6ab){_0x557bc2['or'](_0x67e1('0x6f'),'%,'+_0x2cc6ab+',%');});_0x226425=_[_0x67e1('0x70')](_0x226425,_0x251681);break;case _0x67e1('0x71'):if(_0x52f08c[_0x67e1('0x64')]==='$substring'){_0x3f2be2[_0x186020](_0x67e1('0x72'),'%'+_0x52f08c[_0x67e1('0x66')]+'%',null);}else{_0x245c03=_[_0x67e1('0x5f')](_0x5216a0,[_0x67e1('0x2b'),_0x67e1('0x73')]);_0x52f08c[_0x67e1('0x45')]='UserId';_0x783ea4=as[_0x67e1('0x6b')](_0x359879,_0x245c03[_0x67e1('0x36')],_0x52f08c);_0x3f2be2[_0x186020](_0x783ea4[_0x67e1('0x6c')],_0x783ea4['value'][_0x67e1('0x6d')],_0x783ea4[_0x67e1('0x66')]['end']);}break;case _0x67e1('0x74'):_0x783ea4=as['buildExpression']('me',null,_0x52f08c);_0x3f2be2[_0x186020](_0x783ea4[_0x67e1('0x6c')],_0x783ea4[_0x67e1('0x66')][_0x67e1('0x6d')],_0x783ea4[_0x67e1('0x66')][_0x67e1('0x1c')]);break;}}else{var _0x783ea4=as['buildExpression'](_0x359879,_0x245c03['type'],_0x52f08c);_0x3f2be2[_0x186020](_0x783ea4[_0x67e1('0x6c')],_0x783ea4['value'][_0x67e1('0x6d')],_0x783ea4[_0x67e1('0x66')][_0x67e1('0x1c')]);}}}else{var _0x181678=_(_0x110767['query'])[_0x67e1('0x38')]()[_0x67e1('0x32')](function(_0x45af3c){return _[_0x67e1('0x75')](_0x5216a0,[_0x67e1('0x2b'),_0x45af3c])?_0x45af3c:undefined;})[_0x67e1('0x76')]()['value']();if(!_[_0x67e1('0x77')](_0x181678)){_0x181678[_0x67e1('0x30')](function(_0x289f07){if(_0x289f07===_0x67e1('0x78')){_0x3deb38[_0x67e1('0x44')](_0x67e1('0x79'),[][_0x67e1('0x7a')](_0x110767[_0x67e1('0x39')][_0x289f07]));}else if(_0x289f07===_0x67e1('0x7b')){var _0x20017a=JSON[_0x67e1('0x7c')](_0x110767['query'][_0x289f07])[_0x67e1('0x7d')];var _0x512371=JSON[_0x67e1('0x7c')](_0x110767[_0x67e1('0x39')][_0x289f07])[_0x67e1('0x7e')];_0x3deb38[_0x67e1('0x44')](_0x67e1('0x7f'),_0x20017a,_0x512371);}else{if(_0x110767[_0x67e1('0x39')][_0x289f07]===_0x67e1('0x80')){_0x3deb38[_0x67e1('0x44')]('i.'+_0x289f07+_0x67e1('0x81'));}else{_0x3deb38['where']('i.'+_0x289f07+_0x67e1('0x82'),_0x110767['query'][_0x289f07]);}}});}if(_0x110767[_0x67e1('0x39')][_0x67e1('0x83')]){if(_0x110767[_0x67e1('0x39')][_0x67e1('0x83')]==0x1){_0x3deb38[_0x67e1('0x61')](_0x67e1('0x84'));}else{_0x3deb38[_0x67e1('0x61')](_0x67e1('0x85'));}}if(_0x110767[_0x67e1('0x39')][_0x67e1('0x86')]){_0x226425=_['isArray'](_0x110767[_0x67e1('0x39')][_0x67e1('0x86')])?_0x110767[_0x67e1('0x39')]['tag']:new Array(_0x110767['query'][_0x67e1('0x86')]);_0x226425[_0x67e1('0x30')](function(_0x2a5a76){_0x557bc2['or'](_0x67e1('0x6f'),'%,'+_0x2a5a76+',%');});}if(_0x110767[_0x67e1('0x39')][_0x67e1('0x87')]){var _0xabd4=_0x110767[_0x67e1('0x39')]['filter']['replace']('\x5c','\x5c\x5c')[_0x67e1('0x88')](/'/g,'\x27\x27');if(qs[_0x67e1('0x89')](_0xabd4)){_0x3f2be2['or']('i.id\x20LIKE\x20?',_0xabd4+'%')['or'](_0x67e1('0x8a'),_0xabd4+'%');}else{_0x3f2be2['or'](_0x67e1('0x8b'),qs[_0x67e1('0x68')](_0xabd4))['or'](_0x67e1('0x8c'),_0xabd4+'%');}}}_0x3deb38[_0x67e1('0x44')](_0x3f2be2);_0x3deb38['group'](_0x67e1('0x8d'));var _0x32c5fb={'type':db[_0x67e1('0x8e')]['QueryTypes']['SELECT'],'raw':!![]};var _0x541b5f=_0x3deb38[_0x67e1('0x8f')]();_0x541b5f[_0x67e1('0x45')](_0x67e1('0x8d'));_0x541b5f[_0x67e1('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x67e1('0x60'));if(_0x5ca771[_0x67e1('0x42')]){_0x5ca771['order'][_0x67e1('0x30')](function(_0x384a0d){var _0x189bba=_0x384a0d[0x0]===_0x67e1('0x90')?_0x384a0d[0x0]:'i.'+_0x384a0d[0x0];_0x3deb38[_0x67e1('0x42')](_0x189bba,_0x384a0d[0x1]==='DESC'?![]:!![]);});}if(!_[_0x67e1('0x77')](_0x226425)){_0x3deb38[_0x67e1('0x61')](_0x557bc2);_0x541b5f[_0x67e1('0x44')](_0x67e1('0x91'),_0x226425);}BPromise[_0x67e1('0x92')]()[_0x67e1('0x28')](function(){if(!_0x4b7c72){if(_0x110767['query'][_0x67e1('0x78')])return;_0x541b5f[_0x67e1('0x44')](_0x67e1('0x93'));_0x3deb38[_0x67e1('0x44')](_0x67e1('0x93'));return;}if(_0x110767[_0x67e1('0x94')][_0x67e1('0x95')]!==_0x67e1('0x96'))return;return _0x110767['user']['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0x67e1('0x28')](function(_0x14eae8){if(_[_0x67e1('0x77')](_0x14eae8)){_0x541b5f[_0x67e1('0x44')](_0x67e1('0x97'));_0x3deb38[_0x67e1('0x44')](_0x67e1('0x97'));}else{_0x541b5f[_0x67e1('0x44')]('i.WhatsappAccountId\x20IN\x20?',_[_0x67e1('0x32')](_0x14eae8,'id'));_0x3deb38[_0x67e1('0x44')](_0x67e1('0x79'),_[_0x67e1('0x32')](_0x14eae8,'id'));}});})[_0x67e1('0x28')](function(){if(_0x110767[_0x67e1('0x94')][_0x67e1('0x95')]===_0x67e1('0x96')&&!_0x4b7c72&&!_0x110767[_0x67e1('0x39')][_0x67e1('0x78')])return[];return db[_0x67e1('0x98')][_0x67e1('0x39')](_0x541b5f[_0x67e1('0x99')](),_0x32c5fb);})[_0x67e1('0x28')](function(_0x4fb856){_0x1e2144['count']=_0x4fb856[_0x67e1('0x3f')];if(_0x1e2144['count']===0x0)return[];return db[_0x67e1('0x98')]['query'](_0x46cacb['toString'](),_0x32c5fb)[_0x67e1('0x28')](function(_0x3e0523){_0x27b7c6=_[_0x67e1('0x9a')](_0x3e0523,'id');_0x32c5fb=_[_0x67e1('0x9b')](_0x32c5fb,{'model':db[_0x67e1('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x110767[_0x67e1('0x39')]['fields']){_0x5ca771['attributes']['forEach'](function(_0x137ab8){_0x3deb38[_0x67e1('0x45')]('i.'+_0x137ab8);});}else{_0x3deb38['field'](_0x67e1('0x9c'),_0x67e1('0x60'));_0x3deb38['field'](_0x67e1('0x9d'),'Account.key');_0x3deb38[_0x67e1('0x45')](_0x67e1('0x9e'),_0x67e1('0x9f'));_0x3deb38[_0x67e1('0x45')](_0x67e1('0xa0'),_0x67e1('0x90'));_0x3deb38[_0x67e1('0x45')](_0x67e1('0xa1'));_0x3deb38[_0x67e1('0x45')](_0x67e1('0xa2'),_0x67e1('0xa3'));_0x3deb38['field']('c.lastName',_0x67e1('0xa4'));_0x3deb38[_0x67e1('0x45')](_0x67e1('0xa5'),_0x67e1('0xa6'));_0x3deb38[_0x67e1('0x45')]('c.phone',_0x67e1('0xa7'));_0x3deb38['field'](_0x67e1('0xa8'),_0x67e1('0xa9'));_0x3deb38[_0x67e1('0x45')](_0x67e1('0xaa'),_0x67e1('0xab'));_0x3deb38[_0x67e1('0x45')]('o.fullname',_0x67e1('0xac'));_0x3deb38['field'](_0x67e1('0xad'),_0x67e1('0xae'));_0x3deb38[_0x67e1('0x45')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x67e1('0x2d'));}if(_0x5ca771[_0x67e1('0x21')])_0x3deb38[_0x67e1('0x21')](_0x5ca771[_0x67e1('0x21')]);if(_0x5ca771['offset'])_0x3deb38[_0x67e1('0x20')](_0x5ca771[_0x67e1('0x20')]);return db[_0x67e1('0x98')]['query'](_0x3deb38[_0x67e1('0x99')](),_0x32c5fb);})[_0x67e1('0x28')](function(_0x1ebc34){if(_0x1ebc34[_0x67e1('0x3f')]>0x0)_0x5ee633[_0x67e1('0x44')](_0x67e1('0xaf'),_['map'](_0x1ebc34,'id'));return db[_0x67e1('0x98')][_0x67e1('0x39')](_0x5ee633[_0x67e1('0x99')](),_0x32c5fb)[_0x67e1('0x28')](function(_0x5c0e54){var _0x5cec09=_['groupBy'](_0x5c0e54,'WhatsappInteractionId');var _0x5e99bb=[];_0x1ebc34[_0x67e1('0x30')](function(_0x5c7c46){_0x5e99bb[_0x67e1('0x31')](updateWhatsappInteraction(_0x5c7c46,_0x27b7c6,_0x5cec09));});return BPromise['all'](_0x5e99bb);});});})['then'](function(_0x2c65e1){_0x1e2144[_0x67e1('0xb0')]=_0x2c65e1;return _0x1e2144;})[_0x67e1('0x28')](respondWithFilteredResult(_0x4eb6fb,_0x5ca771))[_0x67e1('0xb1')](handleError(_0x4eb6fb,null));};exports['show']=function(_0x1f4062,_0x460b2a){var _0xa33cdf={'raw':![],'where':{'id':_0x1f4062[_0x67e1('0xb2')]['id']}},_0x45eefa={};_0x45eefa[_0x67e1('0x3c')]=_['keys'](db[_0x67e1('0x33')][_0x67e1('0x34')]);_0x45eefa['query']=_[_0x67e1('0x38')](_0x1f4062[_0x67e1('0x39')]);_0x45eefa[_0x67e1('0x3a')]=_['intersection'](_0x45eefa['model'],_0x45eefa['query']);_0xa33cdf['attributes']=_[_0x67e1('0x3b')](_0x45eefa[_0x67e1('0x3c')],qs[_0x67e1('0x3e')](_0x1f4062[_0x67e1('0x39')]['fields']));_0xa33cdf[_0x67e1('0x3d')]=_0xa33cdf[_0x67e1('0x3d')][_0x67e1('0x3f')]?_0xa33cdf[_0x67e1('0x3d')]:_0x45eefa[_0x67e1('0x3c')];if(_0x1f4062[_0x67e1('0x39')]['includeAll']){_0xa33cdf[_0x67e1('0xb3')]=[{'all':!![]}];}_0xa33cdf=_['merge']({},_0xa33cdf,_0x1f4062['options']);return db[_0x67e1('0x33')]['find'](_0xa33cdf)[_0x67e1('0x28')](handleEntityNotFound(_0x460b2a,null))['then'](respondWithResult(_0x460b2a,null))[_0x67e1('0xb1')](handleError(_0x460b2a,null));};exports[_0x67e1('0xb4')]=function(_0x6283eb,_0x807c5){return db[_0x67e1('0x33')][_0x67e1('0xb4')](_0x6283eb['body'],{})[_0x67e1('0x28')](respondWithResult(_0x807c5,0xc9))[_0x67e1('0xb1')](handleError(_0x807c5,null));};exports[_0x67e1('0x27')]=function(_0x1649a4,_0x23766e){if(_0x1649a4[_0x67e1('0x74')]['id']){delete _0x1649a4[_0x67e1('0x74')]['id'];}return db[_0x67e1('0x33')][_0x67e1('0x5f')]({'where':{'id':_0x1649a4[_0x67e1('0xb2')]['id']}})['then'](handleEntityNotFound(_0x23766e,null))['then'](saveUpdates(_0x1649a4[_0x67e1('0x74')],null))[_0x67e1('0x28')](respondWithResult(_0x23766e,null))[_0x67e1('0xb1')](handleError(_0x23766e,null));};exports[_0x67e1('0x29')]=function(_0x12c84b,_0x26a50d){return db['WhatsappInteraction']['find']({'where':{'id':_0x12c84b[_0x67e1('0xb2')]['id']}})[_0x67e1('0x28')](handleEntityNotFound(_0x26a50d,null))[_0x67e1('0x28')](removeEntity(_0x26a50d,null))[_0x67e1('0xb1')](handleError(_0x26a50d,null));};exports[_0x67e1('0xb5')]=function(_0x2a8130,_0x380b68){return db[_0x67e1('0x33')][_0x67e1('0xb5')]()[_0x67e1('0x28')](respondWithResult(_0x380b68,null))[_0x67e1('0xb1')](handleError(_0x380b68,null));};exports[_0x67e1('0xb6')]=function(_0x1d409e,_0x53bbf2,_0x3d3232){return db['WhatsappMessage'][_0x67e1('0x5f')]({'where':{'id':_0x1d409e['params']['id']}})['then'](handleEntityNotFound(_0x53bbf2,null))['then'](function(_0x5e7521){if(_0x5e7521){return _0x5e7521[_0x67e1('0xb6')](_0x1d409e[_0x67e1('0x74')]['ids'],_[_0x67e1('0xb7')](_0x1d409e['body'],['ids','id'])||{});}})[_0x67e1('0x28')](respondWithResult(_0x53bbf2,null))[_0x67e1('0xb1')](handleError(_0x53bbf2,null));};exports[_0x67e1('0xb8')]=function(_0x58604b,_0x5be06f,_0x501a70){var _0x1815bb={'raw':![],'where':{}};var _0x5a5180={};var _0x455cdf={'count':0x0,'rows':[]};return db[_0x67e1('0x33')][_0x67e1('0xb9')]({'where':{'id':_0x58604b[_0x67e1('0xb2')]['id']}})[_0x67e1('0x28')](handleEntityNotFound(_0x5be06f,null))[_0x67e1('0x28')](function(_0x584354){if(_0x584354){_0x5a5180['model']=_[_0x67e1('0x38')](db['WhatsappMessage'][_0x67e1('0x34')]);_0x5a5180[_0x67e1('0x39')]=_['keys'](_0x58604b[_0x67e1('0x39')]);_0x5a5180[_0x67e1('0x3a')]=_[_0x67e1('0x3b')](_0x5a5180[_0x67e1('0x3c')],_0x5a5180[_0x67e1('0x39')]);_0x1815bb['attributes']=_['intersection'](_0x5a5180[_0x67e1('0x3c')],qs[_0x67e1('0x3e')](_0x58604b[_0x67e1('0x39')]['fields']));_0x1815bb[_0x67e1('0x3d')]=_0x1815bb[_0x67e1('0x3d')][_0x67e1('0x3f')]?_0x1815bb[_0x67e1('0x3d')]:_0x5a5180['model'];if(!_0x58604b[_0x67e1('0x39')]['hasOwnProperty']('nolimit')){_0x1815bb[_0x67e1('0x21')]=qs['limit'](_0x58604b[_0x67e1('0x39')][_0x67e1('0x21')]);_0x1815bb[_0x67e1('0x20')]=qs['offset'](_0x58604b[_0x67e1('0x39')][_0x67e1('0x20')]);}_0x1815bb[_0x67e1('0x42')]=qs[_0x67e1('0x43')](_0x58604b['query'][_0x67e1('0x43')]);_0x1815bb['where']=qs[_0x67e1('0x3a')](_[_0x67e1('0xba')](_0x58604b[_0x67e1('0x39')],_0x5a5180[_0x67e1('0x3a')]));_0x1815bb[_0x67e1('0x44')][_0x67e1('0xbb')]=_0x584354['id'];if(_0x58604b[_0x67e1('0x39')]['filter']){_0x1815bb[_0x67e1('0x44')]=_[_0x67e1('0x9b')](_0x1815bb[_0x67e1('0x44')],{'$or':_[_0x67e1('0x32')](_0x1815bb[_0x67e1('0x3d')],function(_0x34b428){var _0x14d920={};_0x14d920[_0x34b428]={'$like':'%'+_0x58604b[_0x67e1('0x39')]['filter']+'%'};return _0x14d920;})});}if(_0x58604b[_0x67e1('0x39')][_0x67e1('0x7d')]){var _0x5768c5=_0x58604b[_0x67e1('0x39')]['$gte'][_0x67e1('0x2f')](',');var _0x42d23c={};_0x42d23c[_0x5768c5[0x0]]={'$gte':moment(_0x5768c5[0x1])[_0x67e1('0xbc')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1815bb['where']=_[_0x67e1('0x9b')](_0x1815bb[_0x67e1('0x44')],_0x42d23c);}_0x1815bb=_[_0x67e1('0x9b')]({},_0x1815bb,_0x58604b[_0x67e1('0xbd')]);return db[_0x67e1('0xbe')]['count']({'where':_0x1815bb[_0x67e1('0x44')]})['then'](function(_0x5a1d86){_0x455cdf['count']=_0x5a1d86;if(_0x58604b[_0x67e1('0x39')][_0x67e1('0xbf')]){_0x1815bb[_0x67e1('0xb3')]=[{'all':!![]}];}return db[_0x67e1('0xbe')]['findAll'](_0x1815bb);})[_0x67e1('0x28')](function(_0x13e5c5){_0x455cdf[_0x67e1('0xb0')]=_0x13e5c5;return _0x455cdf;});}})[_0x67e1('0x28')](respondWithFilteredResult(_0x5be06f,_0x1815bb))[_0x67e1('0xb1')](handleError(_0x5be06f,null));};exports['addTags']=function(_0x14bdab,_0x59f147,_0x53a332){return db['WhatsappInteraction']['find']({'where':{'id':_0x14bdab['params']['id']}})[_0x67e1('0x28')](handleEntityNotFound(_0x59f147,null))[_0x67e1('0x28')](function(_0x5dc930){if(_0x5dc930){return _0x5dc930['setTags'](_0x14bdab[_0x67e1('0x74')]['ids'],_[_0x67e1('0xb7')](_0x14bdab[_0x67e1('0x74')],[_0x67e1('0xc0'),'id'])||{})[_0x67e1('0xc1')](function(){return db[_0x67e1('0x6e')][_0x67e1('0xc2')]({'attributes':['id','name',_0x67e1('0x46')],'where':{'id':_0x14bdab['body']['ids']}});})[_0x67e1('0x28')](function(_0xa96b27){socket[_0x67e1('0xc3')](_0x67e1('0xc4'),{'id':Number(_0x14bdab[_0x67e1('0xb2')]['id']),'tags':_0xa96b27||[]});return{'id':Number(_0x14bdab[_0x67e1('0xb2')]['id']),'tags':_0xa96b27||[]};});}})[_0x67e1('0x28')](respondWithResult(_0x59f147,null))[_0x67e1('0xb1')](handleError(_0x59f147,null));};exports['removeTags']=function(_0x1e3c72,_0x32db87,_0xfb14c){return db[_0x67e1('0x33')]['find']({'where':{'id':_0x1e3c72[_0x67e1('0xb2')]['id']}})[_0x67e1('0x28')](handleEntityNotFound(_0x32db87,null))[_0x67e1('0x28')](function(_0x594f81){if(_0x594f81){return _0x594f81['removeTags'](_0x1e3c72[_0x67e1('0x39')][_0x67e1('0xc0')]);}})[_0x67e1('0x28')](respondWithStatusCode(_0x32db87,null))[_0x67e1('0xb1')](handleError(_0x32db87,null));};exports['download']=function(_0x3b1241,_0x2e3864){var _0x4714ae=moment()[_0x67e1('0xc5')]()[_0x67e1('0x99')]();var _0x219bed=path[_0x67e1('0xc6')](config['root'],_0x67e1('0xc7'),_0x67e1('0xc8'),_0x67e1('0xc9'));var _0x46de19=path[_0x67e1('0xc6')](config[_0x67e1('0xca')],'server','files',_0x67e1('0xcb'));var _0x56dece=path['join'](_0x219bed,_0x4714ae);var _0x345aa6=util[_0x67e1('0xbc')](_0x67e1('0xcc'),_0x3b1241[_0x67e1('0xb2')]['id'],_0x4714ae);var _0x4b90f3=path[_0x67e1('0xc6')](_0x219bed,_0x345aa6);var _0xdcccb=[];_0xdcccb['push']({'model':db['User'],'as':'User','attributes':['id',_0x67e1('0xcd')],'raw':!![]});_0xdcccb[_0x67e1('0x31')]({'model':db[_0x67e1('0xce')],'as':_0x67e1('0xcf'),'attributes':['id',_0x67e1('0xd0'),'lastName'],'raw':!![]});if(_0x3b1241[_0x67e1('0x39')][_0x67e1('0xcb')]){_0xdcccb[_0x67e1('0x31')]({'model':db[_0x67e1('0xd1')],'as':_0x67e1('0xd1'),'raw':!![]});}var _0x13a91c=[{'model':db[_0x67e1('0xbe')],'as':'Messages','attributes':['id',_0x67e1('0x74'),_0x67e1('0x7b'),_0x67e1('0xd2'),_0x67e1('0xd3'),_0x67e1('0x83')],'include':_0xdcccb}];_0x13a91c['push']({'model':db[_0x67e1('0xd4')],'as':'Account','attributes':['id',_0x67e1('0x2b')]});_0x13a91c[_0x67e1('0x31')]({'model':db[_0x67e1('0x71')],'as':'Owner','attributes':['id',_0x67e1('0xcd')]});return db['WhatsappInteraction'][_0x67e1('0x5f')]({'where':{'id':_0x3b1241[_0x67e1('0xb2')]['id']},'include':_0x13a91c})[_0x67e1('0x28')](handleEntityNotFound(_0x2e3864,null))[_0x67e1('0x28')](function(_0x4f4965){if(_0x4f4965){var _0x5264c5=_0x4f4965[_0x67e1('0xd5')]({'plain':!![]});fs['mkdirSync'](_0x56dece);var _0x187114={'channel':_0x67e1('0xd6'),'account':_0x5264c5[_0x67e1('0xd7')][_0x67e1('0x2b')],'agent':_0x5264c5[_0x67e1('0xd8')]?_0x5264c5[_0x67e1('0xd8')][_0x67e1('0xcd')]:'N.A.','createdAt':moment(_0x5264c5['createdAt'])[_0x67e1('0xbc')](_0x67e1('0xd9'))[_0x67e1('0x99')](),'closedAt':_0x5264c5[_0x67e1('0xda')]?moment(_0x5264c5['closedAt'])[_0x67e1('0xbc')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x5264c5[_0x67e1('0xdb')],'messages':_(_0x5264c5['Messages'])[_0x67e1('0x87')]({'secret':![]})[_0x67e1('0x32')](function(_0x2ff1fa){if(_0x2ff1fa[_0x67e1('0xd1')]){var _0x4e97ee=path[_0x67e1('0xc6')](_0x46de19,_0x2ff1fa[_0x67e1('0xd1')][_0x67e1('0xdc')]);if(fs[_0x67e1('0xdd')](_0x4e97ee)){fs['createReadStream'](_0x4e97ee)[_0x67e1('0xde')](fs['createWriteStream'](path[_0x67e1('0xc6')](_0x56dece,_0x2ff1fa['Attachment'][_0x67e1('0xdc')])));}}return{'date':moment(_0x2ff1fa[_0x67e1('0x7b')])['format'](_0x67e1('0xd9'))[_0x67e1('0x99')](),'sender':_0x2ff1fa[_0x67e1('0xd2')]===_0x67e1('0xdf')?_0x2ff1fa[_0x67e1('0x71')]?_0x2ff1fa[_0x67e1('0x71')]['fullname']:_0x67e1('0xe0'):_0x2ff1fa[_0x67e1('0xcf')][_0x67e1('0xd0')]+(_0x2ff1fa[_0x67e1('0xcf')][_0x67e1('0xe1')]?'\x20'+_0x2ff1fa[_0x67e1('0xcf')][_0x67e1('0xe1')]:''),'body':_0x2ff1fa[_0x67e1('0xd1')]?_0x2ff1fa['Attachment'][_0x67e1('0xdc')]:_0x2ff1fa[_0x67e1('0x74')],'direction':_0x2ff1fa[_0x67e1('0xd2')]===_0x67e1('0xdf')?'A':'C','secret':_0x2ff1fa[_0x67e1('0xd3')],'read':_0x2ff1fa['read'],'attachment':_0x2ff1fa[_0x67e1('0xd1')]};})[_0x67e1('0x66')]()};return ejs[_0x67e1('0xe2')](path['join'](config[_0x67e1('0xca')],_0x67e1('0xc7'),'views',_0x67e1('0xe3')),{'interaction':_0x187114})[_0x67e1('0x28')](function(_0xa6f6fd){var _0x402327=path[_0x67e1('0xc6')](_0x56dece,'transcript-'+_0x5264c5['id']+'-'+_0x4714ae+_0x67e1('0xe4'));var _0x14d238={'path':_0x402327,'channel':_0x67e1('0xd6'),'interactionId':_0x5264c5['id']};return pdf[_0x67e1('0xe5')](_0xa6f6fd,_0x14d238);})['then'](function(){return new BPromise(function(_0x5ddb4b,_0x1643d2){zipdir(_0x56dece,{'saveTo':_0x4b90f3},function(_0x301b1b,_0x11c2b1){if(_0x301b1b)return _0x1643d2(_0x301b1b);return _0x5ddb4b(_0x11c2b1);});})['then'](function(){return new BPromise(function(_0x4f9ddd,_0x29d5d5){rimraf(_0x56dece,function(_0x39a460){if(_0x39a460)_0x29d5d5(_0x39a460);return _0x4f9ddd();});});})[_0x67e1('0x28')](function(){return _0x2e3864[_0x67e1('0xe6')](_0x4b90f3,_0x345aa6,function(_0x4f6515){if(_0x4f6515){console[_0x67e1('0xe7')]('err',_0x4f6515);}else{fs[_0x67e1('0xe8')](_0x4b90f3);}});});});}else{return _0x2e3864['sendStatus'](0xc8);}})[_0x67e1('0xb1')](handleError(_0x2e3864,null));}; \ No newline at end of file +var _0x12dc=['forEach','push','catch','WhatsappInteraction','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','field','color','from','tools_tags','select','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','start','body','some','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','getWhatsappAccounts','role','agent','sequelize','toString','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.fax','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','includeAll','include','options','create','update','params','describe','addMessage','WhatsappMessage','ids','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','omit','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','Contact','firstName','Attachment','Messages','createdAt','direction','secret','WhatsappAccount','Owner','get','mkdirSync','Account','N.A.','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','out','lastName','renderFile','downloadInteraction.ejs','transcript-','.pdf','Whatsapp','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappInteraction.socket','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','then','destroy','stack','send','Users','map','fullname','TagIds','Tags','split'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x12dc,0xb4));var _0xc12d=function(_0x119835,_0x50063f){_0x119835=_0x119835-0x0;var _0x59e4c2=_0x12dc[_0x119835];return _0x59e4c2;};'use strict';var emlformat=require(_0xc12d('0x0'));var rimraf=require(_0xc12d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc12d('0x2'));var rp=require(_0xc12d('0x3'));var moment=require(_0xc12d('0x4'));var BPromise=require(_0xc12d('0x5'));var Mustache=require(_0xc12d('0x6'));var util=require(_0xc12d('0x7'));var path=require(_0xc12d('0x8'));var sox=require(_0xc12d('0x9'));var csv=require(_0xc12d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc12d('0xb'));var _=require(_0xc12d('0xc'));var squel=require(_0xc12d('0xd'));var crypto=require(_0xc12d('0xe'));var jsforce=require(_0xc12d('0xf'));var deskjs=require(_0xc12d('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc12d('0x11'));var Papa=require(_0xc12d('0x12'));var Redis=require('ioredis');var authService=require(_0xc12d('0x13'));var qs=require(_0xc12d('0x14'));var as=require(_0xc12d('0x15'));var pdf=require(_0xc12d('0x16'));var hardwareService=require(_0xc12d('0x17'));var logger=require(_0xc12d('0x18'))(_0xc12d('0x19'));var utils=require(_0xc12d('0x1a'));var config=require(_0xc12d('0x1b'));var licenseUtil=require(_0xc12d('0x1c'));var db=require(_0xc12d('0x1d'))['db'];config[_0xc12d('0x1e')]=_[_0xc12d('0x1f')](config[_0xc12d('0x1e')],{'host':_0xc12d('0x20'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc12d('0x1e')]));require(_0xc12d('0x21'))['register'](socket);function respondWithStatusCode(_0x40e3de,_0x148910){_0x148910=_0x148910||0xcc;return function(_0x47619e){if(_0x47619e){return _0x40e3de[_0xc12d('0x22')](_0x148910);}return _0x40e3de[_0xc12d('0x23')](_0x148910)[_0xc12d('0x24')]();};}function respondWithResult(_0x10fcd8,_0x2e0597){_0x2e0597=_0x2e0597||0xc8;return function(_0x39d962){if(_0x39d962){return _0x10fcd8[_0xc12d('0x23')](_0x2e0597)[_0xc12d('0x25')](_0x39d962);}};}function respondWithFilteredResult(_0x29d5bb,_0xe74bdf){return function(_0x205b6c){if(_0x205b6c){var _0x1fb3fc=typeof _0xe74bdf['offset']===_0xc12d('0x26')&&typeof _0xe74bdf[_0xc12d('0x27')]===_0xc12d('0x26');var _0x51a6d5=_0x205b6c[_0xc12d('0x28')];var _0x307937=_0x1fb3fc?0x0:_0xe74bdf[_0xc12d('0x29')];var _0x22f671=_0x1fb3fc?_0x205b6c[_0xc12d('0x28')]:_0xe74bdf[_0xc12d('0x29')]+_0xe74bdf[_0xc12d('0x27')];var _0x1174f6;if(_0x22f671>=_0x51a6d5){_0x22f671=_0x51a6d5;_0x1174f6=0xc8;}else{_0x1174f6=0xce;}_0x29d5bb[_0xc12d('0x23')](_0x1174f6);return _0x29d5bb[_0xc12d('0x2a')]('Content-Range',_0x307937+'-'+_0x22f671+'/'+_0x51a6d5)[_0xc12d('0x25')](_0x205b6c);}return null;};}function patchUpdates(_0x825f57){return function(_0x27570f){try{jsonpatch['apply'](_0x27570f,_0x825f57,!![]);}catch(_0x44f0c5){return BPromise[_0xc12d('0x2b')](_0x44f0c5);}return _0x27570f[_0xc12d('0x2c')]();};}function saveUpdates(_0x5a4ee9,_0x4a02fd){return function(_0x5ef097){if(_0x5ef097){return _0x5ef097['update'](_0x5a4ee9)[_0xc12d('0x2d')](function(_0x430b6d){return _0x430b6d;});}return null;};}function removeEntity(_0x48c8d0,_0x23214b){return function(_0x1ac26b){if(_0x1ac26b){return _0x1ac26b[_0xc12d('0x2e')]()[_0xc12d('0x2d')](function(){_0x48c8d0[_0xc12d('0x23')](0xcc)[_0xc12d('0x24')]();});}};}function handleEntityNotFound(_0x52bae0,_0x511161){return function(_0x23b758){if(!_0x23b758){_0x52bae0['sendStatus'](0x194);}return _0x23b758;};}function handleError(_0x5428db,_0x29cefb){_0x29cefb=_0x29cefb||0x1f4;return function(_0x4a7c51){logger['error'](_0x4a7c51[_0xc12d('0x2f')]);if(_0x4a7c51['name']){delete _0x4a7c51['name'];}_0x5428db[_0xc12d('0x23')](_0x29cefb)[_0xc12d('0x30')](_0x4a7c51);};}function getInteractionUsers(_0x485d43,_0x51a378){return new BPromise(function(_0x419111,_0x16dac0){try{if(_0x51a378[_0x485d43['id']]){_0x485d43[_0xc12d('0x31')]=_[_0xc12d('0x32')](_0x51a378[_0x485d43['id']],function(_0x53bf64){return{'id':_0x53bf64['id'],'fullname':_0x53bf64[_0xc12d('0x33')]};});}}catch(_0x5f528e){_0x16dac0(_0x5f528e);}_0x419111(_0x485d43);});}function getInteractionTags(_0x2aa495,_0x3740ff){return new BPromise(function(_0x5bf420,_0x37c8d1){try{if(_0x2aa495[_0xc12d('0x34')]){_0x2aa495[_0xc12d('0x35')]=[];_0x2aa495['TagIds'][_0xc12d('0x36')](',')[_0xc12d('0x37')](function(_0x5281a6){_0x2aa495[_0xc12d('0x35')][_0xc12d('0x38')](_0x3740ff[_0x5281a6]);});}delete _0x2aa495[_0xc12d('0x34')];}catch(_0x2d688b){_0x37c8d1(_0x2d688b);}_0x5bf420(_0x2aa495);});}function updateWhatsappInteraction(_0x12f8cd,_0x1d1e4c,_0x45e078){return new BPromise(function(_0x27883d,_0x1eaefb){return getInteractionUsers(_0x12f8cd,_0x45e078)[_0xc12d('0x2d')](function(_0x3250c4){return getInteractionTags(_0x3250c4,_0x1d1e4c);})[_0xc12d('0x2d')](function(_0x3110a7){_0x27883d(_0x3110a7);})[_0xc12d('0x39')](function(_0x3fb83c){_0x1eaefb(_0x3fb83c);});});}exports['index']=function(_0x1cb476,_0x313739){var _0x490029={},_0x1a6b5e={},_0x4bf9b1={'count':0x0,'rows':[]};var _0xb3c7a5=_[_0xc12d('0x32')](db[_0xc12d('0x3a')][_0xc12d('0x3b')],function(_0x1de116){return{'name':_0x1de116[_0xc12d('0x3c')],'type':_0x1de116[_0xc12d('0x3d')]['key']};});_0x1a6b5e[_0xc12d('0x3e')]=_[_0xc12d('0x32')](_0xb3c7a5,_0xc12d('0x3f'));_0x1a6b5e[_0xc12d('0x40')]=_[_0xc12d('0x41')](_0x1cb476[_0xc12d('0x40')]);_0x1a6b5e[_0xc12d('0x42')]=_[_0xc12d('0x43')](_0x1a6b5e[_0xc12d('0x3e')],_0x1a6b5e[_0xc12d('0x40')]);_0x490029[_0xc12d('0x44')]=_[_0xc12d('0x43')](_0x1a6b5e['model'],qs['fields'](_0x1cb476[_0xc12d('0x40')][_0xc12d('0x45')]));_0x490029[_0xc12d('0x44')]=_0x490029['attributes'][_0xc12d('0x46')]?_0x490029[_0xc12d('0x44')]:_0x1a6b5e['model'];if(!_0x1cb476['query'][_0xc12d('0x47')](_0xc12d('0x48'))){_0x490029['limit']=qs['limit'](_0x1cb476[_0xc12d('0x40')][_0xc12d('0x27')]);_0x490029[_0xc12d('0x29')]=qs[_0xc12d('0x29')](_0x1cb476[_0xc12d('0x40')][_0xc12d('0x29')]);}_0x490029[_0xc12d('0x49')]=qs[_0xc12d('0x4a')](_0x1cb476[_0xc12d('0x40')][_0xc12d('0x4a')]);_0x490029[_0xc12d('0x4b')]=qs['filters'](_['pick'](_0x1cb476[_0xc12d('0x40')],_0x1a6b5e[_0xc12d('0x42')]),_0xb3c7a5);var _0x35d341=[];var _0x584146=squel['select']()[_0xc12d('0x4c')]('id')[_0xc12d('0x4c')](_0xc12d('0x3f'))['field'](_0xc12d('0x4d'))[_0xc12d('0x4e')](_0xc12d('0x4f'));var _0x3f43a5=squel[_0xc12d('0x50')]()[_0xc12d('0x4c')](_0xc12d('0x51'))[_0xc12d('0x4c')](_0xc12d('0x52'))[_0xc12d('0x4c')](_0xc12d('0x53'))[_0xc12d('0x4e')](_0xc12d('0x54'),'ui')[_0xc12d('0x55')](_0xc12d('0x56'),'u',_0xc12d('0x57'));var _0x4f982c=squel[_0xc12d('0x50')]()['from'](_0xc12d('0x58'),'i')[_0xc12d('0x55')](_0xc12d('0x59'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xc12d('0x55')]('users','o',_0xc12d('0x5a'))[_0xc12d('0x55')](_0xc12d('0x5b'),'a',_0xc12d('0x5c'))[_0xc12d('0x55')](_0xc12d('0x5d'),'me','me.WhatsappInteractionId\x20=\x20i.id')[_0xc12d('0x55')](_0xc12d('0x5e'),'it',_0xc12d('0x5f'))[_0xc12d('0x55')](_0xc12d('0x4f'),'t',_0xc12d('0x60'));var _0x3c7c27=squel[_0xc12d('0x61')]();var _0x355cc2=[];var _0xb86938=squel[_0xc12d('0x61')]();var _0x548f71;if(_0x1cb476[_0xc12d('0x40')][_0xc12d('0x62')]){_0x548f71=as['parseSearch'](_0x1cb476[_0xc12d('0x40')][_0xc12d('0x62')]);var _0x28efd2=_0x548f71[_0xc12d('0x63')];for(var _0x320468=0x0;_0x320468<_0x548f71[_0xc12d('0x64')]['length'];_0x320468++){var _0x188855=_0x548f71[_0xc12d('0x64')][_0x320468];var _0x188d74='i';var _0x32b825=_[_0xc12d('0x65')](_0xb3c7a5,[_0xc12d('0x3f'),_0x188855['field']]);if(!_0x32b825){switch(_0x188855[_0xc12d('0x4c')]){case _0xc12d('0x66'):if(_0x188855[_0xc12d('0x67')]==0x1){_0x4f982c[_0xc12d('0x68')]('`'+_0x188855[_0xc12d('0x4c')]+_0xc12d('0x69'));}else{_0x4f982c[_0xc12d('0x68')]('`'+_0x188855[_0xc12d('0x4c')]+'`\x20>\x200');}break;case'Contact':if(_0x188855[_0xc12d('0x6a')]===_0xc12d('0x6b')){if(_0x188855[_0xc12d('0x67')][_0xc12d('0x36')]('\x20')[_0xc12d('0x46')]>0x1){_0x3c7c27[_0x28efd2](_0xc12d('0x6c'),qs['getFullTextValue'](_0x188855[_0xc12d('0x67')]),null);}else{var _0x4f0a7b='%'+_0x188855['value']+'%';_0x3c7c27[_0x28efd2]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x4f0a7b,_0x4f0a7b,_0x4f0a7b);}}else{_0x32b825=_[_0xc12d('0x65')](_0xb3c7a5,['name',_0xc12d('0x6d')]);_0x188855[_0xc12d('0x4c')]=_0xc12d('0x6d');_0x44926c=as['buildExpression'](_0x188d74,_0x32b825['type'],_0x188855);_0x3c7c27[_0x28efd2](_0x44926c[_0xc12d('0x6e')],_0x44926c[_0xc12d('0x67')]['start'],_0x44926c[_0xc12d('0x67')][_0xc12d('0x24')]);}break;case _0xc12d('0x6f'):var _0x4f642a=_0x188855[_0xc12d('0x67')][_0xc12d('0x36')](',')[_0xc12d('0x32')](function(_0x1dcb19){return Number(_0x1dcb19);});_0x4f642a[_0xc12d('0x37')](function(_0x342b5d){_0xb86938['or'](_0xc12d('0x70'),'%,'+_0x342b5d+',%');});_0x355cc2=_['union'](_0x355cc2,_0x4f642a);break;case _0xc12d('0x71'):if(_0x188855[_0xc12d('0x6a')]==='$substring'){_0x3c7c27[_0x28efd2](_0xc12d('0x72'),'%'+_0x188855[_0xc12d('0x67')]+'%',null);}else{_0x32b825=_['find'](_0xb3c7a5,[_0xc12d('0x3f'),_0xc12d('0x73')]);_0x188855[_0xc12d('0x4c')]=_0xc12d('0x73');_0x44926c=as[_0xc12d('0x74')](_0x188d74,_0x32b825[_0xc12d('0x3d')],_0x188855);_0x3c7c27[_0x28efd2](_0x44926c[_0xc12d('0x6e')],_0x44926c[_0xc12d('0x67')][_0xc12d('0x75')],_0x44926c[_0xc12d('0x67')][_0xc12d('0x24')]);}break;case _0xc12d('0x76'):_0x44926c=as[_0xc12d('0x74')]('me',null,_0x188855);_0x3c7c27[_0x28efd2](_0x44926c['text'],_0x44926c[_0xc12d('0x67')][_0xc12d('0x75')],_0x44926c[_0xc12d('0x67')][_0xc12d('0x24')]);break;}}else{var _0x44926c=as[_0xc12d('0x74')](_0x188d74,_0x32b825[_0xc12d('0x3d')],_0x188855);_0x3c7c27[_0x28efd2](_0x44926c['text'],_0x44926c[_0xc12d('0x67')][_0xc12d('0x75')],_0x44926c[_0xc12d('0x67')][_0xc12d('0x24')]);}}}else{var _0x16a98d=_(_0x1cb476[_0xc12d('0x40')])[_0xc12d('0x41')]()[_0xc12d('0x32')](function(_0x259712){return _[_0xc12d('0x77')](_0xb3c7a5,['name',_0x259712])?_0x259712:undefined;})['compact']()[_0xc12d('0x67')]();if(!_['isEmpty'](_0x16a98d)){_0x16a98d[_0xc12d('0x37')](function(_0x118718){if(_0x118718===_0xc12d('0x78')){_0x4f982c['where'](_0xc12d('0x79'),[][_0xc12d('0x7a')](_0x1cb476[_0xc12d('0x40')][_0x118718]));}else if(_0x118718==='createdAt'){var _0x441fcd=JSON['parse'](_0x1cb476[_0xc12d('0x40')][_0x118718])['$gte'];var _0x48092b=JSON[_0xc12d('0x7b')](_0x1cb476[_0xc12d('0x40')][_0x118718])['$lte'];_0x4f982c[_0xc12d('0x4b')](_0xc12d('0x7c'),_0x441fcd,_0x48092b);}else{if(_0x1cb476[_0xc12d('0x40')][_0x118718]===_0xc12d('0x7d')){_0x4f982c['where']('i.'+_0x118718+_0xc12d('0x7e'));}else{_0x4f982c[_0xc12d('0x4b')]('i.'+_0x118718+'\x20=\x20?',_0x1cb476[_0xc12d('0x40')][_0x118718]);}}});}if(_0x1cb476[_0xc12d('0x40')][_0xc12d('0x7f')]){if(_0x1cb476['query'][_0xc12d('0x7f')]==0x1){_0x4f982c['having'](_0xc12d('0x80'));}else{_0x4f982c['having'](_0xc12d('0x81'));}}if(_0x1cb476[_0xc12d('0x40')][_0xc12d('0x82')]){_0x355cc2=_[_0xc12d('0x83')](_0x1cb476[_0xc12d('0x40')][_0xc12d('0x82')])?_0x1cb476[_0xc12d('0x40')][_0xc12d('0x82')]:new Array(_0x1cb476['query'][_0xc12d('0x82')]);_0x355cc2[_0xc12d('0x37')](function(_0x496f5a){_0xb86938['or'](_0xc12d('0x70'),'%,'+_0x496f5a+',%');});}if(_0x1cb476[_0xc12d('0x40')][_0xc12d('0x84')]){var _0x370aca=_0x1cb476[_0xc12d('0x40')][_0xc12d('0x84')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x370aca)){_0x3c7c27['or'](_0xc12d('0x85'),_0x370aca+'%')['or']('i.phone\x20LIKE\x20?',_0x370aca+'%');}else{_0x3c7c27['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x370aca))['or'](_0xc12d('0x86'),_0x370aca+'%');}}}_0x4f982c[_0xc12d('0x4b')](_0x3c7c27);_0x4f982c[_0xc12d('0x87')](_0xc12d('0x88'));var _0x2d5c74={'type':db[_0xc12d('0x89')][_0xc12d('0x8a')][_0xc12d('0x8b')],'raw':!![]};var _0x2158a6=_0x4f982c['clone']();_0x2158a6[_0xc12d('0x4c')](_0xc12d('0x88'));_0x2158a6[_0xc12d('0x4c')](_0xc12d('0x8c'),_0xc12d('0x66'));if(_0x490029['order']){_0x490029[_0xc12d('0x49')][_0xc12d('0x37')](function(_0x27be92){var _0x5cc44b=_0x27be92[0x0]===_0xc12d('0x8d')?_0x27be92[0x0]:'i.'+_0x27be92[0x0];_0x4f982c['order'](_0x5cc44b,_0x27be92[0x1]===_0xc12d('0x8e')?![]:!![]);});}if(!_[_0xc12d('0x8f')](_0x355cc2)){_0x4f982c[_0xc12d('0x68')](_0xb86938);_0x2158a6[_0xc12d('0x4b')](_0xc12d('0x90'),_0x355cc2);}BPromise['resolve']()[_0xc12d('0x2d')](function(){if(!_0x548f71){if(_0x1cb476[_0xc12d('0x40')][_0xc12d('0x78')])return;_0x2158a6[_0xc12d('0x4b')](_0xc12d('0x91'));_0x4f982c[_0xc12d('0x4b')](_0xc12d('0x91'));return;}if(_0x1cb476[_0xc12d('0x92')]['role']!=='agent')return;return _0x1cb476[_0xc12d('0x92')][_0xc12d('0x93')]({'attributes':['id'],'raw':!![]})[_0xc12d('0x2d')](function(_0x13d5c2){if(_['isEmpty'](_0x13d5c2)){_0x2158a6[_0xc12d('0x4b')]('i.WhatsappAccountId\x20IS\x20NULL');_0x4f982c[_0xc12d('0x4b')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x2158a6[_0xc12d('0x4b')](_0xc12d('0x79'),_[_0xc12d('0x32')](_0x13d5c2,'id'));_0x4f982c[_0xc12d('0x4b')](_0xc12d('0x79'),_[_0xc12d('0x32')](_0x13d5c2,'id'));}});})['then'](function(){if(_0x1cb476['user'][_0xc12d('0x94')]===_0xc12d('0x95')&&!_0x548f71&&!_0x1cb476['query'][_0xc12d('0x78')])return[];return db[_0xc12d('0x96')][_0xc12d('0x40')](_0x2158a6[_0xc12d('0x97')](),_0x2d5c74);})[_0xc12d('0x2d')](function(_0x1d493c){_0x4bf9b1[_0xc12d('0x28')]=_0x1d493c[_0xc12d('0x46')];if(_0x4bf9b1[_0xc12d('0x28')]===0x0)return[];return db[_0xc12d('0x96')][_0xc12d('0x40')](_0x584146[_0xc12d('0x97')](),_0x2d5c74)[_0xc12d('0x2d')](function(_0xa92215){_0x35d341=_[_0xc12d('0x98')](_0xa92215,'id');_0x2d5c74=_[_0xc12d('0x99')](_0x2d5c74,{'model':db[_0xc12d('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1cb476[_0xc12d('0x40')][_0xc12d('0x45')]){_0x490029[_0xc12d('0x44')][_0xc12d('0x37')](function(_0x57b6c0){_0x4f982c['field']('i.'+_0x57b6c0);});}else{_0x4f982c[_0xc12d('0x4c')](_0xc12d('0x8c'),_0xc12d('0x66'));_0x4f982c[_0xc12d('0x4c')](_0xc12d('0x9a'),_0xc12d('0x9b'));_0x4f982c[_0xc12d('0x4c')]('a.mandatoryDisposition',_0xc12d('0x9c'));_0x4f982c[_0xc12d('0x4c')](_0xc12d('0x9d'),_0xc12d('0x8d'));_0x4f982c[_0xc12d('0x4c')](_0xc12d('0x9e'));_0x4f982c['field'](_0xc12d('0x9f'),_0xc12d('0xa0'));_0x4f982c[_0xc12d('0x4c')]('c.lastName','Contact.lastName');_0x4f982c['field']('c.email',_0xc12d('0xa1'));_0x4f982c[_0xc12d('0x4c')](_0xc12d('0xa2'),_0xc12d('0xa3'));_0x4f982c[_0xc12d('0x4c')](_0xc12d('0xa4'),'Contact.mobile');_0x4f982c[_0xc12d('0x4c')]('c.fax',_0xc12d('0xa5'));_0x4f982c[_0xc12d('0x4c')]('o.fullname',_0xc12d('0xa6'));_0x4f982c[_0xc12d('0x4c')]('o.internal','Owner.internal');_0x4f982c[_0xc12d('0x4c')](_0xc12d('0xa7'),_0xc12d('0x34'));}if(_0x490029[_0xc12d('0x27')])_0x4f982c[_0xc12d('0x27')](_0x490029[_0xc12d('0x27')]);if(_0x490029['offset'])_0x4f982c[_0xc12d('0x29')](_0x490029[_0xc12d('0x29')]);return db[_0xc12d('0x96')][_0xc12d('0x40')](_0x4f982c[_0xc12d('0x97')](),_0x2d5c74);})[_0xc12d('0x2d')](function(_0x5d0acc){if(_0x5d0acc[_0xc12d('0x46')]>0x0)_0x3f43a5[_0xc12d('0x4b')](_0xc12d('0xa8'),_[_0xc12d('0x32')](_0x5d0acc,'id'));return db[_0xc12d('0x96')][_0xc12d('0x40')](_0x3f43a5[_0xc12d('0x97')](),_0x2d5c74)['then'](function(_0x17b005){var _0x1bb961=_[_0xc12d('0xa9')](_0x17b005,_0xc12d('0xaa'));var _0xcadc3d=[];_0x5d0acc[_0xc12d('0x37')](function(_0x3897d4){_0xcadc3d['push'](updateWhatsappInteraction(_0x3897d4,_0x35d341,_0x1bb961));});return BPromise[_0xc12d('0xab')](_0xcadc3d);});});})['then'](function(_0x23eb0c){_0x4bf9b1[_0xc12d('0xac')]=_0x23eb0c;return _0x4bf9b1;})['then'](respondWithFilteredResult(_0x313739,_0x490029))[_0xc12d('0x39')](handleError(_0x313739,null));};exports[_0xc12d('0xad')]=function(_0x1f053c,_0x2b17d4){var _0x10746c={'raw':![],'where':{'id':_0x1f053c['params']['id']}},_0xdab603={};_0xdab603[_0xc12d('0x3e')]=_[_0xc12d('0x41')](db[_0xc12d('0x3a')][_0xc12d('0x3b')]);_0xdab603['query']=_[_0xc12d('0x41')](_0x1f053c[_0xc12d('0x40')]);_0xdab603[_0xc12d('0x42')]=_[_0xc12d('0x43')](_0xdab603[_0xc12d('0x3e')],_0xdab603['query']);_0x10746c[_0xc12d('0x44')]=_[_0xc12d('0x43')](_0xdab603[_0xc12d('0x3e')],qs['fields'](_0x1f053c['query']['fields']));_0x10746c['attributes']=_0x10746c['attributes']['length']?_0x10746c[_0xc12d('0x44')]:_0xdab603[_0xc12d('0x3e')];if(_0x1f053c[_0xc12d('0x40')][_0xc12d('0xae')]){_0x10746c[_0xc12d('0xaf')]=[{'all':!![]}];}_0x10746c=_[_0xc12d('0x99')]({},_0x10746c,_0x1f053c[_0xc12d('0xb0')]);return db['WhatsappInteraction'][_0xc12d('0x65')](_0x10746c)[_0xc12d('0x2d')](handleEntityNotFound(_0x2b17d4,null))[_0xc12d('0x2d')](respondWithResult(_0x2b17d4,null))[_0xc12d('0x39')](handleError(_0x2b17d4,null));};exports['create']=function(_0x5356e1,_0x481ddb){return db[_0xc12d('0x3a')][_0xc12d('0xb1')](_0x5356e1[_0xc12d('0x76')],{})[_0xc12d('0x2d')](respondWithResult(_0x481ddb,0xc9))['catch'](handleError(_0x481ddb,null));};exports[_0xc12d('0xb2')]=function(_0x389b19,_0x4675ae){if(_0x389b19[_0xc12d('0x76')]['id']){delete _0x389b19[_0xc12d('0x76')]['id'];}return db['WhatsappInteraction'][_0xc12d('0x65')]({'where':{'id':_0x389b19[_0xc12d('0xb3')]['id']}})['then'](handleEntityNotFound(_0x4675ae,null))[_0xc12d('0x2d')](saveUpdates(_0x389b19[_0xc12d('0x76')],null))[_0xc12d('0x2d')](respondWithResult(_0x4675ae,null))[_0xc12d('0x39')](handleError(_0x4675ae,null));};exports[_0xc12d('0x2e')]=function(_0x6e9fe5,_0x20d34b){return db[_0xc12d('0x3a')][_0xc12d('0x65')]({'where':{'id':_0x6e9fe5[_0xc12d('0xb3')]['id']}})['then'](handleEntityNotFound(_0x20d34b,null))[_0xc12d('0x2d')](removeEntity(_0x20d34b,null))[_0xc12d('0x39')](handleError(_0x20d34b,null));};exports[_0xc12d('0xb4')]=function(_0x2a5537,_0xb3bfae){return db['WhatsappInteraction'][_0xc12d('0xb4')]()[_0xc12d('0x2d')](respondWithResult(_0xb3bfae,null))[_0xc12d('0x39')](handleError(_0xb3bfae,null));};exports[_0xc12d('0xb5')]=function(_0x155fdc,_0x35e2db,_0x586ce9){return db[_0xc12d('0xb6')][_0xc12d('0x65')]({'where':{'id':_0x155fdc['params']['id']}})['then'](handleEntityNotFound(_0x35e2db,null))[_0xc12d('0x2d')](function(_0x475fab){if(_0x475fab){return _0x475fab[_0xc12d('0xb5')](_0x155fdc[_0xc12d('0x76')][_0xc12d('0xb7')],_['omit'](_0x155fdc[_0xc12d('0x76')],[_0xc12d('0xb7'),'id'])||{});}})[_0xc12d('0x2d')](respondWithResult(_0x35e2db,null))['catch'](handleError(_0x35e2db,null));};exports['getMessages']=function(_0x5608f3,_0xdd22c3,_0x17bfa3){var _0x17388f={'raw':![],'where':{}};var _0x28e863={};var _0x5e8b60={'count':0x0,'rows':[]};return db[_0xc12d('0x3a')][_0xc12d('0xb8')]({'where':{'id':_0x5608f3[_0xc12d('0xb3')]['id']}})[_0xc12d('0x2d')](handleEntityNotFound(_0xdd22c3,null))[_0xc12d('0x2d')](function(_0x3ff71e){if(_0x3ff71e){_0x28e863[_0xc12d('0x3e')]=_[_0xc12d('0x41')](db[_0xc12d('0xb6')][_0xc12d('0x3b')]);_0x28e863[_0xc12d('0x40')]=_['keys'](_0x5608f3['query']);_0x28e863[_0xc12d('0x42')]=_['intersection'](_0x28e863[_0xc12d('0x3e')],_0x28e863[_0xc12d('0x40')]);_0x17388f['attributes']=_[_0xc12d('0x43')](_0x28e863['model'],qs[_0xc12d('0x45')](_0x5608f3['query']['fields']));_0x17388f[_0xc12d('0x44')]=_0x17388f['attributes']['length']?_0x17388f[_0xc12d('0x44')]:_0x28e863[_0xc12d('0x3e')];if(!_0x5608f3[_0xc12d('0x40')]['hasOwnProperty'](_0xc12d('0x48'))){_0x17388f[_0xc12d('0x27')]=qs[_0xc12d('0x27')](_0x5608f3[_0xc12d('0x40')][_0xc12d('0x27')]);_0x17388f['offset']=qs[_0xc12d('0x29')](_0x5608f3[_0xc12d('0x40')][_0xc12d('0x29')]);}_0x17388f[_0xc12d('0x49')]=qs['sort'](_0x5608f3[_0xc12d('0x40')][_0xc12d('0x4a')]);_0x17388f[_0xc12d('0x4b')]=qs[_0xc12d('0x42')](_['pick'](_0x5608f3['query'],_0x28e863['filters']));_0x17388f[_0xc12d('0x4b')][_0xc12d('0xaa')]=_0x3ff71e['id'];if(_0x5608f3[_0xc12d('0x40')]['filter']){_0x17388f['where']=_[_0xc12d('0x99')](_0x17388f[_0xc12d('0x4b')],{'$or':_[_0xc12d('0x32')](_0x17388f[_0xc12d('0x44')],function(_0x267548){var _0x534d13={};_0x534d13[_0x267548]={'$like':'%'+_0x5608f3[_0xc12d('0x40')][_0xc12d('0x84')]+'%'};return _0x534d13;})});}if(_0x5608f3[_0xc12d('0x40')][_0xc12d('0xb9')]){var _0x219696=_0x5608f3[_0xc12d('0x40')]['$gte']['split'](',');var _0x29c218={};_0x29c218[_0x219696[0x0]]={'$gte':moment(_0x219696[0x1])[_0xc12d('0xba')](_0xc12d('0xbb'))};_0x17388f[_0xc12d('0x4b')]=_[_0xc12d('0x99')](_0x17388f[_0xc12d('0x4b')],_0x29c218);}_0x17388f=_['merge']({},_0x17388f,_0x5608f3[_0xc12d('0xb0')]);return db[_0xc12d('0xb6')][_0xc12d('0x28')]({'where':_0x17388f[_0xc12d('0x4b')]})['then'](function(_0x34e1a2){_0x5e8b60[_0xc12d('0x28')]=_0x34e1a2;if(_0x5608f3[_0xc12d('0x40')][_0xc12d('0xae')]){_0x17388f[_0xc12d('0xaf')]=[{'all':!![]}];}return db[_0xc12d('0xb6')][_0xc12d('0xbc')](_0x17388f);})[_0xc12d('0x2d')](function(_0x5ca5a9){_0x5e8b60[_0xc12d('0xac')]=_0x5ca5a9;return _0x5e8b60;});}})[_0xc12d('0x2d')](respondWithFilteredResult(_0xdd22c3,_0x17388f))[_0xc12d('0x39')](handleError(_0xdd22c3,null));};exports[_0xc12d('0xbd')]=function(_0x2ca10b,_0x65a89b,_0xc4f5fc){return db[_0xc12d('0x3a')][_0xc12d('0x65')]({'where':{'id':_0x2ca10b[_0xc12d('0xb3')]['id']}})['then'](handleEntityNotFound(_0x65a89b,null))[_0xc12d('0x2d')](function(_0x4d9c02){if(_0x4d9c02){return _0x4d9c02['setTags'](_0x2ca10b[_0xc12d('0x76')][_0xc12d('0xb7')],_[_0xc12d('0xbe')](_0x2ca10b[_0xc12d('0x76')],[_0xc12d('0xb7'),'id'])||{})[_0xc12d('0xbf')](function(){return db['Tag'][_0xc12d('0xbc')]({'attributes':['id','name',_0xc12d('0x4d')],'where':{'id':_0x2ca10b[_0xc12d('0x76')][_0xc12d('0xb7')]}});})[_0xc12d('0x2d')](function(_0x550515){socket[_0xc12d('0xc0')](_0xc12d('0xc1'),{'id':Number(_0x2ca10b['params']['id']),'tags':_0x550515||[]});return{'id':Number(_0x2ca10b[_0xc12d('0xb3')]['id']),'tags':_0x550515||[]};});}})[_0xc12d('0x2d')](respondWithResult(_0x65a89b,null))[_0xc12d('0x39')](handleError(_0x65a89b,null));};exports[_0xc12d('0xc2')]=function(_0x2cc582,_0x3a6d1b,_0x4a59b1){return db[_0xc12d('0x3a')]['find']({'where':{'id':_0x2cc582[_0xc12d('0xb3')]['id']}})[_0xc12d('0x2d')](handleEntityNotFound(_0x3a6d1b,null))['then'](function(_0x4f91e7){if(_0x4f91e7){return _0x4f91e7[_0xc12d('0xc2')](_0x2cc582[_0xc12d('0x40')]['ids']);}})[_0xc12d('0x2d')](respondWithStatusCode(_0x3a6d1b,null))[_0xc12d('0x39')](handleError(_0x3a6d1b,null));};exports[_0xc12d('0xc3')]=function(_0x22bc57,_0x3c121e){var _0x2e059c=moment()[_0xc12d('0xc4')]()[_0xc12d('0x97')]();var _0x647b06=path[_0xc12d('0xc5')](config[_0xc12d('0xc6')],_0xc12d('0xc7'),_0xc12d('0xc8'),_0xc12d('0xc9'));var _0x110db6=path[_0xc12d('0xc5')](config[_0xc12d('0xc6')],_0xc12d('0xc7'),_0xc12d('0xc8'),_0xc12d('0xca'));var _0x3ace05=path[_0xc12d('0xc5')](_0x647b06,_0x2e059c);var _0x28b978=util[_0xc12d('0xba')](_0xc12d('0xcb'),_0x22bc57['params']['id'],_0x2e059c);var _0x3f882d=path[_0xc12d('0xc5')](_0x647b06,_0x28b978);var _0x567f5e=[];_0x567f5e['push']({'model':db[_0xc12d('0x71')],'as':_0xc12d('0x71'),'attributes':['id',_0xc12d('0x33')],'raw':!![]});_0x567f5e[_0xc12d('0x38')]({'model':db[_0xc12d('0xcc')],'as':_0xc12d('0xcd'),'attributes':['id',_0xc12d('0xce'),'lastName'],'raw':!![]});if(_0x22bc57[_0xc12d('0x40')][_0xc12d('0xca')]){_0x567f5e['push']({'model':db[_0xc12d('0xcf')],'as':_0xc12d('0xcf'),'raw':!![]});}var _0x4e0c31=[{'model':db[_0xc12d('0xb6')],'as':_0xc12d('0xd0'),'attributes':['id',_0xc12d('0x76'),_0xc12d('0xd1'),_0xc12d('0xd2'),_0xc12d('0xd3'),'read'],'include':_0x567f5e}];_0x4e0c31[_0xc12d('0x38')]({'model':db[_0xc12d('0xd4')],'as':'Account','attributes':['id',_0xc12d('0x3f')]});_0x4e0c31[_0xc12d('0x38')]({'model':db['User'],'as':_0xc12d('0xd5'),'attributes':['id',_0xc12d('0x33')]});return db['WhatsappInteraction']['find']({'where':{'id':_0x22bc57['params']['id']},'include':_0x4e0c31})['then'](handleEntityNotFound(_0x3c121e,null))[_0xc12d('0x2d')](function(_0x2ca133){if(_0x2ca133){var _0x1830c8=_0x2ca133[_0xc12d('0xd6')]({'plain':!![]});fs[_0xc12d('0xd7')](_0x3ace05);var _0x359c6d={'channel':'Whatsapp','account':_0x1830c8[_0xc12d('0xd8')]['name'],'agent':_0x1830c8[_0xc12d('0xd5')]?_0x1830c8[_0xc12d('0xd5')][_0xc12d('0x33')]:_0xc12d('0xd9'),'createdAt':moment(_0x1830c8[_0xc12d('0xd1')])['format'](_0xc12d('0xbb'))['toString'](),'closedAt':_0x1830c8['closed']?moment(_0x1830c8['closedAt'])[_0xc12d('0xba')](_0xc12d('0xbb'))[_0xc12d('0x97')]():'','disposition':_0x1830c8[_0xc12d('0xda')],'messages':_(_0x1830c8[_0xc12d('0xd0')])[_0xc12d('0x84')]({'secret':![]})[_0xc12d('0x32')](function(_0x56da14){if(_0x56da14[_0xc12d('0xcf')]){var _0x2b73a7=path['join'](_0x110db6,_0x56da14['Attachment'][_0xc12d('0xdb')]);if(fs[_0xc12d('0xdc')](_0x2b73a7)){fs[_0xc12d('0xdd')](_0x2b73a7)[_0xc12d('0xde')](fs[_0xc12d('0xdf')](path['join'](_0x3ace05,_0x56da14['Attachment']['basename'])));}}return{'date':moment(_0x56da14['createdAt'])['format'](_0xc12d('0xbb'))['toString'](),'sender':_0x56da14[_0xc12d('0xd2')]===_0xc12d('0xe0')?_0x56da14[_0xc12d('0x71')]?_0x56da14[_0xc12d('0x71')][_0xc12d('0x33')]:'System':_0x56da14[_0xc12d('0xcd')]['firstName']+(_0x56da14[_0xc12d('0xcd')][_0xc12d('0xe1')]?'\x20'+_0x56da14[_0xc12d('0xcd')][_0xc12d('0xe1')]:''),'body':_0x56da14['Attachment']?_0x56da14[_0xc12d('0xcf')]['basename']:_0x56da14['body'],'direction':_0x56da14['direction']===_0xc12d('0xe0')?'A':'C','secret':_0x56da14[_0xc12d('0xd3')],'read':_0x56da14[_0xc12d('0x7f')],'attachment':_0x56da14[_0xc12d('0xcf')]};})[_0xc12d('0x67')]()};return ejs[_0xc12d('0xe2')](path[_0xc12d('0xc5')](config[_0xc12d('0xc6')],_0xc12d('0xc7'),'views',_0xc12d('0xe3')),{'interaction':_0x359c6d})[_0xc12d('0x2d')](function(_0x4a8006){var _0x5184f7=path[_0xc12d('0xc5')](_0x3ace05,_0xc12d('0xe4')+_0x1830c8['id']+'-'+_0x2e059c+_0xc12d('0xe5'));var _0x36cbd1={'path':_0x5184f7,'channel':_0xc12d('0xe6'),'interactionId':_0x1830c8['id']};return pdf[_0xc12d('0xe7')](_0x4a8006,_0x36cbd1);})['then'](function(){return new BPromise(function(_0x4f90b8,_0x25722b){zipdir(_0x3ace05,{'saveTo':_0x3f882d},function(_0x3a8fdb,_0x2bca24){if(_0x3a8fdb)return _0x25722b(_0x3a8fdb);return _0x4f90b8(_0x2bca24);});})[_0xc12d('0x2d')](function(){return new BPromise(function(_0x59627b,_0x2919f0){rimraf(_0x3ace05,function(_0x230cad){if(_0x230cad)_0x2919f0(_0x230cad);return _0x59627b();});});})['then'](function(){return _0x3c121e[_0xc12d('0xc3')](_0x3f882d,_0x28b978,function(_0x2d5c8e){if(_0x2d5c8e){console[_0xc12d('0xe8')](_0xc12d('0xe9'),_0x2d5c8e);}else{fs[_0xc12d('0xea')](_0x3f882d);}});});});}else{return _0x3c121e[_0xc12d('0x22')](0xc8);}})[_0xc12d('0x39')](handleError(_0x3c121e,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 91690c0..d46e916 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 _0x1df5=['unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','save','update','remove','getUsers','Users','map','findAll','then','setDataValue'];(function(_0x5414af,_0x16970d){var _0x20c9f6=function(_0x3d28de){while(--_0x3d28de){_0x5414af['push'](_0x5414af['shift']());}};_0x20c9f6(++_0x16970d);}(_0x1df5,0xfd));var _0x51df=function(_0x2785de,_0xcbf4b3){_0x2785de=_0x2785de-0x0;var _0x1f6afc=_0x1df5[_0x2785de];return _0x1f6afc;};'use strict';var EventEmitter=require(_0x51df('0x0'));var WhatsappInteraction=require(_0x51df('0x1'))['db'][_0x51df('0x2')];var WhatsappMessage=require(_0x51df('0x1'))['db'][_0x51df('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x51df('0x4'),'afterUpdate':_0x51df('0x5'),'afterDestroy':_0x51df('0x6')};function emitEvent(_0x34fedd){return function(_0x5ff7ba,_0xd33a85,_0x15de76){_0x5ff7ba[_0x51df('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1316c2){_0x5ff7ba['setDataValue'](_0x51df('0x8'),_0x1316c2[_0x51df('0x9')](function(_0x8dbf50){return{'id':_0x8dbf50['id']};}));return WhatsappMessage[_0x51df('0xa')]({'where':{'WhatsappInteractionId':_0x5ff7ba['id'],'direction':'in','read':![]},'raw':!![]});})[_0x51df('0xb')](function(_0x130cd5){_0x5ff7ba[_0x51df('0xc')](_0x51df('0xd'),_0x130cd5['length']);WhatsappInteractionEvents[_0x51df('0xe')](_0x34fedd+':'+_0x5ff7ba['id'],_0x5ff7ba);WhatsappInteractionEvents[_0x51df('0xe')](_0x34fedd,_0x5ff7ba);_0x15de76(null);})[_0x51df('0xf')](_0x15de76(null));};}for(var e in events){if(events[_0x51df('0x10')](e)){var event=events[e];WhatsappInteraction[_0x51df('0x11')](e,emitEvent(event));}}module[_0x51df('0x12')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x1491=['WhatsappInteraction','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','length','hasOwnProperty','events','../../mysqldb'];(function(_0x609988,_0x507944){var _0x159984=function(_0x39d9ce){while(--_0x39d9ce){_0x609988['push'](_0x609988['shift']());}};_0x159984(++_0x507944);}(_0x1491,0x1b1));var _0x1149=function(_0x203d6c,_0x40857d){_0x203d6c=_0x203d6c-0x0;var _0xcbf00f=_0x1491[_0x203d6c];return _0xcbf00f;};'use strict';var EventEmitter=require(_0x1149('0x0'));var WhatsappInteraction=require(_0x1149('0x1'))['db'][_0x1149('0x2')];var WhatsappMessage=require(_0x1149('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x1149('0x3')](0x0);var events={'afterCreate':_0x1149('0x4'),'afterUpdate':_0x1149('0x5'),'afterDestroy':_0x1149('0x6')};function emitEvent(_0x443acb){return function(_0x206e15,_0x2bf83d,_0x14b438){_0x206e15[_0x1149('0x7')]({'attributes':['id'],'raw':!![]})[_0x1149('0x8')](function(_0x15513b){_0x206e15[_0x1149('0x9')](_0x1149('0xa'),_0x15513b[_0x1149('0xb')](function(_0x2fa4de){return{'id':_0x2fa4de['id']};}));return WhatsappMessage[_0x1149('0xc')]({'where':{'WhatsappInteractionId':_0x206e15['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1149('0x8')](function(_0x449487){_0x206e15[_0x1149('0x9')]('unreadMessages',_0x449487[_0x1149('0xd')]);WhatsappInteractionEvents['emit'](_0x443acb+':'+_0x206e15['id'],_0x206e15);WhatsappInteractionEvents['emit'](_0x443acb,_0x206e15);_0x14b438(null);})['catch'](_0x14b438(null));};}for(var e in events){if(events[_0x1149('0xe')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 9b38691..3db0b85 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 _0xc33d=['format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','whatsapp_interactions','changed','closedAt'];(function(_0x545e64,_0x5879d0){var _0x595cbf=function(_0x2cfe77){while(--_0x2cfe77){_0x545e64['push'](_0x545e64['shift']());}};_0x595cbf(++_0x5879d0);}(_0xc33d,0x1cd));var _0xdc33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc33d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xdc33('0x0'));var logger=require(_0xdc33('0x1'))(_0xdc33('0x2'));var moment=require(_0xdc33('0x3'));var BPromise=require(_0xdc33('0x4'));var rp=require(_0xdc33('0x5'));var fs=require('fs');var path=require(_0xdc33('0x6'));var rimraf=require(_0xdc33('0x7'));var config=require(_0xdc33('0x8'));var attributes=require(_0xdc33('0x9'));module[_0xdc33('0xa')]=function(_0x4d0658,_0x5d986e){return _0x4d0658[_0xdc33('0xb')]('WhatsappInteraction',attributes,{'tableName':_0xdc33('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x57d79b,_0x7f67ff,_0x1be58b){if(_0x57d79b[_0xdc33('0xd')]('closed')){_0x57d79b[_0xdc33('0xe')]=moment()[_0xdc33('0xf')](_0xdc33('0x10'));}_0x1be58b(null,_0x57d79b);}}});}; \ No newline at end of file +var _0xa83c=['moment','bluebird','rimraf','../../config/environment','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0x3dae38,_0x49fa3d){var _0x3d6a2f=function(_0x19561d){while(--_0x19561d){_0x3dae38['push'](_0x3dae38['shift']());}};_0x3d6a2f(++_0x49fa3d);}(_0xa83c,0xa2));var _0xca83=function(_0x5ad0d7,_0x2645f8){_0x5ad0d7=_0x5ad0d7-0x0;var _0xd83bd=_0xa83c[_0x5ad0d7];return _0xd83bd;};'use strict';var _=require(_0xca83('0x0'));var util=require(_0xca83('0x1'));var logger=require(_0xca83('0x2'))('api');var moment=require(_0xca83('0x3'));var BPromise=require(_0xca83('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xca83('0x5'));var config=require(_0xca83('0x6'));var attributes=require('./whatsappInteraction.attributes');module['exports']=function(_0x2a102c,_0x4635ec){return _0x2a102c[_0xca83('0x7')](_0xca83('0x8'),attributes,{'tableName':_0xca83('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x52418e,_0x50bc06,_0x39920c){if(_0x52418e[_0xca83('0xa')](_0xca83('0xb'))){_0x52418e[_0xca83('0xc')]=moment()[_0xca83('0xd')](_0xca83('0xe'));}_0x39920c(null,_0x52418e);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 95a70b9..ccbc7aa 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 _0xaca2=['redis','defaults','localhost','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','attributes','then','AddTagsToWhatsappInteraction','addTags','ids','omit','spread','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0xa7e16e,_0x3dffb0){var _0xd9b0a8=function(_0x204967){while(--_0x204967){_0xa7e16e['push'](_0xa7e16e['shift']());}};_0xd9b0a8(++_0x3dffb0);}(_0xaca2,0x168));var _0x2aca=function(_0x435117,_0x2b9bad){_0x435117=_0x435117-0x0;var _0x585a63=_0xaca2[_0x435117];return _0x585a63;};'use strict';var _=require(_0x2aca('0x0'));var util=require('util');var moment=require(_0x2aca('0x1'));var BPromise=require('bluebird');var rs=require(_0x2aca('0x2'));var fs=require('fs');var Redis=require(_0x2aca('0x3'));var db=require(_0x2aca('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2aca('0x5'))(_0x2aca('0x6'));var config=require(_0x2aca('0x7'));var jayson=require(_0x2aca('0x8'));var client=jayson['client'][_0x2aca('0x9')]({'port':0x232a});config[_0x2aca('0xa')]=_[_0x2aca('0xb')](config['redis'],{'host':_0x2aca('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2aca('0xa')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x59acd1,_0x593b54,_0xb7ac2e){return new BPromise(function(_0x4c1618,_0x5d0ab9){return client['request'](_0x59acd1,_0xb7ac2e)['then'](function(_0x4aadec){logger[_0x2aca('0xd')](_0x2aca('0xe'),_0x593b54,_0x2aca('0xf'));logger[_0x2aca('0x10')](_0x2aca('0x11'),_0x593b54,_0x2aca('0xf'),JSON[_0x2aca('0x12')](_0x4aadec));if(_0x4aadec[_0x2aca('0x13')]){if(_0x4aadec[_0x2aca('0x13')]['code']===0x1f4){logger[_0x2aca('0x13')](_0x2aca('0xe'),_0x593b54,_0x4aadec[_0x2aca('0x13')][_0x2aca('0x14')]);return _0x5d0ab9(_0x4aadec[_0x2aca('0x13')][_0x2aca('0x14')]);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x593b54,_0x4aadec[_0x2aca('0x13')][_0x2aca('0x14')]);return _0x4c1618(_0x4aadec[_0x2aca('0x13')][_0x2aca('0x14')]);}else{logger[_0x2aca('0xd')]('WhatsappInteraction,\x20%s,\x20%s',_0x593b54,'request\x20sent');_0x4c1618(_0x4aadec[_0x2aca('0x15')][_0x2aca('0x14')]);}})[_0x2aca('0x16')](function(_0x9989ef){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x593b54,_0x9989ef);_0x5d0ab9(_0x9989ef);});});}exports[_0x2aca('0x17')]=function(_0x470e15){var _0x2d6bb0=this;return new Promise(function(_0x38c292,_0x3b8680){return db[_0x2aca('0x18')][_0x2aca('0x19')](_0x470e15[_0x2aca('0x1a')],{'raw':_0x470e15[_0x2aca('0x1b')]?_0x470e15[_0x2aca('0x1b')][_0x2aca('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x470e15[_0x2aca('0x1b')]?_0x470e15['options']['where']||null:null,'attributes':_0x470e15[_0x2aca('0x1b')]?_0x470e15[_0x2aca('0x1b')][_0x2aca('0x1d')]||null:null,'limit':_0x470e15[_0x2aca('0x1b')]?_0x470e15['options']['limit']||null:null})[_0x2aca('0x1e')](function(_0x229c6b){logger[_0x2aca('0xd')](_0x2aca('0x17'),_0x470e15);logger['debug'](_0x2aca('0x17'),_0x470e15,JSON['stringify'](_0x229c6b));_0x38c292(_0x229c6b);})[_0x2aca('0x16')](function(_0x3c2861){logger[_0x2aca('0x13')](_0x2aca('0x17'),_0x3c2861['message'],_0x470e15);_0x3b8680(_0x2d6bb0['error'](0x1f4,_0x3c2861[_0x2aca('0x14')]));});});};exports[_0x2aca('0x1f')]=function(_0x85db05){return new Promise(function(_0x15d9fa,_0xe9b59c){return db[_0x2aca('0x18')]['find']({'where':_0x85db05[_0x2aca('0x1b')]?_0x85db05['options']['where']||null:null})[_0x2aca('0x1e')](function(_0xc9a03f){if(_0xc9a03f){return _0xc9a03f[_0x2aca('0x20')](_0x85db05[_0x2aca('0x1a')][_0x2aca('0x21')],_[_0x2aca('0x22')](_0x85db05['body'],['ids','id'])||{});}})[_0x2aca('0x23')](function(_0x406abe){logger[_0x2aca('0xd')](_0x2aca('0x24'),_0x85db05);logger['debug'](_0x2aca('0x24'),_0x85db05,JSON[_0x2aca('0x12')](_0x406abe));_0x15d9fa(_0x406abe);})[_0x2aca('0x16')](function(_0x4cce4b){logger['error'](_0x2aca('0x24'),_0x4cce4b[_0x2aca('0x14')],_0x85db05);_0xe9b59c(_this[_0x2aca('0x13')](0x1f4,_0x4cce4b[_0x2aca('0x14')]));});});}; \ No newline at end of file +var _0xbbd2=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','where','attributes','stringify','AddTagsToWhatsappInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment'];(function(_0x382f44,_0x3a1b12){var _0x2fe454=function(_0x5a2e82){while(--_0x5a2e82){_0x382f44['push'](_0x382f44['shift']());}};_0x2fe454(++_0x3a1b12);}(_0xbbd2,0x100));var _0x2bbd=function(_0x3c487b,_0x44c5e2){_0x3c487b=_0x3c487b-0x0;var _0x1d65f6=_0xbbd2[_0x3c487b];return _0x1d65f6;};'use strict';var _=require(_0x2bbd('0x0'));var util=require('util');var moment=require(_0x2bbd('0x1'));var BPromise=require(_0x2bbd('0x2'));var rs=require(_0x2bbd('0x3'));var fs=require('fs');var Redis=require(_0x2bbd('0x4'));var db=require(_0x2bbd('0x5'))['db'];var utils=require(_0x2bbd('0x6'));var logger=require(_0x2bbd('0x7'))(_0x2bbd('0x8'));var config=require(_0x2bbd('0x9'));var jayson=require(_0x2bbd('0xa'));var client=jayson[_0x2bbd('0xb')][_0x2bbd('0xc')]({'port':0x232a});config[_0x2bbd('0xd')]=_['defaults'](config[_0x2bbd('0xd')],{'host':_0x2bbd('0xe'),'port':0x18eb});var socket=require(_0x2bbd('0xf'))(new Redis(config['redis']));require(_0x2bbd('0x10'))[_0x2bbd('0x11')](socket);function respondWithRpcPromise(_0x3c4634,_0x3d582e,_0x3ec7cb){return new BPromise(function(_0x1f1e00,_0x15192e){return client['request'](_0x3c4634,_0x3ec7cb)[_0x2bbd('0x12')](function(_0x3de9b0){logger[_0x2bbd('0x13')](_0x2bbd('0x14'),_0x3d582e,_0x2bbd('0x15'));logger[_0x2bbd('0x16')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x3d582e,_0x2bbd('0x15'),JSON['stringify'](_0x3de9b0));if(_0x3de9b0[_0x2bbd('0x17')]){if(_0x3de9b0[_0x2bbd('0x17')][_0x2bbd('0x18')]===0x1f4){logger[_0x2bbd('0x17')](_0x2bbd('0x14'),_0x3d582e,_0x3de9b0[_0x2bbd('0x17')][_0x2bbd('0x19')]);return _0x15192e(_0x3de9b0[_0x2bbd('0x17')][_0x2bbd('0x19')]);}logger['error'](_0x2bbd('0x14'),_0x3d582e,_0x3de9b0[_0x2bbd('0x17')][_0x2bbd('0x19')]);return _0x1f1e00(_0x3de9b0[_0x2bbd('0x17')][_0x2bbd('0x19')]);}else{logger[_0x2bbd('0x13')]('WhatsappInteraction,\x20%s,\x20%s',_0x3d582e,_0x2bbd('0x15'));_0x1f1e00(_0x3de9b0[_0x2bbd('0x1a')][_0x2bbd('0x19')]);}})[_0x2bbd('0x1b')](function(_0x2cd304){logger[_0x2bbd('0x17')](_0x2bbd('0x14'),_0x3d582e,_0x2cd304);_0x15192e(_0x2cd304);});});}exports[_0x2bbd('0x1c')]=function(_0x2df9bf){var _0x498299=this;return new Promise(function(_0x1e50d1,_0x2c8681){return db[_0x2bbd('0x1d')][_0x2bbd('0x1e')](_0x2df9bf[_0x2bbd('0x1f')],{'raw':_0x2df9bf[_0x2bbd('0x20')]?_0x2df9bf[_0x2bbd('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2df9bf[_0x2bbd('0x20')]?_0x2df9bf[_0x2bbd('0x20')][_0x2bbd('0x21')]||null:null,'attributes':_0x2df9bf['options']?_0x2df9bf[_0x2bbd('0x20')][_0x2bbd('0x22')]||null:null,'limit':_0x2df9bf[_0x2bbd('0x20')]?_0x2df9bf['options']['limit']||null:null})[_0x2bbd('0x12')](function(_0x522e71){logger['info'](_0x2bbd('0x1c'),_0x2df9bf);logger[_0x2bbd('0x16')](_0x2bbd('0x1c'),_0x2df9bf,JSON[_0x2bbd('0x23')](_0x522e71));_0x1e50d1(_0x522e71);})[_0x2bbd('0x1b')](function(_0x1c53bf){logger[_0x2bbd('0x17')](_0x2bbd('0x1c'),_0x1c53bf['message'],_0x2df9bf);_0x2c8681(_0x498299[_0x2bbd('0x17')](0x1f4,_0x1c53bf[_0x2bbd('0x19')]));});});};exports[_0x2bbd('0x24')]=function(_0x486286){return new Promise(function(_0xcfb1f8,_0x29dd39){return db[_0x2bbd('0x1d')][_0x2bbd('0x25')]({'where':_0x486286[_0x2bbd('0x20')]?_0x486286[_0x2bbd('0x20')]['where']||null:null})[_0x2bbd('0x12')](function(_0x4aa92d){if(_0x4aa92d){return _0x4aa92d[_0x2bbd('0x26')](_0x486286[_0x2bbd('0x1f')][_0x2bbd('0x27')],_[_0x2bbd('0x28')](_0x486286[_0x2bbd('0x1f')],[_0x2bbd('0x27'),'id'])||{});}})[_0x2bbd('0x29')](function(_0x1b0037){logger[_0x2bbd('0x13')](_0x2bbd('0x2a'),_0x486286);logger['debug']('AddTags',_0x486286,JSON['stringify'](_0x1b0037));_0xcfb1f8(_0x1b0037);})[_0x2bbd('0x1b')](function(_0x13385f){logger['error'](_0x2bbd('0x2a'),_0x13385f[_0x2bbd('0x19')],_0x486286);_0x29dd39(_this[_0x2bbd('0x17')](0x1f4,_0x13385f[_0x2bbd('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index ef7cedc..a0fcce4 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 _0x852c=['save','emit','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x852c,0x1d4));var _0xc852=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x852c[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappInteractionEvents=require(_0xc852('0x0'));var events=[_0xc852('0x1'),'remove','update'];function createListener(_0x448a9a,_0x40d89a){return function(_0x3d4941){_0x40d89a[_0xc852('0x2')](_0x448a9a,_0x3d4941);};}function removeListener(_0x39477b,_0xd57e66){return function(){WhatsappInteractionEvents[_0xc852('0x3')](_0x39477b,_0xd57e66);};}exports[_0xc852('0x4')]=function(_0x4d1c6b){for(var _0x21619b=0x0,_0x10dba9=events[_0xc852('0x5')];_0x21619b<_0x10dba9;_0x21619b++){var _0x28d952=events[_0x21619b];var _0x2e18b9=createListener(_0xc852('0x6')+_0x28d952,_0x4d1c6b);WhatsappInteractionEvents['on'](_0x28d952,_0x2e18b9);}}; \ No newline at end of file +var _0x58dc=['update','register','./whatsappInteraction.events','save'];(function(_0x1bbcb0,_0x5d46a3){var _0x5c53f7=function(_0x334d44){while(--_0x334d44){_0x1bbcb0['push'](_0x1bbcb0['shift']());}};_0x5c53f7(++_0x5d46a3);}(_0x58dc,0x1e6));var _0xc58d=function(_0x4421c2,_0x3f49d1){_0x4421c2=_0x4421c2-0x0;var _0x20bf20=_0x58dc[_0x4421c2];return _0x20bf20;};'use strict';var WhatsappInteractionEvents=require(_0xc58d('0x0'));var events=[_0xc58d('0x1'),'remove',_0xc58d('0x2')];function createListener(_0x12ccba,_0x45167a){return function(_0x5cfefa){_0x45167a['emit'](_0x12ccba,_0x5cfefa);};}function removeListener(_0x4dcefc,_0x1b57eb){return function(){WhatsappInteractionEvents['removeListener'](_0x4dcefc,_0x1b57eb);};}exports[_0xc58d('0x3')]=function(_0x277749){for(var _0xdc20df=0x0,_0x24e648=events['length'];_0xdc20df<_0x24e648;_0xdc20df++){var _0x32fe3b=events[_0xdc20df];var _0x16d03c=createListener('whatsappInteraction:'+_0x32fe3b,_0x277749);WhatsappInteractionEvents['on'](_0x32fe3b,_0x16d03c);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 4d804c4..7a65814 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 _0x7fcc=['/:id','tracked','whatsappmessage:create','create','post','status','put','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','describe'];(function(_0x34ad72,_0x1e43f6){var _0x5c9aa8=function(_0x144388){while(--_0x144388){_0x34ad72['push'](_0x34ad72['shift']());}};_0x5c9aa8(++_0x1e43f6);}(_0x7fcc,0x75));var _0xc7fc=function(_0x242b97,_0x1029d1){_0x242b97=_0x242b97-0x0;var _0x105e69=_0x7fcc[_0x242b97];return _0x105e69;};'use strict';var multer=require(_0xc7fc('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc7fc('0x1'));var express=require(_0xc7fc('0x2'));var router=express[_0xc7fc('0x3')]();var fs_extra=require(_0xc7fc('0x4'));var auth=require(_0xc7fc('0x5'));var interaction=require(_0xc7fc('0x6'));var config=require(_0xc7fc('0x7'));var controller=require(_0xc7fc('0x8'));router[_0xc7fc('0x9')]('/',auth[_0xc7fc('0xa')](),controller[_0xc7fc('0xb')]);router['get']('/describe',auth[_0xc7fc('0xa')](),controller[_0xc7fc('0xc')]);router[_0xc7fc('0x9')](_0xc7fc('0xd'),auth[_0xc7fc('0xa')](),controller['show']);router['post']('/',auth[_0xc7fc('0xa')](),interaction[_0xc7fc('0xe')]('whatsapp',_0xc7fc('0xf')),controller[_0xc7fc('0x10')]);router[_0xc7fc('0x11')]('/:id/status',controller[_0xc7fc('0x12')]);router['put'](_0xc7fc('0xd'),auth[_0xc7fc('0xa')](),controller['update']);router[_0xc7fc('0x13')](_0xc7fc('0x14'),auth[_0xc7fc('0xa')](),controller[_0xc7fc('0x15')]);router['put'](_0xc7fc('0x16'),auth[_0xc7fc('0xa')](),controller['reject']);router[_0xc7fc('0x17')](_0xc7fc('0xd'),auth[_0xc7fc('0xa')](),controller[_0xc7fc('0x18')]);module[_0xc7fc('0x19')]=router; \ No newline at end of file +var _0x064f=['/:id','isAuthenticated','tracked','whatsapp','whatsappmessage:create','create','post','/:id/status','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','get','index','/describe','describe'];(function(_0x5bd953,_0x307788){var _0x4ac021=function(_0x31a3ba){while(--_0x31a3ba){_0x5bd953['push'](_0x5bd953['shift']());}};_0x4ac021(++_0x307788);}(_0x064f,0x10c));var _0xf064=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x064f[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0xf064('0x0'));var util=require(_0xf064('0x1'));var path=require('path');var timeout=require(_0xf064('0x2'));var express=require(_0xf064('0x3'));var router=express['Router']();var fs_extra=require(_0xf064('0x4'));var auth=require(_0xf064('0x5'));var interaction=require(_0xf064('0x6'));var config=require('../../config/environment');var controller=require(_0xf064('0x7'));router[_0xf064('0x8')]('/',auth['isAuthenticated'](),controller[_0xf064('0x9')]);router[_0xf064('0x8')](_0xf064('0xa'),auth['isAuthenticated'](),controller[_0xf064('0xb')]);router[_0xf064('0x8')](_0xf064('0xc'),auth[_0xf064('0xd')](),controller['show']);router['post']('/',auth[_0xf064('0xd')](),interaction[_0xf064('0xe')](_0xf064('0xf'),_0xf064('0x10')),controller[_0xf064('0x11')]);router[_0xf064('0x12')](_0xf064('0x13'),controller['status']);router[_0xf064('0x14')](_0xf064('0xc'),auth['isAuthenticated'](),controller[_0xf064('0x15')]);router['put'](_0xf064('0x16'),auth['isAuthenticated'](),controller[_0xf064('0x17')]);router['put'](_0xf064('0x18'),auth[_0xf064('0xd')](),controller[_0xf064('0x19')]);router['delete'](_0xf064('0xc'),auth[_0xf064('0xd')](),controller[_0xf064('0x1a')]);module[_0xf064('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 256abf6..ab920e7 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 _0xf685=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','sequelize'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xf685,0x117));var _0x5f68=function(_0xd47ae,_0x30eaea){_0xd47ae=_0xd47ae-0x0;var _0x469c34=_0xf685[_0xd47ae];return _0x469c34;};'use strict';var Sequelize=require(_0x5f68('0x0'));module[_0x5f68('0x1')]={'body':{'type':Sequelize[_0x5f68('0x2')](_0x5f68('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x5f68('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5f68('0x5')]('in',_0x5f68('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x5f68('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x5f68('0x7')]},'providerResponse':{'type':Sequelize[_0x5f68('0x2')]}}; \ No newline at end of file +var _0x53bb=['sequelize','exports','medium','BOOLEAN','ENUM','out','DATE','STRING','TEXT'];(function(_0x24002e,_0x399aec){var _0x6af43=function(_0x1d77a2){while(--_0x1d77a2){_0x24002e['push'](_0x24002e['shift']());}};_0x6af43(++_0x399aec);}(_0x53bb,0x168));var _0xb53b=function(_0x14d3dd,_0x4c3076){_0x14d3dd=_0x14d3dd-0x0;var _0x2314ed=_0x53bb[_0x14d3dd];return _0x2314ed;};'use strict';var Sequelize=require(_0xb53b('0x0'));module[_0xb53b('0x1')]={'body':{'type':Sequelize['TEXT'](_0xb53b('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xb53b('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb53b('0x4')]('in',_0xb53b('0x5')),'defaultValue':_0xb53b('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xb53b('0x6')]},'secret':{'type':Sequelize[_0xb53b('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xb53b('0x7')]},'providerResponse':{'type':Sequelize[_0xb53b('0x8')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 2b661f8..7f1105c 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 _0xfd28=['include','findAll','rows','show','params','intersection','create','body','find','describe','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','format','role','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','whatsapp-interactions','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','contact','interface','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','inspect','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','stack','name','send','map','WhatsappMessage','rawAttributes','type','query','keys','filters','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','options','includeAll'];(function(_0x186b00,_0x109f71){var _0x3bd728=function(_0x21924a){while(--_0x21924a){_0x186b00['push'](_0x186b00['shift']());}};_0x3bd728(++_0x109f71);}(_0xfd28,0x148));var _0x8fd2=function(_0x648163,_0x241576){_0x648163=_0x648163-0x0;var _0x199d4d=_0xfd28[_0x648163];return _0x199d4d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8fd2('0x0'));var zipdir=require(_0x8fd2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8fd2('0x2'));var moment=require('moment');var BPromise=require(_0x8fd2('0x3'));var Mustache=require(_0x8fd2('0x4'));var util=require(_0x8fd2('0x5'));var path=require('path');var sox=require(_0x8fd2('0x6'));var csv=require(_0x8fd2('0x7'));var ejs=require(_0x8fd2('0x8'));var fs=require('fs');var fs_extra=require(_0x8fd2('0x9'));var _=require(_0x8fd2('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8fd2('0xb'));var deskjs=require(_0x8fd2('0xc'));var toCsv=require(_0x8fd2('0x7'));var querystring=require('querystring');var Papa=require(_0x8fd2('0xd'));var Redis=require('ioredis');var authService=require(_0x8fd2('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x8fd2('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8fd2('0x10'))('api');var utils=require(_0x8fd2('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x8fd2('0x12'));var db=require(_0x8fd2('0x13'))['db'];config[_0x8fd2('0x14')]=_[_0x8fd2('0x15')](config[_0x8fd2('0x14')],{'host':_0x8fd2('0x16'),'port':0x18eb});var socket=require(_0x8fd2('0x17'))(new Redis(config[_0x8fd2('0x14')]));require(_0x8fd2('0x18'))[_0x8fd2('0x19')](socket);var jayson=require(_0x8fd2('0x1a'));var client=jayson[_0x8fd2('0x1b')][_0x8fd2('0x1c')]({'port':0x232c});var client9002=jayson[_0x8fd2('0x1b')][_0x8fd2('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x596639,_0x20daca,_0x5ef478,_0x4f0b17){return new BPromise(function(_0x56f75d,_0x3b79f3){var _0x530866=_0x4f0b17||client;return _0x530866[_0x8fd2('0x1d')](_0x596639,_0x5ef478)[_0x8fd2('0x1e')](function(_0x5c8b3c){logger[_0x8fd2('0x1f')](_0x8fd2('0x20'),_0x20daca,_0x8fd2('0x21'));logger[_0x8fd2('0x22')](_0x8fd2('0x23'),_0x20daca,'request\x20sent',JSON['stringify'](_0x5c8b3c));if(_0x5c8b3c[_0x8fd2('0x24')]){if(_0x5c8b3c['error'][_0x8fd2('0x25')]===0x1f4){logger['error'](_0x8fd2('0x20'),_0x20daca,_0x5c8b3c[_0x8fd2('0x24')]['message']);return _0x3b79f3(_0x5c8b3c[_0x8fd2('0x24')]['message']);}logger[_0x8fd2('0x24')](_0x8fd2('0x20'),_0x20daca,_0x5c8b3c['error'][_0x8fd2('0x26')]);return _0x56f75d(_0x5c8b3c[_0x8fd2('0x24')][_0x8fd2('0x26')]);}else{logger['info'](_0x8fd2('0x20'),_0x20daca,_0x8fd2('0x21'));_0x56f75d(_0x5c8b3c[_0x8fd2('0x27')][_0x8fd2('0x26')]);}})[_0x8fd2('0x28')](function(_0x25db4e){logger[_0x8fd2('0x24')](_0x8fd2('0x20'),_0x20daca,_0x25db4e);_0x3b79f3(_0x25db4e);});});}function respondWithStatusCode(_0x1456b4,_0xbc5945){_0xbc5945=_0xbc5945||0xcc;return function(_0x3392fb){if(_0x3392fb){return _0x1456b4[_0x8fd2('0x29')](_0xbc5945);}return _0x1456b4[_0x8fd2('0x2a')](_0xbc5945)['end']();};}function respondWithResult(_0x4c6af7,_0x345bc3){_0x345bc3=_0x345bc3||0xc8;return function(_0x1858a9){if(_0x1858a9){return _0x4c6af7[_0x8fd2('0x2a')](_0x345bc3)['json'](_0x1858a9);}};}function respondWithFilteredResult(_0x2f26ae,_0x7820e7){return function(_0x27b256){if(_0x27b256){var _0x960869=typeof _0x7820e7[_0x8fd2('0x2b')]===_0x8fd2('0x2c')&&typeof _0x7820e7[_0x8fd2('0x2d')]==='undefined';var _0xe76676=_0x27b256[_0x8fd2('0x2e')];var _0x818f61=_0x960869?0x0:_0x7820e7[_0x8fd2('0x2b')];var _0x313902=_0x960869?_0x27b256[_0x8fd2('0x2e')]:_0x7820e7[_0x8fd2('0x2b')]+_0x7820e7['limit'];var _0x5b992a;if(_0x313902>=_0xe76676){_0x313902=_0xe76676;_0x5b992a=0xc8;}else{_0x5b992a=0xce;}_0x2f26ae['status'](_0x5b992a);return _0x2f26ae[_0x8fd2('0x2f')](_0x8fd2('0x30'),_0x818f61+'-'+_0x313902+'/'+_0xe76676)[_0x8fd2('0x31')](_0x27b256);}return null;};}function patchUpdates(_0xe4987b){return function(_0x5a0b3b){try{jsonpatch['apply'](_0x5a0b3b,_0xe4987b,!![]);}catch(_0x3ebeab){return BPromise[_0x8fd2('0x32')](_0x3ebeab);}return _0x5a0b3b[_0x8fd2('0x33')]();};}function saveUpdates(_0x18fe4e,_0x121fd4){return function(_0x52c46b){if(_0x52c46b){return _0x52c46b[_0x8fd2('0x34')](_0x18fe4e)['then'](function(_0x20a9d0){return _0x20a9d0;});}return null;};}function removeEntity(_0x4ade8c,_0x445b67){return function(_0x4d9faa){if(_0x4d9faa){return _0x4d9faa[_0x8fd2('0x35')]()[_0x8fd2('0x1e')](function(){_0x4ade8c[_0x8fd2('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x339291,_0x4e7f72){return function(_0x11a71d){if(!_0x11a71d){_0x339291[_0x8fd2('0x29')](0x194);}return _0x11a71d;};}function handleError(_0x290c62,_0x5aaaed){_0x5aaaed=_0x5aaaed||0x1f4;return function(_0x14f382){logger[_0x8fd2('0x24')](_0x14f382[_0x8fd2('0x36')]);if(_0x14f382['name']){delete _0x14f382[_0x8fd2('0x37')];}_0x290c62[_0x8fd2('0x2a')](_0x5aaaed)[_0x8fd2('0x38')](_0x14f382);};}exports['index']=function(_0x37a24b,_0x3d3ec6){var _0x589d97={},_0x16b1f3={},_0x130072={'count':0x0,'rows':[]};var _0xac2ca3=_[_0x8fd2('0x39')](db[_0x8fd2('0x3a')][_0x8fd2('0x3b')],function(_0x221022){return{'name':_0x221022['fieldName'],'type':_0x221022[_0x8fd2('0x3c')]['key']};});_0x16b1f3['model']=_[_0x8fd2('0x39')](_0xac2ca3,_0x8fd2('0x37'));_0x16b1f3[_0x8fd2('0x3d')]=_[_0x8fd2('0x3e')](_0x37a24b[_0x8fd2('0x3d')]);_0x16b1f3[_0x8fd2('0x3f')]=_['intersection'](_0x16b1f3['model'],_0x16b1f3[_0x8fd2('0x3d')]);_0x589d97['attributes']=_['intersection'](_0x16b1f3[_0x8fd2('0x40')],qs[_0x8fd2('0x41')](_0x37a24b[_0x8fd2('0x3d')][_0x8fd2('0x41')]));_0x589d97['attributes']=_0x589d97[_0x8fd2('0x42')][_0x8fd2('0x43')]?_0x589d97[_0x8fd2('0x42')]:_0x16b1f3[_0x8fd2('0x40')];if(!_0x37a24b[_0x8fd2('0x3d')][_0x8fd2('0x44')](_0x8fd2('0x45'))){_0x589d97['limit']=qs[_0x8fd2('0x2d')](_0x37a24b[_0x8fd2('0x3d')][_0x8fd2('0x2d')]);_0x589d97[_0x8fd2('0x2b')]=qs[_0x8fd2('0x2b')](_0x37a24b[_0x8fd2('0x3d')][_0x8fd2('0x2b')]);}_0x589d97['order']=qs[_0x8fd2('0x46')](_0x37a24b[_0x8fd2('0x3d')][_0x8fd2('0x46')]);_0x589d97[_0x8fd2('0x47')]=qs[_0x8fd2('0x3f')](_[_0x8fd2('0x48')](_0x37a24b[_0x8fd2('0x3d')],_0x16b1f3['filters']),_0xac2ca3);if(_0x37a24b[_0x8fd2('0x3d')]['filter']){_0x589d97[_0x8fd2('0x47')]=_['merge'](_0x589d97[_0x8fd2('0x47')],{'$or':_[_0x8fd2('0x39')](_0xac2ca3,function(_0x2a39ac){if(_0x2a39ac['type']!==_0x8fd2('0x49')){var _0x2ccc94={};_0x2ccc94[_0x2a39ac[_0x8fd2('0x37')]]={'$like':'%'+_0x37a24b['query'][_0x8fd2('0x4a')]+'%'};return _0x2ccc94;}})});}_0x589d97=_['merge']({},_0x589d97,_0x37a24b[_0x8fd2('0x4b')]);var _0x21195f={'where':_0x589d97[_0x8fd2('0x47')]};return db[_0x8fd2('0x3a')][_0x8fd2('0x2e')](_0x21195f)[_0x8fd2('0x1e')](function(_0x154b61){_0x130072[_0x8fd2('0x2e')]=_0x154b61;if(_0x37a24b[_0x8fd2('0x3d')][_0x8fd2('0x4c')]){_0x589d97[_0x8fd2('0x4d')]=[{'all':!![]}];}return db[_0x8fd2('0x3a')][_0x8fd2('0x4e')](_0x589d97);})[_0x8fd2('0x1e')](function(_0x109d49){_0x130072[_0x8fd2('0x4f')]=_0x109d49;return _0x130072;})[_0x8fd2('0x1e')](respondWithFilteredResult(_0x3d3ec6,_0x589d97))[_0x8fd2('0x28')](handleError(_0x3d3ec6,null));};exports[_0x8fd2('0x50')]=function(_0x57084b,_0x50f894){var _0x43a9a8={'raw':!![],'where':{'id':_0x57084b[_0x8fd2('0x51')]['id']}},_0x40537e={};_0x40537e['model']=_['keys'](db[_0x8fd2('0x3a')]['rawAttributes']);_0x40537e[_0x8fd2('0x3d')]=_[_0x8fd2('0x3e')](_0x57084b[_0x8fd2('0x3d')]);_0x40537e['filters']=_[_0x8fd2('0x52')](_0x40537e[_0x8fd2('0x40')],_0x40537e['query']);_0x43a9a8[_0x8fd2('0x42')]=_[_0x8fd2('0x52')](_0x40537e[_0x8fd2('0x40')],qs['fields'](_0x57084b[_0x8fd2('0x3d')][_0x8fd2('0x41')]));_0x43a9a8[_0x8fd2('0x42')]=_0x43a9a8[_0x8fd2('0x42')][_0x8fd2('0x43')]?_0x43a9a8[_0x8fd2('0x42')]:_0x40537e['model'];if(_0x57084b['query'][_0x8fd2('0x4c')]){_0x43a9a8[_0x8fd2('0x4d')]=[{'all':!![]}];}_0x43a9a8=_['merge']({},_0x43a9a8,_0x57084b[_0x8fd2('0x4b')]);return db['WhatsappMessage']['find'](_0x43a9a8)[_0x8fd2('0x1e')](handleEntityNotFound(_0x50f894,null))[_0x8fd2('0x1e')](respondWithResult(_0x50f894,null))[_0x8fd2('0x28')](handleError(_0x50f894,null));};exports[_0x8fd2('0x53')]=function(_0x353450,_0x3de5b1){return db['WhatsappMessage'][_0x8fd2('0x53')](_0x353450[_0x8fd2('0x54')],{})[_0x8fd2('0x1e')](respondWithResult(_0x3de5b1,0xc9))[_0x8fd2('0x28')](handleError(_0x3de5b1,null));};exports[_0x8fd2('0x34')]=function(_0x51b586,_0x5cf641){if(_0x51b586['body']['id']){delete _0x51b586['body']['id'];}return db['WhatsappMessage'][_0x8fd2('0x55')]({'where':{'id':_0x51b586[_0x8fd2('0x51')]['id']}})[_0x8fd2('0x1e')](handleEntityNotFound(_0x5cf641,null))[_0x8fd2('0x1e')](saveUpdates(_0x51b586[_0x8fd2('0x54')],null))[_0x8fd2('0x1e')](respondWithResult(_0x5cf641,null))[_0x8fd2('0x28')](handleError(_0x5cf641,null));};exports['destroy']=function(_0x5e5f79,_0x5f0cfa){return db[_0x8fd2('0x3a')][_0x8fd2('0x55')]({'where':{'id':_0x5e5f79['params']['id']}})['then'](handleEntityNotFound(_0x5f0cfa,null))[_0x8fd2('0x1e')](removeEntity(_0x5f0cfa,null))[_0x8fd2('0x28')](handleError(_0x5f0cfa,null));};exports[_0x8fd2('0x56')]=function(_0x30a952,_0x37ddfa){return db['WhatsappMessage'][_0x8fd2('0x56')]()[_0x8fd2('0x1e')](respondWithResult(_0x37ddfa,null))[_0x8fd2('0x28')](handleError(_0x37ddfa,null));};var interaction_log=require(_0x8fd2('0x10'))('whatsapp-interactions');exports[_0x8fd2('0x57')]=function(_0x3bd8ce,_0x3ca4b1,_0x23c608){var _0x5df526={'agent':{},'channel':'whatsapp'};if(_0x3bd8ce['body']['id']){delete _0x3bd8ce[_0x8fd2('0x54')]['id'];}_0x3bd8ce[_0x8fd2('0x54')][_0x8fd2('0x58')]=!![];_0x3bd8ce[_0x8fd2('0x54')][_0x8fd2('0x59')]=moment()['format'](_0x8fd2('0x5a'));_0x3bd8ce[_0x8fd2('0x54')]['UserId']=_0x3bd8ce[_0x8fd2('0x54')][_0x8fd2('0x5b')]||_0x3bd8ce[_0x8fd2('0x5c')]['id'];_0x5df526[_0x8fd2('0x5d')]['id']=_0x3bd8ce[_0x8fd2('0x54')]['UserId'];return db[_0x8fd2('0x3a')][_0x8fd2('0x55')]({'where':{'id':_0x3bd8ce[_0x8fd2('0x51')]['id'],'UserId':null}})[_0x8fd2('0x1e')](handleEntityNotFound(_0x3ca4b1,null))[_0x8fd2('0x1e')](saveUpdates(_0x3bd8ce[_0x8fd2('0x54')],null))[_0x8fd2('0x1e')](function(_0x292672){if(_0x292672){_0x5df526[_0x8fd2('0x26')]=_0x292672[_0x8fd2('0x5e')]({'plain':!![]});return db[_0x8fd2('0x5f')][_0x8fd2('0x55')]({'where':{'id':_0x292672[_0x8fd2('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x3ca4b1,null))[_0x8fd2('0x1e')](function(_0x237756){if(_0x237756){return _0x237756['update']({'UserId':_0x3bd8ce['body']['UserId'],'read1stAt':_[_0x8fd2('0x61')](_0x237756[_0x8fd2('0x62')])?moment()[_0x8fd2('0x63')](_0x8fd2('0x5a')):undefined});}return null;})[_0x8fd2('0x1e')](function(_0x2eaa0c){if(_0x2eaa0c){_0x5df526['interaction']=_0x2eaa0c[_0x8fd2('0x5e')]({'plain':!![]});interaction_log[_0x8fd2('0x1f')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3bd8ce[_0x8fd2('0x5c')]['id'],_0x3bd8ce['user'][_0x8fd2('0x37')],_0x3bd8ce[_0x8fd2('0x5c')][_0x8fd2('0x64')],_0x5df526[_0x8fd2('0x65')]['id'],_0x3bd8ce[_0x8fd2('0x54')]?JSON['stringify'](_0x3bd8ce[_0x8fd2('0x54')]):_0x8fd2('0x66'));return respondWithRpcPromise('AcceptMessage',_0x8fd2('0x67'),_0x5df526);}return null;})['then'](function(_0x50c6a6){var _0x433912=_0x8fd2('0x68')+_0x50c6a6['message'][_0x8fd2('0x69')];return db[_0x8fd2('0x6a')][_0x8fd2('0x3d')](_0x433912,{'type':db['Sequelize'][_0x8fd2('0x6b')][_0x8fd2('0x6c')],'raw':!![]})[_0x8fd2('0x1e')](function(_0x59f39b){return _0x59f39b;});})[_0x8fd2('0x1e')](function(_0x31cb0e){if(_0x31cb0e){_0x5df526[_0x8fd2('0x26')]['contact']=_0x31cb0e[0x0];if(!_0x3bd8ce['body'][_0x8fd2('0x5b')])return;return db[_0x8fd2('0x6d')]['find']({'where':{'id':_0x3bd8ce['body']['UserId'],'role':'agent'},'attributes':['id','name',_0x8fd2('0x6e'),_0x8fd2('0x6f'),_0x8fd2('0x70')],'raw':!![]});}return null;})[_0x8fd2('0x1e')](function(_0x1fa13a){if(!_0x1fa13a)return null;_0x5df526['message'][_0x8fd2('0x5d')]=_0x1fa13a;return _0x5df526;})[_0x8fd2('0x1e')](function(_0x3b94f9){if(_0x3b94f9){if(_0x3bd8ce['body'][_0x8fd2('0x71')]){_0x5df526[_0x8fd2('0x26')]['interface']=util[_0x8fd2('0x63')](_0x8fd2('0x72'),_0x3bd8ce[_0x8fd2('0x5c')][_0x8fd2('0x37')]);_0x5df526[_0x8fd2('0x26')][_0x8fd2('0x73')]=_0x5df526[_0x8fd2('0x73')];_0x5df526['message'][_0x8fd2('0x74')]=_0x5df526[_0x8fd2('0x73')];_0x5df526[_0x8fd2('0x26')][_0x8fd2('0x75')]=_0x8fd2('0x57');return respondWithRpcPromise(_0x8fd2('0x76'),_0x8fd2('0x76'),{'event':'acceptmessage','message':_0x5df526[_0x8fd2('0x26')]},client9002)[_0x8fd2('0x1e')](function(){return _0x5df526;});}return _0x5df526;}return null;})['then'](respondWithResult(_0x3ca4b1,null))[_0x8fd2('0x28')](handleError(_0x3ca4b1,null));};var interaction_log=require(_0x8fd2('0x10'))(_0x8fd2('0x77'));exports[_0x8fd2('0x32')]=function(_0x570c23,_0x26e4b9,_0x2ab7cd){var _0x2a0c4={'agent':{},'channel':'whatsapp'};if(_0x570c23[_0x8fd2('0x54')]['id']){delete _0x570c23['body']['id'];}_0x570c23['body']['UserId']=_0x570c23[_0x8fd2('0x54')]['UserId']||_0x570c23[_0x8fd2('0x5c')]['id'];_0x2a0c4['agent']['id']=_0x570c23['body'][_0x8fd2('0x5b')];return db[_0x8fd2('0x3a')]['find']({'where':{'id':_0x570c23[_0x8fd2('0x51')]['id'],'UserId':null}})[_0x8fd2('0x1e')](handleEntityNotFound(_0x26e4b9,null))[_0x8fd2('0x1e')](function(_0x1b1255){if(_0x1b1255){_0x2a0c4['message']=_0x1b1255['get']({'plain':!![]});return db[_0x8fd2('0x5f')]['find']({'where':{'id':_0x1b1255[_0x8fd2('0x60')]}});}return null;})[_0x8fd2('0x1e')](handleEntityNotFound(_0x26e4b9,null))['then'](function(_0x1a96f7){if(_0x1a96f7){_0x2a0c4[_0x8fd2('0x65')]=_0x1a96f7[_0x8fd2('0x5e')]({'plain':!![]});interaction_log[_0x8fd2('0x1f')](_0x8fd2('0x78'),_0x570c23[_0x8fd2('0x5c')]['id'],_0x570c23[_0x8fd2('0x5c')]['name'],_0x570c23[_0x8fd2('0x5c')][_0x8fd2('0x64')],_0x2a0c4[_0x8fd2('0x65')]['id'],_0x570c23[_0x8fd2('0x54')]?JSON['stringify'](_0x570c23[_0x8fd2('0x54')]):_0x8fd2('0x66'));return respondWithRpcPromise(_0x8fd2('0x79'),_0x8fd2('0x7a'),_0x2a0c4);}return null;})['then'](function(_0x4d229a){var _0x1f01e6='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4d229a['message'][_0x8fd2('0x69')];return db['sequelize']['query'](_0x1f01e6,{'type':db[_0x8fd2('0x7b')][_0x8fd2('0x6b')][_0x8fd2('0x6c')],'raw':!![]})[_0x8fd2('0x1e')](function(_0x1a1daf){return _0x1a1daf;});})[_0x8fd2('0x1e')](function(_0x15df51){if(_0x15df51){_0x2a0c4['message'][_0x8fd2('0x7c')]=_0x15df51[0x0];if(!_0x570c23[_0x8fd2('0x54')][_0x8fd2('0x5b')])return;return db[_0x8fd2('0x6d')]['find']({'where':{'id':_0x570c23[_0x8fd2('0x54')]['UserId'],'role':'agent'},'attributes':['id',_0x8fd2('0x37'),_0x8fd2('0x6e'),_0x8fd2('0x6f'),_0x8fd2('0x70')],'raw':!![]});}return null;})[_0x8fd2('0x1e')](function(_0xe90905){if(!_0xe90905)return null;_0x2a0c4[_0x8fd2('0x26')][_0x8fd2('0x5d')]=_0xe90905;return _0x2a0c4;})['then'](function(_0x58fbd6){if(_0x58fbd6){_0x58fbd6[_0x8fd2('0x26')][_0x8fd2('0x7d')]=util[_0x8fd2('0x63')](_0x8fd2('0x72'),_0x570c23['user'][_0x8fd2('0x37')]);_0x58fbd6[_0x8fd2('0x26')]['channel']=_0x2a0c4[_0x8fd2('0x73')];_0x58fbd6[_0x8fd2('0x26')]['motionChannel']=_0x2a0c4[_0x8fd2('0x73')];_0x58fbd6[_0x8fd2('0x26')]['event']=_0x8fd2('0x32');respondWithRpcPromise(_0x8fd2('0x76'),_0x8fd2('0x76'),{'event':_0x8fd2('0x7e'),'message':_0x58fbd6[_0x8fd2('0x26')]},client9002);return _0x2a0c4;}return null;})[_0x8fd2('0x1e')](respondWithResult(_0x26e4b9,null))['catch'](handleError(_0x26e4b9,null));};exports[_0x8fd2('0x2a')]=function(_0xd79110,_0x451fe7,_0xdb481f){if(_0xd79110[_0x8fd2('0x54')]['id']){delete _0xd79110[_0x8fd2('0x54')]['id'];}var _0x411a45;return db[_0x8fd2('0x3a')][_0x8fd2('0x55')]({'where':{'id':_0xd79110[_0x8fd2('0x51')]['id']}})[_0x8fd2('0x1e')](handleEntityNotFound(_0x451fe7,null))['then'](function(_0x58408a){if(_0x58408a){_0x411a45=_0x58408a;return db[_0x8fd2('0x7f')]['find']({'where':{'id':_0x58408a[_0x8fd2('0x80')]}});}})['then'](handleEntityNotFound(_0x451fe7,null))[_0x8fd2('0x1e')](function(_0x5db816){if(_0x5db816){logger['debug'](_0x8fd2('0x81'),_0x8fd2('0x2a'),_0x8fd2('0x82'),_0x5db816[_0x8fd2('0x3c')],util['inspect'](_0xd79110['body'],{'showHidden':![],'depth':null}));switch(_0x5db816['type']){case _0x8fd2('0x83'):if(_0xd79110[_0x8fd2('0x54')][_0x8fd2('0x84')]&&_0xd79110['body'][_0x8fd2('0x84')]===_0x411a45[_0x8fd2('0x85')]&&_0xd79110['body']['MessageStatus']&&_0xd79110[_0x8fd2('0x54')]['MessageStatus']==='read'){return _0x411a45[_0x8fd2('0x34')]({'read':!![]});}else{logger[_0x8fd2('0x24')]('WhatsappAccount,\x20%s,\x20%s,\x20%s','status',_0x8fd2('0x83'),util[_0x8fd2('0x86')](_0xd79110['body'],{'showHidden':![],'depth':null}));}break;}return _0x411a45;}})[_0x8fd2('0x1e')](respondWithResult(_0x451fe7,null))[_0x8fd2('0x28')](handleError(_0x451fe7,null));}; \ No newline at end of file +var _0xa4e8=['RejectMessage','rejectMessage','QueryTypes','SELECT','SIP/%s','motionChannel','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','send','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','filter','where','merge','VIRTUAL','options','includeAll','WhatsappMessage','rows','include','find','create','body','params','describe','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','User','fullname','internal','manual','interface','channel','event','accept','EventManager','whatsapp-interactions','reject'];(function(_0x2430a4,_0x31219b){var _0x3b5e85=function(_0x3c00e2){while(--_0x3c00e2){_0x2430a4['push'](_0x2430a4['shift']());}};_0x3b5e85(++_0x31219b);}(_0xa4e8,0x1a1));var _0x8a4e=function(_0x42868a,_0x4f16af){_0x42868a=_0x42868a-0x0;var _0xec84c4=_0xa4e8[_0x42868a];return _0xec84c4;};'use strict';var emlformat=require(_0x8a4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8a4e('0x1'));var rp=require(_0x8a4e('0x2'));var moment=require('moment');var BPromise=require(_0x8a4e('0x3'));var Mustache=require(_0x8a4e('0x4'));var util=require(_0x8a4e('0x5'));var path=require(_0x8a4e('0x6'));var sox=require(_0x8a4e('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8a4e('0x8'));var _=require(_0x8a4e('0x9'));var squel=require(_0x8a4e('0xa'));var crypto=require('crypto');var jsforce=require(_0x8a4e('0xb'));var deskjs=require(_0x8a4e('0xc'));var toCsv=require(_0x8a4e('0xd'));var querystring=require(_0x8a4e('0xe'));var Papa=require(_0x8a4e('0xf'));var Redis=require(_0x8a4e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8a4e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8a4e('0x12'));var logger=require(_0x8a4e('0x13'))(_0x8a4e('0x14'));var utils=require(_0x8a4e('0x15'));var config=require(_0x8a4e('0x16'));var licenseUtil=require(_0x8a4e('0x17'));var db=require('../../mysqldb')['db'];config[_0x8a4e('0x18')]=_[_0x8a4e('0x19')](config[_0x8a4e('0x18')],{'host':_0x8a4e('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8a4e('0x18')]));require('./whatsappMessage.socket')[_0x8a4e('0x1b')](socket);var jayson=require(_0x8a4e('0x1c'));var client=jayson[_0x8a4e('0x1d')][_0x8a4e('0x1e')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4c99af,_0x37c217,_0x3bedaf,_0xc97eb9){return new BPromise(function(_0x9af22a,_0x3d6beb){var _0x55553d=_0xc97eb9||client;return _0x55553d[_0x8a4e('0x1f')](_0x4c99af,_0x3bedaf)[_0x8a4e('0x20')](function(_0x360474){logger[_0x8a4e('0x21')](_0x8a4e('0x22'),_0x37c217,_0x8a4e('0x23'));logger[_0x8a4e('0x24')](_0x8a4e('0x25'),_0x37c217,'request\x20sent',JSON[_0x8a4e('0x26')](_0x360474));if(_0x360474[_0x8a4e('0x27')]){if(_0x360474[_0x8a4e('0x27')][_0x8a4e('0x28')]===0x1f4){logger[_0x8a4e('0x27')](_0x8a4e('0x22'),_0x37c217,_0x360474[_0x8a4e('0x27')][_0x8a4e('0x29')]);return _0x3d6beb(_0x360474['error']['message']);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x37c217,_0x360474[_0x8a4e('0x27')][_0x8a4e('0x29')]);return _0x9af22a(_0x360474[_0x8a4e('0x27')][_0x8a4e('0x29')]);}else{logger[_0x8a4e('0x21')](_0x8a4e('0x22'),_0x37c217,_0x8a4e('0x23'));_0x9af22a(_0x360474['result'][_0x8a4e('0x29')]);}})[_0x8a4e('0x2a')](function(_0x3a0ebe){logger[_0x8a4e('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0x37c217,_0x3a0ebe);_0x3d6beb(_0x3a0ebe);});});}function respondWithStatusCode(_0x35667b,_0xcf9c56){_0xcf9c56=_0xcf9c56||0xcc;return function(_0x202617){if(_0x202617){return _0x35667b[_0x8a4e('0x2b')](_0xcf9c56);}return _0x35667b[_0x8a4e('0x2c')](_0xcf9c56)['end']();};}function respondWithResult(_0x2cd3f5,_0x8aa4d){_0x8aa4d=_0x8aa4d||0xc8;return function(_0x567c1f){if(_0x567c1f){return _0x2cd3f5[_0x8a4e('0x2c')](_0x8aa4d)[_0x8a4e('0x2d')](_0x567c1f);}};}function respondWithFilteredResult(_0x5e00a4,_0x2203d9){return function(_0x129d49){if(_0x129d49){var _0x474786=typeof _0x2203d9[_0x8a4e('0x2e')]===_0x8a4e('0x2f')&&typeof _0x2203d9[_0x8a4e('0x30')]==='undefined';var _0x2b288a=_0x129d49[_0x8a4e('0x31')];var _0x49d21c=_0x474786?0x0:_0x2203d9['offset'];var _0x431f99=_0x474786?_0x129d49[_0x8a4e('0x31')]:_0x2203d9[_0x8a4e('0x2e')]+_0x2203d9[_0x8a4e('0x30')];var _0x940932;if(_0x431f99>=_0x2b288a){_0x431f99=_0x2b288a;_0x940932=0xc8;}else{_0x940932=0xce;}_0x5e00a4[_0x8a4e('0x2c')](_0x940932);return _0x5e00a4[_0x8a4e('0x32')](_0x8a4e('0x33'),_0x49d21c+'-'+_0x431f99+'/'+_0x2b288a)['json'](_0x129d49);}return null;};}function patchUpdates(_0x3f0426){return function(_0x3a81ba){try{jsonpatch[_0x8a4e('0x34')](_0x3a81ba,_0x3f0426,!![]);}catch(_0x2367aa){return BPromise['reject'](_0x2367aa);}return _0x3a81ba['save']();};}function saveUpdates(_0x3ecf54,_0x577d7d){return function(_0x32f7ab){if(_0x32f7ab){return _0x32f7ab[_0x8a4e('0x35')](_0x3ecf54)[_0x8a4e('0x20')](function(_0x403c68){return _0x403c68;});}return null;};}function removeEntity(_0x2490e2,_0x566f4b){return function(_0x208c7d){if(_0x208c7d){return _0x208c7d[_0x8a4e('0x36')]()['then'](function(){_0x2490e2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xb9eab8,_0x1b9048){return function(_0x384e50){if(!_0x384e50){_0xb9eab8[_0x8a4e('0x2b')](0x194);}return _0x384e50;};}function handleError(_0xf377ab,_0x5da25e){_0x5da25e=_0x5da25e||0x1f4;return function(_0x37539a){logger[_0x8a4e('0x27')](_0x37539a['stack']);if(_0x37539a['name']){delete _0x37539a['name'];}_0xf377ab[_0x8a4e('0x2c')](_0x5da25e)[_0x8a4e('0x37')](_0x37539a);};}exports['index']=function(_0x56a429,_0x5da382){var _0x147e87={},_0x335fc9={},_0x1d0c70={'count':0x0,'rows':[]};var _0x39937e=_[_0x8a4e('0x38')](db['WhatsappMessage'][_0x8a4e('0x39')],function(_0x2f85a0){return{'name':_0x2f85a0[_0x8a4e('0x3a')],'type':_0x2f85a0[_0x8a4e('0x3b')][_0x8a4e('0x3c')]};});_0x335fc9[_0x8a4e('0x3d')]=_[_0x8a4e('0x38')](_0x39937e,_0x8a4e('0x3e'));_0x335fc9[_0x8a4e('0x3f')]=_[_0x8a4e('0x40')](_0x56a429['query']);_0x335fc9[_0x8a4e('0x41')]=_[_0x8a4e('0x42')](_0x335fc9[_0x8a4e('0x3d')],_0x335fc9[_0x8a4e('0x3f')]);_0x147e87[_0x8a4e('0x43')]=_[_0x8a4e('0x42')](_0x335fc9[_0x8a4e('0x3d')],qs[_0x8a4e('0x44')](_0x56a429['query'][_0x8a4e('0x44')]));_0x147e87[_0x8a4e('0x43')]=_0x147e87[_0x8a4e('0x43')][_0x8a4e('0x45')]?_0x147e87['attributes']:_0x335fc9[_0x8a4e('0x3d')];if(!_0x56a429[_0x8a4e('0x3f')][_0x8a4e('0x46')]('nolimit')){_0x147e87[_0x8a4e('0x30')]=qs[_0x8a4e('0x30')](_0x56a429['query']['limit']);_0x147e87[_0x8a4e('0x2e')]=qs[_0x8a4e('0x2e')](_0x56a429[_0x8a4e('0x3f')]['offset']);}_0x147e87['order']=qs[_0x8a4e('0x47')](_0x56a429[_0x8a4e('0x3f')][_0x8a4e('0x47')]);_0x147e87['where']=qs[_0x8a4e('0x41')](_['pick'](_0x56a429[_0x8a4e('0x3f')],_0x335fc9[_0x8a4e('0x41')]),_0x39937e);if(_0x56a429[_0x8a4e('0x3f')][_0x8a4e('0x48')]){_0x147e87[_0x8a4e('0x49')]=_[_0x8a4e('0x4a')](_0x147e87['where'],{'$or':_[_0x8a4e('0x38')](_0x39937e,function(_0x2f53ea){if(_0x2f53ea[_0x8a4e('0x3b')]!==_0x8a4e('0x4b')){var _0x211466={};_0x211466[_0x2f53ea[_0x8a4e('0x3e')]]={'$like':'%'+_0x56a429[_0x8a4e('0x3f')]['filter']+'%'};return _0x211466;}})});}_0x147e87=_[_0x8a4e('0x4a')]({},_0x147e87,_0x56a429[_0x8a4e('0x4c')]);var _0x271869={'where':_0x147e87[_0x8a4e('0x49')]};return db['WhatsappMessage'][_0x8a4e('0x31')](_0x271869)['then'](function(_0x3a3500){_0x1d0c70['count']=_0x3a3500;if(_0x56a429[_0x8a4e('0x3f')][_0x8a4e('0x4d')]){_0x147e87['include']=[{'all':!![]}];}return db[_0x8a4e('0x4e')]['findAll'](_0x147e87);})[_0x8a4e('0x20')](function(_0x30d0db){_0x1d0c70[_0x8a4e('0x4f')]=_0x30d0db;return _0x1d0c70;})[_0x8a4e('0x20')](respondWithFilteredResult(_0x5da382,_0x147e87))[_0x8a4e('0x2a')](handleError(_0x5da382,null));};exports['show']=function(_0x55769a,_0x2110a4){var _0x57685f={'raw':!![],'where':{'id':_0x55769a['params']['id']}},_0x13ef6e={};_0x13ef6e[_0x8a4e('0x3d')]=_[_0x8a4e('0x40')](db[_0x8a4e('0x4e')][_0x8a4e('0x39')]);_0x13ef6e['query']=_[_0x8a4e('0x40')](_0x55769a[_0x8a4e('0x3f')]);_0x13ef6e[_0x8a4e('0x41')]=_[_0x8a4e('0x42')](_0x13ef6e[_0x8a4e('0x3d')],_0x13ef6e[_0x8a4e('0x3f')]);_0x57685f[_0x8a4e('0x43')]=_[_0x8a4e('0x42')](_0x13ef6e['model'],qs[_0x8a4e('0x44')](_0x55769a[_0x8a4e('0x3f')]['fields']));_0x57685f[_0x8a4e('0x43')]=_0x57685f['attributes'][_0x8a4e('0x45')]?_0x57685f['attributes']:_0x13ef6e[_0x8a4e('0x3d')];if(_0x55769a[_0x8a4e('0x3f')][_0x8a4e('0x4d')]){_0x57685f[_0x8a4e('0x50')]=[{'all':!![]}];}_0x57685f=_[_0x8a4e('0x4a')]({},_0x57685f,_0x55769a[_0x8a4e('0x4c')]);return db['WhatsappMessage'][_0x8a4e('0x51')](_0x57685f)['then'](handleEntityNotFound(_0x2110a4,null))[_0x8a4e('0x20')](respondWithResult(_0x2110a4,null))[_0x8a4e('0x2a')](handleError(_0x2110a4,null));};exports['create']=function(_0x46c118,_0x3db419){return db['WhatsappMessage'][_0x8a4e('0x52')](_0x46c118['body'],{})['then'](respondWithResult(_0x3db419,0xc9))[_0x8a4e('0x2a')](handleError(_0x3db419,null));};exports[_0x8a4e('0x35')]=function(_0x501e4d,_0x3fd8ed){if(_0x501e4d['body']['id']){delete _0x501e4d[_0x8a4e('0x53')]['id'];}return db[_0x8a4e('0x4e')][_0x8a4e('0x51')]({'where':{'id':_0x501e4d[_0x8a4e('0x54')]['id']}})[_0x8a4e('0x20')](handleEntityNotFound(_0x3fd8ed,null))[_0x8a4e('0x20')](saveUpdates(_0x501e4d[_0x8a4e('0x53')],null))[_0x8a4e('0x20')](respondWithResult(_0x3fd8ed,null))['catch'](handleError(_0x3fd8ed,null));};exports[_0x8a4e('0x36')]=function(_0x378e93,_0x386fce){return db[_0x8a4e('0x4e')][_0x8a4e('0x51')]({'where':{'id':_0x378e93[_0x8a4e('0x54')]['id']}})[_0x8a4e('0x20')](handleEntityNotFound(_0x386fce,null))[_0x8a4e('0x20')](removeEntity(_0x386fce,null))[_0x8a4e('0x2a')](handleError(_0x386fce,null));};exports['describe']=function(_0x1b83f3,_0x5cb693){return db['WhatsappMessage'][_0x8a4e('0x55')]()[_0x8a4e('0x20')](respondWithResult(_0x5cb693,null))[_0x8a4e('0x2a')](handleError(_0x5cb693,null));};var interaction_log=require(_0x8a4e('0x13'))('whatsapp-interactions');exports['accept']=function(_0x383d5f,_0x35afe3,_0x320cca){var _0x297bc3={'agent':{},'channel':_0x8a4e('0x56')};if(_0x383d5f[_0x8a4e('0x53')]['id']){delete _0x383d5f[_0x8a4e('0x53')]['id'];}_0x383d5f[_0x8a4e('0x53')][_0x8a4e('0x57')]=!![];_0x383d5f['body'][_0x8a4e('0x58')]=moment()[_0x8a4e('0x59')](_0x8a4e('0x5a'));_0x383d5f[_0x8a4e('0x53')][_0x8a4e('0x5b')]=_0x383d5f[_0x8a4e('0x53')][_0x8a4e('0x5b')]||_0x383d5f['user']['id'];_0x297bc3[_0x8a4e('0x5c')]['id']=_0x383d5f[_0x8a4e('0x53')][_0x8a4e('0x5b')];return db['WhatsappMessage'][_0x8a4e('0x51')]({'where':{'id':_0x383d5f['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x35afe3,null))[_0x8a4e('0x20')](saveUpdates(_0x383d5f[_0x8a4e('0x53')],null))[_0x8a4e('0x20')](function(_0x5796c7){if(_0x5796c7){_0x297bc3[_0x8a4e('0x29')]=_0x5796c7[_0x8a4e('0x5d')]({'plain':!![]});return db[_0x8a4e('0x5e')][_0x8a4e('0x51')]({'where':{'id':_0x5796c7[_0x8a4e('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x35afe3,null))['then'](function(_0xe883a8){if(_0xe883a8){return _0xe883a8[_0x8a4e('0x35')]({'UserId':_0x383d5f[_0x8a4e('0x53')][_0x8a4e('0x5b')],'read1stAt':_[_0x8a4e('0x60')](_0xe883a8[_0x8a4e('0x61')])?moment()[_0x8a4e('0x59')](_0x8a4e('0x5a')):undefined});}return null;})[_0x8a4e('0x20')](function(_0x318f29){if(_0x318f29){_0x297bc3[_0x8a4e('0x62')]=_0x318f29[_0x8a4e('0x5d')]({'plain':!![]});interaction_log['info'](_0x8a4e('0x63'),_0x383d5f['user']['id'],_0x383d5f[_0x8a4e('0x64')][_0x8a4e('0x3e')],_0x383d5f['user'][_0x8a4e('0x65')],_0x297bc3[_0x8a4e('0x62')]['id'],_0x383d5f[_0x8a4e('0x53')]?JSON[_0x8a4e('0x26')](_0x383d5f[_0x8a4e('0x53')]):_0x8a4e('0x66'));return respondWithRpcPromise(_0x8a4e('0x67'),'acceptMessage',_0x297bc3);}return null;})[_0x8a4e('0x20')](function(_0x281bdc){var _0xb1f69e=_0x8a4e('0x68')+_0x281bdc[_0x8a4e('0x29')][_0x8a4e('0x69')];return db[_0x8a4e('0x6a')]['query'](_0xb1f69e,{'type':db[_0x8a4e('0x6b')]['QueryTypes']['SELECT'],'raw':!![]})[_0x8a4e('0x20')](function(_0x4bcd91){return _0x4bcd91;});})['then'](function(_0x4fa6c0){if(_0x4fa6c0){_0x297bc3[_0x8a4e('0x29')]['contact']=_0x4fa6c0[0x0];if(!_0x383d5f['body'][_0x8a4e('0x5b')])return;return db[_0x8a4e('0x6c')][_0x8a4e('0x51')]({'where':{'id':_0x383d5f['body'][_0x8a4e('0x5b')],'role':_0x8a4e('0x5c')},'attributes':['id',_0x8a4e('0x3e'),_0x8a4e('0x6d'),'email',_0x8a4e('0x6e')],'raw':!![]});}return null;})[_0x8a4e('0x20')](function(_0x1f1cb2){if(!_0x1f1cb2)return null;_0x297bc3[_0x8a4e('0x29')][_0x8a4e('0x5c')]=_0x1f1cb2;return _0x297bc3;})['then'](function(_0x11deaa){if(_0x11deaa){if(_0x383d5f[_0x8a4e('0x53')][_0x8a4e('0x6f')]){_0x297bc3['message'][_0x8a4e('0x70')]=util[_0x8a4e('0x59')]('SIP/%s',_0x383d5f[_0x8a4e('0x64')]['name']);_0x297bc3[_0x8a4e('0x29')][_0x8a4e('0x71')]=_0x297bc3['channel'];_0x297bc3[_0x8a4e('0x29')]['motionChannel']=_0x297bc3[_0x8a4e('0x71')];_0x297bc3[_0x8a4e('0x29')][_0x8a4e('0x72')]=_0x8a4e('0x73');return respondWithRpcPromise('EventManager',_0x8a4e('0x74'),{'event':'acceptmessage','message':_0x297bc3['message']},client9002)['then'](function(){return _0x297bc3;});}return _0x297bc3;}return null;})['then'](respondWithResult(_0x35afe3,null))[_0x8a4e('0x2a')](handleError(_0x35afe3,null));};var interaction_log=require('../../config/logger')(_0x8a4e('0x75'));exports[_0x8a4e('0x76')]=function(_0x5e5ee9,_0x17b9a6,_0x26d42f){var _0x31b587={'agent':{},'channel':_0x8a4e('0x56')};if(_0x5e5ee9[_0x8a4e('0x53')]['id']){delete _0x5e5ee9['body']['id'];}_0x5e5ee9[_0x8a4e('0x53')][_0x8a4e('0x5b')]=_0x5e5ee9[_0x8a4e('0x53')]['UserId']||_0x5e5ee9['user']['id'];_0x31b587[_0x8a4e('0x5c')]['id']=_0x5e5ee9[_0x8a4e('0x53')]['UserId'];return db[_0x8a4e('0x4e')]['find']({'where':{'id':_0x5e5ee9[_0x8a4e('0x54')]['id'],'UserId':null}})[_0x8a4e('0x20')](handleEntityNotFound(_0x17b9a6,null))[_0x8a4e('0x20')](function(_0x51a8e8){if(_0x51a8e8){_0x31b587[_0x8a4e('0x29')]=_0x51a8e8[_0x8a4e('0x5d')]({'plain':!![]});return db[_0x8a4e('0x5e')]['find']({'where':{'id':_0x51a8e8[_0x8a4e('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x17b9a6,null))['then'](function(_0x120546){if(_0x120546){_0x31b587['interaction']=_0x120546[_0x8a4e('0x5d')]({'plain':!![]});interaction_log[_0x8a4e('0x21')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5e5ee9[_0x8a4e('0x64')]['id'],_0x5e5ee9[_0x8a4e('0x64')][_0x8a4e('0x3e')],_0x5e5ee9['user']['role'],_0x31b587['interaction']['id'],_0x5e5ee9[_0x8a4e('0x53')]?JSON['stringify'](_0x5e5ee9[_0x8a4e('0x53')]):_0x8a4e('0x66'));return respondWithRpcPromise(_0x8a4e('0x77'),_0x8a4e('0x78'),_0x31b587);}return null;})[_0x8a4e('0x20')](function(_0x1b2e13){var _0x29a4cb=_0x8a4e('0x68')+_0x1b2e13[_0x8a4e('0x29')][_0x8a4e('0x69')];return db[_0x8a4e('0x6a')][_0x8a4e('0x3f')](_0x29a4cb,{'type':db[_0x8a4e('0x6b')][_0x8a4e('0x79')][_0x8a4e('0x7a')],'raw':!![]})[_0x8a4e('0x20')](function(_0x5c00ef){return _0x5c00ef;});})[_0x8a4e('0x20')](function(_0x39cbad){if(_0x39cbad){_0x31b587[_0x8a4e('0x29')]['contact']=_0x39cbad[0x0];if(!_0x5e5ee9['body']['UserId'])return;return db[_0x8a4e('0x6c')][_0x8a4e('0x51')]({'where':{'id':_0x5e5ee9[_0x8a4e('0x53')][_0x8a4e('0x5b')],'role':_0x8a4e('0x5c')},'attributes':['id',_0x8a4e('0x3e'),_0x8a4e('0x6d'),'email',_0x8a4e('0x6e')],'raw':!![]});}return null;})[_0x8a4e('0x20')](function(_0x1c1d49){if(!_0x1c1d49)return null;_0x31b587[_0x8a4e('0x29')][_0x8a4e('0x5c')]=_0x1c1d49;return _0x31b587;})[_0x8a4e('0x20')](function(_0x307c4f){if(_0x307c4f){_0x307c4f[_0x8a4e('0x29')]['interface']=util[_0x8a4e('0x59')](_0x8a4e('0x7b'),_0x5e5ee9[_0x8a4e('0x64')][_0x8a4e('0x3e')]);_0x307c4f[_0x8a4e('0x29')][_0x8a4e('0x71')]=_0x31b587[_0x8a4e('0x71')];_0x307c4f['message'][_0x8a4e('0x7c')]=_0x31b587[_0x8a4e('0x71')];_0x307c4f[_0x8a4e('0x29')][_0x8a4e('0x72')]=_0x8a4e('0x76');respondWithRpcPromise(_0x8a4e('0x74'),_0x8a4e('0x74'),{'event':_0x8a4e('0x7d'),'message':_0x307c4f[_0x8a4e('0x29')]},client9002);return _0x31b587;}return null;})[_0x8a4e('0x20')](respondWithResult(_0x17b9a6,null))[_0x8a4e('0x2a')](handleError(_0x17b9a6,null));};exports[_0x8a4e('0x2c')]=function(_0x50d2eb,_0x3f7c8a,_0x151410){if(_0x50d2eb[_0x8a4e('0x53')]['id']){delete _0x50d2eb[_0x8a4e('0x53')]['id'];}var _0x249a12;return db[_0x8a4e('0x4e')][_0x8a4e('0x51')]({'where':{'id':_0x50d2eb[_0x8a4e('0x54')]['id']}})[_0x8a4e('0x20')](handleEntityNotFound(_0x3f7c8a,null))[_0x8a4e('0x20')](function(_0x565e90){if(_0x565e90){_0x249a12=_0x565e90;return db[_0x8a4e('0x7e')][_0x8a4e('0x51')]({'where':{'id':_0x565e90[_0x8a4e('0x7f')]}});}})[_0x8a4e('0x20')](handleEntityNotFound(_0x3f7c8a,null))[_0x8a4e('0x20')](function(_0x5f14f5){if(_0x5f14f5){logger[_0x8a4e('0x24')](_0x8a4e('0x80'),_0x8a4e('0x2c'),_0x8a4e('0x81'),_0x5f14f5[_0x8a4e('0x3b')],util[_0x8a4e('0x82')](_0x50d2eb[_0x8a4e('0x53')],{'showHidden':![],'depth':null}));switch(_0x5f14f5[_0x8a4e('0x3b')]){case _0x8a4e('0x83'):if(_0x50d2eb[_0x8a4e('0x53')][_0x8a4e('0x84')]&&_0x50d2eb[_0x8a4e('0x53')][_0x8a4e('0x84')]===_0x249a12['messageId']&&_0x50d2eb[_0x8a4e('0x53')]['MessageStatus']&&_0x50d2eb[_0x8a4e('0x53')][_0x8a4e('0x85')]===_0x8a4e('0x57')){return _0x249a12[_0x8a4e('0x35')]({'read':!![]});}else{logger[_0x8a4e('0x27')]('WhatsappAccount,\x20%s,\x20%s,\x20%s','status',_0x8a4e('0x83'),util['inspect'](_0x50d2eb[_0x8a4e('0x53')],{'showHidden':![],'depth':null}));}break;}return _0x249a12;}})[_0x8a4e('0x20')](respondWithResult(_0x3f7c8a,null))['catch'](handleError(_0x3f7c8a,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 30d3852..9a39e25 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 _0x0427=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','WhatsappMessage'];(function(_0x225882,_0x56198c){var _0x25682c=function(_0x10fa44){while(--_0x10fa44){_0x225882['push'](_0x225882['shift']());}};_0x25682c(++_0x56198c);}(_0x0427,0x137));var _0x7042=function(_0x34319a,_0x1509eb){_0x34319a=_0x34319a-0x0;var _0x8ff628=_0x0427[_0x34319a];return _0x8ff628;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require('../../mysqldb')['db'][_0x7042('0x0')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x7042('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7042('0x2'),'afterDestroy':_0x7042('0x3')};function emitEvent(_0xae8bc2){return function(_0x1db1f3,_0xa72963,_0x343a69){WhatsappMessageEvents[_0x7042('0x4')](_0xae8bc2+':'+_0x1db1f3['id'],_0x1db1f3);WhatsappMessageEvents['emit'](_0xae8bc2,_0x1db1f3);_0x343a69(null);};}for(var e in events){if(events[_0x7042('0x5')](e)){var event=events[e];WhatsappMessage[_0x7042('0x6')](e,emitEvent(event));}}module[_0x7042('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0xdb94=['remove','hasOwnProperty','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xdb94,0xab));var _0x4db9=function(_0x1e6591,_0xb375af){_0x1e6591=_0x1e6591-0x0;var _0x4809b1=_0xdb94[_0x1e6591];return _0x4809b1;};'use strict';var EventEmitter=require(_0x4db9('0x0'));var WhatsappMessage=require(_0x4db9('0x1'))['db'][_0x4db9('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x4db9('0x3')](0x0);var events={'afterCreate':_0x4db9('0x4'),'afterUpdate':'update','afterDestroy':_0x4db9('0x5')};function emitEvent(_0x16c55a){return function(_0x554bd5,_0x4ed80a,_0x209f80){WhatsappMessageEvents['emit'](_0x16c55a+':'+_0x554bd5['id'],_0x554bd5);WhatsappMessageEvents['emit'](_0x16c55a,_0x554bd5);_0x209f80(null);};}for(var e in events){if(events[_0x4db9('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x4db9('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index abde7da..4dc7f10 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 _0x0442=['create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteractionId','update','createdAt','catch','error','WhatsappAccount','find','then','type','twilio','accountSid','authToken','phone','messages'];(function(_0x2dc949,_0x380aec){var _0x53c9f5=function(_0x474f17){while(--_0x474f17){_0x2dc949['push'](_0x2dc949['shift']());}};_0x53c9f5(++_0x380aec);}(_0x0442,0x1e2));var _0x2044=function(_0x51b661,_0x566ef8){_0x51b661=_0x51b661-0x0;var _0x5d1971=_0x0442[_0x51b661];return _0x5d1971;};'use strict';var _=require(_0x2044('0x0'));var util=require(_0x2044('0x1'));var logger=require(_0x2044('0x2'))('api');var moment=require(_0x2044('0x3'));var BPromise=require(_0x2044('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2044('0x5'));var rimraf=require(_0x2044('0x6'));var config=require(_0x2044('0x7'));var attributes=require('./whatsappMessage.attributes');module[_0x2044('0x8')]=function(_0x4a18a7,_0x434b8b){return _0x4a18a7[_0x2044('0x9')](_0x2044('0xa'),attributes,{'tableName':_0x2044('0xb'),'paranoid':![],'indexes':[{'name':_0x2044('0xc'),'fields':[_0x2044('0xc')]},{'name':_0x2044('0xd'),'fields':[_0x2044('0xe')],'type':_0x2044('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x39c32b,_0x42da30,_0x4c23a0){var _0x2e996f=_0x4a18a7[_0x2044('0x10')];var _0x507a2e=_0x39c32b[_0x2044('0x11')]({'plain':!![]});if(_0x507a2e[_0x2044('0x12')][_0x2044('0x13')]()==='in'||_0x507a2e[_0x2044('0x12')][_0x2044('0x13')]()===_0x2044('0x14')&&!_0x507a2e[_0x2044('0x15')]&&!_[_0x2044('0x16')](_0x507a2e[_0x2044('0x17')])){_0x2e996f['WhatsappInteraction']['findOne']({'where':{'id':_0x507a2e[_0x2044('0x18')]}})['then'](function(_0x5dd50c){if(_0x5dd50c){_0x5dd50c[_0x2044('0x19')]({'lastMsgAt':_0x507a2e[_0x2044('0x1a')],'lastMsgDirection':_0x507a2e[_0x2044('0x12')]['toLowerCase']()});}})[_0x2044('0x1b')](function(_0x19e2ad){console[_0x2044('0x1c')](_0x19e2ad);});}if(_0x507a2e[_0x2044('0x12')]===_0x2044('0x14')&&!_0x507a2e[_0x2044('0x15')]){var _0x1dc64f;_0x2e996f[_0x2044('0x1d')][_0x2044('0x1e')]({'where':{'id':_0x507a2e['WhatsappAccountId']},'raw':!![]})[_0x2044('0x1f')](function(_0x3be812){_0x1dc64f=_0x3be812;if(_0x1dc64f&&_0x1dc64f[_0x2044('0x20')]){switch(_0x1dc64f['type']){case _0x2044('0x21'):var _0x5083d6=require(_0x2044('0x21'));if(_0x1dc64f[_0x2044('0x22')]&&_0x1dc64f[_0x2044('0x23')]&&_0x1dc64f[_0x2044('0x24')]){var _0x51a970=new _0x5083d6(_0x1dc64f[_0x2044('0x22')],_0x1dc64f[_0x2044('0x23')]);_0x51a970[_0x2044('0x25')][_0x2044('0x26')]({'body':_0x507a2e[_0x2044('0xe')],'to':_0x2044('0x27')+_0x507a2e[_0x2044('0x24')],'from':_0x2044('0x27')+_0x1dc64f[_0x2044('0x24')],'statusCallback':_0x1dc64f[_0x2044('0x28')]+_0x2044('0x29')+_0x507a2e['id']+_0x2044('0x2a')+_0x1dc64f[_0x2044('0x2b')]})['then'](function(_0x3e8895){if(_0x3e8895[_0x2044('0x2c')]){return _0x39c32b['update']({'messageId':_0x3e8895['sid']});}})[_0x2044('0x1b')](function(_0x5a4bba){logger[_0x2044('0x1c')](_0x2044('0x2d'),'afterCreate',_0x2044('0x21'),util[_0x2044('0x2e')](_0x5a4bba,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x2044('0x2d'),_0x2044('0x2f'),_0x2044('0x21'),_0x2044('0x30'));}break;}}})[_0x2044('0x31')](function(){_0x4c23a0();});}else{_0x4c23a0();}}},'charset':_0x2044('0x32'),'collate':_0x2044('0x33')});}; \ No newline at end of file +var _0x6ea1=['token','sid','update','catch','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','request-promise','path','rimraf','../../config/environment','WhatsappMessage','whatsapp_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','WhatsappInteraction','findOne','WhatsappInteractionId','then','createdAt','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token='];(function(_0x26cdd8,_0x3c3136){var _0x4687aa=function(_0x58aa46){while(--_0x58aa46){_0x26cdd8['push'](_0x26cdd8['shift']());}};_0x4687aa(++_0x3c3136);}(_0x6ea1,0x68));var _0x16ea=function(_0x2f02fe,_0x22264e){_0x2f02fe=_0x2f02fe-0x0;var _0x2b112e=_0x6ea1[_0x2f02fe];return _0x2b112e;};'use strict';var _=require(_0x16ea('0x0'));var util=require('util');var logger=require(_0x16ea('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x16ea('0x2'));var fs=require('fs');var path=require(_0x16ea('0x3'));var rimraf=require(_0x16ea('0x4'));var config=require(_0x16ea('0x5'));var attributes=require('./whatsappMessage.attributes');module['exports']=function(_0x37a9b2,_0x1a4c97){return _0x37a9b2['define'](_0x16ea('0x6'),attributes,{'tableName':_0x16ea('0x7'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x16ea('0x8')]},{'name':'fti_whatsapp_messages','fields':[_0x16ea('0x9')],'type':_0x16ea('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2319fb,_0x12e438,_0x19e659){var _0x5f0769=_0x37a9b2[_0x16ea('0xb')];var _0x1c30e7=_0x2319fb[_0x16ea('0xc')]({'plain':!![]});if(_0x1c30e7[_0x16ea('0xd')][_0x16ea('0xe')]()==='in'||_0x1c30e7[_0x16ea('0xd')][_0x16ea('0xe')]()===_0x16ea('0xf')&&!_0x1c30e7[_0x16ea('0x10')]&&!_[_0x16ea('0x11')](_0x1c30e7['UserId'])){_0x5f0769[_0x16ea('0x12')][_0x16ea('0x13')]({'where':{'id':_0x1c30e7[_0x16ea('0x14')]}})[_0x16ea('0x15')](function(_0x3cc3f1){if(_0x3cc3f1){_0x3cc3f1['update']({'lastMsgAt':_0x1c30e7[_0x16ea('0x16')],'lastMsgDirection':_0x1c30e7['direction']['toLowerCase']()});}})['catch'](function(_0x5648c5){console[_0x16ea('0x17')](_0x5648c5);});}if(_0x1c30e7[_0x16ea('0xd')]==='out'&&!_0x1c30e7[_0x16ea('0x10')]){var _0x179028;_0x5f0769[_0x16ea('0x18')][_0x16ea('0x19')]({'where':{'id':_0x1c30e7[_0x16ea('0x1a')]},'raw':!![]})[_0x16ea('0x15')](function(_0x3dcf06){_0x179028=_0x3dcf06;if(_0x179028&&_0x179028['type']){switch(_0x179028[_0x16ea('0x1b')]){case'twilio':var _0x51f1d7=require(_0x16ea('0x1c'));if(_0x179028[_0x16ea('0x1d')]&&_0x179028[_0x16ea('0x1e')]&&_0x179028[_0x16ea('0x1f')]){var _0x25c7dd=new _0x51f1d7(_0x179028[_0x16ea('0x1d')],_0x179028[_0x16ea('0x1e')]);_0x25c7dd['messages'][_0x16ea('0x20')]({'body':_0x1c30e7[_0x16ea('0x9')],'to':_0x16ea('0x21')+_0x1c30e7['phone'],'from':_0x16ea('0x21')+_0x179028['phone'],'statusCallback':_0x179028[_0x16ea('0x22')]+_0x16ea('0x23')+_0x1c30e7['id']+_0x16ea('0x24')+_0x179028[_0x16ea('0x25')]})[_0x16ea('0x15')](function(_0x2bab4f){if(_0x2bab4f[_0x16ea('0x26')]){return _0x2319fb[_0x16ea('0x27')]({'messageId':_0x2bab4f[_0x16ea('0x26')]});}})[_0x16ea('0x28')](function(_0x489a9f){logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x16ea('0x29'),_0x16ea('0x1c'),util[_0x16ea('0x2a')](_0x489a9f,{'showHidden':![],'depth':null}));});}else{logger[_0x16ea('0x17')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x16ea('0x29'),_0x16ea('0x1c'),_0x16ea('0x2b'));}break;}}})[_0x16ea('0x2c')](function(){_0x19e659();});}else{_0x19e659();}}},'charset':_0x16ea('0x2d'),'collate':_0x16ea('0x2e')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 35eefe8..19aaf4c 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 _0x5f7a=['debug','stringify','error','code','message','request\x20sent','catch','CreateWhatsappMessage','create','body','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','WhatsappMessage,\x20%s,\x20%s'];(function(_0x5f43b3,_0x3e64d7){var _0xbc3960=function(_0x4efdf8){while(--_0x4efdf8){_0x5f43b3['push'](_0x5f43b3['shift']());}};_0xbc3960(++_0x3e64d7);}(_0x5f7a,0xec));var _0xa5f7=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x5f7a[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0xa5f7('0x0'));var util=require(_0xa5f7('0x1'));var moment=require(_0xa5f7('0x2'));var BPromise=require(_0xa5f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa5f7('0x4'));var db=require(_0xa5f7('0x5'))['db'];var utils=require(_0xa5f7('0x6'));var logger=require(_0xa5f7('0x7'))(_0xa5f7('0x8'));var config=require(_0xa5f7('0x9'));var jayson=require(_0xa5f7('0xa'));var client=jayson['client'][_0xa5f7('0xb')]({'port':0x232a});config[_0xa5f7('0xc')]=_[_0xa5f7('0xd')](config[_0xa5f7('0xc')],{'host':_0xa5f7('0xe'),'port':0x18eb});var socket=require(_0xa5f7('0xf'))(new Redis(config[_0xa5f7('0xc')]));require('./whatsappMessage.socket')[_0xa5f7('0x10')](socket);function respondWithRpcPromise(_0xd76e9,_0x152d45,_0x12fa5f){return new BPromise(function(_0x2ba1cc,_0x1c240e){return client[_0xa5f7('0x11')](_0xd76e9,_0x12fa5f)[_0xa5f7('0x12')](function(_0x555a2b){logger['info'](_0xa5f7('0x13'),_0x152d45,'request\x20sent');logger[_0xa5f7('0x14')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x152d45,'request\x20sent',JSON[_0xa5f7('0x15')](_0x555a2b));if(_0x555a2b[_0xa5f7('0x16')]){if(_0x555a2b['error'][_0xa5f7('0x17')]===0x1f4){logger['error'](_0xa5f7('0x13'),_0x152d45,_0x555a2b[_0xa5f7('0x16')]['message']);return _0x1c240e(_0x555a2b[_0xa5f7('0x16')][_0xa5f7('0x18')]);}logger[_0xa5f7('0x16')](_0xa5f7('0x13'),_0x152d45,_0x555a2b[_0xa5f7('0x16')][_0xa5f7('0x18')]);return _0x2ba1cc(_0x555a2b['error'][_0xa5f7('0x18')]);}else{logger['info'](_0xa5f7('0x13'),_0x152d45,_0xa5f7('0x19'));_0x2ba1cc(_0x555a2b['result'][_0xa5f7('0x18')]);}})[_0xa5f7('0x1a')](function(_0x4443d1){logger[_0xa5f7('0x16')](_0xa5f7('0x13'),_0x152d45,_0x4443d1);_0x1c240e(_0x4443d1);});});}exports[_0xa5f7('0x1b')]=function(_0x23c560){var _0x1e4efc=this;return new Promise(function(_0x190269,_0x220cf9){return db['WhatsappMessage'][_0xa5f7('0x1c')](_0x23c560[_0xa5f7('0x1d')],{'raw':_0x23c560[_0xa5f7('0x1e')]?_0x23c560[_0xa5f7('0x1e')][_0xa5f7('0x1f')]===undefined?!![]:![]:!![]})[_0xa5f7('0x12')](function(_0xddcb54){logger['info']('CreateWhatsappMessage',_0x23c560);logger[_0xa5f7('0x14')](_0xa5f7('0x1b'),_0x23c560,JSON[_0xa5f7('0x15')](_0xddcb54));_0x190269(_0xddcb54);})[_0xa5f7('0x1a')](function(_0x40f814){logger[_0xa5f7('0x16')]('CreateWhatsappMessage',_0x40f814[_0xa5f7('0x18')],_0x23c560);_0x220cf9(_0x1e4efc[_0xa5f7('0x16')](0x1f4,_0x40f814[_0xa5f7('0x18')]));});});}; \ No newline at end of file +var _0xf475=['../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','body','options','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xf475,0x178));var _0x5f47=function(_0x22bad8,_0x5b5324){_0x22bad8=_0x22bad8-0x0;var _0x3795ea=_0xf475[_0x22bad8];return _0x3795ea;};'use strict';var _=require(_0x5f47('0x0'));var util=require(_0x5f47('0x1'));var moment=require(_0x5f47('0x2'));var BPromise=require(_0x5f47('0x3'));var rs=require(_0x5f47('0x4'));var fs=require('fs');var Redis=require(_0x5f47('0x5'));var db=require(_0x5f47('0x6'))['db'];var utils=require(_0x5f47('0x7'));var logger=require(_0x5f47('0x8'))('rpc');var config=require(_0x5f47('0x9'));var jayson=require(_0x5f47('0xa'));var client=jayson[_0x5f47('0xb')][_0x5f47('0xc')]({'port':0x232a});config[_0x5f47('0xd')]=_['defaults'](config['redis'],{'host':_0x5f47('0xe'),'port':0x18eb});var socket=require(_0x5f47('0xf'))(new Redis(config[_0x5f47('0xd')]));require('./whatsappMessage.socket')[_0x5f47('0x10')](socket);function respondWithRpcPromise(_0x29f638,_0x848518,_0x2b8fa4){return new BPromise(function(_0x160c56,_0x28eb27){return client['request'](_0x29f638,_0x2b8fa4)[_0x5f47('0x11')](function(_0x47657a){logger['info'](_0x5f47('0x12'),_0x848518,_0x5f47('0x13'));logger[_0x5f47('0x14')](_0x5f47('0x15'),_0x848518,_0x5f47('0x13'),JSON['stringify'](_0x47657a));if(_0x47657a[_0x5f47('0x16')]){if(_0x47657a[_0x5f47('0x16')][_0x5f47('0x17')]===0x1f4){logger[_0x5f47('0x16')](_0x5f47('0x12'),_0x848518,_0x47657a['error']['message']);return _0x28eb27(_0x47657a[_0x5f47('0x16')]['message']);}logger['error'](_0x5f47('0x12'),_0x848518,_0x47657a['error'][_0x5f47('0x18')]);return _0x160c56(_0x47657a['error'][_0x5f47('0x18')]);}else{logger['info'](_0x5f47('0x12'),_0x848518,_0x5f47('0x13'));_0x160c56(_0x47657a[_0x5f47('0x19')][_0x5f47('0x18')]);}})[_0x5f47('0x1a')](function(_0x2fa11f){logger[_0x5f47('0x16')](_0x5f47('0x12'),_0x848518,_0x2fa11f);_0x28eb27(_0x2fa11f);});});}exports[_0x5f47('0x1b')]=function(_0x127ed1){var _0xb4155b=this;return new Promise(function(_0x3f8482,_0x4adbc3){return db[_0x5f47('0x1c')]['create'](_0x127ed1[_0x5f47('0x1d')],{'raw':_0x127ed1[_0x5f47('0x1e')]?_0x127ed1['options']['raw']===undefined?!![]:![]:!![]})[_0x5f47('0x11')](function(_0x5af3f5){logger[_0x5f47('0x1f')](_0x5f47('0x1b'),_0x127ed1);logger[_0x5f47('0x14')](_0x5f47('0x1b'),_0x127ed1,JSON['stringify'](_0x5af3f5));_0x3f8482(_0x5af3f5);})['catch'](function(_0x56c8ac){logger[_0x5f47('0x16')](_0x5f47('0x1b'),_0x56c8ac[_0x5f47('0x18')],_0x127ed1);_0x4adbc3(_0xb4155b[_0x5f47('0x16')](0x1f4,_0x56c8ac[_0x5f47('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 3990ab4..88240c4 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 _0x04bc=['removeListener','whatsappMessage:','./whatsappMessage.events','save','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x04bc,0x92));var _0xc04b=function(_0x218db7,_0x196f29){_0x218db7=_0x218db7-0x0;var _0x4c8f5f=_0x04bc[_0x218db7];return _0x4c8f5f;};'use strict';var WhatsappMessageEvents=require(_0xc04b('0x0'));var events=[_0xc04b('0x1'),'remove',_0xc04b('0x2')];function createListener(_0x21c92d,_0xc621c8){return function(_0x3330b1){_0xc621c8[_0xc04b('0x3')](_0x21c92d,_0x3330b1);};}function removeListener(_0x1ea8ac,_0x469061){return function(){WhatsappMessageEvents[_0xc04b('0x4')](_0x1ea8ac,_0x469061);};}exports['register']=function(_0x1c8ee0){for(var _0x191949=0x0,_0x460285=events['length'];_0x191949<_0x460285;_0x191949++){var _0xee5f17=events[_0x191949];var _0x32312b=createListener(_0xc04b('0x5')+_0xee5f17,_0x1c8ee0);WhatsappMessageEvents['on'](_0xee5f17,_0x32312b);}}; \ No newline at end of file +var _0xd92f=['save','update','removeListener','length','whatsappMessage:','./whatsappMessage.events'];(function(_0x2b74a3,_0x105e7a){var _0x1b7b5d=function(_0x83557a){while(--_0x83557a){_0x2b74a3['push'](_0x2b74a3['shift']());}};_0x1b7b5d(++_0x105e7a);}(_0xd92f,0x1cd));var _0xfd92=function(_0x370a30,_0x287c01){_0x370a30=_0x370a30-0x0;var _0x111301=_0xd92f[_0x370a30];return _0x111301;};'use strict';var WhatsappMessageEvents=require(_0xfd92('0x0'));var events=[_0xfd92('0x1'),'remove',_0xfd92('0x2')];function createListener(_0x33910b,_0x264409){return function(_0x143e5e){_0x264409['emit'](_0x33910b,_0x143e5e);};}function removeListener(_0x1fa465,_0x1c503a){return function(){WhatsappMessageEvents[_0xfd92('0x3')](_0x1fa465,_0x1c503a);};}exports['register']=function(_0x34fd8a){for(var _0x569feb=0x0,_0x43e96f=events[_0xfd92('0x4')];_0x569feb<_0x43e96f;_0x569feb++){var _0x5a27a5=events[_0x569feb];var _0x1aa748=createListener(_0xfd92('0x5')+_0x5a27a5,_0x34fd8a);WhatsappMessageEvents['on'](_0x5a27a5,_0x1aa748);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 6d6d02f..a2b9bf1 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 _0x416e=['index','/describe','/:id/members','getMembers','/:id/teams','getTeams','post','create','addTeams','/:id/users','addAgents','put','update','delete','/:id','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated'];(function(_0x4edafe,_0x1b3031){var _0x100a2d=function(_0x3c7c6c){while(--_0x3c7c6c){_0x4edafe['push'](_0x4edafe['shift']());}};_0x100a2d(++_0x1b3031);}(_0x416e,0xb3));var _0xe416=function(_0x798ad0,_0xefa3c1){_0x798ad0=_0x798ad0-0x0;var _0x66039e=_0x416e[_0x798ad0];return _0x66039e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe416('0x0'));var timeout=require('connect-timeout');var express=require(_0xe416('0x1'));var router=express[_0xe416('0x2')]();var fs_extra=require(_0xe416('0x3'));var auth=require(_0xe416('0x4'));var interaction=require(_0xe416('0x5'));var config=require(_0xe416('0x6'));var controller=require(_0xe416('0x7'));router[_0xe416('0x8')]('/',auth[_0xe416('0x9')](),controller[_0xe416('0xa')]);router[_0xe416('0x8')](_0xe416('0xb'),auth[_0xe416('0x9')](),controller['describe']);router[_0xe416('0x8')]('/:id',auth[_0xe416('0x9')](),controller['show']);router[_0xe416('0x8')](_0xe416('0xc'),auth[_0xe416('0x9')](),controller[_0xe416('0xd')]);router['get'](_0xe416('0xe'),auth[_0xe416('0x9')](),controller[_0xe416('0xf')]);router['get']('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xe416('0x10')]('/',auth[_0xe416('0x9')](),controller[_0xe416('0x11')]);router['post'](_0xe416('0xe'),auth[_0xe416('0x9')](),controller[_0xe416('0x12')]);router[_0xe416('0x10')](_0xe416('0x13'),auth[_0xe416('0x9')](),controller[_0xe416('0x14')]);router[_0xe416('0x15')]('/:id',auth[_0xe416('0x9')](),controller[_0xe416('0x16')]);router[_0xe416('0x17')](_0xe416('0x18'),auth[_0xe416('0x9')](),controller[_0xe416('0x19')]);router['delete']('/:id/teams',auth[_0xe416('0x9')](),controller['removeTeams']);router[_0xe416('0x17')]('/:id/users',auth[_0xe416('0x9')](),controller['removeAgents']);module[_0xe416('0x1a')]=router; \ No newline at end of file +var _0x095d=['isAuthenticated','/:id','show','/:id/teams','post','create','addTeams','/:id/users','addAgents','update','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','/describe'];(function(_0xa857b1,_0x9588f9){var _0x547d37=function(_0x5d5739){while(--_0x5d5739){_0xa857b1['push'](_0xa857b1['shift']());}};_0x547d37(++_0x9588f9);}(_0x095d,0x16c));var _0xd095=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x095d[_0x2ec461];return _0x28603d;};'use strict';var multer=require(_0xd095('0x0'));var util=require(_0xd095('0x1'));var path=require(_0xd095('0x2'));var timeout=require(_0xd095('0x3'));var express=require(_0xd095('0x4'));var router=express[_0xd095('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd095('0x6'));var config=require(_0xd095('0x7'));var controller=require(_0xd095('0x8'));router[_0xd095('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd095('0x9')](_0xd095('0xa'),auth[_0xd095('0xb')](),controller['describe']);router[_0xd095('0x9')](_0xd095('0xc'),auth[_0xd095('0xb')](),controller[_0xd095('0xd')]);router[_0xd095('0x9')]('/:id/members',auth[_0xd095('0xb')](),controller['getMembers']);router[_0xd095('0x9')](_0xd095('0xe'),auth[_0xd095('0xb')](),controller['getTeams']);router[_0xd095('0x9')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xd095('0xf')]('/',auth[_0xd095('0xb')](),controller[_0xd095('0x10')]);router['post'](_0xd095('0xe'),auth[_0xd095('0xb')](),controller[_0xd095('0x11')]);router[_0xd095('0xf')](_0xd095('0x12'),auth[_0xd095('0xb')](),controller[_0xd095('0x13')]);router['put'](_0xd095('0xc'),auth[_0xd095('0xb')](),controller[_0xd095('0x14')]);router[_0xd095('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xd095('0x15')](_0xd095('0xe'),auth[_0xd095('0xb')](),controller[_0xd095('0x16')]);router[_0xd095('0x15')](_0xd095('0x12'),auth[_0xd095('0xb')](),controller[_0xd095('0x17')]);module[_0xd095('0x18')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 3d33090..9f5fe8d 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 _0x9780=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9780,0x1d4));var _0x0978=function(_0x3b8ed6,_0x3b5bb6){_0x3b8ed6=_0x3b8ed6-0x0;var _0x2e6223=_0x9780[_0x3b8ed6];return _0x2e6223;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0978('0x0')],'unique':_0x0978('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x0978('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0978('0x3')](_0x0978('0x4'),_0x0978('0x5'),_0x0978('0x6'))},'description':{'type':Sequelize[_0x0978('0x0')]}}; \ No newline at end of file +var _0xb26e=['beepall','roundrobin','STRING','sequelize','INTEGER','ENUM'];(function(_0x29e3ec,_0x138a18){var _0x25727e=function(_0x2bea0d){while(--_0x2bea0d){_0x29e3ec['push'](_0x29e3ec['shift']());}};_0x25727e(++_0x138a18);}(_0xb26e,0x11d));var _0xeb26=function(_0x402d00,_0x46761f){_0x402d00=_0x402d00-0x0;var _0x23df42=_0xb26e[_0x402d00];return _0x23df42;};'use strict';var Sequelize=require(_0xeb26('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xeb26('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xeb26('0x2')]('rrmemory',_0xeb26('0x3'),_0xeb26('0x4'))},'description':{'type':Sequelize[_0xeb26('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 9d81d33..10705a2 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 _0x5098=['isArray','userWhatsappQueue:remove','getAgents','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','get','WhatsappQueues','UserProfileResource','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','WhatsappQueue','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserWhatsappQueue','order','WhatsappQueueId','findAll','User','findAndCountAll','agent','whatsappPause','updatedAt','createdAt','%s/%s','SIP','getTeams','findOne','Team','ids','Agents','online','voicePause','interface','flatMap','each','findOrCreate','emit','userWhatsappQueue:save','select','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','includes','all','compact','value','transaction','removeTeams','isEmpty','forEach','addAgents','omit','spread','removeAgents'];(function(_0x3a95f1,_0x6f9805){var _0xa249c3=function(_0x2f741f){while(--_0x2f741f){_0x3a95f1['push'](_0x3a95f1['shift']());}};_0xa249c3(++_0x6f9805);}(_0x5098,0x95));var _0x8509=function(_0xd2fdb5,_0x2721c0){_0xd2fdb5=_0xd2fdb5-0x0;var _0x8d24ee=_0x5098[_0xd2fdb5];return _0x8d24ee;};'use strict';var emlformat=require(_0x8509('0x0'));var rimraf=require(_0x8509('0x1'));var zipdir=require(_0x8509('0x2'));var jsonpatch=require(_0x8509('0x3'));var rp=require(_0x8509('0x4'));var moment=require(_0x8509('0x5'));var BPromise=require(_0x8509('0x6'));var Mustache=require(_0x8509('0x7'));var util=require(_0x8509('0x8'));var path=require(_0x8509('0x9'));var sox=require(_0x8509('0xa'));var csv=require(_0x8509('0xb'));var ejs=require(_0x8509('0xc'));var fs=require('fs');var fs_extra=require(_0x8509('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8509('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8509('0xf'));var toCsv=require(_0x8509('0xb'));var querystring=require(_0x8509('0x10'));var Papa=require(_0x8509('0x11'));var Redis=require(_0x8509('0x12'));var authService=require(_0x8509('0x13'));var qs=require(_0x8509('0x14'));var as=require(_0x8509('0x15'));var hardwareService=require(_0x8509('0x16'));var logger=require('../../config/logger')(_0x8509('0x17'));var utils=require('../../config/utils');var config=require(_0x8509('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x8509('0x19'))['db'];config['redis']=_[_0x8509('0x1a')](config[_0x8509('0x1b')],{'host':_0x8509('0x1c'),'port':0x18eb});var socket=require(_0x8509('0x1d'))(new Redis(config[_0x8509('0x1b')]));require('./whatsappQueue.socket')[_0x8509('0x1e')](socket);function respondWithStatusCode(_0x5cd4e4,_0x2d5986){_0x2d5986=_0x2d5986||0xcc;return function(_0x54699b){if(_0x54699b){return _0x5cd4e4[_0x8509('0x1f')](_0x2d5986);}return _0x5cd4e4[_0x8509('0x20')](_0x2d5986)[_0x8509('0x21')]();};}function respondWithResult(_0x3e75bc,_0x23acd6){_0x23acd6=_0x23acd6||0xc8;return function(_0x10ae3c){if(_0x10ae3c){return _0x3e75bc['status'](_0x23acd6)[_0x8509('0x22')](_0x10ae3c);}};}function respondWithFilteredResult(_0x322a91,_0x12bf29){return function(_0x37d5d7){if(_0x37d5d7){var _0x40b554=typeof _0x12bf29[_0x8509('0x23')]===_0x8509('0x24')&&typeof _0x12bf29[_0x8509('0x25')]==='undefined';var _0x27f8af=_0x37d5d7['count'];var _0x237e56=_0x40b554?0x0:_0x12bf29[_0x8509('0x23')];var _0x1a79ae=_0x40b554?_0x37d5d7[_0x8509('0x26')]:_0x12bf29[_0x8509('0x23')]+_0x12bf29['limit'];var _0x47e6c5;if(_0x1a79ae>=_0x27f8af){_0x1a79ae=_0x27f8af;_0x47e6c5=0xc8;}else{_0x47e6c5=0xce;}_0x322a91[_0x8509('0x20')](_0x47e6c5);return _0x322a91['set'](_0x8509('0x27'),_0x237e56+'-'+_0x1a79ae+'/'+_0x27f8af)[_0x8509('0x22')](_0x37d5d7);}return null;};}function patchUpdates(_0x2c6bae){return function(_0x3337c1){try{jsonpatch[_0x8509('0x28')](_0x3337c1,_0x2c6bae,!![]);}catch(_0x581e2c){return BPromise[_0x8509('0x29')](_0x581e2c);}return _0x3337c1['save']();};}function saveUpdates(_0x1706da,_0x446bc5){return function(_0x3d95b7){if(_0x3d95b7){return _0x3d95b7[_0x8509('0x2a')](_0x1706da)['then'](function(_0xc9d939){return _0xc9d939;});}return null;};}function removeEntity(_0x46f46f,_0x29bd94){return function(_0x25a05b){if(_0x25a05b){return _0x25a05b['destroy']()['then'](function(){var _0x2802f4=_0x25a05b[_0x8509('0x2b')]({'plain':!![]});var _0x24642f=_0x8509('0x2c');return db[_0x8509('0x2d')][_0x8509('0x2e')]({'where':{'type':_0x24642f,'resourceId':_0x2802f4['id']}})[_0x8509('0x2f')](function(){return _0x25a05b;});})['then'](function(){_0x46f46f[_0x8509('0x20')](0xcc)[_0x8509('0x21')]();});}};}function handleEntityNotFound(_0x3bbc53,_0x44122d){return function(_0x35a632){if(!_0x35a632){_0x3bbc53[_0x8509('0x1f')](0x194);}return _0x35a632;};}function handleError(_0x22640e,_0x2c1da8){_0x2c1da8=_0x2c1da8||0x1f4;return function(_0x4d9947){logger['error'](_0x4d9947[_0x8509('0x30')]);if(_0x4d9947[_0x8509('0x31')]){delete _0x4d9947[_0x8509('0x31')];}_0x22640e[_0x8509('0x20')](_0x2c1da8)[_0x8509('0x32')](_0x4d9947);};}exports[_0x8509('0x33')]=function(_0x366b29,_0x5a410){var _0x31c76f={},_0x5088da={},_0x7dd51={'count':0x0,'rows':[]};var _0x4af978=_[_0x8509('0x34')](db['WhatsappQueue'][_0x8509('0x35')],function(_0x2b0227){return{'name':_0x2b0227[_0x8509('0x36')],'type':_0x2b0227[_0x8509('0x37')][_0x8509('0x38')]};});_0x5088da['model']=_[_0x8509('0x34')](_0x4af978,_0x8509('0x31'));_0x5088da[_0x8509('0x39')]=_[_0x8509('0x3a')](_0x366b29[_0x8509('0x39')]);_0x5088da[_0x8509('0x3b')]=_[_0x8509('0x3c')](_0x5088da[_0x8509('0x3d')],_0x5088da['query']);_0x31c76f[_0x8509('0x3e')]=_['intersection'](_0x5088da['model'],qs[_0x8509('0x3f')](_0x366b29[_0x8509('0x39')][_0x8509('0x3f')]));_0x31c76f[_0x8509('0x3e')]=_0x31c76f[_0x8509('0x3e')][_0x8509('0x40')]?_0x31c76f[_0x8509('0x3e')]:_0x5088da['model'];if(!_0x366b29['query'][_0x8509('0x41')](_0x8509('0x42'))){_0x31c76f[_0x8509('0x25')]=qs['limit'](_0x366b29[_0x8509('0x39')][_0x8509('0x25')]);_0x31c76f[_0x8509('0x23')]=qs[_0x8509('0x23')](_0x366b29[_0x8509('0x39')][_0x8509('0x23')]);}_0x31c76f['order']=qs[_0x8509('0x43')](_0x366b29[_0x8509('0x39')][_0x8509('0x43')]);_0x31c76f[_0x8509('0x44')]=qs[_0x8509('0x3b')](_['pick'](_0x366b29[_0x8509('0x39')],_0x5088da[_0x8509('0x3b')]),_0x4af978);if(_0x366b29[_0x8509('0x39')][_0x8509('0x45')]){_0x31c76f[_0x8509('0x44')]=_[_0x8509('0x46')](_0x31c76f[_0x8509('0x44')],{'$or':_[_0x8509('0x34')](_0x4af978,function(_0x3c8cf2){if(_0x3c8cf2['type']!=='VIRTUAL'){var _0x4e894b={};_0x4e894b[_0x3c8cf2[_0x8509('0x31')]]={'$like':'%'+_0x366b29[_0x8509('0x39')][_0x8509('0x45')]+'%'};return _0x4e894b;}})});}_0x31c76f=_['merge']({},_0x31c76f,_0x366b29[_0x8509('0x47')]);var _0x131dc7={'where':_0x31c76f[_0x8509('0x44')]};return db['WhatsappQueue'][_0x8509('0x26')](_0x131dc7)[_0x8509('0x2f')](function(_0x115b43){_0x7dd51[_0x8509('0x26')]=_0x115b43;if(_0x366b29[_0x8509('0x39')][_0x8509('0x48')]){_0x31c76f[_0x8509('0x49')]=[{'all':!![]}];}return db[_0x8509('0x4a')]['findAll'](_0x31c76f);})['then'](function(_0x1ffc56){_0x7dd51[_0x8509('0x4b')]=_0x1ffc56;return _0x7dd51;})[_0x8509('0x2f')](respondWithFilteredResult(_0x5a410,_0x31c76f))[_0x8509('0x4c')](handleError(_0x5a410,null));};exports[_0x8509('0x4d')]=function(_0x3bd76d,_0x4fc833){var _0x34826a={'raw':!![],'where':{'id':_0x3bd76d[_0x8509('0x4e')]['id']}},_0x283fbd={};_0x283fbd[_0x8509('0x3d')]=_[_0x8509('0x3a')](db[_0x8509('0x4a')][_0x8509('0x35')]);_0x283fbd[_0x8509('0x39')]=_[_0x8509('0x3a')](_0x3bd76d[_0x8509('0x39')]);_0x283fbd[_0x8509('0x3b')]=_[_0x8509('0x3c')](_0x283fbd[_0x8509('0x3d')],_0x283fbd[_0x8509('0x39')]);_0x34826a['attributes']=_['intersection'](_0x283fbd[_0x8509('0x3d')],qs[_0x8509('0x3f')](_0x3bd76d[_0x8509('0x39')]['fields']));_0x34826a[_0x8509('0x3e')]=_0x34826a['attributes'][_0x8509('0x40')]?_0x34826a[_0x8509('0x3e')]:_0x283fbd[_0x8509('0x3d')];if(_0x3bd76d[_0x8509('0x39')][_0x8509('0x48')]){_0x34826a[_0x8509('0x49')]=[{'all':!![]}];}_0x34826a=_['merge']({},_0x34826a,_0x3bd76d[_0x8509('0x47')]);return db['WhatsappQueue'][_0x8509('0x4f')](_0x34826a)[_0x8509('0x2f')](handleEntityNotFound(_0x4fc833,null))[_0x8509('0x2f')](respondWithResult(_0x4fc833,null))[_0x8509('0x4c')](handleError(_0x4fc833,null));};exports[_0x8509('0x50')]=function(_0x5a34f2,_0x37620f){return db['WhatsappQueue'][_0x8509('0x50')](_0x5a34f2[_0x8509('0x51')],{})['then'](function(_0x4e8f2c){var _0x1bb0ab=_0x5a34f2[_0x8509('0x52')]['get']({'plain':!![]});if(!_0x1bb0ab)throw new Error(_0x8509('0x53'));if(_0x1bb0ab[_0x8509('0x54')]===_0x8509('0x52')){var _0x2d114a=_0x4e8f2c[_0x8509('0x2b')]({'plain':!![]});var _0x48878b='WhatsappQueues';return db[_0x8509('0x55')][_0x8509('0x4f')]({'where':{'name':_0x48878b,'userProfileId':_0x1bb0ab[_0x8509('0x56')]},'raw':!![]})[_0x8509('0x2f')](function(_0x3e56b2){if(_0x3e56b2&&_0x3e56b2[_0x8509('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x2d114a[_0x8509('0x31')],'resourceId':_0x2d114a['id'],'type':_0x3e56b2[_0x8509('0x31')],'sectionId':_0x3e56b2['id']},{})[_0x8509('0x2f')](function(){return _0x4e8f2c;});}else{return _0x4e8f2c;}})[_0x8509('0x4c')](function(_0x10b528){logger[_0x8509('0x58')](_0x8509('0x59'),_0x10b528);throw _0x10b528;});}return _0x4e8f2c;})[_0x8509('0x2f')](respondWithResult(_0x37620f,0xc9))[_0x8509('0x4c')](handleError(_0x37620f,null));};exports[_0x8509('0x2a')]=function(_0x53be94,_0x523926){if(_0x53be94[_0x8509('0x51')]['id']){delete _0x53be94[_0x8509('0x51')]['id'];}return db[_0x8509('0x4a')][_0x8509('0x4f')]({'where':{'id':_0x53be94[_0x8509('0x4e')]['id']}})['then'](handleEntityNotFound(_0x523926,null))[_0x8509('0x2f')](saveUpdates(_0x53be94[_0x8509('0x51')],null))[_0x8509('0x2f')](respondWithResult(_0x523926,null))[_0x8509('0x4c')](handleError(_0x523926,null));};exports[_0x8509('0x2e')]=function(_0x5cdfe3,_0x2313b6){return db[_0x8509('0x4a')][_0x8509('0x4f')]({'where':{'id':_0x5cdfe3[_0x8509('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2313b6,null))[_0x8509('0x2f')](removeEntity(_0x2313b6,null))[_0x8509('0x4c')](handleError(_0x2313b6,null));};exports[_0x8509('0x5a')]=function(_0x2cca3d,_0x394661){return db[_0x8509('0x4a')][_0x8509('0x5a')]()[_0x8509('0x2f')](respondWithResult(_0x394661,null))[_0x8509('0x4c')](handleError(_0x394661,null));};exports[_0x8509('0x5b')]=function(_0x45efc0,_0x18311c,_0x1e1e15){var _0x277993={'raw':!![],'where':{}},_0x6529ca={},_0x443c8e;return db[_0x8509('0x4a')]['findOne']({'where':{'id':_0x45efc0[_0x8509('0x4e')]['id']}})['then'](handleEntityNotFound(_0x18311c,null))['then'](function(_0x175d1c){if(_0x175d1c){_0x443c8e=_0x175d1c[_0x8509('0x2b')]({'plain':!![]});_0x6529ca['model']=_[_0x8509('0x3a')](db[_0x8509('0x5c')][_0x8509('0x35')]);_0x6529ca[_0x8509('0x39')]=_[_0x8509('0x3a')](_0x45efc0[_0x8509('0x39')]);_0x6529ca[_0x8509('0x3b')]=_[_0x8509('0x3c')](_0x6529ca[_0x8509('0x3d')],_0x6529ca['query']);_0x277993[_0x8509('0x3e')]=_[_0x8509('0x3c')](_0x6529ca[_0x8509('0x3d')],qs[_0x8509('0x3f')](_0x45efc0['query'][_0x8509('0x3f')]));_0x277993[_0x8509('0x3e')]=_0x277993[_0x8509('0x3e')][_0x8509('0x40')]?_0x277993[_0x8509('0x3e')]:_0x6529ca[_0x8509('0x3d')];if(!_0x45efc0[_0x8509('0x39')][_0x8509('0x41')](_0x8509('0x42'))){_0x277993[_0x8509('0x25')]=qs[_0x8509('0x25')](_0x45efc0[_0x8509('0x39')][_0x8509('0x25')]);_0x277993['offset']=qs[_0x8509('0x23')](_0x45efc0[_0x8509('0x39')][_0x8509('0x23')]);}_0x277993[_0x8509('0x5d')]=qs[_0x8509('0x43')](_0x45efc0[_0x8509('0x39')][_0x8509('0x43')]);_0x277993['where']=qs[_0x8509('0x3b')](_['pick'](_0x45efc0['query'],_0x6529ca['filters']));_0x277993[_0x8509('0x44')][_0x8509('0x5e')]=_0x175d1c['id'];if(_0x45efc0[_0x8509('0x39')][_0x8509('0x45')]){_0x277993[_0x8509('0x44')]=_[_0x8509('0x46')](_0x277993['where'],{'$or':_['map'](_0x277993[_0x8509('0x3e')],function(_0x239467){var _0x219b61={};_0x219b61[_0x239467]={'$like':'%'+_0x45efc0[_0x8509('0x39')][_0x8509('0x45')]+'%'};return _0x219b61;})});}_0x277993=_[_0x8509('0x46')]({},_0x277993,_0x45efc0[_0x8509('0x47')]);return db[_0x8509('0x5c')][_0x8509('0x5f')](_0x277993);}})[_0x8509('0x2f')](function(_0x2c56ce){if(_0x2c56ce){return db[_0x8509('0x60')][_0x8509('0x61')]({'where':{'id':_['map'](_0x2c56ce,'UserId'),'role':_0x8509('0x62')},'attributes':['id',_0x8509('0x31'),_0x8509('0x63'),_0x8509('0x64'),_0x8509('0x65')]});}})[_0x8509('0x2f')](function(_0x488348){if(_0x488348){return{'count':_0x488348['count'],'rows':_[_0x8509('0x34')](_0x488348[_0x8509('0x4b')],function(_0x23fd21){return{'membername':_0x23fd21['name'],'UserId':_0x23fd21['id'],'queue_name':_0x443c8e[_0x8509('0x31')],'WhatsappQueueId':_0x443c8e['id'],'interface':util['format'](_0x8509('0x66'),_0x8509('0x67'),_0x23fd21[_0x8509('0x31')]),'penalty':0x0,'paused':_0x23fd21[_0x8509('0x63')],'createdAt':_0x23fd21[_0x8509('0x65')],'updatedAt':_0x23fd21['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x8509('0x2f')](respondWithFilteredResult(_0x18311c,_0x277993))['catch'](handleError(_0x18311c,null));};exports[_0x8509('0x68')]=function(_0x28b593,_0x38b152,_0x12179a){var _0x4005ff={};var _0x1bd055={};var _0x162fe3;var _0x3f1896;return db['WhatsappQueue'][_0x8509('0x69')]({'where':{'id':_0x28b593[_0x8509('0x4e')]['id']}})[_0x8509('0x2f')](handleEntityNotFound(_0x38b152,null))[_0x8509('0x2f')](function(_0x42de90){if(_0x42de90){_0x162fe3=_0x42de90;_0x1bd055[_0x8509('0x3d')]=_['keys'](db[_0x8509('0x6a')][_0x8509('0x35')]);_0x1bd055[_0x8509('0x39')]=_[_0x8509('0x3a')](_0x28b593['query']);_0x1bd055['filters']=_[_0x8509('0x3c')](_0x1bd055[_0x8509('0x3d')],_0x1bd055[_0x8509('0x39')]);_0x4005ff[_0x8509('0x3e')]=_[_0x8509('0x3c')](_0x1bd055['model'],qs[_0x8509('0x3f')](_0x28b593[_0x8509('0x39')][_0x8509('0x3f')]));_0x4005ff['attributes']=_0x4005ff[_0x8509('0x3e')][_0x8509('0x40')]?_0x4005ff[_0x8509('0x3e')]:_0x1bd055['model'];_0x4005ff['order']=qs['sort'](_0x28b593[_0x8509('0x39')][_0x8509('0x43')]);_0x4005ff[_0x8509('0x44')]=qs['filters'](_['pick'](_0x28b593['query'],_0x1bd055[_0x8509('0x3b')]));if(_0x28b593['query']['filter']){_0x4005ff[_0x8509('0x44')]=_[_0x8509('0x46')](_0x4005ff[_0x8509('0x44')],{'$or':_[_0x8509('0x34')](_0x4005ff[_0x8509('0x3e')],function(_0x11f7ee){var _0x118322={};_0x118322[_0x11f7ee]={'$like':'%'+_0x28b593[_0x8509('0x39')]['filter']+'%'};return _0x118322;})});}_0x4005ff=_[_0x8509('0x46')]({},_0x4005ff,_0x28b593['options']);return _0x162fe3[_0x8509('0x68')](_0x4005ff);}})[_0x8509('0x2f')](function(_0x1326ce){if(_0x1326ce){_0x3f1896=_0x1326ce[_0x8509('0x40')];if(!_0x28b593['query'][_0x8509('0x41')]('nolimit')){_0x4005ff[_0x8509('0x25')]=qs['limit'](_0x28b593[_0x8509('0x39')][_0x8509('0x25')]);_0x4005ff[_0x8509('0x23')]=qs['offset'](_0x28b593[_0x8509('0x39')][_0x8509('0x23')]);}return _0x162fe3[_0x8509('0x68')](_0x4005ff);}})['then'](function(_0x5d0c48){if(_0x5d0c48){return _0x5d0c48?{'count':_0x3f1896,'rows':_0x5d0c48}:null;}})['then'](respondWithResult(_0x38b152,null))[_0x8509('0x4c')](handleError(_0x38b152,null));};exports['addTeams']=function(_0x12c6e4,_0x1c122d,_0x13cfc3){var _0x3e5423=_0x12c6e4[_0x8509('0x51')][_0x8509('0x6b')];return db['Team']['findAll']({'where':{'id':_0x3e5423},'attributes':['id'],'include':[{'model':db[_0x8509('0x60')],'as':_0x8509('0x6c'),'attributes':['id',_0x8509('0x31'),_0x8509('0x6d'),_0x8509('0x6e'),_0x8509('0x6f')],'raw':!![]}]})[_0x8509('0x2f')](function(_0x1f8068){if(_0x1f8068){var _0x4853db=_[_0x8509('0x70')](_0x1f8068,function(_0x2323f0){var _0x1915a0=_0x2323f0[_0x8509('0x2b')]({'plain':!![]});return _0x1915a0['Agents'];});return db[_0x8509('0x4a')]['find']({'where':{'id':_0x12c6e4[_0x8509('0x4e')]['id']}})[_0x8509('0x2f')](function(_0x25d11e){return db['sequelize']['transaction'](function(_0x20d144){return _0x25d11e['addTeams'](_0x3e5423,{'transaction':_0x20d144})[_0x8509('0x2f')](function(){return BPromise[_0x8509('0x71')](_0x4853db,function(_0xc2cb5){return db[_0x8509('0x5c')][_0x8509('0x72')]({'where':{'UserId':_0xc2cb5['id'],'WhatsappQueueId':_0x12c6e4[_0x8509('0x4e')]['id']},'transaction':_0x20d144});});})[_0x8509('0x2f')](function(){_0x4853db['forEach'](function(_0x1451ef){socket[_0x8509('0x73')](_0x8509('0x74'),{'UserId':_0x1451ef['id'],'WhatsappQueueId':_0x25d11e['id']});});});});});}})[_0x8509('0x2f')](respondWithStatusCode(_0x1c122d,null))['catch'](handleError(_0x1c122d,null));};exports['removeTeams']=function(_0x1277fa,_0x196b44,_0x37d539){return db['Team'][_0x8509('0x5f')]({'where':{'id':_0x1277fa['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x8509('0x60')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x8509('0x2f')](handleEntityNotFound(_0x196b44,null))[_0x8509('0x2f')](function(_0x4d6ba9){var _0x112415=_['map'](_0x4d6ba9,'id');var _0x52b259=[];var _0x323676=[];var _0x335ac4=squel[_0x8509('0x75')]();_0x335ac4['field'](_0x8509('0x76'))[_0x8509('0x77')](_0x8509('0x78'),'tq')[_0x8509('0x79')](_0x8509('0x7a'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x8509('0x44')](_0x8509('0x7b'),_0x1277fa[_0x8509('0x4e')]['id']);for(var _0x5cd95a=0x0;_0x5cd95a<_0x4d6ba9[_0x8509('0x40')];_0x5cd95a+=0x1){let _0xe20e3e=_0x4d6ba9[_0x5cd95a];for(var _0x7f787d=0x0;_0x7f787d<_0xe20e3e[_0x8509('0x6c')][_0x8509('0x40')];_0x7f787d+=0x1){let _0x3961e6=_0xe20e3e['Agents'][_0x7f787d];var _0x2b6dd7=_0x335ac4['clone']();_0x2b6dd7[_0x8509('0x44')](_0x8509('0x7c'),_0x3961e6['id']);_0x323676[_0x8509('0x7d')](db['sequelize'][_0x8509('0x39')](_0x2b6dd7[_0x8509('0x7e')](),{'type':db[_0x8509('0x7f')][_0x8509('0x80')]['SELECT']})[_0x8509('0x2f')](function(_0x2d3bc4){if(_0x2d3bc4[_0x8509('0x40')]===0x1){return _0x3961e6['id'];}else{var _0x4ee933=_['every'](_['map'](_0x2d3bc4,'TeamId'),function(_0x3d5765){return _[_0x8509('0x81')](_0x112415,_0x3d5765);});if(_0x4ee933){return _0x3961e6['id'];}}}));}}return BPromise[_0x8509('0x82')](_0x323676)['then'](function(_0x4169b6){_0x52b259=_(_0x52b259)['union'](_0x4169b6)[_0x8509('0x83')]()[_0x8509('0x84')]();return db[_0x8509('0x4a')][_0x8509('0x4f')]({'where':{'id':_0x1277fa[_0x8509('0x4e')]['id']}})[_0x8509('0x2f')](function(_0x46f8bb){return db['sequelize'][_0x8509('0x85')](function(_0x442d53){return _0x46f8bb[_0x8509('0x86')](_0x1277fa[_0x8509('0x39')][_0x8509('0x6b')],{'transaction':_0x442d53})[_0x8509('0x2f')](function(){if(!_[_0x8509('0x87')](_0x52b259)){return _0x46f8bb['removeAgents'](_0x52b259,{'transaction':_0x442d53});}})[_0x8509('0x2f')](function(){_0x52b259[_0x8509('0x88')](function(_0x45d505){socket['emit']('userWhatsappQueue:remove',{'UserId':_0x45d505,'WhatsappQueueId':_0x46f8bb['id']});});});});});});})['then'](respondWithStatusCode(_0x196b44,null))[_0x8509('0x4c')](handleError(_0x196b44,null));};exports['addAgents']=function(_0x5ec4ce,_0x2b508c,_0x3dae09){return db['WhatsappQueue'][_0x8509('0x4f')]({'where':{'id':_0x5ec4ce[_0x8509('0x4e')]['id']}})[_0x8509('0x2f')](handleEntityNotFound(_0x2b508c,null))['then'](function(_0x5e9a5f){if(_0x5e9a5f){return _0x5e9a5f[_0x8509('0x89')](_0x5ec4ce[_0x8509('0x51')][_0x8509('0x6b')],_[_0x8509('0x8a')](_0x5ec4ce[_0x8509('0x51')],[_0x8509('0x6b'),'id'])||{})[_0x8509('0x8b')](function(_0x19953e){for(var _0x2246e7=0x0;_0x2246e7<_0x5ec4ce['body'][_0x8509('0x6b')][_0x8509('0x40')];_0x2246e7+=0x1){socket[_0x8509('0x73')]('userWhatsappQueue:save',{'UserId':Number(_0x5ec4ce[_0x8509('0x51')][_0x8509('0x6b')][_0x2246e7]),'WhatsappQueueId':Number(_0x5ec4ce[_0x8509('0x4e')]['id'])});}return _0x19953e;});}})[_0x8509('0x2f')](respondWithResult(_0x2b508c,null))['catch'](handleError(_0x2b508c,null));};exports['removeAgents']=function(_0x3aa250,_0x1349d7,_0x3bedae){return db[_0x8509('0x4a')]['find']({'where':{'id':_0x3aa250['params']['id']}})[_0x8509('0x2f')](handleEntityNotFound(_0x1349d7,null))[_0x8509('0x2f')](function(_0x1caee4){if(_0x1caee4){return _0x1caee4[_0x8509('0x8c')](_0x3aa250[_0x8509('0x39')]['ids'])['then'](function(){if(_[_0x8509('0x8d')](_0x3aa250[_0x8509('0x39')][_0x8509('0x6b')])){for(var _0x2647e3=0x0;_0x2647e3<_0x3aa250[_0x8509('0x39')]['ids'][_0x8509('0x40')];_0x2647e3+=0x1){socket[_0x8509('0x73')](_0x8509('0x8e'),{'UserId':Number(_0x3aa250[_0x8509('0x39')][_0x8509('0x6b')][_0x2647e3]),'WhatsappQueueId':Number(_0x3aa250[_0x8509('0x4e')]['id'])});}}else{socket[_0x8509('0x73')](_0x8509('0x8e'),{'UserId':Number(_0x3aa250[_0x8509('0x39')][_0x8509('0x6b')]),'WhatsappQueueId':Number(_0x3aa250[_0x8509('0x4e')]['id'])});}});}})[_0x8509('0x2f')](respondWithStatusCode(_0x1349d7,null))[_0x8509('0x4c')](handleError(_0x1349d7,null));};exports[_0x8509('0x8f')]=function(_0x1f1973,_0x2ae763,_0x3ff13e){var _0x5a2732={};var _0x568fff={};var _0x5d7c81;var _0x4e47d9;return db[_0x8509('0x4a')][_0x8509('0x69')]({'where':{'id':_0x1f1973[_0x8509('0x4e')]['id']}})[_0x8509('0x2f')](handleEntityNotFound(_0x2ae763,null))[_0x8509('0x2f')](function(_0xcb40e0){if(_0xcb40e0){_0x5d7c81=_0xcb40e0;_0x568fff['model']=_[_0x8509('0x3a')](db['User']['rawAttributes']);_0x568fff[_0x8509('0x39')]=_[_0x8509('0x3a')](_0x1f1973['query']);_0x568fff[_0x8509('0x3b')]=_[_0x8509('0x3c')](_0x568fff['model'],_0x568fff[_0x8509('0x39')]);_0x5a2732['attributes']=_[_0x8509('0x3c')](_0x568fff[_0x8509('0x3d')],qs[_0x8509('0x3f')](_0x1f1973[_0x8509('0x39')][_0x8509('0x3f')]));_0x5a2732[_0x8509('0x3e')]=_0x5a2732[_0x8509('0x3e')][_0x8509('0x40')]?_0x5a2732['attributes']:_0x568fff[_0x8509('0x3d')];_0x5a2732[_0x8509('0x5d')]=qs[_0x8509('0x43')](_0x1f1973[_0x8509('0x39')]['sort']);_0x5a2732[_0x8509('0x44')]=qs['filters'](_[_0x8509('0x90')](_0x1f1973['query'],_0x568fff['filters']));if(_0x1f1973[_0x8509('0x39')]['filter']){_0x5a2732[_0x8509('0x44')]=_['merge'](_0x5a2732[_0x8509('0x44')],{'$or':_[_0x8509('0x34')](_0x5a2732[_0x8509('0x3e')],function(_0x15bb9e){var _0x3b86a7={};_0x3b86a7[_0x15bb9e]={'$like':'%'+_0x1f1973[_0x8509('0x39')]['filter']+'%'};return _0x3b86a7;})});}_0x5a2732=_[_0x8509('0x46')]({},_0x5a2732,_0x1f1973[_0x8509('0x47')]);return _0x5d7c81[_0x8509('0x8f')](_0x5a2732);}})[_0x8509('0x2f')](function(_0x449dbf){if(_0x449dbf){_0x4e47d9=_0x449dbf[_0x8509('0x40')];if(!_0x1f1973[_0x8509('0x39')]['hasOwnProperty'](_0x8509('0x42'))){_0x5a2732[_0x8509('0x25')]=qs[_0x8509('0x25')](_0x1f1973[_0x8509('0x39')][_0x8509('0x25')]);_0x5a2732[_0x8509('0x23')]=qs[_0x8509('0x23')](_0x1f1973['query'][_0x8509('0x23')]);}return _0x5d7c81['getAgents'](_0x5a2732);}})[_0x8509('0x2f')](function(_0x4da015){if(_0x4da015){return _0x4da015?{'count':_0x4e47d9,'rows':_0x4da015}:null;}})['then'](respondWithResult(_0x2ae763,null))[_0x8509('0x4c')](handleError(_0x2ae763,null));}; \ No newline at end of file +var _0xac5a=['status','end','json','offset','limit','undefined','count','set','Content-Range','save','update','then','UserProfileResource','destroy','sendStatus','error','stack','send','index','rawAttributes','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappQueue','rows','catch','show','length','includeAll','find','create','body','user','get','WhatsappQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','hasOwnProperty','WhatsappQueueId','UserWhatsappQueue','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','format','SIP','createdAt','getTeams','Team','addTeams','findAll','Agents','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','compact','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/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','./whatsappQueue.socket','register'];(function(_0x5de756,_0x13698a){var _0x2214ce=function(_0x58626d){while(--_0x58626d){_0x5de756['push'](_0x5de756['shift']());}};_0x2214ce(++_0x13698a);}(_0xac5a,0x104));var _0xaac5=function(_0x1ad926,_0x3e1fed){_0x1ad926=_0x1ad926-0x0;var _0x1b81dc=_0xac5a[_0x1ad926];return _0x1b81dc;};'use strict';var emlformat=require(_0xaac5('0x0'));var rimraf=require(_0xaac5('0x1'));var zipdir=require(_0xaac5('0x2'));var jsonpatch=require(_0xaac5('0x3'));var rp=require(_0xaac5('0x4'));var moment=require(_0xaac5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xaac5('0x6'));var util=require(_0xaac5('0x7'));var path=require(_0xaac5('0x8'));var sox=require(_0xaac5('0x9'));var csv=require(_0xaac5('0xa'));var ejs=require(_0xaac5('0xb'));var fs=require('fs');var fs_extra=require(_0xaac5('0xc'));var _=require(_0xaac5('0xd'));var squel=require(_0xaac5('0xe'));var crypto=require(_0xaac5('0xf'));var jsforce=require(_0xaac5('0x10'));var deskjs=require(_0xaac5('0x11'));var toCsv=require(_0xaac5('0xa'));var querystring=require(_0xaac5('0x12'));var Papa=require(_0xaac5('0x13'));var Redis=require(_0xaac5('0x14'));var authService=require(_0xaac5('0x15'));var qs=require(_0xaac5('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaac5('0x17'));var logger=require(_0xaac5('0x18'))(_0xaac5('0x19'));var utils=require(_0xaac5('0x1a'));var config=require(_0xaac5('0x1b'));var licenseUtil=require(_0xaac5('0x1c'));var db=require(_0xaac5('0x1d'))['db'];config[_0xaac5('0x1e')]=_[_0xaac5('0x1f')](config[_0xaac5('0x1e')],{'host':_0xaac5('0x20'),'port':0x18eb});var socket=require(_0xaac5('0x21'))(new Redis(config[_0xaac5('0x1e')]));require(_0xaac5('0x22'))[_0xaac5('0x23')](socket);function respondWithStatusCode(_0x12c0e9,_0x1cf5c9){_0x1cf5c9=_0x1cf5c9||0xcc;return function(_0x12afd6){if(_0x12afd6){return _0x12c0e9['sendStatus'](_0x1cf5c9);}return _0x12c0e9[_0xaac5('0x24')](_0x1cf5c9)[_0xaac5('0x25')]();};}function respondWithResult(_0x337270,_0x40ecbf){_0x40ecbf=_0x40ecbf||0xc8;return function(_0x3c5aed){if(_0x3c5aed){return _0x337270['status'](_0x40ecbf)[_0xaac5('0x26')](_0x3c5aed);}};}function respondWithFilteredResult(_0x2df40a,_0x569193){return function(_0x5e7fee){if(_0x5e7fee){var _0xa564ac=typeof _0x569193[_0xaac5('0x27')]==='undefined'&&typeof _0x569193[_0xaac5('0x28')]===_0xaac5('0x29');var _0x43e5db=_0x5e7fee[_0xaac5('0x2a')];var _0x137e93=_0xa564ac?0x0:_0x569193['offset'];var _0x581d69=_0xa564ac?_0x5e7fee[_0xaac5('0x2a')]:_0x569193['offset']+_0x569193[_0xaac5('0x28')];var _0x49d127;if(_0x581d69>=_0x43e5db){_0x581d69=_0x43e5db;_0x49d127=0xc8;}else{_0x49d127=0xce;}_0x2df40a[_0xaac5('0x24')](_0x49d127);return _0x2df40a[_0xaac5('0x2b')](_0xaac5('0x2c'),_0x137e93+'-'+_0x581d69+'/'+_0x43e5db)[_0xaac5('0x26')](_0x5e7fee);}return null;};}function patchUpdates(_0x564705){return function(_0x37b21b){try{jsonpatch['apply'](_0x37b21b,_0x564705,!![]);}catch(_0x8648aa){return BPromise['reject'](_0x8648aa);}return _0x37b21b[_0xaac5('0x2d')]();};}function saveUpdates(_0x5bf178,_0x504663){return function(_0x417cc1){if(_0x417cc1){return _0x417cc1[_0xaac5('0x2e')](_0x5bf178)[_0xaac5('0x2f')](function(_0x4047f0){return _0x4047f0;});}return null;};}function removeEntity(_0x422dc9,_0x3711ad){return function(_0x231e98){if(_0x231e98){return _0x231e98['destroy']()[_0xaac5('0x2f')](function(){var _0x44e0d5=_0x231e98['get']({'plain':!![]});var _0xb53410='WhatsappQueues';return db[_0xaac5('0x30')][_0xaac5('0x31')]({'where':{'type':_0xb53410,'resourceId':_0x44e0d5['id']}})[_0xaac5('0x2f')](function(){return _0x231e98;});})[_0xaac5('0x2f')](function(){_0x422dc9[_0xaac5('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42b813,_0x40c1a8){return function(_0x548d1f){if(!_0x548d1f){_0x42b813[_0xaac5('0x32')](0x194);}return _0x548d1f;};}function handleError(_0x3a2ed9,_0x310736){_0x310736=_0x310736||0x1f4;return function(_0x1542e7){logger[_0xaac5('0x33')](_0x1542e7[_0xaac5('0x34')]);if(_0x1542e7['name']){delete _0x1542e7['name'];}_0x3a2ed9[_0xaac5('0x24')](_0x310736)[_0xaac5('0x35')](_0x1542e7);};}exports[_0xaac5('0x36')]=function(_0x2df40d,_0x115cbd){var _0x302fca={},_0xf627bc={},_0x2693d5={'count':0x0,'rows':[]};var _0x26f3a4=_['map'](db['WhatsappQueue'][_0xaac5('0x37')],function(_0x25bb2f){return{'name':_0x25bb2f['fieldName'],'type':_0x25bb2f[_0xaac5('0x38')][_0xaac5('0x39')]};});_0xf627bc[_0xaac5('0x3a')]=_[_0xaac5('0x3b')](_0x26f3a4,_0xaac5('0x3c'));_0xf627bc[_0xaac5('0x3d')]=_[_0xaac5('0x3e')](_0x2df40d[_0xaac5('0x3d')]);_0xf627bc[_0xaac5('0x3f')]=_[_0xaac5('0x40')](_0xf627bc['model'],_0xf627bc[_0xaac5('0x3d')]);_0x302fca[_0xaac5('0x41')]=_[_0xaac5('0x40')](_0xf627bc[_0xaac5('0x3a')],qs[_0xaac5('0x42')](_0x2df40d[_0xaac5('0x3d')]['fields']));_0x302fca[_0xaac5('0x41')]=_0x302fca[_0xaac5('0x41')]['length']?_0x302fca[_0xaac5('0x41')]:_0xf627bc['model'];if(!_0x2df40d['query']['hasOwnProperty'](_0xaac5('0x43'))){_0x302fca['limit']=qs[_0xaac5('0x28')](_0x2df40d[_0xaac5('0x3d')][_0xaac5('0x28')]);_0x302fca[_0xaac5('0x27')]=qs[_0xaac5('0x27')](_0x2df40d[_0xaac5('0x3d')]['offset']);}_0x302fca[_0xaac5('0x44')]=qs[_0xaac5('0x45')](_0x2df40d['query'][_0xaac5('0x45')]);_0x302fca[_0xaac5('0x46')]=qs[_0xaac5('0x3f')](_[_0xaac5('0x47')](_0x2df40d[_0xaac5('0x3d')],_0xf627bc[_0xaac5('0x3f')]),_0x26f3a4);if(_0x2df40d[_0xaac5('0x3d')][_0xaac5('0x48')]){_0x302fca['where']=_[_0xaac5('0x49')](_0x302fca[_0xaac5('0x46')],{'$or':_[_0xaac5('0x3b')](_0x26f3a4,function(_0x40cc1b){if(_0x40cc1b['type']!==_0xaac5('0x4a')){var _0x2e50c4={};_0x2e50c4[_0x40cc1b[_0xaac5('0x3c')]]={'$like':'%'+_0x2df40d[_0xaac5('0x3d')][_0xaac5('0x48')]+'%'};return _0x2e50c4;}})});}_0x302fca=_[_0xaac5('0x49')]({},_0x302fca,_0x2df40d[_0xaac5('0x4b')]);var _0x227dff={'where':_0x302fca[_0xaac5('0x46')]};return db[_0xaac5('0x4c')][_0xaac5('0x2a')](_0x227dff)['then'](function(_0x3e4b18){_0x2693d5['count']=_0x3e4b18;if(_0x2df40d[_0xaac5('0x3d')]['includeAll']){_0x302fca['include']=[{'all':!![]}];}return db[_0xaac5('0x4c')]['findAll'](_0x302fca);})['then'](function(_0x2e24fe){_0x2693d5[_0xaac5('0x4d')]=_0x2e24fe;return _0x2693d5;})[_0xaac5('0x2f')](respondWithFilteredResult(_0x115cbd,_0x302fca))[_0xaac5('0x4e')](handleError(_0x115cbd,null));};exports[_0xaac5('0x4f')]=function(_0xd5b5ff,_0x58dbdc){var _0x182ca5={'raw':!![],'where':{'id':_0xd5b5ff['params']['id']}},_0x266576={};_0x266576[_0xaac5('0x3a')]=_[_0xaac5('0x3e')](db[_0xaac5('0x4c')][_0xaac5('0x37')]);_0x266576[_0xaac5('0x3d')]=_[_0xaac5('0x3e')](_0xd5b5ff[_0xaac5('0x3d')]);_0x266576[_0xaac5('0x3f')]=_[_0xaac5('0x40')](_0x266576[_0xaac5('0x3a')],_0x266576[_0xaac5('0x3d')]);_0x182ca5[_0xaac5('0x41')]=_['intersection'](_0x266576[_0xaac5('0x3a')],qs[_0xaac5('0x42')](_0xd5b5ff[_0xaac5('0x3d')][_0xaac5('0x42')]));_0x182ca5[_0xaac5('0x41')]=_0x182ca5['attributes'][_0xaac5('0x50')]?_0x182ca5[_0xaac5('0x41')]:_0x266576[_0xaac5('0x3a')];if(_0xd5b5ff[_0xaac5('0x3d')][_0xaac5('0x51')]){_0x182ca5['include']=[{'all':!![]}];}_0x182ca5=_[_0xaac5('0x49')]({},_0x182ca5,_0xd5b5ff[_0xaac5('0x4b')]);return db[_0xaac5('0x4c')][_0xaac5('0x52')](_0x182ca5)[_0xaac5('0x2f')](handleEntityNotFound(_0x58dbdc,null))[_0xaac5('0x2f')](respondWithResult(_0x58dbdc,null))['catch'](handleError(_0x58dbdc,null));};exports[_0xaac5('0x53')]=function(_0x67433f,_0x56bcb5){return db[_0xaac5('0x4c')][_0xaac5('0x53')](_0x67433f[_0xaac5('0x54')],{})[_0xaac5('0x2f')](function(_0x5acfa7){var _0x56e927=_0x67433f[_0xaac5('0x55')][_0xaac5('0x56')]({'plain':!![]});if(!_0x56e927)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x56e927['role']===_0xaac5('0x55')){var _0x8d06f7=_0x5acfa7[_0xaac5('0x56')]({'plain':!![]});var _0x287d9a=_0xaac5('0x57');return db[_0xaac5('0x58')][_0xaac5('0x52')]({'where':{'name':_0x287d9a,'userProfileId':_0x56e927[_0xaac5('0x59')]},'raw':!![]})[_0xaac5('0x2f')](function(_0xf8c180){if(_0xf8c180&&_0xf8c180['autoAssociation']===0x0){return db['UserProfileResource'][_0xaac5('0x53')]({'name':_0x8d06f7[_0xaac5('0x3c')],'resourceId':_0x8d06f7['id'],'type':_0xf8c180[_0xaac5('0x3c')],'sectionId':_0xf8c180['id']},{})[_0xaac5('0x2f')](function(){return _0x5acfa7;});}else{return _0x5acfa7;}})[_0xaac5('0x4e')](function(_0x39ca38){logger[_0xaac5('0x33')](_0xaac5('0x5a'),_0x39ca38);throw _0x39ca38;});}return _0x5acfa7;})[_0xaac5('0x2f')](respondWithResult(_0x56bcb5,0xc9))[_0xaac5('0x4e')](handleError(_0x56bcb5,null));};exports[_0xaac5('0x2e')]=function(_0x1b0240,_0x293221){if(_0x1b0240[_0xaac5('0x54')]['id']){delete _0x1b0240[_0xaac5('0x54')]['id'];}return db[_0xaac5('0x4c')][_0xaac5('0x52')]({'where':{'id':_0x1b0240[_0xaac5('0x5b')]['id']}})[_0xaac5('0x2f')](handleEntityNotFound(_0x293221,null))[_0xaac5('0x2f')](saveUpdates(_0x1b0240['body'],null))['then'](respondWithResult(_0x293221,null))[_0xaac5('0x4e')](handleError(_0x293221,null));};exports[_0xaac5('0x31')]=function(_0x4bd5bb,_0x1066e2){return db['WhatsappQueue'][_0xaac5('0x52')]({'where':{'id':_0x4bd5bb[_0xaac5('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1066e2,null))['then'](removeEntity(_0x1066e2,null))[_0xaac5('0x4e')](handleError(_0x1066e2,null));};exports[_0xaac5('0x5c')]=function(_0x538b6e,_0x5031e2){return db['WhatsappQueue']['describe']()['then'](respondWithResult(_0x5031e2,null))[_0xaac5('0x4e')](handleError(_0x5031e2,null));};exports[_0xaac5('0x5d')]=function(_0x2f14ef,_0x77bb8a,_0x249741){var _0x4cc40b={'raw':!![],'where':{}},_0x232059={},_0x4f17f4;return db[_0xaac5('0x4c')][_0xaac5('0x5e')]({'where':{'id':_0x2f14ef['params']['id']}})['then'](handleEntityNotFound(_0x77bb8a,null))[_0xaac5('0x2f')](function(_0x21418){if(_0x21418){_0x4f17f4=_0x21418[_0xaac5('0x56')]({'plain':!![]});_0x232059[_0xaac5('0x3a')]=_[_0xaac5('0x3e')](db['UserWhatsappQueue'][_0xaac5('0x37')]);_0x232059[_0xaac5('0x3d')]=_[_0xaac5('0x3e')](_0x2f14ef[_0xaac5('0x3d')]);_0x232059[_0xaac5('0x3f')]=_[_0xaac5('0x40')](_0x232059[_0xaac5('0x3a')],_0x232059[_0xaac5('0x3d')]);_0x4cc40b[_0xaac5('0x41')]=_[_0xaac5('0x40')](_0x232059['model'],qs[_0xaac5('0x42')](_0x2f14ef[_0xaac5('0x3d')]['fields']));_0x4cc40b[_0xaac5('0x41')]=_0x4cc40b[_0xaac5('0x41')][_0xaac5('0x50')]?_0x4cc40b[_0xaac5('0x41')]:_0x232059[_0xaac5('0x3a')];if(!_0x2f14ef['query'][_0xaac5('0x5f')]('nolimit')){_0x4cc40b[_0xaac5('0x28')]=qs[_0xaac5('0x28')](_0x2f14ef[_0xaac5('0x3d')][_0xaac5('0x28')]);_0x4cc40b[_0xaac5('0x27')]=qs[_0xaac5('0x27')](_0x2f14ef[_0xaac5('0x3d')][_0xaac5('0x27')]);}_0x4cc40b[_0xaac5('0x44')]=qs[_0xaac5('0x45')](_0x2f14ef[_0xaac5('0x3d')]['sort']);_0x4cc40b[_0xaac5('0x46')]=qs[_0xaac5('0x3f')](_['pick'](_0x2f14ef[_0xaac5('0x3d')],_0x232059[_0xaac5('0x3f')]));_0x4cc40b[_0xaac5('0x46')][_0xaac5('0x60')]=_0x21418['id'];if(_0x2f14ef[_0xaac5('0x3d')][_0xaac5('0x48')]){_0x4cc40b['where']=_['merge'](_0x4cc40b[_0xaac5('0x46')],{'$or':_[_0xaac5('0x3b')](_0x4cc40b[_0xaac5('0x41')],function(_0x4d3f19){var _0x9de4bb={};_0x9de4bb[_0x4d3f19]={'$like':'%'+_0x2f14ef[_0xaac5('0x3d')][_0xaac5('0x48')]+'%'};return _0x9de4bb;})});}_0x4cc40b=_['merge']({},_0x4cc40b,_0x2f14ef[_0xaac5('0x4b')]);return db[_0xaac5('0x61')]['findAll'](_0x4cc40b);}})[_0xaac5('0x2f')](function(_0x5c6ba9){if(_0x5c6ba9){return db[_0xaac5('0x62')][_0xaac5('0x63')]({'where':{'id':_[_0xaac5('0x3b')](_0x5c6ba9,_0xaac5('0x64')),'role':_0xaac5('0x65')},'attributes':['id',_0xaac5('0x3c'),_0xaac5('0x66'),_0xaac5('0x67'),'createdAt']});}})[_0xaac5('0x2f')](function(_0x5906a7){if(_0x5906a7){return{'count':_0x5906a7['count'],'rows':_[_0xaac5('0x3b')](_0x5906a7[_0xaac5('0x4d')],function(_0x4a33c1){return{'membername':_0x4a33c1['name'],'UserId':_0x4a33c1['id'],'queue_name':_0x4f17f4[_0xaac5('0x3c')],'WhatsappQueueId':_0x4f17f4['id'],'interface':util[_0xaac5('0x68')]('%s/%s',_0xaac5('0x69'),_0x4a33c1[_0xaac5('0x3c')]),'penalty':0x0,'paused':_0x4a33c1[_0xaac5('0x66')],'createdAt':_0x4a33c1[_0xaac5('0x6a')],'updatedAt':_0x4a33c1[_0xaac5('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x77bb8a,_0x4cc40b))[_0xaac5('0x4e')](handleError(_0x77bb8a,null));};exports[_0xaac5('0x6b')]=function(_0x568699,_0xd5b17e,_0x4c9e7e){var _0x3681db={};var _0x36c1e5={};var _0x1e4f5c;var _0x3a575d;return db[_0xaac5('0x4c')]['findOne']({'where':{'id':_0x568699[_0xaac5('0x5b')]['id']}})[_0xaac5('0x2f')](handleEntityNotFound(_0xd5b17e,null))[_0xaac5('0x2f')](function(_0x2eaa63){if(_0x2eaa63){_0x1e4f5c=_0x2eaa63;_0x36c1e5['model']=_[_0xaac5('0x3e')](db[_0xaac5('0x6c')]['rawAttributes']);_0x36c1e5[_0xaac5('0x3d')]=_[_0xaac5('0x3e')](_0x568699[_0xaac5('0x3d')]);_0x36c1e5[_0xaac5('0x3f')]=_['intersection'](_0x36c1e5[_0xaac5('0x3a')],_0x36c1e5[_0xaac5('0x3d')]);_0x3681db[_0xaac5('0x41')]=_[_0xaac5('0x40')](_0x36c1e5[_0xaac5('0x3a')],qs['fields'](_0x568699[_0xaac5('0x3d')][_0xaac5('0x42')]));_0x3681db[_0xaac5('0x41')]=_0x3681db[_0xaac5('0x41')][_0xaac5('0x50')]?_0x3681db['attributes']:_0x36c1e5['model'];_0x3681db[_0xaac5('0x44')]=qs['sort'](_0x568699[_0xaac5('0x3d')][_0xaac5('0x45')]);_0x3681db[_0xaac5('0x46')]=qs[_0xaac5('0x3f')](_[_0xaac5('0x47')](_0x568699[_0xaac5('0x3d')],_0x36c1e5['filters']));if(_0x568699['query']['filter']){_0x3681db[_0xaac5('0x46')]=_[_0xaac5('0x49')](_0x3681db[_0xaac5('0x46')],{'$or':_[_0xaac5('0x3b')](_0x3681db[_0xaac5('0x41')],function(_0x431e51){var _0x41ec8c={};_0x41ec8c[_0x431e51]={'$like':'%'+_0x568699[_0xaac5('0x3d')][_0xaac5('0x48')]+'%'};return _0x41ec8c;})});}_0x3681db=_[_0xaac5('0x49')]({},_0x3681db,_0x568699['options']);return _0x1e4f5c[_0xaac5('0x6b')](_0x3681db);}})['then'](function(_0x12062f){if(_0x12062f){_0x3a575d=_0x12062f['length'];if(!_0x568699['query'][_0xaac5('0x5f')](_0xaac5('0x43'))){_0x3681db[_0xaac5('0x28')]=qs[_0xaac5('0x28')](_0x568699['query'][_0xaac5('0x28')]);_0x3681db['offset']=qs[_0xaac5('0x27')](_0x568699['query']['offset']);}return _0x1e4f5c[_0xaac5('0x6b')](_0x3681db);}})[_0xaac5('0x2f')](function(_0x27ad07){if(_0x27ad07){return _0x27ad07?{'count':_0x3a575d,'rows':_0x27ad07}:null;}})[_0xaac5('0x2f')](respondWithResult(_0xd5b17e,null))[_0xaac5('0x4e')](handleError(_0xd5b17e,null));};exports[_0xaac5('0x6d')]=function(_0x41d60c,_0x3665dd,_0x29e9a9){var _0x24a1f8=_0x41d60c[_0xaac5('0x54')]['ids'];return db[_0xaac5('0x6c')][_0xaac5('0x6e')]({'where':{'id':_0x24a1f8},'attributes':['id'],'include':[{'model':db[_0xaac5('0x62')],'as':_0xaac5('0x6f'),'attributes':['id',_0xaac5('0x3c'),'online','voicePause',_0xaac5('0x70')],'raw':!![]}]})['then'](function(_0x88788b){if(_0x88788b){var _0x40b8e4=_[_0xaac5('0x71')](_0x88788b,function(_0x2e8de6){var _0x30a00f=_0x2e8de6['get']({'plain':!![]});return _0x30a00f['Agents'];});return db[_0xaac5('0x4c')][_0xaac5('0x52')]({'where':{'id':_0x41d60c['params']['id']}})[_0xaac5('0x2f')](function(_0x74ee51){return db[_0xaac5('0x72')][_0xaac5('0x73')](function(_0x2ec853){return _0x74ee51[_0xaac5('0x6d')](_0x24a1f8,{'transaction':_0x2ec853})['then'](function(){return BPromise[_0xaac5('0x74')](_0x40b8e4,function(_0x5d295d){return db[_0xaac5('0x61')][_0xaac5('0x75')]({'where':{'UserId':_0x5d295d['id'],'WhatsappQueueId':_0x41d60c[_0xaac5('0x5b')]['id']},'transaction':_0x2ec853});});})[_0xaac5('0x2f')](function(){_0x40b8e4[_0xaac5('0x76')](function(_0x5e88ac){socket[_0xaac5('0x77')](_0xaac5('0x78'),{'UserId':_0x5e88ac['id'],'WhatsappQueueId':_0x74ee51['id']});});});});});}})['then'](respondWithStatusCode(_0x3665dd,null))[_0xaac5('0x4e')](handleError(_0x3665dd,null));};exports[_0xaac5('0x79')]=function(_0xd19ea0,_0x192059,_0x126ddc){return db[_0xaac5('0x6c')]['findAll']({'where':{'id':_0xd19ea0[_0xaac5('0x3d')][_0xaac5('0x7a')]},'attributes':['id'],'include':[{'model':db[_0xaac5('0x62')],'as':_0xaac5('0x6f'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x192059,null))['then'](function(_0x304245){var _0x415f39=_[_0xaac5('0x3b')](_0x304245,'id');var _0x3a55e4=[];var _0x5a4f2e=[];var _0xbcdf95=squel[_0xaac5('0x7b')]();_0xbcdf95[_0xaac5('0x7c')](_0xaac5('0x7d'))[_0xaac5('0x7e')](_0xaac5('0x7f'),'tq')[_0xaac5('0x80')](_0xaac5('0x81'),'ut',_0xaac5('0x82'))['where']('WhatsappQueueId\x20=\x20?',_0xd19ea0['params']['id']);for(var _0x1edfe8=0x0;_0x1edfe8<_0x304245[_0xaac5('0x50')];_0x1edfe8+=0x1){let _0x1ba6ed=_0x304245[_0x1edfe8];for(var _0x16aed6=0x0;_0x16aed6<_0x1ba6ed[_0xaac5('0x6f')][_0xaac5('0x50')];_0x16aed6+=0x1){let _0x47624b=_0x1ba6ed[_0xaac5('0x6f')][_0x16aed6];var _0x36f49a=_0xbcdf95[_0xaac5('0x83')]();_0x36f49a['where'](_0xaac5('0x84'),_0x47624b['id']);_0x5a4f2e[_0xaac5('0x85')](db[_0xaac5('0x72')]['query'](_0x36f49a[_0xaac5('0x86')](),{'type':db[_0xaac5('0x72')][_0xaac5('0x87')][_0xaac5('0x88')]})['then'](function(_0x42094f){if(_0x42094f['length']===0x1){return _0x47624b['id'];}else{var _0x381506=_[_0xaac5('0x89')](_[_0xaac5('0x3b')](_0x42094f,_0xaac5('0x8a')),function(_0x12ef65){return _[_0xaac5('0x8b')](_0x415f39,_0x12ef65);});if(_0x381506){return _0x47624b['id'];}}}));}}return BPromise['all'](_0x5a4f2e)[_0xaac5('0x2f')](function(_0x18a125){_0x3a55e4=_(_0x3a55e4)['union'](_0x18a125)[_0xaac5('0x8c')]()['value']();return db[_0xaac5('0x4c')][_0xaac5('0x52')]({'where':{'id':_0xd19ea0[_0xaac5('0x5b')]['id']}})[_0xaac5('0x2f')](function(_0x372d78){return db[_0xaac5('0x72')][_0xaac5('0x73')](function(_0xc3a64e){return _0x372d78[_0xaac5('0x79')](_0xd19ea0[_0xaac5('0x3d')]['ids'],{'transaction':_0xc3a64e})[_0xaac5('0x2f')](function(){if(!_[_0xaac5('0x8d')](_0x3a55e4)){return _0x372d78[_0xaac5('0x8e')](_0x3a55e4,{'transaction':_0xc3a64e});}})['then'](function(){_0x3a55e4[_0xaac5('0x76')](function(_0x40a8b5){socket['emit'](_0xaac5('0x8f'),{'UserId':_0x40a8b5,'WhatsappQueueId':_0x372d78['id']});});});});});});})[_0xaac5('0x2f')](respondWithStatusCode(_0x192059,null))[_0xaac5('0x4e')](handleError(_0x192059,null));};exports['addAgents']=function(_0x39050e,_0xa270df,_0x328fc0){return db[_0xaac5('0x4c')]['find']({'where':{'id':_0x39050e['params']['id']}})['then'](handleEntityNotFound(_0xa270df,null))[_0xaac5('0x2f')](function(_0x3a8407){if(_0x3a8407){return _0x3a8407[_0xaac5('0x90')](_0x39050e['body'][_0xaac5('0x7a')],_[_0xaac5('0x91')](_0x39050e[_0xaac5('0x54')],['ids','id'])||{})['spread'](function(_0x101522){for(var _0x17675d=0x0;_0x17675d<_0x39050e[_0xaac5('0x54')][_0xaac5('0x7a')][_0xaac5('0x50')];_0x17675d+=0x1){socket['emit']('userWhatsappQueue:save',{'UserId':Number(_0x39050e[_0xaac5('0x54')][_0xaac5('0x7a')][_0x17675d]),'WhatsappQueueId':Number(_0x39050e[_0xaac5('0x5b')]['id'])});}return _0x101522;});}})['then'](respondWithResult(_0xa270df,null))['catch'](handleError(_0xa270df,null));};exports[_0xaac5('0x8e')]=function(_0x1843a1,_0x59940a,_0x2ef1b7){return db[_0xaac5('0x4c')][_0xaac5('0x52')]({'where':{'id':_0x1843a1['params']['id']}})[_0xaac5('0x2f')](handleEntityNotFound(_0x59940a,null))[_0xaac5('0x2f')](function(_0x5db9df){if(_0x5db9df){return _0x5db9df[_0xaac5('0x8e')](_0x1843a1[_0xaac5('0x3d')][_0xaac5('0x7a')])['then'](function(){if(_[_0xaac5('0x92')](_0x1843a1[_0xaac5('0x3d')][_0xaac5('0x7a')])){for(var _0x4807e6=0x0;_0x4807e6<_0x1843a1[_0xaac5('0x3d')]['ids'][_0xaac5('0x50')];_0x4807e6+=0x1){socket[_0xaac5('0x77')](_0xaac5('0x8f'),{'UserId':Number(_0x1843a1[_0xaac5('0x3d')]['ids'][_0x4807e6]),'WhatsappQueueId':Number(_0x1843a1[_0xaac5('0x5b')]['id'])});}}else{socket[_0xaac5('0x77')](_0xaac5('0x8f'),{'UserId':Number(_0x1843a1['query'][_0xaac5('0x7a')]),'WhatsappQueueId':Number(_0x1843a1[_0xaac5('0x5b')]['id'])});}});}})['then'](respondWithStatusCode(_0x59940a,null))[_0xaac5('0x4e')](handleError(_0x59940a,null));};exports[_0xaac5('0x93')]=function(_0x383ef8,_0x1abba5,_0x2507fc){var _0x7b69d0={};var _0x1788c2={};var _0x2f8e9c;var _0x486a77;return db[_0xaac5('0x4c')][_0xaac5('0x5e')]({'where':{'id':_0x383ef8[_0xaac5('0x5b')]['id']}})[_0xaac5('0x2f')](handleEntityNotFound(_0x1abba5,null))[_0xaac5('0x2f')](function(_0x3ab2df){if(_0x3ab2df){_0x2f8e9c=_0x3ab2df;_0x1788c2[_0xaac5('0x3a')]=_['keys'](db[_0xaac5('0x62')]['rawAttributes']);_0x1788c2['query']=_[_0xaac5('0x3e')](_0x383ef8[_0xaac5('0x3d')]);_0x1788c2[_0xaac5('0x3f')]=_[_0xaac5('0x40')](_0x1788c2[_0xaac5('0x3a')],_0x1788c2[_0xaac5('0x3d')]);_0x7b69d0[_0xaac5('0x41')]=_['intersection'](_0x1788c2['model'],qs[_0xaac5('0x42')](_0x383ef8[_0xaac5('0x3d')]['fields']));_0x7b69d0[_0xaac5('0x41')]=_0x7b69d0[_0xaac5('0x41')][_0xaac5('0x50')]?_0x7b69d0[_0xaac5('0x41')]:_0x1788c2['model'];_0x7b69d0['order']=qs[_0xaac5('0x45')](_0x383ef8[_0xaac5('0x3d')][_0xaac5('0x45')]);_0x7b69d0['where']=qs[_0xaac5('0x3f')](_['pick'](_0x383ef8[_0xaac5('0x3d')],_0x1788c2['filters']));if(_0x383ef8[_0xaac5('0x3d')][_0xaac5('0x48')]){_0x7b69d0[_0xaac5('0x46')]=_[_0xaac5('0x49')](_0x7b69d0['where'],{'$or':_[_0xaac5('0x3b')](_0x7b69d0[_0xaac5('0x41')],function(_0x1e8c7b){var _0x3394dd={};_0x3394dd[_0x1e8c7b]={'$like':'%'+_0x383ef8[_0xaac5('0x3d')][_0xaac5('0x48')]+'%'};return _0x3394dd;})});}_0x7b69d0=_[_0xaac5('0x49')]({},_0x7b69d0,_0x383ef8['options']);return _0x2f8e9c['getAgents'](_0x7b69d0);}})['then'](function(_0x1e197a){if(_0x1e197a){_0x486a77=_0x1e197a[_0xaac5('0x50')];if(!_0x383ef8[_0xaac5('0x3d')][_0xaac5('0x5f')](_0xaac5('0x43'))){_0x7b69d0['limit']=qs[_0xaac5('0x28')](_0x383ef8[_0xaac5('0x3d')]['limit']);_0x7b69d0[_0xaac5('0x27')]=qs[_0xaac5('0x27')](_0x383ef8[_0xaac5('0x3d')][_0xaac5('0x27')]);}return _0x2f8e9c[_0xaac5('0x93')](_0x7b69d0);}})['then'](function(_0x140f09){if(_0x140f09){return _0x140f09?{'count':_0x486a77,'rows':_0x140f09}:null;}})[_0xaac5('0x2f')](respondWithResult(_0x1abba5,null))['catch'](handleError(_0x1abba5,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 65361d5..995213c 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 _0x8ca9=['save','update','emit','hasOwnProperty','hook','exports','events','WhatsappQueue','setMaxListeners'];(function(_0x49e428,_0x8af8eb){var _0x408143=function(_0x2d55ff){while(--_0x2d55ff){_0x49e428['push'](_0x49e428['shift']());}};_0x408143(++_0x8af8eb);}(_0x8ca9,0xf9));var _0x98ca=function(_0x49af49,_0xe06a4c){_0x49af49=_0x49af49-0x0;var _0x52da19=_0x8ca9[_0x49af49];return _0x52da19;};'use strict';var EventEmitter=require(_0x98ca('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x98ca('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x98ca('0x2')](0x0);var events={'afterCreate':_0x98ca('0x3'),'afterUpdate':_0x98ca('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2e22e2){return function(_0x850207,_0x537fdb,_0x52d266){WhatsappQueueEvents[_0x98ca('0x5')](_0x2e22e2+':'+_0x850207['id'],_0x850207);WhatsappQueueEvents[_0x98ca('0x5')](_0x2e22e2,_0x850207);_0x52d266(null);};}for(var e in events){if(events[_0x98ca('0x6')](e)){var event=events[e];WhatsappQueue[_0x98ca('0x7')](e,emitEvent(event));}}module[_0x98ca('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0xbfa0=['events','../../mysqldb','WhatsappQueue','save','update','emit','hasOwnProperty','exports'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xbfa0,0x100));var _0x0bfa=function(_0x6de5e4,_0x3a291b){_0x6de5e4=_0x6de5e4-0x0;var _0x28ec10=_0xbfa0[_0x6de5e4];return _0x28ec10;};'use strict';var EventEmitter=require(_0x0bfa('0x0'));var WhatsappQueue=require(_0x0bfa('0x1'))['db'][_0x0bfa('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0bfa('0x3'),'afterUpdate':_0x0bfa('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5377a3){return function(_0x465dc9,_0x151327,_0x1518ed){WhatsappQueueEvents[_0x0bfa('0x5')](_0x5377a3+':'+_0x465dc9['id'],_0x465dc9);WhatsappQueueEvents[_0x0bfa('0x5')](_0x5377a3,_0x465dc9);_0x1518ed(null);};}for(var e in events){if(events[_0x0bfa('0x6')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x0bfa('0x7')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index a510a9c..7d74883 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 _0xf270=['path','rimraf','./whatsappQueue.attributes','exports','define','WhatsappQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x53f27c,_0x5d3e6b){var _0x1f94f5=function(_0xcfc18a){while(--_0xcfc18a){_0x53f27c['push'](_0x53f27c['shift']());}};_0x1f94f5(++_0x5d3e6b);}(_0xf270,0x6e));var _0x0f27=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xf270[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x0f27('0x0'));var util=require(_0x0f27('0x1'));var logger=require(_0x0f27('0x2'))(_0x0f27('0x3'));var moment=require(_0x0f27('0x4'));var BPromise=require(_0x0f27('0x5'));var rp=require(_0x0f27('0x6'));var fs=require('fs');var path=require(_0x0f27('0x7'));var rimraf=require(_0x0f27('0x8'));var config=require('../../config/environment');var attributes=require(_0x0f27('0x9'));module[_0x0f27('0xa')]=function(_0x3ba4b,_0x3372bf){return _0x3ba4b[_0x0f27('0xb')](_0x0f27('0xc'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5643=['./whatsappQueue.attributes','exports','whatsapp_queues','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5c5536,_0x27744b){var _0x187c74=function(_0x18fe39){while(--_0x18fe39){_0x5c5536['push'](_0x5c5536['shift']());}};_0x187c74(++_0x27744b);}(_0x5643,0xdf));var _0x3564=function(_0x2cfe37,_0x45b688){_0x2cfe37=_0x2cfe37-0x0;var _0x3f34d7=_0x5643[_0x2cfe37];return _0x3f34d7;};'use strict';var _=require(_0x3564('0x0'));var util=require('util');var logger=require(_0x3564('0x1'))(_0x3564('0x2'));var moment=require('moment');var BPromise=require(_0x3564('0x3'));var rp=require(_0x3564('0x4'));var fs=require('fs');var path=require(_0x3564('0x5'));var rimraf=require(_0x3564('0x6'));var config=require(_0x3564('0x7'));var attributes=require(_0x3564('0x8'));module[_0x3564('0x9')]=function(_0x172d58,_0x24de98){return _0x172d58['define']('WhatsappQueue',attributes,{'tableName':_0x3564('0xa'),'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 60bd64a..5aa47ac 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 _0x3500=['localhost','./whatsappQueue.socket','register','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','model','map','info','ShowWhatsappQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','defaults','redis'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3500,0x18d));var _0x0350=function(_0x4a9a0c,_0x120b8a){_0x4a9a0c=_0x4a9a0c-0x0;var _0x316d25=_0x3500[_0x4a9a0c];return _0x316d25;};'use strict';var _=require(_0x0350('0x0'));var util=require(_0x0350('0x1'));var moment=require(_0x0350('0x2'));var BPromise=require(_0x0350('0x3'));var rs=require(_0x0350('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0350('0x5'))['db'];var utils=require(_0x0350('0x6'));var logger=require('../../config/logger')(_0x0350('0x7'));var config=require(_0x0350('0x8'));var jayson=require(_0x0350('0x9'));var client=jayson[_0x0350('0xa')]['http']({'port':0x232a});config['redis']=_[_0x0350('0xb')](config[_0x0350('0xc')],{'host':_0x0350('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0350('0xc')]));require(_0x0350('0xe'))[_0x0350('0xf')](socket);function respondWithRpcPromise(_0x5201e0,_0x19ecd6,_0x10dd67){return new BPromise(function(_0x25f893,_0x409b4b){return client['request'](_0x5201e0,_0x10dd67)[_0x0350('0x10')](function(_0xab1a12){logger['info'](_0x0350('0x11'),_0x19ecd6,_0x0350('0x12'));logger[_0x0350('0x13')](_0x0350('0x14'),_0x19ecd6,_0x0350('0x12'),JSON[_0x0350('0x15')](_0xab1a12));if(_0xab1a12['error']){if(_0xab1a12[_0x0350('0x16')][_0x0350('0x17')]===0x1f4){logger[_0x0350('0x16')](_0x0350('0x11'),_0x19ecd6,_0xab1a12[_0x0350('0x16')]['message']);return _0x409b4b(_0xab1a12[_0x0350('0x16')][_0x0350('0x18')]);}logger[_0x0350('0x16')](_0x0350('0x11'),_0x19ecd6,_0xab1a12['error']['message']);return _0x25f893(_0xab1a12[_0x0350('0x16')][_0x0350('0x18')]);}else{logger['info'](_0x0350('0x11'),_0x19ecd6,_0x0350('0x12'));_0x25f893(_0xab1a12[_0x0350('0x19')]['message']);}})[_0x0350('0x1a')](function(_0x1cd4ea){logger[_0x0350('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x19ecd6,_0x1cd4ea);_0x409b4b(_0x1cd4ea);});});}exports[_0x0350('0x1b')]=function(_0x357141){var _0x3b8d95=this;return new Promise(function(_0x32422e,_0x40eedb){return db[_0x0350('0x1c')][_0x0350('0x1d')]({'raw':_0x357141['options']?_0x357141[_0x0350('0x1e')][_0x0350('0x1f')]===undefined?!![]:![]:!![],'where':_0x357141[_0x0350('0x1e')]?_0x357141[_0x0350('0x1e')][_0x0350('0x20')]||null:null,'attributes':_0x357141[_0x0350('0x1e')]?_0x357141['options'][_0x0350('0x21')]||null:null,'limit':_0x357141[_0x0350('0x1e')]?_0x357141[_0x0350('0x1e')][_0x0350('0x22')]||null:null,'include':_0x357141[_0x0350('0x1e')]?_0x357141[_0x0350('0x1e')][_0x0350('0x23')]?_['map'](_0x357141[_0x0350('0x1e')]['include'],function(_0x20de79){return{'model':db[_0x20de79[_0x0350('0x24')]],'as':_0x20de79['as'],'attributes':_0x20de79[_0x0350('0x21')],'include':_0x20de79[_0x0350('0x23')]?_[_0x0350('0x25')](_0x20de79['include'],function(_0x5c1de9){return{'model':db[_0x5c1de9[_0x0350('0x24')]],'as':_0x5c1de9['as'],'attributes':_0x5c1de9['attributes'],'include':_0x5c1de9[_0x0350('0x23')]?_[_0x0350('0x25')](_0x5c1de9[_0x0350('0x23')],function(_0x309b2c){return{'model':db[_0x309b2c[_0x0350('0x24')]],'as':_0x309b2c['as'],'attributes':_0x309b2c[_0x0350('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0350('0x10')](function(_0x475052){logger[_0x0350('0x26')]('GetWhatsappQueue',_0x357141);logger[_0x0350('0x13')]('GetWhatsappQueue',_0x357141,JSON[_0x0350('0x15')](_0x475052));_0x32422e(_0x475052);})[_0x0350('0x1a')](function(_0x1433bb){logger['error']('GetWhatsappQueue',_0x1433bb['message'],_0x357141);_0x40eedb(_0x3b8d95[_0x0350('0x16')](0x1f4,_0x1433bb[_0x0350('0x18')]));});});};exports[_0x0350('0x27')]=function(_0x5566da){var _0x40d598=this;return new Promise(function(_0x5cddd9,_0x374476){return db['WhatsappQueue'][_0x0350('0x28')]({'raw':_0x5566da[_0x0350('0x1e')]?_0x5566da[_0x0350('0x1e')][_0x0350('0x1f')]===undefined?!![]:![]:!![],'where':_0x5566da[_0x0350('0x1e')]?_0x5566da[_0x0350('0x1e')][_0x0350('0x20')]||null:null,'attributes':_0x5566da[_0x0350('0x1e')]?_0x5566da[_0x0350('0x1e')][_0x0350('0x21')]||null:null,'include':_0x5566da[_0x0350('0x1e')]?_0x5566da['options']['include']?_['map'](_0x5566da['options'][_0x0350('0x23')],function(_0x28b3e1){return{'model':db[_0x28b3e1[_0x0350('0x24')]],'as':_0x28b3e1['as'],'attributes':_0x28b3e1[_0x0350('0x21')],'include':_0x28b3e1[_0x0350('0x23')]?_['map'](_0x28b3e1[_0x0350('0x23')],function(_0x33d93e){return{'model':db[_0x33d93e[_0x0350('0x24')]],'as':_0x33d93e['as'],'attributes':_0x33d93e['attributes'],'include':_0x33d93e['include']?_['map'](_0x33d93e[_0x0350('0x23')],function(_0x90e708){return{'model':db[_0x90e708[_0x0350('0x24')]],'as':_0x90e708['as'],'attributes':_0x90e708['attributes']};}):[]};}):[]};}):[]:[]})[_0x0350('0x10')](function(_0x2fb04f){logger[_0x0350('0x26')](_0x0350('0x27'),_0x5566da);logger['debug'](_0x0350('0x27'),_0x5566da,JSON['stringify'](_0x2fb04f));_0x5cddd9(_0x2fb04f);})[_0x0350('0x1a')](function(_0xe96d15){logger[_0x0350('0x16')](_0x0350('0x27'),_0xe96d15[_0x0350('0x18')],_0x5566da);_0x374476(_0x40d598['error'](0x1f4,_0xe96d15['message']));});});}; \ No newline at end of file +var _0x58b8=['then','stringify','catch','WhatsappQueue','find','ShowWhatsappQueue','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappQueue.socket','request','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','GetWhatsappQueue','options','raw','where','attributes','limit','include','map','model'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x58b8,0x96));var _0x858b=function(_0x5678b5,_0x1c4aa8){_0x5678b5=_0x5678b5-0x0;var _0x4c09a5=_0x58b8[_0x5678b5];return _0x4c09a5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x858b('0x0'));var BPromise=require(_0x858b('0x1'));var rs=require(_0x858b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x858b('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x858b('0x4'));var config=require('../../config/environment');var jayson=require(_0x858b('0x5'));var client=jayson[_0x858b('0x6')][_0x858b('0x7')]({'port':0x232a});config[_0x858b('0x8')]=_['defaults'](config[_0x858b('0x8')],{'host':_0x858b('0x9'),'port':0x18eb});var socket=require(_0x858b('0xa'))(new Redis(config['redis']));require(_0x858b('0xb'))['register'](socket);function respondWithRpcPromise(_0x1f8054,_0x367da3,_0x286513){return new BPromise(function(_0x1245ec,_0x44d225){return client[_0x858b('0xc')](_0x1f8054,_0x286513)['then'](function(_0x3d0089){logger['info'](_0x858b('0xd'),_0x367da3,_0x858b('0xe'));logger[_0x858b('0xf')](_0x858b('0x10'),_0x367da3,_0x858b('0xe'),JSON['stringify'](_0x3d0089));if(_0x3d0089[_0x858b('0x11')]){if(_0x3d0089[_0x858b('0x11')][_0x858b('0x12')]===0x1f4){logger[_0x858b('0x11')](_0x858b('0xd'),_0x367da3,_0x3d0089['error'][_0x858b('0x13')]);return _0x44d225(_0x3d0089[_0x858b('0x11')][_0x858b('0x13')]);}logger['error'](_0x858b('0xd'),_0x367da3,_0x3d0089['error']['message']);return _0x1245ec(_0x3d0089[_0x858b('0x11')][_0x858b('0x13')]);}else{logger[_0x858b('0x14')](_0x858b('0xd'),_0x367da3,_0x858b('0xe'));_0x1245ec(_0x3d0089['result']['message']);}})['catch'](function(_0x3946c7){logger[_0x858b('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x367da3,_0x3946c7);_0x44d225(_0x3946c7);});});}exports[_0x858b('0x15')]=function(_0x1c05c0){var _0x123528=this;return new Promise(function(_0x2354a1,_0xb4537f){return db['WhatsappQueue']['findAll']({'raw':_0x1c05c0[_0x858b('0x16')]?_0x1c05c0[_0x858b('0x16')][_0x858b('0x17')]===undefined?!![]:![]:!![],'where':_0x1c05c0[_0x858b('0x16')]?_0x1c05c0[_0x858b('0x16')][_0x858b('0x18')]||null:null,'attributes':_0x1c05c0[_0x858b('0x16')]?_0x1c05c0[_0x858b('0x16')][_0x858b('0x19')]||null:null,'limit':_0x1c05c0[_0x858b('0x16')]?_0x1c05c0[_0x858b('0x16')][_0x858b('0x1a')]||null:null,'include':_0x1c05c0[_0x858b('0x16')]?_0x1c05c0['options'][_0x858b('0x1b')]?_[_0x858b('0x1c')](_0x1c05c0[_0x858b('0x16')][_0x858b('0x1b')],function(_0x37da30){return{'model':db[_0x37da30[_0x858b('0x1d')]],'as':_0x37da30['as'],'attributes':_0x37da30[_0x858b('0x19')],'include':_0x37da30[_0x858b('0x1b')]?_[_0x858b('0x1c')](_0x37da30[_0x858b('0x1b')],function(_0x4d429f){return{'model':db[_0x4d429f[_0x858b('0x1d')]],'as':_0x4d429f['as'],'attributes':_0x4d429f['attributes'],'include':_0x4d429f[_0x858b('0x1b')]?_[_0x858b('0x1c')](_0x4d429f['include'],function(_0x5ebbe7){return{'model':db[_0x5ebbe7[_0x858b('0x1d')]],'as':_0x5ebbe7['as'],'attributes':_0x5ebbe7[_0x858b('0x19')]};}):[]};}):[]};}):[]:[]})[_0x858b('0x1e')](function(_0x5b8085){logger[_0x858b('0x14')](_0x858b('0x15'),_0x1c05c0);logger[_0x858b('0xf')](_0x858b('0x15'),_0x1c05c0,JSON[_0x858b('0x1f')](_0x5b8085));_0x2354a1(_0x5b8085);})[_0x858b('0x20')](function(_0x5dbaa1){logger[_0x858b('0x11')](_0x858b('0x15'),_0x5dbaa1['message'],_0x1c05c0);_0xb4537f(_0x123528['error'](0x1f4,_0x5dbaa1[_0x858b('0x13')]));});});};exports['ShowWhatsappQueue']=function(_0x2e4bb3){var _0x1d6c34=this;return new Promise(function(_0x3576e2,_0x4f810c){return db[_0x858b('0x21')][_0x858b('0x22')]({'raw':_0x2e4bb3[_0x858b('0x16')]?_0x2e4bb3[_0x858b('0x16')][_0x858b('0x17')]===undefined?!![]:![]:!![],'where':_0x2e4bb3[_0x858b('0x16')]?_0x2e4bb3[_0x858b('0x16')][_0x858b('0x18')]||null:null,'attributes':_0x2e4bb3[_0x858b('0x16')]?_0x2e4bb3['options'][_0x858b('0x19')]||null:null,'include':_0x2e4bb3[_0x858b('0x16')]?_0x2e4bb3['options']['include']?_[_0x858b('0x1c')](_0x2e4bb3['options'][_0x858b('0x1b')],function(_0x3dd899){return{'model':db[_0x3dd899[_0x858b('0x1d')]],'as':_0x3dd899['as'],'attributes':_0x3dd899[_0x858b('0x19')],'include':_0x3dd899[_0x858b('0x1b')]?_[_0x858b('0x1c')](_0x3dd899[_0x858b('0x1b')],function(_0x48c3b2){return{'model':db[_0x48c3b2[_0x858b('0x1d')]],'as':_0x48c3b2['as'],'attributes':_0x48c3b2[_0x858b('0x19')],'include':_0x48c3b2[_0x858b('0x1b')]?_['map'](_0x48c3b2[_0x858b('0x1b')],function(_0x589d89){return{'model':db[_0x589d89[_0x858b('0x1d')]],'as':_0x589d89['as'],'attributes':_0x589d89['attributes']};}):[]};}):[]};}):[]:[]})[_0x858b('0x1e')](function(_0x2842ef){logger[_0x858b('0x14')](_0x858b('0x23'),_0x2e4bb3);logger['debug'](_0x858b('0x23'),_0x2e4bb3,JSON[_0x858b('0x1f')](_0x2842ef));_0x3576e2(_0x2842ef);})[_0x858b('0x20')](function(_0x129659){logger[_0x858b('0x11')](_0x858b('0x23'),_0x129659[_0x858b('0x13')],_0x2e4bb3);_0x4f810c(_0x1d6c34[_0x858b('0x11')](0x1f4,_0x129659[_0x858b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 924bd48..4255d70 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 _0x8d45=['register','whatsappQueue:','./whatsappQueue.events','save','remove','update','removeListener'];(function(_0x371e5f,_0x208744){var _0x578953=function(_0x3abdc8){while(--_0x3abdc8){_0x371e5f['push'](_0x371e5f['shift']());}};_0x578953(++_0x208744);}(_0x8d45,0x1d7));var _0x58d4=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x8d45[_0x1facfa];return _0x9ec701;};'use strict';var WhatsappQueueEvents=require(_0x58d4('0x0'));var events=[_0x58d4('0x1'),_0x58d4('0x2'),_0x58d4('0x3')];function createListener(_0x4363a3,_0x3604a1){return function(_0xa9f438){_0x3604a1['emit'](_0x4363a3,_0xa9f438);};}function removeListener(_0x3224b7,_0x9867b3){return function(){WhatsappQueueEvents[_0x58d4('0x4')](_0x3224b7,_0x9867b3);};}exports[_0x58d4('0x5')]=function(_0x577f83){for(var _0x30d3f1=0x0,_0x1e966b=events['length'];_0x30d3f1<_0x1e966b;_0x30d3f1++){var _0x319403=events[_0x30d3f1];var _0x1624c5=createListener(_0x58d4('0x6')+_0x319403,_0x577f83);WhatsappQueueEvents['on'](_0x319403,_0x1624c5);}}; \ No newline at end of file +var _0x66ed=['update','register','length','save'];(function(_0x1d7292,_0x4825e9){var _0x158de2=function(_0x58b1a1){while(--_0x58b1a1){_0x1d7292['push'](_0x1d7292['shift']());}};_0x158de2(++_0x4825e9);}(_0x66ed,0x193));var _0xd66e=function(_0x191dc5,_0xde60e6){_0x191dc5=_0x191dc5-0x0;var _0x4bdd8b=_0x66ed[_0x191dc5];return _0x4bdd8b;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0xd66e('0x0'),'remove',_0xd66e('0x1')];function createListener(_0x115c27,_0xa87661){return function(_0x21b3db){_0xa87661['emit'](_0x115c27,_0x21b3db);};}function removeListener(_0x461e4a,_0x39dbb7){return function(){WhatsappQueueEvents['removeListener'](_0x461e4a,_0x39dbb7);};}exports[_0xd66e('0x2')]=function(_0xa07f3d){for(var _0x4085cc=0x0,_0x576b63=events[_0xd66e('0x3')];_0x4085cc<_0x576b63;_0x4085cc++){var _0xc527c0=events[_0x4085cc];var _0xce9232=createListener('whatsappQueue:'+_0xc527c0,_0xa07f3d);WhatsappQueueEvents['on'](_0xc527c0,_0xce9232);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 944dfac..d46743b 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 _0x9819=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','post','create','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9819,0x13e));var _0x9981=function(_0x58e35e,_0x42715e){_0x58e35e=_0x58e35e-0x0;var _0x36b3b2=_0x9819[_0x58e35e];return _0x36b3b2;};'use strict';var multer=require('multer');var util=require(_0x9981('0x0'));var path=require('path');var timeout=require(_0x9981('0x1'));var express=require(_0x9981('0x2'));var router=express[_0x9981('0x3')]();var fs_extra=require(_0x9981('0x4'));var auth=require(_0x9981('0x5'));var interaction=require(_0x9981('0x6'));var config=require(_0x9981('0x7'));var controller=require('./whatsappQueueReport.controller');router[_0x9981('0x8')]('/',auth[_0x9981('0x9')](),controller['index']);router['get']('/describe',auth[_0x9981('0x9')](),controller[_0x9981('0xa')]);router[_0x9981('0x8')](_0x9981('0xb'),auth[_0x9981('0x9')](),controller[_0x9981('0xc')]);router[_0x9981('0xd')]('/',auth['isAuthenticated'](),controller[_0x9981('0xe')]);router['put'](_0x9981('0xb'),auth['isAuthenticated'](),controller[_0x9981('0xf')]);router[_0x9981('0x10')](_0x9981('0xb'),auth['isAuthenticated'](),controller[_0x9981('0x11')]);module[_0x9981('0x12')]=router; \ No newline at end of file +var _0xc7bf=['fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','index','get','/describe','/:id','show','post','create','update','delete','destroy','exports','path','connect-timeout','express'];(function(_0x157c81,_0x2c0224){var _0x1bfb12=function(_0x4b5c5b){while(--_0x4b5c5b){_0x157c81['push'](_0x157c81['shift']());}};_0x1bfb12(++_0x2c0224);}(_0xc7bf,0x6f));var _0xfc7b=function(_0xa46364,_0x14b946){_0xa46364=_0xa46364-0x0;var _0x3a650e=_0xc7bf[_0xa46364];return _0x3a650e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfc7b('0x0'));var timeout=require(_0xfc7b('0x1'));var express=require(_0xfc7b('0x2'));var router=express['Router']();var fs_extra=require(_0xfc7b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xfc7b('0x4'));var config=require(_0xfc7b('0x5'));var controller=require(_0xfc7b('0x6'));router['get']('/',auth[_0xfc7b('0x7')](),controller[_0xfc7b('0x8')]);router[_0xfc7b('0x9')](_0xfc7b('0xa'),auth[_0xfc7b('0x7')](),controller['describe']);router[_0xfc7b('0x9')](_0xfc7b('0xb'),auth[_0xfc7b('0x7')](),controller[_0xfc7b('0xc')]);router[_0xfc7b('0xd')]('/',auth['isAuthenticated'](),controller[_0xfc7b('0xe')]);router['put'](_0xfc7b('0xb'),auth[_0xfc7b('0x7')](),controller[_0xfc7b('0xf')]);router[_0xfc7b('0x10')](_0xfc7b('0xb'),auth[_0xfc7b('0x7')](),controller[_0xfc7b('0x11')]);module[_0xfc7b('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index c091574..926cae1 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x50621f,_0x56845c){var _0x1d2b1d=function(_0x4f6c51){while(--_0x4f6c51){_0x50621f['push'](_0x50621f['shift']());}};_0x1d2b1d(++_0x56845c);}(_0x7a54,0x106));var _0x47a5=function(_0x530a71,_0x22b30e){_0x530a71=_0x530a71-0x0;var _0x1f054e=_0x7a54[_0x530a71];return _0x1f054e;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x1423d6,_0x194b92){var _0x4fad31=function(_0x2f42e7){while(--_0x2f42e7){_0x1423d6['push'](_0x1423d6['shift']());}};_0x4fad31(++_0x194b92);}(_0x7a54,0x106));var _0x47a5=function(_0x422d92,_0x4b7b4d){_0x422d92=_0x422d92-0x0;var _0x36745a=_0x7a54[_0x422d92];return _0x36745a;};'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 2493da0..b89ec6d 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 _0xac4a=['where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','keys','rawAttributes','includeAll','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','WhatsappQueueReport','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x20ffae,_0x557b68){var _0x2af088=function(_0x21d8aa){while(--_0x21d8aa){_0x20ffae['push'](_0x20ffae['shift']());}};_0x2af088(++_0x557b68);}(_0xac4a,0x13f));var _0xaac4=function(_0x494a96,_0x23ff31){_0x494a96=_0x494a96-0x0;var _0x1ab19a=_0xac4a[_0x494a96];return _0x1ab19a;};'use strict';var emlformat=require(_0xaac4('0x0'));var rimraf=require(_0xaac4('0x1'));var zipdir=require(_0xaac4('0x2'));var jsonpatch=require(_0xaac4('0x3'));var rp=require(_0xaac4('0x4'));var moment=require(_0xaac4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaac4('0x6'));var path=require(_0xaac4('0x7'));var sox=require(_0xaac4('0x8'));var csv=require('to-csv');var ejs=require(_0xaac4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaac4('0xa'));var squel=require('squel');var crypto=require(_0xaac4('0xb'));var jsforce=require(_0xaac4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaac4('0xd'));var Papa=require('papaparse');var Redis=require(_0xaac4('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaac4('0xf'));var hardwareService=require(_0xaac4('0x10'));var logger=require(_0xaac4('0x11'))(_0xaac4('0x12'));var utils=require(_0xaac4('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaac4('0x14'))['db'];function respondWithStatusCode(_0x2e2d02,_0x45e512){_0x45e512=_0x45e512||0xcc;return function(_0x5a4801){if(_0x5a4801){return _0x2e2d02[_0xaac4('0x15')](_0x45e512);}return _0x2e2d02[_0xaac4('0x16')](_0x45e512)['end']();};}function respondWithResult(_0xf06b1d,_0x2b20d0){_0x2b20d0=_0x2b20d0||0xc8;return function(_0x46698d){if(_0x46698d){return _0xf06b1d[_0xaac4('0x16')](_0x2b20d0)[_0xaac4('0x17')](_0x46698d);}};}function respondWithFilteredResult(_0x2fbeb7,_0x31b7e5){return function(_0x1df9ae){if(_0x1df9ae){var _0x233278=typeof _0x31b7e5[_0xaac4('0x18')]===_0xaac4('0x19')&&typeof _0x31b7e5[_0xaac4('0x1a')]===_0xaac4('0x19');var _0x52686a=_0x1df9ae[_0xaac4('0x1b')];var _0x52085a=_0x233278?0x0:_0x31b7e5[_0xaac4('0x18')];var _0x5b6fd6=_0x233278?_0x1df9ae[_0xaac4('0x1b')]:_0x31b7e5[_0xaac4('0x18')]+_0x31b7e5[_0xaac4('0x1a')];var _0x271bcb;if(_0x5b6fd6>=_0x52686a){_0x5b6fd6=_0x52686a;_0x271bcb=0xc8;}else{_0x271bcb=0xce;}_0x2fbeb7[_0xaac4('0x16')](_0x271bcb);return _0x2fbeb7[_0xaac4('0x1c')](_0xaac4('0x1d'),_0x52085a+'-'+_0x5b6fd6+'/'+_0x52686a)[_0xaac4('0x17')](_0x1df9ae);}return null;};}function patchUpdates(_0x4166ee){return function(_0x480fb0){try{jsonpatch[_0xaac4('0x1e')](_0x480fb0,_0x4166ee,!![]);}catch(_0x4e1e89){return BPromise[_0xaac4('0x1f')](_0x4e1e89);}return _0x480fb0[_0xaac4('0x20')]();};}function saveUpdates(_0x43625c,_0x477b77){return function(_0x17140f){if(_0x17140f){return _0x17140f[_0xaac4('0x21')](_0x43625c)['then'](function(_0x43ccdc){return _0x43ccdc;});}return null;};}function removeEntity(_0x27a84d,_0x174860){return function(_0x4f10ec){if(_0x4f10ec){return _0x4f10ec[_0xaac4('0x22')]()[_0xaac4('0x23')](function(){_0x27a84d[_0xaac4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24186b,_0x4f1b65){return function(_0x54203b){if(!_0x54203b){_0x24186b['sendStatus'](0x194);}return _0x54203b;};}function handleError(_0x5a0bb3,_0x22d5a6){_0x22d5a6=_0x22d5a6||0x1f4;return function(_0x17d25f){logger[_0xaac4('0x24')](_0x17d25f[_0xaac4('0x25')]);if(_0x17d25f[_0xaac4('0x26')]){delete _0x17d25f[_0xaac4('0x26')];}_0x5a0bb3[_0xaac4('0x16')](_0x22d5a6)[_0xaac4('0x27')](_0x17d25f);};}exports[_0xaac4('0x28')]=function(_0x386c9b,_0x4d0f5f){var _0x316445={},_0x16b33c={},_0xda10b6={'count':0x0,'rows':[]};var _0xb76ccc=_[_0xaac4('0x29')](db[_0xaac4('0x2a')]['rawAttributes'],function(_0xcf6c1){return{'name':_0xcf6c1['fieldName'],'type':_0xcf6c1[_0xaac4('0x2b')][_0xaac4('0x2c')]};});_0x16b33c[_0xaac4('0x2d')]=_[_0xaac4('0x29')](_0xb76ccc,'name');_0x16b33c['query']=_['keys'](_0x386c9b[_0xaac4('0x2e')]);_0x16b33c[_0xaac4('0x2f')]=_[_0xaac4('0x30')](_0x16b33c[_0xaac4('0x2d')],_0x16b33c[_0xaac4('0x2e')]);_0x316445[_0xaac4('0x31')]=_[_0xaac4('0x30')](_0x16b33c[_0xaac4('0x2d')],qs[_0xaac4('0x32')](_0x386c9b[_0xaac4('0x2e')][_0xaac4('0x32')]));_0x316445[_0xaac4('0x31')]=_0x316445[_0xaac4('0x31')][_0xaac4('0x33')]?_0x316445[_0xaac4('0x31')]:_0x16b33c['model'];if(!_0x386c9b['query'][_0xaac4('0x34')](_0xaac4('0x35'))){_0x316445[_0xaac4('0x1a')]=qs['limit'](_0x386c9b[_0xaac4('0x2e')][_0xaac4('0x1a')]);_0x316445[_0xaac4('0x18')]=qs[_0xaac4('0x18')](_0x386c9b[_0xaac4('0x2e')][_0xaac4('0x18')]);}_0x316445[_0xaac4('0x36')]=qs['sort'](_0x386c9b[_0xaac4('0x2e')][_0xaac4('0x37')]);_0x316445[_0xaac4('0x38')]=qs['filters'](_[_0xaac4('0x39')](_0x386c9b['query'],_0x16b33c['filters']),_0xb76ccc);if(_0x386c9b[_0xaac4('0x2e')][_0xaac4('0x3a')]){_0x316445[_0xaac4('0x38')]=_['merge'](_0x316445['where'],{'$or':_[_0xaac4('0x29')](_0xb76ccc,function(_0x33cc4){if(_0x33cc4[_0xaac4('0x2b')]!==_0xaac4('0x3b')){var _0x2b65b1={};_0x2b65b1[_0x33cc4[_0xaac4('0x26')]]={'$like':'%'+_0x386c9b['query']['filter']+'%'};return _0x2b65b1;}})});}_0x316445=_[_0xaac4('0x3c')]({},_0x316445,_0x386c9b[_0xaac4('0x3d')]);var _0x5371b4={'where':_0x316445[_0xaac4('0x38')]};return db[_0xaac4('0x2a')][_0xaac4('0x1b')](_0x5371b4)['then'](function(_0x74a1c){_0xda10b6[_0xaac4('0x1b')]=_0x74a1c;if(_0x386c9b[_0xaac4('0x2e')]['includeAll']){_0x316445[_0xaac4('0x3e')]=[{'all':!![]}];}return db[_0xaac4('0x2a')][_0xaac4('0x3f')](_0x316445);})[_0xaac4('0x23')](function(_0x51e59d){_0xda10b6[_0xaac4('0x40')]=_0x51e59d;return _0xda10b6;})['then'](respondWithFilteredResult(_0x4d0f5f,_0x316445))['catch'](handleError(_0x4d0f5f,null));};exports[_0xaac4('0x41')]=function(_0x31e240,_0x27df36){var _0x40c007={'raw':!![],'where':{'id':_0x31e240[_0xaac4('0x42')]['id']}},_0x43bc12={};_0x43bc12[_0xaac4('0x2d')]=_[_0xaac4('0x43')](db['WhatsappQueueReport'][_0xaac4('0x44')]);_0x43bc12[_0xaac4('0x2e')]=_[_0xaac4('0x43')](_0x31e240[_0xaac4('0x2e')]);_0x43bc12['filters']=_[_0xaac4('0x30')](_0x43bc12[_0xaac4('0x2d')],_0x43bc12[_0xaac4('0x2e')]);_0x40c007['attributes']=_[_0xaac4('0x30')](_0x43bc12[_0xaac4('0x2d')],qs[_0xaac4('0x32')](_0x31e240[_0xaac4('0x2e')]['fields']));_0x40c007[_0xaac4('0x31')]=_0x40c007[_0xaac4('0x31')][_0xaac4('0x33')]?_0x40c007['attributes']:_0x43bc12[_0xaac4('0x2d')];if(_0x31e240[_0xaac4('0x2e')][_0xaac4('0x45')]){_0x40c007[_0xaac4('0x3e')]=[{'all':!![]}];}_0x40c007=_[_0xaac4('0x3c')]({},_0x40c007,_0x31e240[_0xaac4('0x3d')]);return db[_0xaac4('0x2a')][_0xaac4('0x46')](_0x40c007)[_0xaac4('0x23')](handleEntityNotFound(_0x27df36,null))['then'](respondWithResult(_0x27df36,null))[_0xaac4('0x47')](handleError(_0x27df36,null));};exports[_0xaac4('0x48')]=function(_0x27425a,_0x360420){return db[_0xaac4('0x2a')]['create'](_0x27425a['body'],{})[_0xaac4('0x23')](respondWithResult(_0x360420,0xc9))[_0xaac4('0x47')](handleError(_0x360420,null));};exports[_0xaac4('0x21')]=function(_0x16c7f4,_0x5f33ea){if(_0x16c7f4[_0xaac4('0x49')]['id']){delete _0x16c7f4['body']['id'];}return db[_0xaac4('0x2a')][_0xaac4('0x46')]({'where':{'id':_0x16c7f4['params']['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x5f33ea,null))[_0xaac4('0x23')](saveUpdates(_0x16c7f4[_0xaac4('0x49')],null))['then'](respondWithResult(_0x5f33ea,null))['catch'](handleError(_0x5f33ea,null));};exports[_0xaac4('0x22')]=function(_0x2c1751,_0x22dda7){return db[_0xaac4('0x2a')][_0xaac4('0x46')]({'where':{'id':_0x2c1751[_0xaac4('0x42')]['id']}})['then'](handleEntityNotFound(_0x22dda7,null))[_0xaac4('0x23')](removeEntity(_0x22dda7,null))[_0xaac4('0x47')](handleError(_0x22dda7,null));};exports[_0xaac4('0x4a')]=function(_0x38f9af,_0x56201b){return db[_0xaac4('0x2a')]['describe']()[_0xaac4('0x23')](respondWithResult(_0x56201b,null))[_0xaac4('0x47')](handleError(_0x56201b,null));}; \ No newline at end of file +var _0x351d=['includeAll','include','catch','show','params','rawAttributes','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','end','status','json','limit','count','offset','apply','reject','save','update','destroy','then','name','send','map','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','WhatsappQueueReport'];(function(_0x904abe,_0xf49e31){var _0xe48a47=function(_0x16d927){while(--_0x16d927){_0x904abe['push'](_0x904abe['shift']());}};_0xe48a47(++_0xf49e31);}(_0x351d,0x90));var _0xd351=function(_0x5cfd4c,_0x5c2c9e){_0x5cfd4c=_0x5cfd4c-0x0;var _0x22bcde=_0x351d[_0x5cfd4c];return _0x22bcde;};'use strict';var emlformat=require(_0xd351('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd351('0x1'));var jsonpatch=require(_0xd351('0x2'));var rp=require(_0xd351('0x3'));var moment=require('moment');var BPromise=require(_0xd351('0x4'));var Mustache=require('mustache');var util=require(_0xd351('0x5'));var path=require(_0xd351('0x6'));var sox=require('sox');var csv=require(_0xd351('0x7'));var ejs=require(_0xd351('0x8'));var fs=require('fs');var fs_extra=require(_0xd351('0x9'));var _=require('lodash');var squel=require(_0xd351('0xa'));var crypto=require(_0xd351('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd351('0xc'));var toCsv=require(_0xd351('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd351('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd351('0xe'));var as=require(_0xd351('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd351('0x10'))(_0xd351('0x11'));var utils=require('../../config/utils');var config=require(_0xd351('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3eb40c,_0x15549a){_0x15549a=_0x15549a||0xcc;return function(_0x23445f){if(_0x23445f){return _0x3eb40c[_0xd351('0x13')](_0x15549a);}return _0x3eb40c['status'](_0x15549a)[_0xd351('0x14')]();};}function respondWithResult(_0x316cf6,_0x597d7c){_0x597d7c=_0x597d7c||0xc8;return function(_0xc5a145){if(_0xc5a145){return _0x316cf6[_0xd351('0x15')](_0x597d7c)[_0xd351('0x16')](_0xc5a145);}};}function respondWithFilteredResult(_0xf1c285,_0x3867fb){return function(_0x4d238c){if(_0x4d238c){var _0x9f790f=typeof _0x3867fb['offset']==='undefined'&&typeof _0x3867fb[_0xd351('0x17')]==='undefined';var _0x21e591=_0x4d238c[_0xd351('0x18')];var _0x4e0164=_0x9f790f?0x0:_0x3867fb['offset'];var _0x1e1a3c=_0x9f790f?_0x4d238c[_0xd351('0x18')]:_0x3867fb[_0xd351('0x19')]+_0x3867fb[_0xd351('0x17')];var _0x51f265;if(_0x1e1a3c>=_0x21e591){_0x1e1a3c=_0x21e591;_0x51f265=0xc8;}else{_0x51f265=0xce;}_0xf1c285[_0xd351('0x15')](_0x51f265);return _0xf1c285['set']('Content-Range',_0x4e0164+'-'+_0x1e1a3c+'/'+_0x21e591)[_0xd351('0x16')](_0x4d238c);}return null;};}function patchUpdates(_0x4a427b){return function(_0x33b1e5){try{jsonpatch[_0xd351('0x1a')](_0x33b1e5,_0x4a427b,!![]);}catch(_0x3634c9){return BPromise[_0xd351('0x1b')](_0x3634c9);}return _0x33b1e5[_0xd351('0x1c')]();};}function saveUpdates(_0x53e729,_0x18625b){return function(_0xbbc58){if(_0xbbc58){return _0xbbc58[_0xd351('0x1d')](_0x53e729)['then'](function(_0x1ce7f7){return _0x1ce7f7;});}return null;};}function removeEntity(_0x2d9aa0,_0x365bbc){return function(_0x59fb6d){if(_0x59fb6d){return _0x59fb6d[_0xd351('0x1e')]()[_0xd351('0x1f')](function(){_0x2d9aa0[_0xd351('0x15')](0xcc)[_0xd351('0x14')]();});}};}function handleEntityNotFound(_0x489c9a,_0x40f7f3){return function(_0x483c92){if(!_0x483c92){_0x489c9a[_0xd351('0x13')](0x194);}return _0x483c92;};}function handleError(_0x8ad0a6,_0x54f471){_0x54f471=_0x54f471||0x1f4;return function(_0x2648d0){logger['error'](_0x2648d0['stack']);if(_0x2648d0[_0xd351('0x20')]){delete _0x2648d0['name'];}_0x8ad0a6['status'](_0x54f471)[_0xd351('0x21')](_0x2648d0);};}exports['index']=function(_0x38471c,_0x2ddae8){var _0x407b50={},_0x4d3f48={},_0x71ce9c={'count':0x0,'rows':[]};var _0x4aa902=_[_0xd351('0x22')](db['WhatsappQueueReport']['rawAttributes'],function(_0xeb4da9){return{'name':_0xeb4da9[_0xd351('0x23')],'type':_0xeb4da9[_0xd351('0x24')][_0xd351('0x25')]};});_0x4d3f48['model']=_[_0xd351('0x22')](_0x4aa902,_0xd351('0x20'));_0x4d3f48[_0xd351('0x26')]=_[_0xd351('0x27')](_0x38471c[_0xd351('0x26')]);_0x4d3f48[_0xd351('0x28')]=_[_0xd351('0x29')](_0x4d3f48[_0xd351('0x2a')],_0x4d3f48[_0xd351('0x26')]);_0x407b50['attributes']=_[_0xd351('0x29')](_0x4d3f48[_0xd351('0x2a')],qs[_0xd351('0x2b')](_0x38471c[_0xd351('0x26')]['fields']));_0x407b50[_0xd351('0x2c')]=_0x407b50[_0xd351('0x2c')][_0xd351('0x2d')]?_0x407b50[_0xd351('0x2c')]:_0x4d3f48[_0xd351('0x2a')];if(!_0x38471c[_0xd351('0x26')][_0xd351('0x2e')](_0xd351('0x2f'))){_0x407b50[_0xd351('0x17')]=qs['limit'](_0x38471c['query'][_0xd351('0x17')]);_0x407b50[_0xd351('0x19')]=qs[_0xd351('0x19')](_0x38471c[_0xd351('0x26')][_0xd351('0x19')]);}_0x407b50[_0xd351('0x30')]=qs['sort'](_0x38471c['query'][_0xd351('0x31')]);_0x407b50['where']=qs[_0xd351('0x28')](_[_0xd351('0x32')](_0x38471c[_0xd351('0x26')],_0x4d3f48[_0xd351('0x28')]),_0x4aa902);if(_0x38471c[_0xd351('0x26')][_0xd351('0x33')]){_0x407b50[_0xd351('0x34')]=_[_0xd351('0x35')](_0x407b50[_0xd351('0x34')],{'$or':_[_0xd351('0x22')](_0x4aa902,function(_0x2b7170){if(_0x2b7170['type']!==_0xd351('0x36')){var _0x5f0b1c={};_0x5f0b1c[_0x2b7170[_0xd351('0x20')]]={'$like':'%'+_0x38471c[_0xd351('0x26')][_0xd351('0x33')]+'%'};return _0x5f0b1c;}})});}_0x407b50=_[_0xd351('0x35')]({},_0x407b50,_0x38471c[_0xd351('0x37')]);var _0x3db72a={'where':_0x407b50['where']};return db[_0xd351('0x38')][_0xd351('0x18')](_0x3db72a)['then'](function(_0x2e1219){_0x71ce9c[_0xd351('0x18')]=_0x2e1219;if(_0x38471c[_0xd351('0x26')][_0xd351('0x39')]){_0x407b50[_0xd351('0x3a')]=[{'all':!![]}];}return db['WhatsappQueueReport']['findAll'](_0x407b50);})[_0xd351('0x1f')](function(_0x3935aa){_0x71ce9c['rows']=_0x3935aa;return _0x71ce9c;})['then'](respondWithFilteredResult(_0x2ddae8,_0x407b50))[_0xd351('0x3b')](handleError(_0x2ddae8,null));};exports[_0xd351('0x3c')]=function(_0x4ff06a,_0x570d57){var _0x46af23={'raw':!![],'where':{'id':_0x4ff06a[_0xd351('0x3d')]['id']}},_0x18f9d1={};_0x18f9d1[_0xd351('0x2a')]=_[_0xd351('0x27')](db[_0xd351('0x38')][_0xd351('0x3e')]);_0x18f9d1[_0xd351('0x26')]=_[_0xd351('0x27')](_0x4ff06a['query']);_0x18f9d1['filters']=_[_0xd351('0x29')](_0x18f9d1[_0xd351('0x2a')],_0x18f9d1[_0xd351('0x26')]);_0x46af23[_0xd351('0x2c')]=_[_0xd351('0x29')](_0x18f9d1[_0xd351('0x2a')],qs[_0xd351('0x2b')](_0x4ff06a[_0xd351('0x26')][_0xd351('0x2b')]));_0x46af23[_0xd351('0x2c')]=_0x46af23[_0xd351('0x2c')][_0xd351('0x2d')]?_0x46af23[_0xd351('0x2c')]:_0x18f9d1[_0xd351('0x2a')];if(_0x4ff06a[_0xd351('0x26')][_0xd351('0x39')]){_0x46af23['include']=[{'all':!![]}];}_0x46af23=_[_0xd351('0x35')]({},_0x46af23,_0x4ff06a[_0xd351('0x37')]);return db[_0xd351('0x38')]['find'](_0x46af23)[_0xd351('0x1f')](handleEntityNotFound(_0x570d57,null))[_0xd351('0x1f')](respondWithResult(_0x570d57,null))[_0xd351('0x3b')](handleError(_0x570d57,null));};exports[_0xd351('0x3f')]=function(_0xbb92d4,_0x5bc86a){return db[_0xd351('0x38')]['create'](_0xbb92d4[_0xd351('0x40')],{})[_0xd351('0x1f')](respondWithResult(_0x5bc86a,0xc9))['catch'](handleError(_0x5bc86a,null));};exports['update']=function(_0x1bd727,_0x444206){if(_0x1bd727[_0xd351('0x40')]['id']){delete _0x1bd727['body']['id'];}return db[_0xd351('0x38')][_0xd351('0x41')]({'where':{'id':_0x1bd727['params']['id']}})[_0xd351('0x1f')](handleEntityNotFound(_0x444206,null))['then'](saveUpdates(_0x1bd727[_0xd351('0x40')],null))[_0xd351('0x1f')](respondWithResult(_0x444206,null))['catch'](handleError(_0x444206,null));};exports['destroy']=function(_0x25ea1e,_0x58ce5a){return db[_0xd351('0x38')][_0xd351('0x41')]({'where':{'id':_0x25ea1e[_0xd351('0x3d')]['id']}})['then'](handleEntityNotFound(_0x58ce5a,null))[_0xd351('0x1f')](removeEntity(_0x58ce5a,null))['catch'](handleError(_0x58ce5a,null));};exports['describe']=function(_0x48c287,_0x7e4bad){return db[_0xd351('0x38')][_0xd351('0x42')]()['then'](respondWithResult(_0x7e4bad,null))['catch'](handleError(_0x7e4bad,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 44fff7d..a5e802b 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 _0xa85f=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid'];(function(_0x2a8c42,_0x501718){var _0x6494e9=function(_0x2f2f3a){while(--_0x2f2f3a){_0x2a8c42['push'](_0x2a8c42['shift']());}};_0x6494e9(++_0x501718);}(_0xa85f,0x188));var _0xfa85=function(_0xfcde96,_0x3ce18c){_0xfcde96=_0xfcde96-0x0;var _0x39fd1e=_0xa85f[_0xfcde96];return _0x39fd1e;};'use strict';var _=require(_0xfa85('0x0'));var util=require(_0xfa85('0x1'));var logger=require(_0xfa85('0x2'))('api');var moment=require(_0xfa85('0x3'));var BPromise=require(_0xfa85('0x4'));var rp=require(_0xfa85('0x5'));var fs=require('fs');var path=require(_0xfa85('0x6'));var rimraf=require('rimraf');var config=require(_0xfa85('0x7'));var attributes=require(_0xfa85('0x8'));module[_0xfa85('0x9')]=function(_0x3b6071,_0x1130e0){return _0x3b6071[_0xfa85('0xa')](_0xfa85('0xb'),attributes,{'tableName':_0xfa85('0xc'),'paranoid':![],'indexes':[{'name':_0xfa85('0xd'),'fields':[_0xfa85('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6900=['uniqueid','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','WhatsappQueueReport','report_whatsapp_queue'];(function(_0x41127f,_0x26a42b){var _0x24b3fa=function(_0x17cba1){while(--_0x17cba1){_0x41127f['push'](_0x41127f['shift']());}};_0x24b3fa(++_0x26a42b);}(_0x6900,0xf3));var _0x0690=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x6900[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0x0690('0x0'));var util=require(_0x0690('0x1'));var logger=require('../../config/logger')(_0x0690('0x2'));var moment=require('moment');var BPromise=require(_0x0690('0x3'));var rp=require(_0x0690('0x4'));var fs=require('fs');var path=require(_0x0690('0x5'));var rimraf=require(_0x0690('0x6'));var config=require(_0x0690('0x7'));var attributes=require('./whatsappQueueReport.attributes');module['exports']=function(_0x3069c0,_0x245018){return _0x3069c0['define'](_0x0690('0x8'),attributes,{'tableName':_0x0690('0x9'),'paranoid':![],'indexes':[{'name':_0x0690('0xa'),'fields':[_0x0690('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index feaf6ba..af0b7fe 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 _0x1617=['then','info','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappQueueReport,\x20%s,\x20%s','message','result','WhatsappQueueReport','create','body','options','raw','CreateWhatsappQueueReport','catch','UpdateWhatsappQueueReport','update','limit','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x30a582,_0x4bed3e){var _0x353c6a=function(_0x567ac2){while(--_0x567ac2){_0x30a582['push'](_0x30a582['shift']());}};_0x353c6a(++_0x4bed3e);}(_0x1617,0xa5));var _0x7161=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0x1617[_0x172747];return _0x509692;};'use strict';var _=require('lodash');var util=require(_0x7161('0x0'));var moment=require('moment');var BPromise=require(_0x7161('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7161('0x2'));var db=require(_0x7161('0x3'))['db'];var utils=require(_0x7161('0x4'));var logger=require(_0x7161('0x5'))(_0x7161('0x6'));var config=require(_0x7161('0x7'));var jayson=require(_0x7161('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x24f962,_0x1b668,_0xe7a2d3){return new BPromise(function(_0x77e26,_0x258435){return client['request'](_0x24f962,_0xe7a2d3)[_0x7161('0x9')](function(_0xca1f15){logger[_0x7161('0xa')]('WhatsappQueueReport,\x20%s,\x20%s',_0x1b668,_0x7161('0xb'));logger[_0x7161('0xc')](_0x7161('0xd'),_0x1b668,_0x7161('0xb'),JSON[_0x7161('0xe')](_0xca1f15));if(_0xca1f15[_0x7161('0xf')]){if(_0xca1f15['error']['code']===0x1f4){logger[_0x7161('0xf')](_0x7161('0x10'),_0x1b668,_0xca1f15['error'][_0x7161('0x11')]);return _0x258435(_0xca1f15[_0x7161('0xf')][_0x7161('0x11')]);}logger[_0x7161('0xf')](_0x7161('0x10'),_0x1b668,_0xca1f15[_0x7161('0xf')][_0x7161('0x11')]);return _0x77e26(_0xca1f15[_0x7161('0xf')]['message']);}else{logger[_0x7161('0xa')](_0x7161('0x10'),_0x1b668,_0x7161('0xb'));_0x77e26(_0xca1f15[_0x7161('0x12')][_0x7161('0x11')]);}})['catch'](function(_0x35c2bb){logger[_0x7161('0xf')](_0x7161('0x10'),_0x1b668,_0x35c2bb);_0x258435(_0x35c2bb);});});}exports['CreateWhatsappQueueReport']=function(_0x5c10b6){var _0x56f6fd=this;return new Promise(function(_0x5cfd9c,_0x57fba7){return db[_0x7161('0x13')][_0x7161('0x14')](_0x5c10b6[_0x7161('0x15')],{'raw':_0x5c10b6[_0x7161('0x16')]?_0x5c10b6[_0x7161('0x16')][_0x7161('0x17')]===undefined?!![]:![]:!![]})[_0x7161('0x9')](function(_0x25500f){logger['info']('CreateWhatsappQueueReport',_0x5c10b6);logger[_0x7161('0xc')](_0x7161('0x18'),_0x5c10b6,JSON['stringify'](_0x25500f));_0x5cfd9c(_0x25500f);})[_0x7161('0x19')](function(_0x15a3a8){logger[_0x7161('0xf')](_0x7161('0x18'),_0x15a3a8[_0x7161('0x11')],_0x5c10b6);_0x57fba7(_0x56f6fd[_0x7161('0xf')](0x1f4,_0x15a3a8[_0x7161('0x11')]));});});};exports[_0x7161('0x1a')]=function(_0x98e3c8){var _0x3ccebb=this;return new Promise(function(_0x301d34,_0x17c0fa){return db[_0x7161('0x13')][_0x7161('0x1b')](_0x98e3c8[_0x7161('0x15')],{'raw':_0x98e3c8[_0x7161('0x16')]?_0x98e3c8[_0x7161('0x16')][_0x7161('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x98e3c8[_0x7161('0x16')]?_0x98e3c8[_0x7161('0x16')]['where']||null:null,'attributes':_0x98e3c8[_0x7161('0x16')]?_0x98e3c8[_0x7161('0x16')]['attributes']||null:null,'limit':_0x98e3c8['options']?_0x98e3c8[_0x7161('0x16')][_0x7161('0x1c')]||null:null})['then'](function(_0x398ef3){logger['info'](_0x7161('0x1a'),_0x98e3c8);logger[_0x7161('0xc')](_0x7161('0x1a'),_0x98e3c8,JSON[_0x7161('0xe')](_0x398ef3));_0x301d34(_0x398ef3);})[_0x7161('0x19')](function(_0x133830){logger[_0x7161('0xf')]('UpdateWhatsappQueueReport',_0x133830[_0x7161('0x11')],_0x98e3c8);_0x17c0fa(_0x3ccebb[_0x7161('0xf')](0x1f4,_0x133830[_0x7161('0x11')]));});});}; \ No newline at end of file +var _0x607a=['then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','catch','update','limit','UpdateWhatsappQueueReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x1fb284,_0x35d52a){var _0x3b6f77=function(_0x472123){while(--_0x472123){_0x1fb284['push'](_0x1fb284['shift']());}};_0x3b6f77(++_0x35d52a);}(_0x607a,0x97));var _0xa607=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x607a[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xa607('0x0'));var util=require(_0xa607('0x1'));var moment=require(_0xa607('0x2'));var BPromise=require(_0xa607('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa607('0x4'));var db=require(_0xa607('0x5'))['db'];var utils=require(_0xa607('0x6'));var logger=require(_0xa607('0x7'))(_0xa607('0x8'));var config=require(_0xa607('0x9'));var jayson=require(_0xa607('0xa'));var client=jayson[_0xa607('0xb')][_0xa607('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x231445,_0xa1b260,_0x3676ce){return new BPromise(function(_0x4f2d1a,_0x188a7c){return client[_0xa607('0xd')](_0x231445,_0x3676ce)[_0xa607('0xe')](function(_0x532dfa){logger[_0xa607('0xf')](_0xa607('0x10'),_0xa1b260,_0xa607('0x11'));logger[_0xa607('0x12')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0xa1b260,_0xa607('0x11'),JSON[_0xa607('0x13')](_0x532dfa));if(_0x532dfa[_0xa607('0x14')]){if(_0x532dfa[_0xa607('0x14')][_0xa607('0x15')]===0x1f4){logger[_0xa607('0x14')]('WhatsappQueueReport,\x20%s,\x20%s',_0xa1b260,_0x532dfa[_0xa607('0x14')][_0xa607('0x16')]);return _0x188a7c(_0x532dfa['error']['message']);}logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0xa1b260,_0x532dfa[_0xa607('0x14')][_0xa607('0x16')]);return _0x4f2d1a(_0x532dfa[_0xa607('0x14')][_0xa607('0x16')]);}else{logger[_0xa607('0xf')](_0xa607('0x10'),_0xa1b260,_0xa607('0x11'));_0x4f2d1a(_0x532dfa[_0xa607('0x17')][_0xa607('0x16')]);}})['catch'](function(_0x26d628){logger['error'](_0xa607('0x10'),_0xa1b260,_0x26d628);_0x188a7c(_0x26d628);});});}exports[_0xa607('0x18')]=function(_0x10d050){var _0x1f25df=this;return new Promise(function(_0x4ac346,_0x134257){return db[_0xa607('0x19')][_0xa607('0x1a')](_0x10d050[_0xa607('0x1b')],{'raw':_0x10d050[_0xa607('0x1c')]?_0x10d050[_0xa607('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5f25f9){logger[_0xa607('0xf')](_0xa607('0x18'),_0x10d050);logger['debug'](_0xa607('0x18'),_0x10d050,JSON[_0xa607('0x13')](_0x5f25f9));_0x4ac346(_0x5f25f9);})[_0xa607('0x1d')](function(_0x3db381){logger['error']('CreateWhatsappQueueReport',_0x3db381['message'],_0x10d050);_0x134257(_0x1f25df[_0xa607('0x14')](0x1f4,_0x3db381['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0x59998c){var _0x22d56f=this;return new Promise(function(_0x296913,_0x232a21){return db['WhatsappQueueReport'][_0xa607('0x1e')](_0x59998c[_0xa607('0x1b')],{'raw':_0x59998c[_0xa607('0x1c')]?_0x59998c[_0xa607('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59998c[_0xa607('0x1c')]?_0x59998c[_0xa607('0x1c')]['where']||null:null,'attributes':_0x59998c['options']?_0x59998c['options']['attributes']||null:null,'limit':_0x59998c[_0xa607('0x1c')]?_0x59998c[_0xa607('0x1c')][_0xa607('0x1f')]||null:null})[_0xa607('0xe')](function(_0x56ad5c){logger[_0xa607('0xf')](_0xa607('0x20'),_0x59998c);logger[_0xa607('0x12')](_0xa607('0x20'),_0x59998c,JSON[_0xa607('0x13')](_0x56ad5c));_0x296913(_0x56ad5c);})['catch'](function(_0x56f417){logger[_0xa607('0x14')]('UpdateWhatsappQueueReport',_0x56f417[_0xa607('0x16')],_0x59998c);_0x232a21(_0x22d56f[_0xa607('0x14')](0x1f4,_0x56f417[_0xa607('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 6d0f877..eea92a7 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 _0xc2bd=['/:id','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe'];(function(_0x2d289e,_0x1005d9){var _0xe3785a=function(_0x433037){while(--_0x433037){_0x2d289e['push'](_0x2d289e['shift']());}};_0xe3785a(++_0x1005d9);}(_0xc2bd,0x15d));var _0xdc2b=function(_0x3fe988,_0x149b45){_0x3fe988=_0x3fe988-0x0;var _0x62ef22=_0xc2bd[_0x3fe988];return _0x62ef22;};'use strict';var multer=require(_0xdc2b('0x0'));var util=require(_0xdc2b('0x1'));var path=require('path');var timeout=require(_0xdc2b('0x2'));var express=require(_0xdc2b('0x3'));var router=express[_0xdc2b('0x4')]();var fs_extra=require(_0xdc2b('0x5'));var auth=require(_0xdc2b('0x6'));var interaction=require(_0xdc2b('0x7'));var config=require('../../config/environment');var controller=require('./whatsappTransferReport.controller');router[_0xdc2b('0x8')]('/',auth[_0xdc2b('0x9')](),controller[_0xdc2b('0xa')]);router[_0xdc2b('0x8')](_0xdc2b('0xb'),auth[_0xdc2b('0x9')](),controller['describe']);router[_0xdc2b('0x8')](_0xdc2b('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xdc2b('0xd')]('/',auth['isAuthenticated'](),controller[_0xdc2b('0xe')]);router[_0xdc2b('0xf')](_0xdc2b('0xc'),auth[_0xdc2b('0x9')](),controller[_0xdc2b('0x10')]);router['delete'](_0xdc2b('0xc'),auth[_0xdc2b('0x9')](),controller[_0xdc2b('0x11')]);module[_0xdc2b('0x12')]=router; \ No newline at end of file +var _0x0db0=['../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x53431e,_0x2c50dd){var _0x23fe55=function(_0x1edb61){while(--_0x1edb61){_0x53431e['push'](_0x53431e['shift']());}};_0x23fe55(++_0x2c50dd);}(_0x0db0,0x1c8));var _0x00db=function(_0x388eea,_0x340518){_0x388eea=_0x388eea-0x0;var _0x4a175b=_0x0db0[_0x388eea];return _0x4a175b;};'use strict';var multer=require(_0x00db('0x0'));var util=require(_0x00db('0x1'));var path=require(_0x00db('0x2'));var timeout=require(_0x00db('0x3'));var express=require(_0x00db('0x4'));var router=express[_0x00db('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x00db('0x6'));var interaction=require(_0x00db('0x7'));var config=require('../../config/environment');var controller=require(_0x00db('0x8'));router[_0x00db('0x9')]('/',auth[_0x00db('0xa')](),controller[_0x00db('0xb')]);router[_0x00db('0x9')](_0x00db('0xc'),auth[_0x00db('0xa')](),controller[_0x00db('0xd')]);router['get']('/:id',auth[_0x00db('0xa')](),controller['show']);router[_0x00db('0xe')]('/',auth[_0x00db('0xa')](),controller[_0x00db('0xf')]);router[_0x00db('0x10')](_0x00db('0x11'),auth[_0x00db('0xa')](),controller[_0x00db('0x12')]);router[_0x00db('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x00db('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 4e1fbe7..8c074d2 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 _0x3cd0=['agent','queue','DATE','sequelize','ENUM'];(function(_0x6bc441,_0x4e9239){var _0x57514f=function(_0xb88b8e){while(--_0xb88b8e){_0x6bc441['push'](_0x6bc441['shift']());}};_0x57514f(++_0x4e9239);}(_0x3cd0,0x8a));var _0x03cd=function(_0x31dde9,_0x12e816){_0x31dde9=_0x31dde9-0x0;var _0x1fbf2d=_0x3cd0[_0x31dde9];return _0x1fbf2d;};'use strict';var Sequelize=require(_0x03cd('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x03cd('0x1')]('account',_0x03cd('0x2'),_0x03cd('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x03cd('0x4')]}}; \ No newline at end of file +var _0x3f72=['DATE','sequelize','exports','STRING','agent','queue'];(function(_0x5db99b,_0xdee23a){var _0x4b2d0e=function(_0x4deee1){while(--_0x4deee1){_0x5db99b['push'](_0x5db99b['shift']());}};_0x4b2d0e(++_0xdee23a);}(_0x3f72,0xaf));var _0x23f7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3f72[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x23f7('0x0'));module[_0x23f7('0x1')]={'uniqueid':{'type':Sequelize[_0x23f7('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0x23f7('0x3'),_0x23f7('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x23f7('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 668ff49..0b2c652 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 _0x5700=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','options','includeAll','include','WhatsappTransferReport','findAll','rows','catch','keys','rawAttributes','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','save','update','then','destroy','stack','name','index','map','fieldName','type','key','model','query'];(function(_0x315062,_0x3b97d7){var _0x1bea22=function(_0x3ceccb){while(--_0x3ceccb){_0x315062['push'](_0x315062['shift']());}};_0x1bea22(++_0x3b97d7);}(_0x5700,0x12d));var _0x0570=function(_0x5ebe0f,_0x1292af){_0x5ebe0f=_0x5ebe0f-0x0;var _0x2fef04=_0x5700[_0x5ebe0f];return _0x2fef04;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0570('0x0'));var zipdir=require(_0x0570('0x1'));var jsonpatch=require(_0x0570('0x2'));var rp=require(_0x0570('0x3'));var moment=require(_0x0570('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0570('0x5'));var util=require(_0x0570('0x6'));var path=require(_0x0570('0x7'));var sox=require(_0x0570('0x8'));var csv=require('to-csv');var ejs=require(_0x0570('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0570('0xa'));var crypto=require(_0x0570('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0570('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0570('0xd'));var Papa=require(_0x0570('0xe'));var Redis=require(_0x0570('0xf'));var authService=require(_0x0570('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0570('0x11'));var hardwareService=require(_0x0570('0x12'));var logger=require(_0x0570('0x13'))('api');var utils=require(_0x0570('0x14'));var config=require(_0x0570('0x15'));var licenseUtil=require(_0x0570('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x554b63,_0x354a2c){_0x354a2c=_0x354a2c||0xcc;return function(_0x18412d){if(_0x18412d){return _0x554b63[_0x0570('0x17')](_0x354a2c);}return _0x554b63[_0x0570('0x18')](_0x354a2c)[_0x0570('0x19')]();};}function respondWithResult(_0x338ea5,_0x205027){_0x205027=_0x205027||0xc8;return function(_0x472cb0){if(_0x472cb0){return _0x338ea5[_0x0570('0x18')](_0x205027)[_0x0570('0x1a')](_0x472cb0);}};}function respondWithFilteredResult(_0x55cd48,_0x43efe1){return function(_0x462474){if(_0x462474){var _0x2d39b3=typeof _0x43efe1[_0x0570('0x1b')]===_0x0570('0x1c')&&typeof _0x43efe1['limit']===_0x0570('0x1c');var _0x5707c6=_0x462474['count'];var _0x13a9c4=_0x2d39b3?0x0:_0x43efe1[_0x0570('0x1b')];var _0x24851c=_0x2d39b3?_0x462474[_0x0570('0x1d')]:_0x43efe1[_0x0570('0x1b')]+_0x43efe1[_0x0570('0x1e')];var _0x1ac364;if(_0x24851c>=_0x5707c6){_0x24851c=_0x5707c6;_0x1ac364=0xc8;}else{_0x1ac364=0xce;}_0x55cd48['status'](_0x1ac364);return _0x55cd48['set']('Content-Range',_0x13a9c4+'-'+_0x24851c+'/'+_0x5707c6)[_0x0570('0x1a')](_0x462474);}return null;};}function patchUpdates(_0x10f222){return function(_0x409806){try{jsonpatch['apply'](_0x409806,_0x10f222,!![]);}catch(_0x4d9cc0){return BPromise['reject'](_0x4d9cc0);}return _0x409806[_0x0570('0x1f')]();};}function saveUpdates(_0x3b102a,_0x486b37){return function(_0x408b21){if(_0x408b21){return _0x408b21[_0x0570('0x20')](_0x3b102a)[_0x0570('0x21')](function(_0x72e904){return _0x72e904;});}return null;};}function removeEntity(_0x56b7e0,_0xf44762){return function(_0x5de013){if(_0x5de013){return _0x5de013[_0x0570('0x22')]()['then'](function(){_0x56b7e0[_0x0570('0x18')](0xcc)[_0x0570('0x19')]();});}};}function handleEntityNotFound(_0x2ce860,_0x4af6d4){return function(_0x3732d4){if(!_0x3732d4){_0x2ce860['sendStatus'](0x194);}return _0x3732d4;};}function handleError(_0x1da589,_0xf65df0){_0xf65df0=_0xf65df0||0x1f4;return function(_0x4b952f){logger['error'](_0x4b952f[_0x0570('0x23')]);if(_0x4b952f[_0x0570('0x24')]){delete _0x4b952f[_0x0570('0x24')];}_0x1da589[_0x0570('0x18')](_0xf65df0)['send'](_0x4b952f);};}exports[_0x0570('0x25')]=function(_0x5e5da7,_0x4be2c6){var _0x1e6426={},_0x55697e={},_0x53fed8={'count':0x0,'rows':[]};var _0x232fbc=_[_0x0570('0x26')](db['WhatsappTransferReport']['rawAttributes'],function(_0x3016b3){return{'name':_0x3016b3[_0x0570('0x27')],'type':_0x3016b3[_0x0570('0x28')][_0x0570('0x29')]};});_0x55697e[_0x0570('0x2a')]=_[_0x0570('0x26')](_0x232fbc,_0x0570('0x24'));_0x55697e['query']=_['keys'](_0x5e5da7[_0x0570('0x2b')]);_0x55697e[_0x0570('0x2c')]=_[_0x0570('0x2d')](_0x55697e['model'],_0x55697e[_0x0570('0x2b')]);_0x1e6426[_0x0570('0x2e')]=_[_0x0570('0x2d')](_0x55697e[_0x0570('0x2a')],qs['fields'](_0x5e5da7[_0x0570('0x2b')][_0x0570('0x2f')]));_0x1e6426[_0x0570('0x2e')]=_0x1e6426[_0x0570('0x2e')][_0x0570('0x30')]?_0x1e6426[_0x0570('0x2e')]:_0x55697e[_0x0570('0x2a')];if(!_0x5e5da7[_0x0570('0x2b')][_0x0570('0x31')](_0x0570('0x32'))){_0x1e6426[_0x0570('0x1e')]=qs[_0x0570('0x1e')](_0x5e5da7[_0x0570('0x2b')][_0x0570('0x1e')]);_0x1e6426[_0x0570('0x1b')]=qs[_0x0570('0x1b')](_0x5e5da7['query'][_0x0570('0x1b')]);}_0x1e6426[_0x0570('0x33')]=qs['sort'](_0x5e5da7['query']['sort']);_0x1e6426[_0x0570('0x34')]=qs[_0x0570('0x2c')](_[_0x0570('0x35')](_0x5e5da7[_0x0570('0x2b')],_0x55697e['filters']),_0x232fbc);if(_0x5e5da7['query']['filter']){_0x1e6426[_0x0570('0x34')]=_[_0x0570('0x36')](_0x1e6426[_0x0570('0x34')],{'$or':_[_0x0570('0x26')](_0x232fbc,function(_0x4aaa11){if(_0x4aaa11['type']!=='VIRTUAL'){var _0x4b7b9b={};_0x4b7b9b[_0x4aaa11[_0x0570('0x24')]]={'$like':'%'+_0x5e5da7['query']['filter']+'%'};return _0x4b7b9b;}})});}_0x1e6426=_[_0x0570('0x36')]({},_0x1e6426,_0x5e5da7[_0x0570('0x37')]);var _0x24b4c9={'where':_0x1e6426[_0x0570('0x34')]};return db['WhatsappTransferReport'][_0x0570('0x1d')](_0x24b4c9)[_0x0570('0x21')](function(_0x15f3c9){_0x53fed8[_0x0570('0x1d')]=_0x15f3c9;if(_0x5e5da7[_0x0570('0x2b')][_0x0570('0x38')]){_0x1e6426[_0x0570('0x39')]=[{'all':!![]}];}return db[_0x0570('0x3a')][_0x0570('0x3b')](_0x1e6426);})[_0x0570('0x21')](function(_0x525ebc){_0x53fed8[_0x0570('0x3c')]=_0x525ebc;return _0x53fed8;})[_0x0570('0x21')](respondWithFilteredResult(_0x4be2c6,_0x1e6426))[_0x0570('0x3d')](handleError(_0x4be2c6,null));};exports['show']=function(_0x4f67db,_0x8e7c14){var _0x2d02c0={'raw':!![],'where':{'id':_0x4f67db['params']['id']}},_0x443683={};_0x443683[_0x0570('0x2a')]=_[_0x0570('0x3e')](db['WhatsappTransferReport'][_0x0570('0x3f')]);_0x443683['query']=_[_0x0570('0x3e')](_0x4f67db[_0x0570('0x2b')]);_0x443683[_0x0570('0x2c')]=_[_0x0570('0x2d')](_0x443683[_0x0570('0x2a')],_0x443683[_0x0570('0x2b')]);_0x2d02c0[_0x0570('0x2e')]=_[_0x0570('0x2d')](_0x443683[_0x0570('0x2a')],qs[_0x0570('0x2f')](_0x4f67db[_0x0570('0x2b')][_0x0570('0x2f')]));_0x2d02c0[_0x0570('0x2e')]=_0x2d02c0[_0x0570('0x2e')][_0x0570('0x30')]?_0x2d02c0[_0x0570('0x2e')]:_0x443683[_0x0570('0x2a')];if(_0x4f67db[_0x0570('0x2b')][_0x0570('0x38')]){_0x2d02c0[_0x0570('0x39')]=[{'all':!![]}];}_0x2d02c0=_[_0x0570('0x36')]({},_0x2d02c0,_0x4f67db[_0x0570('0x37')]);return db['WhatsappTransferReport'][_0x0570('0x40')](_0x2d02c0)[_0x0570('0x21')](handleEntityNotFound(_0x8e7c14,null))[_0x0570('0x21')](respondWithResult(_0x8e7c14,null))[_0x0570('0x3d')](handleError(_0x8e7c14,null));};exports['create']=function(_0x1859e4,_0x328fc7){return db[_0x0570('0x3a')][_0x0570('0x41')](_0x1859e4[_0x0570('0x42')],{})[_0x0570('0x21')](respondWithResult(_0x328fc7,0xc9))[_0x0570('0x3d')](handleError(_0x328fc7,null));};exports[_0x0570('0x20')]=function(_0x618b56,_0x365af8){if(_0x618b56[_0x0570('0x42')]['id']){delete _0x618b56['body']['id'];}return db[_0x0570('0x3a')][_0x0570('0x40')]({'where':{'id':_0x618b56[_0x0570('0x43')]['id']}})[_0x0570('0x21')](handleEntityNotFound(_0x365af8,null))['then'](saveUpdates(_0x618b56[_0x0570('0x42')],null))[_0x0570('0x21')](respondWithResult(_0x365af8,null))[_0x0570('0x3d')](handleError(_0x365af8,null));};exports[_0x0570('0x22')]=function(_0x222ad7,_0x1eac8e){return db['WhatsappTransferReport'][_0x0570('0x40')]({'where':{'id':_0x222ad7[_0x0570('0x43')]['id']}})[_0x0570('0x21')](handleEntityNotFound(_0x1eac8e,null))[_0x0570('0x21')](removeEntity(_0x1eac8e,null))['catch'](handleError(_0x1eac8e,null));};exports['describe']=function(_0x3ccae2,_0x484775){return db[_0x0570('0x3a')][_0x0570('0x44')]()['then'](respondWithResult(_0x484775,null))[_0x0570('0x3d')](handleError(_0x484775,null));}; \ No newline at end of file +var _0x02a4=['fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','update','destroy','end','error','name','index','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','filter','merge','map','options','then','include','findAll','rows','catch','params','includeAll','find','create','body','describe','eml-format'];(function(_0xde83e2,_0x5efe1e){var _0x9f73ad=function(_0x1e4f41){while(--_0x1e4f41){_0xde83e2['push'](_0xde83e2['shift']());}};_0x9f73ad(++_0x5efe1e);}(_0x02a4,0x19d));var _0x402a=function(_0xe389a7,_0x42e97d){_0xe389a7=_0xe389a7-0x0;var _0x19894e=_0x02a4[_0xe389a7];return _0x19894e;};'use strict';var emlformat=require(_0x402a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x402a('0x1'));var rp=require(_0x402a('0x2'));var moment=require(_0x402a('0x3'));var BPromise=require(_0x402a('0x4'));var Mustache=require(_0x402a('0x5'));var util=require('util');var path=require(_0x402a('0x6'));var sox=require(_0x402a('0x7'));var csv=require(_0x402a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x402a('0x9'));var _=require(_0x402a('0xa'));var squel=require(_0x402a('0xb'));var crypto=require('crypto');var jsforce=require(_0x402a('0xc'));var deskjs=require(_0x402a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x402a('0xe'));var Papa=require(_0x402a('0xf'));var Redis=require(_0x402a('0x10'));var authService=require(_0x402a('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x402a('0x12'))(_0x402a('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x402a('0x14'));var db=require(_0x402a('0x15'))['db'];function respondWithStatusCode(_0x4b84f9,_0x394f73){_0x394f73=_0x394f73||0xcc;return function(_0x433eaa){if(_0x433eaa){return _0x4b84f9[_0x402a('0x16')](_0x394f73);}return _0x4b84f9['status'](_0x394f73)['end']();};}function respondWithResult(_0x419840,_0x429504){_0x429504=_0x429504||0xc8;return function(_0x171523){if(_0x171523){return _0x419840[_0x402a('0x17')](_0x429504)[_0x402a('0x18')](_0x171523);}};}function respondWithFilteredResult(_0x4dd0e9,_0x4897dc){return function(_0x1ef004){if(_0x1ef004){var _0x5dc2ae=typeof _0x4897dc[_0x402a('0x19')]===_0x402a('0x1a')&&typeof _0x4897dc[_0x402a('0x1b')]===_0x402a('0x1a');var _0x514acb=_0x1ef004[_0x402a('0x1c')];var _0x4d4941=_0x5dc2ae?0x0:_0x4897dc[_0x402a('0x19')];var _0x3df24a=_0x5dc2ae?_0x1ef004[_0x402a('0x1c')]:_0x4897dc[_0x402a('0x19')]+_0x4897dc[_0x402a('0x1b')];var _0x5bc0ab;if(_0x3df24a>=_0x514acb){_0x3df24a=_0x514acb;_0x5bc0ab=0xc8;}else{_0x5bc0ab=0xce;}_0x4dd0e9['status'](_0x5bc0ab);return _0x4dd0e9['set']('Content-Range',_0x4d4941+'-'+_0x3df24a+'/'+_0x514acb)['json'](_0x1ef004);}return null;};}function patchUpdates(_0x3a1f9c){return function(_0x1ca806){try{jsonpatch[_0x402a('0x1d')](_0x1ca806,_0x3a1f9c,!![]);}catch(_0x550eb0){return BPromise[_0x402a('0x1e')](_0x550eb0);}return _0x1ca806[_0x402a('0x1f')]();};}function saveUpdates(_0x46db73,_0x8b8dec){return function(_0x573d83){if(_0x573d83){return _0x573d83[_0x402a('0x20')](_0x46db73)['then'](function(_0x3e82c4){return _0x3e82c4;});}return null;};}function removeEntity(_0x406462,_0x1022b2){return function(_0x417aa5){if(_0x417aa5){return _0x417aa5[_0x402a('0x21')]()['then'](function(){_0x406462[_0x402a('0x17')](0xcc)[_0x402a('0x22')]();});}};}function handleEntityNotFound(_0x521a7e,_0x1eb8ad){return function(_0x5f2aa2){if(!_0x5f2aa2){_0x521a7e[_0x402a('0x16')](0x194);}return _0x5f2aa2;};}function handleError(_0x35167c,_0x5c0448){_0x5c0448=_0x5c0448||0x1f4;return function(_0x5edbdc){logger[_0x402a('0x23')](_0x5edbdc['stack']);if(_0x5edbdc[_0x402a('0x24')]){delete _0x5edbdc['name'];}_0x35167c[_0x402a('0x17')](_0x5c0448)['send'](_0x5edbdc);};}exports[_0x402a('0x25')]=function(_0x4d4e96,_0x4cd228){var _0x369584={},_0x479e18={},_0x3d0c67={'count':0x0,'rows':[]};var _0x12fbef=_['map'](db[_0x402a('0x26')][_0x402a('0x27')],function(_0x40f81c){return{'name':_0x40f81c[_0x402a('0x28')],'type':_0x40f81c[_0x402a('0x29')][_0x402a('0x2a')]};});_0x479e18[_0x402a('0x2b')]=_['map'](_0x12fbef,_0x402a('0x24'));_0x479e18[_0x402a('0x2c')]=_[_0x402a('0x2d')](_0x4d4e96[_0x402a('0x2c')]);_0x479e18[_0x402a('0x2e')]=_['intersection'](_0x479e18[_0x402a('0x2b')],_0x479e18['query']);_0x369584[_0x402a('0x2f')]=_[_0x402a('0x30')](_0x479e18['model'],qs[_0x402a('0x31')](_0x4d4e96[_0x402a('0x2c')]['fields']));_0x369584[_0x402a('0x2f')]=_0x369584['attributes']['length']?_0x369584['attributes']:_0x479e18[_0x402a('0x2b')];if(!_0x4d4e96[_0x402a('0x2c')]['hasOwnProperty'](_0x402a('0x32'))){_0x369584[_0x402a('0x1b')]=qs[_0x402a('0x1b')](_0x4d4e96['query'][_0x402a('0x1b')]);_0x369584[_0x402a('0x19')]=qs[_0x402a('0x19')](_0x4d4e96[_0x402a('0x2c')]['offset']);}_0x369584[_0x402a('0x33')]=qs[_0x402a('0x34')](_0x4d4e96[_0x402a('0x2c')][_0x402a('0x34')]);_0x369584[_0x402a('0x35')]=qs['filters'](_['pick'](_0x4d4e96[_0x402a('0x2c')],_0x479e18[_0x402a('0x2e')]),_0x12fbef);if(_0x4d4e96[_0x402a('0x2c')][_0x402a('0x36')]){_0x369584[_0x402a('0x35')]=_[_0x402a('0x37')](_0x369584[_0x402a('0x35')],{'$or':_[_0x402a('0x38')](_0x12fbef,function(_0x2ec78c){if(_0x2ec78c['type']!=='VIRTUAL'){var _0x58af7a={};_0x58af7a[_0x2ec78c[_0x402a('0x24')]]={'$like':'%'+_0x4d4e96[_0x402a('0x2c')][_0x402a('0x36')]+'%'};return _0x58af7a;}})});}_0x369584=_[_0x402a('0x37')]({},_0x369584,_0x4d4e96[_0x402a('0x39')]);var _0x7c2dbc={'where':_0x369584[_0x402a('0x35')]};return db['WhatsappTransferReport'][_0x402a('0x1c')](_0x7c2dbc)[_0x402a('0x3a')](function(_0x5a4119){_0x3d0c67['count']=_0x5a4119;if(_0x4d4e96[_0x402a('0x2c')]['includeAll']){_0x369584[_0x402a('0x3b')]=[{'all':!![]}];}return db[_0x402a('0x26')][_0x402a('0x3c')](_0x369584);})[_0x402a('0x3a')](function(_0x42bcc0){_0x3d0c67[_0x402a('0x3d')]=_0x42bcc0;return _0x3d0c67;})[_0x402a('0x3a')](respondWithFilteredResult(_0x4cd228,_0x369584))[_0x402a('0x3e')](handleError(_0x4cd228,null));};exports['show']=function(_0x1f1d43,_0x4a9e10){var _0x599ca8={'raw':!![],'where':{'id':_0x1f1d43[_0x402a('0x3f')]['id']}},_0x93daa0={};_0x93daa0[_0x402a('0x2b')]=_[_0x402a('0x2d')](db[_0x402a('0x26')][_0x402a('0x27')]);_0x93daa0[_0x402a('0x2c')]=_[_0x402a('0x2d')](_0x1f1d43[_0x402a('0x2c')]);_0x93daa0[_0x402a('0x2e')]=_[_0x402a('0x30')](_0x93daa0['model'],_0x93daa0['query']);_0x599ca8[_0x402a('0x2f')]=_[_0x402a('0x30')](_0x93daa0['model'],qs[_0x402a('0x31')](_0x1f1d43[_0x402a('0x2c')][_0x402a('0x31')]));_0x599ca8[_0x402a('0x2f')]=_0x599ca8[_0x402a('0x2f')]['length']?_0x599ca8['attributes']:_0x93daa0[_0x402a('0x2b')];if(_0x1f1d43['query'][_0x402a('0x40')]){_0x599ca8[_0x402a('0x3b')]=[{'all':!![]}];}_0x599ca8=_[_0x402a('0x37')]({},_0x599ca8,_0x1f1d43['options']);return db[_0x402a('0x26')][_0x402a('0x41')](_0x599ca8)['then'](handleEntityNotFound(_0x4a9e10,null))[_0x402a('0x3a')](respondWithResult(_0x4a9e10,null))['catch'](handleError(_0x4a9e10,null));};exports[_0x402a('0x42')]=function(_0x58899b,_0x385f40){return db[_0x402a('0x26')]['create'](_0x58899b['body'],{})[_0x402a('0x3a')](respondWithResult(_0x385f40,0xc9))[_0x402a('0x3e')](handleError(_0x385f40,null));};exports[_0x402a('0x20')]=function(_0x41b419,_0x4aea5a){if(_0x41b419[_0x402a('0x43')]['id']){delete _0x41b419[_0x402a('0x43')]['id'];}return db[_0x402a('0x26')][_0x402a('0x41')]({'where':{'id':_0x41b419[_0x402a('0x3f')]['id']}})[_0x402a('0x3a')](handleEntityNotFound(_0x4aea5a,null))['then'](saveUpdates(_0x41b419[_0x402a('0x43')],null))[_0x402a('0x3a')](respondWithResult(_0x4aea5a,null))[_0x402a('0x3e')](handleError(_0x4aea5a,null));};exports[_0x402a('0x21')]=function(_0x5202c3,_0x2b2121){return db[_0x402a('0x26')][_0x402a('0x41')]({'where':{'id':_0x5202c3['params']['id']}})[_0x402a('0x3a')](handleEntityNotFound(_0x2b2121,null))['then'](removeEntity(_0x2b2121,null))[_0x402a('0x3e')](handleError(_0x2b2121,null));};exports[_0x402a('0x44')]=function(_0x495b41,_0x478e98){return db['WhatsappTransferReport']['describe']()['then'](respondWithResult(_0x478e98,null))['catch'](handleError(_0x478e98,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 31ffa5e..0e8838d 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 _0xa515=['bluebird','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','define','report_whatsapp_transfer','uniqueid','lodash','util','api','moment'];(function(_0x26e1d0,_0x5d0f48){var _0x21664b=function(_0x27cfde){while(--_0x27cfde){_0x26e1d0['push'](_0x26e1d0['shift']());}};_0x21664b(++_0x5d0f48);}(_0xa515,0x170));var _0x5a51=function(_0x3865f4,_0xd57c37){_0x3865f4=_0x3865f4-0x0;var _0x229b84=_0xa515[_0x3865f4];return _0x229b84;};'use strict';var _=require(_0x5a51('0x0'));var util=require(_0x5a51('0x1'));var logger=require('../../config/logger')(_0x5a51('0x2'));var moment=require(_0x5a51('0x3'));var BPromise=require(_0x5a51('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5a51('0x5'));var rimraf=require(_0x5a51('0x6'));var config=require(_0x5a51('0x7'));var attributes=require(_0x5a51('0x8'));module['exports']=function(_0x3e6d21,_0x1af268){return _0x3e6d21[_0x5a51('0x9')]('WhatsappTransferReport',attributes,{'tableName':_0x5a51('0xa'),'paranoid':![],'indexes':[{'name':_0x5a51('0xb'),'fields':[_0x5a51('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfafd=['moment','request-promise','path','../../config/environment','./whatsappTransferReport.attributes','exports','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0xfafd,0xbf));var _0xdfaf=function(_0x21a062,_0x4f96dd){_0x21a062=_0x21a062-0x0;var _0x105e62=_0xfafd[_0x21a062];return _0x105e62;};'use strict';var _=require(_0xdfaf('0x0'));var util=require(_0xdfaf('0x1'));var logger=require(_0xdfaf('0x2'))(_0xdfaf('0x3'));var moment=require(_0xdfaf('0x4'));var BPromise=require('bluebird');var rp=require(_0xdfaf('0x5'));var fs=require('fs');var path=require(_0xdfaf('0x6'));var rimraf=require('rimraf');var config=require(_0xdfaf('0x7'));var attributes=require(_0xdfaf('0x8'));module[_0xdfaf('0x9')]=function(_0x2297d0,_0x5991eb){return _0x2297d0['define'](_0xdfaf('0xa'),attributes,{'tableName':_0xdfaf('0xb'),'paranoid':![],'indexes':[{'name':_0xdfaf('0xc'),'fields':[_0xdfaf('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 7996904..105d068 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 _0xb4df=['request','then','info','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x434639,_0x2e40f0){var _0x228798=function(_0x2ed31c){while(--_0x2ed31c){_0x434639['push'](_0x434639['shift']());}};_0x228798(++_0x2e40f0);}(_0xb4df,0x64));var _0xfb4d=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0xb4df[_0x24259d];return _0x5a701;};'use strict';var _=require('lodash');var util=require(_0xfb4d('0x0'));var moment=require(_0xfb4d('0x1'));var BPromise=require(_0xfb4d('0x2'));var rs=require(_0xfb4d('0x3'));var fs=require('fs');var Redis=require(_0xfb4d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfb4d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xfb4d('0x6'));var jayson=require(_0xfb4d('0x7'));var client=jayson[_0xfb4d('0x8')][_0xfb4d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x282b85,_0x4b8f92,_0x1ba64b){return new BPromise(function(_0x4f32fd,_0x4f9491){return client[_0xfb4d('0xa')](_0x282b85,_0x1ba64b)[_0xfb4d('0xb')](function(_0x4ec777){logger[_0xfb4d('0xc')]('WhatsappTransferReport,\x20%s,\x20%s',_0x4b8f92,_0xfb4d('0xd'));logger[_0xfb4d('0xe')](_0xfb4d('0xf'),_0x4b8f92,_0xfb4d('0xd'),JSON[_0xfb4d('0x10')](_0x4ec777));if(_0x4ec777[_0xfb4d('0x11')]){if(_0x4ec777[_0xfb4d('0x11')][_0xfb4d('0x12')]===0x1f4){logger[_0xfb4d('0x11')](_0xfb4d('0x13'),_0x4b8f92,_0x4ec777['error']['message']);return _0x4f9491(_0x4ec777[_0xfb4d('0x11')][_0xfb4d('0x14')]);}logger[_0xfb4d('0x11')](_0xfb4d('0x13'),_0x4b8f92,_0x4ec777[_0xfb4d('0x11')][_0xfb4d('0x14')]);return _0x4f32fd(_0x4ec777[_0xfb4d('0x11')][_0xfb4d('0x14')]);}else{logger['info'](_0xfb4d('0x13'),_0x4b8f92,_0xfb4d('0xd'));_0x4f32fd(_0x4ec777[_0xfb4d('0x15')][_0xfb4d('0x14')]);}})['catch'](function(_0xdc68d6){logger[_0xfb4d('0x11')](_0xfb4d('0x13'),_0x4b8f92,_0xdc68d6);_0x4f9491(_0xdc68d6);});});} \ No newline at end of file +var _0x2416=['../../config/utils','../../config/logger','rpc','client','http','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x447f02,_0x12a317){var _0x50144d=function(_0x2990e0){while(--_0x2990e0){_0x447f02['push'](_0x447f02['shift']());}};_0x50144d(++_0x12a317);}(_0x2416,0x94));var _0x6241=function(_0x5d65da,_0x77aa0a){_0x5d65da=_0x5d65da-0x0;var _0x29a37=_0x2416[_0x5d65da];return _0x29a37;};'use strict';var _=require(_0x6241('0x0'));var util=require(_0x6241('0x1'));var moment=require(_0x6241('0x2'));var BPromise=require(_0x6241('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6241('0x4'));var db=require(_0x6241('0x5'))['db'];var utils=require(_0x6241('0x6'));var logger=require(_0x6241('0x7'))(_0x6241('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6241('0x9')][_0x6241('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x409fef,_0xdf6997,_0x38f4ac){return new BPromise(function(_0x18e9b4,_0x5c0578){return client['request'](_0x409fef,_0x38f4ac)[_0x6241('0xb')](function(_0x326da7){logger[_0x6241('0xc')](_0x6241('0xd'),_0xdf6997,_0x6241('0xe'));logger[_0x6241('0xf')](_0x6241('0x10'),_0xdf6997,_0x6241('0xe'),JSON['stringify'](_0x326da7));if(_0x326da7[_0x6241('0x11')]){if(_0x326da7[_0x6241('0x11')][_0x6241('0x12')]===0x1f4){logger[_0x6241('0x11')]('WhatsappTransferReport,\x20%s,\x20%s',_0xdf6997,_0x326da7[_0x6241('0x11')][_0x6241('0x13')]);return _0x5c0578(_0x326da7[_0x6241('0x11')][_0x6241('0x13')]);}logger[_0x6241('0x11')](_0x6241('0xd'),_0xdf6997,_0x326da7[_0x6241('0x11')][_0x6241('0x13')]);return _0x18e9b4(_0x326da7[_0x6241('0x11')][_0x6241('0x13')]);}else{logger[_0x6241('0xc')](_0x6241('0xd'),_0xdf6997,_0x6241('0xe'));_0x18e9b4(_0x326da7[_0x6241('0x14')]['message']);}})[_0x6241('0x15')](function(_0x1cebb2){logger[_0x6241('0x11')](_0x6241('0xd'),_0xdf6997,_0x1cebb2);_0x5c0578(_0x1cebb2);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 9ed074b..6b692f3 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x94f9=['then','listen','start','info','Online\x20apps:','filter','online','name','Offline\x20apps:','map','status','join','None','seedDB','default','catch','exit','lodash','./mysqldb','./rpc','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','sequelize','sync'];(function(_0x571f7c,_0x450489){var _0x374a19=function(_0x5ddfdf){while(--_0x5ddfdf){_0x571f7c['push'](_0x571f7c['shift']());}};_0x374a19(++_0x450489);}(_0x94f9,0x1c1));var _0x994f=function(_0xfb19ff,_0x1a17c2){_0xfb19ff=_0xfb19ff-0x0;var _0x3c8900=_0x94f9[_0xfb19ff];return _0x3c8900;};'use strict';var _=require(_0x994f('0x0'));var mysqldb=require(_0x994f('0x1'));var rpc=require(_0x994f('0x2'));var config=require('./config/environment');var logger=require(_0x994f('0x3'))(_0x994f('0x4'));var pm2=require(_0x994f('0x5'));var pm2Config=require(_0x994f('0x6'));var schedule=require(_0x994f('0x7'));var chat=require('./config/schedule/chat');var whatsapp=require('./config/schedule/whatsapp');var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0x994f('0x8')][_0x994f('0x9')]()[_0x994f('0xa')](function(){return rpc[_0x994f('0xb')]();})['then'](function(_0x12564c){logger['info'](_0x12564c);return chat[_0x994f('0xc')]();})[_0x994f('0xa')](function(){return whatsapp['start']();})['then'](function(){return schedule[_0x994f('0xc')]();})[_0x994f('0xa')](function(){return transcribe[_0x994f('0xc')]();})['then'](function(_0x33be8f){logger['info'](_0x33be8f);return pm2[_0x994f('0xc')](pm2Config);})['then'](function(_0x3d4dab){logger[_0x994f('0xd')](_0x994f('0xe'),_['map'](_[_0x994f('0xf')](_0x3d4dab,{'status':_0x994f('0x10')}),_0x994f('0x11'))['join']());logger['info'](_0x994f('0x12'),_[_0x994f('0x13')](_[_0x994f('0xf')](_0x3d4dab,function(_0x118ee5){return _0x118ee5[_0x994f('0x14')]!==_0x994f('0x10');}),'name')[_0x994f('0x15')]()||_0x994f('0x16'));config[_0x994f('0x17')]&&require('./config/seedDB')[_0x994f('0x18')]();require('./config/license')[_0x994f('0x18')]();})[_0x994f('0x19')](function(_0x377772){logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x377772);process[_0x994f('0x1a')](0x1);});}main(); \ No newline at end of file +var _0x09d2=['./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','listen','info','start','Online\x20apps:','map','filter','online','name','Offline\x20apps:','status','None','seedDB','./config/seedDB','default','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','./mysqldb','./config/environment'];(function(_0x29d569,_0x425415){var _0x2950dd=function(_0x37805e){while(--_0x37805e){_0x29d569['push'](_0x29d569['shift']());}};_0x2950dd(++_0x425415);}(_0x09d2,0x177));var _0x209d=function(_0x1bb37d,_0x5f575f){_0x1bb37d=_0x1bb37d-0x0;var _0x2b683c=_0x09d2[_0x1bb37d];return _0x2b683c;};'use strict';var _=require('lodash');var mysqldb=require(_0x209d('0x0'));var rpc=require('./rpc');var config=require(_0x209d('0x1'));var logger=require(_0x209d('0x2'))('app');var pm2=require(_0x209d('0x3'));var pm2Config=require(_0x209d('0x4'));var schedule=require(_0x209d('0x5'));var chat=require(_0x209d('0x6'));var whatsapp=require(_0x209d('0x7'));var transcribe=require(_0x209d('0x8'));function main(){return mysqldb['db'][_0x209d('0x9')][_0x209d('0xa')]()[_0x209d('0xb')](function(){return rpc[_0x209d('0xc')]();})[_0x209d('0xb')](function(_0x723fe0){logger[_0x209d('0xd')](_0x723fe0);return chat['start']();})['then'](function(){return whatsapp[_0x209d('0xe')]();})[_0x209d('0xb')](function(){return schedule['start']();})[_0x209d('0xb')](function(){return transcribe[_0x209d('0xe')]();})[_0x209d('0xb')](function(_0x596413){logger[_0x209d('0xd')](_0x596413);return pm2['start'](pm2Config);})['then'](function(_0x137463){logger[_0x209d('0xd')](_0x209d('0xf'),_[_0x209d('0x10')](_[_0x209d('0x11')](_0x137463,{'status':_0x209d('0x12')}),_0x209d('0x13'))['join']());logger[_0x209d('0xd')](_0x209d('0x14'),_[_0x209d('0x10')](_[_0x209d('0x11')](_0x137463,function(_0x2b703a){return _0x2b703a[_0x209d('0x15')]!=='online';}),'name')['join']()||_0x209d('0x16'));config[_0x209d('0x17')]&&require(_0x209d('0x18'))[_0x209d('0x19')]();require('./config/license')[_0x209d('0x19')]();})[_0x209d('0x1a')](function(_0x5835da){logger[_0x209d('0x1b')](_0x209d('0x1c'),_0x5835da);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 1641922..082ea0f 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 _0xe2f8=['split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','ValidationError','updatePasswordsHistory','length','splice','unshift','encryptString','join','promisify','sign','secret','options','verify','toString','hex','floor','now','../../mysqldb','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','bluebird','util','moment','secrets','session','role','fullname','name','internal','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','json','Forbidden.','catch','headers','authorization','startsWith','find','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','getUuid','query','apikey','User','sub','Setting','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','Sequelize','validatePasswordHistory','decryptString'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0xe2f8,0x10f));var _0x8e2f=function(_0x16295f,_0x263e7d){_0x16295f=_0x16295f-0x0;var _0x29e074=_0xe2f8[_0x16295f];return _0x29e074;};'use strict';var db=require(_0x8e2f('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x8e2f('0x1'));var licenseUtil=require(_0x8e2f('0x2'));var encryptor=require(_0x8e2f('0x3'));var _=require(_0x8e2f('0x4'));var jwt=require(_0x8e2f('0x5'));var expressJwt=require(_0x8e2f('0x6'));var compose=require(_0x8e2f('0x7'));var basicAuth=require(_0x8e2f('0x8'));var crypto=require('crypto');var BPromise=require(_0x8e2f('0x9'));var util=require(_0x8e2f('0xa'));var moment=require(_0x8e2f('0xb'));var validateJwt=expressJwt({'secret':config[_0x8e2f('0xc')][_0x8e2f('0xd')]});var userAttributes=['id',_0x8e2f('0xe'),_0x8e2f('0xf'),_0x8e2f('0x10'),_0x8e2f('0x11'),'email','userpic','permissions','md5secret',_0x8e2f('0x12'),_0x8e2f('0x13'),_0x8e2f('0x14'),_0x8e2f('0x15'),_0x8e2f('0x16'),_0x8e2f('0x17'),_0x8e2f('0x18'),_0x8e2f('0x19'),_0x8e2f('0x1a'),_0x8e2f('0x1b'),_0x8e2f('0x1c'),_0x8e2f('0x1d'),'passwordResetAt','alias',_0x8e2f('0x1e'),_0x8e2f('0x1f'),_0x8e2f('0x20'),_0x8e2f('0x21'),_0x8e2f('0x22'),'phoneBarEnableSettings',_0x8e2f('0x23'),_0x8e2f('0x24'),_0x8e2f('0x25'),_0x8e2f('0x26'),'hotdesk',_0x8e2f('0x27'),_0x8e2f('0x28'),_0x8e2f('0x29'),_0x8e2f('0x2a'),_0x8e2f('0x2b'),_0x8e2f('0x2c'),_0x8e2f('0x2d'),_0x8e2f('0x2e')];exports['isChatInteractionAuthorized']=function(){return this[_0x8e2f('0x2f')](!![])[_0x8e2f('0x30')](function(_0x6531a,_0x4a717c,_0xda7ffa){if(_0x6531a[_0x8e2f('0x31')]){_0xda7ffa();}else{return db[_0x8e2f('0x32')][_0x8e2f('0x33')]({'where':{'id':_0x6531a[_0x8e2f('0x34')]['id']},'attributes':['id',_0x8e2f('0x35'),_0x8e2f('0x36')],'raw':!![]})[_0x8e2f('0x37')](function(_0x2bce30){if(_0x2bce30&&_0x2bce30[_0x8e2f('0x35')]){return _0x4a717c[_0x8e2f('0x38')](_0x2bce30[_0x8e2f('0x36')]===_0x8e2f('0x39')?0x195:0x193)[_0x8e2f('0x3a')]({'message':_0x2bce30[_0x8e2f('0x36')]===_0x8e2f('0x39')?'Unmanaged.':_0x8e2f('0x3b')});}else{_0xda7ffa();}})[_0x8e2f('0x3c')](function(_0x44a919){_0xda7ffa(_0x44a919);});}});};exports['isAuthenticated']=function isAuthenticated(_0x2f8206){return compose()['use'](function(_0x4ec16f,_0xb6bdbb,_0x379002){var _0x1d71d8;if(_0x4ec16f[_0x8e2f('0x3d')][_0x8e2f('0x3e')]){if(_[_0x8e2f('0x3f')](_0x4ec16f[_0x8e2f('0x3d')]['authorization'],'Basic')){var _0x2d1ad0=basicAuth(_0x4ec16f);db['User'][_0x8e2f('0x40')]({'where':{'name':_0x2d1ad0[_0x8e2f('0x10')]}})[_0x8e2f('0x37')](function(_0x177156){if(!_0x177156||!_0x177156['authenticate'](_0x2d1ad0[_0x8e2f('0x41')])){return _0xb6bdbb[_0x8e2f('0x38')](0x191)[_0x8e2f('0x3a')]({'message':_0x8e2f('0x42')});}_0x4ec16f[_0x8e2f('0x31')]={'id':_0x177156['id']};_0x379002();})['catch'](function(_0x19d641){_0x379002(_0x19d641);});}else if(_[_0x8e2f('0x3f')](_0x4ec16f[_0x8e2f('0x3d')][_0x8e2f('0x3e')],_0x8e2f('0x43'))){validateJwt(_0x4ec16f,_0xb6bdbb,_0x379002);}else{if(_0x2f8206){_0x379002();}else{return _0xb6bdbb[_0x8e2f('0x38')](0x193)['json']({'message':_0x8e2f('0x44')});}}}else if(_0x4ec16f['query']['apikey']){try{var _0x425fe1={'audience':hardwareConf[_0x8e2f('0x45')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x4ec16f[_0x8e2f('0x46')][_0x8e2f('0x47')],_0x425fe1)[_0x8e2f('0x37')](function(_0x161f2d){return db[_0x8e2f('0x48')][_0x8e2f('0x40')]({'where':{'id':_0x161f2d[_0x8e2f('0x49')]}})[_0x8e2f('0x37')](function(_0x1cc044){_0x1d71d8=_0x1cc044;return db[_0x8e2f('0x4a')][_0x8e2f('0x33')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x8e2f('0x4b')],'raw':!![]});})[_0x8e2f('0x37')](function(_0x7ae463){if(!_0x1d71d8||!_[_0x8e2f('0x4c')](_0x1d71d8[_0x8e2f('0x4d')],_0x161f2d[_0x8e2f('0x4e')])){return _0xb6bdbb['status'](0x191)[_0x8e2f('0x3a')]({'message':_0x8e2f('0x4f')});}if(_0x1d71d8['disabled']){return _0xb6bdbb[_0x8e2f('0x38')](0x191)[_0x8e2f('0x3a')]({'message':_0x8e2f('0x50')});}if(_0x1d71d8[_0x8e2f('0x51')]){if(_0x7ae463[_0x8e2f('0x4b')]>0x0){if(moment(_0x1d71d8[_0x8e2f('0x52')])[_0x8e2f('0x53')](_0x7ae463[_0x8e2f('0x4b')],_0x8e2f('0x54'))>moment()){return _0xb6bdbb['status'](0x191)[_0x8e2f('0x3a')]({'message':_0x8e2f('0x50')});}}else{return _0xb6bdbb[_0x8e2f('0x38')](0x191)[_0x8e2f('0x3a')]({'message':_0x8e2f('0x50')});}}_0x4ec16f[_0x8e2f('0x31')]={'id':_0x1d71d8['id']};_0x379002();});})[_0x8e2f('0x3c')](function(){return _0xb6bdbb['status'](0x191)[_0x8e2f('0x3a')]({'message':_0x8e2f('0x50')});});}catch(_0x1361b4){_0x379002(_0x1361b4);}}else if(_0x2f8206){_0x379002();}else{return _0xb6bdbb['status'](0x193)[_0x8e2f('0x3a')]({'message':'Unknown\x20authorization\x20format'});}})[_0x8e2f('0x30')](function(_0x4b0f8f,_0x5de502,_0x3179ff){if(_0x4b0f8f[_0x8e2f('0x31')]){db[_0x8e2f('0x48')][_0x8e2f('0x40')]({'where':{'id':_0x4b0f8f['user']['id']},'attributes':userAttributes})[_0x8e2f('0x37')](function(_0x4ecc49){if(!_0x4ecc49){return _0x5de502[_0x8e2f('0x38')](0x194)[_0x8e2f('0x3a')]({'message':_0x8e2f('0x55')});}_0x4b0f8f[_0x8e2f('0x31')]=_0x4ecc49;_0x3179ff();})[_0x8e2f('0x3c')](function(_0x32a2a4){_0x3179ff(_0x32a2a4);});}else if(_0x2f8206){_0x3179ff();}else{return _0x5de502['status'](0x194)['json']({'message':_0x8e2f('0x56')});}});};exports[_0x8e2f('0x57')]=function canUpdate(){return compose()[_0x8e2f('0x30')](function(_0x9d3c4e,_0x221adb,_0x167a25){return licenseUtil[_0x8e2f('0x58')]()[_0x8e2f('0x37')](function(_0x37d88d){if(_0x37d88d['update']){_0x167a25();}else{return _0x221adb[_0x8e2f('0x38')](0x193)[_0x8e2f('0x3a')]({'message':_0x8e2f('0x59')});}})[_0x8e2f('0x3c')](function(_0x4ee181){_0x167a25(_0x4ee181);});});};exports['isMiddleware']=function(_0x71c561,_0x31dc3f,_0x2e2897){_0x71c561[_0x8e2f('0x5a')]=!![];return _0x2e2897();};exports[_0x8e2f('0x5b')]=function signToken(_0x37fc50){return signJwt(_0x37fc50);};exports['setTokenCookie']=function(_0xb78ed5,_0x2634bc){if(!_0xb78ed5[_0x8e2f('0x31')]){return _0x2634bc[_0x8e2f('0x38')](0x194)['json']({'message':_0x8e2f('0x5c')});}var _0x14364a={'payload':{'id':_0xb78ed5[_0x8e2f('0x31')]['id'],'role':_0xb78ed5[_0x8e2f('0x31')][_0x8e2f('0xe')]},'options':{'expiresIn':0x15180}};return signJwt(_0x14364a)[_0x8e2f('0x37')](function(_0x3043f9){_0x2634bc[_0x8e2f('0x5d')](_0x8e2f('0x5e'),_0x3043f9);_0x2634bc[_0x8e2f('0x5f')]('/dashboards/general');})[_0x8e2f('0x3c')](function(_0x571152){return _0x2634bc[_0x8e2f('0x38')](0x1f4)[_0x8e2f('0x60')](_0x571152);});};exports[_0x8e2f('0x61')]=function(_0x1a1cdd){if(_[_0x8e2f('0x62')](_0x1a1cdd[_0x8e2f('0x4d')])||_[_0x8e2f('0x62')](_0x1a1cdd[_0x8e2f('0x63')])){return null;}else{return createJwt(_0x1a1cdd);}};exports['generateApiKey']=function(_0x55f207){_0x55f207[_0x8e2f('0x4d')]=generateNonce();_0x55f207['apiKeyIat']=generateIssuedAt();return createJwt(_0x55f207);};exports['regenerateApiKey']=function(_0x24db8e,_0x1bd444){var _0x3ccdb5=_0x24db8e[_0x8e2f('0x46')]['apikey'];if(_0x3ccdb5){var _0xff831c={'nonce':_0x1bd444[_0x8e2f('0x4d')],'iat':_0x1bd444['apiKeyIat'],'audience':hardwareConf[_0x8e2f('0x45')](),'issuer':hardwareConf[_0x8e2f('0x45')]()};return verifyJwt(_0x3ccdb5,_0xff831c)[_0x8e2f('0x37')](function(){return generateApiKey(_0x1bd444);});}else{throw{'message':_0x8e2f('0x64')};}};exports['validatePasswordPattern']=function(_0x1bd960){var _0xbfb27a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xbfb27a['test'](_0x1bd960))throw new db[(_0x8e2f('0x65'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x8e2f('0x66')]=function(_0x2854d7,_0x4f7c76,_0x212b40){var _0x162daa=encryptor[_0x8e2f('0x67')](_0x4f7c76)[_0x8e2f('0x68')](',');for(var _0xab6a24=0x0;_0xab6a24<_0x212b40;_0xab6a24++){if(!_0x162daa[_0xab6a24])break;if(_0x2854d7[_0x8e2f('0x69')]()===_0x162daa[_0xab6a24][_0x8e2f('0x69')]()){var _0x263d14=util[_0x8e2f('0x6a')](_0x8e2f('0x6b'),_0x212b40);if(_0x212b40===0x1){_0x263d14=_0x8e2f('0x6c');}throw new db[(_0x8e2f('0x65'))][(_0x8e2f('0x6d'))](_0x263d14);}}return;};exports[_0x8e2f('0x6e')]=function(_0x5e98c5,_0x205c31){var _0xcd61e2=_0x205c31?encryptor['decryptString'](_0x205c31)[_0x8e2f('0x68')](','):[];if(_0xcd61e2[_0x8e2f('0x6f')]===0x5){_0xcd61e2[_0x8e2f('0x70')](-0x1,0x1);}_0xcd61e2[_0x8e2f('0x71')](_0x5e98c5);return encryptor[_0x8e2f('0x72')](_0xcd61e2[_0x8e2f('0x73')](','));};function signJwt(_0x4dce66){var _0x26d8c3=BPromise[_0x8e2f('0x74')](jwt[_0x8e2f('0x75')],{'context':jwt});var _0x2f49bb=_0x4dce66[_0x8e2f('0x76')]||config[_0x8e2f('0xc')][_0x8e2f('0xd')];return new BPromise(function(_0x98cd0e,_0x40ce38){_0x26d8c3(_0x4dce66['payload'],_0x2f49bb,_0x4dce66[_0x8e2f('0x77')])[_0x8e2f('0x37')](function(_0x36ed37){_0x98cd0e(_0x36ed37);})['catch'](function(_0x9aedbf){_0x40ce38(_0x9aedbf);});});}function verifyJwt(_0xc00a16,_0x3add41,_0x401d23){var _0x19f508=BPromise['promisify'](jwt[_0x8e2f('0x78')],{'context':jwt});var _0x1e24d9=_0x401d23||config[_0x8e2f('0xc')][_0x8e2f('0xd')];return new BPromise(function(_0x201b79,_0xd7fea2){_0x19f508(_0xc00a16,_0x1e24d9,_0x3add41)['then'](function(_0x152466){_0x201b79(_0x152466);})['catch'](function(_0x47d100){_0xd7fea2(_0x47d100);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x8e2f('0x79')](_0x8e2f('0x7a'));}function generateIssuedAt(){return Math[_0x8e2f('0x7b')](Date[_0x8e2f('0x7c')]()/0x3e8)[_0x8e2f('0x79')]();}function createJwt(_0x111a79){var _0x28ad7b={'payload':{'iat':_0x111a79['apiKeyIat'],'nonce':_0x111a79[_0x8e2f('0x4d')]},'options':{'algorithm':'HS512','subject':_0x111a79['id'][_0x8e2f('0x79')](),'issuer':hardwareConf[_0x8e2f('0x45')](),'audience':hardwareConf[_0x8e2f('0x45')]()}};return signJwt(_0x28ad7b)[_0x8e2f('0x37')](function(_0x2166fe){return{'iat':_0x111a79[_0x8e2f('0x63')],'nonce':_0x111a79[_0x8e2f('0x4d')],'token':_0x2166fe};});} \ No newline at end of file +var _0xe68b=['apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','isMiddleware','signToken','cookie','redirect','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','length','splice','unshift','join','sign','payload','promisify','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','basic-auth','crypto','util','moment','secrets','session','role','fullname','internal','email','userpic','permissions','md5secret','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','privacyEnabled','settingsEnabled','wssPort','downloadOmnichannelInteractions','downloadAttachments','isChatInteractionAuthorized','isAuthenticated','user','findOne','closed','disposition','then','status','unmanaged','json','catch','use','headers','authorization','startsWith','Basic','User','authenticate','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','find','Setting','allowedLoginAttempts','blockDuration','isEqual'];(function(_0x561698,_0x3e9ea1){var _0x3c16a9=function(_0xedbb6f){while(--_0xedbb6f){_0x561698['push'](_0x561698['shift']());}};_0x3c16a9(++_0x3e9ea1);}(_0xe68b,0x1a2));var _0xbe68=function(_0x745872,_0xea5cb1){_0x745872=_0x745872-0x0;var _0x874d83=_0xe68b[_0x745872];return _0x874d83;};'use strict';var db=require(_0xbe68('0x0'))['db'];var config=require(_0xbe68('0x1'));var hardwareConf=require(_0xbe68('0x2'));var licenseUtil=require(_0xbe68('0x3'));var encryptor=require(_0xbe68('0x4'));var _=require(_0xbe68('0x5'));var jwt=require(_0xbe68('0x6'));var expressJwt=require(_0xbe68('0x7'));var compose=require('composable-middleware');var basicAuth=require(_0xbe68('0x8'));var crypto=require(_0xbe68('0x9'));var BPromise=require('bluebird');var util=require(_0xbe68('0xa'));var moment=require(_0xbe68('0xb'));var validateJwt=expressJwt({'secret':config[_0xbe68('0xc')][_0xbe68('0xd')]});var userAttributes=['id',_0xbe68('0xe'),_0xbe68('0xf'),'name',_0xbe68('0x10'),_0xbe68('0x11'),_0xbe68('0x12'),_0xbe68('0x13'),_0xbe68('0x14'),'voicePause','chatPause',_0xbe68('0x15'),_0xbe68('0x16'),_0xbe68('0x17'),_0xbe68('0x18'),_0xbe68('0x19'),_0xbe68('0x1a'),_0xbe68('0x1b'),'lastPauseAt',_0xbe68('0x1c'),'allowmessenger',_0xbe68('0x1d'),_0xbe68('0x1e'),'phoneBarAutoAnswer',_0xbe68('0x1f'),_0xbe68('0x20'),_0xbe68('0x21'),_0xbe68('0x22'),_0xbe68('0x23'),_0xbe68('0x24'),'phoneBarPrefixRequired',_0xbe68('0x25'),_0xbe68('0x26'),_0xbe68('0x27'),_0xbe68('0x28'),'userProfileId',_0xbe68('0x29'),_0xbe68('0x2a'),_0xbe68('0x2b'),'downloadVoiceRecordings',_0xbe68('0x2c'),_0xbe68('0x2d')];exports[_0xbe68('0x2e')]=function(){return this[_0xbe68('0x2f')](!![])['use'](function(_0x5320f6,_0x4e221b,_0x1d537b){if(_0x5320f6[_0xbe68('0x30')]){_0x1d537b();}else{return db['ChatInteraction'][_0xbe68('0x31')]({'where':{'id':_0x5320f6['params']['id']},'attributes':['id',_0xbe68('0x32'),_0xbe68('0x33')],'raw':!![]})[_0xbe68('0x34')](function(_0x1d8644){if(_0x1d8644&&_0x1d8644[_0xbe68('0x32')]){return _0x4e221b[_0xbe68('0x35')](_0x1d8644['disposition']===_0xbe68('0x36')?0x195:0x193)[_0xbe68('0x37')]({'message':_0x1d8644[_0xbe68('0x33')]===_0xbe68('0x36')?'Unmanaged.':'Forbidden.'});}else{_0x1d537b();}})[_0xbe68('0x38')](function(_0x5232e1){_0x1d537b(_0x5232e1);});}});};exports[_0xbe68('0x2f')]=function isAuthenticated(_0x904144){return compose()[_0xbe68('0x39')](function(_0x1c1ded,_0x149f6c,_0x23e1c8){var _0x845936;if(_0x1c1ded[_0xbe68('0x3a')][_0xbe68('0x3b')]){if(_[_0xbe68('0x3c')](_0x1c1ded[_0xbe68('0x3a')]['authorization'],_0xbe68('0x3d'))){var _0x5b4bb8=basicAuth(_0x1c1ded);db[_0xbe68('0x3e')]['find']({'where':{'name':_0x5b4bb8['name']}})['then'](function(_0x418a49){if(!_0x418a49||!_0x418a49[_0xbe68('0x3f')](_0x5b4bb8['pass'])){return _0x149f6c['status'](0x191)[_0xbe68('0x37')]({'message':'Wrong\x20credentials.'});}_0x1c1ded['user']={'id':_0x418a49['id']};_0x23e1c8();})[_0xbe68('0x38')](function(_0x3b8519){_0x23e1c8(_0x3b8519);});}else if(_[_0xbe68('0x3c')](_0x1c1ded[_0xbe68('0x3a')][_0xbe68('0x3b')],_0xbe68('0x40'))){validateJwt(_0x1c1ded,_0x149f6c,_0x23e1c8);}else{if(_0x904144){_0x23e1c8();}else{return _0x149f6c['status'](0x193)['json']({'message':_0xbe68('0x41')});}}}else if(_0x1c1ded[_0xbe68('0x42')][_0xbe68('0x43')]){try{var _0x492b27={'audience':hardwareConf[_0xbe68('0x44')](),'issuer':hardwareConf[_0xbe68('0x44')]()};verifyJwt(_0x1c1ded['query'][_0xbe68('0x43')],_0x492b27)[_0xbe68('0x34')](function(_0x1cfca1){return db['User'][_0xbe68('0x45')]({'where':{'id':_0x1cfca1['sub']}})['then'](function(_0x2390d1){_0x845936=_0x2390d1;return db[_0xbe68('0x46')][_0xbe68('0x31')]({'where':{'id':0x1},'attributes':[_0xbe68('0x47'),_0xbe68('0x48')],'raw':!![]});})[_0xbe68('0x34')](function(_0x32b140){if(!_0x845936||!_[_0xbe68('0x49')](_0x845936[_0xbe68('0x4a')],_0x1cfca1[_0xbe68('0x4b')])){return _0x149f6c[_0xbe68('0x35')](0x191)[_0xbe68('0x37')]({'message':_0xbe68('0x4c')});}if(_0x845936[_0xbe68('0x4d')]){return _0x149f6c[_0xbe68('0x35')](0x191)[_0xbe68('0x37')]({'message':_0xbe68('0x4e')});}if(_0x845936[_0xbe68('0x4f')]){if(_0x32b140[_0xbe68('0x48')]>0x0){if(moment(_0x845936[_0xbe68('0x50')])[_0xbe68('0x51')](_0x32b140[_0xbe68('0x48')],_0xbe68('0x52'))>moment()){return _0x149f6c[_0xbe68('0x35')](0x191)[_0xbe68('0x37')]({'message':_0xbe68('0x4e')});}}else{return _0x149f6c[_0xbe68('0x35')](0x191)['json']({'message':_0xbe68('0x4e')});}}_0x1c1ded[_0xbe68('0x30')]={'id':_0x845936['id']};_0x23e1c8();});})[_0xbe68('0x38')](function(){return _0x149f6c[_0xbe68('0x35')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x102646){_0x23e1c8(_0x102646);}}else if(_0x904144){_0x23e1c8();}else{return _0x149f6c['status'](0x193)[_0xbe68('0x37')]({'message':_0xbe68('0x41')});}})['use'](function(_0x1a937d,_0x49a5f7,_0x4396ba){if(_0x1a937d[_0xbe68('0x30')]){db[_0xbe68('0x3e')][_0xbe68('0x45')]({'where':{'id':_0x1a937d[_0xbe68('0x30')]['id']},'attributes':userAttributes})[_0xbe68('0x34')](function(_0x37a4d0){if(!_0x37a4d0){return _0x49a5f7[_0xbe68('0x35')](0x194)[_0xbe68('0x37')]({'message':_0xbe68('0x53')});}_0x1a937d[_0xbe68('0x30')]=_0x37a4d0;_0x4396ba();})[_0xbe68('0x38')](function(_0x172b8f){_0x4396ba(_0x172b8f);});}else if(_0x904144){_0x4396ba();}else{return _0x49a5f7['status'](0x194)[_0xbe68('0x37')]({'message':_0xbe68('0x54')});}});};exports[_0xbe68('0x55')]=function canUpdate(){return compose()[_0xbe68('0x39')](function(_0x162ace,_0x3a0a23,_0x1fb1dd){return licenseUtil[_0xbe68('0x56')]()[_0xbe68('0x34')](function(_0x1e3732){if(_0x1e3732[_0xbe68('0x57')]){_0x1fb1dd();}else{return _0x3a0a23[_0xbe68('0x35')](0x193)[_0xbe68('0x37')]({'message':'Forbidden'});}})[_0xbe68('0x38')](function(_0x50a9e5){_0x1fb1dd(_0x50a9e5);});});};exports[_0xbe68('0x58')]=function(_0x509edc,_0x178fd6,_0x122ecf){_0x509edc['isMiddleware']=!![];return _0x122ecf();};exports[_0xbe68('0x59')]=function signToken(_0xcc129f){return signJwt(_0xcc129f);};exports['setTokenCookie']=function(_0x4c04cc,_0x1a3586){if(!_0x4c04cc['user']){return _0x1a3586[_0xbe68('0x35')](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x428c4a={'payload':{'id':_0x4c04cc[_0xbe68('0x30')]['id'],'role':_0x4c04cc[_0xbe68('0x30')][_0xbe68('0xe')]},'options':{'expiresIn':0x15180}};return signJwt(_0x428c4a)[_0xbe68('0x34')](function(_0xdc1d84){_0x1a3586[_0xbe68('0x5a')]('motion.token',_0xdc1d84);_0x1a3586[_0xbe68('0x5b')]('/dashboards/general');})[_0xbe68('0x38')](function(_0x3791d2){return _0x1a3586[_0xbe68('0x35')](0x1f4)[_0xbe68('0x5c')](_0x3791d2);});};exports['retrieveApiKey']=function(_0x10ef0e){if(_[_0xbe68('0x5d')](_0x10ef0e[_0xbe68('0x4a')])||_[_0xbe68('0x5d')](_0x10ef0e[_0xbe68('0x5e')])){return null;}else{return createJwt(_0x10ef0e);}};exports[_0xbe68('0x5f')]=function(_0x4bb761){_0x4bb761[_0xbe68('0x4a')]=generateNonce();_0x4bb761['apiKeyIat']=generateIssuedAt();return createJwt(_0x4bb761);};exports[_0xbe68('0x60')]=function(_0x1acc7b,_0x212d7d){var _0x5b4dc5=_0x1acc7b[_0xbe68('0x42')]['apikey'];if(_0x5b4dc5){var _0x4e6609={'nonce':_0x212d7d[_0xbe68('0x4a')],'iat':_0x212d7d['apiKeyIat'],'audience':hardwareConf[_0xbe68('0x44')](),'issuer':hardwareConf[_0xbe68('0x44')]()};return verifyJwt(_0x5b4dc5,_0x4e6609)[_0xbe68('0x34')](function(){return generateApiKey(_0x212d7d);});}else{throw{'message':_0xbe68('0x61')};}};exports[_0xbe68('0x62')]=function(_0x584d6f){var _0x165628=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x165628[_0xbe68('0x63')](_0x584d6f))throw new db[(_0xbe68('0x64'))][(_0xbe68('0x65'))](_0xbe68('0x66'));return;};exports[_0xbe68('0x67')]=function(_0x3a7daa,_0x2cffb7,_0x807273){var _0x11790c=encryptor[_0xbe68('0x68')](_0x2cffb7)[_0xbe68('0x69')](',');for(var _0x20e740=0x0;_0x20e740<_0x807273;_0x20e740++){if(!_0x11790c[_0x20e740])break;if(_0x3a7daa[_0xbe68('0x6a')]()===_0x11790c[_0x20e740][_0xbe68('0x6a')]()){var _0x4de4de=util[_0xbe68('0x6b')](_0xbe68('0x6c'),_0x807273);if(_0x807273===0x1){_0x4de4de='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0xbe68('0x64'))][(_0xbe68('0x65'))](_0x4de4de);}}return;};exports['updatePasswordsHistory']=function(_0x559dd3,_0x30149f){var _0x30fe7a=_0x30149f?encryptor['decryptString'](_0x30149f)['split'](','):[];if(_0x30fe7a[_0xbe68('0x6d')]===0x5){_0x30fe7a[_0xbe68('0x6e')](-0x1,0x1);}_0x30fe7a[_0xbe68('0x6f')](_0x559dd3);return encryptor['encryptString'](_0x30fe7a[_0xbe68('0x70')](','));};function signJwt(_0xcf251b){var _0x2b541f=BPromise['promisify'](jwt[_0xbe68('0x71')],{'context':jwt});var _0x30b303=_0xcf251b['secret']||config[_0xbe68('0xc')][_0xbe68('0xd')];return new BPromise(function(_0x5082c6,_0x5f05da){_0x2b541f(_0xcf251b[_0xbe68('0x72')],_0x30b303,_0xcf251b['options'])[_0xbe68('0x34')](function(_0x440413){_0x5082c6(_0x440413);})[_0xbe68('0x38')](function(_0x466166){_0x5f05da(_0x466166);});});}function verifyJwt(_0x4735f0,_0x23c991,_0x43b1ec){var _0x3dc905=BPromise[_0xbe68('0x73')](jwt[_0xbe68('0x74')],{'context':jwt});var _0x8bd82b=_0x43b1ec||config[_0xbe68('0xc')]['session'];return new BPromise(function(_0x25c75c,_0x6c7c3d){_0x3dc905(_0x4735f0,_0x8bd82b,_0x23c991)[_0xbe68('0x34')](function(_0xa82c74){_0x25c75c(_0xa82c74);})[_0xbe68('0x38')](function(_0x494104){_0x6c7c3d(_0x494104);});});}function generateNonce(){return crypto[_0xbe68('0x75')](0x10)[_0xbe68('0x76')](_0xbe68('0x77'));}function generateIssuedAt(){return Math[_0xbe68('0x78')](Date[_0xbe68('0x79')]()/0x3e8)[_0xbe68('0x76')]();}function createJwt(_0x4429f9){var _0x3b733f={'payload':{'iat':_0x4429f9[_0xbe68('0x5e')],'nonce':_0x4429f9[_0xbe68('0x4a')]},'options':{'algorithm':_0xbe68('0x7a'),'subject':_0x4429f9['id']['toString'](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0xbe68('0x44')]()}};return signJwt(_0x3b733f)[_0xbe68('0x34')](function(_0x171433){return{'iat':_0x4429f9['apiKeyIat'],'nonce':_0x4429f9[_0xbe68('0x4a')],'token':_0x171433};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 43f8e82..1131420 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 _0x3662=['../../config/environment','app','secrets','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','update','binary','final','end','close','unlink','createDecipher','data','write','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3662,0x8d));var _0x2366=function(_0x115737,_0x4b4df7){_0x115737=_0x115737-0x0;var _0xa98ae4=_0x3662[_0x115737];return _0xa98ae4;};'use strict';var crypto=require(_0x2366('0x0'));var fs=require('fs');var BPromise=require(_0x2366('0x1'));var _=require(_0x2366('0x2'));var config=require(_0x2366('0x3'));var logger=require('../../config/logger')(_0x2366('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x2366('0x5')]['session'],'algorithm':_0x2366('0x6')};const fileOptions={'algorithm':_0x2366('0x7')};if(config[_0x2366('0x8')]&&config[_0x2366('0x8')][_0x2366('0x9')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x2366('0x9')]);if(isSupported){fileOptions['algorithm']=config['encrypt'][_0x2366('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x2366('0xa')](',\x20');logger[_0x2366('0xb')](config[_0x2366('0x8')][_0x2366('0x9')],_0x2366('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x543737){return AES_SUPPORTED_RX[_0x2366('0xd')](_0x543737);}function getSupportedCiphers(){return crypto[_0x2366('0xe')]()[_0x2366('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x227453){return getSupportedCiphers()[_0x2366('0x10')](_0x227453)>-0x1;}function combineOptions(_0x16ad72){var _0x43ea36={};for(var _0x571904 in fileOptions){if(fileOptions[_0x2366('0x11')](_0x571904)){_0x43ea36[_0x571904]=fileOptions[_0x571904];}}if(_0x16ad72){for(var _0x575f3f in _0x16ad72){if(_0x16ad72[_0x2366('0x11')](_0x575f3f)){_0x43ea36[_0x575f3f]=_0x16ad72[_0x575f3f];}}}return _0x43ea36;}exports[_0x2366('0x12')]=function(_0x247ec3,_0x38deec,_0x486479,_0x1a9db3){return new BPromise(function(_0x4f8706,_0x4724f9){_0x1a9db3=combineOptions(_0x1a9db3);var _0x64ea6b=new Buffer(_0x486479);var _0x23ae3a=fs[_0x2366('0x13')](_0x247ec3);var _0x56067f=fs[_0x2366('0x14')](_0x38deec);var _0x4bfe15=crypto[_0x2366('0x15')](_0x1a9db3[_0x2366('0x9')],_0x64ea6b);_0x23ae3a['on']('data',function(_0x35515b){var _0x5c4606=new Buffer(_0x4bfe15[_0x2366('0x16')](_0x35515b),_0x2366('0x17'));_0x56067f['write'](_0x5c4606);});_0x23ae3a['on']('end',function(){try{var _0x42db9f=new Buffer(_0x4bfe15[_0x2366('0x18')](_0x2366('0x17')),_0x2366('0x17'));_0x56067f['write'](_0x42db9f);_0x56067f[_0x2366('0x19')]();_0x56067f['on'](_0x2366('0x1a'),function(){return _0x4f8706(_0x38deec);});}catch(_0x1a4ba8){fs[_0x2366('0x1b')](_0x38deec);return _0x4724f9(_0x1a4ba8);}});});};exports['decryptFile']=function(_0x103060,_0x345cde,_0x38ab37,_0x4435fa){return new BPromise(function(_0x358944,_0x4e65e5){_0x4435fa=combineOptions(_0x4435fa);var _0x3e9442=new Buffer(_0x38ab37);var _0x1e782c=fs[_0x2366('0x13')](_0x103060);var _0x31af1f=fs['createWriteStream'](_0x345cde);var _0x2b9ed1=crypto[_0x2366('0x1c')](_0x4435fa[_0x2366('0x9')],_0x3e9442);_0x1e782c['on'](_0x2366('0x1d'),function(_0x28fab6){var _0x3ded15=new Buffer(_0x2b9ed1['update'](_0x28fab6),_0x2366('0x17'));_0x31af1f[_0x2366('0x1e')](_0x3ded15);});_0x1e782c['on'](_0x2366('0x19'),function(){try{var _0x447fbb=new Buffer(_0x2b9ed1['final'](_0x2366('0x17')),_0x2366('0x17'));_0x31af1f[_0x2366('0x1e')](_0x447fbb);_0x31af1f[_0x2366('0x19')]();_0x31af1f['on'](_0x2366('0x1a'),function(){return _0x358944(_0x345cde);});}catch(_0x44cb12){fs[_0x2366('0x1b')](_0x345cde);return _0x4e65e5(_0x44cb12);}});});};exports[_0x2366('0x1f')]=function(_0x4a8816,_0x4fd288,_0x193409){var _0x42721f=_0x193409||stringOptions[_0x2366('0x9')];var _0x4c8ddb=_0x4fd288||stringOptions[_0x2366('0x20')];var _0x4a575f=crypto['createCipher'](_0x42721f,_0x4c8ddb);var _0x50e68c=_0x4a575f[_0x2366('0x16')](_0x4a8816,_0x2366('0x21'),_0x2366('0x22'));_0x50e68c+=_0x4a575f[_0x2366('0x18')](_0x2366('0x22'));return _0x50e68c;};exports[_0x2366('0x23')]=function(_0x306bd7,_0x45c24f,_0x2ca531){var _0x357734=_0x2ca531||stringOptions[_0x2366('0x9')];var _0x34e5c6=_0x45c24f||stringOptions['secret'];var _0x505c4c=crypto[_0x2366('0x1c')](_0x357734,_0x34e5c6);var _0x432c8e=_0x505c4c['update'](_0x306bd7,'base64','utf8');_0x432c8e+=_0x505c4c[_0x2366('0x18')]('utf8');return _0x432c8e;}; \ No newline at end of file +var _0x351a=['secret','createCipher','utf8','base64','crypto','bluebird','../../config/logger','app','secrets','session','aes192','encrypt','algorithm','join','error','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','data','update','binary','end','write','close','createDecipher','final','encryptString'];(function(_0x573653,_0x104710){var _0x125f2f=function(_0x375956){while(--_0x375956){_0x573653['push'](_0x573653['shift']());}};_0x125f2f(++_0x104710);}(_0x351a,0xe4));var _0xa351=function(_0x481f24,_0x18afcc){_0x481f24=_0x481f24-0x0;var _0x251944=_0x351a[_0x481f24];return _0x251944;};'use strict';var crypto=require(_0xa351('0x0'));var fs=require('fs');var BPromise=require(_0xa351('0x1'));var _=require('lodash');var config=require('../../config/environment');var logger=require(_0xa351('0x2'))(_0xa351('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xa351('0x4')][_0xa351('0x5')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0xa351('0x6')};if(config[_0xa351('0x7')]&&config[_0xa351('0x7')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0xa351('0x7')][_0xa351('0x8')]);if(isSupported){fileOptions[_0xa351('0x8')]=config[_0xa351('0x7')][_0xa351('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xa351('0x9')](',\x20');logger[_0xa351('0xa')](config[_0xa351('0x7')][_0xa351('0x8')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x4a9885){return AES_SUPPORTED_RX[_0xa351('0xb')](_0x4a9885);}function getSupportedCiphers(){return crypto[_0xa351('0xc')]()[_0xa351('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x50d9e0){return getSupportedCiphers()[_0xa351('0xe')](_0x50d9e0)>-0x1;}function combineOptions(_0x37057a){var _0x68a68={};for(var _0x274719 in fileOptions){if(fileOptions[_0xa351('0xf')](_0x274719)){_0x68a68[_0x274719]=fileOptions[_0x274719];}}if(_0x37057a){for(var _0x10201b in _0x37057a){if(_0x37057a[_0xa351('0xf')](_0x10201b)){_0x68a68[_0x10201b]=_0x37057a[_0x10201b];}}}return _0x68a68;}exports[_0xa351('0x10')]=function(_0x247d6a,_0x394012,_0x48d22e,_0x47f681){return new BPromise(function(_0x41ebdb,_0x262c62){_0x47f681=combineOptions(_0x47f681);var _0x3054d6=new Buffer(_0x48d22e);var _0x13d96b=fs[_0xa351('0x11')](_0x247d6a);var _0x32c327=fs[_0xa351('0x12')](_0x394012);var _0x342121=crypto['createCipher'](_0x47f681[_0xa351('0x8')],_0x3054d6);_0x13d96b['on'](_0xa351('0x13'),function(_0x5c946a){var _0x250cca=new Buffer(_0x342121[_0xa351('0x14')](_0x5c946a),_0xa351('0x15'));_0x32c327['write'](_0x250cca);});_0x13d96b['on'](_0xa351('0x16'),function(){try{var _0x4221ac=new Buffer(_0x342121['final']('binary'),_0xa351('0x15'));_0x32c327[_0xa351('0x17')](_0x4221ac);_0x32c327[_0xa351('0x16')]();_0x32c327['on'](_0xa351('0x18'),function(){return _0x41ebdb(_0x394012);});}catch(_0x4a329a){fs['unlink'](_0x394012);return _0x262c62(_0x4a329a);}});});};exports['decryptFile']=function(_0x558a84,_0x4aed7b,_0x60eca5,_0x1e7c98){return new BPromise(function(_0x402000,_0x3bb3b5){_0x1e7c98=combineOptions(_0x1e7c98);var _0x41e295=new Buffer(_0x60eca5);var _0x5583fc=fs[_0xa351('0x11')](_0x558a84);var _0x4ff705=fs[_0xa351('0x12')](_0x4aed7b);var _0x46fc64=crypto[_0xa351('0x19')](_0x1e7c98[_0xa351('0x8')],_0x41e295);_0x5583fc['on'](_0xa351('0x13'),function(_0x50b48b){var _0x3ff92a=new Buffer(_0x46fc64[_0xa351('0x14')](_0x50b48b),_0xa351('0x15'));_0x4ff705[_0xa351('0x17')](_0x3ff92a);});_0x5583fc['on'](_0xa351('0x16'),function(){try{var _0x1c18d4=new Buffer(_0x46fc64[_0xa351('0x1a')](_0xa351('0x15')),_0xa351('0x15'));_0x4ff705[_0xa351('0x17')](_0x1c18d4);_0x4ff705[_0xa351('0x16')]();_0x4ff705['on'](_0xa351('0x18'),function(){return _0x402000(_0x4aed7b);});}catch(_0x140e8d){fs['unlink'](_0x4aed7b);return _0x3bb3b5(_0x140e8d);}});});};exports[_0xa351('0x1b')]=function(_0x831ef0,_0x5d433a,_0x450370){var _0x272757=_0x450370||stringOptions[_0xa351('0x8')];var _0x165d09=_0x5d433a||stringOptions[_0xa351('0x1c')];var _0x257420=crypto[_0xa351('0x1d')](_0x272757,_0x165d09);var _0x2e2e6f=_0x257420[_0xa351('0x14')](_0x831ef0,_0xa351('0x1e'),'base64');_0x2e2e6f+=_0x257420['final'](_0xa351('0x1f'));return _0x2e2e6f;};exports['decryptString']=function(_0x31a995,_0x2c42c3,_0x262ab4){var _0x1ddf81=_0x262ab4||stringOptions['algorithm'];var _0x106b57=_0x2c42c3||stringOptions[_0xa351('0x1c')];var _0x93ebe2=crypto[_0xa351('0x19')](_0x1ddf81,_0x106b57);var _0x1d8691=_0x93ebe2[_0xa351('0x14')](_0x31a995,_0xa351('0x1f'),_0xa351('0x1e'));_0x1d8691+=_0x93ebe2[_0xa351('0x1a')](_0xa351('0x1e'));return _0x1d8691;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index a4ad4b0..be14621 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 _0x80d6=['Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','to-csv','bluebird','../../mysqldb','analytics','argv','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','length','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','basename','existsSync','join','mkdirSync','%s%d.%s','csv','%s.%s','writeFileSync'];(function(_0x4ccab3,_0x2cffb4){var _0x5763c9=function(_0x2155e9){while(--_0x2155e9){_0x4ccab3['push'](_0x4ccab3['shift']());}};_0x5763c9(++_0x2cffb4);}(_0x80d6,0xb7));var _0x680d=function(_0x252328,_0x4c22f0){_0x252328=_0x252328-0x0;var _0xaa85b7=_0x80d6[_0x252328];return _0xaa85b7;};'use strict';var util=require(_0x680d('0x0'));var path=require(_0x680d('0x1'));var _=require('lodash');var csv=require(_0x680d('0x2'));var fs=require('fs');var BPromise=require(_0x680d('0x3'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require(_0x680d('0x4'))['db'];var dbH=require(_0x680d('0x4'))['dbH'];var logger=require('../../config/logger')(_0x680d('0x5'));var EXTRACTED_REPORT_ID=Number(process[_0x680d('0x6')][0x2]);var QUERY=process[_0x680d('0x6')][0x3];var PATH=process[_0x680d('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5efe5c,_0x519f03){var _0x1ef287={'status':_0x5efe5c};var _0x39bfcf={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x519f03){_0x1ef287['savename']=_0x519f03;}return db['AnalyticExtractedReport'][_0x680d('0x7')](_0x1ef287,_0x39bfcf);}function main(){var _0x41fe15=0x1388;var _0x300722;logger[_0x680d('0x8')](util[_0x680d('0x9')](_0x680d('0xa'),EXTRACTED_REPORT_ID,_0x680d('0xb')));return db[_0x680d('0xc')][_0x680d('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x680d('0xe'),_0x680d('0xf')]})[_0x680d('0x10')](function(_0x3c9de7){if(_0x3c9de7){_0x300722=_0x3c9de7;_0x41fe15=_0x300722['splitSizeCsv']||0x1388;}})[_0x680d('0x10')](function(){return dbH[_0x680d('0x11')][_0x680d('0x12')](util[_0x680d('0x9')](_0x680d('0x13'),QUERY),{'type':dbH[_0x680d('0x11')]['QueryTypes'][_0x680d('0x14')]});})[_0x680d('0x10')](function(_0x2fc418){if(!_0x2fc418[0x0][_0x680d('0x15')]){return analyticExtractedReport(_0x680d('0x16'));}var _0xbead36=[];var _0x3421ef=0x0;if(_0x300722[_0x680d('0xe')]){if(_0x2fc418&&_0x2fc418[_0x680d('0x17')]){var _0x4653a2=_[_0x680d('0x18')](_0x2fc418[0x0]['num']/_0x41fe15);var _0x2050ad=Number['isInteger'](_0x2fc418[0x0][_0x680d('0x15')]/_0x41fe15)?_0x2fc418[0x0]['num']%_0x41fe15:0x0;_0x4653a2[_0x680d('0x19')](function(_0x5cc721){if(_0x5cc721>0x0){_0x3421ef+=_0x41fe15;}_0xbead36[_0x680d('0x1a')](dbH['sequelize'][_0x680d('0x12')](util[_0x680d('0x9')](_0x680d('0x1b'),QUERY,_0x41fe15,_0x3421ef),{'type':dbH['sequelize']['QueryTypes']['SELECT']}));});if(_0x2050ad>0x0){_0x3421ef+=_0x41fe15;_0xbead36[_0x680d('0x1a')](dbH[_0x680d('0x11')]['query'](util[_0x680d('0x9')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2050ad,_0x3421ef),{'type':dbH[_0x680d('0x11')]['QueryTypes'][_0x680d('0x14')]}));}}}else{_0xbead36[_0x680d('0x1a')](dbH[_0x680d('0x11')][_0x680d('0x12')](QUERY,{'type':dbH['sequelize'][_0x680d('0x1c')][_0x680d('0x14')]}));}var _0x15a492=path['dirname'](PATH);var _0xc4d841=path[_0x680d('0x1d')](PATH,'.csv');var _0x4e6769=_0x300722[_0x680d('0xe')]&&_0xbead36['length']>0x1;var _0x30c629=[];if(!fs[_0x680d('0x1e')](path[_0x680d('0x1f')](_0x15a492,_0xc4d841))&&_0x4e6769){fs[_0x680d('0x20')](path[_0x680d('0x1f')](_0x15a492,_0xc4d841));}return BPromise['each'](_0xbead36,function(_0x24fc46){_0x30c629[_0x680d('0x1a')](_0x24fc46);})[_0x680d('0x10')](function(){for(var _0x4cb861=0x0;_0x4cb861<_0x30c629[_0x680d('0x17')];_0x4cb861+=0x1){var _0xd241dd;var _0x579b9b=_0x30c629[_0x4cb861];if(_0x4e6769){_0xd241dd=path[_0x680d('0x1f')](_0x15a492,_0xc4d841,util[_0x680d('0x9')](_0x680d('0x21'),_0xc4d841,_0x4cb861,_0x680d('0x22')));}else{_0xd241dd=path[_0x680d('0x1f')](_0x15a492,util[_0x680d('0x9')](_0x680d('0x23'),_0xc4d841,_0x680d('0x22')));}fs[_0x680d('0x24')](_0xd241dd,csv(_0x579b9b));}})[_0x680d('0x10')](function(){if(_0x4e6769){return new Promise(function(_0x396725){zipdir(path[_0x680d('0x1f')](_0x15a492,_0xc4d841),{'saveTo':path[_0x680d('0x1f')](_0x15a492,util['format']('%s.%s',_0xc4d841,'zip'))},function(_0x4e1731,_0x320c25){rimraf(path[_0x680d('0x1f')](_0x15a492,_0xc4d841),function(){});_0x396725('zip\x20finished');});});}})['then'](function(){logger[_0x680d('0x8')](util[_0x680d('0x9')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x680d('0xb')));return analyticExtractedReport(_0x680d('0x25'),_0x4e6769?util[_0x680d('0x9')](_0x680d('0x23'),_0xc4d841,_0x4e6769?'zip':_0x680d('0x22')):null);});})[_0x680d('0x26')](function(_0xb8522){logger[_0x680d('0x8')](util[_0x680d('0x9')](_0x680d('0x27'),EXTRACTED_REPORT_ID,_0x680d('0xb')),util[_0x680d('0x28')](_0xb8522,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x680d('0x29'));})[_0x680d('0x2a')](function(){process[_0x680d('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x2513=['split','length','range','num','isInteger','push','format','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','existsSync','join','%s%d.%s','csv','%s.%s','zip\x20finished','info','CSV','zip','catch','inspect','Failed','finally','util','lodash','to-csv','zip-dir','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','Setting','find','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','Empty'];(function(_0x48a2f3,_0x4c3d5e){var _0x15d69c=function(_0x4a5cfb){while(--_0x4a5cfb){_0x48a2f3['push'](_0x48a2f3['shift']());}};_0x15d69c(++_0x4c3d5e);}(_0x2513,0x1f0));var _0x3251=function(_0x24adca,_0x245839){_0x24adca=_0x24adca-0x0;var _0x47bf56=_0x2513[_0x24adca];return _0x47bf56;};'use strict';var util=require(_0x3251('0x0'));var path=require('path');var _=require(_0x3251('0x1'));var csv=require(_0x3251('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x3251('0x3'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0x3251('0x4'))[_0x3251('0x5')];var logger=require(_0x3251('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x3251('0x7')][0x2]);var QUERY=process[_0x3251('0x7')][0x3];var PATH=process[_0x3251('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x415cbf,_0x9f25f4){var _0x2c4d3e={'status':_0x415cbf};var _0x1cdfcc={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x9f25f4){_0x2c4d3e[_0x3251('0x8')]=_0x9f25f4;}return db[_0x3251('0x9')][_0x3251('0xa')](_0x2c4d3e,_0x1cdfcc);}function main(){var _0x173da9=0x1388;var _0x242154;logger['info'](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'));return db[_0x3251('0xb')][_0x3251('0xc')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x3251('0xd')]})[_0x3251('0xe')](function(_0x150978){if(_0x150978){_0x242154=_0x150978;_0x173da9=_0x242154['splitSizeCsv']||0x1388;}})[_0x3251('0xe')](function(){return dbH[_0x3251('0xf')][_0x3251('0x10')](util['format'](_0x3251('0x11'),QUERY),{'type':dbH[_0x3251('0xf')][_0x3251('0x12')]['SELECT']});})[_0x3251('0xe')](function(_0x3763b8){if(!_0x3763b8[0x0]['num']){return analyticExtractedReport(_0x3251('0x13'));}var _0x308927=[];var _0x41da26=0x0;if(_0x242154[_0x3251('0x14')]){if(_0x3763b8&&_0x3763b8[_0x3251('0x15')]){var _0x450bb5=_[_0x3251('0x16')](_0x3763b8[0x0][_0x3251('0x17')]/_0x173da9);var _0x1d5fb6=Number[_0x3251('0x18')](_0x3763b8[0x0]['num']/_0x173da9)?_0x3763b8[0x0][_0x3251('0x17')]%_0x173da9:0x0;_0x450bb5['forEach'](function(_0x2162a3){if(_0x2162a3>0x0){_0x41da26+=_0x173da9;}_0x308927[_0x3251('0x19')](dbH[_0x3251('0xf')]['query'](util[_0x3251('0x1a')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x173da9,_0x41da26),{'type':dbH[_0x3251('0xf')][_0x3251('0x12')][_0x3251('0x1b')]}));});if(_0x1d5fb6>0x0){_0x41da26+=_0x173da9;_0x308927['push'](dbH[_0x3251('0xf')]['query'](util['format'](_0x3251('0x1c'),QUERY,_0x1d5fb6,_0x41da26),{'type':dbH[_0x3251('0xf')]['QueryTypes'][_0x3251('0x1b')]}));}}}else{_0x308927['push'](dbH[_0x3251('0xf')][_0x3251('0x10')](QUERY,{'type':dbH[_0x3251('0xf')][_0x3251('0x12')][_0x3251('0x1b')]}));}var _0x563723=path['dirname'](PATH);var _0x37634b=path[_0x3251('0x1d')](PATH,'.csv');var _0x2c272b=_0x242154[_0x3251('0x14')]&&_0x308927[_0x3251('0x15')]>0x1;var _0x7d3184=[];if(!fs[_0x3251('0x1e')](path['join'](_0x563723,_0x37634b))&&_0x2c272b){fs['mkdirSync'](path['join'](_0x563723,_0x37634b));}return BPromise['each'](_0x308927,function(_0x42fe69){_0x7d3184[_0x3251('0x19')](_0x42fe69);})[_0x3251('0xe')](function(){for(var _0x48400f=0x0;_0x48400f<_0x7d3184[_0x3251('0x15')];_0x48400f+=0x1){var _0x7d5fbd;var _0x25e6d4=_0x7d3184[_0x48400f];if(_0x2c272b){_0x7d5fbd=path[_0x3251('0x1f')](_0x563723,_0x37634b,util[_0x3251('0x1a')](_0x3251('0x20'),_0x37634b,_0x48400f,_0x3251('0x21')));}else{_0x7d5fbd=path[_0x3251('0x1f')](_0x563723,util[_0x3251('0x1a')]('%s.%s',_0x37634b,_0x3251('0x21')));}fs['writeFileSync'](_0x7d5fbd,csv(_0x25e6d4));}})[_0x3251('0xe')](function(){if(_0x2c272b){return new Promise(function(_0x51187e){zipdir(path[_0x3251('0x1f')](_0x563723,_0x37634b),{'saveTo':path[_0x3251('0x1f')](_0x563723,util[_0x3251('0x1a')](_0x3251('0x22'),_0x37634b,'zip'))},function(_0x286a7d,_0x1a7a6d){rimraf(path[_0x3251('0x1f')](_0x563723,_0x37634b),function(){});_0x51187e(_0x3251('0x23'));});});}})[_0x3251('0xe')](function(){logger[_0x3251('0x24')](util[_0x3251('0x1a')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x3251('0x25')));return analyticExtractedReport('Completed',_0x2c272b?util[_0x3251('0x1a')](_0x3251('0x22'),_0x37634b,_0x2c272b?_0x3251('0x26'):'csv'):null);});})[_0x3251('0x27')](function(_0x81d3bb){logger[_0x3251('0x24')](util[_0x3251('0x1a')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x3251('0x25')),util[_0x3251('0x28')](_0x81d3bb,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x3251('0x29'));})[_0x3251('0x2a')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index f2e1d66..04d2681 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 _0xd5a8=['find','split','splitSizePdf','then','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','join','createPdfKitDocument','%s%d.%s','%s.%s','pdf','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','createWriteStream','finish','error','end','createPdfFromHTML','path','lodash','util','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','bluebird','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','fill','length','body','push','keys','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','endDate','header','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','black','right','num','Setting'];(function(_0x139b85,_0x5e0691){var _0x1e833f=function(_0xc97932){while(--_0xc97932){_0x139b85['push'](_0x139b85['shift']());}};_0x1e833f(++_0x5e0691);}(_0xd5a8,0x198));var _0x8d5a=function(_0x220ae5,_0x4eceb4){_0x220ae5=_0x220ae5-0x0;var _0x319e72=_0xd5a8[_0x220ae5];return _0x319e72;};'use strict';var _=require(_0x8d5a('0x0'));var fs=require('fs');var util=require(_0x8d5a('0x1'));var path=require('path');var moment=require(_0x8d5a('0x2'));var htmlToPdfmake=require(_0x8d5a('0x3'));var PdfPrinter=require(_0x8d5a('0x4'));var zipdir=require(_0x8d5a('0x5'));var rimraf=require(_0x8d5a('0x6'));var JSDOM=require(_0x8d5a('0x7'))['JSDOM'];var window=new JSDOM('')['window'];var BPromise=require(_0x8d5a('0x8'));var db=require(_0x8d5a('0x9'))['db'];var dbH=require(_0x8d5a('0x9'))[_0x8d5a('0xa')];var logger=require(_0x8d5a('0xb'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x8d5a('0xc')][0x2]);var QUERY=process[_0x8d5a('0xc')][0x3];var PATH=process[_0x8d5a('0xc')][0x4];var NAME=process[_0x8d5a('0xc')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0xc8d44e,_0xa726af){var _0x44d918={'status':_0xc8d44e};var _0x454b40={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xa726af){_0x44d918[_0x8d5a('0xd')]=_0xa726af;}return db[_0x8d5a('0xe')][_0x8d5a('0xf')](_0x44d918,_0x454b40);}function getHeaders(_0x1a646f){return _[_0x8d5a('0x10')](_0x1a646f,function(_0x2f0147){return{'text':_0x2f0147,'style':_0x8d5a('0x11')};});}function getRows(_0x2c46e4,_0x48279f){return _[_0x8d5a('0x10')](_0x48279f,function(_0x392b41){return _(_0x392b41)[_0x8d5a('0x12')](_0x2c46e4)[_0x8d5a('0x10')](function(_0x4b4788){return _0x4b4788?_[_0x8d5a('0x13')](_0x4b4788):'';})['value']();});}function createTable(_0x4ff01c,_0x29da9f){var _0x296b50={'widths':_[_0x8d5a('0x14')](Array(_0x4ff01c[_0x8d5a('0x15')]),0x91),'heights':function(_0x2af095){return _0x2af095===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0xd19c2a=getHeaders(_0x4ff01c);_0x296b50[_0x8d5a('0x16')][_0x8d5a('0x17')](_0xd19c2a);var _0x2a1c64=getRows(_0x4ff01c,_0x29da9f);_0x296b50[_0x8d5a('0x16')]=_0x296b50[_0x8d5a('0x16')]['concat'](_0x2a1c64);return _0x296b50;}function createTables(_0x3b9b1c){var _0xad404=[];var _0xcdf869=_['chunk'](Object[_0x8d5a('0x18')](_0x3b9b1c[0x0]),0x5);_0xcdf869['forEach'](function(_0x53f6ba){_0xad404[_0x8d5a('0x17')](createTable(_0x53f6ba,_0x3b9b1c));});return _0xad404;}function getPDFDocDefinition(_0x2bcc8a){var _0x3d1903=util['format'](_0x8d5a('0x19'),NAME,EXTRACTED_REPORT[_0x8d5a('0x1a')],moment(EXTRACTED_REPORT[_0x8d5a('0x1b')])[_0x8d5a('0x1c')](FORMAT),moment(EXTRACTED_REPORT[_0x8d5a('0x1d')])[_0x8d5a('0x1c')](FORMAT));var _0x286750=[];for(var _0x1dc4b4=0x0;_0x1dc4b4<_0x2bcc8a[_0x8d5a('0x15')];_0x1dc4b4++){var _0x150a21=[];if(_0x1dc4b4===0x0){_0x150a21[_0x8d5a('0x17')]({'text':_0x3d1903,'style':_0x8d5a('0x1e')});}var _0x9aa2d9={'table':_0x2bcc8a[_0x1dc4b4]};if(_0x1dc4b4>0x0){_0x9aa2d9[_0x8d5a('0x1f')]=_0x8d5a('0x20');_0x9aa2d9[_0x8d5a('0x21')]=[0x0,0x46,0x0,0x0];}_0x150a21[_0x8d5a('0x17')](_0x9aa2d9);_0x286750[_0x8d5a('0x17')](_0x150a21);}return{'pageSize':'A4','pageOrientation':_0x8d5a('0x22'),'content':_0x286750,'footer':function(_0xae1ac9,_0x5eed2f){return{'text':_0xae1ac9[_0x8d5a('0x13')]()+_0x8d5a('0x23')+_0x5eed2f,'style':_0x8d5a('0x24')};},'defaultStyle':{'font':_0x8d5a('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x8d5a('0x26')},'footer':{'alignment':_0x8d5a('0x27'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x391120){var _0x255bde=0x1388;var _0x36dd6b;if(!_0x391120[0x0][_0x8d5a('0x28')]){return analyticExtractedReport('Empty');}return db[_0x8d5a('0x29')][_0x8d5a('0x2a')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x8d5a('0x2b'),_0x8d5a('0x2c')]})[_0x8d5a('0x2d')](function(_0x2c76ac){if(_0x2c76ac){_0x36dd6b=_0x2c76ac;_0x255bde=_0x36dd6b[_0x8d5a('0x2c')]||0x3e8;}})[_0x8d5a('0x2d')](function(){var _0x3f5339=[];var _0x17f358=0x0;if(_0x36dd6b['split']){if(_0x391120&&_0x391120[_0x8d5a('0x15')]){var _0xdd89a2=_[_0x8d5a('0x2e')](_0x391120[0x0]['num']/_0x255bde);var _0x5494c6=Number[_0x8d5a('0x2f')](_0x391120[0x0][_0x8d5a('0x28')]/_0x255bde)?_0x391120[0x0][_0x8d5a('0x28')]%_0x255bde:0x0;_0xdd89a2['forEach'](function(_0x231e64){if(_0x231e64>0x0){_0x17f358+=_0x255bde;}_0x3f5339[_0x8d5a('0x17')](dbH[_0x8d5a('0x30')][_0x8d5a('0x31')](util['format'](_0x8d5a('0x32'),QUERY,_0x255bde,_0x17f358),{'type':dbH[_0x8d5a('0x30')][_0x8d5a('0x33')][_0x8d5a('0x34')]}));});if(_0x5494c6>0x0){_0x17f358+=_0x255bde;_0x3f5339[_0x8d5a('0x17')](dbH[_0x8d5a('0x30')][_0x8d5a('0x31')](util['format'](_0x8d5a('0x32'),QUERY,_0x5494c6,_0x17f358),{'type':dbH[_0x8d5a('0x30')][_0x8d5a('0x33')][_0x8d5a('0x34')]}));}}}else{_0x3f5339[_0x8d5a('0x17')](dbH[_0x8d5a('0x30')][_0x8d5a('0x31')](QUERY,{'type':dbH[_0x8d5a('0x30')][_0x8d5a('0x33')][_0x8d5a('0x34')]}));}var _0x1d78be=path[_0x8d5a('0x35')](PATH);var _0x55aa72=path[_0x8d5a('0x36')](PATH,_0x8d5a('0x37'));var _0x3caa7f=_0x36dd6b[_0x8d5a('0x2b')]&&_0x3f5339[_0x8d5a('0x15')]>0x1;var _0xd8607c=[];if(!fs[_0x8d5a('0x38')](path[_0x8d5a('0x39')](_0x1d78be,_0x55aa72))&&_0x3caa7f){fs['mkdirSync'](path['join'](_0x1d78be,_0x55aa72));}return BPromise['each'](_0x3f5339,function(_0x58dabd){_0xd8607c[_0x8d5a('0x17')](_0x58dabd);})[_0x8d5a('0x2d')](function(){var _0x7776bc=[];for(var _0x27deab=0x0;_0x27deab<_0xd8607c[_0x8d5a('0x15')];_0x27deab+=0x1){var _0x34962a=_0xd8607c[_0x27deab];var _0x55a41e=createTables(_['flatten'](_0x34962a));var _0x4140f8;var _0x4c44ee=getPDFDocDefinition(_0x55a41e);var _0x37c06e=getPDFPrinter();var _0x2dd490=_0x37c06e[_0x8d5a('0x3a')](_0x4c44ee);if(_0x3caa7f){_0x4140f8=path[_0x8d5a('0x39')](_0x1d78be,_0x55aa72,util[_0x8d5a('0x1c')](_0x8d5a('0x3b'),_0x55aa72,_0x27deab,'pdf'));}else{_0x4140f8=path['join'](_0x1d78be,util['format'](_0x8d5a('0x3c'),_0x55aa72,_0x8d5a('0x3d')));}_0x7776bc[_0x8d5a('0x17')](writePDFDocument(_0x2dd490,_0x4140f8));}return Promise[_0x8d5a('0x3e')](_0x7776bc);})[_0x8d5a('0x2d')](function(){if(_0x3caa7f){return new Promise(function(_0x231c1e){zipdir(path[_0x8d5a('0x39')](_0x1d78be,_0x55aa72),{'saveTo':path[_0x8d5a('0x39')](_0x1d78be,util[_0x8d5a('0x1c')](_0x8d5a('0x3c'),_0x55aa72,_0x8d5a('0x3f')))},function(){rimraf(path[_0x8d5a('0x39')](_0x1d78be,_0x55aa72),function(){});_0x231c1e(_0x8d5a('0x40'));});});}})[_0x8d5a('0x2d')](function(){if(!_0x3caa7f)return;rimraf(path['join'](_0x1d78be,_0x55aa72),function(){});})['then'](function(){logger[_0x8d5a('0x41')](util['format'](_0x8d5a('0x42'),EXTRACTED_REPORT_ID,_0x8d5a('0x43')));return analyticExtractedReport(_0x8d5a('0x44'),_0x3caa7f?util[_0x8d5a('0x1c')](_0x8d5a('0x3c'),_0x55aa72,_0x3caa7f?_0x8d5a('0x3f'):_0x8d5a('0x3d')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x8d5a('0x41')](util[_0x8d5a('0x1c')](_0x8d5a('0x45'),EXTRACTED_REPORT_ID,'PDF'));return db['AnalyticExtractedReport'][_0x8d5a('0x46')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x8d5a('0x2d')](function(_0x1bdccf){EXTRACTED_REPORT=_0x1bdccf;return dbH[_0x8d5a('0x30')]['query'](util[_0x8d5a('0x1c')](_0x8d5a('0x47'),QUERY),{'type':dbH[_0x8d5a('0x30')]['QueryTypes'][_0x8d5a('0x34')]});})[_0x8d5a('0x2d')](extractReport)[_0x8d5a('0x48')](function(_0x4ae401){logger['info'](util[_0x8d5a('0x1c')](_0x8d5a('0x49'),EXTRACTED_REPORT_ID,'PDF'),util['inspect'](_0x4ae401,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x46c990=new PdfPrinter({'Arial':{'normal':__dirname+_0x8d5a('0x4a'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x8d5a('0x4b'),'bolditalics':__dirname+_0x8d5a('0x4c')}});return _0x46c990;}function getPDFDocDefinitionFromHTML(_0x2fe290,_0x1cd991){var _0x42341a=util['format'](_0x8d5a('0x4d'),_0x1cd991[_0x8d5a('0x4e')],_0x1cd991[_0x8d5a('0x4f')]);var _0x4a8ac0=moment()[_0x8d5a('0x1c')](_0x8d5a('0x50'))[_0x8d5a('0x13')]();var _0x37f13d=htmlToPdfmake(_0x2fe290,{'window':window,'tableAutoSize':!![]});return{'content':[_0x37f13d],'defaultStyle':{'font':_0x8d5a('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x8d5a('0x51'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x8d5a('0x51'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x8d5a('0x51')}},'header':function(){return[{'text':_0x8d5a('0x52'),'style':_0x8d5a('0x1e')}];},'footer':function(_0x4a37d1,_0x31ab67){return[{'text':util[_0x8d5a('0x1c')](_0x8d5a('0x53'),_0x42341a,_0x4a37d1,_0x31ab67,_0x4a8ac0),'style':_0x8d5a('0x24')}];}};}function writePDFDocument(_0x5ab928,_0x49a8d5){return new Promise(function(_0x2bd98a,_0x3307b7){var _0x3ad9b1=_0x5ab928['pipe'](fs[_0x8d5a('0x54')](_0x49a8d5));_0x3ad9b1['on'](_0x8d5a('0x55'),function(){_0x2bd98a(_0x8d5a('0x55'));});_0x3ad9b1['on'](_0x8d5a('0x56'),function(_0x3a0833){_0x3307b7(_0x3a0833);});_0x5ab928[_0x8d5a('0x57')]();});}exports[_0x8d5a('0x58')]=function(_0x4521e8,_0xa8f8c6){var _0x9e159f=getPDFPrinter();var _0x34e77a=getPDFDocDefinitionFromHTML(_0x4521e8,_0xa8f8c6);var _0x26ef00=_0x9e159f[_0x8d5a('0x3a')](_0x34e77a);return writePDFDocument(_0x26ef00,_0xa8f8c6[_0x8d5a('0x59')])[_0x8d5a('0x48')](function(_0xbdee25){throw _0xbdee25;});}; \ No newline at end of file +var _0xb028=['Arial','black','num','Empty','find','then','splitSizePdf','split','range','isInteger','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','dirname','.pdf','existsSync','mkdirSync','join','flatten','createPdfKitDocument','pdf','%s.%s','all','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','PDF','inspect','finally','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','center','Interaction\x20Transcript','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','map','pick','toString','value','length','auto','body','concat','chunk','keys','forEach','push','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','format','endDate','header','pageBreak','before','margin','landscape','footer'];(function(_0x2b381d,_0x156c83){var _0x387024=function(_0x54ea48){while(--_0x54ea48){_0x2b381d['push'](_0x2b381d['shift']());}};_0x387024(++_0x156c83);}(_0xb028,0xec));var _0x8b02=function(_0x1a58b3,_0x2e191e){_0x1a58b3=_0x1a58b3-0x0;var _0xc153b3=_0xb028[_0x1a58b3];return _0xc153b3;};'use strict';var _=require(_0x8b02('0x0'));var fs=require('fs');var util=require(_0x8b02('0x1'));var path=require(_0x8b02('0x2'));var moment=require(_0x8b02('0x3'));var htmlToPdfmake=require(_0x8b02('0x4'));var PdfPrinter=require(_0x8b02('0x5'));var zipdir=require(_0x8b02('0x6'));var rimraf=require(_0x8b02('0x7'));var JSDOM=require(_0x8b02('0x8'))[_0x8b02('0x9')];var window=new JSDOM('')[_0x8b02('0xa')];var BPromise=require('bluebird');var db=require(_0x8b02('0xb'))['db'];var dbH=require(_0x8b02('0xb'))[_0x8b02('0xc')];var logger=require('../../config/logger')(_0x8b02('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0x8b02('0xe')][0x2]);var QUERY=process[_0x8b02('0xe')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x8b02('0xe')][0x5];var FORMAT=_0x8b02('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x10761a,_0x1f0b6b){var _0x2b9838={'status':_0x10761a};var _0x4638cb={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1f0b6b){_0x2b9838[_0x8b02('0x10')]=_0x1f0b6b;}return db['AnalyticExtractedReport'][_0x8b02('0x11')](_0x2b9838,_0x4638cb);}function getHeaders(_0x2f93d5){return _[_0x8b02('0x12')](_0x2f93d5,function(_0x616593){return{'text':_0x616593,'style':'tableHeader'};});}function getRows(_0x44aa6d,_0xcf09aa){return _[_0x8b02('0x12')](_0xcf09aa,function(_0xafc51a){return _(_0xafc51a)[_0x8b02('0x13')](_0x44aa6d)['map'](function(_0x24b1c3){return _0x24b1c3?_[_0x8b02('0x14')](_0x24b1c3):'';})[_0x8b02('0x15')]();});}function createTable(_0x555826,_0x281469){var _0xd84a9b={'widths':_['fill'](Array(_0x555826[_0x8b02('0x16')]),0x91),'heights':function(_0x1710cb){return _0x1710cb===0x0?_0x8b02('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x3bc036=getHeaders(_0x555826);_0xd84a9b[_0x8b02('0x18')]['push'](_0x3bc036);var _0x52a8a7=getRows(_0x555826,_0x281469);_0xd84a9b[_0x8b02('0x18')]=_0xd84a9b['body'][_0x8b02('0x19')](_0x52a8a7);return _0xd84a9b;}function createTables(_0x3dda7e){var _0xbad185=[];var _0x29294e=_[_0x8b02('0x1a')](Object[_0x8b02('0x1b')](_0x3dda7e[0x0]),0x5);_0x29294e[_0x8b02('0x1c')](function(_0x2bd3fb){_0xbad185[_0x8b02('0x1d')](createTable(_0x2bd3fb,_0x3dda7e));});return _0xbad185;}function getPDFDocDefinition(_0x4681f3){var _0x4511c4=util['format'](_0x8b02('0x1e'),NAME,EXTRACTED_REPORT[_0x8b02('0x1f')],moment(EXTRACTED_REPORT['startDate'])[_0x8b02('0x20')](FORMAT),moment(EXTRACTED_REPORT[_0x8b02('0x21')])['format'](FORMAT));var _0x1332a2=[];for(var _0x1c414b=0x0;_0x1c414b<_0x4681f3[_0x8b02('0x16')];_0x1c414b++){var _0x4c47a7=[];if(_0x1c414b===0x0){_0x4c47a7[_0x8b02('0x1d')]({'text':_0x4511c4,'style':_0x8b02('0x22')});}var _0x5cd9b3={'table':_0x4681f3[_0x1c414b]};if(_0x1c414b>0x0){_0x5cd9b3[_0x8b02('0x23')]=_0x8b02('0x24');_0x5cd9b3[_0x8b02('0x25')]=[0x0,0x46,0x0,0x0];}_0x4c47a7[_0x8b02('0x1d')](_0x5cd9b3);_0x1332a2[_0x8b02('0x1d')](_0x4c47a7);}return{'pageSize':'A4','pageOrientation':_0x8b02('0x26'),'content':_0x1332a2,'footer':function(_0x369fb7,_0x4d0d28){return{'text':_0x369fb7[_0x8b02('0x14')]()+'\x20/\x20'+_0x4d0d28,'style':_0x8b02('0x27')};},'defaultStyle':{'font':_0x8b02('0x28')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x8b02('0x29')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x29d67f){var _0x79877=0x1388;var _0x5e5008;if(!_0x29d67f[0x0][_0x8b02('0x2a')]){return analyticExtractedReport(_0x8b02('0x2b'));}return db['Setting'][_0x8b02('0x2c')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizePdf']})[_0x8b02('0x2d')](function(_0x4401b4){if(_0x4401b4){_0x5e5008=_0x4401b4;_0x79877=_0x5e5008[_0x8b02('0x2e')]||0x3e8;}})[_0x8b02('0x2d')](function(){var _0x4591d1=[];var _0x548c47=0x0;if(_0x5e5008[_0x8b02('0x2f')]){if(_0x29d67f&&_0x29d67f[_0x8b02('0x16')]){var _0xb3c5be=_[_0x8b02('0x30')](_0x29d67f[0x0][_0x8b02('0x2a')]/_0x79877);var _0x3fedcb=Number[_0x8b02('0x31')](_0x29d67f[0x0][_0x8b02('0x2a')]/_0x79877)?_0x29d67f[0x0][_0x8b02('0x2a')]%_0x79877:0x0;_0xb3c5be[_0x8b02('0x1c')](function(_0x1e4b8e){if(_0x1e4b8e>0x0){_0x548c47+=_0x79877;}_0x4591d1[_0x8b02('0x1d')](dbH['sequelize'][_0x8b02('0x32')](util[_0x8b02('0x20')](_0x8b02('0x33'),QUERY,_0x79877,_0x548c47),{'type':dbH[_0x8b02('0x34')][_0x8b02('0x35')][_0x8b02('0x36')]}));});if(_0x3fedcb>0x0){_0x548c47+=_0x79877;_0x4591d1[_0x8b02('0x1d')](dbH[_0x8b02('0x34')]['query'](util[_0x8b02('0x20')](_0x8b02('0x33'),QUERY,_0x3fedcb,_0x548c47),{'type':dbH[_0x8b02('0x34')]['QueryTypes'][_0x8b02('0x36')]}));}}}else{_0x4591d1[_0x8b02('0x1d')](dbH[_0x8b02('0x34')][_0x8b02('0x32')](QUERY,{'type':dbH[_0x8b02('0x34')]['QueryTypes'][_0x8b02('0x36')]}));}var _0x580ebd=path[_0x8b02('0x37')](PATH);var _0x38aa72=path['basename'](PATH,_0x8b02('0x38'));var _0x583b59=_0x5e5008[_0x8b02('0x2f')]&&_0x4591d1[_0x8b02('0x16')]>0x1;var _0x101340=[];if(!fs[_0x8b02('0x39')](path['join'](_0x580ebd,_0x38aa72))&&_0x583b59){fs[_0x8b02('0x3a')](path[_0x8b02('0x3b')](_0x580ebd,_0x38aa72));}return BPromise['each'](_0x4591d1,function(_0xcf8353){_0x101340[_0x8b02('0x1d')](_0xcf8353);})[_0x8b02('0x2d')](function(){var _0x26e728=[];for(var _0x3b7e33=0x0;_0x3b7e33<_0x101340[_0x8b02('0x16')];_0x3b7e33+=0x1){var _0x2240e5=_0x101340[_0x3b7e33];var _0x59f5c0=createTables(_[_0x8b02('0x3c')](_0x2240e5));var _0x167292;var _0x27dc12=getPDFDocDefinition(_0x59f5c0);var _0x5008c5=getPDFPrinter();var _0xe50647=_0x5008c5[_0x8b02('0x3d')](_0x27dc12);if(_0x583b59){_0x167292=path[_0x8b02('0x3b')](_0x580ebd,_0x38aa72,util[_0x8b02('0x20')]('%s%d.%s',_0x38aa72,_0x3b7e33,_0x8b02('0x3e')));}else{_0x167292=path['join'](_0x580ebd,util['format'](_0x8b02('0x3f'),_0x38aa72,_0x8b02('0x3e')));}_0x26e728[_0x8b02('0x1d')](writePDFDocument(_0xe50647,_0x167292));}return Promise[_0x8b02('0x40')](_0x26e728);})[_0x8b02('0x2d')](function(){if(_0x583b59){return new Promise(function(_0x2691f8){zipdir(path[_0x8b02('0x3b')](_0x580ebd,_0x38aa72),{'saveTo':path[_0x8b02('0x3b')](_0x580ebd,util['format'](_0x8b02('0x3f'),_0x38aa72,'zip'))},function(){rimraf(path[_0x8b02('0x3b')](_0x580ebd,_0x38aa72),function(){});_0x2691f8('zip\x20finished');});});}})[_0x8b02('0x2d')](function(){if(!_0x583b59)return;rimraf(path[_0x8b02('0x3b')](_0x580ebd,_0x38aa72),function(){});})[_0x8b02('0x2d')](function(){logger[_0x8b02('0x41')](util[_0x8b02('0x20')](_0x8b02('0x42'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x8b02('0x43'),_0x583b59?util[_0x8b02('0x20')]('%s.%s',_0x38aa72,_0x583b59?_0x8b02('0x44'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x8b02('0x41')](util[_0x8b02('0x20')](_0x8b02('0x45'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x8b02('0x46')][_0x8b02('0x47')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x37f3d8){EXTRACTED_REPORT=_0x37f3d8;return dbH['sequelize'][_0x8b02('0x32')](util['format'](_0x8b02('0x48'),QUERY),{'type':dbH[_0x8b02('0x34')][_0x8b02('0x35')]['SELECT']});})['then'](extractReport)[_0x8b02('0x49')](function(_0x2a8977){logger[_0x8b02('0x41')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x8b02('0x4a')),util[_0x8b02('0x4b')](_0x2a8977,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x8b02('0x4c')](function(){process[_0x8b02('0x4d')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x1fae09=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x8b02('0x4e'),'italics':__dirname+_0x8b02('0x4f'),'bolditalics':__dirname+_0x8b02('0x50')}});return _0x1fae09;}function getPDFDocDefinitionFromHTML(_0x58db01,_0x3cd656){var _0x536e80=util[_0x8b02('0x20')](_0x8b02('0x51'),_0x3cd656[_0x8b02('0x52')],_0x3cd656[_0x8b02('0x53')]);var _0x1d78b7=moment()[_0x8b02('0x20')]('YYYY-MM-DD')[_0x8b02('0x14')]();var _0x542cdf=htmlToPdfmake(_0x58db01,{'window':window,'tableAutoSize':!![]});return{'content':[_0x542cdf],'defaultStyle':{'font':_0x8b02('0x28')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x8b02('0x54'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x8b02('0x55'),'style':_0x8b02('0x22')}];},'footer':function(_0x58da23,_0x5501f6){return[{'text':util['format']('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x536e80,_0x58da23,_0x5501f6,_0x1d78b7),'style':'footer'}];}};}function writePDFDocument(_0x11d0ae,_0x5fb1d7){return new Promise(function(_0x5e9dd7,_0x5bde14){var _0x5f0f6f=_0x11d0ae[_0x8b02('0x56')](fs[_0x8b02('0x57')](_0x5fb1d7));_0x5f0f6f['on']('finish',function(){_0x5e9dd7(_0x8b02('0x58'));});_0x5f0f6f['on'](_0x8b02('0x59'),function(_0x2429a0){_0x5bde14(_0x2429a0);});_0x11d0ae[_0x8b02('0x5a')]();});}exports[_0x8b02('0x5b')]=function(_0x3a9bfa,_0x309a08){var _0x447763=getPDFPrinter();var _0x3b73de=getPDFDocDefinitionFromHTML(_0x3a9bfa,_0x309a08);var _0x366078=_0x447763[_0x8b02('0x3d')](_0x3b73de);return writePDFDocument(_0x366078,_0x309a08['path'])['catch'](function(_0x4f8e90){throw _0x4f8e90;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index d59a85c..9a8c2b0 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 _0x1794=['../../mysqldb','argv','savename','AnalyticExtractedReport','update','format','Setting','find','split','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','writeFileSync','binary','%s.%s','zip','zip\x20finished','XLSX','Completed','catch','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','path','lodash','json2xls','bluebird','zip-dir','rimraf'];(function(_0x7a3220,_0x1c9e8d){var _0x4801cc=function(_0xcd000f){while(--_0xcd000f){_0x7a3220['push'](_0x7a3220['shift']());}};_0x4801cc(++_0x1c9e8d);}(_0x1794,0xc2));var _0x4179=function(_0x2256c9,_0x5c97a7){_0x2256c9=_0x2256c9-0x0;var _0x27ec38=_0x1794[_0x2256c9];return _0x27ec38;};'use strict';var util=require('util');var path=require(_0x4179('0x0'));var _=require(_0x4179('0x1'));var fs=require('fs');var json2xls=require(_0x4179('0x2'));var BPromise=require(_0x4179('0x3'));var zipdir=require(_0x4179('0x4'));var rimraf=require(_0x4179('0x5'));var db=require(_0x4179('0x6'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x4179('0x7')][0x3];var PATH=process[_0x4179('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xbde556,_0x33b0cc){var _0x27d570={'status':_0xbde556};var _0x1a708c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x33b0cc){_0x27d570[_0x4179('0x8')]=_0x33b0cc;}return db[_0x4179('0x9')][_0x4179('0xa')](_0x27d570,_0x1a708c);}function main(){var _0xe7c563=0x1388;var _0x2c9578;logger['info'](util[_0x4179('0xb')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'));return db[_0x4179('0xc')][_0x4179('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4179('0xe'),'splitSizeXlsx']})[_0x4179('0xf')](function(_0x2bb05a){if(_0x2bb05a){_0x2c9578=_0x2bb05a;_0xe7c563=_0x2c9578['splitSizeXlsx']||0x1388;}})[_0x4179('0xf')](function(){return dbH[_0x4179('0x10')][_0x4179('0x11')](util['format'](_0x4179('0x12'),QUERY),{'type':dbH['sequelize'][_0x4179('0x13')][_0x4179('0x14')]});})[_0x4179('0xf')](function(_0x36e28d){if(!_0x36e28d[0x0][_0x4179('0x15')]){return analyticExtractedReport(_0x4179('0x16'));}var _0x2d90f2=[];var _0x453be7=0x0;if(_0x2c9578[_0x4179('0xe')]){if(_0x36e28d&&_0x36e28d[_0x4179('0x17')]){var _0x30b6e9=_[_0x4179('0x18')](_0x36e28d[0x0][_0x4179('0x15')]/_0xe7c563);var _0x43211d=Number[_0x4179('0x19')](_0x36e28d[0x0][_0x4179('0x15')]/_0xe7c563)?_0x36e28d[0x0][_0x4179('0x15')]%_0xe7c563:0x0;_0x30b6e9[_0x4179('0x1a')](function(_0x262876){if(_0x262876>0x0){_0x453be7+=_0xe7c563;}_0x2d90f2[_0x4179('0x1b')](dbH[_0x4179('0x10')][_0x4179('0x11')](util[_0x4179('0xb')](_0x4179('0x1c'),QUERY,_0xe7c563,_0x453be7),{'type':dbH['sequelize'][_0x4179('0x13')][_0x4179('0x14')]}));});if(_0x43211d>0x0){_0x453be7+=_0xe7c563;_0x2d90f2[_0x4179('0x1b')](dbH[_0x4179('0x10')][_0x4179('0x11')](util[_0x4179('0xb')](_0x4179('0x1c'),QUERY,_0x43211d,_0x453be7),{'type':dbH[_0x4179('0x10')]['QueryTypes'][_0x4179('0x14')]}));}}}else{_0x2d90f2[_0x4179('0x1b')](dbH[_0x4179('0x10')][_0x4179('0x11')](QUERY,{'type':dbH['sequelize'][_0x4179('0x13')][_0x4179('0x14')]}));}var _0xbd76cc=path[_0x4179('0x1d')](PATH);var _0x1f0426=path[_0x4179('0x1e')](PATH,_0x4179('0x1f'));var _0x1ced3d=_0x2c9578['split']&&_0x2d90f2[_0x4179('0x17')]>0x1;var _0x275d28=[];if(!fs[_0x4179('0x20')](path[_0x4179('0x21')](_0xbd76cc,_0x1f0426))&&_0x1ced3d){fs[_0x4179('0x22')](path[_0x4179('0x21')](_0xbd76cc,_0x1f0426));}return BPromise[_0x4179('0x23')](_0x2d90f2,function(_0x58f2a7){_0x275d28[_0x4179('0x1b')](_0x58f2a7);})[_0x4179('0xf')](function(){for(var _0x5ee7b1=0x0;_0x5ee7b1<_0x275d28['length'];_0x5ee7b1+=0x1){var _0x2d1cf4;var _0x146efa=_0x275d28[_0x5ee7b1];if(_0x1ced3d){_0x2d1cf4=path[_0x4179('0x21')](_0xbd76cc,_0x1f0426,util['format'](_0x4179('0x24'),_0x1f0426,_0x5ee7b1,_0x4179('0x25')));}else{_0x2d1cf4=path[_0x4179('0x21')](_0xbd76cc,util[_0x4179('0xb')]('%s.%s',_0x1f0426,_0x4179('0x25')));}fs[_0x4179('0x26')](_0x2d1cf4,json2xls(_0x146efa),_0x4179('0x27'));}})[_0x4179('0xf')](function(){if(_0x1ced3d){return new Promise(function(_0x2228fc){zipdir(path[_0x4179('0x21')](_0xbd76cc,_0x1f0426),{'saveTo':path[_0x4179('0x21')](_0xbd76cc,util['format'](_0x4179('0x28'),_0x1f0426,_0x4179('0x29')))},function(_0x59240b,_0x3d255b){rimraf(path[_0x4179('0x21')](_0xbd76cc,_0x1f0426),function(){});_0x2228fc(_0x4179('0x2a'));});});}})[_0x4179('0xf')](function(){logger['info'](util[_0x4179('0xb')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x4179('0x2b')));return analyticExtractedReport(_0x4179('0x2c'),_0x1ced3d?util[_0x4179('0xb')](_0x4179('0x28'),_0x1f0426,_0x1ced3d?_0x4179('0x29'):_0x4179('0x25')):null);});})[_0x4179('0x2d')](function(_0x1cfbd7){logger[_0x4179('0x2e')](util[_0x4179('0xb')](_0x4179('0x2f'),EXTRACTED_REPORT_ID,_0x4179('0x2b')),util['inspect'](_0x1cfbd7,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x4179('0x30'));})[_0x4179('0x31')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0xc3b7=['path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','join','mkdirSync','each','xlsx','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','%s.%s','inspect','Failed'];(function(_0x5105e8,_0x44a2e0){var _0x53bbf5=function(_0x29dfb8){while(--_0x29dfb8){_0x5105e8['push'](_0x5105e8['shift']());}};_0x53bbf5(++_0x44a2e0);}(_0xc3b7,0xb4));var _0x7c3b=function(_0x4c0d73,_0x5798e3){_0x4c0d73=_0x4c0d73-0x0;var _0x3a1578=_0xc3b7[_0x4c0d73];return _0x3a1578;};'use strict';var util=require('util');var path=require(_0x7c3b('0x0'));var _=require(_0x7c3b('0x1'));var fs=require('fs');var json2xls=require(_0x7c3b('0x2'));var BPromise=require(_0x7c3b('0x3'));var zipdir=require(_0x7c3b('0x4'));var rimraf=require(_0x7c3b('0x5'));var db=require(_0x7c3b('0x6'))['db'];var dbH=require(_0x7c3b('0x6'))[_0x7c3b('0x7')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x7c3b('0x8')][0x2]);var QUERY=process[_0x7c3b('0x8')][0x3];var PATH=process[_0x7c3b('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1bc2d8,_0x47d9a7){var _0x218be1={'status':_0x1bc2d8};var _0x1e03c0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x47d9a7){_0x218be1[_0x7c3b('0x9')]=_0x47d9a7;}return db[_0x7c3b('0xa')][_0x7c3b('0xb')](_0x218be1,_0x1e03c0);}function main(){var _0x46a479=0x1388;var _0x23f373;logger[_0x7c3b('0xc')](util[_0x7c3b('0xd')](_0x7c3b('0xe'),EXTRACTED_REPORT_ID,_0x7c3b('0xf')));return db[_0x7c3b('0x10')][_0x7c3b('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x7c3b('0x12'),'splitSizeXlsx']})[_0x7c3b('0x13')](function(_0x455145){if(_0x455145){_0x23f373=_0x455145;_0x46a479=_0x23f373['splitSizeXlsx']||0x1388;}})[_0x7c3b('0x13')](function(){return dbH[_0x7c3b('0x14')][_0x7c3b('0x15')](util['format'](_0x7c3b('0x16'),QUERY),{'type':dbH[_0x7c3b('0x14')][_0x7c3b('0x17')][_0x7c3b('0x18')]});})['then'](function(_0x6ceff0){if(!_0x6ceff0[0x0][_0x7c3b('0x19')]){return analyticExtractedReport('Empty');}var _0x165c69=[];var _0x128f02=0x0;if(_0x23f373[_0x7c3b('0x12')]){if(_0x6ceff0&&_0x6ceff0[_0x7c3b('0x1a')]){var _0x1069e0=_[_0x7c3b('0x1b')](_0x6ceff0[0x0]['num']/_0x46a479);var _0x123667=Number['isInteger'](_0x6ceff0[0x0][_0x7c3b('0x19')]/_0x46a479)?_0x6ceff0[0x0]['num']%_0x46a479:0x0;_0x1069e0[_0x7c3b('0x1c')](function(_0x4f5048){if(_0x4f5048>0x0){_0x128f02+=_0x46a479;}_0x165c69[_0x7c3b('0x1d')](dbH[_0x7c3b('0x14')][_0x7c3b('0x15')](util[_0x7c3b('0xd')](_0x7c3b('0x1e'),QUERY,_0x46a479,_0x128f02),{'type':dbH['sequelize'][_0x7c3b('0x17')][_0x7c3b('0x18')]}));});if(_0x123667>0x0){_0x128f02+=_0x46a479;_0x165c69['push'](dbH[_0x7c3b('0x14')]['query'](util[_0x7c3b('0xd')](_0x7c3b('0x1e'),QUERY,_0x123667,_0x128f02),{'type':dbH[_0x7c3b('0x14')][_0x7c3b('0x17')][_0x7c3b('0x18')]}));}}}else{_0x165c69[_0x7c3b('0x1d')](dbH[_0x7c3b('0x14')]['query'](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x7c3b('0x18')]}));}var _0xad6455=path[_0x7c3b('0x1f')](PATH);var _0x39de0d=path[_0x7c3b('0x20')](PATH,'.xlsx');var _0xd39491=_0x23f373['split']&&_0x165c69[_0x7c3b('0x1a')]>0x1;var _0x94c0af=[];if(!fs['existsSync'](path[_0x7c3b('0x21')](_0xad6455,_0x39de0d))&&_0xd39491){fs[_0x7c3b('0x22')](path[_0x7c3b('0x21')](_0xad6455,_0x39de0d));}return BPromise[_0x7c3b('0x23')](_0x165c69,function(_0x5938e0){_0x94c0af[_0x7c3b('0x1d')](_0x5938e0);})['then'](function(){for(var _0x345eef=0x0;_0x345eef<_0x94c0af['length'];_0x345eef+=0x1){var _0x130ff0;var _0x57cf01=_0x94c0af[_0x345eef];if(_0xd39491){_0x130ff0=path[_0x7c3b('0x21')](_0xad6455,_0x39de0d,util[_0x7c3b('0xd')]('%s%d.%s',_0x39de0d,_0x345eef,_0x7c3b('0x24')));}else{_0x130ff0=path[_0x7c3b('0x21')](_0xad6455,util[_0x7c3b('0xd')]('%s.%s',_0x39de0d,_0x7c3b('0x24')));}fs[_0x7c3b('0x25')](_0x130ff0,json2xls(_0x57cf01),_0x7c3b('0x26'));}})['then'](function(){if(_0xd39491){return new Promise(function(_0x5ef9ca){zipdir(path['join'](_0xad6455,_0x39de0d),{'saveTo':path[_0x7c3b('0x21')](_0xad6455,util['format']('%s.%s',_0x39de0d,_0x7c3b('0x27')))},function(_0x514073,_0x79efe3){rimraf(path[_0x7c3b('0x21')](_0xad6455,_0x39de0d),function(){});_0x5ef9ca(_0x7c3b('0x28'));});});}})[_0x7c3b('0x13')](function(){logger[_0x7c3b('0xc')](util['format'](_0x7c3b('0x29'),EXTRACTED_REPORT_ID,_0x7c3b('0xf')));return analyticExtractedReport('Completed',_0xd39491?util[_0x7c3b('0xd')](_0x7c3b('0x2a'),_0x39de0d,_0xd39491?'zip':'xlsx'):null);});})['catch'](function(_0x1b00d1){logger[_0x7c3b('0xc')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x7c3b('0xf')),util[_0x7c3b('0x2b')](_0x1b00d1,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x7c3b('0x2c'));})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 9d2ece8..1b8f916 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 _0xc1fd=['bulkCreate','sortBy','error','rewrite','util','Interval','findAll','then','intervals','models','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','extensions','extension','type','Set','format','CDR(type)=%s','context','priority','VoiceExtensionId','inbound','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','push','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','interval','IntervalId','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime','last','concat','transaction','destroy'];(function(_0x1b0661,_0x6816b1){var _0x3b94d1=function(_0x4d3d75){while(--_0x4d3d75){_0x1b0661['push'](_0x1b0661['shift']());}};_0x3b94d1(++_0x6816b1);}(_0xc1fd,0x1ae));var _0xdc1f=function(_0x2784b8,_0x989cac){_0x2784b8=_0x2784b8-0x0;var _0xbde0da=_0xc1fd[_0x2784b8];return _0xbde0da;};'use strict';var _=require('lodash');var util=require(_0xdc1f('0x0'));function rewrite(_0x5d5e09,_0x5783e2){var _0x429447=this;return _0x5d5e09['models'][_0xdc1f('0x1')][_0xdc1f('0x2')]({'raw':!![]})[_0xdc1f('0x3')](function(_0x1aa12f){_0x429447[_0xdc1f('0x4')]=_0x1aa12f;return _0x5d5e09[_0xdc1f('0x5')][_0xdc1f('0x6')]['findAll']({'where':{'IntervalId':_0x5783e2['IntervalId']},'raw':!![]});})['then'](function(_0xa47cf3){return _0x5d5e09[_0xdc1f('0x5')][_0xdc1f('0x6')][_0xdc1f('0x2')]({'where':{'exten':{'$in':_[_0xdc1f('0x7')](_[_0xdc1f('0x8')](_0xa47cf3,_0xdc1f('0x9')))}},'order':[{'raw':_0xdc1f('0xa')}],'raw':!![]});})[_0xdc1f('0x3')](function(_0x4cb2c2){var _0xbe3230=_['filter'](_0x4cb2c2,{'priority':'1'});var _0x2ea05c=_[_0xdc1f('0xb')](_0x4cb2c2,{'isApp':0x1});var _0x416c7d=_[_0xdc1f('0xc')](_0x2ea05c,_0xdc1f('0x9'));var _0x4eafdf=[_0xdc1f('0xd'),_0xdc1f('0xe')];var _0x4070da=[];var _0x36d2e3=[];for(var _0x39ae3f in _0x416c7d){if(_0x416c7d['hasOwnProperty'](_0x39ae3f)){_0x429447['priority']=0x2;_0x429447[_0xdc1f('0xf')]=[];_0x429447[_0xdc1f('0x10')]=_['find'](_0xbe3230,{'exten':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x9')]});_0x429447['extensions']['push']({'type':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x11')],'app':_0xdc1f('0x12'),'appdata':util[_0xdc1f('0x13')](_0xdc1f('0x14'),_0x416c7d[_0x39ae3f][0x0]['type']),'context':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x15')],'exten':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x9')],'priority':_0x429447[_0xdc1f('0x16')]++,'VoiceExtensionId':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x17')]});if(_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x11')]===_0xdc1f('0x18')){_0x429447['extensions']['push']({'type':_0x416c7d[_0x39ae3f][0x0]['type'],'app':'Set','appdata':_0xdc1f('0x19')+_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x17')],'context':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x15')],'exten':_0x416c7d[_0x39ae3f][0x0]['exten'],'priority':_0x429447[_0xdc1f('0x16')]++,'VoiceExtensionId':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x17')]});}else if(_0x416c7d[_0x39ae3f][0x0]['type']===_0xdc1f('0x1a')){if(_0x429447[_0xdc1f('0x10')]){_0x429447[_0xdc1f('0xf')]['push']({'type':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x11')],'app':'Set','appdata':_0xdc1f('0x1b')+(_0x429447[_0xdc1f('0x10')][_0xdc1f('0x1c')]?_0xdc1f('0x1d')+_0x429447[_0xdc1f('0x10')][_0xdc1f('0x1c')]+'}':_0xdc1f('0x1e')),'context':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x15')],'exten':_0x416c7d[_0x39ae3f][0x0]['exten'],'priority':_0x429447['priority']++,'VoiceExtensionId':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x17')]});}_0x429447[_0xdc1f('0xf')][_0xdc1f('0x1f')]({'type':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x11')],'app':_0xdc1f('0x12'),'appdata':_0xdc1f('0x19')+_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x17')],'context':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x15')],'exten':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x9')],'priority':_0x429447['priority']++,'VoiceExtensionId':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x17')]});var _0x38f0f5=_0x429447[_0xdc1f('0x16')]++;_0x429447[_0xdc1f('0xf')][_0xdc1f('0x1f')]({'type':_0x416c7d[_0x39ae3f][0x0]['type'],'app':_0xdc1f('0x20'),'appdata':_0xdc1f('0x21')+(_0x38f0f5+0x2)+_0xdc1f('0x22')+(_0x38f0f5+0x1)+')','context':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x15')],'exten':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x9')],'priority':_0x38f0f5,'VoiceExtensionId':_0x416c7d[_0x39ae3f][0x0]['VoiceExtensionId']});if(_0x429447[_0xdc1f('0x10')]){_0x429447[_0xdc1f('0xf')][_0xdc1f('0x1f')]({'type':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x11')],'app':_0xdc1f('0x12'),'appdata':_0x429447[_0xdc1f('0x10')]['cutdigits']?_0xdc1f('0x23')+_0x429447[_0xdc1f('0x10')]['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x416c7d[_0x39ae3f][0x0]['context'],'exten':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x9')],'priority':_0x429447[_0xdc1f('0x16')]++,'VoiceExtensionId':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x17')]});}_0x429447[_0xdc1f('0xf')][_0xdc1f('0x1f')]({'type':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x11')],'app':'Set','appdata':_0xdc1f('0x24')+_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x17')],'context':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x15')],'exten':_0x416c7d[_0x39ae3f][0x0]['exten'],'priority':_0x429447[_0xdc1f('0x16')]++,'VoiceExtensionId':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x17')]});if(_0x429447[_0xdc1f('0x10')]&&_0x429447[_0xdc1f('0x10')][_0xdc1f('0x25')]('recordingFormat')&&_0x429447['extension'][_0xdc1f('0x26')]!==_0xdc1f('0x27')){_0x429447[_0xdc1f('0xf')][_0xdc1f('0x1f')]({'type':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x11')],'app':_0xdc1f('0x12'),'appdata':_0xdc1f('0x28'),'context':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x15')],'exten':_0x416c7d[_0x39ae3f][0x0]['exten'],'priority':_0x429447[_0xdc1f('0x16')]++,'VoiceExtensionId':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x17')]});_0x429447[_0xdc1f('0xf')][_0xdc1f('0x1f')]({'type':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x11')],'app':'Set','appdata':_0xdc1f('0x29')+_0x429447[_0xdc1f('0x10')]['recordingFormat']||_0xdc1f('0x2a'),'context':_0x416c7d[_0x39ae3f][0x0]['context'],'exten':_0x416c7d[_0x39ae3f][0x0]['exten'],'priority':_0x429447[_0xdc1f('0x16')]++,'VoiceExtensionId':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x17')]});}}_0x429447[_0xdc1f('0xf')][_0xdc1f('0x1f')]({'type':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x11')],'app':_0xdc1f('0x12'),'appdata':_0xdc1f('0x2b'),'context':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x15')],'exten':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x9')],'priority':_0x429447[_0xdc1f('0x16')]++,'VoiceExtensionId':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x17')]});_0x429447[_0xdc1f('0xf')][_0xdc1f('0x1f')]({'type':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x11')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x15')],'exten':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x9')],'priority':_0x429447[_0xdc1f('0x16')]++,'VoiceExtensionId':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x17')]});_0x429447[_0xdc1f('0xf')]['push']({'type':_0x416c7d[_0x39ae3f][0x0]['type'],'app':_0xdc1f('0x12'),'appdata':_0xdc1f('0x2c'),'context':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x15')],'exten':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x9')],'priority':_0x429447[_0xdc1f('0x16')]++,'VoiceExtensionId':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x17')]});for(var _0x4219f1=0x0,_0x588967=0x0;_0x4219f1<_0x416c7d[_0x39ae3f][_0xdc1f('0x2d')];_0x4219f1+=0x1,_0x588967=0x0){var _0xf7af58=_0x416c7d[_0x39ae3f][_0x4219f1];if(_0xf7af58['type']){_0xf7af58[_0xdc1f('0x11')]=_0xf7af58[_0xdc1f('0x11')][_0xdc1f('0x2e')]();}var _0x2b28f2=[];var _0x21f233=[];delete _0xf7af58['id'];delete _0xf7af58[_0xdc1f('0x2f')];delete _0xf7af58['updatedAt'];var _0xbbd8ec=_0xf7af58[_0xdc1f('0x30')]!=='*,*,*,*'?[_0xf7af58['interval']]:_0xf7af58[_0xdc1f('0x31')]?_['map'](_[_0xdc1f('0xb')](_0x429447[_0xdc1f('0x4')],{'IntervalId':_0xf7af58['IntervalId']}),_0xdc1f('0x30')):[];if(_0xf7af58[_0xdc1f('0x25')](_0xdc1f('0x32'))){if(_0xf7af58['tag']&&_0xf7af58['tag']!=='--'){_0x2b28f2[_0xdc1f('0x1f')]({'type':_0xf7af58[_0xdc1f('0x11')],'app':_0xdc1f('0x12'),'appdata':_0xdc1f('0x33')+_0xf7af58[_0xdc1f('0x32')],'context':_0xf7af58[_0xdc1f('0x15')],'exten':_0xf7af58['exten'],'priority':_0xbbd8ec[_0xdc1f('0x2d')]+_0x429447['priority']+_0x588967++,'VoiceExtensionId':_0xf7af58[_0xdc1f('0x17')]});}}if(_0xf7af58['type']===_0xdc1f('0x1a')&&_0xf7af58['hasOwnProperty']('callerID')){if(_0xf7af58[_0xdc1f('0x34')]){_0x2b28f2[_0xdc1f('0x1f')]({'type':_0xf7af58[_0xdc1f('0x11')],'app':_0xdc1f('0x20'),'appdata':_0xdc1f('0x35')+_0xf7af58['callerID']+')','context':_0xf7af58[_0xdc1f('0x15')],'exten':_0xf7af58['exten'],'priority':_0xbbd8ec[_0xdc1f('0x2d')]+_0x429447[_0xdc1f('0x16')]+_0x588967++,'VoiceExtensionId':_0xf7af58[_0xdc1f('0x17')]});}else{_0x2b28f2['push']({'type':_0xf7af58[_0xdc1f('0x11')],'app':_0xdc1f('0x20'),'appdata':_0xdc1f('0x36'),'context':_0xf7af58[_0xdc1f('0x15')],'exten':_0xf7af58[_0xdc1f('0x9')],'priority':_0xbbd8ec[_0xdc1f('0x2d')]+_0x429447[_0xdc1f('0x16')]+_0x588967++,'VoiceExtensionId':_0xf7af58['VoiceExtensionId']});}}if(_0xf7af58[_0xdc1f('0x25')](_0xdc1f('0x37'))){if(_0x4eafdf[_0xdc1f('0x38')](_0xf7af58['app'][_0xdc1f('0x2e')]())>=0x0&&_0xf7af58[_0xdc1f('0x39')]!=='custom'){if(_0xf7af58[_0xdc1f('0x37')]){_0x2b28f2['push']({'type':_0xf7af58[_0xdc1f('0x11')],'app':'ExecIf','appdata':_0xdc1f('0x3a'),'context':_0xf7af58[_0xdc1f('0x15')],'exten':_0xf7af58[_0xdc1f('0x9')],'priority':_0xbbd8ec[_0xdc1f('0x2d')]+_0x429447[_0xdc1f('0x16')]+_0x588967++,'VoiceExtensionId':_0xf7af58[_0xdc1f('0x17')]});_0x2b28f2[_0xdc1f('0x1f')]({'type':_0xf7af58[_0xdc1f('0x11')],'app':_0xdc1f('0x12'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0xf7af58[_0xdc1f('0x15')],'exten':_0xf7af58[_0xdc1f('0x9')],'priority':_0xbbd8ec[_0xdc1f('0x2d')]+_0x429447[_0xdc1f('0x16')]+_0x588967++,'VoiceExtensionId':_0xf7af58['VoiceExtensionId']});}else{_0x2b28f2[_0xdc1f('0x1f')]({'type':_0xf7af58['type'],'app':_0xdc1f('0x20'),'appdata':_0xdc1f('0x3b'),'context':_0xf7af58[_0xdc1f('0x15')],'exten':_0xf7af58['exten'],'priority':_0xbbd8ec[_0xdc1f('0x2d')]+_0x429447[_0xdc1f('0x16')]+_0x588967++,'VoiceExtensionId':_0xf7af58[_0xdc1f('0x17')]});_0x2b28f2[_0xdc1f('0x1f')]({'type':_0xf7af58[_0xdc1f('0x11')],'app':_0xdc1f('0x12'),'appdata':_0xdc1f('0x3c'),'context':_0xf7af58[_0xdc1f('0x15')],'exten':_0xf7af58[_0xdc1f('0x9')],'priority':_0xbbd8ec['length']+_0x429447[_0xdc1f('0x16')]+_0x588967++,'VoiceExtensionId':_0xf7af58['VoiceExtensionId']});}}}for(var _0xfa6e17=0x0;_0xfa6e17<_0xbbd8ec['length'];_0xfa6e17+=0x1){var _0x563c75=_0x429447[_0xdc1f('0x16')]+_0xbbd8ec[_0xdc1f('0x2d')];var _0x4d91ee=_0xfa6e17===_0xbbd8ec['length']-0x1?_0x429447[_0xdc1f('0x16')]+_0x2b28f2['length']+_0x21f233[_0xdc1f('0x2d')]+0x2:_0x429447[_0xdc1f('0x16')]+_0xfa6e17+0x1;_0x2b28f2[_0xdc1f('0x3d')](_0xfa6e17,0x0,{'type':_0xf7af58['type'],'app':_0xdc1f('0x3e'),'appdata':_0xbbd8ec[_0xfa6e17]+'?'+_0xf7af58[_0xdc1f('0x15')]+',${EXTEN},'+_0x563c75+':'+_0xf7af58[_0xdc1f('0x15')]+',${EXTEN},'+_0x4d91ee,'exten':_0xf7af58[_0xdc1f('0x9')],'context':_0xf7af58['context'],'priority':_0x429447[_0xdc1f('0x16')]+_0xfa6e17,'VoiceExtensionId':_0x416c7d[_0x39ae3f][0x0]['VoiceExtensionId']});}_0xf7af58[_0xdc1f('0x16')]=_0x2b28f2['length']?_['last'](_0x2b28f2)[_0xdc1f('0x16')]+0x1:_0x429447[_0xdc1f('0x16')];_0x429447['priority']=(_0x21f233[_0xdc1f('0x2d')]?_[_0xdc1f('0x3f')](_0x21f233)[_0xdc1f('0x16')]:_0xf7af58[_0xdc1f('0x16')])+0x1;_0x429447[_0xdc1f('0xf')]=_[_0xdc1f('0x40')](_0x429447[_0xdc1f('0xf')],_0x2b28f2,[_0xf7af58],_0x21f233);}_0x429447[_0xdc1f('0xf')][_0xdc1f('0x1f')]({'type':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x11')],'app':'Hangup','exten':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x9')],'context':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x15')],'priority':_0x429447[_0xdc1f('0x16')],'VoiceExtensionId':_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x17')]});_0x4070da[_0xdc1f('0x1f')](_0x416c7d[_0x39ae3f][0x0][_0xdc1f('0x17')]);_0x36d2e3=_['concat'](_0x36d2e3,_0x429447['extensions']);}}return _0x5d5e09[_0xdc1f('0x41')](function(_0x61e8a8){return _0x5d5e09['models'][_0xdc1f('0x6')][_0xdc1f('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x4070da}},'transaction':_0x61e8a8})[_0xdc1f('0x3')](function(_0x5e76ab){return _0x5d5e09[_0xdc1f('0x5')][_0xdc1f('0x6')][_0xdc1f('0x43')](_[_0xdc1f('0x44')](_0x36d2e3,_0xdc1f('0x16')),{'transaction':_0x61e8a8});});});})['catch'](function(_0xb43eac){console[_0xdc1f('0x45')](_0xb43eac);});}exports[_0xdc1f('0x46')]=rewrite; \ No newline at end of file +var _0x9fb4=['${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','intervals','CDR(tag)=','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','destroy','catch','lodash','util','models','Interval','findAll','then','VoiceExtension','IntervalId','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','queue','playback','hasOwnProperty','find','extensions','push','type','Set','format','context','priority','VoiceExtensionId','inbound','CDR(routeid)=','outbound','extension','CDR(destination)=','cutdigits'];(function(_0x1a0c87,_0x270cc4){var _0x222ff5=function(_0x2dd85c){while(--_0x2dd85c){_0x1a0c87['push'](_0x1a0c87['shift']());}};_0x222ff5(++_0x270cc4);}(_0x9fb4,0x172));var _0x49fb=function(_0x4f4d19,_0x574245){_0x4f4d19=_0x4f4d19-0x0;var _0x27a258=_0x9fb4[_0x4f4d19];return _0x27a258;};'use strict';var _=require(_0x49fb('0x0'));var util=require(_0x49fb('0x1'));function rewrite(_0xd2b764,_0xb073fa){var _0x2a4e00=this;return _0xd2b764[_0x49fb('0x2')][_0x49fb('0x3')][_0x49fb('0x4')]({'raw':!![]})[_0x49fb('0x5')](function(_0x12b427){_0x2a4e00['intervals']=_0x12b427;return _0xd2b764['models'][_0x49fb('0x6')][_0x49fb('0x4')]({'where':{'IntervalId':_0xb073fa[_0x49fb('0x7')]},'raw':!![]});})[_0x49fb('0x5')](function(_0x3355cd){return _0xd2b764[_0x49fb('0x2')][_0x49fb('0x6')][_0x49fb('0x4')]({'where':{'exten':{'$in':_[_0x49fb('0x8')](_[_0x49fb('0x9')](_0x3355cd,'exten'))}},'order':[{'raw':_0x49fb('0xa')}],'raw':!![]});})[_0x49fb('0x5')](function(_0x4204cf){var _0x42a227=_[_0x49fb('0xb')](_0x4204cf,{'priority':'1'});var _0x226f0d=_[_0x49fb('0xb')](_0x4204cf,{'isApp':0x1});var _0x19858a=_[_0x49fb('0xc')](_0x226f0d,_0x49fb('0xd'));var _0x17f105=[_0x49fb('0xe'),_0x49fb('0xf')];var _0x28b768=[];var _0x31e2a8=[];for(var _0x681739 in _0x19858a){if(_0x19858a[_0x49fb('0x10')](_0x681739)){_0x2a4e00['priority']=0x2;_0x2a4e00['extensions']=[];_0x2a4e00['extension']=_[_0x49fb('0x11')](_0x42a227,{'exten':_0x19858a[_0x681739][0x0][_0x49fb('0xd')]});_0x2a4e00[_0x49fb('0x12')][_0x49fb('0x13')]({'type':_0x19858a[_0x681739][0x0][_0x49fb('0x14')],'app':_0x49fb('0x15'),'appdata':util[_0x49fb('0x16')]('CDR(type)=%s',_0x19858a[_0x681739][0x0][_0x49fb('0x14')]),'context':_0x19858a[_0x681739][0x0][_0x49fb('0x17')],'exten':_0x19858a[_0x681739][0x0][_0x49fb('0xd')],'priority':_0x2a4e00[_0x49fb('0x18')]++,'VoiceExtensionId':_0x19858a[_0x681739][0x0][_0x49fb('0x19')]});if(_0x19858a[_0x681739][0x0][_0x49fb('0x14')]===_0x49fb('0x1a')){_0x2a4e00[_0x49fb('0x12')][_0x49fb('0x13')]({'type':_0x19858a[_0x681739][0x0]['type'],'app':_0x49fb('0x15'),'appdata':_0x49fb('0x1b')+_0x19858a[_0x681739][0x0]['VoiceExtensionId'],'context':_0x19858a[_0x681739][0x0][_0x49fb('0x17')],'exten':_0x19858a[_0x681739][0x0][_0x49fb('0xd')],'priority':_0x2a4e00['priority']++,'VoiceExtensionId':_0x19858a[_0x681739][0x0][_0x49fb('0x19')]});}else if(_0x19858a[_0x681739][0x0][_0x49fb('0x14')]===_0x49fb('0x1c')){if(_0x2a4e00[_0x49fb('0x1d')]){_0x2a4e00[_0x49fb('0x12')][_0x49fb('0x13')]({'type':_0x19858a[_0x681739][0x0][_0x49fb('0x14')],'app':_0x49fb('0x15'),'appdata':_0x49fb('0x1e')+(_0x2a4e00['extension'][_0x49fb('0x1f')]?_0x49fb('0x20')+_0x2a4e00[_0x49fb('0x1d')][_0x49fb('0x1f')]+'}':'${EXTEN}'),'context':_0x19858a[_0x681739][0x0]['context'],'exten':_0x19858a[_0x681739][0x0][_0x49fb('0xd')],'priority':_0x2a4e00[_0x49fb('0x18')]++,'VoiceExtensionId':_0x19858a[_0x681739][0x0][_0x49fb('0x19')]});}_0x2a4e00[_0x49fb('0x12')][_0x49fb('0x13')]({'type':_0x19858a[_0x681739][0x0]['type'],'app':_0x49fb('0x15'),'appdata':_0x49fb('0x1b')+_0x19858a[_0x681739][0x0][_0x49fb('0x19')],'context':_0x19858a[_0x681739][0x0]['context'],'exten':_0x19858a[_0x681739][0x0][_0x49fb('0xd')],'priority':_0x2a4e00['priority']++,'VoiceExtensionId':_0x19858a[_0x681739][0x0][_0x49fb('0x19')]});var _0x57d360=_0x2a4e00['priority']++;_0x2a4e00['extensions']['push']({'type':_0x19858a[_0x681739][0x0][_0x49fb('0x14')],'app':_0x49fb('0x21'),'appdata':_0x49fb('0x22')+(_0x57d360+0x2)+_0x49fb('0x23')+(_0x57d360+0x1)+')','context':_0x19858a[_0x681739][0x0][_0x49fb('0x17')],'exten':_0x19858a[_0x681739][0x0][_0x49fb('0xd')],'priority':_0x57d360,'VoiceExtensionId':_0x19858a[_0x681739][0x0][_0x49fb('0x19')]});if(_0x2a4e00[_0x49fb('0x1d')]){_0x2a4e00[_0x49fb('0x12')][_0x49fb('0x13')]({'type':_0x19858a[_0x681739][0x0]['type'],'app':'Set','appdata':_0x2a4e00[_0x49fb('0x1d')][_0x49fb('0x1f')]?_0x49fb('0x24')+_0x2a4e00[_0x49fb('0x1d')][_0x49fb('0x1f')]+'}':'CDR(prefix)=noprefix','context':_0x19858a[_0x681739][0x0][_0x49fb('0x17')],'exten':_0x19858a[_0x681739][0x0][_0x49fb('0xd')],'priority':_0x2a4e00[_0x49fb('0x18')]++,'VoiceExtensionId':_0x19858a[_0x681739][0x0][_0x49fb('0x19')]});}_0x2a4e00['extensions'][_0x49fb('0x13')]({'type':_0x19858a[_0x681739][0x0][_0x49fb('0x14')],'app':_0x49fb('0x15'),'appdata':_0x49fb('0x25')+_0x19858a[_0x681739][0x0]['VoiceExtensionId'],'context':_0x19858a[_0x681739][0x0][_0x49fb('0x17')],'exten':_0x19858a[_0x681739][0x0][_0x49fb('0xd')],'priority':_0x2a4e00[_0x49fb('0x18')]++,'VoiceExtensionId':_0x19858a[_0x681739][0x0][_0x49fb('0x19')]});if(_0x2a4e00['extension']&&_0x2a4e00[_0x49fb('0x1d')][_0x49fb('0x10')]('recordingFormat')&&_0x2a4e00[_0x49fb('0x1d')][_0x49fb('0x26')]!==_0x49fb('0x27')){_0x2a4e00[_0x49fb('0x12')]['push']({'type':_0x19858a[_0x681739][0x0][_0x49fb('0x14')],'app':_0x49fb('0x15'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x19858a[_0x681739][0x0][_0x49fb('0x17')],'exten':_0x19858a[_0x681739][0x0][_0x49fb('0xd')],'priority':_0x2a4e00[_0x49fb('0x18')]++,'VoiceExtensionId':_0x19858a[_0x681739][0x0]['VoiceExtensionId']});_0x2a4e00[_0x49fb('0x12')]['push']({'type':_0x19858a[_0x681739][0x0][_0x49fb('0x14')],'app':_0x49fb('0x15'),'appdata':_0x49fb('0x28')+_0x2a4e00[_0x49fb('0x1d')][_0x49fb('0x26')]||_0x49fb('0x29'),'context':_0x19858a[_0x681739][0x0][_0x49fb('0x17')],'exten':_0x19858a[_0x681739][0x0]['exten'],'priority':_0x2a4e00['priority']++,'VoiceExtensionId':_0x19858a[_0x681739][0x0][_0x49fb('0x19')]});}}_0x2a4e00[_0x49fb('0x12')][_0x49fb('0x13')]({'type':_0x19858a[_0x681739][0x0]['type'],'app':_0x49fb('0x15'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x19858a[_0x681739][0x0]['context'],'exten':_0x19858a[_0x681739][0x0][_0x49fb('0xd')],'priority':_0x2a4e00[_0x49fb('0x18')]++,'VoiceExtensionId':_0x19858a[_0x681739][0x0][_0x49fb('0x19')]});_0x2a4e00[_0x49fb('0x12')][_0x49fb('0x13')]({'type':_0x19858a[_0x681739][0x0]['type'],'app':_0x49fb('0x15'),'appdata':_0x49fb('0x2a'),'context':_0x19858a[_0x681739][0x0]['context'],'exten':_0x19858a[_0x681739][0x0][_0x49fb('0xd')],'priority':_0x2a4e00[_0x49fb('0x18')]++,'VoiceExtensionId':_0x19858a[_0x681739][0x0][_0x49fb('0x19')]});_0x2a4e00[_0x49fb('0x12')][_0x49fb('0x13')]({'type':_0x19858a[_0x681739][0x0][_0x49fb('0x14')],'app':_0x49fb('0x15'),'appdata':'MONITOR_OPTIONS=ab','context':_0x19858a[_0x681739][0x0][_0x49fb('0x17')],'exten':_0x19858a[_0x681739][0x0][_0x49fb('0xd')],'priority':_0x2a4e00['priority']++,'VoiceExtensionId':_0x19858a[_0x681739][0x0][_0x49fb('0x19')]});for(var _0x3d184d=0x0,_0x64fbd7=0x0;_0x3d184d<_0x19858a[_0x681739][_0x49fb('0x2b')];_0x3d184d+=0x1,_0x64fbd7=0x0){var _0x3b45fc=_0x19858a[_0x681739][_0x3d184d];if(_0x3b45fc[_0x49fb('0x14')]){_0x3b45fc[_0x49fb('0x14')]=_0x3b45fc[_0x49fb('0x14')][_0x49fb('0x2c')]();}var _0x49127d=[];var _0xcaf4fa=[];delete _0x3b45fc['id'];delete _0x3b45fc[_0x49fb('0x2d')];delete _0x3b45fc[_0x49fb('0x2e')];var _0x52ad36=_0x3b45fc[_0x49fb('0x2f')]!==_0x49fb('0x30')?[_0x3b45fc[_0x49fb('0x2f')]]:_0x3b45fc[_0x49fb('0x7')]?_[_0x49fb('0x9')](_[_0x49fb('0xb')](_0x2a4e00[_0x49fb('0x31')],{'IntervalId':_0x3b45fc[_0x49fb('0x7')]}),_0x49fb('0x2f')):[];if(_0x3b45fc[_0x49fb('0x10')]('tag')){if(_0x3b45fc['tag']&&_0x3b45fc['tag']!=='--'){_0x49127d[_0x49fb('0x13')]({'type':_0x3b45fc['type'],'app':_0x49fb('0x15'),'appdata':_0x49fb('0x32')+_0x3b45fc[_0x49fb('0x33')],'context':_0x3b45fc[_0x49fb('0x17')],'exten':_0x3b45fc['exten'],'priority':_0x52ad36[_0x49fb('0x2b')]+_0x2a4e00[_0x49fb('0x18')]+_0x64fbd7++,'VoiceExtensionId':_0x3b45fc[_0x49fb('0x19')]});}}if(_0x3b45fc[_0x49fb('0x14')]===_0x49fb('0x1c')&&_0x3b45fc[_0x49fb('0x10')](_0x49fb('0x34'))){if(_0x3b45fc[_0x49fb('0x34')]){_0x49127d[_0x49fb('0x13')]({'type':_0x3b45fc[_0x49fb('0x14')],'app':'ExecIf','appdata':_0x49fb('0x35')+_0x3b45fc['callerID']+')','context':_0x3b45fc[_0x49fb('0x17')],'exten':_0x3b45fc['exten'],'priority':_0x52ad36[_0x49fb('0x2b')]+_0x2a4e00[_0x49fb('0x18')]+_0x64fbd7++,'VoiceExtensionId':_0x3b45fc[_0x49fb('0x19')]});}else{_0x49127d[_0x49fb('0x13')]({'type':_0x3b45fc[_0x49fb('0x14')],'app':_0x49fb('0x21'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x3b45fc['context'],'exten':_0x3b45fc[_0x49fb('0xd')],'priority':_0x52ad36['length']+_0x2a4e00[_0x49fb('0x18')]+_0x64fbd7++,'VoiceExtensionId':_0x3b45fc[_0x49fb('0x19')]});}}if(_0x3b45fc[_0x49fb('0x10')](_0x49fb('0x36'))){if(_0x17f105['indexOf'](_0x3b45fc['app'][_0x49fb('0x2c')]())>=0x0&&_0x3b45fc[_0x49fb('0x37')]!==_0x49fb('0x38')){if(_0x3b45fc[_0x49fb('0x36')]){_0x49127d[_0x49fb('0x13')]({'type':_0x3b45fc[_0x49fb('0x14')],'app':_0x49fb('0x21'),'appdata':_0x49fb('0x39'),'context':_0x3b45fc['context'],'exten':_0x3b45fc['exten'],'priority':_0x52ad36['length']+_0x2a4e00['priority']+_0x64fbd7++,'VoiceExtensionId':_0x3b45fc[_0x49fb('0x19')]});_0x49127d[_0x49fb('0x13')]({'type':_0x3b45fc[_0x49fb('0x14')],'app':_0x49fb('0x15'),'appdata':_0x49fb('0x3a'),'context':_0x3b45fc[_0x49fb('0x17')],'exten':_0x3b45fc[_0x49fb('0xd')],'priority':_0x52ad36[_0x49fb('0x2b')]+_0x2a4e00[_0x49fb('0x18')]+_0x64fbd7++,'VoiceExtensionId':_0x3b45fc[_0x49fb('0x19')]});}else{_0x49127d['push']({'type':_0x3b45fc[_0x49fb('0x14')],'app':_0x49fb('0x21'),'appdata':_0x49fb('0x3b'),'context':_0x3b45fc[_0x49fb('0x17')],'exten':_0x3b45fc[_0x49fb('0xd')],'priority':_0x52ad36[_0x49fb('0x2b')]+_0x2a4e00[_0x49fb('0x18')]+_0x64fbd7++,'VoiceExtensionId':_0x3b45fc['VoiceExtensionId']});_0x49127d['push']({'type':_0x3b45fc[_0x49fb('0x14')],'app':_0x49fb('0x15'),'appdata':_0x49fb('0x3c'),'context':_0x3b45fc[_0x49fb('0x17')],'exten':_0x3b45fc[_0x49fb('0xd')],'priority':_0x52ad36[_0x49fb('0x2b')]+_0x2a4e00[_0x49fb('0x18')]+_0x64fbd7++,'VoiceExtensionId':_0x3b45fc[_0x49fb('0x19')]});}}}for(var _0x53977e=0x0;_0x53977e<_0x52ad36[_0x49fb('0x2b')];_0x53977e+=0x1){var _0x195752=_0x2a4e00[_0x49fb('0x18')]+_0x52ad36[_0x49fb('0x2b')];var _0x1cdf3b=_0x53977e===_0x52ad36[_0x49fb('0x2b')]-0x1?_0x2a4e00[_0x49fb('0x18')]+_0x49127d[_0x49fb('0x2b')]+_0xcaf4fa['length']+0x2:_0x2a4e00[_0x49fb('0x18')]+_0x53977e+0x1;_0x49127d[_0x49fb('0x3d')](_0x53977e,0x0,{'type':_0x3b45fc[_0x49fb('0x14')],'app':'GotoIfTime','appdata':_0x52ad36[_0x53977e]+'?'+_0x3b45fc[_0x49fb('0x17')]+_0x49fb('0x3e')+_0x195752+':'+_0x3b45fc[_0x49fb('0x17')]+_0x49fb('0x3e')+_0x1cdf3b,'exten':_0x3b45fc[_0x49fb('0xd')],'context':_0x3b45fc[_0x49fb('0x17')],'priority':_0x2a4e00['priority']+_0x53977e,'VoiceExtensionId':_0x19858a[_0x681739][0x0]['VoiceExtensionId']});}_0x3b45fc[_0x49fb('0x18')]=_0x49127d[_0x49fb('0x2b')]?_[_0x49fb('0x3f')](_0x49127d)[_0x49fb('0x18')]+0x1:_0x2a4e00[_0x49fb('0x18')];_0x2a4e00[_0x49fb('0x18')]=(_0xcaf4fa[_0x49fb('0x2b')]?_[_0x49fb('0x3f')](_0xcaf4fa)[_0x49fb('0x18')]:_0x3b45fc[_0x49fb('0x18')])+0x1;_0x2a4e00[_0x49fb('0x12')]=_[_0x49fb('0x40')](_0x2a4e00[_0x49fb('0x12')],_0x49127d,[_0x3b45fc],_0xcaf4fa);}_0x2a4e00[_0x49fb('0x12')][_0x49fb('0x13')]({'type':_0x19858a[_0x681739][0x0][_0x49fb('0x14')],'app':'Hangup','exten':_0x19858a[_0x681739][0x0][_0x49fb('0xd')],'context':_0x19858a[_0x681739][0x0][_0x49fb('0x17')],'priority':_0x2a4e00[_0x49fb('0x18')],'VoiceExtensionId':_0x19858a[_0x681739][0x0][_0x49fb('0x19')]});_0x28b768[_0x49fb('0x13')](_0x19858a[_0x681739][0x0]['VoiceExtensionId']);_0x31e2a8=_[_0x49fb('0x40')](_0x31e2a8,_0x2a4e00[_0x49fb('0x12')]);}}return _0xd2b764['transaction'](function(_0xbe949){return _0xd2b764[_0x49fb('0x2')][_0x49fb('0x6')][_0x49fb('0x41')]({'where':{'VoiceExtensionId':{'$in':_0x28b768}},'transaction':_0xbe949})[_0x49fb('0x5')](function(_0x350d9a){return _0xd2b764['models'][_0x49fb('0x6')]['bulkCreate'](_['sortBy'](_0x31e2a8,'priority'),{'transaction':_0xbe949});});});})[_0x49fb('0x42')](function(_0x36fdb1){console['error'](_0x36fdb1);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 7ac1fe3..d01b2da 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 _0xb013=['calleridnum','cm_hopper_final','\x20=\x20?','into','str','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','get','always','sequelize','query','VoiceQueueId','all','BlackLists','Campaign','dialCheckDuplicateType','Lists','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resume','resolve','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','parse','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','defaults','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','data','firstName','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','inspect','insert','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','NOW()','field','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','cm_hopper','id\x20IN\x20?','phone\x20IS\x20NOT\x20NULL'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xb013,0x99));var _0x3b01=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xb013[_0x2235bf];return _0x4c3a64;};'use strict';var BPromise=require(_0x3b01('0x0'));var util=require(_0x3b01('0x1'));var _=require(_0x3b01('0x2'));var fs=require('fs');var squel=require(_0x3b01('0x3'));var Papa=require(_0x3b01('0x4'));var Redis=require(_0x3b01('0x5'));var db=require(_0x3b01('0x6'))['db'];var config=require(_0x3b01('0x7'));var logger=require(_0x3b01('0x8'))(_0x3b01('0x9'));config['redis']=_[_0x3b01('0xa')](config[_0x3b01('0xb')],{'host':_0x3b01('0xc'),'port':0x18eb});var socket=require(_0x3b01('0xd'))(new Redis(config[_0x3b01('0xb')]));require(_0x3b01('0xe'))['register'](socket);try{if(!process[_0x3b01('0xf')][0x2]||process[_0x3b01('0xf')][0x2]===_0x3b01('0x10')||process[_0x3b01('0xf')][0x2]===_0x3b01('0x11')){throw new Error(_0x3b01('0x12'));}var FILEPATH=process['argv'][0x2];if(!process[_0x3b01('0xf')][0x3]||process['argv'][0x3]===_0x3b01('0x10')||process[_0x3b01('0xf')][0x3]===_0x3b01('0x11')||!process[_0x3b01('0xf')][0x4]||process[_0x3b01('0xf')][0x4]==='undefined'||process[_0x3b01('0xf')][0x4]===_0x3b01('0x11')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x3b01('0x13')](process[_0x3b01('0xf')][0x3][_0x3b01('0x14')](','),process[_0x3b01('0xf')][0x4][_0x3b01('0x14')](','));if(!process[_0x3b01('0xf')][0x5]||process[_0x3b01('0xf')][0x5]==='undefined'||process['argv'][0x5]==='null'){throw new Error(_0x3b01('0x15'));}var LISTID=process[_0x3b01('0xf')][0x5];var COMPANYID=process['argv'][0x6]&&process['argv'][0x6]!==_0x3b01('0x10')&&process['argv'][0x6]!=='null'?process['argv'][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x3b01('0xf')][0x7]!==_0x3b01('0x10')&&process['argv'][0x7]!=='null'?process['argv'][0x7]:null;if(!process[_0x3b01('0xf')][0x8]||process[_0x3b01('0xf')][0x8]===_0x3b01('0x10')||process['argv'][0x8]==='null'){throw new Error(_0x3b01('0x16'));}var SOCKET_TIMESTAMP=process[_0x3b01('0xf')][0x8];}catch(_0x5b7551){logger[_0x3b01('0x17')](_0x5b7551);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(_0x14034e,_0x51c9ef,_0xd9bd5c,_0x5c513a){var _0x366347={'message':_0x51c9ef};_0x366347[_0x14034e]=!![];if(_0xd9bd5c){_0x366347[_0x3b01('0x18')]=_0xd9bd5c;}if(_0x5c513a){_0x366347[_0x3b01('0x19')]=_0x5c513a;}return _0x366347;}function isEmail(_0x101606){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))*$/[_0x3b01('0x1a')](_0x101606);}function checkRow(_0x507edd,_0x36b9a6,_0x43c57c){return new BPromise(function(_0x15ce5f,_0x4d9b88){if(_[_0x3b01('0x1b')](_0x507edd)){return _0x4d9b88(handleCheckRowError(_0x3b01('0x17'),_0x3b01('0x1c'),null,_0x43c57c));}if(_0x507edd[_0x3b01('0x1d')]&&_0x507edd[_0x3b01('0x1d')][_0x3b01('0x1e')]){var _0x412ec3=_[_0x3b01('0x1f')](_0x507edd[_0x3b01('0x1d')],_0x3b01('0x20'))[_0x3b01('0x21')](';');return _0x4d9b88(handleCheckRowError('error',_0x412ec3,null,_0x43c57c));}var _0x3b7741={};for(var _0x2a36b2 in FIELDS){if(FIELDS['hasOwnProperty'](_0x2a36b2)&&FIELDS[_0x2a36b2]){_0x3b7741[_0x2a36b2]=_0x507edd[_0x3b01('0x22')][0x0][FIELDS[_0x2a36b2]]||_0x507edd['data'][0x0]['\ufeff'+FIELDS[_0x2a36b2]];}}if(!_0x3b7741[_0x3b01('0x23')]){return _0x4d9b88(handleCheckRowError(_0x3b01('0x17'),'firstName\x20not\x20specified!',null,_0x43c57c));}if(!_0x3b7741[_0x3b01('0x24')]){return _0x4d9b88(handleCheckRowError(_0x3b01('0x17'),_0x3b01('0x25'),null,_0x43c57c));}if(_0x3b7741[_0x3b01('0x26')]){var _0xa576c=moment(_0x3b7741[_0x3b01('0x26')],'YYYY-MM-DD');if(!_0xa576c[_0x3b01('0x27')]()){return _0x4d9b88(handleCheckRowError('error',_0x3b01('0x28'),null,_0x43c57c));}}if(_0x3b7741[_0x3b01('0x29')]){if(!isEmail(_0x3b7741[_0x3b01('0x29')])){return _0x4d9b88(handleCheckRowError(_0x3b01('0x17'),_0x3b01('0x2a'),null,_0x43c57c));}}_0x3b7741['ListId']=LISTID;_0x3b7741[_0x3b01('0x2b')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x3b01('0x1e')]&&_0x36b9a6){var _0x4701cf={};for(var _0x36d172=0x0,_0x1e86d3=DUPLICATES[_0x3b01('0x1e')];_0x36d172<_0x1e86d3;_0x36d172+=0x1){_0x4701cf[DUPLICATES[_0x36d172]]=_0x3b7741[DUPLICATES[_0x36d172]];}var _0x13652c=_[_0x3b01('0x2c')](_0x36b9a6,_0x4701cf);if(_0x13652c){return _0x4d9b88(handleCheckRowError(_0x3b01('0x2d'),_0x3b01('0x2e'),_0x13652c,_0x43c57c));}}return db[_0x3b01('0x2f')]['create'](_0x3b7741,{'raw':!![],'hooks':![],'fields':_[_0x3b01('0x30')](_0x3b7741)})[_0x3b01('0x31')](function(_0x407fbc){if(DUPLICATES&&DUPLICATES['length']&&_0x36b9a6){_0x36b9a6[_0x3b01('0x32')](_[_0x3b01('0x33')](_0x3b7741,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x407fbc['id'];return _0x15ce5f();})[_0x3b01('0x34')](function(_0x29b48d){return _0x4d9b88(handleCheckRowError(_0x3b01('0x17'),_0x3b01('0x35')+(_0x29b48d[_0x3b01('0x20')]||JSON[_0x3b01('0x36')](_0x29b48d)),null,_0x43c57c));});});}function checkHopper(){function _0x3ff095(){return function(_0x27aa15){logger[_0x3b01('0x17')](_0x3b01('0x37'),'checkHopper',util[_0x3b01('0x38')](_0x27aa15,{'showHidden':![],'depth':null}));};}var _0x483681=function(_0x11e924,_0x4c6565){var _0x27df13=squel[_0x3b01('0x39')]()['into']('cm_hopper')[_0x3b01('0x3a')]([_0x3b01('0x24'),_0x3b01('0x3b'),_0x3b01('0x3c'),_0x3b01('0x3d'),_0x4c6565,_0x3b01('0x3e'),_0x3b01('0x3f')],squel[_0x3b01('0x40')]()['field'](_0x3b01('0x24'),_0x3b01('0x24'))['field'](_0x3b01('0x41'),_0x3b01('0x3b'))[_0x3b01('0x42')]('id',_0x3b01('0x3c'))[_0x3b01('0x42')](LISTID[_0x3b01('0x43')](),_0x3b01('0x3d'))['field'](_0x11e924['id'][_0x3b01('0x43')](),_0x4c6565)[_0x3b01('0x42')]('NOW()',_0x3b01('0x3e'))[_0x3b01('0x42')](_0x3b01('0x41'),'updatedAt')[_0x3b01('0x44')](_0x3b01('0x45'))['where'](_0x3b01('0x46'))[_0x3b01('0x47')](_0x3b01('0x48'),LISTID[_0x3b01('0x43')]())['where']('phone\x20IS\x20NOT\x20NULL')['where'](_0x3b01('0x49'),squel[_0x3b01('0x40')]()[_0x3b01('0x42')](_0x3b01('0x24'))[_0x3b01('0x44')](_0x3b01('0x4a'))[_0x3b01('0x47')](_0x4c6565+'\x20=\x20?',_0x11e924['id'][_0x3b01('0x43')]())))['toString']();return _0x27df13;};var _0x1968d3=function(_0x235af9,_0x588426){var _0x252165=squel[_0x3b01('0x39')]()['into'](_0x3b01('0x4a'))['fromQuery']([_0x3b01('0x24'),_0x3b01('0x3b'),_0x3b01('0x3c'),_0x3b01('0x3d'),_0x588426,_0x3b01('0x3e'),_0x3b01('0x3f')],squel['select']()['field']('phone','phone')['field'](_0x3b01('0x41'),_0x3b01('0x3b'))[_0x3b01('0x42')]('id','ContactId')[_0x3b01('0x42')](LISTID[_0x3b01('0x43')](),_0x3b01('0x3d'))[_0x3b01('0x42')](_0x235af9['id']['toString'](),_0x588426)[_0x3b01('0x42')](_0x3b01('0x41'),_0x3b01('0x3e'))['field']('NOW()','updatedAt')[_0x3b01('0x44')]('cm_contacts')[_0x3b01('0x47')](_0x3b01('0x46'))['where'](_0x3b01('0x48'),LISTID[_0x3b01('0x43')]())[_0x3b01('0x47')](_0x3b01('0x4b'),squel['str'](hopperContacts))[_0x3b01('0x47')](_0x3b01('0x4c'))[_0x3b01('0x47')]('phone\x20NOT\x20IN\x20(?)',squel[_0x3b01('0x40')]()[_0x3b01('0x42')](_0x3b01('0x4d'))['from'](_0x3b01('0x4e'))['where'](_0x588426+_0x3b01('0x4f'),_0x235af9['id'][_0x3b01('0x43')]()))[_0x3b01('0x47')](_0x3b01('0x49'),squel['select']()[_0x3b01('0x42')](_0x3b01('0x24'))[_0x3b01('0x44')](_0x3b01('0x4a'))[_0x3b01('0x47')](_0x588426+_0x3b01('0x4f'),_0x235af9['id'][_0x3b01('0x43')]())))[_0x3b01('0x43')]();return _0x252165;};function _0x2a20bb(_0x1206ed,_0x2d943a){var _0x5c4cb3=squel[_0x3b01('0x39')]()[_0x3b01('0x50')](_0x3b01('0x4a'))[_0x3b01('0x3a')]([_0x3b01('0x24'),_0x3b01('0x3b'),_0x3b01('0x3c'),_0x3b01('0x3d'),_0x2d943a,_0x3b01('0x3e'),_0x3b01('0x3f')],squel[_0x3b01('0x40')]()[_0x3b01('0x42')](_0x3b01('0x24'),'phone')[_0x3b01('0x42')]('NOW()',_0x3b01('0x3b'))[_0x3b01('0x42')]('id',_0x3b01('0x3c'))[_0x3b01('0x42')](LISTID[_0x3b01('0x43')](),'ListId')[_0x3b01('0x42')](_0x1206ed['id'][_0x3b01('0x43')](),_0x2d943a)['field'](_0x3b01('0x41'),'createdAt')[_0x3b01('0x42')](_0x3b01('0x41'),'updatedAt')[_0x3b01('0x44')](_0x3b01('0x45'))[_0x3b01('0x47')](_0x3b01('0x46'))[_0x3b01('0x47')]('ListId\x20=\x20?',LISTID['toString']())['where'](_0x3b01('0x4b'),squel[_0x3b01('0x51')](hopperContacts))[_0x3b01('0x47')](_0x3b01('0x4c')))[_0x3b01('0x43')]();return _0x5c4cb3;}function _0x5f41e2(_0x441666,_0x2d496e){var _0x2c7de2=squel['insert']()[_0x3b01('0x50')](_0x3b01('0x52'))[_0x3b01('0x3a')](['phone',_0x3b01('0x3c'),'ListId',_0x2d496e,'createdAt',_0x3b01('0x3f')],squel[_0x3b01('0x40')]()['field'](_0x3b01('0x24'),_0x3b01('0x24'))[_0x3b01('0x42')]('id',_0x3b01('0x3c'))[_0x3b01('0x42')](LISTID[_0x3b01('0x43')](),_0x3b01('0x3d'))[_0x3b01('0x42')](_0x441666['id'][_0x3b01('0x43')](),_0x2d496e)[_0x3b01('0x42')](_0x3b01('0x41'),_0x3b01('0x3e'))[_0x3b01('0x42')]('NOW()',_0x3b01('0x3f'))[_0x3b01('0x44')](_0x3b01('0x45'))['where'](_0x3b01('0x46'))[_0x3b01('0x47')](_0x3b01('0x48'),LISTID['toString']())['where'](_0x3b01('0x4b'),squel[_0x3b01('0x51')](hopperContacts))[_0x3b01('0x47')](_0x3b01('0x4c')))['toString']();return _0x2c7de2;}return db[_0x3b01('0x53')][_0x3b01('0x54')]({'where':{'type':_0x3b01('0x55')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x3b01('0x56')],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0xfdc61c){var _0x442e84=[];if(_0xfdc61c){var _0x339752;for(var _0x357bf7=0x0,_0x3d8112;_0x357bf7<_0xfdc61c[_0x3b01('0x1e')];_0x357bf7+=0x1){_0x3d8112=_0xfdc61c[_0x357bf7][_0x3b01('0x57')]({'plain':!![]});switch(_0x3d8112['dialCheckDuplicateType']){case _0x3b01('0x58'):_0x442e84[_0x3b01('0x32')](db[_0x3b01('0x59')][_0x3b01('0x5a')](_0x1968d3(_0x3d8112,'VoiceQueueId'))[_0x3b01('0x31')](function(){})[_0x3b01('0x34')](_0x3ff095()));break;case'onlyIfOpen':_0x442e84[_0x3b01('0x32')](db[_0x3b01('0x59')][_0x3b01('0x5a')](_0x483681(_0x3d8112,_0x3b01('0x5b')))[_0x3b01('0x31')](function(){})[_0x3b01('0x34')](_0x3ff095()));break;default:_0x442e84[_0x3b01('0x32')](db[_0x3b01('0x59')][_0x3b01('0x5a')](_0x2a20bb(_0x3d8112,_0x3b01('0x5b')))['then'](function(){})[_0x3b01('0x34')](_0x3ff095()));}}}return _0x442e84;})[_0x3b01('0x5c')]()[_0x3b01('0x31')](function(){return db[_0x3b01('0x53')][_0x3b01('0x54')]({'where':{'type':_0x3b01('0x55')},'attributes':['id'],'include':[{'model':db[_0x3b01('0x56')],'as':_0x3b01('0x5d'),'where':{'id':LISTID}}]})[_0x3b01('0x31')](function(_0x5b70e1){var _0x5b5fd3=[];if(_0x5b70e1){var _0x49fbf9;for(var _0x16f85d=0x0,_0x54b60c;_0x16f85d<_0x5b70e1['length'];_0x16f85d+=0x1){_0x54b60c=_0x5b70e1[_0x16f85d][_0x3b01('0x57')]({'plain':!![]});_0x5b5fd3[_0x3b01('0x32')](db['sequelize'][_0x3b01('0x5a')](_0x5f41e2(_0x54b60c,_0x3b01('0x5b')))[_0x3b01('0x31')](function(){})['catch'](_0x3ff095()));}}return _0x5b5fd3;})['all']();})[_0x3b01('0x31')](function(){return db[_0x3b01('0x5e')][_0x3b01('0x54')]({'attributes':['id',_0x3b01('0x5f')],'include':[{'model':db[_0x3b01('0x56')],'as':_0x3b01('0x60'),'where':{'id':LISTID}}]})[_0x3b01('0x31')](function(_0x2c8c06){var _0xfcf849=[];if(_0x2c8c06){for(var _0x267d94=0x0,_0x506ba2;_0x267d94<_0x2c8c06[_0x3b01('0x1e')];_0x267d94+=0x1){_0x506ba2=_0x2c8c06[_0x267d94][_0x3b01('0x57')]({'plain':!![]});switch(_0x506ba2[_0x3b01('0x5f')]){case'always':_0xfcf849[_0x3b01('0x32')](db[_0x3b01('0x59')][_0x3b01('0x5a')](_0x1968d3(_0x506ba2,_0x3b01('0x61')))[_0x3b01('0x31')](function(){})[_0x3b01('0x34')](_0x3ff095()));break;case _0x3b01('0x62'):_0xfcf849[_0x3b01('0x32')](db[_0x3b01('0x59')][_0x3b01('0x5a')](_0x483681(_0x506ba2,'CampaignId'))[_0x3b01('0x31')](function(){})[_0x3b01('0x34')](_0x3ff095()));break;default:_0xfcf849['push'](db[_0x3b01('0x59')][_0x3b01('0x5a')](_0x2a20bb(_0x506ba2,_0x3b01('0x61')))['then'](function(){})[_0x3b01('0x34')](_0x3ff095()));}}}return _0xfcf849;})[_0x3b01('0x5c')]();})[_0x3b01('0x31')](function(){return db['Campaign'][_0x3b01('0x54')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x3b01('0x5d'),'where':{'id':LISTID}}]})['then'](function(_0xa08804){var _0x55ccf7=[];if(_0xa08804){for(var _0x16f2c7=0x0,_0x286805;_0x16f2c7<_0xa08804['length'];_0x16f2c7+=0x1){_0x286805=_0xa08804[_0x16f2c7][_0x3b01('0x57')]({'plain':!![]});_0x55ccf7[_0x3b01('0x32')](db[_0x3b01('0x59')][_0x3b01('0x5a')](_0x5f41e2(_0x286805,_0x3b01('0x61')))[_0x3b01('0x31')](function(){})[_0x3b01('0x34')](_0x3ff095()));}}return _0x55ccf7;})['all']();})[_0x3b01('0x34')](function(_0x393ca5){logger[_0x3b01('0x17')](_0x3b01('0x63'),'generalCheckHopper',_0x393ca5['message']);});}var processPromises=function(_0x4b0ab6){return BPromise[_0x3b01('0x5c')](promises)[_0x3b01('0x31')](function(_0x39111f){})['catch'](function(_0x4783ba){logger[_0x3b01('0x17')](_0x3b01('0x64'),JSON[_0x3b01('0x36')](_0x4783ba));})['finally'](function(){socket[_0x3b01('0x65')](_0x3b01('0x66')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4b0ab6){return _0x4b0ab6[_0x3b01('0x67')]();}});};var endCsv=function(){return BPromise[_0x3b01('0x68')]()[_0x3b01('0x31')](function(){if(hopperContacts){return checkHopper();}})[_0x3b01('0x31')](function(){socket[_0x3b01('0x65')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x27bd47){logger[_0x3b01('0x17')](_0x3b01('0x69'),JSON[_0x3b01('0x36')](_0x27bd47));}finally{process[_0x3b01('0x6a')](0x0);}});};process['on'](_0x3b01('0x6b'),function(){logger['info'](_0x3b01('0x6c'));endCsv();});function main(){return BPromise[_0x3b01('0x68')]()[_0x3b01('0x31')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x3b01('0x2f')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x3b01('0x31')](function(_0x3f132e){var _0x2b3cc3=fs[_0x3b01('0x6d')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x3b01('0x6e')](_0x2b3cc3,{'header':!![],'skipEmptyLines':!![],'step':function(_0x36207e,_0x2da0b7){total+=0x1;var _0x173a03=total;promises[_0x3b01('0x32')](checkRow(_0x36207e,_0x3f132e,_0x173a03)['then'](function(){success+=0x1;})[_0x3b01('0x34')](function(_0x341af6){if(_0x341af6[_0x3b01('0x17')]){errors+=0x1;delete _0x341af6[_0x3b01('0x17')];}else if(_0x341af6[_0x3b01('0x2d')]){duplicates+=0x1;delete _0x341af6[_0x3b01('0x2d')];}rows[_0x3b01('0x32')](_0x341af6);}));if(total%0xc8===0x0){_0x2da0b7['pause']();return processPromises(_0x2da0b7);}},'complete':function(){return processPromises()[_0x3b01('0x31')](function(){logger[_0x3b01('0x6f')](_0x3b01('0x70'));endCsv();});},'error':function(_0xf9e7ea,_0x5667f8){logger['info'](_0x3b01('0x71'),JSON['stringify'](_0xf9e7ea));endCsv();}});})[_0x3b01('0x34')](function(_0x58fd03){logger['error'](_0x3b01('0x72'),JSON[_0x3b01('0x36')](_0x58fd03));});}main(); \ No newline at end of file +var _0xb5ad=['toString','from','cm_contacts','deletedAt\x20IS\x20NULL','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ListId\x20=\x20?','str','calleridnum','cm_hopper_final','id\x20IN\x20?','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','length','get','always','push','query','VoiceQueueId','onlyIfOpen','sequelize','all','Campaign','CampaignId','BlackLists','generalCheckHopper','finally','emit','contact:csv_','resolve','unlinkSync','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','pause','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','squel','papaparse','ioredis','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','pick','catch','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','createdAt','updatedAt','select','field','NOW()','ContactId'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0xb5ad,0x107));var _0xdb5a=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xb5ad[_0x1a36a5];return _0x746243;};'use strict';var BPromise=require('bluebird');var util=require(_0xdb5a('0x0'));var _=require(_0xdb5a('0x1'));var fs=require('fs');var squel=require(_0xdb5a('0x2'));var Papa=require(_0xdb5a('0x3'));var Redis=require(_0xdb5a('0x4'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0xdb5a('0x5'))(_0xdb5a('0x6'));config[_0xdb5a('0x7')]=_['defaults'](config[_0xdb5a('0x7')],{'host':_0xdb5a('0x8'),'port':0x18eb});var socket=require(_0xdb5a('0x9'))(new Redis(config[_0xdb5a('0x7')]));require(_0xdb5a('0xa'))[_0xdb5a('0xb')](socket);try{if(!process[_0xdb5a('0xc')][0x2]||process[_0xdb5a('0xc')][0x2]===_0xdb5a('0xd')||process[_0xdb5a('0xc')][0x2]==='null'){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process['argv'][0x2];if(!process[_0xdb5a('0xc')][0x3]||process[_0xdb5a('0xc')][0x3]===_0xdb5a('0xd')||process['argv'][0x3]===_0xdb5a('0xe')||!process[_0xdb5a('0xc')][0x4]||process[_0xdb5a('0xc')][0x4]==='undefined'||process[_0xdb5a('0xc')][0x4]===_0xdb5a('0xe')){throw new Error(_0xdb5a('0xf'));}var FIELDS=_[_0xdb5a('0x10')](process[_0xdb5a('0xc')][0x3][_0xdb5a('0x11')](','),process['argv'][0x4][_0xdb5a('0x11')](','));if(!process[_0xdb5a('0xc')][0x5]||process['argv'][0x5]===_0xdb5a('0xd')||process[_0xdb5a('0xc')][0x5]===_0xdb5a('0xe')){throw new Error(_0xdb5a('0x12'));}var LISTID=process[_0xdb5a('0xc')][0x5];var COMPANYID=process[_0xdb5a('0xc')][0x6]&&process[_0xdb5a('0xc')][0x6]!=='undefined'&&process['argv'][0x6]!==_0xdb5a('0xe')?process[_0xdb5a('0xc')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0xdb5a('0xc')][0x7]!==_0xdb5a('0xd')&&process[_0xdb5a('0xc')][0x7]!==_0xdb5a('0xe')?process[_0xdb5a('0xc')][0x7]:null;if(!process['argv'][0x8]||process['argv'][0x8]===_0xdb5a('0xd')||process[_0xdb5a('0xc')][0x8]===_0xdb5a('0xe')){throw new Error(_0xdb5a('0x13'));}var SOCKET_TIMESTAMP=process[_0xdb5a('0xc')][0x8];}catch(_0x9afb89){logger[_0xdb5a('0x14')](_0x9afb89);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(_0x31a47b,_0xb3a5fe,_0x8d8338,_0x246a29){var _0x41d49f={'message':_0xb3a5fe};_0x41d49f[_0x31a47b]=!![];if(_0x8d8338){_0x41d49f['contact']=_0x8d8338;}if(_0x246a29){_0x41d49f['index']=_0x246a29;}return _0x41d49f;}function isEmail(_0x51f7e3){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'](_0x51f7e3);}function checkRow(_0x47e83a,_0x102f4c,_0x14f22a){return new BPromise(function(_0x422396,_0x2fdd07){if(_[_0xdb5a('0x15')](_0x47e83a)){return _0x2fdd07(handleCheckRowError('error',_0xdb5a('0x16'),null,_0x14f22a));}if(_0x47e83a[_0xdb5a('0x17')]&&_0x47e83a[_0xdb5a('0x17')]['length']){var _0x321b5e=_[_0xdb5a('0x18')](_0x47e83a[_0xdb5a('0x17')],_0xdb5a('0x19'))[_0xdb5a('0x1a')](';');return _0x2fdd07(handleCheckRowError(_0xdb5a('0x14'),_0x321b5e,null,_0x14f22a));}var _0x4d6d3e={};for(var _0x4395b4 in FIELDS){if(FIELDS[_0xdb5a('0x1b')](_0x4395b4)&&FIELDS[_0x4395b4]){_0x4d6d3e[_0x4395b4]=_0x47e83a['data'][0x0][FIELDS[_0x4395b4]]||_0x47e83a[_0xdb5a('0x1c')][0x0]['\ufeff'+FIELDS[_0x4395b4]];}}if(!_0x4d6d3e[_0xdb5a('0x1d')]){return _0x2fdd07(handleCheckRowError(_0xdb5a('0x14'),_0xdb5a('0x1e'),null,_0x14f22a));}if(!_0x4d6d3e[_0xdb5a('0x1f')]){return _0x2fdd07(handleCheckRowError('error',_0xdb5a('0x20'),null,_0x14f22a));}if(_0x4d6d3e['birthDate']){var _0x4e7492=moment(_0x4d6d3e['birthDate'],_0xdb5a('0x21'));if(!_0x4e7492[_0xdb5a('0x22')]()){return _0x2fdd07(handleCheckRowError('error',_0xdb5a('0x23'),null,_0x14f22a));}}if(_0x4d6d3e[_0xdb5a('0x24')]){if(!isEmail(_0x4d6d3e['email'])){return _0x2fdd07(handleCheckRowError(_0xdb5a('0x14'),_0xdb5a('0x25'),null,_0x14f22a));}}_0x4d6d3e[_0xdb5a('0x26')]=LISTID;_0x4d6d3e[_0xdb5a('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x102f4c){var _0x4b48c2={};for(var _0x3a0f96=0x0,_0x3d9ee9=DUPLICATES['length'];_0x3a0f96<_0x3d9ee9;_0x3a0f96+=0x1){_0x4b48c2[DUPLICATES[_0x3a0f96]]=_0x4d6d3e[DUPLICATES[_0x3a0f96]];}var _0x3e0fbc=_[_0xdb5a('0x28')](_0x102f4c,_0x4b48c2);if(_0x3e0fbc){return _0x2fdd07(handleCheckRowError(_0xdb5a('0x29'),_0xdb5a('0x2a'),_0x3e0fbc,_0x14f22a));}}return db[_0xdb5a('0x2b')][_0xdb5a('0x2c')](_0x4d6d3e,{'raw':!![],'hooks':![],'fields':_[_0xdb5a('0x2d')](_0x4d6d3e)})[_0xdb5a('0x2e')](function(_0x6efb82){if(DUPLICATES&&DUPLICATES['length']&&_0x102f4c){_0x102f4c['push'](_[_0xdb5a('0x2f')](_0x4d6d3e,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x6efb82['id'];return _0x422396();})[_0xdb5a('0x30')](function(_0x5b0785){return _0x2fdd07(handleCheckRowError(_0xdb5a('0x14'),'Error\x20while\x20creating\x20contact:\x20'+(_0x5b0785[_0xdb5a('0x19')]||JSON[_0xdb5a('0x31')](_0x5b0785)),null,_0x14f22a));});});}function checkHopper(){function _0x45305c(){return function(_0x2fa399){logger[_0xdb5a('0x14')](_0xdb5a('0x32'),_0xdb5a('0x33'),util[_0xdb5a('0x34')](_0x2fa399,{'showHidden':![],'depth':null}));};}var _0x5470e3=function(_0x18189e,_0x5edaa4){var _0x59ea58=squel[_0xdb5a('0x35')]()[_0xdb5a('0x36')](_0xdb5a('0x37'))[_0xdb5a('0x38')]([_0xdb5a('0x1f'),_0xdb5a('0x39'),'ContactId',_0xdb5a('0x26'),_0x5edaa4,_0xdb5a('0x3a'),_0xdb5a('0x3b')],squel[_0xdb5a('0x3c')]()['field']('phone','phone')[_0xdb5a('0x3d')](_0xdb5a('0x3e'),_0xdb5a('0x39'))[_0xdb5a('0x3d')]('id',_0xdb5a('0x3f'))[_0xdb5a('0x3d')](LISTID['toString'](),_0xdb5a('0x26'))[_0xdb5a('0x3d')](_0x18189e['id'][_0xdb5a('0x40')](),_0x5edaa4)[_0xdb5a('0x3d')](_0xdb5a('0x3e'),_0xdb5a('0x3a'))['field'](_0xdb5a('0x3e'),_0xdb5a('0x3b'))[_0xdb5a('0x41')](_0xdb5a('0x42'))['where'](_0xdb5a('0x43'))['where']('ListId\x20=\x20?',LISTID[_0xdb5a('0x40')]())[_0xdb5a('0x44')](_0xdb5a('0x45'))[_0xdb5a('0x44')](_0xdb5a('0x46'),squel[_0xdb5a('0x3c')]()['field'](_0xdb5a('0x1f'))[_0xdb5a('0x41')](_0xdb5a('0x37'))[_0xdb5a('0x44')](_0x5edaa4+_0xdb5a('0x47'),_0x18189e['id'][_0xdb5a('0x40')]())))[_0xdb5a('0x40')]();return _0x59ea58;};var _0x6c431e=function(_0x432fe3,_0x10c784){var _0xecb48b=squel['insert']()[_0xdb5a('0x36')](_0xdb5a('0x37'))[_0xdb5a('0x38')]([_0xdb5a('0x1f'),'scheduledAt',_0xdb5a('0x3f'),'ListId',_0x10c784,_0xdb5a('0x3a'),'updatedAt'],squel[_0xdb5a('0x3c')]()[_0xdb5a('0x3d')](_0xdb5a('0x1f'),_0xdb5a('0x1f'))[_0xdb5a('0x3d')]('NOW()',_0xdb5a('0x39'))[_0xdb5a('0x3d')]('id',_0xdb5a('0x3f'))[_0xdb5a('0x3d')](LISTID['toString'](),'ListId')[_0xdb5a('0x3d')](_0x432fe3['id']['toString'](),_0x10c784)[_0xdb5a('0x3d')]('NOW()',_0xdb5a('0x3a'))[_0xdb5a('0x3d')](_0xdb5a('0x3e'),'updatedAt')[_0xdb5a('0x41')](_0xdb5a('0x42'))[_0xdb5a('0x44')](_0xdb5a('0x43'))[_0xdb5a('0x44')](_0xdb5a('0x48'),LISTID['toString']())[_0xdb5a('0x44')]('id\x20IN\x20?',squel[_0xdb5a('0x49')](hopperContacts))[_0xdb5a('0x44')](_0xdb5a('0x45'))[_0xdb5a('0x44')](_0xdb5a('0x46'),squel[_0xdb5a('0x3c')]()['field'](_0xdb5a('0x4a'))[_0xdb5a('0x41')](_0xdb5a('0x4b'))[_0xdb5a('0x44')](_0x10c784+_0xdb5a('0x47'),_0x432fe3['id']['toString']()))[_0xdb5a('0x44')](_0xdb5a('0x46'),squel[_0xdb5a('0x3c')]()[_0xdb5a('0x3d')](_0xdb5a('0x1f'))[_0xdb5a('0x41')](_0xdb5a('0x37'))[_0xdb5a('0x44')](_0x10c784+'\x20=\x20?',_0x432fe3['id'][_0xdb5a('0x40')]())))[_0xdb5a('0x40')]();return _0xecb48b;};function _0x2efe9c(_0x23fa7f,_0x2c0d80){var _0x36aee7=squel[_0xdb5a('0x35')]()[_0xdb5a('0x36')](_0xdb5a('0x37'))[_0xdb5a('0x38')]([_0xdb5a('0x1f'),'scheduledAt','ContactId',_0xdb5a('0x26'),_0x2c0d80,'createdAt','updatedAt'],squel[_0xdb5a('0x3c')]()[_0xdb5a('0x3d')]('phone','phone')[_0xdb5a('0x3d')](_0xdb5a('0x3e'),_0xdb5a('0x39'))[_0xdb5a('0x3d')]('id','ContactId')[_0xdb5a('0x3d')](LISTID[_0xdb5a('0x40')](),_0xdb5a('0x26'))[_0xdb5a('0x3d')](_0x23fa7f['id'][_0xdb5a('0x40')](),_0x2c0d80)[_0xdb5a('0x3d')](_0xdb5a('0x3e'),_0xdb5a('0x3a'))['field']('NOW()',_0xdb5a('0x3b'))[_0xdb5a('0x41')]('cm_contacts')['where'](_0xdb5a('0x43'))[_0xdb5a('0x44')]('ListId\x20=\x20?',LISTID['toString']())[_0xdb5a('0x44')](_0xdb5a('0x4c'),squel[_0xdb5a('0x49')](hopperContacts))[_0xdb5a('0x44')]('phone\x20IS\x20NOT\x20NULL'))[_0xdb5a('0x40')]();return _0x36aee7;}function _0x52f046(_0x27218e,_0x3c5bf8){var _0x3ecb60=squel[_0xdb5a('0x35')]()['into']('cm_hopper_black')['fromQuery']([_0xdb5a('0x1f'),_0xdb5a('0x3f'),_0xdb5a('0x26'),_0x3c5bf8,_0xdb5a('0x3a'),_0xdb5a('0x3b')],squel['select']()[_0xdb5a('0x3d')](_0xdb5a('0x1f'),'phone')['field']('id',_0xdb5a('0x3f'))[_0xdb5a('0x3d')](LISTID[_0xdb5a('0x40')](),_0xdb5a('0x26'))[_0xdb5a('0x3d')](_0x27218e['id']['toString'](),_0x3c5bf8)[_0xdb5a('0x3d')]('NOW()',_0xdb5a('0x3a'))[_0xdb5a('0x3d')](_0xdb5a('0x3e'),'updatedAt')[_0xdb5a('0x41')]('cm_contacts')['where'](_0xdb5a('0x43'))[_0xdb5a('0x44')](_0xdb5a('0x48'),LISTID[_0xdb5a('0x40')]())[_0xdb5a('0x44')](_0xdb5a('0x4c'),squel[_0xdb5a('0x49')](hopperContacts))[_0xdb5a('0x44')](_0xdb5a('0x45')))[_0xdb5a('0x40')]();return _0x3ecb60;}return db[_0xdb5a('0x4d')][_0xdb5a('0x4e')]({'where':{'type':_0xdb5a('0x4f')},'attributes':['id',_0xdb5a('0x50')],'include':[{'model':db[_0xdb5a('0x51')],'as':_0xdb5a('0x52'),'where':{'id':LISTID}}]})[_0xdb5a('0x2e')](function(_0x52fabc){var _0x529606=[];if(_0x52fabc){var _0x4ea30d;for(var _0x18d910=0x0,_0x4d31b1;_0x18d910<_0x52fabc[_0xdb5a('0x53')];_0x18d910+=0x1){_0x4d31b1=_0x52fabc[_0x18d910][_0xdb5a('0x54')]({'plain':!![]});switch(_0x4d31b1[_0xdb5a('0x50')]){case _0xdb5a('0x55'):_0x529606[_0xdb5a('0x56')](db['sequelize'][_0xdb5a('0x57')](_0x6c431e(_0x4d31b1,_0xdb5a('0x58')))[_0xdb5a('0x2e')](function(){})['catch'](_0x45305c()));break;case _0xdb5a('0x59'):_0x529606[_0xdb5a('0x56')](db['sequelize'][_0xdb5a('0x57')](_0x5470e3(_0x4d31b1,_0xdb5a('0x58')))[_0xdb5a('0x2e')](function(){})['catch'](_0x45305c()));break;default:_0x529606['push'](db[_0xdb5a('0x5a')][_0xdb5a('0x57')](_0x2efe9c(_0x4d31b1,_0xdb5a('0x58')))[_0xdb5a('0x2e')](function(){})[_0xdb5a('0x30')](_0x45305c()));}}}return _0x529606;})[_0xdb5a('0x5b')]()['then'](function(){return db[_0xdb5a('0x4d')]['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0xdb5a('0x51')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xdb5a('0x2e')](function(_0x2d024f){var _0x14035a=[];if(_0x2d024f){var _0x52115d;for(var _0x40d9ff=0x0,_0x5657be;_0x40d9ff<_0x2d024f[_0xdb5a('0x53')];_0x40d9ff+=0x1){_0x5657be=_0x2d024f[_0x40d9ff][_0xdb5a('0x54')]({'plain':!![]});_0x14035a['push'](db['sequelize'][_0xdb5a('0x57')](_0x52f046(_0x5657be,'VoiceQueueId'))[_0xdb5a('0x2e')](function(){})[_0xdb5a('0x30')](_0x45305c()));}}return _0x14035a;})[_0xdb5a('0x5b')]();})[_0xdb5a('0x2e')](function(){return db[_0xdb5a('0x5c')][_0xdb5a('0x4e')]({'attributes':['id',_0xdb5a('0x50')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0xdb5a('0x2e')](function(_0x4d6683){var _0x226c06=[];if(_0x4d6683){for(var _0x3c5bb0=0x0,_0x4e2e37;_0x3c5bb0<_0x4d6683[_0xdb5a('0x53')];_0x3c5bb0+=0x1){_0x4e2e37=_0x4d6683[_0x3c5bb0]['get']({'plain':!![]});switch(_0x4e2e37[_0xdb5a('0x50')]){case _0xdb5a('0x55'):_0x226c06['push'](db[_0xdb5a('0x5a')][_0xdb5a('0x57')](_0x6c431e(_0x4e2e37,_0xdb5a('0x5d')))[_0xdb5a('0x2e')](function(){})[_0xdb5a('0x30')](_0x45305c()));break;case'onlyIfOpen':_0x226c06[_0xdb5a('0x56')](db[_0xdb5a('0x5a')][_0xdb5a('0x57')](_0x5470e3(_0x4e2e37,_0xdb5a('0x5d')))[_0xdb5a('0x2e')](function(){})[_0xdb5a('0x30')](_0x45305c()));break;default:_0x226c06[_0xdb5a('0x56')](db[_0xdb5a('0x5a')][_0xdb5a('0x57')](_0x2efe9c(_0x4e2e37,'CampaignId'))['then'](function(){})[_0xdb5a('0x30')](_0x45305c()));}}}return _0x226c06;})[_0xdb5a('0x5b')]();})[_0xdb5a('0x2e')](function(){return db['Campaign'][_0xdb5a('0x4e')]({'attributes':['id'],'include':[{'model':db[_0xdb5a('0x51')],'as':_0xdb5a('0x5e'),'where':{'id':LISTID}}]})[_0xdb5a('0x2e')](function(_0x200c68){var _0x71cd18=[];if(_0x200c68){for(var _0x2e71c1=0x0,_0x34fc21;_0x2e71c1<_0x200c68[_0xdb5a('0x53')];_0x2e71c1+=0x1){_0x34fc21=_0x200c68[_0x2e71c1][_0xdb5a('0x54')]({'plain':!![]});_0x71cd18[_0xdb5a('0x56')](db[_0xdb5a('0x5a')][_0xdb5a('0x57')](_0x52f046(_0x34fc21,'CampaignId'))['then'](function(){})[_0xdb5a('0x30')](_0x45305c()));}}return _0x71cd18;})[_0xdb5a('0x5b')]();})['catch'](function(_0x48e777){logger[_0xdb5a('0x14')]('cmContact,\x20%s,\x20%s',_0xdb5a('0x5f'),_0x48e777[_0xdb5a('0x19')]);});}var processPromises=function(_0x5b5b63){return BPromise[_0xdb5a('0x5b')](promises)['then'](function(_0x44e41f){})['catch'](function(_0x1f8043){logger[_0xdb5a('0x14')]('Error\x20processing\x20rows\x20block:',JSON[_0xdb5a('0x31')](_0x1f8043));})[_0xdb5a('0x60')](function(){socket[_0xdb5a('0x61')](_0xdb5a('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5b5b63){return _0x5b5b63['resume']();}});};var endCsv=function(){return BPromise[_0xdb5a('0x63')]()[_0xdb5a('0x2e')](function(){if(hopperContacts){return checkHopper();}})[_0xdb5a('0x2e')](function(){socket[_0xdb5a('0x61')](_0xdb5a('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xdb5a('0x64')](FILEPATH);}catch(_0x179d4e){logger[_0xdb5a('0x14')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0xdb5a('0x31')](_0x179d4e));}finally{process[_0xdb5a('0x65')](0x0);}});};process['on'](_0xdb5a('0x66'),function(){logger[_0xdb5a('0x67')](_0xdb5a('0x68'));endCsv();});function main(){return BPromise['resolve']()[_0xdb5a('0x2e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xdb5a('0x11')](',');return db['CmContact'][_0xdb5a('0x4e')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xdb5a('0x2e')](function(_0x594077){var _0x32dab7=fs[_0xdb5a('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x32dab7,{'header':!![],'skipEmptyLines':!![],'step':function(_0x234acb,_0xee90e5){total+=0x1;var _0xdf2ff6=total;promises['push'](checkRow(_0x234acb,_0x594077,_0xdf2ff6)['then'](function(){success+=0x1;})[_0xdb5a('0x30')](function(_0x1ef349){if(_0x1ef349[_0xdb5a('0x14')]){errors+=0x1;delete _0x1ef349[_0xdb5a('0x14')];}else if(_0x1ef349[_0xdb5a('0x29')]){duplicates+=0x1;delete _0x1ef349['duplicate'];}rows['push'](_0x1ef349);}));if(total%0xc8===0x0){_0xee90e5[_0xdb5a('0x6a')]();return processPromises(_0xee90e5);}},'complete':function(){return processPromises()[_0xdb5a('0x2e')](function(){logger[_0xdb5a('0x67')](_0xdb5a('0x6b'));endCsv();});},'error':function(_0x236b52,_0x23ab51){logger[_0xdb5a('0x67')]('CSV\x20parse\x20error',JSON[_0xdb5a('0x31')](_0x236b52));endCsv();}});})['catch'](function(_0x49de41){logger[_0xdb5a('0x14')](_0xdb5a('0x6c'),JSON[_0xdb5a('0x31')](_0x49de41));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index ae5e1bf..194bdc2 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 _0x5ed6=['SIGINT','uncaughtException','lodash','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','socket.io-emitter','format','test','field','phone','from','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','priority','UserId','select','fields','cm_contacts','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_hopper_black','updatedAt','cm_contacts.ListId\x20=\x20','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','ListId\x20=\x20?','\x20=\x20?','concat','keys','CompanyId','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','error','message','exit','errors','push','sequelize','spread','catch','stringify','send','binding','root','.csv','header','writeFileSync','parse','data','length','rows','hasOwnProperty','trim','isValid','isNumber','includes','email','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','SystemRow','appendFileSync','emit','abort','SystemError','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','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','isNil','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','finish','affectedRows','contact:import:','unlink','complete','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available'];(function(_0x3a9661,_0x530b12){var _0x5bb119=function(_0x1278f){while(--_0x1278f){_0x3a9661['push'](_0x3a9661['shift']());}};_0x5bb119(++_0x530b12);}(_0x5ed6,0x83));var _0x65ed=function(_0x12ddb2,_0x5ad61e){_0x12ddb2=_0x12ddb2-0x0;var _0x10b6dd=_0x5ed6[_0x12ddb2];return _0x10b6dd;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x65ed('0x0'));var Papa=require('papaparse');var util=require(_0x65ed('0x1'));var BPromise=require(_0x65ed('0x2'));var moment=require(_0x65ed('0x3'));var squel=require(_0x65ed('0x4'));var Redis=require(_0x65ed('0x5'));var db=require(_0x65ed('0x6'))['db'];var config=require(_0x65ed('0x7'));var logger=require(_0x65ed('0x8'))(_0x65ed('0x9'));config[_0x65ed('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x65ed('0xb'))(new Redis(config[_0x65ed('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x65ed('0xc')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x31280c){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))*$/[_0x65ed('0xd')](_0x31280c);}function selectNotIn(_0xb56240,_0x388222,_0x135f23,_0x1220dd,_0x21835c){return squel['select']()[_0x65ed('0xe')](_0x65ed('0xf'))[_0x65ed('0x10')](_0x1220dd)[_0x65ed('0x11')](_0x388222,null,_0x388222+'.id\x20=\x20'+_0x1220dd+'.'+_0x135f23)[_0x65ed('0x12')](_0x1220dd+'.'+_0x135f23+_0x65ed('0x13')+_0xb56240+'.'+_0x135f23)['where'](_0x388222+_0x65ed('0x14')+_0x21835c[_0x65ed('0x11')]()+')');}function insertCmHopper(_0x1830db,_0x9b7857,_0x5cb215,_0x23d931,_0x269a00){var _0x36120f=[_0x65ed('0x15'),_0x65ed('0x16'),_0x65ed('0x17'),_0x65ed('0x18'),_0x9b7857+'.'+_0x23d931,_0x65ed('0x19'),_0x65ed('0x1a'),_0x65ed('0x1b'),_0x65ed('0x1c'),'\x22'+_0x269a00+'\x22'];return squel[_0x65ed('0x1d')]()[_0x65ed('0x1e')](_0x65ed('0x1f'))[_0x65ed('0x20')]([_0x65ed('0xf'),_0x65ed('0x21'),_0x65ed('0x22'),_0x65ed('0x23'),_0x23d931,_0x65ed('0x24'),'updatedAt',_0x65ed('0x25'),_0x65ed('0x26'),'recallme'],squel[_0x65ed('0x27')]()[_0x65ed('0x28')](_0x36120f)['from'](_0x9b7857)[_0x65ed('0x11')](_0x65ed('0x29'),null,'cm_contacts.ListId\x20=\x20'+_0x9b7857+_0x65ed('0x2a'))[_0x65ed('0x11')](_0x5cb215,null,_0x5cb215+_0x65ed('0x2b')+_0x9b7857+'.'+_0x23d931)[_0x65ed('0x12')](_0x9b7857+_0x65ed('0x2c'),_0x1830db)[_0x65ed('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x65ed('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x9b7857,_0x5cb215,_0x23d931,'cm_hopper',[_0x65ed('0x2d'),_0x65ed('0x2e')]))[_0x65ed('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x9b7857,_0x5cb215,_0x23d931,'cm_hopper',['\x22always\x22'])))[_0x65ed('0x2f')]();}function insertCmHopperBlack(_0x2ed8d3,_0x61968c,_0xce1884,_0x2dc045){var _0x4da9c4=[_0x65ed('0x15'),'cm_contacts.id','cm_contacts.ListId',_0x61968c+'.'+_0x2dc045,_0x65ed('0x19'),'cm_contacts.updatedAt'];return squel['insert']()[_0x65ed('0x1e')](_0x65ed('0x30'))[_0x65ed('0x20')]([_0x65ed('0xf'),_0x65ed('0x22'),'ListId',_0x2dc045,_0x65ed('0x24'),_0x65ed('0x31')],squel[_0x65ed('0x27')]()[_0x65ed('0x28')](_0x4da9c4)[_0x65ed('0x10')](_0x61968c)[_0x65ed('0x11')]('cm_contacts',null,_0x65ed('0x32')+_0x61968c+'.CmListId')[_0x65ed('0x11')](_0xce1884,null,_0xce1884+_0x65ed('0x2b')+_0x61968c+'.'+_0x2dc045)[_0x65ed('0x12')](_0x61968c+'.CmListId\x20=\x20?',_0x2ed8d3)[_0x65ed('0x12')](_0x65ed('0x33'),NOW)[_0x65ed('0x12')](_0x65ed('0x34'),squel[_0x65ed('0x27')]()[_0x65ed('0xe')](_0x65ed('0xf'))['from'](_0x65ed('0x30'))['where'](_0x65ed('0x35'),_0x2ed8d3)['where'](_0x2dc045+_0x65ed('0x36'),_0x61968c+'.'+_0x2dc045)))[_0x65ed('0x2f')]();}function insertCmContact(_0x10d44b,_0x514d20,_0x33a6db,_0x34b085){var _0x29fa61=_[_0x65ed('0x37')](_[_0x65ed('0x38')](_0x34b085),[_0x65ed('0x23'),_0x65ed('0x39'),_0x65ed('0x24'),'updatedAt']);return squel[_0x65ed('0x1d')]()[_0x65ed('0x1e')]('cm_contacts')[_0x65ed('0x20')](_0x29fa61,squel[_0x65ed('0x27')]()[_0x65ed('0x28')](_0x29fa61)[_0x65ed('0x10')](_0x514d20)[_0x65ed('0x12')]('('+_0x33a6db[_0x65ed('0x11')](',')+')\x20NOT\x20IN\x20?',squel[_0x65ed('0x27')]()[_0x65ed('0x28')](_0x33a6db)[_0x65ed('0x10')]('cm_contacts')[_0x65ed('0x12')](_0x65ed('0x35'),_0x10d44b)[_0x65ed('0x12')](_0x65ed('0x3a')))['where'](_0x65ed('0x3b'),squel['select']()[_0x65ed('0xe')](_0x65ed('0x3c'),_0x65ed('0x3d'))[_0x65ed('0x10')](_0x514d20)[_0x65ed('0x3e')](_0x33a6db[_0x65ed('0x11')](','))))['toString']();}function handleStop(){logger[_0x65ed('0x3f')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x3a4a97){logger[_0x65ed('0x40')](_0x3a4a97[_0x65ed('0x41')]);process[_0x65ed('0x42')](0x1);}function handleError(_0x1fa0b9,_0x5dab2c){stats[_0x65ed('0x43')][_0x65ed('0x44')]({'name':_0x5dab2c['code'],'message':_0x5dab2c[_0x65ed('0x41')],'row':_0x1fa0b9});}function handleQuery(_0xf0580a){logger['info'](_0xf0580a);return db[_0x65ed('0x45')]['query'](_0xf0580a)[_0x65ed('0x46')](function(_0x5f3e19){results[_0x65ed('0x44')](_0x5f3e19);})[_0x65ed('0x47')](function(_0x422f61){logger[_0x65ed('0x40')](_0x422f61[_0x65ed('0x41')]);});}function main(_0x1328fd,_0x2aa8a6,_0x4f5f79,_0x99ae){logger[_0x65ed('0x3f')]('main',_0x1328fd,JSON[_0x65ed('0x48')](_0x2aa8a6));process[_0x65ed('0x49')]('start');var _0x3e6c82=_0x2aa8a6[_0x65ed('0x4a')];var _0x4a7e7f=_0x2aa8a6['socket_timestamp'];var _0x23da78=path[_0x65ed('0x11')](config[_0x65ed('0x4b')],'server/files/tmp',_0x4a7e7f+_0x65ed('0x4c'));var _0x360154=_[_0x65ed('0x38')](_0x3e6c82)[_0x65ed('0x11')]();logger[_0x65ed('0x3f')](_0x65ed('0x4d'),_0x360154);fs[_0x65ed('0x4e')](_0x23da78,_0x360154+'\x0a');Papa[_0x65ed('0x4f')](fs['createReadStream'](_0x1328fd),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4ffe78,_0x158181){try{for(var _0x2a8b54=0x0,_0x7cea83=[];_0x2a8b54<_0x4ffe78[_0x65ed('0x50')][_0x65ed('0x51')];_0x2a8b54++){stats[_0x65ed('0x52')]+=0x1;if(_0x4ffe78['errors'][_0x2a8b54]){handleError(_0x4ffe78[_0x65ed('0x50')][_0x2a8b54],_0x4ffe78['errors'][_0x2a8b54]);}else{var _0x56d3c4=[];for(var _0x1837a2 in _0x3e6c82){if(_0x3e6c82[_0x65ed('0x53')](_0x1837a2)){if(_0x4ffe78[_0x65ed('0x50')][_0x2a8b54][_0x3e6c82[_0x1837a2]]){var _0x7223a1=_[_0x65ed('0x54')](_0x4ffe78[_0x65ed('0x50')][_0x2a8b54][_0x3e6c82[_0x1837a2]]['replace'](/"/g,'\x27'));switch(_0x1837a2){case _0x65ed('0x21'):var _0x2db197=moment(_0x7223a1,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x2db197[_0x65ed('0x55')]()){_0x7cea83['push']('\x22'+_0x7223a1+'\x22');}else{_0x56d3c4['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x65ed('0x25'):var _0x3465be=parseInt(_0x7223a1);_0x7223a1=_['isNaN'](_0x3465be)||_0x3465be<0x0||_0x3465be>0x4?_0x99ae?0x3:0x2:_0x3465be;_0x7cea83[_0x65ed('0x44')]('\x22'+_0x7223a1+'\x22');break;case _0x65ed('0x26'):var _0x10df11=parseInt(_0x7223a1);if(_[_0x65ed('0x56')](_0x10df11)&&_[_0x65ed('0x57')](_0x4f5f79,_0x10df11)){_0x7cea83[_0x65ed('0x44')]('\x22'+_0x10df11+'\x22');}else{_0x56d3c4[_0x65ed('0x44')]('agent\x20not\x20exists');}break;case _0x65ed('0x58'):if(isEmail(_0x7223a1)){_0x7cea83[_0x65ed('0x44')]('\x22'+_0x7223a1+'\x22');}else{_0x56d3c4[_0x65ed('0x44')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x16baf7=moment(_0x7223a1,_0x65ed('0x59'),!![]);if(_0x16baf7['isValid']()){_0x7cea83[_0x65ed('0x44')]('\x22'+_0x7223a1+'\x22');}else{_0x56d3c4[_0x65ed('0x44')](_0x65ed('0x5a'));}break;default:_0x7cea83[_0x65ed('0x44')]('\x22'+_0x7223a1+'\x22');}}else{switch(_0x1837a2){case _0x65ed('0x5b'):case _0x65ed('0xf'):_0x56d3c4[_0x65ed('0x44')](_0x1837a2+'\x20not\x20specified');break;default:_0x7cea83[_0x65ed('0x44')]('\x22\x22');}}}}if(_0x56d3c4[_0x65ed('0x51')]){handleError(_0x4ffe78['data'][_0x2a8b54],{'code':_0x65ed('0x5c'),'message':_0x56d3c4[_0x65ed('0x11')]()});}else{fs[_0x65ed('0x5d')](_0x23da78,_0x7cea83[_0x65ed('0x11')]()+'\x0a');}_0x7cea83=[];}if(!(stats['rows']%0xc8)){socket[_0x65ed('0x5e')]('contact:import:'+_0x4a7e7f,stats);stats['errors']=[];}}if(stopped){logger[_0x65ed('0x3f')]('Abort\x20parser');_0x158181[_0x65ed('0x5f')]();}}catch(_0x450ae6){handleError(_0x4ffe78[_0x65ed('0x50')][_0x2a8b54],{'code':_0x65ed('0x60'),'message':_0x450ae6['message']});logger[_0x65ed('0x40')](_0x65ed('0x61'),_0x450ae6[_0x65ed('0x41')]);}},'complete':function(){try{var _0x5ba8df=[];var _0x2d2d9d=_0x65ed('0x29');if(_0x2aa8a6['duplicates']&&_0x2aa8a6[_0x65ed('0x62')][_0x65ed('0x51')]){_0x2d2d9d='cm_contacts_'+_0x4a7e7f;_0x5ba8df[_0x65ed('0x44')](_0x65ed('0x63')+_0x2d2d9d+_0x65ed('0x64'));}var _0x50b51d=util[_0x65ed('0xc')](_0x65ed('0x65'),_0x23da78,_0x2d2d9d,_0x360154,_0x2aa8a6[_0x65ed('0x23')],_0x2aa8a6[_0x65ed('0x39')]||null,NOW,NOW);if(_[_0x65ed('0x66')](_0x3e6c82[_0x65ed('0x21')])){_0x50b51d+=',\x20scheduledAt\x20=\x20NOW()';}_0x5ba8df['push'](_0x50b51d);if(_0x2aa8a6[_0x65ed('0x62')]&&_0x2aa8a6['duplicates']['length']){_0x5ba8df[_0x65ed('0x44')](insertCmContact(_0x2aa8a6[_0x65ed('0x23')],_0x2d2d9d,_0x2aa8a6['duplicates'],_0x3e6c82));_0x5ba8df[_0x65ed('0x44')](_0x65ed('0x67')+_0x2d2d9d+';');}_0x5ba8df[_0x65ed('0x44')](insertCmHopper(_0x2aa8a6['ListId'],_0x65ed('0x68'),_0x65ed('0x69'),_0x65ed('0x6a'),_0x99ae));_0x5ba8df[_0x65ed('0x44')](insertCmHopperBlack(_0x2aa8a6[_0x65ed('0x23')],_0x65ed('0x6b'),'voice_queues','VoiceQueueId'));_0x5ba8df[_0x65ed('0x44')](insertCmHopper(_0x2aa8a6[_0x65ed('0x23')],_0x65ed('0x6c'),_0x65ed('0x6d'),_0x65ed('0x6e'),_0x99ae));_0x5ba8df[_0x65ed('0x44')](insertCmHopperBlack(_0x2aa8a6[_0x65ed('0x23')],_0x65ed('0x6f'),'campaigns',_0x65ed('0x6e')));BPromise[_0x65ed('0x70')](_0x5ba8df,handleQuery)['then'](function(_0x4bb98){stats[_0x65ed('0x71')]=!![];stats['affectedRows']=_0x2aa8a6['duplicates']&&_0x2aa8a6[_0x65ed('0x62')]['length']?results[0x2][_0x65ed('0x72')]:results[0x0][_0x65ed('0x72')];socket[_0x65ed('0x5e')](_0x65ed('0x73')+_0x4a7e7f,stats);fs[_0x65ed('0x74')](_0x1328fd);fs[_0x65ed('0x74')](_0x23da78);process[_0x65ed('0x42')](0x0);})[_0x65ed('0x47')](function(_0x217caf){logger[_0x65ed('0x40')](_0x217caf[_0x65ed('0x41')]);process[_0x65ed('0x42')](0x1);});}catch(_0x5b1b40){logger[_0x65ed('0x40')](_0x65ed('0x75'),_0x5b1b40[_0x65ed('0x41')]);process['exit'](0x1);}},'error':function(_0x7e0e75,_0x1a1cb6,_0xbb9856,_0x2157fd){throw new Error(_0x2157fd);}});}function validate(){if(process[_0x65ed('0x76')]&&process['argv'][_0x65ed('0x51')]<0x4){throw new Error(_0x65ed('0x77'));}var _0x1abac7=path[_0x65ed('0x11')](config['root'],_0x65ed('0x78'),process[_0x65ed('0x76')][0x2]);if(!fs[_0x65ed('0x79')](_0x1abac7)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x7046b={};try{_0x7046b=JSON['parse'](process[_0x65ed('0x76')][0x3]);if(!_0x7046b[_0x65ed('0x4a')]){throw new Error(_0x65ed('0x7a'));}if(!_0x7046b[_0x65ed('0x4a')][_0x65ed('0xf')]){throw new Error(_0x65ed('0x7b'));}if(!_0x7046b[_0x65ed('0x4a')][_0x65ed('0x5b')]){throw new Error('firstName\x20is\x20mandatory');}var _0x231e30=0x0;if(_0x7046b[_0x65ed('0x4a')]['UserId']){_0x231e30=0x1;}if(!_0x7046b[_0x65ed('0x23')]){throw new Error(_0x65ed('0x7c'));}}catch(_0x39a342){throw new Error(_0x65ed('0x7d'));}var _0x42af16=[];try{_0x42af16=_['map'](JSON[_0x65ed('0x4f')](process[_0x65ed('0x76')][0x4]),'id');}catch(_0x16fc34){logger[_0x65ed('0x3f')](_0x65ed('0x7e'));}main(_0x1abac7,_0x7046b,_0x42af16,_0x231e30);}validate();process['on'](_0x65ed('0x7f'),handleStop);process['on'](_0x65ed('0x80'),handleUncaughtException); \ No newline at end of file +var _0xeb37=['rows','contact:import:','Abort\x20parser','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','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','voice_queues_has_cm_lists','voice_queues','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','finish','affectedRows','unlink','catch','complete','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','where','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','fromQuery','ListId','createdAt','updatedAt','priority','UserId','fields','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','toString','cm_contacts.createdAt','cm_contacts.updatedAt','into','cm_hopper_black','.CmListId','ListId\x20=\x20?','concat',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','MIN(id)','min_id','group','Received\x20SIGINT','error','exit','errors','push','message','sequelize','query','spread','info','main','send','start','binding','socket_timestamp','root','.csv','writeFileSync','parse','createReadStream','data','length','scheduledat','isValid','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','appendFileSync'];(function(_0x1372d7,_0x1cdd6f){var _0x3293c5=function(_0x5bab0f){while(--_0x5bab0f){_0x1372d7['push'](_0x1372d7['shift']());}};_0x3293c5(++_0x1cdd6f);}(_0xeb37,0x1ad));var _0x7eb3=function(_0x42818e,_0x53a0c4){_0x42818e=_0x42818e-0x0;var _0x4b7ccf=_0xeb37[_0x42818e];return _0x4b7ccf;};'use strict';var fs=require('fs');var path=require(_0x7eb3('0x0'));var _=require(_0x7eb3('0x1'));var Papa=require(_0x7eb3('0x2'));var util=require(_0x7eb3('0x3'));var BPromise=require(_0x7eb3('0x4'));var moment=require(_0x7eb3('0x5'));var squel=require(_0x7eb3('0x6'));var Redis=require(_0x7eb3('0x7'));var db=require(_0x7eb3('0x8'))['db'];var config=require(_0x7eb3('0x9'));var logger=require(_0x7eb3('0xa'))(_0x7eb3('0xb'));config[_0x7eb3('0xc')]=_['defaults'](config['redis'],{'host':_0x7eb3('0xd'),'port':0x18eb});var socket=require(_0x7eb3('0xe'))(new Redis(config[_0x7eb3('0xc')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x7eb3('0xf')](_0x7eb3('0x10'));function isEmail(_0x5aaddf){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))*$/[_0x7eb3('0x11')](_0x5aaddf);}function selectNotIn(_0x3133c3,_0x7dc04,_0x34b97c,_0x39720b,_0x263e25){return squel[_0x7eb3('0x12')]()[_0x7eb3('0x13')](_0x7eb3('0x14'))[_0x7eb3('0x15')](_0x39720b)[_0x7eb3('0x16')](_0x7dc04,null,_0x7dc04+_0x7eb3('0x17')+_0x39720b+'.'+_0x34b97c)[_0x7eb3('0x18')](_0x39720b+'.'+_0x34b97c+'\x20=\x20'+_0x3133c3+'.'+_0x34b97c)[_0x7eb3('0x18')](_0x7dc04+'.dialCheckDuplicateType\x20IN\x20('+_0x263e25[_0x7eb3('0x16')]()+')');}function insertCmHopper(_0x34b529,_0x2a60bf,_0x419f29,_0x5e252f,_0x35f3ea){var _0x3d370e=[_0x7eb3('0x19'),_0x7eb3('0x1a'),_0x7eb3('0x1b'),_0x7eb3('0x1c'),_0x2a60bf+'.'+_0x5e252f,'cm_contacts.createdAt','cm_contacts.updatedAt',_0x7eb3('0x1d'),_0x7eb3('0x1e'),'\x22'+_0x35f3ea+'\x22'];return squel[_0x7eb3('0x1f')]()['into'](_0x7eb3('0x20'))[_0x7eb3('0x21')](['phone','scheduledat','ContactId',_0x7eb3('0x22'),_0x5e252f,_0x7eb3('0x23'),_0x7eb3('0x24'),_0x7eb3('0x25'),_0x7eb3('0x26'),'recallme'],squel[_0x7eb3('0x12')]()[_0x7eb3('0x27')](_0x3d370e)['from'](_0x2a60bf)[_0x7eb3('0x16')](_0x7eb3('0x28'),null,_0x7eb3('0x29')+_0x2a60bf+'.CmListId')[_0x7eb3('0x16')](_0x419f29,null,_0x419f29+'.id\x20=\x20'+_0x2a60bf+'.'+_0x5e252f)[_0x7eb3('0x18')](_0x2a60bf+_0x7eb3('0x2a'),_0x34b529)[_0x7eb3('0x18')](_0x7eb3('0x2b'),NOW)[_0x7eb3('0x18')](_0x7eb3('0x2c'),selectNotIn(_0x2a60bf,_0x419f29,_0x5e252f,_0x7eb3('0x20'),[_0x7eb3('0x2d'),_0x7eb3('0x2e')]))[_0x7eb3('0x18')](_0x7eb3('0x2c'),selectNotIn(_0x2a60bf,_0x419f29,_0x5e252f,'cm_hopper',[_0x7eb3('0x2d')])))[_0x7eb3('0x2f')]();}function insertCmHopperBlack(_0x316570,_0x71d67,_0x48614d,_0x44a4b6){var _0xa4d1a=[_0x7eb3('0x19'),_0x7eb3('0x1b'),_0x7eb3('0x1c'),_0x71d67+'.'+_0x44a4b6,_0x7eb3('0x30'),_0x7eb3('0x31')];return squel[_0x7eb3('0x1f')]()[_0x7eb3('0x32')](_0x7eb3('0x33'))[_0x7eb3('0x21')](['phone','ContactId',_0x7eb3('0x22'),_0x44a4b6,_0x7eb3('0x23'),_0x7eb3('0x24')],squel[_0x7eb3('0x12')]()[_0x7eb3('0x27')](_0xa4d1a)[_0x7eb3('0x15')](_0x71d67)[_0x7eb3('0x16')](_0x7eb3('0x28'),null,_0x7eb3('0x29')+_0x71d67+_0x7eb3('0x34'))['join'](_0x48614d,null,_0x48614d+_0x7eb3('0x17')+_0x71d67+'.'+_0x44a4b6)[_0x7eb3('0x18')](_0x71d67+_0x7eb3('0x2a'),_0x316570)[_0x7eb3('0x18')](_0x7eb3('0x2b'),NOW)[_0x7eb3('0x18')](_0x7eb3('0x2c'),squel['select']()[_0x7eb3('0x13')]('phone')[_0x7eb3('0x15')]('cm_hopper_black')[_0x7eb3('0x18')](_0x7eb3('0x35'),_0x316570)[_0x7eb3('0x18')](_0x44a4b6+'\x20=\x20?',_0x71d67+'.'+_0x44a4b6)))[_0x7eb3('0x2f')]();}function insertCmContact(_0x4cc889,_0xfe0651,_0x16fddc,_0x43bc8e){var _0x3ae042=_[_0x7eb3('0x36')](_['keys'](_0x43bc8e),[_0x7eb3('0x22'),'CompanyId','createdAt',_0x7eb3('0x24')]);return squel[_0x7eb3('0x1f')]()[_0x7eb3('0x32')](_0x7eb3('0x28'))[_0x7eb3('0x21')](_0x3ae042,squel['select']()['fields'](_0x3ae042)[_0x7eb3('0x15')](_0xfe0651)[_0x7eb3('0x18')]('('+_0x16fddc[_0x7eb3('0x16')](',')+_0x7eb3('0x37'),squel[_0x7eb3('0x12')]()[_0x7eb3('0x27')](_0x16fddc)['from'](_0x7eb3('0x28'))[_0x7eb3('0x18')](_0x7eb3('0x35'),_0x4cc889)[_0x7eb3('0x18')](_0x7eb3('0x38')))[_0x7eb3('0x18')]('id\x20IN\x20?',squel[_0x7eb3('0x12')]()[_0x7eb3('0x13')](_0x7eb3('0x39'),_0x7eb3('0x3a'))[_0x7eb3('0x15')](_0xfe0651)[_0x7eb3('0x3b')](_0x16fddc[_0x7eb3('0x16')](','))))[_0x7eb3('0x2f')]();}function handleStop(){logger['info'](_0x7eb3('0x3c'));stopped=!![];}function handleUncaughtException(_0x51cacd){logger[_0x7eb3('0x3d')](_0x51cacd['message']);process[_0x7eb3('0x3e')](0x1);}function handleError(_0x3a62f8,_0x41aa24){stats[_0x7eb3('0x3f')][_0x7eb3('0x40')]({'name':_0x41aa24['code'],'message':_0x41aa24[_0x7eb3('0x41')],'row':_0x3a62f8});}function handleQuery(_0x11f0db){logger['info'](_0x11f0db);return db[_0x7eb3('0x42')][_0x7eb3('0x43')](_0x11f0db)[_0x7eb3('0x44')](function(_0x581b0b){results[_0x7eb3('0x40')](_0x581b0b);})['catch'](function(_0x347c95){logger['error'](_0x347c95[_0x7eb3('0x41')]);});}function main(_0x19c221,_0x25a665,_0x292b84,_0x576cc8){logger[_0x7eb3('0x45')](_0x7eb3('0x46'),_0x19c221,JSON['stringify'](_0x25a665));process[_0x7eb3('0x47')](_0x7eb3('0x48'));var _0x19899a=_0x25a665[_0x7eb3('0x49')];var _0xe3d8f=_0x25a665[_0x7eb3('0x4a')];var _0x3116e5=path[_0x7eb3('0x16')](config[_0x7eb3('0x4b')],'server/files/tmp',_0xe3d8f+_0x7eb3('0x4c'));var _0x547d27=_['keys'](_0x19899a)[_0x7eb3('0x16')]();logger[_0x7eb3('0x45')]('header',_0x547d27);fs[_0x7eb3('0x4d')](_0x3116e5,_0x547d27+'\x0a');Papa[_0x7eb3('0x4e')](fs[_0x7eb3('0x4f')](_0x19c221),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2b8eee,_0x4ed134){try{for(var _0x41de40=0x0,_0x1feec5=[];_0x41de40<_0x2b8eee[_0x7eb3('0x50')][_0x7eb3('0x51')];_0x41de40++){stats['rows']+=0x1;if(_0x2b8eee[_0x7eb3('0x3f')][_0x41de40]){handleError(_0x2b8eee[_0x7eb3('0x50')][_0x41de40],_0x2b8eee[_0x7eb3('0x3f')][_0x41de40]);}else{var _0x3ee7c2=[];for(var _0x31d17f in _0x19899a){if(_0x19899a['hasOwnProperty'](_0x31d17f)){if(_0x2b8eee[_0x7eb3('0x50')][_0x41de40][_0x19899a[_0x31d17f]]){var _0x5b0382=_['trim'](_0x2b8eee['data'][_0x41de40][_0x19899a[_0x31d17f]]['replace'](/"/g,'\x27'));switch(_0x31d17f){case _0x7eb3('0x52'):var _0x3cf163=moment(_0x5b0382,_0x7eb3('0x10'),!![]);if(_0x3cf163[_0x7eb3('0x53')]()){_0x1feec5[_0x7eb3('0x40')]('\x22'+_0x5b0382+'\x22');}else{_0x3ee7c2['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x7eb3('0x25'):var _0x4c4a68=parseInt(_0x5b0382);_0x5b0382=_['isNaN'](_0x4c4a68)||_0x4c4a68<0x0||_0x4c4a68>0x4?_0x576cc8?0x3:0x2:_0x4c4a68;_0x1feec5[_0x7eb3('0x40')]('\x22'+_0x5b0382+'\x22');break;case _0x7eb3('0x26'):var _0x2b52e3=parseInt(_0x5b0382);if(_[_0x7eb3('0x54')](_0x2b52e3)&&_[_0x7eb3('0x55')](_0x292b84,_0x2b52e3)){_0x1feec5[_0x7eb3('0x40')]('\x22'+_0x2b52e3+'\x22');}else{_0x3ee7c2['push'](_0x7eb3('0x56'));}break;case _0x7eb3('0x57'):if(isEmail(_0x5b0382)){_0x1feec5[_0x7eb3('0x40')]('\x22'+_0x5b0382+'\x22');}else{_0x3ee7c2[_0x7eb3('0x40')](_0x7eb3('0x58'));}break;case _0x7eb3('0x59'):var _0x7e0697=moment(_0x5b0382,_0x7eb3('0x5a'),!![]);if(_0x7e0697[_0x7eb3('0x53')]()){_0x1feec5[_0x7eb3('0x40')]('\x22'+_0x5b0382+'\x22');}else{_0x3ee7c2[_0x7eb3('0x40')](_0x7eb3('0x5b'));}break;default:_0x1feec5[_0x7eb3('0x40')]('\x22'+_0x5b0382+'\x22');}}else{switch(_0x31d17f){case _0x7eb3('0x5c'):case _0x7eb3('0x14'):_0x3ee7c2[_0x7eb3('0x40')](_0x31d17f+_0x7eb3('0x5d'));break;default:_0x1feec5[_0x7eb3('0x40')]('\x22\x22');}}}}if(_0x3ee7c2[_0x7eb3('0x51')]){handleError(_0x2b8eee[_0x7eb3('0x50')][_0x41de40],{'code':'SystemRow','message':_0x3ee7c2[_0x7eb3('0x16')]()});}else{fs[_0x7eb3('0x5e')](_0x3116e5,_0x1feec5[_0x7eb3('0x16')]()+'\x0a');}_0x1feec5=[];}if(!(stats[_0x7eb3('0x5f')]%0xc8)){socket['emit'](_0x7eb3('0x60')+_0xe3d8f,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x7eb3('0x61'));_0x4ed134['abort']();}}catch(_0x2c50d6){handleError(_0x2b8eee[_0x7eb3('0x50')][_0x41de40],{'code':_0x7eb3('0x62'),'message':_0x2c50d6[_0x7eb3('0x41')]});logger[_0x7eb3('0x3d')](_0x7eb3('0x63'),_0x2c50d6[_0x7eb3('0x41')]);}},'complete':function(){try{var _0x165e35=[];var _0x3405a7=_0x7eb3('0x28');if(_0x25a665[_0x7eb3('0x64')]&&_0x25a665[_0x7eb3('0x64')][_0x7eb3('0x51')]){_0x3405a7=_0x7eb3('0x65')+_0xe3d8f;_0x165e35[_0x7eb3('0x40')]('CREATE\x20TABLE\x20'+_0x3405a7+_0x7eb3('0x66'));}var _0x2a3ef8=util[_0x7eb3('0xf')](_0x7eb3('0x67'),_0x3116e5,_0x3405a7,_0x547d27,_0x25a665[_0x7eb3('0x22')],_0x25a665['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x19899a[_0x7eb3('0x52')])){_0x2a3ef8+=',\x20scheduledAt\x20=\x20NOW()';}_0x165e35[_0x7eb3('0x40')](_0x2a3ef8);if(_0x25a665['duplicates']&&_0x25a665[_0x7eb3('0x64')][_0x7eb3('0x51')]){_0x165e35[_0x7eb3('0x40')](insertCmContact(_0x25a665['ListId'],_0x3405a7,_0x25a665['duplicates'],_0x19899a));_0x165e35[_0x7eb3('0x40')]('DROP\x20TABLE\x20'+_0x3405a7+';');}_0x165e35['push'](insertCmHopper(_0x25a665['ListId'],_0x7eb3('0x68'),_0x7eb3('0x69'),'VoiceQueueId',_0x576cc8));_0x165e35['push'](insertCmHopperBlack(_0x25a665[_0x7eb3('0x22')],'voice_queues_has_cm_blacklists',_0x7eb3('0x69'),'VoiceQueueId'));_0x165e35[_0x7eb3('0x40')](insertCmHopper(_0x25a665[_0x7eb3('0x22')],_0x7eb3('0x6a'),_0x7eb3('0x6b'),_0x7eb3('0x6c'),_0x576cc8));_0x165e35[_0x7eb3('0x40')](insertCmHopperBlack(_0x25a665[_0x7eb3('0x22')],_0x7eb3('0x6d'),_0x7eb3('0x6b'),_0x7eb3('0x6c')));BPromise[_0x7eb3('0x6e')](_0x165e35,handleQuery)[_0x7eb3('0x6f')](function(_0x57320f){stats[_0x7eb3('0x70')]=!![];stats['affectedRows']=_0x25a665[_0x7eb3('0x64')]&&_0x25a665[_0x7eb3('0x64')][_0x7eb3('0x51')]?results[0x2][_0x7eb3('0x71')]:results[0x0][_0x7eb3('0x71')];socket['emit']('contact:import:'+_0xe3d8f,stats);fs[_0x7eb3('0x72')](_0x19c221);fs[_0x7eb3('0x72')](_0x3116e5);process['exit'](0x0);})[_0x7eb3('0x73')](function(_0xc5dbba){logger[_0x7eb3('0x3d')](_0xc5dbba[_0x7eb3('0x41')]);process['exit'](0x1);});}catch(_0x6d87d5){logger['error'](_0x7eb3('0x74'),_0x6d87d5[_0x7eb3('0x41')]);process[_0x7eb3('0x3e')](0x1);}},'error':function(_0x36422c,_0x51169b,_0x5d3a2a,_0x3a9458){throw new Error(_0x3a9458);}});}function validate(){if(process[_0x7eb3('0x75')]&&process['argv'][_0x7eb3('0x51')]<0x4){throw new Error(_0x7eb3('0x76'));}var _0x33461e=path[_0x7eb3('0x16')](config[_0x7eb3('0x4b')],_0x7eb3('0x77'),process[_0x7eb3('0x75')][0x2]);if(!fs[_0x7eb3('0x78')](_0x33461e)){throw new Error(_0x7eb3('0x79'));}var _0x2f1cac={};try{_0x2f1cac=JSON[_0x7eb3('0x4e')](process[_0x7eb3('0x75')][0x3]);if(!_0x2f1cac[_0x7eb3('0x49')]){throw new Error(_0x7eb3('0x7a'));}if(!_0x2f1cac['binding']['phone']){throw new Error(_0x7eb3('0x7b'));}if(!_0x2f1cac['binding'][_0x7eb3('0x5c')]){throw new Error(_0x7eb3('0x7c'));}var _0x1fac29=0x0;if(_0x2f1cac[_0x7eb3('0x49')]['UserId']){_0x1fac29=0x1;}if(!_0x2f1cac[_0x7eb3('0x22')]){throw new Error(_0x7eb3('0x7d'));}}catch(_0x1b83ad){throw new Error(_0x7eb3('0x7e'));}var _0x3c0eee=[];try{_0x3c0eee=_[_0x7eb3('0x7f')](JSON[_0x7eb3('0x4e')](process[_0x7eb3('0x75')][0x4]),'id');}catch(_0x52f530){logger[_0x7eb3('0x45')](_0x7eb3('0x80'));}main(_0x33461e,_0x2f1cac,_0x3c0eee,_0x1fac29);}validate();process['on'](_0x7eb3('0x81'),handleStop);process['on'](_0x7eb3('0x82'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index e85725a..7a7c154 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3884=['destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','membername','starttime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','voice','toLowerCase','inbound','push','queue','variable','calleridnum','outbound','Outbound\x20Call'];(function(_0x591cfd,_0x501204){var _0x4d0100=function(_0xb9ff0c){while(--_0xb9ff0c){_0x591cfd['push'](_0x591cfd['shift']());}};_0x4d0100(++_0x501204);}(_0x3884,0xd5));var _0x4388=function(_0x5b27da,_0x4a6532){_0x5b27da=_0x5b27da-0x0;var _0x3254f4=_0x3884[_0x5b27da];return _0x3254f4;};'use strict';exports[_0x4388('0x0')]=function(_0x23a96f,_0x18d124){var _0x1939b1=[{'type':_0x4388('0x1'),'content':_0x4388('0x2'),'variableName':null}];switch(_0x23a96f['toLowerCase']()){case _0x4388('0x3'):switch(_0x18d124[_0x4388('0x4')]()){case _0x4388('0x5'):_0x1939b1[_0x4388('0x6')]({'type':'variable','content':'','variableName':_0x4388('0x7')});_0x1939b1[_0x4388('0x6')]({'type':_0x4388('0x8'),'content':'','variableName':_0x4388('0x9')});break;case _0x4388('0xa'):_0x1939b1[_0x4388('0x6')]({'type':'string','content':_0x4388('0xb'),'variableName':null});_0x1939b1['push']({'type':_0x4388('0x8'),'content':'','variableName':_0x4388('0xc')});break;}}return _0x1939b1;};exports[_0x4388('0xd')]=function(_0x1742e6,_0x97b324){var _0x4d839f=[];switch(_0x1742e6[_0x4388('0x4')]()){case'voice':switch(_0x97b324[_0x4388('0x4')]()){case'inbound':_0x4d839f=[{'type':'string','content':_0x4388('0xe'),'key':null,'keyType':null,'variableName':null},{'type':_0x4388('0xf'),'content':'','key':_0x4388('0x10'),'keyType':_0x4388('0x8'),'variableName':'calleridnum'},{'type':'keyValue','content':'','key':_0x4388('0x11'),'keyType':_0x4388('0x8'),'variableName':_0x4388('0x12')},{'type':'keyValue','content':'','key':_0x4388('0x13'),'keyType':_0x4388('0x8'),'variableName':_0x4388('0x14')},{'type':_0x4388('0xf'),'content':'','key':_0x4388('0x15'),'keyType':_0x4388('0x8'),'variableName':_0x4388('0x7')},{'type':_0x4388('0xf'),'content':'','key':'UniqueId','keyType':'variable','variableName':_0x4388('0x16')},{'type':_0x4388('0xf'),'content':'','key':_0x4388('0x17'),'keyType':'variable','variableName':_0x4388('0x18')},{'type':_0x4388('0x1'),'content':_0x4388('0x19'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x4388('0x1a'),'keyType':'variable','variableName':_0x4388('0x1b')},{'type':_0x4388('0xf'),'content':'','key':_0x4388('0x1c'),'keyType':_0x4388('0x8'),'variableName':_0x4388('0xc')},{'type':_0x4388('0x1'),'content':_0x4388('0x1d'),'key':null,'keyType':null,'variableName':null},{'type':_0x4388('0xf'),'content':'','key':_0x4388('0x1e'),'keyType':_0x4388('0x8'),'variableName':'agentcalledAt'},{'type':'keyValue','content':'','key':_0x4388('0x1f'),'keyType':_0x4388('0x8'),'variableName':'agentconnectAt'},{'type':'keyValue','content':'','key':'Agent\x20Complete','keyType':'variable','variableName':'agentcompleteAt'},{'type':_0x4388('0xf'),'content':'','key':_0x4388('0x20'),'keyType':_0x4388('0x8'),'variableName':_0x4388('0x21')},{'type':_0x4388('0xf'),'content':'','key':_0x4388('0x22'),'keyType':'variable','variableName':_0x4388('0x23')}];break;case'outbound':_0x4d839f=[{'type':_0x4388('0x1'),'content':_0x4388('0xe'),'variableName':null},{'type':_0x4388('0xf'),'content':'','key':_0x4388('0x24'),'keyType':'variable','keyContent':'','variableName':'destcalleridnum'},{'type':_0x4388('0xf'),'content':'','key':'Member\x20Name','keyType':_0x4388('0x8'),'keyContent':'','variableName':_0x4388('0x25')},{'type':_0x4388('0xf'),'content':'','key':'UniqueId','keyType':_0x4388('0x8'),'keyContent':'','variableName':_0x4388('0x16')},{'type':_0x4388('0xf'),'content':'','key':_0x4388('0x17'),'keyType':_0x4388('0x8'),'keyContent':'','variableName':_0x4388('0x26')},{'type':_0x4388('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':_0x4388('0xf'),'content':'','key':'Answer\x20Time','keyType':_0x4388('0x8'),'keyContent':'','variableName':'answertime'},{'type':_0x4388('0xf'),'content':'','key':_0x4388('0x27'),'keyType':_0x4388('0x8'),'keyContent':'','variableName':_0x4388('0x28')},{'type':'keyValue','content':'','key':_0x4388('0x29'),'keyType':_0x4388('0x8'),'keyContent':'','variableName':_0x4388('0x2a')},{'type':_0x4388('0xf'),'content':'','key':_0x4388('0x2b'),'keyType':_0x4388('0x8'),'keyContent':'','variableName':_0x4388('0x2c')}];break;}}return _0x4d839f;}; \ No newline at end of file +var _0x8507=['membername','starttime','***\x20Time\x20Info\x20***','Answer\x20Time','answertime','Complete\x20Time','endtime','duration','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','inbound','push','variable','queue','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','voice','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','calleridnum','Caller\x20Name','calleridname','Queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','talktime','Called\x20Number'];(function(_0x2a707a,_0x4f6513){var _0x11996b=function(_0x152d0c){while(--_0x152d0c){_0x2a707a['push'](_0x2a707a['shift']());}};_0x11996b(++_0x4f6513);}(_0x8507,0x144));var _0x7850=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8507[_0x321bb2];return _0x9c12ed;};'use strict';exports[_0x7850('0x0')]=function(_0xdf7c3f,_0x19669c){var _0xd8f611=[{'type':_0x7850('0x1'),'content':_0x7850('0x2'),'variableName':null}];switch(_0xdf7c3f['toLowerCase']()){case'voice':switch(_0x19669c[_0x7850('0x3')]()){case _0x7850('0x4'):_0xd8f611[_0x7850('0x5')]({'type':_0x7850('0x6'),'content':'','variableName':_0x7850('0x7')});_0xd8f611[_0x7850('0x5')]({'type':'variable','content':'','variableName':'calleridnum'});break;case _0x7850('0x8'):_0xd8f611['push']({'type':_0x7850('0x1'),'content':_0x7850('0x9'),'variableName':null});_0xd8f611[_0x7850('0x5')]({'type':_0x7850('0x6'),'content':'','variableName':_0x7850('0xa')});break;}}return _0xd8f611;};exports[_0x7850('0xb')]=function(_0x1aafad,_0x3a2392){var _0xc2ea2f=[];switch(_0x1aafad[_0x7850('0x3')]()){case _0x7850('0xc'):switch(_0x3a2392[_0x7850('0x3')]()){case _0x7850('0x4'):_0xc2ea2f=[{'type':_0x7850('0x1'),'content':_0x7850('0xd'),'key':null,'keyType':null,'variableName':null},{'type':_0x7850('0xe'),'content':'','key':_0x7850('0xf'),'keyType':_0x7850('0x6'),'variableName':_0x7850('0x10')},{'type':_0x7850('0xe'),'content':'','key':_0x7850('0x11'),'keyType':_0x7850('0x6'),'variableName':_0x7850('0x12')},{'type':_0x7850('0xe'),'content':'','key':'Call\x20To','keyType':_0x7850('0x6'),'variableName':'destexten'},{'type':_0x7850('0xe'),'content':'','key':_0x7850('0x13'),'keyType':'variable','variableName':_0x7850('0x7')},{'type':_0x7850('0xe'),'content':'','key':_0x7850('0x14'),'keyType':_0x7850('0x6'),'variableName':_0x7850('0x15')},{'type':_0x7850('0xe'),'content':'','key':_0x7850('0x16'),'keyType':'variable','variableName':_0x7850('0x17')},{'type':_0x7850('0x1'),'content':_0x7850('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0x7850('0xe'),'content':'','key':_0x7850('0x19'),'keyType':_0x7850('0x6'),'variableName':_0x7850('0x1a')},{'type':'keyValue','content':'','key':'Agent\x20Number','keyType':_0x7850('0x6'),'variableName':_0x7850('0xa')},{'type':'string','content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x7850('0x1b'),'keyType':_0x7850('0x6'),'variableName':_0x7850('0x17')},{'type':'keyValue','content':'','key':_0x7850('0x1c'),'keyType':_0x7850('0x6'),'variableName':_0x7850('0x1d')},{'type':_0x7850('0xe'),'content':'','key':_0x7850('0x1e'),'keyType':'variable','variableName':_0x7850('0x1f')},{'type':_0x7850('0xe'),'content':'','key':_0x7850('0x20'),'keyType':'variable','variableName':_0x7850('0x21')},{'type':'keyValue','content':'','key':'Talk\x20Time','keyType':_0x7850('0x6'),'variableName':_0x7850('0x22')}];break;case _0x7850('0x8'):_0xc2ea2f=[{'type':_0x7850('0x1'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0x7850('0xe'),'content':'','key':_0x7850('0x23'),'keyType':_0x7850('0x6'),'keyContent':'','variableName':_0x7850('0xa')},{'type':_0x7850('0xe'),'content':'','key':'Member\x20Name','keyType':_0x7850('0x6'),'keyContent':'','variableName':_0x7850('0x24')},{'type':'keyValue','content':'','key':'UniqueId','keyType':_0x7850('0x6'),'keyContent':'','variableName':_0x7850('0x15')},{'type':_0x7850('0xe'),'content':'','key':_0x7850('0x16'),'keyType':_0x7850('0x6'),'keyContent':'','variableName':_0x7850('0x25')},{'type':'string','content':_0x7850('0x26')},{'type':_0x7850('0xe'),'content':'','key':_0x7850('0x27'),'keyType':'variable','keyContent':'','variableName':_0x7850('0x28')},{'type':'keyValue','content':'','key':_0x7850('0x29'),'keyType':_0x7850('0x6'),'keyContent':'','variableName':_0x7850('0x2a')},{'type':_0x7850('0xe'),'content':'','key':'Duration','keyType':'variable','keyContent':'','variableName':_0x7850('0x2b')},{'type':_0x7850('0xe'),'content':'','key':'Billable\x20Time','keyType':_0x7850('0x6'),'keyContent':'','variableName':_0x7850('0x2c')}];break;}}return _0xc2ea2f;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index a9a8cd4..ef6a6ad 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x289e=['lodash','../../config/logger','mail-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','findOne','then','update','info','catch','error','user','query','clone','body','omit','phone','fax','mobile'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x289e,0xfc));var _0xe289=function(_0x4959d0,_0x21f44b){_0x4959d0=_0x4959d0-0x0;var _0x2a7258=_0x289e[_0x4959d0];return _0x2a7258;};'use strict';var _=require(_0xe289('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0xe289('0x1'))('openchannel-interactions'),'mail':require(_0xe289('0x1'))(_0xe289('0x2')),'fax':require(_0xe289('0x1'))('fax-interactions'),'sms':require(_0xe289('0x1'))('sms-interactions'),'chat':require(_0xe289('0x1'))(_0xe289('0x3')),'whatsapp':require(_0xe289('0x1'))(_0xe289('0x4'))};function getInteractionId(_0x494816,_0x32d489,_0x579981){if(_0x494816&&_0x494816[_[_0xe289('0x5')](_0x579981)+_0xe289('0x6')]){return _0x494816[_[_0xe289('0x5')](_0x579981)+'InteractionId'];}else if(_0x494816&&_0x494816['id']){return _0x494816['id'];}else if(_0x32d489&&_0x32d489['id']){return _0x32d489['id'];}else{return'unknown';}}function log(_0x29ddc1,_0x596a8d,_0x3c28e5,_0x51472f,_0x18af2c,_0x4c341){loggers[_0x18af2c[_0xe289('0x7')]()][_0x29ddc1](_0xe289('0x8'),_0x4c341[_0xe289('0x9')](),_0x596a8d?_0x596a8d['id']:null,_0x596a8d?_0x596a8d[_0xe289('0xa')]:null,_0x596a8d?_0x596a8d[_0xe289('0xb')]:null,getInteractionId(_0x3c28e5,_0x51472f,_0x18af2c),_0x3c28e5?JSON[_0xe289('0xc')](_0x3c28e5):_0xe289('0xd'));}function updateUser(_0x1a8278,_0x480177,_0x52e501,_0x3aa4f9,_0x785bdb){db[_[_0xe289('0x5')](_0x3aa4f9)+'Interaction'][_0xe289('0xe')]({'where':{'id':getInteractionId(_0x480177,_0x52e501,_0x3aa4f9)}})[_0xe289('0xf')](function(_0x507160){if(_0x507160){return _0x507160[_0xe289('0x10')]({'UserId':_0x1a8278?_0x1a8278['id']:null});}})[_0xe289('0xf')](function(_0xdfb12d){if(_0xdfb12d){log(_0xe289('0x11'),_0x1a8278,_0x480177,_0x52e501,_0x3aa4f9,_0x785bdb);}})[_0xe289('0x12')](function(){log(_0xe289('0x13'),_0x1a8278,_0x480177,_0x52e501,_0x3aa4f9,_0x785bdb);});}exports['tracked']=function(_0x39f70d,_0x1437b0){return function(_0x5bcc4d,_0x260d28,_0x3e5414){var _0x4e4657=_0x5bcc4d[_0xe289('0x14')];var _0xf09f49={};var _0x3f5587=_0x5bcc4d[_0xe289('0x15')];if(_0xf09f49){_0xf09f49=_[_0xe289('0x16')](_0x5bcc4d[_0xe289('0x17')]);_0xf09f49=_[_0xe289('0x18')](_0xf09f49,[_0xe289('0x17'),'html',_0xe289('0x19'),_0xe289('0x1a'),_0xe289('0x1b')]);}updateUser(_0x4e4657,_0xf09f49,_0x3f5587,_0x39f70d,_0x1437b0);_0x3e5414(null);};}; \ No newline at end of file +var _0x71aa=['phone','fax','mobile','lodash','../../mysqldb','openchannel-interactions','../../config/logger','fax-interactions','chat-interactions','upperFirst','InteractionId','unknown','name','stringify','Interaction','update','then','info','catch','tracked','clone','omit','body','html'];(function(_0x3c4fc3,_0x155846){var _0x1bf01b=function(_0x2da615){while(--_0x2da615){_0x3c4fc3['push'](_0x3c4fc3['shift']());}};_0x1bf01b(++_0x155846);}(_0x71aa,0x1cb));var _0xa71a=function(_0x3b2395,_0x1cf2c1){_0x3b2395=_0x3b2395-0x0;var _0x2e6751=_0x71aa[_0x3b2395];return _0x2e6751;};'use strict';var _=require(_0xa71a('0x0'));var db=require(_0xa71a('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0xa71a('0x2')),'mail':require(_0xa71a('0x3'))('mail-interactions'),'fax':require(_0xa71a('0x3'))(_0xa71a('0x4')),'sms':require(_0xa71a('0x3'))('sms-interactions'),'chat':require(_0xa71a('0x3'))(_0xa71a('0x5')),'whatsapp':require(_0xa71a('0x3'))('whatsapp-interactions')};function getInteractionId(_0x89ffce,_0x59fe9c,_0x33d1e1){if(_0x89ffce&&_0x89ffce[_[_0xa71a('0x6')](_0x33d1e1)+'InteractionId']){return _0x89ffce[_[_0xa71a('0x6')](_0x33d1e1)+_0xa71a('0x7')];}else if(_0x89ffce&&_0x89ffce['id']){return _0x89ffce['id'];}else if(_0x59fe9c&&_0x59fe9c['id']){return _0x59fe9c['id'];}else{return _0xa71a('0x8');}}function log(_0xd42e98,_0x31946b,_0x522110,_0x2b1681,_0x392c9e,_0x5c3984){loggers[_0x392c9e['toLowerCase']()][_0xd42e98]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5c3984['toUpperCase'](),_0x31946b?_0x31946b['id']:null,_0x31946b?_0x31946b[_0xa71a('0x9')]:null,_0x31946b?_0x31946b['role']:null,getInteractionId(_0x522110,_0x2b1681,_0x392c9e),_0x522110?JSON[_0xa71a('0xa')](_0x522110):'null');}function updateUser(_0x51c14a,_0x4ee06e,_0x3e45eb,_0x1b8434,_0x41cce8){db[_[_0xa71a('0x6')](_0x1b8434)+_0xa71a('0xb')]['findOne']({'where':{'id':getInteractionId(_0x4ee06e,_0x3e45eb,_0x1b8434)}})['then'](function(_0x34c035){if(_0x34c035){return _0x34c035[_0xa71a('0xc')]({'UserId':_0x51c14a?_0x51c14a['id']:null});}})[_0xa71a('0xd')](function(_0xfef86e){if(_0xfef86e){log(_0xa71a('0xe'),_0x51c14a,_0x4ee06e,_0x3e45eb,_0x1b8434,_0x41cce8);}})[_0xa71a('0xf')](function(){log('error',_0x51c14a,_0x4ee06e,_0x3e45eb,_0x1b8434,_0x41cce8);});}exports[_0xa71a('0x10')]=function(_0x17072b,_0x43b789){return function(_0x3ee67c,_0x578a07,_0x19199f){var _0x37fc18=_0x3ee67c['user'];var _0x19ca59={};var _0x17b6db=_0x3ee67c['query'];if(_0x19ca59){_0x19ca59=_[_0xa71a('0x11')](_0x3ee67c['body']);_0x19ca59=_[_0xa71a('0x12')](_0x19ca59,[_0xa71a('0x13'),_0xa71a('0x14'),_0xa71a('0x15'),_0xa71a('0x16'),_0xa71a('0x17')]);}updateUser(_0x37fc18,_0x19ca59,_0x17b6db,_0x17072b,_0x43b789);_0x19199f(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index b8f29fa..55a425a 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 _0xc3dd=['hasOwnProperty','use','License','findOne','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','admin','user','isUserLimit','crypto','util','../../config/environment','data1','license','split','aes-256-ctr','format','%s:%s:%s','update','base64','utf8'];(function(_0x1c1777,_0x4f345b){var _0x1e634c=function(_0x16df88){while(--_0x16df88){_0x1c1777['push'](_0x1c1777['shift']());}};_0x1e634c(++_0x4f345b);}(_0xc3dd,0xa3));var _0xdc3d=function(_0x5ad07c,_0x324dcd){_0x5ad07c=_0x5ad07c-0x0;var _0x204bae=_0xc3dd[_0x5ad07c];return _0x204bae;};'use strict';var crypto=require(_0xdc3d('0x0'));var util=require(_0xdc3d('0x1'));var compose=require('composable-middleware');var db=require('../../mysqldb')['db'];var config=require(_0xdc3d('0x2'));function getValueFromLicense(_0xec3dc,_0x4ab517){if(_0xec3dc&&_0x4ab517){if(_0x4ab517[_0xdc3d('0x3')]&&_0x4ab517[_0xdc3d('0x4')]){var _0x3b3f97=_0x4ab517[_0xdc3d('0x3')];var _0x46c4e7=_0x4ab517['license'];var _0x4cb632=_0x3b3f97[_0xdc3d('0x5')]('-')[0x4];var _0x3e1c62=_0x3b3f97[_0xdc3d('0x5')]('-')[0x0];var _0x385695=crypto['createDecipher'](_0xdc3d('0x6'),util[_0xdc3d('0x7')](_0xdc3d('0x8'),_0x4cb632,_0x3b3f97,_0x3e1c62));var _0x106fe1=_0x385695[_0xdc3d('0x9')](_0x46c4e7,_0xdc3d('0xa'),_0xdc3d('0xb'));_0x106fe1+=_0x385695['final'](_0xdc3d('0xb'));var _0x300c2=JSON['parse'](_0x106fe1);return _0x300c2[_0xdc3d('0xc')](_0xec3dc)?_0x300c2[_0xec3dc]:null;}}return null;}function isLimit(_0x3682d6,_0x5edd3b,_0x73033b,_0x55a160){var _0x1e7806=_0x5edd3b;return compose()[_0xdc3d('0xd')](function(_0xc65e66,_0x20ad44,_0x5abb21){return db[_0xdc3d('0xe')][_0xdc3d('0xf')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x45c0e4){var _0x2e01e6=getValueFromLicense(_0x3682d6,_0x45c0e4);return _0x2e01e6?_0x2e01e6:_0x1e7806;})[_0xdc3d('0x10')](function(_0x211548){_0x1e7806=_0x211548;return _0x73033b['count'](_0x55a160);})[_0xdc3d('0x10')](function(_0x59b79b){if(_0x59b79b>=_0x1e7806){return _0x20ad44[_0xdc3d('0x11')](0x193)[_0xdc3d('0x12')]({'message':util[_0xdc3d('0x7')](_0xdc3d('0x13'),_0x3682d6)});}_0x5abb21();})[_0xdc3d('0x14')](function(_0x3f90db){_0x5abb21(_0x3f90db);});});}function isUserLimit(){return isLimit('users',0x1,db[_0xdc3d('0x15')],{'where':{'$or':[{'role':_0xdc3d('0x16')},{'role':_0xdc3d('0x17')}]}});}exports[_0xdc3d('0x18')]=isUserLimit; \ No newline at end of file +var _0xaefb=['split','createDecipher','format','%s:%s:%s','base64','utf8','final','parse','hasOwnProperty','use','findOne','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','user','isUserLimit','crypto','composable-middleware','../../config/environment','data1','license'];(function(_0x18ef98,_0x2e5b5d){var _0x5e98f4=function(_0x2be2ae){while(--_0x2be2ae){_0x18ef98['push'](_0x18ef98['shift']());}};_0x5e98f4(++_0x2e5b5d);}(_0xaefb,0xca));var _0xbaef=function(_0x18ae6d,_0x255d00){_0x18ae6d=_0x18ae6d-0x0;var _0x3deb94=_0xaefb[_0x18ae6d];return _0x3deb94;};'use strict';var crypto=require(_0xbaef('0x0'));var util=require('util');var compose=require(_0xbaef('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0xbaef('0x2'));function getValueFromLicense(_0x10d26b,_0x54495f){if(_0x10d26b&&_0x54495f){if(_0x54495f[_0xbaef('0x3')]&&_0x54495f[_0xbaef('0x4')]){var _0x27ba28=_0x54495f[_0xbaef('0x3')];var _0x42a6e6=_0x54495f[_0xbaef('0x4')];var _0x1cbee1=_0x27ba28['split']('-')[0x4];var _0x10c777=_0x27ba28[_0xbaef('0x5')]('-')[0x0];var _0xd70ee9=crypto[_0xbaef('0x6')]('aes-256-ctr',util[_0xbaef('0x7')](_0xbaef('0x8'),_0x1cbee1,_0x27ba28,_0x10c777));var _0x451a45=_0xd70ee9['update'](_0x42a6e6,_0xbaef('0x9'),_0xbaef('0xa'));_0x451a45+=_0xd70ee9[_0xbaef('0xb')]('utf8');var _0x2ede97=JSON[_0xbaef('0xc')](_0x451a45);return _0x2ede97[_0xbaef('0xd')](_0x10d26b)?_0x2ede97[_0x10d26b]:null;}}return null;}function isLimit(_0x56bba7,_0x321bfc,_0x170070,_0x2eb309){var _0x56133a=_0x321bfc;return compose()[_0xbaef('0xe')](function(_0x484483,_0x7a798d,_0x55ae16){return db['License'][_0xbaef('0xf')]({'where':{'id':0x1},'raw':!![]})[_0xbaef('0x10')](function(_0x3ef997){var _0xb2a308=getValueFromLicense(_0x56bba7,_0x3ef997);return _0xb2a308?_0xb2a308:_0x56133a;})['then'](function(_0x1c816b){_0x56133a=_0x1c816b;return _0x170070['count'](_0x2eb309);})['then'](function(_0x555cbc){if(_0x555cbc>=_0x56133a){return _0x7a798d[_0xbaef('0x11')](0x193)[_0xbaef('0x12')]({'message':util[_0xbaef('0x7')](_0xbaef('0x13'),_0x56bba7)});}_0x55ae16();})[_0xbaef('0x14')](function(_0x3cedbc){_0x55ae16(_0x3cedbc);});});}function isUserLimit(){return isLimit('users',0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':_0xbaef('0x15')}]}});}exports[_0xbaef('0x16')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index bf433d0..3ec71f4 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 _0x5649=['days','format','YYYY-MM-DD','castTo','CAST(','field','text','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','$notIn','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$endsWith','LIKE\x20?','$lt','<\x20?','<=\x20?','$gte','>=\x20?','start','$substring','$startsWith','pop','utcOffset','add','hours','minutes','seconds','lodash','moment','startsWith','[$or]','replace','split','length','slice','forEach','shift','filter','indexOf','conditions','push','buildExpression','DATE','operator','$eq','$between','value','$gt','$lte'];(function(_0x3c37b7,_0x5a57ee){var _0x381fe8=function(_0x548e1b){while(--_0x548e1b){_0x3c37b7['push'](_0x3c37b7['shift']());}};_0x381fe8(++_0x5a57ee);}(_0x5649,0xc2));var _0x9564=function(_0xcba291,_0x10e9d5){_0xcba291=_0xcba291-0x0;var _0x162274=_0x5649[_0xcba291];return _0x162274;};'use strict';var _=require(_0x9564('0x0'));var moment=require(_0x9564('0x1'));exports['parseSearch']=function(_0x4f243f){var _0x4686a2={'conditions':[]};_0x4686a2['sqlOperator']=_[_0x9564('0x2')](_0x4f243f,_0x9564('0x3'))?'or':'and';var _0x29d41b=_0x4f243f[_0x9564('0x4')]('[$and]','')[_0x9564('0x4')](_0x9564('0x3'),'')[_0x9564('0x5')]('||');for(var _0x553bf3=0x0;_0x553bf3<_0x29d41b[_0x9564('0x6')];_0x553bf3++){var _0x2294e0=_0x29d41b[_0x553bf3][_0x9564('0x5')](':=');var _0x2f743f=_0x2294e0[0x0];var _0x185aac=_0x2294e0[_0x9564('0x7')](0x1);_0x185aac[_0x9564('0x8')](function(_0x382438){var _0x5eaed1=_0x382438[_0x9564('0x5')]('[')[_0x9564('0x9')]();var _0x536d5a=_0x382438['match'](/\[(.*?)\]/g);_0x536d5a[_0x9564('0x8')](function(_0x120aa3){var _0x2b68f6=_0x120aa3['split']('[')[_0x9564('0xa')](function(_0x4ce686){return _0x4ce686[_0x9564('0xb')](']')>-0x1;})['map'](function(_0x4add1e){return _0x4add1e[_0x9564('0x5')](']')[0x0];})[0x0];_0x4686a2[_0x9564('0xc')][_0x9564('0xd')]({'field':_0x2f743f,'operator':_0x5eaed1,'value':_0x2b68f6});});});}return _0x4686a2;};exports[_0x9564('0xe')]=function(_0x508476,_0x1f6f8c,_0x38537e){var _0x385b34={};if(_0x1f6f8c===_0x9564('0xf')){if(_0x38537e[_0x9564('0x10')]===_0x9564('0x11')){_0x38537e['operator']=_0x9564('0x12');_0x38537e['value']+=','+_0x38537e[_0x9564('0x13')];}else if(_['includes']([_0x9564('0x14'),_0x9564('0x15')],_0x38537e[_0x9564('0x10')])){_0x38537e['value']=moment(_0x38537e[_0x9564('0x13')])['add'](0x1,_0x9564('0x16'))[_0x9564('0x17')](_0x9564('0x18'));}}if(_0x38537e[_0x9564('0x19')]){_0x1f6f8c=_0x38537e[_0x9564('0x19')];_0x385b34['text']=_0x9564('0x1a')+_0x508476+'.'+_0x38537e[_0x9564('0x1b')]+'\x20AS\x20'+_0x38537e['castTo']+')\x20'+parseOperator(_0x38537e[_0x9564('0x10')]);}else{_0x385b34[_0x9564('0x1c')]=_0x508476+'.'+_0x38537e[_0x9564('0x1b')]+'\x20'+parseOperator(_0x38537e[_0x9564('0x10')]);}if(_['includes'](['$ne','$notIn'],_0x38537e[_0x9564('0x10')]))_0x385b34[_0x9564('0x1c')]='('+_0x385b34['text']+_0x9564('0x1d')+_0x508476+'.'+_0x38537e[_0x9564('0x1b')]+_0x9564('0x1e');_0x385b34[_0x9564('0x13')]=parseValue(_0x1f6f8c,_0x38537e[_0x9564('0x10')],_0x38537e['value']);return _0x385b34;};function parseOperator(_0x526545){var _0x24d58a;switch(_0x526545){case _0x9564('0x1f'):_0x24d58a=_0x9564('0x20');break;case _0x9564('0x21'):_0x24d58a=_0x9564('0x22');break;case _0x9564('0x11'):_0x24d58a=_0x9564('0x23');break;case _0x9564('0x24'):_0x24d58a=_0x9564('0x25');break;case'$substring':case'$startsWith':case _0x9564('0x26'):_0x24d58a=_0x9564('0x27');break;case _0x9564('0x28'):_0x24d58a=_0x9564('0x29');break;case _0x9564('0x14'):_0x24d58a='>\x20?';break;case _0x9564('0x15'):_0x24d58a=_0x9564('0x2a');break;case _0x9564('0x2b'):_0x24d58a=_0x9564('0x2c');break;case _0x9564('0x12'):_0x24d58a='BETWEEN\x20?\x20AND\x20?';break;}return _0x24d58a;}function parseValue(_0x9f1cec,_0x2728e3,_0x5861f1){var _0x3aa0d3={'start':undefined,'end':undefined};switch(_0x2728e3){case _0x9564('0x1f'):case _0x9564('0x21'):_0x3aa0d3[_0x9564('0x2d')]=_0x5861f1['split'](',');break;case _0x9564('0x2e'):_0x3aa0d3[_0x9564('0x2d')]='%'+_0x5861f1+'%';break;case _0x9564('0x2f'):_0x3aa0d3[_0x9564('0x2d')]=_0x5861f1+'%';break;case _0x9564('0x26'):_0x3aa0d3[_0x9564('0x2d')]='%'+_0x5861f1;break;case _0x9564('0x12'):var _0x29d30e=_0x5861f1['split'](',');var _0x5861f1=_0x29d30e[_0x9564('0x9')]();var _0x4d063b=_0x29d30e[_0x9564('0x30')]();if(_0x9f1cec===_0x9564('0xf')){_0x5861f1=moment(_0x5861f1)[_0x9564('0x31')](0x0,!![])[_0x9564('0x17')]();_0x4d063b=moment(_0x4d063b)['utcOffset'](0x0,!![])[_0x9564('0x32')](0x17,_0x9564('0x33'))[_0x9564('0x32')](0x3b,_0x9564('0x34'))['add'](0x3b,_0x9564('0x35'))[_0x9564('0x17')]();}_0x3aa0d3={'start':_0x5861f1,'end':_0x4d063b};break;default:_0x3aa0d3['start']=_0x5861f1;break;}return _0x3aa0d3;} \ No newline at end of file +var _0xb781=['sqlOperator','startsWith','[$or]','and','replace','split','length','slice','shift','match','forEach','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','add','days','YYYY-MM-DD','castTo','CAST(','field','\x20AS\x20','$ne','text','$in','IN\x20?','$notIn','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$endsWith','LIKE\x20?','$lt','>\x20?','$lte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$startsWith','utcOffset','format','hours','minutes','seconds','lodash','moment','parseSearch'];(function(_0x431c04,_0x13ec2a){var _0x257610=function(_0x5d4d68){while(--_0x5d4d68){_0x431c04['push'](_0x431c04['shift']());}};_0x257610(++_0x13ec2a);}(_0xb781,0x6f));var _0x1b78=function(_0x199258,_0x55a8c7){_0x199258=_0x199258-0x0;var _0x213bbc=_0xb781[_0x199258];return _0x213bbc;};'use strict';var _=require(_0x1b78('0x0'));var moment=require(_0x1b78('0x1'));exports[_0x1b78('0x2')]=function(_0x2b917b){var _0x569291={'conditions':[]};_0x569291[_0x1b78('0x3')]=_[_0x1b78('0x4')](_0x2b917b,_0x1b78('0x5'))?'or':_0x1b78('0x6');var _0x23ab47=_0x2b917b[_0x1b78('0x7')]('[$and]','')[_0x1b78('0x7')](_0x1b78('0x5'),'')[_0x1b78('0x8')]('||');for(var _0x182d95=0x0;_0x182d95<_0x23ab47[_0x1b78('0x9')];_0x182d95++){var _0x52bb1c=_0x23ab47[_0x182d95][_0x1b78('0x8')](':=');var _0x7b2e18=_0x52bb1c[0x0];var _0x54398a=_0x52bb1c[_0x1b78('0xa')](0x1);_0x54398a['forEach'](function(_0x48524a){var _0x467422=_0x48524a[_0x1b78('0x8')]('[')[_0x1b78('0xb')]();var _0x290d58=_0x48524a[_0x1b78('0xc')](/\[(.*?)\]/g);_0x290d58[_0x1b78('0xd')](function(_0x21b6c4){var _0x49ee1b=_0x21b6c4[_0x1b78('0x8')]('[')[_0x1b78('0xe')](function(_0x53ccd6){return _0x53ccd6[_0x1b78('0xf')](']')>-0x1;})[_0x1b78('0x10')](function(_0x311ec8){return _0x311ec8[_0x1b78('0x8')](']')[0x0];})[0x0];_0x569291[_0x1b78('0x11')][_0x1b78('0x12')]({'field':_0x7b2e18,'operator':_0x467422,'value':_0x49ee1b});});});}return _0x569291;};exports[_0x1b78('0x13')]=function(_0x1f7cdd,_0x3c6ea8,_0x10be90){var _0x27afb7={};if(_0x3c6ea8===_0x1b78('0x14')){if(_0x10be90[_0x1b78('0x15')]===_0x1b78('0x16')){_0x10be90['operator']=_0x1b78('0x17');_0x10be90[_0x1b78('0x18')]+=','+_0x10be90['value'];}else if(_[_0x1b78('0x19')]([_0x1b78('0x1a'),'$lte'],_0x10be90['operator'])){_0x10be90[_0x1b78('0x18')]=moment(_0x10be90[_0x1b78('0x18')])[_0x1b78('0x1b')](0x1,_0x1b78('0x1c'))['format'](_0x1b78('0x1d'));}}if(_0x10be90[_0x1b78('0x1e')]){_0x3c6ea8=_0x10be90[_0x1b78('0x1e')];_0x27afb7['text']=_0x1b78('0x1f')+_0x1f7cdd+'.'+_0x10be90[_0x1b78('0x20')]+_0x1b78('0x21')+_0x10be90[_0x1b78('0x1e')]+')\x20'+parseOperator(_0x10be90[_0x1b78('0x15')]);}else{_0x27afb7['text']=_0x1f7cdd+'.'+_0x10be90[_0x1b78('0x20')]+'\x20'+parseOperator(_0x10be90[_0x1b78('0x15')]);}if(_[_0x1b78('0x19')]([_0x1b78('0x22'),'$notIn'],_0x10be90[_0x1b78('0x15')]))_0x27afb7[_0x1b78('0x23')]='('+_0x27afb7['text']+'\x20OR\x20'+_0x1f7cdd+'.'+_0x10be90[_0x1b78('0x20')]+'\x20IS\x20NULL)';_0x27afb7['value']=parseValue(_0x3c6ea8,_0x10be90[_0x1b78('0x15')],_0x10be90[_0x1b78('0x18')]);return _0x27afb7;};function parseOperator(_0x420471){var _0x23db22;switch(_0x420471){case _0x1b78('0x24'):_0x23db22=_0x1b78('0x25');break;case _0x1b78('0x26'):_0x23db22=_0x1b78('0x27');break;case _0x1b78('0x16'):_0x23db22=_0x1b78('0x28');break;case _0x1b78('0x22'):_0x23db22=_0x1b78('0x29');break;case _0x1b78('0x2a'):case'$startsWith':case _0x1b78('0x2b'):_0x23db22=_0x1b78('0x2c');break;case _0x1b78('0x2d'):_0x23db22='<\x20?';break;case _0x1b78('0x1a'):_0x23db22=_0x1b78('0x2e');break;case _0x1b78('0x2f'):_0x23db22='<=\x20?';break;case'$gte':_0x23db22=_0x1b78('0x30');break;case _0x1b78('0x17'):_0x23db22=_0x1b78('0x31');break;}return _0x23db22;}function parseValue(_0x2c575a,_0x281070,_0x2eac42){var _0x523607={'start':undefined,'end':undefined};switch(_0x281070){case _0x1b78('0x24'):case _0x1b78('0x26'):_0x523607['start']=_0x2eac42[_0x1b78('0x8')](',');break;case _0x1b78('0x2a'):_0x523607[_0x1b78('0x32')]='%'+_0x2eac42+'%';break;case _0x1b78('0x33'):_0x523607[_0x1b78('0x32')]=_0x2eac42+'%';break;case'$endsWith':_0x523607['start']='%'+_0x2eac42;break;case _0x1b78('0x17'):var _0x530c14=_0x2eac42[_0x1b78('0x8')](',');var _0x2eac42=_0x530c14[_0x1b78('0xb')]();var _0x3c4dc5=_0x530c14['pop']();if(_0x2c575a==='DATE'){_0x2eac42=moment(_0x2eac42)[_0x1b78('0x34')](0x0,!![])[_0x1b78('0x35')]();_0x3c4dc5=moment(_0x3c4dc5)[_0x1b78('0x34')](0x0,!![])[_0x1b78('0x1b')](0x17,_0x1b78('0x36'))['add'](0x3b,_0x1b78('0x37'))[_0x1b78('0x1b')](0x3b,_0x1b78('0x38'))[_0x1b78('0x35')]();}_0x523607={'start':_0x2eac42,'end':_0x3c4dc5};break;default:_0x523607[_0x1b78('0x32')]=_0x2eac42;break;}return _0x523607;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 9293262..befd809 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 _0x06a7=['split','filters','isEmpty','forOwn','find','DATE','isPlainObject','$gte','format','utc','$lte','YYYY-MM-DD','subtract','name','uniqueid','isArray','limit','offset','sort','map','indexOf','priority','cast','unsigned','substr','col','ASC','omit','length','isObject','isString','unset','hasOwnProperty','match','isEmail','forEach','replace','push','join','getOptions','$id','query','model','intersection','attributes','nolimit','order','where','filter','type','VIRTUAL','lodash','sequelize','moment','parse','includes','keys','fields'];(function(_0x52f444,_0x11eb63){var _0x4b68ee=function(_0x206344){while(--_0x206344){_0x52f444['push'](_0x52f444['shift']());}};_0x4b68ee(++_0x11eb63);}(_0x06a7,0x18f));var _0x706a=function(_0x2c5435,_0x1bbff8){_0x2c5435=_0x2c5435-0x0;var _0x1f7ffe=_0x06a7[_0x2c5435];return _0x1f7ffe;};'use strict';var _=require(_0x706a('0x0'));var sequelize=require(_0x706a('0x1'));var moment=require(_0x706a('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4b1cc2){var _0x1927e7=['ne'];try{var _0xd334a6=JSON[_0x706a('0x3')](_0x4b1cc2);var _0x5ed842=Object['keys'](_0xd334a6)[0x0];return _0x1927e7[_0x706a('0x4')](_0x5ed842);}catch(_0x392387){return![];}}function getOperatorValue(_0x864de4){var _0x5d94bc=JSON[_0x706a('0x3')](_0x864de4);var _0x190685=Object[_0x706a('0x5')](_0x5d94bc)[0x0];var _0x12a1af=_0x5d94bc[_0x190685];return{['$'+_0x190685]:_0x12a1af};}exports[_0x706a('0x6')]=function(_0x18378c){var _0xe463ee=null;if(_0x18378c){_0xe463ee=_0x18378c[_0x706a('0x7')](',');}return _0xe463ee;};exports[_0x706a('0x8')]=function(_0x184cc7,_0x2bb68c){var _0x29a50e={};if(!_[_0x706a('0x9')](_0x184cc7)){_[_0x706a('0xa')](_0x184cc7,function(_0xa28d8,_0x5cc6db){try{if(_0x2bb68c){var _0x3c7843=_[_0x706a('0xb')](_0x2bb68c,{'name':_0x5cc6db})||{};if(hasSequelizeOperator(_0xa28d8)){_0x29a50e[_0x5cc6db]=getOperatorValue(_0xa28d8);}else if(_0x3c7843['type']===_0x706a('0xc')&&_[_0x706a('0xd')](_0xa28d8)){var _0x25e4a7=JSON[_0x706a('0x3')](_0xa28d8);var _0x26054b={'$gte':moment(moment(_0x25e4a7[_0x706a('0xe')])[_0x706a('0xf')]('YYYY-MM-DD'))[_0x706a('0x10')]()['format'](),'$lte':moment(moment(_0x25e4a7[_0x706a('0x11')])[_0x706a('0xf')](_0x706a('0x12')))['utc']()[_0x706a('0x13')](0x1,'s')[_0x706a('0xf')]()};_0x29a50e[_0x5cc6db]=_0x26054b;}else if(_0x3c7843[_0x706a('0x14')]===_0x706a('0x15')){_0x29a50e[_0x5cc6db]=_0xa28d8;}else{_0x29a50e[_0x5cc6db]=_[_0x706a('0x16')](_0xa28d8)?_0xa28d8:JSON[_0x706a('0x3')](_0xa28d8);}}else{_0x29a50e[_0x5cc6db]=_[_0x706a('0x16')](_0xa28d8)?_0xa28d8:JSON['parse'](_0xa28d8);}}catch(_0x49e6bf){_0x29a50e[_0x5cc6db]=_0xa28d8[_0x706a('0x7')](',');}});}return _0x29a50e;};exports[_0x706a('0x17')]=function(_0x41f288){_0x41f288=parseInt(_0x41f288,0xa);if(!_0x41f288||_0x41f288<0x0){_0x41f288=LIMIT_VALUE;}return _0x41f288;};exports[_0x706a('0x18')]=function(_0x28206d){_0x28206d=parseInt(_0x28206d,0xa);if(!_0x28206d||_0x28206d<0x0){_0x28206d=0x0;}return _0x28206d;};exports[_0x706a('0x19')]=function(_0x185185){var _0x3a4878,_0x3bea2d=null;if(_0x185185){_0x3a4878=_0x185185[_0x706a('0x7')](',');_0x3bea2d=_[_0x706a('0x1a')](_0x3a4878,function(_0x8cce94){if(_0x8cce94[_0x706a('0x1b')]('-')===0x0){return[_0x8cce94===_0x706a('0x1c')?sequelize[_0x706a('0x1d')](sequelize['col'](_0x706a('0x1c')),_0x706a('0x1e')):_0x8cce94[_0x706a('0x1f')](0x1),'DESC'];}else{return[_0x8cce94===_0x706a('0x1c')?sequelize['cast'](sequelize[_0x706a('0x20')](_0x706a('0x1c')),'unsigned'):_0x8cce94,_0x706a('0x21')];}});}return _0x3bea2d;};exports[_0x706a('0x22')]=function(_0x2f4155,_0x39f88a){if(_['isEmpty'](_0x2f4155)){return _0x2f4155;}if(_['isArray'](_0x2f4155)){for(var _0x34b09a=0x0;_0x34b09a<_0x2f4155[_0x706a('0x23')];_0x34b09a+=0x1){_0x2f4155[_0x34b09a]=this['omit'](_0x2f4155[_0x34b09a],_0x39f88a);}return _0x2f4155;}if(!_[_0x706a('0x24')](_0x2f4155)){return _0x2f4155;}if(_[_0x706a('0x25')](_0x39f88a)){_0x39f88a=[_0x39f88a];}if(!_['isArray'](_0x39f88a)){return _0x2f4155;}for(var _0x38e179=0x0;_0x38e179<_0x39f88a[_0x706a('0x23')];_0x38e179+=0x1){_[_0x706a('0x26')](_0x2f4155,_0x39f88a[_0x38e179]);}for(var _0x430c3a in _0x2f4155){if(_0x2f4155[_0x706a('0x27')](_0x430c3a)){_0x2f4155[_0x430c3a]=this[_0x706a('0x22')](_0x2f4155[_0x430c3a],_0x39f88a);}}return _0x2f4155;};exports['isNumeric']=function(_0x51a7d0){return _0x51a7d0[_0x706a('0x28')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x706a('0x29')]=function(_0x3c27c5){return _0x3c27c5['match'](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x3e2c5d){var _0x2d07d2=[];_0x3e2c5d[_0x706a('0x7')](/[ ,]+/)[_0x706a('0x2a')](function(_0x21ad2c){_0x21ad2c=_0x21ad2c[_0x706a('0x2b')](/([^:]")"+/g,'$1');_0x21ad2c='+'+_0x21ad2c+'*';if(_0x21ad2c[_0x706a('0x4')]('@'))_0x21ad2c='\x22'+_0x21ad2c+'\x22';_0x2d07d2[_0x706a('0x2c')](_0x21ad2c);});return _0x2d07d2[_0x706a('0x2d')]('\x20');};exports[_0x706a('0x2e')]=function(_0x8d8162,_0x2f688a,_0x2262eb){var _0x4c9bd8={},_0x28ac72={};if(_0x2f688a['query'][_0x706a('0x2f')]){_0x2f688a[_0x706a('0x30')]['id']=_0x2f688a[_0x706a('0x30')][_0x706a('0x2f')];delete _0x2f688a[_0x706a('0x30')]['$id'];}_0x4c9bd8[_0x706a('0x31')]=_[_0x706a('0x1a')](_0x8d8162,_0x706a('0x14'));_0x4c9bd8['query']=_['keys'](_0x2f688a['query']);_0x4c9bd8[_0x706a('0x8')]=_[_0x706a('0x32')](_0x4c9bd8['model'],_0x4c9bd8[_0x706a('0x30')]);_0x28ac72[_0x706a('0x33')]=_[_0x706a('0x32')](_0x4c9bd8[_0x706a('0x31')],this[_0x706a('0x6')](_0x2f688a[_0x706a('0x30')][_0x706a('0x6')]));_0x28ac72[_0x706a('0x33')]=_0x28ac72[_0x706a('0x33')][_0x706a('0x23')]?_0x28ac72[_0x706a('0x33')]:_0x4c9bd8[_0x706a('0x31')];if(!_0x2f688a[_0x706a('0x30')][_0x706a('0x27')](_0x706a('0x34'))){_0x28ac72[_0x706a('0x17')]=this[_0x706a('0x17')](_0x2f688a[_0x706a('0x30')]['limit']);_0x28ac72[_0x706a('0x18')]=this['offset'](_0x2f688a[_0x706a('0x30')][_0x706a('0x18')]);}_0x28ac72[_0x706a('0x35')]=this[_0x706a('0x19')](_0x2f688a[_0x706a('0x30')][_0x706a('0x19')]);_0x28ac72[_0x706a('0x36')]=this['filters'](_['pick'](_0x2f688a[_0x706a('0x30')],_0x4c9bd8[_0x706a('0x8')]),_0x8d8162);if(_0x2f688a[_0x706a('0x30')][_0x706a('0x37')]){_0x28ac72[_0x706a('0x36')]=_['merge'](_0x28ac72[_0x706a('0x36')],{'$or':_['map'](_0x8d8162,function(_0x1301e3){if(_0x1301e3[_0x706a('0x38')]!==_0x706a('0x39')){if(_0x2262eb){return sequelize[_0x706a('0x36')](sequelize['fn']('lower',sequelize[_0x706a('0x20')](_0x1301e3[_0x706a('0x14')])),{'$like':sequelize['fn']('lower','%'+_0x2f688a[_0x706a('0x30')][_0x706a('0x37')]+'%')});}else{var _0x4388b5={};_0x4388b5[_0x1301e3[_0x706a('0x14')]]={'$like':'%'+_0x2f688a[_0x706a('0x30')][_0x706a('0x37')]+'%'};return _0x4388b5;}}})});}_0x28ac72=_['merge']({},_0x28ac72,_0x2f688a['options']);return _0x28ac72;}; \ No newline at end of file +var _0x1c6d=['lodash','sequelize','moment','keys','includes','parse','fields','split','filters','isEmpty','forOwn','find','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','isArray','limit','offset','map','indexOf','priority','col','unsigned','substr','DESC','cast','omit','length','isObject','isString','hasOwnProperty','isNumeric','match','getFullTextValue','forEach','replace','join','getOptions','query','$id','model','intersection','attributes','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','lower','name','options'];(function(_0x43196c,_0x508cef){var _0xb3f062=function(_0x492d91){while(--_0x492d91){_0x43196c['push'](_0x43196c['shift']());}};_0xb3f062(++_0x508cef);}(_0x1c6d,0xf0));var _0xd1c6=function(_0xccf869,_0x2556a5){_0xccf869=_0xccf869-0x0;var _0x21a9db=_0x1c6d[_0xccf869];return _0x21a9db;};'use strict';var _=require(_0xd1c6('0x0'));var sequelize=require(_0xd1c6('0x1'));var moment=require(_0xd1c6('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x441fde){var _0x3d5901=['ne'];try{var _0x48e5f2=JSON['parse'](_0x441fde);var _0x584141=Object[_0xd1c6('0x3')](_0x48e5f2)[0x0];return _0x3d5901[_0xd1c6('0x4')](_0x584141);}catch(_0x47499b){return![];}}function getOperatorValue(_0x26bc21){var _0x41d0b7=JSON[_0xd1c6('0x5')](_0x26bc21);var _0x2d65d2=Object['keys'](_0x41d0b7)[0x0];var _0x691e2b=_0x41d0b7[_0x2d65d2];return{['$'+_0x2d65d2]:_0x691e2b};}exports[_0xd1c6('0x6')]=function(_0x593480){var _0x5e0348=null;if(_0x593480){_0x5e0348=_0x593480[_0xd1c6('0x7')](',');}return _0x5e0348;};exports[_0xd1c6('0x8')]=function(_0x4412cc,_0x4fadff){var _0x14ef03={};if(!_[_0xd1c6('0x9')](_0x4412cc)){_[_0xd1c6('0xa')](_0x4412cc,function(_0xd8eb19,_0x2e8333){try{if(_0x4fadff){var _0x1ee5b7=_[_0xd1c6('0xb')](_0x4fadff,{'name':_0x2e8333})||{};if(hasSequelizeOperator(_0xd8eb19)){_0x14ef03[_0x2e8333]=getOperatorValue(_0xd8eb19);}else if(_0x1ee5b7['type']===_0xd1c6('0xc')&&_[_0xd1c6('0xd')](_0xd8eb19)){var _0x1d47ba=JSON[_0xd1c6('0x5')](_0xd8eb19);var _0x551419={'$gte':moment(moment(_0x1d47ba[_0xd1c6('0xe')])[_0xd1c6('0xf')](_0xd1c6('0x10')))[_0xd1c6('0x11')]()[_0xd1c6('0xf')](),'$lte':moment(moment(_0x1d47ba[_0xd1c6('0x12')])['format']('YYYY-MM-DD'))[_0xd1c6('0x11')]()[_0xd1c6('0x13')](0x1,'s')[_0xd1c6('0xf')]()};_0x14ef03[_0x2e8333]=_0x551419;}else if(_0x1ee5b7['name']==='uniqueid'){_0x14ef03[_0x2e8333]=_0xd8eb19;}else{_0x14ef03[_0x2e8333]=_[_0xd1c6('0x14')](_0xd8eb19)?_0xd8eb19:JSON[_0xd1c6('0x5')](_0xd8eb19);}}else{_0x14ef03[_0x2e8333]=_['isArray'](_0xd8eb19)?_0xd8eb19:JSON[_0xd1c6('0x5')](_0xd8eb19);}}catch(_0x476a2d){_0x14ef03[_0x2e8333]=_0xd8eb19[_0xd1c6('0x7')](',');}});}return _0x14ef03;};exports[_0xd1c6('0x15')]=function(_0x348af4){_0x348af4=parseInt(_0x348af4,0xa);if(!_0x348af4||_0x348af4<0x0){_0x348af4=LIMIT_VALUE;}return _0x348af4;};exports[_0xd1c6('0x16')]=function(_0x1bb1db){_0x1bb1db=parseInt(_0x1bb1db,0xa);if(!_0x1bb1db||_0x1bb1db<0x0){_0x1bb1db=0x0;}return _0x1bb1db;};exports['sort']=function(_0x3d299c){var _0xa0b7b9,_0xaa1b3=null;if(_0x3d299c){_0xa0b7b9=_0x3d299c[_0xd1c6('0x7')](',');_0xaa1b3=_[_0xd1c6('0x17')](_0xa0b7b9,function(_0x6e7915){if(_0x6e7915[_0xd1c6('0x18')]('-')===0x0){return[_0x6e7915===_0xd1c6('0x19')?sequelize['cast'](sequelize[_0xd1c6('0x1a')](_0xd1c6('0x19')),_0xd1c6('0x1b')):_0x6e7915[_0xd1c6('0x1c')](0x1),_0xd1c6('0x1d')];}else{return[_0x6e7915==='priority'?sequelize[_0xd1c6('0x1e')](sequelize[_0xd1c6('0x1a')](_0xd1c6('0x19')),_0xd1c6('0x1b')):_0x6e7915,'ASC'];}});}return _0xaa1b3;};exports[_0xd1c6('0x1f')]=function(_0x101fde,_0x3b3942){if(_[_0xd1c6('0x9')](_0x101fde)){return _0x101fde;}if(_[_0xd1c6('0x14')](_0x101fde)){for(var _0x558180=0x0;_0x558180<_0x101fde[_0xd1c6('0x20')];_0x558180+=0x1){_0x101fde[_0x558180]=this[_0xd1c6('0x1f')](_0x101fde[_0x558180],_0x3b3942);}return _0x101fde;}if(!_[_0xd1c6('0x21')](_0x101fde)){return _0x101fde;}if(_[_0xd1c6('0x22')](_0x3b3942)){_0x3b3942=[_0x3b3942];}if(!_[_0xd1c6('0x14')](_0x3b3942)){return _0x101fde;}for(var _0x35e2ba=0x0;_0x35e2ba<_0x3b3942[_0xd1c6('0x20')];_0x35e2ba+=0x1){_['unset'](_0x101fde,_0x3b3942[_0x35e2ba]);}for(var _0x627e12 in _0x101fde){if(_0x101fde[_0xd1c6('0x23')](_0x627e12)){_0x101fde[_0x627e12]=this[_0xd1c6('0x1f')](_0x101fde[_0x627e12],_0x3b3942);}}return _0x101fde;};exports[_0xd1c6('0x24')]=function(_0x53c1ea){return _0x53c1ea[_0xd1c6('0x25')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports['isEmail']=function(_0xf1f2da){return _0xf1f2da[_0xd1c6('0x25')](/^\S+@\S+$/)?!![]:![];};exports[_0xd1c6('0x26')]=function(_0x3fc546){var _0x17424f=[];_0x3fc546[_0xd1c6('0x7')](/[ ,]+/)[_0xd1c6('0x27')](function(_0x33341d){_0x33341d=_0x33341d[_0xd1c6('0x28')](/([^:]")"+/g,'$1');_0x33341d='+'+_0x33341d+'*';if(_0x33341d[_0xd1c6('0x4')]('@'))_0x33341d='\x22'+_0x33341d+'\x22';_0x17424f['push'](_0x33341d);});return _0x17424f[_0xd1c6('0x29')]('\x20');};exports[_0xd1c6('0x2a')]=function(_0x3b9cc2,_0x213f22,_0x5df5fc){var _0x4d1d60={},_0x33dafe={};if(_0x213f22[_0xd1c6('0x2b')][_0xd1c6('0x2c')]){_0x213f22[_0xd1c6('0x2b')]['id']=_0x213f22[_0xd1c6('0x2b')][_0xd1c6('0x2c')];delete _0x213f22[_0xd1c6('0x2b')][_0xd1c6('0x2c')];}_0x4d1d60[_0xd1c6('0x2d')]=_[_0xd1c6('0x17')](_0x3b9cc2,'name');_0x4d1d60['query']=_['keys'](_0x213f22[_0xd1c6('0x2b')]);_0x4d1d60[_0xd1c6('0x8')]=_[_0xd1c6('0x2e')](_0x4d1d60[_0xd1c6('0x2d')],_0x4d1d60['query']);_0x33dafe[_0xd1c6('0x2f')]=_[_0xd1c6('0x2e')](_0x4d1d60[_0xd1c6('0x2d')],this['fields'](_0x213f22[_0xd1c6('0x2b')][_0xd1c6('0x6')]));_0x33dafe[_0xd1c6('0x2f')]=_0x33dafe['attributes'][_0xd1c6('0x20')]?_0x33dafe[_0xd1c6('0x2f')]:_0x4d1d60[_0xd1c6('0x2d')];if(!_0x213f22['query'][_0xd1c6('0x23')](_0xd1c6('0x30'))){_0x33dafe[_0xd1c6('0x15')]=this['limit'](_0x213f22[_0xd1c6('0x2b')]['limit']);_0x33dafe[_0xd1c6('0x16')]=this[_0xd1c6('0x16')](_0x213f22['query'][_0xd1c6('0x16')]);}_0x33dafe[_0xd1c6('0x31')]=this[_0xd1c6('0x32')](_0x213f22[_0xd1c6('0x2b')][_0xd1c6('0x32')]);_0x33dafe[_0xd1c6('0x33')]=this['filters'](_[_0xd1c6('0x34')](_0x213f22[_0xd1c6('0x2b')],_0x4d1d60[_0xd1c6('0x8')]),_0x3b9cc2);if(_0x213f22[_0xd1c6('0x2b')][_0xd1c6('0x35')]){_0x33dafe[_0xd1c6('0x33')]=_[_0xd1c6('0x36')](_0x33dafe[_0xd1c6('0x33')],{'$or':_[_0xd1c6('0x17')](_0x3b9cc2,function(_0xdfb4a9){if(_0xdfb4a9[_0xd1c6('0x37')]!==_0xd1c6('0x38')){if(_0x5df5fc){return sequelize[_0xd1c6('0x33')](sequelize['fn'](_0xd1c6('0x39'),sequelize[_0xd1c6('0x1a')](_0xdfb4a9[_0xd1c6('0x3a')])),{'$like':sequelize['fn'](_0xd1c6('0x39'),'%'+_0x213f22[_0xd1c6('0x2b')][_0xd1c6('0x35')]+'%')});}else{var _0x11a05b={};_0x11a05b[_0xdfb4a9[_0xd1c6('0x3a')]]={'$like':'%'+_0x213f22['query'][_0xd1c6('0x35')]+'%'};return _0x11a05b;}}})});}_0x33dafe=_[_0xd1c6('0x36')]({},_0x33dafe,_0x213f22[_0xd1c6('0x3b')]);return _0x33dafe;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index e0ea118..d0287ef 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6fa6=['express','serve-favicon','method-override','errorhandler','path','passport','moment','./environment','../mysqldb','default','get','env','appPath','root','public','test','set','join','use','json\x20replacer','toISOString','split','static','/server/views','html','ejs','renderFile','view\x20engine','50mb','json','initialize'];(function(_0x128e62,_0x2ae3ef){var _0x55328f=function(_0x32171f){while(--_0x32171f){_0x128e62['push'](_0x128e62['shift']());}};_0x55328f(++_0x2ae3ef);}(_0x6fa6,0x7c));var _0x66fa=function(_0x5737ca,_0x4574bd){_0x5737ca=_0x5737ca-0x0;var _0x5ca566=_0x6fa6[_0x5737ca];return _0x5ca566;};'use strict';var express=require(_0x66fa('0x0'));var favicon=require(_0x66fa('0x1'));var bodyParser=require('body-parser');var methodOverride=require(_0x66fa('0x2'));var cookieParser=require('cookie-parser');var errorHandler=require(_0x66fa('0x3'));var path=require(_0x66fa('0x4'));var passport=require(_0x66fa('0x5'));var cors=require('cors');var moment=require(_0x66fa('0x6'));var config=require(_0x66fa('0x7'));var db=require(_0x66fa('0x8'))['db'];exports[_0x66fa('0x9')]=function(_0x1c1938){var _0x5b8378=_0x1c1938[_0x66fa('0xa')](_0x66fa('0xb'));if(_0x5b8378==='production'){_0x1c1938['set'](_0x66fa('0xc'),path['join'](config[_0x66fa('0xd')],_0x66fa('0xe')));}if(_0x5b8378==='development'||_0x5b8378===_0x66fa('0xf')){_0x1c1938[_0x66fa('0x10')]('appPath',path[_0x66fa('0x11')](config[_0x66fa('0xd')],'client'));_0x1c1938[_0x66fa('0x12')](errorHandler());}_0x1c1938[_0x66fa('0x10')](_0x66fa('0x13'),function(_0x241765,_0x5c129f){if(this[_0x241765]instanceof Date){_0x5c129f=this[_0x241765][_0x66fa('0x14')]()[_0x66fa('0x15')]('.')[0x0]+'Z';}return _0x5c129f;});_0x1c1938[_0x66fa('0x12')](express[_0x66fa('0x16')](_0x1c1938[_0x66fa('0xa')](_0x66fa('0xc'))));_0x1c1938['set']('views',config[_0x66fa('0xd')]+_0x66fa('0x17'));_0x1c1938['engine'](_0x66fa('0x18'),require(_0x66fa('0x19'))[_0x66fa('0x1a')]);_0x1c1938[_0x66fa('0x10')](_0x66fa('0x1b'),_0x66fa('0x18'));_0x1c1938[_0x66fa('0x12')](bodyParser['urlencoded']({'limit':_0x66fa('0x1c'),'extended':!![]}));_0x1c1938[_0x66fa('0x12')](bodyParser[_0x66fa('0x1d')]({'limit':_0x66fa('0x1c')}));_0x1c1938['use'](cors());_0x1c1938[_0x66fa('0x12')](methodOverride());_0x1c1938[_0x66fa('0x12')](cookieParser());_0x1c1938['use'](passport[_0x66fa('0x1e')]());}; \ No newline at end of file +var _0xb206=['html','50mb','json','initialize','express','serve-favicon','body-parser','method-override','cookie-parser','errorhandler','path','passport','cors','moment','../mysqldb','production','set','appPath','join','root','public','development','test','client','use','json\x20replacer','split','get','engine'];(function(_0x8ce506,_0x517f30){var _0x23c8e5=function(_0x1d048e){while(--_0x1d048e){_0x8ce506['push'](_0x8ce506['shift']());}};_0x23c8e5(++_0x517f30);}(_0xb206,0x1b7));var _0x6b20=function(_0x2675da,_0x5a250e){_0x2675da=_0x2675da-0x0;var _0x5e6153=_0xb206[_0x2675da];return _0x5e6153;};'use strict';var express=require(_0x6b20('0x0'));var favicon=require(_0x6b20('0x1'));var bodyParser=require(_0x6b20('0x2'));var methodOverride=require(_0x6b20('0x3'));var cookieParser=require(_0x6b20('0x4'));var errorHandler=require(_0x6b20('0x5'));var path=require(_0x6b20('0x6'));var passport=require(_0x6b20('0x7'));var cors=require(_0x6b20('0x8'));var moment=require(_0x6b20('0x9'));var config=require('./environment');var db=require(_0x6b20('0xa'))['db'];exports['default']=function(_0x2dab84){var _0x67f002=_0x2dab84['get']('env');if(_0x67f002===_0x6b20('0xb')){_0x2dab84[_0x6b20('0xc')](_0x6b20('0xd'),path[_0x6b20('0xe')](config[_0x6b20('0xf')],_0x6b20('0x10')));}if(_0x67f002===_0x6b20('0x11')||_0x67f002===_0x6b20('0x12')){_0x2dab84[_0x6b20('0xc')](_0x6b20('0xd'),path[_0x6b20('0xe')](config[_0x6b20('0xf')],_0x6b20('0x13')));_0x2dab84[_0x6b20('0x14')](errorHandler());}_0x2dab84[_0x6b20('0xc')](_0x6b20('0x15'),function(_0x593371,_0x2a0d64){if(this[_0x593371]instanceof Date){_0x2a0d64=this[_0x593371]['toISOString']()[_0x6b20('0x16')]('.')[0x0]+'Z';}return _0x2a0d64;});_0x2dab84[_0x6b20('0x14')](express['static'](_0x2dab84[_0x6b20('0x17')](_0x6b20('0xd'))));_0x2dab84['set']('views',config[_0x6b20('0xf')]+'/server/views');_0x2dab84[_0x6b20('0x18')](_0x6b20('0x19'),require('ejs')['renderFile']);_0x2dab84[_0x6b20('0xc')]('view\x20engine',_0x6b20('0x19'));_0x2dab84[_0x6b20('0x14')](bodyParser['urlencoded']({'limit':_0x6b20('0x1a'),'extended':!![]}));_0x2dab84[_0x6b20('0x14')](bodyParser[_0x6b20('0x1b')]({'limit':_0x6b20('0x1a')}));_0x2dab84['use'](cors());_0x2dab84['use'](methodOverride());_0x2dab84[_0x6b20('0x14')](cookieParser());_0x2dab84[_0x6b20('0x14')](passport[_0x6b20('0x1c')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index d3d1aa9..caa4241 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 _0xd6a0=['filter','family','IPv4','internal','concat','mac','00:00:00:00:00:00','address','getFirstInterface','cpus','map','model','createHash','md5','update','digest','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','replace','macAddress','ipAddress','hex','substring','lodash','crypto','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd6a0,0x117));var _0x0d6a=function(_0x28965b,_0x45ba24){_0x28965b=_0x28965b-0x0;var _0x323553=_0xd6a0[_0x28965b];return _0x323553;};'use strict';var _=require(_0x0d6a('0x0'));var os=require('os');var crypto=require(_0x0d6a('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0x0d6a('0x2'))[_0x0d6a('0x3')];var config=require(_0x0d6a('0x4'));function getInterfaces(){var _0x5e8457=[];var _0x987c25=os[_0x0d6a('0x5')]();var _0x2ed843=_[_0x0d6a('0x6')](_[_0x0d6a('0x7')](_0x987c25));for(var _0x16f7a9=0x0;_0x16f7a9<_0x2ed843[_0x0d6a('0x8')];_0x16f7a9++){var _0x1eb51c=_0x987c25[_0x2ed843[_0x16f7a9]][_0x0d6a('0x9')](function(_0x347645){return _0x347645[_0x0d6a('0xa')]===_0x0d6a('0xb')&&_0x347645[_0x0d6a('0xc')]===![];});_0x5e8457=_0x5e8457[_0x0d6a('0xd')](_0x1eb51c);}return _0x5e8457;}function getFirstInterface(){var _0x2c2ae=_['head'](getInterfaces());return{'macAddress':_0x2c2ae&&_0x2c2ae[_0x0d6a('0xe')]?_0x2c2ae['mac']:_0x0d6a('0xf'),'ipAddress':_0x2c2ae&&_0x2c2ae[_0x0d6a('0x10')]?_0x2c2ae[_0x0d6a('0x10')]:'127.0.0.1'};}exports[_0x0d6a('0x11')]=getFirstInterface;function getCPUhash(){var _0x2b4972=_['orderBy'](os[_0x0d6a('0x12')]()[_0x0d6a('0x13')](function(_0x98a4db){return _0x98a4db[_0x0d6a('0x14')];}))['join'](':');return crypto[_0x0d6a('0x15')](_0x0d6a('0x16'))[_0x0d6a('0x17')](_0x2b4972)[_0x0d6a('0x18')]('hex');}exports[_0x0d6a('0x19')]=function(){var _0x189de0=os[_0x0d6a('0x1a')]();var _0x105e40=/[0-9a-f-]{36}/;if(config[_0x0d6a('0x1b')]&&_0x105e40[_0x0d6a('0x1c')](config[_0x0d6a('0x1b')])){return config['licenseToken'];}else if(_0x189de0===_0x0d6a('0x1d')){return exec(_0x0d6a('0x1e'),{'encoding':'utf8'})[_0x0d6a('0x1f')]('\x0d\x0a','');}else{var _0x4d2b8a=getFirstInterface();var _0x210c76=getCPUhash();var _0x1fe4fd=_0x210c76+'|'+os['hostname']()+'|'+_0x4d2b8a[_0x0d6a('0x20')]+'|'+_0x4d2b8a[_0x0d6a('0x21')];var _0x259bf0=crypto[_0x0d6a('0x15')](_0x0d6a('0x16'))[_0x0d6a('0x17')](_0x1fe4fd)['digest'](_0x0d6a('0x22'));return _0x259bf0[_0x0d6a('0x23')](0x0,0x8)+'-'+_0x259bf0[_0x0d6a('0x23')](0x8,0xc)+'-'+_0x259bf0[_0x0d6a('0x23')](0xc,0x10)+'-'+_0x259bf0[_0x0d6a('0x23')](0x10,0x14)+'-'+_0x259bf0['substring'](0x14);}}; \ No newline at end of file +var _0x2b9c=['execSync','../environment','length','filter','family','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','cpus','map','model','join','createHash','md5','update','digest','hex','getUuid','platform','licenseToken','dmidecode\x20--string\x20system-uuid','utf8','replace','ipAddress','substring','lodash','bimedia-machine-uuid','child_process'];(function(_0x2b65fd,_0x2c14a6){var _0x2786f4=function(_0x24e05a){while(--_0x24e05a){_0x2b65fd['push'](_0x2b65fd['shift']());}};_0x2786f4(++_0x2c14a6);}(_0x2b9c,0x1d9));var _0xc2b9=function(_0x51356c,_0x501f0c){_0x51356c=_0x51356c-0x0;var _0x2ebe29=_0x2b9c[_0x51356c];return _0x2ebe29;};'use strict';var _=require(_0xc2b9('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0xc2b9('0x1'));var exec=require(_0xc2b9('0x2'))[_0xc2b9('0x3')];var config=require(_0xc2b9('0x4'));function getInterfaces(){var _0x349fa4=[];var _0x489c88=os['networkInterfaces']();var _0x24144e=_['orderBy'](_['keys'](_0x489c88));for(var _0x2b8d2c=0x0;_0x2b8d2c<_0x24144e[_0xc2b9('0x5')];_0x2b8d2c++){var _0x209701=_0x489c88[_0x24144e[_0x2b8d2c]][_0xc2b9('0x6')](function(_0x1c34f5){return _0x1c34f5[_0xc2b9('0x7')]==='IPv4'&&_0x1c34f5[_0xc2b9('0x8')]===![];});_0x349fa4=_0x349fa4[_0xc2b9('0x9')](_0x209701);}return _0x349fa4;}function getFirstInterface(){var _0x4ede76=_[_0xc2b9('0xa')](getInterfaces());return{'macAddress':_0x4ede76&&_0x4ede76[_0xc2b9('0xb')]?_0x4ede76['mac']:_0xc2b9('0xc'),'ipAddress':_0x4ede76&&_0x4ede76['address']?_0x4ede76[_0xc2b9('0xd')]:_0xc2b9('0xe')};}exports[_0xc2b9('0xf')]=getFirstInterface;function getCPUhash(){var _0x5a8f94=_[_0xc2b9('0x10')](os[_0xc2b9('0x11')]()[_0xc2b9('0x12')](function(_0x29fb34){return _0x29fb34[_0xc2b9('0x13')];}))[_0xc2b9('0x14')](':');return crypto[_0xc2b9('0x15')](_0xc2b9('0x16'))[_0xc2b9('0x17')](_0x5a8f94)[_0xc2b9('0x18')](_0xc2b9('0x19'));}exports[_0xc2b9('0x1a')]=function(){var _0x1ba5cd=os[_0xc2b9('0x1b')]();var _0x3d99ac=/[0-9a-f-]{36}/;if(config[_0xc2b9('0x1c')]&&_0x3d99ac['test'](config['licenseToken'])){return config[_0xc2b9('0x1c')];}else if(_0x1ba5cd==='win32'){return exec(_0xc2b9('0x1d'),{'encoding':_0xc2b9('0x1e')})[_0xc2b9('0x1f')]('\x0d\x0a','');}else{var _0x13ab81=getFirstInterface();var _0x4476e6=getCPUhash();var _0x37c280=_0x4476e6+'|'+os['hostname']()+'|'+_0x13ab81['macAddress']+'|'+_0x13ab81[_0xc2b9('0x20')];var _0x2d2664=crypto['createHash'](_0xc2b9('0x16'))[_0xc2b9('0x17')](_0x37c280)['digest']('hex');return _0x2d2664[_0xc2b9('0x21')](0x0,0x8)+'-'+_0x2d2664['substring'](0x8,0xc)+'-'+_0x2d2664[_0xc2b9('0x21')](0xc,0x10)+'-'+_0x2d2664['substring'](0x10,0x14)+'-'+_0x2d2664[_0xc2b9('0x21')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index ec462e7..ed6ead7 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 _0xdd94=['finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','bluebird','pkginfo','version','./hardware','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch','get','data1','data2','then','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error'];(function(_0xcfc92e,_0x4fe753){var _0x2fd951=function(_0x2999ab){while(--_0x2999ab){_0xcfc92e['push'](_0xcfc92e['shift']());}};_0x2fd951(++_0x4fe753);}(_0xdd94,0xa2));var _0x4dd9=function(_0x5032b6,_0x4c57a3){_0x5032b6=_0x5032b6-0x0;var _0x15e212=_0xdd94[_0x5032b6];return _0x15e212;};'use strict';var util=require(_0x4dd9('0x0'));var moment=require(_0x4dd9('0x1'));var rp=require(_0x4dd9('0x2'));var BPromise=require(_0x4dd9('0x3'));var pkginfo=require(_0x4dd9('0x4'))(module,_0x4dd9('0x5'));var db=require('../../mysqldb')['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x4dd9('0x6'));var logger=require('../logger')(_0x4dd9('0x7'));var HOST=_0x4dd9('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x4aee70){return new BPromise(function(_0x10852a,_0x546276){var _0xb2c079=util[_0x4dd9('0x9')](_0x4dd9('0xa'),HOST,_0x4aee70,module['exports']['version']);if(oldToken){_0xb2c079=util[_0x4dd9('0x9')](_0x4dd9('0xb'),HOST,_0x4aee70,module['exports'][_0x4dd9('0x5')],oldToken);}var _0x325487={'uri':_0xb2c079,'method':_0x4dd9('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x325487)['then'](function(_0x4e44e1){_0x10852a(_0x4e44e1);})[_0x4dd9('0xd')](function(_0x10dea5){_0x546276(_0x10dea5);});});}function manageLicense(_0x17a9ad,_0x1e233b){var _0x16f319=_0x1e233b[_0x4dd9('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x16f319[_0x4dd9('0xf')]!==_0x17a9ad&&!_0x16f319[_0x4dd9('0x10')]){oldToken=_0x16f319[_0x4dd9('0xf')];}httpRequest(_0x17a9ad)[_0x4dd9('0x11')](function(_0x2bfcb4){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x2bfcb4['active']){isOldTokenSent=![];if(!_0x16f319[_0x4dd9('0x7')]&&_0x16f319['license']!=_0x2bfcb4[_0x4dd9('0x7')]||_0x16f319[_0x4dd9('0x7')]&&_0x16f319[_0x4dd9('0x10')]){logger[_0x4dd9('0x12')](_0x4dd9('0x13'));}if(_0x16f319['license']&&!_0x16f319[_0x4dd9('0x10')]&&_0x16f319[_0x4dd9('0x7')]!=_0x2bfcb4['license']){logger[_0x4dd9('0x12')](_0x4dd9('0x14'));}if(_0x16f319[_0x4dd9('0x7')]&&!_0x16f319[_0x4dd9('0x10')]&&_0x16f319['license']==_0x2bfcb4[_0x4dd9('0x7')]){return _0x1e233b;}return _0x1e233b[_0x4dd9('0x15')]({'data1':_0x17a9ad,'data2':null,'license':_0x2bfcb4[_0x4dd9('0x7')]});}else{if(_0x2bfcb4['license']||_0x16f319[_0x4dd9('0x7')]){if(!_0x16f319[_0x4dd9('0x10')]){if(_0x16f319['data1']==_0x17a9ad){GRAY_PERIOD_REASON=_0x4dd9('0x16');logger[_0x4dd9('0x12')](_0x4dd9('0x17'));}else{GRAY_PERIOD_REASON=_0x4dd9('0x18');logger[_0x4dd9('0x12')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x16f319[_0x4dd9('0xf')],_0x17a9ad);}logger[_0x4dd9('0x12')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x4dd9('0x19')](),moment()[_0x4dd9('0x9')](_0x4dd9('0x1a')));return _0x1e233b['update']({'data2':encryptor[_0x4dd9('0x1b')](moment()[_0x4dd9('0x9')](_0x4dd9('0x1a')))});}else{if(moment()[_0x4dd9('0x1c')](encryptor[_0x4dd9('0x1d')](_0x16f319[_0x4dd9('0x10')]),_0x4dd9('0x1e'))>DAYS){logger[_0x4dd9('0x12')]('DEMO\x20START\x20AT\x20%s',moment()[_0x4dd9('0x9')](_0x4dd9('0x1a')));isOldTokenSent=![];return _0x1e233b[_0x4dd9('0x15')]({'data1':_0x17a9ad,'data2':null,'license':null});}}}else{if(_0x16f319['data1']!=_0x17a9ad){logger['info'](_0x4dd9('0x1f'),_0x16f319[_0x4dd9('0xf')],_0x17a9ad);return _0x1e233b['update']({'data1':_0x17a9ad,'data2':null,'license':null});}}}return _0x1e233b;})[_0x4dd9('0x11')](function(_0x4e7f5f){_0x1e233b=_0x4e7f5f;})[_0x4dd9('0xd')](function(_0x5586ab){logger[_0x4dd9('0x20')](_0x5586ab['message']);})[_0x4dd9('0x21')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x1e233b);},TIME);});}function defaultLicense(){var _0x52e873=hardware[_0x4dd9('0x22')]();if(_0x52e873){return db[_0x4dd9('0x23')][_0x4dd9('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x52e873}})['spread'](function(_0xcdaa52,_0x2397c0){logger[_0x4dd9('0x12')](_0x4dd9('0x25'),_0x52e873);manageLicense(_0x52e873,_0xcdaa52);})[_0x4dd9('0xd')](function(_0x3f04d0){logger[_0x4dd9('0x20')](_0x3f04d0['message']);});}}exports[_0x4dd9('0x26')]=defaultLicense; \ No newline at end of file +var _0x817a=['./hardware','../logger','https://www.xcallymotion.com','format','exports','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','data1','data2','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','decryptString','days','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','message','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','pkginfo','../../components/encryptor'];(function(_0x33362f,_0xe78553){var _0x2fc4ea=function(_0x532b31){while(--_0x532b31){_0x33362f['push'](_0x33362f['shift']());}};_0x2fc4ea(++_0xe78553);}(_0x817a,0x15a));var _0xa817=function(_0xfcb2,_0x5ef656){_0xfcb2=_0xfcb2-0x0;var _0x436b21=_0x817a[_0xfcb2];return _0x436b21;};'use strict';var util=require(_0xa817('0x0'));var moment=require(_0xa817('0x1'));var rp=require(_0xa817('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0xa817('0x3'))(module,'version');var db=require('../../mysqldb')['db'];var encryptor=require(_0xa817('0x4'));var hardware=require(_0xa817('0x5'));var logger=require(_0xa817('0x6'))('license');var HOST=_0xa817('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x316790){return new BPromise(function(_0x36a23d,_0x4a9ac0){var _0x428fbe=util[_0xa817('0x8')]('%s/api/servers/%s/check?version=%s',HOST,_0x316790,module[_0xa817('0x9')][_0xa817('0xa')]);if(oldToken){_0x428fbe=util[_0xa817('0x8')](_0xa817('0xb'),HOST,_0x316790,module[_0xa817('0x9')][_0xa817('0xa')],oldToken);}var _0x21a1a2={'uri':_0x428fbe,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x21a1a2)[_0xa817('0xc')](function(_0x2c1030){_0x36a23d(_0x2c1030);})[_0xa817('0xd')](function(_0x5f189c){_0x4a9ac0(_0x5f189c);});});}function manageLicense(_0x272c20,_0x20e26c){var _0x2fe5e0=_0x20e26c['get']({'plain':!![]});if(!isOldTokenSent&&_0x2fe5e0[_0xa817('0xe')]!==_0x272c20&&!_0x2fe5e0[_0xa817('0xf')]){oldToken=_0x2fe5e0[_0xa817('0xe')];}httpRequest(_0x272c20)[_0xa817('0xc')](function(_0x568480){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x568480['active']){isOldTokenSent=![];if(!_0x2fe5e0['license']&&_0x2fe5e0[_0xa817('0x10')]!=_0x568480[_0xa817('0x10')]||_0x2fe5e0['license']&&_0x2fe5e0[_0xa817('0xf')]){logger[_0xa817('0x11')](_0xa817('0x12'));}if(_0x2fe5e0[_0xa817('0x10')]&&!_0x2fe5e0[_0xa817('0xf')]&&_0x2fe5e0[_0xa817('0x10')]!=_0x568480['license']){logger[_0xa817('0x11')](_0xa817('0x13'));}if(_0x2fe5e0[_0xa817('0x10')]&&!_0x2fe5e0[_0xa817('0xf')]&&_0x2fe5e0[_0xa817('0x10')]==_0x568480[_0xa817('0x10')]){return _0x20e26c;}return _0x20e26c[_0xa817('0x14')]({'data1':_0x272c20,'data2':null,'license':_0x568480['license']});}else{if(_0x568480[_0xa817('0x10')]||_0x2fe5e0['license']){if(!_0x2fe5e0[_0xa817('0xf')]){if(_0x2fe5e0[_0xa817('0xe')]==_0x272c20){GRAY_PERIOD_REASON=_0xa817('0x15');logger[_0xa817('0x11')](_0xa817('0x16'));}else{GRAY_PERIOD_REASON=_0xa817('0x17');logger[_0xa817('0x11')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x2fe5e0[_0xa817('0xe')],_0x272c20);}logger[_0xa817('0x11')](_0xa817('0x18'),GRAY_PERIOD_REASON[_0xa817('0x19')](),moment()[_0xa817('0x8')](_0xa817('0x1a')));return _0x20e26c['update']({'data2':encryptor[_0xa817('0x1b')](moment()[_0xa817('0x8')](_0xa817('0x1a')))});}else{if(moment()['diff'](encryptor[_0xa817('0x1c')](_0x2fe5e0[_0xa817('0xf')]),_0xa817('0x1d'))>DAYS){logger[_0xa817('0x11')]('DEMO\x20START\x20AT\x20%s',moment()[_0xa817('0x8')](_0xa817('0x1a')));isOldTokenSent=![];return _0x20e26c[_0xa817('0x14')]({'data1':_0x272c20,'data2':null,'license':null});}}}else{if(_0x2fe5e0['data1']!=_0x272c20){logger['info'](_0xa817('0x1e'),_0x2fe5e0[_0xa817('0xe')],_0x272c20);return _0x20e26c['update']({'data1':_0x272c20,'data2':null,'license':null});}}}return _0x20e26c;})[_0xa817('0xc')](function(_0xbd7e4f){_0x20e26c=_0xbd7e4f;})['catch'](function(_0x5c2435){logger[_0xa817('0x1f')](_0x5c2435[_0xa817('0x20')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0xa817('0x21')](),_0x20e26c);},TIME);});}function defaultLicense(){var _0x3a0680=hardware[_0xa817('0x21')]();if(_0x3a0680){return db[_0xa817('0x22')][_0xa817('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x3a0680}})[_0xa817('0x24')](function(_0x363b80,_0x551411){logger[_0xa817('0x11')](_0xa817('0x25'),_0x3a0680);manageLicense(_0x3a0680,_0x363b80);})['catch'](function(_0x1fc2b5){logger[_0xa817('0x1f')](_0x1fc2b5[_0xa817('0x20')]);});}}exports[_0xa817('0x26')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 64fe2b9..7671dea 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 _0xcad6=['License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','bluebird','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','then','catch','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','decryptString','format','%s:%s:%s','parse','machineUuid','gray','deadline','add','days','grayReason','uuid','disabled','message','User','role','sequelize','COUNT','col','count','user','telephone','users','telephones','forEach','admin','pick','countBy','License\x20limit\x20reached\x20for\x20users'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xcad6,0x83));var _0x6cad=function(_0x51abea,_0xfd7684){_0x51abea=_0x51abea-0x0;var _0x340b9c=_0xcad6[_0x51abea];return _0x340b9c;};'use strict';var util=require(_0x6cad('0x0'));var _=require(_0x6cad('0x1'));var moment=require('moment');var BPromise=require(_0x6cad('0x2'));var hardware=require('./hardware');var encryptor=require('../../components/encryptor');var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6cad('0x3'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x6cad('0x4'),'machineUuid':hardware[_0x6cad('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6cad('0x3'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x6cad('0x6'),'machineUuid':hardware[_0x6cad('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x9dda68){return new BPromise(function(_0x23f972,_0x4d19cc){return db['License']['find'](_['defaults'](_0x9dda68,{'raw':!![],'where':{'id':0x1}}))[_0x6cad('0x7')](function(_0x23ea62){return checkLicense(_0x23ea62,null);})[_0x6cad('0x7')](function(_0x2bca6b){_0x23f972(_0x2bca6b);return;})[_0x6cad('0x8')](function(_0x5f532b){_0x4d19cc(_0x5f532b);});});}function checkLicense(_0x3ce926,_0x38ce85){if(!_0x3ce926){demoLicense['uuid']=_0x3ce926[_0x6cad('0x9')];return demoLicense;}try{var _0x5ac734=_0x38ce85||_0x3ce926[_0x6cad('0xa')];if(_[_0x6cad('0xb')](_0x5ac734)){throw new Error(_0x6cad('0xc'));}var _0x912c4c=_0x3ce926['data1'];var _0x169d39=_0x3ce926['data2'];var _0x5ad4c9=_0x912c4c['split']('-')[0x4];var _0x27a8cd=_0x912c4c['split']('-')[0x0];var _0x1c0bcb=encryptor[_0x6cad('0xd')](_0x5ac734,util[_0x6cad('0xe')](_0x6cad('0xf'),_0x5ad4c9,_0x912c4c,_0x27a8cd));var _0x3fa065=JSON[_0x6cad('0x10')](_0x1c0bcb);_0x3fa065['demo']=![];_0x3fa065['uuid']=_0x912c4c;_0x3fa065[_0x6cad('0x11')]=hardware[_0x6cad('0x5')]();if(_0x169d39){var _0x4467d8=encryptor[_0x6cad('0xd')](_0x169d39);_0x3fa065[_0x6cad('0x12')]=_0x4467d8;_0x3fa065[_0x6cad('0x13')]=moment(_0x4467d8)[_0x6cad('0x14')](0x7,_0x6cad('0x15'))['format']();_0x3fa065[_0x6cad('0x16')]=_0x3fa065[_0x6cad('0x17')]!=_0x3fa065[_0x6cad('0x11')]?'changed':_0x6cad('0x18');}return _0x3fa065;}catch(_0x5911f5){breakingLicense[_0x6cad('0x17')]=_0x3ce926['data1'];breakingLicense['message']=_0x5911f5[_0x6cad('0x19')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x417fc8,_0x42054f){getLicense()[_0x6cad('0x7')](function(_0x1fe2b5){return db[_0x6cad('0x1a')]['findAll']({'attributes':[_0x6cad('0x1b'),[db[_0x6cad('0x1c')]['fn'](_0x6cad('0x1d'),db[_0x6cad('0x1c')][_0x6cad('0x1e')](_0x6cad('0x1b'))),_0x6cad('0x1f')]],'group':_0x6cad('0x1b'),'where':{'role':{'$or':['admin',_0x6cad('0x20'),_0x6cad('0x21')]}},'raw':!![]})[_0x6cad('0x7')](function(_0x1a4aad){var _0x125cbf={'user':_0x1fe2b5[_0x6cad('0x22')]||0x0,'telephone':_0x1fe2b5[_0x6cad('0x23')]||0x0};_0x1a4aad[_0x6cad('0x24')](function(_0x227d5c){var _0x2974a7=_0x227d5c[_0x6cad('0x1b')]===_0x6cad('0x25')?_0x6cad('0x20'):_0x227d5c[_0x6cad('0x1b')];_0x125cbf[_0x2974a7]-=_0x227d5c['count'];if(_0x125cbf[_0x2974a7]<0x0)_0x125cbf[_0x2974a7]=0x0;});_0x417fc8(_0x125cbf);return;});})['catch'](function(_0xf98278){_0x42054f(_0xf98278);});});}function checkUserLimits(_0x4ef3bc){return new BPromise(function(_0xc5bf97,_0x43f7fb){getLimits()[_0x6cad('0x7')](function(_0x450ec8){var _0x234cd1=_[_0x6cad('0x26')](_[_0x6cad('0x27')](_0x4ef3bc,'role'),[_0x6cad('0x25'),'user',_0x6cad('0x21')]);var _0xb6d829=(_0x234cd1[_0x6cad('0x25')]||0x0)+(_0x234cd1[_0x6cad('0x20')]||0x0);var _0x3dff8d=_0x234cd1[_0x6cad('0x21')]||0x0;if(_0xb6d829>_0x450ec8[_0x6cad('0x20')])return _0x43f7fb(_0x6cad('0x28'));if(_0x3dff8d>_0x450ec8[_0x6cad('0x21')])return _0x43f7fb(_0x6cad('0x29'));return _0xc5bf97();})[_0x6cad('0x8')](function(_0x23c2aa){_0x43f7fb(_0x23c2aa);});});}module[_0x6cad('0x2a')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x59b0=['days','grayReason','changed','message','findAll','role','sequelize','COUNT','col','admin','user','telephone','telephones','count','pick','countBy','License\x20limit\x20reached\x20for\x20users','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','find','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','format','parse','demo','machineUuid','deadline','add'];(function(_0x26f89f,_0x108c66){var _0x4158a2=function(_0x2e4a9b){while(--_0x2e4a9b){_0x26f89f['push'](_0x26f89f['shift']());}};_0x4158a2(++_0x108c66);}(_0x59b0,0x1d4));var _0x059b=function(_0x33f750,_0x3a0638){_0x33f750=_0x33f750-0x0;var _0xd2186a=_0x59b0[_0x33f750];return _0xd2186a;};'use strict';var util=require(_0x059b('0x0'));var _=require(_0x059b('0x1'));var moment=require(_0x059b('0x2'));var BPromise=require(_0x059b('0x3'));var hardware=require(_0x059b('0x4'));var encryptor=require(_0x059b('0x5'));var db=require(_0x059b('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x059b('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x059b('0x8'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x059b('0x9'),'machineUuid':hardware[_0x059b('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x1b7b64){return new BPromise(function(_0x56730d,_0xffb2c){return db['License'][_0x059b('0xa')](_[_0x059b('0xb')](_0x1b7b64,{'raw':!![],'where':{'id':0x1}}))[_0x059b('0xc')](function(_0x40b3f5){return checkLicense(_0x40b3f5,null);})['then'](function(_0x14768e){_0x56730d(_0x14768e);return;})[_0x059b('0xd')](function(_0x388464){_0xffb2c(_0x388464);});});}function checkLicense(_0x187cee,_0x535059){if(!_0x187cee){demoLicense[_0x059b('0xe')]=_0x187cee[_0x059b('0xf')];return demoLicense;}try{var _0x4ffd63=_0x535059||_0x187cee[_0x059b('0x10')];if(_[_0x059b('0x11')](_0x4ffd63)){throw new Error(_0x059b('0x12'));}var _0x17d3d7=_0x187cee[_0x059b('0xf')];var _0x16cbc0=_0x187cee['data2'];var _0xaca77b=_0x17d3d7[_0x059b('0x13')]('-')[0x4];var _0x359a59=_0x17d3d7[_0x059b('0x13')]('-')[0x0];var _0x1f6685=encryptor[_0x059b('0x14')](_0x4ffd63,util[_0x059b('0x15')]('%s:%s:%s',_0xaca77b,_0x17d3d7,_0x359a59));var _0x11e4e0=JSON[_0x059b('0x16')](_0x1f6685);_0x11e4e0[_0x059b('0x17')]=![];_0x11e4e0[_0x059b('0xe')]=_0x17d3d7;_0x11e4e0[_0x059b('0x18')]=hardware[_0x059b('0x7')]();if(_0x16cbc0){var _0x491543=encryptor[_0x059b('0x14')](_0x16cbc0);_0x11e4e0['gray']=_0x491543;_0x11e4e0[_0x059b('0x19')]=moment(_0x491543)[_0x059b('0x1a')](0x7,_0x059b('0x1b'))[_0x059b('0x15')]();_0x11e4e0[_0x059b('0x1c')]=_0x11e4e0[_0x059b('0xe')]!=_0x11e4e0[_0x059b('0x18')]?_0x059b('0x1d'):'disabled';}return _0x11e4e0;}catch(_0x53e69a){breakingLicense[_0x059b('0xe')]=_0x187cee[_0x059b('0xf')];breakingLicense[_0x059b('0x1e')]=_0x53e69a['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x3fcc36,_0x3bc143){getLicense()['then'](function(_0x5b9eb2){return db['User'][_0x059b('0x1f')]({'attributes':[_0x059b('0x20'),[db[_0x059b('0x21')]['fn'](_0x059b('0x22'),db[_0x059b('0x21')][_0x059b('0x23')](_0x059b('0x20'))),'count']],'group':_0x059b('0x20'),'where':{'role':{'$or':[_0x059b('0x24'),_0x059b('0x25'),_0x059b('0x26')]}},'raw':!![]})[_0x059b('0xc')](function(_0x192187){var _0x786754={'user':_0x5b9eb2['users']||0x0,'telephone':_0x5b9eb2[_0x059b('0x27')]||0x0};_0x192187['forEach'](function(_0x5c3693){var _0x265513=_0x5c3693['role']===_0x059b('0x24')?_0x059b('0x25'):_0x5c3693[_0x059b('0x20')];_0x786754[_0x265513]-=_0x5c3693[_0x059b('0x28')];if(_0x786754[_0x265513]<0x0)_0x786754[_0x265513]=0x0;});_0x3fcc36(_0x786754);return;});})[_0x059b('0xd')](function(_0x57b10a){_0x3bc143(_0x57b10a);});});}function checkUserLimits(_0x2fa841){return new BPromise(function(_0x57c8d9,_0x40fe1d){getLimits()[_0x059b('0xc')](function(_0x4f4c87){var _0x467d54=_[_0x059b('0x29')](_[_0x059b('0x2a')](_0x2fa841,_0x059b('0x20')),[_0x059b('0x24'),_0x059b('0x25'),_0x059b('0x26')]);var _0xcc058e=(_0x467d54[_0x059b('0x24')]||0x0)+(_0x467d54['user']||0x0);var _0x1dea14=_0x467d54[_0x059b('0x26')]||0x0;if(_0xcc058e>_0x4f4c87[_0x059b('0x25')])return _0x40fe1d(_0x059b('0x2b'));if(_0x1dea14>_0x4f4c87[_0x059b('0x26')])return _0x40fe1d('License\x20limit\x20reached\x20for\x20telephones');return _0x57c8d9();})[_0x059b('0xd')](function(_0x1f4cc6){_0x40fe1d(_0x1f4cc6);});});}module[_0x059b('0x2c')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index dc99c37..90694ef 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 _0x84a0=['myappanuglar-secret','app-id','exports','http://localhost:9000'];(function(_0x3fd55b,_0x403b8a){var _0xb4654d=function(_0xa0b527){while(--_0xa0b527){_0x3fd55b['push'](_0x3fd55b['shift']());}};_0xb4654d(++_0x403b8a);}(_0x84a0,0x66));var _0x084a=function(_0x688c0e,_0xc9e8e8){_0x688c0e=_0x688c0e-0x0;var _0x351de9=_0x84a0[_0x688c0e];return _0x351de9;};'use strict';module[_0x084a('0x0')]={'DOMAIN':_0x084a('0x1'),'SESSION_SECRET':_0x084a('0x2'),'GOOGLE_ID':_0x084a('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0xf7b4=['app-id','secret','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf7b4,0x152));var _0x4f7b=function(_0xf58b2d,_0x360ca3){_0xf58b2d=_0xf58b2d-0x0;var _0x3b2d32=_0xf7b4[_0xf58b2d];return _0x3b2d32;};'use strict';module[_0x4f7b('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x4f7b('0x1'),'GOOGLE_SECRET':_0x4f7b('0x2'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index b864473..fbadf3e 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x64fe=['env','debugLevel','winston','util','path','INFO','join','/var','log','xcally','format','message','replace','}}}','toUpperCase','exports','Logger','transports','%s-%s','error','File','info'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x64fe,0x14c));var _0xe64f=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x64fe[_0x13e741];return _0x3f8bb3;};'use strict';var moment=require('moment');var winston=require(_0xe64f('0x0'));var util=require(_0xe64f('0x1'));var path=require(_0xe64f('0x2'));var debugLevel=_0xe64f('0x3');function filename(_0x1356f7,_0x5d1edf){return path[_0xe64f('0x4')](_0xe64f('0x5'),_0xe64f('0x6'),_0xe64f('0x7'),util[_0xe64f('0x8')]('%s-%s.log',_0x1356f7,_0x5d1edf));}function formatter(_0x307191,_0x2f72c9){_0x2f72c9['message']=_0x2f72c9[_0xe64f('0x9')][_0xe64f('0xa')](/@@{/g,'{{{')[_0xe64f('0xa')](/}@@/g,_0xe64f('0xb'))[_0xe64f('0xa')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0xe64f('0x8')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xe64f('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),_0x2f72c9['level'][_0xe64f('0xc')](),_0x307191,_0x2f72c9[_0xe64f('0x9')]);}module[_0xe64f('0xd')]=function(_0x695b8a){return new winston[(_0xe64f('0xe'))]({'transports':[new winston[(_0xe64f('0xf'))]['File']({'name':util[_0xe64f('0x8')](_0xe64f('0x10'),_0x695b8a,_0xe64f('0x11')),'filename':filename(_0x695b8a,'error'),'level':_0xe64f('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3ea16a){return formatter(_0x695b8a,_0x3ea16a);}}),new winston[(_0xe64f('0xf'))][(_0xe64f('0x12'))]({'name':util[_0xe64f('0x8')]('%s-%s',_0x695b8a,'info'),'filename':filename(_0x695b8a,_0xe64f('0x13')),'level':_0xe64f('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x7bb772){return formatter(_0x695b8a,_0x7bb772);}}),new winston[(_0xe64f('0xf'))]['Console']({'level':process[_0xe64f('0x14')][_0xe64f('0x15')]||debugLevel,'json':![],'formatter':function(_0x505059){return formatter(_0x695b8a,_0x505059);}})]});}; \ No newline at end of file +var _0x545e=['YYYY-MM-DD\x20HH:mm:ss','level','exports','Logger','transports','File','%s-%s','error','info','env','debugLevel','winston','path','INFO','join','/var','log','xcally','format','%s-%s.log','message','replace','{{{','[%s]\x20[%s]\x20%s\x20-\x20%s'];(function(_0x18f82b,_0x3ea7a0){var _0x5d8128=function(_0x16a009){while(--_0x16a009){_0x18f82b['push'](_0x18f82b['shift']());}};_0x5d8128(++_0x3ea7a0);}(_0x545e,0x18b));var _0xe545=function(_0x30a271,_0x4ea992){_0x30a271=_0x30a271-0x0;var _0x47e3a2=_0x545e[_0x30a271];return _0x47e3a2;};'use strict';var moment=require('moment');var winston=require(_0xe545('0x0'));var util=require('util');var path=require(_0xe545('0x1'));var debugLevel=_0xe545('0x2');function filename(_0x4a2d7b,_0xea3f33){return path[_0xe545('0x3')](_0xe545('0x4'),_0xe545('0x5'),_0xe545('0x6'),util[_0xe545('0x7')](_0xe545('0x8'),_0x4a2d7b,_0xea3f33));}function formatter(_0x1eb18d,_0x55250b){_0x55250b['message']=_0x55250b[_0xe545('0x9')][_0xe545('0xa')](/@@{/g,_0xe545('0xb'))[_0xe545('0xa')](/}@@/g,'}}}')[_0xe545('0xa')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0xe545('0x7')](_0xe545('0xc'),moment()['format'](_0xe545('0xd')),_0x55250b[_0xe545('0xe')]['toUpperCase'](),_0x1eb18d,_0x55250b[_0xe545('0x9')]);}module[_0xe545('0xf')]=function(_0x30dd15){return new winston[(_0xe545('0x10'))]({'transports':[new winston[(_0xe545('0x11'))][(_0xe545('0x12'))]({'name':util['format'](_0xe545('0x13'),_0x30dd15,_0xe545('0x14')),'filename':filename(_0x30dd15,'error'),'level':_0xe545('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xae5ee1){return formatter(_0x30dd15,_0xae5ee1);}}),new winston[(_0xe545('0x11'))][(_0xe545('0x12'))]({'name':util[_0xe545('0x7')](_0xe545('0x13'),_0x30dd15,_0xe545('0x15')),'filename':filename(_0x30dd15,_0xe545('0x15')),'level':_0xe545('0x15'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x32f279){return formatter(_0x30dd15,_0x32f279);}}),new winston['transports']['Console']({'level':process[_0xe545('0x16')][_0xe545('0x17')]||debugLevel,'json':![],'formatter':function(_0x27b661){return formatter(_0x30dd15,_0x27b661);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 9fb1d5c..12b869e 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 _0x1e37=['../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','../../services/agi/index.js','email','../../services/email/index.js','routing'];(function(_0x537c37,_0x536e74){var _0x241f84=function(_0x3fe709){while(--_0x3fe709){_0x537c37['push'](_0x537c37['shift']());}};_0x241f84(++_0x536e74);}(_0x1e37,0x1c4));var _0x71e3=function(_0x114867,_0x3495b3){_0x114867=_0x114867-0x0;var _0x504fd4=_0x1e37[_0x114867];return _0x504fd4;};'use strict';var path=require(_0x71e3('0x0'));var os=require('os');var config={'apps':[{'name':_0x71e3('0x1'),'script':path[_0x71e3('0x2')](__dirname,_0x71e3('0x3'))},{'name':_0x71e3('0x4'),'script':path[_0x71e3('0x2')](__dirname,_0x71e3('0x5'))},{'name':'agi','script':path[_0x71e3('0x2')](__dirname,_0x71e3('0x6'))},{'name':_0x71e3('0x7'),'script':path[_0x71e3('0x2')](__dirname,_0x71e3('0x8'))},{'name':_0x71e3('0x9'),'script':path[_0x71e3('0x2')](__dirname,_0x71e3('0xa'))},{'name':_0x71e3('0xb'),'script':path[_0x71e3('0x2')](__dirname,_0x71e3('0xc'))}]};module[_0x71e3('0xd')]=config; \ No newline at end of file +var _0xc41e=['../../services/xdr/index.js','exports','path','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','xdr'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xc41e,0x1c4));var _0xec41=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xc41e[_0x1d1779];return _0x2377e9;};'use strict';var path=require(_0xec41('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0xec41('0x1')](__dirname,_0xec41('0x2'))},{'name':_0xec41('0x3'),'script':path[_0xec41('0x1')](__dirname,_0xec41('0x4'))},{'name':_0xec41('0x5'),'script':path[_0xec41('0x1')](__dirname,_0xec41('0x6'))},{'name':'email','script':path[_0xec41('0x1')](__dirname,'../../services/email/index.js')},{'name':'routing','script':path[_0xec41('0x1')](__dirname,'../../services/routing/index.js')},{'name':_0xec41('0x7'),'script':path[_0xec41('0x1')](__dirname,_0xec41('0x8'))}]};module[_0xec41('0x9')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 0b5abb2..4812a9b 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 _0x7c0b=['connected','then','start','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','./config','connect'];(function(_0x21d90e,_0x5b5a8c){var _0x467866=function(_0x3c5088){while(--_0x3c5088){_0x21d90e['push'](_0x21d90e['shift']());}};_0x467866(++_0x5b5a8c);}(_0x7c0b,0x1a1));var _0xb7c0=function(_0x800d8d,_0xfeb09f){_0x800d8d=_0x800d8d-0x0;var _0x5022f7=_0x7c0b[_0x800d8d];return _0x5022f7;};'use strict';var pm2=require(_0xb7c0('0x0'));var BPromise=require('bluebird');var config=require(_0xb7c0('0x1'));function connect(){return new BPromise(function(_0x21b439,_0xb4b9fb){return pm2[_0xb7c0('0x2')](function(_0x179969){if(_0x179969){return _0xb4b9fb(_0x179969);}return _0x21b439(_0xb7c0('0x3'));});});};exports['start']=function(_0x304d3f){return connect()[_0xb7c0('0x4')](function(){return new BPromise(function(_0x4de4b4,_0x3854e0){return pm2[_0xb7c0('0x5')](_0x304d3f,function(_0x1dfdc5,_0x53855b){if(_0x1dfdc5){return _0x3854e0(_0x1dfdc5);}pm2[_0xb7c0('0x6')]();return _0x4de4b4(_0x53855b);});});});};exports[_0xb7c0('0x7')]=function(_0x1b26bf){return connect()[_0xb7c0('0x4')](function(){return new BPromise(function(_0x1f0910,_0x42af7f){return pm2['stop'](_0x1b26bf,function(_0x3b1238,_0x2fd1b2){if(_0x3b1238){return _0x42af7f(_0x3b1238);}pm2[_0xb7c0('0x6')]();return _0x1f0910(_0x2fd1b2);});});});};exports[_0xb7c0('0x8')]=function(_0x52c2cd){return connect()['then'](function(){return new BPromise(function(_0x17b942,_0x134ef2){return pm2['restart'](_0x52c2cd,function(_0x44e742,_0x11fa38){if(_0x44e742){return _0x134ef2(_0x44e742);}pm2[_0xb7c0('0x6')]();return _0x17b942(_0x11fa38);});});});};exports[_0xb7c0('0x9')]=function(){return connect()[_0xb7c0('0x4')](function(){return new BPromise(function(_0x232267,_0x3b5ef1){return pm2[_0xb7c0('0x9')](function(_0xebf361,_0x20f1d3){if(_0xebf361){return _0x3b5ef1(_0xebf361);}pm2[_0xb7c0('0x6')]();return _0x232267(_0x20f1d3);});});});};exports[_0xb7c0('0xa')]=function(_0x23cd2d){return connect()[_0xb7c0('0x4')](function(){return new BPromise(function(_0x33bb1c,_0x29f7cc){return pm2['describe'](_0x23cd2d,function(_0x4e88a4,_0x3983f0){if(_0x4e88a4){return _0x29f7cc(_0x4e88a4);}pm2[_0xb7c0('0x6')]();return _0x33bb1c(_0x3983f0);});});});};exports[_0xb7c0('0xb')]=function(_0xd9a73c){return connect()[_0xb7c0('0x4')](function(){return new BPromise(function(_0x6cb1a,_0x3a167b){return pm2[_0xb7c0('0xb')](_0xd9a73c,function(_0x1ad7e5,_0x169c5d){if(_0x1ad7e5){return _0x3a167b(_0x1ad7e5);}pm2[_0xb7c0('0x6')]();return _0x6cb1a(_0x169c5d);});});});};exports['dump']=function(){return connect()[_0xb7c0('0x4')](function(){return new BPromise(function(_0x5128a7,_0x2b5ec1){return pm2[_0xb7c0('0xc')](function(_0x1e7adf){if(_0x1e7adf){return _0x2b5ec1(_0x1e7adf);}return _0x5128a7(_0xb7c0('0xd'));});});});}; \ No newline at end of file +var _0x8010=['list','describe','delete','dump','saved','./config','connect','connected','start','then','stop','disconnect'];(function(_0xf4d54c,_0x118dba){var _0x1e2ae6=function(_0x13a8f6){while(--_0x13a8f6){_0xf4d54c['push'](_0xf4d54c['shift']());}};_0x1e2ae6(++_0x118dba);}(_0x8010,0x1e5));var _0x0801=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8010[_0x3dd15e];return _0x231fd0;};'use strict';var pm2=require('pm2');var BPromise=require('bluebird');var config=require(_0x0801('0x0'));function connect(){return new BPromise(function(_0x4e36e6,_0x1db32a){return pm2[_0x0801('0x1')](function(_0x555cc6){if(_0x555cc6){return _0x1db32a(_0x555cc6);}return _0x4e36e6(_0x0801('0x2'));});});};exports[_0x0801('0x3')]=function(_0x39cf11){return connect()[_0x0801('0x4')](function(){return new BPromise(function(_0x4e6504,_0xa3d35c){return pm2[_0x0801('0x3')](_0x39cf11,function(_0x4c878b,_0x2e864b){if(_0x4c878b){return _0xa3d35c(_0x4c878b);}pm2['disconnect']();return _0x4e6504(_0x2e864b);});});});};exports[_0x0801('0x5')]=function(_0x3fbd7f){return connect()[_0x0801('0x4')](function(){return new BPromise(function(_0x5e640f,_0x59a39d){return pm2[_0x0801('0x5')](_0x3fbd7f,function(_0x57cb28,_0x21d55d){if(_0x57cb28){return _0x59a39d(_0x57cb28);}pm2[_0x0801('0x6')]();return _0x5e640f(_0x21d55d);});});});};exports['restart']=function(_0x3886f6){return connect()[_0x0801('0x4')](function(){return new BPromise(function(_0x591461,_0x25243b){return pm2['restart'](_0x3886f6,function(_0x1483d9,_0x4d59fe){if(_0x1483d9){return _0x25243b(_0x1483d9);}pm2[_0x0801('0x6')]();return _0x591461(_0x4d59fe);});});});};exports[_0x0801('0x7')]=function(){return connect()[_0x0801('0x4')](function(){return new BPromise(function(_0x2620e0,_0x449fcd){return pm2[_0x0801('0x7')](function(_0x17c00b,_0x20136a){if(_0x17c00b){return _0x449fcd(_0x17c00b);}pm2[_0x0801('0x6')]();return _0x2620e0(_0x20136a);});});});};exports[_0x0801('0x8')]=function(_0x31723e){return connect()[_0x0801('0x4')](function(){return new BPromise(function(_0x5f4a6c,_0xb1f1e){return pm2[_0x0801('0x8')](_0x31723e,function(_0x452258,_0x4b231b){if(_0x452258){return _0xb1f1e(_0x452258);}pm2[_0x0801('0x6')]();return _0x5f4a6c(_0x4b231b);});});});};exports[_0x0801('0x9')]=function(_0xf8483f){return connect()['then'](function(){return new BPromise(function(_0x123da4,_0xe09dca){return pm2[_0x0801('0x9')](_0xf8483f,function(_0x468989,_0x5281c5){if(_0x468989){return _0xe09dca(_0x468989);}pm2[_0x0801('0x6')]();return _0x123da4(_0x5281c5);});});});};exports[_0x0801('0xa')]=function(){return connect()[_0x0801('0x4')](function(){return new BPromise(function(_0x5bcb08,_0x152331){return pm2[_0x0801('0xa')](function(_0x1be9e4){if(_0x1be9e4){return _0x152331(_0x1be9e4);}return _0x5bcb08(_0x0801('0xb'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 6b716fe..46ebb23 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 _0xa411=['then','ChatInteraction','subtract','minutes','length','map','info','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','chatInteraction:update','catch','[CHAT]\x20Error\x20closing\x20interactions','inspect','moment','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','Setting','chatTimeout'];(function(_0x231770,_0xb3ad5a){var _0x5ce5f3=function(_0x433f82){while(--_0x433f82){_0x231770['push'](_0x231770['shift']());}};_0x5ce5f3(++_0xb3ad5a);}(_0xa411,0x15d));var _0x1a41=function(_0x4dc00b,_0x229642){_0x4dc00b=_0x4dc00b-0x0;var _0x38a107=_0xa411[_0x4dc00b];return _0x38a107;};'use strict';var _=require('lodash');var moment=require(_0x1a41('0x0'));var Redis=require('ioredis');var util=require(_0x1a41('0x1'));var config=require(_0x1a41('0x2'));var db=require(_0x1a41('0x3'))['db'];var logger=require(_0x1a41('0x4'))(_0x1a41('0x5'));config[_0x1a41('0x6')]=_[_0x1a41('0x7')](config[_0x1a41('0x6')],{'host':_0x1a41('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1a41('0x6')]));function closeInteractions(){var _0x3651b9=0x0;var _0x3bf9d6=[];return db[_0x1a41('0x9')]['find']({'raw':!![],'attributes':['id',_0x1a41('0xa')],'where':{'id':0x1}})[_0x1a41('0xb')](function(_0xaa4bf0){_0x3651b9=_0xaa4bf0['chatTimeout'];if(_0x3651b9){return db[_0x1a41('0xc')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x1a41('0xd')](_0xaa4bf0[_0x1a41('0xa')],_0x1a41('0xe'))}}});}else{return[];}})['then'](function(_0x5d2008){if(_0x5d2008&&_0x5d2008[_0x1a41('0xf')]){_0x3bf9d6=_[_0x1a41('0x10')](_0x5d2008||[],'id');logger[_0x1a41('0x11')]('[CHAT]\x20Interactions\x20to\x20close:',_0x3bf9d6['join']());return db[_0x1a41('0xc')][_0x1a41('0x12')]({'closeReason':_0x1a41('0x13'),'disposition':_0x1a41('0x14'),'closed':!![],'closedAt':moment()[_0x1a41('0x15')](_0x1a41('0x16'))},{'where':{'id':_0x3bf9d6}});}})[_0x1a41('0xb')](function(){if(_0x3bf9d6&&_0x3bf9d6['length']){logger[_0x1a41('0x11')](_0x1a41('0x17'),_0x3bf9d6[_0x1a41('0x18')]());for(var _0x590056=0x0;_0x590056<_0x3bf9d6[_0x1a41('0xf')];_0x590056++){io[_0x1a41('0x19')](_0x1a41('0x1a'),{'id':_0x3bf9d6[_0x590056],'closed':!![]});}}})[_0x1a41('0x1b')](function(_0x2693d3){logger['error'](_0x1a41('0x1c'),_0x2693d3?util[_0x1a41('0x1d')](_0x2693d3,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x1c12=['minutes','length','map','[CHAT]\x20Interactions\x20to\x20close:','join','timeout','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','inspect','start','lodash','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract'];(function(_0x35035e,_0x26bc1d){var _0x3a042f=function(_0x38d4e3){while(--_0x38d4e3){_0x35035e['push'](_0x35035e['shift']());}};_0x3a042f(++_0x26bc1d);}(_0x1c12,0xba));var _0x21c1=function(_0x4ec82c,_0x28f6a6){_0x4ec82c=_0x4ec82c-0x0;var _0x42d3af=_0x1c12[_0x4ec82c];return _0x42d3af;};'use strict';var _=require(_0x21c1('0x0'));var moment=require('moment');var Redis=require(_0x21c1('0x1'));var util=require(_0x21c1('0x2'));var config=require(_0x21c1('0x3'));var db=require(_0x21c1('0x4'))['db'];var logger=require(_0x21c1('0x5'))(_0x21c1('0x6'));config[_0x21c1('0x7')]=_['defaults'](config[_0x21c1('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x21c1('0x8'))(new Redis(config[_0x21c1('0x7')]));function closeInteractions(){var _0x133490=0x0;var _0x4d09d6=[];return db[_0x21c1('0x9')][_0x21c1('0xa')]({'raw':!![],'attributes':['id',_0x21c1('0xb')],'where':{'id':0x1}})[_0x21c1('0xc')](function(_0x485623){_0x133490=_0x485623[_0x21c1('0xb')];if(_0x133490){return db[_0x21c1('0xd')][_0x21c1('0xe')]({'raw':!![],'attributes':['id',_0x21c1('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x21c1('0x10')](_0x485623[_0x21c1('0xb')],_0x21c1('0x11'))}}});}else{return[];}})['then'](function(_0x4316e8){if(_0x4316e8&&_0x4316e8[_0x21c1('0x12')]){_0x4d09d6=_[_0x21c1('0x13')](_0x4316e8||[],'id');logger['info'](_0x21c1('0x14'),_0x4d09d6[_0x21c1('0x15')]());return db['ChatInteraction']['update']({'closeReason':'system','disposition':_0x21c1('0x16'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x4d09d6}});}})[_0x21c1('0xc')](function(){if(_0x4d09d6&&_0x4d09d6[_0x21c1('0x12')]){logger['info'](_0x21c1('0x17'),_0x4d09d6[_0x21c1('0x15')]());for(var _0x5cdf53=0x0;_0x5cdf53<_0x4d09d6['length'];_0x5cdf53++){io[_0x21c1('0x18')](_0x21c1('0x19'),{'id':_0x4d09d6[_0x5cdf53],'closed':!![]});}}})[_0x21c1('0x1a')](function(_0x3fb2e4){logger['error']('[CHAT]\x20Error\x20closing\x20interactions',_0x3fb2e4?util[_0x21c1('0x1b')](_0x3fb2e4,{'showHidden':![],'depth':null}):'');});}exports[_0x21c1('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 6d27dd3..1731bc0 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 _0x15ad=['authentication','user','pass','format','name','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','../../files/reports','savename','%s.%s','basename','extname','zip','join','existsSync','status','Sent','message','attachments','text','stringify','sendIfEmpty','info','request','SendMail','error','error\x20mail','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','then','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','MailServerOut','keys','map','toString','keyBy','difference','intersection','deleteJob','delete\x20cron','toRun','length','my\x20id','resolve','run\x20job','cron','startAt','start','add\x20cron','exists','stop','stop\x20cron','update\x20cron','run','util','path','moment','cron-job-manager','jayson/promise','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure'];(function(_0x1fade3,_0x55d6b7){var _0x580908=function(_0x547e2d){while(--_0x547e2d){_0x1fade3['push'](_0x1fade3['shift']());}};_0x580908(++_0x55d6b7);}(_0x15ad,0x97));var _0xd15a=function(_0x32ab9f,_0x355ca9){_0x32ab9f=_0x32ab9f-0x0;var _0x69f75c=_0x15ad[_0x32ab9f];return _0x69f75c;};'use strict';var fs=require('fs');var util=require(_0xd15a('0x0'));var path=require(_0xd15a('0x1'));var _=require('lodash');var moment=require(_0xd15a('0x2'));var CronJobManager=require(_0xd15a('0x3'));var jayson=require(_0xd15a('0x4'));var BPromise=require('bluebird');var logger=require(_0xd15a('0x5'))(_0xd15a('0x6'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0xd15a('0x7'));var analyticDefaultReportController=require(_0xd15a('0x8'));var client=jayson[_0xd15a('0x9')][_0xd15a('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x595f32,_0x2e2313){return function(){logger['info'](_0xd15a('0xb'),_0x595f32[_0xd15a('0xc')]);var _0x358765=!![];var _0xa19eda={'tls':{'rejectUnauthorized':![]}};if(_0x595f32[_0xd15a('0xd')][_0xd15a('0xe')]['service']){_0xa19eda[_0xd15a('0xf')]=_0x595f32[_0xd15a('0xd')][_0xd15a('0xe')]['service'];}else{_0xa19eda[_0xd15a('0x10')]=_0x595f32['MailAccount'][_0xd15a('0xe')][_0xd15a('0x10')];_0xa19eda[_0xd15a('0x11')]=_0x595f32[_0xd15a('0xd')][_0xd15a('0xe')][_0xd15a('0x11')];_0xa19eda[_0xd15a('0x12')]=_0x595f32['MailAccount'][_0xd15a('0xe')][_0xd15a('0x12')];}if(_0x595f32[_0xd15a('0xd')][_0xd15a('0xe')][_0xd15a('0x13')]){_0xa19eda['auth']={'user':_0x595f32[_0xd15a('0xd')][_0xd15a('0xe')][_0xd15a('0x14')],'pass':_0x595f32[_0xd15a('0xd')][_0xd15a('0xe')][_0xd15a('0x15')]};}var _0x55bfaa={'account':_0xa19eda,'message':{'from':util[_0xd15a('0x16')]('\x22%s\x22\x20<%s>',_0x595f32['MailAccount'][_0xd15a('0x17')],_0x595f32[_0xd15a('0xd')][_0xd15a('0xc')]||_0x595f32[_0xd15a('0xd')][_0xd15a('0xe')][_0xd15a('0x14')]),'to':_0x595f32[_0xd15a('0xc')],'cc':_0x595f32['cc'],'bcc':_0x595f32['bcc'],'subject':util[_0xd15a('0x16')](_0xd15a('0x18'),_0x2e2313[_0xd15a('0x17')],_0x595f32['subtractNumber'],_0x595f32[_0xd15a('0x19')])}};var _0x22a960=path['join'](__dirname,_0xd15a('0x1a'));var _0x246fad=_0x2e2313[_0xd15a('0x1b')];var _0x16c8f0=util['format'](_0xd15a('0x1c'),path[_0xd15a('0x1d')](_0x2e2313[_0xd15a('0x1b')],path[_0xd15a('0x1e')](_0x2e2313[_0xd15a('0x1b')])),_0xd15a('0x1f'));var _0x20fb9b=path[_0xd15a('0x20')](_0x22a960,_0x246fad);var _0x253812=path[_0xd15a('0x20')](_0x22a960,_0x16c8f0);if(fs[_0xd15a('0x21')](_0x20fb9b)){_0x2e2313[_0xd15a('0x22')]=_0xd15a('0x23');_0x55bfaa[_0xd15a('0x24')][_0xd15a('0x25')]=[{'filename':_0x246fad,'path':_0x20fb9b}];_0x55bfaa['message'][_0xd15a('0x26')]=util[_0xd15a('0x16')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xd15a('0x27')](_0x2e2313,null,0x2));}else if(fs[_0xd15a('0x21')](_0x253812)){_0x2e2313[_0xd15a('0x22')]='Sent';_0x55bfaa[_0xd15a('0x24')][_0xd15a('0x25')]=[{'filename':_0x16c8f0,'path':_0x253812}];}else{_0x55bfaa[_0xd15a('0x24')][_0xd15a('0x26')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x595f32[_0xd15a('0x28')]){_0x358765=![];logger[_0xd15a('0x29')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x358765){return client[_0xd15a('0x2a')](_0xd15a('0x2b'),_0x55bfaa)['then'](function(_0x57627b){if(_0x57627b[_0xd15a('0x2c')]){return logger['error'](_0xd15a('0x2d'),JSON['stringify'](_0x57627b));}return logger[_0xd15a('0x29')]('email\x20sent');})['catch'](function(_0x49aa59){return logger[_0xd15a('0x2c')]('error\x20mail',JSON[_0xd15a('0x27')](_0x49aa59));});}};}function handleError(){return function(_0xa749d){return logger['error'](JSON[_0xd15a('0x27')](_0xa749d));};}function handleResult(_0x554654){return function(_0x19ad92){logger['info'](_0xd15a('0x2e'),JSON['stringify'](_0x19ad92));if(_0x554654[_0xd15a('0xd')]&&_0x554654[_0xd15a('0xd')]['Smtp']&&!_['isNil'](_0x554654[_0xd15a('0xc')])){setTimeout(handleSendEmail(_0x554654,_0x19ad92),0x3c*0x3e8);}};}function handleJob(_0x5ab14b){return function(){try{if(_[_0xd15a('0x2f')](_0x5ab14b[_0xd15a('0x30')])){return logger[_0xd15a('0x29')](_0xd15a('0x31'));}if(_[_0xd15a('0x2f')](_0x5ab14b[_0xd15a('0x19')])){return logger[_0xd15a('0x29')]('subtractUnit\x20null\x20or\x20undefined');}var _0x19ba74={'startDate':moment()[_0xd15a('0x32')](_0x5ab14b[_0xd15a('0x30')],_0x5ab14b[_0xd15a('0x19')])[_0xd15a('0x16')](_0xd15a('0x33')),'endDate':moment()['format'](_0xd15a('0x33')),'type':_0xd15a('0x34'),'output':_0x5ab14b[_0xd15a('0x35')],'name':_0x5ab14b[_0xd15a('0x17')]};if(!_[_0xd15a('0x2f')](_0x5ab14b['DefaultReportId'])){logger[_0xd15a('0x29')](_0xd15a('0x36'),_0x5ab14b[_0xd15a('0x37')]);return analyticDefaultReportController[_0xd15a('0x38')]({'id':_0x5ab14b[_0xd15a('0x37')]},_0x19ba74)[_0xd15a('0x39')](handleResult(_0x5ab14b))[_0xd15a('0x3a')](handleError());}if(!_[_0xd15a('0x2f')](_0x5ab14b[_0xd15a('0x3b')])){logger[_0xd15a('0x29')](_0xd15a('0x3c'),_0x5ab14b['CustomReportId']);return analyticCustomReportController[_0xd15a('0x38')]({'id':_0x5ab14b[_0xd15a('0x3b')]},_0x19ba74)[_0xd15a('0x39')](handleResult(_0x5ab14b))[_0xd15a('0x3a')](handleError());}}catch(_0x1d7a9e){logger[_0xd15a('0x2c')](JSON[_0xd15a('0x27')](_0x1d7a9e));}return logger['info'](_0xd15a('0x3d'));};}function getJobs(_0x1e9700){var _0x3ff7fc={};if(_0x1e9700){_0x3ff7fc['id']=_0x1e9700;}return db['Schedule']['findAll']({'where':_0x3ff7fc,'include':[{'model':db[_0xd15a('0xd')],'attributes':['id',_0xd15a('0x17'),_0xd15a('0xc')],'include':[{'model':db[_0xd15a('0x3e')],'as':_0xd15a('0xe')}]}]})[_0xd15a('0x39')](function(_0x2a5285){var _0x1026ce=_[_0xd15a('0x3f')](manager['jobs']);var _0x1a61af=_[_0xd15a('0x40')](_0x2a5285,function(_0x56bbbb){return _0x56bbbb['id'][_0xd15a('0x41')]();});var _0x3cdb93=_[_0xd15a('0x42')](_0x2a5285,function(_0x3cd4f6){return _0x3cd4f6['id'][_0xd15a('0x41')]();});var _0x4352c0=_0x1e9700?_0x1a61af:_[_0xd15a('0x43')](_0x1a61af,_0x1026ce);var _0x45585f=_[_0xd15a('0x44')](_0x1a61af,_0x1026ce);var _0x1305f3=_[_0xd15a('0x43')](_0x1026ce,_0x1a61af);var _0xfd6973;var _0x17754f;for(_0xfd6973=0x0;_0xfd6973<_0x1305f3['length']&&!_0x1e9700;_0xfd6973+=0x1){_0x17754f=_0x1305f3[_0xfd6973]['toString']();if(manager['exists'](_0x17754f)){manager['stop'](_0x17754f);manager[_0xd15a('0x45')](_0x17754f);logger[_0xd15a('0x29')](_0xd15a('0x46'),_0x17754f);}}logger[_0xd15a('0x29')](_0xd15a('0x47'),JSON[_0xd15a('0x27')](_0x4352c0));for(_0xfd6973=0x0;_0xfd6973<_0x4352c0[_0xd15a('0x48')];_0xfd6973+=0x1){_0x17754f=_0x4352c0[_0xfd6973][_0xd15a('0x41')]();logger[_0xd15a('0x29')]('index',_0x17754f);if(_0x1e9700){logger[_0xd15a('0x29')](_0xd15a('0x49'),_0x1e9700);logger[_0xd15a('0x29')](JSON[_0xd15a('0x27')](_0x3cdb93[_0x17754f]));BPromise[_0xd15a('0x4a')]()[_0xd15a('0x39')](handleJob(_0x3cdb93[_0x17754f]));logger[_0xd15a('0x29')](_0xd15a('0x4b'),_0x3cdb93[_0x17754f][_0xd15a('0x17')],_0x3cdb93[_0x17754f][_0xd15a('0x4c')]);}else if(_0x3cdb93[_0x17754f][_0xd15a('0x4c')]&&_0x3cdb93[_0x17754f]['active']&&moment()['isBetween'](_0x3cdb93[_0x17754f][_0xd15a('0x4d')],_0x3cdb93[_0x17754f]['endAt'])){manager['add'](_0x17754f,_0x3cdb93[_0x17754f]['cron'],handleJob(_0x3cdb93[_0x17754f]));manager[_0xd15a('0x4e')](_0x17754f);logger['info'](_0xd15a('0x4f'),_0x3cdb93[_0x17754f][_0xd15a('0x17')],_0x3cdb93[_0x17754f][_0xd15a('0x4c')]);}else if(manager[_0xd15a('0x50')](_0x17754f)){manager[_0xd15a('0x51')](_0x17754f);manager['deleteJob'](_0x17754f);logger[_0xd15a('0x29')](_0xd15a('0x52'),_0x3cdb93[_0x17754f][_0xd15a('0x17')],_0x3cdb93[_0x17754f][_0xd15a('0x4c')]);}}for(_0xfd6973=0x0,_0x17754f;_0xfd6973<_0x45585f['length']&&!_0x1e9700;_0xfd6973+=0x1){_0x17754f=_0x45585f[_0xfd6973]['toString']();if(manager[_0xd15a('0x50')](_0x17754f)){if(_0x3cdb93[_0x17754f]['cron']&&_0x3cdb93[_0x17754f]['active']&&moment()['isBetween'](_0x3cdb93[_0x17754f][_0xd15a('0x4d')],_0x3cdb93[_0x17754f]['endAt'])){manager['update'](_0x17754f,_0x3cdb93[_0x17754f][_0xd15a('0x4c')],handleJob(_0x3cdb93[_0x17754f]));logger[_0xd15a('0x29')](_0xd15a('0x53'),_0x3cdb93[_0x17754f][_0xd15a('0x17')],_0x3cdb93[_0x17754f][_0xd15a('0x4c')]);}else{manager[_0xd15a('0x51')](_0x17754f);manager[_0xd15a('0x45')](_0x17754f);logger[_0xd15a('0x29')]('stop\x20cron',_0x3cdb93[_0x17754f][_0xd15a('0x17')],_0x3cdb93[_0x17754f]['cron']);}}}})[_0xd15a('0x3a')](function(_0x2c20ab){logger[_0xd15a('0x2c')](JSON['stringify'](_0x2c20ab));});}exports[_0xd15a('0x54')]=function(_0xa785cf){return getJobs(_0xa785cf);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xc200=['Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','subtractUnit','join','../../files/reports','savename','basename','extname','zip','existsSync','status','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Sent','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','CustomReportId','no\x20report\x20id','Schedule','MailServerOut','map','toString','keyBy','difference','intersection','length','stop','deleteJob','delete\x20cron','toRun','my\x20id','resolve','run\x20job','cron','isBetween','startAt','add','stop\x20cron','exists','active','endAt','update','update\x20cron','run','start','util','path','lodash','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','auth','user','pass','format','bcc'];(function(_0x451217,_0x2bb4fe){var _0x5cb0f2=function(_0x1be303){while(--_0x1be303){_0x451217['push'](_0x451217['shift']());}};_0x5cb0f2(++_0x2bb4fe);}(_0xc200,0x161));var _0x0c20=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xc200[_0x525c7b];return _0x27b33e;};'use strict';var fs=require('fs');var util=require(_0x0c20('0x0'));var path=require(_0x0c20('0x1'));var _=require(_0x0c20('0x2'));var moment=require('moment');var CronJobManager=require(_0x0c20('0x3'));var jayson=require(_0x0c20('0x4'));var BPromise=require(_0x0c20('0x5'));var logger=require(_0x0c20('0x6'))(_0x0c20('0x7'));var db=require(_0x0c20('0x8'))['db'];var analyticCustomReportController=require(_0x0c20('0x9'));var analyticDefaultReportController=require(_0x0c20('0xa'));var client=jayson[_0x0c20('0xb')][_0x0c20('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x5b8554,_0x4255c2){return function(){logger[_0x0c20('0xd')](_0x0c20('0xe'),_0x5b8554[_0x0c20('0xf')]);var _0x5a5ced=!![];var _0x8106ac={'tls':{'rejectUnauthorized':![]}};if(_0x5b8554[_0x0c20('0x10')][_0x0c20('0x11')]['service']){_0x8106ac[_0x0c20('0x12')]=_0x5b8554['MailAccount'][_0x0c20('0x11')][_0x0c20('0x12')];}else{_0x8106ac[_0x0c20('0x13')]=_0x5b8554[_0x0c20('0x10')][_0x0c20('0x11')][_0x0c20('0x13')];_0x8106ac['port']=_0x5b8554['MailAccount'][_0x0c20('0x11')][_0x0c20('0x14')];_0x8106ac[_0x0c20('0x15')]=_0x5b8554[_0x0c20('0x10')][_0x0c20('0x11')][_0x0c20('0x15')];}if(_0x5b8554[_0x0c20('0x10')][_0x0c20('0x11')]['authentication']){_0x8106ac[_0x0c20('0x16')]={'user':_0x5b8554[_0x0c20('0x10')]['Smtp'][_0x0c20('0x17')],'pass':_0x5b8554[_0x0c20('0x10')][_0x0c20('0x11')][_0x0c20('0x18')]};}var _0x47357d={'account':_0x8106ac,'message':{'from':util[_0x0c20('0x19')]('\x22%s\x22\x20<%s>',_0x5b8554['MailAccount']['name'],_0x5b8554[_0x0c20('0x10')][_0x0c20('0xf')]||_0x5b8554['MailAccount'][_0x0c20('0x11')][_0x0c20('0x17')]),'to':_0x5b8554[_0x0c20('0xf')],'cc':_0x5b8554['cc'],'bcc':_0x5b8554[_0x0c20('0x1a')],'subject':util[_0x0c20('0x19')](_0x0c20('0x1b'),_0x4255c2[_0x0c20('0x1c')],_0x5b8554[_0x0c20('0x1d')],_0x5b8554[_0x0c20('0x1e')])}};var _0x4f4b38=path[_0x0c20('0x1f')](__dirname,_0x0c20('0x20'));var _0x4987f6=_0x4255c2[_0x0c20('0x21')];var _0x17e24a=util[_0x0c20('0x19')]('%s.%s',path[_0x0c20('0x22')](_0x4255c2['savename'],path[_0x0c20('0x23')](_0x4255c2[_0x0c20('0x21')])),_0x0c20('0x24'));var _0x3e32b3=path[_0x0c20('0x1f')](_0x4f4b38,_0x4987f6);var _0x437334=path[_0x0c20('0x1f')](_0x4f4b38,_0x17e24a);if(fs[_0x0c20('0x25')](_0x3e32b3)){_0x4255c2[_0x0c20('0x26')]='Sent';_0x47357d[_0x0c20('0x27')][_0x0c20('0x28')]=[{'filename':_0x4987f6,'path':_0x3e32b3}];_0x47357d[_0x0c20('0x27')][_0x0c20('0x29')]=util[_0x0c20('0x19')](_0x0c20('0x2a'),JSON[_0x0c20('0x2b')](_0x4255c2,null,0x2));}else if(fs['existsSync'](_0x437334)){_0x4255c2[_0x0c20('0x26')]=_0x0c20('0x2c');_0x47357d['message'][_0x0c20('0x28')]=[{'filename':_0x17e24a,'path':_0x437334}];}else{_0x47357d[_0x0c20('0x27')]['text']=_0x0c20('0x2d');if(!_0x5b8554[_0x0c20('0x2e')]){_0x5a5ced=![];logger[_0x0c20('0xd')](_0x0c20('0x2f'));}}if(_0x5a5ced){return client[_0x0c20('0x30')](_0x0c20('0x31'),_0x47357d)['then'](function(_0x2e6522){if(_0x2e6522['error']){return logger[_0x0c20('0x32')](_0x0c20('0x33'),JSON['stringify'](_0x2e6522));}return logger[_0x0c20('0xd')](_0x0c20('0x34'));})[_0x0c20('0x35')](function(_0x3ba077){return logger[_0x0c20('0x32')](_0x0c20('0x33'),JSON[_0x0c20('0x2b')](_0x3ba077));});}};}function handleError(){return function(_0x2887ba){return logger['error'](JSON[_0x0c20('0x2b')](_0x2887ba));};}function handleResult(_0x131a14){return function(_0x77796a){logger['info'](_0x0c20('0x36'),JSON[_0x0c20('0x2b')](_0x77796a));if(_0x131a14[_0x0c20('0x10')]&&_0x131a14[_0x0c20('0x10')][_0x0c20('0x11')]&&!_[_0x0c20('0x37')](_0x131a14['email'])){setTimeout(handleSendEmail(_0x131a14,_0x77796a),0x3c*0x3e8);}};}function handleJob(_0x1fca47){return function(){try{if(_[_0x0c20('0x37')](_0x1fca47[_0x0c20('0x1d')])){return logger[_0x0c20('0xd')](_0x0c20('0x38'));}if(_['isNil'](_0x1fca47['subtractUnit'])){return logger[_0x0c20('0xd')](_0x0c20('0x39'));}var _0x135520={'startDate':moment()[_0x0c20('0x3a')](_0x1fca47[_0x0c20('0x1d')],_0x1fca47[_0x0c20('0x1e')])[_0x0c20('0x19')](_0x0c20('0x3b')),'endDate':moment()[_0x0c20('0x19')](_0x0c20('0x3b')),'type':_0x0c20('0x3c'),'output':_0x1fca47[_0x0c20('0x3d')],'name':_0x1fca47[_0x0c20('0x1c')]};if(!_[_0x0c20('0x37')](_0x1fca47[_0x0c20('0x3e')])){logger[_0x0c20('0xd')](_0x0c20('0x3f'),_0x1fca47[_0x0c20('0x3e')]);return analyticDefaultReportController[_0x0c20('0x40')]({'id':_0x1fca47[_0x0c20('0x3e')]},_0x135520)[_0x0c20('0x41')](handleResult(_0x1fca47))[_0x0c20('0x35')](handleError());}if(!_[_0x0c20('0x37')](_0x1fca47[_0x0c20('0x42')])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x1fca47['CustomReportId']);return analyticCustomReportController[_0x0c20('0x40')]({'id':_0x1fca47['CustomReportId']},_0x135520)[_0x0c20('0x41')](handleResult(_0x1fca47))[_0x0c20('0x35')](handleError());}}catch(_0x51671a){logger[_0x0c20('0x32')](JSON[_0x0c20('0x2b')](_0x51671a));}return logger[_0x0c20('0xd')](_0x0c20('0x43'));};}function getJobs(_0x3f8bb2){var _0x3d45d8={};if(_0x3f8bb2){_0x3d45d8['id']=_0x3f8bb2;}return db[_0x0c20('0x44')]['findAll']({'where':_0x3d45d8,'include':[{'model':db[_0x0c20('0x10')],'attributes':['id',_0x0c20('0x1c'),_0x0c20('0xf')],'include':[{'model':db[_0x0c20('0x45')],'as':_0x0c20('0x11')}]}]})[_0x0c20('0x41')](function(_0x259131){var _0x3c52d6=_['keys'](manager['jobs']);var _0x5a6e7e=_[_0x0c20('0x46')](_0x259131,function(_0x3af1e3){return _0x3af1e3['id'][_0x0c20('0x47')]();});var _0x5a3ad7=_[_0x0c20('0x48')](_0x259131,function(_0x3cec1e){return _0x3cec1e['id'][_0x0c20('0x47')]();});var _0x114c95=_0x3f8bb2?_0x5a6e7e:_[_0x0c20('0x49')](_0x5a6e7e,_0x3c52d6);var _0x1bc405=_[_0x0c20('0x4a')](_0x5a6e7e,_0x3c52d6);var _0x1bf33d=_[_0x0c20('0x49')](_0x3c52d6,_0x5a6e7e);var _0x1d3642;var _0x2ef149;for(_0x1d3642=0x0;_0x1d3642<_0x1bf33d[_0x0c20('0x4b')]&&!_0x3f8bb2;_0x1d3642+=0x1){_0x2ef149=_0x1bf33d[_0x1d3642][_0x0c20('0x47')]();if(manager['exists'](_0x2ef149)){manager[_0x0c20('0x4c')](_0x2ef149);manager[_0x0c20('0x4d')](_0x2ef149);logger[_0x0c20('0xd')](_0x0c20('0x4e'),_0x2ef149);}}logger[_0x0c20('0xd')](_0x0c20('0x4f'),JSON[_0x0c20('0x2b')](_0x114c95));for(_0x1d3642=0x0;_0x1d3642<_0x114c95[_0x0c20('0x4b')];_0x1d3642+=0x1){_0x2ef149=_0x114c95[_0x1d3642][_0x0c20('0x47')]();logger[_0x0c20('0xd')]('index',_0x2ef149);if(_0x3f8bb2){logger['info'](_0x0c20('0x50'),_0x3f8bb2);logger[_0x0c20('0xd')](JSON[_0x0c20('0x2b')](_0x5a3ad7[_0x2ef149]));BPromise[_0x0c20('0x51')]()[_0x0c20('0x41')](handleJob(_0x5a3ad7[_0x2ef149]));logger[_0x0c20('0xd')](_0x0c20('0x52'),_0x5a3ad7[_0x2ef149][_0x0c20('0x1c')],_0x5a3ad7[_0x2ef149]['cron']);}else if(_0x5a3ad7[_0x2ef149][_0x0c20('0x53')]&&_0x5a3ad7[_0x2ef149]['active']&&moment()[_0x0c20('0x54')](_0x5a3ad7[_0x2ef149][_0x0c20('0x55')],_0x5a3ad7[_0x2ef149]['endAt'])){manager[_0x0c20('0x56')](_0x2ef149,_0x5a3ad7[_0x2ef149][_0x0c20('0x53')],handleJob(_0x5a3ad7[_0x2ef149]));manager['start'](_0x2ef149);logger[_0x0c20('0xd')]('add\x20cron',_0x5a3ad7[_0x2ef149][_0x0c20('0x1c')],_0x5a3ad7[_0x2ef149][_0x0c20('0x53')]);}else if(manager['exists'](_0x2ef149)){manager['stop'](_0x2ef149);manager[_0x0c20('0x4d')](_0x2ef149);logger['info'](_0x0c20('0x57'),_0x5a3ad7[_0x2ef149][_0x0c20('0x1c')],_0x5a3ad7[_0x2ef149][_0x0c20('0x53')]);}}for(_0x1d3642=0x0,_0x2ef149;_0x1d3642<_0x1bc405['length']&&!_0x3f8bb2;_0x1d3642+=0x1){_0x2ef149=_0x1bc405[_0x1d3642]['toString']();if(manager[_0x0c20('0x58')](_0x2ef149)){if(_0x5a3ad7[_0x2ef149][_0x0c20('0x53')]&&_0x5a3ad7[_0x2ef149][_0x0c20('0x59')]&&moment()[_0x0c20('0x54')](_0x5a3ad7[_0x2ef149][_0x0c20('0x55')],_0x5a3ad7[_0x2ef149][_0x0c20('0x5a')])){manager[_0x0c20('0x5b')](_0x2ef149,_0x5a3ad7[_0x2ef149]['cron'],handleJob(_0x5a3ad7[_0x2ef149]));logger['info'](_0x0c20('0x5c'),_0x5a3ad7[_0x2ef149][_0x0c20('0x1c')],_0x5a3ad7[_0x2ef149][_0x0c20('0x53')]);}else{manager[_0x0c20('0x4c')](_0x2ef149);manager[_0x0c20('0x4d')](_0x2ef149);logger['info'](_0x0c20('0x57'),_0x5a3ad7[_0x2ef149][_0x0c20('0x1c')],_0x5a3ad7[_0x2ef149]['cron']);}}}})[_0x0c20('0x35')](function(_0x1f0f2e){logger[_0x0c20('0x32')](JSON['stringify'](_0x1f0f2e));});}exports[_0x0c20('0x5d')]=function(_0x13a631){return getJobs(_0x13a631);};exports[_0x0c20('0x5e')]=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 35aabfb..e16b238 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 _0x3611=['COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','sentiment','sentimentAccountId','sentimentRegion','language','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','update','SentimentScore','Negative','Mixed','Neutral','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','Sentiment','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','CloudProvider','forEach','all','inspect','start','lodash','util','../../config/logger','transcribe','getTranscriptionJob','Comprehend','info','format','data1','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText'];(function(_0x11dbb0,_0x557eb1){var _0x11873e=function(_0x361d8b){while(--_0x361d8b){_0x11dbb0['push'](_0x11dbb0['shift']());}};_0x11873e(++_0x557eb1);}(_0x3611,0x136));var _0x1361=function(_0xa00492,_0x5ab9e5){_0xa00492=_0xa00492-0x0;var _0x122014=_0x3611[_0xa00492];return _0x122014;};var _=require(_0x1361('0x0'));var AWS=require('aws-sdk');var rp=require('request-promise');var util=require(_0x1361('0x1'));var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require(_0x1361('0x2'))(_0x1361('0x3'));function getTranscriptionJob(_0x25db42,_0x383a70,_0x5c4262,_0x289e07){return new Promise(function(_0x304832,_0x5aa5dc){var _0x216d22=new AWS['TranscribeService']({'accessKeyId':_0x383a70,'secretAccessKey':_0x25db42,'region':_0x5c4262});_0x216d22[_0x1361('0x4')]({'TranscriptionJobName':_0x289e07},function(_0x49cfad,_0x5cc29f){if(_0x49cfad){return _0x5aa5dc(_0x49cfad);}else{return _0x304832(_0x5cc29f);}});});}function sentiment(_0xc43b7e,_0x253b3a,_0x146242,_0x3f02de,_0x43acbd){return new Promise(function(_0x410a2b,_0x14756b){var _0x519638=new AWS[(_0x1361('0x5'))]({'accessKeyId':_0x253b3a,'secretAccessKey':_0xc43b7e,'region':_0x146242});_0x519638['detectSentiment']({'Text':_0x3f02de,'LanguageCode':_0x43acbd['substring'](0x0,0x2)},function(_0x10b9e7,_0x4a98fe){if(_0x10b9e7){return _0x14756b(_0x10b9e7);}else{return _0x410a2b(_0x4a98fe);}});});}function checkTranscribeJob(_0x27dd65,_0x2cecd6,_0xbc9d68){var _0x1a36e9;return new BPromise(function(_0x459788,_0x2e05ce){logger[_0x1361('0x6')](util[_0x1361('0x7')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x27dd65['id'],_0x27dd65['transcribeName']));return getTranscriptionJob(_0xbc9d68[_0x1361('0x8')],_0xbc9d68['data2'],_0x2cecd6['transcribeRegion'],_0x27dd65[_0x1361('0x9')])[_0x1361('0xa')](function(_0x31e1c7){logger[_0x1361('0x6')](util['format'](_0x1361('0xb'),_0x27dd65['id'],_0x27dd65[_0x1361('0x9')],_0x31e1c7[_0x1361('0xc')][_0x1361('0xd')]));if(!_0x27dd65[_0x1361('0xe')]){switch(_0x31e1c7[_0x1361('0xc')]['TranscriptionJobStatus']){case _0x1361('0xf'):var _0x49e768={'transcribeStatus':_0x31e1c7[_0x1361('0xc')][_0x1361('0xd')],'fileUri':_0x31e1c7[_0x1361('0xc')][_0x1361('0x10')][_0x1361('0x11')]};logger['info'](util[_0x1361('0x7')](_0x1361('0x12'),_0x27dd65['id']));return rp({'uri':_0x31e1c7[_0x1361('0xc')][_0x1361('0x10')]['TranscriptFileUri'],'json':!![]})['then'](function(_0xa3f1f8){logger['info'](util[_0x1361('0x7')](_0x1361('0x13'),_0x27dd65['id']));if(_0xa3f1f8&&_0xa3f1f8[_0x1361('0x14')]&&_0xa3f1f8[_0x1361('0x14')][_0x1361('0x15')]&&_0xa3f1f8['results'][_0x1361('0x15')][_0x1361('0x16')]){_0x49e768[_0x1361('0xe')]='';for(var _0x1d9c1d=0x0;_0x1d9c1d<_0xa3f1f8['results'][_0x1361('0x15')][_0x1361('0x16')];_0x1d9c1d++){_0x49e768[_0x1361('0xe')]+=_0xa3f1f8['results'][_0x1361('0x15')][_0x1d9c1d][_0x1361('0x17')]+'';}}return _0x27dd65['update'](_0x49e768);})[_0x1361('0xa')](function(){logger[_0x1361('0x6')](util[_0x1361('0x7')](_0x1361('0x18'),_0x27dd65['id']));if(!_0x27dd65['tempSentiment']){throw new db[(_0x1361('0x19'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x2cecd6[_0x1361('0x1a')]||!_0x2cecd6[_0x1361('0x1b')]||!_0x2cecd6[_0x1361('0x1c')]||!_0x2cecd6[_0x1361('0x1d')]||!_0x2cecd6[_0x1361('0x1e')]){throw new db[(_0x1361('0x19'))][(_0x1361('0x1f'))](_0x1361('0x20'));}if(!_0x49e768[_0x1361('0xe')]){throw new Error(_0x1361('0x21'));}if(_0x2cecd6[_0x1361('0x1b')]===_0xbc9d68['id']){return _0xbc9d68;}else{return db['CloudProvider'][_0x1361('0x22')]({'where':{'id':_settings[_0x1361('0x1b')]}});}})[_0x1361('0xa')](function(_0x187f85){if(!_0x187f85){throw new db[(_0x1361('0x19'))][(_0x1361('0x1f'))](_0x1361('0x23'));}if(!_0x187f85[_0x1361('0x8')]||!_0x187f85[_0x1361('0x24')]){throw new db[(_0x1361('0x19'))][(_0x1361('0x1f'))](_0x1361('0x25'));}_0x1a36e9=_0x187f85;logger[_0x1361('0x6')](util[_0x1361('0x7')](_0x1361('0x26'),_0x27dd65['id']));return sentiment(_0x1a36e9[_0x1361('0x8')],_0x1a36e9[_0x1361('0x24')],_0x2cecd6['sentimentRegion'],_0x49e768[_0x1361('0xe')],_0x2cecd6[_0x1361('0x1d')]);})['then'](function(_0x234be2){logger[_0x1361('0x6')](util[_0x1361('0x7')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x27dd65['id']));return _0x27dd65[_0x1361('0x27')]({'sentiment':_0x234be2['Sentiment'],'sPositive':_0x234be2[_0x1361('0x28')]['Positive'],'sNegative':_0x234be2['SentimentScore'][_0x1361('0x29')],'sMixed':_0x234be2['SentimentScore'][_0x1361('0x2a')],'sNeutral':_0x234be2[_0x1361('0x28')][_0x1361('0x2b')]});})[_0x1361('0xa')](function(){logger['info'](util[_0x1361('0x7')](_0x1361('0x18'),_0x27dd65['id']));_0x459788();});case'FAILED':return _0x27dd65[_0x1361('0x27')]({'transcribeStatus':'FAILED','failureReason':_0x31e1c7[_0x1361('0xc')]['FailureReason']})['then'](function(){logger[_0x1361('0x6')](util[_0x1361('0x7')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x27dd65['id']));_0x459788();});default:logger[_0x1361('0x6')](util[_0x1361('0x7')](_0x1361('0x2c'),_0x27dd65['id']));break;}}else{return BPromise[_0x1361('0x2d')]()[_0x1361('0xa')](function(){if(!_0x27dd65[_0x1361('0x2e')]){throw new db['Sequelize'][(_0x1361('0x1f'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x2cecd6['sentiment']||!_0x2cecd6[_0x1361('0x1b')]||!_0x2cecd6[_0x1361('0x1c')]||!_0x2cecd6[_0x1361('0x1d')]||!_0x2cecd6[_0x1361('0x1e')]){throw new db[(_0x1361('0x19'))]['ValidationError'](_0x1361('0x20'));}if(!_0x27dd65[_0x1361('0xe')]){throw new Error(_0x1361('0x21'));}if(_0x2cecd6[_0x1361('0x1b')]===_0xbc9d68['id']){return _0xbc9d68;}else{return db['CloudProvider'][_0x1361('0x22')]({'where':{'id':_settings[_0x1361('0x1b')]}});}})[_0x1361('0xa')](function(_0x490c95){if(!_0x490c95){throw new db[(_0x1361('0x19'))][(_0x1361('0x1f'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x490c95['data1']||!_0x490c95['data2']){throw new db[(_0x1361('0x19'))][(_0x1361('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0x1a36e9=_0x490c95;logger[_0x1361('0x6')](util[_0x1361('0x7')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x27dd65['id']));return sentiment(_0x1a36e9['data1'],_0x1a36e9[_0x1361('0x24')],_0x2cecd6[_0x1361('0x1c')],_0x27dd65[_0x1361('0xe')],_0x2cecd6[_0x1361('0x1d')]);})[_0x1361('0xa')](function(_0x193581){logger[_0x1361('0x6')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x27dd65['id']));return _0x27dd65[_0x1361('0x27')]({'sentiment':_0x193581[_0x1361('0x2f')],'sPositive':_0x193581['SentimentScore']['Positive'],'sNegative':_0x193581[_0x1361('0x28')][_0x1361('0x29')],'sMixed':_0x193581[_0x1361('0x28')][_0x1361('0x2a')],'sNeutral':_0x193581['SentimentScore'][_0x1361('0x2b')],'transcribeStatus':_0x1361('0xf')});})['then'](function(){logger[_0x1361('0x6')](util[_0x1361('0x7')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x27dd65['id']));_0x459788();});}})[_0x1361('0x30')](function(_0x5c4f56){if(_0x5c4f56){if(!_0x5c4f56[_0x1361('0x31')]||_0x5c4f56[_0x1361('0x31')]!==_0x1361('0x32')){logger[_0x1361('0x33')](util[_0x1361('0x7')](_0x1361('0x34'),_0x27dd65['id']),util['inspect'](_0x5c4f56,{'showHidden':![],'depth':null}));}}_0x459788();});});}function checkTranscribe(){var _0x21324c;var _0x4412c2;var _0x4b8114;return db[_0x1361('0x35')]['findAll']({'where':{'transcribeStatus':_0x1361('0x36')}})['then'](function(_0x1d8703){if(!_0x1d8703||!_0x1d8703['length']){throw new db['Sequelize'][(_0x1361('0x1f'))](_0x1361('0x37'));}_0x21324c=_0x1d8703;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0x1361('0xa')](function(_0x3bd647){if(!_0x3bd647){throw new db[(_0x1361('0x19'))][(_0x1361('0x1f'))](_0x1361('0x38'));}_0x4412c2=_0x3bd647;if(!_0x4412c2[_0x1361('0x3')]||!_0x4412c2[_0x1361('0x39')]||!_0x4412c2[_0x1361('0x3a')]||!_0x4412c2['language']||!_0x4412c2['bucket']){throw new db[(_0x1361('0x19'))][(_0x1361('0x1f'))](_0x1361('0x3b'));}return db[_0x1361('0x3c')][_0x1361('0x22')]({'where':{'id':_0x4412c2[_0x1361('0x39')]}});})['then'](function(_0x1a7120){if(!_0x1a7120){throw new db['Sequelize'][(_0x1361('0x1f'))](_0x1361('0x23'));}if(!_0x1a7120[_0x1361('0x8')]||!_0x1a7120['data2']){throw new db[(_0x1361('0x19'))][(_0x1361('0x1f'))](_0x1361('0x25'));}_0x4b8114=_0x1a7120;var _0x96ca99=[];_0x21324c[_0x1361('0x3d')](function(_0x5ec794){_0x96ca99['push'](checkTranscribeJob(_0x5ec794,_0x4412c2,_0x4b8114));});return BPromise[_0x1361('0x3e')](_0x96ca99);})[_0x1361('0x30')](function(_0x307704){if(_0x307704){if(!_0x307704[_0x1361('0x31')]||_0x307704['name']!==_0x1361('0x32')){logger[_0x1361('0x33')](util[_0x1361('0x3f')](_0x307704,{'showHidden':![],'depth':null}));}}});}exports[_0x1361('0x40')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x0e21=['Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','tempSentiment','sentiment','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','catch','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','Setting','Settings\x20not\x20available','transcribeAccountId','all','SequelizeValidationError','inspect','start','aws-sdk','request-promise','util','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','substring','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','then','info','format','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','bucket','Transcript\x20not\x20available','CloudProvider','findOne','data2','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','update','Sentiment','SentimentScore','Positive'];(function(_0x176831,_0x2b8fc2){var _0x2a1bcf=function(_0x3abdea){while(--_0x3abdea){_0x176831['push'](_0x176831['shift']());}};_0x2a1bcf(++_0x2b8fc2);}(_0x0e21,0xe8));var _0x10e2=function(_0x4649c9,_0x2c2c49){_0x4649c9=_0x4649c9-0x0;var _0x3a8dfe=_0x0e21[_0x4649c9];return _0x3a8dfe;};var _=require('lodash');var AWS=require(_0x10e2('0x0'));var rp=require(_0x10e2('0x1'));var util=require(_0x10e2('0x2'));var BPromise=require('bluebird');var db=require(_0x10e2('0x3'))['db'];var logger=require(_0x10e2('0x4'))(_0x10e2('0x5'));function getTranscriptionJob(_0x4861d5,_0x4b6911,_0x263df,_0x340513){return new Promise(function(_0x2fb9e4,_0x44e30e){var _0x4e1687=new AWS[(_0x10e2('0x6'))]({'accessKeyId':_0x4b6911,'secretAccessKey':_0x4861d5,'region':_0x263df});_0x4e1687[_0x10e2('0x7')]({'TranscriptionJobName':_0x340513},function(_0x48ab5b,_0x375bbc){if(_0x48ab5b){return _0x44e30e(_0x48ab5b);}else{return _0x2fb9e4(_0x375bbc);}});});}function sentiment(_0x50c758,_0x3594c4,_0x52ef03,_0x559b78,_0x5ac29c){return new Promise(function(_0xe4451a,_0x13c32a){var _0x5c6925=new AWS[(_0x10e2('0x8'))]({'accessKeyId':_0x3594c4,'secretAccessKey':_0x50c758,'region':_0x52ef03});_0x5c6925['detectSentiment']({'Text':_0x559b78,'LanguageCode':_0x5ac29c[_0x10e2('0x9')](0x0,0x2)},function(_0x435c67,_0x26b7dd){if(_0x435c67){return _0x13c32a(_0x435c67);}else{return _0xe4451a(_0x26b7dd);}});});}function checkTranscribeJob(_0x56db90,_0x37dafd,_0x4072f4){var _0x411688;return new BPromise(function(_0x4e584f,_0x4d8533){logger['info'](util['format'](_0x10e2('0xa'),_0x56db90['id'],_0x56db90[_0x10e2('0xb')]));return getTranscriptionJob(_0x4072f4[_0x10e2('0xc')],_0x4072f4['data2'],_0x37dafd[_0x10e2('0xd')],_0x56db90[_0x10e2('0xb')])[_0x10e2('0xe')](function(_0x40c5bc){logger[_0x10e2('0xf')](util[_0x10e2('0x10')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x56db90['id'],_0x56db90[_0x10e2('0xb')],_0x40c5bc[_0x10e2('0x11')][_0x10e2('0x12')]));if(!_0x56db90[_0x10e2('0x13')]){switch(_0x40c5bc[_0x10e2('0x11')][_0x10e2('0x12')]){case _0x10e2('0x14'):var _0x1a8f8d={'transcribeStatus':_0x40c5bc['TranscriptionJob'][_0x10e2('0x12')],'fileUri':_0x40c5bc[_0x10e2('0x11')][_0x10e2('0x15')][_0x10e2('0x16')]};logger['info'](util['format'](_0x10e2('0x17'),_0x56db90['id']));return rp({'uri':_0x40c5bc[_0x10e2('0x11')][_0x10e2('0x15')][_0x10e2('0x16')],'json':!![]})['then'](function(_0x54ef4f){logger[_0x10e2('0xf')](util[_0x10e2('0x10')](_0x10e2('0x18'),_0x56db90['id']));if(_0x54ef4f&&_0x54ef4f[_0x10e2('0x19')]&&_0x54ef4f[_0x10e2('0x19')][_0x10e2('0x1a')]&&_0x54ef4f['results'][_0x10e2('0x1a')][_0x10e2('0x1b')]){_0x1a8f8d[_0x10e2('0x13')]='';for(var _0x46ae73=0x0;_0x46ae73<_0x54ef4f[_0x10e2('0x19')][_0x10e2('0x1a')]['length'];_0x46ae73++){_0x1a8f8d[_0x10e2('0x13')]+=_0x54ef4f['results']['transcripts'][_0x46ae73]['transcript']+'';}}return _0x56db90['update'](_0x1a8f8d);})['then'](function(){logger['info'](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x56db90['id']));if(!_0x56db90['tempSentiment']){throw new db[(_0x10e2('0x1c'))][(_0x10e2('0x1d'))](_0x10e2('0x1e'));}if(!_0x37dafd['sentiment']||!_0x37dafd[_0x10e2('0x1f')]||!_0x37dafd[_0x10e2('0x20')]||!_0x37dafd[_0x10e2('0x21')]||!_0x37dafd[_0x10e2('0x22')]){throw new db[(_0x10e2('0x1c'))][(_0x10e2('0x1d'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x1a8f8d['fileText']){throw new Error(_0x10e2('0x23'));}if(_0x37dafd[_0x10e2('0x1f')]===_0x4072f4['id']){return _0x4072f4;}else{return db[_0x10e2('0x24')][_0x10e2('0x25')]({'where':{'id':_settings[_0x10e2('0x1f')]}});}})[_0x10e2('0xe')](function(_0x45a3a0){if(!_0x45a3a0){throw new db[(_0x10e2('0x1c'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x45a3a0[_0x10e2('0xc')]||!_0x45a3a0[_0x10e2('0x26')]){throw new db[(_0x10e2('0x1c'))][(_0x10e2('0x1d'))]('Cloud\x20Provider\x20not\x20configured');}_0x411688=_0x45a3a0;logger['info'](util[_0x10e2('0x10')](_0x10e2('0x27'),_0x56db90['id']));return sentiment(_0x411688[_0x10e2('0xc')],_0x411688[_0x10e2('0x26')],_0x37dafd[_0x10e2('0x20')],_0x1a8f8d[_0x10e2('0x13')],_0x37dafd['language']);})[_0x10e2('0xe')](function(_0x45590f){logger[_0x10e2('0xf')](util[_0x10e2('0x10')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x56db90['id']));return _0x56db90[_0x10e2('0x28')]({'sentiment':_0x45590f[_0x10e2('0x29')],'sPositive':_0x45590f[_0x10e2('0x2a')][_0x10e2('0x2b')],'sNegative':_0x45590f[_0x10e2('0x2a')][_0x10e2('0x2c')],'sMixed':_0x45590f['SentimentScore'][_0x10e2('0x2d')],'sNeutral':_0x45590f[_0x10e2('0x2a')][_0x10e2('0x2e')]});})[_0x10e2('0xe')](function(){logger[_0x10e2('0xf')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x56db90['id']));_0x4e584f();});case'FAILED':return _0x56db90['update']({'transcribeStatus':_0x10e2('0x2f'),'failureReason':_0x40c5bc['TranscriptionJob'][_0x10e2('0x30')]})[_0x10e2('0xe')](function(){logger[_0x10e2('0xf')](util[_0x10e2('0x10')](_0x10e2('0x31'),_0x56db90['id']));_0x4e584f();});default:logger[_0x10e2('0xf')](util[_0x10e2('0x10')](_0x10e2('0x32'),_0x56db90['id']));break;}}else{return BPromise['resolve']()[_0x10e2('0xe')](function(){if(!_0x56db90[_0x10e2('0x33')]){throw new db['Sequelize'][(_0x10e2('0x1d'))](_0x10e2('0x1e'));}if(!_0x37dafd[_0x10e2('0x34')]||!_0x37dafd[_0x10e2('0x1f')]||!_0x37dafd[_0x10e2('0x20')]||!_0x37dafd['language']||!_0x37dafd[_0x10e2('0x22')]){throw new db[(_0x10e2('0x1c'))][(_0x10e2('0x1d'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x56db90['fileText']){throw new Error(_0x10e2('0x23'));}if(_0x37dafd[_0x10e2('0x1f')]===_0x4072f4['id']){return _0x4072f4;}else{return db[_0x10e2('0x24')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x6836d4){if(!_0x6836d4){throw new db[(_0x10e2('0x1c'))][(_0x10e2('0x1d'))](_0x10e2('0x35'));}if(!_0x6836d4[_0x10e2('0xc')]||!_0x6836d4[_0x10e2('0x26')]){throw new db[(_0x10e2('0x1c'))]['ValidationError'](_0x10e2('0x36'));}_0x411688=_0x6836d4;logger[_0x10e2('0xf')](util[_0x10e2('0x10')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x56db90['id']));return sentiment(_0x411688[_0x10e2('0xc')],_0x411688[_0x10e2('0x26')],_0x37dafd[_0x10e2('0x20')],_0x56db90[_0x10e2('0x13')],_0x37dafd[_0x10e2('0x21')]);})[_0x10e2('0xe')](function(_0x518ee5){logger[_0x10e2('0xf')](util[_0x10e2('0x10')](_0x10e2('0x37'),_0x56db90['id']));return _0x56db90[_0x10e2('0x28')]({'sentiment':_0x518ee5[_0x10e2('0x29')],'sPositive':_0x518ee5[_0x10e2('0x2a')][_0x10e2('0x2b')],'sNegative':_0x518ee5[_0x10e2('0x2a')][_0x10e2('0x2c')],'sMixed':_0x518ee5['SentimentScore']['Mixed'],'sNeutral':_0x518ee5[_0x10e2('0x2a')][_0x10e2('0x2e')],'transcribeStatus':'COMPLETED'});})['then'](function(){logger[_0x10e2('0xf')](util[_0x10e2('0x10')](_0x10e2('0x31'),_0x56db90['id']));_0x4e584f();});}})[_0x10e2('0x38')](function(_0x12a1f0){if(_0x12a1f0){if(!_0x12a1f0['name']||_0x12a1f0[_0x10e2('0x39')]!=='SequelizeValidationError'){logger[_0x10e2('0x3a')](util[_0x10e2('0x10')](_0x10e2('0x3b'),_0x56db90['id']),util['inspect'](_0x12a1f0,{'showHidden':![],'depth':null}));}}_0x4e584f();});});}function checkTranscribe(){var _0x53af61;var _0x2b94e6;var _0x34e2fe;return db[_0x10e2('0x3c')][_0x10e2('0x3d')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x512d4d){if(!_0x512d4d||!_0x512d4d[_0x10e2('0x1b')]){throw new db[(_0x10e2('0x1c'))][(_0x10e2('0x1d'))]('No\x20transcribe\x20job\x20to\x20check');}_0x53af61=_0x512d4d;return db[_0x10e2('0x3e')][_0x10e2('0x25')]({'where':{'id':0x1}});})[_0x10e2('0xe')](function(_0x4bd9e6){if(!_0x4bd9e6){throw new db['Sequelize'][(_0x10e2('0x1d'))](_0x10e2('0x3f'));}_0x2b94e6=_0x4bd9e6;if(!_0x2b94e6['transcribe']||!_0x2b94e6['transcribeAccountId']||!_0x2b94e6[_0x10e2('0xd')]||!_0x2b94e6[_0x10e2('0x21')]||!_0x2b94e6['bucket']){throw new db['Sequelize'][(_0x10e2('0x1d'))]('Transcribe\x20not\x20configured');}return db[_0x10e2('0x24')]['findOne']({'where':{'id':_0x2b94e6[_0x10e2('0x40')]}});})['then'](function(_0xf21188){if(!_0xf21188){throw new db[(_0x10e2('0x1c'))]['ValidationError'](_0x10e2('0x35'));}if(!_0xf21188[_0x10e2('0xc')]||!_0xf21188[_0x10e2('0x26')]){throw new db[(_0x10e2('0x1c'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x34e2fe=_0xf21188;var _0xa9f14f=[];_0x53af61['forEach'](function(_0x3dba83){_0xa9f14f['push'](checkTranscribeJob(_0x3dba83,_0x2b94e6,_0x34e2fe));});return BPromise[_0x10e2('0x41')](_0xa9f14f);})[_0x10e2('0x38')](function(_0x3226bc){if(_0x3226bc){if(!_0x3226bc['name']||_0x3226bc[_0x10e2('0x39')]!==_0x10e2('0x42')){logger[_0x10e2('0x3a')](util[_0x10e2('0x43')](_0x3226bc,{'showHidden':![],'depth':null}));}}});}exports[_0x10e2('0x44')]=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 d9f6901..7cdbde0 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 _0x829a=['hours','then','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','system','timeout','YYYY-MM-DD\x20HH:mm:ss','emit','whatsappInteraction:update','catch','inspect','start','lodash','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','subtract'];(function(_0x3608ed,_0x1339d7){var _0xa53c8d=function(_0x2c6001){while(--_0x2c6001){_0x3608ed['push'](_0x3608ed['shift']());}};_0xa53c8d(++_0x1339d7);}(_0x829a,0xee));var _0xa829=function(_0x5a2ddc,_0x4d7f76){_0x5a2ddc=_0x5a2ddc-0x0;var _0x2d1019=_0x829a[_0x5a2ddc];return _0x2d1019;};'use strict';var _=require(_0xa829('0x0'));var moment=require('moment');var Redis=require(_0xa829('0x1'));var util=require(_0xa829('0x2'));var config=require(_0xa829('0x3'));var db=require(_0xa829('0x4'))['db'];var logger=require(_0xa829('0x5'))(_0xa829('0x6'));config[_0xa829('0x7')]=_[_0xa829('0x8')](config[_0xa829('0x7')],{'host':_0xa829('0x9'),'port':0x18eb});var io=require(_0xa829('0xa'))(new Redis(config[_0xa829('0x7')]));function closeInteractions(){var _0x2710b1=[];return db[_0xa829('0xb')][_0xa829('0xc')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xa829('0xd')](0x18,_0xa829('0xe'))}}})[_0xa829('0xf')](function(_0x2c08f7){if(_0x2c08f7&&_0x2c08f7['length']){_0x2710b1=_[_0xa829('0x10')](_0x2c08f7||[],'id');logger[_0xa829('0x11')](_0xa829('0x12'),_0x2710b1[_0xa829('0x13')]());return db[_0xa829('0xb')]['update']({'closeReason':_0xa829('0x14'),'disposition':_0xa829('0x15'),'closed':!![],'closedAt':moment()['format'](_0xa829('0x16'))},{'where':{'id':_0x2710b1}});}})[_0xa829('0xf')](function(){if(_0x2710b1&&_0x2710b1['length']){logger[_0xa829('0x11')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x2710b1[_0xa829('0x13')]());for(var _0x78e963=0x0;_0x78e963<_0x2710b1['length'];_0x78e963++){io[_0xa829('0x17')](_0xa829('0x18'),{'id':_0x2710b1[_0x78e963],'closed':!![]});}}})[_0xa829('0x19')](function(_0x4e32f0){logger['error']('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x4e32f0?util[_0xa829('0x1a')](_0x4e32f0,{'showHidden':![],'depth':null}):'');});}exports[_0xa829('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x6ced=['socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','system','timeout','format','length','emit','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','../../config/environment','../../mysqldb','../logger','schedule','defaults','redis','localhost'];(function(_0x48d446,_0x58dbc4){var _0x28353c=function(_0x5a1573){while(--_0x5a1573){_0x48d446['push'](_0x48d446['shift']());}};_0x28353c(++_0x58dbc4);}(_0x6ced,0x1e3));var _0xd6ce=function(_0x4ae526,_0x1d4fc5){_0x4ae526=_0x4ae526-0x0;var _0x4da8be=_0x6ced[_0x4ae526];return _0x4da8be;};'use strict';var _=require(_0xd6ce('0x0'));var moment=require(_0xd6ce('0x1'));var Redis=require(_0xd6ce('0x2'));var util=require('util');var config=require(_0xd6ce('0x3'));var db=require(_0xd6ce('0x4'))['db'];var logger=require(_0xd6ce('0x5'))(_0xd6ce('0x6'));config['redis']=_[_0xd6ce('0x7')](config[_0xd6ce('0x8')],{'host':_0xd6ce('0x9'),'port':0x18eb});var io=require(_0xd6ce('0xa'))(new Redis(config[_0xd6ce('0x8')]));function closeInteractions(){var _0x2f3656=[];return db[_0xd6ce('0xb')][_0xd6ce('0xc')]({'raw':!![],'attributes':['id',_0xd6ce('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xd6ce('0xe')](0x18,_0xd6ce('0xf'))}}})[_0xd6ce('0x10')](function(_0x2d9e77){if(_0x2d9e77&&_0x2d9e77['length']){_0x2f3656=_[_0xd6ce('0x11')](_0x2d9e77||[],'id');logger[_0xd6ce('0x12')](_0xd6ce('0x13'),_0x2f3656[_0xd6ce('0x14')]());return db['WhatsappInteraction']['update']({'closeReason':_0xd6ce('0x15'),'disposition':_0xd6ce('0x16'),'closed':!![],'closedAt':moment()[_0xd6ce('0x17')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x2f3656}});}})['then'](function(){if(_0x2f3656&&_0x2f3656[_0xd6ce('0x18')]){logger['info']('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x2f3656[_0xd6ce('0x14')]());for(var _0x528b5c=0x0;_0x528b5c<_0x2f3656[_0xd6ce('0x18')];_0x528b5c++){io[_0xd6ce('0x19')]('whatsappInteraction:update',{'id':_0x2f3656[_0x528b5c],'closed':!![]});}}})['catch'](function(_0x3c18e0){logger['error'](_0xd6ce('0x1a'),_0x3c18e0?util[_0xd6ce('0x1b')](_0x3c18e0,{'showHidden':![],'depth':null}):'');});}exports[_0xd6ce('0x1c')]=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 29ba360..5ff1ea0 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f8d=['../mysqldb','push','Innocenzo','Biondo','now','@xcally.com','CmContact','then','bulkCreate','log','finished\x20populating','contacts1','destroy','CmHopper','hopper1','hopper2','catch','util'];(function(_0x457b64,_0x49a219){var _0x437111=function(_0x3dad3d){while(--_0x3dad3d){_0x457b64['push'](_0x457b64['shift']());}};_0x437111(++_0x49a219);}(_0x4f8d,0x179));var _0xd4f8=function(_0x391c55,_0x168617){_0x391c55=_0x391c55-0x0;var _0xa434e0=_0x4f8d[_0x391c55];return _0xa434e0;};'use strict';var util=require(_0xd4f8('0x0'));var db=require(_0xd4f8('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xd4f8('0x2')]({'id':i,'firstName':_0xd4f8('0x3')+i,'lastName':_0xd4f8('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xd4f8('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xd4f8('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xd4f8('0x5')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xd4f8('0x2')]({'id':i,'firstName':_0xd4f8('0x3')+i,'lastName':_0xd4f8('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xd4f8('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xd4f8('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xd4f8('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xd4f8('0x5')]()});}db[_0xd4f8('0x7')]['destroy']({'where':{}})[_0xd4f8('0x8')](function(){return db['CmContact'][_0xd4f8('0x9')](contacts);})['then'](function(){console[_0xd4f8('0xa')](_0xd4f8('0xb'),_0xd4f8('0xc'));return db['CmHopper'][_0xd4f8('0xd')]({'where':{}});})['then'](function(){return db[_0xd4f8('0xe')][_0xd4f8('0x9')](hopper);})[_0xd4f8('0x8')](function(){console['log'](_0xd4f8('0xb'),_0xd4f8('0xf'));return db[_0xd4f8('0x7')][_0xd4f8('0x9')](contacts2);})[_0xd4f8('0x8')](function(){console[_0xd4f8('0xa')]('finished\x20populating','contacts2');return db[_0xd4f8('0xe')][_0xd4f8('0x9')](hopper2);})[_0xd4f8('0x8')](function(){console[_0xd4f8('0xa')](_0xd4f8('0xb'),_0xd4f8('0x10'));})[_0xd4f8('0x11')](function(_0x312561){console[_0xd4f8('0xa')](_0x312561);}); \ No newline at end of file +var _0x6dfa=['log','contacts1','CmHopper','destroy','finished\x20populating','hopper1','contacts2','hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','then','bulkCreate'];(function(_0xa06f75,_0x59525b){var _0x519ad8=function(_0x209abc){while(--_0x209abc){_0xa06f75['push'](_0xa06f75['shift']());}};_0x519ad8(++_0x59525b);}(_0x6dfa,0x121));var _0xa6df=function(_0x3dfb90,_0x13a3f7){_0x3dfb90=_0x3dfb90-0x0;var _0x59f5d5=_0x6dfa[_0x3dfb90];return _0x59f5d5;};'use strict';var util=require(_0xa6df('0x0'));var db=require(_0xa6df('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xa6df('0x2')]({'id':i,'firstName':_0xa6df('0x3')+i,'lastName':_0xa6df('0x4')+i,'phone':0xf879fb460+i,'email':_0xa6df('0x5')+i+_0xa6df('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xa6df('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xa6df('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xa6df('0x7')](),'updatedAt':Date[_0xa6df('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xa6df('0x2')]({'id':i,'firstName':_0xa6df('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xa6df('0x5')+i+_0xa6df('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xa6df('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xa6df('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xa6df('0x7')](),'updatedAt':Date['now']()});}db[_0xa6df('0x8')]['destroy']({'where':{}})[_0xa6df('0x9')](function(){return db[_0xa6df('0x8')][_0xa6df('0xa')](contacts);})[_0xa6df('0x9')](function(){console[_0xa6df('0xb')]('finished\x20populating',_0xa6df('0xc'));return db[_0xa6df('0xd')][_0xa6df('0xe')]({'where':{}});})[_0xa6df('0x9')](function(){return db['CmHopper']['bulkCreate'](hopper);})[_0xa6df('0x9')](function(){console[_0xa6df('0xb')](_0xa6df('0xf'),_0xa6df('0x10'));return db[_0xa6df('0x8')][_0xa6df('0xa')](contacts2);})[_0xa6df('0x9')](function(){console[_0xa6df('0xb')](_0xa6df('0xf'),_0xa6df('0x11'));return db[_0xa6df('0xd')]['bulkCreate'](hopper2);})[_0xa6df('0x9')](function(){console[_0xa6df('0xb')]('finished\x20populating',_0xa6df('0x12'));})[_0xa6df('0x13')](function(_0x5aff80){console[_0xa6df('0xb')](_0x5aff80);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 5c8dcd7..4412ae9 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0913=['actpass','\x22%s\x22\x20<%s>','bulkCreate','log','add\x20user','catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','udp','wss','all','ulaw','yes'];(function(_0x1d6a82,_0x37c315){var _0x5834ac=function(_0x2402ba){while(--_0x2402ba){_0x1d6a82['push'](_0x1d6a82['shift']());}};_0x5834ac(++_0x37c315);}(_0x0913,0x1ec));var _0x3091=function(_0x4a4c9b,_0x7cec4a){_0x4a4c9b=_0x4a4c9b-0x0;var _0x493e11=_0x0913[_0x4a4c9b];return _0x493e11;};'use strict';var util=require(_0x3091('0x0'));var db=require(_0x3091('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x3091('0x2')]({'name':util[_0x3091('0x3')](_0x3091('0x4'),'agent',i),'fullname':util[_0x3091('0x3')]('%s%s',_0x3091('0x5'),i),'email':util[_0x3091('0x3')](_0x3091('0x6'),'agent',i),'role':'agent','password':'password','internal':0xfa0+i,'type':'friend','transport':[_0x3091('0x7'),'ws',_0x3091('0x8')],'disallow':[_0x3091('0x9')],'allow':[_0x3091('0xa')],'defaultuser':util[_0x3091('0x3')](_0x3091('0x4'),_0x3091('0x5'),i),'encryption':_0x3091('0xb'),'avpf':_0x3091('0xb'),'force_avp':_0x3091('0xb'),'icesupport':'yes','dtlsenable':'yes','dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x3091('0xc'),'callerid':util['format'](_0x3091('0xd'),util[_0x3091('0x3')](_0x3091('0x4'),'agent',i),0xfa0+i)});}db['User'][_0x3091('0xe')](users)['then'](function(){console[_0x3091('0xf')](_0x3091('0x10'));})[_0x3091('0x11')](function(_0x1eef2f){console[_0x3091('0xf')](_0x1eef2f);}); \ No newline at end of file +var _0xbe3a=['ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate','then','log','add\x20user','catch','util','format','%s%s','agent','password','all'];(function(_0x40b9da,_0x4d98d8){var _0x21bc68=function(_0x53cef1){while(--_0x53cef1){_0x40b9da['push'](_0x40b9da['shift']());}};_0x21bc68(++_0x4d98d8);}(_0xbe3a,0x1e7));var _0xabe3=function(_0x451024,_0x24b90e){_0x451024=_0x451024-0x0;var _0x2a0dec=_0xbe3a[_0x451024];return _0x2a0dec;};'use strict';var util=require(_0xabe3('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0xabe3('0x1')](_0xabe3('0x2'),_0xabe3('0x3'),i),'fullname':util['format'](_0xabe3('0x2'),_0xabe3('0x3'),i),'email':util[_0xabe3('0x1')]('%s%s@xcally.com','agent',i),'role':_0xabe3('0x3'),'password':_0xabe3('0x4'),'internal':0xfa0+i,'type':'friend','transport':['udp','ws','wss'],'disallow':[_0xabe3('0x5')],'allow':[_0xabe3('0x6')],'defaultuser':util['format'](_0xabe3('0x2'),'agent',i),'encryption':_0xabe3('0x7'),'avpf':'yes','force_avp':'yes','icesupport':'yes','dtlsenable':_0xabe3('0x7'),'dtlsverify':'no','dtlscertfile':_0xabe3('0x8'),'dtlsprivatekey':_0xabe3('0x9'),'dtlssetup':_0xabe3('0xa'),'callerid':util['format']('\x22%s\x22\x20<%s>',util[_0xabe3('0x1')](_0xabe3('0x2'),_0xabe3('0x3'),i),0xfa0+i)});}db[_0xabe3('0xb')][_0xabe3('0xc')](users)[_0xabe3('0xd')](function(){console[_0xabe3('0xe')](_0xabe3('0xf'));})[_0xabe3('0x10')](function(_0x52bd70){console[_0xabe3('0xe')](_0x52bd70);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 0f47e63..df82523 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a55=['removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','catch','join','default','connection','setMaxListeners','address','request','remotePort','connectedAt','log','SocketIO\x20','nsp','disconnect','CONNECTED','lodash','./environment','User','role','name','telephone','agent','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','IvrCampaigns','UserProfileResource','resourceId','map','Campaign','where','format','%s:queue:%s','Agents','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','include','push','VoiceQueue','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','ChatQueue','FaxQueues','SmsQueues','MailQueue','Trunks','Trunk','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','length','voice','chat','openchannel','whatsapp','telephone:%s','campaign:%s:%s','removeChatInteractions','emit','removeMailInteractions','user_has_mail_interactions:remove','leave','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions'];(function(_0x9a138c,_0x2607f8){var _0x3771a3=function(_0x22ebbb){while(--_0x22ebbb){_0x9a138c['push'](_0x9a138c['shift']());}};_0x3771a3(++_0x2607f8);}(_0x6a55,0xdb));var _0x56a5=function(_0x5b174b,_0x404869){_0x5b174b=_0x5b174b-0x0;var _0x47ee37=_0x6a55[_0x5b174b];return _0x47ee37;};'use strict';var _=require(_0x56a5('0x0'));var util=require('util');var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var config=require(_0x56a5('0x1'));var queryQueues={'attributes':['id','name'],'include':[{'as':'Agents','model':db[_0x56a5('0x2')],'attributes':['id','name',_0x56a5('0x3')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x56a5('0x4')],'where':{'role':_0x56a5('0x5')}};var queryTrunks={'raw':!![],'attributes':['id',_0x56a5('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x56a5('0x4')],'where':{'role':_0x56a5('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x56a5('0x4'),_0x56a5('0x7')],'where':{'type':_0x56a5('0x8')}};function getAssociatedResources(_0x586f7a,_0x1c9e7a,_0xf15490){return db[_0x56a5('0x9')][_0x56a5('0xa')]({'where':{'name':_0x586f7a,'userProfileId':_0x1c9e7a},'raw':!![]})[_0x56a5('0xb')](function(_0x3a721d){if(_0x3a721d){if(_0x3a721d[_0x56a5('0xc')]){switch(_0x586f7a){case _0x56a5('0xd'):case _0x56a5('0xe'):case'FaxQueues':case'SmsQueues':case _0x56a5('0xf'):case _0x56a5('0x10'):case _0x56a5('0x11'):return db[_0xf15490][_0x56a5('0x12')](queryQueues);case _0x56a5('0x13'):return db[_0xf15490][_0x56a5('0x12')](queryTelephones);case'Trunks':return db[_0xf15490]['findAll'](queryTrunks);case _0x56a5('0x14'):return db[_0xf15490][_0x56a5('0x12')](queryCampaigns);}}else{return db[_0x56a5('0x15')][_0x56a5('0x12')]({'attributes':[_0x56a5('0x16')],'where':{'sectionId':_0x3a721d['id']},'raw':!![]})[_0x56a5('0xb')](function(_0xe3091f){if(_0xe3091f){var _0x5c4028={'where':{'id':_[_0x56a5('0x17')](_0xe3091f,'resourceId')},'raw':!![]};switch(_0xf15490){case _0x56a5('0x2'):_0x5c4028['where'][_0x56a5('0x3')]=_0x56a5('0x5');break;case _0x56a5('0x18'):_0x5c4028[_0x56a5('0x19')][_0x56a5('0x7')]=_0x56a5('0x8');break;}return db[_0xf15490][_0x56a5('0x12')](_0x5c4028);}else{return[];}});}}else{return[];}})['then'](function(_0x8621c1){return _0x8621c1;});}function joinOrLeaveQueues(_0x3db687,_0x2bd357,_0x127d73,_0x52eee2){_0x3db687[_0x2bd357](util[_0x56a5('0x1a')](_0x56a5('0x1b'),_0x127d73,_0x52eee2[_0x56a5('0x4')]));if(_0x52eee2[_0x56a5('0x1c')]){for(var _0x155d3b=0x0;_0x155d3b<_0x52eee2['Agents']['length'];_0x155d3b+=0x1){_0x3db687[_0x2bd357](util[_0x56a5('0x1a')](_0x56a5('0x1d'),_0x52eee2['Agents'][_0x155d3b][_0x56a5('0x4')]));}}}function joinOrLeave(_0x309fa5,_0x615d49,_0x15d9f8){var _0xe1ded0;if(_0x309fa5[_0x56a5('0x1e')][_0x56a5('0x1f')]['id']){db[_0x56a5('0x2')][_0x56a5('0x20')]({'attributes':['id',_0x56a5('0x4'),_0x56a5('0x3'),_0x56a5('0x21')],'where':{'id':_0x309fa5[_0x56a5('0x1e')]['query']['id']},'include':[{'model':db[_0x56a5('0x22')],'as':_0x56a5('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x56a5('0x24')],'as':_0x56a5('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x56a5('0x26')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x56a5('0x27')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x56a5('0x28')],'as':_0x56a5('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x56a5('0x2a')],'as':_0x56a5('0x2b'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x3b55e6){if(_0x3b55e6){_0xe1ded0=_0x3b55e6;_0x309fa5[_0x615d49](util[_0x56a5('0x1a')](_0x56a5('0x1d'),_0x3b55e6['name']));var _0x22ceab=[];switch(_0x3b55e6[_0x56a5('0x3')]){case _0x56a5('0x2c'):_0x309fa5[_0x615d49](_0x56a5('0x2d'));_0x309fa5[_0x615d49](_0x56a5('0x2e'));if(queryQueues['hasOwnProperty'](_0x56a5('0x2f'))){delete queryQueues[_0x56a5('0x2f')];}_0x22ceab[_0x56a5('0x30')](db[_0x56a5('0x31')][_0x56a5('0x12')](queryQueues));_0x22ceab['push'](db['ChatQueue'][_0x56a5('0x12')](queryQueues));_0x22ceab[_0x56a5('0x30')](db[_0x56a5('0x32')]['findAll'](queryQueues));_0x22ceab[_0x56a5('0x30')](db[_0x56a5('0x33')]['findAll'](queryQueues));_0x22ceab['push'](db['MailQueue']['findAll'](queryQueues));_0x22ceab[_0x56a5('0x30')](db[_0x56a5('0x34')][_0x56a5('0x12')](queryQueues));_0x22ceab['push'](db[_0x56a5('0x35')]['findAll'](queryQueues));_0x22ceab[_0x56a5('0x30')](db[_0x56a5('0x2')]['findAll'](queryTelephones));_0x22ceab[_0x56a5('0x30')](db['Trunk'][_0x56a5('0x12')](queryTrunks));_0x22ceab[_0x56a5('0x30')](db[_0x56a5('0x18')]['findAll'](queryCampaigns));_0x22ceab[_0x56a5('0x30')](db[_0x56a5('0x2')][_0x56a5('0x12')](queryAgents));break;case'user':_0x309fa5[_0x615d49](_0x56a5('0x2d'));_0x309fa5[_0x615d49](_0x56a5('0x2e'));_0x22ceab[_0x56a5('0x30')](getAssociatedResources(_0x56a5('0xd'),_0x3b55e6[_0x56a5('0x21')],'VoiceQueue'));_0x22ceab['push'](getAssociatedResources(_0x56a5('0xe'),_0x3b55e6[_0x56a5('0x21')],_0x56a5('0x36')));_0x22ceab[_0x56a5('0x30')](getAssociatedResources(_0x56a5('0x37'),_0x3b55e6[_0x56a5('0x21')],_0x56a5('0x32')));_0x22ceab[_0x56a5('0x30')](getAssociatedResources(_0x56a5('0x38'),_0x3b55e6[_0x56a5('0x21')],_0x56a5('0x33')));_0x22ceab[_0x56a5('0x30')](getAssociatedResources(_0x56a5('0xf'),_0x3b55e6[_0x56a5('0x21')],_0x56a5('0x39')));_0x22ceab[_0x56a5('0x30')](getAssociatedResources(_0x56a5('0x10'),_0x3b55e6[_0x56a5('0x21')],_0x56a5('0x34')));_0x22ceab[_0x56a5('0x30')](getAssociatedResources(_0x56a5('0x11'),_0x3b55e6[_0x56a5('0x21')],'WhatsappQueue'));_0x22ceab['push'](getAssociatedResources(_0x56a5('0x13'),_0x3b55e6['userProfileId'],_0x56a5('0x2')));_0x22ceab[_0x56a5('0x30')](getAssociatedResources(_0x56a5('0x3a'),_0x3b55e6[_0x56a5('0x21')],_0x56a5('0x3b')));_0x22ceab[_0x56a5('0x30')](getAssociatedResources('IvrCampaigns',_0x3b55e6['userProfileId'],_0x56a5('0x18')));_0x22ceab[_0x56a5('0x30')](db[_0x56a5('0x2')][_0x56a5('0x12')](queryAgents));break;case _0x56a5('0x6'):_0x309fa5[_0x615d49](_0x56a5('0x2d'));_0x309fa5[_0x615d49]('voice:outbound');_0x22ceab[_0x56a5('0x30')](_0x3b55e6[_0x56a5('0x3c')]({'attributes':['id','name']}));_0x22ceab[_0x56a5('0x30')](_0x3b55e6[_0x56a5('0x3d')]({'attributes':['id',_0x56a5('0x4')]}));_0x22ceab[_0x56a5('0x30')](_0x3b55e6['getFaxQueues']({'attributes':['id',_0x56a5('0x4')]}));_0x22ceab['push'](_0x3b55e6[_0x56a5('0x3e')]({'attributes':['id',_0x56a5('0x4')]}));_0x22ceab['push'](_0x3b55e6[_0x56a5('0x3f')]({'attributes':['id','name']}));_0x22ceab[_0x56a5('0x30')](_0x3b55e6[_0x56a5('0x40')]({'attributes':['id','name']}));_0x22ceab[_0x56a5('0x30')](_0x3b55e6['getWhatsappQueues']({'attributes':['id',_0x56a5('0x4')]}));break;}return BPromise['all'](_0x22ceab);}})[_0x56a5('0xb')](function(_0x47c740){if(_0x47c740&&_0x47c740[_0x56a5('0x41')]){for(var _0xe57293=0x0;_0xe57293<_0x47c740[_0x56a5('0x41')];_0xe57293+=0x1){for(var _0x3017dd=0x0;_0x3017dd<_0x47c740[_0xe57293][_0x56a5('0x41')];_0x3017dd+=0x1){switch(_0xe57293){case 0x0:joinOrLeaveQueues(_0x309fa5,_0x615d49,_0x56a5('0x42'),_0x47c740[_0xe57293][_0x3017dd]);break;case 0x1:joinOrLeaveQueues(_0x309fa5,_0x615d49,_0x56a5('0x43'),_0x47c740[_0xe57293][_0x3017dd]);break;case 0x2:joinOrLeaveQueues(_0x309fa5,_0x615d49,'fax',_0x47c740[_0xe57293][_0x3017dd]);break;case 0x3:joinOrLeaveQueues(_0x309fa5,_0x615d49,'sms',_0x47c740[_0xe57293][_0x3017dd]);break;case 0x4:joinOrLeaveQueues(_0x309fa5,_0x615d49,'mail',_0x47c740[_0xe57293][_0x3017dd]);break;case 0x5:joinOrLeaveQueues(_0x309fa5,_0x615d49,_0x56a5('0x44'),_0x47c740[_0xe57293][_0x3017dd]);break;case 0x6:joinOrLeaveQueues(_0x309fa5,_0x615d49,_0x56a5('0x45'),_0x47c740[_0xe57293][_0x3017dd]);break;case 0x7:if(_0xe1ded0[_0x56a5('0x3')]!=='agent')_0x309fa5[_0x615d49](util[_0x56a5('0x1a')](_0x56a5('0x46'),_0x47c740[_0xe57293][_0x3017dd][_0x56a5('0x4')]));break;case 0x8:if(_0xe1ded0['role']!==_0x56a5('0x6'))_0x309fa5[_0x615d49](util[_0x56a5('0x1a')]('trunk:%s',_0x47c740[_0xe57293][_0x3017dd][_0x56a5('0x4')]));break;case 0x9:if(_0xe1ded0[_0x56a5('0x3')]!==_0x56a5('0x6'))_0x309fa5[_0x615d49](util[_0x56a5('0x1a')](_0x56a5('0x47'),_0x47c740[_0xe57293][_0x3017dd]['type'],_0x47c740[_0xe57293][_0x3017dd][_0x56a5('0x4')]));break;case 0xa:_0x309fa5[_0x615d49](util[_0x56a5('0x1a')](_0x56a5('0x1d'),_0x47c740[_0xe57293][_0x3017dd][_0x56a5('0x4')]));break;}}}}})[_0x56a5('0xb')](function(){if(_0x615d49==='leave'){var _0x22be73=_[_0x56a5('0x17')](_0xe1ded0['ChatInteractions'],'id');return _0xe1ded0[_0x56a5('0x48')](_0x22be73)[_0x56a5('0xb')](function(){for(var _0x1565c0=0x0;_0x1565c0<_0x22be73['length'];_0x1565c0+=0x1){_0x15d9f8[_0x56a5('0x49')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x22be73[_0x1565c0]),'UserId':Number(_0xe1ded0['id'])});}});}})[_0x56a5('0xb')](function(){if(_0x615d49==='leave'){var _0x12821e=_[_0x56a5('0x17')](_0xe1ded0[_0x56a5('0x25')],'id');return _0xe1ded0[_0x56a5('0x4a')](_0x12821e)['then'](function(){for(var _0x341116=0x0;_0x341116<_0x12821e['length'];_0x341116+=0x1){_0x15d9f8[_0x56a5('0x49')](_0x56a5('0x4b'),{'MailInteractionId':Number(_0x12821e[_0x341116]),'UserId':Number(_0xe1ded0['id'])});}});}})[_0x56a5('0xb')](function(){if(_0x615d49===_0x56a5('0x4c')){var _0x20988d=_[_0x56a5('0x17')](_0xe1ded0[_0x56a5('0x4d')],'id');return _0xe1ded0[_0x56a5('0x4e')](_0x20988d)[_0x56a5('0xb')](function(){for(var _0x76c6bb=0x0;_0x76c6bb<_0x20988d['length'];_0x76c6bb+=0x1){_0x15d9f8[_0x56a5('0x49')](_0x56a5('0x4f'),{'FaxInteractionId':Number(_0x20988d[_0x76c6bb]),'UserId':Number(_0xe1ded0['id'])});}});}})['then'](function(){if(_0x615d49===_0x56a5('0x4c')){var _0x5b9a2c=_[_0x56a5('0x17')](_0xe1ded0[_0x56a5('0x50')],'id');return _0xe1ded0[_0x56a5('0x51')](_0x5b9a2c)[_0x56a5('0xb')](function(){for(var _0xcc1218=0x0;_0xcc1218<_0x5b9a2c['length'];_0xcc1218+=0x1){_0x15d9f8[_0x56a5('0x49')](_0x56a5('0x52'),{'SmsInteractionId':Number(_0x5b9a2c[_0xcc1218]),'UserId':Number(_0xe1ded0['id'])});}});}})[_0x56a5('0xb')](function(){if(_0x615d49===_0x56a5('0x4c')){var _0x580f08=_['map'](_0xe1ded0[_0x56a5('0x29')],'id');return _0xe1ded0[_0x56a5('0x53')](_0x580f08)[_0x56a5('0xb')](function(){for(var _0xe5f854=0x0;_0xe5f854<_0x580f08[_0x56a5('0x41')];_0xe5f854+=0x1){_0x15d9f8[_0x56a5('0x49')](_0x56a5('0x54'),{'OpenchannelInteractionId':Number(_0x580f08[_0xe5f854]),'UserId':Number(_0xe1ded0['id'])});}});}})['then'](function(){if(_0x615d49===_0x56a5('0x4c')){var _0x3c9832=_[_0x56a5('0x17')](_0xe1ded0['WhatsappInteractions'],'id');return _0xe1ded0['removeWhatsappInteractions'](_0x3c9832)[_0x56a5('0xb')](function(){for(var _0x150bc3=0x0;_0x150bc3<_0x3c9832[_0x56a5('0x41')];_0x150bc3+=0x1){_0x15d9f8[_0x56a5('0x49')](_0x56a5('0x55'),{'WhatsappInteractionId':Number(_0x3c9832[_0x150bc3]),'UserId':Number(_0xe1ded0['id'])});}});}})[_0x56a5('0x56')](function(_0x3624b1){_0x309fa5['log'](_0x3624b1);});}}function onDisconnect(_0x405eac,_0xefb9a8){joinOrLeave(_0x405eac,_0x56a5('0x4c'),_0xefb9a8);}function onConnect(_0x4240e3){joinOrLeave(_0x4240e3,_0x56a5('0x57'));}exports[_0x56a5('0x58')]=function(_0x50b7d0){_0x50b7d0['on'](_0x56a5('0x59'),function(_0x13c8c1){_0x13c8c1[_0x56a5('0x5a')](0x0);_0x13c8c1[_0x56a5('0x5b')]=_0x13c8c1[_0x56a5('0x5c')][_0x56a5('0x59')]['remoteAddress']+':'+_0x13c8c1['request'][_0x56a5('0x59')][_0x56a5('0x5d')];_0x13c8c1[_0x56a5('0x5e')]=new Date();_0x13c8c1['log']=function(_0x3e243f){console[_0x56a5('0x5f')](_0x56a5('0x60')+_0x13c8c1[_0x56a5('0x61')][_0x56a5('0x4')]+'['+_0x13c8c1[_0x56a5('0x5b')]+']',_0x3e243f);};_0x13c8c1['on'](_0x56a5('0x62'),function(){onDisconnect(_0x13c8c1,_0x50b7d0);_0x13c8c1[_0x56a5('0x5f')]('DISCONNECTED');});onConnect(_0x13c8c1);_0x13c8c1[_0x56a5('0x5f')](_0x56a5('0x63'));});}; \ No newline at end of file +var _0x38f2=['lodash','util','bluebird','./environment','name','Agents','User','role','agent','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','telephone','Campaign','where','format','%s:queue:%s','user:%s','handshake','query','userProfileId','MailInteraction','MailInteractions','FaxInteraction','SmsInteraction','SmsInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','Trunk','user','SmsQueues','WhatsappQueue','Telephones','getChatQueues','getFaxQueues','getOpenchannelQueues','getWhatsappQueues','length','voice','chat','fax','sms','mail','whatsapp','telephone:%s','trunk:%s','emit','user_has_chat_interactions:remove','leave','removeMailInteractions','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address','request','remoteAddress','disconnect','DISCONNECTED'];(function(_0x5aefe9,_0x4db39b){var _0x44a56e=function(_0x2135a6){while(--_0x2135a6){_0x5aefe9['push'](_0x5aefe9['shift']());}};_0x44a56e(++_0x4db39b);}(_0x38f2,0xbe));var _0x238f=function(_0x56221,_0x25b740){_0x56221=_0x56221-0x0;var _0x2fe4de=_0x38f2[_0x56221];return _0x2fe4de;};'use strict';var _=require(_0x238f('0x0'));var util=require(_0x238f('0x1'));var BPromise=require(_0x238f('0x2'));var db=require('../mysqldb')['db'];var config=require(_0x238f('0x3'));var queryQueues={'attributes':['id',_0x238f('0x4')],'include':[{'as':_0x238f('0x5'),'model':db[_0x238f('0x6')],'attributes':['id',_0x238f('0x4'),_0x238f('0x7')],'raw':!![],'where':{'role':_0x238f('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x238f('0x4')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x238f('0x4')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x238f('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x238f('0x4'),_0x238f('0x9')],'where':{'type':_0x238f('0xa')}};function getAssociatedResources(_0x23d12a,_0x10d636,_0x1fa5c8){return db[_0x238f('0xb')][_0x238f('0xc')]({'where':{'name':_0x23d12a,'userProfileId':_0x10d636},'raw':!![]})[_0x238f('0xd')](function(_0x5e9005){if(_0x5e9005){if(_0x5e9005[_0x238f('0xe')]){switch(_0x23d12a){case _0x238f('0xf'):case _0x238f('0x10'):case _0x238f('0x11'):case'SmsQueues':case _0x238f('0x12'):case _0x238f('0x13'):case _0x238f('0x14'):return db[_0x1fa5c8][_0x238f('0x15')](queryQueues);case'Telephones':return db[_0x1fa5c8][_0x238f('0x15')](queryTelephones);case _0x238f('0x16'):return db[_0x1fa5c8]['findAll'](queryTrunks);case _0x238f('0x17'):return db[_0x1fa5c8][_0x238f('0x15')](queryCampaigns);}}else{return db[_0x238f('0x18')][_0x238f('0x15')]({'attributes':[_0x238f('0x19')],'where':{'sectionId':_0x5e9005['id']},'raw':!![]})[_0x238f('0xd')](function(_0x5492ea){if(_0x5492ea){var _0x11f65a={'where':{'id':_[_0x238f('0x1a')](_0x5492ea,_0x238f('0x19'))},'raw':!![]};switch(_0x1fa5c8){case'User':_0x11f65a['where'][_0x238f('0x7')]=_0x238f('0x1b');break;case _0x238f('0x1c'):_0x11f65a[_0x238f('0x1d')][_0x238f('0x9')]=_0x238f('0xa');break;}return db[_0x1fa5c8]['findAll'](_0x11f65a);}else{return[];}});}}else{return[];}})[_0x238f('0xd')](function(_0x3e4973){return _0x3e4973;});}function joinOrLeaveQueues(_0x5223f7,_0x642479,_0x5b166f,_0x1194b1){_0x5223f7[_0x642479](util[_0x238f('0x1e')](_0x238f('0x1f'),_0x5b166f,_0x1194b1['name']));if(_0x1194b1[_0x238f('0x5')]){for(var _0x4357cc=0x0;_0x4357cc<_0x1194b1['Agents']['length'];_0x4357cc+=0x1){_0x5223f7[_0x642479](util[_0x238f('0x1e')](_0x238f('0x20'),_0x1194b1['Agents'][_0x4357cc][_0x238f('0x4')]));}}}function joinOrLeave(_0x20c5fc,_0x2523eb,_0x16adfa){var _0x2a3a5b;if(_0x20c5fc[_0x238f('0x21')][_0x238f('0x22')]['id']){db[_0x238f('0x6')]['find']({'attributes':['id',_0x238f('0x4'),_0x238f('0x7'),_0x238f('0x23')],'where':{'id':_0x20c5fc[_0x238f('0x21')][_0x238f('0x22')]['id']},'include':[{'model':db['ChatInteraction'],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x238f('0x24')],'as':_0x238f('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x238f('0x26')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x238f('0x27')],'as':_0x238f('0x28'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x238f('0x29')],'as':_0x238f('0x2a'),'attributes':['id'],'raw':!![]}]})[_0x238f('0xd')](function(_0x5f0826){if(_0x5f0826){_0x2a3a5b=_0x5f0826;_0x20c5fc[_0x2523eb](util['format'](_0x238f('0x20'),_0x5f0826['name']));var _0x397e89=[];switch(_0x5f0826[_0x238f('0x7')]){case _0x238f('0x2b'):_0x20c5fc[_0x2523eb](_0x238f('0x2c'));_0x20c5fc[_0x2523eb](_0x238f('0x2d'));if(queryQueues[_0x238f('0x2e')](_0x238f('0x2f'))){delete queryQueues[_0x238f('0x2f')];}_0x397e89[_0x238f('0x30')](db[_0x238f('0x31')]['findAll'](queryQueues));_0x397e89[_0x238f('0x30')](db[_0x238f('0x32')]['findAll'](queryQueues));_0x397e89['push'](db[_0x238f('0x33')]['findAll'](queryQueues));_0x397e89['push'](db[_0x238f('0x34')][_0x238f('0x15')](queryQueues));_0x397e89['push'](db[_0x238f('0x35')]['findAll'](queryQueues));_0x397e89[_0x238f('0x30')](db['OpenchannelQueue']['findAll'](queryQueues));_0x397e89[_0x238f('0x30')](db['WhatsappQueue'][_0x238f('0x15')](queryQueues));_0x397e89[_0x238f('0x30')](db[_0x238f('0x6')][_0x238f('0x15')](queryTelephones));_0x397e89[_0x238f('0x30')](db[_0x238f('0x36')][_0x238f('0x15')](queryTrunks));_0x397e89[_0x238f('0x30')](db[_0x238f('0x1c')][_0x238f('0x15')](queryCampaigns));_0x397e89[_0x238f('0x30')](db[_0x238f('0x6')][_0x238f('0x15')](queryAgents));break;case _0x238f('0x37'):_0x20c5fc[_0x2523eb](_0x238f('0x2c'));_0x20c5fc[_0x2523eb](_0x238f('0x2d'));_0x397e89[_0x238f('0x30')](getAssociatedResources('VoiceQueues',_0x5f0826[_0x238f('0x23')],_0x238f('0x31')));_0x397e89[_0x238f('0x30')](getAssociatedResources(_0x238f('0x10'),_0x5f0826['userProfileId'],_0x238f('0x32')));_0x397e89[_0x238f('0x30')](getAssociatedResources('FaxQueues',_0x5f0826[_0x238f('0x23')],_0x238f('0x33')));_0x397e89[_0x238f('0x30')](getAssociatedResources(_0x238f('0x38'),_0x5f0826['userProfileId'],_0x238f('0x34')));_0x397e89['push'](getAssociatedResources('MailQueues',_0x5f0826[_0x238f('0x23')],_0x238f('0x35')));_0x397e89[_0x238f('0x30')](getAssociatedResources(_0x238f('0x13'),_0x5f0826[_0x238f('0x23')],'OpenchannelQueue'));_0x397e89[_0x238f('0x30')](getAssociatedResources(_0x238f('0x14'),_0x5f0826['userProfileId'],_0x238f('0x39')));_0x397e89[_0x238f('0x30')](getAssociatedResources(_0x238f('0x3a'),_0x5f0826[_0x238f('0x23')],'User'));_0x397e89[_0x238f('0x30')](getAssociatedResources('Trunks',_0x5f0826[_0x238f('0x23')],'Trunk'));_0x397e89[_0x238f('0x30')](getAssociatedResources(_0x238f('0x17'),_0x5f0826[_0x238f('0x23')],_0x238f('0x1c')));_0x397e89['push'](db[_0x238f('0x6')]['findAll'](queryAgents));break;case _0x238f('0x8'):_0x20c5fc[_0x2523eb](_0x238f('0x2c'));_0x20c5fc[_0x2523eb]('voice:outbound');_0x397e89[_0x238f('0x30')](_0x5f0826['getVoiceQueues']({'attributes':['id',_0x238f('0x4')]}));_0x397e89[_0x238f('0x30')](_0x5f0826[_0x238f('0x3b')]({'attributes':['id','name']}));_0x397e89[_0x238f('0x30')](_0x5f0826[_0x238f('0x3c')]({'attributes':['id',_0x238f('0x4')]}));_0x397e89['push'](_0x5f0826['getSmsQueues']({'attributes':['id',_0x238f('0x4')]}));_0x397e89[_0x238f('0x30')](_0x5f0826['getMailQueues']({'attributes':['id',_0x238f('0x4')]}));_0x397e89[_0x238f('0x30')](_0x5f0826[_0x238f('0x3d')]({'attributes':['id',_0x238f('0x4')]}));_0x397e89[_0x238f('0x30')](_0x5f0826[_0x238f('0x3e')]({'attributes':['id','name']}));break;}return BPromise['all'](_0x397e89);}})['then'](function(_0x53b9e6){if(_0x53b9e6&&_0x53b9e6[_0x238f('0x3f')]){for(var _0x395e6f=0x0;_0x395e6f<_0x53b9e6['length'];_0x395e6f+=0x1){for(var _0x33799f=0x0;_0x33799f<_0x53b9e6[_0x395e6f]['length'];_0x33799f+=0x1){switch(_0x395e6f){case 0x0:joinOrLeaveQueues(_0x20c5fc,_0x2523eb,_0x238f('0x40'),_0x53b9e6[_0x395e6f][_0x33799f]);break;case 0x1:joinOrLeaveQueues(_0x20c5fc,_0x2523eb,_0x238f('0x41'),_0x53b9e6[_0x395e6f][_0x33799f]);break;case 0x2:joinOrLeaveQueues(_0x20c5fc,_0x2523eb,_0x238f('0x42'),_0x53b9e6[_0x395e6f][_0x33799f]);break;case 0x3:joinOrLeaveQueues(_0x20c5fc,_0x2523eb,_0x238f('0x43'),_0x53b9e6[_0x395e6f][_0x33799f]);break;case 0x4:joinOrLeaveQueues(_0x20c5fc,_0x2523eb,_0x238f('0x44'),_0x53b9e6[_0x395e6f][_0x33799f]);break;case 0x5:joinOrLeaveQueues(_0x20c5fc,_0x2523eb,'openchannel',_0x53b9e6[_0x395e6f][_0x33799f]);break;case 0x6:joinOrLeaveQueues(_0x20c5fc,_0x2523eb,_0x238f('0x45'),_0x53b9e6[_0x395e6f][_0x33799f]);break;case 0x7:if(_0x2a3a5b['role']!==_0x238f('0x8'))_0x20c5fc[_0x2523eb](util[_0x238f('0x1e')](_0x238f('0x46'),_0x53b9e6[_0x395e6f][_0x33799f][_0x238f('0x4')]));break;case 0x8:if(_0x2a3a5b['role']!=='agent')_0x20c5fc[_0x2523eb](util['format'](_0x238f('0x47'),_0x53b9e6[_0x395e6f][_0x33799f][_0x238f('0x4')]));break;case 0x9:if(_0x2a3a5b['role']!==_0x238f('0x8'))_0x20c5fc[_0x2523eb](util['format']('campaign:%s:%s',_0x53b9e6[_0x395e6f][_0x33799f]['type'],_0x53b9e6[_0x395e6f][_0x33799f][_0x238f('0x4')]));break;case 0xa:_0x20c5fc[_0x2523eb](util['format']('user:%s',_0x53b9e6[_0x395e6f][_0x33799f][_0x238f('0x4')]));break;}}}}})['then'](function(){if(_0x2523eb==='leave'){var _0x18d92f=_[_0x238f('0x1a')](_0x2a3a5b['ChatInteractions'],'id');return _0x2a3a5b['removeChatInteractions'](_0x18d92f)['then'](function(){for(var _0x3cc6f0=0x0;_0x3cc6f0<_0x18d92f[_0x238f('0x3f')];_0x3cc6f0+=0x1){_0x16adfa[_0x238f('0x48')](_0x238f('0x49'),{'ChatInteractionId':Number(_0x18d92f[_0x3cc6f0]),'UserId':Number(_0x2a3a5b['id'])});}});}})[_0x238f('0xd')](function(){if(_0x2523eb===_0x238f('0x4a')){var _0x30f5e6=_[_0x238f('0x1a')](_0x2a3a5b[_0x238f('0x25')],'id');return _0x2a3a5b[_0x238f('0x4b')](_0x30f5e6)[_0x238f('0xd')](function(){for(var _0x5f19f2=0x0;_0x5f19f2<_0x30f5e6[_0x238f('0x3f')];_0x5f19f2+=0x1){_0x16adfa['emit']('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x30f5e6[_0x5f19f2]),'UserId':Number(_0x2a3a5b['id'])});}});}})[_0x238f('0xd')](function(){if(_0x2523eb==='leave'){var _0x185f9e=_[_0x238f('0x1a')](_0x2a3a5b[_0x238f('0x4c')],'id');return _0x2a3a5b[_0x238f('0x4d')](_0x185f9e)['then'](function(){for(var _0x45744a=0x0;_0x45744a<_0x185f9e[_0x238f('0x3f')];_0x45744a+=0x1){_0x16adfa[_0x238f('0x48')](_0x238f('0x4e'),{'FaxInteractionId':Number(_0x185f9e[_0x45744a]),'UserId':Number(_0x2a3a5b['id'])});}});}})['then'](function(){if(_0x2523eb==='leave'){var _0x441d60=_[_0x238f('0x1a')](_0x2a3a5b[_0x238f('0x28')],'id');return _0x2a3a5b[_0x238f('0x4f')](_0x441d60)[_0x238f('0xd')](function(){for(var _0x71efae=0x0;_0x71efae<_0x441d60[_0x238f('0x3f')];_0x71efae+=0x1){_0x16adfa['emit'](_0x238f('0x50'),{'SmsInteractionId':Number(_0x441d60[_0x71efae]),'UserId':Number(_0x2a3a5b['id'])});}});}})['then'](function(){if(_0x2523eb==='leave'){var _0x30f091=_['map'](_0x2a3a5b['OpenchannelInteractions'],'id');return _0x2a3a5b[_0x238f('0x51')](_0x30f091)[_0x238f('0xd')](function(){for(var _0x5f3898=0x0;_0x5f3898<_0x30f091[_0x238f('0x3f')];_0x5f3898+=0x1){_0x16adfa['emit']('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x30f091[_0x5f3898]),'UserId':Number(_0x2a3a5b['id'])});}});}})[_0x238f('0xd')](function(){if(_0x2523eb===_0x238f('0x4a')){var _0x5bf85c=_[_0x238f('0x1a')](_0x2a3a5b[_0x238f('0x2a')],'id');return _0x2a3a5b[_0x238f('0x52')](_0x5bf85c)[_0x238f('0xd')](function(){for(var _0xbd3f5c=0x0;_0xbd3f5c<_0x5bf85c[_0x238f('0x3f')];_0xbd3f5c+=0x1){_0x16adfa[_0x238f('0x48')](_0x238f('0x53'),{'WhatsappInteractionId':Number(_0x5bf85c[_0xbd3f5c]),'UserId':Number(_0x2a3a5b['id'])});}});}})[_0x238f('0x54')](function(_0x596981){_0x20c5fc[_0x238f('0x55')](_0x596981);});}}function onDisconnect(_0x76a5b8,_0x2ca62b){joinOrLeave(_0x76a5b8,_0x238f('0x4a'),_0x2ca62b);}function onConnect(_0x2ee34e){joinOrLeave(_0x2ee34e,_0x238f('0x56'));}exports[_0x238f('0x57')]=function(_0x4c5e56){_0x4c5e56['on'](_0x238f('0x58'),function(_0x545124){_0x545124[_0x238f('0x59')](0x0);_0x545124[_0x238f('0x5a')]=_0x545124[_0x238f('0x5b')]['connection'][_0x238f('0x5c')]+':'+_0x545124[_0x238f('0x5b')][_0x238f('0x58')]['remotePort'];_0x545124['connectedAt']=new Date();_0x545124[_0x238f('0x55')]=function(_0x3916d4){console[_0x238f('0x55')]('SocketIO\x20'+_0x545124['nsp'][_0x238f('0x4')]+'['+_0x545124[_0x238f('0x5a')]+']',_0x3916d4);};_0x545124['on'](_0x238f('0x5d'),function(){onDisconnect(_0x545124,_0x4c5e56);_0x545124[_0x238f('0x55')](_0x238f('0x5e'));});onConnect(_0x545124);_0x545124[_0x238f('0x55')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 65048fb..f3746ec 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 _0xcb6b=['../logger','triggers','lodash','client','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','ChatMessage','newmessage','SmsInteraction','Sms','closedinteraction','SmsMessage','Whatsapp','WhatsappInteraction','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','OpenchannelInteraction','Openchannel','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','catch','get','channel','motionChannel','event','direction','ContactId','sequelize','query','Sequelize','QueryTypes','contact','UserId','User','find','name','fullname','email','internal','interface','format','SIP/%s','agent','incomingmessage','outgoingmessage','opened','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','SELECT','closed','changed','substatus','length','hasOwnProperty','model','hook','toLowerCase','condition','util','../../mysqldb'];(function(_0x135573,_0x479526){var _0x13ea56=function(_0x49c990){while(--_0x49c990){_0x135573['push'](_0x135573['shift']());}};_0x13ea56(++_0x479526);}(_0xcb6b,0x11e));var _0xbcb6=function(_0x515a8d,_0x82b8e){_0x515a8d=_0x515a8d-0x0;var _0x5eddc5=_0xcb6b[_0x515a8d];return _0x5eddc5;};'use strict';var util=require(_0xbcb6('0x0'));var db=require(_0xbcb6('0x1'))['db'];var jayson=require('jayson/promise');var logger=require(_0xbcb6('0x2'))(_0xbcb6('0x3'));var _=require(_0xbcb6('0x4'));var client=jayson[_0xbcb6('0x5')][_0xbcb6('0x6')]({'port':0x232a});var triggers=[{'channel':_0xbcb6('0x7'),'model':_0xbcb6('0x8'),'event':_0xbcb6('0x9'),'condition':_0xbcb6('0xa'),'callback':afterCreate},{'channel':_0xbcb6('0x7'),'model':_0xbcb6('0x8'),'event':_0xbcb6('0xb'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xbcb6('0x7'),'model':_0xbcb6('0xc'),'event':_0xbcb6('0x9'),'condition':_0xbcb6('0xd'),'callback':afterCreateMessage},{'channel':'Sms','model':_0xbcb6('0xe'),'event':_0xbcb6('0x9'),'condition':_0xbcb6('0xa'),'callback':afterCreate},{'channel':_0xbcb6('0xf'),'model':_0xbcb6('0xe'),'event':_0xbcb6('0xb'),'condition':_0xbcb6('0x10'),'callback':afterUpdate},{'channel':_0xbcb6('0xf'),'model':_0xbcb6('0x11'),'event':_0xbcb6('0x9'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xbcb6('0x12'),'model':_0xbcb6('0x13'),'event':_0xbcb6('0x9'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xbcb6('0x12'),'model':_0xbcb6('0x13'),'event':_0xbcb6('0xb'),'condition':_0xbcb6('0x10'),'callback':afterUpdate},{'channel':_0xbcb6('0x12'),'model':'WhatsappMessage','event':_0xbcb6('0x9'),'condition':_0xbcb6('0xd'),'callback':afterCreateMessage},{'channel':_0xbcb6('0x14'),'model':_0xbcb6('0x15'),'event':_0xbcb6('0x9'),'condition':_0xbcb6('0xa'),'callback':afterCreate},{'channel':_0xbcb6('0x14'),'model':_0xbcb6('0x15'),'event':_0xbcb6('0xb'),'condition':_0xbcb6('0x10'),'callback':afterUpdate},{'channel':_0xbcb6('0x14'),'model':_0xbcb6('0x16'),'event':_0xbcb6('0x9'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xbcb6('0x17'),'model':'MailInteraction','event':_0xbcb6('0x9'),'condition':_0xbcb6('0xa'),'callback':afterCreate},{'channel':_0xbcb6('0x17'),'model':_0xbcb6('0x18'),'event':_0xbcb6('0xb'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xbcb6('0x17'),'model':_0xbcb6('0x19'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':'Openchannel','model':_0xbcb6('0x1a'),'event':'afterCreate','condition':_0xbcb6('0xa'),'callback':afterCreate},{'channel':'Openchannel','model':_0xbcb6('0x1a'),'event':_0xbcb6('0xb'),'condition':_0xbcb6('0x10'),'callback':afterUpdate},{'channel':_0xbcb6('0x1b'),'model':_0xbcb6('0x1c'),'event':'afterCreate','condition':_0xbcb6('0xd'),'callback':afterCreateMessage}];function request(_0x52c01c){return client[_0xbcb6('0x1d')](_0xbcb6('0x1e'),_0x52c01c)[_0xbcb6('0x1f')](function(_0x462a4b){logger[_0xbcb6('0x20')](_0xbcb6('0x21'),_0xbcb6('0x1e'),_0x462a4b);if(_0x462a4b['error']){if(_0x462a4b[_0xbcb6('0x22')]['code']===0x1f4){logger['error']('Trigger,\x20%s',_0xbcb6('0x1e'),_0x462a4b[_0xbcb6('0x22')]);}}})[_0xbcb6('0x23')](function(_0x1c9bfb){logger[_0xbcb6('0x22')]('Trigger,\x20%s',_0xbcb6('0x1e'),_0x1c9bfb);});}function afterCreateMessage(_0x4ca15e,_0xc5bf6d){return function(_0x156b4e,_0x5b27e9){_0x156b4e=_0x156b4e[_0xbcb6('0x24')]({'plain':!![]});_0x156b4e[_0xbcb6('0x25')]=_0x4ca15e;_0x156b4e[_0xbcb6('0x26')]=_0x4ca15e;_0x156b4e[_0xbcb6('0x27')]=_0x156b4e[_0xbcb6('0x28')];var _0x16caa4='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x156b4e[_0xbcb6('0x29')];return db[_0xbcb6('0x2a')][_0xbcb6('0x2b')](_0x16caa4,{'type':db[_0xbcb6('0x2c')][_0xbcb6('0x2d')]['SELECT'],'raw':!![]})[_0xbcb6('0x1f')](function(_0x2324d3){return _0x2324d3;})['then'](function(_0x46ea70){if(_0x46ea70){_0x156b4e[_0xbcb6('0x2e')]=_0x46ea70[0x0];}if(_0x156b4e[_0xbcb6('0x2f')]){return db[_0xbcb6('0x30')][_0xbcb6('0x31')]({'where':{'id':_0x156b4e[_0xbcb6('0x2f')]},'attributes':['id',_0xbcb6('0x32'),_0xbcb6('0x33'),_0xbcb6('0x34'),_0xbcb6('0x35')],'raw':!![]})[_0xbcb6('0x1f')](function(_0x571835){_0x156b4e[_0xbcb6('0x36')]=util[_0xbcb6('0x37')](_0xbcb6('0x38'),_0x571835['name']);_0x156b4e[_0xbcb6('0x25')]=_0x4ca15e;_0x156b4e[_0xbcb6('0x39')]=_0x571835;return request({'event':_0xbcb6('0x3a'),'message':_0x156b4e});})[_0xbcb6('0x23')](function(_0x506159){console['error'](_0x506159);});}else{return request({'event':_0xbcb6('0x3b'),'message':_0x156b4e});}});};}function afterCreate(_0xc3b4b6,_0xcd2ddc){return function(_0x2a84ce,_0x20016b){_0x2a84ce=_0x2a84ce[_0xbcb6('0x24')]({'plain':!![]});_0x2a84ce[_0xbcb6('0x25')]=_0xc3b4b6;_0x2a84ce[_0xbcb6('0x26')]=_0xc3b4b6;_0x2a84ce['event']=_0xbcb6('0x3c');var _0x530e14=_0xbcb6('0x3d')+_0x2a84ce[_0xbcb6('0x29')];return db[_0xbcb6('0x2a')][_0xbcb6('0x2b')](_0x530e14,{'type':db[_0xbcb6('0x2c')][_0xbcb6('0x2d')][_0xbcb6('0x3e')],'raw':!![]})[_0xbcb6('0x1f')](function(_0x24533f){return _0x24533f;})[_0xbcb6('0x1f')](function(_0x420544){if(_0x420544){_0x2a84ce['contact']=_0x420544[0x0];}return request({'event':_0xcd2ddc,'message':_0x2a84ce});});};}function afterUpdate(_0x3d4a99){return function(_0x1b9a2f){var _0x2d906d=_0x1b9a2f['changed'](_0xbcb6('0x3f'))&&_0x1b9a2f[_0xbcb6('0x3f')];var _0x25b7a5=_0x1b9a2f[_0xbcb6('0x40')](_0xbcb6('0x41'));if(_0x2d906d||_0x25b7a5){var _0x24162b=_0x2d906d?_0xbcb6('0x10'):'substatus';var _0xfe2278=_0x1b9a2f['get']({'plain':!![]});_0xfe2278[_0xbcb6('0x25')]=_0x3d4a99;_0xfe2278[_0xbcb6('0x26')]=_0x3d4a99;_0xfe2278[_0xbcb6('0x27')]=_0x2d906d?_0xbcb6('0x3f'):_0xbcb6('0x41');var _0x21074f=_0xbcb6('0x3d')+_0xfe2278['ContactId'];return db['sequelize'][_0xbcb6('0x2b')](_0x21074f,{'type':db[_0xbcb6('0x2c')]['QueryTypes'][_0xbcb6('0x3e')],'raw':!![]})[_0xbcb6('0x1f')](function(_0x57bca9){if(_0x57bca9){_0xfe2278['contact']=_0x57bca9[0x0];}if(_0xfe2278['UserId']){return db[_0xbcb6('0x30')][_0xbcb6('0x31')]({'where':{'id':_0xfe2278[_0xbcb6('0x2f')]},'attributes':['id',_0xbcb6('0x32'),_0xbcb6('0x33'),_0xbcb6('0x34'),_0xbcb6('0x35')],'raw':!![]})[_0xbcb6('0x1f')](function(_0x5cc94b){_0xfe2278[_0xbcb6('0x36')]=util['format'](_0xbcb6('0x38'),_0x5cc94b[_0xbcb6('0x32')]);_0xfe2278[_0xbcb6('0x39')]=_0x5cc94b;return request({'event':_0x24162b,'message':_0xfe2278});})[_0xbcb6('0x23')](function(_0x50f631){console[_0xbcb6('0x22')](_0x50f631);});}else{return request({'event':_0x24162b,'message':_0xfe2278});}});}};}exports['default']=function(){for(var _0x480704=0x0;_0x480704=_0x3f01a6[_0x4f00('0x15')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x5d149e(_0x1854f3);})[_0x4f00('0x16')](function(_0x6747b3){_0x2ead22(_0x6747b3);});});}; \ No newline at end of file +var _0x3dac=['count','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','../mysqldb','./license/util','mail','chat','fax','sms','whatsapp','includes','isUndefined','updateAttributes','getLicense','role','agent','User'];(function(_0x59eedc,_0x222129){var _0x49b8ad=function(_0x34b8cf){while(--_0x34b8cf){_0x59eedc['push'](_0x59eedc['shift']());}};_0x49b8ad(++_0x222129);}(_0x3dac,0xdb));var _0xc3da=function(_0x1752ec,_0x1215bb){_0x1752ec=_0x1752ec-0x0;var _0x426de8=_0x3dac[_0x1752ec];return _0x426de8;};'use strict';var _=require(_0xc3da('0x0'));var BPromise=require('bluebird');var db=require(_0xc3da('0x1'))['db'];var util=require(_0xc3da('0x2'));var channels=['voice',_0xc3da('0x3'),_0xc3da('0x4'),_0xc3da('0x5'),_0xc3da('0x6'),_0xc3da('0x7'),'openchannel'];exports['getChannels']=function(){return channels;};exports['isValidChannel']=function(_0x26eb6b){_0x26eb6b=_0x26eb6b['toLowerCase']();return _[_0xc3da('0x8')](channels,_0x26eb6b);};exports['clearBlockUser']=function(_0x2817c2,_0x592c92,_0x5377c6,_0x405de9){var _0x24e182={'loginAttempts':_0x592c92,'blocked':_0x5377c6};if(!_[_0xc3da('0x9')](_0x405de9)){_0x24e182['blockedAt']=_0x405de9;}return _0x2817c2[_0xc3da('0xa')](_0x24e182);};exports[_0xc3da('0xb')]=function(_0x303aeb){return new BPromise(function(_0x4194e8,_0x242729){var _0x4dad6f=0x0;if(_0x303aeb[_0xc3da('0xc')]!==_0xc3da('0xd')){_0x4194e8(_0x303aeb);}db[_0xc3da('0xe')][_0xc3da('0xf')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x303aeb['id']}}})['then'](function(_0x3c06da){_0x4dad6f=_0x3c06da;return util[_0xc3da('0xb')]();})['then'](function(_0x1adc93){if(_0x1adc93&&_0x1adc93['agents']&&_0x4dad6f>=_0x1adc93['agents']){throw Error(_0xc3da('0x10'));}_0x4194e8(_0x303aeb);})[_0xc3da('0x11')](function(_0x5508ea){_0x242729(_0x5508ea);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 9be4c79..d3ab447 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7d6e=['json','send','404','status'];(function(_0x26cb2e,_0x13e37a){var _0x14f042=function(_0x4cdad8){while(--_0x4cdad8){_0x26cb2e['push'](_0x26cb2e['shift']());}};_0x14f042(++_0x13e37a);}(_0x7d6e,0x76));var _0xe7d6=function(_0x45bcb1,_0x46cad0){_0x45bcb1=_0x45bcb1-0x0;var _0x4bd6a3=_0x7d6e[_0x45bcb1];return _0x4bd6a3;};'use strict';module['exports'][0x194]=function pageNotFound(_0x555ed0,_0x1c3709){var _0x498923=_0xe7d6('0x0');var _0x2ea07f=0x194;var _0x3d76ab={'status':_0x2ea07f};_0x1c3709[_0xe7d6('0x1')](_0x3d76ab['status']);_0x1c3709['render'](_0x498923,{},function(_0x4aeecd,_0x599299){if(_0x4aeecd){return _0x1c3709[_0xe7d6('0x1')](_0x3d76ab['status'])[_0xe7d6('0x2')](_0x3d76ab);}_0x1c3709[_0xe7d6('0x3')](_0x599299);});}; \ No newline at end of file +var _0x1e1a=['render','send','exports','status'];(function(_0x3cd628,_0x24a6a7){var _0x3508c1=function(_0x4d5417){while(--_0x4d5417){_0x3cd628['push'](_0x3cd628['shift']());}};_0x3508c1(++_0x24a6a7);}(_0x1e1a,0x86));var _0xa1e1=function(_0x67ca3c,_0xe216f3){_0x67ca3c=_0x67ca3c-0x0;var _0x5124df=_0x1e1a[_0x67ca3c];return _0x5124df;};'use strict';module[_0xa1e1('0x0')][0x194]=function pageNotFound(_0x3c73ec,_0x957b96){var _0x344789='404';var _0x742550=0x194;var _0x158f1c={'status':_0x742550};_0x957b96[_0xa1e1('0x1')](_0x158f1c['status']);_0x957b96[_0xa1e1('0x2')](_0x344789,{},function(_0x571c8c,_0x29beb1){if(_0x571c8c){return _0x957b96['status'](_0x158f1c[_0xa1e1('0x1')])['json'](_0x158f1c);}_0x957b96[_0xa1e1('0x3')](_0x29beb1);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 3443fdd..a1dbf7e 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4eb=['CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','cascade','UserId','Recordings','hasMany','VoiceQueuesRt','CmHopperFinal','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','FaxInteractions','WhatsappInteractions','UserNotification','belongsTo','userProfileId','belongsToMany','ChatGroup','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','CmList','Lists','cm_user_has_lists','user_has_teams','MailInteractions','user_has_chat_interactions','user_has_fax_interactions','SmsInteraction','user_has_sms_interactions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','VoicePrefixes','MailQueues','ChatQueues','SmsQueues','OpenchannelQueue','OpenchannelQueues','WhatsappQueues','UserWhatsappQueue','ChatWebsites','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccount','SquareProjects','SpiedAgents','ChanSpyId','VoiceExtension','VoiceMusicOnHold','Sound','Sounds','moh_has_sounds','Members','VoiceQueueId','CmHopper','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','voice_queues_has_cm_lists','Agents','Teams','voice_queues_has_cm_blacklists','VoiceMail','Messages','mailboxuser','mailbox','VoiceQueueReport','uniqueid','AgentReports','MailAccountId','Imap','Smtp','Dispositions','CannedAnswer','Answers','Interactions','Applications','List','ListId','TemplateId','mandatoryDispositionPauseId','Team','team_has_mail_queues','MailInteractionId','Account','Contact','ContactId','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','user_has_mail_interactions','Attachment','Attachments','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','restrict','Tag','TagId','Items','FaxAccountId','Exntensions','FaxQueue','fax_interaction_has_tags','FaxInteractionId','AttachmentId','SmsAccountId','SmsInteractionId','SmsQueueId','OpenchannelAccountId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','OpenchannelMessage','Interaction','OpenchannelQueueId','ChatProactiveAction','ProactiveActions','ChatApplication','ChatMessage','Agent','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','Hoppers','Company','CompanyId','cm_contact_has_tags','Queue','CampaignId','OwnerId','OneAll','Any','AutomationAnyId','Actions','ParentId','ChatApplications','FaxApplications','DefaultReportId','Mohs','sms_interaction_has_tags','whatsapp_interaction_has_tags','AllCondition','TriggerAnyId','TriggerId','AnalyticFieldReport','Fields','AnalyticDefaultReport','AnalyticMetric','MetricId','SalesforceConfiguration','Configurations','AccountId','SalesforceField','Subjects','SubjectId','DescriptionId','Subject','Description','Descriptions','FieldId','Field','VariableId','DeskConfiguration','int_desk_configuration_has_tags','ZendeskField','int_zendesk_configuration_has_tags','FromId','ToId','user_has_square_projects','team_has_sms_queues','team_has_openchannel_queues','team_has_whatsapp_queues','SquareProjectId','BlackLists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','FromChatWebsiteId','ToChatQueueId','ToQueue','ToChatWebsiteId','ToAccount','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsAccountId','CustomFields','Queues','Extensions','UserProfileSections','UserProfileResource','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappQueueReport','WhatsappTransferReport','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','../config/environment','sequelize','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8_general_ci','sequelizeHistory','database','options','username','User','../api/user/user.model','VoiceChanSpy','import','VoiceContext','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserChatQueue','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/sound/sound.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareMessage','../api/team/team.model','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue'];(function(_0x3db83a,_0x1fc6e7){var _0x1f774d=function(_0x3d8e22){while(--_0x3d8e22){_0x3db83a['push'](_0x3db83a['shift']());}};_0x1f774d(++_0x1fc6e7);}(_0xf4eb,0xec));var _0xbf4e=function(_0x13a495,_0x30389b){_0x13a495=_0x13a495-0x0;var _0x527c05=_0xf4eb[_0x13a495];return _0x527c05;};'use strict';var config=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');var _=require('lodash');var jstz=require('jstz');var timezone=jstz['determine']();config[_0xbf4e('0x1')]=_['defaultsDeep'](config['sequelize'],{'database':_0xbf4e('0x2'),'username':_0xbf4e('0x3'),'password':_0xbf4e('0x4'),'options':{'host':_0xbf4e('0x5'),'port':0xcea,'dialect':_0xbf4e('0x6'),'dialectOptions':{'charset':_0xbf4e('0x7')},'logging':![],'timezone':timezone[_0xbf4e('0x8')](),'define':{'charset':'utf8','collate':_0xbf4e('0x9')}}});config['sequelizeHistory']=_['defaultsDeep'](config[_0xbf4e('0xa')],{'database':_0xbf4e('0x2'),'username':_0xbf4e('0x3'),'password':_0xbf4e('0x4'),'options':{'host':_0xbf4e('0x5'),'port':0xcea,'dialect':_0xbf4e('0x6'),'dialectOptions':{'charset':_0xbf4e('0x7')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0xbf4e('0x9')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0xbf4e('0xb')],config[_0xbf4e('0x1')]['username'],config[_0xbf4e('0x1')]['password'],config['sequelize'][_0xbf4e('0xc')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xbf4e('0xa')][_0xbf4e('0xb')],config[_0xbf4e('0xa')][_0xbf4e('0xd')],config[_0xbf4e('0xa')]['password'],config['sequelizeHistory'][_0xbf4e('0xc')])};db[_0xbf4e('0xe')]=db[_0xbf4e('0x1')]['import'](_0xbf4e('0xf'));db[_0xbf4e('0x10')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0xbf4e('0x12')]=db['sequelize']['import']('../api/voiceContext/voiceContext.model');db['VoiceExtension']=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x13'));db['VoiceMusicOnHold']=db['sequelize'][_0xbf4e('0x11')](_0xbf4e('0x14'));db[_0xbf4e('0x15')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x16'));db[_0xbf4e('0x17')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x18'));db[_0xbf4e('0x19')]=db['sequelize'][_0xbf4e('0x11')](_0xbf4e('0x1a'));db['VoiceMail']=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x1b'));db[_0xbf4e('0x1c')]=db[_0xbf4e('0x1')]['import'](_0xbf4e('0x1d'));db[_0xbf4e('0x1e')]=db[_0xbf4e('0x1')]['import'](_0xbf4e('0x1f'));db['VoiceDialReport']=db['sequelize'][_0xbf4e('0x11')]('../api/voiceDialReport/voiceDialReport.model');db[_0xbf4e('0x20')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x21'));db['VoiceQueueReport']=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x22'));db['MemberReport']=db[_0xbf4e('0x1')]['import'](_0xbf4e('0x23'));db[_0xbf4e('0x24')]=db[_0xbf4e('0x1')]['import'](_0xbf4e('0x25'));db[_0xbf4e('0x26')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x27'));db[_0xbf4e('0x28')]=db['sequelize'][_0xbf4e('0x11')](_0xbf4e('0x29'));db['UserVoiceQueue']=db[_0xbf4e('0x1')][_0xbf4e('0x11')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0xbf4e('0x2a')]=db['sequelize'][_0xbf4e('0x11')]('../api/userChatQueue/userChatQueue.model');db[_0xbf4e('0x2b')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')]('../api/userMailQueue/userMailQueue.model');db[_0xbf4e('0x2c')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x2d'));db[_0xbf4e('0x2e')]=db[_0xbf4e('0x1')]['import'](_0xbf4e('0x2f'));db[_0xbf4e('0x30')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x31'));db['UserWhatsappQueue']=db['sequelize']['import']('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0xbf4e('0x32')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x33'));db[_0xbf4e('0x34')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x35'));db[_0xbf4e('0x36')]=db['sequelize']['import'](_0xbf4e('0x37'));db[_0xbf4e('0x38')]=db[_0xbf4e('0x1')]['import'](_0xbf4e('0x39'));db['MailSubstatus']=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x3a'));db[_0xbf4e('0x3b')]=db['sequelize'][_0xbf4e('0x11')](_0xbf4e('0x3c'));db[_0xbf4e('0x3d')]=db[_0xbf4e('0x1')]['import'](_0xbf4e('0x3e'));db[_0xbf4e('0x3f')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x40'));db[_0xbf4e('0x41')]=db[_0xbf4e('0x1')]['import'](_0xbf4e('0x42'));db[_0xbf4e('0x43')]=db['sequelize']['import'](_0xbf4e('0x44'));db[_0xbf4e('0x45')]=db['sequelize']['import'](_0xbf4e('0x46'));db[_0xbf4e('0x47')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x48'));db[_0xbf4e('0x49')]=db['sequelize'][_0xbf4e('0x11')](_0xbf4e('0x4a'));db['FaxInteraction']=db['sequelize']['import']('../api/faxInteraction/faxInteraction.model');db[_0xbf4e('0x4b')]=db['sequelize'][_0xbf4e('0x11')](_0xbf4e('0x4c'));db['FaxQueue']=db['sequelize'][_0xbf4e('0x11')](_0xbf4e('0x4d'));db[_0xbf4e('0x4e')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')]('../api/faxQueueReport/faxQueueReport.model');db[_0xbf4e('0x4f')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x50'));db[_0xbf4e('0x51')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x52'));db['SmsInteraction']=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x53'));db[_0xbf4e('0x54')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x55'));db[_0xbf4e('0x56')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x57'));db[_0xbf4e('0x58')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x59'));db[_0xbf4e('0x5a')]=db[_0xbf4e('0x1')]['import'](_0xbf4e('0x5b'));db[_0xbf4e('0x5c')]=db[_0xbf4e('0x1')]['import'](_0xbf4e('0x5d'));db['OpenchannelMessage']=db['sequelize'][_0xbf4e('0x11')](_0xbf4e('0x5e'));db['OpenchannelQueue']=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x5f'));db[_0xbf4e('0x60')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x61'));db[_0xbf4e('0x62')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x63'));db['ChatApplication']=db['sequelize'][_0xbf4e('0x11')](_0xbf4e('0x64'));db[_0xbf4e('0x65')]=db['sequelize'][_0xbf4e('0x11')](_0xbf4e('0x66'));db['ChatMessage']=db['sequelize'][_0xbf4e('0x11')]('../api/chatMessage/chatMessage.model');db['ChatOfflineMessage']=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x67'));db[_0xbf4e('0x68')]=db[_0xbf4e('0x1')]['import'](_0xbf4e('0x69'));db['ChatGroup']=db[_0xbf4e('0x1')]['import'](_0xbf4e('0x6a'));db['ChatProactiveAction']=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x6b'));db[_0xbf4e('0x6c')]=db[_0xbf4e('0x1')]['import']('../api/cmCompany/cmCompany.model');db['CmContact']=db['sequelize'][_0xbf4e('0x11')](_0xbf4e('0x6d'));db['CmHopper']=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x6e'));db[_0xbf4e('0x6f')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x70'));db['CmHopperFinal']=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x71'));db['CmHopperHistory']=db['sequelize'][_0xbf4e('0x11')](_0xbf4e('0x72'));db[_0xbf4e('0x73')]=db['sequelize'][_0xbf4e('0x11')](_0xbf4e('0x74'));db[_0xbf4e('0x75')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x76'));db[_0xbf4e('0x77')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x78'));db[_0xbf4e('0x79')]=db[_0xbf4e('0x1')]['import'](_0xbf4e('0x7a'));db['CannedAnswer']=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x7b'));db[_0xbf4e('0x7c')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x7d'));db[_0xbf4e('0x7e')]=db['sequelize'][_0xbf4e('0x11')](_0xbf4e('0x7f'));db[_0xbf4e('0x80')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')]('../api/interval/interval.model');db[_0xbf4e('0x81')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x82'));db[_0xbf4e('0x83')]=db[_0xbf4e('0x1')]['import'](_0xbf4e('0x84'));db['VoiceQueuesLog']=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x85'));db[_0xbf4e('0x86')]=db['sequelize'][_0xbf4e('0x11')]('../api/schedule/schedule.model');db['Sound']=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x87'));db['Tag']=db[_0xbf4e('0x1')][_0xbf4e('0x11')]('../api/tag/tag.model');db[_0xbf4e('0x88')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x89'));db[_0xbf4e('0x8a')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x8b'));db[_0xbf4e('0x8c')]=db['sequelize'][_0xbf4e('0x11')](_0xbf4e('0x8d'));db[_0xbf4e('0x8e')]=db[_0xbf4e('0x1')]['import'](_0xbf4e('0x8f'));db[_0xbf4e('0x90')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x91'));db[_0xbf4e('0x92')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x93'));db['AnalyticDefaultReport']=db[_0xbf4e('0x1')]['import'](_0xbf4e('0x94'));db[_0xbf4e('0x95')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x96'));db['AnalyticMetric']=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x97'));db['AnalyticFieldReport']=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x98'));db['AnalyticTreeReport']=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x99'));db[_0xbf4e('0x9a')]=db[_0xbf4e('0x1')]['import'](_0xbf4e('0x9b'));db['SalesforceConfiguration']=db[_0xbf4e('0x1')]['import'](_0xbf4e('0x9c'));db['SalesforceField']=db[_0xbf4e('0x1')]['import'](_0xbf4e('0x9d'));db[_0xbf4e('0x9e')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x9f'));db[_0xbf4e('0xa0')]=db[_0xbf4e('0x1')]['import'](_0xbf4e('0xa1'));db[_0xbf4e('0xa2')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0xa3'));db[_0xbf4e('0xa4')]=db['sequelize'][_0xbf4e('0x11')](_0xbf4e('0xa5'));db['DeskConfiguration']=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0xa6'));db[_0xbf4e('0xa7')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0xa8'));db[_0xbf4e('0xa9')]=db[_0xbf4e('0x1')]['import'](_0xbf4e('0xaa'));db[_0xbf4e('0xab')]=db[_0xbf4e('0x1')]['import'](_0xbf4e('0xac'));db[_0xbf4e('0xad')]=db['sequelize'][_0xbf4e('0x11')](_0xbf4e('0xae'));db[_0xbf4e('0xaf')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0xb0'));db[_0xbf4e('0xb1')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0xb2'));db['ZendeskField']=db['sequelize'][_0xbf4e('0x11')](_0xbf4e('0xb3'));db[_0xbf4e('0xb4')]=db[_0xbf4e('0x1')]['import'](_0xbf4e('0xb5'));db[_0xbf4e('0xb6')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0xb7'));db[_0xbf4e('0xb8')]=db[_0xbf4e('0x1')]['import'](_0xbf4e('0xb9'));db[_0xbf4e('0xba')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0xbb'));db[_0xbf4e('0xbc')]=db['sequelize'][_0xbf4e('0x11')](_0xbf4e('0xbd'));db[_0xbf4e('0xbe')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0xbf'));db[_0xbf4e('0xc0')]=db['sequelize']['import'](_0xbf4e('0xc1'));db[_0xbf4e('0xc2')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0xc3'));db[_0xbf4e('0xc4')]=db[_0xbf4e('0x1')]['import'](_0xbf4e('0xc5'));db[_0xbf4e('0xc6')]=db[_0xbf4e('0x1')]['import']('../api/intDynamics365Account/intDynamics365Account.model');db[_0xbf4e('0xc7')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0xbf4e('0xc8')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0xbf4e('0xc9')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0xca'));db[_0xbf4e('0xcb')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0xcc'));db[_0xbf4e('0xcd')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0xbf4e('0x8e')]=db['sequelize'][_0xbf4e('0x11')](_0xbf4e('0x8f'));db[_0xbf4e('0xce')]=db[_0xbf4e('0x1')]['import'](_0xbf4e('0xcf'));db[_0xbf4e('0xd0')]=db['sequelize'][_0xbf4e('0x11')](_0xbf4e('0xd1'));db[_0xbf4e('0xd2')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0xd3'));db[_0xbf4e('0xd4')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0xbf4e('0xd5')]=db[_0xbf4e('0x1')]['import'](_0xbf4e('0xd6'));db[_0xbf4e('0xd7')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0xd8'));db[_0xbf4e('0xd9')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')]('../api/smsQueueReport/smsQueueReport.model');db[_0xbf4e('0xda')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0xdb'));db[_0xbf4e('0xdc')]=db['sequelize'][_0xbf4e('0x11')](_0xbf4e('0xdd'));db[_0xbf4e('0xde')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0xdf'));db[_0xbf4e('0xe0')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')]('../api/setting/setting.model');db['SquareOdbc']=db['sequelize'][_0xbf4e('0x11')](_0xbf4e('0xe1'));db[_0xbf4e('0xe2')]=db['sequelize'][_0xbf4e('0x11')](_0xbf4e('0xe3'));db['SquareRecording']=db[_0xbf4e('0x1')][_0xbf4e('0x11')]('../api/squareRecording/squareRecording.model');db[_0xbf4e('0xe4')]=db['sequelize'][_0xbf4e('0x11')]('../api/squareMessage/squareMessage.model');db['Team']=db['sequelize'][_0xbf4e('0x11')](_0xbf4e('0xe5'));db['License']=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0xe6'));db[_0xbf4e('0xe7')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0xe8'));db[_0xbf4e('0xe9')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0xea'));db['Attachment']=db['sequelize']['import'](_0xbf4e('0xeb'));db[_0xbf4e('0xec')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0xed'));db[_0xbf4e('0xee')]=db[_0xbf4e('0x1')]['import'](_0xbf4e('0xef'));db[_0xbf4e('0xf0')]=db[_0xbf4e('0x1')]['import'](_0xbf4e('0xf1'));db[_0xbf4e('0xf2')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0xf3'));db[_0xbf4e('0xf4')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0xf5'));db[_0xbf4e('0xf6')]=db[_0xbf4e('0x1')]['import'](_0xbf4e('0xf7'));db['CmList']=db['sequelize'][_0xbf4e('0x11')]('../api/cmList/cmList.model');db[_0xbf4e('0xf8')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0xf9'));db[_0xbf4e('0xfa')]=db['sequelize']['import'](_0xbf4e('0xfb'));db[_0xbf4e('0xfc')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0xfd'));db['UserProfileResource']=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0xfe'));db['UserNotification']=db[_0xbf4e('0x1')]['import'](_0xbf4e('0xff'));db['WhatsappAccount']=db['sequelize'][_0xbf4e('0x11')](_0xbf4e('0x100'));db[_0xbf4e('0x101')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x102'));db[_0xbf4e('0x103')]=db[_0xbf4e('0x1')]['import'](_0xbf4e('0x104'));db[_0xbf4e('0x105')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x106'));db['WhatsappQueueReport']=db['sequelize']['import'](_0xbf4e('0x107'));db['WhatsappTransferReport']=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x108'));db[_0xbf4e('0x109')]=db['sequelize']['import']('../api/whatsappQueue/whatsappQueue.model');db[_0xbf4e('0x10a')]=db[_0xbf4e('0x1')]['import'](_0xbf4e('0x10b'));db[_0xbf4e('0x10c')]=db[_0xbf4e('0x1')]['import']('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0xbf4e('0x10d')]=db[_0xbf4e('0x1')][_0xbf4e('0x11')](_0xbf4e('0x10e'));db[_0xbf4e('0x10f')]=db['sequelize']['import'](_0xbf4e('0x110'));db[_0xbf4e('0xe')][_0xbf4e('0x111')](db['VoiceMail'],{'as':'VoiceMail','onDelete':_0xbf4e('0x112'),'foreignKey':_0xbf4e('0x113')});db[_0xbf4e('0xe')]['hasMany'](db[_0xbf4e('0x17')],{'as':_0xbf4e('0x114'),'foreignKey':_0xbf4e('0x113')});db[_0xbf4e('0xe')][_0xbf4e('0x115')](db[_0xbf4e('0x28')],{'as':_0xbf4e('0x116'),'foreignKey':'UserId'});db[_0xbf4e('0xe')][_0xbf4e('0x115')](db['VoiceExtension'],{'as':'Extensions','onDelete':'cascade','hooks':!![]});db[_0xbf4e('0xe')][_0xbf4e('0x115')](db[_0xbf4e('0x117')],{'as':_0xbf4e('0x118'),'foreignKey':_0xbf4e('0x113')});db[_0xbf4e('0xe')]['hasMany'](db[_0xbf4e('0x119')],{'as':_0xbf4e('0x11a'),'foreignKey':'UserId'});db['User'][_0xbf4e('0x115')](db['ReportAgentPreview'],{'as':_0xbf4e('0x73'),'foreignKey':_0xbf4e('0x113')});db[_0xbf4e('0xe')][_0xbf4e('0x115')](db[_0xbf4e('0x5c')],{'as':_0xbf4e('0x11b'),'foreignKey':_0xbf4e('0x113')});db['User']['hasMany'](db['ChatInteraction'],{'as':_0xbf4e('0x11c'),'foreignKey':'UserId'});db[_0xbf4e('0xe')]['hasMany'](db['SmsInteraction'],{'as':_0xbf4e('0x11d'),'foreignKey':'UserId'});db[_0xbf4e('0xe')][_0xbf4e('0x115')](db[_0xbf4e('0x11e')],{'as':_0xbf4e('0x11f'),'foreignKey':_0xbf4e('0x113')});db[_0xbf4e('0xe')][_0xbf4e('0x115')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':_0xbf4e('0x113')});db[_0xbf4e('0xe')][_0xbf4e('0x115')](db[_0xbf4e('0x103')],{'as':_0xbf4e('0x120'),'foreignKey':_0xbf4e('0x113')});db['User']['hasMany'](db[_0xbf4e('0x121')],{'as':'UserNotifications','foreignKey':'SenderId'});db[_0xbf4e('0xe')][_0xbf4e('0x122')](db[_0xbf4e('0xfa')],{'as':_0xbf4e('0xfa'),'foreignKey':_0xbf4e('0x123')});db[_0xbf4e('0xe')][_0xbf4e('0x124')](db[_0xbf4e('0x125')],{'as':'Groups','through':_0xbf4e('0x126')});db[_0xbf4e('0xe')][_0xbf4e('0x124')](db[_0xbf4e('0x127')],{'as':_0xbf4e('0x128'),'through':_0xbf4e('0x129')});db[_0xbf4e('0xe')]['belongsToMany'](db[_0xbf4e('0x12a')],{'as':_0xbf4e('0x12b'),'through':_0xbf4e('0x12c')});db[_0xbf4e('0xe')][_0xbf4e('0x124')](db['Team'],{'through':_0xbf4e('0x12d')});db['User'][_0xbf4e('0x124')](db[_0xbf4e('0x3b')],{'as':_0xbf4e('0x12e'),'through':'user_has_mail_interactions'});db['User'][_0xbf4e('0x124')](db[_0xbf4e('0x65')],{'as':_0xbf4e('0x11c'),'through':_0xbf4e('0x12f')});db['User'][_0xbf4e('0x124')](db['FaxInteraction'],{'as':_0xbf4e('0x11f'),'through':_0xbf4e('0x130')});db[_0xbf4e('0xe')]['belongsToMany'](db[_0xbf4e('0x131')],{'as':_0xbf4e('0x11d'),'through':_0xbf4e('0x132')});db[_0xbf4e('0xe')][_0xbf4e('0x124')](db['OpenchannelInteraction'],{'as':_0xbf4e('0x11b'),'through':'user_has_openchannel_interactions'});db['User'][_0xbf4e('0x124')](db['WhatsappInteraction'],{'as':_0xbf4e('0x120'),'through':_0xbf4e('0x133')});db[_0xbf4e('0xe')][_0xbf4e('0x124')](db[_0xbf4e('0x15')],{'as':_0xbf4e('0x134'),'through':_0xbf4e('0x135'),'required':![]});db['User'][_0xbf4e('0x124')](db[_0xbf4e('0xf8')],{'as':_0xbf4e('0x136'),'through':_0xbf4e('0x10f'),'required':![]});db['User'][_0xbf4e('0x124')](db[_0xbf4e('0x38')],{'as':_0xbf4e('0x137'),'through':_0xbf4e('0x2b'),'required':![]});db[_0xbf4e('0xe')][_0xbf4e('0x124')](db[_0xbf4e('0x68')],{'as':_0xbf4e('0x138'),'through':_0xbf4e('0x2a'),'required':![],'hooks':!![]});db[_0xbf4e('0xe')]['belongsToMany'](db['FaxQueue'],{'as':'FaxQueues','through':'UserFaxQueue','required':![]});db['User']['belongsToMany'](db[_0xbf4e('0x56')],{'as':_0xbf4e('0x139'),'through':_0xbf4e('0x2e'),'required':![]});db['User'][_0xbf4e('0x124')](db[_0xbf4e('0x13a')],{'as':_0xbf4e('0x13b'),'through':_0xbf4e('0x30'),'required':![]});db[_0xbf4e('0xe')][_0xbf4e('0x124')](db[_0xbf4e('0x109')],{'as':_0xbf4e('0x13c'),'through':_0xbf4e('0x13d'),'required':![]});db[_0xbf4e('0xe')][_0xbf4e('0x124')](db[_0xbf4e('0x12a')],{'through':'cm_user_has_lists'});db['User'][_0xbf4e('0x124')](db['ChatWebsite'],{'as':_0xbf4e('0x13e'),'through':'user_has_chat_websites'});db[_0xbf4e('0xe')][_0xbf4e('0x124')](db[_0xbf4e('0x47')],{'as':'FaxAccounts','through':_0xbf4e('0x13f')});db[_0xbf4e('0xe')][_0xbf4e('0x124')](db[_0xbf4e('0x36')],{'as':'MailAccounts','through':_0xbf4e('0x140')});db[_0xbf4e('0xe')][_0xbf4e('0x124')](db[_0xbf4e('0x58')],{'as':_0xbf4e('0x141'),'through':_0xbf4e('0x142')});db['User'][_0xbf4e('0x124')](db[_0xbf4e('0x4f')],{'as':_0xbf4e('0x143'),'through':_0xbf4e('0x144')});db[_0xbf4e('0xe')][_0xbf4e('0x124')](db[_0xbf4e('0x145')],{'as':'WhatsappAccounts','through':'user_has_whatsapp_accounts'});db[_0xbf4e('0xe')][_0xbf4e('0x124')](db['SquareProject'],{'as':_0xbf4e('0x146'),'through':'user_has_square_projects'});db[_0xbf4e('0x10')]['hasMany'](db['VoiceExtension'],{'as':_0xbf4e('0x147'),'onDelete':_0xbf4e('0x112'),'foreignKey':_0xbf4e('0x148')});db[_0xbf4e('0x12')][_0xbf4e('0x115')](db['VoiceExtension'],{'onDelete':_0xbf4e('0x112')});db[_0xbf4e('0x149')][_0xbf4e('0x115')](db[_0xbf4e('0x149')],{'as':'Applications','onDelete':_0xbf4e('0x112')});db[_0xbf4e('0x14a')][_0xbf4e('0x124')](db[_0xbf4e('0x14b')],{'as':_0xbf4e('0x14c'),'through':_0xbf4e('0x14d')});db[_0xbf4e('0x15')][_0xbf4e('0x115')](db[_0xbf4e('0x28')],{'as':_0xbf4e('0x14e'),'foreignKey':_0xbf4e('0x14f')});db[_0xbf4e('0x15')]['hasMany'](db[_0xbf4e('0x150')],{'as':'Hoppers','foreignKey':_0xbf4e('0x14f')});db['VoiceQueue']['hasMany'](db[_0xbf4e('0x117')],{'as':'HopperFinals','foreignKey':_0xbf4e('0x14f')});db[_0xbf4e('0x15')]['hasMany'](db[_0xbf4e('0x119')],{'as':_0xbf4e('0x151'),'foreignKey':_0xbf4e('0x14f')});db[_0xbf4e('0x15')][_0xbf4e('0x115')](db[_0xbf4e('0x73')],{'as':'ReportAgentPreview','foreignKey':_0xbf4e('0x14f')});db[_0xbf4e('0x15')][_0xbf4e('0x115')](db[_0xbf4e('0x6f')],{'as':_0xbf4e('0x152'),'foreignKey':_0xbf4e('0x14f')});db[_0xbf4e('0x15')][_0xbf4e('0x115')](db['JscriptySessionReport'],{'as':_0xbf4e('0x153'),'foreignKey':_0xbf4e('0x14f')});db[_0xbf4e('0x15')][_0xbf4e('0x122')](db[_0xbf4e('0x24')],{'as':_0xbf4e('0x24'),'foreignKey':_0xbf4e('0x154')});db['VoiceQueue']['belongsTo'](db[_0xbf4e('0x24')],{'as':_0xbf4e('0x155'),'foreignKey':_0xbf4e('0x156')});db['VoiceQueue'][_0xbf4e('0x122')](db[_0xbf4e('0x80')],{'as':'Interval','foreignKey':_0xbf4e('0x157')});db['VoiceQueue'][_0xbf4e('0x122')](db[_0xbf4e('0x81')],{'as':_0xbf4e('0x158'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xbf4e('0x15')][_0xbf4e('0x124')](db[_0xbf4e('0x12a')],{'as':'Lists','through':_0xbf4e('0x159')});db[_0xbf4e('0x15')][_0xbf4e('0x124')](db[_0xbf4e('0xe')],{'as':_0xbf4e('0x15a'),'through':_0xbf4e('0x135')});db[_0xbf4e('0x15')][_0xbf4e('0x124')](db['Team'],{'as':_0xbf4e('0x15b'),'through':_0xbf4e('0x10c')});db[_0xbf4e('0x15')][_0xbf4e('0x124')](db[_0xbf4e('0x12a')],{'as':'BlackLists','through':_0xbf4e('0x15c')});db[_0xbf4e('0x17')]['belongsTo'](db['User'],{'as':_0xbf4e('0xe'),'foreignKey':_0xbf4e('0x113')});db[_0xbf4e('0x19')][_0xbf4e('0x122')](db[_0xbf4e('0xe')],{'as':_0xbf4e('0xe'),'foreignKey':_0xbf4e('0x113')});db[_0xbf4e('0x15d')][_0xbf4e('0x115')](db[_0xbf4e('0x1c')],{'as':_0xbf4e('0x15e'),'onDelete':'cascade','foreignKey':_0xbf4e('0x15f'),'sourceKey':_0xbf4e('0x160')});db[_0xbf4e('0x1c')]['belongsTo'](db[_0xbf4e('0x15d')],{'foreignKey':_0xbf4e('0x15f'),'targetKey':'mailbox'});db[_0xbf4e('0x1e')][_0xbf4e('0x115')](db[_0xbf4e('0x161')],{'as':'QueueCalls','foreignKey':_0xbf4e('0x162'),'constraints':![]});db[_0xbf4e('0x1e')][_0xbf4e('0x115')](db[_0xbf4e('0x20')],{'as':_0xbf4e('0x163'),'foreignKey':_0xbf4e('0x162'),'constraints':![]});db[_0xbf4e('0x1e')]['belongsTo'](db[_0xbf4e('0xe')],{'as':_0xbf4e('0xe'),'foreignKey':_0xbf4e('0x113')});db[_0xbf4e('0x1e')][_0xbf4e('0x122')](db[_0xbf4e('0x127')],{'as':'Contact','foreignKey':'ContactId'});db[_0xbf4e('0x32')][_0xbf4e('0x122')](db[_0xbf4e('0x36')],{'as':_0xbf4e('0x36'),'foreignKey':_0xbf4e('0x164')});db[_0xbf4e('0x34')][_0xbf4e('0x122')](db[_0xbf4e('0x36')],{'as':'MailAccount','foreignKey':_0xbf4e('0x164')});db['MailAccount'][_0xbf4e('0x111')](db['MailServerIn'],{'as':_0xbf4e('0x165'),'onDelete':_0xbf4e('0x112')});db[_0xbf4e('0x36')][_0xbf4e('0x111')](db[_0xbf4e('0x34')],{'as':_0xbf4e('0x166'),'onDelete':'cascade'});db[_0xbf4e('0x36')]['hasMany'](db[_0xbf4e('0x7c')],{'as':_0xbf4e('0x167'),'foreignKey':_0xbf4e('0x164'),'onDelete':'cascade'});db[_0xbf4e('0x36')][_0xbf4e('0x115')](db[_0xbf4e('0x168')],{'as':_0xbf4e('0x169'),'foreignKey':_0xbf4e('0x164')});db['MailAccount'][_0xbf4e('0x115')](db[_0xbf4e('0x3d')],{'as':_0xbf4e('0x15e'),'foreignKey':'MailAccountId'});db[_0xbf4e('0x36')][_0xbf4e('0x115')](db[_0xbf4e('0x3b')],{'as':_0xbf4e('0x16a')});db[_0xbf4e('0x36')][_0xbf4e('0x115')](db[_0xbf4e('0x3f')],{'as':_0xbf4e('0x16b')});db[_0xbf4e('0x36')][_0xbf4e('0x122')](db[_0xbf4e('0x12a')],{'as':_0xbf4e('0x16c'),'foreignKey':_0xbf4e('0x16d')});db[_0xbf4e('0x36')][_0xbf4e('0x122')](db[_0xbf4e('0x88')],{'as':_0xbf4e('0x88'),'foreignKey':_0xbf4e('0x16e')});db[_0xbf4e('0x36')]['belongsTo'](db[_0xbf4e('0x81')],{'as':_0xbf4e('0x158'),'foreignKey':_0xbf4e('0x16f')});db[_0xbf4e('0x36')][_0xbf4e('0x124')](db[_0xbf4e('0xe')],{'as':_0xbf4e('0x15a'),'through':'user_has_mail_accounts'});db['MailQueue'][_0xbf4e('0x124')](db[_0xbf4e('0xe')],{'as':_0xbf4e('0x15a'),'through':_0xbf4e('0x2b')});db[_0xbf4e('0x38')][_0xbf4e('0x124')](db[_0xbf4e('0x170')],{'through':_0xbf4e('0x171'),'as':_0xbf4e('0x15b')});db[_0xbf4e('0x3b')]['hasMany'](db[_0xbf4e('0x3d')],{'as':_0xbf4e('0x15e'),'onDelete':'cascade','foreignKey':_0xbf4e('0x172')});db[_0xbf4e('0x3b')][_0xbf4e('0x122')](db[_0xbf4e('0x36')],{'as':_0xbf4e('0x173'),'foreignKey':'MailAccountId'});db[_0xbf4e('0x3b')]['belongsTo'](db[_0xbf4e('0x127')],{'as':_0xbf4e('0x174'),'foreignKey':_0xbf4e('0x175')});db[_0xbf4e('0x3b')][_0xbf4e('0x122')](db[_0xbf4e('0xe')],{'as':_0xbf4e('0x176'),'foreignKey':_0xbf4e('0x113')});db[_0xbf4e('0x3b')][_0xbf4e('0x124')](db['Tag'],{'through':_0xbf4e('0x177'),'as':_0xbf4e('0x178')});db[_0xbf4e('0x3b')][_0xbf4e('0x124')](db['Tag'],{'through':_0xbf4e('0x177'),'as':_0xbf4e('0x179')});db[_0xbf4e('0x3b')]['belongsToMany'](db[_0xbf4e('0xe')],{'as':_0xbf4e('0x17a'),'through':_0xbf4e('0x17b'),'foreignKey':_0xbf4e('0x172')});db[_0xbf4e('0x3d')]['hasMany'](db[_0xbf4e('0x17c')],{'as':_0xbf4e('0x17d'),'onDelete':_0xbf4e('0x112')});db[_0xbf4e('0x3d')][_0xbf4e('0x122')](db['User'],{'as':_0xbf4e('0xe')});db[_0xbf4e('0x3d')]['belongsTo'](db['CmContact'],{'onDelete':_0xbf4e('0x112'),'as':_0xbf4e('0x174')});db[_0xbf4e('0x3d')][_0xbf4e('0x122')](db['MailInteraction'],{'as':'Interaction','foreignKey':_0xbf4e('0x172')});db['MailMessage'][_0xbf4e('0x122')](db['MailAccount'],{'as':_0xbf4e('0x173'),'foreignKey':_0xbf4e('0x164')});db[_0xbf4e('0x3d')][_0xbf4e('0x122')](db[_0xbf4e('0x60')],{'as':'ChatWebsite','foreignKey':_0xbf4e('0x17e')});db[_0xbf4e('0x3d')][_0xbf4e('0x122')](db['ChatOfflineMessage'],{'as':_0xbf4e('0x17f'),'foreignKey':_0xbf4e('0x180')});db[_0xbf4e('0x3f')]['belongsTo'](db[_0xbf4e('0xe')],{'onDelete':_0xbf4e('0x181')});db[_0xbf4e('0x3f')][_0xbf4e('0x122')](db[_0xbf4e('0x38')],{'onDelete':_0xbf4e('0x181')});db['MailApplication'][_0xbf4e('0x122')](db[_0xbf4e('0x36')],{'onDelete':_0xbf4e('0x181')});db[_0xbf4e('0x3f')][_0xbf4e('0x122')](db['Interval'],{'onDelete':_0xbf4e('0x181'),'foreignKey':_0xbf4e('0x157')});db['MailApplication']['belongsTo'](db[_0xbf4e('0x182')],{'onDelete':'restrict','foreignKey':_0xbf4e('0x183')});db[_0xbf4e('0x41')]['belongsTo'](db[_0xbf4e('0x36')],{});db[_0xbf4e('0x41')][_0xbf4e('0x122')](db[_0xbf4e('0x12a')],{'as':_0xbf4e('0x16c'),'foreignKey':_0xbf4e('0x16d')});db['MailQueueReport'][_0xbf4e('0x122')](db[_0xbf4e('0x127')],{'as':_0xbf4e('0x174'),'foreignKey':_0xbf4e('0x175')});db['MailQueueReport'][_0xbf4e('0x122')](db['MailInteraction'],{});db[_0xbf4e('0x41')][_0xbf4e('0x122')](db[_0xbf4e('0x3d')],{});db[_0xbf4e('0x41')][_0xbf4e('0x122')](db[_0xbf4e('0xe')],{});db[_0xbf4e('0x41')][_0xbf4e('0x122')](db['MailQueue'],{});db[_0xbf4e('0x43')][_0xbf4e('0x115')](db[_0xbf4e('0x45')],{'as':_0xbf4e('0x184'),'onDelete':'cascade'});db['FaxAccount'][_0xbf4e('0x115')](db[_0xbf4e('0x7c')],{'as':_0xbf4e('0x167'),'foreignKey':_0xbf4e('0x185'),'onDelete':'cascade'});db['FaxAccount'][_0xbf4e('0x115')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0xbf4e('0x185')});db[_0xbf4e('0x47')][_0xbf4e('0x115')](db[_0xbf4e('0x11e')],{'as':'Interactions'});db['FaxAccount'][_0xbf4e('0x115')](db['FaxApplication'],{'as':'Applications'});db[_0xbf4e('0x47')][_0xbf4e('0x115')](db[_0xbf4e('0x149')],{'as':_0xbf4e('0x186'),'onDelete':_0xbf4e('0x112')});db[_0xbf4e('0x47')][_0xbf4e('0x115')](db[_0xbf4e('0x4b')],{'as':'Messages'});db[_0xbf4e('0x47')][_0xbf4e('0x122')](db[_0xbf4e('0x24')],{'as':_0xbf4e('0x24')});db['FaxAccount'][_0xbf4e('0x122')](db[_0xbf4e('0x12a')],{'as':_0xbf4e('0x16c'),'foreignKey':'ListId'});db[_0xbf4e('0x47')][_0xbf4e('0x122')](db[_0xbf4e('0x81')],{'as':'mandatoryDispositionPause','foreignKey':_0xbf4e('0x16f')});db[_0xbf4e('0x47')][_0xbf4e('0x124')](db[_0xbf4e('0xe')],{'as':'Agents','through':_0xbf4e('0x13f')});db[_0xbf4e('0x49')][_0xbf4e('0x122')](db[_0xbf4e('0xe')],{'onDelete':_0xbf4e('0x181')});db['FaxApplication'][_0xbf4e('0x122')](db[_0xbf4e('0x187')],{'onDelete':'restrict'});db[_0xbf4e('0x49')][_0xbf4e('0x122')](db[_0xbf4e('0x47')],{'onDelete':_0xbf4e('0x181')});db['FaxApplication'][_0xbf4e('0x122')](db['Tag'],{'onDelete':_0xbf4e('0x181'),'foreignKey':_0xbf4e('0x183')});db[_0xbf4e('0x11e')]['hasMany'](db['FaxMessage'],{'as':_0xbf4e('0x15e'),'onDelete':_0xbf4e('0x112'),'foreignKey':'FaxInteractionId'});db['FaxInteraction'][_0xbf4e('0x122')](db[_0xbf4e('0x47')],{'as':_0xbf4e('0x173'),'foreignKey':_0xbf4e('0x185')});db['FaxInteraction'][_0xbf4e('0x122')](db[_0xbf4e('0x127')],{'as':'Contact','foreignKey':_0xbf4e('0x175')});db['FaxInteraction']['belongsTo'](db['User'],{'as':_0xbf4e('0x176'),'foreignKey':'UserId'});db['FaxInteraction'][_0xbf4e('0x124')](db['Tag'],{'through':_0xbf4e('0x188'),'as':_0xbf4e('0x178')});db[_0xbf4e('0x11e')]['belongsToMany'](db[_0xbf4e('0x182')],{'through':_0xbf4e('0x188'),'as':_0xbf4e('0x179')});db[_0xbf4e('0x11e')][_0xbf4e('0x124')](db[_0xbf4e('0xe')],{'as':'Users','through':'user_has_fax_interactions','foreignKey':_0xbf4e('0x189')});db['FaxMessage'][_0xbf4e('0x122')](db['User'],{'onDelete':'cascade','as':_0xbf4e('0xe')});db['FaxMessage'][_0xbf4e('0x122')](db['FaxInteraction'],{'as':'Interaction','foreignKey':'FaxInteractionId'});db['FaxMessage'][_0xbf4e('0x122')](db[_0xbf4e('0x127')],{'onDelete':'cascade','as':_0xbf4e('0x174')});db[_0xbf4e('0x4b')][_0xbf4e('0x122')](db['Attachment'],{'as':_0xbf4e('0x17c'),'foreignKey':_0xbf4e('0x18a')});db[_0xbf4e('0x4b')]['belongsTo'](db[_0xbf4e('0x47')],{'as':_0xbf4e('0x173'),'foreignKey':_0xbf4e('0x185')});db['FaxQueue'][_0xbf4e('0x124')](db['User'],{'as':_0xbf4e('0x15a'),'through':_0xbf4e('0x2c')});db[_0xbf4e('0x187')][_0xbf4e('0x124')](db['Team'],{'through':'team_has_fax_queues','as':_0xbf4e('0x15b')});db[_0xbf4e('0x4e')]['belongsTo'](db[_0xbf4e('0x47')],{});db[_0xbf4e('0x4e')]['belongsTo'](db[_0xbf4e('0x12a')],{'as':'List','foreignKey':_0xbf4e('0x16d')});db[_0xbf4e('0x4e')][_0xbf4e('0x122')](db[_0xbf4e('0x127')],{'as':_0xbf4e('0x174'),'foreignKey':_0xbf4e('0x175')});db[_0xbf4e('0x4e')][_0xbf4e('0x122')](db[_0xbf4e('0x11e')],{});db[_0xbf4e('0x4e')][_0xbf4e('0x122')](db[_0xbf4e('0x4b')],{});db[_0xbf4e('0x4e')][_0xbf4e('0x122')](db[_0xbf4e('0xe')],{});db[_0xbf4e('0x4e')]['belongsTo'](db['FaxQueue'],{});db[_0xbf4e('0x4f')][_0xbf4e('0x115')](db['Disposition'],{'as':_0xbf4e('0x167'),'foreignKey':'SmsAccountId','onDelete':_0xbf4e('0x112')});db[_0xbf4e('0x4f')]['hasMany'](db['CannedAnswer'],{'as':_0xbf4e('0x169'),'foreignKey':_0xbf4e('0x18b')});db[_0xbf4e('0x4f')]['hasMany'](db[_0xbf4e('0x54')],{'as':_0xbf4e('0x15e'),'foreignKey':_0xbf4e('0x18b')});db['SmsAccount'][_0xbf4e('0x115')](db['SmsInteraction'],{'as':_0xbf4e('0x16a')});db[_0xbf4e('0x4f')]['hasMany'](db[_0xbf4e('0x51')],{'as':_0xbf4e('0x16b')});db[_0xbf4e('0x4f')][_0xbf4e('0x122')](db[_0xbf4e('0x12a')],{'as':'List','foreignKey':_0xbf4e('0x16d')});db[_0xbf4e('0x4f')][_0xbf4e('0x122')](db[_0xbf4e('0x81')],{'as':_0xbf4e('0x158'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xbf4e('0x4f')][_0xbf4e('0x124')](db['User'],{'as':_0xbf4e('0x15a'),'through':_0xbf4e('0x144')});db[_0xbf4e('0x51')][_0xbf4e('0x122')](db['User'],{'onDelete':_0xbf4e('0x181')});db[_0xbf4e('0x51')][_0xbf4e('0x122')](db['SmsQueue'],{'onDelete':_0xbf4e('0x181')});db[_0xbf4e('0x51')][_0xbf4e('0x122')](db['SmsAccount'],{'onDelete':'restrict'});db['SmsApplication'][_0xbf4e('0x122')](db[_0xbf4e('0x80')],{'onDelete':_0xbf4e('0x181'),'foreignKey':_0xbf4e('0x157')});db['SmsApplication'][_0xbf4e('0x122')](db['Tag'],{'onDelete':_0xbf4e('0x181'),'foreignKey':_0xbf4e('0x183')});db['SmsInteraction'][_0xbf4e('0x115')](db[_0xbf4e('0x54')],{'as':_0xbf4e('0x15e'),'onDelete':_0xbf4e('0x112'),'foreignKey':_0xbf4e('0x18c')});db[_0xbf4e('0x131')][_0xbf4e('0x122')](db[_0xbf4e('0x4f')],{'as':_0xbf4e('0x173'),'foreignKey':_0xbf4e('0x18b')});db['SmsInteraction']['belongsTo'](db[_0xbf4e('0x127')],{'as':_0xbf4e('0x174'),'foreignKey':_0xbf4e('0x175')});db[_0xbf4e('0x131')][_0xbf4e('0x122')](db[_0xbf4e('0xe')],{'as':_0xbf4e('0x176'),'foreignKey':_0xbf4e('0x113')});db['SmsInteraction'][_0xbf4e('0x124')](db[_0xbf4e('0x182')],{'through':'sms_interaction_has_tags','as':_0xbf4e('0x178')});db[_0xbf4e('0x131')][_0xbf4e('0x124')](db[_0xbf4e('0x182')],{'through':'sms_interaction_has_tags','as':_0xbf4e('0x179')});db[_0xbf4e('0x131')][_0xbf4e('0x124')](db['User'],{'as':_0xbf4e('0x17a'),'through':_0xbf4e('0x132'),'foreignKey':_0xbf4e('0x18c')});db[_0xbf4e('0x54')][_0xbf4e('0x122')](db[_0xbf4e('0xe')],{'as':_0xbf4e('0xe')});db[_0xbf4e('0x54')][_0xbf4e('0x122')](db['CmContact'],{'onDelete':'cascade','as':'Contact'});db['SmsMessage'][_0xbf4e('0x122')](db[_0xbf4e('0x131')],{'onDelete':_0xbf4e('0x112'),'as':'Interaction','foreignKey':'SmsInteractionId'});db[_0xbf4e('0x54')][_0xbf4e('0x122')](db[_0xbf4e('0x4f')],{'as':_0xbf4e('0x173'),'foreignKey':'SmsAccountId'});db[_0xbf4e('0x56')][_0xbf4e('0x124')](db[_0xbf4e('0xe')],{'as':'Agents','through':_0xbf4e('0x2e'),'foreignKey':_0xbf4e('0x18d')});db[_0xbf4e('0x56')][_0xbf4e('0x124')](db[_0xbf4e('0x170')],{'through':'team_has_sms_queues','as':_0xbf4e('0x15b')});db[_0xbf4e('0x58')][_0xbf4e('0x115')](db[_0xbf4e('0x7c')],{'as':'Dispositions','foreignKey':'OpenchannelAccountId','onDelete':_0xbf4e('0x112')});db[_0xbf4e('0x58')][_0xbf4e('0x115')](db[_0xbf4e('0x168')],{'as':_0xbf4e('0x169'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0xbf4e('0x115')](db[_0xbf4e('0x5c')],{'as':_0xbf4e('0x16a'),'foreignKey':_0xbf4e('0x18e')});db[_0xbf4e('0x58')][_0xbf4e('0x115')](db['OpenchannelMessage'],{'as':_0xbf4e('0x15e'),'foreignKey':_0xbf4e('0x18e')});db['OpenchannelAccount']['hasMany'](db['OpenchannelApplication'],{'as':_0xbf4e('0x16b'),'foreignKey':_0xbf4e('0x18e')});db[_0xbf4e('0x58')][_0xbf4e('0x122')](db[_0xbf4e('0x12a')],{'as':'List','foreignKey':_0xbf4e('0x16d')});db[_0xbf4e('0x58')][_0xbf4e('0x122')](db[_0xbf4e('0x81')],{'as':'mandatoryDispositionPause','foreignKey':_0xbf4e('0x16f')});db['OpenchannelAccount'][_0xbf4e('0x124')](db[_0xbf4e('0xe')],{'as':_0xbf4e('0x15a'),'through':_0xbf4e('0x142')});db[_0xbf4e('0x5a')]['belongsTo'](db['User'],{'onDelete':_0xbf4e('0x181')});db[_0xbf4e('0x5a')][_0xbf4e('0x122')](db[_0xbf4e('0x13a')],{'onDelete':_0xbf4e('0x181'),'foreignKey':'OpenchannelQueueId'});db[_0xbf4e('0x5a')][_0xbf4e('0x122')](db[_0xbf4e('0x58')],{'onDelete':_0xbf4e('0x181'),'foreignKey':_0xbf4e('0x18e')});db[_0xbf4e('0x5a')][_0xbf4e('0x122')](db['Interval'],{'onDelete':'restrict','foreignKey':_0xbf4e('0x157')});db[_0xbf4e('0x5a')]['belongsTo'](db[_0xbf4e('0x182')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xbf4e('0x5c')][_0xbf4e('0x115')](db['OpenchannelMessage'],{'as':_0xbf4e('0x15e'),'onDelete':'cascade','foreignKey':_0xbf4e('0x18f')});db[_0xbf4e('0x5c')][_0xbf4e('0x122')](db['OpenchannelAccount'],{'as':_0xbf4e('0x173'),'foreignKey':_0xbf4e('0x18e')});db[_0xbf4e('0x5c')][_0xbf4e('0x122')](db[_0xbf4e('0x127')],{'as':_0xbf4e('0x174'),'foreignKey':'ContactId'});db[_0xbf4e('0x5c')]['belongsTo'](db[_0xbf4e('0xe')],{'as':'Owner','foreignKey':_0xbf4e('0x113')});db[_0xbf4e('0x5c')][_0xbf4e('0x124')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':'Tags'});db[_0xbf4e('0x5c')]['belongsToMany'](db['Tag'],{'through':_0xbf4e('0x190'),'as':_0xbf4e('0x179')});db[_0xbf4e('0x5c')][_0xbf4e('0x124')](db[_0xbf4e('0xe')],{'as':'Users','through':_0xbf4e('0x191'),'foreignKey':_0xbf4e('0x18f')});db[_0xbf4e('0x192')][_0xbf4e('0x122')](db[_0xbf4e('0xe')],{'onDelete':_0xbf4e('0x112'),'as':_0xbf4e('0xe')});db[_0xbf4e('0x192')][_0xbf4e('0x122')](db[_0xbf4e('0x127')],{'onDelete':_0xbf4e('0x112'),'as':_0xbf4e('0x174')});db[_0xbf4e('0x192')][_0xbf4e('0x122')](db['OpenchannelInteraction'],{'onDelete':_0xbf4e('0x112'),'as':_0xbf4e('0x193'),'foreignKey':'OpenchannelInteractionId'});db[_0xbf4e('0x192')][_0xbf4e('0x122')](db[_0xbf4e('0x17c')],{'as':_0xbf4e('0x17c'),'foreignKey':_0xbf4e('0x18a')});db[_0xbf4e('0x192')][_0xbf4e('0x122')](db[_0xbf4e('0x58')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db['OpenchannelQueue']['belongsToMany'](db[_0xbf4e('0xe')],{'as':_0xbf4e('0x15a'),'through':_0xbf4e('0x30'),'foreignKey':_0xbf4e('0x194')});db[_0xbf4e('0x13a')][_0xbf4e('0x124')](db[_0xbf4e('0x170')],{'through':'team_has_openchannel_queues','as':_0xbf4e('0x15b')});db['ChatWebsite'][_0xbf4e('0x115')](db[_0xbf4e('0x7c')],{'as':'Dispositions','foreignKey':_0xbf4e('0x17e'),'onDelete':_0xbf4e('0x112')});db[_0xbf4e('0x60')][_0xbf4e('0x115')](db[_0xbf4e('0x168')],{'as':'Answers','foreignKey':'ChatWebsiteId'});db[_0xbf4e('0x60')][_0xbf4e('0x115')](db[_0xbf4e('0x195')],{'as':_0xbf4e('0x196')});db[_0xbf4e('0x60')]['hasMany'](db['ChatInteraction'],{'as':_0xbf4e('0x16a')});db[_0xbf4e('0x60')][_0xbf4e('0x115')](db[_0xbf4e('0x197')],{'as':_0xbf4e('0x16b')});db['ChatWebsite'][_0xbf4e('0x115')](db[_0xbf4e('0x198')],{'as':_0xbf4e('0x15e')});db['ChatWebsite'][_0xbf4e('0x122')](db[_0xbf4e('0x12a')],{'as':_0xbf4e('0x16c'),'foreignKey':_0xbf4e('0x16d')});db[_0xbf4e('0x60')][_0xbf4e('0x122')](db[_0xbf4e('0x80')],{'as':'Interval','foreignKey':_0xbf4e('0x157')});db[_0xbf4e('0x60')][_0xbf4e('0x122')](db['MailAccount'],{'as':'MailAccount','foreignKey':_0xbf4e('0x164')});db[_0xbf4e('0x60')][_0xbf4e('0x122')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xbf4e('0x16f')});db[_0xbf4e('0x60')]['belongsToMany'](db[_0xbf4e('0xe')],{'as':_0xbf4e('0x15a'),'through':'user_has_chat_websites'});db[_0xbf4e('0x62')][_0xbf4e('0x122')](db[_0xbf4e('0x58')],{});db[_0xbf4e('0x62')][_0xbf4e('0x122')](db['CmList'],{'as':_0xbf4e('0x16c'),'foreignKey':_0xbf4e('0x16d')});db[_0xbf4e('0x62')][_0xbf4e('0x122')](db['CmContact'],{'as':_0xbf4e('0x174'),'foreignKey':_0xbf4e('0x175')});db[_0xbf4e('0x62')]['belongsTo'](db[_0xbf4e('0x5c')],{});db[_0xbf4e('0x62')]['belongsTo'](db[_0xbf4e('0x192')],{});db[_0xbf4e('0x62')][_0xbf4e('0x122')](db[_0xbf4e('0xe')],{});db[_0xbf4e('0x62')][_0xbf4e('0x122')](db['OpenchannelQueue'],{});db[_0xbf4e('0x197')][_0xbf4e('0x122')](db[_0xbf4e('0xe')],{'as':_0xbf4e('0x199'),'foreignKey':_0xbf4e('0x113'),'onDelete':'restrict'});db[_0xbf4e('0x197')][_0xbf4e('0x122')](db['ChatQueue'],{'as':'Queue','foreignKey':_0xbf4e('0x19a'),'onDelete':_0xbf4e('0x181')});db[_0xbf4e('0x197')][_0xbf4e('0x122')](db['ChatWebsite'],{'as':_0xbf4e('0x19b'),'foreignKey':_0xbf4e('0x17e'),'onDelete':_0xbf4e('0x181')});db['ChatApplication']['belongsTo'](db[_0xbf4e('0x182')],{'onDelete':'restrict','foreignKey':_0xbf4e('0x183')});db[_0xbf4e('0x65')][_0xbf4e('0x115')](db[_0xbf4e('0x198')],{'as':_0xbf4e('0x15e'),'onDelete':'cascade','foreignKey':_0xbf4e('0x19c')});db[_0xbf4e('0x65')][_0xbf4e('0x122')](db['ChatWebsite'],{'as':_0xbf4e('0x173'),'foreignKey':_0xbf4e('0x17e')});db[_0xbf4e('0x65')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0xbf4e('0x175')});db[_0xbf4e('0x65')]['belongsTo'](db[_0xbf4e('0xe')],{'as':_0xbf4e('0x176'),'foreignKey':_0xbf4e('0x113')});db[_0xbf4e('0x65')]['belongsToMany'](db[_0xbf4e('0x182')],{'through':'chat_interaction_has_tags','as':_0xbf4e('0x178')});db[_0xbf4e('0x65')][_0xbf4e('0x124')](db[_0xbf4e('0x182')],{'through':_0xbf4e('0x19d'),'as':'ThroughTags'});db[_0xbf4e('0x65')][_0xbf4e('0x124')](db[_0xbf4e('0xe')],{'as':_0xbf4e('0x17a'),'through':_0xbf4e('0x12f'),'foreignKey':'ChatInteractionId'});db[_0xbf4e('0x198')][_0xbf4e('0x122')](db[_0xbf4e('0xe')],{'onDelete':'cascade','as':_0xbf4e('0xe')});db['ChatMessage']['belongsTo'](db['CmContact'],{'onDelete':'cascade','as':_0xbf4e('0x174'),'foreignKey':_0xbf4e('0x175')});db[_0xbf4e('0x198')][_0xbf4e('0x122')](db['ChatInteraction'],{'onDelete':_0xbf4e('0x112'),'as':_0xbf4e('0x193'),'foreignKey':'ChatInteractionId'});db[_0xbf4e('0x198')]['belongsTo'](db[_0xbf4e('0x17c')],{'as':_0xbf4e('0x17c'),'foreignKey':_0xbf4e('0x18a')});db[_0xbf4e('0x198')][_0xbf4e('0x122')](db[_0xbf4e('0x60')],{'as':'Account','foreignKey':_0xbf4e('0x17e')});db[_0xbf4e('0x17f')][_0xbf4e('0x115')](db['Attachment'],{'as':_0xbf4e('0x17d'),'foreignKey':_0xbf4e('0x180'),'onDelete':_0xbf4e('0x112'),'hooks':!![]});db[_0xbf4e('0x17f')]['belongsTo'](db[_0xbf4e('0x127')],{'onDelete':'cascade','as':'Contact','foreignKey':_0xbf4e('0x175')});db[_0xbf4e('0x17f')][_0xbf4e('0x122')](db[_0xbf4e('0x60')],{'as':_0xbf4e('0x173'),'foreignKey':_0xbf4e('0x17e')});db[_0xbf4e('0x68')][_0xbf4e('0x124')](db[_0xbf4e('0xe')],{'as':'Agents','through':_0xbf4e('0x2a'),'hooks':!![]});db[_0xbf4e('0x68')][_0xbf4e('0x124')](db[_0xbf4e('0x170')],{'through':_0xbf4e('0x19e'),'as':'Teams'});db[_0xbf4e('0x125')]['hasMany'](db[_0xbf4e('0xd2')],{'as':_0xbf4e('0x15e'),'foreignKey':_0xbf4e('0x19f'),'onDelete':'cascade'});db['ChatGroup'][_0xbf4e('0x124')](db['User'],{'as':'Members','through':_0xbf4e('0x126')});db['ChatProactiveAction'][_0xbf4e('0x122')](db[_0xbf4e('0x60')],{'as':_0xbf4e('0x19b'),'foreignKey':_0xbf4e('0x17e')});db[_0xbf4e('0x6c')][_0xbf4e('0x115')](db[_0xbf4e('0x127')],{'as':_0xbf4e('0x128'),'foreignKey':'CompanyId'});db['CmContact'][_0xbf4e('0x115')](db[_0xbf4e('0x150')],{'as':_0xbf4e('0x1a0'),'foreignKey':_0xbf4e('0x175')});db[_0xbf4e('0x127')][_0xbf4e('0x115')](db[_0xbf4e('0x117')],{'as':_0xbf4e('0x118'),'foreignKey':_0xbf4e('0x175')});db[_0xbf4e('0x127')][_0xbf4e('0x115')](db[_0xbf4e('0x119')],{'as':_0xbf4e('0x151'),'foreignKey':_0xbf4e('0x175')});db['CmContact'][_0xbf4e('0x115')](db[_0xbf4e('0x73')],{'as':_0xbf4e('0x73'),'foreignKey':_0xbf4e('0x175')});db[_0xbf4e('0x127')]['hasMany'](db[_0xbf4e('0xd7')],{'as':_0xbf4e('0x153'),'foreignKey':'ContactId'});db[_0xbf4e('0x127')]['hasMany'](db['OpenchannelInteraction'],{'as':_0xbf4e('0x11b'),'foreignKey':_0xbf4e('0x175'),'onDelete':_0xbf4e('0x181')});db['CmContact'][_0xbf4e('0x115')](db[_0xbf4e('0x65')],{'as':'ChatInteractions','foreignKey':_0xbf4e('0x175'),'onDelete':'restrict'});db[_0xbf4e('0x127')][_0xbf4e('0x115')](db[_0xbf4e('0x131')],{'as':_0xbf4e('0x11d'),'foreignKey':_0xbf4e('0x175'),'onDelete':_0xbf4e('0x181')});db['CmContact'][_0xbf4e('0x115')](db[_0xbf4e('0x11e')],{'as':_0xbf4e('0x11f'),'foreignKey':_0xbf4e('0x175'),'onDelete':_0xbf4e('0x181')});db[_0xbf4e('0x127')]['hasMany'](db['MailInteraction'],{'as':'MailInteractions','foreignKey':_0xbf4e('0x175'),'onDelete':_0xbf4e('0x181')});db['CmContact'][_0xbf4e('0x122')](db['CmCompany'],{'as':_0xbf4e('0x1a1'),'foreignKey':_0xbf4e('0x1a2')});db[_0xbf4e('0x127')][_0xbf4e('0x122')](db[_0xbf4e('0x12a')],{'as':_0xbf4e('0x16c'),'foreignKey':_0xbf4e('0x16d'),'onDelete':_0xbf4e('0x112')});db[_0xbf4e('0x127')][_0xbf4e('0x124')](db[_0xbf4e('0xe')],{'as':_0xbf4e('0x17a'),'through':_0xbf4e('0x129')});db[_0xbf4e('0x127')][_0xbf4e('0x124')](db[_0xbf4e('0x182')],{'as':_0xbf4e('0x178'),'through':'cm_contact_has_tags'});db[_0xbf4e('0x127')][_0xbf4e('0x124')](db[_0xbf4e('0x182')],{'through':_0xbf4e('0x1a3'),'as':'ThroughTags'});db['CmHopper']['belongsTo'](db[_0xbf4e('0x127')],{'as':_0xbf4e('0x174'),'foreignKey':'ContactId','onDelete':_0xbf4e('0x112')});db[_0xbf4e('0x150')][_0xbf4e('0x122')](db[_0xbf4e('0x12a')],{'as':_0xbf4e('0x16c'),'foreignKey':'ListId','onDelete':_0xbf4e('0x112')});db[_0xbf4e('0x150')][_0xbf4e('0x122')](db[_0xbf4e('0xe')],{'as':_0xbf4e('0x199'),'foreignKey':_0xbf4e('0x113')});db[_0xbf4e('0x150')][_0xbf4e('0x122')](db[_0xbf4e('0x15')],{'as':_0xbf4e('0x1a4'),'foreignKey':'VoiceQueueId','onDelete':_0xbf4e('0x112')});db[_0xbf4e('0x150')]['belongsTo'](db[_0xbf4e('0xe7')],{'as':_0xbf4e('0xe7'),'foreignKey':_0xbf4e('0x1a5'),'onDelete':_0xbf4e('0x112')});db['CmHopper'][_0xbf4e('0x122')](db[_0xbf4e('0xe')],{'as':_0xbf4e('0x176'),'foreignKey':_0xbf4e('0x1a6')});db[_0xbf4e('0x6f')][_0xbf4e('0x122')](db[_0xbf4e('0x127')],{'as':_0xbf4e('0x174'),'foreignKey':_0xbf4e('0x175'),'onDelete':_0xbf4e('0x112')});db['CmHopperBlack'][_0xbf4e('0x122')](db[_0xbf4e('0x12a')],{'as':_0xbf4e('0x16c'),'foreignKey':_0xbf4e('0x16d'),'onDelete':_0xbf4e('0x112')});db[_0xbf4e('0x6f')][_0xbf4e('0x122')](db[_0xbf4e('0x15')],{'as':_0xbf4e('0x1a4'),'foreignKey':_0xbf4e('0x14f'),'onDelete':_0xbf4e('0x112')});db[_0xbf4e('0x6f')][_0xbf4e('0x122')](db[_0xbf4e('0xe7')],{'as':_0xbf4e('0xe7'),'foreignKey':_0xbf4e('0x1a5'),'onDelete':_0xbf4e('0x112')});db['Automation']['hasMany'](db['Condition'],{'as':{'plural':'All','singular':_0xbf4e('0x1a7')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0xbf4e('0x79')]['hasMany'](db[_0xbf4e('0x7e')],{'as':{'plural':_0xbf4e('0x1a8'),'singular':'OneAny'},'foreignKey':_0xbf4e('0x1a9'),'onDelete':_0xbf4e('0x112'),'hooks':!![]});db[_0xbf4e('0x79')][_0xbf4e('0x115')](db[_0xbf4e('0x77')],{'as':_0xbf4e('0x1aa'),'foreignKey':'AutomationId','onDelete':_0xbf4e('0x112'),'hooks':!![]});db[_0xbf4e('0x7c')][_0xbf4e('0x115')](db[_0xbf4e('0x7c')],{'as':_0xbf4e('0x167'),'foreignKey':_0xbf4e('0x1ab'),'onDelete':_0xbf4e('0x112')});db[_0xbf4e('0x80')][_0xbf4e('0x115')](db['Interval'],{'as':'Intervals','foreignKey':_0xbf4e('0x157'),'onDelete':_0xbf4e('0x112'),'hooks':!![],'required':![]});db[_0xbf4e('0x80')][_0xbf4e('0x115')](db[_0xbf4e('0x149')],{'as':'Extensions','foreignKey':_0xbf4e('0x157'),'onDelete':_0xbf4e('0x181')});db[_0xbf4e('0x80')][_0xbf4e('0x115')](db['MailApplication'],{'as':'MailApplications','foreignKey':_0xbf4e('0x157')});db[_0xbf4e('0x80')][_0xbf4e('0x115')](db['ChatApplication'],{'as':_0xbf4e('0x1ac'),'foreignKey':_0xbf4e('0x157')});db[_0xbf4e('0x80')]['hasMany'](db[_0xbf4e('0x49')],{'as':_0xbf4e('0x1ad'),'foreignKey':_0xbf4e('0x157')});db[_0xbf4e('0x80')][_0xbf4e('0x115')](db[_0xbf4e('0x51')],{'as':'SmsApplications','foreignKey':_0xbf4e('0x157')});db['Schedule'][_0xbf4e('0x122')](db[_0xbf4e('0x36')],{});db['Schedule'][_0xbf4e('0x122')](db['AnalyticDefaultReport'],{'foreignKey':_0xbf4e('0x1ae')});db['Schedule'][_0xbf4e('0x122')](db[_0xbf4e('0x92')],{'foreignKey':'CustomReportId'});db['Sound'][_0xbf4e('0x124')](db[_0xbf4e('0x14a')],{'as':_0xbf4e('0x1af'),'through':_0xbf4e('0x14d'),'onDelete':_0xbf4e('0x181')});db[_0xbf4e('0x182')][_0xbf4e('0x124')](db[_0xbf4e('0x127')],{'through':_0xbf4e('0x1a3')});db[_0xbf4e('0x182')][_0xbf4e('0x124')](db['ChatInteraction'],{'through':_0xbf4e('0x19d')});db[_0xbf4e('0x182')][_0xbf4e('0x124')](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db[_0xbf4e('0x182')][_0xbf4e('0x124')](db[_0xbf4e('0x131')],{'through':_0xbf4e('0x1b0')});db[_0xbf4e('0x182')][_0xbf4e('0x124')](db[_0xbf4e('0x11e')],{'through':_0xbf4e('0x188')});db['Tag'][_0xbf4e('0x124')](db['OpenchannelInteraction'],{'through':_0xbf4e('0x190')});db['Tag'][_0xbf4e('0x124')](db[_0xbf4e('0x103')],{'through':_0xbf4e('0x1b1')});db[_0xbf4e('0x8a')][_0xbf4e('0x115')](db['Condition'],{'as':{'plural':'AllConditions','singular':_0xbf4e('0x1b2')},'foreignKey':'TriggerAllId','onDelete':_0xbf4e('0x112'),'hooks':!![]});db[_0xbf4e('0x8a')][_0xbf4e('0x115')](db[_0xbf4e('0x7e')],{'as':{'plural':'AnyConditions','singular':'AnyCondition'},'foreignKey':_0xbf4e('0x1b3'),'onDelete':_0xbf4e('0x112'),'hooks':!![]});db['Trigger']['hasMany'](db[_0xbf4e('0x77')],{'as':'Actions','foreignKey':_0xbf4e('0x1b4'),'onDelete':_0xbf4e('0x112'),'hooks':!![]});db[_0xbf4e('0x92')][_0xbf4e('0x115')](db[_0xbf4e('0x1b5')],{'as':_0xbf4e('0x1b6'),'onDelete':_0xbf4e('0x112'),'foreignKey':'CustomReportId','hooks':!![]});db[_0xbf4e('0x1b7')]['hasMany'](db['AnalyticFieldReport'],{'as':_0xbf4e('0x1b6'),'onDelete':_0xbf4e('0x112'),'foreignKey':_0xbf4e('0x1ae')});db[_0xbf4e('0x1b8')][_0xbf4e('0x115')](db[_0xbf4e('0x1b5')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xbf4e('0x1b9')});db[_0xbf4e('0x1b5')]['belongsTo'](db[_0xbf4e('0x1b8')],{'foreignKey':_0xbf4e('0x1b9')});db[_0xbf4e('0x9a')][_0xbf4e('0x115')](db[_0xbf4e('0x1ba')],{'as':_0xbf4e('0x1bb'),'onDelete':_0xbf4e('0x112'),'foreignKey':_0xbf4e('0x1bc')});db[_0xbf4e('0x1ba')][_0xbf4e('0x115')](db[_0xbf4e('0x1bd')],{'as':_0xbf4e('0x1be'),'onDelete':_0xbf4e('0x112'),'foreignKey':_0xbf4e('0x1bf')});db[_0xbf4e('0x1ba')][_0xbf4e('0x115')](db[_0xbf4e('0x1bd')],{'as':'Descriptions','onDelete':_0xbf4e('0x112'),'foreignKey':_0xbf4e('0x1c0')});db[_0xbf4e('0x1ba')][_0xbf4e('0x115')](db[_0xbf4e('0x1bd')],{'as':_0xbf4e('0x1b6'),'onDelete':_0xbf4e('0x112'),'foreignKey':'FieldId'});db['SalesforceConfiguration'][_0xbf4e('0x122')](db[_0xbf4e('0x9a')],{'as':'Account','foreignKey':'AccountId'});db['SalesforceField'][_0xbf4e('0x115')](db['SalesforceField'],{'as':_0xbf4e('0x1c1'),'foreignKey':_0xbf4e('0x1bf')});db['SalesforceField'][_0xbf4e('0x115')](db['SalesforceField'],{'as':_0xbf4e('0x1c2'),'foreignKey':_0xbf4e('0x1c0')});db[_0xbf4e('0x1bd')]['hasMany'](db['SalesforceField'],{'as':'Field','foreignKey':'FieldId'});db[_0xbf4e('0x1bd')][_0xbf4e('0x122')](db[_0xbf4e('0x8c')],{'as':'Variable','foreignKey':'VariableId'});db[_0xbf4e('0x9e')][_0xbf4e('0x115')](db['SugarcrmConfiguration'],{'as':_0xbf4e('0x1bb'),'onDelete':_0xbf4e('0x112'),'foreignKey':_0xbf4e('0x1bc')});db[_0xbf4e('0xa0')][_0xbf4e('0x115')](db['SugarcrmField'],{'as':'Subjects','onDelete':_0xbf4e('0x112'),'foreignKey':_0xbf4e('0x1bf')});db[_0xbf4e('0xa0')][_0xbf4e('0x115')](db[_0xbf4e('0xa2')],{'as':_0xbf4e('0x1c3'),'onDelete':_0xbf4e('0x112'),'foreignKey':_0xbf4e('0x1c0')});db[_0xbf4e('0xa0')][_0xbf4e('0x115')](db[_0xbf4e('0xa2')],{'as':_0xbf4e('0x1b6'),'onDelete':'cascade','foreignKey':_0xbf4e('0x1c4')});db['SugarcrmConfiguration'][_0xbf4e('0x122')](db['SugarcrmAccount'],{'as':_0xbf4e('0x173'),'foreignKey':_0xbf4e('0x1bc')});db[_0xbf4e('0xa2')][_0xbf4e('0x115')](db[_0xbf4e('0xa2')],{'as':_0xbf4e('0x1c1'),'foreignKey':_0xbf4e('0x1bf')});db[_0xbf4e('0xa2')]['hasMany'](db[_0xbf4e('0xa2')],{'as':_0xbf4e('0x1c2'),'foreignKey':'DescriptionId'});db[_0xbf4e('0xa2')][_0xbf4e('0x115')](db[_0xbf4e('0xa2')],{'as':_0xbf4e('0x1c5'),'foreignKey':'FieldId'});db[_0xbf4e('0xa2')]['belongsTo'](db[_0xbf4e('0x8c')],{'as':_0xbf4e('0x8c'),'foreignKey':_0xbf4e('0x1c6')});db[_0xbf4e('0xa4')][_0xbf4e('0x115')](db[_0xbf4e('0x1c7')],{'as':_0xbf4e('0x1bb'),'onDelete':_0xbf4e('0x112'),'foreignKey':'AccountId'});db[_0xbf4e('0x1c7')][_0xbf4e('0x115')](db['DeskField'],{'as':_0xbf4e('0x1be'),'onDelete':_0xbf4e('0x112'),'foreignKey':_0xbf4e('0x1bf')});db[_0xbf4e('0x1c7')]['hasMany'](db[_0xbf4e('0xa7')],{'as':_0xbf4e('0x1c3'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xbf4e('0x1c7')][_0xbf4e('0x115')](db[_0xbf4e('0xa7')],{'as':_0xbf4e('0x1b6'),'onDelete':_0xbf4e('0x112'),'foreignKey':_0xbf4e('0x1c4')});db[_0xbf4e('0x1c7')][_0xbf4e('0x122')](db[_0xbf4e('0xa4')],{'as':_0xbf4e('0x173'),'foreignKey':_0xbf4e('0x1bc')});db['DeskConfiguration']['belongsToMany'](db[_0xbf4e('0x182')],{'through':_0xbf4e('0x1c8')});db[_0xbf4e('0xa7')][_0xbf4e('0x115')](db[_0xbf4e('0xa7')],{'as':_0xbf4e('0x1c1'),'foreignKey':_0xbf4e('0x1bf')});db[_0xbf4e('0xa7')]['hasMany'](db[_0xbf4e('0xa7')],{'as':_0xbf4e('0x1c2'),'foreignKey':'DescriptionId'});db[_0xbf4e('0xa7')][_0xbf4e('0x115')](db[_0xbf4e('0xa7')],{'as':'Field','foreignKey':_0xbf4e('0x1c4')});db[_0xbf4e('0xa7')]['belongsTo'](db[_0xbf4e('0x8c')],{'as':'Variable','foreignKey':_0xbf4e('0x1c6')});db['ZohoAccount'][_0xbf4e('0x115')](db['ZohoConfiguration'],{'as':_0xbf4e('0x1bb'),'onDelete':_0xbf4e('0x112'),'foreignKey':_0xbf4e('0x1bc')});db[_0xbf4e('0xab')][_0xbf4e('0x115')](db[_0xbf4e('0xad')],{'as':_0xbf4e('0x1be'),'onDelete':_0xbf4e('0x112'),'foreignKey':_0xbf4e('0x1bf')});db[_0xbf4e('0xab')][_0xbf4e('0x115')](db['ZohoField'],{'as':_0xbf4e('0x1c3'),'onDelete':'cascade','foreignKey':_0xbf4e('0x1c0')});db[_0xbf4e('0xab')]['hasMany'](db[_0xbf4e('0xad')],{'as':_0xbf4e('0x1b6'),'onDelete':_0xbf4e('0x112'),'foreignKey':'FieldId'});db['ZohoConfiguration'][_0xbf4e('0x122')](db['ZohoAccount'],{'as':_0xbf4e('0x173'),'foreignKey':_0xbf4e('0x1bc')});db[_0xbf4e('0xad')][_0xbf4e('0x115')](db[_0xbf4e('0xad')],{'as':_0xbf4e('0x1c1'),'foreignKey':_0xbf4e('0x1bf')});db['ZohoField']['hasMany'](db[_0xbf4e('0xad')],{'as':_0xbf4e('0x1c2'),'foreignKey':_0xbf4e('0x1c0')});db[_0xbf4e('0xad')][_0xbf4e('0x115')](db[_0xbf4e('0xad')],{'as':_0xbf4e('0x1c5'),'foreignKey':'FieldId'});db['ZohoField'][_0xbf4e('0x122')](db[_0xbf4e('0x8c')],{'as':_0xbf4e('0x8c'),'foreignKey':_0xbf4e('0x1c6')});db[_0xbf4e('0xaf')][_0xbf4e('0x115')](db[_0xbf4e('0xb1')],{'as':_0xbf4e('0x1bb'),'onDelete':_0xbf4e('0x112'),'foreignKey':_0xbf4e('0x1bc')});db[_0xbf4e('0xb1')][_0xbf4e('0x115')](db[_0xbf4e('0x1c9')],{'as':_0xbf4e('0x1be'),'foreignKey':_0xbf4e('0x1bf')});db[_0xbf4e('0xb1')][_0xbf4e('0x115')](db[_0xbf4e('0x1c9')],{'as':_0xbf4e('0x1c3'),'foreignKey':_0xbf4e('0x1c0')});db[_0xbf4e('0xb1')][_0xbf4e('0x115')](db[_0xbf4e('0x1c9')],{'as':_0xbf4e('0x1b6'),'foreignKey':_0xbf4e('0x1c4')});db[_0xbf4e('0xb1')]['belongsTo'](db[_0xbf4e('0xaf')],{'as':'Account','foreignKey':_0xbf4e('0x1bc')});db['ZendeskConfiguration'][_0xbf4e('0x124')](db[_0xbf4e('0x182')],{'through':_0xbf4e('0x1ca')});db[_0xbf4e('0x1c9')]['hasMany'](db[_0xbf4e('0x1c9')],{'as':_0xbf4e('0x1c1'),'foreignKey':'SubjectId'});db[_0xbf4e('0x1c9')]['hasMany'](db[_0xbf4e('0x1c9')],{'as':'Description','foreignKey':_0xbf4e('0x1c0')});db[_0xbf4e('0x1c9')]['hasMany'](db[_0xbf4e('0x1c9')],{'as':_0xbf4e('0x1c5'),'foreignKey':_0xbf4e('0x1c4')});db[_0xbf4e('0x1c9')][_0xbf4e('0x122')](db['Variable'],{'as':_0xbf4e('0x8c'),'foreignKey':_0xbf4e('0x1c6')});db[_0xbf4e('0xb4')]['hasMany'](db[_0xbf4e('0xb6')],{'as':_0xbf4e('0x1bb'),'onDelete':_0xbf4e('0x112'),'foreignKey':_0xbf4e('0x1bc')});db['FreshdeskConfiguration'][_0xbf4e('0x115')](db['FreshdeskField'],{'as':_0xbf4e('0x1be'),'onDelete':_0xbf4e('0x112'),'foreignKey':_0xbf4e('0x1bf')});db[_0xbf4e('0xb6')]['hasMany'](db[_0xbf4e('0xb8')],{'as':'Descriptions','onDelete':_0xbf4e('0x112'),'foreignKey':_0xbf4e('0x1c0')});db['FreshdeskConfiguration'][_0xbf4e('0x115')](db[_0xbf4e('0xb8')],{'as':'Fields','onDelete':_0xbf4e('0x112'),'foreignKey':_0xbf4e('0x1c4')});db[_0xbf4e('0xb6')]['belongsTo'](db[_0xbf4e('0xb4')],{'as':_0xbf4e('0x173'),'foreignKey':'AccountId'});db[_0xbf4e('0xb6')]['belongsToMany'](db[_0xbf4e('0x182')],{'through':'int_freshdesk_configuration_has_tags'});db['FreshdeskField'][_0xbf4e('0x115')](db[_0xbf4e('0xb8')],{'as':'Subject','foreignKey':_0xbf4e('0x1bf')});db['FreshdeskField']['hasMany'](db['FreshdeskField'],{'as':_0xbf4e('0x1c2'),'foreignKey':_0xbf4e('0x1c0')});db[_0xbf4e('0xb8')][_0xbf4e('0x115')](db[_0xbf4e('0xb8')],{'as':_0xbf4e('0x1c5'),'foreignKey':_0xbf4e('0x1c4')});db['FreshdeskField'][_0xbf4e('0x122')](db['Variable'],{'as':_0xbf4e('0x8c'),'foreignKey':_0xbf4e('0x1c6')});db[_0xbf4e('0xba')][_0xbf4e('0x115')](db[_0xbf4e('0xbc')],{'as':'Configurations','onDelete':_0xbf4e('0x112'),'foreignKey':_0xbf4e('0x1bc')});db[_0xbf4e('0xbc')][_0xbf4e('0x115')](db[_0xbf4e('0xbe')],{'as':_0xbf4e('0x1be'),'foreignKey':'SubjectId'});db[_0xbf4e('0xbc')]['hasMany'](db[_0xbf4e('0xbe')],{'as':_0xbf4e('0x1c3'),'foreignKey':_0xbf4e('0x1c0')});db[_0xbf4e('0xbc')]['hasMany'](db[_0xbf4e('0xbe')],{'as':_0xbf4e('0x1b6'),'foreignKey':_0xbf4e('0x1c4')});db[_0xbf4e('0xbc')]['belongsTo'](db[_0xbf4e('0xba')],{'as':_0xbf4e('0x173'),'foreignKey':_0xbf4e('0x1bc')});db['VtigerField']['hasMany'](db[_0xbf4e('0xbe')],{'as':_0xbf4e('0x1c1'),'foreignKey':_0xbf4e('0x1bf')});db[_0xbf4e('0xbe')][_0xbf4e('0x115')](db['VtigerField'],{'as':_0xbf4e('0x1c2'),'foreignKey':'DescriptionId'});db[_0xbf4e('0xbe')][_0xbf4e('0x115')](db[_0xbf4e('0xbe')],{'as':'Field','foreignKey':_0xbf4e('0x1c4')});db[_0xbf4e('0xbe')][_0xbf4e('0x122')](db[_0xbf4e('0x8c')],{'as':_0xbf4e('0x8c'),'foreignKey':_0xbf4e('0x1c6')});db[_0xbf4e('0xc0')][_0xbf4e('0x115')](db[_0xbf4e('0xc2')],{'as':_0xbf4e('0x1bb'),'onDelete':_0xbf4e('0x112'),'foreignKey':_0xbf4e('0x1bc')});db[_0xbf4e('0xc2')]['hasMany'](db['ServicenowField'],{'as':_0xbf4e('0x1be'),'foreignKey':_0xbf4e('0x1bf')});db[_0xbf4e('0xc2')]['hasMany'](db[_0xbf4e('0xc4')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ServicenowConfiguration'][_0xbf4e('0x115')](db[_0xbf4e('0xc4')],{'as':_0xbf4e('0x1b6'),'foreignKey':_0xbf4e('0x1c4')});db[_0xbf4e('0xc2')][_0xbf4e('0x122')](db[_0xbf4e('0xc0')],{'as':'Account','foreignKey':'AccountId'});db['ServicenowField'][_0xbf4e('0x115')](db['ServicenowField'],{'as':_0xbf4e('0x1c1'),'foreignKey':_0xbf4e('0x1bf')});db[_0xbf4e('0xc4')][_0xbf4e('0x115')](db[_0xbf4e('0xc4')],{'as':_0xbf4e('0x1c2'),'foreignKey':_0xbf4e('0x1c0')});db['ServicenowField']['hasMany'](db[_0xbf4e('0xc4')],{'as':'Field','foreignKey':_0xbf4e('0x1c4')});db[_0xbf4e('0xc4')][_0xbf4e('0x122')](db[_0xbf4e('0x8c')],{'as':_0xbf4e('0x8c'),'foreignKey':_0xbf4e('0x1c6')});db[_0xbf4e('0xc6')][_0xbf4e('0x115')](db['Dynamics365Configuration'],{'as':_0xbf4e('0x1bb'),'onDelete':'cascade','foreignKey':_0xbf4e('0x1bc')});db[_0xbf4e('0xc7')][_0xbf4e('0x115')](db[_0xbf4e('0xc8')],{'as':'Subjects','onDelete':_0xbf4e('0x112'),'foreignKey':_0xbf4e('0x1bf')});db['Dynamics365Configuration'][_0xbf4e('0x115')](db[_0xbf4e('0xc8')],{'as':'Descriptions','onDelete':_0xbf4e('0x112'),'foreignKey':_0xbf4e('0x1c0')});db[_0xbf4e('0xc7')]['hasMany'](db[_0xbf4e('0xc8')],{'as':_0xbf4e('0x1b6'),'onDelete':_0xbf4e('0x112'),'foreignKey':'FieldId'});db[_0xbf4e('0xc7')][_0xbf4e('0x122')](db[_0xbf4e('0xc6')],{'as':_0xbf4e('0x173'),'foreignKey':'AccountId'});db[_0xbf4e('0xc8')]['hasMany'](db[_0xbf4e('0xc8')],{'as':_0xbf4e('0x1c1'),'foreignKey':_0xbf4e('0x1bf')});db['Dynamics365Field']['hasMany'](db[_0xbf4e('0xc8')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xbf4e('0xc8')][_0xbf4e('0x115')](db['Dynamics365Field'],{'as':_0xbf4e('0x1c5'),'foreignKey':'FieldId'});db['Dynamics365Field'][_0xbf4e('0x122')](db[_0xbf4e('0x8c')],{'as':_0xbf4e('0x8c'),'foreignKey':_0xbf4e('0x1c6')});db[_0xbf4e('0xc9')][_0xbf4e('0x115')](db['FreshsalesConfiguration'],{'as':'Configurations','onDelete':_0xbf4e('0x112'),'foreignKey':_0xbf4e('0x1bc')});db['FreshsalesConfiguration'][_0xbf4e('0x115')](db[_0xbf4e('0xcd')],{'as':'Subjects','foreignKey':_0xbf4e('0x1bf')});db[_0xbf4e('0xcb')][_0xbf4e('0x115')](db[_0xbf4e('0xcd')],{'as':_0xbf4e('0x1c3'),'foreignKey':_0xbf4e('0x1c0')});db[_0xbf4e('0xcb')][_0xbf4e('0x115')](db[_0xbf4e('0xcd')],{'as':_0xbf4e('0x1b6'),'foreignKey':_0xbf4e('0x1c4')});db[_0xbf4e('0xcb')]['belongsTo'](db[_0xbf4e('0xc9')],{'as':_0xbf4e('0x173'),'foreignKey':_0xbf4e('0x1bc')});db['FreshsalesField'][_0xbf4e('0x115')](db[_0xbf4e('0xcd')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xbf4e('0xcd')][_0xbf4e('0x115')](db[_0xbf4e('0xcd')],{'as':_0xbf4e('0x1c2'),'foreignKey':_0xbf4e('0x1c0')});db[_0xbf4e('0xcd')][_0xbf4e('0x115')](db[_0xbf4e('0xcd')],{'as':_0xbf4e('0x1c5'),'foreignKey':'FieldId'});db[_0xbf4e('0xcd')]['belongsTo'](db['Variable'],{'as':_0xbf4e('0x8c'),'foreignKey':_0xbf4e('0x1c6')});db[_0xbf4e('0xd0')]['belongsTo'](db['ChatWebsite'],{});db[_0xbf4e('0xd0')][_0xbf4e('0x122')](db['CmList'],{'as':_0xbf4e('0x16c'),'foreignKey':_0xbf4e('0x16d')});db[_0xbf4e('0xd0')][_0xbf4e('0x122')](db[_0xbf4e('0x127')],{'as':_0xbf4e('0x174'),'foreignKey':_0xbf4e('0x175')});db['ChatQueueReport'][_0xbf4e('0x122')](db['ChatInteraction'],{});db[_0xbf4e('0xd0')][_0xbf4e('0x122')](db[_0xbf4e('0x198')],{});db[_0xbf4e('0xd0')]['belongsTo'](db[_0xbf4e('0xe')],{});db[_0xbf4e('0xd0')][_0xbf4e('0x122')](db['ChatQueue'],{});db['ChatInternalMessage']['belongsTo'](db[_0xbf4e('0xe')],{'onDelete':_0xbf4e('0x112'),'foreignKey':_0xbf4e('0x1cb')});db[_0xbf4e('0xd2')][_0xbf4e('0x122')](db[_0xbf4e('0xe')],{'onDelete':_0xbf4e('0x112'),'foreignKey':_0xbf4e('0x1cc')});db[_0xbf4e('0xd7')][_0xbf4e('0x115')](db[_0xbf4e('0xd5')],{'foreignKey':'SessionId','onDelete':_0xbf4e('0x112')});db[_0xbf4e('0xd7')][_0xbf4e('0x115')](db[_0xbf4e('0xd4')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0xbf4e('0xd9')]['belongsTo'](db['SmsAccount'],{});db[_0xbf4e('0xd9')]['belongsTo'](db['CmList'],{'as':_0xbf4e('0x16c'),'foreignKey':_0xbf4e('0x16d')});db[_0xbf4e('0xd9')][_0xbf4e('0x122')](db[_0xbf4e('0x127')],{'as':_0xbf4e('0x174'),'foreignKey':_0xbf4e('0x175')});db[_0xbf4e('0xd9')]['belongsTo'](db[_0xbf4e('0x131')],{});db[_0xbf4e('0xd9')][_0xbf4e('0x122')](db[_0xbf4e('0x54')],{});db[_0xbf4e('0xd9')][_0xbf4e('0x122')](db[_0xbf4e('0xe')],{});db[_0xbf4e('0xd9')][_0xbf4e('0x122')](db[_0xbf4e('0x56')],{});db[_0xbf4e('0xde')][_0xbf4e('0x115')](db[_0xbf4e('0xd7')],{'foreignKey':'ProjectId'});db[_0xbf4e('0xde')][_0xbf4e('0x115')](db['JscriptyQuestionReport'],{'foreignKey':'ProjectId'});db[_0xbf4e('0xde')][_0xbf4e('0x115')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db['SquareProject'][_0xbf4e('0x124')](db[_0xbf4e('0xe')],{'as':'Users','through':_0xbf4e('0x1cd')});db[_0xbf4e('0x170')]['belongsToMany'](db[_0xbf4e('0xe')],{'as':_0xbf4e('0x15a'),'through':_0xbf4e('0x12d')});db[_0xbf4e('0x170')]['belongsToMany'](db['VoiceQueue'],{'through':_0xbf4e('0x10c'),'as':_0xbf4e('0x134')});db[_0xbf4e('0x170')][_0xbf4e('0x124')](db[_0xbf4e('0x38')],{'through':_0xbf4e('0x171'),'as':'MailQueues'});db[_0xbf4e('0x170')][_0xbf4e('0x124')](db[_0xbf4e('0x68')],{'through':_0xbf4e('0x19e'),'as':_0xbf4e('0x138')});db[_0xbf4e('0x170')][_0xbf4e('0x124')](db[_0xbf4e('0x187')],{'through':'team_has_fax_queues','as':'FaxQueues'});db[_0xbf4e('0x170')]['belongsToMany'](db[_0xbf4e('0x56')],{'through':_0xbf4e('0x1ce'),'as':_0xbf4e('0x139')});db[_0xbf4e('0x170')][_0xbf4e('0x124')](db[_0xbf4e('0x13a')],{'through':_0xbf4e('0x1cf'),'as':_0xbf4e('0x13b')});db[_0xbf4e('0x170')][_0xbf4e('0x124')](db[_0xbf4e('0x109')],{'through':_0xbf4e('0x1d0'),'as':_0xbf4e('0x13c')});db[_0xbf4e('0x170')]['belongsToMany'](db['VoicePrefix'],{'through':'TeamVoicePrefix','as':_0xbf4e('0x136')});db[_0xbf4e('0xe7')][_0xbf4e('0x115')](db['CmHopper'],{'as':_0xbf4e('0x1a0'),'foreignKey':_0xbf4e('0x1a5')});db[_0xbf4e('0xe7')][_0xbf4e('0x115')](db[_0xbf4e('0x117')],{'as':_0xbf4e('0x118'),'foreignKey':_0xbf4e('0x1a5')});db['Campaign'][_0xbf4e('0x115')](db[_0xbf4e('0x119')],{'as':_0xbf4e('0x151'),'foreignKey':'CampaignId'});db[_0xbf4e('0xe7')][_0xbf4e('0x115')](db[_0xbf4e('0x6f')],{'as':_0xbf4e('0x152'),'foreignKey':_0xbf4e('0x1a5')});db['Campaign'][_0xbf4e('0x122')](db[_0xbf4e('0x24')],{'as':'Trunk','foreignKey':_0xbf4e('0x154')});db[_0xbf4e('0xe7')][_0xbf4e('0x122')](db[_0xbf4e('0x24')],{'as':_0xbf4e('0x155'),'foreignKey':'TrunkBackupId'});db[_0xbf4e('0xe7')]['belongsTo'](db['Interval'],{'as':'Interval','foreignKey':_0xbf4e('0x157')});db[_0xbf4e('0xe7')][_0xbf4e('0x122')](db[_0xbf4e('0xe2')],{'as':_0xbf4e('0xe2'),'foreignKey':_0xbf4e('0x1d1')});db[_0xbf4e('0xe7')][_0xbf4e('0x124')](db[_0xbf4e('0x12a')],{'as':'Lists','through':'campaigns_has_cm_lists'});db[_0xbf4e('0xe7')]['belongsToMany'](db[_0xbf4e('0x12a')],{'as':_0xbf4e('0x1d2'),'through':_0xbf4e('0x1d3')});db[_0xbf4e('0x17c')][_0xbf4e('0x122')](db[_0xbf4e('0x17f')],{'as':_0xbf4e('0x17f'),'foreignKey':_0xbf4e('0x180')});db['MailTransferReport'][_0xbf4e('0x122')](db[_0xbf4e('0x3d')],{});db[_0xbf4e('0xee')]['belongsTo'](db[_0xbf4e('0x3b')],{});db[_0xbf4e('0xee')][_0xbf4e('0x122')](db[_0xbf4e('0x36')],{'foreignKey':_0xbf4e('0x1d4'),'as':_0xbf4e('0x1d5')});db['MailTransferReport'][_0xbf4e('0x122')](db[_0xbf4e('0xe')],{'foreignKey':_0xbf4e('0x1d6'),'as':_0xbf4e('0x1d7')});db[_0xbf4e('0xee')]['belongsTo'](db[_0xbf4e('0xe')],{'foreignKey':_0xbf4e('0x1d8'),'as':_0xbf4e('0x1d9')});db[_0xbf4e('0xee')][_0xbf4e('0x122')](db[_0xbf4e('0x38')],{'foreignKey':_0xbf4e('0x1da'),'as':'ToQueue'});db['MailTransferReport'][_0xbf4e('0x122')](db[_0xbf4e('0x36')],{'foreignKey':_0xbf4e('0x1db'),'as':'ToAccount'});db[_0xbf4e('0xf0')][_0xbf4e('0x122')](db[_0xbf4e('0x198')],{});db[_0xbf4e('0xf0')][_0xbf4e('0x122')](db[_0xbf4e('0x65')],{});db[_0xbf4e('0xf0')]['belongsTo'](db[_0xbf4e('0x60')],{'foreignKey':_0xbf4e('0x1dc'),'as':'FromAccount'});db[_0xbf4e('0xf0')][_0xbf4e('0x122')](db[_0xbf4e('0xe')],{'foreignKey':_0xbf4e('0x1d6'),'as':_0xbf4e('0x1d7')});db['ChatTransferReport'][_0xbf4e('0x122')](db[_0xbf4e('0xe')],{'foreignKey':_0xbf4e('0x1d8'),'as':'ToAgent'});db[_0xbf4e('0xf0')][_0xbf4e('0x122')](db[_0xbf4e('0x68')],{'foreignKey':_0xbf4e('0x1dd'),'as':_0xbf4e('0x1de')});db[_0xbf4e('0xf0')][_0xbf4e('0x122')](db[_0xbf4e('0x60')],{'foreignKey':_0xbf4e('0x1df'),'as':_0xbf4e('0x1e0')});db[_0xbf4e('0xf2')][_0xbf4e('0x122')](db[_0xbf4e('0x4b')],{});db[_0xbf4e('0xf2')][_0xbf4e('0x122')](db[_0xbf4e('0x11e')],{});db[_0xbf4e('0xf2')][_0xbf4e('0x122')](db[_0xbf4e('0x47')],{'foreignKey':_0xbf4e('0x1e1'),'as':'FromAccount'});db[_0xbf4e('0xf2')]['belongsTo'](db[_0xbf4e('0xe')],{'foreignKey':_0xbf4e('0x1d6'),'as':_0xbf4e('0x1d7')});db[_0xbf4e('0xf2')][_0xbf4e('0x122')](db[_0xbf4e('0xe')],{'foreignKey':_0xbf4e('0x1d8'),'as':_0xbf4e('0x1d9')});db[_0xbf4e('0xf2')]['belongsTo'](db[_0xbf4e('0x187')],{'foreignKey':_0xbf4e('0x1e2'),'as':_0xbf4e('0x1de')});db[_0xbf4e('0xf2')][_0xbf4e('0x122')](db['FaxAccount'],{'foreignKey':_0xbf4e('0x1e3'),'as':_0xbf4e('0x1e0')});db[_0xbf4e('0xf4')][_0xbf4e('0x122')](db['OpenchannelMessage'],{});db[_0xbf4e('0xf4')]['belongsTo'](db[_0xbf4e('0x5c')],{});db['OpenchannelTransferReport'][_0xbf4e('0x122')](db[_0xbf4e('0x58')],{'foreignKey':_0xbf4e('0x1e4'),'as':'FromAccount'});db[_0xbf4e('0xf4')][_0xbf4e('0x122')](db['User'],{'foreignKey':_0xbf4e('0x1d6'),'as':'FromAgent'});db[_0xbf4e('0xf4')][_0xbf4e('0x122')](db[_0xbf4e('0xe')],{'foreignKey':_0xbf4e('0x1d8'),'as':_0xbf4e('0x1d9')});db['OpenchannelTransferReport'][_0xbf4e('0x122')](db[_0xbf4e('0x13a')],{'foreignKey':'ToOpenchannelQueueId','as':_0xbf4e('0x1de')});db[_0xbf4e('0xf4')][_0xbf4e('0x122')](db['OpenchannelAccount'],{'foreignKey':_0xbf4e('0x1e5'),'as':_0xbf4e('0x1e0')});db[_0xbf4e('0xf6')]['belongsTo'](db[_0xbf4e('0x54')],{});db[_0xbf4e('0xf6')]['belongsTo'](db[_0xbf4e('0x131')],{});db[_0xbf4e('0xf6')][_0xbf4e('0x122')](db[_0xbf4e('0x4f')],{'foreignKey':_0xbf4e('0x1e6'),'as':'FromAccount'});db[_0xbf4e('0xf6')][_0xbf4e('0x122')](db[_0xbf4e('0xe')],{'foreignKey':_0xbf4e('0x1d6'),'as':'FromAgent'});db['SmsTransferReport'][_0xbf4e('0x122')](db['User'],{'foreignKey':_0xbf4e('0x1d8'),'as':_0xbf4e('0x1d9')});db[_0xbf4e('0xf6')][_0xbf4e('0x122')](db[_0xbf4e('0x56')],{'foreignKey':'ToSmsQueueId','as':_0xbf4e('0x1de')});db[_0xbf4e('0xf6')][_0xbf4e('0x122')](db[_0xbf4e('0x4f')],{'foreignKey':_0xbf4e('0x1e7'),'as':'ToAccount'});db[_0xbf4e('0x12a')]['hasMany'](db[_0xbf4e('0x7c')],{'as':_0xbf4e('0x167'),'foreignKey':_0xbf4e('0x16d'),'onDelete':_0xbf4e('0x112')});db[_0xbf4e('0x12a')][_0xbf4e('0x115')](db['CmCustomField'],{'as':_0xbf4e('0x1e8'),'foreignKey':_0xbf4e('0x16d')});db[_0xbf4e('0x12a')][_0xbf4e('0x115')](db[_0xbf4e('0x127')],{'as':_0xbf4e('0x128'),'onDelete':_0xbf4e('0x112'),'foreignKey':_0xbf4e('0x16d')});db[_0xbf4e('0x12a')][_0xbf4e('0x115')](db[_0xbf4e('0x117')],{'as':_0xbf4e('0x118'),'foreignKey':'ListId'});db[_0xbf4e('0x12a')][_0xbf4e('0x115')](db[_0xbf4e('0x119')],{'as':_0xbf4e('0x11a'),'foreignKey':_0xbf4e('0x16d')});db[_0xbf4e('0x12a')][_0xbf4e('0x115')](db[_0xbf4e('0x73')],{'as':'ReportAgentPreview','foreignKey':'ListId'});db[_0xbf4e('0x12a')][_0xbf4e('0x124')](db[_0xbf4e('0x15')],{'as':_0xbf4e('0x1e9'),'through':'voice_queues_has_cm_lists'});db['CmList'][_0xbf4e('0x124')](db[_0xbf4e('0xe')],{'as':_0xbf4e('0x15a'),'through':_0xbf4e('0x12c')});db[_0xbf4e('0xf8')][_0xbf4e('0x115')](db['VoiceExtension'],{'as':_0xbf4e('0x1ea'),'onDelete':_0xbf4e('0x112')});db[_0xbf4e('0xf8')][_0xbf4e('0x124')](db[_0xbf4e('0xe')],{'as':_0xbf4e('0x15a'),'through':_0xbf4e('0x10f')});db['VoicePrefix']['belongsToMany'](db['Team'],{'through':'TeamVoicePrefix','as':'Teams'});db['UserProfile'][_0xbf4e('0x115')](db['User'],{'as':'Users','foreignKey':_0xbf4e('0x123')});db[_0xbf4e('0xfa')][_0xbf4e('0x115')](db[_0xbf4e('0xfc')],{'as':_0xbf4e('0x1eb'),'foreignKey':_0xbf4e('0x123'),'onDelete':'cascade'});db[_0xbf4e('0xfc')][_0xbf4e('0x115')](db[_0xbf4e('0x1ec')],{'as':_0xbf4e('0x1ed'),'foreignKey':_0xbf4e('0x1ee'),'onDelete':_0xbf4e('0x112')});db[_0xbf4e('0x145')]['hasMany'](db['Disposition'],{'as':_0xbf4e('0x167'),'foreignKey':_0xbf4e('0x1ef'),'onDelete':'cascade'});db[_0xbf4e('0x145')][_0xbf4e('0x115')](db[_0xbf4e('0x168')],{'as':_0xbf4e('0x169'),'foreignKey':_0xbf4e('0x1ef')});db[_0xbf4e('0x145')]['hasMany'](db[_0xbf4e('0x105')],{'as':_0xbf4e('0x15e'),'foreignKey':_0xbf4e('0x1ef')});db[_0xbf4e('0x145')][_0xbf4e('0x115')](db[_0xbf4e('0x103')],{'as':_0xbf4e('0x16a')});db['WhatsappAccount'][_0xbf4e('0x115')](db[_0xbf4e('0x101')],{'as':_0xbf4e('0x16b')});db[_0xbf4e('0x145')][_0xbf4e('0x122')](db[_0xbf4e('0x12a')],{'as':_0xbf4e('0x16c'),'foreignKey':_0xbf4e('0x16d')});db[_0xbf4e('0x145')][_0xbf4e('0x122')](db[_0xbf4e('0x81')],{'as':_0xbf4e('0x158'),'foreignKey':_0xbf4e('0x16f')});db[_0xbf4e('0x145')]['belongsToMany'](db[_0xbf4e('0xe')],{'as':'Agents','through':'user_has_whatsapp_accounts'});db[_0xbf4e('0x101')][_0xbf4e('0x122')](db['User'],{'onDelete':'restrict'});db[_0xbf4e('0x101')][_0xbf4e('0x122')](db[_0xbf4e('0x109')],{'onDelete':_0xbf4e('0x181')});db['WhatsappApplication'][_0xbf4e('0x122')](db['WhatsappAccount'],{'onDelete':_0xbf4e('0x181')});db[_0xbf4e('0x101')]['belongsTo'](db['Interval'],{'onDelete':_0xbf4e('0x181'),'foreignKey':_0xbf4e('0x157')});db[_0xbf4e('0x101')][_0xbf4e('0x122')](db['Tag'],{'onDelete':_0xbf4e('0x181'),'foreignKey':_0xbf4e('0x183')});db['WhatsappInteraction'][_0xbf4e('0x115')](db['WhatsappMessage'],{'as':_0xbf4e('0x15e'),'onDelete':_0xbf4e('0x112'),'foreignKey':_0xbf4e('0x1f0')});db[_0xbf4e('0x103')][_0xbf4e('0x122')](db[_0xbf4e('0x145')],{'as':_0xbf4e('0x173'),'foreignKey':_0xbf4e('0x1ef')});db[_0xbf4e('0x103')][_0xbf4e('0x122')](db[_0xbf4e('0x127')],{'as':'Contact','foreignKey':_0xbf4e('0x175')});db[_0xbf4e('0x103')][_0xbf4e('0x122')](db['User'],{'as':_0xbf4e('0x176'),'foreignKey':'UserId'});db['WhatsappInteraction']['belongsToMany'](db[_0xbf4e('0x182')],{'through':_0xbf4e('0x1b1'),'as':_0xbf4e('0x178')});db[_0xbf4e('0x103')]['belongsToMany'](db['Tag'],{'through':_0xbf4e('0x1b1'),'as':_0xbf4e('0x179')});db[_0xbf4e('0x103')][_0xbf4e('0x124')](db[_0xbf4e('0xe')],{'as':_0xbf4e('0x17a'),'through':_0xbf4e('0x133'),'foreignKey':_0xbf4e('0x1f0')});db[_0xbf4e('0x105')][_0xbf4e('0x122')](db['User'],{'as':_0xbf4e('0xe')});db[_0xbf4e('0x105')][_0xbf4e('0x122')](db[_0xbf4e('0x127')],{'onDelete':_0xbf4e('0x112'),'as':'Contact'});db[_0xbf4e('0x105')][_0xbf4e('0x122')](db[_0xbf4e('0x103')],{'onDelete':'cascade','as':_0xbf4e('0x193'),'foreignKey':'WhatsappInteractionId'});db[_0xbf4e('0x105')][_0xbf4e('0x122')](db[_0xbf4e('0x145')],{'as':_0xbf4e('0x173'),'foreignKey':_0xbf4e('0x1ef')});db[_0xbf4e('0x1f1')][_0xbf4e('0x122')](db[_0xbf4e('0x145')],{});db[_0xbf4e('0x1f1')][_0xbf4e('0x122')](db['CmList'],{'as':_0xbf4e('0x16c'),'foreignKey':_0xbf4e('0x16d')});db[_0xbf4e('0x1f1')][_0xbf4e('0x122')](db['CmContact'],{'as':_0xbf4e('0x174'),'foreignKey':_0xbf4e('0x175')});db[_0xbf4e('0x1f1')][_0xbf4e('0x122')](db[_0xbf4e('0x103')],{});db['WhatsappQueueReport'][_0xbf4e('0x122')](db[_0xbf4e('0x109')],{});db[_0xbf4e('0x1f1')]['belongsTo'](db[_0xbf4e('0x105')],{});db[_0xbf4e('0x1f1')]['belongsTo'](db[_0xbf4e('0xe')],{});db[_0xbf4e('0x1f2')]['belongsTo'](db[_0xbf4e('0x105')],{});db[_0xbf4e('0x1f2')][_0xbf4e('0x122')](db['WhatsappInteraction'],{});db[_0xbf4e('0x1f2')]['belongsTo'](db[_0xbf4e('0x145')],{'foreignKey':'FromWhatsappAccountId','as':_0xbf4e('0x1d5')});db[_0xbf4e('0x1f2')][_0xbf4e('0x122')](db[_0xbf4e('0x145')],{'foreignKey':_0xbf4e('0x1f3'),'as':_0xbf4e('0x1e0')});db[_0xbf4e('0x1f2')][_0xbf4e('0x122')](db[_0xbf4e('0x109')],{'foreignKey':_0xbf4e('0x1f4'),'as':_0xbf4e('0x1de')});db[_0xbf4e('0x1f2')][_0xbf4e('0x122')](db[_0xbf4e('0xe')],{'foreignKey':_0xbf4e('0x1d6'),'as':'FromAgent'});db[_0xbf4e('0x1f2')][_0xbf4e('0x122')](db[_0xbf4e('0xe')],{'foreignKey':'ToUserId','as':_0xbf4e('0x1d9')});db[_0xbf4e('0x109')]['belongsToMany'](db[_0xbf4e('0xe')],{'as':_0xbf4e('0x15a'),'through':_0xbf4e('0x13d'),'foreignKey':_0xbf4e('0x1f5')});db['WhatsappQueue']['belongsToMany'](db['Team'],{'through':'team_has_whatsapp_queues','as':_0xbf4e('0x15b')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x878f=['CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Tag','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','Team','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','Attachment','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/userProfile/userProfile.model','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','hasOne','cascade','UserId','hasMany','HopperFinals','OpenchannelInteraction','OpenchannelInteractions','SmsInteractions','MailInteractions','WhatsappInteractions','SenderId','belongsTo','UserProfile','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','SmsInteraction','user_has_openchannel_interactions','VoiceQueues','VoicePrefixes','MailQueues','ChatQueues','FaxQueues','SmsQueues','UserSmsQueue','OpenchannelQueues','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','Trunk','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','VoiceMailMessage','Messages','mailboxuser','mailbox','QueueCalls','VoiceAgentReport','AgentReports','uniqueid','Contact','ContactId','MailAccountId','MailServerOut','Smtp','Dispositions','MailMessage','List','ListId','team_has_mail_queues','Account','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','FaxAccountId','Answers','Interactions','FaxMessage','Owner','fax_interaction_has_tags','FaxInteractionId','Interaction','AttachmentId','team_has_fax_queues','SmsAccountId','SmsApplication','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ProactiveActions','ChatApplication','OpenchannelQueueReport','Agent','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','CmCompany','CompanyId','cm_contact_has_tags','CampaignId','OwnerId','Queue','Automation','All','OneAll','AutomationAllId','Any','OneAny','Action','Actions','AutomationId','Intervals','Extensions','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Sound','Mohs','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','AnalyticFieldReport','Fields','MetricId','Configurations','SalesforceConfiguration','Subjects','SubjectId','Descriptions','FieldId','AccountId','Subject','Description','DescriptionId','SugarcrmAccount','Field','VariableId','DeskConfiguration','int_desk_configuration_has_tags','ZohoAccount','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','FreshdeskField','Dynamics365Field','FreshsalesConfiguration','ChatQueueReport','ToId','SessionId','ProjectId','team_has_whatsapp_queues','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToQueue','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CmCustomField','CustomFields','HopperHistory','Queues','voice_queues_has_cm_lists','UserVoicePrefix','UserProfileSections','Resources','WhatsappAccountId','WhatsappInteractionId','whatsapp_interaction_has_tags','ToWhatsappAccountId','ToQueueId','exports','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','name','utf8','sequelizeHistory','mysql','username','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmContact','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','../api/automation/automation.model'];(function(_0x3b231a,_0x53a00d){var _0x18d67a=function(_0x5e14c6){while(--_0x5e14c6){_0x3b231a['push'](_0x3b231a['shift']());}};_0x18d67a(++_0x53a00d);}(_0x878f,0x173));var _0xf878=function(_0x3819b5,_0x150c65){_0x3819b5=_0x3819b5-0x0;var _0x58bf6f=_0x878f[_0x3819b5];return _0x58bf6f;};'use strict';var config=require('../config/environment');var Sequelize=require(_0xf878('0x0'));var _=require(_0xf878('0x1'));var jstz=require(_0xf878('0x2'));var timezone=jstz[_0xf878('0x3')]();config[_0xf878('0x0')]=_[_0xf878('0x4')](config[_0xf878('0x0')],{'database':_0xf878('0x5'),'username':_0xf878('0x6'),'password':_0xf878('0x7'),'options':{'host':_0xf878('0x8'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xf878('0x9')](),'define':{'charset':_0xf878('0xa'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_['defaultsDeep'](config[_0xf878('0xb')],{'database':'motion2','username':'xcall','password':_0xf878('0x7'),'options':{'host':_0xf878('0x8'),'port':0xcea,'dialect':_0xf878('0xc'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xf878('0x9')](),'define':{'charset':_0xf878('0xa'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xf878('0x0')]['database'],config[_0xf878('0x0')][_0xf878('0xd')],config[_0xf878('0x0')]['password'],config[_0xf878('0x0')][_0xf878('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xf878('0xb')]['database'],config[_0xf878('0xb')][_0xf878('0xd')],config[_0xf878('0xb')]['password'],config['sequelizeHistory'][_0xf878('0xe')])};db[_0xf878('0xf')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x11'));db[_0xf878('0x12')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x13'));db[_0xf878('0x14')]=db[_0xf878('0x0')]['import'](_0xf878('0x15'));db[_0xf878('0x16')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x17'));db[_0xf878('0x18')]=db[_0xf878('0x0')]['import'](_0xf878('0x19'));db[_0xf878('0x1a')]=db[_0xf878('0x0')]['import'](_0xf878('0x1b'));db[_0xf878('0x1c')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x1d'));db[_0xf878('0x1e')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x1f'));db[_0xf878('0x20')]=db[_0xf878('0x0')]['import'](_0xf878('0x21'));db['VoiceMailMessage']=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x22'));db[_0xf878('0x23')]=db[_0xf878('0x0')]['import']('../api/voiceCallReport/voiceCallReport.model');db['VoiceDialReport']=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x24'));db['VoiceAgentReport']=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x25'));db[_0xf878('0x26')]=db[_0xf878('0x0')]['import']('../api/voiceQueueReport/voiceQueueReport.model');db[_0xf878('0x27')]=db[_0xf878('0x0')]['import'](_0xf878('0x28'));db['Trunk']=db[_0xf878('0x0')]['import'](_0xf878('0x29'));db['VoiceTransferReport']=db[_0xf878('0x0')]['import'](_0xf878('0x2a'));db[_0xf878('0x2b')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x2c'));db[_0xf878('0x2d')]=db['sequelize'][_0xf878('0x10')](_0xf878('0x2e'));db[_0xf878('0x2f')]=db[_0xf878('0x0')][_0xf878('0x10')]('../api/userChatQueue/userChatQueue.model');db[_0xf878('0x30')]=db[_0xf878('0x0')]['import'](_0xf878('0x31'));db[_0xf878('0x32')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x33'));db['UserSmsQueue']=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x34'));db[_0xf878('0x35')]=db['sequelize'][_0xf878('0x10')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db['UserWhatsappQueue']=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x36'));db[_0xf878('0x37')]=db[_0xf878('0x0')]['import'](_0xf878('0x38'));db['MailServerOut']=db[_0xf878('0x0')][_0xf878('0x10')]('../api/mailServerOut/mailServerOut.model');db[_0xf878('0x39')]=db[_0xf878('0x0')]['import'](_0xf878('0x3a'));db[_0xf878('0x3b')]=db['sequelize'][_0xf878('0x10')](_0xf878('0x3c'));db[_0xf878('0x3d')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x3e'));db[_0xf878('0x3f')]=db['sequelize'][_0xf878('0x10')](_0xf878('0x40'));db['MailMessage']=db[_0xf878('0x0')]['import']('../api/mailMessage/mailMessage.model');db[_0xf878('0x41')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x42'));db[_0xf878('0x43')]=db['sequelize'][_0xf878('0x10')]('../api/mailQueueReport/mailQueueReport.model');db[_0xf878('0x44')]=db[_0xf878('0x0')]['import']('../api/dashboard/dashboard.model');db[_0xf878('0x45')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x46'));db[_0xf878('0x47')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x48'));db[_0xf878('0x49')]=db['sequelize'][_0xf878('0x10')](_0xf878('0x4a'));db[_0xf878('0x4b')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x4c'));db['FaxMessage']=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x4d'));db[_0xf878('0x4e')]=db[_0xf878('0x0')]['import'](_0xf878('0x4f'));db[_0xf878('0x50')]=db[_0xf878('0x0')][_0xf878('0x10')]('../api/faxQueueReport/faxQueueReport.model');db[_0xf878('0x51')]=db[_0xf878('0x0')][_0xf878('0x10')]('../api/smsAccount/smsAccount.model');db['SmsApplication']=db[_0xf878('0x0')]['import']('../api/smsApplication/smsApplication.model');db['SmsInteraction']=db[_0xf878('0x0')]['import'](_0xf878('0x52'));db[_0xf878('0x53')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x54'));db[_0xf878('0x55')]=db[_0xf878('0x0')]['import'](_0xf878('0x56'));db[_0xf878('0x57')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x58'));db['OpenchannelApplication']=db['sequelize'][_0xf878('0x10')](_0xf878('0x59'));db['OpenchannelInteraction']=db[_0xf878('0x0')]['import'](_0xf878('0x5a'));db[_0xf878('0x5b')]=db[_0xf878('0x0')][_0xf878('0x10')]('../api/openchannelMessage/openchannelMessage.model');db[_0xf878('0x5c')]=db[_0xf878('0x0')][_0xf878('0x10')]('../api/openchannelQueue/openchannelQueue.model');db[_0xf878('0x5d')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x5e'));db['OpenchannelQueueReport']=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x5f'));db['ChatApplication']=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x60'));db[_0xf878('0x61')]=db['sequelize']['import']('../api/chatInteraction/chatInteraction.model');db[_0xf878('0x62')]=db['sequelize']['import']('../api/chatMessage/chatMessage.model');db[_0xf878('0x63')]=db[_0xf878('0x0')]['import'](_0xf878('0x64'));db[_0xf878('0x65')]=db[_0xf878('0x0')]['import']('../api/chatQueue/chatQueue.model');db[_0xf878('0x66')]=db['sequelize'][_0xf878('0x10')](_0xf878('0x67'));db[_0xf878('0x68')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x69'));db['CmCompany']=db[_0xf878('0x0')][_0xf878('0x10')]('../api/cmCompany/cmCompany.model');db[_0xf878('0x6a')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x6b'));db[_0xf878('0x6c')]=db[_0xf878('0x0')][_0xf878('0x10')]('../api/cmHopper/cmHopper.model');db[_0xf878('0x6d')]=db[_0xf878('0x0')][_0xf878('0x10')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0xf878('0x6e')]=db['sequelize'][_0xf878('0x10')](_0xf878('0x6f'));db[_0xf878('0x70')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x71'));db[_0xf878('0x72')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x73'));db['CmCustomField']=db['sequelize']['import'](_0xf878('0x74'));db['Action']=db[_0xf878('0x0')][_0xf878('0x10')]('../api/action/action.model');db['Automation']=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x75'));db[_0xf878('0x76')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x77'));db[_0xf878('0x78')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x79'));db[_0xf878('0x7a')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x7b'));db[_0xf878('0x7c')]=db[_0xf878('0x0')][_0xf878('0x10')]('../api/interval/interval.model');db[_0xf878('0x7d')]=db['sequelize'][_0xf878('0x10')](_0xf878('0x7e'));db[_0xf878('0x7f')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x80'));db[_0xf878('0x81')]=db[_0xf878('0x0')][_0xf878('0x10')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0xf878('0x82')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x83'));db['Sound']=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x84'));db[_0xf878('0x85')]=db[_0xf878('0x0')]['import']('../api/tag/tag.model');db[_0xf878('0x86')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x87'));db[_0xf878('0x88')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x89'));db[_0xf878('0x8a')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x8b'));db[_0xf878('0x8c')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x8d'));db[_0xf878('0x8e')]=db['sequelize'][_0xf878('0x10')](_0xf878('0x8f'));db[_0xf878('0x90')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x91'));db[_0xf878('0x92')]=db[_0xf878('0x0')][_0xf878('0x10')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0xf878('0x93')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x94'));db[_0xf878('0x95')]=db[_0xf878('0x0')][_0xf878('0x10')]('../api/analyticMetric/analyticMetric.model');db['AnalyticFieldReport']=db[_0xf878('0x0')]['import'](_0xf878('0x96'));db[_0xf878('0x97')]=db[_0xf878('0x0')][_0xf878('0x10')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0xf878('0x98')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x99'));db['SalesforceConfiguration']=db[_0xf878('0x0')]['import'](_0xf878('0x9a'));db[_0xf878('0x9b')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x9c'));db['SugarcrmAccount']=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x9d'));db[_0xf878('0x9e')]=db['sequelize'][_0xf878('0x10')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0xf878('0x9f')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0xa0'));db[_0xf878('0xa1')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0xa2'));db['DeskConfiguration']=db['sequelize']['import'](_0xf878('0xa3'));db[_0xf878('0xa4')]=db['sequelize']['import'](_0xf878('0xa5'));db['ZohoAccount']=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0xa6'));db[_0xf878('0xa7')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0xa8'));db[_0xf878('0xa9')]=db[_0xf878('0x0')]['import'](_0xf878('0xaa'));db[_0xf878('0xab')]=db[_0xf878('0x0')]['import'](_0xf878('0xac'));db[_0xf878('0xad')]=db['sequelize'][_0xf878('0x10')](_0xf878('0xae'));db[_0xf878('0xaf')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0xb0'));db[_0xf878('0xb1')]=db[_0xf878('0x0')]['import'](_0xf878('0xb2'));db['FreshdeskConfiguration']=db['sequelize'][_0xf878('0x10')](_0xf878('0xb3'));db['FreshdeskField']=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0xb4'));db[_0xf878('0xb5')]=db[_0xf878('0x0')]['import'](_0xf878('0xb6'));db[_0xf878('0xb7')]=db['sequelize'][_0xf878('0x10')](_0xf878('0xb8'));db[_0xf878('0xb9')]=db[_0xf878('0x0')]['import']('../api/intVtigerField/intVtigerField.model');db[_0xf878('0xba')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0xbb'));db[_0xf878('0xbc')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0xbd'));db[_0xf878('0xbe')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0xbf'));db[_0xf878('0xc0')]=db[_0xf878('0x0')][_0xf878('0x10')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0xf878('0xc1')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0xc2'));db['Dynamics365Field']=db[_0xf878('0x0')]['import'](_0xf878('0xc3'));db[_0xf878('0xc4')]=db['sequelize'][_0xf878('0x10')](_0xf878('0xc5'));db['FreshsalesConfiguration']=db['sequelize'][_0xf878('0x10')](_0xf878('0xc6'));db[_0xf878('0xc7')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0xc8'));db[_0xf878('0x8c')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x8d'));db['Network']=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0xc9'));db['ChatQueueReport']=db[_0xf878('0x0')]['import'](_0xf878('0xca'));db[_0xf878('0xcb')]=db['sequelize'][_0xf878('0x10')](_0xf878('0xcc'));db[_0xf878('0xcd')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0xce'));db[_0xf878('0xcf')]=db['sequelize'][_0xf878('0x10')](_0xf878('0xd0'));db[_0xf878('0xd1')]=db['sequelize']['import'](_0xf878('0xd2'));db[_0xf878('0xd3')]=db['sequelize'][_0xf878('0x10')](_0xf878('0xd4'));db['SquareReport']=db['sequelize']['import'](_0xf878('0xd5'));db['SquareDetailsReport']=db[_0xf878('0x0')][_0xf878('0x10')]('../api/squareReportDetail/squareReportDetail.model');db[_0xf878('0xd6')]=db['sequelize'][_0xf878('0x10')](_0xf878('0xd7'));db[_0xf878('0xd8')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0xd9'));db[_0xf878('0xda')]=db[_0xf878('0x0')][_0xf878('0x10')]('../api/squareOdbc/squareOdbc.model');db[_0xf878('0xdb')]=db[_0xf878('0x0')][_0xf878('0x10')]('../api/squareProject/squareProject.model');db[_0xf878('0xdc')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0xdd'));db[_0xf878('0xde')]=db[_0xf878('0x0')][_0xf878('0x10')]('../api/squareMessage/squareMessage.model');db[_0xf878('0xdf')]=db[_0xf878('0x0')][_0xf878('0x10')]('../api/team/team.model');db['License']=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0xe0'));db[_0xf878('0xe1')]=db['sequelize']['import'](_0xf878('0xe2'));db[_0xf878('0xe3')]=db[_0xf878('0x0')]['import']('../api/migration/migration.model');db[_0xf878('0xe4')]=db[_0xf878('0x0')][_0xf878('0x10')]('../api/attachment/attachment.model');db[_0xf878('0xe5')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0xe6'));db[_0xf878('0xe7')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0xe8'));db[_0xf878('0xe9')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0xea'));db[_0xf878('0xeb')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0xec'));db[_0xf878('0xed')]=db[_0xf878('0x0')]['import'](_0xf878('0xee'));db[_0xf878('0xef')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0xf0'));db[_0xf878('0xf1')]=db['sequelize']['import'](_0xf878('0xf2'));db[_0xf878('0xf3')]=db[_0xf878('0x0')][_0xf878('0x10')]('../api/voicePrefix/voicePrefix.model');db['UserProfile']=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0xf4'));db[_0xf878('0xf5')]=db[_0xf878('0x0')][_0xf878('0x10')]('../api/userProfileSection/userProfileSection.model');db[_0xf878('0xf6')]=db[_0xf878('0x0')]['import'](_0xf878('0xf7'));db[_0xf878('0xf8')]=db[_0xf878('0x0')]['import'](_0xf878('0xf9'));db[_0xf878('0xfa')]=db['sequelize'][_0xf878('0x10')](_0xf878('0xfb'));db[_0xf878('0xfc')]=db[_0xf878('0x0')][_0xf878('0x10')]('../api/whatsappApplication/whatsappApplication.model');db[_0xf878('0xfd')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0xfe'));db[_0xf878('0xff')]=db['sequelize'][_0xf878('0x10')](_0xf878('0x100'));db[_0xf878('0x101')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x102'));db[_0xf878('0x103')]=db[_0xf878('0x0')][_0xf878('0x10')](_0xf878('0x104'));db[_0xf878('0x105')]=db[_0xf878('0x0')]['import']('../api/whatsappQueue/whatsappQueue.model');db['CloudProvider']=db['sequelize'][_0xf878('0x10')]('../api/cloudProvider/cloudProvider.model');db[_0xf878('0x106')]=db[_0xf878('0x0')]['import'](_0xf878('0x107'));db[_0xf878('0x108')]=db['sequelize'][_0xf878('0x10')](_0xf878('0x109'));db['UserVoicePrefix']=db['sequelize'][_0xf878('0x10')](_0xf878('0x10a'));db[_0xf878('0xf')][_0xf878('0x10b')](db['VoiceMail'],{'as':_0xf878('0x20'),'onDelete':_0xf878('0x10c'),'foreignKey':_0xf878('0x10d')});db[_0xf878('0xf')]['hasMany'](db[_0xf878('0x1c')],{'as':'Recordings','foreignKey':_0xf878('0x10d')});db[_0xf878('0xf')]['hasMany'](db[_0xf878('0x2b')],{'as':'VoiceQueuesRt','foreignKey':_0xf878('0x10d')});db['User']['hasMany'](db[_0xf878('0x16')],{'as':'Extensions','onDelete':_0xf878('0x10c'),'hooks':!![]});db[_0xf878('0xf')][_0xf878('0x10e')](db[_0xf878('0x6e')],{'as':_0xf878('0x10f'),'foreignKey':_0xf878('0x10d')});db[_0xf878('0xf')]['hasMany'](db[_0xf878('0x70')],{'as':'HopperHistory','foreignKey':_0xf878('0x10d')});db[_0xf878('0xf')][_0xf878('0x10e')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0xf878('0x10d')});db[_0xf878('0xf')][_0xf878('0x10e')](db[_0xf878('0x110')],{'as':_0xf878('0x111'),'foreignKey':_0xf878('0x10d')});db[_0xf878('0xf')][_0xf878('0x10e')](db[_0xf878('0x61')],{'as':'ChatInteractions','foreignKey':_0xf878('0x10d')});db[_0xf878('0xf')][_0xf878('0x10e')](db['SmsInteraction'],{'as':_0xf878('0x112'),'foreignKey':_0xf878('0x10d')});db['User'][_0xf878('0x10e')](db[_0xf878('0x4b')],{'as':'FaxInteractions','foreignKey':'UserId'});db['User'][_0xf878('0x10e')](db[_0xf878('0x3f')],{'as':_0xf878('0x113'),'foreignKey':_0xf878('0x10d')});db['User'][_0xf878('0x10e')](db[_0xf878('0xfd')],{'as':_0xf878('0x114'),'foreignKey':_0xf878('0x10d')});db[_0xf878('0xf')][_0xf878('0x10e')](db['UserNotification'],{'as':'UserNotifications','foreignKey':_0xf878('0x115')});db[_0xf878('0xf')][_0xf878('0x116')](db[_0xf878('0x117')],{'as':_0xf878('0x117'),'foreignKey':_0xf878('0x118')});db[_0xf878('0xf')][_0xf878('0x119')](db['ChatGroup'],{'as':_0xf878('0x11a'),'through':_0xf878('0x11b')});db[_0xf878('0xf')][_0xf878('0x119')](db[_0xf878('0x6a')],{'as':_0xf878('0x11c'),'through':'cm_user_has_contacts'});db[_0xf878('0xf')][_0xf878('0x119')](db[_0xf878('0xf1')],{'as':_0xf878('0x11d'),'through':_0xf878('0x11e')});db['User'][_0xf878('0x119')](db[_0xf878('0xdf')],{'through':_0xf878('0x11f')});db[_0xf878('0xf')][_0xf878('0x119')](db[_0xf878('0x3f')],{'as':'MailInteractions','through':_0xf878('0x120')});db[_0xf878('0xf')]['belongsToMany'](db[_0xf878('0x61')],{'as':_0xf878('0x121'),'through':_0xf878('0x122')});db[_0xf878('0xf')][_0xf878('0x119')](db[_0xf878('0x4b')],{'as':_0xf878('0x123'),'through':_0xf878('0x124')});db[_0xf878('0xf')][_0xf878('0x119')](db[_0xf878('0x125')],{'as':_0xf878('0x112'),'through':'user_has_sms_interactions'});db['User']['belongsToMany'](db[_0xf878('0x110')],{'as':_0xf878('0x111'),'through':_0xf878('0x126')});db[_0xf878('0xf')][_0xf878('0x119')](db[_0xf878('0xfd')],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db['User']['belongsToMany'](db[_0xf878('0x1a')],{'as':_0xf878('0x127'),'through':_0xf878('0x2d'),'required':![]});db[_0xf878('0xf')][_0xf878('0x119')](db['VoicePrefix'],{'as':_0xf878('0x128'),'through':'UserVoicePrefix','required':![]});db['User'][_0xf878('0x119')](db[_0xf878('0x3b')],{'as':_0xf878('0x129'),'through':_0xf878('0x30'),'required':![]});db['User'][_0xf878('0x119')](db['ChatQueue'],{'as':_0xf878('0x12a'),'through':_0xf878('0x2f'),'required':![],'hooks':!![]});db[_0xf878('0xf')]['belongsToMany'](db['FaxQueue'],{'as':_0xf878('0x12b'),'through':_0xf878('0x32'),'required':![]});db['User'][_0xf878('0x119')](db[_0xf878('0x55')],{'as':_0xf878('0x12c'),'through':_0xf878('0x12d'),'required':![]});db[_0xf878('0xf')]['belongsToMany'](db[_0xf878('0x5c')],{'as':_0xf878('0x12e'),'through':'UserOpenchannelQueue','required':![]});db[_0xf878('0xf')][_0xf878('0x119')](db[_0xf878('0x105')],{'as':'WhatsappQueues','through':'UserWhatsappQueue','required':![]});db[_0xf878('0xf')]['belongsToMany'](db[_0xf878('0xf1')],{'through':_0xf878('0x11e')});db[_0xf878('0xf')][_0xf878('0x119')](db[_0xf878('0x5d')],{'as':'ChatWebsites','through':_0xf878('0x12f')});db[_0xf878('0xf')][_0xf878('0x119')](db[_0xf878('0x47')],{'as':_0xf878('0x130'),'through':_0xf878('0x131')});db['User'][_0xf878('0x119')](db['MailAccount'],{'as':_0xf878('0x132'),'through':_0xf878('0x133')});db[_0xf878('0xf')][_0xf878('0x119')](db['OpenchannelAccount'],{'as':'OpenchannelAccounts','through':'user_has_openchannel_accounts'});db[_0xf878('0xf')][_0xf878('0x119')](db['SmsAccount'],{'as':_0xf878('0x134'),'through':_0xf878('0x135')});db[_0xf878('0xf')]['belongsToMany'](db[_0xf878('0xfa')],{'as':_0xf878('0x136'),'through':_0xf878('0x137')});db[_0xf878('0xf')]['belongsToMany'](db[_0xf878('0xdb')],{'as':_0xf878('0x138'),'through':_0xf878('0x139')});db[_0xf878('0x12')][_0xf878('0x10e')](db[_0xf878('0x16')],{'as':'SpiedAgents','onDelete':_0xf878('0x10c'),'foreignKey':_0xf878('0x13a')});db[_0xf878('0x14')][_0xf878('0x10e')](db[_0xf878('0x16')],{'onDelete':_0xf878('0x10c')});db[_0xf878('0x16')][_0xf878('0x10e')](db[_0xf878('0x16')],{'as':_0xf878('0x13b'),'onDelete':_0xf878('0x10c')});db[_0xf878('0x18')][_0xf878('0x119')](db['Sound'],{'as':_0xf878('0x13c'),'through':_0xf878('0x13d')});db[_0xf878('0x1a')][_0xf878('0x10e')](db[_0xf878('0x2b')],{'as':_0xf878('0x13e'),'foreignKey':_0xf878('0x13f')});db[_0xf878('0x1a')][_0xf878('0x10e')](db['CmHopper'],{'as':_0xf878('0x140'),'foreignKey':_0xf878('0x13f')});db['VoiceQueue'][_0xf878('0x10e')](db['CmHopperFinal'],{'as':_0xf878('0x10f'),'foreignKey':_0xf878('0x13f')});db[_0xf878('0x1a')][_0xf878('0x10e')](db[_0xf878('0x70')],{'as':_0xf878('0x141'),'foreignKey':_0xf878('0x13f')});db[_0xf878('0x1a')][_0xf878('0x10e')](db['ReportAgentPreview'],{'as':_0xf878('0x72'),'foreignKey':_0xf878('0x13f')});db[_0xf878('0x1a')][_0xf878('0x10e')](db['CmHopperBlack'],{'as':_0xf878('0x142'),'foreignKey':_0xf878('0x13f')});db['VoiceQueue']['hasMany'](db[_0xf878('0xd1')],{'as':_0xf878('0x143'),'foreignKey':_0xf878('0x13f')});db['VoiceQueue'][_0xf878('0x116')](db[_0xf878('0x144')],{'as':_0xf878('0x144'),'foreignKey':_0xf878('0x145')});db['VoiceQueue']['belongsTo'](db[_0xf878('0x144')],{'as':_0xf878('0x146'),'foreignKey':_0xf878('0x147')});db['VoiceQueue'][_0xf878('0x116')](db['Interval'],{'as':_0xf878('0x7c'),'foreignKey':_0xf878('0x148')});db[_0xf878('0x1a')][_0xf878('0x116')](db[_0xf878('0x7d')],{'as':_0xf878('0x149'),'foreignKey':_0xf878('0x14a')});db[_0xf878('0x1a')]['belongsToMany'](db[_0xf878('0xf1')],{'as':_0xf878('0x11d'),'through':'voice_queues_has_cm_lists'});db[_0xf878('0x1a')][_0xf878('0x119')](db[_0xf878('0xf')],{'as':_0xf878('0x14b'),'through':_0xf878('0x2d')});db[_0xf878('0x1a')][_0xf878('0x119')](db[_0xf878('0xdf')],{'as':_0xf878('0x14c'),'through':_0xf878('0x106')});db[_0xf878('0x1a')][_0xf878('0x119')](db[_0xf878('0xf1')],{'as':_0xf878('0x14d'),'through':_0xf878('0x14e')});db[_0xf878('0x1c')]['belongsTo'](db[_0xf878('0xf')],{'as':_0xf878('0xf'),'foreignKey':_0xf878('0x10d')});db[_0xf878('0x1e')][_0xf878('0x116')](db[_0xf878('0xf')],{'as':'User','foreignKey':_0xf878('0x10d')});db[_0xf878('0x20')][_0xf878('0x10e')](db[_0xf878('0x14f')],{'as':_0xf878('0x150'),'onDelete':_0xf878('0x10c'),'foreignKey':_0xf878('0x151'),'sourceKey':_0xf878('0x152')});db['VoiceMailMessage'][_0xf878('0x116')](db[_0xf878('0x20')],{'foreignKey':'mailboxuser','targetKey':'mailbox'});db[_0xf878('0x23')][_0xf878('0x10e')](db['VoiceQueueReport'],{'as':_0xf878('0x153'),'foreignKey':'uniqueid','constraints':![]});db[_0xf878('0x23')][_0xf878('0x10e')](db[_0xf878('0x154')],{'as':_0xf878('0x155'),'foreignKey':_0xf878('0x156'),'constraints':![]});db[_0xf878('0x23')][_0xf878('0x116')](db[_0xf878('0xf')],{'as':_0xf878('0xf'),'foreignKey':_0xf878('0x10d')});db[_0xf878('0x23')][_0xf878('0x116')](db[_0xf878('0x6a')],{'as':_0xf878('0x157'),'foreignKey':_0xf878('0x158')});db[_0xf878('0x37')][_0xf878('0x116')](db[_0xf878('0x39')],{'as':_0xf878('0x39'),'foreignKey':_0xf878('0x159')});db[_0xf878('0x15a')][_0xf878('0x116')](db[_0xf878('0x39')],{'as':_0xf878('0x39'),'foreignKey':_0xf878('0x159')});db[_0xf878('0x39')][_0xf878('0x10b')](db[_0xf878('0x37')],{'as':'Imap','onDelete':_0xf878('0x10c')});db[_0xf878('0x39')]['hasOne'](db[_0xf878('0x15a')],{'as':_0xf878('0x15b'),'onDelete':_0xf878('0x10c')});db[_0xf878('0x39')][_0xf878('0x10e')](db[_0xf878('0x78')],{'as':_0xf878('0x15c'),'foreignKey':'MailAccountId','onDelete':'cascade'});db[_0xf878('0x39')][_0xf878('0x10e')](db[_0xf878('0x76')],{'as':'Answers','foreignKey':_0xf878('0x159')});db[_0xf878('0x39')][_0xf878('0x10e')](db[_0xf878('0x15d')],{'as':_0xf878('0x150'),'foreignKey':'MailAccountId'});db[_0xf878('0x39')][_0xf878('0x10e')](db['MailInteraction'],{'as':'Interactions'});db[_0xf878('0x39')][_0xf878('0x10e')](db[_0xf878('0x41')],{'as':_0xf878('0x13b')});db[_0xf878('0x39')]['belongsTo'](db[_0xf878('0xf1')],{'as':_0xf878('0x15e'),'foreignKey':_0xf878('0x15f')});db['MailAccount'][_0xf878('0x116')](db[_0xf878('0x86')],{'as':_0xf878('0x86'),'foreignKey':'TemplateId'});db['MailAccount'][_0xf878('0x116')](db['Pause'],{'as':_0xf878('0x149'),'foreignKey':_0xf878('0x14a')});db[_0xf878('0x39')][_0xf878('0x119')](db[_0xf878('0xf')],{'as':_0xf878('0x14b'),'through':_0xf878('0x133')});db['MailQueue'][_0xf878('0x119')](db[_0xf878('0xf')],{'as':'Agents','through':_0xf878('0x30')});db[_0xf878('0x3b')][_0xf878('0x119')](db['Team'],{'through':_0xf878('0x160'),'as':_0xf878('0x14c')});db[_0xf878('0x3f')][_0xf878('0x10e')](db[_0xf878('0x15d')],{'as':'Messages','onDelete':_0xf878('0x10c'),'foreignKey':'MailInteractionId'});db['MailInteraction']['belongsTo'](db['MailAccount'],{'as':_0xf878('0x161'),'foreignKey':'MailAccountId'});db['MailInteraction'][_0xf878('0x116')](db['CmContact'],{'as':_0xf878('0x157'),'foreignKey':_0xf878('0x158')});db[_0xf878('0x3f')][_0xf878('0x116')](db[_0xf878('0xf')],{'as':'Owner','foreignKey':_0xf878('0x10d')});db[_0xf878('0x3f')]['belongsToMany'](db[_0xf878('0x85')],{'through':_0xf878('0x162'),'as':_0xf878('0x163')});db[_0xf878('0x3f')][_0xf878('0x119')](db[_0xf878('0x85')],{'through':'mail_interaction_has_tags','as':_0xf878('0x164')});db[_0xf878('0x3f')]['belongsToMany'](db[_0xf878('0xf')],{'as':_0xf878('0x165'),'through':'user_has_mail_interactions','foreignKey':_0xf878('0x166')});db['MailMessage'][_0xf878('0x10e')](db[_0xf878('0xe4')],{'as':_0xf878('0x167'),'onDelete':_0xf878('0x10c')});db['MailMessage'][_0xf878('0x116')](db['User'],{'as':_0xf878('0xf')});db[_0xf878('0x15d')]['belongsTo'](db['CmContact'],{'onDelete':_0xf878('0x10c'),'as':'Contact'});db[_0xf878('0x15d')]['belongsTo'](db['MailInteraction'],{'as':'Interaction','foreignKey':_0xf878('0x166')});db[_0xf878('0x15d')]['belongsTo'](db['MailAccount'],{'as':'Account','foreignKey':_0xf878('0x159')});db['MailMessage'][_0xf878('0x116')](db[_0xf878('0x5d')],{'as':_0xf878('0x5d'),'foreignKey':_0xf878('0x168')});db[_0xf878('0x15d')][_0xf878('0x116')](db['ChatOfflineMessage'],{'as':_0xf878('0x63'),'foreignKey':_0xf878('0x169')});db[_0xf878('0x41')]['belongsTo'](db[_0xf878('0xf')],{'onDelete':_0xf878('0x16a')});db[_0xf878('0x41')][_0xf878('0x116')](db['MailQueue'],{'onDelete':_0xf878('0x16a')});db[_0xf878('0x41')][_0xf878('0x116')](db[_0xf878('0x39')],{'onDelete':'restrict'});db[_0xf878('0x41')][_0xf878('0x116')](db[_0xf878('0x7c')],{'onDelete':'restrict','foreignKey':_0xf878('0x148')});db['MailApplication'][_0xf878('0x116')](db[_0xf878('0x85')],{'onDelete':_0xf878('0x16a'),'foreignKey':_0xf878('0x16b')});db[_0xf878('0x43')][_0xf878('0x116')](db[_0xf878('0x39')],{});db[_0xf878('0x43')]['belongsTo'](db[_0xf878('0xf1')],{'as':_0xf878('0x15e'),'foreignKey':_0xf878('0x15f')});db[_0xf878('0x43')][_0xf878('0x116')](db[_0xf878('0x6a')],{'as':_0xf878('0x157'),'foreignKey':'ContactId'});db[_0xf878('0x43')][_0xf878('0x116')](db[_0xf878('0x3f')],{});db['MailQueueReport'][_0xf878('0x116')](db[_0xf878('0x15d')],{});db[_0xf878('0x43')][_0xf878('0x116')](db[_0xf878('0xf')],{});db[_0xf878('0x43')][_0xf878('0x116')](db[_0xf878('0x3b')],{});db[_0xf878('0x44')][_0xf878('0x10e')](db[_0xf878('0x45')],{'as':'Items','onDelete':'cascade'});db[_0xf878('0x47')][_0xf878('0x10e')](db[_0xf878('0x78')],{'as':_0xf878('0x15c'),'foreignKey':_0xf878('0x16c'),'onDelete':_0xf878('0x10c')});db[_0xf878('0x47')][_0xf878('0x10e')](db[_0xf878('0x76')],{'as':_0xf878('0x16d'),'foreignKey':'FaxAccountId'});db['FaxAccount'][_0xf878('0x10e')](db['FaxInteraction'],{'as':_0xf878('0x16e')});db[_0xf878('0x47')][_0xf878('0x10e')](db['FaxApplication'],{'as':_0xf878('0x13b')});db[_0xf878('0x47')][_0xf878('0x10e')](db[_0xf878('0x16')],{'as':'Exntensions','onDelete':_0xf878('0x10c')});db['FaxAccount'][_0xf878('0x10e')](db[_0xf878('0x16f')],{'as':_0xf878('0x150')});db[_0xf878('0x47')][_0xf878('0x116')](db['Trunk'],{'as':_0xf878('0x144')});db['FaxAccount'][_0xf878('0x116')](db[_0xf878('0xf1')],{'as':'List','foreignKey':'ListId'});db['FaxAccount'][_0xf878('0x116')](db[_0xf878('0x7d')],{'as':_0xf878('0x149'),'foreignKey':_0xf878('0x14a')});db[_0xf878('0x47')][_0xf878('0x119')](db[_0xf878('0xf')],{'as':'Agents','through':_0xf878('0x131')});db[_0xf878('0x49')][_0xf878('0x116')](db[_0xf878('0xf')],{'onDelete':_0xf878('0x16a')});db['FaxApplication'][_0xf878('0x116')](db['FaxQueue'],{'onDelete':_0xf878('0x16a')});db['FaxApplication'][_0xf878('0x116')](db[_0xf878('0x47')],{'onDelete':_0xf878('0x16a')});db[_0xf878('0x49')][_0xf878('0x116')](db[_0xf878('0x85')],{'onDelete':_0xf878('0x16a'),'foreignKey':_0xf878('0x16b')});db['FaxInteraction']['hasMany'](db[_0xf878('0x16f')],{'as':_0xf878('0x150'),'onDelete':_0xf878('0x10c'),'foreignKey':'FaxInteractionId'});db[_0xf878('0x4b')][_0xf878('0x116')](db[_0xf878('0x47')],{'as':_0xf878('0x161'),'foreignKey':_0xf878('0x16c')});db[_0xf878('0x4b')][_0xf878('0x116')](db[_0xf878('0x6a')],{'as':_0xf878('0x157'),'foreignKey':_0xf878('0x158')});db[_0xf878('0x4b')][_0xf878('0x116')](db['User'],{'as':_0xf878('0x170'),'foreignKey':_0xf878('0x10d')});db[_0xf878('0x4b')][_0xf878('0x119')](db[_0xf878('0x85')],{'through':_0xf878('0x171'),'as':_0xf878('0x163')});db[_0xf878('0x4b')]['belongsToMany'](db[_0xf878('0x85')],{'through':_0xf878('0x171'),'as':'ThroughTags'});db[_0xf878('0x4b')][_0xf878('0x119')](db[_0xf878('0xf')],{'as':'Users','through':_0xf878('0x124'),'foreignKey':_0xf878('0x172')});db[_0xf878('0x16f')][_0xf878('0x116')](db[_0xf878('0xf')],{'onDelete':_0xf878('0x10c'),'as':_0xf878('0xf')});db[_0xf878('0x16f')][_0xf878('0x116')](db[_0xf878('0x4b')],{'as':_0xf878('0x173'),'foreignKey':_0xf878('0x172')});db[_0xf878('0x16f')][_0xf878('0x116')](db[_0xf878('0x6a')],{'onDelete':_0xf878('0x10c'),'as':_0xf878('0x157')});db[_0xf878('0x16f')]['belongsTo'](db['Attachment'],{'as':'Attachment','foreignKey':_0xf878('0x174')});db[_0xf878('0x16f')][_0xf878('0x116')](db[_0xf878('0x47')],{'as':'Account','foreignKey':_0xf878('0x16c')});db['FaxQueue'][_0xf878('0x119')](db['User'],{'as':_0xf878('0x14b'),'through':'UserFaxQueue'});db['FaxQueue']['belongsToMany'](db['Team'],{'through':_0xf878('0x175'),'as':_0xf878('0x14c')});db[_0xf878('0x50')]['belongsTo'](db['FaxAccount'],{});db[_0xf878('0x50')]['belongsTo'](db[_0xf878('0xf1')],{'as':_0xf878('0x15e'),'foreignKey':_0xf878('0x15f')});db[_0xf878('0x50')][_0xf878('0x116')](db['CmContact'],{'as':'Contact','foreignKey':_0xf878('0x158')});db[_0xf878('0x50')][_0xf878('0x116')](db[_0xf878('0x4b')],{});db[_0xf878('0x50')][_0xf878('0x116')](db['FaxMessage'],{});db[_0xf878('0x50')][_0xf878('0x116')](db[_0xf878('0xf')],{});db[_0xf878('0x50')][_0xf878('0x116')](db['FaxQueue'],{});db['SmsAccount']['hasMany'](db[_0xf878('0x78')],{'as':_0xf878('0x15c'),'foreignKey':_0xf878('0x176'),'onDelete':_0xf878('0x10c')});db['SmsAccount'][_0xf878('0x10e')](db[_0xf878('0x76')],{'as':'Answers','foreignKey':_0xf878('0x176')});db[_0xf878('0x51')][_0xf878('0x10e')](db['SmsMessage'],{'as':'Messages','foreignKey':_0xf878('0x176')});db[_0xf878('0x51')][_0xf878('0x10e')](db[_0xf878('0x125')],{'as':'Interactions'});db[_0xf878('0x51')]['hasMany'](db[_0xf878('0x177')],{'as':_0xf878('0x13b')});db['SmsAccount'][_0xf878('0x116')](db[_0xf878('0xf1')],{'as':_0xf878('0x15e'),'foreignKey':_0xf878('0x15f')});db[_0xf878('0x51')]['belongsTo'](db[_0xf878('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0xf878('0x14a')});db[_0xf878('0x51')][_0xf878('0x119')](db['User'],{'as':_0xf878('0x14b'),'through':_0xf878('0x135')});db[_0xf878('0x177')][_0xf878('0x116')](db[_0xf878('0xf')],{'onDelete':_0xf878('0x16a')});db[_0xf878('0x177')]['belongsTo'](db[_0xf878('0x55')],{'onDelete':_0xf878('0x16a')});db['SmsApplication'][_0xf878('0x116')](db['SmsAccount'],{'onDelete':_0xf878('0x16a')});db['SmsApplication'][_0xf878('0x116')](db[_0xf878('0x7c')],{'onDelete':_0xf878('0x16a'),'foreignKey':_0xf878('0x148')});db[_0xf878('0x177')]['belongsTo'](db[_0xf878('0x85')],{'onDelete':_0xf878('0x16a'),'foreignKey':'TagId'});db[_0xf878('0x125')]['hasMany'](db['SmsMessage'],{'as':_0xf878('0x150'),'onDelete':_0xf878('0x10c'),'foreignKey':_0xf878('0x178')});db[_0xf878('0x125')][_0xf878('0x116')](db[_0xf878('0x51')],{'as':'Account','foreignKey':_0xf878('0x176')});db['SmsInteraction'][_0xf878('0x116')](db[_0xf878('0x6a')],{'as':'Contact','foreignKey':_0xf878('0x158')});db[_0xf878('0x125')][_0xf878('0x116')](db[_0xf878('0xf')],{'as':_0xf878('0x170'),'foreignKey':_0xf878('0x10d')});db[_0xf878('0x125')][_0xf878('0x119')](db[_0xf878('0x85')],{'through':_0xf878('0x179'),'as':_0xf878('0x163')});db[_0xf878('0x125')][_0xf878('0x119')](db[_0xf878('0x85')],{'through':'sms_interaction_has_tags','as':_0xf878('0x164')});db[_0xf878('0x125')][_0xf878('0x119')](db['User'],{'as':_0xf878('0x165'),'through':'user_has_sms_interactions','foreignKey':_0xf878('0x178')});db[_0xf878('0x53')][_0xf878('0x116')](db[_0xf878('0xf')],{'as':_0xf878('0xf')});db['SmsMessage'][_0xf878('0x116')](db[_0xf878('0x6a')],{'onDelete':'cascade','as':'Contact'});db[_0xf878('0x53')]['belongsTo'](db[_0xf878('0x125')],{'onDelete':_0xf878('0x10c'),'as':_0xf878('0x173'),'foreignKey':_0xf878('0x178')});db[_0xf878('0x53')][_0xf878('0x116')](db[_0xf878('0x51')],{'as':_0xf878('0x161'),'foreignKey':'SmsAccountId'});db['SmsQueue']['belongsToMany'](db[_0xf878('0xf')],{'as':_0xf878('0x14b'),'through':_0xf878('0x12d'),'foreignKey':_0xf878('0x17a')});db[_0xf878('0x55')][_0xf878('0x119')](db[_0xf878('0xdf')],{'through':_0xf878('0x17b'),'as':_0xf878('0x14c')});db[_0xf878('0x57')]['hasMany'](db[_0xf878('0x78')],{'as':_0xf878('0x15c'),'foreignKey':_0xf878('0x17c'),'onDelete':_0xf878('0x10c')});db[_0xf878('0x57')][_0xf878('0x10e')](db[_0xf878('0x76')],{'as':_0xf878('0x16d'),'foreignKey':'OpenchannelAccountId'});db[_0xf878('0x57')]['hasMany'](db[_0xf878('0x110')],{'as':_0xf878('0x16e'),'foreignKey':_0xf878('0x17c')});db['OpenchannelAccount']['hasMany'](db['OpenchannelMessage'],{'as':_0xf878('0x150'),'foreignKey':_0xf878('0x17c')});db[_0xf878('0x57')][_0xf878('0x10e')](db[_0xf878('0x17d')],{'as':'Applications','foreignKey':_0xf878('0x17c')});db[_0xf878('0x57')][_0xf878('0x116')](db['CmList'],{'as':'List','foreignKey':_0xf878('0x15f')});db[_0xf878('0x57')][_0xf878('0x116')](db[_0xf878('0x7d')],{'as':_0xf878('0x149'),'foreignKey':_0xf878('0x14a')});db[_0xf878('0x57')][_0xf878('0x119')](db[_0xf878('0xf')],{'as':_0xf878('0x14b'),'through':'user_has_openchannel_accounts'});db[_0xf878('0x17d')][_0xf878('0x116')](db[_0xf878('0xf')],{'onDelete':_0xf878('0x16a')});db['OpenchannelApplication'][_0xf878('0x116')](db[_0xf878('0x5c')],{'onDelete':_0xf878('0x16a'),'foreignKey':_0xf878('0x17e')});db[_0xf878('0x17d')][_0xf878('0x116')](db[_0xf878('0x57')],{'onDelete':_0xf878('0x16a'),'foreignKey':_0xf878('0x17c')});db['OpenchannelApplication'][_0xf878('0x116')](db[_0xf878('0x7c')],{'onDelete':_0xf878('0x16a'),'foreignKey':_0xf878('0x148')});db['OpenchannelApplication'][_0xf878('0x116')](db[_0xf878('0x85')],{'onDelete':_0xf878('0x16a'),'foreignKey':_0xf878('0x16b')});db[_0xf878('0x110')][_0xf878('0x10e')](db[_0xf878('0x5b')],{'as':_0xf878('0x150'),'onDelete':_0xf878('0x10c'),'foreignKey':_0xf878('0x17f')});db[_0xf878('0x110')][_0xf878('0x116')](db[_0xf878('0x57')],{'as':_0xf878('0x161'),'foreignKey':'OpenchannelAccountId'});db[_0xf878('0x110')][_0xf878('0x116')](db[_0xf878('0x6a')],{'as':_0xf878('0x157'),'foreignKey':_0xf878('0x158')});db[_0xf878('0x110')][_0xf878('0x116')](db['User'],{'as':_0xf878('0x170'),'foreignKey':'UserId'});db[_0xf878('0x110')][_0xf878('0x119')](db[_0xf878('0x85')],{'through':_0xf878('0x180'),'as':_0xf878('0x163')});db[_0xf878('0x110')][_0xf878('0x119')](db['Tag'],{'through':_0xf878('0x180'),'as':_0xf878('0x164')});db[_0xf878('0x110')][_0xf878('0x119')](db[_0xf878('0xf')],{'as':_0xf878('0x165'),'through':_0xf878('0x126'),'foreignKey':_0xf878('0x17f')});db[_0xf878('0x5b')][_0xf878('0x116')](db[_0xf878('0xf')],{'onDelete':_0xf878('0x10c'),'as':_0xf878('0xf')});db[_0xf878('0x5b')][_0xf878('0x116')](db[_0xf878('0x6a')],{'onDelete':_0xf878('0x10c'),'as':'Contact'});db[_0xf878('0x5b')]['belongsTo'](db[_0xf878('0x110')],{'onDelete':'cascade','as':_0xf878('0x173'),'foreignKey':_0xf878('0x17f')});db[_0xf878('0x5b')][_0xf878('0x116')](db['Attachment'],{'as':'Attachment','foreignKey':_0xf878('0x174')});db['OpenchannelMessage'][_0xf878('0x116')](db[_0xf878('0x57')],{'as':_0xf878('0x161'),'foreignKey':_0xf878('0x17c')});db[_0xf878('0x5c')]['belongsToMany'](db['User'],{'as':'Agents','through':_0xf878('0x35'),'foreignKey':'OpenchannelQueueId'});db[_0xf878('0x5c')][_0xf878('0x119')](db[_0xf878('0xdf')],{'through':_0xf878('0x181'),'as':'Teams'});db['ChatWebsite'][_0xf878('0x10e')](db[_0xf878('0x78')],{'as':_0xf878('0x15c'),'foreignKey':_0xf878('0x168'),'onDelete':_0xf878('0x10c')});db['ChatWebsite'][_0xf878('0x10e')](db[_0xf878('0x76')],{'as':_0xf878('0x16d'),'foreignKey':_0xf878('0x168')});db[_0xf878('0x5d')]['hasMany'](db[_0xf878('0x68')],{'as':_0xf878('0x182')});db[_0xf878('0x5d')][_0xf878('0x10e')](db[_0xf878('0x61')],{'as':_0xf878('0x16e')});db[_0xf878('0x5d')][_0xf878('0x10e')](db[_0xf878('0x183')],{'as':_0xf878('0x13b')});db['ChatWebsite'][_0xf878('0x10e')](db[_0xf878('0x62')],{'as':_0xf878('0x150')});db['ChatWebsite'][_0xf878('0x116')](db[_0xf878('0xf1')],{'as':_0xf878('0x15e'),'foreignKey':'ListId'});db[_0xf878('0x5d')][_0xf878('0x116')](db['Interval'],{'as':'Interval','foreignKey':_0xf878('0x148')});db[_0xf878('0x5d')]['belongsTo'](db[_0xf878('0x39')],{'as':_0xf878('0x39'),'foreignKey':_0xf878('0x159')});db['ChatWebsite'][_0xf878('0x116')](db['Pause'],{'as':_0xf878('0x149'),'foreignKey':_0xf878('0x14a')});db[_0xf878('0x5d')]['belongsToMany'](db['User'],{'as':_0xf878('0x14b'),'through':'user_has_chat_websites'});db[_0xf878('0x184')][_0xf878('0x116')](db[_0xf878('0x57')],{});db[_0xf878('0x184')][_0xf878('0x116')](db[_0xf878('0xf1')],{'as':'List','foreignKey':'ListId'});db[_0xf878('0x184')][_0xf878('0x116')](db[_0xf878('0x6a')],{'as':_0xf878('0x157'),'foreignKey':_0xf878('0x158')});db[_0xf878('0x184')]['belongsTo'](db[_0xf878('0x110')],{});db[_0xf878('0x184')][_0xf878('0x116')](db['OpenchannelMessage'],{});db['OpenchannelQueueReport'][_0xf878('0x116')](db[_0xf878('0xf')],{});db[_0xf878('0x184')][_0xf878('0x116')](db[_0xf878('0x5c')],{});db[_0xf878('0x183')][_0xf878('0x116')](db['User'],{'as':_0xf878('0x185'),'foreignKey':'UserId','onDelete':'restrict'});db[_0xf878('0x183')][_0xf878('0x116')](db[_0xf878('0x65')],{'as':'Queue','foreignKey':_0xf878('0x186'),'onDelete':'restrict'});db[_0xf878('0x183')][_0xf878('0x116')](db[_0xf878('0x5d')],{'as':'Website','foreignKey':'ChatWebsiteId','onDelete':'restrict'});db[_0xf878('0x183')]['belongsTo'](db[_0xf878('0x85')],{'onDelete':_0xf878('0x16a'),'foreignKey':_0xf878('0x16b')});db[_0xf878('0x61')][_0xf878('0x10e')](db['ChatMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0xf878('0x187')});db[_0xf878('0x61')][_0xf878('0x116')](db[_0xf878('0x5d')],{'as':'Account','foreignKey':_0xf878('0x168')});db[_0xf878('0x61')]['belongsTo'](db['CmContact'],{'as':_0xf878('0x157'),'foreignKey':'ContactId'});db['ChatInteraction']['belongsTo'](db[_0xf878('0xf')],{'as':_0xf878('0x170'),'foreignKey':'UserId'});db[_0xf878('0x61')]['belongsToMany'](db['Tag'],{'through':_0xf878('0x188'),'as':_0xf878('0x163')});db[_0xf878('0x61')][_0xf878('0x119')](db[_0xf878('0x85')],{'through':_0xf878('0x188'),'as':_0xf878('0x164')});db[_0xf878('0x61')]['belongsToMany'](db[_0xf878('0xf')],{'as':_0xf878('0x165'),'through':_0xf878('0x122'),'foreignKey':'ChatInteractionId'});db[_0xf878('0x62')][_0xf878('0x116')](db['User'],{'onDelete':_0xf878('0x10c'),'as':_0xf878('0xf')});db[_0xf878('0x62')]['belongsTo'](db['CmContact'],{'onDelete':_0xf878('0x10c'),'as':_0xf878('0x157'),'foreignKey':_0xf878('0x158')});db[_0xf878('0x62')][_0xf878('0x116')](db[_0xf878('0x61')],{'onDelete':_0xf878('0x10c'),'as':_0xf878('0x173'),'foreignKey':_0xf878('0x187')});db['ChatMessage'][_0xf878('0x116')](db[_0xf878('0xe4')],{'as':_0xf878('0xe4'),'foreignKey':_0xf878('0x174')});db[_0xf878('0x62')][_0xf878('0x116')](db[_0xf878('0x5d')],{'as':_0xf878('0x161'),'foreignKey':_0xf878('0x168')});db[_0xf878('0x63')][_0xf878('0x10e')](db['Attachment'],{'as':_0xf878('0x167'),'foreignKey':'ChatOfflineMessageId','onDelete':_0xf878('0x10c'),'hooks':!![]});db[_0xf878('0x63')][_0xf878('0x116')](db['CmContact'],{'onDelete':_0xf878('0x10c'),'as':'Contact','foreignKey':_0xf878('0x158')});db[_0xf878('0x63')][_0xf878('0x116')](db['ChatWebsite'],{'as':_0xf878('0x161'),'foreignKey':_0xf878('0x168')});db[_0xf878('0x65')]['belongsToMany'](db['User'],{'as':'Agents','through':_0xf878('0x2f'),'hooks':!![]});db[_0xf878('0x65')][_0xf878('0x119')](db['Team'],{'through':_0xf878('0x189'),'as':_0xf878('0x14c')});db[_0xf878('0x66')][_0xf878('0x10e')](db[_0xf878('0xcb')],{'as':_0xf878('0x150'),'foreignKey':_0xf878('0x18a'),'onDelete':'cascade'});db['ChatGroup'][_0xf878('0x119')](db[_0xf878('0xf')],{'as':_0xf878('0x13e'),'through':_0xf878('0x11b')});db['ChatProactiveAction']['belongsTo'](db[_0xf878('0x5d')],{'as':'Website','foreignKey':'ChatWebsiteId'});db[_0xf878('0x18b')][_0xf878('0x10e')](db[_0xf878('0x6a')],{'as':_0xf878('0x11c'),'foreignKey':_0xf878('0x18c')});db[_0xf878('0x6a')]['hasMany'](db[_0xf878('0x6c')],{'as':_0xf878('0x140'),'foreignKey':_0xf878('0x158')});db[_0xf878('0x6a')][_0xf878('0x10e')](db[_0xf878('0x6e')],{'as':'HopperFinals','foreignKey':_0xf878('0x158')});db[_0xf878('0x6a')]['hasMany'](db['CmHopperHistory'],{'as':_0xf878('0x141'),'foreignKey':_0xf878('0x158')});db[_0xf878('0x6a')][_0xf878('0x10e')](db[_0xf878('0x72')],{'as':_0xf878('0x72'),'foreignKey':_0xf878('0x158')});db[_0xf878('0x6a')]['hasMany'](db[_0xf878('0xd1')],{'as':'JscriptySessions','foreignKey':_0xf878('0x158')});db[_0xf878('0x6a')]['hasMany'](db[_0xf878('0x110')],{'as':_0xf878('0x111'),'foreignKey':_0xf878('0x158'),'onDelete':'restrict'});db[_0xf878('0x6a')][_0xf878('0x10e')](db[_0xf878('0x61')],{'as':_0xf878('0x121'),'foreignKey':_0xf878('0x158'),'onDelete':'restrict'});db[_0xf878('0x6a')][_0xf878('0x10e')](db[_0xf878('0x125')],{'as':_0xf878('0x112'),'foreignKey':_0xf878('0x158'),'onDelete':_0xf878('0x16a')});db[_0xf878('0x6a')][_0xf878('0x10e')](db[_0xf878('0x4b')],{'as':_0xf878('0x123'),'foreignKey':_0xf878('0x158'),'onDelete':'restrict'});db[_0xf878('0x6a')][_0xf878('0x10e')](db[_0xf878('0x3f')],{'as':'MailInteractions','foreignKey':_0xf878('0x158'),'onDelete':'restrict'});db[_0xf878('0x6a')][_0xf878('0x116')](db[_0xf878('0x18b')],{'as':'Company','foreignKey':'CompanyId'});db['CmContact'][_0xf878('0x116')](db[_0xf878('0xf1')],{'as':_0xf878('0x15e'),'foreignKey':_0xf878('0x15f'),'onDelete':_0xf878('0x10c')});db[_0xf878('0x6a')]['belongsToMany'](db[_0xf878('0xf')],{'as':_0xf878('0x165'),'through':'cm_user_has_contacts'});db['CmContact'][_0xf878('0x119')](db['Tag'],{'as':'Tags','through':_0xf878('0x18d')});db['CmContact'][_0xf878('0x119')](db['Tag'],{'through':_0xf878('0x18d'),'as':_0xf878('0x164')});db[_0xf878('0x6c')][_0xf878('0x116')](db[_0xf878('0x6a')],{'as':_0xf878('0x157'),'foreignKey':_0xf878('0x158'),'onDelete':_0xf878('0x10c')});db[_0xf878('0x6c')]['belongsTo'](db[_0xf878('0xf1')],{'as':_0xf878('0x15e'),'foreignKey':_0xf878('0x15f'),'onDelete':_0xf878('0x10c')});db['CmHopper'][_0xf878('0x116')](db[_0xf878('0xf')],{'as':'Agent','foreignKey':'UserId'});db[_0xf878('0x6c')][_0xf878('0x116')](db[_0xf878('0x1a')],{'as':'Queue','foreignKey':_0xf878('0x13f'),'onDelete':_0xf878('0x10c')});db[_0xf878('0x6c')]['belongsTo'](db[_0xf878('0xe1')],{'as':_0xf878('0xe1'),'foreignKey':_0xf878('0x18e'),'onDelete':_0xf878('0x10c')});db['CmHopper'][_0xf878('0x116')](db['User'],{'as':_0xf878('0x170'),'foreignKey':_0xf878('0x18f')});db['CmHopperBlack'][_0xf878('0x116')](db[_0xf878('0x6a')],{'as':_0xf878('0x157'),'foreignKey':_0xf878('0x158'),'onDelete':_0xf878('0x10c')});db[_0xf878('0x6d')][_0xf878('0x116')](db[_0xf878('0xf1')],{'as':_0xf878('0x15e'),'foreignKey':'ListId','onDelete':'cascade'});db[_0xf878('0x6d')][_0xf878('0x116')](db[_0xf878('0x1a')],{'as':_0xf878('0x190'),'foreignKey':_0xf878('0x13f'),'onDelete':_0xf878('0x10c')});db[_0xf878('0x6d')]['belongsTo'](db[_0xf878('0xe1')],{'as':_0xf878('0xe1'),'foreignKey':_0xf878('0x18e'),'onDelete':_0xf878('0x10c')});db[_0xf878('0x191')][_0xf878('0x10e')](db['Condition'],{'as':{'plural':_0xf878('0x192'),'singular':_0xf878('0x193')},'foreignKey':_0xf878('0x194'),'onDelete':_0xf878('0x10c'),'hooks':!![]});db[_0xf878('0x191')][_0xf878('0x10e')](db['Condition'],{'as':{'plural':_0xf878('0x195'),'singular':_0xf878('0x196')},'foreignKey':'AutomationAnyId','onDelete':_0xf878('0x10c'),'hooks':!![]});db[_0xf878('0x191')][_0xf878('0x10e')](db[_0xf878('0x197')],{'as':_0xf878('0x198'),'foreignKey':_0xf878('0x199'),'onDelete':_0xf878('0x10c'),'hooks':!![]});db[_0xf878('0x78')][_0xf878('0x10e')](db[_0xf878('0x78')],{'as':_0xf878('0x15c'),'foreignKey':'ParentId','onDelete':_0xf878('0x10c')});db[_0xf878('0x7c')]['hasMany'](db[_0xf878('0x7c')],{'as':_0xf878('0x19a'),'foreignKey':'IntervalId','onDelete':'cascade','hooks':!![],'required':![]});db[_0xf878('0x7c')]['hasMany'](db['VoiceExtension'],{'as':_0xf878('0x19b'),'foreignKey':_0xf878('0x148'),'onDelete':_0xf878('0x16a')});db[_0xf878('0x7c')][_0xf878('0x10e')](db[_0xf878('0x41')],{'as':'MailApplications','foreignKey':_0xf878('0x148')});db[_0xf878('0x7c')]['hasMany'](db[_0xf878('0x183')],{'as':_0xf878('0x19c'),'foreignKey':'IntervalId'});db[_0xf878('0x7c')][_0xf878('0x10e')](db[_0xf878('0x49')],{'as':_0xf878('0x19d'),'foreignKey':_0xf878('0x148')});db[_0xf878('0x7c')][_0xf878('0x10e')](db['SmsApplication'],{'as':_0xf878('0x19e'),'foreignKey':'IntervalId'});db[_0xf878('0x82')][_0xf878('0x116')](db[_0xf878('0x39')],{});db[_0xf878('0x82')][_0xf878('0x116')](db[_0xf878('0x92')],{'foreignKey':_0xf878('0x19f')});db[_0xf878('0x82')][_0xf878('0x116')](db[_0xf878('0x90')],{'foreignKey':_0xf878('0x1a0')});db[_0xf878('0x1a1')]['belongsToMany'](db[_0xf878('0x18')],{'as':_0xf878('0x1a2'),'through':_0xf878('0x13d'),'onDelete':_0xf878('0x16a')});db[_0xf878('0x85')][_0xf878('0x119')](db[_0xf878('0x6a')],{'through':'cm_contact_has_tags'});db[_0xf878('0x85')][_0xf878('0x119')](db[_0xf878('0x61')],{'through':_0xf878('0x188')});db[_0xf878('0x85')][_0xf878('0x119')](db[_0xf878('0x3f')],{'through':_0xf878('0x162')});db[_0xf878('0x85')][_0xf878('0x119')](db[_0xf878('0x125')],{'through':_0xf878('0x179')});db[_0xf878('0x85')][_0xf878('0x119')](db['FaxInteraction'],{'through':'fax_interaction_has_tags'});db[_0xf878('0x85')][_0xf878('0x119')](db['OpenchannelInteraction'],{'through':'openchannel_interaction_has_tags'});db['Tag']['belongsToMany'](db[_0xf878('0xfd')],{'through':'whatsapp_interaction_has_tags'});db[_0xf878('0x88')]['hasMany'](db[_0xf878('0x7a')],{'as':{'plural':'AllConditions','singular':_0xf878('0x1a3')},'foreignKey':_0xf878('0x1a4'),'onDelete':_0xf878('0x10c'),'hooks':!![]});db[_0xf878('0x88')][_0xf878('0x10e')](db['Condition'],{'as':{'plural':_0xf878('0x1a5'),'singular':_0xf878('0x1a6')},'foreignKey':_0xf878('0x1a7'),'onDelete':_0xf878('0x10c'),'hooks':!![]});db[_0xf878('0x88')][_0xf878('0x10e')](db[_0xf878('0x197')],{'as':_0xf878('0x198'),'foreignKey':_0xf878('0x1a8'),'onDelete':_0xf878('0x10c'),'hooks':!![]});db[_0xf878('0x90')][_0xf878('0x10e')](db[_0xf878('0x1a9')],{'as':'Fields','onDelete':_0xf878('0x10c'),'foreignKey':_0xf878('0x1a0'),'hooks':!![]});db[_0xf878('0x92')][_0xf878('0x10e')](db[_0xf878('0x1a9')],{'as':_0xf878('0x1aa'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0xf878('0x95')][_0xf878('0x10e')](db[_0xf878('0x1a9')],{'as':'Fields','onDelete':_0xf878('0x10c'),'foreignKey':_0xf878('0x1ab')});db[_0xf878('0x1a9')]['belongsTo'](db[_0xf878('0x95')],{'foreignKey':'MetricId'});db[_0xf878('0x98')][_0xf878('0x10e')](db['SalesforceConfiguration'],{'as':_0xf878('0x1ac'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xf878('0x1ad')][_0xf878('0x10e')](db[_0xf878('0x9b')],{'as':_0xf878('0x1ae'),'onDelete':_0xf878('0x10c'),'foreignKey':_0xf878('0x1af')});db[_0xf878('0x1ad')][_0xf878('0x10e')](db['SalesforceField'],{'as':_0xf878('0x1b0'),'onDelete':_0xf878('0x10c'),'foreignKey':'DescriptionId'});db[_0xf878('0x1ad')][_0xf878('0x10e')](db[_0xf878('0x9b')],{'as':_0xf878('0x1aa'),'onDelete':'cascade','foreignKey':_0xf878('0x1b1')});db['SalesforceConfiguration'][_0xf878('0x116')](db[_0xf878('0x98')],{'as':_0xf878('0x161'),'foreignKey':_0xf878('0x1b2')});db[_0xf878('0x9b')][_0xf878('0x10e')](db['SalesforceField'],{'as':_0xf878('0x1b3'),'foreignKey':_0xf878('0x1af')});db[_0xf878('0x9b')][_0xf878('0x10e')](db[_0xf878('0x9b')],{'as':_0xf878('0x1b4'),'foreignKey':_0xf878('0x1b5')});db['SalesforceField']['hasMany'](db['SalesforceField'],{'as':'Field','foreignKey':_0xf878('0x1b1')});db[_0xf878('0x9b')][_0xf878('0x116')](db['Variable'],{'as':_0xf878('0x8a'),'foreignKey':'VariableId'});db[_0xf878('0x1b6')][_0xf878('0x10e')](db[_0xf878('0x9e')],{'as':'Configurations','onDelete':_0xf878('0x10c'),'foreignKey':_0xf878('0x1b2')});db['SugarcrmConfiguration'][_0xf878('0x10e')](db['SugarcrmField'],{'as':_0xf878('0x1ae'),'onDelete':_0xf878('0x10c'),'foreignKey':_0xf878('0x1af')});db['SugarcrmConfiguration']['hasMany'](db[_0xf878('0x9f')],{'as':_0xf878('0x1b0'),'onDelete':_0xf878('0x10c'),'foreignKey':_0xf878('0x1b5')});db[_0xf878('0x9e')][_0xf878('0x10e')](db[_0xf878('0x9f')],{'as':'Fields','onDelete':_0xf878('0x10c'),'foreignKey':_0xf878('0x1b1')});db[_0xf878('0x9e')][_0xf878('0x116')](db[_0xf878('0x1b6')],{'as':_0xf878('0x161'),'foreignKey':'AccountId'});db[_0xf878('0x9f')][_0xf878('0x10e')](db[_0xf878('0x9f')],{'as':_0xf878('0x1b3'),'foreignKey':_0xf878('0x1af')});db[_0xf878('0x9f')]['hasMany'](db[_0xf878('0x9f')],{'as':_0xf878('0x1b4'),'foreignKey':_0xf878('0x1b5')});db[_0xf878('0x9f')][_0xf878('0x10e')](db[_0xf878('0x9f')],{'as':_0xf878('0x1b7'),'foreignKey':_0xf878('0x1b1')});db[_0xf878('0x9f')][_0xf878('0x116')](db[_0xf878('0x8a')],{'as':'Variable','foreignKey':_0xf878('0x1b8')});db[_0xf878('0xa1')][_0xf878('0x10e')](db[_0xf878('0x1b9')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xf878('0x1b2')});db[_0xf878('0x1b9')][_0xf878('0x10e')](db[_0xf878('0xa4')],{'as':_0xf878('0x1ae'),'onDelete':_0xf878('0x10c'),'foreignKey':'SubjectId'});db[_0xf878('0x1b9')]['hasMany'](db[_0xf878('0xa4')],{'as':_0xf878('0x1b0'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xf878('0x1b9')]['hasMany'](db[_0xf878('0xa4')],{'as':'Fields','onDelete':_0xf878('0x10c'),'foreignKey':'FieldId'});db[_0xf878('0x1b9')][_0xf878('0x116')](db[_0xf878('0xa1')],{'as':_0xf878('0x161'),'foreignKey':_0xf878('0x1b2')});db[_0xf878('0x1b9')][_0xf878('0x119')](db[_0xf878('0x85')],{'through':_0xf878('0x1ba')});db[_0xf878('0xa4')][_0xf878('0x10e')](db['DeskField'],{'as':_0xf878('0x1b3'),'foreignKey':_0xf878('0x1af')});db[_0xf878('0xa4')][_0xf878('0x10e')](db[_0xf878('0xa4')],{'as':_0xf878('0x1b4'),'foreignKey':_0xf878('0x1b5')});db[_0xf878('0xa4')][_0xf878('0x10e')](db[_0xf878('0xa4')],{'as':_0xf878('0x1b7'),'foreignKey':_0xf878('0x1b1')});db[_0xf878('0xa4')][_0xf878('0x116')](db['Variable'],{'as':_0xf878('0x8a'),'foreignKey':'VariableId'});db[_0xf878('0x1bb')][_0xf878('0x10e')](db[_0xf878('0xa7')],{'as':'Configurations','onDelete':_0xf878('0x10c'),'foreignKey':_0xf878('0x1b2')});db[_0xf878('0xa7')]['hasMany'](db[_0xf878('0xa9')],{'as':_0xf878('0x1ae'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0xf878('0xa7')][_0xf878('0x10e')](db[_0xf878('0xa9')],{'as':_0xf878('0x1b0'),'onDelete':'cascade','foreignKey':_0xf878('0x1b5')});db[_0xf878('0xa7')][_0xf878('0x10e')](db['ZohoField'],{'as':_0xf878('0x1aa'),'onDelete':'cascade','foreignKey':_0xf878('0x1b1')});db[_0xf878('0xa7')]['belongsTo'](db[_0xf878('0x1bb')],{'as':_0xf878('0x161'),'foreignKey':_0xf878('0x1b2')});db[_0xf878('0xa9')]['hasMany'](db[_0xf878('0xa9')],{'as':_0xf878('0x1b3'),'foreignKey':_0xf878('0x1af')});db[_0xf878('0xa9')][_0xf878('0x10e')](db['ZohoField'],{'as':_0xf878('0x1b4'),'foreignKey':'DescriptionId'});db[_0xf878('0xa9')]['hasMany'](db['ZohoField'],{'as':'Field','foreignKey':_0xf878('0x1b1')});db['ZohoField'][_0xf878('0x116')](db['Variable'],{'as':_0xf878('0x8a'),'foreignKey':'VariableId'});db[_0xf878('0xab')][_0xf878('0x10e')](db[_0xf878('0xad')],{'as':_0xf878('0x1ac'),'onDelete':_0xf878('0x10c'),'foreignKey':_0xf878('0x1b2')});db['ZendeskConfiguration'][_0xf878('0x10e')](db[_0xf878('0xaf')],{'as':_0xf878('0x1ae'),'foreignKey':'SubjectId'});db[_0xf878('0xad')]['hasMany'](db['ZendeskField'],{'as':_0xf878('0x1b0'),'foreignKey':'DescriptionId'});db[_0xf878('0xad')]['hasMany'](db[_0xf878('0xaf')],{'as':_0xf878('0x1aa'),'foreignKey':'FieldId'});db[_0xf878('0xad')][_0xf878('0x116')](db['ZendeskAccount'],{'as':_0xf878('0x161'),'foreignKey':_0xf878('0x1b2')});db[_0xf878('0xad')]['belongsToMany'](db['Tag'],{'through':_0xf878('0x1bc')});db['ZendeskField'][_0xf878('0x10e')](db[_0xf878('0xaf')],{'as':_0xf878('0x1b3'),'foreignKey':_0xf878('0x1af')});db[_0xf878('0xaf')][_0xf878('0x10e')](db[_0xf878('0xaf')],{'as':_0xf878('0x1b4'),'foreignKey':_0xf878('0x1b5')});db[_0xf878('0xaf')][_0xf878('0x10e')](db[_0xf878('0xaf')],{'as':_0xf878('0x1b7'),'foreignKey':_0xf878('0x1b1')});db['ZendeskField'][_0xf878('0x116')](db[_0xf878('0x8a')],{'as':_0xf878('0x8a'),'foreignKey':_0xf878('0x1b8')});db['FreshdeskAccount'][_0xf878('0x10e')](db[_0xf878('0x1bd')],{'as':_0xf878('0x1ac'),'onDelete':_0xf878('0x10c'),'foreignKey':_0xf878('0x1b2')});db[_0xf878('0x1bd')]['hasMany'](db['FreshdeskField'],{'as':_0xf878('0x1ae'),'onDelete':_0xf878('0x10c'),'foreignKey':_0xf878('0x1af')});db[_0xf878('0x1bd')][_0xf878('0x10e')](db['FreshdeskField'],{'as':_0xf878('0x1b0'),'onDelete':_0xf878('0x10c'),'foreignKey':_0xf878('0x1b5')});db[_0xf878('0x1bd')][_0xf878('0x10e')](db['FreshdeskField'],{'as':_0xf878('0x1aa'),'onDelete':_0xf878('0x10c'),'foreignKey':'FieldId'});db[_0xf878('0x1bd')][_0xf878('0x116')](db[_0xf878('0xb1')],{'as':_0xf878('0x161'),'foreignKey':_0xf878('0x1b2')});db[_0xf878('0x1bd')][_0xf878('0x119')](db[_0xf878('0x85')],{'through':_0xf878('0x1be')});db[_0xf878('0x1bf')][_0xf878('0x10e')](db[_0xf878('0x1bf')],{'as':_0xf878('0x1b3'),'foreignKey':_0xf878('0x1af')});db[_0xf878('0x1bf')][_0xf878('0x10e')](db[_0xf878('0x1bf')],{'as':_0xf878('0x1b4'),'foreignKey':'DescriptionId'});db[_0xf878('0x1bf')][_0xf878('0x10e')](db[_0xf878('0x1bf')],{'as':_0xf878('0x1b7'),'foreignKey':_0xf878('0x1b1')});db[_0xf878('0x1bf')][_0xf878('0x116')](db[_0xf878('0x8a')],{'as':_0xf878('0x8a'),'foreignKey':_0xf878('0x1b8')});db[_0xf878('0xb5')][_0xf878('0x10e')](db['VtigerConfiguration'],{'as':'Configurations','onDelete':_0xf878('0x10c'),'foreignKey':_0xf878('0x1b2')});db[_0xf878('0xb7')][_0xf878('0x10e')](db[_0xf878('0xb9')],{'as':_0xf878('0x1ae'),'foreignKey':_0xf878('0x1af')});db['VtigerConfiguration'][_0xf878('0x10e')](db[_0xf878('0xb9')],{'as':_0xf878('0x1b0'),'foreignKey':_0xf878('0x1b5')});db[_0xf878('0xb7')][_0xf878('0x10e')](db[_0xf878('0xb9')],{'as':'Fields','foreignKey':'FieldId'});db[_0xf878('0xb7')]['belongsTo'](db['VtigerAccount'],{'as':_0xf878('0x161'),'foreignKey':_0xf878('0x1b2')});db['VtigerField'][_0xf878('0x10e')](db[_0xf878('0xb9')],{'as':'Subject','foreignKey':_0xf878('0x1af')});db[_0xf878('0xb9')][_0xf878('0x10e')](db[_0xf878('0xb9')],{'as':_0xf878('0x1b4'),'foreignKey':'DescriptionId'});db[_0xf878('0xb9')][_0xf878('0x10e')](db[_0xf878('0xb9')],{'as':_0xf878('0x1b7'),'foreignKey':'FieldId'});db['VtigerField']['belongsTo'](db[_0xf878('0x8a')],{'as':_0xf878('0x8a'),'foreignKey':'VariableId'});db[_0xf878('0xba')]['hasMany'](db['ServicenowConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0xf878('0xbc')][_0xf878('0x10e')](db[_0xf878('0xbe')],{'as':_0xf878('0x1ae'),'foreignKey':'SubjectId'});db[_0xf878('0xbc')][_0xf878('0x10e')](db['ServicenowField'],{'as':_0xf878('0x1b0'),'foreignKey':'DescriptionId'});db['ServicenowConfiguration']['hasMany'](db[_0xf878('0xbe')],{'as':_0xf878('0x1aa'),'foreignKey':_0xf878('0x1b1')});db['ServicenowConfiguration']['belongsTo'](db['ServicenowAccount'],{'as':_0xf878('0x161'),'foreignKey':'AccountId'});db[_0xf878('0xbe')]['hasMany'](db[_0xf878('0xbe')],{'as':_0xf878('0x1b3'),'foreignKey':_0xf878('0x1af')});db[_0xf878('0xbe')][_0xf878('0x10e')](db[_0xf878('0xbe')],{'as':_0xf878('0x1b4'),'foreignKey':_0xf878('0x1b5')});db['ServicenowField']['hasMany'](db['ServicenowField'],{'as':'Field','foreignKey':_0xf878('0x1b1')});db[_0xf878('0xbe')][_0xf878('0x116')](db['Variable'],{'as':_0xf878('0x8a'),'foreignKey':_0xf878('0x1b8')});db[_0xf878('0xc0')][_0xf878('0x10e')](db[_0xf878('0xc1')],{'as':_0xf878('0x1ac'),'onDelete':'cascade','foreignKey':_0xf878('0x1b2')});db[_0xf878('0xc1')][_0xf878('0x10e')](db[_0xf878('0x1c0')],{'as':_0xf878('0x1ae'),'onDelete':_0xf878('0x10c'),'foreignKey':'SubjectId'});db[_0xf878('0xc1')][_0xf878('0x10e')](db['Dynamics365Field'],{'as':_0xf878('0x1b0'),'onDelete':_0xf878('0x10c'),'foreignKey':_0xf878('0x1b5')});db[_0xf878('0xc1')][_0xf878('0x10e')](db['Dynamics365Field'],{'as':_0xf878('0x1aa'),'onDelete':_0xf878('0x10c'),'foreignKey':_0xf878('0x1b1')});db[_0xf878('0xc1')][_0xf878('0x116')](db[_0xf878('0xc0')],{'as':'Account','foreignKey':_0xf878('0x1b2')});db[_0xf878('0x1c0')][_0xf878('0x10e')](db['Dynamics365Field'],{'as':_0xf878('0x1b3'),'foreignKey':'SubjectId'});db['Dynamics365Field'][_0xf878('0x10e')](db[_0xf878('0x1c0')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xf878('0x1c0')][_0xf878('0x10e')](db[_0xf878('0x1c0')],{'as':_0xf878('0x1b7'),'foreignKey':_0xf878('0x1b1')});db[_0xf878('0x1c0')][_0xf878('0x116')](db[_0xf878('0x8a')],{'as':_0xf878('0x8a'),'foreignKey':_0xf878('0x1b8')});db['FreshsalesAccount'][_0xf878('0x10e')](db[_0xf878('0x1c1')],{'as':_0xf878('0x1ac'),'onDelete':_0xf878('0x10c'),'foreignKey':'AccountId'});db[_0xf878('0x1c1')]['hasMany'](db['FreshsalesField'],{'as':_0xf878('0x1ae'),'foreignKey':_0xf878('0x1af')});db[_0xf878('0x1c1')]['hasMany'](db[_0xf878('0xc7')],{'as':'Descriptions','foreignKey':_0xf878('0x1b5')});db[_0xf878('0x1c1')][_0xf878('0x10e')](db[_0xf878('0xc7')],{'as':_0xf878('0x1aa'),'foreignKey':_0xf878('0x1b1')});db[_0xf878('0x1c1')]['belongsTo'](db[_0xf878('0xc4')],{'as':_0xf878('0x161'),'foreignKey':_0xf878('0x1b2')});db[_0xf878('0xc7')]['hasMany'](db[_0xf878('0xc7')],{'as':_0xf878('0x1b3'),'foreignKey':_0xf878('0x1af')});db[_0xf878('0xc7')][_0xf878('0x10e')](db['FreshsalesField'],{'as':_0xf878('0x1b4'),'foreignKey':_0xf878('0x1b5')});db['FreshsalesField'][_0xf878('0x10e')](db[_0xf878('0xc7')],{'as':_0xf878('0x1b7'),'foreignKey':'FieldId'});db['FreshsalesField'][_0xf878('0x116')](db['Variable'],{'as':_0xf878('0x8a'),'foreignKey':_0xf878('0x1b8')});db[_0xf878('0x1c2')][_0xf878('0x116')](db[_0xf878('0x5d')],{});db['ChatQueueReport'][_0xf878('0x116')](db[_0xf878('0xf1')],{'as':_0xf878('0x15e'),'foreignKey':_0xf878('0x15f')});db[_0xf878('0x1c2')]['belongsTo'](db[_0xf878('0x6a')],{'as':'Contact','foreignKey':_0xf878('0x158')});db[_0xf878('0x1c2')][_0xf878('0x116')](db[_0xf878('0x61')],{});db[_0xf878('0x1c2')][_0xf878('0x116')](db['ChatMessage'],{});db[_0xf878('0x1c2')][_0xf878('0x116')](db[_0xf878('0xf')],{});db[_0xf878('0x1c2')]['belongsTo'](db[_0xf878('0x65')],{});db['ChatInternalMessage'][_0xf878('0x116')](db['User'],{'onDelete':_0xf878('0x10c'),'foreignKey':'FromId'});db[_0xf878('0xcb')][_0xf878('0x116')](db['User'],{'onDelete':'cascade','foreignKey':_0xf878('0x1c3')});db[_0xf878('0xd1')][_0xf878('0x10e')](db[_0xf878('0xcf')],{'foreignKey':_0xf878('0x1c4'),'onDelete':'cascade'});db[_0xf878('0xd1')][_0xf878('0x10e')](db[_0xf878('0xcd')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0xf878('0xd3')][_0xf878('0x116')](db[_0xf878('0x51')],{});db[_0xf878('0xd3')][_0xf878('0x116')](db[_0xf878('0xf1')],{'as':_0xf878('0x15e'),'foreignKey':_0xf878('0x15f')});db['SmsQueueReport'][_0xf878('0x116')](db['CmContact'],{'as':_0xf878('0x157'),'foreignKey':'ContactId'});db[_0xf878('0xd3')]['belongsTo'](db[_0xf878('0x125')],{});db['SmsQueueReport']['belongsTo'](db[_0xf878('0x53')],{});db[_0xf878('0xd3')][_0xf878('0x116')](db['User'],{});db[_0xf878('0xd3')][_0xf878('0x116')](db[_0xf878('0x55')],{});db[_0xf878('0xd6')][_0xf878('0x10e')](db[_0xf878('0xd1')],{'foreignKey':_0xf878('0x1c5')});db[_0xf878('0xd6')]['hasMany'](db[_0xf878('0xcf')],{'foreignKey':'ProjectId'});db[_0xf878('0xd6')][_0xf878('0x10e')](db[_0xf878('0xcd')],{'foreignKey':_0xf878('0x1c5')});db['SquareProject'][_0xf878('0x119')](db[_0xf878('0xf')],{'as':_0xf878('0x165'),'through':_0xf878('0x139')});db['Team']['belongsToMany'](db['User'],{'as':_0xf878('0x14b'),'through':'user_has_teams'});db[_0xf878('0xdf')][_0xf878('0x119')](db[_0xf878('0x1a')],{'through':_0xf878('0x106'),'as':_0xf878('0x127')});db[_0xf878('0xdf')][_0xf878('0x119')](db[_0xf878('0x3b')],{'through':'team_has_mail_queues','as':_0xf878('0x129')});db[_0xf878('0xdf')][_0xf878('0x119')](db['ChatQueue'],{'through':_0xf878('0x189'),'as':_0xf878('0x12a')});db['Team'][_0xf878('0x119')](db[_0xf878('0x4e')],{'through':'team_has_fax_queues','as':'FaxQueues'});db[_0xf878('0xdf')]['belongsToMany'](db[_0xf878('0x55')],{'through':'team_has_sms_queues','as':'SmsQueues'});db[_0xf878('0xdf')]['belongsToMany'](db[_0xf878('0x5c')],{'through':_0xf878('0x181'),'as':_0xf878('0x12e')});db[_0xf878('0xdf')][_0xf878('0x119')](db[_0xf878('0x105')],{'through':_0xf878('0x1c6'),'as':'WhatsappQueues'});db[_0xf878('0xdf')][_0xf878('0x119')](db[_0xf878('0xf3')],{'through':_0xf878('0x108'),'as':_0xf878('0x128')});db[_0xf878('0xe1')]['hasMany'](db['CmHopper'],{'as':'Hoppers','foreignKey':_0xf878('0x18e')});db['Campaign'][_0xf878('0x10e')](db[_0xf878('0x6e')],{'as':_0xf878('0x10f'),'foreignKey':'CampaignId'});db[_0xf878('0xe1')][_0xf878('0x10e')](db[_0xf878('0x70')],{'as':_0xf878('0x141'),'foreignKey':_0xf878('0x18e')});db[_0xf878('0xe1')]['hasMany'](db['CmHopperBlack'],{'as':_0xf878('0x142'),'foreignKey':_0xf878('0x18e')});db[_0xf878('0xe1')][_0xf878('0x116')](db[_0xf878('0x144')],{'as':_0xf878('0x144'),'foreignKey':_0xf878('0x145')});db[_0xf878('0xe1')][_0xf878('0x116')](db[_0xf878('0x144')],{'as':_0xf878('0x146'),'foreignKey':_0xf878('0x147')});db[_0xf878('0xe1')][_0xf878('0x116')](db[_0xf878('0x7c')],{'as':_0xf878('0x7c'),'foreignKey':_0xf878('0x148')});db['Campaign'][_0xf878('0x116')](db[_0xf878('0xdb')],{'as':'SquareProject','foreignKey':'SquareProjectId'});db[_0xf878('0xe1')][_0xf878('0x119')](db[_0xf878('0xf1')],{'as':_0xf878('0x11d'),'through':'campaigns_has_cm_lists'});db['Campaign'][_0xf878('0x119')](db['CmList'],{'as':_0xf878('0x14d'),'through':_0xf878('0x1c7')});db[_0xf878('0xe4')][_0xf878('0x116')](db[_0xf878('0x63')],{'as':_0xf878('0x63'),'foreignKey':_0xf878('0x169')});db[_0xf878('0xe7')]['belongsTo'](db[_0xf878('0x15d')],{});db[_0xf878('0xe7')][_0xf878('0x116')](db[_0xf878('0x3f')],{});db['MailTransferReport'][_0xf878('0x116')](db[_0xf878('0x39')],{'foreignKey':_0xf878('0x1c8'),'as':_0xf878('0x1c9')});db[_0xf878('0xe7')][_0xf878('0x116')](db['User'],{'foreignKey':'FromUserId','as':_0xf878('0x1ca')});db[_0xf878('0xe7')]['belongsTo'](db[_0xf878('0xf')],{'foreignKey':_0xf878('0x1cb'),'as':_0xf878('0x1cc')});db['MailTransferReport'][_0xf878('0x116')](db['MailQueue'],{'foreignKey':'ToMailQueueId','as':_0xf878('0x1cd')});db['MailTransferReport'][_0xf878('0x116')](db[_0xf878('0x39')],{'foreignKey':'ToMailAccountId','as':_0xf878('0x1ce')});db['ChatTransferReport'][_0xf878('0x116')](db[_0xf878('0x62')],{});db[_0xf878('0xe9')]['belongsTo'](db[_0xf878('0x61')],{});db['ChatTransferReport'][_0xf878('0x116')](db[_0xf878('0x5d')],{'foreignKey':_0xf878('0x1cf'),'as':_0xf878('0x1c9')});db[_0xf878('0xe9')][_0xf878('0x116')](db[_0xf878('0xf')],{'foreignKey':_0xf878('0x1d0'),'as':_0xf878('0x1ca')});db[_0xf878('0xe9')][_0xf878('0x116')](db[_0xf878('0xf')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xf878('0xe9')][_0xf878('0x116')](db[_0xf878('0x65')],{'foreignKey':_0xf878('0x1d1'),'as':_0xf878('0x1cd')});db['ChatTransferReport'][_0xf878('0x116')](db[_0xf878('0x5d')],{'foreignKey':_0xf878('0x1d2'),'as':_0xf878('0x1ce')});db[_0xf878('0xeb')]['belongsTo'](db[_0xf878('0x16f')],{});db[_0xf878('0xeb')]['belongsTo'](db['FaxInteraction'],{});db['FaxTransferReport'][_0xf878('0x116')](db['FaxAccount'],{'foreignKey':_0xf878('0x1d3'),'as':'FromAccount'});db[_0xf878('0xeb')][_0xf878('0x116')](db[_0xf878('0xf')],{'foreignKey':_0xf878('0x1d0'),'as':_0xf878('0x1ca')});db[_0xf878('0xeb')]['belongsTo'](db[_0xf878('0xf')],{'foreignKey':_0xf878('0x1cb'),'as':_0xf878('0x1cc')});db[_0xf878('0xeb')][_0xf878('0x116')](db[_0xf878('0x4e')],{'foreignKey':_0xf878('0x1d4'),'as':'ToQueue'});db['FaxTransferReport'][_0xf878('0x116')](db[_0xf878('0x47')],{'foreignKey':_0xf878('0x1d5'),'as':_0xf878('0x1ce')});db['OpenchannelTransferReport']['belongsTo'](db[_0xf878('0x5b')],{});db[_0xf878('0xed')]['belongsTo'](db[_0xf878('0x110')],{});db[_0xf878('0xed')][_0xf878('0x116')](db[_0xf878('0x57')],{'foreignKey':_0xf878('0x1d6'),'as':_0xf878('0x1c9')});db['OpenchannelTransferReport'][_0xf878('0x116')](db[_0xf878('0xf')],{'foreignKey':_0xf878('0x1d0'),'as':'FromAgent'});db[_0xf878('0xed')][_0xf878('0x116')](db[_0xf878('0xf')],{'foreignKey':_0xf878('0x1cb'),'as':_0xf878('0x1cc')});db[_0xf878('0xed')][_0xf878('0x116')](db[_0xf878('0x5c')],{'foreignKey':'ToOpenchannelQueueId','as':_0xf878('0x1cd')});db[_0xf878('0xed')]['belongsTo'](db[_0xf878('0x57')],{'foreignKey':_0xf878('0x1d7'),'as':_0xf878('0x1ce')});db[_0xf878('0xef')][_0xf878('0x116')](db[_0xf878('0x53')],{});db[_0xf878('0xef')][_0xf878('0x116')](db[_0xf878('0x125')],{});db['SmsTransferReport'][_0xf878('0x116')](db['SmsAccount'],{'foreignKey':_0xf878('0x1d8'),'as':_0xf878('0x1c9')});db[_0xf878('0xef')][_0xf878('0x116')](db[_0xf878('0xf')],{'foreignKey':_0xf878('0x1d0'),'as':_0xf878('0x1ca')});db[_0xf878('0xef')]['belongsTo'](db['User'],{'foreignKey':_0xf878('0x1cb'),'as':_0xf878('0x1cc')});db[_0xf878('0xef')][_0xf878('0x116')](db['SmsQueue'],{'foreignKey':_0xf878('0x1d9'),'as':_0xf878('0x1cd')});db[_0xf878('0xef')][_0xf878('0x116')](db['SmsAccount'],{'foreignKey':_0xf878('0x1da'),'as':_0xf878('0x1ce')});db[_0xf878('0xf1')][_0xf878('0x10e')](db[_0xf878('0x78')],{'as':_0xf878('0x15c'),'foreignKey':_0xf878('0x15f'),'onDelete':'cascade'});db[_0xf878('0xf1')]['hasMany'](db[_0xf878('0x1db')],{'as':_0xf878('0x1dc'),'foreignKey':'ListId'});db[_0xf878('0xf1')]['hasMany'](db[_0xf878('0x6a')],{'as':_0xf878('0x11c'),'onDelete':_0xf878('0x10c'),'foreignKey':_0xf878('0x15f')});db[_0xf878('0xf1')][_0xf878('0x10e')](db[_0xf878('0x6e')],{'as':_0xf878('0x10f'),'foreignKey':_0xf878('0x15f')});db[_0xf878('0xf1')][_0xf878('0x10e')](db[_0xf878('0x70')],{'as':_0xf878('0x1dd'),'foreignKey':_0xf878('0x15f')});db['CmList']['hasMany'](db[_0xf878('0x72')],{'as':_0xf878('0x72'),'foreignKey':_0xf878('0x15f')});db['CmList'][_0xf878('0x119')](db['VoiceQueue'],{'as':_0xf878('0x1de'),'through':_0xf878('0x1df')});db['CmList'][_0xf878('0x119')](db[_0xf878('0xf')],{'as':_0xf878('0x14b'),'through':_0xf878('0x11e')});db[_0xf878('0xf3')][_0xf878('0x10e')](db[_0xf878('0x16')],{'as':_0xf878('0x19b'),'onDelete':_0xf878('0x10c')});db[_0xf878('0xf3')]['belongsToMany'](db[_0xf878('0xf')],{'as':_0xf878('0x14b'),'through':_0xf878('0x1e0')});db['VoicePrefix']['belongsToMany'](db['Team'],{'through':_0xf878('0x108'),'as':_0xf878('0x14c')});db[_0xf878('0x117')][_0xf878('0x10e')](db[_0xf878('0xf')],{'as':'Users','foreignKey':'userProfileId'});db[_0xf878('0x117')][_0xf878('0x10e')](db[_0xf878('0xf5')],{'as':_0xf878('0x1e1'),'foreignKey':_0xf878('0x118'),'onDelete':_0xf878('0x10c')});db[_0xf878('0xf5')]['hasMany'](db[_0xf878('0xf6')],{'as':_0xf878('0x1e2'),'foreignKey':'sectionId','onDelete':_0xf878('0x10c')});db['WhatsappAccount'][_0xf878('0x10e')](db[_0xf878('0x78')],{'as':_0xf878('0x15c'),'foreignKey':_0xf878('0x1e3'),'onDelete':_0xf878('0x10c')});db[_0xf878('0xfa')]['hasMany'](db[_0xf878('0x76')],{'as':'Answers','foreignKey':_0xf878('0x1e3')});db['WhatsappAccount'][_0xf878('0x10e')](db[_0xf878('0xff')],{'as':'Messages','foreignKey':_0xf878('0x1e3')});db[_0xf878('0xfa')][_0xf878('0x10e')](db['WhatsappInteraction'],{'as':_0xf878('0x16e')});db[_0xf878('0xfa')]['hasMany'](db[_0xf878('0xfc')],{'as':_0xf878('0x13b')});db[_0xf878('0xfa')][_0xf878('0x116')](db[_0xf878('0xf1')],{'as':'List','foreignKey':_0xf878('0x15f')});db[_0xf878('0xfa')]['belongsTo'](db[_0xf878('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0xf878('0x14a')});db[_0xf878('0xfa')][_0xf878('0x119')](db[_0xf878('0xf')],{'as':_0xf878('0x14b'),'through':_0xf878('0x137')});db[_0xf878('0xfc')][_0xf878('0x116')](db[_0xf878('0xf')],{'onDelete':_0xf878('0x16a')});db[_0xf878('0xfc')][_0xf878('0x116')](db[_0xf878('0x105')],{'onDelete':'restrict'});db['WhatsappApplication']['belongsTo'](db[_0xf878('0xfa')],{'onDelete':_0xf878('0x16a')});db[_0xf878('0xfc')]['belongsTo'](db['Interval'],{'onDelete':_0xf878('0x16a'),'foreignKey':_0xf878('0x148')});db[_0xf878('0xfc')][_0xf878('0x116')](db['Tag'],{'onDelete':_0xf878('0x16a'),'foreignKey':'TagId'});db[_0xf878('0xfd')][_0xf878('0x10e')](db['WhatsappMessage'],{'as':_0xf878('0x150'),'onDelete':_0xf878('0x10c'),'foreignKey':_0xf878('0x1e4')});db[_0xf878('0xfd')][_0xf878('0x116')](db['WhatsappAccount'],{'as':_0xf878('0x161'),'foreignKey':_0xf878('0x1e3')});db[_0xf878('0xfd')][_0xf878('0x116')](db['CmContact'],{'as':_0xf878('0x157'),'foreignKey':_0xf878('0x158')});db[_0xf878('0xfd')][_0xf878('0x116')](db[_0xf878('0xf')],{'as':_0xf878('0x170'),'foreignKey':_0xf878('0x10d')});db[_0xf878('0xfd')]['belongsToMany'](db['Tag'],{'through':_0xf878('0x1e5'),'as':_0xf878('0x163')});db[_0xf878('0xfd')][_0xf878('0x119')](db[_0xf878('0x85')],{'through':_0xf878('0x1e5'),'as':_0xf878('0x164')});db[_0xf878('0xfd')][_0xf878('0x119')](db['User'],{'as':_0xf878('0x165'),'through':'user_has_whatsapp_interactions','foreignKey':_0xf878('0x1e4')});db['WhatsappMessage']['belongsTo'](db[_0xf878('0xf')],{'as':'User'});db['WhatsappMessage']['belongsTo'](db['CmContact'],{'onDelete':_0xf878('0x10c'),'as':_0xf878('0x157')});db[_0xf878('0xff')][_0xf878('0x116')](db['WhatsappInteraction'],{'onDelete':_0xf878('0x10c'),'as':_0xf878('0x173'),'foreignKey':_0xf878('0x1e4')});db[_0xf878('0xff')][_0xf878('0x116')](db['WhatsappAccount'],{'as':'Account','foreignKey':'WhatsappAccountId'});db['WhatsappQueueReport'][_0xf878('0x116')](db[_0xf878('0xfa')],{});db[_0xf878('0x101')][_0xf878('0x116')](db[_0xf878('0xf1')],{'as':_0xf878('0x15e'),'foreignKey':_0xf878('0x15f')});db[_0xf878('0x101')][_0xf878('0x116')](db[_0xf878('0x6a')],{'as':_0xf878('0x157'),'foreignKey':_0xf878('0x158')});db['WhatsappQueueReport'][_0xf878('0x116')](db[_0xf878('0xfd')],{});db['WhatsappQueueReport'][_0xf878('0x116')](db[_0xf878('0x105')],{});db[_0xf878('0x101')][_0xf878('0x116')](db[_0xf878('0xff')],{});db[_0xf878('0x101')][_0xf878('0x116')](db[_0xf878('0xf')],{});db['WhatsappTransferReport'][_0xf878('0x116')](db[_0xf878('0xff')],{});db[_0xf878('0x103')][_0xf878('0x116')](db['WhatsappInteraction'],{});db[_0xf878('0x103')][_0xf878('0x116')](db[_0xf878('0xfa')],{'foreignKey':'FromWhatsappAccountId','as':_0xf878('0x1c9')});db['WhatsappTransferReport']['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0xf878('0x1e6'),'as':_0xf878('0x1ce')});db[_0xf878('0x103')][_0xf878('0x116')](db[_0xf878('0x105')],{'foreignKey':_0xf878('0x1e7'),'as':_0xf878('0x1cd')});db[_0xf878('0x103')][_0xf878('0x116')](db[_0xf878('0xf')],{'foreignKey':'FromUserId','as':_0xf878('0x1ca')});db[_0xf878('0x103')][_0xf878('0x116')](db[_0xf878('0xf')],{'foreignKey':'ToUserId','as':_0xf878('0x1cc')});db[_0xf878('0x105')][_0xf878('0x119')](db['User'],{'as':_0xf878('0x14b'),'through':'UserWhatsappQueue','foreignKey':'WhatsappQueueId'});db[_0xf878('0x105')][_0xf878('0x119')](db[_0xf878('0xdf')],{'through':_0xf878('0x1c6'),'as':'Teams'});module[_0xf878('0x1e8')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index dc17195..df76ae4 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5471=['./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/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/actions','./api/action','./api/automation','/api/canned_answers','/api/conditions','./api/interval','./api/pause','/api/cdr','./api/cdr','./api/schedule','/api/sounds','/api/tags','./api/template','./api/trigger','/api/variables','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/zoho/accounts','./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/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/networks','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/authLocal','./api/authGoogle','./api/jira','/api/rpc','./api/rpc','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','3.0.0','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','appPath','/index.html','username','password','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridnum','exten','vidaooApiKey','accesskeyid','key','pass','localstationid','secret','registry','oldPassword','isPlainObject','isArray','isString','replace','@@{','includes','lodash','path','express','express-winston','util','./errors','./config/logger','api','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','name','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','method','other','agent_name','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceExtension','/api/voice/mohs','/api/voice/queues','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions'];(function(_0x2d19b9,_0x4e7fa4){var _0x10b8e4=function(_0x221cf1){while(--_0x221cf1){_0x2d19b9['push'](_0x2d19b9['shift']());}};_0x10b8e4(++_0x4e7fa4);}(_0x5471,0xfe));var _0x1547=function(_0x289b71,_0xa160ed){_0x289b71=_0x289b71-0x0;var _0x21bf3c=_0x5471[_0x289b71];return _0x21bf3c;};'use strict';var _=require(_0x1547('0x0'));var path=require(_0x1547('0x1'));var express=require(_0x1547('0x2'));var ewinston=require(_0x1547('0x3'));var util=require(_0x1547('0x4'));var errors=require(_0x1547('0x5'));var config=require('./config/environment');var logger=require(_0x1547('0x6'))(_0x1547('0x7'));var authLogger=require(_0x1547('0x6'))(_0x1547('0x8'));exports[_0x1547('0x9')]=function(_0x7949a9){_0x7949a9[_0x1547('0xa')](ewinston[_0x1547('0xb')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x533562,_0x1e09a6){var _0x406730=_0x1547('0xc');if(!_[_0x1547('0xd')](_0x533562[_0x1547('0xe')])){_0x406730+=_0x1547('0xf');var _0x4b8757=_0x533562['body'];maskSensitiveData(_0x4b8757);}return util[_0x1547('0x10')](_0x406730,_0x533562['method'],_0x533562[_0x1547('0x11')][_0x1547('0x12')]?_0x533562['headers'][_0x1547('0x12')]:_0x533562[_0x1547('0x13')][_0x1547('0x14')]||_0x533562['ip'],_0x533562[_0x1547('0x15')],_0x1e09a6[_0x1547('0x16')],_0x1e09a6[_0x1547('0x17')],_0x533562[_0x1547('0x18')]?_0x533562['user']['id']:null,_0x533562['user']?_0x533562['user'][_0x1547('0x19')]:null,_0x533562[_0x1547('0x18')]?_0x533562[_0x1547('0x18')][_0x1547('0x1a')]:null,_0x4b8757?util[_0x1547('0x1b')](_0x4b8757,![],null):'');}}));_0x7949a9[_0x1547('0xa')](ewinston[_0x1547('0xb')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0xaceaa6,_0x1a0c50){var _0x1b1740=_0x1547('0x1c');if(_0xaceaa6[_0x1547('0xe')]&&_0xaceaa6[_0x1547('0xe')][_0x1547('0x1d')]&&_0xaceaa6['body'][_0x1547('0x1e')]){_0x1b1740='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x1547('0x10')](_0x1b1740,_0xaceaa6[_0x1547('0x1f')],_0xaceaa6['headers'][_0x1547('0x12')]?_0xaceaa6[_0x1547('0x11')][_0x1547('0x12')]:_0xaceaa6[_0x1547('0x13')][_0x1547('0x14')]||_0xaceaa6['ip'],_0xaceaa6['url'],_0x1a0c50[_0x1547('0x16')],_0x1a0c50[_0x1547('0x17')],_0xaceaa6[_0x1547('0x18')]?_0xaceaa6[_0x1547('0x18')]['id']:null,_0xaceaa6[_0x1547('0x18')]?_0xaceaa6['user'][_0x1547('0x19')]:null,_0xaceaa6['user']?_0xaceaa6['user']['role']:null,_0xaceaa6[_0x1547('0xe')]&&_0xaceaa6[_0x1547('0xe')][_0x1547('0x1d')]?_0xaceaa6[_0x1547('0xe')][_0x1547('0x1d')]:_0x1547('0x20'),_0xaceaa6['body']&&_0xaceaa6[_0x1547('0xe')][_0x1547('0x1e')]?_0xaceaa6['body']['agent_id']:'',_0xaceaa6[_0x1547('0xe')]&&_0xaceaa6['body']['agent_name']?_0xaceaa6[_0x1547('0xe')][_0x1547('0x21')]:'');},'ignoreRoute':function(_0x1870f7){var _0x322f55=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x322f55['test'](_0x1870f7[_0x1547('0x15')]);}}));_0x7949a9[_0x1547('0xa')]('/api/users',require('./api/user'));_0x7949a9['use'](_0x1547('0x22'),require(_0x1547('0x23')));_0x7949a9[_0x1547('0xa')](_0x1547('0x24'),require('./api/voiceContext'));_0x7949a9[_0x1547('0xa')]('/api/voice/extensions',require(_0x1547('0x25')));_0x7949a9[_0x1547('0xa')](_0x1547('0x26'),require('./api/voiceMusicOnHold'));_0x7949a9['use'](_0x1547('0x27'),require('./api/voiceQueue'));_0x7949a9[_0x1547('0xa')](_0x1547('0x28'),require('./api/voiceRecording'));_0x7949a9[_0x1547('0xa')](_0x1547('0x29'),require(_0x1547('0x2a')));_0x7949a9[_0x1547('0xa')]('/api/voice/mails',require(_0x1547('0x2b')));_0x7949a9[_0x1547('0xa')](_0x1547('0x2c'),require(_0x1547('0x2d')));_0x7949a9['use'](_0x1547('0x2e'),require(_0x1547('0x2f')));_0x7949a9[_0x1547('0xa')](_0x1547('0x30'),require(_0x1547('0x31')));_0x7949a9[_0x1547('0xa')](_0x1547('0x32'),require(_0x1547('0x33')));_0x7949a9['use'](_0x1547('0x34'),require(_0x1547('0x35')));_0x7949a9[_0x1547('0xa')](_0x1547('0x36'),require(_0x1547('0x37')));_0x7949a9[_0x1547('0xa')](_0x1547('0x38'),require(_0x1547('0x39')));_0x7949a9[_0x1547('0xa')](_0x1547('0x3a'),require(_0x1547('0x3b')));_0x7949a9[_0x1547('0xa')]('/api/mail/out_servers',require(_0x1547('0x3c')));_0x7949a9[_0x1547('0xa')](_0x1547('0x3d'),require(_0x1547('0x3e')));_0x7949a9[_0x1547('0xa')](_0x1547('0x3f'),require(_0x1547('0x40')));_0x7949a9[_0x1547('0xa')](_0x1547('0x41'),require(_0x1547('0x42')));_0x7949a9[_0x1547('0xa')](_0x1547('0x43'),require(_0x1547('0x44')));_0x7949a9[_0x1547('0xa')](_0x1547('0x45'),require('./api/mailMessage'));_0x7949a9[_0x1547('0xa')](_0x1547('0x46'),require(_0x1547('0x47')));_0x7949a9[_0x1547('0xa')](_0x1547('0x48'),require(_0x1547('0x49')));_0x7949a9['use'](_0x1547('0x4a'),require(_0x1547('0x4b')));_0x7949a9[_0x1547('0xa')]('/api/dashboards/items',require(_0x1547('0x4c')));_0x7949a9[_0x1547('0xa')](_0x1547('0x4d'),require(_0x1547('0x4e')));_0x7949a9['use'](_0x1547('0x4f'),require('./api/faxApplication'));_0x7949a9[_0x1547('0xa')](_0x1547('0x50'),require(_0x1547('0x51')));_0x7949a9['use'](_0x1547('0x52'),require(_0x1547('0x53')));_0x7949a9[_0x1547('0xa')](_0x1547('0x54'),require(_0x1547('0x55')));_0x7949a9[_0x1547('0xa')]('/api/fax/reports/queue',require(_0x1547('0x56')));_0x7949a9[_0x1547('0xa')](_0x1547('0x57'),require(_0x1547('0x58')));_0x7949a9[_0x1547('0xa')](_0x1547('0x59'),require(_0x1547('0x5a')));_0x7949a9['use'](_0x1547('0x5b'),require(_0x1547('0x5c')));_0x7949a9[_0x1547('0xa')]('/api/sms/messages',require(_0x1547('0x5d')));_0x7949a9['use'](_0x1547('0x5e'),require(_0x1547('0x5f')));_0x7949a9[_0x1547('0xa')](_0x1547('0x60'),require('./api/openchannelAccount'));_0x7949a9[_0x1547('0xa')](_0x1547('0x61'),require(_0x1547('0x62')));_0x7949a9[_0x1547('0xa')](_0x1547('0x63'),require(_0x1547('0x64')));_0x7949a9['use'](_0x1547('0x65'),require(_0x1547('0x66')));_0x7949a9[_0x1547('0xa')]('/api/openchannel/queues',require(_0x1547('0x67')));_0x7949a9[_0x1547('0xa')](_0x1547('0x68'),require('./api/chatWebsite'));_0x7949a9['use'](_0x1547('0x69'),require(_0x1547('0x6a')));_0x7949a9[_0x1547('0xa')](_0x1547('0x6b'),require('./api/chatApplication'));_0x7949a9[_0x1547('0xa')](_0x1547('0x6c'),require(_0x1547('0x6d')));_0x7949a9[_0x1547('0xa')](_0x1547('0x6e'),require('./api/chatMessage'));_0x7949a9[_0x1547('0xa')]('/api/chat/offline_messages',require(_0x1547('0x6f')));_0x7949a9[_0x1547('0xa')](_0x1547('0x70'),require('./api/chatQueue'));_0x7949a9[_0x1547('0xa')]('/api/chat/groups',require(_0x1547('0x71')));_0x7949a9['use'](_0x1547('0x72'),require(_0x1547('0x73')));_0x7949a9[_0x1547('0xa')](_0x1547('0x74'),require(_0x1547('0x75')));_0x7949a9[_0x1547('0xa')](_0x1547('0x76'),require('./api/cmContact'));_0x7949a9[_0x1547('0xa')](_0x1547('0x77'),require(_0x1547('0x78')));_0x7949a9[_0x1547('0xa')](_0x1547('0x79'),require(_0x1547('0x7a')));_0x7949a9[_0x1547('0xa')](_0x1547('0x7b'),require(_0x1547('0x7c')));_0x7949a9[_0x1547('0xa')](_0x1547('0x7d'),require(_0x1547('0x7e')));_0x7949a9[_0x1547('0xa')](_0x1547('0x7f'),require(_0x1547('0x80')));_0x7949a9[_0x1547('0xa')](_0x1547('0x81'),require(_0x1547('0x82')));_0x7949a9['use']('/api/automations',require(_0x1547('0x83')));_0x7949a9[_0x1547('0xa')](_0x1547('0x84'),require('./api/cannedAnswer'));_0x7949a9['use']('/api/dispositions',require('./api/disposition'));_0x7949a9[_0x1547('0xa')](_0x1547('0x85'),require('./api/condition'));_0x7949a9[_0x1547('0xa')]('/api/intervals',require(_0x1547('0x86')));_0x7949a9['use']('/api/pauses',require(_0x1547('0x87')));_0x7949a9[_0x1547('0xa')](_0x1547('0x88'),require(_0x1547('0x89')));_0x7949a9[_0x1547('0xa')]('/api/voiceQueuesLog',require('./api/voiceQueuesLog'));_0x7949a9[_0x1547('0xa')]('/api/schedules',require(_0x1547('0x8a')));_0x7949a9[_0x1547('0xa')](_0x1547('0x8b'),require('./api/sound'));_0x7949a9[_0x1547('0xa')](_0x1547('0x8c'),require('./api/tag'));_0x7949a9[_0x1547('0xa')]('/api/templates',require(_0x1547('0x8d')));_0x7949a9[_0x1547('0xa')]('/api/triggers',require(_0x1547('0x8e')));_0x7949a9[_0x1547('0xa')](_0x1547('0x8f'),require(_0x1547('0x90')));_0x7949a9[_0x1547('0xa')]('/api/integrations',require(_0x1547('0x91')));_0x7949a9[_0x1547('0xa')](_0x1547('0x92'),require(_0x1547('0x93')));_0x7949a9[_0x1547('0xa')]('/api/analytics/custom_reports',require(_0x1547('0x94')));_0x7949a9[_0x1547('0xa')](_0x1547('0x95'),require(_0x1547('0x96')));_0x7949a9[_0x1547('0xa')](_0x1547('0x97'),require('./api/analyticExtractedReport'));_0x7949a9['use'](_0x1547('0x98'),require('./api/analyticMetric'));_0x7949a9[_0x1547('0xa')](_0x1547('0x99'),require('./api/analyticFieldReport'));_0x7949a9['use']('/api/analytics/tree_reports',require(_0x1547('0x9a')));_0x7949a9['use']('/api/integrations/salesforce/accounts',require(_0x1547('0x9b')));_0x7949a9['use'](_0x1547('0x9c'),require(_0x1547('0x9d')));_0x7949a9[_0x1547('0xa')]('/api/integrations/salesforce/fields',require(_0x1547('0x9e')));_0x7949a9['use'](_0x1547('0x9f'),require(_0x1547('0xa0')));_0x7949a9[_0x1547('0xa')](_0x1547('0xa1'),require('./api/intSugarcrmConfiguration'));_0x7949a9[_0x1547('0xa')]('/api/integrations/sugarcrm/fields',require(_0x1547('0xa2')));_0x7949a9[_0x1547('0xa')](_0x1547('0xa3'),require(_0x1547('0xa4')));_0x7949a9[_0x1547('0xa')](_0x1547('0xa5'),require(_0x1547('0xa6')));_0x7949a9['use']('/api/integrations/desk/fields',require('./api/intDeskField'));_0x7949a9[_0x1547('0xa')](_0x1547('0xa7'),require('./api/intZohoAccount'));_0x7949a9[_0x1547('0xa')]('/api/integrations/zoho/configurations',require(_0x1547('0xa8')));_0x7949a9[_0x1547('0xa')](_0x1547('0xa9'),require(_0x1547('0xaa')));_0x7949a9[_0x1547('0xa')](_0x1547('0xab'),require(_0x1547('0xac')));_0x7949a9[_0x1547('0xa')](_0x1547('0xad'),require(_0x1547('0xae')));_0x7949a9[_0x1547('0xa')](_0x1547('0xaf'),require(_0x1547('0xb0')));_0x7949a9[_0x1547('0xa')](_0x1547('0xb1'),require('./api/intFreshdeskAccount'));_0x7949a9[_0x1547('0xa')](_0x1547('0xb2'),require(_0x1547('0xb3')));_0x7949a9['use'](_0x1547('0xb4'),require('./api/intFreshdeskField'));_0x7949a9[_0x1547('0xa')](_0x1547('0xb5'),require(_0x1547('0xb6')));_0x7949a9[_0x1547('0xa')](_0x1547('0xb7'),require(_0x1547('0xb8')));_0x7949a9[_0x1547('0xa')]('/api/integrations/vtiger/fields',require('./api/intVtigerField'));_0x7949a9[_0x1547('0xa')](_0x1547('0xb9'),require('./api/intServicenowAccount'));_0x7949a9[_0x1547('0xa')](_0x1547('0xba'),require('./api/intServicenowConfiguration'));_0x7949a9[_0x1547('0xa')](_0x1547('0xbb'),require('./api/intServicenowField'));_0x7949a9[_0x1547('0xa')](_0x1547('0xbc'),require(_0x1547('0xbd')));_0x7949a9[_0x1547('0xa')](_0x1547('0xbe'),require('./api/intDynamics365Configuration'));_0x7949a9[_0x1547('0xa')](_0x1547('0xbf'),require(_0x1547('0xc0')));_0x7949a9['use'](_0x1547('0xc1'),require(_0x1547('0xc2')));_0x7949a9[_0x1547('0xa')](_0x1547('0xc3'),require(_0x1547('0xc4')));_0x7949a9[_0x1547('0xa')]('/api/integrations/freshsales/fields',require('./api/intFreshsalesField'));_0x7949a9[_0x1547('0xa')](_0x1547('0xc5'),require('./api/network'));_0x7949a9[_0x1547('0xa')](_0x1547('0xc6'),require(_0x1547('0xc7')));_0x7949a9[_0x1547('0xa')](_0x1547('0xc8'),require(_0x1547('0xc9')));_0x7949a9[_0x1547('0xa')]('/api/jscripty/answers/reports',require(_0x1547('0xca')));_0x7949a9[_0x1547('0xa')](_0x1547('0xcb'),require(_0x1547('0xcc')));_0x7949a9[_0x1547('0xa')](_0x1547('0xcd'),require(_0x1547('0xce')));_0x7949a9['use'](_0x1547('0xcf'),require(_0x1547('0xd0')));_0x7949a9[_0x1547('0xa')]('/api/square/reports',require(_0x1547('0xd1')));_0x7949a9['use'](_0x1547('0xd2'),require('./api/squareReportDetail'));_0x7949a9[_0x1547('0xa')](_0x1547('0xd3'),require(_0x1547('0xd4')));_0x7949a9[_0x1547('0xa')](_0x1547('0xd5'),require(_0x1547('0xd6')));_0x7949a9['use'](_0x1547('0xd7'),require(_0x1547('0xd8')));_0x7949a9[_0x1547('0xa')]('/api/square/projects',require(_0x1547('0xd9')));_0x7949a9['use'](_0x1547('0xda'),require(_0x1547('0xdb')));_0x7949a9[_0x1547('0xa')](_0x1547('0xdc'),require(_0x1547('0xdd')));_0x7949a9['use']('/api/teams',require('./api/team'));_0x7949a9[_0x1547('0xa')]('/api/license',require(_0x1547('0xde')));_0x7949a9[_0x1547('0xa')](_0x1547('0xdf'),require(_0x1547('0xe0')));_0x7949a9[_0x1547('0xa')](_0x1547('0xe1'),require(_0x1547('0xe2')));_0x7949a9[_0x1547('0xa')](_0x1547('0xe3'),require(_0x1547('0xe4')));_0x7949a9[_0x1547('0xa')](_0x1547('0xe5'),require(_0x1547('0xe6')));_0x7949a9['use'](_0x1547('0xe7'),require('./api/mailTransferReport'));_0x7949a9[_0x1547('0xa')](_0x1547('0xe8'),require(_0x1547('0xe9')));_0x7949a9[_0x1547('0xa')]('/api/fax/reports/transfer',require('./api/faxTransferReport'));_0x7949a9[_0x1547('0xa')](_0x1547('0xea'),require(_0x1547('0xeb')));_0x7949a9[_0x1547('0xa')](_0x1547('0xec'),require('./api/smsTransferReport'));_0x7949a9[_0x1547('0xa')](_0x1547('0xed'),require(_0x1547('0xee')));_0x7949a9[_0x1547('0xa')]('/api/voice/prefixes',require('./api/voicePrefix'));_0x7949a9[_0x1547('0xa')]('/api/userProfiles',require(_0x1547('0xef')));_0x7949a9[_0x1547('0xa')]('/api/userProfile/sections',require(_0x1547('0xf0')));_0x7949a9[_0x1547('0xa')](_0x1547('0xf1'),require(_0x1547('0xf2')));_0x7949a9[_0x1547('0xa')](_0x1547('0xf3'),require(_0x1547('0xf4')));_0x7949a9[_0x1547('0xa')]('/api/whatsapp/accounts',require('./api/whatsappAccount'));_0x7949a9[_0x1547('0xa')](_0x1547('0xf5'),require(_0x1547('0xf6')));_0x7949a9[_0x1547('0xa')](_0x1547('0xf7'),require(_0x1547('0xf8')));_0x7949a9[_0x1547('0xa')](_0x1547('0xf9'),require(_0x1547('0xfa')));_0x7949a9[_0x1547('0xa')]('/api/whatsapp/reports/queue',require('./api/whatsappQueueReport'));_0x7949a9[_0x1547('0xa')](_0x1547('0xfb'),require(_0x1547('0xfc')));_0x7949a9[_0x1547('0xa')](_0x1547('0xfd'),require(_0x1547('0xfe')));_0x7949a9[_0x1547('0xa')](_0x1547('0xff'),require(_0x1547('0x100')));_0x7949a9[_0x1547('0xa')](_0x1547('0x101'),require('./api/realtime'));_0x7949a9[_0x1547('0xa')]('/api/auth/local',require(_0x1547('0x102')));_0x7949a9[_0x1547('0xa')]('/api/auth/google',require(_0x1547('0x103')));_0x7949a9[_0x1547('0xa')]('/api/jira',require(_0x1547('0x104')));_0x7949a9[_0x1547('0xa')](_0x1547('0x105'),require(_0x1547('0x106')));_0x7949a9[_0x1547('0xa')]('/api/version',require('./api/version'));_0x7949a9['use']('/api/system',require(_0x1547('0x107')));_0x7949a9['use'](_0x1547('0x108'),require(_0x1547('0x109')));_0x7949a9[_0x1547('0xa')](_0x1547('0x10a'),require(_0x1547('0x10b')));_0x7949a9['use'](_0x1547('0x10c'),express[_0x1547('0x10d')](path[_0x1547('0x10e')](config[_0x1547('0x10f')],_0x1547('0x10c'))));_0x7949a9[_0x1547('0xa')]('/www',express[_0x1547('0x10d')](path[_0x1547('0x10e')](config[_0x1547('0x10f')],_0x1547('0x110'))));_0x7949a9[_0x1547('0xa')](_0x1547('0x111'),express[_0x1547('0x10d')](path['join'](config['root'],_0x1547('0x111'))));_0x7949a9[_0x1547('0xa')]('/snippet',express[_0x1547('0x10d')](path[_0x1547('0x10e')](config['root'],'snippet',_0x1547('0x112'))));_0x7949a9['use'](_0x1547('0x113'),express[_0x1547('0x10d')](path[_0x1547('0x10e')](config[_0x1547('0x10f')],'/server/files/plugins')));_0x7949a9[_0x1547('0x114')](_0x1547('0x115'))[_0x1547('0x116')](errors[0x194]);_0x7949a9[_0x1547('0x114')]('/*')[_0x1547('0x116')](function(_0x50a48b,_0x1b8430){_0x1b8430['sendFile'](path[_0x1547('0x117')](_0x7949a9[_0x1547('0x116')](_0x1547('0x118'))+_0x1547('0x119')));});};var sensitiveFields=[_0x1547('0x11a'),_0x1547('0x11b'),'newPassword',_0x1547('0x11c'),_0x1547('0x11d'),_0x1547('0x11e'),_0x1547('0x11f'),_0x1547('0x120'),_0x1547('0x121'),_0x1547('0x122'),_0x1547('0x123'),_0x1547('0x124'),_0x1547('0x125'),_0x1547('0x126'),_0x1547('0x127'),_0x1547('0x128'),_0x1547('0x129'),_0x1547('0x12a'),_0x1547('0x12b'),_0x1547('0x12c'),_0x1547('0x12d'),_0x1547('0x12e'),_0x1547('0x12f'),_0x1547('0x130'),_0x1547('0x131'),'calleridname',_0x1547('0x132'),_0x1547('0x133'),_0x1547('0x134'),'clientEmail','privateKey',_0x1547('0x135'),'secretaccesskey',_0x1547('0x136'),_0x1547('0x18'),_0x1547('0x137'),'accountSid',_0x1547('0x138'),'dsn',_0x1547('0x139'),_0x1547('0x13a'),_0x1547('0x13b')];function maskSensitiveData(_0x18b42b){var _0x41e6ad=/(?!^)[\s\S](?!$)/g;if(!_[_0x1547('0x13c')](_0x18b42b))return;for(var _0x14a659 in _0x18b42b){if(_[_0x1547('0x13d')](_0x18b42b[_0x14a659])){for(var _0x23b33d=0x0;_0x23b33d<_0x18b42b[_0x14a659]['length'];_0x23b33d++){maskSensitiveData(_0x18b42b[_0x14a659][_0x23b33d]);}}else if(_[_0x1547('0x13c')](_0x18b42b[_0x14a659])){maskSensitiveData(_0x18b42b[_0x14a659]);}else if(_[_0x1547('0x13e')](_0x18b42b[_0x14a659])){_0x18b42b[_0x14a659]=_0x18b42b[_0x14a659][_0x1547('0x13f')](/{{{/g,_0x1547('0x140'))[_0x1547('0x13f')](/}}}/g,'}@@')[_0x1547('0x13f')](/{{/g,'@{')[_0x1547('0x13f')](/}}/g,'}@');if(_[_0x1547('0x141')](sensitiveFields,_0x14a659)){_0x18b42b[_0x14a659]=_0x18b42b[_0x14a659][_0x1547('0x13f')](_0x41e6ad,'*');}}}} \ No newline at end of file +var _0xca48=['./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','./api/setting','/api/square/odbc','/api/square/projects','./api/squareProject','./api/squareRecording','/api/square/messages','./api/team','./api/license','/api/campaigns','./api/campaign','/api/migrations','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','/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/auth/local','./api/authLocal','./api/authGoogle','/api/jira','./api/jira','/api/version','/api/system','./api/pm2','/api/webbar','./api/webbar','static','join','root','/apidoc','/www','/demo','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','route','get','sendFile','resolve','appPath','/index.html','password','newPassword','apiKey','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','privateKey','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','secret','registry','oldPassword','isPlainObject','isArray','length','replace','}@@','includes','path','express','express-winston','util','./errors','./config/logger','auth','default','logger','body','format','method','headers','x-forwarded-for','connection','remoteAddress','url','user','name','role','inspect','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','statusCode','responseTime','other','agent_id','agent_name','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','./api/openchannelQueue','./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/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','./api/tag','./api/template','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./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/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields'];(function(_0x391600,_0x318f23){var _0x2232ab=function(_0x468449){while(--_0x468449){_0x391600['push'](_0x391600['shift']());}};_0x2232ab(++_0x318f23);}(_0xca48,0x8c));var _0x8ca4=function(_0x337a10,_0x5191c7){_0x337a10=_0x337a10-0x0;var _0x575f98=_0xca48[_0x337a10];return _0x575f98;};'use strict';var _=require('lodash');var path=require(_0x8ca4('0x0'));var express=require(_0x8ca4('0x1'));var ewinston=require(_0x8ca4('0x2'));var util=require(_0x8ca4('0x3'));var errors=require(_0x8ca4('0x4'));var config=require('./config/environment');var logger=require(_0x8ca4('0x5'))('api');var authLogger=require(_0x8ca4('0x5'))(_0x8ca4('0x6'));exports[_0x8ca4('0x7')]=function(_0x133996){_0x133996['use'](ewinston[_0x8ca4('0x8')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x26c105,_0x4376a2){var _0x4b9461='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_['isEmpty'](_0x26c105[_0x8ca4('0x9')])){_0x4b9461+='\x20body=%s';var _0x4e91e3=_0x26c105[_0x8ca4('0x9')];maskSensitiveData(_0x4e91e3);}return util[_0x8ca4('0xa')](_0x4b9461,_0x26c105[_0x8ca4('0xb')],_0x26c105['headers']['x-forwarded-for']?_0x26c105[_0x8ca4('0xc')][_0x8ca4('0xd')]:_0x26c105[_0x8ca4('0xe')][_0x8ca4('0xf')]||_0x26c105['ip'],_0x26c105[_0x8ca4('0x10')],_0x4376a2['statusCode'],_0x4376a2['responseTime'],_0x26c105[_0x8ca4('0x11')]?_0x26c105[_0x8ca4('0x11')]['id']:null,_0x26c105[_0x8ca4('0x11')]?_0x26c105[_0x8ca4('0x11')][_0x8ca4('0x12')]:null,_0x26c105[_0x8ca4('0x11')]?_0x26c105[_0x8ca4('0x11')][_0x8ca4('0x13')]:null,_0x4e91e3?util[_0x8ca4('0x14')](_0x4e91e3,![],null):'');}}));_0x133996[_0x8ca4('0x15')](ewinston[_0x8ca4('0x8')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x1f20ec,_0x31d9ac){var _0x3975dc=_0x8ca4('0x16');if(_0x1f20ec['body']&&_0x1f20ec[_0x8ca4('0x9')][_0x8ca4('0x17')]&&_0x1f20ec['body']['agent_id']){_0x3975dc=_0x8ca4('0x18');}return util[_0x8ca4('0xa')](_0x3975dc,_0x1f20ec['method'],_0x1f20ec[_0x8ca4('0xc')][_0x8ca4('0xd')]?_0x1f20ec[_0x8ca4('0xc')]['x-forwarded-for']:_0x1f20ec[_0x8ca4('0xe')][_0x8ca4('0xf')]||_0x1f20ec['ip'],_0x1f20ec[_0x8ca4('0x10')],_0x31d9ac[_0x8ca4('0x19')],_0x31d9ac[_0x8ca4('0x1a')],_0x1f20ec['user']?_0x1f20ec[_0x8ca4('0x11')]['id']:null,_0x1f20ec[_0x8ca4('0x11')]?_0x1f20ec['user'][_0x8ca4('0x12')]:null,_0x1f20ec[_0x8ca4('0x11')]?_0x1f20ec[_0x8ca4('0x11')]['role']:null,_0x1f20ec[_0x8ca4('0x9')]&&_0x1f20ec[_0x8ca4('0x9')][_0x8ca4('0x17')]?_0x1f20ec[_0x8ca4('0x9')][_0x8ca4('0x17')]:_0x8ca4('0x1b'),_0x1f20ec[_0x8ca4('0x9')]&&_0x1f20ec[_0x8ca4('0x9')][_0x8ca4('0x1c')]?_0x1f20ec[_0x8ca4('0x9')][_0x8ca4('0x1c')]:'',_0x1f20ec[_0x8ca4('0x9')]&&_0x1f20ec['body'][_0x8ca4('0x1d')]?_0x1f20ec[_0x8ca4('0x9')]['agent_name']:'');},'ignoreRoute':function(_0x4cb244){var _0x5801ab=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5801ab['test'](_0x4cb244['url']);}}));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x1e'),require(_0x8ca4('0x1f')));_0x133996['use'](_0x8ca4('0x20'),require(_0x8ca4('0x21')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x22'),require(_0x8ca4('0x23')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x24'),require('./api/voiceExtension'));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x25'),require(_0x8ca4('0x26')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x27'),require(_0x8ca4('0x28')));_0x133996['use'](_0x8ca4('0x29'),require(_0x8ca4('0x2a')));_0x133996['use'](_0x8ca4('0x2b'),require(_0x8ca4('0x2c')));_0x133996[_0x8ca4('0x15')]('/api/voice/mails',require(_0x8ca4('0x2d')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x2e'),require(_0x8ca4('0x2f')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x30'),require('./api/voiceCallReport'));_0x133996['use']('/api/voice/dials/reports',require(_0x8ca4('0x31')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x32'),require(_0x8ca4('0x33')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x34'),require(_0x8ca4('0x35')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x36'),require(_0x8ca4('0x37')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x38'),require(_0x8ca4('0x39')));_0x133996[_0x8ca4('0x15')]('/api/voice/transfers/reports',require(_0x8ca4('0x3a')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x3b'),require(_0x8ca4('0x3c')));_0x133996[_0x8ca4('0x15')]('/api/mail/accounts',require(_0x8ca4('0x3d')));_0x133996['use'](_0x8ca4('0x3e'),require(_0x8ca4('0x3f')));_0x133996['use']('/api/mail/substatuses',require(_0x8ca4('0x40')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x41'),require(_0x8ca4('0x42')));_0x133996[_0x8ca4('0x15')]('/api/mail/messages',require(_0x8ca4('0x43')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x44'),require(_0x8ca4('0x45')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x46'),require(_0x8ca4('0x47')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x48'),require(_0x8ca4('0x49')));_0x133996['use'](_0x8ca4('0x4a'),require('./api/dashboardItem'));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x4b'),require(_0x8ca4('0x4c')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x4d'),require(_0x8ca4('0x4e')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x4f'),require(_0x8ca4('0x50')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x51'),require(_0x8ca4('0x52')));_0x133996['use'](_0x8ca4('0x53'),require(_0x8ca4('0x54')));_0x133996['use'](_0x8ca4('0x55'),require(_0x8ca4('0x56')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x57'),require(_0x8ca4('0x58')));_0x133996[_0x8ca4('0x15')]('/api/sms/applications',require(_0x8ca4('0x59')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x5a'),require(_0x8ca4('0x5b')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x5c'),require('./api/smsMessage'));_0x133996['use'](_0x8ca4('0x5d'),require(_0x8ca4('0x5e')));_0x133996['use']('/api/openchannel/accounts',require(_0x8ca4('0x5f')));_0x133996['use'](_0x8ca4('0x60'),require('./api/openchannelApplication'));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x61'),require(_0x8ca4('0x62')));_0x133996[_0x8ca4('0x15')]('/api/openchannel/messages',require(_0x8ca4('0x63')));_0x133996[_0x8ca4('0x15')]('/api/openchannel/queues',require(_0x8ca4('0x64')));_0x133996[_0x8ca4('0x15')]('/api/chat/websites',require(_0x8ca4('0x65')));_0x133996['use'](_0x8ca4('0x66'),require(_0x8ca4('0x67')));_0x133996['use'](_0x8ca4('0x68'),require('./api/chatApplication'));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x69'),require(_0x8ca4('0x6a')));_0x133996['use'](_0x8ca4('0x6b'),require(_0x8ca4('0x6c')));_0x133996['use'](_0x8ca4('0x6d'),require(_0x8ca4('0x6e')));_0x133996['use']('/api/chat/queues',require('./api/chatQueue'));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x6f'),require('./api/chatGroup'));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x70'),require(_0x8ca4('0x71')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x72'),require(_0x8ca4('0x73')));_0x133996[_0x8ca4('0x15')]('/api/cm/contacts',require(_0x8ca4('0x74')));_0x133996['use'](_0x8ca4('0x75'),require(_0x8ca4('0x76')));_0x133996[_0x8ca4('0x15')]('/api/cm/hopper_black',require('./api/cmHopperBlack'));_0x133996['use'](_0x8ca4('0x77'),require(_0x8ca4('0x78')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x79'),require(_0x8ca4('0x7a')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x7b'),require(_0x8ca4('0x7c')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x7d'),require(_0x8ca4('0x7e')));_0x133996['use'](_0x8ca4('0x7f'),require(_0x8ca4('0x80')));_0x133996['use'](_0x8ca4('0x81'),require('./api/cannedAnswer'));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x82'),require(_0x8ca4('0x83')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x84'),require(_0x8ca4('0x85')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x86'),require(_0x8ca4('0x87')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x88'),require('./api/pause'));_0x133996['use'](_0x8ca4('0x89'),require(_0x8ca4('0x8a')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x8b'),require('./api/voiceQueuesLog'));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x8c'),require(_0x8ca4('0x8d')));_0x133996[_0x8ca4('0x15')]('/api/sounds',require(_0x8ca4('0x8e')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x8f'),require(_0x8ca4('0x90')));_0x133996[_0x8ca4('0x15')]('/api/templates',require(_0x8ca4('0x91')));_0x133996[_0x8ca4('0x15')]('/api/triggers',require(_0x8ca4('0x92')));_0x133996['use'](_0x8ca4('0x93'),require(_0x8ca4('0x94')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x95'),require(_0x8ca4('0x96')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x97'),require(_0x8ca4('0x98')));_0x133996['use']('/api/analytics/custom_reports',require('./api/analyticCustomReport'));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x99'),require(_0x8ca4('0x9a')));_0x133996[_0x8ca4('0x15')]('/api/analytics/extracted_reports',require(_0x8ca4('0x9b')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x9c'),require(_0x8ca4('0x9d')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x9e'),require(_0x8ca4('0x9f')));_0x133996['use'](_0x8ca4('0xa0'),require(_0x8ca4('0xa1')));_0x133996['use'](_0x8ca4('0xa2'),require('./api/intSalesforceAccount'));_0x133996[_0x8ca4('0x15')](_0x8ca4('0xa3'),require(_0x8ca4('0xa4')));_0x133996[_0x8ca4('0x15')]('/api/integrations/salesforce/fields',require(_0x8ca4('0xa5')));_0x133996[_0x8ca4('0x15')]('/api/integrations/sugarcrm/accounts',require(_0x8ca4('0xa6')));_0x133996[_0x8ca4('0x15')]('/api/integrations/sugarcrm/configurations',require(_0x8ca4('0xa7')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0xa8'),require(_0x8ca4('0xa9')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0xaa'),require(_0x8ca4('0xab')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0xac'),require(_0x8ca4('0xad')));_0x133996['use'](_0x8ca4('0xae'),require(_0x8ca4('0xaf')));_0x133996[_0x8ca4('0x15')]('/api/integrations/zoho/accounts',require(_0x8ca4('0xb0')));_0x133996['use'](_0x8ca4('0xb1'),require('./api/intZohoConfiguration'));_0x133996[_0x8ca4('0x15')](_0x8ca4('0xb2'),require(_0x8ca4('0xb3')));_0x133996[_0x8ca4('0x15')]('/api/integrations/zendesk/accounts',require(_0x8ca4('0xb4')));_0x133996['use']('/api/integrations/zendesk/configurations',require(_0x8ca4('0xb5')));_0x133996['use'](_0x8ca4('0xb6'),require(_0x8ca4('0xb7')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0xb8'),require('./api/intFreshdeskAccount'));_0x133996[_0x8ca4('0x15')](_0x8ca4('0xb9'),require(_0x8ca4('0xba')));_0x133996['use'](_0x8ca4('0xbb'),require('./api/intFreshdeskField'));_0x133996[_0x8ca4('0x15')](_0x8ca4('0xbc'),require(_0x8ca4('0xbd')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0xbe'),require(_0x8ca4('0xbf')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0xc0'),require(_0x8ca4('0xc1')));_0x133996[_0x8ca4('0x15')]('/api/integrations/servicenow/accounts',require(_0x8ca4('0xc2')));_0x133996['use'](_0x8ca4('0xc3'),require('./api/intServicenowConfiguration'));_0x133996[_0x8ca4('0x15')]('/api/integrations/servicenow/fields',require(_0x8ca4('0xc4')));_0x133996['use'](_0x8ca4('0xc5'),require(_0x8ca4('0xc6')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0xc7'),require(_0x8ca4('0xc8')));_0x133996[_0x8ca4('0x15')]('/api/integrations/dynamics365/fields',require(_0x8ca4('0xc9')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0xca'),require(_0x8ca4('0xcb')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0xcc'),require(_0x8ca4('0xcd')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0xce'),require('./api/intFreshsalesField'));_0x133996[_0x8ca4('0x15')]('/api/networks',require('./api/network'));_0x133996[_0x8ca4('0x15')]('/api/chat/reports/queue',require(_0x8ca4('0xcf')));_0x133996['use'](_0x8ca4('0xd0'),require('./api/chatInternalMessage'));_0x133996[_0x8ca4('0x15')](_0x8ca4('0xd1'),require('./api/jscriptyAnswerReport'));_0x133996[_0x8ca4('0x15')](_0x8ca4('0xd2'),require('./api/jscriptyQuestionReport'));_0x133996['use'](_0x8ca4('0xd3'),require(_0x8ca4('0xd4')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0xd5'),require(_0x8ca4('0xd6')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0xd7'),require(_0x8ca4('0xd8')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0xd9'),require(_0x8ca4('0xda')));_0x133996[_0x8ca4('0x15')]('/api/jscripty/projects',require(_0x8ca4('0xdb')));_0x133996[_0x8ca4('0x15')]('/api/settings',require(_0x8ca4('0xdc')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0xdd'),require('./api/squareOdbc'));_0x133996['use'](_0x8ca4('0xde'),require(_0x8ca4('0xdf')));_0x133996[_0x8ca4('0x15')]('/api/square/recordings',require(_0x8ca4('0xe0')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0xe1'),require('./api/squareMessage'));_0x133996[_0x8ca4('0x15')]('/api/teams',require(_0x8ca4('0xe2')));_0x133996[_0x8ca4('0x15')]('/api/license',require(_0x8ca4('0xe3')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0xe4'),require(_0x8ca4('0xe5')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0xe6'),require('./api/migration'));_0x133996[_0x8ca4('0x15')](_0x8ca4('0xe7'),require('./api/attachment'));_0x133996['use'](_0x8ca4('0xe8'),require(_0x8ca4('0xe9')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0xea'),require(_0x8ca4('0xeb')));_0x133996['use'](_0x8ca4('0xec'),require(_0x8ca4('0xed')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0xee'),require(_0x8ca4('0xef')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0xf0'),require(_0x8ca4('0xf1')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0xf2'),require('./api/smsTransferReport'));_0x133996[_0x8ca4('0x15')](_0x8ca4('0xf3'),require(_0x8ca4('0xf4')));_0x133996[_0x8ca4('0x15')]('/api/voice/prefixes',require(_0x8ca4('0xf5')));_0x133996['use'](_0x8ca4('0xf6'),require(_0x8ca4('0xf7')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0xf8'),require(_0x8ca4('0xf9')));_0x133996[_0x8ca4('0x15')]('/api/userProfile/resources',require(_0x8ca4('0xfa')));_0x133996['use'](_0x8ca4('0xfb'),require(_0x8ca4('0xfc')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0xfd'),require(_0x8ca4('0xfe')));_0x133996['use']('/api/whatsapp/applications',require(_0x8ca4('0xff')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x100'),require('./api/whatsappInteraction'));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x101'),require(_0x8ca4('0x102')));_0x133996['use'](_0x8ca4('0x103'),require('./api/whatsappQueueReport'));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x104'),require(_0x8ca4('0x105')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x106'),require(_0x8ca4('0x107')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x108'),require('./api/cloudProvider'));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x109'),require('./api/realtime'));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x10a'),require(_0x8ca4('0x10b')));_0x133996[_0x8ca4('0x15')]('/api/auth/google',require(_0x8ca4('0x10c')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x10d'),require(_0x8ca4('0x10e')));_0x133996[_0x8ca4('0x15')]('/api/rpc',require('./api/rpc'));_0x133996['use'](_0x8ca4('0x10f'),require('./api/version'));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x110'),require('./api/system'));_0x133996[_0x8ca4('0x15')]('/api/pm2',require(_0x8ca4('0x111')));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x112'),require(_0x8ca4('0x113')));_0x133996[_0x8ca4('0x15')]('/apidoc',express[_0x8ca4('0x114')](path[_0x8ca4('0x115')](config[_0x8ca4('0x116')],_0x8ca4('0x117'))));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x118'),express[_0x8ca4('0x114')](path[_0x8ca4('0x115')](config[_0x8ca4('0x116')],_0x8ca4('0x118'))));_0x133996[_0x8ca4('0x15')]('/demo',express[_0x8ca4('0x114')](path[_0x8ca4('0x115')](config[_0x8ca4('0x116')],_0x8ca4('0x119'))));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x11a'),express[_0x8ca4('0x114')](path[_0x8ca4('0x115')](config[_0x8ca4('0x116')],_0x8ca4('0x11b'),_0x8ca4('0x11c'))));_0x133996[_0x8ca4('0x15')](_0x8ca4('0x11d'),express[_0x8ca4('0x114')](path['join'](config[_0x8ca4('0x116')],_0x8ca4('0x11e'))));_0x133996[_0x8ca4('0x11f')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x8ca4('0x120')](errors[0x194]);_0x133996[_0x8ca4('0x11f')]('/*')['get'](function(_0x326401,_0x1025d9){_0x1025d9[_0x8ca4('0x121')](path[_0x8ca4('0x122')](_0x133996[_0x8ca4('0x120')](_0x8ca4('0x123'))+_0x8ca4('0x124')));});};var sensitiveFields=['username',_0x8ca4('0x125'),_0x8ca4('0x126'),_0x8ca4('0x127'),'firstName','lastName',_0x8ca4('0x128'),_0x8ca4('0x129'),_0x8ca4('0x12a'),_0x8ca4('0x12b'),_0x8ca4('0x12c'),_0x8ca4('0x12d'),_0x8ca4('0x12e'),_0x8ca4('0x12f'),_0x8ca4('0x130'),_0x8ca4('0x131'),_0x8ca4('0x132'),_0x8ca4('0x133'),_0x8ca4('0x134'),_0x8ca4('0x135'),_0x8ca4('0x136'),'authToken',_0x8ca4('0x137'),_0x8ca4('0x138'),_0x8ca4('0x139'),_0x8ca4('0x13a'),_0x8ca4('0x13b'),_0x8ca4('0x13c'),'vidaooApiKey','clientEmail',_0x8ca4('0x13d'),_0x8ca4('0x13e'),_0x8ca4('0x13f'),_0x8ca4('0x140'),_0x8ca4('0x11'),_0x8ca4('0x141'),_0x8ca4('0x142'),_0x8ca4('0x143'),'dsn',_0x8ca4('0x144'),_0x8ca4('0x145'),_0x8ca4('0x146')];function maskSensitiveData(_0x390b38){var _0x273d70=/(?!^)[\s\S](?!$)/g;if(!_[_0x8ca4('0x147')](_0x390b38))return;for(var _0x4eb2f0 in _0x390b38){if(_[_0x8ca4('0x148')](_0x390b38[_0x4eb2f0])){for(var _0x38eb3c=0x0;_0x38eb3c<_0x390b38[_0x4eb2f0][_0x8ca4('0x149')];_0x38eb3c++){maskSensitiveData(_0x390b38[_0x4eb2f0][_0x38eb3c]);}}else if(_[_0x8ca4('0x147')](_0x390b38[_0x4eb2f0])){maskSensitiveData(_0x390b38[_0x4eb2f0]);}else if(_['isString'](_0x390b38[_0x4eb2f0])){_0x390b38[_0x4eb2f0]=_0x390b38[_0x4eb2f0][_0x8ca4('0x14a')](/{{{/g,'@@{')['replace'](/}}}/g,_0x8ca4('0x14b'))['replace'](/{{/g,'@{')[_0x8ca4('0x14a')](/}}/g,'}@');if(_[_0x8ca4('0x14c')](sensitiveFields,_0x4eb2f0)){_0x390b38[_0x4eb2f0]=_0x390b38[_0x4eb2f0][_0x8ca4('0x14a')](_0x273d70,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 81c0db5..ea2e9ae 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x12d0=['../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','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/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelQueue/openchannelQueue.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/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.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/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc'];(function(_0x2c5255,_0x4340c3){var _0x30d0ea=function(_0x131ba1){while(--_0x131ba1){_0x2c5255['push'](_0x2c5255['shift']());}};_0x30d0ea(++_0x4340c3);}(_0x12d0,0xea));var _0x012d=function(_0x4687b5,_0x20ed24){_0x4687b5=_0x4687b5-0x0;var _0x551ce5=_0x12d0[_0x4687b5];return _0x551ce5;};'use strict';var jayson=require(_0x012d('0x0'));var BPromise=require(_0x012d('0x1'));var _=require(_0x012d('0x2'));var config=require('../config/environment');exports[_0x012d('0x3')]=function(){return new BPromise(function(_0x2ca51e,_0x812215){var _0x300edb={};_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x5')));_0x300edb=_['merge'](_0x300edb,require(_0x012d('0x6')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x7')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x8')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x9')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0xa')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0xb')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0xc')));_0x300edb=_['merge'](_0x300edb,require('../api/memberReport/memberReport.rpc'));_0x300edb=_['merge'](_0x300edb,require(_0x012d('0xd')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0xe')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x300edb=_['merge'](_0x300edb,require(_0x012d('0xf')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require('../api/mailAccount/mailAccount.rpc'));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x10')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require('../api/mailInteraction/mailInteraction.rpc'));_0x300edb=_['merge'](_0x300edb,require('../api/mailMessage/mailMessage.rpc'));_0x300edb=_[_0x012d('0x4')](_0x300edb,require('../api/mailApplication/mailApplication.rpc'));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x11')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x12')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require('../api/faxApplication/faxApplication.rpc'));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x13')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x14')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x15')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x16')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x17')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x18')));_0x300edb=_['merge'](_0x300edb,require(_0x012d('0x19')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x1a')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x1b')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x300edb=_['merge'](_0x300edb,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x1c')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x1d')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x1e')));_0x300edb=_['merge'](_0x300edb,require(_0x012d('0x1f')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x20')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x21')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x22')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x23')));_0x300edb=_['merge'](_0x300edb,require(_0x012d('0x24')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x25')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x26')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require('../api/pause/pause.rpc'));_0x300edb=_[_0x012d('0x4')](_0x300edb,require('../api/sound/sound.rpc'));_0x300edb=_['merge'](_0x300edb,require('../api/template/template.rpc'));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x27')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x28')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x29')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x2a')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x2b')));_0x300edb=_['merge'](_0x300edb,require(_0x012d('0x2c')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x2d')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x300edb=_['merge'](_0x300edb,require(_0x012d('0x2e')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x2f')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x30')));_0x300edb=_['merge'](_0x300edb,require(_0x012d('0x31')));_0x300edb=_['merge'](_0x300edb,require(_0x012d('0x32')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x33')));_0x300edb=_['merge'](_0x300edb,require(_0x012d('0x34')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require('../api/setting/setting.rpc'));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x35')));_0x300edb=_['merge'](_0x300edb,require(_0x012d('0x36')));_0x300edb=_['merge'](_0x300edb,require('../api/squareRecording/squareRecording.rpc'));_0x300edb=_['merge'](_0x300edb,require('../api/squareMessage/squareMessage.rpc'));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x37')));_0x300edb=_['merge'](_0x300edb,require(_0x012d('0x38')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require('../api/plugin/plugin.rpc'));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x39')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x3a')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x3b')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x3c')));_0x300edb=_[_0x012d('0x4')](_0x300edb,require(_0x012d('0x3d')));var _0x5d591b=jayson[_0x012d('0x3e')](_0x300edb)[_0x012d('0x3f')]();var _0x251f11=config[_0x012d('0x40')][_0x012d('0x41')]||config[_0x012d('0x41')]+0x1;var _0x43be73=config['rpc']['ip']||_0x012d('0x42');_0x5d591b['on'](_0x012d('0x43'),function(_0x3ab583){return _0x812215(_0x3ab583);});_0x5d591b['listen'](_0x251f11,_0x43be73,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x43be73,_0x251f11);require(_0x012d('0x44'))[_0x012d('0x45')]();return _0x2ca51e(_0x012d('0x46')+_0x43be73+':'+_0x251f11);});});}; \ No newline at end of file +var _0x442d=['../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','port','rpc','localhost','error','listen','log','../config/triggers','default','bluebird','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc'];(function(_0x4f1b87,_0x260834){var _0x74718e=function(_0x24c7c2){while(--_0x24c7c2){_0x4f1b87['push'](_0x4f1b87['shift']());}};_0x74718e(++_0x260834);}(_0x442d,0x19b));var _0xd442=function(_0x15fc3c,_0x35665b){_0x15fc3c=_0x15fc3c-0x0;var _0x94c5c8=_0x442d[_0x15fc3c];return _0x94c5c8;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xd442('0x0'));var _=require('lodash');var config=require('../config/environment');exports['listen']=function(){return new BPromise(function(_0x2df4c4,_0x199122){var _0x516dce={};_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x2')));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x3')));_0x516dce=_['merge'](_0x516dce,require(_0xd442('0x4')));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x5')));_0x516dce=_[_0xd442('0x1')](_0x516dce,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x6')));_0x516dce=_['merge'](_0x516dce,require(_0xd442('0x7')));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x8')));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x9')));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0xa')));_0x516dce=_['merge'](_0x516dce,require(_0xd442('0xb')));_0x516dce=_['merge'](_0x516dce,require(_0xd442('0xc')));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0xd')));_0x516dce=_['merge'](_0x516dce,require('../api/mailAccount/mailAccount.rpc'));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0xe')));_0x516dce=_['merge'](_0x516dce,require(_0xd442('0xf')));_0x516dce=_['merge'](_0x516dce,require(_0xd442('0x10')));_0x516dce=_['merge'](_0x516dce,require('../api/mailApplication/mailApplication.rpc'));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x11')));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x12')));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x13')));_0x516dce=_['merge'](_0x516dce,require('../api/faxInteraction/faxInteraction.rpc'));_0x516dce=_[_0xd442('0x1')](_0x516dce,require('../api/faxMessage/faxMessage.rpc'));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x14')));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x15')));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x16')));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x17')));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x18')));_0x516dce=_[_0xd442('0x1')](_0x516dce,require('../api/smsQueue/smsQueue.rpc'));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x19')));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x1a')));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x1b')));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x1c')));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x1d')));_0x516dce=_[_0xd442('0x1')](_0x516dce,require('../api/chatInteraction/chatInteraction.rpc'));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x1e')));_0x516dce=_['merge'](_0x516dce,require('../api/chatQueue/chatQueue.rpc'));_0x516dce=_[_0xd442('0x1')](_0x516dce,require('../api/cmContact/cmContact.rpc'));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x1f')));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x20')));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x21')));_0x516dce=_['merge'](_0x516dce,require(_0xd442('0x22')));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x23')));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x24')));_0x516dce=_['merge'](_0x516dce,require(_0xd442('0x25')));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x26')));_0x516dce=_['merge'](_0x516dce,require(_0xd442('0x27')));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x28')));_0x516dce=_[_0xd442('0x1')](_0x516dce,require('../api/variable/variable.rpc'));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x29')));_0x516dce=_['merge'](_0x516dce,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x516dce=_[_0xd442('0x1')](_0x516dce,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x2a')));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x2b')));_0x516dce=_['merge'](_0x516dce,require(_0xd442('0x2c')));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x2d')));_0x516dce=_['merge'](_0x516dce,require(_0xd442('0x2e')));_0x516dce=_['merge'](_0x516dce,require(_0xd442('0x2f')));_0x516dce=_[_0xd442('0x1')](_0x516dce,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x30')));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x31')));_0x516dce=_['merge'](_0x516dce,require(_0xd442('0x32')));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x33')));_0x516dce=_[_0xd442('0x1')](_0x516dce,require('../api/setting/setting.rpc'));_0x516dce=_[_0xd442('0x1')](_0x516dce,require('../api/squareOdbc/squareOdbc.rpc'));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x34')));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x35')));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x36')));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x37')));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x38')));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x39')));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x3a')));_0x516dce=_['merge'](_0x516dce,require(_0xd442('0x3b')));_0x516dce=_[_0xd442('0x1')](_0x516dce,require(_0xd442('0x3c')));_0x516dce=_['merge'](_0x516dce,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x516dce=_['merge'](_0x516dce,require(_0xd442('0x3d')));var _0x2f9150=jayson['server'](_0x516dce)[_0xd442('0x3e')]();var _0x51350f=config['rpc'][_0xd442('0x3f')]||config['port']+0x1;var _0x4bae07=config[_0xd442('0x40')]['ip']||_0xd442('0x41');_0x2f9150['on'](_0xd442('0x42'),function(_0x4bb6a6){return _0x199122(_0x4bb6a6);});_0x2f9150[_0xd442('0x43')](_0x51350f,_0x4bae07,function(){console[_0xd442('0x44')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x4bae07,_0x51350f);require(_0xd442('0x45'))[_0xd442('0x46')]();return _0x2df4c4('RPC\x20listening\x20on\x20'+_0x4bae07+':'+_0x51350f);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 39bbc9f..f90d91c 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 _0xf163=['extension','setPriority','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','AGI','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','line','toLowerCase','hangup','520-Invalid','520\x20End\x20of\x20proper','function','substring','replace','result=','indexOf','substr','startsWith','length','match','error','E_AGI_SOCKET_ERROR','code','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','prototype','sync','answer','sendRequest','getData','beep','format','noop','exec','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt'];(function(_0x3f4f84,_0x53a0c5){var _0x3edd6c=function(_0x39c506){while(--_0x39c506){_0x3f4f84['push'](_0x3f4f84['shift']());}};_0x3edd6c(++_0x53a0c5);}(_0xf163,0x129));var _0x3f16=function(_0x3ceb54,_0x5bddfd){_0x3ceb54=_0x3ceb54-0x0;var _0x26d8a6=_0xf163[_0x3ceb54];return _0x26d8a6;};'use strict';var util=require(_0x3f16('0x0'));var _=require('lodash');var EventEmitter=require(_0x3f16('0x1'))[_0x3f16('0x2')];var AGIReply=require(_0x3f16('0x3'));var AGIError=require(_0x3f16('0x4'));function AGIChannel(_0x3b5045){var _0x505606=this,_0xb7e352=new AGIReply(),_0x2accc4=![],_0x5771b7={};EventEmitter[_0x3f16('0x5')](_0x505606);_0x3b5045[_0x3f16('0x6')](_0x3f16('0x7'));_0x3b5045[_0x3f16('0x8')](0x8*0x3c*0x3c*0x3e8);_0xb7e352[_0x3f16('0x6')](_0x3f16('0x7'));_0xb7e352['on'](_0x3f16('0x9'),function(_0x258189){for(var _0x28eaae in _0x258189){_0x505606[_0x28eaae]=_0x258189[_0x28eaae];}_0x505606[_0x3f16('0xa')]('ready');});_0xb7e352['on'](_0x3f16('0xb'),function(_0x204899){if(_0x204899[_0x3f16('0xc')]()==_0x3f16('0xd')){_0x505606[_0x3f16('0xa')](_0x3f16('0xd'));return;}if(_0x204899['substring'](0x0,0xb)==_0x3f16('0xe')){_0x2accc4=!![];}if(_0x2accc4){_0x5771b7['rx']+=_0x204899+'\x0a';if(_0x204899['search'](_0x3f16('0xf'))!=-0x1){_0x2accc4=![];}}else{_0x5771b7['rx']=_0x204899;}if(_0x2accc4){return;}if(typeof _0x5771b7['cb']==_0x3f16('0x10')){var _0xd36fd0=_0x5771b7['rx'][_0x3f16('0x11')](0x0,0x3),_0x101158=null,_0x1e7330=null;_0xd36fd0=parseInt(_0xd36fd0);if(isNaN(_0xd36fd0)){_0x5771b7['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0xd36fd0!=0xc8){_0x5771b7['cb'](null,{'code':_0xd36fd0,'result':-0x1,'extra':'KO'});return;}_0x101158=_0x5771b7['rx'][_0x3f16('0x11')](0x4)[_0x3f16('0x12')](_0x3f16('0x13'),'');if(_0x101158[_0x3f16('0x14')]('\x20')!=-0x1){_0x101158=_0x101158[_0x3f16('0x15')](0x0,_0x101158['indexOf']('\x20'));}if(_[_0x3f16('0x16')](_0x101158,'-1')){_0x101158=parseInt(_0x101158);}_0x1e7330=_0x5771b7['rx']['split']('\x20');if(_0x1e7330[_0x3f16('0x17')]==0x3){_0x1e7330=_0x1e7330[0x2][_0x3f16('0x11')](0x1,_0x1e7330[0x2][_0x3f16('0x17')]-0x1);}else if(_0x1e7330[_0x3f16('0x17')]>0x3){var _0x17bf34=/\((.+)\)/;var _0x164041=_0x5771b7['rx'][_0x3f16('0x18')](_0x17bf34);if(_0x164041){_0x1e7330=_0x164041[0x1];}else{_0x1e7330=null;}}else{_0x1e7330=null;}_0x5771b7['cb'](null,{'code':_0xd36fd0,'result':_0x101158,'extra':_0x1e7330});}});_0x3b5045['on'](_0x3f16('0x19'),function(_0x2fae0f){_0x505606[_0x3f16('0xa')](_0x3f16('0x19'),new AGIError(_0x3f16('0x1a'),_0x2fae0f[_0x3f16('0x1b')]));});_0x3b5045['on'](_0x3f16('0x1c'),function(){_0x505606[_0x3f16('0xa')](_0x3f16('0x1c'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x3b5045['on'](_0x3f16('0x1d'),function(){_0x505606['emit'](_0x3f16('0x1d'),new AGIError(_0x3f16('0x1e')));_0x3b5045[_0x3f16('0x1f')]();});_0x3b5045[_0x3f16('0x20')](_0xb7e352);this['command']=function(_0x27bba9,_0xd451c6){var _0x27bba9=_0x27bba9||'',_0xd451c6=typeof _0xd451c6==_0x3f16('0x10')?_0xd451c6:new Function();_0x5771b7={'tx':_0x27bba9,'rx':'','cb':_0xd451c6};_0x3b5045[_0x3f16('0x21')](_0x27bba9+'\x0a');},this[_0x3f16('0x1c')]=function(){_0x3b5045[_0x3f16('0x1f')]();};}util[_0x3f16('0x22')](AGIChannel,EventEmitter);AGIChannel[_0x3f16('0x23')]['sendRequest']=function(_0x2ef2a5){return this['command'][_0x3f16('0x24')](this,_0x2ef2a5);};AGIChannel[_0x3f16('0x23')][_0x3f16('0x25')]=function(){return this[_0x3f16('0x26')]('ANSWER');};AGIChannel['prototype'][_0x3f16('0x27')]=function(_0x20261f,_0x1f18eb,_0xfe2506){_0x20261f=_0x20261f===undefined?_0x3f16('0x28'):_0x20261f;_0x1f18eb=_0x1f18eb===undefined?'5':_0x1f18eb;_0xfe2506=_0xfe2506===undefined?'1':_0xfe2506;return this[_0x3f16('0x26')](util[_0x3f16('0x29')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x20261f,_0x1f18eb*0x3e8,_0xfe2506));};AGIChannel[_0x3f16('0x23')][_0x3f16('0x2a')]=function(_0x48227f){_0x48227f=_0x48227f||'NO\x20MESSAGE';return this[_0x3f16('0x26')](util[_0x3f16('0x29')]('VERBOSE\x20\x22%s\x22',_0x48227f));};AGIChannel['prototype'][_0x3f16('0x2b')]=function(_0x3048d4,_0x52a045){if(_['isArray'](_0x52a045)){return this[_0x3f16('0x26')](util[_0x3f16('0x29')](_0x3f16('0x2c'),_0x3048d4,_0x52a045[_0x3f16('0x2d')](',')));}return this[_0x3f16('0x26')](util[_0x3f16('0x29')]('EXEC\x20%s\x20%s',_0x3048d4,_0x52a045));};AGIChannel[_0x3f16('0x23')][_0x3f16('0x2e')]=function(_0x1e19bb){return this[_0x3f16('0x26')](util[_0x3f16('0x29')](_0x3f16('0x2f'),_0x1e19bb));};AGIChannel[_0x3f16('0x23')][_0x3f16('0x30')]=function(_0x229ce8){return this['sendRequest'](util['format'](_0x3f16('0x31'),_0x229ce8));};AGIChannel[_0x3f16('0x23')]['setPriority']=function(_0x1ad98b){return this[_0x3f16('0x26')](util[_0x3f16('0x29')](_0x3f16('0x32'),_0x1ad98b));};AGIChannel[_0x3f16('0x23')][_0x3f16('0xd')]=function(){return this['sendRequest'](_0x3f16('0x33'));};AGIChannel[_0x3f16('0x23')][_0x3f16('0x34')]=function(_0xb6535e,_0x1351a5){var _0xefadf0=_[_0x3f16('0x35')](_0x1351a5)||_[_0x3f16('0x36')](_0x1351a5)?_0x1351a5[_0x3f16('0x37')]():_0x1351a5;return this[_0x3f16('0x26')](util[_0x3f16('0x29')](_0x3f16('0x38'),_0xb6535e,_0xefadf0?_0xefadf0['toString']()[_0x3f16('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x3f16('0x23')][_0x3f16('0x39')]=function(_0x2a08b7,_0xc0f6d6){return this[_0x3f16('0x26')](util[_0x3f16('0x29')](_0x3f16('0x3a'),_0x2a08b7,_0xc0f6d6));};AGIChannel['prototype'][_0x3f16('0x3b')]=function(_0xfec238,_0x2dc2a8){return this[_0x3f16('0x26')](util[_0x3f16('0x29')]('SAY\x20DIGITS\x20%s\x20%s',_0xfec238,_0x2dc2a8));};AGIChannel[_0x3f16('0x23')][_0x3f16('0x3c')]=function(_0x30c708,_0x1240a6){return this['sendRequest'](util[_0x3f16('0x29')](_0x3f16('0x3d'),_0x30c708,_0x1240a6));};AGIChannel[_0x3f16('0x23')][_0x3f16('0x3e')]=function(_0x596679,_0x4ad275,_0x1288e1){_0x4ad275=_0x4ad275||this[_0x3f16('0x3f')];_0x1288e1=_0x1288e1||0x1;this[_0x3f16('0x2e')](_0x596679);this[_0x3f16('0x30')](_0x4ad275);this[_0x3f16('0x40')](_0x1288e1);return this[_0x3f16('0x2a')](util[_0x3f16('0x29')]('GOTO\x20%s\x20%s\x20%s',_0x596679,_0x4ad275,_0x1288e1));};AGIChannel[_0x3f16('0x23')]['getVariable']=function(_0x14720c){return this[_0x3f16('0x26')](util[_0x3f16('0x29')](_0x3f16('0x41'),_0x14720c));};AGIChannel[_0x3f16('0x23')]['recordFile']=function(_0xd0a629,_0x3a65bc,_0x18bf96,_0x198c68,_0x2c2909,_0x59df2f){_0x3a65bc=_0x3a65bc||_0x3f16('0x42');_0x18bf96=_0x18bf96||'';_0x198c68=_0x198c68===undefined?-0x1:_0x198c68==='-1'?-0x1:_0x198c68*0x3e8;_0x2c2909=_0x2c2909===undefined?'':'s='+_0x2c2909;_0x59df2f=_0x59df2f?_0x3f16('0x43'):'';return this[_0x3f16('0x26')](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0xd0a629,_0x3a65bc,_0x18bf96,_0x198c68,_0x59df2f,_0x2c2909));};AGIChannel[_0x3f16('0x23')]['streamFile']=function(_0x1fdc2e,_0x108f46){_0x108f46=_0x108f46||'';return this[_0x3f16('0x26')](util[_0x3f16('0x29')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x1fdc2e,_0x108f46));};AGIChannel[_0x3f16('0x23')]['agi']=function(_0x35a895){return this['exec'](_0x3f16('0x44'),_0x35a895);};AGIChannel[_0x3f16('0x23')]['wait']=function(_0x52d7b2){return this[_0x3f16('0x2b')](_0x3f16('0x45'),_0x52d7b2);};AGIChannel[_0x3f16('0x23')]['error']=function(_0x1faf08,_0x176069){this[_0x3f16('0x2a')](util[_0x3f16('0x29')](_0x3f16('0x46'),_0x1faf08['id'],_0x1faf08['label'],_0x176069));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x3f16('0x47')]=AGIChannel; \ No newline at end of file +var _0xa8f5=['setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','SAY\x20NUMBER\x20%s\x20%s','sayDigits','continueAt','extension','setContext','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','EventEmitter','./reply','./error','utf8','setEncoding','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','no\x20code','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','inherits','prototype','sync','answer','ANSWER','getData','beep','sendRequest','format','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setExtension'];(function(_0x5a650b,_0x1eacf1){var _0x17bbea=function(_0x144712){while(--_0x144712){_0x5a650b['push'](_0x5a650b['shift']());}};_0x17bbea(++_0x1eacf1);}(_0xa8f5,0xb1));var _0x5a8f=function(_0x56b886,_0x1ff474){_0x56b886=_0x56b886-0x0;var _0x164baf=_0xa8f5[_0x56b886];return _0x164baf;};'use strict';var util=require(_0x5a8f('0x0'));var _=require(_0x5a8f('0x1'));var EventEmitter=require('events')[_0x5a8f('0x2')];var AGIReply=require(_0x5a8f('0x3'));var AGIError=require(_0x5a8f('0x4'));function AGIChannel(_0x2ec129){var _0x37a0c5=this,_0xe50b92=new AGIReply(),_0x205de5=![],_0x30eed3={};EventEmitter['call'](_0x37a0c5);_0x2ec129['setEncoding'](_0x5a8f('0x5'));_0x2ec129['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0xe50b92[_0x5a8f('0x6')](_0x5a8f('0x5'));_0xe50b92['on'](_0x5a8f('0x7'),function(_0x1b8e07){for(var _0x668a01 in _0x1b8e07){_0x37a0c5[_0x668a01]=_0x1b8e07[_0x668a01];}_0x37a0c5[_0x5a8f('0x8')](_0x5a8f('0x9'));});_0xe50b92['on'](_0x5a8f('0xa'),function(_0x56d2e5){if(_0x56d2e5[_0x5a8f('0xb')]()=='hangup'){_0x37a0c5[_0x5a8f('0x8')](_0x5a8f('0xc'));return;}if(_0x56d2e5[_0x5a8f('0xd')](0x0,0xb)==_0x5a8f('0xe')){_0x205de5=!![];}if(_0x205de5){_0x30eed3['rx']+=_0x56d2e5+'\x0a';if(_0x56d2e5[_0x5a8f('0xf')](_0x5a8f('0x10'))!=-0x1){_0x205de5=![];}}else{_0x30eed3['rx']=_0x56d2e5;}if(_0x205de5){return;}if(typeof _0x30eed3['cb']=='function'){var _0x4d32ac=_0x30eed3['rx'][_0x5a8f('0xd')](0x0,0x3),_0x4188be=null,_0x5e697b=null;_0x4d32ac=parseInt(_0x4d32ac);if(isNaN(_0x4d32ac)){_0x30eed3['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x5a8f('0x11')});return;}if(_0x4d32ac!=0xc8){_0x30eed3['cb'](null,{'code':_0x4d32ac,'result':-0x1,'extra':'KO'});return;}_0x4188be=_0x30eed3['rx'][_0x5a8f('0xd')](0x4)['replace']('result=','');if(_0x4188be[_0x5a8f('0x12')]('\x20')!=-0x1){_0x4188be=_0x4188be[_0x5a8f('0x13')](0x0,_0x4188be[_0x5a8f('0x12')]('\x20'));}if(_[_0x5a8f('0x14')](_0x4188be,'-1')){_0x4188be=parseInt(_0x4188be);}_0x5e697b=_0x30eed3['rx'][_0x5a8f('0x15')]('\x20');if(_0x5e697b['length']==0x3){_0x5e697b=_0x5e697b[0x2][_0x5a8f('0xd')](0x1,_0x5e697b[0x2][_0x5a8f('0x16')]-0x1);}else if(_0x5e697b['length']>0x3){var _0xe71c7d=/\((.+)\)/;var _0x5b948a=_0x30eed3['rx'][_0x5a8f('0x17')](_0xe71c7d);if(_0x5b948a){_0x5e697b=_0x5b948a[0x1];}else{_0x5e697b=null;}}else{_0x5e697b=null;}_0x30eed3['cb'](null,{'code':_0x4d32ac,'result':_0x4188be,'extra':_0x5e697b});}});_0x2ec129['on'](_0x5a8f('0x18'),function(_0x578707){_0x37a0c5[_0x5a8f('0x8')](_0x5a8f('0x18'),new AGIError(_0x5a8f('0x19'),_0x578707[_0x5a8f('0x1a')]));});_0x2ec129['on']('close',function(){_0x37a0c5['emit'](_0x5a8f('0x1b'),new AGIError(_0x5a8f('0x1c')));});_0x2ec129['on']('timeout',function(){_0x37a0c5[_0x5a8f('0x8')](_0x5a8f('0x1d'),new AGIError(_0x5a8f('0x1e')));_0x2ec129[_0x5a8f('0x1f')]();});_0x2ec129[_0x5a8f('0x20')](_0xe50b92);this[_0x5a8f('0x21')]=function(_0x201bd0,_0x4f0288){var _0x201bd0=_0x201bd0||'',_0x4f0288=typeof _0x4f0288=='function'?_0x4f0288:new Function();_0x30eed3={'tx':_0x201bd0,'rx':'','cb':_0x4f0288};_0x2ec129['write'](_0x201bd0+'\x0a');},this[_0x5a8f('0x1b')]=function(){_0x2ec129[_0x5a8f('0x1f')]();};}util[_0x5a8f('0x22')](AGIChannel,EventEmitter);AGIChannel[_0x5a8f('0x23')]['sendRequest']=function(_0x57666f){return this[_0x5a8f('0x21')][_0x5a8f('0x24')](this,_0x57666f);};AGIChannel[_0x5a8f('0x23')][_0x5a8f('0x25')]=function(){return this['sendRequest'](_0x5a8f('0x26'));};AGIChannel[_0x5a8f('0x23')][_0x5a8f('0x27')]=function(_0x50f56b,_0x292414,_0x48f209){_0x50f56b=_0x50f56b===undefined?_0x5a8f('0x28'):_0x50f56b;_0x292414=_0x292414===undefined?'5':_0x292414;_0x48f209=_0x48f209===undefined?'1':_0x48f209;return this[_0x5a8f('0x29')](util[_0x5a8f('0x2a')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x50f56b,_0x292414*0x3e8,_0x48f209));};AGIChannel['prototype'][_0x5a8f('0x2b')]=function(_0xd8aa76){_0xd8aa76=_0xd8aa76||_0x5a8f('0x2c');return this['sendRequest'](util[_0x5a8f('0x2a')](_0x5a8f('0x2d'),_0xd8aa76));};AGIChannel[_0x5a8f('0x23')][_0x5a8f('0x2e')]=function(_0x58d26f,_0x462ffc){if(_[_0x5a8f('0x2f')](_0x462ffc)){return this[_0x5a8f('0x29')](util['format'](_0x5a8f('0x30'),_0x58d26f,_0x462ffc[_0x5a8f('0x31')](',')));}return this[_0x5a8f('0x29')](util[_0x5a8f('0x2a')](_0x5a8f('0x30'),_0x58d26f,_0x462ffc));};AGIChannel[_0x5a8f('0x23')]['setContext']=function(_0x24166e){return this['sendRequest'](util['format']('SET\x20CONTEXT\x20%s',_0x24166e));};AGIChannel[_0x5a8f('0x23')][_0x5a8f('0x32')]=function(_0x46d8f1){return this[_0x5a8f('0x29')](util[_0x5a8f('0x2a')]('SET\x20EXTENSION\x20%s',_0x46d8f1));};AGIChannel[_0x5a8f('0x23')][_0x5a8f('0x33')]=function(_0x17b4f1){return this[_0x5a8f('0x29')](util[_0x5a8f('0x2a')](_0x5a8f('0x34'),_0x17b4f1));};AGIChannel['prototype'][_0x5a8f('0xc')]=function(){return this['sendRequest'](_0x5a8f('0x35'));};AGIChannel['prototype'][_0x5a8f('0x36')]=function(_0x40e403,_0x33569d){var _0xfc7c73=_['isBoolean'](_0x33569d)||_[_0x5a8f('0x37')](_0x33569d)?_0x33569d[_0x5a8f('0x38')]():_0x33569d;return this[_0x5a8f('0x29')](util[_0x5a8f('0x2a')](_0x5a8f('0x39'),_0x40e403,_0xfc7c73?_0xfc7c73['toString']()[_0x5a8f('0x3a')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x5a8f('0x23')]['sayNumber']=function(_0x4311a5,_0x19f619){return this[_0x5a8f('0x29')](util[_0x5a8f('0x2a')](_0x5a8f('0x3b'),_0x4311a5,_0x19f619));};AGIChannel[_0x5a8f('0x23')][_0x5a8f('0x3c')]=function(_0x8b6a67,_0x2f8375){return this[_0x5a8f('0x29')](util[_0x5a8f('0x2a')]('SAY\x20DIGITS\x20%s\x20%s',_0x8b6a67,_0x2f8375));};AGIChannel[_0x5a8f('0x23')]['sayPhonetic']=function(_0x353209,_0x1ad05c){return this[_0x5a8f('0x29')](util[_0x5a8f('0x2a')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x353209,_0x1ad05c));};AGIChannel['prototype'][_0x5a8f('0x3d')]=function(_0xe4c096,_0x366b42,_0x44aee5){_0x366b42=_0x366b42||this[_0x5a8f('0x3e')];_0x44aee5=_0x44aee5||0x1;this[_0x5a8f('0x3f')](_0xe4c096);this[_0x5a8f('0x32')](_0x366b42);this['setPriority'](_0x44aee5);return this[_0x5a8f('0x2b')](util[_0x5a8f('0x2a')](_0x5a8f('0x40'),_0xe4c096,_0x366b42,_0x44aee5));};AGIChannel[_0x5a8f('0x23')]['getVariable']=function(_0x3f661c){return this[_0x5a8f('0x29')](util[_0x5a8f('0x2a')](_0x5a8f('0x41'),_0x3f661c));};AGIChannel[_0x5a8f('0x23')]['recordFile']=function(_0x223926,_0x2bdf1e,_0x17bb9f,_0x17ce84,_0xaec720,_0x437df3){_0x2bdf1e=_0x2bdf1e||_0x5a8f('0x42');_0x17bb9f=_0x17bb9f||'';_0x17ce84=_0x17ce84===undefined?-0x1:_0x17ce84==='-1'?-0x1:_0x17ce84*0x3e8;_0xaec720=_0xaec720===undefined?'':'s='+_0xaec720;_0x437df3=_0x437df3?_0x5a8f('0x43'):'';return this[_0x5a8f('0x29')](util[_0x5a8f('0x2a')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x223926,_0x2bdf1e,_0x17bb9f,_0x17ce84,_0x437df3,_0xaec720));};AGIChannel['prototype']['streamFile']=function(_0x3059d3,_0x5a1813){_0x5a1813=_0x5a1813||'';return this[_0x5a8f('0x29')](util[_0x5a8f('0x2a')](_0x5a8f('0x44'),_0x3059d3,_0x5a1813));};AGIChannel['prototype'][_0x5a8f('0x45')]=function(_0x9e627a){return this['exec'](_0x5a8f('0x46'),_0x9e627a);};AGIChannel[_0x5a8f('0x23')][_0x5a8f('0x47')]=function(_0x759f94){return this[_0x5a8f('0x2e')](_0x5a8f('0x48'),_0x759f94);};AGIChannel[_0x5a8f('0x23')]['error']=function(_0x83e502,_0x3dc43b){this['noop'](util['format'](_0x5a8f('0x49'),_0x83e502['id'],_0x83e502[_0x5a8f('0x4a')],_0x3dc43b));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x5a8f('0x4b')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index c3f6ff9..17e4a4e 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 _0x5fbb=['Undefined\x20error.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','message','exports','util'];(function(_0x22cd62,_0x3f322d){var _0x5e8bf3=function(_0x19319c){while(--_0x19319c){_0x22cd62['push'](_0x22cd62['shift']());}};_0x5e8bf3(++_0x3f322d);}(_0x5fbb,0xc2));var _0xb5fb=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5fbb[_0x21a9d9];return _0x46adce;};'use strict';var util=require(_0xb5fb('0x0'));var error={'E_AGI_UNDEFINED':_0xb5fb('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xb5fb('0x2'),'E_AGI_SERVER_VOICE_DISABLED':_0xb5fb('0x3'),'E_AGI_SOCKET_ERROR':_0xb5fb('0x4'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0xb5fb('0x5'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xb5fb('0x6'),'E_AGI_IVR_ENTRY':_0xb5fb('0x7')};function AGIError(_0x16ddaa){var _0x16ddaa=_0x16ddaa||null,_0x2ea41d=_0x2ea41d||[],_0x22a15c=0x1,_0x19ad60='';if(!error[_0x16ddaa]){_0x16ddaa='E_AGI_UNDEFINED';}_0x2ea41d[_0xb5fb('0x8')](error[_0x16ddaa]);while(arguments[_0x22a15c]){_0x2ea41d[_0xb5fb('0x8')](arguments[_0x22a15c]);_0x22a15c++;}_0x19ad60=util[_0xb5fb('0x9')][_0xb5fb('0xa')](util,_0x2ea41d);this[_0xb5fb('0xb')]=_0x19ad60;this['name']=_0x16ddaa;}module[_0xb5fb('0xc')]=AGIError; \ No newline at end of file +var _0x8cbd=['format','apply','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.'];(function(_0x14a8eb,_0x14df7e){var _0x1759e0=function(_0xb5f26d){while(--_0xb5f26d){_0x14a8eb['push'](_0x14a8eb['shift']());}};_0x1759e0(++_0x14df7e);}(_0x8cbd,0x6b));var _0xd8cb=function(_0x328305,_0x19098d){_0x328305=_0x328305-0x0;var _0xf0347=_0x8cbd[_0x328305];return _0xf0347;};'use strict';var util=require(_0xd8cb('0x0'));var error={'E_AGI_UNDEFINED':_0xd8cb('0x1'),'E_AGI_ARGUMENT_PORT':_0xd8cb('0x2'),'E_AGI_SERVER_ERROR':_0xd8cb('0x3'),'E_AGI_SERVER_CLOSE':_0xd8cb('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0xd8cb('0x5'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0xd8cb('0x6'),'E_AGI_SOCKET_CLOSE':_0xd8cb('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xd8cb('0x8'),'E_AGI_COMMAND_EMPTY':_0xd8cb('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xd8cb('0xa'),'E_AGI_IVR_ENTRY':_0xd8cb('0xb')};function AGIError(_0x5c62a8){var _0x5c62a8=_0x5c62a8||null,_0x11b28b=_0x11b28b||[],_0x2a3de8=0x1,_0x5611b5='';if(!error[_0x5c62a8]){_0x5c62a8='E_AGI_UNDEFINED';}_0x11b28b['push'](error[_0x5c62a8]);while(arguments[_0x2a3de8]){_0x11b28b['push'](arguments[_0x2a3de8]);_0x2a3de8++;}_0x5611b5=util[_0xd8cb('0xc')][_0xd8cb('0xd')](util,_0x11b28b);this[_0xd8cb('0xe')]=_0x5611b5;this[_0xd8cb('0xf')]=_0x5c62a8;}module[_0xd8cb('0x10')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 3a0e609..98cf431 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 _0x1131=['invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','../../../config/logger','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','push','size','relations','getVertex','traverseBFS','info','stop\x20traverse','no\x20edge/s\x20available','length','condition','split','agicommand','vswitch','target','menu'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0x1131,0x71));var _0x1113=function(_0x60b84b,_0x2203ec){_0x60b84b=_0x60b84b-0x0;var _0x1ef3ff=_0x1131[_0x60b84b];return _0x1ef3ff;};'use strict';var _=require('lodash');var logger=require(_0x1113('0x0'))('agi');var verticesWithRetry=['menu','getdigits',_0x1113('0x1')];var Graph=function(){this[_0x1113('0x2')]={};this[_0x1113('0x3')]={};this[_0x1113('0x4')]=0x0;};Graph[_0x1113('0x5')][_0x1113('0x6')]=function(_0x57dd30){this[_0x1113('0x2')][_0x57dd30['id']]=_0x57dd30;this['edges'][_0x57dd30['id']]=[];};Graph[_0x1113('0x5')]['addEdge']=function(_0x502a53,_0x458f86,_0x53a218){this[_0x1113('0x3')][_0x502a53][_0x1113('0x7')]({'target':_0x458f86,'condition':_0x53a218});this[_0x1113('0x4')]+=0x1;};Graph[_0x1113('0x5')][_0x1113('0x8')]=function(){return _['size'](this['vertices']);};Graph[_0x1113('0x5')][_0x1113('0x9')]=function(){return this[_0x1113('0x4')];};Graph['prototype'][_0x1113('0xa')]=function(_0xc0b564){return this['vertices'][_0xc0b564];};Graph[_0x1113('0x5')][_0x1113('0xb')]=function(_0x26bf52,_0x3b929e){if(!this['vertices'][_0x26bf52]){return logger['info']('no\x20vertex\x20found');}var _0x4ca35c=_0x3b929e(this[_0x1113('0x2')][_0x26bf52]);if(!_0x4ca35c){return logger[_0x1113('0xc')](_0x1113('0xd'));}if(this[_0x1113('0x3')][_0x26bf52]['length']===0x0){return logger[_0x1113('0xc')](_0x1113('0xe'));}for(var _0x12d7ac=0x0,_0x42b07a=[],_0x1cadcb=![];_0x12d7ac\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','finally','[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\x20published','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','xml2json','lodash','syncho','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','error','log','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','omit','isArray','length','target','addEdge','source','value','getSquareProject','then','catch','createSquareReport','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xcea5,0x1cf));var _0x5cea=function(_0x210bd1,_0x18b3f8){_0x210bd1=_0x210bd1-0x0;var _0x32d1da=_0xcea5[_0x210bd1];return _0x32d1da;};'use strict';var parser=require(_0x5cea('0x0'));var _=require(_0x5cea('0x1'));var syncho=require(_0x5cea('0x2'));var util=require('util');var moment=require(_0x5cea('0x3'));var config=require(_0x5cea('0x4'));var logger=require(_0x5cea('0x5'))(_0x5cea('0x6'));var utilLicense=require(_0x5cea('0x7'));var rpc=require(_0x5cea('0x8'));var mailRpc=require(_0x5cea('0x9'));var Graph=require(_0x5cea('0xa'));var Vertices=require(_0x5cea('0xb'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x5cea('0x6')]=_['defaults'](config[_0x5cea('0x6')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x39393b){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x39393b);agiHandler(_0x39393b);}catch(_0x296611){logger[_0x5cea('0xc')](_0x296611['stack']);}});});}function listeningHandler(){console[_0x5cea('0xd')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x5cea('0x6')][_0x5cea('0xe')]);logger[_0x5cea('0xf')](util[_0x5cea('0x10')](_0x5cea('0x11'),config[_0x5cea('0x6')]['ip'],config['agi'][_0x5cea('0xe')]));}function errorHandler(_0x2f6816){if(_0x2f6816&&_0x2f6816[_0x5cea('0x12')]&&_0x2f6816[_0x5cea('0x13')]){logger[_0x5cea('0xc')](util['format'](_0x5cea('0x14'),_0x2f6816[_0x5cea('0x12')],_0x2f6816[_0x5cea('0x13')]));}else{logger['error'](util[_0x5cea('0x10')]('[ERROR]\x20%s',_0x2f6816[_0x5cea('0x15')]));}}function closeHandler(){logger[_0x5cea('0xf')](util[_0x5cea('0x10')](_0x5cea('0x16'),this[_0x5cea('0x17')],this[_0x5cea('0x18')],this[_0x5cea('0x19')],this[_0x5cea('0x1a')],this[_0x5cea('0x1b')]));try{createSquareReport(this);}catch(_0x2d9301){logger[_0x5cea('0xc')](_0x2d9301[_0x5cea('0x15')]);}}function timeoutHandler(){logger[_0x5cea('0xf')](util[_0x5cea('0x10')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x5cea('0x17')],this['calleridname'],this['callerid'],this[_0x5cea('0x1a')],this[_0x5cea('0x1b')]));}function hangupHandler(){logger['info'](util['format'](_0x5cea('0x1c'),this[_0x5cea('0x17')],this[_0x5cea('0x18')],this[_0x5cea('0x19')],this[_0x5cea('0x1a')],this[_0x5cea('0x1b')]));this[_0x5cea('0x1d')]=!![];}function getRoot(_0x259aed){return parser[_0x5cea('0x1e')](_0x259aed,{'object':!![]})[_0x5cea('0x1f')][_0x5cea('0x20')];}function addVertex(_0xdd405f,_0x28a04f,_0x164f5e){_0x28a04f[_0x5cea('0x21')]=_0x164f5e;if(_0x28a04f[_0x5cea('0x22')](_0x5cea('0x23'))){_0x28a04f[_0x5cea('0x24')]=parseInt(_0x28a04f[_0x5cea('0x23')],0xa);}_0xdd405f['addVertex'](_[_0x5cea('0x25')](_0x28a04f,'mxCell'));}function initGraph(_0x4a245b,_0x5ec18b){var _0x1fa2c1=new Graph();for(var _0x378c7a in _0x4a245b){if(_0x4a245b[_0x5cea('0x22')](_0x378c7a)){if(_[_0x5cea('0x26')](_0x4a245b[_0x378c7a])){for(var _0x780ced=0x0;_0x780ced<_0x4a245b[_0x378c7a]['length'];_0x780ced+=0x1){addVertex(_0x1fa2c1,_0x4a245b[_0x378c7a][_0x780ced],_0x378c7a);}}else{addVertex(_0x1fa2c1,_0x4a245b[_0x378c7a],_0x378c7a);}}}for(var _0x1d0013=0x0;_0x1d0013<_0x5ec18b[_0x5cea('0x27')];_0x1d0013+=0x1){if(_0x5ec18b[_0x1d0013]['source']&&_0x5ec18b[_0x1d0013][_0x5cea('0x28')]){_0x1fa2c1[_0x5cea('0x29')](_0x5ec18b[_0x1d0013][_0x5cea('0x2a')],_0x5ec18b[_0x1d0013]['target'],_0x5ec18b[_0x1d0013][_0x5cea('0x2b')]);}}return _0x1fa2c1;}function getSquareProject(_0xf22d21,_0xd6087f){rpc[_0x5cea('0x2c')](_0xf22d21)[_0x5cea('0x2d')](function(_0x54225f){_0xd6087f(null,_0x54225f);})[_0x5cea('0x2e')](function(_0x25122b){_0xd6087f(null,_0x25122b);});}function createSquareReport(_0x2ef8ec,_0x3d22b9){rpc[_0x5cea('0x2f')](_0x2ef8ec)['then'](function(_0x459a40){if(_0x3d22b9){_0x3d22b9(null,_0x459a40);}})['catch'](function(_0x4a0907){if(_0x3d22b9){_0x3d22b9(null,_0x4a0907);}});}function setChannelVariables(_0x6e6aa0){for(var _0xbc807a in _0x6e6aa0){if(_0x6e6aa0[_0x5cea('0x22')](_0xbc807a)){if(_0xbc807a['indexOf']('agi_')===0x0){_0x6e6aa0[_0xbc807a[_0x5cea('0x30')](0x4)]=_0x6e6aa0[_0xbc807a];delete _0x6e6aa0[_0xbc807a];}}}}function getLogFromObject(_0x495ab3){return util['inspect'](_0x495ab3,{'showHidden':![],'depth':null});}function agiHandler(_0x3aa3a9){var _0x5c95f5,_0x4cadcd,_0xa3341e,_0x55ca3f,_0x3b104f;logger[_0x5cea('0x31')](_0x5cea('0x32'),JSON[_0x5cea('0x33')](_0x3aa3a9,null,0x2));logger[_0x5cea('0xf')](util[_0x5cea('0x10')](_0x5cea('0x34'),_0x3aa3a9[_0x5cea('0x17')],_0x3aa3a9[_0x5cea('0x18')],_0x3aa3a9[_0x5cea('0x19')],_0x3aa3a9[_0x5cea('0x1a')],_0x3aa3a9[_0x5cea('0x1b')]));_0x3aa3a9['on'](_0x5cea('0xc'),errorHandler);_0x3aa3a9['on'](_0x5cea('0x35'),closeHandler);_0x3aa3a9['on']('timeout',timeoutHandler);_0x3aa3a9[_0x5cea('0x1d')]=![];_0x3aa3a9['on'](_0x5cea('0x36'),hangupHandler);var _0x4e9246=getSquareProject[_0x5cea('0x37')](null,_0x3aa3a9[_0x5cea('0x17')]);if(_0x4e9246){if(_0x4e9246[_0x5cea('0x38')]){_0x5c95f5=getRoot(_0x4e9246['production']);if(_0x5c95f5&&_0x5c95f5['start']){logger['debug'](_0x5cea('0x20'),JSON[_0x5cea('0x33')](_0x5c95f5,null,0x2));_0x3aa3a9[_0x5cea('0x39')]=moment()[_0x5cea('0x10')](_0x5cea('0x3a'));_0x4cadcd=initGraph(_[_0x5cea('0x25')](_0x5c95f5,'mxCell'),_0x5c95f5[_0x5cea('0x3b')]);_0xa3341e=new Vertices(_0x3aa3a9,rpc,mailRpc);logger[_0x5cea('0xf')](util[_0x5cea('0x10')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3aa3a9[_0x5cea('0x17')],_0x3aa3a9['calleridname'],_0x3aa3a9[_0x5cea('0x19')],_0x3aa3a9[_0x5cea('0x1a')],_0x3aa3a9[_0x5cea('0x1b')]));_0x4cadcd['traverseBFS'](_0x5c95f5[_0x5cea('0x3c')]['id'],function(_0x495ae3){try{_0x495ae3=_0xa3341e[_0x5cea('0x3d')](_0x495ae3);logger[_0x5cea('0x31')](_0x5cea('0x3e'),JSON[_0x5cea('0x33')](_0x495ae3,null,0x2));if(_0x495ae3['agicommand']==='gotoc'){logger[_0x5cea('0xf')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x3aa3a9[_0x5cea('0x3f')]=_0x495ae3['context']||_0x3aa3a9[_0x5cea('0x3f')];_0x3aa3a9[_0x5cea('0x40')]=_0x495ae3[_0x5cea('0x40')];_0x3aa3a9[_0x5cea('0x41')]=_0x495ae3[_0x5cea('0x41')]?_0x495ae3[_0x5cea('0x41')]-0x1:0x1;return null;}else if(_0x495ae3&&_0xa3341e[_0x495ae3[_0x5cea('0x21')]]){_0x3b104f=_0xa3341e[_0x495ae3[_0x5cea('0x21')]](_0x495ae3);logger[_0x5cea('0xf')]('response',JSON[_0x5cea('0x33')](_0x3b104f,null,0x2));if(_0x3b104f&&_0x3b104f[_0x5cea('0x42')]===AGI_CODE_SUCCESS&&_0x3b104f[_0x5cea('0x43')]!==AGI_RESULT_ERROR&&!_0x3aa3a9[_0x5cea('0x1d')]){logger[_0x5cea('0x31')](_0x5cea('0x44'),getLogFromObject(_0x3b104f));return _[_0x5cea('0x45')](_0x3b104f['result'])?null:_0x3b104f[_0x5cea('0x43')][_0x5cea('0x46')]();}else{logger[_0x5cea('0xc')](_0x5cea('0x44'),getLogFromObject(_0x3b104f));return null;}}else{logger[_0x5cea('0xc')](_0x5cea('0x47'));return null;}}catch(_0x4609e9){logger['error'](_0x4609e9[_0x5cea('0x15')]);return null;}});if(_0x5c95f5['finally']){logger[_0x5cea('0xf')](util[_0x5cea('0x10')](_0x5cea('0x48'),_0x3aa3a9[_0x5cea('0x17')],_0x3aa3a9['calleridname'],_0x3aa3a9['callerid'],_0x3aa3a9[_0x5cea('0x1a')],_0x3aa3a9[_0x5cea('0x1b')]));_0x4cadcd[_0x5cea('0x49')](_0x5c95f5[_0x5cea('0x4a')]['id'],function(_0x4c0def){try{_0x4c0def=_0xa3341e[_0x5cea('0x3d')](_0x4c0def);logger[_0x5cea('0x31')](_0x5cea('0x3e'),JSON[_0x5cea('0x33')](_0x4c0def,null,0x2));if(_0x4c0def&&_0xa3341e[_0x4c0def['agicommand']]){_0x3b104f=_0xa3341e[_0x4c0def['agicommand']](_0x4c0def);if(_0x3b104f){logger[_0x5cea('0x31')](_0x5cea('0x44'),getLogFromObject(_0x3b104f));return _[_0x5cea('0x45')](_0x3b104f[_0x5cea('0x43')])?null:_0x3b104f[_0x5cea('0x43')]['toString']();}else{logger[_0x5cea('0xc')](_0x5cea('0x44'),getLogFromObject(_0x3b104f));return null;}}else{logger['error'](_0x5cea('0x47'));return null;}}catch(_0x2ff4ad){logger[_0x5cea('0xc')](_0x2ff4ad[_0x5cea('0x15')]);return null;}});}logger[_0x5cea('0xf')](util[_0x5cea('0x10')](_0x5cea('0x4b'),_0x3aa3a9[_0x5cea('0x17')],_0x3aa3a9[_0x5cea('0x18')],_0x3aa3a9[_0x5cea('0x19')],_0x3aa3a9['dnid'],_0x3aa3a9[_0x5cea('0x1b')]));logger[_0x5cea('0xf')](util[_0x5cea('0x10')](_0x5cea('0x4c'),_0x3aa3a9[_0x5cea('0x3f')],_0x3aa3a9[_0x5cea('0x40')],parseInt(_0x3aa3a9[_0x5cea('0x41')],0xa)+0x1));_0x3aa3a9[_0x5cea('0x4d')](_0x3aa3a9[_0x5cea('0x3f')],_0x3aa3a9[_0x5cea('0x40')],parseInt(_0x3aa3a9[_0x5cea('0x41')],0xa)+0x1);_0x3aa3a9[_0x5cea('0x35')]();}}else{logger[_0x5cea('0xc')](util[_0x5cea('0x10')](_0x5cea('0x4e'),_0x3aa3a9['arg_1']));_0x3aa3a9['continueAt'](_0x3aa3a9['context'],_0x3aa3a9['extension'],parseInt(_0x3aa3a9[_0x5cea('0x41')],0xa)+0x1);_0x3aa3a9[_0x5cea('0x35')]();}}else{logger[_0x5cea('0xc')](util[_0x5cea('0x10')]('Project\x20%s\x20not\x20found',_0x3aa3a9[_0x5cea('0x17')]));_0x3aa3a9[_0x5cea('0x4d')](_0x3aa3a9[_0x5cea('0x3f')],_0x3aa3a9[_0x5cea('0x40')],parseInt(_0x3aa3a9[_0x5cea('0x41')],0xa)+0x1);_0x3aa3a9[_0x5cea('0x35')]();}}function main(){var _0x1bbfd6;return utilLicense['getLicense']()[_0x5cea('0x2d')](function(_0x429e3a){if(_0x429e3a){if(_0x429e3a[_0x5cea('0x4f')]){if(_0x429e3a[_0x5cea('0x50')]&&_0x429e3a[_0x5cea('0x50')]>0x0){logger[_0x5cea('0xf')](util[_0x5cea('0x10')](_0x5cea('0x51'),_0x429e3a[_0x5cea('0x50')]));_0x1bbfd6=_0x429e3a['callysquare'];}else{logger[_0x5cea('0xf')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger['info'](_0x5cea('0x52'));_0x1bbfd6=-0x1;}}})['catch'](function(_0x39a763){logger[_0x5cea('0xc')](_0x5cea('0x53'),_0x39a763[_0x5cea('0x15')]);})['finally'](function(){var _0x80a5a1=require(_0x5cea('0x54'))(config[_0x5cea('0x6')][_0x5cea('0xe')],config[_0x5cea('0x6')]['ip'],_0x1bbfd6);_0x80a5a1['on'](_0x5cea('0xc'),errorHandler);_0x80a5a1['on'](_0x5cea('0x55'),listeningHandler);_0x80a5a1['on']('connection',connectionHandler);_0x80a5a1['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x5aa7=['isUndefined','result','toString','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','vertex','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','extension','continueAt','close','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','./server','listening','connection','xml2json','syncho','util','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./graph','defaults','127.0.0.1','nextTick','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','name','message','error','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','target','addEdge','value','getSquareProject','then','createSquareReport','catch','indexOf','substring','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','sync','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','gotoc','context','priority','response'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x5aa7,0x181));var _0x75aa=function(_0x12173a,_0x375cb0){_0x12173a=_0x12173a-0x0;var _0x25cb4a=_0x5aa7[_0x12173a];return _0x25cb4a;};'use strict';var parser=require(_0x75aa('0x0'));var _=require('lodash');var syncho=require(_0x75aa('0x1'));var util=require(_0x75aa('0x2'));var moment=require(_0x75aa('0x3'));var config=require(_0x75aa('0x4'));var logger=require(_0x75aa('0x5'))(_0x75aa('0x6'));var utilLicense=require(_0x75aa('0x7'));var rpc=require(_0x75aa('0x8'));var mailRpc=require(_0x75aa('0x9'));var Graph=require(_0x75aa('0xa'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x75aa('0x6')]=_[_0x75aa('0xb')](config['agi'],{'ip':_0x75aa('0xc'),'port':0x11dd});function connectionHandler(_0x2c3c60){process[_0x75aa('0xd')](function(){syncho(function(){try{setChannelVariables(_0x2c3c60);agiHandler(_0x2c3c60);}catch(_0x36cf3b){logger['error'](_0x36cf3b[_0x75aa('0xe')]);}});});}function listeningHandler(){console[_0x75aa('0xf')](_0x75aa('0x10'),config[_0x75aa('0x6')][_0x75aa('0x11')]);logger[_0x75aa('0x12')](util[_0x75aa('0x13')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x75aa('0x6')]['ip'],config[_0x75aa('0x6')][_0x75aa('0x11')]));}function errorHandler(_0x280d95){if(_0x280d95&&_0x280d95[_0x75aa('0x14')]&&_0x280d95[_0x75aa('0x15')]){logger[_0x75aa('0x16')](util[_0x75aa('0x13')](_0x75aa('0x17'),_0x280d95['name'],_0x280d95[_0x75aa('0x15')]));}else{logger[_0x75aa('0x16')](util[_0x75aa('0x13')](_0x75aa('0x18'),_0x280d95[_0x75aa('0xe')]));}}function closeHandler(){logger[_0x75aa('0x12')](util[_0x75aa('0x13')](_0x75aa('0x19'),this[_0x75aa('0x1a')],this['calleridname'],this[_0x75aa('0x1b')],this[_0x75aa('0x1c')],this[_0x75aa('0x1d')]));try{createSquareReport(this);}catch(_0x33741f){logger['error'](_0x33741f[_0x75aa('0xe')]);}}function timeoutHandler(){logger['info'](util['format'](_0x75aa('0x1e'),this['arg_1'],this[_0x75aa('0x1f')],this[_0x75aa('0x1b')],this['dnid'],this[_0x75aa('0x1d')]));}function hangupHandler(){logger[_0x75aa('0x12')](util['format'](_0x75aa('0x20'),this[_0x75aa('0x1a')],this['calleridname'],this['callerid'],this['dnid'],this['uniqueid']));this[_0x75aa('0x21')]=!![];}function getRoot(_0x3fe03c){return parser[_0x75aa('0x22')](_0x3fe03c,{'object':!![]})[_0x75aa('0x23')][_0x75aa('0x24')];}function addVertex(_0x2e83bd,_0x205e98,_0x392b2d){_0x205e98[_0x75aa('0x25')]=_0x392b2d;if(_0x205e98[_0x75aa('0x26')](_0x75aa('0x27'))){_0x205e98[_0x75aa('0x28')]=parseInt(_0x205e98[_0x75aa('0x27')],0xa);}_0x2e83bd[_0x75aa('0x29')](_[_0x75aa('0x2a')](_0x205e98,_0x75aa('0x2b')));}function initGraph(_0x37631c,_0x5e4bcd){var _0x2e1e3a=new Graph();for(var _0x4796ed in _0x37631c){if(_0x37631c[_0x75aa('0x26')](_0x4796ed)){if(_[_0x75aa('0x2c')](_0x37631c[_0x4796ed])){for(var _0x14d49b=0x0;_0x14d49b<_0x37631c[_0x4796ed][_0x75aa('0x2d')];_0x14d49b+=0x1){addVertex(_0x2e1e3a,_0x37631c[_0x4796ed][_0x14d49b],_0x4796ed);}}else{addVertex(_0x2e1e3a,_0x37631c[_0x4796ed],_0x4796ed);}}}for(var _0x6cd03=0x0;_0x6cd03<_0x5e4bcd['length'];_0x6cd03+=0x1){if(_0x5e4bcd[_0x6cd03]['source']&&_0x5e4bcd[_0x6cd03][_0x75aa('0x2e')]){_0x2e1e3a[_0x75aa('0x2f')](_0x5e4bcd[_0x6cd03]['source'],_0x5e4bcd[_0x6cd03][_0x75aa('0x2e')],_0x5e4bcd[_0x6cd03][_0x75aa('0x30')]);}}return _0x2e1e3a;}function getSquareProject(_0x6a14a8,_0x3b5811){rpc[_0x75aa('0x31')](_0x6a14a8)[_0x75aa('0x32')](function(_0xa017d3){_0x3b5811(null,_0xa017d3);})['catch'](function(_0x43be68){_0x3b5811(null,_0x43be68);});}function createSquareReport(_0x4695fc,_0x4f0754){rpc[_0x75aa('0x33')](_0x4695fc)['then'](function(_0x5b2e74){if(_0x4f0754){_0x4f0754(null,_0x5b2e74);}})[_0x75aa('0x34')](function(_0x3cec2e){if(_0x4f0754){_0x4f0754(null,_0x3cec2e);}});}function setChannelVariables(_0x47efc2){for(var _0x1106c6 in _0x47efc2){if(_0x47efc2[_0x75aa('0x26')](_0x1106c6)){if(_0x1106c6[_0x75aa('0x35')]('agi_')===0x0){_0x47efc2[_0x1106c6[_0x75aa('0x36')](0x4)]=_0x47efc2[_0x1106c6];delete _0x47efc2[_0x1106c6];}}}}function getLogFromObject(_0x3a0acc){return util['inspect'](_0x3a0acc,{'showHidden':![],'depth':null});}function agiHandler(_0x2ffdb1){var _0x17f53e,_0xab9050,_0x3eed19,_0x1573eb,_0x2ee990;logger[_0x75aa('0x37')]('variables',JSON[_0x75aa('0x38')](_0x2ffdb1,null,0x2));logger[_0x75aa('0x12')](util[_0x75aa('0x13')](_0x75aa('0x39'),_0x2ffdb1[_0x75aa('0x1a')],_0x2ffdb1[_0x75aa('0x1f')],_0x2ffdb1[_0x75aa('0x1b')],_0x2ffdb1[_0x75aa('0x1c')],_0x2ffdb1[_0x75aa('0x1d')]));_0x2ffdb1['on'](_0x75aa('0x16'),errorHandler);_0x2ffdb1['on']('close',closeHandler);_0x2ffdb1['on']('timeout',timeoutHandler);_0x2ffdb1[_0x75aa('0x21')]=![];_0x2ffdb1['on']('hangup',hangupHandler);var _0x5bcaaa=getSquareProject[_0x75aa('0x3a')](null,_0x2ffdb1[_0x75aa('0x1a')]);if(_0x5bcaaa){if(_0x5bcaaa['production']){_0x17f53e=getRoot(_0x5bcaaa[_0x75aa('0x3b')]);if(_0x17f53e&&_0x17f53e[_0x75aa('0x3c')]){logger['debug'](_0x75aa('0x24'),JSON['stringify'](_0x17f53e,null,0x2));_0x2ffdb1[_0x75aa('0x3d')]=moment()[_0x75aa('0x13')](_0x75aa('0x3e'));_0xab9050=initGraph(_[_0x75aa('0x2a')](_0x17f53e,_0x75aa('0x2b')),_0x17f53e[_0x75aa('0x2b')]);_0x3eed19=new Vertices(_0x2ffdb1,rpc,mailRpc);logger['info'](util[_0x75aa('0x13')](_0x75aa('0x3f'),_0x2ffdb1[_0x75aa('0x1a')],_0x2ffdb1[_0x75aa('0x1f')],_0x2ffdb1[_0x75aa('0x1b')],_0x2ffdb1[_0x75aa('0x1c')],_0x2ffdb1[_0x75aa('0x1d')]));_0xab9050[_0x75aa('0x40')](_0x17f53e[_0x75aa('0x3c')]['id'],function(_0x4256de){try{_0x4256de=_0x3eed19[_0x75aa('0x41')](_0x4256de);logger[_0x75aa('0x37')]('vertex',JSON[_0x75aa('0x38')](_0x4256de,null,0x2));if(_0x4256de[_0x75aa('0x25')]===_0x75aa('0x42')){logger[_0x75aa('0x12')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x2ffdb1[_0x75aa('0x43')]=_0x4256de[_0x75aa('0x43')]||_0x2ffdb1[_0x75aa('0x43')];_0x2ffdb1['extension']=_0x4256de['extension'];_0x2ffdb1[_0x75aa('0x44')]=_0x4256de[_0x75aa('0x44')]?_0x4256de[_0x75aa('0x44')]-0x1:0x1;return null;}else if(_0x4256de&&_0x3eed19[_0x4256de[_0x75aa('0x25')]]){_0x2ee990=_0x3eed19[_0x4256de[_0x75aa('0x25')]](_0x4256de);logger[_0x75aa('0x12')](_0x75aa('0x45'),JSON[_0x75aa('0x38')](_0x2ee990,null,0x2));if(_0x2ee990&&_0x2ee990['code']===AGI_CODE_SUCCESS&&_0x2ee990['result']!==AGI_RESULT_ERROR&&!_0x2ffdb1[_0x75aa('0x21')]){logger[_0x75aa('0x37')]('response',getLogFromObject(_0x2ee990));return _[_0x75aa('0x46')](_0x2ee990[_0x75aa('0x47')])?null:_0x2ee990[_0x75aa('0x47')][_0x75aa('0x48')]();}else{logger['error'](_0x75aa('0x45'),getLogFromObject(_0x2ee990));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x2359dd){logger[_0x75aa('0x16')](_0x2359dd[_0x75aa('0xe')]);return null;}});if(_0x17f53e[_0x75aa('0x49')]){logger[_0x75aa('0x12')](util[_0x75aa('0x13')](_0x75aa('0x4a'),_0x2ffdb1[_0x75aa('0x1a')],_0x2ffdb1[_0x75aa('0x1f')],_0x2ffdb1[_0x75aa('0x1b')],_0x2ffdb1['dnid'],_0x2ffdb1['uniqueid']));_0xab9050[_0x75aa('0x40')](_0x17f53e[_0x75aa('0x49')]['id'],function(_0x1e7123){try{_0x1e7123=_0x3eed19[_0x75aa('0x41')](_0x1e7123);logger[_0x75aa('0x37')](_0x75aa('0x4b'),JSON[_0x75aa('0x38')](_0x1e7123,null,0x2));if(_0x1e7123&&_0x3eed19[_0x1e7123[_0x75aa('0x25')]]){_0x2ee990=_0x3eed19[_0x1e7123[_0x75aa('0x25')]](_0x1e7123);if(_0x2ee990){logger[_0x75aa('0x37')](_0x75aa('0x45'),getLogFromObject(_0x2ee990));return _[_0x75aa('0x46')](_0x2ee990[_0x75aa('0x47')])?null:_0x2ee990[_0x75aa('0x47')][_0x75aa('0x48')]();}else{logger[_0x75aa('0x16')]('response',getLogFromObject(_0x2ee990));return null;}}else{logger[_0x75aa('0x16')]('agicommand\x20not\x20found');return null;}}catch(_0x52d66e){logger[_0x75aa('0x16')](_0x52d66e[_0x75aa('0xe')]);return null;}});}logger[_0x75aa('0x12')](util[_0x75aa('0x13')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2ffdb1[_0x75aa('0x1a')],_0x2ffdb1[_0x75aa('0x1f')],_0x2ffdb1[_0x75aa('0x1b')],_0x2ffdb1[_0x75aa('0x1c')],_0x2ffdb1[_0x75aa('0x1d')]));logger[_0x75aa('0x12')](util['format'](_0x75aa('0x4c'),_0x2ffdb1[_0x75aa('0x43')],_0x2ffdb1[_0x75aa('0x4d')],parseInt(_0x2ffdb1[_0x75aa('0x44')],0xa)+0x1));_0x2ffdb1[_0x75aa('0x4e')](_0x2ffdb1[_0x75aa('0x43')],_0x2ffdb1[_0x75aa('0x4d')],parseInt(_0x2ffdb1[_0x75aa('0x44')],0xa)+0x1);_0x2ffdb1[_0x75aa('0x4f')]();}}else{logger['error'](util[_0x75aa('0x13')](_0x75aa('0x50'),_0x2ffdb1[_0x75aa('0x1a')]));_0x2ffdb1['continueAt'](_0x2ffdb1[_0x75aa('0x43')],_0x2ffdb1[_0x75aa('0x4d')],parseInt(_0x2ffdb1[_0x75aa('0x44')],0xa)+0x1);_0x2ffdb1[_0x75aa('0x4f')]();}}else{logger[_0x75aa('0x16')](util[_0x75aa('0x13')](_0x75aa('0x51'),_0x2ffdb1[_0x75aa('0x1a')]));_0x2ffdb1[_0x75aa('0x4e')](_0x2ffdb1[_0x75aa('0x43')],_0x2ffdb1[_0x75aa('0x4d')],parseInt(_0x2ffdb1[_0x75aa('0x44')],0xa)+0x1);_0x2ffdb1[_0x75aa('0x4f')]();}}function main(){var _0x2c5967;return utilLicense[_0x75aa('0x52')]()[_0x75aa('0x32')](function(_0x3adb66){if(_0x3adb66){if(_0x3adb66[_0x75aa('0x53')]){if(_0x3adb66[_0x75aa('0x54')]&&_0x3adb66[_0x75aa('0x54')]>0x0){logger[_0x75aa('0x12')](util[_0x75aa('0x13')](_0x75aa('0x55'),_0x3adb66[_0x75aa('0x54')]));_0x2c5967=_0x3adb66[_0x75aa('0x54')];}else{logger[_0x75aa('0x12')](_0x75aa('0x56'));}}else{logger[_0x75aa('0x12')](_0x75aa('0x57'));_0x2c5967=-0x1;}}})[_0x75aa('0x34')](function(_0x2b9990){logger[_0x75aa('0x16')]('[LICENSE]',_0x2b9990[_0x75aa('0xe')]);})[_0x75aa('0x49')](function(){var _0x459763=require(_0x75aa('0x58'))(config['agi'][_0x75aa('0x11')],config[_0x75aa('0x6')]['ip'],_0x2c5967);_0x459763['on'](_0x75aa('0x16'),errorHandler);_0x459763['on'](_0x75aa('0x59'),listeningHandler);_0x459763['on'](_0x75aa('0x5a'),connectionHandler);_0x459763['on'](_0x75aa('0x4f'),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 cc658b1..7593a0a 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 _0x2697=['catch','SendMail','bluebird','jayson/promise','client','http','error','result'];(function(_0x15942a,_0x13b58c){var _0x36a9fb=function(_0x549c27){while(--_0x549c27){_0x15942a['push'](_0x15942a['shift']());}};_0x36a9fb(++_0x13b58c);}(_0x2697,0x142));var _0x7269=function(_0x3f4891,_0x4e6f62){_0x3f4891=_0x3f4891-0x0;var _0x54f2d8=_0x2697[_0x3f4891];return _0x54f2d8;};'use strict';var BPromise=require(_0x7269('0x0'));var jayson=require(_0x7269('0x1'));var client=jayson[_0x7269('0x2')][_0x7269('0x3')]({'port':0x232b});function request(_0x5b21e0,_0x1a3bb9){return new BPromise(function(_0x7b46f3,_0x3c5796){return client['request'](_0x5b21e0,_0x1a3bb9)['then'](function(_0x50fa70){if(_0x50fa70[_0x7269('0x4')]){return _0x3c5796(_0x50fa70['error']['message']);}else{return _0x7b46f3(_0x50fa70[_0x7269('0x5')]);}})[_0x7269('0x6')](function(_0x2f1713){return _0x3c5796(_0x2f1713);});});}exports['sendMailMessage']=function(_0x3260c8,_0x483c03){return request(_0x7269('0x7'),{'account':_0x3260c8,'message':_0x483c03});}; \ No newline at end of file +var _0xfd92=['error','message','catch','sendMailMessage','SendMail','jayson/promise','client','http','request'];(function(_0x39fbcd,_0x316ea4){var _0x478732=function(_0x5885d8){while(--_0x5885d8){_0x39fbcd['push'](_0x39fbcd['shift']());}};_0x478732(++_0x316ea4);}(_0xfd92,0xdd));var _0x2fd9=function(_0x36b2c5,_0x5eaf9a){_0x36b2c5=_0x36b2c5-0x0;var _0x919462=_0xfd92[_0x36b2c5];return _0x919462;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x2fd9('0x0'));var client=jayson[_0x2fd9('0x1')][_0x2fd9('0x2')]({'port':0x232b});function request(_0x177cec,_0x4bdf26){return new BPromise(function(_0x464640,_0x3bade2){return client[_0x2fd9('0x3')](_0x177cec,_0x4bdf26)['then'](function(_0x2f0b38){if(_0x2f0b38[_0x2fd9('0x4')]){return _0x3bade2(_0x2f0b38['error'][_0x2fd9('0x5')]);}else{return _0x464640(_0x2f0b38['result']);}})[_0x2fd9('0x6')](function(_0x5c7888){return _0x3bade2(_0x5c7888);});});}exports[_0x2fd9('0x7')]=function(_0x2238a4,_0x3bbcf0){return request(_0x2fd9('0x8'),{'account':_0x2238a4,'message':_0x3bbcf0});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 38d9c81..689f7fb 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 _0xb469=['toString','substring','length','split','indexOf','slice','trim','emit','headers','util','stream','Transform','call','_localBuffer','_inBody','prototype','_transform','\x0d\x0a\x0d\x0a'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xb469,0x13b));var _0x9b46=function(_0x1c1a79,_0x4fcda6){_0x1c1a79=_0x1c1a79-0x0;var _0x3f1bbe=_0xb469[_0x1c1a79];return _0x3f1bbe;};'use strict';var util=require(_0x9b46('0x0'));var Transform=require(_0x9b46('0x1'))[_0x9b46('0x2')];function AGIReply(_0x34f477){Transform[_0x9b46('0x3')](this,_0x34f477);this[_0x9b46('0x4')]='';this[_0x9b46('0x5')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x9b46('0x6')][_0x9b46('0x7')]=function(_0x538fc4,_0x368923,_0x405d1c){var _0x50b49e='\x0a',_0x1b2dd3=['\x0a\x0a',_0x9b46('0x8')],_0x5bd834=-0x1,_0x4c1ed9=-0x1,_0x34c0de='',_0x545b6c=0x0,_0x402595='',_0xb9d1b5='';this['_localBuffer']+=_0x538fc4[_0x9b46('0x9')]();_0x402595=this['_localBuffer'];if(!this[_0x9b46('0x5')]){_0x545b6c=0x0;while(_0x1b2dd3[_0x545b6c]){while((_0x4c1ed9=_0x402595['indexOf'](_0x1b2dd3[_0x545b6c]))!=-0x1){_0x34c0de=_0x1b2dd3[_0x545b6c];_0xb9d1b5=_0x402595[_0x9b46('0xa')](0x0,_0x4c1ed9);_0x402595=_0x402595['substring'](_0x4c1ed9+_0x34c0de[_0x9b46('0xb')]);var _0x233b6b=_0xb9d1b5[_0x9b46('0xc')](_0x50b49e),_0x563de4=0x0,_0x360974={},_0x417df5='',_0x5b65c2='',_0x14362a=-0x1;while(_0x233b6b[_0x563de4]){_0x14362a=_0x233b6b[_0x563de4][_0x9b46('0xd')](':');if(_0x14362a!=-0x1){_0x417df5=_0x233b6b[_0x563de4][_0x9b46('0xe')](0x0,_0x14362a)[_0x9b46('0xf')]();_0x5b65c2=_0x233b6b[_0x563de4][_0x9b46('0xe')](_0x14362a+0x1)[_0x9b46('0xf')]();if(_0x417df5[_0x9b46('0xb')]>0x0){_0x360974[_0x417df5]=_0x5b65c2;}}else{}_0x563de4++;}this[_0x9b46('0x10')](_0x9b46('0x11'),_0x360974);this[_0x9b46('0x5')]=!![];}_0x545b6c++;}this[_0x9b46('0x4')]=_0x402595;}else{while((_0x5bd834=_0x402595[_0x9b46('0xd')](_0x50b49e))!=-0x1){_0xb9d1b5=_0x402595['substring'](0x0,_0x5bd834);this['emit']('line',_0xb9d1b5);_0x402595=_0x402595[_0x9b46('0xa')](_0x5bd834+_0x50b49e[_0x9b46('0xb')]);}this[_0x9b46('0x4')]=_0x402595;}_0x405d1c();};module['exports']=AGIReply; \ No newline at end of file +var _0xd407=['emit','line','util','stream','call','_inBody','inherits','prototype','\x0d\x0a\x0d\x0a','_localBuffer','toString','substring','length','split','indexOf','slice','trim'];(function(_0xfb02c9,_0x43c274){var _0x9afb71=function(_0x56dff0){while(--_0x56dff0){_0xfb02c9['push'](_0xfb02c9['shift']());}};_0x9afb71(++_0x43c274);}(_0xd407,0x1de));var _0x7d40=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd407[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x7d40('0x0'));var Transform=require(_0x7d40('0x1'))['Transform'];function AGIReply(_0x233fba){Transform[_0x7d40('0x2')](this,_0x233fba);this['_localBuffer']='';this[_0x7d40('0x3')]=![];}util[_0x7d40('0x4')](AGIReply,Transform);AGIReply[_0x7d40('0x5')]['_transform']=function(_0x4fc9b7,_0x2059f9,_0x1ce147){var _0x46307f='\x0a',_0x2009d7=['\x0a\x0a',_0x7d40('0x6')],_0x574dc7=-0x1,_0x2bbec2=-0x1,_0xa981fe='',_0x29e4f5=0x0,_0x3af25a='',_0x3a45a9='';this[_0x7d40('0x7')]+=_0x4fc9b7[_0x7d40('0x8')]();_0x3af25a=this[_0x7d40('0x7')];if(!this[_0x7d40('0x3')]){_0x29e4f5=0x0;while(_0x2009d7[_0x29e4f5]){while((_0x2bbec2=_0x3af25a['indexOf'](_0x2009d7[_0x29e4f5]))!=-0x1){_0xa981fe=_0x2009d7[_0x29e4f5];_0x3a45a9=_0x3af25a[_0x7d40('0x9')](0x0,_0x2bbec2);_0x3af25a=_0x3af25a[_0x7d40('0x9')](_0x2bbec2+_0xa981fe[_0x7d40('0xa')]);var _0x451e57=_0x3a45a9[_0x7d40('0xb')](_0x46307f),_0x564257=0x0,_0x229c61={},_0x273e02='',_0x230ad5='',_0x13f94e=-0x1;while(_0x451e57[_0x564257]){_0x13f94e=_0x451e57[_0x564257][_0x7d40('0xc')](':');if(_0x13f94e!=-0x1){_0x273e02=_0x451e57[_0x564257][_0x7d40('0xd')](0x0,_0x13f94e)[_0x7d40('0xe')]();_0x230ad5=_0x451e57[_0x564257][_0x7d40('0xd')](_0x13f94e+0x1)['trim']();if(_0x273e02[_0x7d40('0xa')]>0x0){_0x229c61[_0x273e02]=_0x230ad5;}}else{}_0x564257++;}this[_0x7d40('0xf')]('headers',_0x229c61);this[_0x7d40('0x3')]=!![];}_0x29e4f5++;}this[_0x7d40('0x7')]=_0x3af25a;}else{while((_0x574dc7=_0x3af25a[_0x7d40('0xc')](_0x46307f))!=-0x1){_0x3a45a9=_0x3af25a[_0x7d40('0x9')](0x0,_0x574dc7);this[_0x7d40('0xf')](_0x7d40('0x10'),_0x3a45a9);_0x3af25a=_0x3af25a['substring'](_0x574dc7+_0x46307f[_0x7d40('0xa')]);}this[_0x7d40('0x7')]=_0x3af25a;}_0x1ce147();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 7780cf3..f5bbcfd 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 _0x63d1=['CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','createCmContact','ShowCmHopper','phone','CreateCmContact','getPauseById','agentLogin','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','util','client','http','request','then','error','message','result','catch','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','ShowTrunk','getSoundById','save_name','getIntervalById','ShowInterval','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport'];(function(_0x5db045,_0x22ed69){var _0x18c1c2=function(_0x45c126){while(--_0x45c126){_0x5db045['push'](_0x5db045['shift']());}};_0x18c1c2(++_0x22ed69);}(_0x63d1,0x13c));var _0x163d=function(_0x46ceaa,_0x1e5518){_0x46ceaa=_0x46ceaa-0x0;var _0x50e799=_0x63d1[_0x46ceaa];return _0x50e799;};'use strict';var BPromise=require(_0x163d('0x0'));var moment=require(_0x163d('0x1'));var _=require(_0x163d('0x2'));var util=require(_0x163d('0x3'));var jayson=require('jayson/promise');var client=jayson[_0x163d('0x4')][_0x163d('0x5')]({'port':0x2329});function request(_0x2e0d2f,_0x286780){return new BPromise(function(_0x4864b7,_0x11c3fd){return client[_0x163d('0x6')](_0x2e0d2f,_0x286780)[_0x163d('0x7')](function(_0x3dffb7){if(_0x3dffb7['error']){return _0x11c3fd(_0x3dffb7[_0x163d('0x8')][_0x163d('0x9')]);}else{return _0x4864b7(_0x3dffb7[_0x163d('0xa')]);}})[_0x163d('0xb')](function(_0x26f007){return _0x11c3fd(_0x26f007);});});}exports['getSquareProject']=function(_0x227335){return request(_0x163d('0xc'),{'options':{'raw':![],'where':{'name':_0x227335},'attributes':[_0x163d('0xd')]}});};exports[_0x163d('0xe')]=function(_0x132502){return request(_0x163d('0xf'),{'options':{'raw':![],'where':{'id':_0x132502},'include':[{'model':_0x163d('0x10'),'as':_0x163d('0x11')}],'attributes':['id',_0x163d('0x12'),_0x163d('0x13')]}});};exports[_0x163d('0x14')]=function(_0x1bd5fe){return request('ShowSquareProject',{'options':{'where':{'id':_0x1bd5fe},'attributes':[_0x163d('0x12')]}});};exports[_0x163d('0x15')]=function(_0x390cb8){return request(_0x163d('0x16'),{'options':{'where':{'id':_0x390cb8},'attributes':[_0x163d('0x12')]}});};exports['getVariableById']=function(_0x18abaf){return request('ShowVariable',{'options':{'where':{'id':_0x18abaf},'attributes':['name']}});};exports[_0x163d('0x17')]=function(_0x216d2d){return request(_0x163d('0x18'),{'options':{'where':{'id':_0x216d2d},'attributes':[_0x163d('0x19')]}});};exports[_0x163d('0x1a')]=function(_0x1fcf8a){return request(_0x163d('0x1b'),{'options':{'where':{'id':_0x1fcf8a},'attributes':[_0x163d('0x12')]}});};exports['getTrunkById']=function(_0x14082e){return request(_0x163d('0x1c'),{'options':{'where':{'id':_0x14082e},'attributes':[_0x163d('0x12')]}});};exports[_0x163d('0x1d')]=function(_0x5ef1a1){return request('ShowSound',{'options':{'where':{'id':_0x5ef1a1},'attributes':[_0x163d('0x1e')]}});};exports[_0x163d('0x1f')]=function(_0x5e0d9f){return request(_0x163d('0x20'),{'options':{'raw':![],'where':{'id':_0x5e0d9f},'include':[{'model':'Interval','as':'Intervals'}]}});};exports[_0x163d('0x21')]=function(_0x21dc9f){return request(_0x163d('0x22'),{'options':{'where':{'id':_0x21dc9f},'attributes':['id',_0x163d('0x12')]}});};exports[_0x163d('0x23')]=function(_0x3c8b8b){return request(_0x163d('0x24'),{'body':_0x3c8b8b});};exports[_0x163d('0x25')]=function(_0x423ad2){return request(_0x163d('0x26'),{'body':_0x423ad2});};exports[_0x163d('0x27')]=function(_0x1e716f){return request(_0x163d('0x28'),{'body':_[_0x163d('0x29')](_0x1e716f,{'project_name':_0x1e716f[_0x163d('0x2a')],'prev_project_name':_0x1e716f[_0x163d('0x2b')]||'','is_subproject':_0x1e716f[_0x163d('0x2b')]?!![]:![],'leaveAt':moment()[_0x163d('0x2c')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x163d('0x2d')]=function(_0x3770b4){return request(_0x163d('0x2e'),{'body':_0x3770b4});};exports['createSquareMessage']=function(_0x3a9b78){return request('CreateSquareMessage',{'body':_0x3a9b78});};exports[_0x163d('0x2f')]=function(_0x5dfded){return request(_0x163d('0x30'),{'options':{'raw':![],'where':{'phone':_0x5dfded[_0x163d('0x31')],'ListId':_0x5dfded['ListId']}}})[_0x163d('0x7')](function(_0x34dc70){if(_0x34dc70){return _0x34dc70;}return request(_0x163d('0x32'),{'body':_0x5dfded});});};exports[_0x163d('0x33')]=function(_0x4620f5){return request('ShowPause',{'options':{'where':{'id':_0x4620f5},'attributes':[_0x163d('0x12')]}});};exports[_0x163d('0x34')]=function(_0x4e21bd,_0x462fe3){return request('LoginUser',{'body':{'interface':_0x462fe3},'options':{'where':_0x4e21bd}});};exports[_0x163d('0x35')]=function(_0x35d875,_0x2dad72,_0x1dcc0b){return request(_0x163d('0x36'),{'body':{'type':_0x2dad72,'uniqueid':_0x1dcc0b},'options':{'where':_0x35d875}});};exports[_0x163d('0x37')]=function(_0x312bc6){return request(_0x163d('0x38'),{'body':{},'options':{'where':_0x312bc6}});};exports[_0x163d('0x39')]=function(_0x47f584){return request(_0x163d('0x3a'),{'body':{},'options':{'where':_0x47f584}});}; \ No newline at end of file +var _0xa97f=['format','YYYY-MM-DD\x20HH:mm:ss','createSquareMessage','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','util','client','http','request','then','error','message','result','catch','getSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','ShowSquareProject','getVoiceQueueById','ShowVariable','getSquareOdbcById','dsn','getUserById','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2'];(function(_0x5b8d1d,_0x13b01f){var _0x1d2e0e=function(_0x4f2d0c){while(--_0x4f2d0c){_0x5b8d1d['push'](_0x5b8d1d['shift']());}};_0x1d2e0e(++_0x13b01f);}(_0xa97f,0x131));var _0xfa97=function(_0x832cae,_0x46d886){_0x832cae=_0x832cae-0x0;var _0x817bb5=_0xa97f[_0x832cae];return _0x817bb5;};'use strict';var BPromise=require(_0xfa97('0x0'));var moment=require(_0xfa97('0x1'));var _=require('lodash');var util=require(_0xfa97('0x2'));var jayson=require('jayson/promise');var client=jayson[_0xfa97('0x3')][_0xfa97('0x4')]({'port':0x2329});function request(_0x40deda,_0x136c3f){return new BPromise(function(_0x1de12b,_0x4c90ef){return client[_0xfa97('0x5')](_0x40deda,_0x136c3f)[_0xfa97('0x6')](function(_0x23a997){if(_0x23a997[_0xfa97('0x7')]){return _0x4c90ef(_0x23a997[_0xfa97('0x7')][_0xfa97('0x8')]);}else{return _0x1de12b(_0x23a997[_0xfa97('0x9')]);}})[_0xfa97('0xa')](function(_0x50f2d3){return _0x4c90ef(_0x50f2d3);});});}exports[_0xfa97('0xb')]=function(_0x15b963){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x15b963},'attributes':[_0xfa97('0xc')]}});};exports[_0xfa97('0xd')]=function(_0x5cb8b){return request(_0xfa97('0xe'),{'options':{'raw':![],'where':{'id':_0x5cb8b},'include':[{'model':_0xfa97('0xf'),'as':_0xfa97('0x10')}],'attributes':['id',_0xfa97('0x11'),_0xfa97('0x12')]}});};exports['getSquareProjectById']=function(_0x303238){return request(_0xfa97('0x13'),{'options':{'where':{'id':_0x303238},'attributes':['name']}});};exports[_0xfa97('0x14')]=function(_0x4cc51d){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x4cc51d},'attributes':[_0xfa97('0x11')]}});};exports['getVariableById']=function(_0x33f1de){return request(_0xfa97('0x15'),{'options':{'where':{'id':_0x33f1de},'attributes':[_0xfa97('0x11')]}});};exports[_0xfa97('0x16')]=function(_0x2162cc){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x2162cc},'attributes':[_0xfa97('0x17')]}});};exports[_0xfa97('0x18')]=function(_0x59bfe3){return request('ShowUser',{'options':{'where':{'id':_0x59bfe3},'attributes':[_0xfa97('0x11')]}});};exports[_0xfa97('0x19')]=function(_0x442f3a){return request(_0xfa97('0x1a'),{'options':{'where':{'id':_0x442f3a},'attributes':['name']}});};exports[_0xfa97('0x1b')]=function(_0x4e0570){return request(_0xfa97('0x1c'),{'options':{'where':{'id':_0x4e0570},'attributes':[_0xfa97('0x1d')]}});};exports[_0xfa97('0x1e')]=function(_0x361107){return request(_0xfa97('0x1f'),{'options':{'raw':![],'where':{'id':_0x361107},'include':[{'model':'Interval','as':_0xfa97('0x20')}]}});};exports[_0xfa97('0x21')]=function(_0x4479ff){return request(_0xfa97('0x22'),{'options':{'where':{'id':_0x4479ff},'attributes':['id',_0xfa97('0x11')]}});};exports[_0xfa97('0x23')]=function(_0x1df63c){return request(_0xfa97('0x24'),{'body':_0x1df63c});};exports[_0xfa97('0x25')]=function(_0x7df6b7){return request(_0xfa97('0x26'),{'body':_0x7df6b7});};exports[_0xfa97('0x27')]=function(_0x12fbbd){return request(_0xfa97('0x28'),{'body':_['merge'](_0x12fbbd,{'project_name':_0x12fbbd[_0xfa97('0x29')],'prev_project_name':_0x12fbbd[_0xfa97('0x2a')]||'','is_subproject':_0x12fbbd[_0xfa97('0x2a')]?!![]:![],'leaveAt':moment()[_0xfa97('0x2b')](_0xfa97('0x2c'))})});};exports['createSquareRecording']=function(_0x1cb3ea){return request('CreateSquareRecording',{'body':_0x1cb3ea});};exports[_0xfa97('0x2d')]=function(_0x3eb4b5){return request('CreateSquareMessage',{'body':_0x3eb4b5});};exports['createCmContact']=function(_0x5a1314){return request(_0xfa97('0x2e'),{'options':{'raw':![],'where':{'phone':_0x5a1314[_0xfa97('0x2f')],'ListId':_0x5a1314[_0xfa97('0x30')]}}})['then'](function(_0x53f1b8){if(_0x53f1b8){return _0x53f1b8;}return request(_0xfa97('0x31'),{'body':_0x5a1314});});};exports[_0xfa97('0x32')]=function(_0x1aa8e1){return request(_0xfa97('0x33'),{'options':{'where':{'id':_0x1aa8e1},'attributes':[_0xfa97('0x11')]}});};exports[_0xfa97('0x34')]=function(_0x20eb90,_0x3d9d61){return request(_0xfa97('0x35'),{'body':{'interface':_0x3d9d61},'options':{'where':_0x20eb90}});};exports['agentPause']=function(_0x4518b4,_0xadf36b,_0x115faf){return request('PauseUser',{'body':{'type':_0xadf36b,'uniqueid':_0x115faf},'options':{'where':_0x4518b4}});};exports[_0xfa97('0x36')]=function(_0x43753d){return request(_0xfa97('0x37'),{'body':{},'options':{'where':_0x43753d}});};exports[_0xfa97('0x38')]=function(_0x4eefb5){return request(_0xfa97('0x39'),{'body':{},'options':{'where':_0x4eefb5}});}; \ 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 f015c45..a47b4fc 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 _0xd0c9=['./polly','./lex'];(function(_0x41bfa8,_0x2222f0){var _0x5a689e=function(_0x9c9b27){while(--_0x9c9b27){_0x41bfa8['push'](_0x41bfa8['shift']());}};_0x5a689e(++_0x2222f0);}(_0xd0c9,0xe2));var _0x9d0c=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xd0c9[_0x5c2e3e];return _0x53f64a;};var polly=require(_0x9d0c('0x0'));var lex=require(_0x9d0c('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x565f=['./lex','exports'];(function(_0x3cd8d0,_0x435c73){var _0x240b5c=function(_0x3b2edd){while(--_0x3b2edd){_0x3cd8d0['push'](_0x3cd8d0['shift']());}};_0x240b5c(++_0x435c73);}(_0x565f,0x68));var _0xf565=function(_0x487974,_0x4023c9){_0x487974=_0x487974-0x0;var _0x36dd0d=_0x565f[_0x487974];return _0x36dd0d;};var polly=require('./polly');var lex=require(_0xf565('0x0'));module[_0xf565('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 2cec545..841e225 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bde=['exports'];(function(_0x166e88,_0x53d48c){var _0x2973f9=function(_0x344e52){while(--_0x344e52){_0x166e88['push'](_0x166e88['shift']());}};_0x2973f9(++_0x53d48c);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4c986c,_0x4546b5){_0x4c986c=_0x4c986c-0x0;var _0x2b7c2b=_0x9bde[_0x4c986c];return _0x2b7c2b;};'use strict';var lex=require('./lib/api');module[_0xe9bd('0x0')]=function(_0x4defda,_0xc79e0b,_0x4c63ca,_0x51786f,_0x3005aa,_0x131f6a){return lex(_0x4defda,_0xc79e0b,_0x4c63ca,_0x51786f,_0x3005aa,_0x131f6a);}; \ No newline at end of file +var _0x9bde=['exports'];(function(_0x37a0b5,_0x557178){var _0x4804d2=function(_0x4463d4){while(--_0x4463d4){_0x37a0b5['push'](_0x37a0b5['shift']());}};_0x4804d2(++_0x557178);}(_0x9bde,0xe1));var _0xe9bd=function(_0x5178c5,_0x298be4){_0x5178c5=_0x5178c5-0x0;var _0x12a84b=_0x9bde[_0x5178c5];return _0x12a84b;};'use strict';var lex=require('./lib/api');module[_0xe9bd('0x0')]=function(_0x4defda,_0xc79e0b,_0x4c63ca,_0x51786f,_0x3005aa,_0x131f6a){return lex(_0x4defda,_0xc79e0b,_0x4c63ca,_0x51786f,_0x3005aa,_0x131f6a);}; \ 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 8e8b42d..ccb2f82 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(_0x4a0f6f,_0x36da54){var _0xc45eaf=function(_0x5b2fb8){while(--_0x5b2fb8){_0x4a0f6f['push'](_0x4a0f6f['shift']());}};_0xc45eaf(++_0x36da54);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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(_0x15a41c,_0x44ea88){var _0x41752f=function(_0x1b7e99){while(--_0x1b7e99){_0x15a41c['push'](_0x15a41c['shift']());}};_0x41752f(++_0x44ea88);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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 9869f6d..610420d 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 _0xa2cf=['exports','./lib/api'];(function(_0x7d62cb,_0x7622c){var _0x3a6266=function(_0x1cc5fa){while(--_0x1cc5fa){_0x7d62cb['push'](_0x7d62cb['shift']());}};_0x3a6266(++_0x7622c);}(_0xa2cf,0x1b7));var _0xfa2c=function(_0x24c341,_0x45d908){_0x24c341=_0x24c341-0x0;var _0x12c2ee=_0xa2cf[_0x24c341];return _0x12c2ee;};'use strict';var polly=require(_0xfa2c('0x0'));module[_0xfa2c('0x1')]=function(_0xc7c96f,_0x2d84a8,_0xd04123,_0x52e52f,_0x40261b,_0x4f2761,_0x125b59){return polly(_0xc7c96f,_0x2d84a8,_0xd04123,_0x52e52f,_0x40261b,_0x4f2761,_0x125b59);}; \ No newline at end of file +var _0x0140=['exports'];(function(_0x459778,_0x55f772){var _0x516076=function(_0xc82acd){while(--_0xc82acd){_0x459778['push'](_0x459778['shift']());}};_0x516076(++_0x55f772);}(_0x0140,0x195));var _0x0014=function(_0x53abe5,_0x33a9e5){_0x53abe5=_0x53abe5-0x0;var _0xc1c37e=_0x0140[_0x53abe5];return _0xc1c37e;};'use strict';var polly=require('./lib/api');module[_0x0014('0x0')]=function(_0x2ce2d8,_0xb60f98,_0x8bf5e9,_0x240446,_0x2fca09,_0x4e0eb2,_0xbb1c85){return polly(_0x2ce2d8,_0xb60f98,_0x8bf5e9,_0x240446,_0x2fca09,_0x4e0eb2,_0xbb1c85);}; \ 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 5f0995c..fa89238 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 _0x8395=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','mp3','path','bluebird','aws-sdk','synthesizeSpeech','writeFile','AudioStream'];(function(_0x30c794,_0xda57ee){var _0x38c2fd=function(_0x2ffacb){while(--_0x2ffacb){_0x30c794['push'](_0x30c794['shift']());}};_0x38c2fd(++_0xda57ee);}(_0x8395,0x10d));var _0x5839=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x8395[_0x4e1d03];return _0x362d4b;};'use strict';var fs=require('fs');var path=require(_0x5839('0x0'));var BPromise=require(_0x5839('0x1'));var rs=require('randomstring');var AWS=require(_0x5839('0x2'));function pollyResult(_0x4ed613,_0x547178,_0x485747){return new BPromise(function(_0x4ccf25,_0x346b0f){_0x4ed613[_0x5839('0x3')](_0x547178,function(_0xee575a,_0xb533b4){if(_0xee575a){_0x346b0f(_0xee575a);}else if(_0xb533b4){if(_0xb533b4['AudioStream']instanceof Buffer){fs[_0x5839('0x4')](_0x485747,_0xb533b4[_0x5839('0x5')],function(_0x43883c){if(_0x43883c){_0x346b0f(_0x43883c);}else{_0x4ccf25();}});}else{_0x346b0f(new Error(_0x5839('0x6')));}}else{_0x346b0f(new Error(_0x5839('0x7')));}});});}module[_0x5839('0x8')]=function(_0x31987e,_0x464f0a,_0x57d9c1,_0x36b87f,_0x46d148,_0x5b7bc6,_0x356f41){var _0x401f21=new AWS['Polly']({'accessKeyId':_0x31987e,'secretAccessKey':_0x464f0a,'region':_0x57d9c1});var _0x1c5de3={'Text':_0x46d148,'TextType':_0x5b7bc6||_0x5839('0x9'),'OutputFormat':_0x5839('0xa'),'VoiceId':_0x36b87f};return pollyResult(_0x401f21,_0x1c5de3,_0x356f41);}; \ No newline at end of file +var _0x09e3=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','randomstring','synthesizeSpeech','AudioStream','writeFile'];(function(_0x1b199f,_0x5adb87){var _0x37fd5a=function(_0x7ef447){while(--_0x7ef447){_0x1b199f['push'](_0x1b199f['shift']());}};_0x37fd5a(++_0x5adb87);}(_0x09e3,0x188));var _0x309e=function(_0x145dea,_0x5bad5f){_0x145dea=_0x145dea-0x0;var _0x30f0f4=_0x09e3[_0x145dea];return _0x30f0f4;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require('bluebird');var rs=require(_0x309e('0x0'));var AWS=require('aws-sdk');function pollyResult(_0x55e6ed,_0x44bc31,_0x1a7488){return new BPromise(function(_0x582cd3,_0x49a97d){_0x55e6ed[_0x309e('0x1')](_0x44bc31,function(_0x572984,_0x59333d){if(_0x572984){_0x49a97d(_0x572984);}else if(_0x59333d){if(_0x59333d[_0x309e('0x2')]instanceof Buffer){fs[_0x309e('0x3')](_0x1a7488,_0x59333d[_0x309e('0x2')],function(_0x44a68b){if(_0x44a68b){_0x49a97d(_0x44a68b);}else{_0x582cd3();}});}else{_0x49a97d(new Error(_0x309e('0x4')));}}else{_0x49a97d(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x309e('0x5')]=function(_0x49bcf5,_0x28893f,_0x2fb562,_0x4af4df,_0x51f314,_0x45a0d5,_0x46eb86){var _0x1fe923=new AWS[(_0x309e('0x6'))]({'accessKeyId':_0x49bcf5,'secretAccessKey':_0x28893f,'region':_0x2fb562});var _0x3589f2={'Text':_0x51f314,'TextType':_0x45a0d5||_0x309e('0x7'),'OutputFormat':_0x309e('0x8'),'VoiceId':_0x4af4df};return pollyResult(_0x1fe923,_0x3589f2,_0x46eb86);}; \ 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 6cd2193..b3f025b 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 _0xc079=['./lib/api','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xc079,0x1d4));var _0x9c07=function(_0x536cf0,_0x4f32e1){_0x536cf0=_0x536cf0-0x0;var _0x4073e8=_0xc079[_0x536cf0];return _0x4073e8;};'use strict';var asr=require(_0x9c07('0x0'));module[_0x9c07('0x1')]=function(_0x5ea744,_0x4b06de,_0x28d9d7,_0x173d6a){return asr(_0x5ea744,_0x4b06de,_0x28d9d7);}; \ No newline at end of file +var _0x0623=['./lib/api','exports'];(function(_0x1d7037,_0x57dd95){var _0x4d6568=function(_0x5c64c5){while(--_0x5c64c5){_0x1d7037['push'](_0x1d7037['shift']());}};_0x4d6568(++_0x57dd95);}(_0x0623,0x19e));var _0x3062=function(_0x97ded9,_0x4043e0){_0x97ded9=_0x97ded9-0x0;var _0x1cbaf6=_0x0623[_0x97ded9];return _0x1cbaf6;};'use strict';var asr=require(_0x3062('0x0'));module[_0x3062('0x1')]=function(_0x504ba7,_0x68ce2e,_0x355708,_0x325540){return asr(_0x504ba7,_0x68ce2e,_0x355708);}; \ 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 483335d..12891da 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 _0x20ce=['string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com'];(function(_0x564edb,_0x5d77dc){var _0x482482=function(_0x45017d){while(--_0x45017d){_0x564edb['push'](_0x564edb['shift']());}};_0x482482(++_0x5d77dc);}(_0x20ce,0x10d));var _0xe20c=function(_0x5e5430,_0x39b452){_0x5e5430=_0x5e5430-0x0;var _0x2db3a7=_0x20ce[_0x5e5430];return _0x2db3a7;};'use strict';var url=require(_0xe20c('0x0'));var BPromise=require(_0xe20c('0x1'));var fs=require('fs');var host=_0xe20c('0x2');module['exports']=function(_0x377a74,_0x34b536,_0x213486){return new BPromise(function(_0x26479b,_0x7e5160){var _0x23f743;if(typeof _0x377a74!==_0xe20c('0x3')||_0x377a74[_0xe20c('0x4')]===0x0){return _0x7e5160(_0xe20c('0x5'));}if(typeof _0x34b536!==_0xe20c('0x3')||_0x34b536[_0xe20c('0x4')]===0x0){return _0x7e5160(_0xe20c('0x6'));}if(typeof _0x213486!==_0xe20c('0x7')&&(typeof _0x213486!==_0xe20c('0x3')||_0x213486[_0xe20c('0x4')]===0x0)){return _0x7e5160(_0xe20c('0x8'));}try{_0x23f743=fs[_0xe20c('0x9')](_0x377a74)[_0xe20c('0xa')](_0xe20c('0xb'));}catch(_0x16aaaa){return _0x7e5160(_0x16aaaa);}return _0x26479b({'method':_0xe20c('0xc'),'uri':host+_0xe20c('0xd')+_0x34b536,'body':{'config':{'encoding':_0xe20c('0xe'),'sampleRateHertz':_0xe20c('0xf'),'languageCode':_0x213486},'audio':{'content':_0x23f743}},'json':!![]});});}; \ No newline at end of file +var _0x765e=['toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync'];(function(_0x65c597,_0x39e7e0){var _0x1ec368=function(_0x42efb8){while(--_0x42efb8){_0x65c597['push'](_0x65c597['shift']());}};_0x1ec368(++_0x39e7e0);}(_0x765e,0x131));var _0xe765=function(_0x423ec5,_0x113ea8){_0x423ec5=_0x423ec5-0x0;var _0x3b142a=_0x765e[_0x423ec5];return _0x3b142a;};'use strict';var url=require(_0xe765('0x0'));var BPromise=require(_0xe765('0x1'));var fs=require('fs');var host=_0xe765('0x2');module[_0xe765('0x3')]=function(_0x375719,_0x5edaf8,_0x25f437){return new BPromise(function(_0x38d6d2,_0x30703f){var _0xd2e232;if(typeof _0x375719!==_0xe765('0x4')||_0x375719[_0xe765('0x5')]===0x0){return _0x30703f(_0xe765('0x6'));}if(typeof _0x5edaf8!==_0xe765('0x4')||_0x5edaf8[_0xe765('0x5')]===0x0){return _0x30703f('key\x20should\x20be\x20a\x20string');}if(typeof _0x25f437!==_0xe765('0x7')&&(typeof _0x25f437!==_0xe765('0x4')||_0x25f437[_0xe765('0x5')]===0x0)){return _0x30703f(_0xe765('0x8'));}try{_0xd2e232=fs[_0xe765('0x9')](_0x375719)[_0xe765('0xa')](_0xe765('0xb'));}catch(_0x53b110){return _0x30703f(_0x53b110);}return _0x38d6d2({'method':_0xe765('0xc'),'uri':host+_0xe765('0xd')+_0x5edaf8,'body':{'config':{'encoding':_0xe765('0xe'),'sampleRateHertz':'8000','languageCode':_0x25f437},'audio':{'content':_0xd2e232}},'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 02d1eb7..7ef4b0e 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 _0x584d=['./asr','exports'];(function(_0x3a42d9,_0x481189){var _0x5d1fef=function(_0x32e455){while(--_0x32e455){_0x3a42d9['push'](_0x3a42d9['shift']());}};_0x5d1fef(++_0x481189);}(_0x584d,0xe6));var _0xd584=function(_0x3e36d4,_0x3bfe44){_0x3e36d4=_0x3e36d4-0x0;var _0x46e2c5=_0x584d[_0x3e36d4];return _0x46e2c5;};var asr=require(_0xd584('0x0'));module[_0xd584('0x1')]={'asr':asr}; \ No newline at end of file +var _0x4f54=['./asr','exports'];(function(_0x1ef207,_0x5b52fa){var _0x47ee00=function(_0x5469fd){while(--_0x5469fd){_0x1ef207['push'](_0x1ef207['shift']());}};_0x47ee00(++_0x5b52fa);}(_0x4f54,0x162));var _0x44f5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4f54[_0x3dd15e];return _0x231fd0;};var asr=require(_0x44f5('0x0'));module[_0x44f5('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index f31e5ab..c03ebce 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 _0xeba2=['allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','isFallback','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%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','dirName','apiai-promise','bluebird','https','md5','querystring','request-promise','randomstring','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','protocol','https:','host','path','WHAT_EVER','get','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','request\x20to\x20','createWriteStream','finish','close','data','end','transcode','wav','error\x20convert','info','finish\x20to\x20convert','resolve','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','readFileSync','https://texttospeech.googleapis.com/v1/','?key=','voice','audioConfig','MP3','text:synthesize','POST','.mp3','from','audioContent','writeFile','unlink','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','stringify','jQ1olc','slice','text\x20length\x20limit\x20reached','lang\x20\x22','goggleTTS\x20path','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','message','googleDialogflow','result','source','resolvedQuery','action','score','status','code','endConversation','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult'];(function(_0x5ae288,_0x12f312){var _0x2ff4cc=function(_0x43c51e){while(--_0x43c51e){_0x5ae288['push'](_0x5ae288['shift']());}};_0x2ff4cc(++_0x12f312);}(_0xeba2,0x122));var _0x2eba=function(_0x454bd3,_0x3e4d94){_0x454bd3=_0x454bd3-0x0;var _0x4eb066=_0xeba2[_0x454bd3];return _0x4eb066;};'use strict';var apiai=require(_0x2eba('0x0'));var BPromise=require(_0x2eba('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require('http');var https=require(_0x2eba('0x2'));var md5=require(_0x2eba('0x3'));var path=require('path');var querystring=require(_0x2eba('0x4'));var rp=require(_0x2eba('0x5'));var rs=require(_0x2eba('0x6'));var sox=require('sox');var tts=require('google-tts-api');var urlParse=require(_0x2eba('0x7'))[_0x2eba('0x8')];var util=require(_0x2eba('0x9'));var aws=require(_0x2eba('0xa'));var google=require(_0x2eba('0xb'));var sestek=require(_0x2eba('0xc'));var tilde=require(_0x2eba('0xd'));var logger=require(_0x2eba('0xe'))(_0x2eba('0xf'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0xf33fe,_0x1fdff7){return new BPromise(function(_0x1c153c,_0x5d1254){var _0x4aabac=urlParse(_0xf33fe);var _0x29d30d=_0x4aabac[_0x2eba('0x10')]===_0x2eba('0x11')?https:http;var _0x516f2d={'host':_0x4aabac[_0x2eba('0x12')],'path':_0x4aabac[_0x2eba('0x13')],'headers':{'user-agent':_0x2eba('0x14')}};_0x29d30d[_0x2eba('0x15')](_0x516f2d,function(_0x29c940){if(_0x29c940[_0x2eba('0x16')]!==0xc8){logger[_0x2eba('0x17')]('request\x20to\x20'+_0xf33fe+_0x2eba('0x18')+_0x29c940[_0x2eba('0x16')]+'\x20('+_0x29c940[_0x2eba('0x19')]+')');_0x5d1254(new Error(_0x2eba('0x1a')+_0xf33fe+_0x2eba('0x18')+_0x29c940[_0x2eba('0x16')]+'\x20('+_0x29c940[_0x2eba('0x19')]+')'));return;}var _0x473515=fs[_0x2eba('0x1b')](_0x1fdff7);_0x473515['on'](_0x2eba('0x1c'),function(){logger['info']('finish\x20download\x20file');_0x473515[_0x2eba('0x1d')](_0x1c153c);});_0x473515['on'](_0x2eba('0x17'),function(_0x319752){fs['unlink'](_0x1fdff7);logger['error']('download\x20error',_0x319752);_0x5d1254(_0x319752);});_0x29c940['pipe'](_0x473515);})['on']('error',function(_0x13c36e){logger[_0x2eba('0x17')](_0x13c36e);_0x5d1254(_0x13c36e);})['end']();});}function uploadFile(_0x27c1ad){return new BPromise(function(_0x29cb86,_0x14ee87){var _0x3ea830=urlParse(_0x27c1ad);var _0x330b66=_0x3ea830[_0x2eba('0x10')]==='https:'?https:http;var _0x575267={'host':_0x3ea830['host'],'path':_0x3ea830[_0x2eba('0x13')],'headers':{'user-agent':_0x2eba('0x14')}};_0x330b66[_0x2eba('0x15')](_0x575267,function(_0x2f0b79){if(_0x2f0b79['statusCode']!==0xc8){_0x14ee87(new Error('request\x20to\x20'+_0x27c1ad+_0x2eba('0x18')+_0x2f0b79[_0x2eba('0x16')]+'\x20('+_0x2f0b79[_0x2eba('0x19')]+')'));return;}var _0x227c06='';_0x2f0b79['on'](_0x2eba('0x1e'),function(_0x4a77fb){_0x227c06+=_0x4a77fb;});_0x2f0b79['on'](_0x2eba('0x1f'),function(){_0x29cb86(_0x227c06);});})['on'](_0x2eba('0x17'),function(_0xae3492){_0x14ee87(_0xae3492);})[_0x2eba('0x1f')]();});}function convertFile(_0x4ba133,_0x46f58d){return new BPromise(function(_0x48324d,_0x39880c){var _0x10e530=sox[_0x2eba('0x20')](_0x4ba133,_0x46f58d,{'sampleRate':0x1f40,'format':_0x2eba('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x10e530['on']('error',function(_0x56cfcc){logger[_0x2eba('0x17')](_0x2eba('0x22'),_0x56cfcc);_0x39880c(_0x56cfcc);});_0x10e530['on'](_0x2eba('0x1f'),function(){logger[_0x2eba('0x23')](_0x2eba('0x24'));_0x48324d();});_0x10e530['start']();});}function base64Decode(_0x1c2172,_0x4253e7){var _0x2dcc18=path[_0x2eba('0x25')](__dirname,_0x2eba('0x26'),rs[_0x2eba('0x27')](0x4)+_0x2eba('0x28'));fs[_0x2eba('0x29')](_0x2dcc18,_0x1c2172,_0x2eba('0x2a'));return convertFile(_0x2dcc18,_0x4253e7)[_0x2eba('0x2b')](function(){try{fs['unlink'](_0x2dcc18);fs[_0x2eba('0x2c')](_0x4253e7,_0x2eba('0x2d'));}catch(_0x4a9cc1){logger[_0x2eba('0x17')](_0x4a9cc1);}return _0x4253e7['split']('.')[0x0];});}function base64Encode(_0x537020){var _0x9f9b7b=fs[_0x2eba('0x2e')](_0x537020);return new Buffer(_0x9f9b7b)['toString'](_0x2eba('0x2a'));}exports['googleCloudTTS']=function(_0x40f250,_0x134f39,_0x143860,_0x5515b9,_0x264f3b,_0x363be2){var _0x44b261,_0x56da86;var _0x1b1b4e=_0x2eba('0x2f');var _0x3e4440=_0x2eba('0x30')+_0x40f250;var _0x575dbd={};if(_0x134f39==='ssml'){_0x575dbd['input']={'ssml':_0x143860};}else{_0x575dbd['input']={'text':_0x143860};};_0x575dbd[_0x2eba('0x31')]={'languageCode':_0x5515b9,'ssmlGender':_0x264f3b};_0x575dbd[_0x2eba('0x32')]={'audioEncoding':_0x2eba('0x33'),'sampleRateHertz':0x1f40};var _0xc4c894={'url':_0x1b1b4e+_0x2eba('0x34')+_0x3e4440,'method':_0x2eba('0x35'),'json':!![],'body':_0x575dbd};return rp(_0xc4c894)[_0x2eba('0x2b')](function(_0x8acad0){return new BPromise(function(_0xc1e97f,_0x3a959e){_0x44b261=path[_0x2eba('0x25')](__dirname,_0x2eba('0x26'),rs[_0x2eba('0x27')](0x4)+_0x2eba('0x36'));var _0x354bcd=Buffer[_0x2eba('0x37')](_0x8acad0[_0x2eba('0x38')],_0x2eba('0x2a'));return fs[_0x2eba('0x39')](_0x44b261,_0x354bcd,function(_0x5f50df){_0x3a959e(_0x5f50df);},function(_0x6ac160){fs[_0x2eba('0x2c')](_0x44b261,_0x2eba('0x2d'));_0xc1e97f(_0x6ac160);});});})[_0x2eba('0x2b')](function(_0x5f39d2){_0x56da86=path[_0x2eba('0x25')](__dirname,_0x2eba('0x26'),rs[_0x2eba('0x27')](0x4)+_0x2eba('0x28'));return convertFile(_0x44b261,_0x56da86);})[_0x2eba('0x2b')](function(){try{fs[_0x2eba('0x3a')](_0x44b261);fs[_0x2eba('0x2c')](_0x56da86,'777');}catch(_0x50d758){logger[_0x2eba('0x17')](_0x50d758);}logger[_0x2eba('0x23')]('googleCloudTTS\x20path',_0x56da86[_0x2eba('0x3b')]('.')[0x0]);return _0x56da86[_0x2eba('0x3b')]('.')[0x0];});};exports[_0x2eba('0x3c')]=function(_0x341092,_0x5cf275){var _0x1bed85=_0x2eba('0x3d');var _0x4c2999,_0x3196e5;var _0x2881b4;var _0x4f48f9={'encoding':_0x2eba('0x3e'),'method':_0x2eba('0x35'),'timeout':0x2710,'url':_0x1bed85,'headers':{'Content-Type':_0x2eba('0x3f')},'body':'f.req='+encodeURIComponent(JSON[_0x2eba('0x40')]([[[_0x2eba('0x41'),JSON[_0x2eba('0x40')]([_0x341092,_0x5cf275||'en',![],'null']),null,'generic']]]))};return rp(_0x4f48f9)[_0x2eba('0x2b')](function(_0x27d8bd){try{_0x2881b4=eval(_0x27d8bd[_0x2eba('0x42')](0x5))[0x0][0x2];}catch(_0x90d844){throw new Error('parse\x20response\x20failed:\x0a'+_0x27d8bd[_0x2eba('0x1e')]);}if(!_0x2881b4){if(_0x341092['length']>0xc8){throw new Error(_0x2eba('0x43'));}else{throw new Error(_0x2eba('0x44')+_0x5cf275+'\x22\x20might\x20not\x20exist');}}try{_0x2881b4=eval(_0x2881b4)[0x0];}catch(_0xcc9940){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x2eba('0x1e')]);}const _0x18c09f=_0x2881b4;_0x4c2999=path[_0x2eba('0x25')](__dirname,_0x2eba('0x26'),rs['generate'](0x4)+_0x2eba('0x36'));fs[_0x2eba('0x29')](_0x4c2999,_0x2881b4,{'encoding':_0x2eba('0x2a')});_0x3196e5=path['resolve'](__dirname,_0x2eba('0x26'),rs[_0x2eba('0x27')](0x4)+'.wav');return convertFile(_0x4c2999,_0x3196e5);})['then'](function(){try{fs[_0x2eba('0x3a')](_0x4c2999);fs[_0x2eba('0x2c')](_0x3196e5,_0x2eba('0x2d'));}catch(_0xa035f1){logger['error'](_0xa035f1);}logger[_0x2eba('0x23')](_0x2eba('0x45'),_0x3196e5[_0x2eba('0x3b')]('.')[0x0]);return _0x3196e5[_0x2eba('0x3b')]('.')[0x0];});};exports['googleASR']=function(_0x54fb33,_0x3e9f94,_0x463c6e){return google[_0x2eba('0x46')](_0x54fb33,_0x3e9f94,_0x463c6e)[_0x2eba('0x2b')](function(_0x38bcf9){logger[_0x2eba('0x23')](_0x38bcf9['uri']);return rp(_0x38bcf9);})[_0x2eba('0x2b')](function(_0x27d4a4){var _0x5479f1='';var _0x2b00de=0x0;try{fs[_0x2eba('0x3a')](_0x54fb33);}catch(_0x46e4f2){logger[_0x2eba('0x17')](_0x46e4f2);}if(_0x27d4a4&&_0x27d4a4[_0x2eba('0x47')]){_0x5479f1=_0x27d4a4[_0x2eba('0x47')][_0x2eba('0x48')](function(_0x1e03a5){return _0x1e03a5&&_0x1e03a5[_0x2eba('0x49')][0x0]&&_0x1e03a5[_0x2eba('0x49')][0x0][_0x2eba('0x4a')]?_0x1e03a5[_0x2eba('0x49')][0x0][_0x2eba('0x4a')]:'';})[_0x2eba('0x4b')]('\x0a');_0x2b00de=_0x27d4a4[_0x2eba('0x47')]['map'](function(_0x6a38cb){return _0x6a38cb&&_0x6a38cb[_0x2eba('0x49')][0x0]&&_0x6a38cb[_0x2eba('0x49')][0x0][_0x2eba('0x4c')]?_0x6a38cb[_0x2eba('0x49')][0x0][_0x2eba('0x4c')]:0x0;})[_0x2eba('0x4b')]('\x0a');}logger[_0x2eba('0x23')](_0x2eba('0x4d'),_0x5479f1);logger[_0x2eba('0x23')]('googleASR\x20confidence',_0x2b00de);return{'transcript':_0x5479f1,'confidence':_0x2b00de};})[_0x2eba('0x4e')](function(_0x46c6e2){logger['error'](_0x2eba('0x4f'),_0x46c6e2[_0x2eba('0x16')],_0x46c6e2[_0x2eba('0x50')],_0x46c6e2[_0x2eba('0x51')]);});};exports[_0x2eba('0x52')]=function(_0x400f2e,_0x1318ba,_0x4deea9,_0x27e117){var _0x5051f6=apiai(_0x1318ba,{'language':_0x27e117||'en'});return _0x5051f6['textRequest'](_0x4deea9,{'sessionId':md5(_0x400f2e)})[_0x2eba('0x2b')](function(_0x40739e){logger[_0x2eba('0x23')](JSON[_0x2eba('0x40')](_0x40739e));return{'source':_0x40739e[_0x2eba('0x53')][_0x2eba('0x54')],'resolvedQuery':_0x40739e[_0x2eba('0x53')][_0x2eba('0x55')],'action':_0x40739e['result'][_0x2eba('0x56')],'actionIncomplete':_0x40739e[_0x2eba('0x53')]['actionIncomplete'],'speech':_0x40739e['result']['fulfillment']['speech'],'score':_0x40739e[_0x2eba('0x53')][_0x2eba('0x57')],'statusCode':_0x40739e[_0x2eba('0x58')][_0x2eba('0x59')],'endConversation':_0x40739e[_0x2eba('0x53')]['metadata'][_0x2eba('0x5a')]||![],'isFallbackIntent':_0x40739e[_0x2eba('0x53')][_0x2eba('0x5b')][_0x2eba('0x5c')]};});};exports[_0x2eba('0x5d')]=function(_0x2c3386,_0x5b9285,_0x2bb961,_0x3c89b4,_0x28dad1,_0x1359cf){var _0x485a78=_0x3c89b4[_0x2eba('0x5e')](/\\n/g,'\x0a');var _0x2a897e={'credentials':{'private_key':_0x485a78,'client_email':_0x2bb961}};var _0x37f4c3=new dialogflow[(_0x2eba('0x5f'))](_0x2a897e);var _0x442d9f=_0x37f4c3['sessionPath'](_0x5b9285,md5(_0x2c3386));var _0x31fb8d={'session':_0x442d9f,'queryInput':{'text':{'text':_0x28dad1,'languageCode':_0x1359cf}}};return _0x37f4c3[_0x2eba('0x60')](_0x31fb8d)[_0x2eba('0x2b')](function(_0x5cae51){if(_0x5cae51&&_0x5cae51[_0x2eba('0x61')]){logger[_0x2eba('0x23')](_0x2eba('0x62'),JSON[_0x2eba('0x40')](_0x5cae51));var _0x3b99b7=_0x5cae51[0x0];if(_0x3b99b7){var _0x4c12f9={'action':_0x3b99b7[_0x2eba('0x63')][_0x2eba('0x56')],'allRequiredParamsPresent':_0x3b99b7['queryResult'][_0x2eba('0x64')],'endConversation':_0x3b99b7[_0x2eba('0x63')][_0x2eba('0x65')]&&_0x3b99b7[_0x2eba('0x63')][_0x2eba('0x65')][_0x2eba('0x66')]?_0x3b99b7[_0x2eba('0x63')][_0x2eba('0x65')]['fields']['end_conversation'][_0x2eba('0x67')]:![],'fulfillmentText':_0x3b99b7[_0x2eba('0x63')][_0x2eba('0x68')],'intentName':_0x3b99b7[_0x2eba('0x63')][_0x2eba('0x69')][_0x2eba('0x50')],'intentDisplayName':_0x3b99b7[_0x2eba('0x63')][_0x2eba('0x69')]['displayName'],'isFallbackIntent':_0x3b99b7[_0x2eba('0x63')][_0x2eba('0x69')][_0x2eba('0x6a')],'languageCode':_0x3b99b7[_0x2eba('0x63')]['languageCode'],'queryText':_0x3b99b7[_0x2eba('0x63')][_0x2eba('0x6b')],'responseId':_0x3b99b7[_0x2eba('0x6c')],'score':_0x3b99b7['queryResult'][_0x2eba('0x6d')],'speech':_0x3b99b7['queryResult']['fulfillmentText'],'providerResponse':JSON[_0x2eba('0x40')](_0x5cae51)};return _0x4c12f9;}}});};exports[_0x2eba('0x6e')]=function(_0x5993d3,_0x2e7ea6,_0x295c9c,_0x55fd44){return tilde['asr'](_0x5993d3,_0x2e7ea6,_0x295c9c,_0x55fd44)[_0x2eba('0x2b')](function(_0x400166){try{fs[_0x2eba('0x3a')](_0x5993d3);}catch(_0x511286){logger[_0x2eba('0x17')](_0x511286);}logger['info']('Tilde\x20ASR\x20transcription',_0x400166[_0x2eba('0x4a')]);logger[_0x2eba('0x23')](_0x2eba('0x6f'),_0x400166[_0x2eba('0x4c')]);return _0x400166;});};exports[_0x2eba('0x70')]=function(_0x469e8c,_0x1e8249,_0x35147f,_0x1b1640,_0x5024a8,_0x3c142e){var _0x4e8514=path[_0x2eba('0x25')](__dirname,_0x2eba('0x26'),rs[_0x2eba('0x27')](0x4)+_0x2eba('0x36'));var _0x49e308;return aws['polly'](_0x469e8c,_0x1e8249,_0x35147f,_0x1b1640,_0x5024a8,_0x3c142e,_0x4e8514)[_0x2eba('0x2b')](function(){_0x49e308=path[_0x2eba('0x25')](__dirname,_0x2eba('0x26'),rs[_0x2eba('0x27')](0x4)+_0x2eba('0x28'));return convertFile(_0x4e8514,_0x49e308);})[_0x2eba('0x2b')](function(){try{fs[_0x2eba('0x3a')](_0x4e8514);fs[_0x2eba('0x2c')](_0x49e308,_0x2eba('0x2d'));}catch(_0x125164){logger[_0x2eba('0x17')](_0x125164);}return _0x49e308[_0x2eba('0x3b')]('.')[0x0];});};exports[_0x2eba('0x71')]=function(_0x26fdb8,_0x2e111b,_0xdba063,_0x523ea8,_0x7fed81,_0x42b94c){return aws[_0x2eba('0x72')](_0x26fdb8,_0x2e111b,_0xdba063,_0x523ea8,_0x7fed81,_0x42b94c)[_0x2eba('0x2b')](function(_0xf7b118){logger[_0x2eba('0x23')](JSON[_0x2eba('0x40')](_0xf7b118));return _0xf7b118;});};exports['ispeechTTS']=function(_0x9a74fa,_0x2427bf,_0x10a5ee,_0xd8008b){var _0x162d9b=util['format'](_0x2eba('0x73'),ISPEECH_API,_0x9a74fa,encodeURIComponent(_0x2427bf),_0x10a5ee,_0xd8008b);var _0x13833e=path[_0x2eba('0x25')](__dirname,_0x2eba('0x26'),rs[_0x2eba('0x27')](0x4)+_0x2eba('0x36'));var _0x3b7fc0;return downloadFile(_0x162d9b,_0x13833e)[_0x2eba('0x2b')](function(){_0x3b7fc0=path['resolve'](__dirname,_0x2eba('0x26'),rs[_0x2eba('0x27')](0x4)+'.wav');return convertFile(_0x13833e,_0x3b7fc0);})['then'](function(){try{fs[_0x2eba('0x3a')](_0x13833e);fs[_0x2eba('0x2c')](_0x3b7fc0,_0x2eba('0x2d'));}catch(_0x2cd64d){logger[_0x2eba('0x17')](_0x2cd64d);}return _0x3b7fc0[_0x2eba('0x3b')]('.')[0x0];});};exports[_0x2eba('0x74')]=function(_0x3d42dd,_0x8c0a57,_0x5536a8,_0x53d65a){var _0x129968=util[_0x2eba('0x75')](_0x2eba('0x76'),ISPEECH_API,_0x8c0a57,_0x5536a8,base64Encode(_0x3d42dd),_0x53d65a?util['format'](_0x2eba('0x77'),encodeURIComponent(_0x53d65a)):_0x2eba('0x78'));return uploadFile(_0x129968)['then'](function(_0x28903e){return querystring[_0x2eba('0x8')](_0x28903e);});};exports[_0x2eba('0x79')]=function(_0x2f8b96,_0x3ae136){return sestek[_0x2eba('0x7a')](_0x2f8b96,_0x3ae136)[_0x2eba('0x2b')](function(_0x508743){logger['info'](JSON[_0x2eba('0x40')](_0x508743));var _0x24de63={'speech':_0x508743[_0x2eba('0x7b')],'action':_0x508743[_0x2eba('0x7c')]?_0x508743['channelData'][_0x2eba('0x7d')]:undefined,'actiondata':_0x508743[_0x2eba('0x7c')]?_0x508743[_0x2eba('0x7c')][_0x2eba('0x7e')]:undefined};if(_0x508743[_0x2eba('0x7c')]&&_0x508743[_0x2eba('0x7c')]['AudioFromTts']){return base64Decode(_0x508743[_0x2eba('0x7c')][_0x2eba('0x7f')]['Data'],path['resolve'](__dirname,_0x2eba('0x26'),rs[_0x2eba('0x27')](0x4)+_0x2eba('0x28')))['then'](function(_0x14361f){_0x24de63[_0x2eba('0x80')]=_0x14361f;return _0x24de63;});}return _0x24de63;});};exports[_0x2eba('0x81')]=function(){return __dirname;}; \ No newline at end of file +var _0xc24c=['.wav','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','lang\x20\x22','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','catch','name','googleDialogflow','textRequest','stringify','source','result','resolvedQuery','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','replace','SessionsClient','detectIntent','Dialogflow\x20V2\x20response:','allRequiredParamsPresent','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','languageCode','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20confidence','polly','lex','ispeechTTS','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','CustomActionData','AudioFromTts','Data','audiofile','apiai-promise','bluebird','http','https','md5','path','randomstring','sox','google-tts-api','url','parse','util','./aws','./google','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','host','WHAT_EVER','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','info','finish\x20download\x20file','close','error','unlink','pipe','end','protocol','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','generate','writeFileSync','base64','then','chmodSync','777','readFileSync','toString','https://texttospeech.googleapis.com/v1/','ssml','input','audioConfig','MP3','text:synthesize','POST','tmp','.mp3','writeFile'];(function(_0x3cc3b7,_0x385737){var _0x19c167=function(_0x54f4fc){while(--_0x54f4fc){_0x3cc3b7['push'](_0x3cc3b7['shift']());}};_0x19c167(++_0x385737);}(_0xc24c,0x1ce));var _0xcc24=function(_0x23736e,_0x526763){_0x23736e=_0x23736e-0x0;var _0x432c1e=_0xc24c[_0x23736e];return _0x432c1e;};'use strict';var apiai=require(_0xcc24('0x0'));var BPromise=require(_0xcc24('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0xcc24('0x2'));var https=require(_0xcc24('0x3'));var md5=require(_0xcc24('0x4'));var path=require(_0xcc24('0x5'));var querystring=require('querystring');var rp=require('request-promise');var rs=require(_0xcc24('0x6'));var sox=require(_0xcc24('0x7'));var tts=require(_0xcc24('0x8'));var urlParse=require(_0xcc24('0x9'))[_0xcc24('0xa')];var util=require(_0xcc24('0xb'));var aws=require(_0xcc24('0xc'));var google=require(_0xcc24('0xd'));var sestek=require(_0xcc24('0xe'));var tilde=require('./tilde');var logger=require(_0xcc24('0xf'))(_0xcc24('0x10'));var ISPEECH_API=_0xcc24('0x11');function downloadFile(_0x5f0a37,_0x25126d){return new BPromise(function(_0x25f250,_0x3e6801){var _0x5b9f27=urlParse(_0x5f0a37);var _0x275da1=_0x5b9f27['protocol']===_0xcc24('0x12')?https:http;var _0x406cb9={'host':_0x5b9f27[_0xcc24('0x13')],'path':_0x5b9f27[_0xcc24('0x5')],'headers':{'user-agent':_0xcc24('0x14')}};_0x275da1['get'](_0x406cb9,function(_0x526293){if(_0x526293['statusCode']!==0xc8){logger['error'](_0xcc24('0x15')+_0x5f0a37+_0xcc24('0x16')+_0x526293[_0xcc24('0x17')]+'\x20('+_0x526293['statusMessage']+')');_0x3e6801(new Error(_0xcc24('0x15')+_0x5f0a37+_0xcc24('0x16')+_0x526293['statusCode']+'\x20('+_0x526293[_0xcc24('0x18')]+')'));return;}var _0x26c4cc=fs['createWriteStream'](_0x25126d);_0x26c4cc['on']('finish',function(){logger[_0xcc24('0x19')](_0xcc24('0x1a'));_0x26c4cc[_0xcc24('0x1b')](_0x25f250);});_0x26c4cc['on'](_0xcc24('0x1c'),function(_0x211017){fs[_0xcc24('0x1d')](_0x25126d);logger[_0xcc24('0x1c')]('download\x20error',_0x211017);_0x3e6801(_0x211017);});_0x526293[_0xcc24('0x1e')](_0x26c4cc);})['on']('error',function(_0x1eb6e9){logger[_0xcc24('0x1c')](_0x1eb6e9);_0x3e6801(_0x1eb6e9);})[_0xcc24('0x1f')]();});}function uploadFile(_0x5ab046){return new BPromise(function(_0xaa2048,_0x2f7901){var _0x42e5be=urlParse(_0x5ab046);var _0x6d5013=_0x42e5be[_0xcc24('0x20')]===_0xcc24('0x12')?https:http;var _0x430201={'host':_0x42e5be[_0xcc24('0x13')],'path':_0x42e5be[_0xcc24('0x5')],'headers':{'user-agent':_0xcc24('0x14')}};_0x6d5013['get'](_0x430201,function(_0x36b5d2){if(_0x36b5d2['statusCode']!==0xc8){_0x2f7901(new Error('request\x20to\x20'+_0x5ab046+_0xcc24('0x16')+_0x36b5d2[_0xcc24('0x17')]+'\x20('+_0x36b5d2[_0xcc24('0x18')]+')'));return;}var _0x2717a0='';_0x36b5d2['on'](_0xcc24('0x21'),function(_0x3a4f87){_0x2717a0+=_0x3a4f87;});_0x36b5d2['on'](_0xcc24('0x1f'),function(){_0xaa2048(_0x2717a0);});})['on']('error',function(_0x1fb8b5){_0x2f7901(_0x1fb8b5);})['end']();});}function convertFile(_0x1f5b85,_0x393fba){return new BPromise(function(_0x422268,_0x5ad0a3){var _0x3d7863=sox[_0xcc24('0x22')](_0x1f5b85,_0x393fba,{'sampleRate':0x1f40,'format':_0xcc24('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3d7863['on'](_0xcc24('0x1c'),function(_0x4fb395){logger[_0xcc24('0x1c')](_0xcc24('0x24'),_0x4fb395);_0x5ad0a3(_0x4fb395);});_0x3d7863['on'](_0xcc24('0x1f'),function(){logger['info'](_0xcc24('0x25'));_0x422268();});_0x3d7863[_0xcc24('0x26')]();});}function base64Decode(_0x159196,_0x371fb0){var _0x3835e9=path[_0xcc24('0x27')](__dirname,'tmp',rs[_0xcc24('0x28')](0x4)+'.wav');fs[_0xcc24('0x29')](_0x3835e9,_0x159196,_0xcc24('0x2a'));return convertFile(_0x3835e9,_0x371fb0)[_0xcc24('0x2b')](function(){try{fs[_0xcc24('0x1d')](_0x3835e9);fs[_0xcc24('0x2c')](_0x371fb0,_0xcc24('0x2d'));}catch(_0x2b6f69){logger['error'](_0x2b6f69);}return _0x371fb0['split']('.')[0x0];});}function base64Encode(_0x58d57e){var _0x272f68=fs[_0xcc24('0x2e')](_0x58d57e);return new Buffer(_0x272f68)[_0xcc24('0x2f')](_0xcc24('0x2a'));}exports['googleCloudTTS']=function(_0x500a1a,_0x5bb4a4,_0xe6e2bd,_0x478053,_0x410310,_0x3596c3){var _0x568c80,_0x22195e;var _0x5ea0d8=_0xcc24('0x30');var _0x402fae='?key='+_0x500a1a;var _0x1f2e62={};if(_0x5bb4a4===_0xcc24('0x31')){_0x1f2e62[_0xcc24('0x32')]={'ssml':_0xe6e2bd};}else{_0x1f2e62[_0xcc24('0x32')]={'text':_0xe6e2bd};};_0x1f2e62['voice']={'languageCode':_0x478053,'ssmlGender':_0x410310};_0x1f2e62[_0xcc24('0x33')]={'audioEncoding':_0xcc24('0x34'),'sampleRateHertz':0x1f40};var _0x1d2e44={'url':_0x5ea0d8+_0xcc24('0x35')+_0x402fae,'method':_0xcc24('0x36'),'json':!![],'body':_0x1f2e62};return rp(_0x1d2e44)[_0xcc24('0x2b')](function(_0x9e189){return new BPromise(function(_0x4b5826,_0x44f0e8){_0x568c80=path[_0xcc24('0x27')](__dirname,_0xcc24('0x37'),rs[_0xcc24('0x28')](0x4)+_0xcc24('0x38'));var _0x134106=Buffer['from'](_0x9e189['audioContent'],_0xcc24('0x2a'));return fs[_0xcc24('0x39')](_0x568c80,_0x134106,function(_0x4be5d5){_0x44f0e8(_0x4be5d5);},function(_0x1955e0){fs[_0xcc24('0x2c')](_0x568c80,_0xcc24('0x2d'));_0x4b5826(_0x1955e0);});});})[_0xcc24('0x2b')](function(_0x45b2a0){_0x22195e=path[_0xcc24('0x27')](__dirname,_0xcc24('0x37'),rs[_0xcc24('0x28')](0x4)+_0xcc24('0x3a'));return convertFile(_0x568c80,_0x22195e);})[_0xcc24('0x2b')](function(){try{fs[_0xcc24('0x1d')](_0x568c80);fs[_0xcc24('0x2c')](_0x22195e,_0xcc24('0x2d'));}catch(_0x1d403e){logger[_0xcc24('0x1c')](_0x1d403e);}logger[_0xcc24('0x19')]('googleCloudTTS\x20path',_0x22195e[_0xcc24('0x3b')]('.')[0x0]);return _0x22195e[_0xcc24('0x3b')]('.')[0x0];});};exports[_0xcc24('0x3c')]=function(_0x5835ec,_0x5aba94){var _0x3b5b6d=_0xcc24('0x3d');var _0x29b9b5,_0x34a1b4;var _0x3eaaf8;var _0x47076c={'encoding':_0xcc24('0x3e'),'method':_0xcc24('0x36'),'timeout':0x2710,'url':_0x3b5b6d,'headers':{'Content-Type':_0xcc24('0x3f')},'body':_0xcc24('0x40')+encodeURIComponent(JSON['stringify']([[[_0xcc24('0x41'),JSON['stringify']([_0x5835ec,_0x5aba94||'en',![],_0xcc24('0x42')]),null,_0xcc24('0x43')]]]))};return rp(_0x47076c)[_0xcc24('0x2b')](function(_0x22dd9c){try{_0x3eaaf8=eval(_0x22dd9c[_0xcc24('0x44')](0x5))[0x0][0x2];}catch(_0x3b7351){throw new Error(_0xcc24('0x45')+_0x22dd9c[_0xcc24('0x21')]);}if(!_0x3eaaf8){if(_0x5835ec['length']>0xc8){throw new Error(_0xcc24('0x46'));}else{throw new Error(_0xcc24('0x47')+_0x5aba94+'\x22\x20might\x20not\x20exist');}}try{_0x3eaaf8=eval(_0x3eaaf8)[0x0];}catch(_0x49426e){throw new Error(_0xcc24('0x45')+res[_0xcc24('0x21')]);}const _0x47dc4f=_0x3eaaf8;_0x29b9b5=path[_0xcc24('0x27')](__dirname,_0xcc24('0x37'),rs[_0xcc24('0x28')](0x4)+_0xcc24('0x38'));fs[_0xcc24('0x29')](_0x29b9b5,_0x3eaaf8,{'encoding':'base64'});_0x34a1b4=path[_0xcc24('0x27')](__dirname,_0xcc24('0x37'),rs['generate'](0x4)+_0xcc24('0x3a'));return convertFile(_0x29b9b5,_0x34a1b4);})[_0xcc24('0x2b')](function(){try{fs[_0xcc24('0x1d')](_0x29b9b5);fs[_0xcc24('0x2c')](_0x34a1b4,_0xcc24('0x2d'));}catch(_0x4e43fc){logger[_0xcc24('0x1c')](_0x4e43fc);}logger[_0xcc24('0x19')]('goggleTTS\x20path',_0x34a1b4[_0xcc24('0x3b')]('.')[0x0]);return _0x34a1b4['split']('.')[0x0];});};exports[_0xcc24('0x48')]=function(_0x18f186,_0x4e8711,_0x3a1939){return google[_0xcc24('0x49')](_0x18f186,_0x4e8711,_0x3a1939)[_0xcc24('0x2b')](function(_0x680747){logger[_0xcc24('0x19')](_0x680747[_0xcc24('0x4a')]);return rp(_0x680747);})[_0xcc24('0x2b')](function(_0x48bca9){var _0x3454cd='';var _0x68f41c=0x0;try{fs[_0xcc24('0x1d')](_0x18f186);}catch(_0xb6bbb4){logger[_0xcc24('0x1c')](_0xb6bbb4);}if(_0x48bca9&&_0x48bca9[_0xcc24('0x4b')]){_0x3454cd=_0x48bca9['results'][_0xcc24('0x4c')](function(_0x50b6ba){return _0x50b6ba&&_0x50b6ba[_0xcc24('0x4d')][0x0]&&_0x50b6ba[_0xcc24('0x4d')][0x0][_0xcc24('0x4e')]?_0x50b6ba[_0xcc24('0x4d')][0x0][_0xcc24('0x4e')]:'';})[_0xcc24('0x4f')]('\x0a');_0x68f41c=_0x48bca9[_0xcc24('0x4b')]['map'](function(_0x17b80b){return _0x17b80b&&_0x17b80b[_0xcc24('0x4d')][0x0]&&_0x17b80b[_0xcc24('0x4d')][0x0]['confidence']?_0x17b80b[_0xcc24('0x4d')][0x0][_0xcc24('0x50')]:0x0;})[_0xcc24('0x4f')]('\x0a');}logger['info']('googleASR\x20transcription',_0x3454cd);logger[_0xcc24('0x19')]('googleASR\x20confidence',_0x68f41c);return{'transcript':_0x3454cd,'confidence':_0x68f41c};})[_0xcc24('0x51')](function(_0x44d043){logger[_0xcc24('0x1c')]('[%s]\x20%s:%s',_0x44d043[_0xcc24('0x17')],_0x44d043[_0xcc24('0x52')],_0x44d043['message']);});};exports[_0xcc24('0x53')]=function(_0x304493,_0x131dca,_0x552fe5,_0x51b464){var _0x45d2f0=apiai(_0x131dca,{'language':_0x51b464||'en'});return _0x45d2f0[_0xcc24('0x54')](_0x552fe5,{'sessionId':md5(_0x304493)})[_0xcc24('0x2b')](function(_0x13c1e4){logger[_0xcc24('0x19')](JSON[_0xcc24('0x55')](_0x13c1e4));return{'source':_0x13c1e4['result'][_0xcc24('0x56')],'resolvedQuery':_0x13c1e4[_0xcc24('0x57')][_0xcc24('0x58')],'action':_0x13c1e4['result']['action'],'actionIncomplete':_0x13c1e4[_0xcc24('0x57')][_0xcc24('0x59')],'speech':_0x13c1e4[_0xcc24('0x57')][_0xcc24('0x5a')][_0xcc24('0x5b')],'score':_0x13c1e4[_0xcc24('0x57')][_0xcc24('0x5c')],'statusCode':_0x13c1e4[_0xcc24('0x5d')][_0xcc24('0x5e')],'endConversation':_0x13c1e4['result'][_0xcc24('0x5f')][_0xcc24('0x60')]||![],'isFallbackIntent':_0x13c1e4[_0xcc24('0x57')][_0xcc24('0x5f')]['isFallbackIntent']};});};exports['googleDialogflowV2']=function(_0x4504ae,_0x4199ea,_0x526682,_0x53fb41,_0x549ba9,_0x1f70a7){var _0x5ade16=_0x53fb41[_0xcc24('0x61')](/\\n/g,'\x0a');var _0x2d9dab={'credentials':{'private_key':_0x5ade16,'client_email':_0x526682}};var _0x14c23e=new dialogflow[(_0xcc24('0x62'))](_0x2d9dab);var _0x53fa83=_0x14c23e['sessionPath'](_0x4199ea,md5(_0x4504ae));var _0x18c87f={'session':_0x53fa83,'queryInput':{'text':{'text':_0x549ba9,'languageCode':_0x1f70a7}}};return _0x14c23e[_0xcc24('0x63')](_0x18c87f)['then'](function(_0x4d7924){if(_0x4d7924&&_0x4d7924['length']){logger[_0xcc24('0x19')](_0xcc24('0x64'),JSON['stringify'](_0x4d7924));var _0x42a78b=_0x4d7924[0x0];if(_0x42a78b){var _0x244535={'action':_0x42a78b['queryResult']['action'],'allRequiredParamsPresent':_0x42a78b['queryResult'][_0xcc24('0x65')],'endConversation':_0x42a78b[_0xcc24('0x66')][_0xcc24('0x67')]&&_0x42a78b['queryResult']['diagnosticInfo'][_0xcc24('0x68')]?_0x42a78b[_0xcc24('0x66')][_0xcc24('0x67')]['fields'][_0xcc24('0x69')][_0xcc24('0x6a')]:![],'fulfillmentText':_0x42a78b['queryResult'][_0xcc24('0x6b')],'intentName':_0x42a78b[_0xcc24('0x66')]['intent'][_0xcc24('0x52')],'intentDisplayName':_0x42a78b[_0xcc24('0x66')][_0xcc24('0x6c')][_0xcc24('0x6d')],'isFallbackIntent':_0x42a78b[_0xcc24('0x66')]['intent']['isFallback'],'languageCode':_0x42a78b[_0xcc24('0x66')][_0xcc24('0x6e')],'queryText':_0x42a78b[_0xcc24('0x66')]['queryText'],'responseId':_0x42a78b['responseId'],'score':_0x42a78b[_0xcc24('0x66')][_0xcc24('0x6f')],'speech':_0x42a78b[_0xcc24('0x66')][_0xcc24('0x6b')],'providerResponse':JSON['stringify'](_0x4d7924)};return _0x244535;}}});};exports[_0xcc24('0x70')]=function(_0x43bd8a,_0x3a7454,_0x5a019a,_0x2c42e8){return tilde[_0xcc24('0x49')](_0x43bd8a,_0x3a7454,_0x5a019a,_0x2c42e8)[_0xcc24('0x2b')](function(_0x2d6e5e){try{fs['unlink'](_0x43bd8a);}catch(_0x21efd3){logger[_0xcc24('0x1c')](_0x21efd3);}logger[_0xcc24('0x19')]('Tilde\x20ASR\x20transcription',_0x2d6e5e[_0xcc24('0x4e')]);logger[_0xcc24('0x19')](_0xcc24('0x71'),_0x2d6e5e['confidence']);return _0x2d6e5e;});};exports['awsPolly']=function(_0x4e4428,_0x2632d9,_0x5954d2,_0x89a404,_0x3ab372,_0xa668e1){var _0x127349=path[_0xcc24('0x27')](__dirname,_0xcc24('0x37'),rs['generate'](0x4)+_0xcc24('0x38'));var _0x4850ef;return aws[_0xcc24('0x72')](_0x4e4428,_0x2632d9,_0x5954d2,_0x89a404,_0x3ab372,_0xa668e1,_0x127349)[_0xcc24('0x2b')](function(){_0x4850ef=path[_0xcc24('0x27')](__dirname,_0xcc24('0x37'),rs[_0xcc24('0x28')](0x4)+_0xcc24('0x3a'));return convertFile(_0x127349,_0x4850ef);})['then'](function(){try{fs[_0xcc24('0x1d')](_0x127349);fs[_0xcc24('0x2c')](_0x4850ef,_0xcc24('0x2d'));}catch(_0x52a081){logger[_0xcc24('0x1c')](_0x52a081);}return _0x4850ef[_0xcc24('0x3b')]('.')[0x0];});};exports['awsLex']=function(_0x4024bc,_0x1bbb4c,_0x119ab5,_0x42f009,_0x220be2,_0x3fda81){return aws[_0xcc24('0x73')](_0x4024bc,_0x1bbb4c,_0x119ab5,_0x42f009,_0x220be2,_0x3fda81)['then'](function(_0x26a263){logger[_0xcc24('0x19')](JSON[_0xcc24('0x55')](_0x26a263));return _0x26a263;});};exports[_0xcc24('0x74')]=function(_0x2eabaf,_0x2f06be,_0x14ae31,_0x511856){var _0x284990=util[_0xcc24('0x75')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x2eabaf,encodeURIComponent(_0x2f06be),_0x14ae31,_0x511856);var _0x31d598=path[_0xcc24('0x27')](__dirname,_0xcc24('0x37'),rs[_0xcc24('0x28')](0x4)+_0xcc24('0x38'));var _0x5b4ace;return downloadFile(_0x284990,_0x31d598)[_0xcc24('0x2b')](function(){_0x5b4ace=path[_0xcc24('0x27')](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x31d598,_0x5b4ace);})[_0xcc24('0x2b')](function(){try{fs[_0xcc24('0x1d')](_0x31d598);fs['chmodSync'](_0x5b4ace,'777');}catch(_0xce4e4d){logger[_0xcc24('0x1c')](_0xce4e4d);}return _0x5b4ace[_0xcc24('0x3b')]('.')[0x0];});};exports[_0xcc24('0x76')]=function(_0x15e4b1,_0x164a18,_0x4fb2b6,_0x462d52){var _0x273e4b=util[_0xcc24('0x75')](_0xcc24('0x77'),ISPEECH_API,_0x164a18,_0x4fb2b6,base64Encode(_0x15e4b1),_0x462d52?util[_0xcc24('0x75')](_0xcc24('0x78'),encodeURIComponent(_0x462d52)):_0xcc24('0x79'));return uploadFile(_0x273e4b)['then'](function(_0x2f1a10){return querystring['parse'](_0x2f1a10);});};exports[_0xcc24('0x7a')]=function(_0xc2510,_0x1a9dea){return sestek[_0xcc24('0x7b')](_0xc2510,_0x1a9dea)['then'](function(_0x4ee1a3){logger['info'](JSON['stringify'](_0x4ee1a3));var _0x207f5e={'speech':_0x4ee1a3[_0xcc24('0x7c')],'action':_0x4ee1a3['channelData']?_0x4ee1a3[_0xcc24('0x7d')]['CustomAction']:undefined,'actiondata':_0x4ee1a3[_0xcc24('0x7d')]?_0x4ee1a3[_0xcc24('0x7d')][_0xcc24('0x7e')]:undefined};if(_0x4ee1a3[_0xcc24('0x7d')]&&_0x4ee1a3['channelData'][_0xcc24('0x7f')]){return base64Decode(_0x4ee1a3[_0xcc24('0x7d')][_0xcc24('0x7f')][_0xcc24('0x80')],path[_0xcc24('0x27')](__dirname,_0xcc24('0x37'),rs[_0xcc24('0x28')](0x4)+_0xcc24('0x3a')))['then'](function(_0x1ef504){_0x207f5e[_0xcc24('0x81')]=_0x1ef504;return _0x207f5e;});}return _0x207f5e;});};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 665c27d..99ea4f1 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 _0x77bf=['exports','./nda'];(function(_0x86e67a,_0x5c26ea){var _0x595003=function(_0x1638e6){while(--_0x1638e6){_0x86e67a['push'](_0x86e67a['shift']());}};_0x595003(++_0x5c26ea);}(_0x77bf,0xd5));var _0xf77b=function(_0x50b411,_0x3743b2){_0x50b411=_0x50b411-0x0;var _0x2e973e=_0x77bf[_0x50b411];return _0x2e973e;};var nda=require(_0xf77b('0x0'));module[_0xf77b('0x1')]={'nda':nda}; \ No newline at end of file +var _0x67d0=['exports','./nda'];(function(_0x7dcc6c,_0x541430){var _0x55f844=function(_0x28a1e7){while(--_0x28a1e7){_0x7dcc6c['push'](_0x7dcc6c['shift']());}};_0x55f844(++_0x541430);}(_0x67d0,0x18b));var _0x067d=function(_0x170bff,_0x8dcd67){_0x170bff=_0x170bff-0x0;var _0x16d7f6=_0x67d0[_0x170bff];return _0x16d7f6;};var nda=require(_0x067d('0x0'));module[_0x067d('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 2061c08..73fb2b0 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 _0x0b96=['then','ndaactivity_type','message','Nda','uniqueid','calleridname','dnid','extension','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','custom_action','CustomAction','CustomActionData','custom_action_data','request-promise','url','../../../../../config/logger','exports','POST','resolve','/token','password','username'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0b96,0xa5));var _0x60b9=function(_0x1dac7a,_0x1828ce){_0x1dac7a=_0x1dac7a-0x0;var _0x4cb363=_0x0b96[_0x1dac7a];return _0x4cb363;};'use strict';var rp=require(_0x60b9('0x0'));var url=require(_0x60b9('0x1'));var logger=require(_0x60b9('0x2'))('agi');module[_0x60b9('0x3')]=function(_0x13616a,_0x23a080){var _0x4a68ca={'method':_0x60b9('0x4'),'uri':url[_0x60b9('0x5')](_0x23a080['ndauth_url'],_0x60b9('0x6')),'form':{'grant_type':_0x60b9('0x7'),'username':_0x23a080[_0x60b9('0x8')],'password':_0x23a080[_0x60b9('0x7')]},'json':!![]};return rp(_0x4a68ca)[_0x60b9('0x9')](function(_0x28d32f){var _0x1e5cef={'method':'POST','uri':url[_0x60b9('0x5')](_0x23a080['ndassistant_url'],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x23a080[_0x60b9('0xa')]||_0x60b9('0xb'),'channelId':_0x60b9('0xc'),'conversation':{'id':_0x13616a[_0x60b9('0xd')]},'from':{'id':_0x13616a['callerid'],'name':_0x13616a[_0x60b9('0xe')]},'recipient':{'id':_0x13616a[_0x60b9('0xf')],'name':_0x13616a[_0x60b9('0x10')]},'text':_0x23a080['text'],'channelData':{}},'headers':{'Authorization':_0x60b9('0x11')+_0x28d32f[_0x60b9('0x12')]},'json':!![]};if(_0x23a080[_0x60b9('0x13')]){_0x1e5cef[_0x60b9('0x14')][_0x60b9('0x15')][_0x60b9('0x16')]=_0x23a080[_0x60b9('0x13')];}if(_0x23a080[_0x60b9('0x17')]=='1'){_0x1e5cef[_0x60b9('0x14')][_0x60b9('0x15')][_0x60b9('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x23a080[_0x60b9('0x19')]){_0x1e5cef[_0x60b9('0x14')][_0x60b9('0x15')][_0x60b9('0x1a')]=_0x23a080[_0x60b9('0x19')];if(_0x23a080['custom_action_data']){_0x1e5cef[_0x60b9('0x14')][_0x60b9('0x15')][_0x60b9('0x1b')]=_0x23a080[_0x60b9('0x1c')];}}logger['info'](JSON['stringify'](_0x1e5cef));return rp(_0x1e5cef);});}; \ No newline at end of file +var _0xe189=['stringify','request-promise','agi','exports','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','project','channelData','ProjectName','ndagenerate_audio','body','AudioOutputSettings','custom_action','CustomAction','custom_action_data','CustomActionData'];(function(_0x205948,_0x2be11a){var _0x56d995=function(_0x444209){while(--_0x444209){_0x205948['push'](_0x205948['shift']());}};_0x56d995(++_0x2be11a);}(_0xe189,0x194));var _0x9e18=function(_0x3678e7,_0x43592c){_0x3678e7=_0x3678e7-0x0;var _0x1884b7=_0xe189[_0x3678e7];return _0x1884b7;};'use strict';var rp=require(_0x9e18('0x0'));var url=require('url');var logger=require('../../../../../config/logger')(_0x9e18('0x1'));module[_0x9e18('0x2')]=function(_0x22eac1,_0x30a009){var _0x5f30f6={'method':'POST','uri':url[_0x9e18('0x3')](_0x30a009[_0x9e18('0x4')],_0x9e18('0x5')),'form':{'grant_type':_0x9e18('0x6'),'username':_0x30a009[_0x9e18('0x7')],'password':_0x30a009['password']},'json':!![]};return rp(_0x5f30f6)[_0x9e18('0x8')](function(_0x2e4691){var _0x4656a4={'method':'POST','uri':url[_0x9e18('0x3')](_0x30a009[_0x9e18('0x9')],_0x9e18('0xa')),'body':{'type':_0x30a009['ndaactivity_type']||_0x9e18('0xb'),'channelId':_0x9e18('0xc'),'conversation':{'id':_0x22eac1[_0x9e18('0xd')]},'from':{'id':_0x22eac1[_0x9e18('0xe')],'name':_0x22eac1[_0x9e18('0xf')]},'recipient':{'id':_0x22eac1[_0x9e18('0x10')],'name':_0x22eac1[_0x9e18('0x11')]},'text':_0x30a009[_0x9e18('0x12')],'channelData':{}},'headers':{'Authorization':_0x9e18('0x13')+_0x2e4691['access_token']},'json':!![]};if(_0x30a009[_0x9e18('0x14')]){_0x4656a4['body'][_0x9e18('0x15')][_0x9e18('0x16')]=_0x30a009['project'];}if(_0x30a009[_0x9e18('0x17')]=='1'){_0x4656a4[_0x9e18('0x18')][_0x9e18('0x15')][_0x9e18('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x30a009[_0x9e18('0x1a')]){_0x4656a4['body']['channelData'][_0x9e18('0x1b')]=_0x30a009['custom_action'];if(_0x30a009[_0x9e18('0x1c')]){_0x4656a4[_0x9e18('0x18')][_0x9e18('0x15')][_0x9e18('0x1d')]=_0x30a009['custom_action_data'];}}logger['info'](JSON[_0x9e18('0x1e')](_0x4656a4));return rp(_0x4656a4);});}; \ 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 e17b54a..d72f43b 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 _0x1f8e=['./lib/api','exports'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x1f8e,0xa4));var _0xe1f8=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x1f8e[_0xaa0309];return _0x5de7ce;};'use strict';var asr=require(_0xe1f8('0x0'));module[_0xe1f8('0x1')]=function(_0x2739c3,_0x5aef4c,_0x1ae2d5,_0x582abe){return asr(_0x2739c3,_0x5aef4c,_0x1ae2d5,_0x582abe);}; \ No newline at end of file +'use strict';var asr=require('./lib/api');module['exports']=function(_0x4d2792,_0x230ade,_0x1e1047,_0x5d1762){return asr(_0x4d2792,_0x230ade,_0x1e1047,_0x5d1762);}; \ 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 39cbfbb..25dc5f7 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 _0xb5f2=['bluebird','lodash','moment','../../../../../../config/logger','info','Tilde\x20URI','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','Open\x20Tilde\x20ASR\x20socket','unix','stringify','createReadStream','data','send','close','error','Tilde\x20ASR\x20send\x20error','parse','status','result','final','hypotheses','likelihood','Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message'];(function(_0x90a39a,_0x32020d){var _0x2b62f7=function(_0x6841cc){while(--_0x6841cc){_0x90a39a['push'](_0x90a39a['shift']());}};_0x2b62f7(++_0x32020d);}(_0xb5f2,0x1c7));var _0x2b5f=function(_0x166f4c,_0x55923a){_0x166f4c=_0x166f4c-0x0;var _0x51489f=_0xb5f2[_0x166f4c];return _0x51489f;};'use strict';var BPromise=require(_0x2b5f('0x0'));var _=require(_0x2b5f('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x2b5f('0x2'));var crypto=require('crypto');var logger=require(_0x2b5f('0x3'))('agi');module['exports']=function(_0x5816f6,_0x5ab7cc,_0x5c423c,_0x3ddb76){return new BPromise(function(_0x454c3a,_0x12ddee){logger[_0x2b5f('0x4')](_0x2b5f('0x5'),_0x3ddb76||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x466a63=new WebSocket(_0x3ddb76||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x5d0b0a='';var _0x4be163='0';var _0x382691='1';var _0x2bb170=_0x2b5f('0x6');function _0x2268cf(_0x1a8564){var _0x3cac42=crypto[_0x2b5f('0x7')]('sha1');_0x3cac42[_0x2b5f('0x8')](_0x1a8564);return _0x3cac42['digest']('hex');}function _0x1e5152(){try{logger[_0x2b5f('0x4')](_0x2b5f('0x9'));var _0x3c04bb=moment()[_0x2b5f('0xa')]();var _0x24b6ff=_0x2268cf(_0x3c04bb+_0x5ab7cc+_0x5c423c);_0x466a63['send'](JSON[_0x2b5f('0xb')]({'appID':_0x5ab7cc,'timestamp':_0x3c04bb,'appKey':_0x24b6ff}));var _0x18e8e6=fs[_0x2b5f('0xc')](_0x5816f6);_0x18e8e6['on'](_0x2b5f('0xd'),function(_0x10e656){_0x466a63[_0x2b5f('0xe')](_0x10e656);});_0x18e8e6['on'](_0x2b5f('0xf'),function(){_0x466a63[_0x2b5f('0xe')]('EOS');});}catch(_0x4aec2c){logger[_0x2b5f('0x10')](_0x2b5f('0x11'),JSON[_0x2b5f('0xb')](_0x4aec2c));_0x466a63['terminate']();}}function _0xbf08e(_0x4a6ce7){try{if(_0x4a6ce7){var _0x40aa2e=JSON[_0x2b5f('0x12')](_0x4a6ce7);switch(_0x40aa2e[_0x2b5f('0x13')]){case 0x0:if(_0x40aa2e[_0x2b5f('0x14')]){if(_0x40aa2e[_0x2b5f('0x14')][_0x2b5f('0x15')]){logger[_0x2b5f('0x4')]('Tilde\x20ASR\x20hypoteses',JSON[_0x2b5f('0xb')](_0x40aa2e[_0x2b5f('0x14')][_0x2b5f('0x16')]));_0x5d0b0a=_0x40aa2e['result'][_0x2b5f('0x16')][0x0]['transcript'];_0x4be163=_0x40aa2e[_0x2b5f('0x14')][_0x2b5f('0x16')][0x0][_0x2b5f('0x17')];_0x382691='0';_0x2bb170=_0x2b5f('0x18');_0x466a63[_0x2b5f('0x19')]();}}break;case 0x1:logger[_0x2b5f('0x4')](_0x2b5f('0x6'));_0x382691='1';_0x2bb170=_0x2b5f('0x6');break;case 0x2:logger['info'](_0x2b5f('0x1a'));_0x382691='2';_0x2bb170=_0x2b5f('0x1a');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x382691='9';_0x2bb170=_0x2b5f('0x1b');break;case 0xa:logger[_0x2b5f('0x4')](_0x2b5f('0x1c'));_0x382691='10';_0x2bb170=_0x2b5f('0x1c');break;case 0xb:logger[_0x2b5f('0x4')](_0x2b5f('0x1d'));_0x382691='11';_0x2bb170=_0x2b5f('0x1d');}}}catch(_0x2d79e7){logger['error']('Tilde\x20ASR\x20parse\x20error',JSON[_0x2b5f('0xb')](_0x2d79e7));_0x466a63[_0x2b5f('0x19')]();}}function _0x522aa5(){logger['info']('Close\x20Tilde\x20ASR\x20socket');_0x454c3a({'transcript':_0x5d0b0a,'confidence':_0x4be163,'status':_0x382691,'status_message':_0x2bb170});}function _0x580e17(_0x3ad0c8){logger[_0x2b5f('0x10')](_0x2b5f('0x1e'));if(!_[_0x2b5f('0x1f')](_0x3ad0c8)){logger[_0x2b5f('0x10')](_[_0x2b5f('0x20')](_0x3ad0c8)?JSON[_0x2b5f('0xb')](_0x3ad0c8):_0x3ad0c8);}}_0x466a63['on'](_0x2b5f('0x21'),_0x1e5152);_0x466a63['on'](_0x2b5f('0x22'),_0xbf08e);_0x466a63['on'](_0x2b5f('0xf'),_0x522aa5);_0x466a63['on'](_0x2b5f('0x10'),_0x580e17);});}; \ No newline at end of file +var _0x1521=['Tilde\x20ASR\x20send\x20error','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','terminate','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','lodash','moment','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','digest','Open\x20Tilde\x20ASR\x20socket','send','stringify','createReadStream','EOS','error'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x1521,0x1c2));var _0x1152=function(_0x29d623,_0x1a5c9c){_0x29d623=_0x29d623-0x0;var _0x242e59=_0x1521[_0x29d623];return _0x242e59;};'use strict';var BPromise=require('bluebird');var _=require(_0x1152('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x1152('0x1'));var crypto=require('crypto');var logger=require(_0x1152('0x2'))(_0x1152('0x3'));module[_0x1152('0x4')]=function(_0xf9facb,_0x1677b5,_0x2708dd,_0x5a8ce4){return new BPromise(function(_0x13c9fd,_0x232a06){logger[_0x1152('0x5')](_0x1152('0x6'),_0x5a8ce4||_0x1152('0x7'));var _0x244676=new WebSocket(_0x5a8ce4||_0x1152('0x7'),{'perMessageDeflate':![]});var _0x31c92b='';var _0x4b6d95='0';var _0x2ae01a='1';var _0x19baf9='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x248ac5(_0x4f5d67){var _0x3fcac0=crypto[_0x1152('0x8')](_0x1152('0x9'));_0x3fcac0[_0x1152('0xa')](_0x4f5d67);return _0x3fcac0[_0x1152('0xb')]('hex');}function _0x49a60b(){try{logger[_0x1152('0x5')](_0x1152('0xc'));var _0x2eeabd=moment()['unix']();var _0x361da3=_0x248ac5(_0x2eeabd+_0x1677b5+_0x2708dd);_0x244676[_0x1152('0xd')](JSON[_0x1152('0xe')]({'appID':_0x1677b5,'timestamp':_0x2eeabd,'appKey':_0x361da3}));var _0x5c6e70=fs[_0x1152('0xf')](_0xf9facb);_0x5c6e70['on']('data',function(_0x164db3){_0x244676[_0x1152('0xd')](_0x164db3);});_0x5c6e70['on']('close',function(){_0x244676[_0x1152('0xd')](_0x1152('0x10'));});}catch(_0x152215){logger[_0x1152('0x11')](_0x1152('0x12'),JSON['stringify'](_0x152215));_0x244676['terminate']();}}function _0x396ea3(_0x3dd5e7){try{if(_0x3dd5e7){var _0x5ea9fa=JSON['parse'](_0x3dd5e7);switch(_0x5ea9fa[_0x1152('0x13')]){case 0x0:if(_0x5ea9fa[_0x1152('0x14')]){if(_0x5ea9fa[_0x1152('0x14')][_0x1152('0x15')]){logger['info'](_0x1152('0x16'),JSON['stringify'](_0x5ea9fa[_0x1152('0x14')][_0x1152('0x17')]));_0x31c92b=_0x5ea9fa[_0x1152('0x14')][_0x1152('0x17')][0x0][_0x1152('0x18')];_0x4b6d95=_0x5ea9fa[_0x1152('0x14')][_0x1152('0x17')][0x0][_0x1152('0x19')];_0x2ae01a='0';_0x19baf9=_0x1152('0x1a');_0x244676[_0x1152('0x1b')]();}}break;case 0x1:logger['info'](_0x1152('0x1c'));_0x2ae01a='1';_0x19baf9=_0x1152('0x1c');break;case 0x2:logger[_0x1152('0x5')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x2ae01a='2';_0x19baf9=_0x1152('0x1d');break;case 0x9:logger[_0x1152('0x5')](_0x1152('0x1e'));_0x2ae01a='9';_0x19baf9='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x1152('0x5')]('Authentication\x20failed.');_0x2ae01a='10';_0x19baf9='Authentication\x20failed.';break;case 0xb:logger[_0x1152('0x5')](_0x1152('0x1f'));_0x2ae01a='11';_0x19baf9=_0x1152('0x1f');}}}catch(_0x3dee1e){logger[_0x1152('0x11')](_0x1152('0x20'),JSON[_0x1152('0xe')](_0x3dee1e));_0x244676[_0x1152('0x1b')]();}}function _0x1afe6d(){logger[_0x1152('0x5')](_0x1152('0x21'));_0x13c9fd({'transcript':_0x31c92b,'confidence':_0x4b6d95,'status':_0x2ae01a,'status_message':_0x19baf9});}function _0x1cbf61(_0x3475b1){logger['error'](_0x1152('0x22'));if(!_[_0x1152('0x23')](_0x3475b1)){logger['error'](_[_0x1152('0x24')](_0x3475b1)?JSON['stringify'](_0x3475b1):_0x3475b1);}}_0x244676['on'](_0x1152('0x25'),_0x49a60b);_0x244676['on'](_0x1152('0x26'),_0x396ea3);_0x244676['on']('close',_0x1afe6d);_0x244676['on'](_0x1152('0x11'),_0x1cbf61);});}; \ 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 07b999e..a76f54c 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 _0x6f7f=['exports','./asr'];(function(_0x4ede09,_0x18801d){var _0x253193=function(_0xa4c752){while(--_0xa4c752){_0x4ede09['push'](_0x4ede09['shift']());}};_0x253193(++_0x18801d);}(_0x6f7f,0x137));var _0xf6f7=function(_0x42f63c,_0x4ef8a3){_0x42f63c=_0x42f63c-0x0;var _0x194f22=_0x6f7f[_0x42f63c];return _0x194f22;};var asr=require(_0xf6f7('0x0'));module[_0xf6f7('0x1')]={'asr':asr}; \ No newline at end of file +var _0x0a7b=['./asr','exports'];(function(_0x64a448,_0x5d69b4){var _0x57a51b=function(_0x4426f0){while(--_0x4426f0){_0x64a448['push'](_0x64a448['shift']());}};_0x57a51b(++_0x5d69b4);}(_0x0a7b,0x1f0));var _0xb0a7=function(_0x42c187,_0x5b5dde){_0x42c187=_0x42c187-0x0;var _0x31ffc5=_0x0a7b[_0x42c187];return _0x31ffc5;};var asr=require(_0xb0a7('0x0'));module[_0xb0a7('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index a7f0ebd..35bf5b8 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 _0x5650=['./channel','127.0.0.1','emit','E_AGI_ARGUMENT_PORT','createServer','listen','connection','getConnections','error','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','events','EventEmitter','./error'];(function(_0x529aaa,_0x4dc537){var _0x190930=function(_0x15672b){while(--_0x15672b){_0x529aaa['push'](_0x529aaa['shift']());}};_0x190930(++_0x4dc537);}(_0x5650,0x1db));var _0x0565=function(_0x2742db,_0x58e00c){_0x2742db=_0x2742db-0x0;var _0x18659e=_0x5650[_0x2742db];return _0x18659e;};'use strict';var util=require(_0x0565('0x0'));var net=require(_0x0565('0x1'));var EventEmitter=require(_0x0565('0x2'))[_0x0565('0x3')];var AGIError=require(_0x0565('0x4'));var AGIChannel=require(_0x0565('0x5'));var AGIServer=function(_0x572456,_0x335528,_0x502903){var _0x1c08a4=this,_0x572456=_0x572456||0x11dd,_0x335528=_0x335528||_0x0565('0x6'),_0x4fa5d2=null,_0x1e8254=0x0;EventEmitter['call'](_0x1c08a4);function _0x5e0d5d(){if(!_0x572456){_0x1c08a4[_0x0565('0x7')]('error',new AGIError(_0x0565('0x8')));return![];}_0x4fa5d2=net[_0x0565('0x9')]();_0x4fa5d2[_0x0565('0xa')](_0x572456,_0x335528);_0x4fa5d2['on']('listening',function(){_0x1c08a4[_0x0565('0x7')]('listening');});_0x4fa5d2['on'](_0x0565('0xb'),function(_0x3c5d84){_0x4fa5d2[_0x0565('0xc')](function(_0x13bae7,_0x3b5911){if(_0x13bae7){_0x1c08a4[_0x0565('0x7')](_0x0565('0xd'),new AGIError(_0x0565('0xe'),_0x13bae7));}else if(_0x502903&&_0x502903<0x0){_0x1c08a4[_0x0565('0x7')](_0x0565('0xd'),new AGIError(_0x0565('0xf')));_0x3c5d84[_0x0565('0x10')]();}else if(_0x502903&&_0x502903>0x0&&_0x502903<_0x3b5911){_0x1e8254+=0x1;_0x1c08a4[_0x0565('0x7')]('error',new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x1e8254));_0x3c5d84[_0x0565('0x10')]();}else{var _0x5e8598=new AGIChannel(_0x3c5d84);_0x5e8598['on'](_0x0565('0x11'),function(){_0x1c08a4['emit']('connection',_0x5e8598);});}});});_0x4fa5d2['on']('error',function(_0x43ac1d){_0x1c08a4[_0x0565('0x7')]('error',new AGIError(_0x0565('0xe'),_0x43ac1d[_0x0565('0x12')]));});_0x4fa5d2['on'](_0x0565('0x13'),function(){_0x1c08a4[_0x0565('0x7')](_0x0565('0x13'),new AGIError(_0x0565('0x14')));});}process[_0x0565('0x15')](function(){_0x5e0d5d();});};util[_0x0565('0x16')](AGIServer,EventEmitter);module[_0x0565('0x17')]=function(_0x44c84e,_0x1d01a7,_0x9b25dd){return new AGIServer(_0x44c84e,_0x1d01a7,_0x9b25dd);}; \ No newline at end of file +var _0x83bd=['net','EventEmitter','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','listen','listening','getConnections','E_AGI_SERVER_VOICE_DISABLED','destroy','ready','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','exports','util'];(function(_0x211cad,_0x393dde){var _0x351ca4=function(_0x1cd61d){while(--_0x1cd61d){_0x211cad['push'](_0x211cad['shift']());}};_0x351ca4(++_0x393dde);}(_0x83bd,0x18f));var _0xd83b=function(_0x291aaf,_0x4c6d8d){_0x291aaf=_0x291aaf-0x0;var _0x5571e6=_0x83bd[_0x291aaf];return _0x5571e6;};'use strict';var util=require(_0xd83b('0x0'));var net=require(_0xd83b('0x1'));var EventEmitter=require('events')[_0xd83b('0x2')];var AGIError=require('./error');var AGIChannel=require(_0xd83b('0x3'));var AGIServer=function(_0x56e197,_0xe11487,_0x2502e5){var _0x1fc0e6=this,_0x56e197=_0x56e197||0x11dd,_0xe11487=_0xe11487||_0xd83b('0x4'),_0x36a3fa=null,_0x123c5a=0x0;EventEmitter[_0xd83b('0x5')](_0x1fc0e6);function _0x44f1ef(){if(!_0x56e197){_0x1fc0e6[_0xd83b('0x6')](_0xd83b('0x7'),new AGIError(_0xd83b('0x8')));return![];}_0x36a3fa=net['createServer']();_0x36a3fa[_0xd83b('0x9')](_0x56e197,_0xe11487);_0x36a3fa['on'](_0xd83b('0xa'),function(){_0x1fc0e6[_0xd83b('0x6')](_0xd83b('0xa'));});_0x36a3fa['on']('connection',function(_0x5eb992){_0x36a3fa[_0xd83b('0xb')](function(_0xad35b1,_0x1b7dea){if(_0xad35b1){_0x1fc0e6['emit'](_0xd83b('0x7'),new AGIError('E_AGI_SERVER_ERROR',_0xad35b1));}else if(_0x2502e5&&_0x2502e5<0x0){_0x1fc0e6[_0xd83b('0x6')](_0xd83b('0x7'),new AGIError(_0xd83b('0xc')));_0x5eb992[_0xd83b('0xd')]();}else if(_0x2502e5&&_0x2502e5>0x0&&_0x2502e5<_0x1b7dea){_0x123c5a+=0x1;_0x1fc0e6[_0xd83b('0x6')](_0xd83b('0x7'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x123c5a));_0x5eb992[_0xd83b('0xd')]();}else{var _0x47c8c1=new AGIChannel(_0x5eb992);_0x47c8c1['on'](_0xd83b('0xe'),function(){_0x1fc0e6[_0xd83b('0x6')]('connection',_0x47c8c1);});}});});_0x36a3fa['on'](_0xd83b('0x7'),function(_0xcbc649){_0x1fc0e6[_0xd83b('0x6')]('error',new AGIError(_0xd83b('0xf'),_0xcbc649[_0xd83b('0x10')]));});_0x36a3fa['on'](_0xd83b('0x11'),function(){_0x1fc0e6['emit'](_0xd83b('0x11'),new AGIError(_0xd83b('0x12')));});}process['nextTick'](function(){_0x44f1ef();});};util['inherits'](AGIServer,EventEmitter);module[_0xd83b('0x13')]=function(_0xe69e2d,_0x3f13a4,_0x581d4b){return new AGIServer(_0xe69e2d,_0x3f13a4,_0x581d4b);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 420fe0b..7214d09 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 _0x784a=['aws_polly_voice','Amy','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','clear','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','isPlainObject','recursiveNodeIndex','isArray','saveRestApiResult','length','setVariable','%s.%s','split','replaceAll','extra','getAndSetVariable','result','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','noop','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','phone','list_id','custom_app','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','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_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20query\x20configured','getQueryOdbc','createSquareDetailsReport','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','%s_ROWS_COUNT','variable\x20%s\x20set','dial','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','opts','no\x20key\x20configured','bot','DIALOGFLOW_%s','out','dialogflow','Dialogflow\x20Result\x20%s','speech','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','response','maxdigit','toString','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','.wav','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','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','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','recordFile','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','beep','intKey','TILDE_ASR_%s','TildeASR\x20Result\x20%s','continueAt','gotoif','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','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','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','getData','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','pause_id','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','indexOf','XMCS-QUEUE','macro','position','QUEUE','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','inspect','%s_STATUS_CODE','200','sayDigits','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','user','subject','service','host','port','secure','authentication','auth','pass','debug','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','getSmsAccount','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','createSmsMessage','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','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','path','util','lodash','odbc','moment','mustache','../../config/logger','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','catch','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','format','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','scheduledAt','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPause','agentPause','agentUnpause','agent','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','text','MALE','audioEncoding','MP3','googleTTS','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','options','googleDialogflow','dialogflow_language','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','en-US','speed','ispeechASR','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region'];(function(_0x2c64b9,_0x30d121){var _0x25e018=function(_0x21c5dc){while(--_0x21c5dc){_0x2c64b9['push'](_0x2c64b9['shift']());}};_0x25e018(++_0x30d121);}(_0x784a,0x130));var _0xa784=function(_0x58916b,_0x43fc5d){_0x58916b=_0x58916b-0x0;var _0x238322=_0x784a[_0x58916b];return _0x238322;};'use strict';var fs=require('fs');var path=require(_0xa784('0x0'));var util=require(_0xa784('0x1'));var _=require(_0xa784('0x2'));var sh=require('shelljs');var odbc=require(_0xa784('0x3'))();var rs=require('randomstring');var moment=require(_0xa784('0x4'));var Mustache=require(_0xa784('0x5'));var rp=require('request-promise');var logger=require(_0xa784('0x6'))('agi');var config=require('../../config/environment');var scripts=require('./scripts');var FILES_PATH=_0xa784('0x7');var recursiveMapAttributes=[_0xa784('0x8'),_0xa784('0x9')];var verticesWithRetry=[_0xa784('0xa'),_0xa784('0xb'),_0xa784('0xc')];var AGIVertices=function(_0x2e55ec,_0xfe31dc,_0xf850d){this[_0xa784('0xd')]=_0x2e55ec;this[_0xa784('0xe')]=_0xfe31dc;this[_0xa784('0xf')]=_0xf850d;};AGIVertices[_0xa784('0x10')][_0xa784('0x11')]=function(_0x3bcec9,_0xc63bec){this[_0xa784('0xe')][_0xa784('0x12')](_0x3bcec9)[_0xa784('0x13')](function(_0x12ef61){_0xc63bec(null,_0x12ef61?_0x12ef61[_0xa784('0x14')]:![]);})['catch'](function(_0x513281){_0xc63bec(_0x513281);});};AGIVertices[_0xa784('0x10')][_0xa784('0x15')]=function(_0x1e8863,_0x5e3845){this['rpc'][_0xa784('0x16')](_0x1e8863)[_0xa784('0x13')](function(_0x4fc277){_0x5e3845(null,_0x4fc277?_0x4fc277[_0xa784('0x14')]:![]);})['catch'](function(_0x16a900){_0x5e3845(_0x16a900);});};AGIVertices[_0xa784('0x10')][_0xa784('0x17')]=function(_0x3e6c07,_0x4dac88){this[_0xa784('0xe')][_0xa784('0x18')](_0x3e6c07)[_0xa784('0x13')](function(_0x265e4e){_0x4dac88(null,_0x265e4e?_0x265e4e[_0xa784('0x14')]:![]);})['catch'](function(_0x333d98){_0x4dac88(_0x333d98);});};AGIVertices['prototype'][_0xa784('0x19')]=function(_0x242525,_0x3b57d3){this[_0xa784('0xe')][_0xa784('0x1a')](_0x242525)[_0xa784('0x13')](function(_0x3f6bc4){_0x3b57d3(null,_0x3f6bc4?_0x3f6bc4['dsn']:![]);})[_0xa784('0x1b')](function(_0x2d17a8){_0x3b57d3(_0x2d17a8);});};AGIVertices[_0xa784('0x10')]['getUser']=function(_0x58a132,_0x42f829){this['rpc']['getUserById'](_0x58a132)[_0xa784('0x13')](function(_0x5dd044){_0x42f829(null,_0x5dd044?_0x5dd044[_0xa784('0x14')]:![]);})[_0xa784('0x1b')](function(_0x3b3974){_0x42f829(_0x3b3974);});};AGIVertices['prototype'][_0xa784('0x1c')]=function(_0x23336d,_0x3986ce){this['rpc'][_0xa784('0x1d')](_0x23336d)[_0xa784('0x13')](function(_0x46514c){_0x3986ce(null,_0x46514c?_0x46514c[_0xa784('0x14')]:![]);})[_0xa784('0x1b')](function(_0x2cf9a9){_0x3986ce(_0x2cf9a9);});};AGIVertices[_0xa784('0x10')][_0xa784('0x1e')]=function(_0x14e9c4,_0x289a49){var _0x390adc=this;this['rpc'][_0xa784('0x1f')](_0x14e9c4)['then'](function(_0x2f631b){_0x289a49(null,_0x2f631b?_0x390adc[_0xa784('0x20')](_0x2f631b[_0xa784('0x21')]):![]);})[_0xa784('0x1b')](function(_0x10d3cc){_0x289a49(_0x10d3cc);});};AGIVertices[_0xa784('0x10')][_0xa784('0x22')]=function(_0x5de8f2,_0xbfa556){this[_0xa784('0xe')][_0xa784('0x23')](_0x5de8f2)['then'](function(_0x1deec9){_0xbfa556(null,_0x1deec9?_0x1deec9:![]);})['catch'](function(_0x243e99){_0xbfa556(_0x243e99);});};AGIVertices['prototype'][_0xa784('0x24')]=function(_0x3663fb,_0x7925c0,_0xca891c){this[_0xa784('0xf')][_0xa784('0x24')](_0x3663fb,_0x7925c0)[_0xa784('0x13')](function(){_0xca891c(null);})[_0xa784('0x1b')](function(_0x67e6bb){_0xca891c(_0x67e6bb);});};AGIVertices[_0xa784('0x10')][_0xa784('0x25')]=function(_0x48a47e,_0x4ec572){this['rpc'][_0xa784('0x26')](_0x48a47e)[_0xa784('0x13')](function(_0x1e3c8f){if(_0x1e3c8f){if(_0x1e3c8f[_0xa784('0x27')]){_0x4ec572(null,[_0x1e3c8f[_0xa784('0x28')]]);}else{_0x4ec572(null,_[_0xa784('0x29')](_0x1e3c8f['Intervals'],_0xa784('0x28')));}}else{_0x4ec572(null,![]);}})['catch'](function(_0xc2c908){_0x4ec572(_0xc2c908);});};AGIVertices[_0xa784('0x10')]['getSoundPath']=function(_0x65d270){return util[_0xa784('0x2a')]('%s/sounds/converted/%s',FILES_PATH,_0x65d270);};AGIVertices[_0xa784('0x10')]['getQueryOdbc']=function(_0x2507b8,_0x2bb9ae,_0x1c600f){odbc[_0xa784('0x2b')](_0x2507b8,function(_0x32c3fa){if(_0x32c3fa){logger[_0xa784('0x2c')](_0xa784('0x2d'),_0x32c3fa);_0x1c600f(_0x32c3fa);}else{logger[_0xa784('0x2e')](_0xa784('0x2f'));odbc[_0xa784('0x30')](_0x2bb9ae,function(_0xa2dbf4,_0x16ca4b){if(_0xa2dbf4){logger[_0xa784('0x2e')](_0xa784('0x31'),_0x2bb9ae);_0x1c600f(_0xa2dbf4);}else{logger[_0xa784('0x2e')](_0xa784('0x32'),_0x2bb9ae);odbc[_0xa784('0x33')](function(_0x20a33c){if(_0x20a33c){logger[_0xa784('0x2c')](_0xa784('0x34'),_0x20a33c);}_0x1c600f(null,_0x16ca4b);});}});}});};AGIVertices[_0xa784('0x10')]['getSmsAccount']=function(_0x4bfde2,_0x4b2aa0){this[_0xa784('0xe')][_0xa784('0x35')](_0x4bfde2)[_0xa784('0x13')](function(_0xba6692){_0x4b2aa0(null,_0xba6692?_0xba6692:![]);})[_0xa784('0x1b')](function(_0xc7ce7b){_0x4b2aa0(_0xc7ce7b);});};AGIVertices[_0xa784('0x10')]['createSmsMessage']=function(_0x44df54,_0x301ad0){this[_0xa784('0xe')]['createSmsMessage'](_0x44df54)[_0xa784('0x13')](function(_0x3a9520){_0x301ad0(null,_0x3a9520);})[_0xa784('0x1b')](function(_0x219f53){_0x301ad0(_0x219f53);});};AGIVertices['prototype']['createSquareDetailsReport']=function(_0x468ba1,_0x3eaf37,_0x3ac8dc){this['rpc']['createSquareDetailsReport']({'uniqueid':this[_0xa784('0xd')][_0xa784('0x36')],'node':_0x468ba1[_0xa784('0x37')],'application':_0x468ba1[_0xa784('0x38')],'data':_0x3eaf37||null,'project_name':this[_0xa784('0xd')][_0xa784('0x39')],'callerid':this['channel'][_0xa784('0x3a')]})['then'](function(_0x473862){if(_0x3ac8dc){_0x3ac8dc(null,_0x473862);}})[_0xa784('0x1b')](function(_0x57fe9c){if(_0x3ac8dc){_0x3ac8dc(_0x57fe9c);}});};AGIVertices['prototype'][_0xa784('0x3b')]=function(_0x1650ac,_0x384846,_0x41598e,_0x153b90){this[_0xa784('0xe')]['createSquareRecording']({'uniqueid':this[_0xa784('0xd')]['uniqueid'],'callerid':this[_0xa784('0xd')]['callerid'],'calleridname':this[_0xa784('0xd')]['calleridname'],'context':this[_0xa784('0xd')][_0xa784('0x3c')],'extension':this[_0xa784('0xd')][_0xa784('0x3d')],'priority':this[_0xa784('0xd')][_0xa784('0x3e')],'accountcode':this['channel'][_0xa784('0x3f')],'dnid':this[_0xa784('0xd')][_0xa784('0x40')],'projectName':this['channel'][_0xa784('0x39')],'saveName':_0x384846,'filename':_0x1650ac[_0xa784('0x41')]||_0x384846,'savePath':_0x41598e})['then'](function(_0x37fe1e){_0x153b90(null,_0x37fe1e);})[_0xa784('0x1b')](function(_0x352f62){_0x153b90(_0x352f62);});};AGIVertices[_0xa784('0x10')][_0xa784('0x42')]=function(_0x2376f1,_0x2e006,_0x241cf4,_0x5aab6e,_0x38c9d3){this[_0xa784('0xe')][_0xa784('0x42')]({'uniqueid':this['channel'][_0xa784('0x36')],'body':_0x2376f1,'direction':_0x2e006,'providerName':_0x241cf4,'providerResponse':_0x5aab6e})[_0xa784('0x13')](function(_0x1e631a){if(_0x38c9d3){_0x38c9d3(null,_0x1e631a);}})[_0xa784('0x1b')](function(_0x1b49c7){if(_0x38c9d3){_0x38c9d3(_0x1b49c7);}});};AGIVertices[_0xa784('0x10')][_0xa784('0x43')]=function(_0x52a9d0,_0x411f83){this['rpc'][_0xa784('0x43')]({'firstName':_[_0xa784('0x44')](_0x52a9d0[_0xa784('0x14')])||_[_0xa784('0x45')](_0x52a9d0[_0xa784('0x14')])?_0xa784('0x46')+Math[_0xa784('0x47')]():_0x52a9d0[_0xa784('0x14')],'lastName':_[_0xa784('0x44')](_0x52a9d0[_0xa784('0x48')])||_[_0xa784('0x45')](_0x52a9d0['lastName'])?null:_0x52a9d0[_0xa784('0x48')],'phone':_0x52a9d0['phone'],'ListId':_0x52a9d0['list_id'],'scheduledat':_0x52a9d0[_0xa784('0x49')],'callbackUniqueid':this['channel']['uniqueid'],'tags':_0xa784('0x4a'),'description':_0xa784('0x4b')+_0x52a9d0[_0xa784('0x49')]['toString'](),'priority':_0x52a9d0[_0xa784('0x4c')]})[_0xa784('0x13')](function(_0x10fcf7){_0x411f83(null,_0x10fcf7);})[_0xa784('0x1b')](function(_0x222ae9){_0x411f83(_0x222ae9);});};AGIVertices[_0xa784('0x10')][_0xa784('0x4d')]=function(_0x80a13f,_0x3cae6a){this['rpc']['getPauseById'](_0x80a13f)[_0xa784('0x13')](function(_0x4b2f64){_0x3cae6a(null,_0x4b2f64?_0x4b2f64[_0xa784('0x14')]:![]);})[_0xa784('0x1b')](function(_0x20212f){_0x3cae6a(_0x20212f);});};AGIVertices[_0xa784('0x10')][_0xa784('0x4e')]=function(_0xdc923a,_0x4b2785,_0xfb9466){var _0x2c46d9={'role':'agent'};_0x2c46d9[_0xdc923a]=this[_0xa784('0xd')]['callerid'];this[_0xa784('0xe')][_0xa784('0x4e')](_0x2c46d9,_0x4b2785,this['channel'][_0xa784('0x36')])[_0xa784('0x13')](function(_0x2aecff){_0xfb9466(null,_['isNil'](_0x2aecff)?![]:!![]);})[_0xa784('0x1b')](function(_0x342533){logger['error'](_0x342533);_0xfb9466(null,![]);});};AGIVertices[_0xa784('0x10')][_0xa784('0x4f')]=function(_0xb9880c,_0x55056c){var _0x2cd4e3={'role':_0xa784('0x50')};_0x2cd4e3[_0xb9880c]=this['channel']['callerid'];this['rpc'][_0xa784('0x4f')](_0x2cd4e3)[_0xa784('0x13')](function(_0x13c0d4){_0x55056c(null,_[_0xa784('0x45')](_0x13c0d4)?![]:!![]);})[_0xa784('0x1b')](function(_0xe523dd){logger['error'](_0xe523dd);_0x55056c(null,![]);});};AGIVertices[_0xa784('0x10')][_0xa784('0x51')]=function(_0x5995a4,_0x33d88a){var _0x4aa326={'role':_0xa784('0x50')};_0x4aa326[_0x5995a4]=this['channel'][_0xa784('0x3a')];this[_0xa784('0xe')]['agentLogout'](_0x4aa326)['then'](function(_0x30088b){_0x33d88a(null,_[_0xa784('0x45')](_0x30088b)?![]:!![]);})['catch'](function(_0x57fa95){logger[_0xa784('0x2c')](_0x57fa95);_0x33d88a(null,![]);});};AGIVertices[_0xa784('0x10')][_0xa784('0x52')]=function(_0x3bae51,_0x29f4d6){var _0x3ba0ee={'role':_0xa784('0x50')};_0x3ba0ee[_0x3bae51]=this[_0xa784('0xd')][_0xa784('0x3a')];var _0x4b386a=_0x3bae51!=_0xa784('0x53')?util[_0xa784('0x2a')](_0xa784('0x54'),_0xa784('0x55'),this[_0xa784('0xd')][_0xa784('0x3a')]):undefined;this[_0xa784('0xe')][_0xa784('0x52')](_0x3ba0ee,_0x4b386a)[_0xa784('0x13')](function(_0x4ac896){_0x29f4d6(null,_[_0xa784('0x45')](_0x4ac896)?![]:!![]);})[_0xa784('0x1b')](function(_0x5c45cf){logger[_0xa784('0x2c')](_0x5c45cf);_0x29f4d6(null,![]);});};AGIVertices['prototype'][_0xa784('0x56')]=function(_0x47718e,_0xc5cebc){sh[_0xa784('0x57')](_[_0xa784('0x58')](_0x47718e),function(_0x114f4b,_0x3f72aa){var _0x30962b=_0x3f72aa[_0xa784('0x59')](/(\r\n|\n|\r)/gm,'');_0xc5cebc(null,_0x30962b);});};AGIVertices[_0xa784('0x10')]['googleCloudTTS']=function(_0x4c4410,_0x5d0a2d){scripts[_0xa784('0x5a')](_0x4c4410[_0xa784('0x5b')],_0x4c4410['google_cloud_tts_text_type']||_0xa784('0x5c'),_0x4c4410[_0xa784('0x5c')],_0x4c4410['languageCode']||'en-US',_0x4c4410['ssmlGender']||_0xa784('0x5d'),_0x4c4410[_0xa784('0x5e')]||_0xa784('0x5f'))[_0xa784('0x13')](function(_0x41cefe){_0x5d0a2d(null,_0x41cefe);})['catch'](function(_0x23f030){_0x5d0a2d(_0x23f030);});};AGIVertices[_0xa784('0x10')][_0xa784('0x60')]=function(_0x276310,_0x3d32b6){scripts[_0xa784('0x60')](_0x276310['text'],_0x276310['google_tts_language']||'en',0x1)[_0xa784('0x13')](function(_0x1a065b){_0x3d32b6(null,_0x1a065b);})[_0xa784('0x1b')](function(_0x37d764){_0x3d32b6(_0x37d764);});};AGIVertices['prototype']['restAPI']=function(_0x4aa277,_0x129b78){var _0x2ada54={'uri':_0x4aa277[_0xa784('0x61')],'method':_0x4aa277[_0xa784('0x62')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4aa277[_0xa784('0x63')])===_0xa784('0x64')&&parseInt(_0x4aa277[_0xa784('0x63')])>=0x1?parseInt(_0x4aa277['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xa784('0x65')]([_0xa784('0x66'),_0xa784('0x67')],_0x2ada54[_0xa784('0x62')][_0xa784('0x68')]())){try{_0x2ada54[_0xa784('0x69')]=_0x4aa277['rawBody']?JSON['parse'](_0x4aa277[_0xa784('0x9')]):{};}catch(_0x342fb1){logger[_0xa784('0x2c')](_0xa784('0x6a'),_0x342fb1);}}try{_0x2ada54['headers']=_0x4aa277[_0xa784('0x8')]?JSON[_0xa784('0x6b')](_0x4aa277[_0xa784('0x8')]):{};}catch(_0x20e199){logger[_0xa784('0x2c')](_0xa784('0x6c'),_0x20e199);}if(_0x4aa277['computedVariables']){try{var _0x1bcd24=require(_0x4aa277[_0xa784('0x6d')])[_0xa784('0x6e')](this,_0x2ada54);_0x2ada54[_0xa784('0x6f')]=Mustache[_0xa784('0x70')](_0x4aa277['url'],_0x1bcd24,{},['$$','$$']);if(_0x2ada54[_0xa784('0x71')]){_0x2ada54[_0xa784('0x71')]=JSON[_0xa784('0x6b')](Mustache[_0xa784('0x70')](JSON[_0xa784('0x72')](_0x2ada54[_0xa784('0x71')]),_0x1bcd24,{},['$$','$$']));}if(_0x2ada54[_0xa784('0x69')]){_0x2ada54[_0xa784('0x69')]=JSON['parse'](Mustache[_0xa784('0x70')](JSON[_0xa784('0x72')](_0x2ada54[_0xa784('0x69')]),_0x1bcd24,{},['$$','$$']));}}catch(_0x3a6e4f){logger[_0xa784('0x2c')](_0xa784('0x73'),_0x3a6e4f);}}rp(_0x2ada54)[_0xa784('0x13')](function(_0x453f88){var _0x4977e6={'statusCode':_0x453f88[_0xa784('0x74')]||0xc8,'statusMessage':_0x453f88[_0xa784('0x75')]||'OK','headers':_0x453f88[_0xa784('0x71')]||{},'body':_0x453f88[_0xa784('0x69')]||{}};_0x129b78(null,_0x4977e6);})[_0xa784('0x1b')](function(_0x10e221){var _0x248c37={'statusCode':_0x10e221[_0xa784('0x74')]||0x1f4,'statusMessage':_0x10e221[_0xa784('0x76')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x10e221['options']['headers']||{},'body':_0x10e221[_0xa784('0x77')][_0xa784('0x69')]||{}};_0x129b78(null,_0x248c37);});};AGIVertices[_0xa784('0x10')]['googleDialogflow']=function(_0x275144,_0x3ee0ce){scripts[_0xa784('0x78')](this['channel'][_0xa784('0x36')],_0x275144['key'],_0x275144[_0xa784('0x5c')],_0x275144[_0xa784('0x79')]||'en')['then'](function(_0x21c640){_0x3ee0ce(null,_0x21c640);})['catch'](function(_0x574b01){_0x3ee0ce(_0x574b01);});};AGIVertices['prototype']['googleDialogflowV2']=function(_0x1df7e3,_0x4a9c8c){scripts['googleDialogflowV2'](this[_0xa784('0xd')][_0xa784('0x36')],_0x1df7e3[_0xa784('0x7a')],_0x1df7e3[_0xa784('0x7b')],_0x1df7e3[_0xa784('0x7c')],_0x1df7e3['text'],_0x1df7e3[_0xa784('0x7d')]||'en')[_0xa784('0x13')](function(_0x4c0082){_0x4a9c8c(null,_0x4c0082);})[_0xa784('0x1b')](function(_0x30a565){_0x4a9c8c(_0x30a565);});};AGIVertices[_0xa784('0x10')][_0xa784('0x7e')]=function(_0xbcb504,_0x447f42){scripts[_0xa784('0x7e')](this[_0xa784('0xd')],_0xbcb504)[_0xa784('0x13')](function(_0x411a10){_0x447f42(null,_0x411a10);})[_0xa784('0x1b')](function(_0x13ae84){_0x447f42(_0x13ae84);});};AGIVertices['prototype'][_0xa784('0x7f')]=function(_0x46bb7e,_0x5ecac1){scripts[_0xa784('0x7f')](_0x46bb7e[_0xa784('0x80')],_0x46bb7e['text'],_0x46bb7e[_0xa784('0x81')]||_0xa784('0x82'),_0x46bb7e[_0xa784('0x83')])['then'](function(_0x1be091){_0x5ecac1(null,_0x1be091);})[_0xa784('0x1b')](function(_0x53e3cd){_0x5ecac1(_0x53e3cd);});};AGIVertices['prototype'][_0xa784('0x84')]=function(_0x10435f,_0x49933f,_0x411709){scripts[_0xa784('0x84')](_0x49933f,_0x10435f['key'],_0x10435f['ispeech_asr_language']||'en-US',this[_0xa784('0x85')](_0x10435f[_0xa784('0x86')])?_0x10435f[_0xa784('0x86')]:undefined)[_0xa784('0x13')](function(_0x932421){_0x411709(null,_0x932421);})[_0xa784('0x1b')](function(_0x17a5bd){_0x411709(_0x17a5bd);});};AGIVertices[_0xa784('0x10')][_0xa784('0x87')]=function(_0x249f33,_0xbd9b1){scripts[_0xa784('0x87')](_0x249f33['aws_access_key_id'],_0x249f33[_0xa784('0x88')],_0x249f33[_0xa784('0x89')],_0x249f33[_0xa784('0x8a')]||_0xa784('0x8b'),_0x249f33[_0xa784('0x5c')],_0x249f33['aws_text_type']||_0xa784('0x5c'))[_0xa784('0x13')](function(_0x40f701){_0xbd9b1(null,_0x40f701);})[_0xa784('0x1b')](function(_0x5b0095){_0xbd9b1(_0x5b0095);});};AGIVertices['prototype'][_0xa784('0x8c')]=function(_0x19e9df,_0x344ec0){scripts['awsLex'](this[_0xa784('0xd')][_0xa784('0x36')],_0x19e9df[_0xa784('0x8d')],_0x19e9df['aws_secret_access_key'],_0x19e9df[_0xa784('0x8e')],_0x19e9df[_0xa784('0x5c')],_0x19e9df[_0xa784('0x8f')])[_0xa784('0x13')](function(_0x52ab8f){_0x344ec0(null,_0x52ab8f);})['catch'](function(_0x3a3a94){_0x344ec0(_0x3a3a94);});};AGIVertices['prototype']['googleASR']=function(_0x52a81f,_0x2e053d,_0x249651){scripts[_0xa784('0x90')](_0x2e053d,_0x52a81f[_0xa784('0x80')],_0x52a81f['google_asr_language']||_0xa784('0x82'))[_0xa784('0x13')](function(_0x21b2b1){_0x249651(null,_0x21b2b1);})[_0xa784('0x1b')](function(_0x2b8ad0){_0x249651(_0x2b8ad0);});};AGIVertices[_0xa784('0x10')]['tildeASR']=function(_0x415c9d,_0x551ffb,_0x1cc91c){scripts[_0xa784('0x91')](_0x551ffb,_0x415c9d[_0xa784('0x92')],_0x415c9d['appsecret'],_0x415c9d[_0xa784('0x6f')])[_0xa784('0x13')](function(_0x255794){_0x1cc91c(null,_0x255794);})[_0xa784('0x1b')](function(_0x1d15ec){_0x1cc91c(_0x1d15ec);});};AGIVertices['prototype'][_0xa784('0x93')]=function(_0x313af7){var _0xe02350=_[_0xa784('0x65')](verticesWithRetry,_0x313af7[_0xa784('0x38')])?_0x313af7:_['clone'](_0x313af7);for(var _0x533405 in _0xe02350){if(_0xe02350[_0xa784('0x94')](_0x533405)){if(_0xe02350[_0x533405]&&_[_0xa784('0x95')](_0xe02350[_0x533405])){if(_[_0xa784('0x65')](recursiveMapAttributes,_0x533405)){_0xe02350[_0x533405]=this[_0xa784('0x96')](_0xe02350[_0x533405]);}else{_0xe02350[_0x533405]=this[_0xa784('0x97')](_0xe02350[_0x533405]);}}}}return _0xe02350;};AGIVertices[_0xa784('0x10')]['recursiveNodeIndex']=function(_0x5aefd6){for(var _0x14df24 in _0x5aefd6){if(_0x5aefd6[_0xa784('0x94')](_0x14df24)){if(_[_0xa784('0x98')](_0x5aefd6[_0x14df24])){this[_0xa784('0x99')](_0x5aefd6[_0x14df24]);}else if(_[_0xa784('0x9a')](_0x5aefd6[_0x14df24])){for(var _0x52de39=0x0;_0x52de39<_0x5aefd6[_0x14df24]['length'];_0x52de39++){this[_0xa784('0x99')](_0x5aefd6[_0x14df24][_0x52de39]);}}else if(_['isString'](_0x5aefd6[_0x14df24])){_0x5aefd6[_0x14df24]=this['replaceAllVariables'](_0x5aefd6[_0x14df24]);}}}};AGIVertices[_0xa784('0x10')][_0xa784('0x9b')]=function(_0x4b1a54,_0xfc6ddd){for(var _0x63d95c in _0x4b1a54){if(_0x4b1a54['hasOwnProperty'](_0x63d95c)){if(_[_0xa784('0x98')](_0x4b1a54[_0x63d95c])){if(!_[_0xa784('0x44')](_0x4b1a54[_0x63d95c])){this[_0xa784('0x9b')](_0x4b1a54[_0x63d95c],util[_0xa784('0x2a')]('%s.%s',_0xfc6ddd,_0x63d95c));}}else if(_['isArray'](_0x4b1a54[_0x63d95c])){for(var _0x16da03=0x0;_0x16da03<_0x4b1a54[_0x63d95c][_0xa784('0x9c')];_0x16da03++){this['saveRestApiResult'](_0x4b1a54[_0x63d95c][_0x16da03],util[_0xa784('0x2a')]('%s.%s',_0xfc6ddd,_0x63d95c+'['+_0x16da03+']'));}}else{if(!_[_0xa784('0x45')](_0x4b1a54[_0x63d95c])){this[_0xa784('0xd')][_0xa784('0x9d')](util[_0xa784('0x2a')](_0xa784('0x9e'),_0xfc6ddd,_0x63d95c),_0x4b1a54[_0x63d95c]);}}}}};AGIVertices[_0xa784('0x10')][_0xa784('0x96')]=function(_0x588030){try{var _0x526a86=JSON[_0xa784('0x6b')](_0x588030);this[_0xa784('0x99')](_0x526a86);return JSON[_0xa784('0x72')](_0x526a86);}catch(_0x2a31c9){return this['replaceAllVariables'](_0x588030);}};AGIVertices[_0xa784('0x10')]['replaceAllVariables']=function(_0x223974){var _0x121aaf=_0x223974[_0xa784('0x9f')]('{');for(var _0x9acd88=0x1;_0x9acd88<_0x121aaf[_0xa784('0x9c')];_0x9acd88+=0x1){var _0x1926eb=_0x121aaf[_0x9acd88][_0xa784('0x9f')]('}');if(_0x1926eb[_0xa784('0x9c')]>0x1){_0x223974=_0x223974[_0xa784('0xa0')]('{'+_0x1926eb[0x0]+'}',this['channel'][_0xa784('0x11')](_0x1926eb[0x0])[_0xa784('0xa1')]||_0x1926eb[0x0]);}}if(_0x121aaf['length']===0x1){return _0x223974['toString']();}return this[_0xa784('0x97')](_0x223974);};AGIVertices['prototype'][_0xa784('0xa2')]=function(_0x1792b7,_0x113361){var _0x5a633e=this[_0xa784('0xd')][_0xa784('0x11')](_0x1792b7);if(_0x5a633e[_0xa784('0xa3')]===-0x1){return _0x5a633e;}logger[_0xa784('0x2e')](util[_0xa784('0x2a')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x113361,_0x5a633e[_0xa784('0xa1')]));return this[_0xa784('0xd')][_0xa784('0x9d')](_0x113361,_0x5a633e[_0xa784('0xa1')]);};AGIVertices[_0xa784('0x10')]['isConfigured']=function(_0x259453){return _0x259453&&_0x259453!=='0'&&_0x259453!=='-1'&&_0x259453!=='';};AGIVertices[_0xa784('0x10')][_0xa784('0xa4')]=function(_0x5e74c9){this['createSquareDetailsReport']['sync'](this,_0x5e74c9,'-');_0x5e74c9[_0xa784('0xa5')]=_0x5e74c9['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0xa784('0xa6')]=function(_0x1fe56a){logger[_0xa784('0x2e')](util[_0xa784('0x2a')](_0xa784('0xa7'),_0x1fe56a[_0xa784('0x37')]));if(!this[_0xa784('0x85')](_0x1fe56a[_0xa784('0x5c')])){return this['channel']['noop'](_0xa784('0xa8'));}var _0xded129='\x22'+_0x1fe56a[_0xa784('0x5c')]+'\x22';if(this[_0xa784('0x85')](_0x1fe56a['options'])){_0xded129+=','+_0x1fe56a['options'];}var _0x274e80=this['channel'][_0xa784('0x57')](_0xa784('0xa9'),_0xded129);if(_0x274e80[_0xa784('0xa3')]===-0x1){return _0x274e80;}return this[_0xa784('0xd')]['noop'](util[_0xa784('0x2a')](_0xa784('0xaa'),_0xded129));};AGIVertices[_0xa784('0x10')][_0xa784('0xab')]=function(_0x433979){logger['info'](util[_0xa784('0x2a')](_0xa784('0xac'),_0x433979[_0xa784('0x37')]));if(!this['isConfigured'](_0x433979['grammar'])){return this[_0xa784('0xd')][_0xa784('0xad')](_0xa784('0xae'));}var _0x1a13fd=_0x433979[_0xa784('0xaf')];if(this[_0xa784('0x85')](_0x433979[_0xa784('0x77')])){_0x1a13fd+=','+_0x433979['options'];}var _0x272d3d=this[_0xa784('0xd')][_0xa784('0x57')](_0xa784('0xb0'),_0x1a13fd);if(_0x272d3d[_0xa784('0xa3')]===-0x1){return _0x272d3d;}var _0xe329d=this[_0xa784('0xa2')](_0xa784('0xb1'),'MRCP_RECOG_CONFIDENCE');if(_0xe329d[_0xa784('0xa3')]===-0x1){return _0xe329d;}var _0x3e308b=this[_0xa784('0xa2')](_0xa784('0xb2'),_0xa784('0xb3'));if(_0x3e308b['result']===-0x1){return _0x3e308b;}var _0xb53824=this[_0xa784('0xa2')](_0xa784('0xb4'),_0xa784('0xb5'));if(_0xb53824[_0xa784('0xa3')]===-0x1){return _0xb53824;}return this[_0xa784('0xd')][_0xa784('0xad')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x1a13fd));};AGIVertices[_0xa784('0x10')][_0xa784('0xb6')]=function(_0x310e20){logger[_0xa784('0x2e')](util[_0xa784('0x2a')](_0xa784('0xb7'),_0x310e20[_0xa784('0x37')]));return this['channel'][_0xa784('0xb6')]([_0x310e20[_0xa784('0xb8')],_0x310e20['args']]);};AGIVertices[_0xa784('0x10')][_0xa784('0xb9')]=function(_0x4b2594){logger['info'](util[_0xa784('0x2a')](_0xa784('0xba'),_0x4b2594[_0xa784('0x37')]));if(this[_0xa784('0x85')](_0x4b2594[_0xa784('0x63')])){logger['info'](util[_0xa784('0x2a')](_0xa784('0xbb'),_0x4b2594[_0xa784('0x63')]));var _0xcb8004=this[_0xa784('0xd')]['wait'](_0x4b2594[_0xa784('0x63')]);if(_0xcb8004[_0xa784('0xa3')]===-0x1){return _0xcb8004;}}return this['channel'][_0xa784('0xb9')]();};AGIVertices[_0xa784('0x10')][_0xa784('0x4a')]=function(_0x3ff437){logger['info'](util['format'](_0xa784('0xbc'),_0x3ff437['label']));if(!this[_0xa784('0x85')](_0x3ff437['list_id'])){return this['channel'][_0xa784('0x2c')](_0x3ff437,_0xa784('0xbd'));}_0x3ff437[_0xa784('0x49')]=moment();if(this[_0xa784('0x85')](_0x3ff437[_0xa784('0xbe')])){_0x3ff437[_0xa784('0x49')]=moment()[_0xa784('0xbf')](_0x3ff437['delay'],'minutes');}if(!this[_0xa784('0x85')](_0x3ff437['callback_priority'])){_0x3ff437[_0xa784('0x4c')]=0x2;}this[_0xa784('0x43')][_0xa784('0x6e')](this,_0x3ff437);return this['channel'][_0xa784('0xad')](util[_0xa784('0x2a')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x3ff437[_0xa784('0xc0')],_0x3ff437[_0xa784('0xc1')],_0x3ff437[_0xa784('0x49')]));};AGIVertices[_0xa784('0x10')][_0xa784('0xc2')]=function(_0x3ae461){logger[_0xa784('0x2e')](util[_0xa784('0x2a')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x3ae461['label']));var _0x11eb43=this[_0xa784('0xd')][_0xa784('0x57')](_0x3ae461[_0xa784('0xc3')],_0x3ae461[_0xa784('0x77')]);if(_0x11eb43[_0xa784('0xa3')]===-0x1){return _0x11eb43;}return this['channel'][_0xa784('0xad')](util[_0xa784('0x2a')](_0xa784('0xc4'),_0x3ae461[_0xa784('0xc3')],_0x3ae461[_0xa784('0x77')]));};AGIVertices['prototype'][_0xa784('0xc5')]=function(_0x3dae3e){logger['info'](util[_0xa784('0x2a')](_0xa784('0xc6'),_0x3dae3e[_0xa784('0x37')]));if(!this[_0xa784('0x85')](_0x3dae3e[_0xa784('0x5c')])){return this['channel']['noop']('no\x20text\x20configured');}var _0x5314bb='\x22'+_0x3dae3e['text']+'\x22';if(this['isConfigured'](_0x3dae3e['options'])){_0x5314bb+=','+_0x3dae3e['options'];}var _0x43d908=this['channel'][_0xa784('0x57')](_0xa784('0xa9'),_0x5314bb);if(_0x43d908[_0xa784('0xa3')]===-0x1){return _0x43d908;}return this['channel'][_0xa784('0xad')](util[_0xa784('0x2a')]('Executed\x20command\x20MRCPSynth\x20%s',_0x5314bb));};AGIVertices[_0xa784('0x10')][_0xa784('0xc7')]=function(_0x44bc50){logger[_0xa784('0x2e')](util['format'](_0xa784('0xc8'),_0x44bc50[_0xa784('0x37')]));if(!this[_0xa784('0x85')](_0x44bc50[_0xa784('0x5c')])){return this[_0xa784('0xd')][_0xa784('0xad')](_0xa784('0xa8'));}var _0x1216f7='\x22'+_0x44bc50[_0xa784('0x5c')]+'\x22';if(this[_0xa784('0x85')](_0x44bc50[_0xa784('0x77')])){_0x1216f7+=','+_0x44bc50[_0xa784('0x77')];}var _0x5be86b=this[_0xa784('0xd')]['exec']('MRCPSynth',_0x1216f7);if(_0x5be86b[_0xa784('0xa3')]===-0x1){return _0x5be86b;}return this[_0xa784('0xd')][_0xa784('0xad')](util[_0xa784('0x2a')](_0xa784('0xaa'),_0x1216f7));};AGIVertices[_0xa784('0x10')][_0xa784('0xc9')]=function(_0x4e3127){logger[_0xa784('0x2e')](util[_0xa784('0x2a')](_0xa784('0xca'),_0x4e3127[_0xa784('0x37')]));if(!this[_0xa784('0x85')](_0x4e3127[_0xa784('0xaf')])){return this['channel'][_0xa784('0xad')](_0xa784('0xae'));}var _0x132ebb=_0x4e3127[_0xa784('0xaf')];if(this[_0xa784('0x85')](_0x4e3127['options'])){_0x132ebb+=','+_0x4e3127[_0xa784('0x77')];}var _0x490547=this[_0xa784('0xd')][_0xa784('0x57')](_0xa784('0xb0'),_0x132ebb);if(_0x490547[_0xa784('0xa3')]===-0x1){return _0x490547;}var _0x31294d=this[_0xa784('0xa2')](_0xa784('0xb1'),_0xa784('0xcb'));if(_0x31294d[_0xa784('0xa3')]===-0x1){return _0x31294d;}var _0x288981=this[_0xa784('0xa2')](_0xa784('0xb2'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x288981[_0xa784('0xa3')]===-0x1){return _0x288981;}var _0x4238a7=this[_0xa784('0xa2')](_0xa784('0xb4'),_0xa784('0xcc'));if(_0x4238a7['result']===-0x1){return _0x4238a7;}return this['channel'][_0xa784('0xad')](util[_0xa784('0x2a')](_0xa784('0xcd'),_0x132ebb));};AGIVertices[_0xa784('0x10')][_0xa784('0xce')]=function(_0x43fc6c){logger['info'](util[_0xa784('0x2a')](_0xa784('0xcf'),_0x43fc6c[_0xa784('0x37')]));if(!this[_0xa784('0x85')](_0x43fc6c[_0xa784('0xaf')])){return this[_0xa784('0xd')][_0xa784('0xad')](_0xa784('0xae'));}var _0x2e909a=_0x43fc6c[_0xa784('0xaf')];if(this['isConfigured'](_0x43fc6c['options'])){_0x2e909a+=','+_0x43fc6c[_0xa784('0x77')];}var _0x201f58=this[_0xa784('0xd')][_0xa784('0x57')]('MRCPRecog',_0x2e909a);if(_0x201f58['result']===-0x1){return _0x201f58;}var _0x249d68=this[_0xa784('0xa2')](_0xa784('0xb1'),_0xa784('0xd0'));if(_0x249d68['result']===-0x1){return _0x249d68;}var _0x380b73=this[_0xa784('0xa2')](_0xa784('0xb2'),'SESTEK_ASR_TRANSCRIPT');if(_0x380b73[_0xa784('0xa3')]===-0x1){return _0x380b73;}var _0x84a8cf=this['getAndSetVariable'](_0xa784('0xb4'),_0xa784('0xd1'));if(_0x84a8cf[_0xa784('0xa3')]===-0x1){return _0x84a8cf;}return this[_0xa784('0xd')][_0xa784('0xad')](util['format'](_0xa784('0xcd'),_0x2e909a));};AGIVertices['prototype'][_0xa784('0xd2')]=function(_0x3deb7e){logger[_0xa784('0x2e')](util[_0xa784('0x2a')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x3deb7e['label']));if(!this[_0xa784('0x85')](_0x3deb7e['odbc_id'])){return this[_0xa784('0xd')]['error'](_0x3deb7e,'no\x20database\x20selected');}var _0x31479f=this[_0xa784('0x19')]['sync'](this,_0x3deb7e[_0xa784('0xd3')]);if(!_0x31479f){return this[_0xa784('0xd')]['error'](_0x3deb7e,'no\x20odbc\x20database\x20found');}if(!this[_0xa784('0x85')](_0x3deb7e[_0xa784('0x30')])){return this[_0xa784('0xd')][_0xa784('0x2c')](_0x3deb7e,_0xa784('0xd4'));}var _0x18eec8=_0x3deb7e['query'][_0xa784('0x59')](/(\r\n|\n|\r)/gm,'\x20');this[_0xa784('0xd')][_0xa784('0xad')](util[_0xa784('0x2a')]('query:\x20%s',_0x18eec8));var _0x38e882=this[_0xa784('0xd5')]['sync'](this,_0x31479f,_0x18eec8);this[_0xa784('0xd6')]['sync'](this,_0x3deb7e,_0x18eec8);if(!this[_0xa784('0x85')](_0x3deb7e[_0xa784('0xd7')])){return this['channel'][_0xa784('0xad')](_0xa784('0xd8'));}var _0x4c2fbd=this[_0xa784('0x11')][_0xa784('0x6e')](this,_0x3deb7e[_0xa784('0xd7')]);if(!_0x4c2fbd){return this[_0xa784('0xd')][_0xa784('0x2c')](_0x3deb7e,'no\x20variable\x20found');}var _0x2b337a=this;_0x38e882['forEach'](function(_0x131268,_0x295197){Object['keys'](_0x131268)['forEach'](function(_0x178dfa){_0x2b337a['channel'][_0xa784('0x9d')](util[_0xa784('0x2a')]('%s[%s][%s]',_0x4c2fbd,_0x295197,_0x178dfa),_0x131268[_0x178dfa]);});});this['channel']['setVariable'](util[_0xa784('0x2a')](_0xa784('0xd9'),_0x4c2fbd),_0x38e882[_0xa784('0x9c')]);return this[_0xa784('0xd')][_0xa784('0xad')](util['format'](_0xa784('0xda'),_0x4c2fbd));};AGIVertices[_0xa784('0x10')][_0xa784('0xdb')]=function(_0x2bc86e){logger['debug'](util[_0xa784('0x2a')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x2bc86e['label']));if(!this[_0xa784('0x85')](_0x2bc86e[_0xa784('0xdc')])){return this[_0xa784('0xd')][_0xa784('0x2c')](_0x2bc86e,_0xa784('0xdd'));}var _0x459a17=this[_0xa784('0xde')][_0xa784('0x6e')](this,_0x2bc86e['sip_id']);if(!_0x459a17){return this[_0xa784('0xd')]['error'](_0x2bc86e,_0xa784('0xdf'));}var _0x39caa6=this[_0xa784('0xd')][_0xa784('0x57')](_0xa784('0xe0'),[util[_0xa784('0x2a')]('SIP/%s',_0x459a17),_0x2bc86e[_0xa784('0x63')],_0x2bc86e[_0xa784('0xe1')],_0x2bc86e[_0xa784('0x61')]]);if(_0x39caa6[_0xa784('0xa3')]===-0x1){return _0x39caa6;}return this['channel'][_0xa784('0xad')](util[_0xa784('0x2a')]('Executed\x20command\x20%s',_0xa784('0xe0')));};AGIVertices['prototype']['dialogflow']=function(_0x4c0168){logger['info'](util[_0xa784('0x2a')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x4c0168[_0xa784('0x37')]));if(!this['isConfigured'](_0x4c0168[_0xa784('0x80')])){return this[_0xa784('0xd')]['noop'](_0xa784('0xe2'));}if(!this[_0xa784('0x85')](_0x4c0168[_0xa784('0x5c')])){return this['channel'][_0xa784('0xad')](_0xa784('0xa8'));}this[_0xa784('0xd')][_0xa784('0xe3')]=!![];this['createSquareDetailsReport'](_0x4c0168);this['createSquareMessage'](_0x4c0168[_0xa784('0x5c')],'in','','');this[_0xa784('0xd')]['noop'](util[_0xa784('0x2a')]('Trying\x20Dialogflow:\x20%s',_0x4c0168[_0xa784('0x5c')]));var _0x288ffe=this['googleDialogflow'][_0xa784('0x6e')](this,_0x4c0168);if(_0x288ffe){for(var _0x584ebf in _0x288ffe){if(_0x288ffe['hasOwnProperty'](_0x584ebf)){this[_0xa784('0xd')][_0xa784('0x9d')](util[_0xa784('0x2a')](_0xa784('0xe4'),_0x584ebf[_0xa784('0x68')]()),_0x288ffe[_0x584ebf]);}}this[_0xa784('0x42')](_0x288ffe['speech'],_0xa784('0xe5'),_0xa784('0xe6'),'');return this[_0xa784('0xd')][_0xa784('0xad')](util[_0xa784('0x2a')](_0xa784('0xe7'),_0x288ffe[_0xa784('0xe8')]));}return this[_0xa784('0xd')][_0xa784('0x2c')](_0x4c0168,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0xa784('0x10')]['dialogflowV2']=function(_0x719369){logger[_0xa784('0x2e')](util[_0xa784('0x2a')](_0xa784('0xe9'),_0x719369[_0xa784('0x37')]));if(!this[_0xa784('0x85')](_0x719369['dialogflowV2_project_id'])){return this[_0xa784('0xd')]['noop'](_0xa784('0xea'));}if(!this[_0xa784('0x85')](_0x719369['client_email'])){return this[_0xa784('0xd')][_0xa784('0xad')]('no\x20client_email\x20configured');}if(!this[_0xa784('0x85')](_0x719369[_0xa784('0x7c')])){return this['channel'][_0xa784('0xad')](_0xa784('0xeb'));}if(!this['isConfigured'](_0x719369['dialogflowV2_language'])){return this[_0xa784('0xd')][_0xa784('0xad')](_0xa784('0xec'));}if(!this['isConfigured'](_0x719369[_0xa784('0x5c')])){return this['channel'][_0xa784('0xad')](_0xa784('0xa8'));}this['channel']['bot']=!![];this['createSquareDetailsReport'](_0x719369);this[_0xa784('0x42')](_0x719369[_0xa784('0x5c')],'in','','');this['channel'][_0xa784('0xad')](util[_0xa784('0x2a')]('Trying\x20DialogflowV2:\x20%s',_0x719369['text']));var _0x2af80f=this['googleDialogflowV2'][_0xa784('0x6e')](this,_0x719369);if(_0x2af80f){for(var _0x543114 in _0x2af80f){if(_0x2af80f[_0xa784('0x94')](_0x543114)){if(_0x543114!=='providerResponse'){this[_0xa784('0xd')][_0xa784('0x9d')](util[_0xa784('0x2a')](_0xa784('0xe4'),_0x543114[_0xa784('0x68')]()),_0x2af80f[_0x543114]);}}}this[_0xa784('0x42')](_0x2af80f['speech'],_0xa784('0xe5'),'dialogflowV2',_0x2af80f[_0xa784('0xed')]);return this['channel'][_0xa784('0xad')](util['format'](_0xa784('0xee'),_0x2af80f[_0xa784('0xe8')]));}return this['channel'][_0xa784('0x2c')](_0x719369,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0xa784('0x10')][_0xa784('0xef')]=function(_0x3fa459){logger[_0xa784('0x2e')](util['format'](_0xa784('0xf0'),_0x3fa459[_0xa784('0x37')]));if(!this[_0xa784('0x85')](_0x3fa459[_0xa784('0xf1')])){return this[_0xa784('0xd')][_0xa784('0xad')]('no\x20ndauth\x20url\x20configured');}if(!this['isConfigured'](_0x3fa459['username'])){return this[_0xa784('0xd')][_0xa784('0xad')]('no\x20username\x20configured');}if(!this['isConfigured'](_0x3fa459[_0xa784('0xf2')])){return this[_0xa784('0xd')][_0xa784('0xad')](_0xa784('0xf3'));}if(!this['isConfigured'](_0x3fa459[_0xa784('0xf4')])){return this[_0xa784('0xd')][_0xa784('0xad')](_0xa784('0xa8'));}this[_0xa784('0xd')]['bot']=!![];this[_0xa784('0xd6')](_0x3fa459);this[_0xa784('0x42')](_0x3fa459[_0xa784('0x5c')],'in','','');this['channel']['noop'](util[_0xa784('0x2a')](_0xa784('0xf5'),_0x3fa459[_0xa784('0x5c')]));var _0x1fc324=this[_0xa784('0x7e')][_0xa784('0x6e')](this,_0x3fa459);if(_0x1fc324){for(var _0x2010a7 in _0x1fc324){if(_0x1fc324['hasOwnProperty'](_0x2010a7)){this[_0xa784('0xd')][_0xa784('0x9d')](util[_0xa784('0x2a')](_0xa784('0xf6'),_0x2010a7[_0xa784('0x68')]()),_0x1fc324[_0x2010a7]);}}this['createSquareMessage'](_0x1fc324[_0xa784('0xe8')],_0xa784('0xe5'),_0xa784('0xef'),'');if(_0x1fc324[_0xa784('0xf7')]){this[_0xa784('0xd')]['noop'](util[_0xa784('0x2a')](_0xa784('0xf8'),_0x1fc324[_0xa784('0xf7')]));var _0xeea2e1=this['channel'][_0xa784('0xf9')](_0x1fc324['audiofile']);try{fs[_0xa784('0xfa')](_0x1fc324[_0xa784('0xf7')]+'.wav');}catch(_0x110842){logger['error'](_0x110842);}return _0xeea2e1;}else{return this[_0xa784('0xd')][_0xa784('0xad')](util[_0xa784('0x2a')](_0xa784('0xfb'),_0x1fc324[_0xa784('0xe8')]));}}return this[_0xa784('0xd')][_0xa784('0x2c')](_0x3fa459,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xa784('0x10')][_0xa784('0xfc')]=function(_0x102cea){logger[_0xa784('0x2e')](util['format'](_0xa784('0xfd'),_0x102cea['label']));return this[_0xa784('0xd')][_0xa784('0xad')](_0xa784('0xfc'));};AGIVertices[_0xa784('0x10')][_0xa784('0xfe')]=function(_0x595b8c){logger[_0xa784('0x2e')](util[_0xa784('0x2a')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x595b8c['label']));var _0x44a37d='';if(_0x595b8c[_0xa784('0xff')]){if(!this['isConfigured'](_0x595b8c[_0xa784('0xff')])){return this[_0xa784('0xd')][_0xa784('0x2c')](_0x595b8c,_0xa784('0x100'));}else{var _0x21f535=parseInt(_0x595b8c[_0xa784('0xff')],0xa);if(isNaN(_0x21f535)){_0x44a37d=_0x595b8c[_0xa784('0xff')];}else{_0x44a37d=this[_0xa784('0x1c')][_0xa784('0x6e')](this,_0x595b8c[_0xa784('0xff')]);if(!_0x44a37d){return this['channel'][_0xa784('0x2c')](_0x595b8c,_0xa784('0x101'));}}}}else if(_0x595b8c['trunk_name']){_0x44a37d=_0x595b8c['trunk_name'];}else{return this['channel'][_0xa784('0x2c')](_0x595b8c,_0xa784('0x100'));}var _0x27fb68=this[_0xa784('0xd')]['exec']('DIAL',[util['format'](_0xa784('0x102'),_0x44a37d,_0x595b8c[_0xa784('0xc0')]),_0x595b8c[_0xa784('0x63')],_0x595b8c[_0xa784('0xe1')],_0x595b8c['url']]);if(_0x27fb68['result']===-0x1){return _0x27fb68;}return this[_0xa784('0xd')]['noop'](util[_0xa784('0x2a')](_0xa784('0x103'),_0xa784('0xe0')));};AGIVertices[_0xa784('0x10')][_0xa784('0x104')]=function(_0x213cc7){logger[_0xa784('0x2e')](util[_0xa784('0x2a')](_0xa784('0x105'),_0x213cc7['label']));return this[_0xa784('0xd')]['noop'](_0xa784('0x104'));};AGIVertices['prototype'][_0xa784('0xb')]=function(_0x3ebe44){logger[_0xa784('0x2e')](util[_0xa784('0x2a')](_0xa784('0x106'),_0x3ebe44[_0xa784('0x37')]));if(_0x3ebe44['retry']===0x0){return this[_0xa784('0xa4')](_0x3ebe44);}_0x3ebe44['retry']-=0x1;if(!this[_0xa784('0x85')](_0x3ebe44[_0xa784('0x107')])){return this[_0xa784('0xd')][_0xa784('0x2c')](_0x3ebe44,_0xa784('0x108'));}var _0x2043d9=this['getSound'][_0xa784('0x6e')](this,_0x3ebe44[_0xa784('0x107')]);if(!_0x2043d9){return this['channel'][_0xa784('0x2c')](_0x3ebe44,_0xa784('0x109'));}if(!this[_0xa784('0x85')](_0x3ebe44[_0xa784('0xd7')])){return this[_0xa784('0xd')]['error'](_0xa784('0xd8'));}var _0x37ddb0=this['channel']['getData'](_0x2043d9,_0x3ebe44[_0xa784('0x10a')],_0x3ebe44[_0xa784('0x10b')]);var _0x3ece0f=_0x37ddb0[_0xa784('0xa3')]?_0x37ddb0[_0xa784('0xa3')][_0xa784('0x10c')]():'';logger[_0xa784('0x2e')](_0xa784('0x10d'),JSON[_0xa784('0x72')](_0x37ddb0));if(_0x37ddb0[_0xa784('0xa3')]===-0x1){this[_0xa784('0xd6')][_0xa784('0x6e')](this,_0x3ebe44,_0x3ece0f);return _0x37ddb0;}else if(_0x37ddb0[_0xa784('0xa1')]===_0xa784('0x63')){_0x37ddb0[_0xa784('0xa3')]=_0x3ece0f[_0xa784('0x9c')]>=parseInt(_0x3ebe44[_0xa784('0x10e')])?'x':'i';}else{_0x37ddb0[_0xa784('0xa3')]=_0x3ece0f[_0xa784('0x9c')]>=parseInt(_0x3ebe44['mindigit'])&&_0x3ece0f['length']<=parseInt(_0x3ebe44[_0xa784('0x10b')])?'x':'i';}var _0x24072b=this[_0xa784('0x11')][_0xa784('0x6e')](this,_0x3ebe44[_0xa784('0xd7')]);if(!_0x24072b){return this[_0xa784('0xd')][_0xa784('0x2c')](_0x3ebe44,_0xa784('0x10f'));}this[_0xa784('0xd')][_0xa784('0x9d')](_0x24072b,_0x3ece0f);if(this[_0xa784('0x85')](_0x3ebe44[_0xa784('0x110')])){var _0x190482=parseInt(_0x3ebe44[_0xa784('0x110')],0xa);var _0x2f477f=rs[_0xa784('0x111')]({'charset':'*','length':_0x190482});var _0xe343ec=_0x3ece0f[_0xa784('0x9c')];if(_0xe343ec>0x0){if(_0xe343ec>_0x190482){this['createSquareDetailsReport'][_0xa784('0x6e')](this,_0x3ebe44,_0x3ebe44['hiddendigitspos']==='first'?_0x2f477f+_0x3ece0f[_0xa784('0x112')](_0x190482):_0x3ece0f[_0xa784('0x112')](0x0,_0xe343ec-_0x190482)+_0x2f477f);}else{this[_0xa784('0xd6')]['sync'](this,_0x3ebe44,rs['generate']({'charset':'*','length':_0xe343ec}));}}else{this[_0xa784('0xd6')][_0xa784('0x6e')](this,_0x3ebe44,'');}}else{this[_0xa784('0xd6')][_0xa784('0x6e')](this,_0x3ebe44,_0x3ece0f);}return _0x37ddb0;};AGIVertices[_0xa784('0x10')][_0xa784('0xc')]=function(_0x8de82f){logger[_0xa784('0x2e')](util[_0xa784('0x2a')](_0xa784('0x113'),_0x8de82f[_0xa784('0x37')]));return this[_0xa784('0xb')](_0x8de82f);};AGIVertices[_0xa784('0x10')][_0xa784('0x114')]=function(_0xe72081){logger['info'](util[_0xa784('0x2a')](_0xa784('0x115'),_0xe72081[_0xa784('0x37')]));this[_0xa784('0xd6')]['sync'](this,_0xe72081,_0xe72081[_0xa784('0x116')]);return this[_0xa784('0xd')][_0xa784('0xad')](util[_0xa784('0x2a')]('GOAL\x20%s',_0xe72081[_0xa784('0x116')]));};AGIVertices[_0xa784('0x10')][_0xa784('0x117')]=function(_0x47e069){logger[_0xa784('0x2e')](util[_0xa784('0x2a')](_0xa784('0x118'),_0x47e069['label']));if(!this['isConfigured'](_0x47e069[_0xa784('0x8d')])||!this[_0xa784('0x85')](_0x47e069[_0xa784('0x88')])){return this[_0xa784('0xd')]['noop'](_0xa784('0x119'));}if(!this[_0xa784('0x85')](_0x47e069[_0xa784('0x5c')])){return this[_0xa784('0xd')][_0xa784('0xad')](_0xa784('0xa8'));}this[_0xa784('0xd')][_0xa784('0xad')](util[_0xa784('0x2a')]('Trying\x20aws\x20Polly\x20%s',_0x47e069[_0xa784('0x5c')]));var _0x241efd=this[_0xa784('0x87')][_0xa784('0x6e')](this,_0x47e069);if(_0x241efd){this[_0xa784('0xd')][_0xa784('0xad')](util[_0xa784('0x2a')](_0xa784('0x11a'),_0x241efd));var _0x570b7b=this[_0xa784('0xd')]['streamFile'](_0x241efd);try{fs[_0xa784('0xfa')](_0x241efd+_0xa784('0x11b'));}catch(_0x42b168){logger['error'](_0x42b168);}return _0x570b7b;}return this['channel'][_0xa784('0x2c')](_0x47e069,_0xa784('0x11c'));};AGIVertices['prototype'][_0xa784('0x11d')]=function(_0x2e0127){logger[_0xa784('0x2e')](util[_0xa784('0x2a')](_0xa784('0x11e'),_0x2e0127['label']));if(!this[_0xa784('0x85')](_0x2e0127[_0xa784('0x8d')])||!this[_0xa784('0x85')](_0x2e0127[_0xa784('0x88')])){return this['channel'][_0xa784('0xad')](_0xa784('0x119'));}if(!this['isConfigured'](_0x2e0127[_0xa784('0x8f')])){return this[_0xa784('0xd')][_0xa784('0xad')](_0xa784('0x11f'));}if(!this[_0xa784('0x85')](_0x2e0127['text'])){return this[_0xa784('0xd')][_0xa784('0xad')](_0xa784('0xa8'));}this['channel']['bot']=!![];this[_0xa784('0xd6')](_0x2e0127);this[_0xa784('0x42')](_0x2e0127[_0xa784('0x5c')],'in','','');this[_0xa784('0xd')][_0xa784('0xad')](util[_0xa784('0x2a')](_0xa784('0x120'),_0x2e0127[_0xa784('0x5c')]));var _0x1e2a44=this['awsLex'][_0xa784('0x6e')](this,_0x2e0127);if(_0x1e2a44){for(var _0x3e273d in _0x1e2a44){if(_0x1e2a44[_0xa784('0x94')](_0x3e273d)&&_[_0xa784('0x95')](_0x1e2a44[_0x3e273d])){this['channel'][_0xa784('0x9d')](util[_0xa784('0x2a')](_0xa784('0x121'),_0x3e273d[_0xa784('0x68')]()),_0x1e2a44[_0x3e273d]);}}if(_['isNil'](_0x1e2a44[_0xa784('0x76')])){return this['channel'][_0xa784('0xad')](_0xa784('0x122'));}else{this[_0xa784('0x42')](_0x1e2a44[_0xa784('0x76')],'out',_0xa784('0x123'),'');return this['channel']['noop'](util['format'](_0xa784('0x124'),_0x1e2a44[_0xa784('0x76')]));}}return this['channel']['error'](_0x2e0127,_0xa784('0x125'));};AGIVertices[_0xa784('0x10')]['googleasr']=function(_0x5d18de){logger[_0xa784('0x2e')](util[_0xa784('0x2a')](_0xa784('0x126'),_0x5d18de[_0xa784('0x37')],_0x5d18de[_0xa784('0x63')]));if(!this[_0xa784('0x85')](_0x5d18de[_0xa784('0x80')])){return this[_0xa784('0xd')]['noop'](_0xa784('0xe2'));}var _0x1e8fe9=_0xa784('0x127');var _0x56ff13=util['format'](_0xa784('0x128'),FILES_PATH,rs[_0xa784('0x111')](0x4));var _0x5a3b90=util[_0xa784('0x2a')](_0xa784('0x9e'),_0x56ff13,_0x1e8fe9);var _0x2b5e33=!![];if(_0x5d18de['beep']===_0xa784('0x129')){_0x2b5e33=![];}var _0x5181d0=this['channel'][_0xa784('0x12a')](_0x56ff13,_0x1e8fe9,_0x5d18de['intKey'],_0x5d18de[_0xa784('0x63')],undefined,_0x2b5e33);if(_0x5181d0[_0xa784('0xa3')]!==-0x1){this[_0xa784('0xd')]['noop'](util[_0xa784('0x2a')](_0xa784('0x12b'),_0x5a3b90));var _0x1a24a2=this[_0xa784('0x90')][_0xa784('0x6e')](this,_0x5d18de,_0x5a3b90);if(_0x1a24a2){for(var _0xde2106 in _0x1a24a2){if(_0x1a24a2[_0xa784('0x94')](_0xde2106)){this[_0xa784('0xd')]['setVariable'](util[_0xa784('0x2a')]('GOOGLE_ASR_%s',_0xde2106[_0xa784('0x68')]()),_0x1a24a2[_0xde2106]);}}return this[_0xa784('0xd')][_0xa784('0xad')](util[_0xa784('0x2a')](_0xa784('0x12c'),JSON[_0xa784('0x72')](_0x1a24a2)));}}return _0x5181d0;};AGIVertices[_0xa784('0x10')][_0xa784('0x12d')]=function(_0x3388d3){logger[_0xa784('0x2e')](util['format'](_0xa784('0x12e'),_0x3388d3[_0xa784('0x37')]));if(!this[_0xa784('0x85')](_0x3388d3[_0xa784('0x92')])){return this[_0xa784('0xd')]['noop'](_0xa784('0x12f'));}if(!this[_0xa784('0x85')](_0x3388d3[_0xa784('0x130')])){return this['channel']['noop']('no\x20appsecret\x20configured');}var _0x503d6f=_0xa784('0x127');var _0x300215=util[_0xa784('0x2a')]('%s/recordings/%s',FILES_PATH,rs[_0xa784('0x111')](0x4));var _0x25db71=util[_0xa784('0x2a')]('%s.%s',_0x300215,_0x503d6f);var _0x356835=!![];if(_0x3388d3[_0xa784('0x131')]==='NOBEEP'){_0x356835=![];}var _0x18323d=this['channel'][_0xa784('0x12a')](_0x300215,_0x503d6f,_0x3388d3[_0xa784('0x132')],_0x3388d3[_0xa784('0x63')],undefined,_0x356835);if(_0x18323d[_0xa784('0xa3')]!==-0x1){this[_0xa784('0xd')]['noop'](util[_0xa784('0x2a')]('tilde\x20%s\x20file\x20created',_0x25db71));var _0x5d6fcf=this['tildeASR'][_0xa784('0x6e')](this,_0x3388d3,_0x25db71);if(_0x5d6fcf){for(var _0x3dd4f9 in _0x5d6fcf){if(_0x5d6fcf[_0xa784('0x94')](_0x3dd4f9)){this[_0xa784('0xd')]['setVariable'](util[_0xa784('0x2a')](_0xa784('0x133'),_0x3dd4f9[_0xa784('0x68')]()),_0x5d6fcf[_0x3dd4f9]);}}return this['channel'][_0xa784('0xad')](util['format'](_0xa784('0x134'),JSON[_0xa784('0x72')](_0x5d6fcf)));}}return _0x18323d;};AGIVertices['prototype']['gotoc']=function(_0x120698){logger[_0xa784('0x2e')](util[_0xa784('0x2a')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x120698[_0xa784('0x37')]));return this[_0xa784('0xd')][_0xa784('0x135')](_0x120698['context'],_0x120698[_0xa784('0x3d')],_0x120698[_0xa784('0x3e')]);};AGIVertices[_0xa784('0x10')][_0xa784('0x136')]=function(_0x143ed4){logger[_0xa784('0x2e')](util[_0xa784('0x2a')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x143ed4[_0xa784('0x37')]));if(!this['isConfigured'](_0x143ed4[_0xa784('0x137')])){return this[_0xa784('0xd')][_0xa784('0x2c')](_0x143ed4,_0xa784('0x138'));}try{var _0x22ce07=eval(_0x143ed4[_0xa784('0x137')])?_0xa784('0x139'):_0xa784('0x13a');this[_0xa784('0xd')][_0xa784('0xad')](util[_0xa784('0x2a')](_0xa784('0x13b'),_0x143ed4[_0xa784('0x137')],_0x22ce07));return{'code':0xc8,'result':_0x22ce07};}catch(_0xc53c27){return{'code':0xc8,'result':_0xa784('0x13a')};}};AGIVertices['prototype']['gotoiftime']=function(_0x194585){logger[_0xa784('0x2e')](util[_0xa784('0x2a')](_0xa784('0x13c'),_0x194585[_0xa784('0x37')]));if(!this['isConfigured'](_0x194585[_0xa784('0x13d')])){return this['channel'][_0xa784('0x2c')](_0x194585,_0xa784('0x13e'));}var _0x386bb6=this[_0xa784('0x25')]['sync'](this,_0x194585[_0xa784('0x13d')]);if(!_0x386bb6){return this[_0xa784('0xd')][_0xa784('0x2c')](_0x194585,_0xa784('0x13f'));}for(var _0x2c9f02=0x0;_0x2c9f02<_0x386bb6[_0xa784('0x9c')];_0x2c9f02+=0x1){var _0x2ed2f8=this[_0xa784('0xd')][_0xa784('0x11')](util[_0xa784('0x2a')]('IFTIME(%s?true:false)',_0x386bb6[_0x2c9f02]));if(_0x2ed2f8[_0xa784('0xa3')]===-0x1){return _0x2ed2f8;}logger[_0xa784('0x2e')](util[_0xa784('0x2a')](_0xa784('0x140'),_0x386bb6[_0x2c9f02],_0x2ed2f8[_0xa784('0xa1')]));if(_0x2ed2f8['extra']===_0xa784('0x139')){logger[_0xa784('0x2e')](util['format'](_0xa784('0x140'),_0x386bb6[_0x2c9f02],_0xa784('0x139')));this[_0xa784('0xd')][_0xa784('0xad')](util[_0xa784('0x2a')](_0xa784('0x140'),_0x386bb6[_0x2c9f02],_0xa784('0x139')));return{'code':0xc8,'result':_0xa784('0x139')};}else{logger[_0xa784('0x2e')](util['format'](_0xa784('0x140'),_0x386bb6[_0x2c9f02],_0xa784('0x13a')));this[_0xa784('0xd')][_0xa784('0xad')](util['format'](_0xa784('0x140'),_0x386bb6[_0x2c9f02],_0xa784('0x13a')));}}return{'code':0xc8,'result':_0xa784('0x13a')};};AGIVertices[_0xa784('0x10')][_0xa784('0x141')]=function(_0x71a18c){logger[_0xa784('0x2e')](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x71a18c[_0xa784('0x37')]));return this['channel']['hangup']();};AGIVertices['prototype'][_0xa784('0x142')]=function(_0x49aaca){logger[_0xa784('0x2e')](util[_0xa784('0x2a')](_0xa784('0x143'),_0x49aaca['label']));if(!this[_0xa784('0x85')](_0x49aaca[_0xa784('0x80')])){return this[_0xa784('0xd')]['noop'](_0xa784('0xe2'));}var _0x1b56d7=_0xa784('0x127');var _0x14b313=util['format'](_0xa784('0x128'),FILES_PATH,rs[_0xa784('0x111')](0x4));var _0x4ed952=util[_0xa784('0x2a')](_0xa784('0x9e'),_0x14b313,_0x1b56d7);var _0x1d4534=!![];if(_0x49aaca[_0xa784('0x131')]===_0xa784('0x129')){_0x1d4534=![];}var _0x28665d=this[_0xa784('0xd')][_0xa784('0x12a')](_0x14b313,_0x1b56d7,_0x49aaca[_0xa784('0x132')],_0x49aaca[_0xa784('0x63')],undefined,_0x1d4534);if(_0x28665d[_0xa784('0xa3')]!==-0x1){this[_0xa784('0xd')][_0xa784('0xad')](util[_0xa784('0x2a')]('ispeech\x20%s\x20file\x20created',_0x4ed952));var _0x3c5717=this[_0xa784('0x84')]['sync'](this,_0x49aaca,_0x4ed952);if(_0x3c5717){for(var _0x5bf6a3 in _0x3c5717){if(_0x3c5717[_0xa784('0x94')](_0x5bf6a3)){this[_0xa784('0xd')][_0xa784('0x9d')](util[_0xa784('0x2a')]('ISPEECH_ASR_%s',_0x5bf6a3['toUpperCase']()),_0x3c5717[_0x5bf6a3]);}}return this[_0xa784('0xd')][_0xa784('0xad')](util[_0xa784('0x2a')](_0xa784('0x144'),JSON[_0xa784('0x72')](_0x3c5717)));}}return _0x28665d;};AGIVertices[_0xa784('0x10')]['ispeechtts']=function(_0x52a43d){logger['info'](util[_0xa784('0x2a')](_0xa784('0x145'),_0x52a43d[_0xa784('0x37')]));if(!this[_0xa784('0x85')](_0x52a43d[_0xa784('0x80')])){return this['channel'][_0xa784('0xad')](_0xa784('0xe2'));}if(!this['isConfigured'](_0x52a43d[_0xa784('0x5c')])){return this[_0xa784('0xd')]['noop'](_0xa784('0xa8'));}this[_0xa784('0xd')][_0xa784('0xad')](util['format'](_0xa784('0x146'),_0x52a43d[_0xa784('0x5c')]));var _0x2ad10d=this['ispeechTTS'][_0xa784('0x6e')](this,_0x52a43d);if(_0x2ad10d){this[_0xa784('0xd')][_0xa784('0xad')](util['format']('ispeech\x20%s\x20file\x20created',_0x2ad10d));var _0x174847=this[_0xa784('0xd')][_0xa784('0xf9')](_0x2ad10d,_0x52a43d['intKey']);try{fs['unlink'](_0x2ad10d+_0xa784('0x11b'));}catch(_0x2a0f40){logger[_0xa784('0x2c')](_0x2a0f40);}return _0x174847;}return this[_0xa784('0xd')]['error'](_0x52a43d,_0xa784('0x147'));};AGIVertices[_0xa784('0x10')][_0xa784('0x148')]=function(_0x3bcc30){logger[_0xa784('0x2e')](util[_0xa784('0x2a')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x3bcc30[_0xa784('0x37')]));if(!this[_0xa784('0x85')](_0x3bcc30[_0xa784('0x149')])){return this['channel'][_0xa784('0x2c')](_0x3bcc30,_0xa784('0x14a'));}logger[_0xa784('0x2e')](util[_0xa784('0x2a')](_0xa784('0x14b'),this[_0xa784('0xd')][_0xa784('0x3a')],_0x3bcc30[_0xa784('0x149')]));var _0x4139bf=this[_0xa784('0x52')][_0xa784('0x6e')](this,_0x3bcc30[_0xa784('0x149')]);if(_0x4139bf){logger[_0xa784('0x2e')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xa784('0xd')][_0xa784('0x3a')],_0x3bcc30[_0xa784('0x149')]));this['channel']['noop'](util['format'](_0xa784('0x14c'),this[_0xa784('0xd')][_0xa784('0x3a')],_0x3bcc30[_0xa784('0x149')]));return{'code':0xc8,'result':_0xa784('0x14d')};}else{logger[_0xa784('0x2e')](util['format'](_0xa784('0x14e'),this[_0xa784('0xd')][_0xa784('0x3a')],_0x3bcc30[_0xa784('0x149')]));this[_0xa784('0xd')][_0xa784('0xad')](util['format'](_0xa784('0x14e'),this[_0xa784('0xd')]['callerid'],_0x3bcc30[_0xa784('0x149')]));return{'code':0xc8,'result':_0xa784('0x14f')};}};AGIVertices[_0xa784('0x10')][_0xa784('0x150')]=function(_0x41b78b){logger[_0xa784('0x2e')](util[_0xa784('0x2a')](_0xa784('0x151'),_0x41b78b[_0xa784('0x37')]));if(!this[_0xa784('0x85')](_0x41b78b['findBy'])){return this[_0xa784('0xd')]['error'](_0x41b78b,_0xa784('0x14a'));}logger[_0xa784('0x2e')](util[_0xa784('0x2a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xa784('0xd')]['callerid'],_0x41b78b['findBy']));var _0x2e5922=this['agentLogout'][_0xa784('0x6e')](this,_0x41b78b[_0xa784('0x149')]);if(_0x2e5922){logger[_0xa784('0x2e')](util[_0xa784('0x2a')](_0xa784('0x14c'),this[_0xa784('0xd')][_0xa784('0x3a')],_0x41b78b[_0xa784('0x149')]));this[_0xa784('0xd')][_0xa784('0xad')](util[_0xa784('0x2a')](_0xa784('0x14c'),this['channel']['callerid'],_0x41b78b['findBy']));return{'code':0xc8,'result':_0xa784('0x14d')};}else{logger[_0xa784('0x2e')](util[_0xa784('0x2a')](_0xa784('0x14e'),this[_0xa784('0xd')][_0xa784('0x3a')],_0x41b78b[_0xa784('0x149')]));this[_0xa784('0xd')][_0xa784('0xad')](util[_0xa784('0x2a')](_0xa784('0x14e'),this[_0xa784('0xd')][_0xa784('0x3a')],_0x41b78b[_0xa784('0x149')]));return{'code':0xc8,'result':_0xa784('0x14f')};}};AGIVertices[_0xa784('0x10')]['math']=function(_0x3bb40c){logger[_0xa784('0x2e')](util[_0xa784('0x2a')](_0xa784('0x152'),_0x3bb40c[_0xa784('0x37')]));if(!this[_0xa784('0x85')](_0x3bb40c[_0xa784('0x153')])){return this[_0xa784('0xd')][_0xa784('0x2c')](_0x3bb40c,_0xa784('0x154'));}this['channel'][_0xa784('0xad')](util[_0xa784('0x2a')](_0xa784('0x155'),_0x3bb40c[_0xa784('0x153')]));var _0x13e44b=eval(_0x3bb40c[_0xa784('0x153')]);if(!this[_0xa784('0x85')](_0x3bb40c[_0xa784('0xd7')])){return this[_0xa784('0xd')][_0xa784('0xad')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x1923cc=this[_0xa784('0x11')][_0xa784('0x6e')](this,_0x3bb40c[_0xa784('0xd7')]);if(!_0x1923cc){return this[_0xa784('0xd')][_0xa784('0x2c')](_0x3bb40c,_0xa784('0x10f'));}if(_[_0xa784('0x9a')](_0x13e44b)){var _0x21c163=this;_0x13e44b['forEach'](function(_0x41b94e,_0x27c1f2){_0x21c163[_0xa784('0xd')][_0xa784('0x9d')](util[_0xa784('0x2a')]('%s[%s]',_0x1923cc,_0x27c1f2),_0x41b94e);});return this[_0xa784('0xd')][_0xa784('0xad')](util[_0xa784('0x2a')]('variable\x20%s[key]\x20set',_0x1923cc));}else{return this[_0xa784('0xd')][_0xa784('0x9d')](_0x1923cc,_0x13e44b);}};AGIVertices[_0xa784('0x10')]['menu']=function(_0x14dabf){logger[_0xa784('0x2e')](util[_0xa784('0x2a')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x14dabf[_0xa784('0x37')]));if(_0x14dabf[_0xa784('0xa5')]===0x0){return this[_0xa784('0xa4')](_0x14dabf);}_0x14dabf[_0xa784('0xa5')]-=0x1;if(!this[_0xa784('0x85')](_0x14dabf[_0xa784('0x107')])){return this[_0xa784('0xd')]['error'](_0x14dabf,_0xa784('0x108'));}var _0x49c497=this[_0xa784('0x1e')]['sync'](this,_0x14dabf['file_id']);if(!_0x49c497){return this[_0xa784('0xd')][_0xa784('0x2c')](_0x14dabf,_0xa784('0x109'));}var _0x12be31=this['channel'][_0xa784('0x156')](_0x49c497,_0x14dabf[_0xa784('0x10a')],_0x14dabf['digit']);var _0x56fc28=_0x12be31[_0xa784('0xa3')];if(_0x12be31[_0xa784('0xa3')]===-0x1){this[_0xa784('0xd6')]['sync'](this,_0x14dabf,'-1');return _0x12be31;}else if(_0x12be31[_0xa784('0xa1')]===_0xa784('0x63')){_0x12be31[_0xa784('0xa3')]=_0x12be31[_0xa784('0xa3')]['length']>0x0?_0x12be31[_0xa784('0xa3')]:'t';}else if(_[_0xa784('0x44')](_0x12be31['result'])){_0x12be31[_0xa784('0xa3')]='#';_0x56fc28='#';}if(!this[_0xa784('0x85')](_0x14dabf[_0xa784('0xd7')])){this[_0xa784('0xd')][_0xa784('0xad')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x9faea4=this[_0xa784('0x11')][_0xa784('0x6e')](this,_0x14dabf[_0xa784('0xd7')]);if(!_0x9faea4){return this[_0xa784('0xd')][_0xa784('0x2c')](_0x14dabf,_0xa784('0x10f'));}this[_0xa784('0xd')][_0xa784('0x9d')](_0x9faea4,_0x56fc28);}this['createSquareDetailsReport'][_0xa784('0x6e')](this,_0x14dabf,_0x56fc28);return _0x12be31;};AGIVertices[_0xa784('0x10')][_0xa784('0xad')]=function(_0x57f511){logger[_0xa784('0x2e')](util[_0xa784('0x2a')](_0xa784('0x157'),_0x57f511[_0xa784('0x37')]));return this[_0xa784('0xd')][_0xa784('0xad')](_0x57f511[_0xa784('0x158')]||_0x57f511[_0xa784('0x37')]);};AGIVertices[_0xa784('0x10')][_0xa784('0x159')]=function(_0x3d87f3){logger[_0xa784('0x2e')](util[_0xa784('0x2a')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x3d87f3[_0xa784('0x37')]));if(!this[_0xa784('0x85')](_0x3d87f3[_0xa784('0x149')])){return this[_0xa784('0xd')][_0xa784('0x2c')](_0x3d87f3,'no\x20find\x20by\x20configured');}logger[_0xa784('0x2e')](util[_0xa784('0x2a')](_0xa784('0x14b'),this[_0xa784('0xd')][_0xa784('0x3a')],_0x3d87f3[_0xa784('0x149')]));var _0x39f131=this[_0xa784('0x4d')][_0xa784('0x6e')](this,_0x3d87f3[_0xa784('0x15a')]);var _0x111a1d=this['agentPause'][_0xa784('0x6e')](this,_0x3d87f3[_0xa784('0x149')],_0x39f131);if(_0x111a1d){logger[_0xa784('0x2e')](util[_0xa784('0x2a')](_0xa784('0x14c'),this[_0xa784('0xd')]['callerid'],_0x3d87f3[_0xa784('0x149')]));this[_0xa784('0xd')][_0xa784('0xad')](util['format'](_0xa784('0x14c'),this[_0xa784('0xd')][_0xa784('0x3a')],_0x3d87f3[_0xa784('0x149')]));return{'code':0xc8,'result':_0xa784('0x14d')};}else{logger[_0xa784('0x2e')](util['format'](_0xa784('0x14e'),this[_0xa784('0xd')]['callerid'],_0x3d87f3[_0xa784('0x149')]));this[_0xa784('0xd')]['noop'](util['format'](_0xa784('0x14c'),this[_0xa784('0xd')][_0xa784('0x3a')],_0x3d87f3[_0xa784('0x149')]));return{'code':0xc8,'result':_0xa784('0x14f')};}};AGIVertices[_0xa784('0x10')]['playback']=function(_0x50e7af){logger['info'](util[_0xa784('0x2a')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x50e7af[_0xa784('0x37')]));if(!this['isConfigured'](_0x50e7af['file_id'])){return this['channel']['error'](_0x50e7af,_0xa784('0x108'));}var _0x2ef92b=this[_0xa784('0x1e')]['sync'](this,_0x50e7af[_0xa784('0x107')]);if(!_0x2ef92b){return this['channel'][_0xa784('0x2c')](_0x50e7af,_0xa784('0x109'));}var _0x3eb072=this[_0xa784('0xd')][_0xa784('0x57')](_0xa784('0x15b'),[_0x2ef92b,_0x50e7af[_0xa784('0xe1')]]);if(_0x3eb072[_0xa784('0xa3')]===-0x1){return _0x3eb072;}return this[_0xa784('0xd')][_0xa784('0xad')](util[_0xa784('0x2a')]('Executed\x20command\x20%s\x20%s',_0xa784('0x15b'),_0x2ef92b));};AGIVertices[_0xa784('0x10')][_0xa784('0x15c')]=function(_0x379ce8){logger[_0xa784('0x2e')](util[_0xa784('0x2a')](_0xa784('0x15d'),_0x379ce8['label']));if(!this[_0xa784('0x85')](_0x379ce8['queue_id'])){return this[_0xa784('0xd')][_0xa784('0x2c')](_0x379ce8,_0xa784('0x15e'));}var _0x342083='';var _0x3b36f3=parseInt(_0x379ce8[_0xa784('0x15f')],0xa);if(isNaN(_0x3b36f3)){_0x342083=_0x379ce8['queue_id'];}else{_0x342083=this[_0xa784('0x15')][_0xa784('0x6e')](this,_0x379ce8[_0xa784('0x15f')]);if(!_0x342083){return this[_0xa784('0xd')]['error'](_0x379ce8,'no\x20queue\x20found');}}var _0x571e0d='';if(this[_0xa784('0x85')](_0x379ce8[_0xa784('0x107')])){var _0x310d62=this[_0xa784('0x1e')][_0xa784('0x6e')](this,_0x379ce8[_0xa784('0x107')]);if(_0x310d62){_0x571e0d=_0x310d62;}}this['createSquareDetailsReport']['sync'](this,_0x379ce8,_0x342083);if(_0x379ce8[_0xa784('0xe1')][_0xa784('0x160')]('x')<0x0){_0x379ce8[_0xa784('0xe1')]+='x';}if(_0x379ce8['opts'][_0xa784('0x160')]('X')<0x0){_0x379ce8[_0xa784('0xe1')]+='X';}this[_0xa784('0xd')][_0xa784('0x9d')](_0xa784('0x161'),_0x342083?_0x342083['toLowerCase']():'');var _0x59d639=this[_0xa784('0xd')]['exec']('QUEUE',[_0x342083,_0x379ce8[_0xa784('0xe1')],_0x379ce8[_0xa784('0x61')],_0x571e0d,_0x379ce8[_0xa784('0x63')],_0x379ce8['agi'],_0x379ce8[_0xa784('0x162')],_0x379ce8['gosub'],'',_0x379ce8[_0xa784('0x163')]]);if(_0x59d639['result']===-0x1){return _0x59d639;}return this[_0xa784('0xd')][_0xa784('0xad')](util[_0xa784('0x2a')](_0xa784('0xc4'),_0xa784('0x164'),_0x342083));};AGIVertices[_0xa784('0x10')]['record']=function(_0x1f2f42){logger[_0xa784('0x2e')](util['format'](_0xa784('0x165'),_0x1f2f42['label']));var _0xbcc228=_0x1f2f42[_0xa784('0x166')]||'wav';var _0x5e5678=util[_0xa784('0x2a')](_0xa784('0x167'),this[_0xa784('0xd')][_0xa784('0x36')],rs['generate'](0x5));var _0x47dc2f=util[_0xa784('0x2a')](_0xa784('0x168'),FILES_PATH,_0x5e5678,_0xbcc228);var _0x58a9c7=util['format'](_0xa784('0x128'),FILES_PATH,_0x5e5678);this[_0xa784('0x3b')]['sync'](this,_0x1f2f42,_0x5e5678,_0x47dc2f);this[_0xa784('0xd')][_0xa784('0x9d')](_0xa784('0x169'),_0x5e5678);logger[_0xa784('0x2e')](_0xa784('0x16a'),_0x58a9c7,_0xbcc228,_0x1f2f42['escape_digits'],_0x1f2f42[_0xa784('0x63')]);return this['channel'][_0xa784('0x12a')](_0x58a9c7,_0xbcc228,_0x1f2f42[_0xa784('0x16b')],_0x1f2f42['timeout'],undefined,!![]);};AGIVertices[_0xa784('0x10')][_0xa784('0x16c')]=function(_0x140098){logger[_0xa784('0x2e')](util[_0xa784('0x2a')](_0xa784('0x16d'),_0x140098[_0xa784('0x37')]));if(!this['isConfigured'](_0x140098[_0xa784('0x61')])){return this['channel'][_0xa784('0xad')](_0xa784('0x16e'));}var _0x2ec31e=this[_0xa784('0x16f')][_0xa784('0x6e')](this,_0x140098);logger[_0xa784('0x2e')](util[_0xa784('0x2a')]('Response:',util[_0xa784('0x170')](_0x2ec31e,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x140098['variable_id'])){return this[_0xa784('0xd')][_0xa784('0xad')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x8218b2=this[_0xa784('0x11')][_0xa784('0x6e')](this,_0x140098[_0xa784('0xd7')]);if(!_0x8218b2){return this[_0xa784('0xd')][_0xa784('0x2c')](_0x140098,_0xa784('0x10f'));}this[_0xa784('0xd')][_0xa784('0x9d')](util['format'](_0xa784('0x171'),_0x8218b2),_0x2ec31e[_0xa784('0x74')]?_0x2ec31e[_0xa784('0x74')]:_0xa784('0x172'));this['channel']['setVariable'](util[_0xa784('0x2a')]('%s_STATUS_MESSAGE',_0x8218b2),_0x2ec31e[_0xa784('0x75')]?_0x2ec31e[_0xa784('0x75')]:'OK');if(_0x2ec31e[_0xa784('0x69')]){try{this['saveRestApiResult'](_0x2ec31e['body'],_0x8218b2);}catch(_0x2668b3){logger[_0xa784('0x2c')](util[_0xa784('0x2a')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x8218b2));}}return this[_0xa784('0xd')]['noop'](util[_0xa784('0x2a')]('variable\x20%s\x20set',_0x8218b2));};AGIVertices[_0xa784('0x10')]['saydigits']=function(_0x5565b0){logger[_0xa784('0x2e')](util[_0xa784('0x2a')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x5565b0[_0xa784('0x37')]));return this[_0xa784('0xd')][_0xa784('0x173')](_0x5565b0['digits'][_0xa784('0x59')](/\s+/g,''),_0x5565b0['escape_digits']);};AGIVertices['prototype'][_0xa784('0x174')]=function(_0x1c43c9){logger[_0xa784('0x2e')](util[_0xa784('0x2a')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x1c43c9['label']));return this[_0xa784('0xd')][_0xa784('0x175')](_0x1c43c9['number']['replace'](/\s+/g,''),_0x1c43c9['escape_digits']);};AGIVertices[_0xa784('0x10')][_0xa784('0x176')]=function(_0x30948d){logger[_0xa784('0x2e')](util[_0xa784('0x2a')](_0xa784('0x177'),_0x30948d[_0xa784('0x37')]));return this[_0xa784('0xd')]['sayPhonetic'](_0x30948d['text'],_0x30948d[_0xa784('0x16b')]);};AGIVertices[_0xa784('0x10')][_0xa784('0x178')]=function(_0xe07d8a){logger[_0xa784('0x2e')](util[_0xa784('0x2a')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0xe07d8a[_0xa784('0x37')]));if(!this['isConfigured'](_0xe07d8a[_0xa784('0x179')])){return this[_0xa784('0xd')][_0xa784('0xad')](_0xa784('0x17a'));}var _0x2bd2d8=this[_0xa784('0x22')][_0xa784('0x6e')](this,_0xe07d8a[_0xa784('0x179')]);if(!_0x2bd2d8||!_0x2bd2d8['Smtp']){return this[_0xa784('0xd')]['error'](_0xe07d8a,_0xa784('0x17b'));}var _0x19e655={'from':util[_0xa784('0x2a')](_0xa784('0x17c'),_0x2bd2d8[_0xa784('0x14')],_0x2bd2d8[_0xa784('0x17d')]||_0x2bd2d8[_0xa784('0x17e')][_0xa784('0x17f')]),'to':_0xe07d8a['to']||'','cc':_0xe07d8a['cc']||'','bcc':_0xe07d8a['bcc']||'','subject':_0xe07d8a[_0xa784('0x180')],'html':_0xe07d8a[_0xa784('0x5c')],'text':_0xe07d8a['text']};var _0x3566ad={'tls':{'rejectUnauthorized':![]}};if(_0x2bd2d8['Smtp'][_0xa784('0x181')]){_0x3566ad[_0xa784('0x181')]=_0x2bd2d8[_0xa784('0x17e')][_0xa784('0x181')];}else{_0x3566ad['host']=_0x2bd2d8['Smtp'][_0xa784('0x182')];_0x3566ad[_0xa784('0x183')]=_0x2bd2d8[_0xa784('0x17e')][_0xa784('0x183')];_0x3566ad[_0xa784('0x184')]=_0x2bd2d8[_0xa784('0x17e')][_0xa784('0x184')];}if(_0x2bd2d8[_0xa784('0x17e')][_0xa784('0x185')]){_0x3566ad[_0xa784('0x186')]={'user':_0x2bd2d8[_0xa784('0x17e')]['user'],'pass':_0x2bd2d8[_0xa784('0x17e')][_0xa784('0x187')]};}if(this[_0xa784('0x85')](_0xe07d8a['template_id'])){}logger[_0xa784('0x188')]('sendMail\x20message',JSON['stringify'](_0x19e655));this[_0xa784('0xd6')][_0xa784('0x6e')](this,_0xe07d8a,_0xe07d8a['account_id']);this['channel']['noop'](util[_0xa784('0x2a')](_0xa784('0x189'),_0x2bd2d8['name']));this[_0xa784('0x24')][_0xa784('0x6e')](this,_0x3566ad,_0x19e655);return this[_0xa784('0xd')][_0xa784('0xad')](_0xa784('0x18a'));};AGIVertices[_0xa784('0x10')]['sendFax']=function(_0xb23539){logger[_0xa784('0x2e')](util[_0xa784('0x2a')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0xb23539[_0xa784('0x37')]));return this['channel']['noop'](_0xa784('0x18b'));};AGIVertices[_0xa784('0x10')][_0xa784('0x18c')]=function(_0x8e607e){logger[_0xa784('0x2e')](util[_0xa784('0x2a')](_0xa784('0x18d'),_0x8e607e[_0xa784('0x37')]));if(!this[_0xa784('0x85')](_0x8e607e[_0xa784('0x18e')])){return this[_0xa784('0xd')]['noop']('no\x20sms\x20account\x20configured');}var _0x40b934=this[_0xa784('0x18f')][_0xa784('0x6e')](this,_0x8e607e[_0xa784('0x18e')]);if(!_0x40b934){return this['channel'][_0xa784('0x2c')](_0x8e607e,_0xa784('0x190'));}var _0x37ed65={'body':_0x8e607e[_0xa784('0x191')],'phone':_0x8e607e['to']||'','SmsAccountId':_0x40b934['id']};logger[_0xa784('0x188')](_0xa784('0x192'),JSON[_0xa784('0x72')](_0x37ed65));this[_0xa784('0xd6')][_0xa784('0x6e')](this,_0x8e607e,_0x8e607e[_0xa784('0x18e')]);this[_0xa784('0xd')][_0xa784('0xad')](util[_0xa784('0x2a')](_0xa784('0x193'),_0x40b934[_0xa784('0x14')]));this[_0xa784('0x194')][_0xa784('0x6e')](this,_0x37ed65);return this['channel']['noop'](_0xa784('0x195'));};AGIVertices[_0xa784('0x10')][_0xa784('0x196')]=function(_0x2c49bb){logger[_0xa784('0x2e')](util['format'](_0xa784('0x197'),_0x2c49bb[_0xa784('0x37')]));if(!this[_0xa784('0x85')](_0x2c49bb[_0xa784('0xd7')])){return this[_0xa784('0xd')][_0xa784('0x2c')](_0x2c49bb,_0xa784('0x198'));}var _0x2d0e4f=this[_0xa784('0x11')][_0xa784('0x6e')](this,_0x2c49bb[_0xa784('0xd7')]);if(!_0x2d0e4f){return this[_0xa784('0xd')][_0xa784('0x2c')](_0x2c49bb,_0xa784('0x10f'));}return this[_0xa784('0xd')]['setVariable'](_0x2d0e4f,_0x2c49bb[_0xa784('0x199')]);};AGIVertices[_0xa784('0x10')][_0xa784('0x19a')]=function(_0x338172){logger[_0xa784('0x2e')](util[_0xa784('0x2a')](_0xa784('0x19b'),_0x338172[_0xa784('0x37')]));this['channel'][_0xa784('0xad')](_0xa784('0x19c'));if(_0x338172[_0xa784('0xb9')]==='yes'){this[_0xa784('0xd')]['noop']('Answer');return this['channel'][_0xa784('0xb9')]();}return this[_0xa784('0xd')][_0xa784('0xad')](_0xa784('0x19d'));};AGIVertices['prototype'][_0xa784('0x19e')]=function(_0x22eb67){logger['info'](util[_0xa784('0x2a')](_0xa784('0x19f'),_0x22eb67[_0xa784('0x37')]));if(!this['isConfigured'](_0x22eb67['project_id'])){return this[_0xa784('0xd')]['error'](_0x22eb67,_0xa784('0x1a0'));}var _0x2b6b36=this[_0xa784('0x17')][_0xa784('0x6e')](this,_0x22eb67[_0xa784('0x1a1')]);if(!this[_0xa784('0x85')](_0x2b6b36)){return this[_0xa784('0xd')][_0xa784('0x2c')](_0x22eb67,util[_0xa784('0x2a')](_0xa784('0x1a2'),_0x22eb67[_0xa784('0x1a1')]));}if(_0x2b6b36===this[_0xa784('0xd')]['arg_1']){return this[_0xa784('0xd')]['error'](_0x22eb67,_0xa784('0x1a3'));}this[_0xa784('0xd6')][_0xa784('0x6e')](this,_0x22eb67,_0x2b6b36);var _0x1a0d40=this['channel'][_0xa784('0x57')](_0xa784('0x1a4'),util['format'](_0xa784('0x1a5'),config[_0xa784('0xb6')][_0xa784('0x182')]||_0xa784('0x1a6'),_0x2b6b36,this['channel'][_0xa784('0x39')]));if(_0x1a0d40[_0xa784('0xa3')]===-0x1){return _0x1a0d40;}return this[_0xa784('0xd')][_0xa784('0xad')](util[_0xa784('0x2a')](_0xa784('0xc4'),'AGI',_0x2b6b36));};AGIVertices[_0xa784('0x10')][_0xa784('0x1a7')]=function(_0x14dc5){logger[_0xa784('0x2e')](util['format']('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x14dc5['label']));var _0x47c912=this[_0xa784('0x56')][_0xa784('0x6e')](this,_0x14dc5[_0xa784('0xb8')]);this['createSquareDetailsReport'][_0xa784('0x6e')](this,_0x14dc5,_0x14dc5['command']);if(this['isConfigured'](_0x14dc5[_0xa784('0xd7')])){var _0x348219=this[_0xa784('0x11')]['sync'](this,_0x14dc5[_0xa784('0xd7')]);if(_0x348219){this[_0xa784('0xd')][_0xa784('0x9d')](_0x348219,_0x47c912);return this[_0xa784('0xd')][_0xa784('0xad')](util[_0xa784('0x2a')](_0xa784('0x1a8'),_0x14dc5[_0xa784('0xb8')],_0x348219));}}return this[_0xa784('0xd')]['noop'](util[_0xa784('0x2a')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x14dc5[_0xa784('0xb8')]));};AGIVertices[_0xa784('0x10')][_0xa784('0x1a9')]=function(_0x3535a1){logger[_0xa784('0x2e')](util[_0xa784('0x2a')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x3535a1[_0xa784('0x37')]));_0x3535a1['text']=_0x3535a1['text'][_0xa784('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa784('0x85')](_0x3535a1[_0xa784('0x5b')])){return this[_0xa784('0xd')][_0xa784('0xad')](_0xa784('0x1aa'));}if(!this['isConfigured'](_0x3535a1['text'])){return this[_0xa784('0xd')][_0xa784('0xad')](_0xa784('0xa8'));}this[_0xa784('0xd')]['noop'](util[_0xa784('0x2a')](_0xa784('0x1ab'),_0x3535a1[_0xa784('0x5c')]));var _0x5509ee=this[_0xa784('0x5a')][_0xa784('0x6e')](this,_0x3535a1);if(_0x5509ee){this[_0xa784('0xd')][_0xa784('0xad')](util[_0xa784('0x2a')](_0xa784('0x1ac'),_0x5509ee));var _0x604620=this['channel'][_0xa784('0xf9')](_0x5509ee);try{fs[_0xa784('0xfa')](_0x5509ee+_0xa784('0x11b'));}catch(_0x45d716){logger['error'](_0x45d716);}return _0x604620;}return this[_0xa784('0xd')][_0xa784('0x2c')](_0x3535a1,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0xa784('0x10')]['tts']=function(_0x397f4a){logger[_0xa784('0x2e')](util[_0xa784('0x2a')](_0xa784('0x1ad'),_0x397f4a['label']));_0x397f4a[_0xa784('0x5c')]=_0x397f4a[_0xa784('0x5c')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa784('0x85')](_0x397f4a[_0xa784('0x5c')])){return this[_0xa784('0xd')][_0xa784('0xad')]('no\x20text\x20configured');}this[_0xa784('0xd')][_0xa784('0xad')](util[_0xa784('0x2a')](_0xa784('0x1ae'),_0x397f4a[_0xa784('0x5c')]));var _0x5a3171=this[_0xa784('0x60')][_0xa784('0x6e')](this,_0x397f4a);if(_0x5a3171){this[_0xa784('0xd')][_0xa784('0xad')](util[_0xa784('0x2a')](_0xa784('0x1af'),_0x5a3171));var _0x43aea8=this['channel']['streamFile'](_0x5a3171);try{fs[_0xa784('0xfa')](_0x5a3171+_0xa784('0x11b'));}catch(_0x15a8a8){logger[_0xa784('0x2c')](_0x15a8a8);}return _0x43aea8;}return this[_0xa784('0xd')]['error'](_0x397f4a,_0xa784('0x1b0'));};AGIVertices[_0xa784('0x10')][_0xa784('0x1b1')]=function(_0x44e121){logger[_0xa784('0x2e')](util['format'](_0xa784('0x1b2'),_0x44e121[_0xa784('0x37')]));if(!this['isConfigured'](_0x44e121['findBy'])){return this[_0xa784('0xd')][_0xa784('0x2c')](_0x44e121,_0xa784('0x14a'));}logger['info'](util[_0xa784('0x2a')](_0xa784('0x14b'),this[_0xa784('0xd')]['callerid'],_0x44e121[_0xa784('0x149')]));var _0x24f29a=this[_0xa784('0x4f')][_0xa784('0x6e')](this,_0x44e121[_0xa784('0x149')]);if(_0x24f29a){logger[_0xa784('0x2e')](util[_0xa784('0x2a')](_0xa784('0x14c'),this[_0xa784('0xd')][_0xa784('0x3a')],_0x44e121[_0xa784('0x149')]));this['channel']['noop'](util['format'](_0xa784('0x14c'),this['channel'][_0xa784('0x3a')],_0x44e121['findBy']));return{'code':0xc8,'result':_0xa784('0x14d')};}else{logger[_0xa784('0x2e')](util[_0xa784('0x2a')](_0xa784('0x14e'),this[_0xa784('0xd')][_0xa784('0x3a')],_0x44e121[_0xa784('0x149')]));this['channel'][_0xa784('0xad')](util[_0xa784('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa784('0xd')][_0xa784('0x3a')],_0x44e121[_0xa784('0x149')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xa784('0x10')][_0xa784('0x1b3')]=function(_0x4fc6c7){logger[_0xa784('0x2e')](util[_0xa784('0x2a')](_0xa784('0x1b4'),_0x4fc6c7[_0xa784('0x37')]));var _0x5210ac=this['channel'][_0xa784('0x57')](_0xa784('0x1b5'),[_0x4fc6c7['mailbox'],_0x4fc6c7[_0xa784('0x77')]]);if(_0x5210ac['result']===-0x1){return _0x5210ac;}return this[_0xa784('0xd')][_0xa784('0xad')](util[_0xa784('0x2a')](_0xa784('0xc4'),_0xa784('0x1b5'),_0x4fc6c7[_0xa784('0x1b6')]));};AGIVertices[_0xa784('0x10')][_0xa784('0x1b7')]=function(_0x4f9bbd){logger[_0xa784('0x2e')](util[_0xa784('0x2a')](_0xa784('0x1b8'),_0x4f9bbd['label']));if(!this[_0xa784('0x85')](_0x4f9bbd['variable_id'])){return this[_0xa784('0xd')][_0xa784('0x2c')](_0x4f9bbd,_0xa784('0x198'));}var _0x9e2fbc=this[_0xa784('0x11')][_0xa784('0x6e')](this,_0x4f9bbd['variable_id']);if(!_0x9e2fbc){return this[_0xa784('0xd')][_0xa784('0x2c')](_0x4f9bbd,_0xa784('0x10f'));}var _0x3e0834=this[_0xa784('0xd')]['getVariable'](_0x9e2fbc);return{'code':0xc8,'result':_0x3e0834['extra']?_0x3e0834[_0xa784('0xa1')]:'-'};};String[_0xa784('0x10')][_0xa784('0xa0')]=function(_0x4fb35e,_0x16295a){return this['split'](_0x4fb35e)[_0xa784('0x1b9')](_0x16295a);};module['exports']=AGIVertices; \ No newline at end of file +var _0x3192=['options','key','googleDialogflowV2','dialogflowV2_project_id','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_bot_name','googleASR','appid','appsecret','includes','agicommand','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','setVariable','%s.%s','split','replaceAll','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','exec','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','result','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','no\x20list\x20selected','add','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','out','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','.wav','aws\x20Polly\x20is\x20unreachable','awslex','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','amazonlex','Amazon\x20Lex\x20Result\x20%s','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','beep','recordFile','tilde\x20%s\x20file\x20created','tildeASR','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','false','hangup','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','streamFile','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','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','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','menu','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','toLowerCase','position','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%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','saynumber','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','user','bcc','subject','service','host','port','authentication','template_id','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','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','Enter\x20in\x20START\x20(%s)\x20block','Answer','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','lodash','shelljs','odbc','mustache','request-promise','../../config/logger','agi','rawHeaders','rawBody','getdigits','getsecretdigits','getVariable','rpc','then','catch','prototype','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbcById','getUser','name','getTrunkById','getSoundById','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervals','getIntervalById','IntervalId','interval','Intervals','getSoundPath','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','createSquareRecording','callerid','calleridname','context','extension','accountcode','arg_1','createSquareMessage','createCmContact','isNil','callback_','isEmpty','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','format','%s/%s@from-sip/n','LOCAL','shellCommand','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','method','timeout','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','url','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error'];(function(_0x39f31c,_0x56400a){var _0x39d61f=function(_0x46513a){while(--_0x46513a){_0x39f31c['push'](_0x39f31c['shift']());}};_0x39d61f(++_0x56400a);}(_0x3192,0x147));var _0x2319=function(_0xa4412e,_0x135481){_0xa4412e=_0xa4412e-0x0;var _0x583391=_0x3192[_0xa4412e];return _0x583391;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var _=require(_0x2319('0x0'));var sh=require(_0x2319('0x1'));var odbc=require(_0x2319('0x2'))();var rs=require('randomstring');var moment=require('moment');var Mustache=require(_0x2319('0x3'));var rp=require(_0x2319('0x4'));var logger=require(_0x2319('0x5'))(_0x2319('0x6'));var config=require('../../config/environment');var scripts=require('./scripts');var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x2319('0x7'),_0x2319('0x8')];var verticesWithRetry=['menu',_0x2319('0x9'),_0x2319('0xa')];var AGIVertices=function(_0x1ce723,_0xe8db68,_0x406aa7){this['channel']=_0x1ce723;this['rpc']=_0xe8db68;this['mailRpc']=_0x406aa7;};AGIVertices['prototype'][_0x2319('0xb')]=function(_0x5c8c15,_0x1d1cb0){this[_0x2319('0xc')]['getVariableById'](_0x5c8c15)[_0x2319('0xd')](function(_0x21aaa2){_0x1d1cb0(null,_0x21aaa2?_0x21aaa2['name']:![]);})[_0x2319('0xe')](function(_0x31e31c){_0x1d1cb0(_0x31e31c);});};AGIVertices[_0x2319('0xf')][_0x2319('0x10')]=function(_0x21d5fc,_0x1f14b0){this[_0x2319('0xc')][_0x2319('0x11')](_0x21d5fc)['then'](function(_0x5699c4){_0x1f14b0(null,_0x5699c4?_0x5699c4['name']:![]);})['catch'](function(_0x1341f0){_0x1f14b0(_0x1341f0);});};AGIVertices[_0x2319('0xf')][_0x2319('0x12')]=function(_0x5f5024,_0x3a1e74){this[_0x2319('0xc')][_0x2319('0x13')](_0x5f5024)[_0x2319('0xd')](function(_0x408c9d){_0x3a1e74(null,_0x408c9d?_0x408c9d['name']:![]);})['catch'](function(_0x16ee93){_0x3a1e74(_0x16ee93);});};AGIVertices[_0x2319('0xf')]['getSquareOdbc']=function(_0x3d063d,_0x4a0ea7){this['rpc'][_0x2319('0x14')](_0x3d063d)[_0x2319('0xd')](function(_0x44763e){_0x4a0ea7(null,_0x44763e?_0x44763e['dsn']:![]);})[_0x2319('0xe')](function(_0xc04d2d){_0x4a0ea7(_0xc04d2d);});};AGIVertices['prototype'][_0x2319('0x15')]=function(_0x49581a,_0x21c63f){this[_0x2319('0xc')]['getUserById'](_0x49581a)[_0x2319('0xd')](function(_0x3f8c3d){_0x21c63f(null,_0x3f8c3d?_0x3f8c3d[_0x2319('0x16')]:![]);})[_0x2319('0xe')](function(_0x34dd50){_0x21c63f(_0x34dd50);});};AGIVertices[_0x2319('0xf')]['getTrunk']=function(_0x4fd5e7,_0x507e14){this[_0x2319('0xc')][_0x2319('0x17')](_0x4fd5e7)[_0x2319('0xd')](function(_0x2fecc7){_0x507e14(null,_0x2fecc7?_0x2fecc7[_0x2319('0x16')]:![]);})[_0x2319('0xe')](function(_0x22f2d3){_0x507e14(_0x22f2d3);});};AGIVertices[_0x2319('0xf')]['getSound']=function(_0x28b316,_0x28f1a5){var _0x2d921e=this;this['rpc'][_0x2319('0x18')](_0x28b316)[_0x2319('0xd')](function(_0x21f678){_0x28f1a5(null,_0x21f678?_0x2d921e['getSoundPath'](_0x21f678['save_name']):![]);})[_0x2319('0xe')](function(_0x49686b){_0x28f1a5(_0x49686b);});};AGIVertices[_0x2319('0xf')][_0x2319('0x19')]=function(_0x333d0c,_0x57e90b){this[_0x2319('0xc')][_0x2319('0x1a')](_0x333d0c)[_0x2319('0xd')](function(_0xa8fbda){_0x57e90b(null,_0xa8fbda?_0xa8fbda:![]);})['catch'](function(_0x1d5d90){_0x57e90b(_0x1d5d90);});};AGIVertices[_0x2319('0xf')][_0x2319('0x1b')]=function(_0x23b561,_0x16f1fd,_0x21249b){this[_0x2319('0x1c')][_0x2319('0x1b')](_0x23b561,_0x16f1fd)[_0x2319('0xd')](function(){_0x21249b(null);})[_0x2319('0xe')](function(_0x2e1edf){_0x21249b(_0x2e1edf);});};AGIVertices[_0x2319('0xf')][_0x2319('0x1d')]=function(_0x3f166d,_0x53251a){this[_0x2319('0xc')][_0x2319('0x1e')](_0x3f166d)[_0x2319('0xd')](function(_0x5c95a1){if(_0x5c95a1){if(_0x5c95a1[_0x2319('0x1f')]){_0x53251a(null,[_0x5c95a1[_0x2319('0x20')]]);}else{_0x53251a(null,_['map'](_0x5c95a1[_0x2319('0x21')],_0x2319('0x20')));}}else{_0x53251a(null,![]);}})[_0x2319('0xe')](function(_0x19b47e){_0x53251a(_0x19b47e);});};AGIVertices[_0x2319('0xf')][_0x2319('0x22')]=function(_0x3b4a9f){return util['format'](_0x2319('0x23'),FILES_PATH,_0x3b4a9f);};AGIVertices[_0x2319('0xf')][_0x2319('0x24')]=function(_0x53f3f2,_0x1d073f,_0x7db104){odbc[_0x2319('0x25')](_0x53f3f2,function(_0x4e8789){if(_0x4e8789){logger[_0x2319('0x26')](_0x2319('0x27'),_0x4e8789);_0x7db104(_0x4e8789);}else{logger[_0x2319('0x28')]('ODBC\x20connection\x20successfully');odbc[_0x2319('0x29')](_0x1d073f,function(_0x2badf7,_0x4c3854){if(_0x2badf7){logger[_0x2319('0x28')](_0x2319('0x2a'),_0x1d073f);_0x7db104(_0x2badf7);}else{logger['info'](_0x2319('0x2b'),_0x1d073f);odbc[_0x2319('0x2c')](function(_0x1cc324){if(_0x1cc324){logger[_0x2319('0x26')](_0x2319('0x2d'),_0x1cc324);}_0x7db104(null,_0x4c3854);});}});}});};AGIVertices[_0x2319('0xf')][_0x2319('0x2e')]=function(_0x20ea3c,_0x55515d){this[_0x2319('0xc')][_0x2319('0x2f')](_0x20ea3c)[_0x2319('0xd')](function(_0x2d9ef5){_0x55515d(null,_0x2d9ef5?_0x2d9ef5:![]);})[_0x2319('0xe')](function(_0x3cb673){_0x55515d(_0x3cb673);});};AGIVertices[_0x2319('0xf')][_0x2319('0x30')]=function(_0x2f564e,_0x261272){this[_0x2319('0xc')]['createSmsMessage'](_0x2f564e)[_0x2319('0xd')](function(_0x7f8f80){_0x261272(null,_0x7f8f80);})[_0x2319('0xe')](function(_0x4493fc){_0x261272(_0x4493fc);});};AGIVertices[_0x2319('0xf')][_0x2319('0x31')]=function(_0x54755b,_0x182d35,_0x397542){this['rpc']['createSquareDetailsReport']({'uniqueid':this[_0x2319('0x32')][_0x2319('0x33')],'node':_0x54755b[_0x2319('0x34')],'application':_0x54755b['agicommand'],'data':_0x182d35||null,'project_name':this[_0x2319('0x32')]['arg_1'],'callerid':this[_0x2319('0x32')]['callerid']})[_0x2319('0xd')](function(_0x5aec0d){if(_0x397542){_0x397542(null,_0x5aec0d);}})['catch'](function(_0x5329e8){if(_0x397542){_0x397542(_0x5329e8);}});};AGIVertices[_0x2319('0xf')][_0x2319('0x35')]=function(_0x391b49,_0x351552,_0x361dde,_0x1983bf){this[_0x2319('0xc')]['createSquareRecording']({'uniqueid':this[_0x2319('0x32')]['uniqueid'],'callerid':this[_0x2319('0x32')][_0x2319('0x36')],'calleridname':this[_0x2319('0x32')][_0x2319('0x37')],'context':this[_0x2319('0x32')][_0x2319('0x38')],'extension':this[_0x2319('0x32')][_0x2319('0x39')],'priority':this[_0x2319('0x32')]['priority'],'accountcode':this[_0x2319('0x32')][_0x2319('0x3a')],'dnid':this[_0x2319('0x32')]['dnid'],'projectName':this['channel'][_0x2319('0x3b')],'saveName':_0x351552,'filename':_0x391b49['file']||_0x351552,'savePath':_0x361dde})[_0x2319('0xd')](function(_0x10cbab){_0x1983bf(null,_0x10cbab);})[_0x2319('0xe')](function(_0x29ca7c){_0x1983bf(_0x29ca7c);});};AGIVertices['prototype'][_0x2319('0x3c')]=function(_0x35f76a,_0x2b173b,_0x38fdc0,_0x228277,_0x2ec762){this[_0x2319('0xc')][_0x2319('0x3c')]({'uniqueid':this[_0x2319('0x32')][_0x2319('0x33')],'body':_0x35f76a,'direction':_0x2b173b,'providerName':_0x38fdc0,'providerResponse':_0x228277})[_0x2319('0xd')](function(_0x14c592){if(_0x2ec762){_0x2ec762(null,_0x14c592);}})[_0x2319('0xe')](function(_0x1100cf){if(_0x2ec762){_0x2ec762(_0x1100cf);}});};AGIVertices[_0x2319('0xf')][_0x2319('0x3d')]=function(_0x5424ba,_0x13fea8){this[_0x2319('0xc')]['createCmContact']({'firstName':_['isEmpty'](_0x5424ba['name'])||_[_0x2319('0x3e')](_0x5424ba[_0x2319('0x16')])?_0x2319('0x3f')+Math['random']():_0x5424ba[_0x2319('0x16')],'lastName':_[_0x2319('0x40')](_0x5424ba['lastName'])||_[_0x2319('0x3e')](_0x5424ba[_0x2319('0x41')])?null:_0x5424ba['lastName'],'phone':_0x5424ba[_0x2319('0x42')],'ListId':_0x5424ba[_0x2319('0x43')],'scheduledat':_0x5424ba['scheduledAt'],'callbackUniqueid':this[_0x2319('0x32')][_0x2319('0x33')],'tags':_0x2319('0x44'),'description':_0x2319('0x45')+_0x5424ba[_0x2319('0x46')][_0x2319('0x47')](),'priority':_0x5424ba[_0x2319('0x48')]})[_0x2319('0xd')](function(_0x3debf2){_0x13fea8(null,_0x3debf2);})[_0x2319('0xe')](function(_0x37c3fb){_0x13fea8(_0x37c3fb);});};AGIVertices['prototype'][_0x2319('0x49')]=function(_0x896b61,_0x3bb410){this[_0x2319('0xc')][_0x2319('0x4a')](_0x896b61)[_0x2319('0xd')](function(_0x36ceb2){_0x3bb410(null,_0x36ceb2?_0x36ceb2[_0x2319('0x16')]:![]);})[_0x2319('0xe')](function(_0x39d7b6){_0x3bb410(_0x39d7b6);});};AGIVertices[_0x2319('0xf')][_0x2319('0x4b')]=function(_0x4d7e93,_0x5a3bab,_0x22363d){var _0xed0402={'role':_0x2319('0x4c')};_0xed0402[_0x4d7e93]=this[_0x2319('0x32')][_0x2319('0x36')];this[_0x2319('0xc')][_0x2319('0x4b')](_0xed0402,_0x5a3bab,this['channel'][_0x2319('0x33')])[_0x2319('0xd')](function(_0x322db0){_0x22363d(null,_['isNil'](_0x322db0)?![]:!![]);})[_0x2319('0xe')](function(_0x398990){logger[_0x2319('0x26')](_0x398990);_0x22363d(null,![]);});};AGIVertices[_0x2319('0xf')]['agentUnpause']=function(_0x488852,_0x150c60){var _0x34f705={'role':_0x2319('0x4c')};_0x34f705[_0x488852]=this[_0x2319('0x32')]['callerid'];this['rpc'][_0x2319('0x4d')](_0x34f705)[_0x2319('0xd')](function(_0x27eaa9){_0x150c60(null,_[_0x2319('0x3e')](_0x27eaa9)?![]:!![]);})[_0x2319('0xe')](function(_0x4c0780){logger['error'](_0x4c0780);_0x150c60(null,![]);});};AGIVertices[_0x2319('0xf')][_0x2319('0x4e')]=function(_0x762d71,_0x1472f4){var _0x17f407={'role':_0x2319('0x4c')};_0x17f407[_0x762d71]=this[_0x2319('0x32')][_0x2319('0x36')];this[_0x2319('0xc')]['agentLogout'](_0x17f407)[_0x2319('0xd')](function(_0x525000){_0x1472f4(null,_[_0x2319('0x3e')](_0x525000)?![]:!![]);})[_0x2319('0xe')](function(_0x1f349b){logger[_0x2319('0x26')](_0x1f349b);_0x1472f4(null,![]);});};AGIVertices[_0x2319('0xf')][_0x2319('0x4f')]=function(_0xebedd6,_0x231e0f){var _0x4681ce={'role':_0x2319('0x4c')};_0x4681ce[_0xebedd6]=this['channel'][_0x2319('0x36')];var _0x42b2ed=_0xebedd6!=_0x2319('0x50')?util[_0x2319('0x51')](_0x2319('0x52'),_0x2319('0x53'),this['channel'][_0x2319('0x36')]):undefined;this[_0x2319('0xc')][_0x2319('0x4f')](_0x4681ce,_0x42b2ed)[_0x2319('0xd')](function(_0x39b629){_0x231e0f(null,_[_0x2319('0x3e')](_0x39b629)?![]:!![]);})[_0x2319('0xe')](function(_0x26fee3){logger[_0x2319('0x26')](_0x26fee3);_0x231e0f(null,![]);});};AGIVertices[_0x2319('0xf')][_0x2319('0x54')]=function(_0x2589ed,_0x539173){sh['exec'](_[_0x2319('0x55')](_0x2589ed),function(_0x3bb948,_0x20b81c){var _0x22cda4=_0x20b81c[_0x2319('0x56')](/(\r\n|\n|\r)/gm,'');_0x539173(null,_0x22cda4);});};AGIVertices[_0x2319('0xf')][_0x2319('0x57')]=function(_0x45b443,_0xc8e62){scripts['googleCloudTTS'](_0x45b443['apiKey'],_0x45b443[_0x2319('0x58')]||'text',_0x45b443[_0x2319('0x59')],_0x45b443['languageCode']||_0x2319('0x5a'),_0x45b443[_0x2319('0x5b')]||_0x2319('0x5c'),_0x45b443[_0x2319('0x5d')]||_0x2319('0x5e'))[_0x2319('0xd')](function(_0x31a703){_0xc8e62(null,_0x31a703);})[_0x2319('0xe')](function(_0x1c00c9){_0xc8e62(_0x1c00c9);});};AGIVertices[_0x2319('0xf')]['googleTTS']=function(_0x44d4a0,_0xc55aa9){scripts[_0x2319('0x5f')](_0x44d4a0[_0x2319('0x59')],_0x44d4a0[_0x2319('0x60')]||'en',0x1)[_0x2319('0xd')](function(_0x39d5db){_0xc55aa9(null,_0x39d5db);})[_0x2319('0xe')](function(_0x3e2a32){_0xc55aa9(_0x3e2a32);});};AGIVertices[_0x2319('0xf')][_0x2319('0x61')]=function(_0x349442,_0x4647fa){var _0x3af82b={'uri':_0x349442['url'],'method':_0x349442[_0x2319('0x62')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x349442[_0x2319('0x63')])==='number'&&parseInt(_0x349442[_0x2319('0x63')])>=0x1?parseInt(_0x349442[_0x2319('0x63')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x2319('0x64'),_0x2319('0x65')],_0x3af82b[_0x2319('0x62')][_0x2319('0x66')]())){try{_0x3af82b[_0x2319('0x67')]=_0x349442[_0x2319('0x8')]?JSON[_0x2319('0x68')](_0x349442[_0x2319('0x8')]):{};}catch(_0x1572c8){logger[_0x2319('0x26')](_0x2319('0x69'),_0x1572c8);}}try{_0x3af82b[_0x2319('0x6a')]=_0x349442[_0x2319('0x7')]?JSON[_0x2319('0x68')](_0x349442[_0x2319('0x7')]):{};}catch(_0x3ae386){logger[_0x2319('0x26')](_0x2319('0x6b'),_0x3ae386);}if(_0x349442[_0x2319('0x6c')]){try{var _0x2293dd=require(_0x349442[_0x2319('0x6c')])[_0x2319('0x6d')](this,_0x3af82b);_0x3af82b[_0x2319('0x6e')]=Mustache[_0x2319('0x6f')](_0x349442[_0x2319('0x70')],_0x2293dd,{},['$$','$$']);if(_0x3af82b[_0x2319('0x6a')]){_0x3af82b[_0x2319('0x6a')]=JSON['parse'](Mustache[_0x2319('0x6f')](JSON[_0x2319('0x71')](_0x3af82b[_0x2319('0x6a')]),_0x2293dd,{},['$$','$$']));}if(_0x3af82b['body']){_0x3af82b[_0x2319('0x67')]=JSON[_0x2319('0x68')](Mustache[_0x2319('0x6f')](JSON[_0x2319('0x71')](_0x3af82b['body']),_0x2293dd,{},['$$','$$']));}}catch(_0x45aa68){logger[_0x2319('0x26')](_0x2319('0x72'),_0x45aa68);}}rp(_0x3af82b)[_0x2319('0xd')](function(_0x3f7581){var _0x45d486={'statusCode':_0x3f7581[_0x2319('0x73')]||0xc8,'statusMessage':_0x3f7581[_0x2319('0x74')]||'OK','headers':_0x3f7581[_0x2319('0x6a')]||{},'body':_0x3f7581[_0x2319('0x67')]||{}};_0x4647fa(null,_0x45d486);})['catch'](function(_0x491c9f){var _0x50b27f={'statusCode':_0x491c9f[_0x2319('0x73')]||0x1f4,'statusMessage':_0x491c9f['message']||_0x2319('0x75'),'headers':_0x491c9f[_0x2319('0x76')][_0x2319('0x6a')]||{},'body':_0x491c9f[_0x2319('0x76')][_0x2319('0x67')]||{}};_0x4647fa(null,_0x50b27f);});};AGIVertices['prototype']['googleDialogflow']=function(_0x4b5313,_0x56ffbf){scripts['googleDialogflow'](this[_0x2319('0x32')][_0x2319('0x33')],_0x4b5313[_0x2319('0x77')],_0x4b5313[_0x2319('0x59')],_0x4b5313['dialogflow_language']||'en')[_0x2319('0xd')](function(_0x30700d){_0x56ffbf(null,_0x30700d);})[_0x2319('0xe')](function(_0x686254){_0x56ffbf(_0x686254);});};AGIVertices[_0x2319('0xf')][_0x2319('0x78')]=function(_0x2dd2ed,_0x14a8a7){scripts[_0x2319('0x78')](this[_0x2319('0x32')][_0x2319('0x33')],_0x2dd2ed[_0x2319('0x79')],_0x2dd2ed['client_email'],_0x2dd2ed[_0x2319('0x7a')],_0x2dd2ed[_0x2319('0x59')],_0x2dd2ed[_0x2319('0x7b')]||'en')[_0x2319('0xd')](function(_0x3f8894){_0x14a8a7(null,_0x3f8894);})[_0x2319('0xe')](function(_0x3517ef){_0x14a8a7(_0x3517ef);});};AGIVertices['prototype']['sestekNDA']=function(_0x239633,_0x22045e){scripts[_0x2319('0x7c')](this[_0x2319('0x32')],_0x239633)[_0x2319('0xd')](function(_0x2a8550){_0x22045e(null,_0x2a8550);})['catch'](function(_0x2f5a2a){_0x22045e(_0x2f5a2a);});};AGIVertices['prototype'][_0x2319('0x7d')]=function(_0x48d9f3,_0x4b7bc4){scripts[_0x2319('0x7d')](_0x48d9f3['key'],_0x48d9f3[_0x2319('0x59')],_0x48d9f3[_0x2319('0x7e')]||_0x2319('0x5a'),_0x48d9f3[_0x2319('0x7f')])[_0x2319('0xd')](function(_0xfe700d){_0x4b7bc4(null,_0xfe700d);})['catch'](function(_0x3e0241){_0x4b7bc4(_0x3e0241);});};AGIVertices[_0x2319('0xf')][_0x2319('0x80')]=function(_0x2cb5c2,_0x3ba9b0,_0xa48f0d){scripts[_0x2319('0x80')](_0x3ba9b0,_0x2cb5c2[_0x2319('0x77')],_0x2cb5c2[_0x2319('0x81')]||_0x2319('0x5a'),this[_0x2319('0x82')](_0x2cb5c2[_0x2319('0x83')])?_0x2cb5c2[_0x2319('0x83')]:undefined)[_0x2319('0xd')](function(_0x23689b){_0xa48f0d(null,_0x23689b);})[_0x2319('0xe')](function(_0x39b186){_0xa48f0d(_0x39b186);});};AGIVertices[_0x2319('0xf')][_0x2319('0x84')]=function(_0x1e99b6,_0x375f3b){scripts['awsPolly'](_0x1e99b6[_0x2319('0x85')],_0x1e99b6[_0x2319('0x86')],_0x1e99b6[_0x2319('0x87')],_0x1e99b6[_0x2319('0x88')]||'Amy',_0x1e99b6['text'],_0x1e99b6[_0x2319('0x89')]||'text')[_0x2319('0xd')](function(_0x5d1ddb){_0x375f3b(null,_0x5d1ddb);})[_0x2319('0xe')](function(_0x26b795){_0x375f3b(_0x26b795);});};AGIVertices[_0x2319('0xf')][_0x2319('0x8a')]=function(_0x5d70f0,_0x300765){scripts[_0x2319('0x8a')](this[_0x2319('0x32')][_0x2319('0x33')],_0x5d70f0[_0x2319('0x85')],_0x5d70f0[_0x2319('0x86')],_0x5d70f0['aws_lex_region'],_0x5d70f0[_0x2319('0x59')],_0x5d70f0[_0x2319('0x8b')])['then'](function(_0x44182f){_0x300765(null,_0x44182f);})[_0x2319('0xe')](function(_0x4a34a1){_0x300765(_0x4a34a1);});};AGIVertices[_0x2319('0xf')][_0x2319('0x8c')]=function(_0x7e1994,_0x2be231,_0x478c93){scripts[_0x2319('0x8c')](_0x2be231,_0x7e1994[_0x2319('0x77')],_0x7e1994['google_asr_language']||_0x2319('0x5a'))['then'](function(_0x435bd9){_0x478c93(null,_0x435bd9);})[_0x2319('0xe')](function(_0xfb67b5){_0x478c93(_0xfb67b5);});};AGIVertices[_0x2319('0xf')]['tildeASR']=function(_0x2ad14c,_0x5ca7f1,_0xdb87d7){scripts['tildeASR'](_0x5ca7f1,_0x2ad14c[_0x2319('0x8d')],_0x2ad14c[_0x2319('0x8e')],_0x2ad14c[_0x2319('0x6e')])[_0x2319('0xd')](function(_0x2a3ebd){_0xdb87d7(null,_0x2a3ebd);})['catch'](function(_0x20cd79){_0xdb87d7(_0x20cd79);});};AGIVertices['prototype']['clear']=function(_0x3c1eea){var _0x4061b8=_[_0x2319('0x8f')](verticesWithRetry,_0x3c1eea[_0x2319('0x90')])?_0x3c1eea:_[_0x2319('0x91')](_0x3c1eea);for(var _0x154e65 in _0x4061b8){if(_0x4061b8[_0x2319('0x92')](_0x154e65)){if(_0x4061b8[_0x154e65]&&_[_0x2319('0x93')](_0x4061b8[_0x154e65])){if(_[_0x2319('0x8f')](recursiveMapAttributes,_0x154e65)){_0x4061b8[_0x154e65]=this[_0x2319('0x94')](_0x4061b8[_0x154e65]);}else{_0x4061b8[_0x154e65]=this[_0x2319('0x95')](_0x4061b8[_0x154e65]);}}}}return _0x4061b8;};AGIVertices['prototype'][_0x2319('0x96')]=function(_0x58ea03){for(var _0x14dcde in _0x58ea03){if(_0x58ea03[_0x2319('0x92')](_0x14dcde)){if(_[_0x2319('0x97')](_0x58ea03[_0x14dcde])){this['recursiveNodeIndex'](_0x58ea03[_0x14dcde]);}else if(_[_0x2319('0x98')](_0x58ea03[_0x14dcde])){for(var _0x5c73f5=0x0;_0x5c73f5<_0x58ea03[_0x14dcde][_0x2319('0x99')];_0x5c73f5++){this[_0x2319('0x96')](_0x58ea03[_0x14dcde][_0x5c73f5]);}}else if(_['isString'](_0x58ea03[_0x14dcde])){_0x58ea03[_0x14dcde]=this[_0x2319('0x95')](_0x58ea03[_0x14dcde]);}}}};AGIVertices[_0x2319('0xf')][_0x2319('0x9a')]=function(_0x5f5a2c,_0x31ed81){for(var _0x487ddd in _0x5f5a2c){if(_0x5f5a2c['hasOwnProperty'](_0x487ddd)){if(_['isPlainObject'](_0x5f5a2c[_0x487ddd])){if(!_[_0x2319('0x40')](_0x5f5a2c[_0x487ddd])){this[_0x2319('0x9a')](_0x5f5a2c[_0x487ddd],util['format']('%s.%s',_0x31ed81,_0x487ddd));}}else if(_[_0x2319('0x98')](_0x5f5a2c[_0x487ddd])){for(var _0x334f8a=0x0;_0x334f8a<_0x5f5a2c[_0x487ddd][_0x2319('0x99')];_0x334f8a++){this['saveRestApiResult'](_0x5f5a2c[_0x487ddd][_0x334f8a],util[_0x2319('0x51')]('%s.%s',_0x31ed81,_0x487ddd+'['+_0x334f8a+']'));}}else{if(!_[_0x2319('0x3e')](_0x5f5a2c[_0x487ddd])){this[_0x2319('0x32')][_0x2319('0x9b')](util[_0x2319('0x51')](_0x2319('0x9c'),_0x31ed81,_0x487ddd),_0x5f5a2c[_0x487ddd]);}}}}};AGIVertices[_0x2319('0xf')][_0x2319('0x94')]=function(_0x55d842){try{var _0x7d113e=JSON[_0x2319('0x68')](_0x55d842);this['recursiveNodeIndex'](_0x7d113e);return JSON[_0x2319('0x71')](_0x7d113e);}catch(_0x11a2f0){return this[_0x2319('0x95')](_0x55d842);}};AGIVertices[_0x2319('0xf')][_0x2319('0x95')]=function(_0x1c900d){var _0x39eb04=_0x1c900d[_0x2319('0x9d')]('{');for(var _0xa6597d=0x1;_0xa6597d<_0x39eb04[_0x2319('0x99')];_0xa6597d+=0x1){var _0x55fdaf=_0x39eb04[_0xa6597d][_0x2319('0x9d')]('}');if(_0x55fdaf['length']>0x1){_0x1c900d=_0x1c900d[_0x2319('0x9e')]('{'+_0x55fdaf[0x0]+'}',this[_0x2319('0x32')][_0x2319('0xb')](_0x55fdaf[0x0])[_0x2319('0x9f')]||_0x55fdaf[0x0]);}}if(_0x39eb04[_0x2319('0x99')]===0x1){return _0x1c900d[_0x2319('0x47')]();}return this['replaceAllVariables'](_0x1c900d);};AGIVertices[_0x2319('0xf')][_0x2319('0xa0')]=function(_0x23ed83,_0x1861db){var _0x4f64b4=this[_0x2319('0x32')][_0x2319('0xb')](_0x23ed83);if(_0x4f64b4['result']===-0x1){return _0x4f64b4;}logger['info'](util[_0x2319('0x51')](_0x2319('0xa1'),_0x1861db,_0x4f64b4[_0x2319('0x9f')]));return this[_0x2319('0x32')][_0x2319('0x9b')](_0x1861db,_0x4f64b4[_0x2319('0x9f')]);};AGIVertices[_0x2319('0xf')]['isConfigured']=function(_0x22f57d){return _0x22f57d&&_0x22f57d!=='0'&&_0x22f57d!=='-1'&&_0x22f57d!=='';};AGIVertices[_0x2319('0xf')][_0x2319('0xa2')]=function(_0x611ef5){this[_0x2319('0x31')][_0x2319('0x6d')](this,_0x611ef5,'-');_0x611ef5[_0x2319('0xa3')]=_0x611ef5[_0x2319('0xa2')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x2319('0xf')]['mrcpsynth']=function(_0x17d206){logger[_0x2319('0x28')](util[_0x2319('0x51')](_0x2319('0xa4'),_0x17d206[_0x2319('0x34')]));if(!this[_0x2319('0x82')](_0x17d206[_0x2319('0x59')])){return this['channel'][_0x2319('0xa5')](_0x2319('0xa6'));}var _0x34f90a='\x22'+_0x17d206[_0x2319('0x59')]+'\x22';if(this[_0x2319('0x82')](_0x17d206[_0x2319('0x76')])){_0x34f90a+=','+_0x17d206[_0x2319('0x76')];}var _0x541e54=this[_0x2319('0x32')][_0x2319('0xa7')]('MRCPSynth',_0x34f90a);if(_0x541e54['result']===-0x1){return _0x541e54;}return this[_0x2319('0x32')]['noop'](util['format'](_0x2319('0xa8'),_0x34f90a));};AGIVertices['prototype'][_0x2319('0xa9')]=function(_0x10a816){logger['info'](util[_0x2319('0x51')](_0x2319('0xaa'),_0x10a816[_0x2319('0x34')]));if(!this['isConfigured'](_0x10a816[_0x2319('0xab')])){return this['channel']['noop'](_0x2319('0xac'));}var _0x1d137c=_0x10a816[_0x2319('0xab')];if(this['isConfigured'](_0x10a816[_0x2319('0x76')])){_0x1d137c+=','+_0x10a816[_0x2319('0x76')];}var _0x1a0fbf=this[_0x2319('0x32')]['exec'](_0x2319('0xad'),_0x1d137c);if(_0x1a0fbf[_0x2319('0xae')]===-0x1){return _0x1a0fbf;}var _0x1cebc6=this[_0x2319('0xa0')](_0x2319('0xaf'),'MRCP_RECOG_CONFIDENCE');if(_0x1cebc6['result']===-0x1){return _0x1cebc6;}var _0x20c1f9=this[_0x2319('0xa0')](_0x2319('0xb0'),'MRCP_RECOG_TRANSCRIPT');if(_0x20c1f9['result']===-0x1){return _0x20c1f9;}var _0x4e4284=this[_0x2319('0xa0')]('RECOG_INSTANCE()',_0x2319('0xb1'));if(_0x4e4284[_0x2319('0xae')]===-0x1){return _0x4e4284;}return this[_0x2319('0x32')][_0x2319('0xa5')](util[_0x2319('0x51')](_0x2319('0xb2'),_0x1d137c));};AGIVertices[_0x2319('0xf')][_0x2319('0x6')]=function(_0x1ea086){logger[_0x2319('0x28')](util['format']('Enter\x20in\x20AGI\x20(%s)\x20block',_0x1ea086[_0x2319('0x34')]));return this[_0x2319('0x32')][_0x2319('0x6')]([_0x1ea086[_0x2319('0xb3')],_0x1ea086[_0x2319('0xb4')]]);};AGIVertices['prototype'][_0x2319('0xb5')]=function(_0x55d7c7){logger[_0x2319('0x28')](util[_0x2319('0x51')](_0x2319('0xb6'),_0x55d7c7['label']));if(this['isConfigured'](_0x55d7c7['timeout'])){logger[_0x2319('0x28')](util[_0x2319('0x51')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x55d7c7[_0x2319('0x63')]));var _0x14f947=this[_0x2319('0x32')]['wait'](_0x55d7c7[_0x2319('0x63')]);if(_0x14f947[_0x2319('0xae')]===-0x1){return _0x14f947;}}return this[_0x2319('0x32')][_0x2319('0xb5')]();};AGIVertices[_0x2319('0xf')][_0x2319('0x44')]=function(_0x20c394){logger[_0x2319('0x28')](util[_0x2319('0x51')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x20c394[_0x2319('0x34')]));if(!this[_0x2319('0x82')](_0x20c394['list_id'])){return this[_0x2319('0x32')][_0x2319('0x26')](_0x20c394,_0x2319('0xb7'));}_0x20c394[_0x2319('0x46')]=moment();if(this[_0x2319('0x82')](_0x20c394['delay'])){_0x20c394[_0x2319('0x46')]=moment()[_0x2319('0xb8')](_0x20c394['delay'],'minutes');}if(!this[_0x2319('0x82')](_0x20c394[_0x2319('0x48')])){_0x20c394[_0x2319('0x48')]=0x2;}this[_0x2319('0x3d')][_0x2319('0x6d')](this,_0x20c394);return this[_0x2319('0x32')]['noop'](util[_0x2319('0x51')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x20c394[_0x2319('0x42')],_0x20c394['list_id'],_0x20c394['scheduledAt']));};AGIVertices['prototype']['custom_app']=function(_0x41cb8b){logger['info'](util['format'](_0x2319('0xb9'),_0x41cb8b['label']));var _0x548ba8=this[_0x2319('0x32')][_0x2319('0xa7')](_0x41cb8b[_0x2319('0xba')],_0x41cb8b[_0x2319('0x76')]);if(_0x548ba8[_0x2319('0xae')]===-0x1){return _0x548ba8;}return this[_0x2319('0x32')][_0x2319('0xa5')](util[_0x2319('0x51')](_0x2319('0xbb'),_0x41cb8b[_0x2319('0xba')],_0x41cb8b[_0x2319('0x76')]));};AGIVertices[_0x2319('0xf')]['lumenvoxtts']=function(_0x2ed83b){logger[_0x2319('0x28')](util[_0x2319('0x51')](_0x2319('0xbc'),_0x2ed83b[_0x2319('0x34')]));if(!this[_0x2319('0x82')](_0x2ed83b[_0x2319('0x59')])){return this[_0x2319('0x32')][_0x2319('0xa5')](_0x2319('0xa6'));}var _0x75e656='\x22'+_0x2ed83b[_0x2319('0x59')]+'\x22';if(this['isConfigured'](_0x2ed83b['options'])){_0x75e656+=','+_0x2ed83b[_0x2319('0x76')];}var _0x2b56c1=this[_0x2319('0x32')][_0x2319('0xa7')](_0x2319('0xbd'),_0x75e656);if(_0x2b56c1[_0x2319('0xae')]===-0x1){return _0x2b56c1;}return this[_0x2319('0x32')][_0x2319('0xa5')](util[_0x2319('0x51')](_0x2319('0xa8'),_0x75e656));};AGIVertices[_0x2319('0xf')]['sestektts']=function(_0x11e5a9){logger['info'](util['format'](_0x2319('0xbe'),_0x11e5a9[_0x2319('0x34')]));if(!this['isConfigured'](_0x11e5a9[_0x2319('0x59')])){return this['channel'][_0x2319('0xa5')](_0x2319('0xa6'));}var _0x22d9a1='\x22'+_0x11e5a9[_0x2319('0x59')]+'\x22';if(this[_0x2319('0x82')](_0x11e5a9[_0x2319('0x76')])){_0x22d9a1+=','+_0x11e5a9['options'];}var _0x317a65=this[_0x2319('0x32')]['exec']('MRCPSynth',_0x22d9a1);if(_0x317a65[_0x2319('0xae')]===-0x1){return _0x317a65;}return this[_0x2319('0x32')]['noop'](util[_0x2319('0x51')](_0x2319('0xa8'),_0x22d9a1));};AGIVertices['prototype'][_0x2319('0xbf')]=function(_0x16a4d5){logger[_0x2319('0x28')](util[_0x2319('0x51')](_0x2319('0xc0'),_0x16a4d5[_0x2319('0x34')]));if(!this['isConfigured'](_0x16a4d5['grammar'])){return this[_0x2319('0x32')][_0x2319('0xa5')](_0x2319('0xac'));}var _0x26b205=_0x16a4d5[_0x2319('0xab')];if(this[_0x2319('0x82')](_0x16a4d5['options'])){_0x26b205+=','+_0x16a4d5[_0x2319('0x76')];}var _0x38cb1d=this[_0x2319('0x32')][_0x2319('0xa7')](_0x2319('0xad'),_0x26b205);if(_0x38cb1d[_0x2319('0xae')]===-0x1){return _0x38cb1d;}var _0x5373c6=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x2319('0xc1'));if(_0x5373c6['result']===-0x1){return _0x5373c6;}var _0x33b83f=this[_0x2319('0xa0')](_0x2319('0xb0'),_0x2319('0xc2'));if(_0x33b83f[_0x2319('0xae')]===-0x1){return _0x33b83f;}var _0x4e879a=this['getAndSetVariable'](_0x2319('0xc3'),_0x2319('0xc4'));if(_0x4e879a['result']===-0x1){return _0x4e879a;}return this[_0x2319('0x32')]['noop'](util[_0x2319('0x51')](_0x2319('0xb2'),_0x26b205));};AGIVertices['prototype']['sestekasr']=function(_0x49a5a6){logger[_0x2319('0x28')](util[_0x2319('0x51')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x49a5a6[_0x2319('0x34')]));if(!this[_0x2319('0x82')](_0x49a5a6[_0x2319('0xab')])){return this[_0x2319('0x32')][_0x2319('0xa5')]('no\x20grammar\x20configured');}var _0x21433b=_0x49a5a6[_0x2319('0xab')];if(this[_0x2319('0x82')](_0x49a5a6[_0x2319('0x76')])){_0x21433b+=','+_0x49a5a6[_0x2319('0x76')];}var _0x3fdd68=this[_0x2319('0x32')][_0x2319('0xa7')](_0x2319('0xad'),_0x21433b);if(_0x3fdd68[_0x2319('0xae')]===-0x1){return _0x3fdd68;}var _0x4734aa=this['getAndSetVariable'](_0x2319('0xaf'),'SESTEK_ASR_CONFIDENCE');if(_0x4734aa[_0x2319('0xae')]===-0x1){return _0x4734aa;}var _0xd59245=this['getAndSetVariable'](_0x2319('0xb0'),_0x2319('0xc5'));if(_0xd59245[_0x2319('0xae')]===-0x1){return _0xd59245;}var _0x5d7dad=this[_0x2319('0xa0')](_0x2319('0xc3'),_0x2319('0xc6'));if(_0x5d7dad[_0x2319('0xae')]===-0x1){return _0x5d7dad;}return this['channel'][_0x2319('0xa5')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x21433b));};AGIVertices[_0x2319('0xf')]['database']=function(_0x3c1300){logger[_0x2319('0x28')](util[_0x2319('0x51')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x3c1300[_0x2319('0x34')]));if(!this[_0x2319('0x82')](_0x3c1300[_0x2319('0xc7')])){return this[_0x2319('0x32')][_0x2319('0x26')](_0x3c1300,_0x2319('0xc8'));}var _0x313e2b=this[_0x2319('0xc9')][_0x2319('0x6d')](this,_0x3c1300[_0x2319('0xc7')]);if(!_0x313e2b){return this[_0x2319('0x32')][_0x2319('0x26')](_0x3c1300,_0x2319('0xca'));}if(!this[_0x2319('0x82')](_0x3c1300[_0x2319('0x29')])){return this['channel'][_0x2319('0x26')](_0x3c1300,'no\x20query\x20configured');}var _0x4f2f54=_0x3c1300[_0x2319('0x29')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x2319('0x32')][_0x2319('0xa5')](util['format']('query:\x20%s',_0x4f2f54));var _0x54c45c=this[_0x2319('0x24')][_0x2319('0x6d')](this,_0x313e2b,_0x4f2f54);this[_0x2319('0x31')]['sync'](this,_0x3c1300,_0x4f2f54);if(!this[_0x2319('0x82')](_0x3c1300[_0x2319('0xcb')])){return this[_0x2319('0x32')][_0x2319('0xa5')](_0x2319('0xcc'));}var _0x3de4f4=this[_0x2319('0xb')][_0x2319('0x6d')](this,_0x3c1300[_0x2319('0xcb')]);if(!_0x3de4f4){return this['channel'][_0x2319('0x26')](_0x3c1300,_0x2319('0xcd'));}var _0x3e41f0=this;_0x54c45c[_0x2319('0xce')](function(_0x47f57a,_0x5e8d9d){Object['keys'](_0x47f57a)['forEach'](function(_0x36d06c){_0x3e41f0[_0x2319('0x32')][_0x2319('0x9b')](util[_0x2319('0x51')]('%s[%s][%s]',_0x3de4f4,_0x5e8d9d,_0x36d06c),_0x47f57a[_0x36d06c]);});});this[_0x2319('0x32')]['setVariable'](util[_0x2319('0x51')](_0x2319('0xcf'),_0x3de4f4),_0x54c45c[_0x2319('0x99')]);return this[_0x2319('0x32')]['noop'](util['format'](_0x2319('0xd0'),_0x3de4f4));};AGIVertices[_0x2319('0xf')][_0x2319('0xd1')]=function(_0x1e4380){logger[_0x2319('0xd2')](util[_0x2319('0x51')](_0x2319('0xd3'),_0x1e4380[_0x2319('0x34')]));if(!this['isConfigured'](_0x1e4380[_0x2319('0xd4')])){return this[_0x2319('0x32')][_0x2319('0x26')](_0x1e4380,_0x2319('0xd5'));}var _0x4b4d13=this[_0x2319('0x15')][_0x2319('0x6d')](this,_0x1e4380[_0x2319('0xd4')]);if(!_0x4b4d13){return this[_0x2319('0x32')][_0x2319('0x26')](_0x1e4380,_0x2319('0xd6'));}var _0x18c8ab=this['channel'][_0x2319('0xa7')](_0x2319('0xd7'),[util[_0x2319('0x51')]('SIP/%s',_0x4b4d13),_0x1e4380[_0x2319('0x63')],_0x1e4380[_0x2319('0xd8')],_0x1e4380[_0x2319('0x70')]]);if(_0x18c8ab[_0x2319('0xae')]===-0x1){return _0x18c8ab;}return this[_0x2319('0x32')][_0x2319('0xa5')](util[_0x2319('0x51')](_0x2319('0xd9'),_0x2319('0xd7')));};AGIVertices[_0x2319('0xf')][_0x2319('0xda')]=function(_0x1dd93a){logger[_0x2319('0x28')](util[_0x2319('0x51')](_0x2319('0xdb'),_0x1dd93a[_0x2319('0x34')]));if(!this['isConfigured'](_0x1dd93a['key'])){return this[_0x2319('0x32')][_0x2319('0xa5')](_0x2319('0xdc'));}if(!this[_0x2319('0x82')](_0x1dd93a['text'])){return this[_0x2319('0x32')]['noop'](_0x2319('0xa6'));}this[_0x2319('0x32')][_0x2319('0xdd')]=!![];this[_0x2319('0x31')](_0x1dd93a);this['createSquareMessage'](_0x1dd93a[_0x2319('0x59')],'in','','');this[_0x2319('0x32')]['noop'](util[_0x2319('0x51')](_0x2319('0xde'),_0x1dd93a['text']));var _0x53d753=this['googleDialogflow'][_0x2319('0x6d')](this,_0x1dd93a);if(_0x53d753){for(var _0x3862dd in _0x53d753){if(_0x53d753[_0x2319('0x92')](_0x3862dd)){this[_0x2319('0x32')]['setVariable'](util[_0x2319('0x51')](_0x2319('0xdf'),_0x3862dd[_0x2319('0x66')]()),_0x53d753[_0x3862dd]);}}this['createSquareMessage'](_0x53d753[_0x2319('0xe0')],'out',_0x2319('0xda'),'');return this[_0x2319('0x32')][_0x2319('0xa5')](util[_0x2319('0x51')]('Dialogflow\x20Result\x20%s',_0x53d753[_0x2319('0xe0')]));}return this[_0x2319('0x32')][_0x2319('0x26')](_0x1dd93a,_0x2319('0xe1'));};AGIVertices[_0x2319('0xf')][_0x2319('0xe2')]=function(_0x440fb3){logger['info'](util[_0x2319('0x51')](_0x2319('0xe3'),_0x440fb3[_0x2319('0x34')]));if(!this[_0x2319('0x82')](_0x440fb3[_0x2319('0x79')])){return this[_0x2319('0x32')][_0x2319('0xa5')](_0x2319('0xe4'));}if(!this['isConfigured'](_0x440fb3[_0x2319('0xe5')])){return this[_0x2319('0x32')][_0x2319('0xa5')](_0x2319('0xe6'));}if(!this[_0x2319('0x82')](_0x440fb3['private_key'])){return this[_0x2319('0x32')][_0x2319('0xa5')](_0x2319('0xe7'));}if(!this[_0x2319('0x82')](_0x440fb3[_0x2319('0x7b')])){return this[_0x2319('0x32')][_0x2319('0xa5')](_0x2319('0xe8'));}if(!this[_0x2319('0x82')](_0x440fb3[_0x2319('0x59')])){return this[_0x2319('0x32')][_0x2319('0xa5')](_0x2319('0xa6'));}this[_0x2319('0x32')]['bot']=!![];this[_0x2319('0x31')](_0x440fb3);this[_0x2319('0x3c')](_0x440fb3['text'],'in','','');this[_0x2319('0x32')][_0x2319('0xa5')](util[_0x2319('0x51')](_0x2319('0xe9'),_0x440fb3['text']));var _0x40e663=this['googleDialogflowV2']['sync'](this,_0x440fb3);if(_0x40e663){for(var _0x37fac5 in _0x40e663){if(_0x40e663[_0x2319('0x92')](_0x37fac5)){if(_0x37fac5!==_0x2319('0xea')){this[_0x2319('0x32')][_0x2319('0x9b')](util[_0x2319('0x51')](_0x2319('0xdf'),_0x37fac5['toUpperCase']()),_0x40e663[_0x37fac5]);}}}this[_0x2319('0x3c')](_0x40e663[_0x2319('0xe0')],_0x2319('0xeb'),_0x2319('0xe2'),_0x40e663[_0x2319('0xea')]);return this[_0x2319('0x32')][_0x2319('0xa5')](util[_0x2319('0x51')](_0x2319('0xec'),_0x40e663[_0x2319('0xe0')]));}return this[_0x2319('0x32')][_0x2319('0x26')](_0x440fb3,_0x2319('0xed'));};AGIVertices[_0x2319('0xf')][_0x2319('0xee')]=function(_0x2be757){logger[_0x2319('0x28')](util['format'](_0x2319('0xef'),_0x2be757['label']));if(!this[_0x2319('0x82')](_0x2be757[_0x2319('0xf0')])){return this[_0x2319('0x32')][_0x2319('0xa5')](_0x2319('0xf1'));}if(!this[_0x2319('0x82')](_0x2be757[_0x2319('0xf2')])){return this['channel'][_0x2319('0xa5')](_0x2319('0xf3'));}if(!this[_0x2319('0x82')](_0x2be757[_0x2319('0xf4')])){return this[_0x2319('0x32')][_0x2319('0xa5')](_0x2319('0xf5'));}if(!this['isConfigured'](_0x2be757[_0x2319('0xf6')])){return this[_0x2319('0x32')][_0x2319('0xa5')](_0x2319('0xa6'));}this[_0x2319('0x32')][_0x2319('0xdd')]=!![];this[_0x2319('0x31')](_0x2be757);this[_0x2319('0x3c')](_0x2be757[_0x2319('0x59')],'in','','');this['channel'][_0x2319('0xa5')](util[_0x2319('0x51')]('Trying\x20SestekNDA:\x20%s',_0x2be757['text']));var _0x3057b1=this[_0x2319('0x7c')][_0x2319('0x6d')](this,_0x2be757);if(_0x3057b1){for(var _0x24678a in _0x3057b1){if(_0x3057b1['hasOwnProperty'](_0x24678a)){this[_0x2319('0x32')][_0x2319('0x9b')](util[_0x2319('0x51')](_0x2319('0xf7'),_0x24678a['toUpperCase']()),_0x3057b1[_0x24678a]);}}this[_0x2319('0x3c')](_0x3057b1[_0x2319('0xe0')],_0x2319('0xeb'),_0x2319('0xee'),'');if(_0x3057b1[_0x2319('0xf8')]){this['channel'][_0x2319('0xa5')](util[_0x2319('0x51')](_0x2319('0xf9'),_0x3057b1[_0x2319('0xf8')]));var _0x1ae34a=this[_0x2319('0x32')]['streamFile'](_0x3057b1['audiofile']);try{fs[_0x2319('0xfa')](_0x3057b1['audiofile']+'.wav');}catch(_0x25af06){logger[_0x2319('0x26')](_0x25af06);}return _0x1ae34a;}else{return this['channel'][_0x2319('0xa5')](util[_0x2319('0x51')](_0x2319('0xfb'),_0x3057b1[_0x2319('0xe0')]));}}return this[_0x2319('0x32')][_0x2319('0x26')](_0x2be757,_0x2319('0xfc'));};AGIVertices[_0x2319('0xf')][_0x2319('0xfd')]=function(_0x3e528c){logger[_0x2319('0x28')](util[_0x2319('0x51')](_0x2319('0xfe'),_0x3e528c['label']));return this['channel'][_0x2319('0xa5')]('end');};AGIVertices[_0x2319('0xf')][_0x2319('0xff')]=function(_0x43efa4){logger['info'](util[_0x2319('0x51')](_0x2319('0x100'),_0x43efa4[_0x2319('0x34')]));var _0x508f67='';if(_0x43efa4['trunk_id']){if(!this[_0x2319('0x82')](_0x43efa4['trunk_id'])){return this['channel'][_0x2319('0x26')](_0x43efa4,'no\x20trunk\x20selected');}else{var _0x3bad9b=parseInt(_0x43efa4[_0x2319('0x101')],0xa);if(isNaN(_0x3bad9b)){_0x508f67=_0x43efa4[_0x2319('0x101')];}else{_0x508f67=this['getTrunk'][_0x2319('0x6d')](this,_0x43efa4[_0x2319('0x101')]);if(!_0x508f67){return this[_0x2319('0x32')][_0x2319('0x26')](_0x43efa4,_0x2319('0x102'));}}}}else if(_0x43efa4[_0x2319('0x103')]){_0x508f67=_0x43efa4[_0x2319('0x103')];}else{return this['channel']['error'](_0x43efa4,_0x2319('0x104'));}var _0x48bf47=this['channel'][_0x2319('0xa7')](_0x2319('0xd7'),[util[_0x2319('0x51')](_0x2319('0x105'),_0x508f67,_0x43efa4['phone']),_0x43efa4[_0x2319('0x63')],_0x43efa4[_0x2319('0xd8')],_0x43efa4[_0x2319('0x70')]]);if(_0x48bf47[_0x2319('0xae')]===-0x1){return _0x48bf47;}return this[_0x2319('0x32')][_0x2319('0xa5')](util[_0x2319('0x51')](_0x2319('0xd9'),_0x2319('0xd7')));};AGIVertices[_0x2319('0xf')][_0x2319('0x106')]=function(_0x13af22){logger[_0x2319('0x28')](util[_0x2319('0x51')](_0x2319('0x107'),_0x13af22[_0x2319('0x34')]));return this['channel']['noop']('finally');};AGIVertices[_0x2319('0xf')][_0x2319('0x9')]=function(_0x263e37){logger[_0x2319('0x28')](util[_0x2319('0x51')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x263e37[_0x2319('0x34')]));if(_0x263e37['retry']===0x0){return this[_0x2319('0xa2')](_0x263e37);}_0x263e37[_0x2319('0xa3')]-=0x1;if(!this[_0x2319('0x82')](_0x263e37[_0x2319('0x108')])){return this[_0x2319('0x32')]['error'](_0x263e37,_0x2319('0x109'));}var _0x3bb50d=this[_0x2319('0x10a')][_0x2319('0x6d')](this,_0x263e37[_0x2319('0x108')]);if(!_0x3bb50d){return this[_0x2319('0x32')]['error'](_0x263e37,_0x2319('0x10b'));}if(!this['isConfigured'](_0x263e37[_0x2319('0xcb')])){return this[_0x2319('0x32')][_0x2319('0x26')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x598431=this[_0x2319('0x32')][_0x2319('0x10c')](_0x3bb50d,_0x263e37[_0x2319('0x10d')],_0x263e37[_0x2319('0x10e')]);var _0x2bdc19=_0x598431[_0x2319('0xae')]?_0x598431['result'][_0x2319('0x47')]():'';logger[_0x2319('0x28')](_0x2319('0x10f'),JSON['stringify'](_0x598431));if(_0x598431[_0x2319('0xae')]===-0x1){this['createSquareDetailsReport'][_0x2319('0x6d')](this,_0x263e37,_0x2bdc19);return _0x598431;}else if(_0x598431['extra']==='timeout'){_0x598431['result']=_0x2bdc19[_0x2319('0x99')]>=parseInt(_0x263e37[_0x2319('0x110')])?'x':'i';}else{_0x598431[_0x2319('0xae')]=_0x2bdc19['length']>=parseInt(_0x263e37[_0x2319('0x110')])&&_0x2bdc19[_0x2319('0x99')]<=parseInt(_0x263e37[_0x2319('0x10e')])?'x':'i';}var _0x2eb728=this['getVariable'][_0x2319('0x6d')](this,_0x263e37[_0x2319('0xcb')]);if(!_0x2eb728){return this[_0x2319('0x32')][_0x2319('0x26')](_0x263e37,_0x2319('0xcd'));}this['channel']['setVariable'](_0x2eb728,_0x2bdc19);if(this[_0x2319('0x82')](_0x263e37[_0x2319('0x111')])){var _0x3191a1=parseInt(_0x263e37[_0x2319('0x111')],0xa);var _0x244771=rs['generate']({'charset':'*','length':_0x3191a1});var _0x3d76ad=_0x2bdc19['length'];if(_0x3d76ad>0x0){if(_0x3d76ad>_0x3191a1){this[_0x2319('0x31')][_0x2319('0x6d')](this,_0x263e37,_0x263e37['hiddendigitspos']===_0x2319('0x112')?_0x244771+_0x2bdc19['substr'](_0x3191a1):_0x2bdc19[_0x2319('0x113')](0x0,_0x3d76ad-_0x3191a1)+_0x244771);}else{this[_0x2319('0x31')]['sync'](this,_0x263e37,rs[_0x2319('0x114')]({'charset':'*','length':_0x3d76ad}));}}else{this[_0x2319('0x31')]['sync'](this,_0x263e37,'');}}else{this[_0x2319('0x31')][_0x2319('0x6d')](this,_0x263e37,_0x2bdc19);}return _0x598431;};AGIVertices[_0x2319('0xf')][_0x2319('0xa')]=function(_0x19bdd2){logger['info'](util['format'](_0x2319('0x115'),_0x19bdd2[_0x2319('0x34')]));return this['getdigits'](_0x19bdd2);};AGIVertices[_0x2319('0xf')][_0x2319('0x116')]=function(_0x92c12f){logger[_0x2319('0x28')](util[_0x2319('0x51')](_0x2319('0x117'),_0x92c12f[_0x2319('0x34')]));this[_0x2319('0x31')][_0x2319('0x6d')](this,_0x92c12f,_0x92c12f[_0x2319('0x118')]);return this[_0x2319('0x32')][_0x2319('0xa5')](util[_0x2319('0x51')]('GOAL\x20%s',_0x92c12f[_0x2319('0x118')]));};AGIVertices['prototype'][_0x2319('0x119')]=function(_0x227c76){logger['info'](util[_0x2319('0x51')](_0x2319('0x11a'),_0x227c76[_0x2319('0x34')]));if(!this[_0x2319('0x82')](_0x227c76[_0x2319('0x85')])||!this[_0x2319('0x82')](_0x227c76[_0x2319('0x86')])){return this[_0x2319('0x32')]['noop'](_0x2319('0x11b'));}if(!this[_0x2319('0x82')](_0x227c76[_0x2319('0x59')])){return this[_0x2319('0x32')]['noop'](_0x2319('0xa6'));}this[_0x2319('0x32')][_0x2319('0xa5')](util['format'](_0x2319('0x11c'),_0x227c76[_0x2319('0x59')]));var _0x4ae95d=this[_0x2319('0x84')]['sync'](this,_0x227c76);if(_0x4ae95d){this[_0x2319('0x32')][_0x2319('0xa5')](util['format'](_0x2319('0x11d'),_0x4ae95d));var _0x3db175=this[_0x2319('0x32')]['streamFile'](_0x4ae95d);try{fs['unlink'](_0x4ae95d+_0x2319('0x11e'));}catch(_0x3a60c9){logger[_0x2319('0x26')](_0x3a60c9);}return _0x3db175;}return this[_0x2319('0x32')][_0x2319('0x26')](_0x227c76,_0x2319('0x11f'));};AGIVertices[_0x2319('0xf')][_0x2319('0x120')]=function(_0x9cd574){logger['info'](util[_0x2319('0x51')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x9cd574[_0x2319('0x34')]));if(!this[_0x2319('0x82')](_0x9cd574[_0x2319('0x85')])||!this['isConfigured'](_0x9cd574[_0x2319('0x86')])){return this['channel']['noop'](_0x2319('0x11b'));}if(!this[_0x2319('0x82')](_0x9cd574[_0x2319('0x8b')])){return this[_0x2319('0x32')][_0x2319('0xa5')](_0x2319('0x121'));}if(!this[_0x2319('0x82')](_0x9cd574[_0x2319('0x59')])){return this[_0x2319('0x32')][_0x2319('0xa5')](_0x2319('0xa6'));}this[_0x2319('0x32')][_0x2319('0xdd')]=!![];this[_0x2319('0x31')](_0x9cd574);this[_0x2319('0x3c')](_0x9cd574[_0x2319('0x59')],'in','','');this['channel'][_0x2319('0xa5')](util[_0x2319('0x51')](_0x2319('0x122'),_0x9cd574[_0x2319('0x59')]));var _0x224f94=this[_0x2319('0x8a')]['sync'](this,_0x9cd574);if(_0x224f94){for(var _0x3da621 in _0x224f94){if(_0x224f94[_0x2319('0x92')](_0x3da621)&&_[_0x2319('0x93')](_0x224f94[_0x3da621])){this['channel']['setVariable'](util[_0x2319('0x51')](_0x2319('0x123'),_0x3da621[_0x2319('0x66')]()),_0x224f94[_0x3da621]);}}if(_[_0x2319('0x3e')](_0x224f94[_0x2319('0x124')])){return this[_0x2319('0x32')]['noop']('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x2319('0x3c')](_0x224f94[_0x2319('0x124')],_0x2319('0xeb'),_0x2319('0x125'),'');return this[_0x2319('0x32')][_0x2319('0xa5')](util['format'](_0x2319('0x126'),_0x224f94[_0x2319('0x124')]));}}return this[_0x2319('0x32')][_0x2319('0x26')](_0x9cd574,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x2319('0xf')][_0x2319('0x127')]=function(_0x4cbc08){logger[_0x2319('0x28')](util['format'](_0x2319('0x128'),_0x4cbc08[_0x2319('0x34')],_0x4cbc08[_0x2319('0x63')]));if(!this[_0x2319('0x82')](_0x4cbc08[_0x2319('0x77')])){return this[_0x2319('0x32')]['noop'](_0x2319('0xdc'));}var _0x481729=_0x2319('0x129');var _0x2d5b1e=util['format'](_0x2319('0x12a'),FILES_PATH,rs[_0x2319('0x114')](0x4));var _0x4860a4=util['format']('%s.%s',_0x2d5b1e,_0x481729);var _0xcbef4e=!![];if(_0x4cbc08['beep']===_0x2319('0x12b')){_0xcbef4e=![];}var _0xd4077d=this[_0x2319('0x32')]['recordFile'](_0x2d5b1e,_0x481729,_0x4cbc08[_0x2319('0x12c')],_0x4cbc08[_0x2319('0x63')],undefined,_0xcbef4e);if(_0xd4077d[_0x2319('0xae')]!==-0x1){this[_0x2319('0x32')][_0x2319('0xa5')](util[_0x2319('0x51')](_0x2319('0x12d'),_0x4860a4));var _0xa92ec0=this[_0x2319('0x8c')]['sync'](this,_0x4cbc08,_0x4860a4);if(_0xa92ec0){for(var _0x21ba8f in _0xa92ec0){if(_0xa92ec0['hasOwnProperty'](_0x21ba8f)){this[_0x2319('0x32')][_0x2319('0x9b')](util[_0x2319('0x51')]('GOOGLE_ASR_%s',_0x21ba8f[_0x2319('0x66')]()),_0xa92ec0[_0x21ba8f]);}}return this[_0x2319('0x32')][_0x2319('0xa5')](util[_0x2319('0x51')](_0x2319('0x12e'),JSON[_0x2319('0x71')](_0xa92ec0)));}}return _0xd4077d;};AGIVertices['prototype'][_0x2319('0x12f')]=function(_0x4b5644){logger['info'](util['format'](_0x2319('0x130'),_0x4b5644[_0x2319('0x34')]));if(!this[_0x2319('0x82')](_0x4b5644[_0x2319('0x8d')])){return this[_0x2319('0x32')][_0x2319('0xa5')](_0x2319('0x131'));}if(!this[_0x2319('0x82')](_0x4b5644[_0x2319('0x8e')])){return this[_0x2319('0x32')][_0x2319('0xa5')]('no\x20appsecret\x20configured');}var _0x478fd6=_0x2319('0x129');var _0x178f1a=util[_0x2319('0x51')]('%s/recordings/%s',FILES_PATH,rs[_0x2319('0x114')](0x4));var _0x2e43a6=util[_0x2319('0x51')]('%s.%s',_0x178f1a,_0x478fd6);var _0x436433=!![];if(_0x4b5644[_0x2319('0x132')]===_0x2319('0x12b')){_0x436433=![];}var _0x2371c6=this[_0x2319('0x32')][_0x2319('0x133')](_0x178f1a,_0x478fd6,_0x4b5644[_0x2319('0x12c')],_0x4b5644[_0x2319('0x63')],undefined,_0x436433);if(_0x2371c6['result']!==-0x1){this[_0x2319('0x32')][_0x2319('0xa5')](util[_0x2319('0x51')](_0x2319('0x134'),_0x2e43a6));var _0x647cdd=this[_0x2319('0x135')][_0x2319('0x6d')](this,_0x4b5644,_0x2e43a6);if(_0x647cdd){for(var _0x349df2 in _0x647cdd){if(_0x647cdd[_0x2319('0x92')](_0x349df2)){this[_0x2319('0x32')][_0x2319('0x9b')](util[_0x2319('0x51')](_0x2319('0x136'),_0x349df2['toUpperCase']()),_0x647cdd[_0x349df2]);}}return this[_0x2319('0x32')][_0x2319('0xa5')](util[_0x2319('0x51')](_0x2319('0x137'),JSON[_0x2319('0x71')](_0x647cdd)));}}return _0x2371c6;};AGIVertices[_0x2319('0xf')]['gotoc']=function(_0x52864c){logger[_0x2319('0x28')](util['format'](_0x2319('0x138'),_0x52864c[_0x2319('0x34')]));return this[_0x2319('0x32')][_0x2319('0x139')](_0x52864c[_0x2319('0x38')],_0x52864c[_0x2319('0x39')],_0x52864c[_0x2319('0x13a')]);};AGIVertices['prototype']['gotoif']=function(_0x3ab620){logger[_0x2319('0x28')](util[_0x2319('0x51')](_0x2319('0x13b'),_0x3ab620['label']));if(!this[_0x2319('0x82')](_0x3ab620[_0x2319('0x13c')])){return this[_0x2319('0x32')]['error'](_0x3ab620,'no\x20condition\x20configured');}try{var _0x1eee9d=eval(_0x3ab620[_0x2319('0x13c')])?_0x2319('0x13d'):'false';this[_0x2319('0x32')][_0x2319('0xa5')](util[_0x2319('0x51')]('EVAL\x20CONDITION\x20%s\x20%s',_0x3ab620['condition'],_0x1eee9d));return{'code':0xc8,'result':_0x1eee9d};}catch(_0x1a0929){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x2319('0xf')][_0x2319('0x13e')]=function(_0x205349){logger[_0x2319('0x28')](util[_0x2319('0x51')](_0x2319('0x13f'),_0x205349[_0x2319('0x34')]));if(!this[_0x2319('0x82')](_0x205349[_0x2319('0x140')])){return this['channel'][_0x2319('0x26')](_0x205349,_0x2319('0x141'));}var _0x1101c1=this[_0x2319('0x1d')][_0x2319('0x6d')](this,_0x205349[_0x2319('0x140')]);if(!_0x1101c1){return this[_0x2319('0x32')][_0x2319('0x26')](_0x205349,_0x2319('0x142'));}for(var _0x1d0418=0x0;_0x1d0418<_0x1101c1[_0x2319('0x99')];_0x1d0418+=0x1){var _0x1441d8=this[_0x2319('0x32')]['getVariable'](util[_0x2319('0x51')](_0x2319('0x143'),_0x1101c1[_0x1d0418]));if(_0x1441d8[_0x2319('0xae')]===-0x1){return _0x1441d8;}logger['info'](util['format'](_0x2319('0x144'),_0x1101c1[_0x1d0418],_0x1441d8[_0x2319('0x9f')]));if(_0x1441d8[_0x2319('0x9f')]===_0x2319('0x13d')){logger[_0x2319('0x28')](util[_0x2319('0x51')](_0x2319('0x144'),_0x1101c1[_0x1d0418],_0x2319('0x13d')));this[_0x2319('0x32')]['noop'](util[_0x2319('0x51')]('IFTIME\x20%s\x20%s',_0x1101c1[_0x1d0418],_0x2319('0x13d')));return{'code':0xc8,'result':'true'};}else{logger[_0x2319('0x28')](util['format'](_0x2319('0x144'),_0x1101c1[_0x1d0418],_0x2319('0x145')));this[_0x2319('0x32')][_0x2319('0xa5')](util[_0x2319('0x51')](_0x2319('0x144'),_0x1101c1[_0x1d0418],'false'));}}return{'code':0xc8,'result':_0x2319('0x145')};};AGIVertices['prototype']['hangup']=function(_0x394d04){logger['info'](util[_0x2319('0x51')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x394d04[_0x2319('0x34')]));return this['channel'][_0x2319('0x146')]();};AGIVertices[_0x2319('0xf')]['ispeechasr']=function(_0x1a25dc){logger['info'](util[_0x2319('0x51')](_0x2319('0x147'),_0x1a25dc[_0x2319('0x34')]));if(!this['isConfigured'](_0x1a25dc[_0x2319('0x77')])){return this[_0x2319('0x32')][_0x2319('0xa5')](_0x2319('0xdc'));}var _0x29b5b0=_0x2319('0x129');var _0x16f08d=util[_0x2319('0x51')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x4a963b=util[_0x2319('0x51')](_0x2319('0x9c'),_0x16f08d,_0x29b5b0);var _0x5190e0=!![];if(_0x1a25dc[_0x2319('0x132')]===_0x2319('0x12b')){_0x5190e0=![];}var _0x1c5712=this[_0x2319('0x32')][_0x2319('0x133')](_0x16f08d,_0x29b5b0,_0x1a25dc[_0x2319('0x12c')],_0x1a25dc[_0x2319('0x63')],undefined,_0x5190e0);if(_0x1c5712['result']!==-0x1){this['channel'][_0x2319('0xa5')](util['format'](_0x2319('0x148'),_0x4a963b));var _0x261379=this[_0x2319('0x80')]['sync'](this,_0x1a25dc,_0x4a963b);if(_0x261379){for(var _0x4fbed5 in _0x261379){if(_0x261379['hasOwnProperty'](_0x4fbed5)){this['channel'][_0x2319('0x9b')](util[_0x2319('0x51')]('ISPEECH_ASR_%s',_0x4fbed5[_0x2319('0x66')]()),_0x261379[_0x4fbed5]);}}return this[_0x2319('0x32')][_0x2319('0xa5')](util[_0x2319('0x51')](_0x2319('0x149'),JSON[_0x2319('0x71')](_0x261379)));}}return _0x1c5712;};AGIVertices[_0x2319('0xf')][_0x2319('0x14a')]=function(_0x4d8d1d){logger[_0x2319('0x28')](util[_0x2319('0x51')](_0x2319('0x14b'),_0x4d8d1d['label']));if(!this[_0x2319('0x82')](_0x4d8d1d[_0x2319('0x77')])){return this[_0x2319('0x32')]['noop'](_0x2319('0xdc'));}if(!this[_0x2319('0x82')](_0x4d8d1d[_0x2319('0x59')])){return this[_0x2319('0x32')][_0x2319('0xa5')](_0x2319('0xa6'));}this[_0x2319('0x32')][_0x2319('0xa5')](util[_0x2319('0x51')]('Trying\x20ispeech\x20TTS\x20%s',_0x4d8d1d['text']));var _0x3b83dd=this[_0x2319('0x7d')][_0x2319('0x6d')](this,_0x4d8d1d);if(_0x3b83dd){this[_0x2319('0x32')]['noop'](util[_0x2319('0x51')]('ispeech\x20%s\x20file\x20created',_0x3b83dd));var _0x512158=this[_0x2319('0x32')][_0x2319('0x14c')](_0x3b83dd,_0x4d8d1d['intKey']);try{fs[_0x2319('0xfa')](_0x3b83dd+'.wav');}catch(_0x15e5d2){logger[_0x2319('0x26')](_0x15e5d2);}return _0x512158;}return this['channel'][_0x2319('0x26')](_0x4d8d1d,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x2319('0xf')][_0x2319('0x14d')]=function(_0x13aa3f){logger[_0x2319('0x28')](util[_0x2319('0x51')](_0x2319('0x14e'),_0x13aa3f[_0x2319('0x34')]));if(!this[_0x2319('0x82')](_0x13aa3f[_0x2319('0x14f')])){return this[_0x2319('0x32')]['error'](_0x13aa3f,_0x2319('0x150'));}logger['info'](util['format'](_0x2319('0x151'),this[_0x2319('0x32')][_0x2319('0x36')],_0x13aa3f['findBy']));var _0x5a8231=this[_0x2319('0x4f')]['sync'](this,_0x13aa3f[_0x2319('0x14f')]);if(_0x5a8231){logger[_0x2319('0x28')](util[_0x2319('0x51')](_0x2319('0x152'),this[_0x2319('0x32')][_0x2319('0x36')],_0x13aa3f[_0x2319('0x14f')]));this[_0x2319('0x32')]['noop'](util[_0x2319('0x51')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x2319('0x32')][_0x2319('0x36')],_0x13aa3f[_0x2319('0x14f')]));return{'code':0xc8,'result':_0x2319('0x153')};}else{logger[_0x2319('0x28')](util[_0x2319('0x51')](_0x2319('0x154'),this['channel'][_0x2319('0x36')],_0x13aa3f[_0x2319('0x14f')]));this[_0x2319('0x32')][_0x2319('0xa5')](util[_0x2319('0x51')](_0x2319('0x154'),this['channel'][_0x2319('0x36')],_0x13aa3f['findBy']));return{'code':0xc8,'result':_0x2319('0x155')};}};AGIVertices[_0x2319('0xf')][_0x2319('0x156')]=function(_0x1d8376){logger[_0x2319('0x28')](util[_0x2319('0x51')](_0x2319('0x157'),_0x1d8376[_0x2319('0x34')]));if(!this[_0x2319('0x82')](_0x1d8376['findBy'])){return this[_0x2319('0x32')][_0x2319('0x26')](_0x1d8376,_0x2319('0x150'));}logger[_0x2319('0x28')](util[_0x2319('0x51')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x2319('0x32')][_0x2319('0x36')],_0x1d8376[_0x2319('0x14f')]));var _0x4aaa0a=this[_0x2319('0x4e')][_0x2319('0x6d')](this,_0x1d8376['findBy']);if(_0x4aaa0a){logger[_0x2319('0x28')](util[_0x2319('0x51')](_0x2319('0x152'),this['channel'][_0x2319('0x36')],_0x1d8376[_0x2319('0x14f')]));this['channel'][_0x2319('0xa5')](util[_0x2319('0x51')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x2319('0x36')],_0x1d8376[_0x2319('0x14f')]));return{'code':0xc8,'result':_0x2319('0x153')};}else{logger[_0x2319('0x28')](util['format'](_0x2319('0x154'),this[_0x2319('0x32')]['callerid'],_0x1d8376[_0x2319('0x14f')]));this[_0x2319('0x32')]['noop'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x2319('0x32')][_0x2319('0x36')],_0x1d8376[_0x2319('0x14f')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x2319('0xf')][_0x2319('0x158')]=function(_0x54e1c6){logger[_0x2319('0x28')](util['format'](_0x2319('0x159'),_0x54e1c6[_0x2319('0x34')]));if(!this[_0x2319('0x82')](_0x54e1c6['operation'])){return this[_0x2319('0x32')][_0x2319('0x26')](_0x54e1c6,_0x2319('0x15a'));}this['channel'][_0x2319('0xa5')](util[_0x2319('0x51')](_0x2319('0x15b'),_0x54e1c6[_0x2319('0x15c')]));var _0x3af4b9=eval(_0x54e1c6[_0x2319('0x15c')]);if(!this[_0x2319('0x82')](_0x54e1c6[_0x2319('0xcb')])){return this[_0x2319('0x32')][_0x2319('0xa5')](_0x2319('0xcc'));}var _0x4725dc=this['getVariable']['sync'](this,_0x54e1c6['variable_id']);if(!_0x4725dc){return this[_0x2319('0x32')][_0x2319('0x26')](_0x54e1c6,_0x2319('0xcd'));}if(_[_0x2319('0x98')](_0x3af4b9)){var _0x2d3a8c=this;_0x3af4b9['forEach'](function(_0x4f7def,_0x24cecd){_0x2d3a8c['channel'][_0x2319('0x9b')](util[_0x2319('0x51')]('%s[%s]',_0x4725dc,_0x24cecd),_0x4f7def);});return this[_0x2319('0x32')]['noop'](util[_0x2319('0x51')]('variable\x20%s[key]\x20set',_0x4725dc));}else{return this['channel'][_0x2319('0x9b')](_0x4725dc,_0x3af4b9);}};AGIVertices[_0x2319('0xf')][_0x2319('0x15d')]=function(_0x546c46){logger[_0x2319('0x28')](util[_0x2319('0x51')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x546c46[_0x2319('0x34')]));if(_0x546c46['retry']===0x0){return this[_0x2319('0xa2')](_0x546c46);}_0x546c46['retry']-=0x1;if(!this[_0x2319('0x82')](_0x546c46[_0x2319('0x108')])){return this['channel'][_0x2319('0x26')](_0x546c46,_0x2319('0x109'));}var _0x33d071=this[_0x2319('0x10a')][_0x2319('0x6d')](this,_0x546c46[_0x2319('0x108')]);if(!_0x33d071){return this[_0x2319('0x32')][_0x2319('0x26')](_0x546c46,_0x2319('0x10b'));}var _0x261159=this[_0x2319('0x32')][_0x2319('0x10c')](_0x33d071,_0x546c46[_0x2319('0x10d')],_0x546c46['digit']);var _0x179d09=_0x261159[_0x2319('0xae')];if(_0x261159[_0x2319('0xae')]===-0x1){this[_0x2319('0x31')][_0x2319('0x6d')](this,_0x546c46,'-1');return _0x261159;}else if(_0x261159[_0x2319('0x9f')]===_0x2319('0x63')){_0x261159['result']=_0x261159[_0x2319('0xae')][_0x2319('0x99')]>0x0?_0x261159['result']:'t';}else if(_[_0x2319('0x40')](_0x261159[_0x2319('0xae')])){_0x261159[_0x2319('0xae')]='#';_0x179d09='#';}if(!this[_0x2319('0x82')](_0x546c46['variable_id'])){this[_0x2319('0x32')][_0x2319('0xa5')](_0x2319('0xcc'));}else{var _0x216838=this['getVariable'][_0x2319('0x6d')](this,_0x546c46[_0x2319('0xcb')]);if(!_0x216838){return this[_0x2319('0x32')]['error'](_0x546c46,_0x2319('0xcd'));}this[_0x2319('0x32')][_0x2319('0x9b')](_0x216838,_0x179d09);}this[_0x2319('0x31')][_0x2319('0x6d')](this,_0x546c46,_0x179d09);return _0x261159;};AGIVertices[_0x2319('0xf')][_0x2319('0xa5')]=function(_0x192c92){logger[_0x2319('0x28')](util['format'](_0x2319('0x15e'),_0x192c92[_0x2319('0x34')]));return this[_0x2319('0x32')][_0x2319('0xa5')](_0x192c92[_0x2319('0x15f')]||_0x192c92[_0x2319('0x34')]);};AGIVertices['prototype']['pause']=function(_0x4edc75){logger[_0x2319('0x28')](util[_0x2319('0x51')](_0x2319('0x160'),_0x4edc75['label']));if(!this[_0x2319('0x82')](_0x4edc75[_0x2319('0x14f')])){return this[_0x2319('0x32')][_0x2319('0x26')](_0x4edc75,_0x2319('0x150'));}logger[_0x2319('0x28')](util[_0x2319('0x51')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x2319('0x32')][_0x2319('0x36')],_0x4edc75[_0x2319('0x14f')]));var _0x1f318b=this['getPause'][_0x2319('0x6d')](this,_0x4edc75['pause_id']);var _0x505110=this[_0x2319('0x4b')][_0x2319('0x6d')](this,_0x4edc75[_0x2319('0x14f')],_0x1f318b);if(_0x505110){logger[_0x2319('0x28')](util[_0x2319('0x51')](_0x2319('0x152'),this['channel']['callerid'],_0x4edc75[_0x2319('0x14f')]));this[_0x2319('0x32')][_0x2319('0xa5')](util[_0x2319('0x51')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x2319('0x36')],_0x4edc75[_0x2319('0x14f')]));return{'code':0xc8,'result':'success'};}else{logger[_0x2319('0x28')](util[_0x2319('0x51')](_0x2319('0x154'),this[_0x2319('0x32')]['callerid'],_0x4edc75[_0x2319('0x14f')]));this[_0x2319('0x32')]['noop'](util[_0x2319('0x51')](_0x2319('0x152'),this['channel'][_0x2319('0x36')],_0x4edc75['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x2319('0x161')]=function(_0x22ab28){logger['info'](util[_0x2319('0x51')](_0x2319('0x162'),_0x22ab28[_0x2319('0x34')]));if(!this[_0x2319('0x82')](_0x22ab28[_0x2319('0x108')])){return this[_0x2319('0x32')]['error'](_0x22ab28,_0x2319('0x109'));}var _0x2f3e3c=this['getSound'][_0x2319('0x6d')](this,_0x22ab28['file_id']);if(!_0x2f3e3c){return this['channel'][_0x2319('0x26')](_0x22ab28,_0x2319('0x10b'));}var _0x25e163=this[_0x2319('0x32')][_0x2319('0xa7')](_0x2319('0x163'),[_0x2f3e3c,_0x22ab28[_0x2319('0xd8')]]);if(_0x25e163[_0x2319('0xae')]===-0x1){return _0x25e163;}return this[_0x2319('0x32')][_0x2319('0xa5')](util[_0x2319('0x51')](_0x2319('0xbb'),_0x2319('0x163'),_0x2f3e3c));};AGIVertices[_0x2319('0xf')][_0x2319('0x164')]=function(_0x1929cb){logger[_0x2319('0x28')](util[_0x2319('0x51')](_0x2319('0x165'),_0x1929cb[_0x2319('0x34')]));if(!this[_0x2319('0x82')](_0x1929cb[_0x2319('0x166')])){return this[_0x2319('0x32')][_0x2319('0x26')](_0x1929cb,_0x2319('0x167'));}var _0x33396f='';var _0x205a3c=parseInt(_0x1929cb['queue_id'],0xa);if(isNaN(_0x205a3c)){_0x33396f=_0x1929cb['queue_id'];}else{_0x33396f=this[_0x2319('0x10')][_0x2319('0x6d')](this,_0x1929cb[_0x2319('0x166')]);if(!_0x33396f){return this[_0x2319('0x32')][_0x2319('0x26')](_0x1929cb,'no\x20queue\x20found');}}var _0x4e2a72='';if(this[_0x2319('0x82')](_0x1929cb[_0x2319('0x108')])){var _0x775c3=this[_0x2319('0x10a')][_0x2319('0x6d')](this,_0x1929cb['file_id']);if(_0x775c3){_0x4e2a72=_0x775c3;}}this[_0x2319('0x31')]['sync'](this,_0x1929cb,_0x33396f);if(_0x1929cb['opts'][_0x2319('0x168')]('x')<0x0){_0x1929cb[_0x2319('0xd8')]+='x';}if(_0x1929cb[_0x2319('0xd8')][_0x2319('0x168')]('X')<0x0){_0x1929cb[_0x2319('0xd8')]+='X';}this[_0x2319('0x32')]['setVariable'](_0x2319('0x169'),_0x33396f?_0x33396f[_0x2319('0x16a')]():'');var _0x4b6f5d=this[_0x2319('0x32')][_0x2319('0xa7')]('QUEUE',[_0x33396f,_0x1929cb['opts'],_0x1929cb[_0x2319('0x70')],_0x4e2a72,_0x1929cb[_0x2319('0x63')],_0x1929cb['agi'],_0x1929cb['macro'],_0x1929cb['gosub'],'',_0x1929cb[_0x2319('0x16b')]]);if(_0x4b6f5d['result']===-0x1){return _0x4b6f5d;}return this[_0x2319('0x32')][_0x2319('0xa5')](util['format'](_0x2319('0xbb'),_0x2319('0x16c'),_0x33396f));};AGIVertices[_0x2319('0xf')][_0x2319('0x16d')]=function(_0x2300c4){logger['info'](util[_0x2319('0x51')](_0x2319('0x16e'),_0x2300c4['label']));var _0x2ada09=_0x2300c4['recordingFormat']||_0x2319('0x129');var _0x5f5c37=util['format'](_0x2319('0x16f'),this[_0x2319('0x32')]['uniqueid'],rs[_0x2319('0x114')](0x5));var _0x38303c=util[_0x2319('0x51')](_0x2319('0x170'),FILES_PATH,_0x5f5c37,_0x2ada09);var _0x4ff1c4=util[_0x2319('0x51')](_0x2319('0x12a'),FILES_PATH,_0x5f5c37);this['createSquareRecording'][_0x2319('0x6d')](this,_0x2300c4,_0x5f5c37,_0x38303c);this[_0x2319('0x32')][_0x2319('0x9b')](_0x2319('0x171'),_0x5f5c37);logger[_0x2319('0x28')](_0x2319('0x172'),_0x4ff1c4,_0x2ada09,_0x2300c4[_0x2319('0x173')],_0x2300c4[_0x2319('0x63')]);return this[_0x2319('0x32')][_0x2319('0x133')](_0x4ff1c4,_0x2ada09,_0x2300c4[_0x2319('0x173')],_0x2300c4[_0x2319('0x63')],undefined,!![]);};AGIVertices[_0x2319('0xf')][_0x2319('0x174')]=function(_0x12be7e){logger['info'](util[_0x2319('0x51')](_0x2319('0x175'),_0x12be7e[_0x2319('0x34')]));if(!this[_0x2319('0x82')](_0x12be7e[_0x2319('0x70')])){return this[_0x2319('0x32')][_0x2319('0xa5')](_0x2319('0x176'));}var _0x53ff77=this[_0x2319('0x61')][_0x2319('0x6d')](this,_0x12be7e);logger[_0x2319('0x28')](util[_0x2319('0x51')]('Response:',util[_0x2319('0x177')](_0x53ff77,{'showHidden':![],'depth':null})));if(!this[_0x2319('0x82')](_0x12be7e['variable_id'])){return this[_0x2319('0x32')][_0x2319('0xa5')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x2818fd=this[_0x2319('0xb')][_0x2319('0x6d')](this,_0x12be7e[_0x2319('0xcb')]);if(!_0x2818fd){return this[_0x2319('0x32')]['error'](_0x12be7e,_0x2319('0xcd'));}this['channel'][_0x2319('0x9b')](util[_0x2319('0x51')](_0x2319('0x178'),_0x2818fd),_0x53ff77[_0x2319('0x73')]?_0x53ff77[_0x2319('0x73')]:_0x2319('0x179'));this['channel'][_0x2319('0x9b')](util[_0x2319('0x51')](_0x2319('0x17a'),_0x2818fd),_0x53ff77[_0x2319('0x74')]?_0x53ff77[_0x2319('0x74')]:'OK');if(_0x53ff77['body']){try{this[_0x2319('0x9a')](_0x53ff77['body'],_0x2818fd);}catch(_0x161782){logger[_0x2319('0x26')](util['format'](_0x2319('0x17b'),_0x2818fd));}}return this[_0x2319('0x32')][_0x2319('0xa5')](util['format'](_0x2319('0xd0'),_0x2818fd));};AGIVertices[_0x2319('0xf')][_0x2319('0x17c')]=function(_0x45a35c){logger[_0x2319('0x28')](util[_0x2319('0x51')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x45a35c[_0x2319('0x34')]));return this[_0x2319('0x32')]['sayDigits'](_0x45a35c['digits'][_0x2319('0x56')](/\s+/g,''),_0x45a35c[_0x2319('0x173')]);};AGIVertices['prototype'][_0x2319('0x17d')]=function(_0xedb76f){logger[_0x2319('0x28')](util[_0x2319('0x51')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0xedb76f[_0x2319('0x34')]));return this['channel'][_0x2319('0x17e')](_0xedb76f[_0x2319('0x17f')][_0x2319('0x56')](/\s+/g,''),_0xedb76f[_0x2319('0x173')]);};AGIVertices['prototype'][_0x2319('0x180')]=function(_0x42af53){logger[_0x2319('0x28')](util[_0x2319('0x51')](_0x2319('0x181'),_0x42af53[_0x2319('0x34')]));return this['channel'][_0x2319('0x182')](_0x42af53[_0x2319('0x59')],_0x42af53[_0x2319('0x173')]);};AGIVertices[_0x2319('0xf')][_0x2319('0x183')]=function(_0x5b8ed1){logger[_0x2319('0x28')](util['format'](_0x2319('0x184'),_0x5b8ed1[_0x2319('0x34')]));if(!this[_0x2319('0x82')](_0x5b8ed1[_0x2319('0x185')])){return this[_0x2319('0x32')]['noop'](_0x2319('0x186'));}var _0x57b941=this[_0x2319('0x19')][_0x2319('0x6d')](this,_0x5b8ed1[_0x2319('0x185')]);if(!_0x57b941||!_0x57b941[_0x2319('0x187')]){return this[_0x2319('0x32')][_0x2319('0x26')](_0x5b8ed1,'no\x20mail\x20account\x20found');}var _0x4aa346={'from':util[_0x2319('0x51')](_0x2319('0x188'),_0x57b941[_0x2319('0x16')],_0x57b941['email']||_0x57b941[_0x2319('0x187')][_0x2319('0x189')]),'to':_0x5b8ed1['to']||'','cc':_0x5b8ed1['cc']||'','bcc':_0x5b8ed1[_0x2319('0x18a')]||'','subject':_0x5b8ed1[_0x2319('0x18b')],'html':_0x5b8ed1[_0x2319('0x59')],'text':_0x5b8ed1[_0x2319('0x59')]};var _0x31e743={'tls':{'rejectUnauthorized':![]}};if(_0x57b941['Smtp']['service']){_0x31e743[_0x2319('0x18c')]=_0x57b941[_0x2319('0x187')][_0x2319('0x18c')];}else{_0x31e743[_0x2319('0x18d')]=_0x57b941[_0x2319('0x187')]['host'];_0x31e743[_0x2319('0x18e')]=_0x57b941[_0x2319('0x187')]['port'];_0x31e743['secure']=_0x57b941[_0x2319('0x187')]['secure'];}if(_0x57b941[_0x2319('0x187')][_0x2319('0x18f')]){_0x31e743['auth']={'user':_0x57b941[_0x2319('0x187')][_0x2319('0x189')],'pass':_0x57b941[_0x2319('0x187')]['pass']};}if(this[_0x2319('0x82')](_0x5b8ed1[_0x2319('0x190')])){}logger[_0x2319('0xd2')]('sendMail\x20message',JSON[_0x2319('0x71')](_0x4aa346));this[_0x2319('0x31')]['sync'](this,_0x5b8ed1,_0x5b8ed1[_0x2319('0x185')]);this[_0x2319('0x32')][_0x2319('0xa5')](util['format'](_0x2319('0x191'),_0x57b941[_0x2319('0x16')]));this[_0x2319('0x1b')]['sync'](this,_0x31e743,_0x4aa346);return this[_0x2319('0x32')][_0x2319('0xa5')](_0x2319('0x192'));};AGIVertices[_0x2319('0xf')]['sendFax']=function(_0x35ab2d){logger[_0x2319('0x28')](util[_0x2319('0x51')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x35ab2d[_0x2319('0x34')]));return this['channel'][_0x2319('0xa5')](_0x2319('0x193'));};AGIVertices[_0x2319('0xf')][_0x2319('0x194')]=function(_0x40f8a6){logger[_0x2319('0x28')](util[_0x2319('0x51')](_0x2319('0x195'),_0x40f8a6[_0x2319('0x34')]));if(!this['isConfigured'](_0x40f8a6[_0x2319('0x196')])){return this['channel'][_0x2319('0xa5')](_0x2319('0x197'));}var _0x2e7c9d=this[_0x2319('0x2e')][_0x2319('0x6d')](this,_0x40f8a6[_0x2319('0x196')]);if(!_0x2e7c9d){return this[_0x2319('0x32')][_0x2319('0x26')](_0x40f8a6,'no\x20sms\x20account\x20found');}var _0x51a172={'body':_0x40f8a6[_0x2319('0x198')],'phone':_0x40f8a6['to']||'','SmsAccountId':_0x2e7c9d['id']};logger[_0x2319('0xd2')]('sendSMS\x20message',JSON[_0x2319('0x71')](_0x51a172));this['createSquareDetailsReport'][_0x2319('0x6d')](this,_0x40f8a6,_0x40f8a6[_0x2319('0x196')]);this[_0x2319('0x32')][_0x2319('0xa5')](util[_0x2319('0x51')](_0x2319('0x199'),_0x2e7c9d[_0x2319('0x16')]));this['createSmsMessage'][_0x2319('0x6d')](this,_0x51a172);return this[_0x2319('0x32')][_0x2319('0xa5')](_0x2319('0x19a'));};AGIVertices[_0x2319('0xf')][_0x2319('0x19b')]=function(_0x185474){logger[_0x2319('0x28')](util[_0x2319('0x51')](_0x2319('0x19c'),_0x185474['label']));if(!this[_0x2319('0x82')](_0x185474['variable_id'])){return this[_0x2319('0x32')][_0x2319('0x26')](_0x185474,_0x2319('0x19d'));}var _0x363e03=this[_0x2319('0xb')]['sync'](this,_0x185474['variable_id']);if(!_0x363e03){return this[_0x2319('0x32')]['error'](_0x185474,'no\x20variable\x20found');}return this[_0x2319('0x32')][_0x2319('0x9b')](_0x363e03,_0x185474['variable_value']);};AGIVertices[_0x2319('0xf')][_0x2319('0x19e')]=function(_0x35c088){logger[_0x2319('0x28')](util[_0x2319('0x51')](_0x2319('0x19f'),_0x35c088['label']));this[_0x2319('0x32')][_0x2319('0xa5')]('START\x20CALLY\x20SQUARE');if(_0x35c088[_0x2319('0xb5')]==='yes'){this['channel']['noop'](_0x2319('0x1a0'));return this[_0x2319('0x32')][_0x2319('0xb5')]();}return this[_0x2319('0x32')][_0x2319('0xa5')](_0x2319('0x1a1'));};AGIVertices[_0x2319('0xf')][_0x2319('0x1a2')]=function(_0xef5aed){logger['info'](util['format']('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0xef5aed[_0x2319('0x34')]));if(!this[_0x2319('0x82')](_0xef5aed[_0x2319('0x1a3')])){return this['channel'][_0x2319('0x26')](_0xef5aed,_0x2319('0x1a4'));}var _0x18a65b=this[_0x2319('0x12')]['sync'](this,_0xef5aed['project_id']);if(!this[_0x2319('0x82')](_0x18a65b)){return this[_0x2319('0x32')][_0x2319('0x26')](_0xef5aed,util[_0x2319('0x51')](_0x2319('0x1a5'),_0xef5aed[_0x2319('0x1a3')]));}if(_0x18a65b===this['channel'][_0x2319('0x3b')]){return this[_0x2319('0x32')][_0x2319('0x26')](_0xef5aed,_0x2319('0x1a6'));}this['createSquareDetailsReport']['sync'](this,_0xef5aed,_0x18a65b);var _0x301049=this['channel'][_0x2319('0xa7')](_0x2319('0x1a7'),util[_0x2319('0x51')](_0x2319('0x1a8'),config['agi']['host']||_0x2319('0x1a9'),_0x18a65b,this[_0x2319('0x32')][_0x2319('0x3b')]));if(_0x301049[_0x2319('0xae')]===-0x1){return _0x301049;}return this['channel'][_0x2319('0xa5')](util[_0x2319('0x51')](_0x2319('0xbb'),'AGI',_0x18a65b));};AGIVertices[_0x2319('0xf')][_0x2319('0x1aa')]=function(_0x208849){logger[_0x2319('0x28')](util[_0x2319('0x51')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x208849[_0x2319('0x34')]));var _0x5da4ca=this['shellCommand'][_0x2319('0x6d')](this,_0x208849[_0x2319('0xb3')]);this[_0x2319('0x31')][_0x2319('0x6d')](this,_0x208849,_0x208849[_0x2319('0xb3')]);if(this[_0x2319('0x82')](_0x208849['variable_id'])){var _0x41dccc=this['getVariable'][_0x2319('0x6d')](this,_0x208849[_0x2319('0xcb')]);if(_0x41dccc){this[_0x2319('0x32')][_0x2319('0x9b')](_0x41dccc,_0x5da4ca);return this['channel'][_0x2319('0xa5')](util[_0x2319('0x51')](_0x2319('0x1ab'),_0x208849['command'],_0x41dccc));}}return this[_0x2319('0x32')][_0x2319('0xa5')](util[_0x2319('0x51')](_0x2319('0x1ac'),_0x208849[_0x2319('0xb3')]));};AGIVertices[_0x2319('0xf')]['google_cloud_tts']=function(_0xffb217){logger[_0x2319('0x28')](util['format'](_0x2319('0x1ad'),_0xffb217[_0x2319('0x34')]));_0xffb217[_0x2319('0x59')]=_0xffb217[_0x2319('0x59')][_0x2319('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x2319('0x82')](_0xffb217[_0x2319('0x1ae')])){return this['channel'][_0x2319('0xa5')](_0x2319('0x1af'));}if(!this[_0x2319('0x82')](_0xffb217[_0x2319('0x59')])){return this[_0x2319('0x32')][_0x2319('0xa5')]('no\x20text\x20configured');}this[_0x2319('0x32')]['noop'](util[_0x2319('0x51')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0xffb217[_0x2319('0x59')]));var _0x2a4f9e=this[_0x2319('0x57')]['sync'](this,_0xffb217);if(_0x2a4f9e){this['channel'][_0x2319('0xa5')](util[_0x2319('0x51')](_0x2319('0x1b0'),_0x2a4f9e));var _0x2481f5=this[_0x2319('0x32')]['streamFile'](_0x2a4f9e);try{fs[_0x2319('0xfa')](_0x2a4f9e+_0x2319('0x11e'));}catch(_0x3927ad){logger['error'](_0x3927ad);}return _0x2481f5;}return this[_0x2319('0x32')][_0x2319('0x26')](_0xffb217,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x2319('0x1b1')]=function(_0x3aef2b){logger['info'](util['format'](_0x2319('0x1b2'),_0x3aef2b[_0x2319('0x34')]));_0x3aef2b[_0x2319('0x59')]=_0x3aef2b[_0x2319('0x59')][_0x2319('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x2319('0x82')](_0x3aef2b[_0x2319('0x59')])){return this[_0x2319('0x32')][_0x2319('0xa5')]('no\x20text\x20configured');}this[_0x2319('0x32')][_0x2319('0xa5')](util[_0x2319('0x51')](_0x2319('0x1b3'),_0x3aef2b[_0x2319('0x59')]));var _0x332f3e=this['googleTTS'][_0x2319('0x6d')](this,_0x3aef2b);if(_0x332f3e){this[_0x2319('0x32')][_0x2319('0xa5')](util[_0x2319('0x51')](_0x2319('0x1b4'),_0x332f3e));var _0xaa30b=this[_0x2319('0x32')][_0x2319('0x14c')](_0x332f3e);try{fs[_0x2319('0xfa')](_0x332f3e+_0x2319('0x11e'));}catch(_0x3aab17){logger[_0x2319('0x26')](_0x3aab17);}return _0xaa30b;}return this[_0x2319('0x32')][_0x2319('0x26')](_0x3aef2b,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x2319('0xf')][_0x2319('0x1b5')]=function(_0x573ecd){logger[_0x2319('0x28')](util[_0x2319('0x51')](_0x2319('0x1b6'),_0x573ecd[_0x2319('0x34')]));if(!this['isConfigured'](_0x573ecd[_0x2319('0x14f')])){return this['channel'][_0x2319('0x26')](_0x573ecd,_0x2319('0x150'));}logger['info'](util[_0x2319('0x51')](_0x2319('0x151'),this[_0x2319('0x32')][_0x2319('0x36')],_0x573ecd['findBy']));var _0x11f270=this[_0x2319('0x4d')][_0x2319('0x6d')](this,_0x573ecd['findBy']);if(_0x11f270){logger[_0x2319('0x28')](util[_0x2319('0x51')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x2319('0x36')],_0x573ecd['findBy']));this[_0x2319('0x32')][_0x2319('0xa5')](util[_0x2319('0x51')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x2319('0x32')][_0x2319('0x36')],_0x573ecd[_0x2319('0x14f')]));return{'code':0xc8,'result':_0x2319('0x153')};}else{logger[_0x2319('0x28')](util['format'](_0x2319('0x154'),this[_0x2319('0x32')][_0x2319('0x36')],_0x573ecd['findBy']));this[_0x2319('0x32')][_0x2319('0xa5')](util[_0x2319('0x51')](_0x2319('0x154'),this[_0x2319('0x32')][_0x2319('0x36')],_0x573ecd[_0x2319('0x14f')]));return{'code':0xc8,'result':_0x2319('0x155')};}};AGIVertices[_0x2319('0xf')][_0x2319('0x1b7')]=function(_0x16f48b){logger[_0x2319('0x28')](util[_0x2319('0x51')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x16f48b[_0x2319('0x34')]));var _0x3e6c20=this['channel'][_0x2319('0xa7')](_0x2319('0x1b8'),[_0x16f48b[_0x2319('0x1b9')],_0x16f48b[_0x2319('0x76')]]);if(_0x3e6c20[_0x2319('0xae')]===-0x1){return _0x3e6c20;}return this['channel'][_0x2319('0xa5')](util[_0x2319('0x51')](_0x2319('0xbb'),_0x2319('0x1b8'),_0x16f48b[_0x2319('0x1b9')]));};AGIVertices[_0x2319('0xf')]['vswitch']=function(_0x528370){logger[_0x2319('0x28')](util[_0x2319('0x51')](_0x2319('0x1ba'),_0x528370[_0x2319('0x34')]));if(!this['isConfigured'](_0x528370['variable_id'])){return this[_0x2319('0x32')][_0x2319('0x26')](_0x528370,_0x2319('0x19d'));}var _0x95534c=this[_0x2319('0xb')][_0x2319('0x6d')](this,_0x528370[_0x2319('0xcb')]);if(!_0x95534c){return this['channel']['error'](_0x528370,_0x2319('0xcd'));}var _0x17784f=this[_0x2319('0x32')][_0x2319('0xb')](_0x95534c);return{'code':0xc8,'result':_0x17784f['extra']?_0x17784f['extra']:'-'};};String[_0x2319('0xf')]['replaceAll']=function(_0xf3b86d,_0x5a7386){return this[_0x2319('0x9d')](_0xf3b86d)[_0x2319('0x1bb')](_0x5a7386);};module[_0x2319('0x1bc')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index c255d3d..8221e72 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 _0xb330=['autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','moment','../ami','acw','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','seconds','prototype','startAcw','queue','ACW','mandatoryDisposition','name','Action','QueuePause','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','then','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','stopAcw','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','timer','update','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','finally','message','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','syncAgentConnect','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s'];(function(_0x7ca0dc,_0x31ff6d){var _0x1dd8d5=function(_0x4e9ec1){while(--_0x4e9ec1){_0x7ca0dc['push'](_0x7ca0dc['shift']());}};_0x1dd8d5(++_0x31ff6d);}(_0xb330,0x15a));var _0x0b33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb330[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x0b33('0x0'));var _=require('lodash');var moment=require(_0x0b33('0x1'));var ami=require(_0x0b33('0x2'));var logger=require('../../../config/logger')(_0x0b33('0x3'));var RpcUser=require(_0x0b33('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x3d411e){this[_0x0b33('0x5')]=_0x3d411e[_0x0b33('0x5')];this['agents']=_0x3d411e[_0x0b33('0x6')];this[_0x0b33('0x7')]=_0x3d411e[_0x0b33('0x7')];this[_0x0b33('0x8')]={};ami['on'](_0x0b33('0x9'),this['syncAgentConnect'][_0x0b33('0xa')](this));ami['on'](_0x0b33('0xb'),this[_0x0b33('0xc')]['bind'](this));ami['on'](_0x0b33('0xd'),this[_0x0b33('0xe')][_0x0b33('0xa')](this));ami['on'](_0x0b33('0xf'),this[_0x0b33('0x10')][_0x0b33('0xa')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer']['bind'](this));ami['on'](_0x0b33('0x11'),this[_0x0b33('0x12')][_0x0b33('0xa')](this));ami['on']('custom:agentConnectPreview',this[_0x0b33('0x13')]['bind'](this));}function getDiff(_0x491e03){var _0x26c313=moment()[_0x0b33('0x14')](0x0);var _0x33a1c0=moment(_0x491e03)[_0x0b33('0x14')](0x0);return _0x26c313['diff'](_0x33a1c0,_0x0b33('0x15'));}Acw[_0x0b33('0x16')][_0x0b33('0x17')]=function(_0x1bf37d){try{var _0x17fb2a=this;var _0x45cd85=this[_0x0b33('0x8')][_0x1bf37d]['interface'];var _0x328685=this[_0x0b33('0x8')][_0x1bf37d][_0x0b33('0x18')];var _0x1b1fe6=this[_0x0b33('0x5')][_0x328685];var _0x42ad05=![];var _0x4827b5=_0x0b33('0x19');if(_0x1b1fe6[_0x0b33('0x1a')]){if(_0x1b1fe6['mandatoryDispositionPause'][_0x0b33('0x1b')]){_0x42ad05=!![];_0x4827b5=_0x1b1fe6['mandatoryDispositionPause'][_0x0b33('0x1b')];}}ami[_0x0b33('0x1c')]({'action':_0x0b33('0x1d'),'interface':_0x45cd85,'paused':!![],'reason':_0x4827b5})['then'](function(_0x5e1334){if(_0x17fb2a['agents'][_0x45cd85]){return RpcUser['getAgent'](_0x17fb2a['agents'][_0x45cd85]['id'])['then'](function(_0x510a1d){if(_0x510a1d&&!_0x510a1d[_0x0b33('0x1e')]){logger['info'](_0x0b33('0x1f'),_0x1bf37d,_0x45cd85,_0x328685);var _0x5bb693=_0x17fb2a[_0x0b33('0x8')][_0x1bf37d][_0x0b33('0x20')]&&_0x17fb2a[_0x0b33('0x8')][_0x1bf37d][_0x0b33('0x21')]?_0x17fb2a[_0x0b33('0x8')][_0x1bf37d][_0x0b33('0x21')]:_0x1bf37d;return RpcUser['savePause'](_0x17fb2a[_0x0b33('0x6')][_0x45cd85],_0x4827b5,_0x5bb693)[_0x0b33('0x22')](function(_0x110a62){if(!_0x42ad05){_0x17fb2a[_0x0b33('0x7')][_0x45cd85]={};logger[_0x0b33('0x23')](_0x0b33('0x24'),_0x1bf37d,_0x17fb2a[_0x0b33('0x5')][_0x328685]['acwTimeout'],_0x45cd85,_0x328685);_0x17fb2a[_0x0b33('0x7')][_0x45cd85]['timer']=setTimeout(_0x17fb2a[_0x0b33('0x25')][_0x0b33('0xa')](_0x17fb2a,_0x45cd85),_0x17fb2a['voiceQueues'][_0x328685][_0x0b33('0x26')]*0x3e8);_0x17fb2a['timers'][_0x45cd85][_0x0b33('0x27')]=moment()[_0x0b33('0x28')](_0x0b33('0x29'));_0x17fb2a[_0x0b33('0x7')][_0x45cd85][_0x0b33('0x2a')]=_0x1bf37d;_0x17fb2a[_0x0b33('0x7')][_0x45cd85][_0x0b33('0x18')]=_0x328685;_0x17fb2a[_0x0b33('0x7')][_0x45cd85][_0x0b33('0x2b')]=function(){var _0x26917b=getDiff(_0x17fb2a['timers'][_0x45cd85][_0x0b33('0x27')]);clearTimeout(_0x17fb2a[_0x0b33('0x7')][_0x45cd85]['timer']);_0x17fb2a[_0x0b33('0x7')][_0x45cd85][_0x0b33('0x2c')]=![];RpcVoiceAgentReport[_0x0b33('0x2d')]({'acwtime':_0x26917b},_0x17fb2a[_0x0b33('0x7')][_0x45cd85][_0x0b33('0x2a')],_0x45cd85)[_0x0b33('0x22')](function(_0x3d273d){logger[_0x0b33('0x23')]('[%s][UPDATE][ACWTIME:%s]',_0x1bf37d,_0x26917b,_0x3d273d);})['catch'](function(_0x5f2a2e){logger[_0x0b33('0x2e')]('[%s][UPDATE][ERRORS:%s]',_0x1bf37d,_0x5f2a2e);});delete _0x17fb2a[_0x0b33('0x7')][_0x45cd85];};}});}else{logger[_0x0b33('0x23')](_0x0b33('0x2f'),_0x1bf37d,_0x45cd85,_0x328685);}});}})[_0x0b33('0x30')](function(_0x799c0a){logger['error'](_0x0b33('0x24'),_0x1bf37d,_0x17fb2a[_0x0b33('0x5')][_0x328685][_0x0b33('0x26')],_0x45cd85,_0x328685);})[_0x0b33('0x31')](function(){delete _0x17fb2a['channels'][_0x1bf37d];});}catch(_0x399f23){logger[_0x0b33('0x2e')]('[ACW][START]\x20%s',_0x399f23[_0x0b33('0x32')]);}};Acw['prototype'][_0x0b33('0x25')]=function(_0x3624cc){try{var _0x46f1c8=this;if(_0x46f1c8[_0x0b33('0x7')][_0x3624cc]){_0x46f1c8[_0x0b33('0x7')][_0x3624cc][_0x0b33('0x2c')]=![];var _0x291b47=_0x46f1c8[_0x0b33('0x7')][_0x3624cc][_0x0b33('0x2a')];var _0x3df764=_0x46f1c8[_0x0b33('0x7')][_0x3624cc][_0x0b33('0x18')];var _0xa159fc=_0x46f1c8['voiceQueues'][_0x3df764]['acwTimeout'];logger[_0x0b33('0x23')]('[%s][TIMER][STOP][AGENT:%s]',_0x291b47,_0x3624cc);RpcUser[_0x0b33('0x33')](this[_0x0b33('0x6')][_0x3624cc]);RpcVoiceAgentReport[_0x0b33('0x2d')]({'acwtime':_0xa159fc,'agentacw':!![]},_0x291b47,_0x3624cc)[_0x0b33('0x22')](function(_0x1839ee){logger[_0x0b33('0x23')](_0x0b33('0x34'),_0x291b47,_0xa159fc,_0x1839ee);})[_0x0b33('0x30')](function(_0x147f45){logger[_0x0b33('0x2e')](_0x0b33('0x35'),_0x291b47,_0x147f45);});}else{logger[_0x0b33('0x2e')](_0x0b33('0x36'),_0x3624cc);if(_0x46f1c8[_0x0b33('0x7')]){logger[_0x0b33('0x23')](_0x0b33('0x37'),JSON[_0x0b33('0x38')](_0x46f1c8[_0x0b33('0x7')]));}}}catch(_0x29552b){logger[_0x0b33('0x2e')](_0x0b33('0x39'),_0x29552b[_0x0b33('0x32')]);}};Acw[_0x0b33('0x16')][_0x0b33('0x3a')]=function(_0x503a64){try{if(this[_0x0b33('0x5')][_0x503a64[_0x0b33('0x18')]]&&(this[_0x0b33('0x5')][_0x503a64[_0x0b33('0x18')]][_0x0b33('0x3')]||this[_0x0b33('0x5')][_0x503a64['queue']][_0x0b33('0x1a')])){if(this['agents'][_0x503a64[_0x0b33('0x3b')]]){this[_0x0b33('0x8')][_0x503a64[_0x0b33('0x2a')]]={'queue':_0x503a64[_0x0b33('0x18')],'interface':_0x503a64[_0x0b33('0x3b')],'destlinkedid':_0x503a64[_0x0b33('0x21')]};}}}catch(_0x3ea6c2){logger[_0x0b33('0x2e')](_0x0b33('0x3c'),_0x3ea6c2['message']);}};Acw[_0x0b33('0x16')]['syncAgentConnectPreview']=function(_0x985a1b){try{if(this[_0x0b33('0x5')][_0x985a1b['queue']]&&(this[_0x0b33('0x5')][_0x985a1b[_0x0b33('0x18')]]['acw']||this[_0x0b33('0x5')][_0x985a1b[_0x0b33('0x18')]][_0x0b33('0x1a')])){if(this[_0x0b33('0x6')][_0x985a1b['interface']]){this[_0x0b33('0x8')][_0x985a1b[_0x0b33('0x2a')]]={'queue':_0x985a1b[_0x0b33('0x18')],'interface':_0x985a1b[_0x0b33('0x3b')]};}}}catch(_0x30ad6f){logger[_0x0b33('0x2e')](_0x0b33('0x3d'),_0x30ad6f[_0x0b33('0x32')]);}};Acw[_0x0b33('0x16')]['syncHangupRequest']=function(_0xdd19ed){try{if(this[_0x0b33('0x8')][_0xdd19ed[_0x0b33('0x2a')]]&&_[_0x0b33('0x3e')](this[_0x0b33('0x8')][_0xdd19ed[_0x0b33('0x2a')]][_0x0b33('0x20')])){logger[_0x0b33('0x23')]('[%s][HANGUP:UNIQUEID]',_0xdd19ed['uniqueid']);this[_0x0b33('0x17')](_0xdd19ed[_0x0b33('0x2a')]);}else if(this[_0x0b33('0x8')][_0xdd19ed[_0x0b33('0x3f')]]&&_[_0x0b33('0x3e')](this[_0x0b33('0x8')][_0xdd19ed[_0x0b33('0x3f')]]['attended'])){logger[_0x0b33('0x23')](_0x0b33('0x40'),_0xdd19ed[_0x0b33('0x3f')]);this[_0x0b33('0x17')](_0xdd19ed[_0x0b33('0x3f')]);}}catch(_0x2df15a){logger[_0x0b33('0x2e')]('[ACW][syncHangupRequest]\x20%s',_0x2df15a[_0x0b33('0x32')]);}};Acw[_0x0b33('0x16')]['syncHangup']=function(_0x129cde){try{if(this[_0x0b33('0x8')][_0x129cde['uniqueid']]&&this[_0x0b33('0x8')][_0x129cde[_0x0b33('0x2a')]][_0x0b33('0x20')]){logger[_0x0b33('0x23')](_0x0b33('0x41'),_0x129cde[_0x0b33('0x2a')]);this['startAcw'](_0x129cde[_0x0b33('0x2a')]);}else if(this[_0x0b33('0x8')][_0x129cde['linkedid']]&&this[_0x0b33('0x8')][_0x129cde[_0x0b33('0x3f')]][_0x0b33('0x20')]){logger[_0x0b33('0x23')](_0x0b33('0x42'),_0x129cde[_0x0b33('0x3f')]);this[_0x0b33('0x17')](_0x129cde[_0x0b33('0x3f')]);}}catch(_0x192b50){logger[_0x0b33('0x2e')]('[ACW][syncHangup]\x20%s',_0x192b50[_0x0b33('0x32')]);}};Acw[_0x0b33('0x16')][_0x0b33('0x43')]=function(_0x22262f){try{if(!_[_0x0b33('0x44')](this[_0x0b33('0x8')][_0x22262f[_0x0b33('0x45')]])){this[_0x0b33('0x17')](_0x22262f[_0x0b33('0x45')]);if(this['channels'][_0x22262f[_0x0b33('0x46')]]){this[_0x0b33('0x8')][_0x22262f['secondtransfereruniqueid']][_0x0b33('0x20')]=!![];this[_0x0b33('0x8')][_0x22262f['transfertargetuniqueid']]=this['channels'][_0x22262f[_0x0b33('0x46')]];delete this[_0x0b33('0x8')][_0x22262f['secondtransfereruniqueid']];}}else if(!_[_0x0b33('0x44')](this['channels'][_0x22262f[_0x0b33('0x47')]])){this[_0x0b33('0x17')](_0x22262f[_0x0b33('0x47')]);if(this['channels'][_0x22262f[_0x0b33('0x48')]]){this[_0x0b33('0x8')][_0x22262f[_0x0b33('0x48')]][_0x0b33('0x20')]=!![];this[_0x0b33('0x8')][_0x22262f[_0x0b33('0x45')]]=this[_0x0b33('0x8')][_0x22262f[_0x0b33('0x48')]];delete this[_0x0b33('0x8')][_0x22262f['origtransfereruniqueid']];}}}catch(_0x49318d){logger[_0x0b33('0x2e')](_0x0b33('0x49'),_0x49318d[_0x0b33('0x32')]);}};Acw[_0x0b33('0x16')]['syncBlindTransfer']=function(_0x43a68e){try{if(this['channels'][_0x43a68e[_0x0b33('0x4a')]]){logger[_0x0b33('0x23')](_0x0b33('0x4b'),JSON[_0x0b33('0x38')](_0x43a68e['transfereruniqueid']));this[_0x0b33('0x17')](_0x43a68e[_0x0b33('0x4a')]);}else if(this[_0x0b33('0x8')][_0x43a68e['transfererlinkedid']]){logger[_0x0b33('0x23')](_0x0b33('0x4c'),JSON['stringify'](_0x43a68e[_0x0b33('0x4d')]));this[_0x0b33('0x17')](_0x43a68e[_0x0b33('0x4d')]);}}catch(_0x46e4a3){logger[_0x0b33('0x2e')](_0x0b33('0x4e'),_0x46e4a3['message']);}};Acw[_0x0b33('0x16')]['syncAgentRingNoAnswer']=function(_0x56d438){try{if(this[_0x0b33('0x5')][_0x56d438[_0x0b33('0x18')]]&&this[_0x0b33('0x5')][_0x56d438[_0x0b33('0x18')]][_0x0b33('0x4f')]===_0x0b33('0x50')){if(this['agents'][_0x56d438[_0x0b33('0x3b')]]){logger[_0x0b33('0x23')](_0x0b33('0x51'),_0x56d438[_0x0b33('0x2a')],_0x56d438[_0x0b33('0x3b')],_0x56d438[_0x0b33('0x18')]);return RpcUser[_0x0b33('0x52')](this[_0x0b33('0x6')][_0x56d438[_0x0b33('0x3b')]],'Auto-Pause',_0x56d438[_0x0b33('0x2a')]);}}}catch(_0x23c3be){logger[_0x0b33('0x2e')](_0x0b33('0x53'),_0x23c3be[_0x0b33('0x32')]);}};module[_0x0b33('0x54')]=Acw; \ No newline at end of file +var _0xd479=['transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','savePause','Auto-Pause','exports','util','moment','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','hanguprequest','syncHangupRequest','bind','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','getAgent','then','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','acwTimeout','timer','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','uniqueid','update','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','stopAcw','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][syncAgentConnect]\x20%s','message','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','startAcw','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','secondtransfereruniqueid'];(function(_0x27573e,_0x29d585){var _0x1d62f8=function(_0x20ba5a){while(--_0x20ba5a){_0x27573e['push'](_0x27573e['shift']());}};_0x1d62f8(++_0x29d585);}(_0xd479,0xac));var _0x9d47=function(_0x1642db,_0x15d58e){_0x1642db=_0x1642db-0x0;var _0x474427=_0xd479[_0x1642db];return _0x474427;};'use strict';var util=require(_0x9d47('0x0'));var _=require('lodash');var moment=require(_0x9d47('0x1'));var ami=require(_0x9d47('0x2'));var logger=require(_0x9d47('0x3'))(_0x9d47('0x4'));var RpcUser=require(_0x9d47('0x5'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x57d86a){this[_0x9d47('0x6')]=_0x57d86a['voiceQueues'];this[_0x9d47('0x7')]=_0x57d86a[_0x9d47('0x7')];this[_0x9d47('0x8')]=_0x57d86a[_0x9d47('0x8')];this[_0x9d47('0x9')]={};ami['on'](_0x9d47('0xa'),this[_0x9d47('0xb')]['bind'](this));ami['on'](_0x9d47('0xc'),this[_0x9d47('0xd')][_0x9d47('0xe')](this));ami['on']('hangup',this[_0x9d47('0xf')][_0x9d47('0xe')](this));ami['on'](_0x9d47('0x10'),this[_0x9d47('0x11')][_0x9d47('0xe')](this));ami['on']('attendedtransfer',this[_0x9d47('0x12')]['bind'](this));ami['on']('blindtransfer',this[_0x9d47('0x13')]['bind'](this));ami['on'](_0x9d47('0x14'),this[_0x9d47('0x15')][_0x9d47('0xe')](this));}function getDiff(_0x2776d6){var _0x37f618=moment()['milliseconds'](0x0);var _0x5cdbbf=moment(_0x2776d6)[_0x9d47('0x16')](0x0);return _0x37f618['diff'](_0x5cdbbf,_0x9d47('0x17'));}Acw[_0x9d47('0x18')]['startAcw']=function(_0x4f6e0e){try{var _0x407246=this;var _0x21e050=this['channels'][_0x4f6e0e][_0x9d47('0x19')];var _0xe9f948=this[_0x9d47('0x9')][_0x4f6e0e][_0x9d47('0x1a')];var _0x347186=this[_0x9d47('0x6')][_0xe9f948];var _0x1e66e6=![];var _0x22c8de=_0x9d47('0x1b');if(_0x347186[_0x9d47('0x1c')]){if(_0x347186[_0x9d47('0x1d')][_0x9d47('0x1e')]){_0x1e66e6=!![];_0x22c8de=_0x347186[_0x9d47('0x1d')]['name'];}}ami[_0x9d47('0x1f')]({'action':_0x9d47('0x20'),'interface':_0x21e050,'paused':!![],'reason':_0x22c8de})['then'](function(_0x59a5e4){if(_0x407246[_0x9d47('0x7')][_0x21e050]){return RpcUser[_0x9d47('0x21')](_0x407246[_0x9d47('0x7')][_0x21e050]['id'])[_0x9d47('0x22')](function(_0x38c345){if(_0x38c345&&!_0x38c345['voicePause']){logger[_0x9d47('0x23')](_0x9d47('0x24'),_0x4f6e0e,_0x21e050,_0xe9f948);var _0x4c2fef=_0x407246[_0x9d47('0x9')][_0x4f6e0e][_0x9d47('0x25')]&&_0x407246['channels'][_0x4f6e0e]['destlinkedid']?_0x407246[_0x9d47('0x9')][_0x4f6e0e]['destlinkedid']:_0x4f6e0e;return RpcUser['savePause'](_0x407246[_0x9d47('0x7')][_0x21e050],_0x22c8de,_0x4c2fef)[_0x9d47('0x22')](function(_0x2a07e7){if(!_0x1e66e6){_0x407246[_0x9d47('0x8')][_0x21e050]={};logger['info']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x4f6e0e,_0x407246[_0x9d47('0x6')][_0xe9f948][_0x9d47('0x26')],_0x21e050,_0xe9f948);_0x407246[_0x9d47('0x8')][_0x21e050][_0x9d47('0x27')]=setTimeout(_0x407246['stopAcw']['bind'](_0x407246,_0x21e050),_0x407246[_0x9d47('0x6')][_0xe9f948]['acwTimeout']*0x3e8);_0x407246[_0x9d47('0x8')][_0x21e050][_0x9d47('0x28')]=moment()['format'](_0x9d47('0x29'));_0x407246[_0x9d47('0x8')][_0x21e050][_0x9d47('0x2a')]=_0x4f6e0e;_0x407246[_0x9d47('0x8')][_0x21e050][_0x9d47('0x1a')]=_0xe9f948;_0x407246[_0x9d47('0x8')][_0x21e050]['updateAcw']=function(){var _0xace4e9=getDiff(_0x407246[_0x9d47('0x8')][_0x21e050][_0x9d47('0x28')]);clearTimeout(_0x407246[_0x9d47('0x8')][_0x21e050][_0x9d47('0x27')]);_0x407246['timers'][_0x21e050][_0x9d47('0x27')]=![];RpcVoiceAgentReport[_0x9d47('0x2b')]({'acwtime':_0xace4e9},_0x407246['timers'][_0x21e050][_0x9d47('0x2a')],_0x21e050)[_0x9d47('0x22')](function(_0x3d45d1){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x4f6e0e,_0xace4e9,_0x3d45d1);})['catch'](function(_0x4764fe){logger[_0x9d47('0x2c')](_0x9d47('0x2d'),_0x4f6e0e,_0x4764fe);});delete _0x407246[_0x9d47('0x8')][_0x21e050];};}});}else{logger[_0x9d47('0x23')](_0x9d47('0x2e'),_0x4f6e0e,_0x21e050,_0xe9f948);}});}})[_0x9d47('0x2f')](function(_0x37fa2f){logger[_0x9d47('0x2c')](_0x9d47('0x30'),_0x4f6e0e,_0x407246[_0x9d47('0x6')][_0xe9f948]['acwTimeout'],_0x21e050,_0xe9f948);})[_0x9d47('0x31')](function(){delete _0x407246[_0x9d47('0x9')][_0x4f6e0e];});}catch(_0x2ba765){logger['error']('[ACW][START]\x20%s',_0x2ba765['message']);}};Acw[_0x9d47('0x18')][_0x9d47('0x32')]=function(_0x246e54){try{var _0x5bb786=this;if(_0x5bb786[_0x9d47('0x8')][_0x246e54]){_0x5bb786[_0x9d47('0x8')][_0x246e54][_0x9d47('0x27')]=![];var _0x5278fc=_0x5bb786['timers'][_0x246e54][_0x9d47('0x2a')];var _0x3f08bd=_0x5bb786[_0x9d47('0x8')][_0x246e54][_0x9d47('0x1a')];var _0x5493d1=_0x5bb786['voiceQueues'][_0x3f08bd][_0x9d47('0x26')];logger[_0x9d47('0x23')]('[%s][TIMER][STOP][AGENT:%s]',_0x5278fc,_0x246e54);RpcUser['saveUnpause'](this[_0x9d47('0x7')][_0x246e54]);RpcVoiceAgentReport['update']({'acwtime':_0x5493d1,'agentacw':!![]},_0x5278fc,_0x246e54)[_0x9d47('0x22')](function(_0x547477){logger[_0x9d47('0x23')](_0x9d47('0x33'),_0x5278fc,_0x5493d1,_0x547477);})[_0x9d47('0x2f')](function(_0x2d8e26){logger['error'](_0x9d47('0x2d'),_0x5278fc,_0x2d8e26);});}else{logger[_0x9d47('0x2c')](_0x9d47('0x34'),_0x246e54);if(_0x5bb786[_0x9d47('0x8')]){logger[_0x9d47('0x23')](_0x9d47('0x35'),JSON[_0x9d47('0x36')](_0x5bb786[_0x9d47('0x8')]));}}}catch(_0x12dd1a){logger[_0x9d47('0x2c')]('[ACW][STOP]\x20%s',_0x12dd1a['message']);}};Acw[_0x9d47('0x18')][_0x9d47('0xb')]=function(_0x5b149c){try{if(this['voiceQueues'][_0x5b149c[_0x9d47('0x1a')]]&&(this[_0x9d47('0x6')][_0x5b149c['queue']][_0x9d47('0x4')]||this[_0x9d47('0x6')][_0x5b149c[_0x9d47('0x1a')]][_0x9d47('0x1c')])){if(this['agents'][_0x5b149c['interface']]){this[_0x9d47('0x9')][_0x5b149c[_0x9d47('0x2a')]]={'queue':_0x5b149c[_0x9d47('0x1a')],'interface':_0x5b149c[_0x9d47('0x19')],'destlinkedid':_0x5b149c['destlinkedid']};}}}catch(_0x137547){logger[_0x9d47('0x2c')](_0x9d47('0x37'),_0x137547[_0x9d47('0x38')]);}};Acw[_0x9d47('0x18')][_0x9d47('0x15')]=function(_0x536c71){try{if(this[_0x9d47('0x6')][_0x536c71[_0x9d47('0x1a')]]&&(this[_0x9d47('0x6')][_0x536c71['queue']]['acw']||this[_0x9d47('0x6')][_0x536c71['queue']]['mandatoryDisposition'])){if(this[_0x9d47('0x7')][_0x536c71[_0x9d47('0x19')]]){this[_0x9d47('0x9')][_0x536c71[_0x9d47('0x2a')]]={'queue':_0x536c71['queue'],'interface':_0x536c71['interface']};}}}catch(_0x1d5aab){logger[_0x9d47('0x2c')](_0x9d47('0x39'),_0x1d5aab[_0x9d47('0x38')]);}};Acw['prototype'][_0x9d47('0xd')]=function(_0x29fa4a){try{if(this[_0x9d47('0x9')][_0x29fa4a[_0x9d47('0x2a')]]&&_[_0x9d47('0x3a')](this['channels'][_0x29fa4a[_0x9d47('0x2a')]][_0x9d47('0x25')])){logger[_0x9d47('0x23')]('[%s][HANGUP:UNIQUEID]',_0x29fa4a['uniqueid']);this['startAcw'](_0x29fa4a[_0x9d47('0x2a')]);}else if(this[_0x9d47('0x9')][_0x29fa4a[_0x9d47('0x3b')]]&&_[_0x9d47('0x3a')](this[_0x9d47('0x9')][_0x29fa4a[_0x9d47('0x3b')]][_0x9d47('0x25')])){logger[_0x9d47('0x23')](_0x9d47('0x3c'),_0x29fa4a[_0x9d47('0x3b')]);this['startAcw'](_0x29fa4a[_0x9d47('0x3b')]);}}catch(_0x33f4da){logger[_0x9d47('0x2c')](_0x9d47('0x3d'),_0x33f4da[_0x9d47('0x38')]);}};Acw[_0x9d47('0x18')][_0x9d47('0xf')]=function(_0x52d6e7){try{if(this['channels'][_0x52d6e7[_0x9d47('0x2a')]]&&this[_0x9d47('0x9')][_0x52d6e7[_0x9d47('0x2a')]]['attended']){logger[_0x9d47('0x23')](_0x9d47('0x3e'),_0x52d6e7[_0x9d47('0x2a')]);this[_0x9d47('0x3f')](_0x52d6e7[_0x9d47('0x2a')]);}else if(this[_0x9d47('0x9')][_0x52d6e7['linkedid']]&&this['channels'][_0x52d6e7[_0x9d47('0x3b')]]['attended']){logger[_0x9d47('0x23')](_0x9d47('0x40'),_0x52d6e7[_0x9d47('0x3b')]);this['startAcw'](_0x52d6e7[_0x9d47('0x3b')]);}}catch(_0x7f1796){logger['error'](_0x9d47('0x41'),_0x7f1796[_0x9d47('0x38')]);}};Acw['prototype'][_0x9d47('0x12')]=function(_0x26c6c9){try{if(!_[_0x9d47('0x42')](this[_0x9d47('0x9')][_0x26c6c9['transfereeuniqueid']])){this[_0x9d47('0x3f')](_0x26c6c9['transfereeuniqueid']);if(this['channels'][_0x26c6c9['secondtransfereruniqueid']]){this[_0x9d47('0x9')][_0x26c6c9[_0x9d47('0x43')]][_0x9d47('0x25')]=!![];this[_0x9d47('0x9')][_0x26c6c9[_0x9d47('0x44')]]=this[_0x9d47('0x9')][_0x26c6c9[_0x9d47('0x43')]];delete this[_0x9d47('0x9')][_0x26c6c9[_0x9d47('0x43')]];}}else if(!_[_0x9d47('0x42')](this[_0x9d47('0x9')][_0x26c6c9[_0x9d47('0x44')]])){this[_0x9d47('0x3f')](_0x26c6c9[_0x9d47('0x44')]);if(this[_0x9d47('0x9')][_0x26c6c9[_0x9d47('0x45')]]){this[_0x9d47('0x9')][_0x26c6c9[_0x9d47('0x45')]][_0x9d47('0x25')]=!![];this['channels'][_0x26c6c9['transfereeuniqueid']]=this[_0x9d47('0x9')][_0x26c6c9[_0x9d47('0x45')]];delete this[_0x9d47('0x9')][_0x26c6c9[_0x9d47('0x45')]];}}}catch(_0x1c363b){logger['error'](_0x9d47('0x46'),_0x1c363b['message']);}};Acw[_0x9d47('0x18')][_0x9d47('0x13')]=function(_0x5b4e16){try{if(this['channels'][_0x5b4e16[_0x9d47('0x47')]]){logger[_0x9d47('0x23')](_0x9d47('0x48'),JSON[_0x9d47('0x36')](_0x5b4e16['transfereruniqueid']));this[_0x9d47('0x3f')](_0x5b4e16[_0x9d47('0x47')]);}else if(this[_0x9d47('0x9')][_0x5b4e16['transfererlinkedid']]){logger[_0x9d47('0x23')](_0x9d47('0x49'),JSON['stringify'](_0x5b4e16['transfererlinkedid']));this[_0x9d47('0x3f')](_0x5b4e16[_0x9d47('0x4a')]);}}catch(_0x20edfb){logger[_0x9d47('0x2c')](_0x9d47('0x4b'),_0x20edfb['message']);}};Acw[_0x9d47('0x18')][_0x9d47('0x11')]=function(_0x24feb2){try{if(this[_0x9d47('0x6')][_0x24feb2['queue']]&&this[_0x9d47('0x6')][_0x24feb2['queue']][_0x9d47('0x4c')]==='all'){if(this[_0x9d47('0x7')][_0x24feb2['interface']]){logger[_0x9d47('0x23')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x24feb2[_0x9d47('0x2a')],_0x24feb2[_0x9d47('0x19')],_0x24feb2[_0x9d47('0x1a')]);return RpcUser[_0x9d47('0x4d')](this[_0x9d47('0x7')][_0x24feb2[_0x9d47('0x19')]],_0x9d47('0x4e'),_0x24feb2[_0x9d47('0x2a')]);}}}catch(_0x166d9e){logger[_0x9d47('0x2c')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x166d9e[_0x9d47('0x38')]);}};module[_0x9d47('0x4f')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index c094862..eb17a8e 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 _0x8953=['error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionQueueSummary','log','close','asterisk-manager','moment','lodash','../../config/environment','port','asterisk','username','password','keepConnected','Action','promisify','action'];(function(_0x4c3846,_0x39b39c){var _0x247d35=function(_0x16b82b){while(--_0x16b82b){_0x4c3846['push'](_0x4c3846['shift']());}};_0x247d35(++_0x39b39c);}(_0x8953,0xcc));var _0x3895=function(_0x38d5ed,_0x2b5125){_0x38d5ed=_0x38d5ed-0x0;var _0x504b92=_0x8953[_0x38d5ed];return _0x504b92;};'use strict';var Manager=require(_0x3895('0x0'));var BPromise=require('bluebird');var moment=require(_0x3895('0x1'));var util=require('util');var _=require(_0x3895('0x2'));var logger=require('../../config/logger')('ami');var config=require(_0x3895('0x3'));var ami=new Manager(config['asterisk'][_0x3895('0x4')],config[_0x3895('0x5')]['ip'],config[_0x3895('0x5')][_0x3895('0x6')],config[_0x3895('0x5')][_0x3895('0x7')],!![]);ami[_0x3895('0x8')]();ami[_0x3895('0x9')]=BPromise[_0x3895('0xa')](ami[_0x3895('0xb')]);function error(_0x4c0924){logger[_0x3895('0xc')](util[_0x3895('0xd')](_0x3895('0xe'),config[_0x3895('0x5')]['username'],config[_0x3895('0x5')]['ip'],config[_0x3895('0x5')][_0x3895('0x4')],util[_0x3895('0xf')](_0x4c0924,![],null)));}function close(){logger[_0x3895('0xc')](util[_0x3895('0xd')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x3895('0x5')][_0x3895('0x6')],config[_0x3895('0x5')]['ip'],config['asterisk'][_0x3895('0x4')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x3895('0x9')]({'action':_0x3895('0x10')});};};ami[_0x3895('0x11')]=function(){return function(){return ami['Action']({'action':_0x3895('0x12')});};};ami[_0x3895('0x13')]=function(){return function(){return ami['Action']({'action':_0x3895('0x14')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x3895('0x15')});};};ami[_0x3895('0x16')]=function(){return function(){return ami[_0x3895('0x9')]({'action':_0x3895('0x17')});};};function connect(_0x30b54d){logger[_0x3895('0x18')](util['format'](_0x3895('0x19'),config[_0x3895('0x5')][_0x3895('0x6')],config['asterisk']['ip'],config[_0x3895('0x5')]['port']));ami['once']('error',error);ami[_0x3895('0x1a')]('close',close);}ami['on']('connect',connect);ami['on'](_0x3895('0x1b'),function(_0x3cd306){logger['info'](util['format'](_0x3895('0x1c'),config[_0x3895('0x5')][_0x3895('0x6')],config[_0x3895('0x5')]['ip'],config[_0x3895('0x5')][_0x3895('0x4')],util[_0x3895('0xf')](_0x3cd306,![],null)));});ami['on'](_0x3895('0x1d'),function(_0x233b47){logger['info'](util['format'](_0x3895('0x1e'),config['asterisk']['username'],config['asterisk']['ip'],config[_0x3895('0x5')]['port']));return BPromise[_0x3895('0x1f')]()['then'](ami['actionSipShowRegistry']())[_0x3895('0x20')](ami[_0x3895('0x11')]())['then'](ami[_0x3895('0x13')]())[_0x3895('0x20')](ami[_0x3895('0x21')]())[_0x3895('0x20')](ami[_0x3895('0x16')]())['catch'](function(_0x68f266){console[_0x3895('0x22')](_0x68f266);});});ami[_0x3895('0x1a')](_0x3895('0xc'),error);ami[_0x3895('0x1a')](_0x3895('0x23'),close);module['exports']=ami; \ No newline at end of file +var _0xe0ef=['../../config/environment','asterisk','username','password','keepConnected','Action','action','format','port','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionCoreShowChannels','coreshowchannels','info','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','inspect','resolve','then','actionQueueSummary','log','asterisk-manager','bluebird','moment','util','../../config/logger','ami'];(function(_0x1d056a,_0x293d07){var _0x8e14c0=function(_0xb2a20a){while(--_0xb2a20a){_0x1d056a['push'](_0x1d056a['shift']());}};_0x8e14c0(++_0x293d07);}(_0xe0ef,0x147));var _0xfe0e=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xe0ef[_0x178e48];return _0x440d7e;};'use strict';var Manager=require(_0xfe0e('0x0'));var BPromise=require(_0xfe0e('0x1'));var moment=require(_0xfe0e('0x2'));var util=require(_0xfe0e('0x3'));var _=require('lodash');var logger=require(_0xfe0e('0x4'))(_0xfe0e('0x5'));var config=require(_0xfe0e('0x6'));var ami=new Manager(config[_0xfe0e('0x7')]['port'],config['asterisk']['ip'],config[_0xfe0e('0x7')][_0xfe0e('0x8')],config['asterisk'][_0xfe0e('0x9')],!![]);ami[_0xfe0e('0xa')]();ami[_0xfe0e('0xb')]=BPromise['promisify'](ami[_0xfe0e('0xc')]);function error(_0x32e4d7){logger['error'](util[_0xfe0e('0xd')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0xfe0e('0x8')],config[_0xfe0e('0x7')]['ip'],config['asterisk'][_0xfe0e('0xe')],util['inspect'](_0x32e4d7,![],null)));}function close(){logger[_0xfe0e('0xf')](util[_0xfe0e('0xd')](_0xfe0e('0x10'),config['asterisk']['username'],config[_0xfe0e('0x7')]['ip'],config[_0xfe0e('0x7')]['port']));}ami[_0xfe0e('0x11')]=function(){return function(){return ami[_0xfe0e('0xb')]({'action':_0xfe0e('0x12')});};};ami[_0xfe0e('0x13')]=function(){return function(){return ami[_0xfe0e('0xb')]({'action':_0xfe0e('0x14')});};};ami[_0xfe0e('0x15')]=function(){return function(){return ami[_0xfe0e('0xb')]({'action':_0xfe0e('0x16')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0xfe0e('0xb')]({'action':'queuesummary'});};};ami[_0xfe0e('0x17')]=function(){return function(){return ami[_0xfe0e('0xb')]({'action':_0xfe0e('0x18')});};};function connect(_0x247801){logger[_0xfe0e('0x19')](util[_0xfe0e('0xd')](_0xfe0e('0x1a'),config[_0xfe0e('0x7')][_0xfe0e('0x8')],config[_0xfe0e('0x7')]['ip'],config[_0xfe0e('0x7')][_0xfe0e('0xe')]));ami['once'](_0xfe0e('0xf'),error);ami[_0xfe0e('0x1b')](_0xfe0e('0x1c'),close);}ami['on'](_0xfe0e('0x1d'),connect);ami['on'](_0xfe0e('0x1e'),function(_0x2a422d){logger[_0xfe0e('0x19')](util[_0xfe0e('0xd')](_0xfe0e('0x1f'),config[_0xfe0e('0x7')][_0xfe0e('0x8')],config[_0xfe0e('0x7')]['ip'],config[_0xfe0e('0x7')][_0xfe0e('0xe')],util[_0xfe0e('0x20')](_0x2a422d,![],null)));});ami['on']('fullybooted',function(_0x12e578){logger[_0xfe0e('0x19')](util[_0xfe0e('0xd')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk'][_0xfe0e('0x8')],config[_0xfe0e('0x7')]['ip'],config[_0xfe0e('0x7')][_0xfe0e('0xe')]));return BPromise[_0xfe0e('0x21')]()['then'](ami['actionSipShowRegistry']())[_0xfe0e('0x22')](ami['actionDeviceStateList']())[_0xfe0e('0x22')](ami[_0xfe0e('0x15')]())[_0xfe0e('0x22')](ami[_0xfe0e('0x23')]())[_0xfe0e('0x22')](ami[_0xfe0e('0x17')]())['catch'](function(_0x100d94){console[_0xfe0e('0x24')](_0x100d94);});});ami[_0xfe0e('0x1b')](_0xfe0e('0xf'),error);ami[_0xfe0e('0x1b')](_0xfe0e('0x1c'),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 4f209a5..66768a9 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 _0xb7e7=['exports','jayson/promise','../../config/logger','client','Request','debug','rpc','error','memberReport','message','result','catch'];(function(_0xc36d01,_0x3bf1a6){var _0xecb231=function(_0x2fb301){while(--_0x2fb301){_0xc36d01['push'](_0xc36d01['shift']());}};_0xecb231(++_0x3bf1a6);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0xb7e7[_0x2faddb];return _0x273c05;};'use strict';var jayson=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b7e('0x1'))('ami');var client=jayson[_0x7b7e('0x2')]['http']({'port':0x2329});client[_0x7b7e('0x3')]=function(_0x556d68,_0x31d0ed){return new BPromise(function(_0x118577,_0x1d9384){return client['request'](_0x556d68,_0x31d0ed)['then'](function(_0x333fa4){logger[_0x7b7e('0x4')](_0x7b7e('0x5'),'memberReport',_0x556d68,_0x31d0ed,_0x333fa4);if(_0x333fa4[_0x7b7e('0x6')]){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x333fa4[_0x7b7e('0x6')][_0x7b7e('0x8')],_0x31d0ed);return _0x1d9384(_0x333fa4[_0x7b7e('0x6')]['message']);}else{return _0x118577(_0x333fa4[_0x7b7e('0x9')]);}})[_0x7b7e('0xa')](function(_0x10a666){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x10a666,_0x31d0ed);return _0x1d9384(_0x10a666);});});};module[_0x7b7e('0xb')]=client; \ No newline at end of file +var _0xcb91=['request','debug','memberReport','error','rpc','message','result','catch','exports','../../config/logger','ami','client','http'];(function(_0x4394b6,_0x12357f){var _0x360244=function(_0x5689a1){while(--_0x5689a1){_0x4394b6['push'](_0x4394b6['shift']());}};_0x360244(++_0x12357f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x207811,_0x3420a6){_0x207811=_0x207811-0x0;var _0x170d56=_0xcb91[_0x207811];return _0x170d56;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var client=jayson[_0x1cb9('0x2')][_0x1cb9('0x3')]({'port':0x2329});client['Request']=function(_0x8c392f,_0x2c17b8){return new BPromise(function(_0x545a34,_0x13d5fd){return client[_0x1cb9('0x4')](_0x8c392f,_0x2c17b8)['then'](function(_0x226b69){logger[_0x1cb9('0x5')]('rpc',_0x1cb9('0x6'),_0x8c392f,_0x2c17b8,_0x226b69);if(_0x226b69[_0x1cb9('0x7')]){logger['error'](_0x1cb9('0x8'),'memberReport',_0x8c392f,_0x226b69['error'][_0x1cb9('0x9')],_0x2c17b8);return _0x13d5fd(_0x226b69[_0x1cb9('0x7')][_0x1cb9('0x9')]);}else{return _0x545a34(_0x226b69[_0x1cb9('0xa')]);}})[_0x1cb9('0xb')](function(_0x50ce71){logger[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x1cb9('0x6'),_0x8c392f,_0x50ce71,_0x2c17b8);return _0x13d5fd(_0x50ce71);});});};module[_0x1cb9('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 84b9bba..0b5090c 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2812=['starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','format','\x22%s\x22\x20<%s>','dialCutDigit','number','substring','util','lodash','moment','isNil','string','voiceQueue','name','Contact','phone','firstName','lastName','queue','active','type','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName'];(function(_0x945377,_0x3173bc){var _0xd5193b=function(_0x515614){while(--_0x515614){_0x945377['push'](_0x945377['shift']());}};_0xd5193b(++_0x3173bc);}(_0x2812,0x1c6));var _0x2281=function(_0x418549,_0x11b13d){_0x418549=_0x418549-0x0;var _0x288826=_0x2812[_0x418549];return _0x288826;};'use strict';var util=require(_0x2281('0x0'));var _=require(_0x2281('0x1'));var moment=require(_0x2281('0x2'));function checkNameSurname(_0x1b6fab,_0x3a934f,_0x162447){var _0x1dd25b='';if(!_[_0x2281('0x3')](_0x3a934f)&&'string'===typeof _0x3a934f){_0x1dd25b+=_0x3a934f;}if(!_[_0x2281('0x3')](_0x162447)&&_0x2281('0x4')===typeof _0x162447){_0x1dd25b+='\x20'+_0x162447;}if(_0x1dd25b!==''){return _0x1dd25b;}return _0x1b6fab;}function Action(_0x55f199,_0x4c625c,_0x373666){this[_0x2281('0x5')]=_0x55f199;this['uniqueid']=_0x373666||undefined;this[_0x2281('0x6')]=checkNameSurname(_0x4c625c[_0x2281('0x7')][_0x2281('0x8')],_0x4c625c[_0x2281('0x7')][_0x2281('0x9')],_0x4c625c[_0x2281('0x7')][_0x2281('0xa')]);this['number']=_0x4c625c[_0x2281('0x7')][_0x2281('0x8')];this[_0x2281('0xb')]=_0x55f199[_0x2281('0x6')];this[_0x2281('0xc')]=_0x4c625c[_0x2281('0xc')]||![];this['type']=_0x55f199[_0x2281('0xd')];this['dialQueueTimeout']=_0x55f199['dialQueueTimeout']||0x3;this[_0x2281('0xe')]=_0x4c625c['scheduledat'];this[_0x2281('0xf')]=_0x4c625c[_0x2281('0xf')];this[_0x2281('0x10')]=_0x4c625c['countcongestionretry'];this[_0x2281('0x11')]=_0x4c625c[_0x2281('0x11')];this['countnosuchnumberretry']=_0x4c625c[_0x2281('0x12')];this[_0x2281('0x13')]=_0x4c625c[_0x2281('0x13')];this[_0x2281('0x14')]=_0x4c625c[_0x2281('0x14')];this[_0x2281('0x15')]=_0x4c625c[_0x2281('0x15')];this['countagentrejectretry']=_0x4c625c[_0x2281('0x16')];this[_0x2281('0x17')]=_0x4c625c[_0x2281('0x17')];this[_0x2281('0x18')]=_0x4c625c['ListId'];this['UserId']=_0x4c625c[_0x2281('0x19')];this[_0x2281('0x1a')]=_0x4c625c['VoiceQueueId'];this[_0x2281('0x1b')]=_0x4c625c[_0x2281('0x1b')];this[_0x2281('0x1c')]=_0x4c625c['id'];this[_0x2281('0x1d')]=_0x4c625c[_0x2281('0x7')]['firstName']||'';this[_0x2281('0x1e')]=moment()['format'](_0x2281('0x1f'));this['callback']=_0x4c625c[_0x2281('0x20')];this['callbackuniqueid']=_0x4c625c[_0x2281('0x21')];this[_0x2281('0x22')]=_0x4c625c[_0x2281('0x22')];this[_0x2281('0x23')]=_0x4c625c[_0x2281('0x23')];this[_0x2281('0x24')]='';this[_0x2281('0x25')]='';}Action[_0x2281('0x26')]['getCaller']=function(){return util[_0x2281('0x27')](_0x2281('0x28'),this[_0x2281('0x6')],this[_0x2281('0x5')][_0x2281('0x29')]>0x0?this[_0x2281('0x2a')][_0x2281('0x2b')](this[_0x2281('0x5')]['dialCutDigit']):this[_0x2281('0x2a')]);};Action[_0x2281('0x26')]['getQueue']=function(){return this[_0x2281('0xb')];};module['exports']=Action; \ No newline at end of file +var _0x70c6=['type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','getCaller','voiceQueue','dialCutDigit','substring','getQueue','exports','util','lodash','isNil','string','uniqueid','name','Contact','firstName','lastName','number','queue','active'];(function(_0x2d8266,_0xaade86){var _0x4a049e=function(_0x13bf15){while(--_0x13bf15){_0x2d8266['push'](_0x2d8266['shift']());}};_0x4a049e(++_0xaade86);}(_0x70c6,0x154));var _0x670c=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x70c6[_0x46698a];return _0x356db0;};'use strict';var util=require(_0x670c('0x0'));var _=require(_0x670c('0x1'));var moment=require('moment');function checkNameSurname(_0xfc0a55,_0x1344c6,_0x15cd8a){var _0xd72e35='';if(!_[_0x670c('0x2')](_0x1344c6)&&'string'===typeof _0x1344c6){_0xd72e35+=_0x1344c6;}if(!_[_0x670c('0x2')](_0x15cd8a)&&_0x670c('0x3')===typeof _0x15cd8a){_0xd72e35+='\x20'+_0x15cd8a;}if(_0xd72e35!==''){return _0xd72e35;}return _0xfc0a55;}function Action(_0x4efcc2,_0x415e31,_0x7432ab){this['voiceQueue']=_0x4efcc2;this[_0x670c('0x4')]=_0x7432ab||undefined;this[_0x670c('0x5')]=checkNameSurname(_0x415e31['Contact']['phone'],_0x415e31[_0x670c('0x6')][_0x670c('0x7')],_0x415e31['Contact'][_0x670c('0x8')]);this[_0x670c('0x9')]=_0x415e31['Contact']['phone'];this[_0x670c('0xa')]=_0x4efcc2['name'];this[_0x670c('0xb')]=_0x415e31[_0x670c('0xb')]||![];this['type']=_0x4efcc2[_0x670c('0xc')];this['dialQueueTimeout']=_0x4efcc2[_0x670c('0xd')]||0x3;this[_0x670c('0xe')]=_0x415e31['scheduledat'];this[_0x670c('0xf')]=_0x415e31['countbusyretry'];this[_0x670c('0x10')]=_0x415e31[_0x670c('0x10')];this[_0x670c('0x11')]=_0x415e31[_0x670c('0x11')];this[_0x670c('0x12')]=_0x415e31[_0x670c('0x12')];this[_0x670c('0x13')]=_0x415e31[_0x670c('0x13')];this[_0x670c('0x14')]=_0x415e31['countabandonedretry'];this[_0x670c('0x15')]=_0x415e31[_0x670c('0x15')];this['countagentrejectretry']=_0x415e31[_0x670c('0x16')];this[_0x670c('0x17')]=_0x415e31[_0x670c('0x17')];this[_0x670c('0x18')]=_0x415e31[_0x670c('0x18')];this[_0x670c('0x19')]=_0x415e31[_0x670c('0x19')];this['VoiceQueueId']=_0x415e31[_0x670c('0x1a')];this[_0x670c('0x1b')]=_0x415e31[_0x670c('0x1b')];this[_0x670c('0x1c')]=_0x415e31['id'];this[_0x670c('0x1d')]=_0x415e31[_0x670c('0x6')][_0x670c('0x7')]||'';this['starttime']=moment()[_0x670c('0x1e')](_0x670c('0x1f'));this[_0x670c('0x20')]=_0x415e31[_0x670c('0x20')];this[_0x670c('0x21')]=_0x415e31[_0x670c('0x21')];this[_0x670c('0x22')]=_0x415e31[_0x670c('0x22')];this[_0x670c('0x23')]=_0x415e31[_0x670c('0x23')];this['originatecalleridnum']='';this[_0x670c('0x24')]='';}Action[_0x670c('0x25')][_0x670c('0x26')]=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0x670c('0x5')],this[_0x670c('0x27')][_0x670c('0x28')]>0x0?this[_0x670c('0x9')][_0x670c('0x29')](this[_0x670c('0x27')][_0x670c('0x28')]):this[_0x670c('0x9')]);};Action['prototype'][_0x670c('0x2a')]=function(){return this['queue'];};module[_0x670c('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 3dde97e..f8dacf0 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe4a2=['originatecalleridnum','lodash','moment','milliseconds','diff','seconds','state','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x45a272,_0x28ac26){var _0x11bdf2=function(_0x226032){while(--_0x226032){_0x45a272['push'](_0x45a272['shift']());}};_0x11bdf2(++_0x28ac26);}(_0xe4a2,0xd3));var _0x2e4a=function(_0x2bcbd9,_0x2b28d1){_0x2bcbd9=_0x2bcbd9-0x0;var _0x9c7581=_0xe4a2[_0x2bcbd9];return _0x9c7581;};'use strict';var util=require('util');var _=require(_0x2e4a('0x0'));var moment=require(_0x2e4a('0x1'));function getSeconds(_0x154174,_0x2842f6){var _0x59b3b9=moment(_0x154174)['milliseconds'](0x0);var _0x2de6bc=moment(_0x2842f6)[_0x2e4a('0x2')](0x0);return _0x59b3b9[_0x2e4a('0x3')](_0x2de6bc,_0x2e4a('0x4'));}function AgentComplete(_0x9e2a4f,_0x10fc31){this[_0x2e4a('0x5')]=0x4;this['statedesc']='Answer';this['scheduledat']=_0x9e2a4f[_0x2e4a('0x6')];this[_0x2e4a('0x7')]=_0x9e2a4f[_0x2e4a('0x7')];this[_0x2e4a('0x8')]=_0x9e2a4f[_0x2e4a('0x7')]==='outbound'?_0x2e4a('0x9'):_0x9e2a4f[_0x2e4a('0x7')];this['countbusyretry']=_0x9e2a4f[_0x2e4a('0xa')];this['countcongestionretry']=_0x9e2a4f[_0x2e4a('0xb')];this[_0x2e4a('0xc')]=_0x9e2a4f['countnoanswerretry'];this['countglobal']=_0x9e2a4f['countbusyretry']+_0x9e2a4f[_0x2e4a('0xb')]+_0x9e2a4f[_0x2e4a('0xc')]+_0x9e2a4f[_0x2e4a('0xd')]+_0x9e2a4f[_0x2e4a('0xe')]+_0x9e2a4f[_0x2e4a('0xf')]+_0x9e2a4f[_0x2e4a('0x10')]+_0x9e2a4f['countagentrejectretry'];this[_0x2e4a('0xd')]=_0x9e2a4f['countnosuchnumberretry'];this[_0x2e4a('0xe')]=_0x9e2a4f[_0x2e4a('0xe')];this[_0x2e4a('0xf')]=_0x9e2a4f['countabandonedretry'];this[_0x2e4a('0x10')]=_0x9e2a4f[_0x2e4a('0x10')];this[_0x2e4a('0x11')]=_0x9e2a4f[_0x2e4a('0x11')];this[_0x2e4a('0x12')]=_0x10fc31[_0x2e4a('0x12')];this[_0x2e4a('0x13')]=_0x9e2a4f[_0x2e4a('0x14')];this[_0x2e4a('0x15')]=_0x9e2a4f[_0x2e4a('0x16')];this[_0x2e4a('0x17')]=_0x9e2a4f[_0x2e4a('0x17')];this[_0x2e4a('0x18')]=_0x9e2a4f[_0x2e4a('0x18')];this[_0x2e4a('0x19')]=_0x9e2a4f[_0x2e4a('0x19')];this['endtime']=moment()[_0x2e4a('0x1a')](_0x2e4a('0x1b'));this[_0x2e4a('0x1c')]=getSeconds(_0x9e2a4f[_0x2e4a('0x18')],_0x9e2a4f['starttime']);this['holdtime']=getSeconds(_0x9e2a4f[_0x2e4a('0x19')],_0x9e2a4f[_0x2e4a('0x18')]);this[_0x2e4a('0x1d')]=getSeconds(this['endtime'],_0x9e2a4f['answertime']);this[_0x2e4a('0x9')]=_0x10fc31[_0x2e4a('0x9')];this[_0x2e4a('0x1e')]=_0x10fc31['membername'];this[_0x2e4a('0x1f')]=_0x10fc31[_0x2e4a('0x1f')];this[_0x2e4a('0x20')]=_0x9e2a4f['callback'];this[_0x2e4a('0x21')]=_0x9e2a4f[_0x2e4a('0x21')];this[_0x2e4a('0x22')]=_0x9e2a4f[_0x2e4a('0x22')];this[_0x2e4a('0x23')]=_0x9e2a4f[_0x2e4a('0x23')];this[_0x2e4a('0x24')]=_0x9e2a4f[_0x2e4a('0x24')];this[_0x2e4a('0x25')]=_0x9e2a4f[_0x2e4a('0x25')];this[_0x2e4a('0x26')]=_0x9e2a4f[_0x2e4a('0x26')];this[_0x2e4a('0x27')]=_0x9e2a4f['VoiceQueueId'];this[_0x2e4a('0x28')]=_0x9e2a4f[_0x2e4a('0x28')];this[_0x2e4a('0x29')]=_0x9e2a4f['originatecalleridnum']||'';this['originatecalleridname']=_0x9e2a4f['originatecalleridname']||'';}module['exports']=AgentComplete; \ No newline at end of file +var _0x101e=['number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','endtime','membername','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','diff','state','statedesc','Answer','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countdropretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum'];(function(_0x2ce133,_0x469794){var _0x47dec4=function(_0x294324){while(--_0x294324){_0x2ce133['push'](_0x2ce133['shift']());}};_0x47dec4(++_0x469794);}(_0x101e,0xbe));var _0xe101=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x101e[_0x3947c9];return _0x2e7871;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xe101('0x0'));function getSeconds(_0x5a172d,_0x411607){var _0x5086cd=moment(_0x5a172d)['milliseconds'](0x0);var _0x3de9a2=moment(_0x411607)['milliseconds'](0x0);return _0x5086cd[_0xe101('0x1')](_0x3de9a2,'seconds');}function AgentComplete(_0xdb7c0a,_0x604cae){this[_0xe101('0x2')]=0x4;this[_0xe101('0x3')]=_0xe101('0x4');this['scheduledat']=_0xdb7c0a['scheduledat'];this['type']=_0xdb7c0a['type'];this['campaigntype']=_0xdb7c0a[_0xe101('0x5')]===_0xe101('0x6')?_0xe101('0x7'):_0xdb7c0a[_0xe101('0x5')];this[_0xe101('0x8')]=_0xdb7c0a[_0xe101('0x8')];this[_0xe101('0x9')]=_0xdb7c0a['countcongestionretry'];this[_0xe101('0xa')]=_0xdb7c0a['countnoanswerretry'];this['countglobal']=_0xdb7c0a[_0xe101('0x8')]+_0xdb7c0a['countcongestionretry']+_0xdb7c0a[_0xe101('0xa')]+_0xdb7c0a[_0xe101('0xb')]+_0xdb7c0a['countdropretry']+_0xdb7c0a[_0xe101('0xc')]+_0xdb7c0a['countmachineretry']+_0xdb7c0a['countagentrejectretry'];this[_0xe101('0xb')]=_0xdb7c0a[_0xe101('0xb')];this[_0xe101('0xd')]=_0xdb7c0a[_0xe101('0xd')];this[_0xe101('0xc')]=_0xdb7c0a[_0xe101('0xc')];this['countmachineretry']=_0xdb7c0a[_0xe101('0xe')];this[_0xe101('0xf')]=_0xdb7c0a[_0xe101('0xf')];this['uniqueid']=_0x604cae[_0xe101('0x10')];this[_0xe101('0x11')]=_0xdb7c0a[_0xe101('0x12')];this[_0xe101('0x13')]=_0xdb7c0a[_0xe101('0x14')];this[_0xe101('0x15')]=_0xdb7c0a[_0xe101('0x15')];this['responsetime']=_0xdb7c0a[_0xe101('0x16')];this['answertime']=_0xdb7c0a[_0xe101('0x17')];this['endtime']=moment()[_0xe101('0x18')](_0xe101('0x19'));this[_0xe101('0x1a')]=getSeconds(_0xdb7c0a[_0xe101('0x16')],_0xdb7c0a[_0xe101('0x15')]);this[_0xe101('0x1b')]=getSeconds(_0xdb7c0a[_0xe101('0x17')],_0xdb7c0a['responsetime']);this[_0xe101('0x1c')]=getSeconds(this[_0xe101('0x1d')],_0xdb7c0a[_0xe101('0x17')]);this['queue']=_0x604cae[_0xe101('0x7')];this[_0xe101('0x1e')]=_0x604cae['membername'];this[_0xe101('0x1f')]=_0x604cae[_0xe101('0x1f')];this['callback']=_0xdb7c0a[_0xe101('0x20')];this[_0xe101('0x21')]=_0xdb7c0a['callbackuniqueid'];this['callbackat']=_0xdb7c0a['callbackat'];this['recallme']=_0xdb7c0a[_0xe101('0x22')];this[_0xe101('0x23')]=_0xdb7c0a[_0xe101('0x23')];this[_0xe101('0x24')]=_0xdb7c0a[_0xe101('0x24')];this[_0xe101('0x25')]=_0xdb7c0a[_0xe101('0x25')];this['VoiceQueueId']=_0xdb7c0a['VoiceQueueId'];this[_0xe101('0x26')]=_0xdb7c0a[_0xe101('0x26')];this[_0xe101('0x27')]=_0xdb7c0a[_0xe101('0x27')]||'';this[_0xe101('0x28')]=_0xdb7c0a[_0xe101('0x28')]||'';}module[_0xe101('0x29')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index b5db763..fd2894d 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8098=['diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds'];(function(_0x743293,_0x1c6a7a){var _0x432544=function(_0x3204c9){while(--_0x3204c9){_0x743293['push'](_0x743293['shift']());}};_0x432544(++_0x1c6a7a);}(_0x8098,0x1ba));var _0x8809=function(_0x39aba0,_0x5a5cf6){_0x39aba0=_0x39aba0-0x0;var _0x56dc38=_0x8098[_0x39aba0];return _0x56dc38;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x8809('0x0'));function getSeconds(_0x1ad523,_0x4037be){var _0x22f28d=moment(_0x1ad523)[_0x8809('0x1')](0x0);var _0x4b0838=moment(_0x4037be)[_0x8809('0x1')](0x0);return _0x22f28d[_0x8809('0x2')](_0x4b0838,_0x8809('0x3'));}function Final(_0x1a11bf){this['uniqueid']=_0x1a11bf[_0x8809('0x4')];this[_0x8809('0x5')]=_0x1a11bf['scheduledat'];this[_0x8809('0x6')]=_0x1a11bf[_0x8809('0x6')];this[_0x8809('0x7')]=_0x1a11bf[_0x8809('0x6')]===_0x8809('0x8')?_0x8809('0x9'):_0x1a11bf[_0x8809('0x6')];this[_0x8809('0xa')]=_0x1a11bf[_0x8809('0xa')];this[_0x8809('0xb')]=_0x1a11bf[_0x8809('0xb')];this[_0x8809('0xc')]=_0x1a11bf[_0x8809('0xc')];this[_0x8809('0xd')]=_0x1a11bf[_0x8809('0xa')]+_0x1a11bf[_0x8809('0xb')]+_0x1a11bf['countnoanswerretry']+_0x1a11bf[_0x8809('0xe')]+_0x1a11bf[_0x8809('0xf')]+_0x1a11bf['countabandonedretry']+_0x1a11bf[_0x8809('0x10')]+_0x1a11bf[_0x8809('0x11')];this['countnosuchnumberretry']=_0x1a11bf['countnosuchnumberretry'];this[_0x8809('0xf')]=_0x1a11bf[_0x8809('0xf')];this[_0x8809('0x12')]=_0x1a11bf[_0x8809('0x12')];this[_0x8809('0x10')]=_0x1a11bf[_0x8809('0x10')];this[_0x8809('0x11')]=_0x1a11bf['countagentrejectretry'];this[_0x8809('0x9')]=_0x1a11bf[_0x8809('0x9')];this['calleridname']=_0x1a11bf[_0x8809('0x13')];this[_0x8809('0x14')]=_0x1a11bf['calleridnum'];this[_0x8809('0x15')]=_0x1a11bf[_0x8809('0x15')];this[_0x8809('0x16')]=_0x1a11bf[_0x8809('0x16')];this[_0x8809('0x17')]=_0x1a11bf['responsetime'];this['ringtime']=_0x1a11bf[_0x8809('0x18')]||0x0;this[_0x8809('0x19')]=_0x1a11bf[_0x8809('0x19')]||0x0;this[_0x8809('0x1a')]=_0x1a11bf[_0x8809('0x1a')]||0x0;this[_0x8809('0x1b')]=_0x1a11bf[_0x8809('0x1b')];this[_0x8809('0x1c')]=_0x1a11bf[_0x8809('0x1c')];this[_0x8809('0x1d')]=_0x1a11bf[_0x8809('0x1d')];this[_0x8809('0x1e')]=_0x1a11bf[_0x8809('0x1e')];this['ContactId']=_0x1a11bf['ContactId'];this[_0x8809('0x1f')]=_0x1a11bf[_0x8809('0x1f')];this['UserId']=_0x1a11bf['UserId'];this['VoiceQueueId']=_0x1a11bf[_0x8809('0x20')];this[_0x8809('0x21')]=_0x1a11bf[_0x8809('0x21')];this[_0x8809('0x22')]=_0x1a11bf[_0x8809('0x22')]||'';this[_0x8809('0x23')]=_0x1a11bf[_0x8809('0x23')]||'';}module[_0x8809('0x24')]=Final; \ No newline at end of file +var _0xd8b1=['originatecalleridname','exports','util','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x2b6e44,_0x1e00a3){var _0x59b46e=function(_0x3b7bc7){while(--_0x3b7bc7){_0x2b6e44['push'](_0x2b6e44['shift']());}};_0x59b46e(++_0x1e00a3);}(_0xd8b1,0x105));var _0x1d8b=function(_0x8d662c,_0x35c437){_0x8d662c=_0x8d662c-0x0;var _0x5b8990=_0xd8b1[_0x8d662c];return _0x5b8990;};'use strict';var util=require(_0x1d8b('0x0'));var _=require(_0x1d8b('0x1'));var moment=require(_0x1d8b('0x2'));function getSeconds(_0x5c8d8a,_0x20c6dd){var _0x5deaca=moment(_0x5c8d8a)[_0x1d8b('0x3')](0x0);var _0x417c87=moment(_0x20c6dd)['milliseconds'](0x0);return _0x5deaca[_0x1d8b('0x4')](_0x417c87,'seconds');}function Final(_0x5d069a){this['uniqueid']=_0x5d069a[_0x1d8b('0x5')];this['scheduledat']=_0x5d069a[_0x1d8b('0x6')];this[_0x1d8b('0x7')]=_0x5d069a[_0x1d8b('0x7')];this[_0x1d8b('0x8')]=_0x5d069a['type']==='outbound'?_0x1d8b('0x9'):_0x5d069a['type'];this['countbusyretry']=_0x5d069a[_0x1d8b('0xa')];this['countcongestionretry']=_0x5d069a[_0x1d8b('0xb')];this['countnoanswerretry']=_0x5d069a[_0x1d8b('0xc')];this[_0x1d8b('0xd')]=_0x5d069a[_0x1d8b('0xa')]+_0x5d069a[_0x1d8b('0xb')]+_0x5d069a[_0x1d8b('0xc')]+_0x5d069a[_0x1d8b('0xe')]+_0x5d069a['countdropretry']+_0x5d069a[_0x1d8b('0xf')]+_0x5d069a[_0x1d8b('0x10')]+_0x5d069a[_0x1d8b('0x11')];this[_0x1d8b('0xe')]=_0x5d069a[_0x1d8b('0xe')];this[_0x1d8b('0x12')]=_0x5d069a[_0x1d8b('0x12')];this[_0x1d8b('0xf')]=_0x5d069a['countabandonedretry'];this[_0x1d8b('0x10')]=_0x5d069a[_0x1d8b('0x10')];this[_0x1d8b('0x11')]=_0x5d069a[_0x1d8b('0x11')];this[_0x1d8b('0x9')]=_0x5d069a[_0x1d8b('0x9')];this[_0x1d8b('0x13')]=_0x5d069a['calleridname'];this['calleridnum']=_0x5d069a[_0x1d8b('0x14')];this[_0x1d8b('0x15')]=_0x5d069a[_0x1d8b('0x15')];this[_0x1d8b('0x16')]=_0x5d069a[_0x1d8b('0x16')];this['endtime']=_0x5d069a[_0x1d8b('0x16')];this[_0x1d8b('0x17')]=_0x5d069a['ringtime']||0x0;this[_0x1d8b('0x18')]=_0x5d069a[_0x1d8b('0x18')]||0x0;this[_0x1d8b('0x19')]=_0x5d069a['talktime']||0x0;this[_0x1d8b('0x1a')]=_0x5d069a[_0x1d8b('0x1a')];this[_0x1d8b('0x1b')]=_0x5d069a[_0x1d8b('0x1b')];this[_0x1d8b('0x1c')]=_0x5d069a[_0x1d8b('0x1c')];this[_0x1d8b('0x1d')]=_0x5d069a['recallme'];this[_0x1d8b('0x1e')]=_0x5d069a[_0x1d8b('0x1e')];this[_0x1d8b('0x1f')]=_0x5d069a[_0x1d8b('0x1f')];this['UserId']=_0x5d069a['UserId'];this[_0x1d8b('0x20')]=_0x5d069a[_0x1d8b('0x20')];this['CampaignId']=_0x5d069a[_0x1d8b('0x21')];this[_0x1d8b('0x22')]=_0x5d069a['originatecalleridnum']||'';this['originatecalleridname']=_0x5d069a[_0x1d8b('0x23')]||'';}module[_0x1d8b('0x24')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 4eb81fb..61d2b7f 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdaa7=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','util','lodash','moment','milliseconds','seconds','state','statedesc','Answer','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','queue','membername','IVR','reason','callback','callbackuniqueid'];(function(_0x59cdf6,_0x35faea){var _0x51b72b=function(_0x4fa65d){while(--_0x4fa65d){_0x59cdf6['push'](_0x59cdf6['shift']());}};_0x51b72b(++_0x35faea);}(_0xdaa7,0x1df));var _0x7daa=function(_0x503564,_0x55867e){_0x503564=_0x503564-0x0;var _0x4be9fd=_0xdaa7[_0x503564];return _0x4be9fd;};'use strict';var util=require(_0x7daa('0x0'));var _=require(_0x7daa('0x1'));var moment=require(_0x7daa('0x2'));function getSeconds(_0x5b2b3f,_0x5cf652){var _0x3d62b5=moment(_0x5b2b3f)[_0x7daa('0x3')](0x0);var _0x1b1134=moment(_0x5cf652)['milliseconds'](0x0);return _0x3d62b5['diff'](_0x1b1134,_0x7daa('0x4'));}function Hangup(_0xcb2883,_0x4c9ead){this[_0x7daa('0x5')]=0x4;this[_0x7daa('0x6')]=_0x7daa('0x7');this[_0x7daa('0x8')]=_0xcb2883[_0x7daa('0x8')];this[_0x7daa('0x9')]=_0xcb2883[_0x7daa('0x9')];this['campaigntype']=_0xcb2883[_0x7daa('0x9')]==='outbound'?'queue':_0xcb2883['type'];this[_0x7daa('0xa')]=_0xcb2883[_0x7daa('0xa')];this['countcongestionretry']=_0xcb2883[_0x7daa('0xb')];this['countnoanswerretry']=_0xcb2883[_0x7daa('0xc')];this[_0x7daa('0xd')]=_0xcb2883[_0x7daa('0xa')]+_0xcb2883[_0x7daa('0xb')]+_0xcb2883[_0x7daa('0xc')]+_0xcb2883[_0x7daa('0xe')]+_0xcb2883['countdropretry']+_0xcb2883['countabandonedretry']+_0xcb2883[_0x7daa('0xf')]+_0xcb2883[_0x7daa('0x10')];this[_0x7daa('0xe')]=_0xcb2883[_0x7daa('0xe')];this[_0x7daa('0x11')]=_0xcb2883[_0x7daa('0x11')];this[_0x7daa('0x12')]=_0xcb2883[_0x7daa('0x12')];this['countmachineretry']=_0xcb2883['countmachineretry'];this[_0x7daa('0x10')]=_0xcb2883[_0x7daa('0x10')];this[_0x7daa('0x13')]=_0x4c9ead['uniqueid'];this[_0x7daa('0x14')]=_0xcb2883['name'];this[_0x7daa('0x15')]=_0xcb2883[_0x7daa('0x16')];this[_0x7daa('0x17')]=_0xcb2883[_0x7daa('0x17')];this[_0x7daa('0x18')]=_0xcb2883[_0x7daa('0x18')];this[_0x7daa('0x19')]=moment()[_0x7daa('0x1a')](_0x7daa('0x1b'));this[_0x7daa('0x1c')]=getSeconds(_0xcb2883['responsetime'],_0xcb2883[_0x7daa('0x17')]);this[_0x7daa('0x1d')]=0x0;this[_0x7daa('0x1e')]=getSeconds(this[_0x7daa('0x19')],_0xcb2883[_0x7daa('0x18')]);this[_0x7daa('0x1f')]=_0xcb2883['queue'];this[_0x7daa('0x20')]=_0x7daa('0x21');this[_0x7daa('0x22')]=_0x4c9ead['cause-txt'];this[_0x7daa('0x23')]=_0xcb2883[_0x7daa('0x23')];this['callbackuniqueid']=_0xcb2883[_0x7daa('0x24')];this['callbackat']=_0xcb2883['callbackat'];this[_0x7daa('0x25')]=_0xcb2883['recallme'];this['ContactId']=_0xcb2883[_0x7daa('0x26')];this[_0x7daa('0x27')]=_0xcb2883[_0x7daa('0x27')];this[_0x7daa('0x28')]=_0xcb2883[_0x7daa('0x28')];this[_0x7daa('0x29')]=_0xcb2883[_0x7daa('0x29')];this[_0x7daa('0x2a')]=_0xcb2883[_0x7daa('0x2a')];}module['exports']=Hangup; \ No newline at end of file +var _0x1da5=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','moment','milliseconds','state','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','uniqueid','calleridname','name','calleridnum','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','responsetime','holdtime','membername','IVR','reason','cause-txt','callback'];(function(_0x36103d,_0x3453b9){var _0x4edadd=function(_0x1b6e64){while(--_0x1b6e64){_0x36103d['push'](_0x36103d['shift']());}};_0x4edadd(++_0x3453b9);}(_0x1da5,0x12e));var _0x51da=function(_0x1421a5,_0x39d591){_0x1421a5=_0x1421a5-0x0;var _0x1f9fbc=_0x1da5[_0x1421a5];return _0x1f9fbc;};'use strict';var util=require(_0x51da('0x0'));var _=require('lodash');var moment=require(_0x51da('0x1'));function getSeconds(_0x893165,_0x4f7bf5){var _0x1b7973=moment(_0x893165)['milliseconds'](0x0);var _0x3cab85=moment(_0x4f7bf5)[_0x51da('0x2')](0x0);return _0x1b7973['diff'](_0x3cab85,'seconds');}function Hangup(_0x48d1de,_0x3c1bc6){this[_0x51da('0x3')]=0x4;this['statedesc']=_0x51da('0x4');this['scheduledat']=_0x48d1de[_0x51da('0x5')];this[_0x51da('0x6')]=_0x48d1de[_0x51da('0x6')];this[_0x51da('0x7')]=_0x48d1de[_0x51da('0x6')]===_0x51da('0x8')?_0x51da('0x9'):_0x48d1de[_0x51da('0x6')];this[_0x51da('0xa')]=_0x48d1de['countbusyretry'];this[_0x51da('0xb')]=_0x48d1de[_0x51da('0xb')];this[_0x51da('0xc')]=_0x48d1de[_0x51da('0xc')];this[_0x51da('0xd')]=_0x48d1de['countbusyretry']+_0x48d1de['countcongestionretry']+_0x48d1de[_0x51da('0xc')]+_0x48d1de[_0x51da('0xe')]+_0x48d1de[_0x51da('0xf')]+_0x48d1de['countabandonedretry']+_0x48d1de['countmachineretry']+_0x48d1de[_0x51da('0x10')];this['countnosuchnumberretry']=_0x48d1de['countnosuchnumberretry'];this['countdropretry']=_0x48d1de['countdropretry'];this['countabandonedretry']=_0x48d1de[_0x51da('0x11')];this[_0x51da('0x12')]=_0x48d1de[_0x51da('0x12')];this['countagentrejectretry']=_0x48d1de['countagentrejectretry'];this[_0x51da('0x13')]=_0x3c1bc6['uniqueid'];this[_0x51da('0x14')]=_0x48d1de[_0x51da('0x15')];this[_0x51da('0x16')]=_0x48d1de['number'];this[_0x51da('0x17')]=_0x48d1de[_0x51da('0x17')];this['responsetime']=_0x48d1de['responsetime'];this[_0x51da('0x18')]=moment()[_0x51da('0x19')](_0x51da('0x1a'));this['ringtime']=getSeconds(_0x48d1de[_0x51da('0x1b')],_0x48d1de[_0x51da('0x17')]);this[_0x51da('0x1c')]=0x0;this['talktime']=getSeconds(this[_0x51da('0x18')],_0x48d1de['responsetime']);this[_0x51da('0x9')]=_0x48d1de[_0x51da('0x9')];this[_0x51da('0x1d')]=_0x51da('0x1e');this[_0x51da('0x1f')]=_0x3c1bc6[_0x51da('0x20')];this[_0x51da('0x21')]=_0x48d1de[_0x51da('0x21')];this['callbackuniqueid']=_0x48d1de['callbackuniqueid'];this[_0x51da('0x22')]=_0x48d1de[_0x51da('0x22')];this['recallme']=_0x48d1de[_0x51da('0x23')];this[_0x51da('0x24')]=_0x48d1de['ContactId'];this['ListId']=_0x48d1de[_0x51da('0x25')];this[_0x51da('0x26')]=_0x48d1de[_0x51da('0x26')];this[_0x51da('0x27')]=_0x48d1de[_0x51da('0x27')];this[_0x51da('0x28')]=_0x48d1de[_0x51da('0x28')];}module[_0x51da('0x29')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 8433976..8978fa7 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa226=['countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','milliseconds','diff','seconds','uniqueid','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x5677b1,_0x4cfe89){var _0x3324e5=function(_0x39fe8e){while(--_0x39fe8e){_0x5677b1['push'](_0x5677b1['shift']());}};_0x3324e5(++_0x4cfe89);}(_0xa226,0x13d));var _0x6a22=function(_0x2b8f9f,_0x4ba01e){_0x2b8f9f=_0x2b8f9f-0x0;var _0x4df414=_0xa226[_0x2b8f9f];return _0x4df414;};'use strict';var util=require(_0x6a22('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x10d4bc,_0xd069c8){var _0x3b29f1=moment(_0x10d4bc)[_0x6a22('0x1')](0x0);var _0x141eff=moment(_0xd069c8)[_0x6a22('0x1')](0x0);return _0x3b29f1[_0x6a22('0x2')](_0x141eff,_0x6a22('0x3'));}function History(_0xe0ec53){this[_0x6a22('0x4')]=_0xe0ec53['uniqueid'];this['scheduledat']=_0xe0ec53['scheduledat']||undefined;this[_0x6a22('0x5')]=_0xe0ec53[_0x6a22('0x5')];this[_0x6a22('0x6')]=_0xe0ec53[_0x6a22('0x5')]===_0x6a22('0x7')?_0x6a22('0x8'):_0xe0ec53[_0x6a22('0x5')];this[_0x6a22('0x9')]=_0xe0ec53['countbusyretry'];this['countcongestionretry']=_0xe0ec53['countcongestionretry'];this[_0x6a22('0xa')]=_0xe0ec53[_0x6a22('0xa')];this[_0x6a22('0xb')]=_0xe0ec53[_0x6a22('0x9')]+_0xe0ec53['countcongestionretry']+_0xe0ec53[_0x6a22('0xa')]+_0xe0ec53[_0x6a22('0xc')]+_0xe0ec53[_0x6a22('0xd')]+_0xe0ec53[_0x6a22('0xe')]+_0xe0ec53[_0x6a22('0xf')]+_0xe0ec53[_0x6a22('0x10')];this[_0x6a22('0xc')]=_0xe0ec53[_0x6a22('0xc')];this['countdropretry']=_0xe0ec53['countdropretry'];this['countabandonedretry']=_0xe0ec53[_0x6a22('0xe')];this[_0x6a22('0xf')]=_0xe0ec53[_0x6a22('0xf')];this[_0x6a22('0x10')]=_0xe0ec53['countagentrejectretry'];this[_0x6a22('0x8')]=_0xe0ec53['queue'];this[_0x6a22('0x11')]=_0xe0ec53[_0x6a22('0x12')];this[_0x6a22('0x13')]=_0xe0ec53[_0x6a22('0x14')];this[_0x6a22('0x15')]=_0xe0ec53[_0x6a22('0x15')];this['responsetime']=_0xe0ec53[_0x6a22('0x16')];this['endtime']=_0xe0ec53[_0x6a22('0x16')];this['ringtime']=getSeconds(_0xe0ec53['responsetime'],_0xe0ec53['starttime']);this[_0x6a22('0x17')]=0x0;this[_0x6a22('0x18')]=0x0;this[_0x6a22('0x19')]=_0xe0ec53['callback'];this[_0x6a22('0x1a')]=_0xe0ec53[_0x6a22('0x1a')];this[_0x6a22('0x1b')]=_0xe0ec53[_0x6a22('0x1b')];this[_0x6a22('0x1c')]=_0xe0ec53[_0x6a22('0x1c')];this['ContactId']=_0xe0ec53[_0x6a22('0x1d')];this[_0x6a22('0x1e')]=_0xe0ec53[_0x6a22('0x1e')];this[_0x6a22('0x1f')]=_0xe0ec53[_0x6a22('0x1f')];this[_0x6a22('0x20')]=_0xe0ec53[_0x6a22('0x20')];this[_0x6a22('0x21')]=_0xe0ec53[_0x6a22('0x21')];this[_0x6a22('0x22')]=_0xe0ec53[_0x6a22('0x22')]||'';this['originatecalleridname']=_0xe0ec53[_0x6a22('0x23')]||'';}module[_0x6a22('0x24')]=History; \ No newline at end of file +var _0x512d=['calleridname','name','calleridnum','number','starttime','responsetime','ringtime','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x512d,0x129));var _0xd512=function(_0xa31f59,_0x2ef147){_0xa31f59=_0xa31f59-0x0;var _0x1b3163=_0x512d[_0xa31f59];return _0x1b3163;};'use strict';var util=require(_0xd512('0x0'));var _=require(_0xd512('0x1'));var moment=require(_0xd512('0x2'));function getSeconds(_0x3a00f4,_0x22f08d){var _0x4ee0a4=moment(_0x3a00f4)[_0xd512('0x3')](0x0);var _0x4411ec=moment(_0x22f08d)['milliseconds'](0x0);return _0x4ee0a4[_0xd512('0x4')](_0x4411ec,_0xd512('0x5'));}function History(_0x5aa734){this[_0xd512('0x6')]=_0x5aa734[_0xd512('0x6')];this[_0xd512('0x7')]=_0x5aa734[_0xd512('0x7')]||undefined;this['type']=_0x5aa734['type'];this['campaigntype']=_0x5aa734['type']==='outbound'?_0xd512('0x8'):_0x5aa734['type'];this[_0xd512('0x9')]=_0x5aa734[_0xd512('0x9')];this[_0xd512('0xa')]=_0x5aa734['countcongestionretry'];this['countnoanswerretry']=_0x5aa734['countnoanswerretry'];this[_0xd512('0xb')]=_0x5aa734[_0xd512('0x9')]+_0x5aa734['countcongestionretry']+_0x5aa734[_0xd512('0xc')]+_0x5aa734[_0xd512('0xd')]+_0x5aa734[_0xd512('0xe')]+_0x5aa734['countabandonedretry']+_0x5aa734[_0xd512('0xf')]+_0x5aa734[_0xd512('0x10')];this[_0xd512('0xd')]=_0x5aa734[_0xd512('0xd')];this[_0xd512('0xe')]=_0x5aa734[_0xd512('0xe')];this[_0xd512('0x11')]=_0x5aa734[_0xd512('0x11')];this[_0xd512('0xf')]=_0x5aa734[_0xd512('0xf')];this[_0xd512('0x10')]=_0x5aa734[_0xd512('0x10')];this[_0xd512('0x8')]=_0x5aa734[_0xd512('0x8')];this[_0xd512('0x12')]=_0x5aa734[_0xd512('0x13')];this[_0xd512('0x14')]=_0x5aa734[_0xd512('0x15')];this[_0xd512('0x16')]=_0x5aa734[_0xd512('0x16')];this[_0xd512('0x17')]=_0x5aa734[_0xd512('0x17')];this['endtime']=_0x5aa734[_0xd512('0x17')];this[_0xd512('0x18')]=getSeconds(_0x5aa734['responsetime'],_0x5aa734[_0xd512('0x16')]);this['holdtime']=0x0;this['talktime']=0x0;this['callback']=_0x5aa734['callback'];this['callbackuniqueid']=_0x5aa734[_0xd512('0x19')];this[_0xd512('0x1a')]=_0x5aa734[_0xd512('0x1a')];this[_0xd512('0x1b')]=_0x5aa734[_0xd512('0x1b')];this['ContactId']=_0x5aa734[_0xd512('0x1c')];this['ListId']=_0x5aa734[_0xd512('0x1d')];this[_0xd512('0x1e')]=_0x5aa734[_0xd512('0x1e')];this[_0xd512('0x1f')]=_0x5aa734[_0xd512('0x1f')];this['CampaignId']=_0x5aa734[_0xd512('0x20')];this[_0xd512('0x21')]=_0x5aa734['originatecalleridnum']||'';this['originatecalleridname']=_0x5aa734['originatecalleridname']||'';}module[_0xd512('0x22')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 5ebfc4b..cad7ebc 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 _0xf4eb=['_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','finally','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','length','command','interval','content','true','iftime\x20%s,%s','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','dialTimezone','checkIfTimeIntervals','[syncQueueSummary]','dialGlobalInterval','[syncCampaigns]','pow','replace','random','match','actionOriginate','object','originate','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','tags','createdAt','%s%s','XMD-','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','originatecalleridnum','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','from-sip','OriginateError','[originate][error]','getQueue','isSuccess','response','callProgressDetecting','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','entity\x20is\x20undefine','[callProgressDetecting]','evt\x20is\x20undefine','reason','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberMaxRetry','createStateFinal','reason\x200\x20no\x20such\x20number....','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','custom:agentreject','agentreject','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','floor','erlangCalls','predictiveIntervalHitRate','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','averageHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','loggedIn','outboundQueuePauses','[CatchErlangB]','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','Agent','dialRecallInQueue','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','handleIvr','limitCalls','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','dialLimitQueue','[countReScheduled]\x20','RUNNING','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','not_inuse','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Error','m\x20=\x20','Ts\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\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','Umin\x20=\x20','exports','util','md5','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopperBlack','./action','./history','./agentComplete','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','tail','sequence','preview','voiceQueues','trunks','maxNumberOriginate','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','bind','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','syncHangup','syncNewExten','varset','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','Intervals','\x20INTERVAL_IS_NULL','isEmpty','stringify','milliseconds','diff','seconds','emit','outbound','strategy','answered','available','pTalking','sumBillable','sumDuration','sumHoldTime','total','type','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','format','voice:queue:%s','ivr','campaign:ivr:%s','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','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','---------\x20ErlangB\x20---------','Agent\x20Busy\x20Factor:\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','---------------------------','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22\x22\x20<>','inspect','error','stack','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','sendMessageOneNotActive','talking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','state','statedesc','endtime','starttime','loopClearZombieChannels','[uniqueid]','clearZombieChannels','enqueue','isNil','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','campaigns','countReScheduled','then','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','resolve','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','ListId','CampaignId','[emptyContact][createHistory]','[emptyContact]','Success','SIP/%s','reachable','unmonitored','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','uniqueid','HangupInAMD','membername','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','AMD','countmachineretry','countglobal','custom:amd','[syncAgentComplete][createHistory][0]','countnoanswerretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','VoiceQueueId','[syncHangupInAMDIvr][createHistory]','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','[syncHangupIvr]','dialQueueProject','AnswerAGI','[syncHangupIvr][createHistory]','outboundUnknownCallsDay','cause-txt','Unknow','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','locked','paused','agents','stateinterface','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]'];(function(_0x1bdaa7,_0x16f164){var _0x598e78=function(_0x1eb468){while(--_0x1eb468){_0x1bdaa7['push'](_0x1bdaa7['shift']());}};_0x598e78(++_0x16f164);}(_0xf4eb,0xec));var _0xbf4e=function(_0x517184,_0x220b74){_0x517184=_0x517184-0x0;var _0x312933=_0xf4eb[_0x517184];return _0x312933;};'use strict';var util=require(_0xbf4e('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var md5=require(_0xbf4e('0x1'));var Redis=require('ioredis');var ut=require('../preview/util/util');var config=require(_0xbf4e('0x2'));var logger=require(_0xbf4e('0x3'))(_0xbf4e('0x4'));var loggerBooked=require(_0xbf4e('0x3'))(_0xbf4e('0x5'));var loggerPredictive=require(_0xbf4e('0x3'))(_0xbf4e('0x6'));var loggerPredictiveCalls=require('../../../config/logger')(_0xbf4e('0x7'));var loggerSyncQueueSummary=require('../../../config/logger')('syncQueueSummary');var ami=require(_0xbf4e('0x8'));config[_0xbf4e('0x9')]=_[_0xbf4e('0xa')](config[_0xbf4e('0x9')],{'host':_0xbf4e('0xb'),'port':0x18eb});var io=require(_0xbf4e('0xc'))(new Redis(config[_0xbf4e('0x9')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xbf4e('0xd'));var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require(_0xbf4e('0xe'));var History=require(_0xbf4e('0xf'));var Final=require('./final');var AgentComplete=require(_0xbf4e('0x10'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require('./hangup');var ipAgi=process[_0xbf4e('0x11')][_0xbf4e('0x12')]||_0xbf4e('0x13');var strategy={'rrmemory':_0xbf4e('0x14'),'roundrobin':_0xbf4e('0x15')};var Sequence=function(){};Sequence[_0xbf4e('0x16')]['enqueue']=function(_0x59fb15){this[_0xbf4e('0x17')]=this[_0xbf4e('0x17')]?this[_0xbf4e('0x17')]['finally'](_0x59fb15):_0x59fb15();};function Dialer(_0x14110b,_0x2c292c){this[_0xbf4e('0x18')]=new Sequence();this[_0xbf4e('0x19')]=_0x2c292c;this['voiceQueues']=_0x14110b[_0xbf4e('0x1a')];this['campaigns']=_0x14110b['campaigns'];this['agents']=_0x14110b['agents'];this[_0xbf4e('0x1b')]=_0x14110b[_0xbf4e('0x1b')];this[_0xbf4e('0x1c')]=config['maxNumberOriginate']||0x2;this['channels']={};this[_0xbf4e('0x1d')]={};this[_0xbf4e('0x1e')]={};this[_0xbf4e('0x1f')]={};this[_0xbf4e('0x20')]={};this[_0xbf4e('0x21')]={};this[_0xbf4e('0x22')]={};this[_0xbf4e('0x23')]={};this[_0xbf4e('0x24')]={};this[_0xbf4e('0x25')]={};ami['on'](_0xbf4e('0x26'),this[_0xbf4e('0x27')]['bind'](this));ami['on'](_0xbf4e('0x28'),this[_0xbf4e('0x29')]['bind'](this));ami['on'](_0xbf4e('0x2a'),this[_0xbf4e('0x2b')][_0xbf4e('0x2c')](this));ami['on'](_0xbf4e('0x2d'),this[_0xbf4e('0x2e')]['bind'](this));ami['on'](_0xbf4e('0x2f'),this[_0xbf4e('0x30')][_0xbf4e('0x2c')](this));ami['on']('hangup',this[_0xbf4e('0x31')]['bind'](this));ami['on']('newexten',this[_0xbf4e('0x32')]['bind'](this));ami['on'](_0xbf4e('0x33'),this[_0xbf4e('0x34')][_0xbf4e('0x2c')](this));ami['on'](_0xbf4e('0x35'),this['syncQueueMember'][_0xbf4e('0x2c')](this));ami['on'](_0xbf4e('0x36'),this[_0xbf4e('0x37')]['bind'](this));this[_0xbf4e('0x38')]();this['loopClearZombieChannels']();}function isNotNull(_0x1dfa81){return _0x1dfa81!==null&&!_[_0xbf4e('0x39')](_0x1dfa81);}function checkIsLoggedIn(_0xb8b58e,_0x498dbd){return function(){if(_0x498dbd<=0x0){_0xb8b58e[_0xbf4e('0x3a')]=_0xbf4e('0x3b');throw _0xb8b58e[_0xbf4e('0x3c')]+_0xbf4e('0x3d');}};}function isActive(_0x2343dd){return _0x2343dd;}function checkIsActive(_0x3b5776,_0x5a7c71){return function(){if(!isActive(_0x5a7c71)){_0x3b5776[_0xbf4e('0x3a')]=_0xbf4e('0x3e');throw _0x3b5776['name']+_0xbf4e('0x3f');}};}function checkInterval(_0x26a375){return function(){if(!isNotNull(_0x26a375['Interval'])){_0x26a375[_0xbf4e('0x3a')]='INTERVAL_IS_NULL';throw _0x26a375[_0xbf4e('0x3c')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x26a375[_0xbf4e('0x40')][_0xbf4e('0x41')])){_0x26a375[_0xbf4e('0x3a')]='INTERVAL_IS_NULL';throw _0x26a375[_0xbf4e('0x3c')]+_0xbf4e('0x42');}if(!isNotNull(_[_0xbf4e('0x43')](_0x26a375[_0xbf4e('0x40')][_0xbf4e('0x41')]))){_0x26a375[_0xbf4e('0x3a')]='INTERVAL_IS_NULL';throw _0x26a375[_0xbf4e('0x3c')]+_0xbf4e('0x42');}};}function msgResponse(_0x25b837,_0x3bba55,_0x31d49a){return{'action':_0x25b837,'response':_0x3bba55,'message':_0x31d49a,'stack':_0x31d49a};}function myreject(_0x5b7ea1){return function(_0x4864bd){return _0x5b7ea1(msgResponse('[ifTime][Action]','Error',JSON[_0xbf4e('0x44')](_0x4864bd)));};}function getSeconds(_0x17a1a1,_0x91b52f){var _0x2693ba=moment(_0x17a1a1)[_0xbf4e('0x45')](0x0);var _0x257b74=moment(_0x91b52f)[_0xbf4e('0x45')](0x0);return _0x2693ba[_0xbf4e('0x46')](_0x257b74,_0xbf4e('0x47'));}function emit(_0x54527d,_0x4f6e93,_0x303fd8){io['to'](_0x54527d)[_0xbf4e('0x48')](_0x4f6e93,_0x303fd8);}function emitVoiceQueueSummary(_0x2cf1b0){if(_0x2cf1b0['type']===_0xbf4e('0x49')){var _0x4e72a2={'id':_0x2cf1b0['id'],'name':_0x2cf1b0[_0xbf4e('0x3c')],'strategy':_0x2cf1b0[_0xbf4e('0x4a')],'answered':_0x2cf1b0[_0xbf4e('0x4b')],'available':_0x2cf1b0[_0xbf4e('0x4c')],'loggedIn':_0x2cf1b0['loggedIn'],'pTalking':_0x2cf1b0[_0xbf4e('0x4d')],'sumBillable':_0x2cf1b0[_0xbf4e('0x4e')],'sumDuration':_0x2cf1b0[_0xbf4e('0x4f')],'sumHoldTime':_0x2cf1b0[_0xbf4e('0x50')]||0x0,'talking':_0x2cf1b0['talking'],'total':_0x2cf1b0[_0xbf4e('0x51')],'type':_0x2cf1b0[_0xbf4e('0x52')],'unmanaged':_0x2cf1b0[_0xbf4e('0x53')],'abandoned':_0x2cf1b0[_0xbf4e('0x54')],'waiting':_0x2cf1b0[_0xbf4e('0x55')],'loggedInDb':_0x2cf1b0[_0xbf4e('0x56')],'dialActive':_0x2cf1b0[_0xbf4e('0x57')],'dialMethod':_0x2cf1b0['dialMethod'],'dialOriginateCallerIdName':_0x2cf1b0[_0xbf4e('0x58')],'dialOriginateCallerIdNumber':_0x2cf1b0[_0xbf4e('0x59')],'dialOriginateTimeout':_0x2cf1b0['dialOriginateTimeout'],'dialPrefix':_0x2cf1b0['dialPrefix'],'outboundAnswerAgiCallsDay':_0x2cf1b0[_0xbf4e('0x5a')],'outboundAnswerCallsDay':_0x2cf1b0[_0xbf4e('0x5b')],'outboundBlacklistCallsDay':_0x2cf1b0['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x2cf1b0['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x2cf1b0[_0xbf4e('0x5c')],'outboundDropCallsDayACS':_0x2cf1b0[_0xbf4e('0x5d')],'outboundDropCallsDayCallersExit':_0x2cf1b0[_0xbf4e('0x5e')],'outboundDropCallsDayTimeout':_0x2cf1b0[_0xbf4e('0x5f')],'outboundNoAnswerCallsDay':_0x2cf1b0[_0xbf4e('0x60')],'outboundNoSuchCallsDay':_0x2cf1b0[_0xbf4e('0x61')],'outboundOriginateFailureCallsDay':_0x2cf1b0['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x2cf1b0[_0xbf4e('0x62')],'outboundRejectCallsDay':_0x2cf1b0[_0xbf4e('0x63')],'outboundUnknownCallsDay':_0x2cf1b0['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x2cf1b0['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x2cf1b0['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x2cf1b0['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x2cf1b0[_0xbf4e('0x64')],'predictiveIntervalDroppedCallsTimeout':_0x2cf1b0['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x2cf1b0[_0xbf4e('0x65')],'predictiveIntervalErlangCallsDroppedCalls':_0x2cf1b0[_0xbf4e('0x66')],'predictiveIntervalHitRate':_0x2cf1b0['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x2cf1b0['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x2cf1b0[_0xbf4e('0x67')],'predictiveIntervalAvailable':_0x2cf1b0[_0xbf4e('0x68')],'predictiveIntervalTotalCalls':_0x2cf1b0[_0xbf4e('0x69')],'message':_0x2cf1b0[_0xbf4e('0x3a')],'originated':_0x2cf1b0[_0xbf4e('0x6a')],'erlangCalls':_0x2cf1b0['erlangCalls'],'erlangCallToSecond':_0x2cf1b0[_0xbf4e('0x6b')],'erlangAbandonmentRate':_0x2cf1b0[_0xbf4e('0x6c')],'erlangBusyFactor':_0x2cf1b0[_0xbf4e('0x6d')],'startPredictive':_0x2cf1b0[_0xbf4e('0x21')],'startProgressive':_0x2cf1b0[_0xbf4e('0x22')]};if(_0x2cf1b0[_0xbf4e('0x6e')]){_0x4e72a2[_0xbf4e('0x6e')]={'id':_0x2cf1b0[_0xbf4e('0x6e')]['id'],'name':_0x2cf1b0['Trunk'][_0xbf4e('0x3c')],'active':_0x2cf1b0[_0xbf4e('0x6e')][_0xbf4e('0x6f')],'callerid':_0x2cf1b0[_0xbf4e('0x6e')][_0xbf4e('0x70')]};}if(_0x2cf1b0[_0xbf4e('0x40')]){_0x4e72a2[_0xbf4e('0x40')]={'id':_0x2cf1b0[_0xbf4e('0x40')]['id'],'name':_0x2cf1b0[_0xbf4e('0x40')][_0xbf4e('0x3c')]};}var _0x2fdba9=md5(JSON[_0xbf4e('0x44')](_0x4e72a2));if(_0x2cf1b0[_0xbf4e('0x1')]!==_0x2fdba9){_0x2cf1b0[_0xbf4e('0x1')]=_0x2fdba9;emit(util[_0xbf4e('0x71')](_0xbf4e('0x72'),_0x4e72a2[_0xbf4e('0x3c')]),'voice_queue:save',_0x4e72a2);}}}function emitCampaignSummary(_0x22d8ef){if(_0x22d8ef[_0xbf4e('0x52')]===_0xbf4e('0x73')){emit(util['format'](_0xbf4e('0x74'),_0x22d8ef['name']),'campaign:save',_0x22d8ef);}}function checkGetDataPredictive(_0x3832c3){if(isNotNull(_0x3832c3)&&!_[_0xbf4e('0x43')](_0x3832c3)){loggerPredictive['info'](_0xbf4e('0x75'));loggerPredictive[_0xbf4e('0x76')](_0xbf4e('0x77'),_0x3832c3[_0xbf4e('0x69')]);loggerPredictive[_0xbf4e('0x76')](_0xbf4e('0x78'),_0x3832c3[_0xbf4e('0x79')]);loggerPredictive[_0xbf4e('0x76')](_0xbf4e('0x7a'),_0x3832c3[_0xbf4e('0x7b')]);loggerPredictive[_0xbf4e('0x76')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3832c3['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0xbf4e('0x76')](_0xbf4e('0x7c'),_0x3832c3[_0xbf4e('0x7d')]);loggerPredictive['info'](_0xbf4e('0x7e'),_0x3832c3[_0xbf4e('0x7f')]);loggerPredictive['info']('---------------------------');if(_0x3832c3[_0xbf4e('0x69')]>0x0){if(!_['isUndefined'](_0x3832c3['predictiveIntervalAvgTalktime'])&&_0x3832c3[_0xbf4e('0x7f')]>0x0){return!![];}loggerPredictive[_0xbf4e('0x76')](_0xbf4e('0x80'));if(!_[_0xbf4e('0x39')](_0x3832c3[_0xbf4e('0x7d')])&&_0x3832c3['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0xbf4e('0x76')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0xbf4e('0x76')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xbf4e('0x76')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0xab6991){return function(_0x6c593a){loggerPredictive[_0xbf4e('0x76')](_0xbf4e('0x81'));loggerPredictive[_0xbf4e('0x76')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x6c593a['erlangCalls']);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x6c593a[_0xbf4e('0x6b')]);loggerPredictive[_0xbf4e('0x76')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x6c593a[_0xbf4e('0x6c')]);loggerPredictive[_0xbf4e('0x76')](_0xbf4e('0x82'),_0x6c593a[_0xbf4e('0x6d')]);loggerPredictive[_0xbf4e('0x76')](_0xbf4e('0x83'),_0x6c593a[_0xbf4e('0x6c')]);loggerPredictive['info'](_0xbf4e('0x84'));_[_0xbf4e('0x85')](_0xab6991,_0x6c593a);};}function getDiff(_0x42e117){var _0x5e548a=moment()['milliseconds'](0x0);var _0x64d8ea=moment(_0x42e117)[_0xbf4e('0x45')](0x0);return _0x5e548a[_0xbf4e('0x46')](_0x64d8ea,'seconds');}function ifInterval(_0x432967,_0x3d0f2c){if(_[_0xbf4e('0x39')](_0x3d0f2c)){return![];}return getDiff(_0x3d0f2c)<_0x432967*0x3c;}function freeVariablesPredictive(_0x4039a4){if(isNotNull(_0x4039a4)){if(!_[_0xbf4e('0x39')](_0x4039a4[_0xbf4e('0x22')])){_0x4039a4[_0xbf4e('0x22')]=undefined;loggerPredictive[_0xbf4e('0x76')](_0x4039a4[_0xbf4e('0x3c')],_0xbf4e('0x86'));}if(!_[_0xbf4e('0x39')](_0x4039a4[_0xbf4e('0x21')])){_0x4039a4['startPredictive']=undefined;loggerPredictive[_0xbf4e('0x76')](_0x4039a4['name'],_0xbf4e('0x87'));}if(!_[_0xbf4e('0x39')](_0x4039a4[_0xbf4e('0x88')])){clearInterval(_0x4039a4[_0xbf4e('0x88')]);_0x4039a4[_0xbf4e('0x88')]=undefined;loggerPredictive[_0xbf4e('0x76')](_0x4039a4[_0xbf4e('0x3c')],_0xbf4e('0x89'));}}}function erlangb(_0x4ea377,_0x1aeedd){if(_0x1aeedd===0x0){return 0x0;}var _0x325d09=0x1;for(var _0x22d5e1=0x1;_0x22d5e1<=_0x1aeedd;_0x22d5e1+=0x1){_0x325d09=0x1+_0x325d09*_0x22d5e1/_0x4ea377;}return 0x1/_0x325d09;}function isVoiceQueueOutbound(_0x33f9c4){return _0x33f9c4===_0xbf4e('0x49');}function isNotPreview(_0x5f3deb){return _0x5f3deb!==_0xbf4e('0x19');}function isCampaignIvr(_0x753f25){return _0x753f25===_0xbf4e('0x73');}function getCallerId(_0x1770ca,_0x12f19f,_0x2c606b){if(!_['isUndefined'](_0x2c606b)&&typeof _0x2c606b===_0xbf4e('0x8a')&&!_['isEmpty'](_0x2c606b)){if(!_[_0xbf4e('0x39')](_0x12f19f)&&typeof _0x12f19f===_0xbf4e('0x8a')&&!_[_0xbf4e('0x43')](_0x12f19f)){return util[_0xbf4e('0x71')]('\x22%s\x22\x20<%s>',_0x12f19f,_0x2c606b);}return util[_0xbf4e('0x71')]('\x22%s\x22\x20<%s>',_0x2c606b,_0x2c606b);}if(!_['isUndefined'](_0x1770ca)&&typeof _0x1770ca===_0xbf4e('0x8a')&&!_[_0xbf4e('0x43')](_0x1770ca)){return _0x1770ca;}return _0xbf4e('0x8b');}function loggerCatchQueueSummary(_0x56f3e0,_0x1c0b76){return function(_0x43bba9){freeVariablesPredictive(_0x1c0b76);emitVoiceQueueSummary(_0x1c0b76);emitCampaignSummary(_0x1c0b76);loggerSyncQueueSummary['error'](_0x56f3e0,util[_0xbf4e('0x8c')](_0x43bba9,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x42df5f,_0x4405b9){return function(_0x137224){loggerPredictive[_0xbf4e('0x8d')](_0x4405b9[_0xbf4e('0x3c')],_0x42df5f);loggerPredictive[_0xbf4e('0x8d')](_0x137224[_0xbf4e('0x8e')]);freeVariablesPredictive(_0x4405b9);};}function loggerCatch(_0x2bd74f){return function(_0x52c527){logger[_0xbf4e('0x8d')](_0x2bd74f,util[_0xbf4e('0x8c')](_0x52c527,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x2b2545){return _0x2b2545&&!_[_0xbf4e('0x39')](_0x2b2545)&&_0x2b2545['length']>0x0;}function decremetOriginate(_0x29a55f){if(!_[_0xbf4e('0x39')](_0x29a55f)&&_0x29a55f!==null){if(typeof _0x29a55f[_0xbf4e('0x6a')]!==_0xbf4e('0x8f')){if(_0x29a55f[_0xbf4e('0x6a')]>0x0){_0x29a55f[_0xbf4e('0x6a')]-=0x1;}else{logger[_0xbf4e('0x8d')](_0xbf4e('0x90'));}}}else{logger[_0xbf4e('0x8d')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x24c5a1,_0x47ef56,_0x11dcdb){if(_0x47ef56>_0x11dcdb){for(var _0x2ae98a=0x0;_0x2ae98a<_0x47ef56-_0x11dcdb;_0x2ae98a+=0x1){decremetOriginate(_0x24c5a1);}}}function loggerGetContactDialer(_0x34116f,_0x2e335f,_0xc5c749){return function(_0x4db6d7){checkContactLowerLimitOriginate(_0x2e335f,_0xc5c749,0x0);logger[_0xbf4e('0x8d')](_0x34116f,util[_0xbf4e('0x8c')](_0x4db6d7,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x16dd5f){return function(_0x4930a3){if(isNotNull(_0x4930a3)&&isNotNull(_0x4930a3[0x0])){if(_0x4930a3[0x0][_0xbf4e('0x91')]>0x0){_0x16dd5f[_0xbf4e('0x3a')]=_0xbf4e('0x92');logger['info'](_0xbf4e('0x93')+_0x16dd5f[_0xbf4e('0x3c')],_0x4930a3[0x0][_0xbf4e('0x91')],_0xbf4e('0x94'));}else{_0x16dd5f[_0xbf4e('0x3a')]='AVAILABLE_CONTACTS_FINISHED';logger[_0xbf4e('0x76')]('[getContactDialer2][Empty]'+_0x16dd5f[_0xbf4e('0x3c')]);}}};}function notSendMessagesQueue(_0x504723){if(_0x504723[_0xbf4e('0x95')]){freeVariablesPredictive(_0x504723);if(_0x504723['originated']===0x0&&_0x504723[_0xbf4e('0x96')]===0x0&&_0x504723['waiting']===0x0&&(_0x504723[_0xbf4e('0x4d')]||0x0)===0x0){_0x504723[_0xbf4e('0x95')]=![];_0x504723[_0xbf4e('0x4c')]=0x0;_0x504723[_0xbf4e('0x3a')]=_0xbf4e('0x3e');loggerSyncQueueSummary[_0xbf4e('0x8d')](_0xbf4e('0x97'),_0x504723['name'],_0xbf4e('0x98'));}else{_0x504723[_0xbf4e('0x3a')]=_0xbf4e('0x99');loggerSyncQueueSummary[_0xbf4e('0x8d')](_0xbf4e('0x97'),_0x504723[_0xbf4e('0x3c')],'is\x20disactive');}emitVoiceQueueSummary(_0x504723);}}function notSendMessagesCampaign(_0x207d2f){if(_0x207d2f[_0xbf4e('0x95')]){if(_0x207d2f['originated']===0x0){_0x207d2f[_0xbf4e('0x95')]=![];_0x207d2f[_0xbf4e('0x3a')]=_0xbf4e('0x3e');loggerSyncQueueSummary[_0xbf4e('0x8d')](_0xbf4e('0x9a'),_0x207d2f[_0xbf4e('0x3c')],_0xbf4e('0x98'));}else{_0x207d2f[_0xbf4e('0x3a')]=_0xbf4e('0x99');loggerSyncQueueSummary['error'](_0xbf4e('0x9a'),_0x207d2f[_0xbf4e('0x3c')],_0xbf4e('0x9b'));}emitCampaignSummary(_0x207d2f);}}function createObjHistory(_0x4ee7ac,_0x44c6f2,_0x27ebde,_0x563f14,_0x3d17dd){_0x4ee7ac[_0xbf4e('0x3a')]=_0x27ebde;var _0x380d25=new Action(_0x4ee7ac,_0x44c6f2);var _0xef121e=new History(_0x380d25);_0xef121e[_0xbf4e('0x9c')]=_0x563f14;_0xef121e[_0xbf4e('0x9d')]=_0x3d17dd;_0xef121e[_0xbf4e('0x9e')]=_0x380d25[_0xbf4e('0x9f')];return _0xef121e;}Dialer[_0xbf4e('0x16')][_0xbf4e('0xa0')]=function(){var _0x55bc7c=this;setInterval(function(){_0x55bc7c['clearZombieChannels'](_0x55bc7c[_0xbf4e('0x1f')],_0xbf4e('0xa1'));_0x55bc7c[_0xbf4e('0xa2')](_0x55bc7c[_0xbf4e('0x1d')],'[actions]');},0x32c8);};Dialer[_0xbf4e('0x16')][_0xbf4e('0xa2')]=function(_0x299af9,_0x99d48d){var _0x37876f=this;for(var _0xf27015 in _0x299af9){if(typeof _0x299af9[_0xf27015]!==_0xbf4e('0x8f')){this['sequence'][_0xbf4e('0xa3')](function(){if(!_[_0xbf4e('0xa4')](_0x299af9[_0xf27015])){return ami[_0xbf4e('0xa5')]({'action':_0xbf4e('0xa6'),'channel':_0x299af9[_0xf27015][_0xbf4e('0xa7')]})[_0xbf4e('0xa8')](function(_0x521d8e){if(_0x521d8e[_0xbf4e('0x3a')]===_0xbf4e('0xa9')){setTimeout(function(){if(_0x299af9[_0xf27015]&&_0x299af9[_0xf27015][_0xbf4e('0x52')]!==_0xbf4e('0x73')){_0x37876f[_0xbf4e('0xaa')](_0x37876f[_0xbf4e('0x1a')][_0x299af9[_0xf27015][_0xbf4e('0xab')]]);logger['error']('[Dialer][checkChannel]',_0x99d48d,_0xf27015,_0x299af9[_0xf27015][_0xbf4e('0xab')]);delete _0x299af9[_0xf27015];}if(_0x299af9[_0xf27015]&&_0x299af9[_0xf27015][_0xbf4e('0x52')]===_0xbf4e('0x73')){_0x37876f[_0xbf4e('0xaa')](_0x37876f[_0xbf4e('0xac')][_0x299af9[_0xf27015][_0xbf4e('0xab')]]);logger[_0xbf4e('0x8d')]('[Dialer][checkChannel][ivr]',_0x99d48d,_0xf27015,_0x299af9[_0xf27015][_0xbf4e('0xab')]);delete _0x299af9[_0xf27015];}},0x2328);}});}});}}};Dialer[_0xbf4e('0x16')][_0xbf4e('0xad')]=function(_0x54ee1a){return BPromise['resolve']()[_0xbf4e('0xae')](cmHopper[_0xbf4e('0xad')](_0x54ee1a))[_0xbf4e('0xa8')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0xbf4e('0x16')][_0xbf4e('0xaf')]=function(_0x2870d4){return BPromise['resolve']()[_0xbf4e('0xae')](cmHopperBlack[_0xbf4e('0xaf')](_0x2870d4))[_0xbf4e('0xa8')](loggerCatch(_0xbf4e('0xb0')));};Dialer[_0xbf4e('0x16')][_0xbf4e('0xb1')]=function(_0xbcac6d){return BPromise[_0xbf4e('0xb2')]()[_0xbf4e('0xae')](cmHopperBlack[_0xbf4e('0xb1')](_0xbcac6d))[_0xbf4e('0xa8')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0xbf4e('0x16')]['averageHandleTime']=function(_0x2de373){return BPromise[_0xbf4e('0xb2')]()[_0xbf4e('0xae')](cmHopperHistory[_0xbf4e('0xb3')](_0x2de373))['catch'](loggerCatch(_0xbf4e('0xb4')));};Dialer[_0xbf4e('0x16')]['rescheduleContact']=function(_0x1b555c){return BPromise[_0xbf4e('0xb2')]()[_0xbf4e('0xae')](cmHopper[_0xbf4e('0xb5')](_0x1b555c))[_0xbf4e('0xa8')](loggerCatch(_0xbf4e('0xb6')));};Dialer[_0xbf4e('0x16')][_0xbf4e('0xb7')]=function(_0x9c06e,_0x5f461a,_0x426445){return BPromise[_0xbf4e('0xb2')]()['then'](cmHopper[_0xbf4e('0xb7')](_0x9c06e,_0x5f461a,_0x426445))[_0xbf4e('0xa8')](loggerCatch(_0xbf4e('0xb8')));};Dialer[_0xbf4e('0x16')][_0xbf4e('0xb9')]=function(_0x27d975,_0xae2904,_0x46d3db,_0x512dd1,_0x1a534d){return BPromise[_0xbf4e('0xb2')]()[_0xbf4e('0xae')](cmHopper[_0xbf4e('0xb9')](_0x27d975,_0xae2904,_0x46d3db,_0x512dd1))[_0xbf4e('0xa8')](function(_0x50b409){_0x1a534d[_0xbf4e('0xba')]-=_0x46d3db;_0x1a534d[_0xbf4e('0xba')]=_0x1a534d[_0xbf4e('0xba')]>0x0?_0x1a534d[_0xbf4e('0xba')]:0x0;loggerCatch(_0xbf4e('0xbb'))(_0x50b409);});};Dialer[_0xbf4e('0x16')][_0xbf4e('0xbc')]=function(_0x8cea1b,_0x439b10,_0x5f2c43,_0x50106f){return BPromise['resolve']()[_0xbf4e('0xae')](cmHopper[_0xbf4e('0xbc')](_0x8cea1b,_0x439b10,_0x5f2c43))[_0xbf4e('0xa8')](function(_0x56add4){_0x50106f[_0xbf4e('0xba')]-=_0x439b10;_0x50106f[_0xbf4e('0xba')]=_0x50106f['temp']>0x0?_0x50106f[_0xbf4e('0xba')]:0x0;loggerCatch(_0xbf4e('0xbd'))(_0x56add4);});};Dialer['prototype'][_0xbf4e('0xbe')]=function(_0x5844a9){return BPromise[_0xbf4e('0xb2')]()['then'](voiceQueueRt['getVoiceQueueRtPauses'](_0x5844a9))['catch'](loggerCatch(_0xbf4e('0xbf')));};Dialer[_0xbf4e('0x16')]['moveContactManagedDialer']=function(_0x29d9ed){return BPromise[_0xbf4e('0xb2')]()[_0xbf4e('0xae')](cmHopper[_0xbf4e('0xc0')](_0x29d9ed))[_0xbf4e('0xa8')](loggerCatch(_0xbf4e('0xc1')));};Dialer[_0xbf4e('0x16')][_0xbf4e('0xc2')]=function(_0x14bf39){return BPromise[_0xbf4e('0xb2')]()[_0xbf4e('0xae')](cmHopperHistory['createHistory'](_0x14bf39))['catch'](loggerCatch('[createHistory]\x20'));};Dialer[_0xbf4e('0x16')][_0xbf4e('0xaa')]=function(_0x4e8f19){if(!_[_0xbf4e('0x39')](_0x4e8f19)&&_0x4e8f19!==null){if(typeof _0x4e8f19[_0xbf4e('0x6a')]!==_0xbf4e('0x8f')){if(_0x4e8f19[_0xbf4e('0x6a')]>0x0){_0x4e8f19['originated']-=0x1;}else{logger[_0xbf4e('0x8d')](_0xbf4e('0xc3'));}}}else{logger[_0xbf4e('0x8d')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0xbf4e('0x16')][_0xbf4e('0xc4')]=function(_0x3f7ae0,_0x92e714){var _0x2d46b0=this;return function(_0xa32ada){_0x2d46b0[_0xbf4e('0xaa')](_0x92e714);logger[_0xbf4e('0x8d')](_0x3f7ae0,util[_0xbf4e('0x8c')](_0xa32ada,{'showHidden':![],'depth':null}));};};Dialer[_0xbf4e('0x16')][_0xbf4e('0xc5')]=function(_0x5cc246,_0x477a0,_0x5dfb54){var _0x5e0dca={'state':0x19,'statedesc':_0xbf4e('0xc6')};this['updateOriginated'](_0x477a0);this[_0xbf4e('0xc7')](_[_0xbf4e('0x85')](_0x5e0dca,_[_0xbf4e('0xc8')](_0x5dfb54,[_0xbf4e('0xc9'),_0xbf4e('0xca'),'UserId','VoiceQueueId',_0xbf4e('0xcb')])),_0xbf4e('0xcc'),_0xbf4e('0xcd'));logger[_0xbf4e('0x8d')](_0x5cc246);};Dialer[_0xbf4e('0x16')]['isSuccess']=function(_0x271ea1){return _0x271ea1===_0xbf4e('0xce');};Dialer[_0xbf4e('0x16')]['isTrunkReachable']=function(_0xdf4d72){return!_['isUndefined'](_0xdf4d72)&&_0xdf4d72&&!_[_0xbf4e('0x39')](_0xdf4d72['name'])&&!_['isUndefined'](_0xdf4d72[_0xbf4e('0x6f')])&&_0xdf4d72[_0xbf4e('0x6f')]&&(this[_0xbf4e('0x1b')][util[_0xbf4e('0x71')](_0xbf4e('0xcf'),_0xdf4d72[_0xbf4e('0x3c')])][_0xbf4e('0xa6')]===_0xbf4e('0xd0')||this['trunks'][util[_0xbf4e('0x71')](_0xbf4e('0xcf'),_0xdf4d72[_0xbf4e('0x3c')])][_0xbf4e('0xa6')]===_0xbf4e('0xd1'));};Dialer['prototype']['saveInDb']=function(_0x4ce422,_0x354d2a,_0x488efe){this[_0xbf4e('0xc2')](_0x4ce422)[_0xbf4e('0xa8')](loggerCatch(_0x354d2a));this[_0xbf4e('0xc0')](_0x4ce422)[_0xbf4e('0xa8')](loggerCatch(_0x488efe));};Dialer['prototype']['syncVarSet']=function(_0x5f07a5){var _0x1716cf=this[_0xbf4e('0x1f')][_0x5f07a5['uniqueid']];var _0x1d717e;if(!_[_0xbf4e('0xa4')](_0x5f07a5)&&!_[_0xbf4e('0xa4')](_0x5f07a5['variable'])&&!_['isNil'](_0x5f07a5[_0xbf4e('0xd2')][_0xbf4e('0xd3')])&&_0x5f07a5[_0xbf4e('0xd4')]===_0xbf4e('0xd5')&&_0x1716cf){if(_0x1716cf[_0xbf4e('0x52')]!=='ivr'&&this['voiceQueues'][_0x1716cf[_0xbf4e('0xab')]][_0xbf4e('0xd6')]&&_0x5f07a5[_0xbf4e('0xd7')]==='HANGUP'){delete this['uniqueId'][_0x5f07a5[_0xbf4e('0xd8')]];this[_0xbf4e('0xaa')](this[_0xbf4e('0x1a')][_0x1716cf['queue']]);this[_0xbf4e('0x1a')][_0x1716cf[_0xbf4e('0xab')]][_0xbf4e('0x5b')]+=0x1;this[_0xbf4e('0x1a')][_0x1716cf[_0xbf4e('0xab')]][_0xbf4e('0x5a')]+=0x1;_0x1d717e=new Hangup(_0x1716cf,_0x5f07a5);_0x1d717e[_0xbf4e('0x9c')]=0x12;_0x1d717e['statedesc']=_0xbf4e('0xd9');_0x1d717e[_0xbf4e('0xda')]='AMD';ami['emit']('custom:amd',ut[_0xbf4e('0xdb')](_0x1d717e,_0xbf4e('0xdc')));this[_0xbf4e('0xc7')](_0x1d717e,_0xbf4e('0xdd'),_0xbf4e('0xde'));}if(_0x1716cf[_0xbf4e('0x52')]!=='ivr'&&this[_0xbf4e('0x1a')][_0x1716cf[_0xbf4e('0xab')]]['dialAMDActive']&&_0x5f07a5['value']===_0xbf4e('0xdf')){var _0x190fa6=this;return new BPromise(function(_0x224bee,_0x2b8ec0){delete _0x190fa6[_0xbf4e('0x1f')][_0x5f07a5[_0xbf4e('0xd8')]];_0x190fa6[_0xbf4e('0xaa')](_0x190fa6[_0xbf4e('0x1a')][_0x1716cf[_0xbf4e('0xab')]]);_0x190fa6['voiceQueues'][_0x1716cf['queue']]['outboundAnswerCallsDay']+=0x1;_0x190fa6[_0xbf4e('0x1a')][_0x1716cf['queue']][_0xbf4e('0x5a')]+=0x1;var _0x5d1407=_0x190fa6['voiceQueues'][_0x1716cf[_0xbf4e('0xab')]];var _0x4da3c7=new Hangup(_0x1716cf,_0x5f07a5);_0x4da3c7[_0xbf4e('0x9c')]=0x13;_0x4da3c7[_0xbf4e('0x9d')]=_0xbf4e('0xe0');_0x4da3c7[_0xbf4e('0xda')]=_0xbf4e('0xe1');_0x4da3c7[_0xbf4e('0xe2')]+=0x1;_0x4da3c7[_0xbf4e('0xe3')]+=0x1;_0x4da3c7['amd']=!![];ami['emit'](_0xbf4e('0xe4'),ut[_0xbf4e('0xdb')](_0x4da3c7,_0xbf4e('0xdc')));_0x190fa6[_0xbf4e('0xc2')](_0x4da3c7)[_0xbf4e('0xa8')](loggerCatch(_0xbf4e('0xe5')));if(_0x4da3c7['countbusyretry']+_0x4da3c7['countcongestionretry']+_0x4da3c7[_0xbf4e('0xe6')]+_0x4da3c7['countnosuchnumberretry']+_0x4da3c7['countdropretry']+_0x4da3c7[_0xbf4e('0xe7')]+_0x4da3c7[_0xbf4e('0xe2')]+_0x4da3c7[_0xbf4e('0xe8')]>=_0x5d1407[_0xbf4e('0xe9')]){_0x190fa6[_0xbf4e('0xea')](_0x4da3c7,_0x224bee,_0x2b8ec0,_0xbf4e('0xeb'));}else{if(_0x4da3c7[_0xbf4e('0xe2')]>=_0x5d1407[_0xbf4e('0xec')]){_0x190fa6['createStateFinal'](_0x4da3c7,_0x224bee,_0x2b8ec0,_0xbf4e('0xed'));}else{_0x190fa6[_0xbf4e('0xb5')]({'active':![],'countmachineretry':_0x4da3c7[_0xbf4e('0xe2')],'scheduledat':moment()[_0xbf4e('0xee')](_0x5d1407[_0xbf4e('0xef')],_0xbf4e('0xf0'))[_0xbf4e('0x71')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4da3c7[_0xbf4e('0xc9')],'ListId':_0x4da3c7[_0xbf4e('0xca')],'VoiceQueueId':_0x4da3c7[_0xbf4e('0xf1')]||undefined,'CampaignId':_0x4da3c7[_0xbf4e('0xcb')]||undefined})[_0xbf4e('0xa8')](loggerCatch('[rescheduleContact][Machine]'));_0x224bee({'reschedule':0x1});}}});}if(_0x1716cf[_0xbf4e('0x52')]==='ivr'&&this[_0xbf4e('0xac')][_0x1716cf[_0xbf4e('0xab')]][_0xbf4e('0xd6')]&&_0x5f07a5['value']==='HANGUP'){delete this[_0xbf4e('0x1f')][_0x5f07a5[_0xbf4e('0xd8')]];this[_0xbf4e('0xaa')](this[_0xbf4e('0xac')][_0x1716cf['queue']]);_0x1d717e=new Hangup(_0x1716cf,_0x5f07a5);_0x1d717e[_0xbf4e('0x9c')]=0x12;_0x1d717e['statedesc']=_0xbf4e('0xd9');_0x1d717e[_0xbf4e('0xda')]=_0xbf4e('0xe1');ami['emit'](_0xbf4e('0xe4'),ut[_0xbf4e('0xdb')](_0x1d717e,_0xbf4e('0xdc')));this[_0xbf4e('0xc7')](_0x1d717e,_0xbf4e('0xf2'),'[syncHangupInAMDIvr]');}if(_0x1716cf[_0xbf4e('0x52')]==='ivr'&&this['campaigns'][_0x1716cf[_0xbf4e('0xab')]]['dialAMDActive']&&_0x5f07a5[_0xbf4e('0xd7')]===_0xbf4e('0xdf')){var _0x190fa6=this;return new BPromise(function(_0x35afdb,_0x2a1935){delete _0x190fa6[_0xbf4e('0x1f')][_0x5f07a5[_0xbf4e('0xd8')]];_0x190fa6['updateOriginated'](_0x190fa6[_0xbf4e('0xac')][_0x1716cf[_0xbf4e('0xab')]]);_0x190fa6[_0xbf4e('0xac')][_0x1716cf[_0xbf4e('0xab')]]['outboundAnswerCallsDay']+=0x1;_0x190fa6[_0xbf4e('0xac')][_0x1716cf[_0xbf4e('0xab')]][_0xbf4e('0x5a')]+=0x1;var _0x43d546=_0x190fa6[_0xbf4e('0xac')][_0x1716cf[_0xbf4e('0xab')]];var _0x1033dc=new Hangup(_0x1716cf,_0x5f07a5);_0x1033dc[_0xbf4e('0x9c')]=0x13;_0x1033dc[_0xbf4e('0x9d')]=_0xbf4e('0xe0');_0x1033dc['membername']='AMD';_0x1033dc['countmachineretry']+=0x1;_0x1033dc['countglobal']+=0x1;_0x1033dc['amd']=!![];ami['emit'](_0xbf4e('0xe4'),ut[_0xbf4e('0xdb')](_0x1033dc,_0xbf4e('0xdc')));_0x190fa6['createHistory'](_0x1033dc)[_0xbf4e('0xa8')](loggerCatch(_0xbf4e('0xe5')));if(_0x1033dc[_0xbf4e('0xf3')]+_0x1033dc[_0xbf4e('0xf4')]+_0x1033dc[_0xbf4e('0xe6')]+_0x1033dc[_0xbf4e('0xf5')]+_0x1033dc[_0xbf4e('0xf6')]+_0x1033dc[_0xbf4e('0xe7')]+_0x1033dc[_0xbf4e('0xe2')]+_0x1033dc[_0xbf4e('0xe8')]>=_0x43d546[_0xbf4e('0xe9')]){_0x190fa6[_0xbf4e('0xea')](_0x1033dc,_0x35afdb,_0x2a1935,'reason19\x20machine....');}else{if(_0x1033dc['countmachineretry']>=_0x43d546[_0xbf4e('0xec')]){_0x190fa6['createStateFinal'](_0x1033dc,_0x35afdb,_0x2a1935,_0xbf4e('0xed'));}else{_0x190fa6['rescheduleContact']({'active':![],'countmachineretry':_0x1033dc[_0xbf4e('0xe2')],'scheduledat':moment()[_0xbf4e('0xee')](_0x43d546[_0xbf4e('0xef')],'minutes')[_0xbf4e('0x71')](_0xbf4e('0xf7')),'ContactId':_0x1033dc[_0xbf4e('0xc9')],'ListId':_0x1033dc[_0xbf4e('0xca')],'VoiceQueueId':_0x1033dc['VoiceQueueId']||undefined,'CampaignId':_0x1033dc[_0xbf4e('0xcb')]||undefined})[_0xbf4e('0xa8')](loggerCatch(_0xbf4e('0xf8')));_0x35afdb({'reschedule':0x1});}}});}}};Dialer[_0xbf4e('0x16')][_0xbf4e('0x31')]=function(_0x2fdf55){var _0x59ae4c=this[_0xbf4e('0x1f')][_0x2fdf55[_0xbf4e('0xd8')]];var _0x38f10c=this;var _0x20cc47;if(_0x59ae4c&&_0x59ae4c[_0xbf4e('0x52')]===_0xbf4e('0x73')){delete this[_0xbf4e('0x1f')][_0x2fdf55['uniqueid']];this['updateOriginated'](this[_0xbf4e('0xac')][_0x59ae4c[_0xbf4e('0xab')]]);this['campaigns'][_0x59ae4c[_0xbf4e('0xab')]]['ivrAnswerCallsDay']+=0x1;_0x20cc47=new Hangup(_0x59ae4c,_0x2fdf55);this[_0xbf4e('0xc2')](_0x20cc47)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xbf4e('0xc0')](_0x20cc47)[_0xbf4e('0xa8')](loggerCatch(_0xbf4e('0xf9')));}if(_0x59ae4c&&_0x59ae4c[_0xbf4e('0x52')]!==_0xbf4e('0x73')&&isNotNull(this['voiceQueues'][_0x59ae4c[_0xbf4e('0xab')]][_0xbf4e('0xfa')])){delete this[_0xbf4e('0x1f')][_0x2fdf55[_0xbf4e('0xd8')]];this['updateOriginated'](this[_0xbf4e('0x1a')][_0x59ae4c[_0xbf4e('0xab')]]);this[_0xbf4e('0x1a')][_0x59ae4c[_0xbf4e('0xab')]][_0xbf4e('0x5b')]+=0x1;this[_0xbf4e('0x1a')][_0x59ae4c[_0xbf4e('0xab')]][_0xbf4e('0x5a')]+=0x1;_0x20cc47=new Hangup(_0x59ae4c,_0x2fdf55);_0x20cc47[_0xbf4e('0x9c')]=0x10;_0x20cc47[_0xbf4e('0x9d')]=_0xbf4e('0xfb');_0x20cc47[_0xbf4e('0xda')]='AGI';this[_0xbf4e('0xc2')](_0x20cc47)['catch'](loggerCatch(_0xbf4e('0xfc')));this['moveContactManagedDialer'](_0x20cc47)['catch'](loggerCatch(_0xbf4e('0xf9')));}if(_0x59ae4c&&_0x59ae4c['type']!==_0xbf4e('0x73')&&!isNotNull(this[_0xbf4e('0x1a')][_0x59ae4c['queue']][_0xbf4e('0xfa')])){delete this[_0xbf4e('0x1f')][_0x2fdf55[_0xbf4e('0xd8')]];this[_0xbf4e('0xaa')](this[_0xbf4e('0x1a')][_0x59ae4c[_0xbf4e('0xab')]]);this['voiceQueues'][_0x59ae4c[_0xbf4e('0xab')]][_0xbf4e('0xfd')]+=0x1;_0x20cc47=new Hangup(_0x59ae4c,_0x2fdf55);_0x20cc47[_0xbf4e('0x9c')]=0xc;_0x20cc47[_0xbf4e('0x9d')]=_0x2fdf55[_0xbf4e('0xfe')];_0x20cc47[_0xbf4e('0xda')]=_0xbf4e('0xff');this[_0xbf4e('0xc2')](_0x20cc47)['catch'](loggerCatch(_0xbf4e('0xfc')));this[_0xbf4e('0xc0')](_0x20cc47)[_0xbf4e('0xa8')](loggerCatch(_0xbf4e('0xf9')));}};Dialer[_0xbf4e('0x16')][_0xbf4e('0x2e')]=function(_0xa0c438){var _0x593b10=this['uniqueId'][_0xa0c438[_0xbf4e('0xd8')]];var _0x31d49b=this;if(this[_0xbf4e('0x1a')][_0xa0c438['queue']]){if(_0x593b10&&_0x593b10[_0xbf4e('0x52')]!==_0xbf4e('0x73')){delete this['uniqueId'][_0xa0c438[_0xbf4e('0xd8')]];this['voiceQueues'][_0xa0c438[_0xbf4e('0xab')]][_0xbf4e('0x5b')]+=0x1;var _0x24c937=new AgentComplete(_0x593b10,_0xa0c438);if(_0xa0c438['reason']===_0xbf4e('0x100')){_0x24c937[_0xbf4e('0x101')]=this[_0xbf4e('0x1a')][_0xa0c438['queue']][_0xbf4e('0x102')]&&this[_0xbf4e('0x1a')][_0xa0c438[_0xbf4e('0xab')]][_0xbf4e('0x103')]?moment()[_0xbf4e('0x71')](_0xbf4e('0xf7')):undefined;}this[_0xbf4e('0xc2')](_0x24c937)[_0xbf4e('0xa8')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0xbf4e('0xc0')](_0x24c937)[_0xbf4e('0xa8')](loggerCatch(_0xbf4e('0x104')));}}};Dialer[_0xbf4e('0x16')][_0xbf4e('0x27')]=function(_0x5b0a70){if(this[_0xbf4e('0x1a')][_0x5b0a70[_0xbf4e('0xab')]]){if(this['uniqueId'][_0x5b0a70['uniqueid']]&&this[_0xbf4e('0x1f')][_0x5b0a70[_0xbf4e('0xd8')]][_0xbf4e('0x52')]!==_0xbf4e('0x73')){this[_0xbf4e('0xaa')](this[_0xbf4e('0x1a')][_0x5b0a70[_0xbf4e('0xab')]]);this[_0xbf4e('0x1f')][_0x5b0a70[_0xbf4e('0xd8')]][_0xbf4e('0x105')]=moment()[_0xbf4e('0x71')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0xbf4e('0x16')][_0xbf4e('0x106')]=function(_0xa93842){this['createHistory'](_0xa93842)[_0xbf4e('0xa8')](loggerCatch(_0xbf4e('0x107')));this['moveContactManagedDialer'](_0xa93842)[_0xbf4e('0xa8')](loggerCatch(_0xbf4e('0x108')));};Dialer[_0xbf4e('0x16')]['syncQueueCallerAbandon']=function(_0x32a47c){var _0x2ddc4a=this[_0xbf4e('0x1f')][_0x32a47c[_0xbf4e('0xd8')]];var _0x23fbe0=this;if(this[_0xbf4e('0x1a')][_0x32a47c[_0xbf4e('0xab')]]){if(_0x2ddc4a&&_0x2ddc4a['type']!==_0xbf4e('0x73')){delete this[_0xbf4e('0x1f')][_0x32a47c[_0xbf4e('0xd8')]];this[_0xbf4e('0xaa')](this[_0xbf4e('0x1a')][_0x32a47c[_0xbf4e('0xab')]]);_0x2ddc4a['droptime']=moment()['format'](_0xbf4e('0xf7'));var _0x400f61=new QueueCallerAbandon(_0x2ddc4a,_0x32a47c);if(getSeconds(_0x2ddc4a[_0xbf4e('0x109')],_0x2ddc4a[_0xbf4e('0x10a')])>=_0x2ddc4a[_0xbf4e('0x10b')]){this[_0xbf4e('0x1a')][_0x32a47c[_0xbf4e('0xab')]][_0xbf4e('0x7b')]+=0x1;this['voiceQueues'][_0x32a47c[_0xbf4e('0xab')]]['outboundDropCallsDayTimeout']+=0x1;this[_0xbf4e('0x1a')][_0x32a47c['queue']][_0xbf4e('0x66')]+=0x1;_0x400f61[_0xbf4e('0x9c')]=0xa;_0x400f61[_0xbf4e('0x9d')]=_0xbf4e('0x10c');_0x400f61[_0xbf4e('0x10d')]=_0xbf4e('0x10e');_0x400f61['agiafterat']=this[_0xbf4e('0x1a')][_0x32a47c['queue']][_0xbf4e('0x102')]?moment()[_0xbf4e('0x71')](_0xbf4e('0xf7')):undefined;_0x400f61['countdropretry']+=0x1;_0x400f61[_0xbf4e('0xe3')]+=0x1;if(_0x400f61[_0xbf4e('0xf6')]>=this[_0xbf4e('0x1a')][_0x32a47c[_0xbf4e('0xab')]][_0xbf4e('0x10f')]){this['queueCallerAbandonCreateState'](_0x400f61);}else{this[_0xbf4e('0xb5')]({'active':![],'countdropretry':_0x400f61[_0xbf4e('0xf6')],'scheduledat':moment()[_0xbf4e('0xee')](this['voiceQueues'][_0x32a47c[_0xbf4e('0xab')]][_0xbf4e('0x110')],_0xbf4e('0xf0'))[_0xbf4e('0x71')](_0xbf4e('0xf7')),'ContactId':_0x2ddc4a[_0xbf4e('0xc9')],'ListId':_0x2ddc4a[_0xbf4e('0xca')],'VoiceQueueId':_0x2ddc4a[_0xbf4e('0xf1')]||undefined,'CampaignId':_0x2ddc4a[_0xbf4e('0xcb')]||undefined})[_0xbf4e('0xa8')](loggerCatch(_0xbf4e('0x111')));var _0x35b10f=new History(_0x400f61);_0x35b10f[_0xbf4e('0x9c')]=0xa;_0x35b10f[_0xbf4e('0x9d')]=_0xbf4e('0x10c');_0x35b10f[_0xbf4e('0x9f')]=moment()[_0xbf4e('0x71')](_0xbf4e('0xf7'));_0x35b10f[_0xbf4e('0x9e')]=_0x35b10f['starttime'];_0x35b10f[_0xbf4e('0x112')]=_0x400f61[_0xbf4e('0x112')];_0x35b10f[_0xbf4e('0x113')]=_0x400f61[_0xbf4e('0x113')];this[_0xbf4e('0xc2')](_0x35b10f)[_0xbf4e('0xa8')](loggerCatch(_0xbf4e('0x114')));}}else{this['voiceQueues'][_0x32a47c['queue']][_0xbf4e('0x64')]+=0x1;this[_0xbf4e('0x1a')][_0x32a47c[_0xbf4e('0xab')]][_0xbf4e('0x5e')]+=0x1;_0x400f61[_0xbf4e('0x9c')]=0xb;_0x400f61[_0xbf4e('0x9d')]=_0xbf4e('0x115');_0x400f61[_0xbf4e('0x10d')]=_0xbf4e('0x116');_0x400f61[_0xbf4e('0xe7')]+=0x1;_0x400f61['countglobal']+=0x1;if(_0x400f61[_0xbf4e('0xe7')]>=this[_0xbf4e('0x1a')][_0x32a47c['queue']][_0xbf4e('0x117')]){this[_0xbf4e('0x106')](_0x400f61);}else{this[_0xbf4e('0xb5')]({'active':![],'countabandonedretry':_0x400f61[_0xbf4e('0xe7')],'scheduledat':moment()[_0xbf4e('0xee')](this['voiceQueues'][_0x32a47c[_0xbf4e('0xab')]]['dialAbandonedRetryFrequency'],_0xbf4e('0xf0'))[_0xbf4e('0x71')](_0xbf4e('0xf7')),'ContactId':_0x2ddc4a[_0xbf4e('0xc9')],'ListId':_0x2ddc4a[_0xbf4e('0xca')],'VoiceQueueId':_0x2ddc4a[_0xbf4e('0xf1')]||undefined,'CampaignId':_0x2ddc4a[_0xbf4e('0xcb')]||undefined})[_0xbf4e('0xa8')](loggerCatch(_0xbf4e('0x118')));var _0x35b10f=new History(_0x400f61);_0x35b10f['state']=0xb;_0x35b10f[_0xbf4e('0x9d')]=_0xbf4e('0x115');_0x35b10f[_0xbf4e('0x9f')]=moment()[_0xbf4e('0x71')]('YYYY-MM-DD\x20HH:mm:ss');_0x35b10f[_0xbf4e('0x9e')]=_0x35b10f[_0xbf4e('0x9f')];_0x35b10f[_0xbf4e('0x112')]=_0x400f61['calleridname'];_0x35b10f[_0xbf4e('0x113')]=_0x400f61[_0xbf4e('0x113')];this[_0xbf4e('0xc2')](_0x35b10f)[_0xbf4e('0xa8')](loggerCatch(_0xbf4e('0x119')));}}}}};Dialer['prototype'][_0xbf4e('0x32')]=function(_0x1d77ee){if(this[_0xbf4e('0x1d')][_0x1d77ee[_0xbf4e('0xd8')]]){this[_0xbf4e('0x1d')][_0x1d77ee['uniqueid']][_0xbf4e('0xa7')]=_0x1d77ee[_0xbf4e('0xa7')];}if(this['uniqueId'][_0x1d77ee['uniqueid']]){this[_0xbf4e('0x1f')][_0x1d77ee[_0xbf4e('0xd8')]][_0xbf4e('0xa7')]=_0x1d77ee[_0xbf4e('0xa7')];}};Dialer['prototype']['syncQueueMember']=function(_0x436f32){if(strategy[this['voiceQueues'][this[_0xbf4e('0x1d')][_0x436f32['actionid']][_0xbf4e('0xab')]][_0xbf4e('0x4a')]]===_0xbf4e('0x15')){if(this[_0xbf4e('0x1d')][_0x436f32[_0xbf4e('0x11a')]]&&_['isNil'](this[_0xbf4e('0x1d')][_0x436f32[_0xbf4e('0x11a')]][_0xbf4e('0x11b')])&&_0x436f32['status']==='1'&&_0x436f32[_0xbf4e('0x11c')]==='0'){if(this[_0xbf4e('0x11d')][_0x436f32[_0xbf4e('0x11e')]]){if(!this['agents'][_0x436f32[_0xbf4e('0x11e')]][_0xbf4e('0x11b')]){this[_0xbf4e('0x11d')][_0x436f32[_0xbf4e('0x11e')]][_0xbf4e('0x11b')]=!![];this[_0xbf4e('0x1d')][_0x436f32['actionid']][_0xbf4e('0x11b')]=!![];this[_0xbf4e('0x1d')][_0x436f32[_0xbf4e('0x11a')]][_0xbf4e('0x11e')]=_0x436f32[_0xbf4e('0x11e')];}}}}else if((strategy[this['voiceQueues'][this[_0xbf4e('0x1d')][_0x436f32[_0xbf4e('0x11a')]]['queue']]['strategy']]||_0xbf4e('0x14'))==='rrmemory'){if(this[_0xbf4e('0x1d')][_0x436f32[_0xbf4e('0x11a')]]){if(this['agents'][_0x436f32[_0xbf4e('0x11e')]]){this[_0xbf4e('0x1d')][_0x436f32[_0xbf4e('0x11a')]][_0xbf4e('0x11e')]=_0x436f32[_0xbf4e('0x11e')];if(_[_0xbf4e('0xa4')](this['queueBooked'][this[_0xbf4e('0x1d')][_0x436f32[_0xbf4e('0x11a')]][_0xbf4e('0xab')]])){this[_0xbf4e('0x24')][this['actions'][_0x436f32[_0xbf4e('0x11a')]]['queue']]=[];}this[_0xbf4e('0x24')][this[_0xbf4e('0x1d')][_0x436f32[_0xbf4e('0x11a')]][_0xbf4e('0xab')]][_0xbf4e('0x11f')](_[_0xbf4e('0x85')](_[_0xbf4e('0xc8')](this[_0xbf4e('0x1d')][_0x436f32['actionid']],[_0xbf4e('0x120'),_0xbf4e('0x11e')]),{'status':_0x436f32[_0xbf4e('0xa6')],'paused':_0x436f32[_0xbf4e('0x11c')]}));}}}};function unlockQueueStatus(_0x57eeb3,_0x5519b5){setTimeout(function(){if(_[_0xbf4e('0x39')](_0x57eeb3[_0xbf4e('0x121')])){loggerBooked[_0xbf4e('0x8d')](_0xbf4e('0x122'),_0x5519b5);}_0x57eeb3['queueStatusComplete']=!![];loggerBooked['info'](_0xbf4e('0x123'),_0x5519b5,JSON['stringify'](_['pick'](_0x57eeb3,[_0xbf4e('0x3c'),_0xbf4e('0x121')])));},0x1f3);}Dialer[_0xbf4e('0x16')][_0xbf4e('0x37')]=function(_0x581e1a){var _0x497b42=this;var _0x2c1587=_0x497b42['voiceQueues'][_0x497b42['actions'][_0x581e1a[_0xbf4e('0x11a')]][_0xbf4e('0xab')]];if(strategy[this[_0xbf4e('0x1a')][this[_0xbf4e('0x1d')][_0x581e1a[_0xbf4e('0x11a')]][_0xbf4e('0xab')]][_0xbf4e('0x4a')]]===_0xbf4e('0x15')){if(this['actions'][_0x581e1a[_0xbf4e('0x11a')]]&&this[_0xbf4e('0x1d')][_0x581e1a[_0xbf4e('0x11a')]][_0xbf4e('0x11e')]){this['preview'][_0xbf4e('0x124')](this[_0xbf4e('0x1d')][_0x581e1a[_0xbf4e('0x11a')]]['idHopper'],this[_0xbf4e('0x1d')][_0x581e1a[_0xbf4e('0x11a')]][_0xbf4e('0x11e')])['catch'](function(_0xaabd7d){logger[_0xbf4e('0x8d')](_0xbf4e('0x125'),util[_0xbf4e('0x8c')](_0xaabd7d,{'showHidden':![],'depth':null}));})['finally'](function(){_0x497b42[_0xbf4e('0xaa')](_0x497b42[_0xbf4e('0x1a')][_0x497b42[_0xbf4e('0x1d')][_0x581e1a[_0xbf4e('0x11a')]][_0xbf4e('0xab')]]);_0x497b42['agents'][_0x497b42[_0xbf4e('0x1d')][_0x581e1a[_0xbf4e('0x11a')]]['stateinterface']][_0xbf4e('0x11b')]=![];delete _0x497b42[_0xbf4e('0x1d')][_0x581e1a[_0xbf4e('0x11a')]];unlockQueueStatus(_0x2c1587);});}else{this[_0xbf4e('0xaa')](this['voiceQueues'][this[_0xbf4e('0x1d')][_0x581e1a['actionid']][_0xbf4e('0xab')]]);this[_0xbf4e('0xb5')]({'active':![],'ContactId':this[_0xbf4e('0x1d')][_0x581e1a['actionid']]['ContactId'],'ListId':this[_0xbf4e('0x1d')][_0x581e1a[_0xbf4e('0x11a')]]['ListId'],'VoiceQueueId':this['actions'][_0x581e1a[_0xbf4e('0x11a')]][_0xbf4e('0xf1')]||undefined,'CampaignId':this[_0xbf4e('0x1d')][_0x581e1a[_0xbf4e('0x11a')]]['CampaignId']||undefined})[_0xbf4e('0xa8')](loggerCatch(_0xbf4e('0x126')));delete this['actions'][_0x581e1a[_0xbf4e('0x11a')]];unlockQueueStatus(_0x2c1587);}}else if((strategy[this['voiceQueues'][this['actions'][_0x581e1a['actionid']][_0xbf4e('0xab')]]['strategy']]||'rrmemory')===_0xbf4e('0x14')){var _0x5900d2;if(this[_0xbf4e('0x1d')][_0x581e1a[_0xbf4e('0x11a')]]&&!_[_0xbf4e('0x43')](this['queueBooked'][this[_0xbf4e('0x1d')][_0x581e1a[_0xbf4e('0x11a')]][_0xbf4e('0xab')]])){if(this[_0xbf4e('0x25')][_0x497b42[_0xbf4e('0x1d')][_0x581e1a[_0xbf4e('0x11a')]]['queue']]){this['queueBookedRR'][_0x497b42[_0xbf4e('0x1d')][_0x581e1a['actionid']][_0xbf4e('0xab')]]=this['queueBookedRR'][this['actions'][_0x581e1a[_0xbf4e('0x11a')]]['queue']]?this[_0xbf4e('0x25')][this['actions'][_0x581e1a['actionid']]['queue']]:this['queueBooked'][this[_0xbf4e('0x1d')][_0x581e1a[_0xbf4e('0x11a')]]['queue']]?this[_0xbf4e('0x24')][this[_0xbf4e('0x1d')][_0x581e1a[_0xbf4e('0x11a')]]['queue']][_0xbf4e('0x127')]||0x0:0x0;}this[_0xbf4e('0x24')][this[_0xbf4e('0x1d')][_0x581e1a['actionid']][_0xbf4e('0xab')]][_0xbf4e('0x127')]=this[_0xbf4e('0x25')][this['actions'][_0x581e1a[_0xbf4e('0x11a')]]['queue']];for(var _0x21b5cb=0x0;_0x21b5cb=0x0;})['catch'](myreject(_0x255ade)));}}else{_0x66f312[_0xbf4e('0x11f')](ami['Action']({'action':_0xbf4e('0x13e'),'command':util[_0xbf4e('0x71')](_0xbf4e('0x142'),_0x3c605e,!_['isUndefined'](config['timezones'][_0x2dd31c])?_0x2dd31c:'')})['then'](function(_0x9af3c3){return _0x9af3c3['content']['indexOf'](_0xbf4e('0x141'))>=0x0;})[_0xbf4e('0xa8')](myreject(_0x255ade)));}BPromise[_0xbf4e('0x143')](_0x66f312)[_0xbf4e('0xae')](function(_0x3d4bf1){var _0x493fba=_[_0xbf4e('0x144')](_0x3d4bf1);if(_0x493fba){return _0x15ab5f(_0x493fba);}else{_0x4d069a[_0xbf4e('0x3a')]=_0xc4d7ae?_0xbf4e('0x145'):_0xbf4e('0x146');return _0x255ade(msgResponse(_0xbf4e('0x147'),_0xbf4e('0x136'),_0xbf4e('0x148')+_0xc4d7ae+'\x20'+_0x532f2a+_0xbf4e('0x149')+util[_0xbf4e('0x8c')](_0x3c605e,{'showHidden':![],'depth':null})+_0xbf4e('0x14a')+_0x2dd31c));}})[_0xbf4e('0xa8')](function(_0x282456){return _0x255ade(msgResponse(_0xbf4e('0x135'),_0xbf4e('0x136'),JSON['stringify'](_0x282456)));});});};Dialer[_0xbf4e('0x16')][_0xbf4e('0x14b')]=function(_0x5c93f6){var _0x43af83=this;return function(){switch(_0x5c93f6[_0xbf4e('0x14c')]){case _0xbf4e('0x14d'):freeVariablesPredictive(_0x5c93f6);_0x43af83[_0xbf4e('0x14e')](_0x5c93f6,0x1);break;case _0xbf4e('0x14f'):freeVariablesPredictive(_0x5c93f6);_0x43af83[_0xbf4e('0x14e')](_0x5c93f6,_0x5c93f6[_0xbf4e('0x150')]);break;case _0xbf4e('0x6'):_0x43af83['predictive'](_0x5c93f6);break;case'booked':freeVariablesPredictive(_0x5c93f6);_0x43af83['handlePower'](_0x5c93f6,0x1);break;default:freeVariablesPredictive(_0x5c93f6);logger['error'](_0xbf4e('0x151'),_0x5c93f6[_0xbf4e('0x3c')],_0xbf4e('0x152'));}};};Dialer[_0xbf4e('0x16')][_0xbf4e('0x153')]=function(_0x34ffe7){var _0x271668=this;return function(){_0x271668['handleIvr'](_0x34ffe7);};};Dialer[_0xbf4e('0x16')]['syncQueueSummary']=function(_0x2b2d82){var _0x41ac70=this;if(isNotPreview(_0x2b2d82['dialMethod'])){if(isVoiceQueueOutbound(_0x2b2d82[_0xbf4e('0x52')])&&isActive(_0x2b2d82[_0xbf4e('0x57')])){_0x2b2d82[_0xbf4e('0x95')]=!![];BPromise[_0xbf4e('0xb2')]()[_0xbf4e('0xae')](checkIsLoggedIn(_0x2b2d82,_0x2b2d82['loggedIn']))['then'](checkIsActive(_0x2b2d82,_0x2b2d82[_0xbf4e('0x57')]))[_0xbf4e('0xae')](checkInterval(_0x2b2d82))[_0xbf4e('0xae')](_0x41ac70[_0xbf4e('0x130')](_0x2b2d82))[_0xbf4e('0xae')](_0x41ac70['checkIfTime'](_0x2b2d82['dialGlobalInterval'],_0x2b2d82[_0xbf4e('0x154')],_0x2b2d82[_0xbf4e('0x3c')],_0x2b2d82))[_0xbf4e('0xae')](_0x41ac70[_0xbf4e('0x155')](_0x2b2d82[_0xbf4e('0x40')],_0x2b2d82['dialTimezone'],_0x2b2d82[_0xbf4e('0x3c')],_0x2b2d82))[_0xbf4e('0xae')](_0x41ac70[_0xbf4e('0x14b')](_0x2b2d82))['catch'](loggerCatchQueueSummary(_0xbf4e('0x156'),_0x2b2d82));}else{notSendMessagesQueue(_0x2b2d82);}}else{freeVariablesPredictive(_0x2b2d82);}};Dialer[_0xbf4e('0x16')][_0xbf4e('0x12f')]=function(){var _0x1edb86=this;var _0x219fad;for(var _0x29d107 in this[_0xbf4e('0xac')]){if(typeof this['campaigns'][_0x29d107]!==_0xbf4e('0x8f')){_0x219fad=this[_0xbf4e('0xac')][_0x29d107];if(isCampaignIvr(_0x219fad[_0xbf4e('0x52')])&&isActive(_0x219fad['active'])){_0x219fad['sendMessageOneNotActive']=!![];BPromise[_0xbf4e('0xb2')]()[_0xbf4e('0xae')](checkIsActive(_0x219fad,_0x219fad[_0xbf4e('0x6f')]))['then'](checkInterval(_0x219fad))['then'](_0x1edb86[_0xbf4e('0x130')](_0x219fad))[_0xbf4e('0xae')](_0x1edb86['checkIfTime'](_0x219fad[_0xbf4e('0x157')],_0x219fad[_0xbf4e('0x154')],_0x219fad['name'],_0x219fad))[_0xbf4e('0xae')](_0x1edb86[_0xbf4e('0x155')](_0x219fad[_0xbf4e('0x40')],_0x219fad[_0xbf4e('0x154')],_0x219fad[_0xbf4e('0x3c')],_0x219fad))['then'](_0x1edb86[_0xbf4e('0x153')](_0x219fad))[_0xbf4e('0xa8')](loggerCatchQueueSummary(_0xbf4e('0x158'),_0x219fad));}else{notSendMessagesCampaign(_0x219fad);}}}};function getCallerIdRandom(_0x3f6ced,_0x5443fa){var _0x1c6858;var _0x428a44;var _0x1bd079;if(_0x5443fa<=0x0){_0x5443fa=0x1;}_0x1c6858=new RegExp('\x5cw{0,'+_0x5443fa+'}$');_0x428a44=Math[_0xbf4e('0x159')](0xa,_0x5443fa-0x1);_0x1bd079=Math[_0xbf4e('0x159')](0xa,_0x5443fa)-0x1;return util['format']('%s',_[_0xbf4e('0x15a')](_0x3f6ced,_0x1c6858,_[_0xbf4e('0x15b')](_0x428a44,_0x1bd079)));}function extractCalleridName(_0x32126c){var _0xc64f18=_0x32126c[_0xbf4e('0x15c')](/"(.*?)"/);return _0xc64f18?_0xc64f18[0x1]:_0x32126c;}function extractCalleridNumber(_0x1983ef){var _0x4dcd16=_0x1983ef[_0xbf4e('0x15c')](/<(.*?)>/);return _0x4dcd16?_0x4dcd16[0x1]:_0x1983ef;}Dialer[_0xbf4e('0x16')][_0xbf4e('0x15d')]=function(_0x453348,_0x1564be){var _0x4fb90d=this;var _0x162565=uuid['v4']();this[_0xbf4e('0x1d')][_0x162565]=new Action(_0x453348,_0x1564be,_0x162565);return new BPromise(function(_0x51d7d3,_0x4a0259){if(_[_0xbf4e('0x39')](_0x453348)&&typeof _0x453348!==_0xbf4e('0x15e')){return _0x4a0259(msgResponse(_0xbf4e('0x15f'),_0xbf4e('0x136'),'voiceQueue\x20is\x20undefine'));}if(_[_0xbf4e('0x39')](_0x1564be[_0xbf4e('0x160')][_0xbf4e('0x161')])||_0x1564be['Contact']['phone']===null){return _0x4a0259(msgResponse(_0xbf4e('0x15f'),'Failure',_0xbf4e('0x162')));}var _0x41de24={'XMD-CALLERID':_0x4fb90d[_0xbf4e('0x1d')][_0x162565][_0xbf4e('0x163')](),'XMD-AGI':_0x453348[_0xbf4e('0xfa')]?util['format'](_0xbf4e('0x164'),ipAgi,_0x453348[_0xbf4e('0xfa')]):_0xbf4e('0x165'),'XMD-AGIAFTER':_0x453348['dialQueueProject2']?util[_0xbf4e('0x71')](_0xbf4e('0x164'),ipAgi,_0x453348[_0xbf4e('0x102')]):'NONE','XMD-QUEUE':_0x453348['type']==='outbound'?util[_0xbf4e('0x71')](_0xbf4e('0x166'),_0x453348['name'],_0x453348[_0xbf4e('0x167')]||'',_0x453348[_0xbf4e('0x103')]?'c':'',_0x453348[_0xbf4e('0x10b')]||0x3):_0xbf4e('0x165'),'XMD-CONTACTID':_0x1564be['ContactId'],'XMD-CDRTYPE':_0xbf4e('0x4'),'CALLERID(all)':_0x4fb90d['actions'][_0x162565][_0xbf4e('0x163')](),'XMD-AMD':_0x453348[_0xbf4e('0xd6')]?_0xbf4e('0x168'):_0xbf4e('0x165'),'XMD-DESTINATION':_0xbf4e('0xd5')};if(_0x453348['dialAMDActive']){_0x41de24[_0xbf4e('0x169')]=_0x453348[_0xbf4e('0x16a')]||0x9c4;_0x41de24[_0xbf4e('0x16b')]=_0x453348[_0xbf4e('0x16c')]||0x5dc;_0x41de24[_0xbf4e('0x16d')]=_0x453348['dialAMDAfterGreetingSilence']||0x320;_0x41de24[_0xbf4e('0x16e')]=_0x453348[_0xbf4e('0x16f')]||0x1388;_0x41de24[_0xbf4e('0x170')]=_0x453348['dialAMDMinWordLength']||0x64;_0x41de24[_0xbf4e('0x171')]=_0x453348['dialAMDBetweenWordsSilence']||0x32;_0x41de24['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x453348['dialAMDMaximumNumberOfWords']||0x3;_0x41de24['XMD-AMDSILENCETHRESHOLD']=_0x453348[_0xbf4e('0x172')]||0x100;_0x41de24[_0xbf4e('0x173')]=_0x453348[_0xbf4e('0x174')]||0x1388;}if(_0x453348[_0xbf4e('0x52')]==='outbound'){_0x41de24[_0xbf4e('0x175')]=_0x1564be[_0xbf4e('0xf1')];}else{_0x41de24['XMD-CAMPAIGNID']=_0x1564be[_0xbf4e('0xcb')];}for(var _0x4fc1c8 in _0x1564be[_0xbf4e('0x160')]){if(typeof _0x1564be[_0xbf4e('0x160')][_0x4fc1c8]!==_0xbf4e('0x8f')){if(isNotNull(_0x1564be[_0xbf4e('0x160')][_0x4fc1c8])&&_0x4fc1c8!=='id'&&_0x4fc1c8!==_0xbf4e('0x176')&&_0x4fc1c8!==_0xbf4e('0x177')&&_0x4fc1c8!=='updatedAt'){_0x41de24[util[_0xbf4e('0x71')](_0xbf4e('0x178'),_0xbf4e('0x179'),_['toUpper'](_0x4fc1c8))]=_0x1564be[_0xbf4e('0x160')][_0x4fc1c8];}}}var _0x2f56b2=_0x4fb90d[_0xbf4e('0x131')](_0x453348[_0xbf4e('0x6e')])?getCallerId(_0x453348['Trunk'][_0xbf4e('0x70')],_0x453348['dialOriginateCallerIdName'],_0x453348['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x453348[_0xbf4e('0x59')],_0x453348[_0xbf4e('0x17a')]):_0x453348[_0xbf4e('0x59')]):getCallerId(_[_0xbf4e('0xa4')](_0x453348[_0xbf4e('0x132')])?_0x453348[_0xbf4e('0x6e')][_0xbf4e('0x70')]:_0x453348[_0xbf4e('0x132')][_0xbf4e('0x70')],_0x453348['dialOriginateCallerIdName'],_0x453348[_0xbf4e('0x17a')]>0x0?getCallerIdRandom(_0x453348[_0xbf4e('0x59')],_0x453348[_0xbf4e('0x17a')]):_0x453348[_0xbf4e('0x59')]);if(_0x2f56b2){_0x41de24[_0xbf4e('0x17b')]=_0x4fb90d['actions'][_0x162565][_0xbf4e('0x17c')]=extractCalleridName(_0x2f56b2);_0x41de24['XMD-ORIGINATECALLERIDNUM']=_0x4fb90d[_0xbf4e('0x1d')][_0x162565][_0xbf4e('0x17d')]=extractCalleridNumber(_0x2f56b2);}return ami[_0xbf4e('0xa5')]({'actionid':_0x162565,'action':'originate','channel':_0x4fb90d['isTrunkReachable'](_0x453348[_0xbf4e('0x6e')])?util['format']('SIP/%s/%s%s',_0x453348[_0xbf4e('0x6e')]['name'],isNotNull(_0x453348[_0xbf4e('0x17e')])?_0x453348[_0xbf4e('0x17e')][_0xbf4e('0x17f')]()||'':'',_0x453348[_0xbf4e('0x180')]>0x0?_0x1564be[_0xbf4e('0x160')][_0xbf4e('0x161')][_0xbf4e('0x181')](_0x453348[_0xbf4e('0x180')]):_0x1564be['Contact']['phone']):util[_0xbf4e('0x71')](_0xbf4e('0x182'),_[_0xbf4e('0xa4')](_0x453348[_0xbf4e('0x132')])?_0x453348[_0xbf4e('0x6e')][_0xbf4e('0x3c')]:_0x453348[_0xbf4e('0x132')][_0xbf4e('0x3c')],isNotNull(_0x453348[_0xbf4e('0x17e')])?_0x453348[_0xbf4e('0x17e')][_0xbf4e('0x17f')]()||'':'',_0x453348[_0xbf4e('0x180')]>0x0?_0x1564be[_0xbf4e('0x160')][_0xbf4e('0x161')]['substring'](_0x453348[_0xbf4e('0x180')]):_0x1564be[_0xbf4e('0x160')][_0xbf4e('0x161')]),'callerid':_0x2f56b2,'Exten':_0xbf4e('0xd5'),'Context':_0xbf4e('0x183'),'Priority':'1','variable':_0x41de24,'timeout':(_0x453348['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x162565})[_0xbf4e('0xae')](function(_0x1f9b39){return _0x51d7d3(_0x1f9b39);})['catch'](function(_0x3c9914){_0x453348['outboundOriginateFailureCallsDay']+=0x1;var _0x512145=new History(_0x4fb90d[_0xbf4e('0x1d')][_0x162565]);logger[_0xbf4e('0x8d')](util[_0xbf4e('0x71')]('[originateError]:\x20%s',JSON[_0xbf4e('0x44')](_0x3c9914)));_0x512145[_0xbf4e('0x9c')]=0xe;_0x512145['statedesc']=_0xbf4e('0x184');_0x512145['starttime']=moment()[_0xbf4e('0x71')](_0xbf4e('0xf7'));_0x512145[_0xbf4e('0x9e')]=_0x512145[_0xbf4e('0x9f')];_0x4fb90d[_0xbf4e('0xc2')](_0x512145)[_0xbf4e('0xa8')](loggerCatch('[originate][error]'));_0x4fb90d[_0xbf4e('0xc0')](_0x512145)[_0xbf4e('0xa8')](loggerCatch(_0xbf4e('0x185')))[_0xbf4e('0x12c')](function(){delete _0x4fb90d[_0xbf4e('0x1d')][_0x162565];return _0x4a0259(msgResponse(_0xbf4e('0x15f'),'Error','originate\x20action\x20Error'));});});});};Dialer['prototype'][_0xbf4e('0x2b')]=function(_0x1a0bf4){var _0x531951=this[_0xbf4e('0x1d')][_0x1a0bf4['actionid']];if(_0x531951){delete this[_0xbf4e('0x1d')][_0x1a0bf4[_0xbf4e('0x11a')]];_0x531951[_0xbf4e('0x10a')]=moment()[_0xbf4e('0x71')](_0xbf4e('0xf7'));var _0x107a3c=_0x531951[_0xbf4e('0x52')]===_0xbf4e('0x73')?this[_0xbf4e('0xac')][_0x531951[_0xbf4e('0xab')]]:this[_0xbf4e('0x1a')][_0x531951[_0xbf4e('0x186')]()];if(!this[_0xbf4e('0x187')](_0x1a0bf4[_0xbf4e('0x188')])){this[_0xbf4e('0xaa')](_0x107a3c);return this[_0xbf4e('0x189')](_0x531951,_0x107a3c,_0x1a0bf4)[_0xbf4e('0xa8')](loggerCatch('[callProgressDetecting]\x20'));}this[_0xbf4e('0x1f')][_0x1a0bf4[_0xbf4e('0xd8')]]=_0x531951;}};Dialer[_0xbf4e('0x16')][_0xbf4e('0x18a')]=function(_0x5a174d,_0x48d429,_0x483258){var _0x29b832=new History(_0x48d429);if(_0x29b832[_0xbf4e('0xf3')]+_0x29b832['countcongestionretry']+_0x29b832[_0xbf4e('0xe6')]+_0x29b832[_0xbf4e('0xf5')]+_0x29b832[_0xbf4e('0xf6')]+_0x29b832[_0xbf4e('0xe7')]+_0x29b832[_0xbf4e('0xe2')]+_0x29b832['countagentrejectretry']>=_0x483258[_0xbf4e('0xe9')]-0x1){return!![];}switch(_0x5a174d){case 0x3:if(_0x29b832[_0xbf4e('0xe6')]>=_0x483258[_0xbf4e('0x18b')]-0x1){return!![];}this[_0xbf4e('0xb5')]({'active':![],'countnoanswerretry':_0x29b832[_0xbf4e('0xe6')]+=0x1,'scheduledat':moment()[_0xbf4e('0xee')](_0x483258[_0xbf4e('0x18c')],_0xbf4e('0xf0'))[_0xbf4e('0x71')](_0xbf4e('0xf7')),'ContactId':_0x29b832['ContactId'],'ListId':_0x29b832[_0xbf4e('0xca')],'VoiceQueueId':_0x29b832[_0xbf4e('0xf1')]||undefined,'CampaignId':_0x29b832['CampaignId']||undefined})[_0xbf4e('0xa8')](loggerCatch(_0xbf4e('0x18d')));break;case 0x5:if(_0x29b832[_0xbf4e('0xf3')]>=_0x483258[_0xbf4e('0x18e')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x29b832[_0xbf4e('0xf3')]+=0x1,'scheduledat':moment()[_0xbf4e('0xee')](_0x483258[_0xbf4e('0x18f')],_0xbf4e('0xf0'))[_0xbf4e('0x71')](_0xbf4e('0xf7')),'ContactId':_0x29b832[_0xbf4e('0xc9')],'ListId':_0x29b832[_0xbf4e('0xca')],'VoiceQueueId':_0x29b832[_0xbf4e('0xf1')]||undefined,'CampaignId':_0x29b832[_0xbf4e('0xcb')]||undefined})['catch'](loggerCatch(_0xbf4e('0x190')));break;case 0x8:if(_0x29b832[_0xbf4e('0xf4')]>=_0x483258[_0xbf4e('0x191')]-0x1){return!![];}this[_0xbf4e('0xb5')]({'active':![],'countcongestionretry':_0x29b832[_0xbf4e('0xf4')]+=0x1,'scheduledat':moment()[_0xbf4e('0xee')](_0x483258[_0xbf4e('0x192')],_0xbf4e('0xf0'))[_0xbf4e('0x71')](_0xbf4e('0xf7')),'ContactId':_0x29b832[_0xbf4e('0xc9')],'ListId':_0x29b832[_0xbf4e('0xca')],'VoiceQueueId':_0x29b832[_0xbf4e('0xf1')]||undefined,'CampaignId':_0x29b832[_0xbf4e('0xcb')]||undefined})[_0xbf4e('0xa8')](loggerCatch(_0xbf4e('0x193')));break;case 0x0:if(_0x29b832[_0xbf4e('0xf5')]>=_0x483258['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x29b832['countnosuchnumberretry']+=0x1,'scheduledat':moment()['add'](_0x483258[_0xbf4e('0x194')],'minutes')['format'](_0xbf4e('0xf7')),'ContactId':_0x29b832['ContactId'],'ListId':_0x29b832[_0xbf4e('0xca')],'VoiceQueueId':_0x29b832[_0xbf4e('0xf1')]||undefined,'CampaignId':_0x29b832['CampaignId']||undefined})[_0xbf4e('0xa8')](loggerCatch(_0xbf4e('0x195')));}break;case 0xa:if(_0x29b832[_0xbf4e('0xf6')]>=_0x483258[_0xbf4e('0x10f')]-0x1){return!![];}this[_0xbf4e('0xb5')]({'active':![],'countdropretry':_0x29b832[_0xbf4e('0xf6')]+=0x1,'scheduledat':moment()['add'](_0x483258[_0xbf4e('0x110')],_0xbf4e('0xf0'))[_0xbf4e('0x71')](_0xbf4e('0xf7')),'ContactId':_0x29b832[_0xbf4e('0xc9')],'ListId':_0x29b832[_0xbf4e('0xca')],'VoiceQueueId':_0x29b832[_0xbf4e('0xf1')]||undefined,'CampaignId':_0x29b832[_0xbf4e('0xcb')]||undefined})[_0xbf4e('0xa8')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x29b832['countabandonedretry']>=_0x483258[_0xbf4e('0x117')]-0x1){return!![];}this[_0xbf4e('0xb5')]({'active':![],'countabandonedretry':_0x29b832[_0xbf4e('0xe7')]+=0x1,'scheduledat':moment()[_0xbf4e('0xee')](_0x483258[_0xbf4e('0x196')],'minutes')[_0xbf4e('0x71')](_0xbf4e('0xf7')),'ContactId':_0x29b832[_0xbf4e('0xc9')],'ListId':_0x29b832[_0xbf4e('0xca')],'VoiceQueueId':_0x29b832['VoiceQueueId']||undefined,'CampaignId':_0x29b832['CampaignId']||undefined})[_0xbf4e('0xa8')](loggerCatch(_0xbf4e('0x118')));break;case 0x13:if(_0x29b832[_0xbf4e('0xe2')]>=_0x483258['dialMachineMaxRetry']-0x1){return!![];}this[_0xbf4e('0xb5')]({'active':![],'countmachineretry':_0x29b832[_0xbf4e('0xe2')]+=0x1,'scheduledat':moment()[_0xbf4e('0xee')](_0x483258['dialMachineRetryFrequency'],_0xbf4e('0xf0'))[_0xbf4e('0x71')](_0xbf4e('0xf7')),'ContactId':_0x29b832[_0xbf4e('0xc9')],'ListId':_0x29b832[_0xbf4e('0xca')],'VoiceQueueId':_0x29b832[_0xbf4e('0xf1')]||undefined,'CampaignId':_0x29b832['CampaignId']||undefined})[_0xbf4e('0xa8')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x29b832[_0xbf4e('0xe8')]>=_0x483258[_0xbf4e('0x197')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x29b832[_0xbf4e('0xe8')]+=0x1,'scheduledat':moment()['add'](_0x483258[_0xbf4e('0x198')],'minutes')[_0xbf4e('0x71')](_0xbf4e('0xf7')),'ContactId':_0x29b832['ContactId'],'ListId':_0x29b832['ListId'],'VoiceQueueId':_0x29b832[_0xbf4e('0xf1')]||undefined,'CampaignId':_0x29b832[_0xbf4e('0xcb')]||undefined})[_0xbf4e('0xa8')](loggerCatch(_0xbf4e('0x199')));break;default:return!![];}};Dialer[_0xbf4e('0x16')][_0xbf4e('0x189')]=function(_0x289a10,_0x451729,_0x4704f1){var _0x2aa2d9=this;var _0xbf141b=new History(_0x289a10);return new BPromise(function(_0x4dfe49,_0x10aaec){if(_[_0xbf4e('0x39')](_0x451729)&&typeof _0x451729!==_0xbf4e('0x15e')){return _0x10aaec(msgResponse('[callProgressDetecting]','Failure',_0xbf4e('0x19a')));}if(_[_0xbf4e('0x39')](_0x4704f1)&&typeof _0x4704f1!==_0xbf4e('0x15e')){return _0x10aaec(msgResponse(_0xbf4e('0x19b'),_0xbf4e('0x136'),_0xbf4e('0x19c')));}switch(_0x4704f1[_0xbf4e('0x19d')]){case'0':_0x451729[_0xbf4e('0x61')]+=0x1;_0xbf141b['state']=0x0;_0xbf141b[_0xbf4e('0x9d')]='NoSuchNumber';_0xbf141b[_0xbf4e('0xf5')]+=0x1;_0xbf141b['countglobal']+=0x1;ami[_0xbf4e('0x48')](_0xbf4e('0x19e'),ut[_0xbf4e('0xdb')](_0x289a10,_0xbf4e('0x19f')));_0x2aa2d9[_0xbf4e('0xc2')](_0xbf141b)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x2aa2d9[_0xbf4e('0x18a')](0x0,_0x289a10,_0x451729)){if(_0xbf141b['countnosuchnumberretry']>=_0x451729[_0xbf4e('0x1a0')]){_0x2aa2d9[_0xbf4e('0x1a1')](_0xbf141b,_0x4dfe49,_0x10aaec,_0xbf4e('0x1a2'));}else{_0x2aa2d9[_0xbf4e('0xea')](_0xbf141b,_0x4dfe49,_0x10aaec,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x451729['outboundNoAnswerCallsDay']+=0x1;_0xbf141b[_0xbf4e('0x9c')]=0x3;_0xbf141b[_0xbf4e('0x9d')]='NoAnswer';_0xbf141b['countnoanswerretry']+=0x1;_0xbf141b[_0xbf4e('0xe3')]+=0x1;ami['emit'](_0xbf4e('0x1a3'),ut[_0xbf4e('0xdb')](_0x289a10,_0xbf4e('0x1a4')));_0x2aa2d9[_0xbf4e('0xc2')](_0xbf141b)[_0xbf4e('0xa8')](loggerCatch(_0xbf4e('0x1a5')));if(_0x2aa2d9[_0xbf4e('0x18a')](0x3,_0x289a10,_0x451729)){if(_0xbf141b['countnoanswerretry']>=_0x451729[_0xbf4e('0x18b')]){_0x2aa2d9['createStateFinal'](_0xbf141b,_0x4dfe49,_0x10aaec,'reason\x203\x20ringing\x20no\x20answer');}else{_0x2aa2d9[_0xbf4e('0xea')](_0xbf141b,_0x4dfe49,_0x10aaec,_0xbf4e('0x1a6'));}}break;case'5':_0x451729[_0xbf4e('0x1a7')]+=0x1;_0xbf141b[_0xbf4e('0x9c')]=0x5;_0xbf141b[_0xbf4e('0x9d')]=_0xbf4e('0x1a8');_0xbf141b['countbusyretry']+=0x1;_0xbf141b['countglobal']+=0x1;ami[_0xbf4e('0x48')](_0xbf4e('0x1a9'),ut['buildObj'](_0x289a10,_0xbf4e('0x1aa')));_0x2aa2d9[_0xbf4e('0xc2')](_0xbf141b)[_0xbf4e('0xa8')](loggerCatch(_0xbf4e('0x1ab')));if(_0x2aa2d9[_0xbf4e('0x18a')](0x5,_0x289a10,_0x451729)){if(_0xbf141b[_0xbf4e('0xf3')]>=_0x451729[_0xbf4e('0x18e')]){_0x2aa2d9[_0xbf4e('0x1a1')](_0xbf141b,_0x4dfe49,_0x10aaec,_0xbf4e('0x1ac'));}else{_0x2aa2d9[_0xbf4e('0xea')](_0xbf141b,_0x4dfe49,_0x10aaec,_0xbf4e('0x1ac'));}}break;case'8':_0x451729[_0xbf4e('0x5c')]+=0x1;_0xbf141b[_0xbf4e('0x9c')]=0x8;_0xbf141b[_0xbf4e('0x9d')]=_0xbf4e('0x1ad');_0xbf141b[_0xbf4e('0xf4')]+=0x1;_0xbf141b[_0xbf4e('0xe3')]+=0x1;ami['emit'](_0xbf4e('0x1ae'),ut[_0xbf4e('0xdb')](_0x289a10,_0xbf4e('0x1af')));_0x2aa2d9[_0xbf4e('0xc2')](_0xbf141b)[_0xbf4e('0xa8')](loggerCatch(_0xbf4e('0x1b0')));if(_0x2aa2d9[_0xbf4e('0x18a')](0x8,_0x289a10,_0x451729)){if(_0xbf141b['countcongestionretry']>=_0x451729['dialCongestionMaxRetry']){_0x2aa2d9[_0xbf4e('0x1a1')](_0xbf141b,_0x4dfe49,_0x10aaec,_0xbf4e('0x1b1'));}else{_0x2aa2d9['stateGlobal'](_0xbf141b,_0x4dfe49,_0x10aaec,'reason\x208\x20congestion');}}break;case'11':_0x451729['outboundAbandonedCallsDay']+=0x1;_0xbf141b[_0xbf4e('0x9c')]=0xb;_0xbf141b['statedesc']=_0xbf4e('0x115');_0xbf141b[_0xbf4e('0xe7')]+=0x1;_0xbf141b['countglobal']+=0x1;_0x2aa2d9[_0xbf4e('0xc2')](_0xbf141b)['catch'](loggerCatch(_0xbf4e('0x119')));if(_0x2aa2d9[_0xbf4e('0x18a')](0xb,_0x289a10,_0x451729)){if(_0xbf141b[_0xbf4e('0xe7')]>=_0x451729['dialAbandonedMaxRetry']){_0x2aa2d9['createStateFinal'](_0xbf141b,_0x4dfe49,_0x10aaec,'reason\x2011\x20abandoned');}else{_0x2aa2d9['stateGlobal'](_0xbf141b,_0x4dfe49,_0x10aaec,_0xbf4e('0x1b2'));}}break;case'20':_0x451729[_0xbf4e('0x63')]+=0x1;_0xbf141b[_0xbf4e('0x9c')]=0x14;_0xbf141b['statedesc']='AgentReject';_0xbf141b[_0xbf4e('0xe8')]+=0x1;_0xbf141b[_0xbf4e('0xe3')]+=0x1;ami['emit'](_0xbf4e('0x1b3'),ut[_0xbf4e('0xdb')](_0x289a10,_0xbf4e('0x1b4')));_0x2aa2d9[_0xbf4e('0xc2')](_0xbf141b)[_0xbf4e('0xa8')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x2aa2d9['checkRetriveMax'](0x14,_0x289a10,_0x451729)){if(_0xbf141b[_0xbf4e('0xe8')]>=_0x451729[_0xbf4e('0x197')]){_0x2aa2d9[_0xbf4e('0x1a1')](_0xbf141b,_0x4dfe49,_0x10aaec,_0xbf4e('0x1b5'));}else{_0x2aa2d9[_0xbf4e('0xea')](_0xbf141b,_0x4dfe49,_0x10aaec,_0xbf4e('0x1b5'));}}break;default:_0x451729[_0xbf4e('0xfd')]+=0x1;_0xbf141b[_0xbf4e('0x9c')]=0xc;_0xbf141b[_0xbf4e('0x9d')]=_0x4704f1[_0xbf4e('0x19d')];_0x2aa2d9[_0xbf4e('0xc2')](_0xbf141b)[_0xbf4e('0xa8')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x2aa2d9[_0xbf4e('0x18a')](_0x4704f1['reason'],_0x289a10,_0x451729)){if(_0xbf141b[_0xbf4e('0xf3')]+_0xbf141b['countcongestionretry']+_0xbf141b[_0xbf4e('0xe6')]+_0xbf141b[_0xbf4e('0xf5')]+_0xbf141b[_0xbf4e('0xf6')]+_0xbf141b[_0xbf4e('0xe7')]+_0xbf141b[_0xbf4e('0xe2')]+_0xbf141b[_0xbf4e('0xe8')]>=_0x451729[_0xbf4e('0xe9')]){_0x2aa2d9[_0xbf4e('0xea')](_0xbf141b,_0x4dfe49,_0x10aaec,_0x4704f1['reason']);}else{_0x2aa2d9[_0xbf4e('0x1a1')](_0xbf141b,_0x4dfe49,_0x10aaec,_0x4704f1[_0xbf4e('0x19d')]);}}}});};Dialer['prototype'][_0xbf4e('0xea')]=function(_0x2857b2,_0x418799,_0x1fb898,_0x53551a){var _0x117f38=new Final(_0x2857b2);_0x117f38['state']=0xf;_0x117f38[_0xbf4e('0x9d')]=_0xbf4e('0x1b6');this[_0xbf4e('0x1a1')](_0x117f38,_0x418799,_0x1fb898,_0x53551a);};Dialer[_0xbf4e('0x16')][_0xbf4e('0x1a1')]=function(_0x1070c3,_0x379ad5,_0x10b199,_0x478c2d){this[_0xbf4e('0xc0')](_0x1070c3)[_0xbf4e('0xae')](function(){return _0x379ad5(msgResponse('[callProgressDetecting]',_0xbf4e('0xce'),_0x478c2d));})[_0xbf4e('0xa8')](function(){return _0x10b199(msgResponse(_0xbf4e('0x1b7'),_0xbf4e('0x136'),'contact\x20not\x20moved'));});};Dialer[_0xbf4e('0x16')][_0xbf4e('0x6')]=function(_0x530703){var _0x4f8f62=_0x530703[_0xbf4e('0x1b8')]/0x64;var _0xedd921=_0x530703[_0xbf4e('0x5f')]/(_0x530703[_0xbf4e('0x5f')]+_0x530703[_0xbf4e('0x5b')]);var _0x44c7ab=Math[_0xbf4e('0x1b9')](_0x530703[_0xbf4e('0x68')]*(_0x530703[_0xbf4e('0x1ba')]/0x64));var _0x2ae38c=Math[_0xbf4e('0x1b9')](_0x530703['predictiveIntervalAvailable']*(_0x530703['predictiveIntervalMinThreshold']/0x64));var _0x3f2b0a=_0x530703[_0xbf4e('0x4c')]+_0x530703[_0xbf4e('0x96')];var _0x3c93be=Math[_0xbf4e('0x1bb')](_0x530703[_0xbf4e('0x1bc')]*_0x530703[_0xbf4e('0x6c')]*_0x530703[_0xbf4e('0x1bd')]*_0x530703['predictiveIntervalMultiplicativeFactor']);if(_[_0xbf4e('0x39')](_0x530703[_0xbf4e('0x22')])){if(!_['isUndefined'](_0x530703[_0xbf4e('0x21')])){_0x530703[_0xbf4e('0x21')]=undefined;loggerPredictive[_0xbf4e('0x8d')]('[startMethodPredictive][StartProgressive]',_0xbf4e('0x1be'));}if(!_[_0xbf4e('0x39')](_0x530703['handlePredictive'])){loggerPredictive[_0xbf4e('0x8d')]('[startMethodPredictive][StartProgressive]',_0xbf4e('0x1bf'));clearInterval(_0x530703['handlePredictive']);_0x530703[_0xbf4e('0x88')]=undefined;}_0x530703['startProgressive']=moment()[_0xbf4e('0x71')](_0xbf4e('0xf7'));loggerPredictive[_0xbf4e('0x76')](_0x530703[_0xbf4e('0x3c')],_0xbf4e('0x1c0'),_0x530703[_0xbf4e('0x22')]);this[_0xbf4e('0x14e')](_0x530703,0x1);}else if(ifInterval(_0x530703[_0xbf4e('0x1c1')],_0x530703[_0xbf4e('0x22')])){this[_0xbf4e('0x14e')](_0x530703,0x1);loggerPredictiveCalls[_0xbf4e('0x76')]('[startMethodPredictive][StartProgressive][Loop]',_0x530703[_0xbf4e('0x22')],_0x530703['name']);_0x530703[_0xbf4e('0x1bc')]=0x0;_0x530703[_0xbf4e('0x66')]=0x0;}else if(_0x4f8f62<_0xedd921&&_0x530703['dialPredictiveOptimization']===_0xbf4e('0x1c2')){freeVariablesPredictive(_0x530703);loggerPredictive[_0xbf4e('0x76')](_0xbf4e('0x1c3'),'Dropped\x20calls\x20day',_0xedd921,'startProgressive',_0x530703[_0xbf4e('0x3c')]);}else if(_0x3c93be<_0x530703['predictiveIntervalErlangCallsDroppedCalls']&&_0x530703[_0xbf4e('0x1c4')]===_0xbf4e('0x1c2')){freeVariablesPredictive(_0x530703);loggerPredictive[_0xbf4e('0x76')](_0xbf4e('0x1c5'),_0xbf4e('0x1c6'),_0x3c93be,_0xbf4e('0x1c7'),_0x530703[_0xbf4e('0x66')],'startProgressive',_0x530703['name']);}else if(!ifInterval(_0x530703[_0xbf4e('0x1c1')],_0x530703[_0xbf4e('0x22')])&&_[_0xbf4e('0x39')](_0x530703[_0xbf4e('0x21')])&&!_[_0xbf4e('0x39')](_0x530703[_0xbf4e('0x22')])){_0x530703[_0xbf4e('0x21')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xbf4e('0x76')](_0x530703[_0xbf4e('0x3c')],_0xbf4e('0x1c8'),_0x530703[_0xbf4e('0x21')]);this[_0xbf4e('0x1c9')](_0x530703[_0xbf4e('0x1c1')])[_0xbf4e('0xae')](this[_0xbf4e('0x1ca')](_0x530703))[_0xbf4e('0xae')](mergeDataErlangB(_0x530703))[_0xbf4e('0xae')](this[_0xbf4e('0x1cb')](_0x530703))[_0xbf4e('0xa8')](loggerCatchPredictive(_0xbf4e('0x1cc'),_0x530703));}else if(!ifInterval(_0x530703[_0xbf4e('0x1c1')],_0x530703[_0xbf4e('0x21')])){_0x530703[_0xbf4e('0x66')]=0x0;_0x530703[_0xbf4e('0x21')]=moment()[_0xbf4e('0x71')](_0xbf4e('0xf7'));loggerPredictive[_0xbf4e('0x76')](_0x530703[_0xbf4e('0x3c')],_0xbf4e('0x1cd'),_0x530703[_0xbf4e('0x21')]);clearInterval(_0x530703[_0xbf4e('0x88')]);_0x530703[_0xbf4e('0x88')]=undefined;this[_0xbf4e('0x1c9')](_0x530703['dialPredictiveInterval'])[_0xbf4e('0xae')](this['getDataPredictive'](_0x530703))[_0xbf4e('0xae')](mergeDataErlangB(_0x530703))['then'](this[_0xbf4e('0x1cb')](_0x530703))[_0xbf4e('0xa8')](loggerCatchPredictive(_0xbf4e('0x1ce'),_0x530703));}else if(_0x530703[_0xbf4e('0x68')]&&_0x3f2b0a<_0x530703['predictiveIntervalAvailable']-_0x2ae38c){freeVariablesPredictive(_0x530703);loggerPredictive[_0xbf4e('0x76')](_0x530703[_0xbf4e('0x3c')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x3f2b0a,_0xbf4e('0x1cf'),_0x530703['predictiveIntervalAvailable'],'-',_0x2ae38c,'=',_0x530703[_0xbf4e('0x68')]-_0x2ae38c,')');}else if(_0x530703['predictiveIntervalAvailable']&&_0x3f2b0a>_0x530703[_0xbf4e('0x68')]+_0x44c7ab){freeVariablesPredictive(_0x530703);loggerPredictive[_0xbf4e('0x76')](_0x530703['name'],_0xbf4e('0x1d0'),_0x3f2b0a,_0xbf4e('0x1d1'),_0x530703[_0xbf4e('0x68')],'+',_0x44c7ab,'=',_0x530703[_0xbf4e('0x68')]+_0x44c7ab,')');}};Dialer[_0xbf4e('0x16')]['getDataPredictive']=function(_0x21d9ef){var _0x3b64b2=this;return function(_0x25a49a){return new BPromise(function(_0x4bd22f,_0x1a7538){_[_0xbf4e('0x85')](_0x21d9ef,_0x25a49a[0x0]);if(checkGetDataPredictive(_0x25a49a[0x0])){var _0x2ca433=_0x21d9ef[_0xbf4e('0x68')]=_0x21d9ef['talking']+_0x21d9ef[_0xbf4e('0x4c')];var _0x5d7be7=_0x21d9ef[_0xbf4e('0x1c1')]*0x3c;var _0x443e7e=_0x25a49a[0x0][_0xbf4e('0x7f')]+_0x25a49a[0x0][_0xbf4e('0x7d')];var _0x5d08f6=(_0x25a49a[0x0][_0xbf4e('0x79')]+_0x25a49a[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x25a49a[0x0][_0xbf4e('0x64')])/_0x25a49a[0x0][_0xbf4e('0x69')];_0x21d9ef['predictiveIntervalHitRate']=_0x5d08f6>0x0?_0x5d08f6:0x1;switch(_0x21d9ef[_0xbf4e('0x1c4')]){case _0xbf4e('0x1c2'):var _0x5cb5ea=_0x21d9ef[_0xbf4e('0x1b8')]/0x64;return _0x3b64b2[_0xbf4e('0x1d2')](_0x2ca433,_0x5d7be7,_0x443e7e,_0x5d08f6,_0x5cb5ea)[_0xbf4e('0xae')](function(_0x596bd1){return _0x4bd22f(_0x596bd1);});case _0xbf4e('0x1d3'):var _0x24d78c=_0x21d9ef['dialPredictiveOptimizationPercentage']/0x64;return _0x3b64b2[_0xbf4e('0x1d4')](_0x2ca433,_0x5d7be7,_0x443e7e,_0x5d08f6,_0x24d78c)['then'](function(_0x3b2198){return _0x4bd22f(_0x3b2198);});default:return _0x1a7538(msgResponse('[getDataPredictive]','Failure',_0xbf4e('0x1d5')));}}else{return _0x1a7538(msgResponse(_0xbf4e('0x1d6'),'Failure',_0xbf4e('0x1d7')));}});};};Dialer['prototype']['getDataPredictiveOld']=function(_0x5702ee){var _0x78925=this;return function(_0x333f77){return new BPromise(function(_0x2286ff,_0x219530){_[_0xbf4e('0x85')](_0x5702ee,_0x333f77[0x0]);if(checkGetDataPredictive(_0x333f77[0x0])){loggerPredictive[_0xbf4e('0x76')](JSON[_0xbf4e('0x44')](_0x333f77[0x0]));if(_0x5702ee['dialPredictiveOptimization']===_0xbf4e('0x1c2')){return _0x78925['getVoiceQueueRtPauses'](_0x5702ee['id'])[_0xbf4e('0xae')](function(_0x1e82d3){var _0x388217=_0x5702ee[_0xbf4e('0x1d8')]-_0x1e82d3[0x0][_0xbf4e('0x1d9')];var _0x4c8dda=_0x5702ee[_0xbf4e('0x1c1')]*0x3c;var _0x16b46d=_0x333f77[0x0][_0xbf4e('0x7f')]+_0x333f77[0x0][_0xbf4e('0x7d')];var _0x2b7fdd=(_0x333f77[0x0][_0xbf4e('0x79')]+_0x333f77[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x333f77[0x0][_0xbf4e('0x64')])/_0x333f77[0x0]['predictiveIntervalTotalCalls'];var _0x423c39=_0x5702ee[_0xbf4e('0x1b8')]/0x64;_0x5702ee[_0xbf4e('0x67')]=_0x1e82d3[0x0][_0xbf4e('0x1d9')]||0x0;_0x5702ee['predictiveIntervalHitRate']=_0x2b7fdd>0x0?_0x2b7fdd:0x1;return _0x78925[_0xbf4e('0x1d2')](_0x388217,_0x4c8dda,_0x16b46d,_0x2b7fdd,_0x423c39);})[_0xbf4e('0xae')](function(_0x3c4a61){return _0x2286ff(_0x3c4a61);})[_0xbf4e('0xa8')](function(_0x5ed2b3){return _0x219530(msgResponse(_0xbf4e('0x1da'),_0xbf4e('0x136'),JSON[_0xbf4e('0x44')](_0x5ed2b3)));});}if(_0x5702ee['dialPredictiveOptimization']==='agentBusyFactor'){return _0x78925[_0xbf4e('0xbe')](_0x5702ee['id'])[_0xbf4e('0xae')](function(_0x25cbef){var _0x23e5a4=_0x5702ee[_0xbf4e('0x1d8')]-_0x25cbef[0x0]['outboundQueuePauses'];var _0x14ea1a=_0x5702ee['dialPredictiveInterval']*0x3c;var _0x3f9deb=_0x333f77[0x0][_0xbf4e('0x7f')]+_0x333f77[0x0][_0xbf4e('0x7d')];var _0x4c7ac6=(_0x333f77[0x0][_0xbf4e('0x79')]+_0x333f77[0x0][_0xbf4e('0x7b')]+_0x333f77[0x0][_0xbf4e('0x64')])/_0x333f77[0x0][_0xbf4e('0x69')];var _0x1acd06=_0x5702ee[_0xbf4e('0x1b8')]/0x64;_0x5702ee[_0xbf4e('0x67')]=_0x25cbef[0x0][_0xbf4e('0x1d9')]||0x0;_0x5702ee[_0xbf4e('0x1bd')]=_0x4c7ac6>0x0?_0x4c7ac6:0x1;return _0x78925[_0xbf4e('0x1d4')](_0x23e5a4,_0x14ea1a,_0x3f9deb,_0x4c7ac6,_0x1acd06);})[_0xbf4e('0xae')](function(_0x2b30f1){return _0x2286ff(_0x2b30f1);})[_0xbf4e('0xa8')](function(_0x5085e0){return _0x219530(msgResponse('[CatchErlangB]',_0xbf4e('0x136'),JSON[_0xbf4e('0x44')](_0x5085e0)));});}}else{return _0x219530(msgResponse(_0xbf4e('0x1d6'),'Failure',_0xbf4e('0x1d7')));}});};};Dialer['prototype']['startMethodPredictive']=function(_0x4a8388){var _0x28b9db=this;return function(){var _0x2a15f9=0x0;var _0x9fa321=Math[_0xbf4e('0x1bb')](_0x4a8388[_0xbf4e('0x6b')]*0x3e8);if(_0x9fa321>0x0){_0x9fa321=_0x9fa321<0x64?0x64:_0x9fa321;loggerPredictive[_0xbf4e('0x76')](_0x4a8388[_0xbf4e('0x3c')],'one\x20call\x20every:',_0x9fa321,'milliseconds');_0x4a8388['handlePredictive']=setInterval(function(){_0x28b9db[_0xbf4e('0x88')](_0x4a8388);loggerPredictiveCalls['info'](_0xbf4e('0x1db'),_0x2a15f9+=0x1);},_0x9fa321);}else{loggerPredictive[_0xbf4e('0x76')](_0x4a8388[_0xbf4e('0x3c')],_0xbf4e('0x1dc'));}};};Dialer[_0xbf4e('0x16')][_0xbf4e('0x1dd')]=function(_0x437d1c,_0x51d779){var _0x5a709e=this;return function(_0x2f0375){if(_['isEmpty'](_0x2f0375)){if(_[_0xbf4e('0xa4')](_0x51d779[_0xbf4e('0x1de')])||!_0x51d779[_0xbf4e('0x1df')]){if(_0x437d1c[_0xbf4e('0x14c')]===_0xbf4e('0x5')){_0x437d1c[_0xbf4e('0x121')]=_[_0xbf4e('0x39')](_0x437d1c[_0xbf4e('0x121')])?!![]:_0x437d1c['queueStatusComplete'];var _0x353643=uuid['v4']();_0x5a709e['actions'][_0x353643]=new Action(_0x437d1c,_0x51d779,_0x353643);loggerBooked[_0xbf4e('0x76')](_0xbf4e('0x1e0'),_0x353643,_0xbf4e('0x1e1'),JSON[_0xbf4e('0x44')](_0x437d1c['queueStatusComplete']),_0xbf4e('0x1e2'),_0x437d1c[_0xbf4e('0x3c')]);if(_0x437d1c['queueStatusComplete']){_0x437d1c[_0xbf4e('0x121')]=![];_0x5a709e[_0xbf4e('0x24')][_0x5a709e['actions'][_0x353643][_0xbf4e('0xab')]]=[];ami[_0xbf4e('0xa5')]({'actionid':_0x353643,'action':_0xbf4e('0x1e3'),'queue':_0x437d1c['name']})[_0xbf4e('0xa8')](function(){_0x5a709e[_0xbf4e('0xaa')](_0x437d1c);_0x5a709e[_0xbf4e('0xb5')]({'active':![],'ContactId':_0x5a709e['actions'][_0x353643][_0xbf4e('0xc9')],'ListId':_0x5a709e[_0xbf4e('0x1d')][_0x353643][_0xbf4e('0xca')],'VoiceQueueId':_0x5a709e[_0xbf4e('0x1d')][_0x353643]['VoiceQueueId']||undefined,'CampaignId':_0x5a709e[_0xbf4e('0x1d')][_0x353643]['CampaignId']||undefined})[_0xbf4e('0xa8')](loggerCatch(_0xbf4e('0x1e4')));delete _0x5a709e[_0xbf4e('0x1d')][_0x353643];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON[_0xbf4e('0x44')](_0x437d1c['queueStatusComplete']),'Queue:\x20',_0x437d1c[_0xbf4e('0x3c')]);_0x5a709e[_0xbf4e('0xaa')](_0x437d1c);_0x5a709e['rescheduleContact']({'active':![],'ContactId':_0x5a709e[_0xbf4e('0x1d')][_0x353643]['ContactId'],'ListId':_0x5a709e['actions'][_0x353643][_0xbf4e('0xca')],'VoiceQueueId':_0x5a709e[_0xbf4e('0x1d')][_0x353643][_0xbf4e('0xf1')]||undefined,'CampaignId':_0x5a709e[_0xbf4e('0x1d')][_0x353643][_0xbf4e('0xcb')]||undefined})[_0xbf4e('0xa8')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x5a709e['actions'][_0x353643];}}else{return _0x5a709e[_0xbf4e('0x15d')](_0x437d1c,_0x51d779);}}else{if(getDiff(_0x51d779[_0xbf4e('0x1e5')])<_0x437d1c['dialRecallMeTimeout']*0x3c){if(_0x51d779[_0xbf4e('0x1e6')]&&!_0x51d779[_0xbf4e('0x1e6')]['voicePause']){_0x5a709e[_0xbf4e('0x19')][_0xbf4e('0x124')](_0x51d779['id'])[_0xbf4e('0x12c')](function(){_0x5a709e[_0xbf4e('0xaa')](_0x437d1c);});}else{_0x5a709e[_0xbf4e('0xb7')]({'active':![]},_0x51d779['id'],0x1)[_0xbf4e('0x12c')](function(){_0x5a709e[_0xbf4e('0xaa')](_0x437d1c);});}}else{_0x437d1c[_0xbf4e('0x62')]+=0x1;_0x5a709e[_0xbf4e('0xaa')](_0x437d1c);if(_0x437d1c[_0xbf4e('0x1e7')]){_0x5a709e[_0xbf4e('0xb5')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x51d779[_0xbf4e('0xc9')],'ListId':_0x51d779['ListId'],'VoiceQueueId':_0x51d779[_0xbf4e('0xf1')]||undefined,'CampaignId':_0x51d779[_0xbf4e('0xcb')]||undefined})[_0xbf4e('0xa8')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x5a709e[_0xbf4e('0xc2')](createObjHistory(_0x437d1c,_0x51d779,_0xbf4e('0x1e8'),0x17,'RecallInQueue'))['catch'](loggerCatch(_0xbf4e('0x1e9')));}else{_0x5a709e[_0xbf4e('0xc7')](createObjHistory(_0x437d1c,_0x51d779,_0xbf4e('0x1ea'),0x16,_0xbf4e('0x1eb')),_0xbf4e('0x1ec'),_0xbf4e('0x1ed'));}}}}else{_0x437d1c[_0xbf4e('0x1ee')]+=0x1;_0x5a709e[_0xbf4e('0xc7')](createObjHistory(_0x437d1c,_0x51d779,_0xbf4e('0x1ef'),0xd,'Blacklist'),_0xbf4e('0x1f0'),'[Originate][MoveBlacklist]');throw'inBlackList';}};};Dialer[_0xbf4e('0x16')][_0xbf4e('0x1f1')]=function(_0x35ae70){var _0x5efff8=this;var _0x5ec006=_0x35ae70[_0xbf4e('0x1f2')]-_0x35ae70[_0xbf4e('0x6a')]-_0x35ae70['temp'];emitCampaignSummary(_0x35ae70);if(_0x5ec006>0x0){if(_0x5ec006>this[_0xbf4e('0x1c')]){_0x5ec006=this[_0xbf4e('0x1c')];}_0x35ae70[_0xbf4e('0xba')]+=_0x5ec006;this[_0xbf4e('0xbc')](_0x35ae70['id'],_0x5ec006,_0x35ae70[_0xbf4e('0x1f3')],_0x35ae70)[_0xbf4e('0xae')](function(_0x18a611){_0x35ae70['temp']-=_0x5ec006;_0x35ae70[_0xbf4e('0xba')]=_0x35ae70['temp']>0x0?_0x35ae70[_0xbf4e('0xba')]:0x0;if(!checkContactEmpty(_0x18a611)){_0x35ae70[_0xbf4e('0x3a')]=_0xbf4e('0x1f4');logger[_0xbf4e('0x76')]('[getContactCampaign2][Empty]'+_0x35ae70[_0xbf4e('0x3c')]);}else{_0x35ae70[_0xbf4e('0x6a')]+=_0x18a611[_0xbf4e('0x13d')];_0x35ae70['message']='RUNNING';for(var _0x50ecd6=0x0;_0x50ecd6<_0x18a611[_0xbf4e('0x13d')];_0x50ecd6+=0x1){_0x35ae70[_0xbf4e('0x1f5')]+=0x1;if(_[_0xbf4e('0xa4')](_0x18a611[_0x50ecd6])||_[_0xbf4e('0xa4')](_0x18a611[_0x50ecd6][_0xbf4e('0x160')])||_[_0xbf4e('0xa4')](_0x18a611[_0x50ecd6][_0xbf4e('0x160')][_0xbf4e('0x161')])){_0x5efff8[_0xbf4e('0xc5')](_0xbf4e('0x1f6'),_0x35ae70,_0x18a611[_0x50ecd6]);}else{_0x5efff8[_0xbf4e('0xb1')](_['pick'](_0x18a611[_0x50ecd6],[_0xbf4e('0xcb'),_0xbf4e('0x1f7')]))[_0xbf4e('0xae')](_0x5efff8[_0xbf4e('0x1dd')](_0x35ae70,_0x18a611[_0x50ecd6]))['catch'](_0x5efff8['loggerHandler'](_0xbf4e('0x1f8'),_0x35ae70));}}}})['catch'](loggerGetContactDialer('[getContactCampaign2]',_0x35ae70,_0x5ec006));}};Dialer[_0xbf4e('0x16')]['handlePower']=function(_0x531299,_0x40fbb7){var _0x2afc4f=this;var _0x3efa9b=[];var _0x1f6d11=_0x40fbb7>=0x1?_0x40fbb7:0x1;if(_0x531299[_0xbf4e('0x14c')]===_0xbf4e('0x5')){_0x1f6d11=0x1;}var _0x25375a=Math[_0xbf4e('0x1bb')](_0x531299['available']*_0x1f6d11)-_0x531299[_0xbf4e('0x6a')]-_0x531299[_0xbf4e('0xba')];emitVoiceQueueSummary(_0x531299);if(_0x531299[_0xbf4e('0x1f9')]>0x0){var _0x386c67=_0x531299[_0xbf4e('0x1f9')]-_0x531299[_0xbf4e('0x6a')]-_0x531299[_0xbf4e('0x96')]-_0x531299[_0xbf4e('0xba')]-_0x531299[_0xbf4e('0x4d')];if(_0x25375a>_0x386c67){_0x25375a=_0x386c67;}}if(_0x25375a>0x0){if(_0x531299[_0xbf4e('0x14c')]===_0xbf4e('0x5')){_0x25375a=0x1;}if(_0x25375a>this[_0xbf4e('0x1c')]){_0x25375a=this[_0xbf4e('0x1c')];}_0x531299['temp']+=_0x25375a;for(var _0x37dd35 in this[_0xbf4e('0x11d')]){if(typeof this['agents'][_0x37dd35]!=='undefined'){if(this[_0xbf4e('0x11d')][_0x37dd35][_0xbf4e('0x9c')]==='not_inuse'&&this['agents'][_0x37dd35]['status']===_0xbf4e('0xd0')){_0x3efa9b[_0xbf4e('0x11f')](this['agents'][_0x37dd35]['id']);}}}this[_0xbf4e('0xb9')](_0x531299['id'],_0x3efa9b,_0x25375a,_0x531299[_0xbf4e('0x1f3')],_0x531299)['then'](function(_0x1cac10){_0x531299[_0xbf4e('0xba')]-=_0x25375a;_0x531299[_0xbf4e('0xba')]=_0x531299[_0xbf4e('0xba')]>0x0?_0x531299['temp']:0x0;if(!checkContactEmpty(_0x1cac10)){_0x2afc4f['countReScheduled'](_0x531299)[_0xbf4e('0xae')](sendMessageReschedule(_0x531299))[_0xbf4e('0xa8')](loggerCatch(_0xbf4e('0x1fa')));}else{_0x531299[_0xbf4e('0x6a')]+=_0x1cac10[_0xbf4e('0x13d')];_0x531299[_0xbf4e('0x3a')]=_0x531299['dialMethod']===_0xbf4e('0x5')?_0xbf4e('0x168'):_0xbf4e('0x1fb');for(var _0x28a3a1=0x0;_0x28a3a1<_0x1cac10[_0xbf4e('0x13d')];_0x28a3a1+=0x1){if(_[_0xbf4e('0xa4')](_0x1cac10[_0x28a3a1])||_[_0xbf4e('0xa4')](_0x1cac10[_0x28a3a1][_0xbf4e('0x160')])||_['isNil'](_0x1cac10[_0x28a3a1]['Contact'][_0xbf4e('0x161')])){_0x2afc4f['emptyContact'](_0xbf4e('0x1f6'),_0x531299,_0x1cac10[_0x28a3a1]);}else{_0x2afc4f[_0xbf4e('0xaf')](_[_0xbf4e('0xc8')](_0x1cac10[_0x28a3a1],[_0xbf4e('0xf1'),_0xbf4e('0x1f7')]))[_0xbf4e('0xae')](_0x2afc4f[_0xbf4e('0x1dd')](_0x531299,_0x1cac10[_0x28a3a1]))[_0xbf4e('0xa8')](_0x2afc4f[_0xbf4e('0xc4')](_0xbf4e('0x1f6'),_0x531299));}}}})[_0xbf4e('0xa8')](loggerGetContactDialer(_0xbf4e('0x1fc'),_0x531299,_0x25375a));}};Dialer[_0xbf4e('0x16')][_0xbf4e('0x88')]=function(_0x4fc3d5){if(_0x4fc3d5['dialLimitQueue']>0x0){var _0x4d79e4=_0x4fc3d5[_0xbf4e('0x1f9')]-_0x4fc3d5[_0xbf4e('0x6a')]-_0x4fc3d5[_0xbf4e('0x96')];if(_0x4d79e4>0x0){this['tryOriginatePredictive'](_0x4fc3d5);}else{loggerPredictiveCalls[_0xbf4e('0x76')](_0xbf4e('0x1fd'));}}else{this[_0xbf4e('0x1fe')](_0x4fc3d5);}};Dialer[_0xbf4e('0x16')][_0xbf4e('0x1fe')]=function(_0x30d853){var _0x8e16f2=this;var _0x5db666=[];_0x30d853[_0xbf4e('0x6a')]+=0x1;for(var _0x11c0c0 in this[_0xbf4e('0x11d')]){if(typeof this['agents'][_0x11c0c0]!==_0xbf4e('0x8f')){if(this[_0xbf4e('0x11d')][_0x11c0c0][_0xbf4e('0x9c')]===_0xbf4e('0x1ff')&&this[_0xbf4e('0x11d')][_0x11c0c0]['status']===_0xbf4e('0xd0')){_0x5db666[_0xbf4e('0x11f')](this['agents'][_0x11c0c0]['id']);}}}this[_0xbf4e('0xb9')](_0x30d853['id'],_0x5db666,0x1,_0x30d853[_0xbf4e('0x1f3')],_0x30d853)[_0xbf4e('0xae')](function(_0x3b6a4b){if(!checkContactEmpty(_0x3b6a4b)){checkContactLowerLimitOriginate(_0x30d853,0x1,0x0);_0x8e16f2[_0xbf4e('0xad')](_0x30d853)['then'](sendMessageReschedule(_0x30d853))[_0xbf4e('0xa8')](loggerCatch('[countReScheduled]\x20'));}else{_0x30d853['message']='RUNNING';if(_[_0xbf4e('0xa4')](_0x3b6a4b[0x0])||_[_0xbf4e('0xa4')](_0x3b6a4b[0x0][_0xbf4e('0x160')])||_[_0xbf4e('0xa4')](_0x3b6a4b[0x0][_0xbf4e('0x160')][_0xbf4e('0x161')])){_0x8e16f2[_0xbf4e('0xc5')](_0xbf4e('0x1f6'),_0x30d853,_0x3b6a4b[0x0]);}else{_0x8e16f2[_0xbf4e('0xaf')](_['pick'](_0x3b6a4b[0x0],['VoiceQueueId',_0xbf4e('0x1f7')]))['then'](_0x8e16f2[_0xbf4e('0x1dd')](_0x30d853,_0x3b6a4b[0x0]))[_0xbf4e('0xa8')](_0x8e16f2[_0xbf4e('0xc4')](_0xbf4e('0x200'),_0x30d853));}}})[_0xbf4e('0xa8')](loggerGetContactDialer(_0xbf4e('0x201'),_0x30d853,0x1));emitVoiceQueueSummary(_0x30d853);};Dialer[_0xbf4e('0x16')][_0xbf4e('0x1d2')]=function(_0x4f5f78,_0x1669b7,_0x400eb2,_0x472d38,_0x4bb7d0,_0x186391){loggerPredictive[_0xbf4e('0x76')](_0xbf4e('0x202'));loggerPredictive[_0xbf4e('0x76')](_0xbf4e('0x203'),_0x4f5f78);loggerPredictive[_0xbf4e('0x76')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1669b7);loggerPredictive[_0xbf4e('0x76')](_0xbf4e('0x204'),_0x400eb2);loggerPredictive[_0xbf4e('0x76')](_0xbf4e('0x205'),_0x472d38);loggerPredictive[_0xbf4e('0x76')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4bb7d0);loggerPredictive[_0xbf4e('0x76')](_0xbf4e('0x84'));return new BPromise(function(_0x1f36ac,_0x36845a){if(_0x4f5f78<=0x0||isNaN(_0x4f5f78)){return _0x36845a(msgResponse(_0xbf4e('0x206'),_0xbf4e('0x207'),_0xbf4e('0x208')+_0x4f5f78));}if(_0x400eb2<=0x0||isNaN(_0x400eb2)){return _0x36845a(msgResponse('[abandonmentRate]','Error',_0xbf4e('0x209')+_0x400eb2));}if(_0x472d38<=0x0||isNaN(_0x472d38)){return _0x36845a(msgResponse(_0xbf4e('0x206'),_0xbf4e('0x207'),'p\x20=\x20'+_0x472d38));}if(_0x1669b7<=0x0||isNaN(_0x1669b7)){return _0x36845a(msgResponse(_0xbf4e('0x206'),_0xbf4e('0x207'),_0xbf4e('0x20a')+_0x1669b7));}if(_0x4bb7d0<=0x0||isNaN(_0x4bb7d0)){return _0x36845a(msgResponse(_0xbf4e('0x206'),_0xbf4e('0x207'),_0xbf4e('0x20b')+_0x4bb7d0));}_0x186391=_0x186391||0x0;var _0x262f24=0x1/_0x400eb2;var _0x4948cb=0x0;var _0xa765d6=0x0;var _0x3f5253=0x0;var _0x509f38=0x0;for(var _0x116c42=0x0;_0x3f5253<_0x4bb7d0;_0x116c42+=0x1){_0xa765d6=_0x116c42/_0x1669b7;_0x4948cb=(_0x472d38*_0xa765d6+_0x186391)/_0x262f24;_0x3f5253=erlangb(_0x4948cb,_0x4f5f78);_0x509f38=_0x4948cb/_0x4f5f78*(0x1-erlangb(_0x4948cb,_0x4f5f78));}return _0x1f36ac({'erlangCalls':_0x116c42,'erlangCallToSecond':_0x1669b7/_0x116c42,'erlangAbandonmentRate':_0x3f5253,'erlangBusyFactor':_0x509f38});});};Dialer[_0xbf4e('0x16')][_0xbf4e('0x1d4')]=function(_0x1e06b5,_0xba5879,_0x5d7535,_0x9e3971,_0x420554,_0xaef200){loggerPredictive['info'](_0xbf4e('0x20c'));loggerPredictive[_0xbf4e('0x76')](_0xbf4e('0x203'),_0x1e06b5);loggerPredictive[_0xbf4e('0x76')](_0xbf4e('0x20d'),_0xba5879);loggerPredictive[_0xbf4e('0x76')](_0xbf4e('0x204'),_0x5d7535);loggerPredictive[_0xbf4e('0x76')](_0xbf4e('0x205'),_0x9e3971);loggerPredictive[_0xbf4e('0x76')](_0xbf4e('0x20e'),_0x420554);loggerPredictive[_0xbf4e('0x76')](_0xbf4e('0x84'));return new BPromise(function(_0x159e88,_0x2b500e){if(_0x1e06b5<=0x0||isNaN(_0x1e06b5)){return _0x2b500e(msgResponse(_0xbf4e('0x20f'),_0xbf4e('0x207'),_0xbf4e('0x208')+_0x1e06b5));}if(_0x5d7535<=0x0||isNaN(_0x5d7535)){return _0x2b500e(msgResponse(_0xbf4e('0x20f'),_0xbf4e('0x207'),'Ts\x20=\x20'+_0x5d7535));}if(_0x9e3971<=0x0||isNaN(_0x9e3971)){return _0x2b500e(msgResponse(_0xbf4e('0x20f'),'Error',_0xbf4e('0x210')+_0x9e3971));}if(_0xba5879<=0x0||isNaN(_0xba5879)){return _0x2b500e(msgResponse(_0xbf4e('0x20f'),_0xbf4e('0x207'),_0xbf4e('0x20a')+_0xba5879));}if(_0x420554<=0x0||isNaN(_0x420554)){return _0x2b500e(msgResponse(_0xbf4e('0x20f'),_0xbf4e('0x207'),_0xbf4e('0x211')+_0x420554));}_0xaef200=_0xaef200||0x0;var _0x23044d=0x1/_0x5d7535;var _0x7a9526=0x0;var _0x4dcbc9=0x0;var _0x2d8baa=0x0;var _0xd58426=0x0;for(var _0x41d381=0x0;_0xd58426<_0x420554;_0x41d381+=0x1){_0x4dcbc9=_0x41d381/_0xba5879;_0x7a9526=(_0x9e3971*_0x4dcbc9+_0xaef200)/_0x23044d;_0x2d8baa=erlangb(_0x7a9526,_0x1e06b5);_0xd58426=_0x7a9526/_0x1e06b5*(0x1-erlangb(_0x7a9526,_0x1e06b5));}return _0x159e88({'erlangCalls':_0x41d381,'erlangCallToSecond':_0xba5879/_0x41d381,'erlangAbandonmentRate':_0x2d8baa,'erlangBusyFactor':_0xd58426});});};module[_0xbf4e('0x212')]=Dialer; \ No newline at end of file +var _0xe812=['queueBookedRR','agentconnect','syncAgentConnect','queuecallerabandon','bind','syncOriginateResponse','syncAgentComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','stringify','seconds','emit','type','outbound','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','callerid','format','voice:queue:%s','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','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','---------------------------','merge','milliseconds','diff','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','ivr','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','length','undefined','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','talking','pTalking','sendMessageOneNotActive','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','statedesc','endtime','uniqueId','[uniqueid]','clearZombieChannels','[actions]','Action','status','channel','catch','No\x20such\x20channel','queue','[Dialer][checkChannel]','updateOriginated','[Dialer][checkChannel][ivr]','countReScheduled','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','resolve','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','saveInDb','ListId','UserId','[emptyContact][createHistory]','[emptyContact]','isSuccess','isTrunkReachable','active','SIP/%s','reachable','unmonitored','uniqueid','isNil','variable','amdstatus','xcally-motion-dialer','dialAMDActive','value','HangupInAMD','membername','custom:amd','buildObj','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','state','Machine','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','VoiceQueueId','CampaignId','[rescheduleContact][Machine]','HANGUP','AMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','countdropretry','countabandonedretry','reason19\x20machine....','createStateFinal','ContactId','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','Unknow','reason','agiafterat','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','dialQueueProject2','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','actionid','locked','paused','stateinterface','push','pick','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','strategy','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','rrmemory','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','command','iftime\x20%s,%s','interval','content','indexOf','true','all','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','checkIfTime','checkIfTimeIntervals','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','originate','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','nosuchnumber','reason\x200\x20no\x20such\x20number....','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','reason\x208\x20congestion','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','custom:agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','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(','dialPredictiveOptimizationPercentage','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','abandonmentRate','[CatchErlangB]','busyFactor','one\x20call\x20every:','[handlePredictive]','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[booked][checkContactBlack][else]','Agent','voicePause','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','[getContactCampaign2][Empty]','Contact.phone','[actionOriginateIvr]\x20','floor','dialLimitQueue','dialOrderByScheduledAt','RUNNING','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','[actionOriginate]\x20','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\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','[busyFactor]','lodash','bluebird','md5','ioredis','../../../config/environment/','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./hangup','env','127.0.0.1','roundrobin','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked'];(function(_0x6e7b4a,_0x4152e5){var _0x2747a8=function(_0x51f893){while(--_0x51f893){_0x6e7b4a['push'](_0x6e7b4a['shift']());}};_0x2747a8(++_0x4152e5);}(_0xe812,0x1f2));var _0x2e81=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xe812[_0x167cc1];return _0x10bc4b;};'use strict';var util=require('util');var _=require(_0x2e81('0x0'));var BPromise=require(_0x2e81('0x1'));var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var md5=require(_0x2e81('0x2'));var Redis=require(_0x2e81('0x3'));var ut=require('../preview/util/util');var config=require(_0x2e81('0x4'));var logger=require(_0x2e81('0x5'))('dialer');var loggerBooked=require(_0x2e81('0x5'))(_0x2e81('0x6'));var loggerPredictive=require('../../../config/logger')(_0x2e81('0x7'));var loggerPredictiveCalls=require(_0x2e81('0x5'))(_0x2e81('0x8'));var loggerSyncQueueSummary=require('../../../config/logger')(_0x2e81('0x9'));var ami=require(_0x2e81('0xa'));config[_0x2e81('0xb')]=_[_0x2e81('0xc')](config['redis'],{'host':_0x2e81('0xd'),'port':0x18eb});var io=require(_0x2e81('0xe'))(new Redis(config[_0x2e81('0xb')]));var cmHopper=require(_0x2e81('0xf'));var cmHopperHistory=require(_0x2e81('0x10'));var cmHopperBlack=require(_0x2e81('0x11'));var voiceQueueRt=require(_0x2e81('0x12'));var Action=require(_0x2e81('0x13'));var History=require(_0x2e81('0x14'));var Final=require(_0x2e81('0x15'));var AgentComplete=require(_0x2e81('0x16'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0x2e81('0x17'));var ipAgi=process[_0x2e81('0x18')]['XCALLY_IP_AGI']||_0x2e81('0x19');var strategy={'rrmemory':'rrmemory','roundrobin':_0x2e81('0x1a')};var Sequence=function(){};Sequence[_0x2e81('0x1b')][_0x2e81('0x1c')]=function(_0x362b5a){this[_0x2e81('0x1d')]=this[_0x2e81('0x1d')]?this['tail'][_0x2e81('0x1e')](_0x362b5a):_0x362b5a();};function Dialer(_0x258749,_0x52b5e4){this[_0x2e81('0x1f')]=new Sequence();this['preview']=_0x52b5e4;this[_0x2e81('0x20')]=_0x258749[_0x2e81('0x20')];this['campaigns']=_0x258749[_0x2e81('0x21')];this[_0x2e81('0x22')]=_0x258749[_0x2e81('0x22')];this[_0x2e81('0x23')]=_0x258749[_0x2e81('0x23')];this[_0x2e81('0x24')]=config[_0x2e81('0x24')]||0x2;this[_0x2e81('0x25')]={};this[_0x2e81('0x26')]={};this[_0x2e81('0x27')]={};this['uniqueId']={};this[_0x2e81('0x28')]={};this[_0x2e81('0x29')]={};this[_0x2e81('0x2a')]={};this[_0x2e81('0x2b')]={};this[_0x2e81('0x2c')]={};this[_0x2e81('0x2d')]={};ami['on'](_0x2e81('0x2e'),this[_0x2e81('0x2f')]['bind'](this));ami['on'](_0x2e81('0x30'),this['syncQueueCallerAbandon'][_0x2e81('0x31')](this));ami['on']('originateresponse',this[_0x2e81('0x32')]['bind'](this));ami['on']('agentcomplete',this[_0x2e81('0x33')][_0x2e81('0x31')](this));ami['on']('custom:queuesummary',this[_0x2e81('0x9')][_0x2e81('0x31')](this));ami['on'](_0x2e81('0x34'),this[_0x2e81('0x35')][_0x2e81('0x31')](this));ami['on'](_0x2e81('0x36'),this[_0x2e81('0x37')][_0x2e81('0x31')](this));ami['on'](_0x2e81('0x38'),this[_0x2e81('0x39')][_0x2e81('0x31')](this));ami['on'](_0x2e81('0x3a'),this[_0x2e81('0x3b')][_0x2e81('0x31')](this));ami['on']('queuestatuscomplete',this['syncQueueStatusComplete'][_0x2e81('0x31')](this));this[_0x2e81('0x3c')]();this[_0x2e81('0x3d')]();}function isNotNull(_0x1eb8f6){return _0x1eb8f6!==null&&!_[_0x2e81('0x3e')](_0x1eb8f6);}function checkIsLoggedIn(_0x2a78bb,_0x243b20){return function(){if(_0x243b20<=0x0){_0x2a78bb[_0x2e81('0x3f')]=_0x2e81('0x40');throw _0x2a78bb[_0x2e81('0x41')]+_0x2e81('0x42');}};}function isActive(_0x5e1fa5){return _0x5e1fa5;}function checkIsActive(_0x111074,_0x115b08){return function(){if(!isActive(_0x115b08)){_0x111074[_0x2e81('0x3f')]=_0x2e81('0x43');throw _0x111074[_0x2e81('0x41')]+_0x2e81('0x44');}};}function checkInterval(_0x2fad97){return function(){if(!isNotNull(_0x2fad97[_0x2e81('0x45')])){_0x2fad97[_0x2e81('0x3f')]=_0x2e81('0x46');throw _0x2fad97[_0x2e81('0x41')]+_0x2e81('0x47');}if(!isNotNull(_0x2fad97[_0x2e81('0x45')][_0x2e81('0x48')])){_0x2fad97[_0x2e81('0x3f')]=_0x2e81('0x46');throw _0x2fad97[_0x2e81('0x41')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x2e81('0x49')](_0x2fad97[_0x2e81('0x45')]['Intervals']))){_0x2fad97[_0x2e81('0x3f')]=_0x2e81('0x46');throw _0x2fad97['name']+_0x2e81('0x47');}};}function msgResponse(_0x36ccb7,_0x101b6b,_0x557c13){return{'action':_0x36ccb7,'response':_0x101b6b,'message':_0x557c13,'stack':_0x557c13};}function myreject(_0x358c99){return function(_0x9df11c){return _0x358c99(msgResponse(_0x2e81('0x4a'),_0x2e81('0x4b'),JSON[_0x2e81('0x4c')](_0x9df11c)));};}function getSeconds(_0x5ab58e,_0x593961){var _0x4d3768=moment(_0x5ab58e)['milliseconds'](0x0);var _0x16ed35=moment(_0x593961)['milliseconds'](0x0);return _0x4d3768['diff'](_0x16ed35,_0x2e81('0x4d'));}function emit(_0x1e7443,_0x4752cf,_0x50e75f){io['to'](_0x1e7443)[_0x2e81('0x4e')](_0x4752cf,_0x50e75f);}function emitVoiceQueueSummary(_0x21b596){if(_0x21b596[_0x2e81('0x4f')]===_0x2e81('0x50')){var _0x396eef={'id':_0x21b596['id'],'name':_0x21b596['name'],'strategy':_0x21b596['strategy'],'answered':_0x21b596[_0x2e81('0x51')],'available':_0x21b596[_0x2e81('0x52')],'loggedIn':_0x21b596[_0x2e81('0x53')],'pTalking':_0x21b596['pTalking'],'sumBillable':_0x21b596[_0x2e81('0x54')],'sumDuration':_0x21b596[_0x2e81('0x55')],'sumHoldTime':_0x21b596[_0x2e81('0x56')]||0x0,'talking':_0x21b596['talking'],'total':_0x21b596[_0x2e81('0x57')],'type':_0x21b596[_0x2e81('0x4f')],'unmanaged':_0x21b596[_0x2e81('0x58')],'abandoned':_0x21b596[_0x2e81('0x59')],'waiting':_0x21b596[_0x2e81('0x5a')],'loggedInDb':_0x21b596[_0x2e81('0x5b')],'dialActive':_0x21b596[_0x2e81('0x5c')],'dialMethod':_0x21b596[_0x2e81('0x5d')],'dialOriginateCallerIdName':_0x21b596['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x21b596['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x21b596[_0x2e81('0x5e')],'dialPrefix':_0x21b596['dialPrefix'],'outboundAnswerAgiCallsDay':_0x21b596[_0x2e81('0x5f')],'outboundAnswerCallsDay':_0x21b596[_0x2e81('0x60')],'outboundBlacklistCallsDay':_0x21b596[_0x2e81('0x61')],'outboundBusyCallsDay':_0x21b596[_0x2e81('0x62')],'outboundCongestionCallsDay':_0x21b596[_0x2e81('0x63')],'outboundDropCallsDayACS':_0x21b596[_0x2e81('0x64')],'outboundDropCallsDayCallersExit':_0x21b596['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x21b596['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x21b596[_0x2e81('0x65')],'outboundNoSuchCallsDay':_0x21b596[_0x2e81('0x66')],'outboundOriginateFailureCallsDay':_0x21b596[_0x2e81('0x67')],'outboundReCallsDay':_0x21b596['outboundReCallsDay'],'outboundRejectCallsDay':_0x21b596[_0x2e81('0x68')],'outboundUnknownCallsDay':_0x21b596[_0x2e81('0x69')],'predictiveIntervalAnsweredCalls':_0x21b596['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x21b596[_0x2e81('0x6a')],'predictiveIntervalAvgTalktime':_0x21b596['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x21b596[_0x2e81('0x6b')],'predictiveIntervalDroppedCallsTimeout':_0x21b596[_0x2e81('0x6c')],'predictiveIntervalErlangCalls':_0x21b596[_0x2e81('0x6d')],'predictiveIntervalErlangCallsDroppedCalls':_0x21b596[_0x2e81('0x6e')],'predictiveIntervalHitRate':_0x21b596['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x21b596[_0x2e81('0x6f')],'predictiveIntervalPauses':_0x21b596['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x21b596[_0x2e81('0x70')],'predictiveIntervalTotalCalls':_0x21b596[_0x2e81('0x71')],'message':_0x21b596['message'],'originated':_0x21b596[_0x2e81('0x72')],'erlangCalls':_0x21b596[_0x2e81('0x73')],'erlangCallToSecond':_0x21b596[_0x2e81('0x74')],'erlangAbandonmentRate':_0x21b596[_0x2e81('0x75')],'erlangBusyFactor':_0x21b596[_0x2e81('0x76')],'startPredictive':_0x21b596[_0x2e81('0x29')],'startProgressive':_0x21b596[_0x2e81('0x2a')]};if(_0x21b596['Trunk']){_0x396eef[_0x2e81('0x77')]={'id':_0x21b596['Trunk']['id'],'name':_0x21b596['Trunk'][_0x2e81('0x41')],'active':_0x21b596['Trunk']['active'],'callerid':_0x21b596[_0x2e81('0x77')][_0x2e81('0x78')]};}if(_0x21b596[_0x2e81('0x45')]){_0x396eef['Interval']={'id':_0x21b596['Interval']['id'],'name':_0x21b596[_0x2e81('0x45')][_0x2e81('0x41')]};}var _0x16ed11=md5(JSON[_0x2e81('0x4c')](_0x396eef));if(_0x21b596['md5']!==_0x16ed11){_0x21b596['md5']=_0x16ed11;emit(util[_0x2e81('0x79')](_0x2e81('0x7a'),_0x396eef['name']),'voice_queue:save',_0x396eef);}}}function emitCampaignSummary(_0x23a42b){if(_0x23a42b[_0x2e81('0x4f')]==='ivr'){emit(util[_0x2e81('0x79')](_0x2e81('0x7b'),_0x23a42b[_0x2e81('0x41')]),_0x2e81('0x7c'),_0x23a42b);}}function checkGetDataPredictive(_0x401143){if(isNotNull(_0x401143)&&!_['isEmpty'](_0x401143)){loggerPredictive[_0x2e81('0x7d')](_0x2e81('0x7e'));loggerPredictive[_0x2e81('0x7d')](_0x2e81('0x7f'),_0x401143['predictiveIntervalTotalCalls']);loggerPredictive['info'](_0x2e81('0x80'),_0x401143[_0x2e81('0x81')]);loggerPredictive[_0x2e81('0x7d')](_0x2e81('0x82'),_0x401143[_0x2e81('0x6c')]);loggerPredictive['info'](_0x2e81('0x83'),_0x401143[_0x2e81('0x6b')]);loggerPredictive[_0x2e81('0x7d')](_0x2e81('0x84'),_0x401143[_0x2e81('0x6a')]);loggerPredictive['info'](_0x2e81('0x85'),_0x401143[_0x2e81('0x86')]);loggerPredictive['info']('---------------------------');if(_0x401143[_0x2e81('0x71')]>0x0){if(!_['isUndefined'](_0x401143[_0x2e81('0x86')])&&_0x401143[_0x2e81('0x86')]>0x0){return!![];}loggerPredictive[_0x2e81('0x7d')](_0x2e81('0x87'));if(!_[_0x2e81('0x3e')](_0x401143[_0x2e81('0x6a')])&&_0x401143[_0x2e81('0x6a')]>0x0){return!![];}loggerPredictive[_0x2e81('0x7d')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x2e81('0x7d')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x2e81('0x7d')](_0x2e81('0x88'));}return![];}function mergeDataErlangB(_0x56135f){return function(_0x28dcab){loggerPredictive[_0x2e81('0x7d')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x2e81('0x7d')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x28dcab[_0x2e81('0x73')]);loggerPredictive[_0x2e81('0x7d')](_0x2e81('0x89'),_0x28dcab[_0x2e81('0x74')]);loggerPredictive[_0x2e81('0x7d')](_0x2e81('0x8a'),_0x28dcab[_0x2e81('0x75')]);loggerPredictive[_0x2e81('0x7d')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x28dcab[_0x2e81('0x76')]);loggerPredictive[_0x2e81('0x7d')](_0x2e81('0x8a'),_0x28dcab[_0x2e81('0x75')]);loggerPredictive[_0x2e81('0x7d')](_0x2e81('0x8b'));_[_0x2e81('0x8c')](_0x56135f,_0x28dcab);};}function getDiff(_0x8a1f0f){var _0x3def62=moment()[_0x2e81('0x8d')](0x0);var _0x1a37f9=moment(_0x8a1f0f)[_0x2e81('0x8d')](0x0);return _0x3def62[_0x2e81('0x8e')](_0x1a37f9,_0x2e81('0x4d'));}function ifInterval(_0x432882,_0x5df615){if(_['isUndefined'](_0x5df615)){return![];}return getDiff(_0x5df615)<_0x432882*0x3c;}function freeVariablesPredictive(_0x354e39){if(isNotNull(_0x354e39)){if(!_[_0x2e81('0x3e')](_0x354e39[_0x2e81('0x2a')])){_0x354e39[_0x2e81('0x2a')]=undefined;loggerPredictive[_0x2e81('0x7d')](_0x354e39[_0x2e81('0x41')],_0x2e81('0x8f'));}if(!_[_0x2e81('0x3e')](_0x354e39['startPredictive'])){_0x354e39['startPredictive']=undefined;loggerPredictive[_0x2e81('0x7d')](_0x354e39[_0x2e81('0x41')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x2e81('0x3e')](_0x354e39[_0x2e81('0x90')])){clearInterval(_0x354e39[_0x2e81('0x90')]);_0x354e39[_0x2e81('0x90')]=undefined;loggerPredictive[_0x2e81('0x7d')](_0x354e39[_0x2e81('0x41')],_0x2e81('0x91'));}}}function erlangb(_0x1f1d8e,_0x59f4a9){if(_0x59f4a9===0x0){return 0x0;}var _0x143f60=0x1;for(var _0x4fce89=0x1;_0x4fce89<=_0x59f4a9;_0x4fce89+=0x1){_0x143f60=0x1+_0x143f60*_0x4fce89/_0x1f1d8e;}return 0x1/_0x143f60;}function isVoiceQueueOutbound(_0x3de86f){return _0x3de86f===_0x2e81('0x50');}function isNotPreview(_0xe3748e){return _0xe3748e!==_0x2e81('0x92');}function isCampaignIvr(_0xafbd8c){return _0xafbd8c===_0x2e81('0x93');}function getCallerId(_0x14bd94,_0xd0861,_0x40a384){if(!_[_0x2e81('0x3e')](_0x40a384)&&typeof _0x40a384===_0x2e81('0x94')&&!_[_0x2e81('0x49')](_0x40a384)){if(!_['isUndefined'](_0xd0861)&&typeof _0xd0861===_0x2e81('0x94')&&!_[_0x2e81('0x49')](_0xd0861)){return util[_0x2e81('0x79')](_0x2e81('0x95'),_0xd0861,_0x40a384);}return util[_0x2e81('0x79')]('\x22%s\x22\x20<%s>',_0x40a384,_0x40a384);}if(!_[_0x2e81('0x3e')](_0x14bd94)&&typeof _0x14bd94===_0x2e81('0x94')&&!_['isEmpty'](_0x14bd94)){return _0x14bd94;}return _0x2e81('0x96');}function loggerCatchQueueSummary(_0xfc4a83,_0x2b0ad3){return function(_0x379d3b){freeVariablesPredictive(_0x2b0ad3);emitVoiceQueueSummary(_0x2b0ad3);emitCampaignSummary(_0x2b0ad3);loggerSyncQueueSummary[_0x2e81('0x97')](_0xfc4a83,util[_0x2e81('0x98')](_0x379d3b,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x27bb80,_0x17c345){return function(_0x217242){loggerPredictive[_0x2e81('0x97')](_0x17c345['name'],_0x27bb80);loggerPredictive['error'](_0x217242['stack']);freeVariablesPredictive(_0x17c345);};}function loggerCatch(_0x19a8f1){return function(_0x27539b){logger[_0x2e81('0x97')](_0x19a8f1,util[_0x2e81('0x98')](_0x27539b,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x4ef3c0){return _0x4ef3c0&&!_[_0x2e81('0x3e')](_0x4ef3c0)&&_0x4ef3c0[_0x2e81('0x99')]>0x0;}function decremetOriginate(_0x56bb05){if(!_['isUndefined'](_0x56bb05)&&_0x56bb05!==null){if(typeof _0x56bb05[_0x2e81('0x72')]!==_0x2e81('0x9a')){if(_0x56bb05['originated']>0x0){_0x56bb05['originated']-=0x1;}else{logger[_0x2e81('0x97')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x2e81('0x97')](_0x2e81('0x9b'));}}function checkContactLowerLimitOriginate(_0x4b8d70,_0x42e0d8,_0x5be573){if(_0x42e0d8>_0x5be573){for(var _0x474183=0x0;_0x474183<_0x42e0d8-_0x5be573;_0x474183+=0x1){decremetOriginate(_0x4b8d70);}}}function loggerGetContactDialer(_0x4df8b3,_0x59bf7e,_0x5e6b07){return function(_0x2f457b){checkContactLowerLimitOriginate(_0x59bf7e,_0x5e6b07,0x0);logger['error'](_0x4df8b3,util[_0x2e81('0x98')](_0x2f457b,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3415f2){return function(_0x48daa3){if(isNotNull(_0x48daa3)&&isNotNull(_0x48daa3[0x0])){if(_0x48daa3[0x0][_0x2e81('0x9c')]>0x0){_0x3415f2[_0x2e81('0x3f')]=_0x2e81('0x9d');logger[_0x2e81('0x7d')](_0x2e81('0x9e')+_0x3415f2[_0x2e81('0x41')],_0x48daa3[0x0][_0x2e81('0x9c')],_0x2e81('0x9f'));}else{_0x3415f2[_0x2e81('0x3f')]=_0x2e81('0xa0');logger['info']('[getContactDialer2][Empty]'+_0x3415f2[_0x2e81('0x41')]);}}};}function notSendMessagesQueue(_0x3d2320){if(_0x3d2320['sendMessageOneNotActive']){freeVariablesPredictive(_0x3d2320);if(_0x3d2320[_0x2e81('0x72')]===0x0&&_0x3d2320[_0x2e81('0xa1')]===0x0&&_0x3d2320[_0x2e81('0x5a')]===0x0&&(_0x3d2320[_0x2e81('0xa2')]||0x0)===0x0){_0x3d2320[_0x2e81('0xa3')]=![];_0x3d2320['available']=0x0;_0x3d2320[_0x2e81('0x3f')]=_0x2e81('0x43');loggerSyncQueueSummary[_0x2e81('0x97')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x3d2320[_0x2e81('0x41')],_0x2e81('0xa4'));}else{_0x3d2320[_0x2e81('0x3f')]=_0x2e81('0xa5');loggerSyncQueueSummary[_0x2e81('0x97')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x3d2320[_0x2e81('0x41')],'is\x20disactive');}emitVoiceQueueSummary(_0x3d2320);}}function notSendMessagesCampaign(_0x261fc7){if(_0x261fc7[_0x2e81('0xa3')]){if(_0x261fc7[_0x2e81('0x72')]===0x0){_0x261fc7[_0x2e81('0xa3')]=![];_0x261fc7[_0x2e81('0x3f')]=_0x2e81('0x43');loggerSyncQueueSummary[_0x2e81('0x97')](_0x2e81('0xa6'),_0x261fc7[_0x2e81('0x41')],_0x2e81('0xa4'));}else{_0x261fc7['message']=_0x2e81('0xa5');loggerSyncQueueSummary['error'](_0x2e81('0xa6'),_0x261fc7[_0x2e81('0x41')],_0x2e81('0xa7'));}emitCampaignSummary(_0x261fc7);}}function createObjHistory(_0x514884,_0x532504,_0x32b6b0,_0x4b1d93,_0x218767){_0x514884['message']=_0x32b6b0;var _0x43237b=new Action(_0x514884,_0x532504);var _0x3a5d5e=new History(_0x43237b);_0x3a5d5e['state']=_0x4b1d93;_0x3a5d5e[_0x2e81('0xa8')]=_0x218767;_0x3a5d5e[_0x2e81('0xa9')]=_0x43237b['starttime'];return _0x3a5d5e;}Dialer[_0x2e81('0x1b')]['loopClearZombieChannels']=function(){var _0x8833=this;setInterval(function(){_0x8833['clearZombieChannels'](_0x8833[_0x2e81('0xaa')],_0x2e81('0xab'));_0x8833[_0x2e81('0xac')](_0x8833[_0x2e81('0x26')],_0x2e81('0xad'));},0x32c8);};Dialer['prototype'][_0x2e81('0xac')]=function(_0x48739f,_0x168cac){var _0x3af9df=this;for(var _0x56e463 in _0x48739f){if(typeof _0x48739f[_0x56e463]!==_0x2e81('0x9a')){this[_0x2e81('0x1f')][_0x2e81('0x1c')](function(){if(!_['isNil'](_0x48739f[_0x56e463])){return ami[_0x2e81('0xae')]({'action':_0x2e81('0xaf'),'channel':_0x48739f[_0x56e463][_0x2e81('0xb0')]})[_0x2e81('0xb1')](function(_0x40df33){if(_0x40df33[_0x2e81('0x3f')]===_0x2e81('0xb2')){setTimeout(function(){if(_0x48739f[_0x56e463]&&_0x48739f[_0x56e463][_0x2e81('0x4f')]!=='ivr'){_0x3af9df['updateOriginated'](_0x3af9df[_0x2e81('0x20')][_0x48739f[_0x56e463][_0x2e81('0xb3')]]);logger['error'](_0x2e81('0xb4'),_0x168cac,_0x56e463,_0x48739f[_0x56e463]['queue']);delete _0x48739f[_0x56e463];}if(_0x48739f[_0x56e463]&&_0x48739f[_0x56e463][_0x2e81('0x4f')]===_0x2e81('0x93')){_0x3af9df[_0x2e81('0xb5')](_0x3af9df[_0x2e81('0x21')][_0x48739f[_0x56e463][_0x2e81('0xb3')]]);logger['error'](_0x2e81('0xb6'),_0x168cac,_0x56e463,_0x48739f[_0x56e463][_0x2e81('0xb3')]);delete _0x48739f[_0x56e463];}},0x2328);}});}});}}};Dialer[_0x2e81('0x1b')][_0x2e81('0xb7')]=function(_0xa1b285){return BPromise['resolve']()[_0x2e81('0xb8')](cmHopper[_0x2e81('0xb7')](_0xa1b285))[_0x2e81('0xb1')](loggerCatch(_0x2e81('0xb9')));};Dialer['prototype'][_0x2e81('0xba')]=function(_0x5d104c){return BPromise['resolve']()[_0x2e81('0xb8')](cmHopperBlack[_0x2e81('0xba')](_0x5d104c))[_0x2e81('0xb1')](loggerCatch(_0x2e81('0xbb')));};Dialer['prototype']['checkIsBlackListIvr']=function(_0xb2e23f){return BPromise[_0x2e81('0xbc')]()[_0x2e81('0xb8')](cmHopperBlack[_0x2e81('0xbd')](_0xb2e23f))[_0x2e81('0xb1')](loggerCatch(_0x2e81('0xbe')));};Dialer[_0x2e81('0x1b')][_0x2e81('0xbf')]=function(_0x5e5854){return BPromise[_0x2e81('0xbc')]()['then'](cmHopperHistory[_0x2e81('0xc0')](_0x5e5854))[_0x2e81('0xb1')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0x2e81('0x1b')][_0x2e81('0xc1')]=function(_0x18e9ce){return BPromise['resolve']()[_0x2e81('0xb8')](cmHopper[_0x2e81('0xc1')](_0x18e9ce))[_0x2e81('0xb1')](loggerCatch(_0x2e81('0xc2')));};Dialer[_0x2e81('0x1b')][_0x2e81('0xc3')]=function(_0x5e964a,_0x5b849d,_0x3592cb){return BPromise[_0x2e81('0xbc')]()[_0x2e81('0xb8')](cmHopper['unlockContact'](_0x5e964a,_0x5b849d,_0x3592cb))['catch'](loggerCatch(_0x2e81('0xc4')));};Dialer['prototype'][_0x2e81('0xc5')]=function(_0x1ea08d,_0x216593,_0x52ba8e,_0x128088,_0x80c914){return BPromise['resolve']()[_0x2e81('0xb8')](cmHopper['getContactDialer'](_0x1ea08d,_0x216593,_0x52ba8e,_0x128088))[_0x2e81('0xb1')](function(_0xa3039e){_0x80c914['temp']-=_0x52ba8e;_0x80c914['temp']=_0x80c914['temp']>0x0?_0x80c914[_0x2e81('0xc6')]:0x0;loggerCatch(_0x2e81('0xc7'))(_0xa3039e);});};Dialer[_0x2e81('0x1b')][_0x2e81('0xc8')]=function(_0x4ee5ec,_0x7d8fe9,_0xf1e606,_0x4d59a1){return BPromise[_0x2e81('0xbc')]()[_0x2e81('0xb8')](cmHopper['getContactDialerIvr'](_0x4ee5ec,_0x7d8fe9,_0xf1e606))['catch'](function(_0x47aab6){_0x4d59a1['temp']-=_0x7d8fe9;_0x4d59a1[_0x2e81('0xc6')]=_0x4d59a1[_0x2e81('0xc6')]>0x0?_0x4d59a1[_0x2e81('0xc6')]:0x0;loggerCatch('[getContactDialerIvr]\x20')(_0x47aab6);});};Dialer[_0x2e81('0x1b')][_0x2e81('0xc9')]=function(_0x230295){return BPromise[_0x2e81('0xbc')]()[_0x2e81('0xb8')](voiceQueueRt['getVoiceQueueRtPauses'](_0x230295))[_0x2e81('0xb1')](loggerCatch(_0x2e81('0xca')));};Dialer['prototype']['moveContactManagedDialer']=function(_0x153aa8){return BPromise[_0x2e81('0xbc')]()[_0x2e81('0xb8')](cmHopper[_0x2e81('0xcb')](_0x153aa8))[_0x2e81('0xb1')](loggerCatch(_0x2e81('0xcc')));};Dialer[_0x2e81('0x1b')][_0x2e81('0xcd')]=function(_0x44ad36){return BPromise[_0x2e81('0xbc')]()[_0x2e81('0xb8')](cmHopperHistory[_0x2e81('0xcd')](_0x44ad36))[_0x2e81('0xb1')](loggerCatch(_0x2e81('0xce')));};Dialer[_0x2e81('0x1b')][_0x2e81('0xb5')]=function(_0x56ca6f){if(!_[_0x2e81('0x3e')](_0x56ca6f)&&_0x56ca6f!==null){if(typeof _0x56ca6f['originated']!=='undefined'){if(_0x56ca6f[_0x2e81('0x72')]>0x0){_0x56ca6f[_0x2e81('0x72')]-=0x1;}else{logger[_0x2e81('0x97')](_0x2e81('0xcf'));}}}else{logger[_0x2e81('0x97')](_0x2e81('0xd0'));}};Dialer[_0x2e81('0x1b')][_0x2e81('0xd1')]=function(_0x3daf78,_0x41415c){var _0x702658=this;return function(_0x27c75a){_0x702658[_0x2e81('0xb5')](_0x41415c);logger[_0x2e81('0x97')](_0x3daf78,util[_0x2e81('0x98')](_0x27c75a,{'showHidden':![],'depth':null}));};};Dialer[_0x2e81('0x1b')][_0x2e81('0xd2')]=function(_0x32704e,_0x1b47e7,_0x229810){var _0x10a559={'state':0x19,'statedesc':'notFound'};this[_0x2e81('0xb5')](_0x1b47e7);this[_0x2e81('0xd3')](_[_0x2e81('0x8c')](_0x10a559,_['pick'](_0x229810,['ContactId',_0x2e81('0xd4'),_0x2e81('0xd5'),'VoiceQueueId','CampaignId'])),_0x2e81('0xd6'),_0x2e81('0xd7'));logger[_0x2e81('0x97')](_0x32704e);};Dialer[_0x2e81('0x1b')][_0x2e81('0xd8')]=function(_0x61ab87){return _0x61ab87==='Success';};Dialer[_0x2e81('0x1b')][_0x2e81('0xd9')]=function(_0x1817bd){return!_[_0x2e81('0x3e')](_0x1817bd)&&_0x1817bd&&!_[_0x2e81('0x3e')](_0x1817bd[_0x2e81('0x41')])&&!_[_0x2e81('0x3e')](_0x1817bd[_0x2e81('0xda')])&&_0x1817bd[_0x2e81('0xda')]&&(this[_0x2e81('0x23')][util[_0x2e81('0x79')](_0x2e81('0xdb'),_0x1817bd[_0x2e81('0x41')])][_0x2e81('0xaf')]===_0x2e81('0xdc')||this['trunks'][util[_0x2e81('0x79')]('SIP/%s',_0x1817bd['name'])][_0x2e81('0xaf')]===_0x2e81('0xdd'));};Dialer['prototype']['saveInDb']=function(_0x44a839,_0x51afb1,_0x583059){this[_0x2e81('0xcd')](_0x44a839)[_0x2e81('0xb1')](loggerCatch(_0x51afb1));this['moveContactManagedDialer'](_0x44a839)[_0x2e81('0xb1')](loggerCatch(_0x583059));};Dialer['prototype'][_0x2e81('0x39')]=function(_0x342301){var _0x4d4c42=this[_0x2e81('0xaa')][_0x342301[_0x2e81('0xde')]];var _0x1c4540;if(!_[_0x2e81('0xdf')](_0x342301)&&!_['isNil'](_0x342301[_0x2e81('0xe0')])&&!_[_0x2e81('0xdf')](_0x342301[_0x2e81('0xe0')][_0x2e81('0xe1')])&&_0x342301['exten']===_0x2e81('0xe2')&&_0x4d4c42){if(_0x4d4c42[_0x2e81('0x4f')]!==_0x2e81('0x93')&&this[_0x2e81('0x20')][_0x4d4c42[_0x2e81('0xb3')]][_0x2e81('0xe3')]&&_0x342301[_0x2e81('0xe4')]==='HANGUP'){delete this[_0x2e81('0xaa')][_0x342301[_0x2e81('0xde')]];this[_0x2e81('0xb5')](this[_0x2e81('0x20')][_0x4d4c42[_0x2e81('0xb3')]]);this[_0x2e81('0x20')][_0x4d4c42['queue']][_0x2e81('0x60')]+=0x1;this[_0x2e81('0x20')][_0x4d4c42[_0x2e81('0xb3')]]['outboundAnswerAgiCallsDay']+=0x1;_0x1c4540=new Hangup(_0x4d4c42,_0x342301);_0x1c4540['state']=0x12;_0x1c4540[_0x2e81('0xa8')]=_0x2e81('0xe5');_0x1c4540[_0x2e81('0xe6')]='AMD';ami[_0x2e81('0x4e')](_0x2e81('0xe7'),ut[_0x2e81('0xe8')](_0x1c4540,'amd'));this['saveInDb'](_0x1c4540,_0x2e81('0xe9'),_0x2e81('0xea'));}if(_0x4d4c42['type']!=='ivr'&&this[_0x2e81('0x20')][_0x4d4c42[_0x2e81('0xb3')]][_0x2e81('0xe3')]&&_0x342301[_0x2e81('0xe4')]==='MACHINE'){var _0x2a28e6=this;return new BPromise(function(_0x1f5b76,_0x52ead6){delete _0x2a28e6[_0x2e81('0xaa')][_0x342301[_0x2e81('0xde')]];_0x2a28e6['updateOriginated'](_0x2a28e6[_0x2e81('0x20')][_0x4d4c42[_0x2e81('0xb3')]]);_0x2a28e6['voiceQueues'][_0x4d4c42['queue']][_0x2e81('0x60')]+=0x1;_0x2a28e6[_0x2e81('0x20')][_0x4d4c42[_0x2e81('0xb3')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x441eda=_0x2a28e6[_0x2e81('0x20')][_0x4d4c42[_0x2e81('0xb3')]];var _0x457b02=new Hangup(_0x4d4c42,_0x342301);_0x457b02[_0x2e81('0xeb')]=0x13;_0x457b02[_0x2e81('0xa8')]=_0x2e81('0xec');_0x457b02['membername']='AMD';_0x457b02[_0x2e81('0xed')]+=0x1;_0x457b02[_0x2e81('0xee')]+=0x1;_0x457b02[_0x2e81('0xef')]=!![];ami[_0x2e81('0x4e')]('custom:amd',ut['buildObj'](_0x457b02,_0x2e81('0xef')));_0x2a28e6[_0x2e81('0xcd')](_0x457b02)['catch'](loggerCatch(_0x2e81('0xf0')));if(_0x457b02[_0x2e81('0xf1')]+_0x457b02[_0x2e81('0xf2')]+_0x457b02[_0x2e81('0xf3')]+_0x457b02[_0x2e81('0xf4')]+_0x457b02['countdropretry']+_0x457b02['countabandonedretry']+_0x457b02[_0x2e81('0xed')]+_0x457b02[_0x2e81('0xf5')]>=_0x441eda[_0x2e81('0xf6')]){_0x2a28e6[_0x2e81('0xf7')](_0x457b02,_0x1f5b76,_0x52ead6,'reason19\x20machine....');}else{if(_0x457b02[_0x2e81('0xed')]>=_0x441eda[_0x2e81('0xf8')]){_0x2a28e6['createStateFinal'](_0x457b02,_0x1f5b76,_0x52ead6,_0x2e81('0xf9'));}else{_0x2a28e6[_0x2e81('0xc1')]({'active':![],'countmachineretry':_0x457b02['countmachineretry'],'scheduledat':moment()[_0x2e81('0xfa')](_0x441eda[_0x2e81('0xfb')],_0x2e81('0xfc'))[_0x2e81('0x79')](_0x2e81('0xfd')),'ContactId':_0x457b02['ContactId'],'ListId':_0x457b02[_0x2e81('0xd4')],'VoiceQueueId':_0x457b02[_0x2e81('0xfe')]||undefined,'CampaignId':_0x457b02[_0x2e81('0xff')]||undefined})['catch'](loggerCatch(_0x2e81('0x100')));_0x1f5b76({'reschedule':0x1});}}});}if(_0x4d4c42[_0x2e81('0x4f')]==='ivr'&&this['campaigns'][_0x4d4c42[_0x2e81('0xb3')]][_0x2e81('0xe3')]&&_0x342301[_0x2e81('0xe4')]===_0x2e81('0x101')){delete this[_0x2e81('0xaa')][_0x342301[_0x2e81('0xde')]];this['updateOriginated'](this[_0x2e81('0x21')][_0x4d4c42['queue']]);_0x1c4540=new Hangup(_0x4d4c42,_0x342301);_0x1c4540['state']=0x12;_0x1c4540[_0x2e81('0xa8')]=_0x2e81('0xe5');_0x1c4540['membername']=_0x2e81('0x102');ami[_0x2e81('0x4e')]('custom:amd',ut[_0x2e81('0xe8')](_0x1c4540,_0x2e81('0xef')));this[_0x2e81('0xd3')](_0x1c4540,_0x2e81('0x103'),_0x2e81('0x104'));}if(_0x4d4c42[_0x2e81('0x4f')]===_0x2e81('0x93')&&this[_0x2e81('0x21')][_0x4d4c42['queue']]['dialAMDActive']&&_0x342301['value']===_0x2e81('0x105')){var _0x2a28e6=this;return new BPromise(function(_0x10bd95,_0x53337a){delete _0x2a28e6['uniqueId'][_0x342301['uniqueid']];_0x2a28e6[_0x2e81('0xb5')](_0x2a28e6[_0x2e81('0x21')][_0x4d4c42['queue']]);_0x2a28e6[_0x2e81('0x21')][_0x4d4c42[_0x2e81('0xb3')]][_0x2e81('0x60')]+=0x1;_0x2a28e6[_0x2e81('0x21')][_0x4d4c42['queue']][_0x2e81('0x5f')]+=0x1;var _0x3f2803=_0x2a28e6[_0x2e81('0x21')][_0x4d4c42[_0x2e81('0xb3')]];var _0x2f0709=new Hangup(_0x4d4c42,_0x342301);_0x2f0709['state']=0x13;_0x2f0709['statedesc']=_0x2e81('0xec');_0x2f0709[_0x2e81('0xe6')]=_0x2e81('0x102');_0x2f0709[_0x2e81('0xed')]+=0x1;_0x2f0709[_0x2e81('0xee')]+=0x1;_0x2f0709[_0x2e81('0xef')]=!![];ami[_0x2e81('0x4e')](_0x2e81('0xe7'),ut[_0x2e81('0xe8')](_0x2f0709,_0x2e81('0xef')));_0x2a28e6['createHistory'](_0x2f0709)['catch'](loggerCatch(_0x2e81('0xf0')));if(_0x2f0709[_0x2e81('0xf1')]+_0x2f0709[_0x2e81('0xf2')]+_0x2f0709[_0x2e81('0xf3')]+_0x2f0709[_0x2e81('0xf4')]+_0x2f0709[_0x2e81('0x106')]+_0x2f0709[_0x2e81('0x107')]+_0x2f0709[_0x2e81('0xed')]+_0x2f0709[_0x2e81('0xf5')]>=_0x3f2803[_0x2e81('0xf6')]){_0x2a28e6[_0x2e81('0xf7')](_0x2f0709,_0x10bd95,_0x53337a,_0x2e81('0x108'));}else{if(_0x2f0709['countmachineretry']>=_0x3f2803[_0x2e81('0xf8')]){_0x2a28e6[_0x2e81('0x109')](_0x2f0709,_0x10bd95,_0x53337a,'reason\x2019\x20machine....');}else{_0x2a28e6['rescheduleContact']({'active':![],'countmachineretry':_0x2f0709[_0x2e81('0xed')],'scheduledat':moment()['add'](_0x3f2803['dialMachineRetryFrequency'],'minutes')[_0x2e81('0x79')](_0x2e81('0xfd')),'ContactId':_0x2f0709[_0x2e81('0x10a')],'ListId':_0x2f0709[_0x2e81('0xd4')],'VoiceQueueId':_0x2f0709[_0x2e81('0xfe')]||undefined,'CampaignId':_0x2f0709[_0x2e81('0xff')]||undefined})[_0x2e81('0xb1')](loggerCatch(_0x2e81('0x100')));_0x10bd95({'reschedule':0x1});}}});}}};Dialer[_0x2e81('0x1b')][_0x2e81('0x35')]=function(_0x164cde){var _0xda9e3a=this[_0x2e81('0xaa')][_0x164cde[_0x2e81('0xde')]];var _0x25e3d6=this;var _0x426528;if(_0xda9e3a&&_0xda9e3a[_0x2e81('0x4f')]==='ivr'){delete this['uniqueId'][_0x164cde[_0x2e81('0xde')]];this['updateOriginated'](this[_0x2e81('0x21')][_0xda9e3a['queue']]);this[_0x2e81('0x21')][_0xda9e3a['queue']][_0x2e81('0x10b')]+=0x1;_0x426528=new Hangup(_0xda9e3a,_0x164cde);this[_0x2e81('0xcd')](_0x426528)[_0x2e81('0xb1')](loggerCatch(_0x2e81('0x10c')));this[_0x2e81('0xcb')](_0x426528)[_0x2e81('0xb1')](loggerCatch(_0x2e81('0x10d')));}if(_0xda9e3a&&_0xda9e3a[_0x2e81('0x4f')]!=='ivr'&&isNotNull(this[_0x2e81('0x20')][_0xda9e3a[_0x2e81('0xb3')]][_0x2e81('0x10e')])){delete this[_0x2e81('0xaa')][_0x164cde['uniqueid']];this[_0x2e81('0xb5')](this[_0x2e81('0x20')][_0xda9e3a[_0x2e81('0xb3')]]);this['voiceQueues'][_0xda9e3a[_0x2e81('0xb3')]][_0x2e81('0x60')]+=0x1;this[_0x2e81('0x20')][_0xda9e3a[_0x2e81('0xb3')]]['outboundAnswerAgiCallsDay']+=0x1;_0x426528=new Hangup(_0xda9e3a,_0x164cde);_0x426528['state']=0x10;_0x426528[_0x2e81('0xa8')]=_0x2e81('0x10f');_0x426528['membername']=_0x2e81('0x110');this['createHistory'](_0x426528)['catch'](loggerCatch(_0x2e81('0x10c')));this[_0x2e81('0xcb')](_0x426528)['catch'](loggerCatch(_0x2e81('0x10d')));}if(_0xda9e3a&&_0xda9e3a['type']!=='ivr'&&!isNotNull(this[_0x2e81('0x20')][_0xda9e3a[_0x2e81('0xb3')]]['dialQueueProject'])){delete this[_0x2e81('0xaa')][_0x164cde[_0x2e81('0xde')]];this['updateOriginated'](this[_0x2e81('0x20')][_0xda9e3a['queue']]);this[_0x2e81('0x20')][_0xda9e3a[_0x2e81('0xb3')]]['outboundUnknownCallsDay']+=0x1;_0x426528=new Hangup(_0xda9e3a,_0x164cde);_0x426528[_0x2e81('0xeb')]=0xc;_0x426528[_0x2e81('0xa8')]=_0x164cde[_0x2e81('0x111')];_0x426528[_0x2e81('0xe6')]=_0x2e81('0x112');this[_0x2e81('0xcd')](_0x426528)['catch'](loggerCatch(_0x2e81('0x10c')));this[_0x2e81('0xcb')](_0x426528)['catch'](loggerCatch(_0x2e81('0x10d')));}};Dialer[_0x2e81('0x1b')][_0x2e81('0x33')]=function(_0x3fef2e){var _0x19d37c=this[_0x2e81('0xaa')][_0x3fef2e['uniqueid']];var _0x1314dd=this;if(this[_0x2e81('0x20')][_0x3fef2e['queue']]){if(_0x19d37c&&_0x19d37c[_0x2e81('0x4f')]!==_0x2e81('0x93')){delete this[_0x2e81('0xaa')][_0x3fef2e[_0x2e81('0xde')]];this[_0x2e81('0x20')][_0x3fef2e[_0x2e81('0xb3')]][_0x2e81('0x60')]+=0x1;var _0x31673d=new AgentComplete(_0x19d37c,_0x3fef2e);if(_0x3fef2e[_0x2e81('0x113')]==='agent'){_0x31673d[_0x2e81('0x114')]=this[_0x2e81('0x20')][_0x3fef2e['queue']]['dialQueueProject2']&&this[_0x2e81('0x20')][_0x3fef2e[_0x2e81('0xb3')]][_0x2e81('0x115')]?moment()[_0x2e81('0x79')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this['createHistory'](_0x31673d)[_0x2e81('0xb1')](loggerCatch(_0x2e81('0x116')));this[_0x2e81('0xcb')](_0x31673d)[_0x2e81('0xb1')](loggerCatch(_0x2e81('0x117')));}}};Dialer[_0x2e81('0x1b')][_0x2e81('0x2f')]=function(_0x239593){if(this[_0x2e81('0x20')][_0x239593[_0x2e81('0xb3')]]){if(this[_0x2e81('0xaa')][_0x239593[_0x2e81('0xde')]]&&this[_0x2e81('0xaa')][_0x239593[_0x2e81('0xde')]][_0x2e81('0x4f')]!=='ivr'){this[_0x2e81('0xb5')](this[_0x2e81('0x20')][_0x239593[_0x2e81('0xb3')]]);this['uniqueId'][_0x239593[_0x2e81('0xde')]][_0x2e81('0x118')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer['prototype'][_0x2e81('0x119')]=function(_0x2a1fbc){this[_0x2e81('0xcd')](_0x2a1fbc)[_0x2e81('0xb1')](loggerCatch(_0x2e81('0x116')));this[_0x2e81('0xcb')](_0x2a1fbc)[_0x2e81('0xb1')](loggerCatch(_0x2e81('0x11a')));};Dialer[_0x2e81('0x1b')][_0x2e81('0x11b')]=function(_0x73e38b){var _0x4a32a3=this['uniqueId'][_0x73e38b[_0x2e81('0xde')]];var _0x3397bd=this;if(this['voiceQueues'][_0x73e38b[_0x2e81('0xb3')]]){if(_0x4a32a3&&_0x4a32a3[_0x2e81('0x4f')]!=='ivr'){delete this[_0x2e81('0xaa')][_0x73e38b['uniqueid']];this[_0x2e81('0xb5')](this['voiceQueues'][_0x73e38b[_0x2e81('0xb3')]]);_0x4a32a3[_0x2e81('0x11c')]=moment()['format'](_0x2e81('0xfd'));var _0xef7425=new QueueCallerAbandon(_0x4a32a3,_0x73e38b);if(getSeconds(_0x4a32a3[_0x2e81('0x11c')],_0x4a32a3[_0x2e81('0x11d')])>=_0x4a32a3[_0x2e81('0x11e')]){this[_0x2e81('0x20')][_0x73e38b[_0x2e81('0xb3')]][_0x2e81('0x6c')]+=0x1;this[_0x2e81('0x20')][_0x73e38b['queue']][_0x2e81('0x11f')]+=0x1;this[_0x2e81('0x20')][_0x73e38b[_0x2e81('0xb3')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0xef7425['state']=0xa;_0xef7425['statedesc']=_0x2e81('0x120');_0xef7425[_0x2e81('0x121')]=_0x2e81('0x122');_0xef7425[_0x2e81('0x114')]=this[_0x2e81('0x20')][_0x73e38b[_0x2e81('0xb3')]][_0x2e81('0x123')]?moment()[_0x2e81('0x79')](_0x2e81('0xfd')):undefined;_0xef7425[_0x2e81('0x106')]+=0x1;_0xef7425[_0x2e81('0xee')]+=0x1;if(_0xef7425['countdropretry']>=this[_0x2e81('0x20')][_0x73e38b[_0x2e81('0xb3')]][_0x2e81('0x124')]){this[_0x2e81('0x119')](_0xef7425);}else{this[_0x2e81('0xc1')]({'active':![],'countdropretry':_0xef7425[_0x2e81('0x106')],'scheduledat':moment()['add'](this['voiceQueues'][_0x73e38b[_0x2e81('0xb3')]][_0x2e81('0x125')],_0x2e81('0xfc'))[_0x2e81('0x79')](_0x2e81('0xfd')),'ContactId':_0x4a32a3[_0x2e81('0x10a')],'ListId':_0x4a32a3[_0x2e81('0xd4')],'VoiceQueueId':_0x4a32a3['VoiceQueueId']||undefined,'CampaignId':_0x4a32a3[_0x2e81('0xff')]||undefined})['catch'](loggerCatch(_0x2e81('0x126')));var _0x3b8c73=new History(_0xef7425);_0x3b8c73[_0x2e81('0xeb')]=0xa;_0x3b8c73[_0x2e81('0xa8')]=_0x2e81('0x120');_0x3b8c73[_0x2e81('0x127')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3b8c73['endtime']=_0x3b8c73['starttime'];_0x3b8c73[_0x2e81('0x128')]=_0xef7425[_0x2e81('0x128')];_0x3b8c73[_0x2e81('0x129')]=_0xef7425[_0x2e81('0x129')];this[_0x2e81('0xcd')](_0x3b8c73)[_0x2e81('0xb1')](loggerCatch(_0x2e81('0x12a')));}}else{this[_0x2e81('0x20')][_0x73e38b['queue']][_0x2e81('0x6b')]+=0x1;this[_0x2e81('0x20')][_0x73e38b[_0x2e81('0xb3')]][_0x2e81('0x12b')]+=0x1;_0xef7425[_0x2e81('0xeb')]=0xb;_0xef7425['statedesc']=_0x2e81('0x12c');_0xef7425[_0x2e81('0x121')]=_0x2e81('0x12d');_0xef7425['countabandonedretry']+=0x1;_0xef7425[_0x2e81('0xee')]+=0x1;if(_0xef7425[_0x2e81('0x107')]>=this[_0x2e81('0x20')][_0x73e38b[_0x2e81('0xb3')]]['dialAbandonedMaxRetry']){this[_0x2e81('0x119')](_0xef7425);}else{this[_0x2e81('0xc1')]({'active':![],'countabandonedretry':_0xef7425[_0x2e81('0x107')],'scheduledat':moment()['add'](this[_0x2e81('0x20')][_0x73e38b[_0x2e81('0xb3')]][_0x2e81('0x12e')],_0x2e81('0xfc'))[_0x2e81('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4a32a3[_0x2e81('0x10a')],'ListId':_0x4a32a3[_0x2e81('0xd4')],'VoiceQueueId':_0x4a32a3[_0x2e81('0xfe')]||undefined,'CampaignId':_0x4a32a3[_0x2e81('0xff')]||undefined})[_0x2e81('0xb1')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x3b8c73=new History(_0xef7425);_0x3b8c73[_0x2e81('0xeb')]=0xb;_0x3b8c73['statedesc']=_0x2e81('0x12c');_0x3b8c73[_0x2e81('0x127')]=moment()['format'](_0x2e81('0xfd'));_0x3b8c73['endtime']=_0x3b8c73[_0x2e81('0x127')];_0x3b8c73[_0x2e81('0x128')]=_0xef7425[_0x2e81('0x128')];_0x3b8c73[_0x2e81('0x129')]=_0xef7425['calleridnum'];this[_0x2e81('0xcd')](_0x3b8c73)[_0x2e81('0xb1')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0x2e81('0x1b')][_0x2e81('0x37')]=function(_0x459e40){if(this[_0x2e81('0x26')][_0x459e40[_0x2e81('0xde')]]){this[_0x2e81('0x26')][_0x459e40[_0x2e81('0xde')]]['channel']=_0x459e40[_0x2e81('0xb0')];}if(this[_0x2e81('0xaa')][_0x459e40[_0x2e81('0xde')]]){this[_0x2e81('0xaa')][_0x459e40[_0x2e81('0xde')]]['channel']=_0x459e40['channel'];}};Dialer[_0x2e81('0x1b')][_0x2e81('0x3b')]=function(_0x1bf955){if(strategy[this[_0x2e81('0x20')][this[_0x2e81('0x26')][_0x1bf955[_0x2e81('0x12f')]][_0x2e81('0xb3')]]['strategy']]===_0x2e81('0x1a')){if(this[_0x2e81('0x26')][_0x1bf955[_0x2e81('0x12f')]]&&_['isNil'](this['actions'][_0x1bf955[_0x2e81('0x12f')]][_0x2e81('0x130')])&&_0x1bf955[_0x2e81('0xaf')]==='1'&&_0x1bf955[_0x2e81('0x131')]==='0'){if(this[_0x2e81('0x22')][_0x1bf955[_0x2e81('0x132')]]){if(!this[_0x2e81('0x22')][_0x1bf955[_0x2e81('0x132')]][_0x2e81('0x130')]){this[_0x2e81('0x22')][_0x1bf955[_0x2e81('0x132')]][_0x2e81('0x130')]=!![];this[_0x2e81('0x26')][_0x1bf955[_0x2e81('0x12f')]][_0x2e81('0x130')]=!![];this[_0x2e81('0x26')][_0x1bf955[_0x2e81('0x12f')]][_0x2e81('0x132')]=_0x1bf955['stateinterface'];}}}}else if((strategy[this['voiceQueues'][this[_0x2e81('0x26')][_0x1bf955[_0x2e81('0x12f')]][_0x2e81('0xb3')]]['strategy']]||'rrmemory')==='rrmemory'){if(this[_0x2e81('0x26')][_0x1bf955[_0x2e81('0x12f')]]){if(this[_0x2e81('0x22')][_0x1bf955['stateinterface']]){this[_0x2e81('0x26')][_0x1bf955[_0x2e81('0x12f')]][_0x2e81('0x132')]=_0x1bf955[_0x2e81('0x132')];if(_['isNil'](this['queueBooked'][this[_0x2e81('0x26')][_0x1bf955[_0x2e81('0x12f')]]['queue']])){this[_0x2e81('0x2c')][this['actions'][_0x1bf955['actionid']][_0x2e81('0xb3')]]=[];}this['queueBooked'][this[_0x2e81('0x26')][_0x1bf955[_0x2e81('0x12f')]]['queue']][_0x2e81('0x133')](_[_0x2e81('0x8c')](_[_0x2e81('0x134')](this[_0x2e81('0x26')][_0x1bf955[_0x2e81('0x12f')]],['idHopper',_0x2e81('0x132')]),{'status':_0x1bf955['status'],'paused':_0x1bf955[_0x2e81('0x131')]}));}}}};function unlockQueueStatus(_0x388222,_0x3d00c2){setTimeout(function(){if(_[_0x2e81('0x3e')](_0x388222[_0x2e81('0x135')])){loggerBooked[_0x2e81('0x97')](_0x2e81('0x136'),_0x3d00c2);}_0x388222[_0x2e81('0x135')]=!![];loggerBooked[_0x2e81('0x7d')](_0x2e81('0x137'),_0x3d00c2,JSON['stringify'](_[_0x2e81('0x134')](_0x388222,[_0x2e81('0x41'),_0x2e81('0x135')])));},0x1f3);}Dialer[_0x2e81('0x1b')]['syncQueueStatusComplete']=function(_0x57816a){var _0x806f3b=this;var _0x30f84c=_0x806f3b[_0x2e81('0x20')][_0x806f3b['actions'][_0x57816a['actionid']][_0x2e81('0xb3')]];if(strategy[this['voiceQueues'][this[_0x2e81('0x26')][_0x57816a[_0x2e81('0x12f')]]['queue']][_0x2e81('0x138')]]===_0x2e81('0x1a')){if(this[_0x2e81('0x26')][_0x57816a[_0x2e81('0x12f')]]&&this[_0x2e81('0x26')][_0x57816a[_0x2e81('0x12f')]][_0x2e81('0x132')]){this['preview'][_0x2e81('0x139')](this[_0x2e81('0x26')][_0x57816a[_0x2e81('0x12f')]][_0x2e81('0x13a')],this[_0x2e81('0x26')][_0x57816a[_0x2e81('0x12f')]]['stateinterface'])[_0x2e81('0xb1')](function(_0x436a4b){logger[_0x2e81('0x97')](_0x2e81('0x13b'),util[_0x2e81('0x98')](_0x436a4b,{'showHidden':![],'depth':null}));})[_0x2e81('0x1e')](function(){_0x806f3b['updateOriginated'](_0x806f3b['voiceQueues'][_0x806f3b['actions'][_0x57816a[_0x2e81('0x12f')]]['queue']]);_0x806f3b['agents'][_0x806f3b[_0x2e81('0x26')][_0x57816a['actionid']][_0x2e81('0x132')]][_0x2e81('0x130')]=![];delete _0x806f3b[_0x2e81('0x26')][_0x57816a['actionid']];unlockQueueStatus(_0x30f84c);});}else{this[_0x2e81('0xb5')](this[_0x2e81('0x20')][this['actions'][_0x57816a[_0x2e81('0x12f')]]['queue']]);this[_0x2e81('0xc1')]({'active':![],'ContactId':this[_0x2e81('0x26')][_0x57816a['actionid']][_0x2e81('0x10a')],'ListId':this[_0x2e81('0x26')][_0x57816a[_0x2e81('0x12f')]][_0x2e81('0xd4')],'VoiceQueueId':this[_0x2e81('0x26')][_0x57816a['actionid']][_0x2e81('0xfe')]||undefined,'CampaignId':this[_0x2e81('0x26')][_0x57816a[_0x2e81('0x12f')]][_0x2e81('0xff')]||undefined})[_0x2e81('0xb1')](loggerCatch(_0x2e81('0x13c')));delete this[_0x2e81('0x26')][_0x57816a['actionid']];unlockQueueStatus(_0x30f84c);}}else if((strategy[this['voiceQueues'][this[_0x2e81('0x26')][_0x57816a['actionid']][_0x2e81('0xb3')]][_0x2e81('0x138')]]||_0x2e81('0x13d'))==='rrmemory'){var _0x4e8d78;if(this[_0x2e81('0x26')][_0x57816a[_0x2e81('0x12f')]]&&!_['isEmpty'](this[_0x2e81('0x2c')][this[_0x2e81('0x26')][_0x57816a['actionid']][_0x2e81('0xb3')]])){if(this[_0x2e81('0x2d')][_0x806f3b[_0x2e81('0x26')][_0x57816a[_0x2e81('0x12f')]][_0x2e81('0xb3')]]){this[_0x2e81('0x2d')][_0x806f3b[_0x2e81('0x26')][_0x57816a[_0x2e81('0x12f')]][_0x2e81('0xb3')]]=this[_0x2e81('0x2d')][this[_0x2e81('0x26')][_0x57816a[_0x2e81('0x12f')]][_0x2e81('0xb3')]]?this[_0x2e81('0x2d')][this[_0x2e81('0x26')][_0x57816a[_0x2e81('0x12f')]][_0x2e81('0xb3')]]:this[_0x2e81('0x2c')][this[_0x2e81('0x26')][_0x57816a[_0x2e81('0x12f')]][_0x2e81('0xb3')]]?this['queueBooked'][this['actions'][_0x57816a['actionid']][_0x2e81('0xb3')]][_0x2e81('0x13e')]||0x0:0x0;}this['queueBooked'][this['actions'][_0x57816a[_0x2e81('0x12f')]][_0x2e81('0xb3')]][_0x2e81('0x13e')]=this['queueBookedRR'][this[_0x2e81('0x26')][_0x57816a['actionid']][_0x2e81('0xb3')]];for(var _0x5cdf85=0x0;_0x5cdf85=0x0;})[_0x2e81('0xb1')](myreject(_0x281777)));}}else{_0x1b95c0[_0x2e81('0x133')](ami[_0x2e81('0xae')]({'action':_0x2e81('0x153'),'command':util[_0x2e81('0x79')](_0x2e81('0x154'),_0x5dbe5e,!_[_0x2e81('0x3e')](config['timezones'][_0x1b1763])?_0x1b1763:'')})[_0x2e81('0xb8')](function(_0x17da71){return _0x17da71[_0x2e81('0x156')][_0x2e81('0x157')](_0x2e81('0x158'))>=0x0;})[_0x2e81('0xb1')](myreject(_0x281777)));}BPromise[_0x2e81('0x159')](_0x1b95c0)[_0x2e81('0xb8')](function(_0x3a7937){var _0xa9d213=_['some'](_0x3a7937);if(_0xa9d213){return _0x4d3139(_0xa9d213);}else{_0x41dbe6['message']=_0x4189ec?'GLOBAL_INTERVAL_IS_OVERTIME':_0x2e81('0x15a');return _0x281777(msgResponse(_0x2e81('0x15b'),'Failure',_0x2e81('0x15c')+_0x4189ec+'\x20'+_0x2c4add+'\x20Interval\x20is\x20overtime:\x20'+util[_0x2e81('0x98')](_0x5dbe5e,{'showHidden':![],'depth':null})+_0x2e81('0x15d')+_0x1b1763));}})[_0x2e81('0xb1')](function(_0x2c4e93){return _0x281777(msgResponse(_0x2e81('0x14c'),_0x2e81('0x14d'),JSON[_0x2e81('0x4c')](_0x2c4e93)));});});};Dialer[_0x2e81('0x1b')][_0x2e81('0x15e')]=function(_0x33091c){var _0x1310ca=this;return function(){switch(_0x33091c[_0x2e81('0x5d')]){case _0x2e81('0x15f'):freeVariablesPredictive(_0x33091c);_0x1310ca[_0x2e81('0x160')](_0x33091c,0x1);break;case _0x2e81('0x161'):freeVariablesPredictive(_0x33091c);_0x1310ca['handlePower'](_0x33091c,_0x33091c[_0x2e81('0x162')]);break;case _0x2e81('0x7'):_0x1310ca[_0x2e81('0x7')](_0x33091c);break;case _0x2e81('0x6'):freeVariablesPredictive(_0x33091c);_0x1310ca[_0x2e81('0x160')](_0x33091c,0x1);break;default:freeVariablesPredictive(_0x33091c);logger[_0x2e81('0x97')](_0x2e81('0x163'),_0x33091c[_0x2e81('0x41')],_0x2e81('0x164'));}};};Dialer[_0x2e81('0x1b')][_0x2e81('0x165')]=function(_0x26c224){var _0x4bb7c6=this;return function(){_0x4bb7c6[_0x2e81('0x166')](_0x26c224);};};Dialer['prototype'][_0x2e81('0x9')]=function(_0xacf4d4){var _0xfafdd2=this;if(isNotPreview(_0xacf4d4[_0x2e81('0x5d')])){if(isVoiceQueueOutbound(_0xacf4d4[_0x2e81('0x4f')])&&isActive(_0xacf4d4[_0x2e81('0x5c')])){_0xacf4d4[_0x2e81('0xa3')]=!![];BPromise[_0x2e81('0xbc')]()[_0x2e81('0xb8')](checkIsLoggedIn(_0xacf4d4,_0xacf4d4['loggedIn']))['then'](checkIsActive(_0xacf4d4,_0xacf4d4[_0x2e81('0x5c')]))['then'](checkInterval(_0xacf4d4))[_0x2e81('0xb8')](_0xfafdd2[_0x2e81('0x148')](_0xacf4d4))[_0x2e81('0xb8')](_0xfafdd2['checkIfTime'](_0xacf4d4[_0x2e81('0x167')],_0xacf4d4[_0x2e81('0x168')],_0xacf4d4['name'],_0xacf4d4))[_0x2e81('0xb8')](_0xfafdd2['checkIfTimeIntervals'](_0xacf4d4[_0x2e81('0x45')],_0xacf4d4[_0x2e81('0x168')],_0xacf4d4[_0x2e81('0x41')],_0xacf4d4))[_0x2e81('0xb8')](_0xfafdd2[_0x2e81('0x15e')](_0xacf4d4))[_0x2e81('0xb1')](loggerCatchQueueSummary(_0x2e81('0x169'),_0xacf4d4));}else{notSendMessagesQueue(_0xacf4d4);}}else{freeVariablesPredictive(_0xacf4d4);}};Dialer[_0x2e81('0x1b')][_0x2e81('0x147')]=function(){var _0x5bb627=this;var _0x5d9260;for(var _0x23fb23 in this['campaigns']){if(typeof this[_0x2e81('0x21')][_0x23fb23]!==_0x2e81('0x9a')){_0x5d9260=this[_0x2e81('0x21')][_0x23fb23];if(isCampaignIvr(_0x5d9260[_0x2e81('0x4f')])&&isActive(_0x5d9260[_0x2e81('0xda')])){_0x5d9260[_0x2e81('0xa3')]=!![];BPromise['resolve']()[_0x2e81('0xb8')](checkIsActive(_0x5d9260,_0x5d9260[_0x2e81('0xda')]))[_0x2e81('0xb8')](checkInterval(_0x5d9260))[_0x2e81('0xb8')](_0x5bb627['checkIsTrunkReachable'](_0x5d9260))[_0x2e81('0xb8')](_0x5bb627[_0x2e81('0x16a')](_0x5d9260[_0x2e81('0x167')],_0x5d9260[_0x2e81('0x168')],_0x5d9260[_0x2e81('0x41')],_0x5d9260))[_0x2e81('0xb8')](_0x5bb627[_0x2e81('0x16b')](_0x5d9260[_0x2e81('0x45')],_0x5d9260['dialTimezone'],_0x5d9260[_0x2e81('0x41')],_0x5d9260))[_0x2e81('0xb8')](_0x5bb627['launchHandleIvr'](_0x5d9260))[_0x2e81('0xb1')](loggerCatchQueueSummary(_0x2e81('0x16c'),_0x5d9260));}else{notSendMessagesCampaign(_0x5d9260);}}}};function getCallerIdRandom(_0x26ceb0,_0x4dd6b9){var _0x2b335f;var _0x5b456b;var _0x24512a;if(_0x4dd6b9<=0x0){_0x4dd6b9=0x1;}_0x2b335f=new RegExp(_0x2e81('0x16d')+_0x4dd6b9+'}$');_0x5b456b=Math[_0x2e81('0x16e')](0xa,_0x4dd6b9-0x1);_0x24512a=Math[_0x2e81('0x16e')](0xa,_0x4dd6b9)-0x1;return util[_0x2e81('0x79')]('%s',_[_0x2e81('0x16f')](_0x26ceb0,_0x2b335f,_[_0x2e81('0x170')](_0x5b456b,_0x24512a)));}function extractCalleridName(_0x1c04c0){var _0x231370=_0x1c04c0[_0x2e81('0x171')](/"(.*?)"/);return _0x231370?_0x231370[0x1]:_0x1c04c0;}function extractCalleridNumber(_0x5da1e6){var _0x5ec10b=_0x5da1e6['match'](/<(.*?)>/);return _0x5ec10b?_0x5ec10b[0x1]:_0x5da1e6;}Dialer['prototype'][_0x2e81('0x172')]=function(_0x2e685e,_0x5efe6e){var _0x31f16c=this;var _0x40b977=uuid['v4']();this[_0x2e81('0x26')][_0x40b977]=new Action(_0x2e685e,_0x5efe6e,_0x40b977);return new BPromise(function(_0x249bf1,_0xd98777){if(_[_0x2e81('0x3e')](_0x2e685e)&&typeof _0x2e685e!==_0x2e81('0x173')){return _0xd98777(msgResponse('originate',_0x2e81('0x14d'),'voiceQueue\x20is\x20undefine'));}if(_[_0x2e81('0x3e')](_0x5efe6e[_0x2e81('0x174')][_0x2e81('0x175')])||_0x5efe6e[_0x2e81('0x174')][_0x2e81('0x175')]===null){return _0xd98777(msgResponse('originate',_0x2e81('0x14d'),_0x2e81('0x176')));}var _0xd9dbd3={'XMD-CALLERID':_0x31f16c['actions'][_0x40b977][_0x2e81('0x177')](),'XMD-AGI':_0x2e685e[_0x2e81('0x10e')]?util[_0x2e81('0x79')](_0x2e81('0x178'),ipAgi,_0x2e685e[_0x2e81('0x10e')]):_0x2e81('0x179'),'XMD-AGIAFTER':_0x2e685e[_0x2e81('0x123')]?util[_0x2e81('0x79')](_0x2e81('0x178'),ipAgi,_0x2e685e[_0x2e81('0x123')]):'NONE','XMD-QUEUE':_0x2e685e['type']===_0x2e81('0x50')?util['format'](_0x2e81('0x17a'),_0x2e685e[_0x2e81('0x41')],_0x2e685e[_0x2e81('0x17b')]||'',_0x2e685e[_0x2e81('0x115')]?'c':'',_0x2e685e[_0x2e81('0x11e')]||0x3):'NONE','XMD-CONTACTID':_0x5efe6e[_0x2e81('0x10a')],'XMD-CDRTYPE':_0x2e81('0x17c'),'CALLERID(all)':_0x31f16c[_0x2e81('0x26')][_0x40b977][_0x2e81('0x177')](),'XMD-AMD':_0x2e685e[_0x2e81('0xe3')]?_0x2e81('0x17d'):'NONE','XMD-DESTINATION':_0x2e81('0xe2')};if(_0x2e685e[_0x2e81('0xe3')]){_0xd9dbd3[_0x2e81('0x17e')]=_0x2e685e[_0x2e81('0x17f')]||0x9c4;_0xd9dbd3[_0x2e81('0x180')]=_0x2e685e[_0x2e81('0x181')]||0x5dc;_0xd9dbd3[_0x2e81('0x182')]=_0x2e685e['dialAMDAfterGreetingSilence']||0x320;_0xd9dbd3[_0x2e81('0x183')]=_0x2e685e[_0x2e81('0x184')]||0x1388;_0xd9dbd3[_0x2e81('0x185')]=_0x2e685e[_0x2e81('0x186')]||0x64;_0xd9dbd3[_0x2e81('0x187')]=_0x2e685e['dialAMDBetweenWordsSilence']||0x32;_0xd9dbd3[_0x2e81('0x188')]=_0x2e685e[_0x2e81('0x189')]||0x3;_0xd9dbd3[_0x2e81('0x18a')]=_0x2e685e[_0x2e81('0x18b')]||0x100;_0xd9dbd3[_0x2e81('0x18c')]=_0x2e685e['dialAMDMaximumWordLength']||0x1388;}if(_0x2e685e[_0x2e81('0x4f')]===_0x2e81('0x50')){_0xd9dbd3[_0x2e81('0x18d')]=_0x5efe6e[_0x2e81('0xfe')];}else{_0xd9dbd3[_0x2e81('0x18e')]=_0x5efe6e[_0x2e81('0xff')];}for(var _0x26f197 in _0x5efe6e[_0x2e81('0x174')]){if(typeof _0x5efe6e[_0x2e81('0x174')][_0x26f197]!==_0x2e81('0x9a')){if(isNotNull(_0x5efe6e['Contact'][_0x26f197])&&_0x26f197!=='id'&&_0x26f197!==_0x2e81('0x18f')&&_0x26f197!==_0x2e81('0x190')&&_0x26f197!==_0x2e81('0x191')){_0xd9dbd3[util['format'](_0x2e81('0x192'),_0x2e81('0x193'),_[_0x2e81('0x194')](_0x26f197))]=_0x5efe6e['Contact'][_0x26f197];}}}var _0x51b46b=_0x31f16c[_0x2e81('0xd9')](_0x2e685e[_0x2e81('0x77')])?getCallerId(_0x2e685e[_0x2e81('0x77')][_0x2e81('0x78')],_0x2e685e[_0x2e81('0x195')],_0x2e685e[_0x2e81('0x196')]>0x0?getCallerIdRandom(_0x2e685e[_0x2e81('0x197')],_0x2e685e[_0x2e81('0x196')]):_0x2e685e[_0x2e81('0x197')]):getCallerId(_[_0x2e81('0xdf')](_0x2e685e[_0x2e81('0x149')])?_0x2e685e['Trunk'][_0x2e81('0x78')]:_0x2e685e[_0x2e81('0x149')]['callerid'],_0x2e685e['dialOriginateCallerIdName'],_0x2e685e[_0x2e81('0x196')]>0x0?getCallerIdRandom(_0x2e685e[_0x2e81('0x197')],_0x2e685e[_0x2e81('0x196')]):_0x2e685e['dialOriginateCallerIdNumber']);if(_0x51b46b){_0xd9dbd3[_0x2e81('0x198')]=_0x31f16c['actions'][_0x40b977]['originatecalleridname']=extractCalleridName(_0x51b46b);_0xd9dbd3[_0x2e81('0x199')]=_0x31f16c[_0x2e81('0x26')][_0x40b977][_0x2e81('0x19a')]=extractCalleridNumber(_0x51b46b);}return ami[_0x2e81('0xae')]({'actionid':_0x40b977,'action':_0x2e81('0x19b'),'channel':_0x31f16c['isTrunkReachable'](_0x2e685e[_0x2e81('0x77')])?util[_0x2e81('0x79')](_0x2e81('0x19c'),_0x2e685e[_0x2e81('0x77')][_0x2e81('0x41')],isNotNull(_0x2e685e[_0x2e81('0x19d')])?_0x2e685e[_0x2e81('0x19d')][_0x2e81('0x19e')]()||'':'',_0x2e685e[_0x2e81('0x19f')]>0x0?_0x5efe6e[_0x2e81('0x174')][_0x2e81('0x175')][_0x2e81('0x1a0')](_0x2e685e[_0x2e81('0x19f')]):_0x5efe6e['Contact'][_0x2e81('0x175')]):util['format'](_0x2e81('0x19c'),_[_0x2e81('0xdf')](_0x2e685e[_0x2e81('0x149')])?_0x2e685e[_0x2e81('0x77')]['name']:_0x2e685e[_0x2e81('0x149')]['name'],isNotNull(_0x2e685e[_0x2e81('0x19d')])?_0x2e685e[_0x2e81('0x19d')][_0x2e81('0x19e')]()||'':'',_0x2e685e[_0x2e81('0x19f')]>0x0?_0x5efe6e[_0x2e81('0x174')][_0x2e81('0x175')][_0x2e81('0x1a0')](_0x2e685e['dialCutDigit']):_0x5efe6e[_0x2e81('0x174')][_0x2e81('0x175')]),'callerid':_0x51b46b,'Exten':_0x2e81('0xe2'),'Context':_0x2e81('0x1a1'),'Priority':'1','variable':_0xd9dbd3,'timeout':(_0x2e685e[_0x2e81('0x5e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x40b977})[_0x2e81('0xb8')](function(_0x33ccf1){return _0x249bf1(_0x33ccf1);})[_0x2e81('0xb1')](function(_0x20ac6a){_0x2e685e[_0x2e81('0x67')]+=0x1;var _0x33c638=new History(_0x31f16c[_0x2e81('0x26')][_0x40b977]);logger[_0x2e81('0x97')](util[_0x2e81('0x79')](_0x2e81('0x1a2'),JSON[_0x2e81('0x4c')](_0x20ac6a)));_0x33c638[_0x2e81('0xeb')]=0xe;_0x33c638[_0x2e81('0xa8')]=_0x2e81('0x1a3');_0x33c638[_0x2e81('0x127')]=moment()[_0x2e81('0x79')]('YYYY-MM-DD\x20HH:mm:ss');_0x33c638['endtime']=_0x33c638[_0x2e81('0x127')];_0x31f16c[_0x2e81('0xcd')](_0x33c638)[_0x2e81('0xb1')](loggerCatch(_0x2e81('0x1a4')));_0x31f16c['moveContactManagedDialer'](_0x33c638)['catch'](loggerCatch(_0x2e81('0x1a4')))[_0x2e81('0x1e')](function(){delete _0x31f16c[_0x2e81('0x26')][_0x40b977];return _0xd98777(msgResponse(_0x2e81('0x19b'),_0x2e81('0x4b'),_0x2e81('0x1a5')));});});});};Dialer['prototype'][_0x2e81('0x32')]=function(_0x2a521d){var _0x386dbc=this['actions'][_0x2a521d[_0x2e81('0x12f')]];if(_0x386dbc){delete this[_0x2e81('0x26')][_0x2a521d['actionid']];_0x386dbc[_0x2e81('0x11d')]=moment()['format'](_0x2e81('0xfd'));var _0x1b436a=_0x386dbc[_0x2e81('0x4f')]===_0x2e81('0x93')?this['campaigns'][_0x386dbc['queue']]:this[_0x2e81('0x20')][_0x386dbc['getQueue']()];if(!this['isSuccess'](_0x2a521d[_0x2e81('0x1a6')])){this[_0x2e81('0xb5')](_0x1b436a);return this[_0x2e81('0x1a7')](_0x386dbc,_0x1b436a,_0x2a521d)[_0x2e81('0xb1')](loggerCatch(_0x2e81('0x1a8')));}this[_0x2e81('0xaa')][_0x2a521d[_0x2e81('0xde')]]=_0x386dbc;}};Dialer[_0x2e81('0x1b')][_0x2e81('0x1a9')]=function(_0xdceb74,_0x196dae,_0xf3f431){var _0x245d4f=new History(_0x196dae);if(_0x245d4f['countbusyretry']+_0x245d4f[_0x2e81('0xf2')]+_0x245d4f[_0x2e81('0xf3')]+_0x245d4f['countnosuchnumberretry']+_0x245d4f[_0x2e81('0x106')]+_0x245d4f['countabandonedretry']+_0x245d4f['countmachineretry']+_0x245d4f[_0x2e81('0xf5')]>=_0xf3f431[_0x2e81('0xf6')]-0x1){return!![];}switch(_0xdceb74){case 0x3:if(_0x245d4f[_0x2e81('0xf3')]>=_0xf3f431['dialNoAnswerMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x245d4f['countnoanswerretry']+=0x1,'scheduledat':moment()['add'](_0xf3f431[_0x2e81('0x1aa')],_0x2e81('0xfc'))[_0x2e81('0x79')](_0x2e81('0xfd')),'ContactId':_0x245d4f[_0x2e81('0x10a')],'ListId':_0x245d4f[_0x2e81('0xd4')],'VoiceQueueId':_0x245d4f[_0x2e81('0xfe')]||undefined,'CampaignId':_0x245d4f['CampaignId']||undefined})['catch'](loggerCatch(_0x2e81('0x1ab')));break;case 0x5:if(_0x245d4f[_0x2e81('0xf1')]>=_0xf3f431[_0x2e81('0x1ac')]-0x1){return!![];}this[_0x2e81('0xc1')]({'active':![],'countbusyretry':_0x245d4f[_0x2e81('0xf1')]+=0x1,'scheduledat':moment()[_0x2e81('0xfa')](_0xf3f431[_0x2e81('0x1ad')],_0x2e81('0xfc'))[_0x2e81('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x245d4f['ContactId'],'ListId':_0x245d4f[_0x2e81('0xd4')],'VoiceQueueId':_0x245d4f[_0x2e81('0xfe')]||undefined,'CampaignId':_0x245d4f[_0x2e81('0xff')]||undefined})[_0x2e81('0xb1')](loggerCatch(_0x2e81('0x1ae')));break;case 0x8:if(_0x245d4f[_0x2e81('0xf2')]>=_0xf3f431['dialCongestionMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x245d4f[_0x2e81('0xf2')]+=0x1,'scheduledat':moment()[_0x2e81('0xfa')](_0xf3f431['dialCongestionRetryFrequency'],_0x2e81('0xfc'))[_0x2e81('0x79')](_0x2e81('0xfd')),'ContactId':_0x245d4f[_0x2e81('0x10a')],'ListId':_0x245d4f[_0x2e81('0xd4')],'VoiceQueueId':_0x245d4f[_0x2e81('0xfe')]||undefined,'CampaignId':_0x245d4f['CampaignId']||undefined})['catch'](loggerCatch(_0x2e81('0x1af')));break;case 0x0:if(_0x245d4f['countnosuchnumberretry']>=_0xf3f431[_0x2e81('0x1b0')]-0x1){return!![];}else{this[_0x2e81('0xc1')]({'active':![],'countnosuchnumberretry':_0x245d4f['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x2e81('0xfa')](_0xf3f431['dialNoSuchNumberRetryFrequency'],_0x2e81('0xfc'))[_0x2e81('0x79')](_0x2e81('0xfd')),'ContactId':_0x245d4f[_0x2e81('0x10a')],'ListId':_0x245d4f[_0x2e81('0xd4')],'VoiceQueueId':_0x245d4f[_0x2e81('0xfe')]||undefined,'CampaignId':_0x245d4f[_0x2e81('0xff')]||undefined})[_0x2e81('0xb1')](loggerCatch(_0x2e81('0x1b1')));}break;case 0xa:if(_0x245d4f[_0x2e81('0x106')]>=_0xf3f431['dialDropMaxRetry']-0x1){return!![];}this[_0x2e81('0xc1')]({'active':![],'countdropretry':_0x245d4f[_0x2e81('0x106')]+=0x1,'scheduledat':moment()[_0x2e81('0xfa')](_0xf3f431[_0x2e81('0x125')],_0x2e81('0xfc'))[_0x2e81('0x79')](_0x2e81('0xfd')),'ContactId':_0x245d4f['ContactId'],'ListId':_0x245d4f[_0x2e81('0xd4')],'VoiceQueueId':_0x245d4f[_0x2e81('0xfe')]||undefined,'CampaignId':_0x245d4f['CampaignId']||undefined})['catch'](loggerCatch(_0x2e81('0x126')));break;case 0xb:if(_0x245d4f[_0x2e81('0x107')]>=_0xf3f431[_0x2e81('0x1b2')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x245d4f[_0x2e81('0x107')]+=0x1,'scheduledat':moment()[_0x2e81('0xfa')](_0xf3f431[_0x2e81('0x12e')],_0x2e81('0xfc'))[_0x2e81('0x79')](_0x2e81('0xfd')),'ContactId':_0x245d4f['ContactId'],'ListId':_0x245d4f['ListId'],'VoiceQueueId':_0x245d4f[_0x2e81('0xfe')]||undefined,'CampaignId':_0x245d4f[_0x2e81('0xff')]||undefined})['catch'](loggerCatch(_0x2e81('0x1b3')));break;case 0x13:if(_0x245d4f[_0x2e81('0xed')]>=_0xf3f431[_0x2e81('0xf8')]-0x1){return!![];}this[_0x2e81('0xc1')]({'active':![],'countmachineretry':_0x245d4f[_0x2e81('0xed')]+=0x1,'scheduledat':moment()['add'](_0xf3f431[_0x2e81('0xfb')],'minutes')[_0x2e81('0x79')](_0x2e81('0xfd')),'ContactId':_0x245d4f['ContactId'],'ListId':_0x245d4f[_0x2e81('0xd4')],'VoiceQueueId':_0x245d4f[_0x2e81('0xfe')]||undefined,'CampaignId':_0x245d4f['CampaignId']||undefined})[_0x2e81('0xb1')](loggerCatch(_0x2e81('0x100')));break;case 0x14:if(_0x245d4f['countagentrejectretry']>=_0xf3f431['dialAgentRejectMaxRetry']-0x1){return!![];}this[_0x2e81('0xc1')]({'active':![],'countagentrejectretry':_0x245d4f[_0x2e81('0xf5')]+=0x1,'scheduledat':moment()[_0x2e81('0xfa')](_0xf3f431[_0x2e81('0x1b4')],_0x2e81('0xfc'))[_0x2e81('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x245d4f[_0x2e81('0x10a')],'ListId':_0x245d4f['ListId'],'VoiceQueueId':_0x245d4f['VoiceQueueId']||undefined,'CampaignId':_0x245d4f[_0x2e81('0xff')]||undefined})['catch'](loggerCatch(_0x2e81('0x1b5')));break;default:return!![];}};Dialer['prototype'][_0x2e81('0x1a7')]=function(_0x4d64f3,_0x232395,_0x5d45e3){var _0x291476=this;var _0x47a52a=new History(_0x4d64f3);return new BPromise(function(_0x433d45,_0x5718af){if(_['isUndefined'](_0x232395)&&typeof _0x232395!==_0x2e81('0x173')){return _0x5718af(msgResponse(_0x2e81('0x1b6'),_0x2e81('0x14d'),_0x2e81('0x1b7')));}if(_[_0x2e81('0x3e')](_0x5d45e3)&&typeof _0x5d45e3!==_0x2e81('0x173')){return _0x5718af(msgResponse(_0x2e81('0x1b6'),_0x2e81('0x14d'),_0x2e81('0x1b8')));}switch(_0x5d45e3[_0x2e81('0x113')]){case'0':_0x232395[_0x2e81('0x66')]+=0x1;_0x47a52a['state']=0x0;_0x47a52a[_0x2e81('0xa8')]='NoSuchNumber';_0x47a52a['countnosuchnumberretry']+=0x1;_0x47a52a[_0x2e81('0xee')]+=0x1;ami[_0x2e81('0x4e')]('custom:agentnosuchnumber',ut[_0x2e81('0xe8')](_0x4d64f3,_0x2e81('0x1b9')));_0x291476[_0x2e81('0xcd')](_0x47a52a)[_0x2e81('0xb1')](loggerCatch(_0x2e81('0xf0')));if(_0x291476[_0x2e81('0x1a9')](0x0,_0x4d64f3,_0x232395)){if(_0x47a52a['countnosuchnumberretry']>=_0x232395[_0x2e81('0x1b0')]){_0x291476[_0x2e81('0x109')](_0x47a52a,_0x433d45,_0x5718af,_0x2e81('0x1ba'));}else{_0x291476[_0x2e81('0xf7')](_0x47a52a,_0x433d45,_0x5718af,_0x2e81('0x1ba'));}}break;case'3':_0x232395[_0x2e81('0x65')]+=0x1;_0x47a52a[_0x2e81('0xeb')]=0x3;_0x47a52a[_0x2e81('0xa8')]='NoAnswer';_0x47a52a['countnoanswerretry']+=0x1;_0x47a52a['countglobal']+=0x1;ami[_0x2e81('0x4e')](_0x2e81('0x1bb'),ut['buildObj'](_0x4d64f3,_0x2e81('0x1bc')));_0x291476['createHistory'](_0x47a52a)['catch'](loggerCatch(_0x2e81('0x1bd')));if(_0x291476[_0x2e81('0x1a9')](0x3,_0x4d64f3,_0x232395)){if(_0x47a52a[_0x2e81('0xf3')]>=_0x232395['dialNoAnswerMaxRetry']){_0x291476['createStateFinal'](_0x47a52a,_0x433d45,_0x5718af,_0x2e81('0x1be'));}else{_0x291476['stateGlobal'](_0x47a52a,_0x433d45,_0x5718af,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x232395[_0x2e81('0x62')]+=0x1;_0x47a52a['state']=0x5;_0x47a52a['statedesc']=_0x2e81('0x1bf');_0x47a52a[_0x2e81('0xf1')]+=0x1;_0x47a52a[_0x2e81('0xee')]+=0x1;ami[_0x2e81('0x4e')]('custom:agentbusy',ut[_0x2e81('0xe8')](_0x4d64f3,_0x2e81('0x1c0')));_0x291476[_0x2e81('0xcd')](_0x47a52a)[_0x2e81('0xb1')](loggerCatch(_0x2e81('0x1c1')));if(_0x291476[_0x2e81('0x1a9')](0x5,_0x4d64f3,_0x232395)){if(_0x47a52a[_0x2e81('0xf1')]>=_0x232395['dialBusyMaxRetry']){_0x291476['createStateFinal'](_0x47a52a,_0x433d45,_0x5718af,'reason\x205\x20busy');}else{_0x291476[_0x2e81('0xf7')](_0x47a52a,_0x433d45,_0x5718af,_0x2e81('0x1c2'));}}break;case'8':_0x232395[_0x2e81('0x63')]+=0x1;_0x47a52a[_0x2e81('0xeb')]=0x8;_0x47a52a[_0x2e81('0xa8')]=_0x2e81('0x1c3');_0x47a52a['countcongestionretry']+=0x1;_0x47a52a[_0x2e81('0xee')]+=0x1;ami[_0x2e81('0x4e')](_0x2e81('0x1c4'),ut['buildObj'](_0x4d64f3,_0x2e81('0x1c5')));_0x291476[_0x2e81('0xcd')](_0x47a52a)[_0x2e81('0xb1')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x291476[_0x2e81('0x1a9')](0x8,_0x4d64f3,_0x232395)){if(_0x47a52a[_0x2e81('0xf2')]>=_0x232395['dialCongestionMaxRetry']){_0x291476['createStateFinal'](_0x47a52a,_0x433d45,_0x5718af,'reason\x208\x20congestion');}else{_0x291476['stateGlobal'](_0x47a52a,_0x433d45,_0x5718af,_0x2e81('0x1c6'));}}break;case'11':_0x232395['outboundAbandonedCallsDay']+=0x1;_0x47a52a[_0x2e81('0xeb')]=0xb;_0x47a52a['statedesc']=_0x2e81('0x12c');_0x47a52a[_0x2e81('0x107')]+=0x1;_0x47a52a[_0x2e81('0xee')]+=0x1;_0x291476[_0x2e81('0xcd')](_0x47a52a)['catch'](loggerCatch(_0x2e81('0x1c7')));if(_0x291476[_0x2e81('0x1a9')](0xb,_0x4d64f3,_0x232395)){if(_0x47a52a['countabandonedretry']>=_0x232395['dialAbandonedMaxRetry']){_0x291476[_0x2e81('0x109')](_0x47a52a,_0x433d45,_0x5718af,_0x2e81('0x1c8'));}else{_0x291476[_0x2e81('0xf7')](_0x47a52a,_0x433d45,_0x5718af,'reason\x2011\x20abandoned');}}break;case'20':_0x232395[_0x2e81('0x68')]+=0x1;_0x47a52a['state']=0x14;_0x47a52a[_0x2e81('0xa8')]='AgentReject';_0x47a52a[_0x2e81('0xf5')]+=0x1;_0x47a52a[_0x2e81('0xee')]+=0x1;ami[_0x2e81('0x4e')](_0x2e81('0x1c9'),ut['buildObj'](_0x4d64f3,'agentreject'));_0x291476[_0x2e81('0xcd')](_0x47a52a)[_0x2e81('0xb1')](loggerCatch(_0x2e81('0x1ca')));if(_0x291476['checkRetriveMax'](0x14,_0x4d64f3,_0x232395)){if(_0x47a52a[_0x2e81('0xf5')]>=_0x232395[_0x2e81('0x1cb')]){_0x291476[_0x2e81('0x109')](_0x47a52a,_0x433d45,_0x5718af,_0x2e81('0x1cc'));}else{_0x291476[_0x2e81('0xf7')](_0x47a52a,_0x433d45,_0x5718af,_0x2e81('0x1cc'));}}break;default:_0x232395[_0x2e81('0x69')]+=0x1;_0x47a52a[_0x2e81('0xeb')]=0xc;_0x47a52a[_0x2e81('0xa8')]=_0x5d45e3[_0x2e81('0x113')];_0x291476[_0x2e81('0xcd')](_0x47a52a)['catch'](loggerCatch(_0x2e81('0x1cd')));if(_0x291476['checkRetriveMax'](_0x5d45e3[_0x2e81('0x113')],_0x4d64f3,_0x232395)){if(_0x47a52a[_0x2e81('0xf1')]+_0x47a52a[_0x2e81('0xf2')]+_0x47a52a[_0x2e81('0xf3')]+_0x47a52a['countnosuchnumberretry']+_0x47a52a['countdropretry']+_0x47a52a[_0x2e81('0x107')]+_0x47a52a['countmachineretry']+_0x47a52a['countagentrejectretry']>=_0x232395['dialGlobalMaxRetry']){_0x291476[_0x2e81('0xf7')](_0x47a52a,_0x433d45,_0x5718af,_0x5d45e3[_0x2e81('0x113')]);}else{_0x291476[_0x2e81('0x109')](_0x47a52a,_0x433d45,_0x5718af,_0x5d45e3[_0x2e81('0x113')]);}}}});};Dialer['prototype'][_0x2e81('0xf7')]=function(_0x5d534c,_0x1e71b2,_0x5f5c26,_0x1c182c){var _0x400207=new Final(_0x5d534c);_0x400207['state']=0xf;_0x400207[_0x2e81('0xa8')]=_0x2e81('0x1ce');this[_0x2e81('0x109')](_0x400207,_0x1e71b2,_0x5f5c26,_0x1c182c);};Dialer['prototype'][_0x2e81('0x109')]=function(_0x125ccb,_0x2948ef,_0x5eec0b,_0x1e59c1){this[_0x2e81('0xcb')](_0x125ccb)[_0x2e81('0xb8')](function(){return _0x2948ef(msgResponse(_0x2e81('0x1b6'),'Success',_0x1e59c1));})[_0x2e81('0xb1')](function(){return _0x5eec0b(msgResponse('[moveContactManagedDialer][0]',_0x2e81('0x14d'),'contact\x20not\x20moved'));});};Dialer[_0x2e81('0x1b')][_0x2e81('0x7')]=function(_0xcec148){var _0x166940=_0xcec148['dialPredictiveOptimizationPercentage']/0x64;var _0x516f0b=_0xcec148[_0x2e81('0x11f')]/(_0xcec148['outboundDropCallsDayTimeout']+_0xcec148[_0x2e81('0x60')]);var _0x5cd96f=Math[_0x2e81('0x1cf')](_0xcec148[_0x2e81('0x70')]*(_0xcec148[_0x2e81('0x1d0')]/0x64));var _0x48aa3c=Math['round'](_0xcec148[_0x2e81('0x70')]*(_0xcec148[_0x2e81('0x1d1')]/0x64));var _0x283914=_0xcec148[_0x2e81('0x52')]+_0xcec148[_0x2e81('0xa1')];var _0x19b170=Math['floor'](_0xcec148['erlangCalls']*_0xcec148[_0x2e81('0x75')]*_0xcec148[_0x2e81('0x1d2')]*_0xcec148[_0x2e81('0x6f')]);if(_[_0x2e81('0x3e')](_0xcec148[_0x2e81('0x2a')])){if(!_['isUndefined'](_0xcec148[_0x2e81('0x29')])){_0xcec148[_0x2e81('0x29')]=undefined;loggerPredictive[_0x2e81('0x97')](_0x2e81('0x1d3'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x2e81('0x3e')](_0xcec148[_0x2e81('0x90')])){loggerPredictive[_0x2e81('0x97')](_0x2e81('0x1d3'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0xcec148['handlePredictive']);_0xcec148[_0x2e81('0x90')]=undefined;}_0xcec148[_0x2e81('0x2a')]=moment()[_0x2e81('0x79')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x2e81('0x7d')](_0xcec148[_0x2e81('0x41')],_0x2e81('0x1d4'),_0xcec148[_0x2e81('0x2a')]);this[_0x2e81('0x160')](_0xcec148,0x1);}else if(ifInterval(_0xcec148[_0x2e81('0x1d5')],_0xcec148[_0x2e81('0x2a')])){this[_0x2e81('0x160')](_0xcec148,0x1);loggerPredictiveCalls[_0x2e81('0x7d')](_0x2e81('0x1d6'),_0xcec148[_0x2e81('0x2a')],_0xcec148[_0x2e81('0x41')]);_0xcec148[_0x2e81('0x73')]=0x0;_0xcec148[_0x2e81('0x6e')]=0x0;}else if(_0x166940<_0x516f0b&&_0xcec148[_0x2e81('0x1d7')]===_0x2e81('0x1d8')){freeVariablesPredictive(_0xcec148);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x2e81('0x1d9'),_0x516f0b,_0x2e81('0x2a'),_0xcec148['name']);}else if(_0x19b170<_0xcec148[_0x2e81('0x6e')]&&_0xcec148[_0x2e81('0x1d7')]===_0x2e81('0x1d8')){freeVariablesPredictive(_0xcec148);loggerPredictive[_0x2e81('0x7d')](_0x2e81('0x1da'),_0x2e81('0x1db'),_0x19b170,_0x2e81('0x1dc'),_0xcec148['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0xcec148[_0x2e81('0x41')]);}else if(!ifInterval(_0xcec148[_0x2e81('0x1d5')],_0xcec148['startProgressive'])&&_[_0x2e81('0x3e')](_0xcec148[_0x2e81('0x29')])&&!_[_0x2e81('0x3e')](_0xcec148[_0x2e81('0x2a')])){_0xcec148[_0x2e81('0x29')]=moment()[_0x2e81('0x79')](_0x2e81('0xfd'));loggerPredictive[_0x2e81('0x7d')](_0xcec148[_0x2e81('0x41')],_0x2e81('0x1dd'),_0xcec148['startPredictive']);this[_0x2e81('0xbf')](_0xcec148[_0x2e81('0x1d5')])[_0x2e81('0xb8')](this[_0x2e81('0x1de')](_0xcec148))[_0x2e81('0xb8')](mergeDataErlangB(_0xcec148))[_0x2e81('0xb8')](this[_0x2e81('0x1df')](_0xcec148))[_0x2e81('0xb1')](loggerCatchPredictive(_0x2e81('0x1e0'),_0xcec148));}else if(!ifInterval(_0xcec148[_0x2e81('0x1d5')],_0xcec148['startPredictive'])){_0xcec148[_0x2e81('0x6e')]=0x0;_0xcec148[_0x2e81('0x29')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0xcec148[_0x2e81('0x41')],_0x2e81('0x1e1'),_0xcec148['startPredictive']);clearInterval(_0xcec148[_0x2e81('0x90')]);_0xcec148[_0x2e81('0x90')]=undefined;this['averageHandleTime'](_0xcec148[_0x2e81('0x1d5')])['then'](this[_0x2e81('0x1de')](_0xcec148))[_0x2e81('0xb8')](mergeDataErlangB(_0xcec148))['then'](this['startMethodPredictive'](_0xcec148))[_0x2e81('0xb1')](loggerCatchPredictive(_0x2e81('0x1e2'),_0xcec148));}else if(_0xcec148[_0x2e81('0x70')]&&_0x283914<_0xcec148[_0x2e81('0x70')]-_0x48aa3c){freeVariablesPredictive(_0xcec148);loggerPredictive['info'](_0xcec148[_0x2e81('0x41')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x283914,')\x20are\x20less\x20than\x20threshold\x20(',_0xcec148[_0x2e81('0x70')],'-',_0x48aa3c,'=',_0xcec148[_0x2e81('0x70')]-_0x48aa3c,')');}else if(_0xcec148[_0x2e81('0x70')]&&_0x283914>_0xcec148[_0x2e81('0x70')]+_0x5cd96f){freeVariablesPredictive(_0xcec148);loggerPredictive[_0x2e81('0x7d')](_0xcec148['name'],_0x2e81('0x1e3'),_0x283914,_0x2e81('0x1e4'),_0xcec148[_0x2e81('0x70')],'+',_0x5cd96f,'=',_0xcec148[_0x2e81('0x70')]+_0x5cd96f,')');}};Dialer[_0x2e81('0x1b')][_0x2e81('0x1de')]=function(_0x5d6893){var _0x230c5a=this;return function(_0x5af35f){return new BPromise(function(_0x5dfe2d,_0x2bea6c){_[_0x2e81('0x8c')](_0x5d6893,_0x5af35f[0x0]);if(checkGetDataPredictive(_0x5af35f[0x0])){var _0x1b0787=_0x5d6893['predictiveIntervalAvailable']=_0x5d6893['talking']+_0x5d6893[_0x2e81('0x52')];var _0x2bdf80=_0x5d6893[_0x2e81('0x1d5')]*0x3c;var _0x24a069=_0x5af35f[0x0][_0x2e81('0x86')]+_0x5af35f[0x0][_0x2e81('0x6a')];var _0x4e0b73=(_0x5af35f[0x0][_0x2e81('0x81')]+_0x5af35f[0x0][_0x2e81('0x6c')]+_0x5af35f[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x5af35f[0x0][_0x2e81('0x71')];_0x5d6893[_0x2e81('0x1d2')]=_0x4e0b73>0x0?_0x4e0b73:0x1;switch(_0x5d6893[_0x2e81('0x1d7')]){case _0x2e81('0x1d8'):var _0x4a181d=_0x5d6893[_0x2e81('0x1e5')]/0x64;return _0x230c5a['abandonmentRate'](_0x1b0787,_0x2bdf80,_0x24a069,_0x4e0b73,_0x4a181d)[_0x2e81('0xb8')](function(_0x436f42){return _0x5dfe2d(_0x436f42);});case _0x2e81('0x1e6'):var _0x1da71f=_0x5d6893['dialPredictiveOptimizationPercentage']/0x64;return _0x230c5a['busyFactor'](_0x1b0787,_0x2bdf80,_0x24a069,_0x4e0b73,_0x1da71f)[_0x2e81('0xb8')](function(_0x509a54){return _0x5dfe2d(_0x509a54);});default:return _0x2bea6c(msgResponse(_0x2e81('0x1e7'),_0x2e81('0x14d'),_0x2e81('0x1e8')));}}else{return _0x2bea6c(msgResponse(_0x2e81('0x1e7'),_0x2e81('0x14d'),_0x2e81('0x1e9')));}});};};Dialer[_0x2e81('0x1b')][_0x2e81('0x1ea')]=function(_0x208991){var _0x2329ed=this;return function(_0x613f2b){return new BPromise(function(_0x5d4f14,_0x5bce05){_['merge'](_0x208991,_0x613f2b[0x0]);if(checkGetDataPredictive(_0x613f2b[0x0])){loggerPredictive['info'](JSON[_0x2e81('0x4c')](_0x613f2b[0x0]));if(_0x208991[_0x2e81('0x1d7')]===_0x2e81('0x1d8')){return _0x2329ed['getVoiceQueueRtPauses'](_0x208991['id'])['then'](function(_0x43fe50){var _0x4d0fea=_0x208991[_0x2e81('0x53')]-_0x43fe50[0x0][_0x2e81('0x1eb')];var _0x4f9b85=_0x208991[_0x2e81('0x1d5')]*0x3c;var _0x554c48=_0x613f2b[0x0][_0x2e81('0x86')]+_0x613f2b[0x0][_0x2e81('0x6a')];var _0x313cb7=(_0x613f2b[0x0][_0x2e81('0x81')]+_0x613f2b[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x613f2b[0x0][_0x2e81('0x6b')])/_0x613f2b[0x0][_0x2e81('0x71')];var _0x5dfe31=_0x208991[_0x2e81('0x1e5')]/0x64;_0x208991[_0x2e81('0x1ec')]=_0x43fe50[0x0]['outboundQueuePauses']||0x0;_0x208991['predictiveIntervalHitRate']=_0x313cb7>0x0?_0x313cb7:0x1;return _0x2329ed[_0x2e81('0x1ed')](_0x4d0fea,_0x4f9b85,_0x554c48,_0x313cb7,_0x5dfe31);})[_0x2e81('0xb8')](function(_0x377798){return _0x5d4f14(_0x377798);})['catch'](function(_0x398f72){return _0x5bce05(msgResponse(_0x2e81('0x1ee'),_0x2e81('0x14d'),JSON[_0x2e81('0x4c')](_0x398f72)));});}if(_0x208991[_0x2e81('0x1d7')]===_0x2e81('0x1e6')){return _0x2329ed['getVoiceQueueRtPauses'](_0x208991['id'])[_0x2e81('0xb8')](function(_0xc70bed){var _0x3e5a73=_0x208991[_0x2e81('0x53')]-_0xc70bed[0x0][_0x2e81('0x1eb')];var _0x427dac=_0x208991[_0x2e81('0x1d5')]*0x3c;var _0x5ba38b=_0x613f2b[0x0][_0x2e81('0x86')]+_0x613f2b[0x0][_0x2e81('0x6a')];var _0x2a5ec5=(_0x613f2b[0x0][_0x2e81('0x81')]+_0x613f2b[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x613f2b[0x0][_0x2e81('0x6b')])/_0x613f2b[0x0]['predictiveIntervalTotalCalls'];var _0x571de7=_0x208991[_0x2e81('0x1e5')]/0x64;_0x208991[_0x2e81('0x1ec')]=_0xc70bed[0x0]['outboundQueuePauses']||0x0;_0x208991[_0x2e81('0x1d2')]=_0x2a5ec5>0x0?_0x2a5ec5:0x1;return _0x2329ed[_0x2e81('0x1ef')](_0x3e5a73,_0x427dac,_0x5ba38b,_0x2a5ec5,_0x571de7);})[_0x2e81('0xb8')](function(_0x1e7774){return _0x5d4f14(_0x1e7774);})[_0x2e81('0xb1')](function(_0x2aba56){return _0x5bce05(msgResponse('[CatchErlangB]','Failure',JSON[_0x2e81('0x4c')](_0x2aba56)));});}}else{return _0x5bce05(msgResponse('[getDataPredictive]',_0x2e81('0x14d'),'check\x20failure'));}});};};Dialer[_0x2e81('0x1b')]['startMethodPredictive']=function(_0x43b2ac){var _0x4f2ced=this;return function(){var _0x78b760=0x0;var _0x5bd3aa=Math['floor'](_0x43b2ac[_0x2e81('0x74')]*0x3e8);if(_0x5bd3aa>0x0){_0x5bd3aa=_0x5bd3aa<0x64?0x64:_0x5bd3aa;loggerPredictive[_0x2e81('0x7d')](_0x43b2ac['name'],_0x2e81('0x1f0'),_0x5bd3aa,_0x2e81('0x8d'));_0x43b2ac[_0x2e81('0x90')]=setInterval(function(){_0x4f2ced[_0x2e81('0x90')](_0x43b2ac);loggerPredictiveCalls['info'](_0x2e81('0x1f1'),_0x78b760+=0x1);},_0x5bd3aa);}else{loggerPredictive['info'](_0x43b2ac[_0x2e81('0x41')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x2e81('0x1b')][_0x2e81('0x1f2')]=function(_0x5e3584,_0x12d6a5){var _0xbbcfab=this;return function(_0x1c4843){if(_[_0x2e81('0x49')](_0x1c4843)){if(_['isNil'](_0x12d6a5['UserId'])||!_0x12d6a5['recallme']){if(_0x5e3584[_0x2e81('0x5d')]===_0x2e81('0x6')){_0x5e3584[_0x2e81('0x135')]=_['isUndefined'](_0x5e3584[_0x2e81('0x135')])?!![]:_0x5e3584['queueStatusComplete'];var _0x557cc6=uuid['v4']();_0xbbcfab[_0x2e81('0x26')][_0x557cc6]=new Action(_0x5e3584,_0x12d6a5,_0x557cc6);loggerBooked[_0x2e81('0x7d')](_0x2e81('0x1f3'),_0x557cc6,_0x2e81('0x1f4'),JSON[_0x2e81('0x4c')](_0x5e3584[_0x2e81('0x135')]),_0x2e81('0x1f5'),_0x5e3584[_0x2e81('0x41')]);if(_0x5e3584[_0x2e81('0x135')]){_0x5e3584[_0x2e81('0x135')]=![];_0xbbcfab['queueBooked'][_0xbbcfab[_0x2e81('0x26')][_0x557cc6][_0x2e81('0xb3')]]=[];ami[_0x2e81('0xae')]({'actionid':_0x557cc6,'action':'queuestatus','queue':_0x5e3584[_0x2e81('0x41')]})[_0x2e81('0xb1')](function(){_0xbbcfab['updateOriginated'](_0x5e3584);_0xbbcfab[_0x2e81('0xc1')]({'active':![],'ContactId':_0xbbcfab['actions'][_0x557cc6]['ContactId'],'ListId':_0xbbcfab[_0x2e81('0x26')][_0x557cc6][_0x2e81('0xd4')],'VoiceQueueId':_0xbbcfab[_0x2e81('0x26')][_0x557cc6][_0x2e81('0xfe')]||undefined,'CampaignId':_0xbbcfab[_0x2e81('0x26')][_0x557cc6][_0x2e81('0xff')]||undefined})[_0x2e81('0xb1')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0xbbcfab[_0x2e81('0x26')][_0x557cc6];});}else{loggerBooked[_0x2e81('0x7d')](_0x2e81('0x1f6'),JSON['stringify'](_0x5e3584[_0x2e81('0x135')]),_0x2e81('0x1f5'),_0x5e3584['name']);_0xbbcfab['updateOriginated'](_0x5e3584);_0xbbcfab[_0x2e81('0xc1')]({'active':![],'ContactId':_0xbbcfab[_0x2e81('0x26')][_0x557cc6][_0x2e81('0x10a')],'ListId':_0xbbcfab[_0x2e81('0x26')][_0x557cc6][_0x2e81('0xd4')],'VoiceQueueId':_0xbbcfab['actions'][_0x557cc6][_0x2e81('0xfe')]||undefined,'CampaignId':_0xbbcfab[_0x2e81('0x26')][_0x557cc6][_0x2e81('0xff')]||undefined})[_0x2e81('0xb1')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0xbbcfab[_0x2e81('0x26')][_0x557cc6];}}else{return _0xbbcfab[_0x2e81('0x172')](_0x5e3584,_0x12d6a5);}}else{if(getDiff(_0x12d6a5['scheduledat'])<_0x5e3584['dialRecallMeTimeout']*0x3c){if(_0x12d6a5[_0x2e81('0x1f7')]&&!_0x12d6a5[_0x2e81('0x1f7')][_0x2e81('0x1f8')]){_0xbbcfab[_0x2e81('0x92')][_0x2e81('0x139')](_0x12d6a5['id'])[_0x2e81('0x1e')](function(){_0xbbcfab[_0x2e81('0xb5')](_0x5e3584);});}else{_0xbbcfab[_0x2e81('0xc3')]({'active':![]},_0x12d6a5['id'],0x1)[_0x2e81('0x1e')](function(){_0xbbcfab[_0x2e81('0xb5')](_0x5e3584);});}}else{_0x5e3584[_0x2e81('0x1f9')]+=0x1;_0xbbcfab['updateOriginated'](_0x5e3584);if(_0x5e3584['dialRecallInQueue']){_0xbbcfab[_0x2e81('0xc1')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x12d6a5[_0x2e81('0x10a')],'ListId':_0x12d6a5[_0x2e81('0xd4')],'VoiceQueueId':_0x12d6a5[_0x2e81('0xfe')]||undefined,'CampaignId':_0x12d6a5[_0x2e81('0xff')]||undefined})[_0x2e81('0xb1')](loggerCatch(_0x2e81('0x1fa')));_0xbbcfab[_0x2e81('0xcd')](createObjHistory(_0x5e3584,_0x12d6a5,'RECALLINQUEUE',0x17,_0x2e81('0x1fb')))[_0x2e81('0xb1')](loggerCatch(_0x2e81('0x1fc')));}else{_0xbbcfab[_0x2e81('0xd3')](createObjHistory(_0x5e3584,_0x12d6a5,_0x2e81('0x1fd'),0x16,'RecallFailedTimeout'),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0x5e3584[_0x2e81('0x61')]+=0x1;_0xbbcfab[_0x2e81('0xd3')](createObjHistory(_0x5e3584,_0x12d6a5,'BLACKLIST',0xd,_0x2e81('0x1fe')),_0x2e81('0x1ff'),_0x2e81('0x200'));throw _0x2e81('0x201');}};};Dialer[_0x2e81('0x1b')][_0x2e81('0x166')]=function(_0x58e979){var _0x1edd18=this;var _0x5a428c=_0x58e979[_0x2e81('0x202')]-_0x58e979[_0x2e81('0x72')]-_0x58e979[_0x2e81('0xc6')];emitCampaignSummary(_0x58e979);if(_0x5a428c>0x0){if(_0x5a428c>this['maxNumberOriginate']){_0x5a428c=this[_0x2e81('0x24')];}_0x58e979[_0x2e81('0xc6')]+=_0x5a428c;this[_0x2e81('0xc8')](_0x58e979['id'],_0x5a428c,_0x58e979['dialOrderByScheduledAt'],_0x58e979)[_0x2e81('0xb8')](function(_0x1d07c1){_0x58e979[_0x2e81('0xc6')]-=_0x5a428c;_0x58e979[_0x2e81('0xc6')]=_0x58e979['temp']>0x0?_0x58e979[_0x2e81('0xc6')]:0x0;if(!checkContactEmpty(_0x1d07c1)){_0x58e979[_0x2e81('0x3f')]=_0x2e81('0xa0');logger[_0x2e81('0x7d')](_0x2e81('0x203')+_0x58e979[_0x2e81('0x41')]);}else{_0x58e979[_0x2e81('0x72')]+=_0x1d07c1[_0x2e81('0x99')];_0x58e979[_0x2e81('0x3f')]='RUNNING';for(var _0x2ce225=0x0;_0x2ce225<_0x1d07c1[_0x2e81('0x99')];_0x2ce225+=0x1){_0x58e979['ivrTotalCallsDays']+=0x1;if(_[_0x2e81('0xdf')](_0x1d07c1[_0x2ce225])||_[_0x2e81('0xdf')](_0x1d07c1[_0x2ce225][_0x2e81('0x174')])||_[_0x2e81('0xdf')](_0x1d07c1[_0x2ce225][_0x2e81('0x174')][_0x2e81('0x175')])){_0x1edd18[_0x2e81('0xd2')]('[actionOriginate]\x20',_0x58e979,_0x1d07c1[_0x2ce225]);}else{_0x1edd18['checkIsBlackListIvr'](_[_0x2e81('0x134')](_0x1d07c1[_0x2ce225],[_0x2e81('0xff'),_0x2e81('0x204')]))[_0x2e81('0xb8')](_0x1edd18[_0x2e81('0x1f2')](_0x58e979,_0x1d07c1[_0x2ce225]))[_0x2e81('0xb1')](_0x1edd18[_0x2e81('0xd1')](_0x2e81('0x205'),_0x58e979));}}}})['catch'](loggerGetContactDialer('[getContactCampaign2]',_0x58e979,_0x5a428c));}};Dialer[_0x2e81('0x1b')][_0x2e81('0x160')]=function(_0x2847ec,_0x4573cf){var _0x40b25b=this;var _0x3fcbc8=[];var _0x3af033=_0x4573cf>=0x1?_0x4573cf:0x1;if(_0x2847ec['dialMethod']===_0x2e81('0x6')){_0x3af033=0x1;}var _0x39fafe=Math[_0x2e81('0x206')](_0x2847ec[_0x2e81('0x52')]*_0x3af033)-_0x2847ec[_0x2e81('0x72')]-_0x2847ec[_0x2e81('0xc6')];emitVoiceQueueSummary(_0x2847ec);if(_0x2847ec[_0x2e81('0x207')]>0x0){var _0x531314=_0x2847ec[_0x2e81('0x207')]-_0x2847ec[_0x2e81('0x72')]-_0x2847ec['talking']-_0x2847ec[_0x2e81('0xc6')]-_0x2847ec[_0x2e81('0xa2')];if(_0x39fafe>_0x531314){_0x39fafe=_0x531314;}}if(_0x39fafe>0x0){if(_0x2847ec['dialMethod']===_0x2e81('0x6')){_0x39fafe=0x1;}if(_0x39fafe>this[_0x2e81('0x24')]){_0x39fafe=this[_0x2e81('0x24')];}_0x2847ec[_0x2e81('0xc6')]+=_0x39fafe;for(var _0x200ced in this['agents']){if(typeof this[_0x2e81('0x22')][_0x200ced]!=='undefined'){if(this['agents'][_0x200ced][_0x2e81('0xeb')]==='not_inuse'&&this[_0x2e81('0x22')][_0x200ced][_0x2e81('0xaf')]===_0x2e81('0xdc')){_0x3fcbc8[_0x2e81('0x133')](this[_0x2e81('0x22')][_0x200ced]['id']);}}}this[_0x2e81('0xc5')](_0x2847ec['id'],_0x3fcbc8,_0x39fafe,_0x2847ec[_0x2e81('0x208')],_0x2847ec)[_0x2e81('0xb8')](function(_0x4d0fe0){_0x2847ec['temp']-=_0x39fafe;_0x2847ec['temp']=_0x2847ec[_0x2e81('0xc6')]>0x0?_0x2847ec[_0x2e81('0xc6')]:0x0;if(!checkContactEmpty(_0x4d0fe0)){_0x40b25b[_0x2e81('0xb7')](_0x2847ec)[_0x2e81('0xb8')](sendMessageReschedule(_0x2847ec))[_0x2e81('0xb1')](loggerCatch(_0x2e81('0xb9')));}else{_0x2847ec['originated']+=_0x4d0fe0['length'];_0x2847ec[_0x2e81('0x3f')]=_0x2847ec[_0x2e81('0x5d')]===_0x2e81('0x6')?_0x2e81('0x17d'):_0x2e81('0x209');for(var _0x31e56e=0x0;_0x31e56e<_0x4d0fe0['length'];_0x31e56e+=0x1){if(_[_0x2e81('0xdf')](_0x4d0fe0[_0x31e56e])||_[_0x2e81('0xdf')](_0x4d0fe0[_0x31e56e]['Contact'])||_[_0x2e81('0xdf')](_0x4d0fe0[_0x31e56e][_0x2e81('0x174')][_0x2e81('0x175')])){_0x40b25b[_0x2e81('0xd2')]('[actionOriginate]\x20',_0x2847ec,_0x4d0fe0[_0x31e56e]);}else{_0x40b25b['checkIsBlackList'](_[_0x2e81('0x134')](_0x4d0fe0[_0x31e56e],[_0x2e81('0xfe'),_0x2e81('0x204')]))[_0x2e81('0xb8')](_0x40b25b[_0x2e81('0x1f2')](_0x2847ec,_0x4d0fe0[_0x31e56e]))[_0x2e81('0xb1')](_0x40b25b[_0x2e81('0xd1')]('[actionOriginate]\x20',_0x2847ec));}}}})['catch'](loggerGetContactDialer(_0x2e81('0x20a'),_0x2847ec,_0x39fafe));}};Dialer[_0x2e81('0x1b')][_0x2e81('0x90')]=function(_0x4a5eb6){if(_0x4a5eb6['dialLimitQueue']>0x0){var _0x85cd1d=_0x4a5eb6[_0x2e81('0x207')]-_0x4a5eb6[_0x2e81('0x72')]-_0x4a5eb6[_0x2e81('0xa1')];if(_0x85cd1d>0x0){this[_0x2e81('0x20b')](_0x4a5eb6);}else{loggerPredictiveCalls[_0x2e81('0x7d')](_0x2e81('0x20c'));}}else{this[_0x2e81('0x20b')](_0x4a5eb6);}};Dialer[_0x2e81('0x1b')][_0x2e81('0x20b')]=function(_0x4dd7c6){var _0x1eeb80=this;var _0x2c16a4=[];_0x4dd7c6['originated']+=0x1;for(var _0x56703f in this['agents']){if(typeof this[_0x2e81('0x22')][_0x56703f]!==_0x2e81('0x9a')){if(this[_0x2e81('0x22')][_0x56703f][_0x2e81('0xeb')]===_0x2e81('0x20d')&&this[_0x2e81('0x22')][_0x56703f][_0x2e81('0xaf')]==='reachable'){_0x2c16a4[_0x2e81('0x133')](this[_0x2e81('0x22')][_0x56703f]['id']);}}}this[_0x2e81('0xc5')](_0x4dd7c6['id'],_0x2c16a4,0x1,_0x4dd7c6[_0x2e81('0x208')],_0x4dd7c6)[_0x2e81('0xb8')](function(_0x3b2136){if(!checkContactEmpty(_0x3b2136)){checkContactLowerLimitOriginate(_0x4dd7c6,0x1,0x0);_0x1eeb80[_0x2e81('0xb7')](_0x4dd7c6)[_0x2e81('0xb8')](sendMessageReschedule(_0x4dd7c6))[_0x2e81('0xb1')](loggerCatch(_0x2e81('0xb9')));}else{_0x4dd7c6[_0x2e81('0x3f')]=_0x2e81('0x209');if(_['isNil'](_0x3b2136[0x0])||_[_0x2e81('0xdf')](_0x3b2136[0x0][_0x2e81('0x174')])||_[_0x2e81('0xdf')](_0x3b2136[0x0][_0x2e81('0x174')]['phone'])){_0x1eeb80[_0x2e81('0xd2')](_0x2e81('0x20e'),_0x4dd7c6,_0x3b2136[0x0]);}else{_0x1eeb80['checkIsBlackList'](_['pick'](_0x3b2136[0x0],['VoiceQueueId',_0x2e81('0x204')]))[_0x2e81('0xb8')](_0x1eeb80[_0x2e81('0x1f2')](_0x4dd7c6,_0x3b2136[0x0]))[_0x2e81('0xb1')](_0x1eeb80['loggerHandler'](_0x2e81('0x20f'),_0x4dd7c6));}}})[_0x2e81('0xb1')](loggerGetContactDialer(_0x2e81('0x210'),_0x4dd7c6,0x1));emitVoiceQueueSummary(_0x4dd7c6);};Dialer[_0x2e81('0x1b')][_0x2e81('0x1ed')]=function(_0x21a1f0,_0x59b3e5,_0xe29542,_0x2defd3,_0x49e3ca,_0x1eb0e9){loggerPredictive['info'](_0x2e81('0x211'));loggerPredictive[_0x2e81('0x7d')](_0x2e81('0x212'),_0x21a1f0);loggerPredictive[_0x2e81('0x7d')](_0x2e81('0x213'),_0x59b3e5);loggerPredictive[_0x2e81('0x7d')](_0x2e81('0x214'),_0xe29542);loggerPredictive[_0x2e81('0x7d')]('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',_0x2defd3);loggerPredictive[_0x2e81('0x7d')](_0x2e81('0x215'),_0x49e3ca);loggerPredictive[_0x2e81('0x7d')](_0x2e81('0x8b'));return new BPromise(function(_0x515b67,_0x18e60c){if(_0x21a1f0<=0x0||isNaN(_0x21a1f0)){return _0x18e60c(msgResponse(_0x2e81('0x216'),_0x2e81('0x4b'),_0x2e81('0x217')+_0x21a1f0));}if(_0xe29542<=0x0||isNaN(_0xe29542)){return _0x18e60c(msgResponse(_0x2e81('0x216'),_0x2e81('0x4b'),_0x2e81('0x218')+_0xe29542));}if(_0x2defd3<=0x0||isNaN(_0x2defd3)){return _0x18e60c(msgResponse(_0x2e81('0x216'),_0x2e81('0x4b'),_0x2e81('0x219')+_0x2defd3));}if(_0x59b3e5<=0x0||isNaN(_0x59b3e5)){return _0x18e60c(msgResponse(_0x2e81('0x216'),_0x2e81('0x4b'),_0x2e81('0x21a')+_0x59b3e5));}if(_0x49e3ca<=0x0||isNaN(_0x49e3ca)){return _0x18e60c(msgResponse(_0x2e81('0x216'),_0x2e81('0x4b'),_0x2e81('0x21b')+_0x49e3ca));}_0x1eb0e9=_0x1eb0e9||0x0;var _0x6e3736=0x1/_0xe29542;var _0x14100e=0x0;var _0x470f91=0x0;var _0x49e972=0x0;var _0x465fa7=0x0;for(var _0x1be449=0x0;_0x49e972<_0x49e3ca;_0x1be449+=0x1){_0x470f91=_0x1be449/_0x59b3e5;_0x14100e=(_0x2defd3*_0x470f91+_0x1eb0e9)/_0x6e3736;_0x49e972=erlangb(_0x14100e,_0x21a1f0);_0x465fa7=_0x14100e/_0x21a1f0*(0x1-erlangb(_0x14100e,_0x21a1f0));}return _0x515b67({'erlangCalls':_0x1be449,'erlangCallToSecond':_0x59b3e5/_0x1be449,'erlangAbandonmentRate':_0x49e972,'erlangBusyFactor':_0x465fa7});});};Dialer[_0x2e81('0x1b')][_0x2e81('0x1ef')]=function(_0xe9ba85,_0x5c24c8,_0x508152,_0x2d23a1,_0x5a4c61,_0x1fd27e){loggerPredictive['info'](_0x2e81('0x21c'));loggerPredictive[_0x2e81('0x7d')](_0x2e81('0x212'),_0xe9ba85);loggerPredictive[_0x2e81('0x7d')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5c24c8);loggerPredictive[_0x2e81('0x7d')](_0x2e81('0x214'),_0x508152);loggerPredictive[_0x2e81('0x7d')](_0x2e81('0x21d'),_0x2d23a1);loggerPredictive[_0x2e81('0x7d')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5a4c61);loggerPredictive[_0x2e81('0x7d')]('---------------------------');return new BPromise(function(_0x241364,_0x4aea40){if(_0xe9ba85<=0x0||isNaN(_0xe9ba85)){return _0x4aea40(msgResponse(_0x2e81('0x21e'),'Error','m\x20=\x20'+_0xe9ba85));}if(_0x508152<=0x0||isNaN(_0x508152)){return _0x4aea40(msgResponse(_0x2e81('0x21e'),_0x2e81('0x4b'),_0x2e81('0x218')+_0x508152));}if(_0x2d23a1<=0x0||isNaN(_0x2d23a1)){return _0x4aea40(msgResponse(_0x2e81('0x21e'),'Error',_0x2e81('0x219')+_0x2d23a1));}if(_0x5c24c8<=0x0||isNaN(_0x5c24c8)){return _0x4aea40(msgResponse('[busyFactor]',_0x2e81('0x4b'),_0x2e81('0x21a')+_0x5c24c8));}if(_0x5a4c61<=0x0||isNaN(_0x5a4c61)){return _0x4aea40(msgResponse(_0x2e81('0x21e'),'Error','Umin\x20=\x20'+_0x5a4c61));}_0x1fd27e=_0x1fd27e||0x0;var _0x38bafc=0x1/_0x508152;var _0x542666=0x0;var _0x177361=0x0;var _0x350bfc=0x0;var _0x44b423=0x0;for(var _0x6048cc=0x0;_0x44b423<_0x5a4c61;_0x6048cc+=0x1){_0x177361=_0x6048cc/_0x5c24c8;_0x542666=(_0x2d23a1*_0x177361+_0x1fd27e)/_0x38bafc;_0x350bfc=erlangb(_0x542666,_0xe9ba85);_0x44b423=_0x542666/_0xe9ba85*(0x1-erlangb(_0x542666,_0xe9ba85));}return _0x241364({'erlangCalls':_0x6048cc,'erlangCallToSecond':_0x5c24c8/_0x6048cc,'erlangAbandonmentRate':_0x350bfc,'erlangBusyFactor':_0x44b423});});};module['exports']=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 4259fed..3cd61f7 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2c75=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','scheduledat','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','droptime','holdtime','responsetime','talktime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme'];(function(_0x32ebe4,_0x55d2e1){var _0xbe603f=function(_0x5dc3bb){while(--_0x5dc3bb){_0x32ebe4['push'](_0x32ebe4['shift']());}};_0xbe603f(++_0x55d2e1);}(_0x2c75,0x127));var _0x52c7=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x2c75[_0xe66cf2];return _0x2d84e7;};'use strict';var util=require(_0x52c7('0x0'));var _=require(_0x52c7('0x1'));var moment=require('moment');function getSeconds(_0xa17760,_0x3bb330){var _0xf6b5d1=moment(_0xa17760)[_0x52c7('0x2')](0x0);var _0x5ce750=moment(_0x3bb330)[_0x52c7('0x2')](0x0);return _0xf6b5d1[_0x52c7('0x3')](_0x5ce750,_0x52c7('0x4'));}function QueueCallerAbandon(_0x16c7b6,_0x34b4a4){this['scheduledat']=_0x16c7b6[_0x52c7('0x5')];this['type']=_0x16c7b6['type'];this[_0x52c7('0x6')]=_0x16c7b6['type']===_0x52c7('0x7')?'queue':_0x16c7b6['type'];this[_0x52c7('0x8')]=_0x16c7b6[_0x52c7('0x8')];this[_0x52c7('0x9')]=_0x16c7b6[_0x52c7('0x9')];this[_0x52c7('0xa')]=_0x16c7b6[_0x52c7('0xa')];this[_0x52c7('0xb')]=_0x16c7b6[_0x52c7('0x8')]+_0x16c7b6['countcongestionretry']+_0x16c7b6[_0x52c7('0xa')]+_0x16c7b6[_0x52c7('0xc')]+_0x16c7b6[_0x52c7('0xd')]+_0x16c7b6['countabandonedretry']+_0x16c7b6[_0x52c7('0xe')]+_0x16c7b6[_0x52c7('0xf')];this[_0x52c7('0xc')]=_0x16c7b6[_0x52c7('0xc')];this[_0x52c7('0xd')]=_0x16c7b6['countdropretry'];this['countabandonedretry']=_0x16c7b6['countabandonedretry'];this[_0x52c7('0xe')]=_0x16c7b6[_0x52c7('0xe')];this[_0x52c7('0xf')]=_0x16c7b6[_0x52c7('0xf')];this['uniqueid']=_0x34b4a4[_0x52c7('0x10')];this[_0x52c7('0x11')]=_0x16c7b6[_0x52c7('0x12')];this['calleridnum']=_0x16c7b6[_0x52c7('0x13')];this['starttime']=_0x16c7b6[_0x52c7('0x14')];this['responsetime']=_0x16c7b6['responsetime'];this[_0x52c7('0x15')]=_0x16c7b6[_0x52c7('0x15')];this['endtime']=this[_0x52c7('0x15')];this['ringtime']=getSeconds(_0x16c7b6['responsetime'],_0x16c7b6[_0x52c7('0x14')]);this[_0x52c7('0x16')]=getSeconds(this[_0x52c7('0x15')],_0x16c7b6[_0x52c7('0x17')]);this[_0x52c7('0x18')]=0x0;this['queue']=_0x34b4a4[_0x52c7('0x19')];this[_0x52c7('0x1a')]=_0x34b4a4[_0x52c7('0x1b')];this[_0x52c7('0x1c')]=_0x34b4a4[_0x52c7('0x1c')];this[_0x52c7('0x1d')]=_0x16c7b6[_0x52c7('0x1d')];this[_0x52c7('0x1e')]=_0x16c7b6[_0x52c7('0x1e')];this[_0x52c7('0x1f')]=_0x16c7b6[_0x52c7('0x1f')];this[_0x52c7('0x20')]=_0x16c7b6[_0x52c7('0x20')];this[_0x52c7('0x21')]=_0x16c7b6['ContactId'];this[_0x52c7('0x22')]=_0x16c7b6[_0x52c7('0x22')];this[_0x52c7('0x23')]=_0x16c7b6[_0x52c7('0x23')];this['VoiceQueueId']=_0x16c7b6[_0x52c7('0x24')];this[_0x52c7('0x25')]=_0x16c7b6[_0x52c7('0x25')];this[_0x52c7('0x26')]=_0x16c7b6[_0x52c7('0x26')]||'';this[_0x52c7('0x27')]=_0x16c7b6['originatecalleridname']||'';}module[_0x52c7('0x28')]=QueueCallerAbandon; \ No newline at end of file +var _0xcd59=['seconds','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','droptime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','util','lodash','moment','milliseconds','diff'];(function(_0x2c4101,_0x29857a){var _0x12f302=function(_0x49f161){while(--_0x49f161){_0x2c4101['push'](_0x2c4101['shift']());}};_0x12f302(++_0x29857a);}(_0xcd59,0x14b));var _0x9cd5=function(_0x3b69e3,_0x40bb88){_0x3b69e3=_0x3b69e3-0x0;var _0x1f5b5e=_0xcd59[_0x3b69e3];return _0x1f5b5e;};'use strict';var util=require(_0x9cd5('0x0'));var _=require(_0x9cd5('0x1'));var moment=require(_0x9cd5('0x2'));function getSeconds(_0x27ce9f,_0x271070){var _0x302b21=moment(_0x27ce9f)['milliseconds'](0x0);var _0x2d392c=moment(_0x271070)[_0x9cd5('0x3')](0x0);return _0x302b21[_0x9cd5('0x4')](_0x2d392c,_0x9cd5('0x5'));}function QueueCallerAbandon(_0x6acbef,_0x2db192){this[_0x9cd5('0x6')]=_0x6acbef[_0x9cd5('0x6')];this[_0x9cd5('0x7')]=_0x6acbef[_0x9cd5('0x7')];this['campaigntype']=_0x6acbef[_0x9cd5('0x7')]===_0x9cd5('0x8')?_0x9cd5('0x9'):_0x6acbef[_0x9cd5('0x7')];this[_0x9cd5('0xa')]=_0x6acbef[_0x9cd5('0xa')];this[_0x9cd5('0xb')]=_0x6acbef[_0x9cd5('0xb')];this['countnoanswerretry']=_0x6acbef[_0x9cd5('0xc')];this[_0x9cd5('0xd')]=_0x6acbef[_0x9cd5('0xa')]+_0x6acbef[_0x9cd5('0xb')]+_0x6acbef['countnoanswerretry']+_0x6acbef['countnosuchnumberretry']+_0x6acbef[_0x9cd5('0xe')]+_0x6acbef[_0x9cd5('0xf')]+_0x6acbef[_0x9cd5('0x10')]+_0x6acbef[_0x9cd5('0x11')];this[_0x9cd5('0x12')]=_0x6acbef[_0x9cd5('0x12')];this['countdropretry']=_0x6acbef[_0x9cd5('0xe')];this[_0x9cd5('0xf')]=_0x6acbef[_0x9cd5('0xf')];this['countmachineretry']=_0x6acbef['countmachineretry'];this['countagentrejectretry']=_0x6acbef[_0x9cd5('0x11')];this[_0x9cd5('0x13')]=_0x2db192['uniqueid'];this[_0x9cd5('0x14')]=_0x6acbef[_0x9cd5('0x15')];this[_0x9cd5('0x16')]=_0x6acbef['number'];this[_0x9cd5('0x17')]=_0x6acbef[_0x9cd5('0x17')];this[_0x9cd5('0x18')]=_0x6acbef[_0x9cd5('0x18')];this[_0x9cd5('0x19')]=_0x6acbef[_0x9cd5('0x19')];this['endtime']=this[_0x9cd5('0x19')];this[_0x9cd5('0x1a')]=getSeconds(_0x6acbef[_0x9cd5('0x18')],_0x6acbef[_0x9cd5('0x17')]);this[_0x9cd5('0x1b')]=getSeconds(this['droptime'],_0x6acbef[_0x9cd5('0x18')]);this[_0x9cd5('0x1c')]=0x0;this[_0x9cd5('0x9')]=_0x2db192[_0x9cd5('0x9')];this[_0x9cd5('0x1d')]=_0x2db192[_0x9cd5('0x1e')];this[_0x9cd5('0x1f')]=_0x2db192[_0x9cd5('0x1f')];this[_0x9cd5('0x20')]=_0x6acbef['callback'];this[_0x9cd5('0x21')]=_0x6acbef[_0x9cd5('0x21')];this[_0x9cd5('0x22')]=_0x6acbef[_0x9cd5('0x22')];this['recallme']=_0x6acbef[_0x9cd5('0x23')];this[_0x9cd5('0x24')]=_0x6acbef[_0x9cd5('0x24')];this[_0x9cd5('0x25')]=_0x6acbef[_0x9cd5('0x25')];this[_0x9cd5('0x26')]=_0x6acbef[_0x9cd5('0x26')];this['VoiceQueueId']=_0x6acbef[_0x9cd5('0x27')];this[_0x9cd5('0x28')]=_0x6acbef[_0x9cd5('0x28')];this['originatecalleridnum']=_0x6acbef['originatecalleridnum']||'';this[_0x9cd5('0x29')]=_0x6acbef['originatecalleridname']||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index a4b63bb..39f370b 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(_0x555e07,_0x2d41d4){var _0x2ad74e=function(_0x3c08a3){while(--_0x3c08a3){_0x555e07['push'](_0x555e07['shift']());}};_0x2ad74e(++_0x2d41d4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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(_0x2e75bc,_0x5edb26){var _0x1bff40=function(_0x21c6c4){while(--_0x21c6c4){_0x2e75bc['push'](_0x2e75bc['shift']());}};_0x1bff40(++_0x5edb26);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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 1d76476..0f8540a 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 _0x8e41=['./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','newchannel','syncNewchannel','bind','syncVarSet','newstate','syncNewState','newexten','hangup','syncHangup','syncOriginateResponse','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','actions','\x20syncNewchannel\x20','prototype','variable','channelstate','channelstatedesc','value','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','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','\x20receiveFax\x20','stringify','pick','response','reason','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','faxpages','faxstatus','SUCCESS','faxstatusstring','execOriginate','FaxAccountId','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isNil','active','SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','lodash','bluebird','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./util/util'];(function(_0x4d8666,_0x2ff19d){var _0x37175b=function(_0x1b8de6){while(--_0x1b8de6){_0x4d8666['push'](_0x4d8666['shift']());}};_0x37175b(++_0x2ff19d);}(_0x8e41,0xd6));var _0x18e4=function(_0x409ef4,_0x435589){_0x409ef4=_0x409ef4-0x0;var _0x50036b=_0x8e41[_0x409ef4];return _0x50036b;};'use strict';var util=require(_0x18e4('0x0'));var _=require(_0x18e4('0x1'));var BPromise=require(_0x18e4('0x2'));var uuid=require('uuid');var moment=require(_0x18e4('0x3'));var path=require(_0x18e4('0x4'));var tiff2pdf=require(_0x18e4('0x5'));var gs=require(_0x18e4('0x6'));var logger=require(_0x18e4('0x7'))(_0x18e4('0x8'));var ami=require(_0x18e4('0x9'));var rpcDb=require(_0x18e4('0xa'));var Channel=require('./channel');var ut=require(_0x18e4('0xb'));var Action=require(_0x18e4('0xc'));var faxAccount=require(_0x18e4('0xd'));var attachment=require(_0x18e4('0xe'));var faxMessage=require('../rpc/faxMessage');function Fax(_0xe5493b){this[_0x18e4('0xf')]={};this['faxAccounts']=_0xe5493b[_0x18e4('0x10')];this[_0x18e4('0x11')]=_0xe5493b[_0x18e4('0x11')];this['actions']={};ami['on'](_0x18e4('0x12'),this[_0x18e4('0x13')][_0x18e4('0x14')](this));ami['on']('varset',this[_0x18e4('0x15')]['bind'](this));ami['on'](_0x18e4('0x16'),this[_0x18e4('0x17')]['bind'](this));ami['on'](_0x18e4('0x18'),this['syncNewExten'][_0x18e4('0x14')](this));ami['on']('faxstatus',this['syncFaxStatus'][_0x18e4('0x14')](this));ami['on']('receivefax',this['syncReceiveFax'][_0x18e4('0x14')](this));ami['on'](_0x18e4('0x19'),this[_0x18e4('0x1a')][_0x18e4('0x14')](this));ami['on']('originateresponse',this[_0x18e4('0x1b')][_0x18e4('0x14')](this));}Fax['prototype'][_0x18e4('0x13')]=function(_0x5cd989){if(_0x5cd989[_0x18e4('0x1c')]===_0x18e4('0x1d')){for(var _0x2dbaf2 in this[_0x18e4('0x10')]){if(this[_0x18e4('0x10')][_0x18e4('0x1e')](_0x2dbaf2)){if(_0x5cd989[_0x18e4('0x1f')]===this['faxAccounts'][_0x2dbaf2][_0x18e4('0x20')]){this[_0x18e4('0xf')][_0x5cd989[_0x18e4('0x21')]]={};this[_0x18e4('0xf')][_0x5cd989[_0x18e4('0x21')]]['channel']=_0x5cd989[_0x18e4('0x22')];this[_0x18e4('0xf')][_0x5cd989[_0x18e4('0x21')]]['id']=this[_0x18e4('0x10')][_0x2dbaf2]['id'];this[_0x18e4('0xf')][_0x5cd989['uniqueid']][_0x18e4('0x23')]=this[_0x18e4('0x10')][_0x2dbaf2]['name'];logger[_0x18e4('0x24')](_0x5cd989[_0x18e4('0x21')],'\x20syncNewchannel\x20');}}}}if(this[_0x18e4('0x25')][_0x5cd989['uniqueid']]){this['channels'][_0x5cd989[_0x18e4('0x21')]]={};this[_0x18e4('0xf')][_0x5cd989[_0x18e4('0x21')]]['channel']=_0x5cd989[_0x18e4('0x22')];logger[_0x18e4('0x24')](_0x5cd989[_0x18e4('0x21')],_0x18e4('0x26'));}};Fax[_0x18e4('0x27')]['syncVarSet']=function(_0x1b2a72){if(this[_0x18e4('0xf')][_0x1b2a72[_0x18e4('0x21')]]){for(var _0x1f3318 in _0x1b2a72[_0x18e4('0x28')]){if(_0x1b2a72[_0x18e4('0x28')]['hasOwnProperty'](_0x1f3318)){this['channels'][_0x1b2a72[_0x18e4('0x21')]][_0x1f3318]=_0x1b2a72['value'];}}}};Fax[_0x18e4('0x27')][_0x18e4('0x17')]=function(_0x1cf969){if(this[_0x18e4('0xf')][_0x1cf969[_0x18e4('0x21')]]){this[_0x18e4('0xf')][_0x1cf969[_0x18e4('0x21')]]['channelstate']=_0x1cf969[_0x18e4('0x29')];this[_0x18e4('0xf')][_0x1cf969[_0x18e4('0x21')]][_0x18e4('0x2a')]=_0x1cf969[_0x18e4('0x2a')];}};Fax['prototype']['syncNewExten']=function(_0x5b0a9a){if(this[_0x18e4('0xf')][_0x5b0a9a[_0x18e4('0x21')]]){for(var _0x39136f in _0x5b0a9a[_0x18e4('0x28')]){if(_0x5b0a9a[_0x18e4('0x28')]['hasOwnProperty'](_0x39136f)){this['channels'][_0x5b0a9a[_0x18e4('0x21')]][_0x39136f]=_0x5b0a9a[_0x18e4('0x2b')];}}}};Fax[_0x18e4('0x27')][_0x18e4('0x2c')]=function(_0xf1c6e){if(this[_0x18e4('0xf')][_0xf1c6e[_0x18e4('0x21')]]){this['channels'][_0xf1c6e[_0x18e4('0x21')]][_0x18e4('0x2d')]=_0xf1c6e[_0x18e4('0x2d')];this['channels'][_0xf1c6e['uniqueid']][_0x18e4('0x2e')]=_0xf1c6e[_0x18e4('0x2e')];this[_0x18e4('0xf')][_0xf1c6e['uniqueid']]['localstationid']=_0xf1c6e[_0x18e4('0x20')];this['channels'][_0xf1c6e[_0x18e4('0x21')]][_0x18e4('0x2f')]=_0xf1c6e[_0x18e4('0x2f')];logger[_0x18e4('0x24')](_0xf1c6e[_0x18e4('0x21')],_0x18e4('0x30'));}};Fax[_0x18e4('0x27')]['syncReceiveFax']=function(_0x3096e3){var _0x4c8519=this;if(this[_0x18e4('0xf')][_0x3096e3['uniqueid']]){var _0x58fd38=this['channels'][_0x3096e3[_0x18e4('0x21')]]['id'];this[_0x18e4('0xf')][_0x3096e3['uniqueid']]['remotestationid']=_0x3096e3[_0x18e4('0x31')];this[_0x18e4('0xf')][_0x3096e3[_0x18e4('0x21')]][_0x18e4('0x32')]=_0x3096e3[_0x18e4('0x32')];this[_0x18e4('0xf')][_0x3096e3['uniqueid']][_0x18e4('0x20')]=_0x3096e3['localstationid'];this[_0x18e4('0xf')][_0x3096e3[_0x18e4('0x21')]][_0x18e4('0x33')]=_0x3096e3[_0x18e4('0x33')];this[_0x18e4('0xf')][_0x3096e3[_0x18e4('0x21')]][_0x18e4('0x34')]=_0x3096e3['transferrate'];this[_0x18e4('0xf')][_0x3096e3[_0x18e4('0x21')]][_0x18e4('0x2f')]=_0x3096e3[_0x18e4('0x2f')];this[_0x18e4('0xf')][_0x3096e3[_0x18e4('0x21')]][_0x18e4('0x35')]=_0x3096e3[_0x18e4('0x35')];if(this['channels'][_0x3096e3[_0x18e4('0x21')]][_0x18e4('0x32')]>0x0){tiff2pdf(_0x3096e3[_0x18e4('0x2f')],_0x18e4('0x36'),function(_0x3ed878){logger[_0x18e4('0x24')](_0x3096e3[_0x18e4('0x21')],_0x18e4('0x37'),_0x3ed878[_0x18e4('0x38')]);attachment[_0x18e4('0x39')]({'name':path['parse'](_0x3096e3[_0x18e4('0x2f')])[_0x18e4('0x23')],'basename':path[_0x18e4('0x3a')](_0x3096e3[_0x18e4('0x2f')])[_0x18e4('0x23')]+_0x18e4('0x3b'),'type':_0x18e4('0x3c')})[_0x18e4('0x3d')](function(_0x55c2f8){faxAccount[_0x18e4('0x3e')](_0x58fd38,{'from':_0x3096e3[_0x18e4('0x35')],'mapKey':'fax','body':path['parse'](_0x3096e3[_0x18e4('0x2f')])['name']+_0x18e4('0x3b'),'AttachmentId':_0x55c2f8['id']})[_0x18e4('0x3f')](function(_0xbe2366){logger[_0x18e4('0x40')](_0x3096e3[_0x18e4('0x21')],'\x20notify\x20',JSON['stringify'](_0xbe2366));});})[_0x18e4('0x3f')](function(_0x172a9a){logger[_0x18e4('0x40')](_0x3096e3[_0x18e4('0x21')],_0x18e4('0x41'),JSON[_0x18e4('0x42')](_0x172a9a));});});}logger[_0x18e4('0x24')](_0x3096e3[_0x18e4('0x21')],_0x18e4('0x41'));}};Fax[_0x18e4('0x27')][_0x18e4('0x1b')]=function(_0x17d72a){if(this[_0x18e4('0x25')][_0x17d72a[_0x18e4('0x21')]]){_['merge'](this[_0x18e4('0xf')][_0x17d72a[_0x18e4('0x21')]],_[_0x18e4('0x43')](_0x17d72a,[_0x18e4('0x44'),_0x18e4('0x45')]));}};function updateStatus(_0x4df332){if(_0x4df332[_0x18e4('0x46')]){faxMessage['update'](_0x4df332[_0x18e4('0x46')],{'failMessage':_0x18e4('0x47')})[_0x18e4('0x3d')](function(_0x19b162){ut[_0x18e4('0x48')](_0x18e4('0x49'),_0x19b162);})['catch'](function(_0x18faea){ut[_0x18e4('0x48')](_0x18e4('0x4a'),_0x18faea);});}else{ut[_0x18e4('0x48')](_0x18e4('0x4b'));}}Fax[_0x18e4('0x27')][_0x18e4('0x4c')]=function(_0x2b7f82,_0x1aa5c4,_0x289067){var _0x204e11=this;var _0x45760b={};if(_0x1aa5c4){_0x45760b={'read':_0x1aa5c4};}else{_0x45760b={'failMessage':_0x289067};}if(this[_0x18e4('0x25')][_0x2b7f82][_0x18e4('0x46')]){faxMessage[_0x18e4('0x4d')](this['actions'][_0x2b7f82][_0x18e4('0x46')],_0x45760b)[_0x18e4('0x3d')](function(_0x21b454){ut[_0x18e4('0x48')]('[Fax][Message][Updated]',_0x21b454);})[_0x18e4('0x3f')](function(_0x418904){ut[_0x18e4('0x48')](_0x18e4('0x4e'),_0x418904);})['finally'](function(){delete _0x204e11[_0x18e4('0xf')][_0x2b7f82];delete _0x204e11['actions'][_0x2b7f82];});}else{ut['logger'](_0x18e4('0x4f'));delete this[_0x18e4('0xf')][_0x2b7f82];delete this[_0x18e4('0x25')][_0x2b7f82];}};Fax[_0x18e4('0x27')][_0x18e4('0x1a')]=function(_0x5d70ac){var _0x4cd818=this;if(this[_0x18e4('0xf')][_0x5d70ac[_0x18e4('0x21')]]){if(this[_0x18e4('0x25')][_0x5d70ac['uniqueid']]){this[_0x18e4('0xf')][_0x5d70ac[_0x18e4('0x21')]]['id']=this[_0x18e4('0x25')][_0x5d70ac[_0x18e4('0x21')]]['id'];this['channels'][_0x5d70ac['uniqueid']][_0x18e4('0x23')]=this[_0x18e4('0x25')][_0x5d70ac[_0x18e4('0x21')]][_0x18e4('0x23')];}logger[_0x18e4('0x24')](_0x5d70ac[_0x18e4('0x21')],this[_0x18e4('0x25')][_0x5d70ac[_0x18e4('0x21')]]?'\x20hangup\x20sendFile\x20':'\x20hangup\x20faxRiceive\x20',JSON['stringify'](this[_0x18e4('0xf')][_0x5d70ac[_0x18e4('0x21')]]));if(this[_0x18e4('0x25')][_0x5d70ac['uniqueid']]){if(this['channels'][_0x5d70ac['uniqueid']][_0x18e4('0x50')]>0x0&&this[_0x18e4('0xf')][_0x5d70ac[_0x18e4('0x21')]][_0x18e4('0x51')]===_0x18e4('0x52')){this[_0x18e4('0x4c')](_0x5d70ac[_0x18e4('0x21')],!![]);}else{this['updateStatus'](_0x5d70ac['uniqueid'],![],this[_0x18e4('0xf')][_0x5d70ac['uniqueid']]['faxstatusstring']?'SENDING\x20FAILED:\x20'+this['channels'][_0x5d70ac[_0x18e4('0x21')]][_0x18e4('0x53')]:'SENDING\x20FAILED');}}}};Fax[_0x18e4('0x27')]['send']=function(_0x3c1d0c){var _0x25d2c3=this;return new BPromise(function(_0xe818b6,_0x1c33bc){_0x25d2c3[_0x18e4('0x54')](_0x3c1d0c,_0x25d2c3[_0x18e4('0x10')][_0x3c1d0c[_0x18e4('0x55')]])[_0x18e4('0x3d')](function(_0x25ea6f){ut[_0x18e4('0x48')]('[Fax][execOriginate][success]',_0x25ea6f);_0xe818b6(ut['message']('Fax\x20received'));})[_0x18e4('0x3f')](function(_0x541da4){ut[_0x18e4('0x48')](_0x18e4('0x56'),_0x541da4);updateStatus(_0x3c1d0c);_0x1c33bc(ut[_0x18e4('0x38')](_0x18e4('0x57')));});});};Fax['prototype'][_0x18e4('0x58')]=function(_0xa5226f){var _0x1b9393=this;return new BPromise(function(_0x4cb8f5,_0x484c7b){var _0x22d10d=_0x1b9393[_0x18e4('0x59')](_0x1b9393[_0x18e4('0x10')][_0xa5226f['FaxAccountId']][_0x18e4('0x5a')],_0xa5226f);if(_0x22d10d[_0x18e4('0x5b')]){_0x4cb8f5(ut[_0x18e4('0x38')](_0x18e4('0x5c')));}else{_0x484c7b(ut['message'](_0x22d10d[_0x18e4('0x38')]));}});};function originate(_0x5b89ff,_0x527198,_0x20909f){return new BPromise(function(_0x1ce98a,_0x313b3e){if(_0x20909f){var _0x346a1d=util[_0x18e4('0x5d')](_0x18e4('0x5e'),path[_0x18e4('0x3a')](_0x5b89ff[_0x18e4('0x4')])[_0x18e4('0x23')],_0x5b89ff[_0x18e4('0x4')]);gs[_0x18e4('0x5f')](_0x346a1d)[_0x18e4('0x3d')](function(){_0x5b89ff['path']=util[_0x18e4('0x5d')](_0x18e4('0x60'),path[_0x18e4('0x3a')](_0x5b89ff[_0x18e4('0x4')])['dir'],path[_0x18e4('0x3a')](_0x5b89ff['path'])[_0x18e4('0x23')]);_0x527198[_0x18e4('0x61')]=_0x5b89ff[_0x18e4('0x4')];ut[_0x18e4('0x48')](_0x18e4('0x62'),'');ami[_0x18e4('0x63')](ut[_0x18e4('0x64')](_0x5b89ff,_0x527198))['then'](function(_0x901418){_0x1ce98a(_0x901418);})['catch'](function(_0x3f9100){_0x313b3e(_0x3f9100);});})[_0x18e4('0x3f')](function(_0x3809b3){_0x313b3e(_0x3809b3);});}else{ami['Action'](ut[_0x18e4('0x64')](_0x5b89ff,_0x527198))[_0x18e4('0x3d')](function(_0x58007e){_0x1ce98a(_0x58007e);})[_0x18e4('0x3f')](function(_0x103076){_0x313b3e(_0x103076);});}});}Fax[_0x18e4('0x27')][_0x18e4('0x54')]=function(_0x458e87,_0x44e1f2){var _0x1a6c05=this;return new BPromise(function(_0x173775,_0x172174){var _0x3b868b=uuid['v4']();var _0x360cfd=ut[_0x18e4('0x65')](_0x458e87,_0x44e1f2);_0x1a6c05[_0x18e4('0x25')][_0x3b868b]=new Action(_0x3b868b,_0x44e1f2,_0x458e87);var _0x37f6fa=_0x1a6c05[_0x18e4('0x25')][_0x3b868b];if(path[_0x18e4('0x3a')](_0x458e87[_0x18e4('0x4')])[_0x18e4('0x66')]===_0x18e4('0x3b')){originate(_0x37f6fa,_0x360cfd,!![])[_0x18e4('0x3d')](function(_0x39ad58){_0x173775(_0x39ad58);})['catch'](function(_0x4ba296){_0x172174(_0x4ba296);});}else{originate(_0x37f6fa,_0x360cfd,![])[_0x18e4('0x3d')](function(_0x138b9c){_0x173775(_0x138b9c);})[_0x18e4('0x3f')](function(_0x5d6381){_0x172174(_0x5d6381);});}});};Fax['prototype']['isTrunkReachable']=function(_0x515ae8){return!_[_0x18e4('0x67')](_0x515ae8)&&!_[_0x18e4('0x67')](_0x515ae8[_0x18e4('0x23')])&&!_[_0x18e4('0x67')](_0x515ae8[_0x18e4('0x68')])&&_0x515ae8[_0x18e4('0x68')]&&!_[_0x18e4('0x67')](this['trunks'][util[_0x18e4('0x5d')](_0x18e4('0x69'),_0x515ae8['name'])])&&!_[_0x18e4('0x67')](this['trunks'][util[_0x18e4('0x5d')]('SIP/%s',_0x515ae8[_0x18e4('0x23')])][_0x18e4('0x2e')])&&(this[_0x18e4('0x11')][util[_0x18e4('0x5d')](_0x18e4('0x69'),_0x515ae8['name'])][_0x18e4('0x2e')]==='reachable'||this['trunks'][util[_0x18e4('0x5d')]('SIP/%s',_0x515ae8['name'])][_0x18e4('0x2e')]===_0x18e4('0x6a'));};Fax['prototype']['checkTrunk']=function(_0x7a4e71,_0x3d29d2){if(!this['isTrunkReachable'](_0x7a4e71)){ut['logger'](_0x18e4('0x6b'),_[_0x18e4('0x67')](_0x7a4e71)?'':_0x7a4e71[_0x18e4('0x23')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x18e4('0x6c')};}if(_[_0x18e4('0x67')](_0x3d29d2[_0x18e4('0x8')])){ut['logger'](_0x18e4('0x6d'),JSON[_0x18e4('0x42')](_0x3d29d2));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x18e4('0x67')](_0x3d29d2[_0x18e4('0x4')])){ut[_0x18e4('0x48')](_0x18e4('0x6e'),JSON[_0x18e4('0x42')](_0x3d29d2));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x18e4('0x6f')};};module[_0x18e4('0x70')]=Fax; \ No newline at end of file +var _0xd2ca=['../ami','./rpcDb','./channel','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','faxstatus','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','hasOwnProperty','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','syncNewExten','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','localstationid','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','fax','.pdf','error','\x20notify\x20','catch','\x20receiveFax\x20','merge','pick','response','AttachmentId','SENDING\x20FAILED\x20','then','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','stringify','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','Fax\x20failed','checkAfterSend','FaxAccountId','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isNil','active','SIP/%s','unmonitored','checkTrunk','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','lodash','bluebird','uuid','path','tiff2pdf','./util/gs','../../../config/logger'];(function(_0x8de950,_0x2693be){var _0x587a48=function(_0xefd05c){while(--_0xefd05c){_0x8de950['push'](_0x8de950['shift']());}};_0x587a48(++_0x2693be);}(_0xd2ca,0x6d));var _0xad2c=function(_0x3dd4b4,_0x4d367e){_0x3dd4b4=_0x3dd4b4-0x0;var _0x67b842=_0xd2ca[_0x3dd4b4];return _0x67b842;};'use strict';var util=require(_0xad2c('0x0'));var _=require(_0xad2c('0x1'));var BPromise=require(_0xad2c('0x2'));var uuid=require(_0xad2c('0x3'));var moment=require('moment');var path=require(_0xad2c('0x4'));var tiff2pdf=require(_0xad2c('0x5'));var gs=require(_0xad2c('0x6'));var logger=require(_0xad2c('0x7'))('fax');var ami=require(_0xad2c('0x8'));var rpcDb=require(_0xad2c('0x9'));var Channel=require(_0xad2c('0xa'));var ut=require('./util/util');var Action=require(_0xad2c('0xb'));var faxAccount=require(_0xad2c('0xc'));var attachment=require(_0xad2c('0xd'));var faxMessage=require(_0xad2c('0xe'));function Fax(_0x46ca48){this[_0xad2c('0xf')]={};this['faxAccounts']=_0x46ca48[_0xad2c('0x10')];this['trunks']=_0x46ca48[_0xad2c('0x11')];this[_0xad2c('0x12')]={};ami['on'](_0xad2c('0x13'),this[_0xad2c('0x14')][_0xad2c('0x15')](this));ami['on'](_0xad2c('0x16'),this[_0xad2c('0x17')][_0xad2c('0x15')](this));ami['on'](_0xad2c('0x18'),this[_0xad2c('0x19')][_0xad2c('0x15')](this));ami['on'](_0xad2c('0x1a'),this['syncNewExten'][_0xad2c('0x15')](this));ami['on'](_0xad2c('0x1b'),this['syncFaxStatus'][_0xad2c('0x15')](this));ami['on']('receivefax',this[_0xad2c('0x1c')][_0xad2c('0x15')](this));ami['on'](_0xad2c('0x1d'),this[_0xad2c('0x1e')]['bind'](this));ami['on'](_0xad2c('0x1f'),this[_0xad2c('0x20')][_0xad2c('0x15')](this));}Fax[_0xad2c('0x21')][_0xad2c('0x14')]=function(_0x4a5225){if(_0x4a5225[_0xad2c('0x22')]==='from-voip-provider'){for(var _0x4f866c in this['faxAccounts']){if(this[_0xad2c('0x10')][_0xad2c('0x23')](_0x4f866c)){if(_0x4a5225[_0xad2c('0x24')]===this['faxAccounts'][_0x4f866c]['localstationid']){this['channels'][_0x4a5225[_0xad2c('0x25')]]={};this[_0xad2c('0xf')][_0x4a5225[_0xad2c('0x25')]][_0xad2c('0x26')]=_0x4a5225[_0xad2c('0x26')];this[_0xad2c('0xf')][_0x4a5225[_0xad2c('0x25')]]['id']=this[_0xad2c('0x10')][_0x4f866c]['id'];this[_0xad2c('0xf')][_0x4a5225['uniqueid']][_0xad2c('0x27')]=this[_0xad2c('0x10')][_0x4f866c][_0xad2c('0x27')];logger[_0xad2c('0x28')](_0x4a5225[_0xad2c('0x25')],'\x20syncNewchannel\x20');}}}}if(this[_0xad2c('0x12')][_0x4a5225[_0xad2c('0x25')]]){this[_0xad2c('0xf')][_0x4a5225['uniqueid']]={};this[_0xad2c('0xf')][_0x4a5225[_0xad2c('0x25')]]['channel']=_0x4a5225['channel'];logger[_0xad2c('0x28')](_0x4a5225['uniqueid'],_0xad2c('0x29'));}};Fax[_0xad2c('0x21')][_0xad2c('0x17')]=function(_0x180246){if(this[_0xad2c('0xf')][_0x180246[_0xad2c('0x25')]]){for(var _0x3c21b2 in _0x180246['variable']){if(_0x180246[_0xad2c('0x2a')]['hasOwnProperty'](_0x3c21b2)){this[_0xad2c('0xf')][_0x180246[_0xad2c('0x25')]][_0x3c21b2]=_0x180246[_0xad2c('0x2b')];}}}};Fax['prototype'][_0xad2c('0x19')]=function(_0x3c52a4){if(this[_0xad2c('0xf')][_0x3c52a4[_0xad2c('0x25')]]){this['channels'][_0x3c52a4[_0xad2c('0x25')]]['channelstate']=_0x3c52a4[_0xad2c('0x2c')];this[_0xad2c('0xf')][_0x3c52a4[_0xad2c('0x25')]][_0xad2c('0x2d')]=_0x3c52a4[_0xad2c('0x2d')];}};Fax[_0xad2c('0x21')][_0xad2c('0x2e')]=function(_0x2203f6){if(this['channels'][_0x2203f6[_0xad2c('0x25')]]){for(var _0x54bc54 in _0x2203f6['variable']){if(_0x2203f6[_0xad2c('0x2a')][_0xad2c('0x23')](_0x54bc54)){this['channels'][_0x2203f6['uniqueid']][_0x54bc54]=_0x2203f6[_0xad2c('0x2b')];}}}};Fax[_0xad2c('0x21')][_0xad2c('0x2f')]=function(_0x293058){if(this[_0xad2c('0xf')][_0x293058[_0xad2c('0x25')]]){this[_0xad2c('0xf')][_0x293058[_0xad2c('0x25')]][_0xad2c('0x30')]=_0x293058[_0xad2c('0x30')];this[_0xad2c('0xf')][_0x293058[_0xad2c('0x25')]]['status']=_0x293058[_0xad2c('0x31')];this[_0xad2c('0xf')][_0x293058[_0xad2c('0x25')]]['localstationid']=_0x293058['localstationid'];this['channels'][_0x293058[_0xad2c('0x25')]][_0xad2c('0x32')]=_0x293058[_0xad2c('0x32')];logger[_0xad2c('0x28')](_0x293058[_0xad2c('0x25')],_0xad2c('0x33'));}};Fax[_0xad2c('0x21')][_0xad2c('0x1c')]=function(_0x243123){var _0x1f1598=this;if(this[_0xad2c('0xf')][_0x243123[_0xad2c('0x25')]]){var _0x4c1bc6=this[_0xad2c('0xf')][_0x243123[_0xad2c('0x25')]]['id'];this[_0xad2c('0xf')][_0x243123[_0xad2c('0x25')]][_0xad2c('0x34')]=_0x243123[_0xad2c('0x34')];this[_0xad2c('0xf')][_0x243123[_0xad2c('0x25')]][_0xad2c('0x35')]=_0x243123['pagestransferred'];this[_0xad2c('0xf')][_0x243123[_0xad2c('0x25')]][_0xad2c('0x36')]=_0x243123[_0xad2c('0x36')];this[_0xad2c('0xf')][_0x243123['uniqueid']]['resolution']=_0x243123[_0xad2c('0x37')];this['channels'][_0x243123['uniqueid']][_0xad2c('0x38')]=_0x243123[_0xad2c('0x38')];this[_0xad2c('0xf')][_0x243123['uniqueid']][_0xad2c('0x32')]=_0x243123['filename'];this[_0xad2c('0xf')][_0x243123[_0xad2c('0x25')]][_0xad2c('0x39')]=_0x243123[_0xad2c('0x39')];if(this[_0xad2c('0xf')][_0x243123[_0xad2c('0x25')]]['pagestransferred']>0x0){tiff2pdf(_0x243123[_0xad2c('0x32')],'/var/opt/motion2/server/files/attachments/',function(_0x57ccf9){logger['info'](_0x243123[_0xad2c('0x25')],_0xad2c('0x3a'),_0x57ccf9[_0xad2c('0x3b')]);attachment[_0xad2c('0x3c')]({'name':path[_0xad2c('0x3d')](_0x243123[_0xad2c('0x32')])['name'],'basename':path[_0xad2c('0x3d')](_0x243123[_0xad2c('0x32')])[_0xad2c('0x27')]+'.pdf','type':'application/pdf'})['then'](function(_0xbd97ec){faxAccount['notify'](_0x4c1bc6,{'from':_0x243123['calleridnum'],'mapKey':_0xad2c('0x3e'),'body':path['parse'](_0x243123[_0xad2c('0x32')])[_0xad2c('0x27')]+_0xad2c('0x3f'),'AttachmentId':_0xbd97ec['id']})['catch'](function(_0x32a6a7){logger[_0xad2c('0x40')](_0x243123[_0xad2c('0x25')],_0xad2c('0x41'),JSON['stringify'](_0x32a6a7));});})[_0xad2c('0x42')](function(_0x122b50){logger['error'](_0x243123[_0xad2c('0x25')],_0xad2c('0x43'),JSON['stringify'](_0x122b50));});});}logger[_0xad2c('0x28')](_0x243123[_0xad2c('0x25')],'\x20receiveFax\x20');}};Fax[_0xad2c('0x21')][_0xad2c('0x20')]=function(_0x286a30){if(this['actions'][_0x286a30[_0xad2c('0x25')]]){_[_0xad2c('0x44')](this[_0xad2c('0xf')][_0x286a30[_0xad2c('0x25')]],_[_0xad2c('0x45')](_0x286a30,[_0xad2c('0x46'),'reason']));}};function updateStatus(_0x563074){if(_0x563074[_0xad2c('0x47')]){faxMessage['update'](_0x563074['AttachmentId'],{'failMessage':_0xad2c('0x48')})[_0xad2c('0x49')](function(_0x2cf2bd){ut['logger'](_0xad2c('0x4a'),_0x2cf2bd);})[_0xad2c('0x42')](function(_0x242204){ut[_0xad2c('0x4b')](_0xad2c('0x4c'),_0x242204);});}else{ut[_0xad2c('0x4b')](_0xad2c('0x4d'));}}Fax[_0xad2c('0x21')][_0xad2c('0x4e')]=function(_0x2db0cd,_0x45d4ca,_0x2a6b1c){var _0x40dfbf=this;var _0x2d0a90={};if(_0x45d4ca){_0x2d0a90={'read':_0x45d4ca};}else{_0x2d0a90={'failMessage':_0x2a6b1c};}if(this[_0xad2c('0x12')][_0x2db0cd][_0xad2c('0x47')]){faxMessage['update'](this['actions'][_0x2db0cd][_0xad2c('0x47')],_0x2d0a90)[_0xad2c('0x49')](function(_0x475202){ut['logger'](_0xad2c('0x4f'),_0x475202);})[_0xad2c('0x42')](function(_0x1dd2a1){ut[_0xad2c('0x4b')]('[Fax][Message][NoUpdate1]',_0x1dd2a1);})[_0xad2c('0x50')](function(){delete _0x40dfbf['channels'][_0x2db0cd];delete _0x40dfbf[_0xad2c('0x12')][_0x2db0cd];});}else{ut['logger'](_0xad2c('0x51'));delete this[_0xad2c('0xf')][_0x2db0cd];delete this[_0xad2c('0x12')][_0x2db0cd];}};Fax[_0xad2c('0x21')][_0xad2c('0x1e')]=function(_0x3240d5){var _0x420c41=this;if(this['channels'][_0x3240d5[_0xad2c('0x25')]]){if(this[_0xad2c('0x12')][_0x3240d5[_0xad2c('0x25')]]){this[_0xad2c('0xf')][_0x3240d5[_0xad2c('0x25')]]['id']=this[_0xad2c('0x12')][_0x3240d5[_0xad2c('0x25')]]['id'];this[_0xad2c('0xf')][_0x3240d5[_0xad2c('0x25')]]['name']=this[_0xad2c('0x12')][_0x3240d5['uniqueid']][_0xad2c('0x27')];}logger[_0xad2c('0x28')](_0x3240d5[_0xad2c('0x25')],this[_0xad2c('0x12')][_0x3240d5[_0xad2c('0x25')]]?'\x20hangup\x20sendFile\x20':'\x20hangup\x20faxRiceive\x20',JSON[_0xad2c('0x52')](this[_0xad2c('0xf')][_0x3240d5['uniqueid']]));if(this[_0xad2c('0x12')][_0x3240d5['uniqueid']]){if(this[_0xad2c('0xf')][_0x3240d5[_0xad2c('0x25')]]['faxpages']>0x0&&this[_0xad2c('0xf')][_0x3240d5['uniqueid']][_0xad2c('0x1b')]===_0xad2c('0x53')){this[_0xad2c('0x4e')](_0x3240d5['uniqueid'],!![]);}else{this[_0xad2c('0x4e')](_0x3240d5[_0xad2c('0x25')],![],this[_0xad2c('0xf')][_0x3240d5[_0xad2c('0x25')]][_0xad2c('0x54')]?_0xad2c('0x55')+this[_0xad2c('0xf')][_0x3240d5['uniqueid']][_0xad2c('0x54')]:'SENDING\x20FAILED');}}}};Fax[_0xad2c('0x21')][_0xad2c('0x56')]=function(_0x59a639){var _0xe7a84e=this;return new BPromise(function(_0x206121,_0x5b2d45){_0xe7a84e[_0xad2c('0x57')](_0x59a639,_0xe7a84e[_0xad2c('0x10')][_0x59a639['FaxAccountId']])['then'](function(_0x39b366){ut[_0xad2c('0x4b')](_0xad2c('0x58'),_0x39b366);_0x206121(ut[_0xad2c('0x3b')](_0xad2c('0x59')));})['catch'](function(_0x368663){ut[_0xad2c('0x4b')]('[Fax][execOriginate][failure]',_0x368663);updateStatus(_0x59a639);_0x5b2d45(ut[_0xad2c('0x3b')](_0xad2c('0x5a')));});});};Fax['prototype'][_0xad2c('0x5b')]=function(_0x497293){var _0x1b63d4=this;return new BPromise(function(_0x107650,_0x344f7a){var _0x373031=_0x1b63d4['checkTrunk'](_0x1b63d4['faxAccounts'][_0x497293[_0xad2c('0x5c')]]['Trunk'],_0x497293);if(_0x373031[_0xad2c('0x5d')]){_0x107650(ut[_0xad2c('0x3b')](_0xad2c('0x5e')));}else{_0x344f7a(ut['message'](_0x373031[_0xad2c('0x3b')]));}});};function originate(_0x326dfa,_0x32b7ce,_0x1a0683){return new BPromise(function(_0x4f874e,_0xc1644d){if(_0x1a0683){var _0x40236b=util[_0xad2c('0x5f')](_0xad2c('0x60'),path[_0xad2c('0x3d')](_0x326dfa['path'])['name'],_0x326dfa[_0xad2c('0x4')]);gs[_0xad2c('0x61')](_0x40236b)[_0xad2c('0x49')](function(){_0x326dfa[_0xad2c('0x4')]=util['format'](_0xad2c('0x62'),path[_0xad2c('0x3d')](_0x326dfa[_0xad2c('0x4')])[_0xad2c('0x63')],path[_0xad2c('0x3d')](_0x326dfa['path'])[_0xad2c('0x27')]);_0x32b7ce[_0xad2c('0x64')]=_0x326dfa['path'];ut[_0xad2c('0x4b')](_0xad2c('0x65'),'');ami[_0xad2c('0x66')](ut[_0xad2c('0x67')](_0x326dfa,_0x32b7ce))['then'](function(_0x3d3503){_0x4f874e(_0x3d3503);})[_0xad2c('0x42')](function(_0x19cfe5){_0xc1644d(_0x19cfe5);});})['catch'](function(_0x4ff659){_0xc1644d(_0x4ff659);});}else{ami[_0xad2c('0x66')](ut[_0xad2c('0x67')](_0x326dfa,_0x32b7ce))[_0xad2c('0x49')](function(_0x56ea9f){_0x4f874e(_0x56ea9f);})[_0xad2c('0x42')](function(_0x3befcc){_0xc1644d(_0x3befcc);});}});}Fax[_0xad2c('0x21')]['execOriginate']=function(_0x8d3e51,_0x10971f){var _0x98481e=this;return new BPromise(function(_0x503286,_0xe67a02){var _0x294183=uuid['v4']();var _0xd3790d=ut[_0xad2c('0x68')](_0x8d3e51,_0x10971f);_0x98481e['actions'][_0x294183]=new Action(_0x294183,_0x10971f,_0x8d3e51);var _0x973101=_0x98481e[_0xad2c('0x12')][_0x294183];if(path[_0xad2c('0x3d')](_0x8d3e51[_0xad2c('0x4')])['ext']===_0xad2c('0x3f')){originate(_0x973101,_0xd3790d,!![])[_0xad2c('0x49')](function(_0x1cb81e){_0x503286(_0x1cb81e);})[_0xad2c('0x42')](function(_0x3f124f){_0xe67a02(_0x3f124f);});}else{originate(_0x973101,_0xd3790d,![])[_0xad2c('0x49')](function(_0x449ba2){_0x503286(_0x449ba2);})['catch'](function(_0x1d9e95){_0xe67a02(_0x1d9e95);});}});};Fax[_0xad2c('0x21')]['isTrunkReachable']=function(_0x4874a1){return!_['isNil'](_0x4874a1)&&!_[_0xad2c('0x69')](_0x4874a1[_0xad2c('0x27')])&&!_['isNil'](_0x4874a1[_0xad2c('0x6a')])&&_0x4874a1[_0xad2c('0x6a')]&&!_[_0xad2c('0x69')](this[_0xad2c('0x11')][util['format'](_0xad2c('0x6b'),_0x4874a1[_0xad2c('0x27')])])&&!_[_0xad2c('0x69')](this[_0xad2c('0x11')][util[_0xad2c('0x5f')]('SIP/%s',_0x4874a1[_0xad2c('0x27')])][_0xad2c('0x31')])&&(this[_0xad2c('0x11')][util[_0xad2c('0x5f')]('SIP/%s',_0x4874a1[_0xad2c('0x27')])]['status']==='reachable'||this[_0xad2c('0x11')][util['format'](_0xad2c('0x6b'),_0x4874a1[_0xad2c('0x27')])][_0xad2c('0x31')]===_0xad2c('0x6c'));};Fax['prototype'][_0xad2c('0x6d')]=function(_0x3ad854,_0x185fc1){if(!this[_0xad2c('0x6e')](_0x3ad854)){ut['logger'](_0xad2c('0x6f'),_['isNil'](_0x3ad854)?'':_0x3ad854['name']+_0xad2c('0x70'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_['isNil'](_0x185fc1[_0xad2c('0x3e')])){ut[_0xad2c('0x4b')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xad2c('0x52')](_0x185fc1));return{'isValid':![],'message':_0xad2c('0x71')};}if(_[_0xad2c('0x69')](_0x185fc1[_0xad2c('0x4')])){ut['logger'](_0xad2c('0x72'),JSON[_0xad2c('0x52')](_0x185fc1));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0xad2c('0x73')};};module[_0xad2c('0x74')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 5b31ddf..2ea4fbb 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 _0xe356=['util','../../../config/logger','preview','lodash','../rpc/faxAccount','inspect','then','notify','[Notify]\x20'];(function(_0x4a58b7,_0xe6c30b){var _0x3afe14=function(_0x29a5e7){while(--_0x29a5e7){_0x4a58b7['push'](_0x4a58b7['shift']());}};_0x3afe14(++_0xe6c30b);}(_0xe356,0x144));var _0x6e35=function(_0x20caec,_0x16cb7e){_0x20caec=_0x20caec-0x0;var _0x5cbb27=_0xe356[_0x20caec];return _0x5cbb27;};'use strict';var util=require(_0x6e35('0x0'));var BPromise=require('bluebird');var logger=require(_0x6e35('0x1'))(_0x6e35('0x2'));var _=require(_0x6e35('0x3'));var faxAccount=require(_0x6e35('0x4'));function loggerCatch(_0x2c683e){return function(_0x31eb0d){logger['error'](_0x2c683e,util[_0x6e35('0x5')](_0x31eb0d,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x2efaaf,_0x497320){return BPromise['resolve']()[_0x6e35('0x6')](faxAccount[_0x6e35('0x7')](_0x2efaaf,_0x497320))['catch'](loggerCatch(_0x6e35('0x8')));}; \ No newline at end of file +var _0x8a7c=['lodash','error','inspect','notify','resolve','[Notify]\x20','util','../../../config/logger','preview'];(function(_0xabdad4,_0x52c7b5){var _0xb69638=function(_0x78bb99){while(--_0x78bb99){_0xabdad4['push'](_0xabdad4['shift']());}};_0xb69638(++_0x52c7b5);}(_0x8a7c,0xf9));var _0xc8a7=function(_0x291e69,_0x29b571){_0x291e69=_0x291e69-0x0;var _0x3e1c1c=_0x8a7c[_0x291e69];return _0x3e1c1c;};'use strict';var util=require(_0xc8a7('0x0'));var BPromise=require('bluebird');var logger=require(_0xc8a7('0x1'))(_0xc8a7('0x2'));var _=require(_0xc8a7('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x213fb1){return function(_0x4b24ad){logger[_0xc8a7('0x4')](_0x213fb1,util[_0xc8a7('0x5')](_0x4b24ad,{'showHidden':![],'depth':null}));};}exports[_0xc8a7('0x6')]=function(_0x21ccfc,_0x1ba2d8){return BPromise[_0xc8a7('0x7')]()['then'](faxAccount[_0xc8a7('0x6')](_0x21ccfc,_0x1ba2d8))['catch'](loggerCatch(_0xc8a7('0x8')));}; \ 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 78e7c76..42bdfda 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 _0x5d6c=['inspect','../../../../config/logger','child_process','exec','execute','Exec\x20gs','info','\x20Error\x20:'];(function(_0x37a416,_0x14ee6a){var _0x47959e=function(_0x57aa93){while(--_0x57aa93){_0x37a416['push'](_0x37a416['shift']());}};_0x47959e(++_0x14ee6a);}(_0x5d6c,0xa1));var _0xc5d6=function(_0x4ea773,_0x50c3b0){_0x4ea773=_0x4ea773-0x0;var _0x42b5d1=_0x5d6c[_0x4ea773];return _0x42b5d1;};'use strict';var util=require('util');var logger=require(_0xc5d6('0x0'))('fax');var BPromise=require('bluebird');var exec=require(_0xc5d6('0x1'))[_0xc5d6('0x2')];exports[_0xc5d6('0x3')]=function(_0x2b9188){return new BPromise(function(_0x1eb030,_0x3abc4d){exec(_0x2b9188,function(_0xebc1e6,_0x5bb2cc,_0x5aaf42){logger['info'](_0xc5d6('0x4'),_0x5bb2cc);if(_0xebc1e6){logger[_0xc5d6('0x5')](_0xc5d6('0x4'),_0xc5d6('0x6'),util[_0xc5d6('0x7')](_0xebc1e6,{'showHidden':![],'depth':null}),_0x5bb2cc,_0x5aaf42);_0x3abc4d(_0xebc1e6);}_0x1eb030(_0x5bb2cc);});});}; \ No newline at end of file +var _0xc3d6=['child_process','execute','Exec\x20gs','info','\x20Error\x20:','inspect','util','fax','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc3d6,0x180));var _0x6c3d=function(_0x52cf2a,_0x248b2e){_0x52cf2a=_0x52cf2a-0x0;var _0x1ee4e5=_0xc3d6[_0x52cf2a];return _0x1ee4e5;};'use strict';var util=require(_0x6c3d('0x0'));var logger=require('../../../../config/logger')(_0x6c3d('0x1'));var BPromise=require(_0x6c3d('0x2'));var exec=require(_0x6c3d('0x3'))['exec'];exports[_0x6c3d('0x4')]=function(_0x15eead){return new BPromise(function(_0x43132d,_0x2ab6c4){exec(_0x15eead,function(_0x35d2e7,_0x4e5114,_0x3fa9ff){logger['info'](_0x6c3d('0x5'),_0x4e5114);if(_0x35d2e7){logger[_0x6c3d('0x6')](_0x6c3d('0x5'),_0x6c3d('0x7'),util[_0x6c3d('0x8')](_0x35d2e7,{'showHidden':![],'depth':null}),_0x4e5114,_0x3fa9ff);_0x2ab6c4(_0x35d2e7);}_0x43132d(_0x4e5114);});});}; \ 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 c75243a..9355e3a 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 _0x770e=['format','\x22%s\x22','gateway','faxdetect','t38timeout','path','uniqueid','originate','channel','from-sip','\x22%s\x22\x20<%s>','localstationid','lodash','../../../../config/logger','message','logger','inspect','addVariables','headerinfo','minrate'];(function(_0x1f3a0c,_0x3c55c8){var _0x1cf471=function(_0x36c2a3){while(--_0x36c2a3){_0x1f3a0c['push'](_0x1f3a0c['shift']());}};_0x1cf471(++_0x3c55c8);}(_0x770e,0x1b0));var _0xe770=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x770e[_0x33032e];return _0x13316b;};'use strict';var util=require('util');var _=require(_0xe770('0x0'));var moment=require('moment');var logger=require(_0xe770('0x1'))('fax');exports[_0xe770('0x2')]=function(_0x3d5b68){return{'message':_0x3d5b68};};exports[_0xe770('0x3')]=function(_0x46a026,_0x1540c8){logger['info'](_0x46a026,util[_0xe770('0x4')](_0x1540c8,{'showHidden':![],'depth':null}));};exports[_0xe770('0x5')]=function(_0x592b6c,_0x4e4eb0){var _0x4d8fdc={'XMF-ECM':_0x4e4eb0['ecm'],'XMF-HEADERINFO':_0x4e4eb0[_0xe770('0x6')],'XMF-MINRATE':_0x4e4eb0[_0xe770('0x7')],'XMF-MAXRATE':_0x4e4eb0['maxrate'],'XMF-MODEM':util[_0xe770('0x8')](_0xe770('0x9'),_0x4e4eb0['modem']),'XMF-GATEWAY':_0x4e4eb0[_0xe770('0xa')],'XMF-FAXDETECT':_0x4e4eb0[_0xe770('0xb')],'XMF-T38TIMEOUT':_0x4e4eb0[_0xe770('0xc')],'XMF-LOCALSTATIONID':_0x4e4eb0['localstationid'],'XMF-PATH':_0x592b6c[_0xe770('0xd')]};return _0x4d8fdc;};exports['variablesAction']=function(_0x2b0478,_0x27b650){return{'actionid':_0x2b0478[_0xe770('0xe')],'action':_0xe770('0xf'),'channel':_0x2b0478[_0xe770('0x10')],'Exten':'xcally-motion-fax','Context':_0xe770('0x11'),'Priority':'1','callerid':util['format'](_0xe770('0x12'),_0x2b0478[_0xe770('0x6')]?_0x2b0478[_0xe770('0x6')]:'',_0x2b0478[_0xe770('0x13')]),'variable':_0x27b650,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2b0478[_0xe770('0xe')]};}; \ No newline at end of file +var _0xfda1=['originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash','fax','message','addVariables','headerinfo','minrate','format','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xfda1,0x16d));var _0x1fda=function(_0x1bc4bf,_0x1be6f3){_0x1bc4bf=_0x1bc4bf-0x0;var _0x3feb6c=_0xfda1[_0x1bc4bf];return _0x3feb6c;};'use strict';var util=require(_0x1fda('0x0'));var _=require(_0x1fda('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')(_0x1fda('0x2'));exports[_0x1fda('0x3')]=function(_0x11a01e){return{'message':_0x11a01e};};exports['logger']=function(_0x160a8e,_0x5527d0){logger['info'](_0x160a8e,util['inspect'](_0x5527d0,{'showHidden':![],'depth':null}));};exports[_0x1fda('0x4')]=function(_0x1906e2,_0x47b083){var _0x517ee3={'XMF-ECM':_0x47b083['ecm'],'XMF-HEADERINFO':_0x47b083[_0x1fda('0x5')],'XMF-MINRATE':_0x47b083[_0x1fda('0x6')],'XMF-MAXRATE':_0x47b083['maxrate'],'XMF-MODEM':util[_0x1fda('0x7')]('\x22%s\x22',_0x47b083[_0x1fda('0x8')]),'XMF-GATEWAY':_0x47b083[_0x1fda('0x9')],'XMF-FAXDETECT':_0x47b083[_0x1fda('0xa')],'XMF-T38TIMEOUT':_0x47b083[_0x1fda('0xb')],'XMF-LOCALSTATIONID':_0x47b083[_0x1fda('0xc')],'XMF-PATH':_0x1906e2[_0x1fda('0xd')]};return _0x517ee3;};exports[_0x1fda('0xe')]=function(_0x58e685,_0x36e424){return{'actionid':_0x58e685['uniqueid'],'action':_0x1fda('0xf'),'channel':_0x58e685[_0x1fda('0x10')],'Exten':_0x1fda('0x11'),'Context':_0x1fda('0x12'),'Priority':'1','callerid':util[_0x1fda('0x7')](_0x1fda('0x13'),_0x58e685['headerinfo']?_0x58e685[_0x1fda('0x5')]:'',_0x58e685[_0x1fda('0xc')]),'variable':_0x36e424,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x58e685['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index f8663a7..24cc35c 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 _0x0617=['./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','initAgents','getTrunks','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','sync','bluebird','util','moment','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk'];(function(_0x221686,_0x1b686e){var _0x3a8d5b=function(_0x232794){while(--_0x232794){_0x221686['push'](_0x221686['shift']());}};_0x3a8d5b(++_0x1b686e);}(_0x0617,0x14c));var _0x7061=function(_0x1199a5,_0x5bd63b){_0x1199a5=_0x1199a5-0x0;var _0x29d7b6=_0x0617[_0x1199a5];return _0x29d7b6;};'use strict';var BPromise=require(_0x7061('0x0'));var util=require(_0x7061('0x1'));var moment=require(_0x7061('0x2'));var server=require('./server');var Realtime=require(_0x7061('0x3'));var Report=require(_0x7061('0x4'));var Acw=require(_0x7061('0x5'));var Trigger=require(_0x7061('0x6'));var Dialer=require(_0x7061('0x7'));var Preview=require(_0x7061('0x8'));var Fax=require(_0x7061('0x9'));var user=require(_0x7061('0xa'));var voiceQueue=require(_0x7061('0xb'));var voiceQueueReport=require(_0x7061('0xc'));var voiceCallReport=require(_0x7061('0xd'));var trunk=require('./rpc/trunk');var trigger=require(_0x7061('0xe'));var template=require('./rpc/template');var cmHopperHistory=require(_0x7061('0xf'));var campaign=require(_0x7061('0x10'));var voiceExtension=require(_0x7061('0x11'));var faxAccount=require(_0x7061('0x12'));var zendesk=require(_0x7061('0x13'));var salesforce=require(_0x7061('0x14'));var sugarcrm=require(_0x7061('0x15'));var freshdesk=require(_0x7061('0x16'));var desk=require(_0x7061('0x17'));var zoho=require(_0x7061('0x18'));var vtiger=require(_0x7061('0x19'));var freshsales=require(_0x7061('0x1a'));var servicenow=require(_0x7061('0x1b'));var dynamics365=require(_0x7061('0x1c'));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 isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x7061('0x1d')](_0x7061('0x1e'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x7061('0x1d')](_0x7061('0x1e'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x7061('0x1f')]()['then'](user['getAgents']())[_0x7061('0x20')](realtime[_0x7061('0x21')]())[_0x7061('0x20')](user['getTelephones']())['then'](realtime['initTelephones']())[_0x7061('0x20')](trunk[_0x7061('0x22')]())[_0x7061('0x20')](realtime[_0x7061('0x23')]())[_0x7061('0x20')](voiceQueue[_0x7061('0x24')]())[_0x7061('0x20')](realtime['initVoiceQueues']())[_0x7061('0x20')](trigger[_0x7061('0x25')]())['then'](realtime[_0x7061('0x26')]())[_0x7061('0x20')](template[_0x7061('0x27')]())[_0x7061('0x20')](realtime[_0x7061('0x28')]())[_0x7061('0x20')](zendesk['getZendeskAccounts']())[_0x7061('0x20')](realtime[_0x7061('0x29')]())[_0x7061('0x20')](salesforce[_0x7061('0x2a')]())[_0x7061('0x20')](realtime[_0x7061('0x2b')]())['then'](sugarcrm[_0x7061('0x2c')]())[_0x7061('0x20')](realtime[_0x7061('0x2d')]())[_0x7061('0x20')](freshdesk['getFreshdeskAccounts']())[_0x7061('0x20')](realtime[_0x7061('0x2e')]())[_0x7061('0x20')](desk[_0x7061('0x2f')]())[_0x7061('0x20')](realtime[_0x7061('0x30')]())[_0x7061('0x20')](zoho['getZohoAccounts']())['then'](realtime[_0x7061('0x31')]())['then'](vtiger['getVtigerAccounts']())['then'](realtime[_0x7061('0x32')]())[_0x7061('0x20')](freshsales[_0x7061('0x33')]())['then'](realtime[_0x7061('0x34')]())[_0x7061('0x20')](servicenow['getServicenowAccounts']())['then'](realtime[_0x7061('0x35')]())[_0x7061('0x20')](dynamics365[_0x7061('0x36')]())[_0x7061('0x20')](realtime[_0x7061('0x37')]())[_0x7061('0x20')](campaign[_0x7061('0x38')]())[_0x7061('0x20')](realtime[_0x7061('0x39')]())['then'](voiceExtension[_0x7061('0x3a')]())[_0x7061('0x20')](realtime[_0x7061('0x3b')]())[_0x7061('0x20')](faxAccount['getFaxAccounts']())['then'](realtime[_0x7061('0x3c')]())[_0x7061('0x20')](function(){return realtime;});}function initParams(){return BPromise[_0x7061('0x1f')]()[_0x7061('0x20')](voiceQueueReport[_0x7061('0x3d')]())[_0x7061('0x20')](realtime[_0x7061('0x3e')]())['then'](cmHopperHistory[_0x7061('0x3f')]())[_0x7061('0x20')](realtime['initVoiceQueueHopperHistory']())[_0x7061('0x20')](cmHopperHistory[_0x7061('0x40')]())[_0x7061('0x20')](realtime['initCampaignHopperHistory']())[_0x7061('0x20')](voiceCallReport[_0x7061('0x41')]())[_0x7061('0x20')](realtime[_0x7061('0x42')]())['then'](function(_0x2164db){})[_0x7061('0x43')](function(_0x120406){console[_0x7061('0x44')](_0x120406);});}function main(){return server[_0x7061('0x45')](realtime,preview,fax)['then'](function(_0x53645b){return initRealtime();})[_0x7061('0x20')](function(){return initParams();})[_0x7061('0x20')](function(){report[_0x7061('0x46')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x3bc356){console[_0x7061('0x44')](_0x3bc356);});}main(); \ No newline at end of file +var _0x139f=['./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','listen','sync','log','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory'];(function(_0x29faa1,_0x150505){var _0x11e02b=function(_0x40aa1d){while(--_0x40aa1d){_0x29faa1['push'](_0x29faa1['shift']());}};_0x11e02b(++_0x150505);}(_0x139f,0x10d));var _0xf139=function(_0x190fcd,_0x491fa5){_0x190fcd=_0x190fcd-0x0;var _0x4ef2fb=_0x139f[_0x190fcd];return _0x4ef2fb;};'use strict';var BPromise=require('bluebird');var util=require('util');var moment=require('moment');var server=require(_0xf139('0x0'));var Realtime=require(_0xf139('0x1'));var Report=require(_0xf139('0x2'));var Acw=require(_0xf139('0x3'));var Trigger=require(_0xf139('0x4'));var Dialer=require(_0xf139('0x5'));var Preview=require(_0xf139('0x6'));var Fax=require(_0xf139('0x7'));var user=require(_0xf139('0x8'));var voiceQueue=require(_0xf139('0x9'));var voiceQueueReport=require(_0xf139('0xa'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0xf139('0xb'));var trigger=require(_0xf139('0xc'));var template=require(_0xf139('0xd'));var cmHopperHistory=require(_0xf139('0xe'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0xf139('0xf'));var faxAccount=require(_0xf139('0x10'));var zendesk=require(_0xf139('0x11'));var salesforce=require(_0xf139('0x12'));var sugarcrm=require(_0xf139('0x13'));var freshdesk=require(_0xf139('0x14'));var desk=require(_0xf139('0x15'));var zoho=require(_0xf139('0x16'));var vtiger=require(_0xf139('0x17'));var freshsales=require(_0xf139('0x18'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0xf139('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 isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xf139('0x1a')](_0xf139('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xf139('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xf139('0x1c')]()[_0xf139('0x1d')](user[_0xf139('0x1e')]())[_0xf139('0x1d')](realtime['initAgents']())[_0xf139('0x1d')](user['getTelephones']())['then'](realtime[_0xf139('0x1f')]())[_0xf139('0x1d')](trunk[_0xf139('0x20')]())[_0xf139('0x1d')](realtime[_0xf139('0x21')]())['then'](voiceQueue[_0xf139('0x22')]())[_0xf139('0x1d')](realtime[_0xf139('0x23')]())[_0xf139('0x1d')](trigger[_0xf139('0x24')]())[_0xf139('0x1d')](realtime['initTriggers']())[_0xf139('0x1d')](template[_0xf139('0x25')]())[_0xf139('0x1d')](realtime[_0xf139('0x26')]())[_0xf139('0x1d')](zendesk[_0xf139('0x27')]())[_0xf139('0x1d')](realtime[_0xf139('0x28')]())[_0xf139('0x1d')](salesforce['getSalesforceAccounts']())[_0xf139('0x1d')](realtime['initSalesforceAccounts']())[_0xf139('0x1d')](sugarcrm['getSugarcrmAccounts']())[_0xf139('0x1d')](realtime[_0xf139('0x29')]())[_0xf139('0x1d')](freshdesk[_0xf139('0x2a')]())[_0xf139('0x1d')](realtime['initFreshdeskAccounts']())[_0xf139('0x1d')](desk[_0xf139('0x2b')]())[_0xf139('0x1d')](realtime[_0xf139('0x2c')]())[_0xf139('0x1d')](zoho[_0xf139('0x2d')]())[_0xf139('0x1d')](realtime[_0xf139('0x2e')]())[_0xf139('0x1d')](vtiger[_0xf139('0x2f')]())[_0xf139('0x1d')](realtime[_0xf139('0x30')]())[_0xf139('0x1d')](freshsales[_0xf139('0x31')]())[_0xf139('0x1d')](realtime[_0xf139('0x32')]())['then'](servicenow[_0xf139('0x33')]())['then'](realtime[_0xf139('0x34')]())[_0xf139('0x1d')](dynamics365['getDynamics365Accounts']())[_0xf139('0x1d')](realtime[_0xf139('0x35')]())[_0xf139('0x1d')](campaign[_0xf139('0x36')]())[_0xf139('0x1d')](realtime[_0xf139('0x37')]())[_0xf139('0x1d')](voiceExtension[_0xf139('0x38')]())[_0xf139('0x1d')](realtime[_0xf139('0x39')]())['then'](faxAccount[_0xf139('0x3a')]())[_0xf139('0x1d')](realtime['initFaxAccounts']())[_0xf139('0x1d')](function(){return realtime;});}function initParams(){return BPromise[_0xf139('0x1c')]()[_0xf139('0x1d')](voiceQueueReport[_0xf139('0x3b')]())[_0xf139('0x1d')](realtime[_0xf139('0x3c')]())[_0xf139('0x1d')](cmHopperHistory[_0xf139('0x3d')]())['then'](realtime[_0xf139('0x3e')]())[_0xf139('0x1d')](cmHopperHistory[_0xf139('0x3f')]())['then'](realtime[_0xf139('0x40')]())[_0xf139('0x1d')](voiceCallReport[_0xf139('0x41')]())[_0xf139('0x1d')](realtime[_0xf139('0x42')]())['then'](function(_0x142169){})[_0xf139('0x43')](function(_0x37ed32){console['log'](_0x37ed32);});}function main(){return server[_0xf139('0x44')](realtime,preview,fax)[_0xf139('0x1d')](function(_0x5714d5){return initRealtime();})['then'](function(){return initParams();})[_0xf139('0x1d')](function(){report[_0xf139('0x45')]();setInterval(initRealtime,0x1388);})[_0xf139('0x43')](function(_0x448d1b){console[_0xf139('0x46')](_0x448d1b);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index b7f023c..636055c 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 _0xe706=['address','phone','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','updateStatusRealtime','not_inuse','inuse','talking','format','interface','stringify','md5','user:%s','emit','user:presence','lodash','util','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status'];(function(_0x3833f9,_0x3a088e){var _0x162837=function(_0x5282bd){while(--_0x5282bd){_0x3833f9['push'](_0x3833f9['shift']());}};_0x162837(++_0x3a088e);}(_0xe706,0xa3));var _0x6e70=function(_0x2a2b9d,_0x29ad81){_0x2a2b9d=_0x2a2b9d-0x0;var _0x314b2d=_0xe706[_0x2a2b9d];return _0x314b2d;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var md5=require('md5');var Redis=require(_0x6e70('0x3'));var config=require(_0x6e70('0x4'));config[_0x6e70('0x5')]=_[_0x6e70('0x6')](config[_0x6e70('0x5')],{'host':_0x6e70('0x7'),'port':0x18eb});var io=require(_0x6e70('0x8'))(new Redis(config[_0x6e70('0x5')]));function Agent(_0x1b0389){this['id']=_0x1b0389['id']||0x0;this[_0x6e70('0x9')]=_0x1b0389[_0x6e70('0x9')]||'';this[_0x6e70('0xa')]=_0x1b0389[_0x6e70('0xa')]||'';this[_0x6e70('0xb')]=_0x1b0389[_0x6e70('0xb')]||'';this[_0x6e70('0xc')]=_0x1b0389[_0x6e70('0xc')]||'';this[_0x6e70('0xd')]=_0x6e70('0xe');this[_0x6e70('0xf')]=0x0;this[_0x6e70('0x10')]=_0x6e70('0xe');this[_0x6e70('0x11')]='';this[_0x6e70('0x12')]='';this['mobile']='';this['interface']='';this[_0x6e70('0x13')]=_0x1b0389[_0x6e70('0x13')]||![];this[_0x6e70('0x14')]=_0x6e70('0xe');this[_0x6e70('0x15')]=0x0;this[_0x6e70('0x16')]='';this[_0x6e70('0x17')]='';this[_0x6e70('0x18')]=![];this['local']=![];this['md5']='';}Agent['prototype'][_0x6e70('0x19')]=function(_0x5a37a6){var _0x53aed0;if(_0x5a37a6&&_0x5a37a6[_0x6e70('0xd')]){_0x53aed0=_0x5a37a6[_0x6e70('0xd')]['toLowerCase']();switch(_0x53aed0){case _0x6e70('0x1a'):_0x53aed0='idle';break;case _0x6e70('0x1b'):_0x53aed0=_0x6e70('0x1c');break;}}if(_0x53aed0&&this['voiceStatus']!==_0x53aed0||_0x5a37a6['statePause']){this[_0x6e70('0x15')]=_['toNumber'](moment()[_0x6e70('0x1d')]('x'));}if(_0x53aed0){this[_0x6e70('0x14')]=_0x53aed0;}var _0x53acdc={'id':this['id'],'name':this['name'],'email':this[_0x6e70('0xa')],'accountcode':this[_0x6e70('0xb')],'fullname':this[_0x6e70('0xc')],'state':this[_0x6e70('0xd')],'stateTime':this[_0x6e70('0xf')],'status':this[_0x6e70('0x10')],'address':this[_0x6e70('0x11')],'online':this[_0x6e70('0x13')],'voiceStatus':this[_0x6e70('0x14')],'voiceStatusTime':this[_0x6e70('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x6e70('0x17')],'interface':this[_0x6e70('0x1e')],'onhold':this[_0x6e70('0x18')]};var _0x502b2d=md5(JSON[_0x6e70('0x1f')](_0x53acdc));if(this[_0x6e70('0x20')]!==_0x502b2d){this[_0x6e70('0x20')]=_0x502b2d;io['to'](util['format'](_0x6e70('0x21'),_0x53acdc['name']))['emit']('user:save',_0x53acdc);io[_0x6e70('0x22')](_0x6e70('0x23'),_0x53acdc);}};module['exports']=Agent; \ No newline at end of file +var _0xe706=['address','phone','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','updateStatusRealtime','not_inuse','inuse','talking','format','interface','stringify','md5','user:%s','emit','user:presence','lodash','util','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status'];(function(_0x490b87,_0x4597d8){var _0x5a5e19=function(_0x2f9010){while(--_0x2f9010){_0x490b87['push'](_0x490b87['shift']());}};_0x5a5e19(++_0x4597d8);}(_0xe706,0xa3));var _0x6e70=function(_0x13b70c,_0x40be1c){_0x13b70c=_0x13b70c-0x0;var _0x2d0edd=_0xe706[_0x13b70c];return _0x2d0edd;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var md5=require('md5');var Redis=require(_0x6e70('0x3'));var config=require(_0x6e70('0x4'));config[_0x6e70('0x5')]=_[_0x6e70('0x6')](config[_0x6e70('0x5')],{'host':_0x6e70('0x7'),'port':0x18eb});var io=require(_0x6e70('0x8'))(new Redis(config[_0x6e70('0x5')]));function Agent(_0x1b0389){this['id']=_0x1b0389['id']||0x0;this[_0x6e70('0x9')]=_0x1b0389[_0x6e70('0x9')]||'';this[_0x6e70('0xa')]=_0x1b0389[_0x6e70('0xa')]||'';this[_0x6e70('0xb')]=_0x1b0389[_0x6e70('0xb')]||'';this[_0x6e70('0xc')]=_0x1b0389[_0x6e70('0xc')]||'';this[_0x6e70('0xd')]=_0x6e70('0xe');this[_0x6e70('0xf')]=0x0;this[_0x6e70('0x10')]=_0x6e70('0xe');this[_0x6e70('0x11')]='';this[_0x6e70('0x12')]='';this['mobile']='';this['interface']='';this[_0x6e70('0x13')]=_0x1b0389[_0x6e70('0x13')]||![];this[_0x6e70('0x14')]=_0x6e70('0xe');this[_0x6e70('0x15')]=0x0;this[_0x6e70('0x16')]='';this[_0x6e70('0x17')]='';this[_0x6e70('0x18')]=![];this['local']=![];this['md5']='';}Agent['prototype'][_0x6e70('0x19')]=function(_0x5a37a6){var _0x53aed0;if(_0x5a37a6&&_0x5a37a6[_0x6e70('0xd')]){_0x53aed0=_0x5a37a6[_0x6e70('0xd')]['toLowerCase']();switch(_0x53aed0){case _0x6e70('0x1a'):_0x53aed0='idle';break;case _0x6e70('0x1b'):_0x53aed0=_0x6e70('0x1c');break;}}if(_0x53aed0&&this['voiceStatus']!==_0x53aed0||_0x5a37a6['statePause']){this[_0x6e70('0x15')]=_['toNumber'](moment()[_0x6e70('0x1d')]('x'));}if(_0x53aed0){this[_0x6e70('0x14')]=_0x53aed0;}var _0x53acdc={'id':this['id'],'name':this['name'],'email':this[_0x6e70('0xa')],'accountcode':this[_0x6e70('0xb')],'fullname':this[_0x6e70('0xc')],'state':this[_0x6e70('0xd')],'stateTime':this[_0x6e70('0xf')],'status':this[_0x6e70('0x10')],'address':this[_0x6e70('0x11')],'online':this[_0x6e70('0x13')],'voiceStatus':this[_0x6e70('0x14')],'voiceStatusTime':this[_0x6e70('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x6e70('0x17')],'interface':this[_0x6e70('0x1e')],'onhold':this[_0x6e70('0x18')]};var _0x502b2d=md5(JSON[_0x6e70('0x1f')](_0x53acdc));if(this[_0x6e70('0x20')]!==_0x502b2d){this[_0x6e70('0x20')]=_0x502b2d;io['to'](util['format'](_0x6e70('0x21'),_0x53acdc['name']))['emit']('user:save',_0x53acdc);io[_0x6e70('0x22')](_0x6e70('0x23'),_0x53acdc);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index b3f5809..b2a9f76 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 _0xa5a3=['dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','name','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','type','campaign','originated','message','sendMessageOneNotActive','active','limitCalls','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency'];(function(_0x4026df,_0x4d7dc4){var _0x1ad571=function(_0x539274){while(--_0x539274){_0x4026df['push'](_0x4026df['shift']());}};_0x1ad571(++_0x4d7dc4);}(_0xa5a3,0x186));var _0x3a5a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa5a3[_0x2641f9];return _0x585741;};'use strict';function Campaign(_0x315941){this['id']=_0x315941['id']||0x0;this['name']=_0x315941['name']||'';this[_0x3a5a('0x0')]=_0x315941['type']||_0x3a5a('0x1');this[_0x3a5a('0x2')]=0x0;this['temp']=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this[_0x3a5a('0x3')]='';this[_0x3a5a('0x4')]=!![];this[_0x3a5a('0x5')]=_0x315941[_0x3a5a('0x5')];this[_0x3a5a('0x6')]=_0x315941['limitCalls'];this['dialTimezone']=_0x315941['dialTimezone']||null;this[_0x3a5a('0x7')]=_0x315941[_0x3a5a('0x7')]?_0x315941[_0x3a5a('0x7')]:null;this[_0x3a5a('0x8')]=_0x315941[_0x3a5a('0x8')];this[_0x3a5a('0x9')]=_0x315941[_0x3a5a('0x9')];this[_0x3a5a('0xa')]=_0x315941['dialOriginateTimeout']||0x1e;this['dialCongestionMaxRetry']=_0x315941['dialCongestionMaxRetry'];this[_0x3a5a('0xb')]=_0x315941['dialCongestionRetryFrequency'];this[_0x3a5a('0xc')]=_0x315941['dialBusyMaxRetry'];this[_0x3a5a('0xd')]=_0x315941[_0x3a5a('0xd')];this[_0x3a5a('0xe')]=_0x315941[_0x3a5a('0xe')];this[_0x3a5a('0xf')]=_0x315941[_0x3a5a('0xf')];this[_0x3a5a('0x10')]=_0x315941[_0x3a5a('0x10')];this[_0x3a5a('0x11')]=_0x315941[_0x3a5a('0x11')]||0x3;this[_0x3a5a('0x12')]=_0x315941[_0x3a5a('0x12')]||0x96;this[_0x3a5a('0x13')]=_0x315941[_0x3a5a('0x13')]||0x3;this['dialDropRetryFrequency']=_0x315941['dialDropRetryFrequency']||0x96;this[_0x3a5a('0x14')]=_0x315941['dialAbandonedMaxRetry']||0x3;this[_0x3a5a('0x15')]=_0x315941['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x315941[_0x3a5a('0x16')]||0x3;this[_0x3a5a('0x17')]=_0x315941[_0x3a5a('0x17')]||0x96;this[_0x3a5a('0x18')]=_0x315941['dialAgentRejectMaxRetry']||0x3;this[_0x3a5a('0x19')]=_0x315941[_0x3a5a('0x19')]||0x96;this[_0x3a5a('0x1a')]=_0x315941['dialOrderByScheduledAt']||_0x3a5a('0x1b');this[_0x3a5a('0x1c')]=_0x315941[_0x3a5a('0x1c')]||undefined;this[_0x3a5a('0x1d')]=_0x315941[_0x3a5a('0x1d')]||undefined;this[_0x3a5a('0x1e')]=_0x315941['dialCutDigit']||undefined;this['TrunkBackup']=_0x315941[_0x3a5a('0x1f')]?_0x315941['TrunkBackup']:undefined;this[_0x3a5a('0x20')]=_0x315941[_0x3a5a('0x20')]?_0x315941['Trunk']:undefined;this[_0x3a5a('0x21')]=_0x315941[_0x3a5a('0x21')]?_0x315941[_0x3a5a('0x21')]:undefined;this['SquareProject']=_0x315941[_0x3a5a('0x22')]?_0x315941[_0x3a5a('0x22')]:undefined;this['dialQueueProject']=_0x315941['SquareProject']?_0x315941[_0x3a5a('0x22')][_0x3a5a('0x23')]:undefined;this[_0x3a5a('0x24')]=_0x315941[_0x3a5a('0x24')]||![];this[_0x3a5a('0x25')]=_0x315941[_0x3a5a('0x25')];this[_0x3a5a('0x26')]=_0x315941[_0x3a5a('0x26')];this['dialAMDAfterGreetingSilence']=_0x315941[_0x3a5a('0x27')];this['dialAMDTotalAnalysisTime']=_0x315941['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x315941[_0x3a5a('0x28')];this[_0x3a5a('0x29')]=_0x315941[_0x3a5a('0x29')];this[_0x3a5a('0x2a')]=_0x315941[_0x3a5a('0x2a')];this[_0x3a5a('0x2b')]=_0x315941['dialAMDSilenceThreshold'];this[_0x3a5a('0x2c')]=_0x315941['dialAMDMaximumWordLength'];}module[_0x3a5a('0x2d')]=Campaign; \ No newline at end of file +var _0xb733=['dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry'];(function(_0x5d82ac,_0x10b48b){var _0x1595e1=function(_0x2b6130){while(--_0x2b6130){_0x5d82ac['push'](_0x5d82ac['shift']());}};_0x1595e1(++_0x10b48b);}(_0xb733,0x87));var _0x3b73=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb733[_0x501510];return _0x1e6ee5;};'use strict';function Campaign(_0x3fb7e7){this['id']=_0x3fb7e7['id']||0x0;this[_0x3b73('0x0')]=_0x3fb7e7['name']||'';this[_0x3b73('0x1')]=_0x3fb7e7[_0x3b73('0x1')]||_0x3b73('0x2');this[_0x3b73('0x3')]=0x0;this[_0x3b73('0x4')]=0x0;this[_0x3b73('0x5')]=0x0;this[_0x3b73('0x6')]=0x0;this[_0x3b73('0x7')]='';this[_0x3b73('0x8')]=!![];this[_0x3b73('0x9')]=_0x3fb7e7[_0x3b73('0x9')];this[_0x3b73('0xa')]=_0x3fb7e7[_0x3b73('0xa')];this['dialTimezone']=_0x3fb7e7[_0x3b73('0xb')]||null;this[_0x3b73('0xc')]=_0x3fb7e7[_0x3b73('0xc')]?_0x3fb7e7['dialGlobalInterval']:null;this[_0x3b73('0xd')]=_0x3fb7e7[_0x3b73('0xd')];this[_0x3b73('0xe')]=_0x3fb7e7['dialOriginateCallerIdNumber'];this[_0x3b73('0xf')]=_0x3fb7e7['dialOriginateTimeout']||0x1e;this[_0x3b73('0x10')]=_0x3fb7e7[_0x3b73('0x10')];this[_0x3b73('0x11')]=_0x3fb7e7['dialCongestionRetryFrequency'];this['dialBusyMaxRetry']=_0x3fb7e7[_0x3b73('0x12')];this[_0x3b73('0x13')]=_0x3fb7e7[_0x3b73('0x13')];this[_0x3b73('0x14')]=_0x3fb7e7[_0x3b73('0x14')];this[_0x3b73('0x15')]=_0x3fb7e7[_0x3b73('0x15')];this[_0x3b73('0x16')]=_0x3fb7e7[_0x3b73('0x16')];this[_0x3b73('0x17')]=_0x3fb7e7[_0x3b73('0x17')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x3fb7e7['dialNoSuchNumberRetryFrequency']||0x96;this[_0x3b73('0x18')]=_0x3fb7e7[_0x3b73('0x18')]||0x3;this[_0x3b73('0x19')]=_0x3fb7e7['dialDropRetryFrequency']||0x96;this[_0x3b73('0x1a')]=_0x3fb7e7[_0x3b73('0x1a')]||0x3;this[_0x3b73('0x1b')]=_0x3fb7e7[_0x3b73('0x1b')]||0x96;this[_0x3b73('0x1c')]=_0x3fb7e7[_0x3b73('0x1c')]||0x3;this[_0x3b73('0x1d')]=_0x3fb7e7['dialMachineRetryFrequency']||0x96;this[_0x3b73('0x1e')]=_0x3fb7e7[_0x3b73('0x1e')]||0x3;this['dialAgentRejectRetryFrequency']=_0x3fb7e7[_0x3b73('0x1f')]||0x96;this[_0x3b73('0x20')]=_0x3fb7e7[_0x3b73('0x20')]||_0x3b73('0x21');this[_0x3b73('0x22')]=_0x3fb7e7[_0x3b73('0x22')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x3fb7e7[_0x3b73('0x23')]||undefined;this[_0x3b73('0x24')]=_0x3fb7e7[_0x3b73('0x24')]||undefined;this[_0x3b73('0x25')]=_0x3fb7e7[_0x3b73('0x25')]?_0x3fb7e7['TrunkBackup']:undefined;this[_0x3b73('0x26')]=_0x3fb7e7[_0x3b73('0x26')]?_0x3fb7e7['Trunk']:undefined;this[_0x3b73('0x27')]=_0x3fb7e7[_0x3b73('0x27')]?_0x3fb7e7[_0x3b73('0x27')]:undefined;this[_0x3b73('0x28')]=_0x3fb7e7[_0x3b73('0x28')]?_0x3fb7e7[_0x3b73('0x28')]:undefined;this[_0x3b73('0x29')]=_0x3fb7e7[_0x3b73('0x28')]?_0x3fb7e7[_0x3b73('0x28')][_0x3b73('0x0')]:undefined;this['dialAMDActive']=_0x3fb7e7[_0x3b73('0x2a')]||![];this['dialAMDInitialSilence']=_0x3fb7e7[_0x3b73('0x2b')];this[_0x3b73('0x2c')]=_0x3fb7e7[_0x3b73('0x2c')];this[_0x3b73('0x2d')]=_0x3fb7e7[_0x3b73('0x2d')];this[_0x3b73('0x2e')]=_0x3fb7e7['dialAMDTotalAnalysisTime'];this[_0x3b73('0x2f')]=_0x3fb7e7[_0x3b73('0x2f')];this['dialAMDBetweenWordsSilence']=_0x3fb7e7[_0x3b73('0x30')];this[_0x3b73('0x31')]=_0x3fb7e7[_0x3b73('0x31')];this['dialAMDSilenceThreshold']=_0x3fb7e7[_0x3b73('0x32')];this[_0x3b73('0x33')]=_0x3fb7e7[_0x3b73('0x33')];}module[_0x3b73('0x34')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index f4a03a7..47dbac3 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 _0x8a5c=['mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','linkedid','exten','answertime','endtime','unmanaged','abandoned','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','transfercalleridnum','transferType'];(function(_0x48783c,_0x1f986b){var _0x2ce586=function(_0x38e1bd){while(--_0x38e1bd){_0x48783c['push'](_0x48783c['shift']());}};_0x2ce586(++_0x1f986b);}(_0x8a5c,0x136));var _0xc8a5=function(_0x90df50,_0x5110bb){_0x90df50=_0x90df50-0x0;var _0x10aa2b=_0x8a5c[_0x90df50];return _0x10aa2b;};'use strict';function Channel(){this[_0xc8a5('0x0')]=null;this[_0xc8a5('0x1')]='';this[_0xc8a5('0x2')]='';this[_0xc8a5('0x3')]=0x0;this[_0xc8a5('0x4')]='';this[_0xc8a5('0x5')]=undefined;this[_0xc8a5('0x6')]=undefined;this[_0xc8a5('0x7')]=0x0;this[_0xc8a5('0x8')]='';this['uniqueid']=0x0;this[_0xc8a5('0x9')]=0x0;this[_0xc8a5('0xa')]=0x0;this['answered']=![];this[_0xc8a5('0xb')]=null;this[_0xc8a5('0xc')]=null;this[_0xc8a5('0xd')]=![];this[_0xc8a5('0xe')]=![];this['lastapplication']='';this[_0xc8a5('0xf')]='';this[_0xc8a5('0x10')]=0x0;this[_0xc8a5('0x11')]=0x0;this[_0xc8a5('0x12')]=0x0;this[_0xc8a5('0x13')]=null;this[_0xc8a5('0x14')]=null;this[_0xc8a5('0x15')]=null;this[_0xc8a5('0x16')]=![];this[_0xc8a5('0x17')]=null;this['queue']=null;this['monitors']=[];this[_0xc8a5('0x18')]=undefined;this['transferconnectedlinenum']=undefined;this[_0xc8a5('0x19')]=undefined;this[_0xc8a5('0x1a')]=0x0;}module[_0xc8a5('0x1b')]=Channel; \ No newline at end of file +var _0x6f18=['transfercalleridnum','transferType','mohtime','exports','starttime','destinationchannel','calleridname','connectedlinenum','accountcode','context','linkedid','exten','answered','answertime','endtime','abandoned','lastapplication','lastdata','duration','billableseconds','type','tag','disposition','monitor','monitorFilename','queue','monitors'];(function(_0x655d4f,_0x55770d){var _0x3a4600=function(_0x275911){while(--_0x275911){_0x655d4f['push'](_0x655d4f['shift']());}};_0x3a4600(++_0x55770d);}(_0x6f18,0x1b4));var _0x86f1=function(_0x16f65f,_0x34ef03){_0x16f65f=_0x16f65f-0x0;var _0x1c6552=_0x6f18[_0x16f65f];return _0x1c6552;};'use strict';function Channel(){this[_0x86f1('0x0')]=null;this['channel']='';this[_0x86f1('0x1')]='';this['calleridnum']=0x0;this[_0x86f1('0x2')]='';this[_0x86f1('0x3')]=undefined;this['connectedlinename']=undefined;this[_0x86f1('0x4')]=0x0;this[_0x86f1('0x5')]='';this['uniqueid']=0x0;this[_0x86f1('0x6')]=0x0;this[_0x86f1('0x7')]=0x0;this[_0x86f1('0x8')]=![];this[_0x86f1('0x9')]=null;this[_0x86f1('0xa')]=null;this['unmanaged']=![];this[_0x86f1('0xb')]=![];this[_0x86f1('0xc')]='';this[_0x86f1('0xd')]='';this[_0x86f1('0xe')]=0x0;this[_0x86f1('0xf')]=0x0;this['holdtime']=0x0;this[_0x86f1('0x10')]=null;this[_0x86f1('0x11')]=null;this[_0x86f1('0x12')]=null;this[_0x86f1('0x13')]=![];this[_0x86f1('0x14')]=null;this[_0x86f1('0x15')]=null;this[_0x86f1('0x16')]=[];this[_0x86f1('0x17')]=undefined;this['transferconnectedlinenum']=undefined;this[_0x86f1('0x18')]=undefined;this[_0x86f1('0x19')]=0x0;}module[_0x86f1('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 fc708d6..18ac09d 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 _0x45e1=['Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl'];(function(_0x392ec2,_0x4e9f85){var _0x16e517=function(_0x379e8b){while(--_0x379e8b){_0x392ec2['push'](_0x392ec2['shift']());}};_0x16e517(++_0x4e9f85);}(_0x45e1,0x188));var _0x145e=function(_0x21f074,_0x3c7959){_0x21f074=_0x21f074-0x0;var _0x1521b1=_0x45e1[_0x21f074];return _0x1521b1;};'use strict';function DeskAccount(_0x2eb562){this['id']=_0x2eb562['id']||0x0;this[_0x145e('0x0')]=_0x2eb562[_0x145e('0x0')]||'';this['username']=_0x2eb562[_0x145e('0x1')]||'';this[_0x145e('0x2')]=_0x2eb562[_0x145e('0x2')]||'';this[_0x145e('0x3')]=_0x2eb562[_0x145e('0x3')]||'';this[_0x145e('0x4')]=_0x2eb562[_0x145e('0x4')]||'';this['consumerKey']=_0x2eb562[_0x145e('0x5')]||'';this[_0x145e('0x6')]=_0x2eb562[_0x145e('0x6')]||'';this[_0x145e('0x7')]=_0x2eb562[_0x145e('0x7')]||'';this[_0x145e('0x8')]=_0x2eb562[_0x145e('0x8')]||'';this['type']=_0x2eb562[_0x145e('0x9')]||'';this[_0x145e('0xa')]=_0x2eb562['serverUrl']||'';this[_0x145e('0xb')]=_0x2eb562[_0x145e('0xb')]||{};}module[_0x145e('0xc')]=DeskAccount; \ No newline at end of file +var _0xbcea=['password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType'];(function(_0x1317ac,_0x102104){var _0x322d18=function(_0x22cd9f){while(--_0x22cd9f){_0x1317ac['push'](_0x1317ac['shift']());}};_0x322d18(++_0x102104);}(_0xbcea,0x1dd));var _0xabce=function(_0x40822a,_0x582b60){_0x40822a=_0x40822a-0x0;var _0x357420=_0xbcea[_0x40822a];return _0x357420;};'use strict';function DeskAccount(_0x50a70f){this['id']=_0x50a70f['id']||0x0;this[_0xabce('0x0')]=_0x50a70f['name']||'';this[_0xabce('0x1')]=_0x50a70f['username']||'';this[_0xabce('0x2')]=_0x50a70f[_0xabce('0x2')]||'';this[_0xabce('0x3')]=_0x50a70f[_0xabce('0x3')]||'';this[_0xabce('0x4')]=_0x50a70f[_0xabce('0x4')]||'';this[_0xabce('0x5')]=_0x50a70f[_0xabce('0x5')]||'';this['consumerSecret']=_0x50a70f[_0xabce('0x6')]||'';this[_0xabce('0x7')]=_0x50a70f[_0xabce('0x7')]||'';this[_0xabce('0x8')]=_0x50a70f[_0xabce('0x8')]||'';this[_0xabce('0x9')]=_0x50a70f[_0xabce('0x9')]||'';this['serverUrl']=_0x50a70f[_0xabce('0xa')]||'';this[_0xabce('0xb')]=_0x50a70f[_0xabce('0xb')]||{};}module[_0xabce('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 5d863dd..3eb0d4d 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 _0x9348=['username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','name'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0x9348,0x10d));var _0x8934=function(_0x47f0bb,_0x1d431c){_0x47f0bb=_0x47f0bb-0x0;var _0x32019f=_0x9348[_0x47f0bb];return _0x32019f;};'use strict';function Dynamics365Account(_0x41a189){this['id']=_0x41a189['id']||0x0;this[_0x8934('0x0')]=_0x41a189[_0x8934('0x0')]||'';this[_0x8934('0x1')]=_0x41a189[_0x8934('0x1')]||'';this['password']=_0x41a189[_0x8934('0x2')]||'';this[_0x8934('0x3')]=_0x41a189['remoteUri']||'';this[_0x8934('0x4')]=_0x41a189[_0x8934('0x4')]||'';this[_0x8934('0x5')]=_0x41a189[_0x8934('0x5')]||'';this[_0x8934('0x6')]=_0x41a189[_0x8934('0x6')]||{};this['serverUrl']=_0x41a189[_0x8934('0x7')]||'';this[_0x8934('0x8')]=_0x41a189[_0x8934('0x8')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0xb688=['remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','exports','name','username','password'];(function(_0x496662,_0x21917a){var _0x4a53ac=function(_0x1b4fb9){while(--_0x1b4fb9){_0x496662['push'](_0x496662['shift']());}};_0x4a53ac(++_0x21917a);}(_0xb688,0xcf));var _0x8b68=function(_0xf7ac63,_0xf52456){_0xf7ac63=_0xf7ac63-0x0;var _0x25b50d=_0xb688[_0xf7ac63];return _0x25b50d;};'use strict';function Dynamics365Account(_0x185590){this['id']=_0x185590['id']||0x0;this[_0x8b68('0x0')]=_0x185590[_0x8b68('0x0')]||'';this[_0x8b68('0x1')]=_0x185590[_0x8b68('0x1')]||'';this[_0x8b68('0x2')]=_0x185590[_0x8b68('0x2')]||'';this['remoteUri']=_0x185590[_0x8b68('0x3')]||'';this[_0x8b68('0x4')]=_0x185590[_0x8b68('0x4')]||'';this[_0x8b68('0x5')]=_0x185590['clientId']||'';this[_0x8b68('0x6')]=_0x185590['clientSecret']||{};this[_0x8b68('0x7')]=_0x185590[_0x8b68('0x7')]||'';this[_0x8b68('0x8')]=_0x185590[_0x8b68('0x8')]||{};}module[_0x8b68('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 6920036..0805ef2 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 _0xbb22=['ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb22,0x166));var _0x2bb2=function(_0x47d986,_0x461405){_0x47d986=_0x47d986-0x0;var _0x54fe45=_0xbb22[_0x47d986];return _0x54fe45;};'use strict';function FaxAccount(_0x33600c){this['id']=_0x33600c['id']||0x0;this[_0x2bb2('0x0')]=_0x33600c[_0x2bb2('0x0')]||'';this[_0x2bb2('0x1')]=_0x33600c[_0x2bb2('0x1')];this[_0x2bb2('0x2')]=_0x33600c[_0x2bb2('0x2')];this[_0x2bb2('0x3')]=_0x33600c[_0x2bb2('0x3')];this[_0x2bb2('0x4')]=_0x33600c[_0x2bb2('0x4')];this[_0x2bb2('0x5')]=_0x33600c[_0x2bb2('0x5')]||0x960;this[_0x2bb2('0x6')]=_0x33600c[_0x2bb2('0x6')]||0x3840;this[_0x2bb2('0x7')]=_0x33600c[_0x2bb2('0x7')]||_0x2bb2('0x8');this[_0x2bb2('0x9')]=_0x33600c[_0x2bb2('0x9')]||'no';this['faxdetect']=_0x33600c[_0x2bb2('0xa')]||'no';this[_0x2bb2('0xb')]=_0x33600c['t38timeout']||0x1388;this[_0x2bb2('0xc')]=_0x33600c['tech']||_0x2bb2('0xd');this['Trunk']=_0x33600c[_0x2bb2('0xe')]?_0x33600c[_0x2bb2('0xe')]:undefined;this[_0x2bb2('0xf')]=_0x33600c[_0x2bb2('0xf')];this[_0x2bb2('0x10')]=_0x33600c[_0x2bb2('0x10')];}module[_0x2bb2('0x11')]=FaxAccount; \ No newline at end of file +var _0x5062=['localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name','description','ecm','headerinfo'];(function(_0x260c59,_0x10a666){var _0x11ad22=function(_0x23f6a2){while(--_0x23f6a2){_0x260c59['push'](_0x260c59['shift']());}};_0x11ad22(++_0x10a666);}(_0x5062,0x84));var _0x2506=function(_0x16020d,_0x44d30e){_0x16020d=_0x16020d-0x0;var _0xf7b6ea=_0x5062[_0x16020d];return _0xf7b6ea;};'use strict';function FaxAccount(_0x32f3a2){this['id']=_0x32f3a2['id']||0x0;this[_0x2506('0x0')]=_0x32f3a2[_0x2506('0x0')]||'';this[_0x2506('0x1')]=_0x32f3a2['description'];this[_0x2506('0x2')]=_0x32f3a2['ecm'];this[_0x2506('0x3')]=_0x32f3a2['headerinfo'];this[_0x2506('0x4')]=_0x32f3a2[_0x2506('0x4')];this[_0x2506('0x5')]=_0x32f3a2['minrate']||0x960;this[_0x2506('0x6')]=_0x32f3a2[_0x2506('0x6')]||0x3840;this[_0x2506('0x7')]=_0x32f3a2[_0x2506('0x7')]||_0x2506('0x8');this[_0x2506('0x9')]=_0x32f3a2['gateway']||'no';this['faxdetect']=_0x32f3a2[_0x2506('0xa')]||'no';this[_0x2506('0xb')]=_0x32f3a2[_0x2506('0xb')]||0x1388;this[_0x2506('0xc')]=_0x32f3a2['tech']||'SIP';this[_0x2506('0xd')]=_0x32f3a2['Trunk']?_0x32f3a2[_0x2506('0xd')]:undefined;this['ListId']=_0x32f3a2[_0x2506('0xe')];this[_0x2506('0xf')]=_0x32f3a2[_0x2506('0xf')];}module[_0x2506('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 4472648..092706d 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 _0x519c=['Configurations','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x519c,0xf6));var _0xc519=function(_0x13910a,_0xbfcaab){_0x13910a=_0x13910a-0x0;var _0x2815bb=_0x519c[_0x13910a];return _0x2815bb;};'use strict';function FreshdeskAccount(_0x2a47d0){this['id']=_0x2a47d0['id']||0x0;this['name']=_0x2a47d0[_0xc519('0x0')]||'';this[_0xc519('0x1')]=_0x2a47d0['username']||'';this[_0xc519('0x2')]=_0x2a47d0[_0xc519('0x3')]||'';this[_0xc519('0x4')]=_0x2a47d0[_0xc519('0x4')]||'';this[_0xc519('0x5')]=_0x2a47d0[_0xc519('0x5')]||'';this[_0xc519('0x6')]=_0x2a47d0[_0xc519('0x6')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x9520=['apiKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0x9520,0x9f));var _0x0952=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x9520[_0x432682];return _0x463d05;};'use strict';function FreshdeskAccount(_0x177a70){this['id']=_0x177a70['id']||0x0;this[_0x0952('0x0')]=_0x177a70[_0x0952('0x0')]||'';this[_0x0952('0x1')]=_0x177a70[_0x0952('0x1')]||'';this[_0x0952('0x2')]=_0x177a70['token']||'';this['remoteUri']=_0x177a70[_0x0952('0x3')]||'';this[_0x0952('0x4')]=_0x177a70[_0x0952('0x4')]||'';this[_0x0952('0x5')]=_0x177a70[_0x0952('0x5')]||{};}module[_0x0952('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index e8eb5b1..e135897 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 _0x24ce=['remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x5dac05,_0x3e58d1){var _0x341fc1=function(_0x2d168e){while(--_0x2d168e){_0x5dac05['push'](_0x5dac05['shift']());}};_0x341fc1(++_0x3e58d1);}(_0x24ce,0x1de));var _0xe24c=function(_0x23dbc8,_0x3949a3){_0x23dbc8=_0x23dbc8-0x0;var _0x3dd3f8=_0x24ce[_0x23dbc8];return _0x3dd3f8;};'use strict';function FreshsalesAccount(_0x1ba72f){this['id']=_0x1ba72f['id']||0x0;this[_0xe24c('0x0')]=_0x1ba72f[_0xe24c('0x0')]||'';this[_0xe24c('0x1')]=_0x1ba72f[_0xe24c('0x1')]||'';this['apiKey']=_0x1ba72f['token']||'';this[_0xe24c('0x2')]=_0x1ba72f['remoteUri']||'';this['serverUrl']=_0x1ba72f[_0xe24c('0x3')]||'';this[_0xe24c('0x4')]=_0x1ba72f[_0xe24c('0x4')]||{};}module[_0xe24c('0x5')]=FreshsalesAccount; \ No newline at end of file +var _0xc569=['Configurations','exports','name','username','apiKey','remoteUri','serverUrl'];(function(_0x3b594b,_0x5835c3){var _0x1ea5f8=function(_0x191b3e){while(--_0x191b3e){_0x3b594b['push'](_0x3b594b['shift']());}};_0x1ea5f8(++_0x5835c3);}(_0xc569,0x159));var _0x9c56=function(_0x1b11db,_0x57ae25){_0x1b11db=_0x1b11db-0x0;var _0x1c39b0=_0xc569[_0x1b11db];return _0x1c39b0;};'use strict';function FreshsalesAccount(_0x5412d0){this['id']=_0x5412d0['id']||0x0;this[_0x9c56('0x0')]=_0x5412d0[_0x9c56('0x0')]||'';this['username']=_0x5412d0[_0x9c56('0x1')]||'';this[_0x9c56('0x2')]=_0x5412d0['token']||'';this[_0x9c56('0x3')]=_0x5412d0[_0x9c56('0x3')]||'';this[_0x9c56('0x4')]=_0x5412d0['serverUrl']||'';this[_0x9c56('0x5')]=_0x5412d0[_0x9c56('0x5')]||{};}module[_0x9c56('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 7f0908f..e01bdf8 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 _0x963a=['connectedlinename','context','exten','holdtime','lastAssignedTo','motionChannel','voice','variables','type','inbound','uniqueid','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum'];(function(_0x90740d,_0xf25227){var _0x5cb962=function(_0x41b805){while(--_0x41b805){_0x90740d['push'](_0x90740d['shift']());}};_0x5cb962(++_0xf25227);}(_0x963a,0x1b1));var _0xa963=function(_0x1f2062,_0x52e086){_0x1f2062=_0x1f2062-0x0;var _0x97405f=_0x963a[_0x1f2062];return _0x97405f;};'use strict';function QueueReport(){this[_0xa963('0x0')]=_0xa963('0x1');this[_0xa963('0x2')]='';this['calleridnum']='';this[_0xa963('0x3')]='';this[_0xa963('0x4')]='';this[_0xa963('0x5')]=null;this[_0xa963('0x6')]=null;this[_0xa963('0x7')]=0x1;this[_0xa963('0x8')]=0x1;this['queuecallerabandon']=![];this[_0xa963('0x9')]=null;this[_0xa963('0xa')]=![];this[_0xa963('0xb')]=null;this[_0xa963('0xc')]=![];this[_0xa963('0xd')]=null;this[_0xa963('0xe')]=0x1;this[_0xa963('0xf')]='';this[_0xa963('0x10')]='';this[_0xa963('0x11')]='';this['accountcode']='';this[_0xa963('0x12')]='';this[_0xa963('0x13')]='';this['priority']='';this[_0xa963('0x14')]=0x0;this['assigned']=![];this[_0xa963('0x15')]='';this[_0xa963('0x16')]=_0xa963('0x17');this['mohtime']=0x0;this[_0xa963('0x18')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0xdf5d=['position','queuecallercompleteAt','queuecallerexitAt','originalposition','channel','connectedlinename','accountcode','context','exten','holdtime','assigned','lastAssignedTo','motionChannel','voice','variables','inbound','uniqueid','calleridnum','calleridname','queuecallerjoinAt','queuecallerleaveAt'];(function(_0x526a46,_0x119cc9){var _0x299cab=function(_0x49722b){while(--_0x49722b){_0x526a46['push'](_0x526a46['shift']());}};_0x299cab(++_0x119cc9);}(_0xdf5d,0x19e));var _0xddf5=function(_0x47938a,_0x157400){_0x47938a=_0x47938a-0x0;var _0x4db31e=_0xdf5d[_0x47938a];return _0x4db31e;};'use strict';function QueueReport(){this['type']=_0xddf5('0x0');this[_0xddf5('0x1')]='';this[_0xddf5('0x2')]='';this[_0xddf5('0x3')]='';this['queue']='';this[_0xddf5('0x4')]=null;this[_0xddf5('0x5')]=null;this[_0xddf5('0x6')]=0x1;this['count']=0x1;this['queuecallerabandon']=![];this['queuecallerabandonAt']=null;this['queuecallercomplete']=![];this[_0xddf5('0x7')]=null;this['queuecallerexit']=![];this[_0xddf5('0x8')]=null;this[_0xddf5('0x9')]=0x1;this[_0xddf5('0xa')]='';this['connectedlinenum']='';this[_0xddf5('0xb')]='';this[_0xddf5('0xc')]='';this[_0xddf5('0xd')]='';this[_0xddf5('0xe')]='';this['priority']='';this[_0xddf5('0xf')]=0x0;this[_0xddf5('0x10')]=![];this[_0xddf5('0x11')]='';this[_0xddf5('0x12')]=_0xddf5('0x13');this['mohtime']=0x0;this[_0xddf5('0x14')]={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index f988a3b..6b24210 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 _0x6cd4=['serverUrl','Configurations','name','username','remoteUri','password','clientId','securityToken','type','integrationTab'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6cd4,0x1d8));var _0x46cd=function(_0x292b1e,_0x10e9d5){_0x292b1e=_0x292b1e-0x0;var _0x116b08=_0x6cd4[_0x292b1e];return _0x116b08;};'use strict';function SalesforceAccount(_0x55835f){this['id']=_0x55835f['id']||0x0;this[_0x46cd('0x0')]=_0x55835f[_0x46cd('0x0')]||'';this[_0x46cd('0x1')]=_0x55835f[_0x46cd('0x1')]||'';this[_0x46cd('0x2')]=_0x55835f[_0x46cd('0x2')]||'';this[_0x46cd('0x3')]=_0x55835f[_0x46cd('0x3')]||'';this[_0x46cd('0x4')]=_0x55835f['clientId']||'';this['clientSecret']=_0x55835f['clientSecret']||'';this[_0x46cd('0x5')]=_0x55835f[_0x46cd('0x5')]||'';this[_0x46cd('0x6')]=_0x55835f[_0x46cd('0x6')]||_0x46cd('0x7');this[_0x46cd('0x8')]=_0x55835f['serverUrl']||'';this[_0x46cd('0x9')]=_0x55835f['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x0626=['name','username','remoteUri','clientId','clientSecret','securityToken','type','serverUrl','Configurations'];(function(_0x3de049,_0x113827){var _0x26a7ff=function(_0x37b4bf){while(--_0x37b4bf){_0x3de049['push'](_0x3de049['shift']());}};_0x26a7ff(++_0x113827);}(_0x0626,0x1ef));var _0x6062=function(_0x13aa1b,_0x3ca595){_0x13aa1b=_0x13aa1b-0x0;var _0x1d0b1a=_0x0626[_0x13aa1b];return _0x1d0b1a;};'use strict';function SalesforceAccount(_0x58f44d){this['id']=_0x58f44d['id']||0x0;this[_0x6062('0x0')]=_0x58f44d[_0x6062('0x0')]||'';this[_0x6062('0x1')]=_0x58f44d[_0x6062('0x1')]||'';this[_0x6062('0x2')]=_0x58f44d[_0x6062('0x2')]||'';this['password']=_0x58f44d['password']||'';this[_0x6062('0x3')]=_0x58f44d['clientId']||'';this[_0x6062('0x4')]=_0x58f44d[_0x6062('0x4')]||'';this[_0x6062('0x5')]=_0x58f44d[_0x6062('0x5')]||'';this['type']=_0x58f44d[_0x6062('0x6')]||'integrationTab';this[_0x6062('0x7')]=_0x58f44d[_0x6062('0x7')]||'';this[_0x6062('0x8')]=_0x58f44d[_0x6062('0x8')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 60fca6b..7bdf250 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 _0xf468=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x23bea4,_0x38a38){var _0xb54789=function(_0x2a5608){while(--_0x2a5608){_0x23bea4['push'](_0x23bea4['shift']());}};_0xb54789(++_0x38a38);}(_0xf468,0x191));var _0x8f46=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xf468[_0x47e7cb];return _0x2a8874;};'use strict';function ServicenowAccount(_0x38496d){this['id']=_0x38496d['id']||0x0;this[_0x8f46('0x0')]=_0x38496d[_0x8f46('0x0')]||'';this[_0x8f46('0x1')]=_0x38496d[_0x8f46('0x1')]||'';this[_0x8f46('0x2')]=_0x38496d[_0x8f46('0x2')]||'';this[_0x8f46('0x3')]=_0x38496d[_0x8f46('0x3')]||'';this[_0x8f46('0x4')]=_0x38496d['serverUrl']||'';this[_0x8f46('0x5')]=_0x38496d[_0x8f46('0x5')]||{};}module[_0x8f46('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xcd3c=['serverUrl','Configurations','name','username','password','remoteUri'];(function(_0x17c483,_0xc69535){var _0x112bdb=function(_0x19adb9){while(--_0x19adb9){_0x17c483['push'](_0x17c483['shift']());}};_0x112bdb(++_0xc69535);}(_0xcd3c,0x92));var _0xccd3=function(_0x4bd71c,_0x2f5991){_0x4bd71c=_0x4bd71c-0x0;var _0x39775a=_0xcd3c[_0x4bd71c];return _0x39775a;};'use strict';function ServicenowAccount(_0x14b63b){this['id']=_0x14b63b['id']||0x0;this[_0xccd3('0x0')]=_0x14b63b[_0xccd3('0x0')]||'';this[_0xccd3('0x1')]=_0x14b63b['username']||'';this[_0xccd3('0x2')]=_0x14b63b[_0xccd3('0x2')]||'';this[_0xccd3('0x3')]=_0x14b63b[_0xccd3('0x3')]||'';this['serverUrl']=_0x14b63b[_0xccd3('0x4')]||'';this['Configurations']=_0x14b63b[_0xccd3('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 3937305..cc5a7fa 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 _0xde72=['name','username','password','remoteUri'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xde72,0x1a4));var _0x2de7=function(_0x33e290,_0x21085c){_0x33e290=_0x33e290-0x0;var _0x371e69=_0xde72[_0x33e290];return _0x371e69;};'use strict';function SugarcrmAccount(_0x24de05){this['id']=_0x24de05['id']||0x0;this[_0x2de7('0x0')]=_0x24de05[_0x2de7('0x0')]||'';this[_0x2de7('0x1')]=_0x24de05[_0x2de7('0x1')]||'';this[_0x2de7('0x2')]=_0x24de05[_0x2de7('0x2')]||'';this[_0x2de7('0x3')]=_0x24de05[_0x2de7('0x3')]||'';this['serverUrl']=_0x24de05['serverUrl']||'';this['Configurations']=_0x24de05['Configurations']||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x8046=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x30e839,_0x5990a9){var _0x29734c=function(_0x45aaa9){while(--_0x45aaa9){_0x30e839['push'](_0x30e839['shift']());}};_0x29734c(++_0x5990a9);}(_0x8046,0xab));var _0x6804=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0x8046[_0x25d386];return _0x857f4a;};'use strict';function SugarcrmAccount(_0x3fa961){this['id']=_0x3fa961['id']||0x0;this['name']=_0x3fa961[_0x6804('0x0')]||'';this[_0x6804('0x1')]=_0x3fa961[_0x6804('0x1')]||'';this[_0x6804('0x2')]=_0x3fa961['password']||'';this['remoteUri']=_0x3fa961[_0x6804('0x3')]||'';this[_0x6804('0x4')]=_0x3fa961[_0x6804('0x4')]||'';this['Configurations']=_0x3fa961[_0x6804('0x5')]||{};}module[_0x6804('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 79a7d95..da2d4da 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 _0x09dd=['address','name','accountcode','state','unknown','stateTime','status'];(function(_0x426ab4,_0x3aa799){var _0x290c07=function(_0x41ffe4){while(--_0x41ffe4){_0x426ab4['push'](_0x426ab4['shift']());}};_0x290c07(++_0x3aa799);}(_0x09dd,0xb7));var _0xd09d=function(_0x44cad0,_0x229ce2){_0x44cad0=_0x44cad0-0x0;var _0x360e6f=_0x09dd[_0x44cad0];return _0x360e6f;};'use strict';function Telephone(_0x5de53a){this['id']=_0x5de53a['id']||0x0;this[_0xd09d('0x0')]=_0x5de53a[_0xd09d('0x0')]||'';this[_0xd09d('0x1')]=_0x5de53a[_0xd09d('0x1')]||'';this[_0xd09d('0x2')]=_0xd09d('0x3');this[_0xd09d('0x4')]=0x0;this[_0xd09d('0x5')]='unknown';this[_0xd09d('0x6')]='';}module['exports']=Telephone; \ No newline at end of file +var _0x74ed=['name','accountcode','state','stateTime','address'];(function(_0x5d547f,_0x50a029){var _0x66efe3=function(_0x53d84f){while(--_0x53d84f){_0x5d547f['push'](_0x5d547f['shift']());}};_0x66efe3(++_0x50a029);}(_0x74ed,0x109));var _0xd74e=function(_0x4d95d9,_0x278833){_0x4d95d9=_0x4d95d9-0x0;var _0x4685e6=_0x74ed[_0x4d95d9];return _0x4685e6;};'use strict';function Telephone(_0xe55b66){this['id']=_0xe55b66['id']||0x0;this[_0xd74e('0x0')]=_0xe55b66[_0xd74e('0x0')]||'';this['accountcode']=_0xe55b66[_0xd74e('0x1')]||'';this[_0xd74e('0x2')]='unknown';this[_0xd74e('0x3')]=0x0;this['status']='unknown';this[_0xd74e('0x4')]='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 3110d52..65986d3 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x5b91a8,_0x4b1e91){var _0x341a51=function(_0x5b2d02){while(--_0x5b2d02){_0x5b91a8['push'](_0x5b91a8['shift']());}};_0x341a51(++_0x4b1e91);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x48c091,_0x2b8b64){var _0x141e8e=function(_0x19aab2){while(--_0x19aab2){_0x48c091['push'](_0x48c091['shift']());}};_0x141e8e(++_0x2b8b64);}(_0xb10b,0x12a));var _0xbb10=function(_0x72ee00,_0x4f9a0c){_0x72ee00=_0x72ee00-0x0;var _0x4da881=_0xb10b[_0x72ee00];return _0x4da881;};'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 2698265..9ade11a 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 _0x14a0=['voice','status','AnyConditions','Actions','name','channel'];(function(_0x4d9e58,_0x41a4a8){var _0x5782f4=function(_0x4ef867){while(--_0x4ef867){_0x4d9e58['push'](_0x4d9e58['shift']());}};_0x5782f4(++_0x41a4a8);}(_0x14a0,0x8e));var _0x014a=function(_0x3c67d4,_0x25e777){_0x3c67d4=_0x3c67d4-0x0;var _0xf8966c=_0x14a0[_0x3c67d4];return _0xf8966c;};'use strict';function Trigger(_0x1ee939){this['id']=_0x1ee939['id']||0x0;this[_0x014a('0x0')]=_0x1ee939[_0x014a('0x0')]||'';this[_0x014a('0x1')]=_0x1ee939[_0x014a('0x1')]||_0x014a('0x2');this[_0x014a('0x3')]=_0x1ee939[_0x014a('0x3')]||![];this['AllConditions']=_0x1ee939['AllConditions']||[];this[_0x014a('0x4')]=_0x1ee939[_0x014a('0x4')]||[];this[_0x014a('0x5')]=_0x1ee939['Actions']||[];}module['exports']=Trigger; \ No newline at end of file +var _0x8603=['exports','name','channel','status','AllConditions','AnyConditions','Actions'];(function(_0x3695c6,_0x3dcc52){var _0x454ee6=function(_0x53096e){while(--_0x53096e){_0x3695c6['push'](_0x3695c6['shift']());}};_0x454ee6(++_0x3dcc52);}(_0x8603,0x190));var _0x3860=function(_0x36479c,_0x2af234){_0x36479c=_0x36479c-0x0;var _0x5dafd7=_0x8603[_0x36479c];return _0x5dafd7;};'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 deb1603..eeb48e6 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 _0x793b=['stateRegistry','address','defaultuser','exports','active','name','unknown','stateTime','status','registry','indexOf','split','host','port','domain','domainport'];(function(_0x45ee80,_0x556689){var _0x350e98=function(_0x96e156){while(--_0x96e156){_0x45ee80['push'](_0x45ee80['shift']());}};_0x350e98(++_0x556689);}(_0x793b,0x1b4));var _0xb793=function(_0x53122a,_0x4ace15){_0x53122a=_0x53122a-0x0;var _0x73686=_0x793b[_0x53122a];return _0x73686;};'use strict';function Trunk(_0x3348b9){this['id']=_0x3348b9['id']||0x0;this[_0xb793('0x0')]=_0x3348b9[_0xb793('0x0')]||![];this[_0xb793('0x1')]=_0x3348b9[_0xb793('0x1')]||'';this['state']=_0xb793('0x2');this[_0xb793('0x3')]=0x0;this[_0xb793('0x4')]=_0xb793('0x2');this[_0xb793('0x5')]=_0x3348b9['registry']&&_0x3348b9[_0xb793('0x5')][_0xb793('0x6')](':')?_0x3348b9['registry'][_0xb793('0x7')](':')[0x0]:'';this[_0xb793('0x8')]='';this[_0xb793('0x9')]='';this[_0xb793('0xa')]='';this[_0xb793('0xb')]='';this['refresh']='';this[_0xb793('0xc')]=_0xb793('0x2');this['registrationtime']='';this[_0xb793('0xd')]='';this[_0xb793('0xe')]=_0x3348b9['defaultuser']||'';}module[_0xb793('0xf')]=Trunk; \ No newline at end of file +var _0xc2dd=['refresh','registrationtime','defaultuser','active','name','state','unknown','status','registry','indexOf','host','port','domainport'];(function(_0x3ff235,_0x428b4d){var _0x409302=function(_0x4ef822){while(--_0x4ef822){_0x3ff235['push'](_0x3ff235['shift']());}};_0x409302(++_0x428b4d);}(_0xc2dd,0x107));var _0xdc2d=function(_0x1af834,_0xca56bc){_0x1af834=_0x1af834-0x0;var _0x42116a=_0xc2dd[_0x1af834];return _0x42116a;};'use strict';function Trunk(_0x2c31aa){this['id']=_0x2c31aa['id']||0x0;this[_0xdc2d('0x0')]=_0x2c31aa[_0xdc2d('0x0')]||![];this[_0xdc2d('0x1')]=_0x2c31aa['name']||'';this[_0xdc2d('0x2')]=_0xdc2d('0x3');this['stateTime']=0x0;this[_0xdc2d('0x4')]=_0xdc2d('0x3');this[_0xdc2d('0x5')]=_0x2c31aa[_0xdc2d('0x5')]&&_0x2c31aa[_0xdc2d('0x5')][_0xdc2d('0x6')](':')?_0x2c31aa[_0xdc2d('0x5')]['split'](':')[0x0]:'';this[_0xdc2d('0x7')]='';this[_0xdc2d('0x8')]='';this['domain']='';this[_0xdc2d('0x9')]='';this[_0xdc2d('0xa')]='';this['stateRegistry']='unknown';this[_0xdc2d('0xb')]='';this['address']='';this['defaultuser']=_0x2c31aa[_0xdc2d('0xc')]||'';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 15fb6ae..c134651 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 _0x66e7=['exports','exten','mandatoryDisposition'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x66e7,0xaf));var _0x766e=function(_0xe45118,_0x5dffbc){_0xe45118=_0xe45118-0x0;var _0x15e15d=_0x66e7[_0xe45118];return _0x15e15d;};'use strict';function voiceExtension(_0xf93b7f){this['id']=_0xf93b7f['id']||0x0;this[_0x766e('0x0')]=_0xf93b7f[_0x766e('0x0')]||'';this['recordingFormat']=_0xf93b7f['recordingFormat']||'none';this[_0x766e('0x1')]=_0xf93b7f[_0x766e('0x1')]||![];}module[_0x766e('0x2')]=voiceExtension; \ No newline at end of file +var _0x091a=['exten','recordingFormat','mandatoryDisposition','exports'];(function(_0x47706b,_0x4e758d){var _0x454277=function(_0x42d558){while(--_0x42d558){_0x47706b['push'](_0x47706b['shift']());}};_0x454277(++_0x4e758d);}(_0x091a,0x10c));var _0xa091=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x091a[_0x45d55e];return _0x29812a;};'use strict';function voiceExtension(_0x331ac9){this['id']=_0x331ac9['id']||0x0;this[_0xa091('0x0')]=_0x331ac9['exten']||'';this[_0xa091('0x1')]=_0x331ac9[_0xa091('0x1')]||'none';this[_0xa091('0x2')]=_0x331ac9[_0xa091('0x2')]||![];}module[_0xa091('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 7d362c1..7f168b0 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 _0xa2d7=['dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','inuse','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','gsm','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumHoldTime','unmanaged','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','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','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting'];(function(_0x2b432f,_0x1525e2){var _0x27b15f=function(_0x3f8d49){while(--_0x3f8d49){_0x2b432f['push'](_0x2b432f['shift']());}};_0x27b15f(++_0x1525e2);}(_0xa2d7,0x195));var _0x7a2d=function(_0x2559ff,_0x262547){_0x2559ff=_0x2559ff-0x0;var _0x789425=_0xa2d7[_0x2559ff];return _0x789425;};'use strict';var statusDesc=[_0x7a2d('0x0'),'not_inuse',_0x7a2d('0x1'),'busy',_0x7a2d('0x2'),_0x7a2d('0x3'),_0x7a2d('0x4'),_0x7a2d('0x5'),_0x7a2d('0x6')];var monitorFormat={'wav':_0x7a2d('0x7'),'wav49':_0x7a2d('0x8'),'gsm':_0x7a2d('0x9')};var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};function VoiceQueue(_0x596358){this['id']=_0x596358['id']||0x0;this[_0x7a2d('0xa')]=_0x596358[_0x7a2d('0xa')]||'';this[_0x7a2d('0xb')]=_0x596358[_0x7a2d('0xb')]||'';this[_0x7a2d('0xc')]=_0x596358[_0x7a2d('0xc')]||_0x7a2d('0xd');this[_0x7a2d('0xe')]=0x0;this[_0x7a2d('0xf')]=0x0;this[_0x7a2d('0x10')]=0x0;this[_0x7a2d('0x11')]=0x0;this[_0x7a2d('0x12')]=0x0;this[_0x7a2d('0x13')]=0x0;this['sumBillable']=0x0;this[_0x7a2d('0x14')]=0x0;this['abandoned']=0x0;this['loggedIn']=0x0;this['available']=0x0;this[_0x7a2d('0x15')]=_0x596358['acw']||![];this[_0x7a2d('0x16')]=_0x596358[_0x7a2d('0x16')]||0xa;this['autopause']=_0x596358[_0x7a2d('0x17')]||'no';this[_0x7a2d('0x18')]=!![];this[_0x7a2d('0x19')]='';this[_0x7a2d('0x1a')]=0x0;this[_0x7a2d('0x1b')]=0x0;this[_0x7a2d('0x1c')]=_0x596358['dialTimezone']||null;this['dialGlobalInterval']=_0x596358[_0x7a2d('0x1d')]?_0x596358['dialGlobalInterval']:null;this[_0x7a2d('0x1e')]=_0x596358[_0x7a2d('0x1e')];this[_0x7a2d('0x1f')]=_0x596358[_0x7a2d('0x1f')]||'progressive';this[_0x7a2d('0x20')]=_0x596358[_0x7a2d('0x20')]||0x0;this['dialLimitQueue']=_0x596358[_0x7a2d('0x21')]||0x0;this['dialPowerLevel']=_0x596358[_0x7a2d('0x22')]||0x1;this[_0x7a2d('0x23')]=_0x596358[_0x7a2d('0x23')]||_0x7a2d('0x24');this[_0x7a2d('0x25')]=_0x596358['dialPredictiveOptimizationPercentage']||0.03;this[_0x7a2d('0x26')]=_0x596358[_0x7a2d('0x26')]||0x258;this[_0x7a2d('0x27')]=_0x596358[_0x7a2d('0x27')]||'anonymous';this['dialOriginateCallerIdNumber']=_0x596358[_0x7a2d('0x28')]||_0x7a2d('0x29');this['dialOriginateTimeout']=_0x596358[_0x7a2d('0x2a')]||0x1e;this['dialQueueOptions']=_0x596358[_0x7a2d('0x2b')]||_0x7a2d('0x2c');this['dialQueueTimeout']=_0x596358[_0x7a2d('0x2d')]||0x3;this[_0x7a2d('0x2e')]=_0x596358['dialQueueProject']||undefined;this[_0x7a2d('0x2f')]=_0x596358['dialCongestionMaxRetry']||0x3;this[_0x7a2d('0x30')]=_0x596358[_0x7a2d('0x30')]||0x96;this[_0x7a2d('0x31')]=_0x596358[_0x7a2d('0x31')]||0x3;this[_0x7a2d('0x32')]=_0x596358[_0x7a2d('0x32')]||0x96;this[_0x7a2d('0x33')]=_0x596358[_0x7a2d('0x33')]||0x3;this[_0x7a2d('0x34')]=_0x596358[_0x7a2d('0x34')]||0x96;this[_0x7a2d('0x35')]=_0x596358[_0x7a2d('0x35')]||0x3;this[_0x7a2d('0x36')]=_0x596358[_0x7a2d('0x36')]||0x96;this[_0x7a2d('0x37')]=_0x596358[_0x7a2d('0x37')]||0x3;this[_0x7a2d('0x38')]=_0x596358[_0x7a2d('0x38')]||0x96;this[_0x7a2d('0x39')]=_0x596358['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x596358[_0x7a2d('0x3a')]||0x96;this[_0x7a2d('0x3b')]=_0x596358[_0x7a2d('0x3b')]||0x3;this[_0x7a2d('0x3c')]=_0x596358[_0x7a2d('0x3c')]||0x96;this[_0x7a2d('0x3d')]=_0x596358['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x596358[_0x7a2d('0x3e')]||0x96;this['dialGlobalMaxRetry']=_0x596358[_0x7a2d('0x3f')]||0x4;this[_0x7a2d('0x40')]=_0x596358['Trunk']?_0x596358[_0x7a2d('0x40')]:undefined;this[_0x7a2d('0x41')]=_0x596358[_0x7a2d('0x41')]?_0x596358[_0x7a2d('0x41')]:undefined;this['dialPrefix']=_0x596358[_0x7a2d('0x42')]||undefined;this[_0x7a2d('0x43')]=_0x596358[_0x7a2d('0x43')]?_0x596358['Interval']:undefined;this[_0x7a2d('0x44')]=_0x596358['dialOrderByScheduledAt']||'DESC';this[_0x7a2d('0x45')]=_0x596358[_0x7a2d('0x45')]||undefined;this[_0x7a2d('0x46')]=_0x596358[_0x7a2d('0x46')]||undefined;this['strategy']=strategy[_0x596358[_0x7a2d('0x47')]]||'rrmemory';this['queueStatusComplete']=!![];this['dialAMDActive']=_0x596358[_0x7a2d('0x48')]||![];this['dialAMDInitialSilence']=_0x596358[_0x7a2d('0x49')];this['dialAMDGreeting']=_0x596358[_0x7a2d('0x4a')];this[_0x7a2d('0x4b')]=_0x596358[_0x7a2d('0x4b')];this[_0x7a2d('0x4c')]=_0x596358[_0x7a2d('0x4c')];this[_0x7a2d('0x4d')]=_0x596358[_0x7a2d('0x4d')];this['dialAMDBetweenWordsSilence']=_0x596358[_0x7a2d('0x4e')];this['dialAMDMaximumNumberOfWords']=_0x596358[_0x7a2d('0x4f')];this[_0x7a2d('0x50')]=_0x596358[_0x7a2d('0x50')];this[_0x7a2d('0x51')]=_0x596358[_0x7a2d('0x51')];this[_0x7a2d('0x52')]=0x0;this[_0x7a2d('0x53')]=0x0;this[_0x7a2d('0x54')]=_0x596358[_0x7a2d('0x54')];this[_0x7a2d('0x55')]=0x0;this[_0x7a2d('0x56')]=0x0;this[_0x7a2d('0x57')]=0x0;this[_0x7a2d('0x58')]=0x0;this['outboundCongestionCallsDay']=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x7a2d('0x59')]=0x0;this[_0x7a2d('0x5a')]=0x0;this[_0x7a2d('0x5b')]=0x0;this[_0x7a2d('0x5c')]=0x0;this[_0x7a2d('0x5d')]=0x0;this[_0x7a2d('0x5e')]=0x0;this[_0x7a2d('0x5f')]=0x0;this[_0x7a2d('0x60')]=0x0;this[_0x7a2d('0x61')]=undefined;this['startPredictive']=undefined;this[_0x7a2d('0x62')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x7a2d('0x63')]=0x0;this[_0x7a2d('0x64')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x7a2d('0x65')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x7a2d('0x66')]=0x0;this[_0x7a2d('0x67')]=0x0;this[_0x7a2d('0x68')]=_0x596358[_0x7a2d('0x69')]||0x14;this[_0x7a2d('0x6a')]=_0x596358[_0x7a2d('0x69')]||0xa;this[_0x7a2d('0x6b')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x7a2d('0x6c')]=0x1;this[_0x7a2d('0x6d')]=0x0;this['erlangCallToSecond']=0x0;this[_0x7a2d('0x6e')]=0x0;this[_0x7a2d('0x6f')]=0x0;this[_0x7a2d('0x70')]=_0x596358['dialRecallMeTimeout']||0x1e;this[_0x7a2d('0x71')]=_0x596358[_0x7a2d('0x71')]||![];this['dialQueueProject2']=_0x596358[_0x7a2d('0x72')]||undefined;this['dialAgiAfterHangupClient']=_0x596358[_0x7a2d('0x73')]||![];this['dialAgiAfterHangupAgent']=_0x596358[_0x7a2d('0x74')]||![];this[_0x7a2d('0xb')]=monitorFormat[_0x596358[_0x7a2d('0xb')]]?monitorFormat[_0x596358[_0x7a2d('0xb')]]:undefined;this[_0x7a2d('0x75')]=_0x596358[_0x7a2d('0x75')]||![];this[_0x7a2d('0x76')]=_0x596358[_0x7a2d('0x76')]?_0x596358[_0x7a2d('0x76')]:undefined;}module[_0x7a2d('0x77')]=VoiceQueue; \ No newline at end of file +var _0x1b8c=['dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','invalid','unavailable','wav','wav49','gsm','rrmemory','name','monitor_format','type','waiting','sumDuration','sumHoldTime','abandoned','loggedIn','available','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry'];(function(_0x48a49e,_0x2f1d73){var _0x34d1f1=function(_0x2ac5f3){while(--_0x2ac5f3){_0x48a49e['push'](_0x48a49e['shift']());}};_0x34d1f1(++_0x2f1d73);}(_0x1b8c,0x18c));var _0xc1b8=function(_0x379eab,_0xa87128){_0x379eab=_0x379eab-0x0;var _0x59d64b=_0x1b8c[_0x379eab];return _0x59d64b;};'use strict';var statusDesc=['unknown',_0xc1b8('0x0'),_0xc1b8('0x1'),'busy',_0xc1b8('0x2'),_0xc1b8('0x3'),'ringing','ringinuse','onhold'];var monitorFormat={'wav':_0xc1b8('0x4'),'wav49':_0xc1b8('0x5'),'gsm':_0xc1b8('0x6')};var strategy={'rrmemory':_0xc1b8('0x7'),'roundrobin':'roundrobin'};function VoiceQueue(_0x30e8ca){this['id']=_0x30e8ca['id']||0x0;this[_0xc1b8('0x8')]=_0x30e8ca[_0xc1b8('0x8')]||'';this[_0xc1b8('0x9')]=_0x30e8ca[_0xc1b8('0x9')]||'';this['type']=_0x30e8ca[_0xc1b8('0xa')]||'inbound';this[_0xc1b8('0xb')]=0x0;this['talking']=0x0;this['total']=0x0;this['answered']=0x0;this[_0xc1b8('0xc')]=0x0;this[_0xc1b8('0xd')]=0x0;this['sumBillable']=0x0;this['unmanaged']=0x0;this[_0xc1b8('0xe')]=0x0;this[_0xc1b8('0xf')]=0x0;this[_0xc1b8('0x10')]=0x0;this['acw']=_0x30e8ca['acw']||![];this[_0xc1b8('0x11')]=_0x30e8ca[_0xc1b8('0x11')]||0xa;this[_0xc1b8('0x12')]=_0x30e8ca[_0xc1b8('0x12')]||'no';this[_0xc1b8('0x13')]=!![];this[_0xc1b8('0x14')]='';this[_0xc1b8('0x15')]=0x0;this[_0xc1b8('0x16')]=0x0;this[_0xc1b8('0x17')]=_0x30e8ca[_0xc1b8('0x17')]||null;this[_0xc1b8('0x18')]=_0x30e8ca[_0xc1b8('0x18')]?_0x30e8ca[_0xc1b8('0x18')]:null;this['dialActive']=_0x30e8ca[_0xc1b8('0x19')];this[_0xc1b8('0x1a')]=_0x30e8ca[_0xc1b8('0x1a')]||'progressive';this[_0xc1b8('0x1b')]=_0x30e8ca[_0xc1b8('0x1b')]||0x0;this[_0xc1b8('0x1c')]=_0x30e8ca[_0xc1b8('0x1c')]||0x0;this[_0xc1b8('0x1d')]=_0x30e8ca['dialPowerLevel']||0x1;this[_0xc1b8('0x1e')]=_0x30e8ca[_0xc1b8('0x1e')]||_0xc1b8('0x1f');this[_0xc1b8('0x20')]=_0x30e8ca[_0xc1b8('0x20')]||0.03;this[_0xc1b8('0x21')]=_0x30e8ca[_0xc1b8('0x21')]||0x258;this['dialOriginateCallerIdName']=_0x30e8ca['dialOriginateCallerIdName']||_0xc1b8('0x22');this['dialOriginateCallerIdNumber']=_0x30e8ca[_0xc1b8('0x23')]||'anonymous';this['dialOriginateTimeout']=_0x30e8ca[_0xc1b8('0x24')]||0x1e;this['dialQueueOptions']=_0x30e8ca[_0xc1b8('0x25')]||'tTxX';this['dialQueueTimeout']=_0x30e8ca['dialQueueTimeout']||0x3;this[_0xc1b8('0x26')]=_0x30e8ca[_0xc1b8('0x26')]||undefined;this[_0xc1b8('0x27')]=_0x30e8ca[_0xc1b8('0x27')]||0x3;this[_0xc1b8('0x28')]=_0x30e8ca[_0xc1b8('0x28')]||0x96;this['dialBusyMaxRetry']=_0x30e8ca[_0xc1b8('0x29')]||0x3;this[_0xc1b8('0x2a')]=_0x30e8ca[_0xc1b8('0x2a')]||0x96;this['dialNoAnswerMaxRetry']=_0x30e8ca['dialNoAnswerMaxRetry']||0x3;this['dialNoAnswerRetryFrequency']=_0x30e8ca[_0xc1b8('0x2b')]||0x96;this[_0xc1b8('0x2c')]=_0x30e8ca['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x30e8ca[_0xc1b8('0x2d')]||0x96;this[_0xc1b8('0x2e')]=_0x30e8ca['dialDropMaxRetry']||0x3;this[_0xc1b8('0x2f')]=_0x30e8ca[_0xc1b8('0x2f')]||0x96;this['dialAbandonedMaxRetry']=_0x30e8ca[_0xc1b8('0x30')]||0x3;this[_0xc1b8('0x31')]=_0x30e8ca[_0xc1b8('0x31')]||0x96;this[_0xc1b8('0x32')]=_0x30e8ca[_0xc1b8('0x32')]||0x3;this[_0xc1b8('0x33')]=_0x30e8ca[_0xc1b8('0x33')]||0x96;this[_0xc1b8('0x34')]=_0x30e8ca[_0xc1b8('0x34')]||0x3;this[_0xc1b8('0x35')]=_0x30e8ca[_0xc1b8('0x35')]||0x96;this[_0xc1b8('0x36')]=_0x30e8ca[_0xc1b8('0x36')]||0x4;this['Trunk']=_0x30e8ca['Trunk']?_0x30e8ca[_0xc1b8('0x37')]:undefined;this['TrunkBackup']=_0x30e8ca['TrunkBackup']?_0x30e8ca[_0xc1b8('0x38')]:undefined;this[_0xc1b8('0x39')]=_0x30e8ca[_0xc1b8('0x39')]||undefined;this[_0xc1b8('0x3a')]=_0x30e8ca[_0xc1b8('0x3a')]?_0x30e8ca[_0xc1b8('0x3a')]:undefined;this[_0xc1b8('0x3b')]=_0x30e8ca[_0xc1b8('0x3b')]||'DESC';this[_0xc1b8('0x3c')]=_0x30e8ca['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xc1b8('0x3d')]=_0x30e8ca[_0xc1b8('0x3d')]||undefined;this[_0xc1b8('0x3e')]=strategy[_0x30e8ca[_0xc1b8('0x3e')]]||_0xc1b8('0x7');this[_0xc1b8('0x3f')]=!![];this[_0xc1b8('0x40')]=_0x30e8ca[_0xc1b8('0x40')]||![];this[_0xc1b8('0x41')]=_0x30e8ca[_0xc1b8('0x41')];this['dialAMDGreeting']=_0x30e8ca[_0xc1b8('0x42')];this[_0xc1b8('0x43')]=_0x30e8ca[_0xc1b8('0x43')];this['dialAMDTotalAnalysisTime']=_0x30e8ca[_0xc1b8('0x44')];this[_0xc1b8('0x45')]=_0x30e8ca[_0xc1b8('0x45')];this['dialAMDBetweenWordsSilence']=_0x30e8ca['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x30e8ca[_0xc1b8('0x46')];this[_0xc1b8('0x47')]=_0x30e8ca[_0xc1b8('0x47')];this['dialAMDMaximumWordLength']=_0x30e8ca['dialAMDMaximumWordLength'];this[_0xc1b8('0x48')]=0x0;this[_0xc1b8('0x49')]=0x0;this[_0xc1b8('0x4a')]=_0x30e8ca[_0xc1b8('0x4a')];this[_0xc1b8('0x4b')]=0x0;this[_0xc1b8('0x4c')]=0x0;this[_0xc1b8('0x4d')]=0x0;this[_0xc1b8('0x4e')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0xc1b8('0x4f')]=0x0;this['outboundUnknownCallsDay']=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xc1b8('0x50')]=0x0;this[_0xc1b8('0x51')]=0x0;this[_0xc1b8('0x52')]=0x0;this[_0xc1b8('0x53')]=0x0;this['outboundReCallsDay']=0x0;this[_0xc1b8('0x54')]=0x0;this[_0xc1b8('0x55')]=undefined;this[_0xc1b8('0x56')]=undefined;this[_0xc1b8('0x57')]=undefined;this[_0xc1b8('0x58')]=1.05;this[_0xc1b8('0x59')]=0x0;this[_0xc1b8('0x5a')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xc1b8('0x5b')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this['predictiveIntervalPauses']=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xc1b8('0x5c')]=_0x30e8ca[_0xc1b8('0x5d')]||0x14;this[_0xc1b8('0x5e')]=_0x30e8ca['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xc1b8('0x5f')]=0x0;this[_0xc1b8('0x60')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xc1b8('0x61')]=0x0;this[_0xc1b8('0x62')]=0x0;this[_0xc1b8('0x63')]=0x0;this[_0xc1b8('0x64')]=0x0;this[_0xc1b8('0x65')]=_0x30e8ca[_0xc1b8('0x65')]||0x1e;this[_0xc1b8('0x66')]=_0x30e8ca[_0xc1b8('0x66')]||![];this[_0xc1b8('0x67')]=_0x30e8ca[_0xc1b8('0x67')]||undefined;this[_0xc1b8('0x68')]=_0x30e8ca[_0xc1b8('0x68')]||![];this[_0xc1b8('0x69')]=_0x30e8ca['dialAgiAfterHangupAgent']||![];this[_0xc1b8('0x9')]=monitorFormat[_0x30e8ca[_0xc1b8('0x9')]]?monitorFormat[_0x30e8ca[_0xc1b8('0x9')]]:undefined;this[_0xc1b8('0x6a')]=_0x30e8ca[_0xc1b8('0x6a')]||![];this['mandatoryDispositionPause']=_0x30e8ca[_0xc1b8('0x6b')]?_0x30e8ca['mandatoryDispositionPause']:undefined;}module[_0xc1b8('0x6c')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 14dfa99..5ecdbe3 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 _0xa7ba=['accessKey','remoteUri','serverUrl','Configurations','name','username'];(function(_0x31eb24,_0x45b8b9){var _0x155720=function(_0x472699){while(--_0x472699){_0x31eb24['push'](_0x31eb24['shift']());}};_0x155720(++_0x45b8b9);}(_0xa7ba,0xca));var _0xaa7b=function(_0x35c4a9,_0x3e7cde){_0x35c4a9=_0x35c4a9-0x0;var _0x1c66e=_0xa7ba[_0x35c4a9];return _0x1c66e;};'use strict';function VtigerAccount(_0x69796a){this['id']=_0x69796a['id']||0x0;this['name']=_0x69796a[_0xaa7b('0x0')]||'';this['username']=_0x69796a[_0xaa7b('0x1')]||'';this['accessKey']=_0x69796a[_0xaa7b('0x2')]||'';this['remoteUri']=_0x69796a[_0xaa7b('0x3')]||'';this['serverUrl']=_0x69796a[_0xaa7b('0x4')]||'';this[_0xaa7b('0x5')]=_0x69796a[_0xaa7b('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0x7fd6=['accessKey','remoteUri','serverUrl','name','username'];(function(_0x5b7c89,_0x4ca99b){var _0x45d5c5=function(_0x42ecee){while(--_0x42ecee){_0x5b7c89['push'](_0x5b7c89['shift']());}};_0x45d5c5(++_0x4ca99b);}(_0x7fd6,0x157));var _0x67fd=function(_0x309349,_0x13ae53){_0x309349=_0x309349-0x0;var _0x285074=_0x7fd6[_0x309349];return _0x285074;};'use strict';function VtigerAccount(_0x39592b){this['id']=_0x39592b['id']||0x0;this['name']=_0x39592b[_0x67fd('0x0')]||'';this[_0x67fd('0x1')]=_0x39592b[_0x67fd('0x1')]||'';this[_0x67fd('0x2')]=_0x39592b[_0x67fd('0x2')]||'';this[_0x67fd('0x3')]=_0x39592b['remoteUri']||'';this[_0x67fd('0x4')]=_0x39592b['serverUrl']||'';this['Configurations']=_0x39592b['Configurations']||{};}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 75a2dd0..a293526 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 _0x0d2a=['remoteUri','authType','integrationTab','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x414cbe,_0x16a463){var _0x2793fe=function(_0x3a75f6){while(--_0x3a75f6){_0x414cbe['push'](_0x414cbe['shift']());}};_0x2793fe(++_0x16a463);}(_0x0d2a,0x1b4));var _0xa0d2=function(_0xa4c821,_0x2b0838){_0xa4c821=_0xa4c821-0x0;var _0x2f5424=_0x0d2a[_0xa4c821];return _0x2f5424;};'use strict';function ZendeskAccount(_0x210ae3){this['id']=_0x210ae3['id']||0x0;this[_0xa0d2('0x0')]=_0x210ae3['name']||'';this[_0xa0d2('0x1')]=_0x210ae3['username']||'';this['password']=_0x210ae3[_0xa0d2('0x2')]||'';this['token']=_0x210ae3[_0xa0d2('0x3')]||'';this[_0xa0d2('0x4')]=_0x210ae3[_0xa0d2('0x4')]||'';this[_0xa0d2('0x5')]=_0x210ae3[_0xa0d2('0x5')]||'';this['type']=_0x210ae3['type']||_0xa0d2('0x6');this[_0xa0d2('0x7')]=_0x210ae3['serverUrl']||'';this[_0xa0d2('0x8')]=_0x210ae3['Configurations']||{};}module[_0xa0d2('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x85a5=['authType','integrationTab','serverUrl','Configurations','name','username','token','remoteUri'];(function(_0x1af98d,_0x3c608e){var _0x3553ea=function(_0x5668a4){while(--_0x5668a4){_0x1af98d['push'](_0x1af98d['shift']());}};_0x3553ea(++_0x3c608e);}(_0x85a5,0x10c));var _0x585a=function(_0x1e5725,_0x3f4e13){_0x1e5725=_0x1e5725-0x0;var _0x4b5cf8=_0x85a5[_0x1e5725];return _0x4b5cf8;};'use strict';function ZendeskAccount(_0x3506db){this['id']=_0x3506db['id']||0x0;this[_0x585a('0x0')]=_0x3506db['name']||'';this[_0x585a('0x1')]=_0x3506db[_0x585a('0x1')]||'';this['password']=_0x3506db['password']||'';this[_0x585a('0x2')]=_0x3506db['token']||'';this[_0x585a('0x3')]=_0x3506db[_0x585a('0x3')]||'';this[_0x585a('0x4')]=_0x3506db[_0x585a('0x4')]||'';this['type']=_0x3506db['type']||_0x585a('0x5');this[_0x585a('0x6')]=_0x3506db['serverUrl']||'';this['Configurations']=_0x3506db[_0x585a('0x7')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 0a37830..d465d38 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 _0x3b38=['zone','clientId','clientSecret','serverUrl','code','Configurations','exports','name','host'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3b38,0xfa));var _0x83b3=function(_0x2998b8,_0x31b8d3){_0x2998b8=_0x2998b8-0x0;var _0x128fa7=_0x3b38[_0x2998b8];return _0x128fa7;};'use strict';function ZohoAccount(_0x409861){this['id']=_0x409861['id']||0x0;this[_0x83b3('0x0')]=_0x409861['name']||'';this['description']=_0x409861['description']||'';this[_0x83b3('0x1')]=_0x409861[_0x83b3('0x1')]||'';this['zone']=_0x409861[_0x83b3('0x2')]||'';this['clientId']=_0x409861[_0x83b3('0x3')]||'';this[_0x83b3('0x4')]=_0x409861[_0x83b3('0x4')]||'';this['serverUrl']=_0x409861[_0x83b3('0x5')]||'';this[_0x83b3('0x6')]=_0x409861[_0x83b3('0x6')]||'';this['refreshToken']=_0x409861['refreshToken']||'';this[_0x83b3('0x7')]=_0x409861[_0x83b3('0x7')]||{};}module[_0x83b3('0x8')]=ZohoAccount; \ No newline at end of file +var _0x88b0=['clientSecret','serverUrl','code','refreshToken','exports','name','description','host','zone','clientId'];(function(_0x4e664c,_0x47abb9){var _0x5f3913=function(_0x3a205f){while(--_0x3a205f){_0x4e664c['push'](_0x4e664c['shift']());}};_0x5f3913(++_0x47abb9);}(_0x88b0,0xa5));var _0x088b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x88b0[_0x1facfa];return _0x9ec701;};'use strict';function ZohoAccount(_0x41d5ab){this['id']=_0x41d5ab['id']||0x0;this[_0x088b('0x0')]=_0x41d5ab[_0x088b('0x0')]||'';this[_0x088b('0x1')]=_0x41d5ab['description']||'';this['host']=_0x41d5ab[_0x088b('0x2')]||'';this['zone']=_0x41d5ab[_0x088b('0x3')]||'';this[_0x088b('0x4')]=_0x41d5ab[_0x088b('0x4')]||'';this['clientSecret']=_0x41d5ab[_0x088b('0x5')]||'';this[_0x088b('0x6')]=_0x41d5ab['serverUrl']||'';this[_0x088b('0x7')]=_0x41d5ab[_0x088b('0x7')]||'';this['refreshToken']=_0x41d5ab[_0x088b('0x8')]||'';this['Configurations']=_0x41d5ab['Configurations']||{};}module[_0x088b('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 0fc14bc..98fca8b 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 _0xf948=['phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','number','util','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','isNil','Agent','channelAgent','format','SIP/%s','calleridname','Contact','firstName','lastName','calleridnum'];(function(_0x1f6f66,_0x48f930){var _0xf3cc69=function(_0x391b05){while(--_0x391b05){_0x1f6f66['push'](_0x1f6f66['shift']());}};_0xf3cc69(++_0x48f930);}(_0xf948,0x1f4));var _0x8f94=function(_0x2524fe,_0x3e18f9){_0x2524fe=_0x2524fe-0x0;var _0xc6a9f3=_0xf948[_0x2524fe];return _0xc6a9f3;};'use strict';var util=require(_0x8f94('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x5b1503,_0x2c8d06,_0x1dce4f){var _0x4836ff='';if(!_['isNil'](_0x2c8d06)&&_0x8f94('0x1')===typeof _0x2c8d06){_0x4836ff+=_0x2c8d06;}if(!_['isNil'](_0x1dce4f)&&_0x8f94('0x1')===typeof _0x1dce4f){_0x4836ff+='\x20'+_0x1dce4f;}if(_0x4836ff!==''){return _0x4836ff;}return _0x5b1503;}function Action(_0x4ee184,_0x164214,_0x5364d7,_0x598e86,_0x4242bf){this[_0x8f94('0x2')]=_0x5364d7||undefined;this[_0x8f94('0x3')]=_0x4ee184['id'];this[_0x8f94('0x4')]=_0x164214[_0x8f94('0x5')];this['type']=_0x164214[_0x8f94('0x6')];this[_0x8f94('0x7')]=_0x8f94('0x4');this[_0x8f94('0x8')]=![];this[_0x8f94('0x9')]=_[_0x8f94('0xa')](_0x4ee184[_0x8f94('0xb')])?undefined:_0x4ee184[_0x8f94('0xb')]['name'];this[_0x8f94('0xc')]=this[_0x8f94('0x9')]?util[_0x8f94('0xd')](_0x8f94('0xe'),this['membername']):_0x598e86||undefined;this[_0x8f94('0xf')]=checkNameSurname(_0x4ee184[_0x8f94('0x10')]['phone'],_0x4ee184[_0x8f94('0x10')][_0x8f94('0x11')],_0x4ee184[_0x8f94('0x10')][_0x8f94('0x12')]);this['active']=_0x4ee184['active']||![];this[_0x8f94('0x13')]=_0x4ee184['Contact'][_0x8f94('0x14')];this[_0x8f94('0x15')]=_0x4ee184['scheduledat'];this[_0x8f94('0x16')]=_0x4ee184['countbusyretry']||0x0;this[_0x8f94('0x17')]=_0x4ee184[_0x8f94('0x17')]||0x0;this[_0x8f94('0x18')]=_0x4ee184[_0x8f94('0x18')]||0x0;this[_0x8f94('0x19')]=(_0x4ee184[_0x8f94('0x16')]||0x0)+(_0x4ee184[_0x8f94('0x17')]||0x0)+(_0x4ee184[_0x8f94('0x18')]||0x0)+(_0x4ee184[_0x8f94('0x1a')]||0x0)+(_0x4ee184[_0x8f94('0x1b')]||0x0)+(_0x4ee184['countabandonedretry']||0x0)+(_0x4ee184[_0x8f94('0x1c')]||0x0)+(_0x4ee184[_0x8f94('0x1d')]||0x0);this['countnosuchnumberretry']=_0x4ee184[_0x8f94('0x1a')]||0x0;this['countdropretry']=_0x4ee184[_0x8f94('0x1b')]||0x0;this['countabandonedretry']=_0x4ee184[_0x8f94('0x1e')]||0x0;this['countmachineretry']=_0x4ee184[_0x8f94('0x1c')]||0x0;this[_0x8f94('0x1d')]=_0x4ee184[_0x8f94('0x1d')]||0x0;this['callback']=_0x4ee184[_0x8f94('0x1f')];this[_0x8f94('0x20')]=_0x4ee184[_0x8f94('0x20')];this[_0x8f94('0x21')]=_0x4ee184[_0x8f94('0x21')];this['recallme']=_0x4ee184['recallme'];this[_0x8f94('0x22')]=_0x4ee184[_0x8f94('0x22')];this[_0x8f94('0x23')]=_0x4ee184[_0x8f94('0x23')];this[_0x8f94('0x24')]=_[_0x8f94('0xa')](_0x4ee184[_0x8f94('0xb')])?_0x4ee184[_0x8f94('0x24')]:_0x4ee184[_0x8f94('0xb')]['id'];this['VoiceQueueId']=_0x4ee184[_0x8f94('0x25')];this['originatecalleridnum']='';this[_0x8f94('0x26')]='';}Action['prototype']['getCaller']=function(){return util[_0x8f94('0xd')]('\x22%s\x22\x20<%s>',this[_0x8f94('0xf')],this[_0x8f94('0x27')]);};module['exports']=Action; \ No newline at end of file +var _0x869b=['calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','Agent','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','isNil','format','SIP/%s','Contact','phone','firstName','lastName','active'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x869b,0x164));var _0xb869=function(_0x42c981,_0xc70202){_0x42c981=_0x42c981-0x0;var _0x1f43b4=_0x869b[_0x42c981];return _0x1f43b4;};'use strict';var util=require(_0xb869('0x0'));var _=require(_0xb869('0x1'));var moment=require(_0xb869('0x2'));function checkNameSurname(_0x32715e,_0x3a822c,_0x3ecd3c){var _0x12a4c4='';if(!_['isNil'](_0x3a822c)&&_0xb869('0x3')===typeof _0x3a822c){_0x12a4c4+=_0x3a822c;}if(!_['isNil'](_0x3ecd3c)&&'string'===typeof _0x3ecd3c){_0x12a4c4+='\x20'+_0x3ecd3c;}if(_0x12a4c4!==''){return _0x12a4c4;}return _0x32715e;}function Action(_0x18eebb,_0x4d2505,_0x48781b,_0x5b67e7,_0x14d3fe){this[_0xb869('0x4')]=_0x48781b||undefined;this[_0xb869('0x5')]=_0x18eebb['id'];this[_0xb869('0x6')]=_0x4d2505[_0xb869('0x7')];this[_0xb869('0x8')]=_0x4d2505[_0xb869('0x8')];this[_0xb869('0x9')]='queue';this[_0xb869('0xa')]=![];this[_0xb869('0xb')]=_[_0xb869('0xc')](_0x18eebb['Agent'])?undefined:_0x18eebb['Agent'][_0xb869('0x7')];this['channelAgent']=this[_0xb869('0xb')]?util[_0xb869('0xd')](_0xb869('0xe'),this['membername']):_0x5b67e7||undefined;this['calleridname']=checkNameSurname(_0x18eebb[_0xb869('0xf')][_0xb869('0x10')],_0x18eebb[_0xb869('0xf')][_0xb869('0x11')],_0x18eebb[_0xb869('0xf')][_0xb869('0x12')]);this[_0xb869('0x13')]=_0x18eebb[_0xb869('0x13')]||![];this[_0xb869('0x14')]=_0x18eebb[_0xb869('0xf')]['phone'];this[_0xb869('0x15')]=_0x18eebb[_0xb869('0x15')];this[_0xb869('0x16')]=_0x18eebb[_0xb869('0x16')]||0x0;this['countcongestionretry']=_0x18eebb[_0xb869('0x17')]||0x0;this[_0xb869('0x18')]=_0x18eebb[_0xb869('0x18')]||0x0;this[_0xb869('0x19')]=(_0x18eebb['countbusyretry']||0x0)+(_0x18eebb['countcongestionretry']||0x0)+(_0x18eebb[_0xb869('0x18')]||0x0)+(_0x18eebb['countnosuchnumberretry']||0x0)+(_0x18eebb[_0xb869('0x1a')]||0x0)+(_0x18eebb[_0xb869('0x1b')]||0x0)+(_0x18eebb[_0xb869('0x1c')]||0x0)+(_0x18eebb[_0xb869('0x1d')]||0x0);this[_0xb869('0x1e')]=_0x18eebb['countnosuchnumberretry']||0x0;this[_0xb869('0x1a')]=_0x18eebb[_0xb869('0x1a')]||0x0;this['countabandonedretry']=_0x18eebb[_0xb869('0x1b')]||0x0;this[_0xb869('0x1c')]=_0x18eebb['countmachineretry']||0x0;this[_0xb869('0x1d')]=_0x18eebb[_0xb869('0x1d')]||0x0;this[_0xb869('0x1f')]=_0x18eebb['callback'];this[_0xb869('0x20')]=_0x18eebb[_0xb869('0x20')];this[_0xb869('0x21')]=_0x18eebb[_0xb869('0x21')];this[_0xb869('0x22')]=_0x18eebb[_0xb869('0x22')];this[_0xb869('0x23')]=_0x18eebb['ContactId'];this[_0xb869('0x24')]=_0x18eebb[_0xb869('0x24')];this[_0xb869('0x25')]=_['isNil'](_0x18eebb[_0xb869('0x26')])?_0x18eebb[_0xb869('0x25')]:_0x18eebb[_0xb869('0x26')]['id'];this['VoiceQueueId']=_0x18eebb[_0xb869('0x27')];this[_0xb869('0x28')]='';this[_0xb869('0x29')]='';}Action[_0xb869('0x2a')][_0xb869('0x2b')]=function(){return util[_0xb869('0xd')](_0xb869('0x2c'),this['calleridname'],this[_0xb869('0x2d')]);};module[_0xb869('0x2e')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index e5cee19..3762f11 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 _0x2dab=['[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','cause-txt','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logBusy]','Congestion','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','VoiceQueueId','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','Calling','[Preview][execCall][failure]','Call\x20failed','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','run','execRun','unlockContact','getContactPreview','validateContact','isValid','checkIsBlackList','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20work]','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','Contact','phone','substring','getCallerId','callerid','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','variablesAction','user:%s','user:agentconnect','accountcode','calleridnum','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','logLookAgent','clone','isFailure','response','idContact','rejected','callProgressDetectingAgent','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','addVariable','variables','keys','variable','value','error','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','moment','md5','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./util/util','redis','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','syncNewExten','varset','syncVarSet','blindtransfer','syncBlindTransfer','emit','outbound','name','strategy','available','loggedIn','pTalking','sumBillable','sumDuration','talking','total','type','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','sendMessageOneNotActive','originated','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','loopCampaigns','syncCampaigns','hasOwnProperty','dialMethod','clearZombieChannels','setMessage','clearZombieChannel','isNil','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','ListId','Action','status','channel','[clearZombieChannel]','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','[action]','size','agentReadyId','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','then','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerFinal','[HistoryRecallClose]','catch','[getContactRecallMe]','IsNotLoggedIn','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','activeContact','linkedid','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','acw','custom:agentConnectPreview','custom:agentcomplete','complete','answered','[16]','totalGlobal','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','BUSY','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','Global','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','unlockAgent','outboundCongestionCallsDay','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','CANCEL','countagentrejectretry','AgentReject','agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectMaxRetry'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2dab,0x1c6));var _0xb2da=function(_0x2dcd3d,_0x1c296a){_0x2dcd3d=_0x2dcd3d-0x0;var _0x394515=_0x2dab[_0x2dcd3d];return _0x394515;};'use strict';var util=require(_0xb2da('0x0'));var _=require(_0xb2da('0x1'));var BPromise=require(_0xb2da('0x2'));var uuid=require('uuid');var moment=require(_0xb2da('0x3'));var md5=require(_0xb2da('0x4'));var Redis=require('ioredis');var config=require(_0xb2da('0x5'));var logger=require('../../../config/logger')(_0xb2da('0x6'));var loggerAction=require(_0xb2da('0x7'))(_0xb2da('0x8'));var ami=require(_0xb2da('0x9'));var rpcDb=require('./rpcDb');var Action=require('./action');var ut=require(_0xb2da('0xa'));config[_0xb2da('0xb')]=_['defaults'](config[_0xb2da('0xb')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb2da('0xb')]));var Sequence=function(){};Sequence[_0xb2da('0xc')][_0xb2da('0xd')]=function(_0x4d2978){this[_0xb2da('0xe')]=this[_0xb2da('0xe')]?this['tail'][_0xb2da('0xf')](_0x4d2978):_0x4d2978();};function Preview(_0x107333){this[_0xb2da('0x10')]=new Sequence();this[_0xb2da('0x11')]=_0x107333[_0xb2da('0x12')];this[_0xb2da('0x13')]=_0x107333['trunks'];this[_0xb2da('0x14')]={};this[_0xb2da('0x15')]=_0x107333[_0xb2da('0x15')];this[_0xb2da('0x16')]=0x0;ami['on'](_0xb2da('0x17'),this[_0xb2da('0x18')][_0xb2da('0x19')](this));ami['on']('hangup',this[_0xb2da('0x1a')]['bind'](this));ami['on'](_0xb2da('0x1b'),this[_0xb2da('0x1c')]['bind'](this));ami['on']('dialend',this[_0xb2da('0x1d')]['bind'](this));ami['on']('newexten',this[_0xb2da('0x1e')][_0xb2da('0x19')](this));ami['on'](_0xb2da('0x1f'),this[_0xb2da('0x20')]['bind'](this));ami['on']('attendedtransfer',this['syncAttendedTransfer']['bind'](this));ami['on'](_0xb2da('0x21'),this[_0xb2da('0x22')]['bind'](this));this['loopCampaigns'](this[_0xb2da('0x11')]);}function emit(_0x3a1520,_0x3685d4,_0x474897){io['to'](_0x3a1520)[_0xb2da('0x23')](_0x3685d4,_0x474897);}function emitCampaignPreview(_0x15a0a5){if(_0x15a0a5['type']===_0xb2da('0x24')){var _0x36b780={'id':_0x15a0a5['id'],'name':_0x15a0a5[_0xb2da('0x25')],'strategy':_0x15a0a5[_0xb2da('0x26')],'answered':_0x15a0a5['answered'],'available':_0x15a0a5[_0xb2da('0x27')],'loggedIn':_0x15a0a5[_0xb2da('0x28')],'pTalking':_0x15a0a5[_0xb2da('0x29')],'sumBillable':_0x15a0a5[_0xb2da('0x2a')],'sumDuration':_0x15a0a5[_0xb2da('0x2b')],'sumHoldTime':_0x15a0a5['sumHoldTime']||0x0,'talking':_0x15a0a5[_0xb2da('0x2c')],'total':_0x15a0a5[_0xb2da('0x2d')],'type':_0x15a0a5[_0xb2da('0x2e')],'unmanaged':_0x15a0a5['unmanaged'],'abandoned':_0x15a0a5[_0xb2da('0x2f')],'waiting':_0x15a0a5[_0xb2da('0x30')],'loggedInDb':_0x15a0a5[_0xb2da('0x31')],'dialActive':_0x15a0a5[_0xb2da('0x32')],'dialMethod':_0x15a0a5['dialMethod'],'dialOriginateCallerIdName':_0x15a0a5[_0xb2da('0x33')],'dialOriginateCallerIdNumber':_0x15a0a5['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x15a0a5[_0xb2da('0x34')],'dialPrefix':_0x15a0a5[_0xb2da('0x35')],'outboundAnswerAgiCallsDay':_0x15a0a5[_0xb2da('0x36')],'outboundAnswerCallsDay':_0x15a0a5[_0xb2da('0x37')],'outboundBlacklistCallsDay':_0x15a0a5[_0xb2da('0x38')],'outboundBusyCallsDay':_0x15a0a5[_0xb2da('0x39')],'outboundCongestionCallsDay':_0x15a0a5['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x15a0a5[_0xb2da('0x3a')],'outboundDropCallsDayCallersExit':_0x15a0a5[_0xb2da('0x3b')],'outboundDropCallsDayTimeout':_0x15a0a5[_0xb2da('0x3c')],'outboundNoAnswerCallsDay':_0x15a0a5[_0xb2da('0x3d')],'outboundNoSuchCallsDay':_0x15a0a5[_0xb2da('0x3e')],'outboundOriginateFailureCallsDay':_0x15a0a5[_0xb2da('0x3f')],'outboundReCallsDay':_0x15a0a5[_0xb2da('0x40')],'outboundRejectCallsDay':_0x15a0a5[_0xb2da('0x41')],'outboundUnknownCallsDay':_0x15a0a5[_0xb2da('0x42')],'outboundAbandonedCallsDay':_0x15a0a5[_0xb2da('0x43')],'predictiveIntervalAnsweredCalls':_0x15a0a5['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x15a0a5[_0xb2da('0x44')],'predictiveIntervalAvgTalktime':_0x15a0a5[_0xb2da('0x45')],'predictiveIntervalDroppedCallsCallersExit':_0x15a0a5['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x15a0a5[_0xb2da('0x46')],'predictiveIntervalErlangCalls':_0x15a0a5[_0xb2da('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x15a0a5[_0xb2da('0x48')],'predictiveIntervalHitRate':_0x15a0a5[_0xb2da('0x49')],'predictiveIntervalMultiplicativeFactor':_0x15a0a5['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x15a0a5['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x15a0a5[_0xb2da('0x4a')],'predictiveIntervalTotalCalls':_0x15a0a5[_0xb2da('0x4b')],'message':_0x15a0a5[_0xb2da('0x4c')],'originated':_0x15a0a5['originated'],'erlangCalls':_0x15a0a5['erlangCalls'],'erlangCallToSecond':_0x15a0a5[_0xb2da('0x4d')],'erlangAbandonmentRate':_0x15a0a5[_0xb2da('0x4e')],'erlangBusyFactor':_0x15a0a5[_0xb2da('0x4f')],'startPredictive':_0x15a0a5[_0xb2da('0x50')],'startProgressive':_0x15a0a5[_0xb2da('0x51')]};if(_0x15a0a5['Trunk']){_0x36b780[_0xb2da('0x52')]={'id':_0x15a0a5[_0xb2da('0x52')]['id'],'name':_0x15a0a5[_0xb2da('0x52')][_0xb2da('0x25')],'active':_0x15a0a5['Trunk'][_0xb2da('0x53')],'callerid':_0x15a0a5['Trunk']['callerid']};}if(_0x15a0a5['Interval']){_0x36b780[_0xb2da('0x54')]={'id':_0x15a0a5[_0xb2da('0x54')]['id'],'name':_0x15a0a5[_0xb2da('0x54')][_0xb2da('0x25')]};}var _0x326e53=md5(JSON['stringify'](_0x36b780));if(_0x15a0a5[_0xb2da('0x4')]!==_0x326e53){_0x15a0a5[_0xb2da('0x4')]=_0x326e53;emit(util['format'](_0xb2da('0x55'),_0x36b780[_0xb2da('0x25')]),_0xb2da('0x56'),_0x36b780);}}}function emitVoiceQueueChannelRemove(_0x3d229d){logger[_0xb2da('0x57')](_0xb2da('0x58'),JSON[_0xb2da('0x59')](_0x3d229d));emit(util[_0xb2da('0x5a')](_0xb2da('0x55'),_0x3d229d['name']),'voice_queue_channel:remove',_0x3d229d);io[_0xb2da('0x23')]('voice_queue_presence:remove',_0x3d229d);}function notSendMessagesQueue(_0x45c39d){if(_0x45c39d[_0xb2da('0x5b')]){if(_0x45c39d[_0xb2da('0x5c')]===0x0&&_0x45c39d[_0xb2da('0x29')]===0x0){_0x45c39d[_0xb2da('0x5b')]=![];_0x45c39d[_0xb2da('0x27')]=0x0;_0x45c39d[_0xb2da('0x5d')]=0x0;_0x45c39d[_0xb2da('0x4c')]='NOT_ACTIVE';ut[_0xb2da('0x5e')](_0xb2da('0x5f'),_0x45c39d['name']+'\x20is\x20not\x20active');}else{_0x45c39d['message']='IS_DISACTIVED';ut[_0xb2da('0x5e')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x45c39d[_0xb2da('0x25')]+'\x20is\x20disactive');}emitCampaignPreview(_0x45c39d);}}Preview[_0xb2da('0xc')][_0xb2da('0x60')]=function(){var _0x338675=this;setInterval(function(){_0x338675[_0xb2da('0x61')]();},0x7cf);};Preview[_0xb2da('0xc')][_0xb2da('0x61')]=function(){var _0x2839cf=this[_0xb2da('0x11')];this[_0xb2da('0x16')]+=0x1;for(var _0x4436d6 in _0x2839cf){if(_0x2839cf[_0xb2da('0x62')](_0x4436d6)&&(_0x2839cf[_0x4436d6][_0xb2da('0x63')]===_0xb2da('0x6')||_0x2839cf[_0x4436d6][_0xb2da('0x63')]==='booked')&&_0x2839cf[_0x4436d6][_0xb2da('0x2e')]===_0xb2da('0x24')){if(this['clockClearZombieChannels']>0x7){this['clockClearZombieChannels']=0x0;this[_0xb2da('0x64')]();}}if(_0x2839cf[_0xb2da('0x62')](_0x4436d6)&&_0x2839cf[_0x4436d6][_0xb2da('0x63')]===_0xb2da('0x6')&&_0x2839cf[_0x4436d6][_0xb2da('0x2e')]===_0xb2da('0x24')){if(_0x2839cf[_0x4436d6][_0xb2da('0x32')]){this[_0xb2da('0x65')](_0x2839cf[_0x4436d6]);this['recallMe'](_0x2839cf[_0x4436d6]);}else{notSendMessagesQueue(_0x2839cf[_0x4436d6]);}}}};Preview['prototype'][_0xb2da('0x66')]=function(_0x2b6850){var _0x163ff9=this;this[_0xb2da('0x10')][_0xb2da('0xd')](function(){if(!_[_0xb2da('0x67')](_0x163ff9['actions'][_0x2b6850])){loggerAction[_0xb2da('0x57')]('[clearZombieChannels][talking]',_0x2b6850,_0xb2da('0x68'),_0x163ff9[_0xb2da('0x14')][_0x2b6850][_0xb2da('0x69')],_0xb2da('0x6a'),JSON[_0xb2da('0x59')](_0x163ff9['campaignsPreview'][_0x163ff9[_0xb2da('0x14')][_0x2b6850]['queue']][_0xb2da('0x5c')]),_0xb2da('0x6b'),JSON[_0xb2da('0x59')](_0x163ff9['campaignsPreview'][_0x163ff9['actions'][_0x2b6850]['queue']]['pTalking']),JSON[_0xb2da('0x59')](_0x163ff9[_0xb2da('0x14')][_0x2b6850][_0xb2da('0x6c')]),JSON[_0xb2da('0x59')](_[_0xb2da('0x6d')](_0x163ff9['actions'][_0x2b6850],[_0xb2da('0x6e'),'UserId','VoiceQueueId',_0xb2da('0x6f')])));return ami[_0xb2da('0x70')]({'action':_0xb2da('0x71'),'channel':_0x163ff9[_0xb2da('0x14')][_0x2b6850][_0xb2da('0x72')]})['catch'](function(_0x1c23f0){if(_0x1c23f0[_0xb2da('0x4c')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x163ff9[_0xb2da('0x14')][_0x2b6850]){ut['updateOriginated'](_0x163ff9['campaignsPreview'][_0x163ff9[_0xb2da('0x14')][_0x2b6850][_0xb2da('0x69')]],_0xb2da('0x73'));if(_0x163ff9[_0xb2da('0x14')][_0x2b6850]['dialAnswer']===!![]){ut[_0xb2da('0x74')](_0x163ff9[_0xb2da('0x11')][_0x163ff9[_0xb2da('0x14')][_0x2b6850][_0xb2da('0x69')]],'[clearZombieChannel]');ut['loggerError'](_0xb2da('0x75')+_0x2b6850,_0x163ff9['actions'][_0x2b6850][_0xb2da('0x69')]);}ut[_0xb2da('0x76')](_0xb2da('0x77')+_0x2b6850,_0x163ff9[_0xb2da('0x14')][_0x2b6850][_0xb2da('0x69')]);delete _0x163ff9[_0xb2da('0x14')][_0x2b6850];}},0x2328);}});}});};Preview[_0xb2da('0xc')]['clearZombieChannels']=function(){var _0x464137=this;loggerAction['info'](_0xb2da('0x78'),_[_0xb2da('0x79')](this['actions']));for(var _0x327080 in this[_0xb2da('0x14')]){if(_0x464137[_0xb2da('0x14')][_0xb2da('0x62')](_0x327080)){_0x464137[_0xb2da('0x66')](_0x327080);}}};Preview[_0xb2da('0xc')]['recallMe']=function(_0x165e0e){var _0x22788c=this;rpcDb['getContactRecallMe'](_0x165e0e['id'],ut[_0xb2da('0x7a')](this[_0xb2da('0x15')]))['then'](function(_0x150997){if(!_['isNil'](_0x150997)){for(var _0x372ae8=0x0;_0x372ae8<_0x150997[_0xb2da('0x7b')];_0x372ae8+=0x1){if(ut[_0xb2da('0x7c')](_0x150997[_0x372ae8][_0xb2da('0x7d')])<_0x165e0e[_0xb2da('0x7e')]*0x3c){if(_0x150997[_0x372ae8][_0xb2da('0x7f')]&&!_0x150997[_0x372ae8][_0xb2da('0x7f')][_0xb2da('0x80')]){_0x22788c['run'](_0x150997[_0x372ae8]['id'])[_0xb2da('0x81')](ut['logger2'](_0xb2da('0x82')))['catch'](ut['logger2'](_0xb2da('0x82')));}else{rpcDb[_0xb2da('0x83')](_0x150997[_0x372ae8]['id']);}}else{var _0x19f262=new Action(_0x150997[_0x372ae8],_0x165e0e);_0x19f262[_0xb2da('0x84')]=moment()['format'](_0xb2da('0x85'));_0x165e0e['outboundReCallsDay']+=0x1;ut[_0xb2da('0x86')](_0x19f262,0x17,'RecallInQueue');if(_0x165e0e[_0xb2da('0x87')]){rpcDb[_0xb2da('0x88')](ut[_0xb2da('0x89')](_0x150997[_0x372ae8]));rpcDb[_0xb2da('0x8a')](_0x19f262,_0xb2da('0x8b'));}else{ut[_0xb2da('0x86')](_0x19f262,0x16,_0xb2da('0x8c'));rpcDb[_0xb2da('0x8a')](_0x19f262,'[HistoryRecallClose]');rpcDb[_0xb2da('0x8d')](_0x19f262,_0xb2da('0x8e'));}}}}})[_0xb2da('0x8f')](ut['logger2'](_0xb2da('0x90')));};Preview[_0xb2da('0xc')][_0xb2da('0x65')]=function(_0x5826fb){_0x5826fb[_0xb2da('0x5b')]=!![];if(ut[_0xb2da('0x91')](_0x5826fb['loggedIn'])){_0x5826fb['message']='AGENTS_NOT_LOGGED';}else if(!ut[_0xb2da('0x92')](_0x5826fb['dialActive'])){_0x5826fb[_0xb2da('0x4c')]='NOT_ACTIVE';}else if(!this[_0xb2da('0x93')](_0x5826fb[_0xb2da('0x52')])){if(!this[_0xb2da('0x93')](_0x5826fb[_0xb2da('0x94')])){_0x5826fb[_0xb2da('0x4c')]=_0xb2da('0x95');}else{_0x5826fb[_0xb2da('0x4c')]=_0xb2da('0x96');}}else{_0x5826fb['message']=_0xb2da('0x96');}emitCampaignPreview(_0x5826fb);};Preview['prototype'][_0xb2da('0x97')]=function(_0x126e5d,_0x48395d,_0x1d9426){var _0x18e417=this;var _0x3f3702=this[_0xb2da('0x14')][_0x48395d];var _0x31a365=this[_0xb2da('0x11')][_0x3f3702['queue']];var _0xff655b;if(_0x31a365){switch(_0x1d9426){case'1':_0x31a365[_0xb2da('0x3e')]+=0x1;_0x3f3702[_0xb2da('0x98')]+=0x1;_0x3f3702[_0xb2da('0x99')]=ut['totalGlobal'](_0x3f3702);ut[_0xb2da('0x86')](_0x3f3702,0x0,_0xb2da('0x9a'));ami['emit'](_0xb2da('0x9b'),ut[_0xb2da('0x9c')](_0x3f3702,_0xb2da('0x9d')));rpcDb[_0xb2da('0x8a')](_0x3f3702,_0xb2da('0x9e'));if(ut['totalGlobal'](_0x3f3702)>=_0x31a365[_0xb2da('0x9f')]){_0xff655b=ut['cloneAction'](_0x3f3702,0xf,'Global');rpcDb[_0xb2da('0x8d')](_0xff655b,_0xb2da('0xa0'));}else{if(_0x3f3702[_0xb2da('0x98')]>=_0x31a365[_0xb2da('0xa1')]){rpcDb[_0xb2da('0x8d')](_0x3f3702,_0xb2da('0xa0'));}else{rpcDb[_0xb2da('0xa2')](ut[_0xb2da('0xa3')](_0x3f3702,'countnosuchnumberretry',_0x31a365[_0xb2da('0xa4')]),_0x3f3702['unlockAgent'],_0x3f3702[_0xb2da('0xa5')]);}}delete this[_0xb2da('0x14')][_0x126e5d[_0xb2da('0xa6')]];break;case _0xb2da('0xa7'):var _0x2f95b1=moment()[_0xb2da('0x5a')](_0xb2da('0x85'));_0x3f3702['responsetime']=_0x2f95b1;_0x3f3702[_0xb2da('0xa8')]=_0x2f95b1;_0x3f3702[_0xb2da('0x6c')]=!![];_0x31a365[_0xb2da('0x29')]+=0x1;logger[_0xb2da('0x57')](_0xb2da('0xa9'),_0x3f3702[_0xb2da('0xaa')],_0xb2da('0xab'),_0x31a365['name'],_0xb2da('0x6b'),_0x31a365[_0xb2da('0x29')]);ami[_0xb2da('0x23')](_0xb2da('0xac'),ut['buildObj'](_0x3f3702,'connect',this[_0xb2da('0x11')][_0x3f3702['queue']]));if(_0x31a365[_0xb2da('0xad')]){ami[_0xb2da('0x23')](_0xb2da('0xae'),ut['buildAcw'](_0x3f3702));}break;case'16':ami[_0xb2da('0x23')](_0xb2da('0xaf'),ut[_0xb2da('0x9c')](_0x3f3702,_0xb2da('0xb0'),this['campaignsPreview'][_0x3f3702[_0xb2da('0x69')]]));emitVoiceQueueChannelRemove(ut[_0xb2da('0x9c')](_0x3f3702,'complete'));_0x31a365['outboundAnswerCallsDay']+=0x1;_0x31a365[_0xb2da('0x2d')]+=0x1;_0x31a365[_0xb2da('0xb1')]+=0x1;ut[_0xb2da('0x74')](_0x31a365,_0xb2da('0xb2'));_0x3f3702['countglobal']=ut[_0xb2da('0xb3')](_0x3f3702);ut[_0xb2da('0x86')](_0x3f3702,0x4,'Answer');rpcDb['createCustomerHistory'](_0x3f3702,_0xb2da('0xb4'));rpcDb[_0xb2da('0x8d')](_0x3f3702,_0xb2da('0xb5'));rpcDb[_0xb2da('0xb6')](_0x3f3702);_0x31a365[_0xb2da('0x2b')]+=_0x3f3702[_0xb2da('0xb7')];_0x31a365[_0xb2da('0x2a')]+=_0x3f3702[_0xb2da('0xb7')];logger[_0xb2da('0x57')]('[syncHangup][talking][decrement]',_0x3f3702[_0xb2da('0xaa')],_0xb2da('0xab'),_0x31a365[_0xb2da('0x25')],_0xb2da('0x6b'),_0x31a365['pTalking']);delete this[_0xb2da('0x14')][_0x126e5d['linkedid']];break;case _0xb2da('0xb8'):_0x31a365['outboundBusyCallsDay']+=0x1;_0x3f3702['countbusyretry']+=0x1;_0x3f3702[_0xb2da('0x99')]=ut[_0xb2da('0xb3')](_0x3f3702);ut[_0xb2da('0x86')](_0x3f3702,0x5,_0xb2da('0xb9'));ami[_0xb2da('0x23')](_0xb2da('0xba'),ut[_0xb2da('0x9c')](_0x3f3702,_0xb2da('0xbb')));rpcDb['createCustomerHistory'](_0x3f3702,_0xb2da('0xbc'));if(ut[_0xb2da('0xb3')](_0x3f3702)>=_0x31a365['dialGlobalMaxRetry']){_0xff655b=ut[_0xb2da('0xbd')](_0x3f3702,0xf,'Global');rpcDb[_0xb2da('0x8d')](_0xff655b,_0xb2da('0xbe'));}else{if(_0x3f3702[_0xb2da('0xbf')]>=_0x31a365[_0xb2da('0xc0')]){rpcDb[_0xb2da('0x8d')](_0x3f3702,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xb2da('0xa2')](ut[_0xb2da('0xa3')](_0x3f3702,_0xb2da('0xbf'),_0x31a365[_0xb2da('0xc1')]),_0x3f3702['unlockAgent'],_0x3f3702[_0xb2da('0xa5')]);}}break;case _0xb2da('0xc2'):_0x31a365[_0xb2da('0x3d')]+=0x1;_0x3f3702[_0xb2da('0xc3')]+=0x1;_0x3f3702[_0xb2da('0x99')]=ut[_0xb2da('0xb3')](_0x3f3702);ut[_0xb2da('0x86')](_0x3f3702,0x3,_0xb2da('0xc4'));ami[_0xb2da('0x23')](_0xb2da('0xc5'),ut[_0xb2da('0x9c')](_0x3f3702,'noanswer'));rpcDb[_0xb2da('0x8a')](_0x3f3702,_0xb2da('0xc6'));if(ut[_0xb2da('0xb3')](_0x3f3702)>=_0x31a365[_0xb2da('0x9f')]){_0xff655b=ut[_0xb2da('0xbd')](_0x3f3702,0xf,_0xb2da('0xc7'));rpcDb[_0xb2da('0x8d')](_0xff655b,_0xb2da('0xc8'));}else{if(_0x3f3702[_0xb2da('0xc3')]>=_0x31a365[_0xb2da('0xc9')]){rpcDb[_0xb2da('0x8d')](_0x3f3702,_0xb2da('0xc6'));}else{rpcDb[_0xb2da('0xa2')](ut['scheduledAt'](_0x3f3702,_0xb2da('0xc3'),_0x31a365[_0xb2da('0xca')]),_0x3f3702[_0xb2da('0xcb')],_0x3f3702[_0xb2da('0xa5')]);}}break;case'CONGESTION':_0x31a365[_0xb2da('0xcc')]+=0x1;_0x3f3702['countcongestionretry']+=0x1;_0x3f3702[_0xb2da('0x99')]=ut[_0xb2da('0xb3')](_0x3f3702);ut[_0xb2da('0x86')](_0x3f3702,0x8,'Congestion');ami[_0xb2da('0x23')]('custom:agentcongestion',ut[_0xb2da('0x9c')](_0x3f3702,_0xb2da('0xcd')));rpcDb['createCustomerHistory'](_0x3f3702,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0xb2da('0xb3')](_0x3f3702)>=_0x31a365[_0xb2da('0x9f')]){_0xff655b=ut[_0xb2da('0xbd')](_0x3f3702,0xf,_0xb2da('0xc7'));rpcDb[_0xb2da('0x8d')](_0xff655b,_0xb2da('0xce'));}else{if(_0x3f3702[_0xb2da('0xcf')]>=_0x31a365[_0xb2da('0xd0')]){rpcDb[_0xb2da('0x8d')](_0x3f3702,_0xb2da('0xd1'));}else{rpcDb[_0xb2da('0xa2')](ut[_0xb2da('0xa3')](_0x3f3702,_0xb2da('0xcf'),_0x31a365[_0xb2da('0xc1')]),_0x3f3702[_0xb2da('0xcb')],_0x3f3702[_0xb2da('0xa5')]);}}break;case _0xb2da('0xd2'):_0x31a365[_0xb2da('0x41')]+=0x1;_0x3f3702[_0xb2da('0xd3')]+=0x1;_0x3f3702[_0xb2da('0x99')]=ut[_0xb2da('0xb3')](_0x3f3702);ut[_0xb2da('0x86')](_0x3f3702,0x14,_0xb2da('0xd4'));ami['emit']('custom:agentreject',ut[_0xb2da('0x9c')](_0x3f3702,_0xb2da('0xd5')));rpcDb[_0xb2da('0x8a')](_0x3f3702,_0xb2da('0xd6'));if(ut[_0xb2da('0xb3')](_0x3f3702)>=_0x31a365['dialGlobalMaxRetry']){_0xff655b=ut[_0xb2da('0xbd')](_0x3f3702,0x14,_0xb2da('0xd4'));rpcDb['createCustomerFinal'](_0xff655b,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x3f3702[_0xb2da('0xd3')]>=_0x31a365[_0xb2da('0xd7')]){rpcDb[_0xb2da('0x8d')](_0x3f3702,_0xb2da('0xd8'));}else{rpcDb[_0xb2da('0xa2')](ut[_0xb2da('0xa3')](_0x3f3702,'countagentrejectretry',_0x31a365[_0xb2da('0xd9')]),_0x3f3702[_0xb2da('0xcb')],_0x3f3702[_0xb2da('0xa5')]);}}break;case _0xb2da('0xda'):_0x31a365[_0xb2da('0x43')]+=0x1;_0x3f3702[_0xb2da('0xdb')]+=0x1;_0x3f3702[_0xb2da('0x99')]=ut[_0xb2da('0xb3')](_0x3f3702);ut['logCustomer'](_0x3f3702,0xb,'Abandoned');rpcDb[_0xb2da('0x8a')](_0x3f3702,_0xb2da('0xdc'));if(ut['totalGlobal'](_0x3f3702)>=_0x31a365[_0xb2da('0x9f')]){_0xff655b=ut[_0xb2da('0xbd')](_0x3f3702,0xf,_0xb2da('0xc7'));rpcDb[_0xb2da('0x8d')](_0xff655b,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x3f3702[_0xb2da('0xdd')]>=_0x31a365[_0xb2da('0xde')]){rpcDb[_0xb2da('0x8d')](_0x3f3702,_0xb2da('0xdc'));}else{rpcDb[_0xb2da('0xa2')](ut['scheduledAt'](_0x3f3702,_0xb2da('0xdb'),_0x31a365['dialAbandonedRetryFrequency']),_0x3f3702[_0xb2da('0xcb')],_0x3f3702[_0xb2da('0xa5')]);}}break;case'18':_0x31a365['outboundUnknownCallsDay']+=0x1;_0x3f3702['countmachineretry']+=0x1;_0x3f3702[_0xb2da('0x99')]=ut['totalGlobal'](_0x3f3702);ut[_0xb2da('0x86')](_0x3f3702,0x12,_0x126e5d[_0xb2da('0xdf')]||_0x126e5d[_0xb2da('0xe0')]);ami['emit']('custom:amd',ut['buildObj'](_0x3f3702,_0xb2da('0xe1')));rpcDb[_0xb2da('0x8a')](_0x3f3702,'[callProgressDetectingCustomer][hangupInAMD]');if(ut['totalGlobal'](_0x3f3702)>=_0x31a365[_0xb2da('0x9f')]){_0xff655b=ut[_0xb2da('0xbd')](_0x3f3702,0xf,'Global');rpcDb['createCustomerFinal'](_0xff655b,_0xb2da('0xe2'));}else{rpcDb[_0xb2da('0x8d')](_0x3f3702,'[callProgressDetectingCustomer][hangupInAMD]');}delete this['actions'][_0x126e5d[_0xb2da('0xa6')]];break;case'19':_0x31a365['outboundUnknownCallsDay']+=0x1;_0x3f3702[_0xb2da('0x99')]=ut['totalGlobal'](_0x3f3702);ut[_0xb2da('0x86')](_0x3f3702,0x13,_0x126e5d['cause-txt']||_0x126e5d[_0xb2da('0xe0')]);ami[_0xb2da('0x23')]('custom:amd',ut[_0xb2da('0x9c')](_0x3f3702,_0xb2da('0xe1')));rpcDb[_0xb2da('0x8a')](_0x3f3702,_0xb2da('0xe3'));if(ut['totalGlobal'](_0x3f3702)>=_0x31a365[_0xb2da('0x9f')]){_0xff655b=ut[_0xb2da('0xbd')](_0x3f3702,0xf,_0xb2da('0xc7'));rpcDb[_0xb2da('0x8d')](_0xff655b,_0xb2da('0xe3'));}else{rpcDb[_0xb2da('0x8d')](_0x3f3702,_0xb2da('0xe3'));}delete this[_0xb2da('0x14')][_0x126e5d[_0xb2da('0xa6')]];break;default:if(_0x3f3702['dialAnswer']){ut['decrementTalkink'](_0x31a365,_0xb2da('0xe4'));ut[_0xb2da('0x76')](_0xb2da('0xe5')+_0x31a365[_0xb2da('0x25')],_0x126e5d);}_0x31a365['outboundUnknownCallsDay']+=0x1;_0x3f3702['countglobal']=ut['totalGlobal'](_0x3f3702);ut[_0xb2da('0x86')](_0x3f3702,0xc,_0x126e5d[_0xb2da('0xdf')]||_0x126e5d[_0xb2da('0xe0')]);rpcDb[_0xb2da('0x8a')](_0x3f3702,_0xb2da('0xe6'));if(ut['totalGlobal'](_0x3f3702)>=_0x31a365[_0xb2da('0x9f')]){_0xff655b=ut[_0xb2da('0xbd')](_0x3f3702,0xf,_0xb2da('0xc7'));rpcDb['createCustomerFinal'](_0xff655b,_0xb2da('0xe7'));}else{rpcDb[_0xb2da('0x8d')](_0x3f3702,_0xb2da('0xe7'));}delete this[_0xb2da('0x14')][_0x126e5d['linkedid']];}if(!(_0x3f3702[_0xb2da('0x6c')]&&_0x1d9426==='16')){ut[_0xb2da('0xe8')](_0x31a365,_0xb2da('0xe9'));logger[_0xb2da('0x57')]('[originated][decrement][callProgressDetectingCustomer]',_0x3f3702[_0xb2da('0xaa')],'\x20Queue',_0x31a365[_0xb2da('0x25')],'originated:\x20',_0x31a365[_0xb2da('0x5c')]);}if(_0x1d9426!=='ANSWER'){delete this[_0xb2da('0x14')][_0x126e5d['linkedid']];delete this[_0xb2da('0x14')][_0x126e5d['destlinkedid']];}}};Preview[_0xb2da('0xc')]['callProgressDetectingAgent']=function(_0x41084a,_0x158cc7,_0x24486d){if(_[_0xb2da('0xea')](_0x158cc7)&&'object'!==typeof _0x158cc7){return;}if(_[_0xb2da('0xea')](_0x24486d)&&_0xb2da('0xeb')!==typeof _0x24486d){return;}switch(_0x24486d[_0xb2da('0xec')]){case'0':ut[_0xb2da('0xed')](_0x41084a,0x0,_0xb2da('0x9a'));rpcDb['createAgentHistory'](_0x41084a,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0xb2da('0xed')](_0x41084a,0x3,_0xb2da('0xc4'));rpcDb[_0xb2da('0xee')](_0x41084a,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut['logAgent'](_0x41084a,0x5,'Busy');rpcDb['createAgentHistory'](_0x41084a,_0xb2da('0xef'));break;case'8':ut[_0xb2da('0xed')](_0x41084a,0x8,_0xb2da('0xf0'));rpcDb[_0xb2da('0xee')](_0x41084a,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0xb2da('0xed')](_0x41084a,0x16,_0xb2da('0xf1'));rpcDb[_0xb2da('0xee')](_0x41084a,_0xb2da('0xf2'));break;default:ut[_0xb2da('0xed')](_0x41084a,0xc,_0x24486d['reason']);rpcDb[_0xb2da('0xee')](_0x41084a,_0xb2da('0xf3'));}ut['updateOriginated'](_0x158cc7,'[callProgressDetectingAgent]');logger[_0xb2da('0x57')]('[originated][decrement][callProgressDetectingAgent]',_0x41084a[_0xb2da('0xaa')],_0xb2da('0xab'),_0x158cc7[_0xb2da('0x25')],'originated:\x20',_0x158cc7[_0xb2da('0x5c')]);delete this[_0xb2da('0x14')][_0x41084a['uniqueid']];};Preview[_0xb2da('0xc')]['checkInBlack']=function(_0x13b7fa,_0x3d6b2f,_0x25ae96,_0x2c727f,_0x4253d0){var _0x139979=this;return new BPromise(function(_0x3f6032,_0x2db7df){if(_[_0xb2da('0x67')](_0x3d6b2f)||_['isNil'](_0x3d6b2f['Contact'])||_[_0xb2da('0x67')](_0x3d6b2f['Contact']['phone'])||_[_0xb2da('0x67')](_0x3d6b2f[_0xb2da('0xf4')])){_0x2db7df(ut['message'](_0xb2da('0xf5'),_0x2c727f,_0x4253d0));return;}var _0x39f361=uuid['v4']();var _0x704a69=_0x139979[_0xb2da('0x11')][_0x3d6b2f['Queue'][_0xb2da('0x25')]];var _0x5b2075=_0x25ae96?_0x139979[_0xb2da('0x15')][_0x25ae96]['id']:undefined;_0x139979[_0xb2da('0x14')][_0x39f361]=new Action(_0x3d6b2f,_0x704a69,_0x39f361,_0x25ae96,_0x5b2075);var _0x1c42fa=_0x139979[_0xb2da('0x14')][_0x39f361];_0x1c42fa[_0xb2da('0xcb')]=_0x2c727f;_0x1c42fa[_0xb2da('0xa5')]=_0x4253d0;_0x1c42fa[_0xb2da('0xf6')]=_0x25ae96;if(_[_0xb2da('0xf7')](_0x13b7fa)){_0x139979[_0xb2da('0xf8')](_0x1c42fa,_0x704a69,_0x3d6b2f,_0x25ae96)[_0xb2da('0x81')](function(_0x56ca47){logger[_0xb2da('0x57')](_0xb2da('0xf9'),_0xb2da('0xfa')+_0x1c42fa[_0xb2da('0x69')]+_0xb2da('0xfb')+_0x1c42fa['idContact'],JSON[_0xb2da('0x59')](_0x56ca47));ami[_0xb2da('0x23')]('custom:agentcalled',ut[_0xb2da('0x9c')](_0x1c42fa,'called',_0x139979[_0xb2da('0x11')][_0x1c42fa['queue']]));_0x3f6032(ut['message'](_0xb2da('0xfc')));})[_0xb2da('0x8f')](function(_0x499663){ut[_0xb2da('0x5e')](_0xb2da('0xfd'),_0x499663);_0x2db7df(ut[_0xb2da('0x4c')](_0xb2da('0xfe'),_0x2c727f,_0x4253d0));});}else{_0x704a69[_0xb2da('0x38')]+=0x1;ut['logBlacklist'](_0x1c42fa);rpcDb[_0xb2da('0xff')](_0x1c42fa,_0xb2da('0x100'));delete _0x139979['actions'][_0x39f361];_0x2db7df(ut[_0xb2da('0x4c')](_0xb2da('0x101'),_0x2c727f,_0x4253d0));}});};Preview['prototype'][_0xb2da('0x93')]=function(_0x3cf60f){return!_[_0xb2da('0x67')](_0x3cf60f)&&!_[_0xb2da('0x67')](_0x3cf60f[_0xb2da('0x25')])&&!_[_0xb2da('0x67')](_0x3cf60f['active'])&&_0x3cf60f[_0xb2da('0x53')]&&!_[_0xb2da('0x67')](this[_0xb2da('0x13')][util[_0xb2da('0x5a')](_0xb2da('0x102'),_0x3cf60f[_0xb2da('0x25')])])&&!_[_0xb2da('0x67')](this[_0xb2da('0x13')][util[_0xb2da('0x5a')](_0xb2da('0x102'),_0x3cf60f['name'])][_0xb2da('0x71')])&&(this['trunks'][util[_0xb2da('0x5a')](_0xb2da('0x102'),_0x3cf60f[_0xb2da('0x25')])][_0xb2da('0x71')]==='reachable'||this[_0xb2da('0x13')][util[_0xb2da('0x5a')](_0xb2da('0x102'),_0x3cf60f[_0xb2da('0x25')])]['status']==='unmonitored');};Preview[_0xb2da('0xc')][_0xb2da('0x103')]=function(_0x553cd2,_0x41c027){var _0x351502=this;return new BPromise(function(_0x3f2e9c,_0x4cf1f6){_0x351502[_0xb2da('0x104')](_0x553cd2,_0x41c027)['then'](function(_0x42fac5){_0x3f2e9c(_['pick'](_0x42fac5,['message']));})['catch'](function(_0x233b8d){if(_0x233b8d['unlock']){rpcDb[_0xb2da('0x105')](_0x553cd2);}if(_0x233b8d[_0xb2da('0x53')]){rpcDb[_0xb2da('0x83')](_0x553cd2);}_0x4cf1f6(_['pick'](_0x233b8d,[_0xb2da('0x4c')]));});});};Preview[_0xb2da('0xc')][_0xb2da('0x104')]=function(_0x3591fc,_0xf93a85){var _0x580a6a=this;return new BPromise(function(_0x268fd6,_0x3ae513){var _0x368f13,_0x54098b;rpcDb[_0xb2da('0x106')](_0x3591fc)[_0xb2da('0x81')](function(_0x38f8b1){if(!_[_0xb2da('0x67')](_0x38f8b1[0x0])){_0x54098b=_0x38f8b1[0x0]['recallme']?![]:!![];_0x368f13=_0x38f8b1[0x0]['recallme']?!![]:![];_0x368f13=_0xf93a85?!![]:_0x368f13;}var _0x53f037=_0x580a6a[_0xb2da('0x107')](_0x38f8b1);if(_0x53f037[_0xb2da('0x108')]){rpcDb[_0xb2da('0x109')](_[_0xb2da('0x6d')](_0x38f8b1[0x0],[_0xb2da('0xf4'),'Contact.phone']))[_0xb2da('0x81')](function(_0x1a47cc){_0x580a6a[_0xb2da('0x10a')](_0x1a47cc,_0x38f8b1[0x0],_0xf93a85,_0x54098b,_0x368f13)[_0xb2da('0x81')](function(_0x11a33e){_0x268fd6(_0x11a33e);})[_0xb2da('0x8f')](function(_0xf737eb){_0x3ae513(_0xf737eb);});})[_0xb2da('0x8f')](function(_0x6f3345){ut[_0xb2da('0x5e')](_0xb2da('0x10b'),_0x6f3345);_0x3ae513(ut['message']('Call\x20unsuccessful',_0x54098b,_0x368f13));});}else{_0x3ae513(ut[_0xb2da('0x4c')](_0x53f037[_0xb2da('0x4c')],_0x54098b,_0x368f13));}})['catch'](function(_0x5cd7cb){ut['logger']('[Preview][getContactPreview]',_0x5cd7cb);_0x3ae513(ut['message'](_0xb2da('0x10c'),![],!![]));});});};Preview['prototype'][_0xb2da('0x107')]=function(_0x2c690e){if(_[_0xb2da('0x67')](_0x2c690e)||_[_0xb2da('0xf7')](_0x2c690e)||!_[_0xb2da('0x67')](_0x2c690e[0x0][_0xb2da('0x7f')])&&_[_0xb2da('0x67')](_0x2c690e[0x0][_0xb2da('0x7f')]['name'])){ut[_0xb2da('0x5e')](_0xb2da('0x10d'),_0x2c690e);return{'isValid':![],'message':_0xb2da('0x10e')};}var _0x5cdb45=this[_0xb2da('0x11')][_0x2c690e[0x0][_0xb2da('0x68')]['name']];_0x5cdb45['message']=_0xb2da('0x96');if(_[_0xb2da('0x67')](_0x5cdb45)){ut[_0xb2da('0x5e')](_0xb2da('0x10f'),_0x5cdb45);return{'isValid':![],'message':_0xb2da('0x110')};}if(!this[_0xb2da('0x93')](_0x5cdb45[_0xb2da('0x52')])){ut[_0xb2da('0x5e')]('[Preview][validateContact][Trunk\x20not\x20work]',_0xb2da('0x111')+_0x5cdb45[_0xb2da('0x25')]+_0xb2da('0x112'));if(!this[_0xb2da('0x93')](_0x5cdb45['TrunkBackup'])){ut['logger'](_0xb2da('0x113'),_0x5cdb45[_0xb2da('0x25')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xb2da('0x114')};}}if(!ut['isActive'](_0x5cdb45[_0xb2da('0x32')])){ut[_0xb2da('0x5e')](_0xb2da('0x115'),_0x5cdb45[_0xb2da('0x25')]+_0xb2da('0x116'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x5cdb45[_0xb2da('0x25')]+_0xb2da('0x116')};}return{'isValid':!![],'message':_0xb2da('0x117')};};Preview['prototype'][_0xb2da('0xf8')]=function(_0x3db6ad,_0x313351,_0x6d942d,_0x2032f7){var _0x4c1c4c=this;return new BPromise(function(_0x191a06,_0x128753){var _0x5f5113=_0x3db6ad[_0xb2da('0xaa')];var _0x2589c4=_0x4c1c4c[_0xb2da('0x93')](_0x313351[_0xb2da('0x52')])?util['format'](_0xb2da('0x118'),_0x313351[_0xb2da('0x52')]['name'],_[_0xb2da('0x67')](_0x313351[_0xb2da('0x35')])?'':_0x313351[_0xb2da('0x35')][_0xb2da('0x119')]()||'',_0x313351[_0xb2da('0x11a')]>0x0?_0x6d942d[_0xb2da('0x11b')][_0xb2da('0x11c')][_0xb2da('0x11d')](_0x313351[_0xb2da('0x11a')]):_0x6d942d['Contact'][_0xb2da('0x11c')]):util[_0xb2da('0x5a')](_0xb2da('0x118'),_[_0xb2da('0x67')](_0x313351[_0xb2da('0x94')])?_0x313351[_0xb2da('0x52')][_0xb2da('0x25')]:_0x313351[_0xb2da('0x94')][_0xb2da('0x25')],_[_0xb2da('0x67')](_0x313351[_0xb2da('0x35')])?'':_0x313351[_0xb2da('0x35')][_0xb2da('0x119')]()||'',_0x313351[_0xb2da('0x11a')]>0x0?_0x6d942d[_0xb2da('0x11b')]['phone']['substring'](_0x313351[_0xb2da('0x11a')]):_0x6d942d[_0xb2da('0x11b')]['phone']);var _0x48b82=_0x4c1c4c[_0xb2da('0x93')](_0x313351[_0xb2da('0x52')])?ut[_0xb2da('0x11e')](_0x313351[_0xb2da('0x52')][_0xb2da('0x11f')],_0x313351[_0xb2da('0x33')],_0x313351['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xb2da('0x120')](_0x313351['dialOriginateCallerIdNumber'],_0x313351['dialRandomLastDigitCallerIdNumber']):_0x313351['dialOriginateCallerIdNumber']):ut[_0xb2da('0x11e')](_[_0xb2da('0x67')](_0x313351['TrunkBackup'])?_0x313351[_0xb2da('0x52')][_0xb2da('0x11f')]:_0x313351[_0xb2da('0x94')]['callerid'],_0x313351[_0xb2da('0x33')],_0x313351[_0xb2da('0x121')]>0x0?ut[_0xb2da('0x120')](_0x313351[_0xb2da('0x122')],_0x313351[_0xb2da('0x121')]):_0x313351['dialOriginateCallerIdNumber']);if(_0x48b82){_0x3db6ad[_0xb2da('0x123')]=ut[_0xb2da('0x124')](_0x48b82);_0x3db6ad[_0xb2da('0x125')]=ut[_0xb2da('0x126')](_0x48b82);}var _0x25fec3=ut[_0xb2da('0x127')](_0x313351,_0x6d942d,_0x2589c4,_0x48b82,_0x5f5113,_0x3db6ad);_['merge'](_0x3db6ad,ut[_0xb2da('0x128')](_0x25fec3));_0x3db6ad['starttime']=moment()['format'](_0xb2da('0x85'));ami[_0xb2da('0x70')](ut[_0xb2da('0x129')](_0x3db6ad,_0x313351,_0x25fec3,_0x3db6ad[_0xb2da('0xa5')],_0x2032f7))[_0xb2da('0x81')](function(_0x11a138){var _0x4dd487=_0x3db6ad['channelAgent'];if(!_['isNil'](_0x4dd487)){if(!_[_0xb2da('0x67')](_0x4c1c4c[_0xb2da('0x15')][_0x4dd487])){_0x4c1c4c[_0xb2da('0x15')][_0x4dd487]['destconnectedlinenum']=_0x3db6ad['calleridnum'];emit(util['format'](_0xb2da('0x12a'),_0x4c1c4c[_0xb2da('0x15')][_0x4dd487][_0xb2da('0x25')]),_0xb2da('0x12b'),{'destaccountcode':_0x4c1c4c[_0xb2da('0x15')][_0x4dd487][_0xb2da('0x12c')],'destconnectedlinenum':_0x3db6ad[_0xb2da('0x12d')]});}}_0x313351[_0xb2da('0x5c')]+=0x1;logger[_0xb2da('0x57')](_0xb2da('0x12e'),_0x5f5113,'\x20Queue',_0x313351['name'],_0xb2da('0x6a'),_0x313351['originated']);_0x191a06(_0x11a138);})[_0xb2da('0x8f')](function(_0x294dc7){ut[_0xb2da('0xed')](_0x3db6ad,0xe,_0xb2da('0x12f'));rpcDb[_0xb2da('0xee')](_0x3db6ad,_0xb2da('0x130'));_0x128753(_0x294dc7);});});};Preview['prototype'][_0xb2da('0x1e')]=function(_0x24509c){if(this[_0xb2da('0x14')][_0x24509c[_0xb2da('0xa6')]]){this[_0xb2da('0x14')][_0x24509c[_0xb2da('0xa6')]]['channel']=_0x24509c[_0xb2da('0x72')];}};Preview['prototype']['syncOriginateResponse']=function(_0x58dae2){var _0x12ffb0=this;var _0x178983=this[_0xb2da('0x14')][_0x58dae2['actionid']];if(_0x178983){if(_0x178983[_0xb2da('0xf6')]&&this[_0xb2da('0x15')][_0x178983['lookAgent']]){ut[_0xb2da('0x131')](_0x178983,this[_0xb2da('0x15')][_0x178983[_0xb2da('0xf6')]][_0xb2da('0x25')],this[_0xb2da('0x15')][_0x178983[_0xb2da('0xf6')]]['id']);}var _0x641927=_[_0xb2da('0x132')](_0x178983);_0x641927['responsetime']=moment()['format'](_0xb2da('0x85'));var _0x5e2310=_0x12ffb0[_0xb2da('0x11')][_0x178983['queue']];if(ut[_0xb2da('0x133')](_0x58dae2[_0xb2da('0x134')])){if(_0x178983[_0xb2da('0xcb')]){rpcDb[_0xb2da('0x105')](_0x178983[_0xb2da('0x135')]);}if(_0x178983[_0xb2da('0xa5')]){rpcDb[_0xb2da('0x83')](_0x178983[_0xb2da('0x135')]);}ami[_0xb2da('0x23')]('custom:agentringnoanswer',ut[_0xb2da('0x9c')](_0x178983,_0xb2da('0x136'),this['campaignsPreview'][_0x178983['queue']]));this[_0xb2da('0x137')](_0x641927,_0x5e2310,_0x58dae2);}else{_0x178983['starttime']=moment()[_0xb2da('0x5a')](_0xb2da('0x85'));ut[_0xb2da('0xed')](_0x641927,0x4,_0xb2da('0x138'));rpcDb[_0xb2da('0xee')](_0x641927,_0xb2da('0x139'));}}};Preview['prototype'][_0xb2da('0x1a')]=function(_0x3f0e5b){var _0xb844da=this;var _0x55ab20=this[_0xb2da('0x14')][_0x3f0e5b[_0xb2da('0xa6')]];var _0x2ef67b;if(_0x55ab20){_0x2ef67b=this[_0xb2da('0x11')][_0x55ab20[_0xb2da('0x69')]];logger[_0xb2da('0x57')](_0xb2da('0x13a'),_0x3f0e5b[_0xb2da('0xa6')],'\x20Queue',_0x2ef67b[_0xb2da('0x25')],_0xb2da('0x6b'),_0x2ef67b[_0xb2da('0x29')]);}if(this[_0xb2da('0x14')][_0x3f0e5b[_0xb2da('0xa6')]]&&_0x3f0e5b[_0xb2da('0xa6')]!==_0x3f0e5b['uniqueid']){if(_0x3f0e5b['cause']==='16'&&this[_0xb2da('0x14')][_0x3f0e5b[_0xb2da('0xa6')]][_0xb2da('0x6c')]){this['callProgressDetectingCustomer'](_0x3f0e5b,_0x3f0e5b[_0xb2da('0xa6')],_0x3f0e5b[_0xb2da('0x13b')]);}else if(this['actions'][_0x3f0e5b['linkedid']][_0xb2da('0x6c')]){logger[_0xb2da('0x57')]('[syncHangup][talking][cause]',_0x3f0e5b['linkedid'],_0x3f0e5b[_0xb2da('0x13b')],_0xb2da('0xab'),_0x2ef67b[_0xb2da('0x25')],_0xb2da('0x6b'),_0x2ef67b[_0xb2da('0x29')]);this[_0xb2da('0x97')](_0x3f0e5b,_0x3f0e5b['linkedid'],_0x3f0e5b['cause']);}}else if(_0x55ab20&&_[_0xb2da('0x67')](_0x55ab20[_0xb2da('0x13c')])&&_0x2ef67b[_0xb2da('0x13d')]&&_0x3f0e5b[_0xb2da('0xa6')]===_0x3f0e5b['uniqueid']&&_[_0xb2da('0x67')](_0x3f0e5b[_0xb2da('0xec')])&&_0x3f0e5b['cause']==='16'&&_0x3f0e5b[_0xb2da('0x13e')]==='6'&&_[_0xb2da('0xea')](_0x55ab20[_0xb2da('0x13f')])){if(_0x55ab20[_0xb2da('0xcb')]){rpcDb['unlockContact'](_0x55ab20[_0xb2da('0x135')]);}if(_0x55ab20[_0xb2da('0xa5')]){rpcDb[_0xb2da('0x83')](_0x55ab20[_0xb2da('0x135')]);}_0x3f0e5b[_0xb2da('0xec')]='22';this[_0xb2da('0x137')](_0x55ab20,_0x2ef67b,_0x3f0e5b);}else if(_0x55ab20&&_0x55ab20[_0xb2da('0x13f')]){if(_0x3f0e5b[_0xb2da('0x13b')]==='16'&&this[_0xb2da('0x14')][_0x3f0e5b['linkedid']]['dialAnswer']){logger[_0xb2da('0x57')](_0xb2da('0x140'),_0x3f0e5b[_0xb2da('0xa6')],_0x3f0e5b[_0xb2da('0x13b')],'\x20Queue',_0x2ef67b[_0xb2da('0x25')],_0xb2da('0x6b'),_0x2ef67b[_0xb2da('0x29')]);this[_0xb2da('0x97')](_0x3f0e5b,_0x3f0e5b[_0xb2da('0xa6')],_0x3f0e5b[_0xb2da('0x13b')]);}else if(this[_0xb2da('0x14')][_0x3f0e5b[_0xb2da('0xa6')]][_0xb2da('0x6c')]){logger['info']('[syncHangup][talking][cause]',_0x3f0e5b[_0xb2da('0xa6')],_0x3f0e5b[_0xb2da('0x13b')],'\x20Queue',_0x2ef67b['name'],'pTalking:\x20',_0x2ef67b[_0xb2da('0x29')]);this[_0xb2da('0x97')](_0x3f0e5b,_0x3f0e5b[_0xb2da('0xa6')],_0x3f0e5b['cause']);}}};Preview['prototype'][_0xb2da('0x1d')]=function(_0x79fefc){if(this['actions'][_0x79fefc[_0xb2da('0x141')]]&&_0x79fefc[_0xb2da('0x141')]!==_0x79fefc[_0xb2da('0x142')]){this[_0xb2da('0x97')](_0x79fefc,_0x79fefc['destlinkedid'],_0x79fefc[_0xb2da('0xe0')]);}};Preview[_0xb2da('0xc')][_0xb2da('0x1c')]=function(_0x303649){if(this[_0xb2da('0x14')][_0x303649[_0xb2da('0xa6')]]&&_0x303649[_0xb2da('0xa6')]!==_0x303649[_0xb2da('0xaa')]&&!this[_0xb2da('0x14')][_0x303649[_0xb2da('0xa6')]][_0xb2da('0x6c')]){if(_0x303649[_0xb2da('0x13b')]==='1'){this[_0xb2da('0x97')](_0x303649,_0x303649['linkedid'],_0x303649[_0xb2da('0x13b')]);}}};Preview[_0xb2da('0xc')][_0xb2da('0x143')]=function(_0x3a0429,_0x33644c,_0x420896){if(this['actions'][_0x3a0429]){if(_[_0xb2da('0x67')](this['actions'][_0x3a0429]['variables'])){this[_0xb2da('0x14')][_0x3a0429][_0xb2da('0x144')]={};}this[_0xb2da('0x14')][_0x3a0429][_0xb2da('0x144')][_0x33644c]=_0x420896;}};Preview['prototype'][_0xb2da('0x20')]=function(_0x45054b){try{if(!_[_0xb2da('0x67')](_0x45054b)){if(ut['filterKey'](_[_0xb2da('0x145')](_0x45054b['variable'])[0x0])){this[_0xb2da('0x143')](_0x45054b[_0xb2da('0xaa')],_[_0xb2da('0x145')](_0x45054b[_0xb2da('0x146')])[0x0],_0x45054b[_0xb2da('0x147')]);}}}catch(_0x5eaabe){logger[_0xb2da('0x148')](_0xb2da('0x149'),util[_0xb2da('0x14a')](_0x5eaabe,{'showHidden':![],'depth':null}));}};Preview[_0xb2da('0xc')][_0xb2da('0x14b')]=function(_0x26420c){if(_0x26420c){if(this[_0xb2da('0x14')][_0x26420c['transfertargetlinkedid']]){this['actions'][_0x26420c[_0xb2da('0x14c')]][_0xb2da('0x13f')]=!![];}}};Preview[_0xb2da('0xc')]['syncBlindTransfer']=function(_0x3fd698){if(_0x3fd698){if(this[_0xb2da('0x14')][_0x3fd698[_0xb2da('0x14d')]]){this[_0xb2da('0x14')][_0x3fd698[_0xb2da('0x14d')]][_0xb2da('0x13f')]=!![];}}};module[_0xb2da('0x14e')]=Preview; \ No newline at end of file +var _0x223e=['voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','pTalking','paused','\x20is\x20not\x20active','IS_DISACTIVED','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','outbound','clearZombieChannels','setMessage','clearZombieChannel','[clearZombieChannels][talking]','queue','originated:\x20','actions','pTalking:\x20','pick','contactId','UserId','VoiceQueueId','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','recallMe','getContactRecallMe','agentReadyId','then','isNil','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','NOT_ACTIVE','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','buildObj','connect','acw','custom:agentcomplete','complete','answered','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','uniqueid','BUSY','outboundBusyCallsDay','countbusyretry','Busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','countabandonedretry','dialAbandonedRetryFrequency','cause-txt','custom:amd','amd','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','destlinkedid','callProgressDetectingAgent','isUndefined','object','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','Contact','phone','Queue','lookAgent','isEmpty','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','idContact','custom:agentcalled','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','unlock','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','isActive','\x20Not\x20Active','Is\x20Valid','dialCutDigit','SIP/%s/%s%s','substring','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerId','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','channelAgent','calleridnum','user:%s','user:agentconnect','accountcode','[originated][increment]','[originateFailure][logOriginateFailure]','syncNewExten','logLookAgent','responsetime','isFailure','unlockContact','syncHangup','[syncHangup][talking]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','disableContact','destuniqueid','dialstatus','addVariable','variables','keys','variable','value','error','[syncVarSet][Preview]','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','util','lodash','uuid','moment','md5','ioredis','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','defaults','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','type','strategy','available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','active','callerid','Interval','name','stringify','format','voice:queue:%s'];(function(_0x38dca6,_0x471cb7){var _0x29bcd7=function(_0x174c5d){while(--_0x174c5d){_0x38dca6['push'](_0x38dca6['shift']());}};_0x29bcd7(++_0x471cb7);}(_0x223e,0x100));var _0xe223=function(_0x349367,_0x1cede2){_0x349367=_0x349367-0x0;var _0x14179b=_0x223e[_0x349367];return _0x14179b;};'use strict';var util=require(_0xe223('0x0'));var _=require(_0xe223('0x1'));var BPromise=require('bluebird');var uuid=require(_0xe223('0x2'));var moment=require(_0xe223('0x3'));var md5=require(_0xe223('0x4'));var Redis=require(_0xe223('0x5'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xe223('0x6'));var loggerAction=require(_0xe223('0x7'))(_0xe223('0x8'));var ami=require(_0xe223('0x9'));var rpcDb=require(_0xe223('0xa'));var Action=require(_0xe223('0xb'));var ut=require(_0xe223('0xc'));config['redis']=_[_0xe223('0xd')](config[_0xe223('0xe')],{'host':_0xe223('0xf'),'port':0x18eb});var io=require(_0xe223('0x10'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xe223('0x11')][_0xe223('0x12')]=function(_0x45799c){this['tail']=this[_0xe223('0x13')]?this[_0xe223('0x13')][_0xe223('0x14')](_0x45799c):_0x45799c();};function Preview(_0x36f062){this[_0xe223('0x15')]=new Sequence();this[_0xe223('0x16')]=_0x36f062[_0xe223('0x17')];this[_0xe223('0x18')]=_0x36f062['trunks'];this['actions']={};this[_0xe223('0x19')]=_0x36f062[_0xe223('0x19')];this[_0xe223('0x1a')]=0x0;ami['on'](_0xe223('0x1b'),this[_0xe223('0x1c')][_0xe223('0x1d')](this));ami['on'](_0xe223('0x1e'),this['syncHangup'][_0xe223('0x1d')](this));ami['on'](_0xe223('0x1f'),this[_0xe223('0x20')][_0xe223('0x1d')](this));ami['on'](_0xe223('0x21'),this[_0xe223('0x22')][_0xe223('0x1d')](this));ami['on'](_0xe223('0x23'),this['syncNewExten'][_0xe223('0x1d')](this));ami['on'](_0xe223('0x24'),this[_0xe223('0x25')][_0xe223('0x1d')](this));ami['on'](_0xe223('0x26'),this[_0xe223('0x27')][_0xe223('0x1d')](this));ami['on'](_0xe223('0x28'),this['syncBlindTransfer']['bind'](this));this[_0xe223('0x29')](this[_0xe223('0x16')]);}function emit(_0x2a90fe,_0x180c00,_0x263cb1){io['to'](_0x2a90fe)[_0xe223('0x2a')](_0x180c00,_0x263cb1);}function emitCampaignPreview(_0xb23031){if(_0xb23031[_0xe223('0x2b')]==='outbound'){var _0x2081fc={'id':_0xb23031['id'],'name':_0xb23031['name'],'strategy':_0xb23031[_0xe223('0x2c')],'answered':_0xb23031['answered'],'available':_0xb23031[_0xe223('0x2d')],'loggedIn':_0xb23031[_0xe223('0x2e')],'pTalking':_0xb23031['pTalking'],'sumBillable':_0xb23031[_0xe223('0x2f')],'sumDuration':_0xb23031[_0xe223('0x30')],'sumHoldTime':_0xb23031[_0xe223('0x31')]||0x0,'talking':_0xb23031[_0xe223('0x32')],'total':_0xb23031[_0xe223('0x33')],'type':_0xb23031[_0xe223('0x2b')],'unmanaged':_0xb23031['unmanaged'],'abandoned':_0xb23031[_0xe223('0x34')],'waiting':_0xb23031[_0xe223('0x35')],'loggedInDb':_0xb23031[_0xe223('0x36')],'dialActive':_0xb23031[_0xe223('0x37')],'dialMethod':_0xb23031[_0xe223('0x38')],'dialOriginateCallerIdName':_0xb23031['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0xb23031[_0xe223('0x39')],'dialOriginateTimeout':_0xb23031['dialOriginateTimeout'],'dialPrefix':_0xb23031[_0xe223('0x3a')],'outboundAnswerAgiCallsDay':_0xb23031[_0xe223('0x3b')],'outboundAnswerCallsDay':_0xb23031[_0xe223('0x3c')],'outboundBlacklistCallsDay':_0xb23031['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0xb23031['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0xb23031[_0xe223('0x3d')],'outboundDropCallsDayACS':_0xb23031['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0xb23031[_0xe223('0x3e')],'outboundDropCallsDayTimeout':_0xb23031['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0xb23031[_0xe223('0x3f')],'outboundNoSuchCallsDay':_0xb23031[_0xe223('0x40')],'outboundOriginateFailureCallsDay':_0xb23031[_0xe223('0x41')],'outboundReCallsDay':_0xb23031[_0xe223('0x42')],'outboundRejectCallsDay':_0xb23031[_0xe223('0x43')],'outboundUnknownCallsDay':_0xb23031[_0xe223('0x44')],'outboundAbandonedCallsDay':_0xb23031[_0xe223('0x45')],'predictiveIntervalAnsweredCalls':_0xb23031[_0xe223('0x46')],'predictiveIntervalAvgHoldtime':_0xb23031[_0xe223('0x47')],'predictiveIntervalAvgTalktime':_0xb23031['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0xb23031['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0xb23031['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0xb23031[_0xe223('0x48')],'predictiveIntervalErlangCallsDroppedCalls':_0xb23031[_0xe223('0x49')],'predictiveIntervalHitRate':_0xb23031[_0xe223('0x4a')],'predictiveIntervalMultiplicativeFactor':_0xb23031[_0xe223('0x4b')],'predictiveIntervalPauses':_0xb23031[_0xe223('0x4c')],'predictiveIntervalAvailable':_0xb23031[_0xe223('0x4d')],'predictiveIntervalTotalCalls':_0xb23031[_0xe223('0x4e')],'message':_0xb23031[_0xe223('0x4f')],'originated':_0xb23031[_0xe223('0x50')],'erlangCalls':_0xb23031['erlangCalls'],'erlangCallToSecond':_0xb23031[_0xe223('0x51')],'erlangAbandonmentRate':_0xb23031[_0xe223('0x52')],'erlangBusyFactor':_0xb23031['erlangBusyFactor'],'startPredictive':_0xb23031[_0xe223('0x53')],'startProgressive':_0xb23031[_0xe223('0x54')]};if(_0xb23031[_0xe223('0x55')]){_0x2081fc[_0xe223('0x55')]={'id':_0xb23031[_0xe223('0x55')]['id'],'name':_0xb23031[_0xe223('0x55')]['name'],'active':_0xb23031['Trunk'][_0xe223('0x56')],'callerid':_0xb23031[_0xe223('0x55')][_0xe223('0x57')]};}if(_0xb23031[_0xe223('0x58')]){_0x2081fc[_0xe223('0x58')]={'id':_0xb23031['Interval']['id'],'name':_0xb23031[_0xe223('0x58')][_0xe223('0x59')]};}var _0x130da2=md5(JSON[_0xe223('0x5a')](_0x2081fc));if(_0xb23031[_0xe223('0x4')]!==_0x130da2){_0xb23031[_0xe223('0x4')]=_0x130da2;emit(util[_0xe223('0x5b')](_0xe223('0x5c'),_0x2081fc[_0xe223('0x59')]),_0xe223('0x5d'),_0x2081fc);}}}function emitVoiceQueueChannelRemove(_0x31cd51){logger[_0xe223('0x5e')](_0xe223('0x5f'),JSON['stringify'](_0x31cd51));emit(util[_0xe223('0x5b')](_0xe223('0x5c'),_0x31cd51['name']),_0xe223('0x60'),_0x31cd51);io[_0xe223('0x2a')](_0xe223('0x61'),_0x31cd51);}function notSendMessagesQueue(_0x292189){if(_0x292189[_0xe223('0x62')]){if(_0x292189[_0xe223('0x50')]===0x0&&_0x292189[_0xe223('0x63')]===0x0){_0x292189['sendMessageOneNotActive']=![];_0x292189[_0xe223('0x2d')]=0x0;_0x292189[_0xe223('0x64')]=0x0;_0x292189[_0xe223('0x4f')]='NOT_ACTIVE';ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x292189[_0xe223('0x59')]+_0xe223('0x65'));}else{_0x292189[_0xe223('0x4f')]=_0xe223('0x66');ut[_0xe223('0x67')](_0xe223('0x68'),_0x292189['name']+_0xe223('0x69'));}emitCampaignPreview(_0x292189);}}Preview['prototype']['loopCampaigns']=function(){var _0x461dbf=this;setInterval(function(){_0x461dbf[_0xe223('0x6a')]();},0x7cf);};Preview[_0xe223('0x11')][_0xe223('0x6a')]=function(){var _0x2ce269=this[_0xe223('0x16')];this[_0xe223('0x1a')]+=0x1;for(var _0x5c3ac6 in _0x2ce269){if(_0x2ce269[_0xe223('0x6b')](_0x5c3ac6)&&(_0x2ce269[_0x5c3ac6][_0xe223('0x38')]==='preview'||_0x2ce269[_0x5c3ac6][_0xe223('0x38')]===_0xe223('0x6c'))&&_0x2ce269[_0x5c3ac6]['type']===_0xe223('0x6d')){if(this[_0xe223('0x1a')]>0x7){this[_0xe223('0x1a')]=0x0;this[_0xe223('0x6e')]();}}if(_0x2ce269[_0xe223('0x6b')](_0x5c3ac6)&&_0x2ce269[_0x5c3ac6][_0xe223('0x38')]===_0xe223('0x6')&&_0x2ce269[_0x5c3ac6][_0xe223('0x2b')]===_0xe223('0x6d')){if(_0x2ce269[_0x5c3ac6][_0xe223('0x37')]){this[_0xe223('0x6f')](_0x2ce269[_0x5c3ac6]);this['recallMe'](_0x2ce269[_0x5c3ac6]);}else{notSendMessagesQueue(_0x2ce269[_0x5c3ac6]);}}}};Preview[_0xe223('0x11')][_0xe223('0x70')]=function(_0x33e00c){var _0x65436f=this;this[_0xe223('0x15')]['enqueue'](function(){if(!_['isNil'](_0x65436f['actions'][_0x33e00c])){loggerAction['info'](_0xe223('0x71'),_0x33e00c,'Queue',_0x65436f['actions'][_0x33e00c][_0xe223('0x72')],_0xe223('0x73'),JSON[_0xe223('0x5a')](_0x65436f[_0xe223('0x16')][_0x65436f[_0xe223('0x74')][_0x33e00c][_0xe223('0x72')]][_0xe223('0x50')]),_0xe223('0x75'),JSON[_0xe223('0x5a')](_0x65436f['campaignsPreview'][_0x65436f[_0xe223('0x74')][_0x33e00c][_0xe223('0x72')]][_0xe223('0x63')]),JSON['stringify'](_0x65436f['actions'][_0x33e00c]['dialAnswer']),JSON['stringify'](_[_0xe223('0x76')](_0x65436f[_0xe223('0x74')][_0x33e00c],[_0xe223('0x77'),_0xe223('0x78'),_0xe223('0x79'),'ListId'])));return ami['Action']({'action':_0xe223('0x7a'),'channel':_0x65436f['actions'][_0x33e00c][_0xe223('0x7b')]})[_0xe223('0x7c')](function(_0x37758d){if(_0x37758d[_0xe223('0x4f')]===_0xe223('0x7d')){setTimeout(function(){if(_0x65436f[_0xe223('0x74')][_0x33e00c]){ut[_0xe223('0x7e')](_0x65436f[_0xe223('0x16')][_0x65436f[_0xe223('0x74')][_0x33e00c][_0xe223('0x72')]],_0xe223('0x7f'));if(_0x65436f[_0xe223('0x74')][_0x33e00c][_0xe223('0x80')]===!![]){ut[_0xe223('0x81')](_0x65436f['campaignsPreview'][_0x65436f['actions'][_0x33e00c][_0xe223('0x72')]],'[clearZombieChannel]');ut[_0xe223('0x82')](_0xe223('0x83')+_0x33e00c,_0x65436f['actions'][_0x33e00c][_0xe223('0x72')]);}ut['loggerError'](_0xe223('0x84')+_0x33e00c,_0x65436f[_0xe223('0x74')][_0x33e00c]['queue']);delete _0x65436f[_0xe223('0x74')][_0x33e00c];}},0x2328);}});}});};Preview[_0xe223('0x11')][_0xe223('0x6e')]=function(){var _0x250f32=this;loggerAction['info'](_0xe223('0x85'),_[_0xe223('0x86')](this[_0xe223('0x74')]));for(var _0x20fd5 in this[_0xe223('0x74')]){if(_0x250f32[_0xe223('0x74')][_0xe223('0x6b')](_0x20fd5)){_0x250f32[_0xe223('0x70')](_0x20fd5);}}};Preview['prototype'][_0xe223('0x87')]=function(_0x512cec){var _0x4dfc6e=this;rpcDb[_0xe223('0x88')](_0x512cec['id'],ut[_0xe223('0x89')](this[_0xe223('0x19')]))[_0xe223('0x8a')](function(_0x50ac0e){if(!_[_0xe223('0x8b')](_0x50ac0e)){for(var _0x41c245=0x0;_0x41c245<_0x50ac0e[_0xe223('0x8c')];_0x41c245+=0x1){if(ut[_0xe223('0x8d')](_0x50ac0e[_0x41c245][_0xe223('0x8e')])<_0x512cec[_0xe223('0x8f')]*0x3c){if(_0x50ac0e[_0x41c245][_0xe223('0x90')]&&!_0x50ac0e[_0x41c245]['Agent'][_0xe223('0x91')]){_0x4dfc6e[_0xe223('0x92')](_0x50ac0e[_0x41c245]['id'])[_0xe223('0x8a')](ut[_0xe223('0x93')]('[RecallMe]'))['catch'](ut[_0xe223('0x93')](_0xe223('0x94')));}else{rpcDb['disableContact'](_0x50ac0e[_0x41c245]['id']);}}else{var _0x56769c=new Action(_0x50ac0e[_0x41c245],_0x512cec);_0x56769c[_0xe223('0x95')]=moment()[_0xe223('0x5b')](_0xe223('0x96'));_0x512cec[_0xe223('0x42')]+=0x1;ut[_0xe223('0x97')](_0x56769c,0x17,_0xe223('0x98'));if(_0x512cec[_0xe223('0x99')]){rpcDb[_0xe223('0x9a')](ut[_0xe223('0x9b')](_0x50ac0e[_0x41c245]));rpcDb[_0xe223('0x9c')](_0x56769c,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0xe223('0x97')](_0x56769c,0x16,_0xe223('0x9d'));rpcDb[_0xe223('0x9c')](_0x56769c,_0xe223('0x9e'));rpcDb['createCustomerFinal'](_0x56769c,_0xe223('0x9e'));}}}}})[_0xe223('0x7c')](ut[_0xe223('0x93')](_0xe223('0x9f')));};Preview['prototype']['setMessage']=function(_0x3a58c8){_0x3a58c8[_0xe223('0x62')]=!![];if(ut[_0xe223('0xa0')](_0x3a58c8['loggedIn'])){_0x3a58c8[_0xe223('0x4f')]='AGENTS_NOT_LOGGED';}else if(!ut['isActive'](_0x3a58c8[_0xe223('0x37')])){_0x3a58c8[_0xe223('0x4f')]=_0xe223('0xa1');}else if(!this[_0xe223('0xa2')](_0x3a58c8[_0xe223('0x55')])){if(!this['isTrunkReachable'](_0x3a58c8[_0xe223('0xa3')])){_0x3a58c8[_0xe223('0x4f')]=_0xe223('0xa4');}else{_0x3a58c8[_0xe223('0x4f')]=_0xe223('0xa5');}}else{_0x3a58c8['message']='ACTIVE';}emitCampaignPreview(_0x3a58c8);};Preview[_0xe223('0x11')][_0xe223('0xa6')]=function(_0x8e982e,_0xc34140,_0x15e480){var _0x52b5b5=this;var _0x107a58=this[_0xe223('0x74')][_0xc34140];var _0x1b46b3=this[_0xe223('0x16')][_0x107a58[_0xe223('0x72')]];var _0x52f3e2;if(_0x1b46b3){switch(_0x15e480){case'1':_0x1b46b3['outboundNoSuchCallsDay']+=0x1;_0x107a58[_0xe223('0xa7')]+=0x1;_0x107a58[_0xe223('0xa8')]=ut[_0xe223('0xa9')](_0x107a58);ut[_0xe223('0x97')](_0x107a58,0x0,'NoSuchNumber');ami[_0xe223('0x2a')](_0xe223('0xaa'),ut['buildObj'](_0x107a58,_0xe223('0xab')));rpcDb[_0xe223('0x9c')](_0x107a58,_0xe223('0xac'));if(ut[_0xe223('0xa9')](_0x107a58)>=_0x1b46b3[_0xe223('0xad')]){_0x52f3e2=ut[_0xe223('0xae')](_0x107a58,0xf,_0xe223('0xaf'));rpcDb[_0xe223('0xb0')](_0x52f3e2,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x107a58[_0xe223('0xa7')]>=_0x1b46b3[_0xe223('0xb1')]){rpcDb[_0xe223('0xb0')](_0x107a58,_0xe223('0xb2'));}else{rpcDb[_0xe223('0xb3')](ut[_0xe223('0xb4')](_0x107a58,_0xe223('0xa7'),_0x1b46b3[_0xe223('0xb5')]),_0x107a58[_0xe223('0xb6')],_0x107a58[_0xe223('0xb7')]);}}delete this['actions'][_0x8e982e[_0xe223('0xb8')]];break;case'ANSWER':var _0x24c0dc=moment()[_0xe223('0x5b')](_0xe223('0x96'));_0x107a58['responsetime']=_0x24c0dc;_0x107a58['answertime']=_0x24c0dc;_0x107a58['dialAnswer']=!![];_0x1b46b3['pTalking']+=0x1;logger[_0xe223('0x5e')](_0xe223('0xb9'),_0x107a58['uniqueid'],_0xe223('0xba'),_0x1b46b3[_0xe223('0x59')],_0xe223('0x75'),_0x1b46b3[_0xe223('0x63')]);ami['emit'](_0xe223('0xbb'),ut[_0xe223('0xbc')](_0x107a58,_0xe223('0xbd'),this[_0xe223('0x16')][_0x107a58[_0xe223('0x72')]]));if(_0x1b46b3[_0xe223('0xbe')]){ami['emit']('custom:agentConnectPreview',ut['buildAcw'](_0x107a58));}break;case'16':ami['emit'](_0xe223('0xbf'),ut[_0xe223('0xbc')](_0x107a58,_0xe223('0xc0'),this[_0xe223('0x16')][_0x107a58[_0xe223('0x72')]]));emitVoiceQueueChannelRemove(ut[_0xe223('0xbc')](_0x107a58,'complete'));_0x1b46b3['outboundAnswerCallsDay']+=0x1;_0x1b46b3['total']+=0x1;_0x1b46b3[_0xe223('0xc1')]+=0x1;ut['decrementTalkink'](_0x1b46b3,_0xe223('0xc2'));_0x107a58['countglobal']=ut[_0xe223('0xa9')](_0x107a58);ut['logCustomer'](_0x107a58,0x4,_0xe223('0xc3'));rpcDb[_0xe223('0x9c')](_0x107a58,_0xe223('0xc4'));rpcDb[_0xe223('0xb0')](_0x107a58,_0xe223('0xc5'));rpcDb[_0xe223('0xc6')](_0x107a58);_0x1b46b3[_0xe223('0x30')]+=_0x107a58[_0xe223('0xc7')];_0x1b46b3[_0xe223('0x2f')]+=_0x107a58[_0xe223('0xc7')];logger[_0xe223('0x5e')](_0xe223('0xc8'),_0x107a58[_0xe223('0xc9')],'\x20Queue',_0x1b46b3[_0xe223('0x59')],_0xe223('0x75'),_0x1b46b3[_0xe223('0x63')]);delete this[_0xe223('0x74')][_0x8e982e[_0xe223('0xb8')]];break;case _0xe223('0xca'):_0x1b46b3[_0xe223('0xcb')]+=0x1;_0x107a58[_0xe223('0xcc')]+=0x1;_0x107a58['countglobal']=ut[_0xe223('0xa9')](_0x107a58);ut[_0xe223('0x97')](_0x107a58,0x5,_0xe223('0xcd'));ami[_0xe223('0x2a')]('custom:agentbusy',ut[_0xe223('0xbc')](_0x107a58,'busy'));rpcDb[_0xe223('0x9c')](_0x107a58,_0xe223('0xce'));if(ut['totalGlobal'](_0x107a58)>=_0x1b46b3[_0xe223('0xad')]){_0x52f3e2=ut['cloneAction'](_0x107a58,0xf,'Global');rpcDb['createCustomerFinal'](_0x52f3e2,_0xe223('0xcf'));}else{if(_0x107a58[_0xe223('0xcc')]>=_0x1b46b3[_0xe223('0xd0')]){rpcDb['createCustomerFinal'](_0x107a58,_0xe223('0xce'));}else{rpcDb[_0xe223('0xb3')](ut[_0xe223('0xb4')](_0x107a58,_0xe223('0xcc'),_0x1b46b3[_0xe223('0xd1')]),_0x107a58[_0xe223('0xb6')],_0x107a58['activeContact']);}}break;case _0xe223('0xd2'):_0x1b46b3[_0xe223('0x3f')]+=0x1;_0x107a58[_0xe223('0xd3')]+=0x1;_0x107a58[_0xe223('0xa8')]=ut[_0xe223('0xa9')](_0x107a58);ut['logCustomer'](_0x107a58,0x3,_0xe223('0xd4'));ami[_0xe223('0x2a')](_0xe223('0xd5'),ut[_0xe223('0xbc')](_0x107a58,_0xe223('0xd6')));rpcDb['createCustomerHistory'](_0x107a58,_0xe223('0xd7'));if(ut['totalGlobal'](_0x107a58)>=_0x1b46b3['dialGlobalMaxRetry']){_0x52f3e2=ut[_0xe223('0xae')](_0x107a58,0xf,_0xe223('0xaf'));rpcDb[_0xe223('0xb0')](_0x52f3e2,_0xe223('0xd8'));}else{if(_0x107a58[_0xe223('0xd3')]>=_0x1b46b3[_0xe223('0xd9')]){rpcDb['createCustomerFinal'](_0x107a58,_0xe223('0xd7'));}else{rpcDb[_0xe223('0xb3')](ut[_0xe223('0xb4')](_0x107a58,'countnoanswerretry',_0x1b46b3[_0xe223('0xda')]),_0x107a58['unlockAgent'],_0x107a58[_0xe223('0xb7')]);}}break;case'CONGESTION':_0x1b46b3[_0xe223('0x3d')]+=0x1;_0x107a58[_0xe223('0xdb')]+=0x1;_0x107a58[_0xe223('0xa8')]=ut['totalGlobal'](_0x107a58);ut['logCustomer'](_0x107a58,0x8,_0xe223('0xdc'));ami[_0xe223('0x2a')](_0xe223('0xdd'),ut[_0xe223('0xbc')](_0x107a58,_0xe223('0xde')));rpcDb[_0xe223('0x9c')](_0x107a58,_0xe223('0xdf'));if(ut[_0xe223('0xa9')](_0x107a58)>=_0x1b46b3[_0xe223('0xad')]){_0x52f3e2=ut[_0xe223('0xae')](_0x107a58,0xf,_0xe223('0xaf'));rpcDb['createCustomerFinal'](_0x52f3e2,_0xe223('0xe0'));}else{if(_0x107a58[_0xe223('0xdb')]>=_0x1b46b3[_0xe223('0xe1')]){rpcDb['createCustomerFinal'](_0x107a58,_0xe223('0xdf'));}else{rpcDb[_0xe223('0xb3')](ut[_0xe223('0xb4')](_0x107a58,_0xe223('0xdb'),_0x1b46b3[_0xe223('0xd1')]),_0x107a58['unlockAgent'],_0x107a58['activeContact']);}}break;case _0xe223('0xe2'):_0x1b46b3[_0xe223('0x43')]+=0x1;_0x107a58[_0xe223('0xe3')]+=0x1;_0x107a58[_0xe223('0xa8')]=ut['totalGlobal'](_0x107a58);ut[_0xe223('0x97')](_0x107a58,0x14,_0xe223('0xe4'));ami[_0xe223('0x2a')](_0xe223('0xe5'),ut['buildObj'](_0x107a58,_0xe223('0xe6')));rpcDb['createCustomerHistory'](_0x107a58,'[syncHangupRequest][logAgentReject]');if(ut[_0xe223('0xa9')](_0x107a58)>=_0x1b46b3[_0xe223('0xad')]){_0x52f3e2=ut[_0xe223('0xae')](_0x107a58,0x14,_0xe223('0xe4'));rpcDb[_0xe223('0xb0')](_0x52f3e2,_0xe223('0xe7'));}else{if(_0x107a58[_0xe223('0xe3')]>=_0x1b46b3[_0xe223('0xe8')]){rpcDb[_0xe223('0xb0')](_0x107a58,_0xe223('0xe7'));}else{rpcDb[_0xe223('0xb3')](ut[_0xe223('0xb4')](_0x107a58,_0xe223('0xe3'),_0x1b46b3['dialAgentRejectRetryFrequency']),_0x107a58[_0xe223('0xb6')],_0x107a58[_0xe223('0xb7')]);}}break;case _0xe223('0xe9'):_0x1b46b3[_0xe223('0x45')]+=0x1;_0x107a58['countabandonedretry']+=0x1;_0x107a58[_0xe223('0xa8')]=ut[_0xe223('0xa9')](_0x107a58);ut['logCustomer'](_0x107a58,0xb,'Abandoned');rpcDb[_0xe223('0x9c')](_0x107a58,_0xe223('0xea'));if(ut['totalGlobal'](_0x107a58)>=_0x1b46b3[_0xe223('0xad')]){_0x52f3e2=ut[_0xe223('0xae')](_0x107a58,0xf,_0xe223('0xaf'));rpcDb[_0xe223('0xb0')](_0x52f3e2,_0xe223('0xea'));}else{if(_0x107a58[_0xe223('0xeb')]>=_0x1b46b3['dialAbandonedMaxRety']){rpcDb[_0xe223('0xb0')](_0x107a58,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xe223('0xb3')](ut[_0xe223('0xb4')](_0x107a58,_0xe223('0xec'),_0x1b46b3[_0xe223('0xed')]),_0x107a58['unlockAgent'],_0x107a58[_0xe223('0xb7')]);}}break;case'18':_0x1b46b3[_0xe223('0x44')]+=0x1;_0x107a58['countmachineretry']+=0x1;_0x107a58[_0xe223('0xa8')]=ut[_0xe223('0xa9')](_0x107a58);ut['logCustomer'](_0x107a58,0x12,_0x8e982e[_0xe223('0xee')]||_0x8e982e['dialstatus']);ami[_0xe223('0x2a')](_0xe223('0xef'),ut['buildObj'](_0x107a58,_0xe223('0xf0')));rpcDb[_0xe223('0x9c')](_0x107a58,'[callProgressDetectingCustomer][hangupInAMD]');if(ut[_0xe223('0xa9')](_0x107a58)>=_0x1b46b3['dialGlobalMaxRetry']){_0x52f3e2=ut[_0xe223('0xae')](_0x107a58,0xf,'Global');rpcDb[_0xe223('0xb0')](_0x52f3e2,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb['createCustomerFinal'](_0x107a58,'[callProgressDetectingCustomer][hangupInAMD]');}delete this[_0xe223('0x74')][_0x8e982e[_0xe223('0xb8')]];break;case'19':_0x1b46b3[_0xe223('0x44')]+=0x1;_0x107a58[_0xe223('0xa8')]=ut[_0xe223('0xa9')](_0x107a58);ut[_0xe223('0x97')](_0x107a58,0x13,_0x8e982e[_0xe223('0xee')]||_0x8e982e['dialstatus']);ami[_0xe223('0x2a')](_0xe223('0xef'),ut[_0xe223('0xbc')](_0x107a58,_0xe223('0xf0')));rpcDb[_0xe223('0x9c')](_0x107a58,'[callProgressDetectingCustomer][machine]');if(ut[_0xe223('0xa9')](_0x107a58)>=_0x1b46b3[_0xe223('0xad')]){_0x52f3e2=ut[_0xe223('0xae')](_0x107a58,0xf,_0xe223('0xaf'));rpcDb['createCustomerFinal'](_0x52f3e2,_0xe223('0xf1'));}else{rpcDb['createCustomerFinal'](_0x107a58,_0xe223('0xf1'));}delete this[_0xe223('0x74')][_0x8e982e[_0xe223('0xb8')]];break;default:if(_0x107a58[_0xe223('0x80')]){ut[_0xe223('0x81')](_0x1b46b3,_0xe223('0xf2'));ut[_0xe223('0x82')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x1b46b3[_0xe223('0x59')],_0x8e982e);}_0x1b46b3[_0xe223('0x44')]+=0x1;_0x107a58['countglobal']=ut[_0xe223('0xa9')](_0x107a58);ut[_0xe223('0x97')](_0x107a58,0xc,_0x8e982e[_0xe223('0xee')]||_0x8e982e['dialstatus']);rpcDb[_0xe223('0x9c')](_0x107a58,_0xe223('0xf3'));if(ut['totalGlobal'](_0x107a58)>=_0x1b46b3[_0xe223('0xad')]){_0x52f3e2=ut[_0xe223('0xae')](_0x107a58,0xf,_0xe223('0xaf'));rpcDb['createCustomerFinal'](_0x52f3e2,_0xe223('0xf4'));}else{rpcDb['createCustomerFinal'](_0x107a58,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0xe223('0x74')][_0x8e982e[_0xe223('0xb8')]];}if(!(_0x107a58[_0xe223('0x80')]&&_0x15e480==='16')){ut['updateOriginated'](_0x1b46b3,_0xe223('0xf5'));logger[_0xe223('0x5e')](_0xe223('0xf6'),_0x107a58[_0xe223('0xc9')],'\x20Queue',_0x1b46b3['name'],_0xe223('0x73'),_0x1b46b3[_0xe223('0x50')]);}if(_0x15e480!==_0xe223('0xf7')){delete this[_0xe223('0x74')][_0x8e982e[_0xe223('0xb8')]];delete this[_0xe223('0x74')][_0x8e982e[_0xe223('0xf8')]];}}};Preview[_0xe223('0x11')][_0xe223('0xf9')]=function(_0x58f7b4,_0x58fb40,_0x33e497){if(_[_0xe223('0xfa')](_0x58fb40)&&_0xe223('0xfb')!==typeof _0x58fb40){return;}if(_['isUndefined'](_0x33e497)&&_0xe223('0xfb')!==typeof _0x33e497){return;}switch(_0x33e497['reason']){case'0':ut[_0xe223('0xfc')](_0x58f7b4,0x0,'NoSuchNumber');rpcDb[_0xe223('0xfd')](_0x58f7b4,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0xe223('0xfc')](_0x58f7b4,0x3,_0xe223('0xd4'));rpcDb[_0xe223('0xfd')](_0x58f7b4,_0xe223('0xfe'));break;case'5':ut[_0xe223('0xfc')](_0x58f7b4,0x5,_0xe223('0xcd'));rpcDb[_0xe223('0xfd')](_0x58f7b4,_0xe223('0xff'));break;case'8':ut[_0xe223('0xfc')](_0x58f7b4,0x8,_0xe223('0xdc'));rpcDb['createAgentHistory'](_0x58f7b4,_0xe223('0x100'));break;case'22':ut[_0xe223('0xfc')](_0x58f7b4,0x16,_0xe223('0x101'));rpcDb[_0xe223('0xfd')](_0x58f7b4,_0xe223('0x102'));break;default:ut['logAgent'](_0x58f7b4,0xc,_0x33e497[_0xe223('0x103')]);rpcDb['createAgentHistory'](_0x58f7b4,_0xe223('0x100'));}ut[_0xe223('0x7e')](_0x58fb40,_0xe223('0x104'));logger[_0xe223('0x5e')](_0xe223('0x105'),_0x58f7b4[_0xe223('0xc9')],_0xe223('0xba'),_0x58fb40[_0xe223('0x59')],_0xe223('0x73'),_0x58fb40[_0xe223('0x50')]);delete this[_0xe223('0x74')][_0x58f7b4[_0xe223('0xc9')]];};Preview[_0xe223('0x11')]['checkInBlack']=function(_0x16265d,_0x1bb242,_0x374ba7,_0x355c29,_0x5c7e11){var _0x5c3ba0=this;return new BPromise(function(_0x8fe958,_0x2de347){if(_[_0xe223('0x8b')](_0x1bb242)||_[_0xe223('0x8b')](_0x1bb242[_0xe223('0x106')])||_[_0xe223('0x8b')](_0x1bb242[_0xe223('0x106')][_0xe223('0x107')])||_[_0xe223('0x8b')](_0x1bb242[_0xe223('0x79')])){_0x2de347(ut['message']('Contact\x20is\x20undefined',_0x355c29,_0x5c7e11));return;}var _0x54e093=uuid['v4']();var _0x107840=_0x5c3ba0[_0xe223('0x16')][_0x1bb242[_0xe223('0x108')][_0xe223('0x59')]];var _0x532ea9=_0x374ba7?_0x5c3ba0[_0xe223('0x19')][_0x374ba7]['id']:undefined;_0x5c3ba0[_0xe223('0x74')][_0x54e093]=new Action(_0x1bb242,_0x107840,_0x54e093,_0x374ba7,_0x532ea9);var _0x2ce846=_0x5c3ba0[_0xe223('0x74')][_0x54e093];_0x2ce846[_0xe223('0xb6')]=_0x355c29;_0x2ce846[_0xe223('0xb7')]=_0x5c7e11;_0x2ce846[_0xe223('0x109')]=_0x374ba7;if(_[_0xe223('0x10a')](_0x16265d)){_0x5c3ba0[_0xe223('0x10b')](_0x2ce846,_0x107840,_0x1bb242,_0x374ba7)['then'](function(_0x224d31){logger['info'](_0xe223('0x10c'),'Queue:\x20'+_0x2ce846[_0xe223('0x72')]+_0xe223('0x10d')+_0x2ce846[_0xe223('0x10e')],JSON[_0xe223('0x5a')](_0x224d31));ami[_0xe223('0x2a')](_0xe223('0x10f'),ut[_0xe223('0xbc')](_0x2ce846,'called',_0x5c3ba0[_0xe223('0x16')][_0x2ce846[_0xe223('0x72')]]));_0x8fe958(ut[_0xe223('0x4f')](_0xe223('0x110')));})['catch'](function(_0x486047){ut[_0xe223('0x67')](_0xe223('0x111'),_0x486047);_0x2de347(ut[_0xe223('0x4f')](_0xe223('0x112'),_0x355c29,_0x5c7e11));});}else{_0x107840[_0xe223('0x113')]+=0x1;ut[_0xe223('0x114')](_0x2ce846);rpcDb[_0xe223('0x115')](_0x2ce846,_0xe223('0x116'));delete _0x5c3ba0['actions'][_0x54e093];_0x2de347(ut[_0xe223('0x4f')](_0xe223('0x117'),_0x355c29,_0x5c7e11));}});};Preview[_0xe223('0x11')]['isTrunkReachable']=function(_0xf3290e){return!_[_0xe223('0x8b')](_0xf3290e)&&!_['isNil'](_0xf3290e[_0xe223('0x59')])&&!_[_0xe223('0x8b')](_0xf3290e[_0xe223('0x56')])&&_0xf3290e['active']&&!_['isNil'](this[_0xe223('0x18')][util[_0xe223('0x5b')](_0xe223('0x118'),_0xf3290e[_0xe223('0x59')])])&&!_['isNil'](this['trunks'][util[_0xe223('0x5b')](_0xe223('0x118'),_0xf3290e['name'])][_0xe223('0x7a')])&&(this[_0xe223('0x18')][util['format']('SIP/%s',_0xf3290e['name'])][_0xe223('0x7a')]===_0xe223('0x119')||this[_0xe223('0x18')][util[_0xe223('0x5b')]('SIP/%s',_0xf3290e[_0xe223('0x59')])]['status']===_0xe223('0x11a'));};Preview['prototype'][_0xe223('0x92')]=function(_0x1c3181,_0x171deb){var _0x5c7e9a=this;return new BPromise(function(_0x122c8f,_0x5e5d2f){_0x5c7e9a['execRun'](_0x1c3181,_0x171deb)[_0xe223('0x8a')](function(_0x4c7948){_0x122c8f(_['pick'](_0x4c7948,['message']));})[_0xe223('0x7c')](function(_0x5394e9){if(_0x5394e9[_0xe223('0x11b')]){rpcDb['unlockContact'](_0x1c3181);}if(_0x5394e9[_0xe223('0x56')]){rpcDb['disableContact'](_0x1c3181);}_0x5e5d2f(_[_0xe223('0x76')](_0x5394e9,[_0xe223('0x4f')]));});});};Preview['prototype'][_0xe223('0x11c')]=function(_0x14538d,_0x5e3fb4){var _0x4c46ea=this;return new BPromise(function(_0xbc2af3,_0x45ddf5){var _0x56111e,_0x5ee9a4;rpcDb[_0xe223('0x11d')](_0x14538d)['then'](function(_0x42fbd0){if(!_[_0xe223('0x8b')](_0x42fbd0[0x0])){_0x5ee9a4=_0x42fbd0[0x0][_0xe223('0x11e')]?![]:!![];_0x56111e=_0x42fbd0[0x0]['recallme']?!![]:![];_0x56111e=_0x5e3fb4?!![]:_0x56111e;}var _0x2a1c4a=_0x4c46ea[_0xe223('0x11f')](_0x42fbd0);if(_0x2a1c4a[_0xe223('0x120')]){rpcDb[_0xe223('0x121')](_[_0xe223('0x76')](_0x42fbd0[0x0],[_0xe223('0x79'),_0xe223('0x122')]))['then'](function(_0x2698b4){_0x4c46ea[_0xe223('0x123')](_0x2698b4,_0x42fbd0[0x0],_0x5e3fb4,_0x5ee9a4,_0x56111e)[_0xe223('0x8a')](function(_0x166854){_0xbc2af3(_0x166854);})[_0xe223('0x7c')](function(_0x5cfc05){_0x45ddf5(_0x5cfc05);});})['catch'](function(_0x169c96){ut[_0xe223('0x67')](_0xe223('0x124'),_0x169c96);_0x45ddf5(ut['message'](_0xe223('0x125'),_0x5ee9a4,_0x56111e));});}else{_0x45ddf5(ut[_0xe223('0x4f')](_0x2a1c4a[_0xe223('0x4f')],_0x5ee9a4,_0x56111e));}})[_0xe223('0x7c')](function(_0x50fc12){ut[_0xe223('0x67')](_0xe223('0x126'),_0x50fc12);_0x45ddf5(ut[_0xe223('0x4f')](_0xe223('0x125'),![],!![]));});});};Preview[_0xe223('0x11')][_0xe223('0x11f')]=function(_0x2d18a9){if(_[_0xe223('0x8b')](_0x2d18a9)||_[_0xe223('0x10a')](_0x2d18a9)||!_['isNil'](_0x2d18a9[0x0][_0xe223('0x90')])&&_['isNil'](_0x2d18a9[0x0][_0xe223('0x90')]['name'])){ut[_0xe223('0x67')](_0xe223('0x127'),_0x2d18a9);return{'isValid':![],'message':_0xe223('0x128')};}var _0x47ac93=this[_0xe223('0x16')][_0x2d18a9[0x0][_0xe223('0x108')][_0xe223('0x59')]];_0x47ac93[_0xe223('0x4f')]=_0xe223('0xa5');if(_[_0xe223('0x8b')](_0x47ac93)){ut[_0xe223('0x67')](_0xe223('0x129'),_0x47ac93);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0xe223('0xa2')](_0x47ac93[_0xe223('0x55')])){ut[_0xe223('0x67')](_0xe223('0x12a'),_0xe223('0x12b')+_0x47ac93[_0xe223('0x59')]+_0xe223('0x12c'));if(!this[_0xe223('0xa2')](_0x47ac93[_0xe223('0xa3')])){ut['logger'](_0xe223('0x12a'),_0x47ac93[_0xe223('0x59')]+_0xe223('0x12d'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut[_0xe223('0x12e')](_0x47ac93[_0xe223('0x37')])){ut[_0xe223('0x67')]('[Preview][validateContact][Campaign\x20Active]',_0x47ac93['name']+_0xe223('0x12f'));return{'isValid':![],'message':_0xe223('0x12b')+_0x47ac93['name']+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0xe223('0x130')};};Preview['prototype'][_0xe223('0x10b')]=function(_0x1e2e72,_0x2fc3fc,_0x588e9,_0x3c565f){var _0x19b216=this;return new BPromise(function(_0x2de474,_0x5bf5d2){var _0x1213a7=_0x1e2e72[_0xe223('0xc9')];var _0x7c0166=_0x19b216[_0xe223('0xa2')](_0x2fc3fc[_0xe223('0x55')])?util[_0xe223('0x5b')]('SIP/%s/%s%s',_0x2fc3fc[_0xe223('0x55')][_0xe223('0x59')],_[_0xe223('0x8b')](_0x2fc3fc['dialPrefix'])?'':_0x2fc3fc[_0xe223('0x3a')]['trim']()||'',_0x2fc3fc[_0xe223('0x131')]>0x0?_0x588e9['Contact'][_0xe223('0x107')]['substring'](_0x2fc3fc[_0xe223('0x131')]):_0x588e9[_0xe223('0x106')][_0xe223('0x107')]):util['format'](_0xe223('0x132'),_['isNil'](_0x2fc3fc[_0xe223('0xa3')])?_0x2fc3fc[_0xe223('0x55')][_0xe223('0x59')]:_0x2fc3fc[_0xe223('0xa3')][_0xe223('0x59')],_[_0xe223('0x8b')](_0x2fc3fc[_0xe223('0x3a')])?'':_0x2fc3fc[_0xe223('0x3a')]['trim']()||'',_0x2fc3fc[_0xe223('0x131')]>0x0?_0x588e9['Contact'][_0xe223('0x107')][_0xe223('0x133')](_0x2fc3fc[_0xe223('0x131')]):_0x588e9['Contact'][_0xe223('0x107')]);var _0x3e22ee=_0x19b216['isTrunkReachable'](_0x2fc3fc[_0xe223('0x55')])?ut['getCallerId'](_0x2fc3fc['Trunk'][_0xe223('0x57')],_0x2fc3fc[_0xe223('0x134')],_0x2fc3fc['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x2fc3fc['dialOriginateCallerIdNumber'],_0x2fc3fc[_0xe223('0x135')]):_0x2fc3fc[_0xe223('0x39')]):ut[_0xe223('0x136')](_['isNil'](_0x2fc3fc['TrunkBackup'])?_0x2fc3fc[_0xe223('0x55')][_0xe223('0x57')]:_0x2fc3fc[_0xe223('0xa3')][_0xe223('0x57')],_0x2fc3fc[_0xe223('0x134')],_0x2fc3fc[_0xe223('0x135')]>0x0?ut['getCallerIdRandom'](_0x2fc3fc['dialOriginateCallerIdNumber'],_0x2fc3fc[_0xe223('0x135')]):_0x2fc3fc[_0xe223('0x39')]);if(_0x3e22ee){_0x1e2e72['originatecalleridname']=ut['extractCalleridName'](_0x3e22ee);_0x1e2e72[_0xe223('0x137')]=ut[_0xe223('0x138')](_0x3e22ee);}var _0x22539c=ut[_0xe223('0x139')](_0x2fc3fc,_0x588e9,_0x7c0166,_0x3e22ee,_0x1213a7,_0x1e2e72);_[_0xe223('0x13a')](_0x1e2e72,ut[_0xe223('0x13b')](_0x22539c));_0x1e2e72[_0xe223('0x95')]=moment()[_0xe223('0x5b')](_0xe223('0x96'));ami['Action'](ut[_0xe223('0x13c')](_0x1e2e72,_0x2fc3fc,_0x22539c,_0x1e2e72[_0xe223('0xb7')],_0x3c565f))[_0xe223('0x8a')](function(_0x207312){var _0x581056=_0x1e2e72[_0xe223('0x13d')];if(!_['isNil'](_0x581056)){if(!_['isNil'](_0x19b216[_0xe223('0x19')][_0x581056])){_0x19b216[_0xe223('0x19')][_0x581056]['destconnectedlinenum']=_0x1e2e72[_0xe223('0x13e')];emit(util[_0xe223('0x5b')](_0xe223('0x13f'),_0x19b216[_0xe223('0x19')][_0x581056][_0xe223('0x59')]),_0xe223('0x140'),{'destaccountcode':_0x19b216['agents'][_0x581056][_0xe223('0x141')],'destconnectedlinenum':_0x1e2e72[_0xe223('0x13e')]});}}_0x2fc3fc[_0xe223('0x50')]+=0x1;logger['info'](_0xe223('0x142'),_0x1213a7,_0xe223('0xba'),_0x2fc3fc[_0xe223('0x59')],_0xe223('0x73'),_0x2fc3fc['originated']);_0x2de474(_0x207312);})['catch'](function(_0xe4cc3a){ut[_0xe223('0xfc')](_0x1e2e72,0xe,'OriginateError');rpcDb[_0xe223('0xfd')](_0x1e2e72,_0xe223('0x143'));_0x5bf5d2(_0xe4cc3a);});});};Preview[_0xe223('0x11')][_0xe223('0x144')]=function(_0xbf5311){if(this[_0xe223('0x74')][_0xbf5311['linkedid']]){this[_0xe223('0x74')][_0xbf5311['linkedid']][_0xe223('0x7b')]=_0xbf5311[_0xe223('0x7b')];}};Preview[_0xe223('0x11')][_0xe223('0x1c')]=function(_0xdf6c1f){var _0x24fe6d=this;var _0x5a106b=this[_0xe223('0x74')][_0xdf6c1f['actionid']];if(_0x5a106b){if(_0x5a106b['lookAgent']&&this[_0xe223('0x19')][_0x5a106b[_0xe223('0x109')]]){ut[_0xe223('0x145')](_0x5a106b,this[_0xe223('0x19')][_0x5a106b[_0xe223('0x109')]][_0xe223('0x59')],this[_0xe223('0x19')][_0x5a106b[_0xe223('0x109')]]['id']);}var _0x406d45=_['clone'](_0x5a106b);_0x406d45[_0xe223('0x146')]=moment()[_0xe223('0x5b')](_0xe223('0x96'));var _0x19915d=_0x24fe6d[_0xe223('0x16')][_0x5a106b[_0xe223('0x72')]];if(ut[_0xe223('0x147')](_0xdf6c1f['response'])){if(_0x5a106b[_0xe223('0xb6')]){rpcDb[_0xe223('0x148')](_0x5a106b[_0xe223('0x10e')]);}if(_0x5a106b[_0xe223('0xb7')]){rpcDb['disableContact'](_0x5a106b['idContact']);}ami['emit']('custom:agentringnoanswer',ut['buildObj'](_0x5a106b,'rejected',this['campaignsPreview'][_0x5a106b[_0xe223('0x72')]]));this[_0xe223('0xf9')](_0x406d45,_0x19915d,_0xdf6c1f);}else{_0x5a106b['starttime']=moment()[_0xe223('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0xe223('0xfc')](_0x406d45,0x4,'Answer');rpcDb[_0xe223('0xfd')](_0x406d45,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0xe223('0x11')][_0xe223('0x149')]=function(_0xdc73a4){var _0x152153=this;var _0x2fb0c8=this[_0xe223('0x74')][_0xdc73a4[_0xe223('0xb8')]];var _0x4fd0a7;if(_0x2fb0c8){_0x4fd0a7=this[_0xe223('0x16')][_0x2fb0c8[_0xe223('0x72')]];logger[_0xe223('0x5e')](_0xe223('0x14a'),_0xdc73a4[_0xe223('0xb8')],'\x20Queue',_0x4fd0a7[_0xe223('0x59')],'pTalking:\x20',_0x4fd0a7[_0xe223('0x63')]);}if(this[_0xe223('0x74')][_0xdc73a4[_0xe223('0xb8')]]&&_0xdc73a4[_0xe223('0xb8')]!==_0xdc73a4['uniqueid']){if(_0xdc73a4[_0xe223('0x14b')]==='16'&&this[_0xe223('0x74')][_0xdc73a4[_0xe223('0xb8')]][_0xe223('0x80')]){this[_0xe223('0xa6')](_0xdc73a4,_0xdc73a4[_0xe223('0xb8')],_0xdc73a4['cause']);}else if(this[_0xe223('0x74')][_0xdc73a4[_0xe223('0xb8')]][_0xe223('0x80')]){logger[_0xe223('0x5e')](_0xe223('0x14c'),_0xdc73a4[_0xe223('0xb8')],_0xdc73a4[_0xe223('0x14b')],_0xe223('0xba'),_0x4fd0a7[_0xe223('0x59')],_0xe223('0x75'),_0x4fd0a7[_0xe223('0x63')]);this[_0xe223('0xa6')](_0xdc73a4,_0xdc73a4['linkedid'],_0xdc73a4['cause']);}}else if(_0x2fb0c8&&_[_0xe223('0x8b')](_0x2fb0c8['statedesc'])&&_0x4fd0a7[_0xe223('0x14d')]&&_0xdc73a4[_0xe223('0xb8')]===_0xdc73a4[_0xe223('0xc9')]&&_['isNil'](_0xdc73a4['reason'])&&_0xdc73a4['cause']==='16'&&_0xdc73a4[_0xe223('0x14e')]==='6'&&_[_0xe223('0xfa')](_0x2fb0c8[_0xe223('0x14f')])){if(_0x2fb0c8[_0xe223('0xb6')]){rpcDb['unlockContact'](_0x2fb0c8['idContact']);}if(_0x2fb0c8[_0xe223('0xb7')]){rpcDb[_0xe223('0x150')](_0x2fb0c8[_0xe223('0x10e')]);}_0xdc73a4[_0xe223('0x103')]='22';this[_0xe223('0xf9')](_0x2fb0c8,_0x4fd0a7,_0xdc73a4);}else if(_0x2fb0c8&&_0x2fb0c8[_0xe223('0x14f')]){if(_0xdc73a4[_0xe223('0x14b')]==='16'&&this[_0xe223('0x74')][_0xdc73a4[_0xe223('0xb8')]][_0xe223('0x80')]){logger[_0xe223('0x5e')]('[syncHangup][talking][transfer]',_0xdc73a4[_0xe223('0xb8')],_0xdc73a4[_0xe223('0x14b')],_0xe223('0xba'),_0x4fd0a7['name'],_0xe223('0x75'),_0x4fd0a7[_0xe223('0x63')]);this[_0xe223('0xa6')](_0xdc73a4,_0xdc73a4['linkedid'],_0xdc73a4[_0xe223('0x14b')]);}else if(this[_0xe223('0x74')][_0xdc73a4[_0xe223('0xb8')]][_0xe223('0x80')]){logger['info'](_0xe223('0x14c'),_0xdc73a4['linkedid'],_0xdc73a4[_0xe223('0x14b')],_0xe223('0xba'),_0x4fd0a7[_0xe223('0x59')],'pTalking:\x20',_0x4fd0a7['pTalking']);this['callProgressDetectingCustomer'](_0xdc73a4,_0xdc73a4[_0xe223('0xb8')],_0xdc73a4[_0xe223('0x14b')]);}}};Preview[_0xe223('0x11')][_0xe223('0x22')]=function(_0x112f57){if(this['actions'][_0x112f57[_0xe223('0xf8')]]&&_0x112f57[_0xe223('0xf8')]!==_0x112f57[_0xe223('0x151')]){this[_0xe223('0xa6')](_0x112f57,_0x112f57[_0xe223('0xf8')],_0x112f57[_0xe223('0x152')]);}};Preview[_0xe223('0x11')][_0xe223('0x20')]=function(_0x78eaeb){if(this[_0xe223('0x74')][_0x78eaeb[_0xe223('0xb8')]]&&_0x78eaeb['linkedid']!==_0x78eaeb['uniqueid']&&!this[_0xe223('0x74')][_0x78eaeb['linkedid']][_0xe223('0x80')]){if(_0x78eaeb[_0xe223('0x14b')]==='1'){this[_0xe223('0xa6')](_0x78eaeb,_0x78eaeb[_0xe223('0xb8')],_0x78eaeb['cause']);}}};Preview['prototype'][_0xe223('0x153')]=function(_0xc2c726,_0x525a82,_0x5d08f7){if(this[_0xe223('0x74')][_0xc2c726]){if(_['isNil'](this[_0xe223('0x74')][_0xc2c726][_0xe223('0x154')])){this['actions'][_0xc2c726][_0xe223('0x154')]={};}this['actions'][_0xc2c726]['variables'][_0x525a82]=_0x5d08f7;}};Preview[_0xe223('0x11')]['syncVarSet']=function(_0xf65bd2){try{if(!_[_0xe223('0x8b')](_0xf65bd2)){if(ut['filterKey'](_[_0xe223('0x155')](_0xf65bd2[_0xe223('0x156')])[0x0])){this['addVariable'](_0xf65bd2[_0xe223('0xc9')],_['keys'](_0xf65bd2['variable'])[0x0],_0xf65bd2[_0xe223('0x157')]);}}}catch(_0x2cc8a4){logger[_0xe223('0x158')](_0xe223('0x159'),util['inspect'](_0x2cc8a4,{'showHidden':![],'depth':null}));}};Preview[_0xe223('0x11')][_0xe223('0x27')]=function(_0x47a233){if(_0x47a233){if(this[_0xe223('0x74')][_0x47a233['transfertargetlinkedid']]){this[_0xe223('0x74')][_0x47a233[_0xe223('0x15a')]][_0xe223('0x14f')]=!![];}}};Preview[_0xe223('0x11')][_0xe223('0x15b')]=function(_0x4a441f){if(_0x4a441f){if(this[_0xe223('0x74')][_0x4a441f[_0xe223('0x15c')]]){this[_0xe223('0x74')][_0x4a441f[_0xe223('0x15c')]]['transfer']=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 38a2fef..2ce0bdd 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 _0x8a58=['[createHistory]\x20','moveContactManagedDialer','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','membername','exten','holdtime','assigned','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch'];(function(_0x2c8087,_0x306bb6){var _0x228e8b=function(_0x59a8f0){while(--_0x59a8f0){_0x2c8087['push'](_0x2c8087['shift']());}};_0x228e8b(++_0x306bb6);}(_0x8a58,0x191));var _0x88a5=function(_0x43eb54,_0x35e944){_0x43eb54=_0x43eb54-0x0;var _0x3892ac=_0x8a58[_0x43eb54];return _0x3892ac;};'use strict';var util=require(_0x88a5('0x0'));var BPromise=require('bluebird');var logger=require(_0x88a5('0x1'))('preview');var _=require('lodash');var cmHopper=require(_0x88a5('0x2'));var cmHopperFinal=require(_0x88a5('0x3'));var cmHopperHistory=require(_0x88a5('0x4'));var cmHopperBlack=require(_0x88a5('0x5'));var voiceQueueRt=require(_0x88a5('0x6'));var agentReportPreview=require(_0x88a5('0x7'));var voiceQueueReport=require(_0x88a5('0x8'));function loggerCatch(_0x33b34b){return function(_0x3853c9){logger[_0x88a5('0x9')](_0x33b34b,util[_0x88a5('0xa')](_0x3853c9,{'showHidden':![],'depth':null}));};}function create(_0x535425){return BPromise[_0x88a5('0xb')]()[_0x88a5('0xc')](cmHopperHistory[_0x88a5('0xd')](_0x535425))[_0x88a5('0xe')](loggerCatch(_0x88a5('0xf')));}function createAgent(_0x3050d9){return BPromise['resolve']()[_0x88a5('0xc')](agentReportPreview['createHistory'](_0x3050d9))[_0x88a5('0xe')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x3c13fd){return BPromise[_0x88a5('0xb')]()[_0x88a5('0xc')](cmHopper[_0x88a5('0x10')](_0x3c13fd,!![]))[_0x88a5('0xe')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x88a5('0x11')]=function(_0x4458bf){return BPromise[_0x88a5('0xb')]()[_0x88a5('0xc')](cmHopperBlack[_0x88a5('0x11')](_0x4458bf))['catch'](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x88a5('0x12')]=function(_0x445474){return BPromise['resolve']()['then'](cmHopper['getContactPreview'](_0x445474))['catch'](loggerCatch(_0x88a5('0x13')));};exports['createHistory']=function(_0x42229f,_0x1fd758){create(_0x42229f)[_0x88a5('0xe')](loggerCatch(_0x1fd758));moveContact(_0x42229f)['catch'](loggerCatch(_0x1fd758));};exports['createAgentHistory']=function(_0x14737f,_0x345fd6){createAgent(_0x14737f)[_0x88a5('0xe')](loggerCatch(_0x345fd6));};exports[_0x88a5('0x14')]=function(_0x16c70f,_0x34c361){create(_0x16c70f)[_0x88a5('0xe')](loggerCatch(_0x34c361));};exports[_0x88a5('0x15')]=function(_0x26cdc7,_0x5d1581){moveContact(_0x26cdc7)[_0x88a5('0xe')](loggerCatch(_0x5d1581));};exports[_0x88a5('0x16')]=function(_0x5f32ea,_0x52bd3b,_0x734d6c){if(_0x52bd3b){_0x5f32ea[_0x88a5('0x17')]=null;}if(_0x734d6c){_0x5f32ea[_0x88a5('0x18')]=![];}return BPromise[_0x88a5('0xb')]()[_0x88a5('0xc')](cmHopper[_0x88a5('0x16')](_0x5f32ea))[_0x88a5('0xe')](loggerCatch(_0x88a5('0x19')));};exports['countReScheduled']=function(_0x17919a){return BPromise['resolve']()[_0x88a5('0xc')](cmHopper['countReScheduled'](_0x17919a))[_0x88a5('0xe')](loggerCatch('[countReScheduled]\x20'));};exports[_0x88a5('0x1a')]=function(_0x6cbdfe){return BPromise[_0x88a5('0xb')]()[_0x88a5('0xc')](cmHopper[_0x88a5('0x1a')]({'UserId':null},_0x6cbdfe,0x1))[_0x88a5('0xe')](loggerCatch(_0x88a5('0x1b')));};exports[_0x88a5('0x1c')]=function(_0x20cf53){return BPromise[_0x88a5('0xb')]()[_0x88a5('0xc')](cmHopper[_0x88a5('0x1a')]({'active':![]},_0x20cf53,0x1))[_0x88a5('0xe')](loggerCatch(_0x88a5('0x1d')));};exports[_0x88a5('0x1e')]=function(_0x37fc78){var _0x2796df={};_0x2796df['type']=_0x37fc78[_0x88a5('0x1f')];_0x2796df['uniqueid']=_0x37fc78['uniqueid'];_0x2796df[_0x88a5('0x20')]=_0x37fc78[_0x88a5('0x20')];_0x2796df[_0x88a5('0x21')]=_0x37fc78[_0x88a5('0x21')];_0x2796df[_0x88a5('0x22')]=_0x37fc78['queue'];_0x2796df[_0x88a5('0x23')]=_0x37fc78[_0x88a5('0x24')];_0x2796df[_0x88a5('0x25')]=_0x37fc78[_0x88a5('0x24')];_0x2796df[_0x88a5('0x26')]=0x1;_0x2796df[_0x88a5('0x27')]=_0x37fc78[_0x88a5('0x28')];_0x2796df['connectedlinename']=_0x37fc78[_0x88a5('0x29')];_0x2796df['context']='from-sip';_0x2796df[_0x88a5('0x2a')]='xcally-motion-preview';_0x2796df[_0x88a5('0x2b')]=0x0;_0x2796df[_0x88a5('0x2c')]=0x1;_0x2796df['lastAssignedTo']=_0x37fc78[_0x88a5('0x29')];_0x2796df[_0x88a5('0x2d')]='COMPLETED';return BPromise[_0x88a5('0xb')]()['then'](voiceQueueReport[_0x88a5('0x2e')](_0x2796df))[_0x88a5('0xe')](loggerCatch(_0x88a5('0x2f')));};exports[_0x88a5('0x30')]=function(_0x3c1d92,_0x5b8b25){return BPromise[_0x88a5('0xb')]()[_0x88a5('0xc')](cmHopper['getContactRecallMe'](_0x3c1d92,_0x5b8b25))['catch'](loggerCatch(_0x88a5('0x31')));};exports[_0x88a5('0x32')]=function(_0x4006e7){return BPromise[_0x88a5('0xb')]()[_0x88a5('0xc')](cmHopper[_0x88a5('0x16')](_0x4006e7,!![],!![]))[_0x88a5('0xe')](loggerCatch(_0x88a5('0x33')));}; \ No newline at end of file +var _0xbccf=['../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper'];(function(_0x4478e7,_0x23fc9c){var _0x1b0af6=function(_0x1f6698){while(--_0x1f6698){_0x4478e7['push'](_0x4478e7['shift']());}};_0x1b0af6(++_0x23fc9c);}(_0xbccf,0x72));var _0xfbcc=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xbccf[_0x4d613c];return _0x301fe3;};'use strict';var util=require(_0xfbcc('0x0'));var BPromise=require(_0xfbcc('0x1'));var logger=require(_0xfbcc('0x2'))(_0xfbcc('0x3'));var _=require(_0xfbcc('0x4'));var cmHopper=require(_0xfbcc('0x5'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xfbcc('0x6'));var voiceQueueRt=require(_0xfbcc('0x7'));var agentReportPreview=require(_0xfbcc('0x8'));var voiceQueueReport=require(_0xfbcc('0x9'));function loggerCatch(_0x2c234f){return function(_0x440b94){logger[_0xfbcc('0xa')](_0x2c234f,util[_0xfbcc('0xb')](_0x440b94,{'showHidden':![],'depth':null}));};}function create(_0x19c61e){return BPromise[_0xfbcc('0xc')]()[_0xfbcc('0xd')](cmHopperHistory[_0xfbcc('0xe')](_0x19c61e))[_0xfbcc('0xf')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x556c3c){return BPromise[_0xfbcc('0xc')]()[_0xfbcc('0xd')](agentReportPreview[_0xfbcc('0xe')](_0x556c3c))[_0xfbcc('0xf')](loggerCatch(_0xfbcc('0x10')));}function moveContact(_0x237432){return BPromise[_0xfbcc('0xc')]()[_0xfbcc('0xd')](cmHopper['moveContactManagedDialer'](_0x237432,!![]))[_0xfbcc('0xf')](loggerCatch(_0xfbcc('0x11')));}exports[_0xfbcc('0x12')]=function(_0x598b35){return BPromise['resolve']()['then'](cmHopperBlack[_0xfbcc('0x12')](_0x598b35))[_0xfbcc('0xf')](loggerCatch(_0xfbcc('0x13')));};exports['getContactPreview']=function(_0xecdf1c){return BPromise[_0xfbcc('0xc')]()[_0xfbcc('0xd')](cmHopper[_0xfbcc('0x14')](_0xecdf1c))['catch'](loggerCatch('[getContactPreview]\x20'));};exports[_0xfbcc('0xe')]=function(_0x501ce9,_0x513aba){create(_0x501ce9)[_0xfbcc('0xf')](loggerCatch(_0x513aba));moveContact(_0x501ce9)['catch'](loggerCatch(_0x513aba));};exports[_0xfbcc('0x15')]=function(_0x55f253,_0x5a4608){createAgent(_0x55f253)[_0xfbcc('0xf')](loggerCatch(_0x5a4608));};exports[_0xfbcc('0x16')]=function(_0x4202bb,_0x1d8d94){create(_0x4202bb)[_0xfbcc('0xf')](loggerCatch(_0x1d8d94));};exports[_0xfbcc('0x17')]=function(_0x49dd12,_0x2f9423){moveContact(_0x49dd12)['catch'](loggerCatch(_0x2f9423));};exports[_0xfbcc('0x18')]=function(_0x2f2de7,_0x34bcec,_0x10d6a8){if(_0x34bcec){_0x2f2de7[_0xfbcc('0x19')]=null;}if(_0x10d6a8){_0x2f2de7[_0xfbcc('0x1a')]=![];}return BPromise[_0xfbcc('0xc')]()[_0xfbcc('0xd')](cmHopper['rescheduleContact'](_0x2f2de7))[_0xfbcc('0xf')](loggerCatch(_0xfbcc('0x1b')));};exports[_0xfbcc('0x1c')]=function(_0x49ccec){return BPromise[_0xfbcc('0xc')]()[_0xfbcc('0xd')](cmHopper[_0xfbcc('0x1c')](_0x49ccec))[_0xfbcc('0xf')](loggerCatch(_0xfbcc('0x1d')));};exports[_0xfbcc('0x1e')]=function(_0x12971b){return BPromise['resolve']()[_0xfbcc('0xd')](cmHopper[_0xfbcc('0x1e')]({'UserId':null},_0x12971b,0x1))['catch'](loggerCatch(_0xfbcc('0x1f')));};exports[_0xfbcc('0x20')]=function(_0x1e4a98){return BPromise[_0xfbcc('0xc')]()['then'](cmHopper[_0xfbcc('0x1e')]({'active':![]},_0x1e4a98,0x1))[_0xfbcc('0xf')](loggerCatch(_0xfbcc('0x21')));};exports[_0xfbcc('0x22')]=function(_0x131e09){var _0x3c100e={};_0x3c100e[_0xfbcc('0x23')]=_0x131e09[_0xfbcc('0x23')];_0x3c100e[_0xfbcc('0x24')]=_0x131e09['uniqueid'];_0x3c100e['calleridnum']=_0x131e09[_0xfbcc('0x25')];_0x3c100e[_0xfbcc('0x26')]=_0x131e09[_0xfbcc('0x26')];_0x3c100e[_0xfbcc('0x27')]=_0x131e09[_0xfbcc('0x27')];_0x3c100e[_0xfbcc('0x28')]=_0x131e09[_0xfbcc('0x29')];_0x3c100e[_0xfbcc('0x2a')]=_0x131e09[_0xfbcc('0x29')];_0x3c100e[_0xfbcc('0x2b')]=0x1;_0x3c100e['queuecallercompleteAt']=_0x131e09[_0xfbcc('0x2c')];_0x3c100e[_0xfbcc('0x2d')]=_0x131e09[_0xfbcc('0x2e')];_0x3c100e[_0xfbcc('0x2f')]=_0xfbcc('0x30');_0x3c100e[_0xfbcc('0x31')]=_0xfbcc('0x32');_0x3c100e[_0xfbcc('0x33')]=0x0;_0x3c100e[_0xfbcc('0x34')]=0x1;_0x3c100e[_0xfbcc('0x35')]=_0x131e09[_0xfbcc('0x2e')];_0x3c100e[_0xfbcc('0x36')]='COMPLETED';return BPromise[_0xfbcc('0xc')]()[_0xfbcc('0xd')](voiceQueueReport['create'](_0x3c100e))[_0xfbcc('0xf')](loggerCatch(_0xfbcc('0x37')));};exports[_0xfbcc('0x38')]=function(_0x359b9f,_0x34c08b){return BPromise['resolve']()[_0xfbcc('0xd')](cmHopper['getContactRecallMe'](_0x359b9f,_0x34c08b))[_0xfbcc('0xf')](loggerCatch(_0xfbcc('0x39')));};exports[_0xfbcc('0x3a')]=function(_0xc147d4){return BPromise[_0xfbcc('0xc')]()['then'](cmHopper[_0xfbcc('0x18')](_0xc147d4,!![],!![]))['catch'](loggerCatch(_0xfbcc('0x3b')));}; \ 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 a86b620..837b9b7 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 _0x6408=['isNil','Queue','name','calleridname','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','hasOwnProperty','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','logAgent','ringtime','logLookAgent','membername','UserId','logCustomer','endtime','talktime','answertime','isFailure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countcongestionretry','countagentrejectretry','cloneAction','clone','Global','scheduledAt','active','add','minutes','ContactId','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','reachable','push','getDiff','createBody','idContact','type','dialAnswer','scheduledat','countbusyretry','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','extractCalleridNumber','lodash','moment','../../../../config/logger','preview','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','logger','info','loggerError','inspect','logger2','getCallerId','isUndefined','isEmpty','string','\x22%s\x22\x20<%s>','format','isActive'];(function(_0x5660d5,_0x235c27){var _0x2a144d=function(_0x54fb3f){while(--_0x54fb3f){_0x5660d5['push'](_0x5660d5['shift']());}};_0x2a144d(++_0x235c27);}(_0x6408,0x1a9));var _0x8640=function(_0x5e7fa2,_0x2aa73b){_0x5e7fa2=_0x5e7fa2-0x0;var _0x509e85=_0x6408[_0x5e7fa2];return _0x509e85;};'use strict';var util=require('util');var _=require(_0x8640('0x0'));var moment=require(_0x8640('0x1'));var logger=require(_0x8640('0x2'))(_0x8640('0x3'));var ipAgi=process['env']['XCALLY_IP_AGI']||_0x8640('0x4');function getSeconds(_0x3bc7f0,_0x10e5f3){var _0x34bc76=moment(_0x3bc7f0)[_0x8640('0x5')](0x0);var _0x3e3a97=moment(_0x10e5f3)[_0x8640('0x5')](0x0);return _0x34bc76[_0x8640('0x6')](_0x3e3a97,_0x8640('0x7'));}exports[_0x8640('0x8')]=function(_0x2f1d29){return function(_0x1ca971){logger[_0x8640('0x9')](_0x2f1d29,util['inspect'](_0x1ca971,{'showHidden':![],'depth':null}));};};exports[_0x8640('0xa')]=function(_0x47ffdd,_0x1c79f1){logger[_0x8640('0xb')](_0x47ffdd,util['inspect'](_0x1c79f1,{'showHidden':![],'depth':null}));};exports[_0x8640('0xc')]=function(_0x58cc85,_0x536763){logger[_0x8640('0x9')](_0x58cc85,util[_0x8640('0xd')](_0x536763,{'showHidden':![],'depth':null}));};exports[_0x8640('0xe')]=function(_0x36add0){return function(_0x496ae5){logger[_0x8640('0xb')](_0x36add0,util['inspect'](_0x496ae5,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x1e5a6b,_0x3b4010,_0x25a0c1){return{'message':_0x1e5a6b,'unlock':_0x3b4010,'active':_0x25a0c1};};exports[_0x8640('0xf')]=function(_0x5b77cc,_0x318753,_0x4ad0aa){if(!_[_0x8640('0x10')](_0x4ad0aa)&&'string'===typeof _0x4ad0aa&&!_[_0x8640('0x11')](_0x4ad0aa)){if(!_[_0x8640('0x10')](_0x318753)&&_0x8640('0x12')===typeof _0x318753&&!_[_0x8640('0x11')](_0x318753)){return util['format'](_0x8640('0x13'),_0x318753,_0x4ad0aa);}return util[_0x8640('0x14')](_0x8640('0x13'),_0x4ad0aa,_0x4ad0aa);}if(!_[_0x8640('0x10')](_0x5b77cc)&&_0x8640('0x12')===typeof _0x5b77cc&&!_[_0x8640('0x11')](_0x5b77cc)){return _0x5b77cc;}return'\x22\x22\x20<>';};exports[_0x8640('0x15')]=function(_0x126d74){if(_[_0x8640('0x16')](_0x126d74)){return![];}return _0x126d74;};exports['addVariables']=function(_0xa80179,_0xd9411c,_0x5541d0,_0x9713c7,_0x12d9b9,_0x53fe4d){var _0x17c564={'XMD-QUEUE':_0xd9411c[_0x8640('0x17')]?_0xd9411c['Queue'][_0x8640('0x18')]:'','XMD-CALLERID':_0x9713c7,'XMD-CALLERID-PREVIEW':_0x53fe4d?util['format'](_0x8640('0x13'),_0x53fe4d[_0x8640('0x19')],_0x53fe4d['calleridnum']):_0x9713c7,'XMD-DIALID':_0x12d9b9,'XMD-CONTACTID':_0xd9411c['ContactId'],'XMD-CDRTYPE':_0x8640('0x1a'),'CALLERID(all)':_0x9713c7,'XMD-VOICEQUEUEID':_0xd9411c[_0x8640('0x1b')],'XMD-DIALCHANNEL':_0x5541d0,'XMD-DIALTIMEOUT':_0xa80179[_0x8640('0x1c')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x8640('0x1d'),_0xa80179[_0x8640('0x1e')]?'g':'',_[_0x8640('0x11')](_0xa80179[_0x8640('0x1f')])?'':_0x8640('0x20')),'XMD-DIALURL':_0xa80179['dialPreviewUrl']||'','XMD-AGI':_0xa80179[_0x8640('0x21')]?util[_0x8640('0x14')]('\x22agi://%s/square,%s\x22',ipAgi,_0xa80179[_0x8640('0x21')]):_0x8640('0x22'),'XMD-AGIAFTER':_0xa80179['dialQueueProject2']?util[_0x8640('0x14')](_0x8640('0x23'),ipAgi,_0xa80179[_0x8640('0x1e')]):_0x8640('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x53fe4d?_0x53fe4d[_0x8640('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x53fe4d?_0x53fe4d[_0x8640('0x25')]:'','XMD-DESTINATION':_0x8640('0x26')};if(!_[_0x8640('0x11')](_0xa80179['monitor_format'])){_0x17c564[util[_0x8640('0x14')]('%s',_0x8640('0x27'))]=_0xa80179['monitor_format'];_0x17c564[util[_0x8640('0x14')]('%s',_0x8640('0x28'))]=_0x12d9b9;}if(_0xd9411c&&_0xd9411c['Contact']){for(var _0x313976 in _0xd9411c['Contact']){if(_0xd9411c[_0x8640('0x29')]['hasOwnProperty'](_0x313976)){if(!_[_0x8640('0x16')](_0xd9411c[_0x8640('0x29')][_0x313976])&&_0x313976!=='id'&&_0x313976!==_0x8640('0x2a')&&_0x313976!==_0x8640('0x2b')&&_0x313976!==_0x8640('0x2c')){_0x17c564[util[_0x8640('0x14')](_0x8640('0x2d'),_0x8640('0x2e'),_[_0x8640('0x2f')](_0x313976))]=_0xd9411c[_0x8640('0x29')][_0x313976];}}}}return _0x17c564;};exports[_0x8640('0x30')]=function(_0x12beea){var _0x4016c9={};for(var _0x437ac2 in _0x12beea){if(_0x12beea[_0x8640('0x31')](_0x437ac2)){_0x4016c9[util['format']('%s',_['toLower'](_0x437ac2))]=_0x12beea[_0x437ac2];}}return{'variables':_0x4016c9};};exports[_0x8640('0x32')]=function(_0x29d052,_0x583b31){if(!_[_0x8640('0x16')](_0x29d052)){if(_0x29d052[_0x8640('0x31')](_0x8640('0x33'))){if(_0x29d052['originated']>0x0){_0x29d052[_0x8640('0x33')]-=0x1;}else{logger['error'](_0x8640('0x34'),_0x583b31);}}}else{logger[_0x8640('0x9')](_0x8640('0x35'),_0x583b31);}};exports[_0x8640('0x36')]=function(_0x1b142f){var _0x56de9f=moment()[_0x8640('0x14')](_0x8640('0x37'));_0x1b142f[_0x8640('0x38')]=0xd;_0x1b142f[_0x8640('0x39')]=_0x8640('0x3a');_0x1b142f[_0x8640('0x3b')]=_0x56de9f;_0x1b142f[_0x8640('0x3c')]=_0x56de9f;_0x1b142f['endtime']=_0x56de9f;};exports[_0x8640('0x3d')]=function(_0xc0b40d,_0x580ada,_0x388537){var _0x54edef=moment()[_0x8640('0x14')](_0x8640('0x37'));_0xc0b40d['state']=_0x580ada;_0xc0b40d['statedesc']=_0x388537;_0xc0b40d['responsetime']=_0x54edef;_0xc0b40d[_0x8640('0x3e')]=getSeconds(_0xc0b40d[_0x8640('0x3c')],_0xc0b40d[_0x8640('0x3b')]);};exports[_0x8640('0x3f')]=function(_0x200cb2,_0x51e06d,_0x277c47){_0x200cb2[_0x8640('0x40')]=_0x51e06d;_0x200cb2[_0x8640('0x41')]=_0x277c47;};exports[_0x8640('0x42')]=function(_0x161342,_0x4b117c,_0xee550b){var _0x364e89=moment()[_0x8640('0x14')](_0x8640('0x37'));_0x161342[_0x8640('0x38')]=_0x4b117c;_0x161342[_0x8640('0x39')]=_0xee550b;_0x161342[_0x8640('0x3c')]=_0x161342[_0x8640('0x3c')]?_0x161342[_0x8640('0x3c')]:_0x364e89;_0x161342[_0x8640('0x43')]=_0x161342['endtime']?_0x161342['endtime']:_0x364e89;_0x161342['ringtime']=getSeconds(_0x161342[_0x8640('0x3c')]||0x0,_0x161342[_0x8640('0x3b')]||0x0);_0x161342[_0x8640('0x44')]=_0x161342[_0x8640('0x45')]?getSeconds(_0x161342[_0x8640('0x43')],_0x161342['answertime']):0x0;};exports[_0x8640('0x46')]=function(_0x408c1b){return _0x408c1b==='Failure';};exports[_0x8640('0x47')]=function(_0x43c4df,_0xd9c026,_0x1215cc,_0x1b464b,_0x2e1876){var _0x19c33b=_0x1b464b?_0x8640('0x48'):_0x43c4df['calleridname'];_0x19c33b=_0x2e1876?_0x8640('0x49'):_0x19c33b;return{'actionid':_0x43c4df[_0x8640('0x4a')],'action':_0x8640('0x4b'),'channel':_0x43c4df[_0x8640('0x4c')],'callerid':util[_0x8640('0x14')]('\x22%s\x22\x20<%s>',_0x19c33b,_0x43c4df['calleridnum']),'Exten':_0x8640('0x26'),'Context':_0x8640('0x4d'),'Priority':'1','variable':_0x1215cc,'timeout':(_0xd9c026[_0x8640('0x4e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x43c4df['uniqueid']};};exports[_0x8640('0x4f')]=function(_0x5ca231){return _0x5ca231['countbusyretry']+_0x5ca231[_0x8640('0x50')]+_0x5ca231['countnoanswerretry']+_0x5ca231[_0x8640('0x51')]+_0x5ca231['countnosuchnumberretry'];};exports[_0x8640('0x52')]=function(_0x54e451){var _0x6a78f2=_[_0x8640('0x53')](_0x54e451);_0x6a78f2[_0x8640('0x38')]=0xf;_0x6a78f2[_0x8640('0x39')]=_0x8640('0x54');return _0x6a78f2;};exports[_0x8640('0x55')]=function(_0x4498f7,_0x5a28da,_0x5f2e7a){var _0x17927a={};_0x17927a[_0x5a28da]=_0x4498f7[_0x5a28da];_0x17927a[_0x8640('0x56')]=![];_0x17927a['scheduledat']=moment()[_0x8640('0x57')](_0x5f2e7a,_0x8640('0x58'))['format'](_0x8640('0x37'));_0x17927a[_0x8640('0x59')]=_0x4498f7[_0x8640('0x59')];_0x17927a['ListId']=_0x4498f7[_0x8640('0x5a')];_0x17927a[_0x8640('0x1b')]=_0x4498f7[_0x8640('0x1b')]||undefined;return _0x17927a;};exports['decrementTalkink']=function(_0x51688d,_0xeec73d){if(!_[_0x8640('0x16')](_0x51688d)){if(_0x51688d[_0x8640('0x5b')]>0x0){_0x51688d['pTalking']-=0x1;}else{logger[_0x8640('0x9')](_0xeec73d,_0x8640('0x5c'));}}else{logger[_0x8640('0x9')](_0xeec73d,_0x8640('0x5d'));}};exports[_0x8640('0x5e')]=function(_0x137210){if(_0x137210<=0x0){return!![];}return![];};exports[_0x8640('0x5f')]=function(_0x4c75bf,_0x1eab45,_0x1ffb1f){_0x4c75bf[_0x8640('0x60')]=_0x1eab45;_0x4c75bf[_0x8640('0x18')]=_0x4c75bf[_0x8640('0x61')];_0x4c75bf[_0x8640('0x62')]=_0x4c75bf[_0x8640('0x4c')];_0x4c75bf[_0x8640('0x63')]=_0x8640('0x64');if(_0x1ffb1f){_0x4c75bf['mandatoryDisposition']=_0x1ffb1f[_0x8640('0x65')];}return _0x4c75bf;};exports[_0x8640('0x66')]=function(_0x59ca05){var _0x2f966d={};_0x2f966d[_0x8640('0x61')]=_0x59ca05[_0x8640('0x61')];_0x2f966d[_0x8640('0x62')]=_0x59ca05[_0x8640('0x4c')];_0x2f966d['uniqueid']=_0x59ca05[_0x8640('0x4a')];return _0x2f966d;};exports[_0x8640('0x67')]=function(_0x4e95a9){var _0x388289=[];for(var _0x513d3e in _0x4e95a9){if(_0x4e95a9[_0x8640('0x31')](_0x513d3e)){if(!_['isNil'](_0x4e95a9[_0x513d3e])&&_0x4e95a9[_0x513d3e][_0x8640('0x38')]===_0x8640('0x68')&&_0x4e95a9[_0x513d3e][_0x8640('0x69')]===_0x8640('0x6a')){_0x388289[_0x8640('0x6b')](_0x4e95a9[_0x513d3e]['id']);}}}return _0x388289;};exports[_0x8640('0x6c')]=function(_0x37bc2e){var _0xae2d98=moment()['milliseconds'](0x0);var _0x413cfa=moment(_0x37bc2e)[_0x8640('0x5')](0x0);return _0xae2d98['diff'](_0x413cfa,_0x8640('0x7'));};exports[_0x8640('0x6d')]=function(_0x39b12f){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x39b12f['ContactId'],'ListId':_0x39b12f[_0x8640('0x5a')],'VoiceQueueId':_0x39b12f['VoiceQueueId']||undefined,'CampaignId':_0x39b12f['CampaignId']||undefined};};exports['filterKey']=function(_0xc2877d){if(_0xc2877d==='uniqueid'||_0xc2877d===_0x8640('0x6e')||_0xc2877d===_0x8640('0x61')||_0xc2877d===_0x8640('0x6f')||_0xc2877d==='campaigntype'||_0xc2877d===_0x8640('0x70')||_0xc2877d===_0x8640('0x40')||_0xc2877d===_0x8640('0x4c')||_0xc2877d===_0x8640('0x19')||_0xc2877d===_0x8640('0x56')||_0xc2877d==='calleridnum'||_0xc2877d===_0x8640('0x71')||_0xc2877d===_0x8640('0x72')||_0xc2877d===_0x8640('0x50')||_0xc2877d===_0x8640('0x73')||_0xc2877d===_0x8640('0x74')||_0xc2877d===_0x8640('0x75')||_0xc2877d===_0x8640('0x76')||_0xc2877d===_0x8640('0x77')||_0xc2877d===_0x8640('0x78')||_0xc2877d==='ContactId'||_0xc2877d===_0x8640('0x5a')||_0xc2877d===_0x8640('0x41')||_0xc2877d===_0x8640('0x1b')||_0xc2877d==='sipcallid'||_0xc2877d===_0x8640('0x79')||_0xc2877d===_0x8640('0x7a')||_0xc2877d==='xmd-phone'||_0xc2877d===_0x8640('0x7b')||_0xc2877d===_0x8640('0x7c')||_0xc2877d===_0x8640('0x7d')||_0xc2877d===_0x8640('0x7e')||_0xc2877d===_0x8640('0x7f')||_0xc2877d===_0x8640('0x80')||_0xc2877d===_0x8640('0x81')||_0xc2877d===_0x8640('0x82')||_0xc2877d==='xmd-callerid'||_0xc2877d===_0x8640('0x83')||_0xc2877d===_0x8640('0x84')||_0xc2877d===_0x8640('0x85')||_0xc2877d===_0x8640('0x86')||_0xc2877d===_0x8640('0x87')||_0xc2877d===_0x8640('0x88')||_0xc2877d===_0x8640('0x89')||_0xc2877d===_0x8640('0x8a')||_0xc2877d===_0x8640('0x8b')||_0xc2877d===_0x8640('0x8c')||_0xc2877d===_0x8640('0x85')||_0xc2877d===_0x8640('0x86')||_0xc2877d==='rtpaudioqosjitter'||_0xc2877d===_0x8640('0x88')||_0xc2877d==='rtpaudioqosloss'||_0xc2877d===_0x8640('0x8a')||_0xc2877d===_0x8640('0x8b')||_0xc2877d===_0x8640('0x8c')||_0xc2877d===_0x8640('0x8d')||_0xc2877d==='bridgepvtcallid'||_0xc2877d===_0x8640('0x38')||_0xc2877d===_0x8640('0x39')){return![];}return!![];};exports[_0x8640('0x8e')]=function(_0x1010cc,_0x1f0f93){var _0x2c1282,_0x334431,_0x5bd6f9;if(_0x1f0f93<=0x0){_0x1f0f93=0x1;}_0x2c1282=new RegExp(_0x8640('0x8f')+_0x1f0f93+'}$');_0x334431=Math[_0x8640('0x90')](0xa,_0x1f0f93-0x1);_0x5bd6f9=Math[_0x8640('0x90')](0xa,_0x1f0f93)-0x1;return util[_0x8640('0x14')]('%s',_[_0x8640('0x91')](_0x1010cc,_0x2c1282,_['random'](_0x334431,_0x5bd6f9)));};exports[_0x8640('0x92')]=function(_0x11b6e2){var _0xe25181=_0x11b6e2[_0x8640('0x93')](/"(.*?)"/);return _0xe25181?_0xe25181[0x1]:_0x11b6e2;};exports[_0x8640('0x94')]=function(_0xab4d9){var _0x4c8bf3=_0xab4d9[_0x8640('0x93')](/<(.*?)>/);return _0x4c8bf3?_0x4c8bf3[0x1]:_0xab4d9;}; \ No newline at end of file +var _0xebb0=['isNil','addVariables','Queue','name','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','statedesc','Blacklist','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','ringtime','starttime','logLookAgent','membername','UserId','logCustomer','isFailure','Failure','variablesAction','RECALL','calleridname','BOOKED','uniqueid','originate','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','add','minutes','ListId','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','channelAgent','motionChannel','voice','mandatoryDisposition','buildAcw','interface','agentReadyId','not_inuse','status','reachable','getDiff','diff','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','scheduledat','callback','callbackuniqueid','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','random','extractCalleridName','match','extractCalleridNumber','util','lodash','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','seconds','error','inspect','logger','info','loggerError','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>'];(function(_0xe719ec,_0x5a280e){var _0x4842a1=function(_0x59b968){while(--_0x59b968){_0xe719ec['push'](_0xe719ec['shift']());}};_0x4842a1(++_0x5a280e);}(_0xebb0,0x7f));var _0x0ebb=function(_0xa522f,_0x5debbc){_0xa522f=_0xa522f-0x0;var _0x2083b0=_0xebb0[_0xa522f];return _0x2083b0;};'use strict';var util=require(_0x0ebb('0x0'));var _=require(_0x0ebb('0x1'));var moment=require('moment');var logger=require(_0x0ebb('0x2'))(_0x0ebb('0x3'));var ipAgi=process[_0x0ebb('0x4')][_0x0ebb('0x5')]||_0x0ebb('0x6');function getSeconds(_0x2e5acb,_0x2b1c0d){var _0x24d1c3=moment(_0x2e5acb)[_0x0ebb('0x7')](0x0);var _0x65058d=moment(_0x2b1c0d)[_0x0ebb('0x7')](0x0);return _0x24d1c3['diff'](_0x65058d,_0x0ebb('0x8'));}exports['loggerCatch']=function(_0x563519){return function(_0x5367c8){logger[_0x0ebb('0x9')](_0x563519,util[_0x0ebb('0xa')](_0x5367c8,{'showHidden':![],'depth':null}));};};exports[_0x0ebb('0xb')]=function(_0xbe7a9f,_0x12abde){logger[_0x0ebb('0xc')](_0xbe7a9f,util[_0x0ebb('0xa')](_0x12abde,{'showHidden':![],'depth':null}));};exports[_0x0ebb('0xd')]=function(_0x270147,_0x49068c){logger['error'](_0x270147,util[_0x0ebb('0xa')](_0x49068c,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x456585){return function(_0x511957){logger[_0x0ebb('0xc')](_0x456585,util[_0x0ebb('0xa')](_0x511957,{'showHidden':![],'depth':null}));};};exports[_0x0ebb('0xe')]=function(_0x55a48b,_0x101f0f,_0x54fe89){return{'message':_0x55a48b,'unlock':_0x101f0f,'active':_0x54fe89};};exports[_0x0ebb('0xf')]=function(_0x5e2f7a,_0x413a20,_0x4438ec){if(!_[_0x0ebb('0x10')](_0x4438ec)&&_0x0ebb('0x11')===typeof _0x4438ec&&!_[_0x0ebb('0x12')](_0x4438ec)){if(!_[_0x0ebb('0x10')](_0x413a20)&&_0x0ebb('0x11')===typeof _0x413a20&&!_['isEmpty'](_0x413a20)){return util[_0x0ebb('0x13')](_0x0ebb('0x14'),_0x413a20,_0x4438ec);}return util[_0x0ebb('0x13')](_0x0ebb('0x14'),_0x4438ec,_0x4438ec);}if(!_['isUndefined'](_0x5e2f7a)&&_0x0ebb('0x11')===typeof _0x5e2f7a&&!_[_0x0ebb('0x12')](_0x5e2f7a)){return _0x5e2f7a;}return _0x0ebb('0x15');};exports['isActive']=function(_0x1f8af4){if(_[_0x0ebb('0x16')](_0x1f8af4)){return![];}return _0x1f8af4;};exports[_0x0ebb('0x17')]=function(_0x276adf,_0x32eeee,_0x49eb81,_0x322828,_0x54fea3,_0x173cd3){var _0x1d9e5e={'XMD-QUEUE':_0x32eeee[_0x0ebb('0x18')]?_0x32eeee['Queue'][_0x0ebb('0x19')]:'','XMD-CALLERID':_0x322828,'XMD-CALLERID-PREVIEW':_0x173cd3?util[_0x0ebb('0x13')](_0x0ebb('0x14'),_0x173cd3['calleridname'],_0x173cd3[_0x0ebb('0x1a')]):_0x322828,'XMD-DIALID':_0x54fea3,'XMD-CONTACTID':_0x32eeee[_0x0ebb('0x1b')],'XMD-CDRTYPE':_0x0ebb('0x1c'),'CALLERID(all)':_0x322828,'XMD-VOICEQUEUEID':_0x32eeee[_0x0ebb('0x1d')],'XMD-DIALCHANNEL':_0x49eb81,'XMD-DIALTIMEOUT':_0x276adf[_0x0ebb('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0x0ebb('0x13')](_0x0ebb('0x1f'),_0x276adf[_0x0ebb('0x20')]?'g':'',_['isEmpty'](_0x276adf[_0x0ebb('0x21')])?'':_0x0ebb('0x22')),'XMD-DIALURL':_0x276adf[_0x0ebb('0x23')]||'','XMD-AGI':_0x276adf[_0x0ebb('0x24')]?util[_0x0ebb('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x276adf[_0x0ebb('0x24')]):'NONE','XMD-AGIAFTER':_0x276adf[_0x0ebb('0x20')]?util['format'](_0x0ebb('0x25'),ipAgi,_0x276adf['dialQueueProject2']):_0x0ebb('0x26'),'XMD-ORIGINATECALLERIDNUM':_0x173cd3?_0x173cd3[_0x0ebb('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0x173cd3?_0x173cd3[_0x0ebb('0x28')]:'','XMD-DESTINATION':_0x0ebb('0x29')};if(!_[_0x0ebb('0x12')](_0x276adf['monitor_format'])){_0x1d9e5e[util['format']('%s',_0x0ebb('0x2a'))]=_0x276adf[_0x0ebb('0x21')];_0x1d9e5e[util['format']('%s',_0x0ebb('0x2b'))]=_0x54fea3;}if(_0x32eeee&&_0x32eeee[_0x0ebb('0x2c')]){for(var _0x280de1 in _0x32eeee[_0x0ebb('0x2c')]){if(_0x32eeee[_0x0ebb('0x2c')][_0x0ebb('0x2d')](_0x280de1)){if(!_['isNil'](_0x32eeee[_0x0ebb('0x2c')][_0x280de1])&&_0x280de1!=='id'&&_0x280de1!==_0x0ebb('0x2e')&&_0x280de1!==_0x0ebb('0x2f')&&_0x280de1!==_0x0ebb('0x30')){_0x1d9e5e[util[_0x0ebb('0x13')](_0x0ebb('0x31'),_0x0ebb('0x32'),_[_0x0ebb('0x33')](_0x280de1))]=_0x32eeee[_0x0ebb('0x2c')][_0x280de1];}}}}return _0x1d9e5e;};exports[_0x0ebb('0x34')]=function(_0x3e0e50){var _0x3b5ce5={};for(var _0x2a59b4 in _0x3e0e50){if(_0x3e0e50[_0x0ebb('0x2d')](_0x2a59b4)){_0x3b5ce5[util[_0x0ebb('0x13')]('%s',_['toLower'](_0x2a59b4))]=_0x3e0e50[_0x2a59b4];}}return{'variables':_0x3b5ce5};};exports[_0x0ebb('0x35')]=function(_0x23e519,_0x5b47ad){if(!_[_0x0ebb('0x16')](_0x23e519)){if(_0x23e519[_0x0ebb('0x2d')](_0x0ebb('0x36'))){if(_0x23e519[_0x0ebb('0x36')]>0x0){_0x23e519[_0x0ebb('0x36')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x5b47ad);}}}else{logger['error'](_0x0ebb('0x37'),_0x5b47ad);}};exports[_0x0ebb('0x38')]=function(_0x388c3f){var _0x49b67f=moment()[_0x0ebb('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x388c3f[_0x0ebb('0x39')]=0xd;_0x388c3f[_0x0ebb('0x3a')]=_0x0ebb('0x3b');_0x388c3f['starttime']=_0x49b67f;_0x388c3f[_0x0ebb('0x3c')]=_0x49b67f;_0x388c3f[_0x0ebb('0x3d')]=_0x49b67f;};exports[_0x0ebb('0x3e')]=function(_0x2d450b,_0x3ab591,_0x4844be){var _0x80f2ab=moment()[_0x0ebb('0x13')](_0x0ebb('0x3f'));_0x2d450b[_0x0ebb('0x39')]=_0x3ab591;_0x2d450b[_0x0ebb('0x3a')]=_0x4844be;_0x2d450b['responsetime']=_0x80f2ab;_0x2d450b[_0x0ebb('0x40')]=getSeconds(_0x2d450b[_0x0ebb('0x3c')],_0x2d450b[_0x0ebb('0x41')]);};exports[_0x0ebb('0x42')]=function(_0x524c6f,_0x2bb4ea,_0x281707){_0x524c6f[_0x0ebb('0x43')]=_0x2bb4ea;_0x524c6f[_0x0ebb('0x44')]=_0x281707;};exports[_0x0ebb('0x45')]=function(_0x418c74,_0x1a9624,_0x178c2b){var _0x18d0ac=moment()[_0x0ebb('0x13')](_0x0ebb('0x3f'));_0x418c74['state']=_0x1a9624;_0x418c74[_0x0ebb('0x3a')]=_0x178c2b;_0x418c74[_0x0ebb('0x3c')]=_0x418c74[_0x0ebb('0x3c')]?_0x418c74['responsetime']:_0x18d0ac;_0x418c74[_0x0ebb('0x3d')]=_0x418c74[_0x0ebb('0x3d')]?_0x418c74[_0x0ebb('0x3d')]:_0x18d0ac;_0x418c74[_0x0ebb('0x40')]=getSeconds(_0x418c74[_0x0ebb('0x3c')]||0x0,_0x418c74['starttime']||0x0);_0x418c74['talktime']=_0x418c74['answertime']?getSeconds(_0x418c74[_0x0ebb('0x3d')],_0x418c74['answertime']):0x0;};exports[_0x0ebb('0x46')]=function(_0x2308af){return _0x2308af===_0x0ebb('0x47');};exports[_0x0ebb('0x48')]=function(_0x5ca966,_0x34e683,_0x4bac5b,_0xe9a365,_0x4ff173){var _0x406053=_0xe9a365?_0x0ebb('0x49'):_0x5ca966[_0x0ebb('0x4a')];_0x406053=_0x4ff173?_0x0ebb('0x4b'):_0x406053;return{'actionid':_0x5ca966[_0x0ebb('0x4c')],'action':_0x0ebb('0x4d'),'channel':_0x5ca966['channelAgent'],'callerid':util[_0x0ebb('0x13')](_0x0ebb('0x14'),_0x406053,_0x5ca966[_0x0ebb('0x1a')]),'Exten':_0x0ebb('0x29'),'Context':'from-sip','Priority':'1','variable':_0x4bac5b,'timeout':(_0x34e683[_0x0ebb('0x4e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5ca966[_0x0ebb('0x4c')]};};exports[_0x0ebb('0x4f')]=function(_0x54a62d){return _0x54a62d[_0x0ebb('0x50')]+_0x54a62d[_0x0ebb('0x51')]+_0x54a62d[_0x0ebb('0x52')]+_0x54a62d[_0x0ebb('0x53')]+_0x54a62d[_0x0ebb('0x54')];};exports[_0x0ebb('0x55')]=function(_0x5a35e8){var _0x1b6ee9=_[_0x0ebb('0x56')](_0x5a35e8);_0x1b6ee9['state']=0xf;_0x1b6ee9[_0x0ebb('0x3a')]=_0x0ebb('0x57');return _0x1b6ee9;};exports[_0x0ebb('0x58')]=function(_0x25a663,_0x4d29eb,_0x3b0779){var _0x31376f={};_0x31376f[_0x4d29eb]=_0x25a663[_0x4d29eb];_0x31376f[_0x0ebb('0x59')]=![];_0x31376f['scheduledat']=moment()[_0x0ebb('0x5a')](_0x3b0779,_0x0ebb('0x5b'))[_0x0ebb('0x13')](_0x0ebb('0x3f'));_0x31376f[_0x0ebb('0x1b')]=_0x25a663[_0x0ebb('0x1b')];_0x31376f[_0x0ebb('0x5c')]=_0x25a663[_0x0ebb('0x5c')];_0x31376f[_0x0ebb('0x1d')]=_0x25a663['VoiceQueueId']||undefined;return _0x31376f;};exports['decrementTalkink']=function(_0x2c6952,_0x26dd02){if(!_['isNil'](_0x2c6952)){if(_0x2c6952['pTalking']>0x0){_0x2c6952[_0x0ebb('0x5d')]-=0x1;}else{logger[_0x0ebb('0x9')](_0x26dd02,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0x26dd02,_0x0ebb('0x5e'));}};exports[_0x0ebb('0x5f')]=function(_0x40890f){if(_0x40890f<=0x0){return!![];}return![];};exports[_0x0ebb('0x60')]=function(_0x4c1954,_0x383095,_0x35ca18){_0x4c1954[_0x0ebb('0x61')]=_0x383095;_0x4c1954[_0x0ebb('0x19')]=_0x4c1954[_0x0ebb('0x62')];_0x4c1954['interface']=_0x4c1954[_0x0ebb('0x63')];_0x4c1954[_0x0ebb('0x64')]=_0x0ebb('0x65');if(_0x35ca18){_0x4c1954[_0x0ebb('0x66')]=_0x35ca18[_0x0ebb('0x66')];}return _0x4c1954;};exports[_0x0ebb('0x67')]=function(_0x9367aa){var _0x2e53ef={};_0x2e53ef[_0x0ebb('0x62')]=_0x9367aa['queue'];_0x2e53ef[_0x0ebb('0x68')]=_0x9367aa[_0x0ebb('0x63')];_0x2e53ef[_0x0ebb('0x4c')]=_0x9367aa[_0x0ebb('0x4c')];return _0x2e53ef;};exports[_0x0ebb('0x69')]=function(_0x4d6898){var _0x5b154d=[];for(var _0x3f017c in _0x4d6898){if(_0x4d6898[_0x0ebb('0x2d')](_0x3f017c)){if(!_[_0x0ebb('0x16')](_0x4d6898[_0x3f017c])&&_0x4d6898[_0x3f017c][_0x0ebb('0x39')]===_0x0ebb('0x6a')&&_0x4d6898[_0x3f017c][_0x0ebb('0x6b')]===_0x0ebb('0x6c')){_0x5b154d['push'](_0x4d6898[_0x3f017c]['id']);}}}return _0x5b154d;};exports[_0x0ebb('0x6d')]=function(_0x273729){var _0x1bd333=moment()[_0x0ebb('0x7')](0x0);var _0xf17d17=moment(_0x273729)['milliseconds'](0x0);return _0x1bd333[_0x0ebb('0x6e')](_0xf17d17,_0x0ebb('0x8'));};exports[_0x0ebb('0x6f')]=function(_0x264f1d){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x264f1d['ContactId'],'ListId':_0x264f1d[_0x0ebb('0x5c')],'VoiceQueueId':_0x264f1d[_0x0ebb('0x1d')]||undefined,'CampaignId':_0x264f1d[_0x0ebb('0x70')]||undefined};};exports[_0x0ebb('0x71')]=function(_0x560495){if(_0x560495===_0x0ebb('0x4c')||_0x560495===_0x0ebb('0x72')||_0x560495===_0x0ebb('0x62')||_0x560495===_0x0ebb('0x73')||_0x560495===_0x0ebb('0x74')||_0x560495===_0x0ebb('0x75')||_0x560495===_0x0ebb('0x43')||_0x560495==='channelAgent'||_0x560495===_0x0ebb('0x4a')||_0x560495===_0x0ebb('0x59')||_0x560495===_0x0ebb('0x1a')||_0x560495===_0x0ebb('0x76')||_0x560495==='countbusyretry'||_0x560495===_0x0ebb('0x51')||_0x560495==='countnoanswerretry'||_0x560495==='countglobal'||_0x560495===_0x0ebb('0x77')||_0x560495===_0x0ebb('0x78')||_0x560495==='callbackat'||_0x560495==='recallme'||_0x560495==='ContactId'||_0x560495==='ListId'||_0x560495===_0x0ebb('0x44')||_0x560495===_0x0ebb('0x1d')||_0x560495===_0x0ebb('0x79')||_0x560495===_0x0ebb('0x7a')||_0x560495===_0x0ebb('0x7b')||_0x560495===_0x0ebb('0x7c')||_0x560495===_0x0ebb('0x7d')||_0x560495===_0x0ebb('0x7e')||_0x560495===_0x0ebb('0x7f')||_0x560495===_0x0ebb('0x80')||_0x560495==='xmd-dialid'||_0x560495===_0x0ebb('0x81')||_0x560495===_0x0ebb('0x82')||_0x560495===_0x0ebb('0x83')||_0x560495==='xmd-callerid'||_0x560495===_0x0ebb('0x84')||_0x560495===_0x0ebb('0x85')||_0x560495===_0x0ebb('0x86')||_0x560495===_0x0ebb('0x87')||_0x560495===_0x0ebb('0x88')||_0x560495==='rtpaudioqosjitterbridged'||_0x560495===_0x0ebb('0x89')||_0x560495===_0x0ebb('0x8a')||_0x560495===_0x0ebb('0x8b')||_0x560495===_0x0ebb('0x8c')||_0x560495===_0x0ebb('0x86')||_0x560495===_0x0ebb('0x87')||_0x560495===_0x0ebb('0x88')||_0x560495==='rtpaudioqosjitterbridged'||_0x560495==='rtpaudioqosloss'||_0x560495==='rtpaudioqoslossbridged'||_0x560495===_0x0ebb('0x8b')||_0x560495===_0x0ebb('0x8c')||_0x560495===_0x0ebb('0x8d')||_0x560495===_0x0ebb('0x8e')||_0x560495===_0x0ebb('0x39')||_0x560495==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x2262a0,_0x9ba19c){var _0x2ca0c1,_0x2c187a,_0x425e14;if(_0x9ba19c<=0x0){_0x9ba19c=0x1;}_0x2ca0c1=new RegExp(_0x0ebb('0x8f')+_0x9ba19c+'}$');_0x2c187a=Math['pow'](0xa,_0x9ba19c-0x1);_0x425e14=Math[_0x0ebb('0x90')](0xa,_0x9ba19c)-0x1;return util['format']('%s',_['replace'](_0x2262a0,_0x2ca0c1,_[_0x0ebb('0x91')](_0x2c187a,_0x425e14)));};exports[_0x0ebb('0x92')]=function(_0x16fd84){var _0x535975=_0x16fd84[_0x0ebb('0x93')](/"(.*?)"/);return _0x535975?_0x535975[0x1]:_0x16fd84;};exports[_0x0ebb('0x94')]=function(_0x1a7866){var _0x5e576d=_0x1a7866[_0x0ebb('0x93')](/<(.*?)>/);return _0x5e576d?_0x5e576d[0x1]:_0x1a7866;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 3fee61c..7e19918 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 _0xf960=['voicequeuechannelredirect','string','number','queueremove','queuepause','boolean','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup'];(function(_0x3ce0af,_0x33a353){var _0x49ada9=function(_0x39c566){while(--_0x39c566){_0x3ce0af['push'](_0x3ce0af['shift']());}};_0x49ada9(++_0x33a353);}(_0xf960,0xf1));var _0x0f96=function(_0x5a60ce,_0x48f080){_0x5a60ce=_0x5a60ce-0x0;var _0x393e5e=_0xf960[_0x5a60ce];return _0x393e5e;};'use strict';exports['queueadd']={'queue':{'type':_0x0f96('0x0'),'required':!![]},'interface':{'type':_0x0f96('0x0'),'required':!![]},'membername':{'type':_0x0f96('0x0'),'required':!![]},'penalty':{'type':_0x0f96('0x1'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0x0f96('0x2')]={'queue':{'type':_0x0f96('0x0'),'required':!![]},'interface':{'type':_0x0f96('0x0'),'required':!![]}};exports[_0x0f96('0x3')]={'interface':{'type':_0x0f96('0x0'),'required':!![]},'paused':{'type':_0x0f96('0x4')},'reason':{'type':_0x0f96('0x0'),'required':![]}};exports[_0x0f96('0x5')]={'module':{'type':_0x0f96('0x0'),'required':![]}};exports[_0x0f96('0x6')]={'uniqueid':{'type':_0x0f96('0x0'),'required':!![]}};exports[_0x0f96('0x7')]={'uniqueid':{'type':_0x0f96('0x0'),'required':!![]},'filename':{'type':_0x0f96('0x0')},'format':{'type':_0x0f96('0x0')},'mixmonitorid':{'type':_0x0f96('0x0')}};exports[_0x0f96('0x8')]={'uniqueid':{'type':_0x0f96('0x0'),'required':!![]}};exports[_0x0f96('0x9')]={'uniqueid':{'type':_0x0f96('0x0'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x0f96('0x0')}}; \ No newline at end of file +var _0x235a=['queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','boolean','queueremove'];(function(_0x435909,_0x30d85a){var _0x957660=function(_0x520531){while(--_0x520531){_0x435909['push'](_0x435909['shift']());}};_0x957660(++_0x30d85a);}(_0x235a,0x100));var _0xa235=function(_0x3ef4b5,_0x349d56){_0x3ef4b5=_0x3ef4b5-0x0;var _0x3efe69=_0x235a[_0x3ef4b5];return _0x3efe69;};'use strict';exports[_0xa235('0x0')]={'queue':{'type':_0xa235('0x1'),'required':!![]},'interface':{'type':_0xa235('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0xa235('0x2'),'required':![]}};exports[_0xa235('0x3')]={'queue':{'type':_0xa235('0x1'),'required':!![]},'interface':{'type':_0xa235('0x1'),'required':!![]}};exports[_0xa235('0x4')]={'interface':{'type':_0xa235('0x1'),'required':!![]},'paused':{'type':_0xa235('0x2')},'reason':{'type':'string','required':![]}};exports[_0xa235('0x5')]={'module':{'type':_0xa235('0x1'),'required':![]}};exports[_0xa235('0x6')]={'uniqueid':{'type':_0xa235('0x1'),'required':!![]}};exports[_0xa235('0x7')]={'uniqueid':{'type':_0xa235('0x1'),'required':!![]},'filename':{'type':_0xa235('0x1')},'format':{'type':_0xa235('0x1')},'mixmonitorid':{'type':'string'}};exports[_0xa235('0x8')]={'uniqueid':{'type':_0xa235('0x1'),'required':!![]}};exports[_0xa235('0x9')]={'uniqueid':{'type':_0xa235('0x1'),'required':!![]},'exten':{'type':_0xa235('0x1'),'required':!![]},'context':{'type':_0xa235('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 1185baf..e249edc 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 _0xf114=['salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','answered','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','length','isUndefined','initTelephones','mergeFromDatabase','initTrunks','trunks','initVoiceQueues','voiceQueues','zendeskAccounts','initFreshdeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','merge','initVoiceQueueReports','uniqueid','queuecallerexit','sumHoldTime','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','diff','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','util','lodash','../model/agent','../model/telephone','../model/voiceQueue','../model/campaign','../model/zendeskAccount','../model/freshdeskAccount','../model/zohoAccount','../model/servicenowAccount','../model/freshsalesAccount','agents','telephones','triggers','campaigns','templates','outbound','channels','queueChannels','outboundChannels','timers','settings'];(function(_0x5877b7,_0x57d044){var _0x3a22af=function(_0x44961b){while(--_0x44961b){_0x5877b7['push'](_0x5877b7['shift']());}};_0x3a22af(++_0x57d044);}(_0xf114,0x182));var _0x4f11=function(_0x5dfe07,_0x3c70d3){_0x5dfe07=_0x5dfe07-0x0;var _0x2f353c=_0xf114[_0x5dfe07];return _0x2f353c;};'use strict';var BPromise=require('bluebird');var util=require(_0x4f11('0x0'));var _=require(_0x4f11('0x1'));var moment=require('moment');var Agent=require(_0x4f11('0x2'));var Telephone=require(_0x4f11('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0x4f11('0x4'));var Trigger=require('../model/trigger');var Template=require('../model/template');var Campaign=require(_0x4f11('0x5'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x4f11('0x6'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x4f11('0x7'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x4f11('0x8'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0x4f11('0x9'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0x4f11('0xa'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x4f11('0xb')]={};this[_0x4f11('0xc')]={};this['trunks']={};this['voiceQueues']={};this[_0x4f11('0xd')]={};this[_0x4f11('0xe')]={};this[_0x4f11('0xf')]={};this[_0x4f11('0x10')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x4f11('0x11')]={};this[_0x4f11('0x12')]={};this[_0x4f11('0x13')]={};this[_0x4f11('0x14')]={};this[_0x4f11('0x15')]={};this['zendeskAccounts']={};this[_0x4f11('0x16')]={};this['sugarcrmAccounts']={};this[_0x4f11('0x17')]={};this[_0x4f11('0x18')]={};this[_0x4f11('0x19')]={};this[_0x4f11('0x1a')]={};this['servicenowAccounts']={};this[_0x4f11('0x1b')]={};this[_0x4f11('0x1c')]={};this[_0x4f11('0x1d')]={};};function freeIsNotKey(_0x28e21f,_0x5b607a,_0x912717){var _0x5bde04=_[_0x4f11('0x1e')](_0x28e21f,function(_0x10eeef,_0xd749fc){return _0x10eeef[_0x912717];});for(var _0x48211e in _0x5b607a){if(_0x5b607a[_0x4f11('0x1f')](_0x48211e)){if(!_0x5bde04[_0x48211e]){delete _0x5b607a[_0x48211e];}}}}function freeIsNotKeySip(_0x4f4575,_0x561b69){var _0x44b3af=_[_0x4f11('0x1e')](_0x4f4575,function(_0x2bbfe1,_0x29ec26){return util[_0x4f11('0x20')](_0x4f11('0x21'),_0x2bbfe1[_0x4f11('0x22')]);});for(var _0x242379 in _0x561b69){if(_0x561b69[_0x4f11('0x1f')](_0x242379)){if(!_0x44b3af[_0x242379]){delete _0x561b69[_0x242379];}}}}function freeIsNotKeyAgent(_0x12c2d2,_0x4c74bb){var _0x10c11a=_[_0x4f11('0x1e')](_0x12c2d2,function(_0x14145b,_0x5b2fb3){var _0x462c4b=_[_0x4f11('0x23')](_0x14145b['interface'])?util['format'](_0x4f11('0x21'),_0x14145b[_0x4f11('0x22')]):_0x14145b[_0x4f11('0x24')];return _0x462c4b;});for(var _0x5a9f63 in _0x4c74bb){if(_0x4c74bb[_0x4f11('0x1f')](_0x5a9f63)){if(!_0x10c11a[_0x5a9f63]){delete _0x4c74bb[_0x5a9f63];}}}}function clearVoiceCallReports(_0x141011){_0x141011[_0x4f11('0x25')]=0x0;_0x141011[_0x4f11('0x26')]=0x0;_0x141011['sumHoldTime']=0x0;_0x141011[_0x4f11('0x27')]=0x0;_0x141011[_0x4f11('0x28')]=0x0;}function clearCampaigns(_0x359d50){if(!_[_0x4f11('0x29')](_0x359d50)){for(var _0x1d699c in _0x359d50){if(_0x359d50[_0x4f11('0x1f')](_0x1d699c)){_0x359d50[_0x1d699c][_0x4f11('0x2a')]=0x0;_0x359d50[_0x1d699c][_0x4f11('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x4812e1){if(!_['isEmpty'](_0x4812e1)){for(var _0xa96dfd in _0x4812e1){if(_0x4812e1[_0x4f11('0x1f')](_0xa96dfd)){_0x4812e1[_0xa96dfd][_0x4f11('0x25')]=0x0;_0x4812e1[_0xa96dfd][_0x4f11('0x26')]=0x0;_0x4812e1[_0xa96dfd][_0x4f11('0x2c')]=0x0;_0x4812e1[_0xa96dfd][_0x4f11('0x2d')]=0x0;_0x4812e1[_0xa96dfd]['sumHoldTime']=0x0;_0x4812e1[_0xa96dfd][_0x4f11('0x27')]=0x0;_0x4812e1[_0xa96dfd][_0x4f11('0x28')]=0x0;_0x4812e1[_0xa96dfd]['outboundAnswerAgiCallsDay']=0x0;_0x4812e1[_0xa96dfd][_0x4f11('0x2e')]=0x0;_0x4812e1[_0xa96dfd][_0x4f11('0x2f')]=0x0;_0x4812e1[_0xa96dfd][_0x4f11('0x30')]=0x0;_0x4812e1[_0xa96dfd][_0x4f11('0x31')]=0x0;_0x4812e1[_0xa96dfd]['outboundUnknownCallsDay']=0x0;_0x4812e1[_0xa96dfd][_0x4f11('0x32')]=0x0;_0x4812e1[_0xa96dfd][_0x4f11('0x33')]=0x0;_0x4812e1[_0xa96dfd][_0x4f11('0x34')]=0x0;_0x4812e1[_0xa96dfd]['outboundOriginateFailureCallsDay']=0x0;_0x4812e1[_0xa96dfd]['outboundRejectCallsDay']=0x0;_0x4812e1[_0xa96dfd][_0x4f11('0x35')]=0x0;_0x4812e1[_0xa96dfd][_0x4f11('0x36')]=0x0;_0x4812e1[_0xa96dfd][_0x4f11('0x37')]=0x0;_0x4812e1[_0xa96dfd][_0x4f11('0x38')]=!![];}}}}Realtime[_0x4f11('0x39')]['mergeFromDatabase']=function(_0x1736c7,_0x6d1ee4){for(var _0x48d33e in _0x6d1ee4){if(_0x1736c7[_0x4f11('0x1f')](_0x48d33e)){_0x1736c7[_0x48d33e]=_0x6d1ee4[_0x48d33e];}}};Realtime[_0x4f11('0x39')][_0x4f11('0x3a')]=function(){var _0x217906=this;return function(_0x1f50e7){if(_0x1f50e7){freeIsNotKeyAgent(_0x1f50e7,_0x217906[_0x4f11('0xb')]);for(var _0x3031f5=0x0,_0x352b69={},_0x24cb9a={};_0x3031f5<_0x1f50e7[_0x4f11('0x3b')];_0x3031f5+=0x1){_0x352b69=_0x1f50e7[_0x3031f5];var _0x2f1b7e=_[_0x4f11('0x23')](_0x352b69[_0x4f11('0x24')])?util[_0x4f11('0x20')](_0x4f11('0x21'),_0x352b69['name']):_0x352b69['interface'];if(_[_0x4f11('0x3c')](_0x217906[_0x4f11('0xb')][_0x2f1b7e])){_0x217906[_0x4f11('0xb')][_0x2f1b7e]=new Agent(_0x352b69);}else{_0x217906['mergeFromDatabase'](_0x217906['agents'][_0x2f1b7e],_0x352b69);}}}return _0x217906[_0x4f11('0xb')];};};Realtime[_0x4f11('0x39')][_0x4f11('0x3d')]=function(){var _0x42f505=this;return function(_0x3f247d){if(_0x3f247d){freeIsNotKeySip(_0x3f247d,_0x42f505[_0x4f11('0xc')]);for(var _0x3c5df6=0x0,_0x2de421={},_0x45cff2={};_0x3c5df6<_0x3f247d[_0x4f11('0x3b')];_0x3c5df6+=0x1){_0x2de421=_0x3f247d[_0x3c5df6];if(_[_0x4f11('0x3c')](_0x42f505['telephones'][util[_0x4f11('0x20')](_0x4f11('0x21'),_0x2de421[_0x4f11('0x22')])])){_0x42f505['telephones'][util[_0x4f11('0x20')]('SIP/%s',_0x2de421[_0x4f11('0x22')])]=new Telephone(_0x2de421);}else{_0x42f505[_0x4f11('0x3e')](_0x42f505[_0x4f11('0xc')][util[_0x4f11('0x20')]('SIP/%s',_0x2de421['name'])],_0x2de421);}}}return _0x42f505[_0x4f11('0xc')];};};Realtime[_0x4f11('0x39')][_0x4f11('0x3f')]=function(){var _0xf99807=this;return function(_0xa9b58a){if(_0xa9b58a){freeIsNotKeySip(_0xa9b58a,_0xf99807['trunks']);for(var _0x121e00=0x0,_0x588a25={},_0x37cae1={};_0x121e00<_0xa9b58a['length'];_0x121e00+=0x1){_0x588a25=_0xa9b58a[_0x121e00];if(_['isUndefined'](_0xf99807[_0x4f11('0x40')][util[_0x4f11('0x20')]('SIP/%s',_0x588a25[_0x4f11('0x22')])])){_0xf99807[_0x4f11('0x40')][util[_0x4f11('0x20')](_0x4f11('0x21'),_0x588a25['name'])]=new Trunk(_0x588a25);}else{_0xf99807[_0x4f11('0x3e')](_0xf99807[_0x4f11('0x40')][util['format']('SIP/%s',_0x588a25[_0x4f11('0x22')])],_0x588a25);}}}return _0xf99807[_0x4f11('0x40')];};};Realtime[_0x4f11('0x39')][_0x4f11('0x41')]=function(){var _0xa86d6c=this;return function(_0x2e6ef6){if(_0x2e6ef6){freeIsNotKey(_0x2e6ef6,_0xa86d6c[_0x4f11('0x42')],_0x4f11('0x22'));for(var _0x4f4f9b=0x0,_0x3b0af5={},_0x44a082={};_0x4f4f9b<_0x2e6ef6['length'];_0x4f4f9b+=0x1){_0x3b0af5=_0x2e6ef6[_0x4f4f9b];if(_[_0x4f11('0x3c')](_0xa86d6c[_0x4f11('0x42')][_0x3b0af5[_0x4f11('0x22')]])){_0xa86d6c[_0x4f11('0x42')][_0x3b0af5['name']]=new VoiceQueue(_0x3b0af5);}else{_0xa86d6c['mergeFromDatabase'](_0xa86d6c[_0x4f11('0x42')][_0x3b0af5[_0x4f11('0x22')]],_0x3b0af5);}}}return _0xa86d6c[_0x4f11('0x42')];};};Realtime[_0x4f11('0x39')]['initTriggers']=function(){var _0x47717a=this;return function(_0xfa1d55){if(_0xfa1d55){freeIsNotKey(_0xfa1d55,_0x47717a[_0x4f11('0xd')],'id');for(var _0x493cbf=0x0,_0x2aaafb={},_0x52e4b9={};_0x493cbf<_0xfa1d55['length'];_0x493cbf+=0x1){_0x2aaafb=_0xfa1d55[_0x493cbf];if(_['isUndefined'](_0x47717a[_0x4f11('0xd')][_0x2aaafb['id']])){_0x47717a[_0x4f11('0xd')][_0x2aaafb['id']]=new Trigger(_0x2aaafb);}else{_0x47717a[_0x4f11('0x3e')](_0x47717a[_0x4f11('0xd')][_0x2aaafb['id']],_0x2aaafb);}}}return _0x47717a[_0x4f11('0xd')];};};Realtime['prototype']['initTemplates']=function(){var _0x175f75=this;return function(_0x560f34){if(_0x560f34){freeIsNotKey(_0x560f34,_0x175f75[_0x4f11('0xf')],'id');for(var _0x3773c4=0x0,_0x4964ab={},_0x13456c={};_0x3773c4<_0x560f34[_0x4f11('0x3b')];_0x3773c4+=0x1){_0x4964ab=_0x560f34[_0x3773c4];if(_[_0x4f11('0x3c')](_0x175f75[_0x4f11('0xf')][_0x4964ab['id']])){_0x175f75['templates'][_0x4964ab['id']]=new Template(_0x4964ab);}else{_0x175f75[_0x4f11('0x3e')](_0x175f75[_0x4f11('0xf')][_0x4964ab['id']],_0x4964ab);}}}return _0x175f75[_0x4f11('0xf')];};};Realtime[_0x4f11('0x39')]['initZendeskAccounts']=function(){var _0x2126f6=this;return function(_0x305a90){if(_0x305a90){freeIsNotKey(_0x305a90,_0x2126f6[_0x4f11('0x43')],'id');for(var _0x28b7b1=0x0,_0x386259={},_0x1215d6={};_0x28b7b1<_0x305a90['length'];_0x28b7b1+=0x1){_0x386259=_0x305a90[_0x28b7b1];if(_['isUndefined'](_0x2126f6['zendeskAccounts'][_0x386259['id']])){_0x2126f6[_0x4f11('0x43')][_0x386259['id']]=new ZendeskAccount(_0x386259);}else{_0x2126f6[_0x4f11('0x3e')](_0x2126f6[_0x4f11('0x43')][_0x386259['id']],_0x386259);}}}return _0x2126f6['zendeskAccounts'];};};Realtime[_0x4f11('0x39')]['initSalesforceAccounts']=function(){var _0x2596e0=this;return function(_0x59d2b9){if(_0x59d2b9){freeIsNotKey(_0x59d2b9,_0x2596e0[_0x4f11('0x16')],'id');for(var _0x23b376=0x0,_0x4197e0={},_0x3230f8={};_0x23b376<_0x59d2b9[_0x4f11('0x3b')];_0x23b376+=0x1){_0x4197e0=_0x59d2b9[_0x23b376];if(_[_0x4f11('0x3c')](_0x2596e0[_0x4f11('0x16')][_0x4197e0['id']])){_0x2596e0[_0x4f11('0x16')][_0x4197e0['id']]=new SalesforceAccount(_0x4197e0);}else{_0x2596e0[_0x4f11('0x3e')](_0x2596e0[_0x4f11('0x16')][_0x4197e0['id']],_0x4197e0);}}}return _0x2596e0[_0x4f11('0x16')];};};Realtime[_0x4f11('0x39')][_0x4f11('0x44')]=function(){var _0x25f96a=this;return function(_0xe3f128){if(_0xe3f128){freeIsNotKey(_0xe3f128,_0x25f96a[_0x4f11('0x17')],'id');for(var _0x1bb9a0=0x0,_0x5edb96={},_0x1c9855={};_0x1bb9a0<_0xe3f128[_0x4f11('0x3b')];_0x1bb9a0+=0x1){_0x5edb96=_0xe3f128[_0x1bb9a0];if(_[_0x4f11('0x3c')](_0x25f96a['freshdeskAccounts'][_0x5edb96['id']])){_0x25f96a[_0x4f11('0x17')][_0x5edb96['id']]=new FreshdeskAccount(_0x5edb96);}else{_0x25f96a[_0x4f11('0x3e')](_0x25f96a[_0x4f11('0x17')][_0x5edb96['id']],_0x5edb96);}}}return _0x25f96a[_0x4f11('0x17')];};};Realtime[_0x4f11('0x39')]['initZohoAccounts']=function(){var _0x5b878a=this;return function(_0xacfe6e){if(_0xacfe6e){freeIsNotKey(_0xacfe6e,_0x5b878a[_0x4f11('0x18')],'id');for(var _0x3c4529=0x0,_0x413373={},_0x35a810={};_0x3c4529<_0xacfe6e[_0x4f11('0x3b')];_0x3c4529+=0x1){_0x413373=_0xacfe6e[_0x3c4529];if(_[_0x4f11('0x3c')](_0x5b878a[_0x4f11('0x18')][_0x413373['id']])){_0x5b878a['zohoAccounts'][_0x413373['id']]=new ZohoAccount(_0x413373);}else{_0x5b878a[_0x4f11('0x3e')](_0x5b878a['zohoAccounts'][_0x413373['id']],_0x413373);}}}return _0x5b878a[_0x4f11('0x18')];};};Realtime[_0x4f11('0x39')]['initDeskAccounts']=function(){var _0x196b64=this;return function(_0x325fe8){if(_0x325fe8){freeIsNotKey(_0x325fe8,_0x196b64['deskAccounts'],'id');for(var _0x3efb25=0x0,_0x456eb3={},_0x18f539={};_0x3efb25<_0x325fe8[_0x4f11('0x3b')];_0x3efb25+=0x1){_0x456eb3=_0x325fe8[_0x3efb25];if(_[_0x4f11('0x3c')](_0x196b64['deskAccounts'][_0x456eb3['id']])){_0x196b64[_0x4f11('0x19')][_0x456eb3['id']]=new DeskAccount(_0x456eb3);}else{_0x196b64[_0x4f11('0x3e')](_0x196b64[_0x4f11('0x19')][_0x456eb3['id']],_0x456eb3);}}}return _0x196b64['deskAccounts'];};};Realtime[_0x4f11('0x39')][_0x4f11('0x45')]=function(){var _0x5e2861=this;return function(_0x2f61e8){if(_0x2f61e8){freeIsNotKey(_0x2f61e8,_0x5e2861[_0x4f11('0x46')],'id');for(var _0x15c804=0x0,_0x516ada={},_0x458f2f={};_0x15c804<_0x2f61e8['length'];_0x15c804+=0x1){_0x516ada=_0x2f61e8[_0x15c804];if(_[_0x4f11('0x3c')](_0x5e2861[_0x4f11('0x46')][_0x516ada['id']])){_0x5e2861['sugarcrmAccounts'][_0x516ada['id']]=new SugarcrmAccount(_0x516ada);}else{_0x5e2861['mergeFromDatabase'](_0x5e2861[_0x4f11('0x46')][_0x516ada['id']],_0x516ada);}}}return _0x5e2861[_0x4f11('0x46')];};};Realtime['prototype'][_0x4f11('0x47')]=function(){var _0x45eed7=this;return function(_0x230754){if(_0x230754){freeIsNotKey(_0x230754,_0x45eed7[_0x4f11('0x1a')],'id');for(var _0x31437d=0x0,_0x421ebd={},_0x5448ed={};_0x31437d<_0x230754[_0x4f11('0x3b')];_0x31437d+=0x1){_0x421ebd=_0x230754[_0x31437d];if(_[_0x4f11('0x3c')](_0x45eed7[_0x4f11('0x1a')][_0x421ebd['id']])){_0x45eed7[_0x4f11('0x1a')][_0x421ebd['id']]=new VtigerAccount(_0x421ebd);}else{_0x45eed7[_0x4f11('0x3e')](_0x45eed7['vtigerAccounts'][_0x421ebd['id']],_0x421ebd);}}}return _0x45eed7[_0x4f11('0x1a')];};};Realtime['prototype'][_0x4f11('0x48')]=function(){var _0x515175=this;return function(_0x506f82){if(_0x506f82){freeIsNotKey(_0x506f82,_0x515175['servicenowAccounts'],'id');for(var _0x444926=0x0,_0x1e2056={},_0x2aaee8={};_0x444926<_0x506f82[_0x4f11('0x3b')];_0x444926+=0x1){_0x1e2056=_0x506f82[_0x444926];if(_[_0x4f11('0x3c')](_0x515175['servicenowAccounts'][_0x1e2056['id']])){_0x515175[_0x4f11('0x49')][_0x1e2056['id']]=new ServicenowAccount(_0x1e2056);}else{_0x515175['mergeFromDatabase'](_0x515175['servicenowAccounts'][_0x1e2056['id']],_0x1e2056);}}}return _0x515175[_0x4f11('0x49')];};};Realtime[_0x4f11('0x39')][_0x4f11('0x4a')]=function(){var _0x8fad82=this;return function(_0x4a33ab){if(_0x4a33ab){freeIsNotKey(_0x4a33ab,_0x8fad82[_0x4f11('0x1b')],'id');for(var _0x5a0e24=0x0,_0x339cac={},_0x5b94aa={};_0x5a0e24<_0x4a33ab[_0x4f11('0x3b')];_0x5a0e24+=0x1){_0x339cac=_0x4a33ab[_0x5a0e24];if(_[_0x4f11('0x3c')](_0x8fad82[_0x4f11('0x1b')][_0x339cac['id']])){_0x8fad82[_0x4f11('0x1b')][_0x339cac['id']]=new Dynamics365Account(_0x339cac);}else{_0x8fad82[_0x4f11('0x3e')](_0x8fad82[_0x4f11('0x1b')][_0x339cac['id']],_0x339cac);}}}return _0x8fad82['dynamics365Accounts'];};};Realtime[_0x4f11('0x39')][_0x4f11('0x4b')]=function(){var _0x20d380=this;return function(_0x5f0a95){if(_0x5f0a95){freeIsNotKey(_0x5f0a95,_0x20d380[_0x4f11('0x1c')],'id');for(var _0x3a06ef=0x0,_0x2b30ab={},_0x1e8308={};_0x3a06ef<_0x5f0a95[_0x4f11('0x3b')];_0x3a06ef+=0x1){_0x2b30ab=_0x5f0a95[_0x3a06ef];if(_['isUndefined'](_0x20d380[_0x4f11('0x1c')][_0x2b30ab['id']])){_0x20d380[_0x4f11('0x1c')][_0x2b30ab['id']]=new FreshsalesAccount(_0x2b30ab);}else{_0x20d380[_0x4f11('0x3e')](_0x20d380[_0x4f11('0x1c')][_0x2b30ab['id']],_0x2b30ab);}}}return _0x20d380[_0x4f11('0x1c')];};};Realtime[_0x4f11('0x39')]['initVoiceQueueHopperHistory']=function(){var _0x1302cb=this;return function(_0x36a089){for(var _0x9a0646=0x0;_0x9a0646<_0x36a089[_0x4f11('0x3b')];_0x9a0646+=0x1){_[_0x4f11('0x4c')](_0x1302cb[_0x4f11('0x42')][_0x36a089[_0x9a0646][_0x4f11('0x22')]],_0x36a089[_0x9a0646]);}return _0x1302cb[_0x4f11('0x42')];};};Realtime[_0x4f11('0x39')][_0x4f11('0x4d')]=function(){var _0xa14ef6=this;return function(_0x1c6874){clearVoiceQueues(_0xa14ef6[_0x4f11('0x42')]);if(_0x1c6874){_0x1c6874=_['groupBy'](_0x1c6874,_0x4f11('0x4e'));for(var _0x4c20af in _0x1c6874){if(_0x1c6874[_0x4f11('0x1f')](_0x4c20af)){var _0xb17567={};for(var _0xb7f282=0x0;_0xb7f282<_0x1c6874[_0x4c20af]['length'];_0xb7f282+=0x1){var _0x21397d=_0x1c6874[_0x4c20af][_0xb7f282]['queue'];if(_0xa14ef6[_0x4f11('0x42')][_0x21397d]){if(_0x1c6874[_0x4c20af][_0xb7f282][_0x4f11('0x4f')]){_0xa14ef6[_0x4f11('0x42')][_0x21397d][_0x4f11('0x2c')]+=0x1;}if(_0x1c6874[_0x4c20af][_0xb7f282]['queuecallerabandon']){_0xa14ef6[_0x4f11('0x42')][_0x21397d][_0x4f11('0x2d')]+=0x1;}_0xa14ef6[_0x4f11('0x42')][_0x21397d][_0x4f11('0x50')]+=moment(_0x1c6874[_0x4c20af][_0xb7f282][_0x4f11('0x51')])['diff'](moment(_0x1c6874[_0x4c20af][_0xb7f282][_0x4f11('0x52')]),_0x4f11('0x53'))||0x0;if(_0xb7f282===_0x1c6874[_0x4c20af]['length']-0x1){_0xa14ef6[_0x4f11('0x42')][_0x21397d]['sumDuration']+=moment(_0x1c6874[_0x4c20af][_0xb7f282][_0x4f11('0x54')]||_0x1c6874[_0x4c20af][_0xb7f282][_0x4f11('0x55')]||_0x1c6874[_0x4c20af][_0xb7f282][_0x4f11('0x56')])['diff'](moment(_0x1c6874[_0x4c20af][_0xb7f282]['queuecallerjoinAt']),_0x4f11('0x53'))||0x0;_0xa14ef6['voiceQueues'][_0x21397d][_0x4f11('0x25')]+=0x1;if(_0x1c6874[_0x4c20af][_0xb7f282][_0x4f11('0x57')]){_0xa14ef6[_0x4f11('0x42')][_0x21397d]['answered']+=0x1;_0xa14ef6[_0x4f11('0x42')][_0x21397d][_0x4f11('0x28')]+=moment(_0x1c6874[_0x4c20af][_0xb7f282][_0x4f11('0x54')])[_0x4f11('0x58')](moment(_0x1c6874[_0x4c20af][_0xb7f282]['queuecallerleaveAt']),_0x4f11('0x53'))||0x0;}}else{_0xa14ef6[_0x4f11('0x42')][_0x21397d][_0x4f11('0x27')]+=_0xa14ef6['voiceQueues'][_0x21397d][_0x4f11('0x50')]||0x0;}}}}}}return _0xa14ef6[_0x4f11('0x42')];};};Realtime[_0x4f11('0x39')][_0x4f11('0x59')]=function(){var _0x19e76b=this;return function(_0x1b2f82){clearVoiceCallReports(_0x19e76b[_0x4f11('0x10')]);if(_0x1b2f82){for(var _0x5651fb=0x0;_0x5651fb<_0x1b2f82['length'];_0x5651fb+=0x1){_0x19e76b[_0x4f11('0x10')][_0x4f11('0x25')]+=0x1;_0x19e76b[_0x4f11('0x10')][_0x4f11('0x27')]+=_0x1b2f82[_0x5651fb][_0x4f11('0x5a')];if(_0x1b2f82[_0x5651fb][_0x4f11('0x5b')]===_0x4f11('0x5c')){_0x19e76b[_0x4f11('0x10')]['answered']+=0x1;_0x19e76b['outbound']['sumHoldTime']+=_0x1b2f82[_0x5651fb][_0x4f11('0x5a')]-_0x1b2f82[_0x5651fb][_0x4f11('0x5d')]||0x0;_0x19e76b[_0x4f11('0x10')][_0x4f11('0x28')]+=_0x1b2f82[_0x5651fb][_0x4f11('0x5d')];}}}return _0x19e76b[_0x4f11('0x10')];};};Realtime['prototype'][_0x4f11('0x5e')]=function(){var _0x5ad6ff=this;return function(_0x42c424){if(_0x42c424){freeIsNotKey(_0x42c424,_0x5ad6ff[_0x4f11('0xe')],_0x4f11('0x22'));for(var _0x2ff97f=0x0,_0x332af7={};_0x2ff97f<_0x42c424[_0x4f11('0x3b')];_0x2ff97f+=0x1){_0x332af7=_0x42c424[_0x2ff97f];if(_[_0x4f11('0x3c')](_0x5ad6ff[_0x4f11('0xe')][_0x332af7[_0x4f11('0x22')]])){_0x5ad6ff[_0x4f11('0xe')][_0x332af7[_0x4f11('0x22')]]=new Campaign(_0x332af7);}else{_0x5ad6ff[_0x4f11('0x3e')](_0x5ad6ff['campaigns'][_0x332af7[_0x4f11('0x22')]],_0x332af7);_0x5ad6ff[_0x4f11('0xe')][_0x332af7[_0x4f11('0x22')]][_0x4f11('0x5f')]=_0x332af7[_0x4f11('0x60')]?_0x332af7[_0x4f11('0x60')]['name']:undefined;}}}return _0x5ad6ff[_0x4f11('0xe')];};};Realtime[_0x4f11('0x39')][_0x4f11('0x61')]=function(){var _0xf08aed=this;return function(_0x452fa5){if(_0x452fa5){freeIsNotKey(_0x452fa5,_0xf08aed[_0x4f11('0x62')],'id');for(var _0x4a1f0e=0x0,_0x530dc4={};_0x4a1f0e<_0x452fa5[_0x4f11('0x3b')];_0x4a1f0e+=0x1){_0x530dc4=_0x452fa5[_0x4a1f0e];if(_[_0x4f11('0x3c')](_0xf08aed['voiceExtensions'][_0x530dc4['id']])){_0xf08aed['voiceExtensions'][_0x530dc4['id']]=new VoiceExtension(_0x530dc4);}else{_0xf08aed[_0x4f11('0x3e')](_0xf08aed[_0x4f11('0x62')][_0x530dc4['id']],_0x530dc4);}}}return _0xf08aed[_0x4f11('0x62')];};};Realtime[_0x4f11('0x39')][_0x4f11('0x63')]=function(){var _0x500039=this;return function(_0x1c87f7){clearCampaigns(_0x500039[_0x4f11('0xe')]);for(var _0xbf61f1=0x0;_0xbf61f1<_0x1c87f7[_0x4f11('0x3b')];_0xbf61f1+=0x1){_[_0x4f11('0x4c')](_0x500039[_0x4f11('0xe')][_0x1c87f7[_0xbf61f1][_0x4f11('0x22')]],_0x1c87f7[_0xbf61f1]);}return _0x500039['campaigns'];};};Realtime[_0x4f11('0x39')][_0x4f11('0x64')]=function(){var _0x3e7db4=this;return function(_0x31ef35){if(_0x31ef35){freeIsNotKey(_0x31ef35,_0x3e7db4[_0x4f11('0x1d')],'id');for(var _0x501ae3=0x0,_0x222f26={},_0x2940d1={};_0x501ae3<_0x31ef35[_0x4f11('0x3b')];_0x501ae3+=0x1){_0x222f26=_0x31ef35[_0x501ae3];if(_['isUndefined'](_0x3e7db4[_0x4f11('0x1d')][_0x222f26['id']])){_0x3e7db4['faxAccounts'][_0x222f26['id']]=new FaxAccount(_0x222f26);}else{_0x3e7db4['mergeFromDatabase'](_0x3e7db4[_0x4f11('0x1d')][_0x222f26['id']],_0x222f26);}}}return _0x3e7db4[_0x4f11('0x1d')];};};module[_0x4f11('0x65')]=Realtime; \ No newline at end of file +var _0x8331=['../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','voiceQueues','campaigns','channels','queueChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','hasOwnProperty','mapKeys','format','SIP/%s','name','interface','answered','sumHoldTime','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','abandoned','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','prototype','mergeFromDatabase','initAgents','length','isNil','isUndefined','initTelephones','telephones','trunks','initVoiceQueues','triggers','initTemplates','templates','initZendeskAccounts','initSalesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','merge','initVoiceQueueReports','groupBy','queue','queuecallerexit','unmanaged','queuecallerleaveAt','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','sumBillable','diff','initVoiceCallReports','outbound','disposition','ANSWERED','duration','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initFaxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/zendeskAccount'];(function(_0x44fc3f,_0x4774d1){var _0x926ba3=function(_0x2af2a9){while(--_0x2af2a9){_0x44fc3f['push'](_0x44fc3f['shift']());}};_0x926ba3(++_0x4774d1);}(_0x8331,0xd1));var _0x1833=function(_0x1f83a5,_0x59843f){_0x1f83a5=_0x1f83a5-0x0;var _0x45edf0=_0x8331[_0x1f83a5];return _0x45edf0;};'use strict';var BPromise=require(_0x1833('0x0'));var util=require(_0x1833('0x1'));var _=require(_0x1833('0x2'));var moment=require(_0x1833('0x3'));var Agent=require(_0x1833('0x4'));var Telephone=require(_0x1833('0x5'));var Trunk=require(_0x1833('0x6'));var VoiceQueue=require(_0x1833('0x7'));var Trigger=require(_0x1833('0x8'));var Template=require(_0x1833('0x9'));var Campaign=require('../model/campaign');var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x1833('0xa'));var SalesforceAccount=require(_0x1833('0xb'));var FreshdeskAccount=require(_0x1833('0xc'));var SugarcrmAccount=require(_0x1833('0xd'));var ZohoAccount=require(_0x1833('0xe'));var DeskAccount=require(_0x1833('0xf'));var VtigerAccount=require(_0x1833('0x10'));var ServicenowAccount=require(_0x1833('0x11'));var Dynamics365Account=require(_0x1833('0x12'));var FreshsalesAccount=require(_0x1833('0x13'));var FaxAccount=require(_0x1833('0x14'));var Realtime=function(){this[_0x1833('0x15')]={};this['telephones']={};this['trunks']={};this[_0x1833('0x16')]={};this['triggers']={};this[_0x1833('0x17')]={};this['templates']={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x1833('0x18')]={};this[_0x1833('0x19')]={};this['outboundChannels']={};this['timers']={};this[_0x1833('0x1a')]={};this[_0x1833('0x1b')]={};this[_0x1833('0x1c')]={};this[_0x1833('0x1d')]={};this[_0x1833('0x1e')]={};this[_0x1833('0x1f')]={};this[_0x1833('0x20')]={};this[_0x1833('0x21')]={};this[_0x1833('0x22')]={};this[_0x1833('0x23')]={};this[_0x1833('0x24')]={};this[_0x1833('0x25')]={};};function freeIsNotKey(_0x280e95,_0x301885,_0x65af72){var _0x4d32dc=_['mapKeys'](_0x280e95,function(_0x20b99b,_0x4840ce){return _0x20b99b[_0x65af72];});for(var _0x2f6afc in _0x301885){if(_0x301885[_0x1833('0x26')](_0x2f6afc)){if(!_0x4d32dc[_0x2f6afc]){delete _0x301885[_0x2f6afc];}}}}function freeIsNotKeySip(_0x2eba96,_0x41a2f6){var _0x149b2f=_[_0x1833('0x27')](_0x2eba96,function(_0x166673,_0x59c449){return util[_0x1833('0x28')](_0x1833('0x29'),_0x166673[_0x1833('0x2a')]);});for(var _0x245a5b in _0x41a2f6){if(_0x41a2f6['hasOwnProperty'](_0x245a5b)){if(!_0x149b2f[_0x245a5b]){delete _0x41a2f6[_0x245a5b];}}}}function freeIsNotKeyAgent(_0x481f82,_0x4859a5){var _0x5c2589=_['mapKeys'](_0x481f82,function(_0x2e1085,_0x1225ce){var _0x1c8f27=_['isNil'](_0x2e1085[_0x1833('0x2b')])?util[_0x1833('0x28')]('SIP/%s',_0x2e1085[_0x1833('0x2a')]):_0x2e1085[_0x1833('0x2b')];return _0x1c8f27;});for(var _0x2a3ef9 in _0x4859a5){if(_0x4859a5[_0x1833('0x26')](_0x2a3ef9)){if(!_0x5c2589[_0x2a3ef9]){delete _0x4859a5[_0x2a3ef9];}}}}function clearVoiceCallReports(_0x357dd2){_0x357dd2['total']=0x0;_0x357dd2[_0x1833('0x2c')]=0x0;_0x357dd2[_0x1833('0x2d')]=0x0;_0x357dd2[_0x1833('0x2e')]=0x0;_0x357dd2['sumBillable']=0x0;}function clearCampaigns(_0x16348a){if(!_[_0x1833('0x2f')](_0x16348a)){for(var _0x9baf27 in _0x16348a){if(_0x16348a[_0x1833('0x26')](_0x9baf27)){_0x16348a[_0x9baf27][_0x1833('0x30')]=0x0;_0x16348a[_0x9baf27][_0x1833('0x31')]=0x0;}}}}function clearVoiceQueues(_0x175cde){if(!_[_0x1833('0x2f')](_0x175cde)){for(var _0x4f811d in _0x175cde){if(_0x175cde[_0x1833('0x26')](_0x4f811d)){_0x175cde[_0x4f811d][_0x1833('0x32')]=0x0;_0x175cde[_0x4f811d][_0x1833('0x2c')]=0x0;_0x175cde[_0x4f811d]['unmanaged']=0x0;_0x175cde[_0x4f811d][_0x1833('0x33')]=0x0;_0x175cde[_0x4f811d][_0x1833('0x2d')]=0x0;_0x175cde[_0x4f811d][_0x1833('0x2e')]=0x0;_0x175cde[_0x4f811d]['sumBillable']=0x0;_0x175cde[_0x4f811d]['outboundAnswerAgiCallsDay']=0x0;_0x175cde[_0x4f811d]['outboundNoAnswerCallsDay']=0x0;_0x175cde[_0x4f811d][_0x1833('0x34')]=0x0;_0x175cde[_0x4f811d][_0x1833('0x35')]=0x0;_0x175cde[_0x4f811d][_0x1833('0x36')]=0x0;_0x175cde[_0x4f811d]['outboundUnknownCallsDay']=0x0;_0x175cde[_0x4f811d][_0x1833('0x37')]=0x0;_0x175cde[_0x4f811d][_0x1833('0x38')]=0x0;_0x175cde[_0x4f811d][_0x1833('0x39')]=0x0;_0x175cde[_0x4f811d][_0x1833('0x3a')]=0x0;_0x175cde[_0x4f811d][_0x1833('0x3b')]=0x0;_0x175cde[_0x4f811d][_0x1833('0x3c')]=0x0;_0x175cde[_0x4f811d][_0x1833('0x3d')]=0x0;_0x175cde[_0x4f811d]['outboundAnswerCallsDay']=0x0;_0x175cde[_0x4f811d]['queueStatusComplete']=!![];}}}}Realtime[_0x1833('0x3e')][_0x1833('0x3f')]=function(_0x2d1e3e,_0x4d7bdf){for(var _0x20ccd7 in _0x4d7bdf){if(_0x2d1e3e['hasOwnProperty'](_0x20ccd7)){_0x2d1e3e[_0x20ccd7]=_0x4d7bdf[_0x20ccd7];}}};Realtime['prototype'][_0x1833('0x40')]=function(){var _0x196107=this;return function(_0x4e9352){if(_0x4e9352){freeIsNotKeyAgent(_0x4e9352,_0x196107[_0x1833('0x15')]);for(var _0x37fd95=0x0,_0x4df4bd={},_0xb1f6c8={};_0x37fd95<_0x4e9352[_0x1833('0x41')];_0x37fd95+=0x1){_0x4df4bd=_0x4e9352[_0x37fd95];var _0x15c9c8=_[_0x1833('0x42')](_0x4df4bd['interface'])?util['format']('SIP/%s',_0x4df4bd[_0x1833('0x2a')]):_0x4df4bd['interface'];if(_[_0x1833('0x43')](_0x196107['agents'][_0x15c9c8])){_0x196107[_0x1833('0x15')][_0x15c9c8]=new Agent(_0x4df4bd);}else{_0x196107[_0x1833('0x3f')](_0x196107['agents'][_0x15c9c8],_0x4df4bd);}}}return _0x196107['agents'];};};Realtime['prototype'][_0x1833('0x44')]=function(){var _0x302499=this;return function(_0x39c99e){if(_0x39c99e){freeIsNotKeySip(_0x39c99e,_0x302499['telephones']);for(var _0x236f97=0x0,_0x579dff={},_0x144037={};_0x236f97<_0x39c99e[_0x1833('0x41')];_0x236f97+=0x1){_0x579dff=_0x39c99e[_0x236f97];if(_[_0x1833('0x43')](_0x302499[_0x1833('0x45')][util['format'](_0x1833('0x29'),_0x579dff[_0x1833('0x2a')])])){_0x302499[_0x1833('0x45')][util[_0x1833('0x28')](_0x1833('0x29'),_0x579dff[_0x1833('0x2a')])]=new Telephone(_0x579dff);}else{_0x302499[_0x1833('0x3f')](_0x302499[_0x1833('0x45')][util[_0x1833('0x28')]('SIP/%s',_0x579dff[_0x1833('0x2a')])],_0x579dff);}}}return _0x302499['telephones'];};};Realtime[_0x1833('0x3e')]['initTrunks']=function(){var _0x29e23c=this;return function(_0x42c56d){if(_0x42c56d){freeIsNotKeySip(_0x42c56d,_0x29e23c['trunks']);for(var _0x166715=0x0,_0x372b8f={},_0x3d8d33={};_0x166715<_0x42c56d[_0x1833('0x41')];_0x166715+=0x1){_0x372b8f=_0x42c56d[_0x166715];if(_[_0x1833('0x43')](_0x29e23c[_0x1833('0x46')][util[_0x1833('0x28')]('SIP/%s',_0x372b8f[_0x1833('0x2a')])])){_0x29e23c[_0x1833('0x46')][util['format'](_0x1833('0x29'),_0x372b8f[_0x1833('0x2a')])]=new Trunk(_0x372b8f);}else{_0x29e23c[_0x1833('0x3f')](_0x29e23c['trunks'][util[_0x1833('0x28')]('SIP/%s',_0x372b8f['name'])],_0x372b8f);}}}return _0x29e23c['trunks'];};};Realtime[_0x1833('0x3e')][_0x1833('0x47')]=function(){var _0x191de2=this;return function(_0x58799c){if(_0x58799c){freeIsNotKey(_0x58799c,_0x191de2['voiceQueues'],_0x1833('0x2a'));for(var _0x261667=0x0,_0x36a471={},_0x399bbf={};_0x261667<_0x58799c['length'];_0x261667+=0x1){_0x36a471=_0x58799c[_0x261667];if(_[_0x1833('0x43')](_0x191de2[_0x1833('0x16')][_0x36a471[_0x1833('0x2a')]])){_0x191de2[_0x1833('0x16')][_0x36a471[_0x1833('0x2a')]]=new VoiceQueue(_0x36a471);}else{_0x191de2[_0x1833('0x3f')](_0x191de2[_0x1833('0x16')][_0x36a471['name']],_0x36a471);}}}return _0x191de2[_0x1833('0x16')];};};Realtime[_0x1833('0x3e')]['initTriggers']=function(){var _0x176944=this;return function(_0x540880){if(_0x540880){freeIsNotKey(_0x540880,_0x176944[_0x1833('0x48')],'id');for(var _0x11a897=0x0,_0x4b7a6c={},_0x1a9a7b={};_0x11a897<_0x540880[_0x1833('0x41')];_0x11a897+=0x1){_0x4b7a6c=_0x540880[_0x11a897];if(_[_0x1833('0x43')](_0x176944[_0x1833('0x48')][_0x4b7a6c['id']])){_0x176944[_0x1833('0x48')][_0x4b7a6c['id']]=new Trigger(_0x4b7a6c);}else{_0x176944[_0x1833('0x3f')](_0x176944[_0x1833('0x48')][_0x4b7a6c['id']],_0x4b7a6c);}}}return _0x176944[_0x1833('0x48')];};};Realtime['prototype'][_0x1833('0x49')]=function(){var _0x5373a2=this;return function(_0x57ea99){if(_0x57ea99){freeIsNotKey(_0x57ea99,_0x5373a2[_0x1833('0x4a')],'id');for(var _0x5e5e8c=0x0,_0x5dfdd7={},_0x2f28a7={};_0x5e5e8c<_0x57ea99[_0x1833('0x41')];_0x5e5e8c+=0x1){_0x5dfdd7=_0x57ea99[_0x5e5e8c];if(_[_0x1833('0x43')](_0x5373a2[_0x1833('0x4a')][_0x5dfdd7['id']])){_0x5373a2[_0x1833('0x4a')][_0x5dfdd7['id']]=new Template(_0x5dfdd7);}else{_0x5373a2[_0x1833('0x3f')](_0x5373a2[_0x1833('0x4a')][_0x5dfdd7['id']],_0x5dfdd7);}}}return _0x5373a2[_0x1833('0x4a')];};};Realtime[_0x1833('0x3e')][_0x1833('0x4b')]=function(){var _0x486558=this;return function(_0x2f9e4d){if(_0x2f9e4d){freeIsNotKey(_0x2f9e4d,_0x486558[_0x1833('0x1b')],'id');for(var _0x2e8948=0x0,_0x5ac845={},_0x1e1fda={};_0x2e8948<_0x2f9e4d[_0x1833('0x41')];_0x2e8948+=0x1){_0x5ac845=_0x2f9e4d[_0x2e8948];if(_[_0x1833('0x43')](_0x486558[_0x1833('0x1b')][_0x5ac845['id']])){_0x486558[_0x1833('0x1b')][_0x5ac845['id']]=new ZendeskAccount(_0x5ac845);}else{_0x486558[_0x1833('0x3f')](_0x486558['zendeskAccounts'][_0x5ac845['id']],_0x5ac845);}}}return _0x486558[_0x1833('0x1b')];};};Realtime['prototype'][_0x1833('0x4c')]=function(){var _0xd1b6c5=this;return function(_0x5c68ec){if(_0x5c68ec){freeIsNotKey(_0x5c68ec,_0xd1b6c5[_0x1833('0x1c')],'id');for(var _0x67098b=0x0,_0x2a756e={},_0x39e540={};_0x67098b<_0x5c68ec[_0x1833('0x41')];_0x67098b+=0x1){_0x2a756e=_0x5c68ec[_0x67098b];if(_[_0x1833('0x43')](_0xd1b6c5[_0x1833('0x1c')][_0x2a756e['id']])){_0xd1b6c5[_0x1833('0x1c')][_0x2a756e['id']]=new SalesforceAccount(_0x2a756e);}else{_0xd1b6c5[_0x1833('0x3f')](_0xd1b6c5['salesforceAccounts'][_0x2a756e['id']],_0x2a756e);}}}return _0xd1b6c5[_0x1833('0x1c')];};};Realtime[_0x1833('0x3e')]['initFreshdeskAccounts']=function(){var _0x33d311=this;return function(_0x18a4b7){if(_0x18a4b7){freeIsNotKey(_0x18a4b7,_0x33d311[_0x1833('0x1e')],'id');for(var _0x277564=0x0,_0x324350={},_0xa2e49={};_0x277564<_0x18a4b7['length'];_0x277564+=0x1){_0x324350=_0x18a4b7[_0x277564];if(_[_0x1833('0x43')](_0x33d311['freshdeskAccounts'][_0x324350['id']])){_0x33d311['freshdeskAccounts'][_0x324350['id']]=new FreshdeskAccount(_0x324350);}else{_0x33d311['mergeFromDatabase'](_0x33d311['freshdeskAccounts'][_0x324350['id']],_0x324350);}}}return _0x33d311[_0x1833('0x1e')];};};Realtime[_0x1833('0x3e')][_0x1833('0x4d')]=function(){var _0x26083a=this;return function(_0xf23ee7){if(_0xf23ee7){freeIsNotKey(_0xf23ee7,_0x26083a[_0x1833('0x1f')],'id');for(var _0x2254ae=0x0,_0x150ae2={},_0x5b9a4d={};_0x2254ae<_0xf23ee7[_0x1833('0x41')];_0x2254ae+=0x1){_0x150ae2=_0xf23ee7[_0x2254ae];if(_['isUndefined'](_0x26083a[_0x1833('0x1f')][_0x150ae2['id']])){_0x26083a[_0x1833('0x1f')][_0x150ae2['id']]=new ZohoAccount(_0x150ae2);}else{_0x26083a[_0x1833('0x3f')](_0x26083a[_0x1833('0x1f')][_0x150ae2['id']],_0x150ae2);}}}return _0x26083a[_0x1833('0x1f')];};};Realtime['prototype'][_0x1833('0x4e')]=function(){var _0x1a0e26=this;return function(_0x559ca6){if(_0x559ca6){freeIsNotKey(_0x559ca6,_0x1a0e26['deskAccounts'],'id');for(var _0x37a0bf=0x0,_0x9da098={},_0x186142={};_0x37a0bf<_0x559ca6[_0x1833('0x41')];_0x37a0bf+=0x1){_0x9da098=_0x559ca6[_0x37a0bf];if(_[_0x1833('0x43')](_0x1a0e26[_0x1833('0x20')][_0x9da098['id']])){_0x1a0e26[_0x1833('0x20')][_0x9da098['id']]=new DeskAccount(_0x9da098);}else{_0x1a0e26['mergeFromDatabase'](_0x1a0e26[_0x1833('0x20')][_0x9da098['id']],_0x9da098);}}}return _0x1a0e26[_0x1833('0x20')];};};Realtime[_0x1833('0x3e')][_0x1833('0x4f')]=function(){var _0xc04587=this;return function(_0x3453c8){if(_0x3453c8){freeIsNotKey(_0x3453c8,_0xc04587[_0x1833('0x1d')],'id');for(var _0x635722=0x0,_0x4f44d9={},_0x30f5f6={};_0x635722<_0x3453c8['length'];_0x635722+=0x1){_0x4f44d9=_0x3453c8[_0x635722];if(_[_0x1833('0x43')](_0xc04587['sugarcrmAccounts'][_0x4f44d9['id']])){_0xc04587['sugarcrmAccounts'][_0x4f44d9['id']]=new SugarcrmAccount(_0x4f44d9);}else{_0xc04587['mergeFromDatabase'](_0xc04587[_0x1833('0x1d')][_0x4f44d9['id']],_0x4f44d9);}}}return _0xc04587[_0x1833('0x1d')];};};Realtime[_0x1833('0x3e')][_0x1833('0x50')]=function(){var _0x274aa3=this;return function(_0x2bedbc){if(_0x2bedbc){freeIsNotKey(_0x2bedbc,_0x274aa3[_0x1833('0x21')],'id');for(var _0x8ba8fd=0x0,_0x153fb0={},_0x4f76ff={};_0x8ba8fd<_0x2bedbc[_0x1833('0x41')];_0x8ba8fd+=0x1){_0x153fb0=_0x2bedbc[_0x8ba8fd];if(_[_0x1833('0x43')](_0x274aa3[_0x1833('0x21')][_0x153fb0['id']])){_0x274aa3['vtigerAccounts'][_0x153fb0['id']]=new VtigerAccount(_0x153fb0);}else{_0x274aa3[_0x1833('0x3f')](_0x274aa3[_0x1833('0x21')][_0x153fb0['id']],_0x153fb0);}}}return _0x274aa3['vtigerAccounts'];};};Realtime['prototype'][_0x1833('0x51')]=function(){var _0x43154d=this;return function(_0x227581){if(_0x227581){freeIsNotKey(_0x227581,_0x43154d[_0x1833('0x22')],'id');for(var _0x5903e1=0x0,_0x2b6e09={},_0x27f1ed={};_0x5903e1<_0x227581[_0x1833('0x41')];_0x5903e1+=0x1){_0x2b6e09=_0x227581[_0x5903e1];if(_[_0x1833('0x43')](_0x43154d[_0x1833('0x22')][_0x2b6e09['id']])){_0x43154d['servicenowAccounts'][_0x2b6e09['id']]=new ServicenowAccount(_0x2b6e09);}else{_0x43154d['mergeFromDatabase'](_0x43154d[_0x1833('0x22')][_0x2b6e09['id']],_0x2b6e09);}}}return _0x43154d['servicenowAccounts'];};};Realtime[_0x1833('0x3e')][_0x1833('0x52')]=function(){var _0x3f9e09=this;return function(_0x47fe06){if(_0x47fe06){freeIsNotKey(_0x47fe06,_0x3f9e09[_0x1833('0x23')],'id');for(var _0x29108c=0x0,_0x307e0d={},_0x2dce45={};_0x29108c<_0x47fe06['length'];_0x29108c+=0x1){_0x307e0d=_0x47fe06[_0x29108c];if(_[_0x1833('0x43')](_0x3f9e09['dynamics365Accounts'][_0x307e0d['id']])){_0x3f9e09[_0x1833('0x23')][_0x307e0d['id']]=new Dynamics365Account(_0x307e0d);}else{_0x3f9e09[_0x1833('0x3f')](_0x3f9e09[_0x1833('0x23')][_0x307e0d['id']],_0x307e0d);}}}return _0x3f9e09['dynamics365Accounts'];};};Realtime[_0x1833('0x3e')][_0x1833('0x53')]=function(){var _0x244376=this;return function(_0x9ec1a0){if(_0x9ec1a0){freeIsNotKey(_0x9ec1a0,_0x244376['freshsalesAccounts'],'id');for(var _0x3e25fc=0x0,_0x502f53={},_0x379553={};_0x3e25fc<_0x9ec1a0[_0x1833('0x41')];_0x3e25fc+=0x1){_0x502f53=_0x9ec1a0[_0x3e25fc];if(_[_0x1833('0x43')](_0x244376[_0x1833('0x24')][_0x502f53['id']])){_0x244376['freshsalesAccounts'][_0x502f53['id']]=new FreshsalesAccount(_0x502f53);}else{_0x244376[_0x1833('0x3f')](_0x244376[_0x1833('0x24')][_0x502f53['id']],_0x502f53);}}}return _0x244376[_0x1833('0x24')];};};Realtime['prototype']['initVoiceQueueHopperHistory']=function(){var _0x392c00=this;return function(_0x3902bf){for(var _0x5421bc=0x0;_0x5421bc<_0x3902bf['length'];_0x5421bc+=0x1){_[_0x1833('0x54')](_0x392c00[_0x1833('0x16')][_0x3902bf[_0x5421bc][_0x1833('0x2a')]],_0x3902bf[_0x5421bc]);}return _0x392c00[_0x1833('0x16')];};};Realtime[_0x1833('0x3e')][_0x1833('0x55')]=function(){var _0x19c874=this;return function(_0x5e3818){clearVoiceQueues(_0x19c874[_0x1833('0x16')]);if(_0x5e3818){_0x5e3818=_[_0x1833('0x56')](_0x5e3818,'uniqueid');for(var _0xf7a0ac in _0x5e3818){if(_0x5e3818[_0x1833('0x26')](_0xf7a0ac)){var _0x55c9a1={};for(var _0x49c279=0x0;_0x49c279<_0x5e3818[_0xf7a0ac][_0x1833('0x41')];_0x49c279+=0x1){var _0x1d4a37=_0x5e3818[_0xf7a0ac][_0x49c279][_0x1833('0x57')];if(_0x19c874[_0x1833('0x16')][_0x1d4a37]){if(_0x5e3818[_0xf7a0ac][_0x49c279][_0x1833('0x58')]){_0x19c874[_0x1833('0x16')][_0x1d4a37][_0x1833('0x59')]+=0x1;}if(_0x5e3818[_0xf7a0ac][_0x49c279]['queuecallerabandon']){_0x19c874[_0x1833('0x16')][_0x1d4a37][_0x1833('0x33')]+=0x1;}_0x19c874[_0x1833('0x16')][_0x1d4a37][_0x1833('0x2d')]+=moment(_0x5e3818[_0xf7a0ac][_0x49c279][_0x1833('0x5a')])['diff'](moment(_0x5e3818[_0xf7a0ac][_0x49c279]['queuecallerjoinAt']),_0x1833('0x5b'))||0x0;if(_0x49c279===_0x5e3818[_0xf7a0ac][_0x1833('0x41')]-0x1){_0x19c874[_0x1833('0x16')][_0x1d4a37][_0x1833('0x2e')]+=moment(_0x5e3818[_0xf7a0ac][_0x49c279]['queuecallercompleteAt']||_0x5e3818[_0xf7a0ac][_0x49c279][_0x1833('0x5c')]||_0x5e3818[_0xf7a0ac][_0x49c279][_0x1833('0x5d')])['diff'](moment(_0x5e3818[_0xf7a0ac][_0x49c279][_0x1833('0x5e')]),'seconds')||0x0;_0x19c874[_0x1833('0x16')][_0x1d4a37][_0x1833('0x32')]+=0x1;if(_0x5e3818[_0xf7a0ac][_0x49c279][_0x1833('0x5f')]){_0x19c874[_0x1833('0x16')][_0x1d4a37]['answered']+=0x1;_0x19c874[_0x1833('0x16')][_0x1d4a37][_0x1833('0x60')]+=moment(_0x5e3818[_0xf7a0ac][_0x49c279]['queuecallercompleteAt'])[_0x1833('0x61')](moment(_0x5e3818[_0xf7a0ac][_0x49c279][_0x1833('0x5a')]),_0x1833('0x5b'))||0x0;}}else{_0x19c874[_0x1833('0x16')][_0x1d4a37][_0x1833('0x2e')]+=_0x19c874[_0x1833('0x16')][_0x1d4a37][_0x1833('0x2d')]||0x0;}}}}}}return _0x19c874[_0x1833('0x16')];};};Realtime[_0x1833('0x3e')][_0x1833('0x62')]=function(){var _0x3f9cf6=this;return function(_0x40299c){clearVoiceCallReports(_0x3f9cf6[_0x1833('0x63')]);if(_0x40299c){for(var _0x4b4234=0x0;_0x4b4234<_0x40299c[_0x1833('0x41')];_0x4b4234+=0x1){_0x3f9cf6['outbound'][_0x1833('0x32')]+=0x1;_0x3f9cf6[_0x1833('0x63')]['sumDuration']+=_0x40299c[_0x4b4234]['duration'];if(_0x40299c[_0x4b4234][_0x1833('0x64')]===_0x1833('0x65')){_0x3f9cf6[_0x1833('0x63')]['answered']+=0x1;_0x3f9cf6[_0x1833('0x63')]['sumHoldTime']+=_0x40299c[_0x4b4234][_0x1833('0x66')]-_0x40299c[_0x4b4234][_0x1833('0x67')]||0x0;_0x3f9cf6['outbound'][_0x1833('0x60')]+=_0x40299c[_0x4b4234][_0x1833('0x67')];}}}return _0x3f9cf6[_0x1833('0x63')];};};Realtime[_0x1833('0x3e')]['initCampaigns']=function(){var _0x413370=this;return function(_0x1a104d){if(_0x1a104d){freeIsNotKey(_0x1a104d,_0x413370[_0x1833('0x17')],_0x1833('0x2a'));for(var _0x1ba84e=0x0,_0x1f7785={};_0x1ba84e<_0x1a104d['length'];_0x1ba84e+=0x1){_0x1f7785=_0x1a104d[_0x1ba84e];if(_[_0x1833('0x43')](_0x413370[_0x1833('0x17')][_0x1f7785[_0x1833('0x2a')]])){_0x413370['campaigns'][_0x1f7785[_0x1833('0x2a')]]=new Campaign(_0x1f7785);}else{_0x413370[_0x1833('0x3f')](_0x413370['campaigns'][_0x1f7785[_0x1833('0x2a')]],_0x1f7785);_0x413370[_0x1833('0x17')][_0x1f7785[_0x1833('0x2a')]][_0x1833('0x68')]=_0x1f7785['SquareProject']?_0x1f7785[_0x1833('0x69')][_0x1833('0x2a')]:undefined;}}}return _0x413370[_0x1833('0x17')];};};Realtime[_0x1833('0x3e')][_0x1833('0x6a')]=function(){var _0x22d288=this;return function(_0xc8147f){if(_0xc8147f){freeIsNotKey(_0xc8147f,_0x22d288['voiceExtensions'],'id');for(var _0x2ba151=0x0,_0x1ca6cb={};_0x2ba151<_0xc8147f[_0x1833('0x41')];_0x2ba151+=0x1){_0x1ca6cb=_0xc8147f[_0x2ba151];if(_['isUndefined'](_0x22d288[_0x1833('0x6b')][_0x1ca6cb['id']])){_0x22d288[_0x1833('0x6b')][_0x1ca6cb['id']]=new VoiceExtension(_0x1ca6cb);}else{_0x22d288[_0x1833('0x3f')](_0x22d288[_0x1833('0x6b')][_0x1ca6cb['id']],_0x1ca6cb);}}}return _0x22d288[_0x1833('0x6b')];};};Realtime[_0x1833('0x3e')]['initCampaignHopperHistory']=function(){var _0x3141e7=this;return function(_0x285a1b){clearCampaigns(_0x3141e7['campaigns']);for(var _0x3d1a36=0x0;_0x3d1a36<_0x285a1b[_0x1833('0x41')];_0x3d1a36+=0x1){_['merge'](_0x3141e7[_0x1833('0x17')][_0x285a1b[_0x3d1a36]['name']],_0x285a1b[_0x3d1a36]);}return _0x3141e7[_0x1833('0x17')];};};Realtime[_0x1833('0x3e')][_0x1833('0x6c')]=function(){var _0x3dcb96=this;return function(_0x2fb68){if(_0x2fb68){freeIsNotKey(_0x2fb68,_0x3dcb96[_0x1833('0x25')],'id');for(var _0x254647=0x0,_0x44ed1a={},_0x5bd1ae={};_0x254647<_0x2fb68[_0x1833('0x41')];_0x254647+=0x1){_0x44ed1a=_0x2fb68[_0x254647];if(_[_0x1833('0x43')](_0x3dcb96[_0x1833('0x25')][_0x44ed1a['id']])){_0x3dcb96[_0x1833('0x25')][_0x44ed1a['id']]=new FaxAccount(_0x44ed1a);}else{_0x3dcb96[_0x1833('0x3f')](_0x3dcb96[_0x1833('0x25')][_0x44ed1a['id']],_0x44ed1a);}}}return _0x3dcb96['faxAccounts'];};};module[_0x1833('0x6d')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 579c684..c4096ac 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 _0xf109=['disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','internal','split','membername','monitors','monitorFilename','filename','createdAt','connectedlinename','xcally-motion-dialer','voiceAgentReport','isArray','forEach','startsWith','Local','substring','indexOf','mobile','lastIndexOf','transfererlinkedid','exports','lodash','moment','util','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','sync','xdr','disabled','voiceQueueReport','bind','custom:voiceAgentReport','voiceDialReport','blindTransfer','attendedTransfer','prototype','accountcode','name','isNil','find','interface','format','SIP/%s','length','findAgent','connectedlinenum','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','match','keys','voiceCallReport','destination','exten','type','dialer','lastapplication','lastdata','queue','context','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','callerid'];(function(_0x5a704d,_0x4082d8){var _0x1f76e1=function(_0x3d20c0){while(--_0x3d20c0){_0x5a704d['push'](_0x5a704d['shift']());}};_0x1f76e1(++_0x4082d8);}(_0xf109,0xce));var _0x9f10=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0xf109[_0x5ddaac];return _0x2a9c58;};'use strict';var _=require(_0x9f10('0x0'));var moment=require(_0x9f10('0x1'));var util=require(_0x9f10('0x2'));var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x9f10('0x3'));var RpcVoiceDialReport=require(_0x9f10('0x4'));var RpcMemberReport=require(_0x9f10('0x5'));var RpcVoiceQueueReport=require(_0x9f10('0x6'));var RpcVoiceRecording=require(_0x9f10('0x7'));var RpcVoiceTransferReport=require(_0x9f10('0x8'));var VoiceQueueReport=require(_0x9f10('0x9'));var VoiceCallReport=require(_0x9f10('0xa'));var VoiceAgentReport=require(_0x9f10('0xb'));var VoiceDialReport=require(_0x9f10('0xc'));var UserReport=require(_0x9f10('0xd'));function Report(_0x5c8719){this[_0x9f10('0xe')]=_0x5c8719;this[_0x9f10('0xf')]=_0x5c8719[_0x9f10('0xf')];this[_0x9f10('0x10')]=_0x5c8719[_0x9f10('0x10')];}Report['prototype'][_0x9f10('0x11')]=function(_0x18995b){var _0x4522d9=new VoiceQueueReport(this['realtime']);var _0x50215f=new VoiceAgentReport(this[_0x9f10('0xe')]);var _0x311935=new VoiceDialReport(this[_0x9f10('0xe')]);var _0x56780e=new VoiceCallReport(this[_0x9f10('0xe')]);var _0x260606=new UserReport(this[_0x9f10('0xe')]);if(config['xdr']&&config[_0x9f10('0x12')][_0x9f10('0x13')]){ami['on']('custom:voiceQueueReport',this[_0x9f10('0x14')][_0x9f10('0x15')](this));ami['on']('custom:voiceCallReport',this['voiceCallReport'][_0x9f10('0x15')](this));ami['on'](_0x9f10('0x16'),this['voiceAgentReport'][_0x9f10('0x15')](this));ami['on']('custom:voiceDialReport',this[_0x9f10('0x17')][_0x9f10('0x15')](this));ami['on']('blindtransfer',this[_0x9f10('0x18')][_0x9f10('0x15')](this));ami['on']('attendedtransfer',this[_0x9f10('0x19')]['bind'](this));}};Report[_0x9f10('0x1a')]['findAgent']=function(_0x2c5064){var _0x56fb44;_0x56fb44=_['find'](this[_0x9f10('0xf')],function(_0x1a1e7e){return _0x1a1e7e[_0x9f10('0x1b')]==_0x2c5064||_0x1a1e7e[_0x9f10('0x1c')]==_0x2c5064;});if(_[_0x9f10('0x1d')](_0x56fb44)){var _0x332575=_[_0x9f10('0x1e')](this['telephones'],function(_0x366044){return _0x366044['accountcode']==_0x2c5064||_0x366044[_0x9f10('0x1c')]==_0x2c5064;});if(_0x332575){_0x56fb44=_[_0x9f10('0x1e')](this[_0x9f10('0xf')],function(_0x4adbda){return _0x4adbda[_0x9f10('0x1f')]==util[_0x9f10('0x20')](_0x9f10('0x21'),_0x332575['name']);});}}return _0x56fb44;};Report[_0x9f10('0x1a')][_0x9f10('0x14')]=function(_0x44b99d){for(var _0x4c531e=0x0;_0x4c531e<_0x44b99d[_0x9f10('0x22')];_0x4c531e+=0x1){var _0x23c2e7=this[_0x9f10('0x23')](_0x44b99d[_0x4c531e][_0x9f10('0x24')]);if(_0x23c2e7){_0x44b99d[_0x4c531e]['accountcode']=_0x23c2e7['accountcode'];_0x44b99d[_0x4c531e]['assigned']=!![];_0x44b99d[_0x4c531e][_0x9f10('0x25')]=_0x23c2e7['name'];_0x44b99d[_0x4c531e][_0x9f10('0x1f')]=_[_0x9f10('0x1d')](_0x23c2e7[_0x9f10('0x1f')])?util[_0x9f10('0x20')](_0x9f10('0x21'),_0x23c2e7['name']):_0x23c2e7[_0x9f10('0x1f')];if(_0x44b99d[_0x4c531e][_0x9f10('0x26')]){_0x44b99d[_0x4c531e][_0x9f10('0x27')]=moment()[_0x9f10('0x20')](_0x9f10('0x28'));}if(_0x44b99d[_0x4c531e][_0x9f10('0x29')]){_0x44b99d[_0x4c531e]['queuecallerexitAt']=moment()[_0x9f10('0x20')](_0x9f10('0x28'));}RpcMemberReport[_0x9f10('0x14')](_0x44b99d[_0x4c531e]);}RpcVoiceQueueReport[_0x9f10('0x2a')](_0x44b99d[_0x4c531e]);}};function extractCalleridNumber(_0x49b3f4){var _0x44f0a0=_0x49b3f4[_0x9f10('0x2b')](/<(.*?)>/);return _0x44f0a0?_0x44f0a0[0x1]:_0x49b3f4;}Report[_0x9f10('0x1a')]['getAgentByInternal']=function(_0x434128){for(var _0x5af399=0x0;_0x5af399','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','type','internal','UserId','split','getAgentByInternal','monitor','monitors','monitorFilename','createdAt','connectedlinename','isArray','forEach','Local','indexOf','mobile','phone','substring','lastIndexOf','SIP/%s','membername','blindTransfer','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','bind','attendedtransfer','attendedTransfer','findAgent','name','isNil','accountcode','find','interface','format','length','connectedlinenum','lastAssignedTo','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','create','match','keys','voiceCallReport','destination','exten','dialer','lastapplication','queue','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','disposition','ANSWERED'];(function(_0x80bac6,_0x4b76de){var _0x493e75=function(_0x3fa206){while(--_0x3fa206){_0x80bac6['push'](_0x80bac6['shift']());}};_0x493e75(++_0x4b76de);}(_0xc99a,0x7c));var _0xac99=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc99a[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xac99('0x0'));var moment=require(_0xac99('0x1'));var util=require(_0xac99('0x2'));var config=require(_0xac99('0x3'));var ami=require(_0xac99('0x4'));var RpcVoiceAgentReport=require(_0xac99('0x5'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xac99('0x6'));var RpcMemberReport=require(_0xac99('0x7'));var RpcVoiceQueueReport=require(_0xac99('0x8'));var RpcVoiceRecording=require(_0xac99('0x9'));var RpcVoiceTransferReport=require(_0xac99('0xa'));var VoiceQueueReport=require(_0xac99('0xb'));var VoiceCallReport=require(_0xac99('0xc'));var VoiceAgentReport=require(_0xac99('0xd'));var VoiceDialReport=require(_0xac99('0xe'));var UserReport=require(_0xac99('0xf'));function Report(_0x458f0b){this[_0xac99('0x10')]=_0x458f0b;this['agents']=_0x458f0b[_0xac99('0x11')];this[_0xac99('0x12')]=_0x458f0b['telephones'];}Report[_0xac99('0x13')][_0xac99('0x14')]=function(_0x140e6d){var _0x34f665=new VoiceQueueReport(this['realtime']);var _0x299d51=new VoiceAgentReport(this[_0xac99('0x10')]);var _0x55e10c=new VoiceDialReport(this['realtime']);var _0x4c3246=new VoiceCallReport(this[_0xac99('0x10')]);var _0x4e51f4=new UserReport(this[_0xac99('0x10')]);if(config[_0xac99('0x15')]&&config[_0xac99('0x15')][_0xac99('0x16')]){ami['on'](_0xac99('0x17'),this[_0xac99('0x18')]['bind'](this));ami['on'](_0xac99('0x19'),this['voiceCallReport']['bind'](this));ami['on'](_0xac99('0x1a'),this[_0xac99('0x1b')]['bind'](this));ami['on'](_0xac99('0x1c'),this[_0xac99('0x1d')][_0xac99('0x1e')](this));ami['on']('blindtransfer',this['blindTransfer'][_0xac99('0x1e')](this));ami['on'](_0xac99('0x1f'),this[_0xac99('0x20')][_0xac99('0x1e')](this));}};Report[_0xac99('0x13')][_0xac99('0x21')]=function(_0x10cfcf){var _0x47bcd1;_0x47bcd1=_['find'](this[_0xac99('0x11')],function(_0xa28347){return _0xa28347['accountcode']==_0x10cfcf||_0xa28347[_0xac99('0x22')]==_0x10cfcf;});if(_[_0xac99('0x23')](_0x47bcd1)){var _0x4f9889=_['find'](this[_0xac99('0x12')],function(_0x3d057c){return _0x3d057c[_0xac99('0x24')]==_0x10cfcf||_0x3d057c[_0xac99('0x22')]==_0x10cfcf;});if(_0x4f9889){_0x47bcd1=_[_0xac99('0x25')](this[_0xac99('0x11')],function(_0x41c378){return _0x41c378[_0xac99('0x26')]==util[_0xac99('0x27')]('SIP/%s',_0x4f9889[_0xac99('0x22')]);});}}return _0x47bcd1;};Report[_0xac99('0x13')][_0xac99('0x18')]=function(_0x2791e0){for(var _0x3ecdbf=0x0;_0x3ecdbf<_0x2791e0[_0xac99('0x28')];_0x3ecdbf+=0x1){var _0x53bcb5=this[_0xac99('0x21')](_0x2791e0[_0x3ecdbf][_0xac99('0x29')]);if(_0x53bcb5){_0x2791e0[_0x3ecdbf][_0xac99('0x24')]=_0x53bcb5[_0xac99('0x24')];_0x2791e0[_0x3ecdbf]['assigned']=!![];_0x2791e0[_0x3ecdbf][_0xac99('0x2a')]=_0x53bcb5['name'];_0x2791e0[_0x3ecdbf][_0xac99('0x26')]=_[_0xac99('0x23')](_0x53bcb5[_0xac99('0x26')])?util['format']('SIP/%s',_0x53bcb5[_0xac99('0x22')]):_0x53bcb5['interface'];if(_0x2791e0[_0x3ecdbf]['queuecallercomplete']){_0x2791e0[_0x3ecdbf][_0xac99('0x2b')]=moment()[_0xac99('0x27')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x2791e0[_0x3ecdbf]['queuecallerexit']){_0x2791e0[_0x3ecdbf]['queuecallerexitAt']=moment()['format'](_0xac99('0x2c'));}RpcMemberReport[_0xac99('0x18')](_0x2791e0[_0x3ecdbf]);}RpcVoiceQueueReport[_0xac99('0x2d')](_0x2791e0[_0x3ecdbf]);}};function extractCalleridNumber(_0x57b29a){var _0x560ae8=_0x57b29a[_0xac99('0x2e')](/<(.*?)>/);return _0x560ae8?_0x560ae8[0x1]:_0x57b29a;}Report[_0xac99('0x13')]['getAgentByInternal']=function(_0x271770){for(var _0xaca0b=0x0;_0xaca0b0x0?_0x1ad67b:0x0;this[_0xeeeb('0x14')][_0x43ab07[_0xeeeb('0x70')]][_0xeeeb('0x5f')]=this['voiceQueues'][_0x43ab07[_0xeeeb('0x70')]]['talking']>_[_0xeeeb('0x73')](_0x43ab07[_0xeeeb('0x74')])?_['toNumber'](_0x43ab07['loggedin']):this[_0xeeeb('0x14')][_0x43ab07['queue']][_0xeeeb('0x5f')];this[_0xeeeb('0x56')](this['voiceQueues'][_0x43ab07[_0xeeeb('0x70')]],_0xeeeb('0x17'));}logger[_0xeeeb('0x4d')](_0xeeeb('0x77'),util[_0xeeeb('0x44')](this[_0xeeeb('0x14')][_0x43ab07[_0xeeeb('0x70')]],{'showHidden':![],'depth':null}));ami[_0xeeeb('0x4b')]('custom:queuesummary',this[_0xeeeb('0x14')][_0x43ab07[_0xeeeb('0x70')]]);}}}catch(_0xee4612){logger[_0xeeeb('0x42')](_0xeeeb('0x6e'),util[_0xeeeb('0x44')](_0xee4612,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xeeeb('0x1b')]=function(_0x126747){logger[_0xeeeb('0x4d')](_0xeeeb('0x78'),util[_0xeeeb('0x44')](_0x126747,{'showHidden':![],'depth':null}));this[_0xeeeb('0x15')]=!![];};VoiceQueueReport[_0xeeeb('0xc')]['syncQueueCallerJoin']=function(_0x4b60e4){try{if(this[_0xeeeb('0x69')](_0x4b60e4)){logger['debug'](_0xeeeb('0x79'),_0x4b60e4[_0xeeeb('0x7a')],util[_0xeeeb('0x44')](_0x4b60e4,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xeeeb('0x10')][_0x4b60e4[_0xeeeb('0x7a')]]))this['queueReports'][_0x4b60e4[_0xeeeb('0x7a')]]=[];if(_['isUndefined'](this[_0xeeeb('0x12')][_0x4b60e4['uniqueid']]))this[_0xeeeb('0x12')][_0x4b60e4[_0xeeeb('0x7a')]]={};var _0x201483=new QueueReport();_0x201483['name']=_0x4b60e4[_0xeeeb('0x70')];_0x201483['type']=this[_0xeeeb('0x14')][_0x201483['name']]&&this['voiceQueues'][_0x201483['name']][_0xeeeb('0x57')]?this[_0xeeeb('0x14')][_0x201483[_0xeeeb('0x50')]]['type']||_0xeeeb('0x58'):_0xeeeb('0x58');_0x201483['queue']=_0x4b60e4[_0xeeeb('0x70')];_0x201483[_0xeeeb('0x7b')]=moment()[_0xeeeb('0x53')](_0xeeeb('0x7c'));_0x201483['position']=_0x4b60e4['position'];_0x201483[_0xeeeb('0x7d')]=_0x4b60e4[_0xeeeb('0x7d')];_0x201483[_0xeeeb('0x7a')]=_0x4b60e4['uniqueid'];_0x201483[_0xeeeb('0x7e')]=this['channels'][_0x4b60e4[_0xeeeb('0x7a')]]['routealias'];logger[_0xeeeb('0x71')](_0xeeeb('0x7f'),_0x201483[_0xeeeb('0x50')],_0x201483[_0xeeeb('0x57')]);_[_0xeeeb('0x80')](_0x201483,_[_0xeeeb('0x81')](_0x4b60e4,_['keys'](_0x201483)));this[_0xeeeb('0x10')][_0x4b60e4[_0xeeeb('0x7a')]][_0xeeeb('0x82')](_0x201483);this[_0xeeeb('0x12')][_0x4b60e4[_0xeeeb('0x7a')]]=_0x201483;this['emitVoiceQueueChannelSave'](_0x201483,_0xeeeb('0x1c'));}}catch(_0x4c3b57){logger[_0xeeeb('0x42')]('[%s][voiceQueueReport][queuecallerjoin]',_0x4b60e4[_0xeeeb('0x7a')],util['inspect'](_0x4c3b57,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xeeeb('0xc')][_0xeeeb('0x1f')]=function(_0x55cb48){try{if(this[_0xeeeb('0x69')](_0x55cb48)){logger['debug'](_0xeeeb('0x83'),_0x55cb48[_0xeeeb('0x7a')],util[_0xeeeb('0x44')](_0x55cb48,{'showHidden':![],'depth':null}));if(this[_0xeeeb('0x10')][_0x55cb48['uniqueid']]){var _0x5af5a4=_[_0xeeeb('0x84')](this['queueReports'][_0x55cb48[_0xeeeb('0x7a')]]);_0x5af5a4[_0xeeeb('0x85')]=![];_0x5af5a4[_0xeeeb('0x86')]=null;_0x5af5a4[_0xeeeb('0x87')]=_0x55cb48[_0xeeeb('0x87')];_0x5af5a4[_0xeeeb('0x88')]=_0x55cb48[_0xeeeb('0x88')];_0x5af5a4['queuecallerabandon']=!![];_0x5af5a4[_0xeeeb('0x89')]=moment()[_0xeeeb('0x53')](_0xeeeb('0x7c'));_0x5af5a4[_0xeeeb('0x8a')]=_0xeeeb('0x8b');_0x5af5a4[_0xeeeb('0x8c')]=null;logger['info']('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x5af5a4[_0xeeeb('0x50')],_0x5af5a4[_0xeeeb('0x57')]);this[_0xeeeb('0x12')][_0x55cb48[_0xeeeb('0x7a')]]=_0x5af5a4;this['emitVoiceQueueChannelRemove'](_0x5af5a4,_0xeeeb('0x1e'));}}}catch(_0x437818){logger[_0xeeeb('0x42')](_0xeeeb('0x83'),_0x55cb48[_0xeeeb('0x7a')],util[_0xeeeb('0x44')](_0x437818,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xeeeb('0xc')][_0xeeeb('0x21')]=function(_0x1a0bf8){try{if(this[_0xeeeb('0x69')](_0x1a0bf8)){logger[_0xeeeb('0x4d')](_0xeeeb('0x8d'),_0x1a0bf8[_0xeeeb('0x7a')],util[_0xeeeb('0x44')](_0x1a0bf8,{'showHidden':![],'depth':null}));if(this[_0xeeeb('0x10')][_0x1a0bf8['uniqueid']]){var _0x404917=_[_0xeeeb('0x84')](this[_0xeeeb('0x10')][_0x1a0bf8[_0xeeeb('0x7a')]]);_0x404917[_0xeeeb('0x8e')]=moment()[_0xeeeb('0x53')]('YYYY-MM-DD\x20HH:mm:ss');_0x404917[_0xeeeb('0x8f')]=_0x1a0bf8[_0xeeeb('0x8f')];_0x404917[_0xeeeb('0x90')]=_0x1a0bf8['connectedlinename'];logger['info'](_0xeeeb('0x91'),_0x404917['name'],_0x404917['type'],_0x1a0bf8[_0xeeeb('0x8f')],_0x1a0bf8[_0xeeeb('0x90')]);this['channels'][_0x1a0bf8[_0xeeeb('0x7a')]]=_0x404917;this[_0xeeeb('0x4c')](_0x404917,'queuecallerleave');}}}catch(_0x20a162){logger[_0xeeeb('0x42')](_0xeeeb('0x8d'),_0x1a0bf8['uniqueid'],util['inspect'](_0x20a162,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentConnect']=function(_0x103ffe){try{if(this[_0xeeeb('0x69')](_0x103ffe)){logger[_0xeeeb('0x4d')]('[%s][voiceQueueReport][agentconnect]',_0x103ffe['uniqueid'],util[_0xeeeb('0x44')](_0x103ffe,{'showHidden':![],'depth':null}));if(this[_0xeeeb('0x10')][_0x103ffe['uniqueid']]){var _0x5584c8=_[_0xeeeb('0x84')](this['queueReports'][_0x103ffe[_0xeeeb('0x7a')]]);_0x5584c8[_0xeeeb('0x85')]=!![];_0x5584c8['queuecallerexitreason']=_0xeeeb('0x92');logger[_0xeeeb('0x71')](_0xeeeb('0x93'),_0x5584c8[_0xeeeb('0x50')],_0x5584c8[_0xeeeb('0x57')]);}}}catch(_0x5a2732){logger[_0xeeeb('0x42')](_0xeeeb('0x94'),_0x103ffe[_0xeeeb('0x7a')],util[_0xeeeb('0x44')](_0x5a2732,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xeeeb('0x23')]=function(_0x2e2d4e){try{if(this['isNotNull'](_0x2e2d4e)){logger[_0xeeeb('0x4d')](_0xeeeb('0x95'),_0x2e2d4e[_0xeeeb('0x7a')],util[_0xeeeb('0x44')](_0x2e2d4e,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x2e2d4e[_0xeeeb('0x7a')]]){var _0x49978c=_[_0xeeeb('0x84')](this[_0xeeeb('0x10')][_0x2e2d4e['uniqueid']]);_0x49978c['queuecallerabandon']=![];_0x49978c[_0xeeeb('0x89')]=null;_0x49978c[_0xeeeb('0x96')]=!![];_0x49978c['lastAssignedTo']=_0x2e2d4e['membername'];_0x49978c[_0xeeeb('0x87')]=_0x2e2d4e[_0xeeeb('0x87')];_0x49978c[_0xeeeb('0x85')]=!![];_0x49978c[_0xeeeb('0x97')]=![];_0x49978c['queuecallerexitAt']=null;if(!_0x49978c[_0xeeeb('0x98')]){if(_0x2e2d4e[_0xeeeb('0x99')]==_0xeeeb('0x98')){_0x49978c[_0xeeeb('0x8a')]=_0xeeeb('0x9a');logger[_0xeeeb('0x71')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x49978c['name'],_0x49978c[_0xeeeb('0x57')]);}else{if(_[_0xeeeb('0x9b')](_0x2e2d4e[_0xeeeb('0x3f')]['toLowerCase'](),_0xeeeb('0x9c'))){if(this[_0xeeeb('0x10')][_0x2e2d4e['linkedid']]){var _0x38f649=_[_0xeeeb('0x84')](this[_0xeeeb('0x10')][_0x2e2d4e[_0xeeeb('0x9d')]]);_0x38f649['queuecallercomplete']=![];_0x38f649[_0xeeeb('0x97')]=!![];_0x38f649[_0xeeeb('0x9e')]=moment(_0x49978c['queuecallerjoinAt'])[_0xeeeb('0x9f')](_0x2e2d4e[_0xeeeb('0x87')],_0xeeeb('0xa0'))[_0xeeeb('0x53')](_0xeeeb('0x7c'));_0x38f649[_0xeeeb('0x8a')]=_0xeeeb('0xa1');_0x38f649[_0xeeeb('0x98')]=!![];_0x38f649['transfertype']='FORWARD';_0x38f649[_0xeeeb('0xa2')]=_0x2e2d4e[_0xeeeb('0xa3')];_0x38f649[_0xeeeb('0xa4')]=_0x2e2d4e[_0xeeeb('0x7a')];logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x38f649[_0xeeeb('0x50')],_0x38f649[_0xeeeb('0x57')]);var _0x1eb0e6=this[_0xeeeb('0x10')][_0x2e2d4e[_0xeeeb('0x9d')]];this[_0xeeeb('0x10')][_0x2e2d4e[_0xeeeb('0x9d')]]=this[_0xeeeb('0x10')][_0x2e2d4e[_0xeeeb('0x7a')]];this[_0xeeeb('0x10')][_0x2e2d4e[_0xeeeb('0x7a')]]=_0x1eb0e6;}}else{_0x49978c[_0xeeeb('0x8a')]=_0xeeeb('0xa5')+_0x2e2d4e[_0xeeeb('0x99')][_0xeeeb('0xa6')]();logger[_0xeeeb('0x71')](_0xeeeb('0xa7'),_0x49978c[_0xeeeb('0x50')],_0x49978c[_0xeeeb('0x57')],_0x49978c[_0xeeeb('0x8a')]);}}}this[_0xeeeb('0x12')][_0x2e2d4e['uniqueid']]=_0x49978c;this['emitVoiceQueueChannelRemove'](_0x49978c,'agentcomplete');}}}catch(_0x21fa45){logger[_0xeeeb('0x42')](_0xeeeb('0x95'),_0x2e2d4e[_0xeeeb('0x7a')],util[_0xeeeb('0x44')](_0x21fa45,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xeeeb('0xc')][_0xeeeb('0x27')]=function(_0x1651ec){try{if(this[_0xeeeb('0x69')](_0x1651ec)){logger[_0xeeeb('0x4d')]('[%s][voiceQueueReport][varset]',_0x1651ec[_0xeeeb('0x7a')],util[_0xeeeb('0x44')](_0x1651ec,{'showHidden':![],'depth':null}));this[_0xeeeb('0xa8')](_0x1651ec[_0xeeeb('0x7a')],_[_0xeeeb('0xa9')](_0x1651ec[_0xeeeb('0xaa')])[0x0],_0x1651ec[_0xeeeb('0xab')]);if(this[_0xeeeb('0x10')][_0x1651ec[_0xeeeb('0x7a')]]){var _0x200ac2=_[_0xeeeb('0x84')](this[_0xeeeb('0x10')][_0x1651ec[_0xeeeb('0x7a')]]);if(_0x200ac2){if(this['isNotNull'](_0x1651ec['variable'])&&this[_0xeeeb('0x69')](_0x1651ec[_0xeeeb('0xaa')][_0xeeeb('0xac')])){switch(_0x1651ec['value']){case _0xeeeb('0xad'):_0x200ac2['queuecallerexit']=![];_0x200ac2[_0xeeeb('0x9e')]=null;break;case _0xeeeb('0xae'):_0x200ac2[_0xeeeb('0xaf')]=_0xeeeb('0xb0');_0x200ac2[_0xeeeb('0x97')]=!![];_0x200ac2['queuecallerexitAt']=moment()[_0xeeeb('0x53')](_0xeeeb('0x7c'));_0x200ac2['queuecallerleaveAt']=moment()[_0xeeeb('0x53')](_0xeeeb('0x7c'));logger['debug'](_0xeeeb('0xb1'),_0x1651ec[_0xeeeb('0x7a')],util[_0xeeeb('0x44')](_0x200ac2,{'showHidden':![],'depth':null}));ami[_0xeeeb('0x4b')](_0xeeeb('0xb2'),_0x200ac2);break;default:_0x200ac2[_0xeeeb('0x97')]=!![];_0x200ac2['queuecallerexitAt']=moment()[_0xeeeb('0x53')](_0xeeeb('0x7c'));_0x200ac2[_0xeeeb('0x8e')]=moment()[_0xeeeb('0x53')](_0xeeeb('0x7c'));}_0x200ac2[_0xeeeb('0x1e')]=![];_0x200ac2['queuecallerabandonAt']=null;_0x200ac2[_0xeeeb('0x8a')]=_0x1651ec['value'];this[_0xeeeb('0x12')][_0x1651ec[_0xeeeb('0x7a')]]=_0x200ac2;this[_0xeeeb('0x52')](_0x200ac2,_0xeeeb('0x26'));}else if(this[_0xeeeb('0x69')](_0x1651ec[_0xeeeb('0xaa')])&&this[_0xeeeb('0x69')](_0x1651ec[_0xeeeb('0xaa')][_0xeeeb('0xb3')])){if(!_0x200ac2[_0xeeeb('0x1e')]){_0x200ac2[_0xeeeb('0x97')]=!![];_0x200ac2[_0xeeeb('0x9e')]=moment()['format'](_0xeeeb('0x7c'));_0x200ac2['queuecallerexitreason']=_0xeeeb('0xb4');_0x200ac2[_0xeeeb('0x8e')]=moment()[_0xeeeb('0x53')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xeeeb('0x12')][_0x1651ec['uniqueid']]=_0x200ac2;}}logger[_0xeeeb('0x71')](_0xeeeb('0xb5'),_0x1651ec['uniqueid'],_0x200ac2['name'],_0x200ac2['type'],_[_0xeeeb('0xa9')](_0x1651ec[_0xeeeb('0xaa')])[0x0],_0x1651ec['value']);_0x200ac2[_0xeeeb('0x16')]=this['variables'][_0x1651ec[_0xeeeb('0x7a')]];}}}}catch(_0x5f3d72){logger[_0xeeeb('0x42')](_0xeeeb('0xb6'),_0x1651ec['uniqueid'],util[_0xeeeb('0x44')](_0x5f3d72,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xeeeb('0xa8')]=function(_0x559a31,_0x17954f,_0x12e0e7){var _0x38f66a=[_0xeeeb('0xb7'),_0xeeeb('0xb8'),'rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss',_0xeeeb('0xb9'),_0xeeeb('0xba'),_0xeeeb('0xbb'),_0xeeeb('0xbc'),_0xeeeb('0xbd'),'bridgepeer',_0xeeeb('0xbe'),_0xeeeb('0xbf'),_0xeeeb('0xc0'),_0xeeeb('0xc1'),_0xeeeb('0xc2'),_0xeeeb('0xc3'),'memberpenalty',_0xeeeb('0xc4')];if(!_['isNil'](_0x17954f)&&!_[_0xeeeb('0xc5')](_0x38f66a,_0x17954f)){if(_['isUndefined'](this[_0xeeeb('0x16')][_0x559a31])){this[_0xeeeb('0x16')][_0x559a31]={};}this[_0xeeeb('0x16')][_0x559a31][_0x17954f]=_0x12e0e7;}};VoiceQueueReport['prototype'][_0xeeeb('0x29')]=function(_0x22892d){try{if(this['isNotNull'](_0x22892d)){logger[_0xeeeb('0x4d')](_0xeeeb('0xc6'),_0x22892d[_0xeeeb('0x7a')],util['inspect'](_0x22892d,{'showHidden':![],'depth':null}));if(this[_0xeeeb('0x10')][_0x22892d[_0xeeeb('0x7a')]]){for(var _0x50ab93=0x0,_0x615b52={};_0x50ab930x0?_0x18a255:0x0;this['voiceQueues'][_0x22d378['queue']]['talking']=this[_0x8405('0x43')][_0x22d378[_0x8405('0x6a')]][_0x8405('0x71')]>_[_0x8405('0x70')](_0x22d378[_0x8405('0x72')])?_[_0x8405('0x70')](_0x22d378[_0x8405('0x72')]):this[_0x8405('0x43')][_0x22d378[_0x8405('0x6a')]][_0x8405('0x71')];this[_0x8405('0x74')](this[_0x8405('0x43')][_0x22d378['queue']],_0x8405('0x65'));}logger[_0x8405('0x47')]('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0x8405('0x3e')](this[_0x8405('0x43')][_0x22d378[_0x8405('0x6a')]],{'showHidden':![],'depth':null}));ami[_0x8405('0x45')](_0x8405('0x75'),this[_0x8405('0x43')][_0x22d378[_0x8405('0x6a')]]);}}}catch(_0x27085d){logger[_0x8405('0x3c')]('[voiceQueueReport][queuesummary]',util[_0x8405('0x3e')](_0x27085d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8405('0xc')][_0x8405('0x15')]=function(_0x5b709a){logger[_0x8405('0x47')](_0x8405('0x76'),util[_0x8405('0x3e')](_0x5b709a,{'showHidden':![],'depth':null}));this[_0x8405('0x64')]=!![];};VoiceQueueReport[_0x8405('0xc')]['syncQueueCallerJoin']=function(_0x19c66a){try{if(this[_0x8405('0x61')](_0x19c66a)){logger[_0x8405('0x47')](_0x8405('0x77'),_0x19c66a[_0x8405('0x78')],util[_0x8405('0x3e')](_0x19c66a,{'showHidden':![],'depth':null}));if(_[_0x8405('0x79')](this[_0x8405('0x10')][_0x19c66a[_0x8405('0x78')]]))this['queueReports'][_0x19c66a[_0x8405('0x78')]]=[];if(_['isUndefined'](this[_0x8405('0x12')][_0x19c66a[_0x8405('0x78')]]))this['channels'][_0x19c66a['uniqueid']]={};var _0x5f4bb6=new QueueReport();_0x5f4bb6['name']=_0x19c66a[_0x8405('0x6a')];_0x5f4bb6['type']=this[_0x8405('0x43')][_0x5f4bb6[_0x8405('0x50')]]&&this[_0x8405('0x43')][_0x5f4bb6[_0x8405('0x50')]][_0x8405('0x53')]?this[_0x8405('0x43')][_0x5f4bb6[_0x8405('0x50')]]['type']||_0x8405('0x54'):_0x8405('0x54');_0x5f4bb6['queue']=_0x19c66a['queue'];_0x5f4bb6['queuecallerjoinAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5f4bb6['position']=_0x19c66a[_0x8405('0x7a')];_0x5f4bb6[_0x8405('0x7b')]=_0x19c66a[_0x8405('0x7b')];_0x5f4bb6[_0x8405('0x78')]=_0x19c66a[_0x8405('0x78')];_0x5f4bb6['routealias']=this[_0x8405('0x12')][_0x19c66a[_0x8405('0x78')]][_0x8405('0x7c')];logger[_0x8405('0x6b')](_0x8405('0x7d'),_0x5f4bb6['name'],_0x5f4bb6[_0x8405('0x53')]);_[_0x8405('0x7e')](_0x5f4bb6,_[_0x8405('0x7f')](_0x19c66a,_[_0x8405('0x80')](_0x5f4bb6)));this[_0x8405('0x10')][_0x19c66a[_0x8405('0x78')]][_0x8405('0x81')](_0x5f4bb6);this[_0x8405('0x12')][_0x19c66a['uniqueid']]=_0x5f4bb6;this[_0x8405('0x46')](_0x5f4bb6,_0x8405('0x16'));}}catch(_0x2d3847){logger[_0x8405('0x3c')](_0x8405('0x77'),_0x19c66a[_0x8405('0x78')],util[_0x8405('0x3e')](_0x2d3847,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8405('0xc')][_0x8405('0x82')]=function(_0x2be89b){try{if(this[_0x8405('0x61')](_0x2be89b)){logger[_0x8405('0x47')](_0x8405('0x83'),_0x2be89b[_0x8405('0x78')],util[_0x8405('0x3e')](_0x2be89b,{'showHidden':![],'depth':null}));if(this[_0x8405('0x10')][_0x2be89b['uniqueid']]){var _0x2562c8=_[_0x8405('0x84')](this[_0x8405('0x10')][_0x2be89b['uniqueid']]);_0x2562c8[_0x8405('0x85')]=![];_0x2562c8[_0x8405('0x86')]=null;_0x2562c8[_0x8405('0x87')]=_0x2be89b[_0x8405('0x87')];_0x2562c8[_0x8405('0x88')]=_0x2be89b[_0x8405('0x88')];_0x2562c8[_0x8405('0x19')]=!![];_0x2562c8[_0x8405('0x89')]=moment()[_0x8405('0x4a')](_0x8405('0x8a'));_0x2562c8['queuecallerexitreason']='ABANDONED';_0x2562c8[_0x8405('0x8b')]=null;logger[_0x8405('0x6b')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x2562c8[_0x8405('0x50')],_0x2562c8[_0x8405('0x53')]);this[_0x8405('0x12')][_0x2be89b['uniqueid']]=_0x2562c8;this['emitVoiceQueueChannelRemove'](_0x2562c8,'queuecallerabandon');}}}catch(_0x4ed271){logger[_0x8405('0x3c')](_0x8405('0x83'),_0x2be89b[_0x8405('0x78')],util['inspect'](_0x4ed271,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8405('0xc')][_0x8405('0x1b')]=function(_0x44be49){try{if(this[_0x8405('0x61')](_0x44be49)){logger['debug']('[%s][voiceQueueReport][queuecallerleave]',_0x44be49[_0x8405('0x78')],util[_0x8405('0x3e')](_0x44be49,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x44be49[_0x8405('0x78')]]){var _0x1bbb21=_[_0x8405('0x84')](this['queueReports'][_0x44be49[_0x8405('0x78')]]);_0x1bbb21[_0x8405('0x8c')]=moment()[_0x8405('0x4a')](_0x8405('0x8a'));_0x1bbb21[_0x8405('0x8d')]=_0x44be49[_0x8405('0x8d')];_0x1bbb21[_0x8405('0x8e')]=_0x44be49[_0x8405('0x8e')];logger[_0x8405('0x6b')](_0x8405('0x8f'),_0x1bbb21['name'],_0x1bbb21[_0x8405('0x53')],_0x44be49[_0x8405('0x8d')],_0x44be49[_0x8405('0x8e')]);this['channels'][_0x44be49['uniqueid']]=_0x1bbb21;this['emitVoiceQueueChannelSave'](_0x1bbb21,_0x8405('0x1a'));}}}catch(_0x305f8d){logger[_0x8405('0x3c')](_0x8405('0x90'),_0x44be49['uniqueid'],util[_0x8405('0x3e')](_0x305f8d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8405('0xc')][_0x8405('0x1f')]=function(_0x2e8f72){try{if(this[_0x8405('0x61')](_0x2e8f72)){logger[_0x8405('0x47')](_0x8405('0x91'),_0x2e8f72[_0x8405('0x78')],util[_0x8405('0x3e')](_0x2e8f72,{'showHidden':![],'depth':null}));if(this[_0x8405('0x10')][_0x2e8f72['uniqueid']]){var _0x599797=_[_0x8405('0x84')](this[_0x8405('0x10')][_0x2e8f72[_0x8405('0x78')]]);_0x599797[_0x8405('0x85')]=!![];_0x599797[_0x8405('0x92')]=_0x8405('0x93');logger[_0x8405('0x6b')](_0x8405('0x94'),_0x599797[_0x8405('0x50')],_0x599797['type']);}}}catch(_0x264c5d){logger[_0x8405('0x3c')](_0x8405('0x91'),_0x2e8f72['uniqueid'],util[_0x8405('0x3e')](_0x264c5d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8405('0xc')][_0x8405('0x1d')]=function(_0x4cc691){try{if(this['isNotNull'](_0x4cc691)){logger['debug'](_0x8405('0x95'),_0x4cc691['uniqueid'],util['inspect'](_0x4cc691,{'showHidden':![],'depth':null}));if(this[_0x8405('0x10')][_0x4cc691[_0x8405('0x78')]]){var _0x596876=_[_0x8405('0x84')](this[_0x8405('0x10')][_0x4cc691[_0x8405('0x78')]]);_0x596876[_0x8405('0x19')]=![];_0x596876[_0x8405('0x89')]=null;_0x596876['assigned']=!![];_0x596876['lastAssignedTo']=_0x4cc691[_0x8405('0x96')];_0x596876['holdtime']=_0x4cc691[_0x8405('0x87')];_0x596876[_0x8405('0x85')]=!![];_0x596876[_0x8405('0x97')]=![];_0x596876[_0x8405('0x98')]=null;if(!_0x596876['transfer']){if(_0x4cc691[_0x8405('0x99')]==_0x8405('0x9a')){_0x596876[_0x8405('0x92')]=_0x8405('0x9b');logger[_0x8405('0x6b')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x596876[_0x8405('0x50')],_0x596876['type']);}else{if(_[_0x8405('0x9c')](_0x4cc691['channel'][_0x8405('0x9d')](),_0x8405('0x9e'))){if(this[_0x8405('0x10')][_0x4cc691['linkedid']]){var _0x489405=_[_0x8405('0x84')](this[_0x8405('0x10')][_0x4cc691['linkedid']]);_0x489405[_0x8405('0x85')]=![];_0x489405[_0x8405('0x97')]=!![];_0x489405[_0x8405('0x98')]=moment(_0x596876[_0x8405('0x9f')])[_0x8405('0xa0')](_0x4cc691[_0x8405('0x87')],_0x8405('0xa1'))[_0x8405('0x4a')](_0x8405('0x8a'));_0x489405[_0x8405('0x92')]=_0x8405('0xa2');_0x489405[_0x8405('0x9a')]=!![];_0x489405[_0x8405('0xa3')]=_0x8405('0xa4');_0x489405['transferexten']=_0x4cc691[_0x8405('0xa5')];_0x489405['transferuniqueid']=_0x4cc691[_0x8405('0x78')];logger['info'](_0x8405('0xa6'),_0x489405[_0x8405('0x50')],_0x489405['type']);var _0x29e9c4=this[_0x8405('0x10')][_0x4cc691[_0x8405('0xa7')]];this[_0x8405('0x10')][_0x4cc691[_0x8405('0xa7')]]=this['queueReports'][_0x4cc691[_0x8405('0x78')]];this['queueReports'][_0x4cc691['uniqueid']]=_0x29e9c4;}}else{_0x596876['queuecallerexitreason']=_0x8405('0xa8')+_0x4cc691[_0x8405('0x99')][_0x8405('0xa9')]();logger[_0x8405('0x6b')](_0x8405('0xaa'),_0x596876[_0x8405('0x50')],_0x596876[_0x8405('0x53')],_0x596876[_0x8405('0x92')]);}}}this[_0x8405('0x12')][_0x4cc691['uniqueid']]=_0x596876;this['emitVoiceQueueChannelRemove'](_0x596876,'agentcomplete');}}}catch(_0xc4bf7d){logger[_0x8405('0x3c')](_0x8405('0x95'),_0x4cc691['uniqueid'],util[_0x8405('0x3e')](_0xc4bf7d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8405('0xc')][_0x8405('0x21')]=function(_0x176162){try{if(this[_0x8405('0x61')](_0x176162)){logger[_0x8405('0x47')]('[%s][voiceQueueReport][varset]',_0x176162[_0x8405('0x78')],util[_0x8405('0x3e')](_0x176162,{'showHidden':![],'depth':null}));this[_0x8405('0xab')](_0x176162[_0x8405('0x78')],_[_0x8405('0x80')](_0x176162[_0x8405('0xac')])[0x0],_0x176162[_0x8405('0xad')]);if(this[_0x8405('0x10')][_0x176162['uniqueid']]){var _0x350a21=_[_0x8405('0x84')](this[_0x8405('0x10')][_0x176162[_0x8405('0x78')]]);if(_0x350a21){if(this[_0x8405('0x61')](_0x176162[_0x8405('0xac')])&&this[_0x8405('0x61')](_0x176162[_0x8405('0xac')][_0x8405('0xae')])){switch(_0x176162[_0x8405('0xad')]){case _0x8405('0xaf'):_0x350a21[_0x8405('0x97')]=![];_0x350a21['queuecallerexitAt']=null;break;case _0x8405('0xb0'):_0x350a21[_0x8405('0xb1')]=_0x8405('0xb2');_0x350a21[_0x8405('0x97')]=!![];_0x350a21[_0x8405('0x98')]=moment()['format'](_0x8405('0x8a'));_0x350a21[_0x8405('0x8c')]=moment()[_0x8405('0x4a')](_0x8405('0x8a'));logger[_0x8405('0x47')](_0x8405('0xb3'),_0x176162[_0x8405('0x78')],util[_0x8405('0x3e')](_0x350a21,{'showHidden':![],'depth':null}));ami[_0x8405('0x45')]('custom:timeout',_0x350a21);break;default:_0x350a21['queuecallerexit']=!![];_0x350a21[_0x8405('0x98')]=moment()['format'](_0x8405('0x8a'));_0x350a21[_0x8405('0x8c')]=moment()[_0x8405('0x4a')](_0x8405('0x8a'));}_0x350a21[_0x8405('0x19')]=![];_0x350a21['queuecallerabandonAt']=null;_0x350a21[_0x8405('0x92')]=_0x176162[_0x8405('0xad')];this['channels'][_0x176162[_0x8405('0x78')]]=_0x350a21;this[_0x8405('0x4e')](_0x350a21,'varset');}else if(this[_0x8405('0x61')](_0x176162[_0x8405('0xac')])&&this[_0x8405('0x61')](_0x176162[_0x8405('0xac')][_0x8405('0xb4')])){if(!_0x350a21[_0x8405('0x19')]){_0x350a21['queuecallerexit']=!![];_0x350a21['queuecallerexitAt']=moment()[_0x8405('0x4a')](_0x8405('0x8a'));_0x350a21['queuecallerexitreason']=_0x8405('0xb5');_0x350a21['queuecallerleaveAt']=moment()['format'](_0x8405('0x8a'));this[_0x8405('0x12')][_0x176162[_0x8405('0x78')]]=_0x350a21;}}logger[_0x8405('0x6b')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x176162[_0x8405('0x78')],_0x350a21['name'],_0x350a21[_0x8405('0x53')],_['keys'](_0x176162[_0x8405('0xac')])[0x0],_0x176162[_0x8405('0xad')]);_0x350a21[_0x8405('0x40')]=this[_0x8405('0x40')][_0x176162['uniqueid']];}}}}catch(_0x16bb12){logger['error'](_0x8405('0xb6'),_0x176162[_0x8405('0x78')],util[_0x8405('0x3e')](_0x16bb12,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8405('0xc')][_0x8405('0xab')]=function(_0x5e022c,_0x301c85,_0x2decbd){var _0x39f467=[_0x8405('0xb7'),_0x8405('0xb8'),'rtpaudioqosjitter',_0x8405('0xb9'),_0x8405('0xba'),'rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged',_0x8405('0xbb'),'sipuri',_0x8405('0xbc'),_0x8405('0xbd'),_0x8405('0xbe'),_0x8405('0xbf'),_0x8405('0xc0'),_0x8405('0xc1'),_0x8405('0x96'),_0x8405('0xc2'),_0x8405('0xc3')];if(!_[_0x8405('0x38')](_0x301c85)&&!_[_0x8405('0xc4')](_0x39f467,_0x301c85)){if(_[_0x8405('0x79')](this[_0x8405('0x40')][_0x5e022c])){this['variables'][_0x5e022c]={};}this[_0x8405('0x40')][_0x5e022c][_0x301c85]=_0x2decbd;}};VoiceQueueReport[_0x8405('0xc')][_0x8405('0x23')]=function(_0x594664){try{if(this[_0x8405('0x61')](_0x594664)){logger[_0x8405('0x47')](_0x8405('0xc5'),_0x594664[_0x8405('0x78')],util[_0x8405('0x3e')](_0x594664,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x594664[_0x8405('0x78')]]){for(var _0x2f0b60=0x0,_0x2d754e={};_0x2f0b60=0x0?moment(_0x5e86c6['endtime'])[_0xe61f('0x19')](_0x5e86c6[_0xe61f('0x17')],_0xe61f('0x10')):null,'data1':_0xe61f('0x1a'),'data2':_0x5e86c6[_0xe61f('0x13')],'data3':_0x5e86c6[_0xe61f('0x1b')],'data4':_0x5e86c6[_0xe61f('0x1c')]||null,'role':_0xe61f('0x1d'),'internal':_0x5e86c6[_0xe61f('0x13')]?_[_0xe61f('0x14')](_0x5e86c6['accountcode']):undefined,'uniqueid':_0x5e86c6['uniqueid']},'log':_0xe61f('0x7')});}; \ No newline at end of file +var _0x5076=['toNumber','accountcode','uniqueid','voiceDialReport','membername','starttime','endtime','outbound','dialstring','agent','moment','lodash','util','../client','voiceQueueReport','queuecallerexitAt','Request','voice','lastAssignedTo','isNil','interface','format','TALKING','diff','seconds','inbound','exten','queue'];(function(_0x6dd5c,_0x4bfc19){var _0x5a87fa=function(_0x3b068b){while(--_0x3b068b){_0x6dd5c['push'](_0x6dd5c['shift']());}};_0x5a87fa(++_0x4bfc19);}(_0x5076,0xb2));var _0x6507=function(_0xc0b689,_0x21ed8c){_0xc0b689=_0xc0b689-0x0;var _0x22bcb7=_0x5076[_0xc0b689];return _0x22bcb7;};'use strict';var moment=require(_0x6507('0x0'));var _=require(_0x6507('0x1'));var util=require(_0x6507('0x2'));var client=require(_0x6507('0x3'));exports[_0x6507('0x4')]=function(_0x5139d3){var _0x32c070=_0x5139d3['queuecallercompleteAt']||_0x5139d3[_0x6507('0x5')];return client[_0x6507('0x6')]('CreateMemberReport',{'body':{'channel':_0x6507('0x7'),'membername':_0x5139d3[_0x6507('0x8')],'interface':_[_0x6507('0x9')](_0x5139d3[_0x6507('0xa')])?util[_0x6507('0xb')]('SIP/%s',_0x5139d3[_0x6507('0x8')]):_0x5139d3[_0x6507('0xa')],'type':_0x6507('0xc'),'enterAt':_0x5139d3['queuecallerleaveAt'],'exitAt':_0x32c070,'duration':moment(_0x32c070)[_0x6507('0xd')](_0x5139d3['queuecallerleaveAt'],_0x6507('0xe')),'data1':_0x6507('0xf'),'data2':_0x5139d3['calleridnum'],'data3':_0x5139d3[_0x6507('0x10')],'data4':null,'data5':_0x5139d3[_0x6507('0x11')],'role':'agent','internal':_0x5139d3['accountcode']?_[_0x6507('0x12')](_0x5139d3[_0x6507('0x13')]):undefined,'uniqueid':_0x5139d3[_0x6507('0x14')]},'log':'CreateMemberReport'});};exports[_0x6507('0x15')]=function(_0x5a6c2c){return client[_0x6507('0x6')]('CreateMemberReport',{'body':{'channel':_0x6507('0x7'),'membername':_0x5a6c2c[_0x6507('0x16')],'interface':_0x5a6c2c[_0x6507('0xa')],'type':_0x6507('0xc'),'enterAt':_0x5a6c2c[_0x6507('0x17')],'exitAt':_0x5a6c2c[_0x6507('0x18')],'duration':moment(_0x5a6c2c[_0x6507('0x18')])[_0x6507('0xd')](_0x5a6c2c['starttime'],_0x6507('0xe'))>=0x0?moment(_0x5a6c2c[_0x6507('0x18')])['diff'](_0x5a6c2c[_0x6507('0x17')],_0x6507('0xe')):null,'data1':_0x6507('0x19'),'data2':_0x5a6c2c[_0x6507('0x13')],'data3':_0x5a6c2c['exten'],'data4':_0x5a6c2c[_0x6507('0x1a')]||null,'role':_0x6507('0x1b'),'internal':_0x5a6c2c[_0x6507('0x13')]?_[_0x6507('0x12')](_0x5a6c2c['accountcode']):undefined,'uniqueid':_0x5a6c2c['uniqueid']},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 3a256bc..2ced49f 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 _0x0820=['Request','ShowSetting','stopRecordingOnTransfer','GetSettings'];(function(_0x17cec2,_0x306995){var _0x68c99a=function(_0xe89750){while(--_0xe89750){_0x17cec2['push'](_0x17cec2['shift']());}};_0x68c99a(++_0x306995);}(_0x0820,0x1c8));var _0x0082=function(_0x38373f,_0x577bc4){_0x38373f=_0x38373f-0x0;var _0x2bbb9f=_0x0820[_0x38373f];return _0x2bbb9f;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0x0082('0x0')](_0x0082('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x0082('0x2')]},'log':_0x0082('0x3')});}; \ No newline at end of file +var _0x33a1=['../client','getSettings'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x33a1,0x7c));var _0x133a=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x33a1[_0x2c91e9];return _0x13f0ff;};'use strict';var client=require(_0x133a('0x0'));exports[_0x133a('0x1')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer']},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 72fb6ac..2d7b1db 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 _0x59d8=['Request','GetTemplate','name','html','../client'];(function(_0x15b399,_0x59db1a){var _0x199f2d=function(_0x3bd31c){while(--_0x3bd31c){_0x15b399['push'](_0x15b399['shift']());}};_0x199f2d(++_0x59db1a);}(_0x59d8,0x95));var _0x859d=function(_0x7c0074,_0x1ffdcf){_0x7c0074=_0x7c0074-0x0;var _0x13e95b=_0x59d8[_0x7c0074];return _0x13e95b;};'use strict';var client=require(_0x859d('0x0'));exports['getTemplates']=function(_0x544ccf){return function(_0x2dda94){return client[_0x859d('0x1')](_0x859d('0x2'),{'options':{'raw':!![],'attributes':['id',_0x859d('0x3'),_0x859d('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0xe99c=['name','html','../client','Request','GetTemplate'];(function(_0x4d9faa,_0x2c8476){var _0x330846=function(_0x1a5df3){while(--_0x1a5df3){_0x4d9faa['push'](_0x4d9faa['shift']());}};_0x330846(++_0x2c8476);}(_0xe99c,0x197));var _0xce99=function(_0x37913a,_0x1aa10b){_0x37913a=_0x37913a-0x0;var _0x5eab78=_0xe99c[_0x37913a];return _0x5eab78;};'use strict';var client=require(_0xce99('0x0'));exports['getTemplates']=function(_0x3034ea){return function(_0x2f9bca){return client[_0xce99('0x1')](_0xce99('0x2'),{'options':{'raw':!![],'attributes':['id',_0xce99('0x3'),_0xce99('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 67e4e7b..28f0b56 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 _0x91b8=['Request','name','channel','Condition','AllConditions','field','operator','value','AnyConditions','Action','Actions','data3','data4','data5','data6','data7','GetTrigger','../client','getTriggers'];(function(_0x45e7ad,_0xf665c){var _0xd5fa6c=function(_0xfb4b53){while(--_0xfb4b53){_0x45e7ad['push'](_0x45e7ad['shift']());}};_0xd5fa6c(++_0xf665c);}(_0x91b8,0x70));var _0x891b=function(_0x88827c,_0xc85e60){_0x88827c=_0x88827c-0x0;var _0xcc5c89=_0x91b8[_0x88827c];return _0xcc5c89;};'use strict';var client=require(_0x891b('0x0'));exports[_0x891b('0x1')]=function(_0x479246){return function(_0xf4a27c){return client[_0x891b('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x891b('0x3'),_0x891b('0x4'),'status'],'include':[{'model':_0x891b('0x5'),'as':_0x891b('0x6'),'attributes':['id',_0x891b('0x7'),_0x891b('0x8'),_0x891b('0x9')]},{'model':_0x891b('0x5'),'as':_0x891b('0xa'),'attributes':['id',_0x891b('0x7'),_0x891b('0x8'),_0x891b('0x9')]},{'model':_0x891b('0xb'),'as':_0x891b('0xc'),'attributes':['id','action','data1','data2',_0x891b('0xd'),_0x891b('0xe'),_0x891b('0xf'),_0x891b('0x10'),_0x891b('0x11')]}]},'log':_0x891b('0x12')});};}; \ No newline at end of file +var _0x6ccc=['data5','data6','getTriggers','Request','GetTrigger','name','channel','status','Condition','field','operator','value','AnyConditions','Actions','action','data1','data2'];(function(_0x4ea809,_0x5416a6){var _0x31be45=function(_0x347d68){while(--_0x347d68){_0x4ea809['push'](_0x4ea809['shift']());}};_0x31be45(++_0x5416a6);}(_0x6ccc,0x9b));var _0xc6cc=function(_0x1b96ee,_0x32ffef){_0x1b96ee=_0x1b96ee-0x0;var _0x1aef42=_0x6ccc[_0x1b96ee];return _0x1aef42;};'use strict';var client=require('../client');exports[_0xc6cc('0x0')]=function(_0x2305a3){return function(_0x1e950d){return client[_0xc6cc('0x1')](_0xc6cc('0x2'),{'options':{'raw':![],'attributes':['id',_0xc6cc('0x3'),_0xc6cc('0x4'),_0xc6cc('0x5')],'include':[{'model':_0xc6cc('0x6'),'as':'AllConditions','attributes':['id',_0xc6cc('0x7'),_0xc6cc('0x8'),_0xc6cc('0x9')]},{'model':_0xc6cc('0x6'),'as':_0xc6cc('0xa'),'attributes':['id','field',_0xc6cc('0x8'),_0xc6cc('0x9')]},{'model':'Action','as':_0xc6cc('0xb'),'attributes':['id',_0xc6cc('0xc'),_0xc6cc('0xd'),_0xc6cc('0xe'),'data3','data4',_0xc6cc('0xf'),_0xc6cc('0x10'),'data7']}]},'log':_0xc6cc('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index b500977..25cbe93 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 _0x427f=['name','registry','../client','getTrunks','GetTrunk'];(function(_0x24b5c0,_0x432f0e){var _0x48f81a=function(_0x3b27c9){while(--_0x3b27c9){_0x24b5c0['push'](_0x24b5c0['shift']());}};_0x48f81a(++_0x432f0e);}(_0x427f,0x1ba));var _0xf427=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x427f[_0x1ac595];return _0x455fff;};'use strict';var client=require(_0xf427('0x0'));exports[_0xf427('0x1')]=function(_0x587bd0){return function(_0x195f58){return client['Request'](_0xf427('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xf427('0x3'),_0xf427('0x4'),'defaultuser']},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x572b=['registry','defaultuser','../client','getTrunks','Request','name'];(function(_0x2a2034,_0x4b2184){var _0x106fea=function(_0x1b123c){while(--_0x1b123c){_0x2a2034['push'](_0x2a2034['shift']());}};_0x106fea(++_0x4b2184);}(_0x572b,0x1b2));var _0xb572=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0x572b[_0x1992f1];return _0x413dfe;};'use strict';var client=require(_0xb572('0x0'));exports[_0xb572('0x1')]=function(_0x1c50e4){return function(_0x52ae8f){return client[_0xb572('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xb572('0x3'),_0xb572('0x4'),_0xb572('0x5')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index fdc5bd7..f433a21 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 _0x0713=['getAgent','Request','GetUser','agent','name','email','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getAgents','getTelephones','accountcode','internal','savePause','PauseUser'];(function(_0x322cc7,_0x33b839){var _0x5f57aa=function(_0x185de9){while(--_0x185de9){_0x322cc7['push'](_0x322cc7['shift']());}};_0x5f57aa(++_0x33b839);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'where':{'role':_0x3071('0x2')},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),'accountcode',_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),_0x3071('0xb'),_0x3071('0xc'),_0x3071('0xd')]},'log':_0x3071('0xe')});};};exports[_0x3071('0xf')]=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x3071('0x3'),_0x3071('0x10'),_0x3071('0x11')]},'log':_0x3071('0xf')});};};exports[_0x3071('0x12')]=function(_0x4a470a,_0x2ace21,_0x11a7ee){return client[_0x3071('0x0')](_0x3071('0x13'),{'body':{'type':_0x2ace21,'uniqueid':_0x11a7ee},'options':{'where':{'id':_0x4a470a['id']}},'log':_0x3071('0x12')});};exports['saveUnpause']=function(_0x5330a8){return client[_0x3071('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5330a8['id']}},'log':_0x3071('0x12')});};exports[_0x3071('0x14')]=function(_0x5d4883){return client[_0x3071('0x0')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x3071('0x2'),'id':_0x5d4883},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),_0x3071('0x10'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),'interface']},'log':_0x3071('0x14')});}; \ No newline at end of file +var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x1601e1,_0xd85370){var _0x1a982e=function(_0x384958){while(--_0x384958){_0x1601e1['push'](_0x1601e1['shift']());}};_0x1a982e(++_0xd85370);}(_0x9c44,0x178));var _0x49c4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9c44[_0x465a0c];return _0x1e202e;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index de7aea7..0d61b9d 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 _0xf06c=['update','UpdateVoiceAgentReport','../client','Request','CreateVoiceAgentReport'];(function(_0xe845f0,_0x29ce48){var _0x236cf9=function(_0x2fe93){while(--_0x2fe93){_0xe845f0['push'](_0xe845f0['shift']());}};_0x236cf9(++_0x29ce48);}(_0xf06c,0x1d8));var _0xcf06=function(_0x12687a,_0x34b58f){_0x12687a=_0x12687a-0x0;var _0x14cb37=_0xf06c[_0x12687a];return _0x14cb37;};'use strict';var client=require(_0xcf06('0x0'));exports['create']=function(_0x261249){return client[_0xcf06('0x1')](_0xcf06('0x2'),{'body':_0x261249,'log':_0xcf06('0x2')});};exports[_0xcf06('0x3')]=function(_0x2c1fe1,_0x4a03e7,_0x3002a8){return client[_0xcf06('0x1')](_0xcf06('0x4'),{'body':_0x2c1fe1,'options':{'where':{'uniqueid':_0x4a03e7,'interface':_0x3002a8,'agentcomplete':!![]}},'log':_0xcf06('0x4')});}; \ No newline at end of file +var _0x2797=['create','CreateVoiceAgentReport','Request','UpdateVoiceAgentReport','../client'];(function(_0x20aadb,_0x5a607a){var _0x520018=function(_0x1d258a){while(--_0x1d258a){_0x20aadb['push'](_0x20aadb['shift']());}};_0x520018(++_0x5a607a);}(_0x2797,0x103));var _0x7279=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x2797[_0x6131cd];return _0x47e916;};'use strict';var client=require(_0x7279('0x0'));exports[_0x7279('0x1')]=function(_0x42d3a5){return client['Request']('CreateVoiceAgentReport',{'body':_0x42d3a5,'log':_0x7279('0x2')});};exports['update']=function(_0xf9f6f1,_0x5d3165,_0x4e1d4e){return client[_0x7279('0x3')]('UpdateVoiceAgentReport',{'body':_0xf9f6f1,'options':{'where':{'uniqueid':_0x5d3165,'interface':_0x4e1d4e,'agentcomplete':!![]}},'log':_0x7279('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index ce1e692..ae8445f 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 _0xcc3b=['outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','duration','billableseconds','GetVoiceCallReports','util','lodash','Request','CreateVoiceCallReport','context','callerid','getVoiceCallReports','GetVoiceCallReport'];(function(_0x17afd2,_0x4deb5e){var _0x3c7fec=function(_0x10a031){while(--_0x10a031){_0x17afd2['push'](_0x17afd2['shift']());}};_0x3c7fec(++_0x4deb5e);}(_0xcc3b,0x196));var _0xbcc3=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xcc3b[_0xa148b7];return _0x51efd3;};'use strict';var moment=require('moment');var util=require(_0xbcc3('0x0'));var _=require(_0xbcc3('0x1'));var client=require('../client');exports['create']=function(_0xa257c4){return client[_0xbcc3('0x2')](_0xbcc3('0x3'),{'body':_['merge'](_0xa257c4,{'source':_0xa257c4['calleridnum'],'destinationcontext':_0xa257c4[_0xbcc3('0x4')],'callerid':_0xa257c4[_0xbcc3('0x5')],'amaflags':'DOCUMENTATION'}),'log':'CreateVoiceCallReport'});};exports[_0xbcc3('0x6')]=function(){return function(){return client['Request'](_0xbcc3('0x7'),{'options':{'where':{'type':[_0xbcc3('0x8')],'createdAt':{'$between':[moment()[_0xbcc3('0x9')](_0xbcc3('0xa'))[_0xbcc3('0xb')](_0xbcc3('0xc')),moment()[_0xbcc3('0xd')]('day')[_0xbcc3('0xb')](_0xbcc3('0xc'))]}},'attributes':[_0xbcc3('0xe'),'disposition',_0xbcc3('0xf'),_0xbcc3('0x10')]},'log':_0xbcc3('0x11')});};}; \ No newline at end of file +var _0xf268=['Request','CreateVoiceCallReport','merge','context','callerid','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','GetVoiceCallReports','moment','util','lodash','create'];(function(_0x16df74,_0xb46c5){var _0x1ba962=function(_0x2be75d){while(--_0x2be75d){_0x16df74['push'](_0x16df74['shift']());}};_0x1ba962(++_0xb46c5);}(_0xf268,0x176));var _0x8f26=function(_0x56857c,_0x4868cb){_0x56857c=_0x56857c-0x0;var _0x4027e7=_0xf268[_0x56857c];return _0x4027e7;};'use strict';var moment=require(_0x8f26('0x0'));var util=require(_0x8f26('0x1'));var _=require(_0x8f26('0x2'));var client=require('../client');exports[_0x8f26('0x3')]=function(_0x36b694){return client[_0x8f26('0x4')](_0x8f26('0x5'),{'body':_[_0x8f26('0x6')](_0x36b694,{'source':_0x36b694['calleridnum'],'destinationcontext':_0x36b694[_0x8f26('0x7')],'callerid':_0x36b694[_0x8f26('0x8')],'amaflags':'DOCUMENTATION'}),'log':_0x8f26('0x5')});};exports[_0x8f26('0x9')]=function(){return function(){return client['Request'](_0x8f26('0xa'),{'options':{'where':{'type':[_0x8f26('0xb')],'createdAt':{'$between':[moment()[_0x8f26('0xc')](_0x8f26('0xd'))[_0x8f26('0xe')](_0x8f26('0xf')),moment()[_0x8f26('0x10')](_0x8f26('0xd'))[_0x8f26('0xe')](_0x8f26('0xf'))]}},'attributes':[_0x8f26('0x11'),_0x8f26('0x12'),_0x8f26('0x13'),'billableseconds']},'log':_0x8f26('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 385e793..fcf2cf3 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 _0x4639=['../client','Request','CreateVoiceDialReport'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x4639,0x66));var _0x9463=function(_0x2ed51e,_0x20d606){_0x2ed51e=_0x2ed51e-0x0;var _0x44318c=_0x4639[_0x2ed51e];return _0x44318c;};'use strict';var client=require(_0x9463('0x0'));exports['create']=function(_0x569e1c){return client[_0x9463('0x1')](_0x9463('0x2'),{'body':_0x569e1c,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x164a=['CreateVoiceDialReport','../client','create','Request'];(function(_0x3c2a82,_0x362c4f){var _0x47ec9d=function(_0x2386ce){while(--_0x2386ce){_0x3c2a82['push'](_0x3c2a82['shift']());}};_0x47ec9d(++_0x362c4f);}(_0x164a,0x15d));var _0xa164=function(_0x50b1c5,_0x1cf2a9){_0x50b1c5=_0x50b1c5-0x0;var _0x344f99=_0x164a[_0x50b1c5];return _0x344f99;};'use strict';var client=require(_0xa164('0x0'));exports[_0xa164('0x1')]=function(_0xa71962){return client[_0xa164('0x2')]('CreateVoiceDialReport',{'body':_0xa71962,'log':_0xa164('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 10bf555..2d0017e 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 _0x58a7=['recordingFormat','../client','getVoiceExtensions','Request','GetVoiceExtension','exten'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x58a7,0xf7));var _0x758a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x58a7[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0x758a('0x0'));exports[_0x758a('0x1')]=function(){return function(){return client[_0x758a('0x2')](_0x758a('0x3'),{'options':{'raw':!![],'attributes':['id',_0x758a('0x4'),_0x758a('0x5')],'where':{'VoiceExtensionId':null}},'log':_0x758a('0x1')});};}; \ No newline at end of file +var _0x8e0d=['exten','getVoiceExtensions','../client','GetVoiceExtension'];(function(_0x35ccde,_0xbe027){var _0xbd6110=function(_0xba7aea){while(--_0xba7aea){_0x35ccde['push'](_0x35ccde['shift']());}};_0xbd6110(++_0xbe027);}(_0x8e0d,0x82));var _0xd8e0=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0x8e0d[_0x266618];return _0x54dbf5;};'use strict';var client=require(_0xd8e0('0x0'));exports['getVoiceExtensions']=function(){return function(){return client['Request'](_0xd8e0('0x1'),{'options':{'raw':!![],'attributes':['id',_0xd8e0('0x2'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xd8e0('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 42c953b..d87a875 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 _0x112f=['dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','name','active','Pause','mandatoryDispositionPause','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','acw','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x112f,0x116));var _0xf112=function(_0x2044ae,_0x12c028){_0x2044ae=_0x2044ae-0x0;var _0x2db12e=_0x112f[_0x2044ae];return _0x2db12e;};'use strict';var client=require(_0xf112('0x0'));exports[_0xf112('0x1')]=function(){return function(){return client[_0xf112('0x2')](_0xf112('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xf112('0x4'),'acwTimeout',_0xf112('0x5'),_0xf112('0x6'),_0xf112('0x7'),_0xf112('0x8'),_0xf112('0x9'),_0xf112('0xa'),_0xf112('0xb'),_0xf112('0xc'),'dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval',_0xf112('0xd'),_0xf112('0xe'),_0xf112('0xf'),_0xf112('0x10'),'dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry',_0xf112('0x11'),_0xf112('0x12'),_0xf112('0x13'),_0xf112('0x14'),_0xf112('0x15'),'dialGlobalMaxRetry',_0xf112('0x16'),_0xf112('0x17'),_0xf112('0x18'),_0xf112('0x19'),_0xf112('0x1a'),_0xf112('0x1b'),_0xf112('0x1c'),_0xf112('0x1d'),_0xf112('0x1e'),_0xf112('0x1f'),_0xf112('0x20'),_0xf112('0x21'),'dialAMDSilenceThreshold',_0xf112('0x22'),_0xf112('0x23'),_0xf112('0x24'),_0xf112('0x25'),_0xf112('0x26'),_0xf112('0x27'),_0xf112('0x28'),_0xf112('0x29'),_0xf112('0x6'),_0xf112('0x2a'),_0xf112('0x2b'),_0xf112('0x2c'),_0xf112('0x2d'),_0xf112('0x2e'),_0xf112('0x2f'),_0xf112('0x30'),_0xf112('0x31'),'dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency',_0xf112('0x32'),_0xf112('0x33'),_0xf112('0x34'),_0xf112('0x35'),_0xf112('0x36')],'include':[{'model':_0xf112('0x37'),'as':_0xf112('0x37'),'attributes':['id',_0xf112('0x38'),'callerid',_0xf112('0x39')]},{'model':_0xf112('0x3a'),'as':_0xf112('0x3b'),'attributes':['id',_0xf112('0x38')]},{'model':_0xf112('0x37'),'as':'TrunkBackup','attributes':['id','name','callerid',_0xf112('0x39')]},{'model':_0xf112('0x3c'),'as':_0xf112('0x3c'),'attributes':['id',_0xf112('0x38')],'include':[{'model':_0xf112('0x3c'),'as':_0xf112('0x3d'),'attributes':['id','name',_0xf112('0x3e')]}]}]},'log':_0xf112('0x1')});};}; \ No newline at end of file +var _0x96f8=['dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','Interval','Intervals','interval','Request','GetVoiceQueue','name','acw','autopause','type','dialActive','dialMethod','dialLimitChannel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry'];(function(_0x26823d,_0x415525){var _0x238cfe=function(_0x1f0822){while(--_0x1f0822){_0x26823d['push'](_0x26823d['shift']());}};_0x238cfe(++_0x415525);}(_0x96f8,0x1ad));var _0x896f=function(_0x527585,_0x192a39){_0x527585=_0x527585-0x0;var _0xe4652c=_0x96f8[_0x527585];return _0xe4652c;};'use strict';var client=require('../client');exports['getVoiceQueues']=function(){return function(){return client[_0x896f('0x0')](_0x896f('0x1'),{'options':{'raw':![],'attributes':['id',_0x896f('0x2'),_0x896f('0x3'),'acwTimeout',_0x896f('0x4'),'monitor_format',_0x896f('0x5'),_0x896f('0x6'),_0x896f('0x7'),_0x896f('0x8'),'dialLimitQueue','dialPowerLevel',_0x896f('0x9'),_0x896f('0xa'),_0x896f('0xb'),_0x896f('0xc'),_0x896f('0xd'),'dialOriginateTimeout',_0x896f('0xe'),_0x896f('0xf'),_0x896f('0x10'),_0x896f('0x11'),_0x896f('0x12'),_0x896f('0x13'),'dialBusyRetryFrequency',_0x896f('0x14'),'dialNoAnswerRetryFrequency',_0x896f('0x15'),_0x896f('0x16'),_0x896f('0x17'),'dialPrefix','dialCheckDuplicateType',_0x896f('0x18'),_0x896f('0x19'),_0x896f('0x1a'),_0x896f('0x1b'),_0x896f('0x1c'),_0x896f('0x1d'),_0x896f('0x1e'),_0x896f('0x1f'),_0x896f('0x20'),_0x896f('0x21'),_0x896f('0x22'),_0x896f('0x23'),_0x896f('0x24'),'dialOrderByScheduledAt',_0x896f('0x25'),_0x896f('0x26'),_0x896f('0x27'),'monitor_format','strategy',_0x896f('0x28'),_0x896f('0x29'),_0x896f('0x2a'),_0x896f('0x2b'),'dialDropMaxRetry',_0x896f('0x2c'),'dialAbandonedMaxRetry',_0x896f('0x2d'),_0x896f('0x2e'),_0x896f('0x2f'),_0x896f('0x30'),_0x896f('0x31'),'mandatoryDisposition',_0x896f('0x32'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':_0x896f('0x33'),'as':_0x896f('0x33'),'attributes':['id',_0x896f('0x2'),_0x896f('0x34'),_0x896f('0x35')]},{'model':_0x896f('0x36'),'as':_0x896f('0x37'),'attributes':['id',_0x896f('0x2')]},{'model':_0x896f('0x33'),'as':'TrunkBackup','attributes':['id',_0x896f('0x2'),_0x896f('0x34'),'active']},{'model':_0x896f('0x38'),'as':'Interval','attributes':['id',_0x896f('0x2')],'include':[{'model':_0x896f('0x38'),'as':_0x896f('0x39'),'attributes':['id',_0x896f('0x2'),_0x896f('0x3a')]}]}]},'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 71e7557..cc8dfaf 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(_0x50dfa4,_0x1e9bb2){var _0x9c4062=function(_0x9b0b2b){while(--_0x9b0b2b){_0x50dfa4['push'](_0x50dfa4['shift']());}};_0x9c4062(++_0x1e9bb2);}(_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 +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(_0x559b77,_0x5b462a){var _0x16fdc8=function(_0x5102c7){while(--_0x5102c7){_0x559b77['push'](_0x559b77['shift']());}};_0x16fdc8(++_0x5b462a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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 c8639db..3f53aca 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 _0x3b4e=['getVoiceQueueRtPauses','../client','GetVoiceQueueRtPauses'];(function(_0x51407e,_0x3f024e){var _0x22e929=function(_0x144df6){while(--_0x144df6){_0x51407e['push'](_0x51407e['shift']());}};_0x22e929(++_0x3f024e);}(_0x3b4e,0x169));var _0xe3b4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3b4e[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xe3b4('0x0'));exports['getVoiceQueueRtPauses']=function(_0xef275d){return function(){return client['Request'](_0xe3b4('0x1'),{'options':{'where':{'VoiceQueueId':_0xef275d,'paused':!![]},'raw':!![]},'log':_0xe3b4('0x2')});};}; \ No newline at end of file +var _0x6e88=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x47a612,_0xdfae51){var _0x2937c1=function(_0x4a19ca){while(--_0x4a19ca){_0x47a612['push'](_0x47a612['shift']());}};_0x2937c1(++_0xdfae51);}(_0x6e88,0x1a7));var _0x86e8=function(_0x2cf0b6,_0x2ea598){_0x2cf0b6=_0x2cf0b6-0x0;var _0x3b2e91=_0x6e88[_0x2cf0b6];return _0x3b2e91;};'use strict';var client=require(_0x86e8('0x0'));exports[_0x86e8('0x1')]=function(_0x4f8a91){return function(){return client[_0x86e8('0x2')](_0x86e8('0x3'),{'options':{'where':{'VoiceQueueId':_0x4f8a91,'paused':!![]},'raw':!![]},'log':_0x86e8('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 064c2f2..03b60a2 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(_0x572600,_0x18d042){var _0x1db19c=function(_0x3fd54d){while(--_0x3fd54d){_0x572600['push'](_0x572600['shift']());}};_0x1db19c(++_0x18d042);}(_0x7a54,0x106));var _0x47a5=function(_0x24ad7d,_0x1b4662){_0x24ad7d=_0x24ad7d-0x0;var _0x39193d=_0x7a54[_0x24ad7d];return _0x39193d;};'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 _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x8874f2,_0x52aef7){var _0x45673a=function(_0x3df184){while(--_0x3df184){_0x8874f2['push'](_0x8874f2['shift']());}};_0x45673a(++_0x52aef7);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 03c8bfe..8637730 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 _0x8b31=['origtransfererexten','attended','../client','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transferercontext','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','context','extension','blind','origtransferercalleridnum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetlinkedid','isexternal','origtransferercontext'];(function(_0x1ba697,_0x186781){var _0x433b23=function(_0xe5df67){while(--_0xe5df67){_0x1ba697['push'](_0x1ba697['shift']());}};_0x433b23(++_0x186781);}(_0x8b31,0x71));var _0x18b3=function(_0x2229c8,_0x3f24f5){_0x2229c8=_0x2229c8-0x0;var _0x120708=_0x8b31[_0x2229c8];return _0x120708;};'use strict';var client=require(_0x18b3('0x0'));exports['transfers']={};exports[_0x18b3('0x1')]=function(_0xca5450){return client[_0x18b3('0x2')](_0x18b3('0x3'),{'body':{'result':_0xca5450[_0x18b3('0x4')],'transfererchannel':_0xca5450[_0x18b3('0x5')],'transferercalleridnum':_0xca5450[_0x18b3('0x6')],'transferercalleridname':_0xca5450[_0x18b3('0x7')],'transfererconnectedlinenum':_0xca5450[_0x18b3('0x8')],'transfererconnectedlinename':_0xca5450['transfererconnectedlinename'],'transfereraccountcode':_0xca5450['transfereraccountcode'],'transferercontext':_0xca5450[_0x18b3('0x9')],'transfererexten':_0xca5450['transfererexten'],'transfererlinkedid':_0xca5450['transfererlinkedid'],'transfereechannel':_0xca5450[_0x18b3('0xa')],'transfereecalleridnum':_0xca5450['transfereecalleridnum'],'transfereecalleridname':_0xca5450[_0x18b3('0xb')],'transfereeconnectedlinenum':_0xca5450[_0x18b3('0xc')],'transfereeconnectedlinename':_0xca5450[_0x18b3('0xd')],'transfereeaccountcode':_0xca5450[_0x18b3('0xe')],'transfereecontext':_0xca5450[_0x18b3('0xf')],'transfereeexten':_0xca5450['transfereeexten'],'transfereelinkedid':_0xca5450[_0x18b3('0x10')],'isexternal':_0xca5450['isexternal'],'context':_0xca5450[_0x18b3('0x11')],'extension':_0xca5450[_0x18b3('0x12')],'type':_0x18b3('0x13')},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0x796bee){return client[_0x18b3('0x2')](_0x18b3('0x3'),{'body':{'result':_0x796bee[_0x18b3('0x4')],'transfererchannel':_0x796bee['origtransfererchannel'],'transferercalleridnum':_0x796bee[_0x18b3('0x14')],'transferercalleridname':_0x796bee['origtransferercalleridname'],'transfererconnectedlinenum':_0x796bee['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x796bee[_0x18b3('0x15')],'transfereraccountcode':_0x796bee[_0x18b3('0x16')],'transferercontext':_0x796bee[_0x18b3('0x17')],'transfererexten':_0x796bee[_0x18b3('0x18')],'transfererlinkedid':_0x796bee[_0x18b3('0x19')],'transfereechannel':_0x796bee[_0x18b3('0x1a')],'transfereecalleridnum':_0x796bee[_0x18b3('0x1b')],'transfereecalleridname':_0x796bee[_0x18b3('0x1c')],'transfereeconnectedlinenum':_0x796bee[_0x18b3('0x1d')],'transfereeconnectedlinename':_0x796bee[_0x18b3('0x1e')],'transfereeaccountcode':_0x796bee['transfertargetaccountcode'],'transfereecontext':_0x796bee[_0x18b3('0x1f')],'transfereeexten':_0x796bee['transfertargetexten'],'transfereelinkedid':_0x796bee[_0x18b3('0x20')],'isexternal':_0x796bee[_0x18b3('0x21')],'context':_0x796bee[_0x18b3('0x22')],'extension':_0x796bee[_0x18b3('0x23')],'type':_0x18b3('0x24')},'log':_0x18b3('0x3')});}; \ No newline at end of file +var _0x155e=['transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','blind','attendedTransfer','CreateVoiceTransferReport','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','origtransferercontext','origtransfererexten','attended','../client','Request','result','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x155e,0x18b));var _0xe155=function(_0x283e4d,_0xd4043c){_0x283e4d=_0x283e4d-0x0;var _0x3ee73a=_0x155e[_0x283e4d];return _0x3ee73a;};'use strict';var client=require(_0xe155('0x0'));exports['transfers']={};exports['blindTransfer']=function(_0xfe5ad8){return client[_0xe155('0x1')]('CreateVoiceTransferReport',{'body':{'result':_0xfe5ad8[_0xe155('0x2')],'transfererchannel':_0xfe5ad8[_0xe155('0x3')],'transferercalleridnum':_0xfe5ad8[_0xe155('0x4')],'transferercalleridname':_0xfe5ad8['transferercalleridname'],'transfererconnectedlinenum':_0xfe5ad8[_0xe155('0x5')],'transfererconnectedlinename':_0xfe5ad8[_0xe155('0x6')],'transfereraccountcode':_0xfe5ad8[_0xe155('0x7')],'transferercontext':_0xfe5ad8[_0xe155('0x8')],'transfererexten':_0xfe5ad8[_0xe155('0x9')],'transfererlinkedid':_0xfe5ad8[_0xe155('0xa')],'transfereechannel':_0xfe5ad8['transfereechannel'],'transfereecalleridnum':_0xfe5ad8[_0xe155('0xb')],'transfereecalleridname':_0xfe5ad8[_0xe155('0xc')],'transfereeconnectedlinenum':_0xfe5ad8[_0xe155('0xd')],'transfereeconnectedlinename':_0xfe5ad8[_0xe155('0xe')],'transfereeaccountcode':_0xfe5ad8['transfereeaccountcode'],'transfereecontext':_0xfe5ad8[_0xe155('0xf')],'transfereeexten':_0xfe5ad8[_0xe155('0x10')],'transfereelinkedid':_0xfe5ad8[_0xe155('0x11')],'isexternal':_0xfe5ad8[_0xe155('0x12')],'context':_0xfe5ad8[_0xe155('0x13')],'extension':_0xfe5ad8['extension'],'type':_0xe155('0x14')},'log':'CreateVoiceTransferReport'});};exports[_0xe155('0x15')]=function(_0x353d11){return client['Request'](_0xe155('0x16'),{'body':{'result':_0x353d11[_0xe155('0x2')],'transfererchannel':_0x353d11[_0xe155('0x17')],'transferercalleridnum':_0x353d11[_0xe155('0x18')],'transferercalleridname':_0x353d11[_0xe155('0x19')],'transfererconnectedlinenum':_0x353d11[_0xe155('0x1a')],'transfererconnectedlinename':_0x353d11[_0xe155('0x1b')],'transfereraccountcode':_0x353d11[_0xe155('0x1c')],'transferercontext':_0x353d11[_0xe155('0x1d')],'transfererexten':_0x353d11[_0xe155('0x1e')],'transfererlinkedid':_0x353d11[_0xe155('0x1f')],'transfereechannel':_0x353d11[_0xe155('0x20')],'transfereecalleridnum':_0x353d11[_0xe155('0x21')],'transfereecalleridname':_0x353d11[_0xe155('0x22')],'transfereeconnectedlinenum':_0x353d11['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x353d11[_0xe155('0x23')],'transfereeaccountcode':_0x353d11[_0xe155('0x24')],'transfereecontext':_0x353d11['transfertargetcontext'],'transfereeexten':_0x353d11[_0xe155('0x25')],'transfereelinkedid':_0x353d11['transfertargetlinkedid'],'isexternal':_0x353d11[_0xe155('0x12')],'context':_0x353d11[_0xe155('0x26')],'extension':_0x353d11[_0xe155('0x27')],'type':_0xe155('0x28')},'log':_0xe155('0x16')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 75cf5c6..0c83e08 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 _0x31c2=['wav','MixMonitor','channel','ai(mixmonitorid)','monitors','toLowerCase','isNil','push','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','destinationchannel','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','outboundChannels','outbound','campaigns','run','event','Event\x20name\x20mandatory','emit','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','message','catch','command','Command','then','content','voiceQueues','hasOwnProperty','strategy','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','type','unmanaged','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','length','find','omit','undefined','values','channels','voicechannel','map','uniqueid','format','%s.%s','filename'];(function(_0x5893f5,_0xbea086){var _0x59773b=function(_0x14716c){while(--_0x14716c){_0x5893f5['push'](_0x5893f5['shift']());}};_0x59773b(++_0xbea086);}(_0x31c2,0x1e1));var _0x231c=function(_0x598a9b,_0x29501f){_0x598a9b=_0x598a9b-0x0;var _0x5bddfc=_0x31c2[_0x598a9b];return _0x5bddfc;};'use strict';var _=require(_0x231c('0x0'));var util=require(_0x231c('0x1'));var jayson=require(_0x231c('0x2'));var schema=require(_0x231c('0x3'));var BPromise=require(_0x231c('0x4'));var moment=require(_0x231c('0x5'));var config=require(_0x231c('0x6'));var properties=require(_0x231c('0x7'));var ami=require('../ami');exports['listen']=function(_0x2b7d5f,_0x1b9d64,_0x1f3f7d){return new BPromise(function(_0x219c3f,_0x48bfb2){var _0x111bf9={'QueuePause':function(_0x49ff9e){return new Promise(function(_0x439df8,_0x38b3b9){var _0x1000c9=util['format'](_0x231c('0x8'),_0x231c('0x9'),_0x49ff9e[_0x231c('0xa')]);if(_0x2b7d5f[_0x231c('0xb')]&&_0x2b7d5f[_0x231c('0xb')][_0x1000c9]&&_0x2b7d5f[_0x231c('0xb')][_0x1000c9][_0x231c('0xc')]){_0x2b7d5f['timers'][_0x1000c9][_0x231c('0xd')]();}if(_0x2b7d5f[_0x231c('0xe')][_0x1000c9]){_0x2b7d5f['agents'][_0x1000c9][_0x231c('0xf')]({'statePause':_0x49ff9e[_0x231c('0x10')]?!![]:![]});}_0x439df8({'code':0xc8,'message':_0x231c('0x11')});});},'Reload':function(_0x1aa3fe){var _0x284280=this;return new Promise(function(_0x1404bc,_0x2c4f75){if(ami[_0x231c('0x12')]()==![]){return _0x2c4f75(_0x284280[_0x231c('0x13')](0x1f4,[config[_0x231c('0x14')]['ip'],config[_0x231c('0x14')][_0x231c('0x15')],_0x231c('0x16')][_0x231c('0x17')]('\x20')));}_0x1aa3fe=_[_0x231c('0x18')](_0x1aa3fe,_[_0x231c('0x19')](properties[_0x231c('0x1a')]));_0x1aa3fe[_0x231c('0x1b')]=_0x231c('0x1c');return ami[_0x231c('0x1d')](_0x1aa3fe)['then'](function(_0x599cd6){_0x1404bc({'code':0xc8,'message':_0x599cd6[_0x231c('0x1e')]});})[_0x231c('0x1f')](function(_0xadea80){_0x2c4f75(_0x284280[_0x231c('0x13')](0x1f5,_0xadea80[_0x231c('0x1e')]));});});},'Command':function(_0x3c3ea6){var _0x172d50=this;return new Promise(function(_0x2890e3,_0x1c9c85){if(ami['isConnected']()==![]){return _0x1c9c85(_0x172d50[_0x231c('0x13')](0x1f4,[config['asterisk']['ip'],config[_0x231c('0x14')]['username'],_0x231c('0x16')][_0x231c('0x17')]('\x20')));}_0x3c3ea6=_[_0x231c('0x18')](_0x3c3ea6,_0x231c('0x20'));_0x3c3ea6[_0x231c('0x1b')]=_0x231c('0x21');return ami[_0x231c('0x1d')](_0x3c3ea6)[_0x231c('0x22')](function(_0x54566f){_0x2890e3({'code':0xc8,'message':_0x54566f[_0x231c('0x23')]});})[_0x231c('0x1f')](function(_0x4af49b){_0x1c9c85(_0x172d50[_0x231c('0x13')](0x1f5,_0x4af49b[_0x231c('0x1e')]));});});},'VoiceQueues':function(_0x5c569a){return new Promise(function(_0x318dad,_0x564939){var _0x3ea0cd=[];for(var _0x454f70 in _0x2b7d5f[_0x231c('0x24')]){if(_0x2b7d5f[_0x231c('0x24')][_0x231c('0x25')](_0x454f70)){var _0x131cfd=_0x2b7d5f[_0x231c('0x24')][_0x454f70];var _0x4caf68={'id':_0x131cfd['id'],'name':_0x131cfd[_0x231c('0xa')],'strategy':_0x131cfd[_0x231c('0x26')],'answered':_0x131cfd['answered'],'available':_0x131cfd[_0x231c('0x27')],'loggedIn':_0x131cfd[_0x231c('0x28')],'pTalking':_0x131cfd[_0x231c('0x29')],'sumBillable':_0x131cfd[_0x231c('0x2a')],'sumDuration':_0x131cfd[_0x231c('0x2b')],'sumHoldTime':_0x131cfd[_0x231c('0x2c')]||0x0,'talking':_0x131cfd[_0x231c('0x2d')],'total':_0x131cfd['total'],'type':_0x131cfd[_0x231c('0x2e')],'unmanaged':_0x131cfd[_0x231c('0x2f')],'abandoned':_0x131cfd['abandoned'],'waiting':_0x131cfd['waiting'],'loggedInDb':_0x131cfd['loggedInDb']};if(_0x131cfd[_0x231c('0x2e')]==='outbound'){_0x4caf68[_0x231c('0x30')]=_0x131cfd['dialActive'];_0x4caf68[_0x231c('0x31')]=_0x131cfd[_0x231c('0x31')];_0x4caf68[_0x231c('0x32')]=_0x131cfd[_0x231c('0x32')];_0x4caf68['dialOriginateCallerIdNumber']=_0x131cfd[_0x231c('0x33')];_0x4caf68[_0x231c('0x34')]=_0x131cfd[_0x231c('0x34')];_0x4caf68[_0x231c('0x35')]=_0x131cfd[_0x231c('0x35')];_0x4caf68[_0x231c('0x36')]=_0x131cfd[_0x231c('0x36')];_0x4caf68[_0x231c('0x37')]=_0x131cfd['outboundAnswerAgiCallsDay'];_0x4caf68['outboundAnswerCallsDay']=_0x131cfd[_0x231c('0x38')];_0x4caf68[_0x231c('0x39')]=_0x131cfd[_0x231c('0x39')];_0x4caf68[_0x231c('0x3a')]=_0x131cfd[_0x231c('0x3a')];_0x4caf68[_0x231c('0x3b')]=_0x131cfd['outboundCongestionCallsDay'];_0x4caf68[_0x231c('0x3c')]=_0x131cfd[_0x231c('0x3c')];_0x4caf68['outboundDropCallsDayCallersExit']=_0x131cfd['outboundDropCallsDayCallersExit'];_0x4caf68[_0x231c('0x3d')]=_0x131cfd['outboundDropCallsDayTimeout'];_0x4caf68[_0x231c('0x3e')]=_0x131cfd['outboundNoAnswerCallsDay'];_0x4caf68[_0x231c('0x3f')]=_0x131cfd[_0x231c('0x3f')];_0x4caf68['outboundOriginateFailureCallsDay']=_0x131cfd[_0x231c('0x40')];_0x4caf68[_0x231c('0x41')]=_0x131cfd[_0x231c('0x41')];_0x4caf68['outboundRejectCallsDay']=_0x131cfd[_0x231c('0x42')];_0x4caf68[_0x231c('0x43')]=_0x131cfd[_0x231c('0x43')];_0x4caf68[_0x231c('0x44')]=_0x131cfd[_0x231c('0x44')];_0x4caf68[_0x231c('0x45')]=_0x131cfd[_0x231c('0x45')];_0x4caf68[_0x231c('0x46')]=_0x131cfd[_0x231c('0x46')];_0x4caf68[_0x231c('0x47')]=_0x131cfd[_0x231c('0x47')];_0x4caf68[_0x231c('0x48')]=_0x131cfd[_0x231c('0x48')];_0x4caf68['predictiveIntervalErlangCalls']=_0x131cfd[_0x231c('0x49')];_0x4caf68[_0x231c('0x4a')]=_0x131cfd[_0x231c('0x4a')];_0x4caf68[_0x231c('0x4b')]=_0x131cfd[_0x231c('0x4b')];_0x4caf68['predictiveIntervalMultiplicativeFactor']=_0x131cfd[_0x231c('0x4c')];_0x4caf68[_0x231c('0x4d')]=_0x131cfd[_0x231c('0x4d')];_0x4caf68['predictiveIntervalAvailable']=_0x131cfd[_0x231c('0x4e')];_0x4caf68[_0x231c('0x4f')]=_0x131cfd[_0x231c('0x4f')];_0x4caf68[_0x231c('0x1e')]=_0x131cfd[_0x231c('0x1e')];_0x4caf68[_0x231c('0x50')]=_0x131cfd['originated'];_0x4caf68[_0x231c('0x51')]=_0x131cfd[_0x231c('0x51')];_0x4caf68[_0x231c('0x52')]=_0x131cfd[_0x231c('0x52')];_0x4caf68['erlangAbandonmentRate']=_0x131cfd[_0x231c('0x53')];_0x4caf68['erlangBusyFactor']=_0x131cfd[_0x231c('0x54')];_0x4caf68['startPredictive']=_0x131cfd[_0x231c('0x55')];_0x4caf68[_0x231c('0x56')]=_0x131cfd[_0x231c('0x56')];}if(_0x131cfd[_0x231c('0x57')]){_0x4caf68[_0x231c('0x57')]={'id':_0x131cfd[_0x231c('0x57')]['id'],'name':_0x131cfd['Trunk'][_0x231c('0xa')],'active':_0x131cfd[_0x231c('0x57')][_0x231c('0x58')],'callerid':_0x131cfd['Trunk'][_0x231c('0x59')]};}if(_0x131cfd[_0x231c('0x5a')]){_0x4caf68[_0x231c('0x5a')]={'id':_0x131cfd[_0x231c('0x5a')]['id'],'name':_0x131cfd['Interval'][_0x231c('0xa')]};}_0x3ea0cd['push'](_0x4caf68);}}_0x318dad({'count':_0x3ea0cd[_0x231c('0x5b')],'rows':_0x3ea0cd});});},'UpdateVoiceQueue':function(_0x446cf1){return new Promise(function(_0x4c1451,_0x436907){var _0x3d88d3=_[_0x231c('0x5c')](_0x2b7d5f[_0x231c('0x24')],{'id':parseInt(_0x446cf1['id'])});var _0x27ab66=_[_0x231c('0x5d')](_0x446cf1,['id']);if(_0x3d88d3){for(var _0x450f70 in _0x27ab66){if(typeof _0x27ab66[_0x450f70]!==_0x231c('0x5e')&&typeof _0x3d88d3[_0x450f70]!==_0x231c('0x5e')){_0x3d88d3[_0x450f70]=_0x27ab66[_0x450f70];}}_0x4c1451(_0x3d88d3);}else{_0x436907();}});},'VoiceChannels':function(_0x80ef81){return new Promise(function(_0x373fc7,_0x53f33d){var _0x18aaca=_[_0x231c('0x5f')](_0x2b7d5f[_0x231c('0x60')]);_0x373fc7({'count':_0x18aaca[_0x231c('0x5b')],'rows':_0x18aaca});});},'VoiceChannelMixMonitor':function(_0x25500d){var _0x565493=this;return new Promise(function(_0x5b096d,_0x317c11){if(ami['isConnected']()==![]){return _0x317c11(_0x565493[_0x231c('0x13')](0x1f4,[config[_0x231c('0x14')]['ip'],config[_0x231c('0x14')]['username'],_0x231c('0x16')]['join']('\x20')));}var _0x2c9336=schema(properties[_0x231c('0x61')])['validate'](_0x25500d);if(_0x2c9336[_0x231c('0x5b')]>0x0){return _0x317c11(_0x565493[_0x231c('0x13')](0x1f4,_[_0x231c('0x62')](_0x2c9336,'message')['join'](',\x20')));}var _0x4a93af=_[_0x231c('0x5c')](_0x2b7d5f[_0x231c('0x60')],{'uniqueid':_0x25500d[_0x231c('0x63')]});if(_0x4a93af&&_0x4a93af['channel']){var _0x228615=util[_0x231c('0x64')](_0x231c('0x65'),_0x25500d[_0x231c('0x66')]||_0x25500d[_0x231c('0x63')],_0x25500d[_0x231c('0x64')]||_0x231c('0x67'));return ami[_0x231c('0x1d')]({'action':_0x231c('0x68'),'channel':_0x4a93af[_0x231c('0x69')],'file':_0x228615,'options':_0x231c('0x6a')})['then'](function(_0xd29a0d){var _0x27cecf=_['find'](_0x4a93af[_0x231c('0x6b')],{'filename':'/var/spool/asterisk/monitor/'+_0x228615[_0x231c('0x6c')]()});if(_[_0x231c('0x6d')](_0x27cecf)){_0x4a93af[_0x231c('0x6b')][_0x231c('0x6e')]({'filename':_0x231c('0x6f')+_0x228615[_0x231c('0x6c')](),'createdAt':moment()[_0x231c('0x64')](_0x231c('0x70')),'mixmonitorid':_0xd29a0d[_0x231c('0x71')],'status':_0x231c('0x72')});}else{_0x27cecf['mixmonitorid']=_0xd29a0d[_0x231c('0x71')];_0x27cecf[_0x231c('0x73')]=_0x231c('0x72');}_0x5b096d({'code':0xc8,'message':[_0x25500d['uniqueid'],_0x231c('0x74'),_0xd29a0d[_0x231c('0x71')]]['join']('\x20'),'mixmonitorid':_0xd29a0d[_0x231c('0x71')]});})['catch'](function(_0x14f28b){_0x317c11(_0x565493[_0x231c('0x13')](0x1f5,[_0x25500d[_0x231c('0x63')],_0x14f28b[_0x231c('0x1e')][_0x231c('0x6c')]()]['join']('\x20')));});}else{return _0x317c11(_0x565493[_0x231c('0x13')](0x1f5,_0x231c('0x75')));}});},'VoiceChannelStopMixMonitor':function(_0xd016a9){var _0x2bd806=this;return new Promise(function(_0x2889fb,_0x29ceda){if(ami[_0x231c('0x12')]()==![]){return _0x29ceda(_0x2bd806['error'](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x231c('0x15')],_0x231c('0x16')]['join']('\x20')));}var _0x28ce15=schema(properties['voicechannel'])[_0x231c('0x3')](_0xd016a9);if(_0x28ce15[_0x231c('0x5b')]>0x0){return _0x29ceda(_0x2bd806[_0x231c('0x13')](0x1f4,_[_0x231c('0x62')](_0x28ce15,'message')[_0x231c('0x17')](',\x20')));}var _0x586866=_[_0x231c('0x5c')](_0x2b7d5f['channels'],{'uniqueid':_0xd016a9['uniqueid']});if(_0x586866){return BPromise[_0x231c('0x76')]()['then'](function(){if(_0x586866[_0x231c('0x69')]){return ami[_0x231c('0x1d')]({'action':'StopMixMonitor','channel':_0x586866[_0x231c('0x69')],'mixmonitorid':_0xd016a9[_0x231c('0x71')]})[_0x231c('0x1f')](function(_0x163561){});}})[_0x231c('0x22')](function(){if(_0x586866[_0x231c('0x77')]){return ami['Action']({'action':'StopMixMonitor','channel':_0x586866['destinationchannel'],'mixmonitorid':_0xd016a9[_0x231c('0x71')]})[_0x231c('0x1f')](function(_0xfed294){});}})[_0x231c('0x22')](function(_0xb72644){var _0x58b010=_['find'](_0x586866[_0x231c('0x6b')],{'mixmonitorid':_0xd016a9[_0x231c('0x71')]});if(_0x58b010){_0x58b010[_0x231c('0x73')]='stop';}})[_0x231c('0x22')](function(){var _0x1d2afa=util[_0x231c('0x64')](_0x231c('0x65'),_0xd016a9['filename']||_0xd016a9['uniqueid'],_0xd016a9['format']||_0x231c('0x67'));var _0x330f0e=_['find'](_0x586866[_0x231c('0x6b')],{'filename':_0x231c('0x6f')+_0x1d2afa[_0x231c('0x6c')]()});if(_0x330f0e){_0x330f0e[_0x231c('0x73')]=_0x231c('0x78');}})[_0x231c('0x22')](function(){_0x2889fb({'code':0xc8,'message':[_0xd016a9['uniqueid'],_0x231c('0x79')][_0x231c('0x17')]('\x20')});})[_0x231c('0x1f')](function(_0x496dc3){_0x29ceda(_0x2bd806[_0x231c('0x13')](0x1f5,[_0xd016a9[_0x231c('0x63')],_0x496dc3[_0x231c('0x1e')]['toLowerCase']()][_0x231c('0x17')]('\x20')));});}else{return _0x29ceda(_0x2bd806[_0x231c('0x13')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x58b86c){return new Promise(function(_0x1d4227,_0x413e39){var _0x182d15=_[_0x231c('0x5f')](_0x2b7d5f[_0x231c('0x7a')]);_0x1d4227({'count':_0x182d15[_0x231c('0x5b')],'rows':_0x182d15});});},'VoiceQueuesChannel':function(_0x323111){var _0x5eef4d=this;return new Promise(function(_0x5734c7,_0x23f255){var _0x4a2f3a=schema(properties[_0x231c('0x7b')])[_0x231c('0x3')](_0x323111);if(_0x4a2f3a['length']>0x0){return _0x23f255(_0x5eef4d[_0x231c('0x13')](0x1f4,_[_0x231c('0x62')](_0x4a2f3a,'message')[_0x231c('0x17')](',\x20')));}var _0x5e98a9=_[_0x231c('0x5c')](_0x2b7d5f[_0x231c('0x7a')],{'uniqueid':_0x323111['uniqueid']});if(_0x5e98a9){_0x5734c7(_0x5e98a9);}else{return _0x23f255(_0x5eef4d[_0x231c('0x13')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x18393c){var _0x6098ec=this;return new Promise(function(_0x4ece82,_0x13a7ac){if(ami['isConnected']()==![]){return _0x13a7ac(_0x6098ec[_0x231c('0x13')](0x1f4,[config[_0x231c('0x14')]['ip'],config[_0x231c('0x14')][_0x231c('0x15')],_0x231c('0x16')][_0x231c('0x17')]('\x20')));}var _0x3ba0e0=schema(properties[_0x231c('0x7c')])[_0x231c('0x3')](_0x18393c);if(_0x3ba0e0[_0x231c('0x5b')]>0x0){return _0x13a7ac(_0x6098ec[_0x231c('0x13')](0x1f4,_[_0x231c('0x62')](_0x3ba0e0,_0x231c('0x1e'))[_0x231c('0x17')](',\x20')));}var _0x55cc9a=_[_0x231c('0x5c')](_0x2b7d5f[_0x231c('0x7a')],{'uniqueid':_0x18393c[_0x231c('0x63')]});if(_0x55cc9a&&_0x55cc9a[_0x231c('0x69')]){return ami[_0x231c('0x1d')]({'action':_0x231c('0x7d'),'channel':_0x55cc9a[_0x231c('0x69')]})[_0x231c('0x22')](function(_0x53bbb9){_0x4ece82({'code':0xc8,'message':[_0x18393c[_0x231c('0x63')],_0x53bbb9['message'][_0x231c('0x6c')]()][_0x231c('0x17')]('\x20')});})[_0x231c('0x1f')](function(_0x39f291){_0x13a7ac(_0x6098ec['error'](0x1f5,[_0x18393c['uniqueid'],_0x39f291['message'][_0x231c('0x6c')]()][_0x231c('0x17')]('\x20')));});}else{return _0x13a7ac(_0x6098ec['error'](0x1f5,_0x231c('0x75')));}});},'VoiceQueuesChannelRedirect':function(_0x2f2f40){var _0x5ec9b3=this;return new Promise(function(_0x16a8a3,_0x4b3e84){if(ami[_0x231c('0x12')]()==![]){return _0x4b3e84(_0x5ec9b3[_0x231c('0x13')](0x1f4,[config[_0x231c('0x14')]['ip'],config[_0x231c('0x14')][_0x231c('0x15')],'ami\x20disconnected']['join']('\x20')));}var _0x42b9ce=schema(properties[_0x231c('0x7e')])[_0x231c('0x3')](_0x2f2f40);if(_0x42b9ce['length']>0x0){return _0x4b3e84(_0x5ec9b3[_0x231c('0x13')](0x1f4,_[_0x231c('0x62')](_0x42b9ce,'message')[_0x231c('0x17')](',\x20')));}var _0x2d037f=_['find'](_0x2b7d5f[_0x231c('0x7a')],{'uniqueid':_0x2f2f40[_0x231c('0x63')]});if(_0x2d037f&&_0x2d037f[_0x231c('0x69')]){return ami[_0x231c('0x1d')]({'action':_0x231c('0x7f'),'channel':_0x2d037f[_0x231c('0x69')],'exten':_0x2f2f40[_0x231c('0x80')],'context':_0x2f2f40['context']||_0x2d037f[_0x231c('0x81')],'priority':0x1})[_0x231c('0x22')](function(_0x263717){_0x16a8a3({'code':0xc8,'message':[_0x2f2f40[_0x231c('0x63')],_0x263717[_0x231c('0x1e')][_0x231c('0x6c')]()][_0x231c('0x17')]('\x20')});})['catch'](function(_0x205f3a){_0x4b3e84(_0x5ec9b3[_0x231c('0x13')](0x1f5,[_0x2f2f40[_0x231c('0x63')],_0x205f3a[_0x231c('0x1e')][_0x231c('0x6c')]()][_0x231c('0x17')]('\x20')));});}else{return _0x4b3e84(_0x5ec9b3[_0x231c('0x13')](0x1f5,_0x231c('0x75')));}});},'Agents':function(_0x2205c3){return new Promise(function(_0x46f6f1,_0x32d698){var _0x130165=_[_0x231c('0x5f')](_0x2b7d5f['agents']);_0x46f6f1({'count':_0x130165[_0x231c('0x5b')],'rows':_0x130165});});},'Telephones':function(_0x40812b){return new Promise(function(_0x507086,_0x47d826){var _0x991169=_[_0x231c('0x5f')](_0x2b7d5f[_0x231c('0x82')]);_0x507086({'count':_0x991169[_0x231c('0x5b')],'rows':_0x991169});});},'Trunks':function(_0x5d94fe){return new Promise(function(_0x202041,_0x4e72df){var _0x3fbd53=_[_0x231c('0x5f')](_0x2b7d5f['trunks']);_0x202041({'count':_0x3fbd53[_0x231c('0x5b')],'rows':_0x3fbd53});});},'OutboundChannels':function(_0x5e8657){return new Promise(function(_0x286551,_0x55f136){var _0x160bbc=_[_0x231c('0x5f')](_0x2b7d5f[_0x231c('0x83')]);_0x286551({'count':_0x160bbc[_0x231c('0x5b')],'rows':_0x160bbc});});},'Outbound':function(_0x170273){return new Promise(function(_0x59b622,_0x54f22b){_0x59b622(_0x2b7d5f[_0x231c('0x84')]);});},'Campaigns':function(_0x237b23){return new Promise(function(_0xc2e4a0,_0x55d370){var _0x37aff9=_[_0x231c('0x5f')](_0x2b7d5f[_0x231c('0x85')]);_0xc2e4a0({'count':_0x37aff9[_0x231c('0x5b')],'rows':_0x37aff9});});},'VoiceQueuesPreview':function(_0x1d9e00){var _0x52712a=this;return new Promise(function(_0x1e2b62,_0x24a405){_0x1b9d64[_0x231c('0x86')](_0x1d9e00['id'])[_0x231c('0x22')](function(_0x537a53){_0x1e2b62({'code':0xc8,'message':_0x537a53[_0x231c('0x1e')]});})['catch'](function(_0xd36d2c){_0x24a405(_0x52712a[_0x231c('0x13')](0x1f4,_0xd36d2c[_0x231c('0x1e')]));});});},'EventManager':function(_0x2cfe62){var _0x4a8527=this;return new Promise(function(_0x20dd2a,_0x5e0f80){if(!_0x2cfe62[_0x231c('0x87')]){return _0x5e0f80(_0x4a8527[_0x231c('0x13')](0x1f4,_0x231c('0x88')));}ami[_0x231c('0x89')]('custom:'+_0x2cfe62[_0x231c('0x87')],_0x2cfe62[_0x231c('0x1e')]);_0x20dd2a({'code':0xc8,'message':_0x2cfe62});});},'FaxAccounts':function(_0x3a270c){return new Promise(function(_0xb3890e,_0x5c1c52){var _0xf73db2=_[_0x231c('0x5f')](_0x2b7d5f[_0x231c('0x8a')]);_0xb3890e({'count':_0xf73db2[_0x231c('0x5b')],'rows':_0xf73db2});});},'SendFax':function(_0x31a8c5){var _0x47366e=this;return new Promise(function(_0x283fd1,_0x4693e8){_0x1f3f7d[_0x231c('0x8b')](_0x31a8c5)['then'](function(_0x279c82){_0x283fd1({'code':0xc8,'message':_0x279c82['message']});})[_0x231c('0x1f')](function(_0xb67ff7){_0x4693e8(_0x47366e['error'](0x1f4,_0xb67ff7['message']));});});},'CheckAfterSend':function(_0x487e4b){var _0x4a2e1a=this;return new Promise(function(_0x393ab8,_0x46b070){_0x1f3f7d[_0x231c('0x8c')](_0x487e4b)[_0x231c('0x22')](function(_0x2ecf43){_0x393ab8({'code':0xc8,'message':_0x2ecf43[_0x231c('0x1e')]});})['catch'](function(_0x5f18d9){_0x46b070(_0x4a2e1a['error'](0x1f4,_0x5f18d9['message']));});});}};var _0x35e570=jayson[_0x231c('0x8d')](_0x111bf9)[_0x231c('0x8e')]();_0x35e570['on'](_0x231c('0x13'),function(_0x143838){return _0x48bfb2(_0x143838);});_0x35e570['listen'](0x232a,_0x231c('0x8f'),function(){console[_0x231c('0x90')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x219c3f(_0x231c('0x91')+0x232a);});});}; \ No newline at end of file +var _0xed1c=['outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','push','find','omit','undefined','channels','validate','length','map','channel','%s.%s','wav','MixMonitor','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','isNil','mixmonitorid','status','catch','uniqueid','voicechannel','resolve','StopMixMonitor','destinationchannel','monitors','stop','filename','StopMixMonitor\x20Success','values','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','Channel\x20doesn\x27t\x20exist','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','event','emit','custom:','faxAccounts','send','server','http','listen','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','../../../config/environment','../properties','../ami','format','%s/%s','SIP','timers','timer','updateAcw','agents','updateStatusRealtime','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','module','action','Reload','Action','then','message','pick','Command','content','voiceQueues','name','strategy','answered','available','pTalking','sumDuration','sumHoldTime','talking','total','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay'];(function(_0x171ac6,_0x51243c){var _0x5afbb7=function(_0x5383ce){while(--_0x5383ce){_0x171ac6['push'](_0x171ac6['shift']());}};_0x5afbb7(++_0x51243c);}(_0xed1c,0xe4));var _0xced1=function(_0x48e64a,_0x1789d5){_0x48e64a=_0x48e64a-0x0;var _0x510cde=_0xed1c[_0x48e64a];return _0x510cde;};'use strict';var _=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var jayson=require('jayson/promise');var schema=require('validate');var BPromise=require('bluebird');var moment=require('moment');var config=require(_0xced1('0x2'));var properties=require(_0xced1('0x3'));var ami=require(_0xced1('0x4'));exports['listen']=function(_0x1e23a9,_0x445160,_0x466657){return new BPromise(function(_0x37b22b,_0x59399e){var _0x2bcf42={'QueuePause':function(_0x38bca8){return new Promise(function(_0x39d5df,_0x1fb40b){var _0x354203=util[_0xced1('0x5')](_0xced1('0x6'),_0xced1('0x7'),_0x38bca8['name']);if(_0x1e23a9[_0xced1('0x8')]&&_0x1e23a9['timers'][_0x354203]&&_0x1e23a9[_0xced1('0x8')][_0x354203][_0xced1('0x9')]){_0x1e23a9[_0xced1('0x8')][_0x354203][_0xced1('0xa')]();}if(_0x1e23a9[_0xced1('0xb')][_0x354203]){_0x1e23a9[_0xced1('0xb')][_0x354203][_0xced1('0xc')]({'statePause':_0x38bca8['pause']?!![]:![]});}_0x39d5df({'code':0xc8,'message':_0xced1('0xd')});});},'Reload':function(_0x2a5cd6){var _0x1b7a33=this;return new Promise(function(_0x52d96a,_0x564e17){if(ami[_0xced1('0xe')]()==![]){return _0x564e17(_0x1b7a33[_0xced1('0xf')](0x1f4,[config['asterisk']['ip'],config[_0xced1('0x10')][_0xced1('0x11')],_0xced1('0x12')][_0xced1('0x13')]('\x20')));}_0x2a5cd6=_['pick'](_0x2a5cd6,_['keys'](properties[_0xced1('0x14')]));_0x2a5cd6[_0xced1('0x15')]=_0xced1('0x16');return ami[_0xced1('0x17')](_0x2a5cd6)[_0xced1('0x18')](function(_0x292997){_0x52d96a({'code':0xc8,'message':_0x292997['message']});})['catch'](function(_0x2a92c8){_0x564e17(_0x1b7a33[_0xced1('0xf')](0x1f5,_0x2a92c8[_0xced1('0x19')]));});});},'Command':function(_0x5257e7){var _0x1eac14=this;return new Promise(function(_0x25f0df,_0x3e51e4){if(ami['isConnected']()==![]){return _0x3e51e4(_0x1eac14[_0xced1('0xf')](0x1f4,[config[_0xced1('0x10')]['ip'],config[_0xced1('0x10')]['username'],_0xced1('0x12')][_0xced1('0x13')]('\x20')));}_0x5257e7=_[_0xced1('0x1a')](_0x5257e7,'command');_0x5257e7['action']=_0xced1('0x1b');return ami[_0xced1('0x17')](_0x5257e7)[_0xced1('0x18')](function(_0x20dcb4){_0x25f0df({'code':0xc8,'message':_0x20dcb4[_0xced1('0x1c')]});})['catch'](function(_0x14f47e){_0x3e51e4(_0x1eac14[_0xced1('0xf')](0x1f5,_0x14f47e['message']));});});},'VoiceQueues':function(_0x5f2018){return new Promise(function(_0x38f738,_0x258c9a){var _0x3af9c0=[];for(var _0x3912fe in _0x1e23a9[_0xced1('0x1d')]){if(_0x1e23a9[_0xced1('0x1d')]['hasOwnProperty'](_0x3912fe)){var _0x181f6e=_0x1e23a9[_0xced1('0x1d')][_0x3912fe];var _0x43cdec={'id':_0x181f6e['id'],'name':_0x181f6e[_0xced1('0x1e')],'strategy':_0x181f6e[_0xced1('0x1f')],'answered':_0x181f6e[_0xced1('0x20')],'available':_0x181f6e[_0xced1('0x21')],'loggedIn':_0x181f6e['loggedIn'],'pTalking':_0x181f6e[_0xced1('0x22')],'sumBillable':_0x181f6e['sumBillable'],'sumDuration':_0x181f6e[_0xced1('0x23')],'sumHoldTime':_0x181f6e[_0xced1('0x24')]||0x0,'talking':_0x181f6e[_0xced1('0x25')],'total':_0x181f6e[_0xced1('0x26')],'type':_0x181f6e['type'],'unmanaged':_0x181f6e['unmanaged'],'abandoned':_0x181f6e[_0xced1('0x27')],'waiting':_0x181f6e[_0xced1('0x28')],'loggedInDb':_0x181f6e[_0xced1('0x29')]};if(_0x181f6e['type']==='outbound'){_0x43cdec['dialActive']=_0x181f6e[_0xced1('0x2a')];_0x43cdec[_0xced1('0x2b')]=_0x181f6e[_0xced1('0x2b')];_0x43cdec[_0xced1('0x2c')]=_0x181f6e['dialOriginateCallerIdName'];_0x43cdec[_0xced1('0x2d')]=_0x181f6e[_0xced1('0x2d')];_0x43cdec[_0xced1('0x2e')]=_0x181f6e[_0xced1('0x2e')];_0x43cdec[_0xced1('0x2f')]=_0x181f6e[_0xced1('0x2f')];_0x43cdec[_0xced1('0x30')]=_0x181f6e['temp'];_0x43cdec['outboundAnswerAgiCallsDay']=_0x181f6e[_0xced1('0x31')];_0x43cdec[_0xced1('0x32')]=_0x181f6e[_0xced1('0x32')];_0x43cdec[_0xced1('0x33')]=_0x181f6e[_0xced1('0x33')];_0x43cdec[_0xced1('0x34')]=_0x181f6e['outboundBusyCallsDay'];_0x43cdec['outboundCongestionCallsDay']=_0x181f6e['outboundCongestionCallsDay'];_0x43cdec['outboundDropCallsDayACS']=_0x181f6e[_0xced1('0x35')];_0x43cdec[_0xced1('0x36')]=_0x181f6e[_0xced1('0x36')];_0x43cdec[_0xced1('0x37')]=_0x181f6e[_0xced1('0x37')];_0x43cdec[_0xced1('0x38')]=_0x181f6e[_0xced1('0x38')];_0x43cdec[_0xced1('0x39')]=_0x181f6e[_0xced1('0x39')];_0x43cdec[_0xced1('0x3a')]=_0x181f6e[_0xced1('0x3a')];_0x43cdec[_0xced1('0x3b')]=_0x181f6e[_0xced1('0x3b')];_0x43cdec['outboundRejectCallsDay']=_0x181f6e[_0xced1('0x3c')];_0x43cdec[_0xced1('0x3d')]=_0x181f6e[_0xced1('0x3d')];_0x43cdec[_0xced1('0x3e')]=_0x181f6e[_0xced1('0x3e')];_0x43cdec[_0xced1('0x3f')]=_0x181f6e['predictiveIntervalAvgHoldtime'];_0x43cdec[_0xced1('0x40')]=_0x181f6e[_0xced1('0x40')];_0x43cdec[_0xced1('0x41')]=_0x181f6e[_0xced1('0x41')];_0x43cdec[_0xced1('0x42')]=_0x181f6e[_0xced1('0x42')];_0x43cdec[_0xced1('0x43')]=_0x181f6e[_0xced1('0x43')];_0x43cdec[_0xced1('0x44')]=_0x181f6e[_0xced1('0x44')];_0x43cdec[_0xced1('0x45')]=_0x181f6e['predictiveIntervalHitRate'];_0x43cdec['predictiveIntervalMultiplicativeFactor']=_0x181f6e[_0xced1('0x46')];_0x43cdec[_0xced1('0x47')]=_0x181f6e[_0xced1('0x47')];_0x43cdec['predictiveIntervalAvailable']=_0x181f6e[_0xced1('0x48')];_0x43cdec[_0xced1('0x49')]=_0x181f6e[_0xced1('0x49')];_0x43cdec['message']=_0x181f6e[_0xced1('0x19')];_0x43cdec[_0xced1('0x4a')]=_0x181f6e['originated'];_0x43cdec[_0xced1('0x4b')]=_0x181f6e['erlangCalls'];_0x43cdec[_0xced1('0x4c')]=_0x181f6e[_0xced1('0x4c')];_0x43cdec['erlangAbandonmentRate']=_0x181f6e[_0xced1('0x4d')];_0x43cdec[_0xced1('0x4e')]=_0x181f6e[_0xced1('0x4e')];_0x43cdec['startPredictive']=_0x181f6e[_0xced1('0x4f')];_0x43cdec[_0xced1('0x50')]=_0x181f6e['startProgressive'];}if(_0x181f6e[_0xced1('0x51')]){_0x43cdec['Trunk']={'id':_0x181f6e['Trunk']['id'],'name':_0x181f6e[_0xced1('0x51')]['name'],'active':_0x181f6e[_0xced1('0x51')][_0xced1('0x52')],'callerid':_0x181f6e[_0xced1('0x51')]['callerid']};}if(_0x181f6e[_0xced1('0x53')]){_0x43cdec['Interval']={'id':_0x181f6e[_0xced1('0x53')]['id'],'name':_0x181f6e[_0xced1('0x53')][_0xced1('0x1e')]};}_0x3af9c0[_0xced1('0x54')](_0x43cdec);}}_0x38f738({'count':_0x3af9c0['length'],'rows':_0x3af9c0});});},'UpdateVoiceQueue':function(_0x19906c){return new Promise(function(_0x1d5034,_0x54c62c){var _0x4733f0=_[_0xced1('0x55')](_0x1e23a9['voiceQueues'],{'id':parseInt(_0x19906c['id'])});var _0x1800c8=_[_0xced1('0x56')](_0x19906c,['id']);if(_0x4733f0){for(var _0x1646df in _0x1800c8){if(typeof _0x1800c8[_0x1646df]!=='undefined'&&typeof _0x4733f0[_0x1646df]!==_0xced1('0x57')){_0x4733f0[_0x1646df]=_0x1800c8[_0x1646df];}}_0x1d5034(_0x4733f0);}else{_0x54c62c();}});},'VoiceChannels':function(_0xcfbed8){return new Promise(function(_0x39fc4a,_0x3333e6){var _0x376619=_['values'](_0x1e23a9[_0xced1('0x58')]);_0x39fc4a({'count':_0x376619['length'],'rows':_0x376619});});},'VoiceChannelMixMonitor':function(_0x31fb76){var _0x646987=this;return new Promise(function(_0xf06f87,_0x24cce1){if(ami[_0xced1('0xe')]()==![]){return _0x24cce1(_0x646987[_0xced1('0xf')](0x1f4,[config['asterisk']['ip'],config[_0xced1('0x10')][_0xced1('0x11')],'ami\x20disconnected'][_0xced1('0x13')]('\x20')));}var _0x5a717a=schema(properties['voicechannel'])[_0xced1('0x59')](_0x31fb76);if(_0x5a717a[_0xced1('0x5a')]>0x0){return _0x24cce1(_0x646987[_0xced1('0xf')](0x1f4,_[_0xced1('0x5b')](_0x5a717a,'message')[_0xced1('0x13')](',\x20')));}var _0x33a8a6=_[_0xced1('0x55')](_0x1e23a9['channels'],{'uniqueid':_0x31fb76['uniqueid']});if(_0x33a8a6&&_0x33a8a6[_0xced1('0x5c')]){var _0x1c51a6=util[_0xced1('0x5')](_0xced1('0x5d'),_0x31fb76['filename']||_0x31fb76['uniqueid'],_0x31fb76['format']||_0xced1('0x5e'));return ami[_0xced1('0x17')]({'action':_0xced1('0x5f'),'channel':_0x33a8a6[_0xced1('0x5c')],'file':_0x1c51a6,'options':_0xced1('0x60')})[_0xced1('0x18')](function(_0x211fd0){var _0x323b32=_[_0xced1('0x55')](_0x33a8a6['monitors'],{'filename':_0xced1('0x61')+_0x1c51a6[_0xced1('0x62')]()});if(_[_0xced1('0x63')](_0x323b32)){_0x33a8a6['monitors'][_0xced1('0x54')]({'filename':_0xced1('0x61')+_0x1c51a6[_0xced1('0x62')](),'createdAt':moment()[_0xced1('0x5')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x211fd0[_0xced1('0x64')],'status':'rec'});}else{_0x323b32['mixmonitorid']=_0x211fd0[_0xced1('0x64')];_0x323b32[_0xced1('0x65')]='rec';}_0xf06f87({'code':0xc8,'message':[_0x31fb76['uniqueid'],'MixMonitor\x20Success',_0x211fd0[_0xced1('0x64')]]['join']('\x20'),'mixmonitorid':_0x211fd0[_0xced1('0x64')]});})[_0xced1('0x66')](function(_0x12241d){_0x24cce1(_0x646987[_0xced1('0xf')](0x1f5,[_0x31fb76[_0xced1('0x67')],_0x12241d[_0xced1('0x19')][_0xced1('0x62')]()][_0xced1('0x13')]('\x20')));});}else{return _0x24cce1(_0x646987['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x4832d2){var _0x45e587=this;return new Promise(function(_0x235651,_0x34262e){if(ami['isConnected']()==![]){return _0x34262e(_0x45e587[_0xced1('0xf')](0x1f4,[config[_0xced1('0x10')]['ip'],config[_0xced1('0x10')][_0xced1('0x11')],'ami\x20disconnected'][_0xced1('0x13')]('\x20')));}var _0x2abd02=schema(properties[_0xced1('0x68')])[_0xced1('0x59')](_0x4832d2);if(_0x2abd02[_0xced1('0x5a')]>0x0){return _0x34262e(_0x45e587[_0xced1('0xf')](0x1f4,_[_0xced1('0x5b')](_0x2abd02,_0xced1('0x19'))['join'](',\x20')));}var _0x4bebc8=_['find'](_0x1e23a9[_0xced1('0x58')],{'uniqueid':_0x4832d2['uniqueid']});if(_0x4bebc8){return BPromise[_0xced1('0x69')]()['then'](function(){if(_0x4bebc8['channel']){return ami[_0xced1('0x17')]({'action':_0xced1('0x6a'),'channel':_0x4bebc8[_0xced1('0x5c')],'mixmonitorid':_0x4832d2[_0xced1('0x64')]})[_0xced1('0x66')](function(_0x466da1){});}})[_0xced1('0x18')](function(){if(_0x4bebc8[_0xced1('0x6b')]){return ami[_0xced1('0x17')]({'action':_0xced1('0x6a'),'channel':_0x4bebc8[_0xced1('0x6b')],'mixmonitorid':_0x4832d2['mixmonitorid']})[_0xced1('0x66')](function(_0x168e5b){});}})['then'](function(_0x8b38ce){var _0x26f154=_['find'](_0x4bebc8[_0xced1('0x6c')],{'mixmonitorid':_0x4832d2[_0xced1('0x64')]});if(_0x26f154){_0x26f154[_0xced1('0x65')]=_0xced1('0x6d');}})[_0xced1('0x18')](function(){var _0x5c9a6d=util['format']('%s.%s',_0x4832d2[_0xced1('0x6e')]||_0x4832d2[_0xced1('0x67')],_0x4832d2['format']||_0xced1('0x5e'));var _0x10447b=_[_0xced1('0x55')](_0x4bebc8['monitors'],{'filename':_0xced1('0x61')+_0x5c9a6d[_0xced1('0x62')]()});if(_0x10447b){_0x10447b['status']=_0xced1('0x6d');}})['then'](function(){_0x235651({'code':0xc8,'message':[_0x4832d2[_0xced1('0x67')],_0xced1('0x6f')][_0xced1('0x13')]('\x20')});})[_0xced1('0x66')](function(_0x286695){_0x34262e(_0x45e587[_0xced1('0xf')](0x1f5,[_0x4832d2[_0xced1('0x67')],_0x286695['message'][_0xced1('0x62')]()][_0xced1('0x13')]('\x20')));});}else{return _0x34262e(_0x45e587[_0xced1('0xf')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x5c2567){return new Promise(function(_0x27f1f1,_0x1fdf2c){var _0x552de8=_[_0xced1('0x70')](_0x1e23a9[_0xced1('0x71')]);_0x27f1f1({'count':_0x552de8[_0xced1('0x5a')],'rows':_0x552de8});});},'VoiceQueuesChannel':function(_0x51c879){var _0x57107b=this;return new Promise(function(_0x13689f,_0x4f9981){var _0x76f5df=schema(properties[_0xced1('0x72')])[_0xced1('0x59')](_0x51c879);if(_0x76f5df[_0xced1('0x5a')]>0x0){return _0x4f9981(_0x57107b['error'](0x1f4,_[_0xced1('0x5b')](_0x76f5df,'message')['join'](',\x20')));}var _0x5973e4=_['find'](_0x1e23a9[_0xced1('0x71')],{'uniqueid':_0x51c879[_0xced1('0x67')]});if(_0x5973e4){_0x13689f(_0x5973e4);}else{return _0x4f9981(_0x57107b['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x334928){var _0x1e9956=this;return new Promise(function(_0x4eefea,_0x591f11){if(ami[_0xced1('0xe')]()==![]){return _0x591f11(_0x1e9956[_0xced1('0xf')](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],'ami\x20disconnected'][_0xced1('0x13')]('\x20')));}var _0x135f0f=schema(properties[_0xced1('0x73')])[_0xced1('0x59')](_0x334928);if(_0x135f0f[_0xced1('0x5a')]>0x0){return _0x591f11(_0x1e9956[_0xced1('0xf')](0x1f4,_['map'](_0x135f0f,_0xced1('0x19'))[_0xced1('0x13')](',\x20')));}var _0x2d5b26=_[_0xced1('0x55')](_0x1e23a9[_0xced1('0x71')],{'uniqueid':_0x334928[_0xced1('0x67')]});if(_0x2d5b26&&_0x2d5b26[_0xced1('0x5c')]){return ami[_0xced1('0x17')]({'action':_0xced1('0x74'),'channel':_0x2d5b26['channel']})['then'](function(_0x607728){_0x4eefea({'code':0xc8,'message':[_0x334928['uniqueid'],_0x607728[_0xced1('0x19')]['toLowerCase']()][_0xced1('0x13')]('\x20')});})[_0xced1('0x66')](function(_0x70bc63){_0x591f11(_0x1e9956[_0xced1('0xf')](0x1f5,[_0x334928[_0xced1('0x67')],_0x70bc63[_0xced1('0x19')]['toLowerCase']()][_0xced1('0x13')]('\x20')));});}else{return _0x591f11(_0x1e9956[_0xced1('0xf')](0x1f5,_0xced1('0x75')));}});},'VoiceQueuesChannelRedirect':function(_0x3e7070){var _0x137460=this;return new Promise(function(_0x2ec441,_0x4fc259){if(ami['isConnected']()==![]){return _0x4fc259(_0x137460[_0xced1('0xf')](0x1f4,[config[_0xced1('0x10')]['ip'],config[_0xced1('0x10')][_0xced1('0x11')],_0xced1('0x12')]['join']('\x20')));}var _0x73ba9a=schema(properties[_0xced1('0x76')])[_0xced1('0x59')](_0x3e7070);if(_0x73ba9a[_0xced1('0x5a')]>0x0){return _0x4fc259(_0x137460['error'](0x1f4,_[_0xced1('0x5b')](_0x73ba9a,_0xced1('0x19'))['join'](',\x20')));}var _0x470053=_['find'](_0x1e23a9[_0xced1('0x71')],{'uniqueid':_0x3e7070[_0xced1('0x67')]});if(_0x470053&&_0x470053[_0xced1('0x5c')]){return ami[_0xced1('0x17')]({'action':_0xced1('0x77'),'channel':_0x470053[_0xced1('0x5c')],'exten':_0x3e7070[_0xced1('0x78')],'context':_0x3e7070[_0xced1('0x79')]||_0x470053[_0xced1('0x79')],'priority':0x1})[_0xced1('0x18')](function(_0x525e46){_0x2ec441({'code':0xc8,'message':[_0x3e7070[_0xced1('0x67')],_0x525e46[_0xced1('0x19')][_0xced1('0x62')]()][_0xced1('0x13')]('\x20')});})['catch'](function(_0x35ff8d){_0x4fc259(_0x137460[_0xced1('0xf')](0x1f5,[_0x3e7070[_0xced1('0x67')],_0x35ff8d[_0xced1('0x19')]['toLowerCase']()][_0xced1('0x13')]('\x20')));});}else{return _0x4fc259(_0x137460[_0xced1('0xf')](0x1f5,_0xced1('0x75')));}});},'Agents':function(_0x265b76){return new Promise(function(_0x3beefd,_0x4fa469){var _0x5d9a97=_['values'](_0x1e23a9[_0xced1('0xb')]);_0x3beefd({'count':_0x5d9a97[_0xced1('0x5a')],'rows':_0x5d9a97});});},'Telephones':function(_0x1abc72){return new Promise(function(_0x4dde74,_0x41d724){var _0x328079=_['values'](_0x1e23a9[_0xced1('0x7a')]);_0x4dde74({'count':_0x328079['length'],'rows':_0x328079});});},'Trunks':function(_0xc4a5c8){return new Promise(function(_0x16bcaa,_0x2b8d1b){var _0x5aeea4=_['values'](_0x1e23a9[_0xced1('0x7b')]);_0x16bcaa({'count':_0x5aeea4[_0xced1('0x5a')],'rows':_0x5aeea4});});},'OutboundChannels':function(_0x3a4bd6){return new Promise(function(_0x20e68a,_0x1f539f){var _0x5f3a8d=_['values'](_0x1e23a9[_0xced1('0x7c')]);_0x20e68a({'count':_0x5f3a8d[_0xced1('0x5a')],'rows':_0x5f3a8d});});},'Outbound':function(_0x410c40){return new Promise(function(_0x4cf606,_0x25fabe){_0x4cf606(_0x1e23a9['outbound']);});},'Campaigns':function(_0x535aaf){return new Promise(function(_0xd54ed3,_0x5a63bf){var _0x18a6a9=_['values'](_0x1e23a9[_0xced1('0x7d')]);_0xd54ed3({'count':_0x18a6a9[_0xced1('0x5a')],'rows':_0x18a6a9});});},'VoiceQueuesPreview':function(_0xb153dc){var _0x19bfcf=this;return new Promise(function(_0x1eac74,_0x4536df){_0x445160[_0xced1('0x7e')](_0xb153dc['id'])['then'](function(_0x4b3511){_0x1eac74({'code':0xc8,'message':_0x4b3511[_0xced1('0x19')]});})[_0xced1('0x66')](function(_0x23d0d4){_0x4536df(_0x19bfcf[_0xced1('0xf')](0x1f4,_0x23d0d4['message']));});});},'EventManager':function(_0x51107f){var _0x36358b=this;return new Promise(function(_0x4f61bb,_0x1f13af){if(!_0x51107f[_0xced1('0x7f')]){return _0x1f13af(_0x36358b[_0xced1('0xf')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0xced1('0x80')](_0xced1('0x81')+_0x51107f['event'],_0x51107f[_0xced1('0x19')]);_0x4f61bb({'code':0xc8,'message':_0x51107f});});},'FaxAccounts':function(_0x25128f){return new Promise(function(_0x3173cc,_0x5e3a52){var _0x2f4f7a=_[_0xced1('0x70')](_0x1e23a9[_0xced1('0x82')]);_0x3173cc({'count':_0x2f4f7a[_0xced1('0x5a')],'rows':_0x2f4f7a});});},'SendFax':function(_0xce8b5){var _0x4725eb=this;return new Promise(function(_0x53fca5,_0x5126d2){_0x466657[_0xced1('0x83')](_0xce8b5)[_0xced1('0x18')](function(_0x455b4e){_0x53fca5({'code':0xc8,'message':_0x455b4e[_0xced1('0x19')]});})[_0xced1('0x66')](function(_0xd997a5){_0x5126d2(_0x4725eb[_0xced1('0xf')](0x1f4,_0xd997a5[_0xced1('0x19')]));});});},'CheckAfterSend':function(_0x401ed5){var _0x43b907=this;return new Promise(function(_0x7b033d,_0x4f22eb){_0x466657['checkAfterSend'](_0x401ed5)[_0xced1('0x18')](function(_0x3a0044){_0x7b033d({'code':0xc8,'message':_0x3a0044[_0xced1('0x19')]});})[_0xced1('0x66')](function(_0x128817){_0x4f22eb(_0x43b907[_0xced1('0xf')](0x1f4,_0x128817[_0xced1('0x19')]));});});}};var _0x14cbf1=jayson[_0xced1('0x84')](_0x2bcf42)[_0xced1('0x85')]();_0x14cbf1['on'](_0xced1('0xf'),function(_0xd39989){return _0x59399e(_0xd39989);});_0x14cbf1[_0xced1('0x86')](0x232a,_0xced1('0x87'),function(){console[_0xced1('0x88')](_0xced1('0x89'),0x232a);return _0x37b22b(_0xced1('0x8a')+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 f2f752d..74740b2 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 _0x4b84=['calleridnum','lastName','phone','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','length','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','destcalleridnum','calleridname','Unknown','firstName','destcalleridname','','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','merge','lodash','bluebird','../../../../config/environment','../../rpc/cmContact','redis','defaults','[CM][%s][%s]','stringify','emit','data1','data2','isNil','data5','ListId','data3','map','routeId'];(function(_0x671369,_0x433da5){var _0x33f2b4=function(_0x2e9db2){while(--_0x2e9db2){_0x671369['push'](_0x671369['shift']());}};_0x33f2b4(++_0x433da5);}(_0x4b84,0x1cc));var _0x44b8=function(_0x1d94d1,_0x347bb8){_0x1d94d1=_0x1d94d1-0x0;var _0x23c397=_0x4b84[_0x1d94d1];return _0x23c397;};'use strict';var _=require(_0x44b8('0x0'));var BPromise=require(_0x44b8('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0x44b8('0x2'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0x44b8('0x3'));config[_0x44b8('0x4')]=_[_0x44b8('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x44b8('0x4')]));function emit(_0x54274b,_0x327f59,_0x5947f7,_0x3e87c5,_0x5a2353){logger['info'](_0x44b8('0x6'),_0x54274b,_0x327f59['id'],_0x5947f7,_0x3e87c5,JSON[_0x44b8('0x7')](_0x5a2353));io['to'](_0x5947f7)[_0x44b8('0x8')](_0x3e87c5,_0x5a2353);}exports['exec']=function(_0xc650ec,_0x2cc74b,_0x4315f6,_0x9b6048){var _0x24dd10,_0x37e471;var _0xe9a025={};var _0x4ae8a1=Number(_0x4315f6[_0x44b8('0x9')]);var _0x4301a6=_0x4315f6['data2']?Boolean(Number(_0x4315f6[_0x44b8('0xa')])):![];var _0x490bc6;var _0x833ea3=![];if(!_[_0x44b8('0xb')](_0x4315f6['data5'])){if(_0x4315f6[_0x44b8('0xc')]=='1')_0x833ea3=!![];}if(!_0x833ea3){if(_0x9b6048['xmd-contactid']){_0xe9a025['id']=_0x9b6048['xmd-contactid'];}}if(!_0xe9a025['id']){_0xe9a025[_0x44b8('0xd')]=_0x4ae8a1;_0x490bc6=_0x4315f6[_0x44b8('0xe')]&&_0x4315f6[_0x44b8('0xe')]!=='0'?_0x4315f6[_0x44b8('0xe')]['split'](','):['phone'];_0xe9a025['$or']=_[_0x44b8('0xf')](_0x490bc6,function(_0x5b7803){var _0x28ef36={};_0x28ef36[_0x5b7803]=_0x9b6048[_0x44b8('0x10')]?_0x9b6048['destcalleridnum']:_0x9b6048[_0x44b8('0x11')];return _0x28ef36;});}var _0xe3de8f=['id','firstName',_0x44b8('0x12'),_0x44b8('0x13'),'mobile',_0x44b8('0x14'),_0x44b8('0xd'),_0x44b8('0x15'),_0x44b8('0x16'),_0x44b8('0x17')];var _0x369c09=_[_0x44b8('0x18')](_0xe3de8f,_0x490bc6);BPromise[_0x44b8('0x19')]()[_0x44b8('0x1a')](cmContactRpc[_0x44b8('0x1b')]({'attributes':_0x369c09,'where':_0xe9a025}))[_0x44b8('0x1a')](function(_0x14996c){_0x37e471=_0x14996c;if(!_['isEmpty'](_0x37e471)){if(_0x37e471[_0x44b8('0x1c')]===0x1){_0x24dd10=_0x37e471[0x0];logger[_0x44b8('0x1d')](_0x44b8('0x1e'),_0x9b6048[_0x44b8('0x1f')],_0x2cc74b['id'],_0x24dd10['id']);}else{logger[_0x44b8('0x1d')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x9b6048[_0x44b8('0x1f')],_0x2cc74b['id'],_['map'](_0x37e471,'id')[_0x44b8('0x20')](','));}return;}else{logger[_0x44b8('0x1d')](_0x44b8('0x21'),_0x9b6048[_0x44b8('0x1f')],_0x2cc74b['id']);var _0x230a3d={'ListId':_0x4ae8a1};var _0x59acbc=_0x4315f6[_0x44b8('0x22')]&&_0x4315f6['data4']!=='0'?_0x4315f6[_0x44b8('0x22')]:_0x44b8('0x13');if(_0x4301a6){logger['info'](_0x44b8('0x23'),_0x9b6048[_0x44b8('0x1f')],_0x2cc74b['id']);_0x230a3d[_0x59acbc]=_[_0x44b8('0xb')](_0x9b6048['routeId'])?_0x9b6048[_0x44b8('0x11')]:_0x9b6048[_0x44b8('0x24')];if(_['isNil'](_0x9b6048[_0x44b8('0x10')])){_0x230a3d['firstName']=_0x9b6048[_0x44b8('0x25')]&&_0x9b6048['calleridname']!==''?_0x9b6048['calleridname']:_0x44b8('0x26');}else{_0x230a3d[_0x44b8('0x27')]=_0x9b6048[_0x44b8('0x28')]&&_0x9b6048[_0x44b8('0x28')]!==_0x44b8('0x29')?_0x9b6048[_0x44b8('0x28')]:_0x44b8('0x26');}return BPromise[_0x44b8('0x19')]()[_0x44b8('0x1a')](cmContactRpc[_0x44b8('0x2a')](_0x230a3d))[_0x44b8('0x1a')](function(_0x417d81){_0x24dd10=_0x417d81;_0x37e471[_0x44b8('0x2b')](_0x417d81);if(_0x24dd10){logger['info'](_0x44b8('0x2c'),_0x9b6048['uniqueid'],_0x2cc74b['id'],_0x24dd10['id']);}return;});}else{logger[_0x44b8('0x1d')](_0x44b8('0x2d'),_0x9b6048[_0x44b8('0x1f')],_0x2cc74b['id']);_0x230a3d[_0x59acbc]=_[_0x44b8('0xb')](_0x9b6048[_0x44b8('0x10')])?_0x9b6048['calleridnum']:_0x9b6048[_0x44b8('0x24')];if(_[_0x44b8('0xb')](_0x9b6048[_0x44b8('0x10')])){_0x230a3d[_0x44b8('0x27')]=_0x9b6048[_0x44b8('0x25')]&&_0x9b6048['calleridname']!==_0x44b8('0x29')?_0x9b6048[_0x44b8('0x25')]:_0x44b8('0x26');}else{_0x230a3d[_0x44b8('0x27')]=_0x9b6048[_0x44b8('0x28')]&&_0x9b6048[_0x44b8('0x28')]!==_0x44b8('0x29')?_0x9b6048[_0x44b8('0x28')]:_0x44b8('0x26');}_0x24dd10=_0x230a3d;_0x37e471[_0x44b8('0x2b')](_0x230a3d);return;}}})[_0x44b8('0x1a')](function(){if(_0xc650ec){emit(_0x9b6048[_0x44b8('0x1f')],_0x2cc74b,util[_0x44b8('0x2e')](_0x44b8('0x2f'),_0xc650ec[_0x44b8('0x30')]),util[_0x44b8('0x2e')](_0x44b8('0x31'),_0x4315f6[_0x44b8('0x32')][_0x44b8('0x33')]()),{'evt':_[_0x44b8('0x34')](_0x9b6048,{'autoCreate':_0x4301a6}),'contact':_0x24dd10===undefined?{}:_0x24dd10,'contacts':_0x37e471[_0x44b8('0x1c')]===0x0?undefined:_0x37e471});}});}; \ No newline at end of file +var _0xb4e6=['format','name','trigger:%s','action','toLowerCase','lodash','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','[CM][%s][%s]','stringify','emit','exec','data1','data2','data5','xmd-contactid','data3','split','phone','$or','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','ListId','scheduledAt','updatedAt','union','then','isEmpty','length','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','isNil','calleridname','Unknown','','destcalleridname','createContact'];(function(_0x49f945,_0x3da540){var _0x52ae37=function(_0x162edd){while(--_0x162edd){_0x49f945['push'](_0x49f945['shift']());}};_0x52ae37(++_0x3da540);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x2f87cd,_0xcaf299){_0x2f87cd=_0x2f87cd-0x0;var _0x5d7eda=_0xb4e6[_0x2f87cd];return _0x5d7eda;};'use strict';var _=require(_0x6b4e('0x0'));var BPromise=require('bluebird');var Redis=require(_0x6b4e('0x1'));var util=require(_0x6b4e('0x2'));var config=require(_0x6b4e('0x3'));var logger=require(_0x6b4e('0x4'))(_0x6b4e('0x5'));var cmContactRpc=require(_0x6b4e('0x6'));config[_0x6b4e('0x7')]=_['defaults'](config[_0x6b4e('0x7')],{'host':_0x6b4e('0x8'),'port':0x18eb});var io=require(_0x6b4e('0x9'))(new Redis(config['redis']));function emit(_0xd3138f,_0x570346,_0x4f00be,_0x2311d9,_0x48c870){logger['info'](_0x6b4e('0xa'),_0xd3138f,_0x570346['id'],_0x4f00be,_0x2311d9,JSON[_0x6b4e('0xb')](_0x48c870));io['to'](_0x4f00be)[_0x6b4e('0xc')](_0x2311d9,_0x48c870);}exports[_0x6b4e('0xd')]=function(_0x14cf84,_0x46cbe1,_0x323487,_0x49c734){var _0x39b4ec,_0x3bba86;var _0x58c67d={};var _0x2a4d0f=Number(_0x323487[_0x6b4e('0xe')]);var _0x432399=_0x323487[_0x6b4e('0xf')]?Boolean(Number(_0x323487[_0x6b4e('0xf')])):![];var _0xa3d358;var _0x1db513=![];if(!_['isNil'](_0x323487[_0x6b4e('0x10')])){if(_0x323487[_0x6b4e('0x10')]=='1')_0x1db513=!![];}if(!_0x1db513){if(_0x49c734['xmd-contactid']){_0x58c67d['id']=_0x49c734[_0x6b4e('0x11')];}}if(!_0x58c67d['id']){_0x58c67d['ListId']=_0x2a4d0f;_0xa3d358=_0x323487[_0x6b4e('0x12')]&&_0x323487[_0x6b4e('0x12')]!=='0'?_0x323487[_0x6b4e('0x12')][_0x6b4e('0x13')](','):[_0x6b4e('0x14')];_0x58c67d[_0x6b4e('0x15')]=_['map'](_0xa3d358,function(_0x5775f4){var _0x67496d={};_0x67496d[_0x5775f4]=_0x49c734[_0x6b4e('0x16')]?_0x49c734[_0x6b4e('0x17')]:_0x49c734[_0x6b4e('0x18')];return _0x67496d;});}var _0x101d0a=['id',_0x6b4e('0x19'),_0x6b4e('0x1a'),_0x6b4e('0x14'),_0x6b4e('0x1b'),_0x6b4e('0x1c'),_0x6b4e('0x1d'),'createdAt',_0x6b4e('0x1e'),_0x6b4e('0x1f')];var _0x31fb9d=_[_0x6b4e('0x20')](_0x101d0a,_0xa3d358);BPromise['resolve']()[_0x6b4e('0x21')](cmContactRpc['getContacts']({'attributes':_0x31fb9d,'where':_0x58c67d}))[_0x6b4e('0x21')](function(_0x163dea){_0x3bba86=_0x163dea;if(!_[_0x6b4e('0x22')](_0x3bba86)){if(_0x3bba86[_0x6b4e('0x23')]===0x1){_0x39b4ec=_0x3bba86[0x0];logger[_0x6b4e('0x24')](_0x6b4e('0x25'),_0x49c734[_0x6b4e('0x26')],_0x46cbe1['id'],_0x39b4ec['id']);}else{logger['info'](_0x6b4e('0x27'),_0x49c734['uniqueid'],_0x46cbe1['id'],_[_0x6b4e('0x28')](_0x3bba86,'id')[_0x6b4e('0x29')](','));}return;}else{logger[_0x6b4e('0x24')](_0x6b4e('0x2a'),_0x49c734['uniqueid'],_0x46cbe1['id']);var _0xec7d35={'ListId':_0x2a4d0f};var _0x3f72d7=_0x323487['data4']&&_0x323487[_0x6b4e('0x2b')]!=='0'?_0x323487[_0x6b4e('0x2b')]:_0x6b4e('0x14');if(_0x432399){logger[_0x6b4e('0x24')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x49c734[_0x6b4e('0x26')],_0x46cbe1['id']);_0xec7d35[_0x3f72d7]=_[_0x6b4e('0x2c')](_0x49c734['routeId'])?_0x49c734[_0x6b4e('0x18')]:_0x49c734[_0x6b4e('0x17')];if(_[_0x6b4e('0x2c')](_0x49c734[_0x6b4e('0x16')])){_0xec7d35['firstName']=_0x49c734[_0x6b4e('0x2d')]&&_0x49c734[_0x6b4e('0x2d')]!==''?_0x49c734[_0x6b4e('0x2d')]:_0x6b4e('0x2e');}else{_0xec7d35[_0x6b4e('0x19')]=_0x49c734['destcalleridname']&&_0x49c734['destcalleridname']!==_0x6b4e('0x2f')?_0x49c734[_0x6b4e('0x30')]:_0x6b4e('0x2e');}return BPromise['resolve']()[_0x6b4e('0x21')](cmContactRpc[_0x6b4e('0x31')](_0xec7d35))[_0x6b4e('0x21')](function(_0x5c1444){_0x39b4ec=_0x5c1444;_0x3bba86['push'](_0x5c1444);if(_0x39b4ec){logger[_0x6b4e('0x24')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x49c734[_0x6b4e('0x26')],_0x46cbe1['id'],_0x39b4ec['id']);}return;});}else{logger[_0x6b4e('0x24')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x49c734[_0x6b4e('0x26')],_0x46cbe1['id']);_0xec7d35[_0x3f72d7]=_[_0x6b4e('0x2c')](_0x49c734[_0x6b4e('0x16')])?_0x49c734[_0x6b4e('0x18')]:_0x49c734['destcalleridnum'];if(_['isNil'](_0x49c734[_0x6b4e('0x16')])){_0xec7d35[_0x6b4e('0x19')]=_0x49c734[_0x6b4e('0x2d')]&&_0x49c734[_0x6b4e('0x2d')]!==_0x6b4e('0x2f')?_0x49c734[_0x6b4e('0x2d')]:_0x6b4e('0x2e');}else{_0xec7d35[_0x6b4e('0x19')]=_0x49c734[_0x6b4e('0x30')]&&_0x49c734[_0x6b4e('0x30')]!==_0x6b4e('0x2f')?_0x49c734[_0x6b4e('0x30')]:_0x6b4e('0x2e');}_0x39b4ec=_0xec7d35;_0x3bba86['push'](_0xec7d35);return;}}})[_0x6b4e('0x21')](function(){if(_0x14cf84){emit(_0x49c734[_0x6b4e('0x26')],_0x46cbe1,util[_0x6b4e('0x32')]('user:%s',_0x14cf84[_0x6b4e('0x33')]),util['format'](_0x6b4e('0x34'),_0x323487[_0x6b4e('0x35')][_0x6b4e('0x36')]()),{'evt':_['merge'](_0x49c734,{'autoCreate':_0x432399}),'contact':_0x39b4ec===undefined?{}:_0x39b4ec,'contacts':_0x3bba86['length']===0x0?undefined:_0x3bba86});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index d87b5ef..eb5e096 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 _0xb09d=['socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','deskAccounts','custom:agentcalled','bind','custom:agentconnect','syncCustomEvent','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','emit','info','stringify','motionChannel','undefined','prototype','interface','status','checkTrigger','merge','variables','Actions','length','action','toLowerCase','motionbar','browser','TemplateId','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','800','data5','windowHeight','data6','winApplication','winArguments','format','user:%s','name','trigger:%s:%s','data1','jscripty','trigger:%s','contactmanager','exec','queue','urlforward','script','query','search','replace','channel','AllConditions','every','checkConditions','AnyConditions','some','field','account','value','ChatWebsiteId','upperFirst','AccountId','interaction','message','event','operator','membername','lastevent','routeId','exports','util','lodash','url','mustache','ioredis','./urlforward','./integration','./cmContact','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','localhost'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb09d,0xed));var _0xdb09=function(_0x2f5ebb,_0x3f08c9){_0x2f5ebb=_0x2f5ebb-0x0;var _0x43f5db=_0xb09d[_0x2f5ebb];return _0x43f5db;};'use strict';var util=require(_0xdb09('0x0'));var _=require(_0xdb09('0x1'));var url=require(_0xdb09('0x2'));var Mustache=require(_0xdb09('0x3'));var Redis=require(_0xdb09('0x4'));var urlforward=require(_0xdb09('0x5'));var integration=require(_0xdb09('0x6'));var cmContact=require(_0xdb09('0x7'));var script=require('./script');var config=require(_0xdb09('0x8'));var logger=require(_0xdb09('0x9'))(_0xdb09('0xa'));var ami=require(_0xdb09('0xb'));config[_0xdb09('0xc')]=_[_0xdb09('0xd')](config[_0xdb09('0xc')],{'host':_0xdb09('0xe'),'port':0x18eb});var io=require(_0xdb09('0xf'))(new Redis(config[_0xdb09('0xc')]));var operators={'equals':function(_0x3d213c,_0x484854){return _0x3d213c==_0x484854;},'not_equals':function(_0x4b6e2e,_0x227939){return _0x4b6e2e!=_0x227939;}};var barAndWebActions=[_0xdb09('0x10'),_0xdb09('0x2'),_0xdb09('0x11')];function Trigger(_0x27817f){this[_0xdb09('0x12')]=_0x27817f['triggers'];this['agents']=_0x27817f[_0xdb09('0x13')];this['voiceQueues']=_0x27817f[_0xdb09('0x14')];this[_0xdb09('0x15')]=_0x27817f[_0xdb09('0x15')];this[_0xdb09('0x16')]=_0x27817f[_0xdb09('0x16')];this[_0xdb09('0x17')]=_0x27817f['zendeskAccounts'];this[_0xdb09('0x18')]=_0x27817f[_0xdb09('0x18')];this[_0xdb09('0x19')]=_0x27817f[_0xdb09('0x19')];this[_0xdb09('0x1a')]=_0x27817f[_0xdb09('0x1a')];this['zohoAccounts']=_0x27817f[_0xdb09('0x1b')];this['deskAccounts']=_0x27817f['deskAccounts'];this['vtigerAccounts']=_0x27817f[_0xdb09('0x1c')];this[_0xdb09('0x1d')]=_0x27817f[_0xdb09('0x1d')];this[_0xdb09('0x1e')]=_0x27817f[_0xdb09('0x1e')];this[_0xdb09('0x1f')]=_0x27817f[_0xdb09('0x1f')];this[_0xdb09('0x20')]={'zendesk':this[_0xdb09('0x17')],'salesforce':this[_0xdb09('0x19')],'freshdesk':this[_0xdb09('0x18')],'sugarcrm':this[_0xdb09('0x1a')],'zoho':this['zohoAccounts'],'desk':this[_0xdb09('0x21')],'vtiger':this[_0xdb09('0x1c')],'dynamics365':this[_0xdb09('0x1e')],'freshsales':this[_0xdb09('0x1f')],'servicenow':this[_0xdb09('0x1d')]};ami['on'](_0xdb09('0x22'),this['syncCustomEvent'][_0xdb09('0x23')](this));ami['on'](_0xdb09('0x24'),this[_0xdb09('0x25')][_0xdb09('0x23')](this));ami['on'](_0xdb09('0x26'),this[_0xdb09('0x25')][_0xdb09('0x23')](this));ami['on'](_0xdb09('0x27'),this[_0xdb09('0x25')][_0xdb09('0x23')](this));ami['on'](_0xdb09('0x28'),this[_0xdb09('0x25')][_0xdb09('0x23')](this));ami['on'](_0xdb09('0x29'),this['syncCustomEvent']['bind'](this));ami['on'](_0xdb09('0x2a'),this['syncCustomEvent'][_0xdb09('0x23')](this));ami['on'](_0xdb09('0x2b'),this[_0xdb09('0x25')][_0xdb09('0x23')](this));ami['on'](_0xdb09('0x2c'),this[_0xdb09('0x25')]['bind'](this));ami['on']('custom:amd',this[_0xdb09('0x25')][_0xdb09('0x23')](this));ami['on']('custom:queuecallerabandon',this[_0xdb09('0x25')]['bind'](this));ami['on']('custom:timeout',this[_0xdb09('0x25')][_0xdb09('0x23')](this));ami['on'](_0xdb09('0x2d'),this[_0xdb09('0x2e')]['bind'](this));ami['on'](_0xdb09('0x2f'),this[_0xdb09('0x2e')]['bind'](this));ami['on'](_0xdb09('0x30'),this[_0xdb09('0x2e')][_0xdb09('0x23')](this));ami['on'](_0xdb09('0x31'),this['syncCustomEvent'][_0xdb09('0x23')](this));ami['on']('custom:closedinteraction',this[_0xdb09('0x25')]['bind'](this));ami['on'](_0xdb09('0x32'),this[_0xdb09('0x25')]['bind'](this));ami['on'](_0xdb09('0x33'),this[_0xdb09('0x25')][_0xdb09('0x23')](this));ami['on'](_0xdb09('0x34'),this[_0xdb09('0x25')][_0xdb09('0x23')](this));ami['on'](_0xdb09('0x35'),this[_0xdb09('0x25')][_0xdb09('0x23')](this));ami['on'](_0xdb09('0x36'),this['syncCustomEvent'][_0xdb09('0x23')](this));}Trigger['prototype'][_0xdb09('0x37')]=function(_0x33e8fb,_0x46fdef,_0x42cf4a){logger[_0xdb09('0x38')](_0x33e8fb,_0x46fdef,JSON[_0xdb09('0x39')](_0x42cf4a));io['to'](_0x33e8fb)[_0xdb09('0x37')](_0x46fdef,_0x42cf4a);};Trigger['prototype'][_0xdb09('0x25')]=function(_0x39f2ab){var _0xe01241=_['clone'](_0x39f2ab);if(typeof _0xe01241[_0xdb09('0x3a')]===_0xdb09('0x3b')){_0xe01241[_0xdb09('0x3a')]='voice';}this['checkTriggers'](_0xe01241);};Trigger[_0xdb09('0x3c')][_0xdb09('0x2e')]=function(_0x321756){if(this[_0xdb09('0x13')][_0x321756[_0xdb09('0x3d')]]){this[_0xdb09('0x25')](_0x321756);}};Trigger['prototype']['checkTriggers']=function(_0x4612fb){var _0xb64acd;for(var _0xe11b9e in this[_0xdb09('0x12')]){if(this[_0xdb09('0x12')]['hasOwnProperty'](_0xe11b9e)){if(this['triggers'][_0xe11b9e][_0xdb09('0x3e')]){_0xb64acd=this[_0xdb09('0x3f')](this[_0xdb09('0x12')][_0xe11b9e],_0x4612fb);if(_0xb64acd){_[_0xdb09('0x40')](_0x4612fb,_0x4612fb[_0xdb09('0x41')]);for(var _0x3b7ce3=0x0,_0x55ceeb,_0x494dce,_0x5376d2;_0x3b7ce30x0){_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(_0x257214,_0x65b711){var _0x393623=function(_0x14d6b4){while(--_0x14d6b4){_0x257214['push'](_0x257214['shift']());}};_0x393623(++_0x65b711);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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 ac19b06..64209d2 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 _0x95de=['userEmail','userId','then','outbound','destcalleridnum','calleridnum','contacts','4.0','headers','odata-entityid','substring','lastIndexOf','enduserId','toLowerCase','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','contactid',']\x20Enduser\x20Created!','forEach','includes','picklist','nameField','idField','indexOf','ticketType','incidents','getString','phonecall','assign','Subjects','Descriptions','/contacts(','/systemusers(','callDirection','queue','ticketId','catch','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','format','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','bluebird','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','POST','clientId','remoteUri','username','password','clientSecret','access_token','error',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','validateEmail','email','length','internalemailaddress','isdisabled','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!'];(function(_0x3207aa,_0xe86a72){var _0x51758f=function(_0x9ff790){while(--_0x9ff790){_0x3207aa['push'](_0x3207aa['shift']());}};_0x51758f(++_0xe86a72);}(_0x95de,0x163));var _0xe95d=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x95de[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require('lodash');var BPromise=require(_0xe95d('0x0'));var rp=require('request-promise');var util=require('util');var intUtil=require(_0xe95d('0x1'));var md5=require(_0xe95d('0x2'));var Redis=require(_0xe95d('0x3'));var logger=require(_0xe95d('0x4'))(_0xe95d('0x5'));var config=require(_0xe95d('0x6'));config[_0xe95d('0x7')]=_[_0xe95d('0x8')](config[_0xe95d('0x7')],{'host':_0xe95d('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe95d('0x7')]));function getAuthToken(_0x39cd3c,_0x2950c6,_0x540a7a){var _0x20d443={'method':_0xe95d('0xa'),'uri':_0x2950c6,'form':{'client_id':_0x39cd3c[_0xe95d('0xb')],'resource':_0x39cd3c[_0xe95d('0xc')],'username':_0x39cd3c[_0xe95d('0xd')],'password':_0x39cd3c[_0xe95d('0xe')],'grant_type':'password','client_secret':_0x39cd3c[_0xe95d('0xf')]},'json':!![]};return rp(_0x20d443)['then'](function(_0x4146b5){return _0x4146b5[_0xe95d('0x10')];})['catch'](function(_0x20ef28){logger[_0xe95d('0x11')]('['+[_0x540a7a['toUpperCase']()]+_0xe95d('0x12'));return _0x20ef28[_0xe95d('0x13')];});}function getUser(_0x4996c7,_0x5034ed,_0x4a0ccd,_0x103b71,_0x111ac5,_0x517410){return new BPromise(function(_0x1813de,_0x627643){return getAuthToken(_0x5034ed,_0x103b71,_0x517410)['then'](function(_0x2e937f){var _0x1f8054={'method':'GET','uri':_0x111ac5+_0xe95d('0x14'),'headers':{'Authorization':_0xe95d('0x15')+_0x2e937f,'OData-Version':'4.0'},'json':!![]};return rp(_0x1f8054);})['then'](function(_0x5a8f49){var _0x29530e=_0x5a8f49[_0xe95d('0x16')];var _0x19e5b2=![];var _0x5aa3ed=null;if(!_['isNil'](_0x4a0ccd)){if(intUtil[_0xe95d('0x17')](_0x4a0ccd[_0xe95d('0x18')])){_0x4996c7['userEmail']=_0x4a0ccd['email'];for(_0x5aa3ed=0x0;_0x5aa3ed<_0x29530e[_0xe95d('0x19')];_0x5aa3ed++){if(_0x29530e[_0x5aa3ed][_0xe95d('0x1a')]===_0x4a0ccd[_0xe95d('0x18')]&&!_0x29530e[_0x5aa3ed][_0xe95d('0x1b')]){_0x19e5b2=!![];logger[_0xe95d('0x1c')]('['+[_0x517410[_0xe95d('0x1d')]()]+_0xe95d('0x1e')+_0x29530e[_0x5aa3ed][_0xe95d('0x1f')]+'!');_0x4996c7['userId']=_0x29530e[_0x5aa3ed]['systemuserid'];}}}}if(!_0x19e5b2){logger[_0xe95d('0x1c')]('['+[_0x517410[_0xe95d('0x1d')]()]+_0xe95d('0x20'));_0x4996c7[_0xe95d('0x21')]=_0x5034ed[_0xe95d('0xd')];for(_0x5aa3ed=0x0;_0x5aa3ed<_0x29530e['length'];_0x5aa3ed++){if(_0x29530e[_0x5aa3ed][_0xe95d('0x1a')]===_0x5034ed[_0xe95d('0xd')]){_0x4996c7[_0xe95d('0x22')]=_0x29530e[_0x5aa3ed]['systemuserid'];}}}_0x1813de(_0x4996c7);})['catch'](function(_0x168bae){_0x627643(_0x168bae[_0xe95d('0x13')]);});});}function createEndUser(_0x523dc5,_0x105017,_0x914cc9,_0x30089c,_0x47f13a,_0x465024){return new BPromise(function(_0x26b920,_0x5c05cc){return getAuthToken(_0x105017,_0x914cc9,_0x465024)[_0xe95d('0x23')](function(_0x16cb77){var _0x1664ad=_0x465024['toLowerCase']()===_0xe95d('0x24')?_0x47f13a[_0xe95d('0x25')]:_0x47f13a[_0xe95d('0x26')];var _0x28071d={'method':_0xe95d('0xa'),'uri':_0x30089c+_0xe95d('0x27'),'body':{'telephone1':_0x1664ad,'fullname':_0x1664ad,'firstname':_0x1664ad,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x523dc5['userId']+')'},'headers':{'Authorization':'Bearer\x20'+_0x16cb77,'OData-Version':_0xe95d('0x28')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x28071d);})[_0xe95d('0x23')](function(_0x44d7cb){var _0x178dae=_0x44d7cb[_0xe95d('0x29')][_0xe95d('0x2a')];var _0x312120=_0x178dae[_0xe95d('0x2b')](_0x178dae[_0xe95d('0x2c')]('(')+0x1,_0x178dae['lastIndexOf'](')'));_0x523dc5[_0xe95d('0x2d')]=_0x312120;_0x26b920(_0x523dc5);})['catch'](function(_0x365b26){_0x5c05cc(_0x365b26[_0xe95d('0x13')]);});});}function getEndUser(_0x1ac750,_0x2cf842,_0x305aed,_0x4182c8,_0x4ec1e8,_0x2ac2d0){return new BPromise(function(_0x3b0ab0,_0x4bb8aa){var _0x240fb0=_0x2ac2d0[_0xe95d('0x2e')]()===_0xe95d('0x24')?_0x4ec1e8['destcalleridnum']:_0x4ec1e8[_0xe95d('0x26')];return getAuthToken(_0x2cf842,_0x305aed,_0x2ac2d0)['then'](function(_0x26cb83){var _0x39fa7a={'method':'GET','uri':_0x4182c8+_0xe95d('0x2f')+_0x240fb0[_0xe95d('0x30')]('+','%2b')+'\x27','headers':{'Authorization':_0xe95d('0x15')+_0x26cb83,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x39fa7a);})[_0xe95d('0x23')](function(_0x41b06d){var _0x50d5a9=null;if(_0x41b06d){var _0x4a33bf=_0x41b06d[_0xe95d('0x16')];var _0x367cec=![];for(_0x50d5a9=0x0;_0x50d5a9<_0x4a33bf[_0xe95d('0x19')];_0x50d5a9++){if(_0x4a33bf[_0x50d5a9]['telephone1']===_0x240fb0){_0x367cec=!![];_0x1ac750['enduserId']=_0x4a33bf[_0x50d5a9][_0xe95d('0x31')];}}if(_0x367cec){_0x3b0ab0(_0x1ac750);}else{return createEndUser(_0x1ac750,_0x2cf842,_0x305aed,_0x4182c8,_0x4ec1e8,_0x2ac2d0)[_0xe95d('0x23')](function(_0x5e3c4a){logger[_0xe95d('0x1c')]('['+[_0x2ac2d0[_0xe95d('0x1d')]()]+']\x20Enduser\x20created!',_0x5e3c4a[_0xe95d('0x2d')]);_0x3b0ab0(_0x5e3c4a);});}}else{return createEndUser(_0x1ac750,_0x2cf842,_0x305aed,_0x4182c8,_0x4ec1e8,_0x2ac2d0)[_0xe95d('0x23')](function(_0xccba5f){logger[_0xe95d('0x1c')]('['+[_0x2ac2d0['toUpperCase']()]+_0xe95d('0x32'),_0xccba5f[_0xe95d('0x2d')]);_0x3b0ab0(_0xccba5f);});}});});}function getCustomFields(_0x134d17,_0x3a725f,_0x57fa5){var _0x23002e={};if(_0x134d17[_0xe95d('0x19')]>0x0){_[_0xe95d('0x33')](_0x134d17,function(_0x4472cb){if(_[_0xe95d('0x34')](['string',_0xe95d('0x35')],_0x4472cb['type'])&&_0x4472cb[_0xe95d('0x36')]&&!_0x4472cb['customField']){var _0x44780c=_0x4472cb[_0xe95d('0x37')][_0xe95d('0x2e')]();var _0x3d69c6=_0x44780c[_0xe95d('0x2b')](0x0,_0x44780c[_0xe95d('0x38')]('_'));var _0x5aaf55=_0x44780c[_0xe95d('0x2b')](_0x44780c['indexOf']('_')+0x1);if(_0x3d69c6===_0x57fa5){_0x23002e[_0x5aaf55]=_0x4472cb['content'];}}});}return _0x23002e;}function getTicket(_0x34ac1e,_0x54ac27,_0x313018,_0x1beef5,_0x123e3f,_0x45bde7,_0x27c52e){return new BPromise(function(_0x470147,_0x4e5977){var _0x1211d7;return getAuthToken(_0x54ac27,_0x313018,_0x27c52e)[_0xe95d('0x23')](function(_0x395dca){if(_0x45bde7[_0xe95d('0x39')]==='incident'){_0x1211d7={'method':'POST','uri':_0x1beef5+_0xe95d('0x3a'),'body':Object['assign']({},{'title':intUtil[_0xe95d('0x3b')](_0x45bde7['Subjects'],_0x123e3f,'\x20'),'description':intUtil[_0xe95d('0x3b')](_0x45bde7['Descriptions'],_0x123e3f,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x34ac1e['enduserId']+')','ownerid@odata.bind':'/systemusers('+_0x34ac1e[_0xe95d('0x22')]+')','caseorigincode':'1'},getCustomFields(_0x45bde7['Fields'],_0x123e3f,_0x45bde7[_0xe95d('0x39')])),'headers':{'Authorization':_0xe95d('0x15')+_0x395dca,'OData-Version':_0xe95d('0x28')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x45bde7[_0xe95d('0x39')]===_0xe95d('0x3c')){_0x1211d7={'method':_0xe95d('0xa'),'uri':_0x1beef5+'phonecalls','body':Object[_0xe95d('0x3d')]({},{'subject':intUtil[_0xe95d('0x3b')](_0x45bde7[_0xe95d('0x3e')],_0x123e3f,'\x20'),'phonenumber':String(_0x123e3f[_0xe95d('0x26')]),'description':intUtil[_0xe95d('0x3b')](_0x45bde7[_0xe95d('0x3f')],_0x123e3f,'\x0a'),'regardingobjectid_contact@odata.bind':_0xe95d('0x40')+_0x34ac1e[_0xe95d('0x2d')]+')','ownerid@odata.bind':_0xe95d('0x41')+_0x34ac1e['userId']+')','directioncode':_0x34ac1e[_0xe95d('0x42')]===_0xe95d('0x43')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xe95d('0x41')+_0x34ac1e[_0xe95d('0x22')]+')','participationtypemask':_0x34ac1e[_0xe95d('0x42')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0xe95d('0x40')+_0x34ac1e[_0xe95d('0x2d')]+')','participationtypemask':_0x34ac1e[_0xe95d('0x42')]===_0xe95d('0x43')?0x1:0x2}]},getCustomFields(_0x45bde7['Fields'],_0x123e3f,_0x45bde7[_0xe95d('0x39')])),'headers':{'Authorization':_0xe95d('0x15')+_0x395dca,'OData-Version':_0xe95d('0x28')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1211d7);})['then'](function(_0x3ff801){var _0xd03254=_0x3ff801['headers']['odata-entityid'];var _0x6786f=_0xd03254['substring'](_0xd03254[_0xe95d('0x2c')]('(')+0x1,_0xd03254[_0xe95d('0x2c')](')'));_0x34ac1e[_0xe95d('0x44')]=_0x6786f;_0x470147(_0x34ac1e);})[_0xe95d('0x45')](function(_0x11ba83){_0x4e5977(_0x11ba83[_0xe95d('0x13')]);});});}function emit(_0x266d63,_0x1fe6d7,_0x52f827,_0x481265){var _0x4a5eb0={'uri':util['format'](_0xe95d('0x46'),_0x266d63,_0x52f827,_0x481265)};io['to'](util['format'](_0xe95d('0x47'),_0x1fe6d7))[_0xe95d('0x48')](_0xe95d('0x49'),_0x4a5eb0);}exports['cs']=function(_0x2139ee,_0x7419ad,_0x29cba2,_0x24ab2e,_0x13d17a,_0xb24db0,_0x4d021c,_0x1458ea){var _0x17848d={};_0xb24db0['remoteUri']=intUtil[_0xe95d('0x4a')](_0xb24db0[_0xe95d('0xc')]);_0xb24db0[_0xe95d('0x4b')]=intUtil[_0xe95d('0x4a')](_0xb24db0[_0xe95d('0x4b')]);_0x17848d[_0xe95d('0x42')]=_0x1458ea===_0xe95d('0x43')||_0x1458ea===_0xe95d('0x4c')?_0xe95d('0x43'):_0xe95d('0x24');var _0x39d406=util[_0xe95d('0x4d')](_0xe95d('0x4e'),_0xb24db0[_0xe95d('0xc')]);var _0x7cdd85=util[_0xe95d('0x4d')](_0xe95d('0x4f'),_0xb24db0[_0xe95d('0x50')]);var _0x51a68a=util[_0xe95d('0x4d')](_0xe95d('0x51'),_0xb24db0[_0xe95d('0x4b')],_0x7419ad['uniqueid'],md5(_0x7419ad['uniqueid']));if(_0x13d17a&&_0x13d17a[_0xe95d('0x52')]){logger[_0xe95d('0x1c')]('[QUEUE]',_0xe95d('0x53'));_0x7419ad[_0xe95d('0x54')]=_0x51a68a;}else if(_0x4d021c&&_0x4d021c[_0xe95d('0x55')]&&_0x4d021c['recordingFormat']!==_0xe95d('0x56')){logger[_0xe95d('0x1c')](_0xe95d('0x57'),'Recording\x20is\x20enabled!');_0x7419ad[_0xe95d('0x54')]=_0x51a68a;}else{_0x7419ad[_0xe95d('0x54')]='';}return getUser(_0x17848d,_0xb24db0,_0x24ab2e,_0x7cdd85,_0x39d406,_0x1458ea)[_0xe95d('0x23')](function(_0x389a1b){logger['info']('['+_0x1458ea[_0xe95d('0x1d')]()+_0xe95d('0x58'),_0x389a1b[_0xe95d('0x22')]);logger[_0xe95d('0x1c')]('['+_0x1458ea[_0xe95d('0x1d')]()+_0xe95d('0x59'),_0x389a1b['userEmail']);return getEndUser(_0x389a1b,_0xb24db0,_0x7cdd85,_0x39d406,_0x7419ad,_0x1458ea);})[_0xe95d('0x23')](function(_0x10ccef){logger[_0xe95d('0x1c')]('['+_0x1458ea[_0xe95d('0x1d')]()+_0xe95d('0x5a'),_0x10ccef['enduserId']);logger[_0xe95d('0x1c')]('['+_0x1458ea[_0xe95d('0x1d')]()+_0xe95d('0x5b'),_0x7419ad[_0xe95d('0x26')]);return getTicket(_0x10ccef,_0xb24db0,_0x7cdd85,_0x39d406,_0x7419ad,_0x29cba2,_0x1458ea);})[_0xe95d('0x23')](function(_0x43cf49){logger[_0xe95d('0x1c')](util[_0xe95d('0x4d')]('['+_0x1458ea[_0xe95d('0x1d')]()+_0xe95d('0x5c'),_0x29cba2[_0xe95d('0x39')],_0x43cf49[_0xe95d('0x44')]));logger[_0xe95d('0x1c')](util['format']('['+_0x1458ea[_0xe95d('0x1d')]()+_0xe95d('0x5d'),_0x1458ea));if(_0x1458ea!==_0xe95d('0x4c')){logger[_0xe95d('0x1c')]('['+_0x1458ea[_0xe95d('0x1d')]()+']',_0xe95d('0x5e'));emit(_0xb24db0['remoteUri'],_0x24ab2e[_0xe95d('0x5f')],_0x29cba2['ticketType'],_0x43cf49[_0xe95d('0x44')]);}})[_0xe95d('0x45')](function(_0x3f7970){logger[_0xe95d('0x11')]('['+_0x1458ea[_0xe95d('0x1d')]()+_0xe95d('0x60'),util['inspect'](_0x3f7970,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x3e1f=['catch','error',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','isNil','email','userEmail','length','internalemailaddress','isdisabled','info','toUpperCase','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','toLowerCase','destcalleridnum','calleridnum','contacts','/systemusers(','lastIndexOf','enduserId','outbound','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','Bearer\x20','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','string','type','nameField','customField','idField','substring','indexOf','incidents','assign','getString','Descriptions','/contacts(','Fields','ticketType','Subjects','callDirection','queue','odata-entityid','ticketId','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','remoteUri','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','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','bluebird','request-promise','util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','POST','clientId','password','clientSecret','then','access_token'];(function(_0x44dbb2,_0x23501c){var _0x2b2656=function(_0xe3688f){while(--_0xe3688f){_0x44dbb2['push'](_0x44dbb2['shift']());}};_0x2b2656(++_0x23501c);}(_0x3e1f,0x18a));var _0xf3e1=function(_0x500812,_0x296a3c){_0x500812=_0x500812-0x0;var _0x4add02=_0x3e1f[_0x500812];return _0x4add02;};'use strict';var _=require('lodash');var BPromise=require(_0xf3e1('0x0'));var rp=require(_0xf3e1('0x1'));var util=require(_0xf3e1('0x2'));var intUtil=require('./util');var md5=require(_0xf3e1('0x3'));var Redis=require(_0xf3e1('0x4'));var logger=require(_0xf3e1('0x5'))(_0xf3e1('0x6'));var config=require(_0xf3e1('0x7'));config['redis']=_[_0xf3e1('0x8')](config[_0xf3e1('0x9')],{'host':_0xf3e1('0xa'),'port':0x18eb});var io=require(_0xf3e1('0xb'))(new Redis(config['redis']));function getAuthToken(_0x4a6491,_0x185faf,_0x88f2e9){var _0x4869fa={'method':_0xf3e1('0xc'),'uri':_0x185faf,'form':{'client_id':_0x4a6491[_0xf3e1('0xd')],'resource':_0x4a6491['remoteUri'],'username':_0x4a6491['username'],'password':_0x4a6491[_0xf3e1('0xe')],'grant_type':'password','client_secret':_0x4a6491[_0xf3e1('0xf')]},'json':!![]};return rp(_0x4869fa)[_0xf3e1('0x10')](function(_0x23738a){return _0x23738a[_0xf3e1('0x11')];})[_0xf3e1('0x12')](function(_0x56ce81){logger[_0xf3e1('0x13')]('['+[_0x88f2e9['toUpperCase']()]+_0xf3e1('0x14'));return _0x56ce81[_0xf3e1('0x15')];});}function getUser(_0x5633d6,_0x29313c,_0x2ff57e,_0xfc07a2,_0x2f4722,_0x395668){return new BPromise(function(_0x54788b,_0x3c4fab){return getAuthToken(_0x29313c,_0xfc07a2,_0x395668)[_0xf3e1('0x10')](function(_0xb18131){var _0x3dea57={'method':_0xf3e1('0x16'),'uri':_0x2f4722+_0xf3e1('0x17'),'headers':{'Authorization':'Bearer\x20'+_0xb18131,'OData-Version':_0xf3e1('0x18')},'json':!![]};return rp(_0x3dea57);})[_0xf3e1('0x10')](function(_0x1bcb42){var _0x1faefe=_0x1bcb42['value'];var _0x2aeb80=![];var _0x1598c0=null;if(!_[_0xf3e1('0x19')](_0x2ff57e)){if(intUtil['validateEmail'](_0x2ff57e[_0xf3e1('0x1a')])){_0x5633d6[_0xf3e1('0x1b')]=_0x2ff57e[_0xf3e1('0x1a')];for(_0x1598c0=0x0;_0x1598c0<_0x1faefe[_0xf3e1('0x1c')];_0x1598c0++){if(_0x1faefe[_0x1598c0][_0xf3e1('0x1d')]===_0x2ff57e[_0xf3e1('0x1a')]&&!_0x1faefe[_0x1598c0][_0xf3e1('0x1e')]){_0x2aeb80=!![];logger[_0xf3e1('0x1f')]('['+[_0x395668[_0xf3e1('0x20')]()]+']\x20Agent\x20found\x20'+_0x1faefe[_0x1598c0][_0xf3e1('0x21')]+'!');_0x5633d6[_0xf3e1('0x22')]=_0x1faefe[_0x1598c0][_0xf3e1('0x21')];}}}}if(!_0x2aeb80){logger['info']('['+[_0x395668[_0xf3e1('0x20')]()]+_0xf3e1('0x23'));_0x5633d6[_0xf3e1('0x1b')]=_0x29313c['username'];for(_0x1598c0=0x0;_0x1598c0<_0x1faefe[_0xf3e1('0x1c')];_0x1598c0++){if(_0x1faefe[_0x1598c0]['internalemailaddress']===_0x29313c[_0xf3e1('0x24')]){_0x5633d6[_0xf3e1('0x22')]=_0x1faefe[_0x1598c0][_0xf3e1('0x21')];}}}_0x54788b(_0x5633d6);})['catch'](function(_0x1c6610){_0x3c4fab(_0x1c6610[_0xf3e1('0x15')]);});});}function createEndUser(_0x248b84,_0x324449,_0x32e7c0,_0x44668c,_0x487a5e,_0xa9bf1a){return new BPromise(function(_0x4677c9,_0x2df74a){return getAuthToken(_0x324449,_0x32e7c0,_0xa9bf1a)['then'](function(_0x1439c6){var _0x377508=_0xa9bf1a[_0xf3e1('0x25')]()==='outbound'?_0x487a5e[_0xf3e1('0x26')]:_0x487a5e[_0xf3e1('0x27')];var _0x38bd5c={'method':_0xf3e1('0xc'),'uri':_0x44668c+_0xf3e1('0x28'),'body':{'telephone1':_0x377508,'fullname':_0x377508,'firstname':_0x377508,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xf3e1('0x29')+_0x248b84[_0xf3e1('0x22')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x1439c6,'OData-Version':_0xf3e1('0x18')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x38bd5c);})[_0xf3e1('0x10')](function(_0x313c76){var _0x3ae639=_0x313c76['headers']['odata-entityid'];var _0x2c7c7a=_0x3ae639['substring'](_0x3ae639[_0xf3e1('0x2a')]('(')+0x1,_0x3ae639[_0xf3e1('0x2a')](')'));_0x248b84[_0xf3e1('0x2b')]=_0x2c7c7a;_0x4677c9(_0x248b84);})[_0xf3e1('0x12')](function(_0xbe7efb){_0x2df74a(_0xbe7efb[_0xf3e1('0x15')]);});});}function getEndUser(_0x3e2bba,_0x2cdb6a,_0x16d144,_0x48a8ea,_0x2f1ef6,_0x7a16df){return new BPromise(function(_0x30891c,_0x1d3e5e){var _0x2cf975=_0x7a16df[_0xf3e1('0x25')]()===_0xf3e1('0x2c')?_0x2f1ef6[_0xf3e1('0x26')]:_0x2f1ef6[_0xf3e1('0x27')];return getAuthToken(_0x2cdb6a,_0x16d144,_0x7a16df)[_0xf3e1('0x10')](function(_0x180504){var _0x38c993={'method':'GET','uri':_0x48a8ea+_0xf3e1('0x2d')+_0x2cf975[_0xf3e1('0x2e')]('+',_0xf3e1('0x2f'))+'\x27','headers':{'Authorization':_0xf3e1('0x30')+_0x180504,'If-None-Match':null,'OData-Version':_0xf3e1('0x18')},'json':!![]};return rp(_0x38c993);})[_0xf3e1('0x10')](function(_0x3cc771){var _0x42691a=null;if(_0x3cc771){var _0x2f8a4f=_0x3cc771['value'];var _0x112c52=![];for(_0x42691a=0x0;_0x42691a<_0x2f8a4f[_0xf3e1('0x1c')];_0x42691a++){if(_0x2f8a4f[_0x42691a][_0xf3e1('0x31')]===_0x2cf975){_0x112c52=!![];_0x3e2bba['enduserId']=_0x2f8a4f[_0x42691a][_0xf3e1('0x32')];}}if(_0x112c52){_0x30891c(_0x3e2bba);}else{return createEndUser(_0x3e2bba,_0x2cdb6a,_0x16d144,_0x48a8ea,_0x2f1ef6,_0x7a16df)['then'](function(_0x15a9c8){logger[_0xf3e1('0x1f')]('['+[_0x7a16df['toUpperCase']()]+_0xf3e1('0x33'),_0x15a9c8[_0xf3e1('0x2b')]);_0x30891c(_0x15a9c8);});}}else{return createEndUser(_0x3e2bba,_0x2cdb6a,_0x16d144,_0x48a8ea,_0x2f1ef6,_0x7a16df)['then'](function(_0x37ab4f){logger[_0xf3e1('0x1f')]('['+[_0x7a16df[_0xf3e1('0x20')]()]+_0xf3e1('0x34'),_0x37ab4f['enduserId']);_0x30891c(_0x37ab4f);});}});});}function getCustomFields(_0x50f914,_0x37a835,_0x34a824){var _0x4d9aa7={};if(_0x50f914['length']>0x0){_[_0xf3e1('0x35')](_0x50f914,function(_0x42a97b){if(_[_0xf3e1('0x36')]([_0xf3e1('0x37'),'picklist'],_0x42a97b[_0xf3e1('0x38')])&&_0x42a97b[_0xf3e1('0x39')]&&!_0x42a97b[_0xf3e1('0x3a')]){var _0x57b4e2=_0x42a97b[_0xf3e1('0x3b')][_0xf3e1('0x25')]();var _0xa6bc52=_0x57b4e2[_0xf3e1('0x3c')](0x0,_0x57b4e2['indexOf']('_'));var _0x560e0e=_0x57b4e2['substring'](_0x57b4e2[_0xf3e1('0x3d')]('_')+0x1);if(_0xa6bc52===_0x34a824){_0x4d9aa7[_0x560e0e]=_0x42a97b['content'];}}});}return _0x4d9aa7;}function getTicket(_0x51700d,_0x127b14,_0x508209,_0x2e5186,_0x47b02c,_0x320eec,_0x8627d3){return new BPromise(function(_0x54ad13,_0x267eb3){var _0x4386e8;return getAuthToken(_0x127b14,_0x508209,_0x8627d3)[_0xf3e1('0x10')](function(_0x552085){if(_0x320eec['ticketType']==='incident'){_0x4386e8={'method':'POST','uri':_0x2e5186+_0xf3e1('0x3e'),'body':Object[_0xf3e1('0x3f')]({},{'title':intUtil[_0xf3e1('0x40')](_0x320eec['Subjects'],_0x47b02c,'\x20'),'description':intUtil[_0xf3e1('0x40')](_0x320eec[_0xf3e1('0x41')],_0x47b02c,'\x0a'),'customerid_contact@odata.bind':_0xf3e1('0x42')+_0x51700d['enduserId']+')','ownerid@odata.bind':_0xf3e1('0x29')+_0x51700d['userId']+')','caseorigincode':'1'},getCustomFields(_0x320eec[_0xf3e1('0x43')],_0x47b02c,_0x320eec[_0xf3e1('0x44')])),'headers':{'Authorization':_0xf3e1('0x30')+_0x552085,'OData-Version':_0xf3e1('0x18')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x320eec[_0xf3e1('0x44')]==='phonecall'){_0x4386e8={'method':_0xf3e1('0xc'),'uri':_0x2e5186+'phonecalls','body':Object[_0xf3e1('0x3f')]({},{'subject':intUtil[_0xf3e1('0x40')](_0x320eec[_0xf3e1('0x45')],_0x47b02c,'\x20'),'phonenumber':String(_0x47b02c[_0xf3e1('0x27')]),'description':intUtil[_0xf3e1('0x40')](_0x320eec['Descriptions'],_0x47b02c,'\x0a'),'regardingobjectid_contact@odata.bind':_0xf3e1('0x42')+_0x51700d[_0xf3e1('0x2b')]+')','ownerid@odata.bind':_0xf3e1('0x29')+_0x51700d[_0xf3e1('0x22')]+')','directioncode':_0x51700d[_0xf3e1('0x46')]==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xf3e1('0x29')+_0x51700d['userId']+')','participationtypemask':_0x51700d[_0xf3e1('0x46')]===_0xf3e1('0x47')?0x2:0x1},{'partyid_contact@odata.bind':_0xf3e1('0x42')+_0x51700d[_0xf3e1('0x2b')]+')','participationtypemask':_0x51700d[_0xf3e1('0x46')]===_0xf3e1('0x47')?0x1:0x2}]},getCustomFields(_0x320eec[_0xf3e1('0x43')],_0x47b02c,_0x320eec[_0xf3e1('0x44')])),'headers':{'Authorization':_0xf3e1('0x30')+_0x552085,'OData-Version':_0xf3e1('0x18')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4386e8);})[_0xf3e1('0x10')](function(_0x4439e2){var _0x30fb28=_0x4439e2['headers'][_0xf3e1('0x48')];var _0x341c84=_0x30fb28[_0xf3e1('0x3c')](_0x30fb28[_0xf3e1('0x2a')]('(')+0x1,_0x30fb28[_0xf3e1('0x2a')](')'));_0x51700d[_0xf3e1('0x49')]=_0x341c84;_0x54ad13(_0x51700d);})[_0xf3e1('0x12')](function(_0x4ba0c4){_0x267eb3(_0x4ba0c4[_0xf3e1('0x15')]);});});}function emit(_0x3d4018,_0x1d5617,_0x212357,_0x30520f){var _0x1ab0ac={'uri':util[_0xf3e1('0x4a')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x3d4018,_0x212357,_0x30520f)};io['to'](util[_0xf3e1('0x4a')](_0xf3e1('0x4b'),_0x1d5617))[_0xf3e1('0x4c')](_0xf3e1('0x4d'),_0x1ab0ac);}exports['cs']=function(_0x1194a9,_0x2a1e98,_0x4f4b57,_0x23951b,_0x39b30a,_0x61f2b3,_0x3343c8,_0x546142){var _0x1aa462={};_0x61f2b3['remoteUri']=intUtil[_0xf3e1('0x4e')](_0x61f2b3[_0xf3e1('0x4f')]);_0x61f2b3[_0xf3e1('0x50')]=intUtil[_0xf3e1('0x4e')](_0x61f2b3['serverUrl']);_0x1aa462[_0xf3e1('0x46')]=_0x546142===_0xf3e1('0x47')||_0x546142===_0xf3e1('0x51')?'queue':'outbound';var _0x5c0284=util['format'](_0xf3e1('0x52'),_0x61f2b3[_0xf3e1('0x4f')]);var _0x2c02a7=util[_0xf3e1('0x4a')](_0xf3e1('0x53'),_0x61f2b3[_0xf3e1('0x54')]);var _0x53e47d=util[_0xf3e1('0x4a')](_0xf3e1('0x55'),_0x61f2b3[_0xf3e1('0x50')],_0x2a1e98[_0xf3e1('0x56')],md5(_0x2a1e98[_0xf3e1('0x56')]));if(_0x39b30a&&_0x39b30a[_0xf3e1('0x57')]){logger[_0xf3e1('0x1f')]('[QUEUE]',_0xf3e1('0x58'));_0x2a1e98[_0xf3e1('0x59')]=_0x53e47d;}else if(_0x3343c8&&_0x3343c8[_0xf3e1('0x5a')]&&_0x3343c8[_0xf3e1('0x5a')]!==_0xf3e1('0x5b')){logger['info'](_0xf3e1('0x5c'),_0xf3e1('0x58'));_0x2a1e98[_0xf3e1('0x59')]=_0x53e47d;}else{_0x2a1e98[_0xf3e1('0x59')]='';}return getUser(_0x1aa462,_0x61f2b3,_0x23951b,_0x2c02a7,_0x5c0284,_0x546142)[_0xf3e1('0x10')](function(_0x4dfc15){logger[_0xf3e1('0x1f')]('['+_0x546142[_0xf3e1('0x20')]()+_0xf3e1('0x5d'),_0x4dfc15[_0xf3e1('0x22')]);logger[_0xf3e1('0x1f')]('['+_0x546142[_0xf3e1('0x20')]()+_0xf3e1('0x5e'),_0x4dfc15['userEmail']);return getEndUser(_0x4dfc15,_0x61f2b3,_0x2c02a7,_0x5c0284,_0x2a1e98,_0x546142);})[_0xf3e1('0x10')](function(_0x2a6054){logger[_0xf3e1('0x1f')]('['+_0x546142[_0xf3e1('0x20')]()+_0xf3e1('0x5f'),_0x2a6054[_0xf3e1('0x2b')]);logger[_0xf3e1('0x1f')]('['+_0x546142['toUpperCase']()+_0xf3e1('0x60'),_0x2a1e98[_0xf3e1('0x27')]);return getTicket(_0x2a6054,_0x61f2b3,_0x2c02a7,_0x5c0284,_0x2a1e98,_0x4f4b57,_0x546142);})[_0xf3e1('0x10')](function(_0x46852a){logger[_0xf3e1('0x1f')](util['format']('['+_0x546142[_0xf3e1('0x20')]()+_0xf3e1('0x61'),_0x4f4b57['ticketType'],_0x46852a[_0xf3e1('0x49')]));logger[_0xf3e1('0x1f')](util[_0xf3e1('0x4a')]('['+_0x546142[_0xf3e1('0x20')]()+_0xf3e1('0x62'),_0x546142));if(_0x546142!=='unmanaged'){logger[_0xf3e1('0x1f')]('['+_0x546142[_0xf3e1('0x20')]()+']',_0xf3e1('0x63'));emit(_0x61f2b3[_0xf3e1('0x4f')],_0x23951b[_0xf3e1('0x64')],_0x4f4b57[_0xf3e1('0x44')],_0x46852a[_0xf3e1('0x49')]);}})[_0xf3e1('0x12')](function(_0x542ae4){logger[_0xf3e1('0x13')]('['+_0x546142[_0xf3e1('0x20')]()+_0xf3e1('0x65'),util[_0xf3e1('0x66')](_0x542ae4,{'showHidden':!![],'depth':null}));});}; \ 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 d19bfc3..2d378b4 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 _0xfd0d=['catch','stringify','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','%s/helpdesk/tickets/%d','unmanaged','lastevent','toUpperCase','error','lodash','request-promise','md5','util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','remoteUri','info','Ticket\x20created!','validateEmail','then','length','Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','toString','base64','debug','map','includes','string','picklist','type','nameField','customField','content','push','idField','variableName','Variable','toLowerCase','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xfd0d,0xbd));var _0xdfd0=function(_0x46a281,_0x2bf44b){_0x46a281=_0x46a281-0x0;var _0x38474d=_0xfd0d[_0x46a281];return _0x38474d;};'use strict';var _=require(_0xdfd0('0x0'));var rp=require(_0xdfd0('0x1'));var md5=require(_0xdfd0('0x2'));var util=require(_0xdfd0('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xdfd0('0x4'));var logger=require(_0xdfd0('0x5'))(_0xdfd0('0x6'));config[_0xdfd0('0x7')]=_[_0xdfd0('0x8')](config[_0xdfd0('0x7')],{'host':_0xdfd0('0x9'),'port':0x18eb});var io=require(_0xdfd0('0xa'))(new Redis(config[_0xdfd0('0x7')]));var headers={'Content-Type':'application/json','Accept':_0xdfd0('0xb')};function emit(_0x548c36,_0x7af06b,_0x264fc6){io['to'](_0x548c36)[_0xdfd0('0xc')](_0x7af06b,_0x264fc6);}function getTicket(_0x2e3ea1,_0x4cae87,_0x827315,_0x593e06,_0x20b4b9){logger['info'](_0xdfd0('0xd'));var _0x33c64f=_[_0xdfd0('0xe')]({'responder_id':_0x4cae87['id'],'requester_id':_0x827315['id'],'name':util[_0xdfd0('0xf')](_0xdfd0('0x10'),_0x20b4b9[_0xdfd0('0x11')]),'phone':_0x20b4b9[_0xdfd0('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xdfd0('0x13')](_0x593e06[_0xdfd0('0x14')],_0x20b4b9,'\x20'),'description':intUtil[_0xdfd0('0x13')](_0x593e06[_0xdfd0('0x15')],_0x20b4b9,_0xdfd0('0x16')),'tags':getTags(_0x593e06[_0xdfd0('0x17')],_0xdfd0('0x18'))},getCustomFields(_0x593e06[_0xdfd0('0x19')],_0x20b4b9));_0x33c64f[_0xdfd0('0x1a')]=_[_0xdfd0('0x1b')](_['keyBy'](_0x33c64f['custom_fields'],'id'),'value');return request({'uri':util['format']('%s/api/v2/tickets',_0x2e3ea1[_0xdfd0('0x1c')]),'method':'POST','body':_0x33c64f})['then'](function(_0x297e69){logger[_0xdfd0('0x1d')](_0xdfd0('0x1e'));return _0x297e69;});}function getUser(_0x21da4c,_0x56ec9b){if(intUtil[_0xdfd0('0x1f')](_0x56ec9b)){return request({'uri':util['format']('%s/api/v2/agents',_0x21da4c['remoteUri']),'qs':{'email':_0x56ec9b}})[_0xdfd0('0x20')](function(_0x597c1a){if(_0x597c1a[_0xdfd0('0x21')]){logger[_0xdfd0('0x1d')](_0xdfd0('0x22'));return _[_0xdfd0('0x23')](_0x597c1a,function(_0x38a62a){return _0x38a62a[_0xdfd0('0x24')]['email']===_0x56ec9b;});}else{logger[_0xdfd0('0x1d')](_0xdfd0('0x25'));return request({'uri':util['format'](_0xdfd0('0x26'),_0x21da4c[_0xdfd0('0x1c')])})[_0xdfd0('0x20')](function(_0x54a5c7){logger[_0xdfd0('0x1d')]('Admin\x20account\x20selected.');return _0x54a5c7;});}});}else{logger[_0xdfd0('0x1d')](_0xdfd0('0x27'));return request({'uri':util['format'](_0xdfd0('0x26'),_0x21da4c[_0xdfd0('0x1c')])})[_0xdfd0('0x20')](function(_0xc4a148){logger[_0xdfd0('0x1d')](_0xdfd0('0x28'));return _0xc4a148;});}}function getEndUser(_0x35f80e,_0x7991a4,_0x4ce3e3){logger['info'](_0xdfd0('0x29'),_0x4ce3e3);return request({'uri':util[_0xdfd0('0xf')]('%s/api/v2/contacts',_0x35f80e[_0xdfd0('0x1c')]),'qs':{'phone':_0x4ce3e3}})[_0xdfd0('0x20')](function(_0x538f58){if(_0x538f58[_0xdfd0('0x21')]){logger[_0xdfd0('0x1d')]('Enduser\x20found!');return _['find'](_0x538f58,{'phone':_0x4ce3e3});}else{logger[_0xdfd0('0x1d')](_0xdfd0('0x2a'));return request({'uri':util['format']('%s/api/v2/contacts',_0x35f80e[_0xdfd0('0x1c')]),'method':'POST','body':{'name':_0x7991a4,'phone':_0x4ce3e3}})['then'](function(_0x50e817){logger[_0xdfd0('0x1d')]('Enduser\x20created.');return _0x50e817;});}});}function getAuth(_0x18264d){return util[_0xdfd0('0xf')]('Basic\x20%s',new Buffer(_0x18264d['apiKey']+':X')[_0xdfd0('0x2b')](_0xdfd0('0x2c')));}function request(_0x2c989b){logger[_0xdfd0('0x2d')]('[HTTP]',JSON['stringify'](_0x2c989b));return rp(_[_0xdfd0('0x8')](_0x2c989b,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x1f92fb,_0x14fe7f){var _0x551a6e=[];if(_0x1f92fb&&_0x1f92fb[_0xdfd0('0x21')]>0x0){_0x551a6e=_[_0xdfd0('0x2e')](_0x1f92fb,_0x14fe7f);}return _0x551a6e;}function getCustomFields(_0x9aef29,_0x525efc){var _0x92e36=[];var _0x2bc388={'custom_fields':[]};if(_0x9aef29[_0xdfd0('0x21')]>0x0){_['forEach'](_0x9aef29,function(_0x1858e4){if(_[_0xdfd0('0x2f')]([_0xdfd0('0x30'),_0xdfd0('0x31')],_0x1858e4[_0xdfd0('0x32')])&&_0x1858e4[_0xdfd0('0x33')]&&!_0x1858e4[_0xdfd0('0x34')]){_0x2bc388[_0x1858e4[_0xdfd0('0x33')]['toLowerCase']()]=_0x1858e4[_0xdfd0('0x35')][_0xdfd0('0x2b')]();}else if(_['includes']([_0xdfd0('0x30'),_0xdfd0('0x31')],_0x1858e4[_0xdfd0('0x32')])&&_0x1858e4['idField']&&_0x1858e4['customField']){_0x2bc388[_0xdfd0('0x1a')][_0xdfd0('0x36')]({'id':_0x1858e4['idField'],'value':_0x1858e4[_0xdfd0('0x35')][_0xdfd0('0x2b')]()});}else if(_0x1858e4[_0xdfd0('0x32')]==='variable'&&_0x1858e4['variableName']&&_0x1858e4[_0xdfd0('0x37')]&&_0x1858e4[_0xdfd0('0x34')]){_0x525efc[_0x1858e4['variableName']]&&_0x2bc388['custom_fields']['push']({'id':_0x1858e4[_0xdfd0('0x37')],'value':_0x525efc[_0x1858e4[_0xdfd0('0x38')]][_0xdfd0('0x2b')]()});}else if(_0x1858e4['type']==='customVariable'&&_0x1858e4[_0xdfd0('0x39')]&&_0x1858e4['Variable'][_0xdfd0('0x18')]&&_0x1858e4[_0xdfd0('0x37')]&&_0x1858e4['customField']){_0x525efc[_0x1858e4[_0xdfd0('0x39')][_0xdfd0('0x18')][_0xdfd0('0x3a')]()]&&_0x2bc388[_0xdfd0('0x1a')][_0xdfd0('0x36')]({'id':_0x1858e4[_0xdfd0('0x37')],'value':_0x525efc[_0x1858e4[_0xdfd0('0x39')][_0xdfd0('0x18')]['toLowerCase']()]['toString']()});}});}return _0x2bc388;}exports['queue']=function(_0x19b3c5,_0x1b70af,_0x158343,_0x47efaa,_0x3ca6bd,_0x19ae4b){var _0xdbf8b7,_0x472781;_0x19ae4b[_0xdfd0('0x1c')]=intUtil[_0xdfd0('0x3b')](_0x19ae4b[_0xdfd0('0x1c')]);_0x19ae4b[_0xdfd0('0x3c')]=intUtil[_0xdfd0('0x3b')](_0x19ae4b[_0xdfd0('0x3c')]);if(_0x3ca6bd&&_0x3ca6bd[_0xdfd0('0x3d')]){logger[_0xdfd0('0x1d')]('[QUEUE]',_0xdfd0('0x3e'));_0x1b70af[_0xdfd0('0x3f')]=util['format'](_0xdfd0('0x40'),_0x19ae4b[_0xdfd0('0x3c')],_0x1b70af[_0xdfd0('0x41')],md5(_0x1b70af[_0xdfd0('0x41')]));}else{_0x1b70af['recordingURL']='';}headers[_0xdfd0('0x42')]=getAuth(_0x19ae4b);return getUser(_0x19ae4b,_0x47efaa[_0xdfd0('0x43')])[_0xdfd0('0x20')](function(_0x5d2afb){_0xdbf8b7=_0x5d2afb;logger[_0xdfd0('0x1d')](_0xdfd0('0x44'),_0xdbf8b7['id']);return getEndUser(_0x19ae4b,_0x1b70af[_0xdfd0('0x11')],_0x1b70af[_0xdfd0('0x12')]);})[_0xdfd0('0x20')](function(_0x5ac968){_0x472781=_0x5ac968;logger[_0xdfd0('0x1d')](_0xdfd0('0x45'),_0x472781['id']);return getTicket(_0x19ae4b,_0xdbf8b7,_0x472781,_0x158343,_0x1b70af);})[_0xdfd0('0x20')](function(_0x11628c){if(_0x11628c&&_0x11628c['id']){logger['info']('Ticket\x20created!');logger[_0xdfd0('0x1d')](_0xdfd0('0x46'),_0x11628c['id']);logger[_0xdfd0('0x1d')](_0xdfd0('0x47'),_0xdfd0('0x48'));emit(util[_0xdfd0('0xf')](_0xdfd0('0x49'),_0x47efaa[_0xdfd0('0x18')]),_0xdfd0('0x4a'),{'uri':util[_0xdfd0('0xf')]('%s/helpdesk/tickets/%d',_0x19ae4b[_0xdfd0('0x1c')],_0x11628c['id'])});}})[_0xdfd0('0x4b')](function(_0x521f7f){logger['error']('[QUEUE]',JSON[_0xdfd0('0x4c')](_0x521f7f));});};exports[_0xdfd0('0x4d')]=function(_0x54ac9b,_0x11a08c,_0x96b562,_0x758e3f,_0x32575c,_0x4eef57,_0x25bf2d){var _0x5e08e4,_0x40b13b;_0x4eef57[_0xdfd0('0x1c')]=intUtil['stripTrailingSlash'](_0x4eef57['remoteUri']);_0x4eef57[_0xdfd0('0x3c')]=intUtil[_0xdfd0('0x3b')](_0x4eef57[_0xdfd0('0x3c')]);if(_0x25bf2d&&_0x25bf2d[_0xdfd0('0x4e')]&&_0x25bf2d[_0xdfd0('0x4e')]!==_0xdfd0('0x4f')){logger[_0xdfd0('0x1d')](_0xdfd0('0x50'),_0xdfd0('0x3e'));_0x11a08c[_0xdfd0('0x3f')]=util[_0xdfd0('0xf')](_0xdfd0('0x40'),_0x4eef57[_0xdfd0('0x3c')],_0x11a08c[_0xdfd0('0x41')],md5(_0x11a08c[_0xdfd0('0x41')]));}headers[_0xdfd0('0x42')]=getAuth(_0x4eef57);return getUser(_0x4eef57,_0x758e3f[_0xdfd0('0x43')])[_0xdfd0('0x20')](function(_0x2f1970){_0x5e08e4=_0x2f1970;logger['info'](_0xdfd0('0x44'),_0x5e08e4['id']);return getEndUser(_0x4eef57,_0x11a08c[_0xdfd0('0x51')],_0x11a08c[_0xdfd0('0x52')]);})['then'](function(_0x522adf){_0x40b13b=_0x522adf;logger[_0xdfd0('0x1d')]('The\x20Enduser\x20ID\x20is:',_0x40b13b['id']);return getTicket(_0x4eef57,_0x5e08e4,_0x40b13b,_0x96b562,_0x11a08c);})[_0xdfd0('0x20')](function(_0x36553c){if(_0x36553c&&_0x36553c['id']){logger[_0xdfd0('0x1d')](_0xdfd0('0x1e'));logger[_0xdfd0('0x1d')]('The\x20Ticket\x20ID\x20is:',_0x36553c['id']);logger[_0xdfd0('0x1d')](_0xdfd0('0x50'),_0xdfd0('0x48'));emit(util[_0xdfd0('0xf')](_0xdfd0('0x49'),_0x758e3f[_0xdfd0('0x18')]),_0xdfd0('0x4a'),{'uri':util[_0xdfd0('0xf')](_0xdfd0('0x53'),_0x4eef57[_0xdfd0('0x1c')],_0x36553c['id'])});}})[_0xdfd0('0x4b')](function(_0x23aada){logger['error'](_0xdfd0('0x50'),JSON[_0xdfd0('0x4c')](_0x23aada));});};exports[_0xdfd0('0x54')]=function(_0x3971f9,_0x54a620,_0xf0774,_0x56daef,_0x2ed617,_0xa8770d){var _0x3f6cde,_0x250909;_0xa8770d['remoteUri']=intUtil[_0xdfd0('0x3b')](_0xa8770d[_0xdfd0('0x1c')]);_0xa8770d[_0xdfd0('0x3c')]=intUtil[_0xdfd0('0x3b')](_0xa8770d[_0xdfd0('0x3c')]);if(_0x2ed617&&_0x2ed617[_0xdfd0('0x3d')]){logger['info']('['+_0x54a620[_0xdfd0('0x55')][_0xdfd0('0x56')]()+']',_0xdfd0('0x3e'));_0x54a620[_0xdfd0('0x3f')]=util[_0xdfd0('0xf')](_0xdfd0('0x40'),_0xa8770d['serverUrl'],_0x54a620[_0xdfd0('0x41')],md5(_0x54a620[_0xdfd0('0x41')]));}else{_0x54a620[_0xdfd0('0x3f')]='';}headers[_0xdfd0('0x42')]=getAuth(_0xa8770d);return getUser(_0xa8770d,'')['then'](function(_0x4c52b2){_0x3f6cde=_0x4c52b2;logger['info'](_0xdfd0('0x44'),_0x3f6cde['id']);return getEndUser(_0xa8770d,_0x54a620['calleridname'],_0x54a620[_0xdfd0('0x12')]);})[_0xdfd0('0x20')](function(_0x11ef69){_0x250909=_0x11ef69;logger['info'](_0xdfd0('0x45'),_0x250909['id']);return getTicket(_0xa8770d,_0x3f6cde,_0x250909,_0xf0774,_0x54a620);})[_0xdfd0('0x20')](function(_0x13303e){if(_0x13303e){logger['info']('Ticket\x20created!');logger[_0xdfd0('0x1d')](_0xdfd0('0x46'),_0x13303e['id']);}})[_0xdfd0('0x4b')](function(_0x2f5122){logger[_0xdfd0('0x57')]('['+_0x54a620[_0xdfd0('0x55')]['toUpperCase']()+']',JSON[_0xdfd0('0x4c')](_0x2f5122));});}; \ No newline at end of file +var _0x3151=['redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','getString','Descriptions','
','Tags','name','Fields','custom_fields','keyBy','value','%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','validateEmail','length','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','POST','apiKey','base64','stringify','GET','map','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','toString','type','push','idField','variable','variableName','customVariable','Variable','stripTrailingSlash','serverUrl','[QUEUE]','uniqueid','recordingURL','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','destcalleridname','%s/helpdesk/tickets/%d','lastevent','toUpperCase','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','lodash','request-promise','md5','ioredis','./util'];(function(_0x2a8851,_0x3e56f3){var _0x3f3974=function(_0x181c95){while(--_0x181c95){_0x2a8851['push'](_0x2a8851['shift']());}};_0x3f3974(++_0x3e56f3);}(_0x3151,0x1a9));var _0x1315=function(_0x1a43bb,_0x17f021){_0x1a43bb=_0x1a43bb-0x0;var _0x3fbaff=_0x3151[_0x1a43bb];return _0x3fbaff;};'use strict';var _=require(_0x1315('0x0'));var rp=require(_0x1315('0x1'));var md5=require(_0x1315('0x2'));var util=require('util');var Redis=require(_0x1315('0x3'));var intUtil=require(_0x1315('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('freshdesk');config[_0x1315('0x5')]=_[_0x1315('0x6')](config[_0x1315('0x5')],{'host':_0x1315('0x7'),'port':0x18eb});var io=require(_0x1315('0x8'))(new Redis(config['redis']));var headers={'Content-Type':_0x1315('0x9'),'Accept':_0x1315('0x9')};function emit(_0x92a6a7,_0x3c89c7,_0x59e75f){io['to'](_0x92a6a7)['emit'](_0x3c89c7,_0x59e75f);}function getTicket(_0x4ad1ec,_0x157f52,_0x3fc969,_0x4a03c8,_0x4df59e){logger[_0x1315('0xa')](_0x1315('0xb'));var _0x302b8d=_[_0x1315('0xc')]({'responder_id':_0x157f52['id'],'requester_id':_0x3fc969['id'],'name':util[_0x1315('0xd')](_0x1315('0xe'),_0x4df59e['calleridname']),'phone':_0x4df59e['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x4a03c8['Subjects'],_0x4df59e,'\x20'),'description':intUtil[_0x1315('0xf')](_0x4a03c8[_0x1315('0x10')],_0x4df59e,_0x1315('0x11')),'tags':getTags(_0x4a03c8[_0x1315('0x12')],_0x1315('0x13'))},getCustomFields(_0x4a03c8[_0x1315('0x14')],_0x4df59e));_0x302b8d[_0x1315('0x15')]=_['mapValues'](_[_0x1315('0x16')](_0x302b8d[_0x1315('0x15')],'id'),_0x1315('0x17'));return request({'uri':util[_0x1315('0xd')](_0x1315('0x18'),_0x4ad1ec[_0x1315('0x19')]),'method':'POST','body':_0x302b8d})[_0x1315('0x1a')](function(_0x3b9f0f){logger[_0x1315('0xa')](_0x1315('0x1b'));return _0x3b9f0f;});}function getUser(_0x32bc53,_0x38e546){if(intUtil[_0x1315('0x1c')](_0x38e546)){return request({'uri':util['format']('%s/api/v2/agents',_0x32bc53[_0x1315('0x19')]),'qs':{'email':_0x38e546}})['then'](function(_0x5b553f){if(_0x5b553f[_0x1315('0x1d')]){logger['info'](_0x1315('0x1e'));return _[_0x1315('0x1f')](_0x5b553f,function(_0x237fd2){return _0x237fd2['contact'][_0x1315('0x20')]===_0x38e546;});}else{logger[_0x1315('0xa')](_0x1315('0x21'));return request({'uri':util[_0x1315('0xd')]('%s/api/v2/agents/me',_0x32bc53[_0x1315('0x19')])})[_0x1315('0x1a')](function(_0x173e5f){logger[_0x1315('0xa')](_0x1315('0x22'));return _0x173e5f;});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x1315('0x23'),_0x32bc53[_0x1315('0x19')])})[_0x1315('0x1a')](function(_0x5a20e9){logger[_0x1315('0xa')]('Admin\x20account\x20selected.');return _0x5a20e9;});}}function getEndUser(_0x280a33,_0x3dc4e5,_0x3b2295){logger[_0x1315('0xa')](_0x1315('0x24'),_0x3b2295);return request({'uri':util[_0x1315('0xd')](_0x1315('0x25'),_0x280a33[_0x1315('0x19')]),'qs':{'phone':_0x3b2295}})[_0x1315('0x1a')](function(_0x2151e7){if(_0x2151e7[_0x1315('0x1d')]){logger['info'](_0x1315('0x26'));return _[_0x1315('0x1f')](_0x2151e7,{'phone':_0x3b2295});}else{logger[_0x1315('0xa')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x1315('0xd')]('%s/api/v2/contacts',_0x280a33[_0x1315('0x19')]),'method':_0x1315('0x27'),'body':{'name':_0x3dc4e5,'phone':_0x3b2295}})[_0x1315('0x1a')](function(_0x55388e){logger[_0x1315('0xa')]('Enduser\x20created.');return _0x55388e;});}});}function getAuth(_0x45955b){return util[_0x1315('0xd')]('Basic\x20%s',new Buffer(_0x45955b[_0x1315('0x28')]+':X')['toString'](_0x1315('0x29')));}function request(_0x1901ee){logger['debug']('[HTTP]',JSON[_0x1315('0x2a')](_0x1901ee));return rp(_['defaults'](_0x1901ee,{'method':_0x1315('0x2b'),'headers':headers,'json':!![]}));}function getTags(_0x1c435d,_0x551986){var _0x7d6691=[];if(_0x1c435d&&_0x1c435d[_0x1315('0x1d')]>0x0){_0x7d6691=_[_0x1315('0x2c')](_0x1c435d,_0x551986);}return _0x7d6691;}function getCustomFields(_0x3a84bc,_0x3afe37){var _0x1ddeb8=[];var _0x7b4a46={'custom_fields':[]};if(_0x3a84bc['length']>0x0){_[_0x1315('0x2d')](_0x3a84bc,function(_0x4d8d8a){if(_[_0x1315('0x2e')]([_0x1315('0x2f'),_0x1315('0x30')],_0x4d8d8a['type'])&&_0x4d8d8a[_0x1315('0x31')]&&!_0x4d8d8a[_0x1315('0x32')]){_0x7b4a46[_0x4d8d8a[_0x1315('0x31')][_0x1315('0x33')]()]=_0x4d8d8a[_0x1315('0x34')][_0x1315('0x35')]();}else if(_['includes'](['string','picklist'],_0x4d8d8a[_0x1315('0x36')])&&_0x4d8d8a['idField']&&_0x4d8d8a['customField']){_0x7b4a46[_0x1315('0x15')][_0x1315('0x37')]({'id':_0x4d8d8a[_0x1315('0x38')],'value':_0x4d8d8a[_0x1315('0x34')][_0x1315('0x35')]()});}else if(_0x4d8d8a[_0x1315('0x36')]===_0x1315('0x39')&&_0x4d8d8a[_0x1315('0x3a')]&&_0x4d8d8a[_0x1315('0x38')]&&_0x4d8d8a[_0x1315('0x32')]){_0x3afe37[_0x4d8d8a[_0x1315('0x3a')]]&&_0x7b4a46[_0x1315('0x15')]['push']({'id':_0x4d8d8a[_0x1315('0x38')],'value':_0x3afe37[_0x4d8d8a['variableName']][_0x1315('0x35')]()});}else if(_0x4d8d8a[_0x1315('0x36')]===_0x1315('0x3b')&&_0x4d8d8a['Variable']&&_0x4d8d8a['Variable'][_0x1315('0x13')]&&_0x4d8d8a[_0x1315('0x38')]&&_0x4d8d8a[_0x1315('0x32')]){_0x3afe37[_0x4d8d8a[_0x1315('0x3c')]['name'][_0x1315('0x33')]()]&&_0x7b4a46[_0x1315('0x15')][_0x1315('0x37')]({'id':_0x4d8d8a[_0x1315('0x38')],'value':_0x3afe37[_0x4d8d8a[_0x1315('0x3c')]['name']['toLowerCase']()][_0x1315('0x35')]()});}});}return _0x7b4a46;}exports['queue']=function(_0x5cf414,_0x1c9e94,_0x1c19ee,_0x4ca311,_0x16fb0f,_0x145beb){var _0x20d186,_0x5867cc;_0x145beb[_0x1315('0x19')]=intUtil[_0x1315('0x3d')](_0x145beb[_0x1315('0x19')]);_0x145beb[_0x1315('0x3e')]=intUtil[_0x1315('0x3d')](_0x145beb[_0x1315('0x3e')]);if(_0x16fb0f&&_0x16fb0f['monitor_format']){logger[_0x1315('0xa')](_0x1315('0x3f'),'Recording\x20is\x20enabled!');_0x1c9e94['recordingURL']=util[_0x1315('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x145beb[_0x1315('0x3e')],_0x1c9e94[_0x1315('0x40')],md5(_0x1c9e94[_0x1315('0x40')]));}else{_0x1c9e94[_0x1315('0x41')]='';}headers['Authorization']=getAuth(_0x145beb);return getUser(_0x145beb,_0x4ca311[_0x1315('0x20')])['then'](function(_0x207a0a){_0x20d186=_0x207a0a;logger['info']('The\x20User\x20ID\x20is:',_0x20d186['id']);return getEndUser(_0x145beb,_0x1c9e94[_0x1315('0x42')],_0x1c9e94[_0x1315('0x43')]);})[_0x1315('0x1a')](function(_0x112614){_0x5867cc=_0x112614;logger['info'](_0x1315('0x44'),_0x5867cc['id']);return getTicket(_0x145beb,_0x20d186,_0x5867cc,_0x1c19ee,_0x1c9e94);})['then'](function(_0xa05e7f){if(_0xa05e7f&&_0xa05e7f['id']){logger['info'](_0x1315('0x1b'));logger[_0x1315('0xa')](_0x1315('0x45'),_0xa05e7f['id']);logger[_0x1315('0xa')](_0x1315('0x3f'),_0x1315('0x46'));emit(util[_0x1315('0xd')](_0x1315('0x47'),_0x4ca311[_0x1315('0x13')]),_0x1315('0x48'),{'uri':util[_0x1315('0xd')]('%s/helpdesk/tickets/%d',_0x145beb['remoteUri'],_0xa05e7f['id'])});}})[_0x1315('0x49')](function(_0x180510){logger[_0x1315('0x4a')](_0x1315('0x3f'),JSON[_0x1315('0x2a')](_0x180510));});};exports[_0x1315('0x4b')]=function(_0x25fa27,_0x156b10,_0xa342af,_0xae5ce1,_0x2eaf15,_0x50254f,_0x3e47f6){var _0x4aa8a3,_0x2f8baf;_0x50254f[_0x1315('0x19')]=intUtil[_0x1315('0x3d')](_0x50254f[_0x1315('0x19')]);_0x50254f[_0x1315('0x3e')]=intUtil[_0x1315('0x3d')](_0x50254f[_0x1315('0x3e')]);if(_0x3e47f6&&_0x3e47f6[_0x1315('0x4c')]&&_0x3e47f6[_0x1315('0x4c')]!=='none'){logger[_0x1315('0xa')](_0x1315('0x4d'),'Recording\x20is\x20enabled!');_0x156b10['recordingURL']=util[_0x1315('0xd')](_0x1315('0x4e'),_0x50254f[_0x1315('0x3e')],_0x156b10[_0x1315('0x40')],md5(_0x156b10[_0x1315('0x40')]));}headers[_0x1315('0x4f')]=getAuth(_0x50254f);return getUser(_0x50254f,_0xae5ce1['email'])['then'](function(_0x4ed53a){_0x4aa8a3=_0x4ed53a;logger[_0x1315('0xa')]('The\x20User\x20ID\x20is:',_0x4aa8a3['id']);return getEndUser(_0x50254f,_0x156b10[_0x1315('0x50')],_0x156b10['destcalleridnum']);})[_0x1315('0x1a')](function(_0x602c66){_0x2f8baf=_0x602c66;logger[_0x1315('0xa')](_0x1315('0x44'),_0x2f8baf['id']);return getTicket(_0x50254f,_0x4aa8a3,_0x2f8baf,_0xa342af,_0x156b10);})[_0x1315('0x1a')](function(_0x496544){if(_0x496544&&_0x496544['id']){logger['info'](_0x1315('0x1b'));logger[_0x1315('0xa')](_0x1315('0x45'),_0x496544['id']);logger['info']('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0xae5ce1['name']),'trigger:browser:url',{'uri':util[_0x1315('0xd')](_0x1315('0x51'),_0x50254f[_0x1315('0x19')],_0x496544['id'])});}})[_0x1315('0x49')](function(_0x1b5500){logger[_0x1315('0x4a')](_0x1315('0x4d'),JSON[_0x1315('0x2a')](_0x1b5500));});};exports['unmanaged']=function(_0x4448de,_0x28cb55,_0x196ebb,_0xa4c195,_0x3e2fec,_0x258be9){var _0x6ed6dc,_0x4882e6;_0x258be9['remoteUri']=intUtil[_0x1315('0x3d')](_0x258be9[_0x1315('0x19')]);_0x258be9[_0x1315('0x3e')]=intUtil[_0x1315('0x3d')](_0x258be9['serverUrl']);if(_0x3e2fec&&_0x3e2fec['monitor_format']){logger[_0x1315('0xa')]('['+_0x28cb55[_0x1315('0x52')][_0x1315('0x53')]()+']',_0x1315('0x54'));_0x28cb55[_0x1315('0x41')]=util[_0x1315('0xd')](_0x1315('0x4e'),_0x258be9[_0x1315('0x3e')],_0x28cb55['uniqueid'],md5(_0x28cb55[_0x1315('0x40')]));}else{_0x28cb55[_0x1315('0x41')]='';}headers[_0x1315('0x4f')]=getAuth(_0x258be9);return getUser(_0x258be9,'')[_0x1315('0x1a')](function(_0x1a7ba0){_0x6ed6dc=_0x1a7ba0;logger[_0x1315('0xa')](_0x1315('0x55'),_0x6ed6dc['id']);return getEndUser(_0x258be9,_0x28cb55['calleridname'],_0x28cb55[_0x1315('0x43')]);})[_0x1315('0x1a')](function(_0x9e2c8d){_0x4882e6=_0x9e2c8d;logger[_0x1315('0xa')](_0x1315('0x44'),_0x4882e6['id']);return getTicket(_0x258be9,_0x6ed6dc,_0x4882e6,_0x196ebb,_0x28cb55);})['then'](function(_0x415e7b){if(_0x415e7b){logger[_0x1315('0xa')](_0x1315('0x1b'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x415e7b['id']);}})[_0x1315('0x49')](function(_0x253338){logger[_0x1315('0x4a')]('['+_0x28cb55[_0x1315('0x52')][_0x1315('0x53')]()+']',JSON[_0x1315('0x2a')](_0x253338));});}; \ 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 9167812..cd50e50 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 _0xa889=['recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','inspect','lodash','request-promise','md5','moment','bluebird','ioredis','./util','redis','defaults','localhost','GET','headers','info','Getting\x20admin\x20information','then','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','Getting\x20user\x20list','users','agentEmail','Getting\x20user\x20with\x20email','userId','User\x20found:','Admin\x20selected','userEmail','catch','/api/lookup?q=','&f=','&entities=contact','find','format','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','work_number','endUserId','Contact\x20created:','POST','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','Subjects','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','task','Task\x20created:','user:%s','emit','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','username','toLowerCase','outbound','queue','uniqueid','monitor_format','[QUEUE]','recordingURL'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa889,0xa3));var _0x9a88=function(_0x450442,_0x4a8fc1){_0x450442=_0x450442-0x0;var _0x287b29=_0xa889[_0x450442];return _0x287b29;};'use strict';var _=require(_0x9a88('0x0'));var rp=require(_0x9a88('0x1'));var md5=require(_0x9a88('0x2'));var util=require('util');var moment=require(_0x9a88('0x3'));var Promise=require(_0x9a88('0x4'));var Redis=require(_0x9a88('0x5'));var intUtil=require(_0x9a88('0x6'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('freshsales');config[_0x9a88('0x7')]=_[_0x9a88('0x8')](config['redis'],{'host':_0x9a88('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9a88('0x7')]));function getAdminId(_0x38a962,_0x1897b3,_0x428746,_0x333977){return new Promise(function(_0x158ca3,_0x2f62ec){var _0x25bae6=![];var _0x373a6d={'method':_0x9a88('0xa'),'uri':_0x333977+'/api/selector/owners','json':!![]};_0x373a6d[_0x9a88('0xb')]=_0x428746;logger[_0x9a88('0xc')](_0x9a88('0xd'));return rp(_0x373a6d)[_0x9a88('0xe')](function(_0x4bdbce){if(_0x4bdbce){var _0x280951=_0x4bdbce['users'];var _0x3f96da=null;for(_0x3f96da=0x0;_0x3f96da<_0x280951[_0x9a88('0xf')];_0x3f96da++){if(_0x280951[_0x3f96da][_0x9a88('0x10')]===_0x38a962[_0x9a88('0x11')]){_0x38a962[_0x9a88('0x12')]=_0x280951[_0x3f96da]['id'];_0x25bae6=!![];}}if(_0x25bae6){logger['info'](_0x9a88('0x13'),_0x38a962['adminId']);_0x158ca3(_0x38a962);}else{_0x2f62ec({'statusCode':0x194,'message':_0x9a88('0x14')});}}else{_0x2f62ec({'statusCode':0x194,'message':_0x9a88('0x14')});}})['catch'](function(_0x2e3843){logger[_0x9a88('0x15')]('['+[_0x1897b3[_0x9a88('0x16')]()]+']',_0x2e3843[_0x9a88('0x17')]);_0x2f62ec(_0x2e3843);});});}function getUser(_0x37af17,_0xcfa282,_0x114dac){return function(_0x5b3a41){return new Promise(function(_0x2eab4a,_0x4b5ae5){var _0x1f7676={'method':'GET','uri':_0x114dac+'/api/selector/owners','json':!![]};_0x1f7676[_0x9a88('0xb')]=_0xcfa282;logger['info'](_0x9a88('0x18'));return rp(_0x1f7676)['then'](function(_0x107cde){if(_0x107cde){var _0x2ae137=_0x107cde[_0x9a88('0x19')];var _0x31ec77=![];var _0x54b5f7=null;if(_0x5b3a41[_0x9a88('0x1a')]!==null){logger[_0x9a88('0xc')](_0x9a88('0x1b'),_0x5b3a41[_0x9a88('0x1a')]);_0x5b3a41['userEmail']=_0x5b3a41['agentEmail'];for(_0x54b5f7=0x0;_0x54b5f7<_0x2ae137[_0x9a88('0xf')];_0x54b5f7++){if(_0x2ae137[_0x54b5f7][_0x9a88('0x10')]===_0x5b3a41[_0x9a88('0x1a')]){_0x31ec77=!![];_0x5b3a41[_0x9a88('0x1c')]=_0x2ae137[_0x54b5f7]['id'];logger[_0x9a88('0xc')](_0x9a88('0x1d'),_0x5b3a41['userId']);}}}if(!_0x31ec77){logger[_0x9a88('0xc')](_0x9a88('0x1e'));_0x5b3a41[_0x9a88('0x1f')]=_0x5b3a41[_0x9a88('0x11')];_0x5b3a41[_0x9a88('0x1c')]=_0x5b3a41[_0x9a88('0x12')];_0x31ec77=!![];}if(_0x31ec77){_0x2eab4a(_0x5b3a41);}else{_0x4b5ae5({'statusCode':0x194,'message':_0x9a88('0x14')});}}else{_0x4b5ae5({'statusCode':0x194,'message':_0x9a88('0x14')});}})[_0x9a88('0x20')](function(_0xd4c903){logger['error']('['+[_0x37af17[_0x9a88('0x16')]()]+']',_0xd4c903['message']);_0x4b5ae5(_0xd4c903);});});};}function searchContact(_0x25ee53,_0xbfec8c,_0x36393e,_0x582e88){return new Promise(function(_0x11c96a,_0x34b8a3){var _0x332fa5={'method':_0x9a88('0xa'),'headers':_0xbfec8c,'uri':_0x25ee53+_0x9a88('0x21')+_0x582e88+_0x9a88('0x22')+_0x36393e+_0x9a88('0x23'),'json':!![]};rp(_0x332fa5)[_0x9a88('0xe')](function(_0x49db0d){var _0x50e81c=_[_0x9a88('0x24')](_0x49db0d['contacts']['contacts'],[_0x36393e,_0x582e88]);_0x11c96a(_0x50e81c);})['catch'](function(_0x5a252a){_0x34b8a3(_0x5a252a);});});}function getEndUser(_0x469b6d,_0x483da0,_0xa76ced){return function(_0x531e89){return new Promise(function(_0x18f041,_0x2ce78c){logger[_0x9a88('0xc')](util[_0x9a88('0x25')]('Searching\x20contact\x20with\x20phone\x20%s',_0x531e89[_0x9a88('0x26')]));searchContact(_0xa76ced,_0x483da0,_0x9a88('0x27'),_0x531e89[_0x9a88('0x26')])[_0x9a88('0xe')](function(_0x38b066){if(_0x38b066){_0x531e89['endUserId']=_0x38b066['id'];logger[_0x9a88('0xc')](_0x9a88('0x28'),_0x531e89['endUserId']);return _0x18f041(_0x531e89);}searchContact(_0xa76ced,_0x483da0,_0x9a88('0x29'),_0x531e89[_0x9a88('0x26')])[_0x9a88('0xe')](function(_0xe8d933){if(_0xe8d933){_0x531e89[_0x9a88('0x2a')]=_0xe8d933['id'];logger['info']('Contact\x20found\x20work_number:',_0x531e89[_0x9a88('0x2a')]);return _0x18f041(_0x531e89);}createEndUser(_0x531e89,_0x469b6d,_0x483da0,_0xa76ced)[_0x9a88('0xe')](function(_0x1ff32f){logger[_0x9a88('0xc')](_0x9a88('0x2b'),_0x1ff32f['endUserId']);return _0x18f041(_0x1ff32f);});});})[_0x9a88('0x20')](function(_0x3ba3e7){_0x2ce78c(_0x3ba3e7);});});};}function createEndUser(_0x5de7f9,_0x2df4b0,_0x372e3a,_0x2254e6){return new Promise(function(_0x10db6e,_0x766112){var _0x5af846=moment();var _0x32fa62={'method':_0x9a88('0x2c'),'uri':_0x2254e6+_0x9a88('0x2d'),'body':{'contact':{'last_name':_0x5de7f9[_0x9a88('0x26')],'work_number':_0x5de7f9['contactNumber'],'mobile_number':_0x5de7f9[_0x9a88('0x26')],'owner_id':_0x5de7f9[_0x9a88('0x1c')],'created_at':_0x5af846[_0x9a88('0x25')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x32fa62[_0x9a88('0xb')]=_0x372e3a;logger[_0x9a88('0xc')](_0x9a88('0x2e'));return rp(_0x32fa62)[_0x9a88('0xe')](function(_0x5b404c){_0x5de7f9[_0x9a88('0x2a')]=_0x5b404c[_0x9a88('0x2f')]['id'];_0x10db6e(_0x5de7f9);})['catch'](function(_0x3e90e6){logger['error']('['+[_0x2df4b0[_0x9a88('0x16')]()]+']',_0x3e90e6[_0x9a88('0x17')]);_0x766112(_0x3e90e6[_0x9a88('0x17')]);});});}function getTicket(_0x33c863,_0xfb8529,_0x2a7bb5,_0x4da841,_0x3a6943){return function(_0x46f355){logger['info'](_0x9a88('0x30'));return new Promise(function(_0x29ab4c,_0xbbaf6){var _0x352be1=moment();var _0x14ccec={'method':_0x9a88('0x2c'),'uri':_0x2a7bb5+_0x9a88('0x31'),'body':{'title':intUtil['getString'](_0x4da841[_0x9a88('0x32')],_0x3a6943,'\x20'),'description':intUtil['getString'](_0x4da841[_0x9a88('0x33')],_0x3a6943,'\x0a'),'owner_id':_0x46f355['userId'],'creater_id':_0x46f355['adminId'],'targetable_id':_0x46f355['endUserId'],'targetable_type':_0x9a88('0x34'),'created_at':_0x352be1[_0x9a88('0x25')](_0x9a88('0x35')),'due_date':_0x352be1[_0x9a88('0x36')](0x1e,'m')[_0x9a88('0x25')](_0x9a88('0x35'))},'json':!![]};_0x14ccec[_0x9a88('0xb')]=_0xfb8529;return rp(_0x14ccec)[_0x9a88('0xe')](function(_0x2d225d){_0x46f355['ticketId']=_0x2d225d[_0x9a88('0x37')]['id'];logger[_0x9a88('0xc')](_0x9a88('0x38'),_0x46f355['ticketId']);_0x29ab4c(_0x46f355);})[_0x9a88('0x20')](function(_0x54436f){logger[_0x9a88('0x15')]('['+[_0x33c863[_0x9a88('0x16')]()]+']',_0x54436f[_0x9a88('0x17')]);_0xbbaf6(_0x54436f['message']);});});};}function emit(_0x31d39e,_0x5c525e,_0x19be7c){var _0x15061e={'uri':_0x31d39e+'/contacts/'+_0x19be7c};io['to'](util[_0x9a88('0x25')](_0x9a88('0x39'),_0x5c525e))[_0x9a88('0x3a')](_0x9a88('0x3b'),_0x15061e);}exports['cs']=function(_0x41b488,_0x4dc86c,_0x130b39,_0x3de59a,_0x482109,_0xf671f8,_0x33e456,_0x1a1a5d){var _0x202d20={};var _0x210272={'Authorization':_0x9a88('0x3c')+_0xf671f8['apiKey']};_0xf671f8[_0x9a88('0x3d')]=intUtil[_0x9a88('0x3e')](_0xf671f8['remoteUri']);_0xf671f8['serverUrl']=intUtil[_0x9a88('0x3e')](_0xf671f8['serverUrl']);var _0x15298b=_0xf671f8[_0x9a88('0x3d')];_0x202d20[_0x9a88('0x11')]=_0xf671f8[_0x9a88('0x3f')];_0x202d20['contactNumber']=_0x1a1a5d[_0x9a88('0x40')]()===_0x9a88('0x41')?_0x4dc86c['destcalleridnum']:_0x4dc86c['calleridnum'];_0x202d20['callDirection']=_0x1a1a5d===_0x9a88('0x42')||_0x1a1a5d==='unmanaged'?_0x9a88('0x42'):_0x9a88('0x41');if(_0x3de59a){_0x202d20[_0x9a88('0x1a')]=_0x3de59a['email'];}var _0x2e6665=util[_0x9a88('0x25')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xf671f8['serverUrl'],_0x4dc86c[_0x9a88('0x43')],md5(_0x4dc86c[_0x9a88('0x43')]));if(_0x482109&&_0x482109[_0x9a88('0x44')]){logger[_0x9a88('0xc')](_0x9a88('0x45'),'Recording\x20is\x20enabled!');_0x4dc86c[_0x9a88('0x46')]=_0x2e6665;}else if(_0x33e456&&_0x33e456[_0x9a88('0x47')]&&_0x33e456[_0x9a88('0x47')]!==_0x9a88('0x48')){logger[_0x9a88('0xc')](_0x9a88('0x49'),_0x9a88('0x4a'));_0x4dc86c[_0x9a88('0x46')]=_0x2e6665;}else{_0x4dc86c[_0x9a88('0x46')]='';}return getAdminId(_0x202d20,_0x1a1a5d,_0x210272,_0x15298b)[_0x9a88('0xe')](getUser(_0x1a1a5d,_0x210272,_0x15298b))[_0x9a88('0xe')](getEndUser(_0x1a1a5d,_0x210272,_0x15298b))[_0x9a88('0xe')](getTicket(_0x1a1a5d,_0x210272,_0x15298b,_0x130b39,_0x4dc86c))[_0x9a88('0xe')](function(_0x29a206){logger[_0x9a88('0xc')](util[_0x9a88('0x25')](_0x9a88('0x4b'),_0x29a206['ticketId']));if(_0x1a1a5d!==_0x9a88('0x4c')){logger[_0x9a88('0xc')]('['+[_0x1a1a5d[_0x9a88('0x16')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x15298b,_0x3de59a['name'],_0x29a206[_0x9a88('0x2a')]);}})['catch'](function(_0x272af8){logger[_0x9a88('0x15')]('['+[_0x1a1a5d['toUpperCase']()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x9a88('0x4d')](_0x272af8,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xf9e4=['The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','../../../../config/environment','../../../../config/logger','freshsales','defaults','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','then','users','length','email','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','/api/lookup?q=','find','contacts','format','contactNumber','mobile_number','endUserId','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','contact','message','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','adminId','Contact','task','Task\x20created:','ticketId','emit','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','adminEmail','username','toLowerCase','destcalleridnum','calleridnum','queue','unmanaged','outbound','uniqueid','monitor_format','[QUEUE]','recordingFormat','none','Recording\x20is\x20enabled!','recordingURL'];(function(_0x245f64,_0x4ae342){var _0x3447e0=function(_0x17d0c5){while(--_0x17d0c5){_0x245f64['push'](_0x245f64['shift']());}};_0x3447e0(++_0x4ae342);}(_0xf9e4,0x1a4));var _0x4f9e=function(_0x2c20a1,_0x381b48){_0x2c20a1=_0x2c20a1-0x0;var _0x2d684a=_0xf9e4[_0x2c20a1];return _0x2d684a;};'use strict';var _=require(_0x4f9e('0x0'));var rp=require(_0x4f9e('0x1'));var md5=require(_0x4f9e('0x2'));var util=require(_0x4f9e('0x3'));var moment=require(_0x4f9e('0x4'));var Promise=require(_0x4f9e('0x5'));var Redis=require(_0x4f9e('0x6'));var intUtil=require('./util');var config=require(_0x4f9e('0x7'));var logger=require(_0x4f9e('0x8'))(_0x4f9e('0x9'));config['redis']=_[_0x4f9e('0xa')](config[_0x4f9e('0xb')],{'host':_0x4f9e('0xc'),'port':0x18eb});var io=require(_0x4f9e('0xd'))(new Redis(config['redis']));function getAdminId(_0x3ecc6d,_0x3f25f1,_0x2fa74f,_0x2202c8){return new Promise(function(_0x585e93,_0x33b4c1){var _0x42f8aa=![];var _0x45ab9f={'method':_0x4f9e('0xe'),'uri':_0x2202c8+_0x4f9e('0xf'),'json':!![]};_0x45ab9f[_0x4f9e('0x10')]=_0x2fa74f;logger[_0x4f9e('0x11')]('Getting\x20admin\x20information');return rp(_0x45ab9f)[_0x4f9e('0x12')](function(_0x327e51){if(_0x327e51){var _0xfae6c1=_0x327e51[_0x4f9e('0x13')];var _0x317fa0=null;for(_0x317fa0=0x0;_0x317fa0<_0xfae6c1[_0x4f9e('0x14')];_0x317fa0++){if(_0xfae6c1[_0x317fa0][_0x4f9e('0x15')]===_0x3ecc6d['adminEmail']){_0x3ecc6d['adminId']=_0xfae6c1[_0x317fa0]['id'];_0x42f8aa=!![];}}if(_0x42f8aa){logger['info']('Admin\x20found:',_0x3ecc6d['adminId']);_0x585e93(_0x3ecc6d);}else{_0x33b4c1({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x33b4c1({'statusCode':0x194,'message':_0x4f9e('0x16')});}})[_0x4f9e('0x17')](function(_0x1b4eaa){logger[_0x4f9e('0x18')]('['+[_0x3f25f1[_0x4f9e('0x19')]()]+']',_0x1b4eaa['message']);_0x33b4c1(_0x1b4eaa);});});}function getUser(_0x474a70,_0x4260ee,_0x535501){return function(_0x4629a7){return new Promise(function(_0x1508cd,_0x45d7aa){var _0x111fa1={'method':_0x4f9e('0xe'),'uri':_0x535501+_0x4f9e('0xf'),'json':!![]};_0x111fa1['headers']=_0x4260ee;logger[_0x4f9e('0x11')](_0x4f9e('0x1a'));return rp(_0x111fa1)[_0x4f9e('0x12')](function(_0xed06fb){if(_0xed06fb){var _0x245700=_0xed06fb[_0x4f9e('0x13')];var _0x137a9b=![];var _0x4d83c0=null;if(_0x4629a7[_0x4f9e('0x1b')]!==null){logger[_0x4f9e('0x11')](_0x4f9e('0x1c'),_0x4629a7['agentEmail']);_0x4629a7[_0x4f9e('0x1d')]=_0x4629a7[_0x4f9e('0x1b')];for(_0x4d83c0=0x0;_0x4d83c0<_0x245700[_0x4f9e('0x14')];_0x4d83c0++){if(_0x245700[_0x4d83c0]['email']===_0x4629a7[_0x4f9e('0x1b')]){_0x137a9b=!![];_0x4629a7[_0x4f9e('0x1e')]=_0x245700[_0x4d83c0]['id'];logger[_0x4f9e('0x11')](_0x4f9e('0x1f'),_0x4629a7[_0x4f9e('0x1e')]);}}}if(!_0x137a9b){logger['info'](_0x4f9e('0x20'));_0x4629a7[_0x4f9e('0x1d')]=_0x4629a7['adminEmail'];_0x4629a7[_0x4f9e('0x1e')]=_0x4629a7['adminId'];_0x137a9b=!![];}if(_0x137a9b){_0x1508cd(_0x4629a7);}else{_0x45d7aa({'statusCode':0x194,'message':_0x4f9e('0x16')});}}else{_0x45d7aa({'statusCode':0x194,'message':_0x4f9e('0x16')});}})['catch'](function(_0x33fed6){logger[_0x4f9e('0x18')]('['+[_0x474a70[_0x4f9e('0x19')]()]+']',_0x33fed6['message']);_0x45d7aa(_0x33fed6);});});};}function searchContact(_0x24f07a,_0x40f1e6,_0x5c2030,_0x4b9fab){return new Promise(function(_0x509207,_0x3082b2){var _0x3a5ff4={'method':'GET','headers':_0x40f1e6,'uri':_0x24f07a+_0x4f9e('0x21')+_0x4b9fab+'&f='+_0x5c2030+'&entities=contact','json':!![]};rp(_0x3a5ff4)['then'](function(_0x250f97){var _0x374941=_[_0x4f9e('0x22')](_0x250f97[_0x4f9e('0x23')][_0x4f9e('0x23')],[_0x5c2030,_0x4b9fab]);_0x509207(_0x374941);})[_0x4f9e('0x17')](function(_0x5becb5){_0x3082b2(_0x5becb5);});});}function getEndUser(_0x3b56b6,_0x5e9652,_0x28fd37){return function(_0x15928a){return new Promise(function(_0x4024c8,_0x22dc33){logger['info'](util[_0x4f9e('0x24')]('Searching\x20contact\x20with\x20phone\x20%s',_0x15928a[_0x4f9e('0x25')]));searchContact(_0x28fd37,_0x5e9652,_0x4f9e('0x26'),_0x15928a[_0x4f9e('0x25')])[_0x4f9e('0x12')](function(_0x4a3e5f){if(_0x4a3e5f){_0x15928a[_0x4f9e('0x27')]=_0x4a3e5f['id'];logger[_0x4f9e('0x11')]('Contact\x20found\x20mobile_number:',_0x15928a[_0x4f9e('0x27')]);return _0x4024c8(_0x15928a);}searchContact(_0x28fd37,_0x5e9652,'work_number',_0x15928a[_0x4f9e('0x25')])[_0x4f9e('0x12')](function(_0x22e095){if(_0x22e095){_0x15928a['endUserId']=_0x22e095['id'];logger[_0x4f9e('0x11')](_0x4f9e('0x28'),_0x15928a[_0x4f9e('0x27')]);return _0x4024c8(_0x15928a);}createEndUser(_0x15928a,_0x3b56b6,_0x5e9652,_0x28fd37)[_0x4f9e('0x12')](function(_0x13f5fc){logger[_0x4f9e('0x11')](_0x4f9e('0x29'),_0x13f5fc[_0x4f9e('0x27')]);return _0x4024c8(_0x13f5fc);});});})[_0x4f9e('0x17')](function(_0x3db93e){_0x22dc33(_0x3db93e);});});};}function createEndUser(_0x5b1165,_0x1300e3,_0x1a6dd2,_0x39295b){return new Promise(function(_0x5335de,_0x502da9){var _0x3b1aea=moment();var _0x3c5507={'method':_0x4f9e('0x2a'),'uri':_0x39295b+_0x4f9e('0x2b'),'body':{'contact':{'last_name':_0x5b1165[_0x4f9e('0x25')],'work_number':_0x5b1165['contactNumber'],'mobile_number':_0x5b1165[_0x4f9e('0x25')],'owner_id':_0x5b1165[_0x4f9e('0x1e')],'created_at':_0x3b1aea[_0x4f9e('0x24')](_0x4f9e('0x2c'))}},'json':!![]};_0x3c5507['headers']=_0x1a6dd2;logger['info']('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x3c5507)[_0x4f9e('0x12')](function(_0x1b734e){_0x5b1165[_0x4f9e('0x27')]=_0x1b734e[_0x4f9e('0x2d')]['id'];_0x5335de(_0x5b1165);})['catch'](function(_0x3afe05){logger[_0x4f9e('0x18')]('['+[_0x1300e3['toUpperCase']()]+']',_0x3afe05[_0x4f9e('0x2e')]);_0x502da9(_0x3afe05['message']);});});}function getTicket(_0x3e2883,_0x12d37e,_0x26cc37,_0x538d3c,_0x1cdf25){return function(_0x1b3372){logger[_0x4f9e('0x11')](_0x4f9e('0x2f'));return new Promise(function(_0x414979,_0x4e12ee){var _0x1c7ede=moment();var _0x4d621c={'method':'POST','uri':_0x26cc37+_0x4f9e('0x30'),'body':{'title':intUtil[_0x4f9e('0x31')](_0x538d3c[_0x4f9e('0x32')],_0x1cdf25,'\x20'),'description':intUtil[_0x4f9e('0x31')](_0x538d3c[_0x4f9e('0x33')],_0x1cdf25,'\x0a'),'owner_id':_0x1b3372[_0x4f9e('0x1e')],'creater_id':_0x1b3372[_0x4f9e('0x34')],'targetable_id':_0x1b3372[_0x4f9e('0x27')],'targetable_type':_0x4f9e('0x35'),'created_at':_0x1c7ede['format'](_0x4f9e('0x2c')),'due_date':_0x1c7ede['add'](0x1e,'m')[_0x4f9e('0x24')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x4d621c[_0x4f9e('0x10')]=_0x12d37e;return rp(_0x4d621c)['then'](function(_0x2f0c04){_0x1b3372['ticketId']=_0x2f0c04[_0x4f9e('0x36')]['id'];logger[_0x4f9e('0x11')](_0x4f9e('0x37'),_0x1b3372[_0x4f9e('0x38')]);_0x414979(_0x1b3372);})[_0x4f9e('0x17')](function(_0x28b815){logger[_0x4f9e('0x18')]('['+[_0x3e2883['toUpperCase']()]+']',_0x28b815[_0x4f9e('0x2e')]);_0x4e12ee(_0x28b815[_0x4f9e('0x2e')]);});});};}function emit(_0x1d21a3,_0x22e2b0,_0x137fcf){var _0x500da0={'uri':_0x1d21a3+'/contacts/'+_0x137fcf};io['to'](util[_0x4f9e('0x24')]('user:%s',_0x22e2b0))[_0x4f9e('0x39')]('trigger:browser:url',_0x500da0);}exports['cs']=function(_0x48384a,_0x2006cc,_0x1b00a0,_0x1c80e2,_0x1b1503,_0x1a4dc8,_0xbc97f6,_0x34b94e){var _0x2fe7c5={};var _0x8a42ed={'Authorization':_0x4f9e('0x3a')+_0x1a4dc8[_0x4f9e('0x3b')]};_0x1a4dc8['remoteUri']=intUtil[_0x4f9e('0x3c')](_0x1a4dc8[_0x4f9e('0x3d')]);_0x1a4dc8[_0x4f9e('0x3e')]=intUtil[_0x4f9e('0x3c')](_0x1a4dc8[_0x4f9e('0x3e')]);var _0x298562=_0x1a4dc8[_0x4f9e('0x3d')];_0x2fe7c5[_0x4f9e('0x3f')]=_0x1a4dc8[_0x4f9e('0x40')];_0x2fe7c5[_0x4f9e('0x25')]=_0x34b94e[_0x4f9e('0x41')]()==='outbound'?_0x2006cc[_0x4f9e('0x42')]:_0x2006cc[_0x4f9e('0x43')];_0x2fe7c5['callDirection']=_0x34b94e===_0x4f9e('0x44')||_0x34b94e===_0x4f9e('0x45')?_0x4f9e('0x44'):_0x4f9e('0x46');if(_0x1c80e2){_0x2fe7c5['agentEmail']=_0x1c80e2[_0x4f9e('0x15')];}var _0x3fee3f=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1a4dc8[_0x4f9e('0x3e')],_0x2006cc[_0x4f9e('0x47')],md5(_0x2006cc[_0x4f9e('0x47')]));if(_0x1b1503&&_0x1b1503[_0x4f9e('0x48')]){logger[_0x4f9e('0x11')](_0x4f9e('0x49'),'Recording\x20is\x20enabled!');_0x2006cc['recordingURL']=_0x3fee3f;}else if(_0xbc97f6&&_0xbc97f6[_0x4f9e('0x4a')]&&_0xbc97f6['recordingFormat']!==_0x4f9e('0x4b')){logger[_0x4f9e('0x11')]('[OUTBOUND]',_0x4f9e('0x4c'));_0x2006cc['recordingURL']=_0x3fee3f;}else{_0x2006cc[_0x4f9e('0x4d')]='';}return getAdminId(_0x2fe7c5,_0x34b94e,_0x8a42ed,_0x298562)['then'](getUser(_0x34b94e,_0x8a42ed,_0x298562))['then'](getEndUser(_0x34b94e,_0x8a42ed,_0x298562))[_0x4f9e('0x12')](getTicket(_0x34b94e,_0x8a42ed,_0x298562,_0x1b00a0,_0x2006cc))[_0x4f9e('0x12')](function(_0x76ad4c){logger['info'](util[_0x4f9e('0x24')](_0x4f9e('0x4e'),_0x76ad4c[_0x4f9e('0x38')]));if(_0x34b94e!==_0x4f9e('0x45')){logger[_0x4f9e('0x11')]('['+[_0x34b94e[_0x4f9e('0x19')]()]+']',_0x4f9e('0x4f'));emit(_0x298562,_0x1c80e2[_0x4f9e('0x50')],_0x76ad4c[_0x4f9e('0x27')]);}})[_0x4f9e('0x17')](function(_0x146e63){logger[_0x4f9e('0x18')]('['+[_0x34b94e[_0x4f9e('0x19')]()]+_0x4f9e('0x51'),util[_0x4f9e('0x52')](_0x146e63,{'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 e87030f..66b79d0 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 _0x7f54=['EVENT\x20UNKNOWN','unmanaged','toLowerCase','zendesk','freshdesk','desk','unknown\x20integration','../../../../config/logger','format','[EXEC]','%s\x20account\x20#%s\x20not\x20found','error','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./dynamics365','salesforce','sugarcrm','zoho','vtiger','dynamics365','freshsales','servicenow','data1','data2','find','Configurations','data3','queue','log'];(function(_0x43777c,_0x2f3033){var _0x8817f4=function(_0x37ff2c){while(--_0x37ff2c){_0x43777c['push'](_0x43777c['shift']());}};_0x8817f4(++_0x2f3033);}(_0x7f54,0x16a));var _0x47f5=function(_0x459b74,_0x5773bd){_0x459b74=_0x459b74-0x0;var _0x46cb16=_0x7f54[_0x459b74];return _0x46cb16;};'use strict';var _=require(_0x47f5('0x0'));var util=require(_0x47f5('0x1'));var zendesk=require(_0x47f5('0x2'));var salesforce=require(_0x47f5('0x3'));var sugarcrm=require(_0x47f5('0x4'));var freshdesk=require(_0x47f5('0x5'));var zoho=require(_0x47f5('0x6'));var desk=require(_0x47f5('0x7'));var vtiger=require('./vtiger');var servicenow=require('./servicenow');var dynamics365=require(_0x47f5('0x8'));var freshsales=require('./freshsales');var integrations=['zendesk',_0x47f5('0x9'),_0x47f5('0xa'),'freshdesk',_0x47f5('0xb'),'desk',_0x47f5('0xc'),_0x47f5('0xd'),_0x47f5('0xe'),_0x47f5('0xf')];exports['exec']=function(_0x3dd654,_0x189e11,_0x966671,_0x59e549,_0x20d1cd,_0x1d4c90){if(_0x966671){if(_['includes'](integrations,_0x3dd654[_0x47f5('0x10')]['toLowerCase']())){try{var _0x2bca72=null;var _0x4ad3b4='';var _0x60822e=_0x966671[_0x3dd654[_0x47f5('0x10')]['toLowerCase']()];if(_0x60822e){var _0x21c2eb=_0x60822e[_0x3dd654[_0x47f5('0x11')]];if(_0x21c2eb){var _0x3bd0af=_[_0x47f5('0x12')](_0x21c2eb[_0x47f5('0x13')],{'id':parseInt(_0x3dd654[_0x47f5('0x14')],0xa)});if(_0x3bd0af){if(_0x59e549){if(_0x20d1cd&&_0x189e11[_0x47f5('0x15')]){_0x4ad3b4=_0x47f5('0x15');}else if(_0x189e11['routeId']){_0x4ad3b4='outbound';}else{console[_0x47f5('0x16')](_0x47f5('0x17'),_0x189e11);}}else{_0x4ad3b4=_0x47f5('0x18');}switch(_0x3dd654[_0x47f5('0x10')][_0x47f5('0x19')]()){case _0x47f5('0x1a'):zendesk[_0x4ad3b4](_0x3dd654,_0x189e11,_0x3bd0af,_0x59e549,_0x20d1cd,_0x21c2eb,_0x1d4c90);break;case'salesforce':salesforce[_0x4ad3b4](_0x3dd654,_0x189e11,_0x3bd0af,_0x59e549,_0x20d1cd,_0x21c2eb,_0x1d4c90);break;case _0x47f5('0xa'):sugarcrm[_0x4ad3b4](_0x3dd654,_0x189e11,_0x3bd0af,_0x59e549,_0x20d1cd,_0x21c2eb,_0x1d4c90);break;case _0x47f5('0x1b'):freshdesk[_0x4ad3b4](_0x3dd654,_0x189e11,_0x3bd0af,_0x59e549,_0x20d1cd,_0x21c2eb,_0x1d4c90);break;case _0x47f5('0xb'):zoho[_0x4ad3b4](_0x3dd654,_0x189e11,_0x3bd0af,_0x59e549,_0x20d1cd,_0x21c2eb,_0x1d4c90);break;case _0x47f5('0x1c'):desk[_0x4ad3b4](_0x3dd654,_0x189e11,_0x3bd0af,_0x59e549,_0x20d1cd,_0x21c2eb,_0x1d4c90);break;case _0x47f5('0xc'):vtiger[_0x4ad3b4](_0x3dd654,_0x189e11,_0x3bd0af,_0x59e549,_0x20d1cd,_0x21c2eb,_0x1d4c90);break;case _0x47f5('0xe'):freshsales['cs'](_0x3dd654,_0x189e11,_0x3bd0af,_0x59e549,_0x20d1cd,_0x21c2eb,_0x1d4c90,_0x4ad3b4);break;case _0x47f5('0xf'):servicenow['cs'](_0x3dd654,_0x189e11,_0x3bd0af,_0x59e549,_0x20d1cd,_0x21c2eb,_0x1d4c90,_0x4ad3b4);break;case'dynamics365':dynamics365['cs'](_0x3dd654,_0x189e11,_0x3bd0af,_0x59e549,_0x20d1cd,_0x21c2eb,_0x1d4c90,_0x4ad3b4);break;default:console['log'](_0x47f5('0x1d'));}}else{_0x2bca72=require(_0x47f5('0x1e'))(_0x3dd654[_0x47f5('0x10')]['toLowerCase']());_0x2bca72['error']('[EXEC]',util[_0x47f5('0x1f')]('%s\x20configuration\x20#%s\x20not\x20found',_0x3dd654['data1']['toLowerCase'](),_0x3dd654['data3']));}}else{_0x2bca72=require(_0x47f5('0x1e'))(_0x3dd654[_0x47f5('0x10')]['toLowerCase']());_0x2bca72['error'](_0x47f5('0x20'),util['format'](_0x47f5('0x21'),_0x3dd654['data1'][_0x47f5('0x19')](),_0x3dd654['data2']));}}else{}}catch(_0x574b8f){console[_0x47f5('0x22')](_0x574b8f);}}}}; \ No newline at end of file +var _0x6fa3=['desk','freshsales','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./freshsales','salesforce','sugarcrm','freshdesk','zoho','vtiger','dynamics365','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','log','EVENT\x20UNKNOWN','unmanaged'];(function(_0x13b69c,_0x5eaaad){var _0x6df506=function(_0x409656){while(--_0x409656){_0x13b69c['push'](_0x13b69c['shift']());}};_0x6df506(++_0x5eaaad);}(_0x6fa3,0x1dd));var _0x36fa=function(_0x439a62,_0x140fbd){_0x439a62=_0x439a62-0x0;var _0x1bcbf8=_0x6fa3[_0x439a62];return _0x1bcbf8;};'use strict';var _=require(_0x36fa('0x0'));var util=require(_0x36fa('0x1'));var zendesk=require(_0x36fa('0x2'));var salesforce=require(_0x36fa('0x3'));var sugarcrm=require(_0x36fa('0x4'));var freshdesk=require(_0x36fa('0x5'));var zoho=require(_0x36fa('0x6'));var desk=require(_0x36fa('0x7'));var vtiger=require(_0x36fa('0x8'));var servicenow=require('./servicenow');var dynamics365=require('./dynamics365');var freshsales=require(_0x36fa('0x9'));var integrations=['zendesk',_0x36fa('0xa'),_0x36fa('0xb'),_0x36fa('0xc'),_0x36fa('0xd'),'desk',_0x36fa('0xe'),_0x36fa('0xf'),'freshsales',_0x36fa('0x10')];exports[_0x36fa('0x11')]=function(_0x4a8b41,_0x2f6a67,_0x4eded1,_0x3c3327,_0x241ad2,_0xb1655d){if(_0x4eded1){if(_[_0x36fa('0x12')](integrations,_0x4a8b41[_0x36fa('0x13')][_0x36fa('0x14')]())){try{var _0x2af8ff=null;var _0x473397='';var _0x3a106d=_0x4eded1[_0x4a8b41[_0x36fa('0x13')][_0x36fa('0x14')]()];if(_0x3a106d){var _0xfea0b7=_0x3a106d[_0x4a8b41[_0x36fa('0x15')]];if(_0xfea0b7){var _0x1f202=_[_0x36fa('0x16')](_0xfea0b7[_0x36fa('0x17')],{'id':parseInt(_0x4a8b41[_0x36fa('0x18')],0xa)});if(_0x1f202){if(_0x3c3327){if(_0x241ad2&&_0x2f6a67[_0x36fa('0x19')]){_0x473397='queue';}else if(_0x2f6a67[_0x36fa('0x1a')]){_0x473397='outbound';}else{console[_0x36fa('0x1b')](_0x36fa('0x1c'),_0x2f6a67);}}else{_0x473397=_0x36fa('0x1d');}switch(_0x4a8b41[_0x36fa('0x13')]['toLowerCase']()){case'zendesk':zendesk[_0x473397](_0x4a8b41,_0x2f6a67,_0x1f202,_0x3c3327,_0x241ad2,_0xfea0b7,_0xb1655d);break;case'salesforce':salesforce[_0x473397](_0x4a8b41,_0x2f6a67,_0x1f202,_0x3c3327,_0x241ad2,_0xfea0b7,_0xb1655d);break;case _0x36fa('0xb'):sugarcrm[_0x473397](_0x4a8b41,_0x2f6a67,_0x1f202,_0x3c3327,_0x241ad2,_0xfea0b7,_0xb1655d);break;case _0x36fa('0xc'):freshdesk[_0x473397](_0x4a8b41,_0x2f6a67,_0x1f202,_0x3c3327,_0x241ad2,_0xfea0b7,_0xb1655d);break;case _0x36fa('0xd'):zoho[_0x473397](_0x4a8b41,_0x2f6a67,_0x1f202,_0x3c3327,_0x241ad2,_0xfea0b7,_0xb1655d);break;case _0x36fa('0x1e'):desk[_0x473397](_0x4a8b41,_0x2f6a67,_0x1f202,_0x3c3327,_0x241ad2,_0xfea0b7,_0xb1655d);break;case _0x36fa('0xe'):vtiger[_0x473397](_0x4a8b41,_0x2f6a67,_0x1f202,_0x3c3327,_0x241ad2,_0xfea0b7,_0xb1655d);break;case _0x36fa('0x1f'):freshsales['cs'](_0x4a8b41,_0x2f6a67,_0x1f202,_0x3c3327,_0x241ad2,_0xfea0b7,_0xb1655d,_0x473397);break;case _0x36fa('0x10'):servicenow['cs'](_0x4a8b41,_0x2f6a67,_0x1f202,_0x3c3327,_0x241ad2,_0xfea0b7,_0xb1655d,_0x473397);break;case _0x36fa('0xf'):dynamics365['cs'](_0x4a8b41,_0x2f6a67,_0x1f202,_0x3c3327,_0x241ad2,_0xfea0b7,_0xb1655d,_0x473397);break;default:console[_0x36fa('0x1b')](_0x36fa('0x20'));}}else{_0x2af8ff=require(_0x36fa('0x21'))(_0x4a8b41['data1'][_0x36fa('0x14')]());_0x2af8ff[_0x36fa('0x22')](_0x36fa('0x23'),util[_0x36fa('0x24')](_0x36fa('0x25'),_0x4a8b41[_0x36fa('0x13')][_0x36fa('0x14')](),_0x4a8b41['data3']));}}else{_0x2af8ff=require('../../../../config/logger')(_0x4a8b41[_0x36fa('0x13')][_0x36fa('0x14')]());_0x2af8ff[_0x36fa('0x22')]('[EXEC]',util[_0x36fa('0x24')](_0x36fa('0x26'),_0x4a8b41['data1'][_0x36fa('0x14')](),_0x4a8b41[_0x36fa('0x15')]));}}else{}}catch(_0x575dd9){console[_0x36fa('0x22')](_0x575dd9);}}}}; \ 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 bb51359..bba5af1 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 _0xcb51=['contact','lead','WhoId','WhatId','ContactId','account','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','User','find','then','length','Email','Agent\x20%s\x20found.','user_id','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','resolve','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','additionalSearchContact','$or','cloneDeep','additionalSearchLead','merge','Lead','account_contact_lead','additionalSearchAccount','Account','Contact','execute','first','Name','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','Caller\x20-\x20%s','Company','No\x20Company','format','upperFirst','forEach','includes','string','idField','content','variable','variableName','toString','customVariable','Variable','name','password','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','username','Connection\x20established.','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridnum','Fields','[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','instanceUrl','error','catch','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','monitor_format','lastevent','toUpperCase','calleridname',']\x20Ticket\x20%s\x20created.','lodash','request-promise','moment','bluebird','md5','jsforce','util','ioredis','../../../../config/logger','salesforce','redis','defaults','localhost','assign','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType'];(function(_0x5f55c7,_0x4d5e85){var _0x5c254a=function(_0x28fcfe){while(--_0x28fcfe){_0x5f55c7['push'](_0x5f55c7['shift']());}};_0x5c254a(++_0x4d5e85);}(_0xcb51,0x163));var _0x1cb5=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xcb51[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0x1cb5('0x0'));var rp=require(_0x1cb5('0x1'));var moment=require(_0x1cb5('0x2'));var BPromise=require(_0x1cb5('0x3'));var md5=require(_0x1cb5('0x4'));var jsforce=require(_0x1cb5('0x5'));var util=require(_0x1cb5('0x6'));var Redis=require(_0x1cb5('0x7'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x1cb5('0x8'))(_0x1cb5('0x9'));config[_0x1cb5('0xa')]=_[_0x1cb5('0xb')](config['redis'],{'host':_0x1cb5('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1cb5('0xa')]));function emit(_0x2f9310,_0x140d42,_0x5f574c){io['to'](_0x2f9310)['emit'](_0x140d42,_0x5f574c);}function getTicket(_0xd27427,_0x5c6e46,_0x3f93da,_0x7ce7e,_0x522285,_0x484d5b,_0x463559,_0x566f10){var _0x4c38fb=Object[_0x1cb5('0xd')]({},{'OwnerId':_0x5c6e46['id'],'Subject':intUtil['getString'](_0x7ce7e[_0x1cb5('0xe')],_0x522285,'\x20'),'Description':intUtil['getString'](_0x7ce7e[_0x1cb5('0xf')],_0x522285,'\x0a')},getCustomFields(_0x484d5b,_0x522285));if(_0x3f93da){if(_0x7ce7e[_0x1cb5('0x10')]===_0x1cb5('0x11')){_0x4c38fb[_0x1cb5('0x12')]=moment[_0x1cb5('0x13')]();_0x4c38fb[_0x1cb5('0x14')]=![];_0x4c38fb[_0x1cb5('0x15')]=![];if(_0x3f93da[_0x1cb5('0x16')]===_0x1cb5('0x17')||_0x3f93da[_0x1cb5('0x16')]===_0x1cb5('0x18')){_0x4c38fb[_0x1cb5('0x19')]=_0x3f93da['id'];}else if(_0x3f93da[_0x1cb5('0x16')]==='account'){_0x4c38fb[_0x1cb5('0x1a')]=_0x3f93da['id'];}}else if(_0x7ce7e[_0x1cb5('0x10')]==='Case'){if(_0x3f93da[_0x1cb5('0x16')]===_0x1cb5('0x17')){_0x4c38fb[_0x1cb5('0x1b')]=_0x3f93da['id'];}else if(_0x3f93da[_0x1cb5('0x16')]===_0x1cb5('0x1c')){_0x4c38fb[_0x1cb5('0x1d')]=_0x3f93da['id'];}else if(_0x3f93da['endUserType']===_0x1cb5('0x18')&&_0x7ce7e[_0x1cb5('0x1e')]){_0x4c38fb[_0x7ce7e[_0x1cb5('0x1e')]]=_0x3f93da['id'];}else{logger[_0x1cb5('0x1f')](_0x1cb5('0x20'));}}}return _0x463559[_0x1cb5('0x21')](_0x7ce7e[_0x1cb5('0x10')])[_0x1cb5('0x22')](_0x4c38fb);}function getUser(_0x3e6f3e,_0x30086d,_0x43d918){if(!_[_0x1cb5('0x23')](_0x30086d)&&intUtil['validateEmail'](_0x30086d)){var _0xb851ac={'Email':_0x30086d};var _0x5399ec={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x43d918[_0x1cb5('0x21')](_0x1cb5('0x24'))[_0x1cb5('0x25')](_0xb851ac,_0x5399ec)['execute']()[_0x1cb5('0x26')](function(_0x3771f4){if(_0x3771f4[_0x1cb5('0x27')]){var _0x3b516c=_[_0x1cb5('0x25')](_0x3771f4,function(_0x3c5c4d){return _0x3c5c4d[_0x1cb5('0x28')]===_0x30086d;});if(_0x3b516c){logger['info'](_0x1cb5('0x29'),_0x30086d);return BPromise['resolve']({'id':_0x3b516c['Id'],'name':_0x3b516c['Name']});}}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x30086d);return _0x43d918['identity']()[_0x1cb5('0x26')](function(_0x3667a4){return BPromise['resolve']({'id':_0x3667a4[_0x1cb5('0x2a')],'name':_0x3667a4['display_name']});});}});}else{logger[_0x1cb5('0x1f')](_0x1cb5('0x2b'),_0x30086d);return _0x43d918[_0x1cb5('0x2c')]()[_0x1cb5('0x26')](function(_0x4bffb3){return BPromise[_0x1cb5('0x2d')]({'id':_0x4bffb3[_0x1cb5('0x2a')],'name':_0x4bffb3[_0x1cb5('0x2e')]});});}}function getEndUser(_0x44581c,_0x4ec99f,_0x1b0e7,_0x38b57c,_0x1d317e){var _0x26a7d9={'$or':{'Phone':_0x38b57c}};var _0x18e78d={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x1cb5('0x2d')]()[_0x1cb5('0x26')](function(){logger['info'](_0x1cb5('0x2f'),_0x38b57c,_0x4ec99f[_0x1cb5('0x30')]);switch(_0x4ec99f[_0x1cb5('0x30')]){case'contact_lead':var _0x2fc6ab=_['cloneDeep'](_0x26a7d9);if(_0x4ec99f[_0x1cb5('0x31')]){var _0x5317f2={};_0x5317f2[_0x4ec99f[_0x1cb5('0x31')]]=_0x38b57c;_['merge'](_0x2fc6ab[_0x1cb5('0x32')],_0x5317f2);}return _0x1d317e[_0x1cb5('0x21')]('Contact')['find'](_0x2fc6ab,_0x18e78d)['execute']()[_0x1cb5('0x26')](function(_0x316226){if(_0x316226&&_0x316226[_0x1cb5('0x27')]){return _0x316226;}else{var _0x558d70=_[_0x1cb5('0x33')](_0x26a7d9);if(_0x4ec99f[_0x1cb5('0x34')]){var _0x5a0205={};_0x5a0205[_0x4ec99f['additionalSearchLead']]=_0x38b57c;_[_0x1cb5('0x35')](_0x558d70[_0x1cb5('0x32')],_0x5a0205);}return _0x1d317e['sobject'](_0x1cb5('0x36'))['find'](_0x558d70,_0x18e78d);}});case _0x1cb5('0x37'):var _0x40861c=_['cloneDeep'](_0x26a7d9);if(_0x4ec99f['additionalSearchAccount']){var _0x5317f2={};_0x5317f2[_0x4ec99f[_0x1cb5('0x38')]]=_0x38b57c;_[_0x1cb5('0x35')](_0x40861c[_0x1cb5('0x32')],_0x5317f2);}return _0x1d317e['sobject'](_0x1cb5('0x39'))[_0x1cb5('0x25')](_0x40861c,_0x18e78d)['execute']()['then'](function(_0x15237c){if(_0x15237c&&_0x15237c['length']){return _0x15237c;}else{var _0x3b2cff=_[_0x1cb5('0x33')](_0x26a7d9);if(_0x4ec99f[_0x1cb5('0x31')]){var _0x4b88ed={};_0x4b88ed[_0x4ec99f[_0x1cb5('0x31')]]=_0x38b57c;_[_0x1cb5('0x35')](_0x3b2cff[_0x1cb5('0x32')],_0x4b88ed);}return _0x1d317e[_0x1cb5('0x21')]('Contact')['find'](_0x3b2cff,_0x18e78d)['then'](function(_0x387432){if(_0x387432&&_0x387432['length']){return _0x387432;}else{var _0x22aca1=_[_0x1cb5('0x33')](_0x26a7d9);if(_0x4ec99f[_0x1cb5('0x34')]){var _0x4e8165={};_0x4e8165[_0x4ec99f['additionalSearchLead']]=_0x38b57c;_[_0x1cb5('0x35')](_0x22aca1[_0x1cb5('0x32')],_0x4e8165);}return _0x1d317e[_0x1cb5('0x21')](_0x1cb5('0x36'))[_0x1cb5('0x25')](_0x22aca1,_0x18e78d);}});}});case'contact':var _0x2fc6ab=_['cloneDeep'](_0x26a7d9);if(_0x4ec99f[_0x1cb5('0x31')]){var _0x5317f2={};_0x5317f2[_0x4ec99f[_0x1cb5('0x31')]]=_0x38b57c;_[_0x1cb5('0x35')](_0x2fc6ab[_0x1cb5('0x32')],_0x5317f2);}return _0x1d317e[_0x1cb5('0x21')](_0x1cb5('0x3a'))[_0x1cb5('0x25')](_0x2fc6ab,_0x18e78d)[_0x1cb5('0x3b')]();case _0x1cb5('0x18'):var _0x1a7e07=_[_0x1cb5('0x33')](_0x26a7d9);if(_0x4ec99f[_0x1cb5('0x34')]){var _0x5317f2={};_0x5317f2[_0x4ec99f[_0x1cb5('0x34')]]=_0x38b57c;_[_0x1cb5('0x35')](_0x1a7e07[_0x1cb5('0x32')],_0x5317f2);}return _0x1d317e['sobject']('Lead')[_0x1cb5('0x25')](_0x1a7e07,_0x18e78d);case _0x1cb5('0x1c'):var _0x40861c=_[_0x1cb5('0x33')](_0x26a7d9);if(_0x4ec99f[_0x1cb5('0x38')]){var _0x5317f2={};_0x5317f2[_0x4ec99f[_0x1cb5('0x38')]]=_0x38b57c;_['merge'](_0x40861c[_0x1cb5('0x32')],_0x5317f2);}return _0x1d317e[_0x1cb5('0x21')]('Account')[_0x1cb5('0x25')](_0x40861c,_0x18e78d);default:return null;}})[_0x1cb5('0x26')](function(_0x4d5367){if(_0x4d5367&&_0x4d5367[_0x1cb5('0x27')]){var _0x1b1373=_[_0x1cb5('0x3c')](_0x4d5367);if(_0x1b1373){return BPromise[_0x1cb5('0x2d')]({'id':_0x1b1373['Id'],'name':_0x1b1373[_0x1cb5('0x3d')],'phone':_0x1b1373[_0x1cb5('0x3e')],'endUserType':_0x1b1373[_0x1cb5('0x3f')][_0x1cb5('0x40')][_0x1cb5('0x41')]()});}}})[_0x1cb5('0x26')](function(_0x5a8951){if(_0x5a8951){logger[_0x1cb5('0x1f')](_0x1cb5('0x42'),_0x5a8951[_0x1cb5('0x16')],_0x38b57c);return BPromise['resolve'](_0x5a8951);}else{logger[_0x1cb5('0x1f')](_0x1cb5('0x43'),_0x38b57c);var _0x350259={'Phone':_0x38b57c};if(_0x4ec99f[_0x1cb5('0x44')]){if(_0x4ec99f[_0x1cb5('0x44')]===_0x1cb5('0x17')){logger['info'](_0x1cb5('0x45'),_0x38b57c,_0x4ec99f['moduleCreate']);_0x350259[_0x1cb5('0x46')]=_0x1b0e7!==_0x1cb5('0x47')?_0x1b0e7:util['format'](_0x1cb5('0x48'),_0x38b57c);}else if(_0x4ec99f[_0x1cb5('0x44')]===_0x1cb5('0x18')){logger[_0x1cb5('0x1f')](_0x1cb5('0x45'),_0x38b57c,_0x4ec99f[_0x1cb5('0x44')]);_0x350259['LastName']=_0x1b0e7!==_0x1cb5('0x47')?_0x1b0e7:util['format'](_0x1cb5('0x48'),_0x38b57c);_0x350259[_0x1cb5('0x49')]=_0x1cb5('0x4a');}else if(_0x4ec99f[_0x1cb5('0x44')]===_0x1cb5('0x1c')){logger[_0x1cb5('0x1f')](_0x1cb5('0x45'),_0x38b57c,_0x4ec99f[_0x1cb5('0x44')]);_0x350259[_0x1cb5('0x3d')]=_0x1b0e7!==_0x1cb5('0x47')?_0x1b0e7:util[_0x1cb5('0x4b')]('Caller\x20-\x20%s',_0x38b57c);}else{return null;}}return _0x1d317e[_0x1cb5('0x21')](_[_0x1cb5('0x4c')](_0x4ec99f[_0x1cb5('0x44')]))[_0x1cb5('0x22')](_0x350259)[_0x1cb5('0x26')](function(_0xabe7a3){return BPromise[_0x1cb5('0x2d')]({'id':_0xabe7a3['id'],'endUserType':_0x4ec99f[_0x1cb5('0x44')]});});}});}function getCustomFields(_0x4fcb2,_0x16c348){var _0x52f1e0={};if(_0x4fcb2['length']>0x0){_[_0x1cb5('0x4d')](_0x4fcb2,function(_0x4f566f){if(_[_0x1cb5('0x4e')]([_0x1cb5('0x4f'),'picklist'],_0x4f566f[_0x1cb5('0x40')])&&_0x4f566f[_0x1cb5('0x50')]){_0x52f1e0[_0x4f566f[_0x1cb5('0x50')]]=_0x4f566f[_0x1cb5('0x51')]['toString']();}else if(_0x4f566f[_0x1cb5('0x40')]===_0x1cb5('0x52')&&_0x4f566f[_0x1cb5('0x53')]&&_0x4f566f[_0x1cb5('0x50')]){_0x16c348[_0x4f566f[_0x1cb5('0x53')]]&&(_0x52f1e0[_0x4f566f[_0x1cb5('0x50')]]=_0x16c348[_0x4f566f[_0x1cb5('0x53')]][_0x1cb5('0x54')]());}else if(_0x4f566f[_0x1cb5('0x40')]===_0x1cb5('0x55')&&_0x4f566f[_0x1cb5('0x56')]&&_0x4f566f[_0x1cb5('0x56')][_0x1cb5('0x57')]&&_0x4f566f[_0x1cb5('0x50')]){_0x16c348[_0x4f566f[_0x1cb5('0x56')][_0x1cb5('0x57')]['toLowerCase']()]&&(_0x52f1e0[_0x4f566f['idField']]=_0x16c348[_0x4f566f['Variable'][_0x1cb5('0x57')][_0x1cb5('0x41')]()][_0x1cb5('0x54')]());}});}return _0x52f1e0;}function getConnection(_0x5816ca){var _0x2566a4=_0x5816ca[_0x1cb5('0x58')]['concat'](_0x5816ca[_0x1cb5('0x59')]);var _0xc24a13=new jsforce[(_0x1cb5('0x5a'))]({'oauth2':{'loginUrl':_0x5816ca[_0x1cb5('0x5b')]||_0x1cb5('0x5c'),'clientId':_0x5816ca[_0x1cb5('0x5d')],'clientSecret':_0x5816ca[_0x1cb5('0x5e')]}});return _0xc24a13['login'](_0x5816ca[_0x1cb5('0x5f')],_0x2566a4)[_0x1cb5('0x26')](function(){logger[_0x1cb5('0x1f')](_0x1cb5('0x60'));return _0xc24a13;});}exports['queue']=function(_0x165bc2,_0x3c8d38,_0x4493d4,_0xa0ccd6,_0x148bb1,_0x455472){var _0x3c317b,_0x179a8f,_0x173c7c,_0x26b823;_0x455472[_0x1cb5('0x61')]=intUtil[_0x1cb5('0x62')](_0x455472[_0x1cb5('0x61')]);_0x455472[_0x1cb5('0x5b')]=intUtil[_0x1cb5('0x62')](_0x455472['remoteUri']);if(_0x148bb1&&_0x148bb1['monitor_format']){logger[_0x1cb5('0x1f')](_0x1cb5('0x63'),_0x1cb5('0x64'));_0x3c8d38[_0x1cb5('0x65')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x455472['serverUrl'],_0x3c8d38[_0x1cb5('0x66')],md5(_0x3c8d38[_0x1cb5('0x66')]));}else{_0x3c8d38[_0x1cb5('0x65')]='';}return getConnection(_0x455472)[_0x1cb5('0x26')](function(_0x3dbec9){_0x26b823=_0x3dbec9;return getUser(_0x455472,_0xa0ccd6['email'],_0x26b823);})[_0x1cb5('0x26')](function(_0x30bbbb){_0x3c317b=_0x30bbbb;return getEndUser(_0x455472,_0x4493d4,_0x3c8d38['calleridname'],_0x3c8d38[_0x1cb5('0x67')],_0x26b823);})[_0x1cb5('0x26')](function(_0x5d4e79){_0x179a8f=_0x5d4e79;return getTicket(_0x455472,_0x3c317b,_0x179a8f,_0x4493d4,_0x3c8d38,_0x4493d4[_0x1cb5('0x68')],_0x26b823,'queue');})[_0x1cb5('0x26')](function(_0x30dfb4){_0x173c7c=_0x30dfb4;logger[_0x1cb5('0x1f')](_0x1cb5('0x69'),_0x173c7c['id']);logger[_0x1cb5('0x1f')](_0x1cb5('0x6a'),_0x173c7c['id'],_0xa0ccd6['name'],_0x455472['type']);switch(_0x455472[_0x1cb5('0x40')]){case _0x1cb5('0x6b'):emit(util[_0x1cb5('0x4b')](_0x1cb5('0x6c'),_0xa0ccd6['name']),_0x1cb5('0x6d'),{'recordId':_0x173c7c['id']});break;case _0x1cb5('0x6e'):emit(util[_0x1cb5('0x4b')](_0x1cb5('0x6c'),_0xa0ccd6[_0x1cb5('0x57')]),_0x1cb5('0x6f'),{'uri':util[_0x1cb5('0x4b')](_0x1cb5('0x70'),_0x26b823[_0x1cb5('0x71')],_0x173c7c['id'])});break;default:logger[_0x1cb5('0x72')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x1cb5('0x73')](function(_0x3930e6){logger[_0x1cb5('0x72')](_0x1cb5('0x63'),_0x3930e6);});};exports['outbound']=function(_0x85e2ff,_0x4df09f,_0x30eb9e,_0xc43c4e,_0x5594b4,_0x9189ac,_0x5187d0){var _0x2a397a,_0x33d21b,_0x42ab99,_0x62d492;_0x9189ac['serverUrl']=intUtil[_0x1cb5('0x62')](_0x9189ac[_0x1cb5('0x61')]);_0x9189ac[_0x1cb5('0x5b')]=intUtil[_0x1cb5('0x62')](_0x9189ac[_0x1cb5('0x5b')]);if(_0x5187d0&&_0x5187d0['recordingFormat']&&_0x5187d0['recordingFormat']!=='none'){logger[_0x1cb5('0x1f')](_0x1cb5('0x74'),_0x1cb5('0x64'));_0x4df09f[_0x1cb5('0x65')]=util[_0x1cb5('0x4b')](_0x1cb5('0x75'),_0x9189ac['serverUrl'],_0x4df09f['uniqueid'],md5(_0x4df09f['uniqueid']));}return getConnection(_0x9189ac)[_0x1cb5('0x26')](function(_0x342e73){_0x62d492=_0x342e73;return getUser(_0x9189ac,_0xc43c4e['email'],_0x62d492);})[_0x1cb5('0x26')](function(_0xa54fca){_0x2a397a=_0xa54fca;return getEndUser(_0x9189ac,_0x30eb9e,_0x4df09f['destcalleridname'],_0x4df09f[_0x1cb5('0x76')],_0x62d492);})[_0x1cb5('0x26')](function(_0x4c9834){_0x33d21b=_0x4c9834;return getTicket(_0x9189ac,_0x2a397a,_0x33d21b,_0x30eb9e,_0x4df09f,_0x30eb9e[_0x1cb5('0x68')],_0x62d492,'outbound');})[_0x1cb5('0x26')](function(_0x4b942d){_0x42ab99=_0x4b942d;logger['info'](_0x1cb5('0x77'),_0x42ab99['id']);logger[_0x1cb5('0x1f')](_0x1cb5('0x78'),_0x42ab99['id'],_0xc43c4e['name'],_0x9189ac['type']);switch(_0x9189ac[_0x1cb5('0x40')]){case _0x1cb5('0x6b'):emit(util['format'](_0x1cb5('0x6c'),_0xc43c4e[_0x1cb5('0x57')]),_0x1cb5('0x6d'),{'recordId':_0x42ab99['id']});break;case _0x1cb5('0x6e'):emit(util['format']('user:%s',_0xc43c4e[_0x1cb5('0x57')]),_0x1cb5('0x6f'),{'uri':util[_0x1cb5('0x4b')](_0x1cb5('0x70'),_0x62d492['instanceUrl'],_0x42ab99['id'])});break;default:logger[_0x1cb5('0x72')](_0x1cb5('0x74'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x1cb5('0x73')](function(_0x18a7b8){logger['error'](_0x1cb5('0x74'),_0x18a7b8);});};exports['unmanaged']=function(_0x244010,_0x490d85,_0xf7817b,_0x4d1539,_0x186b53,_0x3b9f10){var _0x38dff2,_0x1f6d27,_0x596eaf,_0x4a9a9b;_0x3b9f10[_0x1cb5('0x61')]=intUtil[_0x1cb5('0x62')](_0x3b9f10[_0x1cb5('0x61')]);_0x3b9f10[_0x1cb5('0x5b')]=intUtil['stripTrailingSlash'](_0x3b9f10[_0x1cb5('0x5b')]);if(_0x186b53&&_0x186b53[_0x1cb5('0x79')]){logger['info']('['+_0x490d85[_0x1cb5('0x7a')][_0x1cb5('0x7b')]()+']',_0x1cb5('0x64'));_0x490d85['recordingURL']=util[_0x1cb5('0x4b')](_0x1cb5('0x75'),_0x3b9f10[_0x1cb5('0x61')],_0x490d85[_0x1cb5('0x66')],md5(_0x490d85[_0x1cb5('0x66')]));}else{_0x490d85[_0x1cb5('0x65')]='';}return getConnection(_0x3b9f10)[_0x1cb5('0x26')](function(_0x36f779){_0x4a9a9b=_0x36f779;if(!_[_0x1cb5('0x23')](_0x4d1539)){return getUser(_0x3b9f10,_0x4d1539[_0x1cb5('0x57')],_0x4a9a9b);}else{return getUser(_0x3b9f10,null,_0x4a9a9b);}})['then'](function(_0x2487d9){_0x38dff2=_0x2487d9;return getEndUser(_0x3b9f10,_0xf7817b,_0x490d85[_0x1cb5('0x7c')],_0x490d85['calleridnum'],_0x4a9a9b);})['then'](function(_0x108eff){_0x1f6d27=_0x108eff;return getTicket(_0x3b9f10,_0x38dff2,_0x1f6d27,_0xf7817b,_0x490d85,_0xf7817b['Fields'],_0x4a9a9b);})[_0x1cb5('0x26')](function(_0x1b9b60){_0x596eaf=_0x1b9b60;logger[_0x1cb5('0x1f')]('['+_0x490d85[_0x1cb5('0x7a')][_0x1cb5('0x7b')]()+_0x1cb5('0x7d'),_0x596eaf['id']);logger['info']('['+_0x490d85[_0x1cb5('0x7a')][_0x1cb5('0x7b')]()+']\x20Integration\x20account\x20type\x20%s.',_0x3b9f10['type']);})[_0x1cb5('0x73')](function(_0x4541b3){logger[_0x1cb5('0x72')]('['+_0x490d85[_0x1cb5('0x7a')]['toUpperCase']()+']',_0x4541b3);});}; \ No newline at end of file +var _0xbb22=['none','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','isNil',']\x20Ticket\x20%s\x20created.','lodash','request-promise','moment','jsforce','util','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','socket.io-emitter','emit','assign','getString','Subjects','ticketType','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','Case','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','validateEmail','User','then','Email','Agent\x20%s\x20found.','Name','identity','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','sobject','Contact','find','execute','length','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','format','Caller\x20-\x20%s','LastName','Company','No\x20Company','upperFirst','string','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','Connection\x20established.','queue','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]\x20Ticket\x20%s\x20created','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','outbound','recordingFormat'];(function(_0x59c229,_0x5e9d7d){var _0x202833=function(_0x414344){while(--_0x414344){_0x59c229['push'](_0x59c229['shift']());}};_0x202833(++_0x5e9d7d);}(_0xbb22,0x8d));var _0x2bb2=function(_0x3101ff,_0xf266f){_0x3101ff=_0x3101ff-0x0;var _0x3ab3d2=_0xbb22[_0x3101ff];return _0x3ab3d2;};'use strict';var _=require(_0x2bb2('0x0'));var rp=require(_0x2bb2('0x1'));var moment=require(_0x2bb2('0x2'));var BPromise=require('bluebird');var md5=require('md5');var jsforce=require(_0x2bb2('0x3'));var util=require(_0x2bb2('0x4'));var Redis=require('ioredis');var intUtil=require(_0x2bb2('0x5'));var config=require(_0x2bb2('0x6'));var logger=require(_0x2bb2('0x7'))(_0x2bb2('0x8'));config[_0x2bb2('0x9')]=_[_0x2bb2('0xa')](config[_0x2bb2('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x2bb2('0xb'))(new Redis(config['redis']));function emit(_0x39b761,_0x24b6fc,_0x330bc3){io['to'](_0x39b761)[_0x2bb2('0xc')](_0x24b6fc,_0x330bc3);}function getTicket(_0x2dd867,_0x326e08,_0x301261,_0x2c9545,_0x13d700,_0x4b251d,_0x389652,_0x2b2195){var _0x4e5855=Object[_0x2bb2('0xd')]({},{'OwnerId':_0x326e08['id'],'Subject':intUtil[_0x2bb2('0xe')](_0x2c9545[_0x2bb2('0xf')],_0x13d700,'\x20'),'Description':intUtil[_0x2bb2('0xe')](_0x2c9545['Descriptions'],_0x13d700,'\x0a')},getCustomFields(_0x4b251d,_0x13d700));if(_0x301261){if(_0x2c9545[_0x2bb2('0x10')]==='Task'){_0x4e5855[_0x2bb2('0x11')]=moment[_0x2bb2('0x12')]();_0x4e5855[_0x2bb2('0x13')]=![];_0x4e5855[_0x2bb2('0x14')]=![];if(_0x301261[_0x2bb2('0x15')]===_0x2bb2('0x16')||_0x301261[_0x2bb2('0x15')]===_0x2bb2('0x17')){_0x4e5855[_0x2bb2('0x18')]=_0x301261['id'];}else if(_0x301261[_0x2bb2('0x15')]===_0x2bb2('0x19')){_0x4e5855[_0x2bb2('0x1a')]=_0x301261['id'];}}else if(_0x2c9545['ticketType']===_0x2bb2('0x1b')){if(_0x301261[_0x2bb2('0x15')]===_0x2bb2('0x16')){_0x4e5855['ContactId']=_0x301261['id'];}else if(_0x301261[_0x2bb2('0x15')]===_0x2bb2('0x19')){_0x4e5855['AccountId']=_0x301261['id'];}else if(_0x301261['endUserType']===_0x2bb2('0x17')&&_0x2c9545[_0x2bb2('0x1c')]){_0x4e5855[_0x2c9545['leadId']]=_0x301261['id'];}else{logger[_0x2bb2('0x1d')](_0x2bb2('0x1e'));}}}return _0x389652['sobject'](_0x2c9545['ticketType'])[_0x2bb2('0x1f')](_0x4e5855);}function getUser(_0x5a993f,_0x239f0b,_0x4254b0){if(!_['isNil'](_0x239f0b)&&intUtil[_0x2bb2('0x20')](_0x239f0b)){var _0x591466={'Email':_0x239f0b};var _0x502df3={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4254b0['sobject'](_0x2bb2('0x21'))['find'](_0x591466,_0x502df3)['execute']()[_0x2bb2('0x22')](function(_0x370a0d){if(_0x370a0d['length']){var _0x44d013=_['find'](_0x370a0d,function(_0x431bf2){return _0x431bf2[_0x2bb2('0x23')]===_0x239f0b;});if(_0x44d013){logger[_0x2bb2('0x1d')](_0x2bb2('0x24'),_0x239f0b);return BPromise['resolve']({'id':_0x44d013['Id'],'name':_0x44d013[_0x2bb2('0x25')]});}}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x239f0b);return _0x4254b0[_0x2bb2('0x26')]()[_0x2bb2('0x22')](function(_0x196834){return BPromise[_0x2bb2('0x27')]({'id':_0x196834['user_id'],'name':_0x196834['display_name']});});}});}else{logger[_0x2bb2('0x1d')](_0x2bb2('0x28'),_0x239f0b);return _0x4254b0[_0x2bb2('0x26')]()[_0x2bb2('0x22')](function(_0xb9eb5){return BPromise[_0x2bb2('0x27')]({'id':_0xb9eb5[_0x2bb2('0x29')],'name':_0xb9eb5[_0x2bb2('0x2a')]});});}}function getEndUser(_0x297aa9,_0x561505,_0x2e6288,_0x4cab5d,_0x2c626b){var _0x3a69a2={'$or':{'Phone':_0x4cab5d}};var _0x35b37e={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x2bb2('0x27')]()[_0x2bb2('0x22')](function(){logger[_0x2bb2('0x1d')](_0x2bb2('0x2b'),_0x4cab5d,_0x561505[_0x2bb2('0x2c')]);switch(_0x561505['moduleSearch']){case _0x2bb2('0x2d'):var _0x8e5114=_[_0x2bb2('0x2e')](_0x3a69a2);if(_0x561505['additionalSearchContact']){var _0xeb6bf5={};_0xeb6bf5[_0x561505[_0x2bb2('0x2f')]]=_0x4cab5d;_[_0x2bb2('0x30')](_0x8e5114[_0x2bb2('0x31')],_0xeb6bf5);}return _0x2c626b[_0x2bb2('0x32')](_0x2bb2('0x33'))[_0x2bb2('0x34')](_0x8e5114,_0x35b37e)[_0x2bb2('0x35')]()['then'](function(_0x9e0937){if(_0x9e0937&&_0x9e0937[_0x2bb2('0x36')]){return _0x9e0937;}else{var _0x13793e=_[_0x2bb2('0x2e')](_0x3a69a2);if(_0x561505[_0x2bb2('0x37')]){var _0x2058fd={};_0x2058fd[_0x561505[_0x2bb2('0x37')]]=_0x4cab5d;_['merge'](_0x13793e[_0x2bb2('0x31')],_0x2058fd);}return _0x2c626b[_0x2bb2('0x32')](_0x2bb2('0x38'))[_0x2bb2('0x34')](_0x13793e,_0x35b37e);}});case _0x2bb2('0x39'):var _0x56366a=_[_0x2bb2('0x2e')](_0x3a69a2);if(_0x561505[_0x2bb2('0x3a')]){var _0xeb6bf5={};_0xeb6bf5[_0x561505[_0x2bb2('0x3a')]]=_0x4cab5d;_['merge'](_0x56366a[_0x2bb2('0x31')],_0xeb6bf5);}return _0x2c626b['sobject'](_0x2bb2('0x3b'))[_0x2bb2('0x34')](_0x56366a,_0x35b37e)[_0x2bb2('0x35')]()[_0x2bb2('0x22')](function(_0x1bda87){if(_0x1bda87&&_0x1bda87[_0x2bb2('0x36')]){return _0x1bda87;}else{var _0x13a4d3=_[_0x2bb2('0x2e')](_0x3a69a2);if(_0x561505[_0x2bb2('0x2f')]){var _0x4a3419={};_0x4a3419[_0x561505[_0x2bb2('0x2f')]]=_0x4cab5d;_[_0x2bb2('0x30')](_0x13a4d3[_0x2bb2('0x31')],_0x4a3419);}return _0x2c626b[_0x2bb2('0x32')](_0x2bb2('0x33'))[_0x2bb2('0x34')](_0x13a4d3,_0x35b37e)[_0x2bb2('0x22')](function(_0xa04970){if(_0xa04970&&_0xa04970[_0x2bb2('0x36')]){return _0xa04970;}else{var _0x42f74d=_[_0x2bb2('0x2e')](_0x3a69a2);if(_0x561505[_0x2bb2('0x37')]){var _0x39125a={};_0x39125a[_0x561505[_0x2bb2('0x37')]]=_0x4cab5d;_[_0x2bb2('0x30')](_0x42f74d[_0x2bb2('0x31')],_0x39125a);}return _0x2c626b[_0x2bb2('0x32')]('Lead')[_0x2bb2('0x34')](_0x42f74d,_0x35b37e);}});}});case'contact':var _0x8e5114=_[_0x2bb2('0x2e')](_0x3a69a2);if(_0x561505[_0x2bb2('0x2f')]){var _0xeb6bf5={};_0xeb6bf5[_0x561505['additionalSearchContact']]=_0x4cab5d;_[_0x2bb2('0x30')](_0x8e5114['$or'],_0xeb6bf5);}return _0x2c626b[_0x2bb2('0x32')](_0x2bb2('0x33'))[_0x2bb2('0x34')](_0x8e5114,_0x35b37e)[_0x2bb2('0x35')]();case'lead':var _0x3c6063=_[_0x2bb2('0x2e')](_0x3a69a2);if(_0x561505['additionalSearchLead']){var _0xeb6bf5={};_0xeb6bf5[_0x561505[_0x2bb2('0x37')]]=_0x4cab5d;_[_0x2bb2('0x30')](_0x3c6063[_0x2bb2('0x31')],_0xeb6bf5);}return _0x2c626b[_0x2bb2('0x32')]('Lead')[_0x2bb2('0x34')](_0x3c6063,_0x35b37e);case'account':var _0x56366a=_[_0x2bb2('0x2e')](_0x3a69a2);if(_0x561505['additionalSearchAccount']){var _0xeb6bf5={};_0xeb6bf5[_0x561505[_0x2bb2('0x3a')]]=_0x4cab5d;_[_0x2bb2('0x30')](_0x56366a[_0x2bb2('0x31')],_0xeb6bf5);}return _0x2c626b['sobject']('Account')['find'](_0x56366a,_0x35b37e);default:return null;}})['then'](function(_0x27ab28){if(_0x27ab28&&_0x27ab28[_0x2bb2('0x36')]){var _0x227edf=_['first'](_0x27ab28);if(_0x227edf){return BPromise[_0x2bb2('0x27')]({'id':_0x227edf['Id'],'name':_0x227edf['Name'],'phone':_0x227edf[_0x2bb2('0x3c')],'endUserType':_0x227edf[_0x2bb2('0x3d')][_0x2bb2('0x3e')][_0x2bb2('0x3f')]()});}}})[_0x2bb2('0x22')](function(_0x293d21){if(_0x293d21){logger[_0x2bb2('0x1d')](_0x2bb2('0x40'),_0x293d21[_0x2bb2('0x15')],_0x4cab5d);return BPromise[_0x2bb2('0x27')](_0x293d21);}else{logger[_0x2bb2('0x1d')](_0x2bb2('0x41'),_0x4cab5d);var _0x4bb752={'Phone':_0x4cab5d};if(_0x561505[_0x2bb2('0x42')]){if(_0x561505[_0x2bb2('0x42')]===_0x2bb2('0x16')){logger[_0x2bb2('0x1d')](_0x2bb2('0x43'),_0x4cab5d,_0x561505[_0x2bb2('0x42')]);_0x4bb752['LastName']=_0x2e6288!==_0x2bb2('0x44')?_0x2e6288:util[_0x2bb2('0x45')](_0x2bb2('0x46'),_0x4cab5d);}else if(_0x561505[_0x2bb2('0x42')]===_0x2bb2('0x17')){logger[_0x2bb2('0x1d')](_0x2bb2('0x43'),_0x4cab5d,_0x561505[_0x2bb2('0x42')]);_0x4bb752[_0x2bb2('0x47')]=_0x2e6288!==_0x2bb2('0x44')?_0x2e6288:util[_0x2bb2('0x45')]('Caller\x20-\x20%s',_0x4cab5d);_0x4bb752[_0x2bb2('0x48')]=_0x2bb2('0x49');}else if(_0x561505[_0x2bb2('0x42')]==='account'){logger[_0x2bb2('0x1d')](_0x2bb2('0x43'),_0x4cab5d,_0x561505[_0x2bb2('0x42')]);_0x4bb752['Name']=_0x2e6288!==_0x2bb2('0x44')?_0x2e6288:util[_0x2bb2('0x45')]('Caller\x20-\x20%s',_0x4cab5d);}else{return null;}}return _0x2c626b[_0x2bb2('0x32')](_[_0x2bb2('0x4a')](_0x561505[_0x2bb2('0x42')]))[_0x2bb2('0x1f')](_0x4bb752)['then'](function(_0x214d08){return BPromise[_0x2bb2('0x27')]({'id':_0x214d08['id'],'endUserType':_0x561505['moduleCreate']});});}});}function getCustomFields(_0x26e6fe,_0x4d2aad){var _0x3df697={};if(_0x26e6fe[_0x2bb2('0x36')]>0x0){_['forEach'](_0x26e6fe,function(_0x44bef4){if(_['includes']([_0x2bb2('0x4b'),'picklist'],_0x44bef4['type'])&&_0x44bef4[_0x2bb2('0x4c')]){_0x3df697[_0x44bef4['idField']]=_0x44bef4[_0x2bb2('0x4d')][_0x2bb2('0x4e')]();}else if(_0x44bef4[_0x2bb2('0x3e')]===_0x2bb2('0x4f')&&_0x44bef4['variableName']&&_0x44bef4[_0x2bb2('0x4c')]){_0x4d2aad[_0x44bef4[_0x2bb2('0x50')]]&&(_0x3df697[_0x44bef4[_0x2bb2('0x4c')]]=_0x4d2aad[_0x44bef4[_0x2bb2('0x50')]][_0x2bb2('0x4e')]());}else if(_0x44bef4['type']===_0x2bb2('0x51')&&_0x44bef4[_0x2bb2('0x52')]&&_0x44bef4[_0x2bb2('0x52')]['name']&&_0x44bef4[_0x2bb2('0x4c')]){_0x4d2aad[_0x44bef4[_0x2bb2('0x52')][_0x2bb2('0x53')][_0x2bb2('0x3f')]()]&&(_0x3df697[_0x44bef4[_0x2bb2('0x4c')]]=_0x4d2aad[_0x44bef4[_0x2bb2('0x52')]['name'][_0x2bb2('0x3f')]()]['toString']());}});}return _0x3df697;}function getConnection(_0x210539){var _0x203cae=_0x210539[_0x2bb2('0x54')][_0x2bb2('0x55')](_0x210539['securityToken']);var _0x4bddc5=new jsforce[(_0x2bb2('0x56'))]({'oauth2':{'loginUrl':_0x210539[_0x2bb2('0x57')]||_0x2bb2('0x58'),'clientId':_0x210539[_0x2bb2('0x59')],'clientSecret':_0x210539[_0x2bb2('0x5a')]}});return _0x4bddc5[_0x2bb2('0x5b')](_0x210539['username'],_0x203cae)[_0x2bb2('0x22')](function(){logger[_0x2bb2('0x1d')](_0x2bb2('0x5c'));return _0x4bddc5;});}exports[_0x2bb2('0x5d')]=function(_0x14abcc,_0xb6e768,_0x4706d0,_0x14d2f9,_0x1013e2,_0x1b1da1){var _0x583f73,_0x53d327,_0x2a2e6d,_0x3f0c06;_0x1b1da1[_0x2bb2('0x5e')]=intUtil[_0x2bb2('0x5f')](_0x1b1da1[_0x2bb2('0x5e')]);_0x1b1da1[_0x2bb2('0x57')]=intUtil[_0x2bb2('0x5f')](_0x1b1da1[_0x2bb2('0x57')]);if(_0x1013e2&&_0x1013e2[_0x2bb2('0x60')]){logger[_0x2bb2('0x1d')](_0x2bb2('0x61'),_0x2bb2('0x62'));_0xb6e768[_0x2bb2('0x63')]=util['format'](_0x2bb2('0x64'),_0x1b1da1[_0x2bb2('0x5e')],_0xb6e768[_0x2bb2('0x65')],md5(_0xb6e768[_0x2bb2('0x65')]));}else{_0xb6e768['recordingURL']='';}return getConnection(_0x1b1da1)[_0x2bb2('0x22')](function(_0x2401eb){_0x3f0c06=_0x2401eb;return getUser(_0x1b1da1,_0x14d2f9[_0x2bb2('0x66')],_0x3f0c06);})[_0x2bb2('0x22')](function(_0x420cce){_0x583f73=_0x420cce;return getEndUser(_0x1b1da1,_0x4706d0,_0xb6e768[_0x2bb2('0x67')],_0xb6e768[_0x2bb2('0x68')],_0x3f0c06);})[_0x2bb2('0x22')](function(_0x3f75bf){_0x53d327=_0x3f75bf;return getTicket(_0x1b1da1,_0x583f73,_0x53d327,_0x4706d0,_0xb6e768,_0x4706d0[_0x2bb2('0x69')],_0x3f0c06,'queue');})[_0x2bb2('0x22')](function(_0x52cc9f){_0x2a2e6d=_0x52cc9f;logger[_0x2bb2('0x1d')](_0x2bb2('0x6a'),_0x2a2e6d['id']);logger[_0x2bb2('0x1d')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x2a2e6d['id'],_0x14d2f9[_0x2bb2('0x53')],_0x1b1da1[_0x2bb2('0x3e')]);switch(_0x1b1da1['type']){case'integrationTab':emit(util[_0x2bb2('0x45')](_0x2bb2('0x6b'),_0x14d2f9[_0x2bb2('0x53')]),_0x2bb2('0x6c'),{'recordId':_0x2a2e6d['id']});break;case _0x2bb2('0x6d'):emit(util[_0x2bb2('0x45')]('user:%s',_0x14d2f9[_0x2bb2('0x53')]),_0x2bb2('0x6e'),{'uri':util[_0x2bb2('0x45')]('%s/%s/e',_0x3f0c06[_0x2bb2('0x6f')],_0x2a2e6d['id'])});break;default:logger['error'](_0x2bb2('0x70'));}})[_0x2bb2('0x71')](function(_0x43dce5){logger[_0x2bb2('0x72')]('[QUEUE]',_0x43dce5);});};exports[_0x2bb2('0x73')]=function(_0x1f3206,_0x2549c9,_0x20295e,_0xbb23ef,_0x450338,_0x20b7de,_0x35d4cf){var _0x15c3a0,_0x556fe9,_0x23bda7,_0xfea2f;_0x20b7de[_0x2bb2('0x5e')]=intUtil[_0x2bb2('0x5f')](_0x20b7de['serverUrl']);_0x20b7de[_0x2bb2('0x57')]=intUtil[_0x2bb2('0x5f')](_0x20b7de['remoteUri']);if(_0x35d4cf&&_0x35d4cf[_0x2bb2('0x74')]&&_0x35d4cf[_0x2bb2('0x74')]!==_0x2bb2('0x75')){logger[_0x2bb2('0x1d')]('[OUTBOUND]',_0x2bb2('0x62'));_0x2549c9['recordingURL']=util['format'](_0x2bb2('0x64'),_0x20b7de[_0x2bb2('0x5e')],_0x2549c9[_0x2bb2('0x65')],md5(_0x2549c9[_0x2bb2('0x65')]));}return getConnection(_0x20b7de)[_0x2bb2('0x22')](function(_0x189b2a){_0xfea2f=_0x189b2a;return getUser(_0x20b7de,_0xbb23ef['email'],_0xfea2f);})['then'](function(_0x417378){_0x15c3a0=_0x417378;return getEndUser(_0x20b7de,_0x20295e,_0x2549c9[_0x2bb2('0x76')],_0x2549c9[_0x2bb2('0x77')],_0xfea2f);})[_0x2bb2('0x22')](function(_0xb78449){_0x556fe9=_0xb78449;return getTicket(_0x20b7de,_0x15c3a0,_0x556fe9,_0x20295e,_0x2549c9,_0x20295e['Fields'],_0xfea2f,_0x2bb2('0x73'));})[_0x2bb2('0x22')](function(_0x3da03f){_0x23bda7=_0x3da03f;logger[_0x2bb2('0x1d')](_0x2bb2('0x78'),_0x23bda7['id']);logger[_0x2bb2('0x1d')](_0x2bb2('0x79'),_0x23bda7['id'],_0xbb23ef[_0x2bb2('0x53')],_0x20b7de['type']);switch(_0x20b7de['type']){case _0x2bb2('0x7a'):emit(util[_0x2bb2('0x45')](_0x2bb2('0x6b'),_0xbb23ef[_0x2bb2('0x53')]),_0x2bb2('0x6c'),{'recordId':_0x23bda7['id']});break;case _0x2bb2('0x6d'):emit(util[_0x2bb2('0x45')]('user:%s',_0xbb23ef[_0x2bb2('0x53')]),_0x2bb2('0x6e'),{'uri':util['format']('%s/%s/e',_0xfea2f[_0x2bb2('0x6f')],_0x23bda7['id'])});break;default:logger[_0x2bb2('0x72')]('[OUTBOUND]',_0x2bb2('0x7b'));}})[_0x2bb2('0x71')](function(_0x3b4781){logger[_0x2bb2('0x72')]('[OUTBOUND]',_0x3b4781);});};exports[_0x2bb2('0x7c')]=function(_0x589c9c,_0x1df041,_0x5576e2,_0x5c439c,_0x4ab270,_0x71f18f){var _0x4b7e04,_0x40fec6,_0x2a838c,_0xa0e011;_0x71f18f[_0x2bb2('0x5e')]=intUtil[_0x2bb2('0x5f')](_0x71f18f[_0x2bb2('0x5e')]);_0x71f18f[_0x2bb2('0x57')]=intUtil[_0x2bb2('0x5f')](_0x71f18f[_0x2bb2('0x57')]);if(_0x4ab270&&_0x4ab270[_0x2bb2('0x60')]){logger[_0x2bb2('0x1d')]('['+_0x1df041[_0x2bb2('0x7d')][_0x2bb2('0x7e')]()+']',_0x2bb2('0x62'));_0x1df041[_0x2bb2('0x63')]=util[_0x2bb2('0x45')](_0x2bb2('0x64'),_0x71f18f[_0x2bb2('0x5e')],_0x1df041[_0x2bb2('0x65')],md5(_0x1df041[_0x2bb2('0x65')]));}else{_0x1df041['recordingURL']='';}return getConnection(_0x71f18f)[_0x2bb2('0x22')](function(_0x4bcfbc){_0xa0e011=_0x4bcfbc;if(!_[_0x2bb2('0x7f')](_0x5c439c)){return getUser(_0x71f18f,_0x5c439c['name'],_0xa0e011);}else{return getUser(_0x71f18f,null,_0xa0e011);}})[_0x2bb2('0x22')](function(_0x51c7c4){_0x4b7e04=_0x51c7c4;return getEndUser(_0x71f18f,_0x5576e2,_0x1df041[_0x2bb2('0x67')],_0x1df041[_0x2bb2('0x68')],_0xa0e011);})['then'](function(_0x131514){_0x40fec6=_0x131514;return getTicket(_0x71f18f,_0x4b7e04,_0x40fec6,_0x5576e2,_0x1df041,_0x5576e2[_0x2bb2('0x69')],_0xa0e011);})[_0x2bb2('0x22')](function(_0x1bf9f2){_0x2a838c=_0x1bf9f2;logger[_0x2bb2('0x1d')]('['+_0x1df041['lastevent'][_0x2bb2('0x7e')]()+_0x2bb2('0x80'),_0x2a838c['id']);logger['info']('['+_0x1df041['lastevent'][_0x2bb2('0x7e')]()+']\x20Integration\x20account\x20type\x20%s.',_0x71f18f[_0x2bb2('0x3e')]);})[_0x2bb2('0x71')](function(_0x34deaa){logger[_0x2bb2('0x72')]('['+_0x1df041[_0x2bb2('0x7d')]['toUpperCase']()+']',_0x34deaa);});}; \ 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 dee7c0d..a6e1e8a 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 _0x4172=['user','true','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','forEach','includes','picklist','type','customField','nameField','toLowerCase','toString','idField','content','variable','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','endUserId','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','serverUrl','%s/api/now/table/','remoteUri','isNil','email','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','util','md5','ioredis','../../../../config/logger','servicenow','redis','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','validateEmail','sys_user?sysparm_query=email%3D','userEmail','],\x20getUser\x20entity','length','userId','],\x20getUser\x20crm','adminId','adminEmail','],\x20createEndUser\x20input\x20crm','POST','endUserNumber'];(function(_0x5a981b,_0x407fb2){var _0x37ed7e=function(_0x11040b){while(--_0x11040b){_0x5a981b['push'](_0x5a981b['shift']());}};_0x37ed7e(++_0x407fb2);}(_0x4172,0xbc));var _0x2417=function(_0x4249d9,_0x54ea10){_0x4249d9=_0x4249d9-0x0;var _0x326fe1=_0x4172[_0x4249d9];return _0x326fe1;};'use strict';var _=require(_0x2417('0x0'));var Promise=require(_0x2417('0x1'));var rp=require('request-promise');var util=require(_0x2417('0x2'));var md5=require(_0x2417('0x3'));var Redis=require(_0x2417('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x2417('0x5'))(_0x2417('0x6'));config[_0x2417('0x7')]=_['defaults'](config['redis'],{'host':_0x2417('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminUser(_0x4fb8ed,_0x355eec,_0x34c75f,_0x29140b,_0x54238f,_0x5dd785){return new Promise(function(_0x13ec0f,_0x10aeb1){var _0x199b0a={'method':_0x2417('0x9'),'uri':_0x29140b+_0x2417('0xa')+'&'+_0x54238f+'&'+_0x5dd785,'auth':_0x355eec,'json':!![]};return rp(_0x199b0a)[_0x2417('0xb')](function(_0x1a13ee){if(_0x1a13ee[_0x2417('0xc')]['length']>0x0){_0x34c75f['adminId']=_0x1a13ee['result'][0x0][_0x2417('0xd')];}logger[_0x2417('0xe')]('['+[_0x4fb8ed[_0x2417('0xf')]()]+_0x2417('0x10'),_0x34c75f);_0x13ec0f(_0x34c75f);})[_0x2417('0x11')](function(_0x3c408b){logger[_0x2417('0x12')]('['+[_0x4fb8ed['toUpperCase']()]+']',_0x3c408b[_0x2417('0x13')]);_0x10aeb1(_0x3c408b[_0x2417('0x13')]);});});}function getUser(_0x42b950,_0x451e3a,_0x501ce0,_0x3a8b19,_0x326630){return function(_0x1138c){logger[_0x2417('0xe')]('['+[_0x42b950[_0x2417('0xf')]()]+'],\x20getUser\x20input\x20crm',_0x1138c);return new Promise(function(_0x1c5b1c,_0x35bfd6){if(intUtil[_0x2417('0x14')](_0x1138c['userEmail'])){var _0x1e45ce={'method':_0x2417('0x9'),'uri':_0x501ce0+_0x2417('0x15')+_0x1138c[_0x2417('0x16')]+'&'+_0x3a8b19+'&'+_0x326630,'auth':_0x451e3a,'json':!![]};logger[_0x2417('0xe')]('['+[_0x42b950['toUpperCase']()]+'],\x20getUser\x20rp\x20obj',_0x1e45ce);return rp(_0x1e45ce)[_0x2417('0xb')](function(_0x13650b){logger['info']('['+[_0x42b950['toUpperCase']()]+_0x2417('0x17'),_0x13650b);if(_0x13650b[_0x2417('0xc')][_0x2417('0x18')]>0x0&&String(_0x13650b[_0x2417('0xc')][0x0]['active'])==='true'){_0x1138c[_0x2417('0x19')]=_0x13650b[_0x2417('0xc')][0x0][_0x2417('0xd')];}else{_0x1138c['userId']=_0x1138c['adminId'];_0x1138c['userEmail']=_0x1138c['adminEmail'];}logger[_0x2417('0xe')]('['+[_0x42b950[_0x2417('0xf')]()]+_0x2417('0x1a'),_0x1138c);_0x1c5b1c(_0x1138c);})[_0x2417('0x11')](function(_0x47ca6b){logger[_0x2417('0x12')]('['+[_0x42b950[_0x2417('0xf')]()]+']',_0x47ca6b[_0x2417('0x13')]);_0x35bfd6(_0x47ca6b[_0x2417('0x13')]);});}else{logger['info']('['+[_0x42b950['toUpperCase']()]+']\x20using\x20admin\x20profile');_0x1138c['userId']=_0x1138c[_0x2417('0x1b')];_0x1138c['userEmail']=_0x1138c[_0x2417('0x1c')];_0x1c5b1c(_0x1138c);}});};}function createEndUser(_0x1a9eb6,_0x5b929c,_0x3fb40c,_0x5c698e,_0x5e7efa){logger[_0x2417('0xe')]('['+[_0x1a9eb6[_0x2417('0xf')]()]+_0x2417('0x1d'),_0x3fb40c);return new Promise(function(_0x1d0095,_0x249dcb){var _0x3f31b8={'method':_0x2417('0x1e'),'uri':_0x5c698e+'sys_user?'+_0x5e7efa,'body':{'user_name':_0x3fb40c[_0x2417('0x1f')],'roles':_0x2417('0x20'),'first_name':_0x3fb40c[_0x2417('0x1f')],'active':_0x2417('0x21'),'date_format':_0x2417('0x22'),'phone':_0x3fb40c[_0x2417('0x1f')]},'auth':_0x5b929c,'json':!![]};return rp(_0x3f31b8)[_0x2417('0xb')](function(_0x3a071f){logger['info']('['+[_0x1a9eb6[_0x2417('0xf')]()]+_0x2417('0x23'),_0x3a071f[_0x2417('0xc')]);_0x3fb40c['endUserId']=_0x3a071f[_0x2417('0xc')][_0x2417('0xd')];_0x1d0095(_0x3fb40c);})[_0x2417('0x11')](function(_0x28e451){logger[_0x2417('0x12')]('['+[_0x1a9eb6['toUpperCase']()]+']',_0x28e451[_0x2417('0x13')]);_0x249dcb(_0x28e451['message']);});});}function getEndUser(_0x5b8fe3,_0x3b86ba,_0x3bb0bd,_0x1919e1,_0x148934){return function(_0x162fea){logger[_0x2417('0xe')]('['+[_0x5b8fe3[_0x2417('0xf')]()]+_0x2417('0x24'),_0x162fea);return new Promise(function(_0x65cae0,_0x157383){var _0x208fb3={'method':_0x2417('0x9'),'uri':_0x3bb0bd+_0x2417('0x25')+_0x162fea[_0x2417('0x1f')]+'&'+_0x1919e1+'&'+_0x148934,'auth':_0x3b86ba,'json':!![]};return rp(_0x208fb3)[_0x2417('0xb')](function(_0x124cef){if(_0x124cef[_0x2417('0xc')][_0x2417('0x18')]>0x0){_0x162fea['endUserId']=_0x124cef[_0x2417('0xc')][0x0]['sys_id'];logger[_0x2417('0xe')]('['+[_0x5b8fe3[_0x2417('0xf')]()]+'],\x20getEndUser\x20crm',_0x162fea);_0x65cae0(_0x162fea);}else{return createEndUser(_0x5b8fe3,_0x3b86ba,_0x162fea,_0x3bb0bd,_0x1919e1)[_0x2417('0xb')](function(_0x94bbea){logger[_0x2417('0xe')]('['+[_0x5b8fe3[_0x2417('0xf')]()]+_0x2417('0x26'),_0x94bbea);_0x65cae0(_0x94bbea);});}})[_0x2417('0x11')](function(_0x68f7c8){logger[_0x2417('0x12')]('['+[_0x5b8fe3['toUpperCase']()]+']',_0x68f7c8[_0x2417('0x13')]);_0x157383(_0x68f7c8[_0x2417('0x13')]);});});};}function getCustomFields(_0x5405d0,_0x126232){var _0x5aa27d={};if(_0x5405d0['length']>0x0){_[_0x2417('0x27')](_0x5405d0,function(_0x1bf4ca){if(_[_0x2417('0x28')](['string',_0x2417('0x29')],_0x1bf4ca[_0x2417('0x2a')])&&_0x1bf4ca['nameField']&&!_0x1bf4ca[_0x2417('0x2b')]){_0x5aa27d[_0x1bf4ca[_0x2417('0x2c')][_0x2417('0x2d')]()]=_0x1bf4ca['content'][_0x2417('0x2e')]();}else if(_[_0x2417('0x28')](['string','picklist'],_0x1bf4ca[_0x2417('0x2a')])&&_0x1bf4ca[_0x2417('0x2f')]&&_0x1bf4ca[_0x2417('0x2b')]){_0x5aa27d[_0x1bf4ca['idField'][_0x2417('0x2d')]()]=_0x1bf4ca[_0x2417('0x30')][_0x2417('0x2e')]();}else if(_0x1bf4ca['type']===_0x2417('0x31')&&_0x1bf4ca[_0x2417('0x32')]&&_0x1bf4ca[_0x2417('0x2f')]&&_0x1bf4ca[_0x2417('0x2b')]){_0x5aa27d[_0x1bf4ca['idField'][_0x2417('0x2d')]()]=_0x126232[_0x1bf4ca[_0x2417('0x32')]][_0x2417('0x2e')]();}else if(_0x1bf4ca['type']==='customVariable'&&_0x1bf4ca[_0x2417('0x33')]&&_0x1bf4ca[_0x2417('0x33')][_0x2417('0x34')]&&_0x1bf4ca[_0x2417('0x2f')]&&_0x1bf4ca[_0x2417('0x2b')]){_0x5aa27d[_0x1bf4ca[_0x2417('0x2f')][_0x2417('0x2d')]()]=_0x126232[_0x1bf4ca[_0x2417('0x33')][_0x2417('0x34')]['toLowerCase']()][_0x2417('0x2e')]();}});}return _0x5aa27d;}function getTicket(_0x4aebb1,_0x2d0043,_0x24e0d1,_0x315755,_0xbd1d1e,_0x5d6a58){return function(_0x259271){logger[_0x2417('0xe')]('['+[_0x4aebb1['toUpperCase']()]+_0x2417('0x35'),_0x259271);return new Promise(function(_0xad8693,_0x34c95f){var _0x587fcd=_0x4aebb1['toLowerCase']()===_0x2417('0x36')?_0x259271['userId']:_0x259271[_0x2417('0x37')];var _0x2402c3={'method':_0x2417('0x1e'),'uri':_0x24e0d1+_0x2417('0x38')+'?'+_0x5d6a58,'body':Object[_0x2417('0x39')]({},{'active':_0x2417('0x21'),'caller_id':_0x587fcd,'assigned_to':_0x259271['userId'],'short_description':intUtil[_0x2417('0x3a')](_0x315755[_0x2417('0x3b')],_0xbd1d1e,'\x20'),'description':intUtil[_0x2417('0x3a')](_0x315755[_0x2417('0x3c')],_0xbd1d1e,'\x0a')},getCustomFields(_0x315755[_0x2417('0x3d')],_0xbd1d1e)),'auth':_0x2d0043,'json':!![]};return rp(_0x2402c3)[_0x2417('0xb')](function(_0x43de2f){logger[_0x2417('0xe')]('['+[_0x4aebb1[_0x2417('0xf')]()]+_0x2417('0x3e'),_0x43de2f[_0x2417('0xc')]);_0x259271[_0x2417('0x3f')]=_0x43de2f[_0x2417('0xc')]['sys_id'];_0x259271[_0x2417('0x40')]=_0x43de2f[_0x2417('0xc')][_0x2417('0x41')];logger[_0x2417('0xe')]('['+[_0x4aebb1['toUpperCase']()]+_0x2417('0x42'),_0x259271);_0xad8693(_0x259271);})[_0x2417('0x11')](function(_0x35b58c){logger[_0x2417('0x12')]('['+[_0x4aebb1[_0x2417('0xf')]()]+']',_0x35b58c['message']);_0x34c95f(_0x35b58c['message']);});});};}function createRemoteTag(_0x4f7457,_0x2eb593,_0x29a833,_0x5cd092){return new Promise(function(_0x253301,_0x24e388){var _0x3ea680={'method':_0x2417('0x1e'),'uri':_0x29a833+_0x2417('0x43')+'?'+_0x5cd092,'body':{'short_description':_0x4f7457,'global':!![],'active':!![],'name':_0x4f7457},'auth':_0x2eb593,'json':!![]};return rp(_0x3ea680)[_0x2417('0xb')](function(_0x544183){var _0x493d08=_0x544183[_0x2417('0xc')][_0x2417('0xd')];_0x253301(_0x493d08);});});}function getRemoteTag(_0x5dae80,_0x3e5cc0,_0x151c62,_0x50bf0b,_0x3143b0){return new Promise(function(_0x3cfe78,_0x27641d){var _0x58043d={'method':'GET','uri':_0x151c62+_0x2417('0x43')+_0x2417('0x44')+_0x5dae80+'&'+_0x50bf0b,'auth':_0x3e5cc0,'json':!![]};return rp(_0x58043d)[_0x2417('0xb')](function(_0x2af57a){if(_0x2af57a[_0x2417('0xc')]['length']>0x0){var _0x485a6c=_0x2af57a[_0x2417('0xc')][0x0][_0x2417('0xd')];_0x3cfe78(_0x485a6c);}else{return createRemoteTag(_0x5dae80,_0x3e5cc0,_0x151c62,_0x50bf0b)[_0x2417('0xb')](function(_0x3bfae5){_0x3cfe78(_0x3bfae5);});}});});}function assignTagToIncident(_0x36bacb,_0x513bb1,_0x46072c,_0x28cd7a,_0x60a7fd){return new Promise(function(_0x300209,_0x5803bc){var _0x5721a0={'method':_0x2417('0x1e'),'uri':_0x46072c+_0x2417('0x45')+'?'+_0x60a7fd,'body':{'label':_0x36bacb,'table':_0x2417('0x38'),'id_type':_0x2417('0x46'),'table_key':_0x28cd7a['ticketId'],'title':_0x2417('0x47')+_0x28cd7a[_0x2417('0x40')],'id_display':_0x28cd7a[_0x2417('0x40')]},'auth':_0x513bb1,'json':!![]};return rp(_0x5721a0)[_0x2417('0xb')](function(_0x246412){_0x300209();})[_0x2417('0x11')](function(){_0x300209();});});}function manageTags(_0x39ab3,_0x2e404b,_0xf6906c,_0x21d051,_0xd62cf2,_0x4b364c,_0x206c5d){return new Promise(function(_0xef4248,_0x549567){var _0x1ae0ff=[];_0x2e404b['forEach'](function(_0x25f831){_0x1ae0ff[_0x2417('0x48')](getRemoteTag(_0x25f831,_0xf6906c,_0x21d051,_0x4b364c,_0x206c5d));});return Promise[_0x2417('0x49')](_0x1ae0ff)[_0x2417('0xb')](function(_0xd84430){if(_0xd84430['length']){logger['info']('['+[_0x39ab3[_0x2417('0xf')]()]+_0x2417('0x4a'),_0xd84430);var _0x4b0815=[];_0xd84430[_0x2417('0x27')](function(_0x4711b5){_0x4b0815[_0x2417('0x48')](assignTagToIncident(_0x4711b5,_0xf6906c,_0x21d051,_0xd62cf2,_0x4b364c));});return Promise[_0x2417('0x49')](_0x4b0815)[_0x2417('0xb')](function(){_0xef4248();})[_0x2417('0x11')](function(){_0xef4248();});}else{_0xef4248();}});});}function getTags(_0x5b1eab,_0x4deab1,_0x49ad4c,_0x596b26,_0x3dbe85,_0xef2168){return function(_0x28d923){return new Promise(function(_0x3459b,_0x2f0d49){var _0x45c8c8=[];var _0x5e90a4=_0x596b26[_0x2417('0x4b')];if(_0x5e90a4&&_0x5e90a4['length']>0x0){_0x45c8c8=_[_0x2417('0x4c')](_0x5e90a4,'name');}if(_0x45c8c8[_0x2417('0x18')]>0x0){return manageTags(_0x5b1eab,_0x45c8c8,_0x4deab1,_0x49ad4c,_0x28d923,_0x3dbe85,_0xef2168)['then'](function(){_0x3459b(_0x28d923);});}else{_0x3459b(_0x28d923);}});};}function emit(_0x11c559,_0x45cdd7,_0x3d81c8){var _0x37af21=_0x2417('0x4d')+_0x2417('0x4e')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x2417('0x4f');var _0xadca04={'uri':_0x11c559+_0x2417('0x50')+_0x3d81c8+_0x37af21};io['to'](util[_0x2417('0x51')](_0x2417('0x52'),_0x45cdd7))[_0x2417('0x53')](_0x2417('0x54'),_0xadca04);}exports['cs']=function(_0x17bf3b,_0x5a0f51,_0x256a97,_0x2ee13c,_0x5c0667,_0x4f65ae,_0x5504ae,_0x57e2ea){var _0x552827={};var _0x194143={'user':_0x4f65ae[_0x2417('0x55')],'pass':_0x4f65ae[_0x2417('0x56')]};var _0x43df7a=_0x2417('0x57');var _0x311b26=_0x2417('0x58');_0x4f65ae['remoteUri']=intUtil[_0x2417('0x59')](_0x4f65ae['remoteUri']);_0x4f65ae[_0x2417('0x5a')]=intUtil['stripTrailingSlash'](_0x4f65ae['serverUrl']);var _0x44b038=util[_0x2417('0x51')](_0x2417('0x5b'),_0x4f65ae[_0x2417('0x5c')]);_0x552827['userEmail']=!_[_0x2417('0x5d')](_0x2ee13c)?_0x2ee13c[_0x2417('0x5e')]:null;_0x552827['adminEmail']=_0x4f65ae[_0x2417('0x5e')];_0x552827['endUserNumber']=_0x57e2ea[_0x2417('0x2d')]()===_0x2417('0x36')?_0x5a0f51['destcalleridnum']:_0x5a0f51['calleridnum'];_0x552827[_0x2417('0x5f')]=_0x57e2ea==='queue'||_0x57e2ea===_0x2417('0x60')?_0x2417('0x61'):'outbound';var _0x5f83da=util[_0x2417('0x51')](_0x2417('0x62'),_0x4f65ae[_0x2417('0x5a')],_0x5a0f51[_0x2417('0x63')],md5(_0x5a0f51[_0x2417('0x63')]));if(_0x5c0667&&_0x5c0667[_0x2417('0x64')]){logger[_0x2417('0xe')](_0x2417('0x65'),'Recording\x20is\x20enabled!');_0x5a0f51[_0x2417('0x66')]=_0x5f83da;}else if(_0x5504ae&&_0x5504ae[_0x2417('0x67')]&&_0x5504ae['recordingFormat']!=='none'){logger['info'](_0x2417('0x68'),'Recording\x20is\x20enabled!');_0x5a0f51[_0x2417('0x66')]=_0x5f83da;}else{_0x5a0f51[_0x2417('0x66')]='';}return getAdminUser(_0x57e2ea,_0x194143,_0x552827,_0x44b038,_0x311b26,_0x43df7a)[_0x2417('0xb')](getUser(_0x57e2ea,_0x194143,_0x44b038,_0x311b26,_0x43df7a))[_0x2417('0xb')](getEndUser(_0x57e2ea,_0x194143,_0x44b038,_0x311b26,_0x43df7a))[_0x2417('0xb')](getTicket(_0x57e2ea,_0x194143,_0x44b038,_0x256a97,_0x5a0f51,_0x311b26))['then'](function(_0x1bb72f){logger[_0x2417('0xe')](util['format'](_0x2417('0x69'),_0x1bb72f[_0x2417('0x3f')]));logger[_0x2417('0xe')](util['format'](_0x2417('0x6a'),_0x57e2ea));if(_0x57e2ea!==_0x2417('0x60')){logger[_0x2417('0xe')]('['+[_0x57e2ea['toUpperCase']()]+']',_0x2417('0x6b'));emit(_0x4f65ae[_0x2417('0x5c')],_0x2ee13c[_0x2417('0x34')],_0x1bb72f[_0x2417('0x3f')]);}})[_0x2417('0x11')](function(_0x2136e0){logger['error']('['+[_0x57e2ea['toUpperCase']()]+_0x2417('0x6c'),util[_0x2417('0x6d')](_0x2136e0,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x595a=['type','nameField','customField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','name','outbound','POST','incident','assign','getString','Descriptions','Fields','ticketId','ticketNumber',']\x20getTicket\x20crm','label','label_entry','Incident','Incident\x20-\x20','all','push','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','user:%s','emit','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','format','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','md5','ioredis','./util','../../../../config/environment','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','true','userId','adminEmail','],\x20getUser\x20crm','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x595a,0x16f));var _0xa595=function(_0x81fe53,_0x5b8f05){_0x81fe53=_0x81fe53-0x0;var _0x56f7a7=_0x595a[_0x81fe53];return _0x56f7a7;};'use strict';var _=require(_0xa595('0x0'));var Promise=require(_0xa595('0x1'));var rp=require(_0xa595('0x2'));var util=require('util');var md5=require(_0xa595('0x3'));var Redis=require(_0xa595('0x4'));var intUtil=require(_0xa595('0x5'));var config=require(_0xa595('0x6'));var logger=require('../../../../config/logger')(_0xa595('0x7'));config[_0xa595('0x8')]=_[_0xa595('0x9')](config[_0xa595('0x8')],{'host':_0xa595('0xa'),'port':0x18eb});var io=require(_0xa595('0xb'))(new Redis(config[_0xa595('0x8')]));function getAdminUser(_0x36d6e2,_0x1814a2,_0x760332,_0x1ea4cc,_0x41ec7a,_0x1f3227){return new Promise(function(_0x3754da,_0x53f0e0){var _0x1e7069={'method':_0xa595('0xc'),'uri':_0x1ea4cc+_0xa595('0xd')+'&'+_0x41ec7a+'&'+_0x1f3227,'auth':_0x1814a2,'json':!![]};return rp(_0x1e7069)[_0xa595('0xe')](function(_0x300635){if(_0x300635[_0xa595('0xf')][_0xa595('0x10')]>0x0){_0x760332[_0xa595('0x11')]=_0x300635[_0xa595('0xf')][0x0][_0xa595('0x12')];}logger[_0xa595('0x13')]('['+[_0x36d6e2[_0xa595('0x14')]()]+_0xa595('0x15'),_0x760332);_0x3754da(_0x760332);})[_0xa595('0x16')](function(_0x29aff6){logger[_0xa595('0x17')]('['+[_0x36d6e2[_0xa595('0x14')]()]+']',_0x29aff6[_0xa595('0x18')]);_0x53f0e0(_0x29aff6[_0xa595('0x18')]);});});}function getUser(_0x5d340f,_0x42b651,_0x4426a3,_0x546124,_0x14a13d){return function(_0x5c27de){logger[_0xa595('0x13')]('['+[_0x5d340f[_0xa595('0x14')]()]+'],\x20getUser\x20input\x20crm',_0x5c27de);return new Promise(function(_0x310464,_0x5ea60b){if(intUtil[_0xa595('0x19')](_0x5c27de[_0xa595('0x1a')])){var _0x2245b8={'method':'GET','uri':_0x4426a3+'sys_user?sysparm_query=email%3D'+_0x5c27de['userEmail']+'&'+_0x546124+'&'+_0x14a13d,'auth':_0x42b651,'json':!![]};logger[_0xa595('0x13')]('['+[_0x5d340f[_0xa595('0x14')]()]+_0xa595('0x1b'),_0x2245b8);return rp(_0x2245b8)[_0xa595('0xe')](function(_0x1c66e6){logger['info']('['+[_0x5d340f[_0xa595('0x14')]()]+_0xa595('0x1c'),_0x1c66e6);if(_0x1c66e6['result'][_0xa595('0x10')]>0x0&&String(_0x1c66e6[_0xa595('0xf')][0x0]['active'])===_0xa595('0x1d')){_0x5c27de[_0xa595('0x1e')]=_0x1c66e6[_0xa595('0xf')][0x0][_0xa595('0x12')];}else{_0x5c27de[_0xa595('0x1e')]=_0x5c27de[_0xa595('0x11')];_0x5c27de['userEmail']=_0x5c27de[_0xa595('0x1f')];}logger[_0xa595('0x13')]('['+[_0x5d340f[_0xa595('0x14')]()]+_0xa595('0x20'),_0x5c27de);_0x310464(_0x5c27de);})['catch'](function(_0x229f9f){logger[_0xa595('0x17')]('['+[_0x5d340f[_0xa595('0x14')]()]+']',_0x229f9f[_0xa595('0x18')]);_0x5ea60b(_0x229f9f['message']);});}else{logger['info']('['+[_0x5d340f[_0xa595('0x14')]()]+']\x20using\x20admin\x20profile');_0x5c27de[_0xa595('0x1e')]=_0x5c27de[_0xa595('0x11')];_0x5c27de[_0xa595('0x1a')]=_0x5c27de[_0xa595('0x1f')];_0x310464(_0x5c27de);}});};}function createEndUser(_0x1e4f1e,_0x103979,_0x278f54,_0x22ad18,_0x11675f){logger[_0xa595('0x13')]('['+[_0x1e4f1e[_0xa595('0x14')]()]+_0xa595('0x21'),_0x278f54);return new Promise(function(_0x1367fa,_0x33b782){var _0x570b6a={'method':'POST','uri':_0x22ad18+_0xa595('0x22')+_0x11675f,'body':{'user_name':_0x278f54['endUserNumber'],'roles':'user','first_name':_0x278f54['endUserNumber'],'active':_0xa595('0x1d'),'date_format':'System','phone':_0x278f54[_0xa595('0x23')]},'auth':_0x103979,'json':!![]};return rp(_0x570b6a)[_0xa595('0xe')](function(_0x589018){logger[_0xa595('0x13')]('['+[_0x1e4f1e['toUpperCase']()]+_0xa595('0x24'),_0x589018[_0xa595('0xf')]);_0x278f54[_0xa595('0x25')]=_0x589018['result'][_0xa595('0x12')];_0x1367fa(_0x278f54);})[_0xa595('0x16')](function(_0x4406ac){logger[_0xa595('0x17')]('['+[_0x1e4f1e['toUpperCase']()]+']',_0x4406ac[_0xa595('0x18')]);_0x33b782(_0x4406ac[_0xa595('0x18')]);});});}function getEndUser(_0x71a59,_0x19b2ea,_0x1d572e,_0x3af7fa,_0x29d4b1){return function(_0x5dfa1b){logger['info']('['+[_0x71a59[_0xa595('0x14')]()]+_0xa595('0x26'),_0x5dfa1b);return new Promise(function(_0x4d2885,_0x1ee58a){var _0x128f2a={'method':_0xa595('0xc'),'uri':_0x1d572e+'sys_user?sysparm_query=phone%3D'+_0x5dfa1b['endUserNumber']+'&'+_0x3af7fa+'&'+_0x29d4b1,'auth':_0x19b2ea,'json':!![]};return rp(_0x128f2a)[_0xa595('0xe')](function(_0x271be0){if(_0x271be0['result']['length']>0x0){_0x5dfa1b[_0xa595('0x25')]=_0x271be0['result'][0x0][_0xa595('0x12')];logger[_0xa595('0x13')]('['+[_0x71a59['toUpperCase']()]+_0xa595('0x27'),_0x5dfa1b);_0x4d2885(_0x5dfa1b);}else{return createEndUser(_0x71a59,_0x19b2ea,_0x5dfa1b,_0x1d572e,_0x3af7fa)[_0xa595('0xe')](function(_0x2f0739){logger[_0xa595('0x13')]('['+[_0x71a59['toUpperCase']()]+_0xa595('0x28'),_0x2f0739);_0x4d2885(_0x2f0739);});}})[_0xa595('0x16')](function(_0x247185){logger[_0xa595('0x17')]('['+[_0x71a59[_0xa595('0x14')]()]+']',_0x247185[_0xa595('0x18')]);_0x1ee58a(_0x247185['message']);});});};}function getCustomFields(_0x355de8,_0x16b5eb){var _0x543c62={};if(_0x355de8[_0xa595('0x10')]>0x0){_[_0xa595('0x29')](_0x355de8,function(_0x1d20a6){if(_[_0xa595('0x2a')]([_0xa595('0x2b'),_0xa595('0x2c')],_0x1d20a6[_0xa595('0x2d')])&&_0x1d20a6[_0xa595('0x2e')]&&!_0x1d20a6[_0xa595('0x2f')]){_0x543c62[_0x1d20a6[_0xa595('0x2e')][_0xa595('0x30')]()]=_0x1d20a6[_0xa595('0x31')][_0xa595('0x32')]();}else if(_[_0xa595('0x2a')]([_0xa595('0x2b'),_0xa595('0x2c')],_0x1d20a6[_0xa595('0x2d')])&&_0x1d20a6[_0xa595('0x33')]&&_0x1d20a6[_0xa595('0x2f')]){_0x543c62[_0x1d20a6[_0xa595('0x33')][_0xa595('0x30')]()]=_0x1d20a6['content']['toString']();}else if(_0x1d20a6[_0xa595('0x2d')]===_0xa595('0x34')&&_0x1d20a6[_0xa595('0x35')]&&_0x1d20a6[_0xa595('0x33')]&&_0x1d20a6['customField']){_0x543c62[_0x1d20a6['idField']['toLowerCase']()]=_0x16b5eb[_0x1d20a6[_0xa595('0x35')]]['toString']();}else if(_0x1d20a6[_0xa595('0x2d')]===_0xa595('0x36')&&_0x1d20a6[_0xa595('0x37')]&&_0x1d20a6[_0xa595('0x37')][_0xa595('0x38')]&&_0x1d20a6[_0xa595('0x33')]&&_0x1d20a6[_0xa595('0x2f')]){_0x543c62[_0x1d20a6[_0xa595('0x33')][_0xa595('0x30')]()]=_0x16b5eb[_0x1d20a6[_0xa595('0x37')][_0xa595('0x38')]['toLowerCase']()][_0xa595('0x32')]();}});}return _0x543c62;}function getTicket(_0x250023,_0x1167fe,_0x4b64c9,_0x1cfe26,_0x4fac63,_0x4dc2b6){return function(_0x235ebc){logger[_0xa595('0x13')]('['+[_0x250023[_0xa595('0x14')]()]+']\x20getTicket\x20input\x20crm',_0x235ebc);return new Promise(function(_0x6c988,_0x17e62b){var _0x336477=_0x250023['toLowerCase']()===_0xa595('0x39')?_0x235ebc['userId']:_0x235ebc['endUserId'];var _0x4917bb={'method':_0xa595('0x3a'),'uri':_0x4b64c9+_0xa595('0x3b')+'?'+_0x4dc2b6,'body':Object[_0xa595('0x3c')]({},{'active':_0xa595('0x1d'),'caller_id':_0x336477,'assigned_to':_0x235ebc[_0xa595('0x1e')],'short_description':intUtil[_0xa595('0x3d')](_0x1cfe26['Subjects'],_0x4fac63,'\x20'),'description':intUtil['getString'](_0x1cfe26[_0xa595('0x3e')],_0x4fac63,'\x0a')},getCustomFields(_0x1cfe26[_0xa595('0x3f')],_0x4fac63)),'auth':_0x1167fe,'json':!![]};return rp(_0x4917bb)[_0xa595('0xe')](function(_0x203c42){logger[_0xa595('0x13')]('['+[_0x250023[_0xa595('0x14')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x203c42[_0xa595('0xf')]);_0x235ebc[_0xa595('0x40')]=_0x203c42[_0xa595('0xf')][_0xa595('0x12')];_0x235ebc[_0xa595('0x41')]=_0x203c42[_0xa595('0xf')]['number'];logger[_0xa595('0x13')]('['+[_0x250023[_0xa595('0x14')]()]+_0xa595('0x42'),_0x235ebc);_0x6c988(_0x235ebc);})[_0xa595('0x16')](function(_0x33522e){logger[_0xa595('0x17')]('['+[_0x250023['toUpperCase']()]+']',_0x33522e[_0xa595('0x18')]);_0x17e62b(_0x33522e['message']);});});};}function createRemoteTag(_0x1fe80f,_0x10fb8e,_0x531a0a,_0x1f2cdf){return new Promise(function(_0x3c0a4e,_0xfdd863){var _0x4010b5={'method':_0xa595('0x3a'),'uri':_0x531a0a+_0xa595('0x43')+'?'+_0x1f2cdf,'body':{'short_description':_0x1fe80f,'global':!![],'active':!![],'name':_0x1fe80f},'auth':_0x10fb8e,'json':!![]};return rp(_0x4010b5)[_0xa595('0xe')](function(_0xf36335){var _0x369c93=_0xf36335['result']['sys_id'];_0x3c0a4e(_0x369c93);});});}function getRemoteTag(_0x297912,_0xd7e09c,_0xe95ac9,_0x31ecec,_0x41023d){return new Promise(function(_0x1e7278,_0xd46421){var _0x1c9e03={'method':'GET','uri':_0xe95ac9+'label'+'?sysparm_query=name%3D'+_0x297912+'&'+_0x31ecec,'auth':_0xd7e09c,'json':!![]};return rp(_0x1c9e03)['then'](function(_0x71e0ce){if(_0x71e0ce[_0xa595('0xf')][_0xa595('0x10')]>0x0){var _0x5235bd=_0x71e0ce[_0xa595('0xf')][0x0][_0xa595('0x12')];_0x1e7278(_0x5235bd);}else{return createRemoteTag(_0x297912,_0xd7e09c,_0xe95ac9,_0x31ecec)[_0xa595('0xe')](function(_0x39adf9){_0x1e7278(_0x39adf9);});}});});}function assignTagToIncident(_0x8da230,_0x104bd7,_0x3b81b9,_0x4c8fe5,_0x308cf5){return new Promise(function(_0x1fe34b,_0x113b68){var _0x52e0e9={'method':_0xa595('0x3a'),'uri':_0x3b81b9+_0xa595('0x44')+'?'+_0x308cf5,'body':{'label':_0x8da230,'table':_0xa595('0x3b'),'id_type':_0xa595('0x45'),'table_key':_0x4c8fe5[_0xa595('0x40')],'title':_0xa595('0x46')+_0x4c8fe5[_0xa595('0x41')],'id_display':_0x4c8fe5[_0xa595('0x41')]},'auth':_0x104bd7,'json':!![]};return rp(_0x52e0e9)['then'](function(_0x1dadb0){_0x1fe34b();})[_0xa595('0x16')](function(){_0x1fe34b();});});}function manageTags(_0x12b6d0,_0x184239,_0x42f9fb,_0xfee900,_0x35b807,_0xe77d0e,_0x139e85){return new Promise(function(_0x12d204,_0x4d8957){var _0x10f108=[];_0x184239[_0xa595('0x29')](function(_0x5f1bd7){_0x10f108['push'](getRemoteTag(_0x5f1bd7,_0x42f9fb,_0xfee900,_0xe77d0e,_0x139e85));});return Promise[_0xa595('0x47')](_0x10f108)[_0xa595('0xe')](function(_0xdb3717){if(_0xdb3717[_0xa595('0x10')]){logger['info']('['+[_0x12b6d0[_0xa595('0x14')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0xdb3717);var _0x13bcc2=[];_0xdb3717[_0xa595('0x29')](function(_0x464a5f){_0x13bcc2[_0xa595('0x48')](assignTagToIncident(_0x464a5f,_0x42f9fb,_0xfee900,_0x35b807,_0xe77d0e));});return Promise[_0xa595('0x47')](_0x13bcc2)['then'](function(){_0x12d204();})[_0xa595('0x16')](function(){_0x12d204();});}else{_0x12d204();}});});}function getTags(_0x2a03b5,_0x575c88,_0x1eddf9,_0x30cb0c,_0xbc7f1b,_0x1200ac){return function(_0x3d9882){return new Promise(function(_0x4748d6,_0x594c99){var _0xa12138=[];var _0x40842e=_0x30cb0c[_0xa595('0x49')];if(_0x40842e&&_0x40842e[_0xa595('0x10')]>0x0){_0xa12138=_['map'](_0x40842e,_0xa595('0x38'));}if(_0xa12138['length']>0x0){return manageTags(_0x2a03b5,_0xa12138,_0x575c88,_0x1eddf9,_0x3d9882,_0xbc7f1b,_0x1200ac)[_0xa595('0xe')](function(){_0x4748d6(_0x3d9882);});}else{_0x4748d6(_0x3d9882);}});};}function emit(_0x23b30f,_0x3d298f,_0xae5843){var _0x198620=_0xa595('0x4a')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xa595('0x4b')+'%255EORDERBYDESCnumber';var _0x3d4772={'uri':_0x23b30f+'/nav_to.do?uri=incident.do?sys_id%3D'+_0xae5843+_0x198620};io['to'](util['format'](_0xa595('0x4c'),_0x3d298f))[_0xa595('0x4d')]('trigger:browser:url',_0x3d4772);}exports['cs']=function(_0x16db42,_0x48d74c,_0x45250d,_0x3c3352,_0xd9b1fb,_0x4fe95a,_0x23eaf9,_0x2fe7cd){var _0x2d6a79={};var _0x443c31={'user':_0x4fe95a['username'],'pass':_0x4fe95a[_0xa595('0x4e')]};var _0x2e623f=_0xa595('0x4f');var _0x587bd4=_0xa595('0x50');_0x4fe95a[_0xa595('0x51')]=intUtil[_0xa595('0x52')](_0x4fe95a[_0xa595('0x51')]);_0x4fe95a[_0xa595('0x53')]=intUtil[_0xa595('0x52')](_0x4fe95a['serverUrl']);var _0x532e88=util['format'](_0xa595('0x54'),_0x4fe95a[_0xa595('0x51')]);_0x2d6a79[_0xa595('0x1a')]=!_[_0xa595('0x55')](_0x3c3352)?_0x3c3352[_0xa595('0x56')]:null;_0x2d6a79[_0xa595('0x1f')]=_0x4fe95a[_0xa595('0x56')];_0x2d6a79[_0xa595('0x23')]=_0x2fe7cd[_0xa595('0x30')]()===_0xa595('0x39')?_0x48d74c[_0xa595('0x57')]:_0x48d74c[_0xa595('0x58')];_0x2d6a79[_0xa595('0x59')]=_0x2fe7cd===_0xa595('0x5a')||_0x2fe7cd===_0xa595('0x5b')?_0xa595('0x5a'):'outbound';var _0x33c12c=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4fe95a[_0xa595('0x53')],_0x48d74c[_0xa595('0x5c')],md5(_0x48d74c['uniqueid']));if(_0xd9b1fb&&_0xd9b1fb[_0xa595('0x5d')]){logger[_0xa595('0x13')]('[QUEUE]',_0xa595('0x5e'));_0x48d74c[_0xa595('0x5f')]=_0x33c12c;}else if(_0x23eaf9&&_0x23eaf9[_0xa595('0x60')]&&_0x23eaf9['recordingFormat']!=='none'){logger['info'](_0xa595('0x61'),_0xa595('0x5e'));_0x48d74c[_0xa595('0x5f')]=_0x33c12c;}else{_0x48d74c[_0xa595('0x5f')]='';}return getAdminUser(_0x2fe7cd,_0x443c31,_0x2d6a79,_0x532e88,_0x587bd4,_0x2e623f)[_0xa595('0xe')](getUser(_0x2fe7cd,_0x443c31,_0x532e88,_0x587bd4,_0x2e623f))[_0xa595('0xe')](getEndUser(_0x2fe7cd,_0x443c31,_0x532e88,_0x587bd4,_0x2e623f))[_0xa595('0xe')](getTicket(_0x2fe7cd,_0x443c31,_0x532e88,_0x45250d,_0x48d74c,_0x587bd4))[_0xa595('0xe')](function(_0x24909e){logger[_0xa595('0x13')](util[_0xa595('0x62')](_0xa595('0x63'),_0x24909e['ticketId']));logger[_0xa595('0x13')](util[_0xa595('0x62')]('call\x20direction:\x20%s',_0x2fe7cd));if(_0x2fe7cd!==_0xa595('0x5b')){logger['info']('['+[_0x2fe7cd['toUpperCase']()]+']',_0xa595('0x64'));emit(_0x4fe95a[_0xa595('0x51')],_0x3c3352['name'],_0x24909e[_0xa595('0x40')]);}})[_0xa595('0x16')](function(_0x401c83){logger[_0xa595('0x17')]('['+[_0x2fe7cd[_0xa595('0x14')]()]+_0xa595('0x65'),util[_0xa595('0x66')](_0x401c83,{'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 6f0f7fe..23d6022 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 _0x1029=['../../../../config/logger','sugarcrm','redis','defaults','socket.io-emitter','POST','emit','Creating\x20new\x20ticket...','name','getString','Subjects','created_by','Descriptions','toISOString','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','length','forEach','variableName','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','then','entry_list','value','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','user_name','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','map','type','string','nameField','toLowerCase','content','idField','custom_fields','variable','customField','push','Variable','username','password','PLAIN','sessionID','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','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','destcalleridnum','Fields','Outbound','[OUTBOUND]','trigger:browser:url','toUpperCase','lodash','request-promise','bluebird','md5','util','./util','../../../../config/environment'];(function(_0x31d040,_0x46742e){var _0xf4812a=function(_0x3e1d93){while(--_0x3e1d93){_0x31d040['push'](_0x31d040['shift']());}};_0xf4812a(++_0x46742e);}(_0x1029,0x1d5));var _0x9102=function(_0x339d0a,_0x152d67){_0x339d0a=_0x339d0a-0x0;var _0x7f1818=_0x1029[_0x339d0a];return _0x7f1818;};'use strict';var _=require(_0x9102('0x0'));var rp=require(_0x9102('0x1'));var BPromise=require(_0x9102('0x2'));var md5=require(_0x9102('0x3'));var util=require(_0x9102('0x4'));var Redis=require('ioredis');var intUtil=require(_0x9102('0x5'));var config=require(_0x9102('0x6'));var logger=require(_0x9102('0x7'))(_0x9102('0x8'));config[_0x9102('0x9')]=_[_0x9102('0xa')](config[_0x9102('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x9102('0xb'))(new Redis(config[_0x9102('0x9')]));var def={'method':_0x9102('0xc'),'json':!![]};function emit(_0x1bd006,_0x26ba77,_0x2bbf92){io['to'](_0x1bd006)[_0x9102('0xd')](_0x26ba77,_0x2bbf92);}function getTicket(_0x317dce,_0x49a820,_0x1c3893,_0x1673f1,_0x133eaa,_0x1c1c2e,_0x22494a,_0x3c6556){logger['info'](_0x9102('0xe'));var _0x1c65ef=new Date();var _0x28b7bc=[{'name':_0x9102('0xf'),'value':intUtil[_0x9102('0x10')](_0x1673f1[_0x9102('0x11')],_0x133eaa,'\x20')},{'name':'assigned_user_id','value':_0x49a820['id']},{'name':_0x9102('0x12'),'value':_0x49a820['id']},{'name':'description','value':intUtil[_0x9102('0x10')](_0x1673f1[_0x9102('0x13')],_0x133eaa,'\x0a')},{'name':'date_start','value':_0x1c65ef[_0x9102('0x14')]()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0x9102('0x15'),'value':'0'},{'name':_0x9102('0x16'),'value':'15'},{'name':_0x9102('0x17'),'value':_0x1c3893['id']},{'name':_0x9102('0x18'),'value':_0x9102('0x19')},{'name':_0x9102('0x1a'),'value':_0x1c3893[_0x9102('0xf')]},{'name':'direction','value':_0x3c6556}];if(_0x1c1c2e[_0x9102('0x1b')]){_[_0x9102('0x1c')](_0x1c1c2e,function(_0x27a5bf){if(_0x133eaa[_0x27a5bf[_0x9102('0x1d')]]){_0x28b7bc['push']({'name':_0x27a5bf['idField'],'value':_0x133eaa[_0x27a5bf['variableName']]});}});}return request({'form':{'method':_0x9102('0x1e'),'input_type':'JSON','response_type':_0x9102('0x1f'),'rest_data':JSON[_0x9102('0x20')]({'session':_0x22494a['id'],'module_name':'Calls','name_value_list':_0x28b7bc})}});}function getAuth(_0x7d987b){return util[_0x9102('0x21')](_0x9102('0x22'),new Buffer(_0x7d987b[_0x9102('0x23')]+':X')[_0x9102('0x24')](_0x9102('0x25')));}function getServerInfo(_0x4425c3){return request({'form':{'method':_0x9102('0x26'),'input_type':_0x9102('0x1f'),'response_type':_0x9102('0x1f'),'rest_data':JSON[_0x9102('0x20')]({'session':_0x4425c3['id']})}});}function getUser(_0x27232f,_0x31a19f,_0x1b9c43){if(!_[_0x9102('0x27')](_0x31a19f)){logger[_0x9102('0x28')](_0x9102('0x29'),_0x31a19f);return request({'form':{'method':_0x9102('0x2a'),'input_type':_0x9102('0x1f'),'response_type':_0x9102('0x1f'),'rest_data':JSON[_0x9102('0x20')]({'session':_0x1b9c43['id'],'module_name':_0x9102('0x2b'),'query':util['format']('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x31a19f),'order_by':'','offset':'0','select_fields':['id',_0x9102('0xf'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9102('0x2c')](function(_0x1e7301){if(_0x1e7301[_0x9102('0x2d')][_0x9102('0x1b')]){var _0x1357f8=_['find'](_0x1e7301['entry_list'],function(_0x24b78c){return _0x24b78c['name_value_list']['user_name'][_0x9102('0x2e')]===_0x31a19f;});if(_0x1357f8){logger[_0x9102('0x28')]('Agent\x20found!');return BPromise[_0x9102('0x2f')]({'id':_0x1357f8['name_value_list']['id'][_0x9102('0x2e')],'name':_0x1357f8[_0x9102('0x30')][_0x9102('0xf')][_0x9102('0x2e')]});}}logger[_0x9102('0x28')](_0x9102('0x31'));return BPromise[_0x9102('0x2f')]({'id':_0x1b9c43['name_value_list'][_0x9102('0x32')][_0x9102('0x2e')],'name':_0x1b9c43[_0x9102('0x30')][_0x9102('0x33')]['value']});});}else{logger[_0x9102('0x28')](_0x9102('0x34'));return BPromise['resolve']({'id':_0x1b9c43[_0x9102('0x30')][_0x9102('0x32')][_0x9102('0x2e')],'name':_0x1b9c43[_0x9102('0x30')][_0x9102('0x33')]['value']});}}function getEndUser(_0x255b17,_0x19e255,_0x1a4ac8,_0x5f22f3){logger['info'](_0x9102('0x35'),_0x1a4ac8);return request({'form':{'method':'get_entry_list','input_type':_0x9102('0x1f'),'response_type':_0x9102('0x1f'),'rest_data':JSON['stringify']({'session':_0x5f22f3['id'],'module_name':'Contacts','query':util['format'](_0x9102('0x36'),_0x1a4ac8),'order_by':'','offset':'0','select_fields':['id','name',_0x9102('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9102('0x2c')](function(_0x25f6cd){if(_0x25f6cd[_0x9102('0x2d')][_0x9102('0x1b')]){var _0x45aa0d=_[_0x9102('0x38')](_0x25f6cd[_0x9102('0x2d')],function(_0x2f5444){return _0x2f5444[_0x9102('0x30')][_0x9102('0x37')][_0x9102('0x2e')]===_0x1a4ac8;});if(_0x45aa0d){logger[_0x9102('0x28')](_0x9102('0x39'));return BPromise['resolve']({'id':_0x45aa0d['name_value_list']['id'][_0x9102('0x2e')],'name':_0x45aa0d['name_value_list']['name']['value'],'phone':_0x45aa0d['name_value_list'][_0x9102('0x37')]['value']});}}else{logger[_0x9102('0x28')](_0x9102('0x3a'));return request({'form':{'method':_0x9102('0x1e'),'input_type':_0x9102('0x1f'),'response_type':_0x9102('0x1f'),'rest_data':JSON['stringify']({'session':_0x5f22f3['id'],'module_name':'Contacts','name_value_list':[{'name':_0x9102('0x3b'),'value':_0x19e255!==_0x9102('0x3c')?_0x19e255:util[_0x9102('0x21')](_0x9102('0x3d'),_0x1a4ac8)},{'name':'phone_home','value':_0x1a4ac8}]})}})['then'](function(_0xe35879){logger[_0x9102('0x28')](_0x9102('0x3e'));return BPromise[_0x9102('0x2f')]({'id':_0xe35879['id'],'name':_0xe35879['entry_list'][_0x9102('0x3b')][_0x9102('0x2e')],'phone':_0xe35879['entry_list'][_0x9102('0x37')][_0x9102('0x2e')]});});}});}function request(_0x542aa0){logger[_0x9102('0x3f')](_0x9102('0x40'),JSON[_0x9102('0x20')](_0x542aa0));return rp(_['merge'](def,_0x542aa0));}function getTags(_0x2b6df4,_0x1d81e2){var _0x41e902=[];if(_0x2b6df4&&_0x2b6df4[_0x9102('0x1b')]>0x0){_0x41e902=_[_0x9102('0x41')](_0x2b6df4,_0x1d81e2);}return _0x41e902;}function getCustomFields(_0x5449bf,_0x2163d8){var _0x5be83c=[];var _0x21efc0={'custom_fields':[]};if(_0x5449bf[_0x9102('0x1b')]>0x0){_[_0x9102('0x1c')](_0x5449bf,function(_0x7f49c8){if(_0x7f49c8[_0x9102('0x42')]===_0x9102('0x43')&&_0x7f49c8[_0x9102('0x44')]&&!_0x7f49c8['customField']){_0x21efc0[_0x7f49c8[_0x9102('0x44')][_0x9102('0x45')]()]=_0x7f49c8[_0x9102('0x46')][_0x9102('0x24')]();}else if(_0x7f49c8[_0x9102('0x42')]==='string'&&_0x7f49c8[_0x9102('0x47')]&&_0x7f49c8['customField']){_0x21efc0[_0x9102('0x48')]['push']({'id':_0x7f49c8[_0x9102('0x47')],'value':_0x7f49c8[_0x9102('0x46')][_0x9102('0x24')]()});}else if(_0x7f49c8['type']===_0x9102('0x49')&&_0x7f49c8[_0x9102('0x1d')]&&_0x7f49c8[_0x9102('0x47')]&&_0x7f49c8[_0x9102('0x4a')]){_0x2163d8[_0x7f49c8[_0x9102('0x1d')]]&&_0x21efc0['custom_fields'][_0x9102('0x4b')]({'id':_0x7f49c8['idField'],'value':_0x2163d8[_0x7f49c8[_0x9102('0x1d')]]['toString']()});}else if(_0x7f49c8[_0x9102('0x42')]==='customVariable'&&_0x7f49c8[_0x9102('0x4c')]&&_0x7f49c8[_0x9102('0x4c')][_0x9102('0xf')]&&_0x7f49c8[_0x9102('0x47')]&&_0x7f49c8[_0x9102('0x4a')]){_0x2163d8[_0x7f49c8[_0x9102('0x4c')][_0x9102('0xf')]['toLowerCase']()]&&_0x21efc0['custom_fields'][_0x9102('0x4b')]({'id':_0x7f49c8['idField'],'value':_0x2163d8[_0x7f49c8[_0x9102('0x4c')][_0x9102('0xf')][_0x9102('0x45')]()][_0x9102('0x24')]()});}});}return _0x21efc0;}function getConnection(_0x12b10e){return request({'method':_0x9102('0xc'),'form':{'method':'login','input_type':'JSON','response_type':_0x9102('0x1f'),'rest_data':JSON[_0x9102('0x20')]({'user_auth':{'user_name':_0x12b10e[_0x9102('0x4d')],'password':_0x12b10e[_0x9102('0x4e')],'encryption':_0x9102('0x4f')},'application':'xCALLY\x20Motion\x20integration'})}})['then'](function(_0x33636d){var _0x3599b8=_0x33636d;if(_0x3599b8['id']){def[_0x9102('0x50')]=_0x3599b8['id'];return BPromise['resolve'](_0x3599b8);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x12b10e['id']));}});}function setRelationship(_0x11043b,_0x412e9d,_0x956568,_0x49437b){return request({'form':{'method':_0x9102('0x51'),'input_type':'JSON','response_type':_0x9102('0x1f'),'rest_data':JSON[_0x9102('0x20')]({'session':_0x11043b['id'],'module_name':'Calls','module_id':_0x956568['id'],'link_field_name':_0x49437b,'related_ids':[_0x412e9d['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x9102('0x52')]=function(_0x3e8820,_0x308805,_0x1b9f19,_0x3f62a6,_0x342edd,_0x29e1f0){var _0x3c897f,_0x3480c4,_0x1633b5,_0x2faf3b;_0x29e1f0[_0x9102('0x53')]=intUtil[_0x9102('0x54')](_0x29e1f0[_0x9102('0x53')]);_0x29e1f0[_0x9102('0x55')]=intUtil['stripTrailingSlash'](_0x29e1f0[_0x9102('0x55')]);def[_0x9102('0x56')]=util[_0x9102('0x21')](_0x9102('0x57'),_0x29e1f0[_0x9102('0x53')]);if(_0x342edd&&_0x342edd[_0x9102('0x58')]){logger['info'](_0x9102('0x59'),_0x9102('0x5a'));_0x308805[_0x9102('0x5b')]=util['format'](_0x9102('0x5c'),_0x29e1f0['serverUrl'],_0x308805[_0x9102('0x5d')],md5(_0x308805[_0x9102('0x5d')]));}else{_0x308805[_0x9102('0x5b')]='';}return getConnection(_0x29e1f0)[_0x9102('0x2c')](function(_0x54d661){_0x2faf3b=_0x54d661;return getUser(_0x29e1f0,_0x3f62a6[_0x9102('0xf')],_0x2faf3b);})[_0x9102('0x2c')](function(_0xbb477){_0x3c897f=_0xbb477;logger[_0x9102('0x28')](_0x9102('0x5e'),_0x3c897f['id']);return getEndUser(_0x29e1f0,_0x308805[_0x9102('0x5f')],_0x308805[_0x9102('0x60')],_0x2faf3b);})[_0x9102('0x2c')](function(_0x7e32db){_0x3480c4=_0x7e32db;logger['info'](_0x9102('0x61'),_0x3480c4['id']);return getTicket(_0x29e1f0,_0x3c897f,_0x3480c4,_0x1b9f19,_0x308805,_0x1b9f19['Fields'],_0x2faf3b,_0x9102('0x62'));})[_0x9102('0x2c')](function(_0x14993e){_0x1633b5=_0x14993e;logger[_0x9102('0x28')](_0x9102('0x63'));logger['info'](_0x9102('0x64'),_0x1633b5['id']);return setRelationship(_0x2faf3b,_0x3c897f,_0x1633b5,_0x9102('0x65'));})['then'](function(){return setRelationship(_0x2faf3b,_0x3480c4,_0x1633b5,_0x9102('0x66'));})[_0x9102('0x2c')](function(){return getServerInfo(_0x2faf3b);})['then'](function(_0x266414){var _0x31319a=parseInt(_0x266414['version'][_0x9102('0x67')](0x0));var _0x5916ac=util[_0x9102('0x21')](_0x9102('0x68'),_0x29e1f0[_0x9102('0x53')],_0x1633b5['id']);if(_0x31319a>0x6){_0x5916ac=util[_0x9102('0x21')](_0x9102('0x69'),_0x29e1f0[_0x9102('0x53')],_0x1633b5['id']);}logger['info'](_0x9102('0x59'),_0x9102('0x6a'));emit(util[_0x9102('0x21')](_0x9102('0x6b'),_0x3f62a6[_0x9102('0xf')]),'trigger:browser:url',{'uri':_0x5916ac});})[_0x9102('0x6c')](function(_0x50573a){logger[_0x9102('0x6d')](_0x9102('0x59'),JSON[_0x9102('0x20')](_0x50573a));});};exports[_0x9102('0x6e')]=function(_0x1afa68,_0x1d1f6e,_0x5ae8e9,_0x39f7f8,_0x29deb3,_0x518ab5,_0x5c24af){var _0x15359d,_0x3b2eb6,_0x25e12f,_0x2ed946;_0x518ab5[_0x9102('0x53')]=intUtil[_0x9102('0x54')](_0x518ab5[_0x9102('0x53')]);_0x518ab5[_0x9102('0x55')]=intUtil[_0x9102('0x54')](_0x518ab5[_0x9102('0x55')]);def[_0x9102('0x56')]=util[_0x9102('0x21')](_0x9102('0x57'),_0x518ab5[_0x9102('0x53')]);if(_0x5c24af&&_0x5c24af[_0x9102('0x6f')]&&_0x5c24af['recordingFormat']!==_0x9102('0x70')){logger[_0x9102('0x28')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1d1f6e[_0x9102('0x5b')]=util[_0x9102('0x21')](_0x9102('0x5c'),_0x518ab5[_0x9102('0x55')],_0x1d1f6e[_0x9102('0x5d')],md5(_0x1d1f6e[_0x9102('0x5d')]));}return getConnection(_0x518ab5)[_0x9102('0x2c')](function(_0xd0f051){_0x2ed946=_0xd0f051;return getUser(_0x518ab5,_0x39f7f8[_0x9102('0xf')],_0x2ed946);})[_0x9102('0x2c')](function(_0x5573d9){_0x15359d=_0x5573d9;logger[_0x9102('0x28')](_0x9102('0x5e'),_0x15359d['id']);return getEndUser(_0x518ab5,_0x1d1f6e['destcalleridname'],_0x1d1f6e[_0x9102('0x71')],_0x2ed946);})['then'](function(_0x31377f){_0x3b2eb6=_0x31377f;logger[_0x9102('0x28')](_0x9102('0x61'),_0x3b2eb6['id']);return getTicket(_0x518ab5,_0x15359d,_0x3b2eb6,_0x5ae8e9,_0x1d1f6e,_0x5ae8e9[_0x9102('0x72')],_0x2ed946,_0x9102('0x73'));})[_0x9102('0x2c')](function(_0x264929){_0x25e12f=_0x264929;logger[_0x9102('0x28')](_0x9102('0x63'));logger[_0x9102('0x28')](_0x9102('0x64'),_0x25e12f['id']);return setRelationship(_0x2ed946,_0x15359d,_0x25e12f,_0x9102('0x65'));})['then'](function(){return setRelationship(_0x2ed946,_0x3b2eb6,_0x25e12f,_0x9102('0x66'));})[_0x9102('0x2c')](function(){return getServerInfo(_0x2ed946);})[_0x9102('0x2c')](function(_0x43b4f7){var _0x535527=parseInt(_0x43b4f7['version']['charAt'](0x0));var _0x5632d8=util[_0x9102('0x21')](_0x9102('0x68'),_0x518ab5['remoteUri'],_0x25e12f['id']);if(_0x535527>0x6){_0x5632d8=util['format'](_0x9102('0x69'),_0x518ab5[_0x9102('0x53')],_0x25e12f['id']);}logger[_0x9102('0x28')](_0x9102('0x74'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9102('0x21')](_0x9102('0x6b'),_0x39f7f8['name']),_0x9102('0x75'),{'uri':_0x5632d8});})[_0x9102('0x6c')](function(_0x2fb972){logger[_0x9102('0x6d')](_0x9102('0x74'),JSON[_0x9102('0x20')](_0x2fb972));});};exports['unmanaged']=function(_0x4b348c,_0x4ec5c7,_0x5aa74d,_0x2a1c4b,_0x1f417a,_0x56eaff){var _0x8b6756,_0x50cbfc,_0x36ec57,_0xf36e70;_0x56eaff['remoteUri']=intUtil[_0x9102('0x54')](_0x56eaff[_0x9102('0x53')]);_0x56eaff[_0x9102('0x55')]=intUtil['stripTrailingSlash'](_0x56eaff['serverUrl']);def[_0x9102('0x56')]=util[_0x9102('0x21')](_0x9102('0x57'),_0x56eaff[_0x9102('0x53')]);if(_0x1f417a&&_0x1f417a[_0x9102('0x58')]){logger[_0x9102('0x28')]('['+_0x4ec5c7['lastevent']['toUpperCase']()+']',_0x9102('0x5a'));_0x4ec5c7[_0x9102('0x5b')]=util['format'](_0x9102('0x5c'),_0x56eaff[_0x9102('0x55')],_0x4ec5c7['uniqueid'],md5(_0x4ec5c7[_0x9102('0x5d')]));}else{_0x4ec5c7[_0x9102('0x5b')]='';}return getConnection(_0x56eaff)[_0x9102('0x2c')](function(_0x23f23f){_0xf36e70=_0x23f23f;if(!_[_0x9102('0x27')](_0x2a1c4b)){return getUser(_0x56eaff,_0x2a1c4b[_0x9102('0xf')],_0xf36e70);}else{return getUser(_0x56eaff,null,_0xf36e70);}})[_0x9102('0x2c')](function(_0x556728){_0x8b6756=_0x556728;logger[_0x9102('0x28')](_0x9102('0x5e'),_0x8b6756['id']);return getEndUser(_0x56eaff,_0x4ec5c7['calleridname'],_0x4ec5c7['calleridnum'],_0xf36e70);})[_0x9102('0x2c')](function(_0x53e113){_0x50cbfc=_0x53e113;logger[_0x9102('0x28')](_0x9102('0x61'),_0x50cbfc['id']);return getTicket(_0x56eaff,_0x8b6756,_0x50cbfc,_0x5aa74d,_0x4ec5c7,_0x5aa74d[_0x9102('0x72')],_0xf36e70,_0x9102('0x62'));})[_0x9102('0x2c')](function(_0x56a0eb){_0x36ec57=_0x56a0eb;logger[_0x9102('0x28')]('Ticket\x20created!');logger[_0x9102('0x28')]('The\x20Ticket\x20ID\x20is:',_0x36ec57['id']);return setRelationship(_0xf36e70,_0x8b6756,_0x36ec57,_0x9102('0x65'));})[_0x9102('0x2c')](function(){return setRelationship(_0xf36e70,_0x50cbfc,_0x36ec57,_0x9102('0x66'));})[_0x9102('0x2c')](function(){return getServerInfo(_0xf36e70);})[_0x9102('0x6c')](function(_0x37f464){logger[_0x9102('0x6d')]('['+_0x4ec5c7['lastevent'][_0x9102('0x76')]()+']',JSON[_0x9102('0x20')](_0x37f464));});}; \ No newline at end of file +var _0x6229=['%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','Outbound','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','lastevent','isNil','users','contacts','lodash','request-promise','util','ioredis','./util','../../../../config/environment','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','info','Creating\x20new\x20ticket...','name','getString','Subjects','created_by','description','Descriptions','date_start','duration_hours','duration_minutes','parent_id','Contacts','parent_name','direction','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','toString','base64','get_server_info','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','entry_list','length','find','name_value_list','value','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','user_name','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','debug','merge','map','type','nameField','customField','toLowerCase','content','string','custom_fields','variable','customVariable','Variable','login','password','PLAIN','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','charAt'];(function(_0x4629ee,_0x5802d8){var _0x47fb5b=function(_0xf899cd){while(--_0xf899cd){_0x4629ee['push'](_0x4629ee['shift']());}};_0x47fb5b(++_0x5802d8);}(_0x6229,0x87));var _0x9622=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6229[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x9622('0x0'));var rp=require(_0x9622('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require(_0x9622('0x2'));var Redis=require(_0x9622('0x3'));var intUtil=require(_0x9622('0x4'));var config=require(_0x9622('0x5'));var logger=require('../../../../config/logger')(_0x9622('0x6'));config[_0x9622('0x7')]=_[_0x9622('0x8')](config[_0x9622('0x7')],{'host':_0x9622('0x9'),'port':0x18eb});var io=require(_0x9622('0xa'))(new Redis(config[_0x9622('0x7')]));var def={'method':_0x9622('0xb'),'json':!![]};function emit(_0x5ab4d2,_0x3269aa,_0x2cee51){io['to'](_0x5ab4d2)['emit'](_0x3269aa,_0x2cee51);}function getTicket(_0x4bded0,_0x21616d,_0xc08e97,_0x1d6226,_0x39470f,_0x32a30f,_0x51f581,_0x110511){logger[_0x9622('0xc')](_0x9622('0xd'));var _0x1ac4c6=new Date();var _0x45fbc4=[{'name':_0x9622('0xe'),'value':intUtil[_0x9622('0xf')](_0x1d6226[_0x9622('0x10')],_0x39470f,'\x20')},{'name':'assigned_user_id','value':_0x21616d['id']},{'name':_0x9622('0x11'),'value':_0x21616d['id']},{'name':_0x9622('0x12'),'value':intUtil[_0x9622('0xf')](_0x1d6226[_0x9622('0x13')],_0x39470f,'\x0a')},{'name':_0x9622('0x14'),'value':_0x1ac4c6['toISOString']()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0x9622('0x15'),'value':'0'},{'name':_0x9622('0x16'),'value':'15'},{'name':_0x9622('0x17'),'value':_0xc08e97['id']},{'name':'parent_type','value':_0x9622('0x18')},{'name':_0x9622('0x19'),'value':_0xc08e97[_0x9622('0xe')]},{'name':_0x9622('0x1a'),'value':_0x110511}];if(_0x32a30f['length']){_[_0x9622('0x1b')](_0x32a30f,function(_0x47a87f){if(_0x39470f[_0x47a87f[_0x9622('0x1c')]]){_0x45fbc4[_0x9622('0x1d')]({'name':_0x47a87f[_0x9622('0x1e')],'value':_0x39470f[_0x47a87f['variableName']]});}});}return request({'form':{'method':_0x9622('0x1f'),'input_type':_0x9622('0x20'),'response_type':_0x9622('0x20'),'rest_data':JSON[_0x9622('0x21')]({'session':_0x51f581['id'],'module_name':_0x9622('0x22'),'name_value_list':_0x45fbc4})}});}function getAuth(_0x2d56e2){return util[_0x9622('0x23')](_0x9622('0x24'),new Buffer(_0x2d56e2['apiKey']+':X')[_0x9622('0x25')](_0x9622('0x26')));}function getServerInfo(_0x1dd9d4){return request({'form':{'method':_0x9622('0x27'),'input_type':'JSON','response_type':_0x9622('0x20'),'rest_data':JSON[_0x9622('0x21')]({'session':_0x1dd9d4['id']})}});}function getUser(_0x2699ed,_0x9c0622,_0x5f4899){if(!_['isNil'](_0x9c0622)){logger['info'](_0x9622('0x28'),_0x9c0622);return request({'form':{'method':_0x9622('0x29'),'input_type':'JSON','response_type':_0x9622('0x20'),'rest_data':JSON['stringify']({'session':_0x5f4899['id'],'module_name':'Employees','query':util[_0x9622('0x23')](_0x9622('0x2a'),_0x9c0622),'order_by':'','offset':'0','select_fields':['id','name','user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x52fd2){if(_0x52fd2[_0x9622('0x2b')][_0x9622('0x2c')]){var _0x2b2b51=_[_0x9622('0x2d')](_0x52fd2[_0x9622('0x2b')],function(_0x5183b9){return _0x5183b9[_0x9622('0x2e')]['user_name'][_0x9622('0x2f')]===_0x9c0622;});if(_0x2b2b51){logger[_0x9622('0xc')](_0x9622('0x30'));return BPromise['resolve']({'id':_0x2b2b51[_0x9622('0x2e')]['id'][_0x9622('0x2f')],'name':_0x2b2b51['name_value_list'][_0x9622('0xe')][_0x9622('0x2f')]});}}logger[_0x9622('0xc')](_0x9622('0x31'));return BPromise[_0x9622('0x32')]({'id':_0x5f4899['name_value_list'][_0x9622('0x33')][_0x9622('0x2f')],'name':_0x5f4899[_0x9622('0x2e')][_0x9622('0x34')][_0x9622('0x2f')]});});}else{logger[_0x9622('0xc')](_0x9622('0x35'));return BPromise['resolve']({'id':_0x5f4899[_0x9622('0x2e')]['user_id'][_0x9622('0x2f')],'name':_0x5f4899[_0x9622('0x2e')][_0x9622('0x34')][_0x9622('0x2f')]});}}function getEndUser(_0x3cc575,_0xb57612,_0x4d7193,_0x1e2fec){logger[_0x9622('0xc')]('Searching\x20enduser\x20with\x20phone',_0x4d7193);return request({'form':{'method':_0x9622('0x29'),'input_type':_0x9622('0x20'),'response_type':_0x9622('0x20'),'rest_data':JSON['stringify']({'session':_0x1e2fec['id'],'module_name':_0x9622('0x18'),'query':util['format'](_0x9622('0x36'),_0x4d7193),'order_by':'','offset':'0','select_fields':['id','name',_0x9622('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9622('0x38')](function(_0xab41c2){if(_0xab41c2[_0x9622('0x2b')][_0x9622('0x2c')]){var _0x322bb0=_[_0x9622('0x2d')](_0xab41c2[_0x9622('0x2b')],function(_0x584de5){return _0x584de5['name_value_list'][_0x9622('0x37')][_0x9622('0x2f')]===_0x4d7193;});if(_0x322bb0){logger['info']('Enduser\x20found!');return BPromise['resolve']({'id':_0x322bb0[_0x9622('0x2e')]['id']['value'],'name':_0x322bb0[_0x9622('0x2e')][_0x9622('0xe')][_0x9622('0x2f')],'phone':_0x322bb0[_0x9622('0x2e')]['phone_home'][_0x9622('0x2f')]});}}else{logger[_0x9622('0xc')](_0x9622('0x39'));return request({'form':{'method':_0x9622('0x1f'),'input_type':_0x9622('0x20'),'response_type':_0x9622('0x20'),'rest_data':JSON['stringify']({'session':_0x1e2fec['id'],'module_name':'Contacts','name_value_list':[{'name':_0x9622('0x3a'),'value':_0xb57612!==''?_0xb57612:util['format'](_0x9622('0x3b'),_0x4d7193)},{'name':_0x9622('0x37'),'value':_0x4d7193}]})}})[_0x9622('0x38')](function(_0x4dff08){logger[_0x9622('0xc')]('Enduser\x20created.');return BPromise[_0x9622('0x32')]({'id':_0x4dff08['id'],'name':_0x4dff08['entry_list'][_0x9622('0x3a')][_0x9622('0x2f')],'phone':_0x4dff08[_0x9622('0x2b')][_0x9622('0x37')][_0x9622('0x2f')]});});}});}function request(_0x139b76){logger[_0x9622('0x3c')]('[HTTP]',JSON[_0x9622('0x21')](_0x139b76));return rp(_[_0x9622('0x3d')](def,_0x139b76));}function getTags(_0x113f40,_0x5587b6){var _0x22e887=[];if(_0x113f40&&_0x113f40[_0x9622('0x2c')]>0x0){_0x22e887=_[_0x9622('0x3e')](_0x113f40,_0x5587b6);}return _0x22e887;}function getCustomFields(_0x566770,_0x1e975f){var _0xd1807=[];var _0xfb9a20={'custom_fields':[]};if(_0x566770[_0x9622('0x2c')]>0x0){_[_0x9622('0x1b')](_0x566770,function(_0x428722){if(_0x428722[_0x9622('0x3f')]==='string'&&_0x428722[_0x9622('0x40')]&&!_0x428722[_0x9622('0x41')]){_0xfb9a20[_0x428722[_0x9622('0x40')][_0x9622('0x42')]()]=_0x428722[_0x9622('0x43')][_0x9622('0x25')]();}else if(_0x428722[_0x9622('0x3f')]===_0x9622('0x44')&&_0x428722[_0x9622('0x1e')]&&_0x428722['customField']){_0xfb9a20[_0x9622('0x45')][_0x9622('0x1d')]({'id':_0x428722[_0x9622('0x1e')],'value':_0x428722[_0x9622('0x43')][_0x9622('0x25')]()});}else if(_0x428722[_0x9622('0x3f')]===_0x9622('0x46')&&_0x428722[_0x9622('0x1c')]&&_0x428722[_0x9622('0x1e')]&&_0x428722[_0x9622('0x41')]){_0x1e975f[_0x428722[_0x9622('0x1c')]]&&_0xfb9a20[_0x9622('0x45')][_0x9622('0x1d')]({'id':_0x428722[_0x9622('0x1e')],'value':_0x1e975f[_0x428722['variableName']][_0x9622('0x25')]()});}else if(_0x428722[_0x9622('0x3f')]===_0x9622('0x47')&&_0x428722[_0x9622('0x48')]&&_0x428722['Variable'][_0x9622('0xe')]&&_0x428722[_0x9622('0x1e')]&&_0x428722['customField']){_0x1e975f[_0x428722[_0x9622('0x48')][_0x9622('0xe')]['toLowerCase']()]&&_0xfb9a20[_0x9622('0x45')][_0x9622('0x1d')]({'id':_0x428722[_0x9622('0x1e')],'value':_0x1e975f[_0x428722[_0x9622('0x48')]['name'][_0x9622('0x42')]()][_0x9622('0x25')]()});}});}return _0xfb9a20;}function getConnection(_0x5a912b){return request({'method':_0x9622('0xb'),'form':{'method':_0x9622('0x49'),'input_type':_0x9622('0x20'),'response_type':_0x9622('0x20'),'rest_data':JSON[_0x9622('0x21')]({'user_auth':{'user_name':_0x5a912b['username'],'password':_0x5a912b[_0x9622('0x4a')],'encryption':_0x9622('0x4b')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x9622('0x38')](function(_0x521447){var _0x4f97c1=_0x521447;if(_0x4f97c1['id']){def['sessionID']=_0x4f97c1['id'];return BPromise[_0x9622('0x32')](_0x4f97c1);}else{throw new Error(util['format'](_0x9622('0x4c'),_0x5a912b['id']));}});}function setRelationship(_0x1ab687,_0x42cbd3,_0x2d21c7,_0x53985c){return request({'form':{'method':_0x9622('0x4d'),'input_type':_0x9622('0x20'),'response_type':_0x9622('0x20'),'rest_data':JSON[_0x9622('0x21')]({'session':_0x1ab687['id'],'module_name':_0x9622('0x22'),'module_id':_0x2d21c7['id'],'link_field_name':_0x53985c,'related_ids':[_0x42cbd3['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x9622('0x4e')]=function(_0xa4b3af,_0x34ecab,_0xfd1e2c,_0x2949e2,_0x47c85c,_0x25bdd6){var _0x2dccca,_0x136a07,_0x36e2b2,_0x1b7542;_0x25bdd6[_0x9622('0x4f')]=intUtil[_0x9622('0x50')](_0x25bdd6[_0x9622('0x4f')]);_0x25bdd6['serverUrl']=intUtil['stripTrailingSlash'](_0x25bdd6['serverUrl']);def[_0x9622('0x51')]=util[_0x9622('0x23')](_0x9622('0x52'),_0x25bdd6[_0x9622('0x4f')]);if(_0x47c85c&&_0x47c85c[_0x9622('0x53')]){logger[_0x9622('0xc')](_0x9622('0x54'),_0x9622('0x55'));_0x34ecab[_0x9622('0x56')]=util[_0x9622('0x23')](_0x9622('0x57'),_0x25bdd6[_0x9622('0x58')],_0x34ecab[_0x9622('0x59')],md5(_0x34ecab['uniqueid']));}else{_0x34ecab['recordingURL']='';}return getConnection(_0x25bdd6)[_0x9622('0x38')](function(_0x5f5af7){_0x1b7542=_0x5f5af7;return getUser(_0x25bdd6,_0x2949e2[_0x9622('0xe')],_0x1b7542);})[_0x9622('0x38')](function(_0x4b5c0d){_0x2dccca=_0x4b5c0d;logger[_0x9622('0xc')](_0x9622('0x5a'),_0x2dccca['id']);return getEndUser(_0x25bdd6,_0x34ecab[_0x9622('0x5b')],_0x34ecab[_0x9622('0x5c')],_0x1b7542);})[_0x9622('0x38')](function(_0x1560ae){_0x136a07=_0x1560ae;logger[_0x9622('0xc')](_0x9622('0x5d'),_0x136a07['id']);return getTicket(_0x25bdd6,_0x2dccca,_0x136a07,_0xfd1e2c,_0x34ecab,_0xfd1e2c[_0x9622('0x5e')],_0x1b7542,_0x9622('0x5f'));})['then'](function(_0x31f7f7){_0x36e2b2=_0x31f7f7;logger['info'](_0x9622('0x60'));logger[_0x9622('0xc')](_0x9622('0x61'),_0x36e2b2['id']);return setRelationship(_0x1b7542,_0x2dccca,_0x36e2b2,'users');})[_0x9622('0x38')](function(){return setRelationship(_0x1b7542,_0x136a07,_0x36e2b2,'contacts');})['then'](function(){return getServerInfo(_0x1b7542);})[_0x9622('0x38')](function(_0x52577f){var _0x204750=parseInt(_0x52577f['version'][_0x9622('0x62')](0x0));var _0x17485f=util[_0x9622('0x23')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x25bdd6[_0x9622('0x4f')],_0x36e2b2['id']);if(_0x204750>0x6){_0x17485f=util[_0x9622('0x23')](_0x9622('0x63'),_0x25bdd6['remoteUri'],_0x36e2b2['id']);}logger[_0x9622('0xc')](_0x9622('0x54'),_0x9622('0x64'));emit(util[_0x9622('0x23')](_0x9622('0x65'),_0x2949e2[_0x9622('0xe')]),_0x9622('0x66'),{'uri':_0x17485f});})[_0x9622('0x67')](function(_0x324e5d){logger[_0x9622('0x68')](_0x9622('0x54'),JSON[_0x9622('0x21')](_0x324e5d));});};exports[_0x9622('0x69')]=function(_0x50b925,_0x5e8d5b,_0x514a4f,_0x33e6b6,_0x51b4d9,_0x37e9fa,_0x1613cf){var _0x388fb2,_0x831a93,_0x1f2198,_0xb24626;_0x37e9fa['remoteUri']=intUtil[_0x9622('0x50')](_0x37e9fa[_0x9622('0x4f')]);_0x37e9fa[_0x9622('0x58')]=intUtil['stripTrailingSlash'](_0x37e9fa[_0x9622('0x58')]);def['uri']=util[_0x9622('0x23')](_0x9622('0x52'),_0x37e9fa[_0x9622('0x4f')]);if(_0x1613cf&&_0x1613cf[_0x9622('0x6a')]&&_0x1613cf[_0x9622('0x6a')]!==_0x9622('0x6b')){logger[_0x9622('0xc')](_0x9622('0x6c'),'Recording\x20is\x20enabled!');_0x5e8d5b['recordingURL']=util[_0x9622('0x23')](_0x9622('0x57'),_0x37e9fa[_0x9622('0x58')],_0x5e8d5b[_0x9622('0x59')],md5(_0x5e8d5b[_0x9622('0x59')]));}return getConnection(_0x37e9fa)[_0x9622('0x38')](function(_0x4fc592){_0xb24626=_0x4fc592;return getUser(_0x37e9fa,_0x33e6b6[_0x9622('0xe')],_0xb24626);})[_0x9622('0x38')](function(_0x102137){_0x388fb2=_0x102137;logger[_0x9622('0xc')](_0x9622('0x5a'),_0x388fb2['id']);return getEndUser(_0x37e9fa,_0x5e8d5b['destcalleridname'],_0x5e8d5b[_0x9622('0x6d')],_0xb24626);})['then'](function(_0x283c6b){_0x831a93=_0x283c6b;logger[_0x9622('0xc')]('The\x20Enduser\x20ID\x20is:',_0x831a93['id']);return getTicket(_0x37e9fa,_0x388fb2,_0x831a93,_0x514a4f,_0x5e8d5b,_0x514a4f[_0x9622('0x5e')],_0xb24626,_0x9622('0x6e'));})[_0x9622('0x38')](function(_0x30c4c2){_0x1f2198=_0x30c4c2;logger[_0x9622('0xc')](_0x9622('0x60'));logger[_0x9622('0xc')](_0x9622('0x61'),_0x1f2198['id']);return setRelationship(_0xb24626,_0x388fb2,_0x1f2198,'users');})[_0x9622('0x38')](function(){return setRelationship(_0xb24626,_0x831a93,_0x1f2198,'contacts');})['then'](function(){return getServerInfo(_0xb24626);})[_0x9622('0x38')](function(_0x2f8843){var _0x51d3f3=parseInt(_0x2f8843[_0x9622('0x6f')][_0x9622('0x62')](0x0));var _0x211c95=util['format'](_0x9622('0x70'),_0x37e9fa[_0x9622('0x4f')],_0x1f2198['id']);if(_0x51d3f3>0x6){_0x211c95=util['format'](_0x9622('0x63'),_0x37e9fa[_0x9622('0x4f')],_0x1f2198['id']);}logger[_0x9622('0xc')]('[OUTBOUND]',_0x9622('0x64'));emit(util[_0x9622('0x23')](_0x9622('0x65'),_0x33e6b6[_0x9622('0xe')]),'trigger:browser:url',{'uri':_0x211c95});})['catch'](function(_0x236505){logger['error'](_0x9622('0x6c'),JSON[_0x9622('0x21')](_0x236505));});};exports['unmanaged']=function(_0x22b73b,_0x3a77d7,_0x2517a6,_0x3f9ed4,_0x43bb0c,_0x212762){var _0x91ee,_0x10a71b,_0x221492,_0x24b84a;_0x212762[_0x9622('0x4f')]=intUtil[_0x9622('0x50')](_0x212762[_0x9622('0x4f')]);_0x212762[_0x9622('0x58')]=intUtil[_0x9622('0x50')](_0x212762[_0x9622('0x58')]);def[_0x9622('0x51')]=util[_0x9622('0x23')](_0x9622('0x52'),_0x212762[_0x9622('0x4f')]);if(_0x43bb0c&&_0x43bb0c[_0x9622('0x53')]){logger[_0x9622('0xc')]('['+_0x3a77d7[_0x9622('0x71')]['toUpperCase']()+']',_0x9622('0x55'));_0x3a77d7[_0x9622('0x56')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x212762[_0x9622('0x58')],_0x3a77d7[_0x9622('0x59')],md5(_0x3a77d7[_0x9622('0x59')]));}else{_0x3a77d7[_0x9622('0x56')]='';}return getConnection(_0x212762)[_0x9622('0x38')](function(_0x4808f1){_0x24b84a=_0x4808f1;if(!_[_0x9622('0x72')](_0x3f9ed4)){return getUser(_0x212762,_0x3f9ed4[_0x9622('0xe')],_0x24b84a);}else{return getUser(_0x212762,null,_0x24b84a);}})[_0x9622('0x38')](function(_0x29c0b6){_0x91ee=_0x29c0b6;logger['info'](_0x9622('0x5a'),_0x91ee['id']);return getEndUser(_0x212762,_0x3a77d7['calleridname'],_0x3a77d7[_0x9622('0x5c')],_0x24b84a);})['then'](function(_0x33c89e){_0x10a71b=_0x33c89e;logger['info']('The\x20Enduser\x20ID\x20is:',_0x10a71b['id']);return getTicket(_0x212762,_0x91ee,_0x10a71b,_0x2517a6,_0x3a77d7,_0x2517a6[_0x9622('0x5e')],_0x24b84a,'Inbound');})[_0x9622('0x38')](function(_0x40fa26){_0x221492=_0x40fa26;logger[_0x9622('0xc')](_0x9622('0x60'));logger[_0x9622('0xc')](_0x9622('0x61'),_0x221492['id']);return setRelationship(_0x24b84a,_0x91ee,_0x221492,_0x9622('0x73'));})[_0x9622('0x38')](function(){return setRelationship(_0x24b84a,_0x10a71b,_0x221492,_0x9622('0x74'));})[_0x9622('0x38')](function(){return getServerInfo(_0x24b84a);})[_0x9622('0x67')](function(_0x22ab1f){logger['error']('['+_0x3a77d7[_0x9622('0x71')]['toUpperCase']()+']',JSON['stringify'](_0x22ab1f));});}; \ 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 559ae74..083c440 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 _0x3a0e=['type','string','push','variableName','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','keyContent','variable','customVariable','stripTrailingSlash','slice','substring','validateEmail','lodash','getString','length','sortBy'];(function(_0x4ad1f8,_0x2058ca){var _0x86623b=function(_0x5cb618){while(--_0x5cb618){_0x4ad1f8['push'](_0x4ad1f8['shift']());}};_0x86623b(++_0x2058ca);}(_0x3a0e,0x9d));var _0xe3a0=function(_0x59a32e,_0xf48643){_0x59a32e=_0x59a32e-0x0;var _0x19e843=_0x3a0e[_0x59a32e];return _0x19e843;};'use strict';var _=require(_0xe3a0('0x0'));var util=require('util');exports[_0xe3a0('0x1')]=function(_0x167717,_0x31b60b,_0x21ce3c){var _0x4fd945=[];if(_0x167717[_0xe3a0('0x2')]>0x0){var _0x3bde36=_[_0xe3a0('0x3')](_0x167717,['id']);for(var _0x183809=0x0;_0x183809<_0x3bde36['length'];_0x183809++){var _0xff438e=_0x3bde36[_0x183809];if(_0xff438e[_0xe3a0('0x4')]===_0xe3a0('0x5')){_0x4fd945[_0xe3a0('0x6')](_0xff438e['content']);}else if(_0xff438e[_0xe3a0('0x4')]==='variable'&&_0xff438e[_0xe3a0('0x7')]){_0x31b60b[_0xff438e[_0xe3a0('0x7')]]&&_0x4fd945[_0xe3a0('0x6')](_0x31b60b[_0xff438e[_0xe3a0('0x7')]]['toString']());}else if(_0xff438e[_0xe3a0('0x4')]==='customVariable'&&_0xff438e[_0xe3a0('0x8')]&&_0xff438e[_0xe3a0('0x8')]['name']){_0x31b60b[_0xff438e[_0xe3a0('0x8')][_0xe3a0('0x9')][_0xe3a0('0xa')]()]&&_0x4fd945['push'](_0x31b60b[_0xff438e[_0xe3a0('0x8')][_0xe3a0('0x9')][_0xe3a0('0xa')]()]['toString']());}else if(_0xff438e[_0xe3a0('0x4')]===_0xe3a0('0xb')){if(_0xff438e[_0xe3a0('0xc')]==='string'&&_0xff438e[_0xe3a0('0xd')]){_0x4fd945['push'](util[_0xe3a0('0xe')](_0xe3a0('0xf'),_0xff438e[_0xe3a0('0xd')],_0xff438e[_0xe3a0('0x10')]));}else if(_0xff438e['keyType']===_0xe3a0('0x11')&&_0xff438e[_0xe3a0('0x7')]&&_0xff438e[_0xe3a0('0xd')]){_0x31b60b[_0xff438e[_0xe3a0('0x7')]]&&_0x4fd945['push'](util[_0xe3a0('0xe')](_0xe3a0('0xf'),_0xff438e[_0xe3a0('0xd')],_0x31b60b[_0xff438e[_0xe3a0('0x7')]]));}else if(_0xff438e[_0xe3a0('0xc')]===_0xe3a0('0x12')&&_0xff438e[_0xe3a0('0x8')]&&_0xff438e['Variable'][_0xe3a0('0x9')]&&_0xff438e[_0xe3a0('0xd')]){_0x31b60b[_0xff438e['Variable'][_0xe3a0('0x9')][_0xe3a0('0xa')]()]&&_0x4fd945[_0xe3a0('0x6')](util['format'](_0xe3a0('0xf'),_0xff438e[_0xe3a0('0xd')],_0x31b60b[_0xff438e[_0xe3a0('0x8')][_0xe3a0('0x9')]['toLowerCase']()]));}}}}return _0x4fd945['join'](_0x21ce3c);};exports[_0xe3a0('0x13')]=function(_0x1270eb){var _0x9629c8=_0x1270eb[_0xe3a0('0x14')](-0x1);if(_0x9629c8==='/'){_0x1270eb=_0x1270eb[_0xe3a0('0x15')](0x0,_0x1270eb['lastIndexOf'](_0x9629c8));}return _0x1270eb;};exports[_0xe3a0('0x16')]=function(_0x48746c){if(!_['isNil'](_0x48746c)&&_0x48746c!==''){var _0x2d730a=/^(([^<>()\[\]\\.,;:\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 _0x2d730a['test'](String(_0x48746c)[_0xe3a0('0xa')]());}else{return![];}}; \ No newline at end of file +var _0xabc9=['Variable','name','toLowerCase','toString','keyValue','keyType','string','key','format','%s:\x20%s','keyContent','join','stripTrailingSlash','lastIndexOf','validateEmail','isNil','test','getString','sortBy','length','type','content','variable','push','variableName','customVariable'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xabc9,0x197));var _0x9abc=function(_0x366f52,_0x439b7e){_0x366f52=_0x366f52-0x0;var _0x1cff3c=_0xabc9[_0x366f52];return _0x1cff3c;};'use strict';var _=require('lodash');var util=require('util');exports[_0x9abc('0x0')]=function(_0x8ab382,_0x15194f,_0x1f68a4){var _0x41805f=[];if(_0x8ab382['length']>0x0){var _0x2fe522=_[_0x9abc('0x1')](_0x8ab382,['id']);for(var _0x18fa4f=0x0;_0x18fa4f<_0x2fe522[_0x9abc('0x2')];_0x18fa4f++){var _0x1b4ff5=_0x2fe522[_0x18fa4f];if(_0x1b4ff5[_0x9abc('0x3')]==='string'){_0x41805f['push'](_0x1b4ff5[_0x9abc('0x4')]);}else if(_0x1b4ff5[_0x9abc('0x3')]===_0x9abc('0x5')&&_0x1b4ff5['variableName']){_0x15194f[_0x1b4ff5['variableName']]&&_0x41805f[_0x9abc('0x6')](_0x15194f[_0x1b4ff5[_0x9abc('0x7')]]['toString']());}else if(_0x1b4ff5['type']===_0x9abc('0x8')&&_0x1b4ff5['Variable']&&_0x1b4ff5[_0x9abc('0x9')][_0x9abc('0xa')]){_0x15194f[_0x1b4ff5['Variable'][_0x9abc('0xa')][_0x9abc('0xb')]()]&&_0x41805f['push'](_0x15194f[_0x1b4ff5[_0x9abc('0x9')][_0x9abc('0xa')][_0x9abc('0xb')]()][_0x9abc('0xc')]());}else if(_0x1b4ff5[_0x9abc('0x3')]===_0x9abc('0xd')){if(_0x1b4ff5[_0x9abc('0xe')]===_0x9abc('0xf')&&_0x1b4ff5[_0x9abc('0x10')]){_0x41805f[_0x9abc('0x6')](util[_0x9abc('0x11')](_0x9abc('0x12'),_0x1b4ff5[_0x9abc('0x10')],_0x1b4ff5[_0x9abc('0x13')]));}else if(_0x1b4ff5['keyType']===_0x9abc('0x5')&&_0x1b4ff5[_0x9abc('0x7')]&&_0x1b4ff5[_0x9abc('0x10')]){_0x15194f[_0x1b4ff5['variableName']]&&_0x41805f[_0x9abc('0x6')](util['format']('%s:\x20%s',_0x1b4ff5[_0x9abc('0x10')],_0x15194f[_0x1b4ff5[_0x9abc('0x7')]]));}else if(_0x1b4ff5[_0x9abc('0xe')]===_0x9abc('0x8')&&_0x1b4ff5[_0x9abc('0x9')]&&_0x1b4ff5['Variable'][_0x9abc('0xa')]&&_0x1b4ff5['key']){_0x15194f[_0x1b4ff5['Variable'][_0x9abc('0xa')][_0x9abc('0xb')]()]&&_0x41805f[_0x9abc('0x6')](util[_0x9abc('0x11')](_0x9abc('0x12'),_0x1b4ff5[_0x9abc('0x10')],_0x15194f[_0x1b4ff5[_0x9abc('0x9')][_0x9abc('0xa')]['toLowerCase']()]));}}}}return _0x41805f[_0x9abc('0x14')](_0x1f68a4);};exports[_0x9abc('0x15')]=function(_0xfe2bcb){var _0x569e0d=_0xfe2bcb['slice'](-0x1);if(_0x569e0d==='/'){_0xfe2bcb=_0xfe2bcb['substring'](0x0,_0xfe2bcb[_0x9abc('0x16')](_0x569e0d));}return _0xfe2bcb;};exports[_0x9abc('0x17')]=function(_0x2a5698){if(!_[_0x9abc('0x18')](_0x2a5698)&&_0x2a5698!==''){var _0x3b18ba=/^(([^<>()\[\]\\.,;:\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 _0x3b18ba[_0x9abc('0x19')](String(_0x2a5698)['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 fef15af..fdede24 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 _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(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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 +var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x29fa47,_0x58d85a){var _0x378f78=function(_0x51ccd1){while(--_0x51ccd1){_0x29fa47['push'](_0x29fa47['shift']());}};_0x378f78(++_0x58d85a);}(_0x9c44,0x178));var _0x49c4=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x9c44[_0x209941];return _0x1e8729;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index d8843e0..678cbff 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 _0xc38a=['[OUTBOUND]','%s/agent/tickets/%s','/api/v2','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','defaults','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','Tags','Subjects','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','find','agent','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','filter','end-user','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','Caller\x20-\x20%s','password','%s:%s','username','authType','%s/token:%s','token','Basic\x20%s','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','customField','nameField','toLowerCase','content','toString','picklist','idField','custom_fields','type','variable','variableName','push','Variable','name','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','destcalleridnum','newTab'];(function(_0x389a5b,_0x44ebfc){var _0x5a0782=function(_0xc15f3b){while(--_0xc15f3b){_0x389a5b['push'](_0x389a5b['shift']());}};_0x5a0782(++_0x44ebfc);}(_0xc38a,0x79));var _0xac38=function(_0x2fff28,_0x540e58){_0x2fff28=_0x2fff28-0x0;var _0x1f68b9=_0xc38a[_0x2fff28];return _0x1f68b9;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require(_0xac38('0x0'));var Redis=require(_0xac38('0x1'));var intUtil=require('./util');var config=require(_0xac38('0x2'));var logger=require(_0xac38('0x3'))(_0xac38('0x4'));config['redis']=_[_0xac38('0x5')](config[_0xac38('0x6')],{'host':_0xac38('0x7'),'port':0x18eb});var io=require(_0xac38('0x8'))(new Redis(config[_0xac38('0x6')]));function emit(_0x426c82,_0x1398ec,_0x5748fb){io['to'](_0x426c82)[_0xac38('0x9')](_0x1398ec,_0x5748fb);}var headers={'Content-Type':_0xac38('0xa'),'Accept':_0xac38('0xa')};function getTicket(_0x518ed1,_0x2e45e2,_0x2d2bd2,_0x2cf938,_0x27e7ea){logger[_0xac38('0xb')](_0xac38('0xc'));return request({'uri':util[_0xac38('0xd')](_0xac38('0xe'),_0x518ed1[_0xac38('0xf')]),'method':'POST','body':{'ticket':_['merge']({'requester_id':_0x2d2bd2['id'],'submitter_id':_0x2e45e2?_0x2e45e2['id']:undefined,'assignee_id':_0x2e45e2?_0x2e45e2['id']:undefined,'tags':getTags(_0x2cf938[_0xac38('0x10')],'name'),'subject':intUtil['getString'](_0x2cf938[_0xac38('0x11')],_0x27e7ea,'\x20'),'description':intUtil[_0xac38('0x12')](_0x2cf938[_0xac38('0x13')],_0x27e7ea,'\x0a'),'comment':{'public':![],'body':intUtil[_0xac38('0x12')](_0x2cf938[_0xac38('0x13')],_0x27e7ea,'\x0a')}},getCustomFields(_0x2cf938[_0xac38('0x14')],_0x27e7ea))}})[_0xac38('0x15')](function(_0x208295){logger[_0xac38('0xb')](_0xac38('0x16'));return _0x208295[_0xac38('0x17')];});}function getUser(_0x5d95fe,_0x4f5f03){if(intUtil['validateEmail'](_0x4f5f03)){logger[_0xac38('0xb')](_0xac38('0x18'),_0x4f5f03);return request({'uri':util['format'](_0xac38('0x19'),_0x5d95fe[_0xac38('0xf')]),'qs':{'query':util[_0xac38('0xd')](_0xac38('0x1a'),_0x4f5f03)}})[_0xac38('0x15')](function(_0x46d266){if(_0x46d266[_0xac38('0x1b')]){logger[_0xac38('0xb')]('Agent\x20found!');return _[_0xac38('0x1c')](_0x46d266['results'],{'email':_0x4f5f03,'role':_0xac38('0x1d')});}else{logger[_0xac38('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xac38('0xd')]('%s/users/me.json',_0x5d95fe['remoteUri'])})[_0xac38('0x15')](function(_0x51f271){logger[_0xac38('0xb')](_0xac38('0x1e'));return _0x51f271[_0xac38('0x1f')];});}});}else{logger[_0xac38('0xb')](_0xac38('0x20'));return request({'uri':util[_0xac38('0xd')](_0xac38('0x21'),_0x5d95fe[_0xac38('0xf')])})[_0xac38('0x15')](function(_0x514ed3){logger['info'](_0xac38('0x1e'));return _0x514ed3[_0xac38('0x1f')];});}}function getEndUser(_0x1fd9f1,_0x2728f9,_0x45fb28){logger[_0xac38('0xb')](_0xac38('0x22'),_0x45fb28);return request({'uri':util[_0xac38('0xd')](_0xac38('0x19'),_0x1fd9f1[_0xac38('0xf')]),'qs':{'query':util[_0xac38('0xd')](_0xac38('0x23'),_0x45fb28)}})['then'](function(_0x5a7df9){var _0xd19b23;if(_0x5a7df9['results']['length']){_0x5a7df9[_0xac38('0x24')]=_[_0xac38('0x25')](_0x5a7df9[_0xac38('0x24')],{'suspended':![],'role':_0xac38('0x26')});if(_0x5a7df9['results'][_0xac38('0x27')]){_0xd19b23=_['first'](_0x5a7df9[_0xac38('0x24')]);}}if(_0xd19b23){logger[_0xac38('0xb')](_0xac38('0x28'));return _0xd19b23;}else{logger[_0xac38('0xb')](_0xac38('0x29'));return request({'uri':util[_0xac38('0xd')](_0xac38('0x2a'),_0x1fd9f1[_0xac38('0xf')]),'method':_0xac38('0x2b'),'body':{'user':{'role':_0xac38('0x26'),'name':util[_0xac38('0xd')](_0xac38('0x2c'),_0x2728f9||_0x45fb28),'phone':_0x45fb28}}})[_0xac38('0x15')](function(_0x50151c){logger[_0xac38('0xb')]('Enduser\x20created.');return _0x50151c['user'];});}});}function getAuth(_0x133cc8){var _0x52bcd4;if(_0x133cc8['authType']===_0xac38('0x2d')){_0x52bcd4=util[_0xac38('0xd')](_0xac38('0x2e'),_0x133cc8[_0xac38('0x2f')],_0x133cc8['password']);}else if(_0x133cc8[_0xac38('0x30')]==='token'){_0x52bcd4=util[_0xac38('0xd')](_0xac38('0x31'),_0x133cc8[_0xac38('0x2f')],_0x133cc8[_0xac38('0x32')]);}return util['format'](_0xac38('0x33'),new Buffer(_0x52bcd4)['toString'](_0xac38('0x34')));}function request(_0x42456c){logger[_0xac38('0x35')](_0xac38('0x36'),JSON[_0xac38('0x37')](_0x42456c));return rp(_[_0xac38('0x5')](_0x42456c,{'method':_0xac38('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x24b58c,_0x1e44d2){var _0x1d77bd=[];if(_0x24b58c&&_0x24b58c[_0xac38('0x27')]>0x0){_0x1d77bd=_[_0xac38('0x39')](_0x24b58c,_0x1e44d2);}return _0x1d77bd;}function getCustomFields(_0x222e38,_0x3f01cc){var _0x46bc0f=[];var _0x3be7d2={'custom_fields':[]};if(_0x222e38[_0xac38('0x27')]>0x0){_[_0xac38('0x3a')](_0x222e38,function(_0x48559c){if(_[_0xac38('0x3b')]([_0xac38('0x3c'),'picklist'],_0x48559c['type'])&&_0x48559c['nameField']&&!_0x48559c[_0xac38('0x3d')]){_0x3be7d2[_0x48559c[_0xac38('0x3e')][_0xac38('0x3f')]()]=_0x48559c[_0xac38('0x40')][_0xac38('0x41')]();}else if(_['includes'](['string',_0xac38('0x42')],_0x48559c['type'])&&_0x48559c[_0xac38('0x43')]&&_0x48559c[_0xac38('0x3d')]){_0x3be7d2[_0xac38('0x44')]['push']({'id':_0x48559c['idField'],'value':_0x48559c['content'][_0xac38('0x41')]()});}else if(_0x48559c[_0xac38('0x45')]===_0xac38('0x46')&&_0x48559c[_0xac38('0x47')]&&_0x48559c[_0xac38('0x43')]&&_0x48559c[_0xac38('0x3d')]){_0x3f01cc[_0x48559c[_0xac38('0x47')]]&&_0x3be7d2[_0xac38('0x44')][_0xac38('0x48')]({'id':_0x48559c[_0xac38('0x43')],'value':_0x3f01cc[_0x48559c[_0xac38('0x47')]][_0xac38('0x41')]()});}else if(_0x48559c[_0xac38('0x45')]==='customVariable'&&_0x48559c['Variable']&&_0x48559c[_0xac38('0x49')][_0xac38('0x4a')]&&_0x48559c[_0xac38('0x43')]&&_0x48559c[_0xac38('0x3d')]){_0x3f01cc[_0x48559c['Variable'][_0xac38('0x4a')][_0xac38('0x3f')]()]&&_0x3be7d2[_0xac38('0x44')][_0xac38('0x48')]({'id':_0x48559c[_0xac38('0x43')],'value':_0x3f01cc[_0x48559c['Variable']['name'][_0xac38('0x3f')]()][_0xac38('0x41')]()});}});}return _0x3be7d2;}exports[_0xac38('0x4b')]=function(_0x392bc4,_0x597ae5,_0x2b9265,_0x4e9847,_0x2fedb6,_0x5597cd){var _0x3d3aa4,_0x2b51ad;_0x5597cd[_0xac38('0xf')]=intUtil['stripTrailingSlash'](_0x5597cd['remoteUri']);_0x5597cd[_0xac38('0x4c')]=intUtil[_0xac38('0x4d')](_0x5597cd[_0xac38('0x4c')]);if(_0x2fedb6&&_0x2fedb6[_0xac38('0x4e')]){logger[_0xac38('0xb')](_0xac38('0x4f'),_0xac38('0x50'));_0x597ae5[_0xac38('0x51')]=util['format'](_0xac38('0x52'),_0x5597cd[_0xac38('0x4c')],_0x597ae5[_0xac38('0x53')],md5(_0x597ae5[_0xac38('0x53')]));}else{_0x597ae5[_0xac38('0x51')]='';}headers[_0xac38('0x54')]=getAuth(_0x5597cd);return getUser(_0x5597cd,_0x4e9847[_0xac38('0x55')])[_0xac38('0x15')](function(_0x183361){_0x3d3aa4=_0x183361;logger[_0xac38('0xb')](_0xac38('0x56'),_0x3d3aa4['id']);return getEndUser(_0x5597cd,_0x597ae5[_0xac38('0x57')],_0x597ae5[_0xac38('0x58')]);})[_0xac38('0x15')](function(_0x475c11){_0x2b51ad=_0x475c11;logger[_0xac38('0xb')](_0xac38('0x59'),_0x2b51ad['id']);return getTicket(_0x5597cd,_0x3d3aa4,_0x2b51ad,_0x2b9265,_0x597ae5);})[_0xac38('0x15')](function(_0x430b7b){if(_0x430b7b){logger[_0xac38('0xb')](_0xac38('0x5a'),_0x430b7b['id']);switch(_0x5597cd[_0xac38('0x45')]){case _0xac38('0x5b'):logger['info'](_0xac38('0x4f'),_0xac38('0x5c'));return request({'uri':util[_0xac38('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x5597cd[_0xac38('0xf')],_0x3d3aa4['id'],_0x430b7b['id']),'method':'POST'});case'newTab':logger[_0xac38('0xb')]('[QUEUE]',_0xac38('0x5d'));emit(util['format'](_0xac38('0x5e'),_0x4e9847[_0xac38('0x4a')]),_0xac38('0x5f'),{'uri':util[_0xac38('0xd')]('%s/agent/tickets/%s',_0x5597cd['remoteUri'][_0xac38('0x60')]('/api/v2',''),_0x430b7b['id'])});break;default:logger[_0xac38('0x61')](_0xac38('0x4f'),_0xac38('0x62'));}}})[_0xac38('0x63')](function(_0x54eb97){logger[_0xac38('0x61')](_0xac38('0x64'),util[_0xac38('0x65')](_0x54eb97,{'showHidden':!![],'depth':null}));});};exports[_0xac38('0x66')]=function(_0x3adb72,_0x54d64c,_0x436ee6,_0x2a0a3d,_0x609e57,_0x3cfcb6,_0x2c614e){var _0x3da296,_0x19b5d3;_0x3cfcb6[_0xac38('0xf')]=intUtil[_0xac38('0x4d')](_0x3cfcb6[_0xac38('0xf')]);_0x3cfcb6[_0xac38('0x4c')]=intUtil[_0xac38('0x4d')](_0x3cfcb6[_0xac38('0x4c')]);if(_0x2c614e&&_0x2c614e['recordingFormat']&&_0x2c614e[_0xac38('0x67')]!==_0xac38('0x68')){logger[_0xac38('0xb')]('[OUTBOUND]',_0xac38('0x50'));_0x54d64c[_0xac38('0x51')]=util['format'](_0xac38('0x52'),_0x3cfcb6['serverUrl'],_0x54d64c[_0xac38('0x53')],md5(_0x54d64c[_0xac38('0x53')]));}headers['Authorization']=getAuth(_0x3cfcb6);return getUser(_0x3cfcb6,_0x2a0a3d[_0xac38('0x55')])[_0xac38('0x15')](function(_0x5ebbb7){_0x3da296=_0x5ebbb7;logger[_0xac38('0xb')](_0xac38('0x56'),_0x3da296['id']);return getEndUser(_0x3cfcb6,_0x54d64c['destcalleridname'],_0x54d64c[_0xac38('0x69')]);})[_0xac38('0x15')](function(_0x5d2876){_0x19b5d3=_0x5d2876;logger[_0xac38('0xb')](_0xac38('0x59'),_0x19b5d3['id']);return getTicket(_0x3cfcb6,_0x3da296,_0x19b5d3,_0x436ee6,_0x54d64c);})[_0xac38('0x15')](function(_0x5bce8e){if(_0x5bce8e){logger[_0xac38('0xb')](_0xac38('0x5a'),_0x5bce8e['id']);switch(_0x3cfcb6['type']){case _0xac38('0x5b'):logger['info']('[OUTBOUND]',_0xac38('0x5c'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x3cfcb6[_0xac38('0xf')],_0x3da296['id'],_0x5bce8e['id']),'method':_0xac38('0x2b')});case _0xac38('0x6a'):logger['info'](_0xac38('0x6b'),_0xac38('0x5d'));emit(util['format'](_0xac38('0x5e'),_0x2a0a3d[_0xac38('0x4a')]),_0xac38('0x5f'),{'uri':util[_0xac38('0xd')](_0xac38('0x6c'),_0x3cfcb6['remoteUri'][_0xac38('0x60')](_0xac38('0x6d'),''),_0x5bce8e['id'])});break;default:logger[_0xac38('0x61')](_0xac38('0x6b'),_0xac38('0x62'));}}})[_0xac38('0x63')](function(_0x2a2a12){logger[_0xac38('0x61')](_0xac38('0x6e'),util[_0xac38('0x65')](_0x2a2a12,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x412aa1,_0x3eeb5d,_0x5d1c81,_0x5614b1,_0x53a9d2,_0x2f0758){var _0x487aa6,_0x51b9ba;_0x2f0758[_0xac38('0xf')]=intUtil[_0xac38('0x4d')](_0x2f0758[_0xac38('0xf')]);_0x2f0758[_0xac38('0x4c')]=intUtil[_0xac38('0x4d')](_0x2f0758[_0xac38('0x4c')]);if(_0x53a9d2&&_0x53a9d2['monitor_format']){logger['info']('['+_0x3eeb5d[_0xac38('0x6f')][_0xac38('0x70')]()+']',_0xac38('0x50'));_0x3eeb5d[_0xac38('0x51')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2f0758['serverUrl'],_0x3eeb5d[_0xac38('0x53')],md5(_0x3eeb5d[_0xac38('0x53')]));}else{_0x3eeb5d['recordingURL']='';}headers[_0xac38('0x54')]=getAuth(_0x2f0758);return getUser(_0x2f0758)[_0xac38('0x15')](function(_0x26ddb3){_0x487aa6=_0x26ddb3;logger[_0xac38('0xb')](_0xac38('0x56'),_0x487aa6['id']);return getEndUser(_0x2f0758,_0x3eeb5d[_0xac38('0x57')],_0x3eeb5d[_0xac38('0x58')]);})[_0xac38('0x15')](function(_0x204480){_0x51b9ba=_0x204480;logger[_0xac38('0xb')](_0xac38('0x59'),_0x51b9ba['id']);return getTicket(_0x2f0758,_0x487aa6,_0x51b9ba,_0x5d1c81,_0x3eeb5d);})['then'](function(_0x225eb2){if(_0x225eb2){logger[_0xac38('0xb')](_0xac38('0x5a'),_0x225eb2['id']);}})['catch'](function(_0x509236){logger['error']('['+_0x3eeb5d['lastevent'][_0xac38('0x70')]()+']'+_0xac38('0x71'),util['inspect'](_0x509236,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xcfcd=['validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','results','agent','Admin\x20account\x20selected.','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Searching\x20enduser\x20with\x20phone','length','filter','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','token','%s/token:%s','username','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','nameField','toLowerCase','content','customField','custom_fields','push','idField','variable','variableName','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','inspect','outbound','recordingFormat','[OUTBOUND]','recordingURL','uniqueid','destcalleridname','destcalleridnum','%s/agent/tickets/%s','replace','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','calleridname','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','getString','Descriptions','Fields','then','Ticket\x20created!','ticket'];(function(_0x4c5ef3,_0x3b2b5a){var _0x524f31=function(_0x579098){while(--_0x579098){_0x4c5ef3['push'](_0x4c5ef3['shift']());}};_0x524f31(++_0x3b2b5a);}(_0xcfcd,0x147));var _0xdcfc=function(_0x59aa93,_0x2321fd){_0x59aa93=_0x59aa93-0x0;var _0x1d243b=_0xcfcd[_0x59aa93];return _0x1d243b;};'use strict';var _=require('lodash');var rp=require(_0xdcfc('0x0'));var md5=require('md5');var util=require(_0xdcfc('0x1'));var Redis=require(_0xdcfc('0x2'));var intUtil=require(_0xdcfc('0x3'));var config=require(_0xdcfc('0x4'));var logger=require(_0xdcfc('0x5'))(_0xdcfc('0x6'));config[_0xdcfc('0x7')]=_[_0xdcfc('0x8')](config[_0xdcfc('0x7')],{'host':_0xdcfc('0x9'),'port':0x18eb});var io=require(_0xdcfc('0xa'))(new Redis(config['redis']));function emit(_0x2bdc0a,_0x406ad8,_0x5382d1){io['to'](_0x2bdc0a)[_0xdcfc('0xb')](_0x406ad8,_0x5382d1);}var headers={'Content-Type':_0xdcfc('0xc'),'Accept':_0xdcfc('0xc')};function getTicket(_0x5e1b80,_0x27977d,_0x3cf348,_0x43df6f,_0x5e0797){logger[_0xdcfc('0xd')](_0xdcfc('0xe'));return request({'uri':util[_0xdcfc('0xf')](_0xdcfc('0x10'),_0x5e1b80[_0xdcfc('0x11')]),'method':_0xdcfc('0x12'),'body':{'ticket':_[_0xdcfc('0x13')]({'requester_id':_0x3cf348['id'],'submitter_id':_0x27977d?_0x27977d['id']:undefined,'assignee_id':_0x27977d?_0x27977d['id']:undefined,'tags':getTags(_0x43df6f[_0xdcfc('0x14')],'name'),'subject':intUtil[_0xdcfc('0x15')](_0x43df6f['Subjects'],_0x5e0797,'\x20'),'description':intUtil[_0xdcfc('0x15')](_0x43df6f[_0xdcfc('0x16')],_0x5e0797,'\x0a'),'comment':{'public':![],'body':intUtil[_0xdcfc('0x15')](_0x43df6f[_0xdcfc('0x16')],_0x5e0797,'\x0a')}},getCustomFields(_0x43df6f[_0xdcfc('0x17')],_0x5e0797))}})[_0xdcfc('0x18')](function(_0x96dabb){logger[_0xdcfc('0xd')](_0xdcfc('0x19'));return _0x96dabb[_0xdcfc('0x1a')];});}function getUser(_0x6c35ad,_0x28d45e){if(intUtil[_0xdcfc('0x1b')](_0x28d45e)){logger[_0xdcfc('0xd')](_0xdcfc('0x1c'),_0x28d45e);return request({'uri':util[_0xdcfc('0xf')](_0xdcfc('0x1d'),_0x6c35ad[_0xdcfc('0x11')]),'qs':{'query':util[_0xdcfc('0xf')](_0xdcfc('0x1e'),_0x28d45e)}})[_0xdcfc('0x18')](function(_0x51471f){if(_0x51471f[_0xdcfc('0x1f')]){logger[_0xdcfc('0xd')](_0xdcfc('0x20'));return _['find'](_0x51471f[_0xdcfc('0x21')],{'email':_0x28d45e,'role':_0xdcfc('0x22')});}else{logger[_0xdcfc('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format']('%s/users/me.json',_0x6c35ad[_0xdcfc('0x11')])})[_0xdcfc('0x18')](function(_0x112baf){logger[_0xdcfc('0xd')](_0xdcfc('0x23'));return _0x112baf['user'];});}});}else{logger[_0xdcfc('0xd')](_0xdcfc('0x24'));return request({'uri':util[_0xdcfc('0xf')](_0xdcfc('0x25'),_0x6c35ad[_0xdcfc('0x11')])})[_0xdcfc('0x18')](function(_0x4325f0){logger[_0xdcfc('0xd')](_0xdcfc('0x23'));return _0x4325f0['user'];});}}function getEndUser(_0x4a9088,_0x18a190,_0x3fa289){logger[_0xdcfc('0xd')](_0xdcfc('0x26'),_0x3fa289);return request({'uri':util[_0xdcfc('0xf')](_0xdcfc('0x1d'),_0x4a9088[_0xdcfc('0x11')]),'qs':{'query':util[_0xdcfc('0xf')]('type:user\x20role:end-user\x20phone:%s',_0x3fa289)}})[_0xdcfc('0x18')](function(_0x314c45){var _0x5ec36a;if(_0x314c45['results'][_0xdcfc('0x27')]){_0x314c45['results']=_[_0xdcfc('0x28')](_0x314c45[_0xdcfc('0x21')],{'suspended':![],'role':'end-user'});if(_0x314c45[_0xdcfc('0x21')][_0xdcfc('0x27')]){_0x5ec36a=_[_0xdcfc('0x29')](_0x314c45[_0xdcfc('0x21')]);}}if(_0x5ec36a){logger['info'](_0xdcfc('0x2a'));return _0x5ec36a;}else{logger[_0xdcfc('0xd')](_0xdcfc('0x2b'));return request({'uri':util['format'](_0xdcfc('0x2c'),_0x4a9088[_0xdcfc('0x11')]),'method':'POST','body':{'user':{'role':_0xdcfc('0x2d'),'name':util[_0xdcfc('0xf')](_0xdcfc('0x2e'),_0x18a190||_0x3fa289),'phone':_0x3fa289}}})[_0xdcfc('0x18')](function(_0x455760){logger[_0xdcfc('0xd')](_0xdcfc('0x2f'));return _0x455760['user'];});}});}function getAuth(_0x4825d1){var _0x30eaf6;if(_0x4825d1[_0xdcfc('0x30')]===_0xdcfc('0x31')){_0x30eaf6=util['format'](_0xdcfc('0x32'),_0x4825d1['username'],_0x4825d1[_0xdcfc('0x31')]);}else if(_0x4825d1[_0xdcfc('0x30')]===_0xdcfc('0x33')){_0x30eaf6=util[_0xdcfc('0xf')](_0xdcfc('0x34'),_0x4825d1[_0xdcfc('0x35')],_0x4825d1['token']);}return util[_0xdcfc('0xf')](_0xdcfc('0x36'),new Buffer(_0x30eaf6)[_0xdcfc('0x37')](_0xdcfc('0x38')));}function request(_0x12009e){logger[_0xdcfc('0x39')](_0xdcfc('0x3a'),JSON[_0xdcfc('0x3b')](_0x12009e));return rp(_[_0xdcfc('0x8')](_0x12009e,{'method':_0xdcfc('0x3c'),'headers':headers,'json':!![]}));}function getTags(_0x26351d,_0x499c09){var _0x3046fa=[];if(_0x26351d&&_0x26351d[_0xdcfc('0x27')]>0x0){_0x3046fa=_[_0xdcfc('0x3d')](_0x26351d,_0x499c09);}return _0x3046fa;}function getCustomFields(_0x58a858,_0x22b2f4){var _0x2a6a1d=[];var _0x88be09={'custom_fields':[]};if(_0x58a858[_0xdcfc('0x27')]>0x0){_[_0xdcfc('0x3e')](_0x58a858,function(_0xe132e7){if(_[_0xdcfc('0x3f')]([_0xdcfc('0x40'),_0xdcfc('0x41')],_0xe132e7[_0xdcfc('0x42')])&&_0xe132e7[_0xdcfc('0x43')]&&!_0xe132e7['customField']){_0x88be09[_0xe132e7[_0xdcfc('0x43')][_0xdcfc('0x44')]()]=_0xe132e7[_0xdcfc('0x45')]['toString']();}else if(_[_0xdcfc('0x3f')]([_0xdcfc('0x40'),_0xdcfc('0x41')],_0xe132e7['type'])&&_0xe132e7['idField']&&_0xe132e7[_0xdcfc('0x46')]){_0x88be09[_0xdcfc('0x47')][_0xdcfc('0x48')]({'id':_0xe132e7[_0xdcfc('0x49')],'value':_0xe132e7['content'][_0xdcfc('0x37')]()});}else if(_0xe132e7[_0xdcfc('0x42')]===_0xdcfc('0x4a')&&_0xe132e7[_0xdcfc('0x4b')]&&_0xe132e7[_0xdcfc('0x49')]&&_0xe132e7[_0xdcfc('0x46')]){_0x22b2f4[_0xe132e7[_0xdcfc('0x4b')]]&&_0x88be09[_0xdcfc('0x47')][_0xdcfc('0x48')]({'id':_0xe132e7['idField'],'value':_0x22b2f4[_0xe132e7[_0xdcfc('0x4b')]][_0xdcfc('0x37')]()});}else if(_0xe132e7[_0xdcfc('0x42')]===_0xdcfc('0x4c')&&_0xe132e7[_0xdcfc('0x4d')]&&_0xe132e7[_0xdcfc('0x4d')][_0xdcfc('0x4e')]&&_0xe132e7['idField']&&_0xe132e7['customField']){_0x22b2f4[_0xe132e7[_0xdcfc('0x4d')][_0xdcfc('0x4e')][_0xdcfc('0x44')]()]&&_0x88be09['custom_fields']['push']({'id':_0xe132e7[_0xdcfc('0x49')],'value':_0x22b2f4[_0xe132e7[_0xdcfc('0x4d')][_0xdcfc('0x4e')][_0xdcfc('0x44')]()]['toString']()});}});}return _0x88be09;}exports[_0xdcfc('0x4f')]=function(_0x3685ee,_0x105de2,_0x55b92f,_0xd4425b,_0x4f9eaf,_0xee505b){var _0x38fa5e,_0x4521fe;_0xee505b[_0xdcfc('0x11')]=intUtil[_0xdcfc('0x50')](_0xee505b['remoteUri']);_0xee505b[_0xdcfc('0x51')]=intUtil[_0xdcfc('0x50')](_0xee505b[_0xdcfc('0x51')]);if(_0x4f9eaf&&_0x4f9eaf[_0xdcfc('0x52')]){logger[_0xdcfc('0xd')](_0xdcfc('0x53'),_0xdcfc('0x54'));_0x105de2['recordingURL']=util['format'](_0xdcfc('0x55'),_0xee505b['serverUrl'],_0x105de2['uniqueid'],md5(_0x105de2['uniqueid']));}else{_0x105de2['recordingURL']='';}headers[_0xdcfc('0x56')]=getAuth(_0xee505b);return getUser(_0xee505b,_0xd4425b[_0xdcfc('0x57')])[_0xdcfc('0x18')](function(_0x2a13f4){_0x38fa5e=_0x2a13f4;logger[_0xdcfc('0xd')](_0xdcfc('0x58'),_0x38fa5e['id']);return getEndUser(_0xee505b,_0x105de2['calleridname'],_0x105de2[_0xdcfc('0x59')]);})[_0xdcfc('0x18')](function(_0x3878ab){_0x4521fe=_0x3878ab;logger[_0xdcfc('0xd')](_0xdcfc('0x5a'),_0x4521fe['id']);return getTicket(_0xee505b,_0x38fa5e,_0x4521fe,_0x55b92f,_0x105de2);})[_0xdcfc('0x18')](function(_0x4218af){if(_0x4218af){logger[_0xdcfc('0xd')](_0xdcfc('0x5b'),_0x4218af['id']);switch(_0xee505b[_0xdcfc('0x42')]){case _0xdcfc('0x5c'):logger['info'](_0xdcfc('0x53'),_0xdcfc('0x5d'));return request({'uri':util[_0xdcfc('0xf')](_0xdcfc('0x5e'),_0xee505b[_0xdcfc('0x11')],_0x38fa5e['id'],_0x4218af['id']),'method':_0xdcfc('0x12')});case _0xdcfc('0x5f'):logger[_0xdcfc('0xd')](_0xdcfc('0x53'),_0xdcfc('0x60'));emit(util[_0xdcfc('0xf')](_0xdcfc('0x61'),_0xd4425b['name']),_0xdcfc('0x62'),{'uri':util[_0xdcfc('0xf')]('%s/agent/tickets/%s',_0xee505b[_0xdcfc('0x11')]['replace'](_0xdcfc('0x63'),''),_0x4218af['id'])});break;default:logger[_0xdcfc('0x64')](_0xdcfc('0x53'),_0xdcfc('0x65'));}}})['catch'](function(_0x50d7d2){logger[_0xdcfc('0x64')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0xdcfc('0x66')](_0x50d7d2,{'showHidden':!![],'depth':null}));});};exports[_0xdcfc('0x67')]=function(_0x47e29f,_0x2f5c1d,_0x3845b1,_0x2110c0,_0x8e2c5,_0x552711,_0x3d0f16){var _0x21bccb,_0x4f13f7;_0x552711[_0xdcfc('0x11')]=intUtil[_0xdcfc('0x50')](_0x552711[_0xdcfc('0x11')]);_0x552711[_0xdcfc('0x51')]=intUtil[_0xdcfc('0x50')](_0x552711[_0xdcfc('0x51')]);if(_0x3d0f16&&_0x3d0f16['recordingFormat']&&_0x3d0f16[_0xdcfc('0x68')]!=='none'){logger[_0xdcfc('0xd')](_0xdcfc('0x69'),_0xdcfc('0x54'));_0x2f5c1d[_0xdcfc('0x6a')]=util[_0xdcfc('0xf')](_0xdcfc('0x55'),_0x552711[_0xdcfc('0x51')],_0x2f5c1d[_0xdcfc('0x6b')],md5(_0x2f5c1d[_0xdcfc('0x6b')]));}headers['Authorization']=getAuth(_0x552711);return getUser(_0x552711,_0x2110c0[_0xdcfc('0x57')])['then'](function(_0x42f8b4){_0x21bccb=_0x42f8b4;logger[_0xdcfc('0xd')]('The\x20User\x20ID\x20is:',_0x21bccb['id']);return getEndUser(_0x552711,_0x2f5c1d[_0xdcfc('0x6c')],_0x2f5c1d[_0xdcfc('0x6d')]);})[_0xdcfc('0x18')](function(_0x310913){_0x4f13f7=_0x310913;logger['info'](_0xdcfc('0x5a'),_0x4f13f7['id']);return getTicket(_0x552711,_0x21bccb,_0x4f13f7,_0x3845b1,_0x2f5c1d);})['then'](function(_0x4d6303){if(_0x4d6303){logger[_0xdcfc('0xd')]('The\x20Ticket\x20ID\x20is:',_0x4d6303['id']);switch(_0x552711['type']){case _0xdcfc('0x5c'):logger['info'](_0xdcfc('0x69'),_0xdcfc('0x5d'));return request({'uri':util[_0xdcfc('0xf')](_0xdcfc('0x5e'),_0x552711[_0xdcfc('0x11')],_0x21bccb['id'],_0x4d6303['id']),'method':_0xdcfc('0x12')});case _0xdcfc('0x5f'):logger[_0xdcfc('0xd')]('[OUTBOUND]',_0xdcfc('0x60'));emit(util[_0xdcfc('0xf')](_0xdcfc('0x61'),_0x2110c0[_0xdcfc('0x4e')]),'trigger:browser:url',{'uri':util[_0xdcfc('0xf')](_0xdcfc('0x6e'),_0x552711['remoteUri'][_0xdcfc('0x6f')]('/api/v2',''),_0x4d6303['id'])});break;default:logger[_0xdcfc('0x64')](_0xdcfc('0x69'),_0xdcfc('0x65'));}}})[_0xdcfc('0x70')](function(_0x1c97a7){logger['error'](_0xdcfc('0x71'),util[_0xdcfc('0x66')](_0x1c97a7,{'showHidden':!![],'depth':null}));});};exports[_0xdcfc('0x72')]=function(_0x5a6c94,_0x3efbee,_0x1e0e1c,_0x52bb95,_0x5834f6,_0x353698){var _0x14ea39,_0x12437f;_0x353698[_0xdcfc('0x11')]=intUtil[_0xdcfc('0x50')](_0x353698['remoteUri']);_0x353698[_0xdcfc('0x51')]=intUtil[_0xdcfc('0x50')](_0x353698['serverUrl']);if(_0x5834f6&&_0x5834f6['monitor_format']){logger[_0xdcfc('0xd')]('['+_0x3efbee[_0xdcfc('0x73')][_0xdcfc('0x74')]()+']',_0xdcfc('0x54'));_0x3efbee[_0xdcfc('0x6a')]=util['format'](_0xdcfc('0x55'),_0x353698['serverUrl'],_0x3efbee[_0xdcfc('0x6b')],md5(_0x3efbee[_0xdcfc('0x6b')]));}else{_0x3efbee[_0xdcfc('0x6a')]='';}headers[_0xdcfc('0x56')]=getAuth(_0x353698);return getUser(_0x353698)[_0xdcfc('0x18')](function(_0x33ecd5){_0x14ea39=_0x33ecd5;logger[_0xdcfc('0xd')](_0xdcfc('0x58'),_0x14ea39['id']);return getEndUser(_0x353698,_0x3efbee[_0xdcfc('0x75')],_0x3efbee['calleridnum']);})[_0xdcfc('0x18')](function(_0x1149fb){_0x12437f=_0x1149fb;logger[_0xdcfc('0xd')](_0xdcfc('0x5a'),_0x12437f['id']);return getTicket(_0x353698,_0x14ea39,_0x12437f,_0x1e0e1c,_0x3efbee);})[_0xdcfc('0x18')](function(_0x4ab5df){if(_0x4ab5df){logger['info'](_0xdcfc('0x5b'),_0x4ab5df['id']);}})[_0xdcfc('0x70')](function(_0x4b8c7e){logger['error']('['+_0x3efbee[_0xdcfc('0x73')][_0xdcfc('0x74')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0xdcfc('0x66')](_0x4b8c7e,{'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 da86665..cac8e6e 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 _0x7dbe=['abandoned','timeout','Timeout','Call_Start_Time','agentcalledAt','Call_Type','merge','Fields','/crm/v2/Calls','Call\x20created!','details','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','none','[OUTBOUND]','/downloads?type=uniqueid&token=','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','unmanaged','toUpperCase','calleridnum','Inbound','lodash','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','emit','debug','[HTTP]','forEach','includes','string','picklist','type','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','indexOf','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','then','catch','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','user','profile','error','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','startCase','role','first_name','last_name','code','SUCCESS','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','moduleCreate','nothing','contact','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Full_Name','Last_Name','What_Id','First_Name','$se_module','talktime','Call_Duration','utc','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','lastevent','called','Call_Result','complete','connect','Answered','Rejected'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7dbe,0x16d));var _0xe7db=function(_0x26a137,_0x238c59){_0x26a137=_0x26a137-0x0;var _0x3049d3=_0x7dbe[_0x26a137];return _0x3049d3;};'use strict';var _=require(_0xe7db('0x0'));var rp=require('request-promise');var md5=require(_0xe7db('0x1'));var util=require(_0xe7db('0x2'));var intUtil=require(_0xe7db('0x3'));var moment=require(_0xe7db('0x4'));var Redis=require(_0xe7db('0x5'));var BPromise=require(_0xe7db('0x6'));var config=require(_0xe7db('0x7'));var logger=require(_0xe7db('0x8'))('zoho');config[_0xe7db('0x9')]=_[_0xe7db('0xa')](config[_0xe7db('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe7db('0x9')]));function emit(_0x1811a3,_0x1c2221,_0x52653a){io['to'](_0x1811a3)[_0xe7db('0xb')](_0x1c2221,_0x52653a);}function request(_0x1b725b){logger[_0xe7db('0xc')](_0xe7db('0xd'),JSON['stringify'](_0x1b725b));return rp(_0x1b725b);}function getCustomFields(_0x3324ec,_0x229285){var _0x59e66f={};if(_0x3324ec['length']>0x0){_[_0xe7db('0xe')](_0x3324ec,function(_0x37ce6c){if(_[_0xe7db('0xf')]([_0xe7db('0x10'),_0xe7db('0x11')],_0x37ce6c[_0xe7db('0x12')])&&_0x37ce6c['idField']){_0x59e66f[_0x37ce6c[_0xe7db('0x13')]]=_0x37ce6c[_0xe7db('0x14')]['toString']();}else if(_0x37ce6c['type']===_0xe7db('0x15')&&_0x37ce6c[_0xe7db('0x16')]&&_0x37ce6c['idField']&&_0x229285[_0x37ce6c[_0xe7db('0x16')]]){_0x59e66f[_0x37ce6c[_0xe7db('0x13')]]=_0x229285[_0x37ce6c[_0xe7db('0x16')]][_0xe7db('0x17')]();}else if(_0x37ce6c[_0xe7db('0x12')]===_0xe7db('0x18')&&_0x37ce6c[_0xe7db('0x19')]&&_0x37ce6c['Variable'][_0xe7db('0x1a')]&&_0x37ce6c[_0xe7db('0x13')]&&_0x229285[_0x37ce6c['Variable'][_0xe7db('0x1a')][_0xe7db('0x1b')]()]){_0x59e66f[_0x37ce6c[_0xe7db('0x13')]]=_0x229285[_0x37ce6c[_0xe7db('0x19')][_0xe7db('0x1a')][_0xe7db('0x1b')]()][_0xe7db('0x17')]();}});}return _0x59e66f;}function getName(_0x49f03f){if(_0x49f03f[_0xe7db('0x1c')]('\x20')>0x0){var _0x1f5d12=_0x49f03f['split'](/ (.+)/);if(_0x1f5d12[0x1]){return _0x1f5d12;}}return[_0x49f03f,_0x49f03f];}var accountsTokens={};function getAccessToken(_0x641144){return new Promise(function(_0x2b14a2,_0x14cc6a){if(!_['isNil'](accountsTokens[_0x641144['id']])&&!_[_0xe7db('0x1d')](accountsTokens[_0x641144['id']][_0xe7db('0x1e')])){if(moment()['isBefore'](accountsTokens[_0x641144['id']][_0xe7db('0x1f')])){_0x2b14a2(accountsTokens[_0x641144['id']][_0xe7db('0x1e')]);}}var _0x31e91d;switch(_0x641144[_0xe7db('0x20')]){case'US':_0x31e91d=_0xe7db('0x21');break;case'AU':_0x31e91d=_0xe7db('0x22');break;case'EU':_0x31e91d=_0xe7db('0x23');break;case'IN':_0x31e91d=_0xe7db('0x24');break;case'CN':_0x31e91d=_0xe7db('0x25');break;default:_0x31e91d=_0xe7db('0x23');break;}var _0x21e4e7={'method':_0xe7db('0x26'),'uri':_0x31e91d+_0xe7db('0x27'),'qs':{'refresh_token':_0x641144[_0xe7db('0x28')],'client_id':_0x641144[_0xe7db('0x29')],'client_secret':_0x641144[_0xe7db('0x2a')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x21e4e7)[_0xe7db('0x2b')](function(_0x2c0675){accountsTokens[_0x641144['id']]={'access_token':_0x2c0675[_0xe7db('0x1e')],'expires_in':moment()['add'](_0x2c0675[_0xe7db('0x1f')],'seconds')};_0x2b14a2(_0x2c0675[_0xe7db('0x1e')]);})[_0xe7db('0x2c')](function(_0x4dd3e4){logger['error'](_0xe7db('0x2d'),_0x4dd3e4[_0xe7db('0x2e')]);_0x14cc6a(_0x4dd3e4);});});}function getUser(_0x5d2666,_0x2f3714,_0x544699,_0x19337f){logger[_0xe7db('0x2f')](_0xe7db('0x30'));return request({'method':_0xe7db('0x31'),'uri':util[_0xe7db('0x32')](_0xe7db('0x33'),_0x2f3714),'qs':{'type':_0xe7db('0x34')},'headers':{'Authorization':_0xe7db('0x35')+_0x5d2666},'json':!![]})['then'](function(_0x55ad21){if(_0x55ad21[_0xe7db('0x36')]){var _0x9c80c9=-0x1;if(_[_0xe7db('0x37')](_0x55ad21[_0xe7db('0x36')])){if(!_[_0xe7db('0x1d')](_0x19337f)){_0x9c80c9=_[_0xe7db('0x38')](_0x55ad21[_0xe7db('0x36')],function(_0x4b212e){return _0x4b212e[_0xe7db('0x39')]===_0x19337f;});}if(_0x9c80c9>=0x0){logger['info'](_0xe7db('0x3a'));}else{logger[_0xe7db('0x2f')](_0xe7db('0x3b'));_0x9c80c9=_[_0xe7db('0x38')](_0x55ad21[_0xe7db('0x36')],function(_0x1f714a){return _0x1f714a['profile'][_0xe7db('0x1a')]===_0xe7db('0x3c');});}return _0x55ad21['users'][_0x9c80c9];}else{if(_0x55ad21[_0xe7db('0x3d')][_0xe7db('0x3e')]['name']===_0xe7db('0x3c')){logger['info'](_0xe7db('0x3b'));user=_0x55ad21[_0xe7db('0x3d')];return user;}else{logger[_0xe7db('0x3f')](_0xe7db('0x40'),JSON[_0xe7db('0x41')](_0x55ad21));throw new Error(_0xe7db('0x42')+JSON[_0xe7db('0x41')](_0x55ad21));}}}else{logger[_0xe7db('0x3f')]('The\x20failing\x20result\x20is',JSON['stringify'](_0x55ad21));throw new Error(_0xe7db('0x42')+JSON['stringify'](_0x55ad21));}})[_0xe7db('0x2c')](function(_0x45fb27){console[_0xe7db('0x3f')](_0x45fb27);});}function getZohoUser(_0x1dc1ab,_0x4c6d9b){return new BPromise(function(_0x3a2e5c,_0x1cff2a){request(_0x1dc1ab)['then'](function(_0x2e0bbc){var _0x101f8b=null;if(_0x2e0bbc){_0x101f8b=_0x2e0bbc[_0xe7db('0x43')][0x0];_0x101f8b[_0xe7db('0x44')]=_0x4c6d9b;}_0x3a2e5c(_0x101f8b);})[_0xe7db('0x2c')](function(_0x5d5040){_0x1cff2a(_0x5d5040);});});}function createEndUser(_0x4edacf,_0x3e4cbf,_0x4d44f4,_0x35414c,_0xd7c862,_0x52085a){var _0x4d44f4=getName(_0x4d44f4);return request({'method':_0xe7db('0x26'),'uri':_0xe7db('0x45')+_0x3e4cbf+'/crm/v2/'+_[_0xe7db('0x46')](_0x52085a['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x4d44f4[0x1],'First_Name':_0x4d44f4[0x0],'Phone':_0x35414c,'Owner':{'name':!_[_0xe7db('0x1d')](_0xd7c862['role'][_0xe7db('0x1a')])?_0xd7c862[_0xe7db('0x47')][_0xe7db('0x1a')]:!_[_0xe7db('0x1d')](_0xd7c862[_0xe7db('0x48')])?_0xd7c862['first_name']+'\x20'+_0xd7c862[_0xe7db('0x49')]:_0xd7c862[_0xe7db('0x49')],'id':_0xd7c862['id']}}]},'headers':{'Authorization':_0xe7db('0x35')+_0x4edacf},'json':!![]})[_0xe7db('0x2b')](function(_0x4fa927){if(_0x4fa927&&_0x4fa927[_0xe7db('0x43')][0x0][_0xe7db('0x4a')]===_0xe7db('0x4b')){var _0x32a8b6=_0x4fa927[_0xe7db('0x43')][0x0]['details'];_0x32a8b6[_0xe7db('0x44')]=_['startCase'](_0x52085a['moduleCreate'])+'s';return _0x32a8b6;}logger[_0xe7db('0x3f')](_0xe7db('0x40'),JSON[_0xe7db('0x41')](data));throw new Error(_0xe7db('0x4c')+JSON['stringify'](data));})[_0xe7db('0x2c')](function(_0x18d704){console[_0xe7db('0x4d')](_0xe7db('0x4e'),_0x18d704);});}function getEndUser(_0x5eadda,_0x37d362,_0x4613b7,_0x32dfa4,_0x4be2b4,_0x1fa626,_0x41eb7e){var _0x40177f={'method':_0xe7db('0x31'),'uri':'','headers':{'Authorization':_0xe7db('0x35')+_0x5eadda},'json':!![]};switch(_0x41eb7e[_0xe7db('0x4f')]){case _0xe7db('0x50'):_0x40177f[_0xe7db('0x51')]='https://www.zohoapis.'+_0x37d362+_0xe7db('0x52')+_0x4be2b4+'))';return getZohoUser(_0x40177f,_0xe7db('0x53'))[_0xe7db('0x2b')](function(_0x4b95c8){if(_0x4b95c8)return _0x4b95c8;_0x40177f[_0xe7db('0x51')]='https://www.zohoapis.'+_0x37d362+_0xe7db('0x54')+_0x4be2b4+'))';return getZohoUser(_0x40177f,_0xe7db('0x55'))['then'](function(_0x2cf2d3){if(_0x2cf2d3)return _0x2cf2d3;if(_0x41eb7e[_0xe7db('0x56')]!=_0xe7db('0x57')){return createEndUser(_0x5eadda,_0x37d362,_0x32dfa4,_0x4be2b4,_0x1fa626,_0x41eb7e);}else{return{};}});});break;case _0xe7db('0x58'):_0x40177f[_0xe7db('0x51')]=_0xe7db('0x45')+_0x37d362+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x4be2b4+'))';return getZohoUser(_0x40177f,_0xe7db('0x53'))['then'](function(_0x39afd9){if(_0x39afd9)return _0x39afd9;if(_0x41eb7e[_0xe7db('0x56')]!=_0xe7db('0x57')){return createEndUser(_0x5eadda,_0x37d362,_0x32dfa4,_0x4be2b4,_0x1fa626,_0x41eb7e);}else{return{};}});break;case _0xe7db('0x59'):_0x40177f[_0xe7db('0x51')]='https://www.zohoapis.'+_0x37d362+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x4be2b4+'))';return getZohoUser(_0x40177f,'Leads')['then'](function(_0x516607){if(_0x516607)return _0x516607;if(_0x41eb7e[_0xe7db('0x56')]!=_0xe7db('0x57')){return createEndUser(_0x5eadda,_0x37d362,_0x32dfa4,_0x4be2b4,_0x1fa626,_0x41eb7e);}else{return{};}});break;}}function getCall(_0x5299cf,_0x104cef,_0xc383cb,_0x46dce2,_0x14b693,_0x412028,_0x3a94ef,_0x275e09){logger[_0xe7db('0x2f')](_0xe7db('0x5a'));var _0x54ffa7={};_0x54ffa7[_0xe7db('0x5b')]={'name':!_['isNil'](_0x46dce2[_0xe7db('0x47')][_0xe7db('0x1a')])&&!_[_0xe7db('0x1d')](_0x46dce2[_0xe7db('0x3e')][_0xe7db('0x1a')])&&_0x46dce2[_0xe7db('0x3e')][_0xe7db('0x1a')]===_0xe7db('0x5c')?_0x46dce2[_0xe7db('0x47')][_0xe7db('0x1a')]:!_[_0xe7db('0x1d')](_0x46dce2['first_name'])?_0x46dce2[_0xe7db('0x48')]+'\x20'+_0x46dce2[_0xe7db('0x49')]:_0x46dce2[_0xe7db('0x49')],'id':_0x46dce2['id']};_0x54ffa7[_0xe7db('0x5d')]=intUtil[_0xe7db('0x5e')](_0x412028[_0xe7db('0x5f')],_0x3a94ef,'\x20');_0x54ffa7[_0xe7db('0x60')]=intUtil['getString'](_0x412028['Descriptions'],_0x3a94ef,'\x0a');if(_0x14b693[_0xe7db('0x44')]===_0xe7db('0x53')){_0x54ffa7['Who_Id']={'name':!_[_0xe7db('0x1d')](_0x14b693[_0xe7db('0x61')])?_0x14b693[_0xe7db('0x61')]:!_[_0xe7db('0x1d')](_0x14b693['First_Name'])?_0x14b693['First_Name']+'\x20'+_0x14b693[_0xe7db('0x62')]:_0x14b693['Last_Name'],'id':_0x14b693['id']};}if(_0x14b693['enduserType']===_0xe7db('0x55')){_0x54ffa7[_0xe7db('0x63')]={'name':!_['isNil'](_0x14b693['Full_Name'])?_0x14b693['Full_Name']:!_['isNil'](_0x14b693[_0xe7db('0x64')])?_0x14b693[_0xe7db('0x64')]+'\x20'+_0x14b693[_0xe7db('0x62')]:_0x14b693[_0xe7db('0x62')],'id':_0x14b693['id']};_0x54ffa7[_0xe7db('0x65')]=_[_0xe7db('0x46')](_0x14b693[_0xe7db('0x44')]);}if(_0x3a94ef[_0xe7db('0x66')]){_0x54ffa7[_0xe7db('0x67')]=moment[_0xe7db('0x68')](parseInt(_0x3a94ef[_0xe7db('0x66')])*0x3e8)['format']('mm:ss');}else if(_0x3a94ef[_0xe7db('0x69')]&&_0x3a94ef[_0xe7db('0x6a')]){_0x54ffa7[_0xe7db('0x67')]=moment[_0xe7db('0x68')](moment(_0x3a94ef[_0xe7db('0x6a')],_0xe7db('0x6b'))[_0xe7db('0x6c')](moment(_0x3a94ef[_0xe7db('0x6d')],_0xe7db('0x6b'))))[_0xe7db('0x32')](_0xe7db('0x6e'));}switch(_0x3a94ef[_0xe7db('0x6f')]){case _0xe7db('0x70'):_0x54ffa7[_0xe7db('0x71')]='Called';break;case _0xe7db('0x72'):case _0xe7db('0x73'):_0x54ffa7[_0xe7db('0x71')]=_0xe7db('0x74');break;case'rejected':_0x54ffa7[_0xe7db('0x71')]=_0xe7db('0x75');break;case _0xe7db('0x76'):_0x54ffa7[_0xe7db('0x71')]='Abandoned';break;case _0xe7db('0x77'):_0x54ffa7[_0xe7db('0x71')]=_0xe7db('0x78');default:}_0x54ffa7[_0xe7db('0x79')]=(_0x275e09==='outbound'?moment(_0x3a94ef['starttime'])[_0xe7db('0x32')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x3a94ef[_0xe7db('0x7a')])[_0xe7db('0x32')](_0xe7db('0x6b')))||moment()[_0xe7db('0x32')]('YYYY-MM-DDTHH:mm:ss');_0x54ffa7[_0xe7db('0x7b')]=_0x275e09||'Inbound';_0x54ffa7=_[_0xe7db('0x7c')](_0x54ffa7,getCustomFields(_0x412028[_0xe7db('0x7d')],_0x3a94ef));return request({'method':_0xe7db('0x26'),'uri':'https://www.zohoapis.'+_0x104cef+_0xe7db('0x7e'),'headers':{'Authorization':_0xe7db('0x35')+_0x5299cf},'body':{'data':[_0x54ffa7]},'json':!![]})[_0xe7db('0x2b')](function(_0x20ce79){if(_0x20ce79&&_0x20ce79[_0xe7db('0x43')][0x0][_0xe7db('0x4a')]===_0xe7db('0x4b')){logger['info'](_0xe7db('0x7f'));return{'id':_0x20ce79[_0xe7db('0x43')][0x0][_0xe7db('0x80')]['id']};}})[_0xe7db('0x2c')](function(_0x43958e){logger[_0xe7db('0x2f')]('err',_0x43958e[_0xe7db('0x2e')]);console[_0xe7db('0x4d')](_0xe7db('0x81'),_0x43958e);});}exports[_0xe7db('0x82')]=function(_0x2c6adf,_0x11c6ff,_0x2ff72c,_0x29b348,_0x1badbf,_0x42c13c){var _0x58de3c,_0x37fc98,_0x135205;_0x42c13c[_0xe7db('0x83')]=intUtil[_0xe7db('0x84')](_0x42c13c[_0xe7db('0x83')]);_0x42c13c[_0xe7db('0x85')]=intUtil[_0xe7db('0x84')](_0x42c13c[_0xe7db('0x85')]);if(_0x1badbf&&_0x1badbf[_0xe7db('0x86')]){logger[_0xe7db('0x2f')](_0xe7db('0x87'),_0xe7db('0x88'));_0x11c6ff[_0xe7db('0x89')]=_0x42c13c['serverUrl']+_0xe7db('0x8a')+_0x11c6ff['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x11c6ff[_0xe7db('0x8b')]);}else{_0x11c6ff[_0xe7db('0x89')]='';}var _0x3eb934=_0x42c13c[_0xe7db('0x83')]===_0xe7db('0x8c')?'eu':_0xe7db('0x8d');return getAccessToken(_0x42c13c)[_0xe7db('0x2b')](function(_0x18c16e){_0x135205=_0x18c16e;return getUser(_0x135205,_0x3eb934,_0x42c13c,_0x29b348[_0xe7db('0x39')]);})[_0xe7db('0x2b')](function(_0x114884){_0x58de3c=_0x114884;logger[_0xe7db('0x2f')](_0xe7db('0x8e'),_0x58de3c['id']);return getEndUser(_0x135205,_0x3eb934,_0x42c13c,_0x11c6ff[_0xe7db('0x8f')],_0x11c6ff['calleridnum'],_0x58de3c,_0x2ff72c);})[_0xe7db('0x2b')](function(_0x3dc8b2){_0x37fc98=_0x3dc8b2;return getCall(_0x135205,_0x3eb934,_0x42c13c,_0x58de3c,_0x37fc98,_0x2ff72c,_0x11c6ff,'Inbound');})[_0xe7db('0x2b')](function(_0x4ae9ae){if(_0x4ae9ae){logger[_0xe7db('0x2f')]('The\x20Call\x20ID\x20is:',_0x4ae9ae['id']);logger[_0xe7db('0x2f')](_0xe7db('0x87'),_0xe7db('0x90'));emit(util[_0xe7db('0x32')](_0xe7db('0x91'),_0x29b348[_0xe7db('0x1a')]),_0xe7db('0x92'),{'uri':_0xe7db('0x93')+_0x42c13c[_0xe7db('0x83')]+_0xe7db('0x94')+_0x4ae9ae['id']});}})['catch'](function(_0x13eb5e){logger[_0xe7db('0x3f')](_0xe7db('0x87'),JSON[_0xe7db('0x41')](_0x13eb5e));});};exports[_0xe7db('0x95')]=function(_0x764931,_0xa8493d,_0x2f7752,_0x45225d,_0x42ff26,_0x218653,_0x49bf8f){var _0x5426d5,_0x109603,_0x1bfe12;_0x218653[_0xe7db('0x83')]=intUtil[_0xe7db('0x84')](_0x218653[_0xe7db('0x83')]);_0x218653['serverUrl']=intUtil[_0xe7db('0x84')](_0x218653[_0xe7db('0x85')]);if(_0x49bf8f&&_0x49bf8f['recordingFormat']&&_0x49bf8f['recordingFormat']!==_0xe7db('0x96')){logger['info'](_0xe7db('0x97'),'Recording\x20is\x20enabled!');_0xa8493d['recordingURL']=_0x218653['serverUrl']+_0xe7db('0x8a')+_0xa8493d['uniqueid']+_0xe7db('0x98')+md5(_0xa8493d[_0xe7db('0x8b')]);}var _0x57e8e6=_0x218653[_0xe7db('0x83')]===_0xe7db('0x8c')?'eu':_0xe7db('0x8d');return getAccessToken(_0x218653)[_0xe7db('0x2b')](function(_0x102ff9){_0x1bfe12=_0x102ff9;return getUser(_0x1bfe12,_0x57e8e6,_0x218653,_0x45225d[_0xe7db('0x39')]);})[_0xe7db('0x2b')](function(_0x13af21){_0x5426d5=_0x13af21;logger[_0xe7db('0x2f')](_0xe7db('0x8e'),_0x5426d5['id']);return getEndUser(_0x1bfe12,_0x57e8e6,_0x218653,_0xa8493d[_0xe7db('0x99')],_0xa8493d[_0xe7db('0x9a')],_0x5426d5,_0x2f7752);})[_0xe7db('0x2b')](function(_0x45150f){_0x109603=_0x45150f;return getCall(_0x1bfe12,_0x57e8e6,_0x218653,_0x5426d5,_0x109603,_0x2f7752,_0xa8493d,_0xe7db('0x9b'));})[_0xe7db('0x2b')](function(_0x5165ba){if(_0x5165ba){logger[_0xe7db('0x2f')](_0xe7db('0x9c'),_0x5165ba['id']);logger['info']('[OUTBOUND]',_0xe7db('0x90'));emit(util[_0xe7db('0x32')]('user:%s',_0x45225d['name']),'trigger:browser:url',{'uri':_0xe7db('0x93')+_0x218653[_0xe7db('0x83')]+_0xe7db('0x94')+_0x5165ba['id']});}})[_0xe7db('0x2c')](function(_0x4baa4b){logger[_0xe7db('0x3f')](_0xe7db('0x97'),JSON[_0xe7db('0x41')](_0x4baa4b));});};exports[_0xe7db('0x9d')]=function(_0xd60fa1,_0x197153,_0x3e87ad,_0x325309,_0x122eef,_0x36854d){var _0x4df407,_0x60ccac,_0x1239db;_0x36854d[_0xe7db('0x83')]=intUtil[_0xe7db('0x84')](_0x36854d[_0xe7db('0x83')]);_0x36854d['serverUrl']=intUtil[_0xe7db('0x84')](_0x36854d['serverUrl']);if(_0x122eef&&_0x122eef[_0xe7db('0x86')]){logger[_0xe7db('0x2f')]('['+_0x197153[_0xe7db('0x6f')][_0xe7db('0x9e')]()+']',_0xe7db('0x88'));_0x197153['recordingURL']=_0x36854d[_0xe7db('0x85')]+_0xe7db('0x8a')+_0x197153[_0xe7db('0x8b')]+'/downloads?type=uniqueid&token='+md5(_0x197153['uniqueid']);}else{_0x197153['recordingURL']='';}var _0x53499b=_0x36854d[_0xe7db('0x83')]===_0xe7db('0x8c')?'eu':'com';return getAccessToken(_0x36854d)['then'](function(_0x5abb4f){_0x1239db=_0x5abb4f;return getUser(_0x1239db,_0x53499b,_0x36854d);})['then'](function(_0x3bf2b3){_0x4df407=_0x3bf2b3;logger['info'](_0xe7db('0x8e'),_0x4df407['id']);return getEndUser(_0x1239db,_0x53499b,_0x36854d,_0x197153['calleridname'],_0x197153[_0xe7db('0x9f')],_0x4df407,_0x3e87ad);})[_0xe7db('0x2b')](function(_0x289180){_0x60ccac=_0x289180;return getCall(_0x1239db,_0x53499b,_0x36854d,_0x4df407,_0x60ccac,_0x3e87ad,_0x197153,_0xe7db('0xa0'));})[_0xe7db('0x2b')](function(_0x305efc){if(_0x305efc){logger[_0xe7db('0x2f')](_0xe7db('0x9c'),_0x305efc['id']);}})[_0xe7db('0x2c')](function(_0x2babf5){logger[_0xe7db('0x3f')]('['+_0x197153[_0xe7db('0x6f')][_0xe7db('0x9e')]()+']',JSON[_0xe7db('0x41')](_0x2babf5));});}; \ No newline at end of file +var _0x6183=['YYYY-MM-DDTHH:mm:ss','agentcalledAt','merge','Fields','/crm/v2/Calls','Call\x20created!','err','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','recordingFormat','none','Recording\x20is\x20enabled!','/api/voice/recordings/','destcalleridname','Outbound','user:%s','/crm/EntityInfo.do?module=Calls&id=','unmanaged','toUpperCase','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','emit','debug','stringify','forEach','includes','string','picklist','idField','toString','type','variableName','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','refreshToken','clientId','then','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','user','Administrator','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','POST','https://www.zohoapis.','startCase','role','first_name','last_name','code','SUCCESS','details','enduserType','moduleCreate','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','lead','Creating\x20new\x20call...','administrator','Subject','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','starttime','lastevent','called','Call_Result','Called','complete','Answered','Rejected','abandoned','Abandoned','Timeout','Call_Start_Time','outbound'];(function(_0x49ba2a,_0x5aaf83){var _0xd65a13=function(_0x5912b6){while(--_0x5912b6){_0x49ba2a['push'](_0x49ba2a['shift']());}};_0xd65a13(++_0x5aaf83);}(_0x6183,0x1e2));var _0x3618=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0x6183[_0x36ed3c];return _0x52a2e0;};'use strict';var _=require(_0x3618('0x0'));var rp=require(_0x3618('0x1'));var md5=require(_0x3618('0x2'));var util=require(_0x3618('0x3'));var intUtil=require(_0x3618('0x4'));var moment=require(_0x3618('0x5'));var Redis=require(_0x3618('0x6'));var BPromise=require(_0x3618('0x7'));var config=require(_0x3618('0x8'));var logger=require(_0x3618('0x9'))(_0x3618('0xa'));config[_0x3618('0xb')]=_[_0x3618('0xc')](config[_0x3618('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x3618('0xd'))(new Redis(config[_0x3618('0xb')]));function emit(_0x4b3a95,_0x29c084,_0x5c6b24){io['to'](_0x4b3a95)[_0x3618('0xe')](_0x29c084,_0x5c6b24);}function request(_0xe549b9){logger[_0x3618('0xf')]('[HTTP]',JSON[_0x3618('0x10')](_0xe549b9));return rp(_0xe549b9);}function getCustomFields(_0x35b29a,_0x275616){var _0x283e6f={};if(_0x35b29a['length']>0x0){_[_0x3618('0x11')](_0x35b29a,function(_0x12fe9d){if(_[_0x3618('0x12')]([_0x3618('0x13'),_0x3618('0x14')],_0x12fe9d['type'])&&_0x12fe9d[_0x3618('0x15')]){_0x283e6f[_0x12fe9d[_0x3618('0x15')]]=_0x12fe9d['content'][_0x3618('0x16')]();}else if(_0x12fe9d[_0x3618('0x17')]==='variable'&&_0x12fe9d[_0x3618('0x18')]&&_0x12fe9d['idField']&&_0x275616[_0x12fe9d[_0x3618('0x18')]]){_0x283e6f[_0x12fe9d[_0x3618('0x15')]]=_0x275616[_0x12fe9d[_0x3618('0x18')]]['toString']();}else if(_0x12fe9d['type']==='customVariable'&&_0x12fe9d[_0x3618('0x19')]&&_0x12fe9d['Variable'][_0x3618('0x1a')]&&_0x12fe9d[_0x3618('0x15')]&&_0x275616[_0x12fe9d['Variable'][_0x3618('0x1a')][_0x3618('0x1b')]()]){_0x283e6f[_0x12fe9d['idField']]=_0x275616[_0x12fe9d[_0x3618('0x19')][_0x3618('0x1a')][_0x3618('0x1b')]()]['toString']();}});}return _0x283e6f;}function getName(_0x2fb9a3){if(_0x2fb9a3[_0x3618('0x1c')]('\x20')>0x0){var _0x1584ef=_0x2fb9a3[_0x3618('0x1d')](/ (.+)/);if(_0x1584ef[0x1]){return _0x1584ef;}}return[_0x2fb9a3,_0x2fb9a3];}var accountsTokens={};function getAccessToken(_0xfc49d0){return new Promise(function(_0x57bc6e,_0x5e8344){if(!_[_0x3618('0x1e')](accountsTokens[_0xfc49d0['id']])&&!_[_0x3618('0x1e')](accountsTokens[_0xfc49d0['id']][_0x3618('0x1f')])){if(moment()[_0x3618('0x20')](accountsTokens[_0xfc49d0['id']][_0x3618('0x21')])){_0x57bc6e(accountsTokens[_0xfc49d0['id']][_0x3618('0x1f')]);}}var _0x4c0de3;switch(_0xfc49d0['zone']){case'US':_0x4c0de3='https://accounts.zoho.com';break;case'AU':_0x4c0de3=_0x3618('0x22');break;case'EU':_0x4c0de3='https://accounts.zoho.eu';break;case'IN':_0x4c0de3=_0x3618('0x23');break;case'CN':_0x4c0de3=_0x3618('0x24');break;default:_0x4c0de3='https://accounts.zoho.eu';break;}var _0x210ab7={'method':'POST','uri':_0x4c0de3+'/oauth/v2/token','qs':{'refresh_token':_0xfc49d0[_0x3618('0x25')],'client_id':_0xfc49d0[_0x3618('0x26')],'client_secret':_0xfc49d0['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x210ab7)[_0x3618('0x27')](function(_0x119189){accountsTokens[_0xfc49d0['id']]={'access_token':_0x119189[_0x3618('0x1f')],'expires_in':moment()['add'](_0x119189[_0x3618('0x21')],_0x3618('0x28'))};_0x57bc6e(_0x119189['access_token']);})[_0x3618('0x29')](function(_0x45bc1d){logger[_0x3618('0x2a')](_0x3618('0x2b'),_0x45bc1d[_0x3618('0x2c')]);_0x5e8344(_0x45bc1d);});});}function getUser(_0x1343bf,_0x405731,_0x353a30,_0x33eaed){logger[_0x3618('0x2d')](_0x3618('0x2e'));return request({'method':_0x3618('0x2f'),'uri':util[_0x3618('0x30')](_0x3618('0x31'),_0x405731),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x3618('0x32')+_0x1343bf},'json':!![]})['then'](function(_0x4816e4){if(_0x4816e4[_0x3618('0x33')]){var _0x240ee1=-0x1;if(_[_0x3618('0x34')](_0x4816e4['users'])){if(!_['isNil'](_0x33eaed)){_0x240ee1=_[_0x3618('0x35')](_0x4816e4['users'],function(_0x4392fd){return _0x4392fd[_0x3618('0x36')]===_0x33eaed;});}if(_0x240ee1>=0x0){logger[_0x3618('0x2d')](_0x3618('0x37'));}else{logger['info'](_0x3618('0x38'));_0x240ee1=_['findIndex'](_0x4816e4['users'],function(_0x167c98){return _0x167c98[_0x3618('0x39')][_0x3618('0x1a')]==='Administrator';});}return _0x4816e4[_0x3618('0x33')][_0x240ee1];}else{if(_0x4816e4[_0x3618('0x3a')][_0x3618('0x39')][_0x3618('0x1a')]===_0x3618('0x3b')){logger[_0x3618('0x2d')]('Using\x20the\x20admin\x20account!');user=_0x4816e4[_0x3618('0x3a')];return user;}else{logger['error'](_0x3618('0x3c'),JSON[_0x3618('0x10')](_0x4816e4));throw new Error(_0x3618('0x3d')+JSON[_0x3618('0x10')](_0x4816e4));}}}else{logger[_0x3618('0x2a')](_0x3618('0x3c'),JSON[_0x3618('0x10')](_0x4816e4));throw new Error(_0x3618('0x3d')+JSON['stringify'](_0x4816e4));}})[_0x3618('0x29')](function(_0x344dd9){console[_0x3618('0x2a')](_0x344dd9);});}function getZohoUser(_0x427629,_0x161d69){return new BPromise(function(_0x43f943,_0x3ce276){request(_0x427629)['then'](function(_0x5eff7b){var _0x30585e=null;if(_0x5eff7b){_0x30585e=_0x5eff7b[_0x3618('0x3e')][0x0];_0x30585e['enduserType']=_0x161d69;}_0x43f943(_0x30585e);})[_0x3618('0x29')](function(_0x54ccf0){_0x3ce276(_0x54ccf0);});});}function createEndUser(_0x3184d5,_0x7bb2d5,_0x86ba56,_0x2b8a7c,_0x4c4a09,_0x53da77){var _0x86ba56=getName(_0x86ba56);return request({'method':_0x3618('0x3f'),'uri':_0x3618('0x40')+_0x7bb2d5+'/crm/v2/'+_[_0x3618('0x41')](_0x53da77['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x86ba56[0x1],'First_Name':_0x86ba56[0x0],'Phone':_0x2b8a7c,'Owner':{'name':!_[_0x3618('0x1e')](_0x4c4a09[_0x3618('0x42')][_0x3618('0x1a')])?_0x4c4a09[_0x3618('0x42')][_0x3618('0x1a')]:!_[_0x3618('0x1e')](_0x4c4a09[_0x3618('0x43')])?_0x4c4a09['first_name']+'\x20'+_0x4c4a09[_0x3618('0x44')]:_0x4c4a09['last_name'],'id':_0x4c4a09['id']}}]},'headers':{'Authorization':_0x3618('0x32')+_0x3184d5},'json':!![]})[_0x3618('0x27')](function(_0x56964c){if(_0x56964c&&_0x56964c[_0x3618('0x3e')][0x0][_0x3618('0x45')]===_0x3618('0x46')){var _0x50be2f=_0x56964c[_0x3618('0x3e')][0x0][_0x3618('0x47')];_0x50be2f[_0x3618('0x48')]=_[_0x3618('0x41')](_0x53da77[_0x3618('0x49')])+'s';return _0x50be2f;}logger['error'](_0x3618('0x3c'),JSON['stringify'](data));throw new Error('Error:\x20'+JSON[_0x3618('0x10')](data));})[_0x3618('0x29')](function(_0x3a68c9){console[_0x3618('0x4a')](_0x3618('0x4b'),_0x3a68c9);});}function getEndUser(_0x29a6b2,_0x4ce0fe,_0x5ca54e,_0x342487,_0x540f93,_0x1da847,_0x54e806){var _0x6b68a1={'method':_0x3618('0x2f'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x29a6b2},'json':!![]};switch(_0x54e806[_0x3618('0x4c')]){case _0x3618('0x4d'):_0x6b68a1[_0x3618('0x4e')]='https://www.zohoapis.'+_0x4ce0fe+_0x3618('0x4f')+_0x540f93+'))';return getZohoUser(_0x6b68a1,_0x3618('0x50'))[_0x3618('0x27')](function(_0x299633){if(_0x299633)return _0x299633;_0x6b68a1[_0x3618('0x4e')]=_0x3618('0x40')+_0x4ce0fe+_0x3618('0x51')+_0x540f93+'))';return getZohoUser(_0x6b68a1,_0x3618('0x52'))[_0x3618('0x27')](function(_0x223b4b){if(_0x223b4b)return _0x223b4b;if(_0x54e806['moduleCreate']!=_0x3618('0x53')){return createEndUser(_0x29a6b2,_0x4ce0fe,_0x342487,_0x540f93,_0x1da847,_0x54e806);}else{return{};}});});break;case'contact':_0x6b68a1[_0x3618('0x4e')]=_0x3618('0x40')+_0x4ce0fe+_0x3618('0x4f')+_0x540f93+'))';return getZohoUser(_0x6b68a1,_0x3618('0x50'))[_0x3618('0x27')](function(_0x164299){if(_0x164299)return _0x164299;if(_0x54e806[_0x3618('0x49')]!=_0x3618('0x53')){return createEndUser(_0x29a6b2,_0x4ce0fe,_0x342487,_0x540f93,_0x1da847,_0x54e806);}else{return{};}});break;case _0x3618('0x54'):_0x6b68a1['uri']=_0x3618('0x40')+_0x4ce0fe+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x540f93+'))';return getZohoUser(_0x6b68a1,_0x3618('0x52'))['then'](function(_0x48bbd5){if(_0x48bbd5)return _0x48bbd5;if(_0x54e806['moduleCreate']!=_0x3618('0x53')){return createEndUser(_0x29a6b2,_0x4ce0fe,_0x342487,_0x540f93,_0x1da847,_0x54e806);}else{return{};}});break;}}function getCall(_0x2c4510,_0x29b70c,_0x295a5f,_0x4231c1,_0x8e39e9,_0x1d6d1d,_0x5de2fb,_0x17ece7){logger[_0x3618('0x2d')](_0x3618('0x55'));var _0xea4abd={};_0xea4abd['Owner']={'name':!_[_0x3618('0x1e')](_0x4231c1[_0x3618('0x42')][_0x3618('0x1a')])&&!_[_0x3618('0x1e')](_0x4231c1['profile'][_0x3618('0x1a')])&&_0x4231c1['profile'][_0x3618('0x1a')]===_0x3618('0x56')?_0x4231c1[_0x3618('0x42')]['name']:!_['isNil'](_0x4231c1[_0x3618('0x43')])?_0x4231c1[_0x3618('0x43')]+'\x20'+_0x4231c1['last_name']:_0x4231c1[_0x3618('0x44')],'id':_0x4231c1['id']};_0xea4abd[_0x3618('0x57')]=intUtil['getString'](_0x1d6d1d[_0x3618('0x58')],_0x5de2fb,'\x20');_0xea4abd[_0x3618('0x59')]=intUtil['getString'](_0x1d6d1d[_0x3618('0x5a')],_0x5de2fb,'\x0a');if(_0x8e39e9[_0x3618('0x48')]==='Contacts'){_0xea4abd[_0x3618('0x5b')]={'name':!_[_0x3618('0x1e')](_0x8e39e9[_0x3618('0x5c')])?_0x8e39e9[_0x3618('0x5c')]:!_['isNil'](_0x8e39e9['First_Name'])?_0x8e39e9[_0x3618('0x5d')]+'\x20'+_0x8e39e9['Last_Name']:_0x8e39e9[_0x3618('0x5e')],'id':_0x8e39e9['id']};}if(_0x8e39e9[_0x3618('0x48')]===_0x3618('0x52')){_0xea4abd[_0x3618('0x5f')]={'name':!_[_0x3618('0x1e')](_0x8e39e9['Full_Name'])?_0x8e39e9[_0x3618('0x5c')]:!_[_0x3618('0x1e')](_0x8e39e9[_0x3618('0x5d')])?_0x8e39e9[_0x3618('0x5d')]+'\x20'+_0x8e39e9[_0x3618('0x5e')]:_0x8e39e9[_0x3618('0x5e')],'id':_0x8e39e9['id']};_0xea4abd[_0x3618('0x60')]=_[_0x3618('0x41')](_0x8e39e9['enduserType']);}if(_0x5de2fb[_0x3618('0x61')]){_0xea4abd[_0x3618('0x62')]=moment[_0x3618('0x63')](parseInt(_0x5de2fb['talktime'])*0x3e8)[_0x3618('0x30')](_0x3618('0x64'));}else if(_0x5de2fb['answertime']&&_0x5de2fb['endtime']){_0xea4abd[_0x3618('0x62')]=moment[_0x3618('0x63')](moment(_0x5de2fb['endtime'],'YYYY-MM-DDTHH:mm:ss')['diff'](moment(_0x5de2fb[_0x3618('0x65')],'YYYY-MM-DDTHH:mm:ss')))[_0x3618('0x30')]('mm:ss');}switch(_0x5de2fb[_0x3618('0x66')]){case _0x3618('0x67'):_0xea4abd[_0x3618('0x68')]=_0x3618('0x69');break;case _0x3618('0x6a'):case'connect':_0xea4abd[_0x3618('0x68')]=_0x3618('0x6b');break;case'rejected':_0xea4abd[_0x3618('0x68')]=_0x3618('0x6c');break;case _0x3618('0x6d'):_0xea4abd[_0x3618('0x68')]=_0x3618('0x6e');break;case'timeout':_0xea4abd['Call_Result']=_0x3618('0x6f');default:}_0xea4abd[_0x3618('0x70')]=(_0x17ece7===_0x3618('0x71')?moment(_0x5de2fb[_0x3618('0x65')])['format'](_0x3618('0x72')):moment(_0x5de2fb[_0x3618('0x73')])['format'](_0x3618('0x72')))||moment()[_0x3618('0x30')](_0x3618('0x72'));_0xea4abd['Call_Type']=_0x17ece7||'Inbound';_0xea4abd=_[_0x3618('0x74')](_0xea4abd,getCustomFields(_0x1d6d1d[_0x3618('0x75')],_0x5de2fb));return request({'method':_0x3618('0x3f'),'uri':_0x3618('0x40')+_0x29b70c+_0x3618('0x76'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2c4510},'body':{'data':[_0xea4abd]},'json':!![]})[_0x3618('0x27')](function(_0x236d76){if(_0x236d76&&_0x236d76[_0x3618('0x3e')][0x0]['code']===_0x3618('0x46')){logger[_0x3618('0x2d')](_0x3618('0x77'));return{'id':_0x236d76['data'][0x0][_0x3618('0x47')]['id']};}})[_0x3618('0x29')](function(_0x10f5ef){logger[_0x3618('0x2d')](_0x3618('0x78'),_0x10f5ef['stack']);console[_0x3618('0x4a')](_0x3618('0x78'),_0x10f5ef);});}exports['queue']=function(_0xd318f3,_0x2462ba,_0x3bf357,_0x2c6a51,_0x4dc2bf,_0x278530){var _0x1259de,_0x5d7151,_0x2f09df;_0x278530[_0x3618('0x79')]=intUtil[_0x3618('0x7a')](_0x278530[_0x3618('0x79')]);_0x278530['serverUrl']=intUtil[_0x3618('0x7a')](_0x278530[_0x3618('0x7b')]);if(_0x4dc2bf&&_0x4dc2bf[_0x3618('0x7c')]){logger[_0x3618('0x2d')](_0x3618('0x7d'),'Recording\x20is\x20enabled!');_0x2462ba[_0x3618('0x7e')]=_0x278530[_0x3618('0x7b')]+'/api/voice/recordings/'+_0x2462ba['uniqueid']+_0x3618('0x7f')+md5(_0x2462ba[_0x3618('0x80')]);}else{_0x2462ba[_0x3618('0x7e')]='';}var _0x1088ef=_0x278530['host']===_0x3618('0x81')?'eu':_0x3618('0x82');return getAccessToken(_0x278530)['then'](function(_0x33deaa){_0x2f09df=_0x33deaa;return getUser(_0x2f09df,_0x1088ef,_0x278530,_0x2c6a51['email']);})['then'](function(_0xe1cb0e){_0x1259de=_0xe1cb0e;logger[_0x3618('0x2d')](_0x3618('0x83'),_0x1259de['id']);return getEndUser(_0x2f09df,_0x1088ef,_0x278530,_0x2462ba[_0x3618('0x84')],_0x2462ba[_0x3618('0x85')],_0x1259de,_0x3bf357);})[_0x3618('0x27')](function(_0x3729bd){_0x5d7151=_0x3729bd;return getCall(_0x2f09df,_0x1088ef,_0x278530,_0x1259de,_0x5d7151,_0x3bf357,_0x2462ba,_0x3618('0x86'));})[_0x3618('0x27')](function(_0x12c5e6){if(_0x12c5e6){logger[_0x3618('0x2d')](_0x3618('0x87'),_0x12c5e6['id']);logger[_0x3618('0x2d')]('[QUEUE]',_0x3618('0x88'));emit(util[_0x3618('0x30')]('user:%s',_0x2c6a51[_0x3618('0x1a')]),_0x3618('0x89'),{'uri':_0x3618('0x8a')+_0x278530['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x12c5e6['id']});}})[_0x3618('0x29')](function(_0x3bf2b5){logger[_0x3618('0x2a')](_0x3618('0x7d'),JSON[_0x3618('0x10')](_0x3bf2b5));});};exports[_0x3618('0x71')]=function(_0x518f25,_0x25a8ed,_0xbe1bb7,_0x2c70a5,_0x4ac87a,_0x718f43,_0x4caea5){var _0x1b5f74,_0x3aa66c,_0x9fa0cf;_0x718f43[_0x3618('0x79')]=intUtil[_0x3618('0x7a')](_0x718f43[_0x3618('0x79')]);_0x718f43[_0x3618('0x7b')]=intUtil['stripTrailingSlash'](_0x718f43['serverUrl']);if(_0x4caea5&&_0x4caea5[_0x3618('0x8b')]&&_0x4caea5['recordingFormat']!==_0x3618('0x8c')){logger['info']('[OUTBOUND]',_0x3618('0x8d'));_0x25a8ed[_0x3618('0x7e')]=_0x718f43[_0x3618('0x7b')]+_0x3618('0x8e')+_0x25a8ed['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x25a8ed[_0x3618('0x80')]);}var _0x3efd76=_0x718f43[_0x3618('0x79')]==='zoho.eu'?'eu':_0x3618('0x82');return getAccessToken(_0x718f43)['then'](function(_0x4bddc3){_0x9fa0cf=_0x4bddc3;return getUser(_0x9fa0cf,_0x3efd76,_0x718f43,_0x2c70a5[_0x3618('0x36')]);})[_0x3618('0x27')](function(_0x1bd0de){_0x1b5f74=_0x1bd0de;logger[_0x3618('0x2d')](_0x3618('0x83'),_0x1b5f74['id']);return getEndUser(_0x9fa0cf,_0x3efd76,_0x718f43,_0x25a8ed[_0x3618('0x8f')],_0x25a8ed['destcalleridnum'],_0x1b5f74,_0xbe1bb7);})[_0x3618('0x27')](function(_0x560b0f){_0x3aa66c=_0x560b0f;return getCall(_0x9fa0cf,_0x3efd76,_0x718f43,_0x1b5f74,_0x3aa66c,_0xbe1bb7,_0x25a8ed,_0x3618('0x90'));})['then'](function(_0x24cb90){if(_0x24cb90){logger[_0x3618('0x2d')](_0x3618('0x87'),_0x24cb90['id']);logger[_0x3618('0x2d')]('[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x3618('0x30')](_0x3618('0x91'),_0x2c70a5['name']),'trigger:browser:url',{'uri':'https://crm.'+_0x718f43[_0x3618('0x79')]+_0x3618('0x92')+_0x24cb90['id']});}})[_0x3618('0x29')](function(_0x2be61a){logger[_0x3618('0x2a')]('[OUTBOUND]',JSON[_0x3618('0x10')](_0x2be61a));});};exports[_0x3618('0x93')]=function(_0x557edc,_0x13cc27,_0x2a8d65,_0x5a5e79,_0x5aa7ab,_0x15504e){var _0x17fa27,_0x1ce42c,_0x1964b3;_0x15504e[_0x3618('0x79')]=intUtil[_0x3618('0x7a')](_0x15504e[_0x3618('0x79')]);_0x15504e['serverUrl']=intUtil[_0x3618('0x7a')](_0x15504e[_0x3618('0x7b')]);if(_0x5aa7ab&&_0x5aa7ab['monitor_format']){logger['info']('['+_0x13cc27['lastevent'][_0x3618('0x94')]()+']','Recording\x20is\x20enabled!');_0x13cc27['recordingURL']=_0x15504e[_0x3618('0x7b')]+'/api/voice/recordings/'+_0x13cc27[_0x3618('0x80')]+'/downloads?type=uniqueid&token='+md5(_0x13cc27[_0x3618('0x80')]);}else{_0x13cc27[_0x3618('0x7e')]='';}var _0x356aa8=_0x15504e[_0x3618('0x79')]===_0x3618('0x81')?'eu':'com';return getAccessToken(_0x15504e)[_0x3618('0x27')](function(_0x3a10e5){_0x1964b3=_0x3a10e5;return getUser(_0x1964b3,_0x356aa8,_0x15504e);})['then'](function(_0x3620d6){_0x17fa27=_0x3620d6;logger[_0x3618('0x2d')](_0x3618('0x83'),_0x17fa27['id']);return getEndUser(_0x1964b3,_0x356aa8,_0x15504e,_0x13cc27['calleridname'],_0x13cc27[_0x3618('0x85')],_0x17fa27,_0x2a8d65);})['then'](function(_0x5a1197){_0x1ce42c=_0x5a1197;return getCall(_0x1964b3,_0x356aa8,_0x15504e,_0x17fa27,_0x1ce42c,_0x2a8d65,_0x13cc27,_0x3618('0x86'));})[_0x3618('0x27')](function(_0x3bfbf8){if(_0x3bfbf8){logger[_0x3618('0x2d')](_0x3618('0x87'),_0x3bfbf8['id']);}})[_0x3618('0x29')](function(_0x1a5293){logger[_0x3618('0x2a')]('['+_0x13cc27[_0x3618('0x66')][_0x3618('0x94')]()+']',JSON[_0x3618('0x10')](_0x1a5293));});}; \ 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 26730e2..62e0656 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 _0xa3a0=['info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','trigger','exec','data2','Script','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s'];(function(_0x4f1b87,_0x260834){var _0x74718e=function(_0x24c7c2){while(--_0x24c7c2){_0x4f1b87['push'](_0x4f1b87['shift']());}};_0x74718e(++_0x260834);}(_0xa3a0,0x11a));var _0x0a3a=function(_0x2c1f41,_0xc56665){_0x2c1f41=_0x2c1f41-0x0;var _0x53a353=_0xa3a0[_0x2c1f41];return _0x53a353;};'use strict';var util=require(_0x0a3a('0x0'));var sh=require(_0x0a3a('0x1'));var Mustache=require(_0x0a3a('0x2'));var logger=require('../../../../config/logger')(_0x0a3a('0x3'));exports[_0x0a3a('0x4')]=function(_0x735ce1,_0xf604ce){var _0x38a2d1=_0x735ce1[_0x0a3a('0x5')]?_0x735ce1['data2']:_0x0a3a('0x6');var _0x58475f=_0x735ce1[_0x0a3a('0x7')]?Mustache[_0x0a3a('0x8')](_0x735ce1[_0x0a3a('0x7')],_0xf604ce):_0xf604ce;sh[_0x0a3a('0x4')](_0x58475f,function(_0x4578e9,_0x2fe8f7,_0x2b9a07){if(_0x4578e9!==0x0){logger[_0x0a3a('0x9')](util[_0x0a3a('0xa')](_0x0a3a('0xb'),_0x38a2d1,_0x58475f,_0x4578e9,_0x2b9a07));}else{logger[_0x0a3a('0xc')](util[_0x0a3a('0xa')](_0x0a3a('0xd'),_0x38a2d1,_0x58475f,_0x2fe8f7));}});}; \ No newline at end of file +var _0x5fa7=['%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','../../../../config/logger','trigger','exec','data2','render','data3','error','format'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x5fa7,0xf3));var _0x75fa=function(_0x448bfd,_0xe73ef0){_0x448bfd=_0x448bfd-0x0;var _0x1b8c2d=_0x5fa7[_0x448bfd];return _0x1b8c2d;};'use strict';var util=require('util');var sh=require(_0x75fa('0x0'));var Mustache=require('mustache');var logger=require(_0x75fa('0x1'))(_0x75fa('0x2'));exports[_0x75fa('0x3')]=function(_0xd3a4fb,_0x5ffbcb){var _0x412f2a=_0xd3a4fb[_0x75fa('0x4')]?_0xd3a4fb[_0x75fa('0x4')]:'Script';var _0x49876a=_0xd3a4fb['data3']?Mustache[_0x75fa('0x5')](_0xd3a4fb[_0x75fa('0x6')],_0x5ffbcb):_0x5ffbcb;sh[_0x75fa('0x3')](_0x49876a,function(_0x557d29,_0x50d7ed,_0x4df014){if(_0x557d29!==0x0){logger[_0x75fa('0x7')](util[_0x75fa('0x8')](_0x75fa('0x9'),_0x412f2a,_0x49876a,_0x557d29,_0x4df014));}else{logger[_0x75fa('0xa')](util[_0x75fa('0x8')](_0x75fa('0xb'),_0x412f2a,_0x49876a,_0x50d7ed));}});}; \ 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 0ca59f8..1db1449 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 _0xa2e2=['%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','message','request-promise','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','data5','number','headers','data6','parse','render','error','stack','GET','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then',',\x20request\x20body:\x20','object','stringify','info','data2','catch'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xa2e2,0x162));var _0x2a2e=function(_0x32be7d,_0x1e1fd6){_0x32be7d=_0x32be7d-0x0;var _0x3ddf=_0xa2e2[_0x32be7d];return _0x3ddf;};'use strict';var rp=require(_0x2a2e('0x0'));var util=require('util');var _=require(_0x2a2e('0x1'));var Mustache=require(_0x2a2e('0x2'));var logger=require(_0x2a2e('0x3'))(_0x2a2e('0x4'));exports[_0x2a2e('0x5')]=function(_0x7569ad,_0x59ae04){var _0x1a0570,_0x2c28ec;var _0x2d4c8a={'method':_0x7569ad[_0x2a2e('0x6')][_0x2a2e('0x7')](),'uri':Mustache['render'](_0x7569ad['data2'],_0x59ae04),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x7569ad[_0x2a2e('0x8')])===_0x2a2e('0x9')&&parseInt(_0x7569ad[_0x2a2e('0x8')])>=0x1&&parseInt(_0x7569ad[_0x2a2e('0x8')])<=0xa?parseInt(_0x7569ad[_0x2a2e('0x8')])*0x3e8:0x5*0x3e8};try{_0x2d4c8a[_0x2a2e('0xa')]=_0x7569ad[_0x2a2e('0xb')]?JSON[_0x2a2e('0xc')](Mustache[_0x2a2e('0xd')](_0x7569ad[_0x2a2e('0xb')],_0x59ae04)):{};}catch(_0x10c8a3){logger[_0x2a2e('0xe')](_0x10c8a3[_0x2a2e('0xf')]);}switch(_0x7569ad[_0x2a2e('0x6')][_0x2a2e('0x7')]()){case _0x2a2e('0x10'):case _0x2a2e('0x11'):_0x1a0570=null;_0x2d4c8a['qs']=_0x59ae04;break;case _0x2a2e('0x12'):case _0x2a2e('0x13'):if(_0x7569ad[_0x2a2e('0x14')]){try{_0x1a0570=JSON[_0x2a2e('0xc')](Mustache[_0x2a2e('0xd')](_0x7569ad['data7'],_0x59ae04));_0x2d4c8a[_0x2a2e('0x15')]=_0x1a0570;}catch(_0x50d8a1){logger[_0x2a2e('0xe')](_0x50d8a1[_0x2a2e('0xf')]);logger[_0x2a2e('0xe')](_0x2a2e('0x16'));}}else{_0x1a0570=_0x59ae04;_0x2d4c8a[_0x2a2e('0x15')]=_0x1a0570;}break;}logger['info'](util['format'](_0x2a2e('0x17'),_0x7569ad[_0x2a2e('0x6')],_0x7569ad['data2'],JSON['stringify'](_0x2d4c8a)));rp(_0x2d4c8a)[_0x2a2e('0x18')](function(_0x383216){_0x1a0570=!_['isNil'](_0x1a0570)?_0x2a2e('0x19')+_0x1a0570:'';_0x2c28ec=typeof _0x383216[_0x2a2e('0x15')]===_0x2a2e('0x1a')?JSON[_0x2a2e('0x1b')](_0x383216['body']):_0x383216[_0x2a2e('0x15')];logger[_0x2a2e('0x1c')](util['format']('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x7569ad[_0x2a2e('0x6')],_0x7569ad[_0x2a2e('0x1d')],_0x383216['statusCode'],_0x2c28ec));})[_0x2a2e('0x1e')](function(_0x255ee1){logger[_0x2a2e('0xe')](util['format'](_0x2a2e('0x1f'),_0x7569ad[_0x2a2e('0x6')],_0x7569ad[_0x2a2e('0x1d')],_0x255ee1[_0x2a2e('0x20')],_0x255ee1[_0x2a2e('0x21')],_0x255ee1[_0x2a2e('0x22')]));});}; \ No newline at end of file +var _0xbe64=['../../../../config/logger','trigger','exec','data1','data2','data5','number','data6','parse','render','toUpperCase','GET','DELETE','POST','data7','body','error','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then','isNil','stringify','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','message','request-promise','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbe64,0x7a));var _0x4be6=function(_0x493a51,_0x45128c){_0x493a51=_0x493a51-0x0;var _0xc85756=_0xbe64[_0x493a51];return _0xc85756;};'use strict';var rp=require(_0x4be6('0x0'));var util=require('util');var _=require(_0x4be6('0x1'));var Mustache=require('mustache');var logger=require(_0x4be6('0x2'))(_0x4be6('0x3'));exports[_0x4be6('0x4')]=function(_0x39f2b6,_0x313b55){var _0x1385a1,_0x104114;var _0x4fcfb0={'method':_0x39f2b6[_0x4be6('0x5')]['toUpperCase'](),'uri':Mustache['render'](_0x39f2b6[_0x4be6('0x6')],_0x313b55),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x39f2b6[_0x4be6('0x7')])===_0x4be6('0x8')&&parseInt(_0x39f2b6[_0x4be6('0x7')])>=0x1&&parseInt(_0x39f2b6['data5'])<=0xa?parseInt(_0x39f2b6['data5'])*0x3e8:0x5*0x3e8};try{_0x4fcfb0['headers']=_0x39f2b6[_0x4be6('0x9')]?JSON[_0x4be6('0xa')](Mustache[_0x4be6('0xb')](_0x39f2b6['data6'],_0x313b55)):{};}catch(_0x45a685){logger['error'](_0x45a685['stack']);}switch(_0x39f2b6[_0x4be6('0x5')][_0x4be6('0xc')]()){case _0x4be6('0xd'):case _0x4be6('0xe'):_0x1385a1=null;_0x4fcfb0['qs']=_0x313b55;break;case _0x4be6('0xf'):case'PUT':if(_0x39f2b6[_0x4be6('0x10')]){try{_0x1385a1=JSON[_0x4be6('0xa')](Mustache[_0x4be6('0xb')](_0x39f2b6[_0x4be6('0x10')],_0x313b55));_0x4fcfb0[_0x4be6('0x11')]=_0x1385a1;}catch(_0x3e6d7d){logger[_0x4be6('0x12')](_0x3e6d7d[_0x4be6('0x13')]);logger[_0x4be6('0x12')](_0x4be6('0x14'));}}else{_0x1385a1=_0x313b55;_0x4fcfb0[_0x4be6('0x11')]=_0x1385a1;}break;}logger[_0x4be6('0x15')](util[_0x4be6('0x16')](_0x4be6('0x17'),_0x39f2b6[_0x4be6('0x5')],_0x39f2b6['data2'],JSON['stringify'](_0x4fcfb0)));rp(_0x4fcfb0)[_0x4be6('0x18')](function(_0x26661a){_0x1385a1=!_[_0x4be6('0x19')](_0x1385a1)?',\x20request\x20body:\x20'+_0x1385a1:'';_0x104114=typeof _0x26661a[_0x4be6('0x11')]==='object'?JSON[_0x4be6('0x1a')](_0x26661a['body']):_0x26661a['body'];logger[_0x4be6('0x15')](util[_0x4be6('0x16')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x39f2b6['data1'],_0x39f2b6[_0x4be6('0x6')],_0x26661a['statusCode'],_0x104114));})['catch'](function(_0x16b7b3){logger['error'](util[_0x4be6('0x16')](_0x4be6('0x1b'),_0x39f2b6[_0x4be6('0x5')],_0x39f2b6[_0x4be6('0x6')],_0x16b7b3[_0x4be6('0x1c')],_0x16b7b3[_0x4be6('0x1d')],_0x16b7b3[_0x4be6('0x1e')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index ab43d26..810dfe2 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 _0x6950=['routing','error','message','result','catch','jayson/promise','../../config/logger','http','Request','debug','rpc'];(function(_0x154bde,_0x154bef){var _0x926d94=function(_0x1d2b72){while(--_0x1d2b72){_0x154bde['push'](_0x154bde['shift']());}};_0x926d94(++_0x154bef);}(_0x6950,0x144));var _0x0695=function(_0x389ec7,_0x1c920c){_0x389ec7=_0x389ec7-0x0;var _0x40f216=_0x6950[_0x389ec7];return _0x40f216;};'use strict';var jayson=require(_0x0695('0x0'));var BPromise=require('bluebird');var logger=require(_0x0695('0x1'))('routing');var client=jayson['client'][_0x0695('0x2')]({'port':0x2329});client[_0x0695('0x3')]=function(_0x14a4f3,_0x2ab03){return new BPromise(function(_0x222bfc,_0x152341){return client['request'](_0x14a4f3,_0x2ab03)['then'](function(_0x2506bb){logger[_0x0695('0x4')](_0x0695('0x5'),_0x0695('0x6'),_0x14a4f3,_0x2ab03,_0x2506bb);if(_0x2506bb['error']){logger[_0x0695('0x7')](_0x0695('0x5'),_0x0695('0x6'),_0x14a4f3,_0x2506bb[_0x0695('0x7')]['message'],_0x2ab03);return _0x152341(_0x2506bb['error'][_0x0695('0x8')]);}else{return _0x222bfc(_0x2506bb[_0x0695('0x9')]);}})[_0x0695('0xa')](function(_0x38953b){logger[_0x0695('0x7')]('rpc','routing',_0x14a4f3,_0x38953b,_0x2ab03);return _0x152341(_0x38953b);});});};module['exports']=client; \ No newline at end of file +var _0x926a=['request','debug','rpc','error','message','result','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request'];(function(_0xe28bc5,_0x3107c8){var _0x45bc49=function(_0x1bc59b){while(--_0x1bc59b){_0xe28bc5['push'](_0xe28bc5['shift']());}};_0x45bc49(++_0x3107c8);}(_0x926a,0x11f));var _0xa926=function(_0x5cf43f,_0x29508a){_0x5cf43f=_0x5cf43f-0x0;var _0x31eb19=_0x926a[_0x5cf43f];return _0x31eb19;};'use strict';var jayson=require(_0xa926('0x0'));var BPromise=require(_0xa926('0x1'));var logger=require(_0xa926('0x2'))(_0xa926('0x3'));var client=jayson[_0xa926('0x4')][_0xa926('0x5')]({'port':0x2329});client[_0xa926('0x6')]=function(_0x5e86e3,_0x524c18){return new BPromise(function(_0x5ba802,_0x1c63da){return client[_0xa926('0x7')](_0x5e86e3,_0x524c18)['then'](function(_0x1c41e6){logger[_0xa926('0x8')](_0xa926('0x9'),_0xa926('0x3'),_0x5e86e3,_0x524c18,_0x1c41e6);if(_0x1c41e6[_0xa926('0xa')]){logger[_0xa926('0xa')](_0xa926('0x9'),_0xa926('0x3'),_0x5e86e3,_0x1c41e6['error'][_0xa926('0xb')],_0x524c18);return _0x1c63da(_0x1c41e6[_0xa926('0xa')][_0xa926('0xb')]);}else{return _0x5ba802(_0x1c41e6[_0xa926('0xc')]);}})['catch'](function(_0x118516){logger['error'](_0xa926('0x9'),'routing',_0x5e86e3,_0x118516,_0x524c18);return _0x1c63da(_0x118516);});});};module[_0xa926('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 973c2e8..ff2bb85 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 _0x1ef7=['getSettings','loginMailFrequency','log','./server','then','getMailAccounts','mailAccounts','listen'];(function(_0x5a83ed,_0x37d457){var _0x2bd399=function(_0xdcf644){while(--_0xdcf644){_0x5a83ed['push'](_0x5a83ed['shift']());}};_0x2bd399(++_0x37d457);}(_0x1ef7,0x173));var _0x71ef=function(_0x3a04ab,_0x31b9fd){_0x3a04ab=_0x3a04ab-0x0;var _0x4bff6d=_0x1ef7[_0x3a04ab];return _0x4bff6d;};'use strict';var BPromise=require('bluebird');var server=require(_0x71ef('0x0'));var Realtime=require('./realtime');var EmailChannel=require('./lib/email');var mailAccount=require('./rpc/mailAccount');var setting=require('./rpc/setting');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise['resolve']()[_0x71ef('0x1')](mailAccount[_0x71ef('0x2')]())[_0x71ef('0x1')](realtime['initMailAccounts']())[_0x71ef('0x1')](function(){email['refresh'](realtime[_0x71ef('0x3')]);return realtime;});}function main(){return server[_0x71ef('0x4')](realtime,email)['then'](function(){return initRealtime();})['then'](function(){return setting[_0x71ef('0x5')]();})[_0x71ef('0x1')](function(_0x2a99e5){return setInterval(initRealtime,_0x2a99e5[_0x71ef('0x6')]*0x3e8);})['catch'](function(_0x4bdb7a){console[_0x71ef('0x7')](_0x4bdb7a);});}main(); \ No newline at end of file +var _0x7116=['then','initMailAccounts','refresh','listen','getSettings','loginMailFrequency','catch','log','bluebird','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','resolve','getMailAccounts'];(function(_0x16b1a5,_0x318267){var _0x475e25=function(_0x2e3bf6){while(--_0x2e3bf6){_0x16b1a5['push'](_0x16b1a5['shift']());}};_0x475e25(++_0x318267);}(_0x7116,0x17f));var _0x6711=function(_0x2ec69c,_0x4ac21e){_0x2ec69c=_0x2ec69c-0x0;var _0x53b4d0=_0x7116[_0x2ec69c];return _0x53b4d0;};'use strict';var BPromise=require(_0x6711('0x0'));var server=require('./server');var Realtime=require(_0x6711('0x1'));var EmailChannel=require(_0x6711('0x2'));var mailAccount=require(_0x6711('0x3'));var setting=require(_0x6711('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x6711('0x5')]()['then'](mailAccount[_0x6711('0x6')]())[_0x6711('0x7')](realtime[_0x6711('0x8')]())[_0x6711('0x7')](function(){email[_0x6711('0x9')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x6711('0xa')](realtime,email)['then'](function(){return initRealtime();})[_0x6711('0x7')](function(){return setting[_0x6711('0xb')]();})[_0x6711('0x7')](function(_0x51b2da){return setInterval(initRealtime,_0x51b2da[_0x6711('0xc')]*0x3e8);})[_0x6711('0xd')](function(_0x46e804){console[_0x6711('0xe')](_0x46e804);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 8a986da..a580511 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 _0x2768=['socket.io-emitter','./imap','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','total','stringify','md5','hasOwnProperty','email','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','isNil','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp','Smtp','verified','exports','lodash','../../../config/logger','redis','localhost'];(function(_0x4d67b8,_0x565134){var _0x55af3b=function(_0x145904){while(--_0x145904){_0x4d67b8['push'](_0x4d67b8['shift']());}};_0x55af3b(++_0x565134);}(_0x2768,0xfb));var _0x8276=function(_0x52f249,_0x16b09a){_0x52f249=_0x52f249-0x0;var _0x11f1af=_0x2768[_0x52f249];return _0x11f1af;};'use strict';var _=require(_0x8276('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require('md5');var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x8276('0x1'))('email');config[_0x8276('0x2')]=_['defaults'](config['redis'],{'host':_0x8276('0x3'),'port':0x18eb});var io=require(_0x8276('0x4'))(new Redis(config[_0x8276('0x2')]));var EmailImap=require(_0x8276('0x5'));var EmailSmtp=require(_0x8276('0x6'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x174665){logger[_0x8276('0x7')](_0x8276('0x8'));this[_0x8276('0x9')]=_0x174665[_0x8276('0x9')];this[_0x8276('0xa')]={};this[_0x8276('0xb')]=new EmailSmtp();}EmailChannel[_0x8276('0xc')][_0x8276('0xd')]=function(_0x334eac){var _0x526ba5=this[_0x8276('0x9')][_0x334eac];var _0x326444={'id':_0x526ba5['id'],'name':_0x526ba5[_0x8276('0xe')],'key':_0x526ba5[_0x8276('0xf')],'active':_0x526ba5[_0x8276('0x10')],'Imap':{'status':_0x526ba5[_0x8276('0x11')][_0x8276('0x12')],'messageStatus':_0x526ba5[_0x8276('0x11')][_0x8276('0x13')],'total':_0x526ba5['Imap'][_0x8276('0x14')]}};if(_['isNil'](md5Accounts[_0x334eac])){md5Accounts[_0x334eac]={};}var _0x58d905=md5(JSON[_0x8276('0x15')](_0x326444));if(md5Accounts[_0x334eac][_0x8276('0x16')]!==_0x58d905){md5Accounts[_0x334eac][_0x8276('0x16')]=_0x58d905;io[_0x8276('0xd')]('mailAccount:update',_0x326444);}};EmailChannel[_0x8276('0xc')]['refresh']=function(_0x262039){for(var _0x38601e in _0x262039){if(_0x262039['hasOwnProperty'](_0x38601e)){if(_0x262039[_0x38601e][_0x8276('0x11')]&&_0x262039[_0x38601e][_0x8276('0x10')]){var _0x242a48=_0x262039[_0x38601e][_0x8276('0x11')];if(!this[_0x8276('0xa')][_0x8276('0x17')](_0x242a48['id'])){this['imapAccounts'][_0x242a48['id']]=new EmailImap(_0x242a48,_0x262039[_0x38601e][_0x8276('0x18')]);this['imapAccounts'][_0x242a48['id']]['on'](_0x8276('0x19'),this[_0x8276('0x1a')][_0x8276('0x1b')](this,_0x38601e));this['imapAccounts'][_0x242a48['id']]['on'](_0x8276('0x18'),this[_0x8276('0x1c')][_0x8276('0x1b')](this,_0x38601e));this['imapAccounts'][_0x242a48['id']]['on'](_0x8276('0x1d'),this[_0x8276('0x1e')][_0x8276('0x1b')](this,_0x38601e));this['imapAccounts'][_0x242a48['id']]['on'](_0x8276('0x1f'),this['handleImapError'][_0x8276('0x1b')](this,_0x38601e));}}else{if(_[_0x8276('0x20')](this[_0x8276('0x9')][_0x38601e][_0x8276('0x11')])){this[_0x8276('0x9')][_0x38601e][_0x8276('0x11')]={};}this[_0x8276('0x9')][_0x38601e]['Imap'][_0x8276('0x12')]=_0x8276('0x21');this[_0x8276('0x9')][_0x38601e]['Imap'][_0x8276('0x13')]='';this[_0x8276('0xd')](_0x38601e);}}}};EmailChannel[_0x8276('0xc')][_0x8276('0x1a')]=function(_0x19a15c,_0x401336){if(this[_0x8276('0x9')][_0x19a15c]){this[_0x8276('0x9')][_0x19a15c][_0x8276('0x11')]['status']=_0x8276('0x22');this[_0x8276('0x9')][_0x19a15c][_0x8276('0x11')][_0x8276('0x13')]=_0x401336['name'];if(_0x401336[_0x8276('0x23')]){this[_0x8276('0x9')][_0x19a15c]['Imap'][_0x8276('0x14')]=_0x401336[_0x8276('0x23')][_0x8276('0x14')];}return this[_0x8276('0xd')](_0x19a15c);}};EmailChannel['prototype'][_0x8276('0x1c')]=function(_0x5b7515,_0x51ac12){logger[_0x8276('0x7')](_0x8276('0x24'),_0x51ac12[_0x8276('0x25')],_0x51ac12[_0x8276('0x26')],_0x51ac12[_0x8276('0x27')],_0x5b7515);if(this['mailAccounts'][_0x5b7515]){return mailAccount['notify'](_0x5b7515,_0x51ac12)[_0x8276('0x28')](function(_0x197eb4){if(_0x197eb4){logger[_0x8276('0x7')](_0x8276('0x29'));}})[_0x8276('0x2a')](function(_0x129e3b){logger[_0x8276('0x1f')](_0x8276('0x2b'),JSON[_0x8276('0x15')](_0x129e3b));});}};EmailChannel[_0x8276('0xc')][_0x8276('0x1e')]=function(_0x33be1a){if(this[_0x8276('0x9')][_0x33be1a]&&this[_0x8276('0x9')][_0x33be1a][_0x8276('0x11')]){if(this[_0x8276('0xa')][this[_0x8276('0x9')][_0x33be1a][_0x8276('0x11')]['id']]){delete this['imapAccounts'][this[_0x8276('0x9')][_0x33be1a][_0x8276('0x11')]['id']];}this[_0x8276('0x9')][_0x33be1a][_0x8276('0x11')][_0x8276('0x2c')]=moment();this['emit'](_0x33be1a);}};EmailChannel[_0x8276('0xc')]['handleImapError']=function(_0x1e5c17,_0x136542){if(this['mailAccounts'][_0x1e5c17]){this[_0x8276('0x9')][_0x1e5c17][_0x8276('0x11')]['status']=_0x8276('0x1f');this[_0x8276('0x9')][_0x1e5c17][_0x8276('0x11')][_0x8276('0x13')]=_0x136542;return this[_0x8276('0xd')](_0x1e5c17);}};EmailChannel['prototype'][_0x8276('0x2d')]=function(_0x3f8c4a,_0x33e5df){return this[_0x8276('0xb')][_0x8276('0x2e')](_0x3f8c4a,_0x33e5df);};EmailChannel[_0x8276('0xc')][_0x8276('0x2f')]=function(_0x3d4328){var _0x552f67=this;if(this[_0x8276('0x9')][_0x3d4328['id']]){if(_[_0x8276('0x20')](this['mailAccounts'][_0x3d4328['id']][_0x8276('0x30')])){this['mailAccounts'][_0x3d4328['id']][_0x8276('0x30')]={};}this[_0x8276('0x9')][_0x3d4328['id']][_0x8276('0x30')][_0x8276('0x2c')]=moment();return new BPromise(function(_0x4f78ed,_0x15b274){return _0x552f67['smtp']['verify'](_0x3d4328)[_0x8276('0x28')](function(_0x2ed26d){_0x552f67[_0x8276('0x9')][_0x3d4328['id']][_0x8276('0x30')][_0x8276('0x12')]=_0x8276('0x31');_0x552f67[_0x8276('0x9')][_0x3d4328['id']][_0x8276('0x30')]['messageStatus']='';_0x552f67[_0x8276('0xd')](_0x3d4328['id']);_0x4f78ed(_0x2ed26d);})[_0x8276('0x2a')](function(_0x10eb3b){_0x552f67[_0x8276('0x9')][_0x3d4328['id']][_0x8276('0x30')]['status']=_0x8276('0x1f');_0x552f67[_0x8276('0x9')][_0x3d4328['id']][_0x8276('0x30')]['messageStatus']=_0x10eb3b;_0x552f67[_0x8276('0xd')](_0x3d4328['id']);_0x15b274(_0x10eb3b);});});}return this[_0x8276('0xb')]['verify'](_0x3d4328);};module[_0x8276('0x32')]=EmailChannel; \ No newline at end of file +var _0xe3f9=['messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp','Smtp','smtp','verify','exports','lodash','moment','bluebird','md5','../../../config/environment','../../../config/logger','redis','localhost','socket.io-emitter','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','emit','name','key','active','Imap','messageStatus','total','isNil','stringify','mailAccount:update','prototype','refresh','hasOwnProperty','email','box','handleImapBox','handleImapEmail','bind','end','handleImapEnd','error','handleImapError','disabled','status','connected'];(function(_0x192df5,_0x35ac8a){var _0x1b0abe=function(_0x5c2fa5){while(--_0x5c2fa5){_0x192df5['push'](_0x192df5['shift']());}};_0x1b0abe(++_0x35ac8a);}(_0xe3f9,0xc1));var _0x9e3f=function(_0x33dcf7,_0x3d5390){_0x33dcf7=_0x33dcf7-0x0;var _0x542d4e=_0xe3f9[_0x33dcf7];return _0x542d4e;};'use strict';var _=require(_0x9e3f('0x0'));var moment=require(_0x9e3f('0x1'));var BPromise=require(_0x9e3f('0x2'));var md5=require(_0x9e3f('0x3'));var Redis=require('ioredis');var config=require(_0x9e3f('0x4'));var logger=require(_0x9e3f('0x5'))('email');config[_0x9e3f('0x6')]=_['defaults'](config[_0x9e3f('0x6')],{'host':_0x9e3f('0x7'),'port':0x18eb});var io=require(_0x9e3f('0x8'))(new Redis(config[_0x9e3f('0x6')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x9e3f('0x9'));var mailAccount=require(_0x9e3f('0xa'));var md5Accounts={};function EmailChannel(_0x58e1f6){logger['info'](_0x9e3f('0xb'));this[_0x9e3f('0xc')]=_0x58e1f6[_0x9e3f('0xc')];this[_0x9e3f('0xd')]={};this['smtp']=new EmailSmtp();}EmailChannel['prototype'][_0x9e3f('0xe')]=function(_0x1419f4){var _0x5232c0=this['mailAccounts'][_0x1419f4];var _0x995b75={'id':_0x5232c0['id'],'name':_0x5232c0[_0x9e3f('0xf')],'key':_0x5232c0[_0x9e3f('0x10')],'active':_0x5232c0[_0x9e3f('0x11')],'Imap':{'status':_0x5232c0['Imap']['status'],'messageStatus':_0x5232c0[_0x9e3f('0x12')][_0x9e3f('0x13')],'total':_0x5232c0['Imap'][_0x9e3f('0x14')]}};if(_[_0x9e3f('0x15')](md5Accounts[_0x1419f4])){md5Accounts[_0x1419f4]={};}var _0x53472c=md5(JSON[_0x9e3f('0x16')](_0x995b75));if(md5Accounts[_0x1419f4][_0x9e3f('0x3')]!==_0x53472c){md5Accounts[_0x1419f4][_0x9e3f('0x3')]=_0x53472c;io['emit'](_0x9e3f('0x17'),_0x995b75);}};EmailChannel[_0x9e3f('0x18')][_0x9e3f('0x19')]=function(_0x9429cc){for(var _0x2a2d69 in _0x9429cc){if(_0x9429cc[_0x9e3f('0x1a')](_0x2a2d69)){if(_0x9429cc[_0x2a2d69][_0x9e3f('0x12')]&&_0x9429cc[_0x2a2d69][_0x9e3f('0x11')]){var _0x38c8ef=_0x9429cc[_0x2a2d69][_0x9e3f('0x12')];if(!this['imapAccounts'][_0x9e3f('0x1a')](_0x38c8ef['id'])){this[_0x9e3f('0xd')][_0x38c8ef['id']]=new EmailImap(_0x38c8ef,_0x9429cc[_0x2a2d69][_0x9e3f('0x1b')]);this[_0x9e3f('0xd')][_0x38c8ef['id']]['on'](_0x9e3f('0x1c'),this[_0x9e3f('0x1d')]['bind'](this,_0x2a2d69));this['imapAccounts'][_0x38c8ef['id']]['on'](_0x9e3f('0x1b'),this[_0x9e3f('0x1e')][_0x9e3f('0x1f')](this,_0x2a2d69));this[_0x9e3f('0xd')][_0x38c8ef['id']]['on'](_0x9e3f('0x20'),this[_0x9e3f('0x21')][_0x9e3f('0x1f')](this,_0x2a2d69));this[_0x9e3f('0xd')][_0x38c8ef['id']]['on'](_0x9e3f('0x22'),this[_0x9e3f('0x23')]['bind'](this,_0x2a2d69));}}else{if(_[_0x9e3f('0x15')](this[_0x9e3f('0xc')][_0x2a2d69][_0x9e3f('0x12')])){this[_0x9e3f('0xc')][_0x2a2d69][_0x9e3f('0x12')]={};}this[_0x9e3f('0xc')][_0x2a2d69][_0x9e3f('0x12')]['status']=_0x9e3f('0x24');this['mailAccounts'][_0x2a2d69]['Imap'][_0x9e3f('0x13')]='';this[_0x9e3f('0xe')](_0x2a2d69);}}}};EmailChannel[_0x9e3f('0x18')][_0x9e3f('0x1d')]=function(_0x21a9dc,_0x5d250e){if(this[_0x9e3f('0xc')][_0x21a9dc]){this[_0x9e3f('0xc')][_0x21a9dc]['Imap'][_0x9e3f('0x25')]=_0x9e3f('0x26');this[_0x9e3f('0xc')][_0x21a9dc]['Imap'][_0x9e3f('0x13')]=_0x5d250e[_0x9e3f('0xf')];if(_0x5d250e[_0x9e3f('0x27')]){this['mailAccounts'][_0x21a9dc][_0x9e3f('0x12')][_0x9e3f('0x14')]=_0x5d250e[_0x9e3f('0x27')][_0x9e3f('0x14')];}return this[_0x9e3f('0xe')](_0x21a9dc);}};EmailChannel['prototype'][_0x9e3f('0x1e')]=function(_0x4f6c1e,_0x3394b3){logger[_0x9e3f('0x28')](_0x9e3f('0x29'),_0x3394b3[_0x9e3f('0x2a')],_0x3394b3[_0x9e3f('0x2b')],_0x3394b3[_0x9e3f('0x2c')],_0x4f6c1e);if(this[_0x9e3f('0xc')][_0x4f6c1e]){return mailAccount[_0x9e3f('0x2d')](_0x4f6c1e,_0x3394b3)[_0x9e3f('0x2e')](function(_0x5f4b09){if(_0x5f4b09){logger[_0x9e3f('0x28')](_0x9e3f('0x2f'));}})[_0x9e3f('0x30')](function(_0x147b64){logger[_0x9e3f('0x22')](_0x9e3f('0x31'),JSON[_0x9e3f('0x16')](_0x147b64));});}};EmailChannel['prototype'][_0x9e3f('0x21')]=function(_0x553f07){if(this[_0x9e3f('0xc')][_0x553f07]&&this[_0x9e3f('0xc')][_0x553f07][_0x9e3f('0x12')]){if(this['imapAccounts'][this['mailAccounts'][_0x553f07]['Imap']['id']]){delete this[_0x9e3f('0xd')][this[_0x9e3f('0xc')][_0x553f07][_0x9e3f('0x12')]['id']];}this[_0x9e3f('0xc')][_0x553f07][_0x9e3f('0x12')][_0x9e3f('0x32')]=moment();this[_0x9e3f('0xe')](_0x553f07);}};EmailChannel[_0x9e3f('0x18')][_0x9e3f('0x23')]=function(_0x31b95a,_0x4d5aca){if(this[_0x9e3f('0xc')][_0x31b95a]){this[_0x9e3f('0xc')][_0x31b95a][_0x9e3f('0x12')][_0x9e3f('0x25')]=_0x9e3f('0x22');this[_0x9e3f('0xc')][_0x31b95a][_0x9e3f('0x12')][_0x9e3f('0x13')]=_0x4d5aca;return this[_0x9e3f('0xe')](_0x31b95a);}};EmailChannel['prototype'][_0x9e3f('0x33')]=function(_0x112726,_0x157ccf){return this['smtp'][_0x9e3f('0x34')](_0x112726,_0x157ccf);};EmailChannel[_0x9e3f('0x18')][_0x9e3f('0x35')]=function(_0x16a9da){var _0x457b55=this;if(this['mailAccounts'][_0x16a9da['id']]){if(_[_0x9e3f('0x15')](this['mailAccounts'][_0x16a9da['id']]['Smtp'])){this[_0x9e3f('0xc')][_0x16a9da['id']][_0x9e3f('0x36')]={};}this[_0x9e3f('0xc')][_0x16a9da['id']][_0x9e3f('0x36')][_0x9e3f('0x32')]=moment();return new BPromise(function(_0x562e92,_0xe7bbf4){return _0x457b55[_0x9e3f('0x37')]['verify'](_0x16a9da)[_0x9e3f('0x2e')](function(_0x5059bc){_0x457b55[_0x9e3f('0xc')][_0x16a9da['id']]['Smtp'][_0x9e3f('0x25')]='verified';_0x457b55[_0x9e3f('0xc')][_0x16a9da['id']]['Smtp'][_0x9e3f('0x13')]='';_0x457b55['emit'](_0x16a9da['id']);_0x562e92(_0x5059bc);})[_0x9e3f('0x30')](function(_0x22ead2){_0x457b55[_0x9e3f('0xc')][_0x16a9da['id']][_0x9e3f('0x36')][_0x9e3f('0x25')]=_0x9e3f('0x22');_0x457b55[_0x9e3f('0xc')][_0x16a9da['id']][_0x9e3f('0x36')][_0x9e3f('0x13')]=_0x22ead2;_0x457b55[_0x9e3f('0xe')](_0x16a9da['id']);_0xe7bbf4(_0x22ead2);});});}return this[_0x9e3f('0x37')][_0x9e3f('0x38')](_0x16a9da);};module[_0x9e3f('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 3f2e9ca..ccf1479 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 _0x0f13=['../../../config/logger','email','mailbox','account','handleReady','bind','end','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','required','getHost','anonymous@xcally.com','openBox','handleOpenBox','emit','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','once','handleFetchError','handleFetchEnd','closeBox','body','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','stringify','textCode','hasOwnProperty','exports','path','util','imap','lodash','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils'];(function(_0x57411c,_0x529577){var _0xa52b6f=function(_0x3964a8){while(--_0x3964a8){_0x57411c['push'](_0x57411c['shift']());}};_0xa52b6f(++_0x529577);}(_0x0f13,0x12b));var _0x30f1=function(_0x80c77b,_0xc44140){_0x80c77b=_0x80c77b-0x0;var _0x3fca8f=_0x0f13[_0x80c77b];return _0x3fca8f;};'use strict';var fs=require('fs');var path=require(_0x30f1('0x0'));var util=require(_0x30f1('0x1'));var Imap=require(_0x30f1('0x2'));var _=require(_0x30f1('0x3'));var rs=require('randomstring');var simpleParser=require(_0x30f1('0x4'))[_0x30f1('0x5')];var Iconv=require(_0x30f1('0x6'))[_0x30f1('0x7')];var EventEmitter=require(_0x30f1('0x8'))[_0x30f1('0x9')];var utils=require(_0x30f1('0xa'));var logger=require(_0x30f1('0xb'))(_0x30f1('0xc'));function EmailImap(_0x64f714,_0x4dba15){this[_0x30f1('0xd')]='INBOX';this[_0x30f1('0xe')]=this['getAccount'](_0x64f714,_0x4dba15);this[_0x30f1('0x2')]=new Imap(this[_0x30f1('0xe')]);this[_0x30f1('0x2')]['once']('ready',this[_0x30f1('0xf')][_0x30f1('0x10')](this));this[_0x30f1('0x2')]['once'](_0x30f1('0x11'),this[_0x30f1('0x12')][_0x30f1('0x10')](this));this[_0x30f1('0x2')]['on'](_0x30f1('0x13'),this[_0x30f1('0x14')][_0x30f1('0x10')](this));this[_0x30f1('0x2')][_0x30f1('0x15')]();}util[_0x30f1('0x16')](EmailImap,EventEmitter);EmailImap[_0x30f1('0x17')]['getAccount']=function(_0xd1372b,_0x19678e){var _0x53cc24={'connTimeout':_0xd1372b[_0x30f1('0x18')]?_0xd1372b[_0x30f1('0x18')]*0x3e8:0x2710,'authTimeout':_0xd1372b[_0x30f1('0x19')]?_0xd1372b[_0x30f1('0x19')]*0x3e8:0x1388};if(_[_0x30f1('0x1a')](_0xd1372b[_0x30f1('0x1b')])){if(_0xd1372b[_0x30f1('0x1c')]){_0x53cc24[_0x30f1('0x1d')]=_0xd1372b[_0x30f1('0x1d')];_0x53cc24[_0x30f1('0x1e')]=_0xd1372b[_0x30f1('0x1e')];}_0x53cc24[_0x30f1('0x1f')]=_0xd1372b[_0x30f1('0x1f')];_0x53cc24['port']=_0xd1372b[_0x30f1('0x20')]||0x3e1;if(_0xd1372b[_0x30f1('0x21')]){_0x53cc24[_0x30f1('0x21')]=!![];}else{_0x53cc24['tls']=![];_0x53cc24[_0x30f1('0x22')]=_0x30f1('0x23');}}else{_0x53cc24['user']=_0xd1372b[_0x30f1('0x1d')];_0x53cc24[_0x30f1('0x1e')]=_0xd1372b[_0x30f1('0x1e')];_0x53cc24[_0x30f1('0x1f')]=utils[_0x30f1('0x24')](_0xd1372b['service']);_0x53cc24[_0x30f1('0x20')]=0x3e1;_0x53cc24[_0x30f1('0x21')]=!![];}_0x53cc24[_0x30f1('0xc')]=_0x19678e||_0xd1372b[_0x30f1('0x1d')]||_0x30f1('0x25');return _0x53cc24;};EmailImap[_0x30f1('0x17')][_0x30f1('0xf')]=function(){this[_0x30f1('0x2')][_0x30f1('0x26')](this[_0x30f1('0xd')],![],this[_0x30f1('0x27')][_0x30f1('0x10')](this));};EmailImap[_0x30f1('0x17')][_0x30f1('0x27')]=function(_0x249f02,_0x2a20dd){if(_0x249f02){this[_0x30f1('0x14')](_0x249f02,!![]);}else{this[_0x30f1('0x28')]('box',_0x2a20dd);this[_0x30f1('0x29')]();}};EmailImap[_0x30f1('0x17')][_0x30f1('0x2a')]=function(_0x4748e0){if(_0x4748e0){this['handleError'](_0x4748e0,!![]);}else{this['imap'][_0x30f1('0x11')]();}};EmailImap[_0x30f1('0x17')]['readUnseen']=function(){this[_0x30f1('0x2')][_0x30f1('0x2b')]([_0x30f1('0x2c')],this[_0x30f1('0x2d')][_0x30f1('0x10')](this));};EmailImap[_0x30f1('0x17')][_0x30f1('0x2d')]=function(_0x5297f0,_0x337e99){if(_0x5297f0){this[_0x30f1('0x14')](_0x5297f0,!![]);}else{if(_0x337e99[_0x30f1('0x2e')]){try{var _0x11921d=this[_0x30f1('0x2')][_0x30f1('0x2f')](_0x337e99,{'bodies':'','markSeen':!![]});_0x11921d['on']('message',this[_0x30f1('0x30')][_0x30f1('0x10')](this));_0x11921d[_0x30f1('0x31')](_0x30f1('0x13'),this[_0x30f1('0x32')]['bind'](this));_0x11921d[_0x30f1('0x31')](_0x30f1('0x11'),this[_0x30f1('0x33')][_0x30f1('0x10')](this));}catch(_0x2e0978){logger[_0x30f1('0x13')](_0x2e0978);}}else{this[_0x30f1('0x2')][_0x30f1('0x34')](!![],this[_0x30f1('0x2a')][_0x30f1('0x10')](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x1fe9d8,_0x285f5f){_0x1fe9d8['on'](_0x30f1('0x35'),this['handleMessageBody']['bind'](this));_0x1fe9d8[_0x30f1('0x31')]('attributes',this[_0x30f1('0x36')]['bind'](this));_0x1fe9d8[_0x30f1('0x31')](_0x30f1('0x11'),this[_0x30f1('0x37')][_0x30f1('0x10')](this));};EmailImap[_0x30f1('0x17')][_0x30f1('0x38')]=function(_0x224e06,_0x130cc1){simpleParser(_0x224e06,{'Iconv':Iconv},this[_0x30f1('0x39')][_0x30f1('0x10')](this));};EmailImap[_0x30f1('0x17')][_0x30f1('0x36')]=function(_0x4f1d3b){};EmailImap[_0x30f1('0x17')][_0x30f1('0x37')]=function(){};EmailImap['prototype'][_0x30f1('0x39')]=function(_0x37da56,_0x3ca1e5){if(_0x37da56){logger[_0x30f1('0x13')](_0x37da56);}else{var _0x1439cc=this;utils['parser'](this['account'],_0x3ca1e5,function(_0x4f9e6b){_0x1439cc['emit'](_0x30f1('0xc'),_0x4f9e6b);});}};EmailImap['prototype'][_0x30f1('0x33')]=function(){this[_0x30f1('0x2')]['closeBox'](!![],this[_0x30f1('0x2a')]['bind'](this));};EmailImap[_0x30f1('0x17')][_0x30f1('0x32')]=function(_0x216223){this['handleError'](_0x216223);this['imap'][_0x30f1('0x34')](!![],this[_0x30f1('0x2a')][_0x30f1('0x10')](this));};EmailImap[_0x30f1('0x17')][_0x30f1('0x12')]=function(){this[_0x30f1('0x28')](_0x30f1('0x11'));};EmailImap[_0x30f1('0x17')][_0x30f1('0x14')]=function(_0x1ac6ad,_0x98f7be){logger['error']('handleError',this['account'][_0x30f1('0xc')],JSON[_0x30f1('0x3a')](_0x1ac6ad));var _0x494887='';if(_0x1ac6ad){if(_0x1ac6ad[_0x30f1('0x3b')]){_0x494887=_0x1ac6ad[_0x30f1('0x3b')];}else{for(var _0x49c61b in _0x1ac6ad){if(_0x1ac6ad[_0x30f1('0x3c')](_0x49c61b)){_0x494887+=_['upperFirst'](_0x49c61b)+':\x20'+_0x1ac6ad[_0x49c61b]+'\x0a';}}}}if(_0x98f7be){this['imap'][_0x30f1('0x11')]();}else{this[_0x30f1('0x28')](_0x30f1('0x13'),_0x494887);this[_0x30f1('0x28')](_0x30f1('0x11'));}};module[_0x30f1('0x3d')]=EmailImap; \ No newline at end of file +var _0xb226=['handleReady','end','handleEnd','bind','error','handleError','connect','inherits','prototype','connTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','required','getHost','anonymous@xcally.com','openBox','handleOpenBox','emit','box','handleCloseBox','handleReadUnseen','fetch','handleFetchMessage','once','closeBox','body','handleMessageBody','attributes','handleSimpleParser','handleMessageAttributes','handleFetchEnd','handleFetchError','stringify','textCode','hasOwnProperty','upperFirst','exports','path','util','imap','randomstring','simpleParser','iconv','Iconv','events','./utils','../../../config/logger','email','mailbox','INBOX','account','getAccount','ready'];(function(_0x3b4ec4,_0x3f9c54){var _0x383822=function(_0x2f6aee){while(--_0x2f6aee){_0x3b4ec4['push'](_0x3b4ec4['shift']());}};_0x383822(++_0x3f9c54);}(_0xb226,0x11c));var _0x6b22=function(_0x52a897,_0x5c3e2e){_0x52a897=_0x52a897-0x0;var _0x5eced0=_0xb226[_0x52a897];return _0x5eced0;};'use strict';var fs=require('fs');var path=require(_0x6b22('0x0'));var util=require(_0x6b22('0x1'));var Imap=require(_0x6b22('0x2'));var _=require('lodash');var rs=require(_0x6b22('0x3'));var simpleParser=require('mailparser')[_0x6b22('0x4')];var Iconv=require(_0x6b22('0x5'))[_0x6b22('0x6')];var EventEmitter=require(_0x6b22('0x7'))['EventEmitter'];var utils=require(_0x6b22('0x8'));var logger=require(_0x6b22('0x9'))(_0x6b22('0xa'));function EmailImap(_0x38fd1f,_0x412fa4){this[_0x6b22('0xb')]=_0x6b22('0xc');this[_0x6b22('0xd')]=this[_0x6b22('0xe')](_0x38fd1f,_0x412fa4);this[_0x6b22('0x2')]=new Imap(this['account']);this[_0x6b22('0x2')]['once'](_0x6b22('0xf'),this[_0x6b22('0x10')]['bind'](this));this[_0x6b22('0x2')]['once'](_0x6b22('0x11'),this[_0x6b22('0x12')][_0x6b22('0x13')](this));this[_0x6b22('0x2')]['on'](_0x6b22('0x14'),this[_0x6b22('0x15')][_0x6b22('0x13')](this));this[_0x6b22('0x2')][_0x6b22('0x16')]();}util[_0x6b22('0x17')](EmailImap,EventEmitter);EmailImap[_0x6b22('0x18')]['getAccount']=function(_0x2e6200,_0x1731e8){var _0x4a23b9={'connTimeout':_0x2e6200[_0x6b22('0x19')]?_0x2e6200['connTimeout']*0x3e8:0x2710,'authTimeout':_0x2e6200['authTimeout']?_0x2e6200['authTimeout']*0x3e8:0x1388};if(_[_0x6b22('0x1a')](_0x2e6200[_0x6b22('0x1b')])){if(_0x2e6200[_0x6b22('0x1c')]){_0x4a23b9[_0x6b22('0x1d')]=_0x2e6200['user'];_0x4a23b9[_0x6b22('0x1e')]=_0x2e6200[_0x6b22('0x1e')];}_0x4a23b9[_0x6b22('0x1f')]=_0x2e6200[_0x6b22('0x1f')];_0x4a23b9[_0x6b22('0x20')]=_0x2e6200[_0x6b22('0x20')]||0x3e1;if(_0x2e6200[_0x6b22('0x21')]){_0x4a23b9[_0x6b22('0x21')]=!![];}else{_0x4a23b9[_0x6b22('0x21')]=![];_0x4a23b9[_0x6b22('0x22')]=_0x6b22('0x23');}}else{_0x4a23b9['user']=_0x2e6200[_0x6b22('0x1d')];_0x4a23b9[_0x6b22('0x1e')]=_0x2e6200[_0x6b22('0x1e')];_0x4a23b9[_0x6b22('0x1f')]=utils[_0x6b22('0x24')](_0x2e6200['service']);_0x4a23b9[_0x6b22('0x20')]=0x3e1;_0x4a23b9[_0x6b22('0x21')]=!![];}_0x4a23b9[_0x6b22('0xa')]=_0x1731e8||_0x2e6200[_0x6b22('0x1d')]||_0x6b22('0x25');return _0x4a23b9;};EmailImap[_0x6b22('0x18')][_0x6b22('0x10')]=function(){this['imap'][_0x6b22('0x26')](this['mailbox'],![],this[_0x6b22('0x27')]['bind'](this));};EmailImap[_0x6b22('0x18')][_0x6b22('0x27')]=function(_0x5672a3,_0x35ef95){if(_0x5672a3){this['handleError'](_0x5672a3,!![]);}else{this[_0x6b22('0x28')](_0x6b22('0x29'),_0x35ef95);this['readUnseen']();}};EmailImap[_0x6b22('0x18')][_0x6b22('0x2a')]=function(_0xaa3c39){if(_0xaa3c39){this[_0x6b22('0x15')](_0xaa3c39,!![]);}else{this['imap']['end']();}};EmailImap['prototype']['readUnseen']=function(){this['imap']['search'](['UNSEEN'],this[_0x6b22('0x2b')][_0x6b22('0x13')](this));};EmailImap[_0x6b22('0x18')][_0x6b22('0x2b')]=function(_0xdf32ca,_0x29568c){if(_0xdf32ca){this[_0x6b22('0x15')](_0xdf32ca,!![]);}else{if(_0x29568c['length']){try{var _0x3a0070=this[_0x6b22('0x2')][_0x6b22('0x2c')](_0x29568c,{'bodies':'','markSeen':!![]});_0x3a0070['on']('message',this[_0x6b22('0x2d')][_0x6b22('0x13')](this));_0x3a0070[_0x6b22('0x2e')](_0x6b22('0x14'),this['handleFetchError'][_0x6b22('0x13')](this));_0x3a0070[_0x6b22('0x2e')]('end',this['handleFetchEnd'][_0x6b22('0x13')](this));}catch(_0xc5e0fc){logger['error'](_0xc5e0fc);}}else{this[_0x6b22('0x2')][_0x6b22('0x2f')](!![],this[_0x6b22('0x2a')]['bind'](this));}}};EmailImap[_0x6b22('0x18')][_0x6b22('0x2d')]=function(_0x385e28,_0x2ff77b){_0x385e28['on'](_0x6b22('0x30'),this[_0x6b22('0x31')][_0x6b22('0x13')](this));_0x385e28['once'](_0x6b22('0x32'),this['handleMessageAttributes'][_0x6b22('0x13')](this));_0x385e28[_0x6b22('0x2e')]('end',this['handleMessageEnd'][_0x6b22('0x13')](this));};EmailImap['prototype'][_0x6b22('0x31')]=function(_0xe8a6da,_0x26128d){simpleParser(_0xe8a6da,{'Iconv':Iconv},this[_0x6b22('0x33')]['bind'](this));};EmailImap[_0x6b22('0x18')][_0x6b22('0x34')]=function(_0x3a8a75){};EmailImap[_0x6b22('0x18')]['handleMessageEnd']=function(){};EmailImap[_0x6b22('0x18')][_0x6b22('0x33')]=function(_0x2250d5,_0x520184){if(_0x2250d5){logger[_0x6b22('0x14')](_0x2250d5);}else{var _0x5bbc61=this;utils['parser'](this[_0x6b22('0xd')],_0x520184,function(_0x104add){_0x5bbc61['emit'](_0x6b22('0xa'),_0x104add);});}};EmailImap[_0x6b22('0x18')][_0x6b22('0x35')]=function(){this[_0x6b22('0x2')][_0x6b22('0x2f')](!![],this[_0x6b22('0x2a')][_0x6b22('0x13')](this));};EmailImap[_0x6b22('0x18')][_0x6b22('0x36')]=function(_0x4c99fa){this[_0x6b22('0x15')](_0x4c99fa);this[_0x6b22('0x2')][_0x6b22('0x2f')](!![],this['handleCloseBox'][_0x6b22('0x13')](this));};EmailImap['prototype']['handleEnd']=function(){this[_0x6b22('0x28')](_0x6b22('0x11'));};EmailImap[_0x6b22('0x18')][_0x6b22('0x15')]=function(_0x480655,_0x17b647){logger['error'](_0x6b22('0x15'),this[_0x6b22('0xd')][_0x6b22('0xa')],JSON[_0x6b22('0x37')](_0x480655));var _0x29fb5a='';if(_0x480655){if(_0x480655[_0x6b22('0x38')]){_0x29fb5a=_0x480655[_0x6b22('0x38')];}else{for(var _0xa483c7 in _0x480655){if(_0x480655[_0x6b22('0x39')](_0xa483c7)){_0x29fb5a+=_[_0x6b22('0x3a')](_0xa483c7)+':\x20'+_0x480655[_0xa483c7]+'\x0a';}}}}if(_0x17b647){this[_0x6b22('0x2')][_0x6b22('0x11')]();}else{this['emit'](_0x6b22('0x14'),_0x29fb5a);this[_0x6b22('0x28')](_0x6b22('0x11'));}};module[_0x6b22('0x3b')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 759000f..deb1a44 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 _0xe029=['nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile','sendMail','toString','verify','Not\x20verifired','exports','nodemailer','bluebird'];(function(_0x50d84b,_0x1d7ea7){var _0x6d4270=function(_0x883f21){while(--_0x883f21){_0x50d84b['push'](_0x50d84b['shift']());}};_0x6d4270(++_0x1d7ea7);}(_0xe029,0x8d));var _0x9e02=function(_0x5c1b26,_0x356a45){_0x5c1b26=_0x5c1b26-0x0;var _0x5253de=_0xe029[_0x5c1b26];return _0x5253de;};'use strict';var nodemailer=require(_0x9e02('0x0'));var BPromise=require(_0x9e02('0x1'));var inlineBase64=require(_0x9e02('0x2'));function EmailSmtp(){}EmailSmtp[_0x9e02('0x3')][_0x9e02('0x4')]=function(_0x2b087f,_0x4cf091){return new BPromise(function(_0x20360a,_0x10df38){var _0x28ddcf=nodemailer[_0x9e02('0x5')](_0x2b087f);_0x28ddcf[_0x9e02('0x6')](_0x9e02('0x7'),inlineBase64());_0x28ddcf[_0x9e02('0x8')](_0x4cf091,function(_0x408e44,_0x30b3d6){if(_0x408e44){_0x10df38(_0x408e44[_0x9e02('0x9')]());}else{_0x20360a(_0x30b3d6);}});});};EmailSmtp[_0x9e02('0x3')][_0x9e02('0xa')]=function(_0x19b7b1){return new BPromise(function(_0x54164f,_0x528916){var _0x3648ee=nodemailer[_0x9e02('0x5')](_0x19b7b1);_0x3648ee[_0x9e02('0xa')](function(_0x33def7,_0x20ce59){if(_0x33def7){_0x528916(_0x33def7['toString']());}else{if(_0x20ce59){_0x54164f(_0x20ce59);}else{_0x528916(_0x9e02('0xb'));}}});});};module[_0x9e02('0xc')]=EmailSmtp; \ No newline at end of file +var _0x6351=['toString','prototype','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','send','createTransport','compile','sendMail'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x6351,0xec));var _0x1635=function(_0x33f7e1,_0x48d209){_0x33f7e1=_0x33f7e1-0x0;var _0x23bab4=_0x6351[_0x33f7e1];return _0x23bab4;};'use strict';var nodemailer=require(_0x1635('0x0'));var BPromise=require('bluebird');var inlineBase64=require(_0x1635('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0x1635('0x2')]=function(_0x27ef25,_0x5ed05c){return new BPromise(function(_0x9ae463,_0x2c61e1){var _0x74c7c=nodemailer[_0x1635('0x3')](_0x27ef25);_0x74c7c['use'](_0x1635('0x4'),inlineBase64());_0x74c7c[_0x1635('0x5')](_0x5ed05c,function(_0x3d0b1f,_0x18f1ba){if(_0x3d0b1f){_0x2c61e1(_0x3d0b1f[_0x1635('0x6')]());}else{_0x9ae463(_0x18f1ba);}});});};EmailSmtp[_0x1635('0x7')]['verify']=function(_0x304ee0){return new BPromise(function(_0xd177e9,_0x5bbb0f){var _0x53ed2d=nodemailer[_0x1635('0x3')](_0x304ee0);_0x53ed2d[_0x1635('0x8')](function(_0x120e4b,_0x150bcc){if(_0x120e4b){_0x5bbb0f(_0x120e4b['toString']());}else{if(_0x150bcc){_0xd177e9(_0x150bcc);}else{_0x5bbb0f(_0x1635('0x9'));}}});});};module[_0x1635('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 13f0153..04b0dd6 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 _0x2ffe=['messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','textAsHtml','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','Attachments','Title','Data','

Empty\x20message

','getHost','gmail','imap.gmail.com','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','127.0.0.1','moment','randomstring','path','util','node-tnef','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','slice','join','Anonymous','length','pop','isEmpty','html','test','replace','\x20[Attachment:\x20','body','0x1?_0x19d2ce[_0xe2ff('0x11')](0x0,-0x1)[_0xe2ff('0x12')]('\x20'):_0x115c88['name'];}return _0xe2ff('0x13');}function getLastName(_0x3061e2){var _0x1c60ab=_[_0xe2ff('0x7')](_0x3061e2[_0xe2ff('0x8')]);if(_0x1c60ab&&_0x1c60ab[_0xe2ff('0xd')]){var _0x201128=_0x1c60ab[_0xe2ff('0xd')][_0xe2ff('0x10')](/\s+/);return _0x201128[_0xe2ff('0x14')]>0x1?_0x201128[_0xe2ff('0x15')]():'';}return'';}function getMails(_0x3b8f1b,_0x336368){var _0x31a8a0='';for(var _0x3fb0f4=0x0;_0x3fb0f4<_0x336368[_0xe2ff('0x8')]['length'];_0x3fb0f4+=0x1){if(_0x336368[_0xe2ff('0x8')][_0x3fb0f4][_0xe2ff('0x9')]!==_0x3b8f1b){if(!_[_0xe2ff('0x16')](_0x31a8a0)){_0x31a8a0+=',';}_0x31a8a0+=_0x336368[_0xe2ff('0x8')][_0x3fb0f4]['name']||_0x336368[_0xe2ff('0x8')][_0x3fb0f4][_0xe2ff('0x9')]||'';_0x31a8a0+='\x20<';_0x31a8a0+=_0x336368[_0xe2ff('0x8')][_0x3fb0f4][_0xe2ff('0x9')]?_0x336368[_0xe2ff('0x8')][_0x3fb0f4][_0xe2ff('0x9')]:_0xe2ff('0xa')+random['generate'](0x6)+'@xcally.com';_0x31a8a0+='>';}}return _0x31a8a0;}function parseEmail(_0x5646ee,_0x5e31f3,_0x418362){if(_0x5e31f3[_0xe2ff('0x17')]){var _0xcaf707=/)<[^<]*)*<\/script>/gi;while(_0xcaf707[_0xe2ff('0x18')](_0x5e31f3[_0xe2ff('0x17')])){_0x5e31f3[_0xe2ff('0x17')]=_0x5e31f3[_0xe2ff('0x17')][_0xe2ff('0x19')](_0xcaf707,'');}if(_0x5e31f3[_0xe2ff('0x17')]['includes'](_0xe2ff('0x1a'))){var _0x4a2222=[];_0x5e31f3[_0xe2ff('0x1b')][_0xe2ff('0x1c')](_0x495bb2=>{_0x4a2222[_0xe2ff('0x1d')](_0x495bb2['filename']);});var _0x5265b5=/]+>/g;var _0x497890=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x373529=_0x5e31f3['html']['replace'](_0x497890,_0xe2ff('0x1e'));var _0x143ed9=_0x373529['replace'](_0x5265b5,'_IMG');for(let _0x3eeba0=0x0;_0x3eeba0<_0x4a2222[_0xe2ff('0x14')];_0x3eeba0++){var _0x2b8839=_0x143ed9[_0xe2ff('0x19')](_0xe2ff('0x1f'),_0xe2ff('0x20')+_0x4a2222[_0x3eeba0]+'\x20]');_0x143ed9=_0x2b8839;}_0x5e31f3[_0xe2ff('0x17')]=_0x143ed9;}_0x418362[_0xe2ff('0x21')]=_0x5e31f3[_0xe2ff('0x17')];}else{_0x418362[_0xe2ff('0x21')]=_0x5e31f3['textAsHtml'];}if(_0x418362[_0xe2ff('0x21')]){_0x418362[_0xe2ff('0x21')]=_0x418362['body'][_0xe2ff('0x19')](/0x0){var _0x3be03f=[_0xe2ff('0x32'),_0xe2ff('0x33'),_0xe2ff('0x34')];for(var _0x127b24=0x0;_0x127b24<_0x5e31f3['headerLines'][_0xe2ff('0x14')];_0x127b24++){var _0x486cd7=_['indexOf'](_0x3be03f,_0x5e31f3['headerLines'][_0x127b24][_0xe2ff('0x35')]);if(_0x486cd7>=0x0){_0x418362[_0xe2ff('0x36')]=!![];}}}return _0x418362;}exports[_0xe2ff('0x37')]=function(_0x4ef9f7,_0x3f4572,_0x268650){var _0x190b49={'from':getAddress(_0x3f4572[_0xe2ff('0x38')]),'firstName':getFirstName(_0x3f4572[_0xe2ff('0x38')]),'lastName':getLastName(_0x3f4572[_0xe2ff('0x38')]),'mapKey':_0xe2ff('0x5'),'message':{'from':getMails(_0x4ef9f7[_0xe2ff('0x5')],_0x3f4572[_0xe2ff('0x38')]),'to':_0x4ef9f7[_0xe2ff('0x5')],'cc':'','subject':_0x3f4572[_0xe2ff('0x39')]||'','messageId':_0x3f4572[_0xe2ff('0x3a')],'inReplyTo':_0x3f4572[_0xe2ff('0x3b')],'sentAt':moment(_0x3f4572[_0xe2ff('0x3c')])[_0xe2ff('0x2a')](_0xe2ff('0x3d')),'attach':![],'attachments':[]}};if(!_0x3f4572[_0xe2ff('0x17')]&&!_0x3f4572[_0xe2ff('0x3e')]){var _0x11b208=_[_0xe2ff('0x3f')](_0x3f4572[_0xe2ff('0x1b')],{'contentType':_0xe2ff('0x40')});if(_0x11b208[_0xe2ff('0x14')]){logger[_0xe2ff('0x41')](util['format'](_0xe2ff('0x42'),_0x3f4572['messageId']));tnef[_0xe2ff('0x43')](_[_0xe2ff('0x44')](_0x11b208)[_0xe2ff('0x2f')],function(_0x9ddb96,_0x4acdcb){if(_0x4acdcb){_0x3f4572[_0xe2ff('0x17')]=_0x4acdcb[_0xe2ff('0x45')]||'

Empty\x20message

';if(_0x4acdcb[_0xe2ff('0x46')]){for(var _0x4a25bc=0x0;_0x4a25bc<_0x4acdcb[_0xe2ff('0x46')][_0xe2ff('0x14')];_0x4a25bc++){var _0x521d2a=_0x4acdcb[_0xe2ff('0x46')][_0x4a25bc];_0x190b49[_0xe2ff('0x23')]['attachments']['push']({'filename':_0x521d2a[_0xe2ff('0x47')],'content':Buffer['from'](_0x521d2a[_0xe2ff('0x48')])});}}}_0x268650(parseEmail(_0x4ef9f7,_0x3f4572,_0x190b49));});}else{_0x3f4572[_0xe2ff('0x17')]=_0xe2ff('0x49');_0x268650(parseEmail(_0x4ef9f7,_0x3f4572,_0x190b49));}}else{_0x268650(parseEmail(_0x4ef9f7,_0x3f4572,_0x190b49));}};exports[_0xe2ff('0x4a')]=function(_0x432c60){switch(_0x432c60){case _0xe2ff('0x4b'):return _0xe2ff('0x4c');case'yahoo':return _0xe2ff('0x4d');case _0xe2ff('0x4e'):return _0xe2ff('0x4f');case _0xe2ff('0x50'):return'outlook.office365.com';}return _0xe2ff('0x51');}; \ No newline at end of file +var _0x45c2=['parser','from','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','Attachments','Title','

Empty\x20message

','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','node-tnef','../../../config/logger','email','head','value','address','anonymous','generate','@xcally.com','name','indexOf','length','slice','join','Anonymous','pop','isEmpty','html','test','replace','includes','\x20[Attachment:\x20','body','textAsHtml','0x1?_0x5d925c[_0x245c('0x10')](0x0,-0x1)[_0x245c('0x11')]('\x20'):_0x3e7121[_0x245c('0xd')];}return _0x245c('0x12');}function getLastName(_0x510412){var _0x1cb8f5=_[_0x245c('0x7')](_0x510412[_0x245c('0x8')]);if(_0x1cb8f5&&_0x1cb8f5[_0x245c('0xd')]){var _0x50a77b=_0x1cb8f5[_0x245c('0xd')]['split'](/\s+/);return _0x50a77b[_0x245c('0xf')]>0x1?_0x50a77b[_0x245c('0x13')]():'';}return'';}function getMails(_0x3c2ccf,_0x19a877){var _0x49c0f6='';for(var _0x124e02=0x0;_0x124e02<_0x19a877[_0x245c('0x8')][_0x245c('0xf')];_0x124e02+=0x1){if(_0x19a877[_0x245c('0x8')][_0x124e02][_0x245c('0x9')]!==_0x3c2ccf){if(!_[_0x245c('0x14')](_0x49c0f6)){_0x49c0f6+=',';}_0x49c0f6+=_0x19a877['value'][_0x124e02][_0x245c('0xd')]||_0x19a877[_0x245c('0x8')][_0x124e02]['address']||'';_0x49c0f6+='\x20<';_0x49c0f6+=_0x19a877[_0x245c('0x8')][_0x124e02][_0x245c('0x9')]?_0x19a877[_0x245c('0x8')][_0x124e02][_0x245c('0x9')]:'anonymous'+random['generate'](0x6)+_0x245c('0xc');_0x49c0f6+='>';}}return _0x49c0f6;}function parseEmail(_0x5d2d63,_0x41c931,_0x48379b){if(_0x41c931[_0x245c('0x15')]){var _0x4b9aaf=/)<[^<]*)*<\/script>/gi;while(_0x4b9aaf[_0x245c('0x16')](_0x41c931['html'])){_0x41c931['html']=_0x41c931[_0x245c('0x15')][_0x245c('0x17')](_0x4b9aaf,'');}if(_0x41c931[_0x245c('0x15')][_0x245c('0x18')](_0x245c('0x19'))){var _0x122b42=[];_0x41c931['attachments']['forEach'](_0x5682fb=>{_0x122b42[_0x245c('0x1a')](_0x5682fb[_0x245c('0x1b')]);});var _0x383df5=/]+>/g;var _0x1f1357=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x5e0f01=_0x41c931['html'][_0x245c('0x17')](_0x1f1357,_0x245c('0x1c'));var _0x3296e1=_0x5e0f01['replace'](_0x383df5,_0x245c('0x1d'));for(let _0x79c12e=0x0;_0x79c12e<_0x122b42[_0x245c('0xf')];_0x79c12e++){var _0x3377f4=_0x3296e1['replace'](_0x245c('0x1d'),_0x245c('0x1e')+_0x122b42[_0x79c12e]+'\x20]');_0x3296e1=_0x3377f4;}_0x41c931['html']=_0x3296e1;}_0x48379b[_0x245c('0x1f')]=_0x41c931[_0x245c('0x15')];}else{_0x48379b[_0x245c('0x1f')]=_0x41c931[_0x245c('0x20')];}if(_0x48379b[_0x245c('0x1f')]){_0x48379b['body']=_0x48379b[_0x245c('0x1f')]['replace'](/0x0){var _0x290765=[_0x245c('0x32'),_0x245c('0x33'),_0x245c('0x34')];for(var _0x16bceb=0x0;_0x16bceb<_0x41c931[_0x245c('0x31')][_0x245c('0xf')];_0x16bceb++){var _0x49c0d5=_['indexOf'](_0x290765,_0x41c931[_0x245c('0x31')][_0x16bceb]['line']);if(_0x49c0d5>=0x0){_0x48379b[_0x245c('0x35')]=!![];}}}return _0x48379b;}exports[_0x245c('0x36')]=function(_0x42f2c0,_0x20cfdb,_0x4b6c1c){var _0x46c896={'from':getAddress(_0x20cfdb['from']),'firstName':getFirstName(_0x20cfdb['from']),'lastName':getLastName(_0x20cfdb[_0x245c('0x37')]),'mapKey':'email','message':{'from':getMails(_0x42f2c0[_0x245c('0x6')],_0x20cfdb['from']),'to':_0x42f2c0[_0x245c('0x6')],'cc':'','subject':_0x20cfdb['subject']||'','messageId':_0x20cfdb[_0x245c('0x38')],'inReplyTo':_0x20cfdb[_0x245c('0x39')],'sentAt':moment(_0x20cfdb[_0x245c('0x3a')])[_0x245c('0x2a')](_0x245c('0x3b')),'attach':![],'attachments':[]}};if(!_0x20cfdb[_0x245c('0x15')]&&!_0x20cfdb[_0x245c('0x20')]){var _0x530fac=_[_0x245c('0x3c')](_0x20cfdb[_0x245c('0x26')],{'contentType':_0x245c('0x3d')});if(_0x530fac[_0x245c('0xf')]){logger[_0x245c('0x3e')](util[_0x245c('0x2a')](_0x245c('0x3f'),_0x20cfdb[_0x245c('0x38')]));tnef[_0x245c('0x40')](_[_0x245c('0x41')](_0x530fac)[_0x245c('0x2f')],function(_0x3a11fc,_0x4fc7a3){if(_0x4fc7a3){_0x20cfdb[_0x245c('0x15')]=_0x4fc7a3[_0x245c('0x42')]||'

Empty\x20message

';if(_0x4fc7a3[_0x245c('0x43')]){for(var _0x4c8174=0x0;_0x4c8174<_0x4fc7a3['Attachments'][_0x245c('0xf')];_0x4c8174++){var _0xe9c133=_0x4fc7a3[_0x245c('0x43')][_0x4c8174];_0x46c896[_0x245c('0x23')]['attachments'][_0x245c('0x1a')]({'filename':_0xe9c133[_0x245c('0x44')],'content':Buffer[_0x245c('0x37')](_0xe9c133['Data'])});}}}_0x4b6c1c(parseEmail(_0x42f2c0,_0x20cfdb,_0x46c896));});}else{_0x20cfdb[_0x245c('0x15')]=_0x245c('0x45');_0x4b6c1c(parseEmail(_0x42f2c0,_0x20cfdb,_0x46c896));}}else{_0x4b6c1c(parseEmail(_0x42f2c0,_0x20cfdb,_0x46c896));}};exports[_0x245c('0x46')]=function(_0x3522d4){switch(_0x3522d4){case _0x245c('0x47'):return _0x245c('0x48');case _0x245c('0x49'):return _0x245c('0x4a');case _0x245c('0x4b'):return'imap-mail.outlook.com';case _0x245c('0x4c'):return _0x245c('0x4d');}return _0x245c('0x4e');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index f0cbfdf..0176ceb 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 _0xdcbb=['name','Service','key','SERV','active','Imap','Smtp','exports'];(function(_0x22e47a,_0x4ea10c){var _0x15a12a=function(_0x4a097f){while(--_0x4a097f){_0x22e47a['push'](_0x22e47a['shift']());}};_0x15a12a(++_0x4ea10c);}(_0xdcbb,0xe8));var _0xbdcb=function(_0x29df4c,_0x173127){_0x29df4c=_0x29df4c-0x0;var _0x4357e2=_0xdcbb[_0x29df4c];return _0x4357e2;};'use strict';var _=require('lodash');function MailAccount(_0x70cba8){this['id']=_0x70cba8['id']||0x0;this[_0xbdcb('0x0')]=_0x70cba8['name']||_0xbdcb('0x1');this[_0xbdcb('0x2')]=_0x70cba8[_0xbdcb('0x2')]||_0xbdcb('0x3');this[_0xbdcb('0x4')]=_0x70cba8['active']||![];this['Imap']=_0x70cba8[_0xbdcb('0x5')]||[];this[_0xbdcb('0x6')]=_0x70cba8[_0xbdcb('0x6')]||[];}module[_0xbdcb('0x7')]=MailAccount; \ No newline at end of file +var _0x1338=['exports','lodash','name','Service','key','active','Imap','Smtp'];(function(_0x7a42d9,_0x5a0c72){var _0x278b78=function(_0x1fa030){while(--_0x1fa030){_0x7a42d9['push'](_0x7a42d9['shift']());}};_0x278b78(++_0x5a0c72);}(_0x1338,0x1d1));var _0x8133=function(_0x533978,_0x3f4907){_0x533978=_0x533978-0x0;var _0x56b3a5=_0x1338[_0x533978];return _0x56b3a5;};'use strict';var _=require(_0x8133('0x0'));function MailAccount(_0x5c44fd){this['id']=_0x5c44fd['id']||0x0;this['name']=_0x5c44fd[_0x8133('0x1')]||_0x8133('0x2');this[_0x8133('0x3')]=_0x5c44fd[_0x8133('0x3')]||'SERV';this[_0x8133('0x4')]=_0x5c44fd[_0x8133('0x4')]||![];this[_0x8133('0x5')]=_0x5c44fd[_0x8133('0x5')]||[];this[_0x8133('0x6')]=_0x5c44fd['Smtp']||[];}module[_0x8133('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index cb88d95..7054d66 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 _0xb3cd=['hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts'];(function(_0x136304,_0x2045f4){var _0x76ef02=function(_0x175347){while(--_0x175347){_0x136304['push'](_0x136304['shift']());}};_0x76ef02(++_0x2045f4);}(_0xb3cd,0x189));var _0xdb3c=function(_0x3718b7,_0x2da677){_0x3718b7=_0x3718b7-0x0;var _0xf8c91e=_0xb3cd[_0x3718b7];return _0xf8c91e;};'use strict';var _=require(_0xdb3c('0x0'));var MailAccount=require(_0xdb3c('0x1'));var Realtime=function(){this[_0xdb3c('0x2')]={};};function freeIsNotKey(_0x5213ef,_0x2d2ba1,_0x1c13e3){var _0xc3af0d=_['mapKeys'](_0x5213ef,function(_0x4837e6,_0x3d47f2){return _0x4837e6[_0x1c13e3];});for(var _0x8b5a0 in _0x2d2ba1){if(_0x2d2ba1[_0xdb3c('0x3')](_0x8b5a0)){if(!_0xc3af0d[_0x8b5a0]){delete _0x2d2ba1[_0x8b5a0];}}}}Realtime[_0xdb3c('0x4')][_0xdb3c('0x5')]=function(_0x233d69,_0xc9eac6){for(var _0xd4cde7 in _0xc9eac6){if(_0x233d69[_0xdb3c('0x3')](_0xd4cde7)){_0x233d69[_0xd4cde7]=_0xc9eac6[_0xd4cde7];}}};Realtime[_0xdb3c('0x4')][_0xdb3c('0x6')]=function(){var _0x2d3648=this;return function(_0x3356f8){if(_0x3356f8){freeIsNotKey(_0x3356f8,_0x2d3648[_0xdb3c('0x2')],'id');for(var _0x4d9e64=0x0,_0x533e97={},_0x143521={};_0x4d9e64<_0x3356f8[_0xdb3c('0x7')];_0x4d9e64+=0x1){_0x533e97=_0x3356f8[_0x4d9e64];if(_[_0xdb3c('0x8')](_0x2d3648[_0xdb3c('0x2')][_0x533e97['id']])){_0x2d3648['mailAccounts'][_0x533e97['id']]=new MailAccount(_0x533e97);}else{_[_0xdb3c('0x9')](_0x2d3648[_0xdb3c('0x2')][_0x533e97['id']],_0x533e97);}}}return _0x2d3648[_0xdb3c('0x2')];};};module[_0xdb3c('0xa')]=Realtime; \ No newline at end of file +var _0x647b=['isUndefined','merge','exports','lodash','../model/mailAccount','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','mailAccounts','length'];(function(_0x9adf1b,_0x3ac695){var _0x960269=function(_0x368ca6){while(--_0x368ca6){_0x9adf1b['push'](_0x9adf1b['shift']());}};_0x960269(++_0x3ac695);}(_0x647b,0x7c));var _0xb647=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x647b[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xb647('0x0'));var MailAccount=require(_0xb647('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x11a8cc,_0x153438,_0x4849d4){var _0x378711=_[_0xb647('0x2')](_0x11a8cc,function(_0x504a21,_0x46de9b){return _0x504a21[_0x4849d4];});for(var _0x550898 in _0x153438){if(_0x153438[_0xb647('0x3')](_0x550898)){if(!_0x378711[_0x550898]){delete _0x153438[_0x550898];}}}}Realtime[_0xb647('0x4')][_0xb647('0x5')]=function(_0x551073,_0x1dedf7){for(var _0x527b43 in _0x1dedf7){if(_0x551073[_0xb647('0x3')](_0x527b43)){_0x551073[_0x527b43]=_0x1dedf7[_0x527b43];}}};Realtime[_0xb647('0x4')]['initMailAccounts']=function(){var _0x270521=this;return function(_0x5d84e1){if(_0x5d84e1){freeIsNotKey(_0x5d84e1,_0x270521[_0xb647('0x6')],'id');for(var _0x20e958=0x0,_0x1b3b92={},_0x12a600={};_0x20e958<_0x5d84e1[_0xb647('0x7')];_0x20e958+=0x1){_0x1b3b92=_0x5d84e1[_0x20e958];if(_[_0xb647('0x8')](_0x270521[_0xb647('0x6')][_0x1b3b92['id']])){_0x270521[_0xb647('0x6')][_0x1b3b92['id']]=new MailAccount(_0x1b3b92);}else{_[_0xb647('0x9')](_0x270521['mailAccounts'][_0x1b3b92['id']],_0x1b3b92);}}}return _0x270521[_0xb647('0x6')];};};module[_0xb647('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 777c7f1..4cac3b1 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 _0x5226=['name','email','active','key','TemplateId','Imap','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount'];(function(_0x1f52ec,_0xeeaf8e){var _0x53b820=function(_0x315c1d){while(--_0x315c1d){_0x1f52ec['push'](_0x1f52ec['shift']());}};_0x53b820(++_0xeeaf8e);}(_0x5226,0x137));var _0x6522=function(_0x29e157,_0x111d44){_0x29e157=_0x29e157-0x0;var _0x3a67cd=_0x5226[_0x29e157];return _0x3a67cd;};'use strict';var client=require(_0x6522('0x0'));exports[_0x6522('0x1')]=function(){return function(){return client[_0x6522('0x2')](_0x6522('0x3'),{'options':{'attributes':['id',_0x6522('0x4'),'service',_0x6522('0x5'),_0x6522('0x6'),_0x6522('0x7'),'ListId',_0x6522('0x8')],'raw':![],'include':[{'model':'MailServerIn','as':_0x6522('0x9')},{'model':_0x6522('0xa'),'as':_0x6522('0xb')}]},'log':_0x6522('0xc')});};};exports[_0x6522('0xd')]=function(_0x2dbe49,_0x318dc1){return client['Request']('NotifyMailAccount',{'account':{'id':_0x2dbe49},'body':_0x318dc1,'log':_0x6522('0xe')});}; \ No newline at end of file +var _0x77e6=['active','ListId','TemplateId','Imap','Smtp','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','service','email'];(function(_0x5cfdf4,_0x278351){var _0xe40152=function(_0x3cbe90){while(--_0x3cbe90){_0x5cfdf4['push'](_0x5cfdf4['shift']());}};_0xe40152(++_0x278351);}(_0x77e6,0x1a6));var _0x677e=function(_0x36c089,_0x18586f){_0x36c089=_0x36c089-0x0;var _0x37b3eb=_0x77e6[_0x36c089];return _0x37b3eb;};'use strict';var client=require(_0x677e('0x0'));exports[_0x677e('0x1')]=function(){return function(){return client[_0x677e('0x2')](_0x677e('0x3'),{'options':{'attributes':['id',_0x677e('0x4'),_0x677e('0x5'),_0x677e('0x6'),_0x677e('0x7'),'key',_0x677e('0x8'),_0x677e('0x9')],'raw':![],'include':[{'model':'MailServerIn','as':_0x677e('0xa')},{'model':'MailServerOut','as':_0x677e('0xb')}]},'log':'getMailAccount'});};};exports['notify']=function(_0x2eb40c,_0x4c519f){return client[_0x677e('0x2')](_0x677e('0xc'),{'account':{'id':_0x2eb40c},'body':_0x4c519f,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index b6ac6bf..f1ae3a1 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 _0x065b=['loginMailFrequency','../client','getSettings','Request','ShowSetting'];(function(_0x43002a,_0x202b9b){var _0x4f58d1=function(_0xfe6045){while(--_0xfe6045){_0x43002a['push'](_0x43002a['shift']());}};_0x4f58d1(++_0x202b9b);}(_0x065b,0x83));var _0xb065=function(_0x584513,_0x37c6c9){_0x584513=_0x584513-0x0;var _0xe4a14e=_0x065b[_0x584513];return _0xe4a14e;};'use strict';var client=require(_0xb065('0x0'));exports[_0xb065('0x1')]=function(){return client[_0xb065('0x2')](_0xb065('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xb065('0x4')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x947e=['../client','getSettings','Request','loginMailFrequency','GetSettings'];(function(_0x4d394d,_0x40e7b3){var _0x4f0003=function(_0x56d25d){while(--_0x56d25d){_0x4d394d['push'](_0x4d394d['shift']());}};_0x4f0003(++_0x40e7b3);}(_0x947e,0xbe));var _0xe947=function(_0x9245be,_0x2e4d9f){_0x9245be=_0x9245be-0x0;var _0x2e1605=_0x947e[_0x9245be];return _0x2e1605;};'use strict';var client=require(_0xe947('0x0'));exports[_0xe947('0x1')]=function(){return client[_0xe947('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xe947('0x3')]},'log':_0xe947('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index ced2b12..24d5375 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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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 e4e3e91..b6f05f0 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 _0x545e=['http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','port','socket.io','websocket','defaults','redis','localhost','adapter','default','../../config/express','../../routes','once','listening','log','exports','lodash'];(function(_0x14363e,_0x4f0e0d){var _0x17c56d=function(_0x1c7bac){while(--_0x1c7bac){_0x14363e['push'](_0x14363e['shift']());}};_0x17c56d(++_0x4f0e0d);}(_0x545e,0xdb));var _0xe545=function(_0x51daaa,_0x40ed35){_0x51daaa=_0x51daaa-0x0;var _0x5bb545=_0x545e[_0x51daaa];return _0x5bb545;};'use strict';var _=require(_0xe545('0x0'));var http=require(_0xe545('0x1'));var express=require(_0xe545('0x2'));var sticky=require(_0xe545('0x3'));var Redis=require(_0xe545('0x4'));var config=require(_0xe545('0x5'));var app=express();var server=http[_0xe545('0x6')](app);server[_0xe545('0x7')]=0xdbba0;if(sticky['listen'](server,config[_0xe545('0x8')])){var socketio=require(_0xe545('0x9'))(server,{'transports':[_0xe545('0xa'),'polling']});config['redis']=_[_0xe545('0xb')](config[_0xe545('0xc')],{'host':_0xe545('0xd'),'port':0x18eb});socketio[_0xe545('0xe')](require('socket.io-redis')({'pubClient':new Redis(config['redis']),'subClient':new Redis(config['redis'])}));require('../../config/triggers')[_0xe545('0xf')]();require('../../config/socketio')[_0xe545('0xf')](socketio);require(_0xe545('0x10'))['default'](app);require(_0xe545('0x11'))[_0xe545('0xf')](app);}else{server[_0xe545('0x12')](_0xe545('0x13'),function(){console[_0xe545('0x14')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0xe545('0x8')]);});}exports=module[_0xe545('0x15')]=app; \ No newline at end of file +var _0xd59e=['localhost','adapter','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','express','sticky-session','../../config/environment','createServer','timeout','port','socket.io','websocket','polling','redis','defaults'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd59e,0xfc));var _0xed59=function(_0x1cc1ba,_0x4ae341){_0x1cc1ba=_0x1cc1ba-0x0;var _0x2fcad1=_0xd59e[_0x1cc1ba];return _0x2fcad1;};'use strict';var _=require(_0xed59('0x0'));var http=require('http');var express=require(_0xed59('0x1'));var sticky=require(_0xed59('0x2'));var Redis=require('ioredis');var config=require(_0xed59('0x3'));var app=express();var server=http[_0xed59('0x4')](app);server[_0xed59('0x5')]=0xdbba0;if(sticky['listen'](server,config[_0xed59('0x6')])){var socketio=require(_0xed59('0x7'))(server,{'transports':[_0xed59('0x8'),_0xed59('0x9')]});config[_0xed59('0xa')]=_[_0xed59('0xb')](config['redis'],{'host':_0xed59('0xc'),'port':0x18eb});socketio[_0xed59('0xd')](require('socket.io-redis')({'pubClient':new Redis(config[_0xed59('0xa')]),'subClient':new Redis(config[_0xed59('0xa')])}));require(_0xed59('0xe'))[_0xed59('0xf')]();require(_0xed59('0x10'))['default'](socketio);require(_0xed59('0x11'))['default'](app);require(_0xed59('0x12'))['default'](app);}else{server[_0xed59('0x13')]('listening',function(){console[_0xed59('0x14')](_0xed59('0x15'),config['port']);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index e14672a..e4cdeca 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 _0xa054=['Request','request','then','debug','rpc','error','message','result','catch','jayson/promise','../../config/logger','routing','client','http'];(function(_0x5cf974,_0x43baa9){var _0x1a38f2=function(_0x372487){while(--_0x372487){_0x5cf974['push'](_0x5cf974['shift']());}};_0x1a38f2(++_0x43baa9);}(_0xa054,0x79));var _0x4a05=function(_0x1e4f2d,_0x22e2bb){_0x1e4f2d=_0x1e4f2d-0x0;var _0xd05ce5=_0xa054[_0x1e4f2d];return _0xd05ce5;};'use strict';var jayson=require(_0x4a05('0x0'));var BPromise=require('bluebird');var logger=require(_0x4a05('0x1'))(_0x4a05('0x2'));var client=jayson[_0x4a05('0x3')][_0x4a05('0x4')]({'port':0x2329});client[_0x4a05('0x5')]=function(_0x36a826,_0xb48614){return new BPromise(function(_0xe8b56c,_0x21dd24){return client[_0x4a05('0x6')](_0x36a826,_0xb48614)[_0x4a05('0x7')](function(_0x456168){logger[_0x4a05('0x8')](_0x4a05('0x9'),_0x4a05('0x2'),_0x36a826,_0xb48614,_0x456168);if(_0x456168[_0x4a05('0xa')]){logger[_0x4a05('0xa')](_0x4a05('0x9'),_0x4a05('0x2'),_0x36a826,_0x456168[_0x4a05('0xa')][_0x4a05('0xb')],_0xb48614);return _0x21dd24(_0x456168['error'][_0x4a05('0xb')]);}else{return _0xe8b56c(_0x456168[_0x4a05('0xc')]);}})[_0x4a05('0xd')](function(_0x5c6f38){logger[_0x4a05('0xa')](_0x4a05('0x9'),'routing',_0x36a826,_0x5c6f38,_0xb48614);return _0x21dd24(_0x5c6f38);});});};module['exports']=client; \ No newline at end of file +var _0x3def=['Request','then','debug','rpc','error','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client'];(function(_0x40ed50,_0x35b7a4){var _0x407420=function(_0x2e4706){while(--_0x2e4706){_0x40ed50['push'](_0x40ed50['shift']());}};_0x407420(++_0x35b7a4);}(_0x3def,0x18e));var _0xf3de=function(_0x39e157,_0xf96e95){_0x39e157=_0x39e157-0x0;var _0x26a02f=_0x3def[_0x39e157];return _0x26a02f;};'use strict';var jayson=require(_0xf3de('0x0'));var BPromise=require(_0xf3de('0x1'));var logger=require(_0xf3de('0x2'))(_0xf3de('0x3'));var client=jayson[_0xf3de('0x4')]['http']({'port':0x2329});client[_0xf3de('0x5')]=function(_0x4ee674,_0xa9be31){return new BPromise(function(_0x483a1d,_0x1c4812){return client['request'](_0x4ee674,_0xa9be31)[_0xf3de('0x6')](function(_0x241d06){logger[_0xf3de('0x7')](_0xf3de('0x8'),'routing',_0x4ee674,_0xa9be31,_0x241d06);if(_0x241d06[_0xf3de('0x9')]){logger[_0xf3de('0x9')]('rpc',_0xf3de('0x3'),_0x4ee674,_0x241d06['error']['message'],_0xa9be31);return _0x1c4812(_0x241d06[_0xf3de('0x9')]['message']);}else{return _0x483a1d(_0x241d06[_0xf3de('0xa')]);}})[_0xf3de('0xb')](function(_0x2089c8){logger[_0xf3de('0x9')](_0xf3de('0x8'),_0xf3de('0x3'),_0x4ee674,_0x2089c8,_0xa9be31);return _0x1c4812(_0x2089c8);});});};module[_0xf3de('0xc')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index df3bfc0..3f82611 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 _0xbc68=['then','initAgents','initIntervals','initOpenchannelQueues','getChatQueues','getSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','listen','catch','./realtime','./rpc/user','./rpc/interval','./rpc/chatQueue','getAgents'];(function(_0x3a0fba,_0x4567d7){var _0x5b1752=function(_0x4a3fd9){while(--_0x4a3fd9){_0x3a0fba['push'](_0x3a0fba['shift']());}};_0x5b1752(++_0x4567d7);}(_0xbc68,0x12d));var _0x8bc6=function(_0x5509f7,_0x29958a){_0x5509f7=_0x5509f7-0x0;var _0x48582f=_0xbc68[_0x5509f7];return _0x48582f;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require(_0x8bc6('0x0'));var user=require(_0x8bc6('0x1'));var interval=require(_0x8bc6('0x2'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x8bc6('0x3'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require('./rpc/mailQueue');var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()['then'](user[_0x8bc6('0x4')]())[_0x8bc6('0x5')](realtime[_0x8bc6('0x6')]())[_0x8bc6('0x5')](interval['getIntervals']())[_0x8bc6('0x5')](realtime[_0x8bc6('0x7')]())['then'](openchannelQueue['getOpenchannelQueues']())[_0x8bc6('0x5')](realtime[_0x8bc6('0x8')]())[_0x8bc6('0x5')](chatQueue[_0x8bc6('0x9')]())[_0x8bc6('0x5')](realtime['initChatQueues']())['then'](smsQueue[_0x8bc6('0xa')]())[_0x8bc6('0x5')](realtime['initSmsQueues']())[_0x8bc6('0x5')](mailQueue[_0x8bc6('0xb')]())[_0x8bc6('0x5')](realtime[_0x8bc6('0xc')]())[_0x8bc6('0x5')](faxQueue[_0x8bc6('0xd')]())['then'](realtime[_0x8bc6('0xe')]())[_0x8bc6('0x5')](whatsappQueue[_0x8bc6('0xf')]())['then'](realtime['initWhatsappQueues']())[_0x8bc6('0x5')](function(){return realtime;});}function main(){return server[_0x8bc6('0x10')](realtime)[_0x8bc6('0x5')](function(_0x15cadd){return initRealtime();})[_0x8bc6('0x5')](function(_0x44f5d3){return setInterval(initRealtime,0x1388);})[_0x8bc6('0x11')](function(_0x52fb92){console['log'](_0x52fb92);});}main(); \ No newline at end of file +var _0x38e5=['getAgents','initAgents','getIntervals','initIntervals','then','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','initFaxQueues','getWhatsappQueues','listen','catch','log','bluebird','./server','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve'];(function(_0x2c5cd4,_0x124d5e){var _0xdd9a88=function(_0x2b17cc){while(--_0x2b17cc){_0x2c5cd4['push'](_0x2c5cd4['shift']());}};_0xdd9a88(++_0x124d5e);}(_0x38e5,0x7e));var _0x538e=function(_0x481dbe,_0x20984d){_0x481dbe=_0x481dbe-0x0;var _0x56a7b2=_0x38e5[_0x481dbe];return _0x56a7b2;};'use strict';var BPromise=require(_0x538e('0x0'));var server=require(_0x538e('0x1'));var Realtime=require('./realtime');var user=require(_0x538e('0x2'));var interval=require(_0x538e('0x3'));var openchannelQueue=require(_0x538e('0x4'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x538e('0x5'));var faxQueue=require(_0x538e('0x6'));var whatsappQueue=require(_0x538e('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x538e('0x8')]()['then'](user[_0x538e('0x9')]())['then'](realtime[_0x538e('0xa')]())['then'](interval[_0x538e('0xb')]())['then'](realtime[_0x538e('0xc')]())[_0x538e('0xd')](openchannelQueue[_0x538e('0xe')]())[_0x538e('0xd')](realtime[_0x538e('0xf')]())[_0x538e('0xd')](chatQueue[_0x538e('0x10')]())[_0x538e('0xd')](realtime[_0x538e('0x11')]())[_0x538e('0xd')](smsQueue[_0x538e('0x12')]())['then'](realtime[_0x538e('0x13')]())[_0x538e('0xd')](mailQueue[_0x538e('0x14')]())['then'](realtime[_0x538e('0x15')]())[_0x538e('0xd')](faxQueue['getFaxQueues']())[_0x538e('0xd')](realtime[_0x538e('0x16')]())[_0x538e('0xd')](whatsappQueue[_0x538e('0x17')]())[_0x538e('0xd')](realtime['initWhatsappQueues']())[_0x538e('0xd')](function(){return realtime;});}function main(){return server[_0x538e('0x18')](realtime)[_0x538e('0xd')](function(_0x5d26ce){return initRealtime();})[_0x538e('0xd')](function(_0x364492){return setInterval(initRealtime,0x1388);})[_0x538e('0x19')](function(_0x2aed51){console[_0x538e('0x1a')](_0x2aed51);});}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 2696474..6965d39 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x4bb32f,_0x2217e){var _0x2dd6e6=function(_0x28cd57){while(--_0x28cd57){_0x4bb32f['push'](_0x4bb32f['shift']());}};_0x2dd6e6(++_0x2217e);}(_0x326f,0xd1));var _0xf326=function(_0x508418,_0x21a5f5){_0x508418=_0x508418-0x0;var _0x28357b=_0x326f[_0x508418];return _0x28357b;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file +var _0xe14b=['next','restart','condition','noop','findRules','matches','turn','length','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','register','exports','lodash','util','isNil','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','push','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','call'];(function(_0x553443,_0x58272e){var _0x12b705=function(_0x32164c){while(--_0x32164c){_0x553443['push'](_0x553443['shift']());}};_0x12b705(++_0x58272e);}(_0xe14b,0x93));var _0xbe14=function(_0x3b70a4,_0x405917){_0x3b70a4=_0x3b70a4-0x0;var _0x36af97=_0xe14b[_0x3b70a4];return _0x36af97;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x11c3a0,_0x36393a){this['init']();if(!_[_0xbe14('0x2')](_0x11c3a0)){this['register'](_0x11c3a0);}if(_0x36393a){this['ignoreFactChanges']=_0x36393a[_0xbe14('0x3')];}return this;}util[_0xbe14('0x4')](RuleEngine,EventEmitter);RuleEngine[_0xbe14('0x5')][_0xbe14('0x6')]=function(_0x1d9ade){this[_0xbe14('0x7')]=[];this[_0xbe14('0x8')]=[];};RuleEngine['prototype']['register']=function(_0x496063){if(Array[_0xbe14('0x9')](_0x496063)){this[_0xbe14('0x7')]=this[_0xbe14('0x7')][_0xbe14('0xa')](_0x496063);}else if(_0x496063!==null&&_['isObject'](_0x496063)){this['rules'][_0xbe14('0xb')](_0x496063);}this[_0xbe14('0xc')]();};RuleEngine['prototype'][_0xbe14('0xc')]=function(){this[_0xbe14('0x8')]=this[_0xbe14('0x7')][_0xbe14('0xd')](function(_0x27792f){if(_[_0xbe14('0x2')](_0x27792f['on'])){_0x27792f['on']=!![];}if(_0x27792f['on']===!![]){return _0x27792f;}});this[_0xbe14('0x8')]=_[_0xbe14('0xe')](this[_0xbe14('0x8')],['p'],[_0xbe14('0xf')]);};RuleEngine[_0xbe14('0x5')][_0xbe14('0x10')]=function(_0x813399,_0x530538){var _0x55b3a7=![];_0x813399[_0xbe14('0x11')]=!![];var _0x3dc4a9=_[_0xbe14('0x12')](_0x813399);var _0x37ce4e=_['clone'](_0x813399);var _0x21c789=this[_0xbe14('0x8')];var _0xfd7b8f=[];var _0x123ede=this[_0xbe14('0x3')];(function FnRuleLoop(_0x29ab73){var _0x17ae86={'rules':function(){return _0x21c789;},'rule':function(){return _0x21c789[_0x29ab73];},'when':function(_0x5ea1f8){if(_0x5ea1f8){var _0x137ee5=_0x21c789[_0x29ab73][_0xbe14('0x13')];_0x137ee5[_0xbe14('0x14')]=_0x21c789[_0x29ab73]['id']||_0x21c789[_0x29ab73][_0xbe14('0x15')]||_0xbe14('0x16')+_0x29ab73;process[_0xbe14('0x17')](function(){_0xfd7b8f['push'](_0x137ee5[_0xbe14('0x14')]);_0x137ee5[_0xbe14('0x18')](_0x3dc4a9,_0x17ae86);});}else{process[_0xbe14('0x17')](function(){_0x17ae86[_0xbe14('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x55b3a7=!![];return FnRuleLoop(0x0);},'next':function(_0x188ec4){if(!_0x123ede&&!_['isEqual'](_0x37ce4e,_0x3dc4a9)){_0x37ce4e=_[_0xbe14('0x12')](_0x3dc4a9);process['nextTick'](function(){_0x17ae86[_0xbe14('0x1a')]();});}else{process['nextTick'](function(){if(_[_0xbe14('0x2')](_0x188ec4)){return FnRuleLoop(_0x29ab73+0x1);}else{return FnRuleLoop(_0x188ec4);}});}}};if(_0x29ab73<_0x21c789['length']&&_0x55b3a7===![]){var _0x274018=_0x21c789[_0x29ab73][_0xbe14('0x1b')];_0x274018['call'](_0x3dc4a9,_0x17ae86);}else{process[_0xbe14('0x17')](function(){_0x3dc4a9['matchPath']=_0xfd7b8f;return _0x530538?_0x530538(_0x3dc4a9):_[_0xbe14('0x1c')]();});}}(0x0));};RuleEngine['prototype'][_0xbe14('0x1d')]=function(_0x5fa043){if(_[_0xbe14('0x2')](_0x5fa043)){return this[_0xbe14('0x7')];}else{var _0x15ef02=_[_0xbe14('0x1e')](_0x5fa043);return _['filter'](this[_0xbe14('0x7')],_0x15ef02);}};RuleEngine[_0xbe14('0x5')][_0xbe14('0x1f')]=function(_0x169369,_0x5dd475){var _0x16f884=_0x169369==='on'||_0x169369==='ON'?!![]:![];var _0x29fc64=this['findRules'](_0x5dd475);for(var _0x3c3613=0x0,_0x3b3e84=_0x29fc64[_0xbe14('0x20')];_0x3c3613<_0x3b3e84;_0x3c3613+=0x1){_0x29fc64[_0x3c3613]['on']=_0x16f884;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x21')]=function(_0x31a664,_0x2b05cb){_0x31a664=parseInt(_0x31a664,0xa);var _0x4168c8=this[_0xbe14('0x1d')](_0x2b05cb);for(var _0x40538f=0x0,_0x3bf43c=_0x4168c8[_0xbe14('0x20')];_0x40538f<_0x3bf43c;_0x40538f+=0x1){_0x4168c8[_0x40538f][_0xbe14('0x22')]=_0x31a664;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x23')]=function(){var _0x2ff48e=this[_0xbe14('0x7')];if(_0x2ff48e instanceof Array){_0x2ff48e=_0x2ff48e[_0xbe14('0x24')](function(_0x581e86){_0x581e86[_0xbe14('0x1b')]=_0x581e86['condition']['toString']();_0x581e86[_0xbe14('0x13')]=_0x581e86['consequence'][_0xbe14('0x25')]();return _0x581e86;});}else if(!_[_0xbe14('0x2')](_0x2ff48e)){_0x2ff48e['condition']=_0x2ff48e['condition']['toString']();_0x2ff48e[_0xbe14('0x13')]=_0x2ff48e[_0xbe14('0x13')]['toString']();}return _0x2ff48e;};RuleEngine[_0xbe14('0x5')][_0xbe14('0x26')]=function(_0x452635){this[_0xbe14('0x6')]();if(_[_0xbe14('0x27')](_0x452635)){_0x452635=JSON['parse'](_0x452635);}if(_0x452635 instanceof Array){_0x452635=_0x452635['map'](function(_0x15a997){_0x15a997['condition']=eval('('+_0x15a997['condition']+')');_0x15a997['consequence']=eval('('+_0x15a997[_0xbe14('0x13')]+')');return _0x15a997;});}else if(_0x452635!==null&&typeof _0x452635==_0xbe14('0x28')){_0x452635[_0xbe14('0x1b')]=eval('('+_0x452635[_0xbe14('0x1b')]+')');_0x452635[_0xbe14('0x13')]=eval('('+_0x452635[_0xbe14('0x13')]+')');}this[_0xbe14('0x29')](_0x452635);};module[_0xbe14('0x2a')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index c3cc7d4..a028fb0 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 _0xcf90=['message','sendMailMessage','SendMail','jayson/promise','client','request','then','error'];(function(_0x5067db,_0xf8d2f2){var _0x2771e4=function(_0x3d5cb2){while(--_0x3d5cb2){_0x5067db['push'](_0x5067db['shift']());}};_0x2771e4(++_0xf8d2f2);}(_0xcf90,0x1cb));var _0x0cf9=function(_0x294ac7,_0x2e959b){_0x294ac7=_0x294ac7-0x0;var _0x4597e2=_0xcf90[_0x294ac7];return _0x4597e2;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x0cf9('0x0'));var client=jayson[_0x0cf9('0x1')]['http']({'port':0x232b});function request(_0x6f1d4e,_0x515885){return new BPromise(function(_0xee9198,_0x5631c3){return client[_0x0cf9('0x2')](_0x6f1d4e,_0x515885)[_0x0cf9('0x3')](function(_0x7ce49b){if(_0x7ce49b[_0x0cf9('0x4')]){return _0x5631c3(_0x7ce49b[_0x0cf9('0x4')][_0x0cf9('0x5')]);}else{return _0xee9198(_0x7ce49b['result']);}})['catch'](function(_0x48d379){return _0x5631c3(_0x48d379);});});}exports[_0x0cf9('0x6')]=function(_0x12c75a,_0x450b6f){return request(_0x0cf9('0x7'),{'account':_0x12c75a,'message':_0x450b6f});}; \ No newline at end of file +var _0x2032=['then','error','message','result','catch','sendMailMessage','SendMail','jayson/promise','http'];(function(_0x1ba37b,_0x1ae7c8){var _0x4b04e2=function(_0xc65d9c){while(--_0xc65d9c){_0x1ba37b['push'](_0x1ba37b['shift']());}};_0x4b04e2(++_0x1ae7c8);}(_0x2032,0x166));var _0x2203=function(_0x5a5dbe,_0x24bc80){_0x5a5dbe=_0x5a5dbe-0x0;var _0x35d40f=_0x2032[_0x5a5dbe];return _0x35d40f;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x2203('0x0'));var client=jayson['client'][_0x2203('0x1')]({'port':0x232b});function request(_0x159188,_0x179e42){return new BPromise(function(_0xb8b140,_0x45ed2c){return client['request'](_0x159188,_0x179e42)[_0x2203('0x2')](function(_0x319de3){if(_0x319de3[_0x2203('0x3')]){return _0x45ed2c(_0x319de3[_0x2203('0x3')][_0x2203('0x4')]);}else{return _0xb8b140(_0x319de3[_0x2203('0x5')]);}})[_0x2203('0x6')](function(_0x129239){return _0x45ed2c(_0x129239);});});}exports[_0x2203('0x7')]=function(_0x548de1,_0xe305a0){return request(_0x2203('0x8'),{'account':_0x548de1,'message':_0xe305a0});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 01c7c3b..b89bc6f 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 _0x76e0=['redis','socket.io-emitter','name','voicePause','chatPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busyQueue','md5','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','prototype','mail','openchannel','fax','length','StatusTime','mailPause','faxPause','chatCapacity','mailCurrentCapacity','smsStatus','openchannelCurrentCapacity','busy','stringify','emit','user:save','exports','../../../config/environment','defaults'];(function(_0x2e39e8,_0xd7987e){var _0x2e1a83=function(_0x5f213b){while(--_0x5f213b){_0x2e39e8['push'](_0x2e39e8['shift']());}};_0x2e1a83(++_0xd7987e);}(_0x76e0,0x6e));var _0x076e=function(_0x302220,_0x11be79){_0x302220=_0x302220-0x0;var _0x29e5b0=_0x76e0[_0x302220];return _0x29e5b0;};'use strict';var _=require('lodash');var moment=require('moment');var md5=require('md5');var Redis=require('ioredis');var config=require(_0x076e('0x0'));config['redis']=_[_0x076e('0x1')](config[_0x076e('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0x076e('0x3'))(new Redis(config[_0x076e('0x2')]));function Agent(_0x3bacb1){this['id']=_0x3bacb1['id']||0x0;this[_0x076e('0x4')]=_0x3bacb1[_0x076e('0x4')]||'';this['online']=_0x3bacb1['online']||!![];this[_0x076e('0x5')]=_0x3bacb1[_0x076e('0x5')]||![];this[_0x076e('0x6')]=_0x3bacb1['chatPause']||![];this['mailPause']=_0x3bacb1['mailPause']||![];this['faxPause']=_0x3bacb1['faxPause']||![];this[_0x076e('0x7')]=_0x3bacb1[_0x076e('0x7')]||![];this[_0x076e('0x8')]=_0x3bacb1[_0x076e('0x8')]||![];this[_0x076e('0x9')]=_0x076e('0xa');this[_0x076e('0xb')]=0x0;this['chatCapacity']=_0x3bacb1['chatCapacity']||0x0;this[_0x076e('0xc')]=0x0;this[_0x076e('0xd')]=_0x076e('0xa');this[_0x076e('0xe')]=0x0;this[_0x076e('0xf')]=_0x3bacb1[_0x076e('0xf')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x076e('0x10')]=_0x076e('0xa');this[_0x076e('0x11')]=0x0;this['faxCapacity']=_0x3bacb1[_0x076e('0x12')]||0x0;this[_0x076e('0x13')]=0x0;this['smsStatus']=_0x076e('0xa');this[_0x076e('0x14')]=0x0;this[_0x076e('0x15')]=_0x3bacb1[_0x076e('0x15')]||0x0;this[_0x076e('0x16')]=0x0;this[_0x076e('0x17')]=_0x076e('0xa');this[_0x076e('0x18')]=0x0;this[_0x076e('0x19')]=_0x3bacb1[_0x076e('0x19')]||0x0;this[_0x076e('0x1a')]=0x0;this[_0x076e('0x1b')]='unknown';this[_0x076e('0x1c')]=0x0;this[_0x076e('0x1d')]=_0x3bacb1[_0x076e('0x1d')]||0x0;this['openchannelCurrentCapacity']=0x0;this['busy']=![];this[_0x076e('0x1e')]=undefined;this[_0x076e('0x1f')]='';this[_0x076e('0x20')]();}Agent['prototype'][_0x076e('0x21')]=function(_0x410bca){if(this[_0x410bca+_0x076e('0x22')]>0x0){if(this[_0x410bca+_0x076e('0x23')]>0x0&&this[_0x410bca+_0x076e('0x22')]>=this[_0x410bca+_0x076e('0x23')]){return _0x076e('0x24');}else{return _0x076e('0x25');}}else{return _0x076e('0x26');}};Agent[_0x076e('0x27')]['updateRealtime']=function(){var _0x447043=[_0x076e('0x28'),'chat',_0x076e('0x29'),_0x076e('0x2a'),'sms','whatsapp'];for(var _0x4c7ed3=0x0;_0x4c7ed3<_0x447043[_0x076e('0x2b')];_0x4c7ed3+=0x1){var _0x1a6011=this[_0x076e('0x21')](_0x447043[_0x4c7ed3]);if(this[_0x447043[_0x4c7ed3]+'Status']!==_0x1a6011){this[_0x447043[_0x4c7ed3]+_0x076e('0x2c')]=_['toNumber'](moment()['format']('x'));}this[_0x447043[_0x4c7ed3]+'Status']=_0x1a6011;}var _0x17d06d={'id':this['id'],'name':this[_0x076e('0x4')],'online':this['online'],'voicePause':this['voicePause'],'chatPause':this[_0x076e('0x6')],'mailPause':this[_0x076e('0x2d')],'smsPause':this[_0x076e('0x7')],'faxPause':this[_0x076e('0x2e')],'openchannelPause':this[_0x076e('0x8')],'chatStatus':this[_0x076e('0x9')],'chatStatusTime':this[_0x076e('0xb')],'chatCapacity':this[_0x076e('0x2f')],'chatCurrentCapacity':this[_0x076e('0xc')],'mailStatus':this[_0x076e('0xd')],'mailStatusTime':this[_0x076e('0xe')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x076e('0x30')],'faxStatus':this[_0x076e('0x10')],'faxStatusTime':this[_0x076e('0x11')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x076e('0x13')],'smsStatus':this[_0x076e('0x31')],'smsStatusTime':this[_0x076e('0x14')],'smsCapacity':this[_0x076e('0x15')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x076e('0x17')],'whatsappStatusTime':this[_0x076e('0x18')],'whatsappCapacity':this[_0x076e('0x19')],'whatsappCurrentCapacity':this[_0x076e('0x1a')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x076e('0x1c')],'openchannelCapacity':this[_0x076e('0x1d')],'openchannelCurrentCapacity':this[_0x076e('0x32')],'busy':this[_0x076e('0x33')],'busyQueue':this[_0x076e('0x1e')]};var _0xd87254=md5(JSON[_0x076e('0x34')](_0x17d06d));if(this[_0x076e('0x1f')]!==_0xd87254){this[_0x076e('0x1f')]=_0xd87254;io[_0x076e('0x35')](_0x076e('0x36'),_0x17d06d);}};module[_0x076e('0x37')]=Agent; \ No newline at end of file +var _0x7b1f=['redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelCapacity','openchannelCurrentCapacity','busy','md5','updateRealtime','prototype','CurrentCapacity','Capacity','working','mail','chat','openchannel','whatsapp','length','getChannelStatus','toNumber','smsCurrentCapacity','openchannelStatusTime','busyQueue','stringify','lodash','ioredis','../../../config/environment'];(function(_0x30c241,_0x4a2b49){var _0x4a0c39=function(_0x3e15e7){while(--_0x3e15e7){_0x30c241['push'](_0x30c241['shift']());}};_0x4a0c39(++_0x4a2b49);}(_0x7b1f,0x13b));var _0xf7b1=function(_0x15431b,_0x35f41b){_0x15431b=_0x15431b-0x0;var _0x135ee1=_0x7b1f[_0x15431b];return _0x135ee1;};'use strict';var _=require(_0xf7b1('0x0'));var moment=require('moment');var md5=require('md5');var Redis=require(_0xf7b1('0x1'));var config=require(_0xf7b1('0x2'));config[_0xf7b1('0x3')]=_[_0xf7b1('0x4')](config[_0xf7b1('0x3')],{'host':_0xf7b1('0x5'),'port':0x18eb});var io=require(_0xf7b1('0x6'))(new Redis(config[_0xf7b1('0x3')]));function Agent(_0x27df28){this['id']=_0x27df28['id']||0x0;this[_0xf7b1('0x7')]=_0x27df28[_0xf7b1('0x7')]||'';this[_0xf7b1('0x8')]=_0x27df28[_0xf7b1('0x8')]||!![];this['voicePause']=_0x27df28[_0xf7b1('0x9')]||![];this[_0xf7b1('0xa')]=_0x27df28['chatPause']||![];this[_0xf7b1('0xb')]=_0x27df28[_0xf7b1('0xb')]||![];this[_0xf7b1('0xc')]=_0x27df28[_0xf7b1('0xc')]||![];this[_0xf7b1('0xd')]=_0x27df28[_0xf7b1('0xd')]||![];this['openchannelPause']=_0x27df28[_0xf7b1('0xe')]||![];this[_0xf7b1('0xf')]=_0xf7b1('0x10');this[_0xf7b1('0x11')]=0x0;this[_0xf7b1('0x12')]=_0x27df28[_0xf7b1('0x12')]||0x0;this['chatCurrentCapacity']=0x0;this[_0xf7b1('0x13')]=_0xf7b1('0x10');this[_0xf7b1('0x14')]=0x0;this[_0xf7b1('0x15')]=_0x27df28[_0xf7b1('0x15')]||0x0;this[_0xf7b1('0x16')]=0x0;this[_0xf7b1('0x17')]='unknown';this[_0xf7b1('0x18')]=0x0;this[_0xf7b1('0x19')]=_0x27df28[_0xf7b1('0x19')]||0x0;this[_0xf7b1('0x1a')]=0x0;this[_0xf7b1('0x1b')]=_0xf7b1('0x10');this[_0xf7b1('0x1c')]=0x0;this['smsCapacity']=_0x27df28[_0xf7b1('0x1d')]||0x0;this['smsCurrentCapacity']=0x0;this['whatsappStatus']='unknown';this[_0xf7b1('0x1e')]=0x0;this[_0xf7b1('0x1f')]=_0x27df28[_0xf7b1('0x1f')]||0x0;this[_0xf7b1('0x20')]=0x0;this['openchannelStatus']=_0xf7b1('0x10');this['openchannelStatusTime']=0x0;this[_0xf7b1('0x21')]=_0x27df28['openchannelCapacity']||0x0;this[_0xf7b1('0x22')]=0x0;this[_0xf7b1('0x23')]=![];this['busyQueue']=undefined;this[_0xf7b1('0x24')]='';this[_0xf7b1('0x25')]();}Agent[_0xf7b1('0x26')]['getChannelStatus']=function(_0x9efff){if(this[_0x9efff+_0xf7b1('0x27')]>0x0){if(this[_0x9efff+_0xf7b1('0x28')]>0x0&&this[_0x9efff+_0xf7b1('0x27')]>=this[_0x9efff+_0xf7b1('0x28')]){return'maxcapacity';}else{return _0xf7b1('0x29');}}else{return'idle';}};Agent[_0xf7b1('0x26')][_0xf7b1('0x25')]=function(){var _0x419775=[_0xf7b1('0x2a'),_0xf7b1('0x2b'),_0xf7b1('0x2c'),'fax','sms',_0xf7b1('0x2d')];for(var _0x1a1ba4=0x0;_0x1a1ba4<_0x419775[_0xf7b1('0x2e')];_0x1a1ba4+=0x1){var _0x25c90f=this[_0xf7b1('0x2f')](_0x419775[_0x1a1ba4]);if(this[_0x419775[_0x1a1ba4]+'Status']!==_0x25c90f){this[_0x419775[_0x1a1ba4]+'StatusTime']=_[_0xf7b1('0x30')](moment()['format']('x'));}this[_0x419775[_0x1a1ba4]+'Status']=_0x25c90f;}var _0x3cf230={'id':this['id'],'name':this['name'],'online':this[_0xf7b1('0x8')],'voicePause':this['voicePause'],'chatPause':this[_0xf7b1('0xa')],'mailPause':this['mailPause'],'smsPause':this['smsPause'],'faxPause':this[_0xf7b1('0xc')],'openchannelPause':this[_0xf7b1('0xe')],'chatStatus':this[_0xf7b1('0xf')],'chatStatusTime':this[_0xf7b1('0x11')],'chatCapacity':this[_0xf7b1('0x12')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0xf7b1('0x13')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xf7b1('0x15')],'mailCurrentCapacity':this[_0xf7b1('0x16')],'faxStatus':this[_0xf7b1('0x17')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0xf7b1('0x1a')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0xf7b1('0x1c')],'smsCapacity':this[_0xf7b1('0x1d')],'smsCurrentCapacity':this[_0xf7b1('0x31')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0xf7b1('0x1e')],'whatsappCapacity':this[_0xf7b1('0x1f')],'whatsappCurrentCapacity':this[_0xf7b1('0x20')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xf7b1('0x32')],'openchannelCapacity':this[_0xf7b1('0x21')],'openchannelCurrentCapacity':this[_0xf7b1('0x22')],'busy':this[_0xf7b1('0x23')],'busyQueue':this[_0xf7b1('0x33')]};var _0x380207=md5(JSON[_0xf7b1('0x34')](_0x3cf230));if(this[_0xf7b1('0x24')]!==_0x380207){this['md5']=_0x380207;io['emit']('user:save',_0x3cf230);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 94cb1dd..e88c381 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 _0x37f1=['md5','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','_rr','prototype','updateRealtime','length','online','loggedIn','chatPause','paused','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash'];(function(_0x111e4c,_0x39e226){var _0x2aaa89=function(_0x5a31c8){while(--_0x5a31c8){_0x111e4c['push'](_0x111e4c['shift']());}};_0x2aaa89(++_0x39e226);}(_0x37f1,0x1ec));var _0x137f=function(_0x17f47a,_0x5c773a){_0x17f47a=_0x17f47a-0x0;var _0x3d9fc5=_0x37f1[_0x17f47a];return _0x3d9fc5;};'use strict';var _=require(_0x137f('0x0'));var md5=require(_0x137f('0x1'));var util=require('util');var Redis=require(_0x137f('0x2'));var config=require(_0x137f('0x3'));config[_0x137f('0x4')]=_[_0x137f('0x5')](config[_0x137f('0x4')],{'host':_0x137f('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x137f('0x4')]));function ChatQueue(_0x45038a){this['id']=_0x45038a['id']||0x0;this['name']=_0x45038a[_0x137f('0x7')]||'';this[_0x137f('0x8')]=_0x45038a[_0x137f('0x8')]||0xa;this[_0x137f('0x9')]=_0x45038a[_0x137f('0x9')]||'beepall';this[_0x137f('0xa')]=_0x45038a['Agents'];this[_0x137f('0xb')]={};this[_0x137f('0xc')]=0x0;this[_0x137f('0x1')]='';this[_0x137f('0xd')]();this['updateRealtime']();}ChatQueue['prototype'][_0x137f('0xd')]=function(){var _0x3a15f8=this[_0x137f('0xb')][_0x137f('0xe')];this['mapAgentsId']=_['map'](this[_0x137f('0xa')],'id');this[_0x137f('0xb')]['_rr']=_0x3a15f8;};ChatQueue[_0x137f('0xf')][_0x137f('0x10')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0xd3c8cd=0x0;_0xd3c8cd=0x0?this[_0x137f('0x16')]:0x0;var _0x318947={'id':this['id'],'available':this[_0x137f('0x16')],'loggedIn':this[_0x137f('0x13')],'name':this[_0x137f('0x7')],'paused':this[_0x137f('0x15')],'waiting':this[_0x137f('0xc')]};var _0x3e88c0=md5(JSON[_0x137f('0x17')](_0x318947));if(this[_0x137f('0x1')]!==_0x3e88c0){this['md5']=_0x3e88c0;io['to'](util[_0x137f('0x18')](_0x137f('0x19'),_0x318947[_0x137f('0x7')]))[_0x137f('0x1a')](_0x137f('0x1b'),_0x318947);}};module[_0x137f('0x1c')]=ChatQueue; \ No newline at end of file +var _0xde82=['ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','chatPause','available','stringify','chat:queue:%s','emit','chat_queue:save','exports','lodash','util'];(function(_0x46a197,_0xbab470){var _0x441b75=function(_0x2e4e3b){while(--_0x2e4e3b){_0x46a197['push'](_0x46a197['shift']());}};_0x441b75(++_0xbab470);}(_0xde82,0x85));var _0x2de8=function(_0x3e3ab5,_0x1d1b76){_0x3e3ab5=_0x3e3ab5-0x0;var _0x309fd0=_0xde82[_0x3e3ab5];return _0x309fd0;};'use strict';var _=require(_0x2de8('0x0'));var md5=require('md5');var util=require(_0x2de8('0x1'));var Redis=require(_0x2de8('0x2'));var config=require(_0x2de8('0x3'));config[_0x2de8('0x4')]=_['defaults'](config[_0x2de8('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x2de8('0x5'))(new Redis(config[_0x2de8('0x4')]));function ChatQueue(_0x4096e4){this['id']=_0x4096e4['id']||0x0;this[_0x2de8('0x6')]=_0x4096e4['name']||'';this[_0x2de8('0x7')]=_0x4096e4[_0x2de8('0x7')]||0xa;this[_0x2de8('0x8')]=_0x4096e4[_0x2de8('0x8')]||'beepall';this[_0x2de8('0x9')]=_0x4096e4[_0x2de8('0x9')];this[_0x2de8('0xa')]={};this[_0x2de8('0xb')]=0x0;this[_0x2de8('0xc')]='';this[_0x2de8('0xd')]();this[_0x2de8('0xe')]();}ChatQueue[_0x2de8('0xf')][_0x2de8('0xd')]=function(){var _0x1ad82f=this['mapAgentsId'][_0x2de8('0x10')];this[_0x2de8('0xa')]=_['map'](this[_0x2de8('0x9')],'id');this[_0x2de8('0xa')][_0x2de8('0x10')]=_0x1ad82f;};ChatQueue['prototype'][_0x2de8('0xe')]=function(){this[_0x2de8('0x11')]=0x0;this[_0x2de8('0x12')]=0x0;for(var _0x26e051=0x0;_0x26e051=0x0?this[_0x2de8('0x15')]:0x0;var _0x525e6b={'id':this['id'],'available':this[_0x2de8('0x15')],'loggedIn':this[_0x2de8('0x11')],'name':this[_0x2de8('0x6')],'paused':this[_0x2de8('0x12')],'waiting':this[_0x2de8('0xb')]};var _0x3de9a2=md5(JSON[_0x2de8('0x16')](_0x525e6b));if(this[_0x2de8('0xc')]!==_0x3de9a2){this[_0x2de8('0xc')]=_0x3de9a2;io['to'](util['format'](_0x2de8('0x17'),_0x525e6b[_0x2de8('0x6')]))[_0x2de8('0x18')](_0x2de8('0x19'),_0x525e6b);}};module[_0x2de8('0x1a')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 9d76445..d086482 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 _0xd2ab=['faxPause','available','loggedIn','waiting','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','paused','length','online'];(function(_0x5bdc74,_0x23377a){var _0x1e46a3=function(_0x52abc1){while(--_0x52abc1){_0x5bdc74['push'](_0x5bdc74['shift']());}};_0x1e46a3(++_0x23377a);}(_0xd2ab,0x1c9));var _0xbd2a=function(_0x4c13dc,_0x28e2f1){_0x4c13dc=_0x4c13dc-0x0;var _0x32ad5b=_0xd2ab[_0x4c13dc];return _0x32ad5b;};'use strict';var _=require(_0xbd2a('0x0'));var md5=require(_0xbd2a('0x1'));var util=require(_0xbd2a('0x2'));var Redis=require(_0xbd2a('0x3'));var config=require(_0xbd2a('0x4'));config[_0xbd2a('0x5')]=_[_0xbd2a('0x6')](config[_0xbd2a('0x5')],{'host':_0xbd2a('0x7'),'port':0x18eb});var io=require(_0xbd2a('0x8'))(new Redis(config[_0xbd2a('0x5')]));function FaxQueue(_0x515521){this['id']=_0x515521['id']||0x0;this['name']=_0x515521[_0xbd2a('0x9')]||'';this['timeout']=_0x515521[_0xbd2a('0xa')]||0xa;this[_0xbd2a('0xb')]=_0x515521[_0xbd2a('0xb')]||_0xbd2a('0xc');this['Agents']=_0x515521[_0xbd2a('0xd')];this[_0xbd2a('0xe')]={};this['waiting']=0x0;this[_0xbd2a('0x1')]='';this[_0xbd2a('0xf')]();this[_0xbd2a('0x10')]();}FaxQueue[_0xbd2a('0x11')][_0xbd2a('0xf')]=function(){var _0x5edf72=this['mapAgentsId'][_0xbd2a('0x12')];this[_0xbd2a('0xe')]=_[_0xbd2a('0x13')](this[_0xbd2a('0xd')],'id');this[_0xbd2a('0xe')][_0xbd2a('0x12')]=_0x5edf72;};FaxQueue[_0xbd2a('0x11')][_0xbd2a('0x10')]=function(){this['loggedIn']=0x0;this[_0xbd2a('0x14')]=0x0;for(var _0x5af69c=0x0;_0x5af69c=0x0?this[_0xbd2a('0x18')]:0x0;var _0x54773d={'id':this['id'],'available':this['available'],'loggedIn':this[_0xbd2a('0x19')],'name':this[_0xbd2a('0x9')],'paused':this[_0xbd2a('0x14')],'waiting':this[_0xbd2a('0x1a')]};var _0x335399=md5(JSON['stringify'](_0x54773d));if(this[_0xbd2a('0x1')]!==_0x335399){this['md5']=_0x335399;io['to'](util[_0xbd2a('0x1b')](_0xbd2a('0x1c'),_0x54773d['name']))[_0xbd2a('0x1d')](_0xbd2a('0x1e'),_0x54773d);}};module[_0xbd2a('0x1f')]=FaxQueue; \ No newline at end of file +var _0xce1d=['lodash','util','defaults','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','md5','updateRouting','prototype','_rr','updateRealtime','loggedIn','paused','length','online','faxPause','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports'];(function(_0x5216e0,_0x4f8cb9){var _0x5b3f40=function(_0x30c832){while(--_0x30c832){_0x5216e0['push'](_0x5216e0['shift']());}};_0x5b3f40(++_0x4f8cb9);}(_0xce1d,0x134));var _0xdce1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xce1d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdce1('0x0'));var md5=require('md5');var util=require(_0xdce1('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0xdce1('0x2')](config[_0xdce1('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xdce1('0x4'))(new Redis(config[_0xdce1('0x3')]));function FaxQueue(_0xc14a3a){this['id']=_0xc14a3a['id']||0x0;this[_0xdce1('0x5')]=_0xc14a3a['name']||'';this[_0xdce1('0x6')]=_0xc14a3a[_0xdce1('0x6')]||0xa;this[_0xdce1('0x7')]=_0xc14a3a[_0xdce1('0x7')]||_0xdce1('0x8');this[_0xdce1('0x9')]=_0xc14a3a[_0xdce1('0x9')];this[_0xdce1('0xa')]={};this['waiting']=0x0;this[_0xdce1('0xb')]='';this[_0xdce1('0xc')]();this['updateRealtime']();}FaxQueue[_0xdce1('0xd')][_0xdce1('0xc')]=function(){var _0x23485f=this[_0xdce1('0xa')][_0xdce1('0xe')];this[_0xdce1('0xa')]=_['map'](this[_0xdce1('0x9')],'id');this[_0xdce1('0xa')][_0xdce1('0xe')]=_0x23485f;};FaxQueue['prototype'][_0xdce1('0xf')]=function(){this[_0xdce1('0x10')]=0x0;this[_0xdce1('0x11')]=0x0;for(var _0x20c58b=0x0;_0x20c58b=0x0?this['available']:0x0;var _0x2e8d4f={'id':this['id'],'available':this['available'],'loggedIn':this[_0xdce1('0x10')],'name':this[_0xdce1('0x5')],'paused':this[_0xdce1('0x11')],'waiting':this['waiting']};var _0x3260b6=md5(JSON[_0xdce1('0x16')](_0x2e8d4f));if(this[_0xdce1('0xb')]!==_0x3260b6){this[_0xdce1('0xb')]=_0x3260b6;io['to'](util[_0xdce1('0x17')](_0xdce1('0x18'),_0x2e8d4f['name']))[_0xdce1('0x19')](_0xdce1('0x1a'),_0x2e8d4f);}};module[_0xdce1('0x1b')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index f9b018b..b87d7bd 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 _0x734c=['exports','name','Intervals'];(function(_0x12dccf,_0x5d6207){var _0xc4efbf=function(_0x268419){while(--_0x268419){_0x12dccf['push'](_0x12dccf['shift']());}};_0xc4efbf(++_0x5d6207);}(_0x734c,0x11e));var _0xc734=function(_0x1ca285,_0x229461){_0x1ca285=_0x1ca285-0x0;var _0x595e82=_0x734c[_0x1ca285];return _0x595e82;};'use strict';function Interval(_0x498db6){this['id']=_0x498db6['id']||0x0;this[_0xc734('0x0')]=_0x498db6[_0xc734('0x0')]||'';this[_0xc734('0x1')]=_0x498db6[_0xc734('0x1')]||{};}module[_0xc734('0x2')]=Interval; \ No newline at end of file +var _0x67ba=['Intervals','name'];(function(_0x575260,_0x1560a5){var _0x1055e4=function(_0x4dc295){while(--_0x4dc295){_0x575260['push'](_0x575260['shift']());}};_0x1055e4(++_0x1560a5);}(_0x67ba,0xed));var _0xa67b=function(_0x20f115,_0x18b8f0){_0x20f115=_0x20f115-0x0;var _0x491f12=_0x67ba[_0x20f115];return _0x491f12;};'use strict';function Interval(_0x588572){this['id']=_0x588572['id']||0x0;this[_0xa67b('0x0')]=_0x588572[_0xa67b('0x0')]||'';this[_0xa67b('0x1')]=_0x588572[_0xa67b('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 6f9a902..b13a366 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 _0x0972=['waiting','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','length','online','mailPause','paused','available','format','emit','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x0972,0x1de));var _0x2097=function(_0x53c53b,_0x257775){_0x53c53b=_0x53c53b-0x0;var _0x20a2e2=_0x0972[_0x53c53b];return _0x20a2e2;};'use strict';var _=require(_0x2097('0x0'));var md5=require(_0x2097('0x1'));var util=require(_0x2097('0x2'));var Redis=require(_0x2097('0x3'));var config=require(_0x2097('0x4'));config[_0x2097('0x5')]=_[_0x2097('0x6')](config[_0x2097('0x5')],{'host':_0x2097('0x7'),'port':0x18eb});var io=require(_0x2097('0x8'))(new Redis(config['redis']));function MailQueue(_0x2ad2d2){this['id']=_0x2ad2d2['id']||0x0;this[_0x2097('0x9')]=_0x2ad2d2[_0x2097('0x9')]||'';this['timeout']=_0x2ad2d2[_0x2097('0xa')]||0xa;this[_0x2097('0xb')]=_0x2ad2d2[_0x2097('0xb')]||_0x2097('0xc');this[_0x2097('0xd')]=_0x2ad2d2[_0x2097('0xd')];this[_0x2097('0xe')]={};this[_0x2097('0xf')]=0x0;this['md5']='';this[_0x2097('0x10')]();this['updateRealtime']();}MailQueue[_0x2097('0x11')][_0x2097('0x10')]=function(){var _0x546192=this[_0x2097('0xe')][_0x2097('0x12')];this[_0x2097('0xe')]=_[_0x2097('0x13')](this[_0x2097('0xd')],'id');this[_0x2097('0xe')][_0x2097('0x12')]=_0x546192;};MailQueue['prototype'][_0x2097('0x14')]=function(){this[_0x2097('0x15')]=0x0;this['paused']=0x0;for(var _0x3ce6cc=0x0;_0x3ce6cc=0x0?this[_0x2097('0x1a')]:0x0;var _0x1fa5fb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x2097('0x15')],'name':this[_0x2097('0x9')],'paused':this[_0x2097('0x19')],'waiting':this[_0x2097('0xf')]};var _0x38144c=md5(JSON['stringify'](_0x1fa5fb));if(this[_0x2097('0x1')]!==_0x38144c){this[_0x2097('0x1')]=_0x38144c;io['to'](util[_0x2097('0x1b')]('mail:queue:%s',_0x1fa5fb[_0x2097('0x9')]))[_0x2097('0x1c')]('mail_queue:save',_0x1fa5fb);}};module['exports']=MailQueue; \ No newline at end of file +var _0xda62=['mailPause','available','stringify','format','emit','mail_queue:save','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xda62,0x1ec));var _0x2da6=function(_0x21fa62,_0x2ec2ca){_0x21fa62=_0x21fa62-0x0;var _0x49ad15=_0xda62[_0x21fa62];return _0x49ad15;};'use strict';var _=require('lodash');var md5=require(_0x2da6('0x0'));var util=require(_0x2da6('0x1'));var Redis=require(_0x2da6('0x2'));var config=require(_0x2da6('0x3'));config[_0x2da6('0x4')]=_[_0x2da6('0x5')](config['redis'],{'host':_0x2da6('0x6'),'port':0x18eb});var io=require(_0x2da6('0x7'))(new Redis(config[_0x2da6('0x4')]));function MailQueue(_0x32c458){this['id']=_0x32c458['id']||0x0;this['name']=_0x32c458[_0x2da6('0x8')]||'';this['timeout']=_0x32c458[_0x2da6('0x9')]||0xa;this[_0x2da6('0xa')]=_0x32c458['strategy']||'beepall';this['Agents']=_0x32c458[_0x2da6('0xb')];this[_0x2da6('0xc')]={};this['waiting']=0x0;this['md5']='';this[_0x2da6('0xd')]();this[_0x2da6('0xe')]();}MailQueue[_0x2da6('0xf')][_0x2da6('0xd')]=function(){var _0x14cf56=this['mapAgentsId'][_0x2da6('0x10')];this[_0x2da6('0xc')]=_[_0x2da6('0x11')](this[_0x2da6('0xb')],'id');this['mapAgentsId'][_0x2da6('0x10')]=_0x14cf56;};MailQueue[_0x2da6('0xf')][_0x2da6('0xe')]=function(){this[_0x2da6('0x12')]=0x0;this[_0x2da6('0x13')]=0x0;for(var _0x5905cf=0x0;_0x5905cf=0x0?this[_0x2da6('0x16')]:0x0;var _0x1e332f={'id':this['id'],'available':this[_0x2da6('0x16')],'loggedIn':this[_0x2da6('0x12')],'name':this['name'],'paused':this[_0x2da6('0x13')],'waiting':this['waiting']};var _0x241559=md5(JSON[_0x2da6('0x17')](_0x1e332f));if(this['md5']!==_0x241559){this['md5']=_0x241559;io['to'](util[_0x2da6('0x18')]('mail:queue:%s',_0x1e332f[_0x2da6('0x8')]))[_0x2da6('0x19')](_0x2da6('0x1a'),_0x1e332f);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 26b4eac..6b053f0 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['available','stringify','openchannel:queue:%s','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x237546,_0xa81b26){var _0x233e29=function(_0x728aa4){while(--_0x728aa4){_0x237546['push'](_0x237546['shift']());}};_0x233e29(++_0xa81b26);}(_0x1261,0x144));var _0x1126=function(_0x32eb8b,_0x5ac0b5){_0x32eb8b=_0x32eb8b-0x0;var _0x5bc68b=_0x1261[_0x32eb8b];return _0x5bc68b;};'use strict';var _=require('lodash');var md5=require(_0x1126('0x0'));var util=require(_0x1126('0x1'));var Redis=require(_0x1126('0x2'));var config=require(_0x1126('0x3'));config[_0x1126('0x4')]=_[_0x1126('0x5')](config[_0x1126('0x4')],{'host':_0x1126('0x6'),'port':0x18eb});var io=require(_0x1126('0x7'))(new Redis(config[_0x1126('0x4')]));function OpenchannelQueue(_0x5a2189){this['id']=_0x5a2189['id']||0x0;this['name']=_0x5a2189[_0x1126('0x8')]||'';this[_0x1126('0x9')]=_0x5a2189['timeout']||0xa;this[_0x1126('0xa')]=_0x5a2189[_0x1126('0xa')]||_0x1126('0xb');this[_0x1126('0xc')]=_0x5a2189[_0x1126('0xc')];this['mapAgentsId']={};this[_0x1126('0xd')]=0x0;this[_0x1126('0x0')]='';this[_0x1126('0xe')]();this['updateRealtime']();}OpenchannelQueue[_0x1126('0xf')]['updateRouting']=function(){var _0x52ef15=this[_0x1126('0x10')]['_rr'];this[_0x1126('0x10')]=_[_0x1126('0x11')](this[_0x1126('0xc')],'id');this[_0x1126('0x10')][_0x1126('0x12')]=_0x52ef15;};OpenchannelQueue[_0x1126('0xf')][_0x1126('0x13')]=function(){this[_0x1126('0x14')]=0x0;this[_0x1126('0x15')]=0x0;for(var _0x53a8f0=0x0;_0x53a8f0=0x0?this['available']:0x0;var _0x4d2b38={'id':this['id'],'available':this[_0x1126('0x18')],'loggedIn':this[_0x1126('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1126('0xd')]};var _0x58b109=md5(JSON[_0x1126('0x19')](_0x4d2b38));if(this[_0x1126('0x0')]!==_0x58b109){this[_0x1126('0x0')]=_0x58b109;io['to'](util['format'](_0x1126('0x1a'),_0x4d2b38['name']))['emit'](_0x1126('0x1b'),_0x4d2b38);}};module[_0x1126('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x7a54=['exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRealtime','mapAgentsId','_rr','map','Agents','prototype','loggedIn','paused','length','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x7a54,0x106));var _0x47a5=function(_0x5eafce,_0x37ae76){_0x5eafce=_0x5eafce-0x0;var _0x3f2278=_0x7a54[_0x5eafce];return _0x3f2278;};'use strict';var _=require(_0x47a5('0x0'));var md5=require(_0x47a5('0x1'));var util=require(_0x47a5('0x2'));var Redis=require('ioredis');var config=require(_0x47a5('0x3'));config[_0x47a5('0x4')]=_['defaults'](config[_0x47a5('0x4')],{'host':_0x47a5('0x5'),'port':0x18eb});var io=require(_0x47a5('0x6'))(new Redis(config[_0x47a5('0x4')]));function OpenchannelQueue(_0xfdf934){this['id']=_0xfdf934['id']||0x0;this['name']=_0xfdf934[_0x47a5('0x7')]||'';this['timeout']=_0xfdf934[_0x47a5('0x8')]||0xa;this[_0x47a5('0x9')]=_0xfdf934['strategy']||_0x47a5('0xa');this['Agents']=_0xfdf934['Agents'];this['mapAgentsId']={};this[_0x47a5('0xb')]=0x0;this[_0x47a5('0x1')]='';this['updateRouting']();this[_0x47a5('0xc')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x1f47f4=this[_0x47a5('0xd')][_0x47a5('0xe')];this[_0x47a5('0xd')]=_[_0x47a5('0xf')](this[_0x47a5('0x10')],'id');this[_0x47a5('0xd')]['_rr']=_0x1f47f4;};OpenchannelQueue[_0x47a5('0x11')][_0x47a5('0xc')]=function(){this[_0x47a5('0x12')]=0x0;this[_0x47a5('0x13')]=0x0;for(var _0x139f25=0x0;_0x139f25=0x0?this['available']:0x0;var _0x423a81={'id':this['id'],'available':this[_0x47a5('0x16')],'loggedIn':this[_0x47a5('0x12')],'name':this[_0x47a5('0x7')],'paused':this[_0x47a5('0x13')],'waiting':this[_0x47a5('0xb')]};var _0x2763d6=md5(JSON[_0x47a5('0x17')](_0x423a81));if(this[_0x47a5('0x1')]!==_0x2763d6){this['md5']=_0x2763d6;io['to'](util[_0x47a5('0x18')](_0x47a5('0x19'),_0x423a81['name']))[_0x47a5('0x1a')](_0x47a5('0x1b'),_0x423a81);}};module[_0x47a5('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index fb26936..b8178fd 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 _0x919e=['stringify','format','emit','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','loggedIn','length','online','paused','available'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x919e,0x1d7));var _0xe919=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x919e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe919('0x0'));var md5=require(_0xe919('0x1'));var util=require(_0xe919('0x2'));var Redis=require('ioredis');var config=require(_0xe919('0x3'));config['redis']=_['defaults'](config[_0xe919('0x4')],{'host':_0xe919('0x5'),'port':0x18eb});var io=require(_0xe919('0x6'))(new Redis(config[_0xe919('0x4')]));function SmsQueue(_0x2171e9){this['id']=_0x2171e9['id']||0x0;this[_0xe919('0x7')]=_0x2171e9[_0xe919('0x7')]||'';this['timeout']=_0x2171e9[_0xe919('0x8')]||0xa;this[_0xe919('0x9')]=_0x2171e9['strategy']||_0xe919('0xa');this['Agents']=_0x2171e9[_0xe919('0xb')];this[_0xe919('0xc')]={};this[_0xe919('0xd')]=0x0;this['md5']='';this[_0xe919('0xe')]();this[_0xe919('0xf')]();}SmsQueue[_0xe919('0x10')]['updateRouting']=function(){var _0x12098d=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0xe919('0x11')](this[_0xe919('0xb')],'id');this[_0xe919('0xc')]['_rr']=_0x12098d;};SmsQueue['prototype'][_0xe919('0xf')]=function(){this[_0xe919('0x12')]=0x0;this['paused']=0x0;for(var _0x3c09be=0x0;_0x3c09be=0x0?this['available']:0x0;var _0x5250b9={'id':this['id'],'available':this[_0xe919('0x16')],'loggedIn':this[_0xe919('0x12')],'name':this[_0xe919('0x7')],'paused':this[_0xe919('0x15')],'waiting':this['waiting']};var _0x4cc471=md5(JSON[_0xe919('0x17')](_0x5250b9));if(this[_0xe919('0x1')]!==_0x4cc471){this[_0xe919('0x1')]=_0x4cc471;io['to'](util[_0xe919('0x18')]('sms:queue:%s',_0x5250b9[_0xe919('0x7')]))[_0xe919('0x19')]('sms_queue:save',_0x5250b9);}};module['exports']=SmsQueue; \ No newline at end of file +var _0xb43b=['loggedIn','paused','smsPause','available','waiting','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','md5','updateRouting','updateRealtime','prototype','_rr'];(function(_0x3a66e7,_0x2c43d3){var _0x4d60d3=function(_0x4a5a1d){while(--_0x4a5a1d){_0x3a66e7['push'](_0x3a66e7['shift']());}};_0x4d60d3(++_0x2c43d3);}(_0xb43b,0xbf));var _0xbb43=function(_0x2f1dc9,_0x3c0a2b){_0x2f1dc9=_0x2f1dc9-0x0;var _0x366eeb=_0xb43b[_0x2f1dc9];return _0x366eeb;};'use strict';var _=require(_0xbb43('0x0'));var md5=require('md5');var util=require(_0xbb43('0x1'));var Redis=require(_0xbb43('0x2'));var config=require(_0xbb43('0x3'));config[_0xbb43('0x4')]=_[_0xbb43('0x5')](config[_0xbb43('0x4')],{'host':_0xbb43('0x6'),'port':0x18eb});var io=require(_0xbb43('0x7'))(new Redis(config[_0xbb43('0x4')]));function SmsQueue(_0xbe3b56){this['id']=_0xbe3b56['id']||0x0;this[_0xbb43('0x8')]=_0xbe3b56['name']||'';this[_0xbb43('0x9')]=_0xbe3b56['timeout']||0xa;this['strategy']=_0xbe3b56[_0xbb43('0xa')]||_0xbb43('0xb');this[_0xbb43('0xc')]=_0xbe3b56[_0xbb43('0xc')];this[_0xbb43('0xd')]={};this['waiting']=0x0;this[_0xbb43('0xe')]='';this[_0xbb43('0xf')]();this[_0xbb43('0x10')]();}SmsQueue[_0xbb43('0x11')]['updateRouting']=function(){var _0xba4e2=this[_0xbb43('0xd')]['_rr'];this['mapAgentsId']=_['map'](this[_0xbb43('0xc')],'id');this['mapAgentsId'][_0xbb43('0x12')]=_0xba4e2;};SmsQueue['prototype'][_0xbb43('0x10')]=function(){this[_0xbb43('0x13')]=0x0;this[_0xbb43('0x14')]=0x0;for(var _0x3327bc=0x0;_0x3327bc=0x0?this[_0xbb43('0x16')]:0x0;var _0xe15a1b={'id':this['id'],'available':this['available'],'loggedIn':this[_0xbb43('0x13')],'name':this['name'],'paused':this[_0xbb43('0x14')],'waiting':this[_0xbb43('0x17')]};var _0x457a50=md5(JSON[_0xbb43('0x18')](_0xe15a1b));if(this['md5']!==_0x457a50){this[_0xbb43('0xe')]=_0x457a50;io['to'](util[_0xbb43('0x19')](_0xbb43('0x1a'),_0xe15a1b[_0xbb43('0x8')]))[_0xbb43('0x1b')](_0xbb43('0x1c'),_0xe15a1b);}};module[_0xbb43('0x1d')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index b4b0b14..5f3a935 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 _0xec22=['strategy','beepall','Agents','mapAgentsId','_rr','map','prototype','updateRealtime','loggedIn','paused','length','online','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout'];(function(_0x2dbf76,_0x50b1c8){var _0x3f16b4=function(_0x5837f9){while(--_0x5837f9){_0x2dbf76['push'](_0x2dbf76['shift']());}};_0x3f16b4(++_0x50b1c8);}(_0xec22,0x1aa));var _0x2ec2=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xec22[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x2ec2('0x0'));var md5=require(_0x2ec2('0x1'));var util=require(_0x2ec2('0x2'));var Redis=require('ioredis');var config=require(_0x2ec2('0x3'));config['redis']=_['defaults'](config[_0x2ec2('0x4')],{'host':_0x2ec2('0x5'),'port':0x18eb});var io=require(_0x2ec2('0x6'))(new Redis(config[_0x2ec2('0x4')]));function WhatsappQueue(_0x45addc){this['id']=_0x45addc['id']||0x0;this[_0x2ec2('0x7')]=_0x45addc[_0x2ec2('0x7')]||'';this['timeout']=_0x45addc[_0x2ec2('0x8')]||0xa;this[_0x2ec2('0x9')]=_0x45addc['strategy']||_0x2ec2('0xa');this[_0x2ec2('0xb')]=_0x45addc[_0x2ec2('0xb')];this[_0x2ec2('0xc')]={};this['waiting']=0x0;this[_0x2ec2('0x1')]='';this['updateRouting']();this['updateRealtime']();}WhatsappQueue['prototype']['updateRouting']=function(){var _0x380c4f=this[_0x2ec2('0xc')][_0x2ec2('0xd')];this[_0x2ec2('0xc')]=_[_0x2ec2('0xe')](this[_0x2ec2('0xb')],'id');this[_0x2ec2('0xc')][_0x2ec2('0xd')]=_0x380c4f;};WhatsappQueue[_0x2ec2('0xf')][_0x2ec2('0x10')]=function(){this[_0x2ec2('0x11')]=0x0;this[_0x2ec2('0x12')]=0x0;for(var _0x326f0b=0x0;_0x326f0b=0x0?this[_0x2ec2('0x16')]:0x0;var _0x294d0f={'id':this['id'],'available':this[_0x2ec2('0x16')],'loggedIn':this[_0x2ec2('0x11')],'name':this['name'],'paused':this[_0x2ec2('0x12')],'waiting':this['waiting']};var _0x307ba0=md5(JSON[_0x2ec2('0x17')](_0x294d0f));if(this[_0x2ec2('0x1')]!==_0x307ba0){this[_0x2ec2('0x1')]=_0x307ba0;io['to'](util[_0x2ec2('0x18')](_0x2ec2('0x19'),_0x294d0f[_0x2ec2('0x7')]))[_0x2ec2('0x1a')](_0x2ec2('0x1b'),_0x294d0f);}};module[_0x2ec2('0x1c')]=WhatsappQueue; \ No newline at end of file +var _0x33e7=['_rr','map','updateRealtime','loggedIn','paused','length','online','whatsappPause','available','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x33e7,0x14d));var _0x733e=function(_0x48882d,_0x4e1902){_0x48882d=_0x48882d-0x0;var _0x4c9876=_0x33e7[_0x48882d];return _0x4c9876;};'use strict';var _=require(_0x733e('0x0'));var md5=require(_0x733e('0x1'));var util=require(_0x733e('0x2'));var Redis=require('ioredis');var config=require(_0x733e('0x3'));config['redis']=_['defaults'](config[_0x733e('0x4')],{'host':_0x733e('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x733e('0x4')]));function WhatsappQueue(_0x128f0a){this['id']=_0x128f0a['id']||0x0;this[_0x733e('0x6')]=_0x128f0a['name']||'';this[_0x733e('0x7')]=_0x128f0a[_0x733e('0x7')]||0xa;this[_0x733e('0x8')]=_0x128f0a[_0x733e('0x8')]||_0x733e('0x9');this[_0x733e('0xa')]=_0x128f0a['Agents'];this[_0x733e('0xb')]={};this[_0x733e('0xc')]=0x0;this['md5']='';this[_0x733e('0xd')]();this['updateRealtime']();}WhatsappQueue[_0x733e('0xe')][_0x733e('0xd')]=function(){var _0x281d4b=this['mapAgentsId'][_0x733e('0xf')];this['mapAgentsId']=_[_0x733e('0x10')](this[_0x733e('0xa')],'id');this['mapAgentsId'][_0x733e('0xf')]=_0x281d4b;};WhatsappQueue[_0x733e('0xe')][_0x733e('0x11')]=function(){this[_0x733e('0x12')]=0x0;this[_0x733e('0x13')]=0x0;for(var _0x3fe9df=0x0;_0x3fe9df=0x0?this[_0x733e('0x17')]:0x0;var _0x1e2ce9={'id':this['id'],'available':this[_0x733e('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x733e('0x6')],'paused':this[_0x733e('0x13')],'waiting':this[_0x733e('0xc')]};var _0x3da18f=md5(JSON['stringify'](_0x1e2ce9));if(this['md5']!==_0x3da18f){this[_0x733e('0x1')]=_0x3da18f;io['to'](util[_0x733e('0x18')](_0x733e('0x19'),_0x1e2ce9['name']))[_0x733e('0x1a')](_0x733e('0x1b'),_0x1e2ce9);}};module[_0x733e('0x1c')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 19430f8..d6e76ae 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(_0xc44f55,_0x3b4fba){var _0x236c29=function(_0x5c2640){while(--_0x5c2640){_0xc44f55['push'](_0xc44f55['shift']());}};_0x236c29(++_0x3b4fba);}(_0xb10b,0x12a));var _0xbb10=function(_0x5c1ddc,_0x587040){_0x5c1ddc=_0x5c1ddc-0x0;var _0x542a11=_0xb10b[_0x5c1ddc];return _0x542a11;};'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 _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index d7d0bbd..d70ace4 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 _0xf6bd=['../client','update','Request','UpdateChatInteraction','AddTagsToChatInteraction','addTagsToChatInteraction'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xf6bd,0x10e));var _0xdf6b=function(_0x12aaee,_0x5bf50c){_0x12aaee=_0x12aaee-0x0;var _0x37c350=_0xf6bd[_0x12aaee];return _0x37c350;};'use strict';var client=require(_0xdf6b('0x0'));exports[_0xdf6b('0x1')]=function(_0x5c9f2b,_0x5417c0){return client[_0xdf6b('0x2')](_0xdf6b('0x3'),{'body':_0x5417c0,'options':{'where':{'id':_0x5c9f2b}},'log':'updateChatInteraction'});};exports['addTags']=function(_0x34c99f,_0x19978d){return client['Request'](_0xdf6b('0x4'),{'body':_0x19978d,'options':{'where':{'id':_0x34c99f}},'log':_0xdf6b('0x5')});}; \ No newline at end of file +var _0x4adb=['../client','update','Request','UpdateChatInteraction','updateChatInteraction','AddTagsToChatInteraction'];(function(_0x10df18,_0x13338c){var _0x1f9a1d=function(_0x3157f4){while(--_0x3157f4){_0x10df18['push'](_0x10df18['shift']());}};_0x1f9a1d(++_0x13338c);}(_0x4adb,0x1c2));var _0xb4ad=function(_0x4637a7,_0x5defcf){_0x4637a7=_0x4637a7-0x0;var _0x1bdd37=_0x4adb[_0x4637a7];return _0x1bdd37;};'use strict';var client=require(_0xb4ad('0x0'));exports[_0xb4ad('0x1')]=function(_0x500c13,_0x1b002a){return client[_0xb4ad('0x2')](_0xb4ad('0x3'),{'body':_0x1b002a,'options':{'where':{'id':_0x500c13}},'log':_0xb4ad('0x4')});};exports['addTags']=function(_0x50a6c7,_0x26cdcb){return client[_0xb4ad('0x2')](_0xb4ad('0x5'),{'body':_0x26cdcb,'options':{'where':{'id':_0x50a6c7}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 187d6a7..8923fac 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 _0xb826=['create','Request','createChatMessage','../client'];(function(_0x3f88bc,_0xe38cf5){var _0x4df1c4=function(_0x111de1){while(--_0x111de1){_0x3f88bc['push'](_0x3f88bc['shift']());}};_0x4df1c4(++_0xe38cf5);}(_0xb826,0x1ab));var _0x6b82=function(_0x590624,_0x121026){_0x590624=_0x590624-0x0;var _0x4f2beb=_0xb826[_0x590624];return _0x4f2beb;};'use strict';var client=require(_0x6b82('0x0'));exports[_0x6b82('0x1')]=function(_0x599b12){return client[_0x6b82('0x2')]('CreateChatMessage',{'body':_0x599b12,'log':_0x6b82('0x3')});}; \ No newline at end of file +var _0x068e=['CreateChatMessage','createChatMessage','../client','create','Request'];(function(_0x49444c,_0x15cb35){var _0xc0247f=function(_0x2a3f94){while(--_0x2a3f94){_0x49444c['push'](_0x49444c['shift']());}};_0xc0247f(++_0x15cb35);}(_0x068e,0x1d3));var _0xe068=function(_0x256bfe,_0x2a16bc){_0x256bfe=_0x256bfe-0x0;var _0x1e962c=_0x068e[_0x256bfe];return _0x1e962c;};'use strict';var client=require(_0xe068('0x0'));exports[_0xe068('0x1')]=function(_0x1a992a){return client[_0xe068('0x2')](_0xe068('0x3'),{'body':_0x1a992a,'log':_0xe068('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 65c3c83..6fbb707 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 _0x7118=['name','online','chatPause','Request','GetChatQueue','timeout','strategy','User','Agents'];(function(_0x474ed3,_0x15d96d){var _0x5851b1=function(_0x29d005){while(--_0x29d005){_0x474ed3['push'](_0x474ed3['shift']());}};_0x5851b1(++_0x15d96d);}(_0x7118,0x159));var _0x8711=function(_0x169eb5,_0xa19793){_0x169eb5=_0x169eb5-0x0;var _0x25ce90=_0x7118[_0x169eb5];return _0x25ce90;};'use strict';var client=require('../client');exports['getChatQueues']=function(){return function(){return client[_0x8711('0x0')](_0x8711('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x8711('0x2'),_0x8711('0x3')],'include':[{'model':_0x8711('0x4'),'as':_0x8711('0x5'),'attributes':['id',_0x8711('0x6'),_0x8711('0x7'),_0x8711('0x8')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0x1db9=['name','timeout','User','Agents','chatPause','../client','getChatQueues','Request','GetChatQueue'];(function(_0x3ea2bf,_0x5349de){var _0x2bddd4=function(_0x68b95){while(--_0x68b95){_0x3ea2bf['push'](_0x3ea2bf['shift']());}};_0x2bddd4(++_0x5349de);}(_0x1db9,0x176));var _0x91db=function(_0xa6a3f9,_0x25d45e){_0xa6a3f9=_0xa6a3f9-0x0;var _0x1f0692=_0x1db9[_0xa6a3f9];return _0x1f0692;};'use strict';var client=require(_0x91db('0x0'));exports[_0x91db('0x1')]=function(){return function(){return client[_0x91db('0x2')](_0x91db('0x3'),{'options':{'raw':![],'attributes':['id',_0x91db('0x4'),_0x91db('0x5'),'strategy'],'include':[{'model':_0x91db('0x6'),'as':_0x91db('0x7'),'attributes':['id','name','online',_0x91db('0x8')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index e9649c1..dd271d7 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 _0x225c=['Request','UpdateChatQueueReport','DESC','../client','create','CreateChatQueueReport','update'];(function(_0x5c8bbe,_0x5bda35){var _0x2e3aa6=function(_0x46672f){while(--_0x46672f){_0x5c8bbe['push'](_0x5c8bbe['shift']());}};_0x2e3aa6(++_0x5bda35);}(_0x225c,0x106));var _0xc225=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x225c[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xc225('0x0'));exports[_0xc225('0x1')]=function(_0x4882b7){return client['Request'](_0xc225('0x2'),{'body':_0x4882b7,'log':'CreateChatQueueReport'});};exports[_0xc225('0x3')]=function(_0xc96c33,_0x4778ea){return client[_0xc225('0x4')](_0xc225('0x5'),{'body':_0x4778ea,'options':{'where':{'uniqueid':_0xc96c33},'order':[['id',_0xc225('0x6')]],'limit':0x1},'log':_0xc225('0x5')});}; \ No newline at end of file +var _0x2208=['UpdateChatQueueReport','create','Request','CreateChatQueueReport','update'];(function(_0x5c3be2,_0x5bd5d8){var _0x433a97=function(_0x3dc712){while(--_0x3dc712){_0x5c3be2['push'](_0x5c3be2['shift']());}};_0x433a97(++_0x5bd5d8);}(_0x2208,0x11e));var _0x8220=function(_0x3145e2,_0x1287c3){_0x3145e2=_0x3145e2-0x0;var _0x3e7853=_0x2208[_0x3145e2];return _0x3e7853;};'use strict';var client=require('../client');exports[_0x8220('0x0')]=function(_0x5da9d5){return client[_0x8220('0x1')]('CreateChatQueueReport',{'body':_0x5da9d5,'log':_0x8220('0x2')});};exports[_0x8220('0x3')]=function(_0x3d2530,_0x231a4b){return client[_0x8220('0x1')](_0x8220('0x4'),{'body':_0x231a4b,'options':{'where':{'uniqueid':_0x3d2530},'order':[['id','DESC']],'limit':0x1},'log':_0x8220('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 517843a..78ee779 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(_0x425063,_0x53b0b8){var _0x3e8302=function(_0x4f3119){while(--_0x4f3119){_0x425063['push'](_0x425063['shift']());}};_0x3e8302(++_0x53b0b8);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x5986b5,_0x3e5444){var _0x4d8e00=function(_0x228cfc){while(--_0x228cfc){_0x5986b5['push'](_0x5986b5['shift']());}};_0x4d8e00(++_0x3e5444);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 684eef6..7876a2e 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 _0xbcc8=['create','CreateFaxMessage','createFaxMessage'];(function(_0x208481,_0x26d7db){var _0x43fe11=function(_0x179bec){while(--_0x179bec){_0x208481['push'](_0x208481['shift']());}};_0x43fe11(++_0x26d7db);}(_0xbcc8,0xa8));var _0x8bcc=function(_0x3b2369,_0x4c68b9){_0x3b2369=_0x3b2369-0x0;var _0x5a1367=_0xbcc8[_0x3b2369];return _0x5a1367;};'use strict';var client=require('../client');exports[_0x8bcc('0x0')]=function(_0xf3472b){return client['Request'](_0x8bcc('0x1'),{'body':_0xf3472b,'log':_0x8bcc('0x2')});}; \ No newline at end of file +var _0x1cf3=['CreateFaxMessage','createFaxMessage','../client','create','Request'];(function(_0x13b924,_0x5b9e51){var _0xb1266c=function(_0x207127){while(--_0x207127){_0x13b924['push'](_0x13b924['shift']());}};_0xb1266c(++_0x5b9e51);}(_0x1cf3,0x1f1));var _0x31cf=function(_0x110b61,_0x32b994){_0x110b61=_0x110b61-0x0;var _0x24607e=_0x1cf3[_0x110b61];return _0x24607e;};'use strict';var client=require(_0x31cf('0x0'));exports[_0x31cf('0x1')]=function(_0x5e93fe){return client[_0x31cf('0x2')](_0x31cf('0x3'),{'body':_0x5e93fe,'log':_0x31cf('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 2b9eb55..8401b05 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 _0xd273=['Request','timeout','strategy','User','Agents','faxPause','getFaxQueues'];(function(_0x3c5fb9,_0xa9c4ff){var _0x441532=function(_0x30882e){while(--_0x30882e){_0x3c5fb9['push'](_0x3c5fb9['shift']());}};_0x441532(++_0xa9c4ff);}(_0xd273,0x84));var _0x3d27=function(_0xb809d1,_0x1a30b6){_0xb809d1=_0xb809d1-0x0;var _0x49d5f6=_0xd273[_0xb809d1];return _0x49d5f6;};'use strict';var client=require('../client');exports[_0x3d27('0x0')]=function(){return function(){return client[_0x3d27('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id','name',_0x3d27('0x2'),_0x3d27('0x3')],'include':[{'model':_0x3d27('0x4'),'as':_0x3d27('0x5'),'attributes':['id','name','online',_0x3d27('0x6')]}]},'log':_0x3d27('0x0')});};}; \ No newline at end of file +var _0x8433=['name','timeout','strategy','User','Agents','getFaxQueues','Request','GetFaxQueue'];(function(_0x43fe27,_0x5e7031){var _0x460ee1=function(_0x1935a2){while(--_0x1935a2){_0x43fe27['push'](_0x43fe27['shift']());}};_0x460ee1(++_0x5e7031);}(_0x8433,0x175));var _0x3843=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x8433[_0x2b5eae];return _0x5f3ac9;};'use strict';var client=require('../client');exports[_0x3843('0x0')]=function(){return function(){return client[_0x3843('0x1')](_0x3843('0x2'),{'options':{'raw':![],'attributes':['id',_0x3843('0x3'),_0x3843('0x4'),_0x3843('0x5')],'include':[{'model':_0x3843('0x6'),'as':_0x3843('0x7'),'attributes':['id',_0x3843('0x3'),'online','faxPause']}]},'log':_0x3843('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 16950f9..0224033 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 _0x7e4e=['CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client','create','Request'];(function(_0x47e7dd,_0x51b041){var _0x38501f=function(_0x5ba66d){while(--_0x5ba66d){_0x47e7dd['push'](_0x47e7dd['shift']());}};_0x38501f(++_0x51b041);}(_0x7e4e,0x66));var _0xe7e4=function(_0x15f724,_0x2794ef){_0x15f724=_0x15f724-0x0;var _0x49b152=_0x7e4e[_0x15f724];return _0x49b152;};'use strict';var client=require(_0xe7e4('0x0'));exports[_0xe7e4('0x1')]=function(_0x7718a){return client[_0xe7e4('0x2')](_0xe7e4('0x3'),{'body':_0x7718a,'log':_0xe7e4('0x3')});};exports[_0xe7e4('0x4')]=function(_0x4fdcd5,_0x38f8b9){return client[_0xe7e4('0x2')](_0xe7e4('0x5'),{'body':_0x38f8b9,'options':{'where':{'uniqueid':_0x4fdcd5},'order':[['id',_0xe7e4('0x6')]],'limit':0x1},'log':_0xe7e4('0x5')});}; \ No newline at end of file +var _0x3b91=['create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x3b91,0x8b));var _0x13b9=function(_0x1478db,_0x4787cf){_0x1478db=_0x1478db-0x0;var _0x52de95=_0x3b91[_0x1478db];return _0x52de95;};'use strict';var client=require(_0x13b9('0x0'));exports[_0x13b9('0x1')]=function(_0x1e2d4d){return client[_0x13b9('0x2')](_0x13b9('0x3'),{'body':_0x1e2d4d,'log':_0x13b9('0x3')});};exports[_0x13b9('0x4')]=function(_0x1e38cb,_0xb54e0d){return client[_0x13b9('0x2')](_0x13b9('0x5'),{'body':_0xb54e0d,'options':{'where':{'uniqueid':_0x1e38cb},'order':[['id',_0x13b9('0x6')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index e301472..ea1e3e2 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 _0xcd71=['name','Interval','Intervals','interval','../client','getIntervals','Request'];(function(_0x484c03,_0x13c1d2){var _0x294127=function(_0x45a834){while(--_0x45a834){_0x484c03['push'](_0x484c03['shift']());}};_0x294127(++_0x13c1d2);}(_0xcd71,0x1af));var _0x1cd7=function(_0x21057f,_0x4e3b82){_0x21057f=_0x21057f-0x0;var _0x1e2c77=_0xcd71[_0x21057f];return _0x1e2c77;};'use strict';var client=require(_0x1cd7('0x0'));exports[_0x1cd7('0x1')]=function(){return function(){return client[_0x1cd7('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x1cd7('0x3')],'include':[{'model':_0x1cd7('0x4'),'as':_0x1cd7('0x5'),'attributes':['id','name',_0x1cd7('0x6')]}]},'log':_0x1cd7('0x1')});};}; \ No newline at end of file +var _0x6c9e=['interval','../client','getIntervals','GetInterval','Interval','Intervals'];(function(_0x135919,_0x2e6cd5){var _0x1a478f=function(_0x4a6578){while(--_0x4a6578){_0x135919['push'](_0x135919['shift']());}};_0x1a478f(++_0x2e6cd5);}(_0x6c9e,0x127));var _0xe6c9=function(_0x4a8106,_0x3bbc68){_0x4a8106=_0x4a8106-0x0;var _0x35bdc5=_0x6c9e[_0x4a8106];return _0x35bdc5;};'use strict';var client=require(_0xe6c9('0x0'));exports[_0xe6c9('0x1')]=function(){return function(){return client['Request'](_0xe6c9('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xe6c9('0x3'),'as':_0xe6c9('0x4'),'attributes':['id','name',_0xe6c9('0x5')]}]},'log':_0xe6c9('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index c930307..08a002f 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 _0x4cf8=['Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','../client','update'];(function(_0x412871,_0x418447){var _0x328d47=function(_0x25f0fc){while(--_0x25f0fc){_0x412871['push'](_0x412871['shift']());}};_0x328d47(++_0x418447);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x13ec2b,_0x40b664){_0x13ec2b=_0x13ec2b-0x0;var _0x1fb3f4=_0x4cf8[_0x13ec2b];return _0x1fb3f4;};'use strict';var client=require(_0x84cf('0x0'));exports[_0x84cf('0x1')]=function(_0x287eb2,_0x2125ed){return client[_0x84cf('0x2')](_0x84cf('0x3'),{'body':_0x2125ed,'options':{'where':{'id':_0x287eb2}},'log':_0x84cf('0x4')});};exports[_0x84cf('0x5')]=function(_0x3bbbc3,_0x2d38c0){return client[_0x84cf('0x2')](_0x84cf('0x6'),{'body':_0x2d38c0,'options':{'where':{'id':_0x3bbbc3}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x77e6=['addTags','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x438e18,_0x52e2c5){var _0x50c6ea=function(_0x7ae358){while(--_0x7ae358){_0x438e18['push'](_0x438e18['shift']());}};_0x50c6ea(++_0x52e2c5);}(_0x77e6,0x1a6));var _0x677e=function(_0x420111,_0x25e716){_0x420111=_0x420111-0x0;var _0x412b90=_0x77e6[_0x420111];return _0x412b90;};'use strict';var client=require(_0x677e('0x0'));exports[_0x677e('0x1')]=function(_0x3855c7,_0xa48f0c){return client[_0x677e('0x2')](_0x677e('0x3'),{'body':_0xa48f0c,'options':{'where':{'id':_0x3855c7}},'log':_0x677e('0x4')});};exports[_0x677e('0x5')]=function(_0x50231c,_0x2f0307){return client[_0x677e('0x2')]('AddTagsToMailInteraction',{'body':_0x2f0307,'options':{'where':{'id':_0x50231c}},'log':_0x677e('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 158a047..e399e86 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 _0xdde4=['Request','createMailMessage','../client'];(function(_0x23b85e,_0x39b209){var _0x329756=function(_0x3418e1){while(--_0x3418e1){_0x23b85e['push'](_0x23b85e['shift']());}};_0x329756(++_0x39b209);}(_0xdde4,0x80));var _0x4dde=function(_0x196cd4,_0x1f7234){_0x196cd4=_0x196cd4-0x0;var _0x3bb930=_0xdde4[_0x196cd4];return _0x3bb930;};'use strict';var client=require(_0x4dde('0x0'));exports['create']=function(_0x267730){return client[_0x4dde('0x1')]('CreateMailMessage',{'body':_0x267730,'log':_0x4dde('0x2')});}; \ No newline at end of file +var _0xfe71=['../client'];(function(_0x4a96af,_0x4f88f6){var _0x522bec=function(_0x358c19){while(--_0x358c19){_0x4a96af['push'](_0x4a96af['shift']());}};_0x522bec(++_0x4f88f6);}(_0xfe71,0x127));var _0x1fe7=function(_0x1863bc,_0x50bc3d){_0x1863bc=_0x1863bc-0x0;var _0xd65be6=_0xfe71[_0x1863bc];return _0xd65be6;};'use strict';var client=require(_0x1fe7('0x0'));exports['create']=function(_0x4bb052){return client['Request']('CreateMailMessage',{'body':_0x4bb052,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 42dc72a..64dedc0 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 _0xe808=['name','strategy','User','mailPause','getMailQueues','../client','GetMailQueue'];(function(_0x255a8d,_0x12b2c2){var _0x19ceb8=function(_0x2a005d){while(--_0x2a005d){_0x255a8d['push'](_0x255a8d['shift']());}};_0x19ceb8(++_0x12b2c2);}(_0xe808,0xfa));var _0x8e80=function(_0x2a8231,_0x2d6ee7){_0x2a8231=_0x2a8231-0x0;var _0xf11b6d=_0xe808[_0x2a8231];return _0xf11b6d;};'use strict';var client=require(_0x8e80('0x0'));exports['getMailQueues']=function(){return function(){return client['Request'](_0x8e80('0x1'),{'options':{'raw':![],'attributes':['id',_0x8e80('0x2'),'timeout',_0x8e80('0x3')],'include':[{'model':_0x8e80('0x4'),'as':'Agents','attributes':['id',_0x8e80('0x2'),'online',_0x8e80('0x5')]}]},'log':_0x8e80('0x6')});};}; \ No newline at end of file +var _0x1455=['strategy','User','Agents','name','online','mailPause','getMailQueues','../client','Request','GetMailQueue','timeout'];(function(_0x420b8a,_0xc63b13){var _0x769f06=function(_0x4e10e0){while(--_0x4e10e0){_0x420b8a['push'](_0x420b8a['shift']());}};_0x769f06(++_0xc63b13);}(_0x1455,0x17d));var _0x5145=function(_0x36cf26,_0x36b5c6){_0x36cf26=_0x36cf26-0x0;var _0x164354=_0x1455[_0x36cf26];return _0x164354;};'use strict';var client=require(_0x5145('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x5145('0x1')](_0x5145('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x5145('0x3'),_0x5145('0x4')],'include':[{'model':_0x5145('0x5'),'as':_0x5145('0x6'),'attributes':['id',_0x5145('0x7'),_0x5145('0x8'),_0x5145('0x9')]}]},'log':_0x5145('0xa')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 9dc8f37..bab30bd 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 _0xf68d=['update','UpdateMailQueueReport','DESC','../client','create','Request','CreateMailQueueReport'];(function(_0x6acf3b,_0x5e939c){var _0x505545=function(_0x457ad6){while(--_0x457ad6){_0x6acf3b['push'](_0x6acf3b['shift']());}};_0x505545(++_0x5e939c);}(_0xf68d,0x13e));var _0xdf68=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xf68d[_0x550d12];return _0x12103d;};'use strict';var client=require(_0xdf68('0x0'));exports[_0xdf68('0x1')]=function(_0x284e74){return client[_0xdf68('0x2')](_0xdf68('0x3'),{'body':_0x284e74,'log':_0xdf68('0x3')});};exports[_0xdf68('0x4')]=function(_0x1cdbe0,_0x414fb5){return client[_0xdf68('0x2')](_0xdf68('0x5'),{'body':_0x414fb5,'options':{'where':{'uniqueid':_0x1cdbe0},'order':[['id',_0xdf68('0x6')]],'limit':0x1},'log':_0xdf68('0x5')});}; \ No newline at end of file +var _0x1807=['CreateMailQueueReport','update','UpdateMailQueueReport','../client','create','Request'];(function(_0x44cea5,_0x3ff27d){var _0x2724d1=function(_0xe4d448){while(--_0xe4d448){_0x44cea5['push'](_0x44cea5['shift']());}};_0x2724d1(++_0x3ff27d);}(_0x1807,0xff));var _0x7180=function(_0x2a14a5,_0x3783ff){_0x2a14a5=_0x2a14a5-0x0;var _0x4d4da6=_0x1807[_0x2a14a5];return _0x4d4da6;};'use strict';var client=require(_0x7180('0x0'));exports[_0x7180('0x1')]=function(_0x54f7cd){return client[_0x7180('0x2')](_0x7180('0x3'),{'body':_0x54f7cd,'log':_0x7180('0x3')});};exports[_0x7180('0x4')]=function(_0x579269,_0x1a9001){return client[_0x7180('0x2')](_0x7180('0x5'),{'body':_0x1a9001,'options':{'where':{'uniqueid':_0x579269},'order':[['id','DESC']],'limit':0x1},'log':_0x7180('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index cd2851c..e8a8c56 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 _0xec37=['addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction'];(function(_0x4913c8,_0x19320b){var _0x17405b=function(_0x495c9d){while(--_0x495c9d){_0x4913c8['push'](_0x4913c8['shift']());}};_0x17405b(++_0x19320b);}(_0xec37,0xa9));var _0x7ec3=function(_0x671369,_0x433da5){_0x671369=_0x671369-0x0;var _0x33f2b4=_0xec37[_0x671369];return _0x33f2b4;};'use strict';var client=require(_0x7ec3('0x0'));exports[_0x7ec3('0x1')]=function(_0x2fff81,_0x4b94c4){return client[_0x7ec3('0x2')](_0x7ec3('0x3'),{'body':_0x4b94c4,'options':{'where':{'id':_0x2fff81}},'log':_0x7ec3('0x4')});};exports[_0x7ec3('0x5')]=function(_0x813ca6,_0x29e0bb){return client[_0x7ec3('0x2')](_0x7ec3('0x6'),{'body':_0x29e0bb,'options':{'where':{'id':_0x813ca6}},'log':_0x7ec3('0x7')});}; \ No newline at end of file +var _0x37aa=['updateOpenchannelInteraction','addTags','addTagsToChatInteraction','../client','Request'];(function(_0x54a8d3,_0x12b8b7){var _0x5eec0e=function(_0xbc1ade){while(--_0xbc1ade){_0x54a8d3['push'](_0x54a8d3['shift']());}};_0x5eec0e(++_0x12b8b7);}(_0x37aa,0x17f));var _0xa37a=function(_0x1602ef,_0x447aba){_0x1602ef=_0x1602ef-0x0;var _0x5870ee=_0x37aa[_0x1602ef];return _0x5870ee;};'use strict';var client=require(_0xa37a('0x0'));exports['update']=function(_0x592928,_0x4aacef){return client[_0xa37a('0x1')]('UpdateOpenchannelInteraction',{'body':_0x4aacef,'options':{'where':{'id':_0x592928}},'log':_0xa37a('0x2')});};exports[_0xa37a('0x3')]=function(_0x20ccd6,_0x2e666f){return client[_0xa37a('0x1')]('AddTagsToOpenchannelInteraction',{'body':_0x2e666f,'options':{'where':{'id':_0x20ccd6}},'log':_0xa37a('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index aa3850a..cc37d30 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 _0x7f3b=['createOpenchannelMessage','create','Request','CreateOpenchannelMessage'];(function(_0x4904af,_0x4418bc){var _0x2a2f45=function(_0x282c43){while(--_0x282c43){_0x4904af['push'](_0x4904af['shift']());}};_0x2a2f45(++_0x4418bc);}(_0x7f3b,0x129));var _0xb7f3=function(_0x387afe,_0x4b6dcc){_0x387afe=_0x387afe-0x0;var _0x22184b=_0x7f3b[_0x387afe];return _0x22184b;};'use strict';var client=require('../client');exports[_0xb7f3('0x0')]=function(_0x2210d7){return client[_0xb7f3('0x1')](_0xb7f3('0x2'),{'body':_0x2210d7,'log':_0xb7f3('0x3')});}; \ No newline at end of file +var _0x17d1=['create','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x17d1,0x13e));var _0x117d=function(_0xee931,_0x4beeab){_0xee931=_0xee931-0x0;var _0x1d4c7d=_0x17d1[_0xee931];return _0x1d4c7d;};'use strict';var client=require('../client');exports[_0x117d('0x0')]=function(_0x4990e3){return client['Request'](_0x117d('0x1'),{'body':_0x4990e3,'log':_0x117d('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index ecb0685..ddfb87b 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 _0x96ef=['GetOpenchannelQueue','name','timeout','strategy','User','Agents','online','openchannelPause','../client','getOpenchannelQueues'];(function(_0x13f40c,_0x20eab7){var _0x448cb2=function(_0x2413fc){while(--_0x2413fc){_0x13f40c['push'](_0x13f40c['shift']());}};_0x448cb2(++_0x20eab7);}(_0x96ef,0x102));var _0xf96e=function(_0x5bd76e,_0x12f399){_0x5bd76e=_0x5bd76e-0x0;var _0x259c38=_0x96ef[_0x5bd76e];return _0x259c38;};'use strict';var client=require(_0xf96e('0x0'));exports[_0xf96e('0x1')]=function(){return function(){return client['Request'](_0xf96e('0x2'),{'options':{'raw':![],'attributes':['id',_0xf96e('0x3'),_0xf96e('0x4'),_0xf96e('0x5')],'include':[{'model':_0xf96e('0x6'),'as':_0xf96e('0x7'),'attributes':['id',_0xf96e('0x3'),_0xf96e('0x8'),_0xf96e('0x9')]}]},'log':_0xf96e('0x1')});};}; \ No newline at end of file +var _0xf4d4=['Agents','online','openchannelPause','../client','getOpenchannelQueues','Request','name','timeout','strategy','User'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xf4d4,0xf3));var _0x4f4d=function(_0x56c3f1,_0x4ae97b){_0x56c3f1=_0x56c3f1-0x0;var _0x27d3b2=_0xf4d4[_0x56c3f1];return _0x27d3b2;};'use strict';var client=require(_0x4f4d('0x0'));exports[_0x4f4d('0x1')]=function(){return function(){return client[_0x4f4d('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x4f4d('0x3'),_0x4f4d('0x4'),_0x4f4d('0x5')],'include':[{'model':_0x4f4d('0x6'),'as':_0x4f4d('0x7'),'attributes':['id',_0x4f4d('0x3'),_0x4f4d('0x8'),_0x4f4d('0x9')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index fa756b2..de550a8 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 _0x174c=['../client','create','Request','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport'];(function(_0x17cef1,_0x583018){var _0x44bf3f=function(_0x46db41){while(--_0x46db41){_0x17cef1['push'](_0x17cef1['shift']());}};_0x44bf3f(++_0x583018);}(_0x174c,0xf0));var _0xc174=function(_0xf8053,_0x4b5401){_0xf8053=_0xf8053-0x0;var _0x2fe82f=_0x174c[_0xf8053];return _0x2fe82f;};'use strict';var client=require(_0xc174('0x0'));exports[_0xc174('0x1')]=function(_0x426ba5){return client[_0xc174('0x2')](_0xc174('0x3'),{'body':_0x426ba5,'log':'CreateOpenchannelQueueReport'});};exports['update']=function(_0x5f1795,_0x556adb){return client[_0xc174('0x2')]('UpdateOpenchannelQueueReport',{'body':_0x556adb,'options':{'where':{'uniqueid':_0x5f1795},'order':[['id','DESC']],'limit':0x1},'log':_0xc174('0x4')});}; \ No newline at end of file +var _0x61b5=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x61b5,0x17e));var _0x561b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x61b5[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x561b('0x0'));exports[_0x561b('0x1')]=function(_0x55fbb3){return client['Request'](_0x561b('0x2'),{'body':_0x55fbb3,'log':'CreateOpenchannelQueueReport'});};exports[_0x561b('0x3')]=function(_0x3bb5cd,_0x254851){return client['Request'](_0x561b('0x4'),{'body':_0x254851,'options':{'where':{'uniqueid':_0x3bb5cd},'order':[['id',_0x561b('0x5')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index adf5a38..2b9ed74 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 _0x8d97=['updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','update','Request','UpdateSmsInteraction'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8d97,0x82));var _0x78d9=function(_0x33e368,_0x2c721b){_0x33e368=_0x33e368-0x0;var _0x4ea064=_0x8d97[_0x33e368];return _0x4ea064;};'use strict';var client=require('../client');exports[_0x78d9('0x0')]=function(_0x288fbe,_0x54c125){return client[_0x78d9('0x1')](_0x78d9('0x2'),{'body':_0x54c125,'options':{'where':{'id':_0x288fbe}},'log':_0x78d9('0x3')});};exports[_0x78d9('0x4')]=function(_0x1b690f,_0x5f4582){return client[_0x78d9('0x1')](_0x78d9('0x5'),{'body':_0x5f4582,'options':{'where':{'id':_0x1b690f}},'log':_0x78d9('0x6')});}; \ No newline at end of file +var _0x79a8=['Request','updateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x79a8,0x1d0));var _0x879a=function(_0x120da6,_0x15f450){_0x120da6=_0x120da6-0x0;var _0x3d6c07=_0x79a8[_0x120da6];return _0x3d6c07;};'use strict';var client=require(_0x879a('0x0'));exports['update']=function(_0x244704,_0x11da0e){return client[_0x879a('0x1')]('UpdateSmsInteraction',{'body':_0x11da0e,'options':{'where':{'id':_0x244704}},'log':_0x879a('0x2')});};exports['addTags']=function(_0x46ee67,_0x1fe9b2){return client[_0x879a('0x1')](_0x879a('0x3'),{'body':_0x1fe9b2,'options':{'where':{'id':_0x46ee67}},'log':_0x879a('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 68cb4bd..c27ba9f 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 _0x1bb8=['createSmsMessage','../client','create','Request'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x1bb8,0x1e9));var _0x81bb=function(_0x45c324,_0x37702b){_0x45c324=_0x45c324-0x0;var _0x283fa1=_0x1bb8[_0x45c324];return _0x283fa1;};'use strict';var client=require(_0x81bb('0x0'));exports[_0x81bb('0x1')]=function(_0x2c923d){return client[_0x81bb('0x2')]('CreateSmsMessage',{'body':_0x2c923d,'log':_0x81bb('0x3')});}; \ No newline at end of file +var _0xd96b=['create','CreateSmsMessage','../client'];(function(_0x525fc5,_0x26fa34){var _0x136895=function(_0x4f768f){while(--_0x4f768f){_0x525fc5['push'](_0x525fc5['shift']());}};_0x136895(++_0x26fa34);}(_0xd96b,0xb6));var _0xbd96=function(_0x553c0c,_0x38fe72){_0x553c0c=_0x553c0c-0x0;var _0x54aa47=_0xd96b[_0x553c0c];return _0x54aa47;};'use strict';var client=require(_0xbd96('0x0'));exports[_0xbd96('0x1')]=function(_0x1e8102){return client['Request'](_0xbd96('0x2'),{'body':_0x1e8102,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index e491bf9..4aa8bf1 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 _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0xfcba4d,_0x5738f1){var _0x3d0926=function(_0x1d01a3){while(--_0x1d01a3){_0xfcba4d['push'](_0xfcba4d['shift']());}};_0x3d0926(++_0x5738f1);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file +var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0xb3c09d,_0x282b0b){var _0x57dce8=function(_0x4f2b8f){while(--_0x4f2b8f){_0xb3c09d['push'](_0xb3c09d['shift']());}};_0x57dce8(++_0x282b0b);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index fa0afe6..c635b61 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x39f30c,_0x3489b0){var _0x43e521=function(_0x4ab7a0){while(--_0x4ab7a0){_0x39f30c['push'](_0x39f30c['shift']());}};_0x43e521(++_0x3489b0);}(_0x55ca,0x126));var _0xa55c=function(_0x3f369c,_0x1c5793){_0x3f369c=_0x3f369c-0x0;var _0x3f851a=_0x55ca[_0x3f369c];return _0x3f851a;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file +var _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x45d395,_0x1c02ad){var _0x2117fd=function(_0x2f70fd){while(--_0x2f70fd){_0x45d395['push'](_0x45d395['shift']());}};_0x2117fd(++_0x1c02ad);}(_0x9c44,0x178));var _0x49c4=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x9c44[_0x6cf19c];return _0xce14f3;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 50acd7d..4682946 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(_0x36a1d0,_0x571e27){var _0x458a55=function(_0x3c9104){while(--_0x3c9104){_0x36a1d0['push'](_0x36a1d0['shift']());}};_0x458a55(++_0x571e27);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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(_0x196151,_0x428b6e){var _0x5e8b97=function(_0x57b2cc){while(--_0x57b2cc){_0x196151['push'](_0x196151['shift']());}};_0x5e8b97(++_0x428b6e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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 686f3f3..f8af99e 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 _0x5fc3=['../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction'];(function(_0x208505,_0x241a77){var _0x1a985f=function(_0x4a5110){while(--_0x4a5110){_0x208505['push'](_0x208505['shift']());}};_0x1a985f(++_0x241a77);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3474ac,_0x22d0f7){_0x3474ac=_0x3474ac-0x0;var _0x5345ec=_0x5fc3[_0x3474ac];return _0x5345ec;};'use strict';var client=require(_0x35fc('0x0'));exports[_0x35fc('0x1')]=function(_0x5a8343,_0x253d6e){return client[_0x35fc('0x2')](_0x35fc('0x3'),{'body':_0x253d6e,'options':{'where':{'id':_0x5a8343}},'log':_0x35fc('0x4')});};exports[_0x35fc('0x5')]=function(_0x5e75e6,_0x2d1404){return client[_0x35fc('0x2')](_0x35fc('0x6'),{'body':_0x2d1404,'options':{'where':{'id':_0x5e75e6}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x7c1f=['Request','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update'];(function(_0x2d22e4,_0x4e43d5){var _0x4f9f26=function(_0x3b06e3){while(--_0x3b06e3){_0x2d22e4['push'](_0x2d22e4['shift']());}};_0x4f9f26(++_0x4e43d5);}(_0x7c1f,0x194));var _0xf7c1=function(_0x520ede,_0x564686){_0x520ede=_0x520ede-0x0;var _0x4ee220=_0x7c1f[_0x520ede];return _0x4ee220;};'use strict';var client=require(_0xf7c1('0x0'));exports[_0xf7c1('0x1')]=function(_0x44a5f4,_0x4c0c8e){return client[_0xf7c1('0x2')]('UpdateWhatsappInteraction',{'body':_0x4c0c8e,'options':{'where':{'id':_0x44a5f4}},'log':_0xf7c1('0x3')});};exports[_0xf7c1('0x4')]=function(_0x18f5a9,_0x485d8d){return client[_0xf7c1('0x2')](_0xf7c1('0x5'),{'body':_0x485d8d,'options':{'where':{'id':_0x18f5a9}},'log':_0xf7c1('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 0c6a086..ac6b8c9 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 _0xb996=['Request','create'];(function(_0x1b1944,_0x592478){var _0x32612f=function(_0x14dd53){while(--_0x14dd53){_0x1b1944['push'](_0x1b1944['shift']());}};_0x32612f(++_0x592478);}(_0xb996,0x16b));var _0x6b99=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xb996[_0x110c3d];return _0x226d67;};'use strict';var client=require('../client');exports[_0x6b99('0x0')]=function(_0x264127){return client[_0x6b99('0x1')]('CreateWhatsappMessage',{'body':_0x264127,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x5c3f=['create','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x419eee,_0x59e55a){var _0x3bed0c=function(_0x46fb69){while(--_0x46fb69){_0x419eee['push'](_0x419eee['shift']());}};_0x3bed0c(++_0x59e55a);}(_0x5c3f,0xe4));var _0xf5c3=function(_0x35ef4a,_0x2f9912){_0x35ef4a=_0x35ef4a-0x0;var _0x1c1c65=_0x5c3f[_0x35ef4a];return _0x1c1c65;};'use strict';var client=require('../client');exports[_0xf5c3('0x0')]=function(_0x5a69f6){return client['Request'](_0xf5c3('0x1'),{'body':_0x5a69f6,'log':_0xf5c3('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index b8be720..405a4a9 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 _0xab71=['whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','timeout','strategy','User','Agents','name','online'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0xab71,0x161));var _0x1ab7=function(_0xfc406a,_0x4479e1){_0xfc406a=_0xfc406a-0x0;var _0x395473=_0xab71[_0xfc406a];return _0x395473;};'use strict';var client=require(_0x1ab7('0x0'));exports[_0x1ab7('0x1')]=function(){return function(){return client[_0x1ab7('0x2')](_0x1ab7('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x1ab7('0x4'),_0x1ab7('0x5')],'include':[{'model':_0x1ab7('0x6'),'as':_0x1ab7('0x7'),'attributes':['id',_0x1ab7('0x8'),_0x1ab7('0x9'),_0x1ab7('0xa')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x5cac=['whatsappPause','../client','getWhatsappQueues','name','timeout','strategy','Agents'];(function(_0x3bb21a,_0x353b56){var _0x5f3983=function(_0x334b13){while(--_0x334b13){_0x3bb21a['push'](_0x3bb21a['shift']());}};_0x5f3983(++_0x353b56);}(_0x5cac,0xb7));var _0xc5ca=function(_0x15c219,_0x4fd96b){_0x15c219=_0x15c219-0x0;var _0x3770d7=_0x5cac[_0x15c219];return _0x3770d7;};'use strict';var client=require(_0xc5ca('0x0'));exports[_0xc5ca('0x1')]=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xc5ca('0x2'),_0xc5ca('0x3'),_0xc5ca('0x4')],'include':[{'model':'User','as':_0xc5ca('0x5'),'attributes':['id',_0xc5ca('0x2'),'online',_0xc5ca('0x6')]}]},'log':_0xc5ca('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 6367a8f..1fbf578 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 _0x23af=['DESC','../client','create','CreateWhatsappQueueReport','update','Request','UpdateWhatsappQueueReport'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x23af,0x127));var _0xf23a=function(_0x17d8ca,_0x11dd2b){_0x17d8ca=_0x17d8ca-0x0;var _0x3b2e68=_0x23af[_0x17d8ca];return _0x3b2e68;};'use strict';var client=require(_0xf23a('0x0'));exports[_0xf23a('0x1')]=function(_0x3fbfff){return client['Request'](_0xf23a('0x2'),{'body':_0x3fbfff,'log':_0xf23a('0x2')});};exports[_0xf23a('0x3')]=function(_0x441607,_0x169a84){return client[_0xf23a('0x4')](_0xf23a('0x5'),{'body':_0x169a84,'options':{'where':{'uniqueid':_0x441607},'order':[['id',_0xf23a('0x6')]],'limit':0x1},'log':_0xf23a('0x5')});}; \ No newline at end of file +var _0xe602=['update','DESC','UpdateWhatsappQueueReport','../client','create','CreateWhatsappQueueReport'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xe602,0x6f));var _0x2e60=function(_0x387672,_0x2f76cc){_0x387672=_0x387672-0x0;var _0x490891=_0xe602[_0x387672];return _0x490891;};'use strict';var client=require(_0x2e60('0x0'));exports[_0x2e60('0x1')]=function(_0x596d83){return client['Request'](_0x2e60('0x2'),{'body':_0x596d83,'log':_0x2e60('0x2')});};exports[_0x2e60('0x3')]=function(_0x100828,_0x4ed6e2){return client['Request']('UpdateWhatsappQueueReport',{'body':_0x4ed6e2,'options':{'where':{'uniqueid':_0x100828},'order':[['id',_0x2e60('0x4')]],'limit':0x1},'log':_0x2e60('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 000a4d2..9b48fdc 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 _0x8d6d=['message','join','stop','find','timeout','createQueue','atimeout','channel','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','../../../../config/logger','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','name','toLowerCase','length','error','map'];(function(_0x1c880a,_0xeec53a){var _0x26047c=function(_0x2d4f22){while(--_0x2d4f22){_0x1c880a['push'](_0x1c880a['shift']());}};_0x26047c(++_0xeec53a);}(_0x8d6d,0x172));var _0xd8d6=function(_0x468ec0,_0x4e241d){_0x468ec0=_0x468ec0-0x0;var _0x9fb3b2=_0x8d6d[_0x468ec0];return _0x9fb3b2;};'use strict';var schema=require(_0xd8d6('0x0'));var _=require(_0xd8d6('0x1'));var util=require('util');var seqqueue=require('seq-queue');var logger=require(_0xd8d6('0x2'))('routing');var strategy=require(_0xd8d6('0x3'));var queue=schema({'name':{'type':_0xd8d6('0x4'),'required':!![],'message':_0xd8d6('0x5')},'timeout':{'type':_0xd8d6('0x6'),'message':_0xd8d6('0x7')}});function writeLog(_0x45c0f7,_0x53eb9d,_0x549a1e){return logger[_0xd8d6('0x8')](util[_0xd8d6('0x9')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x45c0f7,_0x53eb9d[_0xd8d6('0xa')],_0x549a1e));}function handleFindAgent(_0x2d8cb8){return function(_0x5b6277){return _0x5b6277[_0xd8d6('0xa')][_0xd8d6('0xb')]()===_0x2d8cb8['toLowerCase']();};}exports['consequence']=function(_0x1f6149,_0x556596,_0x484547,_0x5bb9fb){return function(_0x201f52){try{var _0x1f5105={'name':_0x556596[0x0],'timeout':_0x556596[0x1]};var _0x47c488=queue[_0xd8d6('0x0')](_0x1f5105,{'typecast':!![]});if(_0x47c488[_0xd8d6('0xc')]){logger[_0xd8d6('0xd')]('[%s][AGENT]\x20%s',_0x1f6149,_[_0xd8d6('0xe')](_0x47c488,_0xd8d6('0xf'))[_0xd8d6('0x10')](',\x20'));_0x201f52[_0xd8d6('0x11')]();}else{var _0x25f94f=_[_0xd8d6('0x12')](_0x484547['agents'],handleFindAgent(_0x1f5105[_0xd8d6('0xa')]));if(_0x25f94f){var _0x8c963a=(_0x1f5105[_0xd8d6('0x13')]||0xa)*0x3e8;var _0x1ce021,_0x3be569;var _0x167a2b=seqqueue[_0xd8d6('0x14')](_0x8c963a);_0x167a2b['id']=_0x1f6149;_0x167a2b[_0xd8d6('0x15')]=_0x8c963a;_0x167a2b[_0xd8d6('0x16')]=_0x5bb9fb[_0xd8d6('0x16')];writeLog(_0x1f6149,_0x25f94f,util[_0xd8d6('0x9')]('START:%s',_0x8c963a));_0x484547[_0xd8d6('0x17')][_0x1f6149]['on'](_0xd8d6('0x18'),function(){logger[_0xd8d6('0x8')](_0xd8d6('0x19'),_0x1f6149);clearTimeout(_0x3be569);_0x3be569=undefined;_0x167a2b[_0xd8d6('0x1a')]();if(_0x484547['rules'][_0x1f6149]){delete _0x484547[_0xd8d6('0x17')][_0x1f6149];}_0x201f52[_0xd8d6('0x11')]();});_0x484547[_0xd8d6('0x17')][_0x1f6149]['on'](_0xd8d6('0x1b'),function(){if(_0x484547[_0xd8d6('0x17')][_0x1f6149]){delete _0x484547[_0xd8d6('0x17')][_0x1f6149];}});_0x3be569=setTimeout(function(){logger['info'](_0xd8d6('0x1c'),_0x1f6149);clearTimeout(_0x3be569);_0x167a2b['close']();_0x201f52[_0xd8d6('0x1d')]();},_0x8c963a);strategy[_0xd8d6('0x1e')](_0x167a2b,_0x25f94f,_0x484547,_0x5bb9fb);}else{logger[_0xd8d6('0xd')](_0xd8d6('0x1f'),_0x1f6149,_0x1f5105[_0xd8d6('0xa')]);_0x201f52[_0xd8d6('0x11')]();}}}catch(_0x118a02){console[_0xd8d6('0x20')](_0x118a02);logger[_0xd8d6('0xd')](_0xd8d6('0x21'),_0x1f6149,_0x118a02[_0xd8d6('0x22')]);_0x201f52[_0xd8d6('0x11')]();}};}; \ No newline at end of file +var _0x6bba=['seq-queue','routing','./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','consequence','validate','length','[%s][AGENT]\x20%s','map','message','join','agents','createQueue','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','stop','[%s][AGENT]\x20ROUTING\x20END','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','error','[%s][QUEUE]\x20%s','stack','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6bba,0x1a3));var _0xa6bb=function(_0x46d041,_0x4b80db){_0x46d041=_0x46d041-0x0;var _0x294f8a=_0x6bba[_0x46d041];return _0x294f8a;};'use strict';var schema=require('validate');var _=require(_0xa6bb('0x0'));var util=require('util');var seqqueue=require(_0xa6bb('0x1'));var logger=require('../../../../config/logger')(_0xa6bb('0x2'));var strategy=require(_0xa6bb('0x3'));var queue=schema({'name':{'type':_0xa6bb('0x4'),'required':!![],'message':_0xa6bb('0x5')},'timeout':{'type':_0xa6bb('0x6'),'message':_0xa6bb('0x7')}});function writeLog(_0x17e9b2,_0x36825f,_0x1d6768){return logger[_0xa6bb('0x8')](util[_0xa6bb('0x9')](_0xa6bb('0xa'),_0x17e9b2,_0x36825f[_0xa6bb('0xb')],_0x1d6768));}function handleFindAgent(_0x298b10){return function(_0x52f4f4){return _0x52f4f4['name'][_0xa6bb('0xc')]()===_0x298b10[_0xa6bb('0xc')]();};}exports[_0xa6bb('0xd')]=function(_0x488f0c,_0x39ee41,_0x2a241b,_0x521ae0){return function(_0x14c30e){try{var _0x36811={'name':_0x39ee41[0x0],'timeout':_0x39ee41[0x1]};var _0x18ca6e=queue[_0xa6bb('0xe')](_0x36811,{'typecast':!![]});if(_0x18ca6e[_0xa6bb('0xf')]){logger['error'](_0xa6bb('0x10'),_0x488f0c,_[_0xa6bb('0x11')](_0x18ca6e,_0xa6bb('0x12'))[_0xa6bb('0x13')](',\x20'));_0x14c30e['stop']();}else{var _0x29c0d1=_['find'](_0x2a241b[_0xa6bb('0x14')],handleFindAgent(_0x36811[_0xa6bb('0xb')]));if(_0x29c0d1){var _0x386ea4=(_0x36811['timeout']||0xa)*0x3e8;var _0x3deca0,_0x1e1198;var _0x4a12ad=seqqueue[_0xa6bb('0x15')](_0x386ea4);_0x4a12ad['id']=_0x488f0c;_0x4a12ad['atimeout']=_0x386ea4;_0x4a12ad[_0xa6bb('0x16')]=_0x521ae0['channel'];writeLog(_0x488f0c,_0x29c0d1,util['format'](_0xa6bb('0x17'),_0x386ea4));_0x2a241b[_0xa6bb('0x18')][_0x488f0c]['on'](_0xa6bb('0x19'),function(){logger[_0xa6bb('0x8')](_0xa6bb('0x1a'),_0x488f0c);clearTimeout(_0x1e1198);_0x1e1198=undefined;_0x4a12ad[_0xa6bb('0x1b')]();if(_0x2a241b['rules'][_0x488f0c]){delete _0x2a241b[_0xa6bb('0x18')][_0x488f0c];}_0x14c30e[_0xa6bb('0x1c')]();});_0x2a241b[_0xa6bb('0x18')][_0x488f0c]['on']('complete',function(){if(_0x2a241b['rules'][_0x488f0c]){delete _0x2a241b['rules'][_0x488f0c];}});_0x1e1198=setTimeout(function(){logger[_0xa6bb('0x8')](_0xa6bb('0x1d'),_0x488f0c);clearTimeout(_0x1e1198);_0x4a12ad[_0xa6bb('0x1b')]();_0x14c30e['next']();},_0x386ea4);strategy['agent'](_0x4a12ad,_0x29c0d1,_0x2a241b,_0x521ae0);}else{logger['error'](_0xa6bb('0x1e'),_0x488f0c,_0x36811[_0xa6bb('0xb')]);_0x14c30e['stop']();}}}catch(_0x15934b){console[_0xa6bb('0x1f')](_0x15934b);logger[_0xa6bb('0x20')](_0xa6bb('0x21'),_0x488f0c,_0x15934b[_0xa6bb('0x22')]);_0x14c30e['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 b5aa009..48772ba 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 _0x812c=['upperFirst','InteractionId','created','isEmpty','Message','create','then','body','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','toString','message','providerName','amazonlex','dialogState','Failed','lodash','moment','aws-sdk','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','chat','ChatWebsiteId','account'];(function(_0x280072,_0x5b02f1){var _0x4156da=function(_0x4c0c77){while(--_0x4c0c77){_0x280072['push'](_0x280072['shift']());}};_0x4156da(++_0x5b02f1);}(_0x812c,0x16e));var _0xc812=function(_0xff5df6,_0x514e73){_0xff5df6=_0xff5df6-0x0;var _0x2634bb=_0x812c[_0xff5df6];return _0x2634bb;};'use strict';var _=require(_0xc812('0x0'));var moment=require(_0xc812('0x1'));var AWS=require(_0xc812('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0xc812('0x3'));var rpc={'chatMessage':require(_0xc812('0x4')),'openchannelMessage':require(_0xc812('0x5')),'mailMessage':require(_0xc812('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xc812('0x7')),'whatsappMessage':require(_0xc812('0x8'))};exports[_0xc812('0x9')]=function(_0x128814,_0xfabdf3){return function(_0x12a565){try{if(!_['isNil'](this[_0xc812('0xa')][_0xc812('0xb')])){logger[_0xc812('0xc')](_0xc812('0xd'),_0x128814,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x12a565[_0xc812('0xe')]();}var _0x1f0bb2={'ContactId':this[_0xc812('0xf')]['id'],'sentAt':moment()[_0xc812('0x10')](_0xc812('0x11')),'direction':_0xc812('0x12')};if(this['channel']===_0xc812('0x13')||this[_0xc812('0x14')]===_0xc812('0x15')){_0x1f0bb2[_0xc812('0x16')]=this[_0xc812('0xa')][_0xc812('0x16')];}var _0x3aa332=this['channel'];if(_0x3aa332===_0xc812('0x17')){_0x1f0bb2[_0xc812('0x18')]=this[_0xc812('0x19')]['id'];}else{_0x1f0bb2[_[_0xc812('0x1a')](_0x3aa332)+'AccountId']=this[_0xc812('0x19')]['id'];}_0x1f0bb2[_[_0xc812('0x1a')](_0x3aa332)+_0xc812('0x1b')]=this['interaction']['id'];if(this['interaction'][_0xc812('0x1c')]){var _0x3ca42e=_0xfabdf3[0x4];if(!_[_0xc812('0x1d')](_0x3ca42e)){_0x1f0bb2['body']=utils['getMustacheRender'](_0x3ca42e,this);return rpc[_0x3aa332+_0xc812('0x1e')][_0xc812('0x1f')](_0x1f0bb2)[_0xc812('0x20')](function(_0x282652){logger[_0xc812('0xc')](_0xc812('0xd'),_0x128814,_0x1f0bb2[_0xc812('0x21')]);})[_0xc812('0x22')](function(_0x5c901d){logger[_0xc812('0x23')](_0xc812('0xd'),_0x128814,JSON[_0xc812('0x24')](_0x5c901d));})[_0xc812('0x25')](function(){logger['info'](_0xc812('0x26'),_0x128814);_0x12a565[_0xc812('0x27')]();});}else{logger[_0xc812('0xc')](_0xc812('0x28'),_0x128814);_0x12a565['stop']();}}else{var _0x4ba7f9=this;var _0x271490=new AWS[(_0xc812('0x29'))]({'accessKeyId':_0xfabdf3[0x0],'secretAccessKey':_0xfabdf3[0x1],'region':_0xfabdf3[0x2]});var _0x5d3f08={'botAlias':_0xc812('0x2a'),'botName':_0xfabdf3[0x3],'inputText':this['message']['body'],'userId':this[_0xc812('0x14')]+':'+this[_0xc812('0xa')]['id'][_0xc812('0x2b')]()};_0x271490['postText'](_0x5d3f08,function(_0x108bcc,_0x4cc1f5){if(_0x108bcc){logger[_0xc812('0x23')](_0xc812('0xd'),_0x128814,_0x108bcc[_0xc812('0x2c')]);_0x12a565[_0xc812('0xe')]();}else if(_0x4cc1f5&&_0x4cc1f5[_0xc812('0x2c')]){_0x4ba7f9[_0xc812('0x21')]['amazonlex']=_0x4cc1f5;_0x1f0bb2[_0xc812('0x21')]=_0x4cc1f5[_0xc812('0x2c')];_0x1f0bb2[_0xc812('0x2d')]=_0xc812('0x2e');_0x1f0bb2['providerResponse']=JSON[_0xc812('0x24')](_0x4cc1f5);return rpc[_0x3aa332+_0xc812('0x1e')][_0xc812('0x1f')](_0x1f0bb2)[_0xc812('0x20')](function(_0x10deda){logger[_0xc812('0xc')](_0xc812('0xd'),_0x128814,_0x1f0bb2[_0xc812('0x21')]);if(_0x4cc1f5[_0xc812('0x2f')]==_0xc812('0x30')){_0x12a565[_0xc812('0xe')]();}else{_0x12a565[_0xc812('0x27')]();}})['catch'](function(_0x480a16){logger[_0xc812('0x23')](_0xc812('0xd'),_0x128814,JSON['stringify'](_0x480a16));_0x12a565[_0xc812('0xe')]();});}else{_0x12a565[_0xc812('0xe')]();}});}}catch(_0x5e6558){logger[_0xc812('0x23')](_0xc812('0xd'),_0x128814,JSON[_0xc812('0x24')](_0x5e6558));_0x12a565[_0xc812('0x27')]();}};}; \ No newline at end of file +var _0x29c9=['routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','interaction','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','Message','create','info','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','$LATEST','message','toString','amazonlex','providerName','then','body','dialogState','Failed','catch','lodash','moment','aws-sdk','./utils','../../../../config/logger'];(function(_0x26cdf6,_0x968186){var _0x4876f3=function(_0x4ccd71){while(--_0x4ccd71){_0x26cdf6['push'](_0x26cdf6['shift']());}};_0x4876f3(++_0x968186);}(_0x29c9,0xe6));var _0x929c=function(_0x2df15d,_0x8fd49d){_0x2df15d=_0x2df15d-0x0;var _0x15ac30=_0x29c9[_0x2df15d];return _0x15ac30;};'use strict';var _=require(_0x929c('0x0'));var moment=require(_0x929c('0x1'));var AWS=require(_0x929c('0x2'));var utils=require(_0x929c('0x3'));var logger=require(_0x929c('0x4'))(_0x929c('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x929c('0x6')),'mailMessage':require(_0x929c('0x7')),'smsMessage':require(_0x929c('0x8')),'faxMessage':require(_0x929c('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x929c('0xa')]=function(_0x1d38f4,_0xc785db){return function(_0x2808f8){try{if(!_['isNil'](this[_0x929c('0xb')][_0x929c('0xc')])){logger['info'](_0x929c('0xd'),_0x1d38f4,_0x929c('0xe'));return _0x2808f8[_0x929c('0xf')]();}var _0x343414={'ContactId':this[_0x929c('0x10')]['id'],'sentAt':moment()[_0x929c('0x11')](_0x929c('0x12')),'direction':_0x929c('0x13')};if(this['channel']===_0x929c('0x14')||this[_0x929c('0x15')]==='whatsapp'){_0x343414[_0x929c('0x16')]=this[_0x929c('0xb')]['phone'];}var _0x342ab5=this[_0x929c('0x15')];if(_0x342ab5===_0x929c('0x17')){_0x343414[_0x929c('0x18')]=this[_0x929c('0x19')]['id'];}else{_0x343414[_[_0x929c('0x1a')](_0x342ab5)+_0x929c('0x1b')]=this[_0x929c('0x19')]['id'];}_0x343414[_[_0x929c('0x1a')](_0x342ab5)+_0x929c('0x1c')]=this[_0x929c('0xb')]['id'];if(this[_0x929c('0xb')]['created']){var _0x2f4c5e=_0xc785db[0x4];if(!_[_0x929c('0x1d')](_0x2f4c5e)){_0x343414['body']=utils['getMustacheRender'](_0x2f4c5e,this);return rpc[_0x342ab5+_0x929c('0x1e')][_0x929c('0x1f')](_0x343414)['then'](function(_0x3a10bb){logger[_0x929c('0x20')]('[%s][AMAZONLEX]\x20%s',_0x1d38f4,_0x343414['body']);})['catch'](function(_0x56f550){logger[_0x929c('0x21')](_0x929c('0xd'),_0x1d38f4,JSON[_0x929c('0x22')](_0x56f550));})['finally'](function(){logger[_0x929c('0x20')](_0x929c('0x23'),_0x1d38f4);_0x2808f8[_0x929c('0x24')]();});}else{logger[_0x929c('0x20')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x1d38f4);_0x2808f8[_0x929c('0x24')]();}}else{var _0x441407=this;var _0x28c79a=new AWS['LexRuntime']({'accessKeyId':_0xc785db[0x0],'secretAccessKey':_0xc785db[0x1],'region':_0xc785db[0x2]});var _0x2966f8={'botAlias':_0x929c('0x25'),'botName':_0xc785db[0x3],'inputText':this[_0x929c('0x26')]['body'],'userId':this[_0x929c('0x15')]+':'+this[_0x929c('0xb')]['id'][_0x929c('0x27')]()};_0x28c79a['postText'](_0x2966f8,function(_0x4560c6,_0xff9a11){if(_0x4560c6){logger[_0x929c('0x21')](_0x929c('0xd'),_0x1d38f4,_0x4560c6[_0x929c('0x26')]);_0x2808f8['next']();}else if(_0xff9a11&&_0xff9a11['message']){_0x441407['body'][_0x929c('0x28')]=_0xff9a11;_0x343414['body']=_0xff9a11['message'];_0x343414[_0x929c('0x29')]=_0x929c('0x28');_0x343414['providerResponse']=JSON[_0x929c('0x22')](_0xff9a11);return rpc[_0x342ab5+_0x929c('0x1e')]['create'](_0x343414)[_0x929c('0x2a')](function(_0x3135ad){logger[_0x929c('0x20')](_0x929c('0xd'),_0x1d38f4,_0x343414[_0x929c('0x2b')]);if(_0xff9a11[_0x929c('0x2c')]==_0x929c('0x2d')){_0x2808f8[_0x929c('0xf')]();}else{_0x2808f8[_0x929c('0x24')]();}})[_0x929c('0x2e')](function(_0x57a000){logger[_0x929c('0x21')]('[%s][AMAZONLEX]\x20%s',_0x1d38f4,JSON[_0x929c('0x22')](_0x57a000));_0x2808f8['next']();});}else{_0x2808f8['next']();}});}}catch(_0x4ca346){logger['error'](_0x929c('0xd'),_0x1d38f4,JSON[_0x929c('0x22')](_0x4ca346));_0x2808f8[_0x929c('0x24')]();}};}; \ 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 802f6e3..3aa995a 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 _0x11f5=['AccountId','Message','Smtp','service','host','secure','authentication','auth','pass','inReplyTo','messageId',''+_['replace'](_0x284877[_0x511f('0xf')],_0x511f('0x31'),_0x511f('0x32'))+'';_0x284877[_0x511f('0x33')]={'Auto-Submitted':_0x511f('0x34'),'X-Auto-Response-Suppress':_0x511f('0x35'),'Precedence':_0x511f('0x36')};return mailRpc['sendMailMessage'](_0x15eca2,_0x284877)[_0x511f('0x37')](function(_0x57d9c4){logger[_0x511f('0x11')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x7b5360);_0x284877[_0x511f('0x30')]=_0x57d9c4['message'][_0x511f('0x30')];return rpc[_0x5a2334+_0x511f('0x27')][_0x511f('0x38')](_0x284877);})[_0x511f('0x37')](function(_0x496c78){logger['info'](_0x511f('0x12'),_0x7b5360,JSON[_0x511f('0x39')](_0x496c78));})[_0x511f('0x3a')](function(_0x5673a){logger[_0x511f('0x3b')](_0x511f('0x3c'),_0x7b5360,JSON[_0x511f('0x39')](_0x5673a));})[_0x511f('0x3d')](function(){Promise[_0x511f('0x3e')]()['then'](function(){if(_0x492f1a[0x0]!=='2'||_0x2fca78['autoreplyExecuted'])return;return rpc[_0x5a2334+_0x511f('0x3f')]['update'](_0x2fca78['id'],{'autoreplyExecuted':!![]})[_0x511f('0x37')](function(_0xba8d2){logger[_0x511f('0x11')](_0x511f('0x40'),_0x7b5360,JSON[_0x511f('0x39')](_0xba8d2));})[_0x511f('0x3a')](function(_0x149aab){logger[_0x511f('0x3b')](_0x511f('0x41'),_0x7b5360,JSON[_0x511f('0x39')](_0x149aab));});})['then'](function(){_0x295261[_0x511f('0x18')]();});});}else{return rpc[this[_0x511f('0x1f')]+_0x511f('0x27')][_0x511f('0x38')](_0x284877)['then'](function(_0x28500f){logger[_0x511f('0x11')]('[%s][AUTOREPLY]\x20%s',_0x7b5360,_0x284877[_0x511f('0xf')]);})['catch'](function(_0x49c7a0){logger[_0x511f('0x3b')](_0x511f('0x12'),_0x7b5360,JSON[_0x511f('0x39')](_0x49c7a0));})[_0x511f('0x3d')](function(){Promise[_0x511f('0x3e')]()[_0x511f('0x37')](function(){if(_0x492f1a[0x0]!=='2'||_0x2fca78[_0x511f('0x19')])return;return rpc[_0x5a2334+_0x511f('0x3f')][_0x511f('0x42')](_0x2fca78['id'],{'autoreplyExecuted':!![]})[_0x511f('0x37')](function(_0x50c3aa){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x7b5360,JSON[_0x511f('0x39')](_0x50c3aa));})['catch'](function(_0x190fd0){logger[_0x511f('0x3b')](_0x511f('0x41'),_0x7b5360,JSON[_0x511f('0x39')](_0x190fd0));});})['then'](function(){_0x295261[_0x511f('0x18')]();});});}}}catch(_0x13e741){logger[_0x511f('0x3b')](_0x511f('0x12'),_0x7b5360,JSON[_0x511f('0x39')](_0x13e741));_0x295261[_0x511f('0x43')]();}};}; \ No newline at end of file +var _0xe64c=['user','pass','inReplyTo','messageId','html','','replace','';_0x3a5b31[_0xce64('0x3d')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':'All','Precedence':_0xce64('0x3e')};return mailRpc[_0xce64('0x3f')](_0x123224,_0x3a5b31)[_0xce64('0x40')](function(_0x44b824){logger[_0xce64('0x11')](_0xce64('0x41'),_0x2e7467);_0x3a5b31[_0xce64('0x37')]=_0x44b824[_0xce64('0x20')][_0xce64('0x37')];return rpc[_0x17b11a+_0xce64('0x42')][_0xce64('0x43')](_0x3a5b31);})[_0xce64('0x40')](function(_0x39f737){logger[_0xce64('0x11')](_0xce64('0x12'),_0x2e7467,JSON['stringify'](_0x39f737));})[_0xce64('0x44')](function(_0x43b710){logger['error']('[RPC][%s][AUTOREPLY]\x20%s',_0x2e7467,JSON[_0xce64('0x45')](_0x43b710));})[_0xce64('0x46')](function(){Promise['resolve']()[_0xce64('0x40')](function(){if(_0x2fad1a[0x0]!=='2'||_0x26893f[_0xce64('0x19')])return;return rpc[_0x17b11a+_0xce64('0x47')][_0xce64('0x48')](_0x26893f['id'],{'autoreplyExecuted':!![]})[_0xce64('0x40')](function(_0x4b57f2){logger['info'](_0xce64('0x1a'),_0x2e7467,JSON[_0xce64('0x45')](_0x4b57f2));})['catch'](function(_0x3bf9f6){logger['error'](_0xce64('0x49'),_0x2e7467,JSON[_0xce64('0x45')](_0x3bf9f6));});})[_0xce64('0x40')](function(){_0x27e57d[_0xce64('0x14')]();});});}else{return rpc[this[_0xce64('0xe')]+'Message'][_0xce64('0x43')](_0x3a5b31)[_0xce64('0x40')](function(_0x54abc6){logger[_0xce64('0x11')](_0xce64('0x12'),_0x2e7467,_0x3a5b31[_0xce64('0xf')]);})[_0xce64('0x44')](function(_0x4a198b){logger[_0xce64('0x4a')](_0xce64('0x12'),_0x2e7467,JSON[_0xce64('0x45')](_0x4a198b));})['finally'](function(){Promise[_0xce64('0x4b')]()[_0xce64('0x40')](function(){if(_0x2fad1a[0x0]!=='2'||_0x26893f[_0xce64('0x19')])return;return rpc[_0x17b11a+_0xce64('0x47')][_0xce64('0x48')](_0x26893f['id'],{'autoreplyExecuted':!![]})[_0xce64('0x40')](function(_0x1f41c6){logger[_0xce64('0x11')](_0xce64('0x1a'),_0x2e7467,JSON[_0xce64('0x45')](_0x1f41c6));})[_0xce64('0x44')](function(_0x5d984e){logger[_0xce64('0x4a')](_0xce64('0x49'),_0x2e7467,JSON['stringify'](_0x5d984e));});})['then'](function(){_0x27e57d[_0xce64('0x14')]();});});}}}catch(_0x36b004){logger[_0xce64('0x4a')](_0xce64('0x12'),_0x2e7467,JSON['stringify'](_0x36b004));_0x27e57d[_0xce64('0x4c')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 42a683b..ac73158 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4483=['[%s][CLOSE]\x20%s','moment','../../../../config/logger','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','info','[%s][CLOSE]\x20reason\x20%s','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','stringify','finally','stop'];(function(_0x1352f0,_0x4cd565){var _0x1c2a82=function(_0x2a9b63){while(--_0x2a9b63){_0x1352f0['push'](_0x1352f0['shift']());}};_0x1c2a82(++_0x4cd565);}(_0x4483,0x1a3));var _0x3448=function(_0x1316bf,_0x20caa5){_0x1316bf=_0x1316bf-0x0;var _0x2f4d18=_0x4483[_0x1316bf];return _0x2f4d18;};'use strict';var moment=require(_0x3448('0x0'));var logger=require(_0x3448('0x1'))(_0x3448('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x3448('0x3')),'smsInteraction':require(_0x3448('0x4')),'mailInteraction':require(_0x3448('0x5')),'faxInteraction':require(_0x3448('0x6')),'whatsappInteraction':require(_0x3448('0x7'))};exports['consequence']=function(_0xeb5b8,_0x6a89b,_0x1b05db,_0xd3606d){return function(_0x1bb7e5){try{logger[_0x3448('0x8')](_0x3448('0x9'),_0xeb5b8,_0x6a89b[0x0]);var _0x34b926={'closed':0x1,'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0x3448('0xa'),'disposition':_0x6a89b[0x0]};if(rpc[_0xd3606d[_0x3448('0xb')]+_0x3448('0xc')]){rpc[_0xd3606d[_0x3448('0xb')]+_0x3448('0xc')][_0x3448('0xd')](_0xd3606d[_0x3448('0xe')]['id'],_0x34b926)[_0x3448('0xf')](function(_0x39bd9e){logger[_0x3448('0x8')](_0x3448('0x10'),_0xeb5b8,_0xd3606d['interaction']['id']);})['catch'](function(_0x298ae6){logger[_0x3448('0x11')]('[%s][CLOSE]\x20%s',_0xeb5b8,JSON[_0x3448('0x12')](_0x298ae6));})[_0x3448('0x13')](function(){_0x1bb7e5[_0x3448('0x14')]();});}}catch(_0x549306){logger[_0x3448('0x11')](_0x3448('0x15'),_0xeb5b8,JSON['stringify'](_0x549306));_0x1bb7e5[_0x3448('0x14')]();}};}; \ No newline at end of file +var _0x5093=['stringify','finally','stop','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','[%s][CLOSE]\x20%s'];(function(_0x36782c,_0x38c321){var _0xd4e417=function(_0x105817){while(--_0x105817){_0x36782c['push'](_0x36782c['shift']());}};_0xd4e417(++_0x38c321);}(_0x5093,0x193));var _0x3509=function(_0xf35bd4,_0x51ff64){_0xf35bd4=_0xf35bd4-0x0;var _0x47912b=_0x5093[_0xf35bd4];return _0x47912b;};'use strict';var moment=require('moment');var logger=require(_0x3509('0x0'))(_0x3509('0x1'));var rpc={'chatInteraction':require(_0x3509('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x3509('0x3')),'mailInteraction':require(_0x3509('0x4')),'faxInteraction':require(_0x3509('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports['consequence']=function(_0x2b2588,_0x2bd7f3,_0x278e0e,_0x212da0){return function(_0x457cd0){try{logger[_0x3509('0x6')](_0x3509('0x7'),_0x2b2588,_0x2bd7f3[0x0]);var _0xcf872d={'closed':0x1,'closedAt':moment()[_0x3509('0x8')](_0x3509('0x9')),'closeReason':'system','disposition':_0x2bd7f3[0x0]};if(rpc[_0x212da0[_0x3509('0xa')]+_0x3509('0xb')]){rpc[_0x212da0[_0x3509('0xa')]+'Interaction'][_0x3509('0xc')](_0x212da0[_0x3509('0xd')]['id'],_0xcf872d)[_0x3509('0xe')](function(_0x85573a){logger[_0x3509('0x6')](_0x3509('0xf'),_0x2b2588,_0x212da0[_0x3509('0xd')]['id']);})['catch'](function(_0x12ac7e){logger['error'](_0x3509('0x10'),_0x2b2588,JSON[_0x3509('0x11')](_0x12ac7e));})[_0x3509('0x12')](function(){_0x457cd0['stop']();});}}catch(_0x5692ff){logger['error'](_0x3509('0x10'),_0x2b2588,JSON['stringify'](_0x5692ff));_0x457cd0[_0x3509('0x13')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 64201e0..cb70e11 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1b94=['phone','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','isEmpty','Message','create','then','catch','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','body','result','fulfillment','speech','providerName','dialogflow','providerResponse','metadata','endConversation','error','lodash','moment','apiai-promise','md5','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','info','[%s][DIALOGFLOW]\x20%s','next','format','YYYY-MM-DD\x20HH:mm:ss','channel'];(function(_0x393115,_0x2fe4f1){var _0x46adfa=function(_0x2679ed){while(--_0x2679ed){_0x393115['push'](_0x393115['shift']());}};_0x46adfa(++_0x2fe4f1);}(_0x1b94,0x1f2));var _0x41b9=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x1b94[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x41b9('0x0'));var moment=require(_0x41b9('0x1'));var apiai=require(_0x41b9('0x2'));var md5=require(_0x41b9('0x3'));var utils=require(_0x41b9('0x4'));var logger=require('../../../../config/logger')(_0x41b9('0x5'));var rpc={'chatMessage':require(_0x41b9('0x6')),'openchannelMessage':require(_0x41b9('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x41b9('0x8')),'faxMessage':require(_0x41b9('0x9')),'whatsappMessage':require(_0x41b9('0xa'))};exports['consequence']=function(_0x310fd8,_0x3e9325){return function(_0x2a0eed){try{if(!_[_0x41b9('0xb')](this[_0x41b9('0xc')]['UserId'])){logger[_0x41b9('0xd')](_0x41b9('0xe'),_0x310fd8,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x2a0eed[_0x41b9('0xf')]();}var _0x386807={'ContactId':this['contact']['id'],'sentAt':moment()[_0x41b9('0x10')](_0x41b9('0x11')),'direction':'out'};if(this[_0x41b9('0x12')]==='sms'||this[_0x41b9('0x12')]==='whatsapp'){_0x386807[_0x41b9('0x13')]=this[_0x41b9('0xc')][_0x41b9('0x13')];}var _0x1b33c7=this[_0x41b9('0x12')];if(_0x1b33c7==='chat'){_0x386807[_0x41b9('0x14')]=this[_0x41b9('0x15')]['id'];}else{_0x386807[_['upperFirst'](_0x1b33c7)+_0x41b9('0x16')]=this[_0x41b9('0x15')]['id'];}_0x386807[_[_0x41b9('0x17')](_0x1b33c7)+_0x41b9('0x18')]=this['interaction']['id'];if(this['interaction']['created']){var _0x2d7bf0=_0x3e9325[0x2];if(!_[_0x41b9('0x19')](_0x2d7bf0)){_0x386807['body']=utils['getMustacheRender'](_0x2d7bf0,this);return rpc[_0x1b33c7+_0x41b9('0x1a')][_0x41b9('0x1b')](_0x386807)[_0x41b9('0x1c')](function(_0x3ba9f3){logger[_0x41b9('0xd')](_0x41b9('0xe'),_0x310fd8,_0x386807['body']);})[_0x41b9('0x1d')](function(_0x12cab8){logger['error'](_0x41b9('0xe'),_0x310fd8,JSON[_0x41b9('0x1e')](_0x12cab8));})[_0x41b9('0x1f')](function(){logger[_0x41b9('0xd')](_0x41b9('0x20'),_0x310fd8);_0x2a0eed[_0x41b9('0x21')]();});}else{logger['info'](_0x41b9('0x22'),_0x310fd8);_0x2a0eed['stop']();}}else{var _0x319452=this;var _0x14dc16=apiai(_0x3e9325[0x0],{'language':_0x3e9325[0x1]||'en'});return _0x14dc16[_0x41b9('0x23')](this[_0x41b9('0x24')][_0x41b9('0x25')],{'sessionId':md5(this['interaction']['id'])})[_0x41b9('0x1c')](function(_0x50e26b){_0x319452['body']['dialogflow']=_0x50e26b;_0x386807[_0x41b9('0x25')]=_0x50e26b[_0x41b9('0x26')][_0x41b9('0x27')][_0x41b9('0x28')];_0x386807[_0x41b9('0x29')]=_0x41b9('0x2a');_0x386807[_0x41b9('0x2b')]=JSON[_0x41b9('0x1e')](_0x50e26b);return rpc[_0x1b33c7+_0x41b9('0x1a')]['create'](_0x386807)['then'](function(_0x1a3aee){logger[_0x41b9('0xd')](_0x41b9('0xe'),_0x310fd8,_0x386807[_0x41b9('0x25')]);if(_0x50e26b[_0x41b9('0x26')][_0x41b9('0x2c')][_0x41b9('0x2d')]){_0x2a0eed[_0x41b9('0xf')]();}else{_0x2a0eed['stop']();}})['catch'](function(_0x1ae013){logger['error'](_0x41b9('0xe'),_0x310fd8,JSON['stringify'](_0x1ae013));_0x2a0eed[_0x41b9('0xf')]();});})[_0x41b9('0x1d')](function(_0x4be093){logger['error'](_0x41b9('0xe'),_0x310fd8,_0x4be093[_0x41b9('0x24')]);_0x2a0eed['next']();});}}catch(_0x18c95b){logger[_0x41b9('0x2e')]('[%s][DIALOGFLOW]\x20%s',_0x310fd8,JSON[_0x41b9('0x1e')](_0x18c95b));_0x2a0eed['stop']();}};}; \ No newline at end of file +var _0x908e=['format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','interaction','isEmpty','body','getMustacheRender','Message','then','info','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','fulfillment','speech','providerResponse','create','result','endConversation','next','catch','error','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact'];(function(_0x37d0bc,_0x109b96){var _0x170e60=function(_0xae2ad){while(--_0xae2ad){_0x37d0bc['push'](_0x37d0bc['shift']());}};_0x170e60(++_0x109b96);}(_0x908e,0x182));var _0xe908=function(_0xd02155,_0x44db05){_0xd02155=_0xd02155-0x0;var _0x51e412=_0x908e[_0xd02155];return _0x51e412;};'use strict';var _=require(_0xe908('0x0'));var moment=require(_0xe908('0x1'));var apiai=require('apiai-promise');var md5=require('md5');var utils=require(_0xe908('0x2'));var logger=require(_0xe908('0x3'))(_0xe908('0x4'));var rpc={'chatMessage':require(_0xe908('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xe908('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xe908('0x7'))};exports[_0xe908('0x8')]=function(_0x2df114,_0x1f6cd2){return function(_0x7a1fdd){try{if(!_[_0xe908('0x9')](this['interaction'][_0xe908('0xa')])){logger['info'](_0xe908('0xb'),_0x2df114,_0xe908('0xc'));return _0x7a1fdd['next']();}var _0x4c0846={'ContactId':this[_0xe908('0xd')]['id'],'sentAt':moment()[_0xe908('0xe')](_0xe908('0xf')),'direction':_0xe908('0x10')};if(this[_0xe908('0x11')]===_0xe908('0x12')||this[_0xe908('0x11')]===_0xe908('0x13')){_0x4c0846['phone']=this['interaction'][_0xe908('0x14')];}var _0x57428c=this[_0xe908('0x11')];if(_0x57428c===_0xe908('0x15')){_0x4c0846[_0xe908('0x16')]=this[_0xe908('0x17')]['id'];}else{_0x4c0846[_[_0xe908('0x18')](_0x57428c)+'AccountId']=this[_0xe908('0x17')]['id'];}_0x4c0846[_[_0xe908('0x18')](_0x57428c)+_0xe908('0x19')]=this[_0xe908('0x1a')]['id'];if(this['interaction']['created']){var _0x4e0729=_0x1f6cd2[0x2];if(!_[_0xe908('0x1b')](_0x4e0729)){_0x4c0846[_0xe908('0x1c')]=utils[_0xe908('0x1d')](_0x4e0729,this);return rpc[_0x57428c+_0xe908('0x1e')]['create'](_0x4c0846)[_0xe908('0x1f')](function(_0x28b2a1){logger[_0xe908('0x20')](_0xe908('0xb'),_0x2df114,_0x4c0846[_0xe908('0x1c')]);})['catch'](function(_0x137b1c){logger['error'](_0xe908('0xb'),_0x2df114,JSON[_0xe908('0x21')](_0x137b1c));})[_0xe908('0x22')](function(){logger[_0xe908('0x20')](_0xe908('0x23'),_0x2df114);_0x7a1fdd[_0xe908('0x24')]();});}else{logger[_0xe908('0x20')](_0xe908('0x25'),_0x2df114);_0x7a1fdd[_0xe908('0x24')]();}}else{var _0x376184=this;var _0x36c79f=apiai(_0x1f6cd2[0x0],{'language':_0x1f6cd2[0x1]||'en'});return _0x36c79f[_0xe908('0x26')](this[_0xe908('0x27')][_0xe908('0x1c')],{'sessionId':md5(this[_0xe908('0x1a')]['id'])})['then'](function(_0x48eb99){_0x376184[_0xe908('0x1c')][_0xe908('0x28')]=_0x48eb99;_0x4c0846[_0xe908('0x1c')]=_0x48eb99['result'][_0xe908('0x29')][_0xe908('0x2a')];_0x4c0846['providerName']=_0xe908('0x28');_0x4c0846[_0xe908('0x2b')]=JSON[_0xe908('0x21')](_0x48eb99);return rpc[_0x57428c+_0xe908('0x1e')][_0xe908('0x2c')](_0x4c0846)['then'](function(_0x154d4a){logger[_0xe908('0x20')](_0xe908('0xb'),_0x2df114,_0x4c0846[_0xe908('0x1c')]);if(_0x48eb99[_0xe908('0x2d')]['metadata'][_0xe908('0x2e')]){_0x7a1fdd[_0xe908('0x2f')]();}else{_0x7a1fdd[_0xe908('0x24')]();}})[_0xe908('0x30')](function(_0x8a13cb){logger[_0xe908('0x31')](_0xe908('0xb'),_0x2df114,JSON[_0xe908('0x21')](_0x8a13cb));_0x7a1fdd['next']();});})[_0xe908('0x30')](function(_0x99fd59){logger[_0xe908('0x31')](_0xe908('0xb'),_0x2df114,_0x99fd59[_0xe908('0x27')]);_0x7a1fdd[_0xe908('0x2f')]();});}}catch(_0x2584e4){logger[_0xe908('0x31')](_0xe908('0xb'),_0x2df114,JSON['stringify'](_0x2584e4));_0x7a1fdd[_0xe908('0x24')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 1f2643d..2ddc208 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x66cd=['DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','intentDetectionConfidence','providerName','dialogflowV2','fulfillmentText','push','all','next','lodash','dialogflow','md5','moment','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','then','info','catch','error','stringify','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','chat','account','upperFirst','InteractionId','isEmpty','getMustacheRender','[%s][DIALOGFLOWV2]\x20%s','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','replace','SessionsClient','sessionPath','message','detectIntent','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x66cd,0xa4));var _0xd66c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x66cd[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xd66c('0x0'));var dialogflow=require(_0xd66c('0x1'));var md5=require(_0xd66c('0x2'));var moment=require(_0xd66c('0x3'));var Promise=require('bluebird');var logger=require(_0xd66c('0x4'))(_0xd66c('0x5'));var utils=require(_0xd66c('0x6'));var rpc={'chatMessage':require(_0xd66c('0x7')),'openchannelMessage':require(_0xd66c('0x8')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xd66c('0x9')),'faxMessage':require(_0xd66c('0xa')),'whatsappMessage':require(_0xd66c('0xb'))};function createMessage(_0x528f64,_0x43d66d,_0x4d47fa,_0x2cfaaa){return new Promise(function(_0x5c09b9,_0x4eb2dd){var _0x38ec16=_[_0xd66c('0xc')](_0x4d47fa);_0x38ec16[_0xd66c('0xd')]=_0x2cfaaa;return rpc[_0x43d66d+_0xd66c('0xe')]['create'](_0x38ec16)[_0xd66c('0xf')](function(){logger[_0xd66c('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x528f64,_0x38ec16['body']);_0x5c09b9();})[_0xd66c('0x11')](function(_0x3c81c1){logger[_0xd66c('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x528f64,JSON[_0xd66c('0x13')](_0x3c81c1));_0x4eb2dd(_0x3c81c1);});});}exports['consequence']=function(_0x5bb143,_0x321fa6){return function(_0x85a281){try{if(!_['isNil'](this[_0xd66c('0x14')][_0xd66c('0x15')])){logger[_0xd66c('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x5bb143,_0xd66c('0x16'));return _0x85a281['next']();}var _0x528ea3={'ContactId':this[_0xd66c('0x17')]['id'],'sentAt':moment()[_0xd66c('0x18')](_0xd66c('0x19')),'direction':_0xd66c('0x1a')};if(this[_0xd66c('0x1b')]===_0xd66c('0x1c')||this['channel']==='whatsapp'){_0x528ea3[_0xd66c('0x1d')]=this[_0xd66c('0x14')][_0xd66c('0x1d')];}var _0x3dfb49=this[_0xd66c('0x1b')];if(_0x3dfb49===_0xd66c('0x1e')){_0x528ea3['ChatWebsiteId']=this[_0xd66c('0x1f')]['id'];}else{_0x528ea3[_[_0xd66c('0x20')](_0x3dfb49)+'AccountId']=this[_0xd66c('0x1f')]['id'];}_0x528ea3[_[_0xd66c('0x20')](_0x3dfb49)+_0xd66c('0x21')]=this[_0xd66c('0x14')]['id'];if(this[_0xd66c('0x14')]['created']){var _0x5d7718=_0x321fa6[0x4];if(!_[_0xd66c('0x22')](_0x5d7718)){_0x528ea3['body']=utils[_0xd66c('0x23')](_0x5d7718,this);return rpc[_0x3dfb49+_0xd66c('0xe')]['create'](_0x528ea3)['then'](function(_0x486a9a){logger[_0xd66c('0x10')](_0xd66c('0x24'),_0x5bb143,_0x528ea3['body']);})[_0xd66c('0x11')](function(_0x46f6c5){logger['error'](_0xd66c('0x24'),_0x5bb143,JSON[_0xd66c('0x13')](_0x46f6c5));})[_0xd66c('0x25')](function(){logger['info'](_0xd66c('0x26'),_0x5bb143);_0x85a281['stop']();});}else{logger['info'](_0xd66c('0x27'),_0x5bb143);_0x85a281[_0xd66c('0x28')]();}}else{var _0x15ad83=this;var _0x1dc01d=_0x321fa6[0x2][_0xd66c('0x29')](/\\n/g,'\x0a');var _0x464f2c={'credentials':{'private_key':_0x1dc01d,'client_email':_0x321fa6[0x1]}};var _0x410086=new dialogflow[(_0xd66c('0x2a'))](_0x464f2c);var _0x5de70d=_0x410086[_0xd66c('0x2b')](_0x321fa6[0x0],md5(_0x15ad83[_0xd66c('0x14')]['id']));var _0x370ccf={'session':_0x5de70d,'queryInput':{'text':{'text':_0x15ad83[_0xd66c('0x2c')][_0xd66c('0xd')],'languageCode':_0x321fa6[0x3]||'en'}}};return _0x410086[_0xd66c('0x2d')](_0x370ccf)['then'](function(_0x33d610){if(_0x33d610&&_0x33d610['length']){_0x15ad83['body']['dialogflowV2']=_0x33d610;var _0x4e7be0=_0x33d610[0x0];var _0x47c1b1=_0x4e7be0[_0xd66c('0x2e')][_0xd66c('0x2f')]&&_0x4e7be0[_0xd66c('0x2e')][_0xd66c('0x2f')][_0xd66c('0x30')]?_0x4e7be0[_0xd66c('0x2e')]['diagnosticInfo']['fields'][_0xd66c('0x31')][_0xd66c('0x32')]:![];_0x15ad83[_0xd66c('0xd')][_0xd66c('0x33')]=_0x4e7be0[_0xd66c('0x2e')][_0xd66c('0x34')];_0x15ad83[_0xd66c('0xd')][_0xd66c('0x35')]=_0x4e7be0[_0xd66c('0x2e')][_0xd66c('0x36')];_0x15ad83['body'][_0xd66c('0x37')]=_0x4e7be0[_0xd66c('0x2e')][_0xd66c('0x2f')]&&_0x4e7be0[_0xd66c('0x2e')][_0xd66c('0x2f')]['fields']?_0x4e7be0['queryResult'][_0xd66c('0x2f')][_0xd66c('0x30')][_0xd66c('0x31')]['boolValue']:![];_0x15ad83[_0xd66c('0xd')][_0xd66c('0x38')]=_0x4e7be0[_0xd66c('0x2e')][_0xd66c('0x39')][_0xd66c('0x3a')];_0x15ad83['body'][_0xd66c('0x3b')]=_0x4e7be0[_0xd66c('0x2e')]['intent'][_0xd66c('0x3c')];_0x15ad83[_0xd66c('0xd')][_0xd66c('0x3d')]=_0x4e7be0[_0xd66c('0x2e')]['intent'][_0xd66c('0x3e')];_0x15ad83[_0xd66c('0xd')][_0xd66c('0x3f')]=_0x4e7be0[_0xd66c('0x2e')][_0xd66c('0x40')];_0x15ad83['body'][_0xd66c('0x41')]=_0x4e7be0[_0xd66c('0x2e')]['queryText'];_0x15ad83['body']['DIALOGFLOWV2_SCORE']=_0x4e7be0[_0xd66c('0x2e')][_0xd66c('0x42')];_0x528ea3[_0xd66c('0x43')]=_0xd66c('0x44');_0x528ea3['providerResponse']=JSON[_0xd66c('0x13')](_0x33d610);var _0x3e0177=[];for(var _0x555c4e=0x0;_0x555c4e<_0x33d610['length'];_0x555c4e++){var _0x44e91b=_0x33d610[_0x555c4e];if(_0x44e91b&&_0x44e91b['queryResult']&&_0x44e91b[_0xd66c('0x2e')][_0xd66c('0x45')]){_0x3e0177[_0xd66c('0x46')](createMessage(_0x5bb143,_0x3dfb49,_0x528ea3,_0x44e91b['queryResult'][_0xd66c('0x45')]));}}return Promise[_0xd66c('0x47')](_0x3e0177)[_0xd66c('0xf')](function(){if(_0x47c1b1){_0x85a281['next']();}else{_0x85a281['stop']();}})[_0xd66c('0x11')](function(_0x7eaaaa){logger[_0xd66c('0x12')](_0xd66c('0x24'),_0x5bb143,JSON[_0xd66c('0x13')](_0x7eaaaa));_0x85a281[_0xd66c('0x48')]();});}})[_0xd66c('0x11')](function(_0x2641a5){logger[_0xd66c('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x5bb143,_0x2641a5[_0xd66c('0x2c')]);_0x85a281[_0xd66c('0x48')]();});}}catch(_0x41879b){logger['error'](_0xd66c('0x24'),_0x5bb143,JSON[_0xd66c('0x13')](_0x41879b));_0x85a281[_0xd66c('0x28')]();}};}; \ No newline at end of file +var _0x8fd3=['then','catch','error','[%s][DIALOGFLOWV2]\x20%s','stringify','isNil','interaction','UserId','info','contact','format','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','account','created','isEmpty','finally','stop','replace','SessionsClient','sessionPath','message','length','queryResult','diagnosticInfo','fields','end_conversation','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_ENDCONVERSATION','boolValue','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','dialogflowV2','providerResponse','fulfillmentText','push','all','next','dialogflow','md5','moment','./utils','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create'];(function(_0x4f21cd,_0x30f06f){var _0x1af331=function(_0x51145e){while(--_0x51145e){_0x4f21cd['push'](_0x4f21cd['shift']());}};_0x1af331(++_0x30f06f);}(_0x8fd3,0x1d7));var _0x38fd=function(_0x1650b8,_0x472af8){_0x1650b8=_0x1650b8-0x0;var _0x17c356=_0x8fd3[_0x1650b8];return _0x17c356;};'use strict';var _=require('lodash');var dialogflow=require(_0x38fd('0x0'));var md5=require(_0x38fd('0x1'));var moment=require(_0x38fd('0x2'));var Promise=require('bluebird');var logger=require('../../../../config/logger')('routing');var utils=require(_0x38fd('0x3'));var rpc={'chatMessage':require(_0x38fd('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x38fd('0x5')),'faxMessage':require(_0x38fd('0x6')),'whatsappMessage':require(_0x38fd('0x7'))};function createMessage(_0x4281f5,_0xc405f0,_0x3a668d,_0x212baa){return new Promise(function(_0x166cda,_0x548d99){var _0x146512=_[_0x38fd('0x8')](_0x3a668d);_0x146512[_0x38fd('0x9')]=_0x212baa;return rpc[_0xc405f0+_0x38fd('0xa')][_0x38fd('0xb')](_0x146512)[_0x38fd('0xc')](function(){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x4281f5,_0x146512[_0x38fd('0x9')]);_0x166cda();})[_0x38fd('0xd')](function(_0x53ab80){logger[_0x38fd('0xe')](_0x38fd('0xf'),_0x4281f5,JSON[_0x38fd('0x10')](_0x53ab80));_0x548d99(_0x53ab80);});});}exports['consequence']=function(_0x4a3ae9,_0x2b80ec){return function(_0x23e2a9){try{if(!_[_0x38fd('0x11')](this[_0x38fd('0x12')][_0x38fd('0x13')])){logger[_0x38fd('0x14')](_0x38fd('0xf'),_0x4a3ae9,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x23e2a9['next']();}var _0x4c91b6={'ContactId':this[_0x38fd('0x15')]['id'],'sentAt':moment()[_0x38fd('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x38fd('0x17')};if(this[_0x38fd('0x18')]===_0x38fd('0x19')||this[_0x38fd('0x18')]===_0x38fd('0x1a')){_0x4c91b6[_0x38fd('0x1b')]=this[_0x38fd('0x12')]['phone'];}var _0x5d58ee=this[_0x38fd('0x18')];if(_0x5d58ee===_0x38fd('0x1c')){_0x4c91b6[_0x38fd('0x1d')]=this['account']['id'];}else{_0x4c91b6[_[_0x38fd('0x1e')](_0x5d58ee)+_0x38fd('0x1f')]=this[_0x38fd('0x20')]['id'];}_0x4c91b6[_[_0x38fd('0x1e')](_0x5d58ee)+'InteractionId']=this[_0x38fd('0x12')]['id'];if(this[_0x38fd('0x12')][_0x38fd('0x21')]){var _0x3812cd=_0x2b80ec[0x4];if(!_[_0x38fd('0x22')](_0x3812cd)){_0x4c91b6[_0x38fd('0x9')]=utils['getMustacheRender'](_0x3812cd,this);return rpc[_0x5d58ee+_0x38fd('0xa')]['create'](_0x4c91b6)[_0x38fd('0xc')](function(_0x3cb2ae){logger['info'](_0x38fd('0xf'),_0x4a3ae9,_0x4c91b6[_0x38fd('0x9')]);})[_0x38fd('0xd')](function(_0x187335){logger[_0x38fd('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x4a3ae9,JSON[_0x38fd('0x10')](_0x187335));})[_0x38fd('0x23')](function(){logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x4a3ae9);_0x23e2a9['stop']();});}else{logger[_0x38fd('0x14')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x4a3ae9);_0x23e2a9[_0x38fd('0x24')]();}}else{var _0x50fb7a=this;var _0x4a369d=_0x2b80ec[0x2][_0x38fd('0x25')](/\\n/g,'\x0a');var _0x456037={'credentials':{'private_key':_0x4a369d,'client_email':_0x2b80ec[0x1]}};var _0x5a55a9=new dialogflow[(_0x38fd('0x26'))](_0x456037);var _0x1251fc=_0x5a55a9[_0x38fd('0x27')](_0x2b80ec[0x0],md5(_0x50fb7a[_0x38fd('0x12')]['id']));var _0x4c9f46={'session':_0x1251fc,'queryInput':{'text':{'text':_0x50fb7a[_0x38fd('0x28')]['body'],'languageCode':_0x2b80ec[0x3]||'en'}}};return _0x5a55a9['detectIntent'](_0x4c9f46)[_0x38fd('0xc')](function(_0x4bcd9e){if(_0x4bcd9e&&_0x4bcd9e[_0x38fd('0x29')]){_0x50fb7a[_0x38fd('0x9')]['dialogflowV2']=_0x4bcd9e;var _0x54f0e8=_0x4bcd9e[0x0];var _0x10c59d=_0x54f0e8[_0x38fd('0x2a')][_0x38fd('0x2b')]&&_0x54f0e8[_0x38fd('0x2a')][_0x38fd('0x2b')][_0x38fd('0x2c')]?_0x54f0e8[_0x38fd('0x2a')]['diagnosticInfo'][_0x38fd('0x2c')][_0x38fd('0x2d')]['boolValue']:![];_0x50fb7a[_0x38fd('0x9')][_0x38fd('0x2e')]=_0x54f0e8['queryResult'][_0x38fd('0x2f')];_0x50fb7a['body'][_0x38fd('0x30')]=_0x54f0e8['queryResult']['allRequiredParamsPresent'];_0x50fb7a['body'][_0x38fd('0x31')]=_0x54f0e8[_0x38fd('0x2a')]['diagnosticInfo']&&_0x54f0e8['queryResult'][_0x38fd('0x2b')][_0x38fd('0x2c')]?_0x54f0e8[_0x38fd('0x2a')][_0x38fd('0x2b')][_0x38fd('0x2c')]['end_conversation'][_0x38fd('0x32')]:![];_0x50fb7a[_0x38fd('0x9')][_0x38fd('0x33')]=_0x54f0e8[_0x38fd('0x2a')][_0x38fd('0x34')][_0x38fd('0x35')];_0x50fb7a[_0x38fd('0x9')][_0x38fd('0x36')]=_0x54f0e8[_0x38fd('0x2a')][_0x38fd('0x34')][_0x38fd('0x37')];_0x50fb7a[_0x38fd('0x9')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x54f0e8['queryResult'][_0x38fd('0x34')][_0x38fd('0x38')];_0x50fb7a[_0x38fd('0x9')][_0x38fd('0x39')]=_0x54f0e8[_0x38fd('0x2a')][_0x38fd('0x3a')];_0x50fb7a[_0x38fd('0x9')][_0x38fd('0x3b')]=_0x54f0e8[_0x38fd('0x2a')][_0x38fd('0x3c')];_0x50fb7a[_0x38fd('0x9')][_0x38fd('0x3d')]=_0x54f0e8['queryResult'][_0x38fd('0x3e')];_0x4c91b6['providerName']=_0x38fd('0x3f');_0x4c91b6[_0x38fd('0x40')]=JSON['stringify'](_0x4bcd9e);var _0x1421ee=[];for(var _0x576f3d=0x0;_0x576f3d<_0x4bcd9e[_0x38fd('0x29')];_0x576f3d++){var _0x5624ad=_0x4bcd9e[_0x576f3d];if(_0x5624ad&&_0x5624ad['queryResult']&&_0x5624ad[_0x38fd('0x2a')][_0x38fd('0x41')]){_0x1421ee[_0x38fd('0x42')](createMessage(_0x4a3ae9,_0x5d58ee,_0x4c91b6,_0x5624ad[_0x38fd('0x2a')][_0x38fd('0x41')]));}}return Promise[_0x38fd('0x43')](_0x1421ee)[_0x38fd('0xc')](function(){if(_0x10c59d){_0x23e2a9[_0x38fd('0x44')]();}else{_0x23e2a9[_0x38fd('0x24')]();}})[_0x38fd('0xd')](function(_0x32b72b){logger[_0x38fd('0xe')](_0x38fd('0xf'),_0x4a3ae9,JSON['stringify'](_0x32b72b));_0x23e2a9[_0x38fd('0x44')]();});}})[_0x38fd('0xd')](function(_0x55d738){logger[_0x38fd('0xe')](_0x38fd('0xf'),_0x4a3ae9,_0x55d738[_0x38fd('0x28')]);_0x23e2a9['next']();});}}catch(_0x52057c){logger[_0x38fd('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x4a3ae9,JSON['stringify'](_0x52057c));_0x23e2a9['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index bccacc7..1fe6b08 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeb38=['[%s][GOTOIF]\x20%s','stringify','lodash','html-to-text','./utils','../../../../config/logger','routing','string','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','validate','length','error','map','message','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s'];(function(_0x503752,_0x151f62){var _0x4f311c=function(_0x3e928f){while(--_0x3e928f){_0x503752['push'](_0x503752['shift']());}};_0x4f311c(++_0x151f62);}(_0xeb38,0x17b));var _0x8eb3=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0xeb38[_0x40a825];return _0x273a54;};'use strict';var schema=require('validate');var _=require(_0x8eb3('0x0'));var htmlToText=require(_0x8eb3('0x1'));var utils=require(_0x8eb3('0x2'));var logger=require(_0x8eb3('0x3'))(_0x8eb3('0x4'));var gotoif=schema({'condition':{'type':_0x8eb3('0x5'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x8eb3('0x6'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':'number','message':_0x8eb3('0x7')}});exports[_0x8eb3('0x8')]=function(_0x5ad96b,_0x4e02bf){return function(_0x2a7bbf){try{var _0x5bc5f7={'condition':htmlToText[_0x8eb3('0x9')](utils[_0x8eb3('0xa')](_0x4e02bf[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4e02bf[0x1],'priorityFalse':_0x4e02bf[0x2]};var _0x98f696=gotoif[_0x8eb3('0xb')](_0x5bc5f7,{'typecast':!![]});if(_0x98f696[_0x8eb3('0xc')]){logger[_0x8eb3('0xd')]('[%s][GOTOIF]\x20%s',_0x5ad96b,_[_0x8eb3('0xe')](_0x98f696,_0x8eb3('0xf'))[_0x8eb3('0x10')](',\x20'));_0x2a7bbf[_0x8eb3('0x11')]();}else{try{var _0x4371b2=eval('('+_0x5bc5f7[_0x8eb3('0x12')]+')');var _0x303a61=_0x4371b2?_0x5bc5f7[_0x8eb3('0x13')]:_0x5bc5f7[_0x8eb3('0x14')];logger[_0x8eb3('0x15')](_0x8eb3('0x16'),_0x5ad96b,_0x5bc5f7['condition'],_0x4371b2,_0x303a61||_0x8eb3('0x17'));if(_0x303a61){var _0x1f9798=_['findIndex'](_0x2a7bbf['rules'](),{'p':_0x303a61});if(_0x1f9798>=0x0){logger[_0x8eb3('0x15')](_0x8eb3('0x18'),_0x5ad96b,_0x303a61||_0x8eb3('0x17'),_0x1f9798);_0x2a7bbf[_0x8eb3('0x17')](_0x1f9798);}else{logger[_0x8eb3('0x15')](_0x8eb3('0x19'),_0x5ad96b,_0x303a61||'next');_0x2a7bbf['stop']();}}else{_0x2a7bbf[_0x8eb3('0x17')]();}}catch(_0x277425){logger['error'](_0x8eb3('0x1a'),_0x5ad96b,_0x277425['message']);_0x2a7bbf[_0x8eb3('0x11')]();}}}catch(_0xed6b76){logger['error'](_0x8eb3('0x1b'),_0x5ad96b,JSON[_0x8eb3('0x1c')](_0xed6b76));_0x2a7bbf[_0x8eb3('0x11')]();}};}; \ No newline at end of file +var _0xbde9=['priority\x20false\x20is\x20a\x20number','consequence','fromString','replace','length','error','[%s][GOTOIF]\x20%s','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','validate','lodash','html-to-text','./utils','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number'];(function(_0x13973c,_0x4b2a5a){var _0x2ea320=function(_0x583d8a){while(--_0x583d8a){_0x13973c['push'](_0x13973c['shift']());}};_0x2ea320(++_0x4b2a5a);}(_0xbde9,0x1aa));var _0x9bde=function(_0x127b15,_0x11a2a9){_0x127b15=_0x127b15-0x0;var _0x3fe772=_0xbde9[_0x127b15];return _0x3fe772;};'use strict';var schema=require(_0x9bde('0x0'));var _=require(_0x9bde('0x1'));var htmlToText=require(_0x9bde('0x2'));var utils=require(_0x9bde('0x3'));var logger=require('../../../../config/logger')(_0x9bde('0x4'));var gotoif=schema({'condition':{'type':_0x9bde('0x5'),'required':!![],'message':_0x9bde('0x6')},'priorityTrue':{'type':_0x9bde('0x7'),'message':_0x9bde('0x8')},'priorityFalse':{'type':_0x9bde('0x7'),'message':_0x9bde('0x9')}});exports[_0x9bde('0xa')]=function(_0x287c5f,_0x15fee7){return function(_0x19db1f){try{var _0x4d5a27={'condition':htmlToText[_0x9bde('0xb')](utils['getMustacheRender'](_0x15fee7[0x0],this),{'wordwrap':![]})[_0x9bde('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x15fee7[0x1],'priorityFalse':_0x15fee7[0x2]};var _0xc44116=gotoif[_0x9bde('0x0')](_0x4d5a27,{'typecast':!![]});if(_0xc44116[_0x9bde('0xd')]){logger[_0x9bde('0xe')](_0x9bde('0xf'),_0x287c5f,_['map'](_0xc44116,'message')['join'](',\x20'));_0x19db1f['stop']();}else{try{var _0x34ee4a=eval('('+_0x4d5a27[_0x9bde('0x10')]+')');var _0x2f3406=_0x34ee4a?_0x4d5a27[_0x9bde('0x11')]:_0x4d5a27[_0x9bde('0x12')];logger[_0x9bde('0x13')](_0x9bde('0x14'),_0x287c5f,_0x4d5a27[_0x9bde('0x10')],_0x34ee4a,_0x2f3406||_0x9bde('0x15'));if(_0x2f3406){var _0x2cd737=_[_0x9bde('0x16')](_0x19db1f[_0x9bde('0x17')](),{'p':_0x2f3406});if(_0x2cd737>=0x0){logger['info'](_0x9bde('0x18'),_0x287c5f,_0x2f3406||_0x9bde('0x15'),_0x2cd737);_0x19db1f[_0x9bde('0x15')](_0x2cd737);}else{logger[_0x9bde('0x13')](_0x9bde('0x19'),_0x287c5f,_0x2f3406||_0x9bde('0x15'));_0x19db1f[_0x9bde('0x1a')]();}}else{_0x19db1f['next']();}}catch(_0x5110b4){logger[_0x9bde('0xe')](_0x9bde('0x1b'),_0x287c5f,_0x5110b4[_0x9bde('0x1c')]);_0x19db1f[_0x9bde('0x1a')]();}}}catch(_0x4a1b02){logger['error'](_0x9bde('0xf'),_0x287c5f,JSON['stringify'](_0x4a1b02));_0x19db1f[_0x9bde('0x1a')]();}};}; \ 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 a8bcf59..2b1451c 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 _0x56ee=['[%s][GOTOP]\x20%s','message','join','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','stop','stringify','validate','../../../../config/logger','routing','consequence','length','error'];(function(_0x2768c6,_0x5cb241){var _0x4048d9=function(_0x346a3e){while(--_0x346a3e){_0x2768c6['push'](_0x2768c6['shift']());}};_0x4048d9(++_0x5cb241);}(_0x56ee,0x1d5));var _0xe56e=function(_0x4bc65f,_0x39ec43){_0x4bc65f=_0x4bc65f-0x0;var _0x44f85f=_0x56ee[_0x4bc65f];return _0x44f85f;};'use strict';var schema=require(_0xe56e('0x0'));var _=require('lodash');var logger=require(_0xe56e('0x1'))(_0xe56e('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xe56e('0x3')]=function(_0x4228c4,_0x32c666){return function(_0x23ef9b){try{var _0x16afcb={'priority':_0x32c666[0x0]};var _0x103425=gotop['validate'](_0x16afcb,{'typecast':!![]});if(_0x103425[_0xe56e('0x4')]){logger[_0xe56e('0x5')](_0xe56e('0x6'),_0x4228c4,_['map'](_0x103425,_0xe56e('0x7'))[_0xe56e('0x8')](',\x20'));_0x23ef9b['stop']();}else{logger[_0xe56e('0x9')](_0xe56e('0xa'),_0x4228c4,_0x16afcb[_0xe56e('0xb')]);if(_0x16afcb['priority']){var _0x2a7ae0=_[_0xe56e('0xc')](_0x23ef9b[_0xe56e('0xd')](),{'p':_0x16afcb['priority']});if(_0x2a7ae0>=0x0){logger[_0xe56e('0x9')](_0xe56e('0xe'),_0x4228c4,_0x16afcb[_0xe56e('0xb')]||_0xe56e('0xf'),_0x2a7ae0);_0x23ef9b[_0xe56e('0xf')](_0x2a7ae0);}else{logger[_0xe56e('0x9')](_0xe56e('0x10'),_0x4228c4,_0x16afcb[_0xe56e('0xb')]||_0xe56e('0xf'));_0x23ef9b[_0xe56e('0x11')]();}}else{_0x23ef9b[_0xe56e('0xf')]();}}}catch(_0x959adc){logger[_0xe56e('0x5')](_0xe56e('0x6'),_0x4228c4,JSON[_0xe56e('0x12')](_0x959adc));_0x23ef9b['stop']();}};}; \ No newline at end of file +var _0xf01b=['info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','validate','error','[%s][GOTOP]\x20%s','message','join','stop'];(function(_0x548bd9,_0x24d2e2){var _0x31aef4=function(_0x2afa63){while(--_0x2afa63){_0x548bd9['push'](_0x548bd9['shift']());}};_0x31aef4(++_0x24d2e2);}(_0xf01b,0x1ab));var _0xbf01=function(_0x9dd9da,_0x271027){_0x9dd9da=_0x9dd9da-0x0;var _0x193c0e=_0xf01b[_0x9dd9da];return _0x193c0e;};'use strict';var schema=require('validate');var _=require('lodash');var logger=require(_0xbf01('0x0'))(_0xbf01('0x1'));var gotop=schema({'priority':{'type':_0xbf01('0x2'),'required':!![],'message':_0xbf01('0x3')}});exports['consequence']=function(_0x704fb9,_0x3dc80c){return function(_0x2ad4a6){try{var _0x4fd61d={'priority':_0x3dc80c[0x0]};var _0x2b9862=gotop[_0xbf01('0x4')](_0x4fd61d,{'typecast':!![]});if(_0x2b9862['length']){logger[_0xbf01('0x5')](_0xbf01('0x6'),_0x704fb9,_['map'](_0x2b9862,_0xbf01('0x7'))[_0xbf01('0x8')](',\x20'));_0x2ad4a6[_0xbf01('0x9')]();}else{logger[_0xbf01('0xa')](_0xbf01('0xb'),_0x704fb9,_0x4fd61d[_0xbf01('0xc')]);if(_0x4fd61d[_0xbf01('0xc')]){var _0x1b2b3a=_[_0xbf01('0xd')](_0x2ad4a6[_0xbf01('0xe')](),{'p':_0x4fd61d[_0xbf01('0xc')]});if(_0x1b2b3a>=0x0){logger[_0xbf01('0xa')](_0xbf01('0xf'),_0x704fb9,_0x4fd61d[_0xbf01('0xc')]||_0xbf01('0x10'),_0x1b2b3a);_0x2ad4a6[_0xbf01('0x10')](_0x1b2b3a);}else{logger[_0xbf01('0xa')](_0xbf01('0x11'),_0x704fb9,_0x4fd61d['priority']||_0xbf01('0x10'));_0x2ad4a6[_0xbf01('0x9')]();}}else{_0x2ad4a6[_0xbf01('0x10')]();}}}catch(_0x3d7ecd){logger[_0xbf01('0x5')](_0xbf01('0x6'),_0x704fb9,JSON[_0xbf01('0x12')](_0x3d7ecd));_0x2ad4a6[_0xbf01('0x9')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index a53e59e..63f7a1d 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 _0xaf23=['getMustacheRender','contact','channel','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','interaction','Message','then','info','next','catch','error','stringify','stop','[%s][MESSAGE]\x20%s','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage'];(function(_0x18b36c,_0x3fd9e5){var _0x3efbfa=function(_0x87e516){while(--_0x87e516){_0x18b36c['push'](_0x18b36c['shift']());}};_0x3efbfa(++_0x3fd9e5);}(_0xaf23,0x11a));var _0x3af2=function(_0x1eaf74,_0x23a786){_0x1eaf74=_0x1eaf74-0x0;var _0xd34db2=_0xaf23[_0x1eaf74];return _0xd34db2;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require(_0x3af2('0x0'))(_0x3af2('0x1'));var rpc={'chatMessage':require(_0x3af2('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x3af2('0x3')),'smsMessage':require(_0x3af2('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x3af2('0x5'))};exports['consequence']=function(_0x19004b,_0x533d17){return function(_0x523e91){try{var _0x141c5e={'body':utils[_0x3af2('0x6')](_0x533d17[0x0],this),'ContactId':this[_0x3af2('0x7')]['id']};if(this[_0x3af2('0x8')]==='chat'){_0x141c5e[_0x3af2('0x9')]=this['account']['id'];}else{_0x141c5e[_[_0x3af2('0xa')](this['channel'])+_0x3af2('0xb')]=this[_0x3af2('0xc')]['id'];}_0x141c5e[_[_0x3af2('0xa')](this[_0x3af2('0x8')])+_0x3af2('0xd')]=this[_0x3af2('0xe')]['id'];if(rpc[this[_0x3af2('0x8')]+_0x3af2('0xf')]){return rpc[this[_0x3af2('0x8')]+_0x3af2('0xf')]['create'](_0x141c5e)[_0x3af2('0x10')](function(_0x308943){logger[_0x3af2('0x11')]('[%s][MESSAGE]\x20%s',_0x19004b,_0x141c5e['body']);_0x523e91[_0x3af2('0x12')]();})[_0x3af2('0x13')](function(_0x3f5667){logger[_0x3af2('0x14')]('[%s][MESSAGE]\x20%s',_0x19004b,JSON[_0x3af2('0x15')](_0x3f5667));_0x523e91[_0x3af2('0x16')]();});}}catch(_0x821374){logger['error'](_0x3af2('0x17'),_0x19004b,JSON[_0x3af2('0x15')](_0x821374));_0x523e91[_0x3af2('0x16')]();}};}; \ No newline at end of file +var _0x8ef3=['then','[%s][MESSAGE]\x20%s','next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','InteractionId','interaction','Message','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8ef3,0xcb));var _0x38ef=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8ef3[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x38ef('0x0'));var utils=require(_0x38ef('0x1'));var logger=require(_0x38ef('0x2'))(_0x38ef('0x3'));var rpc={'chatMessage':require(_0x38ef('0x4')),'openchannelMessage':require(_0x38ef('0x5')),'mailMessage':require(_0x38ef('0x6')),'smsMessage':require(_0x38ef('0x7')),'faxMessage':require(_0x38ef('0x8')),'whatsappMessage':require(_0x38ef('0x9'))};exports['consequence']=function(_0x478cf6,_0x5e7a6b){return function(_0x528f0f){try{var _0x21c63d={'body':utils[_0x38ef('0xa')](_0x5e7a6b[0x0],this),'ContactId':this[_0x38ef('0xb')]['id']};if(this[_0x38ef('0xc')]===_0x38ef('0xd')){_0x21c63d[_0x38ef('0xe')]=this[_0x38ef('0xf')]['id'];}else{_0x21c63d[_[_0x38ef('0x10')](this[_0x38ef('0xc')])+'AccountId']=this[_0x38ef('0xf')]['id'];}_0x21c63d[_[_0x38ef('0x10')](this[_0x38ef('0xc')])+_0x38ef('0x11')]=this[_0x38ef('0x12')]['id'];if(rpc[this[_0x38ef('0xc')]+_0x38ef('0x13')]){return rpc[this['channel']+_0x38ef('0x13')][_0x38ef('0x14')](_0x21c63d)[_0x38ef('0x15')](function(_0x116cb1){logger['info'](_0x38ef('0x16'),_0x478cf6,_0x21c63d['body']);_0x528f0f[_0x38ef('0x17')]();})[_0x38ef('0x18')](function(_0x3138ff){logger[_0x38ef('0x19')](_0x38ef('0x16'),_0x478cf6,JSON[_0x38ef('0x1a')](_0x3138ff));_0x528f0f[_0x38ef('0x1b')]();});}}catch(_0x434119){logger[_0x38ef('0x19')]('[%s][MESSAGE]\x20%s',_0x478cf6,JSON[_0x38ef('0x1a')](_0x434119));_0x528f0f['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 45fdf34..2c3e9a5 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 _0xa24e=['info','[%s][NOOP]\x20%s','getMustacheRender','next','stringify','stop','./utils','routing'];(function(_0x140ede,_0x4abc15){var _0x5c316f=function(_0x6d9659){while(--_0x6d9659){_0x140ede['push'](_0x140ede['shift']());}};_0x5c316f(++_0x4abc15);}(_0xa24e,0x7e));var _0xea24=function(_0x21bceb,_0x56c1fd){_0x21bceb=_0x21bceb-0x0;var _0x1ac9b3=_0xa24e[_0x21bceb];return _0x1ac9b3;};'use strict';var utils=require(_0xea24('0x0'));var logger=require('../../../../config/logger')(_0xea24('0x1'));exports['consequence']=function(_0x56b282,_0x1abb8a){return function(_0x24389a){try{logger[_0xea24('0x2')](_0xea24('0x3'),_0x56b282,utils[_0xea24('0x4')](_0x1abb8a[0x0],this));_0x24389a[_0xea24('0x5')]();}catch(_0x8aff74){logger['error']('[%s][NOOP]\x20%s',_0x56b282,JSON[_0xea24('0x6')](_0x8aff74));_0x24389a[_0xea24('0x7')]();}};}; \ No newline at end of file +var _0xbb4a=['stop','./utils','routing','getMustacheRender','next','error','[%s][NOOP]\x20%s','stringify'];(function(_0x129607,_0x209891){var _0x488099=function(_0x37163b){while(--_0x37163b){_0x129607['push'](_0x129607['shift']());}};_0x488099(++_0x209891);}(_0xbb4a,0xc1));var _0xabb4=function(_0x12f7d6,_0x304623){_0x12f7d6=_0x12f7d6-0x0;var _0x4d6db4=_0xbb4a[_0x12f7d6];return _0x4d6db4;};'use strict';var utils=require(_0xabb4('0x0'));var logger=require('../../../../config/logger')(_0xabb4('0x1'));exports['consequence']=function(_0x1d95da,_0xb9430){return function(_0x3fb9ab){try{logger['info']('[%s][NOOP]\x20%s',_0x1d95da,utils[_0xabb4('0x2')](_0xb9430[0x0],this));_0x3fb9ab[_0xabb4('0x3')]();}catch(_0x1d8853){logger[_0xabb4('0x4')](_0xabb4('0x5'),_0x1d95da,JSON[_0xabb4('0x6')](_0x1d8853));_0x3fb9ab[_0xabb4('0x7')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 3f80144..f7ee941 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 _0x87a1=['createQueue','atimeout','qtimeout','rules','end','close','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','queue_id','from','joinAt','queue','account','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','channel','interaction','message','chat','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','create','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','QueueReport','update','update\x20queue\x20report','timeout','toLowerCase','consequence','validate','[%s][QUEUE]\x20%s','map','join'];(function(_0x4605da,_0x4d86f8){var _0x26ab6e=function(_0x5e7e2f){while(--_0x5e7e2f){_0x4605da['push'](_0x4605da['shift']());}};_0x26ab6e(++_0x4d86f8);}(_0x87a1,0x1c5));var _0x187a=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x87a1[_0x36dfbd];return _0x4ecad9;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x187a('0x0'));var seqqueue=require(_0x187a('0x1'));var moment=require('moment');var Redis=require(_0x187a('0x2'));var config=require(_0x187a('0x3'));var logger=require(_0x187a('0x4'))(_0x187a('0x5'));var strategy=require('./strategy');config[_0x187a('0x6')]=_[_0x187a('0x7')](config[_0x187a('0x6')],{'host':_0x187a('0x8'),'port':0x18eb});var io=require(_0x187a('0x9'))(new Redis(config[_0x187a('0x6')]));var attributes=['id',_0x187a('0xa'),'account','queue',_0x187a('0xb'),_0x187a('0xc')];function emit(_0x3c1516,_0x41de5f,_0x550060){io['to'](_0x3c1516)['emit'](_0x41de5f,_0x550060);}function emitChannelQueueInteraction(_0x133616,_0xdc6bb9,_0x1fe021,_0x151afc,_0x5efc6b,_0x5ca22d,_0x53546d,_0x56006c){var _0x1267c2=_['clone'](_0x1fe021);_0x1267c2[_0x187a('0xa')]=_0x56006c;_0x1267c2[_0x187a('0xd')]=_0xdc6bb9;_0x1267c2[_0x187a('0xe')]=_0x151afc;_0x1267c2['id']=_0x5efc6b;if(_0x5ca22d){_0x53546d[util['format'](_0x187a('0xf'),_0x133616)][_0x5efc6b]=_[_0x187a('0x10')](_0x1267c2,attributes);}else{delete _0x53546d[util[_0x187a('0x11')]('%sQueuesWaitingInteractions',_0x133616)][_0x5efc6b];}emit(util[_0x187a('0x11')](_0x187a('0x12'),_0x133616,_0xdc6bb9),util[_0x187a('0x11')](_0x187a('0x13'),_0x133616,_0x5ca22d?'save':'remove'),_[_0x187a('0x10')](_0x1267c2,attributes));}var rpc={'openchannelQueueReport':require(_0x187a('0x14')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x187a('0x15')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x187a('0x16')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x187a('0x17'),'required':!![],'message':_0x187a('0x18')},'timeout':{'type':_0x187a('0x19'),'message':_0x187a('0x1a')}});function startRouting(_0x476c02,_0x20ce7d,_0x2dd34a,_0x352e0c){if(_0x476c02&&_0x20ce7d&&_0x2dd34a){_0x20ce7d[_0x187a('0x1b')]+=0x1;var _0x27438b={'uniqueid':_0x476c02,'from':_0x2dd34a[_0x187a('0x1c')]?_0x2dd34a[_0x187a('0x1c')]['from']:'','joinAt':moment()[_0x187a('0x11')](_0x187a('0x1d')),'ContactId':_0x2dd34a[_0x187a('0x1e')]?_0x2dd34a[_0x187a('0x1e')]['id']:null,'ListId':_0x2dd34a['list']?_0x2dd34a[_0x187a('0x1f')]['id']:null};_0x27438b[_[_0x187a('0x20')](_0x2dd34a['channel'])+_0x187a('0x21')]=_0x20ce7d['id']||null;_0x27438b[_['upperFirst'](_0x2dd34a[_0x187a('0x22')])+'InteractionId']=_0x2dd34a[_0x187a('0x23')]?_0x2dd34a['interaction']['id']:null;_0x27438b[_['upperFirst'](_0x2dd34a['channel'])+'MessageId']=_0x2dd34a[_0x187a('0x24')]?_0x2dd34a[_0x187a('0x24')]['id']:null;_0x27438b[_[_0x187a('0x20')](_0x2dd34a[_0x187a('0x22')])+(_0x2dd34a['channel']!==_0x187a('0x25')?'AccountId':_0x187a('0x26'))]=_0x2dd34a[_0x187a('0xe')]?_0x2dd34a[_0x187a('0xe')]['id']:null;logger[_0x187a('0x27')](util[_0x187a('0x11')](_0x187a('0x28'),_0x476c02,_0x20ce7d[_0x187a('0x29')]));emitChannelQueueInteraction(_0x2dd34a['channel'],_0x20ce7d[_0x187a('0x29')],_0x27438b,_0x2dd34a[_0x187a('0xe')]['name'],_0x2dd34a[_0x187a('0x24')]['id'],!![],_0x352e0c,_0x20ce7d['id']);if(rpc[_0x2dd34a[_0x187a('0x22')]+'QueueReport']){return rpc[_0x2dd34a[_0x187a('0x22')]+'QueueReport'][_0x187a('0x2a')](_0x27438b)[_0x187a('0x2b')](function(_0x25e68d){logger[_0x187a('0x2c')](_0x187a('0x2d'));});}}}function stopRouting(_0x30e619,_0xb60003,_0x112783,_0x5f3583){if(_0x30e619&&_0xb60003){_0xb60003['waiting']-=0x1;var _0x16b27c={'leaveAt':moment()[_0x187a('0x11')](_0x187a('0x1d')),'acceptAt':moment()[_0x187a('0x11')](_0x187a('0x1d')),'reason':_0x187a('0x2e')};logger['info'](util['format'](_0x187a('0x2f'),_0x30e619,_0xb60003[_0x187a('0x29')]));emitChannelQueueInteraction(_0x112783[_0x187a('0x22')],_0xb60003[_0x187a('0x29')],_0x112783['body'],_0x112783['account'][_0x187a('0x29')],_0x112783['message']['id'],![],_0x5f3583,_0xb60003['id']);if(rpc[_0x112783['channel']+_0x187a('0x30')]){return rpc[_0x112783['channel']+_0x187a('0x30')][_0x187a('0x31')](_0x30e619,_0x16b27c)[_0x187a('0x2b')](function(_0x2bba5e){logger[_0x187a('0x2c')](_0x187a('0x32'));});}}}function endRouting(_0x5266a0,_0x5644b1,_0x15dd83,_0x2dd238){if(_0x5266a0&&_0x5644b1){_0x5644b1['waiting']-=0x1;var _0x3709ea={'leaveAt':moment()[_0x187a('0x11')](_0x187a('0x1d')),'exitAt':moment()[_0x187a('0x11')](_0x187a('0x1d')),'reason':_0x187a('0x33')};logger[_0x187a('0x27')](util[_0x187a('0x11')]('[%s][END:QUEUE][NAME:%s]',_0x5266a0,_0x5644b1[_0x187a('0x29')]));emitChannelQueueInteraction(_0x15dd83['channel'],_0x5644b1['name'],_0x15dd83[_0x187a('0x1c')],_0x15dd83[_0x187a('0xe')]['name'],_0x15dd83[_0x187a('0x24')]['id'],![],_0x2dd238);if(rpc[_0x15dd83[_0x187a('0x22')]+_0x187a('0x30')]){return rpc[_0x15dd83[_0x187a('0x22')]+_0x187a('0x30')][_0x187a('0x31')](_0x5266a0,_0x3709ea)[_0x187a('0x2b')](function(_0x58d659){logger[_0x187a('0x2c')](_0x187a('0x32'));});}}}function handleFindQueue(_0x199aa0){return function(_0x228dab){return _0x228dab[_0x187a('0x29')]['toLowerCase']()===_0x199aa0[_0x187a('0x34')]();};}exports[_0x187a('0x35')]=function(_0x5d0bbb,_0x299b81,_0x516bf5,_0x38937a){return function(_0x4f86be){try{var _0x5a0099={'name':_0x299b81[0x0],'timeout':_0x299b81[0x1]};var _0x1d9153=queue[_0x187a('0x36')](_0x5a0099,{'typecast':!![]});if(_0x1d9153['length']){logger[_0x187a('0x2c')](_0x187a('0x37'),_0x5d0bbb,_[_0x187a('0x38')](_0x1d9153,_0x187a('0x24'))[_0x187a('0x39')](',\x20'));_0x4f86be['stop']();}else{var _0x40fde3=_['find'](_0x516bf5[_0x38937a['channel']+'Queues'],handleFindQueue(_0x5a0099[_0x187a('0x29')]));if(_0x40fde3){startRouting(_0x5d0bbb,_0x40fde3,_0x38937a,_0x516bf5);var _0x50d901=(_0x40fde3[_0x187a('0x33')]||0xa)*0x3e8;var _0x4b21d8=(_0x5a0099[_0x187a('0x33')]||0x14)*0x3e8;var _0x2fa666,_0x2e1249;if(_0x50d901>_0x4b21d8){_0x4b21d8=_0x50d901;}var _0x19a906=seqqueue[_0x187a('0x3a')](_0x50d901);_0x19a906['id']=_0x5d0bbb;_0x19a906[_0x187a('0x3b')]=_0x50d901;_0x19a906[_0x187a('0x3c')]=_0x4b21d8;_0x19a906[_0x187a('0x22')]=_0x38937a[_0x187a('0x22')];_0x516bf5[_0x187a('0x3d')][_0x5d0bbb]['on'](_0x187a('0x3e'),function(){logger[_0x187a('0x27')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x5d0bbb);stopRouting(_0x5d0bbb,_0x40fde3,_0x38937a,_0x516bf5);clearTimeout(_0x2fa666);_0x2fa666=undefined;_0x19a906[_0x187a('0x3f')](!![]);if(_0x516bf5[_0x187a('0x3d')][_0x5d0bbb]){delete _0x516bf5[_0x187a('0x3d')][_0x5d0bbb];}_0x4f86be[_0x187a('0x40')]();});_0x516bf5['rules'][_0x5d0bbb]['on'](_0x187a('0x41'),function(){if(_0x516bf5['rules'][_0x5d0bbb]){delete _0x516bf5[_0x187a('0x3d')][_0x5d0bbb];}});_0x2fa666=setTimeout(function(){logger[_0x187a('0x27')](_0x187a('0x42'),_0x5d0bbb);endRouting(_0x5d0bbb,_0x40fde3,_0x38937a,_0x516bf5);clearTimeout(_0x2fa666);_0x19a906[_0x187a('0x3f')](!![]);_0x4f86be[_0x187a('0x43')]();},_0x4b21d8);switch(_0x40fde3[_0x187a('0x44')]){case _0x187a('0x45'):strategy['rrmemory'](_0x19a906,_0x40fde3,_0x516bf5,_0x38937a);break;default:strategy[_0x187a('0x46')](_0x19a906,_0x40fde3,_0x516bf5,_0x38937a);}}else{logger[_0x187a('0x2c')](_0x187a('0x47'),_0x5d0bbb,_0x5a0099[_0x187a('0x29')]);_0x4f86be['stop']();}}}catch(_0x4ae3ff){console[_0x187a('0x48')](_0x4ae3ff);logger['error']('[%s][QUEUE]\x20%s',_0x5d0bbb,_0x4ae3ff['stack']);_0x4f86be['stop']();}};}; \ No newline at end of file +var _0x7e29=['joinAt','clone','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','InteractionId','interaction','upperFirst','MessageId','message','chat','AccountId','info','name','QueueReport','create','catch','error','waiting','update','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','timeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','localhost','socket.io-emitter','queue_id','account','queue','from'];(function(_0x1a0979,_0x46595f){var _0x2125f1=function(_0x5bb16f){while(--_0x5bb16f){_0x1a0979['push'](_0x1a0979['shift']());}};_0x2125f1(++_0x46595f);}(_0x7e29,0x177));var _0x97e2=function(_0x3fd175,_0x2bbb07){_0x3fd175=_0x3fd175-0x0;var _0x24fe60=_0x7e29[_0x3fd175];return _0x24fe60;};'use strict';var schema=require(_0x97e2('0x0'));var _=require(_0x97e2('0x1'));var util=require('util');var seqqueue=require(_0x97e2('0x2'));var moment=require(_0x97e2('0x3'));var Redis=require(_0x97e2('0x4'));var config=require(_0x97e2('0x5'));var logger=require(_0x97e2('0x6'))(_0x97e2('0x7'));var strategy=require('./strategy');config['redis']=_['defaults'](config[_0x97e2('0x8')],{'host':_0x97e2('0x9'),'port':0x18eb});var io=require(_0x97e2('0xa'))(new Redis(config['redis']));var attributes=['id',_0x97e2('0xb'),_0x97e2('0xc'),_0x97e2('0xd'),_0x97e2('0xe'),_0x97e2('0xf')];function emit(_0x2e9b9d,_0x4e5f94,_0x44da38){io['to'](_0x2e9b9d)['emit'](_0x4e5f94,_0x44da38);}function emitChannelQueueInteraction(_0x15e75d,_0x4029c2,_0x316f80,_0x19b0a,_0x2c8cab,_0x59d843,_0x598e11,_0x3465f0){var _0x2a97b2=_[_0x97e2('0x10')](_0x316f80);_0x2a97b2['queue_id']=_0x3465f0;_0x2a97b2[_0x97e2('0xd')]=_0x4029c2;_0x2a97b2[_0x97e2('0xc')]=_0x19b0a;_0x2a97b2['id']=_0x2c8cab;if(_0x59d843){_0x598e11[util[_0x97e2('0x11')](_0x97e2('0x12'),_0x15e75d)][_0x2c8cab]=_[_0x97e2('0x13')](_0x2a97b2,attributes);}else{delete _0x598e11[util[_0x97e2('0x11')](_0x97e2('0x12'),_0x15e75d)][_0x2c8cab];}emit(util['format'](_0x97e2('0x14'),_0x15e75d,_0x4029c2),util[_0x97e2('0x11')](_0x97e2('0x15'),_0x15e75d,_0x59d843?_0x97e2('0x16'):_0x97e2('0x17')),_['pick'](_0x2a97b2,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x97e2('0x18')),'chatQueueReport':require(_0x97e2('0x19')),'smsQueueReport':require(_0x97e2('0x1a')),'faxQueueReport':require(_0x97e2('0x1b')),'whatsappQueueReport':require(_0x97e2('0x1c'))};var queue=schema({'name':{'type':_0x97e2('0x1d'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x97e2('0x1e')}});function startRouting(_0x2483f9,_0x55979a,_0x1c79d9,_0x2d4f9e){if(_0x2483f9&&_0x55979a&&_0x1c79d9){_0x55979a['waiting']+=0x1;var _0x2b1bdb={'uniqueid':_0x2483f9,'from':_0x1c79d9[_0x97e2('0x1f')]?_0x1c79d9[_0x97e2('0x1f')][_0x97e2('0xe')]:'','joinAt':moment()[_0x97e2('0x11')](_0x97e2('0x20')),'ContactId':_0x1c79d9[_0x97e2('0x21')]?_0x1c79d9[_0x97e2('0x21')]['id']:null,'ListId':_0x1c79d9[_0x97e2('0x22')]?_0x1c79d9[_0x97e2('0x22')]['id']:null};_0x2b1bdb[_['upperFirst'](_0x1c79d9[_0x97e2('0x23')])+_0x97e2('0x24')]=_0x55979a['id']||null;_0x2b1bdb[_['upperFirst'](_0x1c79d9[_0x97e2('0x23')])+_0x97e2('0x25')]=_0x1c79d9['interaction']?_0x1c79d9[_0x97e2('0x26')]['id']:null;_0x2b1bdb[_[_0x97e2('0x27')](_0x1c79d9['channel'])+_0x97e2('0x28')]=_0x1c79d9[_0x97e2('0x29')]?_0x1c79d9[_0x97e2('0x29')]['id']:null;_0x2b1bdb[_[_0x97e2('0x27')](_0x1c79d9[_0x97e2('0x23')])+(_0x1c79d9[_0x97e2('0x23')]!==_0x97e2('0x2a')?_0x97e2('0x2b'):'WebsiteId')]=_0x1c79d9[_0x97e2('0xc')]?_0x1c79d9[_0x97e2('0xc')]['id']:null;logger[_0x97e2('0x2c')](util[_0x97e2('0x11')]('[%s][START:QUEUE][NAME:%s]',_0x2483f9,_0x55979a[_0x97e2('0x2d')]));emitChannelQueueInteraction(_0x1c79d9['channel'],_0x55979a['name'],_0x2b1bdb,_0x1c79d9[_0x97e2('0xc')]['name'],_0x1c79d9['message']['id'],!![],_0x2d4f9e,_0x55979a['id']);if(rpc[_0x1c79d9['channel']+_0x97e2('0x2e')]){return rpc[_0x1c79d9[_0x97e2('0x23')]+_0x97e2('0x2e')][_0x97e2('0x2f')](_0x2b1bdb)[_0x97e2('0x30')](function(_0xae7fb0){logger[_0x97e2('0x31')]('create\x20queue\x20report');});}}}function stopRouting(_0x346877,_0x15ac88,_0x2a4aae,_0x548d20){if(_0x346877&&_0x15ac88){_0x15ac88[_0x97e2('0x32')]-=0x1;var _0x5de95f={'leaveAt':moment()[_0x97e2('0x11')](_0x97e2('0x20')),'acceptAt':moment()[_0x97e2('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'accepted'};logger[_0x97e2('0x2c')](util[_0x97e2('0x11')]('[%s][STOP:QUEUE][NAME:%s]',_0x346877,_0x15ac88[_0x97e2('0x2d')]));emitChannelQueueInteraction(_0x2a4aae[_0x97e2('0x23')],_0x15ac88['name'],_0x2a4aae[_0x97e2('0x1f')],_0x2a4aae[_0x97e2('0xc')][_0x97e2('0x2d')],_0x2a4aae[_0x97e2('0x29')]['id'],![],_0x548d20,_0x15ac88['id']);if(rpc[_0x2a4aae[_0x97e2('0x23')]+_0x97e2('0x2e')]){return rpc[_0x2a4aae[_0x97e2('0x23')]+_0x97e2('0x2e')][_0x97e2('0x33')](_0x346877,_0x5de95f)[_0x97e2('0x30')](function(_0x595251){logger[_0x97e2('0x31')](_0x97e2('0x34'));});}}}function endRouting(_0x41889e,_0x1f8abd,_0x15cfb4,_0x416767){if(_0x41889e&&_0x1f8abd){_0x1f8abd[_0x97e2('0x32')]-=0x1;var _0x373801={'leaveAt':moment()['format'](_0x97e2('0x20')),'exitAt':moment()[_0x97e2('0x11')](_0x97e2('0x20')),'reason':'timeout'};logger['info'](util[_0x97e2('0x11')](_0x97e2('0x35'),_0x41889e,_0x1f8abd[_0x97e2('0x2d')]));emitChannelQueueInteraction(_0x15cfb4['channel'],_0x1f8abd[_0x97e2('0x2d')],_0x15cfb4[_0x97e2('0x1f')],_0x15cfb4[_0x97e2('0xc')][_0x97e2('0x2d')],_0x15cfb4[_0x97e2('0x29')]['id'],![],_0x416767);if(rpc[_0x15cfb4['channel']+_0x97e2('0x2e')]){return rpc[_0x15cfb4[_0x97e2('0x23')]+_0x97e2('0x2e')]['update'](_0x41889e,_0x373801)['catch'](function(_0x144736){logger[_0x97e2('0x31')](_0x97e2('0x34'));});}}}function handleFindQueue(_0x1bf7a0){return function(_0x1e3e41){return _0x1e3e41['name'][_0x97e2('0x36')]()===_0x1bf7a0['toLowerCase']();};}exports[_0x97e2('0x37')]=function(_0x3f9798,_0x4a7ef3,_0x33eade,_0x497a22){return function(_0x1ae7db){try{var _0x450ccb={'name':_0x4a7ef3[0x0],'timeout':_0x4a7ef3[0x1]};var _0xfaf761=queue[_0x97e2('0x0')](_0x450ccb,{'typecast':!![]});if(_0xfaf761[_0x97e2('0x38')]){logger[_0x97e2('0x31')](_0x97e2('0x39'),_0x3f9798,_[_0x97e2('0x3a')](_0xfaf761,_0x97e2('0x29'))[_0x97e2('0x3b')](',\x20'));_0x1ae7db[_0x97e2('0x3c')]();}else{var _0x54b15f=_[_0x97e2('0x3d')](_0x33eade[_0x497a22[_0x97e2('0x23')]+_0x97e2('0x3e')],handleFindQueue(_0x450ccb[_0x97e2('0x2d')]));if(_0x54b15f){startRouting(_0x3f9798,_0x54b15f,_0x497a22,_0x33eade);var _0x1d944a=(_0x54b15f['timeout']||0xa)*0x3e8;var _0x3df9ef=(_0x450ccb[_0x97e2('0x3f')]||0x14)*0x3e8;var _0x1bcdf6,_0x151019;if(_0x1d944a>_0x3df9ef){_0x3df9ef=_0x1d944a;}var _0x4017f6=seqqueue['createQueue'](_0x1d944a);_0x4017f6['id']=_0x3f9798;_0x4017f6['atimeout']=_0x1d944a;_0x4017f6[_0x97e2('0x40')]=_0x3df9ef;_0x4017f6[_0x97e2('0x23')]=_0x497a22['channel'];_0x33eade[_0x97e2('0x41')][_0x3f9798]['on'](_0x97e2('0x42'),function(){logger[_0x97e2('0x2c')](_0x97e2('0x43'),_0x3f9798);stopRouting(_0x3f9798,_0x54b15f,_0x497a22,_0x33eade);clearTimeout(_0x1bcdf6);_0x1bcdf6=undefined;_0x4017f6[_0x97e2('0x44')](!![]);if(_0x33eade[_0x97e2('0x41')][_0x3f9798]){delete _0x33eade[_0x97e2('0x41')][_0x3f9798];}_0x1ae7db[_0x97e2('0x3c')]();});_0x33eade[_0x97e2('0x41')][_0x3f9798]['on'](_0x97e2('0x45'),function(){if(_0x33eade[_0x97e2('0x41')][_0x3f9798]){delete _0x33eade[_0x97e2('0x41')][_0x3f9798];}});_0x1bcdf6=setTimeout(function(){logger[_0x97e2('0x2c')](_0x97e2('0x46'),_0x3f9798);endRouting(_0x3f9798,_0x54b15f,_0x497a22,_0x33eade);clearTimeout(_0x1bcdf6);_0x4017f6['close'](!![]);_0x1ae7db[_0x97e2('0x47')]();},_0x3df9ef);switch(_0x54b15f[_0x97e2('0x48')]){case _0x97e2('0x49'):strategy[_0x97e2('0x49')](_0x4017f6,_0x54b15f,_0x33eade,_0x497a22);break;default:strategy[_0x97e2('0x4a')](_0x4017f6,_0x54b15f,_0x33eade,_0x497a22);}}else{logger[_0x97e2('0x31')](_0x97e2('0x4b'),_0x3f9798,_0x450ccb[_0x97e2('0x2d')]);_0x1ae7db[_0x97e2('0x3c')]();}}}catch(_0x41548a){console[_0x97e2('0x4c')](_0x41548a);logger['error'](_0x97e2('0x39'),_0x3f9798,_0x41548a[_0x97e2('0x4d')]);_0x1ae7db['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 4149d65..e91923d 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 _0xc80f=['uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','handleRun','handleTimeout','bind','timeout','drained','prototype','push','handleDrained','info','[%s][AGENT]\x20try\x20with\x20%s','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','busy','busyQueue','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','lodash'];(function(_0x4490e1,_0x2d9991){var _0x265655=function(_0x10652a){while(--_0x10652a){_0x4490e1['push'](_0x4490e1['shift']());}};_0x265655(++_0x2d9991);}(_0xc80f,0x10f));var _0xfc80=function(_0x402d16,_0x5b93ed){_0x402d16=_0x402d16-0x0;var _0x3fe1d8=_0xc80f[_0x402d16];return _0x3fe1d8;};'use strict';var _=require(_0xfc80('0x0'));var uuid=require(_0xfc80('0x1'));var util=require(_0xfc80('0x2'));var logger=require(_0xfc80('0x3'))(_0xfc80('0x4'));var Agent=function(_0x5b2494,_0xa7c631,_0x2583e6,_0x52e701){this[_0xfc80('0x5')]=uuid['v4']();this[_0xfc80('0x6')]=_0x5b2494;this[_0xfc80('0x7')]=_0xa7c631;this[_0xfc80('0x8')]=_0x2583e6;this[_0xfc80('0x4')]=_0x52e701;this['squeue']['push'](this[_0xfc80('0x9')]['bind'](this),this[_0xfc80('0xa')][_0xfc80('0xb')](this));this[_0xfc80('0x6')]['on'](_0xfc80('0xc'),this[_0xfc80('0xa')][_0xfc80('0xb')](this));this[_0xfc80('0x6')]['on'](_0xfc80('0xd'),this['handleDrained'][_0xfc80('0xb')](this));};Agent[_0xfc80('0xe')][_0xfc80('0xf')]=function(){this[_0xfc80('0x6')][_0xfc80('0xf')](this[_0xfc80('0x9')][_0xfc80('0xb')](this),this[_0xfc80('0xa')][_0xfc80('0xb')](this));};Agent[_0xfc80('0xe')][_0xfc80('0x10')]=function(){this[_0xfc80('0xa')](!![]);};Agent[_0xfc80('0xe')][_0xfc80('0x9')]=function(_0x3b5939){logger[_0xfc80('0x11')](_0xfc80('0x12'),this[_0xfc80('0x6')]['id'],this[_0xfc80('0x7')]['id']);if(_['isNil'](this[_0xfc80('0x8')][_0xfc80('0x13')][this[_0xfc80('0x7')]['id']])){logger['info'](_0xfc80('0x14'),this[_0xfc80('0x6')]['id'],this[_0xfc80('0x7')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}else{if(this['routing'][_0xfc80('0x15')]||util['isAgentAvailable'](this[_0xfc80('0x6')]['id'],this['realtime']['agents'][this['agent']['id']],this[_0xfc80('0x6')][_0xfc80('0x16')],![])){this[_0xfc80('0x8')][_0xfc80('0x13')][this[_0xfc80('0x7')]['id']][_0xfc80('0x17')]=!![];this[_0xfc80('0x8')][_0xfc80('0x13')][this[_0xfc80('0x7')]['id']][_0xfc80('0x18')]=undefined;util['showNotification'](this['notificationId'],this[_0xfc80('0x6')]['id'],this['realtime'][_0xfc80('0x13')][this['agent']['id']],null,this[_0xfc80('0x4')]);util[_0xfc80('0x19')](this[_0xfc80('0x6')]['id'],this[_0xfc80('0x8')][_0xfc80('0x13')][this[_0xfc80('0x7')]['id']],_0xfc80('0x1a')+(this[_0xfc80('0x4')][_0xfc80('0x15')]?':FORCED':''));}else{logger[_0xfc80('0x11')](_0xfc80('0x1b'),this['squeue']['id'],this[_0xfc80('0x7')]['id']);setTimeout(this[_0xfc80('0xf')][_0xfc80('0xb')](this),0x3e8);}}};Agent[_0xfc80('0xe')]['handleTimeout']=function(_0x4ef88f){if(_[_0xfc80('0x1c')](this[_0xfc80('0x8')]['agents'][this[_0xfc80('0x7')]['id']])){return logger[_0xfc80('0x11')](_0xfc80('0x14'),this[_0xfc80('0x6')]['id'],this[_0xfc80('0x7')]['id']);}else{logger['info'](_0xfc80('0x1d'),this[_0xfc80('0x6')]['id'],this[_0xfc80('0x7')]['id']);util[_0xfc80('0x1e')](this[_0xfc80('0x5')],this[_0xfc80('0x6')]['id'],this[_0xfc80('0x8')][_0xfc80('0x13')][this[_0xfc80('0x7')]['id']],null,this[_0xfc80('0x4')]);this[_0xfc80('0x8')][_0xfc80('0x13')][this['agent']['id']][_0xfc80('0x17')]=![];this[_0xfc80('0x8')][_0xfc80('0x13')][this[_0xfc80('0x7')]['id']][_0xfc80('0x18')]=undefined;util[_0xfc80('0x19')](this['squeue']['id'],this[_0xfc80('0x8')][_0xfc80('0x13')][this[_0xfc80('0x7')]['id']],_0x4ef88f?_0xfc80('0x1f'):_0xfc80('0x20'));}if(!_0x4ef88f){setTimeout(this['push'][_0xfc80('0xb')](this),0x3e8);}};function agent(_0x299424,_0x331e71,_0x1f4177,_0x28acde){return new Agent(_0x299424,_0x331e71,_0x1f4177,_0x28acde);}module[_0xfc80('0x21')]=agent; \ No newline at end of file +var _0x85ef=['[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','STOP','TIMEOUT','exports','lodash','uuid','../../../../../config/logger','routing','notificationId','agent','realtime','squeue','handleRun','bind','handleTimeout','timeout','prototype','push','handleDrained','info','isNil','agents','forcedOwnership','isAgentAvailable','channel','busy','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available'];(function(_0x490607,_0x3fcf8a){var _0x1cfced=function(_0x31fa45){while(--_0x31fa45){_0x490607['push'](_0x490607['shift']());}};_0x1cfced(++_0x3fcf8a);}(_0x85ef,0x165));var _0xf85e=function(_0x12fde3,_0x4800c6){_0x12fde3=_0x12fde3-0x0;var _0x521038=_0x85ef[_0x12fde3];return _0x521038;};'use strict';var _=require(_0xf85e('0x0'));var uuid=require(_0xf85e('0x1'));var util=require('./util');var logger=require(_0xf85e('0x2'))(_0xf85e('0x3'));var Agent=function(_0x164d67,_0x12aa1c,_0x25e808,_0x5245e6){this[_0xf85e('0x4')]=uuid['v4']();this['squeue']=_0x164d67;this[_0xf85e('0x5')]=_0x12aa1c;this[_0xf85e('0x6')]=_0x25e808;this[_0xf85e('0x3')]=_0x5245e6;this[_0xf85e('0x7')]['push'](this[_0xf85e('0x8')][_0xf85e('0x9')](this),this[_0xf85e('0xa')][_0xf85e('0x9')](this));this[_0xf85e('0x7')]['on'](_0xf85e('0xb'),this[_0xf85e('0xa')][_0xf85e('0x9')](this));this[_0xf85e('0x7')]['on']('drained',this['handleDrained'][_0xf85e('0x9')](this));};Agent[_0xf85e('0xc')][_0xf85e('0xd')]=function(){this[_0xf85e('0x7')][_0xf85e('0xd')](this[_0xf85e('0x8')]['bind'](this),this['handleTimeout'][_0xf85e('0x9')](this));};Agent[_0xf85e('0xc')][_0xf85e('0xe')]=function(){this[_0xf85e('0xa')](!![]);};Agent[_0xf85e('0xc')]['handleRun']=function(_0x25cef6){logger[_0xf85e('0xf')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0xf85e('0x7')]['id'],this['agent']['id']);if(_[_0xf85e('0x10')](this[_0xf85e('0x6')][_0xf85e('0x11')][this[_0xf85e('0x5')]['id']])){logger[_0xf85e('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0xf85e('0x5')]['id']);setTimeout(this[_0xf85e('0xd')]['bind'](this),0x3e8);}else{if(this[_0xf85e('0x3')][_0xf85e('0x12')]||util[_0xf85e('0x13')](this['squeue']['id'],this[_0xf85e('0x6')][_0xf85e('0x11')][this['agent']['id']],this[_0xf85e('0x7')][_0xf85e('0x14')],![])){this['realtime'][_0xf85e('0x11')][this[_0xf85e('0x5')]['id']][_0xf85e('0x15')]=!![];this[_0xf85e('0x6')][_0xf85e('0x11')][this[_0xf85e('0x5')]['id']]['busyQueue']=undefined;util[_0xf85e('0x16')](this['notificationId'],this[_0xf85e('0x7')]['id'],this[_0xf85e('0x6')][_0xf85e('0x11')][this[_0xf85e('0x5')]['id']],null,this[_0xf85e('0x3')]);util[_0xf85e('0x17')](this[_0xf85e('0x7')]['id'],this[_0xf85e('0x6')]['agents'][this['agent']['id']],_0xf85e('0x18')+(this[_0xf85e('0x3')][_0xf85e('0x12')]?_0xf85e('0x19'):''));}else{logger[_0xf85e('0xf')](_0xf85e('0x1a'),this[_0xf85e('0x7')]['id'],this['agent']['id']);setTimeout(this[_0xf85e('0xd')][_0xf85e('0x9')](this),0x3e8);}}};Agent['prototype']['handleTimeout']=function(_0x232c78){if(_[_0xf85e('0x10')](this[_0xf85e('0x6')][_0xf85e('0x11')][this[_0xf85e('0x5')]['id']])){return logger[_0xf85e('0xf')](_0xf85e('0x1b'),this[_0xf85e('0x7')]['id'],this['agent']['id']);}else{logger[_0xf85e('0xf')](_0xf85e('0x1c'),this[_0xf85e('0x7')]['id'],this[_0xf85e('0x5')]['id']);util['hideNotification'](this[_0xf85e('0x4')],this[_0xf85e('0x7')]['id'],this[_0xf85e('0x6')][_0xf85e('0x11')][this[_0xf85e('0x5')]['id']],null,this['routing']);this[_0xf85e('0x6')][_0xf85e('0x11')][this[_0xf85e('0x5')]['id']][_0xf85e('0x15')]=![];this[_0xf85e('0x6')][_0xf85e('0x11')][this[_0xf85e('0x5')]['id']]['busyQueue']=undefined;util[_0xf85e('0x17')](this[_0xf85e('0x7')]['id'],this['realtime'][_0xf85e('0x11')][this[_0xf85e('0x5')]['id']],_0x232c78?_0xf85e('0x1d'):_0xf85e('0x1e'));}if(!_0x232c78){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x18270c,_0x4154fe,_0x1f7405,_0x325bc4){return new Agent(_0x18270c,_0x4154fe,_0x1f7405,_0x325bc4);}module[_0xf85e('0x1f')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 496dc39..199551c 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 _0x93bb=['info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','writeLog','RINGING','busy','busyQueue','name','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','hideNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','queue','realtime','squeue','push','bind','handleTimeout','timeout','drained','handleDrained','handleRun','prototype','isNil','length','Agents','agents'];(function(_0x471b40,_0x53c6ef){var _0x3eee63=function(_0x1f6303){while(--_0x1f6303){_0x471b40['push'](_0x471b40['shift']());}};_0x3eee63(++_0x53c6ef);}(_0x93bb,0x135));var _0xb93b=function(_0xa53cc0,_0x552555){_0xa53cc0=_0xa53cc0-0x0;var _0x164825=_0x93bb[_0xa53cc0];return _0x164825;};'use strict';var _=require(_0xb93b('0x0'));var uuid=require(_0xb93b('0x1'));var util=require(_0xb93b('0x2'));var logger=require(_0xb93b('0x3'))(_0xb93b('0x4'));var Beepall=function(_0x9b62ab,_0x3ae317,_0x3d634e,_0x3eb285){this[_0xb93b('0x5')]=uuid['v4']();this['squeue']=_0x9b62ab;this[_0xb93b('0x6')]=_0x3ae317;this[_0xb93b('0x7')]=_0x3d634e;this['routing']=_0x3eb285;this[_0xb93b('0x8')][_0xb93b('0x9')](this['handleRun'][_0xb93b('0xa')](this),this[_0xb93b('0xb')][_0xb93b('0xa')](this));this[_0xb93b('0x8')]['on'](_0xb93b('0xc'),this[_0xb93b('0xb')][_0xb93b('0xa')](this));this[_0xb93b('0x8')]['on'](_0xb93b('0xd'),this[_0xb93b('0xe')][_0xb93b('0xa')](this));};Beepall['prototype'][_0xb93b('0x9')]=function(){this[_0xb93b('0x8')][_0xb93b('0x9')](this[_0xb93b('0xf')]['bind'](this),this[_0xb93b('0xb')][_0xb93b('0xa')](this));};Beepall[_0xb93b('0x10')][_0xb93b('0xe')]=function(_0x172fa1){this[_0xb93b('0xb')](!![]);};Beepall[_0xb93b('0x10')]['handleRun']=function(_0x1155ef){var _0x435eae=!![];if(!_[_0xb93b('0x11')](this[_0xb93b('0x6')])&&!_[_0xb93b('0x11')](this[_0xb93b('0x6')]['Agents'])&&this[_0xb93b('0x6')]['Agents'][_0xb93b('0x12')]>0x0){for(var _0x1f4300=0x0,_0x17b680;_0x1f43000x0){for(var _0xd5b9f1=0x0,_0x4bd6b0;_0xd5b9f10x0&&_0x3450d6[_0x13ec1f+_0xf323('0x27')]>=_0x3450d6[_0x13ec1f+'Capacity']){writeLog(_0x3e1c49,_0x3450d6,_0x13ec1f[_0xf323('0x28')]()+_0xf323('0x29'));return![];}}return!![];};exports['showNotification']=function(_0x46663b,_0x3c95ce,_0x2b6254,_0x3dcf65,_0x46e3b1){return sendNotification(!![],_0x46663b,_0x3c95ce,_0x2b6254,_0x3dcf65,_0x46e3b1);};exports['hideNotification']=function(_0x44c944,_0x34b536,_0x12c7d5,_0x30a5d7,_0x4260f3){return sendNotification(![],_0x44c944,_0x34b536,_0x12c7d5,_0x30a5d7,_0x4260f3);};exports[_0xf323('0x2a')]=writeLog; \ No newline at end of file +var _0x33af=['../../../../../config/logger','routing','redis','localhost','emit','format','user:%s','user:save','split','name','account','notificationShake','body','queue','msg','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','[%s][QUEUE]\x20%s','message','notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','BUSY','online','OFFLINE','Pause','PAUSE','Capacity','hasOwnProperty','CurrentCapacity','\x20MAXCAPACITY','hideNotification','writeLog','util','mustache','ioredis','../../../../../config/environment'];(function(_0x1e9f3a,_0x1906db){var _0x508ea6=function(_0x1ea524){while(--_0x1ea524){_0x1e9f3a['push'](_0x1e9f3a['shift']());}};_0x508ea6(++_0x1906db);}(_0x33af,0xec));var _0xf33a=function(_0x515a41,_0x4c631c){_0x515a41=_0x515a41-0x0;var _0x5a435b=_0x33af[_0x515a41];return _0x5a435b;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var utils=require('../utils');var Mustache=require(_0xf33a('0x1'));var Redis=require(_0xf33a('0x2'));var config=require(_0xf33a('0x3'));var logger=require(_0xf33a('0x4'))(_0xf33a('0x5'));config[_0xf33a('0x6')]=_['defaults'](config[_0xf33a('0x6')],{'host':_0xf33a('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf33a('0x6')]));function emit(_0x384b14,_0x1b2b01,_0x2f3730){io['to'](_0x384b14)[_0xf33a('0x8')](_0x1b2b01,_0x2f3730);}function sendNotification(_0x2cb169,_0x52517f,_0x29bb24,_0x14eb0e,_0x115e08,_0x457b3b){io['to'](util[_0xf33a('0x9')](_0xf33a('0xa'),_0x14eb0e['name']))['emit'](_0xf33a('0xb'),_0x14eb0e);var _0xb47cde=_0x457b3b||{};var _0x170468=_0x29bb24[_0xf33a('0xc')]('.');var _0x338d1b={'uniqueid':_0x52517f,'channel':_0x170468[0x0],'id':_0x170468[0x1],'title':_0x170468[0x0]+'\x20interaction','interactionId':_0x170468[0x2],'queue':_0x115e08?_0x115e08[_0xf33a('0xd')]:null,'sound':_0xb47cde[_0xf33a('0xe')]['notificationSound'],'shake':_0xb47cde['account'][_0xf33a('0xf')]};try{if(!_0xb47cde[_0xf33a('0x10')]){_0xb47cde[_0xf33a('0x10')]={};}if(_0x115e08){_0xb47cde[_0xf33a('0x10')][_0xf33a('0x11')]=_0x115e08;}else if(_0xb47cde[_0xf33a('0x10')][_0xf33a('0x11')]){delete _0xb47cde[_0xf33a('0x10')]['queue'];}_0x338d1b[_0xf33a('0x12')]=utils['getMustacheRender'](_0xb47cde[_0xf33a('0xe')][_0xf33a('0x13')],_0xb47cde);}catch(_0x5138f9){_0x338d1b[_0xf33a('0x12')]=_0xf33a('0x14');logger['error'](util[_0xf33a('0x9')](_0xf33a('0x15'),_0x52517f,_0x5138f9[_0xf33a('0x16')]));}io['to'](util[_0xf33a('0x9')]('user:%s',_0x14eb0e[_0xf33a('0xd')]))[_0xf33a('0x8')](util[_0xf33a('0x9')](_0xf33a('0x17'),_0x2cb169?_0xf33a('0x18'):_0xf33a('0x19')),_0x338d1b);}function writeLog(_0x19986f,_0x288275,_0x19055e){return logger[_0xf33a('0x1a')](util['format'](_0xf33a('0x1b'),_0x19986f,_0x288275[_0xf33a('0xd')],_0x19055e));}exports[_0xf33a('0x1c')]=function(_0x27faa1,_0x2ab756,_0x51d3fd,_0x44654c){if(_0x2ab756['busy']){writeLog(_0x27faa1,_0x2ab756,_0xf33a('0x1d'));return![];}if(!_0x2ab756[_0xf33a('0x1e')]){writeLog(_0x27faa1,_0x2ab756,_0xf33a('0x1f'));return![];}if(_0x2ab756[_0x51d3fd+_0xf33a('0x20')]){writeLog(_0x27faa1,_0x2ab756,_0xf33a('0x21'));return![];}if(_0x44654c&&_0x2ab756['hasOwnProperty'](_0x51d3fd+_0xf33a('0x22'))&&_0x2ab756[_0xf33a('0x23')](_0x51d3fd+'CurrentCapacity')){if(_0x2ab756[_0x51d3fd+'Capacity']>0x0&&_0x2ab756[_0x51d3fd+_0xf33a('0x24')]>=_0x2ab756[_0x51d3fd+'Capacity']){writeLog(_0x27faa1,_0x2ab756,_0x51d3fd['toUpperCase']()+_0xf33a('0x25'));return![];}}return!![];};exports['showNotification']=function(_0x79d653,_0x553480,_0x331115,_0xdc2b34,_0x469741){return sendNotification(!![],_0x79d653,_0x553480,_0x331115,_0xdc2b34,_0x469741);};exports[_0xf33a('0x26')]=function(_0x4552c9,_0x3068a9,_0x1d19ee,_0x1246ff,_0x26e81){return sendNotification(![],_0x4552c9,_0x3068a9,_0x1d19ee,_0x1246ff,_0x26e81);};exports[_0xf33a('0x27')]=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 712aa46..64491b0 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 _0xb3ed=['body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','shelljs','lodash','./utils','../../../../config/logger','routing','consequence','validate','error','[%s][SYSTEM]\x20%s','map','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb3ed,0x173));var _0xdb3e=function(_0x3f1b3f,_0x4df181){_0x3f1b3f=_0x3f1b3f-0x0;var _0x5688e4=_0xb3ed[_0x3f1b3f];return _0x5688e4;};'use strict';var schema=require('validate');var sh=require(_0xdb3e('0x0'));var _=require(_0xdb3e('0x1'));var utils=require(_0xdb3e('0x2'));var logger=require(_0xdb3e('0x3'))(_0xdb3e('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xdb3e('0x5')]=function(_0xc8422e,_0x38d8ce){return function(_0x31fba1){try{var _0x408f9b={'command':_0x38d8ce[0x0]};var _0x430119=system[_0xdb3e('0x6')](_0x408f9b,{'typecast':!![]});if(_0x430119['length']){logger[_0xdb3e('0x7')](_0xdb3e('0x8'),_0xc8422e,_[_0xdb3e('0x9')](_0x430119,_0xdb3e('0xa'))[_0xdb3e('0xb')](',\x20'));logger['info'](_0xdb3e('0xc'),_0xc8422e);_0x31fba1['next']();}else{var _0x460847=this;var _0x4f3843=utils[_0xdb3e('0xd')](_0x38d8ce[0x0],this);logger[_0xdb3e('0xe')](_0xdb3e('0xf'),_0xc8422e,_0x4f3843);sh[_0xdb3e('0x10')](_['trim'](_0x4f3843),function(_0x367c8c,_0x148d9d){logger['info']('[%s][SYSTEM]\x20result\x20code:\x20%s',_0xc8422e,_0x367c8c);if(_0x367c8c==0x0){var _0xa97ab0=_0x148d9d[_0xdb3e('0x11')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x38d8ce[0x1])||_[_0xdb3e('0x12')](_0x38d8ce[0x1])){logger[_0xdb3e('0xe')](_0xdb3e('0x13'),_0xc8422e);_0x460847[_0xdb3e('0x14')][_0x38d8ce[0x1]]=_0xa97ab0;}else{logger[_0xdb3e('0xe')](_0xdb3e('0x15'),_0xc8422e,_0x38d8ce[0x1],_0xa97ab0);_0x460847[_0xdb3e('0x14')][_0x38d8ce[0x1]]=_0xa97ab0;}}_0x31fba1['next']();});}}catch(_0x45d015){logger[_0xdb3e('0x7')]('[%s][SYSTEM]\x20%s',_0xc8422e,_['isObject'](_0x45d015)?JSON['stringify'](_0x45d015):_0x45d015);logger[_0xdb3e('0xe')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0xc8422e);_0x31fba1[_0xdb3e('0x16')]();}};}; \ No newline at end of file +var _0xf6c6=['./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','error','[%s][SYSTEM]\x20%s','stringify','validate','shelljs','lodash'];(function(_0x319df2,_0x4085fb){var _0x41f9df=function(_0x8b9a53){while(--_0x8b9a53){_0x319df2['push'](_0x319df2['shift']());}};_0x41f9df(++_0x4085fb);}(_0xf6c6,0xed));var _0x6f6c=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xf6c6[_0x5f309e];return _0x487b5e;};'use strict';var schema=require(_0x6f6c('0x0'));var sh=require(_0x6f6c('0x1'));var _=require(_0x6f6c('0x2'));var utils=require(_0x6f6c('0x3'));var logger=require('../../../../config/logger')(_0x6f6c('0x4'));var system=schema({'command':{'type':_0x6f6c('0x5'),'required':!![],'message':_0x6f6c('0x6')}});exports[_0x6f6c('0x7')]=function(_0x519ad2,_0x3b30d4){return function(_0x114141){try{var _0x2003ff={'command':_0x3b30d4[0x0]};var _0x4cdcea=system[_0x6f6c('0x0')](_0x2003ff,{'typecast':!![]});if(_0x4cdcea[_0x6f6c('0x8')]){logger['error']('[%s][SYSTEM]\x20%s',_0x519ad2,_['map'](_0x4cdcea,_0x6f6c('0x9'))['join'](',\x20'));logger[_0x6f6c('0xa')](_0x6f6c('0xb'),_0x519ad2);_0x114141['next']();}else{var _0x5765f9=this;var _0x2cc0db=utils['getMustacheRender'](_0x3b30d4[0x0],this);logger[_0x6f6c('0xa')](_0x6f6c('0xc'),_0x519ad2,_0x2cc0db);sh[_0x6f6c('0xd')](_[_0x6f6c('0xe')](_0x2cc0db),function(_0x213ffb,_0x327b41){logger[_0x6f6c('0xa')](_0x6f6c('0xf'),_0x519ad2,_0x213ffb);if(_0x213ffb==0x0){var _0x498e98=_0x327b41['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x6f6c('0x10')](_0x3b30d4[0x1])||_['isEmpty'](_0x3b30d4[0x1])){logger['info'](_0x6f6c('0x11'),_0x519ad2);_0x5765f9[_0x6f6c('0x12')][_0x3b30d4[0x1]]=_0x498e98;}else{logger[_0x6f6c('0xa')](_0x6f6c('0x13'),_0x519ad2,_0x3b30d4[0x1],_0x498e98);_0x5765f9[_0x6f6c('0x12')][_0x3b30d4[0x1]]=_0x498e98;}}_0x114141[_0x6f6c('0x14')]();});}}catch(_0x453c90){logger[_0x6f6c('0x15')](_0x6f6c('0x16'),_0x519ad2,_['isObject'](_0x453c90)?JSON[_0x6f6c('0x17')](_0x453c90):_0x453c90);logger[_0x6f6c('0xa')](_0x6f6c('0xb'),_0x519ad2);_0x114141[_0x6f6c('0x14')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index a176a8d..757f061 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 _0xdfaa=['length','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','[%s][TAG]\x20%s','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','number','consequence'];(function(_0x29268f,_0x17a5dc){var _0x195c54=function(_0x238fa8){while(--_0x238fa8){_0x29268f['push'](_0x29268f['shift']());}};_0x195c54(++_0x17a5dc);}(_0xdfaa,0x6d));var _0xadfa=function(_0x7f6c37,_0x612623){_0x7f6c37=_0x7f6c37-0x0;var _0x37f7db=_0xdfaa[_0x7f6c37];return _0x37f7db;};'use strict';var schema=require(_0xadfa('0x0'));var _=require(_0xadfa('0x1'));var rpc={'chatInteraction':require(_0xadfa('0x2')),'openchannelInteraction':require(_0xadfa('0x3')),'smsInteraction':require(_0xadfa('0x4')),'mailInteraction':require(_0xadfa('0x5')),'faxInteraction':require(_0xadfa('0x6')),'whatsappInteraction':require(_0xadfa('0x7'))};var logger=require(_0xadfa('0x8'))('routing');var tag=schema({'tag':{'type':_0xadfa('0x9'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xadfa('0xa')]=function(_0x5991f5,_0x300436,_0x5bd9e2,_0x56fe09){return function(_0x17b81a){try{var _0x2e3ba1={'tag':_0x300436[0x0]};var _0x47637c=tag[_0xadfa('0x0')](_0x2e3ba1,{'typecast':!![]});if(_0x47637c[_0xadfa('0xb')]){logger['error']('[%s][TAG]\x20%s',_0x5991f5,_[_0xadfa('0xc')](_0x47637c,_0xadfa('0xd'))[_0xadfa('0xe')](',\x20'));logger[_0xadfa('0xf')](_0xadfa('0x10'),_0x5991f5);_0x17b81a[_0xadfa('0x11')]();}else{var _0x5e49a8={'ids':[_0x300436[0x0]]};if(rpc[_0x56fe09[_0xadfa('0x12')]+_0xadfa('0x13')]){rpc[_0x56fe09[_0xadfa('0x12')]+_0xadfa('0x13')][_0xadfa('0x14')](_0x56fe09[_0xadfa('0x15')]['id'],_0x5e49a8)[_0xadfa('0x16')](function(_0x5e1f57){logger['info'](_0xadfa('0x17'),_0x5991f5,_0x300436[0x1],_0x56fe09[_0xadfa('0x12')],_0x56fe09['interaction']['id']);})[_0xadfa('0x18')](function(_0x4a5e31){logger[_0xadfa('0x19')](_0xadfa('0x1a'),_0x5991f5,JSON[_0xadfa('0x1b')](_0x4a5e31));logger[_0xadfa('0xf')](_0xadfa('0x10'),_0x5991f5);})[_0xadfa('0x1c')](function(){_0x17b81a[_0xadfa('0x11')]();});}}}catch(_0xc54e2f){logger[_0xadfa('0x19')](_0xadfa('0x1a'),_0x5991f5,_[_0xadfa('0x1d')](_0xc54e2f)?JSON[_0xadfa('0x1b')](_0xc54e2f):_0xc54e2f);logger[_0xadfa('0xf')](_0xadfa('0x10'),_0x5991f5);_0x17b81a[_0xadfa('0x11')]();}};}; \ No newline at end of file +var _0x5ef4=['validate','length','error','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20%s','stringify','finally','next','isObject','../../rpc/whatsappInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence'];(function(_0x4c9316,_0x5c7f6f){var _0x146aad=function(_0x4fa179){while(--_0x4fa179){_0x4c9316['push'](_0x4c9316['shift']());}};_0x146aad(++_0x5c7f6f);}(_0x5ef4,0x1ef));var _0x45ef=function(_0x270bc0,_0x1a1f86){_0x270bc0=_0x270bc0-0x0;var _0x9b94b1=_0x5ef4[_0x270bc0];return _0x9b94b1;};'use strict';var schema=require('validate');var _=require('lodash');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x45ef('0x0'))};var logger=require('../../../../config/logger')(_0x45ef('0x1'));var tag=schema({'tag':{'type':_0x45ef('0x2'),'required':!![],'message':_0x45ef('0x3')}});exports[_0x45ef('0x4')]=function(_0x2f5a8e,_0x361da5,_0x54c8af,_0x286c5e){return function(_0x4592ab){try{var _0x265162={'tag':_0x361da5[0x0]};var _0x263617=tag[_0x45ef('0x5')](_0x265162,{'typecast':!![]});if(_0x263617[_0x45ef('0x6')]){logger[_0x45ef('0x7')]('[%s][TAG]\x20%s',_0x2f5a8e,_[_0x45ef('0x8')](_0x263617,_0x45ef('0x9'))[_0x45ef('0xa')](',\x20'));logger[_0x45ef('0xb')](_0x45ef('0xc'),_0x2f5a8e);_0x4592ab['next']();}else{var _0x4635df={'ids':[_0x361da5[0x0]]};if(rpc[_0x286c5e[_0x45ef('0xd')]+'Interaction']){rpc[_0x286c5e[_0x45ef('0xd')]+_0x45ef('0xe')][_0x45ef('0xf')](_0x286c5e[_0x45ef('0x10')]['id'],_0x4635df)[_0x45ef('0x11')](function(_0x5e608a){logger[_0x45ef('0xb')](_0x45ef('0x12'),_0x2f5a8e,_0x361da5[0x1],_0x286c5e[_0x45ef('0xd')],_0x286c5e[_0x45ef('0x10')]['id']);})[_0x45ef('0x13')](function(_0x59a0ad){logger[_0x45ef('0x7')](_0x45ef('0x14'),_0x2f5a8e,JSON[_0x45ef('0x15')](_0x59a0ad));logger['info'](_0x45ef('0xc'),_0x2f5a8e);})[_0x45ef('0x16')](function(){_0x4592ab[_0x45ef('0x17')]();});}}}catch(_0x223cdb){logger[_0x45ef('0x7')](_0x45ef('0x14'),_0x2f5a8e,_[_0x45ef('0x18')](_0x223cdb)?JSON[_0x45ef('0x15')](_0x223cdb):_0x223cdb);logger['info'](_0x45ef('0xc'),_0x2f5a8e);_0x4592ab['next']();}};}; \ 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 9eda447..297ac9b 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(_0x4a569c,_0x81fe1b){var _0x8e9d2a=function(_0x2da2ef){while(--_0x2da2ef){_0x4a569c['push'](_0x4a569c['shift']());}};_0x8e9d2a(++_0x81fe1b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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 _0x9c44=['merge','body','account','list','exports','render'];(function(_0x472992,_0x50b9a5){var _0x10f742=function(_0x45cc02){while(--_0x45cc02){_0x472992['push'](_0x472992['shift']());}};_0x10f742(++_0x50b9a5);}(_0x9c44,0x178));var _0x49c4=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x9c44[_0x422905];return _0x33dc6c;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 0111f2e..2b5ef6f 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 _0xf8f4=['../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','IntervalId','isNil','Intervals','map','interval','listen','channel','message','interaction','isArray','applications','length','existsSync','join','app','toLowerCase','autoreply','appdata','split','push','slice','dialogflowv2','amazonlex','tag','TagId','%s:%s:%s','./interval','intervals','./applications/','consequence','info','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','.js','rules','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','error','routing\x20is\x20empty','agent','agents','busyQueue','end','QueueReport','UserId','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','busy','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','available','loggedIn','name','waiting','mailQueues','hasOwnProperty','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','uuid','../../../config/environment'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xf8f4,0x1c6));var _0x4f8f=function(_0xf35672,_0x3833af){_0xf35672=_0xf35672-0x0;var _0x26afcf=_0xf8f4[_0xf35672];return _0x26afcf;};'use strict';var _=require(_0x4f8f('0x0'));var util=require(_0x4f8f('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0x4f8f('0x2'));var BPromise=require(_0x4f8f('0x3'));var uuid=require(_0x4f8f('0x4'));var config=require(_0x4f8f('0x5'));var logger=require(_0x4f8f('0x6'))(_0x4f8f('0x7'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x4f8f('0x8')),'chatQueueReport':require(_0x4f8f('0x9')),'smsQueueReport':require(_0x4f8f('0xa')),'faxQueueReport':require(_0x4f8f('0xb')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x4f8f('0xc'));function getId(_0x5f3309,_0x46b303,_0xb441aa){return util[_0x4f8f('0xd')]('%s.%s.%s',_0x5f3309,_0x46b303||0x0,_0xb441aa||0x0);}function getIntervals(_0x24847d,_0x54fca2){var _0x114c99=[];if(!_['isNil'](_0x54fca2[_0x4f8f('0xe')])&&!_[_0x4f8f('0xf')](_0x24847d[_0x54fca2[_0x4f8f('0xe')]])&&!_[_0x4f8f('0xf')](_0x24847d[_0x54fca2[_0x4f8f('0xe')]][_0x4f8f('0x10')])){_0x114c99=_[_0x4f8f('0x11')](_0x24847d[_0x54fca2[_0x4f8f('0xe')]]['Intervals'],'interval');}else if(!_[_0x4f8f('0xf')](_0x54fca2['interval'])){_0x114c99=[_0x54fca2[_0x4f8f('0x12')]];}return _0x114c99;}exports[_0x4f8f('0x13')]=function(_0x23aada){_0x23aada['rules']={};return new BPromise(function(_0x1d8a27,_0x19dd75){var _0x57fae7={'Start':function(_0x5d5533){var _0xec3db2=this;return new Promise(function(_0x3137bb,_0x4131a7){if(_0x5d5533){try{var _0x59dd92=[];var _0x3529e0=getId(_0x5d5533[_0x4f8f('0x14')],_0x5d5533['message']?_0x5d5533[_0x4f8f('0x15')]['id']:0x0,_0x5d5533[_0x4f8f('0x16')]?_0x5d5533['interaction']['id']:0x0);if(_0x5d5533['applications']&&_[_0x4f8f('0x17')](_0x5d5533[_0x4f8f('0x18')])&&_0x5d5533[_0x4f8f('0x18')][_0x4f8f('0x19')]){for(var _0x4470b3=0x0;_0x4470b3<_0x5d5533[_0x4f8f('0x18')][_0x4f8f('0x19')];_0x4470b3+=0x1){var _0x1f00ec=_0x5d5533[_0x4f8f('0x18')][_0x4470b3];if(fs[_0x4f8f('0x1a')](path[_0x4f8f('0x1b')](__dirname,'applications',_0x1f00ec[_0x4f8f('0x1c')]+'.js'))){var _0x4248b7=[];switch(_0x1f00ec[_0x4f8f('0x1c')][_0x4f8f('0x1d')]()){case _0x4f8f('0x1e'):var _0x352b7a=_0x1f00ec[_0x4f8f('0x1f')][_0x4f8f('0x20')](',');if(_0x5d5533[_0x4f8f('0x14')]==='mail'){_0x4248b7[_0x4f8f('0x21')](_0x352b7a[0x0]);_0x4248b7[_0x4f8f('0x21')](_0x352b7a[0x1]);_0x4248b7[_0x4f8f('0x21')](_0x352b7a['slice'](0x2,_0x352b7a[_0x4f8f('0x19')])[_0x4f8f('0x1b')](','));}else{_0x4248b7[_0x4f8f('0x21')](_0x352b7a[0x0]);_0x4248b7[_0x4f8f('0x21')](_0x352b7a[_0x4f8f('0x22')](0x1,_0x352b7a[_0x4f8f('0x19')])[_0x4f8f('0x1b')](','));}break;case'dialogflow':var _0x5ab3e6=_0x1f00ec[_0x4f8f('0x1f')]['split'](',');_0x4248b7[_0x4f8f('0x21')](_0x5ab3e6[0x0]);_0x4248b7[_0x4f8f('0x21')](_0x5ab3e6[0x1]);_0x4248b7[_0x4f8f('0x21')](_0x5ab3e6[_0x4f8f('0x22')](0x2,_0x5ab3e6[_0x4f8f('0x19')])[_0x4f8f('0x1b')](','));break;case _0x4f8f('0x23'):var _0x171e95=_0x1f00ec[_0x4f8f('0x1f')]['split'](',');_0x4248b7['push'](_0x171e95[0x0]);_0x4248b7[_0x4f8f('0x21')](_0x171e95[0x1]);_0x4248b7[_0x4f8f('0x21')](_0x171e95[0x2]);_0x4248b7[_0x4f8f('0x21')](_0x171e95[0x3]);_0x4248b7[_0x4f8f('0x21')](_0x171e95[_0x4f8f('0x22')](0x4,_0x171e95[_0x4f8f('0x19')])[_0x4f8f('0x1b')](','));break;case _0x4f8f('0x24'):var _0x549aab=_0x1f00ec[_0x4f8f('0x1f')][_0x4f8f('0x20')](',');_0x4248b7[_0x4f8f('0x21')](_0x549aab[0x0]);_0x4248b7['push'](_0x549aab[0x1]);_0x4248b7[_0x4f8f('0x21')](_0x549aab[0x2]);_0x4248b7[_0x4f8f('0x21')](_0x549aab[0x3]);_0x4248b7[_0x4f8f('0x21')](_0x549aab[_0x4f8f('0x22')](0x4,_0x549aab[_0x4f8f('0x19')])[_0x4f8f('0x1b')](','));break;case _0x4f8f('0x15'):_0x4248b7[_0x4f8f('0x21')](_0x1f00ec[_0x4f8f('0x1f')]);break;case _0x4f8f('0x25'):_0x4248b7[_0x4f8f('0x21')](_0x1f00ec[_0x4f8f('0x26')]);_0x4248b7[_0x4f8f('0x21')](_0x1f00ec['appdata']);break;default:_0x4248b7=_[_0x4f8f('0xf')](_0x1f00ec[_0x4f8f('0x1f')])?[]:_0x1f00ec[_0x4f8f('0x1f')]['split'](',');}var _0x124ee3={'id':util['format'](_0x4f8f('0x27'),_0x3529e0,_0x1f00ec['id'],_0x1f00ec[_0x4f8f('0x1c')]),'condition':require(_0x4f8f('0x28'))['condition'](_0x3529e0,getIntervals(_0x23aada[_0x4f8f('0x29')],_0x1f00ec),_0x23aada),'consequence':require(_0x4f8f('0x2a')+_0x1f00ec[_0x4f8f('0x1c')])[_0x4f8f('0x2b')](_0x3529e0,_0x4248b7,_0x23aada,_0x5d5533),'p':_0x1f00ec['priority']||0x0};logger[_0x4f8f('0x2c')]('Push\x20new\x20rule',_0x124ee3['id'],'on\x20interval',getIntervals(_0x23aada[_0x4f8f('0x29')],_0x1f00ec)['join'](_0x4f8f('0x2d')));_0x59dd92[_0x4f8f('0x21')](_0x124ee3);}else{logger['error'](_0x4f8f('0x2e'),path[_0x4f8f('0x1b')](__dirname,_0x4f8f('0x18'),_0x1f00ec[_0x4f8f('0x1c')]+_0x4f8f('0x2f')));}}_0x23aada[_0x4f8f('0x30')][_0x3529e0]=new RuleEngine(_0x59dd92);_0x23aada[_0x4f8f('0x30')][_0x3529e0]['execute'](_0x5d5533,function(_0x5e86e5){logger['info'](_0x4f8f('0x31'),JSON[_0x4f8f('0x32')](_0x5e86e5[_0x4f8f('0x33')]));if(_0x23aada[_0x4f8f('0x30')][_0x3529e0]){_0x23aada[_0x4f8f('0x30')][_0x3529e0][_0x4f8f('0x34')](_0x4f8f('0x35'));}});return _0x3137bb({'code':0xc8,'message':_0x5d5533});}else{logger[_0x4f8f('0x2c')](_0x4f8f('0x36'));return _0x3137bb({'code':0xc8,'message':_0x5d5533});}}catch(_0x1a876c){logger['error'](_0x1a876c['stack']);return _0x4131a7(_0xec3db2[_0x4f8f('0x37')](0x1f4,_0x1a876c));}}return _0x4131a7(_0x4f8f('0x38'));});},'AcceptMessage':function(_0xb5e35a){var _0x1254e2=this;return new Promise(function(_0x9e26db,_0x5bb546){if(_0xb5e35a[_0x4f8f('0x39')]&&_0xb5e35a[_0x4f8f('0x39')]['id']){if(_0x23aada[_0x4f8f('0x3a')][_0xb5e35a[_0x4f8f('0x39')]['id']]){_0x23aada[_0x4f8f('0x3a')][_0xb5e35a[_0x4f8f('0x39')]['id']]['busy']=![];_0x23aada[_0x4f8f('0x3a')][_0xb5e35a['agent']['id']][_0x4f8f('0x3b')]=undefined;}}if(_0xb5e35a[_0x4f8f('0x15')]&&_0xb5e35a[_0x4f8f('0x15')]['id']){try{var _0x1a3848=getId(_0xb5e35a[_0x4f8f('0x14')],_0xb5e35a['message']?_0xb5e35a[_0x4f8f('0x15')]['id']:0x0,_0xb5e35a[_0x4f8f('0x16')]?_0xb5e35a['interaction']['id']:0x0);if(_0x23aada[_0x4f8f('0x30')][_0x1a3848]){_0x23aada[_0x4f8f('0x30')][_0x1a3848][_0x4f8f('0x34')](_0x4f8f('0x3c'));if(rpc[_0xb5e35a[_0x4f8f('0x14')]+_0x4f8f('0x3d')]){rpc[_0xb5e35a['channel']+'QueueReport']['update'](_0x1a3848,{'UserId':_0xb5e35a[_0x4f8f('0x15')][_0x4f8f('0x3e')]})['catch'](function(_0xe21c06){logger[_0x4f8f('0x37')](_0x4f8f('0x3f'));});}}return _0x9e26db({'code':0xc8,'message':_0xb5e35a});}catch(_0x5cebcb){logger['error'](_0x5cebcb[_0x4f8f('0x40')]);return _0x5bb546(_0x1254e2['error'](0x1f4,_0x5cebcb));}}logger[_0x4f8f('0x37')](_0x4f8f('0x41'));return _0x5bb546(_0x1254e2[_0x4f8f('0x37')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x2a033a){var _0x5f48f7=this;return new Promise(function(_0x35be03,_0xf1111f){if(_0x2a033a[_0x4f8f('0x39')]&&_0x2a033a[_0x4f8f('0x39')]['id']){try{if(_0x23aada[_0x4f8f('0x3a')][_0x2a033a[_0x4f8f('0x39')]['id']]){_0x23aada[_0x4f8f('0x3a')][_0x2a033a['agent']['id']][_0x4f8f('0x42')]=![];_0x23aada[_0x4f8f('0x3a')][_0x2a033a['agent']['id']][_0x4f8f('0x3b')]=undefined;}return _0x35be03({'code':0xc8,'message':_0x2a033a});}catch(_0x89bf2){logger[_0x4f8f('0x37')](_0x89bf2['stack']);return _0xf1111f(_0x5f48f7[_0x4f8f('0x37')](0x1f4,_0x89bf2));}}logger[_0x4f8f('0x37')](_0x4f8f('0x41'));return _0xf1111f(_0x5f48f7[_0x4f8f('0x37')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0xe245b2){var _0xa8bbab=this;return new Promise(function(_0x55c961,_0x4fc859){if(_0xe245b2['channel']&&_0xe245b2['interaction']&&_0xe245b2[_0x4f8f('0x16')]['id']){try{var _0x47e952=getId(_0xe245b2[_0x4f8f('0x14')],_0xe245b2[_0x4f8f('0x15')]?_0xe245b2['message']['id']:0x0,_0xe245b2[_0x4f8f('0x16')]?_0xe245b2[_0x4f8f('0x16')]['id']:0x0);if(_0x23aada[_0x4f8f('0x30')][_0x47e952]){_0x23aada[_0x4f8f('0x30')][_0x47e952][_0x4f8f('0x34')]('end');}return _0x55c961({'code':0xc8,'message':_0xe245b2});}catch(_0x52870f){logger['error'](_0x52870f[_0x4f8f('0x40')]);return _0x4fc859(_0xa8bbab[_0x4f8f('0x37')](0x1f4,_0x52870f));}}logger[_0x4f8f('0x37')]('message\x20is\x20empty');return _0x4fc859(_0xa8bbab[_0x4f8f('0x37')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0xfb854b){var _0x3af639=this;return new Promise(function(_0x28f047,_0x20e7d4){if(_0x23aada[_0x4f8f('0x3a')]['hasOwnProperty'](_0xfb854b['id'])){for(var _0x5ce825 in _0xfb854b[_0x4f8f('0x43')]){if(_0xfb854b[_0x4f8f('0x43')]['hasOwnProperty'](_0x5ce825)){if(_0x23aada[_0x4f8f('0x3a')][_0xfb854b['id']]['hasOwnProperty'](_0x5ce825+_0x4f8f('0x44'))){_0x23aada['agents'][_0xfb854b['id']][_0x5ce825+_0x4f8f('0x44')]=parseInt(_0xfb854b['capacity'][_0x5ce825],0xa);}}}_0x23aada[_0x4f8f('0x3a')][_0xfb854b['id']][_0x4f8f('0x45')]();return _0x28f047({'code':0xc8,'message':_0x23aada[_0x4f8f('0x3a')][_0xfb854b['id']]});}else{return _0x20e7d4(_0x3af639['error'](0x1f4,_0x4f8f('0x46')));}});},'Agents':function(_0x41c40e){return new Promise(function(_0x215098,_0x526e01){var _0x5643ec=_['values'](_0x23aada[_0x4f8f('0x3a')]);_0x215098({'count':_0x5643ec[_0x4f8f('0x19')],'rows':_0x5643ec});});},'ChatQueues':function(_0x408067){return new Promise(function(_0x1cff86,_0x42692b){var _0x403dfe=[];for(var _0x2d7dea in _0x23aada[_0x4f8f('0x47')]){if(_0x23aada[_0x4f8f('0x47')]['hasOwnProperty'](_0x2d7dea)){var _0x2c8a2c=_0x23aada['chatQueues'][_0x2d7dea];var _0x44b9f9={'id':_0x2c8a2c['id'],'available':_0x2c8a2c[_0x4f8f('0x48')],'loggedIn':_0x2c8a2c[_0x4f8f('0x49')],'name':_0x2c8a2c[_0x4f8f('0x4a')],'paused':_0x2c8a2c['paused'],'waiting':_0x2c8a2c[_0x4f8f('0x4b')]};_0x403dfe[_0x4f8f('0x21')](_0x44b9f9);}}_0x1cff86({'count':_0x403dfe[_0x4f8f('0x19')],'rows':_0x403dfe});});},'MailQueues':function(_0x2a5371){return new Promise(function(_0x41d815,_0x4060f8){var _0x28b15b=[];for(var _0x5e67ff in _0x23aada[_0x4f8f('0x4c')]){if(_0x23aada[_0x4f8f('0x4c')][_0x4f8f('0x4d')](_0x5e67ff)){var _0x4415ca=_0x23aada[_0x4f8f('0x4c')][_0x5e67ff];var _0x4cb581={'id':_0x4415ca['id'],'available':_0x4415ca[_0x4f8f('0x48')],'loggedIn':_0x4415ca[_0x4f8f('0x49')],'name':_0x4415ca[_0x4f8f('0x4a')],'paused':_0x4415ca[_0x4f8f('0x4e')],'waiting':_0x4415ca['waiting']};_0x28b15b[_0x4f8f('0x21')](_0x4cb581);}}_0x41d815({'count':_0x28b15b['length'],'rows':_0x28b15b});});},'OpenchannelQueues':function(_0x1a91a0){return new Promise(function(_0x21eef1,_0x3dd462){var _0x279acb=[];for(var _0x494c48 in _0x23aada[_0x4f8f('0x4f')]){if(_0x23aada[_0x4f8f('0x4f')][_0x4f8f('0x4d')](_0x494c48)){var _0x2e6973=_0x23aada[_0x4f8f('0x4f')][_0x494c48];var _0x3c199e={'id':_0x2e6973['id'],'available':_0x2e6973[_0x4f8f('0x48')],'loggedIn':_0x2e6973[_0x4f8f('0x49')],'name':_0x2e6973['name'],'paused':_0x2e6973[_0x4f8f('0x4e')],'waiting':_0x2e6973[_0x4f8f('0x4b')]};_0x279acb[_0x4f8f('0x21')](_0x3c199e);}}_0x21eef1({'count':_0x279acb[_0x4f8f('0x19')],'rows':_0x279acb});});},'SmsQueues':function(_0x56ab78){return new Promise(function(_0x5dd9d2,_0x589b86){var _0x11116e=[];for(var _0x42f83a in _0x23aada[_0x4f8f('0x50')]){if(_0x23aada[_0x4f8f('0x50')]['hasOwnProperty'](_0x42f83a)){var _0x409890=_0x23aada[_0x4f8f('0x50')][_0x42f83a];var _0x193b50={'id':_0x409890['id'],'available':_0x409890[_0x4f8f('0x48')],'loggedIn':_0x409890[_0x4f8f('0x49')],'name':_0x409890[_0x4f8f('0x4a')],'paused':_0x409890['paused'],'waiting':_0x409890[_0x4f8f('0x4b')]};_0x11116e[_0x4f8f('0x21')](_0x193b50);}}_0x5dd9d2({'count':_0x11116e[_0x4f8f('0x19')],'rows':_0x11116e});});},'FaxQueues':function(_0x1a6bfe){return new Promise(function(_0x16a1fc,_0x26a1bb){var _0x113eb8=[];for(var _0x35bb1f in _0x23aada[_0x4f8f('0x51')]){if(_0x23aada[_0x4f8f('0x51')][_0x4f8f('0x4d')](_0x35bb1f)){var _0x5c23b7=_0x23aada[_0x4f8f('0x51')][_0x35bb1f];var _0xf604d7={'id':_0x5c23b7['id'],'available':_0x5c23b7[_0x4f8f('0x48')],'loggedIn':_0x5c23b7[_0x4f8f('0x49')],'name':_0x5c23b7['name'],'paused':_0x5c23b7[_0x4f8f('0x4e')],'waiting':_0x5c23b7[_0x4f8f('0x4b')]};_0x113eb8['push'](_0xf604d7);}}_0x16a1fc({'count':_0x113eb8[_0x4f8f('0x19')],'rows':_0x113eb8});});},'WhatsappQueues':function(_0x5ecf7c){return new Promise(function(_0x44a93d,_0x741117){var _0x3450d1=[];for(var _0x3cdc3b in _0x23aada['whatsappQueues']){if(_0x23aada[_0x4f8f('0x52')][_0x4f8f('0x4d')](_0x3cdc3b)){var _0x5170bf=_0x23aada['whatsappQueues'][_0x3cdc3b];var _0x2a0c85={'id':_0x5170bf['id'],'available':_0x5170bf[_0x4f8f('0x48')],'loggedIn':_0x5170bf[_0x4f8f('0x49')],'name':_0x5170bf[_0x4f8f('0x4a')],'paused':_0x5170bf['paused'],'waiting':_0x5170bf[_0x4f8f('0x4b')]};_0x3450d1[_0x4f8f('0x21')](_0x2a0c85);}}_0x44a93d({'count':_0x3450d1[_0x4f8f('0x19')],'rows':_0x3450d1});});},'ChatQueuesWaitingInteractions':function(_0x29cafd){return new Promise(function(_0x71c4c,_0x1e2fca){var _0x22267a=_[_0x4f8f('0x53')](_0x23aada[_0x4f8f('0x54')]);_0x71c4c({'count':_0x22267a[_0x4f8f('0x19')],'rows':_0x22267a});});},'MailQueuesWaitingInteractions':function(_0x5818d0){return new Promise(function(_0x28568a,_0x1c23d4){var _0x5c3387=_[_0x4f8f('0x53')](_0x23aada[_0x4f8f('0x55')]);_0x28568a({'count':_0x5c3387[_0x4f8f('0x19')],'rows':_0x5c3387});});},'OpenchannelQueuesWaitingInteractions':function(_0x4090f5){return new Promise(function(_0x526846,_0x30f7da){var _0x5a017a=_['values'](_0x23aada[_0x4f8f('0x56')]);_0x526846({'count':_0x5a017a[_0x4f8f('0x19')],'rows':_0x5a017a});});},'SmsQueuesWaitingInteractions':function(_0x29b3a9){return new Promise(function(_0x47cdcf,_0x4732ab){var _0x596536=_['values'](_0x23aada['smsQueuesWaitingInteractions']);_0x47cdcf({'count':_0x596536['length'],'rows':_0x596536});});},'FaxQueuesWaitingInteractions':function(_0x337fb8){return new Promise(function(_0x428e75,_0x28a801){var _0x3fbcfd=_[_0x4f8f('0x53')](_0x23aada[_0x4f8f('0x57')]);_0x428e75({'count':_0x3fbcfd['length'],'rows':_0x3fbcfd});});},'WhatsappQueuesWaitingInteractions':function(_0x57a187){return new Promise(function(_0x5a55d3,_0x27ec9b){var _0x3b6b1c=_[_0x4f8f('0x53')](_0x23aada[_0x4f8f('0x58')]);_0x5a55d3({'count':_0x3b6b1c[_0x4f8f('0x19')],'rows':_0x3b6b1c});});}};var _0x476ec1=jayson[_0x4f8f('0x59')](_0x57fae7)['http']();_0x476ec1['on'](_0x4f8f('0x37'),function(_0x49494e){logger[_0x4f8f('0x37')](JSON[_0x4f8f('0x32')](_0x49494e));return _0x19dd75(_0x49494e);});_0x476ec1[_0x4f8f('0x13')](0x232c,'127.0.0.1',function(){console[_0x4f8f('0x5a')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x1d8a27(_0x4f8f('0x5b')+0x232c);});});}; \ No newline at end of file +var _0x96bf=['Applications\x20executed','matchPath','emit','complete','No\x20applications\x20to\x20execute','error','stack','agent','busy','agents','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busyQueue','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','stringify','log','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','bluebird','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','applications','length','join','app','.js','toLowerCase','autoreply','appdata','mail','push','slice','dialogflow','split','dialogflowv2','amazonlex','TagId','format','./interval','consequence','priority','Push\x20new\x20rule','intervals','Please\x20create\x20a\x20new\x20file\x20under','info'];(function(_0x98d5fb,_0x22a6b1){var _0x545f94=function(_0x54dcb5){while(--_0x54dcb5){_0x98d5fb['push'](_0x98d5fb['shift']());}};_0x545f94(++_0x22a6b1);}(_0x96bf,0x13d));var _0xf96b=function(_0x43f489,_0x2b4fea){_0x43f489=_0x43f489-0x0;var _0x4134b4=_0x96bf[_0x43f489];return _0x4134b4;};'use strict';var _=require('lodash');var util=require(_0xf96b('0x0'));var path=require(_0xf96b('0x1'));var fs=require('fs');var jayson=require(_0xf96b('0x2'));var BPromise=require(_0xf96b('0x3'));var uuid=require('uuid');var config=require(_0xf96b('0x4'));var logger=require(_0xf96b('0x5'))(_0xf96b('0x6'));var rpc={'openchannelQueueReport':require(_0xf96b('0x7')),'mailQueueReport':require(_0xf96b('0x8')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0xf96b('0x9')),'faxQueueReport':require(_0xf96b('0xa')),'whatsappQueueReport':require(_0xf96b('0xb'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x575613,_0x205add,_0x1afd9c){return util['format'](_0xf96b('0xc'),_0x575613,_0x205add||0x0,_0x1afd9c||0x0);}function getIntervals(_0x20c4bb,_0x5babf6){var _0x40f85a=[];if(!_[_0xf96b('0xd')](_0x5babf6[_0xf96b('0xe')])&&!_[_0xf96b('0xd')](_0x20c4bb[_0x5babf6[_0xf96b('0xe')]])&&!_[_0xf96b('0xd')](_0x20c4bb[_0x5babf6[_0xf96b('0xe')]][_0xf96b('0xf')])){_0x40f85a=_[_0xf96b('0x10')](_0x20c4bb[_0x5babf6[_0xf96b('0xe')]][_0xf96b('0xf')],_0xf96b('0x11'));}else if(!_[_0xf96b('0xd')](_0x5babf6[_0xf96b('0x11')])){_0x40f85a=[_0x5babf6[_0xf96b('0x11')]];}return _0x40f85a;}exports[_0xf96b('0x12')]=function(_0x17dac8){_0x17dac8[_0xf96b('0x13')]={};return new BPromise(function(_0x3de221,_0x20bee9){var _0x276a40={'Start':function(_0x36a10a){var _0x5d934c=this;return new Promise(function(_0x583129,_0x207a35){if(_0x36a10a){try{var _0xc68166=[];var _0x37fede=getId(_0x36a10a[_0xf96b('0x14')],_0x36a10a[_0xf96b('0x15')]?_0x36a10a['message']['id']:0x0,_0x36a10a[_0xf96b('0x16')]?_0x36a10a[_0xf96b('0x16')]['id']:0x0);if(_0x36a10a['applications']&&_['isArray'](_0x36a10a['applications'])&&_0x36a10a[_0xf96b('0x17')]['length']){for(var _0x44abf0=0x0;_0x44abf0<_0x36a10a['applications'][_0xf96b('0x18')];_0x44abf0+=0x1){var _0x4b863b=_0x36a10a['applications'][_0x44abf0];if(fs['existsSync'](path[_0xf96b('0x19')](__dirname,_0xf96b('0x17'),_0x4b863b[_0xf96b('0x1a')]+_0xf96b('0x1b')))){var _0x1119b0=[];switch(_0x4b863b[_0xf96b('0x1a')][_0xf96b('0x1c')]()){case _0xf96b('0x1d'):var _0xbc390e=_0x4b863b[_0xf96b('0x1e')]['split'](',');if(_0x36a10a[_0xf96b('0x14')]===_0xf96b('0x1f')){_0x1119b0[_0xf96b('0x20')](_0xbc390e[0x0]);_0x1119b0[_0xf96b('0x20')](_0xbc390e[0x1]);_0x1119b0[_0xf96b('0x20')](_0xbc390e[_0xf96b('0x21')](0x2,_0xbc390e[_0xf96b('0x18')])[_0xf96b('0x19')](','));}else{_0x1119b0[_0xf96b('0x20')](_0xbc390e[0x0]);_0x1119b0[_0xf96b('0x20')](_0xbc390e[_0xf96b('0x21')](0x1,_0xbc390e[_0xf96b('0x18')])['join'](','));}break;case _0xf96b('0x22'):var _0x276fc1=_0x4b863b[_0xf96b('0x1e')][_0xf96b('0x23')](',');_0x1119b0['push'](_0x276fc1[0x0]);_0x1119b0['push'](_0x276fc1[0x1]);_0x1119b0[_0xf96b('0x20')](_0x276fc1['slice'](0x2,_0x276fc1['length'])[_0xf96b('0x19')](','));break;case _0xf96b('0x24'):var _0x33d012=_0x4b863b[_0xf96b('0x1e')][_0xf96b('0x23')](',');_0x1119b0[_0xf96b('0x20')](_0x33d012[0x0]);_0x1119b0['push'](_0x33d012[0x1]);_0x1119b0[_0xf96b('0x20')](_0x33d012[0x2]);_0x1119b0[_0xf96b('0x20')](_0x33d012[0x3]);_0x1119b0[_0xf96b('0x20')](_0x33d012[_0xf96b('0x21')](0x4,_0x33d012[_0xf96b('0x18')])[_0xf96b('0x19')](','));break;case _0xf96b('0x25'):var _0x2adca0=_0x4b863b[_0xf96b('0x1e')][_0xf96b('0x23')](',');_0x1119b0[_0xf96b('0x20')](_0x2adca0[0x0]);_0x1119b0[_0xf96b('0x20')](_0x2adca0[0x1]);_0x1119b0[_0xf96b('0x20')](_0x2adca0[0x2]);_0x1119b0['push'](_0x2adca0[0x3]);_0x1119b0['push'](_0x2adca0[_0xf96b('0x21')](0x4,_0x2adca0['length'])['join'](','));break;case _0xf96b('0x15'):_0x1119b0[_0xf96b('0x20')](_0x4b863b[_0xf96b('0x1e')]);break;case'tag':_0x1119b0[_0xf96b('0x20')](_0x4b863b[_0xf96b('0x26')]);_0x1119b0[_0xf96b('0x20')](_0x4b863b[_0xf96b('0x1e')]);break;default:_0x1119b0=_[_0xf96b('0xd')](_0x4b863b[_0xf96b('0x1e')])?[]:_0x4b863b[_0xf96b('0x1e')]['split'](',');}var _0x3ee049={'id':util[_0xf96b('0x27')]('%s:%s:%s',_0x37fede,_0x4b863b['id'],_0x4b863b[_0xf96b('0x1a')]),'condition':require(_0xf96b('0x28'))['condition'](_0x37fede,getIntervals(_0x17dac8['intervals'],_0x4b863b),_0x17dac8),'consequence':require('./applications/'+_0x4b863b[_0xf96b('0x1a')])[_0xf96b('0x29')](_0x37fede,_0x1119b0,_0x17dac8,_0x36a10a),'p':_0x4b863b[_0xf96b('0x2a')]||0x0};logger['info'](_0xf96b('0x2b'),_0x3ee049['id'],'on\x20interval',getIntervals(_0x17dac8[_0xf96b('0x2c')],_0x4b863b)[_0xf96b('0x19')]('\x20|\x20'));_0xc68166[_0xf96b('0x20')](_0x3ee049);}else{logger['error'](_0xf96b('0x2d'),path[_0xf96b('0x19')](__dirname,'applications',_0x4b863b[_0xf96b('0x1a')]+'.js'));}}_0x17dac8[_0xf96b('0x13')][_0x37fede]=new RuleEngine(_0xc68166);_0x17dac8[_0xf96b('0x13')][_0x37fede]['execute'](_0x36a10a,function(_0x26ecc4){logger[_0xf96b('0x2e')](_0xf96b('0x2f'),JSON['stringify'](_0x26ecc4[_0xf96b('0x30')]));if(_0x17dac8[_0xf96b('0x13')][_0x37fede]){_0x17dac8['rules'][_0x37fede][_0xf96b('0x31')](_0xf96b('0x32'));}});return _0x583129({'code':0xc8,'message':_0x36a10a});}else{logger['info'](_0xf96b('0x33'));return _0x583129({'code':0xc8,'message':_0x36a10a});}}catch(_0x438edb){logger[_0xf96b('0x34')](_0x438edb[_0xf96b('0x35')]);return _0x207a35(_0x5d934c[_0xf96b('0x34')](0x1f4,_0x438edb));}}return _0x207a35('routing\x20is\x20empty');});},'AcceptMessage':function(_0x5327da){var _0xf3a96f=this;return new Promise(function(_0x432eb3,_0x5eca3c){if(_0x5327da['agent']&&_0x5327da[_0xf96b('0x36')]['id']){if(_0x17dac8['agents'][_0x5327da[_0xf96b('0x36')]['id']]){_0x17dac8['agents'][_0x5327da['agent']['id']][_0xf96b('0x37')]=![];_0x17dac8[_0xf96b('0x38')][_0x5327da[_0xf96b('0x36')]['id']]['busyQueue']=undefined;}}if(_0x5327da[_0xf96b('0x15')]&&_0x5327da[_0xf96b('0x15')]['id']){try{var _0x42c0e0=getId(_0x5327da[_0xf96b('0x14')],_0x5327da[_0xf96b('0x15')]?_0x5327da[_0xf96b('0x15')]['id']:0x0,_0x5327da[_0xf96b('0x16')]?_0x5327da[_0xf96b('0x16')]['id']:0x0);if(_0x17dac8[_0xf96b('0x13')][_0x42c0e0]){_0x17dac8[_0xf96b('0x13')][_0x42c0e0][_0xf96b('0x31')]('end');if(rpc[_0x5327da[_0xf96b('0x14')]+_0xf96b('0x39')]){rpc[_0x5327da[_0xf96b('0x14')]+_0xf96b('0x39')][_0xf96b('0x3a')](_0x42c0e0,{'UserId':_0x5327da[_0xf96b('0x15')][_0xf96b('0x3b')]})[_0xf96b('0x3c')](function(_0x27e3d3){logger[_0xf96b('0x34')](_0xf96b('0x3d'));});}}return _0x432eb3({'code':0xc8,'message':_0x5327da});}catch(_0x2f1acf){logger['error'](_0x2f1acf[_0xf96b('0x35')]);return _0x5eca3c(_0xf3a96f[_0xf96b('0x34')](0x1f4,_0x2f1acf));}}logger['error']('message\x20is\x20empty');return _0x5eca3c(_0xf3a96f[_0xf96b('0x34')](0x1f4,_0xf96b('0x3e')));});},'RejectMessage':function(_0x48aef4){var _0x1b9fb9=this;return new Promise(function(_0x2766a0,_0x248397){if(_0x48aef4['agent']&&_0x48aef4[_0xf96b('0x36')]['id']){try{if(_0x17dac8[_0xf96b('0x38')][_0x48aef4[_0xf96b('0x36')]['id']]){_0x17dac8['agents'][_0x48aef4[_0xf96b('0x36')]['id']][_0xf96b('0x37')]=![];_0x17dac8[_0xf96b('0x38')][_0x48aef4[_0xf96b('0x36')]['id']][_0xf96b('0x3f')]=undefined;}return _0x2766a0({'code':0xc8,'message':_0x48aef4});}catch(_0xe180ac){logger[_0xf96b('0x34')](_0xe180ac[_0xf96b('0x35')]);return _0x248397(_0x1b9fb9[_0xf96b('0x34')](0x1f4,_0xe180ac));}}logger['error']('message\x20is\x20empty');return _0x248397(_0x1b9fb9[_0xf96b('0x34')](0x1f4,_0xf96b('0x3e')));});},'AbandonInteraction':function(_0x464e37){var _0x1b424f=this;return new Promise(function(_0x255ff9,_0x59ec95){if(_0x464e37['channel']&&_0x464e37[_0xf96b('0x16')]&&_0x464e37[_0xf96b('0x16')]['id']){try{var _0x1f96be=getId(_0x464e37[_0xf96b('0x14')],_0x464e37[_0xf96b('0x15')]?_0x464e37[_0xf96b('0x15')]['id']:0x0,_0x464e37[_0xf96b('0x16')]?_0x464e37[_0xf96b('0x16')]['id']:0x0);if(_0x17dac8[_0xf96b('0x13')][_0x1f96be]){_0x17dac8['rules'][_0x1f96be][_0xf96b('0x31')](_0xf96b('0x40'));}return _0x255ff9({'code':0xc8,'message':_0x464e37});}catch(_0x43a2c0){logger[_0xf96b('0x34')](_0x43a2c0[_0xf96b('0x35')]);return _0x59ec95(_0x1b424f[_0xf96b('0x34')](0x1f4,_0x43a2c0));}}logger[_0xf96b('0x34')](_0xf96b('0x3e'));return _0x59ec95(_0x1b424f['error'](0x1f4,_0xf96b('0x3e')));});},'AgentCapacity':function(_0x295376){var _0x37614e=this;return new Promise(function(_0x4eb396,_0x1ba2c5){if(_0x17dac8[_0xf96b('0x38')][_0xf96b('0x41')](_0x295376['id'])){for(var _0x144d45 in _0x295376['capacity']){if(_0x295376[_0xf96b('0x42')]['hasOwnProperty'](_0x144d45)){if(_0x17dac8['agents'][_0x295376['id']][_0xf96b('0x41')](_0x144d45+_0xf96b('0x43'))){_0x17dac8[_0xf96b('0x38')][_0x295376['id']][_0x144d45+_0xf96b('0x43')]=parseInt(_0x295376['capacity'][_0x144d45],0xa);}}}_0x17dac8[_0xf96b('0x38')][_0x295376['id']][_0xf96b('0x44')]();return _0x4eb396({'code':0xc8,'message':_0x17dac8[_0xf96b('0x38')][_0x295376['id']]});}else{return _0x1ba2c5(_0x37614e[_0xf96b('0x34')](0x1f4,_0xf96b('0x45')));}});},'Agents':function(_0x5dfb60){return new Promise(function(_0x2213e7,_0xebc5e3){var _0xc70989=_[_0xf96b('0x46')](_0x17dac8['agents']);_0x2213e7({'count':_0xc70989[_0xf96b('0x18')],'rows':_0xc70989});});},'ChatQueues':function(_0x2a7581){return new Promise(function(_0x40e34a,_0x416446){var _0x2e2ba3=[];for(var _0x15cdb8 in _0x17dac8['chatQueues']){if(_0x17dac8[_0xf96b('0x47')][_0xf96b('0x41')](_0x15cdb8)){var _0xb0680e=_0x17dac8['chatQueues'][_0x15cdb8];var _0x3e487e={'id':_0xb0680e['id'],'available':_0xb0680e[_0xf96b('0x48')],'loggedIn':_0xb0680e[_0xf96b('0x49')],'name':_0xb0680e[_0xf96b('0x4a')],'paused':_0xb0680e[_0xf96b('0x4b')],'waiting':_0xb0680e[_0xf96b('0x4c')]};_0x2e2ba3[_0xf96b('0x20')](_0x3e487e);}}_0x40e34a({'count':_0x2e2ba3['length'],'rows':_0x2e2ba3});});},'MailQueues':function(_0x3fc69c){return new Promise(function(_0x49c029,_0x2227e3){var _0x2e4032=[];for(var _0x11d46b in _0x17dac8[_0xf96b('0x4d')]){if(_0x17dac8[_0xf96b('0x4d')][_0xf96b('0x41')](_0x11d46b)){var _0x528ff4=_0x17dac8[_0xf96b('0x4d')][_0x11d46b];var _0x1ccf31={'id':_0x528ff4['id'],'available':_0x528ff4[_0xf96b('0x48')],'loggedIn':_0x528ff4['loggedIn'],'name':_0x528ff4[_0xf96b('0x4a')],'paused':_0x528ff4[_0xf96b('0x4b')],'waiting':_0x528ff4[_0xf96b('0x4c')]};_0x2e4032['push'](_0x1ccf31);}}_0x49c029({'count':_0x2e4032[_0xf96b('0x18')],'rows':_0x2e4032});});},'OpenchannelQueues':function(_0x420a91){return new Promise(function(_0x22e697,_0x2954bc){var _0x48bd77=[];for(var _0xe15e52 in _0x17dac8[_0xf96b('0x4e')]){if(_0x17dac8[_0xf96b('0x4e')][_0xf96b('0x41')](_0xe15e52)){var _0x2a8d6d=_0x17dac8['openchannelQueues'][_0xe15e52];var _0x255597={'id':_0x2a8d6d['id'],'available':_0x2a8d6d['available'],'loggedIn':_0x2a8d6d[_0xf96b('0x49')],'name':_0x2a8d6d[_0xf96b('0x4a')],'paused':_0x2a8d6d['paused'],'waiting':_0x2a8d6d[_0xf96b('0x4c')]};_0x48bd77[_0xf96b('0x20')](_0x255597);}}_0x22e697({'count':_0x48bd77[_0xf96b('0x18')],'rows':_0x48bd77});});},'SmsQueues':function(_0x3af62c){return new Promise(function(_0x310859,_0x2cd0f2){var _0x5964a5=[];for(var _0x4cdf66 in _0x17dac8[_0xf96b('0x4f')]){if(_0x17dac8[_0xf96b('0x4f')][_0xf96b('0x41')](_0x4cdf66)){var _0x13820e=_0x17dac8[_0xf96b('0x4f')][_0x4cdf66];var _0x26b576={'id':_0x13820e['id'],'available':_0x13820e['available'],'loggedIn':_0x13820e['loggedIn'],'name':_0x13820e['name'],'paused':_0x13820e['paused'],'waiting':_0x13820e['waiting']};_0x5964a5[_0xf96b('0x20')](_0x26b576);}}_0x310859({'count':_0x5964a5['length'],'rows':_0x5964a5});});},'FaxQueues':function(_0x2c76fc){return new Promise(function(_0xd7bf8c,_0x403dca){var _0x5bc664=[];for(var _0x916e40 in _0x17dac8[_0xf96b('0x50')]){if(_0x17dac8[_0xf96b('0x50')][_0xf96b('0x41')](_0x916e40)){var _0x23fd32=_0x17dac8[_0xf96b('0x50')][_0x916e40];var _0x542bd6={'id':_0x23fd32['id'],'available':_0x23fd32[_0xf96b('0x48')],'loggedIn':_0x23fd32[_0xf96b('0x49')],'name':_0x23fd32['name'],'paused':_0x23fd32[_0xf96b('0x4b')],'waiting':_0x23fd32[_0xf96b('0x4c')]};_0x5bc664[_0xf96b('0x20')](_0x542bd6);}}_0xd7bf8c({'count':_0x5bc664[_0xf96b('0x18')],'rows':_0x5bc664});});},'WhatsappQueues':function(_0x21242a){return new Promise(function(_0x22bd77,_0x377f36){var _0x11cd9f=[];for(var _0x2707c9 in _0x17dac8[_0xf96b('0x51')]){if(_0x17dac8[_0xf96b('0x51')]['hasOwnProperty'](_0x2707c9)){var _0x39f878=_0x17dac8['whatsappQueues'][_0x2707c9];var _0x1826fa={'id':_0x39f878['id'],'available':_0x39f878[_0xf96b('0x48')],'loggedIn':_0x39f878[_0xf96b('0x49')],'name':_0x39f878[_0xf96b('0x4a')],'paused':_0x39f878[_0xf96b('0x4b')],'waiting':_0x39f878[_0xf96b('0x4c')]};_0x11cd9f['push'](_0x1826fa);}}_0x22bd77({'count':_0x11cd9f['length'],'rows':_0x11cd9f});});},'ChatQueuesWaitingInteractions':function(_0x13da7a){return new Promise(function(_0xdc550a,_0x48de44){var _0x212a66=_[_0xf96b('0x46')](_0x17dac8[_0xf96b('0x52')]);_0xdc550a({'count':_0x212a66[_0xf96b('0x18')],'rows':_0x212a66});});},'MailQueuesWaitingInteractions':function(_0x4ddb43){return new Promise(function(_0x890d53,_0x2f7a3e){var _0x1b8cb2=_[_0xf96b('0x46')](_0x17dac8[_0xf96b('0x53')]);_0x890d53({'count':_0x1b8cb2[_0xf96b('0x18')],'rows':_0x1b8cb2});});},'OpenchannelQueuesWaitingInteractions':function(_0x132948){return new Promise(function(_0x4446a2,_0x47473a){var _0x1f9df8=_[_0xf96b('0x46')](_0x17dac8[_0xf96b('0x54')]);_0x4446a2({'count':_0x1f9df8[_0xf96b('0x18')],'rows':_0x1f9df8});});},'SmsQueuesWaitingInteractions':function(_0x3883b5){return new Promise(function(_0x5c4190,_0xb396fd){var _0x395f0b=_[_0xf96b('0x46')](_0x17dac8[_0xf96b('0x55')]);_0x5c4190({'count':_0x395f0b[_0xf96b('0x18')],'rows':_0x395f0b});});},'FaxQueuesWaitingInteractions':function(_0x18c4e2){return new Promise(function(_0x357a0f,_0x576dde){var _0x12adcc=_['values'](_0x17dac8['faxQueuesWaitingInteractions']);_0x357a0f({'count':_0x12adcc[_0xf96b('0x18')],'rows':_0x12adcc});});},'WhatsappQueuesWaitingInteractions':function(_0xa9c66e){return new Promise(function(_0x3f8635,_0x19d4d4){var _0x563c41=_['values'](_0x17dac8[_0xf96b('0x56')]);_0x3f8635({'count':_0x563c41['length'],'rows':_0x563c41});});}};var _0x329706=jayson[_0xf96b('0x57')](_0x276a40)['http']();_0x329706['on'](_0xf96b('0x34'),function(_0x3893f6){logger[_0xf96b('0x34')](JSON[_0xf96b('0x58')](_0x3893f6));return _0x20bee9(_0x3893f6);});_0x329706[_0xf96b('0x12')](0x232c,'127.0.0.1',function(){console[_0xf96b('0x59')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x3de221(_0xf96b('0x5a')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 386c5b1..89edb4e 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 _0x98af=['result','catch','rules','stop','length','push','Command','iftime\x20%s','then','true','[%s][INTERVAL]\x20%s','all','some','info','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','util','bluebird','jayson/promise','lodash','routing','client','error','message'];(function(_0x389cba,_0x1e861f){var _0x493c9f=function(_0x3c3243){while(--_0x3c3243){_0x389cba['push'](_0x389cba['shift']());}};_0x493c9f(++_0x1e861f);}(_0x98af,0x1f0));var _0xf98a=function(_0x2ca718,_0x807f4f){_0x2ca718=_0x2ca718-0x0;var _0xca5918=_0x98af[_0x2ca718];return _0xca5918;};'use strict';var util=require(_0xf98a('0x0'));var BPromise=require(_0xf98a('0x1'));var jayson=require(_0xf98a('0x2'));var _=require(_0xf98a('0x3'));var logger=require('../../../config/logger')(_0xf98a('0x4'));var client=jayson[_0xf98a('0x5')]['http']({'port':0x232a});function request(_0x19675d,_0x299d2d){return new BPromise(function(_0x2d06f5,_0x32aa47){return client['request'](_0x19675d,_0x299d2d)['then'](function(_0x90a099){if(_0x90a099[_0xf98a('0x6')]){return _0x32aa47(_0x90a099[_0xf98a('0x6')][_0xf98a('0x7')]);}else{return _0x2d06f5(_0x90a099[_0xf98a('0x8')]);}})[_0xf98a('0x9')](function(_0x449f51){return _0x32aa47(_0x449f51);});});}exports['condition']=function(_0x32590f,_0x2c6675,_0xfcc671){return function(_0x39c791){if(_0xfcc671['rules']&&!_0xfcc671[_0xf98a('0xa')][_0x32590f]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x32590f);return _0x39c791[_0xf98a('0xb')]();}var _0x400bbe=[];for(var _0x59b733=0x0;_0x59b733<_0x2c6675[_0xf98a('0xc')];_0x59b733+=0x1){_0x400bbe[_0xf98a('0xd')](request(_0xf98a('0xe'),{'command':util['format'](_0xf98a('0xf'),_0x2c6675[_0x59b733])})[_0xf98a('0x10')](function(_0x13ccb5){return _0x13ccb5&&_0x13ccb5[_0xf98a('0x7')]&&_0x13ccb5[_0xf98a('0x7')]['indexOf'](_0xf98a('0x11'))>=0x0?!![]:![];})['catch'](function(_0x350a7e){logger['error'](_0xf98a('0x12'),_0x32590f,_0x2c6675[_0x59b733]);}));}BPromise[_0xf98a('0x13')](_0x400bbe)[_0xf98a('0x10')](function(_0x2798d0){var _0x2ab8d7=_[_0xf98a('0x14')](_0x2798d0);logger[_0xf98a('0x15')](_0xf98a('0x16'),_0x32590f,_0x2c6675[_0xf98a('0x17')](_0xf98a('0x18')),_0x2ab8d7);_0x39c791[_0xf98a('0x19')](_0x2ab8d7);})[_0xf98a('0x9')](function(_0x48d124){console[_0xf98a('0x1a')](_0x48d124);logger[_0xf98a('0x6')](_0xf98a('0x16'),_0x32590f,_0x2c6675['join'](_0xf98a('0x18')),_0x48d124[_0xf98a('0x1b')]);_0x39c791['stop']();});};}; \ No newline at end of file +var _0x34d6=['bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','error','message','result','catch','condition','rules','info','stop','push','Command','format','indexOf','[%s][INTERVAL]\x20%s','some','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','log','join','stack','util'];(function(_0x243782,_0x5cce3a){var _0x19c71f=function(_0x1f787b){while(--_0x1f787b){_0x243782['push'](_0x243782['shift']());}};_0x19c71f(++_0x5cce3a);}(_0x34d6,0x95));var _0x634d=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x34d6[_0x4ae6ef];return _0x3cbb4e;};'use strict';var util=require(_0x634d('0x0'));var BPromise=require(_0x634d('0x1'));var jayson=require(_0x634d('0x2'));var _=require(_0x634d('0x3'));var logger=require(_0x634d('0x4'))(_0x634d('0x5'));var client=jayson[_0x634d('0x6')][_0x634d('0x7')]({'port':0x232a});function request(_0x5370f9,_0xd1ccce){return new BPromise(function(_0x13298c,_0x46d22f){return client[_0x634d('0x8')](_0x5370f9,_0xd1ccce)[_0x634d('0x9')](function(_0x130e1c){if(_0x130e1c['error']){return _0x46d22f(_0x130e1c[_0x634d('0xa')][_0x634d('0xb')]);}else{return _0x13298c(_0x130e1c[_0x634d('0xc')]);}})[_0x634d('0xd')](function(_0x5aa642){return _0x46d22f(_0x5aa642);});});}exports[_0x634d('0xe')]=function(_0x50ceab,_0x18a85f,_0x537b94){return function(_0x3639c9){if(_0x537b94[_0x634d('0xf')]&&!_0x537b94[_0x634d('0xf')][_0x50ceab]){logger[_0x634d('0x10')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x50ceab);return _0x3639c9[_0x634d('0x11')]();}var _0xf5c245=[];for(var _0x3b034a=0x0;_0x3b034a<_0x18a85f['length'];_0x3b034a+=0x1){_0xf5c245[_0x634d('0x12')](request(_0x634d('0x13'),{'command':util[_0x634d('0x14')]('iftime\x20%s',_0x18a85f[_0x3b034a])})[_0x634d('0x9')](function(_0xd7acf1){return _0xd7acf1&&_0xd7acf1['message']&&_0xd7acf1[_0x634d('0xb')][_0x634d('0x15')]('true')>=0x0?!![]:![];})['catch'](function(_0x3b506b){logger[_0x634d('0xa')](_0x634d('0x16'),_0x50ceab,_0x18a85f[_0x3b034a]);}));}BPromise['all'](_0xf5c245)[_0x634d('0x9')](function(_0x25c4bf){var _0x26683f=_[_0x634d('0x17')](_0x25c4bf);logger['info'](_0x634d('0x18'),_0x50ceab,_0x18a85f['join'](_0x634d('0x19')),_0x26683f);_0x3639c9[_0x634d('0x1a')](_0x26683f);})[_0x634d('0xd')](function(_0x216d4d){console[_0x634d('0x1b')](_0x216d4d);logger[_0x634d('0xa')]('[%s][INTERVAL]\x20%s\x20%s',_0x50ceab,_0x18a85f[_0x634d('0x1c')](_0x634d('0x19')),_0x216d4d[_0x634d('0x1d')]);_0x3639c9[_0x634d('0x11')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 56eb1c7..ba7c744 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 _0xab40=['forIn','answered_elsewhere','answeredelsewheremembername','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype','blind','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','transfer','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererlinkedid','transfertargetuniqueid','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','lodash','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','interface','connectedlinenum','lastevent','queue','getVoiceQueueByName','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','membername','agentringnoanswerAt','timeout','reason','ringtime','talktime','queuecallerabandon','includes','[%s][agents][queuecallerabandon]','abandoned','holdtime','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connect'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0xab40,0xcd));var _0x0ab4=function(_0x5b6bed,_0x3005ec){_0x5b6bed=_0x5b6bed-0x0;var _0x570c99=_0xab40[_0x5b6bed];return _0x570c99;};'use strict';var _=require(_0x0ab4('0x0'));var util=require(_0x0ab4('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x570f05,_0x4f3e19){utils[_0x0ab4('0x2')](util[_0x0ab4('0x3')](_0x0ab4('0x4'),_0x570f05[_0x0ab4('0x5')],_0x570f05[_0x0ab4('0x6')],_0x570f05['queue'],_0x570f05['membername'],_0x570f05[_0x0ab4('0x7')],_0x570f05['calleridnum'],_0x570f05[_0x0ab4('0x8')],_0x570f05[_0x0ab4('0x9')]));if(_0x570f05[_0x0ab4('0xa')]){utils[_0x0ab4('0xb')](_0x570f05['queue'])['then'](function(_0x4b01c4){if(_0x4b01c4){_0x570f05[_0x0ab4('0xc')]=_0x4b01c4[_0x0ab4('0xc')];_0x570f05[_0x0ab4('0xd')]=_0x570f05[_0x0ab4('0xe')]?_0x4b01c4[_0x0ab4('0xf')]:![];_0x570f05[_0x0ab4('0x10')]=_0x570f05[_0x0ab4('0xd')]?_0x4b01c4[_0x0ab4('0x11')]:0x0;}utils['request']('CreateVoiceAgentReport',_0x570f05);});}else{utils[_0x0ab4('0x12')]('CreateVoiceAgentReport',_0x570f05);}if(_0x4f3e19){delete transfers[_0x570f05[_0x0ab4('0x5')]];}else{delete agents[_0x570f05[_0x0ab4('0x13')]];}}exports[_0x0ab4('0x14')]=function(_0x1e2b56){try{utils[_0x0ab4('0x15')](util[_0x0ab4('0x3')](_0x0ab4('0x16'),_0x1e2b56[_0x0ab4('0x5')]),_0x1e2b56);agents[_0x1e2b56[_0x0ab4('0x13')]]=_0x1e2b56;agents[_0x1e2b56[_0x0ab4('0x13')]][_0x0ab4('0x17')]=utils[_0x0ab4('0x18')]();agents[_0x1e2b56[_0x0ab4('0x13')]][_0x0ab4('0x9')]=_0x0ab4('0x19');agents[_0x1e2b56[_0x0ab4('0x13')]][_0x0ab4('0x8')]=null;agents[_0x1e2b56[_0x0ab4('0x13')]]['connectedlinename']=null;utils['info'](util['format'](_0x0ab4('0x1a'),_0x1e2b56[_0x0ab4('0x5')],agents[_0x1e2b56[_0x0ab4('0x13')]]['membername'],_0x1e2b56[_0x0ab4('0x13')]));}catch(_0x13ea9f){utils[_0x0ab4('0x1b')](util[_0x0ab4('0x3')]('[%s][agents][agentcalled]',_0x1e2b56['uniqueid']),_0x13ea9f);}};exports[_0x0ab4('0x1c')]=function(_0x5b1ed5){try{if(!_[_0x0ab4('0x1d')](agents[_0x5b1ed5[_0x0ab4('0x13')]])){utils['debug'](util[_0x0ab4('0x3')](_0x0ab4('0x1e'),_0x5b1ed5[_0x0ab4('0x5')]),_0x5b1ed5);utils[_0x0ab4('0x2')](util[_0x0ab4('0x3')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x5b1ed5['uniqueid'],agents[_0x5b1ed5[_0x0ab4('0x13')]][_0x0ab4('0x1f')],_0x5b1ed5[_0x0ab4('0x13')]));agents[_0x5b1ed5[_0x0ab4('0x13')]]['agentringnoanswer']=!![];agents[_0x5b1ed5[_0x0ab4('0x13')]][_0x0ab4('0x20')]=utils[_0x0ab4('0x18')]();agents[_0x5b1ed5['destuniqueid']]['lastevent']=_0x0ab4('0x21');agents[_0x5b1ed5[_0x0ab4('0x13')]][_0x0ab4('0x22')]='timeout';agents[_0x5b1ed5['destuniqueid']]['holdtime']=_0x5b1ed5[_0x0ab4('0x23')]?parseInt(_0x5b1ed5['ringtime'])/0x3e8:0x0;agents[_0x5b1ed5[_0x0ab4('0x13')]][_0x0ab4('0x24')]=0x0;unanswered['push'](_0x5b1ed5['destuniqueid']);}}catch(_0x4d0cc1){utils[_0x0ab4('0x1b')](util[_0x0ab4('0x3')](_0x0ab4('0x1e'),_0x5b1ed5[_0x0ab4('0x5')]),_0x4d0cc1);}};exports[_0x0ab4('0x25')]=function(_0x588e0d){try{_['forIn'](agents,function(_0x580d56,_0x2e7a97){if(_0x580d56[_0x0ab4('0x5')]==_0x588e0d[_0x0ab4('0x5')]&&!_[_0x0ab4('0x26')](unanswered,_0x580d56[_0x0ab4('0x13')])){utils['debug'](util['format'](_0x0ab4('0x27'),_0x588e0d[_0x0ab4('0x5')]),_0x588e0d);utils[_0x0ab4('0x2')](util['format']('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x588e0d[_0x0ab4('0x5')],_0x580d56['membername'],_0x580d56[_0x0ab4('0x13')]));_0x580d56[_0x0ab4('0x1c')]=!![];_0x580d56[_0x0ab4('0x20')]=utils[_0x0ab4('0x18')]();_0x580d56[_0x0ab4('0x9')]=_0x0ab4('0x28');_0x580d56['reason']=_0x0ab4('0x28');_0x580d56[_0x0ab4('0x29')]=_0x588e0d[_0x0ab4('0x29')];_0x580d56[_0x0ab4('0x24')]=0x0;writeDB(_0x580d56);}});}catch(_0x4cce0c){utils['error'](util[_0x0ab4('0x3')](_0x0ab4('0x27'),_0x588e0d[_0x0ab4('0x5')]),_0x4cce0c);}};exports['agentconnect']=function(_0x507d77){try{if(agents[_0x507d77['destuniqueid']]){utils[_0x0ab4('0x15')](util[_0x0ab4('0x3')](_0x0ab4('0x2a'),_0x507d77['uniqueid']),_0x507d77);utils['info'](util['format'](_0x0ab4('0x2b'),_0x507d77[_0x0ab4('0x5')],agents[_0x507d77[_0x0ab4('0x13')]][_0x0ab4('0x1f')],_0x507d77[_0x0ab4('0x13')]));agents[_0x507d77[_0x0ab4('0x13')]][_0x0ab4('0x2c')]=utils[_0x0ab4('0x18')]();agents[_0x507d77[_0x0ab4('0x13')]][_0x0ab4('0x8')]=_0x507d77['connectedlinenum'];agents[_0x507d77[_0x0ab4('0x13')]][_0x0ab4('0x2d')]=_0x507d77[_0x0ab4('0x2d')];agents[_0x507d77[_0x0ab4('0x13')]][_0x0ab4('0x29')]=_0x507d77[_0x0ab4('0x23')];agents[_0x507d77[_0x0ab4('0x13')]][_0x0ab4('0x9')]=_0x0ab4('0x2e');_[_0x0ab4('0x2f')](agents,function(_0x449437,_0x1974ce){if(_0x449437['destuniqueid']!=_0x507d77[_0x0ab4('0x13')]&&_0x449437[_0x0ab4('0x5')]==_0x507d77[_0x0ab4('0x5')]){_0x449437[_0x0ab4('0x24')]=0x0;_0x449437['holdtime']=_0x507d77[_0x0ab4('0x23')];_0x449437['agentringnoanswer']=!![];_0x449437[_0x0ab4('0x20')]=utils[_0x0ab4('0x18')]();_0x449437[_0x0ab4('0x9')]=_0x0ab4('0x30');_0x449437[_0x0ab4('0x22')]=_0x0ab4('0x30');_0x449437['answeredelsewheredestinationuniqueid']=_0x507d77[_0x0ab4('0x13')];_0x449437[_0x0ab4('0x31')]=_0x507d77[_0x0ab4('0x1f')];writeDB(_0x449437);}});}}catch(_0x48029f){utils[_0x0ab4('0x1b')](util[_0x0ab4('0x3')](_0x0ab4('0x2a'),_0x507d77[_0x0ab4('0x5')]),_0x48029f);}};exports[_0x0ab4('0xe')]=function(_0x5aa047){try{if(!_['isNil'](agents[_0x5aa047['destuniqueid']])){utils[_0x0ab4('0x15')](util[_0x0ab4('0x3')]('[%s][agents][agentcomplete]',_0x5aa047[_0x0ab4('0x5')]),_0x5aa047);utils['info'](util[_0x0ab4('0x3')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x5aa047[_0x0ab4('0x5')],agents[_0x5aa047[_0x0ab4('0x13')]][_0x0ab4('0x1f')],_0x5aa047[_0x0ab4('0x13')]));agents[_0x5aa047[_0x0ab4('0x13')]][_0x0ab4('0xe')]=!![];agents[_0x5aa047['destuniqueid']][_0x0ab4('0x32')]=utils[_0x0ab4('0x18')]();agents[_0x5aa047[_0x0ab4('0x13')]][_0x0ab4('0x24')]=utils[_0x0ab4('0x33')](agents[_0x5aa047[_0x0ab4('0x13')]]['agentcompleteAt'],agents[_0x5aa047[_0x0ab4('0x13')]]['agentconnectAt']);agents[_0x5aa047[_0x0ab4('0x13')]][_0x0ab4('0x22')]=_0x5aa047[_0x0ab4('0x22')];agents[_0x5aa047['destuniqueid']][_0x0ab4('0x9')]=_0x0ab4('0x34');writeDB(agents[_0x5aa047[_0x0ab4('0x13')]]);}}catch(_0x3c1247){utils[_0x0ab4('0x1b')](util[_0x0ab4('0x3')]('[%s][agents][agentcomplete]',_0x5aa047[_0x0ab4('0x5')]),_0x3c1247);}};exports[_0x0ab4('0x35')]=function(_0x302894){try{if(!_[_0x0ab4('0x1d')](agents[_0x302894[_0x0ab4('0x36')]])){utils[_0x0ab4('0x15')](util[_0x0ab4('0x3')](_0x0ab4('0x37'),_0x302894[_0x0ab4('0x5')]),_0x302894);utils[_0x0ab4('0x2')](util[_0x0ab4('0x3')](_0x0ab4('0x38'),_0x302894[_0x0ab4('0x5')],agents[_0x302894['transfereruniqueid']][_0x0ab4('0x1f')],agents[_0x302894[_0x0ab4('0x36')]]['uniqueid']));agents[_0x302894[_0x0ab4('0x36')]]['transfer']=!![];agents[_0x302894['transfereruniqueid']][_0x0ab4('0x39')]=_0x0ab4('0x3a');agents[_0x302894[_0x0ab4('0x36')]]['transferexten']=_0x302894[_0x0ab4('0x3b')];agents[_0x302894[_0x0ab4('0x36')]][_0x0ab4('0x3c')]=agents[_0x302894[_0x0ab4('0x36')]][_0x0ab4('0x5')];}}catch(_0x3f20de){utils[_0x0ab4('0x1b')](util['format'](_0x0ab4('0x37'),_0x302894['uniqueid']),_0x3f20de);}};exports[_0x0ab4('0x3d')]=function(_0x55c073){try{utils[_0x0ab4('0x15')](util['format']('[%s][agents][attendedtransfer]',_0x55c073[_0x0ab4('0x3e')]),_0x55c073);if(_0x55c073[_0x0ab4('0x3e')]==_0x55c073[_0x0ab4('0x3f')]){if(!_[_0x0ab4('0x1d')](agents[_0x55c073['secondtransfereruniqueid']])){utils[_0x0ab4('0x2')](util[_0x0ab4('0x3')](_0x0ab4('0x40'),_0x55c073[_0x0ab4('0x3e')],agents[_0x55c073[_0x0ab4('0x41')]][_0x0ab4('0x1f')]));agents[_0x55c073[_0x0ab4('0x41')]][_0x0ab4('0x42')]=!![];agents[_0x55c073[_0x0ab4('0x41')]][_0x0ab4('0x39')]=_0x0ab4('0x43');agents[_0x55c073[_0x0ab4('0x41')]][_0x0ab4('0x44')]=_0x55c073[_0x0ab4('0x45')];agents[_0x55c073[_0x0ab4('0x41')]][_0x0ab4('0x3c')]=_0x55c073[_0x0ab4('0x3e')];}if(_0x55c073[_0x0ab4('0x46')]&&agents[_0x55c073[_0x0ab4('0x46')]]){agents[_0x55c073['transfereeuniqueid']][_0x0ab4('0x47')]=0x1;transfers[_0x55c073[_0x0ab4('0x46')]]=_[_0x0ab4('0x48')](agents[_0x55c073[_0x0ab4('0x46')]]);transfers[_0x55c073[_0x0ab4('0x46')]][_0x0ab4('0x49')]=agents[_0x55c073[_0x0ab4('0x41')]][_0x0ab4('0x49')];transfers[_0x55c073['transfereeuniqueid']][_0x0ab4('0x4a')]=agents[_0x55c073[_0x0ab4('0x41')]]['calleridname'];transfers[_0x55c073['transfereeuniqueid']][_0x0ab4('0x17')]=utils[_0x0ab4('0x18')]();transfers[_0x55c073['transfereeuniqueid']]['agentconnectAt']=utils[_0x0ab4('0x18')]();transfers[_0x55c073['transfereeuniqueid']]['holdtime']=0x0;transfers[_0x55c073[_0x0ab4('0x46')]][_0x0ab4('0x47')]=0x2;}}else if(_0x55c073[_0x0ab4('0x41')]==_0x55c073[_0x0ab4('0x4b')]){if(!_[_0x0ab4('0x1d')](agents[_0x55c073[_0x0ab4('0x3e')]])){utils[_0x0ab4('0x2')](util['format'](_0x0ab4('0x40'),_0x55c073[_0x0ab4('0x3e')],agents[_0x55c073[_0x0ab4('0x3e')]][_0x0ab4('0x1f')]));agents[_0x55c073[_0x0ab4('0x3e')]][_0x0ab4('0x42')]=!![];agents[_0x55c073['origtransfereruniqueid']][_0x0ab4('0x39')]=_0x0ab4('0x43');agents[_0x55c073['origtransfereruniqueid']][_0x0ab4('0x44')]=_0x55c073['secondtransfererexten'];agents[_0x55c073[_0x0ab4('0x3e')]]['transferuniqueid']=_0x55c073[_0x0ab4('0x41')];}if(_0x55c073[_0x0ab4('0x4c')]&&agents[_0x55c073[_0x0ab4('0x4c')]]){agents[_0x55c073[_0x0ab4('0x4c')]]['agententerreason']=0x1;transfers[_0x55c073['transfertargetuniqueid']]=_[_0x0ab4('0x48')](agents[_0x55c073[_0x0ab4('0x4c')]]);transfers[_0x55c073['transfertargetuniqueid']][_0x0ab4('0x49')]=agents[_0x55c073[_0x0ab4('0x3e')]][_0x0ab4('0x49')];transfers[_0x55c073['transfertargetuniqueid']][_0x0ab4('0x4a')]=agents[_0x55c073[_0x0ab4('0x3e')]][_0x0ab4('0x4a')];transfers[_0x55c073[_0x0ab4('0x4c')]][_0x0ab4('0x17')]=utils[_0x0ab4('0x18')]();transfers[_0x55c073[_0x0ab4('0x4c')]][_0x0ab4('0x2c')]=utils['now']();transfers[_0x55c073['transfertargetuniqueid']][_0x0ab4('0x29')]=0x0;transfers[_0x55c073[_0x0ab4('0x4c')]][_0x0ab4('0x47')]=0x2;}}}catch(_0xc23642){utils['error'](util[_0x0ab4('0x3')]('[%s][agents][attendedtransfer]',_0x55c073[_0x0ab4('0x3e')]),_0xc23642);}};exports[_0x0ab4('0x4d')]=function(_0x18308f){try{utils[_0x0ab4('0x15')](util[_0x0ab4('0x3')](_0x0ab4('0x4e'),_0x18308f[_0x0ab4('0x5')]),_0x18308f);if(agents[_0x18308f[_0x0ab4('0x5')]]&&agents[_0x18308f[_0x0ab4('0x5')]]['reason']===_0x0ab4('0x21')){if(_0x18308f['cause']==='21'){agents[_0x18308f[_0x0ab4('0x5')]][_0x0ab4('0x22')]=_0x0ab4('0x4f');agents[_0x18308f[_0x0ab4('0x5')]][_0x0ab4('0x9')]=_0x0ab4('0x4f');}utils[_0x0ab4('0x2')](util[_0x0ab4('0x3')](_0x0ab4('0x50'),_0x18308f['uniqueid'],agents[_0x18308f[_0x0ab4('0x5')]][_0x0ab4('0x1f')],agents[_0x18308f['uniqueid']][_0x0ab4('0x22')],agents[_0x18308f[_0x0ab4('0x5')]][_0x0ab4('0x9')]));writeDB(agents[_0x18308f['uniqueid']]);var _0x3feaaa=unanswered[_0x0ab4('0x51')](_0x18308f[_0x0ab4('0x5')]);if(_0x3feaaa>-0x1){unanswered[_0x0ab4('0x52')](_0x3feaaa,0x1);}}if(transfers[_0x18308f['uniqueid']]){transfers[_0x18308f['uniqueid']][_0x0ab4('0xe')]=!![];transfers[_0x18308f[_0x0ab4('0x5')]][_0x0ab4('0x32')]=utils[_0x0ab4('0x18')]();transfers[_0x18308f['uniqueid']][_0x0ab4('0x24')]=utils[_0x0ab4('0x33')](transfers[_0x18308f[_0x0ab4('0x5')]]['agentcompleteAt'],transfers[_0x18308f['uniqueid']][_0x0ab4('0x2c')]);transfers[_0x18308f[_0x0ab4('0x5')]][_0x0ab4('0x22')]=_0x0ab4('0x53');transfers[_0x18308f[_0x0ab4('0x5')]][_0x0ab4('0x9')]=_0x0ab4('0x34');utils['info'](util[_0x0ab4('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x18308f['uniqueid'],transfers[_0x18308f[_0x0ab4('0x5')]]['membername'],transfers[_0x18308f[_0x0ab4('0x5')]][_0x0ab4('0x22')],transfers[_0x18308f[_0x0ab4('0x5')]][_0x0ab4('0x9')]));writeDB(transfers[_0x18308f[_0x0ab4('0x5')]],!![]);}if(agents[_0x18308f['uniqueid']]&&agents[_0x18308f['uniqueid']][_0x0ab4('0x2c')]){agents[_0x18308f[_0x0ab4('0x5')]]['agentcomplete']=!![];agents[_0x18308f['uniqueid']][_0x0ab4('0x32')]=utils[_0x0ab4('0x18')]();agents[_0x18308f['uniqueid']][_0x0ab4('0x24')]=utils[_0x0ab4('0x33')](agents[_0x18308f[_0x0ab4('0x5')]]['agentcompleteAt'],agents[_0x18308f[_0x0ab4('0x5')]][_0x0ab4('0x2c')]);agents[_0x18308f[_0x0ab4('0x5')]][_0x0ab4('0x22')]=agents[_0x18308f['uniqueid']][_0x0ab4('0x42')]?_0x0ab4('0x42'):_0x0ab4('0x53');agents[_0x18308f[_0x0ab4('0x5')]][_0x0ab4('0x9')]=_0x0ab4('0x34');utils[_0x0ab4('0x2')](util[_0x0ab4('0x3')](_0x0ab4('0x50'),_0x18308f[_0x0ab4('0x5')],agents[_0x18308f['uniqueid']][_0x0ab4('0x1f')],agents[_0x18308f[_0x0ab4('0x5')]][_0x0ab4('0x22')],agents[_0x18308f[_0x0ab4('0x5')]][_0x0ab4('0x9')]));writeDB(agents[_0x18308f['uniqueid']]);}}catch(_0x448fcb){utils[_0x0ab4('0x1b')](util[_0x0ab4('0x3')](_0x0ab4('0x4e'),_0x18308f[_0x0ab4('0x5')]),_0x448fcb);}}; \ No newline at end of file +var _0xbaf0=['includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','talktime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','agent','[%s][agents][hangup]','util','./utils','info','format','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','agentcalledAt','now','connectedlinename','error','agentringnoanswer','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','push','forIn'];(function(_0x4a23a9,_0x17a2c0){var _0x18c27f=function(_0x3414e3){while(--_0x3414e3){_0x4a23a9['push'](_0x4a23a9['shift']());}};_0x18c27f(++_0x17a2c0);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var utils=require(_0x0baf('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1e212d,_0x263f79){utils[_0x0baf('0x2')](util[_0x0baf('0x3')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1e212d[_0x0baf('0x4')],_0x1e212d[_0x0baf('0x5')],_0x1e212d[_0x0baf('0x6')],_0x1e212d[_0x0baf('0x7')],_0x1e212d[_0x0baf('0x8')],_0x1e212d[_0x0baf('0x9')],_0x1e212d[_0x0baf('0xa')],_0x1e212d[_0x0baf('0xb')]));if(_0x1e212d[_0x0baf('0x6')]){utils['getVoiceQueueByName'](_0x1e212d[_0x0baf('0x6')])['then'](function(_0x4605c3){if(_0x4605c3){_0x1e212d[_0x0baf('0xc')]=_0x4605c3[_0x0baf('0xc')];_0x1e212d[_0x0baf('0xd')]=_0x1e212d[_0x0baf('0xe')]?_0x4605c3[_0x0baf('0xf')]:![];_0x1e212d[_0x0baf('0x10')]=_0x1e212d[_0x0baf('0xd')]?_0x4605c3[_0x0baf('0x11')]:0x0;}utils[_0x0baf('0x12')](_0x0baf('0x13'),_0x1e212d);});}else{utils['request']('CreateVoiceAgentReport',_0x1e212d);}if(_0x263f79){delete transfers[_0x1e212d[_0x0baf('0x4')]];}else{delete agents[_0x1e212d[_0x0baf('0x14')]];}}exports[_0x0baf('0x15')]=function(_0x13df17){try{utils['debug'](util[_0x0baf('0x3')]('[%s][agents][agentcalled]',_0x13df17[_0x0baf('0x4')]),_0x13df17);agents[_0x13df17[_0x0baf('0x14')]]=_0x13df17;agents[_0x13df17[_0x0baf('0x14')]][_0x0baf('0x16')]=utils[_0x0baf('0x17')]();agents[_0x13df17[_0x0baf('0x14')]]['lastevent']='called';agents[_0x13df17[_0x0baf('0x14')]][_0x0baf('0xa')]=null;agents[_0x13df17[_0x0baf('0x14')]][_0x0baf('0x18')]=null;utils[_0x0baf('0x2')](util[_0x0baf('0x3')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x13df17[_0x0baf('0x4')],agents[_0x13df17[_0x0baf('0x14')]][_0x0baf('0x7')],_0x13df17[_0x0baf('0x14')]));}catch(_0x47070d){utils[_0x0baf('0x19')](util['format']('[%s][agents][agentcalled]',_0x13df17[_0x0baf('0x4')]),_0x47070d);}};exports[_0x0baf('0x1a')]=function(_0x32e839){try{if(!_[_0x0baf('0x1b')](agents[_0x32e839[_0x0baf('0x14')]])){utils[_0x0baf('0x1c')](util[_0x0baf('0x3')](_0x0baf('0x1d'),_0x32e839[_0x0baf('0x4')]),_0x32e839);utils[_0x0baf('0x2')](util['format'](_0x0baf('0x1e'),_0x32e839['uniqueid'],agents[_0x32e839[_0x0baf('0x14')]]['membername'],_0x32e839['destuniqueid']));agents[_0x32e839[_0x0baf('0x14')]]['agentringnoanswer']=!![];agents[_0x32e839['destuniqueid']][_0x0baf('0x1f')]=utils[_0x0baf('0x17')]();agents[_0x32e839[_0x0baf('0x14')]][_0x0baf('0xb')]=_0x0baf('0x20');agents[_0x32e839['destuniqueid']][_0x0baf('0x21')]=_0x0baf('0x20');agents[_0x32e839[_0x0baf('0x14')]][_0x0baf('0x22')]=_0x32e839[_0x0baf('0x23')]?parseInt(_0x32e839[_0x0baf('0x23')])/0x3e8:0x0;agents[_0x32e839[_0x0baf('0x14')]]['talktime']=0x0;unanswered[_0x0baf('0x24')](_0x32e839[_0x0baf('0x14')]);}}catch(_0xcaf13d){utils[_0x0baf('0x19')](util['format'](_0x0baf('0x1d'),_0x32e839[_0x0baf('0x4')]),_0xcaf13d);}};exports['queuecallerabandon']=function(_0x44ec31){try{_[_0x0baf('0x25')](agents,function(_0x478ce8,_0xb4dbb1){if(_0x478ce8[_0x0baf('0x4')]==_0x44ec31[_0x0baf('0x4')]&&!_[_0x0baf('0x26')](unanswered,_0x478ce8['destuniqueid'])){utils[_0x0baf('0x1c')](util[_0x0baf('0x3')](_0x0baf('0x27'),_0x44ec31[_0x0baf('0x4')]),_0x44ec31);utils[_0x0baf('0x2')](util[_0x0baf('0x3')](_0x0baf('0x28'),_0x44ec31[_0x0baf('0x4')],_0x478ce8[_0x0baf('0x7')],_0x478ce8[_0x0baf('0x14')]));_0x478ce8[_0x0baf('0x1a')]=!![];_0x478ce8[_0x0baf('0x1f')]=utils[_0x0baf('0x17')]();_0x478ce8[_0x0baf('0xb')]='abandoned';_0x478ce8[_0x0baf('0x21')]='abandoned';_0x478ce8[_0x0baf('0x22')]=_0x44ec31[_0x0baf('0x22')];_0x478ce8[_0x0baf('0x29')]=0x0;writeDB(_0x478ce8);}});}catch(_0x3d65f2){utils['error'](util[_0x0baf('0x3')](_0x0baf('0x27'),_0x44ec31['uniqueid']),_0x3d65f2);}};exports[_0x0baf('0x2a')]=function(_0x2447c2){try{if(agents[_0x2447c2[_0x0baf('0x14')]]){utils[_0x0baf('0x1c')](util[_0x0baf('0x3')](_0x0baf('0x2b'),_0x2447c2[_0x0baf('0x4')]),_0x2447c2);utils[_0x0baf('0x2')](util['format'](_0x0baf('0x2c'),_0x2447c2[_0x0baf('0x4')],agents[_0x2447c2['destuniqueid']][_0x0baf('0x7')],_0x2447c2['destuniqueid']));agents[_0x2447c2['destuniqueid']][_0x0baf('0x2d')]=utils[_0x0baf('0x17')]();agents[_0x2447c2['destuniqueid']]['connectedlinenum']=_0x2447c2[_0x0baf('0xa')];agents[_0x2447c2[_0x0baf('0x14')]][_0x0baf('0x18')]=_0x2447c2[_0x0baf('0x18')];agents[_0x2447c2[_0x0baf('0x14')]][_0x0baf('0x22')]=_0x2447c2[_0x0baf('0x23')];agents[_0x2447c2[_0x0baf('0x14')]][_0x0baf('0xb')]=_0x0baf('0x2e');_[_0x0baf('0x25')](agents,function(_0x148540,_0x354cb1){if(_0x148540[_0x0baf('0x14')]!=_0x2447c2['destuniqueid']&&_0x148540[_0x0baf('0x4')]==_0x2447c2[_0x0baf('0x4')]){_0x148540['talktime']=0x0;_0x148540[_0x0baf('0x22')]=_0x2447c2[_0x0baf('0x23')];_0x148540[_0x0baf('0x1a')]=!![];_0x148540[_0x0baf('0x1f')]=utils[_0x0baf('0x17')]();_0x148540[_0x0baf('0xb')]='answered_elsewhere';_0x148540[_0x0baf('0x21')]=_0x0baf('0x2f');_0x148540['answeredelsewheredestinationuniqueid']=_0x2447c2[_0x0baf('0x14')];_0x148540[_0x0baf('0x30')]=_0x2447c2[_0x0baf('0x7')];writeDB(_0x148540);}});}}catch(_0x57903e){utils['error'](util[_0x0baf('0x3')](_0x0baf('0x2b'),_0x2447c2[_0x0baf('0x4')]),_0x57903e);}};exports[_0x0baf('0xe')]=function(_0x2b6d54){try{if(!_[_0x0baf('0x1b')](agents[_0x2b6d54[_0x0baf('0x14')]])){utils[_0x0baf('0x1c')](util[_0x0baf('0x3')](_0x0baf('0x31'),_0x2b6d54['uniqueid']),_0x2b6d54);utils[_0x0baf('0x2')](util[_0x0baf('0x3')](_0x0baf('0x32'),_0x2b6d54[_0x0baf('0x4')],agents[_0x2b6d54[_0x0baf('0x14')]]['membername'],_0x2b6d54[_0x0baf('0x14')]));agents[_0x2b6d54[_0x0baf('0x14')]][_0x0baf('0xe')]=!![];agents[_0x2b6d54[_0x0baf('0x14')]][_0x0baf('0x33')]=utils['now']();agents[_0x2b6d54[_0x0baf('0x14')]][_0x0baf('0x29')]=utils[_0x0baf('0x34')](agents[_0x2b6d54[_0x0baf('0x14')]][_0x0baf('0x33')],agents[_0x2b6d54[_0x0baf('0x14')]][_0x0baf('0x2d')]);agents[_0x2b6d54['destuniqueid']][_0x0baf('0x21')]=_0x2b6d54[_0x0baf('0x21')];agents[_0x2b6d54[_0x0baf('0x14')]]['lastevent']=_0x0baf('0x35');writeDB(agents[_0x2b6d54[_0x0baf('0x14')]]);}}catch(_0x10fa62){utils[_0x0baf('0x19')](util[_0x0baf('0x3')](_0x0baf('0x31'),_0x2b6d54[_0x0baf('0x4')]),_0x10fa62);}};exports['blindtransfer']=function(_0x22c451){try{if(!_[_0x0baf('0x1b')](agents[_0x22c451[_0x0baf('0x36')]])){utils[_0x0baf('0x1c')](util[_0x0baf('0x3')](_0x0baf('0x37'),_0x22c451[_0x0baf('0x4')]),_0x22c451);utils[_0x0baf('0x2')](util[_0x0baf('0x3')](_0x0baf('0x38'),_0x22c451[_0x0baf('0x4')],agents[_0x22c451['transfereruniqueid']]['membername'],agents[_0x22c451[_0x0baf('0x36')]][_0x0baf('0x4')]));agents[_0x22c451[_0x0baf('0x36')]][_0x0baf('0x39')]=!![];agents[_0x22c451[_0x0baf('0x36')]][_0x0baf('0x3a')]=_0x0baf('0x3b');agents[_0x22c451['transfereruniqueid']][_0x0baf('0x3c')]=_0x22c451[_0x0baf('0x3d')];agents[_0x22c451[_0x0baf('0x36')]][_0x0baf('0x3e')]=agents[_0x22c451[_0x0baf('0x36')]][_0x0baf('0x4')];}}catch(_0x5e1849){utils[_0x0baf('0x19')](util['format'](_0x0baf('0x37'),_0x22c451['uniqueid']),_0x5e1849);}};exports[_0x0baf('0x3f')]=function(_0x5eaeb2){try{utils[_0x0baf('0x1c')](util['format'](_0x0baf('0x40'),_0x5eaeb2[_0x0baf('0x41')]),_0x5eaeb2);if(_0x5eaeb2[_0x0baf('0x41')]==_0x5eaeb2[_0x0baf('0x42')]){if(!_[_0x0baf('0x1b')](agents[_0x5eaeb2['secondtransfereruniqueid']])){utils[_0x0baf('0x2')](util[_0x0baf('0x3')](_0x0baf('0x43'),_0x5eaeb2[_0x0baf('0x41')],agents[_0x5eaeb2[_0x0baf('0x44')]][_0x0baf('0x7')]));agents[_0x5eaeb2['secondtransfereruniqueid']][_0x0baf('0x39')]=!![];agents[_0x5eaeb2[_0x0baf('0x44')]][_0x0baf('0x3a')]=_0x0baf('0x45');agents[_0x5eaeb2[_0x0baf('0x44')]][_0x0baf('0x3c')]=_0x5eaeb2[_0x0baf('0x46')];agents[_0x5eaeb2['secondtransfereruniqueid']]['transferuniqueid']=_0x5eaeb2[_0x0baf('0x41')];}if(_0x5eaeb2[_0x0baf('0x47')]&&agents[_0x5eaeb2[_0x0baf('0x47')]]){agents[_0x5eaeb2[_0x0baf('0x47')]][_0x0baf('0x48')]=0x1;transfers[_0x5eaeb2[_0x0baf('0x47')]]=_[_0x0baf('0x49')](agents[_0x5eaeb2[_0x0baf('0x47')]]);transfers[_0x5eaeb2[_0x0baf('0x47')]]['calleridnum']=agents[_0x5eaeb2[_0x0baf('0x44')]][_0x0baf('0x9')];transfers[_0x5eaeb2[_0x0baf('0x47')]][_0x0baf('0x4a')]=agents[_0x5eaeb2[_0x0baf('0x44')]][_0x0baf('0x4a')];transfers[_0x5eaeb2[_0x0baf('0x47')]]['agentcalledAt']=utils[_0x0baf('0x17')]();transfers[_0x5eaeb2[_0x0baf('0x47')]][_0x0baf('0x2d')]=utils[_0x0baf('0x17')]();transfers[_0x5eaeb2[_0x0baf('0x47')]][_0x0baf('0x22')]=0x0;transfers[_0x5eaeb2[_0x0baf('0x47')]][_0x0baf('0x48')]=0x2;}}else if(_0x5eaeb2['secondtransfereruniqueid']==_0x5eaeb2[_0x0baf('0x4b')]){if(!_['isNil'](agents[_0x5eaeb2[_0x0baf('0x41')]])){utils['info'](util['format'](_0x0baf('0x43'),_0x5eaeb2['origtransfereruniqueid'],agents[_0x5eaeb2[_0x0baf('0x41')]][_0x0baf('0x7')]));agents[_0x5eaeb2['origtransfereruniqueid']][_0x0baf('0x39')]=!![];agents[_0x5eaeb2[_0x0baf('0x41')]][_0x0baf('0x3a')]='ATTENDED';agents[_0x5eaeb2['origtransfereruniqueid']][_0x0baf('0x3c')]=_0x5eaeb2[_0x0baf('0x4c')];agents[_0x5eaeb2[_0x0baf('0x41')]][_0x0baf('0x3e')]=_0x5eaeb2[_0x0baf('0x44')];}if(_0x5eaeb2['transfertargetuniqueid']&&agents[_0x5eaeb2[_0x0baf('0x4d')]]){agents[_0x5eaeb2['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x5eaeb2['transfertargetuniqueid']]=_[_0x0baf('0x49')](agents[_0x5eaeb2['transfertargetuniqueid']]);transfers[_0x5eaeb2['transfertargetuniqueid']][_0x0baf('0x9')]=agents[_0x5eaeb2[_0x0baf('0x41')]][_0x0baf('0x9')];transfers[_0x5eaeb2[_0x0baf('0x4d')]][_0x0baf('0x4a')]=agents[_0x5eaeb2[_0x0baf('0x41')]]['calleridname'];transfers[_0x5eaeb2[_0x0baf('0x4d')]][_0x0baf('0x16')]=utils[_0x0baf('0x17')]();transfers[_0x5eaeb2[_0x0baf('0x4d')]][_0x0baf('0x2d')]=utils[_0x0baf('0x17')]();transfers[_0x5eaeb2['transfertargetuniqueid']][_0x0baf('0x22')]=0x0;transfers[_0x5eaeb2[_0x0baf('0x4d')]][_0x0baf('0x48')]=0x2;}}}catch(_0x5d4053){utils[_0x0baf('0x19')](util[_0x0baf('0x3')](_0x0baf('0x40'),_0x5eaeb2[_0x0baf('0x41')]),_0x5d4053);}};exports[_0x0baf('0x4e')]=function(_0x27a959){try{utils[_0x0baf('0x1c')](util['format']('[%s][agents][hangup]',_0x27a959['uniqueid']),_0x27a959);if(agents[_0x27a959[_0x0baf('0x4')]]&&agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x21')]===_0x0baf('0x20')){if(_0x27a959[_0x0baf('0x4f')]==='21'){agents[_0x27a959[_0x0baf('0x4')]]['reason']='rejected';agents[_0x27a959[_0x0baf('0x4')]]['lastevent']=_0x0baf('0x50');}utils[_0x0baf('0x2')](util['format'](_0x0baf('0x51'),_0x27a959[_0x0baf('0x4')],agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x7')],agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x21')],agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0xb')]));writeDB(agents[_0x27a959[_0x0baf('0x4')]]);var _0x5ea0f3=unanswered['indexOf'](_0x27a959['uniqueid']);if(_0x5ea0f3>-0x1){unanswered['splice'](_0x5ea0f3,0x1);}}if(transfers[_0x27a959['uniqueid']]){transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0xe')]=!![];transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x33')]=utils['now']();transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x29')]=utils['diffTime'](transfers[_0x27a959['uniqueid']][_0x0baf('0x33')],transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x2d')]);transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x21')]=_0x0baf('0x52');transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0xb')]='complete';utils[_0x0baf('0x2')](util[_0x0baf('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x27a959[_0x0baf('0x4')],transfers[_0x27a959[_0x0baf('0x4')]]['membername'],transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x21')],transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0xb')]));writeDB(transfers[_0x27a959[_0x0baf('0x4')]],!![]);}if(agents[_0x27a959['uniqueid']]&&agents[_0x27a959['uniqueid']][_0x0baf('0x2d')]){agents[_0x27a959[_0x0baf('0x4')]]['agentcomplete']=!![];agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x33')]=utils[_0x0baf('0x17')]();agents[_0x27a959['uniqueid']][_0x0baf('0x29')]=utils[_0x0baf('0x34')](agents[_0x27a959[_0x0baf('0x4')]]['agentcompleteAt'],agents[_0x27a959[_0x0baf('0x4')]]['agentconnectAt']);agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x21')]=agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x39')]?_0x0baf('0x39'):'agent';agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0xb')]='complete';utils[_0x0baf('0x2')](util[_0x0baf('0x3')](_0x0baf('0x51'),_0x27a959[_0x0baf('0x4')],agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x7')],agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x21')],agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0xb')]));writeDB(agents[_0x27a959[_0x0baf('0x4')]]);}}catch(_0x2c2f09){utils['error'](util['format'](_0x0baf('0x53'),_0x27a959[_0x0baf('0x4')]),_0x2c2f09);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 4ada9cb..99e43c9 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 _0xa2a9=['xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','noop','execif','gotoif','lastdata','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','blinds','uniqueid','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','interface','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','format','linkedid','channel','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','DOCUMENTATION','[%s][calls][newchannel]','newstate','debug','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','error','hangup','[%s][calls][hangup]','calleridname','calleridnum','callerid','cause-txt','endtime','duration','diffTime','starttime','billableseconds','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','_attended','origtransfererchannel','musiconholdstart','musiconholdstartAt','now','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','destination','\x22\x20<'];(function(_0x564cd0,_0x1fdcd0){var _0x303032=function(_0x1eb068){while(--_0x1eb068){_0x564cd0['push'](_0x564cd0['shift']());}};_0x303032(++_0x1fdcd0);}(_0xa2a9,0x89));var _0x9a2a=function(_0x51f983,_0x566b44){_0x51f983=_0x51f983-0x0;var _0x3f182a=_0xa2a9[_0x51f983];return _0x3f182a;};'use strict';var _=require(_0x9a2a('0x0'));var util=require(_0x9a2a('0x1'));var utils=require(_0x9a2a('0x2'));var transfers=require(_0x9a2a('0x3'));var dispositions=[_0x9a2a('0x4'),_0x9a2a('0x5'),'FAILED',_0x9a2a('0x4'),'NO\x20ANSWER','NO\x20ANSWER',_0x9a2a('0x6'),'BUSY',_0x9a2a('0x5'),_0x9a2a('0x5'),_0x9a2a('0x5')];var channels={};function writeDB(_0x447e82){var _0x1a09c3;if(transfers[_0x9a2a('0x7')][_0x447e82[_0x9a2a('0x8')]]){_0x1a09c3=_0x447e82[_0x9a2a('0x8')];_0x447e82[_0x9a2a('0x8')]=transfers['blinds'][_0x447e82[_0x9a2a('0x8')]]['transfereeuniqueid'];}utils[_0x9a2a('0x9')](util['format'](_0x9a2a('0xa'),_0x447e82[_0x9a2a('0x8')],_0x447e82['channel'],_0x447e82[_0x9a2a('0xb')],_0x447e82[_0x9a2a('0xc')],_0x447e82[_0x9a2a('0xd')],_0x447e82['calleridnum'],_0x447e82[_0x9a2a('0xe')],_0x447e82[_0x9a2a('0xf')]));if(_0x447e82[_0x9a2a('0x10')]){utils[_0x9a2a('0x11')](_0x447e82['accountcode'])[_0x9a2a('0x12')](function(_0x2ed0ce){if(_0x2ed0ce){_0x447e82[_0x9a2a('0x13')]=_0x2ed0ce['id'];}utils[_0x9a2a('0x14')](_0x9a2a('0x15'),_0x447e82);});}else{utils['request'](_0x9a2a('0x15'),_0x447e82);}if(channels[_0x447e82[_0x9a2a('0x8')]]){delete channels[_0x447e82[_0x9a2a('0x8')]];}else if(_0x1a09c3&&channels[_0x1a09c3]){delete transfers['blinds'][_0x1a09c3];delete channels[_0x1a09c3];}}exports['newchannel']=function(_0x7714e9){try{utils['debug'](util[_0x9a2a('0x16')]('[%s][calls][newchannel]',_0x7714e9[_0x9a2a('0x8')]),_0x7714e9);if(_0x7714e9[_0x9a2a('0x8')]==_0x7714e9[_0x9a2a('0x17')]&&_0x7714e9[_0x9a2a('0x18')]!='OutgoingSpoolFailed'){utils[_0x9a2a('0x9')](util[_0x9a2a('0x16')](_0x9a2a('0x19'),_0x7714e9[_0x9a2a('0x8')],_0x7714e9[_0x9a2a('0x1a')],_0x7714e9[_0x9a2a('0x1b')]));channels[_0x7714e9[_0x9a2a('0x8')]]={'uniqueid':_0x7714e9[_0x9a2a('0x8')],'accountcode':_0x7714e9[_0x9a2a('0x10')],'source':_0x7714e9['calleridnum'],'destination':_0x7714e9[_0x9a2a('0x1b')],'destinationcontext':_0x7714e9[_0x9a2a('0x1a')],'channel':_0x7714e9[_0x9a2a('0x18')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x9a2a('0x4'),'amaflags':_0x9a2a('0x1c')};}}catch(_0x2acc5f){utils['error'](util['format'](_0x9a2a('0x1d'),_0x7714e9[_0x9a2a('0x8')]),_0x2acc5f);}};exports[_0x9a2a('0x1e')]=function(_0x548a9a){try{utils[_0x9a2a('0x1f')](util['format'](_0x9a2a('0x20'),_0x548a9a['uniqueid']),_0x548a9a);if(!_[_0x9a2a('0x21')](channels[_0x548a9a[_0x9a2a('0x8')]])&&_0x548a9a['channelstate']==0x6){utils['info'](util[_0x9a2a('0x16')](_0x9a2a('0x22'),_0x548a9a[_0x9a2a('0x8')],_0x548a9a[_0x9a2a('0x1a')],_0x548a9a['channel']));if(_[_0x9a2a('0x21')](channels[_0x548a9a['uniqueid']][_0x9a2a('0x23')])){channels[_0x548a9a[_0x9a2a('0x8')]][_0x9a2a('0x23')]=utils['now']();}}else if(!_[_0x9a2a('0x21')](channels[_0x548a9a[_0x9a2a('0x17')]])&&_0x548a9a[_0x9a2a('0x24')]==0x6&&_0x548a9a['context']!=_0x9a2a('0x25')){utils[_0x9a2a('0x9')](util['format'](_0x9a2a('0x26'),_0x548a9a['uniqueid'],_0x548a9a[_0x9a2a('0x17')],_0x548a9a[_0x9a2a('0x1a')],_0x548a9a['channel']));channels[_0x548a9a[_0x9a2a('0x17')]][_0x9a2a('0x10')]=_0x548a9a[_0x9a2a('0x10')];channels[_0x548a9a[_0x9a2a('0x17')]]['destinationchannel']=_0x548a9a['channel'];if(_['isNil'](channels[_0x548a9a[_0x9a2a('0x17')]]['answertime'])){channels[_0x548a9a[_0x9a2a('0x17')]][_0x9a2a('0x27')]=utils['now']();}channels[_0x548a9a[_0x9a2a('0x17')]]['disposition']=dispositions[_['toNumber'](_0x548a9a['channelstate'])]||_0x9a2a('0x6');}}catch(_0x558961){utils[_0x9a2a('0x28')](util['format'](_0x9a2a('0x20'),_0x548a9a[_0x9a2a('0x8')]),_0x558961);}};exports[_0x9a2a('0x29')]=function(_0x37ab1a){try{if(!_[_0x9a2a('0x21')](channels[_0x37ab1a[_0x9a2a('0x8')]])){utils[_0x9a2a('0x1f')](util['format'](_0x9a2a('0x2a'),_0x37ab1a[_0x9a2a('0x8')]),_0x37ab1a);if(_[_0x9a2a('0x21')](channels[_0x37ab1a[_0x9a2a('0x8')]]['callerid'])){channels[_0x37ab1a['uniqueid']]['callerid']=_0x37ab1a[_0x9a2a('0x2b')]+'\x20<'+_0x37ab1a[_0x9a2a('0x2c')]+'>';}utils[_0x9a2a('0x9')](util[_0x9a2a('0x16')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x37ab1a[_0x9a2a('0x8')],channels[_0x37ab1a[_0x9a2a('0x8')]][_0x9a2a('0x2d')],_0x37ab1a[_0x9a2a('0x2e')]));channels[_0x37ab1a[_0x9a2a('0x8')]][_0x9a2a('0x2f')]=utils['now']();channels[_0x37ab1a[_0x9a2a('0x8')]][_0x9a2a('0x30')]=utils[_0x9a2a('0x31')](channels[_0x37ab1a['uniqueid']]['endtime'],channels[_0x37ab1a[_0x9a2a('0x8')]][_0x9a2a('0x32')]);channels[_0x37ab1a[_0x9a2a('0x8')]][_0x9a2a('0x33')]=channels[_0x37ab1a['uniqueid']]['answertime']?utils[_0x9a2a('0x31')](channels[_0x37ab1a[_0x9a2a('0x8')]][_0x9a2a('0x2f')],channels[_0x37ab1a[_0x9a2a('0x8')]][_0x9a2a('0x27')]):0x0;writeDB(channels[_0x37ab1a[_0x9a2a('0x8')]]);}}catch(_0x154770){utils[_0x9a2a('0x28')](util[_0x9a2a('0x16')]('[%s][calls][hangup]',_0x37ab1a[_0x9a2a('0x8')]),_0x154770);}};exports['attendedtransfer']=function(_0x413ba9){try{if(!_[_0x9a2a('0x21')](channels[_0x413ba9[_0x9a2a('0x34')]])){utils[_0x9a2a('0x1f')](util['format'](_0x9a2a('0x35'),_0x413ba9[_0x9a2a('0x36')]),_0x413ba9);if(channels[_0x413ba9[_0x9a2a('0x34')]][_0x9a2a('0x18')]==_0x413ba9[_0x9a2a('0x37')]){utils[_0x9a2a('0x9')](util[_0x9a2a('0x16')](_0x9a2a('0x38'),_0x413ba9['origtransfereruniqueid'],_0x413ba9['localtwolinkedid'],_0x413ba9[_0x9a2a('0x39')]));channels[_0x413ba9[_0x9a2a('0x34')]][_0x9a2a('0x3a')]=_0x413ba9[_0x9a2a('0x39')];channels[_0x413ba9['localtwolinkedid']][_0x9a2a('0x3b')]=_0x9a2a('0x3c');}else if(channels[_0x413ba9[_0x9a2a('0x34')]][_0x9a2a('0x18')]=_0x413ba9['transfertargetchannel']){utils[_0x9a2a('0x9')](util[_0x9a2a('0x16')](_0x9a2a('0x38'),_0x413ba9[_0x9a2a('0x36')],_0x413ba9[_0x9a2a('0x34')],_0x413ba9['origtransfererchannel']));channels[_0x413ba9['localtwolinkedid']][_0x9a2a('0x3a')]=_0x413ba9[_0x9a2a('0x3d')];channels[_0x413ba9['localtwolinkedid']][_0x9a2a('0x3b')]=_0x9a2a('0x3c');}}}catch(_0x549143){utils[_0x9a2a('0x28')](util['format'](_0x9a2a('0x35'),_0x413ba9['origtransfereruniqueid']),_0x549143);}};exports[_0x9a2a('0x3e')]=function(_0x5bccd8){try{if(!_[_0x9a2a('0x21')](channels[_0x5bccd8[_0x9a2a('0x8')]])){utils[_0x9a2a('0x1f')](util[_0x9a2a('0x16')]('[%s][calls][musiconholdstart]',_0x5bccd8[_0x9a2a('0x8')]),_0x5bccd8);channels[_0x5bccd8[_0x9a2a('0x8')]][_0x9a2a('0x3f')]=utils[_0x9a2a('0x40')]();utils[_0x9a2a('0x9')](util['format'](_0x9a2a('0x41'),_0x5bccd8[_0x9a2a('0x8')],channels[_0x5bccd8[_0x9a2a('0x8')]][_0x9a2a('0x3f')]));}}catch(_0x23c847){utils[_0x9a2a('0x28')](util[_0x9a2a('0x16')]('[%s][calls][musiconholdstart]',_0x5bccd8[_0x9a2a('0x8')]),_0x23c847);}};exports[_0x9a2a('0x42')]=function(_0x238a94){try{if(!_['isNil'](channels[_0x238a94[_0x9a2a('0x8')]])){utils['debug'](util[_0x9a2a('0x16')]('[%s][calls][musiconholdstop]',_0x238a94[_0x9a2a('0x8')]),_0x238a94);if(!_[_0x9a2a('0x21')](channels[_0x238a94[_0x9a2a('0x8')]][_0x9a2a('0x3f')])){channels[_0x238a94[_0x9a2a('0x8')]][_0x9a2a('0x43')]+=utils[_0x9a2a('0x31')](utils[_0x9a2a('0x40')](),channels[_0x238a94[_0x9a2a('0x8')]][_0x9a2a('0x3f')]);utils[_0x9a2a('0x9')](util['format'](_0x9a2a('0x44'),_0x238a94[_0x9a2a('0x8')],channels[_0x238a94[_0x9a2a('0x8')]]['mohtime']));delete channels[_0x238a94['uniqueid']][_0x9a2a('0x3f')];}}}catch(_0x235f78){utils[_0x9a2a('0x28')](util['format'](_0x9a2a('0x45'),_0x238a94[_0x9a2a('0x8')]),_0x235f78);}};exports['varset']=function(_0x43df46){try{if(!_[_0x9a2a('0x21')](channels[_0x43df46[_0x9a2a('0x8')]])){utils[_0x9a2a('0x1f')](util[_0x9a2a('0x16')](_0x9a2a('0x46'),_0x43df46[_0x9a2a('0x8')]),_0x43df46);if(!_[_0x9a2a('0x21')](_0x43df46[_0x9a2a('0x47')][_0x9a2a('0x48')])){utils['info'](util[_0x9a2a('0x16')](_0x9a2a('0x49'),_0x43df46['uniqueid'],_0x43df46[_0x9a2a('0x4a')]));channels[_0x43df46[_0x9a2a('0x8')]][_0x9a2a('0x4b')]=_0x43df46[_0x9a2a('0x4a')];}if(!_[_0x9a2a('0x21')](_0x43df46[_0x9a2a('0x47')][_0x9a2a('0x4c')])){utils[_0x9a2a('0x9')](util[_0x9a2a('0x16')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x43df46[_0x9a2a('0x8')],_0x43df46[_0x9a2a('0x4a')]));channels[_0x43df46[_0x9a2a('0x8')]][_0x9a2a('0x4d')]=_0x43df46[_0x9a2a('0x4a')];channels[_0x43df46[_0x9a2a('0x8')]][_0x9a2a('0x2d')]='\x22'+_0x43df46[_0x9a2a('0x4a')]+_0x9a2a('0x4e')+_0x43df46[_0x9a2a('0x4a')]+'>';}if(!_['isNil'](_0x43df46[_0x9a2a('0x47')]['xmd-callerid-preview'])||!_[_0x9a2a('0x21')](_0x43df46[_0x9a2a('0x47')][_0x9a2a('0x4f')])){utils[_0x9a2a('0x9')](util[_0x9a2a('0x16')](_0x9a2a('0x50'),_0x43df46[_0x9a2a('0x8')],!_[_0x9a2a('0x21')](_0x43df46['variable'][_0x9a2a('0x51')])?'xmd-callerid-preview':_0x9a2a('0x4f'),_0x43df46[_0x9a2a('0x4a')]));channels[_0x43df46[_0x9a2a('0x8')]][_0x9a2a('0x2d')]=_0x43df46['value'];}if(!_[_0x9a2a('0x21')](_0x43df46[_0x9a2a('0x47')][_0x9a2a('0x52')])||!_[_0x9a2a('0x21')](_0x43df46[_0x9a2a('0x47')][_0x9a2a('0x53')])){utils[_0x9a2a('0x9')](util['format'](_0x9a2a('0x50'),_0x43df46[_0x9a2a('0x8')],!_[_0x9a2a('0x21')](_0x43df46[_0x9a2a('0x47')][_0x9a2a('0x52')])?_0x9a2a('0x52'):_0x9a2a('0x53'),_0x43df46[_0x9a2a('0x4a')]));channels[_0x43df46[_0x9a2a('0x8')]][_0x9a2a('0x54')]=_0x9a2a('0x55');channels[_0x43df46[_0x9a2a('0x8')]]['lastdata']=_0x43df46[_0x9a2a('0x4a')];channels[_0x43df46[_0x9a2a('0x8')]][_0x9a2a('0xb')]=!![];}if(!_[_0x9a2a('0x21')](_0x43df46[_0x9a2a('0x47')][_0x9a2a('0x56')])){utils[_0x9a2a('0x9')](util['format'](_0x9a2a('0x57'),_0x43df46['uniqueid'],_0x43df46[_0x9a2a('0x4a')]));channels[_0x43df46['uniqueid']]['ContactId']=_0x43df46[_0x9a2a('0x4a')];}if(!_[_0x9a2a('0x21')](_0x43df46['variable'][_0x9a2a('0x58')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x43df46[_0x9a2a('0x8')],_0x43df46[_0x9a2a('0x4a')]));channels[_0x43df46[_0x9a2a('0x8')]][_0x9a2a('0x59')]=_0x43df46['value'];}if(!_['isNil'](_0x43df46['variable'][_0x9a2a('0x5a')])){utils[_0x9a2a('0x9')](util[_0x9a2a('0x16')](_0x9a2a('0x5b'),_0x43df46[_0x9a2a('0x8')],_0x43df46[_0x9a2a('0x4a')]));channels[_0x43df46['uniqueid']]['routeid']=_0x43df46['value'];}if(!_[_0x9a2a('0x21')](_0x43df46[_0x9a2a('0x47')][_0x9a2a('0x5c')])){utils[_0x9a2a('0x9')](util[_0x9a2a('0x16')](_0x9a2a('0x5d'),_0x43df46[_0x9a2a('0x8')],_0x43df46[_0x9a2a('0x4a')]));channels[_0x43df46[_0x9a2a('0x8')]]['sipcallid']=_0x43df46[_0x9a2a('0x4a')];}}}catch(_0x4590ad){utils[_0x9a2a('0x28')](util[_0x9a2a('0x16')](_0x9a2a('0x46'),_0x43df46['uniqueid']),_0x4590ad);}};exports[_0x9a2a('0x5e')]=function(_0x4a4892){try{if(!_['isNil'](channels[_0x4a4892[_0x9a2a('0x8')]])){utils['debug'](util[_0x9a2a('0x16')]('[%s][calls][newexten]',_0x4a4892['uniqueid']),_0x4a4892);utils[_0x9a2a('0x9')](util[_0x9a2a('0x16')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x4a4892[_0x9a2a('0x8')],_0x4a4892[_0x9a2a('0x5f')],_0x4a4892['appdata']));if(_0x4a4892[_0x9a2a('0x5f')][_0x9a2a('0x60')]()==_0x9a2a('0x61')&&_[_0x9a2a('0x62')](_0x4a4892[_0x9a2a('0x63')]['toLowerCase'](),_0x9a2a('0x64'))){var _0x581344=_0x4a4892['appdata'][_0x9a2a('0x65')]('=');var _0x4b4c7e=_0x581344[0x0][_0x9a2a('0x66')](_0x581344[0x0][_0x9a2a('0x67')]('(')+0x1,_0x581344[0x0][_0x9a2a('0x67')](')'));var _0x292a=_0x581344[0x1];channels[_0x4a4892[_0x9a2a('0x8')]][_0x4b4c7e]=_0x292a;}if(!_['includes']([_0x9a2a('0x29'),_0x9a2a('0x68'),_0x9a2a('0x69'),'set',_0x9a2a('0x6a')],_0x4a4892[_0x9a2a('0x5f')][_0x9a2a('0x60')]())){channels[_0x4a4892[_0x9a2a('0x8')]][_0x9a2a('0x54')]=_0x4a4892[_0x9a2a('0x5f')];channels[_0x4a4892[_0x9a2a('0x8')]][_0x9a2a('0x6b')]=_0x4a4892[_0x9a2a('0x63')];}}}catch(_0x450e4a){utils['error'](util[_0x9a2a('0x16')]('[%s][calls][newexten]',_0x4a4892[_0x9a2a('0x8')]),_0x450e4a);}}; \ No newline at end of file +var _0x6bbc=['calleridnum','connectedlinenum','lastevent','accountcode','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','linkedid','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','toNumber','[%s][calls][newstate]','hangup','[%s][calls][hangup]','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','callerid','endtime','diffTime','starttime','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','transfereechannel','secondtransfererchannel','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr','substring','lastIndexOf','includes','noop','execif','gotoif','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface'];(function(_0xc5a5ab,_0x2518e3){var _0x313a2e=function(_0x203bbe){while(--_0x203bbe){_0xc5a5ab['push'](_0xc5a5ab['shift']());}};_0x313a2e(++_0x2518e3);}(_0x6bbc,0x131));var _0xc6bb=function(_0x2f6a20,_0xf9a6af){_0x2f6a20=_0x2f6a20-0x0;var _0x3c4531=_0x6bbc[_0x2f6a20];return _0x3c4531;};'use strict';var _=require(_0xc6bb('0x0'));var util=require(_0xc6bb('0x1'));var utils=require(_0xc6bb('0x2'));var transfers=require('./transfers.controller');var dispositions=[_0xc6bb('0x3'),_0xc6bb('0x4'),_0xc6bb('0x4'),_0xc6bb('0x3'),'NO\x20ANSWER','NO\x20ANSWER',_0xc6bb('0x5'),_0xc6bb('0x6'),_0xc6bb('0x4'),_0xc6bb('0x4'),_0xc6bb('0x4')];var channels={};function writeDB(_0x270463){var _0xb9a851;if(transfers[_0xc6bb('0x7')][_0x270463[_0xc6bb('0x8')]]){_0xb9a851=_0x270463['uniqueid'];_0x270463[_0xc6bb('0x8')]=transfers[_0xc6bb('0x7')][_0x270463['uniqueid']]['transfereeuniqueid'];}utils[_0xc6bb('0x9')](util[_0xc6bb('0xa')](_0xc6bb('0xb'),_0x270463[_0xc6bb('0x8')],_0x270463[_0xc6bb('0xc')],_0x270463[_0xc6bb('0xd')],_0x270463[_0xc6bb('0xe')],_0x270463[_0xc6bb('0xf')],_0x270463[_0xc6bb('0x10')],_0x270463[_0xc6bb('0x11')],_0x270463[_0xc6bb('0x12')]));if(_0x270463[_0xc6bb('0x13')]){utils['getUserByInternal'](_0x270463['accountcode'])[_0xc6bb('0x14')](function(_0x268ec5){if(_0x268ec5){_0x270463[_0xc6bb('0x15')]=_0x268ec5['id'];}utils[_0xc6bb('0x16')](_0xc6bb('0x17'),_0x270463);});}else{utils[_0xc6bb('0x16')](_0xc6bb('0x17'),_0x270463);}if(channels[_0x270463[_0xc6bb('0x8')]]){delete channels[_0x270463[_0xc6bb('0x8')]];}else if(_0xb9a851&&channels[_0xb9a851]){delete transfers[_0xc6bb('0x7')][_0xb9a851];delete channels[_0xb9a851];}}exports[_0xc6bb('0x18')]=function(_0x583e64){try{utils[_0xc6bb('0x19')](util[_0xc6bb('0xa')](_0xc6bb('0x1a'),_0x583e64[_0xc6bb('0x8')]),_0x583e64);if(_0x583e64[_0xc6bb('0x8')]==_0x583e64['linkedid']&&_0x583e64[_0xc6bb('0xc')]!=_0xc6bb('0x1b')){utils[_0xc6bb('0x9')](util[_0xc6bb('0xa')](_0xc6bb('0x1c'),_0x583e64['uniqueid'],_0x583e64[_0xc6bb('0x1d')],_0x583e64['exten']));channels[_0x583e64[_0xc6bb('0x8')]]={'uniqueid':_0x583e64[_0xc6bb('0x8')],'accountcode':_0x583e64[_0xc6bb('0x13')],'source':_0x583e64[_0xc6bb('0x10')],'destination':_0x583e64[_0xc6bb('0x1e')],'destinationcontext':_0x583e64[_0xc6bb('0x1d')],'channel':_0x583e64[_0xc6bb('0xc')],'starttime':utils[_0xc6bb('0x1f')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xc6bb('0x3'),'amaflags':_0xc6bb('0x20')};}}catch(_0xce86c8){utils[_0xc6bb('0x21')](util[_0xc6bb('0xa')](_0xc6bb('0x1a'),_0x583e64['uniqueid']),_0xce86c8);}};exports[_0xc6bb('0x22')]=function(_0x5ce59d){try{utils[_0xc6bb('0x19')](util[_0xc6bb('0xa')]('[%s][calls][newstate]',_0x5ce59d[_0xc6bb('0x8')]),_0x5ce59d);if(!_[_0xc6bb('0x23')](channels[_0x5ce59d[_0xc6bb('0x8')]])&&_0x5ce59d[_0xc6bb('0x24')]==0x6){utils[_0xc6bb('0x9')](util['format'](_0xc6bb('0x25'),_0x5ce59d['uniqueid'],_0x5ce59d[_0xc6bb('0x1d')],_0x5ce59d[_0xc6bb('0xc')]));if(_[_0xc6bb('0x23')](channels[_0x5ce59d['uniqueid']][_0xc6bb('0x26')])){channels[_0x5ce59d['uniqueid']][_0xc6bb('0x26')]=utils[_0xc6bb('0x1f')]();}}else if(!_[_0xc6bb('0x23')](channels[_0x5ce59d[_0xc6bb('0x27')]])&&_0x5ce59d[_0xc6bb('0x24')]==0x6&&_0x5ce59d[_0xc6bb('0x1d')]!='transfer'){utils[_0xc6bb('0x9')](util[_0xc6bb('0xa')](_0xc6bb('0x28'),_0x5ce59d[_0xc6bb('0x8')],_0x5ce59d[_0xc6bb('0x27')],_0x5ce59d[_0xc6bb('0x1d')],_0x5ce59d['channel']));channels[_0x5ce59d[_0xc6bb('0x27')]]['accountcode']=_0x5ce59d[_0xc6bb('0x13')];channels[_0x5ce59d['linkedid']][_0xc6bb('0x29')]=_0x5ce59d['channel'];if(_[_0xc6bb('0x23')](channels[_0x5ce59d[_0xc6bb('0x27')]][_0xc6bb('0x2a')])){channels[_0x5ce59d['linkedid']]['answertime']=utils[_0xc6bb('0x1f')]();}channels[_0x5ce59d[_0xc6bb('0x27')]]['disposition']=dispositions[_[_0xc6bb('0x2b')](_0x5ce59d[_0xc6bb('0x24')])]||'ANSWERED';}}catch(_0x58bfdd){utils[_0xc6bb('0x21')](util[_0xc6bb('0xa')](_0xc6bb('0x2c'),_0x5ce59d[_0xc6bb('0x8')]),_0x58bfdd);}};exports[_0xc6bb('0x2d')]=function(_0x549188){try{if(!_[_0xc6bb('0x23')](channels[_0x549188[_0xc6bb('0x8')]])){utils[_0xc6bb('0x19')](util['format'](_0xc6bb('0x2e'),_0x549188[_0xc6bb('0x8')]),_0x549188);if(_['isNil'](channels[_0x549188[_0xc6bb('0x8')]]['callerid'])){channels[_0x549188[_0xc6bb('0x8')]]['callerid']=_0x549188[_0xc6bb('0x2f')]+'\x20<'+_0x549188[_0xc6bb('0x10')]+'>';}utils[_0xc6bb('0x9')](util[_0xc6bb('0xa')](_0xc6bb('0x30'),_0x549188[_0xc6bb('0x8')],channels[_0x549188[_0xc6bb('0x8')]][_0xc6bb('0x31')],_0x549188['cause-txt']));channels[_0x549188[_0xc6bb('0x8')]][_0xc6bb('0x32')]=utils[_0xc6bb('0x1f')]();channels[_0x549188['uniqueid']]['duration']=utils[_0xc6bb('0x33')](channels[_0x549188[_0xc6bb('0x8')]][_0xc6bb('0x32')],channels[_0x549188[_0xc6bb('0x8')]][_0xc6bb('0x34')]);channels[_0x549188[_0xc6bb('0x8')]]['billableseconds']=channels[_0x549188[_0xc6bb('0x8')]][_0xc6bb('0x2a')]?utils[_0xc6bb('0x33')](channels[_0x549188[_0xc6bb('0x8')]][_0xc6bb('0x32')],channels[_0x549188[_0xc6bb('0x8')]]['answertime']):0x0;writeDB(channels[_0x549188[_0xc6bb('0x8')]]);}}catch(_0x2f9555){utils[_0xc6bb('0x21')](util[_0xc6bb('0xa')](_0xc6bb('0x2e'),_0x549188['uniqueid']),_0x2f9555);}};exports[_0xc6bb('0x35')]=function(_0x288d9d){try{if(!_['isNil'](channels[_0x288d9d['localtwolinkedid']])){utils['debug'](util[_0xc6bb('0xa')](_0xc6bb('0x36'),_0x288d9d[_0xc6bb('0x37')]),_0x288d9d);if(channels[_0x288d9d[_0xc6bb('0x38')]][_0xc6bb('0xc')]==_0x288d9d[_0xc6bb('0x39')]){utils[_0xc6bb('0x9')](util[_0xc6bb('0xa')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x288d9d[_0xc6bb('0x37')],_0x288d9d[_0xc6bb('0x38')],_0x288d9d[_0xc6bb('0x3a')]));channels[_0x288d9d[_0xc6bb('0x38')]][_0xc6bb('0x29')]=_0x288d9d['secondtransfererchannel'];channels[_0x288d9d[_0xc6bb('0x38')]]['userfield']=_0xc6bb('0x3b');}else if(channels[_0x288d9d['localtwolinkedid']][_0xc6bb('0xc')]=_0x288d9d[_0xc6bb('0x3c')]){utils['info'](util[_0xc6bb('0xa')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x288d9d[_0xc6bb('0x37')],_0x288d9d['localtwolinkedid'],_0x288d9d[_0xc6bb('0x3d')]));channels[_0x288d9d[_0xc6bb('0x38')]]['destinationchannel']=_0x288d9d['origtransfererchannel'];channels[_0x288d9d[_0xc6bb('0x38')]]['userfield']=_0xc6bb('0x3b');}}}catch(_0x4ef490){utils[_0xc6bb('0x21')](util[_0xc6bb('0xa')](_0xc6bb('0x36'),_0x288d9d[_0xc6bb('0x37')]),_0x4ef490);}};exports['musiconholdstart']=function(_0x3edb2b){try{if(!_['isNil'](channels[_0x3edb2b[_0xc6bb('0x8')]])){utils['debug'](util[_0xc6bb('0xa')](_0xc6bb('0x3e'),_0x3edb2b[_0xc6bb('0x8')]),_0x3edb2b);channels[_0x3edb2b[_0xc6bb('0x8')]][_0xc6bb('0x3f')]=utils[_0xc6bb('0x1f')]();utils[_0xc6bb('0x9')](util['format'](_0xc6bb('0x40'),_0x3edb2b['uniqueid'],channels[_0x3edb2b[_0xc6bb('0x8')]]['musiconholdstartAt']));}}catch(_0x224473){utils['error'](util[_0xc6bb('0xa')](_0xc6bb('0x3e'),_0x3edb2b[_0xc6bb('0x8')]),_0x224473);}};exports[_0xc6bb('0x41')]=function(_0x337f3d){try{if(!_['isNil'](channels[_0x337f3d[_0xc6bb('0x8')]])){utils['debug'](util[_0xc6bb('0xa')](_0xc6bb('0x42'),_0x337f3d[_0xc6bb('0x8')]),_0x337f3d);if(!_[_0xc6bb('0x23')](channels[_0x337f3d['uniqueid']][_0xc6bb('0x3f')])){channels[_0x337f3d[_0xc6bb('0x8')]][_0xc6bb('0x43')]+=utils['diffTime'](utils[_0xc6bb('0x1f')](),channels[_0x337f3d[_0xc6bb('0x8')]][_0xc6bb('0x3f')]);utils[_0xc6bb('0x9')](util[_0xc6bb('0xa')](_0xc6bb('0x44'),_0x337f3d[_0xc6bb('0x8')],channels[_0x337f3d[_0xc6bb('0x8')]]['mohtime']));delete channels[_0x337f3d[_0xc6bb('0x8')]]['musiconholdstartAt'];}}}catch(_0x3559d1){utils[_0xc6bb('0x21')](util[_0xc6bb('0xa')](_0xc6bb('0x42'),_0x337f3d[_0xc6bb('0x8')]),_0x3559d1);}};exports[_0xc6bb('0x45')]=function(_0x564c00){try{if(!_[_0xc6bb('0x23')](channels[_0x564c00[_0xc6bb('0x8')]])){utils[_0xc6bb('0x19')](util['format'](_0xc6bb('0x46'),_0x564c00['uniqueid']),_0x564c00);if(!_[_0xc6bb('0x23')](_0x564c00[_0xc6bb('0x47')][_0xc6bb('0x48')])){utils['info'](util[_0xc6bb('0xa')](_0xc6bb('0x49'),_0x564c00[_0xc6bb('0x8')],_0x564c00['value']));channels[_0x564c00['uniqueid']][_0xc6bb('0x4a')]=_0x564c00[_0xc6bb('0x4b')];}if(!_['isNil'](_0x564c00[_0xc6bb('0x47')][_0xc6bb('0x4c')])){utils[_0xc6bb('0x9')](util[_0xc6bb('0xa')](_0xc6bb('0x4d'),_0x564c00[_0xc6bb('0x8')],_0x564c00[_0xc6bb('0x4b')]));channels[_0x564c00[_0xc6bb('0x8')]]['destination']=_0x564c00[_0xc6bb('0x4b')];channels[_0x564c00[_0xc6bb('0x8')]][_0xc6bb('0x31')]='\x22'+_0x564c00[_0xc6bb('0x4b')]+'\x22\x20<'+_0x564c00[_0xc6bb('0x4b')]+'>';}if(!_[_0xc6bb('0x23')](_0x564c00[_0xc6bb('0x47')][_0xc6bb('0x4e')])||!_[_0xc6bb('0x23')](_0x564c00[_0xc6bb('0x47')][_0xc6bb('0x4f')])){utils[_0xc6bb('0x9')](util['format'](_0xc6bb('0x50'),_0x564c00[_0xc6bb('0x8')],!_['isNil'](_0x564c00[_0xc6bb('0x47')][_0xc6bb('0x4e')])?_0xc6bb('0x4e'):_0xc6bb('0x4f'),_0x564c00[_0xc6bb('0x4b')]));channels[_0x564c00[_0xc6bb('0x8')]][_0xc6bb('0x31')]=_0x564c00['value'];}if(!_[_0xc6bb('0x23')](_0x564c00['variable'][_0xc6bb('0x51')])||!_[_0xc6bb('0x23')](_0x564c00[_0xc6bb('0x47')][_0xc6bb('0x52')])){utils[_0xc6bb('0x9')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x564c00['uniqueid'],!_['isNil'](_0x564c00[_0xc6bb('0x47')][_0xc6bb('0x51')])?_0xc6bb('0x51'):'xmcs-queue',_0x564c00[_0xc6bb('0x4b')]));channels[_0x564c00[_0xc6bb('0x8')]]['lastapplication']=_0xc6bb('0x53');channels[_0x564c00[_0xc6bb('0x8')]][_0xc6bb('0x54')]=_0x564c00[_0xc6bb('0x4b')];channels[_0x564c00[_0xc6bb('0x8')]][_0xc6bb('0xd')]=!![];}if(!_[_0xc6bb('0x23')](_0x564c00[_0xc6bb('0x47')][_0xc6bb('0x55')])){utils[_0xc6bb('0x9')](util[_0xc6bb('0xa')](_0xc6bb('0x56'),_0x564c00[_0xc6bb('0x8')],_0x564c00[_0xc6bb('0x4b')]));channels[_0x564c00[_0xc6bb('0x8')]][_0xc6bb('0x57')]=_0x564c00[_0xc6bb('0x4b')];}if(!_[_0xc6bb('0x23')](_0x564c00['variable'][_0xc6bb('0x58')])){utils[_0xc6bb('0x9')](util[_0xc6bb('0xa')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x564c00[_0xc6bb('0x8')],_0x564c00[_0xc6bb('0x4b')]));channels[_0x564c00['uniqueid']]['type']=_0x564c00[_0xc6bb('0x4b')];}if(!_['isNil'](_0x564c00[_0xc6bb('0x47')]['outboundrouteid'])){utils[_0xc6bb('0x9')](util[_0xc6bb('0xa')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x564c00['uniqueid'],_0x564c00[_0xc6bb('0x4b')]));channels[_0x564c00[_0xc6bb('0x8')]][_0xc6bb('0x59')]=_0x564c00[_0xc6bb('0x4b')];}if(!_['isNil'](_0x564c00['variable'][_0xc6bb('0x5a')])){utils[_0xc6bb('0x9')](util[_0xc6bb('0xa')](_0xc6bb('0x5b'),_0x564c00[_0xc6bb('0x8')],_0x564c00['value']));channels[_0x564c00[_0xc6bb('0x8')]]['sipcallid']=_0x564c00[_0xc6bb('0x4b')];}}}catch(_0x138c88){utils['error'](util[_0xc6bb('0xa')](_0xc6bb('0x46'),_0x564c00[_0xc6bb('0x8')]),_0x138c88);}};exports[_0xc6bb('0x5c')]=function(_0xd98b5){try{if(!_['isNil'](channels[_0xd98b5[_0xc6bb('0x8')]])){utils['debug'](util[_0xc6bb('0xa')](_0xc6bb('0x5d'),_0xd98b5[_0xc6bb('0x8')]),_0xd98b5);utils[_0xc6bb('0x9')](util[_0xc6bb('0xa')](_0xc6bb('0x5e'),_0xd98b5[_0xc6bb('0x8')],_0xd98b5[_0xc6bb('0x5f')],_0xd98b5[_0xc6bb('0x60')]));if(_0xd98b5[_0xc6bb('0x5f')]['toLowerCase']()==_0xc6bb('0x61')&&_[_0xc6bb('0x62')](_0xd98b5['appdata'][_0xc6bb('0x63')](),_0xc6bb('0x64'))){var _0x5516ea=_0xd98b5[_0xc6bb('0x60')]['split']('=');var _0x4a144c=_0x5516ea[0x0][_0xc6bb('0x65')](_0x5516ea[0x0][_0xc6bb('0x66')]('(')+0x1,_0x5516ea[0x0]['lastIndexOf'](')'));var _0x4a668a=_0x5516ea[0x1];channels[_0xd98b5['uniqueid']][_0x4a144c]=_0x4a668a;}if(!_[_0xc6bb('0x67')]([_0xc6bb('0x2d'),_0xc6bb('0x68'),_0xc6bb('0x69'),_0xc6bb('0x61'),_0xc6bb('0x6a')],_0xd98b5[_0xc6bb('0x5f')]['toLowerCase']())){channels[_0xd98b5[_0xc6bb('0x8')]]['lastapplication']=_0xd98b5[_0xc6bb('0x5f')];channels[_0xd98b5['uniqueid']][_0xc6bb('0x54')]=_0xd98b5[_0xc6bb('0x60')];}}}catch(_0x570ea2){utils[_0xc6bb('0x21')](util['format']('[%s][calls][newexten]',_0xd98b5[_0xc6bb('0x8')]),_0x570ea2);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 69b3360..e7d047e 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 _0xf555=['[core]\x20shutdown','fullybooted','error','managerevent','./utils','connect','info','[core]\x20connected','shutdown'];(function(_0x206cdf,_0x23b424){var _0x2e9e41=function(_0x375d0d){while(--_0x375d0d){_0x206cdf['push'](_0x206cdf['shift']());}};_0x2e9e41(++_0x23b424);}(_0xf555,0xc1));var _0x5f55=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf555[_0x3dd15e];return _0x231fd0;};'use strict';var utils=require(_0x5f55('0x0'));exports[_0x5f55('0x1')]=function(){utils[_0x5f55('0x2')](_0x5f55('0x3'));};exports[_0x5f55('0x4')]=function(){utils['info'](_0x5f55('0x5'));};exports[_0x5f55('0x6')]=function(){utils[_0x5f55('0x2')]('[core]\x20fullybooted');};exports['error']=function(_0x1641a6){utils[_0x5f55('0x7')]('[core]\x20error',_0x1641a6);};exports['close']=function(){utils[_0x5f55('0x2')]('[core]\x20close');};exports[_0x5f55('0x8')]=function(_0x4685dc){}; \ No newline at end of file +var _0xc3a2=['managerevent','./utils','connect','info','[core]\x20shutdown','fullybooted','error','close'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc3a2,0x79));var _0x2c3a=function(_0x2954c4,_0x16658b){_0x2954c4=_0x2954c4-0x0;var _0x502235=_0xc3a2[_0x2954c4];return _0x502235;};'use strict';var utils=require(_0x2c3a('0x0'));exports[_0x2c3a('0x1')]=function(){utils[_0x2c3a('0x2')]('[core]\x20connected');};exports['shutdown']=function(){utils[_0x2c3a('0x2')](_0x2c3a('0x3'));};exports[_0x2c3a('0x4')]=function(){utils[_0x2c3a('0x2')]('[core]\x20fullybooted');};exports[_0x2c3a('0x5')]=function(_0x301bba){utils[_0x2c3a('0x5')]('[core]\x20error',_0x301bba);};exports[_0x2c3a('0x6')]=function(){utils[_0x2c3a('0x2')]('[core]\x20close');};exports[_0x2c3a('0x7')]=function(_0x383331){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 304c95b..20a9783 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 _0x2d88=['channel','dialstatus','request','newexten','debug','application','appdata','set','startsWith','toLowerCase','cdr(routeid)','error','[%s][dials][varset]','variable','outboundrouteid','value','dialbegin','[%s][dials][dialbegin]','assign','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','isNil','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','calleridname','cause-txt','duration','diffTime','holdtime','endtime','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid'];(function(_0x261c23,_0x3eea94){var _0x22116b=function(_0xf126f9){while(--_0xf126f9){_0x261c23['push'](_0x261c23['shift']());}};_0x22116b(++_0x3eea94);}(_0x2d88,0x1cf));var _0x82d8=function(_0xb74b54,_0x2247ff){_0xb74b54=_0xb74b54-0x0;var _0x4e7bdf=_0x2d88[_0xb74b54];return _0x4e7bdf;};'use strict';var _=require(_0x82d8('0x0'));var util=require(_0x82d8('0x1'));var utils=require(_0x82d8('0x2'));var dials={};function writeDB(_0x3cf538){utils[_0x82d8('0x3')](util[_0x82d8('0x4')](_0x82d8('0x5'),_0x3cf538[_0x82d8('0x6')],_0x3cf538[_0x82d8('0x7')],_0x3cf538['dialstring'],_0x3cf538['calleridnum'],_0x3cf538['connectedlinenum'],_0x3cf538[_0x82d8('0x8')]));utils[_0x82d8('0x9')]('CreateVoiceDialReport',_0x3cf538);delete dials[_0x3cf538[_0x82d8('0x6')]];}exports[_0x82d8('0xa')]=function(_0x9918e0){try{utils[_0x82d8('0xb')](util[_0x82d8('0x4')]('[%s][dials][newexten]',_0x9918e0[_0x82d8('0x6')]),_0x9918e0);utils[_0x82d8('0x3')](util['format']('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x9918e0[_0x82d8('0x6')],_0x9918e0[_0x82d8('0xc')],_0x9918e0[_0x82d8('0xd')]));if(_0x9918e0[_0x82d8('0xc')]['toLowerCase']()==_0x82d8('0xe')&&_[_0x82d8('0xf')](_0x9918e0[_0x82d8('0xd')][_0x82d8('0x10')](),_0x82d8('0x11'))){var _0x1ef1b7=_0x9918e0[_0x82d8('0xd')]['split']('=');dials[_0x9918e0['uniqueid']]={'routeId':_0x1ef1b7[0x1]};}}catch(_0x46a233){utils[_0x82d8('0x12')](util[_0x82d8('0x4')]('[%s][dials][newexten]',_0x9918e0[_0x82d8('0x6')]),_0x46a233);}};exports['varset']=function(_0x292e82){try{utils[_0x82d8('0xb')](util[_0x82d8('0x4')](_0x82d8('0x13'),_0x292e82[_0x82d8('0x6')]),_0x292e82);if(!_['isNil'](_0x292e82[_0x82d8('0x14')][_0x82d8('0x15')])){utils[_0x82d8('0x3')](util[_0x82d8('0x4')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x292e82[_0x82d8('0x6')],_0x292e82[_0x82d8('0x16')]));dials[_0x292e82[_0x82d8('0x6')]]={'routeId':_0x292e82[_0x82d8('0x16')]};}}catch(_0xdc3290){utils[_0x82d8('0x12')](util[_0x82d8('0x4')]('[%s][dials][varset]',_0x292e82[_0x82d8('0x6')]),_0xdc3290);}};exports[_0x82d8('0x17')]=function(_0xf5ec20){try{if(!_['isNil'](dials[_0xf5ec20['uniqueid']])){utils[_0x82d8('0xb')](util[_0x82d8('0x4')](_0x82d8('0x18'),_0xf5ec20[_0x82d8('0x6')]),_0xf5ec20);dials[_0xf5ec20[_0x82d8('0x6')]]=_[_0x82d8('0x19')](dials[_0xf5ec20[_0x82d8('0x6')]],_0xf5ec20);dials[_0xf5ec20[_0x82d8('0x6')]]['starttime']=utils[_0x82d8('0x1a')]();dials[_0xf5ec20[_0x82d8('0x6')]][_0x82d8('0x1b')]=_0x82d8('0x1c');utils[_0x82d8('0x3')](util[_0x82d8('0x4')](_0x82d8('0x1d'),_0xf5ec20[_0x82d8('0x6')],dials[_0xf5ec20['uniqueid']][_0x82d8('0x1e')]));}}catch(_0x4b43f7){utils[_0x82d8('0x12')](util['format'](_0x82d8('0x18'),_0xf5ec20[_0x82d8('0x6')]),_0x4b43f7);}};exports[_0x82d8('0x1f')]=function(_0x309212){try{if(!_[_0x82d8('0x20')](dials[_0x309212[_0x82d8('0x6')]])){utils[_0x82d8('0xb')](util[_0x82d8('0x4')](_0x82d8('0x21'),_0x309212[_0x82d8('0x6')]),_0x309212);dials[_0x309212[_0x82d8('0x6')]]['dialstatus']=_0x309212[_0x82d8('0x8')];if(_0x309212[_0x82d8('0x8')]==_0x82d8('0x22')){dials[_0x309212[_0x82d8('0x6')]]=_['assign'](dials[_0x309212[_0x82d8('0x6')]],_0x309212);dials[_0x309212[_0x82d8('0x6')]][_0x82d8('0x23')]=utils[_0x82d8('0x1a')]();dials[_0x309212[_0x82d8('0x6')]]['lastevent']=_0x82d8('0x24');utils[_0x82d8('0x3')](util['format'](_0x82d8('0x25'),_0x309212[_0x82d8('0x6')],_0x309212[_0x82d8('0x8')],dials[_0x309212[_0x82d8('0x6')]][_0x82d8('0x23')]));}else{utils['info'](util[_0x82d8('0x4')](_0x82d8('0x26'),_0x309212[_0x82d8('0x6')],_0x309212[_0x82d8('0x8')]));}}}catch(_0x43a411){utils[_0x82d8('0x12')](util[_0x82d8('0x4')](_0x82d8('0x21'),_0x309212[_0x82d8('0x6')]),_0x43a411);}};exports['hangup']=function(_0x5b4728){try{if(!_[_0x82d8('0x20')](dials[_0x5b4728[_0x82d8('0x6')]])){utils[_0x82d8('0xb')](util[_0x82d8('0x4')]('[%s][dials][hangup]',_0x5b4728[_0x82d8('0x6')]),_0x5b4728);utils[_0x82d8('0x3')](util['format'](_0x82d8('0x27'),_0x5b4728[_0x82d8('0x6')],_0x5b4728[_0x82d8('0x28')],_0x5b4728[_0x82d8('0x29')],_0x5b4728[_0x82d8('0x2a')]));dials[_0x5b4728[_0x82d8('0x6')]]=_['assign'](dials[_0x5b4728['uniqueid']],{'endtime':utils[_0x82d8('0x1a')](),'lastevent':'complete'});dials[_0x5b4728[_0x82d8('0x6')]][_0x82d8('0x2b')]=utils[_0x82d8('0x2c')](dials[_0x5b4728[_0x82d8('0x6')]]['endtime'],dials[_0x5b4728[_0x82d8('0x6')]][_0x82d8('0x1e')]);dials[_0x5b4728[_0x82d8('0x6')]][_0x82d8('0x2d')]=utils[_0x82d8('0x2c')](dials[_0x5b4728['uniqueid']]['answertime']||dials[_0x5b4728[_0x82d8('0x6')]][_0x82d8('0x2e')],dials[_0x5b4728['uniqueid']]['starttime']);dials[_0x5b4728[_0x82d8('0x6')]]['billableseconds']=dials[_0x5b4728['uniqueid']][_0x82d8('0x23')]?utils[_0x82d8('0x2c')](dials[_0x5b4728[_0x82d8('0x6')]][_0x82d8('0x2e')],dials[_0x5b4728['uniqueid']][_0x82d8('0x23')]):0x0;writeDB(dials[_0x5b4728['uniqueid']]);}}catch(_0x392d42){utils[_0x82d8('0x12')](util[_0x82d8('0x4')]('[%s][dials][hangup]',_0x5b4728[_0x82d8('0x6')]),_0x392d42);}}; \ No newline at end of file +var _0x7c82=['format','channel','dialstring','calleridnum','connectedlinenum','dialstatus','CreateVoiceDialReport','uniqueid','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','appdata','split','error','varset','[%s][dials][varset]','isNil','outboundrouteid','value','dialbegin','[%s][dials][dialbegin]','assign','lastevent','starttime','dialend','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','now','complete','duration','diffTime','endtime','billableseconds','lodash','util','info'];(function(_0x1d587a,_0x5eef84){var _0x4216ac=function(_0xa53f2b){while(--_0xa53f2b){_0x1d587a['push'](_0x1d587a['shift']());}};_0x4216ac(++_0x5eef84);}(_0x7c82,0xf2));var _0x27c8=function(_0x7c68b6,_0x445ecc){_0x7c68b6=_0x7c68b6-0x0;var _0x494d17=_0x7c82[_0x7c68b6];return _0x494d17;};'use strict';var _=require(_0x27c8('0x0'));var util=require(_0x27c8('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x209573){utils[_0x27c8('0x2')](util[_0x27c8('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x209573['uniqueid'],_0x209573[_0x27c8('0x4')],_0x209573[_0x27c8('0x5')],_0x209573[_0x27c8('0x6')],_0x209573[_0x27c8('0x7')],_0x209573[_0x27c8('0x8')]));utils['request'](_0x27c8('0x9'),_0x209573);delete dials[_0x209573[_0x27c8('0xa')]];}exports[_0x27c8('0xb')]=function(_0x47b719){try{utils[_0x27c8('0xc')](util[_0x27c8('0x3')](_0x27c8('0xd'),_0x47b719['uniqueid']),_0x47b719);utils[_0x27c8('0x2')](util[_0x27c8('0x3')](_0x27c8('0xe'),_0x47b719[_0x27c8('0xa')],_0x47b719[_0x27c8('0xf')],_0x47b719['appdata']));if(_0x47b719[_0x27c8('0xf')][_0x27c8('0x10')]()==_0x27c8('0x11')&&_['startsWith'](_0x47b719[_0x27c8('0x12')][_0x27c8('0x10')](),'cdr(routeid)')){var _0x2773bb=_0x47b719[_0x27c8('0x12')][_0x27c8('0x13')]('=');dials[_0x47b719['uniqueid']]={'routeId':_0x2773bb[0x1]};}}catch(_0xbaacb7){utils[_0x27c8('0x14')](util[_0x27c8('0x3')](_0x27c8('0xd'),_0x47b719[_0x27c8('0xa')]),_0xbaacb7);}};exports[_0x27c8('0x15')]=function(_0x2a918c){try{utils[_0x27c8('0xc')](util[_0x27c8('0x3')](_0x27c8('0x16'),_0x2a918c[_0x27c8('0xa')]),_0x2a918c);if(!_[_0x27c8('0x17')](_0x2a918c['variable'][_0x27c8('0x18')])){utils[_0x27c8('0x2')](util[_0x27c8('0x3')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x2a918c[_0x27c8('0xa')],_0x2a918c[_0x27c8('0x19')]));dials[_0x2a918c[_0x27c8('0xa')]]={'routeId':_0x2a918c['value']};}}catch(_0x64df49){utils['error'](util[_0x27c8('0x3')](_0x27c8('0x16'),_0x2a918c[_0x27c8('0xa')]),_0x64df49);}};exports[_0x27c8('0x1a')]=function(_0x3c79e5){try{if(!_[_0x27c8('0x17')](dials[_0x3c79e5[_0x27c8('0xa')]])){utils[_0x27c8('0xc')](util['format'](_0x27c8('0x1b'),_0x3c79e5[_0x27c8('0xa')]),_0x3c79e5);dials[_0x3c79e5[_0x27c8('0xa')]]=_[_0x27c8('0x1c')](dials[_0x3c79e5[_0x27c8('0xa')]],_0x3c79e5);dials[_0x3c79e5[_0x27c8('0xa')]]['starttime']=utils['now']();dials[_0x3c79e5['uniqueid']][_0x27c8('0x1d')]='called';utils[_0x27c8('0x2')](util[_0x27c8('0x3')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x3c79e5[_0x27c8('0xa')],dials[_0x3c79e5[_0x27c8('0xa')]][_0x27c8('0x1e')]));}}catch(_0x343708){utils[_0x27c8('0x14')](util[_0x27c8('0x3')](_0x27c8('0x1b'),_0x3c79e5[_0x27c8('0xa')]),_0x343708);}};exports[_0x27c8('0x1f')]=function(_0x7c0dcf){try{if(!_['isNil'](dials[_0x7c0dcf[_0x27c8('0xa')]])){utils[_0x27c8('0xc')](util['format'](_0x27c8('0x20'),_0x7c0dcf['uniqueid']),_0x7c0dcf);dials[_0x7c0dcf[_0x27c8('0xa')]][_0x27c8('0x8')]=_0x7c0dcf[_0x27c8('0x8')];if(_0x7c0dcf[_0x27c8('0x8')]==_0x27c8('0x21')){dials[_0x7c0dcf[_0x27c8('0xa')]]=_['assign'](dials[_0x7c0dcf[_0x27c8('0xa')]],_0x7c0dcf);dials[_0x7c0dcf[_0x27c8('0xa')]][_0x27c8('0x22')]=utils['now']();dials[_0x7c0dcf[_0x27c8('0xa')]]['lastevent']=_0x27c8('0x23');utils['info'](util['format'](_0x27c8('0x24'),_0x7c0dcf[_0x27c8('0xa')],_0x7c0dcf[_0x27c8('0x8')],dials[_0x7c0dcf[_0x27c8('0xa')]][_0x27c8('0x22')]));}else{utils[_0x27c8('0x2')](util['format'](_0x27c8('0x25'),_0x7c0dcf[_0x27c8('0xa')],_0x7c0dcf[_0x27c8('0x8')]));}}}catch(_0x49f325){utils[_0x27c8('0x14')](util[_0x27c8('0x3')](_0x27c8('0x20'),_0x7c0dcf['uniqueid']),_0x49f325);}};exports[_0x27c8('0x26')]=function(_0x1c2e97){try{if(!_[_0x27c8('0x17')](dials[_0x1c2e97['uniqueid']])){utils[_0x27c8('0xc')](util[_0x27c8('0x3')](_0x27c8('0x27'),_0x1c2e97['uniqueid']),_0x1c2e97);utils['info'](util['format'](_0x27c8('0x28'),_0x1c2e97[_0x27c8('0xa')],_0x1c2e97[_0x27c8('0x6')],_0x1c2e97[_0x27c8('0x29')],_0x1c2e97[_0x27c8('0x2a')]));dials[_0x1c2e97['uniqueid']]=_[_0x27c8('0x1c')](dials[_0x1c2e97[_0x27c8('0xa')]],{'endtime':utils[_0x27c8('0x2b')](),'lastevent':_0x27c8('0x2c')});dials[_0x1c2e97['uniqueid']][_0x27c8('0x2d')]=utils[_0x27c8('0x2e')](dials[_0x1c2e97['uniqueid']][_0x27c8('0x2f')],dials[_0x1c2e97[_0x27c8('0xa')]][_0x27c8('0x1e')]);dials[_0x1c2e97[_0x27c8('0xa')]]['holdtime']=utils['diffTime'](dials[_0x1c2e97['uniqueid']][_0x27c8('0x22')]||dials[_0x1c2e97[_0x27c8('0xa')]][_0x27c8('0x2f')],dials[_0x1c2e97[_0x27c8('0xa')]]['starttime']);dials[_0x1c2e97[_0x27c8('0xa')]][_0x27c8('0x30')]=dials[_0x1c2e97[_0x27c8('0xa')]][_0x27c8('0x22')]?utils[_0x27c8('0x2e')](dials[_0x1c2e97[_0x27c8('0xa')]][_0x27c8('0x2f')],dials[_0x1c2e97['uniqueid']][_0x27c8('0x22')]):0x0;writeDB(dials[_0x1c2e97[_0x27c8('0xa')]]);}}catch(_0x408c1b){utils[_0x27c8('0x14')](util[_0x27c8('0x3')](_0x27c8('0x27'),_0x1c2e97[_0x27c8('0xa')]),_0x408c1b);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 21d9c19..159ce61 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 _0x9d3c=['disabled','XDR\x20DISABLED','./agents.controller','./queues.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','./utils','util','port','asterisk','username','password','keepConnected','xdr'];(function(_0x2e7c96,_0x27804d){var _0x36008e=function(_0xd03b6b){while(--_0xd03b6b){_0x2e7c96['push'](_0x2e7c96['shift']());}};_0x36008e(++_0x27804d);}(_0x9d3c,0xc6));var _0xc9d3=function(_0x30bed8,_0x6bbdcd){_0x30bed8=_0x30bed8-0x0;var _0x261e4f=_0x9d3c[_0x30bed8];return _0x261e4f;};var AsteriskManager=require(_0xc9d3('0x0'));var config=require('../../config/environment');var utils=require(_0xc9d3('0x1'));var util=require(_0xc9d3('0x2'));var ami=new AsteriskManager(config['asterisk'][_0xc9d3('0x3')],config[_0xc9d3('0x4')]['ip'],config[_0xc9d3('0x4')][_0xc9d3('0x5')],config['asterisk'][_0xc9d3('0x6')],!![]);ami[_0xc9d3('0x7')]();if(config[_0xc9d3('0x8')]&&config[_0xc9d3('0x8')][_0xc9d3('0x9')]){utils['info'](_0xc9d3('0xa'));}else{var agents=require(_0xc9d3('0xb'));var calls=require('./calls.controller');var queues=require(_0xc9d3('0xc'));var recordings=require('./recordings.controller');var members=require(_0xc9d3('0xd'));var dials=require(_0xc9d3('0xe'));var transfers=require(_0xc9d3('0xf'));var core=require(_0xc9d3('0x10'));ami['on'](_0xc9d3('0x11'),core[_0xc9d3('0x11')]);ami['on'](_0xc9d3('0x12'),core[_0xc9d3('0x12')]);ami['on'](_0xc9d3('0x13'),core['fullybooted']);ami['on'](_0xc9d3('0x14'),core[_0xc9d3('0x14')]);ami['on'](_0xc9d3('0x15'),core['close']);ami['on'](_0xc9d3('0x16'),core[_0xc9d3('0x16')]);ami['on'](_0xc9d3('0x17'),function(_0x439a0c){try{utils[_0xc9d3('0x18')](util[_0xc9d3('0x19')](_0xc9d3('0x1a'),_0x439a0c['device']),_0x439a0c);members[_0xc9d3('0x17')](_0x439a0c);}catch(_0xb510d8){utils[_0xc9d3('0x14')](util['format'](_0xc9d3('0x1a'),_0x439a0c[_0xc9d3('0x1b')]),_0xb510d8);}});ami['on'](_0xc9d3('0x1c'),function(_0x382695){try{utils[_0xc9d3('0x18')](util[_0xc9d3('0x19')](_0xc9d3('0x1d'),_0x382695[_0xc9d3('0x1e')]),_0x382695);agents['agentcalled'](_0x382695);}catch(_0x4e7dcd){utils[_0xc9d3('0x14')](util[_0xc9d3('0x19')](_0xc9d3('0x1d'),_0x382695[_0xc9d3('0x1e')]),_0x4e7dcd);}});ami['on'](_0xc9d3('0x1f'),function(_0x4777a4){try{utils[_0xc9d3('0x18')](util['format'](_0xc9d3('0x20'),_0x4777a4[_0xc9d3('0x1e')]),_0x4777a4);agents[_0xc9d3('0x1f')](_0x4777a4);}catch(_0x10f58d){utils[_0xc9d3('0x14')](util[_0xc9d3('0x19')]('[%s][index][agentringnoanswer]',_0x4777a4[_0xc9d3('0x1e')]),_0x10f58d);}});ami['on'](_0xc9d3('0x21'),function(_0x45b39e){try{utils['debug'](util['format'](_0xc9d3('0x22'),_0x45b39e[_0xc9d3('0x1e')]),_0x45b39e);agents[_0xc9d3('0x21')](_0x45b39e);queues[_0xc9d3('0x21')](_0x45b39e);}catch(_0xcfb819){utils[_0xc9d3('0x14')](util['format'](_0xc9d3('0x22'),_0x45b39e[_0xc9d3('0x1e')]),_0xcfb819);}});ami['on'](_0xc9d3('0x23'),function(_0x483f57){try{utils[_0xc9d3('0x18')](util[_0xc9d3('0x19')](_0xc9d3('0x24'),_0x483f57[_0xc9d3('0x1e')]),_0x483f57);agents['agentcomplete'](_0x483f57);queues[_0xc9d3('0x23')](_0x483f57);members[_0xc9d3('0x23')](_0x483f57);}catch(_0x40ba20){utils['error'](util[_0xc9d3('0x19')](_0xc9d3('0x24'),_0x483f57['uniqueid']),_0x40ba20);}});ami['on'](_0xc9d3('0x25'),function(_0x428b93){try{utils[_0xc9d3('0x18')](util[_0xc9d3('0x19')](_0xc9d3('0x26'),_0x428b93[_0xc9d3('0x1e')]),_0x428b93);agents[_0xc9d3('0x25')](_0x428b93);queues[_0xc9d3('0x25')](_0x428b93);}catch(_0x3550ae){utils[_0xc9d3('0x14')](util['format'](_0xc9d3('0x26'),_0x428b93[_0xc9d3('0x1e')]),_0x3550ae);}});ami['on'](_0xc9d3('0x27'),function(_0x1fd642){try{utils['debug'](util[_0xc9d3('0x19')](_0xc9d3('0x28'),_0x1fd642[_0xc9d3('0x1e')]),_0x1fd642);queues[_0xc9d3('0x27')](_0x1fd642);recordings['queuecallerjoin'](_0x1fd642);}catch(_0x4142eb){utils[_0xc9d3('0x14')](util[_0xc9d3('0x19')](_0xc9d3('0x28'),_0x1fd642[_0xc9d3('0x1e')]),_0x4142eb);}});ami['on'](_0xc9d3('0x29'),function(_0x5031f6){try{utils[_0xc9d3('0x18')](util[_0xc9d3('0x19')](_0xc9d3('0x2a'),_0x5031f6['uniqueid']),_0x5031f6);queues['queuecallerleave'](_0x5031f6);}catch(_0x34d7b1){utils[_0xc9d3('0x14')](util['format'](_0xc9d3('0x2a'),_0x5031f6[_0xc9d3('0x1e')]),_0x34d7b1);}});ami['on']('musiconholdstart',function(_0x20d166){try{utils[_0xc9d3('0x18')](util['format'](_0xc9d3('0x2b'),_0x20d166[_0xc9d3('0x1e')]),_0x20d166);queues[_0xc9d3('0x2c')](_0x20d166);calls[_0xc9d3('0x2c')](_0x20d166);}catch(_0x257b9e){utils[_0xc9d3('0x14')](util[_0xc9d3('0x19')](_0xc9d3('0x2b'),_0x20d166['uniqueid']),_0x257b9e);}});ami['on'](_0xc9d3('0x2d'),function(_0x44715c){try{utils['debug'](util[_0xc9d3('0x19')](_0xc9d3('0x2e'),_0x44715c[_0xc9d3('0x1e')]),_0x44715c);queues[_0xc9d3('0x2d')](_0x44715c);calls[_0xc9d3('0x2d')](_0x44715c);}catch(_0x116fb0){utils[_0xc9d3('0x14')](util[_0xc9d3('0x19')]('[%s][index][musiconholdstop]',_0x44715c[_0xc9d3('0x1e')]),_0x116fb0);}});ami['on'](_0xc9d3('0x2f'),function(_0x436e69){try{utils[_0xc9d3('0x18')](util[_0xc9d3('0x19')]('[%s][index][newstate]',_0x436e69[_0xc9d3('0x1e')]),_0x436e69);calls[_0xc9d3('0x2f')](_0x436e69);recordings[_0xc9d3('0x2f')](_0x436e69);}catch(_0xcd9c25){utils[_0xc9d3('0x14')](util['format'](_0xc9d3('0x30'),_0x436e69[_0xc9d3('0x1e')]),_0xcd9c25);}});ami['on'](_0xc9d3('0x31'),function(_0x47d2e1){try{utils[_0xc9d3('0x18')](util[_0xc9d3('0x19')](_0xc9d3('0x32'),_0x47d2e1[_0xc9d3('0x1e')]),_0x47d2e1);calls['hangup'](_0x47d2e1);recordings['hangup'](_0x47d2e1);dials[_0xc9d3('0x31')](_0x47d2e1);agents['hangup'](_0x47d2e1);queues['hangup'](_0x47d2e1);}catch(_0x182dc5){utils[_0xc9d3('0x14')](util[_0xc9d3('0x19')]('[%s][index][hangup]',_0x47d2e1['uniqueid']),_0x182dc5);}});ami['on'](_0xc9d3('0x33'),function(_0x584f87){try{utils['debug'](util[_0xc9d3('0x19')](_0xc9d3('0x34'),_0x584f87['uniqueid']),_0x584f87);members[_0xc9d3('0x33')](_0x584f87);}catch(_0x31a096){utils[_0xc9d3('0x14')](util[_0xc9d3('0x19')](_0xc9d3('0x34'),_0x584f87[_0xc9d3('0x1e')]),_0x31a096);}});ami['on'](_0xc9d3('0x35'),function(_0x37734f){try{utils[_0xc9d3('0x18')](util['format'](_0xc9d3('0x36'),_0x37734f[_0xc9d3('0x1e')]),_0x37734f);queues[_0xc9d3('0x35')](_0x37734f);agents[_0xc9d3('0x35')](_0x37734f);transfers[_0xc9d3('0x35')](_0x37734f);}catch(_0x1a2941){utils['error'](util[_0xc9d3('0x19')](_0xc9d3('0x36'),_0x37734f['uniqueid']),_0x1a2941);}});ami['on']('attendedtransfer',function(_0x100dcd){try{utils['debug'](util[_0xc9d3('0x19')](_0xc9d3('0x37'),_0x100dcd[_0xc9d3('0x38')]),_0x100dcd);queues[_0xc9d3('0x39')](_0x100dcd);transfers['attendedtransfer'](_0x100dcd);agents[_0xc9d3('0x39')](_0x100dcd);calls[_0xc9d3('0x39')](_0x100dcd);}catch(_0x184b3d){utils[_0xc9d3('0x14')](util[_0xc9d3('0x19')](_0xc9d3('0x37'),_0x100dcd[_0xc9d3('0x38')]),_0x184b3d);}});ami['on'](_0xc9d3('0x3a'),function(_0x4f735e){try{utils['debug'](util[_0xc9d3('0x19')]('[%s][index][varset]',_0x4f735e[_0xc9d3('0x1e')]),_0x4f735e);queues[_0xc9d3('0x3a')](_0x4f735e);recordings[_0xc9d3('0x3a')](_0x4f735e);calls['varset'](_0x4f735e);dials[_0xc9d3('0x3a')](_0x4f735e);}catch(_0x3064eb){utils[_0xc9d3('0x14')](util[_0xc9d3('0x19')](_0xc9d3('0x3b'),_0x4f735e[_0xc9d3('0x1e')]),_0x3064eb);}});ami['on'](_0xc9d3('0x3c'),function(_0x49421b){try{utils['debug'](util[_0xc9d3('0x19')](_0xc9d3('0x3d'),_0x49421b[_0xc9d3('0x1e')]),_0x49421b);calls[_0xc9d3('0x3c')](_0x49421b);recordings[_0xc9d3('0x3c')](_0x49421b);dials['newexten'](_0x49421b);}catch(_0x2148c5){utils['error'](util['format'](_0xc9d3('0x3d'),_0x49421b[_0xc9d3('0x1e')]),_0x2148c5);}});ami['on']('newchannel',function(_0x399ab4){try{utils['debug'](util['format'](_0xc9d3('0x3e'),_0x399ab4['uniqueid']),_0x399ab4);calls[_0xc9d3('0x3f')](_0x399ab4);recordings['newchannel'](_0x399ab4);}catch(_0x137fb2){utils['error'](util[_0xc9d3('0x19')](_0xc9d3('0x3e'),_0x399ab4[_0xc9d3('0x1e')]),_0x137fb2);}});ami['on'](_0xc9d3('0x40'),function(_0x2feef1){try{utils[_0xc9d3('0x18')](util[_0xc9d3('0x19')](_0xc9d3('0x41'),_0x2feef1[_0xc9d3('0x1e')]),_0x2feef1);dials[_0xc9d3('0x40')](_0x2feef1);}catch(_0x42af25){utils[_0xc9d3('0x14')](util['format'](_0xc9d3('0x42'),_0x2feef1[_0xc9d3('0x1e')]),_0x42af25);}});ami['on'](_0xc9d3('0x43'),function(_0x4cae37){try{utils[_0xc9d3('0x18')](util[_0xc9d3('0x19')](_0xc9d3('0x44'),_0x4cae37[_0xc9d3('0x1e')]),_0x4cae37);dials[_0xc9d3('0x43')](_0x4cae37);}catch(_0x56d555){utils[_0xc9d3('0x14')](util[_0xc9d3('0x19')](_0xc9d3('0x44'),_0x4cae37[_0xc9d3('0x1e')]),_0x56d555);}});} \ No newline at end of file +var _0xc32b=['./calls.controller','./queues.controller','./recordings.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','format','[%s][index][devicestatechange]','devicestatechange','agentcalled','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','uniqueid','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][dialbegin]','dialbegin','dialend','[%s][index][dialend]','../../config/environment','./utils','util','asterisk','username','password','xdr','info','XDR\x20DISABLED'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xc32b,0x1b0));var _0xbc32=function(_0xa3fe2c,_0x5bb210){_0xa3fe2c=_0xa3fe2c-0x0;var _0x126aba=_0xc32b[_0xa3fe2c];return _0x126aba;};var AsteriskManager=require('asterisk-manager');var config=require(_0xbc32('0x0'));var utils=require(_0xbc32('0x1'));var util=require(_0xbc32('0x2'));var ami=new AsteriskManager(config[_0xbc32('0x3')]['port'],config[_0xbc32('0x3')]['ip'],config[_0xbc32('0x3')][_0xbc32('0x4')],config[_0xbc32('0x3')][_0xbc32('0x5')],!![]);ami['keepConnected']();if(config[_0xbc32('0x6')]&&config[_0xbc32('0x6')]['disabled']){utils[_0xbc32('0x7')](_0xbc32('0x8'));}else{var agents=require('./agents.controller');var calls=require(_0xbc32('0x9'));var queues=require(_0xbc32('0xa'));var recordings=require(_0xbc32('0xb'));var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require(_0xbc32('0xc'));var core=require(_0xbc32('0xd'));ami['on']('connect',core[_0xbc32('0xe')]);ami['on'](_0xbc32('0xf'),core[_0xbc32('0xf')]);ami['on']('fullybooted',core[_0xbc32('0x10')]);ami['on'](_0xbc32('0x11'),core[_0xbc32('0x11')]);ami['on'](_0xbc32('0x12'),core[_0xbc32('0x12')]);ami['on'](_0xbc32('0x13'),core[_0xbc32('0x13')]);ami['on']('devicestatechange',function(_0x3e19a2){try{utils[_0xbc32('0x14')](util[_0xbc32('0x15')](_0xbc32('0x16'),_0x3e19a2['device']),_0x3e19a2);members[_0xbc32('0x17')](_0x3e19a2);}catch(_0x9a2ef7){utils[_0xbc32('0x11')](util['format'](_0xbc32('0x16'),_0x3e19a2['device']),_0x9a2ef7);}});ami['on'](_0xbc32('0x18'),function(_0x4271d0){try{utils[_0xbc32('0x14')](util['format'](_0xbc32('0x19'),_0x4271d0['uniqueid']),_0x4271d0);agents[_0xbc32('0x18')](_0x4271d0);}catch(_0x728a75){utils[_0xbc32('0x11')](util[_0xbc32('0x15')](_0xbc32('0x19'),_0x4271d0['uniqueid']),_0x728a75);}});ami['on'](_0xbc32('0x1a'),function(_0x49eaf2){try{utils[_0xbc32('0x14')](util[_0xbc32('0x15')](_0xbc32('0x1b'),_0x49eaf2[_0xbc32('0x1c')]),_0x49eaf2);agents['agentringnoanswer'](_0x49eaf2);}catch(_0x2540d5){utils[_0xbc32('0x11')](util[_0xbc32('0x15')]('[%s][index][agentringnoanswer]',_0x49eaf2['uniqueid']),_0x2540d5);}});ami['on']('agentconnect',function(_0x4fd970){try{utils[_0xbc32('0x14')](util[_0xbc32('0x15')]('[%s][index][agentconnect]',_0x4fd970[_0xbc32('0x1c')]),_0x4fd970);agents['agentconnect'](_0x4fd970);queues[_0xbc32('0x1d')](_0x4fd970);}catch(_0x379782){utils[_0xbc32('0x11')](util[_0xbc32('0x15')](_0xbc32('0x1e'),_0x4fd970[_0xbc32('0x1c')]),_0x379782);}});ami['on'](_0xbc32('0x1f'),function(_0x58e5d1){try{utils['debug'](util[_0xbc32('0x15')]('[%s][index][agentcomplete]',_0x58e5d1[_0xbc32('0x1c')]),_0x58e5d1);agents[_0xbc32('0x1f')](_0x58e5d1);queues[_0xbc32('0x1f')](_0x58e5d1);members['agentcomplete'](_0x58e5d1);}catch(_0x134ed2){utils[_0xbc32('0x11')](util[_0xbc32('0x15')](_0xbc32('0x20'),_0x58e5d1[_0xbc32('0x1c')]),_0x134ed2);}});ami['on']('queuecallerabandon',function(_0xe9f320){try{utils[_0xbc32('0x14')](util[_0xbc32('0x15')](_0xbc32('0x21'),_0xe9f320[_0xbc32('0x1c')]),_0xe9f320);agents[_0xbc32('0x22')](_0xe9f320);queues[_0xbc32('0x22')](_0xe9f320);}catch(_0x49eafa){utils[_0xbc32('0x11')](util['format']('[%s][index][queuecallerabandon]',_0xe9f320[_0xbc32('0x1c')]),_0x49eafa);}});ami['on'](_0xbc32('0x23'),function(_0x157812){try{utils[_0xbc32('0x14')](util[_0xbc32('0x15')](_0xbc32('0x24'),_0x157812['uniqueid']),_0x157812);queues[_0xbc32('0x23')](_0x157812);recordings[_0xbc32('0x23')](_0x157812);}catch(_0x4230b0){utils[_0xbc32('0x11')](util[_0xbc32('0x15')]('[%s][index][queuecallerjoin]',_0x157812[_0xbc32('0x1c')]),_0x4230b0);}});ami['on'](_0xbc32('0x25'),function(_0x5c5028){try{utils[_0xbc32('0x14')](util[_0xbc32('0x15')](_0xbc32('0x26'),_0x5c5028['uniqueid']),_0x5c5028);queues['queuecallerleave'](_0x5c5028);}catch(_0x124937){utils[_0xbc32('0x11')](util[_0xbc32('0x15')](_0xbc32('0x26'),_0x5c5028[_0xbc32('0x1c')]),_0x124937);}});ami['on']('musiconholdstart',function(_0x2028af){try{utils['debug'](util[_0xbc32('0x15')]('[%s][index][musiconholdstart]',_0x2028af[_0xbc32('0x1c')]),_0x2028af);queues[_0xbc32('0x27')](_0x2028af);calls['musiconholdstart'](_0x2028af);}catch(_0xccb549){utils['error'](util[_0xbc32('0x15')](_0xbc32('0x28'),_0x2028af['uniqueid']),_0xccb549);}});ami['on']('musiconholdstop',function(_0x3ec922){try{utils[_0xbc32('0x14')](util[_0xbc32('0x15')](_0xbc32('0x29'),_0x3ec922[_0xbc32('0x1c')]),_0x3ec922);queues[_0xbc32('0x2a')](_0x3ec922);calls[_0xbc32('0x2a')](_0x3ec922);}catch(_0x4b1741){utils['error'](util['format']('[%s][index][musiconholdstop]',_0x3ec922['uniqueid']),_0x4b1741);}});ami['on'](_0xbc32('0x2b'),function(_0x5682c7){try{utils['debug'](util[_0xbc32('0x15')](_0xbc32('0x2c'),_0x5682c7[_0xbc32('0x1c')]),_0x5682c7);calls[_0xbc32('0x2b')](_0x5682c7);recordings[_0xbc32('0x2b')](_0x5682c7);}catch(_0x4e99b1){utils[_0xbc32('0x11')](util['format'](_0xbc32('0x2c'),_0x5682c7['uniqueid']),_0x4e99b1);}});ami['on'](_0xbc32('0x2d'),function(_0x250e38){try{utils['debug'](util['format'](_0xbc32('0x2e'),_0x250e38[_0xbc32('0x1c')]),_0x250e38);calls[_0xbc32('0x2d')](_0x250e38);recordings['hangup'](_0x250e38);dials[_0xbc32('0x2d')](_0x250e38);agents['hangup'](_0x250e38);queues['hangup'](_0x250e38);}catch(_0x323f95){utils[_0xbc32('0x11')](util[_0xbc32('0x15')](_0xbc32('0x2e'),_0x250e38[_0xbc32('0x1c')]),_0x323f95);}});ami['on']('cdr',function(_0x37b260){try{utils[_0xbc32('0x14')](util[_0xbc32('0x15')](_0xbc32('0x2f'),_0x37b260[_0xbc32('0x1c')]),_0x37b260);members[_0xbc32('0x30')](_0x37b260);}catch(_0x327331){utils[_0xbc32('0x11')](util[_0xbc32('0x15')]('[%s][index][cdr]',_0x37b260[_0xbc32('0x1c')]),_0x327331);}});ami['on'](_0xbc32('0x31'),function(_0x9d19a3){try{utils[_0xbc32('0x14')](util[_0xbc32('0x15')](_0xbc32('0x32'),_0x9d19a3[_0xbc32('0x1c')]),_0x9d19a3);queues[_0xbc32('0x31')](_0x9d19a3);agents[_0xbc32('0x31')](_0x9d19a3);transfers[_0xbc32('0x31')](_0x9d19a3);}catch(_0x490f74){utils[_0xbc32('0x11')](util['format'](_0xbc32('0x32'),_0x9d19a3['uniqueid']),_0x490f74);}});ami['on'](_0xbc32('0x33'),function(_0x4593a7){try{utils[_0xbc32('0x14')](util[_0xbc32('0x15')](_0xbc32('0x34'),_0x4593a7[_0xbc32('0x35')]),_0x4593a7);queues[_0xbc32('0x33')](_0x4593a7);transfers[_0xbc32('0x33')](_0x4593a7);agents['attendedtransfer'](_0x4593a7);calls[_0xbc32('0x33')](_0x4593a7);}catch(_0x1e0d68){utils[_0xbc32('0x11')](util['format'](_0xbc32('0x34'),_0x4593a7[_0xbc32('0x35')]),_0x1e0d68);}});ami['on'](_0xbc32('0x36'),function(_0x3f1ba9){try{utils['debug'](util[_0xbc32('0x15')](_0xbc32('0x37'),_0x3f1ba9['uniqueid']),_0x3f1ba9);queues['varset'](_0x3f1ba9);recordings[_0xbc32('0x36')](_0x3f1ba9);calls['varset'](_0x3f1ba9);dials[_0xbc32('0x36')](_0x3f1ba9);}catch(_0x3f962f){utils['error'](util['format'](_0xbc32('0x37'),_0x3f1ba9[_0xbc32('0x1c')]),_0x3f962f);}});ami['on'](_0xbc32('0x38'),function(_0x117706){try{utils['debug'](util['format'](_0xbc32('0x39'),_0x117706[_0xbc32('0x1c')]),_0x117706);calls['newexten'](_0x117706);recordings[_0xbc32('0x38')](_0x117706);dials[_0xbc32('0x38')](_0x117706);}catch(_0x2a8244){utils[_0xbc32('0x11')](util[_0xbc32('0x15')](_0xbc32('0x39'),_0x117706[_0xbc32('0x1c')]),_0x2a8244);}});ami['on'](_0xbc32('0x3a'),function(_0x39a937){try{utils[_0xbc32('0x14')](util[_0xbc32('0x15')]('[%s][index][newchannel]',_0x39a937['uniqueid']),_0x39a937);calls[_0xbc32('0x3a')](_0x39a937);recordings[_0xbc32('0x3a')](_0x39a937);}catch(_0xe92b4f){utils[_0xbc32('0x11')](util[_0xbc32('0x15')]('[%s][index][newchannel]',_0x39a937[_0xbc32('0x1c')]),_0xe92b4f);}});ami['on']('dialbegin',function(_0x581a8f){try{utils[_0xbc32('0x14')](util[_0xbc32('0x15')](_0xbc32('0x3b'),_0x581a8f['uniqueid']),_0x581a8f);dials[_0xbc32('0x3c')](_0x581a8f);}catch(_0x49e6b9){utils[_0xbc32('0x11')](util[_0xbc32('0x15')]('[%s]dialbegin',_0x581a8f['uniqueid']),_0x49e6b9);}});ami['on'](_0xbc32('0x3d'),function(_0x38a830){try{utils[_0xbc32('0x14')](util[_0xbc32('0x15')](_0xbc32('0x3e'),_0x38a830[_0xbc32('0x1c')]),_0x38a830);dials[_0xbc32('0x3d')](_0x38a830);}catch(_0x1fd4ed){utils[_0xbc32('0x11')](util[_0xbc32('0x15')](_0xbc32('0x3e'),_0x38a830[_0xbc32('0x1c')]),_0x1fd4ed);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 623f40c..3bb696f 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 _0x62e9=['lodash','util','./utils','Local/_attended@transfer','Queue:','info','uniqueid','interface','channel','data2','membername','type','getUserByInterface','then','name','internal','request','getUserByName','split','CreateMemberReport','catch','error','format','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','exitAt','duration','diffTime','enterAt','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','isNil','data1','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','source'];(function(_0x1a862b,_0x41c918){var _0xeef1c2=function(_0x48c2da){while(--_0x48c2da){_0x1a862b['push'](_0x1a862b['shift']());}};_0xeef1c2(++_0x41c918);}(_0x62e9,0x1e6));var _0x962e=function(_0x559ba7,_0x42c623){_0x559ba7=_0x559ba7-0x0;var _0x1497ea=_0x62e9[_0x559ba7];return _0x1497ea;};'use strict';var _=require(_0x962e('0x0'));var util=require(_0x962e('0x1'));var utils=require(_0x962e('0x2'));var members={};var exclude=[_0x962e('0x3'),_0x962e('0x4')];function writeDB(_0x5126bc){utils[_0x962e('0x5')](util['format']('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x5126bc[_0x962e('0x6')],_0x5126bc[_0x962e('0x7')],_0x5126bc[_0x962e('0x8')],_0x5126bc[_0x962e('0x9')],_0x5126bc[_0x962e('0xa')],_0x5126bc[_0x962e('0xb')]));if(_0x5126bc[_0x962e('0x7')]){utils[_0x962e('0xc')](_0x5126bc[_0x962e('0x7')])[_0x962e('0xd')](function(_0x54180d){if(_0x54180d){_0x5126bc['membername']=_0x54180d[_0x962e('0xe')];_0x5126bc[_0x962e('0xf')]=_0x54180d[_0x962e('0xf')];utils[_0x962e('0x10')]('CreateMemberReport',_0x5126bc);}else{utils[_0x962e('0x11')](_0x5126bc[_0x962e('0x7')][_0x962e('0x12')]('/')[0x1])[_0x962e('0xd')](function(_0x1c06ad){if(_0x1c06ad){_0x5126bc[_0x962e('0xa')]=_0x1c06ad[_0x962e('0xe')];_0x5126bc[_0x962e('0xf')]=_0x1c06ad['internal'];utils[_0x962e('0x10')](_0x962e('0x13'),_0x5126bc);}});}})[_0x962e('0x14')](function(_0x1b29cd){utils[_0x962e('0x15')](util[_0x962e('0x16')](_0x962e('0x17'),_0x5126bc[_0x962e('0x6')]),_0x1b29cd);});}delete members[_0x5126bc[_0x962e('0x7')]];}function startsWith(_0x3549ca,_0x3aa693){return _[_0x962e('0x18')](_0x3549ca,function(_0x5cc51b){return _[_0x962e('0x19')](_0x3aa693,_0x5cc51b);});}exports[_0x962e('0x1a')]=function(_0xd12148){try{utils[_0x962e('0x1b')](util['format'](_0x962e('0x1c'),members[_0xd12148[_0x962e('0x1d')]]?members[_0xd12148[_0x962e('0x1d')]][_0x962e('0x6')]:_0xd12148[_0x962e('0x1d')]),_0xd12148);utils['info'](util[_0x962e('0x16')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0xd12148[_0x962e('0x1d')]]?members[_0xd12148[_0x962e('0x1d')]][_0x962e('0x6')]:_0xd12148['device'],_0xd12148[_0x962e('0x1e')],_0xd12148[_0x962e('0x1d')]));switch(_0xd12148[_0x962e('0x1e')]){case _0x962e('0x1f'):case _0x962e('0x20'):if(!startsWith(exclude,_0xd12148[_0x962e('0x1d')])){members[_0xd12148[_0x962e('0x1d')]]={'channel':_0x962e('0x21'),'interface':_0xd12148[_0x962e('0x1d')],'type':_0x962e('0x22'),'enterAt':utils[_0x962e('0x23')](),'role':_0x962e('0x24')};}break;case _0x962e('0x25'):if(!_['isNil'](members[_0xd12148[_0x962e('0x1d')]])){members[_0xd12148[_0x962e('0x1d')]][_0x962e('0x26')]=utils[_0x962e('0x23')]();members[_0xd12148[_0x962e('0x1d')]][_0x962e('0x27')]=utils[_0x962e('0x28')](members[_0xd12148[_0x962e('0x1d')]][_0x962e('0x26')],members[_0xd12148['device']][_0x962e('0x29')]);if(members[_0xd12148[_0x962e('0x1d')]]['uniqueid']){writeDB(members[_0xd12148[_0x962e('0x1d')]]);}}break;default:break;}}catch(_0x5047f){utils['error'](util[_0x962e('0x16')](_0x962e('0x1c'),members[_0xd12148[_0x962e('0x1d')]]?members[_0xd12148[_0x962e('0x1d')]]['uniqueid']:_0xd12148[_0x962e('0x1d')]),_0x5047f);}};exports['agentcomplete']=function(_0x67c136){try{if(!_['isNil'](members[_0x67c136['interface']])){utils['debug'](util[_0x962e('0x16')](_0x962e('0x2a'),_0x67c136['uniqueid']),_0x67c136);utils[_0x962e('0x5')](util[_0x962e('0x16')](_0x962e('0x2b'),_0x67c136[_0x962e('0x6')],_0x67c136[_0x962e('0x7')],_0x67c136[_0x962e('0x2c')]));members[_0x67c136['interface']]=_[_0x962e('0x2d')](members[_0x67c136[_0x962e('0x7')]],{'data4':_0x67c136[_0x962e('0x2c')],'uniqueid':_0x67c136[_0x962e('0x6')]});}}catch(_0x2905fd){utils['error'](util[_0x962e('0x16')](_0x962e('0x2a'),_0x67c136[_0x962e('0x6')]),_0x2905fd);}};exports[_0x962e('0x2e')]=function(_0x34952f){try{utils[_0x962e('0x1b')](util[_0x962e('0x16')](_0x962e('0x2f'),_0x34952f[_0x962e('0x6')]),_0x34952f);if(_0x34952f[_0x962e('0x8')]){var _0x5d2bd2=_0x34952f[_0x962e('0x8')][_0x962e('0x12')]('-')[0x0];if(!_[_0x962e('0x30')](members[_0x5d2bd2])){members[_0x5d2bd2]=_['assign'](members[_0x5d2bd2],{'data1':members[_0x5d2bd2][_0x962e('0x31')]||_0x34952f['type'],'data2':members[_0x5d2bd2][_0x962e('0x9')]||_0x34952f['source'],'data3':members[_0x5d2bd2][_0x962e('0x32')]||_0x34952f[_0x962e('0x33')],'uniqueid':members[_0x5d2bd2]['uniqueid']||_0x34952f['uniqueid']});utils['info'](util[_0x962e('0x16')](_0x962e('0x34'),_0x34952f['uniqueid'],members[_0x5d2bd2]['data1'],members[_0x5d2bd2][_0x962e('0x9')],members[_0x5d2bd2][_0x962e('0x32')]));if(members[_0x5d2bd2][_0x962e('0x26')]){writeDB(members[_0x5d2bd2]);}}}if(_0x34952f['destinationchannel']){var _0xf1f849=_0x34952f['destinationchannel'][_0x962e('0x12')]('-')[0x0];if(!_[_0x962e('0x30')](members[_0xf1f849])){members[_0xf1f849]=_['assign'](members[_0xf1f849],{'data1':members[_0xf1f849][_0x962e('0x31')]||_0x34952f[_0x962e('0xb')],'data2':members[_0xf1f849][_0x962e('0x9')]||_0x34952f[_0x962e('0x35')],'data3':members[_0xf1f849][_0x962e('0x32')]||_0x34952f[_0x962e('0x33')],'uniqueid':members[_0xf1f849][_0x962e('0x6')]||_0x34952f[_0x962e('0x6')]});utils[_0x962e('0x5')](util['format'](_0x962e('0x34'),_0x34952f['uniqueid'],members[_0xf1f849]['data1'],members[_0xf1f849][_0x962e('0x9')],members[_0xf1f849][_0x962e('0x32')]));if(members[_0xf1f849][_0x962e('0x26')]){writeDB(members[_0xf1f849]);}}}}catch(_0x1e0cdf){utils[_0x962e('0x15')](util[_0x962e('0x16')]('[%s][members][cdr]',_0x34952f[_0x962e('0x6')]),_0x1e0cdf);}}; \ No newline at end of file +var _0x0dba=['[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','exitAt','duration','diffTime','agentcomplete','isNil','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','[%s][members][agentcomplete]','cdr','assign','data1','type','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data2','data3','destinationchannel','source','destination','[%s][members][cdr]','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','getUserByInterface','membername','name','internal','request','CreateMemberReport','split','then','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0dba,0x136));var _0xa0db=function(_0x1d6625,_0x459e74){_0x1d6625=_0x1d6625-0x0;var _0x12a432=_0x0dba[_0x1d6625];return _0x12a432;};'use strict';var _=require(_0xa0db('0x0'));var util=require(_0xa0db('0x1'));var utils=require(_0xa0db('0x2'));var members={};var exclude=[_0xa0db('0x3'),_0xa0db('0x4')];function writeDB(_0x3bc287){utils[_0xa0db('0x5')](util[_0xa0db('0x6')](_0xa0db('0x7'),_0x3bc287[_0xa0db('0x8')],_0x3bc287[_0xa0db('0x9')],_0x3bc287[_0xa0db('0xa')],_0x3bc287['data2'],_0x3bc287['membername'],_0x3bc287['type']));if(_0x3bc287[_0xa0db('0x9')]){utils[_0xa0db('0xb')](_0x3bc287[_0xa0db('0x9')])['then'](function(_0x884ee4){if(_0x884ee4){_0x3bc287[_0xa0db('0xc')]=_0x884ee4[_0xa0db('0xd')];_0x3bc287[_0xa0db('0xe')]=_0x884ee4['internal'];utils[_0xa0db('0xf')](_0xa0db('0x10'),_0x3bc287);}else{utils['getUserByName'](_0x3bc287['interface'][_0xa0db('0x11')]('/')[0x1])[_0xa0db('0x12')](function(_0x21cd8b){if(_0x21cd8b){_0x3bc287[_0xa0db('0xc')]=_0x21cd8b['name'];_0x3bc287[_0xa0db('0xe')]=_0x21cd8b[_0xa0db('0xe')];utils[_0xa0db('0xf')](_0xa0db('0x10'),_0x3bc287);}});}})[_0xa0db('0x13')](function(_0x27fb00){utils[_0xa0db('0x14')](util[_0xa0db('0x6')](_0xa0db('0x15'),_0x3bc287['uniqueid']),_0x27fb00);});}delete members[_0x3bc287[_0xa0db('0x9')]];}function startsWith(_0x1048bf,_0x24efb1){return _[_0xa0db('0x16')](_0x1048bf,function(_0x2d8396){return _[_0xa0db('0x17')](_0x24efb1,_0x2d8396);});}exports[_0xa0db('0x18')]=function(_0x12a3e8){try{utils[_0xa0db('0x19')](util['format'](_0xa0db('0x1a'),members[_0x12a3e8[_0xa0db('0x1b')]]?members[_0x12a3e8['device']][_0xa0db('0x8')]:_0x12a3e8[_0xa0db('0x1b')]),_0x12a3e8);utils[_0xa0db('0x5')](util[_0xa0db('0x6')](_0xa0db('0x1c'),members[_0x12a3e8[_0xa0db('0x1b')]]?members[_0x12a3e8[_0xa0db('0x1b')]]['uniqueid']:_0x12a3e8['device'],_0x12a3e8['state'],_0x12a3e8['device']));switch(_0x12a3e8[_0xa0db('0x1d')]){case _0xa0db('0x1e'):case _0xa0db('0x1f'):if(!startsWith(exclude,_0x12a3e8['device'])){members[_0x12a3e8['device']]={'channel':_0xa0db('0x20'),'interface':_0x12a3e8['device'],'type':_0xa0db('0x21'),'enterAt':utils[_0xa0db('0x22')](),'role':_0xa0db('0x23')};}break;case _0xa0db('0x24'):if(!_['isNil'](members[_0x12a3e8[_0xa0db('0x1b')]])){members[_0x12a3e8[_0xa0db('0x1b')]][_0xa0db('0x25')]=utils[_0xa0db('0x22')]();members[_0x12a3e8[_0xa0db('0x1b')]][_0xa0db('0x26')]=utils[_0xa0db('0x27')](members[_0x12a3e8[_0xa0db('0x1b')]][_0xa0db('0x25')],members[_0x12a3e8[_0xa0db('0x1b')]]['enterAt']);if(members[_0x12a3e8[_0xa0db('0x1b')]][_0xa0db('0x8')]){writeDB(members[_0x12a3e8[_0xa0db('0x1b')]]);}}break;default:break;}}catch(_0x3d5c83){utils[_0xa0db('0x14')](util[_0xa0db('0x6')](_0xa0db('0x1a'),members[_0x12a3e8[_0xa0db('0x1b')]]?members[_0x12a3e8[_0xa0db('0x1b')]][_0xa0db('0x8')]:_0x12a3e8[_0xa0db('0x1b')]),_0x3d5c83);}};exports[_0xa0db('0x28')]=function(_0x6b6ab5){try{if(!_[_0xa0db('0x29')](members[_0x6b6ab5[_0xa0db('0x9')]])){utils[_0xa0db('0x19')](util[_0xa0db('0x6')]('[%s][members][agentcomplete]',_0x6b6ab5['uniqueid']),_0x6b6ab5);utils[_0xa0db('0x5')](util[_0xa0db('0x6')](_0xa0db('0x2a'),_0x6b6ab5[_0xa0db('0x8')],_0x6b6ab5[_0xa0db('0x9')],_0x6b6ab5[_0xa0db('0x2b')]));members[_0x6b6ab5[_0xa0db('0x9')]]=_['assign'](members[_0x6b6ab5[_0xa0db('0x9')]],{'data4':_0x6b6ab5[_0xa0db('0x2b')],'uniqueid':_0x6b6ab5['uniqueid']});}}catch(_0x5263fa){utils['error'](util[_0xa0db('0x6')](_0xa0db('0x2c'),_0x6b6ab5['uniqueid']),_0x5263fa);}};exports[_0xa0db('0x2d')]=function(_0x37a36f){try{utils['debug'](util[_0xa0db('0x6')]('[%s][members][cdr]',_0x37a36f['uniqueid']),_0x37a36f);if(_0x37a36f[_0xa0db('0xa')]){var _0x2aadbf=_0x37a36f[_0xa0db('0xa')][_0xa0db('0x11')]('-')[0x0];if(!_[_0xa0db('0x29')](members[_0x2aadbf])){members[_0x2aadbf]=_[_0xa0db('0x2e')](members[_0x2aadbf],{'data1':members[_0x2aadbf][_0xa0db('0x2f')]||_0x37a36f[_0xa0db('0x30')],'data2':members[_0x2aadbf]['data2']||_0x37a36f['source'],'data3':members[_0x2aadbf]['data3']||_0x37a36f['destination'],'uniqueid':members[_0x2aadbf]['uniqueid']||_0x37a36f['uniqueid']});utils[_0xa0db('0x5')](util[_0xa0db('0x6')](_0xa0db('0x31'),_0x37a36f[_0xa0db('0x8')],members[_0x2aadbf][_0xa0db('0x2f')],members[_0x2aadbf][_0xa0db('0x32')],members[_0x2aadbf][_0xa0db('0x33')]));if(members[_0x2aadbf][_0xa0db('0x25')]){writeDB(members[_0x2aadbf]);}}}if(_0x37a36f[_0xa0db('0x34')]){var _0x2833d3=_0x37a36f[_0xa0db('0x34')][_0xa0db('0x11')]('-')[0x0];if(!_[_0xa0db('0x29')](members[_0x2833d3])){members[_0x2833d3]=_[_0xa0db('0x2e')](members[_0x2833d3],{'data1':members[_0x2833d3][_0xa0db('0x2f')]||_0x37a36f[_0xa0db('0x30')],'data2':members[_0x2833d3][_0xa0db('0x32')]||_0x37a36f[_0xa0db('0x35')],'data3':members[_0x2833d3][_0xa0db('0x33')]||_0x37a36f[_0xa0db('0x36')],'uniqueid':members[_0x2833d3][_0xa0db('0x8')]||_0x37a36f['uniqueid']});utils[_0xa0db('0x5')](util[_0xa0db('0x6')](_0xa0db('0x31'),_0x37a36f[_0xa0db('0x8')],members[_0x2833d3][_0xa0db('0x2f')],members[_0x2833d3][_0xa0db('0x32')],members[_0x2833d3]['data3']));if(members[_0x2833d3][_0xa0db('0x25')]){writeDB(members[_0x2833d3]);}}}}catch(_0x5e135d){utils['error'](util[_0xa0db('0x6')](_0xa0db('0x37'),_0x37a36f[_0xa0db('0x8')]),_0x5e135d);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index d730ea3..b759a3f 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 _0x4f1e=['format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','varset','[%s][queues][varset]','isNil','variable','queuestatus','value','CONTINUE','queuecallerabandon','queuecallerexit','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandonAt','queuecallerexitAt','EXITWITHKEY','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','lastAssignedTo','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','ATTENDED','transferexten','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%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]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils'];(function(_0x380a3f,_0x202483){var _0x2b4eca=function(_0x1e99b2){while(--_0x1e99b2){_0x380a3f['push'](_0x380a3f['shift']());}};_0x2b4eca(++_0x202483);}(_0x4f1e,0x6c));var _0xe4f1=function(_0x24271a,_0x397670){_0x24271a=_0x24271a-0x0;var _0x4a5ffb=_0x4f1e[_0x24271a];return _0x4a5ffb;};'use strict';var _=require(_0xe4f1('0x0'));var util=require('util');var utils=require(_0xe4f1('0x1'));var queues={};function writeDB(_0x4d3222){utils['info'](util[_0xe4f1('0x2')](_0xe4f1('0x3'),_0x4d3222[_0xe4f1('0x4')],_0x4d3222[_0xe4f1('0x5')],_0x4d3222[_0xe4f1('0x6')],_0x4d3222['lastAssignedTo'],_0x4d3222[_0xe4f1('0x7')],_0x4d3222[_0xe4f1('0x8')],_0x4d3222[_0xe4f1('0x9')]));if(_0x4d3222[_0xe4f1('0x6')]){utils[_0xe4f1('0xa')](_0x4d3222[_0xe4f1('0x6')])[_0xe4f1('0xb')](function(_0xfd39){if(_0xfd39){_0x4d3222[_0xe4f1('0xc')]=_0xfd39[_0xe4f1('0xc')];}utils[_0xe4f1('0xd')](_0xe4f1('0xe'),_0x4d3222);});}else{utils[_0xe4f1('0xd')]('CreateVoiceQueueReport',_0x4d3222);}if(_0x4d3222['transfereduniqueid']){delete queues[_0x4d3222[_0xe4f1('0xf')]];}else{delete queues[_0x4d3222[_0xe4f1('0x4')]];}}exports[_0xe4f1('0x10')]=function(_0x31c41a){try{utils[_0xe4f1('0x11')](util[_0xe4f1('0x2')](_0xe4f1('0x12'),_0x31c41a[_0xe4f1('0x4')]),_0x31c41a);utils[_0xe4f1('0x13')](util['format'](_0xe4f1('0x14'),_0x31c41a[_0xe4f1('0x4')],_0x31c41a[_0xe4f1('0x6')],_0x31c41a[_0xe4f1('0x15')]));queues[_0x31c41a[_0xe4f1('0x4')]]=_[_0xe4f1('0x16')](_0x31c41a,{'originalposition':_0x31c41a[_0xe4f1('0x15')],'queuecallerjoinAt':utils[_0xe4f1('0x17')](),'mohtime':0x0});}catch(_0x124ae4){utils[_0xe4f1('0x18')](util[_0xe4f1('0x2')](_0xe4f1('0x12'),_0x31c41a[_0xe4f1('0x4')]),_0x124ae4);}};exports[_0xe4f1('0x19')]=function(_0x32d165){try{if(!_['isNil'](queues[_0x32d165['uniqueid']])){utils[_0xe4f1('0x11')](util[_0xe4f1('0x2')](_0xe4f1('0x1a'),_0x32d165['uniqueid']),_0x32d165);if(queues[_0x32d165['uniqueid']][_0xe4f1('0x1b')]){if(!queues[_0x32d165[_0xe4f1('0x4')]]['queuecallerabandon']&&!queues[_0x32d165['uniqueid']]['queuecallerexit']){queues[_0x32d165[_0xe4f1('0x4')]]['queuecallercomplete']=!![];queues[_0x32d165[_0xe4f1('0x4')]][_0xe4f1('0x1c')]=utils[_0xe4f1('0x17')]();queues[_0x32d165[_0xe4f1('0x4')]][_0xe4f1('0x9')]=_0xe4f1('0x1d');}utils['info'](util[_0xe4f1('0x2')](_0xe4f1('0x1e'),_0x32d165[_0xe4f1('0x4')],queues[_0x32d165[_0xe4f1('0x4')]][_0xe4f1('0x1f')],queues[_0x32d165[_0xe4f1('0x4')]][_0xe4f1('0x9')]));writeDB(queues[_0x32d165[_0xe4f1('0x4')]]);}else if(queues[_0x32d165[_0xe4f1('0x4')]][_0xe4f1('0xf')]){utils[_0xe4f1('0x13')](util['format'](_0xe4f1('0x20'),_0x32d165['uniqueid'],queues[_0x32d165['uniqueid']][_0xe4f1('0x1f')],queues[_0x32d165[_0xe4f1('0x4')]][_0xe4f1('0xf')]));queues[queues[_0x32d165[_0xe4f1('0x4')]][_0xe4f1('0xf')]]=queues[_0x32d165['uniqueid']];queues[queues[_0x32d165['uniqueid']][_0xe4f1('0xf')]]['queuecallerenterreason']=0x2;delete queues[_0x32d165[_0xe4f1('0x4')]];}}}catch(_0x464a4b){utils[_0xe4f1('0x18')](util['format'](_0xe4f1('0x1a'),_0x32d165['uniqueid']),_0x464a4b);}};exports[_0xe4f1('0x21')]=function(_0x46a83a){try{utils[_0xe4f1('0x11')](util[_0xe4f1('0x2')](_0xe4f1('0x22'),_0x46a83a[_0xe4f1('0x4')]),_0x46a83a);if(!_[_0xe4f1('0x23')](_0x46a83a[_0xe4f1('0x24')][_0xe4f1('0x25')])&&_0x46a83a[_0xe4f1('0x26')]['toUpperCase']()!==_0xe4f1('0x27')){if(!_['isNil'](queues[_0x46a83a[_0xe4f1('0x4')]])){queues[_0x46a83a[_0xe4f1('0x4')]][_0xe4f1('0x28')]=![];queues[_0x46a83a[_0xe4f1('0x4')]]['queuecallerabandonAt']=null;queues[_0x46a83a[_0xe4f1('0x4')]][_0xe4f1('0x29')]=!![];queues[_0x46a83a[_0xe4f1('0x4')]]['queuecallerexitAt']=utils[_0xe4f1('0x17')]();queues[_0x46a83a['uniqueid']][_0xe4f1('0x9')]=_0x46a83a['value'][_0xe4f1('0x2a')]();utils[_0xe4f1('0x13')](util[_0xe4f1('0x2')](_0xe4f1('0x2b'),_0x46a83a[_0xe4f1('0x4')],queues[_0x46a83a[_0xe4f1('0x4')]][_0xe4f1('0x1f')],_0x46a83a[_0xe4f1('0x26')],queues[_0x46a83a['uniqueid']][_0xe4f1('0x9')]));writeDB(queues[_0x46a83a[_0xe4f1('0x4')]]);}}else if(!_[_0xe4f1('0x23')](_0x46a83a[_0xe4f1('0x24')][_0xe4f1('0x2c')])){if(!_[_0xe4f1('0x23')](queues[_0x46a83a[_0xe4f1('0x4')]])&&!queues[_0x46a83a[_0xe4f1('0x4')]][_0xe4f1('0x28')]){queues[_0x46a83a[_0xe4f1('0x4')]][_0xe4f1('0x28')]=![];queues[_0x46a83a['uniqueid']][_0xe4f1('0x2d')]=null;queues[_0x46a83a['uniqueid']][_0xe4f1('0x29')]=!![];queues[_0x46a83a[_0xe4f1('0x4')]][_0xe4f1('0x2e')]=utils[_0xe4f1('0x17')]();queues[_0x46a83a['uniqueid']][_0xe4f1('0x9')]=_0xe4f1('0x2f');utils[_0xe4f1('0x13')](util[_0xe4f1('0x2')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x46a83a[_0xe4f1('0x4')],queues[_0x46a83a[_0xe4f1('0x4')]][_0xe4f1('0x1f')],_0x46a83a[_0xe4f1('0x26')],queues[_0x46a83a['uniqueid']][_0xe4f1('0x9')]));}}}catch(_0x1c0960){utils[_0xe4f1('0x18')](util[_0xe4f1('0x2')]('[%s][queues][varset]',_0x46a83a['uniqueid']),_0x1c0960);}};exports[_0xe4f1('0x28')]=function(_0x771bb8){try{if(!_['isNil'](queues[_0x771bb8['uniqueid']])){utils[_0xe4f1('0x11')](util[_0xe4f1('0x2')](_0xe4f1('0x30'),_0x771bb8[_0xe4f1('0x4')]),_0x771bb8);queues[_0x771bb8[_0xe4f1('0x4')]]['queuecallerexit']=![];queues[_0x771bb8[_0xe4f1('0x4')]][_0xe4f1('0x2e')]=null;queues[_0x771bb8['uniqueid']][_0xe4f1('0x28')]=!![];queues[_0x771bb8[_0xe4f1('0x4')]]['queuecallerabandonAt']=utils[_0xe4f1('0x17')]();queues[_0x771bb8[_0xe4f1('0x4')]]['queuecallerexitreason']=_0xe4f1('0x31');utils[_0xe4f1('0x13')](util[_0xe4f1('0x2')](_0xe4f1('0x32'),_0x771bb8[_0xe4f1('0x4')],queues[_0x771bb8[_0xe4f1('0x4')]][_0xe4f1('0x1f')],queues[_0x771bb8[_0xe4f1('0x4')]]['queuecallerexitreason']));}}catch(_0x1f7421){utils['error'](util[_0xe4f1('0x2')](_0xe4f1('0x30'),_0x771bb8[_0xe4f1('0x4')]),_0x1f7421);}};exports[_0xe4f1('0x33')]=function(_0x5e8dec){try{if(!_[_0xe4f1('0x23')](queues[_0x5e8dec[_0xe4f1('0x4')]])){utils[_0xe4f1('0x11')](util['format'](_0xe4f1('0x34'),_0x5e8dec['uniqueid']),_0x5e8dec);utils['info'](util[_0xe4f1('0x2')](_0xe4f1('0x35'),_0x5e8dec['uniqueid'],queues[_0x5e8dec[_0xe4f1('0x4')]][_0xe4f1('0x1f')],_0x5e8dec[_0xe4f1('0x36')],_0x5e8dec[_0xe4f1('0x37')]));queues[_0x5e8dec['uniqueid']][_0xe4f1('0x33')]=!![];queues[_0x5e8dec['uniqueid']][_0xe4f1('0x1b')]=utils['now']();queues[_0x5e8dec[_0xe4f1('0x4')]][_0xe4f1('0x38')]=utils[_0xe4f1('0x39')](queues[_0x5e8dec[_0xe4f1('0x4')]][_0xe4f1('0x1b')],queues[_0x5e8dec[_0xe4f1('0x4')]][_0xe4f1('0x3a')]);queues[_0x5e8dec['uniqueid']]['position']=_0x5e8dec[_0xe4f1('0x15')];queues[_0x5e8dec[_0xe4f1('0x4')]][_0xe4f1('0x3b')]=_0x5e8dec[_0xe4f1('0x3b')];queues[_0x5e8dec['uniqueid']]['connectedlinenum']=_0x5e8dec[_0xe4f1('0x36')];queues[_0x5e8dec[_0xe4f1('0x4')]]['connectedlinename']=_0x5e8dec['connectedlinename'];}}catch(_0x1549ab){utils[_0xe4f1('0x18')](util[_0xe4f1('0x2')](_0xe4f1('0x34'),_0x5e8dec[_0xe4f1('0x4')]),_0x1549ab);}};exports[_0xe4f1('0x3c')]=function(_0x11b180){try{if(!_['isNil'](queues[_0x11b180[_0xe4f1('0x4')]])){utils['debug'](util[_0xe4f1('0x2')]('[%s][queues][agentconnect]',_0x11b180[_0xe4f1('0x4')]),_0x11b180);utils[_0xe4f1('0x13')](util['format'](_0xe4f1('0x3d'),_0x11b180[_0xe4f1('0x4')],queues[_0x11b180[_0xe4f1('0x4')]][_0xe4f1('0x1f')],_0x11b180[_0xe4f1('0x3e')],_0x11b180[_0xe4f1('0x3f')]));queues[_0x11b180[_0xe4f1('0x4')]]['queuecallerabandon']=![];queues[_0x11b180['uniqueid']][_0xe4f1('0x28')]=![];queues[_0x11b180['uniqueid']][_0xe4f1('0x2d')]=null;queues[_0x11b180['uniqueid']][_0xe4f1('0x29')]=![];queues[_0x11b180[_0xe4f1('0x4')]][_0xe4f1('0x9')]=null;queues[_0x11b180['uniqueid']][_0xe4f1('0x2e')]=null;queues[_0x11b180[_0xe4f1('0x4')]][_0xe4f1('0x40')]=!![];queues[_0x11b180[_0xe4f1('0x4')]][_0xe4f1('0x8')]=_0x11b180['destaccountcode'];queues[_0x11b180[_0xe4f1('0x4')]][_0xe4f1('0x41')]=_0x11b180[_0xe4f1('0x3e')];}}catch(_0x443db3){utils['error'](util['format'](_0xe4f1('0x42'),_0x11b180[_0xe4f1('0x4')]),_0x443db3);}};exports[_0xe4f1('0x43')]=function(_0x22d531){try{if(!_['isNil'](queues[_0x22d531['uniqueid']])){if(queues[_0x22d531[_0xe4f1('0x4')]][_0xe4f1('0x1b')]){utils[_0xe4f1('0x11')](util[_0xe4f1('0x2')](_0xe4f1('0x44'),_0x22d531[_0xe4f1('0x4')]),_0x22d531);queues[_0x22d531[_0xe4f1('0x4')]][_0xe4f1('0x28')]=![];queues[_0x22d531['uniqueid']][_0xe4f1('0x28')]=![];queues[_0x22d531[_0xe4f1('0x4')]][_0xe4f1('0x2d')]=null;queues[_0x22d531[_0xe4f1('0x4')]][_0xe4f1('0x29')]=![];queues[_0x22d531[_0xe4f1('0x4')]]['queuecallerexitAt']=null;queues[_0x22d531['uniqueid']][_0xe4f1('0x40')]=!![];queues[_0x22d531[_0xe4f1('0x4')]][_0xe4f1('0x41')]=_0x22d531[_0xe4f1('0x3e')];queues[_0x22d531[_0xe4f1('0x4')]]['queuecallercomplete']=!![];queues[_0x22d531['uniqueid']][_0xe4f1('0x1c')]=utils['now']();if(_0x22d531[_0xe4f1('0x45')]==_0xe4f1('0x46')){if(!queues[_0x22d531[_0xe4f1('0x4')]][_0xe4f1('0x46')]){queues[_0x22d531['uniqueid']][_0xe4f1('0x9')]=_0xe4f1('0x47');}}else{queues[_0x22d531[_0xe4f1('0x4')]]['queuecallerexitreason']='COMPLETEDBY'+_0x22d531[_0xe4f1('0x45')]['toUpperCase']();}utils[_0xe4f1('0x13')](util['format'](_0xe4f1('0x48'),_0x22d531[_0xe4f1('0x4')],queues[_0x22d531[_0xe4f1('0x4')]]['name'],_0x22d531[_0xe4f1('0x3e')],queues[_0x22d531[_0xe4f1('0x4')]][_0xe4f1('0x9')]));writeDB(queues[_0x22d531[_0xe4f1('0x4')]]);}}}catch(_0x29bd7a){utils['error'](util['format']('[%s][queues][agentcomplete]',_0x22d531[_0xe4f1('0x4')]),_0x29bd7a);}};exports[_0xe4f1('0x49')]=function(_0x1c0869){try{if(!_['isNil'](queues[_0x1c0869[_0xe4f1('0x4a')]])){utils[_0xe4f1('0x11')](util[_0xe4f1('0x2')]('[%s][queues][blindtransfer]',_0x1c0869[_0xe4f1('0x4')]),_0x1c0869);queues[_0x1c0869[_0xe4f1('0x4a')]][_0xe4f1('0x46')]=!![];queues[_0x1c0869['transfereeuniqueid']][_0xe4f1('0x4b')]=_0xe4f1('0x4c');queues[_0x1c0869['transfereeuniqueid']]['transferexten']=_0x1c0869['extension'];queues[_0x1c0869['transfereeuniqueid']][_0xe4f1('0x4d')]=_0x1c0869[_0xe4f1('0x4a')];queues[_0x1c0869['transfereeuniqueid']][_0xe4f1('0x9')]=_0xe4f1('0x4e');utils[_0xe4f1('0x13')](util[_0xe4f1('0x2')](_0xe4f1('0x4f'),_0x1c0869[_0xe4f1('0x4')],queues[_0x1c0869[_0xe4f1('0x4a')]][_0xe4f1('0x1f')],_0x1c0869[_0xe4f1('0x4a')],_0x1c0869[_0xe4f1('0x50')]));}}catch(_0x5e60ba){utils[_0xe4f1('0x18')](util['format']('[%s][queues][blindtransfer]',_0x1c0869[_0xe4f1('0x4')]),_0x5e60ba);}};exports[_0xe4f1('0x51')]=function(_0x36021e){try{utils[_0xe4f1('0x11')](util['format'](_0xe4f1('0x52'),_0x36021e[_0xe4f1('0x53')]),_0x36021e);if(_0x36021e[_0xe4f1('0x53')]==_0x36021e['origtransfererlinkedid']){if(!_[_0xe4f1('0x23')](queues[_0x36021e['secondtransfererlinkedid']])){utils[_0xe4f1('0x13')](util[_0xe4f1('0x2')](_0xe4f1('0x54'),_0x36021e[_0xe4f1('0x53')],queues[_0x36021e[_0xe4f1('0x55')]][_0xe4f1('0x1f')],_0x36021e[_0xe4f1('0x56')]));queues[_0x36021e[_0xe4f1('0x55')]][_0xe4f1('0x46')]=!![];queues[_0x36021e[_0xe4f1('0x55')]][_0xe4f1('0x4b')]=_0xe4f1('0x57');queues[_0x36021e[_0xe4f1('0x55')]][_0xe4f1('0x58')]=_0x36021e[_0xe4f1('0x56')];queues[_0x36021e['secondtransfererlinkedid']][_0xe4f1('0x4d')]=_0x36021e[_0xe4f1('0x53')];queues[_0x36021e[_0xe4f1('0x55')]]['queuecallerexitreason']=_0xe4f1('0x59');}if(!_[_0xe4f1('0x23')](queues[_0x36021e[_0xe4f1('0x5a')]])){if(_0x36021e['transfereelinkedid']&&queues[_0x36021e[_0xe4f1('0x5b')]]){queues[_0x36021e[_0xe4f1('0x5b')]][_0xe4f1('0x5c')]=0x1;queues[_0x36021e[_0xe4f1('0x4a')]]=_[_0xe4f1('0x5d')](queues[_0x36021e[_0xe4f1('0x5b')]]);queues[_0x36021e[_0xe4f1('0x4a')]]['transfereduniqueid']=_0x36021e[_0xe4f1('0x5e')];queues[_0x36021e[_0xe4f1('0x4a')]][_0xe4f1('0x5c')]=0x2;queues[_0x36021e[_0xe4f1('0x4a')]][_0xe4f1('0x7')]=queues[_0x36021e[_0xe4f1('0x55')]][_0xe4f1('0x7')];queues[_0x36021e[_0xe4f1('0x4a')]][_0xe4f1('0x5f')]=queues[_0x36021e[_0xe4f1('0x55')]][_0xe4f1('0x5f')];queues[_0x36021e['transfereeuniqueid']][_0xe4f1('0x3a')]=utils[_0xe4f1('0x17')]();queues[_0x36021e[_0xe4f1('0x4a')]][_0xe4f1('0x1b')]=utils[_0xe4f1('0x17')]();queues[_0x36021e[_0xe4f1('0x4a')]][_0xe4f1('0x38')]=0x0;queues[_0x36021e[_0xe4f1('0x4a')]][_0xe4f1('0x60')]=0x0;utils[_0xe4f1('0x13')](util[_0xe4f1('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x36021e[_0xe4f1('0x53')],queues[_0x36021e['transfereeuniqueid']]['name'],queues[_0x36021e[_0xe4f1('0x4a')]][_0xe4f1('0x7')],queues[_0x36021e[_0xe4f1('0x4a')]][_0xe4f1('0x5f')]));}else{utils[_0xe4f1('0x13')](util['format'](_0xe4f1('0x61'),_0x36021e[_0xe4f1('0x53')],queues[_0x36021e['origtransfererlinkedid']][_0xe4f1('0x1f')],_0x36021e['secondtransfererlinkedid']));queues[_0x36021e['origtransfererlinkedid']][_0xe4f1('0xf')]=_0x36021e[_0xe4f1('0x55')];}}}else if(_0x36021e[_0xe4f1('0x62')]==_0x36021e[_0xe4f1('0x55')]){if(!_[_0xe4f1('0x23')](queues[_0x36021e['origtransfererlinkedid']])){utils['info'](util[_0xe4f1('0x2')](_0xe4f1('0x63'),_0x36021e[_0xe4f1('0x53')],queues[_0x36021e[_0xe4f1('0x5a')]][_0xe4f1('0x1f')],_0x36021e[_0xe4f1('0x62')],_0x36021e[_0xe4f1('0x64')]));queues[_0x36021e[_0xe4f1('0x5a')]][_0xe4f1('0x46')]=!![];queues[_0x36021e[_0xe4f1('0x5a')]][_0xe4f1('0x4b')]='ATTENDED';queues[_0x36021e['origtransfererlinkedid']][_0xe4f1('0x58')]=_0x36021e[_0xe4f1('0x64')];queues[_0x36021e['origtransfererlinkedid']][_0xe4f1('0x4d')]=_0x36021e['secondtransfereruniqueid'];queues[_0x36021e[_0xe4f1('0x5a')]][_0xe4f1('0x9')]='ATTENDEDTRANSFER';}if(!_[_0xe4f1('0x23')](queues[_0x36021e[_0xe4f1('0x55')]])){if(_0x36021e[_0xe4f1('0x65')]&&queues[_0x36021e['transfertargetlinkedid']]){queues[_0x36021e['transfertargetlinkedid']]['queuecallerenterreason']=0x1;queues[_0x36021e['transfertargetuniqueid']]=_['clone'](queues[_0x36021e['transfertargetlinkedid']]);queues[_0x36021e[_0xe4f1('0x5e')]][_0xe4f1('0xf')]=_0x36021e[_0xe4f1('0x5e')];queues[_0x36021e[_0xe4f1('0x5e')]][_0xe4f1('0x5c')]=0x2;queues[_0x36021e[_0xe4f1('0x5e')]][_0xe4f1('0x7')]=queues[_0x36021e[_0xe4f1('0x5a')]][_0xe4f1('0x7')];queues[_0x36021e[_0xe4f1('0x5e')]][_0xe4f1('0x5f')]=queues[_0x36021e[_0xe4f1('0x5a')]]['calleridname'];queues[_0x36021e[_0xe4f1('0x5e')]]['queuecallerjoinAt']=utils[_0xe4f1('0x17')]();queues[_0x36021e[_0xe4f1('0x5e')]][_0xe4f1('0x1b')]=utils[_0xe4f1('0x17')]();queues[_0x36021e[_0xe4f1('0x5e')]][_0xe4f1('0x38')]=0x0;queues[_0x36021e[_0xe4f1('0x5e')]]['mohtime']=0x0;utils['info'](util[_0xe4f1('0x2')](_0xe4f1('0x66'),_0x36021e['origtransfereruniqueid'],queues[_0x36021e[_0xe4f1('0x5e')]]['name'],queues[_0x36021e[_0xe4f1('0x5e')]][_0xe4f1('0xf')],queues[_0x36021e[_0xe4f1('0x5e')]]['calleridnum'],queues[_0x36021e['transfertargetuniqueid']][_0xe4f1('0x5f')]));}else{utils[_0xe4f1('0x13')](util[_0xe4f1('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x36021e['origtransfereruniqueid'],queues[_0x36021e[_0xe4f1('0x55')]][_0xe4f1('0x1f')],_0x36021e[_0xe4f1('0x5a')]));queues[_0x36021e[_0xe4f1('0x55')]][_0xe4f1('0xf')]=_0x36021e[_0xe4f1('0x5a')];}}}}catch(_0x2946d5){utils[_0xe4f1('0x18')](util['format'](_0xe4f1('0x52'),_0x36021e[_0xe4f1('0x53')]),_0x2946d5);}};exports[_0xe4f1('0x67')]=function(_0x34e8b1){try{if(!_[_0xe4f1('0x23')](queues[_0x34e8b1[_0xe4f1('0x4')]])){utils[_0xe4f1('0x11')](util[_0xe4f1('0x2')](_0xe4f1('0x68'),_0x34e8b1[_0xe4f1('0x4')]),_0x34e8b1);queues[_0x34e8b1['uniqueid']][_0xe4f1('0x69')]=utils[_0xe4f1('0x17')]();utils[_0xe4f1('0x13')](util[_0xe4f1('0x2')](_0xe4f1('0x6a'),_0x34e8b1[_0xe4f1('0x4')],queues[_0x34e8b1['uniqueid']][_0xe4f1('0x1f')],queues[_0x34e8b1[_0xe4f1('0x4')]][_0xe4f1('0x69')]));}}catch(_0x42f139){utils[_0xe4f1('0x18')](util[_0xe4f1('0x2')](_0xe4f1('0x68'),_0x34e8b1[_0xe4f1('0x4')]),_0x42f139);}};exports[_0xe4f1('0x6b')]=function(_0x5e4153){try{if(!_[_0xe4f1('0x23')](queues[_0x5e4153[_0xe4f1('0x4')]])){if(!_[_0xe4f1('0x23')](queues[_0x5e4153['uniqueid']][_0xe4f1('0x69')])){utils[_0xe4f1('0x11')](util[_0xe4f1('0x2')](_0xe4f1('0x6c'),_0x5e4153[_0xe4f1('0x4')]),_0x5e4153);queues[_0x5e4153[_0xe4f1('0x4')]]['mohtime']+=utils['diffTime'](utils[_0xe4f1('0x17')](),queues[_0x5e4153[_0xe4f1('0x4')]][_0xe4f1('0x69')]);utils[_0xe4f1('0x13')](util[_0xe4f1('0x2')](_0xe4f1('0x6d'),_0x5e4153['uniqueid'],queues[_0x5e4153['uniqueid']]['name'],queues[_0x5e4153[_0xe4f1('0x4')]]['mohtime']));delete queues[_0x5e4153[_0xe4f1('0x4')]]['musiconholdstartAt'];}}}catch(_0x30650c){utils[_0xe4f1('0x18')](util['format']('[%s][queues][musiconholdstop]',_0x5e4153['uniqueid']),_0x30650c);}}; \ No newline at end of file +var _0x0b1b=['queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','holdtime','diffTime','queuecallerjoinAt','count','connectedlinename','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','[%s][queues][blindtransfer]','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','getVoiceQueueByName','then','type','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','format','position','error','[%s][queues][queuecallerjoin]','hangup','debug','queuecallerleaveAt','queuecallerabandon','queuecallercompleteAt','now','queuecallerexitreason','COMPLETEDBYAGENT','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][hangup]','varset','[%s][queues][varset]','isNil','variable','value','toUpperCase','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]'];(function(_0x473467,_0x446a6b){var _0x5b6da0=function(_0x99cd51){while(--_0x99cd51){_0x473467['push'](_0x473467['shift']());}};_0x5b6da0(++_0x446a6b);}(_0x0b1b,0x105));var _0xb0b1=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x0b1b[_0x346737];return _0x1ade2e;};'use strict';var _=require(_0xb0b1('0x0'));var util=require(_0xb0b1('0x1'));var utils=require(_0xb0b1('0x2'));var queues={};function writeDB(_0x24c3bb){utils[_0xb0b1('0x3')](util['format'](_0xb0b1('0x4'),_0x24c3bb[_0xb0b1('0x5')],_0x24c3bb[_0xb0b1('0x6')],_0x24c3bb[_0xb0b1('0x7')],_0x24c3bb[_0xb0b1('0x8')],_0x24c3bb[_0xb0b1('0x9')],_0x24c3bb[_0xb0b1('0xa')],_0x24c3bb['queuecallerexitreason']));if(_0x24c3bb[_0xb0b1('0x7')]){utils[_0xb0b1('0xb')](_0x24c3bb[_0xb0b1('0x7')])[_0xb0b1('0xc')](function(_0x480c96){if(_0x480c96){_0x24c3bb[_0xb0b1('0xd')]=_0x480c96['type'];}utils['request'](_0xb0b1('0xe'),_0x24c3bb);});}else{utils['request'](_0xb0b1('0xe'),_0x24c3bb);}if(_0x24c3bb[_0xb0b1('0xf')]){delete queues[_0x24c3bb[_0xb0b1('0xf')]];}else{delete queues[_0x24c3bb['uniqueid']];}}exports[_0xb0b1('0x10')]=function(_0xc3125e){try{utils['debug'](util[_0xb0b1('0x11')]('[%s][queues][queuecallerjoin]',_0xc3125e[_0xb0b1('0x5')]),_0xc3125e);utils[_0xb0b1('0x3')](util['format']('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0xc3125e[_0xb0b1('0x5')],_0xc3125e['queue'],_0xc3125e[_0xb0b1('0x12')]));queues[_0xc3125e[_0xb0b1('0x5')]]=_['assign'](_0xc3125e,{'originalposition':_0xc3125e[_0xb0b1('0x12')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x380cf2){utils[_0xb0b1('0x13')](util[_0xb0b1('0x11')](_0xb0b1('0x14'),_0xc3125e['uniqueid']),_0x380cf2);}};exports[_0xb0b1('0x15')]=function(_0x1d2579){try{if(!_['isNil'](queues[_0x1d2579['uniqueid']])){utils[_0xb0b1('0x16')](util['format']('[%s][queues][hangup]',_0x1d2579[_0xb0b1('0x5')]),_0x1d2579);if(queues[_0x1d2579['uniqueid']][_0xb0b1('0x17')]){if(!queues[_0x1d2579[_0xb0b1('0x5')]][_0xb0b1('0x18')]&&!queues[_0x1d2579[_0xb0b1('0x5')]]['queuecallerexit']){queues[_0x1d2579[_0xb0b1('0x5')]]['queuecallercomplete']=!![];queues[_0x1d2579['uniqueid']][_0xb0b1('0x19')]=utils[_0xb0b1('0x1a')]();queues[_0x1d2579[_0xb0b1('0x5')]][_0xb0b1('0x1b')]=_0xb0b1('0x1c');}utils[_0xb0b1('0x3')](util[_0xb0b1('0x11')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x1d2579[_0xb0b1('0x5')],queues[_0x1d2579[_0xb0b1('0x5')]][_0xb0b1('0x1d')],queues[_0x1d2579['uniqueid']][_0xb0b1('0x1b')]));writeDB(queues[_0x1d2579[_0xb0b1('0x5')]]);}else if(queues[_0x1d2579[_0xb0b1('0x5')]][_0xb0b1('0xf')]){utils[_0xb0b1('0x3')](util[_0xb0b1('0x11')](_0xb0b1('0x1e'),_0x1d2579['uniqueid'],queues[_0x1d2579[_0xb0b1('0x5')]]['name'],queues[_0x1d2579[_0xb0b1('0x5')]][_0xb0b1('0xf')]));queues[queues[_0x1d2579[_0xb0b1('0x5')]][_0xb0b1('0xf')]]=queues[_0x1d2579[_0xb0b1('0x5')]];queues[queues[_0x1d2579[_0xb0b1('0x5')]][_0xb0b1('0xf')]][_0xb0b1('0x1f')]=0x2;delete queues[_0x1d2579[_0xb0b1('0x5')]];}}}catch(_0x5d18f8){utils[_0xb0b1('0x13')](util['format'](_0xb0b1('0x20'),_0x1d2579[_0xb0b1('0x5')]),_0x5d18f8);}};exports[_0xb0b1('0x21')]=function(_0xf25739){try{utils[_0xb0b1('0x16')](util[_0xb0b1('0x11')](_0xb0b1('0x22'),_0xf25739['uniqueid']),_0xf25739);if(!_[_0xb0b1('0x23')](_0xf25739[_0xb0b1('0x24')]['queuestatus'])&&_0xf25739[_0xb0b1('0x25')][_0xb0b1('0x26')]()!=='CONTINUE'){if(!_[_0xb0b1('0x23')](queues[_0xf25739['uniqueid']])){queues[_0xf25739[_0xb0b1('0x5')]][_0xb0b1('0x18')]=![];queues[_0xf25739[_0xb0b1('0x5')]][_0xb0b1('0x27')]=null;queues[_0xf25739[_0xb0b1('0x5')]][_0xb0b1('0x28')]=!![];queues[_0xf25739[_0xb0b1('0x5')]][_0xb0b1('0x29')]=utils[_0xb0b1('0x1a')]();queues[_0xf25739[_0xb0b1('0x5')]][_0xb0b1('0x1b')]=_0xf25739[_0xb0b1('0x25')][_0xb0b1('0x26')]();utils['info'](util[_0xb0b1('0x11')](_0xb0b1('0x2a'),_0xf25739[_0xb0b1('0x5')],queues[_0xf25739[_0xb0b1('0x5')]][_0xb0b1('0x1d')],_0xf25739[_0xb0b1('0x25')],queues[_0xf25739[_0xb0b1('0x5')]][_0xb0b1('0x1b')]));writeDB(queues[_0xf25739[_0xb0b1('0x5')]]);}}else if(!_[_0xb0b1('0x23')](_0xf25739['variable'][_0xb0b1('0x2b')])){if(!_[_0xb0b1('0x23')](queues[_0xf25739['uniqueid']])&&!queues[_0xf25739[_0xb0b1('0x5')]][_0xb0b1('0x18')]){queues[_0xf25739[_0xb0b1('0x5')]][_0xb0b1('0x18')]=![];queues[_0xf25739[_0xb0b1('0x5')]][_0xb0b1('0x27')]=null;queues[_0xf25739[_0xb0b1('0x5')]][_0xb0b1('0x28')]=!![];queues[_0xf25739[_0xb0b1('0x5')]][_0xb0b1('0x29')]=utils[_0xb0b1('0x1a')]();queues[_0xf25739[_0xb0b1('0x5')]][_0xb0b1('0x1b')]=_0xb0b1('0x2c');utils[_0xb0b1('0x3')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0xf25739['uniqueid'],queues[_0xf25739[_0xb0b1('0x5')]]['name'],_0xf25739[_0xb0b1('0x25')],queues[_0xf25739[_0xb0b1('0x5')]][_0xb0b1('0x1b')]));}}}catch(_0x1a5973){utils['error'](util[_0xb0b1('0x11')](_0xb0b1('0x22'),_0xf25739[_0xb0b1('0x5')]),_0x1a5973);}};exports[_0xb0b1('0x18')]=function(_0x1c7a27){try{if(!_[_0xb0b1('0x23')](queues[_0x1c7a27[_0xb0b1('0x5')]])){utils[_0xb0b1('0x16')](util[_0xb0b1('0x11')]('[%s][queues][queuecallerabandon]',_0x1c7a27['uniqueid']),_0x1c7a27);queues[_0x1c7a27[_0xb0b1('0x5')]]['queuecallerexit']=![];queues[_0x1c7a27['uniqueid']][_0xb0b1('0x29')]=null;queues[_0x1c7a27[_0xb0b1('0x5')]][_0xb0b1('0x18')]=!![];queues[_0x1c7a27['uniqueid']][_0xb0b1('0x27')]=utils['now']();queues[_0x1c7a27[_0xb0b1('0x5')]][_0xb0b1('0x1b')]=_0xb0b1('0x2d');utils[_0xb0b1('0x3')](util[_0xb0b1('0x11')](_0xb0b1('0x2e'),_0x1c7a27['uniqueid'],queues[_0x1c7a27['uniqueid']][_0xb0b1('0x1d')],queues[_0x1c7a27['uniqueid']][_0xb0b1('0x1b')]));}}catch(_0x4d526e){utils['error'](util[_0xb0b1('0x11')](_0xb0b1('0x2f'),_0x1c7a27[_0xb0b1('0x5')]),_0x4d526e);}};exports[_0xb0b1('0x30')]=function(_0xca6e2){try{if(!_['isNil'](queues[_0xca6e2['uniqueid']])){utils[_0xb0b1('0x16')](util['format']('[%s][queues][queuecallerleave]',_0xca6e2['uniqueid']),_0xca6e2);utils[_0xb0b1('0x3')](util[_0xb0b1('0x11')](_0xb0b1('0x31'),_0xca6e2[_0xb0b1('0x5')],queues[_0xca6e2['uniqueid']][_0xb0b1('0x1d')],_0xca6e2[_0xb0b1('0x32')],_0xca6e2['connectedlinename']));queues[_0xca6e2[_0xb0b1('0x5')]]['queuecallerleave']=!![];queues[_0xca6e2['uniqueid']][_0xb0b1('0x17')]=utils[_0xb0b1('0x1a')]();queues[_0xca6e2[_0xb0b1('0x5')]][_0xb0b1('0x33')]=utils[_0xb0b1('0x34')](queues[_0xca6e2[_0xb0b1('0x5')]][_0xb0b1('0x17')],queues[_0xca6e2[_0xb0b1('0x5')]][_0xb0b1('0x35')]);queues[_0xca6e2[_0xb0b1('0x5')]][_0xb0b1('0x12')]=_0xca6e2[_0xb0b1('0x12')];queues[_0xca6e2[_0xb0b1('0x5')]][_0xb0b1('0x36')]=_0xca6e2[_0xb0b1('0x36')];queues[_0xca6e2['uniqueid']][_0xb0b1('0x32')]=_0xca6e2[_0xb0b1('0x32')];queues[_0xca6e2[_0xb0b1('0x5')]][_0xb0b1('0x37')]=_0xca6e2[_0xb0b1('0x37')];}}catch(_0x3fbd4e){utils[_0xb0b1('0x13')](util[_0xb0b1('0x11')]('[%s][queues][queuecallerleave]',_0xca6e2[_0xb0b1('0x5')]),_0x3fbd4e);}};exports[_0xb0b1('0x38')]=function(_0x4d343d){try{if(!_['isNil'](queues[_0x4d343d[_0xb0b1('0x5')]])){utils[_0xb0b1('0x16')](util[_0xb0b1('0x11')](_0xb0b1('0x39'),_0x4d343d['uniqueid']),_0x4d343d);utils[_0xb0b1('0x3')](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x4d343d[_0xb0b1('0x5')],queues[_0x4d343d[_0xb0b1('0x5')]][_0xb0b1('0x1d')],_0x4d343d[_0xb0b1('0x3a')],_0x4d343d[_0xb0b1('0x3b')]));queues[_0x4d343d[_0xb0b1('0x5')]][_0xb0b1('0x18')]=![];queues[_0x4d343d[_0xb0b1('0x5')]][_0xb0b1('0x18')]=![];queues[_0x4d343d[_0xb0b1('0x5')]][_0xb0b1('0x27')]=null;queues[_0x4d343d[_0xb0b1('0x5')]]['queuecallerexit']=![];queues[_0x4d343d['uniqueid']][_0xb0b1('0x1b')]=null;queues[_0x4d343d[_0xb0b1('0x5')]]['queuecallerexitAt']=null;queues[_0x4d343d[_0xb0b1('0x5')]][_0xb0b1('0x3c')]=!![];queues[_0x4d343d[_0xb0b1('0x5')]]['accountcode']=_0x4d343d['destaccountcode'];queues[_0x4d343d[_0xb0b1('0x5')]][_0xb0b1('0x8')]=_0x4d343d['membername'];}}catch(_0x53f24e){utils[_0xb0b1('0x13')](util[_0xb0b1('0x11')]('[%s][queues][agentconnect]',_0x4d343d['uniqueid']),_0x53f24e);}};exports[_0xb0b1('0x3d')]=function(_0x4a2a8e){try{if(!_[_0xb0b1('0x23')](queues[_0x4a2a8e['uniqueid']])){if(queues[_0x4a2a8e[_0xb0b1('0x5')]]['queuecallerleaveAt']){utils[_0xb0b1('0x16')](util['format'](_0xb0b1('0x3e'),_0x4a2a8e[_0xb0b1('0x5')]),_0x4a2a8e);queues[_0x4a2a8e[_0xb0b1('0x5')]][_0xb0b1('0x18')]=![];queues[_0x4a2a8e[_0xb0b1('0x5')]][_0xb0b1('0x18')]=![];queues[_0x4a2a8e['uniqueid']][_0xb0b1('0x27')]=null;queues[_0x4a2a8e[_0xb0b1('0x5')]][_0xb0b1('0x28')]=![];queues[_0x4a2a8e[_0xb0b1('0x5')]][_0xb0b1('0x29')]=null;queues[_0x4a2a8e[_0xb0b1('0x5')]][_0xb0b1('0x3c')]=!![];queues[_0x4a2a8e[_0xb0b1('0x5')]]['lastAssignedTo']=_0x4a2a8e[_0xb0b1('0x3a')];queues[_0x4a2a8e['uniqueid']][_0xb0b1('0x3f')]=!![];queues[_0x4a2a8e['uniqueid']][_0xb0b1('0x19')]=utils['now']();if(_0x4a2a8e[_0xb0b1('0x40')]==_0xb0b1('0x41')){if(!queues[_0x4a2a8e[_0xb0b1('0x5')]][_0xb0b1('0x41')]){queues[_0x4a2a8e[_0xb0b1('0x5')]][_0xb0b1('0x1b')]=_0xb0b1('0x42');}}else{queues[_0x4a2a8e[_0xb0b1('0x5')]]['queuecallerexitreason']=_0xb0b1('0x43')+_0x4a2a8e[_0xb0b1('0x40')][_0xb0b1('0x26')]();}utils[_0xb0b1('0x3')](util[_0xb0b1('0x11')](_0xb0b1('0x44'),_0x4a2a8e['uniqueid'],queues[_0x4a2a8e[_0xb0b1('0x5')]][_0xb0b1('0x1d')],_0x4a2a8e[_0xb0b1('0x3a')],queues[_0x4a2a8e[_0xb0b1('0x5')]][_0xb0b1('0x1b')]));writeDB(queues[_0x4a2a8e[_0xb0b1('0x5')]]);}}}catch(_0x41c0bc){utils[_0xb0b1('0x13')](util[_0xb0b1('0x11')](_0xb0b1('0x3e'),_0x4a2a8e[_0xb0b1('0x5')]),_0x41c0bc);}};exports[_0xb0b1('0x45')]=function(_0x45115b){try{if(!_['isNil'](queues[_0x45115b['transfereeuniqueid']])){utils['debug'](util[_0xb0b1('0x11')]('[%s][queues][blindtransfer]',_0x45115b[_0xb0b1('0x5')]),_0x45115b);queues[_0x45115b[_0xb0b1('0x46')]][_0xb0b1('0x41')]=!![];queues[_0x45115b[_0xb0b1('0x46')]][_0xb0b1('0x47')]=_0xb0b1('0x48');queues[_0x45115b[_0xb0b1('0x46')]]['transferexten']=_0x45115b['extension'];queues[_0x45115b[_0xb0b1('0x46')]][_0xb0b1('0x49')]=_0x45115b['transfereeuniqueid'];queues[_0x45115b['transfereeuniqueid']][_0xb0b1('0x1b')]='BLINDTRANSFER';utils[_0xb0b1('0x3')](util[_0xb0b1('0x11')](_0xb0b1('0x4a'),_0x45115b['uniqueid'],queues[_0x45115b[_0xb0b1('0x46')]][_0xb0b1('0x1d')],_0x45115b[_0xb0b1('0x46')],_0x45115b[_0xb0b1('0x4b')]));}}catch(_0x3426b2){utils[_0xb0b1('0x13')](util[_0xb0b1('0x11')](_0xb0b1('0x4c'),_0x45115b[_0xb0b1('0x5')]),_0x3426b2);}};exports['attendedtransfer']=function(_0x1c7ca2){try{utils[_0xb0b1('0x16')](util[_0xb0b1('0x11')](_0xb0b1('0x4d'),_0x1c7ca2[_0xb0b1('0x4e')]),_0x1c7ca2);if(_0x1c7ca2['origtransfereruniqueid']==_0x1c7ca2[_0xb0b1('0x4f')]){if(!_[_0xb0b1('0x23')](queues[_0x1c7ca2[_0xb0b1('0x50')]])){utils['info'](util['format'](_0xb0b1('0x51'),_0x1c7ca2[_0xb0b1('0x4e')],queues[_0x1c7ca2[_0xb0b1('0x50')]]['name'],_0x1c7ca2[_0xb0b1('0x52')]));queues[_0x1c7ca2[_0xb0b1('0x50')]]['transfer']=!![];queues[_0x1c7ca2['secondtransfererlinkedid']][_0xb0b1('0x47')]=_0xb0b1('0x53');queues[_0x1c7ca2[_0xb0b1('0x50')]]['transferexten']=_0x1c7ca2[_0xb0b1('0x52')];queues[_0x1c7ca2[_0xb0b1('0x50')]][_0xb0b1('0x49')]=_0x1c7ca2[_0xb0b1('0x4e')];queues[_0x1c7ca2['secondtransfererlinkedid']]['queuecallerexitreason']=_0xb0b1('0x54');}if(!_[_0xb0b1('0x23')](queues[_0x1c7ca2[_0xb0b1('0x4f')]])){if(_0x1c7ca2[_0xb0b1('0x55')]&&queues[_0x1c7ca2['transfereelinkedid']]){queues[_0x1c7ca2['transfereelinkedid']][_0xb0b1('0x1f')]=0x1;queues[_0x1c7ca2['transfereeuniqueid']]=_[_0xb0b1('0x56')](queues[_0x1c7ca2[_0xb0b1('0x55')]]);queues[_0x1c7ca2[_0xb0b1('0x46')]][_0xb0b1('0xf')]=_0x1c7ca2[_0xb0b1('0x57')];queues[_0x1c7ca2[_0xb0b1('0x46')]][_0xb0b1('0x1f')]=0x2;queues[_0x1c7ca2[_0xb0b1('0x46')]][_0xb0b1('0x9')]=queues[_0x1c7ca2[_0xb0b1('0x50')]][_0xb0b1('0x9')];queues[_0x1c7ca2[_0xb0b1('0x46')]][_0xb0b1('0x58')]=queues[_0x1c7ca2['secondtransfererlinkedid']][_0xb0b1('0x58')];queues[_0x1c7ca2['transfereeuniqueid']]['queuecallerjoinAt']=utils[_0xb0b1('0x1a')]();queues[_0x1c7ca2[_0xb0b1('0x46')]][_0xb0b1('0x17')]=utils[_0xb0b1('0x1a')]();queues[_0x1c7ca2['transfereeuniqueid']][_0xb0b1('0x33')]=0x0;queues[_0x1c7ca2[_0xb0b1('0x46')]][_0xb0b1('0x59')]=0x0;utils[_0xb0b1('0x3')](util[_0xb0b1('0x11')](_0xb0b1('0x5a'),_0x1c7ca2[_0xb0b1('0x4e')],queues[_0x1c7ca2[_0xb0b1('0x46')]][_0xb0b1('0x1d')],queues[_0x1c7ca2[_0xb0b1('0x46')]][_0xb0b1('0x9')],queues[_0x1c7ca2[_0xb0b1('0x46')]][_0xb0b1('0x58')]));}else{utils[_0xb0b1('0x3')](util[_0xb0b1('0x11')](_0xb0b1('0x5b'),_0x1c7ca2[_0xb0b1('0x4e')],queues[_0x1c7ca2[_0xb0b1('0x4f')]]['name'],_0x1c7ca2[_0xb0b1('0x50')]));queues[_0x1c7ca2[_0xb0b1('0x4f')]]['transfereduniqueid']=_0x1c7ca2[_0xb0b1('0x50')];}}}else if(_0x1c7ca2[_0xb0b1('0x5c')]==_0x1c7ca2[_0xb0b1('0x50')]){if(!_[_0xb0b1('0x23')](queues[_0x1c7ca2[_0xb0b1('0x4f')]])){utils[_0xb0b1('0x3')](util[_0xb0b1('0x11')](_0xb0b1('0x5d'),_0x1c7ca2['origtransfereruniqueid'],queues[_0x1c7ca2[_0xb0b1('0x4f')]][_0xb0b1('0x1d')],_0x1c7ca2['secondtransfereruniqueid'],_0x1c7ca2[_0xb0b1('0x5e')]));queues[_0x1c7ca2[_0xb0b1('0x4f')]][_0xb0b1('0x41')]=!![];queues[_0x1c7ca2[_0xb0b1('0x4f')]][_0xb0b1('0x47')]='ATTENDED';queues[_0x1c7ca2['origtransfererlinkedid']]['transferexten']=_0x1c7ca2[_0xb0b1('0x5e')];queues[_0x1c7ca2['origtransfererlinkedid']]['transferuniqueid']=_0x1c7ca2[_0xb0b1('0x5c')];queues[_0x1c7ca2[_0xb0b1('0x4f')]][_0xb0b1('0x1b')]=_0xb0b1('0x54');}if(!_[_0xb0b1('0x23')](queues[_0x1c7ca2['secondtransfererlinkedid']])){if(_0x1c7ca2[_0xb0b1('0x5f')]&&queues[_0x1c7ca2['transfertargetlinkedid']]){queues[_0x1c7ca2[_0xb0b1('0x5f')]][_0xb0b1('0x1f')]=0x1;queues[_0x1c7ca2['transfertargetuniqueid']]=_[_0xb0b1('0x56')](queues[_0x1c7ca2[_0xb0b1('0x5f')]]);queues[_0x1c7ca2[_0xb0b1('0x57')]][_0xb0b1('0xf')]=_0x1c7ca2['transfertargetuniqueid'];queues[_0x1c7ca2['transfertargetuniqueid']][_0xb0b1('0x1f')]=0x2;queues[_0x1c7ca2[_0xb0b1('0x57')]]['calleridnum']=queues[_0x1c7ca2[_0xb0b1('0x4f')]][_0xb0b1('0x9')];queues[_0x1c7ca2[_0xb0b1('0x57')]][_0xb0b1('0x58')]=queues[_0x1c7ca2[_0xb0b1('0x4f')]][_0xb0b1('0x58')];queues[_0x1c7ca2[_0xb0b1('0x57')]][_0xb0b1('0x35')]=utils['now']();queues[_0x1c7ca2[_0xb0b1('0x57')]]['queuecallerleaveAt']=utils[_0xb0b1('0x1a')]();queues[_0x1c7ca2[_0xb0b1('0x57')]]['holdtime']=0x0;queues[_0x1c7ca2[_0xb0b1('0x57')]]['mohtime']=0x0;utils['info'](util[_0xb0b1('0x11')](_0xb0b1('0x60'),_0x1c7ca2[_0xb0b1('0x4e')],queues[_0x1c7ca2[_0xb0b1('0x57')]][_0xb0b1('0x1d')],queues[_0x1c7ca2['transfertargetuniqueid']][_0xb0b1('0xf')],queues[_0x1c7ca2[_0xb0b1('0x57')]][_0xb0b1('0x9')],queues[_0x1c7ca2['transfertargetuniqueid']]['calleridname']));}else{utils[_0xb0b1('0x3')](util[_0xb0b1('0x11')](_0xb0b1('0x5b'),_0x1c7ca2[_0xb0b1('0x4e')],queues[_0x1c7ca2[_0xb0b1('0x50')]][_0xb0b1('0x1d')],_0x1c7ca2[_0xb0b1('0x4f')]));queues[_0x1c7ca2[_0xb0b1('0x50')]][_0xb0b1('0xf')]=_0x1c7ca2[_0xb0b1('0x4f')];}}}}catch(_0x43da31){utils[_0xb0b1('0x13')](util['format']('[%s][queues][attendedtransfer]',_0x1c7ca2[_0xb0b1('0x4e')]),_0x43da31);}};exports[_0xb0b1('0x61')]=function(_0x57b642){try{if(!_['isNil'](queues[_0x57b642[_0xb0b1('0x5')]])){utils[_0xb0b1('0x16')](util[_0xb0b1('0x11')](_0xb0b1('0x62'),_0x57b642['uniqueid']),_0x57b642);queues[_0x57b642['uniqueid']]['musiconholdstartAt']=utils[_0xb0b1('0x1a')]();utils[_0xb0b1('0x3')](util[_0xb0b1('0x11')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x57b642[_0xb0b1('0x5')],queues[_0x57b642['uniqueid']][_0xb0b1('0x1d')],queues[_0x57b642[_0xb0b1('0x5')]][_0xb0b1('0x63')]));}}catch(_0x3fb35e){utils[_0xb0b1('0x13')](util['format'](_0xb0b1('0x62'),_0x57b642[_0xb0b1('0x5')]),_0x3fb35e);}};exports[_0xb0b1('0x64')]=function(_0x532a35){try{if(!_['isNil'](queues[_0x532a35['uniqueid']])){if(!_[_0xb0b1('0x23')](queues[_0x532a35[_0xb0b1('0x5')]][_0xb0b1('0x63')])){utils[_0xb0b1('0x16')](util[_0xb0b1('0x11')](_0xb0b1('0x65'),_0x532a35[_0xb0b1('0x5')]),_0x532a35);queues[_0x532a35[_0xb0b1('0x5')]][_0xb0b1('0x59')]+=utils[_0xb0b1('0x34')](utils[_0xb0b1('0x1a')](),queues[_0x532a35[_0xb0b1('0x5')]][_0xb0b1('0x63')]);utils[_0xb0b1('0x3')](util[_0xb0b1('0x11')](_0xb0b1('0x66'),_0x532a35[_0xb0b1('0x5')],queues[_0x532a35[_0xb0b1('0x5')]]['name'],queues[_0x532a35[_0xb0b1('0x5')]][_0xb0b1('0x59')]));delete queues[_0x532a35[_0xb0b1('0x5')]]['musiconholdstartAt'];}}}catch(_0x4d0a54){utils[_0xb0b1('0x13')](util[_0xb0b1('0x11')](_0xb0b1('0x65'),_0x532a35[_0xb0b1('0x5')]),_0x4d0a54);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 663a352..788bdb1 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 _0x582e=['toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','info','format','uniqueid','getUserByInternal','accountcode','membername','UserId','request','CreateVoiceRecording','debug','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','newstate','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','linkedid','transfer','varset','variable','mixmonitor_filename','[%s][recordings][varset]','value','endsWith','.wav49','.WAV','find','monitors','push','error','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','calleridnum','connectedlinenum','outbound','forEach','clone','newexten','[%s][recordings][newexten]','application','appdata'];(function(_0x286726,_0x20a337){var _0xcd4fe9=function(_0x4d7da6){while(--_0x4d7da6){_0x286726['push'](_0x286726['shift']());}};_0xcd4fe9(++_0x20a337);}(_0x582e,0x166));var _0xe582=function(_0x20acdb,_0x210c8e){_0x20acdb=_0x20acdb-0x0;var _0x383b0d=_0x582e[_0x20acdb];return _0x383b0d;};'use strict';var _=require(_0xe582('0x0'));var util=require('util');var utils=require('./utils');var recordings={};function writeDB(_0x4e5bba){utils[_0xe582('0x1')](util[_0xe582('0x2')]('[%s][recordings][writeDB]',_0x4e5bba[_0xe582('0x3')]));if(_0x4e5bba['accountcode']){utils[_0xe582('0x4')](_0x4e5bba[_0xe582('0x5')])['then'](function(_0xcae801){if(_0xcae801){_0x4e5bba[_0xe582('0x6')]=_0xcae801['name'];_0x4e5bba[_0xe582('0x7')]=_0xcae801['id'];}utils[_0xe582('0x8')](_0xe582('0x9'),_0x4e5bba);});}else{utils['request'](_0xe582('0x9'),_0x4e5bba);}}exports['newchannel']=function(_0x39fd30){try{utils[_0xe582('0xa')](util['format'](_0xe582('0xb'),_0x39fd30['uniqueid']),_0x39fd30);if(_0x39fd30['uniqueid']==_0x39fd30['linkedid']){utils[_0xe582('0x1')](util[_0xe582('0x2')](_0xe582('0xc'),_0x39fd30[_0xe582('0x3')],_0x39fd30['context'],_0x39fd30[_0xe582('0xd')]));recordings[_0x39fd30['uniqueid']]={'uniqueid':_0x39fd30['uniqueid'],'accountcode':_0x39fd30['accountcode'],'exten':_0x39fd30['exten'],'context':_0x39fd30[_0xe582('0xe')],'channel':_0x39fd30['channel'],'monitors':[]};}}catch(_0x4aaf7c){utils['error'](util[_0xe582('0x2')](_0xe582('0xb'),_0x39fd30[_0xe582('0x3')]),_0x4aaf7c);}};exports[_0xe582('0xf')]=function(_0x1759e3){try{utils[_0xe582('0xa')](util[_0xe582('0x2')](_0xe582('0x10'),_0x1759e3['uniqueid']),_0x1759e3);if(!_[_0xe582('0x11')](recordings[_0x1759e3[_0xe582('0x3')]])&&_0x1759e3['channelstate']==0x6){utils[_0xe582('0x1')](util[_0xe582('0x2')](_0xe582('0x12'),_0x1759e3['uniqueid'],_0x1759e3['context'],_0x1759e3[_0xe582('0x13')]));}else if(!_[_0xe582('0x11')](recordings[_0x1759e3[_0xe582('0x14')]])&&_0x1759e3['channelstate']==0x6&&_0x1759e3[_0xe582('0xe')]!=_0xe582('0x15')){utils[_0xe582('0x1')](util[_0xe582('0x2')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x1759e3[_0xe582('0x3')],_0x1759e3[_0xe582('0x14')],_0x1759e3[_0xe582('0xe')],_0x1759e3[_0xe582('0x13')]));recordings[_0x1759e3[_0xe582('0x14')]][_0xe582('0x5')]=_0x1759e3['accountcode'];}}catch(_0x3c5489){utils['error'](util[_0xe582('0x2')]('[%s][recordings][newstate]',_0x1759e3['uniqueid']),_0x3c5489);}};exports[_0xe582('0x16')]=function(_0xd14555){try{if(!_['isNil'](_0xd14555[_0xe582('0x17')])&&!_[_0xe582('0x11')](_0xd14555[_0xe582('0x17')][_0xe582('0x18')])){utils[_0xe582('0xa')](util[_0xe582('0x2')](_0xe582('0x19'),_0xd14555[_0xe582('0x3')]),_0xd14555);utils['info'](util[_0xe582('0x2')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0xd14555['uniqueid'],_0xd14555['variable'],_0xd14555[_0xe582('0x1a')]));if(_[_0xe582('0x1b')](_0xd14555[_0xe582('0x1a')],_0xe582('0x1c'))){_0xd14555[_0xe582('0x1a')]=_0xd14555['value']['replace']('.wav49',_0xe582('0x1d'));}if(recordings[_0xd14555[_0xe582('0x14')]]){var _0x3b71a9=_[_0xe582('0x1e')](recordings[_0xd14555[_0xe582('0x14')]][_0xe582('0x1f')],{'value':_0xd14555[_0xe582('0x1a')]});if(_[_0xe582('0x11')](_0x3b71a9)){recordings[_0xd14555[_0xe582('0x14')]]['monitors'][_0xe582('0x20')]({'value':_0xd14555[_0xe582('0x1a')]});}}}}catch(_0x3d672e){utils[_0xe582('0x21')](util[_0xe582('0x2')](_0xe582('0x19'),_0xd14555['uniqueid']),_0x3d672e);}};exports[_0xe582('0x22')]=function(_0x551387){try{if(!_[_0xe582('0x11')](recordings[_0x551387[_0xe582('0x3')]])){utils[_0xe582('0xa')](util['format'](_0xe582('0x23'),_0x551387['uniqueid']),_0x551387);utils[_0xe582('0x1')](util[_0xe582('0x2')](_0xe582('0x24'),_0x551387[_0xe582('0x3')],_0x551387['calleridnum'],_0x551387[_0xe582('0x25')],_0x551387[_0xe582('0x26')]));recordings[_0x551387['uniqueid']]['calleridnum']=_0x551387[_0xe582('0x27')];recordings[_0x551387[_0xe582('0x3')]][_0xe582('0x25')]=_0x551387[_0xe582('0x25')];recordings[_0x551387['uniqueid']][_0xe582('0x28')]=_0x551387[_0xe582('0x28')];recordings[_0x551387['uniqueid']]['connectedlinename']=_0x551387['connectedlinename'];if(recordings[_0x551387['uniqueid']]['type']==_0xe582('0x29')&&recordings[_0x551387['uniqueid']][_0xe582('0x5')]){recordings[_0x551387[_0xe582('0x3')]]['connectedlinenum']=recordings[_0x551387[_0xe582('0x3')]][_0xe582('0x5')];recordings[_0x551387['uniqueid']]['connectedlinename']='';}recordings[_0x551387[_0xe582('0x3')]]['monitors'][_0xe582('0x2a')](function(_0x3f045a){var _0x56b375=_[_0xe582('0x2b')](recordings[_0x551387['uniqueid']]);_0x56b375[_0xe582('0x1a')]=_0x3f045a[_0xe582('0x1a')];writeDB(_0x56b375);});delete recordings[_0x551387['uniqueid']];}}catch(_0x43739e){utils[_0xe582('0x21')](util['format'](_0xe582('0x23'),_0x551387[_0xe582('0x3')]),_0x43739e);}};exports[_0xe582('0x2c')]=function(_0x36a2ed){try{if(!_[_0xe582('0x11')](recordings[_0x36a2ed['uniqueid']])){utils['debug'](util[_0xe582('0x2')](_0xe582('0x2d'),_0x36a2ed[_0xe582('0x3')]),_0x36a2ed);utils[_0xe582('0x1')](util[_0xe582('0x2')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x36a2ed[_0xe582('0x3')],_0x36a2ed[_0xe582('0x2e')],_0x36a2ed[_0xe582('0x2f')]));if(_0x36a2ed[_0xe582('0x2e')][_0xe582('0x30')]()==_0xe582('0x31')&&_[_0xe582('0x32')](_0x36a2ed[_0xe582('0x2f')][_0xe582('0x30')](),_0xe582('0x33'))){var _0x369647=_0x36a2ed['appdata'][_0xe582('0x34')]('=');var _0x361779=_0x369647[0x0][_0xe582('0x35')](_0x369647[0x0][_0xe582('0x36')]('(')+0x1,_0x369647[0x0][_0xe582('0x36')](')'));var _0x78dc9f=_0x369647[0x1];recordings[_0x36a2ed[_0xe582('0x3')]][_0x361779]=_0x78dc9f;}}}catch(_0x5a26bb){utils[_0xe582('0x21')](util[_0xe582('0x2')](_0xe582('0x2d'),_0x36a2ed['uniqueid']),_0x5a26bb);}};exports[_0xe582('0x37')]=function(_0x51b14d){try{if(!_[_0xe582('0x11')](recordings[_0x51b14d[_0xe582('0x3')]])){utils[_0xe582('0xa')](util[_0xe582('0x2')]('[%s][recordings][queuecallerjoin]',_0x51b14d[_0xe582('0x3')]),_0x51b14d);utils[_0xe582('0x1')](util[_0xe582('0x2')](_0xe582('0x38'),_0x51b14d[_0xe582('0x3')],_0x51b14d[_0xe582('0x39')]));recordings[_0x51b14d[_0xe582('0x3')]]['queue']=_0x51b14d['queue'];}}catch(_0x5e91b6){utils[_0xe582('0x21')](util[_0xe582('0x2')]('[%s][recordings][queuecallerjoin]',_0x51b14d[_0xe582('0x3')]),_0x5e91b6);}}; \ No newline at end of file +var _0x6df7=['util','./utils','info','format','getUserByInternal','membername','name','UserId','CreateVoiceRecording','request','newchannel','debug','[%s][recordings][newchannel]','uniqueid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','accountcode','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace','.WAV','monitors','push','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','type','forEach','newexten','[%s][recordings][newexten]','application','toLowerCase','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash'];(function(_0x3acdc1,_0x3d1806){var _0x2dce8b=function(_0x392e64){while(--_0x392e64){_0x3acdc1['push'](_0x3acdc1['shift']());}};_0x2dce8b(++_0x3d1806);}(_0x6df7,0xf3));var _0x76df=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x6df7[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x76df('0x0'));var util=require(_0x76df('0x1'));var utils=require(_0x76df('0x2'));var recordings={};function writeDB(_0x351c1a){utils[_0x76df('0x3')](util[_0x76df('0x4')]('[%s][recordings][writeDB]',_0x351c1a['uniqueid']));if(_0x351c1a['accountcode']){utils[_0x76df('0x5')](_0x351c1a['accountcode'])['then'](function(_0x584da4){if(_0x584da4){_0x351c1a[_0x76df('0x6')]=_0x584da4[_0x76df('0x7')];_0x351c1a[_0x76df('0x8')]=_0x584da4['id'];}utils['request'](_0x76df('0x9'),_0x351c1a);});}else{utils[_0x76df('0xa')](_0x76df('0x9'),_0x351c1a);}}exports[_0x76df('0xb')]=function(_0x512d02){try{utils[_0x76df('0xc')](util['format'](_0x76df('0xd'),_0x512d02['uniqueid']),_0x512d02);if(_0x512d02[_0x76df('0xe')]==_0x512d02['linkedid']){utils[_0x76df('0x3')](util[_0x76df('0x4')](_0x76df('0xf'),_0x512d02[_0x76df('0xe')],_0x512d02[_0x76df('0x10')],_0x512d02[_0x76df('0x11')]));recordings[_0x512d02[_0x76df('0xe')]]={'uniqueid':_0x512d02['uniqueid'],'accountcode':_0x512d02['accountcode'],'exten':_0x512d02[_0x76df('0x11')],'context':_0x512d02[_0x76df('0x10')],'channel':_0x512d02[_0x76df('0x12')],'monitors':[]};}}catch(_0x4b379e){utils[_0x76df('0x13')](util['format'](_0x76df('0xd'),_0x512d02[_0x76df('0xe')]),_0x4b379e);}};exports['newstate']=function(_0x38133d){try{utils[_0x76df('0xc')](util['format'](_0x76df('0x14'),_0x38133d['uniqueid']),_0x38133d);if(!_[_0x76df('0x15')](recordings[_0x38133d[_0x76df('0xe')]])&&_0x38133d[_0x76df('0x16')]==0x6){utils[_0x76df('0x3')](util[_0x76df('0x4')](_0x76df('0x17'),_0x38133d[_0x76df('0xe')],_0x38133d[_0x76df('0x10')],_0x38133d['channel']));}else if(!_[_0x76df('0x15')](recordings[_0x38133d[_0x76df('0x18')]])&&_0x38133d[_0x76df('0x16')]==0x6&&_0x38133d[_0x76df('0x10')]!=_0x76df('0x19')){utils[_0x76df('0x3')](util[_0x76df('0x4')](_0x76df('0x1a'),_0x38133d[_0x76df('0xe')],_0x38133d[_0x76df('0x18')],_0x38133d['context'],_0x38133d[_0x76df('0x12')]));recordings[_0x38133d['linkedid']]['accountcode']=_0x38133d[_0x76df('0x1b')];}}catch(_0x5c2af6){utils[_0x76df('0x13')](util[_0x76df('0x4')](_0x76df('0x14'),_0x38133d[_0x76df('0xe')]),_0x5c2af6);}};exports[_0x76df('0x1c')]=function(_0x1bfbff){try{if(!_['isNil'](_0x1bfbff[_0x76df('0x1d')])&&!_[_0x76df('0x15')](_0x1bfbff[_0x76df('0x1d')][_0x76df('0x1e')])){utils[_0x76df('0xc')](util[_0x76df('0x4')](_0x76df('0x1f'),_0x1bfbff[_0x76df('0xe')]),_0x1bfbff);utils[_0x76df('0x3')](util[_0x76df('0x4')](_0x76df('0x20'),_0x1bfbff[_0x76df('0xe')],_0x1bfbff['variable'],_0x1bfbff[_0x76df('0x21')]));if(_[_0x76df('0x22')](_0x1bfbff[_0x76df('0x21')],'.wav49')){_0x1bfbff[_0x76df('0x21')]=_0x1bfbff['value'][_0x76df('0x23')]('.wav49',_0x76df('0x24'));}if(recordings[_0x1bfbff[_0x76df('0x18')]]){var _0x451c00=_['find'](recordings[_0x1bfbff['linkedid']]['monitors'],{'value':_0x1bfbff[_0x76df('0x21')]});if(_[_0x76df('0x15')](_0x451c00)){recordings[_0x1bfbff[_0x76df('0x18')]][_0x76df('0x25')][_0x76df('0x26')]({'value':_0x1bfbff['value']});}}}}catch(_0x5288de){utils[_0x76df('0x13')](util[_0x76df('0x4')](_0x76df('0x1f'),_0x1bfbff[_0x76df('0xe')]),_0x5288de);}};exports['hangup']=function(_0x12ba09){try{if(!_['isNil'](recordings[_0x12ba09[_0x76df('0xe')]])){utils['debug'](util[_0x76df('0x4')](_0x76df('0x27'),_0x12ba09['uniqueid']),_0x12ba09);utils[_0x76df('0x3')](util['format'](_0x76df('0x28'),_0x12ba09[_0x76df('0xe')],_0x12ba09[_0x76df('0x29')],_0x12ba09['calleridname'],_0x12ba09['cause-txt']));recordings[_0x12ba09[_0x76df('0xe')]][_0x76df('0x29')]=_0x12ba09[_0x76df('0x29')];recordings[_0x12ba09[_0x76df('0xe')]][_0x76df('0x2a')]=_0x12ba09[_0x76df('0x2a')];recordings[_0x12ba09[_0x76df('0xe')]][_0x76df('0x2b')]=_0x12ba09['connectedlinenum'];recordings[_0x12ba09[_0x76df('0xe')]]['connectedlinename']=_0x12ba09[_0x76df('0x2c')];if(recordings[_0x12ba09[_0x76df('0xe')]][_0x76df('0x2d')]=='outbound'&&recordings[_0x12ba09['uniqueid']][_0x76df('0x1b')]){recordings[_0x12ba09[_0x76df('0xe')]][_0x76df('0x2b')]=recordings[_0x12ba09['uniqueid']]['accountcode'];recordings[_0x12ba09[_0x76df('0xe')]][_0x76df('0x2c')]='';}recordings[_0x12ba09[_0x76df('0xe')]][_0x76df('0x25')][_0x76df('0x2e')](function(_0x2b3a62){var _0x119d65=_['clone'](recordings[_0x12ba09['uniqueid']]);_0x119d65['value']=_0x2b3a62['value'];writeDB(_0x119d65);});delete recordings[_0x12ba09['uniqueid']];}}catch(_0x17a34d){utils['error'](util['format'](_0x76df('0x27'),_0x12ba09['uniqueid']),_0x17a34d);}};exports[_0x76df('0x2f')]=function(_0x39816e){try{if(!_['isNil'](recordings[_0x39816e['uniqueid']])){utils[_0x76df('0xc')](util['format'](_0x76df('0x30'),_0x39816e['uniqueid']),_0x39816e);utils[_0x76df('0x3')](util['format']('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x39816e['uniqueid'],_0x39816e[_0x76df('0x31')],_0x39816e['appdata']));if(_0x39816e['application'][_0x76df('0x32')]()=='set'&&_[_0x76df('0x33')](_0x39816e[_0x76df('0x34')]['toLowerCase'](),_0x76df('0x35'))){var _0x1f7d03=_0x39816e[_0x76df('0x34')][_0x76df('0x36')]('=');var _0x24d21b=_0x1f7d03[0x0][_0x76df('0x37')](_0x1f7d03[0x0][_0x76df('0x38')]('(')+0x1,_0x1f7d03[0x0][_0x76df('0x38')](')'));var _0x27030b=_0x1f7d03[0x1];recordings[_0x39816e[_0x76df('0xe')]][_0x24d21b]=_0x27030b;}}}catch(_0x7bd0d2){utils[_0x76df('0x13')](util[_0x76df('0x4')](_0x76df('0x30'),_0x39816e[_0x76df('0xe')]),_0x7bd0d2);}};exports[_0x76df('0x39')]=function(_0x3c9948){try{if(!_[_0x76df('0x15')](recordings[_0x3c9948[_0x76df('0xe')]])){utils[_0x76df('0xc')](util[_0x76df('0x4')](_0x76df('0x3a'),_0x3c9948[_0x76df('0xe')]),_0x3c9948);utils[_0x76df('0x3')](util[_0x76df('0x4')](_0x76df('0x3b'),_0x3c9948[_0x76df('0xe')],_0x3c9948[_0x76df('0x3c')]));recordings[_0x3c9948[_0x76df('0xe')]][_0x76df('0x3c')]=_0x3c9948[_0x76df('0x3c')];}}catch(_0x1c6dca){utils[_0x76df('0x13')](util[_0x76df('0x4')](_0x76df('0x3a'),_0x3c9948[_0x76df('0xe')]),_0x1c6dca);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 5d8310b..dee4c88 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 _0xb903=['origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','isNil','transfereechannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','CreateVoiceTransferReport','blinds','blindtransfer','uniqueid','transferercalleridnum','transfereecalleridname','blind','transfereruniqueid','[%s][transfers][blindtransfer]','debug','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename'];(function(_0x1c25b1,_0x2501e1){var _0x10fa15=function(_0x56395f){while(--_0x56395f){_0x1c25b1['push'](_0x1c25b1['shift']());}};_0x10fa15(++_0x2501e1);}(_0xb903,0x87));var _0x3b90=function(_0x3b6fad,_0x382fcf){_0x3b6fad=_0x3b6fad-0x0;var _0x3db98d=_0xb903[_0x3b6fad];return _0x3db98d;};'use strict';var _=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var utils=require(_0x3b90('0x2'));function writeDB(_0x525f66){utils[_0x3b90('0x3')](util[_0x3b90('0x4')](_0x3b90('0x5'),_0x525f66[_0x3b90('0x6')]===_0x3b90('0x7')?_0x525f66[_0x3b90('0x8')]:_0x525f66['uniqueid'],_0x525f66[_0x3b90('0x6')]));utils['request'](_0x3b90('0x9'),_0x525f66);}exports[_0x3b90('0xa')]={};exports[_0x3b90('0xb')]=function(_0x3c73e6){try{utils['debug'](util[_0x3b90('0x4')]('[%s][transfers][blindtransfer]',_0x3c73e6[_0x3b90('0xc')]),_0x3c73e6);utils[_0x3b90('0x3')](util[_0x3b90('0x4')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x3c73e6[_0x3b90('0xc')],_0x3c73e6[_0x3b90('0xd')],_0x3c73e6['transferercalleridname'],_0x3c73e6['transfereecalleridnum'],_0x3c73e6[_0x3b90('0xe')]));_0x3c73e6[_0x3b90('0x6')]=_0x3b90('0xf');exports[_0x3b90('0xa')][_0x3c73e6[_0x3b90('0x10')]]=_0x3c73e6;writeDB(_0x3c73e6);}catch(_0x732df5){utils['error'](util[_0x3b90('0x4')](_0x3b90('0x11'),_0x3c73e6['uniqueid']),_0x732df5);}};exports['attendedtransfer']=function(_0x1711d7){try{utils[_0x3b90('0x12')](util[_0x3b90('0x4')](_0x3b90('0x13'),_0x1711d7[_0x3b90('0x8')]),_0x1711d7);utils[_0x3b90('0x3')](util['format'](_0x3b90('0x14'),_0x1711d7['origtransfereruniqueid'],_0x1711d7[_0x3b90('0x15')],_0x1711d7[_0x3b90('0x16')],_0x1711d7[_0x3b90('0x17')],_0x1711d7[_0x3b90('0x18')]));_0x1711d7=_[_0x3b90('0x19')](_0x1711d7,{'transfererchannel':_0x1711d7[_0x3b90('0x1a')],'transferercalleridnum':_0x1711d7[_0x3b90('0x15')],'transferercalleridname':_0x1711d7[_0x3b90('0x16')],'transfererconnectedlinenum':_0x1711d7[_0x3b90('0x1b')],'transfererconnectedlinename':_0x1711d7[_0x3b90('0x1c')],'transfereraccountcode':_0x1711d7[_0x3b90('0x1d')],'transferercontext':_0x1711d7[_0x3b90('0x1e')],'transfererexten':_0x1711d7[_0x3b90('0x1f')],'transfererlinkedid':_0x1711d7[_0x3b90('0x20')],'context':_0x1711d7['origtransferercontext'],'extension':_0x1711d7['origtransfererexten'],'type':_0x3b90('0x7')});if(_[_0x3b90('0x21')](_0x1711d7[_0x3b90('0x22')])){_0x1711d7=_['assign'](_0x1711d7,{'transfereechannel':_0x1711d7['transfertargetchannel'],'transfereecalleridnum':_0x1711d7[_0x3b90('0x17')],'transfereecalleridname':_0x1711d7[_0x3b90('0x18')],'transfereeconnectedlinenum':_0x1711d7[_0x3b90('0x23')],'transfereeconnectedlinename':_0x1711d7['transfertargetconnectedlinename'],'transfereeaccountcode':_0x1711d7[_0x3b90('0x24')],'transfereecontext':_0x1711d7[_0x3b90('0x25')],'transfereeexten':_0x1711d7[_0x3b90('0x26')],'transfereelinkedid':_0x1711d7[_0x3b90('0x27')]});}writeDB(_0x1711d7);}catch(_0x32d9e6){utils[_0x3b90('0x28')](util[_0x3b90('0x4')]('[%s][transfers][attendedtransfer]',_0x1711d7[_0x3b90('0x8')]),_0x32d9e6);}}; \ No newline at end of file +var _0xc8dc=['attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','lodash','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','uniqueid','CreateVoiceTransferReport','blinds','blindtransfer','debug','format','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xc8dc,0xbe));var _0xcc8d=function(_0x53d578,_0x4ca37f){_0x53d578=_0x53d578-0x0;var _0x5ce805=_0xc8dc[_0x53d578];return _0x5ce805;};'use strict';var _=require(_0xcc8d('0x0'));var util=require(_0xcc8d('0x1'));var utils=require(_0xcc8d('0x2'));function writeDB(_0x15debf){utils[_0xcc8d('0x3')](util['format'](_0xcc8d('0x4'),_0x15debf[_0xcc8d('0x5')]==='attended'?_0x15debf['origtransfereruniqueid']:_0x15debf[_0xcc8d('0x6')],_0x15debf[_0xcc8d('0x5')]));utils['request'](_0xcc8d('0x7'),_0x15debf);}exports[_0xcc8d('0x8')]={};exports[_0xcc8d('0x9')]=function(_0x22010c){try{utils[_0xcc8d('0xa')](util[_0xcc8d('0xb')](_0xcc8d('0xc'),_0x22010c[_0xcc8d('0x6')]),_0x22010c);utils[_0xcc8d('0x3')](util[_0xcc8d('0xb')](_0xcc8d('0xd'),_0x22010c['uniqueid'],_0x22010c[_0xcc8d('0xe')],_0x22010c[_0xcc8d('0xf')],_0x22010c[_0xcc8d('0x10')],_0x22010c[_0xcc8d('0x11')]));_0x22010c['type']=_0xcc8d('0x12');exports[_0xcc8d('0x8')][_0x22010c['transfereruniqueid']]=_0x22010c;writeDB(_0x22010c);}catch(_0x2584f3){utils[_0xcc8d('0x13')](util[_0xcc8d('0xb')](_0xcc8d('0xc'),_0x22010c[_0xcc8d('0x6')]),_0x2584f3);}};exports[_0xcc8d('0x14')]=function(_0x13b004){try{utils[_0xcc8d('0xa')](util[_0xcc8d('0xb')](_0xcc8d('0x15'),_0x13b004[_0xcc8d('0x16')]),_0x13b004);utils[_0xcc8d('0x3')](util[_0xcc8d('0xb')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x13b004[_0xcc8d('0x16')],_0x13b004[_0xcc8d('0x17')],_0x13b004[_0xcc8d('0x18')],_0x13b004[_0xcc8d('0x19')],_0x13b004[_0xcc8d('0x1a')]));_0x13b004=_[_0xcc8d('0x1b')](_0x13b004,{'transfererchannel':_0x13b004[_0xcc8d('0x1c')],'transferercalleridnum':_0x13b004[_0xcc8d('0x17')],'transferercalleridname':_0x13b004[_0xcc8d('0x18')],'transfererconnectedlinenum':_0x13b004[_0xcc8d('0x1d')],'transfererconnectedlinename':_0x13b004['secondtransfererconnectedlinename'],'transfereraccountcode':_0x13b004['origtransfereraccountcode'],'transferercontext':_0x13b004[_0xcc8d('0x1e')],'transfererexten':_0x13b004[_0xcc8d('0x1f')],'transfererlinkedid':_0x13b004['origtransfererlinkedid'],'context':_0x13b004[_0xcc8d('0x20')],'extension':_0x13b004[_0xcc8d('0x21')],'type':'attended'});if(_[_0xcc8d('0x22')](_0x13b004[_0xcc8d('0x23')])){_0x13b004=_[_0xcc8d('0x1b')](_0x13b004,{'transfereechannel':_0x13b004[_0xcc8d('0x24')],'transfereecalleridnum':_0x13b004[_0xcc8d('0x19')],'transfereecalleridname':_0x13b004[_0xcc8d('0x1a')],'transfereeconnectedlinenum':_0x13b004[_0xcc8d('0x25')],'transfereeconnectedlinename':_0x13b004[_0xcc8d('0x26')],'transfereeaccountcode':_0x13b004[_0xcc8d('0x27')],'transfereecontext':_0x13b004[_0xcc8d('0x28')],'transfereeexten':_0x13b004['transfertargetexten'],'transfereelinkedid':_0x13b004[_0xcc8d('0x29')]});}writeDB(_0x13b004);}catch(_0x285413){utils[_0xcc8d('0x13')](util['format']('[%s][transfers][attendedtransfer]',_0x13b004[_0xcc8d('0x16')]),_0x285413);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index d94a38c..554619f 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 _0x9541=['YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','../../config/logger','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','catch','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]','acw','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format'];(function(_0x90f39,_0x17382e){var _0x220c6a=function(_0x588f12){while(--_0x588f12){_0x90f39['push'](_0x90f39['shift']());}};_0x220c6a(++_0x17382e);}(_0x9541,0x8f));var _0x1954=function(_0x242e5a,_0x5ea6ac){_0x242e5a=_0x242e5a-0x0;var _0x5aa904=_0x9541[_0x242e5a];return _0x5aa904;};'use strict';var BPromise=require(_0x1954('0x0'));var jayson=require(_0x1954('0x1'));var moment=require(_0x1954('0x2'));var util=require(_0x1954('0x3'));var client=jayson[_0x1954('0x4')]['http']({'port':0x2329});var logger=require(_0x1954('0x5'))(_0x1954('0x6'));exports[_0x1954('0x7')]=function(_0x2e0c68,_0x3ffc0b){logger[_0x1954('0x7')](_0x2e0c68,_0x3ffc0b?util['inspect'](_0x3ffc0b,{'showHidden':![],'depth':null}):'');};exports[_0x1954('0x8')]=function(_0x5748dd,_0x2f9a94){logger[_0x1954('0x8')](_0x5748dd,_0x2f9a94?util[_0x1954('0x9')](_0x2f9a94,{'showHidden':![],'depth':null}):'');};exports[_0x1954('0xa')]=function(_0x5774e0,_0x110e51){logger['error'](_0x5774e0,_0x110e51?util[_0x1954('0x9')](_0x110e51,{'showHidden':![],'depth':null}):'');};exports[_0x1954('0xb')]=function(_0x4b53ab,_0x3403d6){return client[_0x1954('0xb')](_0x4b53ab,{'body':_0x3403d6})[_0x1954('0xc')](function(_0x5aa9a0){logger[_0x1954('0x8')](_0x1954('0xd'),_0x4b53ab,_0x5aa9a0?util[_0x1954('0x9')](_0x5aa9a0,{'showHidden':![],'depth':null}):'');})[_0x1954('0xe')](function(_0x26c5ce){logger[_0x1954('0xa')](_0x1954('0xd'),_0x4b53ab,_0x26c5ce?util[_0x1954('0x9')](_0x26c5ce,{'showHidden':![],'depth':null}):'');});};function getUser(_0x5db69b){return client[_0x1954('0xb')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x1954('0xf'),_0x1954('0x10'),_0x1954('0x11')],'where':_0x5db69b,'limit':0x1}})['then'](function(_0x2e04e7){logger['debug'](_0x1954('0x12'),JSON[_0x1954('0x13')](_0x5db69b),_0x2e04e7?util[_0x1954('0x9')](_0x2e04e7,{'showHidden':![],'depth':null}):'');return _0x2e04e7[_0x1954('0x14')][_0x1954('0x15')]?_0x2e04e7['result'][0x0]:null;});}exports[_0x1954('0x16')]=function(_0x2b6cc0){return new BPromise(function(_0x264c20,_0x3f125a){if(_0x2b6cc0){return getUser({'internal':_0x2b6cc0})[_0x1954('0xc')](function(_0x1eb55e){logger[_0x1954('0x7')](_0x1954('0x17'),_0x2b6cc0,_0x1eb55e?_0x1954('0x18'):_0x1954('0x19'));return _0x264c20(_0x1eb55e);})[_0x1954('0xe')](function(_0x10e8fe){logger[_0x1954('0xa')](_0x1954('0x1a'),_0x10e8fe?util[_0x1954('0x9')](_0x10e8fe,{'showHidden':![],'depth':null}):'');return _0x264c20(null);});}return _0x264c20(null);});};exports['getUserByInterface']=function(_0x1a4606){return new BPromise(function(_0x5a8c4e,_0x5c0e80){if(_0x1a4606){return getUser({'interface':_0x1a4606})['then'](function(_0x3dd702){logger[_0x1954('0x7')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x1a4606,_0x3dd702?_0x1954('0x18'):_0x1954('0x19'));return _0x5a8c4e(_0x3dd702);})[_0x1954('0xe')](function(_0x4c2361){logger[_0x1954('0xa')](_0x1954('0x1b'),_0x4c2361?util['inspect'](_0x4c2361,{'showHidden':![],'depth':null}):'');return _0x5a8c4e(null);});}return _0x5a8c4e(null);});};exports[_0x1954('0x1c')]=function(_0x9da53e){return new BPromise(function(_0xe51075,_0x2bdbd0){if(_0x9da53e){return getUser({'name':_0x9da53e})[_0x1954('0xc')](function(_0x11cb8a){logger['info']('[utils][getUserByName]\x20name:%s\x20%s',_0x9da53e,_0x11cb8a?_0x1954('0x18'):_0x1954('0x19'));return _0xe51075(_0x11cb8a);})[_0x1954('0xe')](function(_0x4ecdd1){logger[_0x1954('0xa')](_0x1954('0x1d'),_0x4ecdd1?util[_0x1954('0x9')](_0x4ecdd1,{'showHidden':![],'depth':null}):'');return _0xe51075(null);});}return _0xe51075(null);});};exports['getVoiceQueueByName']=function(_0x5a2566){return new BPromise(function(_0x70a102,_0x486fc7){if(_0x5a2566){return client[_0x1954('0xb')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x1954('0x10'),'type',_0x1954('0x1e'),'acwTimeout'],'where':{'name':_0x5a2566},'limit':0x1}})[_0x1954('0xc')](function(_0xe98fe0){logger[_0x1954('0x8')]('[utils][getVoiceQueueByName]\x20name:%s',_0x5a2566,_0xe98fe0?util['inspect'](_0xe98fe0,{'showHidden':![],'depth':null}):'');logger[_0x1954('0x7')](_0x1954('0x1f'),_0x5a2566,_0xe98fe0?_0x1954('0x18'):'notfound');return _0x70a102(_0xe98fe0['result'][_0x1954('0x15')]?_0xe98fe0[_0x1954('0x14')][0x0]:null);})[_0x1954('0xe')](function(_0x341e5b){logger[_0x1954('0xa')](_0x1954('0x20'),_0x341e5b?util[_0x1954('0x9')](_0x341e5b,{'showHidden':![],'depth':null}):'');return _0x70a102(null);});}return _0x70a102(null);});};exports[_0x1954('0x21')]=function(_0x17a357,_0xab22af){return moment(_0x17a357)[_0x1954('0x22')](_0xab22af,_0x1954('0x23'))[_0x1954('0x24')](_0x1954('0x25'));};exports[_0x1954('0x26')]=function(_0x571cdc,_0xf037d7){return moment(_0x571cdc)[_0x1954('0x27')](_0xf037d7,_0x1954('0x23'))['format'](_0x1954('0x25'));};exports['diffTime']=function(_0x3b7036,_0x3e0fb8){return moment(_0x3b7036)[_0x1954('0x28')](moment(_0x3e0fb8),'seconds');};exports[_0x1954('0x29')]=function(_0x27a233,_0x138d66){return parseInt(_0x27a233,0xa)+parseInt(_0x138d66,0xa);};exports[_0x1954('0x2a')]=function(){return moment()[_0x1954('0x24')](_0x1954('0x25'));};exports[_0x1954('0x2b')]=function(_0x5aaffe,_0x5457c1){if(_0x5457c1){return moment(_0x5aaffe)[_0x1954('0x2b')](_0x5457c1);}return!![];};exports[_0x1954('0x2c')]=function(_0x55ed5d,_0xe2f9f6){if(_0xe2f9f6){return moment(_0x55ed5d)['isBefore'](_0xe2f9f6);}else if(_0x55ed5d){return!![];}return![];}; \ No newline at end of file +var _0xa456=['[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','now','isBefore','bluebird','jayson/promise','moment','util','http','../../config/logger','xdr','info','inspect','debug','error','request','[utils][request]\x20name:%s','name','interface','[utils][getUser]\x20where:%s','stringify','result','getUserByInternal','then','notfound','catch','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName'];(function(_0x144b30,_0x77072d){var _0x1bb7bc=function(_0x1082cc){while(--_0x1082cc){_0x144b30['push'](_0x144b30['shift']());}};_0x1bb7bc(++_0x77072d);}(_0xa456,0x142));var _0x6a45=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0xa456[_0x45f951];return _0x24756c;};'use strict';var BPromise=require(_0x6a45('0x0'));var jayson=require(_0x6a45('0x1'));var moment=require(_0x6a45('0x2'));var util=require(_0x6a45('0x3'));var client=jayson['client'][_0x6a45('0x4')]({'port':0x2329});var logger=require(_0x6a45('0x5'))(_0x6a45('0x6'));exports['info']=function(_0x1f0701,_0x40acad){logger[_0x6a45('0x7')](_0x1f0701,_0x40acad?util[_0x6a45('0x8')](_0x40acad,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x25cf8d,_0x26bfc0){logger[_0x6a45('0x9')](_0x25cf8d,_0x26bfc0?util[_0x6a45('0x8')](_0x26bfc0,{'showHidden':![],'depth':null}):'');};exports[_0x6a45('0xa')]=function(_0x4858df,_0x3a5c20){logger['error'](_0x4858df,_0x3a5c20?util[_0x6a45('0x8')](_0x3a5c20,{'showHidden':![],'depth':null}):'');};exports[_0x6a45('0xb')]=function(_0x35ed96,_0x147679){return client[_0x6a45('0xb')](_0x35ed96,{'body':_0x147679})['then'](function(_0x553a67){logger[_0x6a45('0x9')](_0x6a45('0xc'),_0x35ed96,_0x553a67?util['inspect'](_0x553a67,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x511b92){logger[_0x6a45('0xa')](_0x6a45('0xc'),_0x35ed96,_0x511b92?util[_0x6a45('0x8')](_0x511b92,{'showHidden':![],'depth':null}):'');});};function getUser(_0x3f01f6){return client[_0x6a45('0xb')]('GetUser',{'options':{'raw':!![],'attributes':['id','internal',_0x6a45('0xd'),_0x6a45('0xe')],'where':_0x3f01f6,'limit':0x1}})['then'](function(_0x2c20db){logger[_0x6a45('0x9')](_0x6a45('0xf'),JSON[_0x6a45('0x10')](_0x3f01f6),_0x2c20db?util['inspect'](_0x2c20db,{'showHidden':![],'depth':null}):'');return _0x2c20db['result']['length']?_0x2c20db[_0x6a45('0x11')][0x0]:null;});}exports[_0x6a45('0x12')]=function(_0x360b7f){return new BPromise(function(_0x52a055,_0x379c22){if(_0x360b7f){return getUser({'internal':_0x360b7f})[_0x6a45('0x13')](function(_0x3439c8){logger['info']('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x360b7f,_0x3439c8?'found':_0x6a45('0x14'));return _0x52a055(_0x3439c8);})[_0x6a45('0x15')](function(_0x5bdaef){logger[_0x6a45('0xa')](_0x6a45('0x16'),_0x5bdaef?util['inspect'](_0x5bdaef,{'showHidden':![],'depth':null}):'');return _0x52a055(null);});}return _0x52a055(null);});};exports[_0x6a45('0x17')]=function(_0xdf10c6){return new BPromise(function(_0x46a13a,_0x458b99){if(_0xdf10c6){return getUser({'interface':_0xdf10c6})[_0x6a45('0x13')](function(_0x487666){logger['info'](_0x6a45('0x18'),_0xdf10c6,_0x487666?_0x6a45('0x19'):_0x6a45('0x14'));return _0x46a13a(_0x487666);})[_0x6a45('0x15')](function(_0x25a380){logger[_0x6a45('0xa')](_0x6a45('0x1a'),_0x25a380?util[_0x6a45('0x8')](_0x25a380,{'showHidden':![],'depth':null}):'');return _0x46a13a(null);});}return _0x46a13a(null);});};exports[_0x6a45('0x1b')]=function(_0x18a5b8){return new BPromise(function(_0x1310d7,_0x46587a){if(_0x18a5b8){return getUser({'name':_0x18a5b8})['then'](function(_0x3cb4d5){logger['info'](_0x6a45('0x1c'),_0x18a5b8,_0x3cb4d5?_0x6a45('0x19'):_0x6a45('0x14'));return _0x1310d7(_0x3cb4d5);})[_0x6a45('0x15')](function(_0x3ede76){logger['error'](_0x6a45('0x1d'),_0x3ede76?util[_0x6a45('0x8')](_0x3ede76,{'showHidden':![],'depth':null}):'');return _0x1310d7(null);});}return _0x1310d7(null);});};exports[_0x6a45('0x1e')]=function(_0x1ccff0){return new BPromise(function(_0x8265d9,_0x227b6f){if(_0x1ccff0){return client[_0x6a45('0xb')](_0x6a45('0x1f'),{'options':{'raw':!![],'attributes':['id','name',_0x6a45('0x20'),_0x6a45('0x21'),_0x6a45('0x22')],'where':{'name':_0x1ccff0},'limit':0x1}})[_0x6a45('0x13')](function(_0x3b07a1){logger['debug'](_0x6a45('0x23'),_0x1ccff0,_0x3b07a1?util[_0x6a45('0x8')](_0x3b07a1,{'showHidden':![],'depth':null}):'');logger[_0x6a45('0x7')](_0x6a45('0x24'),_0x1ccff0,_0x3b07a1?'found':'notfound');return _0x8265d9(_0x3b07a1[_0x6a45('0x11')]['length']?_0x3b07a1[_0x6a45('0x11')][0x0]:null);})['catch'](function(_0x3dcddf){logger[_0x6a45('0xa')](_0x6a45('0x25'),_0x3dcddf?util[_0x6a45('0x8')](_0x3dcddf,{'showHidden':![],'depth':null}):'');return _0x8265d9(null);});}return _0x8265d9(null);});};exports[_0x6a45('0x26')]=function(_0x3cab47,_0x351e70){return moment(_0x3cab47)[_0x6a45('0x27')](_0x351e70,_0x6a45('0x28'))[_0x6a45('0x29')](_0x6a45('0x2a'));};exports[_0x6a45('0x2b')]=function(_0x44c1cc,_0x483b00){return moment(_0x44c1cc)[_0x6a45('0x2c')](_0x483b00,'seconds')[_0x6a45('0x29')](_0x6a45('0x2a'));};exports[_0x6a45('0x2d')]=function(_0x2b052e,_0x462d1f){return moment(_0x2b052e)[_0x6a45('0x2e')](moment(_0x462d1f),'seconds');};exports[_0x6a45('0x2f')]=function(_0x2abd19,_0x2b75f6){return parseInt(_0x2abd19,0xa)+parseInt(_0x2b75f6,0xa);};exports[_0x6a45('0x30')]=function(){return moment()[_0x6a45('0x29')](_0x6a45('0x2a'));};exports['isAfter']=function(_0x120f79,_0xbd573b){if(_0xbd573b){return moment(_0x120f79)['isAfter'](_0xbd573b);}return!![];};exports[_0x6a45('0x31')]=function(_0x32f014,_0x10cb71){if(_0x10cb71){return moment(_0x32f014)[_0x6a45('0x31')](_0x10cb71);}else if(_0x32f014){return!![];}return![];}; \ No newline at end of file